diff --git a/LeanPool/GraphMinor.lean b/LeanPool/GraphMinor.lean new file mode 100644 index 0000000000..bcbd68c4cc --- /dev/null +++ b/LeanPool/GraphMinor.lean @@ -0,0 +1,43 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +module + +public import LeanPool.GraphMinor.GM20.Assembled + +/-! +# The Robertson–Seymour graph minor theorem + +Source: doi:10.1016/j.jctb.2004.08.001, url:https://github.com/mahdi-jfri/GraphMinor/tree/89c19b2fd07130fe6fc0fb7df2743ad99558c939 +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +Status: verified +Main declarations: `GraphMinor.graph_minor_theorem` +Tags: graph-theory, graph-minors, multigraphs, well-quasi-ordering +MSC: 05C83, 05C10 +-/ + +/-! +This is the dependency closure of the graph minor theorem from the Lean +formalization of the Robertson–Seymour series by MohammadTaghi Hajiaghayi +and Mahdi JafariRaviz. Graphs are Mathlib multigraphs and may have loops and +parallel edges. The supporting development includes drawings on surfaces, +surface classification, tangles and well-quasi-ordering. +-/ + +public section + +namespace GraphMinor + +open Graph + +/-- In every infinite sequence of finite multigraphs, some earlier graph is +isomorphic to a minor of a later graph. -/ +theorem graph_minor_theorem {α β : Type*} (G : ℕ → Graph α β) + (hV : ∀ n, V(G n).Finite) (hE : ∀ n, E(G n).Finite) : + ∃ i j, i < j ∧ IsIsoMinor (G i) (G j) := + GM20.graph_minor_theorem_assembled G hV hE + +end GraphMinor diff --git a/LeanPool/GraphMinor/GM01/Defs.lean b/LeanPool/GraphMinor/GM01/Defs.lean new file mode 100644 index 0000000000..8154d2493f --- /dev/null +++ b/LeanPool/GraphMinor/GM01/Defs.lean @@ -0,0 +1,185 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Statement +public import Mathlib.Combinatorics.Graph.Simple +public import Mathlib.Combinatorics.SimpleGraph.Acyclic +public import Mathlib.Combinatorics.SimpleGraph.Connectivity.Subgraph +public import Mathlib.Combinatorics.SimpleGraph.Hasse +public import Mathlib.Combinatorics.SimpleGraph.Prod +public import Mathlib.Data.Set.Card + +/-! +# Definitions for Graph Minors I, Section 2 (Grids) + +This file gives the definitions used in Section 2 of +N. Robertson and P. D. Seymour, *Graph Minors. I. Excluding a forest*, +J. Combin. Theory Ser. B **35** (1983), 39–61 (pages 41–50). + +## Representation + +A finite graph in Section 2 is represented as a subgraph `G : (⊤ : SimpleGraph α).Subgraph` with +`G.verts.Finite`. All results (2.1)–(2.9) of Section 2 concern grid minors, paths, connected +subgraphs, connected components, and vertex separators, which depend only on the underlying simple +graph; representing subgraphs of `G` (paths, stars, and the `Bⱼ`) as `H ≤ G` retains their edge sets +so that the proofs can delete and contract edges as in the paper. + +* `toGraph G`: the Mathlib multigraph `Graph α (Sym2 α)` with vertex set `G.verts` and edge set + `G.edgeSet`. +* `gridGraph θ`: the `θ`-grid `Graph.ofSimpleGraph (pathGraph θ □ pathGraph θ)`, whose vertex + `(i, j)` corresponds to the paper's `v_{i+1, j+1}`. +* `𝓕 θ` (with notation `𝓕_θ`): the set of graphs `G` with no minor isomorphic to `gridGraph θ`. +* `Path α`: a path in `α`, given by its initial vertex `first`, its terminal vertex `last`, and a + walk `walk : (⊤ : SimpleGraph α).Walk first last` with `walk.IsPath`. Its subgraph is + `P.toSubgraph`, its vertex set is `P.verts`, its ends are `P.ends = {P.first, P.last}`, and its + internal vertices are `P.internalVerts = P.verts \ P.ends`. +* `Path.Precedes`: the order of vertices along a path. +* `Path.IsIn`, `Path.IsFromTo`, `Path.Avoids`, `Separates`: paths in `G`, paths from `A₁` to `A₂`, + paths avoiding `X`, and vertex sets `X` separating `Y` and `Z` in `G`. +* `IsDisjointPathFamily`: families of disjoint paths from `A₁` to `A₂`. +* `IsStarWithCenter`, `IsStar`, `IsTreeSubgraph`, `IsLeafOf`, `numComponents`: stars, trees, + end-vertices, and the number of connected components of a subgraph. +-/ + +@[expose] public section + +namespace GraphMinor.GM01 + +open SimpleGraph + +variable {α : Type*} + +/-- The Mathlib `Graph α (Sym2 α)` underlying a subgraph `G : (⊤ : SimpleGraph α).Subgraph`, with +vertex set `G.verts` and edge set `G.edgeSet`. -/ +def toGraph (G : (⊤ : SimpleGraph α).Subgraph) : Graph α (Sym2 α) where + vertexSet := G.verts + edgeSet := G.edgeSet + IsLink e x y := e = s(x, y) ∧ G.Adj x y + isLink_symm _ _ := ⟨fun _ _ ↦ by simp [Sym2.eq_swap, G.adj_comm]⟩ + eq_or_eq_of_isLink_of_isLink _ _ _ _ _ he hf := by grind + edge_mem_iff_exists_isLink e := by + induction e with + | h u v => + simp only [Subgraph.mem_edgeSet] + exact ⟨fun h ↦ ⟨u, v, rfl, h⟩, fun ⟨x, y, heq, hadj⟩ ↦ by + rw [G.adj_congr_of_sym2 heq] + exact hadj⟩ + left_mem_of_isLink _ _ _ h := h.2.fst_mem + +/-- The `θ`-grid (Graph Minors I, Section 2, page 42): "If $\theta \ge 2$, the $\theta$-grid is the +simple graph with vertices $v_{ij}$ ($1 \le i, j \le \theta$) in which $v_{ij}$ and $v_{i'j'}$ are +adjacent if $|i - i'| + |j - j'| = 1$." Here vertex `(i, j)` in `Fin θ × Fin θ` is the paper's +`v_{i+1, j+1}`. -/ +def gridGraph (θ : ℕ) : Graph (Fin θ × Fin θ) (Sym2 (Fin θ × Fin θ)) := + Graph.ofSimpleGraph (pathGraph θ □ pathGraph θ) + +/-- `𝓕_θ` denotes the set of all graphs with no minor isomorphic to the `θ`-grid +(Graph Minors I, Section 2, page 42). -/ +def 𝓕 (θ : ℕ) : Set (⊤ : SimpleGraph α).Subgraph := + {G | ¬ IsIsoMinor (gridGraph θ) (toGraph G)} + +/-- Notation `𝓕_θ` for `𝓕 θ`, the set of graphs with no minor isomorphic to the `θ`-grid. -/ +scoped notation "𝓕_" θ:max => 𝓕 θ + +/-- A path (Graph Minors I, Section 1, page 41): "Every *path* has at least one vertex, and no +... vertices. It has an *initial* and a *terminal* vertex (which are equal for a one-vertex +path) called its *ends*, and any other vertices are called *internal* vertices." -/ +@[ext] +structure Path (α : Type*) where + /-- The initial vertex of the path. -/ + first : α + /-- The terminal vertex of the path. -/ + last : α + /-- The walk from `first` to `last`. -/ + walk : (⊤ : SimpleGraph α).Walk first last + /-- The walk has no repeated vertices. -/ + isPath : walk.IsPath + +namespace Path + +variable (P : Path α) + +/-- The subgraph consisting of the vertices and edges of `P`. -/ +def toSubgraph : (⊤ : SimpleGraph α).Subgraph := P.walk.toSubgraph + +/-- The vertex set `V(P)` of the path `P`. -/ +def verts : Set α := P.toSubgraph.verts + +/-- The edge set `E(P)` of the path `P`. -/ +def edgeSet : Set (Sym2 α) := P.toSubgraph.edgeSet + +/-- The ends `{P.first, P.last}` of the path `P` (Graph Minors I, Section 1, page 41). -/ +def ends : Set α := {P.first, P.last} + +/-- The internal vertices of `P` (its vertices other than its ends): "called its *ends*, and any +other vertices are called *internal* vertices." (Graph Minors I, Section 1, page 41). -/ +def internalVerts : Set α := P.verts \ P.ends + +/-- `P` is a path of `G`: its subgraph `P.toSubgraph` is a subgraph of `G`. -/ +def IsIn (G : (⊤ : SimpleGraph α).Subgraph) : Prop := P.toSubgraph ≤ G + +/-- `P` is a path in `G` from `A₁` to `A₂`: `P` is a path of `G` with initial vertex in `A₁` and +terminal vertex in `A₂` (Graph Minors I, Section 1, page 41). -/ +def IsFromTo (G : (⊤ : SimpleGraph α).Subgraph) (A₁ A₂ : Set α) : Prop := + P.toSubgraph ≤ G ∧ P.first ∈ A₁ ∧ P.last ∈ A₂ + +/-- "A path *avoids* $X \subseteq V(G)$ if it has no vertex in $X$." +(Graph Minors I, Section 1, page 41). -/ +def Avoids (X : Set α) : Prop := Disjoint P.verts X + +/-- `u` occurs before `v` on `P` (equivalently, `v` is after `u` on `P`, Graph Minors I, +Section 2, pages 42–44): `u` appears at an earlier position than `v` in `P.walk.support`. -/ +def Precedes (u v : α) : Prop := + ∃ (i j : ℕ) (hi : i < P.walk.support.length) (hj : j < P.walk.support.length), + i < j ∧ P.walk.support[i] = u ∧ P.walk.support[j] = v + +end Path + +/-- `H` is a path subgraph: there is a path `P : Path α` with `P.toSubgraph = H`. -/ +def IsPathSubgraph (H : (⊤ : SimpleGraph α).Subgraph) : Prop := + ∃ P : Path α, P.toSubgraph = H + +/-- "$X \subseteq V(G)$ *separates* $Y, Z \subseteq V(G)$ if no path in $G$ from $Y$ to $Z$ avoids +$X$." +(Graph Minors I, Section 1, page 41). -/ +def Separates (G : (⊤ : SimpleGraph α).Subgraph) (X Y Z : Set α) : Prop := + ∀ P : Path α, P.IsFromTo G Y Z → ¬ P.Avoids X + +/-- `P₁, …, Pₘ` are disjoint paths in `G` from `A₁` to `A₂` (Graph Minors I, Section 1, page 41, +and Section 2, (2.5)–(2.8), pages 44–48). -/ +def IsDisjointPathFamily (G : (⊤ : SimpleGraph α).Subgraph) (A₁ A₂ : Set α) + {m : ℕ} (P : Fin m → Path α) : Prop := + (∀ i, (P i).IsFromTo G A₁ A₂) ∧ Pairwise fun i j ↦ Disjoint (P i).verts (P j).verts + +/-- "A star is a tree in which one vertex, called the *centre*, is adjacent to all others" +(Graph Minors I, Section 2, (2.2), page 42). Here `B` is a star with centre `c`. -/ +def IsStarWithCenter (B : (⊤ : SimpleGraph α).Subgraph) (c : α) : Prop := + c ∈ B.verts ∧ (∀ v ∈ B.verts, v ≠ c → B.Adj c v) ∧ ∀ u v, B.Adj u v → u = c ∨ v = c + +/-- `B` is a star: a tree in which one vertex (a centre) is adjacent to all others +(Graph Minors I, Section 2, (2.2), page 42). -/ +def IsStar (B : (⊤ : SimpleGraph α).Subgraph) : Prop := + ∃ c, IsStarWithCenter B c + +/-- `T` is a tree subgraph: a connected acyclic subgraph (`T.coe.IsTree`). -/ +def IsTreeSubgraph (T : (⊤ : SimpleGraph α).Subgraph) : Prop := + T.coe.IsTree + +/-- `v` is an end-vertex (a vertex of valency `1`) of the subgraph `T` +(Graph Minors I, Section 2, (2.3), page 43). -/ +def IsLeafOf (T : (⊤ : SimpleGraph α).Subgraph) (v : α) : Prop := + v ∈ T.verts ∧ (T.neighborSet v).ncard = 1 + +/-- The number of connected components of a subgraph `H`, or `⊤` if there are infinitely many. +For finite graphs this is the count in Graph Minors I, Section 2, (2.8), page 48. -/ +noncomputable def numComponents (H : (⊤ : SimpleGraph α).Subgraph) : ℕ∞ := + ENat.card H.coe.ConnectedComponent + +end GraphMinor.GM01 diff --git a/LeanPool/GraphMinor/GM04/Axioms.lean b/LeanPool/GraphMinor/GM04/Axioms.lean new file mode 100644 index 0000000000..a9b5c720f9 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Axioms.lean @@ -0,0 +1,174 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.TreeDecomposition + +/-! +# Simulation axioms, good classes, linked and rotund tree-decompositions + +Graph Minors IV, Sections 3–5, works with a class `ℛ` of rooted hypergraphs and a relation +"`G` is simulated in `H`" on it, and assumes four axioms about them. Here `ℛ` is a set +`R : Set (RootedHypergraph α β)` and the relation is `sim : RootedHypergraph α β → +RootedHypergraph α β → Prop`, where `sim G H` says that `G` is simulated in `H`. + +* `Axiom1`, `Axiom2` (Section 3, page 235), `Axiom3` (Section 4, page 236) and `Axiom4` + (Section 5, page 240). +* `WellSimulated sim W`: the class `W` is well-quasi-ordered by simulation. +* `IsStarDecomposition S σ`, `index S σ`, `tips S σ`: star-decompositions, their index and their + tips (Section 3). +* `IsGood R sim 𝒮`: the class `𝒮` of star-decompositions is good (Section 3). +* `IsSymmetric 𝒮` (Section 4). +* `branching T τ s`: the parts of the branching of `(T, τ)` at `s`, a star-decomposition with tree + `T.starAt s` (Section 3). +* `IsLinked sim T τ F` and `IsRotund T τ F` (Sections 3 and 4). +* `starClass R n`: the class `𝒮_n` of Axiom 4. +* `Theorem53Statement`: the statement of (5.3). + +A class of star-decompositions is a set of pairs `(S, σ)` of a tree `S` in a type `ι` and a +function `σ : ι → RootedHypergraph α β`. +-/ + +@[expose] public section + +namespace GraphMinor.GM04 + +open Hypergraph + +variable {α β ι : Type*} + +/-- Axiom 1: "{R}$ is a class of rooted hypergraphs, and if $G \in \mathscr{R}$ and $H$ is a rooted +hypergraph with $H \subseteq G^-$ then $H \in \mathscr{R}$." -/ +def Axiom1 (R : Set (RootedHypergraph α β)) : Prop := + ∀ G ∈ R, ∀ H : RootedHypergraph α β, H.toHypergraph ≤ G.toHypergraph → H ∈ R + +/-- Axiom 2: "The relation “$G$ is simulated in $H$” defines a quasi-order on $\mathscr{R}$." -/ +def Axiom2 (R : Set (RootedHypergraph α β)) + (sim : RootedHypergraph α β → RootedHypergraph α β → Prop) : Prop := + (∀ G ∈ R, sim G G) ∧ + ∀ G₁ ∈ R, ∀ G₂ ∈ R, ∀ G₃ ∈ R, sim G₁ G₂ → sim G₂ G₃ → sim G₁ G₃ + +/-- Axiom 3: "Let $G \in \mathscr{R}$ and let $(G_1, G_2)$ be a separation of $G$ of order +$|\bar{\pi}(G)|$. Suppose that there is no separation $(H_1, H_2)$ of $G$ with $G_1^- +\subseteq H_1^-$ of order less than $|\bar{\pi}(G)|$. Then there is a march $\pi_1$ with +$\bar{\pi}_1 = \bar{\pi}(G_1)$ such that $(G_1^-, \pi_1)$ is simulated in $G$." Here +`|πBar(G)|` is the length of the march `π(G)`, and `(G₁⁻, π₁)` is a rooted hypergraph `H` with +`H⁻ = G₁⁻` and `πBar(H) = πBar(G₁)`. -/ +def Axiom3 (R : Set (RootedHypergraph α β)) + (sim : RootedHypergraph α β → RootedHypergraph α β → Prop) : Prop := + ∀ G ∈ R, ∀ G₁ G₂ : RootedHypergraph α β, G.IsSeparation G₁ G₂ → + separationOrder G₁.toHypergraph G₂.toHypergraph = G.roots.length → + (¬ ∃ H₁ H₂ : RootedHypergraph α β, G.IsSeparation H₁ H₂ ∧ + G₁.toHypergraph ≤ H₁.toHypergraph ∧ + separationOrder H₁.toHypergraph H₂.toHypergraph < G.roots.length) → + ∃ H : RootedHypergraph α β, H.toHypergraph = G₁.toHypergraph ∧ H.rootSet = G₁.rootSet ∧ + sim H G + +/-- The class `W` is well-simulated: it is well-quasi-ordered by simulation, that is, for every +sequence `x₁, x₂, …` of members of `W` there are `i < i'` with `xᵢ` simulated in `x_{i'}`. -/ +def WellSimulated (sim : RootedHypergraph α β → RootedHypergraph α β → Prop) + (W : Set (RootedHypergraph α β)) : Prop := + ∀ x : ℕ → RootedHypergraph α β, (∀ n, x n ∈ W) → ∃ i i', i < i' ∧ sim (x i) (x i') + +/-- `(S, σ)` is a star-decomposition: a tree-decomposition whose tree `S` is a star. It is then a +tree-decomposition of `σ × S`. -/ +def IsStarDecomposition (S : RootedTree ι) (σ : ι → RootedHypergraph α β) : Prop := + S.IsStar ∧ IsTreeDecomposition (cross σ S.verts S.root) S σ + +/-- The index of the star-decomposition `(S, σ)`: `max(|πBar(σ(s))| : s ∈ V(S))`. -/ +def index (S : RootedTree ι) (σ : ι → RootedHypergraph α β) : ℕ := + S.verts.sup fun s ↦ (σ s).roots.length + +/-- The tips of the star-decomposition `(S, σ)`: the `σ(s)` for `s ∈ U(S) = V(S) - {o(S)}`. -/ +def tips (S : RootedTree ι) (σ : ι → RootedHypergraph α β) : Set (RootedHypergraph α β) := + {H | ∃ s ∈ S.edges, H = σ s} + +/-- The class `𝒮` of star-decompositions is good (Graph Minors IV, Section 3): +(a) `σ × S ∈ ℛ` for each `(S, σ) ∈ 𝒮`, +(b) `𝒮` has finite index, and +(c) for every countable sequence `(Sᵢ, σᵢ)` of members of `𝒮` such that the set of all tips of all +the `(Sᵢ, σᵢ)` is well-simulated, there exist `i' > i` such that `σᵢ × Sᵢ` is simulated in +`σ_{i'} × S_{i'}`. +The first condition says that `𝒮` is a class of star-decompositions. -/ +def IsGood (R : Set (RootedHypergraph α β)) + (sim : RootedHypergraph α β → RootedHypergraph α β → Prop) + (𝒮 : Set (RootedTree ι × (ι → RootedHypergraph α β))) : Prop := + (∀ p ∈ 𝒮, IsStarDecomposition p.1 p.2) ∧ + (∀ p ∈ 𝒮, cross p.2 p.1.verts p.1.root ∈ R) ∧ + (∃ n, ∀ p ∈ 𝒮, index p.1 p.2 ≤ n) ∧ + ∀ x : ℕ → RootedTree ι × (ι → RootedHypergraph α β), (∀ i, x i ∈ 𝒮) → + WellSimulated sim (⋃ i, tips (x i).1 (x i).2) → + ∃ i i', i < i' ∧ sim (cross (x i).2 (x i).1.verts (x i).1.root) + (cross (x i').2 (x i').1.verts (x i').1.root) + +/-- The class `𝒮` of star-decompositions is symmetric (Graph Minors IV, Section 4): for every +`(S, σ) ∈ 𝒮` and every star-decomposition `(S, σ')` with `σ'(s)⁻ = σ(s)⁻` and +`πBar(σ'(s)) = πBar(σ(s))` for each `s ∈ V(S)`, we have `(S, σ') ∈ 𝒮`. -/ +def IsSymmetric (𝒮 : Set (RootedTree ι × (ι → RootedHypergraph α β))) : Prop := + ∀ p ∈ 𝒮, ∀ σ' : ι → RootedHypergraph α β, IsStarDecomposition p.1 σ' → + (∀ s ∈ p.1.verts, (σ' s).toHypergraph = (p.2 s).toHypergraph ∧ + (σ' s).rootSet = (p.2 s).rootSet) → + (p.1, σ') ∈ 𝒮 + +/-- The parts of the branching of `(T, τ)` at `s` (Graph Minors IV, Section 3): its tree is +`T.starAt s`, the maximal star with root `s` which is a subtree of `T`; `σ(s) = τ(s)`, and +`σ(t) = τ × T^t` for every other vertex `t` of the star. It is a star-decomposition of +`τ × T^s`. -/ +noncomputable def branching (T : RootedTree ι) (τ : ι → RootedHypergraph α β) (s : ι) : + ι → RootedHypergraph α β := by + classical exact fun t ↦ if t = s then τ s else cross τ (T.subtreeAt t) t + +/-- `F ⊆ E(T)` is linked in `(T, τ)` (Graph Minors IV, Section 3): for every directed path `P` of +`T` with first edge `f₂ ∈ F` and last edge `f₁ ∈ F` such that `f₁, f₂` have the same order and no +element of `E(P) ∩ F` has smaller order, `τ × T^{f₁}` is simulated in `τ × T^{f₂}`. (The paper +defines this when `τ × T ∈ ℛ`.) -/ +def IsLinked (sim : RootedHypergraph α β → RootedHypergraph α β → Prop) (T : RootedTree ι) + (τ : ι → RootedHypergraph α β) (F : Set ι) : Prop := + ∀ f₁ ∈ F, ∀ f₂ ∈ F, T.Reaches f₂ f₁ → edgeOrder T τ f₁ = edgeOrder T τ f₂ → + (∀ g ∈ T.pathEdges f₂ f₁ ∩ F, edgeOrder T τ f₁ ≤ edgeOrder T τ g) → + sim (cross τ (T.subtreeAt f₁) f₁) (cross τ (T.subtreeAt f₂) f₂) + +/-- `F ⊆ E(T)` is rotund in `(T, τ)` (Graph Minors IV, Section 4): for every directed path `P` of +`T` with first edge `f₂ ∈ F` and last edge `f₁ ∈ F` such that `f₁, f₂` have the same order, `k` +say, and no element of `F ∩ E(P)` has smaller order, there is no separation `(H₁, H₂)` of +`(τ × T)⁻` with `(τ × T^{f₁})⁻ ⊆ H₁` and `(τ × T_{f₂})⁻ ⊆ H₂` of order smaller than `k`. -/ +def IsRotund (T : RootedTree ι) (τ : ι → RootedHypergraph α β) (F : Set ι) : Prop := + ∀ f₁ ∈ F, ∀ f₂ ∈ F, T.Reaches f₂ f₁ → edgeOrder T τ f₁ = edgeOrder T τ f₂ → + (∀ g ∈ T.pathEdges f₂ f₁ ∩ F, edgeOrder T τ f₁ ≤ edgeOrder T τ g) → + ¬ ∃ H₁ H₂ : Hypergraph α β, + (cross τ T.verts T.root).toHypergraph.IsSeparation H₁ H₂ ∧ + (cross τ (T.subtreeAt f₁) f₁).toHypergraph ≤ H₁ ∧ + (cross τ (T.rootSide f₂) T.root).toHypergraph ≤ H₂ ∧ + separationOrder H₁ H₂ < edgeOrder T τ f₁ + +/-- The class `𝒮_n` of Axiom 4: the star-decompositions `(S, σ)` with `σ × S ∈ ℛ` and +`|V(σ(o(S)))| ≤ n`, with trees in the type `ι`. -/ +def starClass (ι : Type*) (R : Set (RootedHypergraph α β)) (n : ℕ) : + Set (RootedTree ι × (ι → RootedHypergraph α β)) := + {p | IsStarDecomposition p.1 p.2 ∧ cross p.2 p.1.verts p.1.root ∈ R ∧ + (p.2 p.1.root).vertexSet.ncard ≤ n} + +/-- Axiom 4: "For each `n ≥ 0`, `𝒮_n` is good", for star-decompositions with trees in `ι`. -/ +def Axiom4 (ι : Type*) (R : Set (RootedHypergraph α β)) + (sim : RootedHypergraph α β → RootedHypergraph α β → Prop) : Prop := + ∀ n : ℕ, IsGood R sim (starClass ι R n) + +/-- The statement of Graph Minors IV, (5.3): assuming Axioms 1–4, "Let $G_i$ ($i = 1, 2, \dots$) be +a countable sequence of elements of $\mathscr{R}$, each of +tree-width $\le n$. Then there exist $i' > i \ge 1$ such that $G_i$ is simulated in +$G_{i'}$." Axiom 4 is assumed for trees with vertices in `ℕ`, the +trees of `TreeWidthLE`. -/ +def Theorem53Statement : Prop := + ∀ {α β : Type*} (R : Set (RootedHypergraph α β)) + (sim : RootedHypergraph α β → RootedHypergraph α β → Prop), + Axiom1 R → Axiom2 R sim → Axiom3 R sim → Axiom4 ℕ R sim → + ∀ (n : ℕ) (G : ℕ → RootedHypergraph α β), (∀ i, G i ∈ R) → (∀ i, TreeWidthLE (G i) n) → + ∃ i i', i < i' ∧ sim (G i) (G i') + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/Decomposition/Basic.lean b/LeanPool/GraphMinor/GM04/Decomposition/Basic.lean new file mode 100644 index 0000000000..70981ab0f8 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Decomposition/Basic.lean @@ -0,0 +1,891 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Axioms +public import LeanPool.GraphMinor.GM04.TreeLemma.Basic + +/-! +# Basic properties of rooted trees, hypergraphs, and tree-decompositions + +This file proves fundamental lemmas about hypergraphs, rooted trees, `cross`, `edgeOrder`, and +tree-decompositions, including Graph Minors IV, (3.1): for every edge `f` of `T`, +`(τ × T^f, τ × T_f)` is a separation of `G`, and its order `edgeOrder T τ f` equals +`|V(τ(f)⁻ ∩ τ(parent f)⁻)| = |πBar(τ(f))|`. +-/ + +public section + +namespace GraphMinor + +variable {α β ι : Type*} + +namespace Hypergraph + +@[simp] +theorem mem_ends_iff (G : Hypergraph α β) (e : β) (v : α) : v ∈ G.ends e ↔ G.Inc e v := Iff.rfl + +theorem union_vertexSet (G₁ G₂ : Hypergraph α β) : + (G₁ ∪ G₂).vertexSet = G₁.vertexSet ∪ G₂.vertexSet := + GraphMinor.Hypergraph.union_vertexSet_eq G₁ G₂ + +theorem union_edgeSet (G₁ G₂ : Hypergraph α β) : + (G₁ ∪ G₂).edgeSet = G₁.edgeSet ∪ G₂.edgeSet := + GraphMinor.Hypergraph.union_edgeSet_eq G₁ G₂ + +@[simp] +theorem union_inc (G₁ G₂ : Hypergraph α β) (e : β) (v : α) : + (G₁ ∪ G₂).Inc e v ↔ G₁.Inc e v ∨ G₂.Inc e v := + GraphMinor.Hypergraph.union_inc_iff G₁ G₂ e v + +theorem inter_vertexSet (G₁ G₂ : Hypergraph α β) : + (G₁ ∩ G₂).vertexSet = G₁.vertexSet ∩ G₂.vertexSet := + GraphMinor.Hypergraph.inter_vertexSet_eq G₁ G₂ + +theorem inter_edgeSet (G₁ G₂ : Hypergraph α β) : + (G₁ ∩ G₂).edgeSet = G₁.edgeSet ∩ G₂.edgeSet := + GraphMinor.Hypergraph.inter_edgeSet_eq G₁ G₂ + +@[simp] +theorem inter_inc (G₁ G₂ : Hypergraph α β) (e : β) (v : α) : + (G₁ ∩ G₂).Inc e v ↔ G₁.Inc e v ∧ G₂.Inc e v := + GraphMinor.Hypergraph.inter_inc_iff G₁ G₂ e v + +attribute [simp] GraphMinor.Hypergraph.union_vertexSet_eq + GraphMinor.Hypergraph.union_edgeSet_eq GraphMinor.Hypergraph.inter_vertexSet_eq + GraphMinor.Hypergraph.inter_edgeSet_eq + +@[simp] +theorem biUnion_vertexSet (s : Finset ι) (G : ι → Hypergraph α β) : + (biUnion s G).vertexSet = ⋃ i ∈ s, (G i).vertexSet := rfl + +@[simp] +theorem biUnion_edgeSet (s : Finset ι) (G : ι → Hypergraph α β) : + (biUnion s G).edgeSet = ⋃ i ∈ s, (G i).edgeSet := rfl + +@[simp] +theorem biUnion_inc (s : Finset ι) (G : ι → Hypergraph α β) (e : β) (v : α) : + (biUnion s G).Inc e v ↔ ∃ i ∈ s, (G i).Inc e v := Iff.rfl + +theorem inc_of_le {H G : Hypergraph α β} (h : H ≤ G) {e : β} {v : α} (hev : H.Inc e v) : + G.Inc e v := by + have he : e ∈ H.edgeSet := H.edge_mem_of_inc hev + have h_ends := h.ends_eq e he + exact (Set.ext_iff.mp h_ends v).mpr hev + +theorem inc_iff_of_le {H G : Hypergraph α β} (h : H ≤ G) {e : β} (he : e ∈ H.edgeSet) (v : α) : + G.Inc e v ↔ H.Inc e v := + Set.ext_iff.mp (h.ends_eq e he) v + +theorem eq_of_le_of_subset {H G : Hypergraph α β} (h : H ≤ G) + (hV : G.vertexSet ⊆ H.vertexSet) (hE : G.edgeSet ⊆ H.edgeSet) : H = G := + le_antisymm h + { vertexSet_subset := hV + edgeSet_subset := hE + ends_eq := fun e he ↦ (h.ends_eq e (hE he)).symm } + +theorem union_le {G₁ G₂ G : Hypergraph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) : G₁ ∪ G₂ ≤ G where + vertexSet_subset := Set.union_subset h₁.vertexSet_subset h₂.vertexSet_subset + edgeSet_subset := Set.union_subset h₁.edgeSet_subset h₂.edgeSet_subset + ends_eq e he := by + ext v + simp only [mem_ends_iff, union_inc] + rcases he with he₁ | he₂ + · exact ⟨fun hv ↦ Or.inl ((inc_iff_of_le h₁ he₁ v).mp hv), + fun h ↦ h.elim (inc_of_le h₁) (inc_of_le h₂)⟩ + · exact ⟨fun hv ↦ Or.inr ((inc_iff_of_le h₂ he₂ v).mp hv), + fun h ↦ h.elim (inc_of_le h₁) (inc_of_le h₂)⟩ + +theorem le_union_left {G₁ G₂ G : Hypergraph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) : + G₁ ≤ G₁ ∪ G₂ where + vertexSet_subset := Set.subset_union_left + edgeSet_subset := Set.subset_union_left + ends_eq e he := by + ext v + simp only [mem_ends_iff, union_inc] + exact ⟨fun h ↦ h.elim id fun h' ↦ (inc_iff_of_le h₁ he v).mp (inc_of_le h₂ h'), Or.inl⟩ + +theorem le_union_right {G₁ G₂ G : Hypergraph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) : + G₂ ≤ G₁ ∪ G₂ where + vertexSet_subset := Set.subset_union_right + edgeSet_subset := Set.subset_union_right + ends_eq e he := by + ext v + simp only [mem_ends_iff, union_inc] + exact ⟨fun h ↦ h.elim (fun h' ↦ (inc_iff_of_le h₂ he v).mp (inc_of_le h₁ h')) id, Or.inr⟩ + +theorem inter_le_left {G₁ G₂ G : Hypergraph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) : + G₁ ∩ G₂ ≤ G₁ where + vertexSet_subset := Set.inter_subset_left + edgeSet_subset := Set.inter_subset_left + ends_eq e he := by + ext v + simp only [mem_ends_iff, inter_inc] + exact ⟨fun hv ↦ ⟨hv, (inc_iff_of_le h₂ he.2 v).mp (inc_of_le h₁ hv)⟩, And.left⟩ + +theorem inter_le_right {G₁ G₂ G : Hypergraph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) : + G₁ ∩ G₂ ≤ G₂ where + vertexSet_subset := Set.inter_subset_right + edgeSet_subset := Set.inter_subset_right + ends_eq e he := by + ext v + simp only [mem_ends_iff, inter_inc] + exact ⟨fun hv ↦ ⟨(inc_iff_of_le h₁ he.1 v).mp (inc_of_le h₂ hv), hv⟩, And.right⟩ + +theorem le_inter {H G₁ G₂ : Hypergraph α β} (h₁ : H ≤ G₁) (h₂ : H ≤ G₂) : H ≤ G₁ ∩ G₂ where + vertexSet_subset := Set.subset_inter h₁.vertexSet_subset h₂.vertexSet_subset + edgeSet_subset := Set.subset_inter h₁.edgeSet_subset h₂.edgeSet_subset + ends_eq e he := by + ext v + simp only [mem_ends_iff, inter_inc] + exact ⟨And.left ∘ fun ⟨hv₁, _⟩ ↦ ⟨(inc_iff_of_le h₁ he v).mp hv₁, True.intro⟩, + fun hv ↦ ⟨inc_of_le h₁ hv, inc_of_le h₂ hv⟩⟩ + +theorem inter_comm (G₁ G₂ : Hypergraph α β) : G₁ ∩ G₂ = G₂ ∩ G₁ := + Hypergraph.ext (Set.inter_comm _ _) (Set.inter_comm _ _) (funext₂ fun _ _ ↦ propext and_comm) + +theorem union_comm (G₁ G₂ : Hypergraph α β) : G₁ ∪ G₂ = G₂ ∪ G₁ := + Hypergraph.ext (Set.union_comm _ _) (Set.union_comm _ _) (funext₂ fun _ _ ↦ propext or_comm) + +theorem biUnion_le {s : Finset ι} {G : ι → Hypergraph α β} {H : Hypergraph α β} + (h : ∀ i ∈ s, G i ≤ H) : biUnion s G ≤ H where + vertexSet_subset := Set.iUnion₂_subset fun i hi ↦ (h i hi).vertexSet_subset + edgeSet_subset := Set.iUnion₂_subset fun i hi ↦ (h i hi).edgeSet_subset + ends_eq e he := by + obtain ⟨i, hi, hei⟩ := Set.mem_iUnion₂.mp he + ext v + simp only [mem_ends_iff, biUnion_inc] + refine ⟨fun hv ↦ ⟨i, hi, (inc_iff_of_le (h i hi) hei v).mp hv⟩, ?_⟩ + rintro ⟨j, hj, hv⟩ + exact inc_of_le (h j hj) hv + +theorem biUnion_mono {s₁ s₂ : Finset ι} {G : ι → Hypergraph α β} {H : Hypergraph α β} + (hs : s₁ ⊆ s₂) (h : ∀ i ∈ s₂, G i ≤ H) : biUnion s₁ G ≤ biUnion s₂ G where + vertexSet_subset := Set.biUnion_subset_biUnion_left hs + edgeSet_subset := Set.biUnion_subset_biUnion_left hs + ends_eq e he := by + obtain ⟨i, hi, hei⟩ := Set.mem_iUnion₂.mp he + ext v + simp only [mem_ends_iff, biUnion_inc] + refine ⟨?_, fun ⟨j, hj, hv⟩ ↦ ⟨j, hs hj, hv⟩⟩ + rintro ⟨j, hj, hv⟩ + exact ⟨i, hi, (inc_iff_of_le (h i (hs hi)) hei v).mp (inc_of_le (h j hj) hv)⟩ + +theorem le_biUnion {s : Finset ι} {G : ι → Hypergraph α β} {H : Hypergraph α β} + (h : ∀ i ∈ s, G i ≤ H) {i : ι} (hi : i ∈ s) : G i ≤ biUnion s G where + vertexSet_subset _ hv := Set.mem_biUnion hi hv + edgeSet_subset _ he := Set.mem_biUnion hi he + ends_eq e he := by + ext v + simp only [mem_ends_iff, biUnion_inc] + refine ⟨?_, fun hv ↦ ⟨i, hi, hv⟩⟩ + rintro ⟨j, hj, hv⟩ + exact (inc_iff_of_le (h i hi) he v).mp (inc_of_le (h j hj) hv) + +theorem biUnion_insert_of_mem [DecidableEq ι] {s : Finset ι} {r : ι} (hr : r ∈ s) + (G : ι → Hypergraph α β) : biUnion (insert r s) G = biUnion s G := by + rw [Finset.insert_eq_of_mem hr] + +theorem biUnion_union [DecidableEq ι] (s₁ s₂ : Finset ι) (G : ι → Hypergraph α β) : + biUnion (s₁ ∪ s₂) G = biUnion s₁ G ∪ biUnion s₂ G := by + ext x <;> simp [or_and_right, exists_or] + +theorem biUnion_congr {s₁ s₂ : Finset ι} (hs : s₁ = s₂) {G₁ G₂ : ι → Hypergraph α β} + (hG : ∀ i ∈ s₁, G₁ i = G₂ i) : biUnion s₁ G₁ = biUnion s₂ G₂ := by + subst hs + ext x + · simp only [biUnion_vertexSet, Set.mem_iUnion] + exact exists_congr fun i ↦ exists_congr fun hi ↦ by rw [hG i hi] + · simp only [biUnion_edgeSet, Set.mem_iUnion] + exact exists_congr fun i ↦ exists_congr fun hi ↦ by rw [hG i hi] + · simp only [biUnion_inc] + exact exists_congr fun i ↦ and_congr_right fun hi ↦ by rw [hG i hi] + +theorem separationOrder_comm (G₁ G₂ : Hypergraph α β) : + separationOrder G₁ G₂ = separationOrder G₂ G₁ := by + simp only [separationOrder, inter_comm] + +theorem IsSeparation.symm {G G₁ G₂ : Hypergraph α β} (h : G.IsSeparation G₁ G₂) : + G.IsSeparation G₂ G₁ where + left_le := h.right_le + right_le := h.left_le + union_eq := (union_comm G₂ G₁).trans h.union_eq + edgeSet_inter_eq := by rw [inter_comm, h.edgeSet_inter_eq] + +end Hypergraph + +namespace RootedHypergraph + +@[ext] +theorem ext {G₁ G₂ : RootedHypergraph α β} (h₁ : G₁.toHypergraph = G₂.toHypergraph) + (h₂ : G₁.roots = G₂.roots) : G₁ = G₂ := by + cases G₁ + cases G₂ + congr + +@[simp] +theorem mem_rootSet_iff (G : RootedHypergraph α β) (v : α) : v ∈ G.rootSet ↔ v ∈ G.roots := + Iff.rfl + +theorem rootSet_subset_vertexSet (G : RootedHypergraph α β) : G.rootSet ⊆ G.vertexSet := + G.roots_subset + +theorem rootSet_finite (G : RootedHypergraph α β) : G.rootSet.Finite := + G.vertexSet_finite.subset G.rootSet_subset_vertexSet + +@[simp] +theorem ncard_rootSet (G : RootedHypergraph α β) : G.rootSet.ncard = G.roots.length := by + classical + have h : G.rootSet = (G.roots.toFinset : Set α) := by + ext v + simp [rootSet] + rw [h, Set.ncard_coe_finset, List.toFinset_card_of_nodup G.roots_nodup] + +end RootedHypergraph + +namespace GM04 + +namespace RootedTree + +variable (T : RootedTree ι) + +theorem mem_edges_iff {f : ι} : f ∈ T.edges ↔ f ∈ T.verts ∧ f ≠ T.root := by + classical + simp [edges, and_comm] + +theorem parent_iterate_mem {v : ι} (hv : v ∈ T.verts) : ∀ n, T.parent^[n] v ∈ T.verts := + T.iterate_parent_mem hv + +theorem parent_iterate_root : ∀ n, T.parent^[n] T.root = T.root := + T.iterate_parent_root + +theorem parent_iterate_eq_root_of_le {v : ι} {m n : ℕ} (hm : T.parent^[m] v = T.root) + (hmn : m ≤ n) : T.parent^[n] v = T.root := + T.iterate_parent_eq_root_of_le hm hmn + +theorem reaches_mem_left {u v : ι} (h : T.Reaches u v) : u ∈ T.verts := + h.verts_left T + +theorem reaches_mem_right {u v : ι} (h : T.Reaches u v) : v ∈ T.verts := h.1 + +theorem reaches_trans {u v w : ι} (huv : T.Reaches u v) (hvw : T.Reaches v w) : + T.Reaches u w := + huv.trans T hvw + +theorem reaches_root {v : ι} (hv : v ∈ T.verts) : T.Reaches T.root v := + T.root_reaches hv + +theorem reaches_antisymm {u v : ι} (huv : T.Reaches u v) (hvu : T.Reaches v u) : u = v := + huv.antisymm T hvu + +theorem reaches_total_of_reaches {x y v : ι} (hx : T.Reaches x v) (hy : T.Reaches y v) : + T.Reaches x y ∨ T.Reaches y x := + hx.total_of_reaches T hy + +theorem reaches_parent_of_reaches_of_ne {u v : ι} (h : T.Reaches u v) (hne : u ≠ v) : + T.Reaches u (T.parent v) := + (h.ne_imp_mem_edges_and_reaches_parent T hne).2 + +theorem mem_edges_of_reaches_of_ne {u v : ι} (h : T.Reaches u v) (hne : u ≠ v) : + v ∈ T.edges := + (h.ne_imp_mem_edges_and_reaches_parent T hne).1 + +theorem reaches_iff_eq_or_reaches_parent {u v : ι} (hv : v ∈ T.verts) : + T.Reaches u v ↔ u = v ∨ T.Reaches u (T.parent v) := by + refine ⟨fun h ↦ h.eq_or_reaches_parent T, ?_⟩ + rintro (rfl | h) + · exact T.reaches_refl hv + · exact T.reaches_trans h (T.reaches_parent hv) + +theorem subtreeAt_mono {u v : ι} (h : T.Reaches u v) : T.subtreeAt v ⊆ T.subtreeAt u := + T.subtreeAt_subset_of_reaches h + +theorem parent_mem_rootSide {f : ι} (hf : f ∈ T.edges) : T.parent f ∈ T.rootSide f := + T.mem_rootSide.mpr ⟨T.parent_mem f (T.edges_subset_verts hf), T.not_reaches_parent hf⟩ + +theorem subtreeAt_union_rootSide [DecidableEq ι] (f : ι) : + T.subtreeAt f ∪ T.rootSide f = T.verts := by + ext x + simp only [Finset.mem_union, T.mem_subtreeAt, T.mem_rootSide] + exact ⟨fun h ↦ h.elim (fun h ↦ h.1) And.left, + fun hx ↦ by + by_cases h : T.Reaches f x + · exact Or.inl h + · exact Or.inr ⟨hx, h⟩⟩ + +theorem onPath_symm {t₁ t₂ t : ι} : T.OnPath t₁ t₂ t ↔ T.OnPath t₂ t₁ t := by + simp only [OnPath, or_comm] + exact and_congr_right' ⟨fun h x h₂ h₁ ↦ h x h₁ h₂, fun h x h₁ h₂ ↦ h x h₂ h₁⟩ + +theorem onPath_left {t₁ t₂ : ι} (ht₁ : t₁ ∈ T.verts) : T.OnPath t₁ t₂ t₁ := + ⟨Or.inl (T.reaches_refl ht₁), fun _ hx₁ _ ↦ hx₁⟩ + +theorem onPath_right {t₁ t₂ : ι} (ht₂ : t₂ ∈ T.verts) : T.OnPath t₁ t₂ t₂ := + ⟨Or.inr (T.reaches_refl ht₂), fun _ _ hx₂ ↦ hx₂⟩ + +theorem onPath_of_reaches {t₁ t₂ t : ι} (h₁ : T.Reaches t₁ t) (h₂ : T.Reaches t t₂) : + T.OnPath t₁ t₂ t := + ⟨Or.inr h₂, fun _ hx₁ _ ↦ T.reaches_trans hx₁ h₁⟩ + +theorem onPath_head_of_mem_subtreeAt_of_mem_rootSide {f t₁ t₃ : ι} + (ht₁ : t₁ ∈ T.subtreeAt f) (ht₃ : t₃ ∈ T.rootSide f) : T.OnPath t₁ t₃ f := by + have hf₁ : T.Reaches f t₁ := T.mem_subtreeAt.mp ht₁ + have hf₃ : ¬ T.Reaches f t₃ := (T.mem_rootSide.mp ht₃).2 + refine ⟨Or.inl hf₁, fun x hx₁ hx₃ ↦ ?_⟩ + rcases T.reaches_total_of_reaches hx₁ hf₁ with hxf | hfx + · exact hxf + · exact absurd (T.reaches_trans hfx hx₃) hf₃ + +theorem onPath_parent_of_mem_subtreeAt_of_mem_rootSide {f t₁ t₃ : ι} (hf : f ∈ T.edges) + (ht₁ : t₁ ∈ T.subtreeAt f) (ht₃ : t₃ ∈ T.rootSide f) : T.OnPath t₁ t₃ (T.parent f) := by + have hfv : f ∈ T.verts := T.edges_subset_verts hf + have hf₁ : T.Reaches f t₁ := T.mem_subtreeAt.mp ht₁ + have hf₃ : ¬ T.Reaches f t₃ := (T.mem_rootSide.mp ht₃).2 + refine ⟨Or.inl (T.reaches_trans (T.reaches_parent hfv) hf₁), fun x hx₁ hx₃ ↦ ?_⟩ + have hxf : T.Reaches x f := (T.onPath_head_of_mem_subtreeAt_of_mem_rootSide ht₁ ht₃).2 x hx₁ hx₃ + rcases (T.reaches_iff_eq_or_reaches_parent hfv).mp hxf with rfl | hxp + · exact absurd hx₃ hf₃ + · exact hxp + +theorem onPathEdge_symm {t₁ t₂ f : ι} : T.OnPathEdge t₁ t₂ f ↔ T.OnPathEdge t₂ t₁ f := by + simp only [OnPathEdge, T.onPath_symm] + +theorem onPathEdge_iff {t₁ t₂ f : ι} (ht₁ : t₁ ∈ T.verts) (ht₂ : t₂ ∈ T.verts) : + T.OnPathEdge t₁ t₂ f ↔ + f ∈ T.edges ∧ ((t₁ ∈ T.subtreeAt f ∧ t₂ ∈ T.rootSide f) ∨ + (t₂ ∈ T.subtreeAt f ∧ t₁ ∈ T.rootSide f)) := by + refine ⟨?_, ?_⟩ + · rintro ⟨hf, hhead, hpar⟩ + refine ⟨hf, ?_⟩ + rcases hhead.1 with hf₁ | hf₂ + · left + refine ⟨T.mem_subtreeAt.mpr hf₁, T.mem_rootSide.mpr ⟨ht₂, fun hf₂ ↦ ?_⟩⟩ + exact T.not_reaches_parent hf (hpar.2 f hf₁ hf₂) + · right + refine ⟨T.mem_subtreeAt.mpr hf₂, T.mem_rootSide.mpr ⟨ht₁, fun hf₁ ↦ ?_⟩⟩ + exact T.not_reaches_parent hf (hpar.2 f hf₁ hf₂) + · rintro ⟨hf, ⟨h₁, h₂⟩ | ⟨h₂, h₁⟩⟩ + · exact ⟨hf, T.onPath_head_of_mem_subtreeAt_of_mem_rootSide h₁ h₂, + T.onPath_parent_of_mem_subtreeAt_of_mem_rootSide hf h₁ h₂⟩ + · rw [T.onPathEdge_symm] + exact ⟨hf, T.onPath_head_of_mem_subtreeAt_of_mem_rootSide h₂ h₁, + T.onPath_parent_of_mem_subtreeAt_of_mem_rootSide hf h₂ h₁⟩ + +@[simp] +theorem mem_children_iff {s v : ι} : v ∈ T.children s ↔ v ∈ T.edges ∧ T.parent v = s := by + classical + simp [children] + +theorem children_subset_edges (s : ι) : T.children s ⊆ T.edges := by + intro v hv + exact (T.mem_children_iff.mp hv).1 + +theorem children_subset_verts (s : ι) : T.children s ⊆ T.verts := + (T.children_subset_edges s).trans T.edges_subset_verts + +theorem self_notMem_children (s : ι) : s ∉ T.children s := by + rw [T.mem_children_iff] + rintro ⟨hs, hpar⟩ + exact T.parent_ne_self hs hpar + +@[simp] +theorem starAt_root (s : ι) : (T.starAt s).root = s := rfl + +@[simp] +theorem starAt_parent (s v : ι) : (T.starAt s).parent v = s := rfl + +@[simp] +theorem mem_starAt_verts {s v : ι} : v ∈ (T.starAt s).verts ↔ v = s ∨ v ∈ T.children s := by + classical + simp [starAt] + +@[simp] +theorem starAt_edges (s : ι) : (T.starAt s).edges = T.children s := by + ext v + simp only [mem_edges_iff, mem_starAt_verts, starAt_root] + refine ⟨?_, fun hv ↦ ⟨Or.inr hv, fun h ↦ T.self_notMem_children s (h ▸ hv)⟩⟩ + rintro ⟨rfl | hv, hne⟩ + · exact absurd rfl hne + · exact hv + +theorem isStar_starAt (s : ι) : (T.starAt s).IsStar := + fun _ _ ↦ rfl + +theorem reaches_starAt {s u v : ι} (h : (T.starAt s).Reaches u v) : u = v ∨ u = s := by + obtain ⟨_, n, hn⟩ := h + cases n with + | zero => exact Or.inl hn.symm + | succ k => + rw [Function.iterate_succ_apply'] at hn + exact Or.inr hn.symm + +theorem reaches_iff_eq_or_exists_children {s x : ι} (hs : s ∈ T.verts) : + T.Reaches s x ↔ x = s ∨ ∃ t ∈ T.children s, T.Reaches t x := by + refine ⟨?_, ?_⟩ + · rintro ⟨hx, n, h⟩ + induction n generalizing x with + | zero => exact Or.inl h + | succ k ih => + by_cases hxs : x = s + · exact Or.inl hxs + · have hxe : x ∈ T.edges := T.mem_edges_of_reaches_of_ne ⟨hx, k + 1, h⟩ (Ne.symm hxs) + rw [Function.iterate_succ_apply] at h + rcases ih (T.parent_mem x hx) h with hpar | ⟨t, ht, htx⟩ + · exact Or.inr ⟨x, T.mem_children_iff.mpr ⟨hxe, hpar⟩, T.reaches_refl hx⟩ + · exact Or.inr ⟨t, ht, T.reaches_trans htx (T.reaches_parent hx)⟩ + · rintro (rfl | ⟨t, ht, htx⟩) + · exact T.reaches_refl hs + · obtain ⟨hte, hpar⟩ := T.mem_children_iff.mp ht + have hst : T.Reaches s t := hpar ▸ T.reaches_parent (T.edges_subset_verts hte) + exact T.reaches_trans hst htx + +theorem mem_subtreeAt_iff_eq_or_exists_children {s x : ι} (hs : s ∈ T.verts) : + x ∈ T.subtreeAt s ↔ x = s ∨ ∃ t ∈ T.children s, x ∈ T.subtreeAt t := by + simp only [T.mem_subtreeAt, T.reaches_iff_eq_or_exists_children hs] + +theorem disjoint_subtreeAt_of_mem_children {s t₁ t₂ : ι} (ht₁ : t₁ ∈ T.children s) + (ht₂ : t₂ ∈ T.children s) (hne : t₁ ≠ t₂) : + Disjoint (T.subtreeAt t₁) (T.subtreeAt t₂) := by + rw [Finset.disjoint_left] + intro x hx₁ hx₂ + obtain ⟨he₁, hp₁⟩ := T.mem_children_iff.mp ht₁ + obtain ⟨he₂, hp₂⟩ := T.mem_children_iff.mp ht₂ + rcases T.reaches_total_of_reaches (T.mem_subtreeAt.mp hx₁) (T.mem_subtreeAt.mp hx₂) with h₁₂ | h₂₁ + · have h := T.reaches_parent_of_reaches_of_ne h₁₂ hne + rw [hp₂, ← hp₁] at h + exact T.not_reaches_parent he₁ h + · have h := T.reaches_parent_of_reaches_of_ne h₂₁ hne.symm + rw [hp₁, ← hp₂] at h + exact T.not_reaches_parent he₂ h + +end RootedTree + +open Hypergraph + +/-- The march of `cross τ S r` is `π(τ(r))`. -/ +@[simp] +theorem cross_roots (τ : ι → RootedHypergraph α β) (S : Finset ι) (r : ι) : + (cross τ S r).roots = (τ r).roots := rfl + +/-- The root set of `cross τ S r` is `πBar(τ(r))`. -/ +@[simp] +theorem cross_rootSet (τ : ι → RootedHypergraph α β) (S : Finset ι) (r : ι) : + (cross τ S r).rootSet = (τ r).rootSet := rfl + +/-- When `r ∈ S`, `(cross τ S r)⁻` is the union of `τ(t)⁻` over `t ∈ S`. -/ +theorem cross_toHypergraph_of_mem (τ : ι → RootedHypergraph α β) {S : Finset ι} {r : ι} + (hr : r ∈ S) : + (cross τ S r).toHypergraph = Hypergraph.biUnion S (fun t ↦ (τ t).toHypergraph) := by + classical + exact Hypergraph.biUnion_insert_of_mem hr _ + +/-- `(cross τ S r)⁻` depends only on the values of `τ(t)⁻` for `t ∈ S` when `r ∈ S`. -/ +theorem cross_toHypergraph_congr {τ₁ τ₂ : ι → RootedHypergraph α β} {S : Finset ι} {r₁ r₂ : ι} + (hr₁ : r₁ ∈ S) (hr₂ : r₂ ∈ S) + (h : ∀ t ∈ S, (τ₁ t).toHypergraph = (τ₂ t).toHypergraph) : + (cross τ₁ S r₁).toHypergraph = (cross τ₂ S r₂).toHypergraph := by + rw [cross_toHypergraph_of_mem τ₁ hr₁, cross_toHypergraph_of_mem τ₂ hr₂] + exact Hypergraph.biUnion_congr rfl h + +/-- `cross τ S r` depends only on `τ(r).roots` and the values of `τ(t)⁻` for `t ∈ S` (when `r ∈ S`). +-/ +theorem cross_congr {τ₁ τ₂ : ι → RootedHypergraph α β} {S : Finset ι} {r : ι} (hr : r ∈ S) + (hH : ∀ t ∈ S, (τ₁ t).toHypergraph = (τ₂ t).toHypergraph) + (hroots : (τ₁ r).roots = (τ₂ r).roots) : + cross τ₁ S r = cross τ₂ S r := + RootedHypergraph.ext (cross_toHypergraph_congr hr hr hH) hroots + +/-- The order of an edge `f` depends only on the underlying hypergraphs `τ(t)⁻` for `t ∈ V(T)`. -/ +theorem edgeOrder_congr {T : RootedTree ι} {τ₁ τ₂ : ι → RootedHypergraph α β} {f : ι} + (hf : f ∈ T.edges) (h : ∀ t ∈ T.verts, (τ₁ t).toHypergraph = (τ₂ t).toHypergraph) : + edgeOrder T τ₁ f = edgeOrder T τ₂ f := by + have hfv : f ∈ T.verts := T.edges_subset_verts hf + have hf_mem : f ∈ T.subtreeAt f := T.self_mem_subtreeAt hfv + have hr_mem : T.root ∈ T.rootSide f := T.root_mem_rootSide hf + simp only [edgeOrder, + cross_toHypergraph_congr hf_mem hf_mem (fun t ht ↦ h t (T.subtreeAt_subset_verts f ht)), + cross_toHypergraph_congr hr_mem hr_mem (fun t ht ↦ h t (T.rootSide_subset_verts f ht))] + +theorem cross_subtreeAt_root (T : RootedTree ι) (τ : ι → RootedHypergraph α β) : + cross τ (T.subtreeAt T.root) T.root = cross τ T.verts T.root := by + rw [T.subtreeAt_root] + +@[simp] +theorem branching_self (T : RootedTree ι) (τ : ι → RootedHypergraph α β) (s : ι) : + branching T τ s s = τ s := by + classical + simp [branching] + +theorem branching_of_ne (T : RootedTree ι) (τ : ι → RootedHypergraph α β) {s t : ι} (h : t ≠ s) : + branching T τ s t = cross τ (T.subtreeAt t) t := by + classical + simp [branching, h] + +theorem branching_of_mem_children (T : RootedTree ι) (τ : ι → RootedHypergraph α β) {s t : ι} + (ht : t ∈ T.children s) : + branching T τ s t = cross τ (T.subtreeAt t) t := + branching_of_ne T τ (by rintro rfl; exact T.self_notMem_children t ht) + +/-- If `(S, σ)` is the branching of `(T, τ)` at `s ∈ V(T)`, then `σ × S = τ × T^s`. -/ +theorem cross_branching_eq (T : RootedTree ι) (τ : ι → RootedHypergraph α β) {s : ι} + (hs : s ∈ T.verts) : + cross (branching T τ s) (T.starAt s).verts (T.starAt s).root = + cross τ (T.subtreeAt s) s := by + have hs_star : (T.starAt s).root ∈ (T.starAt s).verts := (T.starAt s).root_mem + have hs_sub : s ∈ T.subtreeAt s := T.self_mem_subtreeAt hs + apply RootedHypergraph.ext + · rw [cross_toHypergraph_of_mem _ hs_star, cross_toHypergraph_of_mem _ hs_sub] + ext x + · simp only [biUnion_vertexSet, Set.mem_iUnion, T.mem_starAt_verts, + T.mem_subtreeAt_iff_eq_or_exists_children hs] + refine ⟨?_, ?_⟩ + · rintro ⟨t, rfl | ht, hx⟩ + · rw [branching_self] at hx + exact ⟨t, Or.inl rfl, hx⟩ + · rw [branching_of_mem_children T τ ht, + cross_toHypergraph_of_mem _ (T.self_mem_subtreeAt (T.children_subset_verts s ht)), + biUnion_vertexSet, Set.mem_iUnion₂] at hx + obtain ⟨u, hu, hx⟩ := hx + exact ⟨u, Or.inr ⟨t, ht, hu⟩, hx⟩ + · rintro ⟨u, rfl | ⟨t, ht, hu⟩, hx⟩ + · refine ⟨u, Or.inl rfl, ?_⟩ + rwa [branching_self] + · refine ⟨t, Or.inr ht, ?_⟩ + rw [branching_of_mem_children T τ ht, + cross_toHypergraph_of_mem _ (T.self_mem_subtreeAt (T.children_subset_verts s ht)), + biUnion_vertexSet, Set.mem_iUnion₂] + exact ⟨u, hu, hx⟩ + · simp only [biUnion_edgeSet, Set.mem_iUnion, T.mem_starAt_verts, + T.mem_subtreeAt_iff_eq_or_exists_children hs] + refine ⟨?_, ?_⟩ + · rintro ⟨t, rfl | ht, hx⟩ + · rw [branching_self] at hx + exact ⟨t, Or.inl rfl, hx⟩ + · rw [branching_of_mem_children T τ ht, + cross_toHypergraph_of_mem _ (T.self_mem_subtreeAt (T.children_subset_verts s ht)), + biUnion_edgeSet, Set.mem_iUnion₂] at hx + obtain ⟨u, hu, hx⟩ := hx + exact ⟨u, Or.inr ⟨t, ht, hu⟩, hx⟩ + · rintro ⟨u, rfl | ⟨t, ht, hu⟩, hx⟩ + · refine ⟨u, Or.inl rfl, ?_⟩ + rwa [branching_self] + · refine ⟨t, Or.inr ht, ?_⟩ + rw [branching_of_mem_children T τ ht, + cross_toHypergraph_of_mem _ (T.self_mem_subtreeAt (T.children_subset_verts s ht)), + biUnion_edgeSet, Set.mem_iUnion₂] + exact ⟨u, hu, hx⟩ + · simp only [biUnion_inc, T.mem_starAt_verts, + T.mem_subtreeAt_iff_eq_or_exists_children hs] + refine ⟨?_, ?_⟩ + · rintro ⟨t, rfl | ht, hx⟩ + · rw [branching_self] at hx + exact ⟨t, Or.inl rfl, hx⟩ + · rw [branching_of_mem_children T τ ht, + cross_toHypergraph_of_mem _ (T.self_mem_subtreeAt (T.children_subset_verts s ht)), + biUnion_inc] at hx + obtain ⟨u, hu, hx⟩ := hx + exact ⟨u, Or.inr ⟨t, ht, hu⟩, hx⟩ + · rintro ⟨u, rfl | ⟨t, ht, hu⟩, hx⟩ + · refine ⟨u, Or.inl rfl, ?_⟩ + rwa [branching_self] + · refine ⟨t, Or.inr ht, ?_⟩ + rw [branching_of_mem_children T τ ht, + cross_toHypergraph_of_mem _ (T.self_mem_subtreeAt (T.children_subset_verts s ht)), + biUnion_inc] + exact ⟨u, hu, hx⟩ + · simp [branching_self] + +namespace IsTreeDecomposition + +variable {G : RootedHypergraph α β} {T : RootedTree ι} {τ : ι → RootedHypergraph α β} + +/-- If `(T, τ)` is a tree-decomposition of `G`, then `τ × T = G`. -/ +theorem cross_verts_eq (h : IsTreeDecomposition G T τ) : + cross τ T.verts T.root = G := by + apply RootedHypergraph.ext + · rw [cross_toHypergraph_of_mem τ T.root_mem, h.biUnion_eq] + · exact h.roots_root + +/-- For `t ∈ S ⊆ V(T)` with `r ∈ S`, `τ(t)⁻` is a subhypergraph of `(cross τ S r)⁻`. -/ +theorem le_cross (h : IsTreeDecomposition G T τ) {S : Finset ι} {r t : ι} + (hS : S ⊆ T.verts) (hr : r ∈ S) (ht : t ∈ S) : + (τ t).toHypergraph ≤ (cross τ S r).toHypergraph := by + rw [cross_toHypergraph_of_mem τ hr] + exact Hypergraph.le_biUnion (fun i hi ↦ h.le i (hS hi)) ht + +/-- For `S ⊆ V(T)` with `r ∈ S`, `(cross τ S r)⁻` is a subhypergraph of `G⁻`. -/ +theorem cross_le (h : IsTreeDecomposition G T τ) {S : Finset ι} {r : ι} + (hS : S ⊆ T.verts) (hr : r ∈ S) : + (cross τ S r).toHypergraph ≤ G.toHypergraph := by + rw [cross_toHypergraph_of_mem τ hr] + exact Hypergraph.biUnion_le fun i hi ↦ h.le i (hS hi) + +/-- Monotonicity of `(cross τ S r)⁻` in `S ⊆ V(T)`. -/ +theorem cross_le_cross (h : IsTreeDecomposition G T τ) {S₁ S₂ : Finset ι} {r₁ r₂ : ι} + (h₁₂ : S₁ ⊆ S₂) (h₂ : S₂ ⊆ T.verts) (hr₁ : r₁ ∈ S₁) (hr₂ : r₂ ∈ S₂) : + (cross τ S₁ r₁).toHypergraph ≤ (cross τ S₂ r₂).toHypergraph := by + rw [cross_toHypergraph_of_mem τ hr₁, cross_toHypergraph_of_mem τ hr₂] + exact Hypergraph.biUnion_mono h₁₂ fun i hi ↦ h.le i (h₂ hi) + +/-- For every edge `f ∈ E(T)`, `(τ × T^f)⁻ ∩ (τ × T_f)⁻ = τ(f)⁻ ∩ τ(parent f)⁻`. -/ +theorem subtreeAt_inter_rootSide_eq (h : IsTreeDecomposition G T τ) {f : ι} (hf : f ∈ T.edges) : + (cross τ (T.subtreeAt f) f).toHypergraph ∩ (cross τ (T.rootSide f) T.root).toHypergraph = + (τ f).toHypergraph ∩ (τ (T.parent f)).toHypergraph := by + have hfv : f ∈ T.verts := T.edges_subset_verts hf + have hsub : T.subtreeAt f ⊆ T.verts := T.subtreeAt_subset_verts f + have hroot : T.rootSide f ⊆ T.verts := T.rootSide_subset_verts f + have hf_mem : f ∈ T.subtreeAt f := T.self_mem_subtreeAt hfv + have hr_mem : T.root ∈ T.rootSide f := T.root_mem_rootSide hf + have hp_mem : T.parent f ∈ T.rootSide f := T.parent_mem_rootSide hf + have hle₁ : (τ f).toHypergraph ≤ (cross τ (T.subtreeAt f) f).toHypergraph := + h.le_cross hsub hf_mem hf_mem + have hle₂ : (τ (T.parent f)).toHypergraph ≤ (cross τ (T.rootSide f) T.root).toHypergraph := + h.le_cross hroot hr_mem hp_mem + have h_inter_le : (τ f).toHypergraph ∩ (τ (T.parent f)).toHypergraph ≤ + (cross τ (T.subtreeAt f) f).toHypergraph ∩ (cross τ (T.rootSide f) T.root).toHypergraph := + Hypergraph.le_inter + ((Hypergraph.inter_le_left (h.le f hfv) (h.le _ (T.parent_mem f hfv))).trans hle₁) + ((Hypergraph.inter_le_right (h.le f hfv) (h.le _ (T.parent_mem f hfv))).trans hle₂) + refine (Hypergraph.eq_of_le_of_subset h_inter_le ?_ ?_).symm + · rintro v ⟨hv₁, hv₂⟩ + rw [cross_toHypergraph_of_mem τ hf_mem, biUnion_vertexSet, Set.mem_iUnion₂] at hv₁ + rw [cross_toHypergraph_of_mem τ hr_mem, biUnion_vertexSet, Set.mem_iUnion₂] at hv₂ + obtain ⟨t₁, ht₁, hv₁⟩ := hv₁ + obtain ⟨t₃, ht₃, hv₃⟩ := hv₂ + have h_head := T.onPath_head_of_mem_subtreeAt_of_mem_rootSide ht₁ ht₃ + have h_par := T.onPath_parent_of_mem_subtreeAt_of_mem_rootSide hf ht₁ ht₃ + have hv : v ∈ ((τ t₁).toHypergraph ∩ (τ t₃).toHypergraph).vertexSet := ⟨hv₁, hv₃⟩ + exact ⟨(h.inter_le t₁ (hsub ht₁) f hfv t₃ (hroot ht₃) h_head).vertexSet_subset hv, + (h.inter_le t₁ (hsub ht₁) (T.parent f) (T.parent_mem f hfv) t₃ (hroot ht₃) + h_par).vertexSet_subset hv⟩ + · rintro e ⟨he₁, he₂⟩ + rw [cross_toHypergraph_of_mem τ hf_mem, biUnion_edgeSet, Set.mem_iUnion₂] at he₁ + rw [cross_toHypergraph_of_mem τ hr_mem, biUnion_edgeSet, Set.mem_iUnion₂] at he₂ + obtain ⟨t₁, ht₁, he₁⟩ := he₁ + obtain ⟨t₃, ht₃, he₃⟩ := he₂ + have hne : t₁ ≠ t₃ := by + rintro rfl + exact Finset.disjoint_left.mp (T.disjoint_subtreeAt_rootSide f) ht₁ ht₃ + have h_empty := h.edgeSet_inter_eq t₁ (hsub ht₁) t₃ (hroot ht₃) hne + have he : e ∈ ((τ t₁).toHypergraph ∩ (τ t₃).toHypergraph).edgeSet := ⟨he₁, he₃⟩ + rw [h_empty] at he + exact False.elim he + +/-- Graph Minors IV, (3.1): if `(T, τ)` is a tree-decomposition of a rooted hypergraph `G` and +`f ∈ E(T)`, then `(τ × T^f, τ × T_f)` is a separation of `G`. -/ +theorem isSeparation_edge {ι : Type*} {G : RootedHypergraph α β} + {T : RootedTree ι} {τ : ι → RootedHypergraph α β} (h : IsTreeDecomposition G T τ) + {f : ι} (hf : f ∈ T.edges) : + G.IsSeparation (cross τ (T.subtreeAt f) f) (cross τ (T.rootSide f) T.root) := by + classical + have hfv : f ∈ T.verts := T.edges_subset_verts hf + have hf_mem : f ∈ T.subtreeAt f := T.self_mem_subtreeAt hfv + have hr_mem : T.root ∈ T.rootSide f := T.root_mem_rootSide hf + refine ⟨?_, h.roots_root, ?_⟩ + · refine ⟨h.cross_le (T.subtreeAt_subset_verts f) hf_mem, + h.cross_le (T.rootSide_subset_verts f) hr_mem, ?_, ?_⟩ + · rw [cross_toHypergraph_of_mem τ hf_mem, cross_toHypergraph_of_mem τ hr_mem, + ← Hypergraph.biUnion_union, T.subtreeAt_union_rootSide f, h.biUnion_eq] + · rw [h.subtreeAt_inter_rootSide_eq hf] + exact h.edgeSet_inter_eq f hfv (T.parent f) (T.parent_mem f hfv) (T.parent_ne_self hf).symm + · rw [cross_rootSet, h.subtreeAt_inter_rootSide_eq hf, h.rootSet_edge f hf] + +/-- The order of an edge `f` in a tree-decomposition `(T, τ)` equals +`|V(τ(f)⁻ ∩ τ(parent f)⁻)|`. -/ +theorem edgeOrder_eq_ncard_inter (h : IsTreeDecomposition G T τ) {f : ι} (hf : f ∈ T.edges) : + edgeOrder T τ f = ((τ f).toHypergraph ∩ (τ (T.parent f)).toHypergraph).vertexSet.ncard := by + simp only [edgeOrder, separationOrder, h.subtreeAt_inter_rootSide_eq hf] + +/-- The order of an edge `f` in a tree-decomposition `(T, τ)` equals +`|V(τ(f)) ∩ V(τ(parent f))|`. -/ +theorem edgeOrder_eq_ncard_vertexSet_inter (h : IsTreeDecomposition G T τ) {f : ι} + (hf : f ∈ T.edges) : + edgeOrder T τ f = ((τ f).vertexSet ∩ (τ (T.parent f)).vertexSet).ncard := + h.edgeOrder_eq_ncard_inter hf + +/-- The order of an edge `f` in a tree-decomposition `(T, τ)` equals `|πBar(τ(f))|`. -/ +theorem edgeOrder_eq_ncard_rootSet (h : IsTreeDecomposition G T τ) {f : ι} (hf : f ∈ T.edges) : + edgeOrder T τ f = (τ f).rootSet.ncard := by + rw [h.edgeOrder_eq_ncard_inter hf, h.rootSet_edge f hf] + +/-- The order of an edge `f` in a tree-decomposition `(T, τ)` equals the length of `π(τ(f))`. -/ +theorem edgeOrder_eq_length_roots (h : IsTreeDecomposition G T τ) {f : ι} (hf : f ∈ T.edges) : + edgeOrder T τ f = (τ f).roots.length := by + rw [h.edgeOrder_eq_ncard_rootSet hf, RootedHypergraph.ncard_rootSet] + +/-- For every edge `f ∈ E(T)`, `(τ × T^f)⁻ ∩ τ(parent f)⁻ = τ(f)⁻ ∩ τ(parent f)⁻`. -/ +theorem subtreeAt_inter_parent_eq (h : IsTreeDecomposition G T τ) {f : ι} (hf : f ∈ T.edges) : + (cross τ (T.subtreeAt f) f).toHypergraph ∩ (τ (T.parent f)).toHypergraph = + (τ f).toHypergraph ∩ (τ (T.parent f)).toHypergraph := by + have hfv : f ∈ T.verts := T.edges_subset_verts hf + have hsub : T.subtreeAt f ⊆ T.verts := T.subtreeAt_subset_verts f + have hf_mem : f ∈ T.subtreeAt f := T.self_mem_subtreeAt hfv + have hp_mem : T.parent f ∈ T.rootSide f := T.parent_mem_rootSide hf + have hpv : T.parent f ∈ T.verts := T.parent_mem f hfv + have hle₁ : (τ f).toHypergraph ≤ (cross τ (T.subtreeAt f) f).toHypergraph := + h.le_cross hsub hf_mem hf_mem + have h_inter_le : (τ f).toHypergraph ∩ (τ (T.parent f)).toHypergraph ≤ + (cross τ (T.subtreeAt f) f).toHypergraph ∩ (τ (T.parent f)).toHypergraph := + Hypergraph.le_inter + ((Hypergraph.inter_le_left (h.le f hfv) (h.le _ hpv)).trans hle₁) + (Hypergraph.inter_le_right (h.le f hfv) (h.le _ hpv)) + refine (Hypergraph.eq_of_le_of_subset h_inter_le ?_ ?_).symm + · rintro v ⟨hv₁, hv₂⟩ + rw [cross_toHypergraph_of_mem τ hf_mem, biUnion_vertexSet, Set.mem_iUnion₂] at hv₁ + obtain ⟨t₁, ht₁, hv₁⟩ := hv₁ + have h_head := T.onPath_head_of_mem_subtreeAt_of_mem_rootSide ht₁ hp_mem + have hv : v ∈ ((τ t₁).toHypergraph ∩ (τ (T.parent f)).toHypergraph).vertexSet := ⟨hv₁, hv₂⟩ + exact ⟨(h.inter_le t₁ (hsub ht₁) f hfv (T.parent f) hpv h_head).vertexSet_subset hv, hv₂⟩ + · rintro e ⟨he₁, he₂⟩ + rw [cross_toHypergraph_of_mem τ hf_mem, biUnion_edgeSet, Set.mem_iUnion₂] at he₁ + obtain ⟨t₁, ht₁, he₁⟩ := he₁ + have hne : t₁ ≠ T.parent f := by + rintro rfl + exact Finset.disjoint_left.mp (T.disjoint_subtreeAt_rootSide f) ht₁ hp_mem + have h_empty := h.edgeSet_inter_eq t₁ (hsub ht₁) (T.parent f) hpv hne + have he : e ∈ ((τ t₁).toHypergraph ∩ (τ (T.parent f)).toHypergraph).edgeSet := ⟨he₁, he₂⟩ + rw [h_empty] at he + exact False.elim he + +theorem branching_le (h : IsTreeDecomposition G T τ) {s t : ι} (hs : s ∈ T.verts) + (ht : t ∈ (T.starAt s).verts) : + (branching T τ s t).toHypergraph ≤ G.toHypergraph := by + rcases T.mem_starAt_verts.mp ht with rfl | ht_child + · rw [branching_self] + exact h.le t hs + · rw [branching_of_mem_children T τ ht_child] + have htv : t ∈ T.verts := T.children_subset_verts s ht_child + exact h.cross_le (T.subtreeAt_subset_verts t) (T.self_mem_subtreeAt htv) + +/-- For every `s ∈ V(T)`, the branching of `(T, τ)` at `s` is a star-decomposition of +`τ × T^s`. -/ +theorem isStarDecomposition_branching (h : IsTreeDecomposition G T τ) {s : ι} (hs : s ∈ T.verts) : + IsStarDecomposition (T.starAt s) (branching T τ s) := by + refine ⟨T.isStar_starAt s, ?_⟩ + have hr_mem : (T.starAt s).root ∈ (T.starAt s).verts := (T.starAt s).root_mem + refine ⟨?_, (cross_toHypergraph_of_mem _ hr_mem).symm, ?_, ?_, rfl, ?_⟩ + · intro t ht + rw [cross_toHypergraph_of_mem _ hr_mem] + exact Hypergraph.le_biUnion (fun i hi ↦ h.branching_le hs hi) ht + · intro t₁ ht₁ t₂ ht₂ hne + ext e + simp only [inter_edgeSet, Set.mem_inter_iff, Set.mem_empty_iff_false, iff_false, not_and] + intro he₁ he₂ + have mem_verts_of_branching : ∀ {t}, t ∈ (T.starAt s).verts → + e ∈ (branching T τ s t).edgeSet → + ∃ u ∈ T.verts, (t = s ∧ u = s ∨ t ∈ T.children s ∧ u ∈ T.subtreeAt t) ∧ + e ∈ (τ u).edgeSet := by + intro t ht he + rcases T.mem_starAt_verts.mp ht with rfl | ht_child + · rw [branching_self] at he + exact ⟨t, hs, Or.inl ⟨rfl, rfl⟩, he⟩ + · have htv : t ∈ T.verts := T.children_subset_verts s ht_child + rw [branching_of_mem_children T τ ht_child, + cross_toHypergraph_of_mem _ (T.self_mem_subtreeAt htv), + biUnion_edgeSet, Set.mem_iUnion₂] at he + obtain ⟨u, hu, he⟩ := he + exact ⟨u, T.subtreeAt_subset_verts t hu, Or.inr ⟨ht_child, hu⟩, he⟩ + obtain ⟨u₁, hu₁v, hcase₁, heu₁⟩ := mem_verts_of_branching ht₁ he₁ + obtain ⟨u₂, hu₂v, hcase₂, heu₂⟩ := mem_verts_of_branching ht₂ he₂ + have hu_ne : u₁ ≠ u₂ := by + rintro rfl + rcases hcase₁ with ⟨rfl, rfl⟩ | ⟨ht₁c, hu₁⟩ <;> + rcases hcase₂ with ⟨rfl, h₂⟩ | ⟨ht₂c, hu₂⟩ + · exact hne rfl + · obtain ⟨ht₂e, hp₂⟩ := T.mem_children_iff.mp ht₂c + exact T.not_reaches_parent ht₂e (hp₂ ▸ T.mem_subtreeAt.mp hu₂) + · obtain ⟨ht₁e, hp₁⟩ := T.mem_children_iff.mp ht₁c + exact T.not_reaches_parent ht₁e (hp₁ ▸ h₂ ▸ T.mem_subtreeAt.mp hu₁) + · by_cases ht₁₂ : t₁ = t₂ + · exact hne ht₁₂ + · exact Finset.disjoint_left.mp + (T.disjoint_subtreeAt_of_mem_children ht₁c ht₂c ht₁₂) hu₁ hu₂ + have h_empty := h.edgeSet_inter_eq u₁ hu₁v u₂ hu₂v hu_ne + have he : e ∈ ((τ u₁).toHypergraph ∩ (τ u₂).toHypergraph).edgeSet := ⟨heu₁, heu₂⟩ + rw [h_empty] at he + exact False.elim he + · intro t₁ ht₁ t₂ ht₂ t₃ ht₃ hon + have hle₁ := h.branching_le hs ht₁ + have hle₃ := h.branching_le hs ht₃ + by_cases h₂₁ : t₂ = t₁ + · subst h₂₁ + exact Hypergraph.inter_le_left hle₁ hle₃ + · by_cases h₂₃ : t₂ = t₃ + · subst h₂₃ + exact Hypergraph.inter_le_right hle₁ hle₃ + · have ht₂s : t₂ = s := by + rcases hon.1 with h₁ | h₃ + · exact (T.reaches_starAt h₁).resolve_left h₂₁ + · exact (T.reaches_starAt h₃).resolve_left h₂₃ + subst ht₂s + have ht₁c : t₁ ∈ T.children t₂ := by + rcases T.mem_starAt_verts.mp ht₁ with rfl | h1 + · exact absurd rfl h₂₁ + · exact h1 + have ht₃c : t₃ ∈ T.children t₂ := by + rcases T.mem_starAt_verts.mp ht₃ with rfl | h3 + · exact absurd rfl h₂₃ + · exact h3 + have ht₁₃ : t₁ ≠ t₃ := by + rintro rfl + have hr : (T.starAt t₂).Reaches t₁ t₂ := + hon.2 t₁ ((T.starAt t₂).reaches_refl ht₁) ((T.starAt t₂).reaches_refl ht₁) + rcases T.reaches_starAt hr with h | h <;> exact h₂₁ h.symm + rw [branching_self, branching_of_mem_children T τ ht₁c, branching_of_mem_children T τ ht₃c] + have ht₁v : t₁ ∈ T.verts := T.children_subset_verts t₂ ht₁c + have ht₃v : t₃ ∈ T.verts := T.children_subset_verts t₂ ht₃c + have ht₁_sub : t₁ ∈ T.subtreeAt t₁ := T.self_mem_subtreeAt ht₁v + have ht₃_sub : t₃ ∈ T.subtreeAt t₃ := T.self_mem_subtreeAt ht₃v + have h_empty : ((cross τ (T.subtreeAt t₁) t₁).toHypergraph ∩ + (cross τ (T.subtreeAt t₃) t₃).toHypergraph).edgeSet = ∅ := by + ext e + simp only [inter_edgeSet, Set.mem_inter_iff, Set.mem_empty_iff_false, iff_false, not_and] + rw [cross_toHypergraph_of_mem τ ht₁_sub, cross_toHypergraph_of_mem τ ht₃_sub, + biUnion_edgeSet, biUnion_edgeSet, Set.mem_iUnion₂, Set.mem_iUnion₂] + rintro ⟨u₁, hu₁, he₁⟩ ⟨u₃, hu₃, he₃⟩ + have hu_ne : u₁ ≠ u₃ := by + rintro rfl + exact Finset.disjoint_left.mp + (T.disjoint_subtreeAt_of_mem_children ht₁c ht₃c ht₁₃) hu₁ hu₃ + have he : e ∈ ((τ u₁).toHypergraph ∩ (τ u₃).toHypergraph).edgeSet := ⟨he₁, he₃⟩ + rw [h.edgeSet_inter_eq u₁ (T.subtreeAt_subset_verts t₁ hu₁) u₃ + (T.subtreeAt_subset_verts t₃ hu₃) hu_ne] at he + exact False.elim he + refine ⟨?_, ?_, ?_⟩ + · rintro v ⟨hv₁, hv₃⟩ + rw [cross_toHypergraph_of_mem τ ht₁_sub, biUnion_vertexSet, Set.mem_iUnion₂] at hv₁ + rw [cross_toHypergraph_of_mem τ ht₃_sub, biUnion_vertexSet, Set.mem_iUnion₂] at hv₃ + obtain ⟨u₁, hu₁, hv₁⟩ := hv₁ + obtain ⟨u₃, hu₃, hv₃⟩ := hv₃ + have hu₃_root : u₃ ∈ T.rootSide t₁ := by + refine T.mem_rootSide.mpr ⟨T.subtreeAt_subset_verts t₃ hu₃, fun h₁ ↦ ?_⟩ + exact Finset.disjoint_left.mp (T.disjoint_subtreeAt_of_mem_children ht₁c ht₃c ht₁₃) + (T.mem_subtreeAt.mpr h₁) hu₃ + obtain ⟨ht₁e, hp₁⟩ := T.mem_children_iff.mp ht₁c + have hon_p := T.onPath_parent_of_mem_subtreeAt_of_mem_rootSide ht₁e hu₁ hu₃_root + rw [hp₁] at hon_p + have hv : v ∈ ((τ u₁).toHypergraph ∩ (τ u₃).toHypergraph).vertexSet := ⟨hv₁, hv₃⟩ + exact (h.inter_le u₁ (T.subtreeAt_subset_verts t₁ hu₁) t₂ hs u₃ + (T.subtreeAt_subset_verts t₃ hu₃) hon_p).vertexSet_subset hv + · rw [h_empty] + exact Set.empty_subset _ + · intro e he + rw [h_empty] at he + exact False.elim he + · intro f hf + rw [T.starAt_edges] at hf + obtain ⟨hfe, hfp⟩ := T.mem_children_iff.mp hf + rw [branching_of_mem_children T τ hf, T.starAt_parent, branching_self, ← hfp] + rw [cross_rootSet, h.subtreeAt_inter_parent_eq hfe, h.rootSet_edge f hfe] + +end IsTreeDecomposition + +end GM04 + +end GraphMinor diff --git a/LeanPool/GraphMinor/GM04/Decomposition/Contraction.lean b/LeanPool/GraphMinor/GM04/Decomposition/Contraction.lean new file mode 100644 index 0000000000..b0debde0cd --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Decomposition/Contraction.lean @@ -0,0 +1,390 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Decomposition.Basic + +/-! +# Contraction of a tree-decomposition (Graph Minors IV, (3.2)) + +This file proves Graph Minors IV, (3.2) (page 234): if `(T, τ)` is a tree-decomposition of a rooted +hypergraph `G`, `F ⊆ E(T)`, `S` is the contraction of `T` onto `F`, and `σ(s) = τ × T_s` where +`T_s` is the component of `T \ F` with root `s`, then `(S, σ)` is a tree-decomposition of `G`. +-/ + +public section + +namespace GraphMinor.GM04 + +open Hypergraph + +variable {α β ι : Type*} + +namespace RootedTree + +variable (T : RootedTree ι) + +/-- Every vertex `x` of `T` has a lowest common ancestor `a` with any other vertex `y` of `T`. -/ +theorem exists_lca {x y : ι} (hx : x ∈ T.verts) (hy : y ∈ T.verts) : + ∃ a ∈ T.verts, T.Reaches a x ∧ T.Reaches a y ∧ + ∀ z, T.Reaches z x → T.Reaches z y → T.Reaches z a := by + obtain ⟨n, hn⟩ := T.exists_iterate_eq_root x hx + have hroot : T.Reaches T.root y := T.reaches_root hy + revert hx hn + generalize T.root = u at hroot + intro hx hn + induction n generalizing x with + | zero => + rw [Function.iterate_zero_apply] at hn + subst hn + exact ⟨x, hx, T.reaches_refl hx, hroot, fun _ hzx _ ↦ hzx⟩ + | succ k ih => + by_cases hxy : T.Reaches x y + · exact ⟨x, hx, T.reaches_refl hx, hxy, fun _ hzx _ ↦ hzx⟩ + · rw [Function.iterate_succ_apply] at hn + obtain ⟨a, hav, hap, hay, ha⟩ := ih (T.parent_mem x hx) hn + refine ⟨a, hav, T.reaches_trans hap (T.reaches_parent hx), hay, fun z hzx hzy ↦ ?_⟩ + have hzx_ne : z ≠ x := by + rintro rfl + exact hxy hzy + exact ha z (T.reaches_parent_of_reaches_of_ne hzx hzx_ne) hzy + +private theorem exists_isComponentRoot_mem (F : Set ι) {x : ι} (hx : x ∈ T.verts) : + ∃ s ∈ T.verts, T.IsComponentRoot F s x := by + obtain ⟨n, hn⟩ := T.exists_iterate_eq_root x hx + induction n generalizing x with + | zero => + rw [Function.iterate_zero_apply] at hn + exact ⟨x, hx, T.isComponentRoot_self hx (Or.inl hn)⟩ + | succ k ih => + by_cases hxF : x = T.root ∨ x ∈ F + · exact ⟨x, hx, T.isComponentRoot_self hx hxF⟩ + · push Not at hxF + rw [Function.iterate_succ_apply] at hn + obtain ⟨s, hsv, hs⟩ := ih (T.parent_mem x hx) hn + refine ⟨s, hsv, T.reaches_trans hs.1 (T.reaches_parent hx), hs.2.1, fun g hne hsg hgx ↦ ?_⟩ + rcases (T.reaches_iff_eq_or_reaches_parent hx).mp hgx with rfl | hgp + · exact hxF.2 + · exact hs.2.2 g hne hsg hgp + +theorem componentAt_subset_subtreeAt (F : Set ι) (s : ι) : + T.componentAt F s ⊆ T.subtreeAt s := by + intro x hx + exact T.mem_subtreeAt.mpr (T.mem_componentAt.mp hx).1 + +section IsContraction + +variable {T} {F : Set ι} {S : RootedTree ι} + +private theorem IsContraction.mem_verts_iff_of_subset (hF : F ⊆ T.edges) + (hS : T.IsContraction F S) {s : ι} : + s ∈ S.verts ↔ s = T.root ∨ s ∈ F := by + have h := Set.ext_iff.mp hS.verts_eq s + rw [Finset.mem_coe, Set.mem_insert_iff, Set.mem_inter_iff] at h + exact h.trans (or_congr_right ⟨And.left, fun hs ↦ ⟨hs, hF hs⟩⟩) + +private theorem IsContraction.verts_subset_of_subset (hF : F ⊆ T.edges) + (hS : T.IsContraction F S) : + S.verts ⊆ T.verts := by + intro s hs + rcases hS.mem_verts_iff_of_subset hF |>.mp hs with rfl | hsF + · exact T.root_mem + · exact T.edges_subset_verts (hF hsF) + +private theorem IsContraction.mem_edges_iff_of_subset (hF : F ⊆ T.edges) + (hS : T.IsContraction F S) {f : ι} : + f ∈ S.edges ↔ f ∈ F := by + rw [S.mem_edges_iff, hS.mem_verts_iff_of_subset hF, hS.root_eq] + refine ⟨?_, fun hf ↦ ⟨Or.inr hf, (T.mem_edges_iff.mp (hF hf)).2⟩⟩ + rintro ⟨rfl | hf, hne⟩ + · exact absurd rfl hne + · exact hf + +private theorem IsContraction.edges_subset (hF : F ⊆ T.edges) (hS : T.IsContraction F S) : + S.edges ⊆ T.edges := by + intro f hf + exact hF ((hS.mem_edges_iff_of_subset hF).mp hf) + +private theorem IsContraction.self_mem_componentAt (hF : F ⊆ T.edges) (hS : T.IsContraction F S) + {s : ι} (hs : s ∈ S.verts) : s ∈ T.componentAt F s := + T.mem_componentAt.mpr + (T.isComponentRoot_self (hS.verts_subset_of_subset hF hs) + ((hS.mem_verts_iff_of_subset hF).mp hs)) + +theorem IsContraction.reaches_of_reaches (hF : F ⊆ T.edges) (hS : T.IsContraction F S) + {s₁ s₂ : ι} (h : S.Reaches s₁ s₂) : T.Reaches s₁ s₂ := by + obtain ⟨hs₂, n, rfl⟩ := h + induction n generalizing s₂ with + | zero => exact T.reaches_refl (hS.verts_subset_of_subset hF hs₂) + | succ k ih => + rw [Function.iterate_succ_apply] + have hstep : T.Reaches (S.parent s₂) s₂ := by + by_cases hs₂r : s₂ = S.root + · rw [hs₂r, S.parent_root] + exact T.reaches_refl (hS.verts_subset_of_subset hF S.root_mem) + · have hs₂e : s₂ ∈ S.edges := S.mem_edges_iff.mpr ⟨hs₂, hs₂r⟩ + have hcomp := hS.parent_eq s₂ hs₂e + exact T.reaches_trans hcomp.1 (T.reaches_parent (hS.verts_subset_of_subset hF hs₂)) + exact T.reaches_trans (ih (S.parent_mem s₂ hs₂)) hstep + +theorem IsContraction.reaches_of_isComponentRoot (hF : F ⊆ T.edges) (hS : T.IsContraction F S) + {u s x : ι} (hu : u ∈ S.verts) (hsx : T.IsComponentRoot F s x) (hux : T.Reaches u x) : + T.Reaches u s := by + rcases T.reaches_total_of_reaches hux hsx.1 with hus | hsu + · exact hus + · by_cases h_eq : u = s + · subst h_eq + exact T.reaches_refl (hS.verts_subset_of_subset hF hu) + · rcases (hS.mem_verts_iff_of_subset hF).mp hu with rfl | huF + · rw [T.reaches_root_iff] at hsu + exact absurd hsu.symm h_eq + · exact absurd huF (hsx.2.2 u h_eq hsu hux) + +theorem IsContraction.reaches_iff (hF : F ⊆ T.edges) (hS : T.IsContraction F S) + {s₁ s₂ : ι} (hs₁ : s₁ ∈ S.verts) (hs₂ : s₂ ∈ S.verts) : + S.Reaches s₁ s₂ ↔ T.Reaches s₁ s₂ := by + refine ⟨hS.reaches_of_reaches hF, fun h ↦ ?_⟩ + obtain ⟨n, hn⟩ := S.exists_iterate_eq_root s₂ hs₂ + induction n generalizing s₂ with + | zero => + rw [Function.iterate_zero_apply, hS.root_eq] at hn + subst hn + rw [T.reaches_root_iff] at h + subst h + exact S.reaches_refl hs₂ + | succ k ih => + by_cases h₁₂ : s₁ = s₂ + · subst h₁₂ + exact S.reaches_refl hs₁ + · have hs₂e : s₂ ∈ S.edges := by + refine S.mem_edges_iff.mpr ⟨hs₂, ?_⟩ + rw [hS.root_eq] + rintro rfl + exact h₁₂ (T.reaches_root_iff.mp h) + have h_par_T : T.Reaches s₁ (T.parent s₂) := T.reaches_parent_of_reaches_of_ne h h₁₂ + have hcomp := hS.parent_eq s₂ hs₂e + have h_par_S : T.Reaches s₁ (S.parent s₂) := + hS.reaches_of_isComponentRoot hF hs₁ hcomp h_par_T + rw [Function.iterate_succ_apply] at hn + exact S.reaches_trans (ih (S.parent_mem s₂ hs₂) h_par_S hn) (S.reaches_parent hs₂) + +theorem IsContraction.reaches_iff_of_mem_componentAt (hF : F ⊆ T.edges) (hS : T.IsContraction F S) + {u s x : ι} (hu : u ∈ S.verts) (hs : s ∈ S.verts) (hx : x ∈ T.componentAt F s) : + T.Reaches u x ↔ S.Reaches u s := by + rw [hS.reaches_iff hF hu hs] + have hsx := T.mem_componentAt.mp hx + exact ⟨hS.reaches_of_isComponentRoot hF hu hsx, fun hus ↦ T.reaches_trans hus hsx.1⟩ + +theorem IsContraction.componentAt_parent_subset_rootSide (hF : F ⊆ T.edges) + (hS : T.IsContraction F S) {f : ι} (hf : f ∈ S.edges) : + T.componentAt F (S.parent f) ⊆ T.rootSide f := by + intro x hx + have hxv : x ∈ T.verts := T.componentAt_subset_verts F (S.parent f) hx + refine T.mem_rootSide.mpr ⟨hxv, fun hfx ↦ ?_⟩ + have hf_verts : f ∈ S.verts := S.edges_subset_verts hf + have hp_verts : S.parent f ∈ S.verts := S.parent_mem f hf_verts + have hS_reach : S.Reaches f (S.parent f) := + (hS.reaches_iff_of_mem_componentAt hF hf_verts hp_verts hx).mp hfx + exact S.not_reaches_parent hf hS_reach + +theorem IsContraction.exists_mem_componentAt_onPath (hF : F ⊆ T.edges) (hS : T.IsContraction F S) + {s₁ s₂ s₃ x₁ x₃ : ι} (hs₁ : s₁ ∈ S.verts) (hs₂ : s₂ ∈ S.verts) (hs₃ : s₃ ∈ S.verts) + (hon : S.OnPath s₁ s₃ s₂) (hx₁ : x₁ ∈ T.componentAt F s₁) (hx₃ : x₃ ∈ T.componentAt F s₃) : + ∃ x₂ ∈ T.componentAt F s₂, T.OnPath x₁ x₃ x₂ := by + have hx₁v : x₁ ∈ T.verts := T.componentAt_subset_verts F s₁ hx₁ + have hx₃v : x₃ ∈ T.verts := T.componentAt_subset_verts F s₃ hx₃ + obtain ⟨a, hav, ha₁, ha₃, ha_lca⟩ := T.exists_lca hx₁v hx₃v + have hs₂_reach : T.Reaches s₂ x₁ ∨ T.Reaches s₂ x₃ := by + rcases hon.1 with h₂₁ | h₂₃ + · exact Or.inl ((hS.reaches_iff_of_mem_componentAt hF hs₂ hs₁ hx₁).mpr h₂₁) + · exact Or.inr ((hS.reaches_iff_of_mem_componentAt hF hs₂ hs₃ hx₃).mpr h₂₃) + by_cases has₂ : T.Reaches a s₂ + · refine ⟨s₂, hS.self_mem_componentAt hF hs₂, hs₂_reach, fun z hz₁ hz₃ ↦ ?_⟩ + exact T.reaches_trans (ha_lca z hz₁ hz₃) has₂ + · have hs₂a : T.Reaches s₂ a := by + rcases hs₂_reach with hs₂₁ | hs₂₃ + · exact (T.reaches_total_of_reaches hs₂₁ ha₁).resolve_right has₂ + · exact (T.reaches_total_of_reaches hs₂₃ ha₃).resolve_right has₂ + obtain ⟨u, huv, hua⟩ := T.exists_isComponentRoot_mem F hav + have huS : u ∈ S.verts := (hS.mem_verts_iff_of_subset hF).mpr hua.2.1 + have hu_mem : a ∈ T.componentAt F u := T.mem_componentAt.mpr hua + have hu₁ : S.Reaches u s₁ := + (hS.reaches_iff_of_mem_componentAt hF huS hs₁ hx₁).mp (T.reaches_trans hua.1 ha₁) + have hu₃ : S.Reaches u s₃ := + (hS.reaches_iff_of_mem_componentAt hF huS hs₃ hx₃).mp (T.reaches_trans hua.1 ha₃) + have hu₂ : S.Reaches u s₂ := hon.2 u hu₁ hu₃ + have hs₂_u : S.Reaches s₂ u := + (hS.reaches_iff_of_mem_componentAt hF hs₂ huS hu_mem).mp hs₂a + have heq : u = s₂ := S.reaches_antisymm hu₂ hs₂_u + subst heq + exact ⟨a, hu_mem, Or.inl ha₁, ha_lca⟩ + +end IsContraction + +end RootedTree + +namespace IsTreeDecomposition + +variable {G : RootedHypergraph α β} {T : RootedTree ι} {τ : ι → RootedHypergraph α β} + +/-- Graph Minors IV, (3.2): contracting a tree-decomposition `(T, τ)` of `G` onto `F ⊆ E(T)` yields +a tree-decomposition `(S, σ)` of `G`. -/ +theorem contraction {ι : Type*} {G : RootedHypergraph α β} + {T : RootedTree ι} {τ : ι → RootedHypergraph α β} (h : IsTreeDecomposition G T τ) + {F : Set ι} (hF : F ⊆ T.edges) {S : RootedTree ι} (hS : T.IsContraction F S) + (σ : ι → RootedHypergraph α β) (hσ : ∀ s ∈ S.verts, σ s = cross τ (T.componentAt F s) s) : + IsTreeDecomposition G S σ where + le s hs := by + rw [hσ s hs] + exact h.cross_le (T.componentAt_subset_verts F s) (hS.self_mem_componentAt hF hs) + biUnion_eq := by + have hle : Hypergraph.biUnion S.verts (fun s ↦ (σ s).toHypergraph) ≤ G.toHypergraph := by + refine Hypergraph.biUnion_le fun s hs ↦ ?_ + rw [hσ s hs] + exact h.cross_le (T.componentAt_subset_verts F s) (hS.self_mem_componentAt hF hs) + refine Hypergraph.eq_of_le_of_subset hle ?_ ?_ + · intro v hv + rw [← h.biUnion_eq, biUnion_vertexSet, Set.mem_iUnion₂] at hv + obtain ⟨x, hx, hv⟩ := hv + obtain ⟨s, _, hsx⟩ := T.exists_isComponentRoot_mem F hx + have hs : s ∈ S.verts := (hS.mem_verts_iff_of_subset hF).mpr hsx.2.1 + rw [biUnion_vertexSet, Set.mem_iUnion₂] + refine ⟨s, hs, ?_⟩ + rw [hσ s hs, cross_toHypergraph_of_mem τ (hS.self_mem_componentAt hF hs), + biUnion_vertexSet, Set.mem_iUnion₂] + exact ⟨x, T.mem_componentAt.mpr hsx, hv⟩ + · intro e he + rw [← h.biUnion_eq, biUnion_edgeSet, Set.mem_iUnion₂] at he + obtain ⟨x, hx, he⟩ := he + obtain ⟨s, _, hsx⟩ := T.exists_isComponentRoot_mem F hx + have hs : s ∈ S.verts := (hS.mem_verts_iff_of_subset hF).mpr hsx.2.1 + rw [biUnion_edgeSet, Set.mem_iUnion₂] + refine ⟨s, hs, ?_⟩ + rw [hσ s hs, cross_toHypergraph_of_mem τ (hS.self_mem_componentAt hF hs), + biUnion_edgeSet, Set.mem_iUnion₂] + exact ⟨x, T.mem_componentAt.mpr hsx, he⟩ + edgeSet_inter_eq s₁ hs₁ s₂ hs₂ hne := by + rw [hσ s₁ hs₁, hσ s₂ hs₂, + cross_toHypergraph_of_mem τ (hS.self_mem_componentAt hF hs₁), + cross_toHypergraph_of_mem τ (hS.self_mem_componentAt hF hs₂)] + ext e + simp only [inter_edgeSet, Set.mem_inter_iff, Set.mem_empty_iff_false, iff_false, not_and, + biUnion_edgeSet, Set.mem_iUnion₂] + rintro ⟨x₁, hx₁, he₁⟩ ⟨x₂, hx₂, he₂⟩ + have hx_ne : x₁ ≠ x₂ := by + rintro rfl + exact Finset.disjoint_left.mp (T.disjoint_componentAt (F := F) hne) hx₁ hx₂ + have he : e ∈ ((τ x₁).toHypergraph ∩ (τ x₂).toHypergraph).edgeSet := ⟨he₁, he₂⟩ + rw [h.edgeSet_inter_eq x₁ (T.componentAt_subset_verts F s₁ hx₁) + x₂ (T.componentAt_subset_verts F s₂ hx₂) hx_ne] at he + exact False.elim he + inter_le s₁ hs₁ s₂ hs₂ s₃ hs₃ hon := by + have hle₁ : (σ s₁).toHypergraph ≤ G.toHypergraph := by + rw [hσ s₁ hs₁] + exact h.cross_le (T.componentAt_subset_verts F s₁) (hS.self_mem_componentAt hF hs₁) + have hle₃ : (σ s₃).toHypergraph ≤ G.toHypergraph := by + rw [hσ s₃ hs₃] + exact h.cross_le (T.componentAt_subset_verts F s₃) (hS.self_mem_componentAt hF hs₃) + by_cases h₂₁ : s₂ = s₁ + · subst h₂₁ + exact Hypergraph.inter_le_left hle₁ hle₃ + · by_cases h₂₃ : s₂ = s₃ + · subst h₂₃ + exact Hypergraph.inter_le_right hle₁ hle₃ + · have h₁₃ : s₁ ≠ s₃ := by + rintro rfl + have hr : S.Reaches s₁ s₂ := hon.2 s₁ (S.reaches_refl hs₁) (S.reaches_refl hs₁) + rcases hon.1 with h1 | h1 <;> exact h₂₁ (S.reaches_antisymm h1 hr) + have h_empty : ((σ s₁).toHypergraph ∩ (σ s₃).toHypergraph).edgeSet = ∅ := by + rw [hσ s₁ hs₁, hσ s₃ hs₃, + cross_toHypergraph_of_mem τ (hS.self_mem_componentAt hF hs₁), + cross_toHypergraph_of_mem τ (hS.self_mem_componentAt hF hs₃)] + ext e + simp only [inter_edgeSet, Set.mem_inter_iff, Set.mem_empty_iff_false, iff_false, not_and, + biUnion_edgeSet, Set.mem_iUnion₂] + rintro ⟨x₁, hx₁, he₁⟩ ⟨x₃, hx₃, he₃⟩ + have hx_ne : x₁ ≠ x₃ := by + rintro rfl + exact Finset.disjoint_left.mp (T.disjoint_componentAt (F := F) h₁₃) hx₁ hx₃ + have he : e ∈ ((τ x₁).toHypergraph ∩ (τ x₃).toHypergraph).edgeSet := ⟨he₁, he₃⟩ + rw [h.edgeSet_inter_eq x₁ (T.componentAt_subset_verts F s₁ hx₁) + x₃ (T.componentAt_subset_verts F s₃ hx₃) hx_ne] at he + exact False.elim he + refine ⟨?_, ?_, ?_⟩ + · rintro v ⟨hv₁, hv₃⟩ + rw [hσ s₁ hs₁, cross_toHypergraph_of_mem τ (hS.self_mem_componentAt hF hs₁), + biUnion_vertexSet, Set.mem_iUnion₂] at hv₁ + rw [hσ s₃ hs₃, cross_toHypergraph_of_mem τ (hS.self_mem_componentAt hF hs₃), + biUnion_vertexSet, Set.mem_iUnion₂] at hv₃ + obtain ⟨x₁, hx₁, hv₁⟩ := hv₁ + obtain ⟨x₃, hx₃, hv₃⟩ := hv₃ + obtain ⟨x₂, hx₂, hon_T⟩ := + hS.exists_mem_componentAt_onPath hF hs₁ hs₂ hs₃ hon hx₁ hx₃ + have hv : v ∈ ((τ x₁).toHypergraph ∩ (τ x₃).toHypergraph).vertexSet := ⟨hv₁, hv₃⟩ + have hv₂ := (h.inter_le x₁ (T.componentAt_subset_verts F s₁ hx₁) + x₂ (T.componentAt_subset_verts F s₂ hx₂) + x₃ (T.componentAt_subset_verts F s₃ hx₃) hon_T).vertexSet_subset hv + rw [hσ s₂ hs₂, cross_toHypergraph_of_mem τ (hS.self_mem_componentAt hF hs₂)] + exact Set.mem_biUnion hx₂ hv₂ + · rw [h_empty] + exact Set.empty_subset _ + · intro e he + rw [h_empty] at he + exact False.elim he + roots_root := by + rw [hσ S.root S.root_mem, cross_roots, hS.root_eq, h.roots_root] + rootSet_edge f hf := by + have hf_verts : f ∈ S.verts := S.edges_subset_verts hf + have hp_verts : S.parent f ∈ S.verts := S.parent_mem f hf_verts + have hfe : f ∈ T.edges := hS.edges_subset hF hf + have hfv : f ∈ T.verts := T.edges_subset_verts hfe + have hpv : T.parent f ∈ T.verts := T.parent_mem f hfv + rw [hσ f hf_verts, hσ (S.parent f) hp_verts, cross_rootSet, h.rootSet_edge f hfe] + have hf_comp : f ∈ T.componentAt F f := hS.self_mem_componentAt hF hf_verts + have hp_comp : T.parent f ∈ T.componentAt F (S.parent f) := + T.mem_componentAt.mpr (hS.parent_eq f hf) + have hle₁ : (τ f).toHypergraph ≤ (cross τ (T.componentAt F f) f).toHypergraph := + h.le_cross (T.componentAt_subset_verts F f) hf_comp hf_comp + have hle₂ : (τ (T.parent f)).toHypergraph ≤ + (cross τ (T.componentAt F (S.parent f)) (S.parent f)).toHypergraph := + h.le_cross (T.componentAt_subset_verts F (S.parent f)) + (hS.self_mem_componentAt hF hp_verts) hp_comp + have hle₃ : (cross τ (T.componentAt F f) f).toHypergraph ≤ + (cross τ (T.subtreeAt f) f).toHypergraph := + h.cross_le_cross (T.componentAt_subset_subtreeAt F f) (T.subtreeAt_subset_verts f) + hf_comp (T.self_mem_subtreeAt hfv) + have hle₄ : (cross τ (T.componentAt F (S.parent f)) (S.parent f)).toHypergraph ≤ + (cross τ (T.rootSide f) T.root).toHypergraph := + h.cross_le_cross (hS.componentAt_parent_subset_rootSide hF hf) (T.rootSide_subset_verts f) + (hS.self_mem_componentAt hF hp_verts) (T.root_mem_rootSide hfe) + apply Set.Subset.antisymm + · exact Set.subset_inter (hle₁.vertexSet_subset.trans' Set.inter_subset_left) + (hle₂.vertexSet_subset.trans' Set.inter_subset_right) + · have hsub : ((cross τ (T.componentAt F f) f).toHypergraph ∩ + (cross τ (T.componentAt F (S.parent f)) (S.parent f)).toHypergraph).vertexSet ⊆ + ((cross τ (T.subtreeAt f) f).toHypergraph ∩ + (cross τ (T.rootSide f) T.root).toHypergraph).vertexSet := + Set.inter_subset_inter hle₃.vertexSet_subset hle₄.vertexSet_subset + rwa [h.subtreeAt_inter_rootSide_eq hfe] at hsub + +/-- Contracting a tree-decomposition `(T, τ)` onto `F ⊆ E(T)` preserves the order of every edge in +`F`. -/ +theorem edgeOrder_contraction (h : IsTreeDecomposition G T τ) + {F : Set ι} (hF : F ⊆ T.edges) {S : RootedTree ι} (hS : T.IsContraction F S) + {σ : ι → RootedHypergraph α β} (hσ : ∀ s ∈ S.verts, σ s = cross τ (T.componentAt F s) s) + {f : ι} (hf : f ∈ S.edges) : + edgeOrder S σ f = edgeOrder T τ f := by + have hdecS := h.contraction hF hS σ hσ + have hfe : f ∈ T.edges := hS.edges_subset hF hf + rw [hdecS.edgeOrder_eq_ncard_rootSet hf, h.edgeOrder_eq_ncard_rootSet hfe, + hσ f (S.edges_subset_verts hf), cross_rootSet] + +end IsTreeDecomposition + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/Decomposition/Linked.lean b/LeanPool/GraphMinor/GM04/Decomposition/Linked.lean new file mode 100644 index 0000000000..5db10d3447 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Decomposition/Linked.lean @@ -0,0 +1,395 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Decomposition.Basic + +/-! +# Linked tree-decompositions (Graph Minors IV, (3.3)) + +This file proves Graph Minors IV, (3.3) (pages 235–236): if `𝒮` is a good class of +star-decompositions and `(T_i, τ_i)` is a sequence of linked tree-decompositions all of whose +branchings belong to `𝒮`, then there exist `i < i'` such that `τ_i × T_i` is simulated in +`τ_{i'} × T_{i'}`. + +The proof follows the paper: we form disjoint copies `T'_i` of the trees `T_i` in `ℕ × ι`, define +the infinite graph `M` and edge weights `φ_i` by `edgeOrder`, prove Claims (1) and (2), and apply +(2.2) (`TreeLemma22Statement`). +-/ + +public section + +namespace GraphMinor.GM04 + +open Hypergraph + +universe u + +variable {α β : Type*} {R : Set (RootedHypergraph α β)} + {sim : RootedHypergraph α β → RootedHypergraph α β → Prop} + +/-- Disjoint copy of `T i` in `ℕ × ι` with first coordinate `i`. -/ +noncomputable def indexedTree {ι : Type*} (T : ℕ → RootedTree ι) (i : ℕ) : + RootedTree (ℕ × ι) where + verts := (T i).verts.map ⟨Prod.mk i, Prod.mk_right_injective i⟩ + root := (i, (T i).root) + parent p := (i, (T i).parent p.2) + root_mem := Finset.mem_map_of_mem _ (T i).root_mem + parent_mem p hp := by + obtain ⟨v, hv, rfl⟩ := Finset.mem_map.mp hp + exact Finset.mem_map_of_mem _ ((T i).parent_mem v hv) + parent_root := congrArg (Prod.mk i) (T i).parent_root + exists_iterate_eq_root p hp := by + obtain ⟨v, hv, rfl⟩ := Finset.mem_map.mp hp + obtain ⟨n, hn⟩ := (T i).exists_iterate_eq_root v hv + refine ⟨n, ?_⟩ + have hiter : ∀ k (w : ι), ((fun q : ℕ × ι ↦ (i, (T i).parent q.2))^[k] (i, w)) = + (i, (T i).parent^[k] w) := by + intro k + induction k with + | zero => intro w; rfl + | succ k ih => + intro w + rw [Function.iterate_succ_apply, Function.iterate_succ_apply, ih] + change (fun q : ℕ × ι ↦ (i, (T i).parent q.2))^[n] (i, v) = (i, (T i).root) + rw [hiter, hn] + +private theorem indexedTree_parent_iterate {ι : Type*} (T : ℕ → RootedTree ι) (i : ℕ) + (k : ℕ) (p : ℕ × ι) : + (indexedTree T i).parent^[k] p = + if k = 0 then p else (i, (T i).parent^[k] p.2) := by + induction k generalizing p with + | zero => simp + | succ k ih => + rw [Function.iterate_succ_apply, ih] + cases k with + | zero => + simp [indexedTree] + | succ m => + simp [indexedTree, Function.iterate_succ_apply] + +@[simp] +private theorem mem_indexedTree_verts {ι : Type*} (T : ℕ → RootedTree ι) (i : ℕ) (p : ℕ × ι) : + p ∈ (indexedTree T i).verts ↔ p.1 = i ∧ p.2 ∈ (T i).verts := by + simp only [indexedTree, Finset.mem_map, Function.Embedding.coeFn_mk] + refine ⟨?_, ?_⟩ + · rintro ⟨v, hv, rfl⟩ + exact ⟨rfl, hv⟩ + · rintro ⟨rfl, hv⟩ + exact ⟨p.2, hv, Prod.eta p⟩ + +private theorem mem_indexedTree_edges {ι : Type*} (T : ℕ → RootedTree ι) (i : ℕ) (p : ℕ × ι) : + p ∈ (indexedTree T i).edges ↔ p.1 = i ∧ p.2 ∈ (T i).edges := by + rw [RootedTree.mem_edges_iff, mem_indexedTree_verts, RootedTree.mem_edges_iff] + simp only [indexedTree, ne_eq, Prod.ext_iff, not_and] + exact ⟨fun ⟨⟨h1, h2⟩, h3⟩ ↦ ⟨h1, h2, h3 h1⟩, fun ⟨h1, h2, h3⟩ ↦ ⟨⟨h1, h2⟩, fun _ ↦ h3⟩⟩ + +private theorem indexedTree_reaches_iff {ι : Type*} (T : ℕ → RootedTree ι) (i : ℕ) + (p q : ℕ × ι) : + (indexedTree T i).Reaches p q ↔ p.1 = i ∧ q.1 = i ∧ (T i).Reaches p.2 q.2 := by + refine ⟨?_, ?_⟩ + · rintro ⟨hq, n, hn⟩ + obtain ⟨hq1, hq2⟩ := (mem_indexedTree_verts T i q).mp hq + rw [indexedTree_parent_iterate] at hn + split_ifs at hn with h0 + · subst h0 + subst hn + exact ⟨hq1, hq1, (T i).reaches_refl hq2⟩ + · rw [Prod.ext_iff] at hn + exact ⟨hn.1.symm, hq1, hq2, n, hn.2⟩ + · rintro ⟨hp1, hq1, hq2, n, hn⟩ + refine ⟨(mem_indexedTree_verts T i q).mpr ⟨hq1, hq2⟩, n, ?_⟩ + rw [indexedTree_parent_iterate] + split_ifs with h0 + · subst h0 + rw [Function.iterate_zero_apply] at hn + exact Prod.ext (hq1.trans hp1.symm) hn + · exact Prod.ext hp1.symm hn + +private theorem indexedTree_precedes_iff {ι : Type*} (T : ℕ → RootedTree ι) + (ψ : ι → ℕ) (i : ℕ) (v w : ι) : + (indexedTree T i).Precedes (fun p ↦ ψ p.2) (i, v) (i, w) ↔ + (T i).Precedes ψ v w := by + simp only [RootedTree.Precedes, indexedTree_reaches_iff, true_and] + refine and_congr ⟨fun h hv ↦ h (congrArg (Prod.mk i) hv), + fun h hv ↦ h (Prod.mk_right_injective i hv)⟩ + (and_congr_right fun _ ↦ and_congr_right fun _ ↦ ⟨?_, ?_⟩) + · intro h g hgv hvg hgw + exact h (i, g) (fun h' ↦ hgv (Prod.mk_right_injective i h')) ⟨rfl, hvg⟩ ⟨rfl, hgw⟩ + · intro h p hp ⟨hp1, hvp⟩ ⟨_, hpw⟩ + have hp_eq : p = (i, p.2) := Prod.ext hp1 rfl + have hpv : p.2 ≠ v := fun h' ↦ hp (hp_eq.trans (congrArg (Prod.mk i) h')) + exact h p.2 hpv hvp hpw + +/-- The infinite graph `M` on `ℕ × ι` in the proof of Graph Minors IV, (3.3). -/ +def simGraph {ι : Type*} (sim : RootedHypergraph α β → RootedHypergraph α β → Prop) + (T : ℕ → RootedTree ι) (τ : ℕ → ι → RootedHypergraph α β) : SimpleGraph (ℕ × ι) where + Adj p q := + (p.1 < q.1 ∧ p.2 ∈ (T p.1).verts ∧ q.2 ∈ (T q.1).verts ∧ + sim (cross (τ p.1) ((T p.1).subtreeAt p.2) p.2) + (cross (τ q.1) ((T q.1).subtreeAt q.2) q.2)) ∨ + (q.1 < p.1 ∧ q.2 ∈ (T q.1).verts ∧ p.2 ∈ (T p.1).verts ∧ + sim (cross (τ q.1) ((T q.1).subtreeAt q.2) q.2) + (cross (τ p.1) ((T p.1).subtreeAt p.2) p.2)) + symm := ⟨fun _ _ h ↦ h.symm⟩ + loopless := ⟨fun p h ↦ by rcases h with ⟨h, _⟩ | ⟨h, _⟩ <;> exact lt_irrefl p.1 h⟩ + +private theorem simGraph_adj_of_lt {ι : Type*} + {sim : RootedHypergraph α β → RootedHypergraph α β → Prop} + {T : ℕ → RootedTree ι} {τ : ℕ → ι → RootedHypergraph α β} + {i i' : ℕ} (hii' : i < i') {u w : ι} : + (simGraph sim T τ).Adj (i, u) (i', w) ↔ + u ∈ (T i).verts ∧ w ∈ (T i').verts ∧ + sim (cross (τ i) ((T i).subtreeAt u) u) (cross (τ i') ((T i').subtreeAt w) w) := by + simp only [simGraph, hii', true_and] + refine ⟨?_, Or.inl⟩ + rintro (h | ⟨h, _⟩) + · exact h + · exact absurd hii' (not_lt_of_gt h) + +private theorem cross_subtreeAt_mem_R {ι : Type*} + {𝒮 : Set (RootedTree ι × (ι → RootedHypergraph α β))} (h𝒮 : IsGood R sim 𝒮) + {T : ℕ → RootedTree ι} {τ : ℕ → ι → RootedHypergraph α β} + (hbr : ∀ i, ∀ s ∈ (T i).verts, ((T i).starAt s, branching (T i) (τ i) s) ∈ 𝒮) + (i : ℕ) {s : ι} (hs : s ∈ (T i).verts) : + cross (τ i) ((T i).subtreeAt s) s ∈ R := by + have h := h𝒮.2.1 ((T i).starAt s, branching (T i) (τ i) s) (hbr i s hs) + dsimp only at h + rwa [cross_branching_eq (T i) (τ i) hs] at h + +/-- Graph Minors IV, (3.3), Claim (1) (page 236): if `i < i'`, `u ∈ V(T_i)` is `M`-adjacent to +`w ∈ V(T_{i'})`, and `v ∈ V(T_{i'})` precedes `w`, then `u` is `M`-adjacent to `v`. -/ +theorem theorem_3_3_claim_1 {ι : Type*} (hA2 : Axiom2 R sim) + {𝒮 : Set (RootedTree ι × (ι → RootedHypergraph α β))} (h𝒮 : IsGood R sim 𝒮) + {T : ℕ → RootedTree ι} {τ : ℕ → ι → RootedHypergraph α β} + (hlinked : ∀ i, IsLinked sim (T i) (τ i) (T i).edges) + (hbr : ∀ i, ∀ s ∈ (T i).verts, ((T i).starAt s, branching (T i) (τ i) s) ∈ 𝒮) + {i i' : ℕ} (hii' : i < i') {u w v : ℕ × ι} + (hu : u ∈ (indexedTree T i).verts) (hw : w ∈ (indexedTree T i').verts) + (hadj : (simGraph sim T τ).Adj u w) + (hprec : (indexedTree T i').Precedes (fun p ↦ edgeOrder (T i') (τ i') p.2) v w) : + (simGraph sim T τ).Adj u v := by + rcases u with ⟨iu, u2⟩ + rcases w with ⟨iw, w2⟩ + rcases v with ⟨iv, v2⟩ + obtain ⟨rfl, hu2⟩ := (mem_indexedTree_verts T i (iu, u2)).mp hu + obtain ⟨rfl, hw2⟩ := (mem_indexedTree_verts T i' (iw, w2)).mp hw + dsimp only at hu2 hw2 hii' hprec + have hv1 : iw = iv := ((indexedTree_reaches_iff T iw (iv, v2) (iw, w2)).mp hprec.2.1).1.symm + subst hv1 + rw [indexedTree_precedes_iff] at hprec + obtain ⟨hvr, hvw, hord, hmin⟩ := hprec + have hv2 : v2 ∈ (T iw).verts := (T iw).reaches_mem_left hvw + have hve : v2 ∈ (T iw).edges := (T iw).mem_edges_iff.mpr ⟨hv2, hvr⟩ + have hwe : w2 ∈ (T iw).edges := by + refine (T iw).mem_edges_iff.mpr ⟨hw2, ?_⟩ + rintro rfl + exact hvr ((T iw).reaches_root_iff.mp hvw) + rw [simGraph_adj_of_lt hii'] at hadj ⊢ + refine ⟨hu2, hv2, ?_⟩ + have hsim_wv : sim (cross (τ iw) ((T iw).subtreeAt w2) w2) + (cross (τ iw) ((T iw).subtreeAt v2) v2) := by + refine hlinked iw w2 hwe v2 hve hvw hord.symm ?_ + rintro g ⟨⟨hvg, hgw⟩, _⟩ + by_cases hgv : g = v2 + · subst hgv + exact le_of_eq hord.symm + · exact hmin g hgv hvg hgw + exact hA2.2 _ (cross_subtreeAt_mem_R h𝒮 hbr iu hu2) + _ (cross_subtreeAt_mem_R h𝒮 hbr iw hw2) + _ (cross_subtreeAt_mem_R h𝒮 hbr iw hv2) hadj.2.2 hsim_wv + +/-- Graph Minors IV, (3.3), Claim (2) (page 236): there is no infinite `M`-stable set `X` meeting +each `V(T_i)` in at most one vertex such that the set of heads of edges with tails in `X` is +`M`-rich. -/ +theorem theorem_3_3_claim_2 {ι : Type*} (hA2 : Axiom2 R sim) + {𝒮 : Set (RootedTree ι × (ι → RootedHypergraph α β))} (h𝒮 : IsGood R sim 𝒮) + {T : ℕ → RootedTree ι} {τ : ℕ → ι → RootedHypergraph α β} + (hbr : ∀ i, ∀ s ∈ (T i).verts, ((T i).starAt s, branching (T i) (τ i) s) ∈ 𝒮) + {X : Set (ℕ × ι)} (hX_inf : X.Infinite) (hX_indep : (simGraph sim T τ).IsIndepSet X) + (hX_sub : X ⊆ ⋃ i, ((indexedTree T i).verts : Set (ℕ × ι))) + (hX_subsingle : ∀ i, (X ∩ (indexedTree T i).verts).Subsingleton) : + ¬ IsRich (simGraph sim T τ) + {v | ∃ i, v ∈ (indexedTree T i).edges ∧ (indexedTree T i).parent v ∈ X} := by + classical + intro hrich + have h_mem_verts : ∀ p ∈ X, p.2 ∈ (T p.1).verts := by + intro p hp + obtain ⟨i, hi⟩ := Set.mem_iUnion.mp (hX_sub hp) + obtain ⟨rfl, hp2⟩ := (mem_indexedTree_verts T i p).mp hi + exact hp2 + have h_fst_injOn : Set.InjOn Prod.fst X := by + intro p hp q hq (heq : p.1 = q.1) + have hp' : p ∈ X ∩ (indexedTree T p.1).verts := + ⟨hp, (mem_indexedTree_verts T p.1 p).mpr ⟨rfl, h_mem_verts p hp⟩⟩ + have hq' : q ∈ X ∩ (indexedTree T p.1).verts := + ⟨hq, (mem_indexedTree_verts T p.1 q).mpr ⟨heq.symm, heq ▸ h_mem_verts q hq⟩⟩ + exact hX_subsingle p.1 hp' hq' + have hI_inf : (Prod.fst '' X).Infinite := hX_inf.image h_fst_injOn + have hX_nonempty : ∃ i₀ u₀, (i₀, u₀) ∈ X := by + obtain ⟨⟨i₀, u₀⟩, h₀⟩ := hX_inf.nonempty + exact ⟨i₀, u₀, h₀⟩ + obtain ⟨i₀, u₀, hu₀⟩ := hX_nonempty + have h_exists_gt : ∀ B : ℕ, ∃ i, B < i ∧ ∃ u, (i, u) ∈ X := by + intro B + obtain ⟨i, ⟨p, hp, rfl⟩, hiB⟩ := + (hI_inf.sdiff (Set.finite_le_nat B)).nonempty + exact ⟨p.1, not_le.mp hiB, p.2, hp⟩ + choose nextIdx hnextIdx_lt hnextIdx_mem using h_exists_gt + let idx : ℕ → ℕ := fun j ↦ Nat.rec i₀ (fun _ prev ↦ nextIdx prev) j + have hidx_mono : StrictMono idx := strictMono_nat_of_lt_succ fun j ↦ hnextIdx_lt (idx j) + have hidx_mem : ∀ j, ∃ u, (idx j, u) ∈ X := by + intro j + cases j with + | zero => exact ⟨u₀, hu₀⟩ + | succ m => exact hnextIdx_mem (idx m) + choose u huX using hidx_mem + have hu_verts : ∀ j, u j ∈ (T (idx j)).verts := fun j ↦ h_mem_verts (idx j, u j) (huX j) + let x : ℕ → RootedTree ι × (ι → RootedHypergraph α β) := + fun j ↦ ((T (idx j)).starAt (u j), branching (T (idx j)) (τ (idx j)) (u j)) + have hx_mem : ∀ j, x j ∈ 𝒮 := fun j ↦ hbr (idx j) (u j) (hu_verts j) + have h_not_ws : ¬ WellSimulated sim (⋃ j, tips (x j).1 (x j).2) := by + intro hws + obtain ⟨j, j', hjj', hsim⟩ := h𝒮.2.2.2 x hx_mem hws + rw [cross_branching_eq (T (idx j)) (τ (idx j)) (hu_verts j), + cross_branching_eq (T (idx j')) (τ (idx j')) (hu_verts j')] at hsim + have hne : (idx j, u j) ≠ (idx j', u j') := fun h ↦ + ne_of_lt (hidx_mono hjj') (congrArg Prod.fst h) + have hadj : (simGraph sim T τ).Adj (idx j, u j) (idx j', u j') := + (simGraph_adj_of_lt (hidx_mono hjj')).mpr ⟨hu_verts j, hu_verts j', hsim⟩ + exact hX_indep (huX j) (huX j') hne hadj + unfold WellSimulated at h_not_ws + push Not at h_not_ws + obtain ⟨L, hL_mem, hL_not_sim⟩ := h_not_ws + have hL_unpack : ∀ k, ∃ j w, w ∈ (T (idx j)).children (u j) ∧ + L k = cross (τ (idx j)) ((T (idx j)).subtreeAt w) w := by + intro k + obtain ⟨j, hj⟩ := Set.mem_iUnion.mp (hL_mem k) + obtain ⟨w, hw, hLw⟩ := hj + change w ∈ ((T (idx j)).starAt (u j)).edges at hw + rw [RootedTree.starAt_edges] at hw + refine ⟨j, w, hw, ?_⟩ + rw [hLw] + exact branching_of_mem_children (T (idx j)) (τ (idx j)) hw + choose j w hw_child hL_eq using hL_unpack + let v : ℕ → ℕ × ι := fun k ↦ (idx (j k), w k) + have hw_verts : ∀ k, w k ∈ (T (idx (j k))).verts := + fun k ↦ (T (idx (j k))).children_subset_verts (u (j k)) (hw_child k) + have hv_inj : Function.Injective v := by + intro k₁ k₂ h_eq + by_contra hne + have h_idx : idx (j k₁) = idx (j k₂) := congrArg Prod.fst h_eq + have hj_eq : j k₁ = j k₂ := hidx_mono.injective h_idx + have hw_eq : w k₁ = w k₂ := congrArg Prod.snd h_eq + have hL_same : L k₁ = L k₂ := by rw [hL_eq k₁, hL_eq k₂, hj_eq, hw_eq] + have hL_R : L k₁ ∈ R := by + rw [hL_eq k₁] + exact cross_subtreeAt_mem_R h𝒮 hbr (idx (j k₁)) (hw_verts k₁) + rcases lt_or_gt_of_ne hne with hlt | hgt + · exact hL_not_sim k₁ k₂ hlt (hL_same ▸ hA2.1 (L k₁) hL_R) + · exact hL_not_sim k₂ k₁ hgt (hL_same ▸ hA2.1 (L k₁) hL_R) + have h_exists_next : ∀ K B : ℕ, ∃ k, K < k ∧ B < j k := by + intro K B + let F : Finset (ℕ × ι) := (Finset.Iic B).biUnion fun b ↦ (indexedTree T (idx b)).verts + have h_fin : ({k : ℕ | k ≤ K} ∪ v ⁻¹' (F : Set (ℕ × ι))).Finite := + (Set.finite_le_nat K).union (F.finite_toSet.preimage hv_inj.injOn) + obtain ⟨k, _, hk⟩ := (Set.infinite_univ.sdiff h_fin).nonempty + have hk1 : K < k := not_le.mp fun hle ↦ hk (Or.inl hle) + refine ⟨k, hk1, ?_⟩ + by_contra hle + push Not at hle + apply hk + right + change v k ∈ (F : Set (ℕ × ι)) + rw [Finset.mem_coe, Finset.mem_biUnion] + exact ⟨j k, Finset.mem_Iic.mpr hle, + (mem_indexedTree_verts T (idx (j k)) (v k)).mpr ⟨rfl, hw_verts k⟩⟩ + choose next hnext_K hnext_B using h_exists_next + let subseq : ℕ → ℕ := fun m ↦ Nat.rec 0 (fun _ prev ↦ next prev (j prev)) m + have hsub_mono : StrictMono subseq := strictMono_nat_of_lt_succ fun m ↦ hnext_K (subseq m) _ + have hjsub_mono : StrictMono (fun m ↦ j (subseq m)) := + strictMono_nat_of_lt_succ fun m ↦ hnext_B (subseq m) (j (subseq m)) + let v' : ℕ → ℕ × ι := fun m ↦ v (subseq m) + have hv'_sub : Set.range v' ⊆ + {z | ∃ i, z ∈ (indexedTree T i).edges ∧ (indexedTree T i).parent z ∈ X} := by + rintro _ ⟨m, rfl⟩ + have hwc := (T (idx (j (subseq m)))).mem_children_iff.mp (hw_child (subseq m)) + refine ⟨idx (j (subseq m)), + (mem_indexedTree_edges T (idx (j (subseq m))) (v' m)).mpr ⟨rfl, hwc.1⟩, ?_⟩ + change (idx (j (subseq m)), (T (idx (j (subseq m)))).parent (w (subseq m))) ∈ X + rw [hwc.2] + exact huX (j (subseq m)) + have hv'_indep : (simGraph sim T τ).IsIndepSet (Set.range v') := by + rintro _ ⟨m₁, rfl⟩ _ ⟨m₂, rfl⟩ _ hadj + have h_wlog : ∀ a b, a < b → ¬ (simGraph sim T τ).Adj (v' a) (v' b) := by + intro a b hab hadj' + have h_lt : idx (j (subseq a)) < idx (j (subseq b)) := hidx_mono (hjsub_mono hab) + obtain ⟨_, _, hsim⟩ := (simGraph_adj_of_lt h_lt).mp hadj' + rw [← hL_eq (subseq a), ← hL_eq (subseq b)] at hsim + exact hL_not_sim (subseq a) (subseq b) (hsub_mono hab) hsim + rcases lt_trichotomy m₁ m₂ with hlt | rfl | hgt + · exact h_wlog m₁ m₂ hlt hadj + · exact (simGraph sim T τ).loopless.irrefl _ hadj + · exact h_wlog m₂ m₁ hgt ((simGraph sim T τ).adj_symm hadj) + have hv'_inf : (Set.range v').Infinite := + Set.infinite_range_of_injective (hv_inj.comp hsub_mono.injective) + exact hv'_inf (hrich (Set.range v') hv'_sub hv'_indep) + +/-- Graph Minors IV, (3.3). -/ +theorem theorem_3_3_proof (h22 : TreeLemma22Statement.{u}) {ι : Type u} + (_hA1 : Axiom1 R) (hA2 : Axiom2 R sim) + (𝒮 : Set (RootedTree ι × (ι → RootedHypergraph α β))) (h𝒮 : IsGood R sim 𝒮) + (T : ℕ → RootedTree ι) (τ : ℕ → ι → RootedHypergraph α β) + (hdec : ∀ i, IsTreeDecomposition (cross (τ i) (T i).verts (T i).root) (T i) (τ i)) + (hlinked : ∀ i, IsLinked sim (T i) (τ i) (T i).edges) + (hbr : ∀ i, ∀ s ∈ (T i).verts, ((T i).starAt s, branching (T i) (τ i) s) ∈ 𝒮) : + ∃ i i', i < i' ∧ + sim (cross (τ i) (T i).verts (T i).root) (cross (τ i') (T i').verts (T i').root) := by + obtain ⟨n, hn⟩ := h𝒮.2.2.1 + let T' : ℕ → RootedTree (ℕ × ι) := indexedTree T + let φ : ℕ → ℕ × ι → ℕ := fun i p ↦ edgeOrder (T i) (τ i) p.2 + let M : SimpleGraph (ℕ × ι) := simGraph sim T τ + have hdisj : Pairwise (fun i j ↦ Disjoint (T' i).verts (T' j).verts) := by + intro i j hij + rw [Finset.disjoint_left] + intro p hp₁ hp₂ + have h1 := ((mem_indexedTree_verts T i p).mp hp₁).1 + have h2 := ((mem_indexedTree_verts T j p).mp hp₂).1 + exact hij (h1.symm.trans h2) + have hφ : ∀ i, ∀ f ∈ (T' i).edges, φ i f ≤ n := by + intro i f hf + obtain ⟨_, hfe⟩ := (mem_indexedTree_edges T i f).mp hf + have hfv : f.2 ∈ (T i).verts := (T i).edges_subset_verts hfe + have h_ind : index ((T i).starAt f.2) (branching (T i) (τ i) f.2) ≤ n := + hn _ (hbr i f.2 hfv) + have h_root_le : (branching (T i) (τ i) f.2 f.2).roots.length ≤ + index ((T i).starAt f.2) (branching (T i) (τ i) f.2) := + Finset.le_sup (f := fun s ↦ (branching (T i) (τ i) f.2 s).roots.length) + ((T i).starAt f.2).root_mem + rw [branching_self, ← (hdec i).edgeOrder_eq_length_roots hfe] at h_root_le + exact h_root_le.trans h_ind + have hM_prec : ∀ i i', i < i' → ∀ u ∈ (T' i).verts, ∀ w ∈ (T' i').verts, ∀ v, + M.Adj u w → (T' i').Precedes (φ i') v w → M.Adj u v := + fun _ _ hii' _ hu _ hw _ hadj hprec ↦ + theorem_3_3_claim_1 hA2 h𝒮 hlinked hbr hii' hu hw hadj hprec + by_contra h_no_sim + have h_root_indep : M.IsIndepSet (Set.range fun i ↦ (T' i).root) := by + rintro _ ⟨i, rfl⟩ _ ⟨i', rfl⟩ _ hadj + rcases hadj with ⟨hii', _, _, hsim⟩ | ⟨hi'i, _, _, hsim⟩ + · dsimp [T', indexedTree] at hii' hsim + rw [cross_subtreeAt_root, cross_subtreeAt_root] at hsim + exact h_no_sim ⟨i, i', hii', hsim⟩ + · dsimp [T', indexedTree] at hi'i hsim + rw [cross_subtreeAt_root, cross_subtreeAt_root] at hsim + exact h_no_sim ⟨i', i, hi'i, hsim⟩ + obtain ⟨X, hX_inf, hX_indep, hX_sub, hX_subsingle, hrich⟩ := + h22 T' n φ M hdisj hφ hM_prec h_root_indep + exact theorem_3_3_claim_2 hA2 h𝒮 hbr hX_inf hX_indep hX_sub hX_subsingle hrich + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/Decomposition/Rotund.lean b/LeanPool/GraphMinor/GM04/Decomposition/Rotund.lean new file mode 100644 index 0000000000..182a0387c9 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Decomposition/Rotund.lean @@ -0,0 +1,574 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Decomposition.Linked + +/-! +# Rotund tree-decompositions (Graph Minors IV, (4.1) and (4.2)) + +This file proves Graph Minors IV, (4.1) and (4.2) (pages 236–238): +* (4.1) (`theorem_4_1`): if `(T, τ)` is a tree-decomposition with `τ × T ∈ ℛ` and `F ⊆ E(T)` is + rotund in `(T, τ)`, then there is a tree-decomposition `(T, τ')` of `τ × T` with + `τ'(t)⁻ = τ(t)⁻` for all `t ∈ V(T)` such that `F` is linked in `(T, τ')`. +* (4.2) (`theorem_4_2`): if `𝒮` is a good and symmetric class of star-decompositions and + `(T_i, τ_i)` is a sequence of rotund tree-decompositions all of whose branchings belong to `𝒮`, + then there exist `i < i'` such that `τ_i × T_i` is simulated in `τ_{i'} × T_{i'}`. +-/ + +public section + +namespace GraphMinor.GM04 + +open Hypergraph + +universe u + +variable {α β ι : Type*} {R : Set (RootedHypergraph α β)} + {sim : RootedHypergraph α β → RootedHypergraph α β → Prop} + +namespace RootedTree + +variable (T : RootedTree ι) + +/-- Among the vertices on the directed path from `u` to `v` that satisfy `P`, there is one `y` +closest to `u` (furthest from `v`). -/ +theorem exists_furthest_ancestor {P : ι → Prop} {u v : ι} (huv : T.Reaches u v) + (hP : ∃ x, P x ∧ T.Reaches u x ∧ T.Reaches x v) : + ∃ y, P y ∧ T.Reaches u y ∧ T.Reaches y v ∧ + ∀ z, P z → T.Reaches u z → T.Reaches z y → z = y := by + obtain ⟨hv, n, hn⟩ := huv + induction n generalizing v with + | zero => + rw [Function.iterate_zero_apply] at hn + subst hn + obtain ⟨x, hxP, hux, hxu⟩ := hP + have h_eq : x = v := T.reaches_antisymm hxu hux + subst h_eq + exact ⟨x, hxP, T.reaches_refl hv, T.reaches_refl hv, + fun z _ huz hzu ↦ T.reaches_antisymm hzu huz⟩ + | succ k ih => + rw [Function.iterate_succ_apply] at hn + by_cases hP' : ∃ x, P x ∧ T.Reaches u x ∧ T.Reaches x (T.parent v) + · obtain ⟨y, hyP, huy, hyp, hmin⟩ := ih hP' (T.parent_mem v hv) hn + exact ⟨y, hyP, huy, T.reaches_trans hyp (T.reaches_parent hv), hmin⟩ + · obtain ⟨x, hxP, hux, hxv⟩ := hP + have hxv_eq : x = v := by + rcases (T.reaches_iff_eq_or_reaches_parent hv).mp hxv with rfl | hxp + · rfl + · exact absurd ⟨x, hxP, hux, hxp⟩ hP' + subst hxv_eq + refine ⟨x, hxP, hux, T.reaches_refl hv, fun z hzP huz hzx ↦ ?_⟩ + rcases (T.reaches_iff_eq_or_reaches_parent hv).mp hzx with rfl | hzp + · rfl + · exact absurd ⟨z, hzP, huz, hzp⟩ hP' + +/-- Among the vertices on the directed path from `u` to `v` that satisfy `P`, there is one `y` +closest to `v`. -/ +theorem exists_closest_ancestor {P : ι → Prop} {u v : ι} (hu : P u) (huv : T.Reaches u v) : + ∃ y, P y ∧ T.Reaches u y ∧ T.Reaches y v ∧ + ∀ z, P z → T.Reaches z v → T.Reaches z y := by + obtain ⟨hv, n, hn⟩ := huv + induction n generalizing v with + | zero => + rw [Function.iterate_zero_apply] at hn + subst hn + exact ⟨v, hu, T.reaches_refl hv, T.reaches_refl hv, fun _ _ hzv ↦ hzv⟩ + | succ k ih => + by_cases hvP : P v + · exact ⟨v, hvP, ⟨hv, k + 1, hn⟩, T.reaches_refl hv, fun _ _ hzv ↦ hzv⟩ + · rw [Function.iterate_succ_apply] at hn + obtain ⟨y, hyP, huy, hyp, hmax⟩ := ih (T.parent_mem v hv) hn + refine ⟨y, hyP, huy, T.reaches_trans hyp (T.reaches_parent hv), fun z hzP hzv ↦ ?_⟩ + have hzv_ne : z ≠ v := by + rintro rfl + exact hvP hzP + exact hmax z hzP (T.reaches_parent_of_reaches_of_ne hzv hzv_ne) + +end RootedTree + +/-- Updating the marches of `τ` while preserving the underlying hypergraphs and root sets preserves +being a tree-decomposition of `cross τ T.verts T.root` (when the root march is unchanged). -/ +theorem IsTreeDecomposition.of_toHypergraph_eq {G : RootedHypergraph α β} {T : RootedTree ι} + {τ τ' : ι → RootedHypergraph α β} (hdec : IsTreeDecomposition G T τ) + (hH : ∀ t ∈ T.verts, (τ' t).toHypergraph = (τ t).toHypergraph) + (hroot : (τ' T.root).roots = (τ T.root).roots) + (hrootSet : ∀ f ∈ T.edges, (τ' f).rootSet = (τ f).rootSet) : + IsTreeDecomposition G T τ' where + le t ht := by rw [hH t ht]; exact hdec.le t ht + biUnion_eq := by + rw [Hypergraph.biUnion_congr rfl (fun t ht ↦ hH t ht)] + exact hdec.biUnion_eq + edgeSet_inter_eq t₁ ht₁ t₂ ht₂ hne := by + rw [hH t₁ ht₁, hH t₂ ht₂] + exact hdec.edgeSet_inter_eq t₁ ht₁ t₂ ht₂ hne + inter_le t₁ ht₁ t₂ ht₂ t₃ ht₃ hon := by + rw [hH t₁ ht₁, hH t₂ ht₂, hH t₃ ht₃] + exact hdec.inter_le t₁ ht₁ t₂ ht₂ t₃ ht₃ hon + roots_root := hroot.trans hdec.roots_root + rootSet_edge f hf := by + have hfv : f ∈ T.verts := T.edges_subset_verts hf + rw [hrootSet f hf, hH f hfv, hH (T.parent f) (T.parent_mem f hfv)] + exact hdec.rootSet_edge f hf + +/-- Graph Minors IV, (4.1), Claim (2) (page 237): given `e₀ = f_{p-1} ∈ F` and `f = f_p ∈ F` of +the same order `k` with `e₀ ≠ f`, `T.Reaches e₀ f`, and no edge of `pathEdges e₀ f ∩ F` of order +`< k`, there is a rooted hypergraph `H` with `H⁻ = (τ × T^f)⁻` and `πBar(H) = πBar(τ(f))` such that +`H` +is simulated in `(τ' × T^{e₀})`. -/ +theorem theorem_4_1_claim_2 (hA1 : Axiom1 R) (hA3 : Axiom3 R sim) + {T : RootedTree ι} {τ τ' : ι → RootedHypergraph α β} + (hdec : IsTreeDecomposition (cross τ T.verts T.root) T τ) + (hR : cross τ T.verts T.root ∈ R) {F : Set ι} (hF : F ⊆ T.edges) + (hrot : IsRotund T τ F) + (hH : ∀ t ∈ T.verts, (τ' t).toHypergraph = (τ t).toHypergraph) + (hrootSet : ∀ t ∈ T.verts, (τ' t).rootSet = (τ t).rootSet) + {e₀ f : ι} (he₀F : e₀ ∈ F) (hfF : f ∈ F) (hne : e₀ ≠ f) + (hreach : T.Reaches e₀ f) (hord : edgeOrder T τ f = edgeOrder T τ e₀) + (hmin : ∀ g ∈ T.pathEdges e₀ f ∩ F, edgeOrder T τ f ≤ edgeOrder T τ g) : + ∃ H : RootedHypergraph α β, + H.toHypergraph = (cross τ (T.subtreeAt f) f).toHypergraph ∧ + H.rootSet = (τ f).rootSet ∧ + sim H (cross τ' (T.subtreeAt e₀) e₀) := by + classical + have he₀e : e₀ ∈ T.edges := hF he₀F + have hfe : f ∈ T.edges := hF hfF + have he₀v : e₀ ∈ T.verts := T.edges_subset_verts he₀e + have hfv : f ∈ T.verts := T.edges_subset_verts hfe + have hpv : T.parent f ∈ T.verts := T.parent_mem f hfv + have he₀_sub : e₀ ∈ T.subtreeAt e₀ := T.self_mem_subtreeAt he₀v + have hf_sub : f ∈ T.subtreeAt f := T.self_mem_subtreeAt hfv + let G₀ : RootedHypergraph α β := cross τ' (T.subtreeAt e₀) e₀ + have hG₀_toH : G₀.toHypergraph = (cross τ (T.subtreeAt e₀) e₀).toHypergraph := + cross_toHypergraph_congr he₀_sub he₀_sub fun t ht ↦ hH t (T.subtreeAt_subset_verts e₀ ht) + have hG₀_R : G₀ ∈ R := by + refine hA1 (cross τ T.verts T.root) hR G₀ ?_ + rw [hG₀_toH] + exact hdec.cross_le (T.subtreeAt_subset_verts e₀) he₀_sub + have hG₀_len : G₀.roots.length = edgeOrder T τ f := by + rw [hord, hdec.edgeOrder_eq_ncard_rootSet he₀e, ← hrootSet e₀ he₀v, + RootedHypergraph.ncard_rootSet] + rfl + let G₁ : RootedHypergraph α β := cross τ (T.subtreeAt f) f + let S₂ : Finset ι := T.subtreeAt e₀ \ T.subtreeAt f + have he₀_S₂ : e₀ ∈ S₂ := by + rw [Finset.mem_sdiff, T.mem_subtreeAt, T.mem_subtreeAt] + exact ⟨T.reaches_refl he₀v, fun hfe₀ ↦ hne (T.reaches_antisymm hreach hfe₀)⟩ + have hp_S₂ : T.parent f ∈ S₂ := by + rw [Finset.mem_sdiff, T.mem_subtreeAt, T.mem_subtreeAt] + exact ⟨T.reaches_parent_of_reaches_of_ne hreach hne, T.not_reaches_parent hfe⟩ + have hS₂_sub_e₀ : S₂ ⊆ T.subtreeAt e₀ := Finset.sdiff_subset + have hS₂_sub_root : S₂ ⊆ T.rootSide f := by + intro x hx + rw [Finset.mem_sdiff, T.mem_subtreeAt, T.mem_subtreeAt] at hx + exact T.mem_rootSide.mpr ⟨T.reaches_mem_right hx.1, hx.2⟩ + let G₂ : RootedHypergraph α β := + { toHypergraph := (cross τ S₂ e₀).toHypergraph + roots := (τ' e₀).roots + roots_nodup := (τ' e₀).roots_nodup + roots_subset := fun v hv ↦ by + have hv' : v ∈ (τ e₀).vertexSet := by + rw [← hH e₀ he₀v] + exact (τ' e₀).roots_subset v hv + exact (hdec.le_cross (hS₂_sub_e₀.trans (T.subtreeAt_subset_verts e₀)) + he₀_S₂ he₀_S₂).vertexSet_subset hv' } + have hG₁_le_G₀ : G₁.toHypergraph ≤ G₀.toHypergraph := by + rw [hG₀_toH] + exact hdec.cross_le_cross (T.subtreeAt_mono hreach) (T.subtreeAt_subset_verts e₀) + hf_sub he₀_sub + have hG₂_le_G₀ : G₂.toHypergraph ≤ G₀.toHypergraph := by + rw [hG₀_toH] + exact hdec.cross_le_cross hS₂_sub_e₀ (T.subtreeAt_subset_verts e₀) he₀_S₂ he₀_sub + have hG₁₂_inter : G₁.toHypergraph ∩ G₂.toHypergraph = + (τ f).toHypergraph ∩ (τ (T.parent f)).toHypergraph := by + have hle₁ : (τ f).toHypergraph ≤ G₁.toHypergraph := + hdec.le_cross (T.subtreeAt_subset_verts f) hf_sub hf_sub + have hle₂ : (τ (T.parent f)).toHypergraph ≤ G₂.toHypergraph := + hdec.le_cross (hS₂_sub_e₀.trans (T.subtreeAt_subset_verts e₀)) he₀_S₂ hp_S₂ + have hle₃ : G₂.toHypergraph ≤ (cross τ (T.rootSide f) T.root).toHypergraph := + hdec.cross_le_cross hS₂_sub_root (T.rootSide_subset_verts f) + he₀_S₂ (T.root_mem_rootSide hfe) + have h_low : (τ f).toHypergraph ∩ (τ (T.parent f)).toHypergraph ≤ + G₁.toHypergraph ∩ G₂.toHypergraph := + Hypergraph.le_inter + ((Hypergraph.inter_le_left (hdec.le f hfv) (hdec.le _ hpv)).trans hle₁) + ((Hypergraph.inter_le_right (hdec.le f hfv) (hdec.le _ hpv)).trans hle₂) + refine (Hypergraph.eq_of_le_of_subset h_low ?_ ?_).symm + · have hsub : (G₁.toHypergraph ∩ G₂.toHypergraph).vertexSet ⊆ + (G₁.toHypergraph ∩ (cross τ (T.rootSide f) T.root).toHypergraph).vertexSet := + Set.inter_subset_inter_right _ hle₃.vertexSet_subset + rwa [hdec.subtreeAt_inter_rootSide_eq hfe] at hsub + · have hsub : (G₁.toHypergraph ∩ G₂.toHypergraph).edgeSet ⊆ + (G₁.toHypergraph ∩ (cross τ (T.rootSide f) T.root).toHypergraph).edgeSet := + Set.inter_subset_inter_right _ hle₃.edgeSet_subset + rwa [hdec.subtreeAt_inter_rootSide_eq hfe] at hsub + have hsep_G₀ : G₀.IsSeparation G₁ G₂ := by + refine ⟨⟨hG₁_le_G₀, hG₂_le_G₀, ?_, ?_⟩, rfl, ?_⟩ + · change (cross τ (T.subtreeAt f) f).toHypergraph ∪ (cross τ S₂ e₀).toHypergraph = + G₀.toHypergraph + rw [hG₀_toH, cross_toHypergraph_of_mem τ hf_sub, cross_toHypergraph_of_mem τ he₀_S₂, + cross_toHypergraph_of_mem τ he₀_sub, ← Hypergraph.biUnion_union, + Finset.union_sdiff_of_subset (T.subtreeAt_mono hreach)] + · rw [hG₁₂_inter] + exact hdec.edgeSet_inter_eq f hfv (T.parent f) hpv (T.parent_ne_self hfe).symm + · rw [cross_rootSet, hG₁₂_inter, hdec.rootSet_edge f hfe] + have hord_G₁₂ : separationOrder G₁.toHypergraph G₂.toHypergraph = G₀.roots.length := by + rw [hG₀_len, hdec.edgeOrder_eq_ncard_inter hfe] + simp only [separationOrder, hG₁₂_inter] + have hno_sep : ¬ ∃ H₁ H₂ : RootedHypergraph α β, G₀.IsSeparation H₁ H₂ ∧ + G₁.toHypergraph ≤ H₁.toHypergraph ∧ + separationOrder H₁.toHypergraph H₂.toHypergraph < G₀.roots.length := by + rintro ⟨H₁, H₂, hsepH, hG₁_H₁, hordH⟩ + have hsep_e₀ := hdec.isSeparation_edge he₀e + let R_e₀ := (cross τ (T.rootSide e₀) T.root).toHypergraph + have hH₁_le_G : H₁.toHypergraph ≤ (cross τ T.verts T.root).toHypergraph := + hsepH.isSeparation.left_le.trans (hG₀_toH ▸ hsep_e₀.isSeparation.left_le) + have hH₂_le_G : H₂.toHypergraph ≤ (cross τ T.verts T.root).toHypergraph := + hsepH.isSeparation.right_le.trans (hG₀_toH ▸ hsep_e₀.isSeparation.left_le) + have hR_le_G : R_e₀ ≤ (cross τ T.verts T.root).toHypergraph := + hsep_e₀.isSeparation.right_le + let K₁ : Hypergraph α β := H₁.toHypergraph + let K₂ : Hypergraph α β := H₂.toHypergraph ∪ R_e₀ + have h_root_in_H₂ : (G₀.toHypergraph ∩ R_e₀).vertexSet ⊆ H₂.vertexSet := by + rw [hG₀_toH, ← hsep_e₀.rootSet_left, cross_rootSet, ← hrootSet e₀ he₀v] + intro v hv + change v ∈ (τ' e₀).roots at hv + have h_roots_eq : H₂.roots = (τ' e₀).roots := hsepH.roots_right + rw [← h_roots_eq] at hv + exact H₂.roots_subset v hv + have hK₁₂_vertex : (K₁ ∩ K₂).vertexSet = (H₁.toHypergraph ∩ H₂.toHypergraph).vertexSet := by + ext v + simp only [K₁, K₂, inter_vertexSet, union_vertexSet, Set.mem_inter_iff, Set.mem_union] + refine ⟨fun ⟨hv₁, hv₂⟩ ↦ ⟨hv₁, hv₂.elim id fun hvR ↦ ?_⟩, + fun ⟨hv₁, hv₂⟩ ↦ ⟨hv₁, Or.inl hv₂⟩⟩ + exact h_root_in_H₂ ⟨hsepH.isSeparation.left_le.vertexSet_subset hv₁, hvR⟩ + have hK₁₂_edge : (K₁ ∩ K₂).edgeSet = ∅ := by + ext e + simp only [K₁, K₂, inter_edgeSet, union_edgeSet, Set.mem_inter_iff, Set.mem_union, + Set.mem_empty_iff_false, iff_false, not_and] + rintro he₁ (he₂ | heR) + · have he : e ∈ (H₁.toHypergraph ∩ H₂.toHypergraph).edgeSet := ⟨he₁, he₂⟩ + rw [hsepH.isSeparation.edgeSet_inter_eq] at he + exact False.elim he + · have he : e ∈ ((cross τ (T.subtreeAt e₀) e₀).toHypergraph ∩ R_e₀).edgeSet := by + rw [← hG₀_toH] + exact ⟨hsepH.isSeparation.left_le.edgeSet_subset he₁, heR⟩ + rw [hsep_e₀.isSeparation.edgeSet_inter_eq] at he + exact False.elim he + have hK₁₂_union : K₁ ∪ K₂ = (cross τ T.verts T.root).toHypergraph := by + have hle : K₁ ∪ K₂ ≤ (cross τ T.verts T.root).toHypergraph := + Hypergraph.union_le hH₁_le_G (Hypergraph.union_le hH₂_le_G hR_le_G) + refine Hypergraph.eq_of_le_of_subset hle ?_ ?_ + · intro v hv + rw [← hsep_e₀.isSeparation.union_eq, union_vertexSet, ← hG₀_toH, + ← hsepH.isSeparation.union_eq, union_vertexSet] at hv + simp only [K₁, K₂, union_vertexSet, Set.mem_union] at hv ⊢ + tauto + · intro e he + rw [← hsep_e₀.isSeparation.union_eq, union_edgeSet, ← hG₀_toH, + ← hsepH.isSeparation.union_eq, union_edgeSet] at he + simp only [K₁, K₂, union_edgeSet, Set.mem_union] at he ⊢ + tauto + have hsepK : (cross τ T.verts T.root).toHypergraph.IsSeparation K₁ K₂ := + ⟨hH₁_le_G, Hypergraph.union_le hH₂_le_G hR_le_G, hK₁₂_union, hK₁₂_edge⟩ + have hR_le_K₂ : R_e₀ ≤ K₂ := Hypergraph.le_union_right hH₂_le_G hR_le_G + have hordK : separationOrder K₁ K₂ < edgeOrder T τ f := by + rw [← hG₀_len] + simpa only [separationOrder, hK₁₂_vertex] using hordH + exact hrot f hfF e₀ he₀F hreach hord hmin ⟨K₁, K₂, hsepK, hG₁_H₁, hR_le_K₂, hordK⟩ + exact hA3 G₀ hG₀_R G₁ G₂ hsep_G₀ hord_G₁₂ hno_sep + +private theorem coe_eq_of_sdiff_card_zero {ι : Type*} [DecidableEq ι] + {D Ffin : Finset ι} {F : Set ι} (hFfin : ∀ x, x ∈ Ffin ↔ x ∈ F) + (hsub : D ⊆ Ffin) (hcard : (Ffin \ D).card = 0) : (D : Set ι) = F := by + have hback : Ffin ⊆ D := Finset.sdiff_eq_empty_iff_subset.mp (Finset.card_eq_zero.mp hcard) + have hEq : D = Ffin := Finset.Subset.antisymm hsub hback + subst hEq + exact Set.ext hFfin + +private theorem sdiff_insert_card_eq {ι : Type*} [DecidableEq ι] {D Ffin : Finset ι} {f : ι} + {m : ℕ} (hf : f ∈ Ffin \ D) (hcard : (Ffin \ D).card = m + 1) : + (Ffin \ insert f D).card = m := by + have hsdiff : Ffin \ insert f D = (Ffin \ D).erase f := by + ext z + simp only [Finset.mem_sdiff, Finset.mem_insert, Finset.mem_erase, not_or] + tauto + rw [hsdiff, Finset.card_erase_of_mem hf, hcard] + rfl + +/-- Graph Minors IV, (4.1). -/ +theorem theorem_4_1_proof {ι : Type*} (hA1 : Axiom1 R) (hA2 : Axiom2 R sim) (hA3 : Axiom3 R sim) + (T : RootedTree ι) (τ : ι → RootedHypergraph α β) + (hdec : IsTreeDecomposition (cross τ T.verts T.root) T τ) + (hR : cross τ T.verts T.root ∈ R) (F : Set ι) (hF : F ⊆ T.edges) + (hrot : IsRotund T τ F) : + ∃ τ' : ι → RootedHypergraph α β, + IsTreeDecomposition (cross τ T.verts T.root) T τ' ∧ + (∀ t ∈ T.verts, (τ' t).toHypergraph = (τ t).toHypergraph) ∧ IsLinked sim T τ' F := by + classical + let F_fin : Finset ι := T.edges.filter (· ∈ F) + have hF_fin : ∀ x, x ∈ F_fin ↔ x ∈ F := by + intro x + simp only [F_fin, Finset.mem_filter] + exact ⟨And.right, fun hx ↦ ⟨hF hx, hx⟩⟩ + -- Inductive step: extend a downward-closed subset `D ⊆ F_fin` until `F_fin \ D = ∅`. + suffices h_ind : ∀ (n : ℕ) (D : Finset ι) (τ' : ι → RootedHypergraph α β), + D ⊆ F_fin → + (F_fin \ D).card = n → + (∀ f ∈ D, ∀ e ∈ F, T.Reaches e f → e ∈ D) → + (∀ t, (τ' t).toHypergraph = (τ t).toHypergraph) → + (∀ t, (τ' t).rootSet = (τ t).rootSet) → + (τ' T.root).roots = (τ T.root).roots → + IsLinked sim T τ' (D : Set ι) → + ∃ τ'' : ι → RootedHypergraph α β, + (∀ t, (τ'' t).toHypergraph = (τ t).toHypergraph) ∧ + (∀ t, (τ'' t).rootSet = (τ t).rootSet) ∧ + (τ'' T.root).roots = (τ T.root).roots ∧ + IsLinked sim T τ'' F by + obtain ⟨τ'', hH, hrootSet, hroot, hlinked⟩ := + h_ind F_fin.card ∅ τ (Finset.empty_subset _) (by simp) (by simp) + (fun _ ↦ rfl) (fun _ ↦ rfl) rfl (by simp [IsLinked]) + refine ⟨τ'', hdec.of_toHypergraph_eq (fun t _ ↦ hH t) hroot (fun f _ ↦ hrootSet f), + fun t _ ↦ hH t, hlinked⟩ + intro n + induction n with + | zero => + intro D τ' hD_sub hcard _ hH hrootSet hroot hlinkedD + have hF_eq : (D : Set ι) = F := + coe_eq_of_sdiff_card_zero hF_fin hD_sub hcard + rw [hF_eq] at hlinkedD + exact ⟨τ', hH, hrootSet, hroot, hlinkedD⟩ + | succ m ih => + intro D τ' hD_sub hcard hD_down hH hrootSet hroot hlinkedD + have hne : (F_fin \ D).Nonempty := Finset.card_pos.mp (by omega) + obtain ⟨x₀, hx₀⟩ := hne + have hx₀v : x₀ ∈ T.verts := T.edges_subset_verts (hF ((hF_fin x₀).mp + (Finset.mem_sdiff.mp hx₀).1)) + obtain ⟨f, hf_sdiff, _, _, hf_min⟩ := + T.exists_furthest_ancestor (T.reaches_root hx₀v) + ⟨x₀, hx₀, T.reaches_root hx₀v, T.reaches_refl hx₀v⟩ + have hf_F : f ∈ F := (hF_fin f).mp (Finset.mem_sdiff.mp hf_sdiff).1 + have hf_notD : f ∉ D := (Finset.mem_sdiff.mp hf_sdiff).2 + have hfe : f ∈ T.edges := hF hf_F + have hfv : f ∈ T.verts := T.edges_subset_verts hfe + have hf_anc_in_D : ∀ e ∈ F, e ≠ f → T.Reaches e f → e ∈ D := by + intro e heF hef hef_reach + by_contra heD + have he_sdiff : e ∈ F_fin \ D := Finset.mem_sdiff.mpr ⟨(hF_fin e).mpr heF, heD⟩ + have hev : e ∈ T.verts := T.edges_subset_verts (hF heF) + exact hef (hf_min e he_sdiff (T.reaches_root hev) hef_reach) + let D' : Finset ι := insert f D + have hD'_sub : D' ⊆ F_fin := + Finset.insert_subset ((Finset.mem_sdiff.mp hf_sdiff).1) hD_sub + have hcard' : (F_fin \ D').card = m := + sdiff_insert_card_eq hf_sdiff hcard + have hD'_down : ∀ x ∈ D', ∀ e ∈ F, T.Reaches e x → e ∈ D' := by + intro x hx e heF hex + rcases Finset.mem_insert.mp hx with rfl | hxD + · by_cases hef : e = x + · subst hef + exact Finset.mem_insert_self e D + · exact Finset.mem_insert_of_mem (hf_anc_in_D e heF hef hex) + · exact Finset.mem_insert_of_mem (hD_down x hxD e heF hex) + -- Define the predicate `P e` for strict ancestors `e ∈ F` of `f` on a constant-order path. + let P : ι → Prop := fun e ↦ e ∈ F ∧ e ≠ f ∧ edgeOrder T τ f = edgeOrder T τ e ∧ + ∀ g ∈ T.pathEdges e f ∩ F, edgeOrder T τ f ≤ edgeOrder T τ g + have h_choice : ∃ H_f : RootedHypergraph α β, + H_f.toHypergraph = (τ f).toHypergraph ∧ + H_f.rootSet = (τ f).rootSet ∧ + ∀ e, P e → T.Reaches e f → + sim (cross (Function.update τ' f H_f) (T.subtreeAt f) f) + (cross τ' (T.subtreeAt e) e) := by + by_cases hP_ex : ∃ e, P e ∧ T.Reaches e f + · obtain ⟨e₁, he₁P, he₁f⟩ := hP_ex + obtain ⟨e₀, he₀P, _, he₀f, he₀_max⟩ := T.exists_closest_ancestor he₁P he₁f + obtain ⟨H, hH_to, hH_rootSet, hsim_e₀⟩ := + theorem_4_1_claim_2 hA1 hA3 hdec hR hF hrot + (fun t _ ↦ hH t) (fun t _ ↦ hrootSet t) + he₀P.1 hf_F he₀P.2.1 he₀f he₀P.2.2.1 he₀P.2.2.2 + let H_f : RootedHypergraph α β := + { toHypergraph := (τ f).toHypergraph + roots := H.roots + roots_nodup := H.roots_nodup + roots_subset := fun v hv ↦ by + have hv' : v ∈ H.rootSet := hv + rw [hH_rootSet] at hv' + exact (τ f).roots_subset v hv' } + have hcross_eq : cross (Function.update τ' f H_f) (T.subtreeAt f) f = H := by + apply RootedHypergraph.ext + · rw [hH_to] + refine cross_toHypergraph_congr (T.self_mem_subtreeAt hfv) (T.self_mem_subtreeAt hfv) + fun t _ ↦ ?_ + by_cases htf : t = f + · subst htf + simp [H_f] + · simp [htf, hH t] + · simp [H_f] + refine ⟨H_f, rfl, hH_rootSet, fun e heP hef ↦ ?_⟩ + rw [hcross_eq] + have hee₀ : T.Reaches e e₀ := he₀_max e heP hef + have he₀D : e₀ ∈ D := hf_anc_in_D e₀ he₀P.1 he₀P.2.1 he₀f + have heD : e ∈ D := hf_anc_in_D e heP.1 heP.2.1 hef + have hord_e₀_e : edgeOrder T τ' e₀ = edgeOrder T τ' e := by + rw [edgeOrder_congr (hF he₀P.1) (fun t _ ↦ hH t), + edgeOrder_congr (hF heP.1) (fun t _ ↦ hH t), + ← he₀P.2.2.1, ← heP.2.2.1] + have hmin_e₀_e : ∀ g ∈ T.pathEdges e e₀ ∩ ↑D, edgeOrder T τ' e₀ ≤ edgeOrder T τ' g := by + rintro g ⟨⟨heg, hge₀⟩, hgD⟩ + have hgF : g ∈ F := (hF_fin g).mp (hD_sub hgD) + rw [edgeOrder_congr (hF he₀P.1) (fun t _ ↦ hH t), + edgeOrder_congr (hF hgF) (fun t _ ↦ hH t), ← he₀P.2.2.1] + exact heP.2.2.2 g ⟨⟨heg, T.reaches_trans hge₀ he₀f⟩, hgF⟩ + have hsim_e₀_e : sim (cross τ' (T.subtreeAt e₀) e₀) (cross τ' (T.subtreeAt e) e) := + hlinkedD e₀ he₀D e heD hee₀ hord_e₀_e hmin_e₀_e + have hH_R : H ∈ R := by + refine hA1 (cross τ T.verts T.root) hR H ?_ + rw [hH_to] + exact hdec.cross_le (T.subtreeAt_subset_verts f) (T.self_mem_subtreeAt hfv) + have he₀_R : cross τ' (T.subtreeAt e₀) e₀ ∈ R := by + refine hA1 (cross τ T.verts T.root) hR _ ?_ + have he₀v : e₀ ∈ T.verts := T.edges_subset_verts (hF he₀P.1) + rw [cross_toHypergraph_congr (T.self_mem_subtreeAt he₀v) (T.self_mem_subtreeAt he₀v) + (fun t _ ↦ hH t)] + exact hdec.cross_le (T.subtreeAt_subset_verts e₀) (T.self_mem_subtreeAt he₀v) + have he_R : cross τ' (T.subtreeAt e) e ∈ R := by + refine hA1 (cross τ T.verts T.root) hR _ ?_ + have hev : e ∈ T.verts := T.edges_subset_verts (hF heP.1) + rw [cross_toHypergraph_congr (T.self_mem_subtreeAt hev) (T.self_mem_subtreeAt hev) + (fun t _ ↦ hH t)] + exact hdec.cross_le (T.subtreeAt_subset_verts e) (T.self_mem_subtreeAt hev) + exact hA2.2 H hH_R _ he₀_R _ he_R hsim_e₀ hsim_e₀_e + · refine ⟨τ' f, hH f, hrootSet f, fun e heP hef ↦ False.elim (hP_ex ⟨e, heP, hef⟩)⟩ + obtain ⟨H_f, hHf_to, hHf_rootSet, hHf_sim⟩ := h_choice + let τ'' : ι → RootedHypergraph α β := Function.update τ' f H_f + have hH'' : ∀ t, (τ'' t).toHypergraph = (τ t).toHypergraph := by + intro t + by_cases htf : t = f + · subst htf + simpa [τ''] using hHf_to + · simp [τ'', htf, hH t] + have hrootSet'' : ∀ t, (τ'' t).rootSet = (τ t).rootSet := by + intro t + by_cases htf : t = f + · subst htf + simpa [τ''] using hHf_rootSet + · simp [τ'', htf, hrootSet t] + have hroot'' : (τ'' T.root).roots = (τ T.root).roots := by + have hrf : T.root ≠ f := (T.mem_edges_iff.mp hfe).2.symm + simp [τ'', hrf, hroot] + have hcross_ne : ∀ e ∈ T.verts, e ≠ f → + cross τ'' (T.subtreeAt e) e = cross τ' (T.subtreeAt e) e := by + intro e hev hef + refine cross_congr (T.self_mem_subtreeAt hev) (fun t _ ↦ ?_) ?_ + · rw [hH'' t, hH t] + · simp [τ'', hef] + have hlinkedD' : IsLinked sim T τ'' (D' : Set ι) := by + intro f₁ hf₁ f₂ hf₂ hreach hord hmin + have hf₁F : f₁ ∈ F := (hF_fin f₁).mp (hD'_sub hf₁) + have hf₂F : f₂ ∈ F := (hF_fin f₂).mp (hD'_sub hf₂) + have hf₁v : f₁ ∈ T.verts := T.edges_subset_verts (hF hf₁F) + have hf₂v : f₂ ∈ T.verts := T.edges_subset_verts (hF hf₂F) + by_cases h₁₂ : f₁ = f₂ + · subst h₁₂ + refine hA2.1 _ (hA1 (cross τ T.verts T.root) hR _ ?_) + rw [cross_toHypergraph_congr (T.self_mem_subtreeAt hf₁v) (T.self_mem_subtreeAt hf₁v) + (fun t _ ↦ hH'' t)] + exact hdec.cross_le (T.subtreeAt_subset_verts f₁) (T.self_mem_subtreeAt hf₁v) + · have hf₂_ne_f : f₂ ≠ f := by + rintro rfl + have hf₁D : f₁ ∈ D := (Finset.mem_insert.mp hf₁).resolve_left h₁₂ + exact hf_notD (hD_down f₁ hf₁D f₂ hf₂F hreach) + have hf₂D : f₂ ∈ D := (Finset.mem_insert.mp hf₂).resolve_left hf₂_ne_f + rw [hcross_ne f₂ hf₂v hf₂_ne_f] + rcases Finset.mem_insert.mp hf₁ with rfl | hf₁D + · refine hHf_sim f₂ ⟨hf₂F, hf₂_ne_f, ?_, ?_⟩ hreach + · rw [← edgeOrder_congr (hF hf₁F) (fun t _ ↦ hH'' t), + ← edgeOrder_congr (hF hf₂F) (fun t _ ↦ hH'' t), hord] + · rintro g ⟨hg_path, hgF⟩ + have hgD' : g ∈ D' := hD'_down f₁ (Finset.mem_insert_self f₁ D) g hgF hg_path.2 + rw [← edgeOrder_congr (hF hf₁F) (fun t _ ↦ hH'' t), + ← edgeOrder_congr (hF hgF) (fun t _ ↦ hH'' t)] + exact hmin g ⟨hg_path, hgD'⟩ + · have hf₁_ne_f : f₁ ≠ f := fun h ↦ hf_notD (h ▸ hf₁D) + rw [hcross_ne f₁ hf₁v hf₁_ne_f] + refine hlinkedD f₁ hf₁D f₂ hf₂D hreach ?_ ?_ + · rw [edgeOrder_congr (hF hf₁F) (fun t _ ↦ hH t), + edgeOrder_congr (hF hf₂F) (fun t _ ↦ hH t), + ← edgeOrder_congr (hF hf₁F) (fun t _ ↦ hH'' t), + ← edgeOrder_congr (hF hf₂F) (fun t _ ↦ hH'' t), hord] + · rintro g ⟨hg_path, hgD⟩ + have hgF : g ∈ F := (hF_fin g).mp (hD_sub hgD) + rw [edgeOrder_congr (hF hf₁F) (fun t _ ↦ hH t), + edgeOrder_congr (hF hgF) (fun t _ ↦ hH t), + ← edgeOrder_congr (hF hf₁F) (fun t _ ↦ hH'' t), + ← edgeOrder_congr (hF hgF) (fun t _ ↦ hH'' t)] + exact hmin g ⟨hg_path, Finset.mem_insert_of_mem hgD⟩ + exact ih D' τ'' hD'_sub hcard' hD'_down hH'' hrootSet'' hroot'' hlinkedD' + +/-- Graph Minors IV, (4.2). -/ +theorem theorem_4_2_proof (h22 : TreeLemma22Statement.{u}) {ι : Type u} + (hA1 : Axiom1 R) (hA2 : Axiom2 R sim) (hA3 : Axiom3 R sim) + (𝒮 : Set (RootedTree ι × (ι → RootedHypergraph α β))) (h𝒮 : IsGood R sim 𝒮) + (hsym : IsSymmetric 𝒮) (T : ℕ → RootedTree ι) (τ : ℕ → ι → RootedHypergraph α β) + (hdec : ∀ i, IsTreeDecomposition (cross (τ i) (T i).verts (T i).root) (T i) (τ i)) + (hrot : ∀ i, IsRotund (T i) (τ i) (T i).edges) + (hbr : ∀ i, ∀ s ∈ (T i).verts, ((T i).starAt s, branching (T i) (τ i) s) ∈ 𝒮) : + ∃ i i', i < i' ∧ + sim (cross (τ i) (T i).verts (T i).root) (cross (τ i') (T i').verts (T i').root) := by + have hR : ∀ i, cross (τ i) (T i).verts (T i).root ∈ R := by + intro i + have h := h𝒮.2.1 ((T i).starAt (T i).root, branching (T i) (τ i) (T i).root) + (hbr i (T i).root (T i).root_mem) + dsimp only at h + rwa [cross_branching_eq (T i) (τ i) (T i).root_mem, cross_subtreeAt_root] at h + have h41 : ∀ i, ∃ τ' : ι → RootedHypergraph α β, + IsTreeDecomposition (cross (τ i) (T i).verts (T i).root) (T i) τ' ∧ + (∀ t ∈ (T i).verts, (τ' t).toHypergraph = (τ i t).toHypergraph) ∧ + IsLinked sim (T i) τ' (T i).edges := + fun i ↦ theorem_4_1_proof hA1 hA2 hA3 (T i) (τ i) (hdec i) (hR i) (T i).edges subset_rfl + (hrot i) + choose τ' hdec' hH' hlinked' using h41 + have hrootSet' : ∀ i, ∀ t ∈ (T i).verts, (τ' i t).rootSet = (τ i t).rootSet := by + intro i t ht + by_cases htr : t = (T i).root + · subst htr + have h1 : (τ' i (T i).root).roots = (τ i (T i).root).roots := + (hdec' i).roots_root.trans (hdec i).roots_root.symm + simp only [RootedHypergraph.rootSet, h1] + · have hte : t ∈ (T i).edges := (T i).mem_edges_iff.mpr ⟨ht, htr⟩ + rw [(hdec' i).rootSet_edge t hte, (hdec i).rootSet_edge t hte, + hH' i t ht, hH' i ((T i).parent t) ((T i).parent_mem t ht)] + have hcross_eq : ∀ i, + cross (τ' i) (T i).verts (T i).root = cross (τ i) (T i).verts (T i).root := + fun i ↦ (hdec' i).cross_verts_eq + have hdec'' : ∀ i, IsTreeDecomposition (cross (τ' i) (T i).verts (T i).root) (T i) (τ' i) := by + intro i + rw [hcross_eq i] + exact hdec' i + have hbr' : ∀ i, ∀ s ∈ (T i).verts, ((T i).starAt s, branching (T i) (τ' i) s) ∈ 𝒮 := by + intro i s hs + refine hsym ((T i).starAt s, branching (T i) (τ i) s) (hbr i s hs) + (branching (T i) (τ' i) s) ((hdec' i).isStarDecomposition_branching hs) ?_ + intro t ht + dsimp only at ht ⊢ + rcases (T i).mem_starAt_verts.mp ht with rfl | htc + · simp only [branching_self] + exact ⟨hH' i t hs, hrootSet' i t hs⟩ + · rw [branching_of_mem_children (T i) (τ' i) htc, branching_of_mem_children (T i) (τ i) htc] + have htv : t ∈ (T i).verts := (T i).children_subset_verts s htc + have ht_sub : t ∈ (T i).subtreeAt t := (T i).self_mem_subtreeAt htv + refine ⟨cross_toHypergraph_congr ht_sub ht_sub + (fun u hu ↦ hH' i u ((T i).subtreeAt_subset_verts t hu)), ?_⟩ + simp only [cross_rootSet] + exact hrootSet' i t htv + obtain ⟨i, i', hii', hsim⟩ := theorem_3_3_proof h22 hA1 hA2 𝒮 h𝒮 T τ' hdec'' hlinked' hbr' + rw [hcross_eq i, hcross_eq i'] at hsim + exact ⟨i, i', hii', hsim⟩ + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/Decomposition/SubtreeHelly.lean b/LeanPool/GraphMinor/GM04/Decomposition/SubtreeHelly.lean new file mode 100644 index 0000000000..a268d9b469 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Decomposition/SubtreeHelly.lean @@ -0,0 +1,485 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Decomposition.Rotund +import LeanPool.GraphMinor.GM04.Decomposition.Contraction + +/-! +# Helly property of subtrees and re-rooting of trees + +This file proves two tree-theoretic ingredients for Graph Minors IV, (5.2): +1. The Helly property for vertex sets of subtrees of a rooted tree +(`RootedTree.helly_isSubtreeSet`). +2. Re-rooting a `RootedTree ι` at any vertex `r₀ ∈ T.verts` (`RootedTree.exists_reroot`), preserving + the vertex set, the `OnPath` relation, and the separation pairs `{T.subtreeAt f, T.rootSide f}` + of the edges. +-/ + +public section + +namespace GraphMinor.GM04.RootedTree + +variable {ι : Type*} (T : RootedTree ι) + +/-- `A` is the vertex set of a subtree of `T`: `A ⊆ T.verts` and `A` is closed under paths in `T`. +-/ +@[expose] def IsSubtreeSet (A : Set ι) : Prop := + A ⊆ T.verts ∧ ∀ t₁ ∈ A, ∀ t₃ ∈ A, ∀ t₂ ∈ T.verts, T.OnPath t₁ t₃ t₂ → t₂ ∈ A + +/-- Every nonempty subtree vertex set `A` has a root `r ∈ A` that reaches every vertex in `A`. -/ +theorem IsSubtreeSet.exists_root {T : RootedTree ι} {A : Set ι} (hA : T.IsSubtreeSet A) + (hne : A.Nonempty) : + ∃ r ∈ A, ∀ t ∈ A, T.Reaches r t := by + obtain ⟨t₀, ht₀⟩ := hne + have ht₀v : t₀ ∈ T.verts := hA.1 ht₀ + obtain ⟨r, hrA, _, _, hr_min⟩ := + T.exists_furthest_ancestor (T.reaches_root ht₀v) + ⟨t₀, ht₀, T.reaches_root ht₀v, T.reaches_refl ht₀v⟩ + refine ⟨r, hrA, fun t htA ↦ ?_⟩ + have hrv : r ∈ T.verts := hA.1 hrA + have htv : t ∈ T.verts := hA.1 htA + obtain ⟨a, hav, har, hat, ha_lca⟩ := T.exists_lca hrv htv + have ha_on : T.OnPath r t a := ⟨Or.inl har, ha_lca⟩ + have haA : a ∈ A := hA.2 r hrA t htA a hav ha_on + have ha_eq : a = r := hr_min a haA (T.reaches_root hav) har + rwa [← ha_eq] + +/-- If two subtree vertex sets `A` and `B` with roots `r_A, r_B` meet, then `r_A` reaches `r_B` +(so `r_B ∈ A`) or `r_B` reaches `r_A` (so `r_A ∈ B`). -/ +theorem IsSubtreeSet.reaches_root_or_symm {T : RootedTree ι} {A B : Set ι} + (hA : T.IsSubtreeSet A) {rA rB : ι} (hrA : rA ∈ A) (hA_reach : ∀ t ∈ A, T.Reaches rA t) + (hB_reach : ∀ t ∈ B, T.Reaches rB t) (hinter : (A ∩ B).Nonempty) : + (T.Reaches rA rB ∧ rB ∈ A) ∨ T.Reaches rB rA := by + obtain ⟨t, htA, htB⟩ := hinter + rcases T.reaches_total_of_reaches (hA_reach t htA) (hB_reach t htB) with hAB | hBA + · left + have hrBv : rB ∈ T.verts := T.reaches_mem_left (hB_reach t htB) + exact ⟨hAB, hA.2 rA hrA t htA rB hrBv (T.onPath_of_reaches hAB (hB_reach t htB))⟩ + · exact Or.inr hBA + +/-- In a finite nonempty set `I`, a relation `R` that is reflexive and total on `I` and transitive +has a maximum element in `I`. -/ +private theorem exists_max_of_total {α : Type*} {I : Finset α} (hne : I.Nonempty) + {R : α → α → Prop} (hrefl : ∀ x ∈ I, R x x) + (htrans : ∀ x y z, R x y → R y z → R x z) + (htotal : ∀ x ∈ I, ∀ y ∈ I, R x y ∨ R y x) : + ∃ m ∈ I, ∀ x ∈ I, R x m := by + classical + induction I using Finset.induction with + | empty => exact absurd hne Finset.not_nonempty_empty + | @insert a s ha ih => + by_cases hs : s.Nonempty + · obtain ⟨m, hm_s, hm⟩ := ih hs + (fun x hx ↦ hrefl x (Finset.mem_insert_of_mem hx)) + (fun x hx y hy ↦ htotal x (Finset.mem_insert_of_mem hx) y (Finset.mem_insert_of_mem hy)) + rcases htotal a (Finset.mem_insert_self a s) m (Finset.mem_insert_of_mem hm_s) with ham | hma + · refine ⟨m, Finset.mem_insert_of_mem hm_s, fun x hx ↦ ?_⟩ + rcases Finset.mem_insert.mp hx with rfl | hxs + · exact ham + · exact hm x hxs + · refine ⟨a, Finset.mem_insert_self a s, fun x hx ↦ ?_⟩ + rcases Finset.mem_insert.mp hx with rfl | hxs + · exact hrefl x (Finset.mem_insert_self x s) + · exact htrans x m a (hm x hxs) hma + · rw [Finset.not_nonempty_iff_eq_empty] at hs + subst hs + refine ⟨a, Finset.mem_singleton_self a, fun x hx ↦ ?_⟩ + rw [Finset.mem_singleton.mp hx] + exact hrefl a (Finset.mem_singleton_self a) + +/-- The **Helly property for subtrees of a tree**: if `I` is a finite index set and `A i` (`i ∈ I`) +are nonempty subtree vertex sets of `T` that intersect pairwise, then there is a vertex `t ∈ +T.verts` +belonging to `A i` for all `i ∈ I`. -/ +theorem helly_isSubtreeSet {α : Type*} (I : Finset α) (A : α → Set ι) + (hsub : ∀ i ∈ I, T.IsSubtreeSet (A i)) + (hinter : ∀ i ∈ I, ∀ j ∈ I, (A i ∩ A j).Nonempty) : + ∃ t ∈ T.verts, ∀ i ∈ I, t ∈ A i := by + by_cases hne : I.Nonempty + · have hex_root : ∀ i : α, ∃ r, i ∈ I → r ∈ A i ∧ ∀ t ∈ A i, T.Reaches r t := by + intro i + by_cases hi : i ∈ I + · obtain ⟨r, hr₁, hr₂⟩ := (hsub i hi).exists_root (by simpa using hinter i hi i hi) + exact ⟨r, fun _ ↦ ⟨hr₁, hr₂⟩⟩ + · exact ⟨T.root, fun h ↦ False.elim (hi h)⟩ + choose r hr using hex_root + obtain ⟨i₀, hi₀, hmax⟩ := exists_max_of_total hne + (R := fun i j ↦ T.Reaches (r i) (r j)) + (fun i hi ↦ T.reaches_refl ((hsub i hi).1 (hr i hi).1)) + (fun _ _ _ h₁ h₂ ↦ T.reaches_trans h₁ h₂) + (fun i hi j hj ↦ by + rcases (hsub i hi).reaches_root_or_symm (hr i hi).1 (hr i hi).2 (hr j hj).2 + (hinter i hi j hj) with ⟨h, _⟩ | h + · exact Or.inl h + · exact Or.inr h) + refine ⟨r i₀, (hsub i₀ hi₀).1 (hr i₀ hi₀).1, fun i hi ↦ ?_⟩ + rcases (hsub i hi).reaches_root_or_symm (hr i hi).1 (hr i hi).2 (hr i₀ hi₀).2 + (hinter i hi i₀ hi₀) with ⟨_, hmem⟩ | h_rev + · exact hmem + · have heq : r i₀ = r i := T.reaches_antisymm h_rev (hmax i hi) + rw [heq] + exact (hr i hi).1 + · rw [Finset.not_nonempty_iff_eq_empty] at hne + subst hne + exact ⟨T.root, T.root_mem, fun _ h ↦ False.elim (Finset.notMem_empty _ h)⟩ + +/-- Characterization of `T.OnPath t₁ t₃ t₂` in terms of the half-trees `{T.subtreeAt f, T.rootSide +f}` +for `f ∈ T.edges`. -/ +theorem onPath_iff_edges {t₁ t₂ t₃ : ι} (ht₁ : t₁ ∈ T.verts) (ht₂ : t₂ ∈ T.verts) + (ht₃ : t₃ ∈ T.verts) : + T.OnPath t₁ t₃ t₂ ↔ + ∀ f ∈ T.edges, + (t₂ ∈ T.subtreeAt f → t₁ ∈ T.subtreeAt f ∨ t₃ ∈ T.subtreeAt f) ∧ + (t₂ ∈ T.rootSide f → t₁ ∈ T.rootSide f ∨ t₃ ∈ T.rootSide f) := by + refine ⟨?_, ?_⟩ + · intro hon f _ + simp only [T.mem_subtreeAt, T.mem_rootSide, ht₁, ht₂, ht₃, true_and] + refine ⟨fun hf₂ ↦ ?_, fun hf₂ ↦ ?_⟩ + · rcases hon.1 with h₂₁ | h₂₃ + · exact Or.inl (T.reaches_trans hf₂ h₂₁) + · exact Or.inr (T.reaches_trans hf₂ h₂₃) + · by_contra h_not + push Not at h_not + exact hf₂ (hon.2 f h_not.1 h_not.2) + · intro h + refine ⟨?_, fun x hx₁ hx₃ ↦ ?_⟩ + · by_cases ht₂r : t₂ = T.root + · subst ht₂r + exact Or.inl (T.reaches_root ht₁) + · have ht₂e : t₂ ∈ T.edges := T.mem_edges_iff.mpr ⟨ht₂, ht₂r⟩ + have h_sub := (h t₂ ht₂e).1 (T.self_mem_subtreeAt ht₂) + simpa only [T.mem_subtreeAt] using h_sub + · by_cases hxr : x = T.root + · subst hxr + exact T.reaches_root ht₂ + · have hxe : x ∈ T.edges := T.mem_edges_iff.mpr ⟨T.reaches_mem_left hx₁, hxr⟩ + by_contra h_not + have ht₂_root : t₂ ∈ T.rootSide x := T.mem_rootSide.mpr ⟨ht₂, h_not⟩ + rcases (h x hxe).2 ht₂_root with h₁ | h₃ + · exact (T.mem_rootSide.mp h₁).2 hx₁ + · exact (T.mem_rootSide.mp h₃).2 hx₃ + +/-- Re-rooting `T` by moving the root one step to a child `c ∈ T.children T.root`. -/ +noncomputable def rerootChild {c : ι} (hc : c ∈ T.children T.root) : RootedTree ι where + verts := T.verts + root := c + parent v := by classical exact if v = T.root ∨ v = c then c else T.parent v + root_mem := T.children_subset_verts T.root hc + parent_mem v hv := by + classical + split_ifs + · exact T.children_subset_verts T.root hc + · exact T.parent_mem v hv + parent_root := by + classical + simp + exists_iterate_eq_root v hv := by + classical + obtain ⟨n, hn⟩ := T.exists_iterate_eq_root v hv + induction n generalizing v with + | zero => + rw [Function.iterate_zero_apply] at hn + subst hn + exact ⟨1, by simp⟩ + | succ k ih => + by_cases hvc : v = T.root ∨ v = c + · exact ⟨1, by simp [hvc]⟩ + · rw [Function.iterate_succ_apply] at hn + obtain ⟨m, hm⟩ := ih (T.parent v) (T.parent_mem v hv) hn + refine ⟨m + 1, ?_⟩ + simp only [Function.iterate_succ_apply, hvc, ↓reduceIte, hm] + +@[simp] +private theorem rerootChild_verts {c : ι} (hc : c ∈ T.children T.root) : + (T.rerootChild hc).verts = T.verts := rfl + +private theorem rerootChild_reaches_old_root {c : ι} (hc : c ∈ T.children T.root) (x : ι) : + (T.rerootChild hc).Reaches T.root x ↔ x ∈ T.rootSide c := by + classical + obtain ⟨hce, hcp⟩ := T.mem_children_iff.mp hc + refine ⟨?_, ?_⟩ + · rintro ⟨hx, n, hn⟩ + induction n generalizing x with + | zero => + rw [Function.iterate_zero_apply] at hn + subst hn + exact T.root_mem_rootSide hce + | succ k ih => + rw [Function.iterate_succ_apply] at hn + have hp_mem : (T.rerootChild hc).parent x ∈ T.verts := + (T.rerootChild hc).parent_mem x hx + have hp_rootSide : (T.rerootChild hc).parent x ∈ T.rootSide c := + ih ((T.rerootChild hc).parent x) hp_mem hn + have hxc : ¬ (x = T.root ∨ x = c) := by + intro h_or + have hp_eq : (T.rerootChild hc).parent x = c := by simp [rerootChild, h_or] + rw [hp_eq, T.mem_rootSide] at hp_rootSide + exact hp_rootSide.2 (T.reaches_refl (T.edges_subset_verts hce)) + have hp_eq : (T.rerootChild hc).parent x = T.parent x := by simp [rerootChild, hxc] + rw [hp_eq, T.mem_rootSide] at hp_rootSide + refine T.mem_rootSide.mpr ⟨hx, fun hcx ↦ ?_⟩ + have hx_ne_c : c ≠ x := fun h ↦ hxc (Or.inr h.symm) + exact hp_rootSide.2 (T.reaches_parent_of_reaches_of_ne hcx hx_ne_c) + · intro hx + obtain ⟨hxv, hnot_cx⟩ := T.mem_rootSide.mp hx + obtain ⟨n, hn⟩ := T.exists_iterate_eq_root x hxv + induction n generalizing x with + | zero => + rw [Function.iterate_zero_apply] at hn + subst hn + exact (T.rerootChild hc).reaches_refl T.root_mem + | succ k ih => + by_cases hxr : x = T.root + · subst hxr + exact (T.rerootChild hc).reaches_refl T.root_mem + · have hxc : ¬ (x = T.root ∨ x = c) := by + rintro (rfl | rfl) + · exact hxr rfl + · exact hnot_cx (T.reaches_refl hxv) + have hp_eq : (T.rerootChild hc).parent x = T.parent x := by simp [rerootChild, hxc] + have hnot_cp : ¬ T.Reaches c (T.parent x) := + fun hcp' ↦ hnot_cx (T.reaches_trans hcp' (T.reaches_parent hxv)) + rw [Function.iterate_succ_apply] at hn + have hp_reach := ih (T.parent x) (T.mem_rootSide.mpr ⟨T.parent_mem x hxv, hnot_cp⟩) + (T.parent_mem x hxv) hnot_cp hn + exact (T.rerootChild hc).reaches_trans hp_reach + (hp_eq ▸ (T.rerootChild hc).reaches_parent hxv) + +private theorem rerootChild_reaches_of_ne {c f : ι} (hc : c ∈ T.children T.root) + (hf : f ∈ T.edges) (hfc : f ≠ c) (x : ι) : + (T.rerootChild hc).Reaches f x ↔ T.Reaches f x := by + classical + obtain ⟨hce, hcp⟩ := T.mem_children_iff.mp hc + have hfr : f ≠ T.root := (T.mem_edges_iff.mp hf).2 + have h_not_fc : ¬ T.Reaches f c := by + intro hfc_reach + have hfp := T.reaches_parent_of_reaches_of_ne hfc_reach hfc + rw [hcp, T.reaches_root_iff] at hfp + exact hfr hfp + refine ⟨?_, ?_⟩ + · rintro ⟨hx, n, hn⟩ + induction n generalizing x with + | zero => + rw [Function.iterate_zero_apply] at hn + subst hn + exact T.reaches_refl hx + | succ k ih => + rw [Function.iterate_succ_apply] at hn + have hp_reach : T.Reaches f ((T.rerootChild hc).parent x) := + ih ((T.rerootChild hc).parent x) ((T.rerootChild hc).parent_mem x hx) hn + have hxc : ¬ (x = T.root ∨ x = c) := by + intro h_or + have hp_eq : (T.rerootChild hc).parent x = c := by simp [rerootChild, h_or] + rw [hp_eq] at hp_reach + exact h_not_fc hp_reach + have hp_eq : (T.rerootChild hc).parent x = T.parent x := by simp [rerootChild, hxc] + rw [hp_eq] at hp_reach + exact T.reaches_trans hp_reach (T.reaches_parent hx) + · rintro ⟨hx, n, hn⟩ + induction n generalizing x with + | zero => + rw [Function.iterate_zero_apply] at hn + subst hn + exact (T.rerootChild hc).reaches_refl hx + | succ k ih => + by_cases hxf : x = f + · subst hxf + exact (T.rerootChild hc).reaches_refl hx + · have hfx : T.Reaches f x := ⟨hx, k + 1, hn⟩ + have hxc : ¬ (x = T.root ∨ x = c) := by + rintro (rfl | rfl) + · exact hfr (T.reaches_root_iff.mp hfx) + · exact h_not_fc hfx + have hp_eq : (T.rerootChild hc).parent x = T.parent x := by simp [rerootChild, hxc] + rw [Function.iterate_succ_apply] at hn + have hp_reach := ih (T.parent x) (T.parent_mem x hx) hn + exact (T.rerootChild hc).reaches_trans hp_reach + (hp_eq ▸ (T.rerootChild hc).reaches_parent hx) + +@[simp] +private theorem rerootChild_subtreeAt_old_root {c : ι} (hc : c ∈ T.children T.root) : + (T.rerootChild hc).subtreeAt T.root = T.rootSide c := by + ext x + rw [(T.rerootChild hc).mem_subtreeAt, T.rerootChild_reaches_old_root hc] + +@[simp] +private theorem rerootChild_rootSide_old_root {c : ι} (hc : c ∈ T.children T.root) : + (T.rerootChild hc).rootSide T.root = T.subtreeAt c := by + ext x + rw [(T.rerootChild hc).mem_rootSide, T.rerootChild_verts hc, T.rerootChild_reaches_old_root hc, + T.mem_rootSide, T.mem_subtreeAt] + exact ⟨fun ⟨hx, hnot⟩ ↦ by tauto, fun h ↦ ⟨T.reaches_mem_right h, fun hnot ↦ hnot.2 h⟩⟩ + +private theorem rerootChild_subtreeAt_of_ne {c f : ι} (hc : c ∈ T.children T.root) + (hf : f ∈ T.edges) (hfc : f ≠ c) : + (T.rerootChild hc).subtreeAt f = T.subtreeAt f := by + ext x + rw [(T.rerootChild hc).mem_subtreeAt, T.mem_subtreeAt, + T.rerootChild_reaches_of_ne hc hf hfc] + +private theorem rerootChild_rootSide_of_ne {c f : ι} (hc : c ∈ T.children T.root) + (hf : f ∈ T.edges) (hfc : f ≠ c) : + (T.rerootChild hc).rootSide f = T.rootSide f := by + ext x + rw [(T.rerootChild hc).mem_rootSide, T.rerootChild_verts hc, + T.rerootChild_reaches_of_ne hc hf hfc, T.mem_rootSide] + +private theorem mem_rerootChild_edges_iff {c f : ι} (hc : c ∈ T.children T.root) : + f ∈ (T.rerootChild hc).edges ↔ f = T.root ∨ (f ∈ T.edges ∧ f ≠ c) := by + obtain ⟨hce, _⟩ := T.mem_children_iff.mp hc + have hcr : c ≠ T.root := (T.mem_edges_iff.mp hce).2 + rw [(T.rerootChild hc).mem_edges_iff, T.mem_edges_iff] + change (f ∈ T.verts ∧ f ≠ c) ↔ f = T.root ∨ (f ∈ T.verts ∧ f ≠ T.root) ∧ f ≠ c + refine ⟨fun ⟨hfv, hfc⟩ ↦ ?_, ?_⟩ + · by_cases hfr : f = T.root + · exact Or.inl hfr + · exact Or.inr ⟨⟨hfv, hfr⟩, hfc⟩ + · rintro (rfl | ⟨⟨hfv, _⟩, hfc⟩) + · exact ⟨T.root_mem, hcr.symm⟩ + · exact ⟨hfv, hfc⟩ + +private theorem rerootChild_onPath_iff {c t₁ t₂ t₃ : ι} (hc : c ∈ T.children T.root) + (ht₁ : t₁ ∈ T.verts) (ht₂ : t₂ ∈ T.verts) (ht₃ : t₃ ∈ T.verts) : + (T.rerootChild hc).OnPath t₁ t₃ t₂ ↔ T.OnPath t₁ t₃ t₂ := by + obtain ⟨hce, _⟩ := T.mem_children_iff.mp hc + rw [(T.rerootChild hc).onPath_iff_edges ht₁ ht₂ ht₃, T.onPath_iff_edges ht₁ ht₂ ht₃] + refine ⟨fun h f hf ↦ ?_, fun h f hf ↦ ?_⟩ + · by_cases hfc : f = c + · subst hfc + have hr_edge : T.root ∈ (T.rerootChild hc).edges := + (T.mem_rerootChild_edges_iff hc).mpr (Or.inl rfl) + have h_root := h T.root hr_edge + rw [T.rerootChild_subtreeAt_old_root hc, T.rerootChild_rootSide_old_root hc] at h_root + exact h_root.symm + · have hf_edge : f ∈ (T.rerootChild hc).edges := + (T.mem_rerootChild_edges_iff hc).mpr (Or.inr ⟨hf, hfc⟩) + have h_f := h f hf_edge + rwa [T.rerootChild_subtreeAt_of_ne hc hf hfc, + T.rerootChild_rootSide_of_ne hc hf hfc] at h_f + · rcases (T.mem_rerootChild_edges_iff hc).mp hf with rfl | ⟨hfe, hfc⟩ + · rw [T.rerootChild_subtreeAt_old_root hc, T.rerootChild_rootSide_old_root hc] + exact (h c hce).symm + · rw [T.rerootChild_subtreeAt_of_ne hc hfe hfc, T.rerootChild_rootSide_of_ne hc hfe hfc] + exact h f hfe + +private theorem rerootChild_onPathEdge_exists_iff {α : Type*} {c t₁ t₂ : ι} + (hc : c ∈ T.children T.root) (V : ι → Set α) (ht₁ : t₁ ∈ T.verts) (ht₂ : t₂ ∈ T.verts) + (k : ℕ) : + (∃ f, (T.rerootChild hc).OnPathEdge t₁ t₂ f ∧ + (V f ∩ V ((T.rerootChild hc).parent f)).ncard < k) ↔ + ∃ f, T.OnPathEdge t₁ t₂ f ∧ (V f ∩ V (T.parent f)).ncard < k := by + classical + obtain ⟨hce, hcp⟩ := T.mem_children_iff.mp hc + refine ⟨?_, ?_⟩ + · rintro ⟨f, hon, hcard⟩ + rw [(T.rerootChild hc).onPathEdge_iff ht₁ ht₂] at hon + rcases (T.mem_rerootChild_edges_iff hc).mp hon.1 with rfl | ⟨hfe, hfc⟩ + · rw [T.rerootChild_subtreeAt_old_root hc, T.rerootChild_rootSide_old_root hc] at hon + have hp_eq : (T.rerootChild hc).parent T.root = c := by simp [rerootChild] + rw [hp_eq, Set.inter_comm] at hcard + rw [← hcp] at hcard + refine ⟨c, ?_, hcard⟩ + rw [T.onPathEdge_iff ht₁ ht₂] + exact ⟨hce, hon.2.symm.imp And.symm And.symm⟩ + · rw [T.rerootChild_subtreeAt_of_ne hc hfe hfc, + T.rerootChild_rootSide_of_ne hc hfe hfc] at hon + have hfr : f ≠ T.root := (T.mem_edges_iff.mp hfe).2 + have hp_eq : (T.rerootChild hc).parent f = T.parent f := by + simp [rerootChild, hfr, hfc] + rw [hp_eq] at hcard + refine ⟨f, ?_, hcard⟩ + rw [T.onPathEdge_iff ht₁ ht₂] + exact ⟨hfe, hon.2⟩ + · rintro ⟨f, hon, hcard⟩ + rw [T.onPathEdge_iff ht₁ ht₂] at hon + by_cases hfc : f = c + · subst hfc + have hp_eq : (T.rerootChild hc).parent T.root = f := by simp [rerootChild] + refine ⟨T.root, ?_, ?_⟩ + · rw [(T.rerootChild hc).onPathEdge_iff ht₁ ht₂, + T.rerootChild_subtreeAt_old_root hc, T.rerootChild_rootSide_old_root hc] + exact ⟨(T.mem_rerootChild_edges_iff hc).mpr (Or.inl rfl), + hon.2.symm.imp And.symm And.symm⟩ + · rw [hp_eq, Set.inter_comm, ← hcp] + exact hcard + · have hfr : f ≠ T.root := (T.mem_edges_iff.mp hon.1).2 + have hp_eq : (T.rerootChild hc).parent f = T.parent f := by + simp [rerootChild, hfr, hfc] + refine ⟨f, ?_, hp_eq.symm ▸ hcard⟩ + rw [(T.rerootChild hc).onPathEdge_iff ht₁ ht₂, + T.rerootChild_subtreeAt_of_ne hc hon.1 hfc, + T.rerootChild_rootSide_of_ne hc hon.1 hfc] + exact ⟨(T.mem_rerootChild_edges_iff hc).mpr (Or.inr ⟨hon.1, hfc⟩), hon.2⟩ + +/-- Re-rooting `T` at any vertex `r₀ ∈ T.verts` produces a `RootedTree ι` with the same vertex set, +root `r₀`, the same `OnPath` relation, and the same edge-separation orders for any vertex-bag +assignment `V`. -/ +theorem exists_reroot {α : Type*} (V : ι → Set α) {r₀ : ι} (hr₀ : r₀ ∈ T.verts) : + ∃ T' : RootedTree ι, + T'.verts = T.verts ∧ + T'.root = r₀ ∧ + (∀ t₁ ∈ T.verts, ∀ t₂ ∈ T.verts, ∀ t₃ ∈ T.verts, T'.OnPath t₁ t₃ t₂ ↔ T.OnPath t₁ t₃ t₂) ∧ + ∀ t₁ ∈ T.verts, ∀ t₂ ∈ T.verts, ∀ k : ℕ, + (∃ f, T'.OnPathEdge t₁ t₂ f ∧ (V f ∩ V (T'.parent f)).ncard < k) ↔ + ∃ f, T.OnPathEdge t₁ t₂ f ∧ (V f ∩ V (T.parent f)).ncard < k := by + classical + obtain ⟨n, hn⟩ := T.exists_iterate_eq_root r₀ hr₀ + induction n generalizing T with + | zero => + rw [Function.iterate_zero_apply] at hn + exact ⟨T, rfl, hn.symm, fun _ _ _ _ _ _ ↦ Iff.rfl, fun _ _ _ _ _ ↦ Iff.rfl⟩ + | succ k ih => + by_cases h_already : T.parent^[k] r₀ = T.root + · exact ih T hr₀ h_already + · let c := T.parent^[k] r₀ + have hcv : c ∈ T.verts := T.parent_iterate_mem hr₀ k + have hce : c ∈ T.edges := T.mem_edges_iff.mpr ⟨hcv, h_already⟩ + have hcp : T.parent c = T.root := by + rw [← hn, Function.iterate_succ_apply'] + have hc : c ∈ T.children T.root := T.mem_children_iff.mpr ⟨hce, hcp⟩ + let T₁ := T.rerootChild hc + have h_iter : ∀ j ≤ k, T₁.parent^[j] r₀ = T.parent^[j] r₀ := by + intro j hj + induction j with + | zero => rfl + | succ m ihm => + have hm_le : m ≤ k := Nat.le_of_succ_le hj + rw [Function.iterate_succ_apply', Function.iterate_succ_apply', ihm hm_le] + set x := T.parent^[m] r₀ + have hxv : x ∈ T.verts := T.parent_iterate_mem hr₀ m + have hcx : T.Reaches c x := by + have hd : k - m + m = k := Nat.sub_add_cancel hm_le + refine ⟨hxv, k - m, ?_⟩ + change T.parent^[k - m] (T.parent^[m] r₀) = T.parent^[k] r₀ + rw [← Function.iterate_add_apply, hd] + have hxc_ne : x ≠ c := by + intro h_eq + have h_loop : T.parent^[k - m] x = x := by + change T.parent^[k - m] (T.parent^[m] r₀) = x + rw [← Function.iterate_add_apply, Nat.sub_add_cancel hm_le] + exact h_eq.symm + have h_pos : 0 < k - m := by omega + have hx_root := T.eq_root_of_iterate_eq_self hxv h_pos h_loop + exact h_already (h_eq.symm.trans hx_root) + have hxr_ne : x ≠ T.root := by + intro hxr + rw [hxr] at hcx + exact (T.mem_edges_iff.mp hce).2 (T.reaches_root_iff.mp hcx) + simp [T₁, rerootChild, hxr_ne, hxc_ne] + have hT₁_k : T₁.parent^[k] r₀ = T₁.root := by + rw [h_iter k (le_refl k)] + rfl + obtain ⟨T', hverts, hroot, honPath, honPathEdge⟩ := ih T₁ hr₀ hT₁_k + refine ⟨T', hverts, hroot, fun t₁ ht₁ t₂ ht₂ t₃ ht₃ ↦ ?_, fun t₁ ht₁ t₂ ht₂ m ↦ ?_⟩ + · rw [honPath t₁ ht₁ t₂ ht₂ t₃ ht₃, T.rerootChild_onPath_iff hc ht₁ ht₂ ht₃] + · rw [honPathEdge t₁ ht₁ t₂ ht₂ m, T.rerootChild_onPathEdge_exists_iff hc V ht₁ ht₂ m] + +end GraphMinor.GM04.RootedTree diff --git a/LeanPool/GraphMinor/GM04/Decomposition/TreeWidth.lean b/LeanPool/GraphMinor/GM04/Decomposition/TreeWidth.lean new file mode 100644 index 0000000000..f04fb5df86 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Decomposition/TreeWidth.lean @@ -0,0 +1,656 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Decomposition.SubtreeHelly + +/-! +# Tree-width and rotundity (Graph Minors IV, Section 5) + +This file proves the main theorems of Graph Minors IV, Section 5 (pages 238–240): +- `theorem_5_2`: Graph Minors IV, (5.2), deduced from Thomas's lemma (5.1) (`ThomasStatement`) via + claims (1)–(5) (`theorem_5_2_claim_1` through `theorem_5_2_claim_5`). +- `theorem_5_3`: Graph Minors IV, (5.3), deduced from (5.2) and (4.2). +-/ + +public section + +namespace GraphMinor.GM04 + +open Hypergraph + +universe u v + +variable {α β ι : Type*} + +/-- If `t₂` lies on the path of `T` from `t₁` to `t₁`, then `t₂ = t₁`. -/ +private theorem RootedTree.eq_of_onPath_self {T : RootedTree ι} {t₁ t₂ : ι} + (ht₁ : t₁ ∈ T.verts) (hon : T.OnPath t₁ t₁ t₂) : t₂ = t₁ := by + have h₁ : T.Reaches t₂ t₁ := hon.1.elim id id + have h₂ : T.Reaches t₁ t₂ := hon.2 t₁ (T.reaches_refl ht₁) (T.reaches_refl ht₁) + exact T.reaches_antisymm h₁ h₂ + +/-- Given vertex bags `V : ι → Set α` on a tree `T` that cover `G.vertexSet`, contain the ends of +every edge of `G`, satisfy the path-interpolation property, and contain `G.rootSet` at `T.root`, +there is a tree-decomposition `(T, τ)` of `G` with `(τ t).vertexSet = V t` for all `t ∈ T.verts`. -/ +theorem exists_isTreeDecomposition_of_ends_subset (G : RootedHypergraph α β) (T : RootedTree ι) + (V : ι → Set α) + (hV_sub : ∀ t ∈ T.verts, V t ⊆ G.vertexSet) + (hV_union : (⋃ t ∈ T.verts, V t) = G.vertexSet) + (hE : ∀ e ∈ G.edgeSet, ∃ t ∈ T.verts, G.ends e ⊆ V t) + (hpath : ∀ t₁ ∈ T.verts, ∀ t₂ ∈ T.verts, ∀ t₃ ∈ T.verts, + T.OnPath t₁ t₃ t₂ → V t₁ ∩ V t₃ ⊆ V t₂) + (hroot : G.rootSet ⊆ V T.root) : + ∃ τ : ι → RootedHypergraph α β, + IsTreeDecomposition G T τ ∧ ∀ t ∈ T.verts, (τ t).vertexSet = V t := by + classical + have hfin : ∀ t ∈ T.verts, (V t).Finite := + fun t ht ↦ G.vertexSet_finite.subset (hV_sub t ht) + have hex_owner : ∀ e : β, ∃ t : ι, e ∈ G.edgeSet → t ∈ T.verts ∧ G.ends e ⊆ V t := by + intro e + by_cases he : e ∈ G.edgeSet + · obtain ⟨t, ht, hends⟩ := hE e he + exact ⟨t, fun _ ↦ ⟨ht, hends⟩⟩ + · exact ⟨T.root, fun h ↦ False.elim (he h)⟩ + choose owner howner using hex_owner + let τ : ι → RootedHypergraph α β := fun t ↦ + if ht : t ∈ T.verts then + { vertexSet := V t + edgeSet := {e ∈ G.edgeSet | owner e = t} + Inc := fun e v ↦ e ∈ G.edgeSet ∧ owner e = t ∧ G.Inc e v + vertex_mem_of_inc := fun {e v} h ↦ by + rw [← h.2.1] + exact (howner e h.1).2 h.2.2 + edge_mem_of_inc := fun {e v} h ↦ ⟨h.1, h.2.1⟩ + vertexSet_finite := hfin t ht + edgeSet_finite := G.edgeSet_finite.subset (fun _ h ↦ h.1) + roots := if t = T.root then G.roots else + ((hfin t ht).subset (Set.inter_subset_left (t := V (T.parent t)))).toFinset.toList + roots_nodup := by + split_ifs + · exact G.roots_nodup + · exact Finset.nodup_toList _ + roots_subset := by + intro v hv + split_ifs at hv with htr + · subst htr + exact hroot hv + · rw [Finset.mem_toList, Set.Finite.mem_toFinset] at hv + exact hv.1 } + else G + have hτ_vert : ∀ t ∈ T.verts, (τ t).vertexSet = V t := by + intro t ht + simp [τ, ht] + have hτ_edge : ∀ t ∈ T.verts, (τ t).edgeSet = {e ∈ G.edgeSet | owner e = t} := by + intro t ht + simp [τ, ht] + have hτ_inc : ∀ t ∈ T.verts, ∀ e v, (τ t).Inc e v ↔ e ∈ G.edgeSet ∧ owner e = t ∧ G.Inc e v := by + intro t ht e v + simp [τ, ht] + have h_inter_edge : ∀ t₁ ∈ T.verts, ∀ t₂ ∈ T.verts, t₁ ≠ t₂ → + ((τ t₁).toHypergraph ∩ (τ t₂).toHypergraph).edgeSet = ∅ := by + intro t₁ ht₁ t₂ ht₂ hne + ext e + simp only [inter_edgeSet, Set.mem_inter_iff, hτ_edge t₁ ht₁, hτ_edge t₂ ht₂, + Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false] + rintro ⟨⟨_, rfl⟩, ⟨_, h⟩⟩ + exact hne h + refine ⟨τ, ?_, hτ_vert⟩ + refine + { le := fun t ht ↦ ?_ + biUnion_eq := ?_ + edgeSet_inter_eq := h_inter_edge + inter_le := fun t₁ ht₁ t₂ ht₂ t₃ ht₃ hon ↦ ?_ + roots_root := ?_ + rootSet_edge := fun f hf ↦ ?_ } + · refine ⟨hτ_vert t ht ▸ hV_sub t ht, ?_, ?_⟩ + · rw [hτ_edge t ht] + exact fun _ h ↦ h.1 + · intro e he + rw [hτ_edge t ht] at he + ext v + simp only [Hypergraph.ends, Set.mem_ofPred_eq, hτ_inc t ht, he.1, he.2, true_and] + · refine Hypergraph.ext ?_ ?_ ?_ + · ext v + rw [← hV_union] + simp only [biUnion_vertexSet, Set.mem_iUnion] + refine ⟨fun ⟨t, ht, hv⟩ ↦ ⟨t, ht, hτ_vert t ht ▸ hv⟩, + fun ⟨t, ht, hv⟩ ↦ ⟨t, ht, (hτ_vert t ht).symm ▸ hv⟩⟩ + · ext e + simp only [biUnion_edgeSet, Set.mem_iUnion] + refine ⟨?_, ?_⟩ + · rintro ⟨t, ht, he⟩ + rw [hτ_edge t ht] at he + exact he.1 + · intro he + refine ⟨owner e, (howner e he).1, ?_⟩ + rw [hτ_edge _ (howner e he).1] + exact ⟨he, rfl⟩ + · funext e v + apply propext + simp only [biUnion_inc] + refine ⟨?_, ?_⟩ + · rintro ⟨t, ht, hinc⟩ + rw [hτ_inc t ht] at hinc + exact hinc.2.2 + · intro hinc + have he : e ∈ G.edgeSet := G.edge_mem_of_inc hinc + refine ⟨owner e, (howner e he).1, ?_⟩ + rw [hτ_inc _ (howner e he).1] + exact ⟨he, rfl, hinc⟩ + · by_cases h₁₃ : t₁ = t₃ + · subst h₁₃ + have h₂₁ : t₂ = t₁ := T.eq_of_onPath_self ht₁ hon + subst h₂₁ + exact Hypergraph.inter_le_left le_rfl le_rfl + · refine ⟨?_, ?_, ?_⟩ + · simp only [inter_vertexSet, hτ_vert t₁ ht₁, hτ_vert t₂ ht₂, hτ_vert t₃ ht₃] + exact hpath t₁ ht₁ t₂ ht₂ t₃ ht₃ hon + · rw [h_inter_edge t₁ ht₁ t₃ ht₃ h₁₃] + exact Set.empty_subset _ + · intro e he + rw [h_inter_edge t₁ ht₁ t₃ ht₃ h₁₃] at he + exact False.elim (Set.notMem_empty e he) + · simp [τ, T.root_mem] + · obtain ⟨hfv, hfr⟩ := T.mem_edges_iff.mp hf + have hpv : T.parent f ∈ T.verts := T.parent_mem f hfv + ext v + simp only [RootedHypergraph.rootSet, Set.mem_ofPred_eq, inter_vertexSet, + hτ_vert f hfv, hτ_vert (T.parent f) hpv] + simp only [τ, hfv, ↓reduceDIte, hfr, ↓reduceIte, Finset.mem_toList, Set.Finite.mem_toFinset] + +/-- Two vertices `u, v` of `G` are adjacent in the auxiliary simple graph `K` of the proof of +Graph Minors IV, (5.2) when `u ≠ v` and either some edge of `G` is incident with both `u` and `v`, +or `u, v ∈ G.rootSet`. -/ +def completeRootAdj (G : RootedHypergraph α β) (u v : α) : Prop := + u ≠ v ∧ ((∃ e, G.Inc e u ∧ G.Inc e v) ∨ (u ∈ G.rootSet ∧ v ∈ G.rootSet)) + +private theorem completeRootAdj_symm {G : RootedHypergraph α β} {u v : α} + (h : completeRootAdj G u v) : completeRootAdj G v u := by + refine ⟨h.1.symm, ?_⟩ + rcases h.2 with ⟨e, hu, hv⟩ | ⟨hu, hv⟩ + · exact Or.inl ⟨e, hv, hu⟩ + · exact Or.inr ⟨hv, hu⟩ + +private theorem completeRootAdj_mem_left {G : RootedHypergraph α β} {u v : α} + (h : completeRootAdj G u v) : u ∈ G.vertexSet := by + rcases h.2 with ⟨e, hu, _⟩ | ⟨hu, _⟩ + · exact G.vertex_mem_of_inc hu + · exact G.roots_subset u hu + +private theorem completeRootAdj_mem_right {G : RootedHypergraph α β} {u v : α} + (h : completeRootAdj G u v) : v ∈ G.vertexSet := + completeRootAdj_mem_left (completeRootAdj_symm h) + +/-- The auxiliary simple graph `K` in the proof of Graph Minors IV, (5.2) (page 239), represented +as a hypergraph on `α` with edge type `Sym2 α`: its vertex set is `G.vertexSet`, and its edges are +the pairs `s(u, v)` with `completeRootAdj G u v`. -/ +def completeRootHypergraph (G : RootedHypergraph α β) : Hypergraph α (Sym2 α) where + vertexSet := G.vertexSet + edgeSet := {e | ∃ u v, completeRootAdj G u v ∧ e = s(u, v)} + Inc e x := (∃ u v, completeRootAdj G u v ∧ e = s(u, v)) ∧ x ∈ e + vertex_mem_of_inc := by + rintro e x ⟨⟨u, v, hadj, rfl⟩, hx⟩ + rcases Sym2.mem_iff.mp hx with rfl | rfl + · exact completeRootAdj_mem_left hadj + · exact completeRootAdj_mem_right hadj + edge_mem_of_inc := fun _ _ h ↦ h.1 + vertexSet_finite := G.vertexSet_finite + edgeSet_finite := by + refine ((G.vertexSet_finite.prod G.vertexSet_finite).image (fun p : α × α ↦ s(p.1, + p.2))).subset ?_ + rintro e ⟨u, v, hadj, rfl⟩ + exact ⟨(u, v), ⟨completeRootAdj_mem_left hadj, completeRootAdj_mem_right hadj⟩, rfl⟩ + +@[simp] +private theorem completeRootHypergraph_vertexSet (G : RootedHypergraph α β) : + (completeRootHypergraph G).vertexSet = G.vertexSet := rfl + +private theorem completeRootHypergraph_ends_of_mem {G : RootedHypergraph α β} {u v : α} + (hadj : completeRootAdj G u v) : + (completeRootHypergraph G).ends s(u, v) = {u, v} := by + ext x + simp only [Hypergraph.ends, completeRootHypergraph, Set.mem_ofPred_eq, Sym2.mem_iff, + Set.mem_insert_iff, Set.mem_singleton_iff] + exact ⟨fun h ↦ h.2, fun h ↦ ⟨⟨u, v, hadj, rfl⟩, h⟩⟩ + +/-- `completeRootHypergraph G` is a graph (every edge has 1 or 2 ends). -/ +theorem completeRootHypergraph_isGraph (G : RootedHypergraph α β) : + (completeRootHypergraph G).IsGraph := by + rintro e ⟨u, v, hadj, rfl⟩ + rw [completeRootHypergraph_ends_of_mem hadj] + refine ⟨⟨u, Set.mem_insert u {v}⟩, ?_⟩ + exact (Set.ncard_insert_le u {v}).trans (by simp) + +/-- Two vertices are adjacent in `(completeRootHypergraph G).skeleton` if and only if they satisfy +`completeRootAdj G`. -/ +@[simp] +theorem completeRootHypergraph_skeleton_adj (G : RootedHypergraph α β) (x y : α) : + (completeRootHypergraph G).skeleton.Adj x y ↔ completeRootAdj G x y := by + refine ⟨?_, ?_⟩ + · rintro ⟨hxy, e, ⟨⟨u, v, hadj, rfl⟩, hx⟩, ⟨_, hy⟩⟩ + rw [Sym2.mem_iff] at hx hy + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl + · exact False.elim (hxy rfl) + · exact hadj + · exact completeRootAdj_symm hadj + · exact False.elim (hxy rfl) + · intro hadj + refine ⟨hadj.1, s(x, y), ?_, ?_⟩ + · exact ⟨⟨x, y, hadj, rfl⟩, Sym2.mem_mk_left x y⟩ + · exact ⟨⟨x, y, hadj, rfl⟩, Sym2.mem_mk_right x y⟩ + +/-- Graph Minors IV, (5.2), Claim (1) (page 239): if `G` has tree-width `≤ w`, then `(K, 0)` has +tree-width `≤ w`. -/ +theorem theorem_5_2_claim_1 {G : RootedHypergraph α β} {w : ℕ} (h : TreeWidthLE G w) : + TreeWidthLE (completeRootHypergraph G).toRooted w := by + obtain ⟨T, τ, hdec, hwidth⟩ := h + have hE : ∀ e ∈ (completeRootHypergraph G).edgeSet, + ∃ t ∈ T.verts, (completeRootHypergraph G).ends e ⊆ (τ t).vertexSet := by + rintro e ⟨u, v, hadj, rfl⟩ + rw [completeRootHypergraph_ends_of_mem hadj] + rcases hadj.2 with ⟨e', hu, hv⟩ | ⟨hu, hv⟩ + · have he'_mem : e' ∈ G.edgeSet := G.edge_mem_of_inc hu + rw [← hdec.biUnion_eq, biUnion_edgeSet, Set.mem_iUnion] at he'_mem + obtain ⟨t, ht_Sub⟩ := he'_mem + rw [Set.mem_iUnion] at ht_Sub + obtain ⟨ht, he'_t⟩ := ht_Sub + have h_ends := (hdec.le t ht).ends_eq e' he'_t + refine ⟨t, ht, ?_⟩ + rintro x (rfl | rfl) + · have hx_inc : (τ t).Inc e' x := by + change x ∈ (τ t).ends e' + rw [← h_ends] + exact hu + exact (τ t).vertex_mem_of_inc hx_inc + · have hx_inc : (τ t).Inc e' x := by + change x ∈ (τ t).ends e' + rw [← h_ends] + exact hv + exact (τ t).vertex_mem_of_inc hx_inc + · refine ⟨T.root, T.root_mem, ?_⟩ + rintro x (rfl | rfl) + · exact (τ T.root).roots_subset x (hdec.roots_root.symm ▸ hu) + · exact (τ T.root).roots_subset x (hdec.roots_root.symm ▸ hv) + obtain ⟨τ', hdec', hV⟩ := exists_isTreeDecomposition_of_ends_subset + (completeRootHypergraph G).toRooted T (fun t ↦ (τ t).vertexSet) + (fun t ht ↦ (hdec.le t ht).vertexSet_subset) + (by + have h_eq := congrArg Hypergraph.vertexSet hdec.biUnion_eq + rw [biUnion_vertexSet] at h_eq + exact h_eq) + hE + (fun t₁ ht₁ t₂ ht₂ t₃ ht₃ hon ↦ (hdec.inter_le t₁ ht₁ t₂ ht₂ t₃ ht₃ hon).vertexSet_subset) + (by simp [RootedHypergraph.rootSet, Hypergraph.toRooted]) + refine ⟨T, τ', hdec', fun t ht ↦ ?_⟩ + rw [hV t ht] + exact hwidth t ht + +/-- Graph Minors IV, (5.2), Claim (2) (page 239): there is a tree-decomposition `(T, τ)` of `(K, 0)` +of width `≤ w` satisfying the Menger-like property of Thomas's lemma (5.1). -/ +theorem theorem_5_2_claim_2 (hT : ThomasStatement.{u, u}) {α : Type u} {β : Type v} + {G : RootedHypergraph α β} {w : ℕ} (h : TreeWidthLE G w) : + ∃ (T : RootedTree ℕ) (τ : ℕ → RootedHypergraph α (Sym2 α)), + IsTreeDecomposition (completeRootHypergraph G).toRooted T τ ∧ WidthLE T τ w ∧ + ∀ t₁ ∈ T.verts, ∀ t₂ ∈ T.verts, t₁ ≠ t₂ → ∀ k : ℕ, + HasDisjointPaths (completeRootHypergraph G).skeleton (τ t₁).vertexSet (τ t₂).vertexSet k ∨ + ∃ f, T.OnPathEdge t₁ t₂ f ∧ edgeOrder T τ f < k := + hT (completeRootHypergraph G) (completeRootHypergraph_isGraph G) w (theorem_5_2_claim_1 h) + +/-- Graph Minors IV, (5.2), Claim (3) (page 239): for every clique `X ⊆ G.vertexSet` of `K` and +every tree-decomposition `(T, τ)` of `(K, 0)`, there exists `t ∈ T.verts` with +`X ⊆ (τ t).vertexSet`. -/ +theorem theorem_5_2_claim_3 {G : RootedHypergraph α β} {T : RootedTree ι} + {τ : ι → RootedHypergraph α (Sym2 α)} + (hdec : IsTreeDecomposition (completeRootHypergraph G).toRooted T τ) + {X : Set α} (hX_sub : X ⊆ G.vertexSet) + (hclique : ∀ x ∈ X, ∀ y ∈ X, x ≠ y → (completeRootHypergraph G).skeleton.Adj x y) : + ∃ t ∈ T.verts, X ⊆ (τ t).vertexSet := by + classical + let I : Finset α := (G.vertexSet_finite.subset hX_sub).toFinset + let A : α → Set ι := fun x ↦ {t ∈ T.verts | x ∈ (τ t).vertexSet} + have hsub : ∀ x ∈ I, T.IsSubtreeSet (A x) := by + intro x _ + refine ⟨fun _ h ↦ h.1, fun t₁ ht₁ t₃ ht₃ t₂ ht₂ hon ↦ ⟨ht₂, ?_⟩⟩ + exact (hdec.inter_le t₁ ht₁.1 t₂ ht₂ t₃ ht₃.1 hon).vertexSet_subset ⟨ht₁.2, ht₃.2⟩ + have hinter : ∀ x ∈ I, ∀ y ∈ I, (A x ∩ A y).Nonempty := by + intro x hx y hy + rw [Set.Finite.mem_toFinset] at hx hy + by_cases hxy : x = y + · subst hxy + have hx_mem : x ∈ (completeRootHypergraph G).toRooted.vertexSet := hX_sub hx + have h_vert_eq := congrArg Hypergraph.vertexSet hdec.biUnion_eq + rw [← h_vert_eq, biUnion_vertexSet, Set.mem_iUnion] at hx_mem + obtain ⟨t, ht_sub⟩ := hx_mem + rw [Set.mem_iUnion] at ht_sub + obtain ⟨ht, hxt⟩ := ht_sub + exact ⟨t, ⟨ht, hxt⟩, ⟨ht, hxt⟩⟩ + · have hadj : completeRootAdj G x y := + (completeRootHypergraph_skeleton_adj G x y).mp (hclique x hx y hy hxy) + have he_mem : s(x, y) ∈ (completeRootHypergraph G).toRooted.edgeSet := ⟨x, y, hadj, rfl⟩ + have h_edge_eq := congrArg Hypergraph.edgeSet hdec.biUnion_eq + rw [← h_edge_eq, biUnion_edgeSet, Set.mem_iUnion] at he_mem + obtain ⟨t, ht_sub⟩ := he_mem + rw [Set.mem_iUnion] at ht_sub + obtain ⟨ht, het⟩ := ht_sub + have h_ends := (hdec.le t ht).ends_eq s(x, y) het + have hxy_ends : (τ t).ends s(x, y) = {x, y} := by + rw [← h_ends] + exact completeRootHypergraph_ends_of_mem hadj + have hx_t : x ∈ (τ t).vertexSet := by + apply (τ t).vertex_mem_of_inc (e := s(x, y)) + change x ∈ (τ t).ends s(x, y) + rw [hxy_ends] + exact Set.mem_insert x {y} + have hy_t : y ∈ (τ t).vertexSet := by + apply (τ t).vertex_mem_of_inc (e := s(x, y)) + change y ∈ (τ t).ends s(x, y) + rw [hxy_ends] + exact Set.mem_insert_of_mem x (Set.mem_singleton y) + exact ⟨t, ⟨ht, hx_t⟩, ⟨ht, hy_t⟩⟩ + obtain ⟨t, ht, hmem⟩ := T.helly_isSubtreeSet I A hsub hinter + refine ⟨t, ht, fun x hx ↦ ?_⟩ + have hxI : x ∈ I := (Set.Finite.mem_toFinset _).mpr hx + exact (hmem x hxI).2 + +/-- Graph Minors IV, (5.2), Claim (4) (page 239): we may choose `(T, τ)` satisfying Claim (2) so +that in addition `G.rootSet ⊆ (τ T.root).vertexSet`. -/ +theorem theorem_5_2_claim_4 (hT : ThomasStatement.{u, u}) {α : Type u} {β : Type v} + {G : RootedHypergraph α β} {w : ℕ} (h : TreeWidthLE G w) : + ∃ (T : RootedTree ℕ) (τ : ℕ → RootedHypergraph α (Sym2 α)), + IsTreeDecomposition (completeRootHypergraph G).toRooted T τ ∧ WidthLE T τ w ∧ + G.rootSet ⊆ (τ T.root).vertexSet ∧ + ∀ t₁ ∈ T.verts, ∀ t₂ ∈ T.verts, t₁ ≠ t₂ → ∀ k : ℕ, + HasDisjointPaths (completeRootHypergraph G).skeleton (τ t₁).vertexSet (τ t₂).vertexSet k ∨ + ∃ f, T.OnPathEdge t₁ t₂ f ∧ edgeOrder T τ f < k := by + obtain ⟨T₀, τ₀, hdec₀, hwidth₀, hthomas₀⟩ := theorem_5_2_claim_2 hT h + have hroot_sub : G.rootSet ⊆ G.vertexSet := fun x hx ↦ G.roots_subset x hx + have hroot_clique : ∀ x ∈ G.rootSet, ∀ y ∈ G.rootSet, x ≠ y → + (completeRootHypergraph G).skeleton.Adj x y := by + intro x hx y hy hxy + rw [completeRootHypergraph_skeleton_adj] + exact ⟨hxy, Or.inr ⟨hx, hy⟩⟩ + obtain ⟨r₀, hr₀, hr₀_sub⟩ := theorem_5_2_claim_3 hdec₀ hroot_sub hroot_clique + obtain ⟨T, hverts, hroot, honPath, honPathEdge⟩ := + T₀.exists_reroot (fun t ↦ (τ₀ t).vertexSet) hr₀ + have hE : ∀ e ∈ (completeRootHypergraph G).toRooted.edgeSet, + ∃ t ∈ T.verts, (completeRootHypergraph G).toRooted.ends e ⊆ (τ₀ t).vertexSet := by + intro e he + have h_edge_eq := congrArg Hypergraph.edgeSet hdec₀.biUnion_eq + rw [← h_edge_eq, biUnion_edgeSet, Set.mem_iUnion] at he + obtain ⟨t, ht_sub⟩ := he + rw [Set.mem_iUnion] at ht_sub + obtain ⟨ht, het⟩ := ht_sub + have h_ends := (hdec₀.le t ht).ends_eq e het + refine ⟨t, hverts.symm ▸ ht, fun x hx ↦ ?_⟩ + have hx_inc : (τ₀ t).Inc e x := by + change x ∈ (τ₀ t).ends e + rw [← h_ends] + exact hx + exact (τ₀ t).vertex_mem_of_inc hx_inc + obtain ⟨τ, hdec, hV⟩ := exists_isTreeDecomposition_of_ends_subset + (completeRootHypergraph G).toRooted T (fun t ↦ (τ₀ t).vertexSet) + (fun t ht ↦ (hdec₀.le t (hverts ▸ ht)).vertexSet_subset) + (by + rw [hverts] + have h_eq := congrArg Hypergraph.vertexSet hdec₀.biUnion_eq + rw [biUnion_vertexSet] at h_eq + exact h_eq) + hE + (fun t₁ ht₁ t₂ ht₂ t₃ ht₃ hon ↦ by + rw [hverts] at ht₁ ht₂ ht₃ + rw [honPath t₁ ht₁ t₂ ht₂ t₃ ht₃] at hon + exact (hdec₀.inter_le t₁ ht₁ t₂ ht₂ t₃ ht₃ hon).vertexSet_subset) + (by simp [RootedHypergraph.rootSet, Hypergraph.toRooted]) + refine ⟨T, τ, hdec, ?_, ?_, ?_⟩ + · intro t ht + rw [hV t ht] + exact hwidth₀ t (hverts ▸ ht) + · rw [hV T.root T.root_mem, hroot] + exact hr₀_sub + · intro t₁ ht₁ t₂ ht₂ hne k + have ht₁₀ : t₁ ∈ T₀.verts := hverts ▸ ht₁ + have ht₂₀ : t₂ ∈ T₀.verts := hverts ▸ ht₂ + rw [hV t₁ ht₁, hV t₂ ht₂] + rcases hthomas₀ t₁ ht₁₀ t₂ ht₂₀ hne k with hpaths | ⟨f, hfon, hford⟩ + · exact Or.inl hpaths + · right + have hf_edge : f ∈ T₀.edges := hfon.1 + rw [hdec₀.edgeOrder_eq_ncard_vertexSet_inter hf_edge] at hford + have hex : ∃ f, T.OnPathEdge t₁ t₂ f ∧ + ((τ₀ f).vertexSet ∩ (τ₀ (T.parent f)).vertexSet).ncard < k := + (honPathEdge t₁ ht₁₀ t₂ ht₂₀ k).mpr ⟨f, hfon, hford⟩ + obtain ⟨f', hf'on, hf'ord⟩ := hex + have hf'_edge : f' ∈ T.edges := hf'on.1 + have hf'_v : f' ∈ T.verts := T.edges_subset_verts hf'_edge + have hpf'_v : T.parent f' ∈ T.verts := T.parent_mem f' hf'_v + refine ⟨f', hf'on, ?_⟩ + rw [hdec.edgeOrder_eq_ncard_vertexSet_inter hf'_edge, hV f' hf'_v, hV (T.parent f') hpf'_v] + exact hf'ord + +/-- Graph Minors IV, (5.2), Claim (5) (page 239): for `(T, τ)` as in Claim (4), there is a +tree-decomposition `(T, τ')` of `G` such that `(τ' t).vertexSet = (τ t).vertexSet` for all +`t ∈ T.verts`. -/ +theorem theorem_5_2_claim_5 {G : RootedHypergraph α β} {T : RootedTree ι} + {τ : ι → RootedHypergraph α (Sym2 α)} + (hdec : IsTreeDecomposition (completeRootHypergraph G).toRooted T τ) + (hroot : G.rootSet ⊆ (τ T.root).vertexSet) : + ∃ τ' : ι → RootedHypergraph α β, + IsTreeDecomposition G T τ' ∧ ∀ t ∈ T.verts, (τ' t).vertexSet = (τ t).vertexSet := by + have hE : ∀ e ∈ G.edgeSet, ∃ t ∈ T.verts, G.ends e ⊆ (τ t).vertexSet := by + intro e he + have hends_sub : G.ends e ⊆ G.vertexSet := fun x hx ↦ G.vertex_mem_of_inc hx + have hends_clique : ∀ x ∈ G.ends e, ∀ y ∈ G.ends e, x ≠ y → + (completeRootHypergraph G).skeleton.Adj x y := by + intro x hx y hy hxy + rw [completeRootHypergraph_skeleton_adj] + exact ⟨hxy, Or.inl ⟨e, hx, hy⟩⟩ + exact theorem_5_2_claim_3 hdec hends_sub hends_clique + exact exists_isTreeDecomposition_of_ends_subset G T (fun t ↦ (τ t).vertexSet) + (fun t ht ↦ (hdec.le t ht).vertexSet_subset) + (by + have h_eq := congrArg Hypergraph.vertexSet hdec.biUnion_eq + rw [biUnion_vertexSet] at h_eq + exact h_eq) + hE + (fun t₁ ht₁ t₂ ht₂ t₃ ht₃ hon ↦ (hdec.inter_le t₁ ht₁ t₂ ht₂ t₃ ht₃ hon).vertexSet_subset) + hroot + +/-- If `f₂` reaches `f₁` in `T`, then every edge `g` on the path of `T` between `f₁` and +`T.parent f₂` lies in `T.pathEdges f₂ f₁ ∩ T.edges`. -/ +private theorem RootedTree.mem_pathEdges_of_onPathEdge_parent {T : RootedTree ι} {f₁ f₂ g : ι} + (hf₁ : f₁ ∈ T.edges) (hf₂ : f₂ ∈ T.edges) (hreach : T.Reaches f₂ f₁) + (hon : T.OnPathEdge f₁ (T.parent f₂) g) : + g ∈ T.pathEdges f₂ f₁ ∩ T.edges := by + have hf₁v : f₁ ∈ T.verts := T.edges_subset_verts hf₁ + have hf₂v : f₂ ∈ T.verts := T.edges_subset_verts hf₂ + have hp₂v : T.parent f₂ ∈ T.verts := T.parent_mem f₂ hf₂v + have hp₂_f₂ : T.Reaches (T.parent f₂) f₂ := T.reaches_parent hf₂v + have hp₂_f₁ : T.Reaches (T.parent f₂) f₁ := T.reaches_trans hp₂_f₂ hreach + rw [T.onPathEdge_iff hf₁v hp₂v] at hon + obtain ⟨hg_edge, hcases⟩ := hon + rcases hcases with ⟨h₁, h₂⟩ | ⟨h₂, h₁⟩ + · have hg_f₁ : T.Reaches g f₁ := T.mem_subtreeAt.mp h₁ + have hnot_g_p₂ : ¬ T.Reaches g (T.parent f₂) := (T.mem_rootSide.mp h₂).2 + have hf₂_g : T.Reaches f₂ g := by + rcases T.reaches_total_of_reaches hreach hg_f₁ with h | h + · exact h + · by_cases hgf₂ : g = f₂ + · subst hgf₂ + exact T.reaches_refl hf₂v + · exact False.elim (hnot_g_p₂ (T.reaches_parent_of_reaches_of_ne h hgf₂)) + exact ⟨⟨hf₂_g, hg_f₁⟩, hg_edge⟩ + · have hg_p₂ : T.Reaches g (T.parent f₂) := T.mem_subtreeAt.mp h₂ + have hnot_g_f₁ : ¬ T.Reaches g f₁ := (T.mem_rootSide.mp h₁).2 + exact False.elim (hnot_g_f₁ (T.reaches_trans hg_p₂ hp₂_f₁)) + +/-- If every edge of a simple graph `K` has both ends in `A` or both ends in `B`, then every walk +of `K` from a vertex in `A` to a vertex in `B` visits a vertex in `A ∩ B`. -/ +private theorem exists_mem_inter_of_walk {K : SimpleGraph α} {A B : Set α} + (hedges : ∀ x y, K.Adj x y → (x ∈ A ∧ y ∈ A) ∨ (x ∈ B ∧ y ∈ B)) + {u v : α} (w : K.Walk u v) (hu : u ∈ A) (hv : v ∈ B) : + ∃ z ∈ w.support, z ∈ A ∩ B := by + induction w with + | nil => + exact ⟨_, SimpleGraph.Walk.start_mem_support _, ⟨hu, hv⟩⟩ + | @cons u u' v hadj w' ih => + by_cases huB : u ∈ B + · exact ⟨u, SimpleGraph.Walk.start_mem_support _, ⟨hu, huB⟩⟩ + · have hu'A : u' ∈ A := by + rcases hedges u u' hadj with ⟨_, h⟩ | ⟨h, _⟩ + · exact h + · exact False.elim (huB h) + obtain ⟨z, hz_sup, hz_AB⟩ := ih hu'A hv + refine ⟨z, ?_, hz_AB⟩ + rw [SimpleGraph.Walk.support_cons] + exact List.mem_cons_of_mem u hz_sup + +/-- Graph Minors IV, (5.2) (page 239): "Let $G$ be a rooted hypergraph of tree-width $\le w$. Then +there is a rotund +tree-decomposition of $G$ of width $\le w$." -/ +theorem theorem_5_2_proof (hT : ThomasStatement.{u, u}) {α : Type u} {β : Type v} + (G : RootedHypergraph α β) (w : ℕ) (h : TreeWidthLE G w) : + ∃ (T : RootedTree ℕ) (τ : ℕ → RootedHypergraph α β), + IsTreeDecomposition G T τ ∧ WidthLE T τ w ∧ IsRotund T τ T.edges := by + obtain ⟨T, τ, hdec, hwidth, hroot, hthomas⟩ := theorem_5_2_claim_4 hT h + obtain ⟨τ', hdec', hV⟩ := theorem_5_2_claim_5 hdec hroot + have hwidth' : WidthLE T τ' w := by + intro t ht + rw [hV t ht] + exact hwidth t ht + have hord_eq : ∀ f ∈ T.edges, edgeOrder T τ' f = edgeOrder T τ f := by + intro f hf + have hfv : f ∈ T.verts := T.edges_subset_verts hf + have hpv : T.parent f ∈ T.verts := T.parent_mem f hfv + rw [hdec'.edgeOrder_eq_ncard_vertexSet_inter hf, hdec.edgeOrder_eq_ncard_vertexSet_inter hf, + hV f hfv, hV (T.parent f) hpv] + refine ⟨T, τ', hdec', hwidth', ?_⟩ + intro f₁ hf₁ f₂ hf₂ hreach heq hmin + rintro ⟨H₁, H₂, hsep, hH₁, hH₂, hord⟩ + rw [hdec'.cross_verts_eq] at hsep + set k := edgeOrder T τ' f₁ + have hf₁v : f₁ ∈ T.verts := T.edges_subset_verts hf₁ + have hf₂v : f₂ ∈ T.verts := T.edges_subset_verts hf₂ + have hp₂v : T.parent f₂ ∈ T.verts := T.parent_mem f₂ hf₂v + have hne : f₁ ≠ T.parent f₂ := by + intro h_eq + rw [h_eq] at hreach + exact T.not_reaches_parent hf₂ hreach + have hnot_lt : ¬ ∃ f, T.OnPathEdge f₁ (T.parent f₂) f ∧ edgeOrder T τ f < k := by + rintro ⟨g, hgon, hg_lt⟩ + have hg_mem : g ∈ T.pathEdges f₂ f₁ ∩ T.edges := + T.mem_pathEdges_of_onPathEdge_parent hf₁ hf₂ hreach hgon + rw [← hord_eq g hg_mem.2] at hg_lt + exact Nat.lt_irrefl _ (hg_lt.trans_le (hmin g hg_mem)) + have hpaths : HasDisjointPaths (completeRootHypergraph G).skeleton + (τ f₁).vertexSet (τ (T.parent f₂)).vertexSet k := by + rcases hthomas f₁ hf₁v (T.parent f₂) hp₂v hne k with hp | hex + · exact hp + · exact False.elim (hnot_lt hex) + obtain ⟨P, hdisj⟩ := hpaths + have hV₁_sub : (τ f₁).vertexSet ⊆ H₁.vertexSet := by + rw [← hV f₁ hf₁v] + refine Set.Subset.trans ?_ hH₁.vertexSet_subset + rw [cross_toHypergraph_of_mem τ' (T.self_mem_subtreeAt hf₁v), biUnion_vertexSet] + exact fun _ hx ↦ Set.mem_biUnion (T.self_mem_subtreeAt hf₁v) hx + have hV₂_sub : (τ (T.parent f₂)).vertexSet ⊆ H₂.vertexSet := by + rw [← hV (T.parent f₂) hp₂v] + refine Set.Subset.trans ?_ hH₂.vertexSet_subset + rw [cross_toHypergraph_of_mem τ' (T.root_mem_rootSide hf₂), biUnion_vertexSet] + exact fun _ hx ↦ Set.mem_biUnion (T.parent_mem_rootSide hf₂) hx + have hroot_H₂ : G.rootSet ⊆ H₂.vertexSet := by + refine Set.Subset.trans (hV T.root T.root_mem ▸ hroot) ?_ + refine Set.Subset.trans ?_ hH₂.vertexSet_subset + rw [cross_toHypergraph_of_mem τ' (T.root_mem_rootSide hf₂), biUnion_vertexSet] + exact fun _ hx ↦ Set.mem_biUnion (T.root_mem_rootSide hf₂) hx + have hedges : ∀ x y, (completeRootHypergraph G).skeleton.Adj x y → + (x ∈ H₁.vertexSet ∧ y ∈ H₁.vertexSet) ∨ (x ∈ H₂.vertexSet ∧ y ∈ H₂.vertexSet) := by + intro x y hadj + rw [completeRootHypergraph_skeleton_adj] at hadj + rcases hadj.2 with ⟨e, hx, hy⟩ | ⟨hx, hy⟩ + · have he : e ∈ G.edgeSet := G.edge_mem_of_inc hx + rw [← hsep.union_eq, union_edgeSet] at he + rcases he with he₁ | he₂ + · left + have hends := hsep.left_le.ends_eq e he₁ + have hx₁ : H₁.Inc e x := by change x ∈ H₁.ends e; rw [← hends]; exact hx + have hy₁ : H₁.Inc e y := by change y ∈ H₁.ends e; rw [← hends]; exact hy + exact ⟨H₁.vertex_mem_of_inc hx₁, H₁.vertex_mem_of_inc hy₁⟩ + · right + have hends := hsep.right_le.ends_eq e he₂ + have hx₂ : H₂.Inc e x := by change x ∈ H₂.ends e; rw [← hends]; exact hx + have hy₂ : H₂.Inc e y := by change y ∈ H₂.ends e; rw [← hends]; exact hy + exact ⟨H₂.vertex_mem_of_inc hx₂, H₂.vertex_mem_of_inc hy₂⟩ + · exact Or.inr ⟨hroot_H₂ hx, hroot_H₂ hy⟩ + have hex_z : ∀ i : Fin k, ∃ z ∈ (P i).walk.support, z ∈ (H₁ ∩ H₂).vertexSet := by + intro i + exact exists_mem_inter_of_walk hedges (P i).walk + (hV₁_sub (P i).first_mem) (hV₂_sub (P i).last_mem) + choose z hz_sup hz_mem using hex_z + have hz_inj : Function.Injective z := by + intro i j hij + by_contra hne_ij + have hdisj_ij := hdisj hne_ij + exact Set.disjoint_left.mp hdisj_ij (hz_sup i) (hij ▸ hz_sup j) + have hcard : k ≤ separationOrder H₁ H₂ := by + have h_range_sub : Set.range z ⊆ (H₁ ∩ H₂).vertexSet := by + rintro _ ⟨i, rfl⟩ + exact hz_mem i + have h_ncard_le := Set.ncard_le_ncard h_range_sub (H₁ ∩ H₂).vertexSet_finite + rwa [Set.ncard_range_of_injective hz_inj, Nat.card_eq_fintype_card, Fintype.card_fin] at + h_ncard_le + exact Nat.not_lt.mpr hcard hord + +/-- For any `R` satisfying Axiom 1, the class `starClass ι R n` is symmetric. -/ +theorem isSymmetric_starClass {R : Set (RootedHypergraph α β)} (hA1 : Axiom1 R) (n : ℕ) : + IsSymmetric (starClass ι R n) := by + rintro ⟨S, σ⟩ ⟨hstar, hR, hcard⟩ σ' hstar' hσ' + refine ⟨hstar', ?_, ?_⟩ + · have h_eq : (cross σ' S.verts S.root).toHypergraph = (cross σ S.verts S.root).toHypergraph := + cross_toHypergraph_congr S.root_mem S.root_mem (fun s hs ↦ (hσ' s hs).1) + exact hA1 _ hR _ (h_eq ▸ le_rfl) + · have h_vert : (σ' S.root).vertexSet = (σ S.root).vertexSet := + congrArg Hypergraph.vertexSet (hσ' S.root S.root_mem).1 + rwa [h_vert] + +/-- Graph Minors IV, (5.3) (page 240): assuming Axioms 1–4, every countable sequence of elements of +`R` of tree-width `≤ n` has `i < i'` with `G i` simulated in `G i'`. -/ +theorem theorem_5_3_proof (h22 : TreeLemma22Statement.{0}) (hT : ThomasStatement.{u, u}) : + Theorem53Statement.{u, v} := by + intro α β R sim hA1 hA2 hA3 hA4 n G hR htw + have hex : ∀ i, ∃ (T : RootedTree ℕ) (τ : ℕ → RootedHypergraph α β), + IsTreeDecomposition (G i) T τ ∧ WidthLE T τ n ∧ IsRotund T τ T.edges := + fun i ↦ theorem_5_2_proof hT (G i) n (htw i) + choose T τ hdec hwidth hrot using hex + have hcross : ∀ i, cross (τ i) (T i).verts (T i).root = G i := + fun i ↦ (hdec i).cross_verts_eq + have hdec' : ∀ i, IsTreeDecomposition (cross (τ i) (T i).verts (T i).root) (T i) (τ i) := + fun i ↦ (hcross i).symm ▸ hdec i + have hbr : ∀ i, ∀ s ∈ (T i).verts, + ((T i).starAt s, branching (T i) (τ i) s) ∈ starClass ℕ R (n + 1) := by + intro i s hs + refine ⟨(hdec i).isStarDecomposition_branching hs, ?_, ?_⟩ + · rw [cross_branching_eq (T i) (τ i) hs] + have hle : (cross (τ i) ((T i).subtreeAt s) s).toHypergraph ≤ (G i).toHypergraph := by + rw [cross_toHypergraph_of_mem (τ i) ((T i).self_mem_subtreeAt hs)] + exact biUnion_le (fun t ht ↦ (hdec i).le t ((T i).subtreeAt_subset_verts s ht)) + exact hA1 (G i) (hR i) _ hle + · dsimp only + have hroot_eq : ((T i).starAt s).root = s := rfl + rw [hroot_eq] + have hbr_root : branching (T i) (τ i) s s = τ i s := by simp [branching] + rw [hbr_root] + exact hwidth i s hs + obtain ⟨i, i', hii', hsim⟩ := theorem_4_2_proof h22 hA1 hA2 hA3 + (starClass ℕ R (n + 1)) (hA4 (n + 1)) (isSymmetric_starClass hA1 (n + 1)) + T τ hdec' hrot hbr + rw [hcross i, hcross i'] at hsim + exact ⟨i, i', hii', hsim⟩ + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/Higman.lean b/LeanPool/GraphMinor/GM04/Higman.lean new file mode 100644 index 0000000000..76da6ac689 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Higman.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Order.WellQuasiOrder +public import Mathlib.Data.Finset.Defs +import Mathlib.Data.List.Forall2 + +/-! +# The theorem of Higman quoted as Graph Minors IV, (8.3) + +Graph Minors IV, (8.3) (page 249), quoting G. Higman, *Ordering by divisibility in abstract +algebras*, Proc. London Math. Soc. (3) 2 (1952) 326–336: "(8.3) *Let $\Omega$ be a well-quasi +-order, and let $X_i$ ($i = 1, 2, \dots$) be a countable sequence of finite subsets of $E(\Omega)$. +Then there exists an infinite subset $I \subseteq \{1, 2, \dots\}$ with the property that for all +$i$, $i' \in I$ with $i < i'$ there is an injection $\alpha \colon X_i \to X_{i'}$ such that $x \le +\alpha(x)$ for all $x \in X_i$.*" + +In the proof of (8.4) the paper applies (8.3) to sets of edges, each labelled by an element of a +well-quasi-order, where different edges may have the same label. `Higman83Statement` is therefore +stated for finite sets `Xᵢ` of a type `κ` with labels `ℓ i : κ → Ω`. The statement as printed is +the case `κ = Ω`, `ℓ i = id`. +-/ + +@[expose] public section + +namespace GraphMinor.GM04 + +/-- Labelled finite-set generalization of Graph Minors IV, (8.3). For finite sets `X i` with +possibly repeated labels `ℓ i` in a well-quasi-order `Ω`, there is an infinite set `I` of indices +such that each `i < i'` in `I` admits an injection `g : X i → X i'` satisfying `ℓ i x ≤ ℓ i' (g x)` +for all `x ∈ X i`. -/ +def Higman83Statement : Prop := + ∀ {κ Ω : Type*} [Preorder Ω], WellQuasiOrderedLE Ω → ∀ (X : ℕ → Finset κ) (ℓ : ℕ → κ → Ω), + ∃ I : Set ℕ, I.Infinite ∧ ∀ i ∈ I, ∀ i' ∈ I, i < i' → + ∃ g : κ → κ, Set.InjOn g (X i) ∧ Set.MapsTo g (X i) (X i') ∧ + ∀ x ∈ X i, ℓ i x ≤ ℓ i' (g x) + +/-- A sublist relation between duplicate-free lists gives an injection between them. -/ +theorem exists_inj_of_sublistForall₂ {κ Ω : Type*} {r : Ω → Ω → Prop} {l₁ l₂ : List κ} + {ℓ₁ ℓ₂ : κ → Ω} (hnd₁ : l₁.Nodup) (hnd₂ : l₂.Nodup) + (h : List.SublistForall₂ (fun x y ↦ r (ℓ₁ x) (ℓ₂ y)) l₁ l₂) : + ∃ g : κ → κ, (∀ x ∈ l₁, ∀ y ∈ l₁, g x = g y → x = y) ∧ + (∀ x ∈ l₁, g x ∈ l₂) ∧ (∀ x ∈ l₁, r (ℓ₁ x) (ℓ₂ (g x))) := by + classical + induction h with + | nil => exact ⟨id, by simp, by simp, by simp⟩ + | @cons a₁ a₂ t₁ t₂ hr hsub ih => + obtain ⟨ha₁, hnd₁'⟩ := List.nodup_cons.1 hnd₁ + obtain ⟨ha₂, hnd₂'⟩ := List.nodup_cons.1 hnd₂ + obtain ⟨g, hinj, hmem, hrel⟩ := ih hnd₁' hnd₂' + have hg : ∀ x ∈ t₁, (if x = a₁ then a₂ else g x) = g x := fun x hx ↦ + ite_eq_right fun (h : x = a₁) ↦ ha₁ (h ▸ hx) + refine ⟨fun x ↦ if x = a₁ then a₂ else g x, ?_, ?_, ?_⟩ + · intro x hx y hy hxy + simp only [List.mem_cons] at hx hy + rcases hx with rfl | hx <;> rcases hy with rfl | hy + · rfl + · simp only [↓reduceIte, hg y hy] at hxy + exact absurd (hxy ▸ hmem y hy) ha₂ + · simp only [↓reduceIte, hg x hx] at hxy + exact absurd (hxy ▸ hmem x hx) ha₂ + · simp only [hg x hx, hg y hy] at hxy + exact hinj x hx y hy hxy + · intro x hx + simp only [List.mem_cons] at hx ⊢ + rcases hx with rfl | hx + · simp + · simp only [hg x hx] + exact Or.inr (hmem x hx) + · intro x hx + simp only [List.mem_cons] at hx + rcases hx with rfl | hx + · simpa using hr + · simp only [hg x hx] + exact hrel x hx + | @cons_right a l₁ t₂ hsub ih => + obtain ⟨_, hnd₂'⟩ := List.nodup_cons.1 hnd₂ + obtain ⟨g, hinj, hmem, hrel⟩ := ih hnd₁ hnd₂' + exact ⟨g, hinj, fun x hx ↦ List.mem_cons_of_mem a (hmem x hx), hrel⟩ + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/HigmanProof.lean b/LeanPool/GraphMinor/GM04/HigmanProof.lean new file mode 100644 index 0000000000..7b98f403d3 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/HigmanProof.lean @@ -0,0 +1,68 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Higman +import Mathlib.Data.Finset.Dedup +import Mathlib.Data.List.Forall2 +import Mathlib.Order.WellFoundedSet + +/-! +# Higman's theorem for labelled finite sets + +This file proves `GraphMinor.GM04.Higman83Statement`, the labelled finite-set generalization of +Higman's theorem quoted in Graph Minors IV, (8.3) (page 249). The paper states the result for finite +subsets of the well-quasi-order `Ω`. Here different elements of a finite set may carry the same +label in `Ω`, as needed for the edge sets in the proof of (8.4). + +We represent each finite set `X i` as a duplicate-free list `(X i).toList`, map it by `ℓ i` to a +list in `Ω`, apply Mathlib's Higman lemma +(`Set.PartiallyWellOrderedOn.partiallyWellOrderedOn_sublistForall₂`) and extract a monotone +subsequence via `Set.PartiallyWellOrderedOn.exists_monotone_subseq`. A `List.SublistForall₂` +witness between two duplicate-free lists then yields the required injection. +-/ + +namespace GraphMinor.GM04 + +open Set + +public section + +/-- Labelled finite-set generalization of Graph Minors IV, (8.3) (page 249). +An infinite subsequence of finite sets with labels in a well-quasi-order admits injections from +each earlier set into each later set that weakly increase labels. Labels may repeat within a set. -/ +theorem higman_8_3 : Higman83Statement := by + classical + intro κ Ω _ hwqo X ℓ + have hU : (univ : Set Ω).PartiallyWellOrderedOn (· ≤ ·) := + partiallyWellOrderedOn_of_wellQuasiOrdered hwqo.wqo univ + have hL := hU.partiallyWellOrderedOn_sublistForall₂ + have : IsPreorder (List Ω) (List.SublistForall₂ (· ≤ ·)) := ⟨⟩ + let f : ℕ → List Ω := fun i ↦ (X i).toList.map (ℓ i) + have hf : ∀ i, f i ∈ {l : List Ω | ∀ x ∈ l, x ∈ (univ : Set Ω)} := fun _ _ _ ↦ mem_univ _ + obtain ⟨φ, hφ⟩ := hL.exists_monotone_subseq hf + refine ⟨range φ, infinite_range_of_injective φ.injective, ?_⟩ + rintro _ ⟨m, rfl⟩ _ ⟨n, rfl⟩ hlt + have hmn : m < n := φ.lt_iff_lt.1 hlt + have hsub := hφ m n hmn.le + dsimp only [f] at hsub + rw [List.sublistForall₂_map_left_iff, List.sublistForall₂_map_right_iff] at hsub + obtain ⟨g, hinj, hmem, hrel⟩ := + exists_inj_of_sublistForall₂ (X (φ m)).nodup_toList (X (φ n)).nodup_toList hsub + refine ⟨g, ?_, ?_, ?_⟩ + · intro x hx y hy hxy + exact hinj x (Finset.mem_toList.2 hx) y (Finset.mem_toList.2 hy) hxy + · intro x hx + exact Finset.mem_toList.1 (hmem x (Finset.mem_toList.2 hx)) + · intro x hx + exact hrel x (Finset.mem_toList.2 hx) + +end + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/Main.lean b/LeanPool/GraphMinor/GM04/Main.lean new file mode 100644 index 0000000000..70a26cedf6 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Main.lean @@ -0,0 +1,51 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Patchwork.Main +public import LeanPool.GraphMinor.GM04.Decomposition.TreeWidth +public import LeanPool.GraphMinor.GM04.TreeLemma.Lemma22 +public import LeanPool.GraphMinor.GM04.HigmanProof +public import LeanPool.GraphMinor.Thomas.Translate +public import LeanPool.GraphMinor.Menger.Basic +public import LeanPool.GraphMinor.Minor.Basic + +/-! +# Graph Minors IV, (1.5), with every hypothesis proved + +`GM04.theorem_1_5_proved` derives (1.5) from (5.3), Menger's theorem, the labelled finite-set +generalization of Higman's theorem (8.3) and the description of minors by models. This file +supplies each of them: +- (5.3) is `theorem_5_3`, which uses the tree lemma (2.2) (`lemma_2_2`) and Thomas's lemma (5.1) + (`thomas_5_1`, which uses Menger's theorem); +- Menger's theorem is `menger`; +- `higman_8_3` is the generalization of (8.3) allowing repeated labels; +- the statement about models of minors is `isIsoMinor_of_isMinorModel`. +-/ + +@[expose] public section + +namespace GraphMinor.GM04 + +open Graph + +universe u v + +/-- Graph Minors IV, (1.5) (page 229): "For any integer $k$ the class of all graphs with tree-width +$\le k$ is well-quasi-ordered by +minors." In the form of `theorem_1_5_of_cited`: every sequence +of finite graphs of tree-width `≤ k` has `i < j` with `G i` isomorphic to a minor of `G j`. -/ +theorem theorem_1_5_proved {α : Type u} {β : Type v} (k : ℕ) (G : ℕ → Graph α β) + (hV : ∀ n, V(G n).Finite) (hE : ∀ n, E(G n).Finite) + (htw : ∀ n, TreeWidthLE (Hypergraph.ofGraph (G n) (hV n) (hE n)).toRooted k) : + ∃ i j, i < j ∧ IsIsoMinor (G i) (G j) := + theorem_1_5_of_cited.{u, v, 0, 0} (theorem_5_3_proof lemma_2_2 (thomas_5_1)) menger higman_8_3 + isIsoMinor_of_isMinorModel k G hV hE htw + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/NumberedDecomposition.lean b/LeanPool/GraphMinor/GM04/NumberedDecomposition.lean new file mode 100644 index 0000000000..d85fafbc95 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/NumberedDecomposition.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Decomposition.Contraction +public import LeanPool.GraphMinor.GM04.Main + +/-! +# Numbered decomposition results of Graph Minors IV + +The edge separation and contraction results already follow from the decomposition API. +The tree lemma and Thomas's theorem supply the inputs to the linked and rotund results. +-/ + +public section + +namespace GraphMinor.GM04 + +open _root_.GraphMinor.Hypergraph + +universe u v w + +/-- Graph Minors IV, (3.1), page 234: an edge of a tree-decomposition gives a separation. -/ +theorem theorem_3_1_proof {α : Type u} {β : Type v} {ι : Type w} + {G : RootedHypergraph α β} {T : RootedTree ι} {τ : ι → RootedHypergraph α β} + (h : IsTreeDecomposition G T τ) {f : ι} (hf : f ∈ T.edges) : + G.IsSeparation (cross τ (T.subtreeAt f) f) (cross τ (T.rootSide f) T.root) := + h.isSeparation_edge hf + +/-- Graph Minors IV, (3.2), page 234: contracting the tree and taking the union of each +component's bags preserves a tree-decomposition. -/ +theorem theorem_3_2_proof {α : Type u} {β : Type v} {ι : Type w} + {G : RootedHypergraph α β} {T : RootedTree ι} {τ : ι → RootedHypergraph α β} + (h : IsTreeDecomposition G T τ) {F : Set ι} (hF : F ⊆ T.edges) + {S : RootedTree ι} (hS : T.IsContraction F S) (σ : ι → RootedHypergraph α β) + (hσ : ∀ s ∈ S.verts, σ s = cross τ (T.componentAt F s) s) : + IsTreeDecomposition G S σ := + h.contraction hF hS σ hσ + +/-- Graph Minors IV, (3.3), page 235, using the proved tree lemma (2.2). -/ +theorem theorem_3_3_proved {α : Type u} {β : Type v} {ι : Type w} + {R : Set (RootedHypergraph α β)} + {sim : RootedHypergraph α β → RootedHypergraph α β → Prop} + (hA1 : Axiom1 R) (hA2 : Axiom2 R sim) + (𝒮 : Set (RootedTree ι × (ι → RootedHypergraph α β))) (h𝒮 : IsGood R sim 𝒮) + (T : ℕ → RootedTree ι) (τ : ℕ → ι → RootedHypergraph α β) + (hdec : ∀ i, IsTreeDecomposition (cross (τ i) (T i).verts (T i).root) (T i) (τ i)) + (hlinked : ∀ i, IsLinked sim (T i) (τ i) (T i).edges) + (hbr : ∀ i, ∀ s ∈ (T i).verts, ((T i).starAt s, branching (T i) (τ i) s) ∈ 𝒮) : + ∃ i i', i < i' ∧ + sim (cross (τ i) (T i).verts (T i).root) (cross (τ i') (T i').verts (T i').root) := + theorem_3_3_proof lemma_2_2 hA1 hA2 𝒮 h𝒮 T τ hdec hlinked hbr + +/-- Graph Minors IV, (4.2), page 238, using the proved tree lemma (2.2). -/ +theorem theorem_4_2_proved {α : Type u} {β : Type v} {ι : Type w} + {R : Set (RootedHypergraph α β)} + {sim : RootedHypergraph α β → RootedHypergraph α β → Prop} + (hA1 : Axiom1 R) (hA2 : Axiom2 R sim) (hA3 : Axiom3 R sim) + (𝒮 : Set (RootedTree ι × (ι → RootedHypergraph α β))) (h𝒮 : IsGood R sim 𝒮) + (hsym : IsSymmetric 𝒮) (T : ℕ → RootedTree ι) (τ : ℕ → ι → RootedHypergraph α β) + (hdec : ∀ i, IsTreeDecomposition (cross (τ i) (T i).verts (T i).root) (T i) (τ i)) + (hrot : ∀ i, IsRotund (T i) (τ i) (T i).edges) + (hbr : ∀ i, ∀ s ∈ (T i).verts, ((T i).starAt s, branching (T i) (τ i) s) ∈ 𝒮) : + ∃ i i', i < i' ∧ + sim (cross (τ i) (T i).verts (T i).root) (cross (τ i') (T i').verts (T i').root) := + theorem_4_2_proof lemma_2_2 hA1 hA2 hA3 𝒮 h𝒮 hsym T τ hdec hrot hbr + +/-- Graph Minors IV, (5.1), page 238: Thomas's path-or-small-separator decomposition. -/ +theorem theorem_5_1_proof : ThomasStatement.{u, v} := thomas_5_1 + +/-- Graph Minors IV, (5.2), page 239: a rooted hypergraph has a rotund decomposition +of the same width. -/ +theorem theorem_5_2_proved {α : Type u} {β : Type v} + (G : RootedHypergraph α β) (w : ℕ) (h : TreeWidthLE G w) : + ∃ (T : RootedTree ℕ) (τ : ℕ → RootedHypergraph α β), + IsTreeDecomposition G T τ ∧ WidthLE T τ w ∧ IsRotund T τ T.edges := + theorem_5_2_proof theorem_5_1_proof G w h + +/-- Graph Minors IV, (5.3), page 240: Axioms 1–4 imply well-quasi-ordering +on each class of bounded tree-width. -/ +theorem theorem_5_3_proved : Theorem53Statement.{u, v} := + theorem_5_3_proof lemma_2_2 theorem_5_1_proof + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/Patchwork/Defs.lean b/LeanPool/GraphMinor/GM04/Patchwork/Defs.lean new file mode 100644 index 0000000000..354d55777a --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Patchwork/Defs.lean @@ -0,0 +1,730 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Hypergraph.Basic +public import Mathlib.Combinatorics.SimpleGraph.Connectivity.Subgraph +public import Mathlib.Data.List.NodupEquivFin +public import Mathlib.Order.WellQuasiOrder + +/-! +# Patchworks and their containment relation (Graph Minors IV, Sections 6–8) + +This file formalizes the definitions of Graph Minors IV, Sections 6, 7 and 8 (pages 240–248): + +* `completeSubgraph V` (`K_V`) and `emptySubgraph V` (`N_V`), represented as subgraphs of + `⊤ : SimpleGraph α`. +* `componentVerts`, `component`, `IsComponent`: connected components of a subgraph `K` of + `⊤ : SimpleGraph α`, defined via `SimpleGraph.Subgraph.coe` and `SimpleGraph.Reachable`. +* `IsCompleteSubgraph`, `IsGrouping`, `IsPairing`, `Pairs`: groupings, pairings, and when a + pairing pairs two disjoint vertex sets `X, Y`, together with simpler equivalent characterizations. +* `Patch`: a patch `Δ` with its vertex set `V(Δ)` (`Δ.verts`) and its set of groupings + (`Δ.groupings`), along with `Patch.IsFree`, `freePatch`, and `Patch.IsRobust`. +* `Patchwork Ω α β`: an `Ω`-patchwork `(G, μ, Δ, φ)` (conditions (i)–(iv) of Section 6) and + `Patchwork.IsRobust`. +* `realizationOf` and `Patchwork.IsRealization`: realizations of an `Ω`-patchwork. +* `MarchCorresponds`, `marchEquiv`, `marchMapSubgraph`: the march bijection `π → π'` between the + term sets of two marches of the same length, and the induced map on subgraphs. +* `IsExpansion`: expansions `(ηv, ηe)` of an `Ω`-patchwork `P` in `P'` (conditions (i)–(ix) of + Section 7). +* `RootedHypergraph.deleteEdges` (`G \ F`), `Patchwork.deleteEdges` (`P \ F`), `Realizes`, + `IsRealizableExpansion`, and `Simulated`. +* `Patchwork.restrict` (`P | G'`), `Patchwork.IsRemovableEdge`, and `Patchwork.IsRemovable` + (Section 8). +-/ + +@[expose] public section + +namespace GraphMinor.GM04 + +open SimpleGraph + +variable {Ω α β α' β' : Type*} + +/-! ### Complete and edgeless subgraphs `K_V` and `N_V`, and components -/ + +/-- `K_V`, the complete graph on `V` (Graph Minors IV, Section 6, page 241): "If $V$ is a finite set +we denote by $K_V$ the complete graph on $V$, that is, the simple +graph with vertex set $V$ and edge set the set of all subsets of $V$ of cardinality 2, with +the natural incidence relation." -/ +def completeSubgraph (V : Set α) : (⊤ : SimpleGraph α).Subgraph := + (⊤ : (⊤ : SimpleGraph α).Subgraph).induce V + +@[simp] +theorem completeSubgraph_verts (V : Set α) : (completeSubgraph V).verts = V := rfl + +@[simp] +theorem completeSubgraph_adj {V : Set α} {u v : α} : + (completeSubgraph V).Adj u v ↔ u ∈ V ∧ v ∈ V ∧ u ≠ v := Iff.rfl + +@[simp] +theorem le_completeSubgraph_iff {V : Set α} {K : (⊤ : SimpleGraph α).Subgraph} : + K ≤ completeSubgraph V ↔ K.verts ⊆ V := by + refine ⟨fun h ↦ h.1, fun h ↦ ⟨h, fun u v hadj ↦ ?_⟩⟩ + exact ⟨h (K.edge_vert hadj), h (K.edge_vert hadj.symm), hadj.ne⟩ + +/-- `N_V`, the graph with vertex set `V` and no edges (Graph Minors IV, Section 6, page 241): +"If $V$ is a finite set, $N_V$ denotes the graph with vertex set $V$ and no edges." -/ +def emptySubgraph (V : Set α) : (⊤ : SimpleGraph α).Subgraph where + verts := V + Adj _ _ := False + adj_sub := False.elim + edge_vert := False.elim + +@[simp] +theorem emptySubgraph_verts (V : Set α) : (emptySubgraph V).verts = V := rfl + +@[simp] +theorem not_emptySubgraph_adj {V : Set α} {u v : α} : ¬(emptySubgraph V).Adj u v := id + +@[simp] +theorem emptySubgraph_le_iff {V : Set α} {K : (⊤ : SimpleGraph α).Subgraph} : + emptySubgraph V ≤ K ↔ V ⊆ K.verts := + ⟨fun h ↦ h.1, fun h ↦ ⟨h, fun _ _ ↦ False.elim⟩⟩ + +/-- The vertex set of the component of `K` containing `x : K.verts`: the vertices of `K` that are +reachable from `x` in `K.coe`. -/ +def componentVerts (K : (⊤ : SimpleGraph α).Subgraph) (x : K.verts) : Set α := + {w | ∃ hw : w ∈ K.verts, K.coe.Reachable x ⟨w, hw⟩} + +@[simp] +theorem mem_componentVerts_iff {K : (⊤ : SimpleGraph α).Subgraph} {x : K.verts} {w : α} : + w ∈ componentVerts K x ↔ ∃ hw : w ∈ K.verts, K.coe.Reachable x ⟨w, hw⟩ := Iff.rfl + +theorem componentVerts_subset (K : (⊤ : SimpleGraph α).Subgraph) (x : K.verts) : + componentVerts K x ⊆ K.verts := + fun _ ⟨hw, _⟩ ↦ hw + +theorem self_mem_componentVerts (K : (⊤ : SimpleGraph α).Subgraph) (x : K.verts) : + (x : α) ∈ componentVerts K x := + ⟨x.2, Reachable.refl x⟩ + +theorem componentVerts_eq_iff {K : (⊤ : SimpleGraph α).Subgraph} {x y : K.verts} : + componentVerts K x = componentVerts K y ↔ K.coe.Reachable x y := by + constructor + · intro h + have hy : (y : α) ∈ componentVerts K x := h ▸ self_mem_componentVerts K y + obtain ⟨_, hr⟩ := hy + exact hr + · intro hxy + ext w + simp only [mem_componentVerts_iff] + exact ⟨fun ⟨hw, hr⟩ ↦ ⟨hw, hxy.symm.trans hr⟩, fun ⟨hw, hr⟩ ↦ ⟨hw, hxy.trans hr⟩⟩ + +/-- The connected component of `K` containing `x : K.verts`, as an induced subgraph of `K`. -/ +def component (K : (⊤ : SimpleGraph α).Subgraph) (x : K.verts) : (⊤ : SimpleGraph α).Subgraph := + K.induce (componentVerts K x) + +@[simp] +theorem component_verts (K : (⊤ : SimpleGraph α).Subgraph) (x : K.verts) : + (component K x).verts = componentVerts K x := rfl + +@[simp] +theorem component_adj {K : (⊤ : SimpleGraph α).Subgraph} {x : K.verts} {u v : α} : + (component K x).Adj u v ↔ + u ∈ componentVerts K x ∧ v ∈ componentVerts K x ∧ K.Adj u v := Iff.rfl + +theorem component_le (K : (⊤ : SimpleGraph α).Subgraph) (x : K.verts) : + component K x ≤ K := by + refine ⟨componentVerts_subset K x, fun u v h ↦ h.2.2⟩ + +theorem component_eq_iff {K : (⊤ : SimpleGraph α).Subgraph} {x y : K.verts} : + component K x = component K y ↔ K.coe.Reachable x y := by + refine ⟨fun h ↦ componentVerts_eq_iff.mp (congrArg Subgraph.verts h), fun h ↦ ?_⟩ + have hv : componentVerts K x = componentVerts K y := componentVerts_eq_iff.mpr h + simp only [component, hv] + +/-- `D` is a connected component of `K`: `D` is `component K x` for some vertex `x` of `K`. -/ +def IsComponent (K D : (⊤ : SimpleGraph α).Subgraph) : Prop := + ∃ x : K.verts, D = component K x + +theorem IsComponent.verts_nonempty {K D : (⊤ : SimpleGraph α).Subgraph} (h : IsComponent K D) : + D.verts.Nonempty := by + obtain ⟨x, rfl⟩ := h + exact ⟨x.1, self_mem_componentVerts K x⟩ + +theorem IsComponent.le {K D : (⊤ : SimpleGraph α).Subgraph} (h : IsComponent K D) : D ≤ K := by + obtain ⟨x, rfl⟩ := h + exact component_le K x + +theorem IsComponent.eq_of_mem {K D₁ D₂ : (⊤ : SimpleGraph α).Subgraph} + (h₁ : IsComponent K D₁) (h₂ : IsComponent K D₂) {v : α} (hv₁ : v ∈ D₁.verts) + (hv₂ : v ∈ D₂.verts) : D₁ = D₂ := by + obtain ⟨x₁, rfl⟩ := h₁ + obtain ⟨x₂, rfl⟩ := h₂ + obtain ⟨hv, hr₁⟩ := hv₁ + obtain ⟨_, hr₂⟩ := hv₂ + exact component_eq_iff.mpr (hr₁.trans hr₂.symm) + +theorem IsComponent.disjoint_verts_of_ne {K D₁ D₂ : (⊤ : SimpleGraph α).Subgraph} + (h₁ : IsComponent K D₁) (h₂ : IsComponent K D₂) (hne : D₁ ≠ D₂) : + Disjoint D₁.verts D₂.verts := + Set.disjoint_left.mpr fun _ hv₁ hv₂ ↦ hne (h₁.eq_of_mem h₂ hv₁ hv₂) + +/-! ### Groupings and pairings -/ + +/-- A subgraph `D` is complete if it equals the complete graph `K_{V(D)}` on its vertex set. -/ +def IsCompleteSubgraph (D : (⊤ : SimpleGraph α).Subgraph) : Prop := + D = completeSubgraph D.verts + +theorem isCompleteSubgraph_iff {D : (⊤ : SimpleGraph α).Subgraph} : + IsCompleteSubgraph D ↔ ∀ u ∈ D.verts, ∀ v ∈ D.verts, u ≠ v → D.Adj u v := by + refine ⟨fun h u hu v hv hne ↦ ?_, fun h ↦ ?_⟩ + · rw [h] + exact ⟨hu, hv, hne⟩ + · ext u v + · rfl + · exact ⟨fun hadj ↦ ⟨D.edge_vert hadj, D.edge_vert hadj.symm, hadj.ne⟩, + fun ⟨hu, hv, hne⟩ ↦ h u hu v hv hne⟩ + +/-- A grouping in `V` (Graph Minors IV, Section 6, page 241): "A *grouping* in $V$ is a subgraph of +$K_V$ every component of which is complete." -/ +def IsGrouping (V : Set α) (K : (⊤ : SimpleGraph α).Subgraph) : Prop := + K ≤ completeSubgraph V ∧ ∀ D, IsComponent K D → IsCompleteSubgraph D + +/-- A subgraph `K` is a grouping in `V` if and only if `V(K) ⊆ V` and adjacency in `K` is +transitive on distinct vertices. -/ +theorem isGrouping_iff {V : Set α} {K : (⊤ : SimpleGraph α).Subgraph} : + IsGrouping V K ↔ K.verts ⊆ V ∧ ∀ a b c, a ≠ c → K.Adj a b → K.Adj b c → K.Adj a c := by + constructor + · rintro ⟨hKV, hcomp⟩ + refine ⟨le_completeSubgraph_iff.mp hKV, fun a b c hac hab hbc ↦ ?_⟩ + have ha : a ∈ K.verts := K.edge_vert hab + have hb : b ∈ K.verts := K.edge_vert hbc + have hc : c ∈ K.verts := K.edge_vert hbc.symm + let x : K.verts := ⟨a, ha⟩ + have hD := isCompleteSubgraph_iff.mp (hcomp (component K x) ⟨x, rfl⟩) + have haD : a ∈ (component K x).verts := self_mem_componentVerts K x + have hcD : c ∈ (component K x).verts := by + refine ⟨hc, ?_⟩ + exact (Adj.reachable hab.coe).trans (Adj.reachable hbc.coe) + exact (hD a haD c hcD hac).2.2 + · rintro ⟨hKV, htrans⟩ + refine ⟨le_completeSubgraph_iff.mpr hKV, ?_⟩ + rintro D ⟨x, rfl⟩ + rw [isCompleteSubgraph_iff] + intro u ⟨hu, hxu⟩ v ⟨hv, hxv⟩ huv + refine ⟨⟨hu, hxu⟩, ⟨hv, hxv⟩, ?_⟩ + have hreach : K.coe.Reachable ⟨u, hu⟩ ⟨v, hv⟩ := hxu.symm.trans hxv + suffices ∀ (y z : K.verts), K.coe.Reachable y z → y.1 ≠ z.1 → K.Adj y.1 z.1 from + this ⟨u, hu⟩ ⟨v, hv⟩ hreach huv + intro y z hr + rw [reachable_iff_reflTransGen] at hr + induction hr with + | refl => intro hne; exact absurd rfl hne + | @tail w z _ hwz ih => + intro hyz + by_cases hyw : y.1 = w.1 + · rw [hyw] + exact hwz + · exact htrans y.1 w.1 z.1 hyz (ih hyw) hwz + +/-- A pairing in `V` (Graph Minors IV, Section 6, page 241): "A *pairing* in $V$ is a grouping in +$V$ every component of which has at most two vertices." -/ +def IsPairing (V : Set α) (K : (⊤ : SimpleGraph α).Subgraph) : Prop := + IsGrouping V K ∧ ∀ D, IsComponent K D → D.verts.encard ≤ 2 + +/-- For finite `V`, a subgraph `K` is a pairing in `V` if and only if `V(K) ⊆ V` and every vertex +is adjacent to at most one vertex in `K`. -/ +theorem isPairing_iff {V : Set α} (hV : V.Finite) {K : (⊤ : SimpleGraph α).Subgraph} : + IsPairing V K ↔ K.verts ⊆ V ∧ ∀ a b c, K.Adj a b → K.Adj a c → b = c := by + constructor + · rintro ⟨⟨hKV, _⟩, hcard⟩ + have hKsub : K.verts ⊆ V := le_completeSubgraph_iff.mp hKV + refine ⟨hKsub, fun a b c hab hac ↦ ?_⟩ + by_contra hbc + have ha : a ∈ K.verts := K.edge_vert hab + have hb : b ∈ K.verts := K.edge_vert hab.symm + have hc : c ∈ K.verts := K.edge_vert hac.symm + let x : K.verts := ⟨a, ha⟩ + have hle : (componentVerts K x).ncard ≤ 2 := + ((Set.encard_le_coe_iff_finite_ncard_le (k := 2)).mp (hcard (component K x) ⟨x, rfl⟩)).2 + have haD : a ∈ componentVerts K x := self_mem_componentVerts K x + have hbD : b ∈ componentVerts K x := ⟨hb, Adj.reachable hab.coe⟩ + have hcD : c ∈ componentVerts K x := ⟨hc, Adj.reachable hac.coe⟩ + have hsub : ({a, b, c} : Set α) ⊆ componentVerts K x := by + intro z hz + rcases hz with rfl | rfl | rfl <;> assumption + have h3 : ({a, b, c} : Set α).ncard = 3 := by + rw [Set.ncard_insert_of_notMem, Set.ncard_pair hbc] + simp [hab.ne, hac.ne] + have hfin : (componentVerts K x).Finite := + hV.subset ((componentVerts_subset K x).trans hKsub) + have hle3 := Set.ncard_le_ncard hsub hfin + omega + · rintro ⟨hKV, huniq⟩ + have hgrp : IsGrouping V K := by + rw [isGrouping_iff] + refine ⟨hKV, fun a b c hac hab hbc ↦ ?_⟩ + exfalso + exact hac (huniq b a c hab.symm hbc) + refine ⟨hgrp, ?_⟩ + rintro D ⟨x, rfl⟩ + have hreach_sub : ∀ y : K.verts, K.coe.Reachable x y → + y.1 = x.1 ∨ K.Adj x.1 y.1 := by + intro y hr + rw [reachable_iff_reflTransGen] at hr + induction hr with + | refl => exact Or.inl rfl + | @tail z w _ hzw ih => + rcases ih with hzx | hxz + · right + rw [← hzx] + exact hzw + · left + exact (huniq z.1 x.1 w.1 hxz.symm hzw).symm + by_cases h : ∃ b, K.Adj x.1 b + · obtain ⟨b, hab⟩ := h + have hsub : (component K x).verts ⊆ {x.1, b} := by + rintro w ⟨hw, hr⟩ + rcases hreach_sub ⟨w, hw⟩ hr with hwx | hxw + · exact Or.inl hwx + · exact Or.inr (huniq x.1 b w hab hxw).symm + exact (Set.encard_mono hsub).trans_eq (Set.encard_pair hab.ne) + · push Not at h + have hsub : (component K x).verts ⊆ {x.1} := by + rintro w ⟨hw, hr⟩ + rcases hreach_sub ⟨w, hw⟩ hr with hwx | hxw + · exact hwx + · exact (h w hxw).elim + exact (Set.encard_mono hsub).trans (by simp) + +/-- `K` pairs `X, Y` in `V` (Graph Minors IV, Section 6, page 241): "If $K$ is a pairing in $V$, we +say that $K$ *pairs* $X, Y$ if $X, Y \subseteq V$ are +disjoint and (i) every 2-vertex component of $K$ has one vertex in $X$ and the other in $Y$, +and (ii) every vertex of $X \cup Y$ belongs to some 2-vertex component of $K$." -/ +structure Pairs (V : Set α) (K : (⊤ : SimpleGraph α).Subgraph) (X Y : Set α) : Prop where + subset_left : X ⊆ V + subset_right : Y ⊆ V + disjoint : Disjoint X Y + /-- (i) Every 2-vertex component of `K` has one vertex in `X` and the other in `Y`. -/ + two_vert_component : ∀ D, IsComponent K D → D.verts.ncard = 2 → + (D.verts ∩ X).Nonempty ∧ (D.verts ∩ Y).Nonempty + /-- (ii) Every vertex of `X ∪ Y` belongs to some 2-vertex component of `K`. -/ + mem_two_vert_component : ∀ v ∈ X ∪ Y, ∃ D, IsComponent K D ∧ D.verts.ncard = 2 ∧ v ∈ D.verts + +/-- For a pairing `K` in a finite set `V`, `K` pairs `X, Y` if and only if `X, Y ⊆ V` are disjoint, +every edge of `K` joins a vertex of `X` and a vertex of `Y`, and every vertex of `X ∪ Y` is +incident with an edge of `K`. -/ +theorem pairs_iff_of_isPairing {V : Set α} (hV : V.Finite) {K : (⊤ : SimpleGraph α).Subgraph} + (hK : IsPairing V K) {X Y : Set α} : + Pairs V K X Y ↔ X ⊆ V ∧ Y ⊆ V ∧ Disjoint X Y ∧ + (∀ u v, K.Adj u v → (u ∈ X ∧ v ∈ Y) ∨ (u ∈ Y ∧ v ∈ X)) ∧ + (∀ v ∈ X ∪ Y, ∃ w, K.Adj v w) := by + have hKsub : K.verts ⊆ V := le_completeSubgraph_iff.mp hK.1.1 + constructor + · intro hP + refine ⟨hP.subset_left, hP.subset_right, hP.disjoint, fun u v huv ↦ ?_, fun v hv ↦ ?_⟩ + · have hu : u ∈ K.verts := K.edge_vert huv + have hv : v ∈ K.verts := K.edge_vert huv.symm + let x : K.verts := ⟨u, hu⟩ + have hcomp : IsComponent K (component K x) := ⟨x, rfl⟩ + have huD : u ∈ (component K x).verts := self_mem_componentVerts K x + have hvD : v ∈ (component K x).verts := ⟨hv, Adj.reachable huv.coe⟩ + have hsub : ({u, v} : Set α) ⊆ (component K x).verts := by + intro z hz + rcases hz with rfl | rfl <;> assumption + have hfin : (component K x).verts.Finite := + hV.subset ((componentVerts_subset K x).trans hKsub) + have h2le : 2 ≤ (component K x).verts.ncard := by + rw [← Set.ncard_pair huv.ne] + exact Set.ncard_le_ncard hsub hfin + have hle2 : (component K x).verts.ncard ≤ 2 := + ((Set.encard_le_coe_iff_finite_ncard_le (k := 2)).mp (hK.2 (component K x) hcomp)).2 + have hcard2 : (component K x).verts.ncard = 2 := le_antisymm hle2 h2le + have hD_eq : (component K x).verts = {u, v} := + (Set.eq_of_subset_of_ncard_le hsub (by rw [hcard2, Set.ncard_pair huv.ne]) hfin).symm + obtain ⟨⟨a, haD, haX⟩, ⟨b, hbD, hbY⟩⟩ := hP.two_vert_component (component K x) hcomp hcard2 + rw [hD_eq] at haD hbD + rcases haD with rfl | rfl <;> rcases hbD with rfl | rfl + · exact absurd hbY (Set.disjoint_left.mp hP.disjoint haX) + · exact Or.inl ⟨haX, hbY⟩ + · exact Or.inr ⟨hbY, haX⟩ + · exact absurd hbY (Set.disjoint_left.mp hP.disjoint haX) + · obtain ⟨D, hD, hcard2, hvD⟩ := hP.mem_two_vert_component v hv + obtain ⟨a, b, hab, hD_eq⟩ := Set.ncard_eq_two.mp hcard2 + have hcomp := isCompleteSubgraph_iff.mp (hK.1.2 D hD) + have hvab : v = a ∨ v = b := by + have : v ∈ ({a, b} : Set α) := hD_eq ▸ hvD + simpa using this + rcases hvab with rfl | rfl + · refine ⟨b, hD.le.2 (hcomp v hvD b ?_ hab)⟩ + rw [hD_eq]; exact Or.inr rfl + · refine ⟨a, hD.le.2 (hcomp v hvD a ?_ hab.symm)⟩ + rw [hD_eq]; exact Or.inl rfl + · rintro ⟨hX, hY, hdisj, hadj, hex⟩ + refine ⟨hX, hY, hdisj, fun D hD hcard2 ↦ ?_, fun v hv ↦ ?_⟩ + · obtain ⟨a, b, hab, hD_eq⟩ := Set.ncard_eq_two.mp hcard2 + have haD : a ∈ D.verts := by rw [hD_eq]; exact Or.inl rfl + have hbD : b ∈ D.verts := by rw [hD_eq]; exact Or.inr rfl + have hcomp := isCompleteSubgraph_iff.mp (hK.1.2 D hD) + have hab_adj : K.Adj a b := (hD.le).2 (hcomp a haD b hbD hab) + rcases hadj a b hab_adj with ⟨haX, hbY⟩ | ⟨haY, hbX⟩ + · exact ⟨⟨a, haD, haX⟩, ⟨b, hbD, hbY⟩⟩ + · exact ⟨⟨b, hbD, hbX⟩, ⟨a, haD, haY⟩⟩ + · obtain ⟨w, hvw⟩ := hex v hv + have hvK : v ∈ K.verts := K.edge_vert hvw + have hwK : w ∈ K.verts := K.edge_vert hvw.symm + let x : K.verts := ⟨v, hvK⟩ + have hcomp : IsComponent K (component K x) := ⟨x, rfl⟩ + have hvD : v ∈ (component K x).verts := self_mem_componentVerts K x + have hwD : w ∈ (component K x).verts := ⟨hwK, Adj.reachable hvw.coe⟩ + have hsub : ({v, w} : Set α) ⊆ (component K x).verts := by + intro z hz + rcases hz with rfl | rfl <;> assumption + have hfin : (component K x).verts.Finite := + hV.subset ((componentVerts_subset K x).trans hKsub) + have h2le : 2 ≤ (component K x).verts.ncard := by + rw [← Set.ncard_pair hvw.ne] + exact Set.ncard_le_ncard hsub hfin + have hle2 : (component K x).verts.ncard ≤ 2 := + ((Set.encard_le_coe_iff_finite_ncard_le (k := 2)).mp (hK.2 (component K x) hcomp)).2 + exact ⟨component K x, hcomp, le_antisymm hle2 h2le, hvD⟩ + +/-! ### Patches -/ + +/-- A patch `Δ` (Graph Minors IV, Section 6, page 241): "A *patch* in $V$ is a collection $\Delta$ +of groupings in $V$, each with the same vertex set +$V(\Delta) \subseteq V$." -/ +@[ext] +structure Patch (α : Type*) where + /-- The vertex set `V(Δ)` of the patch. -/ + verts : Set α + /-- The collection of groupings belonging to the patch. -/ + groupings : Set ((⊤ : SimpleGraph α).Subgraph) + /-- Every member of `Δ` is a grouping in `V(Δ)`. -/ + isGrouping : ∀ δ ∈ groupings, IsGrouping verts δ + /-- Every member of `Δ` has vertex set `V(Δ)`. -/ + verts_eq : ∀ δ ∈ groupings, δ.verts = verts + +instance : Membership ((⊤ : SimpleGraph α).Subgraph) (Patch α) where + mem Δ δ := δ ∈ Δ.groupings + +@[simp] +theorem Patch.mem_iff {Δ : Patch α} {δ : (⊤ : SimpleGraph α).Subgraph} : + δ ∈ Δ.groupings ↔ δ ∈ Δ := Iff.rfl + +/-- `Δ` is a patch in `V` if `V(Δ) ⊆ V`. -/ +def Patch.IsIn (V : Set α) (Δ : Patch α) : Prop := + Δ.verts ⊆ V + +/-- A patch `Δ` is free (Graph Minors IV, Section 6, page 241): "A patch $\Delta$ is *free* if it +contains every grouping in $V$ with vertex set $V(\Delta)$" -/ +def Patch.IsFree (Δ : Patch α) : Prop := + ∀ δ : (⊤ : SimpleGraph α).Subgraph, IsGrouping Δ.verts δ → δ.verts = Δ.verts → δ ∈ Δ + +/-- The free patch on a vertex set `U`: the patch with vertex set `U` containing every grouping in +`U` with vertex set `U`. -/ +def freePatch (U : Set α) : Patch α where + verts := U + groupings := {δ | IsGrouping U δ ∧ δ.verts = U} + isGrouping _ h := h.1 + verts_eq _ h := h.2 + +@[simp] +theorem freePatch_verts (U : Set α) : (freePatch U).verts = U := rfl + +@[simp] +theorem mem_freePatch_iff {U : Set α} {δ : (⊤ : SimpleGraph α).Subgraph} : + δ ∈ freePatch U ↔ IsGrouping U δ ∧ δ.verts = U := Iff.rfl + +theorem freePatch_isFree (U : Set α) : (freePatch U).IsFree := + fun _ h₁ h₂ ↦ ⟨h₁, h₂⟩ + +/-- A patch `Δ` on a finite carrier is robust (Graph Minors IV, Section 6, page 241): +"it is *robust* if for every +choice of $X, Y \subseteq V(\Delta)$ with $|X| = |Y|$ and $X +\cap Y = \emptyset$, there is a pairing in $\Delta$ which pairs $X, Y$." -/ +structure Patch.IsRobust (Δ : Patch α) : Prop where + /-- The patch has a finite carrier. -/ + finite_verts : Δ.verts.Finite + /-- Disjoint equicardinal subsets have a pairing in the patch. -/ + exists_pairing : ∀ X ⊆ Δ.verts, ∀ Y ⊆ Δ.verts, X.ncard = Y.ncard → Disjoint X Y → + ∃ δ ∈ Δ, IsPairing Δ.verts δ ∧ Pairs Δ.verts δ X Y + +/-! ### `Ω`-patchworks and realizations -/ + +/-- An `Ω`-patchwork `(G, μ, Δ, φ)` (Graph Minors IV, Section 6, page 241): +"Let $\Omega$ be a quasi-order. An $\Omega$-*patchwork* is a quadruple $(G, \mu, \Delta, +\phi)$, where (i) $G$ is a rooted hypergraph (ii) $\mu$ is a function with domain +$\operatorname{dom}(\mu) \subseteq E(G)$; and for each $e \in \operatorname{dom}(\mu)$, +$\mu(e)$ is a march with $\bar{\mu}(e) = V(e)$. (iii) $\Delta$ is a function with domain +$E(G)$, and for each $e \in E(G)$, $\Delta(e)$ is a patch with $V(\Delta(e)) = V(e)$; and +for each $e \in E(G) - \operatorname{dom}(\mu)$, $\Delta(e)$ is free (iv) $\phi$ is a +function from $E(G)$ into $E(\Omega)$." -/ +structure Patchwork (Ω α β : Type*) where + /-- (i) The underlying rooted hypergraph `G`. -/ + G : RootedHypergraph α β + /-- The domain `dom(μ) ⊆ E(G)`. -/ + dom : Set β + /-- (ii) The function `μ` assigning a march to each `e ∈ dom(μ)`. -/ + μ : β → List α + /-- (iii) The function `Δ` assigning a patch to each `e ∈ E(G)`. -/ + Δ : β → Patch α + /-- (iv) The function `φ` from `E(G)` into `Ω`. -/ + φ : β → Ω + /-- (ii) `dom(μ) ⊆ E(G)`. -/ + dom_subset : dom ⊆ G.edgeSet + /-- (ii) For each `e ∈ dom(μ)`, `μ(e)` is a march. -/ + μ_nodup : ∀ e ∈ dom, (μ e).Nodup + /-- (ii) For each `e ∈ dom(μ)`, `μBar(e) = V(e)`. -/ + μ_set : ∀ e ∈ dom, {v | v ∈ μ e} = G.ends e + /-- (iii) For each `e ∈ E(G)`, `V(Δ(e)) = V(e)`. -/ + Δ_verts : ∀ e ∈ G.edgeSet, (Δ e).verts = G.ends e + /-- (iii) For each `e ∈ E(G) - dom(μ)`, `Δ(e)` is free. -/ + Δ_free : ∀ e ∈ G.edgeSet, e ∉ dom → (Δ e).IsFree + +/-- An `Ω`-patchwork `(G, μ, Δ, φ)` is robust if each `Δ(e)` (`e ∈ E(G)`) is robust +(Graph Minors IV, Section 6, page 241). -/ +def Patchwork.IsRobust (P : Patchwork Ω α β) : Prop := + ∀ e ∈ P.G.edgeSet, (P.Δ e).IsRobust + +/-- The subgraph `N_{V(G)} ∪ ⋃ (δ_e : e ∈ E(G))` formed from a choice of `δ e` for each edge `e` +of `G`. -/ +def realizationOf (G : Hypergraph α β) (δ : β → (⊤ : SimpleGraph α).Subgraph) : + (⊤ : SimpleGraph α).Subgraph := + emptySubgraph G.vertexSet ⊔ ⨆ e ∈ G.edgeSet, δ e + +@[simp] +theorem realizationOf_adj {G : Hypergraph α β} {δ : β → (⊤ : SimpleGraph α).Subgraph} {u v : α} : + (realizationOf G δ).Adj u v ↔ ∃ e ∈ G.edgeSet, (δ e).Adj u v := by + simp [realizationOf] + +/-- A realization of an `Ω`-patchwork `(G, μ, Δ, φ)` (Graph Minors IV, Section 6, page 241): +"a subgraph of $K_{V(G)}$ expressible in the form $$N_{V(G)} \cup \bigcup (\delta_e: e \in +E(G))$$ where $\delta_e \in \Delta(e)$ for each $e \in E(G)$." -/ +def Patchwork.IsRealization (P : Patchwork Ω α β) (H : (⊤ : SimpleGraph α).Subgraph) : Prop := + ∃ δ : β → (⊤ : SimpleGraph α).Subgraph, + (∀ e ∈ P.G.edgeSet, δ e ∈ P.Δ e) ∧ H = realizationOf P.G.toHypergraph δ + +/-! ### The march bijection `π → π'` -/ + +/-- Two elements `x` and `y` correspond under the march bijection `π → π'` if they occur at the +same index in `π` and `π'`. -/ +def MarchCorresponds (π : List α) (π' : List α') (x : α) (y : α') : Prop := + ∃ (i : ℕ) (hi : i < π.length) (hi' : i < π'.length), π[i] = x ∧ π'[i] = y + +open Classical in +/-- The march bijection `π → π'` (Graph Minors IV, Section 7, page 244): "If $\pi, \pi'$ are marches +of the same length, we denote by $\pi \to \pi'$ the bijection +from $\bar{\pi}$ onto $\bar{\pi}'$ mapping $\pi$ to $\pi'$." -/ +noncomputable def marchEquiv {π : List α} {π' : List α'} (hπ : π.Nodup) (hπ' : π'.Nodup) + (hlen : π.length = π'.length) : {x // x ∈ π} ≃ {y // y ∈ π'} := + (hπ.getEquiv.symm.trans (finCongr hlen)).trans hπ'.getEquiv + +theorem marchEquiv_apply_iff {π : List α} {π' : List α'} (hπ : π.Nodup) (hπ' : π'.Nodup) + (hlen : π.length = π'.length) (x : {x // x ∈ π}) (y : {y // y ∈ π'}) : + marchEquiv hπ hπ' hlen x = y ↔ MarchCorresponds π π' x.1 y.1 := by + classical + constructor + · intro h + let i : Fin π.length := hπ.getEquiv.symm x + have hx : π[i.1] = x.1 := congrArg Subtype.val (hπ.getEquiv.apply_symm_apply x) + have hy : π'[i.1] = y.1 := by + have h' := congrArg Subtype.val h + simpa [marchEquiv, i] using h' + exact ⟨i.1, i.2, hlen ▸ i.2, hx, hy⟩ + · rintro ⟨i, hi, hi', hx, hy⟩ + apply Subtype.ext + have hx' : (⟨π[i], List.getElem_mem hi⟩ : {x // x ∈ π}) = x := Subtype.ext hx + have hidx : hπ.getEquiv.symm x = ⟨i, hi⟩ := by + rw [← hx'] + apply hπ.getEquiv.injective + simp [List.Nodup.getEquiv] + simp [marchEquiv, hidx, hy] + +/-- The image of a subgraph `δ` under the march bijection `π → π'`. -/ +def marchMapSubgraph (π : List α) (π' : List α') (δ : (⊤ : SimpleGraph α).Subgraph) : + (⊤ : SimpleGraph α').Subgraph where + verts := {y | ∃ x ∈ δ.verts, MarchCorresponds π π' x y} + Adj y₁ y₂ := y₁ ≠ y₂ ∧ ∃ x₁ x₂, MarchCorresponds π π' x₁ y₁ ∧ MarchCorresponds π π' x₂ y₂ ∧ + δ.Adj x₁ x₂ + adj_sub h := h.1 + edge_vert := by + rintro y₁ y₂ ⟨_, x₁, x₂, hx₁, _, hadj⟩ + exact ⟨x₁, δ.edge_vert hadj, hx₁⟩ + symm := ⟨by + rintro y₁ y₂ ⟨hne, x₁, x₂, hx₁, hx₂, hadj⟩ + exact ⟨hne.symm, x₂, x₁, hx₂, hx₁, δ.adj_symm hadj⟩⟩ + +/-! ### Expansions, edge deletion, and simulation (Section 7) -/ + +/-- `η = (ηv, ηe)` is an expansion of `P` in `P'` (Graph Minors IV, Section 7, page 244): +"Let $P = (G, \mu, \Delta, \phi)$, $P' = (G', \mu', \Delta', \phi')$ be $\Omega$-patchworks. +An *expansion* of $P$ in $P'$ is a function $\eta$ with domain $V(G) \cup E(G)$ such that +(i) for each $v \in V(G)$, $\eta(v)$ is a non-empty subset of $V(G')$, and for each $e \in +E(G)$, $\eta(e) \in E(G')$ (ii) for distinct $v_1, v_2 \in V(G)$, $\eta(v_1) \cap \eta(v_2) += \emptyset$ (iii) for distinct $e_1, e_2 \in E(G)$, $\eta(e_1) \neq \eta(e_2)$ (iv) for +each $e \in E(G)$, $e \in \operatorname{dom}(\mu)$ if and only if $\eta(e) \in +\operatorname{dom}(\mu')$ (v) for each $e \in E(G) - \operatorname{dom}(\mu)$, if $v$ is an +end of $e$ in $G$ then $\eta(v)$ contains an end of $\eta(e)$ in $G'$ (vi) for each $e \in +\operatorname{dom}(\mu)$, $\mu(e)$ and $\mu'(\eta(e))$ have the same length, $k$, say, and +for $1 \le i \le k$, $\eta(v)$ contains the $i$th term of $\mu'(\eta(e))$ where $v$ is the +$i$th term of $\mu(e)$ (vii) $\pi(G)$ and $\pi(G')$ have the same length, $k$, say, and for +$1 \le i \le k$, $\eta(v)$ contains the $i$th term of $\pi(G')$ where $v$ is the $i$th term +of $\pi(G)$ (viii) for each $e \in \operatorname{dom}(\mu)$, $\mu(e) \to \mu'(\eta(e))$ maps +$\Delta(e)$ to $\Delta'(\eta(e))$ (ix) for each $e \in E(G)$, $\phi(e) \le \phi'(\eta(e))$." -/ +structure IsExpansion [Preorder Ω] (P : Patchwork Ω α β) (P' : Patchwork Ω α' β') + (ηv : α → Set α') (ηe : β → β') : Prop where + /-- (i) For each `v ∈ V(G)`, `η(v)` is non-empty. -/ + vertex_nonempty : ∀ v ∈ P.G.vertexSet, (ηv v).Nonempty + /-- (i) For each `v ∈ V(G)`, `η(v) ⊆ V(G')`. -/ + vertex_subset : ∀ v ∈ P.G.vertexSet, ηv v ⊆ P'.G.vertexSet + /-- (i) For each `e ∈ E(G)`, `η(e) ∈ E(G')`. -/ + edge_mem : ∀ e ∈ P.G.edgeSet, ηe e ∈ P'.G.edgeSet + /-- (ii) For distinct `v₁, v₂ ∈ V(G)`, `η(v₁) ∩ η(v₂) = ∅`. -/ + vertex_disjoint : ∀ v₁ ∈ P.G.vertexSet, ∀ v₂ ∈ P.G.vertexSet, v₁ ≠ v₂ → + Disjoint (ηv v₁) (ηv v₂) + /-- (iii) For distinct `e₁, e₂ ∈ E(G)`, `η(e₁) ≠ η(e₂)`. -/ + edge_injOn : Set.InjOn ηe P.G.edgeSet + /-- (iv) For each `e ∈ E(G)`, `e ∈ dom(μ)` if and only if `η(e) ∈ dom(μ')`. -/ + mem_dom_iff : ∀ e ∈ P.G.edgeSet, e ∈ P.dom ↔ ηe e ∈ P'.dom + /-- (v) For each `e ∈ E(G) - dom(μ)`, if `v` is an end of `e` in `G` then `η(v)` contains an end + of `η(e)` in `G'`. -/ + ends_nonempty : ∀ e ∈ P.G.edgeSet, e ∉ P.dom → ∀ v, P.G.Inc e v → + ∃ v' ∈ ηv v, P'.G.Inc (ηe e) v' + /-- (vi) For each `e ∈ dom(μ)`, `μ(e)` and `μ'(η(e))` have the same length. -/ + μ_length : ∀ e ∈ P.dom, (P.μ e).length = (P'.μ (ηe e)).length + /-- (vi) For each `e ∈ dom(μ)` and `1 ≤ i ≤ k`, `η(v)` contains the `i`th term of `μ'(η(e))` + where `v` is the `i`th term of `μ(e)`. -/ + μ_mem : ∀ e ∈ P.dom, ∀ (i : ℕ) (hi : i < (P.μ e).length) (hi' : i < (P'.μ (ηe e)).length), + (P'.μ (ηe e))[i] ∈ ηv (P.μ e)[i] + /-- (vii) `π(G)` and `π(G')` have the same length. -/ + roots_length : P.G.roots.length = P'.G.roots.length + /-- (vii) For `1 ≤ i ≤ k`, `η(v)` contains the `i`th term of `π(G')` where `v` is the `i`th term + of `π(G)`. -/ + roots_mem : ∀ (i : ℕ) (hi : i < P.G.roots.length) (hi' : i < P'.G.roots.length), + P'.G.roots[i] ∈ ηv P.G.roots[i] + /-- (viii) For each `e ∈ dom(μ)`, `μ(e) → μ'(η(e))` maps `Δ(e)` to `Δ'(η(e))`: the image of + every member of `Δ(e)` is a member of `Δ'(η(e))`. The paper uses 'maps ... to' in this sense in + the proof of (7.1), claim (6): "$\delta_e''$ ... belongs to $\Delta''(e)$ since $\delta_f \in + \Delta'(f)$ and + $\mu'(f) \to \mu''(\eta'(f))$ maps $\Delta'(f)$ to $\Delta''(e)$." -/ + maps_Δ : ∀ e ∈ P.dom, + Set.MapsTo (marchMapSubgraph (P.μ e) (P'.μ (ηe e))) (P.Δ e).groupings (P'.Δ (ηe e)).groupings + /-- (ix) For each `e ∈ E(G)`, `φ(e) ≤ φ'(η(e))`. -/ + φ_le : ∀ e ∈ P.G.edgeSet, P.φ e ≤ P'.φ (ηe e) + +/-- `G \ F` for a rooted hypergraph `G` (Graph Minors IV, Section 7, page 244): +"If $G$ is a rooted hypergraph, $G \setminus F$ denotes $(G^- \setminus F, \pi(G))$." -/ +def _root_.GraphMinor.RootedHypergraph.deleteEdges (G : RootedHypergraph α β) (F : Set β) : + RootedHypergraph α β where + toHypergraph := G.toHypergraph.deleteEdges F + roots := G.roots + roots_nodup := G.roots_nodup + roots_subset := G.roots_subset + +/-- `P \ F` for an `Ω`-patchwork `P` (Graph Minors IV, Section 7, page 244): +"If $P = (G, \mu, \Delta, \phi)$ is an $\Omega$-patchwork and $F \subseteq E(G)$, $P +\setminus F$ denotes the $\Omega$-patchwork $(G \setminus F, \mu', \Delta', \phi')$ where +$\mu', \Delta', \phi'$ are the restrictions of $\mu, \Delta, \phi$ to +$\operatorname{dom}(\mu) \cap E(G \setminus F)$, $E(G \setminus F)$, $E(G \setminus F)$, +respectively." -/ +def Patchwork.deleteEdges (P : Patchwork Ω α β) (F : Set β) : Patchwork Ω α β where + G := P.G.deleteEdges F + dom := P.dom \ F + μ := P.μ + Δ := P.Δ + φ := P.φ + dom_subset := Set.sdiff_subset_sdiff P.dom_subset subset_rfl + μ_nodup e he := P.μ_nodup e he.1 + μ_set e he := by + rw [P.μ_set e he.1] + ext v + exact ⟨fun hv ↦ ⟨hv, he.2⟩, fun hv ↦ hv.1⟩ + Δ_verts e he := by + rw [P.Δ_verts e he.1] + ext v + exact ⟨fun hv ↦ ⟨hv, he.2⟩, fun hv ↦ hv.1⟩ + Δ_free e he hnd := P.Δ_free e he.1 fun hd ↦ hnd ⟨hd, he.2⟩ + +/-- A realization `H` of `P' \ η(E(G))` realizes `η` (Graph Minors IV, Section 7, page 244): +"A realization $H$ of $P' \setminus \eta(E(G))$ is said to *realize* $\eta$ if for every $v +\in V(G)$, $\eta(v)$ is the vertex set of some component of $H$" -/ +def Realizes (P : Patchwork Ω α β) (P' : Patchwork Ω α' β') (ηv : α → Set α') (ηe : β → β') + (H : (⊤ : SimpleGraph α').Subgraph) : Prop := + (P'.deleteEdges (ηe '' P.G.edgeSet)).IsRealization H ∧ + ∀ v ∈ P.G.vertexSet, ∃ D, IsComponent H D ∧ D.verts = ηv v + +/-- An expansion `η = (ηv, ηe)` of `P` in `P'` is realizable (Graph Minors IV, Section 7, +page 244): "if there is such a realization, $\eta$ is said to be *realizable*." -/ +def IsRealizableExpansion [Preorder Ω] (P : Patchwork Ω α β) (P' : Patchwork Ω α' β') + (ηv : α → Set α') (ηe : β → β') : Prop := + IsExpansion P P' ηv ηe ∧ ∃ H, Realizes P P' ηv ηe H + +/-- `P` is simulated in `P'` (Graph Minors IV, Section 7, page 244): "Let us say that $P$ is +*simulated* in $P'$ if there is a realizable expansion of $P$ in +$P'$." -/ +def Simulated [Preorder Ω] (P : Patchwork Ω α β) (P' : Patchwork Ω α' β') : Prop := + ∃ (ηv : α → Set α') (ηe : β → β'), IsRealizableExpansion P P' ηv ηe + +/-! ### Restriction `P | G'` and removable patchworks (Section 8) -/ + +open Classical in +/-- `P | G'` (Graph Minors IV, Section 8, page 247): "Let $P = (G, \mu, \Delta, \phi)$ be an +$\Omega$-patchwork. If $G'$ is a rooted hypergraph +with $G'^- \subseteq G^-$, and $\mu'$, $\Delta'$, $\phi'$ are the restrictions of $\mu$, +$\Delta$, $\phi$ to $\operatorname{dom}(\mu) \cap E(G')$, $E(G')$, $E(G')$, respectively, +then $(G', \mu', \Delta', \phi')$ is an $\Omega$-patchwork which we denote by $P | G'$." -/ +noncomputable def Patchwork.restrict (P : Patchwork Ω α β) (G' : RootedHypergraph α β) : + Patchwork Ω α β where + G := G' + dom := {e ∈ P.dom ∩ G'.edgeSet | G'.ends e = P.G.ends e} + μ := P.μ + Δ e := if e ∈ P.G.edgeSet ∧ G'.ends e = P.G.ends e then P.Δ e else freePatch (G'.ends e) + φ := P.φ + dom_subset _ he := he.1.2 + μ_nodup e he := P.μ_nodup e he.1.1 + μ_set e he := (P.μ_set e he.1.1).trans he.2.symm + Δ_verts e he := by + split_ifs with h + · exact (P.Δ_verts e h.1).trans h.2.symm + · rfl + Δ_free e he hnd := by + split_ifs with h + · exact P.Δ_free e h.1 fun hd ↦ hnd ⟨⟨hd, he⟩, h.2⟩ + · exact freePatch_isFree _ + +@[simp] +theorem Patchwork.restrict_G (P : Patchwork Ω α β) (G' : RootedHypergraph α β) : + (P.restrict G').G = G' := rfl + +@[simp] +theorem Patchwork.restrict_μ (P : Patchwork Ω α β) (G' : RootedHypergraph α β) : + (P.restrict G').μ = P.μ := rfl + +@[simp] +theorem Patchwork.restrict_φ (P : Patchwork Ω α β) (G' : RootedHypergraph α β) : + (P.restrict G').φ = P.φ := rfl + +theorem Patchwork.restrict_dom {P : Patchwork Ω α β} {G' : RootedHypergraph α β} + (hG' : G'.toHypergraph ≤ P.G.toHypergraph) : + (P.restrict G').dom = P.dom ∩ G'.edgeSet := by + ext e + change (e ∈ P.dom ∧ e ∈ G'.edgeSet) ∧ G'.ends e = P.G.ends e ↔ e ∈ P.dom ∧ e ∈ G'.edgeSet + exact ⟨fun h ↦ h.1, fun h ↦ ⟨h, (hG'.ends_eq e h.2).symm⟩⟩ + +theorem Patchwork.restrict_Δ {P : Patchwork Ω α β} {G' : RootedHypergraph α β} + (hG' : G'.toHypergraph ≤ P.G.toHypergraph) {e : β} (he : e ∈ G'.edgeSet) : + (P.restrict G').Δ e = P.Δ e := by + have h : e ∈ P.G.edgeSet ∧ G'.ends e = P.G.ends e := + ⟨hG'.edgeSet_subset he, (hG'.ends_eq e he).symm⟩ + simp [Patchwork.restrict, h] + +/-- An edge `e ∈ E(G)` of an `Ω`-patchwork `P = (G, μ, Δ, φ)` is removable if `N_{V(e)} ∈ Δ(e)` +(Graph Minors IV, Section 8, page 248). -/ +def Patchwork.IsRemovableEdge (P : Patchwork Ω α β) (e : β) : Prop := + emptySubgraph (P.G.ends e) ∈ P.Δ e + +/-- An `Ω`-patchwork `P = (G, μ, Δ, φ)` is removable if each `e ∈ E(G)` is removable +(Graph Minors IV, Section 8, page 248). -/ +def Patchwork.IsRemovable (P : Patchwork Ω α β) : Prop := + ∀ e ∈ P.G.edgeSet, P.IsRemovableEdge e + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/Patchwork/Expansion.lean b/LeanPool/GraphMinor/GM04/Patchwork/Expansion.lean new file mode 100644 index 0000000000..99160f412b --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Patchwork/Expansion.lean @@ -0,0 +1,842 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Patchwork.Defs +import LeanPool.GraphMinor.GM04.Patchwork.Menger + +/-! +# Composition of patchwork expansions and simulation quasi-order (Graph Minors IV, Section 7) + +This file formalizes Graph Minors IV, (7.1) (pages 244–247): + +* `compVertex` and `compEdge`: composition `η''` of two expansions `η` and `η'`. +* `lemma_7_1_claim_1`–`lemma_7_1_claim_5` and `IsExpansion.comp`: the composition of two expansions + is an expansion. +* `lemma_7_1_claim_6`–`lemma_7_1_claim_9` and `IsRealizableExpansion.comp`: the composition of two + realizable expansions is realizable. +* `Simulated.refl` and `Simulated.trans`: simulation is reflexive and transitive (a quasi-order on + `Ω`-patchworks). +-/ + +public section + +namespace GraphMinor.GM04 + +open SimpleGraph + +universe u v w + +variable {Ω : Type w} [Preorder Ω] {α α' α'' : Type*} {β β' β'' : Type*} + +/-! ### Properties of `MarchCorresponds` and `marchMapSubgraph` -/ + +theorem marchCorresponds_refl {π : List α} {x y : α} : + MarchCorresponds π π x y ↔ x ∈ π ∧ x = y := by + constructor + · rintro ⟨i, hi, _, rfl, rfl⟩ + exact ⟨List.getElem_mem hi, rfl⟩ + · rintro ⟨hx, rfl⟩ + obtain ⟨i, hi, rfl⟩ := List.getElem_of_mem hx + exact ⟨i, hi, hi, rfl, rfl⟩ + +theorem marchCorresponds_unique_left {π : List α} {π' : List α'} (hπ' : π'.Nodup) + {x₁ x₂ : α} {y : α'} (h₁ : MarchCorresponds π π' x₁ y) (h₂ : MarchCorresponds π π' x₂ y) : + x₁ = x₂ := by + obtain ⟨i₁, hi₁, hi₁', rfl, hy₁⟩ := h₁ + obtain ⟨i₂, hi₂, hi₂', rfl, hy₂⟩ := h₂ + have hidx : i₁ = i₂ := (hπ'.getElem_inj_iff (hi := hi₁') (hj := hi₂')).mp (hy₁.trans hy₂.symm) + subst hidx + rfl + +theorem marchCorresponds_unique_right {π : List α} {π' : List α'} (hπ : π.Nodup) + {x : α} {y₁ y₂ : α'} (h₁ : MarchCorresponds π π' x y₁) (h₂ : MarchCorresponds π π' x y₂) : + y₁ = y₂ := by + obtain ⟨i₁, hi₁, hi₁', hx₁, rfl⟩ := h₁ + obtain ⟨i₂, hi₂, hi₂', hx₂, rfl⟩ := h₂ + have hidx : i₁ = i₂ := (hπ.getElem_inj_iff (hi := hi₁) (hj := hi₂)).mp (hx₁.trans hx₂.symm) + subst hidx + rfl + +theorem marchCorresponds_comp {π₁ : List α} {π₂ : List α'} {π₃ : List α''} + (h₂ : π₂.Nodup) (h₁₂ : π₁.length = π₂.length) + {x : α} {z : α''} : + MarchCorresponds π₁ π₃ x z ↔ + ∃ y : α', MarchCorresponds π₁ π₂ x y ∧ MarchCorresponds π₂ π₃ y z := by + constructor + · rintro ⟨i, hi₁, hi₃, rfl, rfl⟩ + have hi₂ : i < π₂.length := h₁₂ ▸ hi₁ + exact ⟨π₂[i], ⟨i, hi₁, hi₂, rfl, rfl⟩, ⟨i, hi₂, hi₃, rfl, rfl⟩⟩ + · rintro ⟨y, ⟨i, hi₁, hi₂, rfl, rfl⟩, ⟨j, hj₂, hj₃, hy, rfl⟩⟩ + have hij : i = j := (h₂.getElem_inj_iff (hi := hi₂) (hj := hj₂)).mp hy.symm + subst hij + exact ⟨i, hi₁, hj₃, rfl, rfl⟩ + +theorem marchMapSubgraph_id {π : List α} {δ : (⊤ : SimpleGraph α).Subgraph} + (hverts : δ.verts ⊆ {x | x ∈ π}) : + marchMapSubgraph π π δ = δ := by + ext x y + · simp only [marchMapSubgraph, Set.mem_ofPred_eq] + constructor + · rintro ⟨x', hx', hcorr⟩ + obtain ⟨_, rfl⟩ := marchCorresponds_refl.mp hcorr + exact hx' + · intro hx + exact ⟨x, hx, marchCorresponds_refl.mpr ⟨hverts hx, rfl⟩⟩ + · simp only [marchMapSubgraph] + constructor + · rintro ⟨_, x₁, x₂, hx₁, hx₂, hadj⟩ + obtain ⟨_, rfl⟩ := marchCorresponds_refl.mp hx₁ + obtain ⟨_, rfl⟩ := marchCorresponds_refl.mp hx₂ + exact hadj + · intro hadj + have hx : x ∈ π := hverts (δ.edge_vert hadj) + have hy : y ∈ π := hverts (δ.edge_vert hadj.symm) + exact ⟨hadj.ne, x, y, marchCorresponds_refl.mpr ⟨hx, rfl⟩, + marchCorresponds_refl.mpr ⟨hy, rfl⟩, hadj⟩ + +theorem marchMapSubgraph_comp {π₁ : List α} {π₂ : List α'} {π₃ : List α''} + (h₂ : π₂.Nodup) (h₁₂ : π₁.length = π₂.length) (δ : (⊤ : SimpleGraph α).Subgraph) : + marchMapSubgraph π₂ π₃ (marchMapSubgraph π₁ π₂ δ) = marchMapSubgraph π₁ π₃ δ := by + ext z₁ z₂ + · simp only [marchMapSubgraph, Set.mem_ofPred_eq] + constructor + · rintro ⟨y, ⟨x, hx, hxy⟩, hyz⟩ + exact ⟨x, hx, (marchCorresponds_comp h₂ h₁₂).mpr ⟨y, hxy, hyz⟩⟩ + · rintro ⟨x, hx, hxz⟩ + obtain ⟨y, hxy, hyz⟩ := (marchCorresponds_comp h₂ h₁₂).mp hxz + exact ⟨y, ⟨x, hx, hxy⟩, hyz⟩ + · simp only [marchMapSubgraph] + constructor + · rintro ⟨hne, y₁, y₂, hyz₁, hyz₂, _, x₁, x₂, hxy₁, hxy₂, hadj⟩ + exact ⟨hne, x₁, x₂, (marchCorresponds_comp h₂ h₁₂).mpr ⟨y₁, hxy₁, hyz₁⟩, + (marchCorresponds_comp h₂ h₁₂).mpr ⟨y₂, hxy₂, hyz₂⟩, hadj⟩ + · rintro ⟨hne, x₁, x₂, hxz₁, hxz₂, hadj⟩ + obtain ⟨y₁, hxy₁, hyz₁⟩ := (marchCorresponds_comp h₂ h₁₂).mp hxz₁ + obtain ⟨y₂, hxy₂, hyz₂⟩ := (marchCorresponds_comp h₂ h₁₂).mp hxz₂ + have hyne : y₁ ≠ y₂ := by + intro hEq + subst hEq + exact hne (marchCorresponds_unique_right h₂ hyz₁ hyz₂) + exact ⟨hne, y₁, y₂, hyz₁, hyz₂, hyne, x₁, x₂, hxy₁, hxy₂, hadj⟩ + +/-! ### Composition of expansions: Graph Minors IV, (7.1), claims (1)–(5) -/ + +/-- The vertex map `η''(v) = ⋃ (η'(v') : v' ∈ η(v))` of the composed expansion in (7.1) +(Graph Minors IV, page 244). -/ +def compVertex (ηv : α → Set α') (η'v : α' → Set α'') (v : α) : Set α'' := + ⋃ v' ∈ ηv v, η'v v' + +/-- The edge map `η''(e) = η'(η(e))` of the composed expansion in (7.1) +(Graph Minors IV, page 244). -/ +def compEdge (ηe : β → β') (η'e : β' → β'') (e : β) : β'' := + η'e (ηe e) + +@[simp] +theorem mem_compVertex_iff {ηv : α → Set α'} {η'v : α' → Set α''} {v : α} {w : α''} : + w ∈ compVertex ηv η'v v ↔ ∃ v' ∈ ηv v, w ∈ η'v v' := by + simp [compVertex] + +@[simp] +theorem compEdge_apply (ηe : β → β') (η'e : β' → β'') (e : β) : + compEdge ηe η'e e = η'e (ηe e) := by + rfl + +/-- Graph Minors IV, (7.1), claim (1) (page 245): +"For distinct $v_1, v_2 \in V(G)$, $\eta''(v_1) \cap \eta''(v_2) = \emptyset$" -/ +theorem lemma_7_1_claim_1 {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {P'' : Patchwork Ω α'' β''} {ηv : α → Set α'} {ηe : β → β'} + {η'v : α' → Set α''} {η'e : β' → β''} + (hη : IsExpansion P P' ηv ηe) (hη' : IsExpansion P' P'' η'v η'e) + {v₁ v₂ : α} (hv₁ : v₁ ∈ P.G.vertexSet) (hv₂ : v₂ ∈ P.G.vertexSet) (hne : v₁ ≠ v₂) : + Disjoint (compVertex ηv η'v v₁) (compVertex ηv η'v v₂) := by + refine Set.disjoint_left.mpr fun w h₁ h₂ ↦ ?_ + rw [mem_compVertex_iff] at h₁ h₂ + obtain ⟨v₁', hv₁', hw₁⟩ := h₁ + obtain ⟨v₂', hv₂', hw₂⟩ := h₂ + have hne' : v₁' ≠ v₂' := by + intro hEq + subst hEq + exact Set.disjoint_left.mp (hη.vertex_disjoint v₁ hv₁ v₂ hv₂ hne) hv₁' hv₂' + exact Set.disjoint_left.mp + (hη'.vertex_disjoint v₁' (hη.vertex_subset v₁ hv₁ hv₁') + v₂' (hη.vertex_subset v₂ hv₂ hv₂') hne') + hw₁ hw₂ + +/-- Graph Minors IV, (7.1), claim (2) (page 245): +"For each $e \in E(G) - \operatorname{dom}(\mu)$, if $v$ is an end of $e$ in $G$ then +$\eta''(v)$ contains an end of $\eta''(e)$ in $G''$." -/ +theorem lemma_7_1_claim_2 {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {P'' : Patchwork Ω α'' β''} {ηv : α → Set α'} {ηe : β → β'} + {η'v : α' → Set α''} {η'e : β' → β''} + (hη : IsExpansion P P' ηv ηe) (hη' : IsExpansion P' P'' η'v η'e) + {e : β} (he : e ∈ P.G.edgeSet) (hnd : e ∉ P.dom) {v : α} (hinc : P.G.Inc e v) : + ∃ v'' ∈ compVertex ηv η'v v, P''.G.Inc (compEdge ηe η'e e) v'' := by + obtain ⟨v', hv', hinc'⟩ := hη.ends_nonempty e he hnd v hinc + have he' : ηe e ∈ P'.G.edgeSet := hη.edge_mem e he + have hnd' : ηe e ∉ P'.dom := fun hd' ↦ hnd ((hη.mem_dom_iff e he).mpr hd') + obtain ⟨v'', hv'', hinc''⟩ := hη'.ends_nonempty (ηe e) he' hnd' v' hinc' + exact ⟨v'', mem_compVertex_iff.mpr ⟨v', hv', hv''⟩, hinc''⟩ + +/-- Graph Minors IV, (7.1), claim (3) (page 245): +"For each $e \in \operatorname{dom}(\mu)$, $\mu(e)$ and $\mu''(\eta''(e))$ have the same +length, $k$, say, and for $1 \le i \le k$, $\eta''(v)$ contains the $i$th term of +$\mu''(\eta''(e))$ where $v$ is the $i$th term of $\mu(e)$." -/ +theorem lemma_7_1_claim_3 {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {P'' : Patchwork Ω α'' β''} {ηv : α → Set α'} {ηe : β → β'} + {η'v : α' → Set α''} {η'e : β' → β''} + (hη : IsExpansion P P' ηv ηe) (hη' : IsExpansion P' P'' η'v η'e) + {e : β} (he : e ∈ P.dom) : + (P.μ e).length = (P''.μ (compEdge ηe η'e e)).length ∧ + ∀ (i : ℕ) (hi : i < (P.μ e).length) (hi'' : i < (P''.μ (compEdge ηe η'e e)).length), + (P''.μ (compEdge ηe η'e e))[i] ∈ compVertex ηv η'v (P.μ e)[i] := by + have heE : e ∈ P.G.edgeSet := P.dom_subset he + have he' : ηe e ∈ P'.dom := (hη.mem_dom_iff e heE).mp he + have hlen1 := hη.μ_length e he + have hlen2 := hη'.μ_length (ηe e) he' + refine ⟨hlen1.trans hlen2, fun i hi hi'' ↦ ?_⟩ + have hi' : i < (P'.μ (ηe e)).length := hlen1 ▸ hi + exact mem_compVertex_iff.mpr ⟨(P'.μ (ηe e))[i], hη.μ_mem e he i hi hi', + hη'.μ_mem (ηe e) he' i hi' hi''⟩ + +/-- Graph Minors IV, (7.1), claim (4) (page 245): +"$\pi(G)$ and $\pi(G'')$ have the same length, $k$, say, and for $1 \le i \le k$ $\eta''(v)$ +contains the $i$th term of $\pi(G'')$ where $v$ is the $i$th term of $\pi(G)$." -/ +theorem lemma_7_1_claim_4 {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {P'' : Patchwork Ω α'' β''} {ηv : α → Set α'} {ηe : β → β'} + {η'v : α' → Set α''} {η'e : β' → β''} + (hη : IsExpansion P P' ηv ηe) (hη' : IsExpansion P' P'' η'v η'e) : + P.G.roots.length = P''.G.roots.length ∧ + ∀ (i : ℕ) (hi : i < P.G.roots.length) (hi'' : i < P''.G.roots.length), + P''.G.roots[i] ∈ compVertex ηv η'v P.G.roots[i] := by + refine ⟨hη.roots_length.trans hη'.roots_length, fun i hi hi'' ↦ ?_⟩ + have hi' : i < P'.G.roots.length := hη.roots_length ▸ hi + exact mem_compVertex_iff.mpr ⟨P'.G.roots[i], hη.roots_mem i hi hi', + hη'.roots_mem i hi' hi''⟩ + +/-- Graph Minors IV, (7.1), claim (5) (page 245): +"For each $e \in \operatorname{dom}(\mu)$, $\mu(e) \to \mu''(\eta''(e))$ maps $\Delta(e)$ to +$\Delta''(\eta''(e))$." -/ +theorem lemma_7_1_claim_5 {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {P'' : Patchwork Ω α'' β''} {ηv : α → Set α'} {ηe : β → β'} + {η'v : α' → Set α''} {η'e : β' → β''} + (hη : IsExpansion P P' ηv ηe) (hη' : IsExpansion P' P'' η'v η'e) + {e : β} (he : e ∈ P.dom) : + Set.MapsTo (marchMapSubgraph (P.μ e) (P''.μ (compEdge ηe η'e e))) + (P.Δ e).groupings (P''.Δ (compEdge ηe η'e e)).groupings := by + intro δ hδ + have heE : e ∈ P.G.edgeSet := P.dom_subset he + have he' : ηe e ∈ P'.dom := (hη.mem_dom_iff e heE).mp he + rw [← marchMapSubgraph_comp (P'.μ_nodup (ηe e) he') (hη.μ_length e he) δ] + exact hη'.maps_Δ (ηe e) he' (hη.maps_Δ e he hδ) + +/-- First statement of Graph Minors IV, (7.1) (page 245): the composition `η''` of an expansion `η` +of `P` in `P'` and an expansion `η'` of `P'` in `P''` is an expansion of `P` in `P''`. -/ +theorem IsExpansion.comp {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {P'' : Patchwork Ω α'' β''} {ηv : α → Set α'} {ηe : β → β'} + {η'v : α' → Set α''} {η'e : β' → β''} + (hη : IsExpansion P P' ηv ηe) (hη' : IsExpansion P' P'' η'v η'e) : + IsExpansion P P'' (compVertex ηv η'v) (compEdge ηe η'e) where + vertex_nonempty v hv := by + obtain ⟨v', hv'⟩ := hη.vertex_nonempty v hv + obtain ⟨v'', hv''⟩ := hη'.vertex_nonempty v' (hη.vertex_subset v hv hv') + exact ⟨v'', mem_compVertex_iff.mpr ⟨v', hv', hv''⟩⟩ + vertex_subset v hv := by + intro v'' hv'' + rw [mem_compVertex_iff] at hv'' + obtain ⟨v', hv', hv''⟩ := hv'' + exact hη'.vertex_subset v' (hη.vertex_subset v hv hv') hv'' + edge_mem e he := hη'.edge_mem (ηe e) (hη.edge_mem e he) + vertex_disjoint _ hv₁ _ hv₂ hne := lemma_7_1_claim_1 hη hη' hv₁ hv₂ hne + edge_injOn e₁ he₁ e₂ he₂ hEq := + hη.edge_injOn he₁ he₂ (hη'.edge_injOn (hη.edge_mem e₁ he₁) (hη.edge_mem e₂ he₂) hEq) + mem_dom_iff e he := + (hη.mem_dom_iff e he).trans (hη'.mem_dom_iff (ηe e) (hη.edge_mem e he)) + ends_nonempty _ he hnd _ hinc := lemma_7_1_claim_2 hη hη' he hnd hinc + μ_length _ he := (lemma_7_1_claim_3 hη hη' he).1 + μ_mem _ he := (lemma_7_1_claim_3 hη hη' he).2 + roots_length := (lemma_7_1_claim_4 hη hη').1 + roots_mem := (lemma_7_1_claim_4 hη hη').2 + maps_Δ _ he := lemma_7_1_claim_5 hη hη' he + φ_le e he := (hη.φ_le e he).trans (hη'.φ_le (ηe e) (hη.edge_mem e he)) + +/-! ### Helper lemmas on `sameComponent`, `Realizes`, and `expandedGrouping` -/ + +/-- For any `e ∈ E(G)` (whether in `dom(μ)` or not) and `v ∈ V_G(e)`, `η(v)` contains an end of +`η(e)` in `G'`. -/ +theorem IsExpansion.exists_inc_of_inc {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {ηv : α → Set α'} {ηe : β → β'} (hη : IsExpansion P P' ηv ηe) + {e : β} (he : e ∈ P.G.edgeSet) {v : α} (hv : P.G.Inc e v) : + ∃ v' ∈ ηv v, P'.G.Inc (ηe e) v' := by + by_cases hd : e ∈ P.dom + · have hv_mem : v ∈ P.μ e := by + have hset := P.μ_set e hd + have hv' : v ∈ P.G.ends e := hv + rwa [← hset] at hv' + obtain ⟨i, hi, rfl⟩ := List.getElem_of_mem hv_mem + have hi' : i < (P'.μ (ηe e)).length := (hη.μ_length e hd) ▸ hi + refine ⟨(P'.μ (ηe e))[i], hη.μ_mem e hd i hi hi', ?_⟩ + have hd' : ηe e ∈ P'.dom := (hη.mem_dom_iff e he).mp hd + have hset' := P'.μ_set (ηe e) hd' + change (P'.μ (ηe e))[i] ∈ P'.G.ends (ηe e) + rw [← hset'] + exact List.getElem_mem hi' + · exact hη.ends_nonempty e he hd v hv + +/-- Two vertices `p, q` belong to the same component of a subgraph `K`. -/ +def sameComponent (K : (⊤ : SimpleGraph α).Subgraph) (p q : α) : Prop := + ∃ D, IsComponent K D ∧ p ∈ D.verts ∧ q ∈ D.verts + +theorem sameComponent_iff {K : (⊤ : SimpleGraph α).Subgraph} {p q : α} : + sameComponent K p q ↔ + ∃ (hp : p ∈ K.verts) (hq : q ∈ K.verts), K.coe.Reachable ⟨p, hp⟩ ⟨q, hq⟩ := by + constructor + · rintro ⟨_, ⟨x, rfl⟩, ⟨hp, hxp⟩, ⟨hq, hxq⟩⟩ + exact ⟨hp, hq, hxp.symm.trans hxq⟩ + · rintro ⟨hp, hq, hr⟩ + exact ⟨component K ⟨p, hp⟩, ⟨⟨p, hp⟩, rfl⟩, + self_mem_componentVerts K ⟨p, hp⟩, ⟨hq, hr⟩⟩ + +theorem sameComponent.symm {K : (⊤ : SimpleGraph α).Subgraph} {p q : α} + (h : sameComponent K p q) : sameComponent K q p := by + obtain ⟨D, hD, hp, hq⟩ := h + exact ⟨D, hD, hq, hp⟩ + +theorem sameComponent.trans {K : (⊤ : SimpleGraph α).Subgraph} {p q r : α} + (hpq : sameComponent K p q) (hqr : sameComponent K q r) : sameComponent K p r := by + obtain ⟨D₁, hD₁, hp, hq₁⟩ := hpq + obtain ⟨D₂, hD₂, hq₂, hr⟩ := hqr + have hEq : D₁ = D₂ := hD₁.eq_of_mem hD₂ hq₁ hq₂ + exact ⟨D₁, hD₁, hp, hEq ▸ hr⟩ + +theorem sameComponent_of_adj {K : (⊤ : SimpleGraph α).Subgraph} {p q : α} + (h : K.Adj p q) : sameComponent K p q := + sameComponent_iff.mpr ⟨K.edge_vert h, K.edge_vert h.symm, Adj.reachable h.coe⟩ + +theorem sameComponent.mono {K H : (⊤ : SimpleGraph α).Subgraph} (hle : K ≤ H) {p q : α} + (h : sameComponent K p q) : sameComponent H p q := by + rw [sameComponent_iff] at h ⊢ + obtain ⟨hp, hq, hr⟩ := h + refine ⟨hle.1 hp, hle.1 hq, ?_⟩ + suffices ∀ x y : K.verts, K.coe.Reachable x y → + H.coe.Reachable ⟨x.1, hle.1 x.2⟩ ⟨y.1, hle.1 y.2⟩ from + this ⟨p, hp⟩ ⟨q, hq⟩ hr + intro x y hxy + rw [reachable_iff_reflTransGen] at hxy ⊢ + induction hxy with + | refl => exact Relation.ReflTransGen.refl + | @tail a b _ hab ih => + exact Relation.ReflTransGen.tail ih (hle.2 hab) + +theorem sameComponent_iff_adj_of_isGrouping {V : Set α} {δ : (⊤ : SimpleGraph α).Subgraph} + (hgrp : IsGrouping V δ) {p q : α} (hne : p ≠ q) : + sameComponent δ p q ↔ δ.Adj p q := by + constructor + · rintro ⟨D, hD, hp, hq⟩ + have hcomp := isCompleteSubgraph_iff.mp (hgrp.2 D hD) + exact hD.le.2 (hcomp p hp q hq hne) + · exact sameComponent_of_adj + +theorem exists_isComponent_verts_eq_iff {H : (⊤ : SimpleGraph α).Subgraph} {S : Set α} + (hne : S.Nonempty) (hsub : S ⊆ H.verts) : + (∃ D, IsComponent H D ∧ D.verts = S) ↔ + (∀ a ∈ S, ∀ b, H.Adj a b → b ∈ S) ∧ + (∀ a ∈ S, ∀ b ∈ S, sameComponent H a b) := by + constructor + · rintro ⟨D, hD, rfl⟩ + refine ⟨?_, fun a ha b hb ↦ ⟨D, hD, ha, hb⟩⟩ + obtain ⟨x, rfl⟩ := hD + rintro a ⟨ha, hxa⟩ b hab + exact ⟨H.edge_vert hab.symm, hxa.trans (Adj.reachable hab.coe)⟩ + · rintro ⟨hclosed, hconn⟩ + obtain ⟨a₀, ha₀⟩ := hne + let x : H.verts := ⟨a₀, hsub ha₀⟩ + refine ⟨component H x, ⟨x, rfl⟩, ?_⟩ + ext b + simp only [component_verts, mem_componentVerts_iff] + constructor + · rintro ⟨hbH, hxb⟩ + suffices ∀ y : H.verts, H.coe.Reachable x y → y.1 ∈ S from this ⟨b, hbH⟩ hxb + intro y hy + rw [reachable_iff_reflTransGen] at hy + induction hy with + | refl => exact ha₀ + | @tail u w _ huw ih => exact hclosed u.1 ih w.1 huw + · intro hbS + obtain ⟨_, hbH, hreach⟩ := sameComponent_iff.mp (hconn a₀ ha₀ b hbS) + exact ⟨hbH, hreach⟩ + +/-- The subgraph of `K_{V''}` on `V''` in which distinct `a, b ∈ V''` are adjacent if and only if +`a ∈ η'v p` and `b ∈ η'v q` for some `p, q` in the same component of `δ` +(Graph Minors IV, Section 7, page 246). -/ +def expandedGrouping (V'' : Set α'') (η'v : α' → Set α'') + (δ : (⊤ : SimpleGraph α').Subgraph) : (⊤ : SimpleGraph α'').Subgraph where + verts := V'' + Adj a b := a ∈ V'' ∧ b ∈ V'' ∧ a ≠ b ∧ + ∃ p q, sameComponent δ p q ∧ a ∈ η'v p ∧ b ∈ η'v q + adj_sub h := h.2.2.1 + edge_vert h := h.1 + symm := ⟨by + rintro a b ⟨ha, hb, hne, p, q, hpq, hap, hbq⟩ + exact ⟨hb, ha, hne.symm, q, p, hpq.symm, hbq, hap⟩⟩ + +@[simp] +theorem expandedGrouping_verts (V'' : Set α'') (η'v : α' → Set α'') + (δ : (⊤ : SimpleGraph α').Subgraph) : + (expandedGrouping V'' η'v δ).verts = V'' := by + rfl + +theorem expandedGrouping_isGrouping {P' : Patchwork Ω α' β'} {P'' : Patchwork Ω α'' β''} + {η'v : α' → Set α''} {η'e : β' → β''} (hη' : IsExpansion P' P'' η'v η'e) + (V'' : Set α'') {δ : (⊤ : SimpleGraph α').Subgraph} (hδ_verts : δ.verts ⊆ P'.G.vertexSet) : + IsGrouping V'' (expandedGrouping V'' η'v δ) := by + rw [isGrouping_iff] + refine ⟨subset_rfl, fun a b c hac hab hbc ↦ ?_⟩ + rcases hab with ⟨ha, _, _, p, q, hpq, hap, hbq⟩ + rcases hbc with ⟨_, hc, _, r, s, hrs, hbr, hcs⟩ + have hqV : q ∈ P'.G.vertexSet := by + obtain ⟨_, hq, _⟩ := sameComponent_iff.mp hpq + exact hδ_verts hq + have hrV : r ∈ P'.G.vertexSet := by + obtain ⟨hr, _, _⟩ := sameComponent_iff.mp hrs + exact hδ_verts hr + have hqr : q = r := by + by_contra hne + exact Set.disjoint_left.mp (hη'.vertex_disjoint q hqV r hrV hne) hbq hbr + subst hqr + exact ⟨ha, hc, hac, p, s, hpq.trans hrs, hap, hcs⟩ + +private theorem mem_η_iff_marchCorresponds {P' : Patchwork Ω α' β'} {P'' : Patchwork Ω α'' β''} + {η'v : α' → Set α''} {η'e : β' → β''} (hη' : IsExpansion P' P'' η'v η'e) + {f : β'} (hf : f ∈ P'.dom) {p : α'} (hp : p ∈ P'.G.ends f) {a : α''} : + (a ∈ P''.G.ends (η'e f) ∧ a ∈ η'v p) ↔ + MarchCorresponds (P'.μ f) (P''.μ (η'e f)) p a := by + have hfE : f ∈ P'.G.edgeSet := P'.dom_subset hf + have he'' : η'e f ∈ P''.dom := (hη'.mem_dom_iff f hfE).mp hf + constructor + · rintro ⟨ha_end, hap⟩ + have ha_mem : a ∈ P''.μ (η'e f) := by + rwa [← P''.μ_set (η'e f) he''] at ha_end + obtain ⟨i, hi', rfl⟩ := List.getElem_of_mem ha_mem + have hi : i < (P'.μ f).length := (hη'.μ_length f hf).symm ▸ hi' + have hmem_i : (P''.μ (η'e f))[i] ∈ η'v (P'.μ f)[i] := hη'.μ_mem f hf i hi hi' + have hp_i_end : (P'.μ f)[i] ∈ P'.G.ends f := by + rw [← P'.μ_set f hf] + exact List.getElem_mem hi + have hEq : (P'.μ f)[i] = p := by + by_contra hne + exact Set.disjoint_left.mp + (hη'.vertex_disjoint (P'.μ f)[i] (P'.G.vertex_mem_of_inc hp_i_end) + p (P'.G.vertex_mem_of_inc hp) hne) + hmem_i hap + exact ⟨i, hi, hi', hEq, rfl⟩ + · rintro ⟨i, hi, hi', rfl, rfl⟩ + refine ⟨?_, hη'.μ_mem f hf i hi hi'⟩ + rw [← P''.μ_set (η'e f) he''] + exact List.getElem_mem hi' + +theorem expandedGrouping_eq_marchMapSubgraph {P' : Patchwork Ω α' β'} {P'' : Patchwork Ω α'' β''} + {η'v : α' → Set α''} {η'e : β' → β''} (hη' : IsExpansion P' P'' η'v η'e) + {f : β'} (hf : f ∈ P'.dom) {δ : (⊤ : SimpleGraph α').Subgraph} (hδ : δ ∈ P'.Δ f) : + expandedGrouping (P''.G.ends (η'e f)) η'v δ = + marchMapSubgraph (P'.μ f) (P''.μ (η'e f)) δ := by + have hfE : f ∈ P'.G.edgeSet := P'.dom_subset hf + have he'' : η'e f ∈ P''.dom := (hη'.mem_dom_iff f hfE).mp hf + have hδ_verts : δ.verts = P'.G.ends f := + ((P'.Δ f).verts_eq δ hδ).trans (P'.Δ_verts f hfE) + have hδ_grp : IsGrouping (P'.G.ends f) δ := + P'.Δ_verts f hfE ▸ (P'.Δ f).isGrouping δ hδ + ext a b + · simp only [expandedGrouping, marchMapSubgraph, Set.mem_ofPred_eq, hδ_verts] + constructor + · intro ha + have ha_mem : a ∈ P''.μ (η'e f) := by rwa [← P''.μ_set (η'e f) he''] at ha + obtain ⟨i, hi', rfl⟩ := List.getElem_of_mem ha_mem + have hi : i < (P'.μ f).length := (hη'.μ_length f hf).symm ▸ hi' + refine ⟨(P'.μ f)[i], ?_, ⟨i, hi, hi', rfl, rfl⟩⟩ + rw [← P'.μ_set f hf] + exact List.getElem_mem hi + · rintro ⟨x, hx, hcorr⟩ + exact ((mem_η_iff_marchCorresponds hη' hf hx).mpr hcorr).1 + · simp only [expandedGrouping, marchMapSubgraph] + constructor + · rintro ⟨ha, hb, hne, p, q, hpq, hap, hbq⟩ + obtain ⟨hp_verts, hq_verts, _⟩ := sameComponent_iff.mp hpq + have hp_end : p ∈ P'.G.ends f := hδ_verts ▸ hp_verts + have hq_end : q ∈ P'.G.ends f := hδ_verts ▸ hq_verts + have hcorr_p := (mem_η_iff_marchCorresponds hη' hf hp_end).mp ⟨ha, hap⟩ + have hcorr_q := (mem_η_iff_marchCorresponds hη' hf hq_end).mp ⟨hb, hbq⟩ + have hpq_ne : p ≠ q := by + intro hEq + subst hEq + exact hne (marchCorresponds_unique_right (P'.μ_nodup f hf) hcorr_p hcorr_q) + exact ⟨hne, p, q, hcorr_p, hcorr_q, + (sameComponent_iff_adj_of_isGrouping hδ_grp hpq_ne).mp hpq⟩ + · rintro ⟨hne, p, q, hcorr_p, hcorr_q, hadj⟩ + have hp_end : p ∈ P'.G.ends f := hδ_verts ▸ δ.edge_vert hadj + have hq_end : q ∈ P'.G.ends f := hδ_verts ▸ δ.edge_vert hadj.symm + obtain ⟨ha, hap⟩ := (mem_η_iff_marchCorresponds hη' hf hp_end).mpr hcorr_p + obtain ⟨hb, hbq⟩ := (mem_η_iff_marchCorresponds hη' hf hq_end).mpr hcorr_q + exact ⟨ha, hb, hne, p, q, sameComponent_of_adj hadj, hap, hbq⟩ + +/-- Graph Minors IV, (7.1), claim (6) (page 246): +For `f ∈ E(G')` with `e = η'(f)` and `δ_f ∈ Δ'(f)`, the subgraph `δ''_e` (`expandedGrouping`) +belongs to `Δ''(e)`. -/ +theorem lemma_7_1_claim_6 {P' : Patchwork Ω α' β'} {P'' : Patchwork Ω α'' β''} + {η'v : α' → Set α''} {η'e : β' → β''} (hη' : IsExpansion P' P'' η'v η'e) + {f : β'} (hf : f ∈ P'.G.edgeSet) {δf : (⊤ : SimpleGraph α').Subgraph} (hδf : δf ∈ P'.Δ f) : + expandedGrouping (P''.G.ends (η'e f)) η'v δf ∈ P''.Δ (η'e f) := by + have he : η'e f ∈ P''.G.edgeSet := hη'.edge_mem f hf + by_cases hf_dom : f ∈ P'.dom + · rw [expandedGrouping_eq_marchMapSubgraph hη' hf_dom hδf] + exact hη'.maps_Δ f hf_dom hδf + · have he_not_dom : η'e f ∉ P''.dom := fun hd ↦ hf_dom ((hη'.mem_dom_iff f hf).mpr hd) + have hfree : (P''.Δ (η'e f)).IsFree := P''.Δ_free (η'e f) he he_not_dom + have hδf_verts : δf.verts ⊆ P'.G.vertexSet := by + rw [((P'.Δ f).verts_eq δf hδf).trans (P'.Δ_verts f hf)] + exact fun _ hv ↦ P'.G.vertex_mem_of_inc hv + have hgrp : IsGrouping (P''.Δ (η'e f)).verts (expandedGrouping (P''.G.ends (η'e f)) η'v δf) + := by + rw [P''.Δ_verts (η'e f) he] + exact expandedGrouping_isGrouping hη' _ hδf_verts + exact hfree _ hgrp (P''.Δ_verts (η'e f) he).symm + +/-! ### Composition of realizable expansions: Graph Minors IV, (7.1), claims (7)–(9) -/ + +open Classical in +/-- The family `δ''` constructed in the proof of (7.1) (Graph Minors IV, page 246): +for `e ∈ E(G'') - η''(E(G))`, `δ''_e = δ'_e` if `e ∉ η'(E(G'))`, and `δ''_e` is the expanded +grouping of `δ_f` if `e = η'(f)` with `f ∈ E(G')`. -/ +noncomputable def compRealizationChoice (P' : Patchwork Ω α' β') (P'' : Patchwork Ω α'' β'') + (η'v : α' → Set α'') (η'e : β' → β'') + (δ : β' → (⊤ : SimpleGraph α').Subgraph) (δ' : β'' → (⊤ : SimpleGraph α'').Subgraph) + (e : β'') : (⊤ : SimpleGraph α'').Subgraph := + if h : ∃ f ∈ P'.G.edgeSet, η'e f = e then + expandedGrouping (P''.G.ends e) η'v (δ h.choose) + else + δ' e + +omit [Preorder Ω] in +theorem compRealizationChoice_of_notMem {P' : Patchwork Ω α' β'} {P'' : Patchwork Ω α'' β''} + {η'v : α' → Set α''} {η'e : β' → β''} + {δ : β' → (⊤ : SimpleGraph α').Subgraph} {δ' : β'' → (⊤ : SimpleGraph α'').Subgraph} + {e : β''} (he : e ∉ η'e '' P'.G.edgeSet) : + compRealizationChoice P' P'' η'v η'e δ δ' e = δ' e := by + have h : ¬∃ f ∈ P'.G.edgeSet, η'e f = e := fun ⟨f, hf, hfe⟩ ↦ he ⟨f, hf, hfe⟩ + dsimp only [compRealizationChoice] + rw [dite_eq_right_of_eq_false (eq_false h)] + +theorem compRealizationChoice_apply_image {P' : Patchwork Ω α' β'} {P'' : Patchwork Ω α'' β''} + {η'v : α' → Set α''} {η'e : β' → β''} (hη' : IsExpansion P' P'' η'v η'e) + {δ : β' → (⊤ : SimpleGraph α').Subgraph} {δ' : β'' → (⊤ : SimpleGraph α'').Subgraph} + {f : β'} (hf : f ∈ P'.G.edgeSet) : + compRealizationChoice P' P'' η'v η'e δ δ' (η'e f) = + expandedGrouping (P''.G.ends (η'e f)) η'v (δ f) := by + have h : ∃ f' ∈ P'.G.edgeSet, η'e f' = η'e f := ⟨f, hf, rfl⟩ + dsimp only [compRealizationChoice] + rw [dite_eq_left_of_eq_true (eq_true h)] + have hf_eq : h.choose = f := hη'.edge_injOn h.choose_spec.1 hf h.choose_spec.2 + rw [hf_eq] + +/-- Graph Minors IV, (7.1), claim (7) (page 246): +"No edge of $H''$ joins a vertex of $\eta''(v)$ to a vertex of $V(G'') - \eta''(v)$." -/ +theorem lemma_7_1_claim_7 {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {P'' : Patchwork Ω α'' β''} {ηv : α → Set α'} {ηe : β → β'} + {η'v : α' → Set α''} {η'e : β' → β''} + (hη : IsExpansion P P' ηv ηe) (hη' : IsExpansion P' P'' η'v η'e) + {δ : β' → (⊤ : SimpleGraph α').Subgraph} + (hδ : ∀ f ∈ (P'.deleteEdges (ηe '' P.G.edgeSet)).G.edgeSet, δ f ∈ P'.Δ f) + (hH_real : Realizes P P' ηv ηe + (realizationOf (P'.deleteEdges (ηe '' P.G.edgeSet)).G.toHypergraph δ)) + {δ' : β'' → (⊤ : SimpleGraph α'').Subgraph} + (hH'_real : Realizes P' P'' η'v η'e + (realizationOf (P''.deleteEdges (η'e '' P'.G.edgeSet)).G.toHypergraph δ')) + {v : α} (hv : v ∈ P.G.vertexSet) {a b : α''} (ha : a ∈ compVertex ηv η'v v) + (hab : (realizationOf + (P''.deleteEdges (compEdge ηe η'e '' P.G.edgeSet)).G.toHypergraph + (compRealizationChoice P' P'' η'v η'e δ δ')).Adj a b) : + b ∈ compVertex ηv η'v v := by + obtain ⟨v', hv', ha_v'⟩ := mem_compVertex_iff.mp ha + have hv'V : v' ∈ P'.G.vertexSet := hη.vertex_subset v hv hv' + rw [realizationOf_adj] at hab + obtain ⟨e, ⟨heE, he_not_comp⟩, hab⟩ := hab + by_cases he_im : e ∈ η'e '' P'.G.edgeSet + · obtain ⟨f, hfE, rfl⟩ := he_im + have hf_not_im : f ∉ ηe '' P.G.edgeSet := by + rintro ⟨g, hg, rfl⟩ + exact he_not_comp ⟨g, hg, rfl⟩ + have hf_del : f ∈ (P'.deleteEdges (ηe '' P.G.edgeSet)).G.edgeSet := ⟨hfE, hf_not_im⟩ + rw [compRealizationChoice_apply_image hη' hfE] at hab + obtain ⟨_, _, _, p, q, hpq, hap, hbq⟩ := hab + have hδf_verts : (δ f).verts = P'.G.ends f := + ((P'.Δ f).verts_eq (δ f) (hδ f hf_del)).trans (P'.Δ_verts f hfE) + obtain ⟨hp_verts, _, _⟩ := sameComponent_iff.mp hpq + have hpV : p ∈ P'.G.vertexSet := P'.G.vertex_mem_of_inc (hδf_verts ▸ hp_verts) + have hp_eq : p = v' := by + by_contra hne + exact Set.disjoint_left.mp (hη'.vertex_disjoint p hpV v' hv'V hne) hap ha_v' + subst hp_eq + let H := realizationOf (P'.deleteEdges (ηe '' P.G.edgeSet)).G.toHypergraph δ + have hδf_le_H : δ f ≤ H := by + refine ⟨fun x hx ↦ ?_, fun x y hxy ↦ realizationOf_adj.mpr ⟨f, hf_del, hxy⟩⟩ + rw [hH_real.1.verts_eq] + exact P'.G.vertex_mem_of_inc (hδf_verts ▸ hx) + have hpq_H : sameComponent H p q := hpq.mono hδf_le_H + obtain ⟨D, hD, hD_verts⟩ := hH_real.2 v hv + obtain ⟨D', hD', hpD', hqD'⟩ := hpq_H + have hD_eq : D' = D := hD'.eq_of_mem hD hpD' (hD_verts ▸ hv') + have hq_mem : q ∈ ηv v := hD_verts ▸ hD_eq ▸ hqD' + exact mem_compVertex_iff.mpr ⟨q, hq_mem, hbq⟩ + · rw [compRealizationChoice_of_notMem he_im] at hab + let H' := realizationOf (P''.deleteEdges (η'e '' P'.G.edgeSet)).G.toHypergraph δ' + have hab_H' : H'.Adj a b := realizationOf_adj.mpr ⟨e, ⟨heE, he_im⟩, hab⟩ + obtain ⟨D', hD', hD'_verts⟩ := hH'_real.2 v' hv'V + have hclosed := ((exists_isComponent_verts_eq_iff (hη'.vertex_nonempty v' hv'V) + (hH'_real.1.verts_eq.symm ▸ hη'.vertex_subset v' hv'V)).mp ⟨D', hD', hD'_verts⟩).1 + exact mem_compVertex_iff.mpr ⟨v', hv', hclosed a ha_v' b hab_H'⟩ + +/-- Graph Minors IV, (7.1), claim (8) (page 246): +"If $p, q \in V(H)$ are adjacent in $H$ then there exist $a \in \eta'(p)$ and $b \in +\eta'(q)$ adjacent in $H''$." -/ +theorem lemma_7_1_claim_8 {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {P'' : Patchwork Ω α'' β''} {ηv : α → Set α'} {ηe : β → β'} + {η'v : α' → Set α''} {η'e : β' → β''} + (hη : IsExpansion P P' ηv ηe) (hη' : IsExpansion P' P'' η'v η'e) + {δ : β' → (⊤ : SimpleGraph α').Subgraph} + (hδ : ∀ f ∈ (P'.deleteEdges (ηe '' P.G.edgeSet)).G.edgeSet, δ f ∈ P'.Δ f) + {δ' : β'' → (⊤ : SimpleGraph α'').Subgraph} + {p q : α'} + (hpq : (realizationOf (P'.deleteEdges (ηe '' P.G.edgeSet)).G.toHypergraph δ).Adj p q) : + ∃ a ∈ η'v p, ∃ b ∈ η'v q, + (realizationOf + (P''.deleteEdges (compEdge ηe η'e '' P.G.edgeSet)).G.toHypergraph + (compRealizationChoice P' P'' η'v η'e δ δ')).Adj a b := by + rw [realizationOf_adj] at hpq + obtain ⟨f, hf_del, hpq_adj⟩ := hpq + have hfE : f ∈ P'.G.edgeSet := hf_del.1 + have hδf_verts : (δ f).verts = P'.G.ends f := + ((P'.Δ f).verts_eq (δ f) (hδ f hf_del)).trans (P'.Δ_verts f hfE) + have hp_end : p ∈ P'.G.ends f := hδf_verts ▸ (δ f).edge_vert hpq_adj + have hq_end : q ∈ P'.G.ends f := hδf_verts ▸ (δ f).edge_vert hpq_adj.symm + obtain ⟨a, hap, ha_inc⟩ := hη'.exists_inc_of_inc hfE hp_end + obtain ⟨b, hbq, hb_inc⟩ := hη'.exists_inc_of_inc hfE hq_end + have hab_ne : a ≠ b := by + intro hEq + subst hEq + exact Set.disjoint_left.mp + (hη'.vertex_disjoint p (P'.G.vertex_mem_of_inc hp_end) + q (P'.G.vertex_mem_of_inc hq_end) hpq_adj.ne) + hap hbq + refine ⟨a, hap, b, hbq, realizationOf_adj.mpr ⟨η'e f, ⟨hη'.edge_mem f hfE, ?_⟩, ?_⟩⟩ + · rintro ⟨g, hg, hEq⟩ + exact hf_del.2 ⟨g, hg, hη'.edge_injOn (hη.edge_mem g hg) hfE hEq⟩ + · rw [compRealizationChoice_apply_image hη' hfE] + exact ⟨ha_inc, hb_inc, hab_ne, p, q, sameComponent_of_adj hpq_adj, hap, hbq⟩ + +/-- Graph Minors IV, (7.1), claim (9) (pages 246–247): +"If $a, b \in \eta''(v)$ then $a, b$ belong to the same component of $H''$." -/ +theorem lemma_7_1_claim_9 {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {P'' : Patchwork Ω α'' β''} {ηv : α → Set α'} {ηe : β → β'} + {η'v : α' → Set α''} {η'e : β' → β''} + (hη : IsExpansion P P' ηv ηe) (hη' : IsExpansion P' P'' η'v η'e) + {δ : β' → (⊤ : SimpleGraph α').Subgraph} + (hδ : ∀ f ∈ (P'.deleteEdges (ηe '' P.G.edgeSet)).G.edgeSet, δ f ∈ P'.Δ f) + (hH_real : Realizes P P' ηv ηe + (realizationOf (P'.deleteEdges (ηe '' P.G.edgeSet)).G.toHypergraph δ)) + {δ' : β'' → (⊤ : SimpleGraph α'').Subgraph} + (hδ' : ∀ e ∈ (P''.deleteEdges (η'e '' P'.G.edgeSet)).G.edgeSet, δ' e ∈ P''.Δ e) + (hH'_real : Realizes P' P'' η'v η'e + (realizationOf (P''.deleteEdges (η'e '' P'.G.edgeSet)).G.toHypergraph δ')) + {v : α} (hv : v ∈ P.G.vertexSet) + {a b : α''} (ha : a ∈ compVertex ηv η'v v) (hb : b ∈ compVertex ηv η'v v) : + sameComponent + (realizationOf + (P''.deleteEdges (compEdge ηe η'e '' P.G.edgeSet)).G.toHypergraph + (compRealizationChoice P' P'' η'v η'e δ δ')) + a b := by + let H := realizationOf (P'.deleteEdges (ηe '' P.G.edgeSet)).G.toHypergraph δ + let H' := realizationOf (P''.deleteEdges (η'e '' P'.G.edgeSet)).G.toHypergraph δ' + let δ'' := compRealizationChoice P' P'' η'v η'e δ δ' + let H'' := realizationOf (P''.deleteEdges (compEdge ηe η'e '' P.G.edgeSet)).G.toHypergraph δ'' + have hδ''_mem : ∀ e ∈ (P''.deleteEdges (compEdge ηe η'e '' P.G.edgeSet)).G.edgeSet, + δ'' e ∈ P''.Δ e := by + rintro e ⟨heE, he_not_comp⟩ + dsimp only [δ''] + by_cases he_im : e ∈ η'e '' P'.G.edgeSet + · obtain ⟨f, hfE, rfl⟩ := he_im + have hf_not_im : f ∉ ηe '' P.G.edgeSet := by + rintro ⟨g, hg, rfl⟩ + exact he_not_comp ⟨g, hg, rfl⟩ + rw [compRealizationChoice_apply_image hη' hfE] + exact lemma_7_1_claim_6 hη' hfE (hδ f ⟨hfE, hf_not_im⟩) + · rw [compRealizationChoice_of_notMem he_im] + exact hδ' e ⟨heE, he_im⟩ + have hH''_real : (P''.deleteEdges (compEdge ηe η'e '' P.G.edgeSet)).IsRealization H'' := + ⟨δ'', hδ''_mem, rfl⟩ + have hH'_le_H'' : H' ≤ H'' := by + refine ⟨?_, fun x y hxy ↦ ?_⟩ + · rw [hH'_real.1.verts_eq, hH''_real.verts_eq] + exact subset_rfl + · rw [realizationOf_adj] at hxy ⊢ + obtain ⟨e, ⟨heE, he_not⟩, hxy⟩ := hxy + have he_not_comp : e ∉ compEdge ηe η'e '' P.G.edgeSet := by + rintro ⟨g, hg, rfl⟩ + exact he_not ⟨ηe g, hη.edge_mem g hg, rfl⟩ + refine ⟨e, ⟨heE, he_not_comp⟩, ?_⟩ + dsimp only [δ''] + rwa [compRealizationChoice_of_notMem he_not] + have hsame_v' : ∀ r ∈ P'.G.vertexSet, ∀ x ∈ η'v r, ∀ y ∈ η'v r, sameComponent H'' x y := by + intro r hr x hx y hy + obtain ⟨D', hD', hD'_verts⟩ := hH'_real.2 r hr + have hconn := ((exists_isComponent_verts_eq_iff (hη'.vertex_nonempty r hr) + (hH'_real.1.verts_eq.symm ▸ hη'.vertex_subset r hr)).mp ⟨D', hD', hD'_verts⟩).2 + exact (hconn x hx y hy).mono hH'_le_H'' + obtain ⟨p, hp, hap⟩ := mem_compVertex_iff.mp ha + obtain ⟨q, hq, hbq⟩ := mem_compVertex_iff.mp hb + obtain ⟨D, hD, hD_verts⟩ := hH_real.2 v hv + have hconn_H := ((exists_isComponent_verts_eq_iff (hη.vertex_nonempty v hv) + (hH_real.1.verts_eq.symm ▸ hη.vertex_subset v hv)).mp ⟨D, hD, hD_verts⟩).2 + obtain ⟨hpH, hqH, hreach⟩ := sameComponent_iff.mp (hconn_H p hp q hq) + suffices ∀ x y : H.verts, H.coe.Reachable x y → + ∀ x'' ∈ η'v x.1, ∀ y'' ∈ η'v y.1, sameComponent H'' x'' y'' from + this ⟨p, hpH⟩ ⟨q, hqH⟩ hreach a hap b hbq + intro x y hxy + rw [reachable_iff_reflTransGen] at hxy + induction hxy with + | refl => + intro x'' hx'' y'' hy'' + have hxV : x.1 ∈ P'.G.vertexSet := hH_real.1.verts_eq ▸ x.2 + exact hsame_v' x.1 hxV x'' hx'' y'' hy'' + | @tail w z _ hwz ih => + intro x'' hx'' z'' hz'' + obtain ⟨c, hc, d, hd, hcd⟩ := lemma_7_1_claim_8 hη hη' hδ hwz + have hzV : z.1 ∈ P'.G.vertexSet := hH_real.1.verts_eq ▸ z.2 + exact ((ih x'' hx'' c hc).trans (sameComponent_of_adj hcd)).trans + (hsame_v' z.1 hzV d hd z'' hz'') + +/-- Second statement of Graph Minors IV, (7.1) (pages 245–247): if `η` is a realizable expansion +of `P` in `P'` and `η'` is a realizable expansion of `P'` in `P''`, then the composed expansion +`η'' = (compVertex ηv η'v, compEdge ηe η'e)` is realizable. -/ +theorem IsRealizableExpansion.comp {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {P'' : Patchwork Ω α'' β''} {ηv : α → Set α'} {ηe : β → β'} + {η'v : α' → Set α''} {η'e : β' → β''} + (hη : IsRealizableExpansion P P' ηv ηe) (hη' : IsRealizableExpansion P' P'' η'v η'e) : + IsRealizableExpansion P P'' (compVertex ηv η'v) (compEdge ηe η'e) := by + have hcomp_exp := hη.1.comp hη'.1 + obtain ⟨H, ⟨δ, hδ, rfl⟩, hH_comp⟩ := hη.2 + obtain ⟨H', ⟨δ', hδ', rfl⟩, hH'_comp⟩ := hη'.2 + have hH_real : Realizes P P' ηv ηe + (realizationOf (P'.deleteEdges (ηe '' P.G.edgeSet)).G.toHypergraph δ) := + ⟨⟨δ, hδ, rfl⟩, hH_comp⟩ + have hH'_real : Realizes P' P'' η'v η'e + (realizationOf (P''.deleteEdges (η'e '' P'.G.edgeSet)).G.toHypergraph δ') := + ⟨⟨δ', hδ', rfl⟩, hH'_comp⟩ + let δ'' := compRealizationChoice P' P'' η'v η'e δ δ' + let H'' := realizationOf (P''.deleteEdges (compEdge ηe η'e '' P.G.edgeSet)).G.toHypergraph δ'' + have hδ''_mem : ∀ e ∈ (P''.deleteEdges (compEdge ηe η'e '' P.G.edgeSet)).G.edgeSet, + δ'' e ∈ P''.Δ e := by + rintro e ⟨heE, he_not_comp⟩ + dsimp only [δ''] + by_cases he_im : e ∈ η'e '' P'.G.edgeSet + · obtain ⟨f, hfE, rfl⟩ := he_im + have hf_not_im : f ∉ ηe '' P.G.edgeSet := by + rintro ⟨g, hg, rfl⟩ + exact he_not_comp ⟨g, hg, rfl⟩ + rw [compRealizationChoice_apply_image hη'.1 hfE] + exact lemma_7_1_claim_6 hη'.1 hfE (hδ f ⟨hfE, hf_not_im⟩) + · rw [compRealizationChoice_of_notMem he_im] + exact hδ' e ⟨heE, he_im⟩ + have hH''_isReal : (P''.deleteEdges (compEdge ηe η'e '' P.G.edgeSet)).IsRealization H'' := + ⟨δ'', hδ''_mem, rfl⟩ + refine ⟨hcomp_exp, H'', hH''_isReal, fun v hv ↦ ?_⟩ + rw [exists_isComponent_verts_eq_iff (hcomp_exp.vertex_nonempty v hv) + (hH''_isReal.verts_eq.symm ▸ hcomp_exp.vertex_subset v hv)] + exact ⟨fun a ha b hab ↦ lemma_7_1_claim_7 hη.1 hη'.1 hδ hH_real hH'_real hv ha hab, + fun a ha b hb ↦ lemma_7_1_claim_9 hη.1 hη'.1 hδ hH_real hδ' hH'_real hv ha hb⟩ + +/-! ### Reflexivity and transitivity of simulation -/ + +/-- The identity expansion `(v ↦ {v}, e ↦ e)` of an `Ω`-patchwork `P` in itself +(Graph Minors IV, Section 7, page 247). -/ +theorem IsExpansion.id (P : Patchwork Ω α β) : + IsExpansion P P (fun v ↦ {v}) _root_.id where + vertex_nonempty v _ := Set.singleton_nonempty v + vertex_subset _ hv _ h := h.symm ▸ hv + edge_mem _ he := he + vertex_disjoint _ _ _ _ hne := Set.disjoint_singleton.mpr hne + edge_injOn _ _ _ _ h := h + mem_dom_iff _ _ := Iff.rfl + ends_nonempty _ _ _ v hv := ⟨v, rfl, hv⟩ + μ_length _ _ := rfl + μ_mem _ _ _ _ _ := rfl + roots_length := rfl + roots_mem _ _ _ := rfl + maps_Δ e he δ hδ := by + have heE : e ∈ P.G.edgeSet := P.dom_subset he + have hverts : δ.verts ⊆ {x | x ∈ P.μ e} := by + rw [((P.Δ e).verts_eq δ hδ).trans (P.Δ_verts e heE), P.μ_set e he] + dsimp only [_root_.id] + rwa [marchMapSubgraph_id hverts] + φ_le _ _ := le_rfl + +/-- The identity expansion of `P` in itself is realizable, realized by `N_{V(G)}` +(Graph Minors IV, Section 7, page 247). -/ +theorem IsRealizableExpansion.id (P : Patchwork Ω α β) : + IsRealizableExpansion P P (fun v ↦ {v}) _root_.id := by + refine ⟨IsExpansion.id P, emptySubgraph P.G.vertexSet, ?_, fun v hv ↦ ?_⟩ + · refine ⟨fun _ ↦ emptySubgraph ∅, fun e ⟨he, hnot⟩ ↦ ?_, ?_⟩ + · exact False.elim (hnot ⟨e, he, rfl⟩) + · ext u w + · simp [Patchwork.deleteEdges, RootedHypergraph.deleteEdges, Hypergraph.deleteEdges, + realizationOf] + · simp only [not_emptySubgraph_adj, realizationOf_adj, false_iff, not_exists] + rintro e ⟨⟨he, hnot⟩, _⟩ + exact hnot ⟨e, he, rfl⟩ + · let x : (emptySubgraph P.G.vertexSet).verts := ⟨v, hv⟩ + refine ⟨component (emptySubgraph P.G.vertexSet) x, ⟨x, rfl⟩, ?_⟩ + ext w + simp only [component_verts, mem_componentVerts_iff, emptySubgraph_verts, + Set.mem_singleton_iff] + refine ⟨?_, fun hEq ↦ hEq ▸ ⟨hv, Reachable.refl x⟩⟩ + rintro ⟨hw, hr⟩ + suffices ∀ y : (emptySubgraph P.G.vertexSet).verts, + (emptySubgraph P.G.vertexSet).coe.Reachable x y → y.1 = x.1 from + this ⟨w, hw⟩ hr + intro y hy + rw [reachable_iff_reflTransGen] at hy + induction hy with + | refl => rfl + | @tail _ _ _ hab => exact False.elim hab + +/-- Simulation of `Ω`-patchworks is reflexive (Graph Minors IV, (7.1), page 247). -/ +theorem Simulated.refl (P : Patchwork Ω α β) : Simulated P P := + ⟨fun v ↦ {v}, _root_.id, IsRealizableExpansion.id P⟩ + +/-- Simulation of `Ω`-patchworks is transitive (Graph Minors IV, (7.1), page 247). -/ +theorem Simulated.trans {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {P'' : Patchwork Ω α'' β''} (h₁ : Simulated P P') (h₂ : Simulated P' P'') : + Simulated P P'' := by + obtain ⟨ηv, ηe, hη⟩ := h₁ + obtain ⟨η'v, η'e, hη'⟩ := h₂ + exact ⟨compVertex ηv η'v, compEdge ηe η'e, hη.comp hη'⟩ + +/-- **Graph Minors IV, (7.1)** (pages 244–247): If `η = (ηv, ηe)` is an expansion of `P` in `P'` +and `η' = (η'v, η'e)` is an expansion of `P'` in `P''`, then `η'' = (compVertex ηv η'v, compEdge ηe +η'e)` +is an expansion of `P` in `P''`; and if `η` and `η'` are realizable then so is `η''`. -/ +theorem theorem_7_1_proof {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {P'' : Patchwork Ω α'' β''} {ηv : α → Set α'} {ηe : β → β'} + {η'v : α' → Set α''} {η'e : β' → β''} + (hη : IsExpansion P P' ηv ηe) (hη' : IsExpansion P' P'' η'v η'e) : + IsExpansion P P'' (compVertex ηv η'v) (compEdge ηe η'e) ∧ + ((∃ H, Realizes P P' ηv ηe H) → (∃ H', Realizes P' P'' η'v η'e H') → + ∃ H'', Realizes P P'' (compVertex ηv η'v) (compEdge ηe η'e) H'') := + ⟨hη.comp hη', fun h₁ h₂ ↦ (IsRealizableExpansion.comp ⟨hη, h₁⟩ ⟨hη', h₂⟩).2⟩ + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/Patchwork/Main.lean b/LeanPool/GraphMinor/GM04/Patchwork/Main.lean new file mode 100644 index 0000000000..e3e0275532 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Patchwork/Main.lean @@ -0,0 +1,399 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Minor.Model +public import LeanPool.GraphMinor.GM04.Patchwork.VerifyAxioms +import LeanPool.GraphMinor.GM04.Patchwork.Menger +import LeanPool.GraphMinor.GM04.Patchwork.Expansion + +/-! +# Deduction of Graph Minors IV, (1.5) from (9.1) + +This file formalizes the deduction of (1.5) ("(1.5) *For any integer $k$ the class of all graphs +with tree-width $\le k$ is well-quasi-ordered by minors.*") from (9.1) in Graph Minors IV, Section 9 +(pages +252–253): + +* `graphPatch`: for a vertex set `U`, the patch `{N_U, K_U}` consisting of the empty and complete + subgraphs on `U`. +* `graphPatch_isRobust`: when `U` has at most two elements (as is the case for the ends of an edge + in a graph), `graphPatch U` is a robust patch. +* `graphPatchwork`: the `Unit`-patchwork `P(G) = ((G, 0), μ, Δ, φ)` associated with a finite graph + `G`, where `dom(μ) = E(G)`, `μ(e)` is a march with `μBar(e) = V(e)`, `Δ(e) = {N_{V(e)}, + K_{V(e)}}`, + and `φ(e) = ()`. +* `graphPatchwork_isRobust`: `graphPatchwork G hV hE` is a robust patchwork. +* `isMinorModel_of_simulated`: if `graphPatchwork H hVH hEH` is simulated in + `graphPatchwork G hVG hEG`, then there is a minor model (`IsMinorModel H G ηv ηe`) of `H` in `G`. +* `theorem_1_5`: Graph Minors IV, (1.5). +-/ + +@[expose] public section + +namespace GraphMinor.GM04 + +open SimpleGraph Graph _root_.GraphMinor.Hypergraph + +universe u v u₁ u₂ + +variable {α : Type u} {β : Type v} + +open Classical in +/-- The trivial one-element preorder `Unit` is well-quasi-ordered (`E(Ω) = {1}` on page 252). -/ +theorem wellQuasiOrderedLE_unit : WellQuasiOrderedLE Unit := + ⟨fun _ ↦ ⟨0, 1, Nat.zero_lt_one, le_rfl⟩⟩ + +open Classical in +/-- For a set `U : Set α`, the patch `{N_U, K_U}` consisting of the edgeless subgraph `N_U` and the +complete subgraph `K_U` on `U` (Graph Minors IV, Section 9, page 253, condition (iii)). -/ +def graphPatch (U : Set α) : Patch α where + verts := U + groupings := {emptySubgraph U, completeSubgraph U} + isGrouping := by + rintro K (rfl | rfl) + · exact emptySubgraph_isGrouping U + · exact completeSubgraph_isGrouping U + verts_eq := by + rintro K (rfl | rfl) <;> rfl + +open Classical in +@[simp] +theorem graphPatch_verts (U : Set α) : (graphPatch U).verts = U := rfl + +open Classical in +@[simp] +theorem mem_graphPatch_iff {U : Set α} {K : (⊤ : SimpleGraph α).Subgraph} : + K ∈ graphPatch U ↔ K = emptySubgraph U ∨ K = completeSubgraph U := Iff.rfl + +open Classical in +/-- When any three elements of `U` have at least two equal (so `|U| ≤ 2`), the patch +`graphPatch U = {N_U, K_U}` is robust. -/ +theorem graphPatch_isRobust {U : Set α} (hfin : U.Finite) + (hU : ∀ a ∈ U, ∀ b ∈ U, ∀ c ∈ U, a = b ∨ a = c ∨ b = c) : + (graphPatch U).IsRobust := by + refine ⟨hfin, ?_⟩ + intro X hXU Y hYU hcard hdisj + have hXfin : X.Finite := hfin.subset hXU + have hYfin : Y.Finite := hfin.subset hYU + rcases X.eq_empty_or_nonempty with rfl | ⟨x, hxX⟩ + · have hY0 : Y.ncard = 0 := by simpa using hcard.symm + obtain rfl : Y = ∅ := (Set.ncard_eq_zero (hs := hYfin)).mp hY0 + exact ⟨emptySubgraph U, Or.inl rfl, emptySubgraph_isPairing U, emptySubgraph_pairs_empty U⟩ + · have hYpos : 0 < Y.ncard := by + rw [← hcard] + exact (Set.ncard_pos hXfin).mpr ⟨x, hxX⟩ + obtain ⟨y, hyY⟩ := (Set.ncard_pos hYfin).mp hYpos + have hxU : x ∈ U := hXU hxX + have hyU : y ∈ U := hYU hyY + have hxy : x ≠ y := fun h ↦ Set.disjoint_left.mp hdisj hxX (h ▸ hyY) + have hU_eq : ∀ z ∈ U, z = x ∨ z = y := by + intro z hz + rcases hU z hz x hxU y hyU with rfl | rfl | hEq + · exact Or.inl rfl + · exact Or.inr rfl + · exact absurd hEq hxy + have hX_eq : ∀ z ∈ X, z = x := by + intro z hz + rcases hU_eq z (hXU hz) with rfl | rfl + · rfl + · exact absurd hyY (Set.disjoint_left.mp hdisj hz) + have hY_eq : ∀ z ∈ Y, z = y := by + intro z hz + rcases hU_eq z (hYU hz) with rfl | rfl + · exact absurd hz (Set.disjoint_left.mp hdisj hxX) + · rfl + have hK_pair : IsPairing U (completeSubgraph U) := by + rw [isPairing_iff hfin] + refine ⟨subset_rfl, fun a b c hab hac ↦ ?_⟩ + simp only [completeSubgraph_adj] at hab hac + rcases hU_eq a hab.1 with rfl | rfl <;> + rcases hU_eq b hab.2.1 with rfl | rfl <;> + rcases hU_eq c hac.2.1 with rfl | rfl + all_goals first | rfl | exact absurd rfl hab.2.2 | exact absurd rfl hac.2.2 + refine ⟨completeSubgraph U, Or.inr rfl, hK_pair, ?_⟩ + rw [graphPatch_verts, pairs_iff_of_isPairing hfin hK_pair] + refine ⟨hXU, hYU, hdisj, fun u v huv ↦ ?_, fun v hv ↦ ?_⟩ + · simp only [completeSubgraph_adj] at huv + rcases hU_eq u huv.1 with rfl | rfl <;> + rcases hU_eq v huv.2.1 with rfl | rfl + · exact absurd rfl huv.2.2 + · exact Or.inl ⟨hxX, hyY⟩ + · exact Or.inr ⟨hyY, hxX⟩ + · exact absurd rfl huv.2.2 + · rcases hv with hvX | hvY + · obtain rfl : v = x := hX_eq v hvX + exact ⟨y, hxU, hyU, hxy⟩ + · obtain rfl : v = y := hY_eq v hvY + exact ⟨x, hyU, hxU, hxy.symm⟩ + +open Classical in +theorem ofGraph_ends_finite (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) (e : β) : + ((Hypergraph.ofGraph G hV hE).ends e).Finite := + hV.subset fun _ hv ↦ hv.vertex_mem + +open Classical in +/-- The `Unit`-patchwork `P(G) = ((G, 0), μ, Δ, φ)` associated with a finite graph `G` +(Graph Minors IV, Section 9, pages 252–253). -/ +noncomputable def graphPatchwork (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) : + Patchwork Unit α β where + G := (Hypergraph.ofGraph G hV hE).toRooted + dom := E(G) + μ e := (ofGraph_ends_finite G hV hE e).toFinset.toList + Δ e := graphPatch ((Hypergraph.ofGraph G hV hE).ends e) + φ _ := () + dom_subset := le_rfl + μ_nodup _ _ := Finset.nodup_toList _ + μ_set e _ := by + ext v + simp [Hypergraph.ends, Hypergraph.toRooted] + Δ_verts _ _ := rfl + Δ_free _ he hne := absurd he hne + +open Classical in +@[simp] +theorem graphPatchwork_G (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) : + (graphPatchwork G hV hE).G = (Hypergraph.ofGraph G hV hE).toRooted := rfl + +open Classical in +theorem graphPatchwork_vertexSet (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) : + (graphPatchwork G hV hE).G.vertexSet = V(G) := rfl + +open Classical in +theorem graphPatchwork_edgeSet (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) : + (graphPatchwork G hV hE).G.edgeSet = E(G) := rfl + +open Classical in +theorem graphPatchwork_ends (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) (e : β) : + (graphPatchwork G hV hE).G.ends e = {v | G.Inc e v} := rfl + +open Classical in +@[simp] +theorem graphPatchwork_dom (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) : + (graphPatchwork G hV hE).dom = E(G) := rfl + +open Classical in +@[simp] +theorem graphPatchwork_Δ (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) (e : β) : + (graphPatchwork G hV hE).Δ e = graphPatch {v | G.Inc e v} := rfl + +open Classical in +/-- For any finite graph `G`, `graphPatchwork G hV hE` is a robust `Unit`-patchwork. -/ +theorem graphPatchwork_isRobust (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) : + (graphPatchwork G hV hE).IsRobust := by + intro e _ + refine graphPatch_isRobust (ofGraph_ends_finite G hV hE e) ?_ + intro a ha b hb c hc + exact Inc.eq_or_eq_or_eq ha hb hc + +open Classical in +/-- An expansion between graph patchworks gives an undirected minor model once the patches +outside the retained edges realize its branch sets. The order of each endpoint list is free. -/ +theorem isMinorModel_of_realized_graph_expansion {H G : Graph α β} + {hVH : V(H).Finite} {hEH : E(H).Finite} {hVG : V(G).Finite} {hEG : E(G).Finite} + {PH PG : Patchwork Unit α β} + (hPH : PH.G = (Hypergraph.ofGraph H hVH hEH).toRooted) + (hPG : PG.G = (Hypergraph.ofGraph G hVG hEG).toRooted) + (hdomPH : PH.dom = E(H)) (hdomPG : PG.dom = E(G)) + (hpatch : ∀ e ∈ E(G), PG.Δ e = graphPatch {x | G.Inc e x}) + {ηv : α → Set α} {ηe : β → β} {R : (⊤ : SimpleGraph α).Subgraph} + (hexp : IsExpansion PH PG ηv ηe) (hreal : Realizes PH PG ηv ηe R) : + IsMinorModel H G ηv ηe := by + have hVP : ∀ v, v ∈ PH.G.vertexSet ↔ v ∈ V(H) := by rw [hPH]; exact fun _ => Iff.rfl + have hEP : ∀ e, e ∈ PH.G.edgeSet ↔ e ∈ E(H) := by rw [hPH]; exact fun _ => Iff.rfl + have hdomH : ∀ e, e ∈ PH.dom ↔ e ∈ E(H) := by rw [hdomPH]; exact fun _ => Iff.rfl + have hdomG : ∀ e, e ∈ PG.dom ↔ e ∈ E(G) := by rw [hdomPG]; exact fun _ => Iff.rfl + have hVG : PG.G.vertexSet = V(G) := hPG ▸ rfl + have hEG : PG.G.edgeSet = E(G) := hPG ▸ rfl + have hmemv {v : α} (hv : v ∈ V(H)) : ηv v ⊆ V(G) := + hVG ▸ hexp.vertex_subset v ((hVP v).mpr hv) + have hmap_edge {e : β} (he : e ∈ E(H)) : ηe e ∈ E(G) := + hEG ▸ hexp.edge_mem e ((hEP e).mpr he) + have hendsH (e : β) (he : e ∈ E(H)) : {x | x ∈ PH.μ e} = {x | H.Inc e x} := by + rw [PH.μ_set e ((hdomH e).mpr he), hPH] + rfl + have hendsG (e : β) (he : e ∈ E(G)) : {x | x ∈ PG.μ e} = {x | G.Inc e x} := by + rw [PG.μ_set e ((hdomG e).mpr he), hPG] + rfl + have hinc_iff : ∀ v ∈ V(H), ∀ e ∈ E(H), H.Inc e v ↔ ∃ x ∈ ηv v, G.Inc (ηe e) x := by + intro v hv e he + have hμH := hendsH e he + have hμG := hendsG (ηe e) (hmap_edge he) + constructor + · intro hinc + have hv_mem : v ∈ PH.μ e := by + have hv_ends : v ∈ {u | H.Inc e u} := hinc + rw [← hμH] at hv_ends + exact hv_ends + obtain ⟨r, hr, rfl⟩ := List.mem_iff_getElem.mp hv_mem + have hr' : r < (PG.μ (ηe e)).length := hexp.μ_length e ((hdomH e).mpr he) ▸ hr + refine ⟨(PG.μ (ηe e))[r], hexp.μ_mem e ((hdomH e).mpr he) r hr hr', ?_⟩ + have hx_mem : (PG.μ (ηe e))[r] ∈ {x | x ∈ PG.μ (ηe e)} := List.getElem_mem hr' + rw [hμG] at hx_mem + exact hx_mem + · rintro ⟨x, hxv, hinc'⟩ + have hx_mem : x ∈ PG.μ (ηe e) := by + have hx_ends : x ∈ {u | G.Inc (ηe e) u} := hinc' + rw [← hμG] at hx_ends + exact hx_ends + obtain ⟨r, hr', rfl⟩ := List.mem_iff_getElem.mp hx_mem + have hr : r < (PH.μ e).length := (hexp.μ_length e ((hdomH e).mpr he)).symm ▸ hr' + let w := (PH.μ e)[r] + have hw_inc : H.Inc e w := by + have hw_mem : w ∈ {u | u ∈ PH.μ e} := List.getElem_mem hr + rw [hμH] at hw_mem + exact hw_mem + have hw_v : w ∈ V(H) := hw_inc.vertex_mem + have hxw : (PG.μ (ηe e))[r] ∈ ηv w := hexp.μ_mem e ((hdomH e).mpr he) r hr hr' + have hvw : v = w := by + by_contra hne + exact Set.disjoint_left.mp + (hexp.vertex_disjoint v ((hVP v).mpr hv) w ((hVP w).mpr hw_v) hne) hxv hxw + exact hvw ▸ hw_inc + have hisLoopAt_iff : ∀ v ∈ V(H), ∀ e ∈ E(H), + H.IsLoopAt e v ↔ ∀ x, G.Inc (ηe e) x → x ∈ ηv v := by + intro v hv e he + have hμH := hendsH e he + have hμG := hendsG (ηe e) (hmap_edge he) + constructor + · intro hloop x hinc' + have hx_mem : x ∈ PG.μ (ηe e) := by + have hx_ends : x ∈ {u | G.Inc (ηe e) u} := hinc' + rw [← hμG] at hx_ends + exact hx_ends + obtain ⟨r, hr', rfl⟩ := List.mem_iff_getElem.mp hx_mem + have hr : r < (PH.μ e).length := (hexp.μ_length e ((hdomH e).mpr he)).symm ▸ hr' + let w := (PH.μ e)[r] + have hw_inc : H.Inc e w := by + have hw_mem : w ∈ {u | u ∈ PH.μ e} := List.getElem_mem hr + rw [hμH] at hw_mem + exact hw_mem + have hvw : v = w := hloop.eq_of_inc hw_inc + exact hvw ▸ hexp.μ_mem e ((hdomH e).mpr he) r hr hr' + · intro hall + obtain ⟨a, b, hab⟩ := H.exists_isLink_of_mem_edgeSet he + have ha_eq : a = v := by + obtain ⟨x, hxa, hinc_x⟩ := (hinc_iff a hab.left_mem e he).mp hab.inc_left + have hxv := hall x hinc_x + by_contra hne + exact Set.disjoint_left.mp + (hexp.vertex_disjoint a ((hVP a).mpr hab.left_mem) v ((hVP v).mpr hv) hne) hxa hxv + have hb_eq : b = v := by + obtain ⟨x, hxb, hinc_x⟩ := (hinc_iff b hab.right_mem e he).mp hab.inc_right + have hxv := hall x hinc_x + by_contra hne + exact Set.disjoint_left.mp + (hexp.vertex_disjoint b ((hVP b).mpr hab.right_mem) v ((hVP v).mpr hv) hne) hxb hxv + rw [← isLink_self_iff] + rw [ha_eq, hb_eq] at hab + exact hab + refine ⟨fun v hv ↦ hexp.vertex_nonempty v ((hVP v).mpr hv), fun _ => hmemv, + fun _ => hmap_edge, + fun v₁ hv₁ v₂ hv₂ ↦ hexp.vertex_disjoint v₁ ((hVP v₁).mpr hv₁) v₂ ((hVP v₂).mpr hv₂), + (fun a ha b hb => hexp.edge_injOn ((hEP a).mpr ha) ((hEP b).mpr hb)), + hinc_iff, hisLoopAt_iff, ?_⟩ + intro v hv + let K : Graph α β := (G.deleteEdges (ηe '' E(H))).induce (ηv v) + have hK_le : K ≤ G.deleteEdges (ηe '' E(H)) := + Graph.induce_le (hmemv hv) + refine ⟨K, hK_le, rfl, hexp.vertex_nonempty v ((hVP v).mpr hv), ?_⟩ + intro x hx y hy + obtain ⟨D, ⟨z, rfl⟩, hD_verts⟩ := hreal.2 v ((hVP v).mpr hv) + obtain ⟨δ, hδ, hR_eq⟩ := hreal.1 + have hR_adj_to_K : ∀ a b : R.verts, + a.1 ∈ ηv v → b.1 ∈ ηv v → R.coe.Adj a b → K.Adj a.1 b.1 := by + intro a b ha hb hab + have hR_adj : (realizationOf (PG.deleteEdges (ηe '' PH.G.edgeSet)).G.toHypergraph δ).Adj + a.1 b.1 := by + rw [← hR_eq] + exact hab + rw [realizationOf_adj] at hR_adj + obtain ⟨e', he', hδ_adj⟩ := hR_adj + have hδ_mem := hδ e' he' + have he'_sdiff : e' ∈ PG.G.edgeSet ∧ e' ∉ ηe '' PH.G.edgeSet := he' + have hδ_cases : δ e' = emptySubgraph {w | G.Inc e' w} ∨ + δ e' = completeSubgraph {w | G.Inc e' w} := by + change δ e' ∈ PG.Δ e' at hδ_mem + rw [hpatch e' (hEG ▸ he'_sdiff.1), mem_graphPatch_iff] at hδ_mem + exact hδ_mem + rcases hδ_cases with hEq | hEq + · rw [hEq] at hδ_adj + exact (not_emptySubgraph_adj hδ_adj).elim + · rw [hEq, completeSubgraph_adj] at hδ_adj + obtain ⟨ha_inc, hb_inc, hne⟩ := hδ_adj + change G.Inc e' a.1 at ha_inc + change G.Inc e' b.1 at hb_inc + have hlink : G.IsLink e' a.1 b.1 := by + rw [isLink_iff_inc] + refine ⟨ha_inc, hb_inc, fun w hw ↦ ?_⟩ + rcases Inc.eq_or_eq_or_eq hw ha_inc hb_inc with rfl | rfl | hEq' + · exact Or.inl rfl + · exact Or.inr rfl + · exact absurd hEq' hne + refine ⟨e', ?_⟩ + simp only [K, Graph.induce_isLink, Graph.deleteEdges_isLink] + exact ⟨⟨hlink, fun he' => he'_sdiff.2 + ((show PH.G.edgeSet = E(H) from hPH ▸ rfl).symm ▸ he')⟩, ha, hb⟩ + have hreach_K : ∀ u : R.verts, R.coe.Reachable z u → Relation.ReflTransGen K.Adj z.1 u.1 := by + intro u hr + rw [SimpleGraph.reachable_iff_reflTransGen] at hr + induction hr with + | refl => exact Relation.ReflTransGen.refl + | @tail a b ha_rel hab ih => + have ha_reach : R.coe.Reachable z a := by + rw [SimpleGraph.reachable_iff_reflTransGen] + exact ha_rel + have hb_reach : R.coe.Reachable z b := ha_reach.trans (SimpleGraph.Adj.reachable hab) + have ha_v : a.1 ∈ ηv v := hD_verts ▸ ⟨a.2, ha_reach⟩ + have hb_v : b.1 ∈ ηv v := hD_verts ▸ ⟨b.2, hb_reach⟩ + exact ih.tail (hR_adj_to_K a b ha_v hb_v hab) + have hxD : x ∈ (component R z).verts := hD_verts.symm ▸ hx + have hyD : y ∈ (component R z).verts := hD_verts.symm ▸ hy + obtain ⟨hxR, hx_reach⟩ := hxD + obtain ⟨hyR, hy_reach⟩ := hyD + have hzx : Relation.ReflTransGen K.Adj z.1 x := hreach_K ⟨x, hxR⟩ hx_reach + have hzy : Relation.ReflTransGen K.Adj z.1 y := hreach_K ⟨y, hyR⟩ hy_reach + have hxz : Relation.ReflTransGen K.Adj x z.1 := by + clear *- hzx + induction hzx with + | refl => exact Relation.ReflTransGen.refl + | @tail a b _ hab ih => exact (Relation.ReflTransGen.single hab.symm).trans ih + exact hxz.trans hzy + +open Classical in +/-- If `graphPatchwork H hVH hEH` is simulated in `graphPatchwork G hVG hEG`, then there is a +minor model (`IsMinorModel H G ηv ηe`) of `H` in `G`. -/ +theorem isMinorModel_of_simulated {H G : Graph α β} + {hVH : V(H).Finite} {hEH : E(H).Finite} {hVG : V(G).Finite} {hEG : E(G).Finite} + (hsim : Simulated (graphPatchwork H hVH hEH) (graphPatchwork G hVG hEG)) : + ∃ (ηv : α → Set α) (ηe : β → β), IsMinorModel H G ηv ηe := by + let PH := graphPatchwork H hVH hEH + let PG := graphPatchwork G hVG hEG + obtain ⟨ηv, ηe, hexp, R, hreal⟩ := hsim + exact ⟨ηv, ηe, isMinorModel_of_realized_graph_expansion + (PH := PH) (PG := PG) (hVH := hVH) (hEH := hEH) (hVG := hVG) (hEG := hEG) + rfl rfl rfl rfl (fun _ _ => rfl) hexp hreal⟩ + +open Classical in +/-- Graph Minors IV, (1.5): for every `k`, the class of graphs of tree-width at most `k` is +well-quasi-ordered by minors. -/ +theorem theorem_1_5_of_cited (h53 : Theorem53Statement.{u, v}) (hM : MengerStatement.{u, v}) + (hH : Higman83Statement.{u₁, u₂}) (hModel : MinorModelStatement.{u, v, u, v}) + {α : Type u} {β : Type v} (k : ℕ) (G : ℕ → Graph α β) (hV : ∀ n, V(G n).Finite) + (hE : ∀ n, E(G n).Finite) + (htw : ∀ n, TreeWidthLE (Hypergraph.ofGraph (G n) (hV n) (hE n)).toRooted k) : + ∃ i j, i < j ∧ IsIsoMinor (G i) (G j) := by + obtain ⟨i, j, hij, hsim⟩ := theorem_9_1_proof h53 hM hH wellQuasiOrderedLE_unit k + (fun n ↦ graphPatchwork (G n) (hV n) (hE n)) + (fun n ↦ graphPatchwork_isRobust (G n) (hV n) (hE n)) + (fun n ↦ by rw [graphPatchwork_G]; exact htw n) + obtain ⟨ηv, ηe, hmod⟩ := isMinorModel_of_simulated hsim + exact ⟨i, j, hij, hModel (G i) (G j) (hV i) (hE i) (hV j) (hE j) ηv ηe hmod⟩ + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/Patchwork/Menger.lean b/LeanPool/GraphMinor/GM04/Patchwork/Menger.lean new file mode 100644 index 0000000000..abae81b60b --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Patchwork/Menger.lean @@ -0,0 +1,1135 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Patchwork.Defs +import Mathlib.Algebra.BigOperators.Group.Finset.Basic +import Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected +import Mathlib.Data.Finset.Card + +/-! +# Menger's theorem for robust patchworks (Graph Minors IV, Section 6) + +This file proves the properties of free and robust patches from Graph Minors IV, Section 6 +(pages 241–242) and Section 8 (page 248): + +* `emptySubgraph_isPairing`, `completeSubgraph_isGrouping`: `N_V` is a pairing and `K_V` is a + grouping. +* `Patch.IsFree.isRobust`: every free patch on a finite vertex set is robust. +* `Patch.IsRobust.emptySubgraph_mem` and `Patchwork.IsRobust.isRemovable`: every robust patch on a + finite vertex set contains `N_{V(Δ)}`, so every robust patchwork is removable. +* `Theorem61Cond1`, `Theorem61Cond2`, `Theorem61Cond3`, and `theorem_6_1`: Graph Minors IV, (6.1), + the equivalence of (i), (ii), and (iii) for a robust `Ω`-patchwork, assuming `MengerStatement`. +-/ + +public section + +namespace GraphMinor.GM04 + +open SimpleGraph + +universe u v w + +variable {Ω : Type w} {α : Type u} {β : Type v} + +/-! ### Basic groupings and pairings -/ + +/-- `N_V` (`emptySubgraph V`) is a grouping in `V`. -/ +theorem emptySubgraph_isGrouping (V : Set α) : IsGrouping V (emptySubgraph V) := by + rw [isGrouping_iff] + exact ⟨subset_rfl, fun _ _ _ _ h ↦ False.elim h⟩ + +/-- `N_V` (`emptySubgraph V`) is a pairing in `V`. -/ +theorem emptySubgraph_isPairing (V : Set α) : IsPairing V (emptySubgraph V) := by + refine ⟨emptySubgraph_isGrouping V, ?_⟩ + rintro D ⟨x, rfl⟩ + have hsub : (component (emptySubgraph V) x).verts ⊆ {x.1} := by + rintro w ⟨hw, hr⟩ + suffices ∀ y : (emptySubgraph V).verts, (emptySubgraph V).coe.Reachable x y → y.1 = x.1 from + this ⟨w, hw⟩ hr + intro y hy + rw [reachable_iff_reflTransGen] at hy + induction hy with + | refl => rfl + | @tail z u _ hzu => exact False.elim hzu + exact (Set.encard_mono hsub).trans (by simp) + +/-- `K_V` (`completeSubgraph V`) is a grouping in `V`. -/ +theorem completeSubgraph_isGrouping (V : Set α) : IsGrouping V (completeSubgraph V) := by + rw [isGrouping_iff] + exact ⟨subset_rfl, fun a b c hac ⟨ha, _, _⟩ ⟨_, hc, _⟩ ↦ ⟨ha, hc, hac⟩⟩ + +/-- `N_V` pairs `∅, ∅` in `V`. -/ +theorem emptySubgraph_pairs_empty (V : Set α) : Pairs V (emptySubgraph V) ∅ ∅ := by + refine ⟨Set.empty_subset V, Set.empty_subset V, Set.disjoint_empty _, fun D hD hcard2 ↦ ?_, + fun v hv ↦ by simp at hv⟩ + exfalso + have hle1 : D.verts.ncard ≤ 1 := by + rcases hD with ⟨x, rfl⟩ + have hsub : (component (emptySubgraph V) x).verts ⊆ {x.1} := by + rintro w ⟨hw, hr⟩ + suffices ∀ y : (emptySubgraph V).verts, (emptySubgraph V).coe.Reachable x y → y.1 = x.1 from + this ⟨w, hw⟩ hr + intro y hy + rw [reachable_iff_reflTransGen] at hy + induction hy with + | refl => rfl + | @tail z u _ hzu => exact False.elim hzu + exact (Set.ncard_le_ncard hsub (Set.toFinite {x.1})).trans (by simp) + omega + +/-- Given disjoint subsets `X, Y` of a finite set `V` with `|X| = |Y|`, there is a pairing in `V` +with vertex set `V` that pairs `X, Y`. -/ +theorem exists_pairing_pairs {V X Y : Set α} (hV : V.Finite) (hX : X ⊆ V) (hY : Y ⊆ V) + (hcard : X.ncard = Y.ncard) (hdisj : Disjoint X Y) : + ∃ δ : (⊤ : SimpleGraph α).Subgraph, + δ.verts = V ∧ IsPairing V δ ∧ Pairs V δ X Y := by + classical + have hXfin : X.Finite := hV.subset hX + have hYfin : Y.Finite := hV.subset hY + have : Fintype X := hXfin.fintype + have : Fintype Y := hYfin.fintype + have hcard' : Fintype.card X = Fintype.card Y := by + rw [← Nat.card_eq_fintype_card, ← Nat.card_eq_fintype_card, + Nat.card_coe_set_eq, Nat.card_coe_set_eq, hcard] + obtain ⟨e⟩ := Fintype.truncEquivOfCardEq hcard' + let δ : (⊤ : SimpleGraph α).Subgraph := + { verts := V + Adj := fun u v ↦ + (∃ (hu : u ∈ X), (e ⟨u, hu⟩).1 = v) ∨ (∃ (hv : v ∈ X), (e ⟨v, hv⟩).1 = u) + adj_sub := by + rintro u v (⟨hu, rfl⟩ | ⟨hv, rfl⟩) + · simp only [top_adj] + intro hEq + exact Set.disjoint_left.mp hdisj hu (hEq ▸ (e ⟨u, hu⟩).2) + · simp only [top_adj] + intro hEq + exact Set.disjoint_left.mp hdisj hv (hEq.symm ▸ (e ⟨v, hv⟩).2) + edge_vert := by + rintro u v (⟨hu, _⟩ | ⟨_, rfl⟩) + · exact hX hu + · exact hY (e _).2 + symm := ⟨fun _ _ h ↦ h.symm⟩ } + have hpair : IsPairing V δ := by + rw [isPairing_iff hV] + refine ⟨subset_rfl, fun a b c hab hac ↦ ?_⟩ + rcases hab with ⟨ha, rfl⟩ | ⟨hb, hab⟩ <;> rcases hac with ⟨ha', rfl⟩ | ⟨hc, hac⟩ + · rfl + · exfalso + exact Set.disjoint_left.mp hdisj ha (hac ▸ (e ⟨c, hc⟩).2) + · exfalso + exact Set.disjoint_left.mp hdisj ha' (hab ▸ (e ⟨b, hb⟩).2) + · have hbc : (⟨b, hb⟩ : X) = ⟨c, hc⟩ := e.injective (Subtype.ext (hab.trans hac.symm)) + exact congrArg Subtype.val hbc + refine ⟨δ, rfl, hpair, ?_⟩ + rw [pairs_iff_of_isPairing hV hpair] + refine ⟨hX, hY, hdisj, fun u v huv ↦ ?_, fun v hv ↦ ?_⟩ + · rcases huv with ⟨hu, rfl⟩ | ⟨hv, rfl⟩ + · exact Or.inl ⟨hu, (e ⟨u, hu⟩).2⟩ + · exact Or.inr ⟨(e ⟨v, hv⟩).2, hv⟩ + · rcases hv with hvX | hvY + · exact ⟨(e ⟨v, hvX⟩).1, Or.inl ⟨hvX, rfl⟩⟩ + · exact ⟨(e.symm ⟨v, hvY⟩).1, Or.inr ⟨(e.symm ⟨v, hvY⟩).2, by simp⟩⟩ + +/-- Every free patch on a finite vertex set is robust (Graph Minors IV, Section 6, page 241: +"free patches are robust"). -/ +theorem Patch.IsFree.isRobust {Δ : Patch α} (hfin : Δ.verts.Finite) (hfree : Δ.IsFree) : + Δ.IsRobust := by + refine ⟨hfin, ?_⟩ + intro X hX Y hY hcard hdisj + obtain ⟨δ, hverts, hpair, hpairs⟩ := exists_pairing_pairs hfin hX hY hcard hdisj + exact ⟨δ, hfree δ hpair.1 hverts, hpair, hpairs⟩ + +/-- Every robust patch contains `N_{V(Δ)}`. -/ +theorem Patch.IsRobust.emptySubgraph_mem {Δ : Patch α} (hrob : Δ.IsRobust) : + emptySubgraph Δ.verts ∈ Δ := by + obtain ⟨δ, hδ, hpair, hpairs⟩ := + hrob.exists_pairing ∅ (Set.empty_subset _) ∅ (Set.empty_subset _) rfl (Set.disjoint_empty _) + have hverts : δ.verts = Δ.verts := Δ.verts_eq δ hδ + have hadj := (pairs_iff_of_isPairing hrob.finite_verts hpair).mp hpairs + have hEq : δ = emptySubgraph Δ.verts := by + ext u v + · simp [hverts] + · simp only [not_emptySubgraph_adj, iff_false] + intro huv + rcases hadj.2.2.2.1 u v huv with ⟨hu, _⟩ | ⟨hu, _⟩ <;> exact hu + rwa [← hEq] + +/-- Every robust `Ω`-patchwork is removable (Graph Minors IV, Section 8, page 248: "Evidently +robust patchworks are removable"). -/ +theorem Patchwork.IsRobust.isRemovable {P : Patchwork Ω α β} (hrob : P.IsRobust) : + P.IsRemovable := by + intro e he + have hmem := (hrob e he).emptySubgraph_mem + rwa [P.Δ_verts e he] at hmem + +/-! ### Properties of realizations -/ + +@[simp] +theorem realizationOf_verts {G : Hypergraph α β} {δ : β → (⊤ : SimpleGraph α).Subgraph} + (hδ : ∀ e ∈ G.edgeSet, (δ e).verts = G.ends e) : + (realizationOf G δ).verts = G.vertexSet := by + ext v + simp only [realizationOf, Subgraph.verts_sup, emptySubgraph_verts, Subgraph.verts_iSup, + Set.mem_union, Set.mem_iUnion, exists_prop] + refine ⟨?_, fun hv ↦ Or.inl hv⟩ + rintro (hv | ⟨e, he, hv⟩) + · exact hv + · rw [hδ e he] at hv + exact G.vertex_mem_of_inc hv + +theorem Patchwork.IsRealization.verts_eq {P : Patchwork Ω α β} + {H : (⊤ : SimpleGraph α).Subgraph} (hH : P.IsRealization H) : + H.verts = P.G.vertexSet := by + obtain ⟨δ, hδ, rfl⟩ := hH + exact realizationOf_verts fun e he ↦ ((P.Δ e).verts_eq (δ e) (hδ e he)).trans (P.Δ_verts e he) + +theorem Patchwork.IsRealization.adj_imp_skeleton_adj {P : Patchwork Ω α β} + {H : (⊤ : SimpleGraph α).Subgraph} (hH : P.IsRealization H) {u v : α} (huv : H.Adj u v) : + P.G.toHypergraph.skeleton.Adj u v := by + obtain ⟨δ, hδ, rfl⟩ := hH + rw [realizationOf_adj] at huv + obtain ⟨e, he, huv⟩ := huv + have hverts : (δ e).verts = P.G.ends e := + ((P.Δ e).verts_eq (δ e) (hδ e he)).trans (P.Δ_verts e he) + have hu : u ∈ P.G.ends e := hverts ▸ (δ e).edge_vert huv + have hv : v ∈ P.G.ends e := hverts ▸ (δ e).edge_vert huv.symm + exact ⟨huv.ne, e, hu, hv⟩ + +/-! ### Statements of (6.1)(i), (ii), (iii) -/ + +/-- Condition (i) of Graph Minors IV, (6.1) (page 241): "every separation $(G_1, G_2)$ of $G^-$ with +$X_i \subseteq V(G_i)$ ($i = 1, 2$) has order +$\ge k$". -/ +@[expose] def Theorem61Cond1 (P : Patchwork Ω α β) (X₁ X₂ : Set α) (k : ℕ) : Prop := + ∀ G₁ G₂ : Hypergraph α β, P.G.toHypergraph.IsSeparation G₁ G₂ → + X₁ ⊆ G₁.vertexSet → X₂ ⊆ G₂.vertexSet → k ≤ Hypergraph.separationOrder G₁ G₂ + +/-- Condition (ii) of Graph Minors IV, (6.1) (page 241): "there is a realization of $P$ such that +$k$ of its components have non-empty intersection +with both $X_1$ and $X_2$". -/ +@[expose] def Theorem61Cond2 (P : Patchwork Ω α β) (X₁ X₂ : Set α) (k : ℕ) : Prop := + ∃ (H : (⊤ : SimpleGraph α).Subgraph) (D : Fin k → (⊤ : SimpleGraph α).Subgraph), + P.IsRealization H ∧ Function.Injective D ∧ + (∀ i, IsComponent H (D i) ∧ ((D i).verts ∩ X₁).Nonempty ∧ ((D i).verts ∩ X₂).Nonempty) + +/-- A subgraph `D` is a path of `H` from `X₁` to `X₂` with no vertex except its first in `X₁` and +no vertex except its last in `X₂`. -/ +@[expose] def IsCleanPathSubgraph (H D : (⊤ : SimpleGraph α).Subgraph) (X₁ X₂ : Set α) : Prop := + ∃ p : PathFromTo H.spanningCoe X₁ X₂, + D = H.induce {v | v ∈ p.walk.support} ∧ + (∀ u ∈ p.walk.support, ∀ v ∈ p.walk.support, H.Adj u v ↔ p.walk.toSubgraph.Adj u v) ∧ + (∀ v ∈ p.walk.support, v ∈ X₁ → v = p.first) ∧ + (∀ v ∈ p.walk.support, v ∈ X₂ → v = p.last) + +/-- Condition (iii) of Graph Minors IV, (6.1) (page 242): "there is a realization of $P$ such that +$k$ of its components are paths from $X_1$ to $X_2$ +with no vertex except their first in $X_1$, and no vertex except their last in $X_2$, and +the remainder of the components of this realization are isolated vertices." -/ +@[expose] def Theorem61Cond3 (P : Patchwork Ω α β) (X₁ X₂ : Set α) (k : ℕ) : Prop := + ∃ (H : (⊤ : SimpleGraph α).Subgraph) (D : Fin k → (⊤ : SimpleGraph α).Subgraph), + P.IsRealization H ∧ Function.Injective D ∧ + (∀ i, IsComponent H (D i) ∧ IsCleanPathSubgraph H (D i) X₁ X₂) ∧ + (∀ C, IsComponent H C → (∀ i, C ≠ D i) → C.verts.ncard = 1) + +/-! ### Easy directions of (6.1) -/ + +/-- By Menger's theorem (`MengerStatement`), condition (i) of (6.1) is equivalent to `(i)'`: there +are `k` mutually vertex-disjoint paths of `P.G.toHypergraph.skeleton` from `X₁` to `X₂` +(Graph Minors IV, page 242). -/ +theorem theorem_6_1_i_iff_disjointPaths (hM : MengerStatement.{u, v}) {P : Patchwork Ω α β} + {X₁ X₂ : Set α} (hX₁ : X₁ ⊆ P.G.vertexSet) (hX₂ : X₂ ⊆ P.G.vertexSet) (k : ℕ) : + Theorem61Cond1 P X₁ X₂ k ↔ HasDisjointPaths P.G.toHypergraph.skeleton X₁ X₂ k := by + unfold Theorem61Cond1 + exact hM P.G.toHypergraph X₁ X₂ hX₁ hX₂ k + +/-- Condition (iii) of (6.1) implies condition (ii) (Graph Minors IV, page 242: "Obviously (iii) +implies (ii)"). -/ +theorem theorem_6_1_iii_imp_ii {P : Patchwork Ω α β} {X₁ X₂ : Set α} {k : ℕ} + (h : Theorem61Cond3 P X₁ X₂ k) : Theorem61Cond2 P X₁ X₂ k := by + obtain ⟨H, D, hH, hDinj, hD, _⟩ := h + refine ⟨H, D, hH, hDinj, fun i ↦ ?_⟩ + obtain ⟨hcomp, p, hDeq, _, _, _⟩ := hD i + refine ⟨hcomp, ⟨p.first, ?_, p.first_mem⟩, ⟨p.last, ?_, p.last_mem⟩⟩ + · rw [hDeq] + exact p.walk.start_mem_support + · rw [hDeq] + exact p.walk.end_mem_support + +private theorem walk_coe_to_skeleton {P : Patchwork Ω α β} {H : (⊤ : SimpleGraph α).Subgraph} + (hH : P.IsRealization H) {x u v : H.verts} (hx : H.coe.Reachable x u) + (w : H.coe.Walk u v) : + ∃ w' : P.G.toHypergraph.skeleton.Walk u.1 v.1, + ∀ z ∈ w'.support, z ∈ (component H x).verts := by + induction w with + | @nil a => + exact ⟨Walk.nil, fun z hz ↦ by + rw [Walk.mem_support_nil_iff] at hz + subst hz + exact ⟨a.2, hx⟩⟩ + | @cons a b c hab w ih => + obtain ⟨w', hw'⟩ := ih (hx.trans (Adj.reachable hab)) + refine ⟨Walk.cons (hH.adj_imp_skeleton_adj hab) w', fun z hz ↦ ?_⟩ + rw [Walk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · exact ⟨a.2, hx⟩ + · exact hw' z hz + +/-- Condition (ii) of (6.1) implies `(i)'` (Graph Minors IV, page 242: "and (ii) implies (i)'"). -/ +theorem theorem_6_1_ii_imp_disjointPaths {P : Patchwork Ω α β} {X₁ X₂ : Set α} {k : ℕ} + (h : Theorem61Cond2 P X₁ X₂ k) : HasDisjointPaths P.G.toHypergraph.skeleton X₁ X₂ k := by + classical + obtain ⟨H, D, hH, hDinj, hD⟩ := h + have hpath : ∀ i : Fin k, ∃ p : PathFromTo P.G.toHypergraph.skeleton X₁ X₂, + ∀ z ∈ p.walk.support, z ∈ (D i).verts := by + intro i + obtain ⟨⟨x, hDeq⟩, ⟨u, huD, huX₁⟩, ⟨v, hvD, hvX₂⟩⟩ := hD i + have hu' : u ∈ componentVerts H x := by rwa [← component_verts, ← hDeq] + have hv' : v ∈ componentVerts H x := by rwa [← component_verts, ← hDeq] + obtain ⟨huH, hxu⟩ := hu' + obtain ⟨hvH, hxv⟩ := hv' + obtain ⟨w₀⟩ := hxu.symm.trans hxv + obtain ⟨w₁, hw₁⟩ := walk_coe_to_skeleton hH hxu w₀ + refine ⟨⟨u, v, w₁.toPath, w₁.toPath.2, huX₁, hvX₂⟩, fun z hz ↦ ?_⟩ + rw [hDeq] + exact hw₁ z (w₁.support_toPath_subset_support hz) + choose P' hP' using hpath + refine ⟨P', fun i j hij ↦ ?_⟩ + have hdisj := (hD i).1.disjoint_verts_of_ne (hD j).1 (fun hEq ↦ hij (hDinj hEq)) + exact Set.disjoint_left.mpr fun z hzi hzj ↦ + Set.disjoint_left.mp hdisj (hP' i z hzi) (hP' j z hzj) + +/-! ### Minimality properties of shortest disjoint paths in (6.1) -/ + +private def IsDisjointPathFamily (K : SimpleGraph α) (X₁ X₂ : Set α) {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) : Prop := + Pairwise fun i j ↦ Disjoint {x | x ∈ (Q i).walk.support} {x | x ∈ (Q j).walk.support} + +private def familyLength (K : SimpleGraph α) (X₁ X₂ : Set α) {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) : ℕ := + ∑ i, (Q i).walk.length + +private theorem isDisjointPathFamily_update {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + {Q : Fin k → PathFromTo K X₁ X₂} (hQ : IsDisjointPathFamily K X₁ X₂ Q) + (i : Fin k) (p : PathFromTo K X₁ X₂) (hsub : ∀ z ∈ p.walk.support, z ∈ (Q i).walk.support) : + IsDisjointPathFamily K X₁ X₂ (Function.update Q i p) := by + classical + intro a b hab + by_cases ha : a = i + · subst ha + have hb : b ≠ a := hab.symm + change Disjoint {x | x ∈ (Function.update Q a p a).walk.support} + {x | x ∈ (Function.update Q a p b).walk.support} + rw [Function.update_self, Function.update_of_ne hb] + exact Set.disjoint_left.mpr fun z hza hzb ↦ + Set.disjoint_left.mp (hQ hab) (hsub z hza) hzb + · by_cases hb : b = i + · subst hb + change Disjoint {x | x ∈ (Function.update Q b p a).walk.support} + {x | x ∈ (Function.update Q b p b).walk.support} + rw [Function.update_self, Function.update_of_ne ha] + exact Set.disjoint_left.mpr fun z hza hzb ↦ + Set.disjoint_left.mp (hQ hab) hza (hsub z hzb) + · change Disjoint {x | x ∈ (Function.update Q i p a).walk.support} + {x | x ∈ (Function.update Q i p b).walk.support} + rw [Function.update_of_ne ha, Function.update_of_ne hb] + exact hQ hab + +private theorem familyLength_update_lt {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) (i : Fin k) (p : PathFromTo K X₁ X₂) + (hlt : p.walk.length < (Q i).walk.length) : + familyLength K X₁ X₂ (Function.update Q i p) < familyLength K X₁ X₂ Q := by + classical + unfold familyLength + rw [← Finset.sum_erase_add _ _ (Finset.mem_univ i), + ← Finset.sum_erase_add Finset.univ (fun j ↦ (Q j).walk.length) (Finset.mem_univ i)] + have hsum : + ∑ x ∈ Finset.univ.erase i, (Function.update Q i p x).walk.length = + ∑ x ∈ Finset.univ.erase i, (Q x).walk.length := by + refine Finset.sum_congr rfl fun x hx ↦ ?_ + rw [Function.update_of_ne (Finset.ne_of_mem_erase hx)] + rw [hsum, Function.update_self] + exact Nat.add_lt_add_left hlt _ + +private theorem exists_min_disjointPathFamily {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + (h : HasDisjointPaths K X₁ X₂ k) : + ∃ Q : Fin k → PathFromTo K X₁ X₂, + IsDisjointPathFamily K X₁ X₂ Q ∧ + ∀ Q' : Fin k → PathFromTo K X₁ X₂, + IsDisjointPathFamily K X₁ X₂ Q' → familyLength K X₁ X₂ Q ≤ familyLength K X₁ X₂ Q' := by + obtain ⟨Q₀, hQ₀⟩ := h + have hne : + {n : ℕ | ∃ Q : Fin k → PathFromTo K X₁ X₂, + IsDisjointPathFamily K X₁ X₂ Q ∧ familyLength K X₁ X₂ Q = n}.Nonempty := + ⟨familyLength K X₁ X₂ Q₀, Q₀, hQ₀, rfl⟩ + obtain ⟨n, ⟨Q, hQ, rfl⟩, hmin⟩ := WellFounded.has_min Nat.lt_wfRel.wf _ hne + refine ⟨Q, hQ, fun Q' hQ' ↦ ?_⟩ + by_contra hlt + exact hmin (familyLength K X₁ X₂ Q') ⟨Q', hQ', rfl⟩ (Nat.lt_of_not_ge hlt) + +private theorem min_family_mem_X₁_eq_first {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + {Q : Fin k → PathFromTo K X₁ X₂} (hQ : IsDisjointPathFamily K X₁ X₂ Q) + (hmin : ∀ Q' : Fin k → PathFromTo K X₁ X₂, IsDisjointPathFamily K X₁ X₂ Q' → + familyLength K X₁ X₂ Q ≤ familyLength K X₁ X₂ Q') + (i : Fin k) {v : α} (hv : v ∈ (Q i).walk.support) (hvX₁ : v ∈ X₁) : + v = (Q i).first := by + classical + by_contra hne + let w' := (Q i).walk.dropUntil v hv + let p' : PathFromTo K X₁ X₂ := + ⟨v, (Q i).last, w', (Q i).isPath.dropUntil hv, hvX₁, (Q i).last_mem⟩ + have hsub : ∀ z ∈ p'.walk.support, z ∈ (Q i).walk.support := + fun _ hz ↦ (Q i).walk.support_dropUntil_subset_support hv hz + have hlt : p'.walk.length < (Q i).walk.length := + Walk.length_dropUntil_lt_length hv hne + exact absurd (hmin _ (isDisjointPathFamily_update hQ i p' hsub)) + (not_le_of_gt (familyLength_update_lt Q i p' hlt)) + +private theorem min_family_mem_X₂_eq_last {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + {Q : Fin k → PathFromTo K X₁ X₂} (hQ : IsDisjointPathFamily K X₁ X₂ Q) + (hmin : ∀ Q' : Fin k → PathFromTo K X₁ X₂, IsDisjointPathFamily K X₁ X₂ Q' → + familyLength K X₁ X₂ Q ≤ familyLength K X₁ X₂ Q') + (i : Fin k) {v : α} (hv : v ∈ (Q i).walk.support) (hvX₂ : v ∈ X₂) : + v = (Q i).last := by + classical + by_contra hne + let w' := (Q i).walk.takeUntil v hv + let p' : PathFromTo K X₁ X₂ := + ⟨(Q i).first, v, w', (Q i).isPath.takeUntil hv, (Q i).first_mem, hvX₂⟩ + have hsub : ∀ z ∈ p'.walk.support, z ∈ (Q i).walk.support := + fun _ hz ↦ (Q i).walk.support_takeUntil_subset_support hv hz + have hlt : p'.walk.length < (Q i).walk.length := + Walk.length_takeUntil_lt_length hv hne + exact absurd (hmin _ (isDisjointPathFamily_update hQ i p' hsub)) + (not_le_of_gt (familyLength_update_lt Q i p' hlt)) + +private theorem min_family_consecutive_of_adj {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + {Q : Fin k → PathFromTo K X₁ X₂} (hQ : IsDisjointPathFamily K X₁ X₂ Q) + (hmin : ∀ Q' : Fin k → PathFromTo K X₁ X₂, IsDisjointPathFamily K X₁ X₂ Q' → + familyLength K X₁ X₂ Q ≤ familyLength K X₁ X₂ Q') + (i : Fin k) {a b : ℕ} (hab : a < b) (hb : b ≤ (Q i).walk.length) + (hadj : K.Adj ((Q i).walk.getVert a) ((Q i).walk.getVert b)) : + b = a + 1 := by + classical + by_contra hne + have hab1 : a + 1 < b := Nat.lt_of_le_of_ne hab (Ne.symm hne) + let w₀ := ((Q i).walk.take a).append (Walk.cons hadj ((Q i).walk.drop b)) + let p' : PathFromTo K X₁ X₂ := + ⟨(Q i).first, (Q i).last, w₀.toPath, w₀.toPath.2, (Q i).first_mem, (Q i).last_mem⟩ + have hsub₀ : ∀ z ∈ w₀.support, z ∈ (Q i).walk.support := by + intro z hz + rw [Walk.mem_support_append_iff] at hz + rcases hz with hz | hz + · rw [Walk.support_take] at hz + exact List.mem_of_mem_take hz + · rw [Walk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · exact Walk.getVert_mem_support _ _ + · rw [Walk.drop_support_eq_support_drop_min] at hz + exact List.mem_of_mem_drop hz + have hsub : ∀ z ∈ p'.walk.support, z ∈ (Q i).walk.support := + fun z hz ↦ hsub₀ z (w₀.support_toPath_subset_support hz) + have hlen₀ : w₀.length < (Q i).walk.length := by + simp only [w₀, Walk.length_append, Walk.take_length, Walk.length_cons, Walk.drop_length] + omega + have hlt : p'.walk.length < (Q i).walk.length := + (Walk.length_bypass_le_length w₀).trans_lt hlen₀ + exact absurd (hmin _ (isDisjointPathFamily_update hQ i p' hsub)) + (not_le_of_gt (familyLength_update_lt Q i p' hlt)) + +/-! ### Darts and patch pairings for (6.1) -/ + +private abbrev DartIdx {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) : Type := + Σ i : Fin k, Fin (Q i).walk.length + +private def dartMinus {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) (d : DartIdx Q) : α := + (Q d.1).walk.getVert d.2.1 + +private def dartPlus {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) (d : DartIdx Q) : α := + (Q d.1).walk.getVert (d.2.1 + 1) + +private theorem dartMinus_mem_support {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) (d : DartIdx Q) : + dartMinus Q d ∈ (Q d.1).walk.support := + Walk.getVert_mem_support _ _ + +private theorem dartPlus_mem_support {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) (d : DartIdx Q) : + dartPlus Q d ∈ (Q d.1).walk.support := + Walk.getVert_mem_support _ _ + +private theorem eq_of_mem_support_of_disjoint {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + {Q : Fin k → PathFromTo K X₁ X₂} (hQ : IsDisjointPathFamily K X₁ X₂ Q) + {i j : Fin k} {v : α} (hvi : v ∈ (Q i).walk.support) (hvj : v ∈ (Q j).walk.support) : + i = j := by + by_contra hij + exact Set.disjoint_left.mp (hQ hij) hvi hvj + +private theorem dartMinus_injective {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + {Q : Fin k → PathFromTo K X₁ X₂} (hQ : IsDisjointPathFamily K X₁ X₂ Q) : + Function.Injective (dartMinus Q) := by + rintro ⟨i₁, m₁⟩ ⟨i₂, m₂⟩ h + have hi : i₁ = i₂ := + eq_of_mem_support_of_disjoint hQ (dartMinus_mem_support Q ⟨i₁, m₁⟩) + (h ▸ dartMinus_mem_support Q ⟨i₂, m₂⟩) + subst hi + have hm : m₁.1 = m₂.1 := + (Q i₁).isPath.getVert_injOn (by simp [m₁.2.le]) (by simp [m₂.2.le]) h + exact Sigma.ext rfl (heq_of_eq (Fin.ext hm)) + +private theorem dartPlus_injective {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + {Q : Fin k → PathFromTo K X₁ X₂} (hQ : IsDisjointPathFamily K X₁ X₂ Q) : + Function.Injective (dartPlus Q) := by + rintro ⟨i₁, m₁⟩ ⟨i₂, m₂⟩ h + have hi : i₁ = i₂ := + eq_of_mem_support_of_disjoint hQ (dartPlus_mem_support Q ⟨i₁, m₁⟩) + (h ▸ dartPlus_mem_support Q ⟨i₂, m₂⟩) + subst hi + have hm1 : m₁.1 + 1 = m₂.1 + 1 := + (Q i₁).isPath.getVert_injOn (by simp [Nat.succ_le_of_lt m₁.2]) + (by simp [Nat.succ_le_of_lt m₂.2]) h + exact Sigma.ext rfl (heq_of_eq (Fin.ext (Nat.succ.inj hm1))) + +private theorem dartMinus_ne_last {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + {Q : Fin k → PathFromTo K X₁ X₂} (hQ : IsDisjointPathFamily K X₁ X₂ Q) + (d : DartIdx Q) (i : Fin k) : dartMinus Q d ≠ (Q i).last := by + intro h + have hmem : dartMinus Q d ∈ (Q i).walk.support := by + rw [h] + exact (Q i).walk.end_mem_support + have hi : d.1 = i := + eq_of_mem_support_of_disjoint hQ (dartMinus_mem_support Q d) hmem + rcases d with ⟨j, m⟩ + subst hi + have hlen : (Q j).walk.getVert m.1 = (Q j).walk.getVert (Q j).walk.length := by + simpa [dartMinus] using h + have hm := (Q j).isPath.getVert_injOn (by simp [m.2.le]) (by simp) hlen + exact m.2.ne hm + +private theorem dartPlus_ne_first {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + {Q : Fin k → PathFromTo K X₁ X₂} (hQ : IsDisjointPathFamily K X₁ X₂ Q) + (d : DartIdx Q) (i : Fin k) : dartPlus Q d ≠ (Q i).first := by + intro h + have hmem : dartPlus Q d ∈ (Q i).walk.support := by + rw [h] + exact (Q i).walk.start_mem_support + have hi : d.1 = i := + eq_of_mem_support_of_disjoint hQ (dartPlus_mem_support Q d) hmem + rcases d with ⟨j, m⟩ + subst hi + have hzero : (Q j).walk.getVert (m.1 + 1) = (Q j).walk.getVert 0 := by + simpa [dartPlus] using h + have hm := (Q j).isPath.getVert_injOn (by simp [Nat.succ_le_of_lt m.2]) (by simp) hzero + exact Nat.succ_ne_zero m.1 hm + +private theorem dart_adj {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) (d : DartIdx Q) : + K.Adj (dartMinus Q d) (dartPlus Q d) := + Walk.adj_getVert_succ _ d.2.2 + +private noncomputable def dartEdge {G : Hypergraph α β} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo G.skeleton X₁ X₂) (d : DartIdx Q) : β := + (dart_adj Q d).2.choose + +private theorem dartEdge_inc_minus {G : Hypergraph α β} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo G.skeleton X₁ X₂) (d : DartIdx Q) : + G.Inc (dartEdge Q d) (dartMinus Q d) := + (dart_adj Q d).2.choose_spec.1 + +private theorem dartEdge_inc_plus {G : Hypergraph α β} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo G.skeleton X₁ X₂) (d : DartIdx Q) : + G.Inc (dartEdge Q d) (dartPlus Q d) := + (dart_adj Q d).2.choose_spec.2 + +private theorem dartEdge_mem {G : Hypergraph α β} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo G.skeleton X₁ X₂) (d : DartIdx Q) : + dartEdge Q d ∈ G.edgeSet := + G.edge_mem_of_inc (dartEdge_inc_minus Q d) + +private def dartSetA {G : Hypergraph α β} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo G.skeleton X₁ X₂) (e : β) : Set α := + dartMinus Q '' {d | dartEdge Q d = e} + +private def dartSetB {G : Hypergraph α β} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo G.skeleton X₁ X₂) (e : β) : Set α := + dartPlus Q '' {d | dartEdge Q d = e} + +private theorem dartSetA_subset_ends {G : Hypergraph α β} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo G.skeleton X₁ X₂) (e : β) : + dartSetA Q e ⊆ G.ends e := by + rintro _ ⟨d, rfl, rfl⟩ + exact dartEdge_inc_minus Q d + +private theorem dartSetB_subset_ends {G : Hypergraph α β} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo G.skeleton X₁ X₂) (e : β) : + dartSetB Q e ⊆ G.ends e := by + rintro _ ⟨d, rfl, rfl⟩ + exact dartEdge_inc_plus Q d + +private theorem dartSetA_ncard_eq_dartSetB_ncard {G : Hypergraph α β} {X₁ X₂ : Set α} {k : ℕ} + {Q : Fin k → PathFromTo G.skeleton X₁ X₂} (hQ : IsDisjointPathFamily G.skeleton X₁ X₂ Q) + (e : β) : (dartSetA Q e).ncard = (dartSetB Q e).ncard := by + rw [dartSetA, dartSetB, Set.ncard_image_of_injective _ (dartMinus_injective hQ), + Set.ncard_image_of_injective _ (dartPlus_injective hQ)] + +private theorem disjoint_dartSetA_dartSetB {G : Hypergraph α β} {X₁ X₂ : Set α} {k : ℕ} + {Q : Fin k → PathFromTo G.skeleton X₁ X₂} (hQ : IsDisjointPathFamily G.skeleton X₁ X₂ Q) + (hmin : ∀ Q' : Fin k → PathFromTo G.skeleton X₁ X₂, + IsDisjointPathFamily G.skeleton X₁ X₂ Q' → + familyLength G.skeleton X₁ X₂ Q ≤ familyLength G.skeleton X₁ X₂ Q') + (e : β) : Disjoint (dartSetA Q e) (dartSetB Q e) := by + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨d₁, hd₁, rfl⟩ ⟨d₂, hd₂, hEq⟩ + have hi : d₁.1 = d₂.1 := + eq_of_mem_support_of_disjoint hQ (dartMinus_mem_support Q d₁) + (hEq.symm ▸ dartPlus_mem_support Q d₂) + rcases d₁ with ⟨i, m₁⟩ + rcases d₂ with ⟨j, m₂⟩ + subst hi + have hm : m₁.1 = m₂.1 + 1 := + (Q i).isPath.getVert_injOn (by simp [m₁.2.le]) (by simp [Nat.succ_le_of_lt m₂.2]) hEq.symm + have hx : G.Inc e ((Q i).walk.getVert m₂.1) := hd₂ ▸ dartEdge_inc_minus Q ⟨i, m₂⟩ + have hy : G.Inc e ((Q i).walk.getVert (m₁.1 + 1)) := hd₁ ▸ dartEdge_inc_plus Q ⟨i, m₁⟩ + have hlt : m₂.1 < m₁.1 + 1 := by omega + have hle : m₁.1 + 1 ≤ (Q i).walk.length := Nat.succ_le_of_lt m₁.2 + have hne : (Q i).walk.getVert m₂.1 ≠ (Q i).walk.getVert (m₁.1 + 1) := by + intro hxy + have hEqIdx := (Q i).isPath.getVert_injOn (by simp [m₂.2.le]) (by simp [hle]) hxy + omega + have hadj : G.skeleton.Adj ((Q i).walk.getVert m₂.1) ((Q i).walk.getVert (m₁.1 + 1)) := + ⟨hne, e, hx, hy⟩ + have hcons := min_family_consecutive_of_adj hQ hmin i hlt hle hadj + omega + +private theorem exists_realization_and_dartPerm {P : Patchwork Ω α β} (hrob : P.IsRobust) + {X₁ X₂ : Set α} {k : ℕ} {Q : Fin k → PathFromTo P.G.toHypergraph.skeleton X₁ X₂} + (hQ : IsDisjointPathFamily P.G.toHypergraph.skeleton X₁ X₂ Q) + (hmin : ∀ Q' : Fin k → PathFromTo P.G.toHypergraph.skeleton X₁ X₂, + IsDisjointPathFamily P.G.toHypergraph.skeleton X₁ X₂ Q' → + familyLength P.G.toHypergraph.skeleton X₁ X₂ Q ≤ + familyLength P.G.toHypergraph.skeleton X₁ X₂ Q') : + ∃ (H : (⊤ : SimpleGraph α).Subgraph) (π : DartIdx Q → DartIdx Q), + P.IsRealization H ∧ Function.Injective π ∧ + (∀ x y, H.Adj x y ↔ ∃ d : DartIdx Q, + (x = dartMinus Q d ∧ y = dartPlus Q (π d)) ∨ + (y = dartMinus Q d ∧ x = dartPlus Q (π d))) := by + classical + have hδ_ex : ∀ e ∈ P.G.edgeSet, ∃ δe ∈ P.Δ e, + IsPairing (P.Δ e).verts δe ∧ + Pairs (P.Δ e).verts δe (dartSetA Q e) (dartSetB Q e) := by + intro e he + have hA : dartSetA Q e ⊆ (P.Δ e).verts := by + rw [P.Δ_verts e he] + exact dartSetA_subset_ends Q e + have hB : dartSetB Q e ⊆ (P.Δ e).verts := by + rw [P.Δ_verts e he] + exact dartSetB_subset_ends Q e + exact (hrob e he).exists_pairing (dartSetA Q e) hA (dartSetB Q e) hB + (dartSetA_ncard_eq_dartSetB_ncard hQ e) (disjoint_dartSetA_dartSetB hQ hmin e) + let δ : β → (⊤ : SimpleGraph α).Subgraph := fun e ↦ + if he : e ∈ P.G.edgeSet then (hδ_ex e he).choose else emptySubgraph ∅ + have hδ_mem : ∀ e ∈ P.G.edgeSet, δ e ∈ P.Δ e := by + intro e he + dsimp only [δ] + rw [dite_eq_left_of_eq_true (eq_true he)] + exact (hδ_ex e he).choose_spec.1 + have hδ_pair : ∀ e ∈ P.G.edgeSet, IsPairing (P.Δ e).verts (δ e) := by + intro e he + dsimp only [δ] + rw [dite_eq_left_of_eq_true (eq_true he)] + exact (hδ_ex e he).choose_spec.2.1 + have hδ_pairs : ∀ e ∈ P.G.edgeSet, + Pairs (P.Δ e).verts (δ e) (dartSetA Q e) (dartSetB Q e) := by + intro e he + dsimp only [δ] + rw [dite_eq_left_of_eq_true (eq_true he)] + exact (hδ_ex e he).choose_spec.2.2 + have hfin : ∀ e ∈ P.G.edgeSet, (P.Δ e).verts.Finite := by + intro e he + rw [P.Δ_verts e he] + exact P.G.vertexSet_finite.subset fun _ hv ↦ P.G.vertex_mem_of_inc hv + have hδ_unique : ∀ e ∈ P.G.edgeSet, ∀ a b c, (δ e).Adj a b → (δ e).Adj a c → b = c := + fun e he ↦ ((isPairing_iff (hfin e he)).mp (hδ_pair e he)).2 + have hδ_ab : ∀ e ∈ P.G.edgeSet, ∀ u v, (δ e).Adj u v → + (u ∈ dartSetA Q e ∧ v ∈ dartSetB Q e) ∨ (u ∈ dartSetB Q e ∧ v ∈ dartSetA Q e) := + fun e he ↦ ((pairs_iff_of_isPairing (hfin e he) (hδ_pair e he)).mp (hδ_pairs e he)).2.2.2.1 + have hδ_deg : ∀ e ∈ P.G.edgeSet, ∀ v ∈ dartSetA Q e ∪ dartSetB Q e, ∃ w, (δ e).Adj v w := + fun e he ↦ ((pairs_iff_of_isPairing (hfin e he) (hδ_pair e he)).mp (hδ_pairs e he)).2.2.2.2 + have hπ_ex : ∀ d : DartIdx Q, ∃ d' : DartIdx Q, + dartEdge Q d' = dartEdge Q d ∧ + (δ (dartEdge Q d)).Adj (dartMinus Q d) (dartPlus Q d') := by + intro d + have he : dartEdge Q d ∈ P.G.edgeSet := dartEdge_mem Q d + have hmemA : dartMinus Q d ∈ dartSetA Q (dartEdge Q d) := ⟨d, rfl, rfl⟩ + obtain ⟨w, hw⟩ := hδ_deg (dartEdge Q d) he (dartMinus Q d) (Or.inl hmemA) + rcases hδ_ab (dartEdge Q d) he (dartMinus Q d) w hw with ⟨_, hwB⟩ | ⟨hB, _⟩ + · obtain ⟨d', hd', rfl⟩ := hwB + exact ⟨d', hd', hw⟩ + · exact False.elim (Set.disjoint_left.mp + (disjoint_dartSetA_dartSetB hQ hmin (dartEdge Q d)) hmemA hB) + choose π hπ_edge hπ_adj using hπ_ex + have hπ_inj : Function.Injective π := by + intro d₁ d₂ hEq + have heEq : dartEdge Q d₁ = dartEdge Q d₂ := by + rw [← hπ_edge d₁, hEq, hπ_edge d₂] + have he₁ : dartEdge Q d₁ ∈ P.G.edgeSet := dartEdge_mem Q d₁ + have hadj₁ : (δ (dartEdge Q d₁)).Adj (dartPlus Q (π d₁)) (dartMinus Q d₁) := + (hπ_adj d₁).symm + have hadj₂ : (δ (dartEdge Q d₁)).Adj (dartPlus Q (π d₁)) (dartMinus Q d₂) := by + rw [hEq, heEq] + exact (hπ_adj d₂).symm + exact dartMinus_injective hQ (hδ_unique (dartEdge Q d₁) he₁ _ _ _ hadj₁ hadj₂) + let H := realizationOf P.G.toHypergraph δ + refine ⟨H, π, ⟨δ, hδ_mem, rfl⟩, hπ_inj, fun x y ↦ ?_⟩ + simp only [H, realizationOf_adj] + constructor + · rintro ⟨e, he, hxy⟩ + rcases hδ_ab e he x y hxy with ⟨hxA, _⟩ | ⟨_, hyA⟩ + · obtain ⟨d, rfl, rfl⟩ := hxA + have hyEq : y = dartPlus Q (π d) := + hδ_unique (dartEdge Q d) he (dartMinus Q d) y (dartPlus Q (π d)) hxy (hπ_adj d) + exact ⟨d, Or.inl ⟨rfl, hyEq⟩⟩ + · obtain ⟨d, rfl, rfl⟩ := hyA + have hxEq : x = dartPlus Q (π d) := + hδ_unique (dartEdge Q d) he (dartMinus Q d) x (dartPlus Q (π d)) hxy.symm (hπ_adj d) + exact ⟨d, Or.inr ⟨rfl, hxEq⟩⟩ + · rintro ⟨d, ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩⟩ + · exact ⟨dartEdge Q d, dartEdge_mem Q d, hπ_adj d⟩ + · exact ⟨dartEdge Q d, dartEdge_mem Q d, (hπ_adj d).symm⟩ + +/-! ### Rerouting paths patch by patch -/ + +private theorem reroute_step_adj {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + {Q : Fin k → PathFromTo K X₁ X₂} {H : (⊤ : SimpleGraph α).Subgraph} + {π : DartIdx Q → DartIdx Q} + (hstep : ∀ d : DartIdx Q, H.spanningCoe.Adj (dartMinus Q d) (dartPlus Q (π d))) + {z : α} (h : ∃ d : DartIdx Q, z = dartMinus Q d) : + H.spanningCoe.Adj z (dartPlus Q (π h.choose)) := by + have hz : z = dartMinus Q h.choose := h.choose_spec + generalize h.choose = d at hz ⊢ + rw [hz] + exact hstep d + +private noncomputable def reroute {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) {H : (⊤ : SimpleGraph α).Subgraph} + (π : DartIdx Q → DartIdx Q) + (hstep : ∀ d : DartIdx Q, H.spanningCoe.Adj (dartMinus Q d) (dartPlus Q (π d))) : + ∀ (_ : ℕ) (z : α), Σ w : α, H.spanningCoe.Walk z w + | 0, z => ⟨z, Walk.nil⟩ + | n + 1, z => by + classical + exact if h : ∃ d : DartIdx Q, z = dartMinus Q d then + let r := reroute Q π hstep n (dartPlus Q (π h.choose)) + ⟨r.1, Walk.cons (reroute_step_adj hstep h) r.2⟩ + else ⟨z, Walk.nil⟩ + +private theorem reroute_zero {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) {H : (⊤ : SimpleGraph α).Subgraph} + (π : DartIdx Q → DartIdx Q) + (hstep : ∀ d : DartIdx Q, H.spanningCoe.Adj (dartMinus Q d) (dartPlus Q (π d))) + (z : α) : reroute Q π hstep 0 z = ⟨z, Walk.nil⟩ := rfl + +private theorem reroute_succ_pos {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) {H : (⊤ : SimpleGraph α).Subgraph} + (π : DartIdx Q → DartIdx Q) + (hstep : ∀ d : DartIdx Q, H.spanningCoe.Adj (dartMinus Q d) (dartPlus Q (π d))) + (n : ℕ) {z : α} (h : ∃ d : DartIdx Q, z = dartMinus Q d) : + reroute Q π hstep (n + 1) z = + ⟨(reroute Q π hstep n (dartPlus Q (π h.choose))).1, + Walk.cons (reroute_step_adj hstep h) + (reroute Q π hstep n (dartPlus Q (π h.choose))).2⟩ := by + dsimp only [reroute] + rw [dite_eq_left_of_eq_true (eq_true h)] + +private theorem reroute_succ_neg {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) {H : (⊤ : SimpleGraph α).Subgraph} + (π : DartIdx Q → DartIdx Q) + (hstep : ∀ d : DartIdx Q, H.spanningCoe.Adj (dartMinus Q d) (dartPlus Q (π d))) + (n : ℕ) {z : α} (h : ¬∃ d : DartIdx Q, z = dartMinus Q d) : + reroute Q π hstep (n + 1) z = ⟨z, Walk.nil⟩ := by + dsimp only [reroute] + rw [dite_eq_right_of_eq_false (eq_false h)] + +private theorem reroute_not_exists_or_length {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) {H : (⊤ : SimpleGraph α).Subgraph} + (π : DartIdx Q → DartIdx Q) + (hstep : ∀ d : DartIdx Q, H.spanningCoe.Adj (dartMinus Q d) (dartPlus Q (π d))) + (n : ℕ) (z : α) : + (¬∃ d : DartIdx Q, (reroute Q π hstep n z).1 = dartMinus Q d) ∨ + (reroute Q π hstep n z).2.length = n := by + induction n generalizing z with + | zero => exact Or.inr rfl + | succ n ih => + by_cases h : ∃ d : DartIdx Q, z = dartMinus Q d + · rw [reroute_succ_pos Q π hstep n h] + rcases ih (dartPlus Q (π h.choose)) with hnot | hlen + · exact Or.inl hnot + · exact Or.inr (by simp [hlen]) + · rw [reroute_succ_neg Q π hstep n h] + exact Or.inl h + +private theorem reroute_getVert_step {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) {H : (⊤ : SimpleGraph α).Subgraph} + (π : DartIdx Q → DartIdx Q) + (hstep : ∀ d : DartIdx Q, H.spanningCoe.Adj (dartMinus Q d) (dartPlus Q (π d))) + (n : ℕ) (z : α) {m : ℕ} (hm : m < (reroute Q π hstep n z).2.length) : + ∃ d : DartIdx Q, + (reroute Q π hstep n z).2.getVert m = dartMinus Q d ∧ + (reroute Q π hstep n z).2.getVert (m + 1) = dartPlus Q (π d) := by + induction n generalizing z m with + | zero => + rw [reroute_zero, Walk.length_nil] at hm + omega + | succ n ih => + by_cases h : ∃ d : DartIdx Q, z = dartMinus Q d + · rw [reroute_succ_pos Q π hstep n h] at hm ⊢ + cases m with + | zero => + exact ⟨h.choose, h.choose_spec, by simp⟩ + | succ m' => + rw [Walk.length_cons, Nat.add_lt_add_iff_right] at hm + simpa using ih (dartPlus Q (π h.choose)) hm + · rw [reroute_succ_neg Q π hstep n h, Walk.length_nil] at hm + omega + +private theorem reroute_support_mem {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + (Q : Fin k → PathFromTo K X₁ X₂) {H : (⊤ : SimpleGraph α).Subgraph} + (π : DartIdx Q → DartIdx Q) + (hstep : ∀ d : DartIdx Q, H.spanningCoe.Adj (dartMinus Q d) (dartPlus Q (π d))) + (n : ℕ) {z : α} (hz : ∃ i, z ∈ (Q i).walk.support) + {v : α} (hv : v ∈ (reroute Q π hstep n z).2.support) : + ∃ i, v ∈ (Q i).walk.support := by + induction n generalizing z with + | zero => + rw [reroute_zero, Walk.mem_support_nil_iff] at hv + exact hv ▸ hz + | succ n ih => + by_cases h : ∃ d : DartIdx Q, z = dartMinus Q d + · rw [reroute_succ_pos Q π hstep n h, Walk.support_cons, List.mem_cons] at hv + rcases hv with rfl | hv + · exact hz + · exact ih ⟨(π h.choose).1, dartPlus_mem_support Q (π h.choose)⟩ hv + · rw [reroute_succ_neg Q π hstep n h, Walk.mem_support_nil_iff] at hv + exact hv ▸ hz + +private theorem reroute_getVert_inj {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + {Q : Fin k → PathFromTo K X₁ X₂} (hQ : IsDisjointPathFamily K X₁ X₂ Q) + {H : (⊤ : SimpleGraph α).Subgraph} {π : DartIdx Q → DartIdx Q} + (hπ_inj : Function.Injective π) + (hstep : ∀ d : DartIdx Q, H.spanningCoe.Adj (dartMinus Q d) (dartPlus Q (π d))) + (n : ℕ) {i₁ i₂ : Fin k} {m₁ m₂ : ℕ} + (hm₁ : m₁ ≤ (reroute Q π hstep n (Q i₁).first).2.length) + (hm₂ : m₂ ≤ (reroute Q π hstep n (Q i₂).first).2.length) + (hEq : (reroute Q π hstep n (Q i₁).first).2.getVert m₁ = + (reroute Q π hstep n (Q i₂).first).2.getVert m₂) : + i₁ = i₂ ∧ m₁ = m₂ := by + induction m₁ generalizing m₂ with + | zero => + cases m₂ with + | zero => + simp only [Walk.getVert_zero] at hEq + refine ⟨eq_of_mem_support_of_disjoint hQ (Q i₁).walk.start_mem_support ?_, rfl⟩ + rw [hEq] + exact (Q i₂).walk.start_mem_support + | succ m₂' => + exfalso + obtain ⟨d₂, _, hd₂⟩ := reroute_getVert_step Q π hstep n (Q i₂).first + (Nat.lt_of_succ_le hm₂) + rw [Walk.getVert_zero, hd₂] at hEq + exact dartPlus_ne_first hQ (π d₂) i₁ hEq.symm + | succ m₁' ih => + cases m₂ with + | zero => + exfalso + obtain ⟨d₁, _, hd₁⟩ := reroute_getVert_step Q π hstep n (Q i₁).first + (Nat.lt_of_succ_le hm₁) + rw [Walk.getVert_zero, hd₁] at hEq + exact dartPlus_ne_first hQ (π d₁) i₂ hEq + | succ m₂' => + obtain ⟨d₁, hd₁_minus, hd₁_plus⟩ := reroute_getVert_step Q π hstep n (Q i₁).first + (Nat.lt_of_succ_le hm₁) + obtain ⟨d₂, hd₂_minus, hd₂_plus⟩ := reroute_getVert_step Q π hstep n (Q i₂).first + (Nat.lt_of_succ_le hm₂) + rw [hd₁_plus, hd₂_plus] at hEq + have hdEq : d₁ = d₂ := hπ_inj (dartPlus_injective hQ hEq) + have hprev : (reroute Q π hstep n (Q i₁).first).2.getVert m₁' = + (reroute Q π hstep n (Q i₂).first).2.getVert m₂' := by + rw [hd₁_minus, hd₂_minus, hdEq] + obtain ⟨hi, hm⟩ := ih (Nat.le_of_succ_le hm₁) (Nat.le_of_succ_le hm₂) hprev + exact ⟨hi, congrArg Nat.succ hm⟩ + +private theorem reroute_isPath {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + {Q : Fin k → PathFromTo K X₁ X₂} (hQ : IsDisjointPathFamily K X₁ X₂ Q) + {H : (⊤ : SimpleGraph α).Subgraph} {π : DartIdx Q → DartIdx Q} + (hπ_inj : Function.Injective π) + (hstep : ∀ d : DartIdx Q, H.spanningCoe.Adj (dartMinus Q d) (dartPlus Q (π d))) + (n : ℕ) (i : Fin k) : + (reroute Q π hstep n (Q i).first).2.IsPath := by + rw [← Walk.IsPath.getVert_injOn_iff] + intro a ha b hb hEq + exact (reroute_getVert_inj hQ hπ_inj hstep n ha hb hEq).2 + +private theorem reroute_disjoint_support {K : SimpleGraph α} {X₁ X₂ : Set α} {k : ℕ} + {Q : Fin k → PathFromTo K X₁ X₂} (hQ : IsDisjointPathFamily K X₁ X₂ Q) + {H : (⊤ : SimpleGraph α).Subgraph} {π : DartIdx Q → DartIdx Q} + (hπ_inj : Function.Injective π) + (hstep : ∀ d : DartIdx Q, H.spanningCoe.Adj (dartMinus Q d) (dartPlus Q (π d))) + (n : ℕ) {i₁ i₂ : Fin k} (hne : i₁ ≠ i₂) : + Disjoint {v | v ∈ (reroute Q π hstep n (Q i₁).first).2.support} + {v | v ∈ (reroute Q π hstep n (Q i₂).first).2.support} := by + refine Set.disjoint_left.mpr fun v hv₁ hv₂ ↦ hne ?_ + rw [Set.mem_ofPred_eq, Walk.mem_support_iff_exists_getVert] at hv₁ hv₂ + obtain ⟨m₁, rfl, hm₁⟩ := hv₁ + obtain ⟨m₂, hEq, hm₂⟩ := hv₂ + exact (reroute_getVert_inj hQ hπ_inj hstep n hm₁ hm₂ hEq.symm).1 + +private theorem walk_toSubgraph_adj_getVert_succ {G : SimpleGraph α} {u v : α} + (w : G.Walk u v) {m : ℕ} (hm : m < w.length) : + w.toSubgraph.Adj (w.getVert m) (w.getVert (m + 1)) := by + induction w generalizing m with + | nil => + rw [Walk.length_nil] at hm + omega + | cons h p ih => + cases m with + | zero => + simp [Walk.toSubgraph] + | succ m' => + rw [Walk.length_cons, Nat.add_lt_add_iff_right] at hm + simpa [Walk.toSubgraph] using Or.inr (ih hm) + +private theorem walk_spanningCoe_reachable_coe {H : (⊤ : SimpleGraph α).Subgraph} {u v : α} + (hu : u ∈ H.verts) (w : H.spanningCoe.Walk u v) {z : α} (hz : z ∈ w.support) : + ∃ hzH : z ∈ H.verts, H.coe.Reachable ⟨u, hu⟩ ⟨z, hzH⟩ := by + induction w with + | nil => + rw [Walk.mem_support_nil_iff] at hz + subst hz + exact ⟨hu, Reachable.refl _⟩ + | @cons a b c hab p ih => + rw [Walk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · exact ⟨hu, Reachable.refl _⟩ + · have hb : b ∈ H.verts := H.edge_vert hab.symm + obtain ⟨hzH, hreach⟩ := ih hb hz + exact ⟨hzH, (Adj.reachable hab.coe).trans hreach⟩ + +/-- Condition `(i)'` of (6.1) implies condition (iii) for a robust `Ω`-patchwork +(Graph Minors IV, page 242). -/ +theorem theorem_6_1_disjointPaths_imp_iii {P : Patchwork Ω α β} (hrob : P.IsRobust) + {X₁ X₂ : Set α} (hX₁ : X₁ ⊆ P.G.vertexSet) (_hX₂ : X₂ ⊆ P.G.vertexSet) {k : ℕ} + (hpaths : HasDisjointPaths P.G.toHypergraph.skeleton X₁ X₂ k) : + Theorem61Cond3 P X₁ X₂ k := by + classical + let K := P.G.toHypergraph.skeleton + obtain ⟨Q, hQ, hmin⟩ := exists_min_disjointPathFamily hpaths + obtain ⟨H, π, hH, hπ_inj, hadj_iff⟩ := exists_realization_and_dartPerm hrob hQ hmin + have hstep : ∀ d : DartIdx Q, H.spanningCoe.Adj (dartMinus Q d) (dartPlus Q (π d)) := + fun d ↦ (hadj_iff _ _).mpr ⟨d, Or.inl ⟨rfl, rfl⟩⟩ + let n := familyLength K X₁ X₂ Q + 1 + let endV : Fin k → α := fun i ↦ (reroute Q π hstep n (Q i).first).1 + let W : ∀ i : Fin k, H.spanningCoe.Walk (Q i).first (endV i) := + fun i ↦ (reroute Q π hstep n (Q i).first).2 + let StepIdx := Σ i : Fin k, Fin (W i).length + have hstep_ex : ∀ s : StepIdx, ∃ d : DartIdx Q, + (W s.1).getVert s.2.1 = dartMinus Q d ∧ + (W s.1).getVert (s.2.1 + 1) = dartPlus Q (π d) := + fun s ↦ reroute_getVert_step Q π hstep n (Q s.1).first s.2.2 + choose stepDart hstep_minus hstep_plus using hstep_ex + have hstepDart_inj : Function.Injective stepDart := by + rintro ⟨i₁, m₁⟩ ⟨i₂, m₂⟩ hEq + have hvert : (W i₁).getVert m₁.1 = (W i₂).getVert m₂.1 := by + rw [hstep_minus ⟨i₁, m₁⟩, hstep_minus ⟨i₂, m₂⟩, hEq] + obtain ⟨hi, hm⟩ := reroute_getVert_inj hQ hπ_inj hstep n m₁.2.le m₂.2.le hvert + subst hi + exact Sigma.ext rfl (heq_of_eq (Fin.ext hm)) + have hsum_le : ∑ i : Fin k, (W i).length ≤ familyLength K X₁ X₂ Q := by + have hcard := Fintype.card_le_of_injective stepDart hstepDart_inj + simpa [StepIdx, DartIdx, familyLength] using hcard + have hlen_lt : ∀ i : Fin k, (W i).length < n := by + intro i + have hle : (W i).length ≤ ∑ j : Fin k, (W j).length := by + rw [← Finset.sum_erase_add Finset.univ (fun j ↦ (W j).length) (Finset.mem_univ i)] + exact Nat.le_add_left _ _ + exact Nat.lt_succ_of_le (hle.trans hsum_le) + have hend_not_minus : ∀ i : Fin k, ¬∃ d : DartIdx Q, endV i = dartMinus Q d := by + intro i + rcases reroute_not_exists_or_length Q π hstep n (Q i).first with hnot | hlen + · exact hnot + · exact absurd hlen (hlen_lt i).ne + have hend_eq_last : ∀ i : Fin k, ∃ j : Fin k, endV i = (Q j).last := by + intro i + obtain ⟨j, hj⟩ := reroute_support_mem Q π hstep n ⟨i, (Q i).walk.start_mem_support⟩ + (W i).end_mem_support + rw [Walk.mem_support_iff_exists_getVert] at hj + obtain ⟨m, hmEq, hmle⟩ := hj + rcases hmle.lt_or_eq with hmlt | rfl + · exfalso + exact hend_not_minus i ⟨⟨j, ⟨m, hmlt⟩⟩, hmEq.symm⟩ + · exact ⟨j, hmEq.symm.trans (Walk.getVert_length (Q j).walk)⟩ + have hend_mem_X₂ : ∀ i : Fin k, endV i ∈ X₂ := by + intro i + obtain ⟨j, hj⟩ := hend_eq_last i + rw [hj] + exact (Q j).last_mem + have hH_le_K : H.spanningCoe ≤ K := fun _ _ h ↦ hH.adj_imp_skeleton_adj h + let Q' : Fin k → PathFromTo K X₁ X₂ := fun i ↦ + { first := (Q i).first + last := endV i + walk := (W i).mapLe hH_le_K + isPath := (reroute_isPath hQ hπ_inj hstep n i).mapLe _ + first_mem := (Q i).first_mem + last_mem := hend_mem_X₂ i } + have hQ'_disj : IsDisjointPathFamily K X₁ X₂ Q' := by + intro i₁ i₂ hne + simpa [Q'] using reroute_disjoint_support hQ hπ_inj hstep n hne + have hsum_ge : familyLength K X₁ X₂ Q ≤ ∑ i : Fin k, (W i).length := by + simpa [familyLength, Q'] using hmin Q' hQ'_disj + have hstepDart_bij : Function.Bijective stepDart := by + rw [Fintype.bijective_iff_injective_and_card] + refine ⟨hstepDart_inj, ?_⟩ + simpa [StepIdx, DartIdx, familyLength] using le_antisymm hsum_le hsum_ge + have hadj_W : ∀ x y : α, H.Adj x y ↔ ∃ i : Fin k, (W i).toSubgraph.Adj x y := by + intro x y + constructor + · intro hxy + obtain ⟨d, ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩⟩ := (hadj_iff x y).mp hxy + · obtain ⟨⟨i, m⟩, rfl⟩ := hstepDart_bij.2 d + refine ⟨i, ?_⟩ + rw [← hstep_minus ⟨i, m⟩, ← hstep_plus ⟨i, m⟩] + exact walk_toSubgraph_adj_getVert_succ (W i) m.2 + · obtain ⟨⟨i, m⟩, rfl⟩ := hstepDart_bij.2 d + refine ⟨i, ?_⟩ + rw [← hstep_minus ⟨i, m⟩, ← hstep_plus ⟨i, m⟩] + exact (walk_toSubgraph_adj_getVert_succ (W i) m.2).symm + · rintro ⟨i, hxy⟩ + exact (W i).toSubgraph.adj_sub hxy + have hW_mem_X₁ : ∀ (i : Fin k), ∀ v ∈ (W i).support, v ∈ X₁ → v = (Q i).first := by + intro i v hv hvX₁ + obtain ⟨j, hj⟩ := reroute_support_mem Q π hstep n ⟨i, (Q i).walk.start_mem_support⟩ hv + have hv_first : v = (Q j).first := min_family_mem_X₁_eq_first hQ hmin j hj hvX₁ + rw [Walk.mem_support_iff_exists_getVert] at hv + obtain ⟨m, rfl, hm⟩ := hv + have hzero : (W i).getVert m = (W j).getVert 0 := by simpa using hv_first + obtain ⟨rfl, rfl⟩ := reroute_getVert_inj hQ hπ_inj hstep n hm (Nat.zero_le _) hzero + exact hv_first + have hW_mem_X₂ : ∀ (i : Fin k), ∀ v ∈ (W i).support, v ∈ X₂ → v = endV i := by + intro i v hv hvX₂ + obtain ⟨j, hj⟩ := reroute_support_mem Q π hstep n ⟨i, (Q i).walk.start_mem_support⟩ hv + have hv_last : v = (Q j).last := min_family_mem_X₂_eq_last hQ hmin j hj hvX₂ + rw [Walk.mem_support_iff_exists_getVert] at hv + obtain ⟨m, rfl, hm⟩ := hv + rcases hm.lt_or_eq with hmlt | rfl + · exfalso + have hminus := hstep_minus ⟨i, ⟨m, hmlt⟩⟩ + exact dartMinus_ne_last hQ (stepDart ⟨i, ⟨m, hmlt⟩⟩) j (hminus.symm.trans hv_last) + · exact Walk.getVert_length (W i) + let D : Fin k → (⊤ : SimpleGraph α).Subgraph := fun i ↦ H.induce {v | v ∈ (W i).support} + have hfirst_H : ∀ i : Fin k, (Q i).first ∈ H.verts := by + intro i + rw [hH.verts_eq] + exact hX₁ (Q i).first_mem + have hD_eq_comp : ∀ i : Fin k, D i = component H ⟨(Q i).first, hfirst_H i⟩ := by + intro i + have hverts : {v | v ∈ (W i).support} = componentVerts H ⟨(Q i).first, hfirst_H i⟩ := by + ext z + simp only [Set.mem_ofPred_eq, mem_componentVerts_iff] + constructor + · intro hz + exact walk_spanningCoe_reachable_coe (hfirst_H i) (W i) hz + · rintro ⟨hzH, hreach⟩ + suffices ∀ y : H.verts, H.coe.Reachable ⟨(Q i).first, hfirst_H i⟩ y → y.1 ∈ + (W i).support from + this ⟨z, hzH⟩ hreach + intro y hy + rw [reachable_iff_reflTransGen] at hy + induction hy with + | refl => exact (W i).start_mem_support + | @tail a b _ hab ih => + obtain ⟨j, hj⟩ := (hadj_W a.1 b.1).mp hab + have ha_j : a.1 ∈ (W j).support := + (Walk.mem_verts_toSubgraph (W j)).mp ((W j).toSubgraph.edge_vert hj) + have hb_j : b.1 ∈ (W j).support := + (Walk.mem_verts_toSubgraph (W j)).mp ((W j).toSubgraph.edge_vert hj.symm) + by_cases hij : i = j + · subst hij + exact hb_j + · exact False.elim (Set.disjoint_left.mp + (reroute_disjoint_support hQ hπ_inj hstep n hij) ih ha_j) + simp only [D, component, hverts] + have hD_comp : ∀ i : Fin k, IsComponent H (D i) := + fun i ↦ ⟨⟨(Q i).first, hfirst_H i⟩, hD_eq_comp i⟩ + have hD_inj : Function.Injective D := by + intro i₁ i₂ hEq + by_contra hne + have hmem : (Q i₁).first ∈ (D i₂).verts := hEq ▸ (W i₁).start_mem_support + exact Set.disjoint_left.mp (reroute_disjoint_support hQ hπ_inj hstep n hne) + (W i₁).start_mem_support hmem + have hD_clean : ∀ i : Fin k, IsCleanPathSubgraph H (D i) X₁ X₂ := by + intro i + refine ⟨⟨(Q i).first, endV i, W i, reroute_isPath hQ hπ_inj hstep n i, + (Q i).first_mem, hend_mem_X₂ i⟩, rfl, ?_, hW_mem_X₁ i, hW_mem_X₂ i⟩ + intro u hu v _ + constructor + · intro huv + obtain ⟨j, hj⟩ := (hadj_W u v).mp huv + have hu_j : u ∈ (W j).support := + (Walk.mem_verts_toSubgraph (W j)).mp ((W j).toSubgraph.edge_vert hj) + by_cases hij : i = j + · subst hij + exact hj + · exact False.elim (Set.disjoint_left.mp + (reroute_disjoint_support hQ hπ_inj hstep n hij) hu hu_j) + · intro huv + exact (W i).toSubgraph.adj_sub huv + refine ⟨H, D, hH, hD_inj, fun i ↦ ⟨hD_comp i, hD_clean i⟩, ?_⟩ + intro C hC hC_ne + obtain ⟨x, rfl⟩ := hC + have hx_not_W : ∀ i : Fin k, x.1 ∉ (W i).support := by + intro i hxi + exact hC_ne i (IsComponent.eq_of_mem ⟨x, rfl⟩ (hD_comp i) + (self_mem_componentVerts H x) hxi) + have hcomp_eq : (component H x).verts = {x.1} := by + ext z + simp only [component_verts, mem_componentVerts_iff, Set.mem_singleton_iff] + refine ⟨?_, fun hEq ↦ hEq ▸ ⟨x.2, Reachable.refl x⟩⟩ + rintro ⟨hzH, hreach⟩ + suffices ∀ y : H.verts, H.coe.Reachable x y → y.1 = x.1 from this ⟨z, hzH⟩ hreach + intro y hy + rw [reachable_iff_reflTransGen] at hy + induction hy with + | refl => rfl + | @tail a b _ hab ih => + obtain ⟨i, hi⟩ := (hadj_W a.1 b.1).mp hab + have ha_i : a.1 ∈ (W i).support := + (Walk.mem_verts_toSubgraph (W i)).mp ((W i).toSubgraph.edge_vert hi) + rw [ih] at ha_i + exact False.elim (hx_not_W i ha_i) + rw [hcomp_eq, Set.ncard_singleton] + +/-- **Graph Minors IV, (6.1)** (pages 241–242): Let `P = (G, μ, Δ, φ)` be a robust `Ω`-patchwork, +let `X₁, X₂ ⊆ V(G)`, and let `k ≥ 0` be an integer. Then conditions (i), (ii), and (iii) are +equivalent. -/ +theorem theorem_6_1_proof (hM : MengerStatement.{u, v}) {P : Patchwork Ω α β} (hrob : P.IsRobust) + {X₁ X₂ : Set α} (hX₁ : X₁ ⊆ P.G.vertexSet) (hX₂ : X₂ ⊆ P.G.vertexSet) (k : ℕ) : + (Theorem61Cond1 P X₁ X₂ k ↔ Theorem61Cond2 P X₁ X₂ k) ∧ + (Theorem61Cond2 P X₁ X₂ k ↔ Theorem61Cond3 P X₁ X₂ k) := by + have hi := theorem_6_1_i_iff_disjointPaths hM hX₁ hX₂ k + have h32 : Theorem61Cond3 P X₁ X₂ k → Theorem61Cond2 P X₁ X₂ k := theorem_6_1_iii_imp_ii + have h2p : Theorem61Cond2 P X₁ X₂ k → HasDisjointPaths P.G.toHypergraph.skeleton X₁ X₂ k := + theorem_6_1_ii_imp_disjointPaths + have hp3 : HasDisjointPaths P.G.toHypergraph.skeleton X₁ X₂ k → Theorem61Cond3 P X₁ X₂ k := + theorem_6_1_disjointPaths_imp_iii hrob hX₁ hX₂ + exact ⟨⟨fun h ↦ h32 (hp3 (hi.mp h)), fun h ↦ hi.mpr (h2p h)⟩, + ⟨fun h ↦ hp3 (h2p h), h32⟩⟩ + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/Patchwork/StarWQO.lean b/LeanPool/GraphMinor/GM04/Patchwork/StarWQO.lean new file mode 100644 index 0000000000..32298cb663 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Patchwork/StarWQO.lean @@ -0,0 +1,1112 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Higman +public import LeanPool.GraphMinor.GM04.Patchwork.Stars +import Mathlib.Data.Nat.Nth +import Mathlib.Data.Fintype.Pigeonhole + +/-! +# Well-quasi-ordering star-decompositions of patchworks (Graph Minors IV, (8.4)) + +This file formalizes Graph Minors IV, (8.4) (pages 249–251): + +* `higman83_universal`, `higman83_on_infinite_set`, and `higman83_partitioned`: helpers applying + `Higman83Statement` on infinite subsets of `ℕ` and across finitely many tag classes. +* `lemma_8_4_claim_1`–`lemma_8_4_claim_8`: claims (1)–(8) of the proof of (8.4). +* `theorem_8_4`: Graph Minors IV, (8.4), showing that if `(Sᵢ, σᵢ)` is a star-decomposition of a + removable `Ω`-patchwork `Pᵢ` with `|V(σᵢ(o(Sᵢ)))| ≤ n` and the tips `{Pᵢ | σᵢ(s)}` are + well-quasi-ordered by simulation, then `Pᵢ` is simulated in `P_{i'}` for some `i < i'`. + +Instead of mutating the vertex type of each `Pᵢ` in claim (3) ("By replacing each $P_i$ by an ... +$\Omega$-patchwork, we may therefore assume, to simplify notation, that for some set $V_0$ and march +$\pi_0$ in $V_0$, (3) *$V(\sigma_i(o(S_i))) = V_0$ and $\pi(G_i) = \pi_0$ for all $i \in I_2$.*"), +we fix a coordinate bijection `γᵢ : Fin m → V(σᵢ(o(Sᵢ)))` with inverse +`γ_invᵢ` for each `i ∈ I₂`, pull back the root marches to `Fin m` to pass to an infinite subset +where the pulled-back root march is constant (`π₀`), and use the composite bijection +`v ↦ γ_{i'}(γ_invᵢ(v))` between `V(σᵢ(o(Sᵢ)))` and `V(σ_{i'}(o(S_{i'})))`. +-/ + +public section + +namespace GraphMinor.GM04 + +open SimpleGraph _root_.GraphMinor.Hypergraph + +universe u v w u₁ u₂ + +variable {Ω : Type w} [Preorder Ω] {α β ι : Type*} + +/-! ### Universe-polymorphic and partitioned helpers for labelled Higman -/ + +open Classical in +/-- A wrapper equipping `Σ i : ℕ, Fin (X i).card` with the pullback preorder of `ℓ`. -/ +private structure HigmanIdx {κ : Type*} {Ω' : Type*} (X : ℕ → Finset κ) (_ℓ : ℕ → κ → Ω') where + i : ℕ + j : Fin (X i).card + +open Classical in +private instance {κ : Type*} {Ω' : Type*} [Preorder Ω'] (X : ℕ → Finset κ) (ℓ : ℕ → κ → Ω') : + Preorder (ULift.{u₂} (HigmanIdx X ℓ)) where + le a b := ℓ a.down.i ((X a.down.i).equivFin.symm a.down.j).1 ≤ + ℓ b.down.i ((X b.down.i).equivFin.symm b.down.j).1 + le_refl _ := le_rfl + le_trans _ _ _ hab hbc := le_trans hab hbc + +open Classical in +private theorem higmanIdx_wqo {κ : Type*} {Ω' : Type*} [Preorder Ω'] + (hΩ' : WellQuasiOrderedLE Ω') (X : ℕ → Finset κ) (ℓ : ℕ → κ → Ω') : + WellQuasiOrderedLE (ULift.{u₂} (HigmanIdx X ℓ)) := by + refine ⟨fun f ↦ ?_⟩ + obtain ⟨m, n, hlt, hle⟩ := + hΩ'.wqo fun k ↦ ℓ (f k).down.i ((X (f k).down.i).equivFin.symm (f k).down.j).1 + exact ⟨m, n, hlt, hle⟩ + +open Classical in +/-- `Higman83Statement` at any universe pair `{u₁, u₂}` implies `Higman83Statement` for any type +`κ` and any well-quasi-ordered type `Ω'`. -/ +theorem higman83_universal (hH : Higman83Statement.{u₁, u₂}) + {κ : Type*} {Ω' : Type*} [Preorder Ω'] (hΩ' : WellQuasiOrderedLE Ω') + (X : ℕ → Finset κ) (ℓ : ℕ → κ → Ω') : + ∃ I : Set ℕ, I.Infinite ∧ ∀ i ∈ I, ∀ i' ∈ I, i < i' → + ∃ g : κ → κ, Set.InjOn g (X i) ∧ Set.MapsTo g (X i) (X i') ∧ + ∀ x ∈ X i, ℓ i x ≤ ℓ i' (g x) := by + have hwqo : WellQuasiOrderedLE (ULift.{u₂} (HigmanIdx X ℓ)) := higmanIdx_wqo hΩ' X ℓ + let toIdx (i : ℕ) (x : {x // x ∈ X i}) : ULift.{u₁} (HigmanIdx X ℓ) := + ULift.up ⟨i, (X i).equivFin x⟩ + let X₀ (i : ℕ) : Finset (ULift.{u₁} (HigmanIdx X ℓ)) := + (Finset.univ : Finset (Fin (X i).card)).image fun j ↦ ULift.up ⟨i, j⟩ + let ℓ₀ : ℕ → ULift.{u₁} (HigmanIdx X ℓ) → ULift.{u₂} (HigmanIdx X ℓ) := + fun _ p ↦ ULift.up p.down + obtain ⟨I, hI_inf, hI⟩ := hH hwqo X₀ ℓ₀ + refine ⟨I, hI_inf, fun i hi i' hi' hlt ↦ ?_⟩ + obtain ⟨g₀, hg₀_inj, hg₀_maps, hg₀_le⟩ := hI i hi i' hi' hlt + have hmem_X₀ : ∀ x : {x // x ∈ X i}, toIdx i x ∈ X₀ i := by + intro x + exact Finset.mem_image.mpr ⟨(X i).equivFin x, Finset.mem_univ _, rfl⟩ + have hg₀_mem : ∀ x : {x // x ∈ X i}, + ∃ j' : Fin (X i').card, g₀ (toIdx i x) = ULift.up ⟨i', j'⟩ := by + intro x + have hm := hg₀_maps (hmem_X₀ x) + obtain ⟨j', _, hEq⟩ := Finset.mem_image.mp hm + exact ⟨j', hEq.symm⟩ + let g (x : κ) : κ := + if hx : x ∈ (X i : Set κ) then + ((X i').equivFin.symm (hg₀_mem ⟨x, hx⟩).choose).1 + else x + refine ⟨g, ?_, ?_, ?_⟩ + · intro x₁ hx₁ x₂ hx₂ hEq + dsimp only [g] at hEq + rw [dite_eq_left_of_eq_true (eq_true hx₁), dite_eq_left_of_eq_true (eq_true hx₂)] at hEq + have hsub_eq : (X i').equivFin.symm (hg₀_mem ⟨x₁, hx₁⟩).choose = + (X i').equivFin.symm (hg₀_mem ⟨x₂, hx₂⟩).choose := Subtype.ext hEq + have hj'_eq : (hg₀_mem ⟨x₁, hx₁⟩).choose = (hg₀_mem ⟨x₂, hx₂⟩).choose := + (X i').equivFin.symm.injective hsub_eq + have hg₀_eq : g₀ (toIdx i ⟨x₁, hx₁⟩) = g₀ (toIdx i ⟨x₂, hx₂⟩) := by + rw [(hg₀_mem ⟨x₁, hx₁⟩).choose_spec, (hg₀_mem ⟨x₂, hx₂⟩).choose_spec, hj'_eq] + have htoIdx_eq := hg₀_inj (hmem_X₀ ⟨x₁, hx₁⟩) (hmem_X₀ ⟨x₂, hx₂⟩) hg₀_eq + have hj_eq : (X i).equivFin ⟨x₁, hx₁⟩ = (X i).equivFin ⟨x₂, hx₂⟩ := by + have hdown := congrArg ULift.down htoIdx_eq + injection hdown with h_i h_j + exact congrArg Subtype.val ((X i).equivFin.injective hj_eq) + · intro x hx + dsimp only [g] + rw [dite_eq_left_of_eq_true (eq_true hx)] + exact ((X i').equivFin.symm (hg₀_mem ⟨x, hx⟩).choose).2 + · intro x hx + have hx' : x ∈ (X i : Set κ) := hx + dsimp only [g] + rw [dite_eq_left_of_eq_true (eq_true hx')] + have hle := hg₀_le (toIdx i ⟨x, hx⟩) (hmem_X₀ ⟨x, hx⟩) + have hspec := (hg₀_mem ⟨x, hx⟩).choose_spec + change ℓ (toIdx i ⟨x, hx⟩).down.i + ((X (toIdx i ⟨x, hx⟩).down.i).equivFin.symm (toIdx i ⟨x, hx⟩).down.j).1 ≤ + ℓ (g₀ (toIdx i ⟨x, hx⟩)).down.i + ((X (g₀ (toIdx i ⟨x, hx⟩)).down.i).equivFin.symm (g₀ (toIdx i ⟨x, hx⟩)).down.j).1 at hle + rw [hspec] at hle + simpa [toIdx] using hle + +open Classical in +/-- Applying `Higman83Statement` within a given infinite subset `I ⊆ ℕ`. -/ +theorem higman83_on_infinite_set (hH : Higman83Statement.{u₁, u₂}) + {κ : Type*} {Ω' : Type*} [Preorder Ω'] (hΩ' : WellQuasiOrderedLE Ω') + {I : Set ℕ} (hI : I.Infinite) (X : ℕ → Finset κ) (ℓ : ℕ → κ → Ω') : + ∃ I' ⊆ I, I'.Infinite ∧ ∀ i ∈ I', ∀ i' ∈ I', i < i' → + ∃ g : κ → κ, Set.InjOn g (X i) ∧ Set.MapsTo g (X i) (X i') ∧ + ∀ x ∈ X i, ℓ i x ≤ ℓ i' (g x) := by + let φ : ℕ → ℕ := Nat.nth (· ∈ I) + have hφ_mono : StrictMono φ := Nat.nth_strictMono hI + have hφ_mem : ∀ k, φ k ∈ I := Nat.nth_mem_of_infinite hI + obtain ⟨J, hJ_inf, hJ⟩ := higman83_universal hH hΩ' (fun k ↦ X (φ k)) (fun k ↦ ℓ (φ k)) + refine ⟨φ '' J, ?_, hJ_inf.image hφ_mono.injective.injOn, ?_⟩ + · rintro _ ⟨k, _, rfl⟩ + exact hφ_mem k + · rintro _ ⟨k, hk, rfl⟩ _ ⟨k', hk', rfl⟩ hlt + exact hJ k hk k' hk' (hφ_mono.lt_iff_lt.mp hlt) + +open Classical in +/-- Pigeonhole principle for an infinite set `I ⊆ ℕ` mapped into a finite set `s : Set τ`. -/ +theorem exists_infinite_fiber {τ : Type*} {I : Set ℕ} (hI : I.Infinite) + {s : Set τ} (hs : s.Finite) {f : ℕ → τ} (hf : ∀ i ∈ I, f i ∈ s) : + ∃ c ∈ s, {i ∈ I | f i = c}.Infinite := by + by_contra! hnot + have hEq : I = ⋃ c ∈ s, {i ∈ I | f i = c} := by + ext i + simp only [Set.mem_iUnion, Set.mem_ofPred_eq, exists_prop] + exact ⟨fun hi ↦ ⟨f i, hf i hi, hi, rfl⟩, fun ⟨_, _, hi, _⟩ ↦ hi⟩ + have hfin : I.Finite := by + rw [hEq] + exact hs.biUnion fun c hc ↦ hnot c hc + exact hI hfin + +open Classical in +/-- Iterating `higman83_on_infinite_set` over a finite set `A : Finset τ` of tags. -/ +theorem higman83_partitioned_finset (hH : Higman83Statement.{u₁, u₂}) + {κ τ : Type*} {Ω' : Type*} [Preorder Ω'] (hΩ' : WellQuasiOrderedLE Ω') + {I₀ : Set ℕ} (hI₀ : I₀.Infinite) (E : ℕ → Finset κ) (tag : ℕ → κ → τ) (ℓ : ℕ → κ → Ω') + (A : Finset τ) : + ∃ I ⊆ I₀, I.Infinite ∧ ∀ t ∈ A, ∀ i ∈ I, ∀ i' ∈ I, i < i' → + ∃ g : κ → κ, + Set.InjOn g {x ∈ (E i : Set κ) | tag i x = t} ∧ + Set.MapsTo g {x ∈ (E i : Set κ) | tag i x = t} {x ∈ (E i' : Set κ) | tag i' x = t} ∧ + ∀ x ∈ {x ∈ (E i : Set κ) | tag i x = t}, ℓ i x ≤ ℓ i' (g x) := by + induction A using Finset.induction_on with + | empty => exact ⟨I₀, subset_rfl, hI₀, fun _ h ↦ False.elim (Finset.notMem_empty _ h)⟩ + | @insert t₀ A _ ih => + obtain ⟨I₁, hI₁_sub, hI₁_inf, hI₁⟩ := ih + obtain ⟨I₂, hI₂_sub, hI₂_inf, hI₂⟩ := + higman83_on_infinite_set hH hΩ' hI₁_inf (fun i ↦ (E i).filter fun x ↦ tag i x = t₀) ℓ + refine ⟨I₂, hI₂_sub.trans hI₁_sub, hI₂_inf, fun t ht i hi i' hi' hlt ↦ ?_⟩ + rcases Finset.mem_insert.mp ht with rfl | htA + · obtain ⟨g, hg_inj, hg_maps, hg_le⟩ := hI₂ i hi i' hi' hlt + simp only [Finset.coe_filter] at hg_inj hg_maps + refine ⟨g, hg_inj, hg_maps, fun x hx ↦ hg_le x (Finset.mem_filter.mpr hx)⟩ + · exact hI₁ t htA i (hI₂_sub hi) i' (hI₂_sub hi') hlt + +open Classical in +/-- Piecing together fiber injections over all `t : τ`. -/ +theorem piece_fiber_injections {κ τ : Type*} {Ω' : Type*} [Preorder Ω'] + {E₁ E₂ : Set κ} {tag₁ tag₂ : κ → τ} {ℓ₁ ℓ₂ : κ → Ω'} + (hfib : ∀ t : τ, ∃ g : κ → κ, + Set.InjOn g {x ∈ E₁ | tag₁ x = t} ∧ + Set.MapsTo g {x ∈ E₁ | tag₁ x = t} {x ∈ E₂ | tag₂ x = t} ∧ + ∀ x ∈ {x ∈ E₁ | tag₁ x = t}, ℓ₁ x ≤ ℓ₂ (g x)) : + ∃ g : κ → κ, Set.InjOn g E₁ ∧ Set.MapsTo g E₁ E₂ ∧ + (∀ x ∈ E₁, tag₂ (g x) = tag₁ x) ∧ (∀ x ∈ E₁, ℓ₁ x ≤ ℓ₂ (g x)) := by + let g (x : κ) : κ := (hfib (tag₁ x)).choose x + have hmem_fib : ∀ x ∈ E₁, x ∈ {y ∈ E₁ | tag₁ y = tag₁ x} := fun x hx ↦ ⟨hx, rfl⟩ + have hg_mem : ∀ x ∈ E₁, g x ∈ E₂ ∧ tag₂ (g x) = tag₁ x := + fun x hx ↦ (hfib (tag₁ x)).choose_spec.2.1 (hmem_fib x hx) + refine ⟨g, ?_, fun x hx ↦ (hg_mem x hx).1, fun x hx ↦ (hg_mem x hx).2, fun x hx ↦ ?_⟩ + · intro x₁ hx₁ x₂ hx₂ hEq + have htag_eq : tag₁ x₁ = tag₁ x₂ := by + rw [← (hg_mem x₁ hx₁).2, ← (hg_mem x₂ hx₂).2, hEq] + have hx₂_fib : x₂ ∈ {y ∈ E₁ | tag₁ y = tag₁ x₁} := ⟨hx₂, htag_eq.symm⟩ + have hEq' : (hfib (tag₁ x₁)).choose x₁ = (hfib (tag₁ x₁)).choose x₂ := by + dsimp only [g] at hEq + rwa [← htag_eq] at hEq + exact (hfib (tag₁ x₁)).choose_spec.1 (hmem_fib x₁ hx₁) hx₂_fib hEq' + · exact (hfib (tag₁ x)).choose_spec.2.2 x (hmem_fib x hx) + +/-! ### Finite types of marches and subgraphs on `Fin m`, and coordinate pullbacks -/ + +open Classical in +/-- A march (nodup list) in `Fin m`. -/ +abbrev MarchIn (m : ℕ) := {ρ : List (Fin m) // ρ.Nodup} + +open Classical in +instance (m : ℕ) : Finite ((⊤ : SimpleGraph (Fin m)).Subgraph) := + Finite.of_injective (fun H ↦ (H.verts, H.Adj)) fun _ _ h ↦ + Subgraph.ext (congrArg Prod.fst h) (congrArg Prod.snd h) + +open Classical in +instance (m : ℕ) : Finite (MarchIn m) := by + refine Finite.of_injective (fun (ρ : MarchIn m) (i : Fin m) ↦ ρ.1[i.1]?) ?_ + intro ρ₁ ρ₂ h + apply Subtype.ext + apply List.ext_getElem? + intro i + by_cases hi : i < m + · exact congrFun h ⟨i, hi⟩ + · have hlen : ∀ ρ : MarchIn m, ρ.1.length ≤ m := by + intro ρ + rw [← List.toFinset_card_of_nodup ρ.2] + exact (Finset.card_le_univ _).trans_eq (Fintype.card_fin m) + have h₁ : ρ₁.1[i]? = none := List.getElem?_eq_none ((hlen ρ₁).trans (Nat.le_of_not_lt hi)) + have h₂ : ρ₂.1[i]? = none := List.getElem?_eq_none ((hlen ρ₂).trans (Nat.le_of_not_lt hi)) + rw [h₁, h₂] + +open Classical in +/-- The inclusion `Fin m → α` from an equivalence `c : Fin m ≃ V`. -/ +def toVal {V : Set α} {m : ℕ} (c : Fin m ≃ V) (x : Fin m) : α := (c x).1 + +open Classical in +theorem toVal_mem {V : Set α} {m : ℕ} (c : Fin m ≃ V) (x : Fin m) : toVal c x ∈ V := (c x).2 + +open Classical in +theorem toVal_injective {V : Set α} {m : ℕ} (c : Fin m ≃ V) : Function.Injective (toVal c) := + fun _ _ h ↦ c.injective (Subtype.ext h) + +open Classical in +/-- The bijection `V → V'` induced by two coordinate equivalences `c : Fin m ≃ V` and +`c' : Fin m ≃ V'`, extended by the identity outside `V`. -/ +noncomputable def coordMap {V V' : Set α} {m : ℕ} (c : Fin m ≃ V) (c' : Fin m ≃ V') (v : α) : α := + if hv : v ∈ V then (c' (c.symm ⟨v, hv⟩)).1 else v + +open Classical in +@[simp] +theorem coordMap_toVal {V V' : Set α} {m : ℕ} (c : Fin m ≃ V) (c' : Fin m ≃ V') (x : Fin m) : + coordMap c c' (toVal c x) = toVal c' x := by + have hx : (c x).1 ∈ V := (c x).2 + change (if hv : (c x).1 ∈ V then (c' (c.symm ⟨(c x).1, hv⟩)).1 else (c x).1) = (c' x).1 + rw [dite_eq_left_of_eq_true (eq_true hx)] + simp + +open Classical in +theorem coordMap_bijOn {V V' : Set α} {m : ℕ} (c : Fin m ≃ V) (c' : Fin m ≃ V') : + Set.BijOn (coordMap c c') V V' := by + refine ⟨fun v hv ↦ ?_, fun v₁ hv₁ v₂ hv₂ hEq ↦ ?_, fun v' hv' ↦ ?_⟩ + · dsimp only [coordMap] + rw [dite_eq_left_of_eq_true (eq_true hv)] + exact (c' (c.symm ⟨v, hv⟩)).2 + · dsimp only [coordMap] at hEq + rw [dite_eq_left_of_eq_true (eq_true hv₁), dite_eq_left_of_eq_true (eq_true hv₂)] at hEq + have hEq' : c.symm ⟨v₁, hv₁⟩ = c.symm ⟨v₂, hv₂⟩ := c'.injective (Subtype.ext hEq) + exact congrArg Subtype.val (c.symm.injective hEq') + · let x := c'.symm ⟨v', hv'⟩ + refine ⟨toVal c x, toVal_mem c x, ?_⟩ + rw [coordMap_toVal] + exact congrArg Subtype.val (c'.apply_symm_apply ⟨v', hv'⟩) + +open Classical in +theorem toVal_image_preimage {V : Set α} {m : ℕ} (c : Fin m ≃ V) {S : Set α} (hS : S ⊆ V) : + toVal c '' (toVal c ⁻¹' S) = S := by + refine Set.Subset.antisymm (Set.image_preimage_subset _ _) fun v hv ↦ ?_ + let x := c.symm ⟨v, hS hv⟩ + have hx : toVal c x = v := congrArg Subtype.val (c.apply_symm_apply ⟨v, hS hv⟩) + exact ⟨x, show toVal c x ∈ S from hx.symm ▸ hv, hx⟩ + +open Classical in +theorem image_coordMap_eq_of_preimage_eq {V V' : Set α} {m : ℕ} (c : Fin m ≃ V) (c' : Fin m ≃ V') + {S S' : Set α} (hS : S ⊆ V) (hS' : S' ⊆ V') (hEq : toVal c ⁻¹' S = toVal c' ⁻¹' S') : + coordMap c c' '' S = S' := by + rw [← toVal_image_preimage c hS, ← Set.image_comp] + have hcomp : coordMap c c' ∘ toVal c = toVal c' := funext (coordMap_toVal c c') + rw [hcomp, hEq, toVal_image_preimage c' hS'] + +open Classical in +/-- Pulling back a list `π : List α` with vertices in `V` along `c : Fin m ≃ V`. -/ +noncomputable def pullList {V : Set α} {m : ℕ} (c : Fin m ≃ V) (π : List α) : List (Fin m) := + π.filterMap fun v ↦ if hv : v ∈ V then some (c.symm ⟨v, hv⟩) else none + +open Classical in +theorem map_toVal_pullList {V : Set α} {m : ℕ} (c : Fin m ≃ V) {π : List α} + (hπ : ∀ v ∈ π, v ∈ V) : (pullList c π).map (toVal c) = π := by + induction π with + | nil => rfl + | cons v l ih => + have hv : v ∈ V := hπ v List.mem_cons_self + have hl : ∀ w ∈ l, w ∈ V := fun w hw ↦ hπ w (List.mem_cons_of_mem v hw) + dsimp only [pullList, List.filterMap_cons] + rw [dite_eq_left_of_eq_true (eq_true hv)] + simp only [List.map_cons] + congr 1 + · exact congrArg Subtype.val (c.apply_symm_apply ⟨v, hv⟩) + · exact ih hl + +open Classical in +theorem pullList_nodup {V : Set α} {m : ℕ} (c : Fin m ≃ V) {π : List α} + (hnd : π.Nodup) (hπ : ∀ v ∈ π, v ∈ V) : (pullList c π).Nodup := by + have hmap : ((pullList c π).map (toVal c)).Nodup := by + rw [map_toVal_pullList c hπ] + exact hnd + exact hmap.of_map (toVal c) + +open Classical in +theorem map_coordMap_eq_of_pullList_eq {V V' : Set α} {m : ℕ} (c : Fin m ≃ V) (c' : Fin m ≃ V') + {π π' : List α} (hπ : ∀ v ∈ π, v ∈ V) (hπ' : ∀ v' ∈ π', v' ∈ V') + (hEq : pullList c π = pullList c' π') : + π.map (coordMap c c') = π' := by + conv_lhs => rw [← map_toVal_pullList c hπ] + rw [List.map_map] + have hcomp : coordMap c c' ∘ toVal c = toVal c' := funext (coordMap_toVal c c') + rw [hcomp, hEq, map_toVal_pullList c' hπ'] + +/-! ### Graph Minors IV, (8.4), claims (1)–(3) -/ + +open Classical in +/-- Graph Minors IV, (8.4), claim (1) (page 250): +"Since there are only $n + 1$ possibilities for each $|V(\sigma_i(o(S_i)))|$ we may choose an +infinite subset $I_1 \subseteq \{1, 2, \dots\}$ and $m \ge 0$ such that +(1) For all $i \in I_1$, $|V(\sigma_i(o(S_i)))| = m$." -/ +theorem lemma_8_4_claim_1 {n : ℕ} {S : ℕ → RootedTree ι} {σ : ℕ → ι → RootedHypergraph α β} + (hcard : ∀ i, (σ i (S i).root).vertexSet.ncard ≤ n) : + ∃ (I₁ : Set ℕ) (m : ℕ), I₁.Infinite ∧ m ≤ n ∧ + ∀ i ∈ I₁, (σ i (S i).root).vertexSet.ncard = m := by + obtain ⟨m, hm, hI₁⟩ := exists_infinite_fiber Set.infinite_univ (Set.finite_Iic n) + (f := fun i ↦ (σ i (S i).root).vertexSet.ncard) (fun i _ ↦ hcard i) + exact ⟨{i ∈ Set.univ | (σ i (S i).root).vertexSet.ncard = m}, m, hI₁, hm, fun _ hi ↦ hi.2⟩ + +omit [Preorder Ω] in +open Classical in +/-- Graph Minors IV, (8.4), claim (2) (page 250): +"Similarly, we may choose an infinite $I_2 \subseteq I_1$ and $k \ge 0$ such that +(2) For all $i \in I_2$, $|\bar{\pi}(G_i)| = k$." -/ +theorem lemma_8_4_claim_2 {m : ℕ} {P : ℕ → Patchwork Ω α β} {S : ℕ → RootedTree ι} + {σ : ℕ → ι → RootedHypergraph α β} (htd : ∀ i, IsTreeDecomposition (P i).G (S i) (σ i)) + {I₁ : Set ℕ} (hI₁ : I₁.Infinite) + (hm : ∀ i ∈ I₁, (σ i (S i).root).vertexSet.ncard = m) : + ∃ (I₂ : Set ℕ) (k : ℕ), I₂ ⊆ I₁ ∧ I₂.Infinite ∧ k ≤ m ∧ + ∀ i ∈ I₂, (P i).G.roots.length = k := by + have hlen_le : ∀ i ∈ I₁, (P i).G.roots.length ≤ m := by + intro i hi + have hset : ((P i).G.roots.toFinset : Set α) ⊆ (σ i (S i).root).vertexSet := by + intro v hv + rw [Finset.mem_coe, List.mem_toFinset, ← (htd i).roots_root] at hv + exact (σ i (S i).root).roots_subset v hv + have hncard : ((P i).G.roots.toFinset : Set α).ncard = (P i).G.roots.length := by + rw [Set.ncard_coe_finset, List.toFinset_card_of_nodup (P i).G.roots_nodup] + rw [← hm i hi, ← hncard] + exact Set.ncard_le_ncard hset (σ i (S i).root).vertexSet_finite + obtain ⟨k, hk, hI₂⟩ := exists_infinite_fiber hI₁ (Set.finite_Iic m) + (f := fun i ↦ (P i).G.roots.length) hlen_le + exact ⟨{i ∈ I₁ | (P i).G.roots.length = k}, k, fun _ hi ↦ hi.1, hI₂, hk, fun _ hi ↦ hi.2⟩ + +open Classical in +/-- Canonical coordinate equivalence `Fin m ≃ V` for a finite set `V` with `V.ncard = m`. -/ +noncomputable def coordEquiv {V : Set α} (hfin : V.Finite) {m : ℕ} (hm : V.ncard = m) : + Fin m ≃ V := by + let _ : Fintype V := hfin.fintype + have hcard : Fintype.card V = m := by + rw [← hm, Set.ncard_eq_toFinset_card V hfin, Set.Finite.card_toFinset] + exact (Fintype.equivFinOfCardEq hcard).symm + +open Classical in +/-- Canonical coordinate equivalence `Fin m ≃ V(σᵢ(o(Sᵢ)))` when `|V(σᵢ(o(Sᵢ)))| = m`. -/ +noncomputable def rootCoord (S : ℕ → RootedTree ι) (σ : ℕ → ι → RootedHypergraph α β) + (i : ℕ) {m : ℕ} (hm : (σ i (S i).root).vertexSet.ncard = m) : + Fin m ≃ (σ i (S i).root).vertexSet := + coordEquiv (σ i (S i).root).vertexSet_finite hm + +open Classical in +/-- Total pulled-back list in `Fin m` along `rootCoord S σ i hm` (empty if `|V| ≠ m`). -/ +noncomputable def rootPullList (S : ℕ → RootedTree ι) (σ : ℕ → ι → RootedHypergraph α β) + (m i : ℕ) (π : List α) : List (Fin m) := + if hm : (σ i (S i).root).vertexSet.ncard = m then + pullList (rootCoord S σ i hm) π + else [] + +open Classical in +theorem rootPullList_eq (S : ℕ → RootedTree ι) (σ : ℕ → ι → RootedHypergraph α β) + {m i : ℕ} (hm : (σ i (S i).root).vertexSet.ncard = m) (π : List α) : + rootPullList S σ m i π = pullList (rootCoord S σ i hm) π := + dite_eq_left_of_eq_true (eq_true hm) + +omit [Preorder Ω] in +open Classical in +/-- Graph Minors IV, (8.4), claim (3) (page 250): +Coordinate version of "By replacing each $P_i$ by an ...isomorphic... $\Omega$-patchwork, we may +therefore assume, +to simplify notation, that for some set $V_0$ and march $\pi_0$ in $V_0$, (3) +*$V(\sigma_i(o(S_i))) = V_0$ and $\pi(G_i) = \pi_0$ for all $i \in I_2$": +there is an infinite `I₂' ⊆ I₂` and a march `π₀` in `Fin m` such that +`rootPullList S σ m i (P i).G.roots = π₀.1` for all `i ∈ I₂'`. -/ +theorem lemma_8_4_claim_3 {m : ℕ} {P : ℕ → Patchwork Ω α β} {S : ℕ → RootedTree ι} + {σ : ℕ → ι → RootedHypergraph α β} (htd : ∀ i, IsTreeDecomposition (P i).G (S i) (σ i)) + {I₂ : Set ℕ} (hI₂ : I₂.Infinite) + (hm : ∀ i ∈ I₂, (σ i (S i).root).vertexSet.ncard = m) : + ∃ (I₂' : Set ℕ) (π₀ : MarchIn m), + I₂' ⊆ I₂ ∧ I₂'.Infinite ∧ + ∀ i ∈ I₂', rootPullList S σ m i (P i).G.roots = π₀.1 := by + have hroots_sub : ∀ i, ∀ v ∈ (P i).G.roots, v ∈ (σ i (S i).root).vertexSet := by + intro i v hv + rw [← (htd i).roots_root] at hv + exact (σ i (S i).root).roots_subset v hv + let f (i : ℕ) : MarchIn m := + if hnd : (rootPullList S σ m i (P i).G.roots).Nodup then + ⟨rootPullList S σ m i (P i).G.roots, hnd⟩ + else ⟨[], List.nodup_nil⟩ + obtain ⟨π₀, _, hI₂'⟩ := + exists_infinite_fiber hI₂ Set.finite_univ (f := f) (fun _ _ ↦ Set.mem_univ _) + refine ⟨{i ∈ I₂ | f i = π₀}, π₀, fun _ hi ↦ hi.1, hI₂', fun i hi' ↦ ?_⟩ + have hmi : (σ i (S i).root).vertexSet.ncard = m := hm i hi'.1 + have hnd : (rootPullList S σ m i (P i).G.roots).Nodup := by + rw [rootPullList_eq S σ hmi] + exact pullList_nodup _ (P i).G.roots_nodup (hroots_sub i) + have hEq := congrArg Subtype.val hi'.2 + dsimp only [f] at hEq + rwa [dite_eq_left_of_eq_true (eq_true hnd)] at hEq + +/-! ### Pulled-back edge invariants and Graph Minors IV, (8.4), claims (4)–(8) -/ + +open Classical in +/-- Pulled-back march `μᵢ(e)` in `Fin m` along `rootCoord S σ i hm`. -/ +noncomputable def μPull (S : ℕ → RootedTree ι) (σ : ℕ → ι → RootedHypergraph α β) + (P : ℕ → Patchwork Ω α β) (m i : ℕ) (e : β) : List (Fin m) := + rootPullList S σ m i ((P i).μ e) + +open Classical in +/-- Pulled-back patch `Δᵢ(e)` on `Fin m` along `marchMapSubgraph ((P i).μ e) (μPull ...)`. -/ +noncomputable def ΔPull (S : ℕ → RootedTree ι) (σ : ℕ → ι → RootedHypergraph α β) + (P : ℕ → Patchwork Ω α β) (m i : ℕ) (e : β) : + Set ((⊤ : SimpleGraph (Fin m)).Subgraph) := + marchMapSubgraph ((P i).μ e) (μPull S σ P m i e) '' ((P i).Δ e).groupings + +open Classical in +/-- Pulled-back end set `V_{Gᵢ}(e)` in `Fin m` along `rootCoord S σ i hm`. -/ +noncomputable def endsPull (S : ℕ → RootedTree ι) (σ : ℕ → ι → RootedHypergraph α β) + (P : ℕ → Patchwork Ω α β) (m i : ℕ) (e : β) : Set (Fin m) := + if hm : (σ i (S i).root).vertexSet.ncard = m then + toVal (rootCoord S σ i hm) ⁻¹' (P i).G.ends e + else ∅ + +omit [Preorder Ω] in +open Classical in +theorem endsPull_eq (S : ℕ → RootedTree ι) (σ : ℕ → ι → RootedHypergraph α β) + (P : ℕ → Patchwork Ω α β) {m i : ℕ} (hm : (σ i (S i).root).vertexSet.ncard = m) (e : β) : + endsPull S σ P m i e = toVal (rootCoord S σ i hm) ⁻¹' (P i).G.ends e := + dite_eq_left_of_eq_true (eq_true hm) + +omit [Preorder Ω] in +open Classical in +theorem ends_subset_root_vertexSet {P : ℕ → Patchwork Ω α β} {S : ℕ → RootedTree ι} + {σ : ℕ → ι → RootedHypergraph α β} (htd : ∀ i, IsTreeDecomposition (P i).G (S i) (σ i)) + {i : ℕ} {e : β} (he : e ∈ (σ i (S i).root).edgeSet) : + (P i).G.ends e ⊆ (σ i (S i).root).vertexSet := by + rw [((htd i).le (S i).root (S i).root_mem).ends_eq e he] + exact fun _ hv ↦ (σ i (S i).root).vertex_mem_of_inc hv + +omit [Preorder Ω] in +open Classical in +theorem μ_subset_root_vertexSet {P : ℕ → Patchwork Ω α β} {S : ℕ → RootedTree ι} + {σ : ℕ → ι → RootedHypergraph α β} (htd : ∀ i, IsTreeDecomposition (P i).G (S i) (σ i)) + {i : ℕ} {e : β} (he : e ∈ (σ i (S i).root).edgeSet) (hd : e ∈ (P i).dom) : + ∀ v ∈ (P i).μ e, v ∈ (σ i (S i).root).vertexSet := by + intro v hv + have hv_ends : v ∈ (P i).G.ends e := by + rw [← (P i).μ_set e hd] + exact hv + exact ends_subset_root_vertexSet htd he hv_ends + +omit [Preorder Ω] in +open Classical in +theorem μPull_nodup {m : ℕ} {P : ℕ → Patchwork Ω α β} {S : ℕ → RootedTree ι} + {σ : ℕ → ι → RootedHypergraph α β} (htd : ∀ i, IsTreeDecomposition (P i).G (S i) (σ i)) + {i : ℕ} (hmi : (σ i (S i).root).vertexSet.ncard = m) + {e : β} (he : e ∈ (σ i (S i).root).edgeSet) (hd : e ∈ (P i).dom) : + (μPull S σ P m i e).Nodup := by + dsimp only [μPull] + rw [rootPullList_eq S σ hmi] + exact pullList_nodup _ ((P i).μ_nodup e hd) (μ_subset_root_vertexSet htd he hd) + +omit [Preorder Ω] in +open Classical in +theorem μPull_ΔPull_imp {m : ℕ} {P : ℕ → Patchwork Ω α β} {S : ℕ → RootedTree ι} + {σ : ℕ → ι → RootedHypergraph α β} (htd : ∀ i, IsTreeDecomposition (P i).G (S i) (σ i)) + {i i' : ℕ} (hmi : (σ i (S i).root).vertexSet.ncard = m) + (hmi' : (σ i' (S i').root).vertexSet.ncard = m) + {e e' : β} (he : e ∈ (σ i (S i).root).edgeSet) (hd : e ∈ (P i).dom) + (he' : e' ∈ (σ i' (S i').root).edgeSet) (hd' : e' ∈ (P i').dom) + (hμ : μPull S σ P m i e = μPull S σ P m i' e') + (hΔ : ΔPull S σ P m i e = ΔPull S σ P m i' e') : + (P i').μ e' = ((P i).μ e).map (coordMap (rootCoord S σ i hmi) (rootCoord S σ i' hmi')) ∧ + Set.MapsTo (marchMapSubgraph ((P i).μ e) ((P i').μ e')) + ((P i).Δ e).groupings ((P i').Δ e').groupings := by + have hsub : ∀ v ∈ (P i).μ e, v ∈ (σ i (S i).root).vertexSet := + μ_subset_root_vertexSet htd he hd + have hsub' : ∀ v ∈ (P i').μ e', v ∈ (σ i' (S i').root).vertexSet := + μ_subset_root_vertexSet htd he' hd' + have hμ_pull : pullList (rootCoord S σ i hmi) ((P i).μ e) = + pullList (rootCoord S σ i' hmi') ((P i').μ e') := by + rw [← rootPullList_eq S σ hmi, ← rootPullList_eq S σ hmi'] + exact hμ + refine ⟨(map_coordMap_eq_of_pullList_eq _ _ hsub hsub' hμ_pull).symm, fun δ hδ ↦ ?_⟩ + let ρ := μPull S σ P m i e + have hρ_nodup : ρ.Nodup := μPull_nodup htd hmi he hd + have hlen : ((P i).μ e).length = ρ.length := by + have hmap := congrArg List.length (map_toVal_pullList (rootCoord S σ i hmi) hsub) + rw [List.length_map, ← rootPullList_eq S σ hmi] at hmap + exact hmap.symm + have hlen' : ((P i').μ e').length = ρ.length := by + have hmap := congrArg List.length (map_toVal_pullList (rootCoord S σ i' hmi') hsub') + rw [List.length_map, ← rootPullList_eq S σ hmi'] at hmap + change (μPull S σ P m i' e').length = ((P i').μ e').length at hmap + rw [← hmap, ← hμ] + have hmem : marchMapSubgraph ((P i).μ e) ρ δ ∈ ΔPull S σ P m i' e' := by + rw [← hΔ] + exact ⟨δ, hδ, rfl⟩ + dsimp only [ΔPull] at hmem + rw [← hμ] at hmem + obtain ⟨δ', hδ', hEq⟩ := hmem + have hcomp₁ := marchMapSubgraph_comp hρ_nodup hlen δ (π₃ := (P i').μ e') + have hcomp₂ := marchMapSubgraph_comp hρ_nodup hlen' δ' (π₃ := (P i').μ e') + have hverts' : δ'.verts ⊆ {v | v ∈ (P i').μ e'} := by + rw [(((P i').Δ e').verts_eq δ' hδ').trans ((P i').Δ_verts e' ((P i').dom_subset hd')), + (P i').μ_set e' hd'] + have hid := marchMapSubgraph_id hverts' + have hEq2 := congrArg (marchMapSubgraph ρ ((P i').μ e')) hEq.symm + rw [hcomp₁, hcomp₂, hid] at hEq2 + exact hEq2 ▸ hδ' + +omit [Preorder Ω] in +open Classical in +theorem endsPull_imp {m : ℕ} {P : ℕ → Patchwork Ω α β} {S : ℕ → RootedTree ι} + {σ : ℕ → ι → RootedHypergraph α β} (htd : ∀ i, IsTreeDecomposition (P i).G (S i) (σ i)) + {i i' : ℕ} (hmi : (σ i (S i).root).vertexSet.ncard = m) + (hmi' : (σ i' (S i').root).vertexSet.ncard = m) + {e e' : β} (he : e ∈ (σ i (S i).root).edgeSet) (he' : e' ∈ (σ i' (S i').root).edgeSet) + (hends : endsPull S σ P m i e = endsPull S σ P m i' e') : + coordMap (rootCoord S σ i hmi) (rootCoord S σ i' hmi') '' (P i).G.ends e = + (P i').G.ends e' := by + rw [endsPull_eq S σ P hmi, endsPull_eq S σ P hmi'] at hends + exact image_coordMap_eq_of_preimage_eq _ _ + (ends_subset_root_vertexSet htd he) (ends_subset_root_vertexSet htd he') hends + +open Classical in +/-- Set of root edges in `dom(μᵢ)` with pulled-back march `ρ`. -/ +noncomputable def domRootEdges (S : ℕ → RootedTree ι) (σ : ℕ → ι → RootedHypergraph α β) + (P : ℕ → Patchwork Ω α β) (m : ℕ) (ρ : List (Fin m)) (i : ℕ) : Set β := + {e ∈ (σ i (S i).root).edgeSet | e ∈ (P i).dom ∧ μPull S σ P m i e = ρ} + +open Classical in +/-- Graph Minors IV, (8.4), claim (4) (page 250): +"Since $\Omega$ is well-quasi-ordered and there are only finitely many different patches with +a given vertex set, we may choose by (8.3) an infinite $I_3 \subseteq I_2$ such that (4) +*For all $i$, $i' \in I_3$ with $i' > i$ there is an injection $\alpha$ from $\{e \in +\operatorname{dom}(\mu_i) \cap E(\sigma_i(o(S_i))) \colon \mu_i(e) = \rho\}$ into $\{e' \in +\operatorname{dom}(\mu_{i'}) \cap E(\sigma_{i'}(o(S_{i'}))) \colon \mu_{i'}(e') = \rho\}$, +such that for each $e$, $\phi_i(e) \le \phi_{i'}(\alpha(e))$ and $\Delta_i(e) = +\Delta_{i'}(\alpha(e))$ ... ." -/ +theorem lemma_8_4_claim_4 (hH : Higman83Statement.{u₁, u₂}) (hΩ : WellQuasiOrderedLE Ω) + {m : ℕ} {P : ℕ → Patchwork Ω α β} {S : ℕ → RootedTree ι} + {σ : ℕ → ι → RootedHypergraph α β} + {I₂' : Set ℕ} (hI₂' : I₂'.Infinite) : + ∃ I₃ ⊆ I₂', I₃.Infinite ∧ + ∀ (ρ : MarchIn m), ∀ i ∈ I₃, ∀ i' ∈ I₃, i < i' → + ∃ α : β → β, + Set.InjOn α (domRootEdges S σ P m ρ.1 i) ∧ + Set.MapsTo α (domRootEdges S σ P m ρ.1 i) (domRootEdges S σ P m ρ.1 i') ∧ + ∀ e ∈ domRootEdges S σ P m ρ.1 i, + (P i).φ e ≤ (P i').φ (α e) ∧ + ΔPull S σ P m i e = ΔPull S σ P m i' (α e) := by + let Tag := MarchIn m × Set ((⊤ : SimpleGraph (Fin m)).Subgraph) + let A_Tag : Finset Tag := (Set.finite_univ : (Set.univ : Set Tag).Finite).toFinset + let E_dom (i : ℕ) : Finset β := + (σ i (S i).root).edgeSet_finite.toFinset.filter fun e ↦ + e ∈ (P i).dom ∧ (μPull S σ P m i e).Nodup + let tag (i : ℕ) (e : β) : Tag := + if hnd : (μPull S σ P m i e).Nodup then + (⟨μPull S σ P m i e, hnd⟩, ΔPull S σ P m i e) + else (⟨[], List.nodup_nil⟩, ∅) + obtain ⟨I₃, hI₃_sub, hI₃_inf, hI₃⟩ := + higman83_partitioned_finset hH hΩ hI₂' E_dom tag (fun i e ↦ (P i).φ e) A_Tag + refine ⟨I₃, hI₃_sub, hI₃_inf, fun ρ i hi₃ i' hi₃' hlt ↦ ?_⟩ + have hset_eq : ∀ (j : ℕ) (D : Set ((⊤ : SimpleGraph (Fin m)).Subgraph)), + {e ∈ domRootEdges S σ P m ρ.1 j | ΔPull S σ P m j e = D} = + {e ∈ (E_dom j : Set β) | tag j e = (ρ, D)} := by + intro j D + ext e + simp only [domRootEdges, E_dom, tag, Set.mem_sep_iff, Finset.mem_coe, Finset.mem_filter, + Set.Finite.mem_toFinset] + constructor + · rintro ⟨⟨heE, hd, hμ⟩, hD⟩ + have hnd : (μPull S σ P m j e).Nodup := hμ ▸ ρ.2 + refine ⟨⟨heE, hd, hnd⟩, ?_⟩ + rw [dite_eq_left_of_eq_true (eq_true hnd)] + exact Prod.ext (Subtype.ext hμ) hD + · rintro ⟨⟨heE, hd, hnd⟩, htag⟩ + rw [dite_eq_left_of_eq_true (eq_true hnd)] at htag + exact ⟨⟨heE, hd, congrArg Subtype.val (congrArg Prod.fst htag)⟩, congrArg Prod.snd htag⟩ + have hfib : ∀ D : Set ((⊤ : SimpleGraph (Fin m)).Subgraph), + ∃ g : β → β, + Set.InjOn g {e ∈ domRootEdges S σ P m ρ.1 i | ΔPull S σ P m i e = D} ∧ + Set.MapsTo g {e ∈ domRootEdges S σ P m ρ.1 i | ΔPull S σ P m i e = D} + {e ∈ domRootEdges S σ P m ρ.1 i' | ΔPull S σ P m i' e = D} ∧ + ∀ e ∈ {e ∈ domRootEdges S σ P m ρ.1 i | ΔPull S σ P m i e = D}, + (P i).φ e ≤ (P i').φ (g e) := by + intro D + rw [hset_eq i D, hset_eq i' D] + have hmemA : (ρ, D) ∈ A_Tag := (Set.Finite.mem_toFinset _).mpr (Set.mem_univ _) + exact hI₃ (ρ, D) hmemA i hi₃ i' hi₃' hlt + obtain ⟨α, hα_inj, hα_maps, hα_tag, hα_le⟩ := piece_fiber_injections hfib + exact ⟨α, hα_inj, hα_maps, fun e he ↦ ⟨hα_le e he, (hα_tag e he).symm⟩⟩ + +open Classical in +/-- Set of root edges outside `dom(μᵢ)` with pulled-back end set `Y`. -/ +noncomputable def nondomRootEdges (S : ℕ → RootedTree ι) (σ : ℕ → ι → RootedHypergraph α β) + (P : ℕ → Patchwork Ω α β) (m : ℕ) (Y : Set (Fin m)) (i : ℕ) : Set β := + {e ∈ (σ i (S i).root).edgeSet | e ∉ (P i).dom ∧ endsPull S σ P m i e = Y} + +open Classical in +/-- Graph Minors IV, (8.4), claim (5) (page 250): +"We may similarly choose an infinite subset $I_4 \subseteq I_3$ such that for all subsets $Y$ +of $V_0$, (5) *For all $i, i' \in I_4$ with $i' > i$ there is an injection $\alpha$ from +$\{e \in E(\sigma_i(o(S_i))) - \operatorname{dom}(\mu_i) \colon V_{G_i}(e) = Y\}$ into $\{e' +\in E(\sigma_{i'}(o(S_{i'}))) - \operatorname{dom}(\mu_{i'}) \colon V_{G_{i'}}(e') = Y\}$, +such that $\phi_i(e) \le \phi_{i'}(\alpha(e))$ for each $e$." -/ +theorem lemma_8_4_claim_5 (hH : Higman83Statement.{u₁, u₂}) (hΩ : WellQuasiOrderedLE Ω) + {m : ℕ} {P : ℕ → Patchwork Ω α β} {S : ℕ → RootedTree ι} + {σ : ℕ → ι → RootedHypergraph α β} + {I₃ : Set ℕ} (hI₃ : I₃.Infinite) : + ∃ I₄ ⊆ I₃, I₄.Infinite ∧ + ∀ (Y : Set (Fin m)), ∀ i ∈ I₄, ∀ i' ∈ I₄, i < i' → + ∃ α : β → β, + Set.InjOn α (nondomRootEdges S σ P m Y i) ∧ + Set.MapsTo α (nondomRootEdges S σ P m Y i) (nondomRootEdges S σ P m Y i') ∧ + ∀ e ∈ nondomRootEdges S σ P m Y i, (P i).φ e ≤ (P i').φ (α e) := by + let A_Y : Finset (Set (Fin m)) := (Set.finite_univ : (Set.univ : Set (Set + (Fin m))).Finite).toFinset + let E_nondom (i : ℕ) : Finset β := + (σ i (S i).root).edgeSet_finite.toFinset.filter fun e ↦ e ∉ (P i).dom + let tag (i : ℕ) (e : β) : Set (Fin m) := endsPull S σ P m i e + obtain ⟨I₄, hI₄_sub, hI₄_inf, hI₄⟩ := + higman83_partitioned_finset hH hΩ hI₃ E_nondom tag (fun i e ↦ (P i).φ e) A_Y + refine ⟨I₄, hI₄_sub, hI₄_inf, fun Y i hi₄ i' hi₄' hlt ↦ ?_⟩ + have hset_eq : ∀ j : ℕ, + nondomRootEdges S σ P m Y j = {e ∈ (E_nondom j : Set β) | tag j e = Y} := by + intro j + ext e + simp [nondomRootEdges, E_nondom, tag, and_assoc] + rw [hset_eq i, hset_eq i'] + have hmemA : Y ∈ A_Y := (Set.Finite.mem_toFinset _).mpr (Set.mem_univ _) + exact hI₄ Y hmemA i hi₄ i' hi₄' hlt + +open Classical in +/-- Graph Minors IV, (8.4), claim (6) (page 250): +"By piecing together the injections of (4) and (5), we deduce (6) For all $i$, $i' \in I_4$ with +$i' > i$ there is an injection $\alpha \colon E(\sigma_i(o(S_i))) \to E(\sigma_{i'}(o(S_{i'})))$ +such that for each $e \in E(\sigma_i(o(S_i)))$ +(i) $\alpha(e) \in \operatorname{dom}(\mu_{i'})$ if and only if $e \in \operatorname{dom}(\mu_i)$ +(ii) if $e \in \operatorname{dom}(\mu_i)$ then $\mu_i(e) = \mu_{i'}(\alpha(e))$ and +$\Delta_i(e) = \Delta_{i'}(\alpha(e))$ +(iii) if $e \notin \operatorname{dom}(\mu_i)$ then $V_{G_i}(e) = V_{G_{i'}}(\alpha(e))$ +(iv) $\phi_i(e) \le \phi_{i'}(\alpha(e))$." -/ +theorem lemma_8_4_claim_6 {m : ℕ} {P : ℕ → Patchwork Ω α β} {S : ℕ → RootedTree ι} + {σ : ℕ → ι → RootedHypergraph α β} (htd : ∀ i, IsTreeDecomposition (P i).G (S i) (σ i)) + {I₂ I₃ I₄ : Set ℕ} (hm : ∀ i ∈ I₂, (σ i (S i).root).vertexSet.ncard = m) + (hI₃_sub : I₃ ⊆ I₂) (hI₄_sub : I₄ ⊆ I₃) + (h4 : ∀ (ρ : MarchIn m), ∀ i ∈ I₃, ∀ i' ∈ I₃, i < i' → + ∃ α : β → β, + Set.InjOn α (domRootEdges S σ P m ρ.1 i) ∧ + Set.MapsTo α (domRootEdges S σ P m ρ.1 i) (domRootEdges S σ P m ρ.1 i') ∧ + ∀ e ∈ domRootEdges S σ P m ρ.1 i, + (P i).φ e ≤ (P i').φ (α e) ∧ + ΔPull S σ P m i e = ΔPull S σ P m i' (α e)) + (h5 : ∀ (Y : Set (Fin m)), ∀ i ∈ I₄, ∀ i' ∈ I₄, i < i' → + ∃ α : β → β, + Set.InjOn α (nondomRootEdges S σ P m Y i) ∧ + Set.MapsTo α (nondomRootEdges S σ P m Y i) (nondomRootEdges S σ P m Y i') ∧ + ∀ e ∈ nondomRootEdges S σ P m Y i, (P i).φ e ≤ (P i').φ (α e)) + {i i' : ℕ} (hi₄ : i ∈ I₄) (hi₄' : i' ∈ I₄) (hlt : i < i') : + let hmi := hm i (hI₃_sub (hI₄_sub hi₄)) + let hmi' := hm i' (hI₃_sub (hI₄_sub hi₄')) + let γ := coordMap (rootCoord S σ i hmi) (rootCoord S σ i' hmi') + ∃ αe : β → β, + Set.MapsTo αe (σ i (S i).root).edgeSet (σ i' (S i').root).edgeSet ∧ + Set.InjOn αe (σ i (S i).root).edgeSet ∧ + (∀ e ∈ (σ i (S i).root).edgeSet, αe e ∈ (P i').dom ↔ e ∈ (P i).dom) ∧ + (∀ e ∈ (σ i (S i).root).edgeSet, e ∈ (P i).dom → + (P i').μ (αe e) = ((P i).μ e).map γ ∧ + Set.MapsTo (marchMapSubgraph ((P i).μ e) ((P i').μ (αe e))) + ((P i).Δ e).groupings ((P i').Δ (αe e)).groupings) ∧ + (∀ e ∈ (σ i (S i).root).edgeSet, e ∉ (P i).dom → + γ '' (P i).G.ends e = (P i').G.ends (αe e)) ∧ + (∀ e ∈ (σ i (S i).root).edgeSet, (P i).φ e ≤ (P i').φ (αe e)) := by + intro hmi hmi' γ + have hi₃ : i ∈ I₃ := hI₄_sub hi₄ + have hi₃' : i' ∈ I₃ := hI₄_sub hi₄' + let α_dom (ρ : MarchIn m) : β → β := (h4 ρ i hi₃ i' hi₃' hlt).choose + let α_nondom (Y : Set (Fin m)) : β → β := (h5 Y i hi₄ i' hi₄' hlt).choose + let αe (e : β) : β := + if hnd : e ∈ (P i).dom ∧ (μPull S σ P m i e).Nodup then + α_dom ⟨μPull S σ P m i e, hnd.2⟩ e + else + α_nondom (endsPull S σ P m i e) e + have hmem_dom : ∀ e ∈ (σ i (S i).root).edgeSet, ∀ (hd : e ∈ (P i).dom), + (μPull S σ P m i e).Nodup ∧ + e ∈ domRootEdges S σ P m (μPull S σ P m i e) i := + fun e he hd ↦ ⟨μPull_nodup htd hmi he hd, ⟨he, hd, rfl⟩⟩ + have hmem_nondom : ∀ e ∈ (σ i (S i).root).edgeSet, e ∉ (P i).dom → + e ∈ nondomRootEdges S σ P m (endsPull S σ P m i e) i := + fun e he hnd ↦ ⟨he, hnd, rfl⟩ + have hαe_dom_spec : ∀ e (he : e ∈ (σ i (S i).root).edgeSet) (hd : e ∈ (P i).dom), + let hnd := (hmem_dom e he hd).1 + αe e = α_dom ⟨μPull S σ P m i e, hnd⟩ e ∧ + αe e ∈ (σ i' (S i').root).edgeSet ∧ + αe e ∈ (P i').dom ∧ + μPull S σ P m i' (αe e) = μPull S σ P m i e ∧ + (P i).φ e ≤ (P i').φ (αe e) ∧ + ΔPull S σ P m i e = ΔPull S σ P m i' (αe e) := by + intro e he hd + obtain ⟨hnd, hmem⟩ := hmem_dom e he hd + have hEq : αe e = α_dom ⟨μPull S σ P m i e, hnd⟩ e := by + dsimp only [αe] + exact dite_eq_left_of_eq_true (eq_true ⟨hd, hnd⟩) + have hspec := (h4 ⟨μPull S σ P m i e, hnd⟩ i hi₃ i' hi₃' hlt).choose_spec + have hm' : αe e ∈ domRootEdges S σ P m (μPull S σ P m i e) i' := + hEq.symm ▸ hspec.2.1 hmem + have hφΔ : (P i).φ e ≤ (P i').φ (αe e) ∧ ΔPull S σ P m i e = ΔPull S σ P m i' (αe e) := + hEq.symm ▸ hspec.2.2 e hmem + exact ⟨hEq, hm'.1, hm'.2.1, hm'.2.2, hφΔ.1, hφΔ.2⟩ + have hαe_nondom_spec : ∀ e ∈ (σ i (S i).root).edgeSet, ∀ (hnd : e ∉ (P i).dom), + αe e = α_nondom (endsPull S σ P m i e) e ∧ + αe e ∈ (σ i' (S i').root).edgeSet ∧ + αe e ∉ (P i').dom ∧ + endsPull S σ P m i' (αe e) = endsPull S σ P m i e ∧ + (P i).φ e ≤ (P i').φ (αe e) := by + intro e he hnd + have hmem := hmem_nondom e he hnd + have hnot : ¬(e ∈ (P i).dom ∧ (μPull S σ P m i e).Nodup) := fun h ↦ hnd h.1 + have hEq : αe e = α_nondom (endsPull S σ P m i e) e := by + dsimp only [αe] + exact dite_eq_right_of_eq_false (eq_false hnot) + have hspec := (h5 (endsPull S σ P m i e) i hi₄ i' hi₄' hlt).choose_spec + have hm' : αe e ∈ nondomRootEdges S σ P m (endsPull S σ P m i e) i' := + hEq.symm ▸ hspec.2.1 hmem + have hφ : (P i).φ e ≤ (P i').φ (αe e) := + hEq.symm ▸ hspec.2.2 e hmem + exact ⟨hEq, hm'.1, hm'.2.1, hm'.2.2, hφ⟩ + refine ⟨αe, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro e he + by_cases hd : e ∈ (P i).dom + · exact (hαe_dom_spec e he hd).2.1 + · exact (hαe_nondom_spec e he hd).2.1 + · intro e₁ he₁ e₂ he₂ hEq + by_cases hd₁ : e₁ ∈ (P i).dom <;> by_cases hd₂ : e₂ ∈ (P i).dom + · obtain ⟨hEq₁, _, _, hμ₁, _, _⟩ := hαe_dom_spec e₁ he₁ hd₁ + obtain ⟨hEq₂, _, _, hμ₂, _, _⟩ := hαe_dom_spec e₂ he₂ hd₂ + have hμ_eq : μPull S σ P m i e₁ = μPull S σ P m i e₂ := + hμ₁.symm.trans (by rw [hEq, hμ₂]) + have hρ_eq : (⟨μPull S σ P m i e₁, (hmem_dom e₁ he₁ hd₁).1⟩ : MarchIn m) = + ⟨μPull S σ P m i e₂, (hmem_dom e₂ he₂ hd₂).1⟩ := + Subtype.ext hμ_eq + have hα_eq : α_dom ⟨μPull S σ P m i e₁, (hmem_dom e₁ he₁ hd₁).1⟩ e₁ = + α_dom ⟨μPull S σ P m i e₁, (hmem_dom e₁ he₁ hd₁).1⟩ e₂ := by + rw [← hEq₁, hEq, hEq₂, hρ_eq] + have hm₂ : e₂ ∈ domRootEdges S σ P m (μPull S σ P m i e₁) i := by + rw [hμ_eq] + exact (hmem_dom e₂ he₂ hd₂).2 + exact (h4 ⟨μPull S σ P m i e₁, (hmem_dom e₁ he₁ hd₁).1⟩ i hi₃ i' hi₃' hlt).choose_spec.1 + (hmem_dom e₁ he₁ hd₁).2 hm₂ hα_eq + · exact False.elim ((hαe_nondom_spec e₂ he₂ hd₂).2.2.1 (hEq ▸ (hαe_dom_spec e₁ he₁ hd₁).2.2.1)) + · exact False.elim ((hαe_nondom_spec e₁ he₁ hd₁).2.2.1 (hEq.symm ▸ + (hαe_dom_spec e₂ he₂ hd₂).2.2.1)) + · obtain ⟨hEq₁, _, _, hends₁, _⟩ := hαe_nondom_spec e₁ he₁ hd₁ + obtain ⟨hEq₂, _, _, hends₂, _⟩ := hαe_nondom_spec e₂ he₂ hd₂ + have hY_eq : endsPull S σ P m i e₁ = endsPull S σ P m i e₂ := + hends₁.symm.trans (by rw [hEq, hends₂]) + have hα_eq : α_nondom (endsPull S σ P m i e₁) e₁ = + α_nondom (endsPull S σ P m i e₁) e₂ := by + rw [← hEq₁, hEq, hEq₂, hY_eq] + have hm₂ : e₂ ∈ nondomRootEdges S σ P m (endsPull S σ P m i e₁) i := by + rw [hY_eq] + exact hmem_nondom e₂ he₂ hd₂ + exact (h5 (endsPull S σ P m i e₁) i hi₄ i' hi₄' hlt).choose_spec.1 + (hmem_nondom e₁ he₁ hd₁) hm₂ hα_eq + · intro e he + by_cases hd : e ∈ (P i).dom + · exact ⟨fun _ ↦ hd, fun _ ↦ (hαe_dom_spec e he hd).2.2.1⟩ + · exact ⟨fun hd' ↦ False.elim ((hαe_nondom_spec e he hd).2.2.1 hd'), + fun hd' ↦ False.elim (hd hd')⟩ + · intro e he hd + obtain ⟨_, he', hd', hμ, _, hΔ⟩ := hαe_dom_spec e he hd + exact μPull_ΔPull_imp htd hmi hmi' he hd he' hd' hμ.symm hΔ + · intro e he hnd + obtain ⟨_, he', _, hends, _⟩ := hαe_nondom_spec e he hnd + exact endsPull_imp htd hmi hmi' he he' hends.symm + · intro e he + by_cases hd : e ∈ (P i).dom + · exact (hαe_dom_spec e he hd).2.2.2.2.1 + · exact (hαe_nondom_spec e he hd).2.2.2.2 + +open Classical in +/-- Wrapper equipping `ℕ × ι` with the tip-simulation preorder. -/ +private structure TipPair (P : ℕ → Patchwork Ω α β) (S : ℕ → RootedTree ι) + (σ : ℕ → ι → RootedHypergraph α β) where + i : ℕ + s : ι + +open Classical in +private instance (P : ℕ → Patchwork Ω α β) (S : ℕ → RootedTree ι) + (σ : ℕ → ι → RootedHypergraph α β) : Preorder (TipPair P S σ) where + le a b := a.s ∈ (S a.i).edges → + b.s ∈ (S b.i).edges ∧ Simulated ((P a.i).restrict (σ a.i a.s)) ((P b.i).restrict (σ b.i b.s)) + le_refl a := fun hs ↦ ⟨hs, Simulated.refl _⟩ + le_trans a b c hab hbc := fun hsa ↦ + ⟨(hbc (hab hsa).1).1, (hab hsa).2.trans (hbc (hab hsa).1).2⟩ + +open Classical in +private theorem tipPair_wqo {P : ℕ → Patchwork Ω α β} {S : ℕ → RootedTree ι} + {σ : ℕ → ι → RootedHypergraph α β} + (hwqo : ∀ Q : ℕ → Patchwork Ω α β, + (∀ k, ∃ i, ∃ s ∈ (S i).edges, Q k = (P i).restrict (σ i s)) → + ∃ j j', j < j' ∧ Simulated (Q j) (Q j')) : + WellQuasiOrderedLE (TipPair P S σ) := by + refine ⟨fun f ↦ ?_⟩ + by_cases hall : ∀ k, (f k).s ∈ (S (f k).i).edges + · obtain ⟨j, j', hlt, hsim⟩ := hwqo (fun k ↦ (P (f k).i).restrict (σ (f k).i (f k).s)) + (fun k ↦ ⟨(f k).i, (f k).s, hall k, rfl⟩) + exact ⟨j, j', hlt, fun _ ↦ ⟨hall j', hsim⟩⟩ + · push Not at hall + obtain ⟨k, hk⟩ := hall + exact ⟨k, k + 1, Nat.lt_succ_self k, fun h ↦ False.elim (hk h)⟩ + +open Classical in +/-- Pulled-back root march `π(σᵢ(s))` in `Fin m` for a tip `s` of `Sᵢ`. -/ +noncomputable def tipRootsPull (S : ℕ → RootedTree ι) (σ : ℕ → ι → RootedHypergraph α β) + (m i : ℕ) (s : ι) : List (Fin m) := + rootPullList S σ m i (σ i s).roots + +omit [Preorder Ω] in +open Classical in +theorem tip_roots_subset_root_vertexSet {P : ℕ → Patchwork Ω α β} {S : ℕ → RootedTree ι} + {σ : ℕ → ι → RootedHypergraph α β} (hstar : ∀ i, (S i).IsStar) + (htd : ∀ i, IsTreeDecomposition (P i).G (S i) (σ i)) + {i : ℕ} {s : ι} (hs : s ∈ (S i).edges) : + ∀ v ∈ (σ i s).roots, v ∈ (σ i (S i).root).vertexSet := by + intro v hv + have hmem : v ∈ (σ i s).rootSet := hv + rw [(htd i).rootSet_edge s hs, hstar i s hs] at hmem + exact hmem.2 + +omit [Preorder Ω] in +open Classical in +theorem tipRootsPull_nodup {m : ℕ} {P : ℕ → Patchwork Ω α β} {S : ℕ → RootedTree ι} + {σ : ℕ → ι → RootedHypergraph α β} (hstar : ∀ i, (S i).IsStar) + (htd : ∀ i, IsTreeDecomposition (P i).G (S i) (σ i)) + {i : ℕ} (hmi : (σ i (S i).root).vertexSet.ncard = m) + {s : ι} (hs : s ∈ (S i).edges) : + (tipRootsPull S σ m i s).Nodup := by + dsimp only [tipRootsPull] + rw [rootPullList_eq S σ hmi] + exact pullList_nodup _ (σ i s).roots_nodup (tip_roots_subset_root_vertexSet hstar htd hs) + +open Classical in +/-- Set of tips `s ∈ U(Sᵢ)` with pulled-back root march `ρ`. -/ +noncomputable def tipsWithMarch (S : ℕ → RootedTree ι) (σ : ℕ → ι → RootedHypergraph α β) + (m : ℕ) (ρ : List (Fin m)) (i : ℕ) : Set ι := + {s ∈ ((S i).edges : Set ι) | tipRootsPull S σ m i s = ρ} + +open Classical in +/-- Graph Minors IV, (8.4), claim (7) (page 250) and claim (8) (page 251): +"Let $\rho$ be a march in $V_0$. Since $\{P_i | \sigma_i(s) \colon i \ge 1, s \in U(S_i)\}$ is +well-quasi-ordered by simulation we may choose by (8.3) an infinite $I_5 \subseteq I_4$ such that +(7) For all $i$, $i' \in I_5$ with $i' > i$ there is an injection $\beta$ from +$\{s \in U(S_i) \colon \pi(\sigma_i(s)) = \rho\}$ into +$\{s' \in U(S_{i'}) \colon \pi(\sigma_{i'}(s')) = \rho\}$, such that $P_i | \sigma_i(s)$ is +simulated in $P_{i'} | \sigma_{i'}(\beta(s))$ for each $s$." +"By repeating this for each $\rho$ and piecing together the resulting injections $\beta$, we deduce +that there is an infinite $I_6 \subseteq I_4$ such that (8) For all $i, i' \in I_6$ with $i' > i$ +there is an injection $\beta \colon U(S_i) \to U(S_{i'})$ such that for each $s \in U(S_i)$, +(i) $\pi(\sigma_i(s)) = \pi(\sigma_{i'}(\beta(s)))$ +(ii) there is a realizable expansion of $P_i \mid \sigma_i(s)$ in +$P_{i'} \mid \sigma_{i'}(\beta(s))$." -/ +theorem lemma_8_4_claim_7 (hH : Higman83Statement.{u₁, u₂}) + {m : ℕ} {P : ℕ → Patchwork Ω α β} {S : ℕ → RootedTree ι} + {σ : ℕ → ι → RootedHypergraph α β} + (hwqo : ∀ Q : ℕ → Patchwork Ω α β, + (∀ k, ∃ i, ∃ s ∈ (S i).edges, Q k = (P i).restrict (σ i s)) → + ∃ j j', j < j' ∧ Simulated (Q j) (Q j')) + {I₄ : Set ℕ} (hI₄ : I₄.Infinite) : + ∃ I₆ ⊆ I₄, I₆.Infinite ∧ + ∀ (ρ : MarchIn m), ∀ i ∈ I₆, ∀ i' ∈ I₆, i < i' → + ∃ βf : ι → ι, + Set.InjOn βf (tipsWithMarch S σ m ρ.1 i) ∧ + Set.MapsTo βf (tipsWithMarch S σ m ρ.1 i) (tipsWithMarch S σ m ρ.1 i') ∧ + ∀ s ∈ tipsWithMarch S σ m ρ.1 i, + Simulated ((P i).restrict (σ i s)) ((P i').restrict (σ i' (βf s))) := by + let A_March : Finset (MarchIn m) := (Set.finite_univ : (Set.univ : Set + (MarchIn m)).Finite).toFinset + have hTipWQO : WellQuasiOrderedLE (TipPair P S σ) := tipPair_wqo hwqo + let E_tips (i : ℕ) : Finset ι := + (S i).edges.filter fun s ↦ (tipRootsPull S σ m i s).Nodup + let tag (i : ℕ) (s : ι) : MarchIn m := + if hnd : (tipRootsPull S σ m i s).Nodup then + ⟨tipRootsPull S σ m i s, hnd⟩ + else ⟨[], List.nodup_nil⟩ + let ℓ (i : ℕ) (s : ι) : TipPair P S σ := ⟨i, s⟩ + obtain ⟨I₆, hI₆_sub, hI₆_inf, hI₆⟩ := + higman83_partitioned_finset hH hTipWQO hI₄ E_tips tag ℓ A_March + refine ⟨I₆, hI₆_sub, hI₆_inf, fun ρ i hi₆ i' hi₆' hlt ↦ ?_⟩ + have hset_eq : ∀ j : ℕ, + tipsWithMarch S σ m ρ.1 j = {s ∈ (E_tips j : Set ι) | tag j s = ρ} := by + intro j + ext s + simp only [tipsWithMarch, E_tips, tag, Finset.mem_coe, Finset.mem_filter] + constructor + · rintro ⟨hs, hEq⟩ + have hnd : (tipRootsPull S σ m j s).Nodup := hEq ▸ ρ.2 + refine ⟨⟨hs, hnd⟩, ?_⟩ + rw [dite_eq_left_of_eq_true (eq_true hnd)] + exact Subtype.ext hEq + · rintro ⟨⟨hs, hnd⟩, htag⟩ + rw [dite_eq_left_of_eq_true (eq_true hnd)] at htag + exact ⟨hs, congrArg Subtype.val htag⟩ + rw [hset_eq i, hset_eq i'] + have hmemA : ρ ∈ A_March := (Set.Finite.mem_toFinset _).mpr (Set.mem_univ _) + obtain ⟨βf, hβ_inj, hβ_maps, hβ_le⟩ := hI₆ ρ hmemA i hi₆ i' hi₆' hlt + refine ⟨βf, hβ_inj, hβ_maps, fun s hs ↦ ?_⟩ + have hs_edges : s ∈ (S i).edges := by + rw [← hset_eq i] at hs + exact hs.1 + exact (hβ_le s hs hs_edges).2 + +open Classical in +/-- Graph Minors IV, (8.4), claim (8) (page 251). -/ +theorem lemma_8_4_claim_8 {m : ℕ} {P : ℕ → Patchwork Ω α β} {S : ℕ → RootedTree ι} + {σ : ℕ → ι → RootedHypergraph α β} (hstar : ∀ i, (S i).IsStar) + (htd : ∀ i, IsTreeDecomposition (P i).G (S i) (σ i)) + {I₂ I₆ : Set ℕ} (hm : ∀ i ∈ I₂, (σ i (S i).root).vertexSet.ncard = m) + (hI₆_sub : I₆ ⊆ I₂) + (h7 : ∀ (ρ : MarchIn m), ∀ i ∈ I₆, ∀ i' ∈ I₆, i < i' → + ∃ βf : ι → ι, + Set.InjOn βf (tipsWithMarch S σ m ρ.1 i) ∧ + Set.MapsTo βf (tipsWithMarch S σ m ρ.1 i) (tipsWithMarch S σ m ρ.1 i') ∧ + ∀ s ∈ tipsWithMarch S σ m ρ.1 i, + Simulated ((P i).restrict (σ i s)) ((P i').restrict (σ i' (βf s)))) + {i i' : ℕ} (hi₆ : i ∈ I₆) (hi₆' : i' ∈ I₆) (hlt : i < i') : + let hmi := hm i (hI₆_sub hi₆) + let hmi' := hm i' (hI₆_sub hi₆') + let γ := coordMap (rootCoord S σ i hmi) (rootCoord S σ i' hmi') + ∃ βf : ι → ι, + Set.MapsTo βf (S i).edges (S i').edges ∧ + Set.InjOn βf (S i).edges ∧ + (∀ s ∈ (S i).edges, (σ i' (βf s)).roots = (σ i s).roots.map γ) ∧ + (∀ s ∈ (S i).edges, Simulated ((P i).restrict (σ i s)) ((P i').restrict (σ i' (βf s)))) := by + intro hmi hmi' γ + have hi₂ : i ∈ I₂ := hI₆_sub hi₆ + have hi₂' : i' ∈ I₂ := hI₆_sub hi₆' + let tag (j : ℕ) (hj : j ∈ I₂) (s : ι) : MarchIn m := + if hs : s ∈ (S j).edges then + ⟨tipRootsPull S σ m j s, tipRootsPull_nodup hstar htd (hm j hj) hs⟩ + else ⟨[], List.nodup_nil⟩ + have hset_eq : ∀ (j : ℕ) (hj : j ∈ I₂) (ρ : MarchIn m), + {s ∈ ((S j).edges : Set ι) | tag j hj s = ρ} = tipsWithMarch S σ m ρ.1 j := by + intro j hj ρ + ext s + simp only [tipsWithMarch, Finset.mem_coe] + refine ⟨fun ⟨hs, hEq⟩ ↦ ⟨hs, ?_⟩, fun ⟨hs, hEq⟩ ↦ ⟨hs, ?_⟩⟩ + · dsimp only [tag] at hEq + rw [dite_eq_left_of_eq_true (eq_true hs)] at hEq + exact congrArg Subtype.val hEq + · dsimp only [tag] + rw [dite_eq_left_of_eq_true (eq_true hs)] + exact Subtype.ext hEq + let ℓ (j : ℕ) (s : ι) : TipPair P S σ := ⟨j, s⟩ + have hfib : ∀ ρ : MarchIn m, ∃ βf : ι → ι, + Set.InjOn βf {s ∈ ((S i).edges : Set ι) | tag i hi₂ s = ρ} ∧ + Set.MapsTo βf {s ∈ ((S i).edges : Set ι) | tag i hi₂ s = ρ} + {s ∈ ((S i').edges : Set ι) | tag i' hi₂' s = ρ} ∧ + ∀ s ∈ {s ∈ ((S i).edges : Set ι) | tag i hi₂ s = ρ}, ℓ i s ≤ ℓ i' (βf s) := by + intro ρ + rw [hset_eq i hi₂ ρ, hset_eq i' hi₂' ρ] + obtain ⟨βf, hβ_inj, hβ_maps, hβ_sim⟩ := h7 ρ i hi₆ i' hi₆' hlt + refine ⟨βf, hβ_inj, hβ_maps, fun s hs _ ↦ ?_⟩ + exact ⟨(hβ_maps hs).1, hβ_sim s hs⟩ + obtain ⟨βf, hβ_inj, hβ_maps, hβ_tag, hβ_le⟩ := piece_fiber_injections hfib + refine ⟨βf, hβ_maps, hβ_inj, fun s hs ↦ ?_, fun s hs ↦ (hβ_le s hs hs).2⟩ + have hs' : βf s ∈ (S i').edges := hβ_maps hs + have hEq_tag := congrArg Subtype.val (hβ_tag s hs) + dsimp only [tag] at hEq_tag + rw [dite_eq_left_of_eq_true (eq_true hs'), dite_eq_left_of_eq_true (eq_true hs)] at hEq_tag + have hpull_eq : pullList (rootCoord S σ i hmi) (σ i s).roots = + pullList (rootCoord S σ i' hmi') (σ i' (βf s)).roots := by + rw [← rootPullList_eq S σ hmi, ← rootPullList_eq S σ hmi'] + exact hEq_tag.symm + exact (map_coordMap_eq_of_pullList_eq _ _ + (tip_roots_subset_root_vertexSet hstar htd hs) + (tip_roots_subset_root_vertexSet hstar htd hs') hpull_eq).symm + +open Classical in +/-- **Graph Minors IV, (8.4)** (pages 249–250): +"Let $n \ge 0$, let $\Omega$ be a well-quasi-order, and let $P_i = (G_i, \mu_i, \Delta_i, +\phi_i)$ ($i = 1, 2, \dots$) be a countable sequence of removable $\Omega$-patchworks. For +each $i \ge 1$ let $(S_i, \sigma_i)$ be a star-decomposition of $G_i$ with +$|V(\sigma_i(o(S_i)))| \le n$." "*Suppose that $\{P_i | \sigma_i(s) \colon i \ge 1, s \in +U(S_i)\}$ is well-quasi-ordered by simulation. Then there exist $i' > i \ge 1$ such that +$P_i$ is simulated in $P_{i'}$." -/ +theorem theorem_8_4_proof (hH : Higman83Statement.{u₁, u₂}) (hΩ : WellQuasiOrderedLE Ω) + (n : ℕ) (P : ℕ → Patchwork Ω α β) (hrem : ∀ i, (P i).IsRemovable) + (S : ℕ → RootedTree ι) (σ : ℕ → ι → RootedHypergraph α β) + (hstar : ∀ i, (S i).IsStar) + (htd : ∀ i, IsTreeDecomposition (P i).G (S i) (σ i)) + (hcard : ∀ i, (σ i (S i).root).vertexSet.ncard ≤ n) + (hwqo : ∀ Q : ℕ → Patchwork Ω α β, + (∀ k, ∃ i, ∃ s ∈ (S i).edges, Q k = (P i).restrict (σ i s)) → + ∃ j j', j < j' ∧ Simulated (Q j) (Q j')) : + ∃ i i', i < i' ∧ Simulated (P i) (P i') := by + obtain ⟨I₁, m, hI₁_inf, _, hm₁⟩ := lemma_8_4_claim_1 hcard + obtain ⟨I₂, _, hI₂_sub, hI₂_inf, _, _⟩ := lemma_8_4_claim_2 htd hI₁_inf hm₁ + have hm : ∀ i ∈ I₂, (σ i (S i).root).vertexSet.ncard = m := fun i hi ↦ hm₁ i (hI₂_sub hi) + obtain ⟨I₂', π₀, hI₂'_sub, hI₂'_inf, h3⟩ := lemma_8_4_claim_3 htd hI₂_inf hm + obtain ⟨I₃, hI₃_sub, hI₃_inf, h4⟩ := lemma_8_4_claim_4 hH hΩ hI₂'_inf + have hI₃_sub₂ : I₃ ⊆ I₂ := hI₃_sub.trans hI₂'_sub + obtain ⟨I₄, hI₄_sub, hI₄_inf, h5⟩ := lemma_8_4_claim_5 hH hΩ hI₃_inf + have hI₄_sub₂ : I₄ ⊆ I₂ := hI₄_sub.trans hI₃_sub₂ + obtain ⟨I₆, hI₆_sub, hI₆_inf, h7⟩ := lemma_8_4_claim_7 hH hwqo hI₄_inf + let i := Nat.nth (· ∈ I₆) 0 + let i' := Nat.nth (· ∈ I₆) 1 + have hi₆ : i ∈ I₆ := Nat.nth_mem_of_infinite hI₆_inf 0 + have hi₆' : i' ∈ I₆ := Nat.nth_mem_of_infinite hI₆_inf 1 + have hlt : i < i' := Nat.nth_strictMono hI₆_inf Nat.zero_lt_one + have hi₄ : i ∈ I₄ := hI₆_sub hi₆ + have hi₄' : i' ∈ I₄ := hI₆_sub hi₆' + have hi₂' : i ∈ I₂' := hI₃_sub (hI₄_sub hi₄) + have hi'₂' : i' ∈ I₂' := hI₃_sub (hI₄_sub hi₄') + have hi₂ : i ∈ I₂ := hI₂'_sub hi₂' + have hi'₂ : i' ∈ I₂ := hI₂'_sub hi'₂' + let hmi := hm i hi₂ + let hmi' := hm i' hi'₂ + let γ := coordMap (rootCoord S σ i hmi) (rootCoord S σ i' hmi') + have hγ_bij : Set.BijOn γ (σ i (S i).root).vertexSet (σ i' (S i').root).vertexSet := + coordMap_bijOn (rootCoord S σ i hmi) (rootCoord S σ i' hmi') + have hroots_sub : ∀ j, ∀ v ∈ (P j).G.roots, v ∈ (σ j (S j).root).vertexSet := by + intro j v hv + rw [← (htd j).roots_root] at hv + exact (σ j (S j).root).roots_subset v hv + have hroots_pull : pullList (rootCoord S σ i hmi) (P i).G.roots = + pullList (rootCoord S σ i' hmi') (P i').G.roots := by + rw [← rootPullList_eq S σ hmi, ← rootPullList_eq S σ hmi', h3 i hi₂', h3 i' hi'₂'] + have hγ_roots : (P i').G.roots = (P i).G.roots.map γ := + (map_coordMap_eq_of_pullList_eq _ _ (hroots_sub i) (hroots_sub i') hroots_pull).symm + obtain ⟨αe, hα_maps, hα_inj, hα_dom, hα_μ, hα_ends, hα_φ⟩ := + lemma_8_4_claim_6 htd hm hI₃_sub₂ hI₄_sub h4 h5 hi₄ hi₄' hlt + obtain ⟨βf, hβ_maps, hβ_inj, hβ_roots, hβ_sim⟩ := + lemma_8_4_claim_8 hstar htd hm (hI₆_sub.trans hI₄_sub₂) h7 hi₆ hi₆' hlt + have hα_ends' : ∀ e ∈ (σ i (S i).root).edgeSet, e ∉ (P i).dom → + ∀ v ∈ (P i).G.ends e, γ v ∈ (P i').G.ends (αe e) := by + intro e he hnd v hv + rw [← hα_ends e he hnd] + exact ⟨v, hv, rfl⟩ + obtain ⟨ζv, ζe, hζ, _⟩ := + theorem_8_2_subset (hrem i') (hstar i) (htd i) (hstar i') (htd i') + hγ_bij.mapsTo hγ_bij.injOn hγ_roots hα_maps hα_inj hα_dom hα_μ hα_ends' hα_φ + hβ_maps hβ_inj hβ_roots hβ_sim (S i).edges subset_rfl + rw [cross_edges_of_isTreeDecomposition (htd i)] at hζ + have hAgrees_rfl : ∀ Q : Patchwork Ω α β, Q.Agrees Q := + fun _ ↦ ⟨rfl, rfl, fun _ _ ↦ rfl, fun _ _ ↦ rfl, fun _ _ ↦ rfl⟩ + have hsim₁ : Simulated (P i) + ((P i').restrict (cross (σ i') ((S i).edges.image βf) (S i').root)) := + ⟨ζv, ζe, hζ.congr (Patchwork.agrees_restrict_self (P i)) (hAgrees_rfl _)⟩ + have hsub' : (S i).edges.image βf ⊆ (S i').edges := by + intro s' hs' + obtain ⟨s, hs, rfl⟩ := Finset.mem_image.mp hs' + exact hβ_maps hs + have hle' : (cross (σ i') ((S i).edges.image βf) (S i').root).toHypergraph ≤ + (P i').G.toHypergraph := + cross_le_of_isTreeDecomposition (htd i') hsub' + have hroots' : (cross (σ i') ((S i).edges.image βf) (S i').root).roots = (P i').G.roots := + (htd i').roots_root + have hsim₂ : Simulated + ((P i').restrict (cross (σ i') ((S i).edges.image βf) (S i').root)) (P i') := + (hrem i').simulated_restrict_of_roots_eq hle' hroots' + exact ⟨i, i', hlt, hsim₁.trans hsim₂⟩ + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/Patchwork/Stars.lean b/LeanPool/GraphMinor/GM04/Patchwork/Stars.lean new file mode 100644 index 0000000000..1a4a8efa81 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Patchwork/Stars.lean @@ -0,0 +1,1207 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Axioms +public import LeanPool.GraphMinor.GM04.Patchwork.Expansion +import LeanPool.GraphMinor.GM04.Patchwork.Menger + +/-! +# Stars with small hearts: gluing and star-decomposition simulation (Graph Minors IV, Section 8) + +This file formalizes Graph Minors IV, (8.1) and (8.2) (pages 247–249): + +* `glueVertex` and `glueEdge`: the glued expansion `η` across separations `(G₁, G₂)` of `G` and + `(G'₁, G'₂)` of `G'`. +* `lemma_8_1_claim_1`, `lemma_8_1_claim_2`, and `theorem_8_1`: Graph Minors IV, (8.1), showing that + `η` is a realizable expansion of `P` in `P'`. +* `theorem_8_2`: Graph Minors IV, (8.2), showing that simulation of tips along a star-decomposition + together with a root isomorphism `γ` and edge injection `α` gives simulation of `P` in `P'`. +-/ + +public section + +namespace GraphMinor.GM04 + +open SimpleGraph Hypergraph + +universe u v w + +variable {Ω : Type w} [Preorder Ω] {α α' β β' ι ι' : Type*} + +/-! ### Basic properties of separations and patchwork restrictions -/ + +theorem isSeparation_disjoint_edgeSet {G G₁ G₂ : Hypergraph α β} + (hsep : G.IsSeparation G₁ G₂) : Disjoint G₁.edgeSet G₂.edgeSet := by + rw [Set.disjoint_iff_inter_eq_empty] + exact hsep.edgeSet_inter_eq + +theorem isSeparation_vertexSet_union {G G₁ G₂ : Hypergraph α β} + (hsep : G.IsSeparation G₁ G₂) : G₁.vertexSet ∪ G₂.vertexSet = G.vertexSet := + congrArg Hypergraph.vertexSet hsep.union_eq + +theorem isSeparation_edgeSet_union {G G₁ G₂ : Hypergraph α β} + (hsep : G.IsSeparation G₁ G₂) : G₁.edgeSet ∪ G₂.edgeSet = G.edgeSet := + congrArg Hypergraph.edgeSet hsep.union_eq + +/-- Two `Ω`-patchworks agree on their rooted hypergraph, domain, and edge data on `E(G)`. -/ +structure Patchwork.Agrees (P₁ P₂ : Patchwork Ω α β) : Prop where + G_eq : P₁.G = P₂.G + dom_eq : P₁.dom = P₂.dom + μ_eq : ∀ e ∈ P₁.G.edgeSet, P₁.μ e = P₂.μ e + Δ_eq : ∀ e ∈ P₁.G.edgeSet, P₁.Δ e = P₂.Δ e + φ_eq : ∀ e ∈ P₁.G.edgeSet, P₁.φ e = P₂.φ e + +omit [Preorder Ω] in +theorem Patchwork.Agrees.symm {P₁ P₂ : Patchwork Ω α β} (h : P₁.Agrees P₂) : P₂.Agrees P₁ where + G_eq := h.G_eq.symm + dom_eq := h.dom_eq.symm + μ_eq e he := (h.μ_eq e (h.G_eq.symm ▸ he)).symm + Δ_eq e he := (h.Δ_eq e (h.G_eq.symm ▸ he)).symm + φ_eq e he := (h.φ_eq e (h.G_eq.symm ▸ he)).symm + +omit [Preorder Ω] in +theorem Patchwork.agrees_restrict_self (P : Patchwork Ω α β) : + (P.restrict P.G).Agrees P where + G_eq := rfl + dom_eq := by + rw [P.restrict_dom le_rfl, Set.inter_eq_left.mpr P.dom_subset] + μ_eq _ _ := rfl + Δ_eq _ he := P.restrict_Δ le_rfl he + φ_eq _ _ := rfl + +omit [Preorder Ω] in +theorem Patchwork.agrees_restrict_restrict {P : Patchwork Ω α β} + {G₁ G₂ : RootedHypergraph α β} (h₁ : G₁.toHypergraph ≤ P.G.toHypergraph) + (h₂ : G₂.toHypergraph ≤ G₁.toHypergraph) : + ((P.restrict G₁).restrict G₂).Agrees (P.restrict G₂) where + G_eq := rfl + dom_eq := by + rw [(P.restrict G₁).restrict_dom h₂, P.restrict_dom h₁, P.restrict_dom (h₂.trans h₁), + Set.inter_assoc, Set.inter_eq_right.mpr h₂.edgeSet_subset] + μ_eq _ _ := rfl + Δ_eq _ he := by + rw [(P.restrict G₁).restrict_Δ h₂ he, P.restrict_Δ h₁ (h₂.edgeSet_subset he), + P.restrict_Δ (h₂.trans h₁) he] + φ_eq _ _ := rfl + +theorem IsExpansion.congr {P₁ P₂ : Patchwork Ω α β} {P'₁ P'₂ : Patchwork Ω α' β'} + {ηv : α → Set α'} {ηe : β → β'} (hP : P₁.Agrees P₂) (hP' : P'₁.Agrees P'₂) + (h : IsExpansion P₁ P'₁ ηv ηe) : IsExpansion P₂ P'₂ ηv ηe where + vertex_nonempty v hv := h.vertex_nonempty v (hP.G_eq.symm ▸ hv) + vertex_subset v hv := hP'.G_eq ▸ h.vertex_subset v (hP.G_eq.symm ▸ hv) + edge_mem e he := hP'.G_eq ▸ h.edge_mem e (hP.G_eq.symm ▸ he) + vertex_disjoint v₁ hv₁ v₂ hv₂ hne := + h.vertex_disjoint v₁ (hP.G_eq.symm ▸ hv₁) v₂ (hP.G_eq.symm ▸ hv₂) hne + edge_injOn := hP.G_eq ▸ h.edge_injOn + mem_dom_iff e he := by + rw [← hP.dom_eq, ← hP'.dom_eq] + exact h.mem_dom_iff e (hP.G_eq.symm ▸ he) + ends_nonempty e he hnd v hinc := by + have he₁ : e ∈ P₁.G.edgeSet := hP.G_eq.symm ▸ he + have hnd₁ : e ∉ P₁.dom := hP.dom_eq.symm ▸ hnd + have hinc₁ : P₁.G.Inc e v := hP.G_eq.symm ▸ hinc + obtain ⟨v', hv', hinc'⟩ := h.ends_nonempty e he₁ hnd₁ v hinc₁ + exact ⟨v', hv', hP'.G_eq ▸ hinc'⟩ + μ_length e he := by + have he₁ : e ∈ P₁.dom := hP.dom_eq.symm ▸ he + have heE₁ : e ∈ P₁.G.edgeSet := P₁.dom_subset he₁ + have he'E₁ : ηe e ∈ P'₁.G.edgeSet := h.edge_mem e heE₁ + rw [← hP.μ_eq e heE₁, ← hP'.μ_eq (ηe e) he'E₁] + exact h.μ_length e he₁ + μ_mem e he i hi hi' := by + have he₁ : e ∈ P₁.dom := hP.dom_eq.symm ▸ he + have heE₁ : e ∈ P₁.G.edgeSet := P₁.dom_subset he₁ + have he'E₁ : ηe e ∈ P'₁.G.edgeSet := h.edge_mem e heE₁ + have hi₁ : i < (P₁.μ e).length := (hP.μ_eq e heE₁).symm ▸ hi + have hi'₁ : i < (P'₁.μ (ηe e)).length := (hP'.μ_eq (ηe e) he'E₁).symm ▸ hi' + have hmem := h.μ_mem e he₁ i hi₁ hi'₁ + simpa [hP.μ_eq e heE₁, hP'.μ_eq (ηe e) he'E₁] using hmem + roots_length := by + rw [← hP.G_eq, ← hP'.G_eq] + exact h.roots_length + roots_mem i hi hi' := by + have hi₁ : i < P₁.G.roots.length := hP.G_eq.symm ▸ hi + have hi'₁ : i < P'₁.G.roots.length := hP'.G_eq.symm ▸ hi' + have hmem := h.roots_mem i hi₁ hi'₁ + simpa [hP.G_eq, hP'.G_eq] using hmem + maps_Δ e he := by + have he₁ : e ∈ P₁.dom := hP.dom_eq.symm ▸ he + have heE₁ : e ∈ P₁.G.edgeSet := P₁.dom_subset he₁ + have he'E₁ : ηe e ∈ P'₁.G.edgeSet := h.edge_mem e heE₁ + rw [← hP.μ_eq e heE₁, ← hP'.μ_eq (ηe e) he'E₁, ← hP.Δ_eq e heE₁, ← hP'.Δ_eq (ηe e) he'E₁] + exact h.maps_Δ e he₁ + φ_le e he := by + have heE₁ : e ∈ P₁.G.edgeSet := hP.G_eq.symm ▸ he + have he'E₁ : ηe e ∈ P'₁.G.edgeSet := h.edge_mem e heE₁ + rw [← hP.φ_eq e heE₁, ← hP'.φ_eq (ηe e) he'E₁] + exact h.φ_le e heE₁ + +omit [Preorder Ω] in +theorem Realizes.congr {P₁ P₂ : Patchwork Ω α β} {P'₁ P'₂ : Patchwork Ω α' β'} + {ηv : α → Set α'} {ηe : β → β'} {H : (⊤ : SimpleGraph α').Subgraph} + (hP : P₁.Agrees P₂) (hP' : P'₁.Agrees P'₂) (h : Realizes P₁ P'₁ ηv ηe H) : + Realizes P₂ P'₂ ηv ηe H := by + obtain ⟨⟨δ, hδ, hH⟩, hcomp⟩ := h + refine ⟨⟨δ, fun e he ↦ ?_, ?_⟩, fun v hv ↦ hcomp v (hP.G_eq.symm ▸ hv)⟩ + · have he₁ : e ∈ (P'₁.deleteEdges (ηe '' P₁.G.edgeSet)).G.edgeSet := by + simpa [Patchwork.deleteEdges, RootedHypergraph.deleteEdges, Hypergraph.deleteEdges, + hP.G_eq, hP'.G_eq] using he + have hmem := hδ e he₁ + change δ e ∈ P'₂.Δ e + rw [← hP'.Δ_eq e he₁.1] + exact hmem + · simpa [Patchwork.deleteEdges, RootedHypergraph.deleteEdges, Hypergraph.deleteEdges, + hP.G_eq, hP'.G_eq] using hH + +theorem IsRealizableExpansion.congr {P₁ P₂ : Patchwork Ω α β} {P'₁ P'₂ : Patchwork Ω α' β'} + {ηv : α → Set α'} {ηe : β → β'} (hP : P₁.Agrees P₂) (hP' : P'₁.Agrees P'₂) + (h : IsRealizableExpansion P₁ P'₁ ηv ηe) : IsRealizableExpansion P₂ P'₂ ηv ηe := by + obtain ⟨hexp, H, hreal⟩ := h + exact ⟨hexp.congr hP hP', H, hreal.congr hP hP'⟩ + +/-! ### Gluing expansions across separations: Graph Minors IV, (8.1) -/ + +open Classical in +/-- The vertex map `η(v)` of Graph Minors IV, (8.1) (page 247): +`η₁(v)` for `v ∈ V(G₁) - V(G₂)`, `η₂(v)` for `v ∈ V(G₂) - V(G₁)`, and `η₁(v) ∪ η₂(v)` for +`v ∈ V(G₁) ∩ V(G₂)`. -/ +noncomputable def glueVertex (G₁ G₂ : RootedHypergraph α β) (η₁v η₂v : α → Set α') (v : α) : + Set α' := + (if v ∈ G₁.vertexSet then η₁v v else ∅) ∪ (if v ∈ G₂.vertexSet then η₂v v else ∅) + +open Classical in +/-- The edge map `η(e)` of Graph Minors IV, (8.1) (page 247): +`η₁(e)` for `e ∈ E(G₁)` and `η₂(e)` for `e ∈ E(G₂)`. -/ +noncomputable def glueEdge (G₁ : RootedHypergraph α β) (η₁e η₂e : β → β') (e : β) : β' := + if e ∈ G₁.edgeSet then η₁e e else η₂e e + +@[simp] +theorem mem_glueVertex_iff {G₁ G₂ : RootedHypergraph α β} {η₁v η₂v : α → Set α'} + {v : α} {v' : α'} : + v' ∈ glueVertex G₁ G₂ η₁v η₂v v ↔ + (v ∈ G₁.vertexSet ∧ v' ∈ η₁v v) ∨ (v ∈ G₂.vertexSet ∧ v' ∈ η₂v v) := by + dsimp only [glueVertex] + simp only [Set.mem_union] + constructor + · rintro (h | h) + · split_ifs at h with hv₁ + · exact Or.inl ⟨hv₁, h⟩ + · exact False.elim h + · split_ifs at h with hv₂ + · exact Or.inr ⟨hv₂, h⟩ + · exact False.elim h + · rintro (⟨hv₁, h⟩ | ⟨hv₂, h⟩) + · left + simp [hv₁, h] + · right + simp [hv₂, h] + +theorem glueEdge_of_mem_left {G₁ : RootedHypergraph α β} {η₁e η₂e : β → β'} {e : β} + (he : e ∈ G₁.edgeSet) : glueEdge G₁ η₁e η₂e e = η₁e e := by + simp [glueEdge, he] + +theorem glueEdge_of_notMem_left {G₁ : RootedHypergraph α β} {η₁e η₂e : β → β'} {e : β} + (he : e ∉ G₁.edgeSet) : glueEdge G₁ η₁e η₂e e = η₂e e := by + simp [glueEdge, he] + +/-- Graph Minors IV, (8.1), claim (1) (page 248): +"For $1 \le i \le k$ and all $v \in V(G)$, if $v'_i \in \eta(v)$ then $v = v_i$." -/ +theorem lemma_8_1_claim_1 {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {G₁ G₂ : RootedHypergraph α β} {G'₁ G'₂ : RootedHypergraph α' β'} + (hsep : P.G.IsSeparation G₁ G₂) + {η₁v η₂v : α → Set α'} {η₁e η₂e : β → β'} + (hη₁ : IsExpansion (P.restrict G₁) (P'.restrict G'₁) η₁v η₁e) + (hη₂ : IsExpansion (P.restrict G₂) (P'.restrict G'₂) η₂v η₂e) + (hroots_mem : ∀ (i : ℕ) (hi : i < G₁.roots.length) (hi' : i < G'₁.roots.length), + G'₁.roots[i] ∈ η₂v G₁.roots[i]) + {i : ℕ} (hi : i < G₁.roots.length) (hi' : i < G'₁.roots.length) + {v : α} (hv : G'₁.roots[i] ∈ glueVertex G₁ G₂ η₁v η₂v v) : + v = G₁.roots[i] := by + have hvi_root : G₁.roots[i] ∈ G₁.rootSet := List.getElem_mem hi + rw [hsep.rootSet_left] at hvi_root + have hvi₁ : G₁.roots[i] ∈ G₁.vertexSet := hvi_root.1 + have hvi₂ : G₁.roots[i] ∈ G₂.vertexSet := hvi_root.2 + rw [mem_glueVertex_iff] at hv + rcases hv with ⟨hv₁, hv_mem₁⟩ | ⟨hv₂, hv_mem₂⟩ + · by_contra hne + exact Set.disjoint_left.mp (hη₁.vertex_disjoint v hv₁ G₁.roots[i] hvi₁ hne) + hv_mem₁ (hη₁.roots_mem i hi hi') + · by_contra hne + exact Set.disjoint_left.mp (hη₂.vertex_disjoint v hv₂ G₁.roots[i] hvi₂ hne) + hv_mem₂ (hroots_mem i hi hi') + +/-- Graph Minors IV, (8.1), claim (2) (page 248): +"For distinct $u_1, u_2 \in V(G)$, $\eta(u_1) \cap \eta(u_2) = \emptyset$." -/ +theorem lemma_8_1_claim_2 {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {G₁ G₂ : RootedHypergraph α β} {G'₁ G'₂ : RootedHypergraph α' β'} + (hsep : P.G.IsSeparation G₁ G₂) (hsep' : P'.G.IsSeparation G'₁ G'₂) + {η₁v η₂v : α → Set α'} {η₁e η₂e : β → β'} + (hη₁ : IsExpansion (P.restrict G₁) (P'.restrict G'₁) η₁v η₁e) + (hη₂ : IsExpansion (P.restrict G₂) (P'.restrict G'₂) η₂v η₂e) + (hroots_mem : ∀ (i : ℕ) (hi : i < G₁.roots.length) (hi' : i < G'₁.roots.length), + G'₁.roots[i] ∈ η₂v G₁.roots[i]) + {u₁ u₂ : α} (hne : u₁ ≠ u₂) : + Disjoint (glueVertex G₁ G₂ η₁v η₂v u₁) (glueVertex G₁ G₂ η₁v η₂v u₂) := by + refine Set.disjoint_left.mpr fun v' h₁ h₂ ↦ hne ?_ + have h₁' := mem_glueVertex_iff.mp h₁ + have h₂' := mem_glueVertex_iff.mp h₂ + rcases h₁' with ⟨hu₁, hv'₁⟩ | ⟨hu₁, hv'₁⟩ <;> rcases h₂' with ⟨hu₂, hv'₂⟩ | ⟨hu₂, hv'₂⟩ + · by_contra hne' + exact Set.disjoint_left.mp (hη₁.vertex_disjoint u₁ hu₁ u₂ hu₂ hne') hv'₁ hv'₂ + · have hv'_inter : v' ∈ (G'₁.toHypergraph ∩ G'₂.toHypergraph).vertexSet := + ⟨hη₁.vertex_subset u₁ hu₁ hv'₁, hη₂.vertex_subset u₂ hu₂ hv'₂⟩ + rw [← hsep'.rootSet_left] at hv'_inter + obtain ⟨i, hi', rfl⟩ := List.getElem_of_mem hv'_inter + have hi : i < G₁.roots.length := hη₁.roots_length.symm ▸ hi' + have hEq₁ := lemma_8_1_claim_1 hsep hη₁ hη₂ hroots_mem hi hi' h₁ + have hEq₂ := lemma_8_1_claim_1 hsep hη₁ hη₂ hroots_mem hi hi' h₂ + exact hEq₁.trans hEq₂.symm + · have hv'_inter : v' ∈ (G'₁.toHypergraph ∩ G'₂.toHypergraph).vertexSet := + ⟨hη₁.vertex_subset u₂ hu₂ hv'₂, hη₂.vertex_subset u₁ hu₁ hv'₁⟩ + rw [← hsep'.rootSet_left] at hv'_inter + obtain ⟨i, hi', rfl⟩ := List.getElem_of_mem hv'_inter + have hi : i < G₁.roots.length := hη₁.roots_length.symm ▸ hi' + have hEq₁ := lemma_8_1_claim_1 hsep hη₁ hη₂ hroots_mem hi hi' h₁ + have hEq₂ := lemma_8_1_claim_1 hsep hη₁ hη₂ hroots_mem hi hi' h₂ + exact hEq₁.trans hEq₂.symm + · by_contra hne' + exact Set.disjoint_left.mp (hη₂.vertex_disjoint u₁ hu₁ u₂ hu₂ hne') hv'₁ hv'₂ + +/-- First half of Graph Minors IV, (8.1) (pages 247–248). The glued map `(glueVertex, glueEdge)` is +an expansion of `P` in `P'`. -/ +theorem theorem_8_1_expansion {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {G₁ G₂ : RootedHypergraph α β} {G'₁ G'₂ : RootedHypergraph α' β'} + (hsep : P.G.IsSeparation G₁ G₂) (hsep' : P'.G.IsSeparation G'₁ G'₂) + {η₁v η₂v : α → Set α'} {η₁e η₂e : β → β'} + (hη₁ : IsExpansion (P.restrict G₁) (P'.restrict G'₁) η₁v η₁e) + (hη₂ : IsExpansion (P.restrict G₂) (P'.restrict G'₂) η₂v η₂e) + (hroots_mem : ∀ (i : ℕ) (hi : i < G₁.roots.length) (hi' : i < G'₁.roots.length), + G'₁.roots[i] ∈ η₂v G₁.roots[i]) : + IsExpansion P P' (glueVertex G₁ G₂ η₁v η₂v) (glueEdge G₁ η₁e η₂e) := by + have hle₁ := hsep.isSeparation.left_le + have hle₂ := hsep.isSeparation.right_le + have hle'₁ := hsep'.isSeparation.left_le + have hle'₂ := hsep'.isSeparation.right_le + have hdisjE := isSeparation_disjoint_edgeSet hsep.isSeparation + have hdisjE' := isSeparation_disjoint_edgeSet hsep'.isSeparation + have he_or : ∀ e ∈ P.G.edgeSet, e ∈ G₁.edgeSet ∨ (e ∈ G₂.edgeSet ∧ e ∉ G₁.edgeSet) := by + intro e he + by_cases he₁ : e ∈ G₁.edgeSet + · exact Or.inl he₁ + · rw [← isSeparation_edgeSet_union hsep.isSeparation] at he + rcases he with he₁' | he₂ + · exact absurd he₁' he₁ + · exact Or.inr ⟨he₂, he₁⟩ + refine + { vertex_nonempty := fun v hv ↦ ?_ + vertex_subset := fun v hv v' hv' ↦ ?_ + edge_mem := fun e he ↦ ?_ + vertex_disjoint := fun u₁ _ u₂ _ hne ↦ + lemma_8_1_claim_2 hsep hsep' hη₁ hη₂ hroots_mem hne + edge_injOn := fun e₁ he₁ e₂ he₂ hEq ↦ ?_ + mem_dom_iff := fun e he ↦ ?_ + ends_nonempty := fun e he hnd v hinc ↦ ?_ + μ_length := fun e he ↦ ?_ + μ_mem := fun e he i hi hi' ↦ ?_ + roots_length := ?_ + roots_mem := fun i hi hi' ↦ ?_ + maps_Δ := fun e he ↦ ?_ + φ_le := fun e he ↦ ?_ } + · rw [← isSeparation_vertexSet_union hsep.isSeparation] at hv + rcases hv with hv₁ | hv₂ + · obtain ⟨v', hv'⟩ := hη₁.vertex_nonempty v hv₁ + exact ⟨v', mem_glueVertex_iff.mpr (Or.inl ⟨hv₁, hv'⟩)⟩ + · obtain ⟨v', hv'⟩ := hη₂.vertex_nonempty v hv₂ + exact ⟨v', mem_glueVertex_iff.mpr (Or.inr ⟨hv₂, hv'⟩)⟩ + · rcases mem_glueVertex_iff.mp hv' with ⟨hv₁, hv'₁⟩ | ⟨hv₂, hv'₂⟩ + · exact hle'₁.vertexSet_subset (hη₁.vertex_subset v hv₁ hv'₁) + · exact hle'₂.vertexSet_subset (hη₂.vertex_subset v hv₂ hv'₂) + · rcases he_or e he with he₁ | ⟨he₂, hne₁⟩ + · rw [glueEdge_of_mem_left he₁] + exact hle'₁.edgeSet_subset (hη₁.edge_mem e he₁) + · rw [glueEdge_of_notMem_left hne₁] + exact hle'₂.edgeSet_subset (hη₂.edge_mem e he₂) + · rcases he_or e₁ he₁ with h₁ | ⟨h₁, hn₁⟩ <;> rcases he_or e₂ he₂ with h₂ | ⟨h₂, hn₂⟩ + · rw [glueEdge_of_mem_left h₁, glueEdge_of_mem_left h₂] at hEq + exact hη₁.edge_injOn h₁ h₂ hEq + · rw [glueEdge_of_mem_left h₁, glueEdge_of_notMem_left hn₂] at hEq + exact False.elim (Set.disjoint_left.mp hdisjE' (hη₁.edge_mem e₁ h₁) + (hEq ▸ hη₂.edge_mem e₂ h₂)) + · rw [glueEdge_of_notMem_left hn₁, glueEdge_of_mem_left h₂] at hEq + exact False.elim (Set.disjoint_left.mp hdisjE' (hEq ▸ hη₁.edge_mem e₂ h₂) + (hη₂.edge_mem e₁ h₁)) + · rw [glueEdge_of_notMem_left hn₁, glueEdge_of_notMem_left hn₂] at hEq + exact hη₂.edge_injOn h₁ h₂ hEq + · rcases he_or e he with he₁ | ⟨he₂, hne₁⟩ + · rw [glueEdge_of_mem_left he₁] + have hdom₁ := hη₁.mem_dom_iff e he₁ + rw [P.restrict_dom hle₁, P'.restrict_dom hle'₁] at hdom₁ + exact ⟨fun hd ↦ (hdom₁.mp ⟨hd, he₁⟩).1, fun hd' ↦ (hdom₁.mpr ⟨hd', hη₁.edge_mem e he₁⟩).1⟩ + · rw [glueEdge_of_notMem_left hne₁] + have hdom₂ := hη₂.mem_dom_iff e he₂ + rw [P.restrict_dom hle₂, P'.restrict_dom hle'₂] at hdom₂ + exact ⟨fun hd ↦ (hdom₂.mp ⟨hd, he₂⟩).1, fun hd' ↦ (hdom₂.mpr ⟨hd', hη₂.edge_mem e he₂⟩).1⟩ + · rcases he_or e he with he₁ | ⟨he₂, hne₁⟩ + · rw [glueEdge_of_mem_left he₁] + have hnd₁ : e ∉ (P.restrict G₁).dom := by + rw [P.restrict_dom hle₁] + exact fun h ↦ hnd h.1 + have hinc₁ : G₁.Inc e v := by + change v ∈ G₁.ends e + rw [← hle₁.ends_eq e he₁] + exact hinc + obtain ⟨v', hv', hinc'⟩ := hη₁.ends_nonempty e he₁ hnd₁ v hinc₁ + refine ⟨v', mem_glueVertex_iff.mpr (Or.inl ⟨G₁.vertex_mem_of_inc hinc₁, hv'⟩), ?_⟩ + change v' ∈ P'.G.ends (η₁e e) + rw [hle'₁.ends_eq (η₁e e) (hη₁.edge_mem e he₁)] + exact hinc' + · rw [glueEdge_of_notMem_left hne₁] + have hnd₂ : e ∉ (P.restrict G₂).dom := by + rw [P.restrict_dom hle₂] + exact fun h ↦ hnd h.1 + have hinc₂ : G₂.Inc e v := by + change v ∈ G₂.ends e + rw [← hle₂.ends_eq e he₂] + exact hinc + obtain ⟨v', hv', hinc'⟩ := hη₂.ends_nonempty e he₂ hnd₂ v hinc₂ + refine ⟨v', mem_glueVertex_iff.mpr (Or.inr ⟨G₂.vertex_mem_of_inc hinc₂, hv'⟩), ?_⟩ + change v' ∈ P'.G.ends (η₂e e) + rw [hle'₂.ends_eq (η₂e e) (hη₂.edge_mem e he₂)] + exact hinc' + · rcases he_or e (P.dom_subset he) with he₁ | ⟨he₂, hne₁⟩ + · rw [glueEdge_of_mem_left he₁] + have hd₁ : e ∈ (P.restrict G₁).dom := by + rw [P.restrict_dom hle₁] + exact ⟨he, he₁⟩ + exact hη₁.μ_length e hd₁ + · rw [glueEdge_of_notMem_left hne₁] + have hd₂ : e ∈ (P.restrict G₂).dom := by + rw [P.restrict_dom hle₂] + exact ⟨he, he₂⟩ + exact hη₂.μ_length e hd₂ + · rcases he_or e (P.dom_subset he) with he₁ | ⟨he₂, hne₁⟩ + · simp only [glueEdge_of_mem_left he₁] at hi' ⊢ + have hd₁ : e ∈ (P.restrict G₁).dom := by + rw [P.restrict_dom hle₁] + exact ⟨he, he₁⟩ + have hv_end : (P.μ e)[i] ∈ G₁.ends e := by + rw [← hle₁.ends_eq e he₁, ← P.μ_set e he] + exact List.getElem_mem hi + exact mem_glueVertex_iff.mpr + (Or.inl ⟨G₁.vertex_mem_of_inc hv_end, hη₁.μ_mem e hd₁ i hi hi'⟩) + · simp only [glueEdge_of_notMem_left hne₁] at hi' ⊢ + have hd₂ : e ∈ (P.restrict G₂).dom := by + rw [P.restrict_dom hle₂] + exact ⟨he, he₂⟩ + have hv_end : (P.μ e)[i] ∈ G₂.ends e := by + rw [← hle₂.ends_eq e he₂, ← P.μ_set e he] + exact List.getElem_mem hi + exact mem_glueVertex_iff.mpr + (Or.inr ⟨G₂.vertex_mem_of_inc hv_end, hη₂.μ_mem e hd₂ i hi hi'⟩) + · rw [← hsep.roots_right, ← hsep'.roots_right] + exact hη₂.roots_length + · have hi₂ : i < G₂.roots.length := hsep.roots_right.symm ▸ hi + have hi'₂ : i < G'₂.roots.length := hsep'.roots_right.symm ▸ hi' + have hmem := hη₂.roots_mem i hi₂ hi'₂ + have hv₂ : G₂.roots[i] ∈ G₂.vertexSet := G₂.roots_subset _ (List.getElem_mem hi₂) + have hmem' : G'₂.roots[i] ∈ glueVertex G₁ G₂ η₁v η₂v G₂.roots[i] := + mem_glueVertex_iff.mpr (Or.inr ⟨hv₂, hmem⟩) + simpa [hsep.roots_right, hsep'.roots_right] using hmem' + · rcases he_or e (P.dom_subset he) with he₁ | ⟨he₂, hne₁⟩ + · rw [glueEdge_of_mem_left he₁] + have hd₁ : e ∈ (P.restrict G₁).dom := by + rw [P.restrict_dom hle₁] + exact ⟨he, he₁⟩ + have hmaps := hη₁.maps_Δ e hd₁ + rwa [P.restrict_Δ hle₁ he₁, P'.restrict_Δ hle'₁ (hη₁.edge_mem e he₁)] at hmaps + · rw [glueEdge_of_notMem_left hne₁] + have hd₂ : e ∈ (P.restrict G₂).dom := by + rw [P.restrict_dom hle₂] + exact ⟨he, he₂⟩ + have hmaps := hη₂.maps_Δ e hd₂ + rwa [P.restrict_Δ hle₂ he₂, P'.restrict_Δ hle'₂ (hη₂.edge_mem e he₂)] at hmaps + · rcases he_or e he with he₁ | ⟨he₂, hne₁⟩ + · rw [glueEdge_of_mem_left he₁] + exact hη₁.φ_le e he₁ + · rw [glueEdge_of_notMem_left hne₁] + exact hη₂.φ_le e he₂ + +private theorem emptySubgraph_sup_emptySubgraph (X Y : Set α) : + emptySubgraph X ⊔ emptySubgraph Y = emptySubgraph (X ∪ Y) := by + ext v w + · rfl + · simp [emptySubgraph] + +/-- **Graph Minors IV, (8.1)** (page 247): +"Let $P = (G, \mu, \Delta, \phi)$, $P' = (G', \mu', \Delta', \phi')$ be $\Omega$-patchworks, and +let $(G_1, G_2)$, $(G'_1, G'_2)$ be separations of $G$, $G'$ respectively. Let $\eta_1$ be a +realizable expansion of $P | G_1$ in $P' | G'_1$ (whence $|\bar{\pi}(G_1)| = |\bar{\pi}(G'_1)| = k$, +say) and let $\eta_2$ be a realizable expansion of $P | G_2$ in $P' | G'_2$ such that for +$1 \le i \le k$, $\eta_2(v)$ contains the $i$th term of $\pi(G'_1)$, where $v$ is the $i$th term of +$\pi(G_1)$. Define $\eta$ by +$$\begin{aligned} +\eta(v) &= \eta_1(v) && (v \in V(G_1) - V(G_2)) \\ +&= \eta_2(v) && (v \in V(G_2) - V(G_1)) \\ +&= \eta_1(v) \cup \eta_2(v) && (v \in V(G_1) \cap V(G_2)) \\ +\eta(e) &= \eta_1(e) && (e \in E(G_1)) \\ +&= \eta_2(e) && (e \in E(G_2)). +\end{aligned}$$ +Then $\eta$ is a realizable expansion of $P$ in $P'$." -/ +theorem theorem_8_1_proof {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + {G₁ G₂ : RootedHypergraph α β} {G'₁ G'₂ : RootedHypergraph α' β'} + (hsep : P.G.IsSeparation G₁ G₂) (hsep' : P'.G.IsSeparation G'₁ G'₂) + {η₁v η₂v : α → Set α'} {η₁e η₂e : β → β'} + (hη₁ : IsRealizableExpansion (P.restrict G₁) (P'.restrict G'₁) η₁v η₁e) + (hη₂ : IsRealizableExpansion (P.restrict G₂) (P'.restrict G'₂) η₂v η₂e) + (hroots_mem : ∀ (i : ℕ) (hi : i < G₁.roots.length) (hi' : i < G'₁.roots.length), + G'₁.roots[i] ∈ η₂v G₁.roots[i]) : + IsRealizableExpansion P P' (glueVertex G₁ G₂ η₁v η₂v) (glueEdge G₁ η₁e η₂e) := by + classical + obtain ⟨hexp₁, H₁, ⟨⟨δ₁, hδ₁, hH₁_eq⟩, hcomp₁⟩⟩ := hη₁ + obtain ⟨hexp₂, H₂, ⟨⟨δ₂, hδ₂, hH₂_eq⟩, hcomp₂⟩⟩ := hη₂ + have hexp := theorem_8_1_expansion hsep hsep' hexp₁ hexp₂ hroots_mem + refine ⟨hexp, H₁ ⊔ H₂, ?_, ?_⟩ + · have hle'₁ := hsep'.isSeparation.left_le + have hle'₂ := hsep'.isSeparation.right_le + have hdisjE := isSeparation_disjoint_edgeSet hsep.isSeparation + have hdisjE' := isSeparation_disjoint_edgeSet hsep'.isSeparation + let ηe := glueEdge G₁ η₁e η₂e + let δ : β' → (⊤ : SimpleGraph α').Subgraph := + fun e' ↦ if e' ∈ G'₁.edgeSet then δ₁ e' else δ₂ e' + let S₁ : Set β' := G'₁.edgeSet \ (η₁e '' G₁.edgeSet) + let S₂ : Set β' := G'₂.edgeSet \ (η₂e '' G₂.edgeSet) + let S : Set β' := P'.G.edgeSet \ (ηe '' P.G.edgeSet) + have hS₁_sub : ∀ e' ∈ S₁, e' ∈ S := by + rintro e' ⟨he'₁, hne'₁⟩ + refine ⟨hle'₁.edgeSet_subset he'₁, ?_⟩ + rintro ⟨e, he, rfl⟩ + dsimp only [ηe] at he'₁ hne'₁ + by_cases he₁ : e ∈ G₁.edgeSet + · rw [glueEdge_of_mem_left he₁] at hne'₁ + exact hne'₁ ⟨e, he₁, rfl⟩ + · rw [glueEdge_of_notMem_left he₁] at he'₁ + rw [← isSeparation_edgeSet_union hsep.isSeparation] at he + rcases he with he₁' | he₂ + · exact he₁ he₁' + · exact Set.disjoint_left.mp hdisjE' he'₁ (hexp₂.edge_mem e he₂) + have hS₂_sub : ∀ e' ∈ S₂, e' ∈ S ∧ e' ∉ G'₁.edgeSet := by + rintro e' ⟨he'₂, hne'₂⟩ + have hne'₁ : e' ∉ G'₁.edgeSet := fun h ↦ Set.disjoint_left.mp hdisjE' h he'₂ + refine ⟨⟨hle'₂.edgeSet_subset he'₂, ?_⟩, hne'₁⟩ + rintro ⟨e, he, rfl⟩ + dsimp only [ηe] at hne'₁ hne'₂ + by_cases he₁ : e ∈ G₁.edgeSet + · rw [glueEdge_of_mem_left he₁] at hne'₁ + exact hne'₁ (hexp₁.edge_mem e he₁) + · rw [glueEdge_of_notMem_left he₁] at hne'₂ + rw [← isSeparation_edgeSet_union hsep.isSeparation] at he + rcases he with he₁' | he₂ + · exact he₁ he₁' + · exact hne'₂ ⟨e, he₂, rfl⟩ + have hS_or : ∀ e' ∈ S, e' ∈ S₁ ∨ (e' ∈ S₂ ∧ e' ∉ G'₁.edgeSet) := by + rintro e' ⟨he', hne'⟩ + by_cases he'₁ : e' ∈ G'₁.edgeSet + · refine Or.inl ⟨he'₁, ?_⟩ + rintro ⟨e, he₁, rfl⟩ + exact hne' ⟨e, hsep.isSeparation.left_le.edgeSet_subset he₁, glueEdge_of_mem_left he₁⟩ + · rw [← isSeparation_edgeSet_union hsep'.isSeparation] at he' + rcases he' with he'₁_abs | he'₂ + · exact absurd he'₁_abs he'₁ + · refine Or.inr ⟨⟨he'₂, ?_⟩, he'₁⟩ + rintro ⟨e, he₂, rfl⟩ + have hne₁ : e ∉ G₁.edgeSet := fun h ↦ Set.disjoint_left.mp hdisjE h he₂ + exact hne' ⟨e, hsep.isSeparation.right_le.edgeSet_subset he₂, glueEdge_of_notMem_left + hne₁⟩ + refine ⟨δ, fun e' he' ↦ ?_, ?_⟩ + · rcases hS_or e' he' with he'₁ | ⟨he'₂, hne'₁⟩ + · dsimp only [δ] + rw [ite_eq_left_iff.mpr (fun h ↦ absurd he'₁.1 h)] + have hmem := hδ₁ e' he'₁ + change δ₁ e' ∈ (P'.restrict G'₁).Δ e' at hmem + rwa [P'.restrict_Δ hle'₁ he'₁.1] at hmem + · dsimp only [δ] + rw [ite_eq_right_iff.mpr (fun h ↦ absurd h hne'₁)] + have hmem := hδ₂ e' he'₂ + change δ₂ e' ∈ (P'.restrict G'₂).Δ e' at hmem + rwa [P'.restrict_Δ hle'₂ he'₂.1] at hmem + · change H₁ ⊔ H₂ = emptySubgraph P'.G.vertexSet ⊔ ⨆ e' ∈ S, δ e' + have hH₁_eq' : H₁ = emptySubgraph G'₁.vertexSet ⊔ ⨆ e' ∈ S₁, δ₁ e' := hH₁_eq + have hH₂_eq' : H₂ = emptySubgraph G'₂.vertexSet ⊔ ⨆ e' ∈ S₂, δ₂ e' := hH₂_eq + rw [hH₁_eq', hH₂_eq', sup_sup_sup_comm, emptySubgraph_sup_emptySubgraph, + isSeparation_vertexSet_union hsep'.isSeparation] + congr 1 + apply le_antisymm + · refine sup_le (iSup₂_le fun e' he'₁ ↦ ?_) (iSup₂_le fun e' he'₂ ↦ ?_) + · have hδ_eq : δ₁ e' = δ e' := by + dsimp only [δ] + rw [ite_eq_left_iff.mpr (fun h ↦ absurd he'₁.1 h)] + rw [hδ_eq] + exact le_biSup δ (hS₁_sub e' he'₁) + · obtain ⟨he'S, hne'₁⟩ := hS₂_sub e' he'₂ + have hδ_eq : δ₂ e' = δ e' := by + dsimp only [δ] + rw [ite_eq_right_iff.mpr (fun h ↦ absurd h hne'₁)] + rw [hδ_eq] + exact le_biSup δ he'S + · refine iSup₂_le fun e' he' ↦ ?_ + rcases hS_or e' he' with he'₁ | ⟨he'₂, hne'₁⟩ + · have hδ_eq : δ e' = δ₁ e' := by + dsimp only [δ] + rw [ite_eq_left_iff.mpr (fun h ↦ absurd he'₁.1 h)] + rw [hδ_eq] + exact le_sup_of_le_left (le_biSup δ₁ he'₁) + · have hδ_eq : δ e' = δ₂ e' := by + dsimp only [δ] + rw [ite_eq_right_iff.mpr (fun h ↦ absurd h hne'₁)] + rw [hδ_eq] + exact le_sup_of_le_right (le_biSup δ₂ he'₂) + · intro v hv + have hH₁_verts : H₁.verts = G'₁.vertexSet := + Patchwork.IsRealization.verts_eq ⟨δ₁, hδ₁, hH₁_eq⟩ + have hH₂_verts : H₂.verts = G'₂.vertexSet := + Patchwork.IsRealization.verts_eq ⟨δ₂, hδ₂, hH₂_eq⟩ + have hH_verts : (H₁ ⊔ H₂).verts = P'.G.vertexSet := by + change H₁.verts ∪ H₂.verts = P'.G.vertexSet + rw [hH₁_verts, hH₂_verts, isSeparation_vertexSet_union hsep'.isSeparation] + have hsub : glueVertex G₁ G₂ η₁v η₂v v ⊆ (H₁ ⊔ H₂).verts := by + rw [hH_verts] + exact hexp.vertex_subset v hv + have h₁_prop : ∀ (hv₁ : v ∈ G₁.vertexSet), + (∀ a ∈ η₁v v, ∀ b, H₁.Adj a b → b ∈ η₁v v) ∧ + (∀ a ∈ η₁v v, ∀ b ∈ η₁v v, sameComponent H₁ a b) := by + intro hv₁ + have hsub₁ : η₁v v ⊆ H₁.verts := hH₁_verts ▸ hexp₁.vertex_subset v hv₁ + exact (exists_isComponent_verts_eq_iff (hexp₁.vertex_nonempty v hv₁) hsub₁).mp (hcomp₁ v hv₁) + have h₂_prop : ∀ (hv₂ : v ∈ G₂.vertexSet), + (∀ a ∈ η₂v v, ∀ b, H₂.Adj a b → b ∈ η₂v v) ∧ + (∀ a ∈ η₂v v, ∀ b ∈ η₂v v, sameComponent H₂ a b) := by + intro hv₂ + have hsub₂ : η₂v v ⊆ H₂.verts := hH₂_verts ▸ hexp₂.vertex_subset v hv₂ + exact (exists_isComponent_verts_eq_iff (hexp₂.vertex_nonempty v hv₂) hsub₂).mp (hcomp₂ v hv₂) + have h₁_mem : ∀ a ∈ glueVertex G₁ G₂ η₁v η₂v v, a ∈ G'₁.vertexSet → + v ∈ G₁.vertexSet ∧ a ∈ η₁v v := by + intro a ha ha₁ + rcases mem_glueVertex_iff.mp ha with ⟨hv₁, ha_mem₁⟩ | ⟨hv₂, ha_mem₂⟩ + · exact ⟨hv₁, ha_mem₁⟩ + · have ha_inter : a ∈ (G'₁.toHypergraph ∩ G'₂.toHypergraph).vertexSet := + ⟨ha₁, hexp₂.vertex_subset v hv₂ ha_mem₂⟩ + rw [← hsep'.rootSet_left] at ha_inter + obtain ⟨i, hi', rfl⟩ := List.getElem_of_mem ha_inter + have hi : i < G₁.roots.length := hexp₁.roots_length.symm ▸ hi' + have hv_eq := lemma_8_1_claim_1 hsep hexp₁ hexp₂ hroots_mem hi hi' ha + subst hv_eq + exact ⟨G₁.roots_subset _ (List.getElem_mem hi), hexp₁.roots_mem i hi hi'⟩ + have h₂_mem : ∀ a ∈ glueVertex G₁ G₂ η₁v η₂v v, a ∈ G'₂.vertexSet → + v ∈ G₂.vertexSet ∧ a ∈ η₂v v := by + intro a ha ha₂ + rcases mem_glueVertex_iff.mp ha with ⟨hv₁, ha_mem₁⟩ | ⟨hv₂, ha_mem₂⟩ + · have ha_inter : a ∈ (G'₁.toHypergraph ∩ G'₂.toHypergraph).vertexSet := + ⟨hexp₁.vertex_subset v hv₁ ha_mem₁, ha₂⟩ + rw [← hsep'.rootSet_left] at ha_inter + obtain ⟨i, hi', rfl⟩ := List.getElem_of_mem ha_inter + have hi : i < G₁.roots.length := hexp₁.roots_length.symm ▸ hi' + have hv_eq := lemma_8_1_claim_1 hsep hexp₁ hexp₂ hroots_mem hi hi' ha + subst hv_eq + have hvi_inter : G₁.roots[i] ∈ (G₁.toHypergraph ∩ G₂.toHypergraph).vertexSet := by + rw [← hsep.rootSet_left] + exact List.getElem_mem hi + exact ⟨hvi_inter.2, hroots_mem i hi hi'⟩ + · exact ⟨hv₂, ha_mem₂⟩ + rw [exists_isComponent_verts_eq_iff (hexp.vertex_nonempty v hv) hsub] + refine ⟨fun a ha b hab ↦ ?_, fun a ha b hb ↦ ?_⟩ + · rcases Subgraph.sup_adj.mp hab with hab₁ | hab₂ + · obtain ⟨hv₁, ha₁⟩ := h₁_mem a ha (hH₁_verts ▸ H₁.edge_vert hab₁) + have hb₁ : b ∈ η₁v v := (h₁_prop hv₁).1 a ha₁ b hab₁ + exact mem_glueVertex_iff.mpr (Or.inl ⟨hv₁, hb₁⟩) + · obtain ⟨hv₂, ha₂⟩ := h₂_mem a ha (hH₂_verts ▸ H₂.edge_vert hab₂) + have hb₂ : b ∈ η₂v v := (h₂_prop hv₂).1 a ha₂ b hab₂ + exact mem_glueVertex_iff.mpr (Or.inr ⟨hv₂, hb₂⟩) + · have hsc₁ : ∀ (hv₁ : v ∈ G₁.vertexSet), ∀ x ∈ η₁v v, ∀ y ∈ η₁v v, + sameComponent (H₁ ⊔ H₂) x y := + fun hv₁ x hx y hy ↦ ((h₁_prop hv₁).2 x hx y hy).mono le_sup_left + have hsc₂ : ∀ (hv₂ : v ∈ G₂.vertexSet), ∀ x ∈ η₂v v, ∀ y ∈ η₂v v, + sameComponent (H₁ ⊔ H₂) x y := + fun hv₂ x hx y hy ↦ ((h₂_prop hv₂).2 x hx y hy).mono le_sup_right + rcases mem_glueVertex_iff.mp ha with ⟨hv₁, ha₁⟩ | ⟨hv₂, ha₂⟩ <;> + rcases mem_glueVertex_iff.mp hb with ⟨hv₁', hb₁⟩ | ⟨hv₂', hb₂⟩ + · exact hsc₁ hv₁ a ha₁ b hb₁ + · have hv_inter : v ∈ (G₁.toHypergraph ∩ G₂.toHypergraph).vertexSet := ⟨hv₁, hv₂'⟩ + rw [← hsep.rootSet_left] at hv_inter + obtain ⟨i, hi, rfl⟩ := List.getElem_of_mem hv_inter + have hi' : i < G'₁.roots.length := hexp₁.roots_length ▸ hi + exact (hsc₁ hv₁ a ha₁ G'₁.roots[i] (hexp₁.roots_mem i hi hi')).trans + (hsc₂ hv₂' G'₁.roots[i] (hroots_mem i hi hi') b hb₂) + · have hv_inter : v ∈ (G₁.toHypergraph ∩ G₂.toHypergraph).vertexSet := ⟨hv₁', hv₂⟩ + rw [← hsep.rootSet_left] at hv_inter + obtain ⟨i, hi, rfl⟩ := List.getElem_of_mem hv_inter + have hi' : i < G'₁.roots.length := hexp₁.roots_length ▸ hi + exact (hsc₂ hv₂ a ha₂ G'₁.roots[i] (hroots_mem i hi hi')).trans + (hsc₁ hv₁' G'₁.roots[i] (hexp₁.roots_mem i hi hi') b hb₁) + · exact hsc₂ hv₂ a ha₂ b hb₂ + +/-! ### Removable patchworks, star-decompositions, and Graph Minors IV, (8.2) -/ + + + +open Classical in +private theorem emptySubgraph_mono {X Y : Set α} (h : X ⊆ Y) : + emptySubgraph X ≤ emptySubgraph Y := + ⟨h, fun _ _ hab ↦ False.elim hab⟩ + +omit [Preorder Ω] in +open Classical in +theorem Patchwork.IsRemovable.restrict {P : Patchwork Ω α β} (hP : P.IsRemovable) + {G' : RootedHypergraph α β} (hle : G'.toHypergraph ≤ P.G.toHypergraph) : + (P.restrict G').IsRemovable := by + intro e he + change emptySubgraph (G'.ends e) ∈ (P.restrict G').Δ e + rw [P.restrict_Δ hle he, ← hle.ends_eq e he] + exact hP e (hle.edgeSet_subset he) + +omit [Preorder Ω] in +open Classical in +theorem Patchwork.IsRemovable.deleteEdges {P : Patchwork Ω α β} (hP : P.IsRemovable) + (F : Set β) : (P.deleteEdges F).IsRemovable := by + rintro e ⟨he, hneF⟩ + have hends : (P.deleteEdges F).G.ends e = P.G.ends e := by + ext v + exact ⟨fun hv ↦ hv.1, fun hv ↦ ⟨hv, hneF⟩⟩ + change emptySubgraph ((P.deleteEdges F).G.ends e) ∈ P.Δ e + rw [hends] + exact hP e he + +omit [Preorder Ω] in +open Classical in +theorem Patchwork.IsRemovable.emptySubgraph_isRealization {P : Patchwork Ω α β} + (hP : P.IsRemovable) : P.IsRealization (emptySubgraph P.G.vertexSet) := by + refine ⟨fun e ↦ emptySubgraph (P.G.ends e), fun e he ↦ hP e he, ?_⟩ + apply le_antisymm le_sup_left + refine sup_le le_rfl (iSup₂_le fun e _ ↦ emptySubgraph_mono fun _ hv ↦ P.G.vertex_mem_of_inc hv) + +open Classical in +theorem exists_isComponent_emptySubgraph_singleton {X : Set α} {x : α} (hx : x ∈ X) : + ∃ D, IsComponent (emptySubgraph X) D ∧ D.verts = {x} := by + rw [exists_isComponent_verts_eq_iff (Set.singleton_nonempty x) (Set.singleton_subset_iff.mpr hx)] + refine ⟨fun _ _ _ hab ↦ False.elim hab, ?_⟩ + rintro a rfl b rfl + exact sameComponent_iff.mpr ⟨hx, hx, Reachable.refl _⟩ + +open Classical in +theorem Patchwork.IsRemovable.isRealizableExpansion_of_singleton {P : Patchwork Ω α β} + {P' : Patchwork Ω α' β'} (hP' : P'.IsRemovable) {ηv : α → Set α'} {ηe : β → β'} + (hexp : IsExpansion P P' ηv ηe) (hsing : ∀ v ∈ P.G.vertexSet, ∃ v', ηv v = {v'}) : + IsRealizableExpansion P P' ηv ηe := by + refine ⟨hexp, emptySubgraph P'.G.vertexSet, + (hP'.deleteEdges (ηe '' P.G.edgeSet)).emptySubgraph_isRealization, fun v hv ↦ ?_⟩ + obtain ⟨v', hv'⟩ := hsing v hv + have hv'_mem : v' ∈ P'.G.vertexSet := hexp.vertex_subset v hv (hv' ▸ Set.mem_singleton v') + rw [hv'] + exact exists_isComponent_emptySubgraph_singleton hv'_mem + +open Classical in +theorem Patchwork.IsRemovable.simulated_restrict_of_roots_eq {P' : Patchwork Ω α' β'} + (hP' : P'.IsRemovable) {G'₀ : RootedHypergraph α' β'} + (hle : G'₀.toHypergraph ≤ P'.G.toHypergraph) (hroots : G'₀.roots = P'.G.roots) : + Simulated (P'.restrict G'₀) P' := by + refine ⟨fun v ↦ {v}, id, hP'.isRealizableExpansion_of_singleton ?_ fun v _ ↦ ⟨v, rfl⟩⟩ + refine + { vertex_nonempty := fun v _ ↦ Set.singleton_nonempty v + vertex_subset := fun v hv _ hEq ↦ hEq.symm ▸ hle.vertexSet_subset hv + edge_mem := fun e he ↦ hle.edgeSet_subset he + vertex_disjoint := fun _ _ _ _ hne ↦ Set.disjoint_singleton.mpr hne + edge_injOn := fun _ _ _ _ h ↦ h + mem_dom_iff := fun e he ↦ by + rw [P'.restrict_dom hle] + exact ⟨fun h ↦ h.1, fun h ↦ ⟨h, he⟩⟩ + ends_nonempty := fun e he _ v hv ↦ by + refine ⟨v, rfl, ?_⟩ + change v ∈ P'.G.ends e + rw [hle.ends_eq e he] + exact hv + μ_length := fun _ _ ↦ rfl + μ_mem := fun _ _ _ _ _ ↦ rfl + roots_length := congrArg List.length hroots + roots_mem := fun i hi hi' ↦ by + change P'.G.roots[i] = G'₀.roots[i] + simp [hroots] + maps_Δ := fun e he δ hδ ↦ by + rw [P'.restrict_dom hle] at he + rw [P'.restrict_Δ hle he.2] at hδ + have hverts : δ.verts ⊆ {x | x ∈ P'.μ e} := by + rw [((P'.Δ e).verts_eq δ hδ).trans (P'.Δ_verts e (hle.edgeSet_subset he.2)), + P'.μ_set e he.1] + change marchMapSubgraph (P'.μ e) (P'.μ e) δ ∈ (P'.Δ e).groupings + rwa [marchMapSubgraph_id hverts] + φ_le := fun _ _ ↦ le_rfl } + +attribute [local simp] GraphMinor.Hypergraph.union_vertexSet_eq + GraphMinor.Hypergraph.union_edgeSet_eq + GraphMinor.Hypergraph.inter_vertexSet_eq GraphMinor.Hypergraph.inter_edgeSet_eq + +open Classical in +theorem Hypergraph.biUnion_insert (s : ι) (A : Finset ι) (f : ι → Hypergraph α β) : + Hypergraph.biUnion (insert s A) f = f s ∪ Hypergraph.biUnion A f := by + ext v e + · simp [Hypergraph.biUnion] + · simp [Hypergraph.biUnion] + · simp [Hypergraph.biUnion, GraphMinor.Hypergraph.union_inc_iff] + +open Classical in +theorem Hypergraph.biUnion_singleton (s : ι) (f : ι → Hypergraph α β) : + Hypergraph.biUnion {s} f = f s := by + ext v e + · simp [Hypergraph.biUnion] + · simp [Hypergraph.biUnion] + · simp [Hypergraph.biUnion] + +open Classical in +theorem Hypergraph.biUnion_ends_eq {G : Hypergraph α β} {C : Finset ι} {f : ι → Hypergraph α β} + (hle : ∀ t ∈ C, f t ≤ G) {e : β} (he : e ∈ (Hypergraph.biUnion C f).edgeSet) : + (Hypergraph.biUnion C f).ends e = G.ends e := by + simp only [Hypergraph.biUnion, Set.mem_iUnion, exists_prop] at he + obtain ⟨t₀, ht₀, he₀⟩ := he + ext v + simp only [Hypergraph.ends, Hypergraph.biUnion, Set.mem_ofPred_eq] + constructor + · rintro ⟨t, ht, hinc⟩ + have he_t : e ∈ (f t).edgeSet := (f t).edge_mem_of_inc hinc + change v ∈ G.ends e + rw [(hle t ht).ends_eq e he_t] + exact hinc + · intro hv + refine ⟨t₀, ht₀, ?_⟩ + change v ∈ (f t₀).ends e + rw [← (hle t₀ ht₀).ends_eq e he₀] + exact hv + +open Classical in +theorem Hypergraph.biUnion_le {G : Hypergraph α β} {C : Finset ι} {f : ι → Hypergraph α β} + (hle : ∀ t ∈ C, f t ≤ G) : Hypergraph.biUnion C f ≤ G where + vertexSet_subset := by + simp only [Hypergraph.biUnion, Set.iUnion_subset_iff] + exact fun t ht ↦ (hle t ht).vertexSet_subset + edgeSet_subset := by + simp only [Hypergraph.biUnion, Set.iUnion_subset_iff] + exact fun t ht ↦ (hle t ht).edgeSet_subset + ends_eq _ he := (Hypergraph.biUnion_ends_eq hle he).symm + +open Classical in +theorem Hypergraph.biUnion_le_biUnion {G : Hypergraph α β} {A B : Finset ι} + {f : ι → Hypergraph α β} (hAB : A ⊆ B) (hle : ∀ t ∈ B, f t ≤ G) : + Hypergraph.biUnion A f ≤ Hypergraph.biUnion B f where + vertexSet_subset := Set.biUnion_mono hAB fun _ _ ↦ subset_rfl + edgeSet_subset := Set.biUnion_mono hAB fun _ _ ↦ subset_rfl + ends_eq e he := by + have heB : e ∈ (Hypergraph.biUnion B f).edgeSet := + Set.biUnion_mono hAB (fun _ _ ↦ subset_rfl) he + rw [Hypergraph.biUnion_ends_eq hle heB, + Hypergraph.biUnion_ends_eq (fun t ht ↦ hle t (hAB ht)) he] + +open Classical in +theorem cross_empty (σ : ι → RootedHypergraph α β) (r : ι) : + cross σ ∅ r = σ r := by + have hins : insert r (∅ : Finset ι) = {r} := rfl + cases h : σ r with + | mk toH roots nodup sub => + simp only [cross, hins, Hypergraph.biUnion_singleton, h] + +open Classical in +theorem cross_verts_of_isTreeDecomposition {G : RootedHypergraph α β} {S : RootedTree ι} + {σ : ι → RootedHypergraph α β} (htd : IsTreeDecomposition G S σ) : + cross σ S.verts S.root = G := by + have hins : insert S.root S.verts = S.verts := Finset.insert_eq_of_mem S.root_mem + cases G with + | mk toH roots nodup sub => + simp only [cross, hins, htd.biUnion_eq, htd.roots_root] + +open Classical in +theorem cross_edges_of_isTreeDecomposition {G : RootedHypergraph α β} {S : RootedTree ι} + {σ : ι → RootedHypergraph α β} (htd : IsTreeDecomposition G S σ) : + cross σ S.edges S.root = G := by + have hins : insert S.root S.edges = S.verts := Finset.insert_erase S.root_mem + cases G with + | mk toH roots nodup sub => + simp only [cross, hins, htd.biUnion_eq, htd.roots_root] + +open Classical in +theorem cross_le_of_subset {G : RootedHypergraph α β} {S : RootedTree ι} + {σ : ι → RootedHypergraph α β} (htd : IsTreeDecomposition G S σ) + {F₁ F₂ : Finset ι} (h₁₂ : F₁ ⊆ F₂) (h₂ : F₂ ⊆ S.edges) : + (cross σ F₁ S.root).toHypergraph ≤ (cross σ F₂ S.root).toHypergraph := by + refine Hypergraph.biUnion_le_biUnion (G := G.toHypergraph) + (Finset.insert_subset_insert S.root h₁₂) ?_ + intro t ht + rcases Finset.mem_insert.mp ht with rfl | ht₂ + · exact htd.le S.root S.root_mem + · exact htd.le t (Finset.mem_of_mem_erase (h₂ ht₂)) + +open Classical in +theorem cross_le_of_isTreeDecomposition {G : RootedHypergraph α β} {S : RootedTree ι} + {σ : ι → RootedHypergraph α β} (htd : IsTreeDecomposition G S σ) + {F : Finset ι} (hF : F ⊆ S.edges) : + (cross σ F S.root).toHypergraph ≤ G.toHypergraph := by + apply Hypergraph.biUnion_le + intro t ht + rcases Finset.mem_insert.mp ht with rfl | htF + · exact htd.le S.root S.root_mem + · exact htd.le t (Finset.mem_of_mem_erase (hF htF)) + +open Classical in +theorem isStar_reaches_iff {S : RootedTree ι} (hstar : S.IsStar) {s : ι} (hs : s ∈ S.edges) + {x : ι} : S.Reaches x s ↔ x = s ∨ x = S.root := by + have hs_verts : s ∈ S.verts := Finset.mem_of_mem_erase hs + constructor + · rintro ⟨_, n, hn⟩ + cases n with + | zero => exact Or.inl hn.symm + | succ m => + rw [Function.iterate_succ_apply, hstar s hs, Function.iterate_fixed S.parent_root m] at hn + exact Or.inr hn.symm + · rintro (rfl | rfl) + · exact ⟨hs_verts, 0, rfl⟩ + · exact ⟨hs_verts, 1, hstar s hs⟩ + +open Classical in +theorem isStar_onPath_root {S : RootedTree ι} (hstar : S.IsStar) {s t : ι} + (hs : s ∈ S.edges) (ht : t ∈ S.edges) (hne : s ≠ t) : + S.OnPath s t S.root := by + refine ⟨Or.inl ((isStar_reaches_iff hstar hs).mpr (Or.inr rfl)), fun x hxs hxt ↦ ?_⟩ + rcases (isStar_reaches_iff hstar hs).mp hxs with rfl | rfl + · rcases (isStar_reaches_iff hstar ht).mp hxt with hst | hxroot + · exact absurd hst hne + · subst hxroot + exact ⟨S.root_mem, 0, rfl⟩ + · exact ⟨S.root_mem, 0, rfl⟩ + +open Classical in +theorem isSeparation_cross_insert {G : RootedHypergraph α β} {S : RootedTree ι} + {σ : ι → RootedHypergraph α β} (hstar : S.IsStar) (htd : IsTreeDecomposition G S σ) + {F : Finset ι} (hF : F ⊆ S.edges) {s : ι} (hs : s ∈ S.edges) (hsF : s ∉ F) : + (cross σ (insert s F) S.root).IsSeparation (σ s) (cross σ F S.root) := by + have hs_verts : s ∈ S.verts := Finset.mem_of_mem_erase hs + have hsub : insert S.root (insert s F) ⊆ S.verts := + Finset.insert_subset_iff.mpr ⟨S.root_mem, + Finset.insert_subset_iff.mpr ⟨hs_verts, fun x hx ↦ Finset.mem_of_mem_erase (hF hx)⟩⟩ + have hle_all : ∀ t ∈ insert S.root (insert s F), (σ t).toHypergraph ≤ G.toHypergraph := + fun t ht ↦ htd.le t (hsub ht) + refine + { isSeparation := + { left_le := by + rw [← Hypergraph.biUnion_singleton s (fun t ↦ (σ t).toHypergraph)] + refine Hypergraph.biUnion_le_biUnion ?_ hle_all + simp + right_le := cross_le_of_subset htd (Finset.subset_insert s F) + (Finset.insert_subset_iff.mpr ⟨hs, hF⟩) + union_eq := by + change (σ s).toHypergraph ∪ + Hypergraph.biUnion (insert S.root F) (fun t ↦ (σ t).toHypergraph) = + Hypergraph.biUnion (insert S.root (insert s F)) (fun t ↦ (σ t).toHypergraph) + rw [← Hypergraph.biUnion_insert s (insert S.root F) (fun t ↦ (σ t).toHypergraph), + Finset.insert_comm] + edgeSet_inter_eq := by + ext e + simp only [GraphMinor.Hypergraph.inter_edgeSet_eq, cross, Hypergraph.biUnion, + Set.mem_inter_iff, + Set.mem_iUnion, Set.mem_empty_iff_false, iff_false, not_and, not_exists] + intro hes t ht het + have ht_verts : t ∈ S.verts := by + rcases Finset.mem_insert.mp ht with rfl | htF + · exact S.root_mem + · exact Finset.mem_of_mem_erase (hF htF) + have hne : s ≠ t := by + rintro rfl + rcases Finset.mem_insert.mp ht with hs_root | hsF' + · exact Finset.ne_of_mem_erase hs hs_root + · exact hsF hsF' + have hempty := htd.edgeSet_inter_eq s hs_verts t ht_verts hne + have he_inter : e ∈ ((σ s).toHypergraph ∩ (σ t).toHypergraph).edgeSet := ⟨hes, het⟩ + rw [hempty] at he_inter + exact he_inter } + roots_right := rfl + rootSet_left := by + rw [htd.rootSet_edge s hs, hstar s hs] + ext v + simp only [GraphMinor.Hypergraph.inter_vertexSet_eq, cross, Hypergraph.biUnion, + Set.mem_inter_iff, + Set.mem_iUnion, exists_prop] + refine ⟨fun ⟨hvs, hvr⟩ ↦ ⟨hvs, S.root, Finset.mem_insert_self _ _, hvr⟩, ?_⟩ + rintro ⟨hvs, t, ht, hvt⟩ + refine ⟨hvs, ?_⟩ + rcases Finset.mem_insert.mp ht with rfl | htF + · exact hvt + · have ht_edges : t ∈ S.edges := hF htF + have hne : s ≠ t := fun h ↦ hsF (h ▸ htF) + have hOnPath := isStar_onPath_root hstar hs ht_edges hne + exact (htd.inter_le s hs_verts S.root S.root_mem t + (Finset.mem_of_mem_erase ht_edges) hOnPath).vertexSet_subset ⟨hvs, hvt⟩ } + +open Classical in +/-- Given a star `S` and a subset `U ⊆ S.edges`, the sub-star with vertex set `{o(S)} ∪ U`. -/ +noncomputable def subStar (S : RootedTree ι) (hstar : S.IsStar) (U : Finset ι) + (hU : U ⊆ S.edges) : RootedTree ι where + verts := by classical exact insert S.root U + root := S.root + parent := S.parent + root_mem := by classical exact Finset.mem_insert_self S.root U + parent_mem v hv := by + classical + rcases Finset.mem_insert.mp hv with rfl | hvU + · rw [S.parent_root] + exact Finset.mem_insert_self S.root U + · rw [hstar v (hU hvU)] + exact Finset.mem_insert_self S.root U + parent_root := S.parent_root + exists_iterate_eq_root v hv := by + classical + rcases Finset.mem_insert.mp hv with rfl | hvU + · exact ⟨0, rfl⟩ + · exact ⟨1, hstar v (hU hvU)⟩ + +open Classical in +theorem subStar_edges {S : RootedTree ι} (hstar : S.IsStar) {U : Finset ι} (hU : U ⊆ S.edges) : + (subStar S hstar U hU).edges = U := by + classical + have hnot : S.root ∉ U := fun h ↦ Finset.notMem_erase S.root S.verts (hU h) + change (insert S.root U).erase S.root = U + exact Finset.erase_insert hnot + +open Classical in +theorem subStar_isStar {S : RootedTree ι} (hstar : S.IsStar) {U : Finset ι} (hU : U ⊆ S.edges) : + (subStar S hstar U hU).IsStar := by + intro v hv + rw [subStar_edges hstar hU] at hv + exact hstar v (hU hv) + +open Classical in +/-- Base step of Graph Minors IV, (8.2) (page 249): `η₀(v) = {γ(v)}`, `η₀(e) = α(e)` is a +realizable expansion of `P | σ(o(S))` in `P' | σ'(o(S'))`. -/ +theorem theorem_8_2_root {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + (hP' : P'.IsRemovable) + {S : RootedTree ι} {σ : ι → RootedHypergraph α β} + {S' : RootedTree ι'} {σ' : ι' → RootedHypergraph α' β'} + (htd : IsTreeDecomposition P.G S σ) (htd' : IsTreeDecomposition P'.G S' σ') + {γ : α → α'} (hγ_maps : Set.MapsTo γ (σ S.root).vertexSet (σ' S'.root).vertexSet) + (hγ_inj : Set.InjOn γ (σ S.root).vertexSet) + (hγ_roots : P'.G.roots = P.G.roots.map γ) + {αe : β → β'} (hα_maps : Set.MapsTo αe (σ S.root).edgeSet (σ' S'.root).edgeSet) + (hα_inj : Set.InjOn αe (σ S.root).edgeSet) + (hα_dom : ∀ e ∈ (σ S.root).edgeSet, αe e ∈ P'.dom ↔ e ∈ P.dom) + (hα_μ : ∀ e ∈ (σ S.root).edgeSet, e ∈ P.dom → + P'.μ (αe e) = (P.μ e).map γ ∧ + Set.MapsTo (marchMapSubgraph (P.μ e) (P'.μ (αe e))) + (P.Δ e).groupings (P'.Δ (αe e)).groupings) + (hα_ends : ∀ e ∈ (σ S.root).edgeSet, e ∉ P.dom → + ∀ v ∈ P.G.ends e, γ v ∈ P'.G.ends (αe e)) + (hα_φ : ∀ e ∈ (σ S.root).edgeSet, P.φ e ≤ P'.φ (αe e)) : + IsRealizableExpansion (P.restrict (σ S.root)) (P'.restrict (σ' S'.root)) + (fun v ↦ {γ v}) αe := by + have hle : (σ S.root).toHypergraph ≤ P.G.toHypergraph := htd.le S.root S.root_mem + have hle' : (σ' S'.root).toHypergraph ≤ P'.G.toHypergraph := htd'.le S'.root S'.root_mem + have hrem₀ : (P'.restrict (σ' S'.root)).IsRemovable := hP'.restrict hle' + refine hrem₀.isRealizableExpansion_of_singleton ?_ fun v _ ↦ ⟨γ v, rfl⟩ + refine + { vertex_nonempty := fun v _ ↦ Set.singleton_nonempty (γ v) + vertex_subset := fun v hv _ hEq ↦ hEq.symm ▸ hγ_maps hv + edge_mem := fun e he ↦ hα_maps he + vertex_disjoint := fun v₁ hv₁ v₂ hv₂ hne ↦ + Set.disjoint_singleton.mpr fun hEq ↦ hne (hγ_inj hv₁ hv₂ hEq) + edge_injOn := hα_inj + mem_dom_iff := fun e he ↦ by + rw [P.restrict_dom hle, P'.restrict_dom hle'] + exact ⟨fun ⟨hd, _⟩ ↦ ⟨(hα_dom e he).mpr hd, hα_maps he⟩, + fun ⟨hd', _⟩ ↦ ⟨(hα_dom e he).mp hd', he⟩⟩ + ends_nonempty := fun e he hnd v hinc ↦ by + rw [P.restrict_dom hle] at hnd + have hndP : e ∉ P.dom := fun hd ↦ hnd ⟨hd, he⟩ + have hincP : v ∈ P.G.ends e := by + rw [hle.ends_eq e he] + exact hinc + refine ⟨γ v, rfl, ?_⟩ + change γ v ∈ (σ' S'.root).ends (αe e) + rw [← hle'.ends_eq (αe e) (hα_maps he)] + exact hα_ends e he hndP v hincP + μ_length := fun e he ↦ by + rw [P.restrict_dom hle] at he + have hμ := (hα_μ e he.2 he.1).1 + change (P.μ e).length = (P'.μ (αe e)).length + rw [hμ, List.length_map] + μ_mem := fun e he i hi hi' ↦ by + rw [P.restrict_dom hle] at he + have hμ := (hα_μ e he.2 he.1).1 + change (P'.μ (αe e))[i] ∈ {γ (P.μ e)[i]} + simp only [Set.mem_singleton_iff, hμ, List.getElem_map] + rfl + roots_length := by + change (σ S.root).roots.length = (σ' S'.root).roots.length + rw [htd.roots_root, htd'.roots_root, hγ_roots, List.length_map] + roots_mem := fun i hi hi' ↦ by + change (σ' S'.root).roots[i] ∈ {γ (σ S.root).roots[i]} + simp only [Set.mem_singleton_iff, htd.roots_root, htd'.roots_root, hγ_roots, + List.getElem_map] + maps_Δ := fun e he ↦ by + rw [P.restrict_dom hle] at he + rw [P.restrict_Δ hle he.2, P'.restrict_Δ hle' (hα_maps he.2)] + exact (hα_μ e he.2 he.1).2 + φ_le := fun e he ↦ hα_φ e he } + +open Classical in +/-- Inductive step of Graph Minors IV, (8.2) (page 249): for every subset `F ⊆ U(S)` of tips of +`S`, there is a realizable expansion `ζ` of `P | (σ × S_F)` in `P' | (σ' × S'_{β(F)})` such that +`γ(v) ∈ ζ(v)` for all `v ∈ V(σ(o(S)))`. -/ +theorem theorem_8_2_subset {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + (hP' : P'.IsRemovable) + {S : RootedTree ι} {σ : ι → RootedHypergraph α β} + {S' : RootedTree ι'} {σ' : ι' → RootedHypergraph α' β'} + (hstar : S.IsStar) (htd : IsTreeDecomposition P.G S σ) + (hstar' : S'.IsStar) (htd' : IsTreeDecomposition P'.G S' σ') + {γ : α → α'} (hγ_maps : Set.MapsTo γ (σ S.root).vertexSet (σ' S'.root).vertexSet) + (hγ_inj : Set.InjOn γ (σ S.root).vertexSet) + (hγ_roots : P'.G.roots = P.G.roots.map γ) + {αe : β → β'} (hα_maps : Set.MapsTo αe (σ S.root).edgeSet (σ' S'.root).edgeSet) + (hα_inj : Set.InjOn αe (σ S.root).edgeSet) + (hα_dom : ∀ e ∈ (σ S.root).edgeSet, αe e ∈ P'.dom ↔ e ∈ P.dom) + (hα_μ : ∀ e ∈ (σ S.root).edgeSet, e ∈ P.dom → + P'.μ (αe e) = (P.μ e).map γ ∧ + Set.MapsTo (marchMapSubgraph (P.μ e) (P'.μ (αe e))) + (P.Δ e).groupings (P'.Δ (αe e)).groupings) + (hα_ends : ∀ e ∈ (σ S.root).edgeSet, e ∉ P.dom → + ∀ v ∈ P.G.ends e, γ v ∈ P'.G.ends (αe e)) + (hα_φ : ∀ e ∈ (σ S.root).edgeSet, P.φ e ≤ P'.φ (αe e)) + {βf : ι → ι'} (hβ_maps : Set.MapsTo βf (S.edges : Set ι) (S'.edges : Set ι')) + (hβ_inj : Set.InjOn βf (S.edges : Set ι)) + (hβ_roots : ∀ s ∈ S.edges, (σ' (βf s)).roots = (σ s).roots.map γ) + (hβ_sim : ∀ s ∈ S.edges, Simulated (P.restrict (σ s)) (P'.restrict (σ' (βf s)))) + (F : Finset ι) (hF : F ⊆ S.edges) : + ∃ (ζv : α → Set α') (ζe : β → β'), + IsRealizableExpansion + (P.restrict (cross σ F S.root)) + (P'.restrict (cross σ' (by classical exact F.image βf) S'.root)) + ζv ζe ∧ + ∀ v ∈ (σ S.root).vertexSet, γ v ∈ ζv v := by + classical + induction F using Finset.induction_on with + | empty => + refine ⟨fun v ↦ {γ v}, αe, ?_, fun v _ ↦ rfl⟩ + rw [Finset.image_empty, cross_empty, cross_empty] + exact theorem_8_2_root hP' htd htd' hγ_maps hγ_inj hγ_roots + hα_maps hα_inj hα_dom hα_μ hα_ends hα_φ + | @insert s F hsF ih => + have hs : s ∈ S.edges := hF (Finset.mem_insert_self s F) + have hF_sub : F ⊆ S.edges := (Finset.subset_insert s F).trans hF + obtain ⟨ζv, ζe, hζ, hζ_root⟩ := ih hF_sub + obtain ⟨η₁v, η₁e, hη₁⟩ := hβ_sim s hs + have hF'_sub : F.image βf ⊆ S'.edges := by + intro s' hs' + obtain ⟨t, ht, rfl⟩ := Finset.mem_image.mp hs' + exact hβ_maps (hF_sub ht) + have hbs : βf s ∈ S'.edges := hβ_maps hs + have hbsF' : βf s ∉ F.image βf := by + intro hmem + obtain ⟨t, ht, hEq⟩ := Finset.mem_image.mp hmem + exact hsF (hβ_inj (hF_sub ht) hs hEq ▸ ht) + have hsep := isSeparation_cross_insert hstar htd hF_sub hs hsF + have hsep' := isSeparation_cross_insert hstar' htd' hF'_sub hbs hbsF' + let G_next := cross σ (insert s F) S.root + let G'_next := cross σ' (insert (βf s) (F.image βf)) S'.root + have hle_next : G_next.toHypergraph ≤ P.G.toHypergraph := + cross_le_of_isTreeDecomposition htd hF + have hle'_next : G'_next.toHypergraph ≤ P'.G.toHypergraph := + cross_le_of_isTreeDecomposition htd' (Finset.insert_subset_iff.mpr ⟨hbs, hF'_sub⟩) + have hη₁' : IsRealizableExpansion + ((P.restrict G_next).restrict (σ s)) + ((P'.restrict G'_next).restrict (σ' (βf s))) η₁v η₁e := + hη₁.congr + (Patchwork.agrees_restrict_restrict hle_next hsep.isSeparation.left_le).symm + (Patchwork.agrees_restrict_restrict hle'_next hsep'.isSeparation.left_le).symm + have hζ' : IsRealizableExpansion + ((P.restrict G_next).restrict (cross σ F S.root)) + ((P'.restrict G'_next).restrict (cross σ' (F.image βf) S'.root)) ζv ζe := + hζ.congr + (Patchwork.agrees_restrict_restrict hle_next hsep.isSeparation.right_le).symm + (Patchwork.agrees_restrict_restrict hle'_next hsep'.isSeparation.right_le).symm + have hroots_mem : ∀ (i : ℕ) (hi : i < (σ s).roots.length) + (hi' : i < (σ' (βf s)).roots.length), + (σ' (βf s)).roots[i] ∈ ζv (σ s).roots[i] := by + intro i hi hi' + have hvi_root : (σ s).roots[i] ∈ (σ S.root).vertexSet := by + have hmem : (σ s).roots[i] ∈ (σ s).rootSet := List.getElem_mem hi + rw [htd.rootSet_edge s hs, hstar s hs] at hmem + exact hmem.2 + have hEq : (σ' (βf s)).roots[i] = γ (σ s).roots[i] := by + simp [hβ_roots s hs] + rw [hEq] + exact hζ_root (σ s).roots[i] hvi_root + have hglued := theorem_8_1_proof hsep hsep' hη₁' hζ' hroots_mem + rw [Finset.image_insert] + refine ⟨glueVertex (σ s) (cross σ F S.root) η₁v ζv, glueEdge (σ s) η₁e ζe, hglued, + fun v hv ↦ ?_⟩ + have hv_in_F : v ∈ (cross σ F S.root).vertexSet := + Set.mem_biUnion (Finset.mem_coe.mpr (Finset.mem_insert_self S.root F)) hv + exact mem_glueVertex_iff.mpr (Or.inr ⟨hv_in_F, hζ_root v hv⟩) + +open Classical in +/-- **Graph Minors IV, (8.2)** (pages 248–249): +"Let $P = (G, \mu, \Delta, \phi)$, $P' = (G', \mu', \Delta', \phi')$ be $\Omega$-patchworks +where $P'$ is removable. Let $(S, \sigma)$, $(S', \sigma')$ be star-decompositions of $G$, +$G'$, respectively. Let $\gamma$ be a bijection from $V(\sigma(o(S)))$ to +$V(\sigma'(o(S')))$ mapping $\pi(G)$ to $\pi(G')$. Let $\alpha$ be an injection from +$E(\sigma(o(S)))$ into $E(\sigma'(o(S')))$, such that for each $e \in E(\sigma(o(S)))$* (i) +*$\alpha(e) \in \operatorname{dom}(\mu')$ if and only if $e \in \operatorname{dom}(\mu)$* +(ii) *if $e \in \operatorname{dom}(\mu)$ then $\gamma$ maps $\mu(e)$ to $\mu'(\alpha(e))$ +... (iii) *if $e \notin \operatorname{dom}(\mu)$ then $\gamma$ maps $V_G(e)$ to +$V_{G'}(\alpha(e))$* (iv) *$\phi(e) \le \phi'(\alpha(e))$.* ... *Let $\beta$ be a bijection from +$U(S)$ to $U(S')$, such that for each $s \in U(S)$,* (v) *$\gamma$ maps $\pi(\sigma(s))$ to +$\pi(\sigma'(\beta(s)))$* (vi) *$P | \sigma(s)$ is simulated in $P' | \sigma'(\beta(s))$.* +*Then $P$ is simulated in $P'$." + +Note on condition (ii): the paper omits '`μ(e) → μ'(α(e))` maps `Δ(e)` to `Δ'(α(e))`' in the +statement of (8.2)(ii), which is required for `η₀` to satisfy condition (viii) of an expansion; +in the proof of (8.4) (page 250, claims (4) and (6)(ii)), the paper explicitly establishes +`Δᵢ(e) = Δ_{i'}(α(e))` before invoking (8.2). -/ +theorem theorem_8_2_proof {P : Patchwork Ω α β} {P' : Patchwork Ω α' β'} + (hP' : P'.IsRemovable) + {S : RootedTree ι} {σ : ι → RootedHypergraph α β} + {S' : RootedTree ι'} {σ' : ι' → RootedHypergraph α' β'} + (hstar : S.IsStar) (htd : IsTreeDecomposition P.G S σ) + (hstar' : S'.IsStar) (htd' : IsTreeDecomposition P'.G S' σ') + {γ : α → α'} (hγ_bij : Set.BijOn γ (σ S.root).vertexSet (σ' S'.root).vertexSet) + (hγ_roots : P'.G.roots = P.G.roots.map γ) + {αe : β → β'} (hα_maps : Set.MapsTo αe (σ S.root).edgeSet (σ' S'.root).edgeSet) + (hα_inj : Set.InjOn αe (σ S.root).edgeSet) + (hα_dom : ∀ e ∈ (σ S.root).edgeSet, αe e ∈ P'.dom ↔ e ∈ P.dom) + (hα_μ : ∀ e ∈ (σ S.root).edgeSet, e ∈ P.dom → + P'.μ (αe e) = (P.μ e).map γ ∧ + Set.MapsTo (marchMapSubgraph (P.μ e) (P'.μ (αe e))) + (P.Δ e).groupings (P'.Δ (αe e)).groupings) + (hα_ends : ∀ e ∈ (σ S.root).edgeSet, e ∉ P.dom → + γ '' P.G.ends e = P'.G.ends (αe e)) + (hα_φ : ∀ e ∈ (σ S.root).edgeSet, P.φ e ≤ P'.φ (αe e)) + {βf : ι → ι'} (hβ_bij : Set.BijOn βf (S.edges : Set ι) (S'.edges : Set ι')) + (hβ_roots : ∀ s ∈ S.edges, (σ' (βf s)).roots = (σ s).roots.map γ) + (hβ_sim : ∀ s ∈ S.edges, Simulated (P.restrict (σ s)) (P'.restrict (σ' (βf s)))) : + Simulated P P' := by + classical + have hα_ends' : ∀ e ∈ (σ S.root).edgeSet, e ∉ P.dom → + ∀ v ∈ P.G.ends e, γ v ∈ P'.G.ends (αe e) := by + intro e he hnd v hv + rw [← hα_ends e he hnd] + exact ⟨v, hv, rfl⟩ + obtain ⟨ζv, ζe, hζ, _⟩ := + theorem_8_2_subset hP' hstar htd hstar' htd' hγ_bij.mapsTo hγ_bij.injOn hγ_roots + hα_maps hα_inj hα_dom hα_μ hα_ends' hα_φ hβ_bij.mapsTo hβ_bij.injOn hβ_roots hβ_sim + S.edges subset_rfl + have himg : S.edges.image βf = S'.edges := by + apply Finset.coe_injective + rw [Finset.coe_image] + exact hβ_bij.image_eq + rw [himg, cross_edges_of_isTreeDecomposition htd, cross_edges_of_isTreeDecomposition htd'] at hζ + exact ⟨ζv, ζe, hζ.congr (Patchwork.agrees_restrict_self P) (Patchwork.agrees_restrict_self P')⟩ + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/Patchwork/VerifyAxioms.lean b/LeanPool/GraphMinor/GM04/Patchwork/VerifyAxioms.lean new file mode 100644 index 0000000000..9b1311a629 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Patchwork/VerifyAxioms.lean @@ -0,0 +1,973 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Axioms +public import LeanPool.GraphMinor.GM04.Patchwork.StarWQO +import LeanPool.GraphMinor.GM04.Patchwork.Menger +import LeanPool.GraphMinor.GM04.Patchwork.Expansion +import LeanPool.GraphMinor.GM04.Patchwork.Stars +import Mathlib.Data.Fintype.Pigeonhole + +/-! +# Verifying the axioms for robust patchworks (Graph Minors IV, Section 9) + +This file formalizes Section 9 of Graph Minors IV (pages 251–252): +given a sequence `P : ℕ → Patchwork Ω α β` of mutually disjoint robust `Ω`-patchworks, we define +the class `ℛ` (`patchworkClass P`), the induced patchwork `P(G)` (`inducedPatchwork P G`), and the +simulation relation (`patchworkSim P`), verify `Axiom1`, `Axiom2`, `Axiom3`, and `Axiom4 ι` (for +every tree vertex type `ι`), and deduce (9.1) (`theorem_9_1`) from `(5.3)` (`Theorem53Statement`). +-/ + +@[expose] public section + +namespace GraphMinor.GM04 + +open SimpleGraph _root_.GraphMinor.Hypergraph + +universe u v w u₁ u₂ + +variable {Ω : Type w} [Preorder Ω] {α : Type u} {β : Type v} {ι : Type*} + +/-! ### Restriction of a robust patchwork and `Patchwork.Agrees` equivalence -/ + +omit [Preorder Ω] in +open Classical in +theorem Patchwork.IsRobust.restrict {P : Patchwork Ω α β} (hP : P.IsRobust) + (G' : RootedHypergraph α β) : (P.restrict G').IsRobust := by + intro e he + dsimp only [Patchwork.restrict] + split_ifs with h + · exact hP e h.1 + · have hfin : (G'.ends e).Finite := + G'.vertexSet_finite.subset fun _ hv ↦ G'.vertex_mem_of_inc hv + exact Patch.IsFree.isRobust hfin (freePatch_isFree (G'.ends e)) + +omit [Preorder Ω] in +open Classical in +theorem Patchwork.Agrees.rfl (P : Patchwork Ω α β) : P.Agrees P := + ⟨Eq.refl _, Eq.refl _, fun _ _ ↦ Eq.refl _, fun _ _ ↦ Eq.refl _, fun _ _ ↦ Eq.refl _⟩ + +omit [Preorder Ω] in +open Classical in +theorem Patchwork.Agrees.trans {P₁ P₂ P₃ : Patchwork Ω α β} + (h₁₂ : P₁.Agrees P₂) (h₂₃ : P₂.Agrees P₃) : P₁.Agrees P₃ := + ⟨h₁₂.G_eq.trans h₂₃.G_eq, h₁₂.dom_eq.trans h₂₃.dom_eq, + fun e he ↦ (h₁₂.μ_eq e he).trans (h₂₃.μ_eq e (h₁₂.G_eq ▸ he)), + fun e he ↦ (h₁₂.Δ_eq e he).trans (h₂₃.Δ_eq e (h₁₂.G_eq ▸ he)), + fun e he ↦ (h₁₂.φ_eq e he).trans (h₂₃.φ_eq e (h₁₂.G_eq ▸ he))⟩ + +/-! ### The class `ℛ`, induced patchwork `P(G)`, and simulation relation (Section 9, page 251) -/ + +open Classical in +/-- Graph Minors IV, Section 9 (page 251): +"Let $\mathscr{R}$ be the set of all rooted hypergraphs $G$ such that $G^- \subseteq G_i^-$ +for some $i$." -/ +def patchworkClass (P : ℕ → Patchwork Ω α β) : Set (RootedHypergraph α β) := + {G | ∃ i, G.toHypergraph ≤ (P i).G.toHypergraph} + +open Classical in +/-- Chosen index `i` with `G⁻ ⊆ Gᵢ⁻` when `G ∈ patchworkClass P` (and `0` otherwise). -/ +noncomputable def inducedIndex (P : ℕ → Patchwork Ω α β) (G : RootedHypergraph α β) : ℕ := + if h : ∃ i, G.toHypergraph ≤ (P i).G.toHypergraph then h.choose else 0 + +open Classical in +/-- Graph Minors IV, Section 9 (page 251): +"For each $G \in \mathscr{R}$ we define $P(G)$ to be $P_i \mid G$ where $G^- \subseteq +G_i^-$. (This is well-defined since such a value of $i$ is unique unless $G$ is null.)" -/ +noncomputable def inducedPatchwork (P : ℕ → Patchwork Ω α β) (G : RootedHypergraph α β) : + Patchwork Ω α β := + (P (inducedIndex P G)).restrict G + +open Classical in +/-- Graph Minors IV, Section 9 (page 251): +"Let us say that $G \in \mathscr{R}$ is simulated in $G' \in \mathscr{R}$ if $P(G)$ is +simulated in $P(G')$." -/ +def patchworkSim (P : ℕ → Patchwork Ω α β) (G G' : RootedHypergraph α β) : Prop := + Simulated (inducedPatchwork P G) (inducedPatchwork P G') + +omit [Preorder Ω] in +open Classical in +@[simp] +theorem inducedPatchwork_G (P : ℕ → Patchwork Ω α β) (G : RootedHypergraph α β) : + (inducedPatchwork P G).G = G := rfl + +omit [Preorder Ω] in +open Classical in +theorem inducedIndex_spec {P : ℕ → Patchwork Ω α β} {G : RootedHypergraph α β} + (hG : G ∈ patchworkClass P) : + G.toHypergraph ≤ (P (inducedIndex P G)).G.toHypergraph := by + have hG' : ∃ i, G.toHypergraph ≤ (P i).G.toHypergraph := hG + dsimp only [inducedIndex] + rw [dite_eq_left_of_eq_true (eq_true hG')] + exact hG'.choose_spec + +omit [Preorder Ω] in +open Classical in +theorem inducedPatchwork_isRobust {P : ℕ → Patchwork Ω α β} (hrob : ∀ i, (P i).IsRobust) + (G : RootedHypergraph α β) : (inducedPatchwork P G).IsRobust := + (hrob (inducedIndex P G)).restrict G + +omit [Preorder Ω] in +open Classical in +theorem inducedPatchwork_isRemovable {P : ℕ → Patchwork Ω α β} (hrob : ∀ i, (P i).IsRobust) + (G : RootedHypergraph α β) : (inducedPatchwork P G).IsRemovable := + (inducedPatchwork_isRobust hrob G).isRemovable + +omit [Preorder Ω] in +open Classical in +theorem agrees_restrict_of_edgeSet_eq_empty (P₁ P₂ : Patchwork Ω α β) + {G : RootedHypergraph α β} (hE : G.edgeSet = ∅) : + (P₁.restrict G).Agrees (P₂.restrict G) := by + refine ⟨rfl, ?_, ?_, ?_, ?_⟩ + · simp [Patchwork.restrict, hE] + · intro e he + have heE : e ∈ G.edgeSet := he + rw [hE] at heE + exact False.elim heE + · intro e he + have heE : e ∈ G.edgeSet := he + rw [hE] at heE + exact False.elim heE + · intro e he + have heE : e ∈ G.edgeSet := he + rw [hE] at heE + exact False.elim heE + +omit [Preorder Ω] in +open Classical in +theorem inducedPatchwork_agrees {P : ℕ → Patchwork Ω α β} + (hdisj : Pairwise fun i j ↦ Disjoint (P i).G.edgeSet (P j).G.edgeSet) + {i : ℕ} {G : RootedHypergraph α β} (hG : G.toHypergraph ≤ (P i).G.toHypergraph) : + (inducedPatchwork P G).Agrees ((P i).restrict G) := by + have hmem : G ∈ patchworkClass P := ⟨i, hG⟩ + let j := inducedIndex P G + have hj : G.toHypergraph ≤ (P j).G.toHypergraph := inducedIndex_spec hmem + by_cases hij : j = i + · subst hij + exact Patchwork.Agrees.rfl _ + · have hE : G.edgeSet = ∅ := by + rw [Set.eq_empty_iff_forall_notMem] + intro e he + exact Set.disjoint_left.mp (hdisj hij) (hj.edgeSet_subset he) (hG.edgeSet_subset he) + exact agrees_restrict_of_edgeSet_eq_empty (P j) (P i) hE + +omit [Preorder Ω] in +open Classical in +theorem inducedPatchwork_self_agrees {P : ℕ → Patchwork Ω α β} + (hdisj : Pairwise fun i j ↦ Disjoint (P i).G.edgeSet (P j).G.edgeSet) (i : ℕ) : + (inducedPatchwork P (P i).G).Agrees (P i) := + (inducedPatchwork_agrees hdisj (le_refl (P i).G.toHypergraph)).trans + (Patchwork.agrees_restrict_self (P i)) + +omit [Preorder Ω] in +open Classical in +theorem inducedPatchwork_restrict_agrees {P : ℕ → Patchwork Ω α β} + (hdisj : Pairwise fun i j ↦ Disjoint (P i).G.edgeSet (P j).G.edgeSet) + {G H : RootedHypergraph α β} (hG : G ∈ patchworkClass P) + (hHG : H.toHypergraph ≤ G.toHypergraph) : + (inducedPatchwork P H).Agrees ((inducedPatchwork P G).restrict H) := by + let i := inducedIndex P G + have hi : G.toHypergraph ≤ (P i).G.toHypergraph := inducedIndex_spec hG + have hHi : H.toHypergraph ≤ (P i).G.toHypergraph := hHG.trans hi + exact (inducedPatchwork_agrees hdisj hHi).trans + (Patchwork.agrees_restrict_restrict hi hHG).symm + +/-! ### Verification of Axioms 1 and 2 (Section 9, page 251) -/ + +omit [Preorder Ω] in +open Classical in +/-- Graph Minors IV, Section 9, Axiom 1 (page 251): +"Axiom 1. This is clear from the definition of $\mathscr{R}$." -/ +theorem axiom1_patchwork (P : ℕ → Patchwork Ω α β) : + Axiom1 (patchworkClass P) := by + intro G ⟨i, hi⟩ H hHG + exact ⟨i, hHG.trans hi⟩ + +open Classical in +/-- Graph Minors IV, Section 9, Axiom 2 (page 251): +"Axiom 2. This is immediate from (7.1)." -/ +theorem axiom2_patchwork (P : ℕ → Patchwork Ω α β) : + Axiom2 (patchworkClass P) (patchworkSim P) := + ⟨fun G _ ↦ Simulated.refl (inducedPatchwork P G), + fun _ _ _ _ _ _ h₁₂ h₂₃ ↦ h₁₂.trans h₂₃⟩ + +/-! ### Verification of Axiom 3 (Section 9, pages 251–252) -/ + +omit [Preorder Ω] in +open Classical in +theorem sup_emptySubgraph_reachable_iff (H : (⊤ : SimpleGraph α).Subgraph) (V : Set α) + (a b : (H ⊔ emptySubgraph V).verts) : + (H ⊔ emptySubgraph V).coe.Reachable a b ↔ + a = b ∨ ∃ (ha : a.1 ∈ H.verts) (hb : b.1 ∈ H.verts), H.coe.Reachable ⟨a.1, ha⟩ ⟨b.1, hb⟩ := by + rw [reachable_iff_reflTransGen] + constructor + · intro h + induction h with + | refl => exact Or.inl rfl + | @tail y z _ hyz ih => + have hyz_H : H.Adj y.1 z.1 := by + rcases hyz with hyz | hyz + · exact hyz + · exact False.elim hyz + have hy : y.1 ∈ H.verts := H.edge_vert hyz_H + have hz : z.1 ∈ H.verts := H.edge_vert hyz_H.symm + have hstep : H.coe.Reachable ⟨y.1, hy⟩ ⟨z.1, hz⟩ := Adj.reachable hyz_H + rcases ih with rfl | ⟨ha, hy', hry⟩ + · exact Or.inr ⟨hy, hz, hstep⟩ + · exact Or.inr ⟨ha, hz, hry.trans hstep⟩ + · rintro (rfl | ⟨ha, hb, hr⟩) + · exact Relation.ReflTransGen.refl + · rw [reachable_iff_reflTransGen] at hr + suffices ∀ (x y : H.verts), Relation.ReflTransGen H.coe.Adj x y → + ∀ (hx : x.1 ∈ (H ⊔ emptySubgraph V).verts) (hy : y.1 ∈ (H ⊔ emptySubgraph V).verts), + Relation.ReflTransGen (H ⊔ emptySubgraph V).coe.Adj ⟨x.1, hx⟩ ⟨y.1, hy⟩ from + this ⟨a.1, ha⟩ ⟨b.1, hb⟩ hr a.2 b.2 + intro x y hxy + induction hxy with + | refl => + intro _ _ + exact Relation.ReflTransGen.refl + | @tail u w _ huw ih => + intro hx hw + have hu : u.1 ∈ (H ⊔ emptySubgraph V).verts := Or.inl u.2 + exact (ih hx hu).tail (Or.inl huw) + +omit [Preorder Ω] in +open Classical in +theorem IsComponent.sup_emptySubgraph {H D : (⊤ : SimpleGraph α).Subgraph} (h : IsComponent H D) + (V : Set α) : IsComponent (H ⊔ emptySubgraph V) D := by + obtain ⟨x, rfl⟩ := h + let x' : (H ⊔ emptySubgraph V).verts := ⟨x.1, Or.inl x.2⟩ + refine ⟨x', ?_⟩ + have hverts : componentVerts H x = componentVerts (H ⊔ emptySubgraph V) x' := by + ext w + simp only [mem_componentVerts_iff] + constructor + · rintro ⟨hw, hr⟩ + refine ⟨Or.inl hw, (sup_emptySubgraph_reachable_iff H V x' ⟨w, Or.inl hw⟩).mpr ?_⟩ + exact Or.inr ⟨x.2, hw, hr⟩ + · rintro ⟨hw, hr⟩ + rcases (sup_emptySubgraph_reachable_iff H V x' ⟨w, hw⟩).mp hr with hEq | ⟨_, hwH, hrH⟩ + · have hwx : w = x.1 := congrArg Subtype.val hEq.symm + subst hwx + exact ⟨x.2, Reachable.refl x⟩ + · exact ⟨hwH, hrH⟩ + ext u v + · exact (congrArg (u ∈ ·) hverts).to_iff + · simp [component, hverts, emptySubgraph] + +omit [Preorder Ω] in +open Classical in +theorem component_sup_emptySubgraph_verts_of_notMem (H : (⊤ : SimpleGraph α).Subgraph) + {V : Set α} {u : α} (huV : u ∈ V) (huH : u ∉ H.verts) : + (component (H ⊔ emptySubgraph V) ⟨u, Or.inr huV⟩).verts = {u} := by + ext w + simp only [component_verts, mem_componentVerts_iff, Set.mem_singleton_iff] + constructor + · rintro ⟨hw, hr⟩ + rcases (sup_emptySubgraph_reachable_iff H V ⟨u, Or.inr huV⟩ ⟨w, hw⟩).mp hr with hEq | ⟨huH', _, + _⟩ + · exact congrArg Subtype.val hEq.symm + · exact False.elim (huH huH') + · rintro rfl + exact ⟨Or.inr huV, Reachable.refl _⟩ + +omit [Preorder Ω] in +open Classical in +/-- Gluing a separation `(J₁, J₂)` of `G₂⁻` with `V(G₁⁻ ∩ G₂⁻) ⊆ V(J₁)` and `πBar(G₂) ⊆ V(J₂)` to +`G₁` yields a separation `(G₁⁻ ∪ J₁, J₂)` of `G` with the same order as `(J₁, J₂)` +(Graph Minors IV, Section 9, pages 251–252). -/ +private theorem sep_G2_ge_of_min {G G₁ G₂ : RootedHypergraph α β} + (hsep : G.IsSeparation G₁ G₂) + (hmin : ¬ ∃ H₁ H₂ : RootedHypergraph α β, G.IsSeparation H₁ H₂ ∧ + G₁.toHypergraph ≤ H₁.toHypergraph ∧ + separationOrder H₁.toHypergraph H₂.toHypergraph < G.roots.length) + {J₁ J₂ : Hypergraph α β} (hJ : G₂.toHypergraph.IsSeparation J₁ J₂) + (hX_sub : (G₁.toHypergraph ∩ G₂.toHypergraph).vertexSet ⊆ J₁.vertexSet) + (hY_sub : G₂.rootSet ⊆ J₂.vertexSet) : + G.roots.length ≤ separationOrder J₁ J₂ := by + by_contra! hlt + have hle₁ : G₁.toHypergraph ∪ J₁ ≤ G.toHypergraph := by + have hJ₁_G : J₁ ≤ G.toHypergraph := hJ.left_le.trans hsep.isSeparation.right_le + refine ⟨Set.union_subset hsep.isSeparation.left_le.vertexSet_subset hJ₁_G.vertexSet_subset, + Set.union_subset hsep.isSeparation.left_le.edgeSet_subset hJ₁_G.edgeSet_subset, ?_⟩ + rintro e (he₁ | heJ) + · ext v + simp only [Hypergraph.ends, Set.mem_ofPred_eq] + constructor + · intro hv + left + have hEq := hsep.isSeparation.left_le.ends_eq e he₁ + exact (congrArg (v ∈ ·) hEq).mp hv + · rintro (hv₁ | hvJ) + · have hEq := hsep.isSeparation.left_le.ends_eq e he₁ + exact (congrArg (v ∈ ·) hEq).mpr hv₁ + · have hEq := hJ₁_G.ends_eq e (J₁.edge_mem_of_inc hvJ) + exact (congrArg (v ∈ ·) hEq).mpr hvJ + · ext v + simp only [Hypergraph.ends, Set.mem_ofPred_eq] + constructor + · intro hv + right + have hEq := hJ₁_G.ends_eq e heJ + exact (congrArg (v ∈ ·) hEq).mp hv + · rintro (hv₁ | hvJ) + · have hEq := hsep.isSeparation.left_le.ends_eq e (G₁.edge_mem_of_inc hv₁) + exact (congrArg (v ∈ ·) hEq).mpr hv₁ + · have hEq := hJ₁_G.ends_eq e heJ + exact (congrArg (v ∈ ·) hEq).mpr hvJ + have hle₂ : J₂ ≤ G.toHypergraph := hJ.right_le.trans hsep.isSeparation.right_le + have hunion : (G₁.toHypergraph ∪ J₁) ∪ J₂ = G.toHypergraph := by + have hassoc : (G₁.toHypergraph ∪ J₁) ∪ J₂ = G₁.toHypergraph ∪ (J₁ ∪ J₂) := by + ext : 1 + · exact Set.union_assoc _ _ _ + · exact Set.union_assoc _ _ _ + · ext e v + exact or_assoc + rw [hassoc, hJ.union_eq, hsep.isSeparation.union_eq] + have hedge_inter : ((G₁.toHypergraph ∪ J₁) ∩ J₂).edgeSet = ∅ := by + rw [Set.eq_empty_iff_forall_notMem] + rintro e ⟨he₁ | heJ₁, heJ₂⟩ + · have he₂ : e ∈ G₂.edgeSet := hJ.right_le.edgeSet_subset heJ₂ + have he_inter : e ∈ (G₁.toHypergraph ∩ G₂.toHypergraph).edgeSet := ⟨he₁, he₂⟩ + rw [hsep.isSeparation.edgeSet_inter_eq] at he_inter + exact he_inter + · have he_inter : e ∈ (J₁ ∩ J₂).edgeSet := ⟨heJ₁, heJ₂⟩ + rw [hJ.edgeSet_inter_eq] at he_inter + exact he_inter + have hvert_inter : ((G₁.toHypergraph ∪ J₁) ∩ J₂).vertexSet = (J₁ ∩ J₂).vertexSet := by + ext v + constructor + · rintro ⟨hv₁ | hvJ₁, hvJ₂⟩ + · have hv₂ : v ∈ G₂.vertexSet := hJ.right_le.vertexSet_subset hvJ₂ + exact ⟨hX_sub ⟨hv₁, hv₂⟩, hvJ₂⟩ + · exact ⟨hvJ₁, hvJ₂⟩ + · rintro ⟨hvJ₁, hvJ₂⟩ + exact ⟨Or.inr hvJ₁, hvJ₂⟩ + let S := ((G₁.toHypergraph ∪ J₁) ∩ J₂).vertexSet + have hS_fin : S.Finite := ((G₁.toHypergraph ∪ J₁) ∩ J₂).vertexSet_finite + let H₁ : RootedHypergraph α β := + { toHypergraph := G₁.toHypergraph ∪ J₁ + roots := hS_fin.toFinset.toList + roots_nodup := Finset.nodup_toList _ + roots_subset := fun v hv ↦ by + rw [Finset.mem_toList, Set.Finite.mem_toFinset] at hv + exact hv.1 } + let H₂ : RootedHypergraph α β := + { toHypergraph := J₂ + roots := G.roots + roots_nodup := G.roots_nodup + roots_subset := fun v hv ↦ by + rw [← hsep.roots_right] at hv + exact hY_sub hv } + have hH_sep : G.IsSeparation H₁ H₂ := by + refine ⟨⟨hle₁, hle₂, hunion, hedge_inter⟩, rfl, ?_⟩ + ext v + simp [H₁, H₂, RootedHypergraph.rootSet, S] + have hG₁_le_H₁ : G₁.toHypergraph ≤ H₁.toHypergraph := by + refine ⟨Set.subset_union_left, Set.subset_union_left, fun e he ↦ ?_⟩ + ext v + simp only [H₁, Hypergraph.ends, Set.mem_ofPred_eq] + refine ⟨fun h ↦ ?_, Or.inl⟩ + rcases h with h | hJ₁ + · exact h + · have hG := (hJ.left_le.trans hsep.isSeparation.right_le).ends_eq e (J₁.edge_mem_of_inc hJ₁) + have hG₁ := hsep.isSeparation.left_le.ends_eq e he + exact (congrArg (v ∈ ·) (hG₁.symm.trans hG)).mpr hJ₁ + have hord_eq : separationOrder H₁.toHypergraph H₂.toHypergraph = separationOrder J₁ J₂ := by + dsimp only [separationOrder, H₁, H₂] + rw [hvert_inter] + exact hmin ⟨H₁, H₂, hH_sep, hG₁_le_H₁, hord_eq.symm ▸ hlt⟩ + +open Classical in +/-- Index the disjoint components by the roots they contain, retaining a vertex in the +separator for each component. -/ +private theorem reindex_components_by_roots {G G₂ : RootedHypergraph α β} + {H : (⊤ : SimpleGraph α).Subgraph} {X : Set α} + {D : Fin G.roots.length → (⊤ : SimpleGraph α).Subgraph} + (hroots : G₂.roots = G.roots) (hD_inj : Function.Injective D) + (hD_spec : ∀ j, IsComponent H (D j) ∧ + ((D j).verts ∩ X).Nonempty ∧ ((D j).verts ∩ G₂.rootSet).Nonempty) : + ∃ (C : Fin G.roots.length → (⊤ : SimpleGraph α).Subgraph) + (v : Fin G.roots.length → α), + (∀ i, IsComponent H (C i)) ∧ Function.Injective C ∧ + (∀ i, G.roots[i.1]'i.2 ∈ (C i).verts) ∧ + (∀ i, v i ∈ (C i).verts) ∧ (∀ i, v i ∈ X) := by + let k := G.roots.length + let yOf (j : Fin k) : α := ((hD_spec j).2.2).choose + have hyOf_D : ∀ j : Fin k, yOf j ∈ (D j).verts := fun j ↦ ((hD_spec j).2.2).choose_spec.1 + have hyOf_Y : ∀ j : Fin k, yOf j ∈ G.roots := by + intro j + rw [← hroots] + exact ((hD_spec j).2.2).choose_spec.2 + let idxOf (j : Fin k) : Fin k := + ⟨G.roots.idxOf (yOf j), List.idxOf_lt_length_of_mem (hyOf_Y j)⟩ + have hidxOf_get : ∀ j : Fin k, G.roots[(idxOf j).1]'(idxOf j).2 = yOf j := + fun j ↦ List.getElem_idxOf (idxOf j).2 + have hidxOf_inj : Function.Injective idxOf := by + intro j₁ j₂ hEq + have hyEq : yOf j₁ = yOf j₂ := by + rw [← hidxOf_get j₁, ← hidxOf_get j₂] + exact congrArg (fun m : Fin k ↦ G.roots[m.1]'m.2) hEq + have hDEq : D j₁ = D j₂ := + (hD_spec j₁).1.eq_of_mem (hD_spec j₂).1 (hyOf_D j₁) (hyEq ▸ hyOf_D j₂) + exact hD_inj hDEq + have hidxOf_bij : Function.Bijective idxOf := + (Fintype.bijective_iff_injective_and_card idxOf).mpr ⟨hidxOf_inj, rfl⟩ + let eIdx : Fin k ≃ Fin k := Equiv.ofBijective idxOf hidxOf_bij + let C (i : Fin k) : (⊤ : SimpleGraph α).Subgraph := D (eIdx.symm i) + have hC_comp : ∀ i : Fin k, IsComponent H (C i) := fun i ↦ (hD_spec (eIdx.symm i)).1 + have hC_inj : Function.Injective C := hD_inj.comp eIdx.symm.injective + have hC_root : ∀ i : Fin k, G.roots[i.1]'i.2 ∈ (C i).verts := by + intro i + have h1 : idxOf (eIdx.symm i) = i := eIdx.apply_symm_apply i + have h2 : G.roots[i.1]'i.2 = yOf (eIdx.symm i) := + (congrArg (fun m : Fin k ↦ G.roots[m.1]'m.2) h1).symm.trans (hidxOf_get (eIdx.symm i)) + rw [h2] + exact hyOf_D (eIdx.symm i) + let v (i : Fin k) : α := ((hD_spec (eIdx.symm i)).2.1).choose + have hv_C : ∀ i : Fin k, v i ∈ (C i).verts := fun i ↦ ((hD_spec (eIdx.symm i)).2.1).choose_spec.1 + have hv_X : ∀ i : Fin k, v i ∈ X := fun i ↦ ((hD_spec (eIdx.symm i)).2.1).choose_spec.2 + exact ⟨C, v, hC_comp, hC_inj, hC_root, hv_C, hv_X⟩ + +open Classical in +/-- Graph Minors IV, Section 9, Axiom 3 (pages 251–252): +verification of Axiom 3 for `patchworkClass P` and `patchworkSim P`. -/ +theorem axiom3_patchwork (hM : MengerStatement.{u, v}) {P : ℕ → Patchwork Ω α β} + (hdisj : Pairwise fun i j ↦ Disjoint (P i).G.edgeSet (P j).G.edgeSet) + (hrob : ∀ i, (P i).IsRobust) : + Axiom3 (patchworkClass P) (patchworkSim P) := by + intro G hG G₁ G₂ hsep hord hmin + let Q := inducedPatchwork P G + let Q₂ := Q.restrict G₂ + have hQ_rob : Q.IsRobust := inducedPatchwork_isRobust hrob G + have hQ₂_rob : Q₂.IsRobust := hQ_rob.restrict G₂ + let X := (G₁.toHypergraph ∩ G₂.toHypergraph).vertexSet + let Y := G₂.rootSet + let k := G.roots.length + have hX_sub : X ⊆ G₂.vertexSet := Set.inter_subset_right + have hY_sub : Y ⊆ G₂.vertexSet := fun v hv ↦ G₂.roots_subset v hv + have hcond1 : Theorem61Cond1 Q₂ X Y k := + fun J₁ J₂ hJ hJ₁ hJ₂ ↦ sep_G2_ge_of_min hsep hmin hJ hJ₁ hJ₂ + have hcond2 : Theorem61Cond2 Q₂ X Y k := + ((theorem_6_1_proof hM hQ₂_rob hX_sub hY_sub k).1.mp hcond1) + obtain ⟨H, D, hH_real, hD_inj, hD_spec⟩ := hcond2 + have hH_verts : H.verts = G₂.vertexSet := hH_real.verts_eq + obtain ⟨C, v, hC_comp, hC_inj, hC_root, hv_C, hv_X⟩ := + reindex_components_by_roots hsep.roots_right hD_inj hD_spec + have hv_inj : Function.Injective v := by + intro i₁ i₂ hEq + have hCEq : C i₁ = C i₂ := + (hC_comp i₁).eq_of_mem (hC_comp i₂) (hv_C i₁) (hEq ▸ hv_C i₂) + exact hC_inj hCEq + have hrange_v : Set.range v = X := by + have hsub : Set.range v ⊆ X := Set.range_subset_iff.mpr hv_X + have hcard_range : (Set.range v).ncard = k := by + rw [Set.ncard_range_of_injective hv_inj, Nat.card_eq_fintype_card, Fintype.card_fin] + have hX_fin : X.Finite := (G₁.toHypergraph ∩ G₂.toHypergraph).vertexSet_finite + have hX_le : X.ncard ≤ (Set.range v).ncard := by + rw [hcard_range] + exact hord.le + exact Set.eq_of_subset_of_ncard_le hsub hX_le hX_fin + let π₁ : List α := List.ofFn v + have hπ₁_len : π₁.length = k := List.length_ofFn + have hπ₁_nodup : π₁.Nodup := List.nodup_ofFn.mpr hv_inj + have hπ₁_set : {w | w ∈ π₁} = X := by + ext w + simp [π₁, ← hrange_v] + let H₁ : RootedHypergraph α β := + { toHypergraph := G₁.toHypergraph + roots := π₁ + roots_nodup := hπ₁_nodup + roots_subset := fun w hw ↦ by + have hwX : w ∈ X := hπ₁_set ▸ hw + exact hwX.1 } + have hH₁_rootSet : H₁.rootSet = G₁.rootSet := by + change {w | w ∈ π₁} = G₁.rootSet + rw [hπ₁_set, hsep.rootSet_left] + refine ⟨H₁, rfl, hH₁_rootSet, ?_⟩ + let Q₁ := Q.restrict H₁ + have hH₁_le : H₁.toHypergraph ≤ Q.G.toHypergraph := hsep.isSeparation.left_le + have hQ₁_agrees : (inducedPatchwork P H₁).Agrees Q₁ := + inducedPatchwork_restrict_agrees hdisj hG hH₁_le + have hQ_rfl : Q.Agrees Q := ⟨rfl, rfl, fun _ _ ↦ rfl, fun _ _ ↦ rfl, fun _ _ ↦ rfl⟩ + let ηv (u : α) : Set α := + if h : ∃ i : Fin k, v i = u then (C h.choose).verts else {u} + have hηv_v : ∀ i : Fin k, ηv (v i) = (C i).verts := by + intro i + have h : ∃ j : Fin k, v j = v i := ⟨i, rfl⟩ + dsimp only [ηv] + rw [dite_eq_left_of_eq_true (eq_true h)] + rw [hv_inj h.choose_spec] + have hηv_not_X : ∀ u ∉ X, ηv u = {u} := by + intro u hu + have hnot : ¬∃ i : Fin k, v i = u := by + rw [← Set.mem_range, hrange_v] + exact hu + dsimp only [ηv] + exact dite_eq_right_of_eq_false (eq_false hnot) + have hself_mem_ηv : ∀ u : α, u ∈ ηv u := by + intro u + by_cases h : ∃ i : Fin k, v i = u + · obtain ⟨i, rfl⟩ := h + rw [hηv_v i] + exact hv_C i + · dsimp only [ηv] + rw [dite_eq_right_of_eq_false (eq_false h)] + exact Set.mem_singleton u + have hC_sub_G₂ : ∀ i : Fin k, (C i).verts ⊆ G₂.vertexSet := + fun i ↦ hH_verts ▸ (hC_comp i).le.1 + have hηv_sub_G : ∀ u ∈ G₁.vertexSet, ηv u ⊆ G.vertexSet := by + intro u hu + by_cases h : ∃ i : Fin k, v i = u + · obtain ⟨i, rfl⟩ := h + rw [hηv_v i] + exact (hC_sub_G₂ i).trans hsep.isSeparation.right_le.vertexSet_subset + · dsimp only [ηv] + rw [dite_eq_right_of_eq_false (eq_false h)] + exact Set.singleton_subset_iff.mpr (hsep.isSeparation.left_le.vertexSet_subset hu) + have hηv_disj : ∀ u₁ ∈ G₁.vertexSet, ∀ u₂ ∈ G₁.vertexSet, u₁ ≠ u₂ → + Disjoint (ηv u₁) (ηv u₂) := by + intro u₁ hu₁ u₂ hu₂ hne + by_cases h₁ : ∃ i : Fin k, v i = u₁ <;> by_cases h₂ : ∃ i : Fin k, v i = u₂ + · obtain ⟨i₁, rfl⟩ := h₁ + obtain ⟨i₂, rfl⟩ := h₂ + rw [hηv_v i₁, hηv_v i₂] + have hne_i : i₁ ≠ i₂ := fun hEq ↦ hne (congrArg v hEq) + exact (hC_comp i₁).disjoint_verts_of_ne (hC_comp i₂) (fun hCEq ↦ hne_i (hC_inj hCEq)) + · obtain ⟨i₁, rfl⟩ := h₁ + have hu₂_notX : u₂ ∉ X := by rwa [← hrange_v] + rw [hηv_v i₁, hηv_not_X u₂ hu₂_notX, Set.disjoint_singleton_right] + intro hu₂_C + exact hu₂_notX ⟨hu₂, hC_sub_G₂ i₁ hu₂_C⟩ + · obtain ⟨i₂, rfl⟩ := h₂ + have hu₁_notX : u₁ ∉ X := by rwa [← hrange_v] + rw [hηv_not_X u₁ hu₁_notX, hηv_v i₂, Set.disjoint_singleton_left] + intro hu₁_C + exact hu₁_notX ⟨hu₁, hC_sub_G₂ i₂ hu₁_C⟩ + · have hu₁_notX : u₁ ∉ X := by rwa [← hrange_v] + have hu₂_notX : u₂ ∉ X := by rwa [← hrange_v] + rw [hηv_not_X u₁ hu₁_notX, hηv_not_X u₂ hu₂_notX, Set.disjoint_singleton] + exact hne + have hexp : IsExpansion Q₁ Q ηv id := by + refine ⟨fun u _ ↦ ⟨u, hself_mem_ηv u⟩, hηv_sub_G, + fun e he ↦ hH₁_le.edgeSet_subset he, hηv_disj, Set.injOn_id _, + ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro e he + rw [Q.restrict_dom hH₁_le] + exact ⟨fun h ↦ h.1, fun h ↦ ⟨h, he⟩⟩ + · intro e he _ u hu + have hu' : Q.G.Inc e u := by + have hEq := hH₁_le.ends_eq e he + exact (congrArg (u ∈ ·) hEq).mpr hu + exact ⟨u, hself_mem_ηv u, hu'⟩ + · intro e _ + rfl + · intro e _ i hi₁ _ + exact hself_mem_ηv ((Q.μ e)[i]'hi₁) + · exact hπ₁_len + · intro i hi₁ hi' + have hget : Q₁.G.roots[i]'hi₁ = v ⟨i, hi'⟩ := by simp [Q₁, Patchwork.restrict, H₁, π₁] + rw [hget, hηv_v ⟨i, hi'⟩] + exact hC_root ⟨i, hi'⟩ + · intro e hd δ hδ + have hd_H₁ : e ∈ H₁.edgeSet := Q₁.dom_subset hd + have hd_Q : e ∈ Q.dom := (Q.restrict_dom hH₁_le ▸ hd).1 + have hδ_Q : δ ∈ (Q.Δ e).groupings := by + rwa [Q.restrict_Δ hH₁_le hd_H₁] at hδ + have hverts : δ.verts ⊆ {w | w ∈ Q.μ e} := by + rw [((Q.Δ e).verts_eq δ hδ_Q).trans (Q.Δ_verts e (Q.dom_subset hd_Q)), Q.μ_set e hd_Q] + change marchMapSubgraph (Q.μ e) (Q.μ e) δ ∈ (Q.Δ e).groupings + rwa [marchMapSubgraph_id hverts] + · intro _ _ + exact le_rfl + have hreal : Realizes Q₁ Q ηv id (H ⊔ emptySubgraph G₁.vertexSet) := by + refine ⟨?_, ?_⟩ + · obtain ⟨δ, hδ, hH_eq⟩ := hH_real + have hE_diff : G.edgeSet \ (id '' H₁.edgeSet) = G₂.edgeSet := by + rw [Set.image_id] + ext e + simp only [Set.mem_sdiff] + constructor + · rintro ⟨heG, he₁⟩ + have hunion : e ∈ G₁.edgeSet ∪ G₂.edgeSet := by + change e ∈ (G₁.toHypergraph ∪ G₂.toHypergraph).edgeSet + rwa [hsep.isSeparation.union_eq] + exact hunion.resolve_left he₁ + · intro he₂ + refine ⟨hsep.isSeparation.right_le.edgeSet_subset he₂, fun he₁ ↦ ?_⟩ + have he_inter : e ∈ (G₁.toHypergraph ∩ G₂.toHypergraph).edgeSet := ⟨he₁, he₂⟩ + rw [hsep.isSeparation.edgeSet_inter_eq] at he_inter + exact he_inter + have hδ' : ∀ e ∈ (Q.deleteEdges (id '' H₁.edgeSet)).G.edgeSet, + δ e ∈ (Q.deleteEdges (id '' H₁.edgeSet)).Δ e := by + intro e he + have he₂ : e ∈ G₂.edgeSet := hE_diff ▸ he + have hδe := hδ e he₂ + rwa [Q.restrict_Δ hsep.isSeparation.right_le he₂] at hδe + have hreal' : (Q.deleteEdges (id '' H₁.edgeSet)).IsRealization + (realizationOf (Q.deleteEdges (id '' H₁.edgeSet)).G.toHypergraph δ) := + ⟨δ, hδ', rfl⟩ + refine ⟨δ, hδ', ?_⟩ + ext x y + · have hverts1 : (H ⊔ emptySubgraph G₁.vertexSet).verts = G.vertexSet := by + rw [Subgraph.verts_sup, hH_verts, emptySubgraph_verts, Set.union_comm] + exact isSeparation_vertexSet_union hsep.isSeparation + have hverts2 : (realizationOf (Q.deleteEdges (id '' Q₁.G.edgeSet)).G.toHypergraph δ).verts = + G.vertexSet := hreal'.verts_eq + exact (congrArg (x ∈ ·) (hverts1.trans hverts2.symm)).to_iff + · rw [hH_eq] + change ((emptySubgraph G₂.vertexSet ⊔ ⨆ e ∈ G₂.edgeSet, δ e) ⊔ + emptySubgraph G₁.vertexSet).Adj x y ↔ + (emptySubgraph G.vertexSet ⊔ ⨆ e ∈ G.edgeSet \ (id '' H₁.edgeSet), δ e).Adj x y + rw [hE_diff] + simp [Subgraph.sup_adj, Subgraph.iSup_adj] + · intro u hu + have huG₁ : u ∈ G₁.vertexSet := hu + by_cases h : ∃ i : Fin k, v i = u + · obtain ⟨i, rfl⟩ := h + exact ⟨C i, (hC_comp i).sup_emptySubgraph G₁.vertexSet, (hηv_v i).symm⟩ + · have hu_notX : u ∉ X := by rwa [← hrange_v] + have hu_notH : u ∉ H.verts := by + rw [hH_verts] + intro hu₂ + exact hu_notX ⟨huG₁, hu₂⟩ + refine ⟨component (H ⊔ emptySubgraph G₁.vertexSet) ⟨u, Or.inr huG₁⟩, ⟨_, rfl⟩, ?_⟩ + rw [component_sup_emptySubgraph_verts_of_notMem H huG₁ hu_notH, hηv_not_X u hu_notX] + exact ⟨ηv, id, IsRealizableExpansion.congr hQ₁_agrees.symm hQ_rfl ⟨hexp, _, hreal⟩⟩ + +/-! ### Verification of Axiom 4 (Section 9, page 252) -/ + +omit [Preorder Ω] in +open Classical in +private theorem index_le_of_starClass {P : ℕ → Patchwork Ω α β} {n : ℕ} + {S : RootedTree ι} {σ : ι → RootedHypergraph α β} + (hp : (S, σ) ∈ starClass ι (patchworkClass P) n) : + index S σ ≤ n := by + obtain ⟨⟨hstar, htd⟩, _, hcard⟩ := hp + refine Finset.sup_le fun s hs ↦ ?_ + have hsub : ((σ s).roots.toFinset : Set α) ⊆ (σ S.root).vertexSet := by + intro v hv + rw [Finset.mem_coe, List.mem_toFinset] at hv + by_cases hsr : s = S.root + · subst hsr + exact (σ S.root).roots_subset v hv + · have hs_edge : s ∈ S.edges := Finset.mem_erase.mpr ⟨hsr, hs⟩ + have hv_rootSet : v ∈ (σ s).rootSet := hv + rw [htd.rootSet_edge s hs_edge, hstar s hs_edge] at hv_rootSet + exact hv_rootSet.2 + have hncard : ((σ s).roots.toFinset : Set α).ncard = (σ s).roots.length := by + rw [Set.ncard_coe_finset, List.toFinset_card_of_nodup (σ s).roots_nodup] + rw [← hncard] + exact (Set.ncard_le_ncard hsub (σ S.root).vertexSet_finite).trans hcard + +open Classical in +/-- Graph Minors IV, Section 9, Axiom 4 (page 252): +verification of `Axiom4 ι` for `patchworkClass P` and `patchworkSim P` for every tree vertex type +`ι`. -/ +theorem axiom4_patchwork (hH : Higman83Statement.{u₁, u₂}) (hΩ : WellQuasiOrderedLE Ω) + {P : ℕ → Patchwork Ω α β} + (hdisj : Pairwise fun i j ↦ Disjoint (P i).G.edgeSet (P j).G.edgeSet) + (hrob : ∀ i, (P i).IsRobust) (ι : Type*) : + Axiom4 ι (patchworkClass P) (patchworkSim P) := by + intro n + refine ⟨fun _ hp ↦ hp.1, fun _ hp ↦ hp.2.1, ⟨n, fun _ hp ↦ index_le_of_starClass hp⟩, ?_⟩ + intro x hx hwqo_tips + let S (i : ℕ) : RootedTree ι := (x i).1 + let σ (i : ℕ) : ι → RootedHypergraph α β := (x i).2 + let G (i : ℕ) : RootedHypergraph α β := cross (σ i) (S i).verts (S i).root + let Q (i : ℕ) : Patchwork Ω α β := inducedPatchwork P (G i) + have hrem : ∀ i, (Q i).IsRemovable := fun i ↦ inducedPatchwork_isRemovable hrob (G i) + have hstar : ∀ i, (S i).IsStar := fun i ↦ (hx i).1.1 + have htd : ∀ i, IsTreeDecomposition (Q i).G (S i) (σ i) := fun i ↦ (hx i).1.2 + have hcard : ∀ i, (σ i (S i).root).vertexSet.ncard ≤ n := fun i ↦ (hx i).2.2 + have hwqo : ∀ T : ℕ → Patchwork Ω α β, + (∀ k, ∃ i, ∃ s ∈ (S i).edges, T k = (Q i).restrict (σ i s)) → + ∃ j j', j < j' ∧ Simulated (T j) (T j') := by + intro T hT + let ik (k : ℕ) : ℕ := (hT k).choose + let sk (k : ℕ) : ι := (hT k).choose_spec.choose + have hsk_edge : ∀ k, sk k ∈ (S (ik k)).edges := + fun k ↦ (hT k).choose_spec.choose_spec.1 + have hTk_eq : ∀ k, T k = (Q (ik k)).restrict (σ (ik k) (sk k)) := + fun k ↦ (hT k).choose_spec.choose_spec.2 + have hmem_tips : ∀ k, σ (ik k) (sk k) ∈ ⋃ i, tips (S i) (σ i) := + fun k ↦ Set.mem_iUnion.mpr ⟨ik k, sk k, hsk_edge k, rfl⟩ + obtain ⟨j, j', hlt, hsim⟩ := hwqo_tips (fun k ↦ σ (ik k) (sk k)) hmem_tips + have h_agrees : ∀ k, (inducedPatchwork P (σ (ik k) (sk k))).Agrees (T k) := by + intro k + rw [hTk_eq k] + have hle : (σ (ik k) (sk k)).toHypergraph ≤ (G (ik k)).toHypergraph := + (htd (ik k)).le (sk k) (Finset.mem_of_mem_erase (hsk_edge k)) + exact inducedPatchwork_restrict_agrees hdisj (hx (ik k)).2.1 hle + obtain ⟨ηv, ηe, hη⟩ := hsim + exact ⟨j, j', hlt, ηv, ηe, hη.congr (h_agrees j) (h_agrees j')⟩ + exact theorem_8_4_proof hH hΩ n Q hrem S σ hstar htd hcard hwqo + +/-! ### Graph Minors IV, (9.1) (page 252) -/ + +open Classical in +/-- Graph Minors IV, (9.1) for a sequence of edge-disjoint robust `Ω`-patchworks. -/ +theorem theorem_9_1_disjoint (h53 : Theorem53Statement.{u, v}) (hM : MengerStatement.{u, v}) + (hH : Higman83Statement.{u₁, u₂}) (hΩ : WellQuasiOrderedLE Ω) + (n : ℕ) (P : ℕ → Patchwork Ω α β) + (hdisj : Pairwise fun i j ↦ Disjoint (P i).G.edgeSet (P j).G.edgeSet) + (hrob : ∀ i, (P i).IsRobust) + (htw : ∀ i, TreeWidthLE (P i).G n) : + ∃ i i', i < i' ∧ Simulated (P i) (P i') := by + have hmem : ∀ i, (P i).G ∈ patchworkClass P := fun i ↦ ⟨i, le_rfl⟩ + obtain ⟨i, i', hlt, ηv, ηe, hη⟩ := h53 (patchworkClass P) (patchworkSim P) + (axiom1_patchwork P) (axiom2_patchwork P) (axiom3_patchwork hM hdisj hrob) + (axiom4_patchwork hH hΩ hdisj hrob ℕ) n (fun i ↦ (P i).G) hmem htw + exact ⟨i, i', hlt, ηv, ηe, + hη.congr (inducedPatchwork_self_agrees hdisj i) (inducedPatchwork_self_agrees hdisj i')⟩ + +open Classical in +/-- Tagging the edges of a hypergraph `G` with an index `i : ℕ` so that a sequence of hypergraphs +becomes pairwise edge-disjoint while keeping the same vertex type `α`. -/ +def tagEdgeHypergraph (i : ℕ) (G : Hypergraph α β) : Hypergraph α (ℕ × β) where + vertexSet := G.vertexSet + edgeSet := Prod.mk i '' G.edgeSet + Inc p v := p.1 = i ∧ G.Inc p.2 v + vertex_mem_of_inc _ _ h := G.vertex_mem_of_inc h.2 + edge_mem_of_inc p _ h := ⟨p.2, G.edge_mem_of_inc h.2, Prod.ext h.1.symm rfl⟩ + vertexSet_finite := G.vertexSet_finite + edgeSet_finite := G.edgeSet_finite.image (Prod.mk i) + +open Classical in +/-- Tagging the edges of a rooted hypergraph `G` with `i : ℕ`. -/ +def tagEdgeRooted (i : ℕ) (G : RootedHypergraph α β) : RootedHypergraph α (ℕ × β) where + toHypergraph := tagEdgeHypergraph i G.toHypergraph + roots := G.roots + roots_nodup := G.roots_nodup + roots_subset := G.roots_subset + +omit [Preorder Ω] in +open Classical in +@[simp] +theorem tagEdgeHypergraph_ends (i : ℕ) (G : Hypergraph α β) (e : β) : + (tagEdgeHypergraph i G).ends (i, e) = G.ends e := by + ext v + simp [tagEdgeHypergraph, Hypergraph.ends] + +open Classical in +/-- Tagging the edges of an `Ω`-patchwork `P` with `i : ℕ`. -/ +def tagEdgePatchwork (i : ℕ) (P : Patchwork Ω α β) : Patchwork Ω α (ℕ × β) where + G := tagEdgeRooted i P.G + dom := Prod.mk i '' P.dom + μ p := P.μ p.2 + Δ p := P.Δ p.2 + φ p := P.φ p.2 + dom_subset := Set.image_mono P.dom_subset + μ_nodup := by + rintro _ ⟨e, he, rfl⟩ + exact P.μ_nodup e he + μ_set := by + rintro _ ⟨e, he, rfl⟩ + rw [P.μ_set e he] + exact (tagEdgeHypergraph_ends i P.G.toHypergraph e).symm + Δ_verts := by + rintro _ ⟨e, he, rfl⟩ + rw [P.Δ_verts e he] + exact (tagEdgeHypergraph_ends i P.G.toHypergraph e).symm + Δ_free := by + rintro _ ⟨e, he, rfl⟩ hnd + exact P.Δ_free e he fun hd ↦ hnd ⟨e, hd, rfl⟩ + +omit [Preorder Ω] in +open Classical in +theorem tagEdgePatchwork_disjoint (P : ℕ → Patchwork Ω α β) : + Pairwise fun i j ↦ + Disjoint (tagEdgePatchwork i (P i)).G.edgeSet (tagEdgePatchwork j (P j)).G.edgeSet := by + intro i j hij + rw [Set.disjoint_left] + rintro _ ⟨e₁, _, rfl⟩ ⟨e₂, _, hEq⟩ + exact hij (congrArg Prod.fst hEq).symm + +omit [Preorder Ω] in +open Classical in +theorem tagEdgePatchwork_isRobust {P : Patchwork Ω α β} (hrob : P.IsRobust) (i : ℕ) : + (tagEdgePatchwork i P).IsRobust := by + rintro _ ⟨e, he, rfl⟩ + exact hrob e he + +omit [Preorder Ω] in +open Classical in +theorem tagEdgeRooted_treeWidthLE {G : RootedHypergraph α β} {n : ℕ} + (htw : TreeWidthLE G n) (i : ℕ) : + TreeWidthLE (tagEdgeRooted i G) n := by + obtain ⟨T, τ, htd, hwidth⟩ := htw + refine ⟨T, fun t ↦ tagEdgeRooted i (τ t), ⟨?_, ?_, ?_, ?_, htd.roots_root, htd.rootSet_edge⟩, + hwidth⟩ + · intro t ht + have hle := htd.le t ht + refine ⟨hle.vertexSet_subset, Set.image_mono hle.edgeSet_subset, ?_⟩ + rintro _ ⟨e, he, rfl⟩ + simp only [tagEdgeRooted, tagEdgeHypergraph_ends] + exact hle.ends_eq e he + · ext : 1 + · change (Hypergraph.biUnion T.verts fun t ↦ (τ t).toHypergraph).vertexSet = G.vertexSet + exact congrArg Hypergraph.vertexSet htd.biUnion_eq + · simp only [Hypergraph.biUnion, tagEdgeRooted, tagEdgeHypergraph] + rw [← Set.image_iUnion₂] + exact congrArg (Prod.mk i '' ·) (congrArg Hypergraph.edgeSet htd.biUnion_eq) + · ext ⟨j, e⟩ v + simp only [Hypergraph.biUnion, tagEdgeRooted, tagEdgeHypergraph] + constructor + · rintro ⟨t, ht, rfl, hinc⟩ + refine ⟨rfl, ?_⟩ + have hEq := congrFun (congrFun (congrArg Hypergraph.Inc htd.biUnion_eq) e) v + exact hEq.mp ⟨t, ht, hinc⟩ + · rintro ⟨rfl, hinc⟩ + have hEq := congrFun (congrFun (congrArg Hypergraph.Inc htd.biUnion_eq) e) v + obtain ⟨t, ht, hinc'⟩ := hEq.mpr hinc + exact ⟨t, ht, rfl, hinc'⟩ + · intro t₁ ht₁ t₂ ht₂ hne + rw [Set.eq_empty_iff_forall_notMem] + rintro _ ⟨⟨e₁, he₁, rfl⟩, ⟨e₂, he₂, hEq⟩⟩ + obtain rfl : e₁ = e₂ := congrArg Prod.snd hEq.symm + have he_inter : e₁ ∈ ((τ t₁).toHypergraph ∩ (τ t₂).toHypergraph).edgeSet := ⟨he₁, he₂⟩ + rw [htd.edgeSet_inter_eq t₁ ht₁ t₂ ht₂ hne] at he_inter + exact he_inter + · intro t₁ ht₁ t₂ ht₂ t₃ ht₃ hpath + have hle := htd.inter_le t₁ ht₁ t₂ ht₂ t₃ ht₃ hpath + refine ⟨hle.vertexSet_subset, ?_, ?_⟩ + · rintro _ ⟨⟨e₁, he₁, rfl⟩, ⟨e₃, he₃, hEq⟩⟩ + obtain rfl : e₁ = e₃ := congrArg Prod.snd hEq.symm + exact ⟨e₁, hle.edgeSet_subset ⟨he₁, he₃⟩, rfl⟩ + · rintro _ ⟨⟨e₁, he₁, rfl⟩, ⟨e₃, he₃, hEq⟩⟩ + obtain rfl : e₁ = e₃ := congrArg Prod.snd hEq.symm + ext v + have hends := congrArg (v ∈ ·) (hle.ends_eq e₁ ⟨he₁, he₃⟩) + dsimp only [Hypergraph.ends, Inter.inter, tagEdgeRooted, tagEdgeHypergraph] at hends ⊢ + rw [Set.mem_ofPred_eq, Set.mem_ofPred_eq] at hends ⊢ + exact ⟨fun h ↦ ⟨⟨rfl, (hends.mp h.2).1⟩, ⟨rfl, (hends.mp h.2).2⟩⟩, + fun ⟨h₁, h₃⟩ ↦ ⟨rfl, hends.mpr ⟨h₁.2, h₃.2⟩⟩⟩ + +open Classical in +theorem simulated_of_tagEdgePatchwork {P P' : Patchwork Ω α β} {i i' : ℕ} + (hsim : Simulated (tagEdgePatchwork i P) (tagEdgePatchwork i' P')) : + Simulated P P' := by + obtain ⟨ηv, ηe', hexp', H, hreal'⟩ := hsim + let ηe (e : β) : β := (ηe' (i, e)).2 + have hηe_eq : ∀ e ∈ P.G.edgeSet, ηe' (i, e) = (i', ηe e) := by + intro e he + obtain ⟨e', _, hEq⟩ := hexp'.edge_mem (i, e) ⟨e, he, rfl⟩ + exact Prod.ext (congrArg Prod.fst hEq).symm rfl + have hηe_mem : ∀ e ∈ P.G.edgeSet, ηe e ∈ P'.G.edgeSet := by + intro e he + obtain ⟨e', he', hEq⟩ := hexp'.edge_mem (i, e) ⟨e, he, rfl⟩ + have hsnd : e' = ηe e := congrArg Prod.snd hEq + exact hsnd ▸ he' + have hexp : IsExpansion P P' ηv ηe := by + refine ⟨hexp'.vertex_nonempty, hexp'.vertex_subset, hηe_mem, hexp'.vertex_disjoint, + ?_, ?_, ?_, ?_, ?_, hexp'.roots_length, hexp'.roots_mem, ?_, ?_⟩ + · intro e₁ he₁ e₂ he₂ hEq + have hEq' : ηe' (i, e₁) = ηe' (i, e₂) := by + rw [hηe_eq e₁ he₁, hηe_eq e₂ he₂, hEq] + have hinj := hexp'.edge_injOn ⟨e₁, he₁, rfl⟩ ⟨e₂, he₂, rfl⟩ hEq' + exact congrArg Prod.snd hinj + · intro e he + have hdom := hexp'.mem_dom_iff (i, e) ⟨e, he, rfl⟩ + rw [hηe_eq e he] at hdom + simp only [tagEdgePatchwork, Set.mem_image, Prod.mk.injEq, true_and, exists_eq_right] at hdom + exact hdom + · intro e he hnd v hv + have hnd' : (i, e) ∉ (tagEdgePatchwork i P).dom := by + rintro ⟨e₁, hd₁, hEq⟩ + obtain rfl : e₁ = e := congrArg Prod.snd hEq + exact hnd hd₁ + obtain ⟨v', hv', hinc'⟩ := hexp'.ends_nonempty (i, e) ⟨e, he, rfl⟩ hnd' v ⟨rfl, hv⟩ + rw [hηe_eq e he] at hinc' + exact ⟨v', hv', hinc'.2⟩ + · intro e hd + exact hexp'.μ_length (i, e) ⟨e, hd, rfl⟩ + · intro e hd j hj₁ hj' + exact hexp'.μ_mem (i, e) ⟨e, hd, rfl⟩ j hj₁ hj' + · intro e hd + exact hexp'.maps_Δ (i, e) ⟨e, hd, rfl⟩ + · intro e he + exact hexp'.φ_le (i, e) ⟨e, he, rfl⟩ + have hreal : Realizes P P' ηv ηe H := by + refine ⟨?_, hreal'.2⟩ + obtain ⟨δ', hδ', rfl⟩ := hreal'.1 + let δ (e' : β) : (⊤ : SimpleGraph α).Subgraph := δ' (i', e') + have hmem_del : ∀ e' : β, + e' ∈ (P'.deleteEdges (ηe '' P.G.edgeSet)).G.edgeSet ↔ + (i', e') ∈ ((tagEdgePatchwork i' P').deleteEdges + (ηe' '' (tagEdgePatchwork i P).G.edgeSet)).G.edgeSet := by + intro e' + simp only [Patchwork.deleteEdges, RootedHypergraph.deleteEdges, Hypergraph.deleteEdges, + tagEdgePatchwork, tagEdgeRooted, tagEdgeHypergraph, Set.mem_sdiff, Set.mem_image, + Prod.mk.injEq, true_and, exists_eq_right] + refine and_congr_right fun _ ↦ not_congr ?_ + constructor + · rintro ⟨e, he, rfl⟩ + exact ⟨(i, e), ⟨e, he, rfl⟩, hηe_eq e he⟩ + · rintro ⟨_, ⟨e, he, rfl⟩, hEq⟩ + rw [hηe_eq e he] at hEq + exact ⟨e, he, congrArg Prod.snd hEq⟩ + refine ⟨δ, fun e' he' ↦ hδ' (i', e') ((hmem_del e').mp he'), ?_⟩ + ext x y + · simp only [realizationOf, Patchwork.deleteEdges, RootedHypergraph.deleteEdges, + Hypergraph.deleteEdges, Subgraph.verts_sup, Subgraph.verts_iSup, emptySubgraph_verts, + tagEdgePatchwork, tagEdgeRooted, tagEdgeHypergraph] + refine or_congr_right ?_ + simp only [Set.mem_iUnion] + constructor + · rintro ⟨⟨j, e'⟩, hje', hxy⟩ + have hj : j = i' := by + rcases hje'.1 with ⟨_, _, hEq⟩ + exact (congrArg Prod.fst hEq).symm + subst hj + exact ⟨e', (hmem_del e').mpr hje', hxy⟩ + · rintro ⟨e', he', hxy⟩ + exact ⟨(i', e'), (hmem_del e').mp he', hxy⟩ + · simp only [realizationOf, Subgraph.sup_adj, not_emptySubgraph_adj, false_or, + Subgraph.iSup_adj] + constructor + · rintro ⟨⟨j, e'⟩, hje', hxy⟩ + have hj : j = i' := by + rcases hje'.1 with ⟨_, _, hEq⟩ + exact (congrArg Prod.fst hEq).symm + subst hj + exact ⟨e', (hmem_del e').mpr hje', hxy⟩ + · rintro ⟨e', he', hxy⟩ + exact ⟨(i', e'), (hmem_del e').mp he', hxy⟩ + exact ⟨ηv, ηe, hexp, H, hreal⟩ + +open Classical in +/-- **Graph Minors IV, (9.1)** (page 252): +"Let $n \ge 0$, let $\Omega$ be a well-quasi-order, and let $P_i = (G_i, \mu_i, \Delta_i, +\phi_i)$ $(i = 1, 2, \dots)$ be a countable sequence of robust $\Omega$-patchworks, where +each $G_i$ has tree-width $\le n$. Then there exist $i' > i \ge 1$ such that there is a +realizable expansion of $P_i$ in $P_{i'}$." + +Following the paper ("We may assume that $G_1, G_2, \dots$ are mutually disjoint, and hence we may +define +$\mathscr{R}$, etc. as at the start of this section; and the claim follows from (5.3)"), we tag the +edges of +each `Pᵢ` with `i` via `tagEdgePatchwork i (P i) : Patchwork Ω α (ℕ × β)` so that the hypergraphs +have pairwise disjoint edge sets without changing the universe `v`, apply `theorem_9_1_disjoint`, +and pull back the resulting simulation along `simulated_of_tagEdgePatchwork`. -/ +theorem theorem_9_1_proof (h53 : Theorem53Statement.{u, v}) (hM : MengerStatement.{u, v}) + (hH : Higman83Statement.{u₁, u₂}) (hΩ : WellQuasiOrderedLE Ω) + (n : ℕ) (P : ℕ → Patchwork Ω α β) + (hrob : ∀ i, (P i).IsRobust) + (htw : ∀ i, TreeWidthLE (P i).G n) : + ∃ i i', i < i' ∧ Simulated (P i) (P i') := by + let P' (i : ℕ) : Patchwork Ω α (ℕ × β) := tagEdgePatchwork i (P i) + obtain ⟨i, i', hlt, hsim⟩ := theorem_9_1_disjoint h53 hM hH hΩ n P' + (tagEdgePatchwork_disjoint P) + (fun i ↦ tagEdgePatchwork_isRobust (hrob i) i) + (fun i ↦ tagEdgeRooted_treeWidthLE (htw i) i) + exact ⟨i, i', hlt, simulated_of_tagEdgePatchwork hsim⟩ + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/Tree.lean b/LeanPool/GraphMinor/GM04/Tree.lean new file mode 100644 index 0000000000..8dd96f5fb8 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/Tree.lean @@ -0,0 +1,199 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Combinatorics.SimpleGraph.Clique +public import Mathlib.Data.Finset.Basic +public import Mathlib.Logic.Function.Iterate + +/-! +# Rooted trees (Graph Minors IV, Section 2) + +Graph Minors IV, Section 2 (page 230): "we define an *undirected tree* to be a non-null connected +finite undirected graph without circuits, and a *tree* $T$ to be a directed graph, the undirected +graph underlying which is an undirected tree, such that every vertex of $T$ is the head of at most +one edge. It follows that there is a unique vertex of each tree $T$ (called the *root* and denoted +by $o(T)$) which is the head of no edge of $T$, and every edge of $T$ is directed away from the +root." + +## How a tree is represented + +A `RootedTree ι` has a finite vertex set `verts` in the type `ι`, a root, and a function `parent`. +Every vertex `v` other than the root is the head of exactly one edge, and the tail of that edge is +`parent v`. Since an edge is determined by its head, **we identify each edge with its head**: the +edge set `E(T)` is `T.edges`, the vertex set minus the root, and the edge `f` has head `f` and tail +`T.parent f`. The condition that iterating `parent` from any vertex reaches the root says that the +underlying undirected graph is connected; it then has `|V(T)| - 1` edges, so it is a tree. +Conversely every tree in the sense of the paper arises in this way, with `parent v` the tail of +the edge with head `v`. + +All trees of this file live in one type `ι`, so a sequence of disjoint trees, as in (2.1) and +(2.2), is a sequence of trees in `ι` with pairwise disjoint vertex sets, and subtrees and the +contraction of a tree are trees in the same type. + +## Notions + +* `T.Reaches u v`: there is a directed path of `T` from `u` to `v`, that is, `u` lies on the path + of `T` from `o(T)` to `v` (possibly `u = v`). +* `T.subtreeAt v`: the vertex set of `T^v`, the maximal subtree of `T` with root `v`. For an edge + `f`, `T^f = T^{head f}` is `T.subtreeAt f`, and `T.rootSide f` is the vertex set of `T_f`, the + other component of `T \ f`, with root `o(T)`. +* `T.OnPath t₁ t₂ t`: `t` lies on the path of `T` between `t₁` and `t₂`. `T.OnPathEdge t₁ t₂ f`: + the edge `f` is an edge of that path. +* `T.pathEdges f₂ f₁`: the edge set of the directed path of `T` with first edge `f₂` and last edge + `f₁`. Such a path exists exactly when `T.Reaches f₂ f₁`. +* `T.Precedes φ v w`: `v` precedes `w` with respect to `φ`, as defined before (2.2). +* `T.IsComponentRoot F y x`, `T.componentAt F y`: `y` is the root of the component of `T \ F` + containing `x`, and the vertex set of the component with root `y`. +* `T.IsContraction F S`: `S` is the contraction of `T` onto `F`, as defined before (2.2). +* `IsStar S`, `T.starAt s`: stars, and the maximal star with root `s` that is a subtree of `T` + (Section 3). +* `IsRich M X`: `X` is `M`-rich. A set is `M`-stable when it is an independent set of `M` + (Mathlib's `SimpleGraph.IsIndepSet`). +* `TreeLemma22Statement`: the statement of (2.2). +-/ + +@[expose] public section + +namespace GraphMinor.GM04 + +variable {ι : Type*} + +/-- A rooted tree (Graph Minors IV, Section 2), with vertex set `verts` in `ι`. Each vertex `v` +other than the root is the head of exactly one edge, whose tail is `parent v`; we identify this +edge with `v`. The value of `parent` at the root, and outside `verts`, carries no meaning; it is +the root at the root. -/ +structure RootedTree (ι : Type*) where + /-- The vertex set `V(T)`. -/ + verts : Finset ι + /-- The root `o(T)`. -/ + root : ι + /-- `parent v` is the tail of the edge with head `v`, for `v ≠ root`. -/ + parent : ι → ι + root_mem : root ∈ verts + parent_mem : ∀ v ∈ verts, parent v ∈ verts + parent_root : parent root = root + /-- From every vertex, following edges backwards leads to the root. -/ + exists_iterate_eq_root : ∀ v ∈ verts, ∃ n, parent^[n] v = root + +namespace RootedTree + +variable (T : RootedTree ι) + +/-- The edge set `E(T)`: the vertices other than the root, each standing for the edge of which it +is the head. -/ +noncomputable def edges : Finset ι := by classical exact T.verts.erase T.root + +/-- There is a directed path of `T` from `u` to `v`, possibly with no edges. Equivalently, `u` lies +on the path of `T` from `o(T)` to `v`. -/ +def Reaches (u v : ι) : Prop := v ∈ T.verts ∧ ∃ n, T.parent^[n] v = u + +/-- The vertex set of `T^v`, the maximal subtree of `T` with root `v`: the vertices `w` such that +`v` lies on the path from `o(T)` to `w`. -/ +noncomputable def subtreeAt (v : ι) : Finset ι := by classical exact T.verts.filter (T.Reaches v) + +/-- The vertex set of `T_f` for an edge `f`: the component of `T \ f` that contains the root. +Its root is `o(T)`. -/ +noncomputable def rootSide (f : ι) : Finset ι := by classical exact T.verts \ T.subtreeAt f + +/-- `t` lies on the path of `T` between `t₁` and `t₂`. The common ancestors of `t₁` and `t₂` form a +directed path from the root, whose last vertex `a` is the vertex of the path between `t₁` and `t₂` +closest to the root; the path consists of the vertices from `a` to `t₁` and from `a` to `t₂`. So +`t` is on it when `t` lies on the path from the root to `t₁` or to `t₂`, and every common ancestor +of `t₁` and `t₂` lies on the path from the root to `t`. -/ +def OnPath (t₁ t₂ t : ι) : Prop := + (T.Reaches t t₁ ∨ T.Reaches t t₂) ∧ ∀ x, T.Reaches x t₁ → T.Reaches x t₂ → T.Reaches x t + +/-- The edge `f` is an edge of the path of `T` between `t₁` and `t₂`: both its head `f` and its +tail `T.parent f` lie on that path. -/ +def OnPathEdge (t₁ t₂ f : ι) : Prop := + f ∈ T.edges ∧ T.OnPath t₁ t₂ f ∧ T.OnPath t₁ t₂ (T.parent f) + +/-- The edge set of the directed path of `T` with first edge `f₂` and last edge `f₁` (it exists +when `T.Reaches f₂ f₁`): the edges `g` with `f₂` on the path from the root to `g` and `g` on the +path from the root to `f₁`. -/ +def pathEdges (f₂ f₁ : ι) : Set ι := {g | T.Reaches f₂ g ∧ T.Reaches g f₁} + +/-- `v` precedes `w` with respect to `φ` (Graph Minors IV, before (2.2)): `v ≠ o(T)`, there is a +directed path `P` of `T` from `v` to `w`, `φ(e) = φ(f)` where `e, f` are the edges with heads `v, +w`, and `φ(g) ≥ φ(f)` for every edge `g` of `P`. The edges of `P` are the vertices `g ≠ v` with +`v` on the path from the root to `g` and `g` on the path from the root to `w`. -/ +def Precedes (φ : ι → ℕ) (v w : ι) : Prop := + v ≠ T.root ∧ T.Reaches v w ∧ φ v = φ w ∧ + ∀ g, g ≠ v → T.Reaches v g → T.Reaches g w → φ w ≤ φ g + +/-- `y` is the root of the component of `T \ F` containing `x`: `y` lies on the path from the +root to `x`, `y` is the root of `T` or the head of an edge in `F`, and no other edge of the +directed path from `y` to `x` is in `F`. -/ +def IsComponentRoot (F : Set ι) (y x : ι) : Prop := + T.Reaches y x ∧ (y = T.root ∨ y ∈ F) ∧ ∀ g, g ≠ y → T.Reaches y g → T.Reaches g x → g ∉ F + +/-- The vertex set of the component of `T \ F` with root `y` (for `y` the root of `T` or the head +of an edge in `F`). -/ +noncomputable def componentAt (F : Set ι) (y : ι) : Finset ι := by + classical exact T.verts.filter (T.IsComponentRoot F y) + +/-- `S` is the contraction of `T` onto `F ⊆ E(T)` (Graph Minors IV, before (2.2)): "the tree $S$ +with $E(S) = F$ and $V(S)$ the set of roots of the components of $T\setminus +F$, in which $v \in V(S)$ is the head (or tail, respectively) of $f \in F$ if the head (or +tail, respectively) of $f$ in $T$ belongs to the component of $T\setminus F$ with root $v$." The +roots of the components of `T \ F` are +`o(T)` and the heads of the edges in `F`. The head of `f` in `T` is `f`, the root of its own +component, so `f` keeps its head; its tail in `S` is the root of the component containing its +tail `T.parent f` in `T`. -/ +structure IsContraction (F : Set ι) (S : RootedTree ι) : Prop where + verts_eq : (S.verts : Set ι) = insert T.root (F ∩ T.edges) + root_eq : S.root = T.root + parent_eq : ∀ f ∈ S.edges, T.IsComponentRoot F (S.parent f) (T.parent f) + +/-- `S` is a star: its root is the tail of every edge. -/ +def IsStar (S : RootedTree ι) : Prop := ∀ v ∈ S.edges, S.parent v = S.root + +/-- The heads of the edges of `T` with tail `s`. -/ +noncomputable def children (s : ι) : Finset ι := by + classical exact T.edges.filter fun v ↦ T.parent v = s + +/-- The maximal star with root `s` which is a subtree of `T` (Graph Minors IV, Section 3): the +vertex `s`, the heads of the edges of `T` with tail `s`, and these edges. -/ +noncomputable def starAt (s : ι) : RootedTree ι where + verts := by classical exact insert s (T.children s) + root := s + parent _ := s + root_mem := by classical exact Finset.mem_insert_self s _ + parent_mem _ _ := by classical exact Finset.mem_insert_self s _ + parent_root := rfl + exists_iterate_eq_root _ _ := ⟨1, rfl⟩ + +end RootedTree + +/-- `X` is `M`-rich: no infinite subset of `X` is `M`-stable, that is, independent in `M`. -/ +def IsRich (M : SimpleGraph ι) (X : Set ι) : Prop := ∀ Y ⊆ X, M.IsIndepSet Y → Y.Finite + +/-- The statement of Graph Minors IV, (2.2). Let `T₁, T₂, …` be a countable sequence of disjoint +trees, let `n ≥ 0`, and for each `i` let `φᵢ : E(Tᵢ) → {0, 1, …, n}`. Let `M` be an infinite graph +with `V(M) = V(T₁ ∪ T₂ ∪ ⋯)` such that for `i' > i`, if `u ∈ V(Tᵢ)` is `M`-adjacent to +`w ∈ V(T_{i'})`, and `v ∈ V(T_{i'})` precedes `w` (with respect to `φ_{i'}`), then `u` is +`M`-adjacent to `v`. Let `{o(T₁), o(T₂), …}` be `M`-stable. Then there is an infinite `M`-stable +set `X ⊆ V(M)` such that `|X ∩ V(Tᵢ)| ≤ 1` for each `i` and such that the set of heads of all +edges of `T₁ ∪ T₂ ∪ ⋯` with tails in `X` is `M`-rich. + +Here `M` is a simple graph on `ι`; only its adjacencies between vertices of the trees matter. The +sequence is indexed from `0`. -/ +def TreeLemma22Statement : Prop := + ∀ {ι : Type*} (T : ℕ → RootedTree ι) (n : ℕ) (φ : ℕ → ι → ℕ) (M : SimpleGraph ι), + Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts) → + (∀ i, ∀ f ∈ (T i).edges, φ i f ≤ n) → + (∀ i i', i < i' → ∀ u ∈ (T i).verts, ∀ w ∈ (T i').verts, ∀ v, + M.Adj u w → (T i').Precedes (φ i') v w → M.Adj u v) → + M.IsIndepSet (Set.range fun i ↦ (T i).root) → + ∃ X : Set ι, X.Infinite ∧ M.IsIndepSet X ∧ X ⊆ ⋃ i, ((T i).verts : Set ι) ∧ + (∀ i, (X ∩ (T i).verts).Subsingleton) ∧ + IsRich M {v | ∃ i, v ∈ (T i).edges ∧ (T i).parent v ∈ X} + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/TreeDecomposition.lean b/LeanPool/GraphMinor/GM04/TreeDecomposition.lean new file mode 100644 index 0000000000..1a81e6d513 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/TreeDecomposition.lean @@ -0,0 +1,129 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Hypergraph.Basic +public import LeanPool.GraphMinor.GM04.Tree + +/-! +# Tree-decompositions of rooted hypergraphs (Graph Minors IV, Sections 3 and 5) + +Graph Minors IV, Section 3 (page 234): "A *tree-decomposition* $(T, \tau)$ of a rooted hypergraph +$G$ consists of a tree $T$ and a function $\tau$ which assigns to each $t \in V(T)$ a rooted +hypergraph $\tau(t)$, such that + +(i) for each $t \in V(T)$, $\tau(t)^- \subseteq G^-$ + +(ii) $\bigcup_{t \in V(T)} \tau(t)^- = G^-$ + +(iii) for distinct $t_1, t_2 \in V(T)$, $E(\tau(t_1)^- \cap \tau(t_2)^-) = \emptyset$ + +(iv) for $t_1, t_2, t_3 \in V(T)$, if $t_2$ lies on the path of $T$ between $t_1$ and $t_3$ then +$\tau(t_1)^- \cap \tau(t_3)^- \subseteq \tau(t_2)^-$ + +(v) $\pi(\tau(o(T))) = \pi(G)$ + +(vi) for each edge $f \in E(T)$ with head $t_1$ and tail $t_2$, $\bar{\pi}(\tau(t_1)) = +V(\tau(t_1)^- \cap \tau(t_2)^-)$." + +"If $T'$ is a subtree of $T$ we denote by $\tau \times T'$ the rooted hypergraph $G'$ defined by +$$ +G'^- = \bigcup_{t \in V(T')} \tau(t)^- +$$ +$$ +\pi(G') = \pi(\tau(o(T'))). +$$" Here `cross τ S r` is `τ × T'` for the +subtree `T'` with vertex set `S` and root `r`. + +(3.1) says that for an edge `f` of `T`, `(τ × T^f, τ × T_f)` is a separation of `G`; "The order of +the separation in (3.1) is called the *order* of $f$ in $(T, \tau)$." (`edgeOrder`). + +Section 5 (page 238): "The width of a tree-decomposition $(T, \tau)$ of a rooted hypergraph $G$ is + +$$\max(|V(\tau(t))| - 1 : t \in V(T))$$ + +and the *tree-width* of $G$ is the minimum $w \ge 0$ such that $G$ has a tree-decomposition of width +$\le w$." `WidthLE T τ w` says that the width is at most `w`, and +`TreeWidthLE G w` that the tree-width is at most `w`. In `TreeWidthLE` the tree has vertices in +`ℕ`; every finite tree is isomorphic to one with vertices in `ℕ`, so this loses nothing. + +`ThomasStatement` is the lemma of R. Thomas that Graph Minors IV quotes as (5.1). +-/ + +@[expose] public section + +namespace GraphMinor.GM04 + +open Hypergraph + +variable {α β ι : Type*} + +open Classical in +/-- `τ × T'`, for the subtree `T'` of `T` with vertex set `S` and root `r ∈ S`: the union of the +`τ(t)⁻` for `t ∈ S`, with the march `π(τ(r))`. (The union is taken over `insert r S`, which is `S` +since `r ∈ S`; this makes the march a march in the union also when `r ∉ S`.) -/ +noncomputable def cross (τ : ι → RootedHypergraph α β) (S : Finset ι) (r : ι) : + RootedHypergraph α β where + toHypergraph := Hypergraph.biUnion (insert r S) fun t ↦ (τ t).toHypergraph + roots := (τ r).roots + roots_nodup := (τ r).roots_nodup + roots_subset v hv := + Set.mem_biUnion (Finset.mem_coe.2 (Finset.mem_insert_self r S)) ((τ r).roots_subset v hv) + +/-- `(T, τ)` is a tree-decomposition of the rooted hypergraph `G` (Graph Minors IV, Section 3, +conditions (i)–(vi)). Only the values of `τ` on `V(T)` matter. -/ +structure IsTreeDecomposition (G : RootedHypergraph α β) (T : RootedTree ι) + (τ : ι → RootedHypergraph α β) : Prop where + /-- (i) -/ + le : ∀ t ∈ T.verts, (τ t).toHypergraph ≤ G.toHypergraph + /-- (ii) -/ + biUnion_eq : Hypergraph.biUnion T.verts (fun t ↦ (τ t).toHypergraph) = G.toHypergraph + /-- (iii) -/ + edgeSet_inter_eq : ∀ t₁ ∈ T.verts, ∀ t₂ ∈ T.verts, t₁ ≠ t₂ → + ((τ t₁).toHypergraph ∩ (τ t₂).toHypergraph).edgeSet = ∅ + /-- (iv) -/ + inter_le : ∀ t₁ ∈ T.verts, ∀ t₂ ∈ T.verts, ∀ t₃ ∈ T.verts, T.OnPath t₁ t₃ t₂ → + (τ t₁).toHypergraph ∩ (τ t₃).toHypergraph ≤ (τ t₂).toHypergraph + /-- (v) -/ + roots_root : (τ T.root).roots = G.roots + /-- (vi), for the edge with head `f` and tail `T.parent f`. -/ + rootSet_edge : ∀ f ∈ T.edges, + (τ f).rootSet = ((τ f).toHypergraph ∩ (τ (T.parent f)).toHypergraph).vertexSet + +/-- The order of the edge `f` in `(T, τ)`: the order of the separation `(τ × T^f, τ × T_f)`, that +is, `|V((τ × T^f)⁻ ∩ (τ × T_f)⁻)|`. -/ +noncomputable def edgeOrder (T : RootedTree ι) (τ : ι → RootedHypergraph α β) (f : ι) : ℕ := + separationOrder (cross τ (T.subtreeAt f) f).toHypergraph + (cross τ (T.rootSide f) T.root).toHypergraph + +/-- The width of `(T, τ)` is at most `w`: `|V(τ(t))| - 1 ≤ w` for every `t ∈ V(T)`. -/ +def WidthLE (T : RootedTree ι) (τ : ι → RootedHypergraph α β) (w : ℕ) : Prop := + ∀ t ∈ T.verts, (τ t).vertexSet.ncard ≤ w + 1 + +/-- The tree-width of the rooted hypergraph `G` is at most `w`: `G` has a tree-decomposition of +width at most `w`. -/ +def TreeWidthLE (G : RootedHypergraph α β) (w : ℕ) : Prop := + ∃ (T : RootedTree ℕ) (τ : ℕ → RootedHypergraph α β), IsTreeDecomposition G T τ ∧ WidthLE T τ w + +/-- The lemma of R. Thomas (*A Menger-like property of tree-width. The finite case*, J. Combin. +Theory Ser. B 48 (1990) 67–76), as Graph Minors IV states it in (5.1) (page 238): "Let $G$ be a +graph. If $(G, 0)$ has a tree-decomposition of width $\le w$, then it has a +tree-decomposition $(T, \tau)$ of width $\le w$ such that for all distinct $t_1$, $t_2 \in +V(T)$ and all $k \ge 0$ either there are $k$ mutually vertex-disjoint paths of $G$ from +$V(\tau(t_1))$ to $V(\tau(t_2))$, or some edge of the path of $T$ between $t_1$ and $t_2$ +has order $< k$." -/ +def ThomasStatement : Prop := + ∀ {α β : Type*} (G : Hypergraph α β), G.IsGraph → ∀ w : ℕ, TreeWidthLE G.toRooted w → + ∃ (T : RootedTree ℕ) (τ : ℕ → RootedHypergraph α β), + IsTreeDecomposition G.toRooted T τ ∧ WidthLE T τ w ∧ + ∀ t₁ ∈ T.verts, ∀ t₂ ∈ T.verts, t₁ ≠ t₂ → ∀ k : ℕ, + HasDisjointPaths G.skeleton (τ t₁).vertexSet (τ t₂).vertexSet k ∨ + ∃ f, T.OnPathEdge t₁ t₂ f ∧ edgeOrder T τ f < k + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/TreeLemma/Basic.lean b/LeanPool/GraphMinor/GM04/TreeLemma/Basic.lean new file mode 100644 index 0000000000..4e743439ce --- /dev/null +++ b/LeanPool/GraphMinor/GM04/TreeLemma/Basic.lean @@ -0,0 +1,699 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Tree +import Mathlib.Data.Finset.Card +import Mathlib.Data.Set.Finite.Basic + +/-! +# Basic properties of rooted trees (Graph Minors IV, Section 2) + +This file develops the basic theory of `RootedTree` from `GraphMinor/GM04/Tree.lean` needed in +Section 2 and later sections of Graph Minors IV: + +* Acyclicity of `parent` iterates outside the root, and the partial order `Reaches` (reflexive on + `verts`, transitive, antisymmetric, with `root` as minimum and linear ancestor chains). +* Properties of vertex sets of subtrees (`subtreeAt`) and root-side components (`rootSide`), and the + construction `RootedTree.subtree` of `T^v` as a `RootedTree`. +* Existence and uniqueness of component roots (`IsComponentRoot`) in `T \ F`, the construction + `RootedTree.componentTree` of a component of `T \ F` as a `RootedTree`, and the existence of the + contraction of `T` onto `F` (`RootedTree.exists_isContraction`). +* Closure of `IsRich` under subsets and binary unions. +-/ + +public section + +namespace GraphMinor.GM04 + +variable {ι : Type*} + +namespace RootedTree + +variable (T : RootedTree ι) + +/-! ### Edges and iterates of `parent` -/ + +@[simp] +theorem mem_edges {v : ι} : v ∈ T.edges ↔ v ≠ T.root ∧ v ∈ T.verts := by + classical exact Finset.mem_erase + +theorem edges_subset_verts : T.edges ⊆ T.verts := by + intro v hv + exact (T.mem_edges.1 hv).2 + +theorem ne_root_of_mem_edges {v : ι} (hv : v ∈ T.edges) : v ≠ T.root := + (T.mem_edges.1 hv).1 + +theorem mem_verts_of_mem_edges {v : ι} (hv : v ∈ T.edges) : v ∈ T.verts := + (T.mem_edges.1 hv).2 + +theorem root_notMem_edges : T.root ∉ T.edges := by + simp [mem_edges] + +/-- Iterating `parent` preserves membership in `T.verts`. -/ +theorem iterate_parent_mem {v : ι} (hv : v ∈ T.verts) : ∀ n : ℕ, T.parent^[n] v ∈ T.verts + | 0 => hv + | n + 1 => by + rw [Function.iterate_succ_apply'] + exact T.parent_mem _ (iterate_parent_mem hv n) + +/-- Iterating `parent` at the root stays at the root. -/ +@[simp] +theorem iterate_parent_root (n : ℕ) : T.parent^[n] T.root = T.root := + Function.iterate_fixed T.parent_root n + +/-- Once an iterate of `parent` reaches the root, all higher iterates stay at the root. -/ +theorem iterate_parent_eq_root_of_le {v : ι} {m n : ℕ} (h : T.parent^[m] v = T.root) + (hmn : m ≤ n) : T.parent^[n] v = T.root := by + obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le hmn + rw [add_comm, Function.iterate_add_apply, h, T.iterate_parent_root] + +private theorem iterate_mul_eq_self {u : ι} {k : ℕ} (hk : T.parent^[k] u = u) : + ∀ m : ℕ, T.parent^[m * k] u = u + | 0 => by simp + | m + 1 => by + rw [Nat.succ_mul, Function.iterate_add_apply, hk, iterate_mul_eq_self hk m] + +/-- The root is the only vertex fixed by a positive iterate of `parent`. -/ +theorem eq_root_of_iterate_eq_self {u : ι} (hu : u ∈ T.verts) {k : ℕ} (hk : 0 < k) + (h : T.parent^[k] u = u) : u = T.root := by + obtain ⟨n, hn⟩ := T.exists_iterate_eq_root u hu + have h1 : T.parent^[n * k] u = T.root := + T.iterate_parent_eq_root_of_le hn (Nat.le_mul_of_pos_right n hk) + rw [iterate_mul_eq_self T h n] at h1 + exact h1 + +/-- No non-root vertex is its own parent. -/ +theorem parent_ne_self {v : ι} (hv : v ∈ T.edges) : T.parent v ≠ v := by + intro h + exact T.ne_root_of_mem_edges hv + (T.eq_root_of_iterate_eq_self (T.mem_verts_of_mem_edges hv) Nat.one_pos h) + +/-! ### Reachability (`Reaches`) -/ + +theorem Reaches.verts_right {u v : ι} (h : T.Reaches u v) : v ∈ T.verts := + h.1 + +theorem Reaches.verts_left {u v : ι} (h : T.Reaches u v) : u ∈ T.verts := by + obtain ⟨hv, n, rfl⟩ := h + exact T.iterate_parent_mem hv n + +/-- `Reaches` is reflexive on `T.verts`. -/ +@[simp] +theorem reaches_refl {v : ι} (hv : v ∈ T.verts) : T.Reaches v v := + ⟨hv, 0, rfl⟩ + +/-- `Reaches` is transitive. -/ +theorem Reaches.trans {u v w : ι} (huv : T.Reaches u v) (hvw : T.Reaches v w) : + T.Reaches u w := by + obtain ⟨_, n, rfl⟩ := huv + obtain ⟨hw, m, rfl⟩ := hvw + exact ⟨hw, n + m, by rw [Function.iterate_add_apply]⟩ + +/-- `Reaches` is antisymmetric. -/ +theorem Reaches.antisymm {u v : ι} (huv : T.Reaches u v) (hvu : T.Reaches v u) : u = v := by + obtain ⟨hv, n, rfl⟩ := huv + obtain ⟨hu, m, hmu⟩ := hvu + have hnm : T.parent^[m + n] v = v := by + rw [Function.iterate_add_apply] + exact hmu + rcases Nat.eq_zero_or_pos (m + n) with h0 | hpos + · have hn : n = 0 := by omega + simp [hn] + · have hvroot : v = T.root := T.eq_root_of_iterate_eq_self hv hpos hnm + rw [hvroot, T.iterate_parent_root] + +/-- The root reaches every vertex of `T`. -/ +theorem root_reaches {v : ι} (hv : v ∈ T.verts) : T.Reaches T.root v := + ⟨hv, T.exists_iterate_eq_root v hv⟩ + +/-- Only the root reaches the root. -/ +@[simp] +theorem reaches_root_iff {u : ι} : T.Reaches u T.root ↔ u = T.root := by + constructor + · rintro ⟨_, n, rfl⟩ + exact T.iterate_parent_root n + · rintro rfl + exact T.reaches_refl T.root_mem + +/-- The parent of a vertex reaches that vertex. -/ +theorem reaches_parent {v : ι} (hv : v ∈ T.verts) : T.Reaches (T.parent v) v := + ⟨hv, 1, rfl⟩ + +/-- A non-root vertex does not reach its own parent. -/ +theorem not_reaches_parent {v : ι} (hv : v ∈ T.edges) : ¬ T.Reaches v (T.parent v) := by + intro h + exact T.parent_ne_self hv (h.antisymm T (T.reaches_parent (T.mem_verts_of_mem_edges hv))).symm + +/-- If `u` reaches `v`, then `u = v` or `u` reaches `T.parent v`. -/ +theorem Reaches.eq_or_reaches_parent {u v : ι} (h : T.Reaches u v) : + u = v ∨ T.Reaches u (T.parent v) := by + obtain ⟨hv, n, rfl⟩ := h + rcases n with _ | n + · exact Or.inl rfl + · exact Or.inr ⟨T.parent_mem v hv, n, Function.iterate_succ_apply T.parent n v⟩ + +/-- If `u` properly reaches `v`, then `v` is a non-root vertex and `u` reaches `T.parent v`. -/ +theorem Reaches.ne_imp_mem_edges_and_reaches_parent {u v : ι} (h : T.Reaches u v) (hne : u ≠ v) : + v ∈ T.edges ∧ T.Reaches u (T.parent v) := by + refine ⟨T.mem_edges.2 ⟨?_, h.verts_right⟩, ?_⟩ + · rintro rfl + exact hne (T.reaches_root_iff.1 h) + · exact (h.eq_or_reaches_parent T).resolve_left hne + +/-- The ancestors of any vertex form a chain under `Reaches`. -/ +theorem Reaches.total_of_reaches {x y w : ι} (hx : T.Reaches x w) (hy : T.Reaches y w) : + T.Reaches x y ∨ T.Reaches y x := by + obtain ⟨hw, n, rfl⟩ := hx + obtain ⟨_, m, rfl⟩ := hy + rcases le_total n m with hnm | hmn + · obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le hnm + refine Or.inr ⟨T.iterate_parent_mem hw n, k, ?_⟩ + rw [add_comm, Function.iterate_add_apply] + · obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le hmn + refine Or.inl ⟨T.iterate_parent_mem hw m, k, ?_⟩ + rw [add_comm, Function.iterate_add_apply] + +/-! ### Subtrees (`subtreeAt`, `rootSide`, `subtree`) -/ + +@[simp] +theorem mem_subtreeAt {v w : ι} : w ∈ T.subtreeAt v ↔ T.Reaches v w := by + classical + simp only [subtreeAt, Finset.mem_filter, and_iff_right_iff_imp] + exact Reaches.verts_right T + +theorem subtreeAt_subset_verts (v : ι) : T.subtreeAt v ⊆ T.verts := by + intro w hw + exact (T.mem_subtreeAt.1 hw).verts_right T + +theorem self_mem_subtreeAt {v : ι} (hv : v ∈ T.verts) : v ∈ T.subtreeAt v := + T.mem_subtreeAt.2 (T.reaches_refl hv) + +@[simp] +theorem subtreeAt_root : T.subtreeAt T.root = T.verts := by + ext v + simp only [mem_subtreeAt] + exact ⟨Reaches.verts_right T, T.root_reaches⟩ + +/-- If `u` reaches `v`, the subtree at `v` is contained in the subtree at `u`. -/ +theorem subtreeAt_subset_of_reaches {u v : ι} (h : T.Reaches u v) : + T.subtreeAt v ⊆ T.subtreeAt u := by + intro w hw + exact T.mem_subtreeAt.2 (h.trans T (T.mem_subtreeAt.1 hw)) + +/-- If `u` properly reaches `v`, the subtree at `v` is a strict subset of the subtree at `u`. -/ +theorem subtreeAt_ssubset_of_reaches_of_ne {u v : ι} (h : T.Reaches u v) (hne : u ≠ v) : + T.subtreeAt v ⊂ T.subtreeAt u := by + refine Finset.ssubset_iff_subset_ne.2 ⟨T.subtreeAt_subset_of_reaches h, ?_⟩ + intro heq + have hu : u ∈ T.subtreeAt v := heq ▸ T.self_mem_subtreeAt (h.verts_left T) + exact hne (h.antisymm T (T.mem_subtreeAt.1 hu)) + +/-- If `u` properly reaches `v`, the subtree at `v` has strictly fewer vertices than that at `u`. -/ +theorem subtreeAt_card_lt_of_reaches_of_ne {u v : ι} (h : T.Reaches u v) (hne : u ≠ v) : + (T.subtreeAt v).card < (T.subtreeAt u).card := + Finset.card_lt_card (T.subtreeAt_ssubset_of_reaches_of_ne h hne) + +@[simp] +theorem mem_rootSide {f w : ι} : w ∈ T.rootSide f ↔ w ∈ T.verts ∧ ¬ T.Reaches f w := by + classical simp [rootSide, mem_subtreeAt] + +theorem rootSide_subset_verts (f : ι) : T.rootSide f ⊆ T.verts := by + intro w hw + exact (T.mem_rootSide.1 hw).1 + +theorem disjoint_subtreeAt_rootSide (f : ι) : Disjoint (T.subtreeAt f) (T.rootSide f) := by + classical exact Finset.disjoint_sdiff + +theorem coe_subtreeAt_union_rootSide (f : ι) : + (T.subtreeAt f : Set ι) ∪ (T.rootSide f : Set ι) = T.verts := by + ext x + simp only [Set.mem_union, Finset.mem_coe, mem_subtreeAt, mem_rootSide] + exact ⟨fun h ↦ h.elim (Reaches.verts_right T) And.left, + fun hx ↦ by + by_cases h : T.Reaches f x + · exact Or.inl h + · exact Or.inr ⟨hx, h⟩⟩ + +theorem root_mem_rootSide {f : ι} (hf : f ∈ T.edges) : T.root ∈ T.rootSide f := by + rw [mem_rootSide, reaches_root_iff] + exact ⟨T.root_mem, T.ne_root_of_mem_edges hf⟩ + +private theorem iterate_update_root {v : ι} [DecidableEq ι] (p : ι → ι) : + ∀ {n : ℕ} {x : ι}, p^[n] x = v → (fun w ↦ if w = v then v else p w)^[n] x = v + | 0, _, rfl => rfl + | n + 1, x, h => by + rw [Function.iterate_succ_apply] + by_cases hxv : x = v + · subst hxv + simp only [↓reduceIte] + exact Function.iterate_fixed (by simp) n + · simp only [hxv, ↓reduceIte] + rw [Function.iterate_succ_apply] at h + exact iterate_update_root p h + +/-- The maximal subtree `T^v` of `T` with root `v` as a `RootedTree`. -/ +@[expose] noncomputable def subtree (v : ι) (hv : v ∈ T.verts) : RootedTree ι where + verts := T.subtreeAt v + root := v + parent := by classical exact fun w ↦ if w = v then v else T.parent w + root_mem := T.self_mem_subtreeAt hv + parent_mem w hw := by + classical + split_ifs with hwv + · exact T.self_mem_subtreeAt hv + · exact T.mem_subtreeAt.2 + (((T.mem_subtreeAt.1 hw).ne_imp_mem_edges_and_reaches_parent T (Ne.symm hwv)).2) + parent_root := by classical simp + exists_iterate_eq_root w hw := by + classical + obtain ⟨_, n, hn⟩ := T.mem_subtreeAt.1 hw + exact ⟨n, iterate_update_root T.parent hn⟩ + +@[simp] +theorem subtree_verts (v : ι) (hv : v ∈ T.verts) : (T.subtree v hv).verts = T.subtreeAt v := rfl + +@[simp] +theorem subtree_root (v : ι) (hv : v ∈ T.verts) : (T.subtree v hv).root = v := rfl + +theorem subtree_parent_of_ne (v : ι) (hv : v ∈ T.verts) {w : ι} (hw : w ≠ v) : + (T.subtree v hv).parent w = T.parent w := by + classical simp [subtree, hw] + +theorem mem_subtree_edges {v f : ι} (hv : v ∈ T.verts) : + f ∈ (T.subtree v hv).edges ↔ f ≠ v ∧ T.Reaches v f := by + rw [mem_edges, subtree_root, subtree_verts, mem_subtreeAt] + +/-! ### Component roots, components of `T \ F`, and contractions -/ + +theorem IsComponentRoot.reaches {F : Set ι} {y x : ι} (h : T.IsComponentRoot F y x) : + T.Reaches y x := + h.1 + +theorem IsComponentRoot.verts_left {F : Set ι} {y x : ι} (h : T.IsComponentRoot F y x) : + y ∈ T.verts := + h.1.verts_left T + +theorem IsComponentRoot.verts_right {F : Set ι} {y x : ι} (h : T.IsComponentRoot F y x) : + x ∈ T.verts := + h.1.verts_right T + +theorem IsComponentRoot.root_or_mem {F : Set ι} {y x : ι} (h : T.IsComponentRoot F y x) : + y = T.root ∨ y ∈ F := + h.2.1 + +theorem IsComponentRoot.notMem_of_reaches {F : Set ι} {y x g : ι} (h : T.IsComponentRoot F y x) + (hgy : g ≠ y) (hyg : T.Reaches y g) (hgx : T.Reaches g x) : g ∉ F := + h.2.2 g hgy hyg hgx + +/-- Each vertex of `T` has at most one component root in `T \ F`. -/ +theorem IsComponentRoot.unique {F : Set ι} {y₁ y₂ x : ι} + (h₁ : T.IsComponentRoot F y₁ x) (h₂ : T.IsComponentRoot F y₂ x) : y₁ = y₂ := by + rcases h₁.reaches.total_of_reaches T h₂.reaches with h12 | h21 + · by_contra hne + have hy₂_not_F : y₂ ∉ F := h₁.notMem_of_reaches T (Ne.symm hne) h12 h₂.reaches + have hy₂_ne_root : y₂ ≠ T.root := by + rintro rfl + exact hne (T.reaches_root_iff.1 h12) + rcases h₂.root_or_mem with hroot | hF + · exact hy₂_ne_root hroot + · exact hy₂_not_F hF + · by_contra hne + have hy₁_not_F : y₁ ∉ F := h₂.notMem_of_reaches T hne h21 h₁.reaches + have hy₁_ne_root : y₁ ≠ T.root := by + rintro rfl + exact hne (T.reaches_root_iff.1 h21).symm + rcases h₁.root_or_mem with hroot | hF + · exact hy₁_ne_root hroot + · exact hy₁_not_F hF + +/-- Any vertex `y ∈ T.verts` with `y = T.root ∨ y ∈ F` is the root of its own component. -/ +theorem isComponentRoot_self {F : Set ι} {y : ι} (hy : y ∈ T.verts) (hyF : y = T.root ∨ y ∈ F) : + T.IsComponentRoot F y y := by + refine ⟨T.reaches_refl hy, hyF, fun g hgy hyg hgy' ↦ ?_⟩ + exact absurd (hyg.antisymm T hgy').symm hgy + +@[simp] +theorem isComponentRoot_root (F : Set ι) : T.IsComponentRoot F T.root T.root := + T.isComponentRoot_self T.root_mem (Or.inl rfl) + +/-- If `x` is neither the root nor in `F`, it lies in the same component of `T \ F` as its +parent. -/ +theorem IsComponentRoot.of_parent {F : Set ι} {y x : ι} (hx : x ∈ T.verts) (hxF : x ∉ F) + (hxr : x ≠ T.root) (hp : T.IsComponentRoot F y (T.parent x)) : + T.IsComponentRoot F y x := by + refine ⟨hp.reaches.trans T (T.reaches_parent hx), hp.root_or_mem, fun g hgy hyg hgx ↦ ?_⟩ + rcases hgx.eq_or_reaches_parent T with rfl | hgp + · exact hxF + · exact hp.notMem_of_reaches T hgy hyg hgp + +/-- If `x` has component root `y` and `x ≠ y`, then `x` is an edge not in `F` and `T.parent x` +has the same component root `y`. -/ +theorem IsComponentRoot.parent {F : Set ι} {y x : ι} (h : T.IsComponentRoot F y x) (hne : x ≠ y) : + x ∈ T.edges ∧ x ∉ F ∧ T.IsComponentRoot F y (T.parent x) := by + obtain ⟨hxe, hyp⟩ := h.reaches.ne_imp_mem_edges_and_reaches_parent T hne.symm + refine ⟨hxe, h.notMem_of_reaches T hne h.reaches (T.reaches_refl (h.verts_right T)), ?_⟩ + refine ⟨hyp, h.root_or_mem, fun g hgy hyg hgp ↦ ?_⟩ + exact h.notMem_of_reaches T hgy hyg (hgp.trans T (T.reaches_parent (h.verts_right T))) + +/-- Any vertex on the directed path from a component root `y` to `x` also has component root `y`. -/ +theorem IsComponentRoot.intermediate {F : Set ι} {y g x : ι} (h : T.IsComponentRoot F y x) + (hyg : T.Reaches y g) (hgx : T.Reaches g x) : T.IsComponentRoot F y g := + ⟨hyg, h.root_or_mem, fun _ hzy hyz hzg ↦ h.notMem_of_reaches T hzy hyz (hzg.trans T hgx)⟩ + +private theorem exists_isComponentRoot_aux (F : Set ι) : + ∀ (n : ℕ) {x : ι}, x ∈ T.verts → T.parent^[n] x = T.root → ∃ y, T.IsComponentRoot F y x + | 0, x, _, h0 => ⟨T.root, h0 ▸ T.isComponentRoot_root F⟩ + | n + 1, x, hx, hn => by + by_cases hxF : x = T.root ∨ x ∈ F + · exact ⟨x, T.isComponentRoot_self hx hxF⟩ + · push Not at hxF + rw [Function.iterate_succ_apply] at hn + obtain ⟨y, hy⟩ := exists_isComponentRoot_aux F n (T.parent_mem x hx) hn + exact ⟨y, hy.of_parent T hx hxF.2 hxF.1⟩ + +/-- Every vertex of `T` has a component root in `T \ F`. -/ +theorem exists_isComponentRoot (F : Set ι) {x : ι} (hx : x ∈ T.verts) : + ∃ y, T.IsComponentRoot F y x := by + obtain ⟨n, hn⟩ := T.exists_iterate_eq_root x hx + exact exists_isComponentRoot_aux T F n hx hn + +@[simp] +theorem mem_componentAt {F : Set ι} {y x : ι} : + x ∈ T.componentAt F y ↔ T.IsComponentRoot F y x := by + classical + simp only [componentAt, Finset.mem_filter, and_iff_right_iff_imp] + exact IsComponentRoot.verts_right T + +theorem componentAt_subset_verts (F : Set ι) (y : ι) : T.componentAt F y ⊆ T.verts := by + intro x hx + exact (T.mem_componentAt.1 hx).verts_right T + +theorem self_mem_componentAt {F : Set ι} {y : ι} (hy : y ∈ T.verts) (hyF : y = T.root ∨ y ∈ F) : + y ∈ T.componentAt F y := + T.mem_componentAt.2 (T.isComponentRoot_self hy hyF) + +theorem disjoint_componentAt {F : Set ι} {y₁ y₂ : ι} (hne : y₁ ≠ y₂) : + Disjoint (T.componentAt F y₁) (T.componentAt F y₂) := by + classical + rw [Finset.disjoint_left] + intro x hx₁ hx₂ + exact hne ((T.mem_componentAt.1 hx₁).unique T (T.mem_componentAt.1 hx₂)) + +/-- The component of `T \ F` with root `y` as a `RootedTree`. -/ +@[expose] noncomputable def componentTree (F : Set ι) (y : ι) (hy : y ∈ T.verts) + (hyF : y = T.root ∨ y ∈ F) : RootedTree ι where + verts := T.componentAt F y + root := y + parent := by classical exact fun x ↦ if x = y then y else T.parent x + root_mem := T.self_mem_componentAt hy hyF + parent_mem x hx := by + classical + split_ifs with hxy + · exact T.self_mem_componentAt hy hyF + · exact T.mem_componentAt.2 (((T.mem_componentAt.1 hx).parent T hxy).2.2) + parent_root := by classical simp + exists_iterate_eq_root x hx := by + classical + obtain ⟨_, n, hn⟩ := (T.mem_componentAt.1 hx).reaches + exact ⟨n, iterate_update_root T.parent hn⟩ + +@[simp] +theorem componentTree_verts (F : Set ι) (y : ι) (hy : y ∈ T.verts) (hyF : y = T.root ∨ y ∈ F) : + (T.componentTree F y hy hyF).verts = T.componentAt F y := rfl + +@[simp] +theorem componentTree_root (F : Set ι) (y : ι) (hy : y ∈ T.verts) (hyF : y = T.root ∨ y ∈ F) : + (T.componentTree F y hy hyF).root = y := rfl + +theorem componentTree_parent_of_ne (F : Set ι) (y : ι) (hy : y ∈ T.verts) + (hyF : y = T.root ∨ y ∈ F) {x : ι} (hx : x ≠ y) : + (T.componentTree F y hy hyF).parent x = T.parent x := by + classical simp [componentTree, hx] + +/-- A vertex `f` is an edge of `T.componentTree F y` if and only if `f ∈ T.edges`, `f ∉ F`, and +`T.parent f` belongs to the component at `y`. -/ +theorem mem_componentTree_edges_iff (F : Set ι) (y : ι) (hy : y ∈ T.verts) + (hyF : y = T.root ∨ y ∈ F) {f : ι} : + f ∈ (T.componentTree F y hy hyF).edges ↔ + f ∈ T.edges ∧ f ∉ F ∧ T.parent f ∈ (T.componentTree F y hy hyF).verts := by + rw [mem_edges, componentTree_root, componentTree_verts, mem_componentAt, mem_componentAt] + constructor + · rintro ⟨hfy, hf⟩ + exact hf.parent T hfy + · rintro ⟨hfe, hfF, hfp⟩ + have hfy : f ≠ y := by + rintro rfl + rcases hyF with hroot | hF + · exact T.ne_root_of_mem_edges hfe hroot + · exact hfF hF + exact ⟨hfy, hfp.of_parent T (T.mem_verts_of_mem_edges hfe) hfF (T.ne_root_of_mem_edges hfe)⟩ + +private theorem iterate_componentTree_parent_reaches (F : Set ι) (y : ι) (hy : y ∈ T.verts) + (hyF : y = T.root ∨ y ∈ F) {w : ι} (hw : w ∈ T.verts) : + ∀ n : ℕ, T.Reaches ((T.componentTree F y hy hyF).parent^[n] w) w + | 0 => T.reaches_refl hw + | n + 1 => by + rw [Function.iterate_succ_apply] + classical + change T.Reaches ((fun x ↦ if x = y then y else T.parent x)^[n] + (if w = y then y else T.parent w)) w + split_ifs with hwy + · subst hwy + have hfix : (fun x ↦ if x = w then w else T.parent x)^[n] w = w := + Function.iterate_fixed (by simp) n + rw [hfix] + exact T.reaches_refl hw + · exact (iterate_componentTree_parent_reaches F y hy hyF (T.parent_mem w hw) n).trans T + (T.reaches_parent hw) + +private theorem iterate_parent_eq_in_componentTree (F : Set ι) (y : ι) (hy : y ∈ T.verts) + (hyF : y = T.root ∨ y ∈ F) : + ∀ {n : ℕ} {v w : ι}, T.IsComponentRoot F y v → T.parent^[n] w = v → + (T.componentTree F y hy hyF).parent^[n] w = v + | 0, _, _, _, rfl => rfl + | n + 1, v, w, hv, h => by + rw [Function.iterate_succ_apply] at h ⊢ + by_cases hwy : w = y + · have hvy : v = y := by + refine (hv.reaches.antisymm T ⟨hv.verts_left T, n + 1, ?_⟩).symm + rw [← hwy, Function.iterate_succ_apply, h] + rw [hwy, hvy] + have hfix := Function.iterate_fixed (T.componentTree F y hy hyF).parent_root (n + 1) + rw [Function.iterate_succ_apply] at hfix + exact hfix + · rw [T.componentTree_parent_of_ne F y hy hyF hwy] + exact iterate_parent_eq_in_componentTree F y hy hyF hv h + +/-- Within a component of `T \ F`, reachability in the component tree agrees with reachability in +`T`. -/ +theorem componentTree_reaches_iff (F : Set ι) (y : ι) (hy : y ∈ T.verts) + (hyF : y = T.root ∨ y ∈ F) {v w : ι} + (hv : v ∈ (T.componentTree F y hy hyF).verts) : + (T.componentTree F y hy hyF).Reaches v w ↔ + w ∈ (T.componentTree F y hy hyF).verts ∧ T.Reaches v w := by + constructor + · rintro ⟨hw, n, rfl⟩ + have hwT : w ∈ T.verts := T.componentAt_subset_verts F y hw + exact ⟨hw, iterate_componentTree_parent_reaches T F y hy hyF hwT n⟩ + · rintro ⟨hw, _, n, rfl⟩ + refine ⟨hw, n, ?_⟩ + exact iterate_parent_eq_in_componentTree T F y hy hyF (T.mem_componentAt.1 hv) rfl + +/-- If `v` precedes `w` in `T.componentTree F y` with respect to `e ↦ φ e - 1`, where `F` is the +set of edges with `φ e = 0`, then `v` precedes `w` in `T` with respect to `φ`. -/ +theorem componentTree_precedes {φ : ι → ℕ} {F : Set ι} + (hF : ∀ e ∈ T.edges, e ∈ F ↔ φ e = 0) (y : ι) (hy : y ∈ T.verts) + (hyF : y = T.root ∨ y ∈ F) {v w : ι} (hv : v ∈ (T.componentTree F y hy hyF).verts) : + (T.componentTree F y hy hyF).Precedes (fun e ↦ φ e - 1) v w → T.Precedes φ v w := by + rintro ⟨hvy, hvwR, hφvw, hpath⟩ + dsimp only at hφvw + have hve_comp : v ∈ (T.componentTree F y hy hyF).edges := + (T.componentTree F y hy hyF).mem_edges.2 ⟨hvy, hv⟩ + obtain ⟨hve, hvF, -⟩ := (T.mem_componentTree_edges_iff F y hy hyF).1 hve_comp + obtain ⟨hw_comp, hvwT⟩ := (T.componentTree_reaches_iff F y hy hyF hv).1 hvwR + have hwy : w ≠ y := by + intro hwy_eq + rw [hwy_eq] at hvwR + exact hvy ((T.componentTree F y hy hyF).reaches_root_iff.1 hvwR) + have hwe_comp : w ∈ (T.componentTree F y hy hyF).edges := + (T.componentTree F y hy hyF).mem_edges.2 ⟨hwy, hw_comp⟩ + obtain ⟨hwe, hwF, -⟩ := (T.mem_componentTree_edges_iff F y hy hyF).1 hwe_comp + have hφv : φ v ≠ 0 := mt (hF v hve).2 hvF + have hφw : φ w ≠ 0 := mt (hF w hwe).2 hwF + refine ⟨T.ne_root_of_mem_edges hve, hvwT, by omega, fun g hgv hvg hgw ↦ ?_⟩ + have hg_comp : g ∈ (T.componentTree F y hy hyF).verts := by + rw [componentTree_verts, mem_componentAt] + exact (T.mem_componentAt.1 hw_comp).intermediate T + (((T.mem_componentAt.1 hv).reaches).trans T hvg) hgw + have hvgR : (T.componentTree F y hy hyF).Reaches v g := + (T.componentTree_reaches_iff F y hy hyF hv).2 ⟨hg_comp, hvg⟩ + have hgy : g ≠ y := by + intro hgy_eq + rw [hgy_eq] at hvgR + exact hvy ((T.componentTree F y hy hyF).reaches_root_iff.1 hvgR) + have hge_comp : g ∈ (T.componentTree F y hy hyF).edges := + (T.componentTree F y hy hyF).mem_edges.2 ⟨hgy, hg_comp⟩ + obtain ⟨hge, hgF, -⟩ := (T.mem_componentTree_edges_iff F y hy hyF).1 hge_comp + have hφg : φ g ≠ 0 := mt (hF g hge).2 hgF + have hgwR : (T.componentTree F y hy hyF).Reaches g w := + (T.componentTree_reaches_iff F y hy hyF hg_comp).2 ⟨hw_comp, hgw⟩ + have hle := hpath g hgv hvgR hgwR + dsimp only at hle + omega + +/-- The root of the component of `T \ F` containing `x` (or `T.root` if `x ∉ T.verts`). -/ +noncomputable def compRoot (F : Set ι) (x : ι) : ι := by + classical exact if hx : x ∈ T.verts then (T.exists_isComponentRoot F hx).choose else T.root + +theorem compRoot_spec (F : Set ι) {x : ι} (hx : x ∈ T.verts) : + T.IsComponentRoot F (T.compRoot F x) x := by + classical + simp only [compRoot, hx, ↓reduceDIte] + exact (T.exists_isComponentRoot F hx).choose_spec + +theorem compRoot_eq_iff (F : Set ι) {x y : ι} (hx : x ∈ T.verts) : + T.compRoot F x = y ↔ T.IsComponentRoot F y x := + ⟨fun h ↦ h ▸ T.compRoot_spec F hx, fun h ↦ (T.compRoot_spec F hx).unique T h⟩ + +@[simp] +theorem compRoot_root (F : Set ι) : T.compRoot F T.root = T.root := + (T.compRoot_eq_iff F T.root_mem).2 (T.isComponentRoot_root F) + +theorem compRoot_mem (F : Set ι) {x : ι} (hx : x ∈ T.verts) : + T.compRoot F x = T.root ∨ T.compRoot F x ∈ F ∩ T.edges := by + have h := T.compRoot_spec F hx + rcases h.root_or_mem with hroot | hF + · exact Or.inl hroot + · by_cases hr : T.compRoot F x = T.root + · exact Or.inl hr + · exact Or.inr ⟨hF, T.mem_edges.2 ⟨hr, h.verts_left T⟩⟩ + +private theorem iterate_compRoot_parent_eq_root (F : Set ι) : + ∀ (n : ℕ) {v : ι}, v ∈ T.verts → T.parent^[n] v = T.root → + (fun x ↦ T.compRoot F (T.parent x))^[n] v = T.root + | 0, _, _, h0 => h0 + | n + 1, v, hv, hn => by + rw [Function.iterate_succ_apply] + have hpv : T.parent v ∈ T.verts := T.parent_mem v hv + have hspec := T.compRoot_spec F hpv + have hw : T.compRoot F (T.parent v) ∈ T.verts := hspec.verts_left T + obtain ⟨_, k, hk⟩ := hspec.reaches + have hnw : T.parent^[n] (T.compRoot F (T.parent v)) = T.root := by + rw [← hk, ← Function.iterate_add_apply, add_comm, Function.iterate_add_apply, + ← Function.iterate_succ_apply T.parent n v, hn, T.iterate_parent_root] + exact iterate_compRoot_parent_eq_root F n hw hnw + +/-- The contraction of `T` onto `F` exists. -/ +theorem exists_isContraction (F : Set ι) (_hF : F ⊆ T.edges) : + ∃ S : RootedTree ι, T.IsContraction F S := by + classical + refine ⟨{ + verts := insert T.root (T.edges.filter (· ∈ F)) + root := T.root + parent := fun x ↦ T.compRoot F (T.parent x) + root_mem := Finset.mem_insert_self T.root _ + parent_mem := fun v hv ↦ by + have hvT : v ∈ T.verts := by + rcases Finset.mem_insert.1 hv with rfl | hv' + · exact T.root_mem + · exact T.edges_subset_verts (Finset.mem_of_mem_filter v hv') + rcases T.compRoot_mem F (T.parent_mem v hvT) with hr | ⟨hF', hE'⟩ + · exact Finset.mem_insert.2 (Or.inl hr) + · exact Finset.mem_insert.2 (Or.inr (Finset.mem_filter.2 ⟨hE', hF'⟩)) + parent_root := by rw [T.parent_root, T.compRoot_root] + exists_iterate_eq_root := fun v hv ↦ by + have hvT : v ∈ T.verts := by + rcases Finset.mem_insert.1 hv with rfl | hv' + · exact T.root_mem + · exact T.edges_subset_verts (Finset.mem_of_mem_filter v hv') + obtain ⟨n, hn⟩ := T.exists_iterate_eq_root v hvT + exact ⟨n, iterate_compRoot_parent_eq_root T F n hvT hn⟩ + }, ?_⟩ + refine ⟨?_, rfl, fun f hf ↦ ?_⟩ + · ext x + simp only [Finset.mem_coe, Finset.mem_insert, Finset.mem_filter, Set.mem_insert_iff, + Set.mem_inter_iff, and_comm] + · have hfT : f ∈ T.verts := by + rcases Finset.mem_insert.1 (Finset.mem_of_mem_erase hf) with rfl | hf' + · exact T.root_mem + · exact T.edges_subset_verts (Finset.mem_of_mem_filter f hf') + exact T.compRoot_spec F (T.parent_mem f hfT) + +/-! ### Lemmas about `IsContraction` -/ + +theorem IsContraction.mem_verts_iff {F : Set ι} {S : RootedTree ι} (hS : T.IsContraction F S) + {v : ι} : v ∈ S.verts ↔ v = T.root ∨ v ∈ F ∧ v ∈ T.edges := by + rw [← Finset.mem_coe, hS.verts_eq, Set.mem_insert_iff, Set.mem_inter_iff, Finset.mem_coe] + +theorem IsContraction.verts_subset {F : Set ι} {S : RootedTree ι} (hS : T.IsContraction F S) : + S.verts ⊆ T.verts := by + intro v hv + rcases hS.mem_verts_iff.1 hv with rfl | ⟨-, hve⟩ + · exact T.root_mem + · exact T.edges_subset_verts hve + +theorem IsContraction.mem_edges_iff {F : Set ι} {S : RootedTree ι} (hS : T.IsContraction F S) + {v : ι} : v ∈ S.edges ↔ v ∈ F ∧ v ∈ T.edges := by + rw [S.mem_edges, hS.root_eq, hS.mem_verts_iff] + constructor + · rintro ⟨hne, rfl | h⟩ + · exact absurd rfl hne + · exact h + · rintro ⟨hvF, hve⟩ + exact ⟨T.ne_root_of_mem_edges hve, Or.inr ⟨hvF, hve⟩⟩ + +theorem IsContraction.reaches_parent_in_tree {F : Set ι} {S : RootedTree ι} + (hS : T.IsContraction F S) {v : ι} (hv : v ∈ S.verts) : T.Reaches (S.parent v) v := by + by_cases hvr : v = S.root + · rw [hvr, S.parent_root, hS.root_eq] + exact T.reaches_refl T.root_mem + · have hve : v ∈ S.edges := S.mem_edges.2 ⟨hvr, hv⟩ + exact (hS.parent_eq v hve).reaches.trans T (T.reaches_parent (hS.verts_subset T hv)) + +private theorem IsContraction.iterate_reaches {F : Set ι} {S : RootedTree ι} + (hS : T.IsContraction F S) {w : ι} (hw : w ∈ S.verts) : + ∀ n : ℕ, T.Reaches (S.parent^[n] w) w + | 0 => T.reaches_refl (hS.verts_subset T hw) + | n + 1 => by + rw [Function.iterate_succ_apply'] + exact (hS.reaches_parent_in_tree T (S.iterate_parent_mem hw n)).trans T + (hS.iterate_reaches hw n) + +/-- Reachability in a contraction `S` of `T` implies reachability in `T`. -/ +theorem IsContraction.reaches_imp {F : Set ι} {S : RootedTree ι} (hS : T.IsContraction F S) + {v w : ι} (h : S.Reaches v w) : T.Reaches v w := by + obtain ⟨hw, n, rfl⟩ := h + exact hS.iterate_reaches T hw n + +end RootedTree + +/-! ### Lemmas about `IsRich` -/ + +/-- A subset of an `M`-rich set is `M`-rich. -/ +theorem IsRich.mono {M : SimpleGraph ι} {X X' : Set ι} (h : IsRich M X) (hsub : X' ⊆ X) : + IsRich M X' := + fun Y hY hInd ↦ h Y (hY.trans hsub) hInd + +/-- The union of two `M`-rich sets is `M`-rich. -/ +theorem IsRich.union {M : SimpleGraph ι} {A B : Set ι} (hA : IsRich M A) (hB : IsRich M B) : + IsRich M (A ∪ B) := by + intro Y hY hInd + have hYA : (Y ∩ A).Finite := hA (Y ∩ A) Set.inter_subset_right (hInd.mono Set.inter_subset_left) + have hYB : (Y ∩ B).Finite := hB (Y ∩ B) Set.inter_subset_right (hInd.mono Set.inter_subset_left) + have hYeq : Y = (Y ∩ A) ∪ (Y ∩ B) := by + ext x + simp only [Set.mem_union, Set.mem_inter_iff] + exact ⟨fun hx ↦ (hY hx).imp (fun ha ↦ ⟨hx, ha⟩) (fun hb ↦ ⟨hx, hb⟩), + fun h ↦ h.elim And.left And.left⟩ + rw [hYeq] + exact hYA.union hYB + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/TreeLemma/Lemma21.lean b/LeanPool/GraphMinor/GM04/TreeLemma/Lemma21.lean new file mode 100644 index 0000000000..7f65252f98 --- /dev/null +++ b/LeanPool/GraphMinor/GM04/TreeLemma/Lemma21.lean @@ -0,0 +1,537 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.TreeLemma.Basic +import Mathlib.Data.Nat.Find +import Mathlib.Order.Minimal + +/-! +# A lemma about trees: Graph Minors IV, (2.1) + +This file formalizes Graph Minors IV, (2.1) (pages 230–231), the minimal bad sequence lemma for a +countable sequence of disjoint rooted trees `T₁, T₂, …` and a graph `M` on their vertices. + +Following the paper: +* `IsIncreasing T z`: a sequence `z₁, z₂, …` of vertices of `⋃ᵢ V(Tᵢ)` is *increasing* if `i < i'` + whenever `j < j'`, `z_j ∈ V(Tᵢ)`, and `z_{j'} ∈ V(T_{i'})`. +* `V₀ T`: the non-root vertices `⋃ᵢ V(Tᵢ) \ {o(T₁), o(T₂), …}`. +* `IsSection T M z`: a *section* is an increasing sequence in `V₀ T` whose range is `M`-stable. +* If there is no section, `V₀ T` is `M`-rich and `X = {o(T₁), o(T₂), …}` satisfies (2.1). +* If there is a section, we define `minimalSectionSeq T M` (`x₁, x₂, …`) inductively by choosing at + each step a candidate whose subtree has the minimum number of vertices, and prove claims (1)–(5) + of the paper (`lemma_2_1_claim_1` through `lemma_2_1_claim_5`). +-/ + +public section + +namespace GraphMinor.GM04 + +variable {ι : Type*} + +/-! ### Disjoint sequences of trees and increasing sequences -/ + +/-- In a sequence of pairwise disjoint trees, each vertex belongs to at most one tree. -/ +theorem tree_eq_of_mem_verts {T : ℕ → RootedTree ι} + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + {i j : ℕ} {v : ι} (hi : v ∈ (T i).verts) (hj : v ∈ (T j).verts) : i = j := by + by_contra hne + exact Finset.disjoint_left.1 (hdisj hne) hi hj + +/-- A sequence `z : ℕ → ι` is *increasing* with respect to `T` (Graph Minors IV, proof of (2.1), +page 230) if every term belongs to some `V(Tᵢ)` and `i < i'` whenever `j < j'`, `z j ∈ V(Tᵢ)`, +and `z j' ∈ V(T_{i'})`. -/ +def IsIncreasing (T : ℕ → RootedTree ι) (z : ℕ → ι) : Prop := + (∀ j, ∃ i, z j ∈ (T i).verts) ∧ + ∀ ⦃j j' i i'⦄, j < j' → z j ∈ (T i).verts → z j' ∈ (T i').verts → i < i' + +theorem IsIncreasing.le_of_le {T : ℕ → RootedTree ι} + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + {z : ℕ → ι} (hz : IsIncreasing T z) {j j' i i' : ℕ} (hjj' : j ≤ j') + (hi : z j ∈ (T i).verts) (hi' : z j' ∈ (T i').verts) : i ≤ i' := by + rcases eq_or_lt_of_le hjj' with rfl | hlt + · exact le_of_eq (tree_eq_of_mem_verts hdisj hi hi') + · exact le_of_lt (hz.2 hlt hi hi') + +theorem IsIncreasing.index_le_of_tree_le {T : ℕ → RootedTree ι} {z : ℕ → ι} + (hz : IsIncreasing T z) {j j' i i' : ℕ} + (hi : z j ∈ (T i).verts) (hi' : z j' ∈ (T i').verts) (hii' : i ≤ i') : j ≤ j' := by + by_contra hlt + have : i' < i := hz.2 (Nat.lt_of_not_ge hlt) hi' hi + omega + +theorem IsIncreasing.injective {T : ℕ → RootedTree ι} + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + {z : ℕ → ι} (hz : IsIncreasing T z) : Function.Injective z := by + intro j₁ j₂ hjeq + rcases lt_trichotomy j₁ j₂ with hlt | rfl | hgt + · obtain ⟨i₁, hi₁⟩ := hz.1 j₁ + obtain ⟨i₂, hi₂⟩ := hz.1 j₂ + have hlt_i : i₁ < i₂ := hz.2 hlt hi₁ hi₂ + have heq_i : i₁ = i₂ := tree_eq_of_mem_verts hdisj hi₁ (hjeq ▸ hi₂) + omega + · rfl + · obtain ⟨i₁, hi₁⟩ := hz.1 j₁ + obtain ⟨i₂, hi₂⟩ := hz.1 j₂ + have hlt_i : i₂ < i₁ := hz.2 hgt hi₂ hi₁ + have heq_i : i₁ = i₂ := tree_eq_of_mem_verts hdisj hi₁ (hjeq ▸ hi₂) + omega + +theorem IsIncreasing.infinite_range {T : ℕ → RootedTree ι} + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + {z : ℕ → ι} (hz : IsIncreasing T z) : (Set.range z).Infinite := + Set.infinite_range_of_injective (hz.injective hdisj) + +theorem IsIncreasing.range_subset {T : ℕ → RootedTree ι} {z : ℕ → ι} (hz : IsIncreasing T z) : + Set.range z ⊆ ⋃ i, ((T i).verts : Set ι) := by + rintro _ ⟨j, rfl⟩ + obtain ⟨i, hi⟩ := hz.1 j + exact Set.mem_iUnion.2 ⟨i, hi⟩ + +theorem IsIncreasing.subsingleton_inter {T : ℕ → RootedTree ι} {z : ℕ → ι} + (hz : IsIncreasing T z) (i : ℕ) : (Set.range z ∩ (T i).verts).Subsingleton := by + rintro _ ⟨⟨j₁, rfl⟩, hj₁⟩ _ ⟨⟨j₂, rfl⟩, hj₂⟩ + rcases lt_trichotomy j₁ j₂ with hlt | rfl | hgt + · exact absurd (hz.2 hlt hj₁ hj₂) (lt_irrefl i) + · rfl + · exact absurd (hz.2 hgt hj₂ hj₁) (lt_irrefl i) + +private theorem exists_tree_inter_nonempty_ge {T : ℕ → RootedTree ι} {Y : Set ι} + (hY_inf : Y.Infinite) (hY_sub : Y ⊆ ⋃ i, ((T i).verts : Set ι)) (m : ℕ) : + ∃ i, m ≤ i ∧ (Y ∩ (T i).verts).Nonempty := by + have hfin : (⋃ i ∈ Finset.range m, (Y ∩ (T i).verts)).Finite := by + refine Finset.finite_toSet (Finset.range m) |>.biUnion fun i _ ↦ ?_ + exact (T i).verts.finite_toSet.subset Set.inter_subset_right + obtain ⟨y, hyY, hy_not_mem⟩ := Set.Infinite.exists_notMem_finite hY_inf hfin + obtain ⟨i, hi⟩ := Set.mem_iUnion.1 (hY_sub hyY) + refine ⟨i, ?_, y, hyY, hi⟩ + by_contra hlt + apply hy_not_mem + exact Set.mem_biUnion (Finset.mem_range.2 (Nat.lt_of_not_ge hlt)) ⟨hyY, hi⟩ + +open Classical in +private noncomputable def nextTreeIdx (T : ℕ → RootedTree ι) (Y : Set ι) + (hY_inf : Y.Infinite) (hY_sub : Y ⊆ ⋃ i, ((T i).verts : Set ι)) : ℕ → ℕ + | 0 => Nat.find (exists_tree_inter_nonempty_ge hY_inf hY_sub 0) + | k + 1 => + Nat.find (exists_tree_inter_nonempty_ge hY_inf hY_sub (nextTreeIdx T Y hY_inf hY_sub k + 1)) + +private theorem nextTreeIdx_lt_succ {T : ℕ → RootedTree ι} {Y : Set ι} + (hY_inf : Y.Infinite) (hY_sub : Y ⊆ ⋃ i, ((T i).verts : Set ι)) (k : ℕ) : + nextTreeIdx T Y hY_inf hY_sub k < nextTreeIdx T Y hY_inf hY_sub (k + 1) := by + classical + simp only [nextTreeIdx] + exact (Nat.find_spec + (exists_tree_inter_nonempty_ge hY_inf hY_sub (nextTreeIdx T Y hY_inf hY_sub k + 1))).1 + +private theorem strictMono_nextTreeIdx {T : ℕ → RootedTree ι} {Y : Set ι} + (hY_inf : Y.Infinite) (hY_sub : Y ⊆ ⋃ i, ((T i).verts : Set ι)) : + StrictMono (nextTreeIdx T Y hY_inf hY_sub) := + strictMono_nat_of_lt_succ (nextTreeIdx_lt_succ hY_inf hY_sub) + +private theorem nextTreeIdx_nonempty {T : ℕ → RootedTree ι} {Y : Set ι} + (hY_inf : Y.Infinite) (hY_sub : Y ⊆ ⋃ i, ((T i).verts : Set ι)) (k : ℕ) : + (Y ∩ (T (nextTreeIdx T Y hY_inf hY_sub k)).verts).Nonempty := by + classical + cases k with + | zero => + simp only [nextTreeIdx] + exact (Nat.find_spec (exists_tree_inter_nonempty_ge hY_inf hY_sub 0)).2 + | succ k => + simp only [nextTreeIdx] + exact (Nat.find_spec + (exists_tree_inter_nonempty_ge hY_inf hY_sub (nextTreeIdx T Y hY_inf hY_sub k + 1))).2 + +private theorem exists_nextTreeIdx_eq_of_lt {T : ℕ → RootedTree ι} {Y : Set ι} + (hY_inf : Y.Infinite) (hY_sub : Y ⊆ ⋃ i, ((T i).verts : Set ι)) : + ∀ (k i : ℕ), i < nextTreeIdx T Y hY_inf hY_sub k → (Y ∩ (T i).verts).Nonempty → + ∃ j < k, nextTreeIdx T Y hY_inf hY_sub j = i + | 0, i, hlt, hne => by + classical + simp only [nextTreeIdx] at hlt + have hmin := Nat.find_min (exists_tree_inter_nonempty_ge hY_inf hY_sub 0) hlt + exact absurd ⟨Nat.zero_le i, hne⟩ hmin + | k + 1, i, hlt, hne => by + classical + simp only [nextTreeIdx] at hlt + have hmin := Nat.find_min + (exists_tree_inter_nonempty_ge hY_inf hY_sub (nextTreeIdx T Y hY_inf hY_sub k + 1)) hlt + have hle : i ≤ nextTreeIdx T Y hY_inf hY_sub k := by + by_contra hgt + exact hmin ⟨Nat.lt_of_not_ge hgt, hne⟩ + rcases eq_or_lt_of_le hle with rfl | hlt' + · exact ⟨k, Nat.lt_succ_self k, rfl⟩ + · obtain ⟨j, hjk, hj⟩ := exists_nextTreeIdx_eq_of_lt hY_inf hY_sub k i hlt' hne + exact ⟨j, Nat.lt_succ_of_lt hjk, hj⟩ + +/-- Every infinite subset `Y ⊆ ⋃ i, V(Tᵢ)` contains an increasing sequence; if furthermore +`Y` meets each `V(Tᵢ)` in at most one vertex, the sequence enumerates all of `Y`. -/ +theorem exists_isIncreasing_of_infinite {T : ℕ → RootedTree ι} + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + {Y : Set ι} (hY_inf : Y.Infinite) (hY_sub : Y ⊆ ⋃ i, ((T i).verts : Set ι)) : + ∃ (z : ℕ → ι) (idx : ℕ → ℕ), StrictMono idx ∧ IsIncreasing T z ∧ + (∀ j, z j ∈ Y ∧ z j ∈ (T (idx j)).verts) ∧ + ((∀ i, (Y ∩ (T i).verts).Subsingleton) → Set.range z = Y) := by + let idx := nextTreeIdx T Y hY_inf hY_sub + have hmono : StrictMono idx := strictMono_nextTreeIdx hY_inf hY_sub + let z : ℕ → ι := fun j ↦ (nextTreeIdx_nonempty hY_inf hY_sub j).choose + have hz_spec : ∀ j, z j ∈ Y ∧ z j ∈ (T (idx j)).verts := + fun j ↦ (nextTreeIdx_nonempty hY_inf hY_sub j).choose_spec + have hinc : IsIncreasing T z := by + refine ⟨fun j ↦ ⟨idx j, (hz_spec j).2⟩, fun j j' i i' hlt hi hi' ↦ ?_⟩ + have hi_eq : i = idx j := tree_eq_of_mem_verts hdisj hi (hz_spec j).2 + have hi'_eq : i' = idx j' := tree_eq_of_mem_verts hdisj hi' (hz_spec j').2 + rw [hi_eq, hi'_eq] + exact hmono hlt + refine ⟨z, idx, hmono, hinc, hz_spec, fun hsub ↦ ?_⟩ + ext y + constructor + · rintro ⟨j, rfl⟩ + exact (hz_spec j).1 + · intro hy + obtain ⟨i, hi⟩ := Set.mem_iUnion.1 (hY_sub hy) + have hlt : i < idx (i + 1) := Nat.lt_of_lt_of_le (Nat.lt_succ_self i) (hmono.id_le (i + 1)) + obtain ⟨j, -, hj⟩ := exists_nextTreeIdx_eq_of_lt hY_inf hY_sub (i + 1) i hlt ⟨y, hy, hi⟩ + refine ⟨j, ?_⟩ + have hzj_verts : z j ∈ (T i).verts := hj ▸ (hz_spec j).2 + exact hsub i ⟨(hz_spec j).1, hzj_verts⟩ ⟨hy, hi⟩ + +/-! ### `V₀`, sections, and the inductive choice of `x₁, x₂, …` -/ + +/-- `V₀ = V(M) - {o(T₁), o(T₂), …}` (Graph Minors IV, proof of (2.1), page 230). -/ +def V₀ (T : ℕ → RootedTree ι) : Set ι := + (⋃ i, ((T i).verts : Set ι)) \ Set.range fun i ↦ (T i).root + +theorem mem_V₀_iff {T : ℕ → RootedTree ι} + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) {v : ι} : + v ∈ V₀ T ↔ ∃ i, v ∈ (T i).edges := by + simp only [V₀, Set.mem_sdiff, Set.mem_iUnion, Finset.mem_coe, Set.mem_range, not_exists, + RootedTree.mem_edges] + constructor + · rintro ⟨⟨i, hvi⟩, hnotroot⟩ + exact ⟨i, fun hr ↦ hnotroot i hr.symm, hvi⟩ + · rintro ⟨i, hne, hvi⟩ + refine ⟨⟨i, hvi⟩, fun k hvk ↦ hne ?_⟩ + have hki : k = i := tree_eq_of_mem_verts hdisj (hvk ▸ (T k).root_mem) hvi + exact (hki ▸ hvk).symm + +/-- A *section* (Graph Minors IV, proof of (2.1), page 231) is an increasing sequence in `V₀` +whose elements form an `M`-stable set. -/ +def IsSection (T : ℕ → RootedTree ι) (M : SimpleGraph ι) (z : ℕ → ι) : Prop := + IsIncreasing T z ∧ (∀ j, z j ∈ V₀ T) ∧ M.IsIndepSet (Set.range z) + +/-- If no sequence of elements of `Y ⊆ V₀` is a section, then `Y` is `M`-rich. -/ +theorem isRich_of_no_section {T : ℕ → RootedTree ι} {M : SimpleGraph ι} + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + {Y : Set ι} (hYV₀ : Y ⊆ V₀ T) (hno : ∀ z : ℕ → ι, (∀ j, z j ∈ Y) → ¬ IsSection T M z) : + IsRich M Y := by + intro Z hZY hZind + by_contra hZinf + have hZsub : Z ⊆ ⋃ i, ((T i).verts : Set ι) := + hZY.trans (hYV₀.trans Set.sdiff_subset) + obtain ⟨z, _, _, hinc, hzZ, -⟩ := exists_isIncreasing_of_infinite hdisj hZinf hZsub + have hzY : ∀ j, z j ∈ Y := fun j ↦ hZY (hzZ j).1 + have hz_range : Set.range z ⊆ Z := by rintro _ ⟨j, rfl⟩; exact (hzZ j).1 + exact hno z hzY ⟨hinc, fun j ↦ hYV₀ (hzY j), hZind.mono hz_range⟩ + +/-- `HasSectionPrefix T M s` says that there is a section whose first `s.length` terms are `s`. -/ +def HasSectionPrefix (T : ℕ → RootedTree ι) (M : SimpleGraph ι) (s : List ι) : Prop := + ∃ z : ℕ → ι, IsSection T M z ∧ ∀ j (hj : j < s.length), z j = s[j] + +/-- Given a prefix `s` of some section, we can extend `s` by a vertex `v` so that `s ++ [v]` is +still a prefix of a section, while no proper descendant `x` of `v` in its tree extends `s` to a +prefix of a section. -/ +private theorem exists_minimal_section_step {T : ℕ → RootedTree ι} {M : SimpleGraph ι} + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + {s : List ι} (hs : HasSectionPrefix T M s) : + ∃ v : ι, HasSectionPrefix T M (s ++ [v]) ∧ + ∀ i, v ∈ (T i).verts → ∀ x ∈ (T i).subtreeAt v, x ≠ v → + ¬ HasSectionPrefix T M (s ++ [x]) := by + obtain ⟨z₀, hz₀_sec, hz₀_pre⟩ := hs + let v₀ := z₀ s.length + obtain ⟨i₀, hi₀⟩ := hz₀_sec.1.1 s.length + have hv₀_cand : HasSectionPrefix T M (s ++ [v₀]) := by + refine ⟨z₀, hz₀_sec, fun j hj ↦ ?_⟩ + rw [List.length_append, List.length_singleton] at hj + rcases Nat.lt_succ_iff_lt_or_eq.1 hj with hlt | rfl + · rw [List.getElem_append_left hlt] + exact hz₀_pre j hlt + · simp [v₀] + let P : ι → Prop := fun v ↦ v ∈ (T i₀).subtreeAt v₀ ∧ HasSectionPrefix T M (s ++ [v]) + obtain ⟨v, ⟨hv_sub, hv_cand⟩, hv_min⟩ := + exists_minimalFor_of_wellFoundedLT P (fun w ↦ ((T i₀).subtreeAt w).card) + ⟨v₀, (T i₀).self_mem_subtreeAt hi₀, hv₀_cand⟩ + refine ⟨v, hv_cand, fun i hvi x hxv hne hxcand ↦ ?_⟩ + have hii₀ : i = i₀ := + tree_eq_of_mem_verts hdisj hvi ((T i₀).subtreeAt_subset_verts v₀ hv_sub) + subst hii₀ + have hreaches_v₀_v : (T i).Reaches v₀ v := (T i).mem_subtreeAt.1 hv_sub + have hreaches_v_x : (T i).Reaches v x := (T i).mem_subtreeAt.1 hxv + have hxP : P x := + ⟨(T i).mem_subtreeAt.2 (hreaches_v₀_v.trans (T i) hreaches_v_x), hxcand⟩ + have hlt_card : ((T i).subtreeAt x).card < ((T i).subtreeAt v).card := + (T i).subtreeAt_card_lt_of_reaches_of_ne hreaches_v_x hne.symm + have hle_card := hv_min hxP (le_of_lt hlt_card) + dsimp only at hle_card + omega + +private noncomputable def chooseNext (T : ℕ → RootedTree ι) (M : SimpleGraph ι) (s : List ι) : ι := + by + classical + exact if h : ∃ v : ι, HasSectionPrefix T M (s ++ [v]) ∧ + ∀ i, v ∈ (T i).verts → ∀ x ∈ (T i).subtreeAt v, x ≠ v → + ¬ HasSectionPrefix T M (s ++ [x]) + then h.choose + else (T 0).root + +private noncomputable def sectionPrefix (T : ℕ → RootedTree ι) (M : SimpleGraph ι) : ℕ → List ι + | 0 => [] + | k + 1 => + sectionPrefix T M k ++ [chooseNext T M (sectionPrefix T M k)] + +/-- The inductively defined sequence `x₁, x₂, …` in the proof of (2.1) (page 231). -/ +noncomputable def minimalSectionSeq (T : ℕ → RootedTree ι) (M : SimpleGraph ι) (k : ℕ) : ι := + chooseNext T M (sectionPrefix T M k) + +private theorem length_sectionPrefix (T : ℕ → RootedTree ι) (M : SimpleGraph ι) : + ∀ k : ℕ, (sectionPrefix T M k).length = k + | 0 => rfl + | k + 1 => by simp [sectionPrefix, length_sectionPrefix T M k] + +private theorem getElem_sectionPrefix (T : ℕ → RootedTree ι) (M : SimpleGraph ι) : + ∀ (k j : ℕ) (hj : j < (sectionPrefix T M k).length), + (sectionPrefix T M k)[j] = minimalSectionSeq T M j + | 0, _, hj => by contradiction + | k + 1, j, hj => by + have hlen : (sectionPrefix T M k).length = k := length_sectionPrefix T M k + rw [length_sectionPrefix] at hj + rcases Nat.lt_succ_iff_lt_or_eq.1 hj with hlt | rfl + · have hlt' : j < (sectionPrefix T M k).length := hlen.symm ▸ hlt + simp only [sectionPrefix, List.getElem_append_left hlt'] + exact getElem_sectionPrefix T M k j hlt' + · simp [sectionPrefix, minimalSectionSeq, hlen] + +private theorem hasSectionPrefix_sectionPrefix {T : ℕ → RootedTree ι} {M : SimpleGraph ι} + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + (hsec : ∃ z, IsSection T M z) : + ∀ k : ℕ, HasSectionPrefix T M (sectionPrefix T M k) + | 0 => by + obtain ⟨z, hz⟩ := hsec + exact ⟨z, hz, fun _ hj ↦ by contradiction⟩ + | k + 1 => by + have hk := hasSectionPrefix_sectionPrefix hdisj hsec k + have hex := exists_minimal_section_step hdisj hk + simp only [sectionPrefix, chooseNext, hex, ↓reduceDIte] + exact hex.choose_spec.1 + +/-- Graph Minors IV, (2.1), claim (1) (page 231): for each `k`, there is a section whose first `k` +terms are `x₀, …, x_{k-1}`. -/ +theorem lemma_2_1_claim_1 {T : ℕ → RootedTree ι} {M : SimpleGraph ι} + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + (hsec : ∃ z, IsSection T M z) (k : ℕ) : + ∃ z : ℕ → ι, IsSection T M z ∧ ∀ j < k, z j = minimalSectionSeq T M j := by + obtain ⟨z, hz, hpre⟩ := hasSectionPrefix_sectionPrefix hdisj hsec k + refine ⟨z, hz, fun j hjk ↦ ?_⟩ + have hjk' : j < (sectionPrefix T M k).length := (length_sectionPrefix T M k).symm ▸ hjk + rw [hpre j hjk', getElem_sectionPrefix T M k j hjk'] + +/-- Graph Minors IV, (2.1), claim (2) (page 231): for each `k`, there is no section whose first +terms are `x₀, …, x_{k-1}, x` for any `x ∈ V(T^{x_k}) - {x_k}`. -/ +theorem lemma_2_1_claim_2 {T : ℕ → RootedTree ι} {M : SimpleGraph ι} + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + (hsec : ∃ z, IsSection T M z) (k i : ℕ) + (hvi : minimalSectionSeq T M k ∈ (T i).verts) + {x : ι} (hx : x ∈ (T i).subtreeAt (minimalSectionSeq T M k)) + (hne : x ≠ minimalSectionSeq T M k) : + ¬ ∃ z : ℕ → ι, IsSection T M z ∧ (∀ j < k, z j = minimalSectionSeq T M j) ∧ z k = x := by + have hk := hasSectionPrefix_sectionPrefix hdisj hsec k + have hex := exists_minimal_section_step hdisj hk + have hchoose : minimalSectionSeq T M k = hex.choose := by + simp only [minimalSectionSeq, chooseNext, hex, ↓reduceDIte] + have hnot : ¬ HasSectionPrefix T M (sectionPrefix T M k ++ [x]) := by + rw [hchoose] at hvi hx hne + exact hex.choose_spec.2 i hvi x hx hne + rintro ⟨z, hz_sec, hz_pre, hzk⟩ + apply hnot + refine ⟨z, hz_sec, fun j hj ↦ ?_⟩ + have hlen : (sectionPrefix T M k).length = k := length_sectionPrefix T M k + rw [List.length_append, hlen, List.length_singleton] at hj + rcases Nat.lt_succ_iff_lt_or_eq.1 hj with hlt | rfl + · have hlt' : j < (sectionPrefix T M k).length := hlen.symm ▸ hlt + rw [List.getElem_append_left hlt', getElem_sectionPrefix T M k j hlt', hz_pre j hlt] + · simp [hlen, hzk] + +/-- Graph Minors IV, (2.1), claim (3) (page 231): `x₁, x₂, …` is a section. -/ +theorem lemma_2_1_claim_3 {T : ℕ → RootedTree ι} {M : SimpleGraph ι} + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + (hsec : ∃ z, IsSection T M z) : + IsSection T M (minimalSectionSeq T M) := by + have hV₀ : ∀ j, minimalSectionSeq T M j ∈ V₀ T := by + intro j + obtain ⟨z, hz, hj⟩ := lemma_2_1_claim_1 hdisj hsec (j + 1) + rw [← hj j (Nat.lt_succ_self j)] + exact hz.2.1 j + have hinc : IsIncreasing T (minimalSectionSeq T M) := by + refine ⟨fun j ↦ Set.mem_iUnion.1 (Set.sdiff_subset (hV₀ j)), + fun j j' i i' hlt hi hi' ↦ ?_⟩ + obtain ⟨z, hz, hj⟩ := lemma_2_1_claim_1 hdisj hsec (j' + 1) + have hzj : z j = minimalSectionSeq T M j := hj j (Nat.lt_succ_of_lt hlt) + have hzj' : z j' = minimalSectionSeq T M j' := hj j' (Nat.lt_succ_self j') + exact hz.1.2 hlt (hzj.symm ▸ hi) (hzj'.symm ▸ hi') + refine ⟨hinc, hV₀, ?_⟩ + rintro _ ⟨j₁, rfl⟩ _ ⟨j₂, rfl⟩ hne + rcases lt_trichotomy j₁ j₂ with hlt | rfl | hgt + · obtain ⟨z, hz, hj⟩ := lemma_2_1_claim_1 hdisj hsec (j₂ + 1) + have hzj₁ : z j₁ = minimalSectionSeq T M j₁ := hj j₁ (Nat.lt_succ_of_lt hlt) + have hzj₂ : z j₂ = minimalSectionSeq T M j₂ := hj j₂ (Nat.lt_succ_self j₂) + rw [← hzj₁, ← hzj₂] + exact hz.2.2 ⟨j₁, rfl⟩ ⟨j₂, rfl⟩ (hzj₁.symm ▸ hzj₂.symm ▸ hne) + · exact absurd rfl hne + · obtain ⟨z, hz, hj⟩ := lemma_2_1_claim_1 hdisj hsec (j₁ + 1) + have hzj₁ : z j₁ = minimalSectionSeq T M j₁ := hj j₁ (Nat.lt_succ_self j₁) + have hzj₂ : z j₂ = minimalSectionSeq T M j₂ := hj j₂ (Nat.lt_succ_of_lt hgt) + rw [← hzj₁, ← hzj₂] + exact hz.2.2 ⟨j₁, rfl⟩ ⟨j₂, rfl⟩ (hzj₁.symm ▸ hzj₂.symm ▸ hne) + +/-- Graph Minors IV, (2.1), claim (4) (page 231): for `j < j'`, if `z` is the head of an edge of +some `Tᵢ` with tail `x_{j'}`, then `x_j` is not `M`-adjacent to `z`. -/ +theorem lemma_2_1_claim_4 {T : ℕ → RootedTree ι} {M : SimpleGraph ι} + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + (hM : ∀ i i', i < i' → ∀ u ∈ (T i).verts, ∀ w ∈ (T i').verts, ∀ v, + M.Adj u w → v ≠ (T i').root → (T i').Reaches v w → M.Adj u v) + (hsec : ∃ z, IsSection T M z) {j j' i : ℕ} (hlt : j < j') + {z : ι} (hz_edge : z ∈ (T i).edges) + (hz_parent : (T i).parent z = minimalSectionSeq T M j') : + ¬ M.Adj (minimalSectionSeq T M j) z := by + have hx_sec := lemma_2_1_claim_3 hdisj hsec + have hz_verts : z ∈ (T i).verts := (T i).mem_verts_of_mem_edges hz_edge + have hxj'_verts : minimalSectionSeq T M j' ∈ (T i).verts := + hz_parent ▸ (T i).parent_mem z hz_verts + obtain ⟨i₀, hxj_verts⟩ := hx_sec.1.1 j + have hi₀_lt_i : i₀ < i := hx_sec.1.2 hlt hxj_verts hxj'_verts + have hxj'_ne_root : minimalSectionSeq T M j' ≠ (T i).root := by + intro hr + exact (hx_sec.2.1 j').2 ⟨i, hr.symm⟩ + have hreaches : (T i).Reaches (minimalSectionSeq T M j') z := + hz_parent ▸ (T i).reaches_parent hz_verts + intro hadj + have hadj_x : M.Adj (minimalSectionSeq T M j) (minimalSectionSeq T M j') := + hM i₀ i hi₀_lt_i _ hxj_verts z hz_verts _ hadj hxj'_ne_root hreaches + have hne : minimalSectionSeq T M j ≠ minimalSectionSeq T M j' := + (hx_sec.1.injective hdisj).ne (ne_of_lt hlt) + exact hx_sec.2.2 ⟨j, rfl⟩ ⟨j', rfl⟩ hne hadj_x + +/-- Graph Minors IV, (2.1), claim (5) (page 231): let `Y` be the set of heads of all edges of +`T₁ ∪ T₂ ∪ ⋯` with tails in `{x₁, x₂, …}`; then no sequence of elements of `Y` is a section. -/ +theorem lemma_2_1_claim_5 {T : ℕ → RootedTree ι} {M : SimpleGraph ι} + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + (hM : ∀ i i', i < i' → ∀ u ∈ (T i).verts, ∀ w ∈ (T i').verts, ∀ v, + M.Adj u w → v ≠ (T i').root → (T i').Reaches v w → M.Adj u v) + (hsec : ∃ z, IsSection T M z) + (y : ℕ → ι) + (hy : ∀ j, ∃ i, y j ∈ (T i).edges ∧ (T i).parent (y j) ∈ Set.range (minimalSectionSeq T M)) : + ¬ IsSection T M y := by + intro hy_sec + have hx_sec := lemma_2_1_claim_3 hdisj hsec + obtain ⟨i₀, hy₀_edge, k, hy₀_parent⟩ := hy 0 + have hy₀_verts : y 0 ∈ (T i₀).verts := (T i₀).mem_verts_of_mem_edges hy₀_edge + have hxk_verts : minimalSectionSeq T M k ∈ (T i₀).verts := + hy₀_parent ▸ (T i₀).parent_mem (y 0) hy₀_verts + let w : ℕ → ι := fun j ↦ if j < k then minimalSectionSeq T M j else y (j - k) + have hw_sec : IsSection T M w := by + have hw_V₀ : ∀ j, w j ∈ V₀ T := by + intro j + dsimp only [w] + split_ifs with hjk + · exact hx_sec.2.1 j + · exact hy_sec.2.1 (j - k) + have hw_inc : IsIncreasing T w := by + refine ⟨fun j ↦ Set.mem_iUnion.1 (Set.sdiff_subset (hw_V₀ j)), + fun j₁ j₂ i₁ i₂ hlt hi₁ hi₂ ↦ ?_⟩ + dsimp only [w] at hi₁ hi₂ + split_ifs at hi₁ hi₂ with hj₁ hj₂ hj₂ + · exact hx_sec.1.2 hlt hi₁ hi₂ + · have hi₁_lt_i₀ : i₁ < i₀ := hx_sec.1.2 hj₁ hi₁ hxk_verts + have hi₀_le_i₂ : i₀ ≤ i₂ := + hy_sec.1.le_of_le hdisj (Nat.zero_le (j₂ - k)) hy₀_verts hi₂ + omega + · omega + · exact hy_sec.1.2 (by omega : j₁ - k < j₂ - k) hi₁ hi₂ + refine ⟨hw_inc, hw_V₀, ?_⟩ + have hadj_lt : ∀ j₁ j₂, j₁ < j₂ → ¬ M.Adj (w j₁) (w j₂) := by + intro j₁ j₂ hlt + dsimp only [w] + split_ifs with hj₁ hj₂ hj₂ + · have hne : minimalSectionSeq T M j₁ ≠ minimalSectionSeq T M j₂ := + (hx_sec.1.injective hdisj).ne (ne_of_lt hlt) + exact hx_sec.2.2 ⟨j₁, rfl⟩ ⟨j₂, rfl⟩ hne + · obtain ⟨i₂, hy_edge, m, hy_parent⟩ := hy (j₂ - k) + have hy_verts : y (j₂ - k) ∈ (T i₂).verts := (T i₂).mem_verts_of_mem_edges hy_edge + have hxm_verts : minimalSectionSeq T M m ∈ (T i₂).verts := + hy_parent ▸ (T i₂).parent_mem _ hy_verts + have hi₀_le_i₂ : i₀ ≤ i₂ := + hy_sec.1.le_of_le hdisj (Nat.zero_le (j₂ - k)) hy₀_verts hy_verts + have hk_le_m : k ≤ m := + hx_sec.1.index_le_of_tree_le hxk_verts hxm_verts hi₀_le_i₂ + exact lemma_2_1_claim_4 hdisj hM hsec (Nat.lt_of_lt_of_le hj₁ hk_le_m) hy_edge + hy_parent.symm + · omega + · have hlt' : j₁ - k < j₂ - k := by omega + have hne : y (j₁ - k) ≠ y (j₂ - k) := (hy_sec.1.injective hdisj).ne (ne_of_lt hlt') + exact hy_sec.2.2 ⟨j₁ - k, rfl⟩ ⟨j₂ - k, rfl⟩ hne + rintro _ ⟨j₁, rfl⟩ _ ⟨j₂, rfl⟩ hne hadj + rcases lt_trichotomy j₁ j₂ with hlt | rfl | hgt + · exact hadj_lt j₁ j₂ hlt hadj + · exact hne rfl + · exact hadj_lt j₂ j₁ hgt hadj.symm + have hy₀_sub : y 0 ∈ (T i₀).subtreeAt (minimalSectionSeq T M k) := + (T i₀).mem_subtreeAt.2 (hy₀_parent ▸ (T i₀).reaches_parent hy₀_verts) + have hy₀_ne : y 0 ≠ minimalSectionSeq T M k := + hy₀_parent ▸ ((T i₀).parent_ne_self hy₀_edge).symm + refine lemma_2_1_claim_2 hdisj hsec k i₀ hxk_verts hy₀_sub hy₀_ne ⟨w, hw_sec, ?_, ?_⟩ + · intro j hjk + simp [w, hjk] + · simp [w] + +/-- Graph Minors IV, (2.1) (page 230). Let `T₁, T₂, …` be a countable sequence of disjoint trees, +and `M` be a graph on their vertices such that whenever `i < i'`, `u ∈ V(Tᵢ)` is `M`-adjacent to +`w ∈ V(T_{i'})`, and `v ∈ V(T_{i'}) - {o(T_{i'})}` lies on the path of `T_{i'}` from `o(T_{i'})` +to `w`, `u` is `M`-adjacent to `v`. If `{o(T₁), o(T₂), …}` is `M`-stable, then there is an infinite +`M`-stable set `X ⊆ ⋃ᵢ V(Tᵢ)` meeting each `V(Tᵢ)` in at most one vertex such that the set of heads +of all edges of `T₁ ∪ T₂ ∪ ⋯` with tails in `X` is `M`-rich. -/ +theorem lemma_2_1 (T : ℕ → RootedTree ι) (M : SimpleGraph ι) + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + (hM : ∀ i i', i < i' → ∀ u ∈ (T i).verts, ∀ w ∈ (T i').verts, ∀ v, + M.Adj u w → v ≠ (T i').root → (T i').Reaches v w → M.Adj u v) + (hroot : M.IsIndepSet (Set.range fun i ↦ (T i).root)) : + ∃ X : Set ι, X.Infinite ∧ M.IsIndepSet X ∧ X ⊆ ⋃ i, ((T i).verts : Set ι) ∧ + (∀ i, (X ∩ (T i).verts).Subsingleton) ∧ + IsRich M {v | ∃ i, v ∈ (T i).edges ∧ (T i).parent v ∈ X} := by + by_cases hsec : ∃ z, IsSection T M z + · have hx_sec := lemma_2_1_claim_3 hdisj hsec + refine ⟨Set.range (minimalSectionSeq T M), hx_sec.1.infinite_range hdisj, hx_sec.2.2, + hx_sec.1.range_subset, hx_sec.1.subsingleton_inter, ?_⟩ + refine isRich_of_no_section hdisj ?_ fun y hy ↦ lemma_2_1_claim_5 hdisj hM hsec y hy + rintro v ⟨i, hve, -⟩ + exact (mem_V₀_iff hdisj).2 ⟨i, hve⟩ + · push Not at hsec + have hinc_root : IsIncreasing T (fun i ↦ (T i).root) := by + refine ⟨fun i ↦ ⟨i, (T i).root_mem⟩, fun j j' i i' hlt hi hi' ↦ ?_⟩ + have hji : j = i := tree_eq_of_mem_verts hdisj (T j).root_mem hi + have hj'i' : j' = i' := tree_eq_of_mem_verts hdisj (T j').root_mem hi' + omega + refine ⟨Set.range fun i ↦ (T i).root, hinc_root.infinite_range hdisj, hroot, + hinc_root.range_subset, hinc_root.subsingleton_inter, ?_⟩ + have hrich_V₀ : IsRich M (V₀ T) := + isRich_of_no_section hdisj Set.Subset.rfl fun z _ ↦ hsec z + refine hrich_V₀.mono ?_ + rintro v ⟨i, hve, -⟩ + exact (mem_V₀_iff hdisj).2 ⟨i, hve⟩ + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM04/TreeLemma/Lemma22.lean b/LeanPool/GraphMinor/GM04/TreeLemma/Lemma22.lean new file mode 100644 index 0000000000..ec2c13e87a --- /dev/null +++ b/LeanPool/GraphMinor/GM04/TreeLemma/Lemma22.lean @@ -0,0 +1,267 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.TreeLemma.Lemma21 + +/-! +# The main tree lemma: Graph Minors IV, (2.2) + +This file formalizes Graph Minors IV, (2.2) (pages 232–233), proved by induction on `n` from (2.1): + +* Base case `n = 0` (`lemma_2_2_zero`): when `φᵢ(e) = 0` for every edge `e`, `v` precedes `w` + whenever `v ≠ o(Tᵢ)` reaches `w`, so (2.2) reduces directly to (2.1). +* Inductive step `n + 1`: for each `i`, let `Fᵢ = {e ∈ E(Tᵢ) : φᵢ(e) = 0}` and let `Sᵢ` be the + contraction of `Tᵢ` onto `Fᵢ` (`RootedTree.exists_isContraction`). + - Claim (1) (`lemma_2_2_claim_1`): the contractions `Sᵢ` and `M` satisfy the adjacency hypothesis + of (2.1). + - Claim (2) (`lemma_2_2_claim_2`): applying (2.1) to `S₁, S₂, …` yields an increasing sequence + `z₁, z₂, …` of `M`-independent vertices, each the root of a component `R_j` of some + `Tᵢ \ Fᵢ`, such that the set `A` of heads of edges in `⋃ᵢ Fᵢ` with tails in `⋃_j V(R_j)` is + `M`-rich. + - Claim (3) (`lemma_2_2_claim_3`): applying the induction hypothesis to `R₁, R₂, …` with + `φ'_j(e) = φᵢ(e) - 1` yields an infinite `M`-stable set `X ⊆ ⋃_j V(R_j)` meeting each `V(Tᵢ)` in + at most one vertex such that the set `B` of heads of edges of `⋃_j R_j` with tails in `X` is + `M`-rich. + - Final step: every edge of `⋃ᵢ Tᵢ` with tail in `X` has head in `A ∪ B`, so the set `C` of such + heads is `M`-rich. +-/ + +public section + +namespace GraphMinor.GM04 + +variable {ι : Type*} + +/-- Base case `n = 0` of Graph Minors IV, (2.2) (page 232). -/ +theorem lemma_2_2_zero (T : ℕ → RootedTree ι) (φ : ℕ → ι → ℕ) (M : SimpleGraph ι) + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + (hφ : ∀ i, ∀ f ∈ (T i).edges, φ i f ≤ 0) + (hM : ∀ i i', i < i' → ∀ u ∈ (T i).verts, ∀ w ∈ (T i').verts, ∀ v, + M.Adj u w → (T i').Precedes (φ i') v w → M.Adj u v) + (hroot : M.IsIndepSet (Set.range fun i ↦ (T i).root)) : + ∃ X : Set ι, X.Infinite ∧ M.IsIndepSet X ∧ X ⊆ ⋃ i, ((T i).verts : Set ι) ∧ + (∀ i, (X ∩ (T i).verts).Subsingleton) ∧ + IsRich M {v | ∃ i, v ∈ (T i).edges ∧ (T i).parent v ∈ X} := by + refine lemma_2_1 T M hdisj (fun i i' hii' u hu w hw v hadj hvr hvw ↦ ?_) hroot + have hve : v ∈ (T i').edges := (T i').mem_edges.2 ⟨hvr, hvw.verts_left (T i')⟩ + have hwr : w ≠ (T i').root := by + rintro rfl + exact hvr (((T i').reaches_root_iff).1 hvw) + have hwe : w ∈ (T i').edges := (T i').mem_edges.2 ⟨hwr, hw⟩ + have hv0 : φ i' v ≤ 0 := hφ i' v hve + have hw0 : φ i' w ≤ 0 := hφ i' w hwe + exact hM i i' hii' u hu w hw v hadj ⟨hvr, hvw, by omega, fun g _ _ _ ↦ by omega⟩ + +/-- Graph Minors IV, (2.2), claim (1) (page 232): if `Sᵢ` is the contraction of `Tᵢ` onto +`Fᵢ = {e ∈ E(Tᵢ) : φᵢ(e) = 0}`, then for `i < i'`, if `u ∈ V(Sᵢ)` is `M`-adjacent to `w ∈ V(S_{i'})` +and `v ≠ o(S_{i'})` reaches `w` in `S_{i'}`, then `u` is `M`-adjacent to `v`. -/ +theorem lemma_2_2_claim_1 {T S : ℕ → RootedTree ι} {φ : ℕ → ι → ℕ} {M : SimpleGraph ι} + (hS : ∀ i, (T i).IsContraction {e : ι | e ∈ (T i).edges ∧ φ i e = 0} (S i)) + (hM : ∀ i i', i < i' → ∀ u ∈ (T i).verts, ∀ w ∈ (T i').verts, ∀ v, + M.Adj u w → (T i').Precedes (φ i') v w → M.Adj u v) + {i i' : ℕ} (hii' : i < i') {u w v : ι} (hu : u ∈ (S i).verts) (hw : w ∈ (S i').verts) + (hadj : M.Adj u w) (hvr : v ≠ (S i').root) (hvw : (S i').Reaches v w) : + M.Adj u v := by + have huT : u ∈ (T i).verts := (hS i).verts_subset (T i) hu + have hwT : w ∈ (T i').verts := (hS i').verts_subset (T i') hw + have hveS : v ∈ (S i').edges := (S i').mem_edges.2 ⟨hvr, hvw.verts_left (S i')⟩ + have hwr : w ≠ (S i').root := by + rintro rfl + exact hvr (((S i').reaches_root_iff).1 hvw) + have hweS : w ∈ (S i').edges := (S i').mem_edges.2 ⟨hwr, hw⟩ + obtain ⟨⟨_, hv0⟩, -⟩ := ((hS i').mem_edges_iff (T i')).1 hveS + obtain ⟨⟨_, hw0⟩, -⟩ := ((hS i').mem_edges_iff (T i')).1 hweS + have hvwT : (T i').Reaches v w := (hS i').reaches_imp (T i') hvw + have hprec : (T i').Precedes (φ i') v w := + ⟨(hS i').root_eq ▸ hvr, hvwT, by omega, fun g _ _ _ ↦ by omega⟩ + exact hM i i' hii' u huT w hwT v hadj hprec + +/-- Graph Minors IV, (2.2), claim (2) (page 232): applying (2.1) to the contractions `Sᵢ` produces +an increasing sequence `z` with tree indices `idx` (`StrictMono idx`), where `z j` is the root of a +component `R j` of `T (idx j) \ F (idx j)`, such that `Set.range z` is `M`-stable and the set `A` of +heads of edges in `⋃ᵢ Fᵢ` with tails in `⋃_j V(R_j)` is `M`-rich. -/ +theorem lemma_2_2_claim_2 (T : ℕ → RootedTree ι) (φ : ℕ → ι → ℕ) (M : SimpleGraph ι) + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + (hM : ∀ i i', i < i' → ∀ u ∈ (T i).verts, ∀ w ∈ (T i').verts, ∀ v, + M.Adj u w → (T i').Precedes (φ i') v w → M.Adj u v) + (hroot : M.IsIndepSet (Set.range fun i ↦ (T i).root)) : + let F : ℕ → Set ι := fun i ↦ {e : ι | e ∈ (T i).edges ∧ φ i e = 0} + ∃ (z : ℕ → ι) (idx : ℕ → ℕ) (hz_verts : ∀ j, z j ∈ (T (idx j)).verts) + (hz_F : ∀ j, z j = (T (idx j)).root ∨ z j ∈ F (idx j)), + StrictMono idx ∧ M.IsIndepSet (Set.range z) ∧ + IsRich M {v | ∃ i, v ∈ F i ∧ + (T i).parent v ∈ ⋃ j, (((T (idx j)).componentTree (F (idx j)) (z j) + (hz_verts j) (hz_F j)).verts : Set ι)} := by + intro F + have hF_sub : ∀ i, F i ⊆ (T i).edges := fun i _ h ↦ h.1 + let S : ℕ → RootedTree ι := fun i ↦ ((T i).exists_isContraction (F i) (hF_sub i)).choose + have hS : ∀ i, (T i).IsContraction (F i) (S i) := + fun i ↦ ((T i).exists_isContraction (F i) (hF_sub i)).choose_spec + have hS_disj : Pairwise (fun i j ↦ Disjoint (S i).verts (S j).verts) := + fun i j hij ↦ (hdisj hij).mono ((hS i).verts_subset (T i)) ((hS j).verts_subset (T j)) + have hS_root : M.IsIndepSet (Set.range fun i ↦ (S i).root) := by + have heq : (fun i ↦ (S i).root) = (fun i ↦ (T i).root) := + funext fun i ↦ (hS i).root_eq + exact heq ▸ hroot + obtain ⟨Z, hZ_inf, hZ_ind, hZ_sub, hZ_subsing, hZ_rich⟩ := + lemma_2_1 S M hS_disj (fun i i' hii' u hu w hw v hadj hvr hvw ↦ + lemma_2_2_claim_1 hS hM hii' hu hw hadj hvr hvw) hS_root + obtain ⟨z, idx, hmono, _, hz_spec, hz_range⟩ := + exists_isIncreasing_of_infinite hS_disj hZ_inf hZ_sub + have hrange_eq : Set.range z = Z := hz_range hZ_subsing + have hz_verts : ∀ j, z j ∈ (T (idx j)).verts := + fun j ↦ (hS (idx j)).verts_subset (T (idx j)) (hz_spec j).2 + have hz_F : ∀ j, z j = (T (idx j)).root ∨ z j ∈ F (idx j) := by + intro j + rcases ((hS (idx j)).mem_verts_iff (T (idx j))).1 (hz_spec j).2 with hr | ⟨hF, -⟩ + · exact Or.inl hr + · exact Or.inr hF + refine ⟨z, idx, hz_verts, hz_F, hmono, hrange_eq.symm ▸ hZ_ind, ?_⟩ + refine hZ_rich.mono ?_ + rintro v ⟨i, hvF, hvp⟩ + obtain ⟨j, hj⟩ := Set.mem_iUnion.1 hvp + rw [RootedTree.componentTree_verts, Finset.mem_coe, RootedTree.mem_componentAt] at hj + have hvp_T : (T i).parent v ∈ (T i).verts := + (T i).parent_mem v ((T i).mem_verts_of_mem_edges hvF.1) + have hi_eq : i = idx j := tree_eq_of_mem_verts hdisj hvp_T (hj.verts_right (T (idx j))) + subst hi_eq + have hve_S : v ∈ (S (idx j)).edges := + ((hS (idx j)).mem_edges_iff (T (idx j))).2 ⟨hvF, hvF.1⟩ + have hcomp_S : (T (idx j)).IsComponentRoot (F (idx j)) ((S (idx j)).parent v) + ((T (idx j)).parent v) := + (hS (idx j)).parent_eq v hve_S + have hp_eq : (S (idx j)).parent v = z j := hcomp_S.unique (T (idx j)) hj + exact ⟨idx j, hve_S, hrange_eq ▸ ⟨j, hp_eq.symm⟩⟩ + +/-- Graph Minors IV, (2.2), claim (3) (page 233): applying the induction hypothesis to the +components `R_j` and `φ'_j(e) = φ_{idx j}(e) - 1` produces an infinite `M`-stable set +`X ⊆ ⋃_j V(R_j)` meeting each `V(Tᵢ)` in at most one vertex such that the set `B` of heads of edges +of `⋃_j R_j` with tails in `X` is `M`-rich. -/ +theorem lemma_2_2_claim_3 {T : ℕ → RootedTree ι} {n : ℕ} {φ : ℕ → ι → ℕ} {M : SimpleGraph ι} + (ih : ∀ (T' : ℕ → RootedTree ι) (φ' : ℕ → ι → ℕ), + Pairwise (fun i j ↦ Disjoint (T' i).verts (T' j).verts) → + (∀ i, ∀ f ∈ (T' i).edges, φ' i f ≤ n) → + (∀ i i', i < i' → ∀ u ∈ (T' i).verts, ∀ w ∈ (T' i').verts, ∀ v, + M.Adj u w → (T' i').Precedes (φ' i') v w → M.Adj u v) → + M.IsIndepSet (Set.range fun i ↦ (T' i).root) → + ∃ X : Set ι, X.Infinite ∧ M.IsIndepSet X ∧ X ⊆ ⋃ i, ((T' i).verts : Set ι) ∧ + (∀ i, (X ∩ (T' i).verts).Subsingleton) ∧ + IsRich M {v | ∃ i, v ∈ (T' i).edges ∧ (T' i).parent v ∈ X}) + (hdisj : Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts)) + (hφ : ∀ i, ∀ f ∈ (T i).edges, φ i f ≤ n + 1) + (hM : ∀ i i', i < i' → ∀ u ∈ (T i).verts, ∀ w ∈ (T i').verts, ∀ v, + M.Adj u w → (T i').Precedes (φ i') v w → M.Adj u v) + (z : ℕ → ι) (idx : ℕ → ℕ) + (hz_verts : ∀ j, z j ∈ (T (idx j)).verts) + (hz_F : ∀ j, z j = (T (idx j)).root ∨ z j ∈ {e : ι | e ∈ (T (idx j)).edges ∧ φ (idx j) e = 0}) + (hmono : StrictMono idx) (hz_ind : M.IsIndepSet (Set.range z)) : + let F : ℕ → Set ι := fun i ↦ {e : ι | e ∈ (T i).edges ∧ φ i e = 0} + let R : ℕ → RootedTree ι := fun j ↦ + (T (idx j)).componentTree (F (idx j)) (z j) (hz_verts j) (hz_F j) + ∃ X : Set ι, X.Infinite ∧ M.IsIndepSet X ∧ X ⊆ ⋃ j, ((R j).verts : Set ι) ∧ + (∀ i, (X ∩ (T i).verts).Subsingleton) ∧ + IsRich M {v | ∃ j, v ∈ (R j).edges ∧ (R j).parent v ∈ X} := by + intro F R + let φ' : ℕ → ι → ℕ := fun j e ↦ φ (idx j) e - 1 + have hR_disj : Pairwise (fun j₁ j₂ ↦ Disjoint (R j₁).verts (R j₂).verts) := by + intro j₁ j₂ hj + exact (hdisj (hmono.injective.ne hj)).mono + ((T (idx j₁)).componentAt_subset_verts (F (idx j₁)) (z j₁)) + ((T (idx j₂)).componentAt_subset_verts (F (idx j₂)) (z j₂)) + have hφ' : ∀ j, ∀ f ∈ (R j).edges, φ' j f ≤ n := by + intro j f hf + obtain ⟨hfT, -, -⟩ := + ((T (idx j)).mem_componentTree_edges_iff (F (idx j)) (z j) (hz_verts j) (hz_F j)).1 hf + have hle := hφ (idx j) f hfT + dsimp only [φ'] + omega + have hR_M : ∀ j j', j < j' → ∀ u ∈ (R j).verts, ∀ w ∈ (R j').verts, ∀ v, + M.Adj u w → (R j').Precedes (φ' j') v w → M.Adj u v := by + intro j j' hjj' u hu w hw v hadj hprec + have huT : u ∈ (T (idx j)).verts := + (T (idx j)).componentAt_subset_verts (F (idx j)) (z j) hu + have hwT : w ∈ (T (idx j')).verts := + (T (idx j')).componentAt_subset_verts (F (idx j')) (z j') hw + have hvR : v ∈ (R j').verts := hprec.2.1.verts_left (R j') + have hprecT : (T (idx j')).Precedes (φ (idx j')) v w := by + refine (T (idx j')).componentTree_precedes (F := F (idx j')) + (fun e he ↦ ⟨fun h ↦ h.2, fun h ↦ ⟨he, h⟩⟩) + (z j') (hz_verts j') (hz_F j') hvR hprec + exact hM (idx j) (idx j') (hmono hjj') u huT w hwT v hadj hprecT + have hR_root : M.IsIndepSet (Set.range fun j ↦ (R j).root) := hz_ind + obtain ⟨X, hX_inf, hX_ind, hX_sub, hX_subsing_R, hB_rich⟩ := + ih R φ' hR_disj hφ' hR_M hR_root + refine ⟨X, hX_inf, hX_ind, hX_sub, fun i ↦ ?_, hB_rich⟩ + rintro x₁ ⟨hx₁X, hx₁T⟩ x₂ ⟨hx₂X, hx₂T⟩ + obtain ⟨j₁, hj₁⟩ := Set.mem_iUnion.1 (hX_sub hx₁X) + obtain ⟨j₂, hj₂⟩ := Set.mem_iUnion.1 (hX_sub hx₂X) + have hx₁_idx : x₁ ∈ (T (idx j₁)).verts := + (T (idx j₁)).componentAt_subset_verts (F (idx j₁)) (z j₁) hj₁ + have hx₂_idx : x₂ ∈ (T (idx j₂)).verts := + (T (idx j₂)).componentAt_subset_verts (F (idx j₂)) (z j₂) hj₂ + have hi₁ : idx j₁ = i := tree_eq_of_mem_verts hdisj hx₁_idx hx₁T + have hi₂ : idx j₂ = i := tree_eq_of_mem_verts hdisj hx₂_idx hx₂T + have hj12 : j₁ = j₂ := hmono.injective (hi₁.trans hi₂.symm) + subst hj12 + exact hX_subsing_R j₁ ⟨hx₁X, hj₁⟩ ⟨hx₂X, hj₂⟩ + +private theorem lemma_2_2_ind (n : ℕ) : + ∀ (T : ℕ → RootedTree ι) (φ : ℕ → ι → ℕ) (M : SimpleGraph ι), + Pairwise (fun i j ↦ Disjoint (T i).verts (T j).verts) → + (∀ i, ∀ f ∈ (T i).edges, φ i f ≤ n) → + (∀ i i', i < i' → ∀ u ∈ (T i).verts, ∀ w ∈ (T i').verts, ∀ v, + M.Adj u w → (T i').Precedes (φ i') v w → M.Adj u v) → + M.IsIndepSet (Set.range fun i ↦ (T i).root) → + ∃ X : Set ι, X.Infinite ∧ M.IsIndepSet X ∧ X ⊆ ⋃ i, ((T i).verts : Set ι) ∧ + (∀ i, (X ∩ (T i).verts).Subsingleton) ∧ + IsRich M {v | ∃ i, v ∈ (T i).edges ∧ (T i).parent v ∈ X} := by + induction n with + | zero => exact fun T φ M hdisj hφ hM hroot ↦ lemma_2_2_zero T φ M hdisj hφ hM hroot + | succ n ih => + intro T φ M hdisj hφ hM hroot + let F : ℕ → Set ι := fun i ↦ {e : ι | e ∈ (T i).edges ∧ φ i e = 0} + obtain ⟨z, idx, hz_verts, hz_F, hmono, hz_ind, hA_rich⟩ := + lemma_2_2_claim_2 T φ M hdisj hM hroot + let R : ℕ → RootedTree ι := fun j ↦ + (T (idx j)).componentTree (F (idx j)) (z j) (hz_verts j) (hz_F j) + obtain ⟨X, hX_inf, hX_ind, hX_sub, hX_subsing, hB_rich⟩ := + lemma_2_2_claim_3 (fun T' φ' ↦ ih T' φ' M) hdisj hφ hM z idx hz_verts hz_F hmono hz_ind + have hX_sub_T : X ⊆ ⋃ i, ((T i).verts : Set ι) := by + refine hX_sub.trans ?_ + rintro x hx + obtain ⟨j, hj⟩ := Set.mem_iUnion.1 hx + exact Set.mem_iUnion.2 ⟨idx j, (T (idx j)).componentAt_subset_verts (F (idx j)) (z j) hj⟩ + refine ⟨X, hX_inf, hX_ind, hX_sub_T, hX_subsing, ?_⟩ + refine (hA_rich.union hB_rich).mono ?_ + rintro v ⟨i, hve, hvp⟩ + obtain ⟨j, hj⟩ := Set.mem_iUnion.1 (hX_sub hvp) + have hvp_T : (T i).parent v ∈ (T i).verts := + (T i).parent_mem v ((T i).mem_verts_of_mem_edges hve) + have hvp_idx : (T i).parent v ∈ (T (idx j)).verts := + (T (idx j)).componentAt_subset_verts (F (idx j)) (z j) hj + have hi_eq : i = idx j := tree_eq_of_mem_verts hdisj hvp_T hvp_idx + subst hi_eq + by_cases hφ0 : φ (idx j) v = 0 + · exact Or.inl ⟨idx j, ⟨hve, hφ0⟩, Set.mem_iUnion.2 ⟨j, hj⟩⟩ + · refine Or.inr ⟨j, ?_⟩ + have hv_not_F : v ∉ F (idx j) := fun h ↦ hφ0 h.2 + have hve_R : v ∈ (R j).edges := + ((T (idx j)).mem_componentTree_edges_iff (F (idx j)) (z j) (hz_verts j) (hz_F j)).2 + ⟨hve, hv_not_F, hj⟩ + have hne_root : v ≠ z j := (R j).ne_root_of_mem_edges hve_R + have hp_eq : (R j).parent v = (T (idx j)).parent v := + (T (idx j)).componentTree_parent_of_ne (F (idx j)) (z j) (hz_verts j) (hz_F j) hne_root + exact ⟨hve_R, hp_eq ▸ hvp⟩ + +/-- Graph Minors IV, (2.2) (page 232). -/ +theorem lemma_2_2 : TreeLemma22Statement := + fun T n φ M hdisj hφ hM hroot ↦ lemma_2_2_ind n T φ M hdisj hφ hM hroot + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/GM05/Defs.lean b/LeanPool/GraphMinor/GM05/Defs.lean new file mode 100644 index 0000000000..3f4b6f8d02 --- /dev/null +++ b/LeanPool/GraphMinor/GM05/Defs.lean @@ -0,0 +1,258 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM01.Defs +public import LeanPool.GraphMinor.GM10.Defs +public import Mathlib.Algebra.BigOperators.Finprod +public import Mathlib.Data.Nat.Choose.Basic + +/-! +# Definitions for Graph Minors V, Sections 1–7 (The Grid Theorem) + +This file formalizes the definitions and parameters of +N. Robertson and P. D. Seymour, *Graph Minors. V. Excluding a planar graph*, +J. Combin. Theory Ser. B **41** (1986), 92–114, Sections 1–7 (pages 92–109): + +- **Section 1 (pages 92–94):** + - Tree-decompositions `(T, χ)` of a graph `G` (`IsTreeDecomposition`), where `T : SimpleGraph ι` + is a finite tree (`[Fintype ι]`, `T.IsTree`) and `χ : ι → Set V` assigns a subset of `V(G)` to + each vertex of `T` satisfying conditions (i)–(iii). + - The width of a tree-decomposition (`decompWidth` and the predicate `WidthLE χ w` for width at + most `w`), and the tree-width of `G` (both as the predicate `TreeWidthLE G w`, stating that `G` + has a tree-decomposition of width at most `w`, and as `treeWidth G : ℕ∞`, the least finite + bound or `⊤` when no finite bound exists). + - Relabelling of tree-decompositions along an equivalence `e : ι ≃ ι'` + (`IsTreeDecomposition.relabel`, `treeWidthLE_of_isTreeDecomposition`). + - Separations `(V₁, V₂)` of a graph `G` (`IsSeparation`). +- **Section 2 (pages 94–95):** + - The function `α(k, n)` (`α θ k n`) and the parameters `θ₁, …, θ₉` and `φ_k` (`θ₁ θ`, …, + `θ₉ θ`, `φ θ k`). +- **Section 4 (pages 97–100):** + - The parameter `ψ_k` (`ψ θ k`). +- **Section 6 (pages 102–106):** + - The vertex-weight sum `w(X)` (`weightSum w X`). +-/ + +@[expose] public section + +namespace GraphMinor.GM05 + +open SimpleGraph GM01 + +variable {V ι ι' : Type*} + +/-! ## Section 1: Tree-Decompositions, Tree-Width, Separations, and Components -/ + +export GM10 (OnTreePath) + +/-- `(T, χ)` is a tree-decomposition of a graph `G` (Graph Minors V, Section 1, pages 92–93): +"A *tree-decomposition* $(T, \chi)$ of a graph $G$ is a tree $T$ together with a family +$\chi = (X_t : t \in V(T))$ of subsets of $V(G)$, such that +(i) $\bigcup(X_t : t \in V(T)) = V(G)$; +(ii) for each edge $e$ of $G$ there exists $t \in V(T)$ such that $e$ has both ends (or its end, in + the case of a loop) in $X_t$; ... +(iii) for $t, t', t'' \in V(T)$, if $t'$ lies on the path of $T$ between $t$ and $t''$, then + $X_t \cap X_{t''} \subseteq X_{t'}$." -/ +structure IsTreeDecomposition [Fintype ι] (G : (⊤ : SimpleGraph V).Subgraph) + (T : SimpleGraph ι) (χ : ι → Set V) : Prop where + /-- `T` is a tree. -/ + isTree : T.IsTree + /-- (i) `⋃ (X_t : t ∈ V(T)) = V(G)`. -/ + iUnion_eq : (⋃ t : ι, χ t) = G.verts + /-- (ii) For each edge of `G` there exists `t ∈ V(T)` containing both ends of the edge. -/ + adj_mem : ∀ ⦃u v : V⦄, G.Adj u v → ∃ t : ι, u ∈ χ t ∧ v ∈ χ t + /-- (iii) For `t, t', t'' ∈ V(T)`, if `t'` lies on the path of `T` between `t` and `t''`, then + `X_t ∩ X_{t''} ⊆ X_{t'}`. -/ + inter_subset : ∀ ⦃t t' t'' : ι⦄, OnTreePath T t t'' t' → χ t ∩ χ t'' ⊆ χ t' + +/-- The tree-decomposition `(T, χ)` has width at most `w` (Graph Minors V, Section 1, page 93): +"The width of the tree-decomposition is $\max(|X_t| - 1 : t \in V(T))$;" Thus the width is `≤ w` +for `w : ℕ` when `|X_t| ≤ w + 1` for every `t ∈ V(T)`. -/ +def WidthLE (χ : ι → Set V) (w : ℕ) : Prop := + ∀ t : ι, (χ t).encard ≤ (w + 1 : ℕ) + +/-- The supremum of `|X_t| - 1` over the bags of a tree-decomposition. For finitely many finite bags +with at least one nonempty bag, this agrees with the width in Graph Minors V, Section 1, page 93. +Subtraction in `ℕ∞` gives width zero when every bag is empty. An infinite bag gives width `⊤`. -/ +noncomputable def decompWidth (χ : ι → Set V) : ℕ∞ := + ⨆ t, (χ t).encard - 1 + +/-- `G` has tree-width at most `w` (Graph Minors V, Section 1, page 93): +"and the *tree-width* of $G$ is the minimum $w \ge 0$ such that $G$ has a tree-decomposition +of width $\le w$." + +The existential quantifies over finite trees whose vertex type `ι` lies in `Type`; see +`IsTreeDecomposition.relabel` and `treeWidthLE_of_isTreeDecomposition` for any finite index type +`ι : Type*`. -/ +def TreeWidthLE (G : (⊤ : SimpleGraph V).Subgraph) (w : ℕ) : Prop := + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (χ : ι → Set V), + IsTreeDecomposition G T χ ∧ WidthLE χ w + +/-- For a finite graph `G`, the least width bound of a tree-decomposition of `G` +(Graph Minors V, Section 1, page 93). Lean extends this to arbitrary `G` using `⊤` when no finite +bound exists for a decomposition indexed by a finite tree. -/ +noncomputable def treeWidth (G : (⊤ : SimpleGraph V).Subgraph) : ℕ∞ := + ⨅ w : {w : ℕ // TreeWidthLE G w}, (w.1 : ℕ∞) + +/-- Relabelling a tree-decomposition `(T, χ)` along an equivalence `e : ι ≃ ι'` gives a +tree-decomposition `(T.map e.toEmbedding, χ ∘ e.symm)`. -/ +theorem IsTreeDecomposition.relabel [Fintype ι] [Fintype ι'] {G : (⊤ : SimpleGraph V).Subgraph} + {T : SimpleGraph ι} {χ : ι → Set V} (h : IsTreeDecomposition G T χ) (e : ι ≃ ι') : + IsTreeDecomposition G (T.map e.toEmbedding) (χ ∘ e.symm) where + isTree := (SimpleGraph.Iso.map e T).isTree_iff.1 h.isTree + iUnion_eq := by + rw [← h.iUnion_eq] + ext v + simp only [Set.mem_iUnion, Function.comp_apply] + exact e.symm.exists_congr (fun _ ↦ Iff.rfl) + adj_mem {u v} hadj := by + obtain ⟨t, hu, hv⟩ := h.adj_mem hadj + exact ⟨e t, by simpa using hu, by simpa using hv⟩ + inter_subset {t₁ t₂ t₃} hp := by + apply h.inter_subset + rw [← GM10.onTreePath_map e] + simpa using hp + +/-- Relabelling a family of bags `χ` along an equivalence `e : ι ≃ ι'` preserves `WidthLE`. -/ +theorem widthLE_comp_equiv {χ : ι → Set V} {w : ℕ} (e : ι ≃ ι') : + WidthLE (χ ∘ e.symm) w ↔ WidthLE χ w := + ⟨fun h t ↦ by simpa using h (e t), fun h t' ↦ h (e.symm t')⟩ + +/-- Relabelling a tree-decomposition along an equivalence `e : ι ≃ ι'` preserves `decompWidth`. -/ +theorem decompWidth_comp_equiv (χ : ι → Set V) (e : ι ≃ ι') : + decompWidth (χ ∘ e.symm) = decompWidth χ := + e.symm.iSup_comp (g := fun t ↦ (χ t).encard - 1) + +/-- Any tree-decomposition `(T, χ)` of `G` of width `≤ w` on an arbitrary finite index type +`ι : Type*` witnesses `TreeWidthLE G w`. -/ +theorem treeWidthLE_of_isTreeDecomposition [Fintype ι] {G : (⊤ : SimpleGraph V).Subgraph} + {T : SimpleGraph ι} {χ : ι → Set V} {w : ℕ} + (h : IsTreeDecomposition G T χ) (hw : WidthLE χ w) : + TreeWidthLE G w := by + let e := Fintype.equivFin ι + exact ⟨Fin (Fintype.card ι), inferInstance, T.map e.toEmbedding, χ ∘ e.symm, + h.relabel e, (widthLE_comp_equiv e).2 hw⟩ + +/-- Any tree-decomposition `(T, χ)` of `G` of width `≤ w` on an arbitrary finite index type +`ι : Type*` bounds `treeWidth G ≤ w`. -/ +theorem treeWidth_le_of_isTreeDecomposition [Fintype ι] {G : (⊤ : SimpleGraph V).Subgraph} + {T : SimpleGraph ι} {χ : ι → Set V} {w : ℕ} + (h : IsTreeDecomposition G T χ) (hw : WidthLE χ w) : + treeWidth G ≤ (w : ℕ∞) := + iInf_le (fun bound : {n : ℕ // TreeWidthLE G n} => (bound.1 : ℕ∞)) + ⟨w, treeWidthLE_of_isTreeDecomposition h hw⟩ + +/-- `(V₁, V₂)` is a separation of `G` (Graph Minors V, Section 1, page 94): +"A *separation* of a graph $G$ is a pair $(V_1, V_2)$, where $V_1, V_2 \subseteq V(G)$, $V_1 +\cup V_2 = V(G)$, and no vertex of $V_1 - V_2$ is adjacent to any vertex of $V_2 - V_1$." -/ +structure IsSeparation (G : (⊤ : SimpleGraph V).Subgraph) (V₁ V₂ : Set V) : Prop where + /-- `V₁ ⊆ V(G)`. -/ + subset_left : V₁ ⊆ G.verts + /-- `V₂ ⊆ V(G)`. -/ + subset_right : V₂ ⊆ G.verts + /-- `V₁ ∪ V₂ = V(G)`. -/ + union_eq : V₁ ∪ V₂ = G.verts + /-- No vertex of `V₁ - V₂` is adjacent in `G` to any vertex of `V₂ - V₁`. -/ + not_adj : ∀ ⦃u v : V⦄, u ∈ V₁ \ V₂ → v ∈ V₂ \ V₁ → ¬ G.Adj u v + +/-! ## Section 2: The Parameters `α`, `θ₁, …, θ₉`, and `φ_k` -/ + +/-- The function `α(k, n)` (Graph Minors V, Section 2, page 94): +"Now let $\theta \ge 6$ be some even number. For $k \ge 2$, $n \ge 0$, define $\alpha(k, n)$ +inductively by +$$ +\begin{aligned} +\alpha(2, n) &= n + 1 \\ +\alpha(k, n) &= 2^{n\theta^4} + \alpha(k - 1, 2^{n\theta^4} + n + 1), \quad \text{for } k \ge 3. +\end{aligned} +$$" -/ +def α (θ : ℕ) : ℕ → ℕ → ℕ + | 0, n => n + 1 + | 1, n => n + 1 + | 2, n => n + 1 + | k + 3, n => 2 ^ (n * θ ^ 4) + α θ (k + 2) (2 ^ (n * θ ^ 4) + n + 1) + +/-- The parameter `θ₁ = 2 α(θ²/2, θ²/2)` (Graph Minors V, Section 2, page 94): +"Define `θ₁ = 2 α(θ²/2, θ²/2)`." -/ +def θ₁ (θ : ℕ) : ℕ := + 2 * α θ (θ ^ 2 / 2) (θ ^ 2 / 2) + +/-- Auxiliary upward recursion for `φ_k` in terms of `d = θ₁ - k`. -/ +def φAux (θ : ℕ) : ℕ → ℕ + | 0 => θ ^ 2 / 2 + | d + 1 => + let m := φAux θ d + m * 2 ^ (m * θ ^ 2) + +/-- The parameter `φ_k` (Graph Minors V, Section 2, page 94): +"Define $\phi_{\theta_1} = \theta^2/2$, and for $0 \le k < \theta_1$ define $\phi_k$ +inductively by $$ \phi_k = \phi_{k+1} 2^{\phi_{k+1} \theta^2}." -/ +def φ (θ k : ℕ) : ℕ := + φAux θ (θ₁ θ - k) + +/-- The parameter `θ₂ = φ₀ + 2 φ₁ + 2 φ₂ + ⋯ + 2 φ_{θ₁ - 1} + φ_{θ₁}` +(Graph Minors V, Section 2, page 95). -/ +def θ₂ (θ : ℕ) : ℕ := + φ θ 0 + (∑ i ∈ Finset.Ico 1 (θ₁ θ), 2 * φ θ i) + φ θ (θ₁ θ) + +/-- The parameter `θ₃ = (θ²/2)^{θ₂ - 1}` (Graph Minors V, Section 2, page 95). -/ +def θ₃ (θ : ℕ) : ℕ := + (θ ^ 2 / 2) ^ (θ₂ θ - 1) + +/-- The parameter `θ₄ = θ₂ (θ₃.choose θ₂) + (θ²/2) (θ₃.choose (θ²/2))` +(Graph Minors V, Section 2, page 95). -/ +def θ₄ (θ : ℕ) : ℕ := + θ₂ θ * (θ₃ θ).choose (θ₂ θ) + (θ ^ 2 / 2) * (θ₃ θ).choose (θ ^ 2 / 2) + +/-- The parameter `θ₅ = (θ²/2)^{θ₄ - 1}` (Graph Minors V, Section 2, page 95). -/ +def θ₅ (θ : ℕ) : ℕ := + (θ ^ 2 / 2) ^ (θ₄ θ - 1) + +/-- The parameter `θ₆ = θ₃ (θ₅.choose θ₄) + (θ²/2) (θ₅.choose (θ²/2))` +(Graph Minors V, Section 2, page 95). -/ +def θ₆ (θ : ℕ) : ℕ := + θ₃ θ * (θ₅ θ).choose (θ₄ θ) + (θ ^ 2 / 2) * (θ₅ θ).choose (θ ^ 2 / 2) + +/-- The parameter `θ₇ = α(θ₅, θ₆)` (Graph Minors V, Section 2, page 95). -/ +def θ₇ (θ : ℕ) : ℕ := + α θ (θ₅ θ) (θ₆ θ) + +/-- The parameter `θ₈ = 3 θ₅ (3^{θ₅} - 1) / 4` (Graph Minors V, Section 2, page 95). -/ +def θ₈ (θ : ℕ) : ℕ := + 3 * θ₅ θ * (3 ^ θ₅ θ - 1) / 4 + +/-- The parameter `θ₉ = θ₇ (θ₈ + 1) + 1` (Graph Minors V, Section 2, page 95). -/ +def θ₉ (θ : ℕ) : ℕ := + θ₇ θ * (θ₈ θ + 1) + 1 + +/-! ## Section 4: The Parameter `ψ_k` -/ + +/-- The parameter `ψ_k` (Graph Minors V, Section 4, page 99): +"Define $\phi_{\theta_1}, \dots, \phi_0$ as in Section 2. Define $\psi_{\theta_1} = 0$, and +for $0 \le k < \theta_1$, define $$\psi_k = \phi_k + 2\phi_{k+1} + 2\phi_{k+2} + \dots + +2\phi_{\theta_1 - 1} + \phi_{\theta_1}.$$ Then for $0 \le k < \theta_1$ we have $\psi_k = +\psi_{k+1} + \phi_k + \phi_{k+1}$." -/ +def ψ (θ k : ℕ) : ℕ := + if k < θ₁ θ then + φ θ k + (∑ i ∈ Finset.Ico (k + 1) (θ₁ θ), 2 * φ θ i) + φ θ (θ₁ θ) + else + 0 + +/-! ## Section 6: Vertex Weights -/ + +/-- The sum `w(X) = ∑_{v ∈ X} w(v)` of a non-negative integer vertex weight `w : V → ℕ` over a set +`X ⊆ V(G)` (Graph Minors V, Section 6, page 103): +"Let $\mathbf{Z}^+$ denote the set of non-negative integers. If $G$ is a graph and +$w \colon V(G) \to \mathbf{Z}^+$ is a function and $X \subseteq V(G)$, then $w(X)$ denotes +$\sum_{v \in X} w(v)$." -/ +noncomputable def weightSum (w : V → ℕ) (X : Set V) : ℕ := + ∑ᶠ v ∈ X, w v + +end GraphMinor.GM05 diff --git a/LeanPool/GraphMinor/GM06/Defs.lean b/LeanPool/GraphMinor/GM06/Defs.lean new file mode 100644 index 0000000000..dbf69a1643 --- /dev/null +++ b/LeanPool/GraphMinor/GM06/Defs.lean @@ -0,0 +1,574 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Circle +public import LeanPool.GraphMinor.Surface.Disc +public import LeanPool.GraphMinor.Surface.Cylinder + +/-! +# Definitions and Statements for Graph Minors VI (Disjoint Paths across a Disc) + +This file defines the divisions, dual drawings, and chains used in Sections 1–3 of +N. Robertson and P. D. Seymour, *Graph Minors. VI. Disjoint paths across a disc*, +J. Combin. Theory Ser. B **41** (1986), 115–138. It also defines graph separations +from Section 5, used by the society results of Graph Minors IX. + +- **Section 1 (pages 115–116):** + - Divisions (`IsDivision`, `divisionUnion`), connected graphs (`IsGraphConnected`), connected + components of graphs (`IsGraphComponent`, `graphComponents`), realizations of a division in a + graph (`IsRealization`), feasibility of a division (`IsFeasible`), and vertex valency + (`vertexValency`). +- **Section 2 (pages 116–119):** + - Segments of a circle with respect to a finite vertex set (`IsSegmentOf`, `segmentsOf`), dual + point sets $U$ (`IsDualPointSet`), crossing pairs on a circle (`CrossesOn`), the dual and + double-dual divisions $\Delta^*$ and $\Delta^{**}$ (`dualEquivRel`, `dualDivision`, + `doubleDualDivision`), cross-free divisions (`IsCrossFree`), the counting function + $\Delta(x, y)$ (`divisionCount`), and the statements of (2.1)–(2.4). +- **Section 3 (pages 119–122):** + - Closed disc spaces (`IsClosedDiscSpace`), dual drawings $G^*$ on a closed disc + (`IsDiscDualDrawing`), peripheral vertices and regions (`ChainTerm`, `ChainTerm.IsPeripheral`), + $(x, y)$-chains (`IsXYChain`), chain length (`chainLength`), $\Delta$-redundancy + (`chainRedundancy`), and the statements of (3.1)–(3.3), (3.5), and (3.6). +-/ + +@[expose] public section + +namespace GraphMinor.GM06 + +open Set Function Real Topology unitInterval Graph GraphMinor.Surface + +universe u v w + +/-! ## Section 1: Divisions, Realizations, Feasibility, and Valency (pages 115–116) -/ + +/-- A *division* is a finite set of non-empty pairwise disjoint sets. +Graph Minors VI, Section 1 (page 116): "A *division* is a finite set of non-empty pairwise disjoint +sets." -/ +def IsDivision {α : Type u} (Δ : Set (Set α)) : Prop := + Δ.Finite ∧ (∀ δ ∈ Δ, δ.Nonempty) ∧ Δ.PairwiseDisjoint id + +/-- For a division $\Delta$, $\bigcup \Delta$ denotes $\bigcup (\delta \in \Delta)$. +Graph Minors VI, Section 1 (page 116): "If $\Delta$ is a division, we abbreviate +$\bigcup (\delta \in \Delta)$ by $\bigcup \Delta$." -/ +def divisionUnion {α : Type u} (Δ : Set (Set α)) : Set α := + ⋃₀ Δ + +/-- A multigraph $G$ is *connected* if its vertex set is nonempty and any two vertices of $G$ are +joined by a walk in $G$. +Graph Minors VI, Section 1 (page 116). -/ +def IsGraphConnected {α : Type u} {β : Type v} (G : Graph α β) : Prop := + V(G).Nonempty ∧ ∀ u ∈ V(G), ∀ v ∈ V(G), Nonempty (GraphWalk G u v) + +/-- A subgraph $C$ of $G$ is a *connected component* of $G$ if $C$ is a maximal connected subgraph +of $G$. +Graph Minors VI, Section 1 (page 116). -/ +def IsGraphComponent {α : Type u} {β : Type v} (C G : Graph α β) : Prop := + C ≤ G ∧ IsGraphConnected C ∧ + ∀ C' : Graph α β, C ≤ C' → C' ≤ G → IsGraphConnected C' → C' = C + +/-- The set of connected components of a multigraph $G$. -/ +def graphComponents {α : Type u} {β : Type v} (G : Graph α β) : Set (Graph α β) := + {C : Graph α β | IsGraphComponent C G} + +/-- If $G$ is a graph and $\Delta$ is a division with $\bigcup \Delta \subseteq V(G)$, a +*realization* of $\Delta$ in $G$ is a subgraph $H$ of $G$ which is a forest with $|\Delta|$ +components $H(\delta)$ ($\delta \in \Delta$) such that $\delta \subseteq V(H(\delta))$ for each +$\delta \in \Delta$. +Graph Minors VI, Section 1 (page 116): "If $G$ is a graph and $\Delta$ is a division with +$\bigcup \Delta \subseteq V(G)$, a *realization* of $\Delta$ in $G$ is a subgraph of $G$ which is a +forest with $|\Delta|$ components $H(\delta)$ ($\delta \in \Delta$) such that +$\delta \subseteq V(H(\delta))$ ($\delta \in \Delta$)." -/ +def IsRealization {α : Type u} {β : Type v} (G : Graph α β) (Δ : Set (Set α)) + (H : Graph α β) : Prop := + IsDivision Δ ∧ divisionUnion Δ ⊆ V(G) ∧ + H ≤ G ∧ IsGraphForest H ∧ + ∃ H_comp : Set α → Graph α β, + InjOn H_comp Δ ∧ + (∀ δ ∈ Δ, IsGraphComponent (H_comp δ) H ∧ δ ⊆ V(H_comp δ)) ∧ + graphComponents H = H_comp '' Δ + +/-- A division $\Delta$ is *feasible* in $G$ if there is a realization of $\Delta$ in $G$. +Graph Minors VI, Section 1 (page 116): "We say that $\Delta$ is *feasible* in $G$ if there is a +realization of $\Delta$ in $G$." -/ +def IsFeasible {α : Type u} {β : Type v} (G : Graph α β) (Δ : Set (Set α)) : Prop := + ∃ H : Graph α β, IsRealization G Δ H + +/-- The *valency* of a vertex $v$ in a graph $G$ is the number of edges incident with $v$, counting +loops twice. +Graph Minors VI, Section 1 (page 116): "The *valency* of a vertex is the number of edges incident +with it; loops are counted twice." -/ +noncomputable def vertexValency {α : Type u} {β : Type v} (G : Graph α β) (v : α) : ℕ := + {e ∈ E(G) | ∃ w ≠ v, G.IsLink e v w}.ncard + 2 * {e ∈ E(G) | G.IsLink e v v}.ncard + +/-! ## Section 2: Divisions on a Circle (pages 116–119) -/ + +/-- A subset $S \subseteq C$ is a *segment* of $C$ with respect to $V$ if $S$ is a connected +component of $C \setminus V$ homeomorphic to the open interval $(0, 1)$. +Graph Minors VI, Section 2 (page 117): "Let $C$ be homeomorphic to a circle and let $V \subseteq C$ +be finite. Every component of $C - V$ homeomorphic to $(0, 1)$ is called a *segment* (of $C$ with +respect to $V$)." -/ +def IsSegmentOf {S : Type u} [TopologicalSpace S] (C V seg : Set S) : Prop := + seg ∈ componentsIn (C \ V) ∧ Nonempty (Ioo (0 : ℝ) 1 ≃ₜ seg) + +/-- The set of all segments of $C$ with respect to $V$. +Graph Minors VI, Section 2 (page 117). -/ +def segmentsOf {S : Type u} [TopologicalSpace S] (C V : Set S) : Set (Set S) := + {seg : Set S | IsSegmentOf C V seg} + +/-- A subset $U \subseteq C \setminus V$ is a *dual point set* for $(C, V)$ if $U = \emptyset$ when +$V = \emptyset$, and when $V \ne \emptyset$, $U \subseteq C \setminus V$ with $|U \cap S| = 1$ for +every segment $S$ of $C$ with respect to $V$. +Graph Minors VI, Section 2 (page 117): "If $V = \emptyset$ let $U = \emptyset$. If +$V \ne \emptyset$ let $U \subseteq C - V$ with $|U \cap S| = 1$ for every segment $S$ of $C$ with +respect to $V$." -/ +def IsDualPointSet {S : Type u} [TopologicalSpace S] (C V U : Set S) : Prop := + (V = ∅ → U = ∅) ∧ + (V.Nonempty → U ⊆ C \ V ∧ ∀ seg ∈ segmentsOf C V, (U ∩ seg).ncard = 1) + +/-- Four points $a, b, c, d \in C$ satisfy '$\{a, c\}$ *crosses* $\{b, d\}$' on $C$ if $a, b, c, d$ +are distinct points of $C$ occurring in cyclic order around $C$, that is, $b$ and $d$ lie in +different connected components of $C \setminus \{a, c\}$. +Graph Minors VI, Section 2 (page 117): "If $a, b, c, d$ are distinct points of $C$ occurring in +that order, we say that $\{a, c\}$ *crosses* $\{b, d\}$." -/ +abbrev CrossesOn {S : Type u} [TopologicalSpace S] (C : Set S) (a c b d : S) : Prop := + Surface.PairsCrossOn C a c b d + +/-- The relation on $U$ defining the dual division $\Delta^*$: there is no $\delta \in \Delta$ and +$v, v' \in \delta$ such that $\{v, v'\}$ crosses $\{u, u'\}$. +Graph Minors VI, Section 2 (page 117): "The relation between $u, u' \in U$, ...there is no $\delta +\in \Delta$ and $v, v' \in +\delta$ such that $\{v, v'\}$ crosses $\{u, u'\}$... is an equivalence relation on $U$, as +is easily seen." -/ +def dualEquivRel {S : Type u} [TopologicalSpace S] (C : Set S) (Δ : Set (Set S)) + (u u' : S) : Prop := + ¬ ∃ δ ∈ Δ, ∃ v ∈ δ, ∃ v' ∈ δ, CrossesOn C v v' u u' + +/-- The dual division $\Delta^*$ on $U$, defined as the set of equivalence classes of +`dualEquivRel C Δ` on $U$. +Graph Minors VI, Section 2 (page 117): "We denote the set of equivalence classes by $\Delta^*$." -/ +def dualDivision {S : Type u} [TopologicalSpace S] (C U : Set S) (Δ : Set (Set S)) : + Set (Set S) := + (fun u : S => {u' ∈ U | dualEquivRel C Δ u u'}) '' U + +/-- The double-dual division $\Delta^{**}$ on $V = \bigcup \Delta$, defined as the set of +equivalence classes on $V$ of `dualEquivRel C Δ*`. +Graph Minors VI, Section 2 (page 117): "We define $\Delta^{**}$ to be the set of equivalence classes +on $V$ of the relation between +$v, v' \in V$, ...there is no $\delta^* \in \Delta^*$ and $u, u' \in \delta^*$ such that +$\{u, u'\}$ crosses $\{v, v'\}$...." -/ +def doubleDualDivision {S : Type u} [TopologicalSpace S] (C U : Set S) (Δ : Set (Set S)) : + Set (Set S) := + dualDivision C (divisionUnion Δ) (dualDivision C U Δ) + +/-- A division $\Delta$ on $C$ is *cross-free* if there do not exist distinct +$\delta, \delta' \in \Delta$ and $s, t \in \delta$, $s', t' \in \delta'$ such that $\{s, t\}$ +crosses $\{s', t'\}$. +Graph Minors VI, Section 2 (page 117): "We say that $\Delta$ is *cross-free* if there do not exist +distinct $\delta, \delta' \in \Delta$ and $s, t \in \delta$, $s', t' \in \delta'$ such that +$\{s, t\}$ crosses $\{s', t'\}$." -/ +def IsCrossFree {S : Type u} [TopologicalSpace S] (C : Set S) (Δ : Set (Set S)) : Prop := + ¬ ∃ δ ∈ Δ, ∃ δ' ∈ Δ, δ ≠ δ' ∧ ∃ s ∈ δ, ∃ t ∈ δ, ∃ s' ∈ δ', ∃ t' ∈ δ', + CrossesOn C s t s' t' + +/-- For $x, y \in W$, $\Delta(x, y)$ is the number of members $\delta \in \Delta$ that either meet +$\{x, y\}$ or contain $u, v \in \delta$ such that $\{u, v\}$ crosses $\{x, y\}$. +Graph Minors VI, Section 2 (page 118): +"$$\Delta(x, y) = |\{\delta \in \Delta : \text{either } \delta \cap \{x, y\} \ne +\emptyset\text{, or there exist } u, v \in \delta \text{ such that } \{u, v\} \text{ crosses +} \{x, y\}\}|" -/ +noncomputable def divisionCount {S : Type u} [TopologicalSpace S] (C : Set S) + (Δ : Set (Set S)) (x y : S) : ℕ := + {δ ∈ Δ | (δ ∩ {x, y}).Nonempty ∨ ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn C u v x y}.ncard + +/-- **Graph Minors VI, (2.1)** (page 117): +"$\Delta^*$ is cross-free, for any $\Delta$." -/ +def Statement21 : Prop := + ∀ {S : Type u} [TopologicalSpace S] (C U : Set S) (Δ : Set (Set S)), + IsOArc C → IsDivision Δ → divisionUnion Δ ⊆ C → + IsDualPointSet C (divisionUnion Δ) U → + IsCrossFree C (dualDivision C U Δ) + +/-- **Graph Minors VI, (2.2)** (page 117): +"If $\Delta$ is cross-free then $\Delta^{**} = \Delta$." -/ +def Statement22 : Prop := + ∀ {S : Type u} [TopologicalSpace S] (C U : Set S) (Δ : Set (Set S)), + IsOArc C → IsDivision Δ → (divisionUnion Δ).Finite → divisionUnion Δ ⊆ C → + IsDualPointSet C (divisionUnion Δ) U → IsCrossFree C Δ → + doubleDualDivision C U Δ = Δ + +/-- **Graph Minors VI, (2.3)** (page 118): +"If $W \ne \emptyset$, one of $\Delta, \Delta^*$ has a member with cardinality $1$." -/ +def Statement23 : Prop := + ∀ {S : Type u} [TopologicalSpace S] (C U : Set S) (Δ : Set (Set S)), + IsOArc C → IsDivision Δ → (divisionUnion Δ).Finite → divisionUnion Δ ⊆ C → + IsDualPointSet C (divisionUnion Δ) U → + (divisionUnion Δ ∪ U).Nonempty → + ∃ γ ∈ Δ ∪ dualDivision C U Δ, γ.ncard = 1 + +/-- **Graph Minors VI, (2.4)** (page 118): +"If $\Delta$ is cross-free and $x, y \in W$, then +$$\begin{aligned} +\Delta(x, y) - \Delta^*(x, y) &= 1 &&\text{if } x, y \in V \\ +&= -1 &&\text{if } x, y \in U. \\ +&= 0 &&\text{otherwise.} +\end{aligned}$$" -/ +def Statement24 : Prop := + ∀ {S : Type u} [TopologicalSpace S] (C U : Set S) (Δ : Set (Set S)) (x y : S), + IsOArc C → IsDivision Δ → (divisionUnion Δ).Finite → divisionUnion Δ ⊆ C → + IsDualPointSet C (divisionUnion Δ) U → IsCrossFree C Δ → + x ∈ divisionUnion Δ ∪ U → y ∈ divisionUnion Δ ∪ U → + ((x ∈ divisionUnion Δ ∧ y ∈ divisionUnion Δ → + (divisionCount C Δ x y : ℤ) - (divisionCount C (dualDivision C U Δ) x y : ℤ) = 1) ∧ + (x ∈ U ∧ y ∈ U → + (divisionCount C Δ x y : ℤ) - (divisionCount C (dualDivision C U Δ) x y : ℤ) = -1) ∧ + (¬ (x ∈ divisionUnion Δ ∧ y ∈ divisionUnion Δ) → ¬ (x ∈ U ∧ y ∈ U) → + (divisionCount C Δ x y : ℤ) - (divisionCount C (dualDivision C U Δ) x y : ℤ) = 0)) + +/-! ## Section 3: The Disjoint Subgraph Problem on a Disc (pages 119–122) -/ + +/-- A topological space $S$ is a *closed disc* if it is homeomorphic to `ClosedUnitDisc`. +Graph Minors VI, Section 1 (page 116) & Section 3 (page 119). -/ +def IsClosedDiscSpace (S : Type u) [TopologicalSpace S] : Prop := + Nonempty (ClosedUnitDisc ≃ₜ S) + +/-- A drawing $G^*$ on a closed disc $\Sigma$ is a *dual drawing* of a proper drawing $G$ on +$\Sigma$ (in the one-way sense of Graph Minors VI, Section 3, pages 119–120) if: +- $G$ and $G^*$ are properly drawn in $\Sigma$; +- each region of $G$ contains a unique vertex of $G^*$, and every vertex of $G^*$ lies in a region + of $G$; +- each segment of $\operatorname{bd}(\Sigma)$ with respect to $V(G) \cap \operatorname{bd}(\Sigma)$ + contains a unique vertex of $G^*$, and no other vertices of $G^*$ lie in + $\operatorname{bd}(\Sigma)$; +- the edges of $G^*$ separate distinct vertices of $G$ in $\Sigma \setminus U(G^*)$, and there is a + bijection between $E(G)$ and $E(G^*)$ such that for each edge $e \in E(G)$ and its corresponding + edge $e^* \in E(G^*)$, $e$ and $e^*$ cross at a single point, every region of $G^*$ incident with + $e^*$ meets $e$, and the ends of $e^*$ in $G^*$ are the dual vertices of the regions of $G$ + incident with $e$. +Graph Minors VI, Section 3 (pages 119–120). -/ +def IsDiscDualDrawing {S : Type u} [TopologicalSpace S] (G G_dual : Drawing S) : Prop := + G.IsProper ∧ G_dual.IsProper ∧ + (∀ r ∈ G.R, ∃! w, w ∈ r ∧ w ∈ G_dual.V) ∧ + (∀ w ∈ G_dual.V, ∃ r ∈ G.R, w ∈ r) ∧ + IsDualPointSet (bd S) (G.V ∩ bd S) (G_dual.V ∩ bd S) ∧ + (∀ v₁ ∈ G.V, ∀ v₂ ∈ G.V, + connectedComponentIn (univ \ G_dual.U) v₁ = connectedComponentIn (univ \ G_dual.U) v₂ → + v₁ = v₂) ∧ + ∃ edgeEquiv : G.E ≃ G_dual.E, + ∀ e : G.E, + ((edgeEquiv e).1 ∩ G.U = (edgeEquiv e).1 ∩ e.1) ∧ + (e.1 ∩ G_dual.U = e.1 ∩ (edgeEquiv e).1) ∧ + ((edgeEquiv e).1 ∩ e.1).ncard = 1 ∧ + (∀ r' ∈ G_dual.R, G_dual.EdgeRegionIncident (edgeEquiv e).1 r' → (r' ∩ e.1).Nonempty) ∧ + (∀ r₁ ∈ G.R, ∀ r₂ ∈ G.R, ∀ w₁ ∈ r₁ ∩ G_dual.V, ∀ w₂ ∈ r₂ ∩ G_dual.V, + G_dual.toGraph.IsLink (edgeEquiv e).1 w₁ w₂ ↔ + G.EdgeRegionIncident e.1 r₁ ∧ G.EdgeRegionIncident e.1 r₂ ∧ + ∀ r ∈ G.R, G.EdgeRegionIncident e.1 r → r = r₁ ∨ r = r₂) + +/-- A pair of drawings $(G, G^*)$ on a closed disc $\Sigma$ is a *dual drawing pair* if each is a +dual drawing of the other and vertex-region incidence is transposed between $G$ and $G^*$. +Graph Minors VI, Section 3 (pages 119–120). -/ +def IsDiscDualDrawingPair {S : Type u} [TopologicalSpace S] (G G_dual : Drawing S) : Prop := + G.IsProper ∧ G_dual.IsProper ∧ + G.V ∩ G_dual.V = ∅ ∧ + (∀ r ∈ G.R, ∃! w, w ∈ r ∧ w ∈ G_dual.V) ∧ + (∀ w ∈ G_dual.V, ∃ r ∈ G.R, w ∈ r) ∧ + (∀ r_dual ∈ G_dual.R, ∃! v, v ∈ r_dual ∧ v ∈ G.V) ∧ + (∀ v ∈ G.V, ∃ r_dual ∈ G_dual.R, v ∈ r_dual) ∧ + (∀ v ∈ G.V, ∀ r ∈ G.R, ∀ w ∈ r ∩ G_dual.V, ∀ r_dual ∈ G_dual.R, v ∈ r_dual → + (v ∈ closure r ↔ w ∈ closure r_dual)) ∧ + IsDualPointSet (bd S) (G.V ∩ bd S) (G_dual.V ∩ bd S) ∧ + IsDualPointSet (bd S) (G_dual.V ∩ bd S) (G.V ∩ bd S) ∧ + ∃ edgeEquiv : G.E ≃ G_dual.E, + ∀ e : G.E, + ((edgeEquiv e).1 ∩ G.U = (edgeEquiv e).1 ∩ e.1) ∧ + (e.1 ∩ G_dual.U = e.1 ∩ (edgeEquiv e).1) ∧ + ((edgeEquiv e).1 ∩ e.1).ncard = 1 ∧ + (∀ r₁ ∈ G.R, ∀ r₂ ∈ G.R, ∀ w₁ ∈ r₁ ∩ G_dual.V, ∀ w₂ ∈ r₂ ∩ G_dual.V, + G_dual.toGraph.IsLink (edgeEquiv e).1 w₁ w₂ ↔ + G.EdgeRegionIncident e.1 r₁ ∧ G.EdgeRegionIncident e.1 r₂ ∧ + ∀ r ∈ G.R, G.EdgeRegionIncident e.1 r → r = r₁ ∨ r = r₂) ∧ + (∀ r₁' ∈ G_dual.R, ∀ r₂' ∈ G_dual.R, ∀ v₁ ∈ r₁' ∩ G.V, ∀ v₂ ∈ r₂' ∩ G.V, + G.toGraph.IsLink e.1 v₁ v₂ ↔ + G_dual.EdgeRegionIncident (edgeEquiv e).1 r₁' ∧ + G_dual.EdgeRegionIncident (edgeEquiv e).1 r₂' ∧ + ∀ r' ∈ G_dual.R, G_dual.EdgeRegionIncident (edgeEquiv e).1 r' → r' = r₁' ∨ r' = r₂') + +/-- A term $A_i$ of an $(x, y)$-chain in a drawing $G$ on $\Sigma$: either a vertex `.inl v` +($v \in \Sigma$) or a region `.inr r` ($r \subseteq \Sigma$). +Graph Minors VI, Section 3 (page 121). -/ +abbrev ChainTerm (S : Type u) : Type u := + S ⊕ Set S + +namespace ChainTerm + +variable {S : Type u} [TopologicalSpace S] + +/-- A chain term is valid in $G$ if it is either a vertex in $V(G)$ or a region in $R(G)$. -/ +def IsValid (G : Drawing S) : ChainTerm S → Prop + | .inl v => v ∈ G.V + | .inr r => r ∈ G.R + +/-- Whether a chain term is a vertex term. -/ +def IsVertex : ChainTerm S → Prop + | .inl _ => True + | .inr _ => False + +instance (t : ChainTerm S) : Decidable t.IsVertex := + match t with + | .inl _ => isTrue trivial + | .inr _ => isFalse not_false + +/-- A vertex $v$ of $G$ is *peripheral* if $v \in \operatorname{bd}(\Sigma)$, and a region $r$ of +$G$ is *peripheral* if it contains a segment of $\operatorname{bd}(\Sigma)$ with respect to +$V(G) \cap \operatorname{bd}(\Sigma)$. +Graph Minors VI, Section 3 (page 121): "A vertex $v$ of $G$ is *peripheral* if +$v \in \operatorname{bd}(\Sigma)$, and a region is *peripheral* if it contains a segment of +$\operatorname{bd}(\Sigma)$ (with respect to $\bigcup \Delta$)." -/ +def IsPeripheral (G : Drawing S) : ChainTerm S → Prop + | .inl v => v ∈ G.V ∧ v ∈ bd S + | .inr r => r ∈ G.R ∧ ∃ seg ∈ segmentsOf (bd S) (G.V ∩ bd S), seg ⊆ r + +/-- Two chain terms $A_i, A_{i+1}$ are incident in $G$ if one is a vertex of $G$, the other is a +region of $G$, and the vertex lies in the closure of the region. +Graph Minors VI, Section 3 (page 121): "(i) for $1 \le i < k$, one of $A_i, A_{i+1}$ is a vertex of +$G$, the other is a region, and +they are incident" -/ +def AreIncident (G : Drawing S) : ChainTerm S → ChainTerm S → Prop + | .inl v, .inr r => v ∈ G.V ∧ r ∈ G.R ∧ v ∈ closure r + | .inr r, .inl v => v ∈ G.V ∧ r ∈ G.R ∧ v ∈ closure r + | _, _ => False + +/-- Condition (ii) of an $(x, y)$-chain at an endpoint $z \in W$: if the endpoint term is a vertex +then it equals $z$; if it is a region then $z$ lies in that region. +Graph Minors VI, Section 3 (page 121): "(ii) if $A_1$ is a vertex then $A_1 = x$; if $A_1$ is a +region then $x \in A_1$; if $A_k$ is +a vertex then $A_k = y$; if $A_k$ is a region then $y \in A_k$" -/ +def MatchesEnd (z : S) : ChainTerm S → Prop + | .inl v => v = z + | .inr r => z ∈ r + +/-- The left endpoint of a chain term, using `x` when the chain starts in a region. -/ +def leftEndpoint {S : Type u} (A : List (ChainTerm S)) (x : S) (i : Fin A.length) : S := + match A[i.1]'i.2 with + | .inl v => v + | .inr _ => + if i.1 = 0 then x + else + match A[i.1 - 1]'(Nat.lt_of_le_of_lt (Nat.sub_le _ _) i.2) with + | .inl v => v + | .inr _ => x + +/-- The right endpoint of a chain term, using `y` when the chain ends in a region. -/ +def rightEndpoint {S : Type u} (A : List (ChainTerm S)) (y : S) (i : Fin A.length) : S := + match A[i.1]'i.2 with + | .inl v => v + | .inr _ => + if hi : i.1 + 1 = A.length then y + else + match A[i.1 + 1]'(Nat.lt_of_le_of_ne (Nat.succ_le_of_lt i.2) hi) with + | .inl v => v + | .inr _ => y + +end ChainTerm + +/-- For $x, y \in W$, a sequence $A = [A_1, \dots, A_k]$ ($k \ge 1$) is an *$(x, y)$-chain* of $G$ +if: +(i) consecutive terms consist of a vertex of $G$ and a region of $G$ that are incident; +(ii) $A_1$ matches $x$ and $A_k$ matches $y$; and +(iii) $A_i$ is peripheral if and only if $i = 1$ or $i = k$. +Graph Minors VI, Section 3 (page 121). -/ +structure IsXYChain {S : Type u} [TopologicalSpace S] (G : Drawing S) (x y : S) + (A : List (ChainTerm S)) : Prop where + /-- The chain has at least one term ($k \ge 1$). -/ + ne_nil : A ≠ [] + /-- Every term is a vertex or region of $G$. -/ + valid : ∀ t ∈ A, t.IsValid G + /-- (i) Consecutive terms alternate between incident vertices and regions of $G$. -/ + isChain : A.IsChain (ChainTerm.AreIncident G) + /-- (ii) $A_1$ matches $x$. -/ + head_matches : (A.head ne_nil).MatchesEnd x + /-- (ii) $A_k$ matches $y$. -/ + last_matches : (A.getLast ne_nil).MatchesEnd y + /-- (iii) $A_i$ is peripheral if and only if $i$ is the first or last index. -/ + peripheral_iff : ∀ i : Fin A.length, + (A[i]).IsPeripheral G ↔ (i.1 = 0 ∨ i.1 + 1 = A.length) + +/-- Consecutive terms of a chain share their endpoints at the intervening drawing vertex. -/ +theorem IsXYChain.endpoints_eq {S : Type u} [TopologicalSpace S] {G : Drawing S} + {A : List (ChainTerm S)} {x y : S} (h : IsXYChain G x y A) + (i : Fin A.length) (hi : i.1 + 1 < A.length) : + ChainTerm.rightEndpoint A y i = ChainTerm.leftEndpoint A x ⟨i.1 + 1, hi⟩ := by + have hinc := List.isChain_iff_getElem.mp h.isChain i.1 hi + rcases hcurrent : A[i.1]'i.2 with v | r <;> + rcases hnext : A[i.1 + 1]'hi with w | r' + · rw [hcurrent, hnext] at hinc + exact False.elim hinc + · simp [ChainTerm.rightEndpoint, ChainTerm.leftEndpoint, hcurrent, hnext] + · simp [ChainTerm.rightEndpoint, ChainTerm.leftEndpoint, hcurrent, hnext, ne_of_lt hi] + · rw [hcurrent, hnext] at hinc + exact False.elim hinc + +/-- The *length* of an $(x, y)$-chain is the number of terms which are vertices. +Graph Minors VI, Section 3 (page 121): "The *length* of an $(x, y)$-chain is the number of terms +which are vertices." -/ +def chainLength {S : Type u} (A : List (ChainTerm S)) : ℕ := + (A.filter (fun t => decide t.IsVertex)).length + +theorem ncard_inl_mem_le_chainLength {S : Type u} (A : List (ChainTerm S)) : + {v : S | Sum.inl v ∈ A}.ncard ≤ chainLength A := by + induction A with + | nil => simp [chainLength] + | cons hd tl ih => + rcases hd with v | r + · have h_eq : {w : S | Sum.inl w ∈ (Sum.inl v : ChainTerm S) :: tl} = + insert v {w : S | Sum.inl w ∈ tl} := by + ext w; simp + have h_len : chainLength ((Sum.inl v : ChainTerm S) :: tl) = chainLength tl + 1 := rfl + rw [h_eq, h_len] + exact (ncard_insert_le v _).trans (Nat.add_le_add_right ih 1) + · have h_eq : {w : S | Sum.inl w ∈ (Sum.inr r : ChainTerm S) :: tl} = + {w : S | Sum.inl w ∈ tl} := by + ext w; simp + have h_len : chainLength ((Sum.inr r : ChainTerm S) :: tl) = chainLength tl := rfl + rw [h_eq, h_len] + exact ih + +theorem finite_inl_mem {S : Type u} (A : List (ChainTerm S)) : + {v : S | Sum.inl v ∈ A}.Finite := by + induction A with + | nil => simp + | cons hd tl ih => + rcases hd with v | r + · have h_eq : {w : S | Sum.inl w ∈ (Sum.inl v : ChainTerm S) :: tl} = + insert v {w : S | Sum.inl w ∈ tl} := by + ext w; simp + rw [h_eq] + exact ih.insert v + · have h_eq : {w : S | Sum.inl w ∈ (Sum.inr r : ChainTerm S) :: tl} = + {w : S | Sum.inl w ∈ tl} := by + ext w; simp + rw [h_eq] + exact ih + +/-- The *$\Delta$-redundancy* of an $(x, y)$-chain in $G$ is its length minus $\Delta(x, y)$. +Graph Minors VI, Section 3 (page 121): "The *$\Delta$-redundancy* of an $(x, y)$-chain in $G$ is +its length minus $\Delta(x, y)$." -/ +noncomputable def chainRedundancy {S : Type u} [TopologicalSpace S] (_G : Drawing S) + (Δ : Set (Set S)) (x y : S) (A : List (ChainTerm S)) : ℤ := + (chainLength A : ℤ) - (divisionCount (bd S) Δ x y : ℤ) + +/-- **Graph Minors VI, (3.1)** (page 120): +"If $G$ is connected and properly drawn on a disc $\Sigma$, then $G^{**} = G$. (More precisely, the +drawing of $G$ is a drawing of $G^{**}$.)" -/ +def Statement31 : Prop := + ∀ {S : Type u} [TopologicalSpace S] (G G_dual : Drawing S), + IsClosedDiscSpace S → IsGraphConnected G.toGraph → + IsDiscDualDrawing G G_dual → + IsDiscDualDrawing G_dual G + +/-- **Graph Minors VI, (3.2)** (page 120): +"Let $G$ be a connected graph, properly drawn on a disc $\Sigma$. Let $\Delta$ be a +cross-free division with* $$\bigcup \Delta = V(G) \cap bd(\Sigma).$$ *Let the drawing of +$G^*$ be chosen so that* $$\bigcup \Delta^* = V(G^*) \cap bd(\Sigma).$$ *Then $\Delta$ is +feasible in $G$ if and only if $\Delta^*$ is feasible in $G^*$." -/ +def Statement32 : Prop := + ∀ {S : Type u} [TopologicalSpace S] (G G_dual : Drawing S) (Δ : Set (Set S)), + IsClosedDiscSpace S → IsGraphConnected G.toGraph → + IsDivision Δ → divisionUnion Δ = G.V ∩ bd S → + IsCrossFree (bd S) Δ → IsDiscDualDrawing G G_dual → + (IsFeasible G.toGraph Δ ↔ + IsFeasible G_dual.toGraph (dualDivision (bd S) (G_dual.V ∩ bd S) Δ)) + +/-- **Graph Minors VI, (3.3)(i)** (page 120): +"If $|\delta| = 1$ for some $\delta \in \Delta$, and $\delta = \{v\}$ say, then $\Delta$ is feasible +in $G$ if and only if $\Delta - \{\delta\}$ is feasible in the graph obtained from $G$ by deleting +$v$." -/ +def Statement33i : Prop := + ∀ {α : Type u} {β : Type v} (G : Graph α β) (Δ : Set (Set α)) (v : α), + IsDivision Δ → divisionUnion Δ ⊆ V(G) → {v} ∈ Δ → + (IsFeasible G Δ ↔ IsFeasible (G.deleteVerts {v}) (Δ \ {{v}})) + +/-- **Graph Minors VI, (3.3)(ii)** (page 120): +"If $G$ has a component $G'$ with no vertex in $\operatorname{bd}(\Sigma)$ then $\Delta$ is feasible +in $G$ if and only if it is feasible in the graph obtained from $G$ by deleting $V(G')$." -/ +def Statement33ii : Prop := + ∀ {S : Type u} [TopologicalSpace S] (G : Drawing S) (G' : Graph S (Set S)) (Δ : Set (Set S)), + IsDivision Δ → divisionUnion Δ ⊆ G.V ∩ bd S → + IsGraphComponent G' G.toGraph → Disjoint V(G') (bd S) → + (IsFeasible G.toGraph Δ ↔ IsFeasible (G.toGraph.deleteVerts V(G')) Δ) + +/-- **Graph Minors VI, (3.3)(iii)** (page 121): +"If there exists $\delta \in \Delta$ which intersects more than one component of $G$ then $\Delta$ +is not feasible in $G$." -/ +def Statement33iii : Prop := + ∀ {α : Type u} {β : Type v} (G : Graph α β) (Δ : Set (Set α)) (δ : Set α) + (G₁ G₂ : Graph α β), + δ ∈ Δ → IsGraphComponent G₁ G → IsGraphComponent G₂ G → G₁ ≠ G₂ → + (δ ∩ V(G₁)).Nonempty → (δ ∩ V(G₂)).Nonempty → + ¬ IsFeasible G Δ + +/-- **Graph Minors VI, (3.3)(iv)** (page 121): +"If $G$ has components $G_1, \dots, G_k$ for $k \ge 2$, and (ii), (iii) do not apply, let +$(\Delta_1, \dots, \Delta_k)$ be the partition of $\Delta$ such that* $$\bigcup \Delta_i = +V(G_i) \cap bd(\Sigma) \qquad (1 \le i \le k);$$ *then $\Delta$ is feasible in $G$ if and +only if $\Delta_i$ is feasible in $G_i$ for each $i$." -/ +def Statement33iv : Prop := + ∀ {S : Type u} [TopologicalSpace S] (G : Drawing S) (Δ : Set (Set S)) + (k : ℕ) (G_comp : Fin k → Graph S (Set S)) (Δ_part : Fin k → Set (Set S)), + 2 ≤ k → IsDivision Δ → divisionUnion Δ = G.V ∩ bd S → + InjOn G_comp Set.univ → + graphComponents G.toGraph = Set.range G_comp → + (∀ i : Fin k, Δ_part i = {δ ∈ Δ | δ ⊆ V(G_comp i)}) → + (∀ δ ∈ Δ, ∃ i : Fin k, δ ⊆ V(G_comp i)) → + (IsFeasible G.toGraph Δ ↔ ∀ i : Fin k, IsFeasible (G_comp i) (Δ_part i)) + +/-- **Graph Minors VI, (3.5)** (page 121): +"If $G$ is connected, any $(x, y)$-chain of $G^*$ corresponds to an $(x, y)$-chain of $G$, and if +$\Delta$ is cross-free the $\Delta^*$-redundancy of the first chain equals the $\Delta$-redundancy +of the second." -/ +def Statement35 : Prop := + ∀ {S : Type u} [TopologicalSpace S] (G G_dual : Drawing S) (Δ : Set (Set S)) (x y : S) + (A_dual : List (ChainTerm S)), + IsClosedDiscSpace S → IsGraphConnected G.toGraph → + IsDivision Δ → divisionUnion Δ = G.V ∩ bd S → + IsCrossFree (bd S) Δ → IsDiscDualDrawing G G_dual → + x ∈ (G_dual.V ∩ bd S) ∪ divisionUnion Δ → + y ∈ (G_dual.V ∩ bd S) ∪ divisionUnion Δ → + IsXYChain G_dual x y A_dual → + ∃ A : List (ChainTerm S), + IsXYChain G x y A ∧ + chainRedundancy G_dual (dualDivision (bd S) (G_dual.V ∩ bd S) Δ) x y A_dual = + chainRedundancy G Δ x y A + +/-- **Graph Minors VI, (3.6)** (page 122): +"Let $G$ be properly drawn on a disc $\Sigma$, and let $\Delta$ be a division with* $$\bigcup +\Delta = V(G) \cap bd(\Sigma).$$ *Then $\Delta$ is feasible in $G$ if and only if* (i) +*$\Delta$ is cross-free, and* (ii) *every $(x, y)$-chain has non-negative redundancy, for +all $x, y \in W$" -/ +def Statement36 : Prop := + ∀ {S : Type u} [TopologicalSpace S] (G : Drawing S) (Δ : Set (Set S)) (U : Set S), + IsClosedDiscSpace S → G.IsProper → + IsDivision Δ → divisionUnion Δ = G.V ∩ bd S → + IsDualPointSet (bd S) (divisionUnion Δ) U → + (IsFeasible G.toGraph Δ ↔ + IsCrossFree (bd S) Δ ∧ + ∀ x ∈ U ∪ divisionUnion Δ, ∀ y ∈ U ∪ divisionUnion Δ, + ∀ A : List (ChainTerm S), IsXYChain G x y A → + 0 ≤ chainRedundancy G Δ x y A) + +/-! ## Graph separations -/ + +/-- A *separation* of a graph $G$ is a pair $(G_1, G_2)$ of subgraphs of $G$ with +$V(G_1) \cup V(G_2) = V(G)$, $E(G_1) \cup E(G_2) = E(G)$, and $E(G_1) \cap E(G_2) = \emptyset$. +Graph Minors VI, Section 5 (page 128). -/ +def IsGraphSeparation {α : Type u} {β : Type v} (G G₁ G₂ : Graph α β) : Prop := + G₁ ≤ G ∧ G₂ ≤ G ∧ V(G₁) ∪ V(G₂) = V(G) ∧ E(G₁) ∪ E(G₂) = E(G) ∧ Disjoint E(G₁) E(G₂) + +end GraphMinor.GM06 diff --git a/LeanPool/GraphMinor/GM06/DiscRegions.lean b/LeanPool/GraphMinor/GM06/DiscRegions.lean new file mode 100644 index 0000000000..23e9de782b --- /dev/null +++ b/LeanPool/GraphMinor/GM06/DiscRegions.lean @@ -0,0 +1,1060 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.RegionLocal +public import LeanPool.GraphMinor.GM06.Section2Dual +public import LeanPool.GraphMinor.GM11.Section5b +import LeanPool.GraphMinor.Surface.JordanDomain +import LeanPool.GraphMinor.GM11.EdgeSides +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.Surface.DiscArcs +import Mathlib.Analysis.Convex.PathConnected + +/-! +# Regions and Edges of a Proper Drawing on a Closed Disc Space + +This file adapts the edge-side and region-connectivity lemmas of `GraphMinor.GM11` (`EdgeSides`, +`Regions`, `Section5`, `Section5b`) from closed surfaces to proper drawings on a closed disc space +`S` (`IsClosedDiscSpace S`), with zero unproved hypotheses. +-/ + +public section + +namespace GraphMinor.GM06 + +open Set Function Topology Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- `bd S` is closed in `S` when `IsClosedDiscSpace S`. -/ +theorem isClosed_bd_of_isClosedDiscSpace (hS : IsClosedDiscSpace S) : + IsClosed (bd S) := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : CompactSpace ClosedUnitDisc := + isCompact_iff_compactSpace.mp (isCompact_closedBall (0 : EuclideanPlane) 1) + obtain ⟨φ⟩ := hS + have hbd := image_bd_homeomorph φ + rw [bd_closedUnitDisc] at hbd + rw [← hbd] + have hcl : IsClosed {x : ClosedUnitDisc | x.1 ∈ UnitCircle} := + isClosed_sphere.preimage continuous_subtype_val + exact hcl.isCompact.image φ.continuous |>.isClosed + +/-- Small closed disc neighborhoods around an interior point `p ∈ O \ bd S` of a closed disc +space `S`. -/ +theorem disc_exists_closedDisc_nbhd (hS : IsClosedDiscSpace S) {O : Set S} (hO : IsOpen O) + {p : S} (hpO : p ∈ O) (hpbd : p ∉ bd S) : + ∃ D D' : Set S, + IsClosedDisc D ∧ IsOpen D' ∧ p ∈ D' ∧ D' ⊆ D ∧ D ⊆ O ∧ D \ D' = discBd D := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : CompactSpace ClosedUnitDisc := + isCompact_iff_compactSpace.mp (isCompact_closedBall (0 : EuclideanPlane) 1) + have hbd_cl : IsClosed (bd S) := isClosed_bd_of_isClosedDiscSpace hS + obtain ⟨φ⟩ := hS + have hbd_img := image_bd_homeomorph φ + rw [bd_closedUnitDisc] at hbd_img + let c : ClosedUnitDisc := φ.symm p + have hc_open : (c : EuclideanPlane) ∈ OpenUnitDisc := by + have hle : ‖(c : EuclideanPlane)‖ ≤ 1 := mem_closedBall_zero_iff.mp c.2 + have hne : ‖(c : EuclideanPlane)‖ ≠ 1 := by + intro h1 + apply hpbd + rw [← hbd_img] + exact ⟨c, by simpa [UnitCircle] using h1, φ.apply_symm_apply p⟩ + simpa [OpenUnitDisc] using lt_of_le_of_ne hle hne + let P : Set ClosedUnitDisc := φ ⁻¹' (O \ bd S) + have hP_open : IsOpen P := (hO.sdiff hbd_cl).preimage φ.continuous + rw [isOpen_induced_iff] at hP_open + obtain ⟨W, hW_open, hW_eq⟩ := hP_open + have hcW : (c : EuclideanPlane) ∈ W ∩ OpenUnitDisc := by + refine ⟨?_, hc_open⟩ + have hcP : c ∈ P := by + change φ c ∈ O \ bd S + rw [φ.apply_symm_apply] + exact ⟨hpO, hpbd⟩ + rw [← hW_eq] at hcP + exact hcP + obtain ⟨ρ', hρ', hball⟩ := Metric.isOpen_iff.mp (hW_open.inter Metric.isOpen_ball) c.1 hcW + let ρ : ℝ := ρ' / 2 + have hρ : 0 < ρ := half_pos hρ' + have hclosed : Metric.closedBall (c : EuclideanPlane) ρ ⊆ W ∩ OpenUnitDisc := + (Metric.closedBall_subset_ball (half_lt_self hρ')).trans hball + have hto : Metric.closedBall (c : EuclideanPlane) ρ ⊆ ClosedUnitDisc := + fun x hx => Metric.ball_subset_closedBall (hclosed hx).2 + let g : EuclideanPlane → EuclideanPlane := fun x => (c : EuclideanPlane) + ρ • x + have hg : Continuous g := by fun_prop + have hgin : ∀ x : EuclideanPlane, + g x ∈ Metric.closedBall (c : EuclideanPlane) ρ ↔ x ∈ ClosedUnitDisc := by + intro x + simp only [g, Metric.mem_closedBall, dist_eq_norm, add_sub_cancel_left, ClosedUnitDisc, + sub_zero, norm_smul, Real.norm_eq_abs, abs_of_pos hρ] + exact ⟨fun h' => le_of_mul_le_mul_left (by simpa using h') hρ, fun h' => by nlinarith⟩ + have hgball : ∀ x : EuclideanPlane, + g x ∈ Metric.ball (c : EuclideanPlane) ρ ↔ x ∈ OpenUnitDisc := by + intro x + simp only [g, Metric.mem_ball, dist_eq_norm, add_sub_cancel_left, OpenUnitDisc, + sub_zero, norm_smul, Real.norm_eq_abs, abs_of_pos hρ] + exact ⟨fun h' => lt_of_mul_lt_mul_left (by simpa using h') hρ.le, fun h' => by nlinarith⟩ + let k : ClosedUnitDisc → S := fun x => φ ⟨g x.1, hto ((hgin x.1).mpr x.2)⟩ + have hk : Continuous k := φ.continuous.comp (Continuous.subtype_mk (hg.comp + continuous_subtype_val) _) + have hkinj : Function.Injective k := by + intro x y hxy + have h₁ : g x.1 = g y.1 := congrArg Subtype.val (φ.injective hxy) + have h₂ : ρ • x.1 = ρ • y.1 := add_left_cancel h₁ + exact Subtype.ext (smul_right_injective _ hρ.ne' h₂) + let D : Set S := range k + let E : ClosedUnitDisc ≃ₜ D := + Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofInjective k hkinj) hk.rangeFactorization + have hE_val : ∀ x : ClosedUnitDisc, (E x).1 = k x := fun _ => rfl + let B_sub : Set ClosedUnitDisc := Subtype.val ⁻¹' Metric.ball (c : EuclideanPlane) ρ + have hB_open : IsOpen B_sub := Metric.isOpen_ball.preimage continuous_subtype_val + let D' : Set S := φ '' B_sub + have hD'open : IsOpen D' := φ.isOpenMap _ hB_open + have hkD' : ∀ x : ClosedUnitDisc, k x ∈ D' ↔ x.1 ∈ OpenUnitDisc := by + intro x + constructor + · rintro ⟨y, hy, hyk⟩ + have heq : ⟨g x.1, hto ((hgin x.1).mpr x.2)⟩ = y := φ.injective hyk.symm + have hgy : g x.1 = y.1 := congrArg Subtype.val heq + rw [← hgball, hgy] + exact hy + · intro hx + refine ⟨⟨g x.1, hto ((hgin x.1).mpr x.2)⟩, ?_, rfl⟩ + exact (hgball x.1).mpr hx + have hbd := disc_boundary D E + refine ⟨D, D', ⟨E⟩, hD'open, ⟨c, by simp [B_sub, hρ], φ.apply_symm_apply p⟩, ?_, ?_, ?_⟩ + · rintro _ ⟨y, hy, rfl⟩ + have hy' : (y : EuclideanPlane) ∈ Metric.ball (c : EuclideanPlane) ρ := hy + let x : EuclideanPlane := ρ⁻¹ • ((y : EuclideanPlane) - c.1) + have hgx : g x = (y : EuclideanPlane) := by + simp only [g, x, smul_smul, mul_inv_cancel₀ hρ.ne', one_smul, add_sub_cancel] + have hxm : x ∈ OpenUnitDisc := by + rw [← hgball, hgx] + exact hy' + refine ⟨⟨x, Metric.ball_subset_closedBall hxm⟩, ?_⟩ + change φ ⟨g x, _⟩ = φ y + congr 1 + exact Subtype.ext hgx + · rintro _ ⟨x, rfl⟩ + have hxW : g x.1 ∈ W := (hclosed ((hgin x.1).mpr x.2)).1 + have hxP : (⟨g x.1, hto ((hgin x.1).mpr x.2)⟩ : ClosedUnitDisc) ∈ P := by + rw [← hW_eq] + exact hxW + exact hxP.1 + · rw [hbd] + ext q + constructor + · rintro ⟨⟨x, rfl⟩, hq⟩ + refine ⟨x, ?_, hE_val x⟩ + have hle : ‖x.1‖ ≤ 1 := by simpa [ClosedUnitDisc] using x.2 + have hne : ¬ ‖x.1‖ < 1 := fun hlt => hq ((hkD' x).mpr (by simpa [OpenUnitDisc] using hlt)) + have : ‖x.1‖ = 1 := le_antisymm hle (not_lt.mp hne) + simpa [UnitCircle] using this + · rintro ⟨x, hx, rfl⟩ + refine ⟨⟨x, (hE_val x).symm⟩, fun hin => ?_⟩ + have h₁ : ‖x.1‖ < 1 := by simpa [OpenUnitDisc] using (hkD' x).mp hin + have h₂ : ‖x.1‖ = 1 := by simpa [UnitCircle] using hx + linarith + +/-- Small punctured neighborhoods in a closed disc space `S`. -/ +theorem disc_exists_punctured_nbhd (hS : IsClosedDiscSpace S) {O : Set S} (hO : IsOpen O) + {x : S} (hx : x ∈ O) : + ∃ Z : Set S, IsOpen Z ∧ x ∈ Z ∧ Z ⊆ O ∧ IsPreconnected (Z \ {x}) ∧ x ∈ closure (Z \ {x}) := by + obtain ⟨φ⟩ := hS + let c : ClosedUnitDisc := φ.symm x + have hφc : φ c = x := φ.apply_symm_apply x + have hbd_img := image_bd_homeomorph φ + rw [bd_closedUnitDisc] at hbd_img + by_cases h_int : (c : EuclideanPlane) ∈ OpenUnitDisc + · let P : Set ClosedUnitDisc := φ ⁻¹' O + have hP_open : IsOpen P := hO.preimage φ.continuous + rw [isOpen_induced_iff] at hP_open + obtain ⟨W, hW_open, hW_eq⟩ := hP_open + have hcW : (c : EuclideanPlane) ∈ W ∩ OpenUnitDisc := by + refine ⟨?_, h_int⟩ + have hcP : c ∈ P := by simp [P, hφc, hx] + rw [← hW_eq] at hcP + exact hcP + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp (hW_open.inter Metric.isOpen_ball) c.1 hcW + have hsub : Metric.ball (c : EuclideanPlane) δ ⊆ ClosedUnitDisc := + fun y hy => Metric.ball_subset_closedBall (hball hy).2 + let B : Set ClosedUnitDisc := Subtype.val ⁻¹' Metric.ball (c : EuclideanPlane) δ + have hdiff : φ '' B \ {x} = + φ '' (Subtype.val ⁻¹' (Metric.ball (c : EuclideanPlane) δ \ {(c : EuclideanPlane)})) := by + ext q + constructor + · rintro ⟨⟨y, hy, rfl⟩, hne⟩ + refine ⟨y, ⟨hy, fun hyc => hne ?_⟩, rfl⟩ + have : y = c := Subtype.ext hyc + rw [this, hφc] + rfl + · rintro ⟨y, ⟨hy, hne⟩, rfl⟩ + refine ⟨⟨y, hy, rfl⟩, fun hq => hne ?_⟩ + have : y = c := φ.injective (hq.trans hφc.symm) + rw [this] + rfl + refine ⟨φ '' B, φ.isOpenMap _ (Metric.isOpen_ball.preimage continuous_subtype_val), + ⟨c, by simp [B, hδ], hφc⟩, ?_, ?_, ?_⟩ + · rintro _ ⟨y, hy, rfl⟩ + have hyW : (y : EuclideanPlane) ∈ W := (hball hy).1 + have hyP : y ∈ P := by rw [← hW_eq]; exact hyW + exact hyP + · rw [hdiff] + refine IsPreconnected.image ?_ _ φ.continuous.continuousOn + refine (IsInducing.subtypeVal : + IsInducing (Subtype.val : ClosedUnitDisc → EuclideanPlane)).isPreconnected_image.mp ?_ + rw [Subtype.image_preimage_coe, inter_eq_right.mpr (sdiff_subset.trans hsub)] + exact isPreconnected_ball_sdiff _ hδ + · rw [hdiff, ← hφc] + refine image_closure_subset_closure_image φ.continuous ⟨c, ?_, rfl⟩ + rw [closure_subtype, Subtype.image_preimage_coe, inter_eq_right.mpr (sdiff_subset.trans hsub)] + refine Metric.mem_closure_iff.mpr fun ε hε => ?_ + have hr : 0 < min ε δ / 2 := by positivity + obtain ⟨b, hb⟩ := (NormedSpace.sphere_nonempty (x := (c : EuclideanPlane))).mpr hr.le + have hbd : dist b (c : EuclideanPlane) = min ε δ / 2 := hb + have hlt₁ : min ε δ / 2 < δ := by + have := min_le_right ε δ + linarith + have hlt₂ : min ε δ / 2 < ε := by + have := min_le_left ε δ + linarith + refine ⟨b, ⟨?_, ?_⟩, ?_⟩ + · simpa [hbd] using hlt₁ + · intro hbc + rw [hbc, dist_self] at hbd + exact hr.ne hbd + · rw [dist_comm] + simpa [hbd] using hlt₂ + · let P : Set ClosedUnitDisc := φ ⁻¹' O + have hP_open : IsOpen P := hO.preimage φ.continuous + rw [isOpen_induced_iff] at hP_open + obtain ⟨W, hW_open, hW_eq⟩ := hP_open + have hcW : (c : EuclideanPlane) ∈ W := by + have hcP : c ∈ P := by simp [P, hφc, hx] + rw [← hW_eq] at hcP + exact hcP + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp hW_open c.1 hcW + let B : Set ClosedUnitDisc := Subtype.val ⁻¹' Metric.ball (c : EuclideanPlane) δ + let U_open : Set EuclideanPlane := Metric.ball (c : EuclideanPlane) δ ∩ OpenUnitDisc + have hU_sub : U_open ⊆ ClosedUnitDisc := + fun y hy => Metric.ball_subset_closedBall hy.2 + let B_open : Set ClosedUnitDisc := Subtype.val ⁻¹' U_open + have hB_open_conn : IsPreconnected B_open := by + refine (IsInducing.subtypeVal : + IsInducing (Subtype.val : ClosedUnitDisc → EuclideanPlane)).isPreconnected_image.mp ?_ + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hU_sub] + exact ((convex_ball _ _).inter convex_openUnitDisc).isPreconnected + have hB_sub_diff : B_open ⊆ B \ {c} := by + intro y hy + refine ⟨hy.1, fun hyc => ?_⟩ + rw [mem_singleton_iff] at hyc + subst hyc + exact h_int hy.2 + have hB_sub_cl : B ⊆ closure B_open := by + intro y hy + rw [closure_subtype, Subtype.image_preimage_coe, inter_eq_right.mpr hU_sub] + have hcl : (y : EuclideanPlane) ∈ closure (OpenUnitDisc : Set EuclideanPlane) := by + rw [show closure (OpenUnitDisc : Set EuclideanPlane) = ClosedUnitDisc from + closure_ball _ one_ne_zero] + exact y.2 + exact Metric.isOpen_ball.inter_closure ⟨hy, hcl⟩ + have hB_diff_conn : IsPreconnected (B \ {c}) := + hB_open_conn.subset_closure hB_sub_diff (sdiff_subset.trans hB_sub_cl) + have hc_cl : c ∈ closure (B \ {c}) := + closure_mono hB_sub_diff (hB_sub_cl (Metric.mem_ball_self hδ)) + have hdiff_eq : φ '' B \ {x} = φ '' (B \ {c}) := by + ext q + constructor + · rintro ⟨⟨y, hy, rfl⟩, hne⟩ + refine ⟨y, ⟨hy, fun hyc => hne ?_⟩, rfl⟩ + rw [mem_singleton_iff] at hyc + rw [hyc, hφc] + rfl + · rintro ⟨y, ⟨hy, hne⟩, rfl⟩ + refine ⟨⟨y, hy, rfl⟩, fun hq => hne ?_⟩ + exact φ.injective (hq.trans hφc.symm) + refine ⟨φ '' B, φ.isOpenMap _ (Metric.isOpen_ball.preimage continuous_subtype_val), + ⟨c, Metric.mem_ball_self hδ, hφc⟩, ?_, ?_, ?_⟩ + · rintro _ ⟨y, hy, rfl⟩ + have hyW : (y : EuclideanPlane) ∈ W := hball hy + have hyP : y ∈ P := by rw [← hW_eq]; exact hyW + exact hyP + · rw [hdiff_eq] + exact hB_diff_conn.image _ φ.continuous.continuousOn + · rw [hdiff_eq, ← hφc] + exact image_closure_subset_closure_image φ.continuous ⟨c, hc_cl, rfl⟩ + +private theorem exists_edge_side_neighborhood {Y Δ A₀ D D' F : Set S} + {Γ : Drawing S} {e : Set S} {p : S} + (hY : IsClosed Y) (hpY : p ∉ Y) (hpF : p ∈ F) + (hYcover : Γ.U \ e ⊆ Y) (hFU : F ⊆ Γ.U) + (hFsub : ∀ x ∈ e, x ∉ Y → x ∈ F) + (hbdD : D \ D' = discBd D) (hΔ : IsClosedDisc Δ) + (hbdΔ : discBd Δ = A₀ ∪ F) (hA₀ : A₀ ⊆ discBd D) : + ∃ A W : Set S, IsOpen W ∧ p ∈ W ∧ IsPreconnected A ∧ Disjoint A Γ.U ∧ + (∀ x ∈ W, x ∈ D' → x ∈ Δ → x ∉ Γ.U → x ∈ A) ∧ + (∀ x ∈ W, x ∈ e → x ∉ Y → x ∈ closure A) := by + have hpbd : p ∈ discBd Δ := by rw [hbdΔ]; exact Or.inr hpF + obtain ⟨A, W, hW, hpW, hconn, -, hAbd, hAY, hin, hcl⟩ := + exists_half_nbhd hΔ hY hpbd hpY + refine ⟨A, W, hW, hpW, hconn, ?_, ?_, ?_⟩ + · refine disjoint_left.mpr fun x hxA hxU => ?_ + have hxY : x ∉ Y := disjoint_left.mp hAY hxA + have hxe : x ∈ e := by + by_contra hxe + exact hxY (hYcover ⟨hxU, hxe⟩) + refine disjoint_left.mp hAbd hxA ?_ + rw [hbdΔ] + exact Or.inr (hFsub x hxe hxY) + · intro x hxW hxD' hxΔ hxU + refine hin ⟨⟨hxW, hxΔ⟩, ?_⟩ + rw [hbdΔ] + rintro (h | h) + · have hx' := hA₀ h + rw [← hbdD] at hx' + exact hx'.2 hxD' + · exact hxU (hFU h) + · intro x hxW hxe hxY + refine hcl ⟨hxW, ?_⟩ + rw [hbdΔ] + exact Or.inr (hFsub x hxe hxY) + +/-- Two sides of an edge of a proper drawing on a closed disc space `S`. -/ +theorem disc_exists_edge_sides (hS : IsClosedDiscSpace S) (Γ : Drawing S) (hprop : Γ.IsProper) + {e : Set S} (he : e ∈ Γ.E) {p : S} (hp : p ∈ e) : + ∃ W A₁ A₂ : Set S, IsOpen W ∧ p ∈ W ∧ W ∩ Γ.U ⊆ e ∧ W \ Γ.U ⊆ A₁ ∪ A₂ ∧ + IsPreconnected A₁ ∧ IsPreconnected A₂ ∧ Disjoint A₁ Γ.U ∧ Disjoint A₂ Γ.U ∧ + e ∩ W ⊆ closure A₁ ∧ e ∩ W ⊆ closure A₂ := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + obtain ⟨γ, hγ, hγ0, hγ1, hinj, hγe⟩ := exists_edge_param Γ he + have hX₀ := isClosed_U_sdiff_edge Γ he + have hpX₀ : p ∉ Γ.U \ e := fun h => h.2 hp + have hpbd : p ∉ bd S := fun hbd => (he.2.1 hp).2 (hprop ⟨hbd, (he.2.1 hp).1⟩) + obtain ⟨D, D', hD, hD', hpD', hD'D, hDO, hbdD⟩ := + disc_exists_closedDisc_nbhd hS hX₀.isOpen_compl hpX₀ hpbd + have hVout : ∀ x ∈ Γ.V, x ∉ D := fun x hx hxD => + hDO hxD ⟨Γ.V_subset_U hx, fun hxe => (he.2.1 hxe).2 hx⟩ + obtain ⟨t₀, ⟨ht₀0, ht₀1⟩, rfl⟩ : p ∈ γ '' Ioo 0 1 := by rw [hγe]; exact hp + obtain ⟨a, b, hat', htb', hIcc, hIoo, hFline, hFD, hFcap, hst⟩ := + GM11.exists_edge_piece_in_disc hD hD' hD'D hbdD hγ hinj + (hVout _ hγ0) (hVout _ hγ1) hpD' + let F := γ '' Icc a b + have hFmem : ∀ x, x ∈ F ↔ ∃ t ∈ Icc a b, γ t = x := fun _ ↦ Iff.rfl + obtain ⟨A₁, A₂, Δ₁, Δ₂, -, hcomp, hΔ₁, hΔ₂, hunion, -, hbd₁, hbd₂, -⟩ := + disc_iArc D F (γ a) (γ b) hD hFD hst hFline hFcap + have hAsub : ∀ A ∈ componentsIn (discBd D \ {γ a, γ b}), A ⊆ discBd D := by + rintro _ ⟨x, -, rfl⟩ + exact (connectedComponentIn_subset _ _).trans sdiff_subset + have hA₁ : A₁ ⊆ discBd D := hAsub _ (by rw [hcomp]; simp) + have hA₂ : A₂ ⊆ discBd D := hAsub _ (by rw [hcomp]; simp) + have hFU : F ⊆ Γ.U := by + intro x hx + obtain ⟨t, ht, rfl⟩ := (hFmem x).mp hx + have hmem : γ t ∈ e := by rw [← hγe]; exact ⟨t, hIcc ht, rfl⟩ + exact (he.2.1 hmem).1 + let Y : Set S := D'ᶜ ∪ (Γ.U \ e) ∪ γ '' {t | t ≤ a ∨ b ≤ t} + have hY : IsClosed Y := by + refine (hD'.isClosed_compl.union hX₀).union ?_ + exact ((isClosed_Iic.union isClosed_Ici).isCompact.image hγ).isClosed + have hpY : γ t₀ ∉ Y := by + rintro ((h | h) | ⟨t, ht, hteq⟩) + · exact h hpD' + · exact h.2 hp + · have hpV : t ∈ Ioo (0 : unitInterval) 1 := by + refine ⟨unitInterval.pos_iff_ne_zero.mpr ?_, unitInterval.lt_one_iff_ne_one.mpr ?_⟩ + · rintro rfl + exact (he.2.1 hp).2 (hteq ▸ hγ0) + · rintro rfl + exact (he.2.1 hp).2 (hteq ▸ hγ1) + have := hinj hpV ⟨ht₀0, ht₀1⟩ hteq + subst this + rcases ht with h | h + · exact absurd h (not_le.mpr hat') + · exact absurd h (not_le.mpr htb') + have hpF : γ t₀ ∈ F := (hFmem _).mpr ⟨t₀, ⟨hat'.le, htb'.le⟩, rfl⟩ + have hFsub : ∀ x ∈ e, x ∉ Y → x ∈ F := by + intro x hx hxY + obtain ⟨t, -, rfl⟩ : x ∈ γ '' Ioo 0 1 := by rw [hγe]; exact hx + refine (hFmem _).mpr ⟨t, ?_, rfl⟩ + have hn : ¬ (t ≤ a ∨ b ≤ t) := fun h => hxY (Or.inr ⟨t, h, rfl⟩) + push Not at hn + exact ⟨hn.1.le, hn.2.le⟩ + have hYcover : Γ.U \ e ⊆ Y := fun _ h => Or.inl (Or.inr h) + obtain ⟨S₁, W₁, hW₁, hpW₁, hconn₁, hdis₁, hin₁, hcl₁⟩ := + exists_edge_side_neighborhood hY hpY hpF hYcover hFU hFsub hbdD hΔ₁ hbd₁ hA₁ + obtain ⟨S₂, W₂, hW₂, hpW₂, hconn₂, hdis₂, hin₂, hcl₂⟩ := + exists_edge_side_neighborhood hY hpY hpF hYcover hFU hFsub hbdD hΔ₂ hbd₂ hA₂ + refine ⟨W₁ ∩ W₂ ∩ Yᶜ, S₁, S₂, (hW₁.inter hW₂).inter hY.isOpen_compl, ⟨⟨hpW₁, hpW₂⟩, hpY⟩, + ?_, ?_, hconn₁, hconn₂, hdis₁, hdis₂, ?_, ?_⟩ + · rintro x ⟨⟨-, hxY⟩, hxU⟩ + by_contra hxe + exact hxY (Or.inl (Or.inr ⟨hxU, hxe⟩)) + · rintro x ⟨⟨⟨hx₁, hx₂⟩, hxY⟩, hxU⟩ + have hxD' : x ∈ D' := by + by_contra h + exact hxY (Or.inl (Or.inl h)) + have hxD : x ∈ Δ₁ ∪ Δ₂ := by rw [hunion]; exact hD'D hxD' + rcases hxD with h | h + · exact Or.inl (hin₁ x hx₁ hxD' h hxU) + · exact Or.inr (hin₂ x hx₂ hxD' h hxU) + · rintro x ⟨hxe, ⟨hx₁, -⟩, hxY⟩ + exact hcl₁ x hx₁ hxe hxY + · rintro x ⟨hxe, ⟨-, hx₂⟩, hxY⟩ + exact hcl₂ x hx₂ hxe hxY + +/-- If a region of a proper drawing on `S` has a point of an edge `e` in its closure, then all of +`e` lies in its closure. -/ +theorem disc_edge_subset_closure_of_incident (hS : IsClosedDiscSpace S) {Γ : Drawing S} + (hprop : Γ.IsProper) {e r : Set S} (he : e ∈ Γ.E) (hr : r ∈ Γ.R) + (hinc : (e ∩ closure r).Nonempty) : e ⊆ closure r := + GM11.edge_subset_closure_of_local_sides + (fun _ hp => disc_exists_edge_sides hS Γ hprop he hp) he hr hinc + +/-- Every edge of a proper drawing on `S` is incident with a region. -/ +theorem disc_exists_region_incident (hS : IsClosedDiscSpace S) {Γ : Drawing S} + (hprop : Γ.IsProper) {e : Set S} (he : e ∈ Γ.E) : + ∃ r ∈ Γ.R, e ⊆ closure r := + GM11.exists_region_incident_of_local_sides + (fun _ hp => disc_exists_edge_sides hS Γ hprop he hp) he + +/-- An edge of a proper drawing on `S` is incident with at most two regions. -/ +theorem disc_region_incident_two (hS : IsClosedDiscSpace S) {Γ : Drawing S} + (hprop : Γ.IsProper) {e r₁ r₂ r₃ : Set S} (he : e ∈ Γ.E) (h₁ : r₁ ∈ Γ.R) (h₂ : r₂ ∈ Γ.R) + (h₃ : r₃ ∈ Γ.R) (i₁ : e ⊆ closure r₁) (i₂ : e ⊆ closure r₂) (i₃ : e ⊆ closure r₃) : + r₁ = r₂ ∨ r₁ = r₃ ∨ r₂ = r₃ := + GM11.region_incident_two_of_local_sides + (fun _ hp => disc_exists_edge_sides hS Γ hprop he hp) he h₁ h₂ h₃ i₁ i₂ i₃ + +/-- Either an edge of a proper drawing on `S` is incident with a region, or it misses the closure +of the region. -/ +theorem disc_edge_incident_or_disjoint (hS : IsClosedDiscSpace S) {Γ : Drawing S} + (hprop : Γ.IsProper) {e r : Set S} (he : e ∈ Γ.E) (hr : r ∈ Γ.R) : + e ⊆ closure r ∨ Disjoint e (closure r) := by + by_cases h : (e ∩ closure r).Nonempty + · exact Or.inl (disc_edge_subset_closure_of_incident hS hprop he hr h) + · exact Or.inr (disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp h)) + +/-- An open connected subset of a closed disc space `S` stays connected when finitely many points +are removed. -/ +theorem disc_isPreconnected_sdiff_finite (hS : IsClosedDiscSpace S) {G F : Set S} (hG : IsOpen G) + (hGc : IsPreconnected G) (hF : F.Finite) : IsPreconnected (G \ F) := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + exact isPreconnected_sdiff_finite_of_punctured_nbhd + (fun {_} hO {_} hx => disc_exists_punctured_nbhd hS hO hx) hG hGc hF + +/-- A point in any nonempty open subset of `S` lies off `U(Γ)` for a proper drawing `Γ`. -/ +theorem disc_exists_notMem_U (hS : IsClosedDiscSpace S) {Γ : Drawing S} (hprop : Γ.IsProper) + {O : Set S} (hO : IsOpen O) (hne : O.Nonempty) : + ∃ y ∈ O, y ∉ Γ.U := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + obtain ⟨x, hx⟩ := hne + obtain ⟨y, hyO, hyV⟩ : ∃ y ∈ O, y ∉ Γ.V := by + have hF : IsOpen (O ∩ (Γ.V \ {x})ᶜ) := + hO.inter (Γ.finite_V.subset sdiff_subset).isClosed.isOpen_compl + obtain ⟨Z, -, -, hZsub, -, hZcl⟩ := + disc_exists_punctured_nbhd hS hF ⟨hx, fun h => h.2 rfl⟩ + obtain ⟨y, hy⟩ : (Z \ {x}).Nonempty := by + by_contra hcon + rw [not_nonempty_iff_eq_empty] at hcon + rw [hcon, closure_empty] at hZcl + exact hZcl + exact ⟨y, (hZsub hy.1).1, fun hyV => (hZsub hy.1).2 ⟨hyV, hy.2⟩⟩ + by_cases hyU : y ∈ Γ.U + · obtain ⟨e, he, hye⟩ := Γ.exists_edge_of_mem hyU hyV + obtain ⟨W, A₁, A₂, hW, hyW, -, -, -, -, d₁, -, c₁, -⟩ := + disc_exists_edge_sides hS Γ hprop he hye + obtain ⟨a, ⟨haW, haO⟩, ha⟩ := mem_closure_iff.mp (c₁ ⟨hye, hyW⟩) _ (hW.inter hO) ⟨hyW, hyO⟩ + exact ⟨a, haO, disjoint_left.mp d₁ ha⟩ + · exact ⟨y, hyO, hyU⟩ + +/-- Deleting an edge from a proper drawing on `S` preserves properness. -/ +theorem deleteEdge_isProper {Γ : Drawing S} [T2Space S] (hprop : Γ.IsProper) (e : Set S) : + (Γ.deleteEdge e).IsProper := by + have hsub := deleteEdge_isSubdrawing Γ e + rintro x ⟨hxbd, hxU⟩ + rw [deleteEdge_V] + exact hprop ⟨hxbd, hsub.U_subset hxU⟩ + +/-- Closed-disc version of Graph Minors XI, (5.1): if `Γ' ⊆ Γ` is a subdrawing of a proper drawing +`Γ` on a closed disc space `S`, `r' ∈ Γ'.R`, and `r₁ ∈ Z`, `r₂ ∈ Γ.R \ Z` satisfy `r₁, r₂ ⊆ r'`, +then there is an edge `e ∈ Γ.E \ Γ'.E` incident with a region in `Z` and a region outside `Z` inside +`r'`. -/ +theorem disc_theorem_5_1 (hS : IsClosedDiscSpace S) {Γ Γ' : Drawing S} (hprop : Γ.IsProper) + (hsub : Γ'.IsSubdrawing Γ) {Z : Set (Set S)} + {r' r₁ r₂ : Set S} (hr' : r' ∈ Γ'.R) (h₁ : r₁ ∈ Γ.R) (hz₁ : r₁ ∈ Z) (h₂ : r₂ ∈ Γ.R) + (hz₂ : r₂ ∉ Z) (hs₁ : r₁ ⊆ r') (hs₂ : r₂ ⊆ r') : + ∃ e ∈ Γ.E, e ∉ Γ'.E ∧ ∃ a b : Set S, a ∈ Z ∧ b ∉ Z ∧ a ⊆ r' ∧ b ⊆ r' ∧ + Γ.EdgeRegionIncident e a ∧ Γ.EdgeRegionIncident e b := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + exact exists_separating_region_edge Drawing.IsProper + (fun {_} hp e => deleteEdge_isProper hp e) + (fun {_} hp {_ _} he hr => disc_edge_incident_or_disjoint hS hp he hr) + (fun {G} hp {_} he {_} hx => disc_exists_edge_sides hS G hp he hx) + (disc_isPreconnected_sdiff_finite hS) hprop hsub hr' h₁ hz₁ h₂ hz₂ hs₁ hs₂ + +/-- A proper drawing on a closed disc space `S` has finitely many regions. -/ +theorem disc_finite_R (hS : IsClosedDiscSpace S) (Γ : Drawing S) (hprop : Γ.IsProper) : + Γ.R.Finite := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + obtain ⟨φ⟩ := hS + have : ConnectedSpace ClosedUnitDisc := + Subtype.connectedSpace ((convex_closedBall (0 : EuclideanPlane) 1).isConnected + ⟨0, by simp⟩) + have : PreconnectedSpace S := (φ.surjective.connectedSpace φ.continuous).toPreconnectedSpace + have hS : IsClosedDiscSpace S := ⟨φ⟩ + induction hn : Γ.E.ncard using Nat.strong_induction_on generalizing Γ with + | _ n ih => + by_cases hE : Γ.E.Nonempty + · obtain ⟨e, he⟩ := hE + have hlt : (Γ.deleteEdge e).E.ncard < n := by + rw [deleteEdge_E, ← hn] + exact ncard_sdiff_singleton_lt_of_mem he Γ.finite_edges + have h₁ := ih _ hlt (Γ.deleteEdge e) (deleteEdge_isProper hprop e) rfl + have h₂ : {r ∈ Γ.R | e ⊆ closure r}.Finite := by + by_contra hinf + obtain ⟨T, hT, hcard⟩ := (Set.not_finite.mp hinf |> Set.Infinite.exists_subset_ncard_eq) 3 + obtain ⟨a, b, c, hab, hac, hbc, rfl⟩ := Set.ncard_eq_three.mp hcard.2 + have ha := hT (show a ∈ _ by simp) + have hb := hT (show b ∈ _ by simp) + have hc := hT (show c ∈ _ by simp) + rcases disc_region_incident_two hS hprop he ha.1 hb.1 hc.1 ha.2 hb.2 hc.2 with h | h | h + · exact hab h + · exact hac h + · exact hbc h + refine (h₁.union h₂).subset fun r hr => ?_ + rcases disc_edge_incident_or_disjoint hS hprop he hr with h | h + · exact Or.inr ⟨hr, h⟩ + · exact Or.inl (region_deleteEdge_of_not_incident he hr h) + · have hU : Γ.U = Γ.V := by + rw [Γ.U_eq, not_nonempty_iff_eq_empty.mp hE] + simp + have hc : IsPreconnected (univ \ Γ.U) := by + rw [hU] + exact disc_isPreconnected_sdiff_finite hS isOpen_univ isPreconnected_univ Γ.finite_V + refine Set.Subsingleton.finite fun r₁ h₁ r₂ h₂ => ?_ + obtain ⟨x, hx⟩ := region_nonempty h₁ + obtain ⟨y, hy⟩ := region_nonempty h₂ + refine region_eq_of_mem h₁ h₂ (subset_region h₁ hc ?_ ⟨mem_univ _, region_subset h₁ hx⟩ hx + ⟨mem_univ _, region_subset h₂ hy⟩) hy + exact disjoint_left.mpr fun q hq => hq.2 + +/-- A subdrawing `Γ' ⊆ Γ` of a proper drawing `Γ` on `S` has at most as many regions as `Γ`. -/ +theorem disc_region_ncard_le_of_isSubdrawing (hS : IsClosedDiscSpace S) {Γ Γ' : Drawing S} + (hprop : Γ.IsProper) (hsub : Γ'.IsSubdrawing Γ) : + Γ'.R.ncard ≤ Γ.R.ncard := by + classical + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + have hfin : Γ.R.Finite := disc_finite_R hS Γ hprop + let f : Set S → Set S := fun r => + if hr : r.Nonempty then connectedComponentIn (univ \ Γ'.U) hr.some else ∅ + have hf_surj : Γ'.R ⊆ f '' Γ.R := by + intro r' hr' + obtain ⟨z, hz, hzU⟩ := disc_exists_notMem_U hS hprop (region_isOpen hr') (region_nonempty hr') + obtain ⟨r, hr, hzr⟩ := exists_region_of_notMem hzU + refine ⟨r, hr, ?_⟩ + have hr_ne : r.Nonempty := ⟨z, hzr⟩ + dsimp only [f] + simp only [hr_ne, ↓reduceDIte] + have hsub_r : r ⊆ r' := subset_region hr' (region_isPreconnected hr) + (disjoint_left.mpr fun y hy h => region_subset hr hy (hsub.U_subset h)) hzr hz + have hx_r' : hr_ne.some ∈ r' := hsub_r hr_ne.some_mem + obtain ⟨x₀, -, rfl⟩ := (mem_R_iff Γ').mp hr' + exact (connectedComponentIn_eq hx_r').symm + exact (Set.ncard_le_ncard hf_surj (hfin.image f)).trans (Set.ncard_image_le hfin) + +/-! ## 2. One-Way Duality and Proof of Theorem (3.1) -/ + +/-- `IsClosedDiscSpace S` implies `IsClosedDisc (univ : Set S)`. -/ +theorem IsClosedDiscSpace.isClosedDisc_univ (hS : IsClosedDiscSpace S) : + IsClosedDisc (univ : Set S) := by + obtain ⟨φ⟩ := hS + exact ⟨φ.trans (Homeomorph.Set.univ S).symm⟩ + +/-- `discBd (univ : Set S) = bd S`. -/ +theorem discBd_univ (S : Type u) [TopologicalSpace S] : + discBd (univ : Set S) = bd S := + image_bd_homeomorph (Homeomorph.Set.univ S) + +/-- For a closed disc space `S`, `bd S` is an `O`-arc. -/ +theorem IsClosedDiscSpace.isOArc_bd (hS : IsClosedDiscSpace S) : IsOArc (bd S) := by + rw [← discBd_univ] + exact hS.isClosedDisc_univ.isOArc_discBd + +/-- Symmetry of `IsDualPointSet` on any `O`-arc `C`. -/ +theorem isDualPointSet_symm {C V U : Set S} (hC : IsOArc C) (hV : V.Finite) (hV_sub : V ⊆ C) + (hU : IsDualPointSet C V U) : IsDualPointSet C U V := by + obtain ⟨φ⟩ := hC + have hU_sub : U ⊆ C := (isDualPointSet_subset_diff hU).trans sdiff_subset + have hV_eq : oArcMap φ '' (oArcMap φ ⁻¹' V) = V := + image_preimage_eq_of_subset (hV_sub.trans (range_oArcMap φ).symm.subset) + have hU_eq : oArcMap φ '' (oArcMap φ ⁻¹' U) = U := + image_preimage_eq_of_subset (hU_sub.trans (range_oArcMap φ).symm.subset) + have hV₀ : (oArcMap φ ⁻¹' V).Finite := + Finite.of_finite_image (by rwa [hV_eq]) (injective_oArcMap φ).injOn + rw [← hV_eq, ← hU_eq, isDualPointSet_oArcMap_iff] at hU ⊢ + exact isDualPointSet_univ_symm hV₀ hU + +/-- Every edge `e ∈ Γ.E` has a parameterization `γ : unitInterval → S` with `closure e = range γ` +and `Γ.toGraph.IsLink e (γ 0) (γ 1)`. -/ +theorem exists_edge_param_isLink [T2Space S] (Γ : Drawing S) {e : Set S} (he : e ∈ Γ.E) : + ∃ γ : unitInterval → S, Continuous γ ∧ γ 0 ∈ Γ.V ∧ γ 1 ∈ Γ.V ∧ + InjOn γ (Ioo 0 1) ∧ γ '' Ioo 0 1 = e ∧ closure e = range γ ∧ + Γ.toGraph.IsLink e (γ 0) (γ 1) := by + obtain ⟨γ, hγ, h0, h1, hinj, himg⟩ := exists_edge_param Γ he + have hrange : range γ = e ∪ {γ 0, γ 1} := by + ext x + constructor + · rintro ⟨t, rfl⟩ + by_cases ht0 : t = 0 + · subst ht0; exact Or.inr (Or.inl rfl) + · by_cases ht1 : t = 1 + · subst ht1; exact Or.inr (Or.inr rfl) + · left + rw [← himg] + exact ⟨t, ⟨unitInterval.pos_iff_ne_zero.mpr ht0, + unitInterval.lt_one_iff_ne_one.mpr ht1⟩, rfl⟩ + · rintro (hxe | rfl | rfl) + · rw [← himg] at hxe + obtain ⟨t, -, rfl⟩ := hxe + exact mem_range_self t + · exact mem_range_self 0 + · exact mem_range_self 1 + have hcl : closure e = range γ := by + refine Subset.antisymm ?_ ?_ + · refine closure_minimal ?_ (isCompact_range hγ).isClosed + rw [hrange] + exact subset_union_left + · rintro _ ⟨t, rfl⟩ + have ht_cl : t ∈ closure (Ioo (0 : unitInterval) 1) := by + rw [closure_Ioo (zero_ne_one : (0 : unitInterval) ≠ 1)] + exact ⟨unitInterval.nonneg t, unitInterval.le_one t⟩ + rw [← himg] + exact image_closure_subset_closure_image hγ ⟨t, ht_cl, rfl⟩ + refine ⟨γ, hγ, h0, h1, hinj, himg, hcl, he, h0, h1, ?_⟩ + rw [hcl, hrange] + ext x + simp only [mem_inter_iff, mem_union, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨hxe | rfl | rfl, hxV⟩ + · exact ((he.2.1 hxe).2 hxV).elim + · exact Or.inl rfl + · exact Or.inr rfl + · rintro (rfl | rfl) + · exact ⟨Or.inr (Or.inl rfl), h0⟩ + · exact ⟨Or.inr (Or.inr rfl), h1⟩ + +/-- If `IsDiscDualDrawing G G_dual`, then `G.V` is disjoint from `G_dual.U`. -/ +theorem IsDiscDualDrawing.disjoint_V_dual_U {G G_dual : Drawing S} + (hDual : IsDiscDualDrawing G G_dual) : Disjoint G.V G_dual.U := by + refine disjoint_left.mpr fun v hv hvU => ?_ + by_cases hvVd : v ∈ G_dual.V + · obtain ⟨r, hr, hvr⟩ := hDual.2.2.2.1 v hvVd + exact region_subset hr hvr (G.V_subset_U hv) + · obtain ⟨e', he', hve'⟩ := G_dual.exists_edge_of_mem hvU hvVd + obtain ⟨edgeEquiv, hedge⟩ := hDual.2.2.2.2.2.2 + let e := edgeEquiv.symm ⟨e', he'⟩ + have he_eq : (edgeEquiv e).1 = e' := congrArg Subtype.val (edgeEquiv.apply_symm_apply ⟨e', he'⟩) + have hmem : v ∈ (edgeEquiv e).1 ∩ G.U := ⟨he_eq ▸ hve', G.V_subset_U hv⟩ + rw [(hedge e).1] at hmem + exact (e.2.2.1 hmem.2).2 hv + +/-- If `IsDiscDualDrawing G G_dual`, then `G.V ∩ G_dual.V = ∅`. -/ +theorem IsDiscDualDrawing.V_inter_dual_V_eq_empty {G G_dual : Drawing S} + (hDual : IsDiscDualDrawing G G_dual) : G.V ∩ G_dual.V = ∅ := by + ext v + simp only [mem_inter_iff, mem_empty_iff_false, iff_false, not_and] + intro hv hvVd + exact disjoint_left.mp hDual.disjoint_V_dual_U hv (G_dual.V_subset_U hvVd) + +/-- For every `v ∈ G.V`, `connectedComponentIn (univ \ G_dual.U) v` is a region of `G_dual` +containing `v`. -/ +theorem IsDiscDualDrawing.connectedComponentIn_mem_dual_R {G G_dual : Drawing S} + (hDual : IsDiscDualDrawing G G_dual) {v : S} (hv : v ∈ G.V) : + connectedComponentIn (univ \ G_dual.U) v ∈ G_dual.R ∧ + v ∈ connectedComponentIn (univ \ G_dual.U) v := by + have hv_compl : v ∈ univ \ G_dual.U := + ⟨mem_univ v, disjoint_left.mp hDual.disjoint_V_dual_U hv⟩ + exact ⟨⟨v, hv_compl, rfl⟩, mem_connectedComponentIn hv_compl⟩ + +/-- Each primal edge `e ∈ G.E` is split by its dual edge `e' ∈ G_dual.E` into two half-edges +lying in the dual regions of the ends `u, v ∈ G.V` of `e`, and `e'` is incident in `G_dual` with +precisely those two dual regions. -/ +theorem IsDiscDualDrawing.edge_half_regions (hS : IsClosedDiscSpace S) {G G_dual : Drawing S} + (hDual : IsDiscDualDrawing G G_dual) {e e' : Set S} (he : e ∈ G.E) (he' : e' ∈ G_dual.E) + (he2 : e ∩ G_dual.U = e ∩ e') (he3 : (e' ∩ e).ncard = 1) + (he4 : ∀ r' ∈ G_dual.R, G_dual.EdgeRegionIncident e' r' → (r' ∩ e).Nonempty) : + (∃ u ∈ G.V, ∃ v ∈ G.V, + G.toGraph.IsLink e u v ∧ + e \ G_dual.U ⊆ connectedComponentIn (univ \ G_dual.U) u ∪ + connectedComponentIn (univ \ G_dual.U) v ∧ + G_dual.EdgeRegionIncident e' (connectedComponentIn (univ \ G_dual.U) u) ∧ + G_dual.EdgeRegionIncident e' (connectedComponentIn (univ \ G_dual.U) v) ∧ + ∀ r' ∈ G_dual.R, G_dual.EdgeRegionIncident e' r' → + r' = connectedComponentIn (univ \ G_dual.U) u ∨ + r' = connectedComponentIn (univ \ G_dual.U) v) ∧ + (∀ r₁' ∈ G_dual.R, ∀ r₂' ∈ G_dual.R, ∀ v₁ ∈ r₁' ∩ G.V, ∀ v₂ ∈ r₂' ∩ G.V, + G.toGraph.IsLink e v₁ v₂ ↔ + G_dual.EdgeRegionIncident e' r₁' ∧ G_dual.EdgeRegionIncident e' r₂' ∧ + ∀ r' ∈ G_dual.R, G_dual.EdgeRegionIncident e' r' → r' = r₁' ∨ r' = r₂') := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + obtain ⟨γ, hγ, h0, h1, hinj, himg, _, hlink⟩ := exists_edge_param_isLink G he + obtain ⟨p, hp_eq⟩ := ncard_eq_one.mp he3 + have hp_mem : p ∈ e' ∩ e := by rw [hp_eq]; exact mem_singleton p + have hp_e' : p ∈ e' := hp_mem.1 + have hp_e : p ∈ e := hp_mem.2 + have he_GdU : e ∩ G_dual.U = {p} := by rw [he2, inter_comm, hp_eq] + rw [← himg] at hp_e + obtain ⟨t₀, ht₀, rfl⟩ := hp_e + let u := γ 0 + let v := γ 1 + have hIco_sub : γ '' Ico 0 t₀ ⊆ univ \ G_dual.U := by + rintro _ ⟨t, ht, rfl⟩ + refine ⟨mem_univ _, fun htU => ?_⟩ + by_cases ht0 : t = 0 + · subst ht0 + exact disjoint_left.mp hDual.disjoint_V_dual_U h0 htU + · have ht_Ioo : t ∈ Ioo (0 : unitInterval) 1 := + ⟨unitInterval.pos_iff_ne_zero.mpr ht0, ht.2.trans ht₀.2⟩ + have hmem : γ t ∈ e ∩ G_dual.U := ⟨himg ▸ mem_image_of_mem γ ht_Ioo, htU⟩ + rw [he_GdU, mem_singleton_iff] at hmem + exact ht.2.ne (hinj ht_Ioo ht₀ hmem) + have hIco_comp : γ '' Ico 0 t₀ ⊆ connectedComponentIn (univ \ G_dual.U) u := + (isPreconnected_Ico.image γ hγ.continuousOn).subset_connectedComponentIn + ⟨0, left_mem_Ico.mpr ht₀.1, rfl⟩ hIco_sub + have hp_cl_u : γ t₀ ∈ closure (connectedComponentIn (univ \ G_dual.U) u) := + closure_mono hIco_comp (image_closure_subset_closure_image hγ + ⟨t₀, by rw [closure_Ico ht₀.1.ne]; exact ⟨ht₀.1.le, le_rfl⟩, rfl⟩) + have hinc_u : G_dual.EdgeRegionIncident e' (connectedComponentIn (univ \ G_dual.U) u) := + ⟨he', (hDual.connectedComponentIn_mem_dual_R h0).1, γ t₀, hp_e', hp_cl_u⟩ + have hIoc_sub : γ '' Ioc t₀ 1 ⊆ univ \ G_dual.U := by + rintro _ ⟨t, ht, rfl⟩ + refine ⟨mem_univ _, fun htU => ?_⟩ + by_cases ht1 : t = 1 + · subst ht1 + exact disjoint_left.mp hDual.disjoint_V_dual_U h1 htU + · have ht_Ioo : t ∈ Ioo (0 : unitInterval) 1 := + ⟨ht₀.1.trans ht.1, unitInterval.lt_one_iff_ne_one.mpr ht1⟩ + have hmem : γ t ∈ e ∩ G_dual.U := ⟨himg ▸ mem_image_of_mem γ ht_Ioo, htU⟩ + rw [he_GdU, mem_singleton_iff] at hmem + exact ht.1.ne' (hinj ht_Ioo ht₀ hmem) + have hIoc_comp : γ '' Ioc t₀ 1 ⊆ connectedComponentIn (univ \ G_dual.U) v := + (isPreconnected_Ioc.image γ hγ.continuousOn).subset_connectedComponentIn + ⟨1, right_mem_Ioc.mpr ht₀.2, rfl⟩ hIoc_sub + have hp_cl_v : γ t₀ ∈ closure (connectedComponentIn (univ \ G_dual.U) v) := + closure_mono hIoc_comp (image_closure_subset_closure_image hγ + ⟨t₀, by rw [closure_Ioc ht₀.2.ne]; exact ⟨le_rfl, ht₀.2.le⟩, rfl⟩) + have hinc_v : G_dual.EdgeRegionIncident e' (connectedComponentIn (univ \ G_dual.U) v) := + ⟨he', (hDual.connectedComponentIn_mem_dual_R h1).1, γ t₀, hp_e', hp_cl_v⟩ + have he_diff_sub : e \ G_dual.U ⊆ + connectedComponentIn (univ \ G_dual.U) u ∪ connectedComponentIn (univ \ G_dual.U) v := by + rintro x ⟨hxe, hxU⟩ + rw [← himg] at hxe + obtain ⟨t, ht, rfl⟩ := hxe + have hne : t ≠ t₀ := fun h => hxU (h ▸ (he'.2.1 hp_e').1) + rcases lt_or_gt_of_ne hne with hlt | hgt + · exact Or.inl (hIco_comp ⟨t, ⟨unitInterval.nonneg t, hlt⟩, rfl⟩) + · exact Or.inr (hIoc_comp ⟨t, ⟨hgt, unitInterval.le_one t⟩, rfl⟩) + have hall_r' : ∀ r' ∈ G_dual.R, G_dual.EdgeRegionIncident e' r' → + r' = connectedComponentIn (univ \ G_dual.U) u ∨ + r' = connectedComponentIn (univ \ G_dual.U) v := by + intro r' hr' hinc + obtain ⟨x, hx_r', hx_e⟩ := he4 r' hr' hinc + have hx_diff : x ∈ e \ G_dual.U := ⟨hx_e, region_subset hr' hx_r'⟩ + rcases he_diff_sub hx_diff with hxu | hxv + · exact Or.inl (region_eq_of_mem hr' (hDual.connectedComponentIn_mem_dual_R h0).1 hx_r' hxu) + · exact Or.inr (region_eq_of_mem hr' (hDual.connectedComponentIn_mem_dual_R h1).1 hx_r' hxv) + refine ⟨⟨u, h0, v, h1, hlink, he_diff_sub, hinc_u, hinc_v, hall_r'⟩, ?_⟩ + intro r₁' hr₁' r₂' hr₂' v₁ hv₁ v₂ hv₂ + have hr₁_eq : r₁' = connectedComponentIn (univ \ G_dual.U) v₁ := by + obtain ⟨z, -, rfl⟩ := (mem_R_iff G_dual).mp hr₁' + exact connectedComponentIn_eq hv₁.1 + have hr₂_eq : r₂' = connectedComponentIn (univ \ G_dual.U) v₂ := by + obtain ⟨z, -, rfl⟩ := (mem_R_iff G_dual).mp hr₂' + exact connectedComponentIn_eq hv₂.1 + constructor + · intro hlink' + have hpair : ({v₁, v₂} : Set S) = {u, v} := hlink'.2.2.2.symm.trans hlink.2.2.2 + have hv₁_mem : v₁ = u ∨ v₁ = v := by + have : v₁ ∈ ({v₁, v₂} : Set S) := mem_insert v₁ {v₂} + rwa [hpair, mem_insert_iff, mem_singleton_iff] at this + have hv₂_mem : v₂ = u ∨ v₂ = v := by + have : v₂ ∈ ({v₁, v₂} : Set S) := mem_insert_of_mem v₁ (mem_singleton v₂) + rwa [hpair, mem_insert_iff, mem_singleton_iff] at this + have hu_mem : u = v₁ ∨ u = v₂ := by + have : u ∈ ({u, v} : Set S) := mem_insert u {v} + rwa [← hpair, mem_insert_iff, mem_singleton_iff] at this + have hv_mem : v = v₁ ∨ v = v₂ := by + have : v ∈ ({u, v} : Set S) := mem_insert_of_mem u (mem_singleton v) + rwa [← hpair, mem_insert_iff, mem_singleton_iff] at this + refine ⟨?_, ?_, fun r' hr' hinc => ?_⟩ + · rw [hr₁_eq] + rcases hv₁_mem with rfl | rfl <;> assumption + · rw [hr₂_eq] + rcases hv₂_mem with rfl | rfl <;> assumption + · rcases hall_r' r' hr' hinc with rfl | rfl + · rcases hu_mem with rfl | rfl + · exact Or.inl hr₁_eq.symm + · exact Or.inr hr₂_eq.symm + · rcases hv_mem with rfl | rfl + · exact Or.inl hr₁_eq.symm + · exact Or.inr hr₂_eq.symm + · rintro ⟨hinc1, hinc2, hall⟩ + have hv₁_uv : v₁ = u ∨ v₁ = v := by + rcases hall_r' r₁' hr₁' hinc1 with heq | heq + · exact Or.inl (hDual.2.2.2.2.2.1 v₁ hv₁.2 u h0 (hr₁_eq.symm.trans heq)) + · exact Or.inr (hDual.2.2.2.2.2.1 v₁ hv₁.2 v h1 (hr₁_eq.symm.trans heq)) + have hv₂_uv : v₂ = u ∨ v₂ = v := by + rcases hall_r' r₂' hr₂' hinc2 with heq | heq + · exact Or.inl (hDual.2.2.2.2.2.1 v₂ hv₂.2 u h0 (hr₂_eq.symm.trans heq)) + · exact Or.inr (hDual.2.2.2.2.2.1 v₂ hv₂.2 v h1 (hr₂_eq.symm.trans heq)) + have hu_12 : u = v₁ ∨ u = v₂ := by + rcases hall _ (hDual.connectedComponentIn_mem_dual_R h0).1 hinc_u with heq | heq + · exact Or.inl (hDual.2.2.2.2.2.1 u h0 v₁ hv₁.2 (heq.trans hr₁_eq)) + · exact Or.inr (hDual.2.2.2.2.2.1 u h0 v₂ hv₂.2 (heq.trans hr₂_eq)) + have hv_12 : v = v₁ ∨ v = v₂ := by + rcases hall _ (hDual.connectedComponentIn_mem_dual_R h1).1 hinc_v with heq | heq + · exact Or.inl (hDual.2.2.2.2.2.1 v h1 v₁ hv₁.2 (heq.trans hr₁_eq)) + · exact Or.inr (hDual.2.2.2.2.2.1 v h1 v₂ hv₂.2 (heq.trans hr₂_eq)) + refine ⟨he, hv₁.2, hv₂.2, ?_⟩ + rw [hlink.2.2.2] + ext x + simp only [mem_insert_iff, mem_singleton_iff] + constructor + · rintro (rfl | rfl) + · exact hu_12 + · exact hv_12 + · rintro (rfl | rfl) + · exact hv₁_uv + · exact hv₂_uv + +/-- If `A` is preconnected, `B` is open, `(A ∩ B).Nonempty`, and `A` is disjoint from +`closure B \ B`, then `A ⊆ B`. -/ +private theorem subset_of_isPreconnected_of_inter_open {A B : Set S} + (hA : IsPreconnected A) (hB : IsOpen B) (hAB : (A ∩ B).Nonempty) + (hfront : Disjoint A (closure B \ B)) : A ⊆ B := by + intro x hx + by_contra hxB + by_cases hxcl : x ∈ closure B + · exact disjoint_left.mp hfront hx ⟨hxcl, hxB⟩ + · obtain ⟨w, hwA, hwB, hwcl⟩ := hA B (closure B)ᶜ hB isClosed_closure.isOpen_compl + (fun y hy => by + by_cases hyB : y ∈ B + · exact Or.inl hyB + · exact Or.inr fun hycl => disjoint_left.mp hfront hy ⟨hycl, hyB⟩) + hAB ⟨x, hx, hxcl⟩ + exact hwcl (subset_closure hwB) + +/-- For any region `r ∈ Γ.R` on a locally path-connected space `S`, `closure r \ r ⊆ Γ.U`. -/ +private theorem closure_region_sdiff_subset_U [LocallyPathConnectedSpace S] + {Γ : Drawing S} {r : Set S} (hr : r ∈ Γ.R) : + closure r \ r ⊆ Γ.U := by + rintro y ⟨hy_cl, hy_not_r⟩ + by_contra hyU + obtain ⟨r', hr', hyr'⟩ := exists_region_of_notMem hyU + obtain ⟨w, hwr', hwr⟩ := mem_closure_iff.mp hy_cl r' (region_isOpen hr') hyr' + exact hy_not_r (region_eq_of_mem hr' hr hwr' hwr ▸ hyr') + +/-- Every region `r_dual ∈ G_dual.R` contains a unique vertex `v ∈ G.V` when `G` is connected. -/ +theorem IsDiscDualDrawing.exists_unique_vertex_in_dual_region (hS : IsClosedDiscSpace S) + {G G_dual : Drawing S} (hConn : IsGraphConnected G.toGraph) + (hDual : IsDiscDualDrawing G G_dual) {r_dual : Set S} (hr_dual : r_dual ∈ G_dual.R) : + ∃! v, v ∈ r_dual ∧ v ∈ G.V := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + obtain ⟨φ⟩ := hS + have : ConnectedSpace ClosedUnitDisc := + Subtype.connectedSpace ((convex_closedBall (0 : EuclideanPlane) 1).isConnected + ⟨0, by simp⟩) + have : PreconnectedSpace S := (φ.surjective.connectedSpace φ.continuous).toPreconnectedSpace + have hS : IsClosedDiscSpace S := ⟨φ⟩ + have huniq : ∀ v₁ v₂, v₁ ∈ r_dual ∧ v₁ ∈ G.V → v₂ ∈ r_dual ∧ v₂ ∈ G.V → v₁ = v₂ := by + rintro v₁ v₂ ⟨hv₁_r, hv₁_V⟩ ⟨hv₂_r, hv₂_V⟩ + obtain ⟨z, -, rfl⟩ := (mem_R_iff G_dual).mp hr_dual + have h1 : connectedComponentIn (univ \ G_dual.U) v₁ = connectedComponentIn (univ \ G_dual.U) z + := + (connectedComponentIn_eq hv₁_r).symm + have h2 : connectedComponentIn (univ \ G_dual.U) v₂ = connectedComponentIn (univ \ G_dual.U) z + := + (connectedComponentIn_eq hv₂_r).symm + exact hDual.2.2.2.2.2.1 v₁ hv₁_V v₂ hv₂_V (h1.trans h2.symm) + by_cases hex : ∃ e' ∈ G_dual.E, G_dual.EdgeRegionIncident e' r_dual + · obtain ⟨e', he', hinc⟩ := hex + obtain ⟨edgeEquiv, hedge⟩ := hDual.2.2.2.2.2.2 + let e := edgeEquiv.symm ⟨e', he'⟩ + have he_eq : (edgeEquiv e).1 = e' := congrArg Subtype.val (edgeEquiv.apply_symm_apply ⟨e', he'⟩) + obtain ⟨he1, he2, he3, he4, _⟩ := hedge e + rw [he_eq] at he1 he2 he3 he4 + obtain ⟨⟨u, hu, v, hv, _, _, _, _, hall⟩, _⟩ := + hDual.edge_half_regions hS e.2 he' he2 he3 he4 + rcases hall r_dual hr_dual hinc with rfl | rfl + · exact ⟨u, ⟨(hDual.connectedComponentIn_mem_dual_R hu).2, hu⟩, + fun y hy => huniq y u hy ⟨(hDual.connectedComponentIn_mem_dual_R hu).2, hu⟩⟩ + · exact ⟨v, ⟨(hDual.connectedComponentIn_mem_dual_R hv).2, hv⟩, + fun y hy => huniq y v hy ⟨(hDual.connectedComponentIn_mem_dual_R hv).2, hv⟩⟩ + · have hsub_all : univ \ G_dual.V ⊆ r_dual := by + refine subset_of_isPreconnected_of_inter_open + (disc_isPreconnected_sdiff_finite hS isOpen_univ isPreconnected_univ G_dual.finite_V) + (region_isOpen hr_dual) ?_ ?_ + · obtain ⟨x₀, hx₀⟩ := region_nonempty hr_dual + exact ⟨x₀, ⟨mem_univ x₀, fun hxV => region_subset hr_dual hx₀ (G_dual.V_subset_U hxV)⟩, hx₀⟩ + · refine disjoint_left.mpr fun y hy hfront => ?_ + have hyU : y ∈ G_dual.U := closure_region_sdiff_subset_U hr_dual hfront + obtain ⟨e', he', hye'⟩ := G_dual.exists_edge_of_mem hyU hy.2 + exact hex ⟨e', he', he', hr_dual, y, hye', hfront.1⟩ + obtain ⟨v₀, hv₀⟩ := hConn.1 + have hv₀_r : v₀ ∈ r_dual := hsub_all ⟨mem_univ v₀, + fun hvVd => disjoint_left.mp hDual.disjoint_V_dual_U hv₀ (G_dual.V_subset_U hvVd)⟩ + exact ⟨v₀, ⟨hv₀_r, hv₀⟩, fun y hy => huniq y v₀ hy ⟨hv₀_r, hv₀⟩⟩ + +/-- **Graph Minors VI, (3.1)**: if `G` is connected and properly drawn on a closed disc `S` and +`IsDiscDualDrawing G G_dual`, then `IsDiscDualDrawing G_dual G`. -/ +theorem IsDiscDualDrawing.symm_of_connected (hS : IsClosedDiscSpace S) {G G_dual : Drawing S} + (hConn : IsGraphConnected G.toGraph) (hDual : IsDiscDualDrawing G G_dual) : + IsDiscDualDrawing G_dual G := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + obtain ⟨edgeEquiv, hedge⟩ := hDual.2.2.2.2.2.2 + refine ⟨hDual.2.1, hDual.1, + fun r_dual hr_dual => hDual.exists_unique_vertex_in_dual_region hS hConn hr_dual, + fun v hv => ⟨_, (hDual.connectedComponentIn_mem_dual_R hv).1, + (hDual.connectedComponentIn_mem_dual_R hv).2⟩, + isDualPointSet_symm hS.isOArc_bd (G.finite_V.subset inter_subset_left) + inter_subset_right hDual.2.2.2.2.1, + ?_, edgeEquiv.symm, ?_⟩ + · intro w₁ hw₁ w₂ hw₂ heq + obtain ⟨r₁, hr₁, hw₁_r⟩ := hDual.2.2.2.1 w₁ hw₁ + obtain ⟨r₂, hr₂, hw₂_r⟩ := hDual.2.2.2.1 w₂ hw₂ + have hr₁_eq : r₁ = connectedComponentIn (univ \ G.U) w₁ := by + obtain ⟨z, -, rfl⟩ := (mem_R_iff G).mp hr₁ + exact connectedComponentIn_eq hw₁_r + have hr₂_eq : r₂ = connectedComponentIn (univ \ G.U) w₂ := by + obtain ⟨z, -, rfl⟩ := (mem_R_iff G).mp hr₂ + exact connectedComponentIn_eq hw₂_r + have hw₂_r₁ : w₂ ∈ r₁ := by + rw [hr₁_eq, heq, ← hr₂_eq] + exact hw₂_r + exact (hDual.2.2.1 r₁ hr₁).unique ⟨hw₁_r, hw₁⟩ ⟨hw₂_r₁, hw₂⟩ + · intro e' + let e := edgeEquiv.symm e' + have he_eq : edgeEquiv e = e' := edgeEquiv.apply_symm_apply e' + obtain ⟨he1, he2, he3, he4, he5⟩ := hedge e + rw [he_eq] at he1 he2 he3 he4 he5 + refine ⟨he2, he1, by rw [inter_comm, he3], ?_, + (hDual.edge_half_regions hS e.2 e'.2 he2 he3 he4).2⟩ + intro r hr hinc + obtain ⟨γ', hγ', h0', h1', _, _, hcl', hlink'⟩ := exists_edge_param_isLink G_dual e'.2 + obtain ⟨r₁, hr₁, hw₁⟩ := hDual.2.2.2.1 (γ' 0) h0' + obtain ⟨r₂, hr₂, hw₂⟩ := hDual.2.2.2.1 (γ' 1) h1' + have hall := ((he5 r₁ hr₁ r₂ hr₂ (γ' 0) ⟨hw₁, h0'⟩ (γ' 1) ⟨hw₂, h1'⟩).mp hlink').2.2 + rcases hall r hr hinc with hr_eq | hr_eq + · subst hr_eq + have h0_cl : γ' 0 ∈ closure e'.1 := by rw [hcl']; exact mem_range_self 0 + exact mem_closure_iff.mp h0_cl r (region_isOpen hr) hw₁ + · subst hr_eq + have h1_cl : γ' 1 ∈ closure e'.1 := by rw [hcl']; exact mem_range_self 1 + exact mem_closure_iff.mp h1_cl r (region_isOpen hr) hw₂ + +/-- One-way vertex-region incidence transposition: if `w ∈ closure r_dual`, then `v ∈ closure r`. -/ +theorem IsDiscDualDrawing.mem_closure_region_of_mem_closure_dual (hS : IsClosedDiscSpace S) + {G G_dual : Drawing S} (hDual : IsDiscDualDrawing G G_dual) + {v : S} (hv : v ∈ G.V) {r : Set S} (hr : r ∈ G.R) {w : S} (hw : w ∈ r ∩ G_dual.V) + {r_dual : Set S} (hr_dual : r_dual ∈ G_dual.R) (hv_rd : v ∈ r_dual) + (hw_cl : w ∈ closure r_dual) : v ∈ closure r := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + have h_inter : (r_dual ∩ r).Nonempty := by + rw [inter_comm] + exact mem_closure_iff.mp hw_cl r (region_isOpen hr) hw.1 + have h_not_sub : ¬ (r_dual ⊆ r) := fun hsub => + region_subset hr (hsub hv_rd) (G.V_subset_U hv) + have h_not_disj : ¬ Disjoint r_dual (closure r \ r) := fun hdisj => + h_not_sub (subset_of_isPreconnected_of_inter_open (region_isPreconnected hr_dual) + (region_isOpen hr) h_inter hdisj) + rw [not_disjoint_iff] at h_not_disj + obtain ⟨z, hz_rd, hz_cl, hz_not_r⟩ := h_not_disj + have hz_U : z ∈ G.U := closure_region_sdiff_subset_U hr ⟨hz_cl, hz_not_r⟩ + have hrd_eq : r_dual = connectedComponentIn (univ \ G_dual.U) v := by + obtain ⟨x₀, -, rfl⟩ := (mem_R_iff G_dual).mp hr_dual + exact connectedComponentIn_eq hv_rd + by_cases hzV : z ∈ G.V + · have hzv : z = v := by + have hz_eq : r_dual = connectedComponentIn (univ \ G_dual.U) z := by + obtain ⟨x₀, -, rfl⟩ := (mem_R_iff G_dual).mp hr_dual + exact connectedComponentIn_eq hz_rd + exact hDual.2.2.2.2.2.1 z hzV v hv (hz_eq.symm.trans hrd_eq) + exact hzv ▸ hz_cl + · obtain ⟨e₀, he₀, hze₀⟩ := G.exists_edge_of_mem hz_U hzV + have he₀_inc : e₀ ⊆ closure r := + disc_edge_subset_closure_of_incident hS hDual.1 he₀ hr ⟨z, hze₀, hz_cl⟩ + obtain ⟨edgeEquiv, hedge⟩ := hDual.2.2.2.2.2.2 + let e : G.E := ⟨e₀, he₀⟩ + obtain ⟨_, he2, he3, he4, _⟩ := hedge e + obtain ⟨⟨u₁, hu₁, u₂, hu₂, hlink, he_diff, _, _, _⟩, _⟩ := + hDual.edge_half_regions hS he₀ (edgeEquiv e).2 he2 he3 he4 + have hz_diff : z ∈ e₀ \ G_dual.U := ⟨hze₀, region_subset hr_dual hz_rd⟩ + rcases he_diff hz_diff with hzu₁ | hzu₂ + · have h_eq : r_dual = connectedComponentIn (univ \ G_dual.U) u₁ := + region_eq_of_mem hr_dual (hDual.connectedComponentIn_mem_dual_R hu₁).1 hz_rd hzu₁ + have hvu₁ : v = u₁ := hDual.2.2.2.2.2.1 v hv u₁ hu₁ (hrd_eq.symm.trans h_eq) + have hu₁_cl : u₁ ∈ closure e₀ := by + have : u₁ ∈ closure e₀ ∩ G.V := by rw [hlink.2.2.2]; exact mem_insert u₁ {u₂} + exact this.1 + simpa only [closure_closure] using closure_mono he₀_inc (hvu₁ ▸ hu₁_cl) + · have h_eq : r_dual = connectedComponentIn (univ \ G_dual.U) u₂ := + region_eq_of_mem hr_dual (hDual.connectedComponentIn_mem_dual_R hu₂).1 hz_rd hzu₂ + have hvu₂ : v = u₂ := hDual.2.2.2.2.2.1 v hv u₂ hu₂ (hrd_eq.symm.trans h_eq) + have hu₂_cl : u₂ ∈ closure e₀ := by + have : u₂ ∈ closure e₀ ∩ G.V := by rw [hlink.2.2.2]; exact mem_insert_of_mem u₁ rfl + exact this.1 + simpa only [closure_closure] using closure_mono he₀_inc (hvu₂ ▸ hu₂_cl) + +/-- Upgrade a one-way `IsDiscDualDrawing G G_dual` to the two-way `IsDiscDualDrawingPair G G_dual` +when `G` is connected and drawn on a closed disc space `S`. -/ +theorem IsDiscDualDrawing.to_pair (hS : IsClosedDiscSpace S) {G G_dual : Drawing S} + (hConn : IsGraphConnected G.toGraph) (hDual : IsDiscDualDrawing G G_dual) : + IsDiscDualDrawingPair G G_dual := by + have hSymm := hDual.symm_of_connected hS hConn + obtain ⟨edgeEquiv, hedge⟩ := hDual.2.2.2.2.2.2 + refine ⟨hDual.1, hDual.2.1, hDual.V_inter_dual_V_eq_empty, + hDual.2.2.1, hDual.2.2.2.1, + hSymm.2.2.1, hSymm.2.2.2.1, + ?_, hDual.2.2.2.2.1, hSymm.2.2.2.2.1, edgeEquiv, ?_⟩ + · intro v hv r hr w hw r_dual hr_dual hv_rd + exact ⟨fun hv_cl => hSymm.mem_closure_region_of_mem_closure_dual hS hw.2 hr_dual + ⟨hv_rd, hv⟩ hr hw.1 hv_cl, + fun hw_cl => hDual.mem_closure_region_of_mem_closure_dual hS hv hr hw hr_dual hv_rd hw_cl⟩ + · intro e + obtain ⟨he1, he2, he3, he4, he5⟩ := hedge e + exact ⟨he1, he2, he3, he5, (hDual.edge_half_regions hS e.2 (edgeEquiv e).2 he2 he3 he4).2⟩ + +/-- Symmetry of `IsDiscDualDrawingPair`. -/ +theorem IsDiscDualDrawingPair.symm {G G_dual : Drawing S} + (h : IsDiscDualDrawingPair G G_dual) : IsDiscDualDrawingPair G_dual G := by + rcases h with ⟨hG_prop, hGd_prop, hV_disj, hR_uniq, hVd_R, hRd_uniq, hV_Rd, + hinc, hU1, hU2, edgeEquiv, hedge⟩ + refine ⟨hGd_prop, hG_prop, by rw [inter_comm, hV_disj], + hRd_uniq, hV_Rd, hR_uniq, hVd_R, ?_, hU2, hU1, edgeEquiv.symm, ?_⟩ + · intro w hw r_dual hr_dual v hv r hr hw_r + exact (hinc v hv.2 r hr w ⟨hw_r, hw⟩ r_dual hr_dual hv.1).symm + · intro e' + let e := edgeEquiv.symm e' + have he' : edgeEquiv e = e' := edgeEquiv.apply_symm_apply e' + obtain ⟨h1, h2, h3, h4, h5⟩ := hedge e + rw [he'] at h1 h2 h3 h4 h5 + refine ⟨h2, h1, by rw [inter_comm, h3], h5, h4⟩ + +end GraphMinor.GM06 diff --git a/LeanPool/GraphMinor/GM06/DualExists.lean b/LeanPool/GraphMinor/GM06/DualExists.lean new file mode 100644 index 0000000000..68fd2f0ec9 --- /dev/null +++ b/LeanPool/GraphMinor/GM06/DualExists.lean @@ -0,0 +1,2103 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.EdgeChart +public import LeanPool.GraphMinor.GM06.Euler +public import LeanPool.GraphMinor.GM06.Section3Main +public import LeanPool.GraphMinor.GM11.RadialBasics +public import LeanPool.GraphMinor.GM11.RadialChord +public import LeanPool.GraphMinor.Surface.ArcTools +public import LeanPool.GraphMinor.Surface.ArcInPath + +/-! +# Existence of a Disc Dual Drawing and Graph Minors VI, (3.6) + +This file constructs a disc dual drawing `G_dual : Drawing S` satisfying +`IsDiscDualDrawing G G_dual` for every connected proper drawing `G : Drawing S` on a closed disc +space `S` (`exists_isDiscDualDrawing`), and deduces the unconditional characterization of feasible +divisions **Graph Minors VI, (3.6)** (`theorem_3_6 : Statement36`). +-/ + +public section + +namespace GraphMinor.GM06 + +open Set Function Topology Metric unitInterval Complex GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +private theorem isClosed_of_isLine [T2Space S] {L : Set S} (h : IsLine L) : IsClosed L := by + obtain ⟨φ⟩ := h + exact (isCompact_iff_compactSpace.mpr φ.compactSpace).isClosed + +private theorem IsLineWithEnds.left_mem {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : + a ∈ L := by + obtain ⟨f, h0, _⟩ := h + exact h0 ▸ (f 0).2 + +private theorem IsLineWithEnds.right_mem {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : + b ∈ L := by + obtain ⟨f, _, h1⟩ := h + exact h1 ▸ (f 1).2 + +private theorem IsLineWithEnds.isLine {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : + IsLine L := by + obtain ⟨f, _, _⟩ := h + exact ⟨f⟩ + +/-! ### Section 1: Complex Disc Balls and Radial Segments Around Dual Vertices -/ + +/-- Closed ball of radius `δ` around `w` in complex disc coordinates `h : S → ℂ`. -/ +def discBall (h : S → ℂ) (w : S) (δ : ℝ) : Set S := + {x : S | dist (h x) (h w) ≤ δ} + +/-- Open ball of radius `δ` around `w` in complex disc coordinates `h : S → ℂ`. -/ +def discOpenBall (h : S → ℂ) (w : S) (δ : ℝ) : Set S := + {x : S | dist (h x) (h w) < δ} + +/-- Interior sphere of radius `δ` around `w` (excluding `bd S`) in complex disc coordinates `h`. -/ +def discSphere (h : S → ℂ) (w : S) (δ : ℝ) : Set S := + {x : S | dist (h x) (h w) = δ} \ bd S + +theorem isClosed_discBall {h : S → ℂ} (hh : Continuous h) (w : S) (δ : ℝ) : + IsClosed (discBall h w δ) := + isClosed_le (hh.dist continuous_const) continuous_const + +theorem isOpen_discOpenBall {h : S → ℂ} (hh : Continuous h) (w : S) (δ : ℝ) : + IsOpen (discOpenBall h w δ) := + isOpen_lt (hh.dist continuous_const) continuous_const + +omit [TopologicalSpace S] in +theorem discOpenBall_subset_discBall (h : S → ℂ) (w : S) (δ : ℝ) : + discOpenBall h w δ ⊆ discBall h w δ := + fun _ hx => le_of_lt (show dist _ _ < δ from hx) + +theorem discSphere_subset_discBall (h : S → ℂ) (w : S) (δ : ℝ) : + discSphere h w δ ⊆ discBall h w δ := + fun _ hx => le_of_eq (show dist _ _ = δ from hx.1) + +omit [TopologicalSpace S] in +theorem mem_discOpenBall_self (h : S → ℂ) (w : S) {δ : ℝ} (hδ : 0 < δ) : + w ∈ discOpenBall h w δ := by + simp [discOpenBall, hδ] + +theorem exists_discBall_subset_of_isOpen [CompactSpace S] {h : S → ℂ} + (hh : Continuous h) (hinj : Function.Injective h) {U : Set S} (hU : IsOpen U) + {w : S} (hw : w ∈ U) : + ∃ δ > 0, discBall h w δ ⊆ U := by + have hK : IsCompact (h '' Uᶜ) := (hU.isClosed_compl.isCompact).image hh + have hw_not : h w ∉ h '' Uᶜ := by + rintro ⟨x, hx, hxw⟩ + exact hx (hinj hxw ▸ hw) + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hK.isClosed.isOpen_compl (h w) hw_not + refine ⟨ε / 2, half_pos hε, fun x hx => ?_⟩ + by_contra hxU + have hx_mem : h x ∈ ball (h w) ε := + mem_ball.mpr (lt_of_le_of_lt hx (half_lt_self hε)) + exact hball hx_mem ⟨x, hxU, rfl⟩ + +/-- Uniform radius `δ > 0` for all regions `r : G.R` so that `discBall h (w_of r) δ ⊆ r.1`. -/ +theorem exists_uniform_discBall_radius (hS : IsClosedDiscSpace S) {G : Drawing S} + (hProper : G.IsProper) {h : S → ℂ} (hh : Continuous h) (hinj : Function.Injective h) + (w_of : G.R → S) (hw_in : ∀ r : G.R, w_of r ∈ r.1) : + ∃ δ > 0, δ < 1 / 2 ∧ ∀ r : G.R, discBall h (w_of r) δ ⊆ r.1 := by + classical + have : CompactSpace S := compactSpace_of_isClosedDiscSpace hS + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + have hR_fin : G.R.Finite := disc_finite_R hS G hProper + have : Finite G.R := hR_fin.to_subtype + have hex : ∀ r : G.R, ∃ δ > 0, discBall h (w_of r) δ ⊆ r.1 := + fun r => exists_discBall_subset_of_isOpen hh hinj (region_isOpen r.2) (hw_in r) + choose δ_of hδ_pos hδ_sub using hex + have h_all : ∀ F : Finset G.R, ∃ δ > 0, δ < 1 / 2 ∧ + ∀ r ∈ F, discBall h (w_of r) δ ⊆ r.1 := by + intro F + induction F using Finset.induction_on with + | empty => + exact ⟨1 / 4, by norm_num, by norm_num, fun _ hr => False.elim (Finset.notMem_empty _ hr)⟩ + | insert r₀ F _ ih => + obtain ⟨δ₁, hδ₁_pos, hδ₁_lt, hδ₁_sub⟩ := ih + refine ⟨min δ₁ (δ_of r₀), lt_min hδ₁_pos (hδ_pos r₀), + lt_of_le_of_lt (min_le_left _ _) hδ₁_lt, ?_⟩ + intro r' hr' + rcases Finset.mem_insert.mp hr' with rfl | hr' + · exact fun x hx => hδ_sub r' (le_trans (show dist _ _ ≤ _ from hx) (min_le_right _ _)) + · exact fun x hx => hδ₁_sub r' hr' (le_trans (show dist _ _ ≤ _ from hx) (min_le_left _ _)) + let _ : Fintype G.R := Fintype.ofFinite G.R + obtain ⟨δ, hδ_pos, hδ_lt, hδ_sub⟩ := h_all Finset.univ + exact ⟨δ, hδ_pos, hδ_lt, fun r => hδ_sub r (Finset.mem_univ r)⟩ + +/-- Straight radial segment in complex disc coordinates from `w` (at `t = 0`) to `y` (at `t = 1`). +-/ +noncomputable def radMap (h : S → ℂ) (g : ℂ → S) (w y : S) (t : I) : S := + g ((1 - (t : ℝ)) • h w + (t : ℝ) • h y) + +omit [TopologicalSpace S] in +theorem radMap_arg_mem_closedBall {h : S → ℂ} + (hmem : ∀ x : S, h x ∈ closedBall (0 : ℂ) 1) (w y : S) (t : I) : + (1 - (t : ℝ)) • h w + (t : ℝ) • h y ∈ closedBall (0 : ℂ) 1 := + convex_closedBall (0 : ℂ) 1 (hmem w) (hmem y) + (sub_nonneg.mpr t.2.2) t.2.1 (sub_add_cancel 1 (t : ℝ)) + +omit [TopologicalSpace S] in +theorem h_radMap {h : S → ℂ} {g : ℂ → S} + (hmem : ∀ x : S, h x ∈ closedBall (0 : ℂ) 1) + (hgr : ∀ z ∈ closedBall (0 : ℂ) 1, h (g z) = z) (w y : S) (t : I) : + h (radMap h g w y t) = (1 - (t : ℝ)) • h w + (t : ℝ) • h y := + hgr _ (radMap_arg_mem_closedBall hmem w y t) + +omit [TopologicalSpace S] in +theorem radMap_zero {h : S → ℂ} {g : ℂ → S} (hgl : ∀ x : S, g (h x) = x) (w y : S) : + radMap h g w y 0 = w := by + simp [radMap, hgl] + +omit [TopologicalSpace S] in +theorem radMap_one {h : S → ℂ} {g : ℂ → S} (hgl : ∀ x : S, g (h x) = x) (w y : S) : + radMap h g w y 1 = y := by + simp [radMap, hgl] + +omit [TopologicalSpace S] in +theorem dist_h_radMap {h : S → ℂ} {g : ℂ → S} + (hmem : ∀ x : S, h x ∈ closedBall (0 : ℂ) 1) + (hgr : ∀ z ∈ closedBall (0 : ℂ) 1, h (g z) = z) (w y : S) (t : I) : + dist (h (radMap h g w y t)) (h w) = (t : ℝ) * dist (h y) (h w) := by + rw [h_radMap hmem hgr, dist_eq_norm, dist_eq_norm] + have heq : (1 - (t : ℝ)) • h w + (t : ℝ) • h y - h w = (t : ℝ) • (h y - h w) := by + module + rw [heq, norm_smul, Real.norm_of_nonneg t.2.1] + +theorem radMap_notMem_bd {h : S → ℂ} {g : ℂ → S} + (hmem : ∀ x : S, h x ∈ closedBall (0 : ℂ) 1) + (hgr : ∀ z ∈ closedBall (0 : ℂ) 1, h (g z) = z) + (hball_iff : ∀ x : S, x ∉ bd S ↔ h x ∈ ball (0 : ℂ) 1) + (w : S) {y : S} (hy : y ∉ bd S) {t : I} (ht : (0 : I) < t) : + radMap h g w y t ∉ bd S := by + rw [hball_iff, h_radMap hmem hgr, mem_ball_zero_iff] + have hw_norm : ‖h w‖ ≤ 1 := mem_closedBall_zero_iff.mp (hmem w) + have hy_norm : ‖h y‖ < 1 := mem_ball_zero_iff.mp ((hball_iff y).mp hy) + have ht_pos : (0 : ℝ) < t := ht + have ht1 : 0 ≤ 1 - (t : ℝ) := sub_nonneg.mpr t.2.2 + calc + ‖(1 - (t : ℝ)) • h w + (t : ℝ) • h y‖ + ≤ ‖(1 - (t : ℝ)) • h w‖ + ‖(t : ℝ) • h y‖ := norm_add_le _ _ + _ = (1 - (t : ℝ)) * ‖h w‖ + (t : ℝ) * ‖h y‖ := by + rw [norm_smul, norm_smul, Real.norm_of_nonneg ht1, Real.norm_of_nonneg t.2.1] + _ < (1 - (t : ℝ)) * 1 + (t : ℝ) * 1 := by + nlinarith + _ = 1 := by ring + +theorem isArcMap_radMap {h : S → ℂ} {g : ℂ → S} + (hinj : Function.Injective h) + (hg : ContinuousOn g (closedBall (0 : ℂ) 1)) + (hmem : ∀ x : S, h x ∈ closedBall (0 : ℂ) 1) + (hgr : ∀ z ∈ closedBall (0 : ℂ) 1, h (g z) = z) + {w y : S} (hyw : y ≠ w) : + IsArcMap (radMap h g w y) := by + refine ⟨hg.comp_continuous (by fun_prop) (radMap_arg_mem_closedBall hmem w y), ?_⟩ + intro s t hst + have h1 : h (radMap h g w y s) = h (radMap h g w y t) := congrArg h hst + rw [h_radMap hmem hgr, h_radMap hmem hgr] at h1 + have h2 : ((s : ℝ) - (t : ℝ)) • (h y - h w) = 0 := by + calc + ((s : ℝ) - (t : ℝ)) • (h y - h w) + = ((1 - (s : ℝ)) • h w + (s : ℝ) • h y) - ((1 - (t : ℝ)) • h w + (t : ℝ) • h y) := by + module + _ = 0 := sub_eq_zero.mpr h1 + have hne : h y - h w ≠ 0 := sub_ne_zero.mpr (hinj.ne hyw) + have h3 : (s : ℝ) - (t : ℝ) = 0 := (smul_eq_zero.mp h2).resolve_right hne + exact Subtype.ext (sub_eq_zero.mp h3) + +theorem isLineWithEnds_range_radMap [T2Space S] {h : S → ℂ} {g : ℂ → S} + (hinj : Function.Injective h) + (hg : ContinuousOn g (closedBall (0 : ℂ) 1)) + (hmem : ∀ x : S, h x ∈ closedBall (0 : ℂ) 1) + (hgl : ∀ x : S, g (h x) = x) + (hgr : ∀ z ∈ closedBall (0 : ℂ) 1, h (g z) = z) + {w y : S} (hyw : y ≠ w) : + IsLineWithEnds (range (radMap h g w y)) y w := by + have harc := isArcMap_radMap hinj hg hmem hgr hyw + have hL := IsArcMap.isLineWithEnds harc + rw [radMap_zero hgl, radMap_one hgl] at hL + exact Surface.IsLineWithEnds.symm hL + +theorem range_radMap_subset_discBall {h : S → ℂ} {g : ℂ → S} + (hmem : ∀ x : S, h x ∈ closedBall (0 : ℂ) 1) + (hgr : ∀ z ∈ closedBall (0 : ℂ) 1, h (g z) = z) + {w y : S} {δ : ℝ} (hy : y ∈ discSphere h w δ) : + range (radMap h g w y) ⊆ discBall h w δ := by + rintro _ ⟨t, rfl⟩ + change dist (h (radMap h g w y t)) (h w) ≤ δ + rw [dist_h_radMap hmem hgr, hy.1] + have hδ : 0 ≤ δ := by rw [← hy.1]; exact dist_nonneg + nlinarith [t.2.1, t.2.2] + +theorem range_radMap_inter_discSphere {h : S → ℂ} {g : ℂ → S} + (hmem : ∀ x : S, h x ∈ closedBall (0 : ℂ) 1) + (hgl : ∀ x : S, g (h x) = x) + (hgr : ∀ z ∈ closedBall (0 : ℂ) 1, h (g z) = z) + {w y : S} {δ : ℝ} (hδ : 0 < δ) (hy : y ∈ discSphere h w δ) : + range (radMap h g w y) ∩ discSphere h w δ = {y} := by + ext x + simp only [mem_inter_iff, mem_range, mem_singleton_iff] + constructor + · rintro ⟨⟨t, rfl⟩, hx_sph, -⟩ + change dist (h (radMap h g w y t)) (h w) = δ at hx_sph + rw [dist_h_radMap hmem hgr, hy.1] at hx_sph + have ht1 : (t : ℝ) = 1 := by nlinarith + have ht : t = 1 := Subtype.ext ht1 + rw [ht, radMap_one hgl] + · rintro rfl + exact ⟨⟨1, radMap_one hgl w x⟩, hy⟩ + +omit [TopologicalSpace S] in +theorem range_radMap_inter_eq_singleton {h : S → ℂ} {g : ℂ → S} + (hinj : Function.Injective h) + (hmem : ∀ x : S, h x ∈ closedBall (0 : ℂ) 1) + (hgl : ∀ x : S, g (h x) = x) + (hgr : ∀ z ∈ closedBall (0 : ℂ) 1, h (g z) = z) + {w y₁ y₂ : S} {δ : ℝ} (hδ : 0 < δ) + (hy₁ : dist (h y₁) (h w) = δ) (hy₂ : dist (h y₂) (h w) = δ) (hne : y₁ ≠ y₂) : + range (radMap h g w y₁) ∩ range (radMap h g w y₂) = {w} := by + ext x + simp only [mem_inter_iff, mem_range, mem_singleton_iff] + constructor + · rintro ⟨⟨s, rfl⟩, ⟨t, hst⟩⟩ + have hd : dist (h (radMap h g w y₁ s)) (h w) = dist (h (radMap h g w y₂ t)) (h w) := by + rw [hst] + rw [dist_h_radMap hmem hgr, dist_h_radMap hmem hgr, hy₁, hy₂] at hd + have hst_eq : (s : ℝ) = (t : ℝ) := mul_right_cancel₀ hδ.ne' hd + by_cases hs0 : (s : ℝ) = 0 + · have hs : s = 0 := Subtype.ext hs0 + rw [hs, radMap_zero hgl] + · have h1 : h (radMap h g w y₂ t) = h (radMap h g w y₁ s) := congrArg h hst + rw [h_radMap hmem hgr, h_radMap hmem hgr, ← hst_eq] at h1 + have h2 : (s : ℝ) • (h y₂ - h y₁) = 0 := by + calc + (s : ℝ) • (h y₂ - h y₁) + = ((1 - (s : ℝ)) • h w + (s : ℝ) • h y₂) - ((1 - (s : ℝ)) • h w + (s : ℝ) • h y₁) := by + module + _ = 0 := sub_eq_zero.mpr h1 + have h3 : h y₂ - h y₁ = 0 := (smul_eq_zero.mp h2).resolve_left hs0 + exact False.elim (hne (hinj (sub_eq_zero.mp h3).symm)) + · rintro rfl + exact ⟨⟨0, radMap_zero hgl x y₁⟩, ⟨0, radMap_zero hgl x y₂⟩⟩ + +/-! ### Section 2: Stub Paths in Edge Charts and Incident Regions -/ + +/-- Parameterization of the half-edge stub in `ℂ` along the positive (`sgn = true`) or negative +(`sgn = false`) imaginary axis up to `± Complex.I / 2`. -/ +noncomputable def zStub (sgn : Bool) (t : I) : ℂ := + (t : ℝ) • (if sgn then Complex.I / 2 else -Complex.I / 2) + +theorem zStub_zero (sgn : Bool) : zStub sgn 0 = 0 := by + simp [zStub] + +theorem norm_zStub (sgn : Bool) (t : I) : ‖zStub sgn t‖ = (t : ℝ) / 2 := by + simp only [zStub, norm_smul, Real.norm_of_nonneg t.2.1] + cases sgn <;> simp <;> ring + +theorem zStub_mem_closedBall_half (sgn : Bool) (t : I) : + zStub sgn t ∈ closedBall (0 : ℂ) (1 / 2) := by + rw [mem_closedBall_zero_iff, norm_zStub] + linarith [t.2.2] + +theorem zStub_mem_ball_one (sgn : Bool) (t : I) : + zStub sgn t ∈ ball (0 : ℂ) 1 := by + rw [mem_ball_zero_iff, norm_zStub] + linarith [t.2.2] + +theorem zStub_mem_closedBall_one (sgn : Bool) (t : I) : + zStub sgn t ∈ closedBall (0 : ℂ) 1 := + ball_subset_closedBall (zStub_mem_ball_one sgn t) + +theorem zStub_re (sgn : Bool) (t : I) : (zStub sgn t).re = 0 := by + cases sgn <;> simp [zStub] + +theorem zStub_im (sgn : Bool) (t : I) : + (zStub sgn t).im = if sgn then (t : ℝ) / 2 else -(t : ℝ) / 2 := by + cases sgn <;> simp [zStub] <;> ring + +theorem zStub_im_eq_zero_iff (sgn : Bool) (t : I) : + (zStub sgn t).im = 0 ↔ t = 0 := by + rw [zStub_im, Subtype.ext_iff] + cases sgn <;> simp + +theorem zStub_injective (sgn : Bool) : Function.Injective (zStub sgn) := by + intro s t h + have him := congrArg Complex.im h + rw [zStub_im, zStub_im] at him + cases sgn <;> simp only [ite_true, Bool.false_eq_true, ite_false] at him <;> + exact Subtype.ext (by linarith) + +theorem continuous_zStub (sgn : Bool) : Continuous (zStub sgn) := by + unfold zStub + fun_prop + +theorem isArcMap_stub {φ : ℂ → S} (hφc : ContinuousOn φ (closedBall (0 : ℂ) 1)) + (hφi : InjOn φ (closedBall (0 : ℂ) 1)) (sgn : Bool) : + IsArcMap (fun t : I => φ (zStub sgn t)) := by + refine ⟨hφc.comp_continuous (continuous_zStub sgn) (zStub_mem_closedBall_one sgn), ?_⟩ + intro s t hst + exact zStub_injective sgn + (hφi (zStub_mem_closedBall_one sgn s) (zStub_mem_closedBall_one sgn t) hst) + +omit [TopologicalSpace S] in +theorem stub_inter_stub_opposite {φ : ℂ → S} (hφi : InjOn φ (closedBall (0 : ℂ) 1)) : + range (fun t : I => φ (zStub true t)) ∩ range (fun t : I => φ (zStub false t)) = {φ 0} := by + ext x + simp only [mem_inter_iff, mem_range, mem_singleton_iff] + constructor + · rintro ⟨⟨s, rfl⟩, ⟨t, hst⟩⟩ + have hz := hφi (zStub_mem_closedBall_one false t) (zStub_mem_closedBall_one true s) hst + have him := congrArg Complex.im hz + rw [zStub_im, zStub_im] at him + simp only [Bool.false_eq_true, ↓reduceIte] at him + have hs0 : (s : ℝ) = 0 := by linarith [s.2.1, t.2.1] + have hs : s = 0 := Subtype.ext hs0 + rw [hs, zStub_zero] + · rintro rfl + exact ⟨⟨0, by simp [zStub_zero]⟩, ⟨0, by simp [zStub_zero]⟩⟩ + +/-! ### Section 3: Non-Separation by Families of Arcs Attached to `G.U` -/ + +theorem connectedComponentIn_sdiff_biUnion_arcs (hS : IsClosedDiscSpace S) {G : Drawing S} + {α : Type*} (F : Finset α) + (J : α → Set S) (v : α → S) + (hJ_line : ∀ a ∈ F, IsLine (J a)) + (hJ_U : ∀ a ∈ F, J a ∩ G.U ⊆ {v a}) + (hJ_bd : ∀ a ∈ F, J a ∩ bd S ⊆ {v a}) + (hJ_inter : ∀ a ∈ F, ∀ b ∈ F, b ≠ a → J a ∩ J b ⊆ {v a}) + {r : Set S} (hr : r ∈ G.R) + {x y : S} (hx : x ∈ (r \ bd S) \ ⋃ a ∈ F, J a) (hy : y ∈ (r \ bd S) \ ⋃ a ∈ F, J a) : + y ∈ connectedComponentIn ((r \ bd S) \ ⋃ a ∈ F, J a) x := by + classical + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have hmain : y ∈ connectedComponentIn ((univ \ bd S) \ (G.U ∪ ⋃ a ∈ F, J a)) x := by + induction F using Finset.induction_on with + | empty => + simp only [Finset.notMem_empty, iUnion_of_empty, iUnion_empty, union_empty] + exact mem_connectedComponentIn_sdiff_bd_of_region hS hr hx.1 hy.1 + | insert a₀ F ha₀ ih => + have hJ_line' : ∀ a ∈ F, IsLine (J a) := fun a ha => hJ_line a (Finset.mem_insert_of_mem ha) + have hJ_U' : ∀ a ∈ F, J a ∩ G.U ⊆ {v a} := fun a ha => hJ_U a (Finset.mem_insert_of_mem ha) + have hJ_bd' : ∀ a ∈ F, J a ∩ bd S ⊆ {v a} := fun a ha => hJ_bd a (Finset.mem_insert_of_mem ha) + have hJ_inter' : ∀ a ∈ F, ∀ b ∈ F, b ≠ a → J a ∩ J b ⊆ {v a} := + fun a ha b hb hne => hJ_inter a (Finset.mem_insert_of_mem ha) b + (Finset.mem_insert_of_mem hb) hne + have hx' : x ∈ (r \ bd S) \ ⋃ a ∈ F, J a := + ⟨hx.1, fun h => hx.2 (by rw [Finset.set_biUnion_insert]; exact Or.inr h)⟩ + have hy' : y ∈ (r \ bd S) \ ⋃ a ∈ F, J a := + ⟨hy.1, fun h => hy.2 (by rw [Finset.set_biUnion_insert]; exact Or.inr h)⟩ + have h_ih := ih hJ_line' hJ_U' hJ_bd' hJ_inter' hx' hy' + let K : Set S := G.U ∪ ⋃ a ∈ F, J a + have hK_cl : IsClosed K := + G.isClosed_U.union (F.finite_toSet.isClosed_biUnion fun a ha => isClosed_of_isLine + (hJ_line' a ha)) + have ha₀_mem : a₀ ∈ insert a₀ F := Finset.mem_insert_self a₀ F + have hJK : J a₀ ∩ K ⊆ {v a₀} := by + rintro z ⟨hzJ, hzU | hzF⟩ + · exact hJ_U a₀ ha₀_mem ⟨hzJ, hzU⟩ + · obtain ⟨b, hbF, hzb⟩ := mem_iUnion₂.mp hzF + have hba : b ≠ a₀ := fun h => ha₀ (h ▸ hbF) + exact hJ_inter a₀ ha₀_mem b (Finset.mem_insert_of_mem hbF) hba ⟨hzJ, hzb⟩ + have hx_in : x ∈ (univ \ bd S) \ (K ∪ J a₀) := by + refine ⟨⟨mem_univ x, hx.1.2⟩, ?_⟩ + rintro ((hxU | hxF) | hxJ₀) + · exact region_subset hr hx.1.1 hxU + · exact hx'.2 hxF + · exact hx.2 (by rw [Finset.set_biUnion_insert]; exact Or.inl hxJ₀) + have hy_in : y ∈ (univ \ bd S) \ (K ∪ J a₀) := by + refine ⟨⟨mem_univ y, hy.1.2⟩, ?_⟩ + rintro ((hyU | hyF) | hyJ₀) + · exact region_subset hr hy.1.1 hyU + · exact hy'.2 hyF + · exact hy.2 (by rw [Finset.set_biUnion_insert]; exact Or.inl hyJ₀) + have h_step := + disc_sdiff_arc_connectedComponentIn hS hK_cl (hJ_line a₀ ha₀_mem) hJK + (hJ_bd a₀ ha₀_mem) hx_in hy_in h_ih + have heq : K ∪ J a₀ = G.U ∪ ⋃ a ∈ insert a₀ F, J a := by + dsimp [K] + rw [Finset.set_biUnion_insert, union_assoc, union_comm (⋃ a ∈ F, J a) (J a₀)] + rwa [heq] at h_step + let C := connectedComponentIn ((univ \ bd S) \ (G.U ∪ ⋃ a ∈ F, J a)) x + have hC_sub : C ⊆ (univ \ bd S) \ (G.U ∪ ⋃ a ∈ F, J a) := connectedComponentIn_subset _ _ + have hx_C : x ∈ C := mem_connectedComponentIn + ⟨⟨mem_univ x, hx.1.2⟩, fun h => h.elim (region_subset hr hx.1.1) hx.2⟩ + have hC_disj_U : Disjoint C G.U := + disjoint_left.mpr fun z hz hzU => (hC_sub hz).2 (Or.inl hzU) + have hC_r : C ⊆ r := + subset_region hr isPreconnected_connectedComponentIn hC_disj_U hx_C hx.1.1 + have hC_target : C ⊆ (r \ bd S) \ ⋃ a ∈ F, J a := + fun z hz => ⟨⟨hC_r hz, (hC_sub hz).1.2⟩, fun hzF => (hC_sub hz).2 (Or.inr hzF)⟩ + exact isPreconnected_connectedComponentIn.subset_connectedComponentIn hx_C hC_target hmain + +/-! ### Section 4: Truncating a Path from a Stub to a Dual Vertex Ball -/ + +private theorem first_hit_mem_discSphere {h : S → ℂ} (hh : Continuous h) + {w : S} {δ : ℝ} {α : I → S} (hα_cont : Continuous α) + {τ : I} (hτ_pos' : (0 : ℝ) < τ) (hτ_mem : α τ ∈ discBall h w δ) + (hbefore_τ : ∀ t : I, t < τ → α t ∉ discBall h w δ) + (hy_bd : α τ ∉ bd S) : α τ ∈ discSphere h w δ := by + refine ⟨le_antisymm hτ_mem ?_, hy_bd⟩ + by_contra hlt + push Not at hlt + have hopen_pre : IsOpen (α ⁻¹' discOpenBall h w δ) := + (isOpen_discOpenBall hh w δ).preimage hα_cont + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hopen_pre τ hlt + let t' : ℝ := max 0 ((τ : ℝ) - ε / 2) + have ht'_mem : t' ∈ Icc (0 : ℝ) 1 := + ⟨le_max_left _ _, max_le zero_le_one (by linarith [τ.2.2])⟩ + let t_sub : I := ⟨t', ht'_mem⟩ + have ht_lt : t_sub < τ := by + change max 0 ((τ : ℝ) - ε / 2) < (τ : ℝ) + exact max_lt hτ_pos' (by linarith) + have ht_in_ball : t_sub ∈ ball τ ε := by + rw [Metric.mem_ball, Subtype.dist_eq, Real.dist_eq] + have h1 : (τ : ℝ) - ε / 2 ≤ t' := le_max_right _ _ + have h2 : t' < (τ : ℝ) := ht_lt + rw [abs_of_neg (by linarith)] + linarith + exact hbefore_τ t_sub ht_lt (discOpenBall_subset_discBall h w δ (hball ht_in_ball)) + +/-- Given a stub `stub : I → S` in region `r` and a connected open subset `Ω ⊆ r \ bd S` containing +`range stub \ {stub 0}` and a point `c ∈ discOpenBall h w δ \ bd S`, we can construct a truncated +spoke arc `T` from `stub 0` to a point `y ∈ discSphere h w δ` inside `{stub 0} ∪ Ω` that meets +`discBall h w δ` only at `y` and agrees with `stub` near `stub 0`. -/ +theorem exists_truncated_spoke_of_connected (hS : IsClosedDiscSpace S) + {h : S → ℂ} (hh : Continuous h) {w : S} {δ : ℝ} + {Ω : Set S} (hΩ_open : IsOpen Ω) (hΩ_bd : Disjoint Ω (bd S)) + {stub : I → S} (hstub_arc : IsArcMap stub) + (hstub_0_not_Ω : stub 0 ∉ Ω) + (hstub_Ω : range stub \ {stub 0} ⊆ Ω) + (hstub_ball : Disjoint (range stub) (discBall h w δ)) + {c : S} (hc_ball : c ∈ discOpenBall h w δ) + (hconn : c ∈ connectedComponentIn Ω (stub 1)) : + ∃ (T A_far : Set S) (y : S) (u₀ : I), + IsLineWithEnds T (stub 0) y ∧ + y ∈ discSphere h w δ ∧ + T \ {stub 0} ⊆ Ω ∧ + T ∩ discBall h w δ = {y} ∧ + (0 : I) < u₀ ∧ + IsClosed A_far ∧ + stub 0 ∉ A_far ∧ + T = stub '' Icc 0 u₀ ∪ A_far := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + have h1_ne_0 : stub 1 ≠ stub 0 := fun heq => by + exact zero_ne_one (hstub_arc.2 heq.symm) + have h1_Ω : stub 1 ∈ Ω := hstub_Ω ⟨⟨1, rfl⟩, h1_ne_0⟩ + have hcomp_open : IsOpen (connectedComponentIn Ω (stub 1)) := hΩ_open.connectedComponentIn + have hcomp_pc : IsPathConnected (connectedComponentIn Ω (stub 1)) := + hcomp_open.isConnected_iff_isPathConnected.mp + ⟨⟨stub 1, mem_connectedComponentIn h1_Ω⟩, isPreconnected_connectedComponentIn⟩ + obtain ⟨P, hP⟩ := hcomp_pc.joinedIn (stub 1) (mem_connectedComponentIn h1_Ω) c hconn + have h1_ne_c : stub 1 ≠ c := fun heq => + disjoint_left.mp hstub_ball ⟨1, rfl⟩ (heq ▸ discOpenBall_subset_discBall h w δ hc_ball) + obtain ⟨α, hα_cont, hα_inj, hα0, hα1, hα_sub⟩ := + exists_arc_of_path P.continuous (by simpa using h1_ne_c) + have hα0' : α 0 = stub 1 := by simpa using hα0 + have hα1' : α 1 = c := by simpa using hα1 + have hα_arc : IsArcMap α := ⟨hα_cont, hα_inj⟩ + have hα_Ω : range α ⊆ Ω := by + rintro _ ⟨t, rfl⟩ + obtain ⟨s, hs⟩ := hα_sub ⟨t, rfl⟩ + rw [← hs] + exact connectedComponentIn_subset _ _ (hP s) + -- Step 1: First hit `τ` of `discBall h w δ` along `α`. + let S_hit : Set I := α ⁻¹' discBall h w δ + have hS_hit_cl : IsClosed S_hit := (isClosed_discBall hh w δ).preimage hα_cont + have h1_hit : (1 : I) ∈ S_hit := by + change α 1 ∈ discBall h w δ + rw [hα1'] + exact discOpenBall_subset_discBall h w δ hc_ball + obtain ⟨τ, hτ_mem, hτ_min⟩ := hS_hit_cl.isCompact.exists_isLeast ⟨1, h1_hit⟩ + have h0_not_hit : (0 : I) ∉ S_hit := by + change α 0 ∉ discBall h w δ + rw [hα0'] + exact disjoint_left.mp hstub_ball ⟨1, rfl⟩ + have hτ_pos : (0 : I) < τ := + lt_of_le_of_ne (unitInterval.nonneg τ) (fun heq => h0_not_hit (heq ▸ hτ_mem)) + have hτ_pos' : (0 : ℝ) < τ := hτ_pos + have hbefore_τ : ∀ t : I, t < τ → α t ∉ discBall h w δ := + fun t hlt ht => not_le.mpr hlt (hτ_min ht) + let y : S := α τ + have hy_Ω : y ∈ Ω := hα_Ω ⟨τ, rfl⟩ + have hy_sph : y ∈ discSphere h w δ := + first_hit_mem_discSphere hh hα_cont hτ_pos' hτ_mem hbefore_τ (disjoint_left.mp hΩ_bd hy_Ω) + let α₁ : I → S := pieceA α 0 τ + have hα₁_arc : IsArcMap α₁ := isArcMap_pieceA hα_arc le_rfl hτ_pos' τ.2.2 + have hα₁_0 : α₁ 0 = stub 1 := by + dsimp [α₁] + rw [pieceA_zero] + exact (extI_coe α 0).trans hα0' + have hα₁_1 : α₁ 1 = y := by dsimp [α₁]; rw [pieceA_one, extI_coe] + have hα₁_range : range α₁ = α '' Icc 0 τ := by + dsimp [α₁] + rw [range_pieceA α le_rfl hτ_pos'.le τ.2.2] + ext z + constructor + · rintro ⟨r, hr, rfl⟩ + have hrI : r ∈ Icc (0 : ℝ) 1 := ⟨hr.1, hr.2.trans τ.2.2⟩ + exact ⟨⟨r, hrI⟩, hr, (extI_of_mem α hrI).symm⟩ + · rintro ⟨t, ht, rfl⟩ + exact ⟨t.1, ht, extI_coe α t⟩ + have hα₁_Ω : range α₁ ⊆ Ω := by + rw [hα₁_range] + exact (image_subset_range α _).trans hα_Ω + have hα₁_ball : ∀ s : I, α₁ s ∈ discBall h w δ ↔ s = 1 := by + intro s + constructor + · intro hs + have hs_mem : α₁ s ∈ range α₁ := mem_range_self s + rw [hα₁_range] at hs_mem + obtain ⟨t, ht, hts⟩ := hs_mem + have ht_in : t ∈ S_hit := by + change α t ∈ discBall h w δ + rw [hts] + exact hs + have ht_ge : τ ≤ t := hτ_min ht_in + have ht_eq : t = τ := le_antisymm ht.2 ht_ge + subst ht_eq + exact hα₁_arc.2 (hts.symm.trans hα₁_1.symm) + · rintro rfl + rw [hα₁_1] + exact discSphere_subset_discBall h w δ hy_sph + -- Step 2: Last hit `s₀` of `range stub` along `α₁`. + let S_stub : Set I := α₁ ⁻¹' range stub + have hstub_cl : IsClosed (range stub) := (isCompact_range hstub_arc.1).isClosed + have hS_stub_cl : IsClosed S_stub := hstub_cl.preimage hα₁_arc.1 + have h0_stub : (0 : I) ∈ S_stub := by + change α₁ 0 ∈ range stub + rw [hα₁_0] + exact ⟨1, rfl⟩ + obtain ⟨s₀, hs₀_mem, hs₀_max⟩ := hS_stub_cl.isCompact.exists_isGreatest ⟨0, h0_stub⟩ + have h1_not_stub : (1 : I) ∉ S_stub := by + change α₁ 1 ∉ range stub + rw [hα₁_1] + exact fun hy_stub => disjoint_left.mp hstub_ball hy_stub (discSphere_subset_discBall h w δ + hy_sph) + have hs₀_lt : s₀ < (1 : I) := + lt_of_le_of_ne (unitInterval.le_one s₀) (fun heq => h1_not_stub (heq ▸ hs₀_mem)) + have hs₀_lt' : (s₀ : ℝ) < 1 := hs₀_lt + have hafter_s₀ : ∀ s : I, s₀ < s → α₁ s ∉ range stub := + fun s hgt hs => not_le.mpr hgt (hs₀_max hs) + obtain ⟨u₀, hu₀_eq⟩ : α₁ s₀ ∈ range stub := hs₀_mem + have hu₀_pos : (0 : I) < u₀ := by + refine lt_of_le_of_ne (unitInterval.nonneg u₀) fun heq => ?_ + have h_in_Ω : α₁ s₀ ∈ Ω := hα₁_Ω ⟨s₀, rfl⟩ + rw [← hu₀_eq, ← heq] at h_in_Ω + exact hstub_0_not_Ω h_in_Ω + have hu₀_pos' : (0 : ℝ) < u₀ := hu₀_pos + let β₀ : I → S := pieceA stub 0 u₀ + let α₂ : I → S := pieceA α₁ s₀ 1 + have hβ₀_arc : IsArcMap β₀ := isArcMap_pieceA hstub_arc le_rfl hu₀_pos' u₀.2.2 + have hα₂_arc : IsArcMap α₂ := isArcMap_pieceA hα₁_arc s₀.2.1 hs₀_lt' le_rfl + have hβ₀_0 : β₀ 0 = stub 0 := by + dsimp [β₀] + rw [pieceA_zero] + exact extI_coe stub 0 + have hβ₀_1 : β₀ 1 = stub u₀ := by dsimp [β₀]; rw [pieceA_one, extI_coe] + have hα₂_0 : α₂ 0 = stub u₀ := by dsimp [α₂]; rw [pieceA_zero, extI_coe, hu₀_eq] + have hα₂_1 : α₂ 1 = y := by + dsimp [α₂] + rw [pieceA_one] + exact (extI_coe α₁ 1).trans hα₁_1 + have hβ₀_range : range β₀ = stub '' Icc 0 u₀ := by + dsimp [β₀] + rw [range_pieceA stub le_rfl hu₀_pos'.le u₀.2.2] + ext z + constructor + · rintro ⟨r, hr, rfl⟩ + have hrI : r ∈ Icc (0 : ℝ) 1 := ⟨hr.1, hr.2.trans u₀.2.2⟩ + exact ⟨⟨r, hrI⟩, hr, (extI_of_mem stub hrI).symm⟩ + · rintro ⟨t, ht, rfl⟩ + exact ⟨t.1, ht, extI_coe stub t⟩ + have hα₂_range : range α₂ = α₁ '' Icc s₀ 1 := by + dsimp [α₂] + rw [range_pieceA α₁ s₀.2.1 hs₀_lt'.le le_rfl] + ext z + constructor + · rintro ⟨r, hr, rfl⟩ + have hrI : r ∈ Icc (0 : ℝ) 1 := ⟨s₀.2.1.trans hr.1, hr.2⟩ + exact ⟨⟨r, hrI⟩, hr, (extI_of_mem α₁ hrI).symm⟩ + · rintro ⟨t, ht, rfl⟩ + exact ⟨t.1, ht, extI_coe α₁ t⟩ + have hβ₀_L : IsLineWithEnds (range β₀) (stub 0) (stub u₀) := by + have hL := IsArcMap.isLineWithEnds hβ₀_arc + rwa [hβ₀_0, hβ₀_1] at hL + have hα₂_L : IsLineWithEnds (range α₂) (stub u₀) y := by + have hL := IsArcMap.isLineWithEnds hα₂_arc + rwa [hα₂_0, hα₂_1] at hL + have hinter : range β₀ ∩ range α₂ = {stub u₀} := by + rw [hβ₀_range, hα₂_range] + ext z + simp only [mem_inter_iff, mem_image, mem_Icc, mem_singleton_iff] + constructor + · rintro ⟨⟨u, hu, rfl⟩, ⟨s, hs, hsu⟩⟩ + have hs_eq : s = s₀ := by + refine le_antisymm ?_ hs.1 + by_contra hlt + push Not at hlt + exact hafter_s₀ s hlt ⟨u, hsu.symm⟩ + subst hs_eq + rw [← hsu, hu₀_eq] + · rintro rfl + exact ⟨⟨u₀, ⟨unitInterval.nonneg u₀, le_rfl⟩, rfl⟩, + ⟨s₀, ⟨le_rfl, unitInterval.le_one s₀⟩, hu₀_eq.symm⟩⟩ + have hT_line : IsLineWithEnds (range β₀ ∪ range α₂) (stub 0) y := + Surface.IsLineWithEnds.union hβ₀_L hα₂_L hinter + refine ⟨range β₀ ∪ range α₂, range α₂, y, u₀, hT_line, hy_sph, ?_, ?_, hu₀_pos, + (isCompact_range hα₂_arc.1).isClosed, ?_, by rw [hβ₀_range]⟩ + · rintro z ⟨hz_mem | hz_mem, hz_ne⟩ + · rw [hβ₀_range] at hz_mem + obtain ⟨u, _, rfl⟩ := hz_mem + exact hstub_Ω ⟨⟨u, rfl⟩, hz_ne⟩ + · rw [hα₂_range] at hz_mem + obtain ⟨s, _, rfl⟩ := hz_mem + exact hα₁_Ω ⟨s, rfl⟩ + · ext z + simp only [mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hz_β | hz_α, hz_ball⟩ + · rw [hβ₀_range] at hz_β + obtain ⟨u, _, rfl⟩ := hz_β + exact False.elim (disjoint_left.mp hstub_ball ⟨u, rfl⟩ hz_ball) + · rw [hα₂_range] at hz_α + obtain ⟨s, _, rfl⟩ := hz_α + have hs1 : s = 1 := (hα₁_ball s).mp hz_ball + rw [hs1, hα₁_1] + · rintro rfl + exact ⟨Or.inr ⟨1, hα₂_1⟩, discSphere_subset_discBall h w δ hy_sph⟩ + · intro h0_in + rw [hα₂_range] at h0_in + obtain ⟨s, _, hs0⟩ := h0_in + exact hstub_0_not_Ω (hs0 ▸ hα₁_Ω ⟨s, rfl⟩) + +/-! ### Section 5: Assembling the Dual Drawing from Half-Edge Spokes -/ + +theorem isPathConnected_sdiff_right_and_closure [T2Space S] {L : Set S} {u v : S} + (hL : IsLineWithEnds L u v) : + u ∈ L \ {v} ∧ IsPathConnected (L \ {v}) ∧ closure (L \ {v}) = L := by + obtain ⟨f, h0, h1⟩ := hL + have huv : u ≠ v := fun he => by + have : f 0 = f 1 := Subtype.ext (by rw [h0, h1, he]) + exact zero_ne_one (f.injective this) + let g : I → S := fun t => (f t).1 + have hgc : Continuous g := continuous_subtype_val.comp f.continuous + have hgi : Function.Injective g := fun s t h => f.injective (Subtype.ext h) + have hg0 : g 0 = u := h0 + have hg1 : g 1 = v := h1 + have hrange : range g = L := by + ext x + exact ⟨by rintro ⟨t, rfl⟩; exact (f t).2, fun hx => ⟨f.symm ⟨x, hx⟩, by simp [g]⟩⟩ + have hsdiff : L \ {v} = g '' Ico (0 : I) 1 := by + ext x + simp only [mem_sdiff, mem_singleton_iff, mem_image, mem_Ico] + constructor + · rintro ⟨hxL, hxv⟩ + rw [← hrange] at hxL + obtain ⟨t, rfl⟩ := hxL + refine ⟨t, ⟨unitInterval.nonneg t, lt_of_le_of_ne (unitInterval.le_one t) ?_⟩, rfl⟩ + intro ht1 + exact hxv (ht1 ▸ hg1) + · rintro ⟨t, ⟨_, ht1⟩, rfl⟩ + refine ⟨hrange ▸ mem_range_self t, fun hgv => ?_⟩ + exact ht1.ne (hgi (hgv.trans hg1.symm)) + have hIco_eq : Ico (0 : I) 1 = projIcc 0 1 zero_le_one '' Ico (0 : ℝ) 1 := by + ext t + constructor + · intro ht + exact ⟨t.1, ⟨ht.1, ht.2⟩, projIcc_val zero_le_one t⟩ + · rintro ⟨r, hr, rfl⟩ + rw [mem_Ico, ← Subtype.coe_le_coe, ← Subtype.coe_lt_coe, + projIcc_of_mem zero_le_one (Ico_subset_Icc_self hr)] + exact hr + have hIco_pc : IsPathConnected (Ico (0 : I) 1) := by + rw [hIco_eq] + exact ((convex_Ico (0 : ℝ) 1).isPathConnected ⟨0, by simp⟩).image continuous_projIcc + have hL_cl : IsClosed L := hrange ▸ (isCompact_range hgc).isClosed + refine ⟨⟨hrange ▸ ⟨0, hg0⟩, huv⟩, hsdiff ▸ hIco_pc.image hgc, ?_⟩ + refine Subset.antisymm (closure_minimal sdiff_subset hL_cl) ?_ + rw [hsdiff, ← hrange] + rintro _ ⟨t, rfl⟩ + have ht_cl : t ∈ closure (Ico (0 : I) 1) := by + have hsub : Ioo (0 : I) 1 ⊆ Ico (0 : I) 1 := Ioo_subset_Ico_self + have hcl_Ioo : closure (Ioo (0 : I) 1) = Icc (0 : I) 1 := closure_Ioo zero_ne_one + exact closure_mono hsub (hcl_Ioo ▸ ⟨unitInterval.nonneg t, unitInterval.le_one t⟩) + exact map_mem_closure hgc ht_cl fun s hs => ⟨s, hs, rfl⟩ + +/-- Given a finite vertex set `W` and for each edge `e : G.E` two half-edge spokes `H e true` and +`H e false` joining `m e` to `w_end e true ∈ W` and `w_end e false ∈ W`, their union forms a valid +`Drawing S` whose vertex set is `W` and whose edges are `{ (H e true ∪ H e false) \ W | e : G.E }`. +-/ +theorem exists_dual_drawing_of_spokes [T2Space S] {G : Drawing S} + {W : Set S} (hW_fin : W.Finite) + (m : G.E → S) (w_end : G.E → Bool → S) (H : G.E → Bool → Set S) + (hm_not_W : ∀ e : G.E, m e ∉ W) + (hw_mem : ∀ e sgn, w_end e sgn ∈ W) + (hH_line : ∀ e sgn, IsLineWithEnds (H e sgn) (m e) (w_end e sgn)) + (hH_W : ∀ e sgn, H e sgn ∩ W = {w_end e sgn}) + (hH_opp : ∀ e, H e true ∩ H e false ⊆ {m e, w_end e true}) + (hH_opp_ne : ∀ e, w_end e true ≠ w_end e false → H e true ∩ H e false = {m e}) + (hH_disj : ∀ e₁ e₂ sgn₁ sgn₂, e₁ ≠ e₂ → H e₁ sgn₁ ∩ H e₂ sgn₂ ⊆ W) : + ∃ (G_dual : Drawing S) (edgeEquiv : G.E ≃ G_dual.E), + G_dual.V = W ∧ + G_dual.U = W ∪ (⋃ e : G.E, (H e true ∪ H e false)) ∧ + (∀ e : G.E, (edgeEquiv e).1 = (H e true ∪ H e false) \ W) ∧ + (∀ e : G.E, G_dual.toGraph.IsLink (edgeEquiv e).1 (w_end e true) (w_end e false)) := by + classical + have : Finite G.E := G.finite_edges.to_subtype + let _ : Fintype G.E := Fintype.ofFinite G.E + let K : G.E → Set S := fun e => H e true ∪ H e false + let eStar : G.E → Set S := fun e => K e \ W + have hK_cl : ∀ e : G.E, IsClosed (K e) := + fun e => (isClosed_of_isLine (IsLineWithEnds.isLine (hH_line e true))).union + (isClosed_of_isLine (IsLineWithEnds.isLine (hH_line e false))) + have hK_W : ∀ e : G.E, K e ∩ W = {w_end e true, w_end e false} := by + intro e + dsimp [K] + rw [union_inter_distrib_right, hH_W e true, hH_W e false, pair_comm (w_end e true), + insert_eq, union_comm] + have heStar_eq : ∀ e : G.E, + eStar e = (H e true \ {w_end e true}) ∪ (H e false \ {w_end e false}) := by + intro e + ext x + simp only [eStar, K, mem_sdiff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hx | hx, hxW⟩ + · exact Or.inl ⟨hx, fun heq => hxW (heq ▸ hw_mem e true)⟩ + · exact Or.inr ⟨hx, fun heq => hxW (heq ▸ hw_mem e false)⟩ + · rintro (⟨hx, hne⟩ | ⟨hx, hne⟩) + · refine ⟨Or.inl hx, fun hxW => hne ?_⟩ + have : x ∈ H e true ∩ W := ⟨hx, hxW⟩ + rwa [hH_W e true, mem_singleton_iff] at this + · refine ⟨Or.inr hx, fun hxW => hne ?_⟩ + have : x ∈ H e false ∩ W := ⟨hx, hxW⟩ + rwa [hH_W e false, mem_singleton_iff] at this + have hm_eStar : ∀ e : G.E, m e ∈ eStar e := by + intro e + rw [heStar_eq] + exact Or.inl (isPathConnected_sdiff_right_and_closure (hH_line e true)).1 + have heStar_pc : ∀ e : G.E, IsPathConnected (eStar e) := by + intro e + rw [heStar_eq] + obtain ⟨hm1, hpc1, _⟩ := isPathConnected_sdiff_right_and_closure (hH_line e true) + obtain ⟨hm2, hpc2, _⟩ := isPathConnected_sdiff_right_and_closure (hH_line e false) + exact hpc1.union hpc2 ⟨m e, hm1, hm2⟩ + have heStar_cl : ∀ e : G.E, closure (eStar e) = K e := by + intro e + rw [heStar_eq, closure_union, + (isPathConnected_sdiff_right_and_closure (hH_line e true)).2.2, + (isPathConnected_sdiff_right_and_closure (hH_line e false)).2.2] + have hK_disj : ∀ e₁ e₂ : G.E, e₁ ≠ e₂ → K e₁ ∩ K e₂ ⊆ W := by + rintro e₁ e₂ hne x ⟨hx1 | hx1, hx2 | hx2⟩ + · exact hH_disj e₁ e₂ true true hne ⟨hx1, hx2⟩ + · exact hH_disj e₁ e₂ true false hne ⟨hx1, hx2⟩ + · exact hH_disj e₁ e₂ false true hne ⟨hx1, hx2⟩ + · exact hH_disj e₁ e₂ false false hne ⟨hx1, hx2⟩ + let U_dual : Set S := W ∪ ⋃ e : G.E, K e + have hU_sdiff_W : U_dual \ W = ⋃ e : G.E, eStar e := by + ext x + simp only [U_dual, eStar, mem_sdiff, mem_union, mem_iUnion] + constructor + · rintro ⟨hxW | ⟨e, hxe⟩, hnotW⟩ + · exact False.elim (hnotW hxW) + · exact ⟨e, hxe, hnotW⟩ + · rintro ⟨e, hxe, hnotW⟩ + exact ⟨Or.inr ⟨e, hxe⟩, hnotW⟩ + have hsub_eStar : ∀ {D : Set S} (e : G.E), + D ⊆ U_dual \ W → IsPathConnected D → (D ∩ eStar e).Nonempty → D ⊆ eStar e := by + intro D e hD_sub hD_pc ⟨x₀, hx₀D, hx₀e⟩ + let X : Set S := K e + let Y : Set S := ⋃ e' ∈ Finset.univ.erase e, K e' + have hX : IsClosed X := hK_cl e + have hY : IsClosed Y := (Finset.univ.erase e).finite_toSet.isClosed_biUnion fun e' _ => hK_cl e' + have hD_XY : D ⊆ X ∪ Y := by + intro x hx + have hx_u := hD_sub hx + rw [hU_sdiff_W, mem_iUnion] at hx_u + obtain ⟨e', hxe'⟩ := hx_u + by_cases he' : e' = e + · subst he'; exact Or.inl hxe'.1 + · exact Or.inr (mem_iUnion₂.mpr ⟨e', Finset.mem_erase.mpr ⟨he', Finset.mem_univ e'⟩, hxe'.1⟩) + have hdis : ∀ x ∈ D, x ∈ X → x ∉ Y := by + intro x hx hxX hxY + obtain ⟨e', he', hxK'⟩ := mem_iUnion₂.mp hxY + have hne : e ≠ e' := (Finset.mem_erase.mp he').1.symm + exact (hD_sub hx).2 (hK_disj e e' hne ⟨hxX, hxK'⟩) + rcases subset_or_subset_of_closed hD_pc.isConnected.isPreconnected hX hY hD_XY hdis with hDX | + hDY + · exact fun x hx => ⟨hDX hx, (hD_sub hx).2⟩ + · exact False.elim (hdis x₀ hx₀D hx₀e.1 (hDY hx₀D)) + have harc_eq : arcComponentsIn (U_dual \ W) = range eStar := by + ext C + simp only [mem_range] + constructor + · rintro ⟨⟨x₀, hx₀C⟩, hC_sub, hC_pc, hC_max⟩ + have hx₀_u := hC_sub hx₀C + rw [hU_sdiff_W, mem_iUnion] at hx₀_u + obtain ⟨e, hx₀e⟩ := hx₀_u + have hC_sub_e : C ⊆ eStar e := hsub_eStar e hC_sub hC_pc ⟨x₀, hx₀C, hx₀e⟩ + have he_sub_u : eStar e ⊆ U_dual \ W := by + rw [hU_sdiff_W]; exact subset_iUnion eStar e + exact ⟨e, hC_max (eStar e) he_sub_u (heStar_pc e) hC_sub_e⟩ + · rintro ⟨e, rfl⟩ + have he_sub_u : eStar e ⊆ U_dual \ W := by + rw [hU_sdiff_W]; exact subset_iUnion eStar e + refine ⟨⟨m e, hm_eStar e⟩, he_sub_u, heStar_pc e, fun D hD hD_pc hsub => ?_⟩ + exact Subset.antisymm (hsub_eStar e hD hD_pc ⟨m e, hsub (hm_eStar e), hm_eStar e⟩) hsub + let G_dual : Drawing S := { + U := U_dual + V := W + V_subset_U := subset_union_left + isClosed_U := hW_fin.isClosed.union (isClosed_iUnion_of_finite hK_cl) + finite_V := hW_fin + finite_edges := by + rw [harc_eq] + exact finite_range eStar + edge_cond := by + intro C hC + change C ∈ arcComponentsIn (U_dual \ W) at hC + rw [harc_eq] at hC + obtain ⟨e, rfl⟩ := hC + rw [heStar_cl e, hK_W e] + by_cases hne : w_end e true ≠ w_end e false + · left + refine ⟨w_end e true, w_end e false, hne, rfl, ?_⟩ + exact Surface.IsLineWithEnds.union + (Surface.IsLineWithEnds.symm (hH_line e true)) (hH_line e false) + (hH_opp_ne e hne) + · right + push Not at hne + rw [hne, pair_eq_singleton] + refine ⟨w_end e false, rfl, ?_⟩ + have hL1 : IsLineWithEnds (H e true) (m e) (w_end e false) := hne ▸ hH_line e true + have hcap : H e true ∩ H e false ⊆ {m e, w_end e false} := hne ▸ hH_opp e + exact isOArc_union hL1 (hH_line e false) hcap + } + have hGd_E : G_dual.E = range eStar := harc_eq + have heStar_inj : Function.Injective eStar := by + intro e₁ e₂ heq + have hm1 : m e₁ ∈ eStar e₂ := heq ▸ hm_eStar e₁ + by_contra hne + exact hm_not_W e₁ (hK_disj e₁ e₂ hne ⟨(hm_eStar e₁).1, hm1.1⟩) + let f_equiv : G.E → G_dual.E := fun e => ⟨eStar e, hGd_E ▸ mem_range_self e⟩ + have hf_bij : Function.Bijective f_equiv := by + refine ⟨fun e₁ e₂ h => heStar_inj (congrArg Subtype.val h), ?_⟩ + rintro ⟨C, hC⟩ + rw [hGd_E] at hC + obtain ⟨e, rfl⟩ := hC + exact ⟨e, rfl⟩ + let edgeEquiv : G.E ≃ G_dual.E := Equiv.ofBijective f_equiv hf_bij + refine ⟨G_dual, edgeEquiv, rfl, rfl, fun e => rfl, fun e => ?_⟩ + refine ⟨(edgeEquiv e).2, hw_mem e true, hw_mem e false, ?_⟩ + change closure (eStar e) ∩ W = {w_end e true, w_end e false} + rw [heStar_cl e, hK_W e] + +/-! ### Section 6: Main Existence Theorem `exists_isDiscDualDrawing` and `(3.6)` -/ + +private theorem exists_truncated_spokes (hS : IsClosedDiscSpace S) {G : Drawing S} + {h : S → ℂ} (hh : Continuous h) {w_of c_of : G.R → S} {δ : ℝ} + (hδ_sub : ∀ r : G.R, discBall h (w_of r) δ ⊆ r.1) + (hc_of : ∀ r : G.R, c_of r ∈ discOpenBall h (w_of r) δ \ bd S) + {m_of : G.E → S} (hm_mem_U : ∀ e : G.E, m_of e ∈ G.U) + (hm_not_bd : ∀ e : G.E, m_of e ∉ bd S) (hm_inj : Function.Injective m_of) : + let Half := G.E × Bool + ∀ (stub : Half → I → S) (r_of : Half → G.R), + let Stub : Half → Set S := fun a => range (stub a) + (∀ a, IsArcMap (stub a)) → + (∀ a, stub a 0 = m_of a.1) → + (∀ a, Stub a ∩ G.U = {m_of a.1}) → + (∀ a, Stub a ∩ bd S = ∅) → + (∀ a (r : G.R), Disjoint (Stub a) (discBall h (w_of r) δ)) → + (∀ a b, b ≠ a → Stub a ∩ Stub b = if a.1 = b.1 then {m_of a.1} else ∅) → + (∀ a (t : I), (0 : I) < t → stub a t ∈ (r_of a).1 \ bd S) → + ∀ F : Finset Half, + ∃ (T A_far : Half → Set S) (y : Half → S) (u₀ : Half → I), + (∀ a ∉ F, T a = Stub a) ∧ + (∀ a ∈ F, + IsLineWithEnds (T a) (m_of a.1) (y a) ∧ + y a ∈ discSphere h (w_of (r_of a)) δ ∧ + T a ∩ discBall h (w_of (r_of a)) δ = {y a} ∧ + (0 : I) < u₀ a ∧ + IsClosed (A_far a) ∧ + m_of a.1 ∉ A_far a ∧ + T a = stub a '' Icc 0 (u₀ a) ∪ A_far a) ∧ + (∀ a : Half, + IsLine (T a) ∧ + T a \ {m_of a.1} ⊆ (r_of a).1 \ bd S ∧ + T a ∩ G.U = {m_of a.1} ∧ + T a ∩ bd S = ∅ ∧ + (∀ r : G.R, r ≠ r_of a → Disjoint (T a) (discBall h (w_of r) δ)) ∧ + (∀ r : G.R, Disjoint (T a) (discOpenBall h (w_of r) δ)) ∧ + (∀ b : Half, b ≠ a → T a ∩ T b = if a.1 = b.1 then {m_of a.1} else ∅)) := by + classical + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : Finite G.E := G.finite_edges.to_subtype + have hbd_cl : IsClosed (bd S) := isClosed_bd_of_isClosedDiscSpace hS + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + intro Half stub r_of Stub hstub_arc hstub_0 hStub_U hStub_bd hStub_D hStub_inter hr_of + let _ : Fintype Half := Fintype.ofFinite Half + intro F + induction F using Finset.induction_on with + | empty => + refine ⟨Stub, fun _ => ∅, fun a => stub a 1, fun _ => 1, + fun _ _ => rfl, fun _ ha => False.elim (Finset.notMem_empty _ ha), fun a => ?_⟩ + refine ⟨IsLineWithEnds.isLine (IsArcMap.isLineWithEnds (hstub_arc a)), ?_, hStub_U a, + hStub_bd a, fun r _ => hStub_D a r, + fun r => (hStub_D a r).mono_right (discOpenBall_subset_discBall h (w_of r) δ), + fun b hne => hStub_inter a b hne⟩ + rintro _ ⟨⟨t, rfl⟩, hne⟩ + have ht_pos : (0 : I) < t := + lt_of_le_of_ne (unitInterval.nonneg t) (fun heq => hne (heq ▸ hstub_0 a)) + exact hr_of a t ht_pos + | insert a₀ F ha₀_not_F ih => + obtain ⟨T, A_far, y, u₀, hT_out, hT_in, hT_all⟩ := ih + have hT_a₀ : T a₀ = Stub a₀ := hT_out a₀ ha₀_not_F + let E₀ : Finset Half := Finset.univ.erase a₀ + let r₀ : G.R := r_of a₀ + let Ω : Set S := (r₀.1 \ bd S) \ ⋃ b ∈ E₀, T b + have hΩ_open : IsOpen Ω := by + refine ((region_isOpen r₀.2).sdiff hbd_cl).sdiff ?_ + exact E₀.finite_toSet.isClosed_biUnion fun b _ => isClosed_of_isLine (hT_all b).1 + have hΩ_bd : Disjoint Ω (bd S) := disjoint_left.mpr fun _ hx => hx.1.2 + have h0_not_Ω : stub a₀ 0 ∉ Ω := by + rw [hstub_0] + intro hm + exact region_subset r₀.2 hm.1.1 (hm_mem_U a₀.1) + have hstub_Ω : range (stub a₀) \ {stub a₀ 0} ⊆ Ω := by + rw [hstub_0] + rintro x ⟨hx_stub, hx_ne⟩ + have hx_T : x ∈ T a₀ \ {m_of a₀.1} := ⟨hT_a₀.symm ▸ hx_stub, hx_ne⟩ + refine ⟨(hT_all a₀).2.1 hx_T, ?_⟩ + intro hx_union + obtain ⟨b, hbE₀, hxb⟩ := mem_iUnion₂.mp hx_union + have hba : b ≠ a₀ := (Finset.mem_erase.mp hbE₀).1 + have hinter : x ∈ T a₀ ∩ T b := ⟨hx_T.1, hxb⟩ + rw [(hT_all a₀).2.2.2.2.2.2 b hba] at hinter + split_ifs at hinter with heq + · exact hx_ne hinter + · exact hinter + have hc₀_Ω : c_of r₀ ∈ Ω := by + have hc_in : c_of r₀ ∈ discOpenBall h (w_of r₀) δ \ bd S := hc_of r₀ + refine ⟨⟨hδ_sub r₀ (discOpenBall_subset_discBall h (w_of r₀) δ hc_in.1), hc_in.2⟩, ?_⟩ + intro hx_union + obtain ⟨b, _, hxb⟩ := mem_iUnion₂.mp hx_union + exact disjoint_left.mp ((hT_all b).2.2.2.2.2.1 r₀) hxb hc_in.1 + have h1_Ω : stub a₀ 1 ∈ Ω := by + apply hstub_Ω + refine ⟨⟨1, rfl⟩, fun heq => ?_⟩ + exact one_ne_zero ((hstub_arc a₀).2 heq) + have hconn_Ω : c_of r₀ ∈ connectedComponentIn Ω (stub a₀ 1) := by + refine connectedComponentIn_sdiff_biUnion_arcs hS E₀ T (fun b => m_of b.1) + (fun b _ => (hT_all b).1) + (fun b _ => by rw [(hT_all b).2.2.1]) + (fun b _ => by rw [(hT_all b).2.2.2.1]; exact empty_subset _) + (fun b _ c _ hne => by + rw [(hT_all b).2.2.2.2.2.2 c hne] + split_ifs <;> simp) + r₀.2 h1_Ω hc₀_Ω + obtain ⟨T_new, A_new, y_new, u_new, hTn_line, hyn_sph, hTn_Ω, hTn_ball, + hun_pos, hAn_cl, hm_not_An, hTn_eq⟩ := + exists_truncated_spoke_of_connected hS hh hΩ_open hΩ_bd (hstub_arc a₀) + h0_not_Ω hstub_Ω (hStub_D a₀ r₀) (hc_of r₀).1 hconn_Ω + rw [hstub_0] at hTn_line hTn_Ω hm_not_An + let T' : Half → Set S := fun a => if a = a₀ then T_new else T a + let A' : Half → Set S := fun a => if a = a₀ then A_new else A_far a + let y' : Half → S := fun a => if a = a₀ then y_new else y a + let u' : Half → I := fun a => if a = a₀ then u_new else u₀ a + have hTn_0 : m_of a₀.1 ∈ T_new := IsLineWithEnds.left_mem hTn_line + have hTn_U : T_new ∩ G.U = {m_of a₀.1} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hxT, hxU⟩ + by_contra hne + exact region_subset r₀.2 (hTn_Ω ⟨hxT, hne⟩).1.1 hxU + · rintro rfl + exact ⟨hTn_0, hm_mem_U a₀.1⟩ + have hTn_bd : T_new ∩ bd S = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro x ⟨hxT, hxbd⟩ + by_cases hxm : x = m_of a₀.1 + · exact hm_not_bd a₀.1 (hxm ▸ hxbd) + · exact (hTn_Ω ⟨hxT, hxm⟩).1.2 hxbd + have hTn_D_other : ∀ r : G.R, r ≠ r₀ → Disjoint T_new (discBall h (w_of r) δ) := by + intro r hne + refine disjoint_left.mpr fun x hxT hxD => ?_ + by_cases hxm : x = m_of a₀.1 + · exact region_subset r.2 (hδ_sub r hxD) (hxm ▸ hm_mem_U a₀.1) + · have hx_r₀ : x ∈ r₀.1 := (hTn_Ω ⟨hxT, hxm⟩).1.1 + have hx_r : x ∈ r.1 := hδ_sub r hxD + exact hne (Subtype.ext (region_eq_of_mem r.2 r₀.2 hx_r hx_r₀)) + have hTn_openBall : ∀ r : G.R, Disjoint T_new (discOpenBall h (w_of r) δ) := by + intro r + by_cases hr : r = r₀ + · subst r + refine disjoint_left.mpr fun x hxT hxB => ?_ + have hx_mem : x ∈ T_new ∩ discBall h (w_of r₀) δ := + ⟨hxT, discOpenBall_subset_discBall h (w_of r₀) δ hxB⟩ + rw [hTn_ball, mem_singleton_iff] at hx_mem + subst hx_mem + exact ne_of_lt (show dist _ _ < δ from hxB) hyn_sph.1 + · exact (hTn_D_other r hr).mono_right (discOpenBall_subset_discBall h (w_of r) δ) + have hTn_inter : ∀ b : Half, b ≠ a₀ → + T_new ∩ T b = if a₀.1 = b.1 then {m_of a₀.1} else ∅ := by + intro b hba + have hbE₀ : b ∈ E₀ := Finset.mem_erase.mpr ⟨hba, Finset.mem_univ b⟩ + ext x + simp only [mem_inter_iff] + constructor + · rintro ⟨hxTn, hxTb⟩ + have hxm : x = m_of a₀.1 := by + by_contra hne + exact (hTn_Ω ⟨hxTn, hne⟩).2 (mem_iUnion₂.mpr ⟨b, hbE₀, hxTb⟩) + subst hxm + have hm_in_b : m_of a₀.1 ∈ T b ∩ G.U := ⟨hxTb, hm_mem_U a₀.1⟩ + rw [(hT_all b).2.2.1, mem_singleton_iff] at hm_in_b + have heq := hm_inj hm_in_b + rw [ite_eq_left heq, mem_singleton_iff] + · intro hx + split_ifs at hx with heq + · rw [mem_singleton_iff] at hx + subst hx + have hm_b : m_of b.1 ∈ T b := by + have : m_of b.1 ∈ T b ∩ G.U := by rw [(hT_all b).2.2.1]; rfl + exact this.1 + exact ⟨hTn_0, heq ▸ hm_b⟩ + · exact False.elim hx + refine ⟨T', A', y', u', ?_, ?_, ?_⟩ + · intro a ha + have ha_ne : a ≠ a₀ := fun h => ha (h ▸ Finset.mem_insert_self a₀ F) + have ha_not_F : a ∉ F := fun h => ha (Finset.mem_insert_of_mem h) + dsimp [T'] + rw [ite_eq_right ha_ne, hT_out a ha_not_F] + · intro a ha + rcases Finset.mem_insert.mp ha with rfl | haF + · simp only [T', A', y', u', ↓reduceIte] + exact ⟨hTn_line, hyn_sph, hTn_ball, hun_pos, hAn_cl, hm_not_An, hTn_eq⟩ + · have ha_ne : a ≠ a₀ := fun h => ha₀_not_F (h ▸ haF) + simp only [T', A', y', u', ha_ne, ↓reduceIte] + exact hT_in a haF + · intro a + by_cases ha : a = a₀ + · subst a + have hT'_a₀ : T' a₀ = T_new := by simp [T'] + rw [hT'_a₀] + refine ⟨IsLineWithEnds.isLine hTn_line, + fun z hz => (hTn_Ω hz).1, + hTn_U, + hTn_bd, + fun r hr => hTn_D_other r hr, + fun r => hTn_openBall r, + fun b hba => ?_⟩ + have hT'_b : T' b = T b := by simp [T', hba] + rw [hT'_b] + exact hTn_inter b hba + · have hT'_a : T' a = T a := by simp [T', ha] + rw [hT'_a] + refine ⟨(hT_all a).1, (hT_all a).2.1, (hT_all a).2.2.1, (hT_all a).2.2.2.1, + (hT_all a).2.2.2.2.1, (hT_all a).2.2.2.2.2.1, fun b hba => ?_⟩ + by_cases hb : b = a₀ + · subst b + have hT'_a₀ : T' a₀ = T_new := by simp [T'] + rw [hT'_a₀, inter_comm, hTn_inter a (show a ≠ a₀ from ha)] + by_cases heq : a₀.1 = a.1 + · simp [heq] + · have heq' : a.1 ≠ a₀.1 := Ne.symm heq + simp [heq, heq'] + · have hT'_b : T' b = T b := by simp [T', hb] + rw [hT'_b] + exact (hT_all a).2.2.2.2.2.2 b hba + +private theorem radial_spoke_properties {G : Drawing S} [T2Space S] + {h : S → ℂ} {g : ℂ → S} (hinj : Function.Injective h) + (hg : ContinuousOn g (closedBall 0 1)) + (hmem : ∀ x, h x ∈ closedBall (0 : ℂ) 1) (hgl : ∀ x, g (h x) = x) + (hgr : ∀ z ∈ closedBall (0 : ℂ) 1, h (g z) = z) + (hball_iff : ∀ x, x ∉ bd S ↔ h x ∈ ball (0 : ℂ) 1) + {w_of : G.R → S} {m_of : G.E → S} {W : Set S} {δ : ℝ} (hδ_pos : 0 < δ) + (hδ_sub : ∀ r : G.R, discBall h (w_of r) δ ⊆ r.1) + (hm_mem_U : ∀ e : G.E, m_of e ∈ G.U) (hm_not_W : ∀ e : G.E, m_of e ∉ W) + (hw_W : ∀ r : G.R, w_of r ∈ W) + (hw_of_uniq : ∀ (r : G.R) x, x ∈ r.1 ∧ x ∈ W → x = w_of r) : + let Half := G.E × Bool + ∀ {r_of : Half → G.R} {T : Half → Set S} {y : Half → S} {A_far : Half → Set S} + {u₀ : Half → I} {stub : Half → I → S}, + Function.Injective y → + (∀ a : Half, + IsLineWithEnds (T a) (m_of a.1) (y a) ∧ y a ∈ discSphere h (w_of (r_of a)) δ ∧ + T a ∩ discBall h (w_of (r_of a)) δ = {y a} ∧ (0 : I) < u₀ a ∧ + IsClosed (A_far a) ∧ m_of a.1 ∉ A_far a ∧ T a = stub a '' Icc 0 (u₀ a) ∪ A_far a) → + (∀ a : Half, IsLine (T a) ∧ T a \ {m_of a.1} ⊆ (r_of a).1 \ bd S ∧ + T a ∩ G.U = {m_of a.1} ∧ T a ∩ bd S = ∅ ∧ + (∀ r : G.R, r ≠ r_of a → Disjoint (T a) (discBall h (w_of r) δ)) ∧ + (∀ r : G.R, Disjoint (T a) (discOpenBall h (w_of r) δ)) ∧ + (∀ b : Half, b ≠ a → T a ∩ T b = if a.1 = b.1 then {m_of a.1} else ∅)) → + let R_seg : Half → Set S := fun a => range (radMap h g (w_of (r_of a)) (y a)) + let H : G.E → Bool → Set S := fun e sgn => T (e, sgn) ∪ R_seg (e, sgn) + let w_end : G.E → Bool → S := fun e sgn => w_of (r_of (e, sgn)) + (∀ a : Half, R_seg a ⊆ discBall h (w_of (r_of a)) δ) ∧ + (∀ e sgn, IsLineWithEnds (H e sgn) (m_of e) (w_end e sgn)) ∧ + (∀ e sgn, H e sgn ∩ G.U = {m_of e}) ∧ + (∀ e sgn, H e sgn ∩ bd S ⊆ {w_end e sgn}) ∧ + (∀ e sgn, H e sgn ∩ W = {w_end e sgn}) ∧ + (∀ e : G.E, H e true ∩ H e false ⊆ {m_of e, w_end e true}) ∧ + (∀ e : G.E, w_end e true ≠ w_end e false → H e true ∩ H e false = {m_of e}) ∧ + (∀ e₁ e₂ sgn₁ sgn₂, e₁ ≠ e₂ → H e₁ sgn₁ ∩ H e₂ sgn₂ ⊆ W) := by + classical + intro Half r_of T y A_far u₀ stub hy_inj hT_props hT_all R_seg H w_end + have hy_ne_w : ∀ a : Half, y a ≠ w_of (r_of a) := by + intro a heq + have h1 := (hT_props a).2.1.1 + change dist (h (y a)) (h (w_of (r_of a))) = δ at h1 + rw [heq, dist_self] at h1 + exact hδ_pos.ne h1 + have hR_line : ∀ a : Half, IsLineWithEnds (R_seg a) (y a) (w_of (r_of a)) := + fun a => isLineWithEnds_range_radMap hinj hg hmem hgl hgr (hy_ne_w a) + have hR_sub_D : ∀ a : Half, R_seg a ⊆ discBall h (w_of (r_of a)) δ := + fun a => range_radMap_subset_discBall hmem hgr (hT_props a).2.1 + have hTR_inter : ∀ a : Half, T a ∩ R_seg a = {y a} := by + intro a + refine Subset.antisymm ?_ ?_ + · intro x ⟨hxT, hxR⟩ + have hxD : x ∈ T a ∩ discBall h (w_of (r_of a)) δ := ⟨hxT, hR_sub_D a hxR⟩ + rwa [(hT_props a).2.2.1] at hxD + · rintro x rfl + exact ⟨IsLineWithEnds.right_mem (hT_props a).1, IsLineWithEnds.left_mem (hR_line a)⟩ + have hH_line : ∀ e sgn, IsLineWithEnds (H e sgn) (m_of e) (w_end e sgn) := + fun e sgn => Surface.IsLineWithEnds.union + (hT_props (e, sgn)).1 (hR_line (e, sgn)) (hTR_inter (e, sgn)) + have hH_sub_r : ∀ a : Half, H a.1 a.2 \ {m_of a.1} ⊆ (r_of a).1 := by + rintro a x ⟨hxT | hxR, hne⟩ + · exact ((hT_all a).2.1 ⟨hxT, hne⟩).1 + · exact hδ_sub (r_of a) (hR_sub_D a hxR) + have hH_U : ∀ e sgn, H e sgn ∩ G.U = {m_of e} := by + intro e sgn + ext x + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hxH, hxU⟩ + by_contra hne + exact region_subset (r_of (e, sgn)).2 (hH_sub_r (e, sgn) ⟨hxH, hne⟩) hxU + · rintro rfl + exact ⟨Or.inl (IsLineWithEnds.left_mem (hT_props (e, sgn)).1), hm_mem_U e⟩ + have hH_bd : ∀ e sgn, H e sgn ∩ bd S ⊆ {w_end e sgn} := by + rintro e sgn x ⟨hxT | hxR, hxbd⟩ + · have : x ∈ T (e, sgn) ∩ bd S := ⟨hxT, hxbd⟩ + rw [(hT_all (e, sgn)).2.2.2.1] at this + exact False.elim this + · obtain ⟨t, rfl⟩ := hxR + by_cases ht0 : t = 0 + · subst ht0 + rw [radMap_zero hgl] + rfl + · have ht_pos : (0 : I) < t := unitInterval.pos_iff_ne_zero.mpr ht0 + exact False.elim + (radMap_notMem_bd hmem hgr hball_iff _ (hT_props (e, sgn)).2.1.2 ht_pos hxbd) + have hH_W : ∀ e sgn, H e sgn ∩ W = {w_end e sgn} := by + intro e sgn + ext x + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hxH, hxW⟩ + have hne : x ≠ m_of e := fun h => hm_not_W e (h ▸ hxW) + have hxr : x ∈ (r_of (e, sgn)).1 := hH_sub_r (e, sgn) ⟨hxH, hne⟩ + exact hw_of_uniq (r_of (e, sgn)) x ⟨hxr, hxW⟩ + · rintro rfl + exact ⟨Or.inr (IsLineWithEnds.right_mem (hR_line (e, sgn))), hw_W (r_of (e, sgn))⟩ + have hTR_disj_other : ∀ a b : Half, a ≠ b → Disjoint (T a) (R_seg b) := by + intro a b hne + by_cases hr : r_of a = r_of b + · refine disjoint_left.mpr fun x hxT hxR => ?_ + have hxD : x ∈ T a ∩ discBall h (w_of (r_of a)) δ := + ⟨hxT, hr ▸ hR_sub_D b hxR⟩ + rw [(hT_props a).2.2.1, mem_singleton_iff] at hxD + subst hxD + have hy_in : y a ∈ R_seg b ∩ discSphere h (w_of (r_of b)) δ := + ⟨hxR, hr ▸ (hT_props a).2.1⟩ + rw [range_radMap_inter_discSphere hmem hgl hgr hδ_pos (hT_props b).2.1, + mem_singleton_iff] at hy_in + exact hne (hy_inj hy_in) + · exact ((hT_all a).2.2.2.2.1 (r_of b) (Ne.symm hr)).mono_right (hR_sub_D b) + have hRR_inter_other : ∀ a b : Half, a ≠ b → + R_seg a ∩ R_seg b = if r_of a = r_of b then {w_of (r_of a)} else ∅ := by + intro a b hne + by_cases hr : r_of a = r_of b + · rw [ite_eq_left hr] + dsimp [R_seg] + have hyb : dist (h (y b)) (h (w_of (r_of a))) = δ := hr ▸ (hT_props b).2.1.1 + rw [← hr] + exact range_radMap_inter_eq_singleton hinj hmem hgl hgr hδ_pos + (hT_props a).2.1.1 hyb (hy_inj.ne hne) + · rw [ite_eq_right hr, eq_empty_iff_forall_notMem] + rintro x ⟨hxa, hxb⟩ + have hx_ra : x ∈ (r_of a).1 := hδ_sub (r_of a) (hR_sub_D a hxa) + have hx_rb : x ∈ (r_of b).1 := hδ_sub (r_of b) (hR_sub_D b hxb) + exact hr (Subtype.ext (region_eq_of_mem (r_of a).2 (r_of b).2 hx_ra hx_rb)) + have hne_ft : ∀ e : G.E, (e, false) ≠ (e, true) := + fun _ h => Bool.false_ne_true (congrArg Prod.snd h) + have hne_tf : ∀ e : G.E, (e, true) ≠ (e, false) := + fun _ h => Bool.false_ne_true (congrArg Prod.snd h).symm + have hH_opp : ∀ e : G.E, H e true ∩ H e false ⊆ {m_of e, w_end e true} := by + rintro e x ⟨hx1 | hx1, hx2 | hx2⟩ + · have hinter : x ∈ T (e, true) ∩ T (e, false) := ⟨hx1, hx2⟩ + rw [(hT_all (e, true)).2.2.2.2.2.2 (e, false) (hne_ft e)] at hinter + simp only [↓reduceIte, mem_singleton_iff] at hinter + exact Or.inl hinter + · exact False.elim (disjoint_left.mp (hTR_disj_other (e, true) (e, false) (hne_tf e)) hx1 hx2) + · exact False.elim (disjoint_left.mp (hTR_disj_other (e, false) (e, true) (hne_ft e)) hx2 hx1) + · have hinter : x ∈ R_seg (e, true) ∩ R_seg (e, false) := ⟨hx1, hx2⟩ + rw [hRR_inter_other (e, true) (e, false) (hne_tf e)] at hinter + split_ifs at hinter with hr + · exact Or.inr hinter + · exact False.elim hinter + have hH_opp_ne : ∀ e : G.E, w_end e true ≠ w_end e false → H e true ∩ H e false = {m_of e} := by + intro e hne + have hr : r_of (e, true) ≠ r_of (e, false) := fun h => hne (congrArg w_of h) + ext x + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hx1 | hx1, hx2 | hx2⟩ + · have hinter : x ∈ T (e, true) ∩ T (e, false) := ⟨hx1, hx2⟩ + rw [(hT_all (e, true)).2.2.2.2.2.2 (e, false) (hne_ft e)] at hinter + simpa using hinter + · exact False.elim (disjoint_left.mp (hTR_disj_other (e, true) (e, false) (hne_tf e)) hx1 hx2) + · exact False.elim (disjoint_left.mp (hTR_disj_other (e, false) (e, true) (hne_ft e)) hx2 hx1) + · have hinter : x ∈ R_seg (e, true) ∩ R_seg (e, false) := ⟨hx1, hx2⟩ + rw [hRR_inter_other (e, true) (e, false) (hne_tf e), ite_eq_right hr] at hinter + exact False.elim hinter + · rintro rfl + exact ⟨Or.inl (IsLineWithEnds.left_mem (hT_props (e, true)).1), + Or.inl (IsLineWithEnds.left_mem (hT_props (e, false)).1)⟩ + have hH_disj : ∀ e₁ e₂ sgn₁ sgn₂, e₁ ≠ e₂ → H e₁ sgn₁ ∩ H e₂ sgn₂ ⊆ W := by + rintro e₁ e₂ sgn₁ sgn₂ hne x ⟨hx1 | hx1, hx2 | hx2⟩ + · have hinter : x ∈ T (e₁, sgn₁) ∩ T (e₂, sgn₂) := ⟨hx1, hx2⟩ + have hne_pair : (e₂, sgn₂) ≠ (e₁, sgn₁) := fun h => hne (congrArg Prod.fst h).symm + rw [(hT_all (e₁, sgn₁)).2.2.2.2.2.2 (e₂, sgn₂) hne_pair, + ite_eq_right hne] at hinter + exact False.elim hinter + · have hne_pair : (e₁, sgn₁) ≠ (e₂, sgn₂) := fun h => hne (congrArg Prod.fst h) + exact False.elim + (disjoint_left.mp (hTR_disj_other (e₁, sgn₁) (e₂, sgn₂) hne_pair) hx1 hx2) + · have hne_pair : (e₂, sgn₂) ≠ (e₁, sgn₁) := fun h => hne (congrArg Prod.fst h).symm + exact False.elim + (disjoint_left.mp (hTR_disj_other (e₂, sgn₂) (e₁, sgn₁) hne_pair) hx2 hx1) + · have hinter : x ∈ R_seg (e₁, sgn₁) ∩ R_seg (e₂, sgn₂) := ⟨hx1, hx2⟩ + have hne_pair : (e₁, sgn₁) ≠ (e₂, sgn₂) := fun h => hne (congrArg Prod.fst h) + rw [hRR_inter_other (e₁, sgn₁) (e₂, sgn₂) hne_pair] at hinter + split_ifs at hinter with hr + · rw [mem_singleton_iff] at hinter + exact hinter ▸ hw_W (r_of (e₁, sgn₁)) + · exact False.elim hinter + exact ⟨hR_sub_D, hH_line, hH_U, hH_bd, hH_W, hH_opp, hH_opp_ne, hH_disj⟩ + +private theorem dual_region_meets_primal_edge (hS : IsClosedDiscSpace S) + {G G_dual : Drawing S} (hGd_prop : G_dual.IsProper) (edgeEquiv : G.E ≃ G_dual.E) + {h : S → ℂ} {δ : ℝ} {W : Set S} (hW_fin : W.Finite) + {w_of : G.R → S} {m_of : G.E → S} (hm_mem_U : ∀ e : G.E, m_of e ∈ G.U) + (hm_not_W : ∀ e : G.E, m_of e ∉ W) (hm_inj : Function.Injective m_of) + (hedge_inter_e : ∀ e : G.E, (edgeEquiv e).1 ∩ e.1 = {m_of e}) + {φ_e : G.E → ℂ → S} (hφc : ∀ e : G.E, ContinuousOn (φ_e e) (closedBall 0 1)) + (hφi : ∀ e : G.E, InjOn (φ_e e) (closedBall 0 1)) + (hφ0 : ∀ e : G.E, φ_e e 0 = m_of e) + (hφ_real_sub : ∀ e : G.E, φ_e e '' {z | z ∈ ball (0 : ℂ) 1 ∧ z.im = 0} ⊆ e.1) : + let Half := G.E × Bool + ∀ {r_of : Half → G.R} {T R_seg A_far : Half → Set S} {u₀ : Half → I} {y : Half → S}, + let D_union : Set S := ⋃ r : G.R, discBall h (w_of r) δ + let H : G.E → Bool → Set S := fun e sgn => T (e, sgn) ∪ R_seg (e, sgn) + let stub : Half → I → S := fun a t => φ_e a.1 (zStub a.2 t) + IsClosed D_union → Disjoint D_union G.U → + (∀ (a : Half), IsLineWithEnds (T a) (m_of a.1) (y a) ∧ + y a ∈ discSphere h (w_of (r_of a)) δ ∧ + T a ∩ discBall h (w_of (r_of a)) δ = {y a} ∧ + (0 : I) < u₀ a ∧ IsClosed (A_far a) ∧ m_of a.1 ∉ A_far a ∧ + T a = stub a '' Icc 0 (u₀ a) ∪ A_far a) → + (∀ a : Half, R_seg a ⊆ discBall h (w_of (r_of a)) δ) → + (∀ e sgn, IsLineWithEnds (H e sgn) (m_of e) (w_of (r_of (e, sgn)))) → + (∀ e : G.E, (H e true ∪ H e false) ∩ G.U = {m_of e}) → + G_dual.U = W ∪ ⋃ e : G.E, (H e true ∪ H e false) → + ∀ e : G.E, ∀ r' ∈ G_dual.R, + G_dual.EdgeRegionIncident (edgeEquiv e).1 r' → (r' ∩ e.1).Nonempty := by + classical + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : Finite G.E := G.finite_edges.to_subtype + intro Half r_of T R_seg A_far u₀ y D_union H stub hD_union_cl hD_union_disj_U hT_props + hR_sub_D hH_line hK_U hGd_U + let _ : Fintype G.E := Fintype.ofFinite G.E + intro e r' hr' hinc + have he'_sub : (edgeEquiv e).1 ⊆ closure r' := + disc_edge_subset_closure_of_incident hS hGd_prop (edgeEquiv e).2 hr' hinc.2.2 + have hm_in_e' : m_of e ∈ (edgeEquiv e).1 := by + have : m_of e ∈ (edgeEquiv e).1 ∩ e.1 := by rw [hedge_inter_e e]; rfl + exact this.1 + have hm_cl : m_of e ∈ closure r' := he'_sub hm_in_e' + let B_bad : Set S := + A_far (e, true) ∪ A_far (e, false) ∪ D_union ∪ W ∪ + ⋃ e' ∈ Finset.univ.erase e, (H e' true ∪ H e' false) + have hB_bad_cl : IsClosed B_bad := by + refine (((( (hT_props (e, true)).2.2.2.2.1.union (hT_props (e, false)).2.2.2.2.1 ).union + hD_union_cl).union hW_fin.isClosed).union ?_) + exact (Finset.univ.erase e).finite_toSet.isClosed_biUnion fun e' _ => + (isClosed_of_isLine (IsLineWithEnds.isLine (hH_line e' true))).union + (isClosed_of_isLine (IsLineWithEnds.isLine (hH_line e' false))) + have hm_not_bad : m_of e ∉ B_bad := by + rintro ((((hmA1 | hmA2) | hmD) | hmW) | hm_other) + · exact (hT_props (e, true)).2.2.2.2.2.1 hmA1 + · exact (hT_props (e, false)).2.2.2.2.2.1 hmA2 + · exact disjoint_left.mp hD_union_disj_U hmD (hm_mem_U e) + · exact hm_not_W e hmW + · obtain ⟨e', he', hmK'⟩ := mem_iUnion₂.mp hm_other + have hne : e' ≠ e := (Finset.mem_erase.mp he').1 + have : m_of e ∈ (H e' true ∪ H e' false) ∩ G.U := ⟨hmK', hm_mem_U e⟩ + rw [hK_U e', mem_singleton_iff] at this + exact hne (hm_inj this).symm + let ρ : ℝ := min ((u₀ (e, true) : ℝ) / 2) ((u₀ (e, false) : ℝ) / 2) + have hρ_pos : 0 < ρ := by + have h1 : (0 : ℝ) < u₀ (e, true) := (hT_props (e, true)).2.2.2.1 + have h2 : (0 : ℝ) < u₀ (e, false) := (hT_props (e, false)).2.2.2.1 + exact lt_min (half_pos h1) (half_pos h2) + have hρ_le_one : ρ ≤ 1 := by + have h1 : (u₀ (e, true) : ℝ) ≤ 1 := (u₀ (e, true)).2.2 + exact le_trans (min_le_left _ _) (by linarith) + -- Choose `ε_e > 0` (`ε_e ≤ ρ`) so that `φ_e e '' ball (0 : ℂ) ε_e ⊆ B_badᶜ`. + have hpre_open : IsOpen (ball (0 : ℂ) 1 ∩ φ_e e ⁻¹' B_badᶜ) := + ((hφc e).mono ball_subset_closedBall).isOpen_inter_preimage isOpen_ball hB_bad_cl.isOpen_compl + have h0_pre : (0 : ℂ) ∈ ball (0 : ℂ) 1 ∩ φ_e e ⁻¹' B_badᶜ := + ⟨mem_ball_self zero_lt_one, by change φ_e e 0 ∉ B_bad; rwa [hφ0 e]⟩ + obtain ⟨δ_e, hδ_e_pos, hδ_e_ball⟩ := Metric.isOpen_iff.mp hpre_open 0 h0_pre + let ε_e : ℝ := min ρ (δ_e / 2) + have hε_pos : 0 < ε_e := lt_min hρ_pos (half_pos hδ_e_pos) + have hε_le_ρ : ε_e ≤ ρ := min_le_left _ _ + have hε_le_one : ε_e ≤ 1 := le_trans hε_le_ρ hρ_le_one + have hε_not_bad : ∀ w ∈ ball (0 : ℂ) ε_e, φ_e e w ∉ B_bad := by + intro w hw + have hw_δ : w ∈ ball (0 : ℂ) δ_e := + ball_subset_ball (le_trans (min_le_right _ _) (half_lt_self hδ_e_pos).le) hw + exact (hδ_e_ball hw_δ).2 + have hGdU_iff_re_zero : ∀ w ∈ ball (0 : ℂ) ε_e, φ_e e w ∈ G_dual.U ↔ w.re = 0 := by + intro w hw_ball + have hw_cl1 : w ∈ closedBall (0 : ℂ) 1 := + ball_subset_closedBall (ball_subset_ball hε_le_one hw_ball) + have hw_not_bad : φ_e e w ∉ B_bad := hε_not_bad w hw_ball + constructor + · intro hw_GdU + rw [hGd_U] at hw_GdU + rcases hw_GdU with hwW | ⟨_, ⟨e', rfl⟩, hwK⟩ + · exact False.elim (hw_not_bad (Or.inl (Or.inr hwW))) + · by_cases he' : e' = e + · subst e' + rcases hwK with (hwT | hwR) | (hwT | hwR) + · rw [(hT_props (e, true)).2.2.2.2.2.2] at hwT + rcases hwT with ⟨t, _, htw⟩ | hwA + · have hzw := hφi e (zStub_mem_closedBall_one true t) hw_cl1 htw + rw [← hzw, zStub_re] + · exact False.elim (hw_not_bad (Or.inl (Or.inl (Or.inl (Or.inl hwA))))) + · exact False.elim (hw_not_bad (Or.inl (Or.inl (Or.inr + ⟨_, ⟨r_of (e, true), rfl⟩, hR_sub_D (e, true) hwR⟩)))) + · rw [(hT_props (e, false)).2.2.2.2.2.2] at hwT + rcases hwT with ⟨t, _, htw⟩ | hwA + · have hzw := hφi e (zStub_mem_closedBall_one false t) hw_cl1 htw + rw [← hzw, zStub_re] + · exact False.elim (hw_not_bad (Or.inl (Or.inl (Or.inl (Or.inr hwA))))) + · exact False.elim (hw_not_bad (Or.inl (Or.inl (Or.inr + ⟨_, ⟨r_of (e, false), rfl⟩, hR_sub_D (e, false) hwR⟩)))) + · exact False.elim (hw_not_bad (Or.inr (mem_iUnion₂.mpr + ⟨e', Finset.mem_erase.mpr ⟨he', Finset.mem_univ e'⟩, hwK⟩))) + · intro hw_re + have hw_norm : ‖w‖ < ε_e := mem_ball_zero_iff.mp hw_ball + have him_abs : |w.im| < ε_e := (abs_im_le_norm w).trans_lt hw_norm + rw [hGd_U] + right + refine ⟨_, ⟨e, rfl⟩, ?_⟩ + rcases le_or_gt 0 w.im with him_nonneg | him_neg + · left + left + rw [(hT_props (e, true)).2.2.2.2.2.2] + left + have ht_le_u : 2 * w.im ≤ (u₀ (e, true) : ℝ) := by + have h1 : w.im < (u₀ (e, true) : ℝ) / 2 := + lt_of_lt_of_le (by rwa [abs_of_nonneg him_nonneg] at him_abs) + (le_trans hε_le_ρ (min_le_left _ _)) + linarith + let t : I := ⟨2 * w.im, by linarith, le_trans ht_le_u (u₀ (e, true)).2.2⟩ + refine ⟨t, ⟨unitInterval.nonneg t, ht_le_u⟩, ?_⟩ + dsimp [stub] + congr 1 + apply Complex.ext + · rw [zStub_re, hw_re] + · simp [zStub_im, t] + · right + left + rw [(hT_props (e, false)).2.2.2.2.2.2] + left + have ht_le_u : -2 * w.im ≤ (u₀ (e, false) : ℝ) := by + have h1 : -w.im < (u₀ (e, false) : ℝ) / 2 := + lt_of_lt_of_le (by rwa [abs_of_neg him_neg] at him_abs) + (le_trans hε_le_ρ (min_le_right _ _)) + linarith + let t : I := ⟨-2 * w.im, by linarith, le_trans ht_le_u (u₀ (e, false)).2.2⟩ + refine ⟨t, ⟨unitInterval.nonneg t, ht_le_u⟩, ?_⟩ + dsimp [stub] + congr 1 + apply Complex.ext + · rw [zStub_re, hw_re] + · simp [zStub_im, t] + have hO_ball_open : IsOpen (φ_e e '' ball (0 : ℂ) ε_e) := + isOpen_image_ball_of_disc hS (hφc e) (hφi e) hε_le_one + obtain ⟨x, ⟨z, hz_ball, rfl⟩, hxr'⟩ := + _root_.mem_closure_iff.mp hm_cl (φ_e e '' ball (0 : ℂ) ε_e) hO_ball_open + ⟨0, mem_ball_self hε_pos, hφ0 e⟩ + have hx_not_GdU : φ_e e z ∉ G_dual.U := region_subset hr' hxr' + have hz_re_ne : z.re ≠ 0 := fun h => hx_not_GdU ((hGdU_iff_re_zero z hz_ball).mpr h) + let q_real : ℝ := if 0 < z.re then ε_e / 2 else -ε_e / 2 + let q : ℂ := (q_real : ℂ) + have hq_ball : q ∈ ball (0 : ℂ) ε_e := by + rw [mem_ball_zero_iff, norm_real, Real.norm_eq_abs] + dsimp [q_real] + split_ifs + · rw [abs_of_pos (half_pos hε_pos)] + linarith + · have hneg_div : -ε_e / 2 = -(ε_e / 2) := neg_div _ _ + rw [hneg_div, abs_neg, abs_of_pos (half_pos hε_pos)] + linarith + have hq_ball1 : q ∈ ball (0 : ℂ) 1 := ball_subset_ball hε_le_one hq_ball + have hq_im : q.im = 0 := ofReal_im q_real + have hq_mem_e : φ_e e q ∈ e.1 := hφ_real_sub e ⟨q, ⟨hq_ball1, hq_im⟩, rfl⟩ + let seg : I → S := fun t => φ_e e ((1 - (t : ℝ)) • z + (t : ℝ) • q) + have hseg_ball : ∀ t : I, (1 - (t : ℝ)) • z + (t : ℝ) • q ∈ ball (0 : ℂ) ε_e := + fun t => convex_ball (0 : ℂ) ε_e hz_ball hq_ball + (sub_nonneg.mpr t.2.2) t.2.1 (sub_add_cancel 1 (t : ℝ)) + have hseg_cl1 : ∀ t : I, (1 - (t : ℝ)) • z + (t : ℝ) • q ∈ closedBall (0 : ℂ) 1 := + fun t => ball_subset_closedBall (ball_subset_ball hε_le_one (hseg_ball t)) + have hseg_cont : Continuous seg := (hφc e).comp_continuous (by fun_prop) hseg_cl1 + have hseg_disj : Disjoint (range seg) G_dual.U := by + refine disjoint_left.mpr ?_ + rintro _ ⟨t, rfl⟩ hU + have hre0 : ((1 - (t : ℝ)) • z + (t : ℝ) • q).re = 0 := + (hGdU_iff_re_zero _ (hseg_ball t)).mp hU + simp only [add_re, real_smul, mul_re, ofReal_re, ofReal_im, zero_mul, sub_zero, q] at hre0 + have ht0 := t.2.1 + have ht1 : 0 ≤ 1 - (t : ℝ) := sub_nonneg.mpr t.2.2 + rcases lt_or_gt_of_ne hz_re_ne with hneg | hpos + · have hq_neg : q_real = -ε_e / 2 := ite_eq_right (not_lt.mpr hneg.le) + rw [hq_neg] at hre0 + have h1 : (1 - (t : ℝ)) * z.re ≤ 0 := mul_nonpos_of_nonneg_of_nonpos ht1 hneg.le + have h2 : (t : ℝ) * (-ε_e / 2) ≤ 0 := mul_nonpos_of_nonneg_of_nonpos ht0 (by linarith) + have h3 : (t : ℝ) * (-ε_e / 2) = 0 := by linarith + have ht_zero : (t : ℝ) = 0 := (mul_eq_zero.mp h3).resolve_right (by linarith) + rw [ht_zero] at hre0 + linarith + · have hq_pos : q_real = ε_e / 2 := ite_eq_left hpos + rw [hq_pos] at hre0 + have h1 : 0 ≤ (1 - (t : ℝ)) * z.re := mul_nonneg ht1 hpos.le + have h2 : 0 ≤ (t : ℝ) * (ε_e / 2) := mul_nonneg ht0 (by linarith) + have h3 : (t : ℝ) * (ε_e / 2) = 0 := by linarith + have ht_zero : (t : ℝ) = 0 := (mul_eq_zero.mp h3).resolve_right (by linarith) + rw [ht_zero] at hre0 + linarith + have hseg_sub : range seg ⊆ r' := + subset_region hr' (isPreconnected_range hseg_cont) hseg_disj ⟨0, by simp [seg]⟩ hxr' + exact ⟨φ_e e q, hseg_sub ⟨1, by simp [seg]⟩, hq_mem_e⟩ + +private theorem incident_regions_of_edge_charts (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) + {m_of : G.E → S} (hm_mem_e : ∀ e : G.E, m_of e ∈ e.1) + {φ_e : G.E → ℂ → S} (hφc : ∀ e : G.E, ContinuousOn (φ_e e) (closedBall 0 1)) + (hφi : ∀ e : G.E, InjOn (φ_e e) (closedBall 0 1)) + (hφ0 : ∀ e : G.E, φ_e e 0 = m_of e) + (hφU : ∀ e : G.E, ∀ z ∈ closedBall (0 : ℂ) 1, φ_e e z ∈ G.U ↔ z.im = 0) : + let Half := G.E × Bool + let stub : Half → I → S := fun a t => φ_e a.1 (zStub a.2 t) + ∀ {r_of : Half → G.R}, + (∀ a : Half, IsArcMap (stub a)) → (∀ a : Half, stub a 0 = m_of a.1) → + (∀ a : Half, ∀ t : I, (0 : I) < t → stub a t ∈ (r_of a).1 \ bd S) → + (∀ a : Half, G.EdgeRegionIncident a.1.1 (r_of a).1) ∧ + ∀ (e : G.E) (r : Set S), r ∈ G.R → + G.EdgeRegionIncident e.1 r → r = (r_of (e, true)).1 ∨ r = (r_of (e, false)).1 := by + intro Half stub r_of hstub_arc hstub_0 hr_of + have hm_cl_r : ∀ a : Half, m_of a.1 ∈ closure (r_of a).1 := by + intro a + have h0_mem : stub a 0 ∈ stub a '' closure (Ioc (0 : I) 1) := + ⟨0, by rw [closure_Ioc zero_ne_one]; exact ⟨le_rfl, zero_le_one⟩, rfl⟩ + have hsub_r : stub a '' Ioc (0 : I) 1 ⊆ (r_of a).1 := by + rintro _ ⟨t, ht, rfl⟩ + exact (hr_of a t ht.1).1 + rw [← hstub_0 a] + exact closure_mono hsub_r (image_closure_subset_closure_image (hstub_arc a).1 h0_mem) + have hinc_r_of : ∀ a : Half, G.EdgeRegionIncident a.1.1 (r_of a).1 := + fun a => ⟨a.1.2, (r_of a).2, m_of a.1, hm_mem_e a.1, hm_cl_r a⟩ + have hall_inc_r : ∀ (e : G.E) (r : Set S), r ∈ G.R → + G.EdgeRegionIncident e.1 r → r = (r_of (e, true)).1 ∨ r = (r_of (e, false)).1 := by + intro e r hr hinc + have he_sub : e.1 ⊆ closure r := + disc_edge_subset_closure_of_incident hS hProper e.2 hr hinc.2.2 + have hm_cl : m_of e ∈ closure r := he_sub (hm_mem_e e) + have hO_open1 : IsOpen (φ_e e '' ball (0 : ℂ) 1) := + isOpen_image_ball_of_disc hS (hφc e) (hφi e) le_rfl + obtain ⟨x, ⟨z, hz_ball, rfl⟩, hxr⟩ := + _root_.mem_closure_iff.mp hm_cl (φ_e e '' ball (0 : ℂ) 1) hO_open1 + ⟨0, mem_ball_self zero_lt_one, hφ0 e⟩ + have hz_cl1 : z ∈ closedBall (0 : ℂ) 1 := ball_subset_closedBall hz_ball + have hx_not_U : φ_e e z ∉ G.U := region_subset hr hxr + have hz_im_ne : z.im ≠ 0 := fun h => hx_not_U ((hφU e z hz_cl1).mpr h) + let sgn : Bool := decide (0 < z.im) + let p : ℂ := zStub sgn 1 + have hp_ball : p ∈ ball (0 : ℂ) 1 := zStub_mem_ball_one sgn 1 + let seg_r : I → S := fun t => φ_e e ((1 - (t : ℝ)) • z + (t : ℝ) • p) + have hseg_r_ball : ∀ t : I, (1 - (t : ℝ)) • z + (t : ℝ) • p ∈ ball (0 : ℂ) 1 := + fun t => convex_ball (0 : ℂ) 1 hz_ball hp_ball + (sub_nonneg.mpr t.2.2) t.2.1 (sub_add_cancel 1 (t : ℝ)) + have hseg_r_cl1 : ∀ t : I, (1 - (t : ℝ)) • z + (t : ℝ) • p ∈ closedBall (0 : ℂ) 1 := + fun t => ball_subset_closedBall (hseg_r_ball t) + have hseg_r_cont : Continuous seg_r := (hφc e).comp_continuous (by fun_prop) hseg_r_cl1 + have hseg_r_disj : Disjoint (range seg_r) G.U := by + refine disjoint_left.mpr ?_ + rintro _ ⟨t, rfl⟩ hU + have him0 : ((1 - (t : ℝ)) • z + (t : ℝ) • p).im = 0 := + (hφU e _ (hseg_r_cl1 t)).mp hU + simp only [add_im, real_smul, mul_im, ofReal_re, ofReal_im, zero_mul, add_zero] at him0 + have ht0 := t.2.1 + have ht1 : 0 ≤ 1 - (t : ℝ) := sub_nonneg.mpr t.2.2 + rcases lt_or_gt_of_ne hz_im_ne with hneg | hpos + · have hsgn_f : sgn = false := decide_eq_false (not_lt.mpr hneg.le) + have hp_im : p.im = -1 / 2 := by + dsimp [p] + rw [zStub_im, hsgn_f] + simp + rw [hp_im] at him0 + have h1 : (1 - (t : ℝ)) * z.im ≤ 0 := mul_nonpos_of_nonneg_of_nonpos ht1 hneg.le + have h2 : (t : ℝ) * (-1 / 2) ≤ 0 := mul_nonpos_of_nonneg_of_nonpos ht0 (by norm_num) + have h3 : (t : ℝ) * (-1 / 2) = 0 := by linarith + have ht_zero : (t : ℝ) = 0 := (mul_eq_zero.mp h3).resolve_right (by norm_num) + rw [ht_zero] at him0 + linarith + · have hsgn_t : sgn = true := decide_eq_true hpos + have hp_im : p.im = 1 / 2 := by + dsimp [p] + rw [zStub_im, hsgn_t] + simp + rw [hp_im] at him0 + have h1 : 0 ≤ (1 - (t : ℝ)) * z.im := mul_nonneg ht1 hpos.le + have h2 : 0 ≤ (t : ℝ) * (1 / 2) := mul_nonneg ht0 (by norm_num) + have h3 : (t : ℝ) * (1 / 2) = 0 := by linarith + have ht_zero : (t : ℝ) = 0 := (mul_eq_zero.mp h3).resolve_right (by norm_num) + rw [ht_zero] at him0 + linarith + have hseg_r_sub : range seg_r ⊆ r := + subset_region hr (isPreconnected_range hseg_r_cont) hseg_r_disj ⟨0, by simp [seg_r]⟩ hxr + have h1_in_r : stub (e, sgn) 1 ∈ r := hseg_r_sub ⟨1, by simp [seg_r, stub, p]⟩ + have h1_in_rof : stub (e, sgn) 1 ∈ (r_of (e, sgn)).1 := (hr_of (e, sgn) 1 zero_lt_one).1 + have hr_eq : r = (r_of (e, sgn)).1 := region_eq_of_mem hr (r_of (e, sgn)).2 h1_in_r h1_in_rof + rcases Bool.dichotomy sgn with hsgn | hsgn + · rw [hsgn] at hr_eq + exact Or.inr hr_eq + · rw [hsgn] at hr_eq + exact Or.inl hr_eq + exact ⟨hinc_r_of, hall_inc_r⟩ + +private theorem dual_edge_link_iff_of_incident_regions {G G_dual : Drawing S} + (edgeEquiv : G.E ≃ G_dual.E) {W : Set S} (hGd_V : G_dual.V = W) + {w_of : G.R → S} (hw_in : ∀ r : G.R, w_of r ∈ r.1) + (hw_of_uniq : ∀ (r : G.R) x, x ∈ r.1 ∧ x ∈ W → x = w_of r) + {r_of : G.E × Bool → G.R} + (hinc_r_of : ∀ a : G.E × Bool, G.EdgeRegionIncident a.1.1 (r_of a).1) + (hall_inc_r : ∀ (e : G.E) (r : Set S), r ∈ G.R → + G.EdgeRegionIncident e.1 r → r = (r_of (e, true)).1 ∨ r = (r_of (e, false)).1) + (hedge_link : ∀ e : G.E, G_dual.toGraph.IsLink (edgeEquiv e).1 + (w_of (r_of (e, true))) (w_of (r_of (e, false)))) : + ∀ (e : G.E) (r₁ : Set S), r₁ ∈ G.R → ∀ (r₂ : Set S), r₂ ∈ G.R → + ∀ w₁ ∈ r₁ ∩ G_dual.V, ∀ w₂ ∈ r₂ ∩ G_dual.V, + G_dual.toGraph.IsLink (edgeEquiv e).1 w₁ w₂ ↔ + G.EdgeRegionIncident e.1 r₁ ∧ G.EdgeRegionIncident e.1 r₂ ∧ + ∀ r ∈ G.R, G.EdgeRegionIncident e.1 r → r = r₁ ∨ r = r₂ := by + have hw_of_inj : Function.Injective w_of := by + intro r₁ r₂ heq + have hwr₁ : w_of r₁ ∈ r₁.1 := hw_in r₁ + have hwr₂ : w_of r₁ ∈ r₂.1 := heq ▸ hw_in r₂ + exact Subtype.ext (region_eq_of_mem r₁.2 r₂.2 hwr₁ hwr₂) + intro e r₁ hr₁ r₂ hr₂ w₁ hw₁ w₂ hw₂ + have hw₁_eq : w₁ = w_of ⟨r₁, hr₁⟩ := + hw_of_uniq ⟨r₁, hr₁⟩ w₁ ⟨hw₁.1, hGd_V ▸ hw₁.2⟩ + have hw₂_eq : w₂ = w_of ⟨r₂, hr₂⟩ := + hw_of_uniq ⟨r₂, hr₂⟩ w₂ ⟨hw₂.1, hGd_V ▸ hw₂.2⟩ + have hlink_e := hedge_link e + let rt := r_of (e, true) + let rf := r_of (e, false) + constructor + · intro hlink' + have hpair : ({w₁, w₂} : Set S) = {w_of rt, w_of rf} := + hlink'.2.2.2.symm.trans hlink_e.2.2.2 + have hw₁_mem : w₁ = w_of rt ∨ w₁ = w_of rf := by + have : w₁ ∈ ({w₁, w₂} : Set S) := mem_insert w₁ {w₂} + rwa [hpair, mem_insert_iff, mem_singleton_iff] at this + have hw₂_mem : w₂ = w_of rt ∨ w₂ = w_of rf := by + have : w₂ ∈ ({w₁, w₂} : Set S) := mem_insert_of_mem w₁ (mem_singleton w₂) + rwa [hpair, mem_insert_iff, mem_singleton_iff] at this + have hrt_mem : w_of rt = w₁ ∨ w_of rt = w₂ := by + have : w_of rt ∈ ({w_of rt, w_of rf} : Set S) := mem_insert (w_of rt) {w_of rf} + rwa [← hpair, mem_insert_iff, mem_singleton_iff] at this + have hrf_mem : w_of rf = w₁ ∨ w_of rf = w₂ := by + have : w_of rf ∈ ({w_of rt, w_of rf} : Set S) := + mem_insert_of_mem (w_of rt) (mem_singleton (w_of rf)) + rwa [← hpair, mem_insert_iff, mem_singleton_iff] at this + have hr₁_mem : r₁ = rt.1 ∨ r₁ = rf.1 := by + rcases hw₁_mem with h1 | h1 + · exact Or.inl (congrArg Subtype.val (hw_of_inj (hw₁_eq.symm.trans h1))) + · exact Or.inr (congrArg Subtype.val (hw_of_inj (hw₁_eq.symm.trans h1))) + have hr₂_mem : r₂ = rt.1 ∨ r₂ = rf.1 := by + rcases hw₂_mem with h2 | h2 + · exact Or.inl (congrArg Subtype.val (hw_of_inj (hw₂_eq.symm.trans h2))) + · exact Or.inr (congrArg Subtype.val (hw_of_inj (hw₂_eq.symm.trans h2))) + have hrt_12 : rt.1 = r₁ ∨ rt.1 = r₂ := by + rcases hrt_mem with ht | ht + · exact Or.inl (congrArg Subtype.val (hw_of_inj (ht.trans hw₁_eq))) + · exact Or.inr (congrArg Subtype.val (hw_of_inj (ht.trans hw₂_eq))) + have hrf_12 : rf.1 = r₁ ∨ rf.1 = r₂ := by + rcases hrf_mem with hf | hf + · exact Or.inl (congrArg Subtype.val (hw_of_inj (hf.trans hw₁_eq))) + · exact Or.inr (congrArg Subtype.val (hw_of_inj (hf.trans hw₂_eq))) + refine ⟨?_, ?_, fun r hr hinc => ?_⟩ + · rcases hr₁_mem with rfl | rfl + · exact hinc_r_of (e, true) + · exact hinc_r_of (e, false) + · rcases hr₂_mem with rfl | rfl + · exact hinc_r_of (e, true) + · exact hinc_r_of (e, false) + · rcases hall_inc_r e r hr hinc with rfl | rfl + · exact hrt_12 + · exact hrf_12 + · rintro ⟨hinc1, hinc2, hall⟩ + have hw₁_tf : w₁ = w_of rt ∨ w₁ = w_of rf := by + rcases hall_inc_r e r₁ hr₁ hinc1 with heq | heq + · exact Or.inl (hw₁_eq.trans (congrArg w_of (Subtype.ext heq))) + · exact Or.inr (hw₁_eq.trans (congrArg w_of (Subtype.ext heq))) + have hw₂_tf : w₂ = w_of rt ∨ w₂ = w_of rf := by + rcases hall_inc_r e r₂ hr₂ hinc2 with heq | heq + · exact Or.inl (hw₂_eq.trans (congrArg w_of (Subtype.ext heq))) + · exact Or.inr (hw₂_eq.trans (congrArg w_of (Subtype.ext heq))) + have hrt_12 : w_of rt = w₁ ∨ w_of rt = w₂ := by + rcases hall rt.1 rt.2 (hinc_r_of (e, true)) with heq | heq + · exact Or.inl ((congrArg w_of (Subtype.ext heq)).trans hw₁_eq.symm) + · exact Or.inr ((congrArg w_of (Subtype.ext heq)).trans hw₂_eq.symm) + have hrf_12 : w_of rf = w₁ ∨ w_of rf = w₂ := by + rcases hall rf.1 rf.2 (hinc_r_of (e, false)) with heq | heq + · exact Or.inl ((congrArg w_of (Subtype.ext heq)).trans hw₁_eq.symm) + · exact Or.inr ((congrArg w_of (Subtype.ext heq)).trans hw₂_eq.symm) + refine ⟨(edgeEquiv e).2, hw₁.2, hw₂.2, ?_⟩ + rw [hlink_e.2.2.2] + ext x + simp only [mem_insert_iff, mem_singleton_iff] + constructor + · rintro (rfl | rfl) + · exact hrt_12 + · exact hrf_12 + · rintro (rfl | rfl) + · exact hw₁_tf + · exact hw₂_tf + +private theorem exists_disjoint_edge_charts (hS : IsClosedDiscSpace S) {G : Drawing S} + (hProper : G.IsProper) {h : S → ℂ} (hh : Continuous h) (hinj : Function.Injective h) + {D_union : Set S} (hD_union_cl : IsClosed D_union) (hD_union_disj_U : Disjoint D_union G.U) : + ∃ (m_of : G.E → S) (O_of : G.E → Set S) (φ_e : G.E → ℂ → S), + (∀ e : G.E, m_of e ∈ e.1) ∧ (∀ e : G.E, m_of e ∈ G.U) ∧ + (∀ e : G.E, m_of e ∉ bd S) ∧ Function.Injective m_of ∧ + (∀ e₁ e₂ : G.E, e₁ ≠ e₂ → Disjoint (O_of e₁) (O_of e₂)) ∧ + (∀ e : G.E, φ_e e '' closedBall (0 : ℂ) 1 ⊆ O_of e \ bd S) ∧ + (∀ e : G.E, Disjoint (O_of e) D_union) ∧ + (∀ e : G.E, ContinuousOn (φ_e e) (closedBall 0 1)) ∧ + (∀ e : G.E, InjOn (φ_e e) (closedBall 0 1)) ∧ + (∀ e : G.E, φ_e e 0 = m_of e) ∧ + (∀ e : G.E, ∀ z ∈ closedBall (0 : ℂ) 1, φ_e e z ∈ G.U ↔ z.im = 0) ∧ + (∀ e : G.E, φ_e e '' {z | z ∈ ball (0 : ℂ) 1 ∧ z.im = 0} ⊆ e.1) := by + classical + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : Finite G.E := G.finite_edges.to_subtype + let _ : Fintype G.E := Fintype.ofFinite G.E + have hbd_cl : IsClosed (bd S) := isClosed_bd_of_isClosedDiscSpace hS + choose γ_e hγ_cont hγ_0 hγ_1 hγ_inj hγ_img _ _ using + fun e : G.E => exists_edge_param_isLink G e.2 + let tLeft : I := ⟨1 / 4, by norm_num, by norm_num⟩ + let tMid : I := ⟨1 / 2, by norm_num, by norm_num⟩ + let tRight : I := ⟨3 / 4, by norm_num, by norm_num⟩ + have htMid_Ioo : tMid ∈ Ioo (0 : I) 1 := by + constructor + · change (0 : ℝ) < 1 / 2 + norm_num + · change (1 / 2 : ℝ) < 1 + norm_num + have htLeft_lt : tLeft < tMid := by change (1 / 4 : ℝ) < 1 / 2; norm_num + have htMid_lt : tMid < tRight := by change (1 / 2 : ℝ) < 3 / 4; norm_num + let m_of : G.E → S := fun e => γ_e e tMid + have hm_mem_e : ∀ e : G.E, m_of e ∈ e.1 := + fun e => hγ_img e ▸ mem_image_of_mem (γ_e e) htMid_Ioo + have hm_mem_U : ∀ e : G.E, m_of e ∈ G.U := + fun e => (e.2.2.1 (hm_mem_e e)).1 + have hm_not_bd : ∀ e : G.E, m_of e ∉ bd S := + fun e hbd => (e.2.2.1 (hm_mem_e e)).2 (hProper ⟨hbd, hm_mem_U e⟩) + have hm_inj : Function.Injective m_of := by + intro e₁ e₂ heq + by_contra hne + have hdisj := disjoint_edges_of_ne G e₁.2 e₂.2 (Subtype.coe_ne_coe.mpr hne) + exact disjoint_left.mp hdisj (hm_mem_e e₁) (heq ▸ hm_mem_e e₂) + let Voro : G.E → Set S := fun e => + ⋂ e' ∈ Finset.univ.erase e, {x : S | dist (h x) (h (m_of e)) < dist (h x) (h (m_of e'))} + have hVoro_open : ∀ e : G.E, IsOpen (Voro e) := by + intro e + exact isOpen_biInter_finset fun e' _ => + isOpen_lt (hh.dist continuous_const) (hh.dist continuous_const) + have hm_Voro : ∀ e : G.E, m_of e ∈ Voro e := by + intro e + simp only [Voro, mem_iInter, Finset.mem_erase, Finset.mem_univ, and_true] + intro e' hne + change dist (h (m_of e)) (h (m_of e)) < dist (h (m_of e)) (h (m_of e')) + rw [dist_self, dist_pos] + exact hinj.ne (hm_inj.ne hne.symm) + have hVoro_disj : ∀ e₁ e₂ : G.E, e₁ ≠ e₂ → Disjoint (Voro e₁) (Voro e₂) := by + intro e₁ e₂ hne + refine disjoint_left.mpr fun x hx1 hx2 => ?_ + have h1 : dist (h x) (h (m_of e₁)) < dist (h x) (h (m_of e₂)) := by + have := mem_iInter₂.mp hx1 e₂ (Finset.mem_erase.mpr ⟨hne.symm, Finset.mem_univ e₂⟩) + exact this + have h2 : dist (h x) (h (m_of e₂)) < dist (h x) (h (m_of e₁)) := by + have := mem_iInter₂.mp hx2 e₁ (Finset.mem_erase.mpr ⟨hne, Finset.mem_univ e₁⟩) + exact this + exact lt_irrefl _ (h1.trans h2) + let O_of : G.E → Set S := fun e => + Voro e ∩ (G.V ∪ (G.U \ e.1) ∪ D_union ∪ bd S)ᶜ + have hO_open : ∀ e : G.E, IsOpen (O_of e) := by + intro e + refine (hVoro_open e).inter ?_ + exact (((G.finite_V.isClosed.union (isClosed_U_sdiff_edge G e.2)).union hD_union_cl).union + hbd_cl).isOpen_compl + have hm_O : ∀ e : G.E, m_of e ∈ O_of e := by + intro e + refine ⟨hm_Voro e, ?_⟩ + rintro (((hmV | hm_sdiff) | hmD) | hmbd) + · exact (e.2.2.1 (hm_mem_e e)).2 hmV + · exact hm_sdiff.2 (hm_mem_e e) + · exact disjoint_left.mp hD_union_disj_U hmD (hm_mem_U e) + · exact hm_not_bd e hmbd + have hchart_exists : ∀ e : G.E, + ∃ (φ : ℂ → S) (a b : I), ContinuousOn φ (closedBall 0 1) ∧ InjOn φ (closedBall 0 1) ∧ + tLeft < a ∧ a < tMid ∧ tMid < b ∧ b < tRight ∧ φ 0 = m_of e ∧ + φ '' closedBall (0 : ℂ) 1 ⊆ O_of e \ bd S ∧ + (∀ z ∈ closedBall (0 : ℂ) 1, φ z ∈ G.U ↔ z.im = 0) ∧ + φ '' {z | z ∈ ball (0 : ℂ) 1 ∧ z.im = 0} = γ_e e '' Ioo a b := by + intro e + obtain ⟨φ, a, b, hφc, hφi, ha1, ha2, hb1, hb2, hφ0, hφ_sub, hφU, hφ_real, _, _⟩ := + disc_exists_edge_chart hS G hProper e.2 (hγ_cont e) (hγ_0 e) (hγ_1 e) (hγ_inj e) + (hγ_img e) htMid_Ioo htLeft_lt htMid_lt (hO_open e) (hm_O e) + exact ⟨φ, a, b, hφc, hφi, ha1, ha2, hb1, hb2, hφ0, hφ_sub, hφU, hφ_real⟩ + choose φ_e a_e b_e hφc hφi ha1 ha2 hb1 hb2 hφ0 hφ_sub hφU hφ_real using hchart_exists + have hφ_real_sub : ∀ e : G.E, φ_e e '' {z | z ∈ ball (0 : ℂ) 1 ∧ z.im = 0} ⊆ e.1 := by + intro e + rw [hφ_real e, ← hγ_img e] + have hLeft : (0 : I) < tLeft := by + change (0 : ℝ) < 1 / 4 + norm_num + have hRight : tRight < (1 : I) := by + change (3 / 4 : ℝ) < 1 + norm_num + exact image_mono fun _ ht => ⟨hLeft.trans ((ha1 e).trans ht.1), + ht.2.trans ((hb2 e).trans hRight)⟩ + refine ⟨m_of, O_of, φ_e, hm_mem_e, hm_mem_U, hm_not_bd, hm_inj, ?_, hφ_sub, ?_, + hφc, hφi, hφ0, hφU, hφ_real_sub⟩ + · intro e₁ e₂ hne + exact (hVoro_disj e₁ e₂ hne).mono inter_subset_left inter_subset_left + · intro e + exact disjoint_left.mpr fun _ hx hxD => hx.2 (Or.inl (Or.inr hxD)) + +private theorem edge_stubs_and_incident_regions {G : Drawing S} + {h : S → ℂ} {w_of : G.R → S} {δ : ℝ} {m_of : G.E → S} + (hm_mem_U : ∀ e : G.E, m_of e ∈ G.U) + {O_of : G.E → Set S} {φ_e : G.E → ℂ → S} + (hO_disj : ∀ e₁ e₂ : G.E, e₁ ≠ e₂ → Disjoint (O_of e₁) (O_of e₂)) + (hO_disj_D : ∀ e : G.E, Disjoint (O_of e) (⋃ r : G.R, discBall h (w_of r) δ)) + (hφ_sub : ∀ e : G.E, φ_e e '' closedBall (0 : ℂ) 1 ⊆ O_of e \ bd S) + (hφc : ∀ e : G.E, ContinuousOn (φ_e e) (closedBall 0 1)) + (hφi : ∀ e : G.E, InjOn (φ_e e) (closedBall 0 1)) + (hφ0 : ∀ e : G.E, φ_e e 0 = m_of e) + (hφU : ∀ e : G.E, ∀ z ∈ closedBall (0 : ℂ) 1, φ_e e z ∈ G.U ↔ z.im = 0) : + let Half := G.E × Bool + let stub : Half → I → S := fun a t => φ_e a.1 (zStub a.2 t) + let Stub : Half → Set S := fun a => range (stub a) + ∃ r_of : Half → G.R, + (∀ a : Half, IsArcMap (stub a)) ∧ (∀ a : Half, stub a 0 = m_of a.1) ∧ + (∀ a : Half, Stub a ∩ G.U = {m_of a.1}) ∧ (∀ a : Half, Stub a ∩ bd S = ∅) ∧ + (∀ (a : Half) (r : G.R), Disjoint (Stub a) (discBall h (w_of r) δ)) ∧ + (∀ a b : Half, b ≠ a → Stub a ∩ Stub b = if a.1 = b.1 then {m_of a.1} else ∅) ∧ + (∀ (a : Half) (t : I), (0 : I) < t → stub a t ∈ (r_of a).1 \ bd S) := by + classical + intro Half stub Stub + have hstub_arc : ∀ a : Half, IsArcMap (stub a) := + fun a => isArcMap_stub (hφc a.1) (hφi a.1) a.2 + have hstub_0 : ∀ a : Half, stub a 0 = m_of a.1 := by + intro a; simp [stub, zStub_zero, hφ0] + have hstub_mem_O : ∀ a : Half, ∀ t : I, stub a t ∈ O_of a.1 \ bd S := + fun a t => hφ_sub a.1 ⟨zStub a.2 t, zStub_mem_closedBall_one a.2 t, rfl⟩ + have hstub_U_iff : ∀ a : Half, ∀ t : I, stub a t ∈ G.U ↔ t = 0 := by + intro a t + rw [hφU a.1 (zStub a.2 t) (zStub_mem_closedBall_one a.2 t), zStub_im_eq_zero_iff] + have hStub_U : ∀ a : Half, Stub a ∩ G.U = {m_of a.1} := by + intro a + ext x + simp only [Stub, mem_inter_iff, mem_range, mem_singleton_iff] + constructor + · rintro ⟨⟨t, rfl⟩, hxU⟩ + rw [(hstub_U_iff a t).mp hxU, hstub_0] + · rintro rfl + exact ⟨⟨0, hstub_0 a⟩, hm_mem_U a.1⟩ + have hStub_bd : ∀ a : Half, Stub a ∩ bd S = ∅ := by + intro a + rw [eq_empty_iff_forall_notMem] + rintro _ ⟨⟨t, rfl⟩, hbd⟩ + exact (hstub_mem_O a t).2 hbd + have hStub_D : ∀ (a : Half) (r : G.R), Disjoint (Stub a) (discBall h (w_of r) δ) := by + intro a r + refine (hO_disj_D a.1).mono ?_ ?_ + · rintro _ ⟨t, rfl⟩ + exact (hstub_mem_O a t).1 + · exact subset_iUnion (fun r : G.R => discBall h (w_of r) δ) r + have hStub_inter : ∀ a b : Half, b ≠ a → Stub a ∩ Stub b = if a.1 = b.1 then {m_of a.1} else ∅ + := by + intro a b hne + by_cases he : a.1 = b.1 + · rw [ite_eq_left he] + rcases a with ⟨e, sgn₁⟩ + rcases b with ⟨e₂, sgn₂⟩ + dsimp at he + subst e₂ + have hsgn : sgn₁ ≠ sgn₂ := fun h => hne (Prod.ext rfl h.symm) + cases sgn₁ <;> cases sgn₂ + · exact False.elim (hsgn rfl) + · rw [inter_comm, stub_inter_stub_opposite (hφi e), hφ0] + · rw [stub_inter_stub_opposite (hφi e), hφ0] + · exact False.elim (hsgn rfl) + · rw [ite_eq_right he, eq_empty_iff_forall_notMem] + rintro x ⟨⟨s, rfl⟩, ⟨t, hst⟩⟩ + have hx1 : stub a s ∈ O_of a.1 := (hstub_mem_O a s).1 + have hx2 : stub a s ∈ O_of b.1 := hst ▸ (hstub_mem_O b t).1 + exact disjoint_left.mp (hO_disj a.1 b.1 he) hx1 hx2 + -- Region `r_of a` containing `stub a '' Ioc 0 1`. + have hr_exists : ∀ a : Half, ∃ r : G.R, ∀ t : I, (0 : I) < t → stub a t ∈ r.1 \ bd S := by + intro a + have h1_not_U : stub a 1 ∉ G.U := by + rw [hstub_U_iff]; exact one_ne_zero + obtain ⟨r, hr, h1_r⟩ := exists_region_of_notMem h1_not_U + refine ⟨⟨r, hr⟩, fun t ht => ⟨?_, (hstub_mem_O a t).2⟩⟩ + have hIoc_sub : stub a '' Ioc 0 1 ⊆ univ \ G.U := by + rintro _ ⟨s, hs, rfl⟩ + exact ⟨mem_univ _, fun hsU => hs.1.ne' ((hstub_U_iff a s).mp hsU)⟩ + have hIoc_conn : IsPreconnected (stub a '' Ioc 0 1) := + isPreconnected_Ioc.image (stub a) (hstub_arc a).1.continuousOn + have hIoc_r : stub a '' Ioc 0 1 ⊆ r := + subset_region hr hIoc_conn (disjoint_left.mpr fun z hz => (hIoc_sub hz).2) + ⟨1, right_mem_Ioc.mpr zero_lt_one, rfl⟩ h1_r + exact hIoc_r ⟨t, ⟨ht, unitInterval.le_one t⟩, rfl⟩ + choose r_of hr_of using hr_exists + exact ⟨r_of, hstub_arc, hstub_0, hStub_U, hStub_bd, hStub_D, hStub_inter, hr_of⟩ + +/-- Every connected proper drawing `G` on a closed disc space `S` has a disc dual drawing +`G_dual : Drawing S` satisfying `IsDiscDualDrawing G G_dual`. -/ +theorem exists_isDiscDualDrawing (hS : IsClosedDiscSpace S) {G : Drawing S} + (hProper : G.IsProper) (hConn : IsGraphConnected G.toGraph) : + ∃ G_dual : Drawing S, IsDiscDualDrawing G G_dual := by + classical + by_cases hE_emp : G.E = ∅ + · exact exists_isDiscDualDrawing_of_edges_empty hS hProper hConn hE_emp + have hT2 : T2Space S := t2Space_of_isClosedDiscSpace hS + have : CompactSpace S := compactSpace_of_isClosedDiscSpace hS + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + have hbd_cl : IsClosed (bd S) := isClosed_bd_of_isClosedDiscSpace hS + obtain ⟨h, g, hh, hinj, hg, hmem, hgl, hgr, _, _, hball_iff⟩ := exists_disc_complex_chart hS + obtain ⟨W, hW_fin, hW_uniq, hW_in_R, hW_bd⟩ := + exists_dual_vertices_of_connected hS hProper hConn + have hR_fin : G.R.Finite := disc_finite_R hS G hProper + have : Finite G.R := hR_fin.to_subtype + have : Finite G.E := G.finite_edges.to_subtype + let _ : Fintype G.R := Fintype.ofFinite G.R + let _ : Fintype G.E := Fintype.ofFinite G.E + choose w_of hw_of_mem hw_of_uniq using fun r : G.R => hW_uniq r.1 r.2 + have hw_in : ∀ r : G.R, w_of r ∈ r.1 := fun r => (hw_of_mem r).1 + have hw_W : ∀ r : G.R, w_of r ∈ W := fun r => (hw_of_mem r).2 + have hW_disj_U : Disjoint W G.U := by + refine disjoint_left.mpr fun w hw hwU => ?_ + obtain ⟨r, hr, hwr⟩ := hW_in_R w hw + exact region_subset hr hwr hwU + -- Step 1: Uniform radius `δ > 0` for `discBall h (w_of r) δ ⊆ r.1` and interior centers `c_of r`. + obtain ⟨δ, hδ_pos, _, hδ_sub⟩ := + exists_uniform_discBall_radius hS hProper hh hinj w_of hw_in + have hc_exists : ∀ r : G.R, ∃ c : S, c ∈ discOpenBall h (w_of r) δ \ bd S := by + intro r + exact open_sdiff_bd_nonempty hS (isOpen_discOpenBall hh (w_of r) δ) + ⟨w_of r, mem_discOpenBall_self h (w_of r) hδ_pos⟩ + choose c_of hc_of using hc_exists + let D_union : Set S := ⋃ r : G.R, discBall h (w_of r) δ + have hD_union_cl : IsClosed D_union := + isClosed_iUnion_of_finite fun r => isClosed_discBall hh (w_of r) δ + have hD_union_disj_U : Disjoint D_union G.U := by + refine disjoint_left.mpr ?_ + rintro x ⟨_, ⟨r, rfl⟩, hxr⟩ hxU + exact region_subset r.2 (hδ_sub r hxr) hxU + obtain ⟨m_of, O_of, φ_e, hm_mem_e, hm_mem_U, hm_not_bd, hm_inj, hO_disj, hφ_sub, hO_disj_D, + hφc, hφi, hφ0, hφU, hφ_real_sub⟩ := + exists_disjoint_edge_charts hS hProper hh hinj hD_union_cl hD_union_disj_U + have hm_not_W : ∀ e : G.E, m_of e ∉ W := + fun e hmW => disjoint_left.mp hW_disj_U hmW (hm_mem_U e) + let Half := G.E × Bool + let stub : Half → I → S := fun a t => φ_e a.1 (zStub a.2 t) + let Stub : Half → Set S := fun a => range (stub a) + obtain ⟨r_of, hstub_arc, hstub_0, hStub_U, hStub_bd, hStub_D, hStub_inter, hr_of⟩ := + edge_stubs_and_incident_regions hm_mem_U hO_disj hO_disj_D hφ_sub hφc hφi hφ0 hφU + have h_ind := exists_truncated_spokes hS hh hδ_sub hc_of hm_mem_U hm_not_bd hm_inj + stub r_of hstub_arc hstub_0 hStub_U hStub_bd hStub_D hStub_inter hr_of + obtain ⟨T, A_far, y, u₀, _, hT_in, hT_all⟩ := h_ind Finset.univ + have hT_props : ∀ a : Half, + IsLineWithEnds (T a) (m_of a.1) (y a) ∧ + y a ∈ discSphere h (w_of (r_of a)) δ ∧ + T a ∩ discBall h (w_of (r_of a)) δ = {y a} ∧ + (0 : I) < u₀ a ∧ + IsClosed (A_far a) ∧ + m_of a.1 ∉ A_far a ∧ + T a = stub a '' Icc 0 (u₀ a) ∪ A_far a := + fun a => hT_in a (Finset.mem_univ a) + have hy_inj : Function.Injective y := by + intro a b hab + by_contra hne + have hya : y a ∈ T a \ {m_of a.1} := by + refine ⟨IsLineWithEnds.right_mem (hT_props a).1, fun heq => ?_⟩ + exact disjoint_left.mp hD_union_disj_U + ⟨_, ⟨r_of a, rfl⟩, discSphere_subset_discBall h (w_of (r_of a)) δ (hT_props a).2.1⟩ + (heq ▸ hm_mem_U a.1) + have hyb : y a ∈ T b := hab ▸ IsLineWithEnds.right_mem (hT_props b).1 + have hinter : y a ∈ T a ∩ T b := ⟨hya.1, hyb⟩ + rw [(hT_all a).2.2.2.2.2.2 b (Ne.symm hne)] at hinter + split_ifs at hinter with heq + · exact hya.2 hinter + · exact hinter + -- Step 5: Attach radial segments `R_seg a` in `discBall h (w_of (r_of a)) δ` to form `H e sgn`. + let R_seg : Half → Set S := fun a => range (radMap h g (w_of (r_of a)) (y a)) + let H : G.E → Bool → Set S := fun e sgn => T (e, sgn) ∪ R_seg (e, sgn) + let w_end : G.E → Bool → S := fun e sgn => w_of (r_of (e, sgn)) + obtain ⟨hR_sub_D, hH_line, hH_U, hH_bd, hH_W, hH_opp, hH_opp_ne, hH_disj⟩ := + radial_spoke_properties hinj hg hmem hgl hgr hball_iff hδ_pos hδ_sub hm_mem_U hm_not_W + hw_W hw_of_uniq hy_inj hT_props hT_all + -- Step 6: Obtain `G_dual` and `edgeEquiv` from `exists_dual_drawing_of_spokes`. + obtain ⟨G_dual, edgeEquiv, hGd_V, hGd_U, hedge_eq, hedge_link⟩ := + exists_dual_drawing_of_spokes hW_fin m_of w_end H hm_not_W + (fun e sgn => hw_W (r_of (e, sgn))) hH_line hH_W hH_opp hH_opp_ne hH_disj + have hGd_prop : G_dual.IsProper := by + rintro x ⟨hxbd, hxU⟩ + rw [hGd_V] + rw [hGd_U] at hxU + rcases hxU with hxW | ⟨_, ⟨e, rfl⟩, hxH | hxH⟩ + · exact hxW + · have : x ∈ H e true ∩ bd S := ⟨hxH, hxbd⟩ + rw [mem_singleton_iff.mp (hH_bd e true this)] + exact hw_W (r_of (e, true)) + · have : x ∈ H e false ∩ bd S := ⟨hxH, hxbd⟩ + rw [mem_singleton_iff.mp (hH_bd e false this)] + exact hw_W (r_of (e, false)) + have hK_U : ∀ e : G.E, (H e true ∪ H e false) ∩ G.U = {m_of e} := by + intro e + rw [union_inter_distrib_right, hH_U e true, hH_U e false, union_self] + have hedge_inter_U : ∀ e : G.E, (edgeEquiv e).1 ∩ G.U = {m_of e} := by + intro e + rw [hedge_eq e] + ext x + simp only [mem_inter_iff, mem_sdiff, mem_singleton_iff] + constructor + · rintro ⟨⟨hxK, _⟩, hxU⟩ + have : x ∈ (H e true ∪ H e false) ∩ G.U := ⟨hxK, hxU⟩ + rwa [hK_U e, mem_singleton_iff] at this + · rintro rfl + exact ⟨⟨Or.inl (IsLineWithEnds.left_mem (hH_line e true)), hm_not_W e⟩, hm_mem_U e⟩ + have hedge_inter_e : ∀ e : G.E, (edgeEquiv e).1 ∩ e.1 = {m_of e} := by + intro e + ext x + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hxe', hxe⟩ + have : x ∈ (edgeEquiv e).1 ∩ G.U := ⟨hxe', (e.2.2.1 hxe).1⟩ + rwa [hedge_inter_U e, mem_singleton_iff] at this + · rintro rfl + have : m_of e ∈ (edgeEquiv e).1 ∩ G.U := by rw [hedge_inter_U e]; rfl + exact ⟨this.1, hm_mem_e e⟩ + have he_inter_GdU : ∀ e : G.E, e.1 ∩ G_dual.U = {m_of e} := by + intro e + ext x + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hxe, hxU⟩ + have hxGU : x ∈ G.U := (e.2.2.1 hxe).1 + rw [hGd_U] at hxU + rcases hxU with hxW | ⟨_, ⟨e', rfl⟩, hxK⟩ + · exact False.elim (disjoint_left.mp hW_disj_U hxW hxGU) + · have : x ∈ (H e' true ∪ H e' false) ∩ G.U := ⟨hxK, hxGU⟩ + rw [hK_U e', mem_singleton_iff] at this + subst this + have he'_eq : e' = e := by + by_contra hne + exact disjoint_left.mp (disjoint_edges_of_ne G e'.2 e.2 (Subtype.coe_ne_coe.mpr hne)) + (hm_mem_e e') hxe + rw [he'_eq] + · rintro rfl + have : m_of e ∈ (edgeEquiv e).1 ∩ e.1 := by rw [hedge_inter_e e]; rfl + exact ⟨this.2, (edgeEquiv e).2.2.1 this.1 |>.1⟩ + have hedge_clause2 := dual_region_meets_primal_edge hS hGd_prop edgeEquiv hW_fin hm_mem_U hm_not_W + hm_inj hedge_inter_e hφc hφi hφ0 hφ_real_sub + hD_union_cl hD_union_disj_U hT_props hR_sub_D hH_line hK_U hGd_U + obtain ⟨hinc_r_of, hall_inc_r⟩ := + incident_regions_of_edge_charts hS hProper hm_mem_e hφc hφi hφ0 hφU hstub_arc hstub_0 hr_of + have hedge_link_iff := + dual_edge_link_iff_of_incident_regions edgeEquiv hGd_V hw_in hw_of_uniq hinc_r_of hall_inc_r + hedge_link + have hedge_4 : ∀ e : G.E, + ((edgeEquiv e).1 ∩ G.U = (edgeEquiv e).1 ∩ e.1) ∧ + (e.1 ∩ G_dual.U = e.1 ∩ (edgeEquiv e).1) ∧ + ((edgeEquiv e).1 ∩ e.1).ncard = 1 ∧ + (∀ r' ∈ G_dual.R, G_dual.EdgeRegionIncident (edgeEquiv e).1 r' → (r' ∩ e.1).Nonempty) := by + intro e + refine ⟨?_, ?_, ?_, hedge_clause2 e⟩ + · rw [hedge_inter_U e, hedge_inter_e e] + · rw [he_inter_GdU e, inter_comm e.1, hedge_inter_e e] + · rw [hedge_inter_e e, ncard_singleton] + have hDual_V_uniq : ∀ r ∈ G.R, ∃! w, w ∈ r ∧ w ∈ G_dual.V := by + rwa [hGd_V] + have hDual_V_in_R : ∀ w ∈ G_dual.V, ∃ r ∈ G.R, w ∈ r := by + rwa [hGd_V] + have hDual_bd : IsDualPointSet (bd S) (G.V ∩ bd S) (G_dual.V ∩ bd S) := by + rwa [hGd_V] + have hV_inj : ∀ v₁ ∈ G.V, ∀ v₂ ∈ G.V, + connectedComponentIn (univ \ G_dual.U) v₁ = connectedComponentIn (univ \ G_dual.U) v₂ → + v₁ = v₂ := + dual_region_injective_on_V hS hProper hConn hGd_prop hDual_V_uniq hDual_V_in_R + hDual_bd edgeEquiv hedge_4 + refine ⟨G_dual, hProper, hGd_prop, hDual_V_uniq, hDual_V_in_R, hDual_bd, hV_inj, + ⟨edgeEquiv, fun e => ?_⟩⟩ + obtain ⟨h1, h2, h3, h4⟩ := hedge_4 e + exact ⟨h1, h2, h3, h4, hedge_link_iff e⟩ + +/-- **Graph Minors VI, (3.6)** (pages 121–122): +Let $\Gamma$ be a drawing in a closed disc $\Delta$, let $U$ be a dual point set for +$(\operatorname{bd}(\Delta), V(\Gamma) \cap \operatorname{bd}(\Delta))$, and let $\mathcal{D}$ be a +division of $V(\Gamma) \cap \operatorname{bd}(\Delta)$. Then $\mathcal{D}$ is feasible if and only +if $\mathcal{D}$ is cross-free and every $xy$-chain has non-negative redundancy, for all +$x, y \in U \cup (V(\Gamma) \cap \operatorname{bd}(\Delta))$. -/ +theorem theorem_3_6_proof : Statement36 := by + intro S _ G Δ U hS hProper hΔ hΔ_eq hU + exact isFeasible_iff_of_exists_isDiscDualDrawing hS + (fun _ hP' hC' => exists_isDiscDualDrawing hS hP' hC') + G Δ hProper hΔ hΔ_eq hU + +end GraphMinor.GM06 diff --git a/LeanPool/GraphMinor/GM06/EdgeChart.lean b/LeanPool/GraphMinor/GM06/EdgeChart.lean new file mode 100644 index 0000000000..8adfe6ec44 --- /dev/null +++ b/LeanPool/GraphMinor/GM06/EdgeChart.lean @@ -0,0 +1,407 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.DiscRegions +public import LeanPool.GraphMinor.GM11.EdgeChart +public import LeanPool.GraphMinor.Surface.Crossing + +/-! +# Edge Charts and Arc Non-Separation on a Closed Disc Space + +This file proves two topological tools for proper drawings on a closed disc space `S` +(`IsClosedDiscSpace S`), without requiring `IsClosedSurface S`: +1. `disc_exists_edge_chart`: around any point `γ t₀` of an edge `e ∈ H.E` of a proper drawing `H` + on `S`, inside any open neighborhood `O` of `γ t₀`, there is an injective continuous chart + `G : ℂ → S` on `closedBall (0 : ℂ) 1` mapping `0` to `γ t₀`, the real diameter into `e`, and the + rest of `closedBall (0 : ℂ) 1` into `O \ (bd S ∪ H.U)`, such that `G '' ball (0 : ℂ) ρ` is open + in `S` for every `0 < ρ ≤ 1`. +2. `disc_sdiff_arc_connectedComponentIn`: an arc `J` in `S` that meets a closed set `K` and `bd S` + in at most a single point `v` does not separate any connected component of `(univ \ bd S) \ K`. +-/ + +public section + +namespace GraphMinor.GM06 + +open Set Function Topology Metric unitInterval Complex GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- CompactSpace instance for a closed disc space `S`. -/ +theorem compactSpace_of_isClosedDiscSpace (hS : IsClosedDiscSpace S) : CompactSpace S := by + have : CompactSpace ClosedUnitDisc := + isCompact_iff_compactSpace.mp (isCompact_closedBall (0 : EuclideanPlane) 1) + obtain ⟨φ⟩ := hS + exact φ.compactSpace + +/-- Global complex disc coordinates on a closed disc space `S`. -/ +theorem exists_disc_complex_chart (hS : IsClosedDiscSpace S) : + ∃ (h : S → ℂ) (g : ℂ → S), + Continuous h ∧ Function.Injective h ∧ ContinuousOn g (closedBall 0 1) ∧ + (∀ x : S, h x ∈ closedBall (0 : ℂ) 1) ∧ + (∀ x : S, g (h x) = x) ∧ + (∀ z ∈ closedBall (0 : ℂ) 1, h (g z) = z) ∧ + h '' bd S = sphere (0 : ℂ) 1 ∧ + (∀ x : S, x ∈ bd S ↔ ‖h x‖ = 1) ∧ + (∀ x : S, x ∉ bd S ↔ h x ∈ ball (0 : ℂ) 1) := by + obtain ⟨h, g, hh, hg, hmaps, _, hleft, hright, hbd⟩ := hS.isClosedDisc_univ.exists_chart + rw [discBd_univ] at hbd + have hcont : Continuous h := continuousOn_univ.mp hh + have hgl : ∀ x : S, g (h x) = x := fun x => hleft (mem_univ x) + have hinj : Function.Injective h := fun x y hxy => by + rw [← hgl x, ← hgl y, hxy] + have hmem : ∀ x : S, h x ∈ closedBall (0 : ℂ) 1 := fun x => hmaps (mem_univ x) + have hbd_iff : ∀ x : S, x ∈ bd S ↔ ‖h x‖ = 1 := by + intro x + rw [← mem_sphere_zero_iff_norm, ← hbd, hinj.mem_set_image] + have hball_iff : ∀ x : S, x ∉ bd S ↔ h x ∈ ball (0 : ℂ) 1 := by + intro x + rw [hbd_iff, mem_ball_zero_iff] + have hle : ‖h x‖ ≤ 1 := mem_closedBall_zero_iff.mp (hmem x) + exact ⟨fun hne => lt_of_le_of_ne hle hne, fun hlt => hlt.ne⟩ + exact ⟨h, g, hcont, hinj, hg, hmem, hgl, fun z hz => hright hz, hbd, hbd_iff, hball_iff⟩ + +/-- An injective continuous map `G : ℂ → S` on `closedBall (0 : ℂ) 1` into `univ \ bd S` maps +`ball (0 : ℂ) ρ` (`0 < ρ ≤ 1`) to an open set in `S`. -/ +theorem isOpen_image_ball_of_disc (hS : IsClosedDiscSpace S) {G : ℂ → S} + (hGc : ContinuousOn G (closedBall (0 : ℂ) 1)) (hGi : InjOn G (closedBall (0 : ℂ) 1)) + {ρ : ℝ} (hρ1 : ρ ≤ 1) : + IsOpen (G '' ball (0 : ℂ) ρ) := by + obtain ⟨h, _, hh, hinj, _, _, _, _, _, _, _⟩ := exists_disc_complex_chart hS + have hsub : ball (0 : ℂ) ρ ⊆ closedBall (0 : ℂ) 1 := + ball_subset_closedBall.trans (closedBall_subset_closedBall hρ1) + have hcomp_c : ContinuousOn (h ∘ G) (ball (0 : ℂ) ρ) := + hh.comp_continuousOn (hGc.mono hsub) + have hcomp_i : InjOn (h ∘ G) (ball (0 : ℂ) ρ) := + hinj.comp_injOn (hGi.mono hsub) + have hopen_C : IsOpen ((h ∘ G) '' ball (0 : ℂ) ρ) := + isOpen_image_of_injOn isOpen_ball hcomp_c hcomp_i + rw [image_comp] at hopen_C + have hpre : h ⁻¹' (h '' (G '' ball (0 : ℂ) ρ)) = G '' ball (0 : ℂ) ρ := + preimage_image_eq _ hinj + rw [← hpre] + exact hopen_C.preimage hh + +private theorem edge_has_collared_disc (hS : IsClosedDiscSpace S) (H : Drawing S) + (hprop : H.IsProper) + {e : Set S} (he : e ∈ H.E) {γ : I → S} (hγ : Continuous γ) (hγ0 : γ 0 ∈ H.V) + (hγ1 : γ 1 ∈ H.V) (hinj : InjOn γ (Ioo 0 1)) (hγe : γ '' Ioo 0 1 = e) + {s t₀ u : I} (ht₀ : t₀ ∈ Ioo (0 : I) 1) (hs : s < t₀) (hu : t₀ < u) + {O : Set S} (hO : IsOpen O) (hpO : γ t₀ ∈ O) : + ∃ (a₀ b₀ : I) (W A₁ Δ₁ : Set S), + a₀ < t₀ ∧ t₀ < b₀ ∧ Icc a₀ b₀ ⊆ Ioo 0 1 ∧ + IsOpen W ∧ γ t₀ ∈ W ∧ W ⊆ O \ bd S ∧ Disjoint A₁ W ∧ + W ⊆ ((H.U \ e) ∪ γ '' {t | t ≤ s ∨ u ≤ t})ᶜ ∧ + W ⊆ ((H.U \ e) ∪ γ '' {t | t ≤ a₀ ∨ b₀ ≤ t})ᶜ ∧ + IsClosedDisc Δ₁ ∧ Δ₁ ⊆ univ \ discBd (univ : Set S) ∧ + discBd Δ₁ = A₁ ∪ γ '' Icc a₀ b₀ ∧ γ '' Icc a₀ b₀ ⊆ H.U := by + classical + have hT2 : T2Space S := t2Space_of_isClosedDiscSpace hS + have hbd_cl : IsClosed (bd S) := isClosed_bd_of_isClosedDiscSpace hS + have hpe : γ t₀ ∈ e := hγe ▸ mem_image_of_mem γ ht₀ + have hpbd₀ : γ t₀ ∉ bd S := fun hbd => (he.2.1 hpe).2 (hprop ⟨hbd, (he.2.1 hpe).1⟩) + have hpiece : ∀ {t : I}, γ t = γ t₀ → t = t₀ := + fun h => GM11.edge_parameter_unique H he hγ0 hγ1 hinj ht₀ hpe h + let Y₀ : Set S := (H.U \ e) ∪ γ '' {t | t ≤ s ∨ u ≤ t} + obtain ⟨hY₀, hpY₀⟩ := GM11.edge_chart_avoidance H he hγ hpe hpiece hs hu + let O' : Set S := (O \ bd S) ∩ Y₀ᶜ + have hO' : IsOpen O' := (hO.sdiff hbd_cl).inter hY₀.isOpen_compl + have hpO' : γ t₀ ∈ O' := ⟨⟨hpO, hpbd₀⟩, hpY₀⟩ + obtain ⟨D, D', hD, hD', hpD', hD'D, hDO', hbdD⟩ := + disc_exists_closedDisc_nbhd hS hO' hpO' hpbd₀ + have hDO : ∀ {x}, x ∈ D → x ∉ Y₀ := fun hx => (hDO' hx).2 + have hD_sub_Obd : D ⊆ O \ bd S := fun x hx => (hDO' hx).1 + have hVout : ∀ x ∈ H.V, x ∉ D := fun x hx hxD => + hDO hxD (Or.inl ⟨H.V_subset_U hx, fun hxe => (he.2.1 hxe).2 hx⟩) + have hDclosed : IsClosed D := hD.isClosed + have hC₁ : IsCompact {t : I | t ≤ t₀ ∧ γ t ∉ D'} := + (isClosed_Iic.inter (hD'.isClosed_compl.preimage hγ)).isCompact + have hC₂ : IsCompact {t : I | t₀ ≤ t ∧ γ t ∉ D'} := + (isClosed_Ici.inter (hD'.isClosed_compl.preimage hγ)).isCompact + obtain ⟨a₀, ⟨hat, hagamma⟩, hamax⟩ := hC₁.exists_isGreatest + ⟨0, unitInterval.nonneg _, fun h => hVout _ hγ0 (hD'D h)⟩ + obtain ⟨b₀, ⟨htb, hbgamma⟩, hbmin⟩ := hC₂.exists_isLeast + ⟨1, unitInterval.le_one _, fun h => hVout _ hγ1 (hD'D h)⟩ + have ha₀ : a₀ < t₀ := lt_of_le_of_ne hat fun h => hagamma (h ▸ hpD') + have hb₀ : t₀ < b₀ := lt_of_le_of_ne htb fun h => hbgamma (h ▸ hpD') + have hIoo : ∀ t, a₀ < t → t < b₀ → γ t ∈ D' := by + intro t h₁ h₂ + by_contra hcon + rcases le_total t t₀ with h | h + · exact absurd (hamax ⟨h, hcon⟩) (not_le.mpr h₁) + · exact absurd (hbmin ⟨h, hcon⟩) (not_le.mpr h₂) + have hab : a₀ < b₀ := ha₀.trans hb₀ + have hclosure : ∀ t ∈ closure (Ioo a₀ b₀), γ t ∈ D := by + intro t ht + have h₁ : γ t ∈ closure (γ '' Ioo a₀ b₀) := image_closure_subset_closure_image hγ ⟨t, ht, rfl⟩ + have h₂ : γ '' Ioo a₀ b₀ ⊆ D := by + rintro _ ⟨v, hv, rfl⟩ + exact hD'D (hIoo v hv.1 hv.2) + exact hDclosed.closure_subset_iff.mpr h₂ h₁ + have hamem : γ a₀ ∈ D := hclosure a₀ (by rw [closure_Ioo hab.ne]; exact ⟨le_rfl, hab.le⟩) + have hbmem : γ b₀ ∈ D := hclosure b₀ (by rw [closure_Ioo hab.ne]; exact ⟨hab.le, le_rfl⟩) + have ha0 : 0 < a₀ := unitInterval.pos_iff_ne_zero.mpr fun h => hVout _ hγ0 (h ▸ hamem) + have hb1 : b₀ < 1 := unitInterval.lt_one_iff_ne_one.mpr fun h => hVout _ hγ1 (h ▸ hbmem) + have hIcc : Icc a₀ b₀ ⊆ Ioo 0 1 := fun t ht => ⟨ha0.trans_le ht.1, ht.2.trans_lt hb1⟩ + have habR : (a₀ : ℝ) < b₀ := hab + have hρmem : ∀ v : I, (a₀ : ℝ) + v.1 * (b₀ - a₀) ∈ Set.Icc (0 : ℝ) 1 := by + intro v + have hv₀ := v.2.1 + have hv₁ := v.2.2 + have ha' := a₀.2.1 + have hb' := b₀.2.2 + constructor + · have : 0 ≤ v.1 * ((b₀ : ℝ) - a₀) := mul_nonneg hv₀ (by linarith) + linarith + · have : v.1 * ((b₀ : ℝ) - a₀) ≤ 1 * ((b₀ : ℝ) - a₀) := + mul_le_mul_of_nonneg_right hv₁ (by linarith) + linarith + let ρ : I → I := fun v => ⟨(a₀ : ℝ) + v.1 * (b₀ - a₀), hρmem v⟩ + have hρ : Continuous ρ := by + refine Continuous.subtype_mk ?_ _ + fun_prop + have hρIcc : ∀ v, ρ v ∈ Icc a₀ b₀ := by + intro v + have hv₀ := v.2.1 + have hv₁ := v.2.2 + constructor + · have : 0 ≤ v.1 * ((b₀ : ℝ) - a₀) := mul_nonneg hv₀ (by linarith) + exact Subtype.mk_le_mk.mpr (by linarith) + · have : v.1 * ((b₀ : ℝ) - a₀) ≤ 1 * ((b₀ : ℝ) - a₀) := + mul_le_mul_of_nonneg_right hv₁ (by linarith) + exact Subtype.mk_le_mk.mpr (by linarith) + have hρsurj : ∀ t ∈ Icc a₀ b₀, ∃ v, ρ v = t := by + intro t ht + have ht₁ : (a₀ : ℝ) ≤ t := ht.1 + have ht₂ : (t : ℝ) ≤ b₀ := ht.2 + have hd : (0 : ℝ) < b₀ - a₀ := by linarith + have hv : ((t : ℝ) - a₀) / (b₀ - a₀) ∈ Set.Icc (0 : ℝ) 1 := + ⟨div_nonneg (by linarith) hd.le, (div_le_one hd).mpr (by linarith)⟩ + refine ⟨⟨_, hv⟩, Subtype.ext ?_⟩ + change (a₀ : ℝ) + ((t : ℝ) - a₀) / (b₀ - a₀) * (b₀ - a₀) = t + field_simp + ring + have hρ0 : ρ 0 = a₀ := Subtype.ext (by simp [ρ]) + have hρ1 : ρ 1 = b₀ := Subtype.ext (by simp [ρ]) + have hρinj : Function.Injective ρ := by + intro v w h + have h₁ : (a₀ : ℝ) + v.1 * (b₀ - a₀) = a₀ + w.1 * (b₀ - a₀) := congrArg Subtype.val h + have hd : ((b₀ : ℝ) - a₀) ≠ 0 := by linarith + exact Subtype.ext (mul_right_cancel₀ hd (add_left_cancel h₁)) + let k : I → S := fun v => γ (ρ v) + have hk : Continuous k := hγ.comp hρ + have hkinj : Function.Injective k := fun v w h => + hρinj (hinj (hIcc (hρIcc v)) (hIcc (hρIcc w)) h) + set F : Set S := γ '' Icc a₀ b₀ with hF + have hFk : F = range k := by + ext x + constructor + · rintro ⟨t, ht, rfl⟩ + obtain ⟨v, rfl⟩ := hρsurj t ht + exact ⟨v, rfl⟩ + · rintro ⟨v, rfl⟩ + exact ⟨ρ v, hρIcc v, rfl⟩ + have hFline : IsLineWithEnds F (γ a₀) (γ b₀) := by + rw [hFk] + refine ⟨Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofInjective k hkinj) + hk.rangeFactorization, ?_, ?_⟩ + · change k 0 = γ a₀ + simp [k, hρ0] + · change k 1 = γ b₀ + simp [k, hρ1] + have hFD : F ⊆ D := by + rintro _ ⟨t, ht, rfl⟩ + rcases eq_or_lt_of_le ht.1 with rfl | h₁ + · exact hamem + rcases eq_or_lt_of_le ht.2 with rfl | h₂ + · exact hbmem + exact hD'D (hIoo t h₁ h₂) + have hst : γ a₀ ≠ γ b₀ := + fun h => hab.ne (hinj (hIcc ⟨le_rfl, hab.le⟩) (hIcc ⟨hab.le, le_rfl⟩) h) + have hFcap : F ∩ discBd D = {γ a₀, γ b₀} := by + rw [← hbdD] + ext x + constructor + · rintro ⟨⟨t, ht, rfl⟩, -, hxD'⟩ + rcases eq_or_lt_of_le ht.1 with rfl | h₁ + · exact Or.inl rfl + rcases eq_or_lt_of_le ht.2 with rfl | h₂ + · exact Or.inr rfl + exact absurd (hIoo t h₁ h₂) hxD' + · rintro (rfl | hx) + · exact ⟨⟨a₀, ⟨le_rfl, hab.le⟩, rfl⟩, hamem, hagamma⟩ + · rw [mem_singleton_iff.mp hx] + exact ⟨⟨b₀, ⟨hab.le, le_rfl⟩, rfl⟩, hbmem, hbgamma⟩ + obtain ⟨A₁, A₂, Δ₁, Δ₂, -, hcomp, hΔ₁, -, hunion, -, hbd₁, -, -⟩ := + disc_iArc D F (γ a₀) (γ b₀) hD hFD hst hFline hFcap + have hA₁ : A₁ ⊆ discBd D := by + have hmem : A₁ ∈ componentsIn (discBd D \ {γ a₀, γ b₀}) := by rw [hcomp]; simp + obtain ⟨x, -, rfl⟩ := hmem + exact (connectedComponentIn_subset _ _).trans sdiff_subset + have hA₁D' : Disjoint A₁ D' := by + refine disjoint_left.mpr fun x hx hx' => ?_ + have := hA₁ hx + rw [← hbdD] at this + exact this.2 hx' + have hFU : F ⊆ H.U := by + rintro _ ⟨t, ht, rfl⟩ + exact (he.2.1 (hγe ▸ mem_image_of_mem γ (hIcc ht))).1 + let Y₁ : Set S := (H.U \ e) ∪ γ '' {t | t ≤ a₀ ∨ b₀ ≤ t} + obtain ⟨hY₁, hpY₁⟩ := GM11.edge_chart_avoidance H he hγ hpe hpiece ha₀ hb₀ + let W : Set S := D' ∩ Y₁ᶜ + have hW : IsOpen W := hD'.inter hY₁.isOpen_compl + have hpW : γ t₀ ∈ W := ⟨hpD', hpY₁⟩ + have hW_Obd : W ⊆ O \ bd S := fun x hx => hD_sub_Obd (hD'D hx.1) + have hin_univ : Δ₁ ⊆ univ \ discBd (univ : Set S) := by + rw [discBd_univ] + intro x hx + exact ⟨mem_univ x, (hD_sub_Obd (hunion ▸ Or.inl hx)).2⟩ + exact ⟨a₀, b₀, W, A₁, Δ₁, ha₀, hb₀, hIcc, hW, hpW, hW_Obd, + hA₁D'.mono_right inter_subset_left, fun _ hx => hDO (hD'D hx.1), fun _ hx => hx.2, + hΔ₁, hin_univ, hbd₁, hFU⟩ + +/-- **A chart around a point of an edge on a closed disc space.** Here `G` maps the closed unit disc +of `ℂ` onto a closed disc around `γ t₀` inside `O \ bd S`. The real part of the disc is the piece +of `e` from `γ a` to `γ b`, and there is no other point of `U(H)` in the disc. -/ +theorem disc_exists_edge_chart (hS : IsClosedDiscSpace S) (H : Drawing S) (hprop : H.IsProper) + {e : Set S} (he : e ∈ H.E) {γ : I → S} (hγ : Continuous γ) (hγ0 : γ 0 ∈ H.V) + (hγ1 : γ 1 ∈ H.V) (hinj : InjOn γ (Ioo 0 1)) (hγe : γ '' Ioo 0 1 = e) + {s t₀ u : I} (ht₀ : t₀ ∈ Ioo (0 : I) 1) (hs : s < t₀) (hu : t₀ < u) + {O : Set S} (hO : IsOpen O) (hpO : γ t₀ ∈ O) : + ∃ (G : ℂ → S) (a b : I), ContinuousOn G (closedBall 0 1) ∧ InjOn G (closedBall 0 1) ∧ + s < a ∧ a < t₀ ∧ t₀ < b ∧ b < u ∧ G 0 = γ t₀ ∧ + G '' closedBall (0 : ℂ) 1 ⊆ O \ bd S ∧ + (∀ z ∈ closedBall (0 : ℂ) 1, G z ∈ H.U ↔ z.im = 0) ∧ + G '' {z | z ∈ ball (0 : ℂ) 1 ∧ z.im = 0} = γ '' Ioo a b ∧ + G '' {z | z ∈ closedBall (0 : ℂ) 1 ∧ z.im = 0} = γ '' Icc a b ∧ + ((G (-1) = γ a ∧ G 1 = γ b) ∨ (G (-1) = γ b ∧ G 1 = γ a)) := by + classical + have hT2 : T2Space S := t2Space_of_isClosedDiscSpace hS + have hpe : γ t₀ ∈ e := hγe ▸ mem_image_of_mem γ ht₀ + have hpiece : ∀ {t : I}, γ t = γ t₀ → t = t₀ := + fun h => GM11.edge_parameter_unique H he hγ0 hγ1 hinj ht₀ hpe h + obtain ⟨a₀, b₀, W, A₁, Δ₁, ha₀, hb₀, hIcc, hW, hpW, hW_Obd, hA₁W, hW₀, hW₁, + hΔ₁, hin_univ, hbd₁, hFU⟩ := + edge_has_collared_disc hS H hprop he hγ hγ0 hγ1 hinj hγe ht₀ hs hu hO hpO + obtain ⟨G, hGc, hGi, hG0, hGW, hreal, hUiff⟩ := + GM11.exists_edge_chart_in_collared_disc H hγe ha₀ hb₀ hW hpW hA₁W hW₁ + hΔ₁ hS.isClosedDisc_univ hin_univ hbd₁ hFU + have hG_Obd := hGW.trans hW_Obd + obtain ⟨a, b, hsa, hat, htb, hbu, hball, hclosed, hends⟩ := + GM11.edge_chart_endpoints hγ hinj hIcc hpiece hGc hGi hG0 hreal + (fun z hz t ht heq => hW₀ (hGW (mem_image_of_mem G hz)) (Or.inr ⟨t, ht, heq⟩)) + exact ⟨G, a, b, hGc, hGi, hsa, hat, htb, hbu, hG0, hG_Obd, hUiff, hball, hclosed, hends⟩ + +/-- An arc `J` in a closed disc space `S` that meets `K ∪ bd S` in at most a single point `v` +does not separate any connected component of `(univ \ bd S) \ K`. -/ +theorem disc_sdiff_arc_connectedComponentIn (hS : IsClosedDiscSpace S) {K J : Set S} {v : S} + (hK : IsClosed K) (hJ : IsLine J) (hJK : J ∩ K ⊆ {v}) (hJbd : J ∩ bd S ⊆ {v}) + {a b : S} (ha : a ∈ (univ \ bd S) \ (K ∪ J)) (hb : b ∈ (univ \ bd S) \ (K ∪ J)) + (hab : b ∈ connectedComponentIn ((univ \ bd S) \ K) a) : + b ∈ connectedComponentIn ((univ \ bd S) \ (K ∪ J)) a := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : CompactSpace S := compactSpace_of_isClosedDiscSpace hS + have hbd_cl : IsClosed (bd S) := isClosed_bd_of_isClosedDiscSpace hS + obtain ⟨h, g, hh, hinj, hg, hmem, hgl, hgr, hbd_img, _, hball_iff⟩ := exists_disc_complex_chart hS + obtain ⟨φ⟩ := hJ + have : CompactSpace J := φ.compactSpace + let fJ : J → h '' J := fun x => ⟨h x.1, x.1, x.2, rfl⟩ + have hfJ_c : Continuous fJ := Continuous.subtype_mk (hh.comp continuous_subtype_val) _ + have hfJ_b : Function.Bijective fJ := by + refine ⟨fun x y hxy => Subtype.ext (hinj (congrArg Subtype.val hxy)), ?_⟩ + rintro ⟨_, x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + let ψJ : I ≃ₜ h '' J := φ.trans (hfJ_c.homeoOfEquivCompactToT2 (f := Equiv.ofBijective fJ hfJ_b)) + let L₁ : Set ℂ := h '' J + let L₂ : Set ℂ := h '' (K ∪ bd S) + have hL₁_comp : IsCompact L₁ := isCompact_iff_compactSpace.mpr ψJ.compactSpace + have hL₂_comp : IsCompact L₂ := ((hK.union hbd_cl).isCompact.image hh) + have h_inter : L₁ ∩ L₂ ⊆ {h v} := by + rw [← image_inter hinj] + rintro _ ⟨x, ⟨hxJ, hxK | hxbd⟩, rfl⟩ + · rw [mem_singleton_iff.mp (hJK ⟨hxJ, hxK⟩)] + exact rfl + · rw [mem_singleton_iff.mp (hJbd ⟨hxJ, hxbd⟩)] + exact rfl + have h_inter_pre : IsPreconnected (L₁ ∩ L₂) := + (subsingleton_singleton.anti h_inter).isPreconnected + have ha_L₁ : h a ∉ L₁ := by + rw [hinj.mem_set_image] + exact fun hJ' => ha.2 (Or.inr hJ') + have hb_L₁ : h b ∉ L₁ := by + rw [hinj.mem_set_image] + exact fun hJ' => hb.2 (Or.inr hJ') + have ha_L₂ : h a ∉ L₂ := by + rw [hinj.mem_set_image] + rintro (hK' | hbd') + · exact ha.2 (Or.inl hK') + · exact ha.1.2 hbd' + have hb_L₂ : h b ∉ L₂ := by + rw [hinj.mem_set_image] + rintro (hK' | hbd') + · exact hb.2 (Or.inl hK') + · exact hb.1.2 hbd' + have hab₁ : h b ∈ connectedComponentIn L₁ᶜ (h a) := by + rw [component_eq_of_arc ψJ ha_L₁ hb_L₁] + exact mem_connectedComponentIn hb_L₁ + have hab₂ : h b ∈ connectedComponentIn L₂ᶜ (h a) := by + let C₀ := connectedComponentIn ((univ \ bd S) \ K) a + have hC₀_pre : IsPreconnected (h '' C₀) := + isPreconnected_connectedComponentIn.image _ hh.continuousOn + have hC₀_sub : h '' C₀ ⊆ L₂ᶜ := by + rintro _ ⟨x, hx, rfl⟩ + have hx' := connectedComponentIn_subset _ _ hx + rw [mem_compl_iff, hinj.mem_set_image] + rintro (hxK | hxbd) + · exact hx'.2 hxK + · exact hx'.1.2 hxbd + have ha_C₀ : h a ∈ h '' C₀ := ⟨a, mem_connectedComponentIn ⟨ha.1, fun hK' => ha.2 + (Or.inl hK')⟩, rfl⟩ + have hb_C₀ : h b ∈ h '' C₀ := ⟨b, hab, rfl⟩ + exact hC₀_pre.subset_connectedComponentIn ha_C₀ hC₀_sub hb_C₀ + have hab₁₂ : h b ∈ connectedComponentIn (L₁ ∪ L₂)ᶜ (h a) := + janiszewski hL₁_comp hL₂_comp h_inter_pre + (fun h' => h'.elim ha_L₁ ha_L₂) (fun h' => h'.elim hb_L₁ hb_L₂) hab₁ hab₂ + let C := connectedComponentIn (L₁ ∪ L₂)ᶜ (h a) + have hC_pre : IsPreconnected C := isPreconnected_connectedComponentIn + have hC_sub_compl : C ⊆ (L₁ ∪ L₂)ᶜ := connectedComponentIn_subset _ _ + have hC_ball : C ⊆ ball (0 : ℂ) 1 := by + refine hC_pre.subset_left_of_subset_union isOpen_ball isClosed_closedBall.isOpen_compl + (disjoint_left.mpr fun z hz₁ hz₂ => hz₂ (ball_subset_closedBall hz₁)) ?_ + ⟨h a, mem_connectedComponentIn (fun h' => h'.elim ha_L₁ ha_L₂), (hball_iff a).mp ha.1.2⟩ + intro z hz + by_cases hlt : ‖z‖ < 1 + · exact Or.inl (mem_ball_zero_iff.mpr hlt) + · refine Or.inr ?_ + rw [mem_compl_iff, mem_closedBall_zero_iff, not_le] + refine lt_of_le_of_ne (not_lt.mp hlt) fun heq => ?_ + have hsph : z ∈ sphere (0 : ℂ) 1 := mem_sphere_zero_iff_norm.mpr heq.symm + rw [← hbd_img] at hsph + obtain ⟨x, hxbd, rfl⟩ := hsph + exact hC_sub_compl hz (Or.inr ⟨x, Or.inr hxbd, rfl⟩) + have hC_cb : C ⊆ closedBall (0 : ℂ) 1 := hC_ball.trans ball_subset_closedBall + have hgC_pre : IsPreconnected (g '' C) := + hC_pre.image g (hg.mono hC_cb) + have hgC_sub : g '' C ⊆ (univ \ bd S) \ (K ∪ J) := by + rintro _ ⟨z, hz, rfl⟩ + have hgz : h (g z) = z := hgr z (hC_cb hz) + have hz_compl := hC_sub_compl hz + refine ⟨⟨mem_univ _, fun hbd' => hz_compl (Or.inr ⟨g z, Or.inr hbd', hgz⟩)⟩, ?_⟩ + rintro (hK' | hJ') + · exact hz_compl (Or.inr ⟨g z, Or.inl hK', hgz⟩) + · exact hz_compl (Or.inl ⟨g z, hJ', hgz⟩) + have ha_gC : a ∈ g '' C := + ⟨h a, mem_connectedComponentIn (fun h' => h'.elim ha_L₁ ha_L₂), hgl a⟩ + have hb_gC : b ∈ g '' C := ⟨h b, hab₁₂, hgl b⟩ + exact hgC_pre.subset_connectedComponentIn ha_gC hgC_sub hb_gC + +end GraphMinor.GM06 diff --git a/LeanPool/GraphMinor/GM06/Euler.lean b/LeanPool/GraphMinor/GM06/Euler.lean new file mode 100644 index 0000000000..09feeffe3c --- /dev/null +++ b/LeanPool/GraphMinor/GM06/Euler.lean @@ -0,0 +1,1695 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.EdgeChart +public import LeanPool.GraphMinor.GM06.Section3Main + +/-! +# Region Counting and Dual Region Separation on a Closed Disc Space + +This file proves the region-counting inequalities for proper drawings on a closed disc space `S` +(`IsClosedDiscSpace S`) and deduces that for any connected proper drawing `G` on `S` and any +drawing `G_dual` satisfying the remaining properties of `IsDiscDualDrawing G G_dual`, distinct +vertices `v₁ ≠ v₂ ∈ G.V` lie in distinct regions of `G_dual`. +-/ + +public section + +namespace GraphMinor.GM06 + +open Set Function Topology Metric unitInterval Complex GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-! ## 1. Region Deletion Identities -/ + +/-- For an edge `e ∈ Γ.E` of a proper drawing `Γ` on a closed disc space `S`, `e` lies in a single +region `r₀'` of `Γ.deleteEdge e`, and every region `r' ≠ r₀'` of `Γ.deleteEdge e` is a region of +`Γ` whose closure is disjoint from `e`. -/ +theorem region_of_deleteEdge_sdiff (hS : IsClosedDiscSpace S) {Γ : Drawing S} + (_hprop : Γ.IsProper) {e : Set S} (he : e ∈ Γ.E) {p : S} (hp : p ∈ e) : + let r₀' := connectedComponentIn (univ \ (Γ.deleteEdge e).U) p + r₀' ∈ (Γ.deleteEdge e).R ∧ e ⊆ r₀' ∧ + ∀ r' ∈ (Γ.deleteEdge e).R, r' ≠ r₀' → r' ∈ Γ.R ∧ Disjoint e (closure r') := by + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + dsimp only + set Γ' := Γ.deleteEdge e + set r₀' := connectedComponentIn (univ \ Γ'.U) p + have hUe : Γ'.U = Γ.U \ e := deleteEdge_U Γ he + have hp_compl : p ∈ univ \ Γ'.U := by + rw [hUe] + exact ⟨mem_univ p, fun h => h.2 hp⟩ + have hr₀' : r₀' ∈ Γ'.R := ⟨p, hp_compl, rfl⟩ + have he_conn : IsPreconnected e := he.2.2.1.isConnected.isPreconnected + have he_sub_compl : e ⊆ univ \ Γ'.U := by + rw [hUe] + exact fun x hx => ⟨mem_univ x, fun h => h.2 hx⟩ + have he_r₀' : e ⊆ r₀' := + he_conn.subset_connectedComponentIn hp he_sub_compl + refine ⟨hr₀', he_r₀', fun r' hr' hne => ?_⟩ + have hdisj_r₀' : Disjoint r' r₀' := by + refine disjoint_left.mpr fun x hxr' hxr₀' => hne ?_ + exact region_eq_of_mem hr' hr₀' hxr' hxr₀' + have hdisj_e : Disjoint r' e := hdisj_r₀'.mono_right he_r₀' + have hdisj_cl : Disjoint e (closure r') := by + refine disjoint_left.mpr fun x hxe hxcl => ?_ + obtain ⟨y, hyr₀', hyr'⟩ := + mem_closure_iff.mp hxcl r₀' (region_isOpen hr₀') (he_r₀' hxe) + exact disjoint_left.mp hdisj_r₀' hyr' hyr₀' + have hr'_sub : r' ⊆ univ \ Γ.U := by + intro x hx + have hx' : x ∉ Γ'.U := region_subset hr' hx + rw [hUe] at hx' + exact ⟨mem_univ x, fun hxU => hx' ⟨hxU, disjoint_left.mp hdisj_e hx⟩⟩ + obtain ⟨x₀, hx₀⟩ := region_nonempty hr' + have hr'_mem : r' ∈ Γ.R := by + refine (mem_R_iff Γ).mpr ⟨x₀, (hr'_sub hx₀).2, subset_antisymm ?_ ?_⟩ + · exact (region_isPreconnected hr').subset_connectedComponentIn hx₀ hr'_sub + · have hsub := deleteEdge_isSubdrawing Γ e + have h_sub_r' : connectedComponentIn (univ \ Γ.U) x₀ ⊆ + connectedComponentIn (univ \ Γ'.U) x₀ := + isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn (hr'_sub hx₀)) + (fun y hy => ⟨mem_univ y, fun hyU' => + (connectedComponentIn_subset _ _ hy).2 (hsub.U_subset hyU')⟩) + obtain ⟨z, -, rfl⟩ := (mem_R_iff Γ').mp hr' + rwa [connectedComponentIn_eq hx₀] + exact ⟨hr'_mem, hdisj_cl⟩ + +/-- For any edge `e ∈ Γ.E` of a proper drawing `Γ` on a closed disc space `S`, there is a region +`r₀' ∈ (Γ.deleteEdge e).R` containing `e` and two regions `r₁, r₂ ∈ Γ.R` with `e ⊆ closure r₁` and +`e ⊆ closure r₂` such that `(Γ.deleteEdge e).R \ {r₀'} = Γ.R \ {r₁, r₂}`, and every region +`r ∈ Γ.R` with `e ⊆ closure r` equals `r₁` or `r₂`. -/ +theorem exists_deleteEdge_R_sdiff_eq (hS : IsClosedDiscSpace S) {Γ : Drawing S} + (hprop : Γ.IsProper) {e : Set S} (he : e ∈ Γ.E) : + ∃ r₀' ∈ (Γ.deleteEdge e).R, ∃ r₁ ∈ Γ.R, ∃ r₂ ∈ Γ.R, + e ⊆ r₀' ∧ e ⊆ closure r₁ ∧ e ⊆ closure r₂ ∧ + (∀ r ∈ Γ.R, e ⊆ closure r → r = r₁ ∨ r = r₂) ∧ + (Γ.deleteEdge e).R \ {r₀'} = Γ.R \ {r₁, r₂} := by + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + obtain ⟨p, hp⟩ := he.1 + obtain ⟨hr₀', he_r₀', hother⟩ := region_of_deleteEdge_sdiff hS hprop he hp + set Γ' := Γ.deleteEdge e + set r₀' := connectedComponentIn (univ \ Γ'.U) p + obtain ⟨W, A₁, A₂, hW, hpW, -, hsub, c₁, c₂, d₁, d₂, cl₁, cl₂⟩ := + disc_exists_edge_sides hS Γ hprop he hp + have hA₁_ne : A₁.Nonempty := by + by_contra hcon + rw [not_nonempty_iff_eq_empty] at hcon + have := cl₁ ⟨hp, hpW⟩ + rw [hcon, closure_empty] at this + exact this + have hA₂_ne : A₂.Nonempty := by + by_contra hcon + rw [not_nonempty_iff_eq_empty] at hcon + have := cl₂ ⟨hp, hpW⟩ + rw [hcon, closure_empty] at this + exact this + obtain ⟨x₁, hx₁⟩ := hA₁_ne + obtain ⟨x₂, hx₂⟩ := hA₂_ne + obtain ⟨r₁, hr₁, hxr₁⟩ := exists_region_of_notMem (disjoint_left.mp d₁ hx₁) + obtain ⟨r₂, hr₂, hxr₂⟩ := exists_region_of_notMem (disjoint_left.mp d₂ hx₂) + have hA₁_r₁ : A₁ ⊆ r₁ := subset_region hr₁ c₁ d₁ hx₁ hxr₁ + have hA₂_r₂ : A₂ ⊆ r₂ := subset_region hr₂ c₂ d₂ hx₂ hxr₂ + have hi₁ : e ⊆ closure r₁ := + disc_edge_subset_closure_of_incident hS hprop he hr₁ + ⟨p, hp, closure_mono hA₁_r₁ (cl₁ ⟨hp, hpW⟩)⟩ + have hi₂ : e ⊆ closure r₂ := + disc_edge_subset_closure_of_incident hS hprop he hr₂ + ⟨p, hp, closure_mono hA₂_r₂ (cl₂ ⟨hp, hpW⟩)⟩ + have hall_inc : ∀ r ∈ Γ.R, e ⊆ closure r → r = r₁ ∨ r = r₂ := by + intro r hr hi + obtain ⟨x, hxW, hxr⟩ := mem_closure_iff.mp (hi hp) W hW hpW + rcases hsub ⟨hxW, region_subset hr hxr⟩ with hx | hx + · exact Or.inl (region_eq_of_mem hr hr₁ hxr (hA₁_r₁ hx)) + · exact Or.inr (region_eq_of_mem hr hr₂ hxr (hA₂_r₂ hx)) + refine ⟨r₀', hr₀', r₁, hr₁, r₂, hr₂, he_r₀', hi₁, hi₂, hall_inc, ?_⟩ + ext r + simp only [mem_sdiff, mem_singleton_iff, mem_insert_iff, not_or] + constructor + · rintro ⟨hr', hne⟩ + obtain ⟨hr, hdisj⟩ := hother r hr' hne + refine ⟨hr, ?_, ?_⟩ + · rintro rfl + exact disjoint_left.mp hdisj hp (hi₁ hp) + · rintro rfl + exact disjoint_left.mp hdisj hp (hi₂ hp) + · rintro ⟨hr, hne₁, hne₂⟩ + rcases disc_edge_incident_or_disjoint hS hprop he hr with hinc | hdisj + · rcases hall_inc r hr hinc with rfl | rfl + · exact (hne₁ rfl).elim + · exact (hne₂ rfl).elim + · refine ⟨region_deleteEdge_of_not_incident he hr hdisj, ?_⟩ + rintro rfl + exact region_subset hr (he_r₀' hp) (he.2.1 hp).1 + +/-- Deleting an edge reduces the number of regions by at most `1`: +`Γ.R.ncard ≤ (Γ.deleteEdge e).R.ncard + 1`. -/ +theorem deleteEdge_R_ncard_le (hS : IsClosedDiscSpace S) {Γ : Drawing S} + (hprop : Γ.IsProper) {e : Set S} (he : e ∈ Γ.E) : + Γ.R.ncard ≤ (Γ.deleteEdge e).R.ncard + 1 := by + obtain ⟨r₀', hr₀', r₁, hr₁, r₂, hr₂, -, -, -, -, hdiff⟩ := + exists_deleteEdge_R_sdiff_eq hS hprop he + have hfin : Γ.R.Finite := disc_finite_R hS Γ hprop + have hfin' : (Γ.deleteEdge e).R.Finite := + disc_finite_R hS (Γ.deleteEdge e) (deleteEdge_isProper hprop e) + have h₁ : ((Γ.deleteEdge e).R \ {r₀'}).ncard + 1 = (Γ.deleteEdge e).R.ncard := + ncard_sdiff_singleton_add_one hr₀' hfin' + have hsub : Γ.R ⊆ insert r₁ (insert r₂ (Γ.R \ {r₁, r₂})) := by + intro r hr + by_cases h1 : r = r₁ + · exact Or.inl h1 + · by_cases h2 : r = r₂ + · exact Or.inr (Or.inl h2) + · exact Or.inr (Or.inr ⟨hr, fun h => h.elim h1 h2⟩) + have h₂ : Γ.R.ncard ≤ (insert r₁ (insert r₂ (Γ.R \ {r₁, r₂}))).ncard := + ncard_le_ncard hsub (((hfin.subset sdiff_subset).insert r₂).insert r₁) + have h₃ : (insert r₁ (insert r₂ (Γ.R \ {r₁, r₂}))).ncard ≤ + (insert r₂ (Γ.R \ {r₁, r₂})).ncard + 1 := ncard_insert_le _ _ + have h₄ : (insert r₂ (Γ.R \ {r₁, r₂})).ncard ≤ (Γ.R \ {r₁, r₂}).ncard + 1 := + ncard_insert_le _ _ + have h₅ : (Γ.R \ {r₁, r₂}).ncard = ((Γ.deleteEdge e).R \ {r₀'}).ncard := + congrArg Set.ncard hdiff.symm + omega + +/-- If an edge `e ∈ Γ.E` is incident with two distinct regions `ra ≠ rb ∈ Γ.R`, then +`Γ.R.ncard = (Γ.deleteEdge e).R.ncard + 1`. -/ +theorem deleteEdge_R_ncard_eq_add_one_of_two_regions (hS : IsClosedDiscSpace S) {Γ : Drawing S} + (hprop : Γ.IsProper) {e ra rb : Set S} (he : e ∈ Γ.E) + (hra : ra ∈ Γ.R) (hrb : rb ∈ Γ.R) (hne : ra ≠ rb) + (hia : e ⊆ closure ra) (hib : e ⊆ closure rb) : + Γ.R.ncard = (Γ.deleteEdge e).R.ncard + 1 := by + obtain ⟨r₀', hr₀', r₁, hr₁, r₂, hr₂, -, _, _, hall, hdiff⟩ := + exists_deleteEdge_R_sdiff_eq hS hprop he + have hfin : Γ.R.Finite := disc_finite_R hS Γ hprop + have hfin' : (Γ.deleteEdge e).R.Finite := + disc_finite_R hS (Γ.deleteEdge e) (deleteEdge_isProper hprop e) + have h₁ : ((Γ.deleteEdge e).R \ {r₀'}).ncard + 1 = (Γ.deleteEdge e).R.ncard := + ncard_sdiff_singleton_add_one hr₀' hfin' + have hr₁₂_ne : r₁ ≠ r₂ := by + intro heq + subst heq + have ha1 : ra = r₁ := (hall ra hra hia).elim id id + have hb1 : rb = r₁ := (hall rb hrb hib).elim id id + exact hne (ha1.trans hb1.symm) + have h₂ : (Γ.R \ {r₁, r₂}).ncard + 2 = Γ.R.ncard := by + have h_eq : Γ.R \ {r₁, r₂} = (Γ.R \ {r₂}) \ {r₁} := by + ext r + simp only [mem_sdiff, mem_insert_iff, mem_singleton_iff, not_or] + tauto + have hr₁_mem : r₁ ∈ Γ.R \ {r₂} := ⟨hr₁, hr₁₂_ne⟩ + have ha := ncard_sdiff_singleton_add_one hr₁_mem (hfin.subset sdiff_subset) + have hb := ncard_sdiff_singleton_add_one hr₂ hfin + rw [h_eq] + omega + rw [hdiff] at h₁ + omega + +/-! ## 2. Preconnectivity of `O \ bd S` and Region Separation by Redundant Edges -/ + +omit [T2Space S] in +/-- For any open preconnected set `O ⊆ S` in a closed disc space `S`, `O \ bd S` is +preconnected. -/ +theorem isPreconnected_sdiff_bd_of_isOpen (hS : IsClosedDiscSpace S) {O : Set S} + (hO : IsOpen O) (hOc : IsPreconnected O) : IsPreconnected (O \ bd S) := by + intro U V hU hV hcov ⟨a, haO, haU⟩ ⟨b, hbO, hbV⟩ + by_contra hdisj + rw [not_nonempty_iff_eq_empty] at hdisj + have hlocal : ∀ x ∈ O, ∃ Z : Set S, IsOpen Z ∧ x ∈ Z ∧ Z ⊆ O ∧ IsPreconnected (Z \ bd S) := by + intro x hx + obtain ⟨φ⟩ := hS + have hbd_img := image_bd_homeomorph φ + rw [bd_closedUnitDisc] at hbd_img + let c : ClosedUnitDisc := φ.symm x + have hc_in : c ∈ φ ⁻¹' O := by + change φ c ∈ O + rw [φ.apply_symm_apply] + exact hx + have hP_open : IsOpen (φ ⁻¹' O) := hO.preimage φ.continuous + rw [isOpen_induced_iff] at hP_open + obtain ⟨W, hW_open, hW_eq⟩ := hP_open + have hcW : c.1 ∈ W := by + have : c ∈ Subtype.val ⁻¹' W := by rwa [hW_eq] + exact this + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp hW_open c.1 hcW + let B : Set ClosedUnitDisc := Subtype.val ⁻¹' Metric.ball c.1 δ + have hB_open : IsOpen B := Metric.isOpen_ball.preimage continuous_subtype_val + let U_open : Set EuclideanPlane := Metric.ball c.1 δ ∩ OpenUnitDisc + have hU_sub : U_open ⊆ ClosedUnitDisc := + fun y hy => Metric.ball_subset_closedBall hy.2 + let B_int : Set ClosedUnitDisc := Subtype.val ⁻¹' U_open + have hB_int_conn : IsPreconnected B_int := by + refine (IsInducing.subtypeVal : + IsInducing (Subtype.val : ClosedUnitDisc → EuclideanPlane)).isPreconnected_image.mp ?_ + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hU_sub] + exact ((convex_ball _ _).inter convex_openUnitDisc).isPreconnected + have hZ_diff : (φ '' B) \ bd S = φ '' B_int := by + ext q + constructor + · rintro ⟨⟨y, hy, rfl⟩, hq_bd⟩ + refine ⟨y, ⟨hy, ?_⟩, rfl⟩ + have hle : ‖y.1‖ ≤ 1 := mem_closedBall_zero_iff.mp y.2 + have hne : ‖y.1‖ ≠ 1 := by + intro h1 + apply hq_bd + rw [← hbd_img] + exact ⟨y, by simpa [UnitCircle] using h1, rfl⟩ + simpa [OpenUnitDisc] using lt_of_le_of_ne hle hne + · rintro ⟨y, ⟨hy1, hy2⟩, rfl⟩ + refine ⟨⟨y, hy1, rfl⟩, ?_⟩ + rw [← hbd_img] + rintro ⟨z, hz, hφz⟩ + have hzy : z = y := φ.injective hφz + subst hzy + have h1 : ‖z.1‖ < 1 := by simpa [OpenUnitDisc] using hy2 + have h2 : ‖z.1‖ = 1 := by simpa [UnitCircle] using hz + linarith + refine ⟨φ '' B, φ.isOpenMap _ hB_open, ⟨c, Metric.mem_ball_self hδ, φ.apply_symm_apply x⟩, + ?_, ?_⟩ + · rintro _ ⟨y, hy, rfl⟩ + have hyW : y.1 ∈ W := hball hy + have hyP : y ∈ φ ⁻¹' O := by rw [← hW_eq]; exact hyW + exact hyP + · rw [hZ_diff] + exact hB_int_conn.image _ φ.continuous.continuousOn + let U' : Set S := {x ∈ O | ∃ Z, IsOpen Z ∧ x ∈ Z ∧ Z ⊆ O ∧ Z \ bd S ⊆ U} + let V' : Set S := {x ∈ O | ∃ Z, IsOpen Z ∧ x ∈ Z ∧ Z ⊆ O ∧ Z \ bd S ⊆ V} + have hU'_open : IsOpen U' := by + rw [isOpen_iff_mem_nhds] + rintro x ⟨_, Z, hZ, hxZ, hZO, hZU⟩ + filter_upwards [hZ.mem_nhds hxZ] with y hy + exact ⟨hZO hy, Z, hZ, hy, hZO, hZU⟩ + have hV'_open : IsOpen V' := by + rw [isOpen_iff_mem_nhds] + rintro x ⟨_, Z, hZ, hxZ, hZO, hZV⟩ + filter_upwards [hZ.mem_nhds hxZ] with y hy + exact ⟨hZO hy, Z, hZ, hy, hZO, hZV⟩ + have hO_cov : O ⊆ U' ∪ V' := by + intro x hx + obtain ⟨Z, hZ, hxZ, hZO, hZ_conn⟩ := hlocal x hx + have hZ_sub : Z \ bd S ⊆ U ∪ V := fun y hy => hcov ⟨hZO hy.1, hy.2⟩ + by_cases hZU : Z \ bd S ⊆ U + · exact Or.inl ⟨hx, Z, hZ, hxZ, hZO, hZU⟩ + · refine Or.inr ⟨hx, Z, hZ, hxZ, hZO, fun y hy => ?_⟩ + rcases hZ_sub hy with hyU | hyV + · obtain ⟨z, hzZ, hzU⟩ := not_subset.mp hZU + have hzV : z ∈ V := (hZ_sub hzZ).resolve_left hzU + obtain ⟨w, hwZ, hwUV⟩ := hZ_conn U V hU hV hZ_sub ⟨y, hy, hyU⟩ ⟨z, hzZ, hzV⟩ + have hw_in : w ∈ (O \ bd S) ∩ (U ∩ V) := ⟨⟨hZO hwZ.1, hwZ.2⟩, hwUV⟩ + rw [hdisj] at hw_in + exact hw_in.elim + · exact hyV + have hbd_cl : IsClosed (bd S) := isClosed_bd_of_isClosedDiscSpace hS + have ha_U' : a ∈ O ∩ U' := by + refine ⟨haO.1, haO.1, (O \ bd S) ∩ U, (hO.sdiff hbd_cl).inter hU, ⟨haO, haU⟩, + fun y hy => hy.1.1, fun y hy => hy.1.2⟩ + have hb_V' : b ∈ O ∩ V' := by + refine ⟨hbO.1, hbO.1, (O \ bd S) ∩ V, (hO.sdiff hbd_cl).inter hV, ⟨hbO, hbV⟩, + fun y hy => hy.1.1, fun y hy => hy.1.2⟩ + obtain ⟨x, hxO, ⟨_, Z₁, hZ₁, hxZ₁, hZ₁O, hZ₁U⟩, ⟨_, Z₂, hZ₂, hxZ₂, _, hZ₂V⟩⟩ := + hOc U' V' hU'_open hV'_open hO_cov ⟨a, ha_U'⟩ ⟨b, hb_V'⟩ + obtain ⟨y, ⟨hy1, hy2⟩, hy_bd⟩ := + open_sdiff_bd_nonempty hS (hZ₁.inter hZ₂) ⟨x, hxZ₁, hxZ₂⟩ + have hy_in : y ∈ (O \ bd S) ∩ (U ∩ V) := + ⟨⟨hZ₁O hy1, hy_bd⟩, hZ₁U ⟨hy1, hy_bd⟩, hZ₂V ⟨hy2, hy_bd⟩⟩ + rw [hdisj] at hy_in + exact hy_in + +omit [T2Space S] in +/-- Any two points `a, b ∈ r \ bd S` of a region `r ∈ Γ.R` lie in the same connected component of +`(univ \ bd S) \ Γ.U`. -/ +theorem mem_connectedComponentIn_sdiff_bd_of_region (hS : IsClosedDiscSpace S) {Γ : Drawing S} + {r : Set S} (hr : r ∈ Γ.R) {a b : S} (ha : a ∈ r \ bd S) (hb : b ∈ r \ bd S) : + b ∈ connectedComponentIn ((univ \ bd S) \ Γ.U) a := by + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + have hconn : IsPreconnected (r \ bd S) := + isPreconnected_sdiff_bd_of_isOpen hS (region_isOpen hr) (region_isPreconnected hr) + refine hconn.subset_connectedComponentIn ha ?_ hb + intro x hx + exact ⟨⟨mem_univ x, hx.2⟩, region_subset hr hx.1⟩ + +/-- In the closed unit disc of `ℂ`, if `φ : ℂ → ℂ` is continuous and injective on +`closedBall (0 : ℂ) 1` and `K_out ⊆ ℂ` is a compact preconnected set disjoint from +`φ '' ball (0 : ℂ) 1` containing `φ (-1)` and `φ 1`, then `φ (Complex.I / 2)` and `φ (-Complex.I / +2)` do not lie +in the same connected component of `(φ '' {z ∈ closedBall 0 1 | z.im = 0} ∪ K_out)ᶜ`. -/ +theorem not_mem_connectedComponentIn_of_chart_loop {φ : ℂ → ℂ} {K_out : Set ℂ} + (hφc : ContinuousOn φ (closedBall (0 : ℂ) 1)) (hφi : InjOn φ (closedBall (0 : ℂ) 1)) + (hK_comp : IsCompact K_out) (hK_pre : IsPreconnected K_out) + (hK_disj : Disjoint K_out (φ '' ball (0 : ℂ) 1)) + (hm1 : φ (-1) ∈ K_out) (hp1 : φ 1 ∈ K_out) : + let K_in := φ '' {z : ℂ | z ∈ closedBall (0 : ℂ) 1 ∧ z.im = 0} + φ (-Complex.I / 2) ∉ connectedComponentIn (K_in ∪ K_out)ᶜ (φ (Complex.I / 2)) := by + intro K_in hab + let p_pos : ℂ := φ (Complex.I / 2) + let p_neg : ℂ := φ (-Complex.I / 2) + have hI2_ball : (Complex.I / 2 : ℂ) ∈ ball (0 : ℂ) 1 := by + rw [mem_ball_zero_iff, norm_div, norm_I, RCLike.norm_ofNat] + norm_num + have hmI2_ball : (-Complex.I / 2 : ℂ) ∈ ball (0 : ℂ) 1 := by + rw [mem_ball_zero_iff, norm_div, norm_neg, norm_I, RCLike.norm_ofNat] + norm_num + have hI2_cb : (Complex.I / 2 : ℂ) ∈ closedBall (0 : ℂ) 1 := ball_subset_closedBall hI2_ball + have hmI2_cb : (-Complex.I / 2 : ℂ) ∈ closedBall (0 : ℂ) 1 := ball_subset_closedBall hmI2_ball + have h1_cb : (1 : ℂ) ∈ closedBall (0 : ℂ) 1 := by simp + have hm1_cb : (-1 : ℂ) ∈ closedBall (0 : ℂ) 1 := by simp + have hp_not_Kin : p_pos ∉ K_in := by + rintro ⟨z, ⟨hz, hzim⟩, hz_eq⟩ + have := hφi hz hI2_cb hz_eq + subst this + simp at hzim + have hm_not_Kin : p_neg ∉ K_in := by + rintro ⟨z, ⟨hz, hzim⟩, hz_eq⟩ + have := hφi hz hmI2_cb hz_eq + subst this + simp at hzim + have hp_not_Kout : p_pos ∉ K_out := + fun h => disjoint_left.mp hK_disj h ⟨Complex.I / 2, hI2_ball, rfl⟩ + have hm_not_Kout : p_neg ∉ K_out := + fun h => disjoint_left.mp hK_disj h ⟨-Complex.I / 2, hmI2_ball, rfl⟩ + have hKin_comp : IsCompact K_in := by + have hcl : IsClosed {z : ℂ | z ∈ closedBall (0 : ℂ) 1 ∧ z.im = 0} := + isClosed_closedBall.inter (isClosed_eq Complex.continuous_im continuous_const) + exact ( (isCompact_closedBall (0 : ℂ) 1).inter_right + (isClosed_eq Complex.continuous_im continuous_const) ).image_of_continuousOn + (hφc.mono fun _ h => h.1) + have hlog₁ : HasLogOn (K_in ∪ K_out) (fun z => (z - p_neg) / (z - p_pos)) := + hasLogOn_div_of_same_component (hKin_comp.union hK_comp).isClosed + (fun h => h.elim hp_not_Kin hp_not_Kout) hab + let R₀ : Set ℂ := {z : ℂ | z ∈ sphere (0 : ℂ) 1 ∧ 0 ≤ z.im} + let R_pos : Set ℂ := φ '' R₀ + have hR₀_sub : R₀ ⊆ closedBall (0 : ℂ) 1 := fun z hz => sphere_subset_closedBall hz.1 + have hR₀_comp : IsCompact R₀ := + (isCompact_sphere (0 : ℂ) 1).inter_right (isClosed_le continuous_const Complex.continuous_im) + have hR_comp : IsCompact R_pos := hR₀_comp.image_of_continuousOn (hφc.mono hR₀_sub) + have hR_disj : Disjoint R_pos (φ '' ball (0 : ℂ) 1) := by + refine disjoint_left.mpr ?_ + rintro _ ⟨z, hz, rfl⟩ ⟨w, hw, hwz⟩ + have heq := hφi (hR₀_sub hz) (ball_subset_closedBall hw) hwz.symm + subst heq + have h1 : ‖z‖ = 1 := mem_sphere_zero_iff_norm.mp hz.1 + have h2 : ‖z‖ < 1 := mem_ball_zero_iff.mp hw + linarith + have hp_not_R : p_pos ∉ R_pos := + fun h => disjoint_left.mp hR_disj h ⟨Complex.I / 2, hI2_ball, rfl⟩ + have hm_not_R : p_neg ∉ R_pos := + fun h => disjoint_left.mp hR_disj h ⟨-Complex.I / 2, hmI2_ball, rfl⟩ + have hab_R : p_neg ∈ connectedComponentIn (K_out ∪ R_pos)ᶜ p_pos := by + let seg : Set ℂ := segment ℝ (Complex.I / 2 : ℂ) (-Complex.I / 2) + have hseg_ball : seg ⊆ ball (0 : ℂ) 1 := + (convex_ball (0 : ℂ) 1).segment_subset hI2_ball hmI2_ball + have hseg_pre : IsPreconnected (φ '' seg) := + (convex_segment (Complex.I / 2 : ℂ) (-Complex.I / 2)).isPreconnected.image φ + (hφc.mono (hseg_ball.trans ball_subset_closedBall)) + have hseg_sub : φ '' seg ⊆ (K_out ∪ R_pos)ᶜ := by + rintro _ ⟨z, hz, rfl⟩ + rintro (hK | hR) + · exact disjoint_left.mp hK_disj hK ⟨z, hseg_ball hz, rfl⟩ + · exact disjoint_left.mp hR_disj hR ⟨z, hseg_ball hz, rfl⟩ + exact hseg_pre.subset_connectedComponentIn + ⟨Complex.I / 2, left_mem_segment ℝ _ _, rfl⟩ hseg_sub ⟨-Complex.I / 2, right_mem_segment ℝ _ + _, rfl⟩ + have hlog₂ : HasLogOn (K_out ∪ R_pos) (fun z => (z - p_neg) / (z - p_pos)) := + hasLogOn_div_of_same_component (hK_comp.union hR_comp).isClosed + (fun h => h.elim hp_not_Kout hp_not_R) hab_R + obtain ⟨g₁, hg₁c, hg₁⟩ := hlog₁ + obtain ⟨g₂, hg₂c, hg₂⟩ := hlog₂ + dsimp only at hg₁ hg₂ + have hnz : ∀ x ∈ K_out, (x - p_neg) / (x - p_pos) ≠ 0 := by + intro x hx + rw [hg₂ x (Or.inl hx)] + exact exp_ne_zero _ + have hexp : ∀ x ∈ K_out, exp (g₁ x - g₂ x) = 1 := by + intro x hx + rw [exp_sub, ← hg₁ x (Or.inr hx), ← hg₂ x (Or.inl hx)] + exact div_self (hnz x hx) + have hconstant : ∀ x ∈ K_out, g₁ x - g₂ x = g₁ (φ (-1)) - g₂ (φ (-1)) := fun x hx => + eq_of_exp_eq_one hK_pre + ((hg₁c.mono subset_union_right).sub (hg₂c.mono subset_union_left)) hexp hx hm1 + set c := g₁ (φ (-1)) - g₂ (φ (-1)) + have hc_exp : exp c = 1 := hexp (φ (-1)) hm1 + have hKin_R_inter : K_in ∩ R_pos ⊆ K_out := by + rintro _ ⟨⟨z, ⟨hz, hzim⟩, rfl⟩, ⟨w, ⟨hw, _⟩, hwz⟩⟩ + have heq := hφi hz (sphere_subset_closedBall hw) hwz.symm + subst heq + have hnorm : ‖z‖ = 1 := mem_sphere_zero_iff_norm.mp hw + have hre_sq : z.re ^ 2 = 1 := by + have hsq := Complex.sq_norm z + rw [hnorm, one_pow, Complex.normSq_apply, hzim] at hsq + linarith + rcases sq_eq_one_iff.mp hre_sq with hre | hre + · have hz1 : z = 1 := Complex.ext (by simpa using hre) (by simpa using hzim) + rw [hz1] + exact hp1 + · have hzm1 : z = -1 := Complex.ext (by simpa using hre) (by simpa using hzim) + rw [hzm1] + exact hm1 + have hlogF : HasLogOn (K_in ∪ R_pos) (fun z => (z - p_neg) / (z - p_pos)) := by + refine hasLogOn_union (gA := g₁) (gB := fun z => g₂ z + c) + hKin_comp.isClosed hR_comp.isClosed + (hg₁c.mono subset_union_left) ((hg₂c.mono subset_union_right).add continuousOn_const) + (fun z hz => hg₁ z (Or.inl hz)) + (fun z hz => by rw [exp_add, hc_exp, mul_one]; exact hg₂ z (Or.inr hz)) + fun z hz => ?_ + have := hconstant z (hKin_R_inter hz) + dsimp [c] + linear_combination this + let U₀ : Set ℂ := {z : ℂ | z ∈ ball (0 : ℂ) 1 ∧ 0 < z.im} + have hU₀_open : IsOpen U₀ := + isOpen_ball.inter (isOpen_lt continuous_const Complex.continuous_im) + have hU₀_sub : U₀ ⊆ closedBall (0 : ℂ) 1 := fun z hz => ball_subset_closedBall hz.1 + let U : Set ℂ := φ '' U₀ + have hU_open : IsOpen U := + isOpen_image_of_injOn hU₀_open (hφc.mono hU₀_sub) (hφi.mono hU₀_sub) + let D₀ : Set ℂ := {z : ℂ | z ∈ closedBall (0 : ℂ) 1 ∧ 0 ≤ z.im} + have hD₀_comp : IsCompact D₀ := + (isCompact_closedBall (0 : ℂ) 1).inter_right (isClosed_le continuous_const + Complex.continuous_im) + have hD_comp : IsCompact (φ '' D₀) := + hD₀_comp.image_of_continuousOn (hφc.mono fun _ h => h.1) + have hU_bdd : Bornology.IsBounded U := + hD_comp.isBounded.subset (image_mono fun z hz => ⟨ball_subset_closedBall hz.1, hz.2.le⟩) + have hp_in_U : p_pos ∈ U := ⟨Complex.I / 2, ⟨hI2_ball, by simp⟩, rfl⟩ + have hcl_U_sub : closure U ⊆ φ '' D₀ := + hD_comp.isClosed.closure_subset_iff.mpr + (image_mono fun z hz => ⟨ball_subset_closedBall hz.1, hz.2.le⟩) + have hm_not_clU : p_neg ∉ closure U := by + intro hcl + obtain ⟨z, hz, hzeq⟩ := hcl_U_sub hcl + have heq := hφi hz.1 hmI2_cb hzeq + subst heq + have : (0 : ℝ) ≤ (-Complex.I / 2 : ℂ).im := hz.2 + simp at this + linarith + have hfront_sub : frontier U ⊆ K_in ∪ R_pos := by + rw [hU_open.frontier_eq] + rintro w ⟨hw_cl, hw_not_U⟩ + obtain ⟨z, ⟨hz_cb, hz_im⟩, rfl⟩ := hcl_U_sub hw_cl + rcases eq_or_lt_of_le hz_im with hzim0 | hzim_pos + · exact Or.inl ⟨z, ⟨hz_cb, hzim0.symm⟩, rfl⟩ + · have hznorm : ‖z‖ = 1 := by + have hle : ‖z‖ ≤ 1 := mem_closedBall_zero_iff.mp hz_cb + refine le_antisymm hle (not_lt.mp fun hlt => hw_not_U ?_) + exact ⟨z, ⟨mem_ball_zero_iff.mpr hlt, hzim_pos⟩, rfl⟩ + exact Or.inr ⟨z, ⟨mem_sphere_zero_iff_norm.mpr hznorm, hz_im⟩, rfl⟩ + have hlog_inv : HasLogOn (frontier U) (fun z => (z - p_pos) ^ (1 : ℤ) / (z - p_neg)) := by + refine ((hlogF.mono hfront_sub).inv).congr fun z _ => ?_ + simp [inv_div] + have hne_clU : ∀ z ∈ closure U, z - p_neg ≠ 0 := + fun z hz h => hm_not_clU (sub_eq_zero.mp h ▸ hz) + exact one_ne_zero (eq_zero_of_hasLogOn_frontier hU_open hU_bdd hp_in_U + (continuousOn_id.sub continuousOn_const) hne_clU hlog_inv) + +omit [T2Space S] in +private theorem edge_meets_closure_of_radial_component {Γ : Drawing S} + {e : Set S} {G : ℂ → S} (hGc : ContinuousOn G (closedBall 0 1)) (hmid_e : G 0 ∈ e) + (hG_off_real : ∀ z ∈ closedBall (0 : ℂ) 1, z.im ≠ 0 → G z ∉ Γ.U) : + ∀ w ∈ ball (0 : ℂ) 1, w.im ≠ 0 → + (e ∩ closure (connectedComponentIn (univ \ Γ.U) (G w))).Nonempty := by + intro w hw hwim + have hw_cb : w ∈ closedBall (0 : ℂ) 1 := ball_subset_closedBall hw + refine ⟨G 0, hmid_e, ?_⟩ + rw [mem_closure_iff_nhds] + intro V hV + have h0_cb : (0 : ℂ) ∈ closedBall (0 : ℂ) 1 := by simp + have hpre : G ⁻¹' V ∈ 𝓝[closedBall (0 : ℂ) 1] 0 := hGc.continuousWithinAt h0_cb hV + rw [mem_nhdsWithin_iff] at hpre + obtain ⟨δ, hδ_pos, hδ⟩ := hpre + let t : ℝ := min (1 / 2) (δ / 2) + have ht_pos : 0 < t := lt_min (by norm_num) (half_pos hδ_pos) + have ht_le1 : t ≤ 1 := (min_le_left _ _).trans (by norm_num) + have htw_cb : (t : ℂ) * w ∈ closedBall (0 : ℂ) 1 := by + rw [mem_closedBall_zero_iff, norm_mul, Complex.norm_real, Real.norm_of_nonneg ht_pos.le] + have h1 : ‖w‖ ≤ 1 := mem_closedBall_zero_iff.mp hw_cb + nlinarith + have htw_ball : (t : ℂ) * w ∈ ball (0 : ℂ) δ := by + rw [mem_ball_zero_iff, norm_mul, Complex.norm_real, Real.norm_of_nonneg ht_pos.le] + have h1 : ‖w‖ < 1 := mem_ball_zero_iff.mp hw + have h2 : t ≤ δ / 2 := min_le_right _ _ + nlinarith + have hGtw_V : G ((t : ℂ) * w) ∈ V := hδ ⟨htw_ball, htw_cb⟩ + have hseg_sub : (fun s : ℝ => G ((s : ℂ) * w)) '' Icc t 1 ⊆ univ \ Γ.U := by + rintro _ ⟨s, ⟨hs1, hs2⟩, rfl⟩ + have hs_pos : 0 < s := lt_of_lt_of_le ht_pos hs1 + have hsw_cb : (s : ℂ) * w ∈ closedBall (0 : ℂ) 1 := by + rw [mem_closedBall_zero_iff, norm_mul, Complex.norm_real, Real.norm_of_nonneg hs_pos.le] + have h1 : ‖w‖ ≤ 1 := mem_closedBall_zero_iff.mp hw_cb + nlinarith + have hsw_im : ((s : ℂ) * w).im ≠ 0 := by + simp [hs_pos.ne', hwim] + exact ⟨mem_univ _, hG_off_real _ hsw_cb hsw_im⟩ + have hseg_cont : ContinuousOn (fun s : ℝ => G ((s : ℂ) * w)) (Icc t 1) := by + refine hGc.comp ((Complex.continuous_ofReal.mul continuous_const).continuousOn) ?_ + intro s ⟨hs1, hs2⟩ + have hs_pos : 0 < s := lt_of_lt_of_le ht_pos hs1 + rw [mem_closedBall_zero_iff, norm_mul, Complex.norm_real, Real.norm_of_nonneg hs_pos.le] + have h1 : ‖w‖ ≤ 1 := mem_closedBall_zero_iff.mp hw_cb + nlinarith + have hseg_pre : IsPreconnected ((fun s : ℝ => G ((s : ℂ) * w)) '' Icc t 1) := + isPreconnected_Icc.image _ hseg_cont + have hw_in : G w ∈ (fun s : ℝ => G ((s : ℂ) * w)) '' Icc t 1 := + ⟨1, ⟨ht_le1, le_rfl⟩, by simp⟩ + have htw_in : G ((t : ℂ) * w) ∈ (fun s : ℝ => G ((s : ℂ) * w)) '' Icc t 1 := + ⟨t, ⟨le_rfl, ht_le1⟩, rfl⟩ + exact ⟨G ((t : ℂ) * w), hGtw_V, hseg_pre.subset_connectedComponentIn hw_in hseg_sub htw_in⟩ + +/-- If `e ∈ Γ.E` has ends `u, v ∈ Γ.V` and there is a compact preconnected set +`C₀ ⊆ (Γ.deleteEdge e).U ∪ bd S` containing `u` and `v`, then deleting `e` decreases the number of +regions by `1`: `Γ.R.ncard = (Γ.deleteEdge e).R.ncard + 1`. -/ +theorem deleteEdge_R_ncard_eq_add_one_of_ends_connected (hS : IsClosedDiscSpace S) + {Γ : Drawing S} (hΓ : Γ.IsProper) {e : Set S} (he : e ∈ Γ.E) {u v : S} + (hlink : Γ.toGraph.IsLink e u v) {C₀ : Set S} + (hC₀_comp : IsCompact C₀) (hC₀_pre : IsPreconnected C₀) + (hC₀_sub : C₀ ⊆ (Γ.deleteEdge e).U ∪ bd S) (hu : u ∈ C₀) (hv : v ∈ C₀) : + Γ.R.ncard = (Γ.deleteEdge e).R.ncard + 1 := by + obtain ⟨γ, hγc, hγ0, hγ1, hγi, hγ_open, hγ_cl, hlink_γ⟩ := exists_edge_param_isLink Γ he + have hpair : ({γ 0, γ 1} : Set S) = {u, v} := hlink_γ.2.2.2.symm.trans hlink.2.2.2 + have hγ0_C₀ : γ 0 ∈ C₀ := by + have : γ 0 ∈ ({u, v} : Set S) := hpair ▸ mem_insert (γ 0) {γ 1} + rcases this with rfl | rfl <;> assumption + have hγ1_C₀ : γ 1 ∈ C₀ := by + have : γ 1 ∈ ({u, v} : Set S) := hpair ▸ mem_insert_of_mem (γ 0) rfl + rcases this with rfl | rfl <;> assumption + let t₀ : I := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht₀ : t₀ ∈ Ioo (0 : I) 1 := + ⟨Subtype.mk_lt_mk.mpr (by norm_num), Subtype.mk_lt_mk.mpr (by norm_num)⟩ + obtain ⟨G, a, b, hGc, hGi, ha, hab, hb1, hb, hG0, hG_sub, hG_inter, _, hG_arc, hG_ends⟩ := + disc_exists_edge_chart hS Γ hΓ he hγc hγ0 hγ1 hγi hγ_open ht₀ ht₀.1 ht₀.2 + isOpen_univ (mem_univ _) + let C_left : Set S := γ '' Icc 0 a + let C_right : Set S := γ '' Icc b 1 + have hC_left_comp : IsCompact C_left := isCompact_Icc.image hγc + have hC_right_comp : IsCompact C_right := isCompact_Icc.image hγc + have hC_left_pre : IsPreconnected C_left := isPreconnected_Icc.image γ hγc.continuousOn + have hC_right_pre : IsPreconnected C_right := isPreconnected_Icc.image γ hγc.continuousOn + have hu_left : γ 0 ∈ C_left := ⟨0, ⟨le_rfl, unitInterval.nonneg a⟩, rfl⟩ + have hv_right : γ 1 ∈ C_right := ⟨1, ⟨unitInterval.le_one b, le_rfl⟩, rfl⟩ + have hγa_left : γ a ∈ C_left := ⟨a, ⟨unitInterval.nonneg a, le_rfl⟩, rfl⟩ + have hγb_right : γ b ∈ C_right := ⟨b, ⟨le_rfl, unitInterval.le_one b⟩, rfl⟩ + let C_loop : Set S := (C_left ∪ C₀) ∪ C_right + have hCloop_comp : IsCompact C_loop := (hC_left_comp.union hC₀_comp).union hC_right_comp + have hCloop_pre : IsPreconnected C_loop := + (hC_left_pre.union (γ 0) hu_left hγ0_C₀ hC₀_pre).union (γ 1) + (Or.inr hγ1_C₀) hv_right hC_right_pre + have hcl_sub_U : closure e ⊆ Γ.U := + Γ.isClosed_U.closure_subset_iff.mpr (he.2.1.trans sdiff_subset) + have hCloop_sub : C_loop ⊆ Γ.U ∪ bd S := by + have hleft_sub : C_left ⊆ Γ.U ∪ bd S := + (image_subset_range γ _).trans (hγ_cl.symm.subset.trans (hcl_sub_U.trans subset_union_left)) + have hright_sub : C_right ⊆ Γ.U ∪ bd S := + (image_subset_range γ _).trans (hγ_cl.symm.subset.trans (hcl_sub_U.trans subset_union_left)) + have hC₀_sub' : C₀ ⊆ Γ.U ∪ bd S := + hC₀_sub.trans (union_subset_union_left _ (deleteEdge_isSubdrawing Γ e).U_subset) + exact union_subset (union_subset hleft_sub hC₀_sub') hright_sub + have hm1_in : G (-1) ∈ C_loop := by + rcases hG_ends with ⟨h1, _⟩ | ⟨h1, _⟩ + · rw [h1]; exact Or.inl (Or.inl hγa_left) + · rw [h1]; exact Or.inr hγb_right + have hp1_in : G 1 ∈ C_loop := by + rcases hG_ends with ⟨_, h2⟩ | ⟨_, h2⟩ + · rw [h2]; exact Or.inr hγb_right + · rw [h2]; exact Or.inl (Or.inl hγa_left) + have hdisj_e_delU : Disjoint e (Γ.deleteEdge e).U := by + rw [deleteEdge_U Γ he] + exact disjoint_sdiff_self_right + have hCloop_disj : Disjoint C_loop (G '' ball (0 : ℂ) 1) := by + refine disjoint_left.mpr ?_ + rintro x hx ⟨z, hz_ball, rfl⟩ + have hz_cb : z ∈ closedBall (0 : ℂ) 1 := ball_subset_closedBall hz_ball + have hGz_not_bd : G z ∉ bd S := (hG_sub ⟨z, hz_cb, rfl⟩).2 + have hGz_U : G z ∈ Γ.U := (hCloop_sub hx).resolve_right hGz_not_bd + have hzim : z.im = 0 := (hG_inter z hz_cb).mp hGz_U + have hGz_ab : G z ∈ γ '' Icc a b := hG_arc ▸ ⟨z, ⟨hz_cb, hzim⟩, rfl⟩ + obtain ⟨t₂, ht₂, hgt₂⟩ := hGz_ab + have ht₂_ioo : t₂ ∈ Ioo (0 : I) 1 := ⟨ha.trans_le ht₂.1, ht₂.2.trans_lt hb⟩ + have hGz_e : G z ∈ e := hγ_open ▸ ⟨t₂, ht₂_ioo, hgt₂⟩ + have hGz_not_C₀ : G z ∉ C₀ := fun h => by + rcases hC₀_sub h with hdel | hbd + · exact disjoint_left.mp hdisj_e_delU hGz_e hdel + · exact hGz_not_bd hbd + have hGz_ends : G z ∈ C_left ∪ C_right := by + rcases hx with (hx_left | hx_C₀) | hx_right + · exact Or.inl hx_left + · exact (hGz_not_C₀ hx_C₀).elim + · exact Or.inr hx_right + have hGz_a_or_b : G z = γ a ∨ G z = γ b := by + rcases hGz_ends with ⟨t₁, ht₁, hgt₁⟩ | ⟨t₁, ht₁, hgt₁⟩ + · have ht₁_ne0 : t₁ ≠ 0 := fun h0 => (he.2.1 hGz_e).2 (hgt₁ ▸ h0 ▸ hγ0) + have ht₁_ioo : t₁ ∈ Ioo (0 : I) 1 := + ⟨unitInterval.pos_iff_ne_zero.mpr ht₁_ne0, ht₁.2.trans_lt (hab.trans ht₀.2)⟩ + have heq := hγi ht₁_ioo ht₂_ioo (hgt₁.trans hgt₂.symm) + have : t₁ = a := le_antisymm ht₁.2 (heq ▸ ht₂.1) + exact Or.inl (hgt₁.symm.trans (congrArg γ this)) + · have ht₁_ne1 : t₁ ≠ 1 := fun h1 => (he.2.1 hGz_e).2 (hgt₁ ▸ h1 ▸ hγ1) + have ht₁_ioo : t₁ ∈ Ioo (0 : I) 1 := + ⟨(ht₀.1.trans hb1).trans_le ht₁.1, unitInterval.lt_one_iff_ne_one.mpr ht₁_ne1⟩ + have heq := hγi ht₁_ioo ht₂_ioo (hgt₁.trans hgt₂.symm) + have : t₁ = b := le_antisymm (heq ▸ ht₂.2) ht₁.1 + exact Or.inr (hgt₁.symm.trans (congrArg γ this)) + have hGz_pm1 : G z = G (-1) ∨ G z = G 1 := by + rcases hG_ends with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> rcases hGz_a_or_b with h | h + · exact Or.inl (h.trans h1.symm) + · exact Or.inr (h.trans h2.symm) + · exact Or.inr (h.trans h2.symm) + · exact Or.inl (h.trans h1.symm) + have h1_cb : (1 : ℂ) ∈ closedBall (0 : ℂ) 1 := by simp + have hm1_cb : (-1 : ℂ) ∈ closedBall (0 : ℂ) 1 := by simp + rcases hGz_pm1 with h | h + · have := hGi hz_cb hm1_cb h + subst this + simp at hz_ball + · have := hGi hz_cb h1_cb h + subst this + simp at hz_ball + obtain ⟨h, g, hhc, hhi, hh_univ, _, _, _, _, _⟩ := exists_disc_complex_chart hS + let φ : ℂ → ℂ := h ∘ G + have hφc : ContinuousOn φ (closedBall (0 : ℂ) 1) := hhc.comp_continuousOn hGc + have hφi : InjOn φ (closedBall (0 : ℂ) 1) := + fun z₁ hz₁ z₂ hz₂ heq => hGi hz₁ hz₂ (hhi heq) + let K_out : Set ℂ := h '' C_loop + have hK_comp : IsCompact K_out := hCloop_comp.image hhc + have hK_pre : IsPreconnected K_out := hCloop_pre.image h hhc.continuousOn + have hK_disj : Disjoint K_out (φ '' ball (0 : ℂ) 1) := by + rw [image_comp] + exact Disjoint.image hCloop_disj hhi.injOn (subset_univ _) (subset_univ _) + have hm1_K : φ (-1) ∈ K_out := ⟨G (-1), hm1_in, rfl⟩ + have hp1_K : φ 1 ∈ K_out := ⟨G 1, hp1_in, rfl⟩ + have hnot_same := + not_mem_connectedComponentIn_of_chart_loop hφc hφi hK_comp hK_pre hK_disj hm1_K hp1_K + have hI2_ball : (Complex.I / 2 : ℂ) ∈ ball (0 : ℂ) 1 := by + rw [mem_ball_zero_iff, norm_div, norm_I, RCLike.norm_ofNat] + norm_num + have hmI2_ball : (-Complex.I / 2 : ℂ) ∈ ball (0 : ℂ) 1 := by + rw [mem_ball_zero_iff, norm_div, norm_neg, norm_I, RCLike.norm_ofNat] + norm_num + have hG_off_real : ∀ z ∈ closedBall (0 : ℂ) 1, z.im ≠ 0 → G z ∈ (univ \ bd S) \ Γ.U := by + intro z hz hzim + exact ⟨hG_sub ⟨z, hz, rfl⟩, fun hxU => hzim ((hG_inter z hz).mp hxU)⟩ + let x_pos : S := G (Complex.I / 2) + let x_neg : S := G (-Complex.I / 2) + have hx_pos : x_pos ∈ (univ \ bd S) \ Γ.U := + hG_off_real (Complex.I / 2) (ball_subset_closedBall hI2_ball) (by simp) + have hx_neg : x_neg ∈ (univ \ bd S) \ Γ.U := + hG_off_real (-Complex.I / 2) (ball_subset_closedBall hmI2_ball) (by simp) + let r_pos : Set S := connectedComponentIn (univ \ Γ.U) x_pos + let r_neg : Set S := connectedComponentIn (univ \ Γ.U) x_neg + have hr_pos_R : r_pos ∈ Γ.R := ⟨x_pos, ⟨mem_univ _, hx_pos.2⟩, rfl⟩ + have hr_neg_R : r_neg ∈ Γ.R := ⟨x_neg, ⟨mem_univ _, hx_neg.2⟩, rfl⟩ + have hmid_e : γ t₀ ∈ e := hγ_open ▸ ⟨t₀, ht₀, rfl⟩ + have hinc_of_im_ne_zero := edge_meets_closure_of_radial_component hGc (hG0 ▸ hmid_e) + (fun z hz him => (hG_off_real z hz him).2) + have hinc_pos : e ⊆ closure r_pos := + disc_edge_subset_closure_of_incident hS hΓ he hr_pos_R + (hinc_of_im_ne_zero (Complex.I / 2) hI2_ball (by simp)) + have hinc_neg : e ⊆ closure r_neg := + disc_edge_subset_closure_of_incident hS hΓ he hr_neg_R + (hinc_of_im_ne_zero (-Complex.I / 2) hmI2_ball (by simp)) + have hr_ne : r_pos ≠ r_neg := by + intro heq + have hx_pos_r : x_pos ∈ r_pos \ bd S := + ⟨mem_connectedComponentIn ⟨mem_univ _, hx_pos.2⟩, hx_pos.1.2⟩ + have hx_neg_r : x_neg ∈ r_pos \ bd S := by + rw [heq] + exact ⟨mem_connectedComponentIn ⟨mem_univ _, hx_neg.2⟩, hx_neg.1.2⟩ + have hsame_S : x_neg ∈ connectedComponentIn ((univ \ bd S) \ Γ.U) x_pos := + mem_connectedComponentIn_sdiff_bd_of_region hS hr_pos_R hx_pos_r hx_neg_r + let Comp := connectedComponentIn ((univ \ bd S) \ Γ.U) x_pos + have hComp_pre : IsPreconnected (h '' Comp) := + isPreconnected_connectedComponentIn.image h hhc.continuousOn + have hComp_sub : h '' Comp ⊆ + (φ '' {z : ℂ | z ∈ closedBall (0 : ℂ) 1 ∧ z.im = 0} ∪ K_out)ᶜ := by + rintro _ ⟨y, hyComp, rfl⟩ + have hy : y ∈ (univ \ bd S) \ Γ.U := connectedComponentIn_subset _ _ hyComp + rintro (⟨z, hz, hzy⟩ | ⟨w, hw, hwy⟩) + · have hGz_y : G z = y := hhi hzy + have hGz_U : G z ∈ Γ.U := (hG_inter z hz.1).mpr hz.2 + rw [hGz_y] at hGz_U + exact hy.2 hGz_U + · have hw_y : w = y := hhi hwy + subst hw_y + rcases hCloop_sub hw with hwU | hw_bd + · exact hy.2 hwU + · exact hy.1.2 hw_bd + have hφ_pos_in : φ (Complex.I / 2) ∈ h '' Comp := + ⟨x_pos, mem_connectedComponentIn hx_pos, rfl⟩ + have hφ_neg_in : φ (-Complex.I / 2) ∈ h '' Comp := + ⟨x_neg, hsame_S, rfl⟩ + exact hnot_same (hComp_pre.subset_connectedComponentIn hφ_pos_in hComp_sub hφ_neg_in) + exact deleteEdge_R_ncard_eq_add_one_of_two_regions hS hΓ he hr_pos_R hr_neg_R hr_ne hinc_pos + hinc_neg + +/-- An edge `e ∈ Γ.E` with ends `u, v ∈ Γ.V` is redundant in `Γ` if `u` and `v` are joined by a walk +in `(Γ.deleteEdge e).toGraph`, or both `u` and `v` are joined by walks to `Γ.V ∩ bd S` in +`(Γ.deleteEdge e).toGraph`. In either case, `Γ.R.ncard = (Γ.deleteEdge e).R.ncard + 1`. -/ +theorem deleteEdge_R_ncard_eq_add_one_of_redundant (hS : IsClosedDiscSpace S) + {Γ : Drawing S} (hΓ : Γ.IsProper) {e : Set S} (he : e ∈ Γ.E) {u v : S} + (hlink : Γ.toGraph.IsLink e u v) + (hred : Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u v) ∨ + ((∃ b₁ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u b₁)) ∧ + (∃ b₂ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph v b₂)))) : + Γ.R.ncard = (Γ.deleteEdge e).R.ncard + 1 := by + have : CompactSpace S := compactSpace_of_isClosedDiscSpace hS + rcases hred with ⟨⟨W⟩⟩ | ⟨⟨b₁, hb₁, ⟨W₁⟩⟩, ⟨b₂, hb₂, ⟨W₂⟩⟩⟩ + · obtain ⟨K, hK_comp, hK_conn, huK, hvK, _, hK_U, _⟩ := + exists_compact_connected_of_walk (Γ.deleteEdge e) le_rfl W + exact deleteEdge_R_ncard_eq_add_one_of_ends_connected hS hΓ he hlink + hK_comp hK_conn.isPreconnected (hK_U.trans subset_union_left) huK hvK + · obtain ⟨K₁, hK₁_comp, hK₁_conn, huK₁, hb₁K₁, _, hK₁_U, _⟩ := + exists_compact_connected_of_walk (Γ.deleteEdge e) le_rfl W₁ + obtain ⟨K₂, hK₂_comp, hK₂_conn, hvK₂, hb₂K₂, _, hK₂_U, _⟩ := + exists_compact_connected_of_walk (Γ.deleteEdge e) le_rfl W₂ + have hbd_comp : IsCompact (bd S) := (isClosed_bd_of_isClosedDiscSpace hS).isCompact + obtain ⟨φ_bd⟩ := hS.isOArc_bd + have hbd_pre : IsPreconnected (bd S) := by + rw [← range_oArcMap φ_bd, ← image_univ] + exact isPreconnected_univ.image _ (isEmbedding_oArcMap φ_bd).continuous.continuousOn + let C₀ : Set S := (K₁ ∪ bd S) ∪ K₂ + have hC₀_comp : IsCompact C₀ := (hK₁_comp.union hbd_comp).union hK₂_comp + have hC₀_pre : IsPreconnected C₀ := + (hK₁_conn.isPreconnected.union b₁ hb₁K₁ hb₁.2 hbd_pre).union b₂ + (Or.inr hb₂.2) hb₂K₂ hK₂_conn.isPreconnected + have hC₀_sub : C₀ ⊆ (Γ.deleteEdge e).U ∪ bd S := + union_subset (union_subset (hK₁_U.trans subset_union_left) subset_union_right) + (hK₂_U.trans subset_union_left) + exact deleteEdge_R_ncard_eq_add_one_of_ends_connected hS hΓ he hlink + hC₀_comp hC₀_pre hC₀_sub (Or.inl (Or.inl huK₁)) (Or.inr hvK₂) + +/-! ## 3. Deleting an Internal Leaf -/ + +/-- If `w ∈ Γ.V \ bd S` has a unique incident edge `e ∈ Γ.E` with ends `w ≠ u`, then +`Γ' := Γ.span (Γ.V \ {w}) (Γ.E \ {e})` has `Γ'.V = Γ.V \ {w}`, `Γ'.E = Γ.E \ {e}`, +`Γ'.U ∪ closure e = Γ.U`, `closure e ∩ Γ'.U ⊆ {u}`, `closure e ∩ bd S ⊆ {u}`, and +`Γ'.IsProper`. -/ +theorem deleteLeaf_props {Γ : Drawing S} (hΓ : Γ.IsProper) {e : Set S} (he : e ∈ Γ.E) + {w u : S} (hlink : Γ.toGraph.IsLink e w u) (hw_ne : w ≠ u) (hw_bd : w ∉ bd S) + (hleaf : ∀ f ∈ Γ.E, f ≠ e → w ∉ closure f) : + let Γ' := Γ.span (Γ.V \ {w}) (Γ.E \ {e}) + Γ'.V = Γ.V \ {w} ∧ Γ'.E = Γ.E \ {e} ∧ Γ'.IsSubdrawing Γ ∧ Γ'.IsProper ∧ + IsLine (closure e) ∧ Γ'.U ∪ closure e = Γ.U ∧ + closure e ∩ Γ'.U ⊆ {u} ∧ closure e ∩ bd S ⊆ {u} := by + intro Γ' + have hE' : Γ'.E = Γ.E \ {e} := by + rw [Γ.span_E, inter_eq_left.mpr sdiff_subset] + have hV' : Γ'.V = Γ.V \ {w} := by + rw [Γ.span_V] + unfold Drawing.spanV + rw [inter_eq_left.mpr sdiff_subset, inter_eq_left.mpr sdiff_subset] + refine Subset.antisymm (union_subset le_rfl ?_) subset_union_left + rintro x hx + obtain ⟨f, ⟨hfE, hfe⟩, hxf, hxV⟩ := mem_iUnion₂.mp hx + exact ⟨hxV, fun hxw => hleaf f hfE hfe (hxw ▸ hxf)⟩ + have hsub : Γ'.IsSubdrawing Γ := + ⟨Γ.spanV_subset _ _, by rw [hE']; exact sdiff_subset⟩ + have hprop' : Γ'.IsProper := fun x hx => by + have hxV : x ∈ Γ.V := hΓ ⟨hx.1, hsub.U_subset hx.2⟩ + rw [hV'] + exact ⟨hxV, fun hxw => hw_bd (hxw ▸ hx.1)⟩ + have hcl_e : closure e = e ∪ {w, u} := closure_edge_eq_union_ends Γ hlink hw_ne + have hline : IsLine (closure e) := by + rcases Γ.edge_cond e he with ⟨u', v', _, _, f, _, _⟩ | ⟨u', hcap', _⟩ + · exact ⟨f⟩ + · exfalso + have hpair : ({w, u} : Set S) = {u'} := hlink.2.2.2.symm.trans hcap' + have hw_u' : w = u' := mem_singleton_iff.mp (hpair ▸ mem_insert w {u}) + have hu_u' : u = u' := mem_singleton_iff.mp (hpair ▸ mem_insert_of_mem w rfl) + exact hw_ne (hw_u'.trans hu_u'.symm) + have hU_union : Γ'.U ∪ closure e = Γ.U := by + refine Subset.antisymm (union_subset hsub.U_subset (Γ.closure_subset_U he)) ?_ + intro x hxU + by_cases hxe : x ∈ closure e + · exact Or.inr hxe + · left + rw [Γ'.U_eq, hV', hE'] + rw [Γ.U_eq] at hxU + rcases hxU with hxV | hx_edges + · refine Or.inl ⟨hxV, fun hxw => hxe ?_⟩ + rw [hcl_e, hxw] + exact Or.inr (mem_insert w {u}) + · obtain ⟨f, hfE, hxf⟩ := mem_iUnion₂.mp hx_edges + have hfe : f ≠ e := fun h => hxe (h ▸ hxf) + exact Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hfE, hfe⟩, hxf⟩) + have hinter_U : closure e ∩ Γ'.U ⊆ {u} := by + rintro x ⟨hxcl, hxU'⟩ + rw [hcl_e] at hxcl + rw [Γ'.U_eq, hV', hE'] at hxU' + rcases hxcl with hxe | (rfl | hxu) + · exfalso + rcases hxU' with ⟨hxV, _⟩ | hx_edges + · exact (he.2.1 hxe).2 hxV + · obtain ⟨f, ⟨hfE, hfe⟩, hxf⟩ := mem_iUnion₂.mp hx_edges + have hxf_open : x ∈ f := by + rw [← Γ.closure_diff_V hfE] + exact ⟨hxf, (he.2.1 hxe).2⟩ + exact hfe (Γ.edge_eq_of_mem hfE he hxf_open hxe) + · exfalso + rcases hxU' with ⟨_, hnw⟩ | hx_edges + · exact hnw rfl + · obtain ⟨f, ⟨hfE, hfe⟩, hwf⟩ := mem_iUnion₂.mp hx_edges + exact hleaf f hfE hfe hwf + · exact hxu + have hinter_bd : closure e ∩ bd S ⊆ {u} := by + rintro x ⟨hxcl, hxbd⟩ + rw [hcl_e] at hxcl + rcases hxcl with hxe | (rfl | hxu) + · exact ((he.2.1 hxe).2 (hΓ ⟨hxbd, (he.2.1 hxe).1⟩)).elim + · exact (hw_bd hxbd).elim + · exact hxu + exact ⟨hV', hE', hsub, hprop', hline, hU_union, hinter_U, hinter_bd⟩ + +/-- Deleting an internal leaf `w ∈ Γ.V \ bd S` and its unique incident edge `e ∈ Γ.E` preserves the +number of regions: `Γ.R.ncard = (Γ.span (Γ.V \ {w}) (Γ.E \ {e})).R.ncard`. -/ +theorem deleteLeaf_R_ncard_eq (hS : IsClosedDiscSpace S) {Γ : Drawing S} (hΓ : Γ.IsProper) + {e : Set S} (he : e ∈ Γ.E) {w u : S} (hlink : Γ.toGraph.IsLink e w u) + (hw_ne : w ≠ u) (hw_bd : w ∉ bd S) (hleaf : ∀ f ∈ Γ.E, f ≠ e → w ∉ closure f) : + Γ.R.ncard = (Γ.span (Γ.V \ {w}) (Γ.E \ {e})).R.ncard := by + classical + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + set Γ' := Γ.span (Γ.V \ {w}) (Γ.E \ {e}) + obtain ⟨_, _, hsub, hprop', hline, hU_union, hinter_U, hinter_bd⟩ := + deleteLeaf_props hΓ he hlink hw_ne hw_bd hleaf + refine le_antisymm ?_ (disc_region_ncard_le_of_isSubdrawing hS hΓ hsub) + have hfin' : Γ'.R.Finite := disc_finite_R hS Γ' hprop' + let φ : Set S → Set S := fun r => + if hr : r ∈ Γ.R then + connectedComponentIn (univ \ Γ'.U) (Classical.choose (region_nonempty hr)) + else ∅ + have hφ_eq : ∀ {r : Set S} (hr : r ∈ Γ.R), + φ r = connectedComponentIn (univ \ Γ'.U) (Classical.choose (region_nonempty hr)) := + fun hr => dite_eq_left_of_eq_true (eq_true hr) + have hφ_maps : MapsTo φ Γ.R Γ'.R := by + intro r hr + rw [hφ_eq hr] + have hx := Classical.choose_spec (region_nonempty hr) + have hxU : Classical.choose (region_nonempty hr) ∉ Γ'.U := + fun h => region_subset hr hx (hsub.U_subset h) + exact ⟨_, ⟨mem_univ _, hxU⟩, rfl⟩ + have hφ_inj : InjOn φ Γ.R := by + intro r₁ hr₁ r₂ hr₂ heq + rw [hφ_eq hr₁, hφ_eq hr₂] at heq + set x₁ := Classical.choose (region_nonempty hr₁) + set x₂ := Classical.choose (region_nonempty hr₂) + have hx₁ : x₁ ∈ r₁ := Classical.choose_spec (region_nonempty hr₁) + have hx₂ : x₂ ∈ r₂ := Classical.choose_spec (region_nonempty hr₂) + let r' := connectedComponentIn (univ \ Γ'.U) x₁ + have hr'_R : r' ∈ Γ'.R := by + have hx₁U : x₁ ∉ Γ'.U := fun h => region_subset hr₁ hx₁ (hsub.U_subset h) + exact ⟨x₁, ⟨mem_univ _, hx₁U⟩, rfl⟩ + have hr₁_sub : r₁ ⊆ r' := + (region_isPreconnected hr₁).subset_connectedComponentIn hx₁ + fun y hy => ⟨mem_univ _, fun hyU => region_subset hr₁ hy (hsub.U_subset hyU)⟩ + have hr₂_sub : r₂ ⊆ r' := by + change r₂ ⊆ connectedComponentIn (univ \ Γ'.U) x₁ + rw [heq] + exact (region_isPreconnected hr₂).subset_connectedComponentIn hx₂ + fun y hy => ⟨mem_univ _, fun hyU => region_subset hr₂ hy (hsub.U_subset hyU)⟩ + obtain ⟨a, ha₁, habd⟩ := open_sdiff_bd_nonempty hS (region_isOpen hr₁) ⟨x₁, hx₁⟩ + obtain ⟨b, hb₂, hbbd⟩ := open_sdiff_bd_nonempty hS (region_isOpen hr₂) ⟨x₂, hx₂⟩ + have ha_r' : a ∈ r' \ bd S := ⟨hr₁_sub ha₁, habd⟩ + have hb_r' : b ∈ r' \ bd S := ⟨hr₂_sub hb₂, hbbd⟩ + have hab' : b ∈ connectedComponentIn ((univ \ bd S) \ Γ'.U) a := + mem_connectedComponentIn_sdiff_bd_of_region hS hr'_R ha_r' hb_r' + have ha_compl : a ∈ (univ \ bd S) \ (Γ'.U ∪ closure e) := by + rw [hU_union] + exact ⟨⟨mem_univ _, habd⟩, region_subset hr₁ ha₁⟩ + have hb_compl : b ∈ (univ \ bd S) \ (Γ'.U ∪ closure e) := by + rw [hU_union] + exact ⟨⟨mem_univ _, hbbd⟩, region_subset hr₂ hb₂⟩ + have hab : b ∈ connectedComponentIn ((univ \ bd S) \ (Γ'.U ∪ closure e)) a := + disc_sdiff_arc_connectedComponentIn hS Γ'.isClosed_U hline hinter_U hinter_bd + ha_compl hb_compl hab' + rw [hU_union] at hab + have hb_r₁ : b ∈ r₁ := by + have hr₁_eq : r₁ = connectedComponentIn (univ \ Γ.U) a := + region_eq_of_mem hr₁ ⟨a, ⟨mem_univ _, region_subset hr₁ ha₁⟩, rfl⟩ ha₁ + (mem_connectedComponentIn ⟨mem_univ _, region_subset hr₁ ha₁⟩) + rw [hr₁_eq] + exact connectedComponentIn_mono a (sdiff_subset_sdiff sdiff_subset subset_rfl) hab + exact region_eq_of_mem hr₁ hr₂ hb_r₁ hb₂ + exact ncard_le_ncard_of_injOn φ hφ_maps hφ_inj hfin' + +theorem deleteEdge_V (Γ : Drawing S) (e : Set S) : (Γ.deleteEdge e).V = Γ.V := by + refine Subset.antisymm (deleteEdge_isSubdrawing Γ e).1 ?_ + intro x hx + exact Or.inl ⟨hx, hx⟩ + +/-- If `Γ.E.Nonempty` and no edge `e ∈ Γ.E` is redundant, then `Γ` has an internal leaf +`w ∈ Γ.V \ bd S` with a unique incident edge `e ∈ Γ.E`. -/ +theorem exists_internal_leaf_of_no_redundant_edge {Γ : Drawing S} (hE : Γ.E.Nonempty) + (hno : ∀ e ∈ Γ.E, ∀ u v, Γ.toGraph.IsLink e u v → + ¬ Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u v) ∧ + ¬ ((∃ b₁ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u b₁)) ∧ + (∃ b₂ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph v b₂)))) : + ∃ e ∈ Γ.E, ∃ w u : S, w ≠ u ∧ w ∈ Γ.V \ bd S ∧ Γ.toGraph.IsLink e w u ∧ + ∀ f ∈ Γ.E, f ≠ e → w ∉ closure f := by + classical + have hne_ends : ∀ f ∈ Γ.E, ∀ u v, Γ.toGraph.IsLink f u v → u ≠ v := by + intro f hf u v hl heq + subst heq + have hu' : u ∈ (Γ.deleteEdge f).V := by rw [deleteEdge_V]; exact hl.left_mem + exact (hno f hf u u hl).1 ⟨.nil hu'⟩ + have hlink : ∀ f ∈ Γ.E, ∀ x ∈ Γ.V, x ∈ closure f → ∃ y, x ≠ y ∧ Γ.toGraph.IsLink f x y := by + intro f hf x hxV hxf + obtain ⟨γ, _, h0, h1, _, _, _, hl⟩ := exists_edge_param_isLink Γ hf + have hne := hne_ends f hf (γ 0) (γ 1) hl + have hx : x ∈ closure f ∩ Γ.V := ⟨hxf, hxV⟩ + rw [hl.2.2.2] at hx + rcases hx with rfl | hx + · exact ⟨γ 1, hne, hl⟩ + · rw [mem_singleton_iff.mp hx] + exact ⟨γ 0, hne.symm, hl.symm⟩ + obtain ⟨e₀, he₀⟩ := hE + obtain ⟨γ₀, _, _, _, _, _, _, hlink₀_raw⟩ := exists_edge_param_isLink Γ he₀ + have hnot_both := (hno e₀ he₀ (γ₀ 0) (γ₀ 1) hlink₀_raw).2 + have hex_end : ∃ x₁ x₀ : S, Γ.toGraph.IsLink e₀ x₁ x₀ ∧ + ∀ b ∈ Γ.V ∩ bd S, ¬ Nonempty (GraphWalk (Γ.deleteEdge e₀).toGraph x₁ b) := by + by_cases h1 : ∃ b₁ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e₀).toGraph (γ₀ 0) b₁) + · refine ⟨γ₀ 1, γ₀ 0, hlink₀_raw.symm, fun b hb h2 => hnot_both ⟨h1, b, hb, h2⟩⟩ + · refine ⟨γ₀ 0, γ₀ 1, hlink₀_raw, fun b hb h2 => h1 ⟨b, hb, h2⟩⟩ + obtain ⟨x₁, x₀, hlink₀, hx₁_no_bd⟩ := hex_end + have hx₁_ne_x₀ : x₁ ≠ x₀ := hne_ends e₀ he₀ x₁ x₀ hlink₀ + set Γ₀ := Γ.deleteEdge e₀ + have hsub₀ : Γ₀.IsSubdrawing Γ := deleteEdge_isSubdrawing Γ e₀ + have hV₀ : Γ₀.V = Γ.V := deleteEdge_V Γ e₀ + have hE₀ : Γ₀.E = Γ.E \ {e₀} := deleteEdge_E Γ e₀ + let P : ℕ → Prop := fun n => + ∃ (a : S) (W : GraphWalk Γ₀.toGraph a x₁), W.IsSimple ∧ W.length = n + have hbound : ∀ n, P n → n ≤ Γ₀.finite_V.toFinset.card := by + rintro n ⟨a, W, hW, rfl⟩ + have hsub : W.support.toFinset ⊆ Γ₀.finite_V.toFinset := by + intro x hx + simp only [List.mem_toFinset] at hx + have : x ∈ Γ₀.V := W.mem_vertexSet_of_mem_support hx + simpa using this + have h₁ := Finset.card_le_card hsub + rw [List.toFinset_card_of_nodup hW, length_support] at h₁ + omega + have hx₁_V₀ : x₁ ∈ Γ₀.V := by rw [hV₀]; exact hlink₀.left_mem + have hP0 : P 0 := ⟨x₁, .nil hx₁_V₀, List.nodup_singleton x₁, rfl⟩ + let N := Nat.findGreatest P Γ₀.finite_V.toFinset.card + have hmax : ∀ n, P n → n ≤ N := fun n hn => Nat.le_findGreatest (hbound n hn) hn + have hN : P N := Nat.findGreatest_spec (Nat.zero_le _) hP0 + obtain ⟨a, W, hW, hlen⟩ := hN + have ha_V : a ∈ Γ.V := by + rw [← hV₀] + exact W.mem_vertexSet_of_mem_support W.start_mem_support + have ha_not_bd : a ∉ bd S := fun habd => + hx₁_no_bd a ⟨ha_V, habd⟩ ⟨W.reverse⟩ + cases W with + | nil _ => + simp only [GraphWalk.length_nil] at hlen + refine ⟨e₀, he₀, x₁, x₀, hx₁_ne_x₀, ⟨ha_V, ha_not_bd⟩, hlink₀, fun f hf hfe hxf => ?_⟩ + obtain ⟨y, hxy, hl_f⟩ := hlink f hf x₁ ha_V hxf + have hf₀ : f ∈ Γ₀.E := by rw [hE₀]; exact ⟨hf, hfe⟩ + have hl_f₀ : Γ₀.toGraph.IsLink f x₁ y := (hsub₀.isLink_iff hf₀).mpr hl_f + have hP1 : P 1 := by + refine ⟨y, .cons hl_f₀.symm (.nil hl_f₀.left_mem), ?_, rfl⟩ + exact List.nodup_cons.mpr ⟨by simpa using hxy.symm, List.nodup_singleton _⟩ + have := hmax 1 hP1 + omega + | @cons _ u _ e h r => + have he_Γ : e ∈ Γ.E := hsub₀.2 h.1 + have hl_e : Γ.toGraph.IsLink e a u := (hsub₀.isLink_iff h.1).mp h + have hau : a ≠ u := hne_ends e he_Γ a u hl_e + have hnd := List.nodup_cons.mp hW + refine ⟨e, he_Γ, a, u, hau, ⟨ha_V, ha_not_bd⟩, hl_e, fun f hf hfe haf => ?_⟩ + by_cases hfe₀ : f = e₀ + · subst f + have ha_pair : a ∈ ({x₁, x₀} : Set S) := hlink₀.2.2.2 ▸ ⟨haf, ha_V⟩ + rcases ha_pair with rfl | ha_x₀ + · exact hnd.1 r.end_mem_support + · rw [mem_singleton_iff.mp ha_x₀] at h + exact (hno e₀ he₀ x₁ x₀ hlink₀).1 ⟨(GraphWalk.cons h r).reverse⟩ + · obtain ⟨y, hay, hl_f⟩ := hlink f hf a ha_V haf + have hf₀ : f ∈ Γ₀.E := by rw [hE₀]; exact ⟨hf, hfe₀⟩ + have hl_f₀ : Γ₀.toGraph.IsLink f a y := (hsub₀.isLink_iff hf₀).mpr hl_f + by_cases hy : y ∈ (GraphWalk.cons h r).support + · obtain ⟨W₁, W₂, hsplit⟩ := (GraphWalk.cons h r).exists_append_of_mem hy + have hfW₁ : f ∉ W₁.edges := by + intro hfW₁ + have h₁ : f ∈ (GraphWalk.cons h r).edges := by + rw [hsplit, GraphWalk.edges_append] + exact List.mem_append_left _ hfW₁ + rcases List.mem_cons.mp h₁ with h₂ | h₂ + · exact hfe h₂ + · exact hnd.1 (r.left_mem_support_of_mem_edges h₂ hl_f₀) + obtain ⟨W₁', hsupp₁, hed₁⟩ := hsub₀.exists_walk_up W₁ + obtain ⟨W₁'', -, -⟩ := (deleteEdge_isSubdrawing Γ f).exists_walk_down W₁' + (fun x hx => by + rw [deleteEdge_V] + exact W₁'.mem_vertexSet_of_mem_support hx) + (fun g hg => by + rw [deleteEdge_E] + refine ⟨mem_E_of_mem_edges W₁' hg, ?_⟩ + intro hgf + exact hfW₁ (mem_singleton_iff.mp hgf ▸ hed₁ ▸ hg)) + exact (hno f hf a y hl_f).1 ⟨W₁''⟩ + · have hPN1 : P (N + 1) := + ⟨y, .cons hl_f₀.symm (.cons h r), List.nodup_cons.mpr ⟨hy, hW⟩, by + simp only [GraphWalk.length_cons] at hlen ⊢ + omega⟩ + have := hmax (N + 1) hPN1 + omega + +/-- Deleting an internal leaf removes one vertex and one edge and preserves boundary vertices. -/ +private theorem exists_internal_leaf_deletion {Γ : Drawing S} (hΓ : Γ.IsProper) + (hE : Γ.E.Nonempty) + (hno : ∀ e ∈ Γ.E, ∀ u v, Γ.toGraph.IsLink e u v → + ¬ Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u v) ∧ + ¬ ((∃ b₁ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u b₁)) ∧ + (∃ b₂ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph v b₂)))) : + ∃ e ∈ Γ.E, ∃ w u : S, w ≠ u ∧ w ∉ bd S ∧ Γ.toGraph.IsLink e w u ∧ + (∀ f ∈ Γ.E, f ≠ e → w ∉ closure f) ∧ + let Γ' := Γ.span (Γ.V \ {w}) (Γ.E \ {e}) + Γ'.V = Γ.V \ {w} ∧ Γ'.IsProper ∧ Γ'.V.ncard + 1 = Γ.V.ncard ∧ + Γ'.E.ncard + 1 = Γ.E.ncard ∧ Γ'.V ∩ bd S = Γ.V ∩ bd S := by + obtain ⟨e, he, w, u, hw_ne, ⟨hw_V, hw_bd⟩, hlink, hleaf⟩ := + exists_internal_leaf_of_no_redundant_edge hE hno + obtain ⟨hV', hE', _, hΓ', _, _, _, _⟩ := deleteLeaf_props hΓ he hlink hw_ne hw_bd hleaf + refine ⟨e, he, w, u, hw_ne, hw_bd, hlink, hleaf, hV', hΓ', ?_, ?_, ?_⟩ + · rw [hV'] + exact ncard_sdiff_singleton_add_one hw_V Γ.finite_V + · rw [hE'] + exact ncard_sdiff_singleton_add_one he Γ.finite_edges + · rw [hV'] + ext x + simp only [mem_inter_iff, mem_sdiff, mem_singleton_iff] + exact ⟨fun h => ⟨h.1.1, h.2⟩, fun h => ⟨⟨h.1, fun hxw => hw_bd (hxw ▸ h.2)⟩, h.2⟩⟩ + +/-! ## 4. Region-Counting Bounds (Euler's Formula on a Disc) -/ + +omit [T2Space S] in +/-- If `Γ` is a proper drawing on `S` with `Γ.E = ∅`, then `Γ.R.ncard = 1`. -/ +theorem R_ncard_eq_one_of_E_empty (hS : IsClosedDiscSpace S) {Γ : Drawing S} + (hΓ : Γ.IsProper) (hE : Γ.E = ∅) : Γ.R.ncard = 1 := by + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + obtain ⟨φ_disc⟩ := hS + have : ConnectedSpace ClosedUnitDisc := + Subtype.connectedSpace ((convex_closedBall (0 : EuclideanPlane) 1).isConnected ⟨0, by simp⟩) + have : PreconnectedSpace S := (φ_disc.surjective.connectedSpace + φ_disc.continuous).toPreconnectedSpace + have hS : IsClosedDiscSpace S := ⟨φ_disc⟩ + obtain ⟨p, -, hp⟩ := + disc_exists_notMem_U hS hΓ isOpen_univ ⟨φ_disc ⟨0, by simp [ClosedUnitDisc]⟩, mem_univ _⟩ + have hr₀ : connectedComponentIn (univ \ Γ.U) p ∈ Γ.R := ⟨p, ⟨mem_univ p, hp⟩, rfl⟩ + have hU : Γ.U = Γ.V := by + rw [Γ.U_eq, hE] + simp + have hc : IsPreconnected (univ \ Γ.U) := by + rw [hU] + exact disc_isPreconnected_sdiff_finite hS isOpen_univ isPreconnected_univ Γ.finite_V + have hsub : Γ.R.Subsingleton := fun r₁ h₁ r₂ h₂ => by + obtain ⟨x, hx⟩ := region_nonempty h₁ + obtain ⟨y, hy⟩ := region_nonempty h₂ + refine region_eq_of_mem h₁ h₂ (subset_region h₁ hc ?_ ⟨mem_univ _, region_subset h₁ hx⟩ hx + ⟨mem_univ _, region_subset h₂ hy⟩) hy + exact disjoint_left.mpr fun q hq => hq.2 + have hR_eq : Γ.R = {connectedComponentIn (univ \ Γ.U) p} := + Subset.antisymm (fun r hr => mem_singleton_iff.mpr (hsub hr hr₀)) + (singleton_subset_iff.mpr hr₀) + rw [hR_eq, ncard_singleton] + +/-- Lower bound on `Γ.V.ncard + Γ.R.ncard` for any proper drawing `Γ` on a closed disc space `S`. -/ +theorem euler_lower_bound (hS : IsClosedDiscSpace S) {Γ : Drawing S} (hΓ : Γ.IsProper) : + Γ.E.ncard + (Γ.V ∩ bd S).ncard + 1 ≤ Γ.V.ncard + Γ.R.ncard ∧ + (Γ.V.Nonempty → Γ.E.ncard + 2 ≤ Γ.V.ncard + Γ.R.ncard) := by + classical + induction hn : Γ.E.ncard using Nat.strong_induction_on generalizing Γ with + | _ n ih => + rcases Γ.E.eq_empty_or_nonempty with hE_emp | hE_ne + · have hE0 : Γ.E.ncard = 0 := by rw [hE_emp, ncard_empty] + have hR1 : Γ.R.ncard = 1 := R_ncard_eq_one_of_E_empty hS hΓ hE_emp + have hVbd : (Γ.V ∩ bd S).ncard ≤ Γ.V.ncard := + ncard_le_ncard inter_subset_left Γ.finite_V + refine ⟨by omega, fun hV => ?_⟩ + have hV1 : 1 ≤ Γ.V.ncard := (ncard_pos Γ.finite_V).mpr hV + omega + · by_cases hred : ∃ e ∈ Γ.E, ∃ u v, Γ.toGraph.IsLink e u v ∧ + (Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u v) ∨ + ((∃ b₁ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u b₁)) ∧ + (∃ b₂ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph v b₂)))) + · obtain ⟨e, he, u, v, hlink, hred_e⟩ := hred + let Γ' := Γ.deleteEdge e + have hΓ' : Γ'.IsProper := deleteEdge_isProper hΓ e + have hV' : Γ'.V = Γ.V := deleteEdge_V Γ e + have hE' : Γ'.E = Γ.E \ {e} := deleteEdge_E Γ e + have hE_card : Γ'.E.ncard + 1 = Γ.E.ncard := by + rw [hE'] + exact ncard_sdiff_singleton_add_one he Γ.finite_edges + have hlt : Γ'.E.ncard < n := by omega + have hR_eq : Γ.R.ncard = Γ'.R.ncard + 1 := + deleteEdge_R_ncard_eq_add_one_of_redundant hS hΓ he hlink hred_e + obtain ⟨ih1, ih2⟩ := ih Γ'.E.ncard hlt (Γ := Γ') hΓ' rfl + rw [hV'] at ih1 ih2 + refine ⟨by omega, fun hV => ?_⟩ + have := ih2 hV + omega + · have hno : ∀ e ∈ Γ.E, ∀ u v, Γ.toGraph.IsLink e u v → + ¬ Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u v) ∧ + ¬ ((∃ b₁ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u b₁)) ∧ + (∃ b₂ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph v b₂))) := by + intro e he u v hl + exact ⟨fun h1 => hred ⟨e, he, u, v, hl, Or.inl h1⟩, + fun h2 => hred ⟨e, he, u, v, hl, Or.inr h2⟩⟩ + obtain ⟨e, he, w, u, hw_ne, hw_bd, hlink, hleaf, hV', hΓ', hV_card, hE_card, hVbd_eq⟩ := + exists_internal_leaf_deletion hΓ hE_ne hno + let Γ' := Γ.span (Γ.V \ {w}) (Γ.E \ {e}) + change Γ'.V.ncard + 1 = Γ.V.ncard at hV_card + change Γ'.E.ncard + 1 = Γ.E.ncard at hE_card + have hR_eq : Γ.R.ncard = Γ'.R.ncard := + deleteLeaf_R_ncard_eq hS hΓ he hlink hw_ne hw_bd hleaf + have hlt : Γ'.E.ncard < n := by omega + obtain ⟨ih1, ih2⟩ := ih Γ'.E.ncard hlt (Γ := Γ') hΓ' rfl + have hu_V' : u ∈ Γ'.V := by + rw [hV'] + exact ⟨hlink.right_mem, hw_ne.symm⟩ + have ih2' := ih2 ⟨u, hu_V'⟩ + rw [hVbd_eq] at ih1 + omega + +/-- Retracting a walk along a leaf edge `e` from `w` to `u` produces a walk in +`Γ' := Γ.span (Γ.V \ {w}) (Γ.E \ {e})`. -/ +theorem deleteLeaf_walk {Γ : Drawing S} (hΓ : Γ.IsProper) {e : Set S} (he : e ∈ Γ.E) + {w u : S} (hlink : Γ.toGraph.IsLink e w u) (hw_ne : w ≠ u) (hw_bd : w ∉ bd S) + (hleaf : ∀ f ∈ Γ.E, f ≠ e → w ∉ closure f) {x y : S} + (hx : x ∈ Γ.V \ {w}) (hy : y ∈ Γ.V \ {w}) + (W : GraphWalk Γ.toGraph x y) : + Nonempty (GraphWalk (Γ.span (Γ.V \ {w}) (Γ.E \ {e})).toGraph x y) := by + classical + let Γ' := Γ.span (Γ.V \ {w}) (Γ.E \ {e}) + obtain ⟨hV', hE', hsub, _, _, _, _, _⟩ := + deleteLeaf_props hΓ he hlink hw_ne hw_bd hleaf + let proj : S → S := fun z => if z = w then u else z + have hu_V' : u ∈ Γ'.V := by rw [hV']; exact ⟨hlink.right_mem, hw_ne.symm⟩ + have hproj_mem : ∀ z ∈ Γ.V, proj z ∈ Γ'.V := by + intro z hz + dsimp [proj] + split_ifs with hzw + · exact hu_V' + · rw [hV']; exact ⟨hz, hzw⟩ + have hwalk : ∀ {a b : S}, GraphWalk Γ.toGraph a b → + Nonempty (GraphWalk Γ'.toGraph (proj a) (proj b)) := by + intro a b W₀ + induction W₀ with + | @nil z hz => + exact ⟨.nil (hproj_mem z hz)⟩ + | @cons a z b f hl rest ih => + obtain ⟨W_rest⟩ := ih + by_cases hfe : f = e + · subst f + have hpair : ({a, z} : Set S) = {w, u} := hl.2.2.2.symm.trans hlink.2.2.2 + have ha_wu : a = w ∨ a = u := by + have : a ∈ ({w, u} : Set S) := hpair ▸ mem_insert a {z} + simpa using this + have hz_wu : z = w ∨ z = u := by + have : z ∈ ({w, u} : Set S) := hpair ▸ mem_insert_of_mem a rfl + simpa using this + have hpa : proj a = u := by rcases ha_wu with rfl | rfl <;> simp [proj] + have hpz : proj z = u := by rcases hz_wu with rfl | rfl <;> simp [proj] + rw [hpa, ← hpz] + exact ⟨W_rest⟩ + · have haw : a ≠ w := fun h => hleaf f hl.1 hfe (h ▸ (hl.2.2.2 ▸ mem_insert a {z}).1) + have hzw : z ≠ w := fun h => + hleaf f hl.1 hfe (h ▸ (hl.2.2.2 ▸ mem_insert_of_mem a (mem_singleton z)).1) + have hpa : proj a = a := by simp [proj, haw] + have hpz : proj z = z := by simp [proj, hzw] + have hf' : f ∈ Γ'.E := by rw [hE']; exact ⟨hl.1, hfe⟩ + have hl' : Γ'.toGraph.IsLink f a z := (hsub.isLink_iff hf').mpr hl + rw [hpa] + rw [hpz] at W_rest + exact ⟨.cons hl' W_rest⟩ + have hpx : proj x = x := by simp [proj, mem_singleton_iff.not.mp hx.2] + have hpy : proj y = y := by simp [proj, mem_singleton_iff.not.mp hy.2] + obtain ⟨W'⟩ := hwalk W + rw [hpx, hpy] at W' + exact ⟨W'⟩ + +/-- Deleting a redundant edge `e` whose ends `u, v` are joined by a walk in `(Γ.deleteEdge +e).toGraph` +preserves connectivity of any walk in `Γ.toGraph`. -/ +theorem deleteEdge_walk_of_ends_reachable {Γ : Drawing S} {e : Set S} {u v : S} + (hlink : Γ.toGraph.IsLink e u v) + (huv : Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u v)) + {x y : S} (W : GraphWalk Γ.toGraph x y) : + Nonempty (GraphWalk (Γ.deleteEdge e).toGraph x y) := by + obtain ⟨P⟩ := huv + let Γ' := Γ.deleteEdge e + have hsub : Γ'.IsSubdrawing Γ := deleteEdge_isSubdrawing Γ e + have hV' : Γ'.V = Γ.V := deleteEdge_V Γ e + have hE' : Γ'.E = Γ.E \ {e} := deleteEdge_E Γ e + induction W with + | @nil z hz => + have hz' : z ∈ Γ'.toGraph.vertexSet := by change z ∈ Γ'.V; rw [hV']; exact hz + exact ⟨.nil hz'⟩ + | @cons a z b f hl rest ih => + obtain ⟨W_rest⟩ := ih + by_cases hfe : f = e + · subst f + have hpair : ({a, z} : Set S) = {u, v} := hl.2.2.2.symm.trans hlink.2.2.2 + have ha_uv : a = u ∨ a = v := by + have : a ∈ ({u, v} : Set S) := hpair ▸ mem_insert a {z} + simpa using this + have hz_uv : z = u ∨ z = v := by + have : z ∈ ({u, v} : Set S) := hpair ▸ mem_insert_of_mem a rfl + simpa using this + rcases ha_uv with rfl | rfl <;> rcases hz_uv with rfl | rfl + · exact ⟨W_rest⟩ + · exact ⟨P.append W_rest⟩ + · exact ⟨P.reverse.append W_rest⟩ + · exact ⟨W_rest⟩ + · have hf' : f ∈ Γ'.E := by rw [hE']; exact ⟨hl.1, hfe⟩ + have hl' : Γ'.toGraph.IsLink f a z := (hsub.isLink_iff hf').mpr hl + exact ⟨.cons hl' W_rest⟩ + +/-- Upper bound on `Γ.V.ncard + Γ.R.ncard` when `Γ` is connected and `Γ.V ∩ bd S = ∅`. -/ +theorem euler_upper_bound_of_bd_empty (hS : IsClosedDiscSpace S) {Γ : Drawing S} + (hΓ : Γ.IsProper) (hConn : IsGraphConnected Γ.toGraph) (hbd : Γ.V ∩ bd S = ∅) : + Γ.V.ncard + Γ.R.ncard ≤ Γ.E.ncard + 2 := by + classical + induction hn : Γ.E.ncard using Nat.strong_induction_on generalizing Γ with + | _ n ih => + rcases Γ.E.eq_empty_or_nonempty with hE_emp | hE_ne + · have hE0 : Γ.E.ncard = 0 := by rw [hE_emp, ncard_empty] + have hR1 : Γ.R.ncard = 1 := R_ncard_eq_one_of_E_empty hS hΓ hE_emp + obtain ⟨v₀, hv₀⟩ := hConn.1 + have hV_sub : Γ.V ⊆ {v₀} := by + intro v hv + obtain ⟨W⟩ := hConn.2 v hv v₀ hv₀ + cases W with + | nil _ => rfl + | cons hl _ => + have he : _ ∈ Γ.E := hl.1 + rw [hE_emp] at he + exact he.elim + have hV1 : Γ.V.ncard ≤ 1 := (ncard_le_ncard hV_sub (finite_singleton v₀)).trans + (by rw [ncard_singleton]) + omega + · by_cases hred : ∃ e ∈ Γ.E, ∃ u v, Γ.toGraph.IsLink e u v ∧ + (Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u v) ∨ + ((∃ b₁ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u b₁)) ∧ + (∃ b₂ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph v b₂)))) + · obtain ⟨e, he, u, v, hlink, hred_e⟩ := hred + have huv : Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u v) := by + rcases hred_e with h1 | ⟨⟨b₁, hb₁, _⟩, _⟩ + · exact h1 + · rw [hbd] at hb₁; exact hb₁.elim + let Γ' := Γ.deleteEdge e + have hΓ' : Γ'.IsProper := deleteEdge_isProper hΓ e + have hV' : Γ'.V = Γ.V := deleteEdge_V Γ e + have hE' : Γ'.E = Γ.E \ {e} := deleteEdge_E Γ e + have hE_card : Γ'.E.ncard + 1 = Γ.E.ncard := by + rw [hE'] + exact ncard_sdiff_singleton_add_one he Γ.finite_edges + have hConn' : IsGraphConnected Γ'.toGraph := by + refine ⟨by change Γ'.V.Nonempty; rw [hV']; exact hConn.1, fun x hx y hy => ?_⟩ + rw [show Γ'.toGraph.vertexSet = Γ.V from hV'] at hx hy + obtain ⟨W⟩ := hConn.2 x hx y hy + exact deleteEdge_walk_of_ends_reachable hlink huv W + have hbd' : Γ'.V ∩ bd S = ∅ := by rw [hV']; exact hbd + have hR_le : Γ.R.ncard ≤ Γ'.R.ncard + 1 := deleteEdge_R_ncard_le hS hΓ he + have hlt : Γ'.E.ncard < n := by omega + have ih' := ih Γ'.E.ncard hlt (Γ := Γ') hΓ' hConn' hbd' rfl + rw [hV'] at ih' + omega + · have hno : ∀ e ∈ Γ.E, ∀ u v, Γ.toGraph.IsLink e u v → + ¬ Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u v) ∧ + ¬ ((∃ b₁ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u b₁)) ∧ + (∃ b₂ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph v b₂))) := by + intro e he u v hl + exact ⟨fun h1 => hred ⟨e, he, u, v, hl, Or.inl h1⟩, + fun h2 => hred ⟨e, he, u, v, hl, Or.inr h2⟩⟩ + obtain ⟨e, he, w, u, hw_ne, hw_bd, hlink, hleaf, hV', hΓ', hV_card, hE_card, hVbd_eq⟩ := + exists_internal_leaf_deletion hΓ hE_ne hno + let Γ' := Γ.span (Γ.V \ {w}) (Γ.E \ {e}) + change Γ'.V.ncard + 1 = Γ.V.ncard at hV_card + change Γ'.E.ncard + 1 = Γ.E.ncard at hE_card + have hu_V' : u ∈ Γ'.V := by rw [hV']; exact ⟨hlink.right_mem, hw_ne.symm⟩ + have hConn' : IsGraphConnected Γ'.toGraph := by + refine ⟨⟨u, hu_V'⟩, fun x hx y hy => ?_⟩ + change x ∈ Γ'.V at hx + change y ∈ Γ'.V at hy + rw [hV'] at hx hy + obtain ⟨W⟩ := hConn.2 x hx.1 y hy.1 + exact deleteLeaf_walk hΓ he hlink hw_ne hw_bd hleaf hx hy W + have hbd' : Γ'.V ∩ bd S = ∅ := by rwa [hVbd_eq] + have hR_eq : Γ.R.ncard = Γ'.R.ncard := + deleteLeaf_R_ncard_eq hS hΓ he hlink hw_ne hw_bd hleaf + have hlt : Γ'.E.ncard < n := by omega + have ih' := ih Γ'.E.ncard hlt (Γ := Γ') hΓ' hConn' hbd' rfl + omega + +/-- Upper bound on `Γ.V.ncard + Γ.R.ncard` when every vertex of `Γ` can reach `Γ.V ∩ bd S`. -/ +theorem euler_upper_bound_of_reach_bd (hS : IsClosedDiscSpace S) {Γ : Drawing S} + (hΓ : Γ.IsProper) + (hreach : ∀ v ∈ Γ.V, ∃ b ∈ Γ.V ∩ bd S, Nonempty (GraphWalk Γ.toGraph v b)) : + Γ.V.ncard + Γ.R.ncard ≤ Γ.E.ncard + (Γ.V ∩ bd S).ncard + 1 := by + classical + induction hn : Γ.E.ncard using Nat.strong_induction_on generalizing Γ with + | _ n ih => + rcases Γ.E.eq_empty_or_nonempty with hE_emp | hE_ne + · have hE0 : Γ.E.ncard = 0 := by rw [hE_emp, ncard_empty] + have hR1 : Γ.R.ncard = 1 := R_ncard_eq_one_of_E_empty hS hΓ hE_emp + have hV_sub : Γ.V ⊆ Γ.V ∩ bd S := by + intro v hv + obtain ⟨b, hb, ⟨W⟩⟩ := hreach v hv + cases W with + | nil _ => exact hb + | cons hl _ => + have he : _ ∈ Γ.E := hl.1 + rw [hE_emp] at he + exact he.elim + have hV_le : Γ.V.ncard ≤ (Γ.V ∩ bd S).ncard := + ncard_le_ncard hV_sub (Γ.finite_V.subset inter_subset_left) + omega + · by_cases hred : ∃ e ∈ Γ.E, ∃ u v, Γ.toGraph.IsLink e u v ∧ + (Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u v) ∨ + ((∃ b₁ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u b₁)) ∧ + (∃ b₂ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph v b₂)))) + · obtain ⟨e, he, u, v, hlink, hred_e⟩ := hred + let Γ' := Γ.deleteEdge e + have hsub : Γ'.IsSubdrawing Γ := deleteEdge_isSubdrawing Γ e + have hΓ' : Γ'.IsProper := deleteEdge_isProper hΓ e + have hV' : Γ'.V = Γ.V := deleteEdge_V Γ e + have hE' : Γ'.E = Γ.E \ {e} := deleteEdge_E Γ e + have hE_card : Γ'.E.ncard + 1 = Γ.E.ncard := by + rw [hE'] + exact ncard_sdiff_singleton_add_one he Γ.finite_edges + have hreach' : ∀ x ∈ Γ'.V, ∃ b ∈ Γ'.V ∩ bd S, Nonempty (GraphWalk Γ'.toGraph x b) := by + rw [hV'] + rcases hred_e with huv | ⟨hu_bd, hv_bd⟩ + · intro x hx + obtain ⟨b, hb, ⟨W⟩⟩ := hreach x hx + exact ⟨b, hb, deleteEdge_walk_of_ends_reachable hlink huv W⟩ + · have hwalk_bd : ∀ {a c : S}, GraphWalk Γ.toGraph a c → + (∃ b ∈ Γ.V ∩ bd S, Nonempty (GraphWalk Γ'.toGraph c b)) → + ∃ b ∈ Γ.V ∩ bd S, Nonempty (GraphWalk Γ'.toGraph a b) := by + intro a c W₀ hc + induction W₀ with + | nil _ => exact hc + | @cons a z c f hl rest ih_w => + have hz := ih_w hc + by_cases hfe : f = e + · subst f + have hpair : ({a, z} : Set S) = {u, v} := hl.2.2.2.symm.trans hlink.2.2.2 + have ha_uv : a = u ∨ a = v := by + have : a ∈ ({u, v} : Set S) := hpair ▸ mem_insert a {z} + simpa using this + rcases ha_uv with rfl | rfl + · exact hu_bd + · exact hv_bd + · obtain ⟨b, hb, ⟨W_zb⟩⟩ := hz + have hf' : f ∈ Γ'.E := by rw [hE']; exact ⟨hl.1, hfe⟩ + have hl' : Γ'.toGraph.IsLink f a z := (hsub.isLink_iff hf').mpr hl + exact ⟨b, hb, ⟨.cons hl' W_zb⟩⟩ + intro x hx + obtain ⟨b, hb, ⟨W⟩⟩ := hreach x hx + have hb_V' : b ∈ Γ'.toGraph.vertexSet := by change b ∈ Γ'.V; rw [hV']; exact hb.1 + exact hwalk_bd W ⟨b, hb, ⟨.nil hb_V'⟩⟩ + have hR_le : Γ.R.ncard ≤ Γ'.R.ncard + 1 := deleteEdge_R_ncard_le hS hΓ he + have hlt : Γ'.E.ncard < n := by omega + have ih' := ih Γ'.E.ncard hlt (Γ := Γ') hΓ' hreach' rfl + rw [hV'] at ih' + omega + · have hno : ∀ e ∈ Γ.E, ∀ u v, Γ.toGraph.IsLink e u v → + ¬ Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u v) ∧ + ¬ ((∃ b₁ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph u b₁)) ∧ + (∃ b₂ ∈ Γ.V ∩ bd S, Nonempty (GraphWalk (Γ.deleteEdge e).toGraph v b₂))) := by + intro e he u v hl + exact ⟨fun h1 => hred ⟨e, he, u, v, hl, Or.inl h1⟩, + fun h2 => hred ⟨e, he, u, v, hl, Or.inr h2⟩⟩ + obtain ⟨e, he, w, u, hw_ne, hw_bd, hlink, hleaf, hV', hΓ', hV_card, hE_card, hVbd_eq⟩ := + exists_internal_leaf_deletion hΓ hE_ne hno + let Γ' := Γ.span (Γ.V \ {w}) (Γ.E \ {e}) + change Γ'.V.ncard + 1 = Γ.V.ncard at hV_card + change Γ'.E.ncard + 1 = Γ.E.ncard at hE_card + have hreach' : ∀ x ∈ Γ'.V, ∃ b ∈ Γ'.V ∩ bd S, Nonempty (GraphWalk Γ'.toGraph x b) := by + intro x hx + rw [hV'] at hx + obtain ⟨b, hb, ⟨W⟩⟩ := hreach x hx.1 + have hb' : b ∈ Γ'.V ∩ bd S := by rwa [hVbd_eq] + have hb_diff : b ∈ Γ.V \ {w} := by rw [← hV']; exact hb'.1 + exact ⟨b, hb', deleteLeaf_walk hΓ he hlink hw_ne hw_bd hleaf hx hb_diff W⟩ + have hR_eq : Γ.R.ncard = Γ'.R.ncard := + deleteLeaf_R_ncard_eq hS hΓ he hlink hw_ne hw_bd hleaf + have hlt : Γ'.E.ncard < n := by omega + have ih' := ih Γ'.E.ncard hlt (Γ := Γ') hΓ' hreach' rfl + rw [hVbd_eq] at ih' + omega + +/-! ## 5. Dual Region Separation of Primal Vertices -/ + +omit [T2Space S] in +/-- On any `O`-arc `C`, if `U` is a dual point set for `(C, V)` with `V ⊆ C` finite, then +`U.ncard = V.ncard`. -/ +theorem ncard_eq_of_isDualPointSet {C V U : Set S} (hC : IsOArc C) (hV_sub : V ⊆ C) + (hV_fin : V.Finite) (hU : IsDualPointSet C V U) : U.ncard = V.ncard := by + classical + have hle_univ : ∀ {V₀ U₀ : Set Circle}, V₀.Finite → + IsDualPointSet (univ : Set Circle) V₀ U₀ → V₀.ncard ≤ U₀.ncard := by + intro V₀ U₀ hV₀ hU₀ + have hU₀_fin : U₀.Finite := finite_of_isDualPointSet_univ hV₀ hU₀ + rcases V₀.eq_empty_or_nonempty with rfl | hne + · rw [ncard_empty] + exact Nat.zero_le _ + · have hex : ∀ v : Circle, ∃ u : Circle, v ∈ V₀ → U₀ ∩ nextSegment V₀ v = {u} := by + intro v + by_cases hv : v ∈ V₀ + · obtain ⟨u, hu⟩ := exists_unique_mem_nextSegment_of_isDualPointSet hV₀ hU₀ hv + exact ⟨u, fun _ => hu⟩ + · exact ⟨v, fun h => (hv h).elim⟩ + choose f hf using hex + have hf_maps : MapsTo f V₀ U₀ := by + intro v hv + have : f v ∈ U₀ ∩ nextSegment V₀ v := by rw [hf v hv]; exact mem_singleton _ + exact this.1 + have hf_inj : InjOn f V₀ := by + intro v₁ hv₁ v₂ hv₂ heq + have h1 : f v₁ ∈ U₀ ∩ nextSegment V₀ v₁ := by rw [hf v₁ hv₁]; exact mem_singleton _ + have h2 : f v₁ ∈ U₀ ∩ nextSegment V₀ v₂ := by rw [heq, hf v₂ hv₂]; exact mem_singleton _ + have hu_compl : f v₁ ∈ V₀ᶜ := ((hU₀.2 hne).1 h1.1).2 + obtain ⟨v, _, huniq⟩ := exists_unique_nextSegment_of_mem_compl hV₀ hne hu_compl + exact (huniq v₁ ⟨hv₁, h1.2⟩).trans (huniq v₂ ⟨hv₂, h2.2⟩).symm + exact ncard_le_ncard_of_injOn f hf_maps hf_inj hU₀_fin + have hU_sub : U ⊆ C := (isDualPointSet_subset_diff hU).trans sdiff_subset + obtain ⟨φ⟩ := hC + have hinj := injective_oArcMap φ + let V₀ := oArcMap φ ⁻¹' V + let U₀ := oArcMap φ ⁻¹' U + have hV_eq : oArcMap φ '' V₀ = V := + image_preimage_eq_of_subset (hV_sub.trans (range_oArcMap φ).symm.subset) + have hU_eq : oArcMap φ '' U₀ = U := + image_preimage_eq_of_subset (hU_sub.trans (range_oArcMap φ).symm.subset) + have hV₀_fin : V₀.Finite := Finite.of_finite_image (by rwa [hV_eq]) hinj.injOn + have hU₀ : IsDualPointSet (univ : Set Circle) V₀ U₀ := by + rwa [← isDualPointSet_oArcMap_iff φ, hV_eq, hU_eq] + have hU₀_fin : U₀.Finite := finite_of_isDualPointSet_univ hV₀_fin hU₀ + have hU₀_symm : IsDualPointSet (univ : Set Circle) U₀ V₀ := + isDualPointSet_univ_symm hV₀_fin hU₀ + have hcard_eq : U₀.ncard = V₀.ncard := + le_antisymm (hle_univ hU₀_fin hU₀_symm) (hle_univ hV₀_fin hU₀) + rw [← hU_eq, ← hV_eq, hinj.injOn.ncard_image, hinj.injOn.ncard_image, hcard_eq] + +/-- If `G` is a connected proper drawing on a closed disc space `S` and `G_dual` satisfies all +conditions of `IsDiscDualDrawing G G_dual` except possibly vertex-region injectivity on `G.V`, then +distinct vertices `v₁ ≠ v₂ ∈ G.V` lie in distinct regions of `G_dual`. -/ +theorem dual_region_injective_on_V (hS : IsClosedDiscSpace S) {G G_dual : Drawing S} + (hG : G.IsProper) (hConn : IsGraphConnected G.toGraph) + (hDual_prop : G_dual.IsProper) + (hDual_V_unique : ∀ r ∈ G.R, ∃! w, w ∈ r ∧ w ∈ G_dual.V) + (hDual_V_in_R : ∀ w ∈ G_dual.V, ∃ r ∈ G.R, w ∈ r) + (hDual_bd : IsDualPointSet (bd S) (G.V ∩ bd S) (G_dual.V ∩ bd S)) + (edgeEquiv : G.E ≃ G_dual.E) + (hedge : ∀ e : G.E, + ((edgeEquiv e).1 ∩ G.U = (edgeEquiv e).1 ∩ e.1) ∧ + (e.1 ∩ G_dual.U = e.1 ∩ (edgeEquiv e).1) ∧ + ((edgeEquiv e).1 ∩ e.1).ncard = 1 ∧ + (∀ r' ∈ G_dual.R, G_dual.EdgeRegionIncident (edgeEquiv e).1 r' → (r' ∩ e.1).Nonempty)) : + ∀ v₁ ∈ G.V, ∀ v₂ ∈ G.V, + connectedComponentIn (univ \ G_dual.U) v₁ = connectedComponentIn (univ \ G_dual.U) v₂ → + v₁ = v₂ := by + classical + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + obtain ⟨φ_disc⟩ := hS + have : ConnectedSpace ClosedUnitDisc := + Subtype.connectedSpace ((convex_closedBall (0 : EuclideanPlane) 1).isConnected ⟨0, by simp⟩) + have : PreconnectedSpace S := (φ_disc.surjective.connectedSpace + φ_disc.continuous).toPreconnectedSpace + have hS : IsClosedDiscSpace S := ⟨φ_disc⟩ + have hdisj_V_U : Disjoint G.V G_dual.U := by + refine disjoint_left.mpr fun v hv hvU => ?_ + by_cases hvVd : v ∈ G_dual.V + · obtain ⟨r, hr, hvr⟩ := hDual_V_in_R v hvVd + exact region_subset hr hvr (G.V_subset_U hv) + · obtain ⟨e', he', hve'⟩ := G_dual.exists_edge_of_mem hvU hvVd + let e := edgeEquiv.symm ⟨e', he'⟩ + have he_eq : (edgeEquiv e).1 = e' := + congrArg Subtype.val (edgeEquiv.apply_symm_apply ⟨e', he'⟩) + have hmem : v ∈ (edgeEquiv e).1 ∩ G.U := ⟨he_eq ▸ hve', G.V_subset_U hv⟩ + rw [(hedge e).1] at hmem + exact (e.2.2.1 hmem.2).2 hv + let compV : S → Set S := fun v => connectedComponentIn (univ \ G_dual.U) v + have hcompV_mem : ∀ {v : S}, v ∈ G.V → compV v ∈ G_dual.R ∧ v ∈ compV v := by + intro v hv + have hv_compl : v ∈ univ \ G_dual.U := ⟨mem_univ v, disjoint_left.mp hdisj_V_U hv⟩ + exact ⟨⟨v, hv_compl, rfl⟩, mem_connectedComponentIn hv_compl⟩ + have hsurj_R : G_dual.R ⊆ compV '' G.V := by + intro r_dual hr_dual + by_cases hex : ∃ e' ∈ G_dual.E, G_dual.EdgeRegionIncident e' r_dual + · obtain ⟨e', he', hinc⟩ := hex + let e := edgeEquiv.symm ⟨e', he'⟩ + have he_eq : (edgeEquiv e).1 = e' := + congrArg Subtype.val (edgeEquiv.apply_symm_apply ⟨e', he'⟩) + obtain ⟨_, he2, he3, he4⟩ := hedge e + rw [he_eq] at he2 he3 he4 + obtain ⟨γ, hγ, h0, h1, hinj, himg, _, _⟩ := exists_edge_param_isLink G e.2 + obtain ⟨p, hp_eq⟩ := ncard_eq_one.mp he3 + have hp_mem : p ∈ e' ∩ e.1 := by rw [hp_eq]; exact mem_singleton p + have hp_e' : p ∈ e' := hp_mem.1 + have hp_e : p ∈ e.1 := hp_mem.2 + have he_GdU : e.1 ∩ G_dual.U = {p} := by rw [he2, inter_comm, hp_eq] + rw [← himg] at hp_e + obtain ⟨t₀, ht₀, rfl⟩ := hp_e + have hIco_sub : γ '' Ico 0 t₀ ⊆ univ \ G_dual.U := by + rintro _ ⟨t, ht, rfl⟩ + refine ⟨mem_univ _, fun htU => ?_⟩ + by_cases ht0 : t = 0 + · subst ht0; exact disjoint_left.mp hdisj_V_U h0 htU + · have ht_Ioo : t ∈ Ioo (0 : unitInterval) 1 := + ⟨unitInterval.pos_iff_ne_zero.mpr ht0, ht.2.trans ht₀.2⟩ + have hmem : γ t ∈ e.1 ∩ G_dual.U := ⟨himg ▸ mem_image_of_mem γ ht_Ioo, htU⟩ + rw [he_GdU, mem_singleton_iff] at hmem + exact ht.2.ne (hinj ht_Ioo ht₀ hmem) + have hIco_comp : γ '' Ico 0 t₀ ⊆ compV (γ 0) := + (isPreconnected_Ico.image γ hγ.continuousOn).subset_connectedComponentIn + ⟨0, left_mem_Ico.mpr ht₀.1, rfl⟩ hIco_sub + have hIoc_sub : γ '' Ioc t₀ 1 ⊆ univ \ G_dual.U := by + rintro _ ⟨t, ht, rfl⟩ + refine ⟨mem_univ _, fun htU => ?_⟩ + by_cases ht1 : t = 1 + · subst ht1; exact disjoint_left.mp hdisj_V_U h1 htU + · have ht_Ioo : t ∈ Ioo (0 : unitInterval) 1 := + ⟨ht₀.1.trans ht.1, unitInterval.lt_one_iff_ne_one.mpr ht1⟩ + have hmem : γ t ∈ e.1 ∩ G_dual.U := ⟨himg ▸ mem_image_of_mem γ ht_Ioo, htU⟩ + rw [he_GdU, mem_singleton_iff] at hmem + exact ht.1.ne' (hinj ht_Ioo ht₀ hmem) + have hIoc_comp : γ '' Ioc t₀ 1 ⊆ compV (γ 1) := + (isPreconnected_Ioc.image γ hγ.continuousOn).subset_connectedComponentIn + ⟨1, right_mem_Ioc.mpr ht₀.2, rfl⟩ hIoc_sub + obtain ⟨x, hx_r', hx_e⟩ := he4 r_dual hr_dual hinc + have hxU : x ∉ G_dual.U := region_subset hr_dual hx_r' + rw [← himg] at hx_e + obtain ⟨t, ht, rfl⟩ := hx_e + have hne : t ≠ t₀ := fun h => hxU (h ▸ (he'.2.1 hp_e').1) + rcases lt_or_gt_of_ne hne with hlt | hgt + · have hxu := hIco_comp ⟨t, ⟨unitInterval.nonneg t, hlt⟩, rfl⟩ + exact ⟨γ 0, h0, (region_eq_of_mem hr_dual (hcompV_mem h0).1 hx_r' hxu).symm⟩ + · have hxv := hIoc_comp ⟨t, ⟨hgt, unitInterval.le_one t⟩, rfl⟩ + exact ⟨γ 1, h1, (region_eq_of_mem hr_dual (hcompV_mem h1).1 hx_r' hxv).symm⟩ + · have hfront : closure r_dual \ r_dual ⊆ G_dual.U := by + rintro y ⟨hy_cl, hy_not_r⟩ + by_contra hyU + obtain ⟨r', hr', hyr'⟩ := exists_region_of_notMem hyU + obtain ⟨w, hwr', hwr⟩ := mem_closure_iff.mp hy_cl r' (region_isOpen hr') hyr' + exact hy_not_r (region_eq_of_mem hr' hr_dual hwr' hwr ▸ hyr') + have hAll_conn : IsPreconnected (univ \ G_dual.V) := + disc_isPreconnected_sdiff_finite hS isOpen_univ isPreconnected_univ G_dual.finite_V + obtain ⟨x₀, hx₀⟩ := region_nonempty hr_dual + have hx₀_in : x₀ ∈ (univ \ G_dual.V) ∩ r_dual := + ⟨⟨mem_univ x₀, fun hxV => region_subset hr_dual hx₀ (G_dual.V_subset_U hxV)⟩, hx₀⟩ + have hsub_all : univ \ G_dual.V ⊆ r_dual := by + intro x hx + by_contra hxr + by_cases hxcl : x ∈ closure r_dual + · have hxU : x ∈ G_dual.U := hfront ⟨hxcl, hxr⟩ + obtain ⟨e', he', hxe'⟩ := G_dual.exists_edge_of_mem hxU hx.2 + exact hex ⟨e', he', he', hr_dual, x, hxe', hxcl⟩ + · obtain ⟨w, -, hwr, hwcl⟩ := + hAll_conn r_dual (closure r_dual)ᶜ (region_isOpen hr_dual) isClosed_closure.isOpen_compl + (fun y hy => by + by_cases hyr : y ∈ r_dual + · exact Or.inl hyr + · exact Or.inr fun hycl => by + have hyU : y ∈ G_dual.U := hfront ⟨hycl, hyr⟩ + obtain ⟨e', he', hye'⟩ := G_dual.exists_edge_of_mem hyU hy.2 + exact hex ⟨e', he', he', hr_dual, y, hye', hycl⟩) + ⟨x₀, hx₀_in⟩ ⟨x, hx, hxcl⟩ + exact hwcl (subset_closure hwr) + obtain ⟨v₀, hv₀⟩ := hConn.1 + have hv₀_r : v₀ ∈ r_dual := + hsub_all ⟨mem_univ v₀, fun hvVd => disjoint_left.mp hdisj_V_U hv₀ (G_dual.V_subset_U hvVd)⟩ + exact ⟨v₀, hv₀, + (region_eq_of_mem hr_dual (hcompV_mem hv₀).1 hv₀_r (hcompV_mem hv₀).2).symm⟩ + have himg_eq : compV '' G.V = G_dual.R := by + refine Subset.antisymm ?_ hsurj_R + rintro _ ⟨v, hv, rfl⟩ + exact (hcompV_mem hv).1 + let ρ : S → Set S := fun w => connectedComponentIn (univ \ G.U) w + have hρ_inj : InjOn ρ G_dual.V := by + intro w₁ hw₁ w₂ hw₂ heq + obtain ⟨r₁, hr₁, hw₁r⟩ := hDual_V_in_R w₁ hw₁ + obtain ⟨r₂, hr₂, hw₂r⟩ := hDual_V_in_R w₂ hw₂ + have hρ1 : ρ w₁ = r₁ := + region_eq_of_mem ⟨w₁, ⟨mem_univ _, region_subset hr₁ hw₁r⟩, rfl⟩ hr₁ + (mem_connectedComponentIn ⟨mem_univ _, region_subset hr₁ hw₁r⟩) hw₁r + have hρ2 : ρ w₂ = r₂ := + region_eq_of_mem ⟨w₂, ⟨mem_univ _, region_subset hr₂ hw₂r⟩, rfl⟩ hr₂ + (mem_connectedComponentIn ⟨mem_univ _, region_subset hr₂ hw₂r⟩) hw₂r + have hr_eq : r₁ = r₂ := hρ1.symm.trans (heq.trans hρ2) + subst hr_eq + obtain ⟨w, _, hw_uniq⟩ := hDual_V_unique r₁ hr₁ + exact (hw_uniq w₁ ⟨hw₁r, hw₁⟩).trans (hw_uniq w₂ ⟨hw₂r, hw₂⟩).symm + have hρ_img : ρ '' G_dual.V = G.R := by + ext r + constructor + · rintro ⟨w, hw, rfl⟩ + obtain ⟨r', hr', hwr'⟩ := hDual_V_in_R w hw + have hρw : ρ w = r' := + region_eq_of_mem ⟨w, ⟨mem_univ _, region_subset hr' hwr'⟩, rfl⟩ hr' + (mem_connectedComponentIn ⟨mem_univ _, region_subset hr' hwr'⟩) hwr' + exact hρw ▸ hr' + · intro hr + obtain ⟨w, ⟨hwr, hwV⟩, _⟩ := hDual_V_unique r hr + refine ⟨w, hwV, ?_⟩ + exact region_eq_of_mem ⟨w, ⟨mem_univ _, region_subset hr hwr⟩, rfl⟩ hr + (mem_connectedComponentIn ⟨mem_univ _, region_subset hr hwr⟩) hwr + have hV_dual_card : G_dual.V.ncard = G.R.ncard := by + rw [← hρ_img, hρ_inj.ncard_image] + have hE_dual_card : G_dual.E.ncard = G.E.ncard := by + have henc : G.E.encard = G_dual.E.encard := encard_congr edgeEquiv + exact (congrArg ENat.toNat henc).symm + have hbd_card : (G_dual.V ∩ bd S).ncard = (G.V ∩ bd S).ncard := + ncard_eq_of_isDualPointSet hS.isOArc_bd inter_subset_right + (G.finite_V.subset inter_subset_left) hDual_bd + obtain ⟨p₀, -, hp₀⟩ := + disc_exists_notMem_U hS hG isOpen_univ ⟨φ_disc ⟨0, by simp [ClosedUnitDisc]⟩, mem_univ _⟩ + have hr₀ : connectedComponentIn (univ \ G.U) p₀ ∈ G.R := ⟨p₀, ⟨mem_univ p₀, hp₀⟩, rfl⟩ + obtain ⟨w₀, ⟨_, hw₀_V⟩, _⟩ := hDual_V_unique _ hr₀ + have hDual_V_ne : G_dual.V.Nonempty := ⟨w₀, hw₀_V⟩ + have hV_le_R : G.V.ncard ≤ G_dual.R.ncard := by + rcases (G.V ∩ bd S).eq_empty_or_nonempty with hbd_emp | ⟨b₀, hb₀⟩ + · have hup := euler_upper_bound_of_bd_empty hS hG hConn hbd_emp + have hlow := (euler_lower_bound hS hDual_prop).2 hDual_V_ne + omega + · have hreach : ∀ v ∈ G.V, ∃ b ∈ G.V ∩ bd S, Nonempty (GraphWalk G.toGraph v b) := + fun v hv => ⟨b₀, hb₀, hConn.2 v hv b₀ hb₀.1⟩ + have hup := euler_upper_bound_of_reach_bd hS hG hreach + have hlow := (euler_lower_bound hS hDual_prop).1 + omega + have hR_le_V : G_dual.R.ncard ≤ G.V.ncard := by + rw [← himg_eq] + exact ncard_image_le G.finite_V + have hcard_eq : (compV '' G.V).ncard = G.V.ncard := by + rw [himg_eq] + omega + have hinj : InjOn compV G.V := injOn_of_ncard_image_eq hcard_eq G.finite_V + exact fun v₁ hv₁ v₂ hv₂ heq => hinj hv₁ hv₂ heq + +end GraphMinor.GM06 diff --git a/LeanPool/GraphMinor/GM06/RegionCurve.lean b/LeanPool/GraphMinor/GM06/RegionCurve.lean new file mode 100644 index 0000000000..da7fd90216 --- /dev/null +++ b/LeanPool/GraphMinor/GM06/RegionCurve.lean @@ -0,0 +1,968 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.Defs +import LeanPool.GraphMinor.GM06.RegionLocal +import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.Surface.Crossing +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# Complementary Curves in Regions of a Proper Drawing on a Disc + +This file proves `exists_region_curve`: for any proper drawing `G` on a closed disc space `S`, +any region `r ∈ G.R`, and any two points `p, q ∈ closure r`, there is a continuous curve +`γ : C(unitInterval, S)` with `γ 0 = p`, `γ 1 = q`, and `γ t ∈ r` for all `t ∈ Ioo 0 1`. +-/ + +public section + +namespace GraphMinor.GM06 + +open Set Function Topology Metric GraphMinor.Surface unitInterval + +universe u + +/-! ## 1. Pulling Back Plane Entry Curves to the Closed Disc Space -/ + +private theorem subset_openUnitDisc_of_isPreconnected + {P : Set EuclideanPlane} (hP : IsPreconnected P) + (hdisj : Disjoint P UnitCircle) (hinter : (P ∩ OpenUnitDisc).Nonempty) : + P ⊆ OpenUnitDisc := by + refine hP.subset_left_of_subset_union Metric.isOpen_ball + (show IsOpen ClosedUnitDiscᶜ from Metric.isClosed_closedBall.isOpen_compl) ?_ ?_ hinter + · exact disjoint_left.mpr fun z hz h => h (Metric.ball_subset_closedBall hz) + · intro z hz + by_cases hzb : z ∈ OpenUnitDisc + · exact Or.inl hzb + · refine Or.inr fun hzc => ?_ + have hle : ‖z‖ ≤ 1 := by simpa [ClosedUnitDisc] using hzc + have hge : 1 ≤ ‖z‖ := not_lt.mp (by simpa [OpenUnitDisc] using hzb) + have heq : ‖z‖ = 1 := le_antisymm hle hge + exact disjoint_left.mp hdisj hz (by simpa [UnitCircle] using heq) + +private theorem entry_path_of_plane {S : Type u} [TopologicalSpace S] + (e : ClosedUnitDisc ≃ₜ S) (G : Drawing S) {r : Set S} (hr : r ∈ G.R) {p : S} + {P : Set EuclideanPlane} {α : C(I, EuclideanPlane)} + (hP_conn : IsPreconnected P) + (hP_disj : Disjoint P (UnitCircle ∪ (fun x => (e.symm x).1) '' G.U)) + (hP_inter : (P ∩ (fun x => (e.symm x).1) '' (r \ bd S)).Nonempty) + (hα0 : α 0 = (e.symm p).1) + (hαP : ∀ t : I, 0 < (t : ℝ) → α t ∈ P) : + ∃ α_S : C(I, S), α_S 0 = p ∧ ∀ t : I, 0 < (t : ℝ) → α_S t ∈ r \ bd S := by + have hbd_img := image_bd_homeomorph e + rw [bd_closedUnitDisc] at hbd_img + have hR_sub_open : (fun x => (e.symm x).1) '' (r \ bd S) ⊆ OpenUnitDisc := by + rintro _ ⟨x, ⟨_, hxbd⟩, rfl⟩ + have hle : ‖(e.symm x).1‖ ≤ 1 := mem_closedBall_zero_iff.mp (e.symm x).2 + have hne : ‖(e.symm x).1‖ ≠ 1 := by + intro h1 + apply hxbd + rw [← hbd_img] + exact ⟨e.symm x, by simpa [UnitCircle] using h1, e.apply_symm_apply x⟩ + simpa [OpenUnitDisc] using lt_of_le_of_ne hle hne + have hP_open : P ⊆ OpenUnitDisc := + subset_openUnitDisc_of_isPreconnected hP_conn + (hP_disj.mono_right subset_union_left) + (hP_inter.mono (inter_subset_inter_right P hR_sub_open)) + have hP_disc : P ⊆ ClosedUnitDisc := fun z hz => Metric.ball_subset_closedBall (hP_open hz) + have hα_disc : ∀ t : I, α t ∈ ClosedUnitDisc := by + intro t + rcases eq_or_lt_of_le (t.2.1 : (0 : ℝ) ≤ t) with ht0 | ht + · have ht_eq : t = 0 := Subtype.ext ht0.symm + rw [ht_eq, hα0] + exact (e.symm p).2 + · exact hP_disc (hαP t ht) + let g : I → ClosedUnitDisc := fun t => ⟨α t, hα_disc t⟩ + have hg_cont : Continuous g := Continuous.subtype_mk α.continuous _ + let A : Set S := e '' (Subtype.val ⁻¹' P) + have hP'_conn : IsPreconnected (Subtype.val ⁻¹' P : Set ClosedUnitDisc) := by + refine (IsInducing.subtypeVal : + IsInducing (Subtype.val : ClosedUnitDisc → EuclideanPlane)).isPreconnected_image.mp ?_ + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hP_disc] + exact hP_conn + have hA_conn : IsPreconnected A := hP'_conn.image e e.continuous.continuousOn + have hA_disj : Disjoint A G.U := by + refine disjoint_left.mpr ?_ + rintro _ ⟨x, hxP, rfl⟩ hxU + exact disjoint_left.mp hP_disj hxP (Or.inr ⟨e x, hxU, by simp⟩) + have hA_inter : (A ∩ r).Nonempty := by + rcases hP_inter with ⟨_, hzP, x, ⟨hxr, _⟩, rfl⟩ + exact ⟨x, ⟨e.symm x, hzP, e.apply_symm_apply x⟩, hxr⟩ + have hA_sub : A ⊆ r := region_subset_of_isPreconnected G hr hA_conn hA_disj hA_inter + refine ⟨⟨e ∘ g, e.continuous.comp hg_cont⟩, ?_, ?_⟩ + · change e (g 0) = p + have hg0 : g 0 = e.symm p := Subtype.ext hα0 + rw [hg0, e.apply_symm_apply] + · intro t ht + refine ⟨hA_sub ⟨g t, hαP t ht, rfl⟩, fun hb => ?_⟩ + rw [← hbd_img] at hb + obtain ⟨y, hy, hye⟩ := hb + have hyg : y = g t := e.injective hye + have hcirc : α t ∈ UnitCircle := by + have : (y : EuclideanPlane) ∈ UnitCircle := by simpa [UnitCircle] using hy + rw [hyg] at this + exact this + exact disjoint_left.mp hP_disj (hαP t ht) (Or.inl hcirc) + +/-! ## 2. Semicircle Spokes of `UnitCircle` at a Boundary Vertex -/ + +private noncomputable def bdAngle (b : Bool) (t : I) : ℝ := + if b then -(Real.pi * (t : ℝ)) else Real.pi * (t : ℝ) + +private noncomputable def bdSpoke (c : EuclideanPlane) (b : Bool) (t : I) : EuclideanPlane := + complexPlane (complexPlane.symm c * (Circle.exp (bdAngle b t) : ℂ)) + +private theorem continuous_bdSpoke (c : EuclideanPlane) (b : Bool) : + Continuous (bdSpoke c b) := by + unfold bdSpoke bdAngle + refine complexPlane.continuous.comp + (continuous_const.mul (continuous_subtype_val.comp (Circle.exp.continuous.comp ?_))) + cases b <;> dsimp <;> fun_prop + +private theorem bdSpoke_zero (c : EuclideanPlane) (b : Bool) : + bdSpoke c b 0 = c := by + simp [bdSpoke, bdAngle] + +private theorem bdSpoke_mem_unitCircle {c : EuclideanPlane} (hc : c ∈ UnitCircle) + (b : Bool) (t : I) : bdSpoke c b t ∈ UnitCircle := by + have hc_norm : ‖complexPlane.symm c‖ = 1 := by + rw [LinearIsometryEquiv.norm_map] + simpa [UnitCircle] using hc + simp only [bdSpoke, UnitCircle, Metric.mem_sphere, dist_zero_right, + LinearIsometryEquiv.norm_map, norm_mul, hc_norm, one_mul, Circle.norm_coe] + +private theorem bdSpoke_injective {c : EuclideanPlane} (hc : c ∈ UnitCircle) (b : Bool) : + Function.Injective (bdSpoke c b) := by + have hc_ne : complexPlane.symm c ≠ 0 := by + intro h0 + have hnorm : ‖complexPlane.symm c‖ = 1 := by + rw [LinearIsometryEquiv.norm_map]; simpa [UnitCircle] using hc + rw [h0, norm_zero] at hnorm + exact zero_ne_one hnorm + intro s t h + have h1 := complexPlane.injective h + have h2 := mul_left_cancel₀ hc_ne h1 + have h3 : Circle.exp (bdAngle b s) = Circle.exp (bdAngle b t) := Subtype.ext h2 + rw [Circle.exp_eq_exp] at h3 + rcases h3 with ⟨m, hm⟩ + have hpi := Real.pi_pos + have hs0 : 0 ≤ (s : ℝ) := s.2.1 + have hs1 : (s : ℝ) ≤ 1 := s.2.2 + have ht0 : 0 ≤ (t : ℝ) := t.2.1 + have ht1 : (t : ℝ) ≤ 1 := t.2.2 + have hm0 : m = 0 := by + by_contra hne + rcases lt_or_gt_of_ne hne with hlt | hgt + · have hm_le : (m : ℝ) ≤ -1 := by exact_mod_cast Int.le_sub_one_of_lt hlt + cases b <;> dsimp [bdAngle] at hm <;> nlinarith + · have hm_ge : (1 : ℝ) ≤ m := by exact_mod_cast Int.add_one_le_of_lt hgt + cases b <;> dsimp [bdAngle] at hm <;> nlinarith + subst hm0 + simp only [Int.cast_zero, zero_mul, add_zero] at hm + have h_eq : (s : ℝ) = (t : ℝ) := by + cases b <;> dsimp [bdAngle] at hm <;> nlinarith + exact Subtype.ext h_eq + +private theorem bdSpoke_eq_of_ne {c : EuclideanPlane} (hc : c ∈ UnitCircle) + {b₁ b₂ : Bool} (hb : b₁ ≠ b₂) {s t : I} (hs : 0 < s) (ht : 0 < t) + (heq : bdSpoke c b₁ s = bdSpoke c b₂ t) : s = 1 ∧ t = 1 := by + have hc_ne : complexPlane.symm c ≠ 0 := by + intro h0 + have hnorm : ‖complexPlane.symm c‖ = 1 := by + rw [LinearIsometryEquiv.norm_map]; simpa [UnitCircle] using hc + rw [h0, norm_zero] at hnorm + exact zero_ne_one hnorm + have h1 := mul_left_cancel₀ hc_ne (complexPlane.injective heq) + have h2 : Circle.exp (bdAngle b₁ s) = Circle.exp (bdAngle b₂ t) := Subtype.ext h1 + rw [Circle.exp_eq_exp] at h2 + rcases h2 with ⟨m, hm⟩ + have hpi := Real.pi_pos + have hs0 : 0 < (s : ℝ) := hs + have hs1 : (s : ℝ) ≤ 1 := s.2.2 + have ht0 : 0 < (t : ℝ) := ht + have ht1 : (t : ℝ) ≤ 1 := t.2.2 + cases b₁ <;> cases b₂ + · exact absurd rfl hb + · dsimp [bdAngle] at hm + have hm1 : m = 1 := by + by_contra hne + rcases lt_or_gt_of_ne hne with hlt | hgt + · have hm_le : (m : ℝ) ≤ 0 := by exact_mod_cast Int.le_sub_one_of_lt hlt + nlinarith + · have hm_ge : (2 : ℝ) ≤ m := by exact_mod_cast Int.add_one_le_of_lt hgt + nlinarith + subst hm1 + simp only [Int.cast_one, one_mul] at hm + exact ⟨Subtype.ext (show (s : ℝ) = 1 by nlinarith), Subtype.ext (show (t : ℝ) = 1 by nlinarith)⟩ + · dsimp [bdAngle] at hm + have hm1 : m = -1 := by + by_contra hne + rcases lt_or_gt_of_ne hne with hlt | hgt + · have hm_le : (m : ℝ) ≤ -2 := by exact_mod_cast Int.le_sub_one_of_lt hlt + nlinarith + · have hm_ge : (0 : ℝ) ≤ m := by exact_mod_cast Int.add_one_le_of_lt hgt + nlinarith + subst hm1 + simp only [Int.cast_neg, Int.cast_one] at hm + exact ⟨Subtype.ext (show (s : ℝ) = 1 by nlinarith), Subtype.ext (show (t : ℝ) = 1 by nlinarith)⟩ + · exact absurd rfl hb + +private theorem unitCircle_subset_range_bdSpoke {c : EuclideanPlane} (hc : c ∈ UnitCircle) : + UnitCircle ⊆ range (bdSpoke c false) ∪ range (bdSpoke c true) := by + intro w hw + have hc_norm : ‖complexPlane.symm c‖ = 1 := by + rw [LinearIsometryEquiv.norm_map]; simpa [UnitCircle] using hc + have hw_norm : ‖complexPlane.symm w‖ = 1 := by + rw [LinearIsometryEquiv.norm_map]; simpa [UnitCircle] using hw + let zc : Circle := ⟨complexPlane.symm c, mem_sphere_zero_iff_norm.mpr hc_norm⟩ + let zw : Circle := ⟨complexPlane.symm w, mem_sphere_zero_iff_norm.mpr hw_norm⟩ + let q : Circle := zc⁻¹ * zw + have hq : complexPlane.symm c * (q : ℂ) = complexPlane.symm w := + congrArg Subtype.val (mul_inv_cancel_left zc zw) + have hexp : Circle.exp (Complex.arg (q : ℂ)) = q := Circle.exp_arg q + have h_le_pi : Complex.arg (q : ℂ) ≤ Real.pi := Complex.arg_le_pi (q : ℂ) + have h_gt_neg_pi : -Real.pi < Complex.arg (q : ℂ) := Complex.neg_pi_lt_arg (q : ℂ) + have hpi := Real.pi_pos + rcases le_or_gt 0 (Complex.arg (q : ℂ)) with hnonneg | hneg + · left + let t : I := ⟨Complex.arg (q : ℂ) / Real.pi, + div_nonneg hnonneg hpi.le, (div_le_one hpi).mpr h_le_pi⟩ + refine ⟨t, ?_⟩ + unfold bdSpoke + have hmul : bdAngle false t = Complex.arg (q : ℂ) := by + dsimp [bdAngle, t]; field_simp + rw [hmul, hexp, hq, LinearIsometryEquiv.apply_symm_apply] + · right + let t : I := ⟨(-Complex.arg (q : ℂ)) / Real.pi, + div_nonneg (by linarith) hpi.le, (div_le_one hpi).mpr (by linarith)⟩ + refine ⟨t, ?_⟩ + unfold bdSpoke + have hmul : bdAngle true t = Complex.arg (q : ℂ) := by + dsimp [bdAngle, t]; field_simp + rw [hmul, hexp, hq, LinearIsometryEquiv.apply_symm_apply] + +/-! ## 3. Decomposing `G.U` into Half-Edge Spokes Around a Vertex -/ + +private theorem endOf_eq (b : Bool) : GM11.endOf b = if b then 1 else 0 := by + ext + rw [← GM11.halfPar_zero, GM11.halfPar_coe] + cases b <;> simp + +private def localHalfEdges {S : Type u} [TopologicalSpace S] + (G : Drawing S) (γ : Set S → I → S) (p : S) : Set (Set S × Bool) := + {x | x.1 ∈ G.E ∧ γ x.1 (GM11.endOf x.2) = p} + +private theorem finite_localHalfEdges {S : Type u} [TopologicalSpace S] + (G : Drawing S) (γ : Set S → I → S) (p : S) : + (localHalfEdges G γ p).Finite := + (G.finite_edges.prod (finite_univ (α := Bool))).subset fun _ hx => ⟨hx.1, mem_univ _⟩ + +private noncomputable def localSpoke {S : Type u} (γ : Set S → I → S) + (x : Set S × Bool) (t : I) : S := + γ x.1 (GM11.halfPar x.2 t) + +private theorem localSpoke_zero {S : Type u} (γ : Set S → I → S) (x : Set S × Bool) : + localSpoke γ x 0 = γ x.1 (GM11.endOf x.2) := by + simp [localSpoke] + +private theorem continuous_localSpoke {S : Type u} [TopologicalSpace S] + {G : Drawing S} {γ : Set S → I → S} (hγ : GM11.EdgePar G γ) + {x : Set S × Bool} (hx : x.1 ∈ G.E) : + Continuous (localSpoke γ x) := + (hγ.cont _ hx).comp (GM11.continuous_halfPar x.2) + +private theorem localSpoke_mem_edge {S : Type u} [TopologicalSpace S] + {G : Drawing S} {γ : Set S → I → S} (hγ : GM11.EdgePar G γ) + {x : Set S × Bool} (hx : x.1 ∈ G.E) {t : I} (ht : 0 < t) : + localSpoke γ x t ∈ x.1 := by + have := mem_image_of_mem (γ x.1) (GM11.halfPar_mem_Ioo x.2 ht) + rwa [hγ.image _ hx] at this + +private theorem localSpoke_injective {S : Type u} [TopologicalSpace S] + {G : Drawing S} {γ : Set S → I → S} (hγ : GM11.EdgePar G γ) + {x : Set S × Bool} (hx : x.1 ∈ G.E) : + Function.Injective (localSpoke γ x) := by + intro s t h + by_cases hs : 0 < s + · by_cases ht : 0 < t + · exact GM11.halfPar_injective _ + (hγ.inj _ hx (GM11.halfPar_mem_Ioo _ hs) (GM11.halfPar_mem_Ioo _ ht) h) + · have ht0 : t = 0 := le_antisymm (not_lt.mp ht) bot_le + subst ht0 + rw [localSpoke_zero] at h + have hmem := localSpoke_mem_edge hγ hx hs + rw [h] at hmem + have hV : γ x.1 (GM11.endOf x.2) ∈ G.V := by + rw [endOf_eq] + cases x.2 + · exact hγ.zero _ hx + · exact hγ.one _ hx + exact absurd hV (GM11.edge_notMem_V hx hmem) + · have hs0 : s = 0 := le_antisymm (not_lt.mp hs) bot_le + subst hs0 + by_cases ht : 0 < t + · rw [localSpoke_zero] at h + have hmem := localSpoke_mem_edge hγ hx ht + rw [← h] at hmem + have hV : γ x.1 (GM11.endOf x.2) ∈ G.V := by + rw [endOf_eq] + cases x.2 + · exact hγ.zero _ hx + · exact hγ.one _ hx + exact absurd hV (GM11.edge_notMem_V hx hmem) + · exact (le_antisymm (not_lt.mp ht) bot_le).symm + +private theorem localSpoke_eq_of_ne {S : Type u} [TopologicalSpace S] + {G : Drawing S} {γ : Set S → I → S} (hγ : GM11.EdgePar G γ) + {x y : Set S × Bool} (hx : x.1 ∈ G.E) (hy : y.1 ∈ G.E) + (hxy : x ≠ y) {s t : I} (hs : 0 < s) (ht : 0 < t) + (h : localSpoke γ x s = localSpoke γ y t) : + s = 1 ∧ t = 1 := by + obtain ⟨e, b⟩ := x + obtain ⟨e', b'⟩ := y + have h1 := localSpoke_mem_edge hγ hx hs + have h2 := localSpoke_mem_edge hγ hy ht + rw [h] at h1 + have he : e = e' := G.edge_eq_of_mem hx hy h1 h2 + subst he + have hb : b ≠ b' := fun hb => hxy (by rw [hb]) + exact GM11.halfPar_eq_of_ne hb + (hγ.inj _ hx (GM11.halfPar_mem_Ioo b hs) (GM11.halfPar_mem_Ioo b' ht) h) + +private theorem closure_edge_subset_spoke_union {S : Type u} [TopologicalSpace S] [T2Space S] + {G : Drawing S} {γ : Set S → I → S} (hγ : GM11.EdgePar G γ) + {e : Set S} (he : e ∈ G.E) : + closure e ⊆ range (localSpoke γ (e, false)) ∪ range (localSpoke γ (e, true)) := by + have hcl : closure e ⊆ range (γ e) := by + refine closure_minimal ?_ (isCompact_range (hγ.cont e he)).isClosed + intro x hx + rw [← hγ.image e he] at hx + rcases hx with ⟨t, _, rfl⟩ + exact ⟨t, rfl⟩ + rintro x hx + obtain ⟨t, rfl⟩ := hcl hx + rcases le_or_gt (t : ℝ) (1 / 2) with ht | ht + · left + let s : I := ⟨2 * (t : ℝ), by linarith [t.2.1], by linarith⟩ + refine ⟨s, ?_⟩ + unfold localSpoke + congr 1 + ext + rw [GM11.halfPar_coe] + simp only [Bool.false_eq_true, ite_false, s] + ring + · right + let s : I := ⟨2 * (1 - (t : ℝ)), by linarith [t.2.2], by linarith⟩ + refine ⟨s, ?_⟩ + unfold localSpoke + congr 1 + ext + rw [GM11.halfPar_coe] + simp only [ite_true, s] + ring + +private noncomputable def vertexBad {S : Type u} [TopologicalSpace S] + (G : Drawing S) (γ : Set S → I → S) (p : S) : Set S := + (G.V \ {p}) ∪ ⋃ x ∈ {x : Set S × Bool | x.1 ∈ G.E ∧ x ∉ localHalfEdges G γ p}, + range (localSpoke γ x) + +private theorem isClosed_vertexBad {S : Type u} [TopologicalSpace S] [T2Space S] + (G : Drawing S) {γ : Set S → I → S} (hγ : GM11.EdgePar G γ) (p : S) : + IsClosed (vertexBad G γ p) := by + have hfin : {x : Set S × Bool | x.1 ∈ G.E ∧ x ∉ localHalfEdges G γ p}.Finite := + (G.finite_edges.prod (finite_univ (α := Bool))).subset fun _ hx => ⟨hx.1, mem_univ _⟩ + refine (G.finite_V.subset sdiff_subset).isClosed.union ?_ + exact hfin.isClosed_biUnion fun x hx => + (isCompact_range (continuous_localSpoke hγ hx.1)).isClosed + +private theorem notMem_vertexBad {S : Type u} [TopologicalSpace S] + (G : Drawing S) {γ : Set S → I → S} (hγ : GM11.EdgePar G γ) {p : S} (hp : p ∈ G.V) : + p ∉ vertexBad G γ p := by + rintro (⟨_, hp_ne⟩ | h) + · exact hp_ne rfl + · obtain ⟨x, ⟨hxE, hxH⟩, s, hsp⟩ := mem_iUnion₂.mp h + by_cases hs0 : 0 < s + · have hmem := localSpoke_mem_edge hγ hxE hs0 + rw [hsp] at hmem + exact GM11.edge_notMem_V hxE hmem hp + · have hs_eq : s = 0 := le_antisymm (not_lt.mp hs0) bot_le + rw [hs_eq, localSpoke_zero] at hsp + exact hxH ⟨hxE, hsp⟩ + +private theorem U_sdiff_subset_vertexBad_union_spokes {S : Type u} [TopologicalSpace S] [T2Space S] + (G : Drawing S) {γ : Set S → I → S} (hγ : GM11.EdgePar G γ) (p : S) : + G.U \ {p} ⊆ vertexBad G γ p ∪ + ⋃ x : localHalfEdges G γ p, range (localSpoke γ x.1) := by + rintro z ⟨hzU, hzp⟩ + rw [G.U_eq] at hzU + rcases hzU with hzV | hzE + · exact Or.inl (Or.inl ⟨hzV, hzp⟩) + · obtain ⟨e, he, hze⟩ := mem_iUnion₂.mp hzE + rcases closure_edge_subset_spoke_union hγ he hze with h1 | h1 + · by_cases hm : (e, false) ∈ localHalfEdges G γ p + · exact Or.inr (mem_iUnion.mpr ⟨⟨(e, false), hm⟩, h1⟩) + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨(e, false), ⟨he, hm⟩, h1⟩)) + · by_cases hm : (e, true) ∈ localHalfEdges G γ p + · exact Or.inr (mem_iUnion.mpr ⟨⟨(e, true), hm⟩, h1⟩) + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨(e, true), ⟨he, hm⟩, h1⟩)) + +/-! ## 4. Entry Curve from Any Point of `closure r` (`exists_region_entry_path`) -/ + +private theorem exists_region_entry_path_at_vertex + {S : Type u} [TopologicalSpace S] [T2Space S] + (e : ClosedUnitDisc ≃ₜ S) (G : Drawing S) (hProper : G.IsProper) + {r : Set S} (hr : r ∈ G.R) {p : S} (hpU : p ∈ G.U) (hpV : p ∈ G.V) : + let ι : S → EuclideanPlane := fun x => (e.symm x).1 + let U_full : Set EuclideanPlane := UnitCircle ∪ ι '' G.U + let R_open : Set EuclideanPlane := ι '' (r \ bd S) + Continuous ι → Function.Injective ι → IsClosedMap ι → + (∀ x : S, ι x ∈ UnitCircle ↔ x ∈ bd S) → + R_open ⊆ U_fullᶜ → ι p ∈ closure R_open → + ∃ α : C(I, S), α 0 = p ∧ ∀ t : I, 0 < (t : ℝ) → α t ∈ r \ bd S := by + classical + intro ι U_full R_open hι_cont hι_inj hι_closed hι_bd hR_sub hc_cl + have : Nonempty S := ⟨p⟩ + obtain ⟨γ, hγ⟩ := GM11.exists_edgePar G + let H := localHalfEdges G γ p + have : Fintype H := (finite_localHalfEdges G γ p).fintype + have hBad_closed : IsClosed (vertexBad G γ p) := isClosed_vertexBad G hγ p + have hp_not_Bad : p ∉ vertexBad G γ p := notMem_vertexBad G hγ hpV + have hU_sdiff := U_sdiff_subset_vertexBad_union_spokes G hγ p + have hspoke_sub : ∀ x : H, range (fun t => ι (localSpoke γ x.1 t)) ⊆ U_full := by + rintro x _ ⟨t, rfl⟩ + right + refine ⟨localSpoke γ x.1 t, ?_, rfl⟩ + by_cases ht0 : 0 < t + · exact G.closure_subset_U x.2.1 (subset_closure (localSpoke_mem_edge hγ x.2.1 ht0)) + · have ht_eq : t = 0 := le_antisymm (not_lt.mp ht0) bot_le + rw [ht_eq, localSpoke_zero, x.2.2] + exact G.V_subset_U hpV + by_cases hp_bd : p ∈ bd S + · -- Boundary vertex: combine H with the two boundary semicircles + have hc_unit : ι p ∈ UnitCircle := (hι_bd p).mpr hp_bd + let sp : H ⊕ Bool → I → EuclideanPlane := fun i t => + match i with + | .inl x => ι (localSpoke γ x.1 t) + | .inr b => bdSpoke (ι p) b t + have h2 : 2 ≤ Fintype.card (H ⊕ Bool) := by + rw [Fintype.card_sum, Fintype.card_bool] + omega + let Bad : Set EuclideanPlane := ι '' vertexBad G γ p + have hBad : IsClosed Bad := hι_closed _ hBad_closed + have hcBad : ι p ∉ Bad := by + rintro ⟨x, hx, hxp⟩ + exact hp_not_Bad (hι_inj hxp ▸ hx) + have hsp_cont : ∀ i, Continuous (sp i) := by + rintro (x | b) + · exact hι_cont.comp (continuous_localSpoke hγ x.2.1) + · exact continuous_bdSpoke (ι p) b + have hsp_zero : ∀ i, sp i 0 = ι p := by + rintro (x | b) + · simp [sp, localSpoke_zero, x.2.2] + · exact bdSpoke_zero (ι p) b + have hsp_inj : ∀ i, Function.Injective (sp i) := by + rintro (x | b) + · exact hι_inj.comp (localSpoke_injective hγ x.2.1) + · exact bdSpoke_injective hc_unit b + have hsp_disj : ∀ i j, i ≠ j → ∀ s t : I, 0 < s → 0 < t → + sp i s = sp j t → s = 1 ∧ t = 1 := by + rintro (x | b₁) (y | b₂) hij s t hs ht heq + · have hxy : x.1 ≠ y.1 := fun h => hij (congrArg Sum.inl (Subtype.ext h)) + exact localSpoke_eq_of_ne hγ x.2.1 y.2.1 hxy hs ht (hι_inj heq) + · exfalso + have hmem_e : localSpoke γ x.1 s ∈ x.1.1 := localSpoke_mem_edge hγ x.2.1 hs + have hmem_U : localSpoke γ x.1 s ∈ G.U := (x.2.1.2.1 hmem_e).1 + have hnot_V : localSpoke γ x.1 s ∉ G.V := (x.2.1.2.1 hmem_e).2 + have hmem_bd : localSpoke γ x.1 s ∈ bd S := by + rw [← hι_bd] + change sp (.inl x) s ∈ UnitCircle + rw [heq] + exact bdSpoke_mem_unitCircle hc_unit b₂ t + exact hnot_V (hProper ⟨hmem_bd, hmem_U⟩) + · exfalso + have hmem_e : localSpoke γ y.1 t ∈ y.1.1 := localSpoke_mem_edge hγ y.2.1 ht + have hmem_U : localSpoke γ y.1 t ∈ G.U := (y.2.1.2.1 hmem_e).1 + have hnot_V : localSpoke γ y.1 t ∉ G.V := (y.2.1.2.1 hmem_e).2 + have hmem_bd : localSpoke γ y.1 t ∈ bd S := by + rw [← hι_bd] + change sp (.inl y) t ∈ UnitCircle + rw [← heq] + exact bdSpoke_mem_unitCircle hc_unit b₁ s + exact hnot_V (hProper ⟨hmem_bd, hmem_U⟩) + · have hb : b₁ ≠ b₂ := fun h => hij (congrArg Sum.inr h) + exact bdSpoke_eq_of_ne hc_unit hb hs ht heq + have hsp_sub : ∀ i, range (sp i) ⊆ U_full := by + rintro (x | b) + · exact hspoke_sub x + · rintro _ ⟨t, rfl⟩ + exact Or.inl (bdSpoke_mem_unitCircle hc_unit b t) + have hU_cover : U_full ⊆ Bad ∪ ⋃ i, range (sp i) := by + rintro z (hz_unit | ⟨x, hxU, rfl⟩) + · rcases unitCircle_subset_range_bdSpoke hc_unit hz_unit with h1 | h1 + · exact Or.inr (mem_iUnion.mpr ⟨.inr false, h1⟩) + · exact Or.inr (mem_iUnion.mpr ⟨.inr true, h1⟩) + · by_cases hxp : x = p + · subst hxp + exact Or.inr (mem_iUnion.mpr ⟨.inr false, ⟨0, bdSpoke_zero (ι x) false⟩⟩) + · rcases hU_sdiff ⟨hxU, hxp⟩ with hxBad | hxH + · exact Or.inl ⟨x, hxBad, rfl⟩ + · obtain ⟨y, ⟨t, rfl⟩⟩ := mem_iUnion.mp hxH + exact Or.inr (mem_iUnion.mpr ⟨.inl y, ⟨t, rfl⟩⟩) + obtain ⟨P, α, hP_conn, hP_disj, hP_inter, hα0, hαP⟩ := + exists_entry_path_of_spokes h2 hR_sub hc_cl Bad hBad hcBad sp + hsp_cont hsp_zero hsp_inj hsp_disj hsp_sub hU_cover + exact entry_path_of_plane e G hr hP_conn hP_disj hP_inter hα0 hαP + · -- Interior vertex: p ∈ G.V \ bd S + let Bad : Set EuclideanPlane := UnitCircle ∪ ι '' vertexBad G γ p + have hBad : IsClosed Bad := Metric.isClosed_sphere.union (hι_closed _ hBad_closed) + have hcBad : ι p ∉ Bad := by + rintro (h_unit | ⟨x, hx, hxp⟩) + · exact hp_bd ((hι_bd p).mp h_unit) + · exact hp_not_Bad (hι_inj hxp ▸ hx) + by_cases h2 : 2 ≤ Fintype.card H + · let sp : H → I → EuclideanPlane := fun x t => ι (localSpoke γ x.1 t) + have hsp_cont : ∀ x, Continuous (sp x) := + fun x => hι_cont.comp (continuous_localSpoke hγ x.2.1) + have hsp_zero : ∀ x, sp x 0 = ι p := by + intro x; simp [sp, localSpoke_zero, x.2.2] + have hsp_inj : ∀ x, Function.Injective (sp x) := + fun x => hι_inj.comp (localSpoke_injective hγ x.2.1) + have hsp_disj : ∀ x y, x ≠ y → ∀ s t : I, 0 < s → 0 < t → + sp x s = sp y t → s = 1 ∧ t = 1 := by + intro x y hxy s t hs ht heq + have hne : x.1 ≠ y.1 := fun h => hxy (Subtype.ext h) + exact localSpoke_eq_of_ne hγ x.2.1 y.2.1 hne hs ht (hι_inj heq) + have hU_cover : U_full ⊆ Bad ∪ ⋃ x, range (sp x) := by + rintro z (hz_unit | ⟨x, hxU, rfl⟩) + · exact Or.inl (Or.inl hz_unit) + · by_cases hxp : x = p + · subst hxp + obtain ⟨x₀⟩ : Nonempty H := + Fintype.card_pos_iff.mp (lt_of_lt_of_le zero_lt_two h2) + exact Or.inr (mem_iUnion.mpr ⟨x₀, ⟨0, hsp_zero x₀⟩⟩) + · rcases hU_sdiff ⟨hxU, hxp⟩ with hxBad | hxH + · exact Or.inl (Or.inr ⟨x, hxBad, rfl⟩) + · obtain ⟨y, ⟨t, rfl⟩⟩ := mem_iUnion.mp hxH + exact Or.inr (mem_iUnion.mpr ⟨y, ⟨t, rfl⟩⟩) + obtain ⟨P, α, hP_conn, hP_disj, hP_inter, hα0, hαP⟩ := + exists_entry_path_of_spokes h2 hR_sub hc_cl Bad hBad hcBad sp + hsp_cont hsp_zero hsp_inj hsp_disj hspoke_sub hU_cover + exact entry_path_of_plane e G hr hP_conn hP_disj hP_inter hα0 hαP + · by_cases h1 : Fintype.card H = 1 + · obtain ⟨x₀, hx₀⟩ := Fintype.card_eq_one_iff.mp h1 + let sp₀ : I → EuclideanPlane := fun t => ι (localSpoke γ x₀.1 t) + have hsp_cont : Continuous sp₀ := hι_cont.comp (continuous_localSpoke hγ x₀.2.1) + have hsp_zero : sp₀ 0 = ι p := by simp [sp₀, localSpoke_zero, x₀.2.2] + have hsp_inj : Function.Injective sp₀ := hι_inj.comp (localSpoke_injective hγ x₀.2.1) + have hU_cover : U_full ⊆ Bad ∪ range sp₀ := by + rintro z (hz_unit | ⟨x, hxU, rfl⟩) + · exact Or.inl (Or.inl hz_unit) + · by_cases hxp : x = p + · subst hxp + exact Or.inr ⟨0, hsp_zero⟩ + · rcases hU_sdiff ⟨hxU, hxp⟩ with hxBad | hxH + · exact Or.inl (Or.inr ⟨x, hxBad, rfl⟩) + · obtain ⟨y, ⟨t, rfl⟩⟩ := mem_iUnion.mp hxH + rw [hx₀ y] + exact Or.inr ⟨t, rfl⟩ + obtain ⟨P, α, hP_conn, hP_disj, hP_inter, hα0, hαP⟩ := + exists_entry_path_of_one_spoke hR_sub hc_cl Bad hBad hcBad sp₀ + hsp_cont hsp_zero hsp_inj (hspoke_sub x₀) hU_cover + exact entry_path_of_plane e G hr hP_conn hP_disj hP_inter hα0 hαP + · have h0 : Fintype.card H = 0 := by omega + have hH_empty : IsEmpty H := Fintype.card_eq_zero_iff.mp h0 + have hU_cover : U_full \ {ι p} ⊆ Bad := by + rintro z ⟨hz_unit | ⟨x, hxU, rfl⟩, hzp⟩ + · exact Or.inl hz_unit + · have hxp : x ≠ p := fun h => hzp (congrArg ι h) + rcases hU_sdiff ⟨hxU, hxp⟩ with hxBad | hxH + · exact Or.inr ⟨x, hxBad, rfl⟩ + · obtain ⟨y, _⟩ := mem_iUnion.mp hxH + exact False.elim (hH_empty.false y) + obtain ⟨P, α, hP_conn, hP_disj, hP_inter, hα0, hαP⟩ := + exists_entry_path_of_zero_spokes hR_sub hc_cl (Or.inr ⟨p, hpU, rfl⟩) + Bad hBad hcBad hU_cover + exact entry_path_of_plane e G hr hP_conn hP_disj hP_inter hα0 hαP + +private theorem exists_region_entry_path_at_edge + {S : Type u} [TopologicalSpace S] [T2Space S] + (e : ClosedUnitDisc ≃ₜ S) (G : Drawing S) (hProper : G.IsProper) + {r : Set S} (hr : r ∈ G.R) {p : S} (hpU : p ∈ G.U) (hpV : p ∉ G.V) : + let ι : S → EuclideanPlane := fun x => (e.symm x).1 + let U_full : Set EuclideanPlane := UnitCircle ∪ ι '' G.U + let R_open : Set EuclideanPlane := ι '' (r \ bd S) + Continuous ι → Function.Injective ι → IsClosedMap ι → + (∀ x : S, ι x ∈ UnitCircle ↔ x ∈ bd S) → + R_open ⊆ U_fullᶜ → ι p ∈ closure R_open → + ∃ α : C(I, S), α 0 = p ∧ ∀ t : I, 0 < (t : ℝ) → α t ∈ r \ bd S := by + classical + intro ι U_full R_open hι_cont hι_inj hι_closed hι_bd hR_sub hc_cl + have hp_not_bd : p ∉ bd S := fun hbd => hpV (hProper ⟨hbd, hpU⟩) + have hpE_mem : ∃ e_edge ∈ G.E, p ∈ e_edge := by + rw [G.U_eq] at hpU + rcases hpU with hpV' | hpE + · exact False.elim (hpV hpV') + · obtain ⟨e_edge, he_edge, hpe⟩ := mem_iUnion₂.mp hpE + refine ⟨e_edge, he_edge, ?_⟩ + rw [← G.closure_diff_V he_edge] + exact ⟨hpe, hpV⟩ + rcases hpE_mem with ⟨e_edge, he_edge, hpe⟩ + obtain ⟨γ_e, hγ_cont, hγ0, hγ1, hγ_inj, hγ_img⟩ := GM11.exists_edge_param G he_edge + obtain ⟨t₀, ⟨ht₀0, ht₀1⟩, rfl⟩ : p ∈ γ_e '' Ioo 0 1 := by + rw [hγ_img]; exact hpe + have ht₀0_R : 0 < (t₀ : ℝ) := ht₀0 + have ht₀1_R : (t₀ : ℝ) < 1 := ht₀1 + have h_left_mem : ∀ s : I, (1 - (s : ℝ) / 2) * (t₀ : ℝ) ∈ Set.Icc (0 : ℝ) 1 := by + intro s + have hs0 := s.2.1 + have hs1 := s.2.2 + constructor <;> nlinarith + have h_right_mem : ∀ s : I, (t₀ : ℝ) + ((s : ℝ) / 2) * (1 - (t₀ : ℝ)) ∈ Set.Icc (0 : ℝ) 1 := by + intro s + have hs0 := s.2.1 + have hs1 := s.2.2 + constructor <;> nlinarith + let par : Bool → I → I := fun b s => + if b then ⟨(t₀ : ℝ) + ((s : ℝ) / 2) * (1 - (t₀ : ℝ)), h_right_mem s⟩ + else ⟨(1 - (s : ℝ) / 2) * (t₀ : ℝ), h_left_mem s⟩ + have hpar_cont : ∀ b, Continuous (par b) := by + intro b + cases b <;> refine Continuous.subtype_mk ?_ _ <;> fun_prop + have hpar_zero : ∀ b, par b 0 = t₀ := by + intro b + cases b <;> ext <;> simp [par] + have hpar_ioo : ∀ b s, par b s ∈ Ioo (0 : I) 1 := by + intro b s + have hs0 := s.2.1 + have hs1 := s.2.2 + cases b + · constructor + · change (0 : ℝ) < (1 - (s : ℝ) / 2) * (t₀ : ℝ); nlinarith + · change (1 - (s : ℝ) / 2) * (t₀ : ℝ) < 1; nlinarith + · constructor + · change (0 : ℝ) < (t₀ : ℝ) + ((s : ℝ) / 2) * (1 - (t₀ : ℝ)); nlinarith + · change (t₀ : ℝ) + ((s : ℝ) / 2) * (1 - (t₀ : ℝ)) < 1; nlinarith + let sp : Bool → I → EuclideanPlane := fun b s => ι (γ_e (par b s)) + have hsp_cont : ∀ b, Continuous (sp b) := + fun b => hι_cont.comp (hγ_cont.comp (hpar_cont b)) + have hsp_zero : ∀ b, sp b 0 = ι (γ_e t₀) := by + intro b; simp [sp, hpar_zero] + have hsp_inj : ∀ b, Function.Injective (sp b) := by + intro b s₁ s₂ heq + have h1 := hγ_inj (hpar_ioo b s₁) (hpar_ioo b s₂) (hι_inj heq) + have h2 := congrArg Subtype.val h1 + cases b <;> simp only [par, Bool.false_eq_true, ite_false, ite_true] at h2 <;> + exact Subtype.ext (by nlinarith) + have hsp_disj : ∀ b₁ b₂, b₁ ≠ b₂ → ∀ s t : I, 0 < s → 0 < t → + sp b₁ s = sp b₂ t → s = 1 ∧ t = 1 := by + intro b₁ b₂ hb s t hs ht heq + exfalso + have h1 := hγ_inj (hpar_ioo b₁ s) (hpar_ioo b₂ t) (hι_inj heq) + have h2 := congrArg Subtype.val h1 + have hs_pos : (0 : ℝ) < s := hs + have ht_pos : (0 : ℝ) < t := ht + cases b₁ <;> cases b₂ + · exact hb rfl + · simp only [par, Bool.false_eq_true, ite_false, ite_true] at h2 + nlinarith + · simp only [par, Bool.false_eq_true, ite_true, ite_false] at h2 + nlinarith + · exact hb rfl + have hsp_sub : ∀ b, range (sp b) ⊆ U_full := by + rintro b _ ⟨s, rfl⟩ + right + refine ⟨γ_e (par b s), ?_, rfl⟩ + have hmem_e : γ_e (par b s) ∈ e_edge := by + rw [← hγ_img] + exact ⟨par b s, hpar_ioo b s, rfl⟩ + exact (he_edge.2.1 hmem_e).1 + let Far : Set I := {t : I | (t : ℝ) ≤ (t₀ : ℝ) / 2 ∨ (t₀ : ℝ) + (1 - (t₀ : ℝ)) / 2 ≤ (t : ℝ)} + have hFar_closed : IsClosed Far := + (isClosed_le continuous_subtype_val continuous_const).union + (isClosed_le continuous_const continuous_subtype_val) + let Bad : Set EuclideanPlane := + UnitCircle ∪ ι '' ((G.U \ e_edge) ∪ γ_e '' Far) + have hBad : IsClosed Bad := by + refine Metric.isClosed_sphere.union (hι_closed _ ?_) + exact (GM11.isClosed_U_sdiff_edge G he_edge).union + (hFar_closed.isCompact.image hγ_cont).isClosed + have hcBad : ι (γ_e t₀) ∉ Bad := by + rintro (h_unit | ⟨x, hx, hxe⟩) + · exact hp_not_bd ((hι_bd (γ_e t₀)).mp h_unit) + · have hxp : x = γ_e t₀ := hι_inj hxe + subst hxp + rcases hx with ⟨_, hnot_e⟩ | ⟨t, htFar, hteq⟩ + · exact hnot_e hpe + · have ht_ioo : t ∈ Ioo (0 : I) 1 := by + refine ⟨unitInterval.pos_iff_ne_zero.mpr ?_, unitInterval.lt_one_iff_ne_one.mpr ?_⟩ + · rintro rfl; exact hpV (hteq ▸ hγ0) + · rintro rfl; exact hpV (hteq ▸ hγ1) + have h_eq := hγ_inj ht_ioo ⟨ht₀0, ht₀1⟩ hteq + subst h_eq + rcases htFar with hle | hge <;> linarith + have hU_cover : U_full ⊆ Bad ∪ ⋃ b, range (sp b) := by + rintro z (hz_unit | ⟨x, hxU, rfl⟩) + · exact Or.inl (Or.inl hz_unit) + · by_cases hxe : x ∈ e_edge + · rw [← hγ_img] at hxe + rcases hxe with ⟨t, _, rfl⟩ + by_cases htFar : t ∈ Far + · exact Or.inl (Or.inr ⟨γ_e t, Or.inr ⟨t, htFar, rfl⟩, rfl⟩) + · simp only [Far, mem_ofPred_eq, not_or, not_le] at htFar + rcases le_or_gt (t : ℝ) (t₀ : ℝ) with hle | hgt + · right + refine mem_iUnion.mpr ⟨false, ?_⟩ + let s : I := ⟨2 * (1 - (t : ℝ) / (t₀ : ℝ)), + by have : (t : ℝ) / (t₀ : ℝ) ≤ 1 := (div_le_one ht₀0_R).mpr hle; linarith, + by + have : (1 / 2 : ℝ) < (t : ℝ) / (t₀ : ℝ) := by + rw [div_lt_div_iff₀ zero_lt_two ht₀0_R]; linarith [htFar.1] + linarith⟩ + refine ⟨s, ?_⟩ + change ι (γ_e (par false s)) = ι (γ_e t) + congr 2 + ext + change (1 - (2 * (1 - (t : ℝ) / (t₀ : ℝ))) / 2) * (t₀ : ℝ) = (t : ℝ) + field_simp + ring + · right + refine mem_iUnion.mpr ⟨true, ?_⟩ + have h_one_sub : 0 < 1 - (t₀ : ℝ) := by linarith + let s : I := ⟨2 * ((t : ℝ) - (t₀ : ℝ)) / (1 - (t₀ : ℝ)), + div_nonneg (by linarith) h_one_sub.le, + (div_le_one h_one_sub).mpr (by linarith [htFar.2])⟩ + refine ⟨s, ?_⟩ + change ι (γ_e (par true s)) = ι (γ_e t) + congr 2 + ext + change (t₀ : ℝ) + ((2 * ((t : ℝ) - (t₀ : ℝ)) / (1 - (t₀ : ℝ))) / 2) * + (1 - (t₀ : ℝ)) = (t : ℝ) + field_simp + ring + · exact Or.inl (Or.inr ⟨x, Or.inl ⟨hxU, hxe⟩, rfl⟩) + have h2_bool : 2 ≤ Fintype.card Bool := by simp + obtain ⟨P, α, hP_conn, hP_disj, hP_inter, hα0, hαP⟩ := + exists_entry_path_of_spokes h2_bool hR_sub hc_cl Bad hBad hcBad sp + hsp_cont hsp_zero hsp_inj hsp_disj hsp_sub hU_cover + exact entry_path_of_plane e G hr hP_conn hP_disj hP_inter hα0 hαP + +/-- From a point of `U(G)` in the closure of a region `r` there is a curve into `r` that leaves +`bd(S)` at once. +Its open part lies in the plane model of the open disc, so `exists_region_entry_path` gets this +stronger form for free. -/ +theorem exists_region_entry_path_of_mem_U + {S : Type u} [TopologicalSpace S] (G : Drawing S) + (hDisc : IsClosedDiscSpace S) (hProper : G.IsProper) + (r : Set S) (hr : r ∈ G.R) + (p : S) (hp : p ∈ closure r) (hpU : p ∈ G.U) : + ∃ α : C(I, S), α 0 = p ∧ ∀ t : I, 0 < (t : ℝ) → α t ∈ r \ bd S := by + classical + have : T2Space S := t2Space_of_isClosedDiscSpace hDisc + obtain ⟨e⟩ := hDisc + have hDisc : IsClosedDiscSpace S := ⟨e⟩ + have : Nonempty S := ⟨e ⟨0, Metric.mem_closedBall_self zero_le_one⟩⟩ + let ι : S → EuclideanPlane := fun x => (e.symm x).1 + have hι_cont : Continuous ι := continuous_subtype_val.comp e.symm.continuous + have hι_inj : Function.Injective ι := fun x y h => e.symm.injective (Subtype.ext h) + have hι_closed : IsClosedMap ι := + Metric.isClosed_closedBall.isClosedEmbedding_subtypeVal.isClosedMap.comp e.symm.isClosedMap + have hbd_img := image_bd_homeomorph e + rw [bd_closedUnitDisc] at hbd_img + have hι_bd : ∀ x : S, ι x ∈ UnitCircle ↔ x ∈ bd S := by + intro x + rw [← hbd_img] + constructor + · intro hx + exact ⟨e.symm x, hx, e.apply_symm_apply x⟩ + · rintro ⟨y, hy, rfl⟩ + simpa [ι] using hy + let U_full : Set EuclideanPlane := UnitCircle ∪ ι '' G.U + let R_open : Set EuclideanPlane := ι '' (r \ bd S) + have hr_open : IsOpen r := isOpen_region hDisc G hr + have hR_sub : R_open ⊆ U_fullᶜ := by + rintro _ ⟨x, ⟨hxr, hxbd⟩, rfl⟩ (h_unit | ⟨y, hyU, hyx⟩) + · exact hxbd ((hι_bd x).mp h_unit) + · have hyx' : y = x := hι_inj hyx + subst hyx' + rcases hr with ⟨z₀, _, rfl⟩ + exact (connectedComponentIn_subset (univ \ G.U) z₀ hxr).2 hyU + have hc_cl : ι p ∈ closure R_open := by + have hp_cl' : p ∈ closure (r \ bd S) := by + rw [closure_sdiff_bd_eq hDisc hr_open] + exact hp + exact image_closure_subset_closure_image hι_cont ⟨p, hp_cl', rfl⟩ + by_cases hpV : p ∈ G.V + · exact exists_region_entry_path_at_vertex e G hProper hr hpU hpV + hι_cont hι_inj hι_closed hι_bd hR_sub hc_cl + · exact exists_region_entry_path_at_edge e G hProper hr hpU hpV + hι_cont hι_inj hι_closed hι_bd hR_sub hc_cl + +/-- For any point `p ∈ closure r` of a region `r ∈ G.R` of a proper drawing `G` on a closed disc +space `S`, there is a continuous curve `α : C(unitInterval, S)` with `α 0 = p` and `α t ∈ r` for all +`t > 0`. -/ +theorem exists_region_entry_path + {S : Type u} [TopologicalSpace S] (G : Drawing S) + (hDisc : IsClosedDiscSpace S) (hProper : G.IsProper) + (r : Set S) (hr : r ∈ G.R) + (p : S) (hp : p ∈ closure r) : + ∃ α : C(I, S), α 0 = p ∧ ∀ t : I, 0 < (t : ℝ) → α t ∈ r := by + classical + have : T2Space S := t2Space_of_isClosedDiscSpace hDisc + by_cases hpU : p ∈ G.U + · obtain ⟨α, h0, h1⟩ := exists_region_entry_path_of_mem_U G hDisc hProper r hr p hp hpU + exact ⟨α, h0, fun t ht => (h1 t ht).1⟩ + · -- Point off G.U: p ∈ r directly, so constant path works + have hpr : p ∈ r := by + have hp_compl : p ∈ univ \ G.U := ⟨mem_univ p, hpU⟩ + let r' := connectedComponentIn (univ \ G.U) p + have hr'_mem : r' ∈ G.R := ⟨p, hp_compl, rfl⟩ + have hr'_open : IsOpen r' := isOpen_region hDisc G hr'_mem + have hp_r' : p ∈ r' := mem_connectedComponentIn hp_compl + obtain ⟨z, hzr', hzr⟩ := _root_.mem_closure_iff.mp hp r' hr'_open hp_r' + rcases hr with ⟨z₀, _, rfl⟩ + have h_eq : connectedComponentIn (univ \ G.U) p = connectedComponentIn (univ \ G.U) z₀ := + (connectedComponentIn_eq hzr').trans (connectedComponentIn_eq hzr).symm + rw [← h_eq] + exact hp_r' + exact ⟨ContinuousMap.const I p, rfl, fun _ _ => hpr⟩ + +/-! ## 5. Complementary Curves Between Two Points of `closure r` (`exists_region_curve`) -/ + +/-- Any two points `p, q ∈ closure r` of a region `r ∈ G.R` of a proper drawing `G` on a closed +disc space `S` are joined by a continuous curve `γ : C(unitInterval, S)` with `γ 0 = p`, +`γ 1 = q`, and `γ t ∈ r` for all `t ∈ Ioo 0 1`. -/ +theorem exists_region_curve + {S : Type u} [TopologicalSpace S] (G : Drawing S) + (hDisc : IsClosedDiscSpace S) (hProper : G.IsProper) + (r : Set S) (hr : r ∈ G.R) + (p : S) (hp : p ∈ closure r) + (q : S) (hq : q ∈ closure r) : + ∃ γ : C(I, S), γ 0 = p ∧ γ 1 = q ∧ + ∀ t : I, (t : ℝ) ∈ Set.Ioo (0 : ℝ) 1 → γ t ∈ r := by + obtain ⟨α_p, hα_p0, hα_pr⟩ := exists_region_entry_path G hDisc hProper r hr p hp + obtain ⟨α_q, hα_q0, hα_qr⟩ := exists_region_entry_path G hDisc hProper r hr q hq + have hp1_r : α_p 1 ∈ r := hα_pr 1 zero_lt_one + have hq1_r : α_q 1 ∈ r := hα_qr 1 zero_lt_one + have hr_pc : IsPathConnected r := isPathConnected_region hDisc G hr + obtain ⟨β, hβ_r⟩ := hr_pc.joinedIn (α_p 1) hp1_r (α_q 1) hq1_r + let P_p : Path p (α_p 1) := ⟨α_p, hα_p0, rfl⟩ + let P_q : Path q (α_q 1) := ⟨α_q, hα_q0, rfl⟩ + let P : Path p q := P_p.trans (β.trans P_q.symm) + refine ⟨P.toContinuousMap, P.source, P.target, ?_⟩ + intro t ⟨ht0, ht1⟩ + change (P_p.trans (β.trans P_q.symm)) t ∈ r + rw [Path.trans_apply] + split_ifs with h1 + · apply hα_pr + change 0 < 2 * (t : ℝ) + linarith + · rw [Path.trans_apply] + split_ifs with h2 + · exact hβ_r _ + · change α_q (σ ⟨2 * (2 * (t : ℝ) - 1) - 1, _⟩) ∈ r + apply hα_qr + change 0 < 1 - (2 * (2 * (t : ℝ) - 1) - 1) + linarith + +theorem not_mem_U_of_mem_region {S : Type u} [TopologicalSpace S] + (G : Drawing S) {r : Set S} (hr : r ∈ G.R) {z : S} (hz : z ∈ r) : z ∉ G.U := by + rcases hr with ⟨z₀, _, rfl⟩ + exact (connectedComponentIn_subset (univ \ G.U) z₀ hz).2 + +theorem IsXYChain.leftEndpoint_mem_closure + {S : Type u} [TopologicalSpace S] {G : Drawing S} {x y : S} {A : List (ChainTerm S)} + (hChain : IsXYChain G x y A) : + let leftPt := ChainTerm.leftEndpoint A x + ∀ (i : Fin A.length) (r : Set S), + A[i.1]'i.2 = .inr r → leftPt i ∈ closure r ∧ + (leftPt i ∈ G.U → leftPt i ∈ G.V ∧ Sum.inl (leftPt i) ∈ A) := by + intro leftPt + have h_chain_rel : ∀ (j : ℕ) (hj : j + 1 < A.length), + ChainTerm.AreIncident G A[j] A[j + 1] := + fun j hj => List.isChain_iff_getElem.mp hChain.isChain j hj + intro i r hir + have hrR : r ∈ G.R := by + have hv := hChain.valid (A[i.1]'i.2) (List.getElem_mem i.2) + simpa [hir, ChainTerm.IsValid] using hv + by_cases hi0 : i.1 = 0 + · have hhead : A.head hChain.ne_nil = A[i.1]'i.2 := by + rw [List.head_eq_getElem_zero] + congr 1; omega + have hmatch := hChain.head_matches + rw [hhead, hir] at hmatch + change x ∈ r at hmatch + have hleft : leftPt i = x := by + dsimp [leftPt, ChainTerm.leftEndpoint] + rw [hir] + simp [hi0] + rw [hleft] + refine ⟨subset_closure hmatch, fun hxU => ?_⟩ + exfalso + exact not_mem_U_of_mem_region G hrR hmatch hxU + · have hprev_lt : i.1 - 1 < A.length := Nat.lt_of_le_of_lt (Nat.sub_le _ _) i.2 + have hstep : (i.1 - 1) + 1 < A.length := by omega + have hinc := h_chain_rel (i.1 - 1) hstep + have h_idx_eq : A[(i.1 - 1) + 1]'hstep = A[i.1]'i.2 := by congr 1; omega + rw [h_idx_eq, hir] at hinc + rcases h_prev : A[i.1 - 1]'hprev_lt with v | r' + · rw [h_prev] at hinc + rcases hinc with ⟨hvV, _, hv_cl⟩ + have hleft : leftPt i = v := by simp [leftPt, ChainTerm.leftEndpoint, hir, hi0, h_prev] + rw [hleft] + refine ⟨hv_cl, fun _ => ⟨hvV, ?_⟩⟩ + rw [← h_prev] + exact List.getElem_mem hprev_lt + · rw [h_prev] at hinc + exact False.elim hinc + +theorem IsXYChain.rightEndpoint_mem_closure + {S : Type u} [TopologicalSpace S] {G : Drawing S} {x y : S} {A : List (ChainTerm S)} + (hChain : IsXYChain G x y A) : + let rightPt := ChainTerm.rightEndpoint A y + ∀ (i : Fin A.length) (r : Set S), + A[i.1]'i.2 = .inr r → rightPt i ∈ closure r ∧ + (rightPt i ∈ G.U → rightPt i ∈ G.V ∧ Sum.inl (rightPt i) ∈ A) := by + intro rightPt + have h_chain_rel : ∀ (j : ℕ) (hj : j + 1 < A.length), + ChainTerm.AreIncident G A[j] A[j + 1] := + fun j hj => List.isChain_iff_getElem.mp hChain.isChain j hj + intro i r hir + have hrR : r ∈ G.R := by + have hv := hChain.valid (A[i.1]'i.2) (List.getElem_mem i.2) + simpa [hir, ChainTerm.IsValid] using hv + by_cases hi1 : i.1 + 1 = A.length + · have hlast : A.getLast hChain.ne_nil = A[i.1]'i.2 := by + rw [List.getLast_eq_getElem] + congr 1; omega + have hmatch := hChain.last_matches + rw [hlast, hir] at hmatch + change y ∈ r at hmatch + have hright : rightPt i = y := by simp [rightPt, ChainTerm.rightEndpoint, hir, hi1] + rw [hright] + refine ⟨subset_closure hmatch, fun hyU => ?_⟩ + exfalso + exact not_mem_U_of_mem_region G hrR hmatch hyU + · have hnext_lt : i.1 + 1 < A.length := Nat.lt_of_le_of_ne (Nat.succ_le_of_lt i.2) hi1 + have hinc := h_chain_rel i.1 hnext_lt + rw [hir] at hinc + rcases h_next : A[i.1 + 1]'hnext_lt with v | r' + · rw [h_next] at hinc + rcases hinc with ⟨hvV, _, hv_cl⟩ + have hright : rightPt i = v := by simp [rightPt, ChainTerm.rightEndpoint, hir, hi1, h_next] + rw [hright] + refine ⟨hv_cl, fun _ => ⟨hvV, ?_⟩⟩ + rw [← h_next] + exact List.getElem_mem hnext_lt + · rw [h_next] at hinc + exact False.elim hinc + +end GraphMinor.GM06 diff --git a/LeanPool/GraphMinor/GM06/RegionLocal.lean b/LeanPool/GraphMinor/GM06/RegionLocal.lean new file mode 100644 index 0000000000..a5d8c78ccd --- /dev/null +++ b/LeanPool/GraphMinor/GM06/RegionLocal.lean @@ -0,0 +1,769 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.Defs +import LeanPool.GraphMinor.Surface.JordanDomain +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.GM11.Fan +import LeanPool.GraphMinor.GM11.PlaneFacts +import Mathlib.Topology.Algebra.Module.LocallyConvex +import Mathlib.Analysis.Convex.PathConnected + +/-! +# Local Accessibility of Regions in the Plane + +This file proves the local plane-topological lemmas used to construct curves in regions of a proper +drawing on a closed disc: +- `locallyPathConnectedSpace_of_isClosedDiscSpace`, `isOpen_region`, `isPathConnected_region`, + and `closure_sdiff_bd_eq`: regions of a drawing on a closed disc space are open and + path-connected, and removing the disc boundary preserves their closure. +- `exists_curve_of_half_nbhd`: any half-disc neighborhood at a boundary point of a closed disc + contains a radial entry curve starting at that boundary point. +- `exists_entry_path_of_spokes`: if at least two injective spokes meet at a point `c` in the plane, + then any set `R_open` off the drawing with `c ∈ closure R_open` is entered by a continuous + curve starting at `c`. +- `exists_entry_path_of_one_spoke` and `exists_entry_path_of_zero_spokes`: the corresponding entry + curve existence results when `1` or `0` spokes meet at `c`. +-/ + +public section + +namespace GraphMinor.GM06 + +open Set Function Topology Metric GraphMinor.Surface unitInterval + +universe u + +/-! ## 1. Local Path-Connectivity of Closed Disc Spaces and Their Regions -/ + +instance locallyPathConnectedSpace_closedUnitDisc : + LocallyPathConnectedSpace ClosedUnitDisc := + (convex_closedBall (0 : EuclideanPlane) 1).locallyPathConnectedSpace + +theorem locallyPathConnectedSpace_of_isClosedDiscSpace {S : Type u} [TopologicalSpace S] + (hDisc : IsClosedDiscSpace S) : LocallyPathConnectedSpace S := by + obtain ⟨e⟩ := hDisc + exact Homeomorph.locallyPathConnectedSpace e + +theorem t2Space_of_isClosedDiscSpace {S : Type u} [TopologicalSpace S] + (hDisc : IsClosedDiscSpace S) : T2Space S := by + obtain ⟨e⟩ := hDisc + exact e.symm.isEmbedding.t2Space + +theorem isOpen_region {S : Type u} [TopologicalSpace S] + (hDisc : IsClosedDiscSpace S) (G : Drawing S) {r : Set S} (hr : r ∈ G.R) : + IsOpen r := by + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hDisc + rcases hr with ⟨x, _, rfl⟩ + exact (isOpen_univ.sdiff G.isClosed_U).connectedComponentIn + +theorem isPathConnected_region {S : Type u} [TopologicalSpace S] + (hDisc : IsClosedDiscSpace S) (G : Drawing S) {r : Set S} (hr : r ∈ G.R) : + IsPathConnected r := by + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hDisc + have hopen : IsOpen r := isOpen_region hDisc G hr + rcases hr with ⟨x, hx, rfl⟩ + exact hopen.isConnected_iff_isPathConnected.mp (isConnected_connectedComponentIn_iff.mpr hx) + +theorem region_subset_of_isPreconnected {S : Type u} [TopologicalSpace S] + (G : Drawing S) {r A : Set S} (hr : r ∈ G.R) (hA : IsPreconnected A) + (hdisj : Disjoint A G.U) (hinter : (A ∩ r).Nonempty) : + A ⊆ r := by + rcases hr with ⟨x, _, rfl⟩ + rcases hinter with ⟨z, hzA, hzr⟩ + rw [connectedComponentIn_eq hzr] + refine hA.subset_connectedComponentIn hzA ?_ + intro w hw + exact ⟨mem_univ w, disjoint_left.mp hdisj hw⟩ + +theorem closure_sdiff_bd_eq {S : Type u} [TopologicalSpace S] + (hDisc : IsClosedDiscSpace S) {r : Set S} (hr : IsOpen r) : + closure (r \ bd S) = closure r := by + apply Subset.antisymm (closure_mono sdiff_subset) + obtain ⟨e⟩ := hDisc + have hbd_img := image_bd_homeomorph e + rw [bd_closedUnitDisc] at hbd_img + intro p hp + rw [_root_.mem_closure_iff] at hp ⊢ + intro V hV hpV + obtain ⟨q, hqV, hqr⟩ := hp V hV hpV + have hopen_sub : IsOpen (e ⁻¹' (V ∩ r)) := (hV.inter hr).preimage e.continuous + rw [isOpen_induced_iff] at hopen_sub + rcases hopen_sub with ⟨W, hW, hWeq⟩ + have hqW : (e.symm q).1 ∈ W := by + have hmem : e.symm q ∈ Subtype.val ⁻¹' W := by + rw [hWeq] + simp [hqV, hqr] + exact hmem + have hcl : (e.symm q).1 ∈ closure (OpenUnitDisc : Set EuclideanPlane) := by + rw [show closure (OpenUnitDisc : Set EuclideanPlane) = ClosedUnitDisc from + closure_ball (0 : EuclideanPlane) one_ne_zero] + exact (e.symm q).2 + obtain ⟨y, hyW, hyO⟩ := _root_.mem_closure_iff.mp hcl W hW hqW + let y_disc : ClosedUnitDisc := ⟨y, Metric.ball_subset_closedBall hyO⟩ + have hy_pre : y_disc ∈ e ⁻¹' (V ∩ r) := by + rw [← hWeq] + exact hyW + refine ⟨e y_disc, hy_pre.1, hy_pre.2, ?_⟩ + intro hbd + rw [← hbd_img] at hbd + rcases hbd with ⟨z, hz, hze⟩ + have hzy : z = y_disc := e.injective hze + subst hzy + have h1 : ‖y‖ < 1 := by simpa [OpenUnitDisc] using hyO + have h2 : ‖y‖ = 1 := by simpa [UnitCircle, y_disc] using hz + linarith + +/-! ## 2. Radial Entry Curve in a Half-Disc Neighborhood -/ + +/-- Any half-disc neighborhood `(W ∩ Δ) \ discBd Δ ⊆ A` around a boundary point `p ∈ discBd Δ` +of a closed disc `Δ` contains a continuous curve starting at `p` that stays in `A` for all `t > 0`. +-/ +theorem exists_curve_of_half_nbhd {S : Type u} [TopologicalSpace S] + {Δ W A : Set S} (hΔ : IsClosedDisc Δ) (hW : IsOpen W) + {p : S} (hp : p ∈ discBd Δ) (hpW : p ∈ W) + (hsub : (W ∩ Δ) \ discBd Δ ⊆ A) : + ∃ α : C(I, S), α 0 = p ∧ ∀ t : I, 0 < (t : ℝ) → α t ∈ A := by + obtain ⟨φ⟩ := hΔ + have hbd := disc_boundary Δ φ + rw [hbd] at hp + rcases hp with ⟨c, hc, rfl⟩ + let f : ClosedUnitDisc → S := fun x => (φ x).1 + have hf : Continuous f := continuous_subtype_val.comp φ.continuous + have hfinj : Function.Injective f := fun x y h => φ.injective (Subtype.ext h) + have hopen : IsOpen {x : ClosedUnitDisc | f x ∈ W} := hW.preimage hf + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp hopen c hpW + let ε : ℝ := min (δ / 2) (1 / 2) + have hε_pos : 0 < ε := lt_min (half_pos hδ) (by norm_num) + have hε_δ : ε < δ := lt_of_le_of_lt (min_le_left _ _) (half_lt_self hδ) + have hε_half : ε ≤ 1 / 2 := min_le_right _ _ + have hc_norm : ‖(c : EuclideanPlane)‖ = 1 := by simpa [UnitCircle] using hc + have hg_mem : ∀ t : I, (1 - ε * (t : ℝ)) • (c : EuclideanPlane) ∈ ClosedUnitDisc := by + intro t + have ht0 : 0 ≤ (t : ℝ) := t.2.1 + have ht1 : (t : ℝ) ≤ 1 := t.2.2 + have h1 : 0 ≤ 1 - ε * (t : ℝ) := by nlinarith + have h2 : 1 - ε * (t : ℝ) ≤ 1 := by nlinarith + simp only [ClosedUnitDisc, Metric.mem_closedBall, dist_zero_right, norm_smul, + Real.norm_eq_abs, abs_of_nonneg h1, hc_norm, mul_one] + exact h2 + let g : I → ClosedUnitDisc := fun t => ⟨(1 - ε * (t : ℝ)) • (c : EuclideanPlane), hg_mem t⟩ + have hg_cont : Continuous g := by + refine Continuous.subtype_mk ?_ _ + fun_prop + refine ⟨⟨f ∘ g, hf.comp hg_cont⟩, ?_, ?_⟩ + · change f (g 0) = f c + congr 1 + ext + simp [g] + · intro t ht + refine hsub ⟨⟨?_, (φ (g t)).2⟩, ?_⟩ + · apply hball + change dist ((1 - ε * (t : ℝ)) • (c : EuclideanPlane)) (c : EuclideanPlane) < δ + have hdiff : (1 - ε * (t : ℝ)) • (c : EuclideanPlane) - (c : EuclideanPlane) = + (- (ε * (t : ℝ))) • (c : EuclideanPlane) := by + rw [sub_smul, one_smul, sub_sub_cancel_left, neg_smul] + rw [dist_eq_norm, hdiff, norm_smul, Real.norm_eq_abs, hc_norm, mul_one] + have ht0 : 0 ≤ (t : ℝ) := t.2.1 + have ht1 : (t : ℝ) ≤ 1 := t.2.2 + have hnonneg : 0 ≤ ε * (t : ℝ) := mul_nonneg hε_pos.le ht0 + rw [abs_neg, abs_of_nonneg hnonneg] + nlinarith + · rw [hbd] + rintro ⟨y, hy, hy_eq⟩ + have heq : y = g t := hfinj hy_eq + have hy_norm : ‖(y : EuclideanPlane)‖ = 1 := by simpa [UnitCircle] using hy + rw [heq] at hy_norm + have ht1 : (t : ℝ) ≤ 1 := t.2.2 + have hpos : 0 ≤ 1 - ε * (t : ℝ) := by nlinarith + have h_gt_norm : ‖(g t : EuclideanPlane)‖ = 1 - ε * (t : ℝ) := by + simp [g, norm_smul, Real.norm_eq_abs, abs_of_nonneg hpos, hc_norm] + linarith [mul_pos hε_pos ht] + +/-! ## 3. Round Closed Discs in the Plane -/ + +private theorem exists_round_closedDisc {c : EuclideanPlane} {O : Set EuclideanPlane} + (hO : IsOpen O) (hc : c ∈ O) : + ∃ (D D' : Set EuclideanPlane) (ρ : ℝ), + 0 < ρ ∧ D = Metric.closedBall c ρ ∧ D' = Metric.ball c ρ ∧ + IsClosedDisc D ∧ IsOpen D' ∧ c ∈ D' ∧ D' ⊆ D ∧ D ⊆ O ∧ D \ D' = discBd D := by + obtain ⟨ρ', hρ', hball⟩ := Metric.isOpen_iff.mp hO c hc + let ρ : ℝ := ρ' / 2 + have hρ : 0 < ρ := half_pos hρ' + let D : Set EuclideanPlane := Metric.closedBall c ρ + let D' : Set EuclideanPlane := Metric.ball c ρ + have hDO : D ⊆ O := (Metric.closedBall_subset_ball (half_lt_self hρ')).trans hball + let g : EuclideanPlane → EuclideanPlane := fun x => c + ρ • x + have hg : Continuous g := by fun_prop + have hgin : ∀ x : EuclideanPlane, g x ∈ D ↔ x ∈ ClosedUnitDisc := by + intro x + simp only [g, D, Metric.mem_closedBall, dist_eq_norm, add_sub_cancel_left, ClosedUnitDisc, + sub_zero, norm_smul, Real.norm_eq_abs, abs_of_pos hρ] + exact ⟨fun h' => le_of_mul_le_mul_left (by simpa using h') hρ, fun h' => by nlinarith⟩ + have hgball : ∀ x : EuclideanPlane, g x ∈ D' ↔ x ∈ OpenUnitDisc := by + intro x + simp only [g, D', Metric.mem_ball, dist_eq_norm, add_sub_cancel_left, OpenUnitDisc, + sub_zero, norm_smul, Real.norm_eq_abs, abs_of_pos hρ] + exact ⟨fun h' => lt_of_mul_lt_mul_left (by simpa using h') hρ.le, fun h' => by nlinarith⟩ + have hginj : Function.Injective g := by + intro x y hxy + exact smul_right_injective _ hρ.ne' (add_left_cancel hxy) + let k : ClosedUnitDisc → D := fun x => ⟨g x.1, (hgin x.1).mpr x.2⟩ + have hk : Continuous k := Continuous.subtype_mk (hg.comp continuous_subtype_val) _ + have hkinj : Function.Injective k := fun x y hxy => + Subtype.ext (hginj (congrArg Subtype.val hxy)) + have hksurj : Function.Surjective k := by + rintro ⟨y, hy⟩ + let x : EuclideanPlane := ρ⁻¹ • (y - c) + have hgx : g x = y := by + simp [g, x, smul_smul, mul_inv_cancel₀ hρ.ne'] + have hx : x ∈ ClosedUnitDisc := (hgin x).mp (hgx.symm ▸ hy) + exact ⟨⟨x, hx⟩, Subtype.ext hgx⟩ + have : CompactSpace ClosedUnitDisc := + isCompact_iff_compactSpace.mp (isCompact_closedBall (0 : EuclideanPlane) 1) + let E : ClosedUnitDisc ≃ₜ D := + Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective k ⟨hkinj, hksurj⟩) hk + have hbd := disc_boundary D E + refine ⟨D, D', ρ, hρ, rfl, rfl, ⟨E⟩, Metric.isOpen_ball, Metric.mem_ball_self hρ, + Metric.ball_subset_closedBall, hDO, ?_⟩ + rw [hbd] + ext q + constructor + · rintro ⟨hqD, hqD'⟩ + obtain ⟨x, hx⟩ := E.surjective ⟨q, hqD⟩ + have hkx : g x.1 = q := congrArg Subtype.val hx + refine ⟨x, ?_, hkx⟩ + have hle : ‖x.1‖ ≤ 1 := by simpa [ClosedUnitDisc] using x.2 + have hne : ¬ ‖x.1‖ < 1 := fun hlt => + hqD' (hkx ▸ (hgball x.1).mpr (by simpa [OpenUnitDisc] using hlt)) + have : ‖x.1‖ = 1 := le_antisymm hle (not_lt.mp hne) + simpa [UnitCircle] using this + · rintro ⟨x, hx, rfl⟩ + refine ⟨(E x).2, fun hin => ?_⟩ + have h1 : ‖x.1‖ < 1 := by simpa [OpenUnitDisc] using (hgball x.1).mp hin + have h2 : ‖x.1‖ = 1 := by simpa [UnitCircle] using hx + linarith + +/-! ## 4. Truncation of Spokes in the Plane -/ + +private theorem exists_spoke_truncation {sp : I → EuclideanPlane} + (hc : Continuous sp) {D D' : Set EuclideanPlane} + (hD : IsClosed D) (hD' : IsOpen D') (hsub : D' ⊆ D) (hbd : D \ D' = discBd D) + (hv : sp 0 ∈ D') (hout : sp 1 ∉ D) : + ∃ τ : I, 0 < τ ∧ τ < 1 ∧ (∀ t, t < τ → sp t ∈ D') ∧ sp τ ∈ discBd D := by + have hC : IsCompact {t : I | sp t ∉ D'} := (hD'.isClosed_compl.preimage hc).isCompact + obtain ⟨τ, hτ, hmin⟩ := hC.exists_isLeast ⟨1, fun h => hout (hsub h)⟩ + have hτ0 : 0 < τ := by + refine unitInterval.pos_iff_ne_zero.mpr ?_ + rintro rfl + exact hτ hv + have hbefore : ∀ t, t < τ → sp t ∈ D' := fun t ht => by + by_contra hcon + exact absurd (hmin hcon) (not_le.mpr ht) + have hτD : sp τ ∈ D := by + have h1 : τ ∈ closure (Iio τ) := by + rw [closure_Iio' (a := τ) ⟨0, hτ0⟩] + exact mem_Iic.mpr le_rfl + have h2 := map_mem_closure hc h1 (t := D) fun t ht => hsub (hbefore t ht) + rwa [hD.closure_eq] at h2 + have hτ1 : τ < 1 := by + refine lt_of_le_of_ne le_top ?_ + rintro rfl + exact hout hτD + exact ⟨τ, hτ0, hτ1, hbefore, hbd ▸ ⟨hτD, hτ⟩⟩ + +private theorem isLineWithEnds_spoke_piece {sp : I → EuclideanPlane} + (hc : Continuous sp) (hinj : Function.Injective sp) {τ : I} (hτ : 0 < τ) : + IsLineWithEnds (sp '' Icc 0 τ) (sp 0) (sp τ) := by + let f : C(I, EuclideanPlane) := ⟨fun t => sp (t * τ), hc.comp (by fun_prop)⟩ + have hfinj : Function.Injective f := by + intro s t h + have h1 := hinj h + have h2 : s.1 * τ.1 = t.1 * τ.1 := congrArg Subtype.val h1 + have hτ' : (τ : ℝ) ≠ 0 := ne_of_gt hτ + exact Subtype.ext (mul_right_cancel₀ hτ' h2) + have hr : range f = sp '' Icc 0 τ := by + ext y + constructor + · rintro ⟨t, rfl⟩ + exact ⟨t * τ, ⟨bot_le, unitInterval.mul_le_right⟩, rfl⟩ + · rintro ⟨t, ⟨-, ht⟩, rfl⟩ + have hτ' : (0 : ℝ) < τ := hτ + have ht' : t.1 ≤ τ.1 := ht + refine ⟨⟨t.1 / τ.1, div_nonneg t.2.1 hτ'.le, (div_le_one hτ').mpr ht'⟩, ?_⟩ + change sp _ = _ + congr 1 + apply Subtype.ext + change t.1 / τ.1 * τ.1 = t.1 + field_simp + have hline := GM11.isLineWithEnds_range f hfinj + rw [hr] at hline + have h0 : f 0 = sp 0 := by simp [f] + have h1 : f 1 = sp τ := by simp [f] + rwa [h0, h1] at hline + +/-! ## 5. Entry Curve for `≥ 2` Spokes (`exists_entry_path_of_spokes`) -/ + +/-- If `2 ≤ Fintype.card ι` injective spokes meet at `c` and cover `U_full` outside a closed set +`Bad` missing `c`, then any set `R_open ⊆ U_fullᶜ` with `c ∈ closure R_open` has a preconnected +subset `P ⊆ U_fullᶜ` meeting `R_open` and a curve `α` starting at `c` with `α t ∈ P` for `t > 0`. -/ +theorem exists_entry_path_of_spokes + {ι : Type*} [Fintype ι] (h2 : 2 ≤ Fintype.card ι) + {c : EuclideanPlane} {U_full R_open : Set EuclideanPlane} + (hR_sub : R_open ⊆ U_fullᶜ) (hc_cl : c ∈ closure R_open) + (Bad : Set EuclideanPlane) (hBad : IsClosed Bad) (hcBad : c ∉ Bad) + (sp : ι → I → EuclideanPlane) + (hsp_cont : ∀ i, Continuous (sp i)) + (hsp_zero : ∀ i, sp i 0 = c) + (hsp_inj : ∀ i, Function.Injective (sp i)) + (hsp_disj : ∀ i j, i ≠ j → ∀ s t : I, 0 < s → 0 < t → sp i s = sp j t → s = 1 ∧ t = 1) + (hsp_sub : ∀ i, range (sp i) ⊆ U_full) + (hU_cover : U_full ⊆ Bad ∪ ⋃ i, range (sp i)) : + ∃ (P : Set EuclideanPlane) (α : C(I, EuclideanPlane)), + IsPreconnected P ∧ Disjoint P U_full ∧ (P ∩ R_open).Nonempty ∧ + α 0 = c ∧ ∀ t : I, 0 < (t : ℝ) → α t ∈ P := by + classical + have hmid_fin : (range fun i : ι => sp i 1).Finite := finite_range _ + have hcmid : c ∉ range fun i : ι => sp i 1 := by + rintro ⟨i, hi⟩ + have h01 : (1 : I) = 0 := hsp_inj i (hi.trans (hsp_zero i).symm) + exact one_ne_zero (congrArg Subtype.val h01) + have hO : IsOpen (Bad ∪ range fun i : ι => sp i 1)ᶜ := + (hBad.union hmid_fin.isClosed).isOpen_compl + have hcO : c ∈ (Bad ∪ range fun i : ι => sp i 1)ᶜ := by + rintro (h | h) + · exact hcBad h + · exact hcmid h + obtain ⟨D, D', _, _, _, _, hD, hD', hcD', hD'D, hDO, hbdD⟩ := + exists_round_closedDisc hO hcO + have hDc : IsClosed D := hD.isClosed + have htrunc : ∀ i : ι, ∃ τ : I, 0 < τ ∧ τ < 1 ∧ (∀ t, t < τ → sp i t ∈ D') ∧ + sp i τ ∈ discBd D := fun i => + exists_spoke_truncation (hsp_cont i) hDc hD' hD'D hbdD (by rw [hsp_zero]; exact hcD') + fun h => hDO h (Or.inr ⟨i, rfl⟩) + choose τ hτ0 hτ1 hτb hτp using htrunc + let J : ι → Set EuclideanPlane := fun i => sp i '' Icc 0 (τ i) + let q : ι → EuclideanPlane := fun i => sp i (τ i) + have hbdD' : Disjoint D' (discBd D) := by + rw [← hbdD] + exact Set.disjoint_left.mpr fun x hx hx' => hx'.2 hx + have hcJ : ∀ i, c ∈ J i := fun i => ⟨0, ⟨le_rfl, bot_le⟩, hsp_zero i⟩ + have hline : ∀ i, IsLineWithEnds (J i) c (q i) := fun i => by + have := isLineWithEnds_spoke_piece (hsp_cont i) (hsp_inj i) (hτ0 i) + rwa [hsp_zero] at this + have hsub : ∀ i, J i ⊆ D := by + rintro i _ ⟨t, ht, rfl⟩ + rcases ht.2.eq_or_lt with rfl | hlt + · exact discBd_subset _ (hτp i) + · exact hD'D (hτb i t hlt) + have hbd : ∀ i, J i ∩ discBd D = {q i} := by + intro i + ext x + constructor + · rintro ⟨⟨t, ht, rfl⟩, hx⟩ + rcases ht.2.eq_or_lt with rfl | hlt + · rfl + · exact absurd hx (Set.disjoint_left.mp hbdD' (hτb i t hlt)) + · rintro rfl + exact ⟨⟨τ i, ⟨bot_le, le_rfl⟩, rfl⟩, hτp i⟩ + have hJJ : ∀ i j, i ≠ j → J i ∩ J j = {c} := by + intro i j hij + ext x + constructor + · rintro ⟨⟨s, hs, rfl⟩, ⟨t, ht, hst⟩⟩ + by_cases hs0 : 0 < s + · by_cases ht0 : 0 < t + · have := (hsp_disj i j hij s t hs0 ht0 hst.symm).1 + have hs1 : s < 1 := lt_of_le_of_lt hs.2 (hτ1 i) + exact absurd this hs1.ne + · have ht' : t = 0 := le_antisymm (not_lt.mp ht0) bot_le + rw [← hst, ht', hsp_zero] + rfl + · have hs' : s = 0 := le_antisymm (not_lt.mp hs0) bot_le + rw [hs', hsp_zero] + rfl + · rintro rfl + exact ⟨hcJ i, hcJ j⟩ + have hne : ∀ i, c ≠ q i := by + intro i h + have h0 : τ i = 0 := hsp_inj i (h.symm.trans (hsp_zero i).symm) + exact (hτ0 i).ne' h0 + have hcD : c ∉ discBd D := fun h => Set.disjoint_left.mp hbdD' hcD' h + obtain ⟨next, Q, hF⟩ := GM11.exists_fanInv hD hline hsub hbd hJJ hne hcD + (Finset.univ : Finset ι) (by rwa [Finset.card_univ]) + let K : Set EuclideanPlane := Bad ∪ ⋃ i : ι, sp i '' Ici (τ i) + have hKclosed : IsClosed K := + hBad.union (isClosed_iUnion_of_finite fun i => + (isClosed_Ici.isCompact.image (hsp_cont i)).isClosed) + have hcK : c ∉ K := by + rintro (h | h) + · exact hcBad h + · obtain ⟨i, ⟨t, ht, htc⟩⟩ := mem_iUnion.mp h + have ht0 : t = 0 := hsp_inj i (htc.trans (hsp_zero i).symm) + subst ht0 + exact not_le.mpr (hτ0 i) ht + have hUsub : U_full ⊆ K ∪ ⋃ i, J i := by + intro x hx + rcases hU_cover hx with hxBad | hxsp + · exact Or.inl (Or.inl hxBad) + · obtain ⟨i, ⟨t, rfl⟩⟩ := mem_iUnion.mp hxsp + rcases le_total t (τ i) with ht | ht + · exact Or.inr (mem_iUnion.mpr ⟨i, ⟨t, ⟨bot_le, ht⟩, rfl⟩⟩) + · exact Or.inl (Or.inr (mem_iUnion.mpr ⟨i, ⟨t, ht, rfl⟩⟩)) + have hJU : ∀ i, J i ⊆ U_full := by + rintro i _ ⟨t, _, rfl⟩ + exact hsp_sub i ⟨t, rfl⟩ + obtain ⟨P, W, hW, hcW, hWD', hP⟩ := + GM11.exists_sector_sets hF hD' hcD' hcJ hKclosed hcK + have hWbd : Disjoint W (discBd D) := hbdD'.mono_left hWD' + have hWD : W ⊆ D := hWD'.trans hD'D + obtain ⟨c₁, -⟩ := GM11.sector_sets_props hF hW hWD hWbd + (fun k hk => (hF.disc k hk).isClosed) + (fun k hk => ⟨(hP k hk).2.2.2.2.1, (hP k hk).2.2.2.2.2⟩) + have mem : ∀ k : ι, k ∈ (Finset.univ : Finset ι) := Finset.mem_univ + have hiU : (⋃ i ∈ (Finset.univ : Finset ι), J i) ⊆ U_full := + iUnion₂_subset fun i _ => hJU i + have hcbd : ∀ k, c ∈ discBd (Q k) := by + intro k + obtain ⟨B, -, hb⟩ := hF.bd k (mem k) + exact hb ▸ Or.inl (Or.inl (hcJ k)) + have hdisjU : ∀ k, Disjoint (P k) U_full := by + intro k + obtain ⟨-, hPQ, hPbd, hPK, -, -⟩ := hP k (mem k) + refine Set.disjoint_left.mpr fun x hx hxU => ?_ + obtain ⟨B, -, hb⟩ := hF.bd k (mem k) + have hxbd : x ∉ discBd (Q k) := Set.disjoint_left.mp hPbd hx + rw [hb] at hxbd + rcases hUsub hxU with hxK | hxJ + · exact Set.disjoint_left.mp hPK hx hxK + · obtain ⟨i, hi⟩ := mem_iUnion.mp hxJ + by_cases hik : i = k + · exact hxbd (Or.inl (Or.inl (hik ▸ hi))) + · by_cases hin : i = next k + · exact hxbd (Or.inl (Or.inr (hin ▸ hi))) + · rcases hF.off k (mem k) i (mem i) hik hin ⟨hi, hPQ hx⟩ with h | h + · exact hxbd (Or.inl (Or.inl (h ▸ hcJ k))) + · have := hF.edge k (mem k) ⟨hPQ hx, h⟩ + rw [hb] at this + exact hxbd this + obtain ⟨z, hzW, hzR⟩ := mem_closure_iff.mp hc_cl W hW hcW + have hzU : z ∉ U_full := hR_sub hzR + obtain ⟨k, -, hzk⟩ := mem_iUnion₂.mp (c₁ ⟨hzW, fun h => hzU (hiU h)⟩) + obtain ⟨α, hα0, hαP⟩ := exists_curve_of_half_nbhd (hF.disc k (mem k)) hW (hcbd k) hcW + (hP k (mem k)).2.2.2.2.1 + exact ⟨P k, α, (hP k (mem k)).1, hdisjU k, ⟨z, hzk, hzR⟩, hα0, hαP⟩ + +/-! ## 6. Entry Curve for `1` Spoke (`exists_entry_path_of_one_spoke`) -/ + +private theorem exists_one_spoke_connector + {c : EuclideanPlane} {U_full : Set EuclideanPlane} + (Bad : Set EuclideanPlane) (hBad : IsClosed Bad) (hcBad : c ∉ Bad) + (sp₀ : I → EuclideanPlane) (hsp_cont : Continuous sp₀) (hsp_zero : sp₀ 0 = c) + (hsp_inj : Function.Injective sp₀) (hsp_sub : range sp₀ ⊆ U_full) + (hU_cover : U_full ⊆ Bad ∪ range sp₀) + {ε : ℝ} (hε : 0 < ε) : + ∃ δ : ℝ, 0 < δ ∧ ∀ x y : EuclideanPlane, + x ∈ Metric.ball c δ → x ∉ U_full → y ∈ Metric.ball c δ → y ∉ U_full → + ∃ C : Set EuclideanPlane, IsPathConnected C ∧ Disjoint C U_full ∧ + x ∈ C ∧ y ∈ C ∧ C ⊆ Metric.ball c ε := by + have hcmid : c ≠ sp₀ 1 := fun h => + one_ne_zero (congrArg Subtype.val (hsp_inj (h.symm.trans hsp_zero.symm))) + have hO : IsOpen (Bad ∪ {sp₀ 1})ᶜ := (hBad.union isClosed_singleton).isOpen_compl + have hcO : c ∈ (Bad ∪ {sp₀ 1})ᶜ := by + rintro (h | h) + · exact hcBad h + · exact hcmid (mem_singleton_iff.mp h) + obtain ⟨ρ', hρ', hball⟩ := Metric.isOpen_iff.mp hO c hcO + let ρ₀ : ℝ := min (ρ' / 2) ε + have hρ₀ : 0 < ρ₀ := lt_min (half_pos hρ') hε + have hCB : Metric.closedBall c ρ₀ ⊆ (Bad ∪ {sp₀ 1})ᶜ := + (Metric.closedBall_subset_ball (lt_of_le_of_lt (min_le_left _ _) (half_lt_self hρ'))).trans + hball + let D : Set EuclideanPlane := Metric.closedBall c ρ₀ + let D' : Set EuclideanPlane := Metric.ball c ρ₀ + have hC₁ : IsCompact {t : I | sp₀ t ∉ D'} := + (Metric.isOpen_ball.isClosed_compl.preimage hsp_cont).isCompact + have h1_out : sp₀ 1 ∉ D' := fun h => hCB (Metric.ball_subset_closedBall h) (Or.inr rfl) + obtain ⟨a, ha, hamin⟩ := hC₁.exists_isLeast ⟨1, h1_out⟩ + have ha0 : 0 < a := by + refine unitInterval.pos_iff_ne_zero.mpr ?_ + rintro rfl + exact ha (by rw [hsp_zero]; exact Metric.mem_ball_self hρ₀) + have hbefore : ∀ t, t < a → sp₀ t ∈ D' := fun t ht => by + by_contra hcon + exact absurd (hamin hcon) (not_le.mpr ht) + have haD : sp₀ a ∈ D := by + have h1 : a ∈ closure (Iio a) := by + rw [closure_Iio' (a := a) ⟨0, ha0⟩] + exact mem_Iic.mpr le_rfl + have h2 := map_mem_closure hsp_cont h1 (t := D) fun t ht => + Metric.ball_subset_closedBall (hbefore t ht) + rwa [Metric.isClosed_closedBall.closure_eq] at h2 + have ha_sph : sp₀ a ∈ Metric.sphere c ρ₀ := by + rw [← Metric.closedBall_sdiff_ball] + exact ⟨haD, ha⟩ + let f : C(I, EuclideanPlane) := ⟨fun s => sp₀ (s * a), hsp_cont.comp (by fun_prop)⟩ + have hfinj : Function.Injective f := by + intro s t h + have h1 := hsp_inj h + have h2 : s.1 * a.1 = t.1 * a.1 := congrArg Subtype.val h1 + have ha' : (a : ℝ) ≠ 0 := ne_of_gt ha0 + exact Subtype.ext (mul_right_cancel₀ ha' h2) + have hJline : IsLine (range f) := + ⟨Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofInjective f hfinj) + f.continuous.rangeFactorization⟩ + have hJ_eq : range f = sp₀ '' Icc 0 a := by + ext y + constructor + · rintro ⟨s, rfl⟩ + exact ⟨s * a, ⟨bot_le, unitInterval.mul_le_right⟩, rfl⟩ + · rintro ⟨t, ⟨-, ht⟩, rfl⟩ + have ha' : (0 : ℝ) < a := ha0 + have ht' : t.1 ≤ a.1 := ht + refine ⟨⟨t.1 / a.1, div_nonneg t.2.1 ha'.le, (div_le_one ha').mpr ht'⟩, ?_⟩ + change sp₀ _ = _ + congr 1 + apply Subtype.ext + change t.1 / a.1 * a.1 = t.1 + field_simp + let M : Set EuclideanPlane := D ∩ (sp₀ '' Ici a) + have hMcpt : IsCompact M := + ( isCompact_closedBall c ρ₀ ).inter_right (isClosed_Ici.isCompact.image hsp_cont).isClosed + let K : Set EuclideanPlane := Metric.sphere c ρ₀ ∪ M + have hKcpt : IsCompact K := (isCompact_sphere c ρ₀).union hMcpt + have hKJ : K ∩ range f = {sp₀ a} := by + rw [hJ_eq] + ext z + constructor + · rintro ⟨hzK, t, ht, rfl⟩ + rcases eq_or_lt_of_le ht.2 with rfl | hlt + · rfl + · rcases hzK with hz_sph | ⟨_, s, hs, hst⟩ + · exact absurd hz_sph (ne_of_lt (Metric.mem_ball.mp (hbefore t hlt))) + · have hts : s = t := hsp_inj hst + exact absurd (hts ▸ hs) (not_le.mpr hlt) + · rintro rfl + exact ⟨Or.inl ha_sph, ⟨a, ⟨bot_le, le_rfl⟩, rfl⟩⟩ + have hKJconn : IsPreconnected (K ∩ range f) := by + rw [hKJ] + exact isPreconnected_singleton + have hcK : c ∉ K := by + rintro (h_sph | ⟨_, t, ht, htc⟩) + · have : dist c c = ρ₀ := h_sph + rw [dist_self] at this + exact hρ₀.ne this + · have ht0 : t = 0 := hsp_inj (htc.trans hsp_zero.symm) + subst ht0 + exact not_le.mpr ha0 ht + obtain ⟨ρ₂, hρ₂, hballK⟩ := Metric.isOpen_iff.mp hKcpt.isClosed.isOpen_compl c hcK + let δ : ℝ := min ρ₂ ρ₀ + have hδ : 0 < δ := lt_min hρ₂ hρ₀ + have hsmallK : Metric.ball c δ ⊆ Kᶜ := + (Metric.ball_subset_ball (min_le_left _ _)).trans hballK + have hsmall₀ : Metric.ball c δ ⊆ D' := + Metric.ball_subset_ball (min_le_right _ _) + refine ⟨δ, hδ, fun x y hx hxU hy hyU => ?_⟩ + have hoff : ∀ z : EuclideanPlane, z ∉ U_full → z ∉ range f := by + rintro z hz ⟨s, rfl⟩ + exact hz (hsp_sub ⟨s * a, rfl⟩) + have hxnot : x ∉ K ∪ range f := fun h => h.elim (hsmallK hx) (hoff x hxU) + have hynot : y ∉ K ∪ range f := fun h => h.elim (hsmallK hy) (hoff y hyU) + have hsameK : y ∈ connectedComponentIn Kᶜ x := + (convex_ball c δ).isPreconnected.subset_connectedComponentIn hx hsmallK hy + have hsameJ : y ∈ connectedComponentIn (range f)ᶜ x := + (isPreconnected_compl_of_isLine hJline).subset_connectedComponentIn + (fun h => hxnot (Or.inr h)) subset_rfl (fun h => hynot (Or.inr h)) + have hsame := janiszewski_plane hKcpt (isCompact_range f.continuous) hKJconn + hxnot hynot hsameK hsameJ + let Cc : Set EuclideanPlane := connectedComponentIn (K ∪ range f)ᶜ x + have hCc_open : IsOpen Cc := + (hKcpt.union (isCompact_range f.continuous)).isClosed.isOpen_compl.connectedComponentIn + have hCc_conn : IsConnected Cc := isConnected_connectedComponentIn_iff.mpr hxnot + have hCc_pc : IsPathConnected Cc := hCc_open.isConnected_iff_isPathConnected.mp hCc_conn + have hCc_sub : Cc ⊆ (K ∪ range f)ᶜ := connectedComponentIn_subset _ _ + have hxCc : x ∈ Cc := mem_connectedComponentIn hxnot + have hCc_ball : Cc ⊆ D' := by + refine hCc_conn.isPreconnected.subset_left_of_subset_union Metric.isOpen_ball + (show IsOpen Dᶜ from Metric.isClosed_closedBall.isOpen_compl) ?_ ?_ ⟨x, hxCc, hsmall₀ hx⟩ + · exact disjoint_left.mpr fun z hz h' => h' (Metric.ball_subset_closedBall hz) + · intro z hz + by_cases hzb : z ∈ D' + · exact Or.inl hzb + · refine Or.inr fun hzc => ?_ + have h1 : dist z c = ρ₀ := le_antisymm hzc (not_lt.mp hzb) + exact hCc_sub hz (Or.inl (Or.inl h1)) + refine ⟨Cc, hCc_pc, ?_, hxCc, hsame, hCc_ball.trans (Metric.ball_subset_ball (min_le_right _ _))⟩ + refine disjoint_left.mpr fun z hz hzU => ?_ + have hzD : z ∈ D := Metric.ball_subset_closedBall (hCc_ball hz) + rcases hU_cover hzU with hzBad | ⟨t, rfl⟩ + · exact hCB hzD (Or.inl hzBad) + · rcases le_or_gt t a with hta | hta + · refine hCc_sub hz (Or.inr ?_) + rw [hJ_eq] + exact ⟨t, ⟨bot_le, hta⟩, rfl⟩ + · exact hCc_sub hz (Or.inl (Or.inr ⟨hzD, t, hta.le, rfl⟩)) + +/-- Entry curve when `1` injective spoke meets at `c`. -/ +theorem exists_entry_path_of_one_spoke + {c : EuclideanPlane} {U_full R_open : Set EuclideanPlane} + (hR_sub : R_open ⊆ U_fullᶜ) (hc_cl : c ∈ closure R_open) + (Bad : Set EuclideanPlane) (hBad : IsClosed Bad) (hcBad : c ∉ Bad) + (sp₀ : I → EuclideanPlane) (hsp_cont : Continuous sp₀) (hsp_zero : sp₀ 0 = c) + (hsp_inj : Function.Injective sp₀) (hsp_sub : range sp₀ ⊆ U_full) + (hU_cover : U_full ⊆ Bad ∪ range sp₀) : + ∃ (P : Set EuclideanPlane) (α : C(I, EuclideanPlane)), + IsPreconnected P ∧ Disjoint P U_full ∧ (P ∩ R_open).Nonempty ∧ + α 0 = c ∧ ∀ t : I, 0 < (t : ℝ) → α t ∈ P := by + classical + have hε : ∀ n : ℕ, (0 : ℝ) < (1 / 2) ^ n := fun _ => by positivity + choose δ hδ hconn using fun n => + exists_one_spoke_connector Bad hBad hcBad sp₀ hsp_cont hsp_zero hsp_inj hsp_sub hU_cover (hε n) + let η : ℕ → ℝ := fun n => min (δ n / 2) ((1 / 2) ^ n) + have hη : ∀ n, 0 < η n := fun n => lt_min (half_pos (hδ n)) (hε n) + let e : ℕ → ℝ := fun n => Nat.casesOn n (η 0) fun k => min (η k) (η (k + 1)) + have he : ∀ n, 0 < e n := by + intro n; cases n with + | zero => exact hη 0 + | succ k => exact lt_min (hη k) (hη (k + 1)) + have heη : ∀ n, e n ≤ η n := by + intro n; cases n with + | zero => exact le_rfl + | succ k => exact min_le_right _ _ + have heη' : ∀ n, e (n + 1) ≤ η n := fun n => min_le_left _ _ + choose y hyR hyd using fun n => Metric.mem_closure_iff.mp hc_cl (e n) (he n) + have hyU : ∀ n, y n ∉ U_full := fun n => hR_sub (hyR n) + have hy_ball : ∀ n, y n ∈ Metric.ball c (δ n) := by + intro n + rw [Metric.mem_ball, dist_comm] + have h1 := hyd n + have h2 := heη n + have h3 : η n ≤ δ n / 2 := min_le_left _ _ + have h4 := hδ n + linarith + have hy_ball' : ∀ n, y (n + 1) ∈ Metric.ball c (δ n) := by + intro n + rw [Metric.mem_ball, dist_comm] + have h1 := hyd (n + 1) + have h2 := heη' n + have h3 : η n ≤ δ n / 2 := min_le_left _ _ + have h4 := hδ n + linarith + have hstep : ∀ n, ∃ q : Path (y n) (y (n + 1)), + (∀ t, q t ∉ U_full) ∧ ∀ t, dist (q t) c ≤ (1 / 2) ^ n := by + intro n + obtain ⟨C, hC_pc, hC_disj, hxC, hyC, hC_ball⟩ := + hconn n (y n) (y (n + 1)) (hy_ball n) (hyU n) (hy_ball' n) (hyU (n + 1)) + obtain ⟨q, hq⟩ := hC_pc.joinedIn _ hxC _ hyC + refine ⟨q, fun t => disjoint_left.mp hC_disj (hq t), fun t => ?_⟩ + exact le_of_lt (Metric.mem_ball.mp (hC_ball (hq t))) + choose q hqU hqd using hstep + let f := complexPlane.toHomeomorph.symm + have hf_isom : ∀ x z : EuclideanPlane, dist (f x) (f z) = dist x z := + fun x z => complexPlane.symm.dist_map x z + let P_seq : ℕ → I → ℂ := fun n t => f (q n t) + let r_bd : ℕ → ℝ := fun n => (1 / 2) ^ n + have hr : Filter.Tendsto r_bd Filter.atTop (𝓝 0) := + tendsto_pow_atTop_nhds_zero_of_lt_one (by norm_num) (by norm_num) + have hPc : ∀ n, Continuous (P_seq n) := fun n => f.continuous.comp (q n).continuous + have hlink : ∀ n, P_seq n 1 = P_seq (n + 1) 0 := fun n => by + simp only [P_seq] + rw [(q n).target, (q (n + 1)).source] + have hclose : ∀ n t, dist (P_seq n t) (f c) ≤ r_bd n := fun n t => by + rw [hf_isom] + exact hqd n t + obtain ⟨γ₀, hγ₀c, hγ₀0, hγ₀1, hγ₀U⟩ := exists_path_of_tendsto hPc hlink hr hclose + let β : C(I, EuclideanPlane) := + ⟨fun t => complexPlane.toHomeomorph (γ₀ t), complexPlane.toHomeomorph.continuous.comp hγ₀c⟩ + have hβ0 : β 0 = y 0 := by + change complexPlane.toHomeomorph (γ₀ 0) = y 0 + rw [hγ₀0] + simp [P_seq, f] + have hβ1 : β 1 = c := by + change complexPlane.toHomeomorph (γ₀ 1) = c + rw [hγ₀1] + simp [f] + have hβ_notU : ∀ t : I, t ≠ 1 → β t ∉ U_full := by + intro t ht + obtain ⟨n, s, hs⟩ := hγ₀U t ht + have hbt : β t = q n s := by + change complexPlane.toHomeomorph (γ₀ t) = q n s + rw [hs] + simp [P_seq, f] + rw [hbt] + exact hqU n s + have h_ioo_conn : IsPreconnected {s : I | s ≠ 1} := by + have h_eq : {s : I | s ≠ 1} = Ico (0 : I) 1 := by + ext s + simp only [mem_ofPred_eq, mem_Ico] + exact ⟨fun h => ⟨bot_le, lt_of_le_of_ne le_top h⟩, fun h => h.2.ne⟩ + rw [h_eq] + exact isPreconnected_Ico + let P : Set EuclideanPlane := β '' {s : I | s ≠ 1} + have hP_conn : IsPreconnected P := h_ioo_conn.image β β.continuous.continuousOn + have hP_disj : Disjoint P U_full := by + refine disjoint_left.mpr ?_ + rintro _ ⟨s, hs, rfl⟩ + exact hβ_notU s hs + have hy0_mem : y 0 ∈ P := ⟨0, zero_ne_one, hβ0⟩ + refine ⟨P, ⟨fun t => β (σ t), β.continuous.comp unitInterval.continuous_symm⟩, + hP_conn, hP_disj, ⟨y 0, hy0_mem, hyR 0⟩, ?_, ?_⟩ + · change β (σ 0) = c + simpa using hβ1 + · intro t ht + refine ⟨σ t, ?_, rfl⟩ + intro h + have h1 : 1 - (t : ℝ) = 1 := congrArg Subtype.val h + linarith + +/-! ## 7. Entry Curve for `0` Spokes (`exists_entry_path_of_zero_spokes`) -/ + +/-- Entry curve when `0` spokes meet at `c` (so `U_full \ {c} ⊆ Bad`). -/ +theorem exists_entry_path_of_zero_spokes + {c : EuclideanPlane} {U_full R_open : Set EuclideanPlane} + (hR_sub : R_open ⊆ U_fullᶜ) (hc_cl : c ∈ closure R_open) (hcU : c ∈ U_full) + (Bad : Set EuclideanPlane) (hBad : IsClosed Bad) (hcBad : c ∉ Bad) + (hU_cover : U_full \ {c} ⊆ Bad) : + ∃ (P : Set EuclideanPlane) (α : C(I, EuclideanPlane)), + IsPreconnected P ∧ Disjoint P U_full ∧ (P ∩ R_open).Nonempty ∧ + α 0 = c ∧ ∀ t : I, 0 < (t : ℝ) → α t ∈ P := by + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp hBad.isOpen_compl c hcBad + obtain ⟨z, hz_ball, hzR⟩ := + mem_closure_iff.mp hc_cl (Metric.ball c δ) Metric.isOpen_ball (Metric.mem_ball_self hδ) + have hzc : z ≠ c := fun h => hR_sub hzR (h ▸ hcU) + let α : C(I, EuclideanPlane) := ⟨fun t => (1 - (t : ℝ)) • c + (t : ℝ) • z, by fun_prop⟩ + let P : Set EuclideanPlane := α '' Ioc (0 : I) 1 + have hP_conn : IsPreconnected P := isPreconnected_Ioc.image α α.continuous.continuousOn + have hα0 : α 0 = c := by simp [α] + have hα1 : α 1 = z := by simp [α] + refine ⟨P, α, hP_conn, ?_, ⟨z, ⟨1, ⟨zero_lt_one, le_rfl⟩, hα1⟩, hzR⟩, hα0, ?_⟩ + · refine disjoint_left.mpr ?_ + rintro _ ⟨t, ⟨ht0, ht1⟩, rfl⟩ hxU + have ht_pos : 0 < (t : ℝ) := ht0 + have h_ne_c : α t ≠ c := by + intro heq + have hdiff : (t : ℝ) • (z - c) = 0 := by + calc (t : ℝ) • (z - c) + _ = ((1 - (t : ℝ)) • c + (t : ℝ) • z) - c := by + rw [smul_sub, sub_smul, one_smul] + abel + _ = α t - c := rfl + _ = 0 := sub_eq_zero.mpr heq + rcases smul_eq_zero.mp hdiff with h0 | h0 + · exact ht_pos.ne' h0 + · exact hzc (sub_eq_zero.mp h0) + have h_in_ball : α t ∈ Metric.ball c δ := by + have hconv := convex_ball c δ (Metric.mem_ball_self hδ) hz_ball + (sub_nonneg.mpr t.2.2) t.2.1 (sub_add_cancel 1 (t : ℝ)) + exact hconv + exact hball h_in_ball (hU_cover ⟨hxU, h_ne_c⟩) + · intro t ht + exact ⟨t, ⟨ht, le_top⟩, rfl⟩ + +end GraphMinor.GM06 diff --git a/LeanPool/GraphMinor/GM06/Section2Count.lean b/LeanPool/GraphMinor/GM06/Section2Count.lean new file mode 100644 index 0000000000..d3a070c411 --- /dev/null +++ b/LeanPool/GraphMinor/GM06/Section2Count.lean @@ -0,0 +1,886 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.Section2Dual + +/-! +# Graph Minors VI, Section 2: Proof of Theorem (2.4) + +This file formalizes $\Delta$-minimizers, $\Delta^*$-maximizers, and the proof of (2.4) of +Robertson and Seymour, *Graph Minors. VI. Disjoint paths across a disc*, J. Combin. Theory +Ser. B **41** (1986), 115–138 (pages 118–119). +-/ + +@[expose] public section + +namespace GraphMinor.GM06 + +open Set Function Topology GraphMinor.Surface + +universe u + +/-! ## 1. Counting $\Delta(x, y)$ when $x = y$ -/ + +theorem not_crossesOn_self_right {S : Type u} [TopologicalSpace S] {C : Set S} {a c x : S} : + ¬ CrossesOn C a c x x := + fun h => h.2.2.2.2.2.1 rfl + +theorem divisionCount_self_eq_one_of_mem {S : Type u} [TopologicalSpace S] {C : Set S} + {Δ : Set (Set S)} {x : S} (hΔ : IsDivision Δ) (hx : x ∈ divisionUnion Δ) : + divisionCount C Δ x x = 1 := by + obtain ⟨δ₀, hδ₀, hxδ₀⟩ := hx + unfold divisionCount + have heq : {δ ∈ Δ | (δ ∩ {x, x}).Nonempty ∨ ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn C u v x x} = {δ₀} := by + ext δ + simp only [pair_eq_singleton, inter_singleton_nonempty, not_crossesOn_self_right, + and_false, exists_false, or_false, mem_ofPred_eq, mem_singleton_iff] + constructor + · rintro ⟨hδ, hxδ⟩ + by_contra hne + exact (hΔ.2.2 hδ hδ₀ hne).ne_of_mem hxδ hxδ₀ rfl + · rintro rfl + exact ⟨hδ₀, hxδ₀⟩ + rw [heq, ncard_singleton] + +theorem divisionCount_self_eq_zero_of_not_mem {S : Type u} [TopologicalSpace S] {C : Set S} + {Δ : Set (Set S)} {x : S} (hx : x ∉ divisionUnion Δ) : + divisionCount C Δ x x = 0 := by + unfold divisionCount + have heq : {δ ∈ Δ | (δ ∩ {x, x}).Nonempty ∨ ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn C u v x x} = ∅ := by + ext δ + simp only [pair_eq_singleton, inter_singleton_nonempty, not_crossesOn_self_right, + and_false, exists_false, or_false, mem_ofPred_eq, mem_empty_iff_false, iff_false, not_and] + intro hδ hxδ + exact hx ⟨δ, hδ, hxδ⟩ + rw [heq, ncard_empty] + +theorem theorem_2_4_self {S : Type u} [TopologicalSpace S] (C U : Set S) (Δ : Set (Set S)) + (x : S) (hV_fin : (divisionUnion Δ).Finite) (hV_sub : divisionUnion Δ ⊆ C) + (hC : IsOArc C) (hΔ : IsDivision Δ) (hU : IsDualPointSet C (divisionUnion Δ) U) + (hx : x ∈ divisionUnion Δ ∪ U) : + ((x ∈ divisionUnion Δ ∧ x ∈ divisionUnion Δ → + (divisionCount C Δ x x : ℤ) - (divisionCount C (dualDivision C U Δ) x x : ℤ) = 1) ∧ + (x ∈ U ∧ x ∈ U → + (divisionCount C Δ x x : ℤ) - (divisionCount C (dualDivision C U Δ) x x : ℤ) = -1) ∧ + (¬ (x ∈ divisionUnion Δ ∧ x ∈ divisionUnion Δ) → ¬ (x ∈ U ∧ x ∈ U) → + (divisionCount C Δ x x : ℤ) - (divisionCount C (dualDivision C U Δ) x x : ℤ) = 0)) := by + have hU_sub : U ⊆ C \ divisionUnion Δ := isDualPointSet_subset_diff hU + have hΔ_star_union : divisionUnion (dualDivision C U Δ) = U := divisionUnion_dualDivision C U Δ + have hΔ_star_div := isDivision_dualDivision_of_isOArc hC hV_fin hV_sub hU + refine ⟨?_, ?_, ?_⟩ + · rintro ⟨hxV, _⟩ + have hxU : x ∉ divisionUnion (dualDivision C U Δ) := by + rw [hΔ_star_union] + exact fun h => (hU_sub h).2 hxV + rw [divisionCount_self_eq_one_of_mem hΔ hxV, divisionCount_self_eq_zero_of_not_mem hxU] + norm_num + · rintro ⟨hxU, _⟩ + have hxV : x ∉ divisionUnion Δ := (hU_sub hxU).2 + have hxU' : x ∈ divisionUnion (dualDivision C U Δ) := by rwa [hΔ_star_union] + rw [divisionCount_self_eq_zero_of_not_mem hxV, divisionCount_self_eq_one_of_mem hΔ_star_div + hxU'] + norm_num + · intro hnotV hnotU + rcases hx with hxV | hxU + · exact (hnotV ⟨hxV, hxV⟩).elim + · exact (hnotU ⟨hxU, hxU⟩).elim + +/-! ## 2. Transfer of `divisionCount` along `oArcMap` -/ + +theorem divisionCount_oArcMap {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) + (Δ : Set (Set Circle)) (x y : Circle) : + divisionCount C ((image (oArcMap φ)) '' Δ) (oArcMap φ x) (oArcMap φ y) = + divisionCount (univ : Set Circle) Δ x y := by + have hinj := injective_oArcMap φ + have himg_inj : Injective (image (oArcMap φ)) := image_injective.mpr hinj + unfold divisionCount + have heq : {δ ∈ (image (oArcMap φ)) '' Δ | + (δ ∩ {oArcMap φ x, oArcMap φ y}).Nonempty ∨ + ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn C u v (oArcMap φ x) (oArcMap φ y)} = + (image (oArcMap φ)) '' {δ ∈ Δ | + (δ ∩ {x, y}).Nonempty ∨ ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn (univ : Set Circle) u v x y} := by + ext s + simp only [mem_ofPred_eq, mem_image] + constructor + · rintro ⟨⟨δ, hδ, rfl⟩, hcond⟩ + refine ⟨δ, ⟨hδ, ?_⟩, rfl⟩ + have hpair : ({oArcMap φ x, oArcMap φ y} : Set S) = oArcMap φ '' {x, y} := by simp + rw [hpair, ← image_inter hinj, image_nonempty] at hcond + simp only [mem_image, exists_exists_and_eq_and, crossesOn_oArcMap_iff] at hcond + exact hcond + · rintro ⟨δ, ⟨hδ, hcond⟩, rfl⟩ + refine ⟨⟨δ, hδ, rfl⟩, ?_⟩ + have hpair : ({oArcMap φ x, oArcMap φ y} : Set S) = oArcMap φ '' {x, y} := by simp + rw [hpair, ← image_inter hinj, image_nonempty] + simp only [mem_image, exists_exists_and_eq_and, crossesOn_oArcMap_iff] + exact hcond + rw [heq, ncard_image_of_injective _ himg_inj] + +/-! ## 3. Active Members and $\Delta$-Minimizers on `Circle` -/ + +/-- A member $\delta \in \Delta$ is *active* for $(x, y)$ ($x \ne y$) on `Circle` if $x \notin +\delta$ +and $\delta$ meets both half-open arcs $(x, y]$ (`0 < x.angleDiff v ≤ x.angleDiff y`) and $[y, x)$ +(`x.angleDiff y ≤ x.angleDiff v`). -/ +private def IsActiveFor (x y : Circle) (δ : Set Circle) : Prop := + x ∉ δ ∧ + (∃ v₁ ∈ δ, x.angleDiff v₁ ≤ x.angleDiff y) ∧ + (∃ v₂ ∈ δ, x.angleDiff y ≤ x.angleDiff v₂) + +private lemma active_iff_counted_not_mem_x {x y : Circle} (hxy : x ≠ y) {δ : Set Circle} : + ((δ ∩ {x, y}).Nonempty ∨ ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn (univ : Set Circle) u v x y) ∧ x ∉ δ ↔ + IsActiveFor x y δ := by + have hxy_pos : 0 < x.angleDiff y := Circle.angleDiff_pos hxy + constructor + · rintro ⟨hcount, hxδ⟩ + refine ⟨hxδ, ?_⟩ + rcases hcount with ⟨z, hzδ, hzx | hzy⟩ | ⟨u, huδ, v, hvδ, hcross⟩ + · subst hzx + exact (hxδ hzδ).elim + · rw [mem_singleton_iff] at hzy + subst hzy + exact ⟨⟨z, hzδ, le_rfl⟩, ⟨z, hzδ, le_rfl⟩⟩ + · have hcross' := hcross.comm isOArc_univ_circle + rw [crossesOn_univ_iff_angleDiff] at hcross' + rcases hcross' with ⟨_, _, _, _, hyu, hyv, hiff⟩ + have hyu_ang : x.angleDiff y ≠ x.angleDiff u := (circleCoordFrom x).injective.ne hyu + have hyv_ang : x.angleDiff y ≠ x.angleDiff v := (circleCoordFrom x).injective.ne hyv + by_cases hu_lt : x.angleDiff u < x.angleDiff y + · have hv_ge : x.angleDiff y ≤ x.angleDiff v := not_lt.mp (hiff.mp hu_lt) + exact ⟨⟨u, huδ, hu_lt.le⟩, ⟨v, hvδ, hv_ge⟩⟩ + · have hv_lt : x.angleDiff v < x.angleDiff y := by tauto + have hu_ge : x.angleDiff y ≤ x.angleDiff u := not_lt.mp hu_lt + exact ⟨⟨v, hvδ, hv_lt.le⟩, ⟨u, huδ, hu_ge⟩⟩ + · rintro ⟨hxδ, ⟨v₁, hv₁δ, hle₁⟩, ⟨v₂, hv₂δ, hle₂⟩⟩ + refine ⟨?_, hxδ⟩ + by_cases hyδ : y ∈ δ + · exact Or.inl ⟨y, hyδ, mem_insert_of_mem x (mem_singleton y)⟩ + · right + have hv₁x : x ≠ v₁ := fun h => hxδ (h ▸ hv₁δ) + have hv₂x : x ≠ v₂ := fun h => hxδ (h ▸ hv₂δ) + have hv₁y : y ≠ v₁ := fun h => hyδ (h ▸ hv₁δ) + have hv₂y : y ≠ v₂ := fun h => hyδ (h ▸ hv₂δ) + have hlt₁ : x.angleDiff v₁ < x.angleDiff y := + lt_of_le_of_ne hle₁ ((circleCoordFrom x).injective.ne hv₁y.symm) + have hlt₂ : x.angleDiff y < x.angleDiff v₂ := + lt_of_le_of_ne hle₂ ((circleCoordFrom x).injective.ne hv₂y) + have hv₁v₂ : v₁ ≠ v₂ := fun h => by + have : x.angleDiff v₁ = x.angleDiff v₂ := congrArg (Circle.angleDiff x) h + linarith + refine ⟨v₁, hv₁δ, v₂, hv₂δ, (CrossesOn.comm isOArc_univ_circle ?_)⟩ + rw [crossesOn_univ_iff_angleDiff] + exact ⟨hxy, hv₁v₂, hv₁x, hv₂x, hv₁y, hv₂y, ⟨fun _ => not_lt_of_ge hlt₂.le, fun _ => hlt₁⟩⟩ + +private lemma divisionCount_eq_active_add_mem {Δ : Set (Set Circle)} (hΔ : IsDivision Δ) + {x y : Circle} (hxy : x ≠ y) : + (divisionCount (univ : Set Circle) Δ x y : ℤ) - ((divisionUnion Δ ∩ {x}).ncard : ℤ) = + ({δ ∈ Δ | IsActiveFor x y δ}.ncard : ℤ) := by + let S_all := {δ ∈ Δ | (δ ∩ {x, y}).Nonempty ∨ ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn + (univ : Set Circle) u v x y} + let S_act := {δ ∈ Δ | IsActiveFor x y δ} + let S_x := {δ ∈ Δ | x ∈ δ} + have hS_all_fin : S_all.Finite := hΔ.1.subset fun _ h => h.1 + have hS_act_fin : S_act.Finite := hΔ.1.subset fun _ h => h.1 + have hS_x_fin : S_x.Finite := hΔ.1.subset fun _ h => h.1 + have hdisj : Disjoint S_act S_x := by + rw [disjoint_left] + intro δ h1 h2 + exact h1.2.1 h2.2 + have hunion : S_all = S_act ∪ S_x := by + ext δ + simp only [S_all, S_act, S_x, mem_ofPred_eq, mem_union] + by_cases hxδ : x ∈ δ + · have hmem : (δ ∩ {x, y}).Nonempty := ⟨x, hxδ, mem_insert x {y}⟩ + have hnot : ¬ IsActiveFor x y δ := fun h => h.1 hxδ + exact ⟨fun h => Or.inr ⟨h.1, hxδ⟩, fun h => ⟨h.elim (fun h1 => h1.1) (fun h2 + => h2.1), Or.inl hmem⟩⟩ + · have hiff := active_iff_counted_not_mem_x hxy (δ := δ) + constructor + · rintro ⟨hδ, hcond⟩ + exact Or.inl ⟨hδ, hiff.mp ⟨hcond, hxδ⟩⟩ + · rintro (⟨hδ, hact⟩ | ⟨_, hxδ'⟩) + · exact ⟨hδ, (hiff.mpr hact).1⟩ + · exact (hxδ hxδ').elim + have hcard_union : S_all.ncard = S_act.ncard + S_x.ncard := by + rw [hunion] + exact ncard_union_eq hdisj hS_act_fin hS_x_fin + have hcard_x : S_x.ncard = (divisionUnion Δ ∩ {x}).ncard := by + by_cases hxV : x ∈ divisionUnion Δ + · obtain ⟨δ₀, hδ₀, hxδ₀⟩ := hxV + have h1 : S_x = {δ₀} := by + ext δ + simp only [S_x, mem_ofPred_eq, mem_singleton_iff] + refine ⟨fun ⟨hδ, hxδ⟩ => ?_, fun h => h ▸ ⟨hδ₀, hxδ₀⟩⟩ + by_contra hne + exact (hΔ.2.2 hδ hδ₀ hne).ne_of_mem hxδ hxδ₀ rfl + have h2 : divisionUnion Δ ∩ {x} = {x} := by + ext z + simp only [mem_inter_iff, mem_singleton_iff, and_iff_right_iff_imp] + rintro rfl + exact ⟨δ₀, hδ₀, hxδ₀⟩ + rw [h1, h2, ncard_singleton, ncard_singleton] + · have h1 : S_x = ∅ := by + ext δ + simp only [S_x, mem_ofPred_eq, mem_empty_iff_false, iff_false, not_and] + intro hδ hxδ + exact hxV ⟨δ, hδ, hxδ⟩ + have h2 : divisionUnion Δ ∩ {x} = ∅ := by + ext z + simp only [mem_inter_iff, mem_singleton_iff, mem_empty_iff_false, iff_false, not_and] + rintro h rfl + exact hxV h + rw [h1, h2, ncard_empty, ncard_empty] + change (S_all.ncard : ℤ) - ((divisionUnion Δ ∩ {x}).ncard : ℤ) = (S_act.ncard : ℤ) + rw [hcard_union, ← hcard_x] + omega + +/-! ## 4. Bijection between Active Members of $\Delta$ and Active Members of $\Delta^*$ -/ + +private lemma angleDiff_cases (x a b : Circle) : + (x.angleDiff a ≤ x.angleDiff b ∧ a.angleDiff b = x.angleDiff b - x.angleDiff a) ∨ + (x.angleDiff b < x.angleDiff a ∧ a.angleDiff b = 2 * Real.pi + x.angleDiff b - x.angleDiff a) + := by + have h := angleDiff_eq_of_angleDiff (x := x) (a := a) (b := b) + split_ifs at h with hle + · exact Or.inl ⟨hle, h⟩ + · exact Or.inr ⟨not_le.mp hle, h⟩ + +private lemma prevSegment_angleDiff_bounds {V U : Set Circle} + (hU : IsDualPointSet (univ : Set Circle) V U) + {x v₁ u₁ : Circle} (hx : x ∈ V ∪ U) (hv₁V : v₁ ∈ V) (hv₁x : x ≠ v₁) + (hu₁_eq : U ∩ prevSegment V v₁ = {u₁}) : + u₁ ∈ U ∧ u₁ ≠ v₁ ∧ + x.angleDiff u₁ < x.angleDiff v₁ ∧ + (∀ w ∈ V, x.angleDiff u₁ ≤ x.angleDiff w → x.angleDiff v₁ ≤ x.angleDiff w) ∧ + (∀ u ∈ U, x.angleDiff u₁ < x.angleDiff u → x.angleDiff v₁ < x.angleDiff u) := by + have hU_sub : U ⊆ (univ : Set Circle) \ V := isDualPointSet_subset_diff hU + obtain ⟨hu₁U, hu₁v₁, hvw₁, hu'w₁⟩ := prevSegment_dual_properties hU hv₁V hu₁_eq + have hxv₁_pos := Circle.angleDiff_pos hv₁x + have hxv₁_lt_2pi := Circle.angleDiff_lt_two_pi x v₁ + have hu₁v₁_pos := Circle.angleDiff_pos hu₁v₁ + have hxu₁_lt_v₁ : x.angleDiff u₁ < x.angleDiff v₁ := by + rcases eq_or_ne x u₁ with rfl | hxu₁_ne + · have hx0 : x.angleDiff x = 0 := circleCoordFrom_self x + linarith + · have hxu₁_pos := Circle.angleDiff_pos hxu₁_ne + have hxu₁_lt_2pi := Circle.angleDiff_lt_two_pi x u₁ + have hlt : u₁.angleDiff v₁ < x.angleDiff v₁ := by + rcases hx with hxV | hxU + · exact hvw₁ x ⟨hxV, hv₁x⟩ + · obtain ⟨w, _, h1, h2⟩ := hu'w₁ x ⟨hxU, hxu₁_ne⟩ + exact h1.trans h2 + rcases angleDiff_cases x u₁ v₁ with ⟨_, heq⟩ | ⟨_, heq⟩ <;> linarith + have hno_V_1 : ∀ w ∈ V, x.angleDiff u₁ ≤ x.angleDiff w → x.angleDiff v₁ ≤ x.angleDiff w := by + intro w hw hle + rcases eq_or_ne w v₁ with rfl | hwv₁ + · exact le_rfl + · have hlt := hvw₁ w ⟨hw, hwv₁⟩ + have hxw_ne : x ≠ w := by + rintro rfl + have hx0 : x.angleDiff x = 0 := circleCoordFrom_self x + rcases eq_or_ne x u₁ with rfl | hxu₁ + · exact (hU_sub hu₁U).2 hw + · have := Circle.angleDiff_pos hxu₁ + linarith + have hxw_pos := Circle.angleDiff_pos hxw_ne + have hxw_lt_2pi := Circle.angleDiff_lt_two_pi x w + have hwv₁_pos := Circle.angleDiff_pos hwv₁ + rcases angleDiff_cases x w v₁ with ⟨_, heq_w⟩ | ⟨_, heq_w⟩ <;> + rcases angleDiff_cases x u₁ v₁ with ⟨_, heq_u₁⟩ | ⟨_, heq_u₁⟩ <;> + linarith + have hno_U_1 : ∀ u ∈ U, x.angleDiff u₁ < x.angleDiff u → x.angleDiff v₁ < x.angleDiff u := by + intro u huU hu₁_lt_u + by_contra! hle + have hu_ne_u₁ : u ≠ u₁ := fun h => by subst h; exact lt_irrefl _ hu₁_lt_u + obtain ⟨w, _, hlt1, hlt2⟩ := hu'w₁ u ⟨huU, hu_ne_u₁⟩ + have hlt : u₁.angleDiff v₁ < u.angleDiff v₁ := hlt1.trans hlt2 + have hxu_ne : x ≠ u := fun h => by + subst h + have hx0 : x.angleDiff x = 0 := circleCoordFrom_self x + have := Circle.angleDiff_nonneg x u₁ + linarith + have hxu_pos := Circle.angleDiff_pos hxu_ne + have hxu_lt_2pi := Circle.angleDiff_lt_two_pi x u + have huv₁_ne : u ≠ v₁ := fun h => (hU_sub huU).2 (h ▸ hv₁V) + have huv₁_pos := Circle.angleDiff_pos huv₁_ne + rcases angleDiff_cases x u v₁ with ⟨_, heq_u⟩ | ⟨_, heq_u⟩ <;> + rcases angleDiff_cases x u₁ v₁ with ⟨_, heq_u₁⟩ | ⟨_, heq_u₁⟩ <;> + linarith + exact ⟨hu₁U, hu₁v₁, hxu₁_lt_v₁, hno_V_1, hno_U_1⟩ + +private lemma nextSegment_angleDiff_bounds {V U : Set Circle} + (hU : IsDualPointSet (univ : Set Circle) V U) + {x v₂ u₂ : Circle} (hx : x ∈ V ∪ U) (hv₂V : v₂ ∈ V) (hv₂x : x ≠ v₂) + (hx_not_V : x ∉ V) (hu₂_eq : U ∩ nextSegment V v₂ = {u₂}) : + u₂ ∈ U ∧ u₂ ≠ v₂ ∧ + (x = u₂ ∨ x.angleDiff v₂ < x.angleDiff u₂) ∧ + (∀ w ∈ V, (x = u₂ ∨ x.angleDiff w ≤ x.angleDiff u₂) → x.angleDiff w ≤ x.angleDiff v₂) ∧ + (∀ u ∈ U, (x ≠ u₂ → x.angleDiff u < x.angleDiff u₂) → x.angleDiff u < x.angleDiff v₂) := by + have hU_sub : U ⊆ (univ : Set Circle) \ V := isDualPointSet_subset_diff hU + obtain ⟨hu₂U, hu₂v₂, hvw₂, hu'w₂⟩ := nextSegment_dual_properties hU hv₂V hu₂_eq + have hxv₂_pos := Circle.angleDiff_pos hv₂x + have hxv₂_lt_2pi := Circle.angleDiff_lt_two_pi x v₂ + have hsum_xv₂ := Circle.angleDiff_add_angleDiff hv₂x + have hv₂u₂_pos := Circle.angleDiff_pos hu₂v₂.symm + have hxv₂_lt_u₂ : x = u₂ ∨ x.angleDiff v₂ < x.angleDiff u₂ := by + rcases eq_or_ne x u₂ with rfl | hxu₂_ne + · exact Or.inl rfl + · right + have hxu₂_pos := Circle.angleDiff_pos hxu₂_ne + have hxu₂_lt_2pi := Circle.angleDiff_lt_two_pi x u₂ + have hlt : v₂.angleDiff u₂ < v₂.angleDiff x := by + rcases hx with hxV | hxU + · exact (hx_not_V hxV).elim + · obtain ⟨w, _, h1, h2⟩ := hu'w₂ x ⟨hxU, hxu₂_ne⟩ + exact h1.trans h2 + rcases angleDiff_cases x v₂ u₂ with ⟨_, heq⟩ | ⟨_, heq⟩ <;> linarith + have hno_V_2 : ∀ w ∈ V, + (x = u₂ ∨ x.angleDiff w ≤ x.angleDiff u₂) → x.angleDiff w ≤ x.angleDiff v₂ := by + intro w hw hle + rcases eq_or_ne w v₂ with rfl | hwv₂ + · exact le_rfl + · have hlt := hvw₂ w ⟨hw, hwv₂⟩ + have hxw_ne : x ≠ w := fun h => hx_not_V (h ▸ hw) + have hxw_pos := Circle.angleDiff_pos hxw_ne + have hxw_lt_2pi := Circle.angleDiff_lt_two_pi x w + have hv₂w_pos := Circle.angleDiff_pos hwv₂.symm + rcases angleDiff_cases x v₂ w with ⟨_, heq_w⟩ | ⟨_, heq_w⟩ + · rcases hxv₂_lt_u₂ with rfl | hlt_u₂ + · linarith + · have hle' : x.angleDiff w ≤ x.angleDiff u₂ := hle.resolve_left (fun h + => by subst h; linarith) + have hxu₂_lt_2pi := Circle.angleDiff_lt_two_pi x u₂ + rcases angleDiff_cases x v₂ u₂ with ⟨_, heq_u₂⟩ | ⟨_, heq_u₂⟩ <;> + linarith + · linarith + have hno_U_2 : ∀ u ∈ U, + (x ≠ u₂ → x.angleDiff u < x.angleDiff u₂) → x.angleDiff u < x.angleDiff v₂ := by + intro u huU hu_lt_u₂ + by_contra! hge + have hu_ne_u₂ : u ≠ u₂ := by + rintro rfl + rcases eq_or_ne x u with rfl | hxu + · have hx0 : x.angleDiff x = 0 := circleCoordFrom_self x + linarith + · exact lt_irrefl _ (hu_lt_u₂ hxu) + obtain ⟨w, _, hlt1, hlt2⟩ := hu'w₂ u ⟨huU, hu_ne_u₂⟩ + have hlt : v₂.angleDiff u₂ < v₂.angleDiff u := hlt1.trans hlt2 + have hxu_lt_2pi := Circle.angleDiff_lt_two_pi x u + have hv₂u_ne : v₂ ≠ u := fun h => (hU_sub huU).2 (h ▸ hv₂V) + have hv₂u_pos := Circle.angleDiff_pos hv₂u_ne + rcases angleDiff_cases x v₂ u with ⟨_, heq_u⟩ | ⟨_, heq_u⟩ + · rcases hxv₂_lt_u₂ with rfl | hlt_u₂ + · linarith + · have hlt' : x.angleDiff u < x.angleDiff u₂ := hu_lt_u₂ (fun h => by subst h; linarith) + have hxu₂_lt_2pi := Circle.angleDiff_lt_two_pi x u₂ + rcases angleDiff_cases x v₂ u₂ with ⟨_, heq_u₂⟩ | ⟨_, heq_u₂⟩ <;> + linarith + · linarith + exact ⟨hu₂U, hu₂v₂, hxv₂_lt_u₂, hno_V_2, hno_U_2⟩ + +/-- The dual endpoints of a primal active interval belong to the same region. -/ +private lemma dualEquivRel_of_angle_bounds {Δ : Set (Set Circle)} {δ : Set Circle} + (hΔ : IsDivision Δ) (hCF : IsCrossFree (univ : Set Circle) Δ) + (hδ : δ ∈ Δ) {x v₁ v₂ u₁ u₂ : Circle} (hv₁δ : v₁ ∈ δ) (hv₂δ : v₂ ∈ δ) + (hmin₁ : ∀ z ∈ δ, x.angleDiff v₁ ≤ x.angleDiff z) + (hmax₂ : ∀ z ∈ δ, x.angleDiff z ≤ x.angleDiff v₂) + (hxu₁_lt_v₁ : x.angleDiff u₁ < x.angleDiff v₁) + (hle_v : x.angleDiff v₁ ≤ x.angleDiff v₂) + (hxv₂_lt_u₂ : x = u₂ ∨ x.angleDiff v₂ < x.angleDiff u₂) + (hno_V_1 : ∀ z ∈ divisionUnion Δ, + x.angleDiff u₁ ≤ x.angleDiff z → x.angleDiff v₁ ≤ x.angleDiff z) + (hno_V_2 : ∀ z ∈ divisionUnion Δ, + (x = u₂ ∨ x.angleDiff z ≤ x.angleDiff u₂) → x.angleDiff z ≤ x.angleDiff v₂) : + dualEquivRel (univ : Set Circle) Δ u₁ u₂ := by + rcases eq_or_ne u₁ u₂ with rfl | hu₁u₂_ne + · exact dualEquivRel_refl _ _ u₁ + rintro ⟨δ', hδ', z₁, hz₁, z₂, hz₂, hcross⟩ + have hz₁V : z₁ ∈ divisionUnion Δ := ⟨δ', hδ', hz₁⟩ + have hz₂V : z₂ ∈ divisionUnion Δ := ⟨δ', hδ', hz₂⟩ + have hcross' := hcross.comm isOArc_univ_circle + rw [crossesOn_univ_iff_circleCoordFrom x] at hcross' + rcases hcross' with ⟨_, hz₁z₂_ne, hu₁z₁, hu₁z₂, hu₂z₁, hu₂z₂, hiff⟩ + simp only [onOpenArc, circleCoordFrom] at hiff + have hiff' : + (x.angleDiff v₁ ≤ x.angleDiff z₁ ∧ x.angleDiff z₁ ≤ x.angleDiff v₂) ↔ + ¬ (x.angleDiff v₁ ≤ x.angleDiff z₂ ∧ x.angleDiff z₂ ≤ x.angleDiff v₂) := by + rcases hxv₂_lt_u₂ with rfl | hlt_u₂ + · have hx0 : x.angleDiff x = 0 := circleCoordFrom_self x + have hxu₁_pos : 0 < x.angleDiff u₁ := Circle.angleDiff_pos hu₁u₂_ne.symm + have hmin_eq : min (x.angleDiff u₁) (x.angleDiff x) = 0 := by + rw [hx0, min_eq_right hxu₁_pos.le] + have hmax_eq : max (x.angleDiff u₁) (x.angleDiff x) = x.angleDiff u₁ := by + rw [hx0, max_eq_left hxu₁_pos.le] + rw [hmin_eq, hmax_eq] at hiff + have hz₁_pos : 0 < x.angleDiff z₁ := Circle.angleDiff_pos hu₂z₁ + have hz₂_pos : 0 < x.angleDiff z₂ := Circle.angleDiff_pos hu₂z₂ + have hz₁_ne_u₁ : x.angleDiff z₁ ≠ x.angleDiff u₁ := + (circleCoordFrom x).injective.ne hu₁z₁.symm + have hz₂_ne_u₁ : x.angleDiff z₂ ≠ x.angleDiff u₁ := + (circleCoordFrom x).injective.ne hu₁z₂.symm + have h1_z₁ := hno_V_1 z₁ hz₁V + have h2_z₁ := hno_V_2 z₁ hz₁V (Or.inl rfl) + have h1_z₂ := hno_V_1 z₂ hz₂V + have h2_z₂ := hno_V_2 z₂ hz₂V (Or.inl rfl) + have hz₁_iff : (0 < x.angleDiff z₁ ∧ x.angleDiff z₁ < x.angleDiff u₁) ↔ + ¬ (x.angleDiff v₁ ≤ x.angleDiff z₁ ∧ x.angleDiff z₁ ≤ x.angleDiff v₂) := by + constructor + · rintro ⟨_, hlt⟩ ⟨hge, _⟩; linarith + · intro hnot + refine ⟨hz₁_pos, lt_of_le_of_ne ?_ hz₁_ne_u₁⟩ + by_contra! hgt + exact hnot ⟨h1_z₁ hgt.le, h2_z₁⟩ + have hz₂_iff : (0 < x.angleDiff z₂ ∧ x.angleDiff z₂ < x.angleDiff u₁) ↔ + ¬ (x.angleDiff v₁ ≤ x.angleDiff z₂ ∧ x.angleDiff z₂ ≤ x.angleDiff v₂) := by + constructor + · rintro ⟨_, hlt⟩ ⟨hge, _⟩; linarith + · intro hnot + refine ⟨hz₂_pos, lt_of_le_of_ne ?_ hz₂_ne_u₁⟩ + by_contra! hgt + exact hnot ⟨h1_z₂ hgt.le, h2_z₂⟩ + rw [hz₁_iff, hz₂_iff] at hiff + exact ⟨fun h1 h2 => hiff.mpr (not_not.mpr h2) h1, + fun hnot => by_contra fun hnotA => hiff.mp hnotA hnot⟩ + · have hlt_u₁_u₂ : x.angleDiff u₁ < x.angleDiff u₂ := by linarith + have hmin_eq : min (x.angleDiff u₁) (x.angleDiff u₂) = x.angleDiff u₁ := + min_eq_left hlt_u₁_u₂.le + have hmax_eq : max (x.angleDiff u₁) (x.angleDiff u₂) = x.angleDiff u₂ := + max_eq_right hlt_u₁_u₂.le + rw [hmin_eq, hmax_eq] at hiff + have h1_z₁ := hno_V_1 z₁ hz₁V + have h2_z₁ := hno_V_2 z₁ hz₁V + have h1_z₂ := hno_V_1 z₂ hz₂V + have h2_z₂ := hno_V_2 z₂ hz₂V + have hz₁_iff : (x.angleDiff u₁ < x.angleDiff z₁ ∧ x.angleDiff z₁ < x.angleDiff u₂) ↔ + (x.angleDiff v₁ ≤ x.angleDiff z₁ ∧ x.angleDiff z₁ ≤ x.angleDiff v₂) := by + refine ⟨fun ⟨h1, h2⟩ => ⟨h1_z₁ h1.le, h2_z₁ (Or.inr h2.le)⟩, fun ⟨h1, h2⟩ => ⟨?_, ?_⟩⟩ + <;> linarith + have hz₂_iff : (x.angleDiff u₁ < x.angleDiff z₂ ∧ x.angleDiff z₂ < x.angleDiff u₂) ↔ + (x.angleDiff v₁ ≤ x.angleDiff z₂ ∧ x.angleDiff z₂ ≤ x.angleDiff v₂) := by + refine ⟨fun ⟨h1, h2⟩ => ⟨h1_z₂ h1.le, h2_z₂ (Or.inr h2.le)⟩, fun ⟨h1, h2⟩ => ⟨?_, ?_⟩⟩ + <;> linarith + rwa [hz₁_iff, hz₂_iff] at hiff + have hδ_ne_δ' : δ ≠ δ' := by + rintro rfl + exact hiff'.mp ⟨hmin₁ z₁ hz₁, hmax₂ z₁ hz₁⟩ ⟨hmin₁ z₂ hz₂, hmax₂ z₂ hz₂⟩ + have hdisj : Disjoint δ δ' := hΔ.2.2 hδ hδ' hδ_ne_δ' + have hz₁_ne_v₁ : z₁ ≠ v₁ := (hdisj.ne_of_mem hv₁δ hz₁).symm + have hz₁_ne_v₂ : z₁ ≠ v₂ := (hdisj.ne_of_mem hv₂δ hz₁).symm + have hz₂_ne_v₁ : z₂ ≠ v₁ := (hdisj.ne_of_mem hv₁δ hz₂).symm + have hz₂_ne_v₂ : z₂ ≠ v₂ := (hdisj.ne_of_mem hv₂δ hz₂).symm + have hz₁_ne_v₁_ang : x.angleDiff z₁ ≠ x.angleDiff v₁ := + (circleCoordFrom x).injective.ne hz₁_ne_v₁ + have hz₁_ne_v₂_ang : x.angleDiff z₁ ≠ x.angleDiff v₂ := + (circleCoordFrom x).injective.ne hz₁_ne_v₂ + have hz₂_ne_v₁_ang : x.angleDiff z₂ ≠ x.angleDiff v₁ := + (circleCoordFrom x).injective.ne hz₂_ne_v₁ + have hz₂_ne_v₂_ang : x.angleDiff z₂ ≠ x.angleDiff v₂ := + (circleCoordFrom x).injective.ne hz₂_ne_v₂ + have hv₁_ne_v₂ : v₁ ≠ v₂ := by + intro h + subst h + by_cases hb₁ : x.angleDiff v₁ ≤ x.angleDiff z₁ ∧ x.angleDiff z₁ ≤ x.angleDiff v₁ + · exact hz₁_ne_v₁_ang (le_antisymm hb₁.2 hb₁.1) + · have hb₂ : x.angleDiff v₁ ≤ x.angleDiff z₂ ∧ x.angleDiff z₂ ≤ x.angleDiff v₁ := + not_not.mp (hiff'.not.mp hb₁) + exact hz₂_ne_v₁_ang (le_antisymm hb₂.2 hb₂.1) + have hv_cross : CrossesOn (univ : Set Circle) v₁ v₂ z₁ z₂ := by + rw [crossesOn_univ_iff_circleCoordFrom x] + refine ⟨hv₁_ne_v₂, hz₁z₂_ne, hz₁_ne_v₁.symm, hz₂_ne_v₁.symm, + hz₁_ne_v₂.symm, hz₂_ne_v₂.symm, ?_⟩ + simp only [onOpenArc, circleCoordFrom] + rw [min_eq_left hle_v, max_eq_right hle_v] + have hz₁_open : (x.angleDiff v₁ < x.angleDiff z₁ ∧ x.angleDiff z₁ < x.angleDiff v₂) ↔ + (x.angleDiff v₁ ≤ x.angleDiff z₁ ∧ x.angleDiff z₁ ≤ x.angleDiff v₂) := + ⟨fun ⟨h1, h2⟩ => ⟨h1.le, h2.le⟩, + fun ⟨h1, h2⟩ => ⟨lt_of_le_of_ne h1 hz₁_ne_v₁_ang.symm, lt_of_le_of_ne h2 hz₁_ne_v₂_ang⟩⟩ + have hz₂_open : (x.angleDiff v₁ < x.angleDiff z₂ ∧ x.angleDiff z₂ < x.angleDiff v₂) ↔ + (x.angleDiff v₁ ≤ x.angleDiff z₂ ∧ x.angleDiff z₂ ≤ x.angleDiff v₂) := + ⟨fun ⟨h1, h2⟩ => ⟨h1.le, h2.le⟩, + fun ⟨h1, h2⟩ => ⟨lt_of_le_of_ne h1 hz₂_ne_v₁_ang.symm, lt_of_le_of_ne h2 hz₂_ne_v₂_ang⟩⟩ + rwa [hz₁_open, hz₂_open] + exact hCF ⟨δ, hδ, δ', hδ', hδ_ne_δ', v₁, hv₁δ, v₂, hv₂δ, z₁, hz₁, z₂, hz₂, hv_cross⟩ + +private lemma dual_active_of_primal_active {U : Set Circle} {Δ : Set (Set Circle)} + (hΔ : IsDivision Δ) (hV_fin : (divisionUnion Δ).Finite) + (hU : IsDualPointSet (univ : Set Circle) (divisionUnion Δ) U) + (hCF : IsCrossFree (univ : Set Circle) Δ) + {x y : Circle} (hx : x ∈ divisionUnion Δ ∪ U) (hy : y ∈ divisionUnion Δ ∪ U) + (hxy : x ≠ y) {δ : Set Circle} (hδ : δ ∈ Δ) (hact : IsActiveFor x y δ) : + ∃ v₁ ∈ δ, ∃ v₂ ∈ δ, + (∀ v ∈ δ, x.angleDiff v₁ ≤ x.angleDiff v ∧ x.angleDiff v ≤ x.angleDiff v₂) ∧ + x.angleDiff v₁ ≤ x.angleDiff y ∧ x.angleDiff y ≤ x.angleDiff v₂ ∧ + ∃ u₁ u₂ : Circle, + U ∩ prevSegment (divisionUnion Δ) v₁ = {u₁} ∧ + U ∩ nextSegment (divisionUnion Δ) v₂ = {u₂} ∧ + ∃ δ_star ∈ dualDivision (univ : Set Circle) U Δ, + u₁ ∈ δ_star ∧ u₂ ∈ δ_star ∧ + IsActiveFor y x δ_star ∧ + (∀ u ∈ δ_star, y.angleDiff u₂ ≤ y.angleDiff u ∧ y.angleDiff u ≤ y.angleDiff u₁) := by + have hU_sub : U ⊆ (univ : Set Circle) \ divisionUnion Δ := isDualPointSet_subset_diff hU + have hδ_fin : δ.Finite := hV_fin.subset (subset_sUnion_of_mem hδ) + have hδ_ne : δ.Nonempty := hΔ.2.1 δ hδ + obtain ⟨v₁, hv₁δ, hmin₁⟩ := exists_min_on_finite hδ_fin hδ_ne (Circle.angleDiff x) + obtain ⟨v₂, hv₂δ, hmax₂⟩ := exists_max_on_finite hδ_fin hδ_ne (Circle.angleDiff x) + rcases hact with ⟨hxδ, ⟨w₁, hw₁δ, hw₁le⟩, ⟨w₂, hw₂δ, hw₂ge⟩⟩ + have hv₁_le_y : x.angleDiff v₁ ≤ x.angleDiff y := (hmin₁ w₁ hw₁δ).trans hw₁le + have hy_le_v₂ : x.angleDiff y ≤ x.angleDiff v₂ := hw₂ge.trans (hmax₂ w₂ hw₂δ) + have hv₁V : v₁ ∈ divisionUnion Δ := ⟨δ, hδ, hv₁δ⟩ + have hv₂V : v₂ ∈ divisionUnion Δ := ⟨δ, hδ, hv₂δ⟩ + have hv₁x : x ≠ v₁ := fun h => hxδ (h ▸ hv₁δ) + have hv₂x : x ≠ v₂ := fun h => hxδ (h ▸ hv₂δ) + obtain ⟨u₁, hu₁_eq⟩ := exists_unique_mem_prevSegment_of_isDualPointSet hV_fin hU hv₁V + obtain ⟨hu₁U, hu₁v₁, hxu₁_lt_v₁, hno_V_1, hno_U_1⟩ := + prevSegment_angleDiff_bounds hU hx hv₁V hv₁x hu₁_eq + obtain ⟨u₂, hu₂_eq⟩ := exists_unique_mem_nextSegment_of_isDualPointSet hV_fin hU hv₂V + have hxv₂_lt_u₂_all : + u₂ ∈ U ∧ u₂ ≠ v₂ ∧ + (x = u₂ ∨ x.angleDiff v₂ < x.angleDiff u₂) ∧ + (∀ w ∈ divisionUnion Δ, (x = u₂ ∨ x.angleDiff w ≤ x.angleDiff u₂) → x.angleDiff w + ≤ x.angleDiff v₂) ∧ + (∀ u ∈ U, (x ≠ u₂ → x.angleDiff u < x.angleDiff u₂) → x.angleDiff u < x.angleDiff v₂) := by + by_cases hxV : x ∈ divisionUnion Δ + · obtain ⟨hu₂U, hu₂v₂, hvw₂, hu'w₂⟩ := nextSegment_dual_properties hU hv₂V hu₂_eq + have hxu₂_ne : x ≠ u₂ := fun h => (hU_sub hu₂U).2 (h ▸ hxV) + have hxv₂_pos := Circle.angleDiff_pos hv₂x + have hxv₂_lt_2pi := Circle.angleDiff_lt_two_pi x v₂ + have hsum_xv₂ := Circle.angleDiff_add_angleDiff hv₂x + have hv₂u₂_pos := Circle.angleDiff_pos hu₂v₂.symm + have hxu₂_pos := Circle.angleDiff_pos hxu₂_ne + have hxu₂_lt_2pi := Circle.angleDiff_lt_two_pi x u₂ + have hlt_x := hvw₂ x ⟨hxV, hv₂x⟩ + have hlt_u₂ : x.angleDiff v₂ < x.angleDiff u₂ := by + rcases angleDiff_cases x v₂ u₂ with ⟨_, heq⟩ | ⟨_, heq⟩ <;> linarith + refine ⟨hu₂U, hu₂v₂, Or.inr hlt_u₂, ?_, ?_⟩ + · intro w hw hle + rcases eq_or_ne w v₂ with rfl | hwv₂ + · exact le_rfl + · have hlt := hvw₂ w ⟨hw, hwv₂⟩ + rcases eq_or_ne x w with rfl | hxw_ne + · have hx0 : x.angleDiff x = 0 := circleCoordFrom_self x + linarith + · have hxw_pos := Circle.angleDiff_pos hxw_ne + have hxw_lt_2pi := Circle.angleDiff_lt_two_pi x w + have hv₂w_pos := Circle.angleDiff_pos hwv₂.symm + have hle' := hle.resolve_left hxu₂_ne + rcases angleDiff_cases x v₂ w with ⟨_, heq_w⟩ | ⟨_, heq_w⟩ <;> + rcases angleDiff_cases x v₂ u₂ with ⟨_, heq_u₂⟩ | ⟨_, heq_u₂⟩ <;> + linarith + · intro u huU hu_lt_u₂ + by_contra! hge + have hlt' := hu_lt_u₂ hxu₂_ne + have hu_ne_u₂ : u ≠ u₂ := fun h => by subst h; linarith + obtain ⟨w, _, hlt1, hlt2⟩ := hu'w₂ u ⟨huU, hu_ne_u₂⟩ + have hlt := hlt1.trans hlt2 + have hxu_lt_2pi := Circle.angleDiff_lt_two_pi x u + have hv₂u_ne : v₂ ≠ u := fun h => (hU_sub huU).2 (h ▸ hv₂V) + have hv₂u_pos := Circle.angleDiff_pos hv₂u_ne + rcases angleDiff_cases x v₂ u with ⟨_, heq_u⟩ | ⟨_, heq_u⟩ <;> + rcases angleDiff_cases x v₂ u₂ with ⟨_, heq_u₂⟩ | ⟨_, heq_u₂⟩ <;> + linarith + · exact nextSegment_angleDiff_bounds hU hx hv₂V hv₂x hxV hu₂_eq + obtain ⟨hu₂U, hu₂v₂, hxv₂_lt_u₂, hno_V_2, hno_U_2⟩ := hxv₂_lt_u₂_all + have hxy_pos := Circle.angleDiff_pos hxy + have hxy_lt_2pi := Circle.angleDiff_lt_two_pi x y + have hsum_xy := Circle.angleDiff_add_angleDiff hxy + have hxv₁_pos := Circle.angleDiff_pos hv₁x + have hxv₂_pos := Circle.angleDiff_pos hv₂x + have hxv₁_lt_2pi := Circle.angleDiff_lt_two_pi x v₁ + have hxv₂_lt_2pi := Circle.angleDiff_lt_two_pi x v₂ + have hu₁u₂_rel : dualEquivRel (univ : Set Circle) Δ u₁ u₂ := + dualEquivRel_of_angle_bounds hΔ hCF hδ hv₁δ hv₂δ hmin₁ hmax₂ hxu₁_lt_v₁ + (hv₁_le_y.trans hy_le_v₂) hxv₂_lt_u₂ hno_V_1 hno_V_2 + -- Step 5: Every u ∈ δ_star lies outside (v₁, v₂) + let δ_star := {u' ∈ U | dualEquivRel (univ : Set Circle) Δ u₁ u'} + have hδ_star_mem : δ_star ∈ dualDivision (univ : Set Circle) U Δ := ⟨u₁, hu₁U, rfl⟩ + have hu₁_in : u₁ ∈ δ_star := ⟨hu₁U, dualEquivRel_refl _ _ u₁⟩ + have hu₂_in : u₂ ∈ δ_star := ⟨hu₂U, hu₁u₂_rel⟩ + have hδ_star_outside : ∀ u ∈ δ_star, + x.angleDiff u ≤ x.angleDiff u₁ ∨ (x ≠ u₂ ∧ x.angleDiff u₂ ≤ x.angleDiff u) := by + intro u ⟨huU, hrel⟩ + by_contra! hbetween + rcases hbetween with ⟨hu₁_lt_u, hu_lt_u₂⟩ + have hu_gt_v₁ : x.angleDiff v₁ < x.angleDiff u := hno_U_1 u huU hu₁_lt_u + have hu_lt_v₂ : x.angleDiff u < x.angleDiff v₂ := hno_U_2 u huU hu_lt_u₂ + have hv₁v₂_ne : v₁ ≠ v₂ := fun h => by subst h; linarith + have hu₁u_ne : u₁ ≠ u := fun h => by subst h; linarith + have hv₁u₁_ne : v₁ ≠ u₁ := hu₁v₁.symm + have hv₁u_ne : v₁ ≠ u := fun h => (hU_sub huU).2 (h ▸ hv₁V) + have hv₂u₁_ne : v₂ ≠ u₁ := fun h => (hU_sub hu₁U).2 (h ▸ hv₂V) + have hv₂u_ne : v₂ ≠ u := fun h => (hU_sub huU).2 (h ▸ hv₂V) + have hcross : CrossesOn (univ : Set Circle) v₁ v₂ u₁ u := by + rw [crossesOn_univ_iff_circleCoordFrom x] + refine ⟨hv₁v₂_ne, hu₁u_ne, hv₁u₁_ne, hv₁u_ne, hv₂u₁_ne, hv₂u_ne, ?_⟩ + simp only [onOpenArc, circleCoordFrom] + have hle_v : x.angleDiff v₁ ≤ x.angleDiff v₂ := hv₁_le_y.trans hy_le_v₂ + rw [min_eq_left hle_v, max_eq_right hle_v] + exact ⟨fun ⟨h1, _⟩ => (lt_irrefl _ (hxu₁_lt_v₁.trans h1)).elim, + fun hnot => (hnot ⟨hu_gt_v₁, hu_lt_v₂⟩).elim⟩ + exact hrel ⟨δ, hδ, v₁, hv₁δ, v₂, hv₂δ, hcross⟩ + -- Step 6: Translate to y.angleDiff bounds! + have hy_not_in : y ∉ δ_star := by + intro hy_in + rcases hy with hyV | hyU + · exact (hU_sub hy_in.1).2 hyV + · have hyv₁_ne : y ≠ v₁ := fun h => (hU_sub hyU).2 (h ▸ hv₁V) + have hyv₂_ne : y ≠ v₂ := fun h => (hU_sub hyU).2 (h ▸ hv₂V) + have hv₁_lt_y : x.angleDiff v₁ < x.angleDiff y := + lt_of_le_of_ne hv₁_le_y ((circleCoordFrom x).injective.ne hyv₁_ne.symm) + have hy_lt_v₂ : x.angleDiff y < x.angleDiff v₂ := + lt_of_le_of_ne hy_le_v₂ ((circleCoordFrom x).injective.ne hyv₂_ne) + rcases hδ_star_outside y hy_in with hle1 | ⟨hxu₂, hge2⟩ + · linarith + · rcases hxv₂_lt_u₂ with rfl | hlt_u₂ + · exact hxu₂ rfl + · linarith + have hx0 : x.angleDiff x = 0 := circleCoordFrom_self x + have hxu₁_nonneg := Circle.angleDiff_nonneg x u₁ + have hxu₁_lt_2pi := Circle.angleDiff_lt_two_pi x u₁ + have hxu₂_nonneg := Circle.angleDiff_nonneg x u₂ + have hxu₂_lt_2pi := Circle.angleDiff_lt_two_pi x u₂ + have hyu₁_val : y.angleDiff u₁ = x.angleDiff u₁ - x.angleDiff y + 2 * Real.pi := by + rcases angleDiff_cases x y u₁ with ⟨_, heq⟩ | ⟨_, heq⟩ <;> linarith + have hyu₂_val : (x = u₂ ∧ y.angleDiff u₂ = 2 * Real.pi - x.angleDiff y) ∨ + (x ≠ u₂ ∧ y.angleDiff u₂ = x.angleDiff u₂ - x.angleDiff y) := by + rcases hxv₂_lt_u₂ with rfl | hlt_u₂ + · left + refine ⟨rfl, ?_⟩ + rcases angleDiff_cases x y x with ⟨_, heq⟩ | ⟨_, heq⟩ <;> linarith + · right + refine ⟨fun h => by subst h; linarith, ?_⟩ + rcases angleDiff_cases x y u₂ with ⟨_, heq⟩ | ⟨_, heq⟩ <;> linarith + have hy_bounds : ∀ u ∈ δ_star, y.angleDiff u₂ ≤ y.angleDiff u ∧ y.angleDiff u ≤ y.angleDiff u₁ + := by + intro u hu + have hxu_nonneg := Circle.angleDiff_nonneg x u + have hxu_lt_2pi := Circle.angleDiff_lt_two_pi x u + rcases hδ_star_outside u hu with hle1 | ⟨hxu₂, hge2⟩ + · have hyu_val : y.angleDiff u = x.angleDiff u - x.angleDiff y + 2 * Real.pi := by + rcases angleDiff_cases x y u with ⟨_, heq⟩ | ⟨_, heq⟩ <;> linarith + rcases hyu₂_val with ⟨_, heq₂⟩ | ⟨_, heq₂⟩ <;> refine ⟨?_, ?_⟩ <;> linarith + · rcases hyu₂_val with ⟨rfl, _⟩ | ⟨_, heq₂⟩ + · exact (hxu₂ rfl).elim + · rcases hxv₂_lt_u₂ with rfl | hlt_u₂ + · exact (hxu₂ rfl).elim + · have hyu_val : y.angleDiff u = x.angleDiff u - x.angleDiff y := by + rcases angleDiff_cases x y u with ⟨_, heq⟩ | ⟨_, heq⟩ <;> linarith + refine ⟨?_, ?_⟩ <;> linarith + have hyu₂_le_yx : y.angleDiff u₂ ≤ y.angleDiff x := by + rcases hyu₂_val with ⟨_, heq₂⟩ | ⟨_, heq₂⟩ <;> linarith + have hyx_le_yu₁ : y.angleDiff x ≤ y.angleDiff u₁ := by + linarith + refine ⟨v₁, hv₁δ, v₂, hv₂δ, fun v hv => ⟨hmin₁ v hv, hmax₂ v hv⟩, + hv₁_le_y, hy_le_v₂, u₁, u₂, hu₁_eq, hu₂_eq, + δ_star, hδ_star_mem, hu₁_in, hu₂_in, + ⟨hy_not_in, ⟨u₂, hu₂_in, hyu₂_le_yx⟩, ⟨u₁, hu₁_in, hyx_le_yu₁⟩⟩, + hy_bounds⟩ + +private lemma active_ncard_le_dual_active_ncard {U : Set Circle} {Δ : Set (Set Circle)} + (hΔ : IsDivision Δ) (hV_fin : (divisionUnion Δ).Finite) + (hU : IsDualPointSet (univ : Set Circle) (divisionUnion Δ) U) + (hCF : IsCrossFree (univ : Set Circle) Δ) + {x y : Circle} (hx : x ∈ divisionUnion Δ ∪ U) (hy : y ∈ divisionUnion Δ ∪ U) + (hxy : x ≠ y) : + {δ ∈ Δ | IsActiveFor x y δ}.ncard ≤ + {δ_star ∈ dualDivision (univ : Set Circle) U Δ | IsActiveFor y x δ_star}.ncard := by + let V := divisionUnion Δ + let Δ_star := dualDivision (univ : Set Circle) U Δ + have hΔ_star_div : IsDivision Δ_star := isDivision_dualDivision_univ hV_fin hU + have hS₂_fin : {δ_star ∈ Δ_star | IsActiveFor y x δ_star}.Finite := + hΔ_star_div.1.subset fun _ h => h.1 + have hex : ∀ δ : Set Circle, + ∃ δ_star : Set Circle, δ ∈ {δ ∈ Δ | IsActiveFor x y δ} → + δ_star ∈ {δ_star ∈ Δ_star | IsActiveFor y x δ_star} ∧ + ∃ v₁ ∈ δ, ∃ u₁ ∈ δ_star, + U ∩ prevSegment V v₁ = {u₁} ∧ + ∀ u ∈ δ_star, y.angleDiff u ≤ y.angleDiff u₁ := by + intro δ + by_cases h : δ ∈ {δ ∈ Δ | IsActiveFor x y δ} + · obtain ⟨v₁, hv₁δ, _, _, _, _, _, u₁, _, hu₁_eq, _, δ_star, hδ_star, hu₁_in, _, hact_star, + hy_b⟩ := + dual_active_of_primal_active hΔ hV_fin hU hCF hx hy hxy h.1 h.2 + exact ⟨δ_star, fun _ => ⟨⟨hδ_star, hact_star⟩, v₁, hv₁δ, u₁, hu₁_in, hu₁_eq, fun u hu => + (hy_b u hu).2⟩⟩ + · exact ⟨∅, fun h' => (h h').elim⟩ + choose f hf using hex + refine ncard_le_ncard_of_injOn f + (fun δ hδ => (hf δ hδ).1) (fun δ₁ hδ₁ δ₂ hδ₂ heq => ?_) hS₂_fin + obtain ⟨_, v₁, hv₁, u₁, hu₁, hu₁_eq, hmax₁⟩ := hf δ₁ hδ₁ + obtain ⟨_, v₁', hv₁', u₁', hu₁', hu₁'_eq, hmax₁'⟩ := hf δ₂ hδ₂ + rw [heq] at hu₁ hmax₁ + have hu_eq : u₁ = u₁' := + (circleCoordFrom y).injective (le_antisymm (hmax₁' u₁ hu₁) (hmax₁ u₁' hu₁')) + rw [hu_eq] at hu₁_eq + have hv₁V : v₁ ∈ V := ⟨δ₁, hδ₁.1, hv₁⟩ + have hv₁'V : v₁' ∈ V := ⟨δ₂, hδ₂.1, hv₁'⟩ + have hu₁'_in₁ : u₁' ∈ prevSegment V v₁ := by + have : u₁' ∈ U ∩ prevSegment V v₁ := by rw [hu₁_eq]; exact mem_singleton u₁' + exact this.2 + have hu₁'_in₂ : u₁' ∈ prevSegment V v₁' := by + have : u₁' ∈ U ∩ prevSegment V v₁' := by rw [hu₁'_eq]; exact mem_singleton u₁' + exact this.2 + have hu₁'_compl : u₁' ∈ Vᶜ := prevSegment_subset_compl hu₁'_in₁ + obtain ⟨_, _, huniq⟩ := exists_unique_prevSegment_of_mem_compl hV_fin ⟨v₁, hv₁V⟩ hu₁'_compl + have hv_eq : v₁ = v₁' := (huniq v₁ ⟨hv₁V, hu₁'_in₁⟩).trans (huniq v₁' ⟨hv₁'V, hu₁'_in₂⟩).symm + rw [hv_eq] at hv₁ + by_contra hne + exact (hΔ.2.2 hδ₁.1 hδ₂.1 hne).ne_of_mem hv₁ hv₁' rfl + +/-! ## 5. Proof of (2.4) -/ + +theorem theorem_2_4_univ (U : Set Circle) (Δ : Set (Set Circle)) (x y : Circle) + (hΔ : IsDivision Δ) (hV_fin : (divisionUnion Δ).Finite) + (hU : IsDualPointSet (univ : Set Circle) (divisionUnion Δ) U) + (hCF : IsCrossFree (univ : Set Circle) Δ) + (hx : x ∈ divisionUnion Δ ∪ U) (hy : y ∈ divisionUnion Δ ∪ U) : + ((x ∈ divisionUnion Δ ∧ y ∈ divisionUnion Δ → + (divisionCount (univ : Set Circle) Δ x y : ℤ) - + (divisionCount (univ : Set Circle) (dualDivision (univ : Set Circle) U Δ) x y : ℤ) = 1) ∧ + (x ∈ U ∧ y ∈ U → + (divisionCount (univ : Set Circle) Δ x y : ℤ) - + (divisionCount (univ : Set Circle) (dualDivision (univ : Set Circle) U Δ) x y : ℤ) = -1) ∧ + (¬ (x ∈ divisionUnion Δ ∧ y ∈ divisionUnion Δ) → ¬ (x ∈ U ∧ y ∈ U) → + (divisionCount (univ : Set Circle) Δ x y : ℤ) - + (divisionCount (univ : Set Circle) (dualDivision (univ : Set Circle) U Δ) x y : ℤ) = 0)) + := by + rcases eq_or_ne x y with rfl | hxy + · exact theorem_2_4_self (univ : Set Circle) U Δ x hV_fin (subset_univ _) + isOArc_univ_circle hΔ hU hx + let V := divisionUnion Δ + let Δ_star := dualDivision (univ : Set Circle) U Δ + have hU_sub : U ⊆ (univ : Set Circle) \ V := isDualPointSet_subset_diff hU + have hΔ_star_div : IsDivision Δ_star := isDivision_dualDivision_univ hV_fin hU + have hΔ_star_union : divisionUnion Δ_star = U := divisionUnion_dualDivision _ U Δ + have hU_fin : U.Finite := finite_of_isDualPointSet_univ hV_fin hU + have hU_symm : IsDualPointSet (univ : Set Circle) U V := isDualPointSet_univ_symm hV_fin hU + have hU_symm' : IsDualPointSet (univ : Set Circle) (divisionUnion Δ_star) V := by + rwa [hΔ_star_union] + have hCF_star : IsCrossFree (univ : Set Circle) Δ_star := + theorem_2_1_proof (univ : Set Circle) U Δ isOArc_univ_circle hΔ (subset_univ _) hU + have hdd : dualDivision (univ : Set Circle) V Δ_star = Δ := + theorem_2_2_univ U Δ hΔ hV_fin hU hCF + have hle₁ := active_ncard_le_dual_active_ncard hΔ hV_fin hU hCF hx hy hxy + have hx' : x ∈ divisionUnion Δ_star ∪ V := by + rw [hΔ_star_union, union_comm] + exact hx + have hy' : y ∈ divisionUnion Δ_star ∪ V := by + rw [hΔ_star_union, union_comm] + exact hy + have hle₂ : {δ_star ∈ Δ_star | IsActiveFor y x δ_star}.ncard ≤ + {δ ∈ Δ | IsActiveFor x y δ}.ncard := by + have h := active_ncard_le_dual_active_ncard hΔ_star_div (hΔ_star_union ▸ hU_fin) + hU_symm' hCF_star hy' hx' hxy.symm + rwa [hdd] at h + have hact_eq : {δ ∈ Δ | IsActiveFor x y δ}.ncard = + {δ_star ∈ Δ_star | IsActiveFor y x δ_star}.ncard := le_antisymm hle₁ hle₂ + have hcount_symm : divisionCount (univ : Set Circle) Δ_star x y = + divisionCount (univ : Set Circle) Δ_star y x := by + unfold divisionCount + congr 1 + ext δ_star + simp only [mem_ofPred_eq, pair_comm x y] + refine and_congr_right fun _ => or_congr_right ?_ + exact exists_congr fun u => and_congr_right fun _ => + exists_congr fun v => and_congr_right fun _ => + ⟨CrossesOn.symm_right, CrossesOn.symm_right⟩ + have h1 := divisionCount_eq_active_add_mem hΔ hxy + have h2 := divisionCount_eq_active_add_mem hΔ_star_div hxy.symm + rw [hΔ_star_union, ← hcount_symm] at h2 + have hmain : (divisionCount (univ : Set Circle) Δ x y : ℤ) - ((divisionUnion Δ ∩ {x}).ncard : ℤ) = + (divisionCount (univ : Set Circle) (dualDivision (univ : Set Circle) U Δ) x y : ℤ) - + ((U ∩ {y}).ncard : ℤ) := by + rw [h1, h2, hact_eq] + have hxV_card : ∀ (h : x ∈ divisionUnion Δ), (divisionUnion Δ ∩ {x}).ncard = 1 := fun h => by + have heq : divisionUnion Δ ∩ {x} = {x} := inter_eq_right.mpr (singleton_subset_iff.mpr h) + rw [heq, ncard_singleton] + have hxV_not_card : ∀ (h : x ∉ divisionUnion Δ), (divisionUnion Δ ∩ {x}).ncard = 0 := fun h => by + have heq : divisionUnion Δ ∩ {x} = ∅ := by + ext z; simp only [mem_inter_iff, mem_singleton_iff, mem_empty_iff_false, iff_false, not_and] + rintro hz rfl; exact h hz + rw [heq, ncard_empty] + have hyU_card : ∀ (h : y ∈ U), (U ∩ {y}).ncard = 1 := fun h => by + have heq : U ∩ {y} = {y} := inter_eq_right.mpr (singleton_subset_iff.mpr h) + rw [heq, ncard_singleton] + have hyU_not_card : ∀ (h : y ∉ U), (U ∩ {y}).ncard = 0 := fun h => by + have heq : U ∩ {y} = ∅ := by + ext z; simp only [mem_inter_iff, mem_singleton_iff, mem_empty_iff_false, iff_false, not_and] + rintro hz rfl; exact h hz + rw [heq, ncard_empty] + refine ⟨?_, ?_, ?_⟩ + · rintro ⟨hxV, hyV⟩ + have hyU : y ∉ U := fun h => (hU_sub h).2 hyV + rw [hxV_card hxV, hyU_not_card hyU] at hmain + omega + · rintro ⟨hxU, hyU⟩ + have hxV : x ∉ divisionUnion Δ := (hU_sub hxU).2 + rw [hxV_not_card hxV, hyU_card hyU] at hmain + omega + · intro hnotV hnotU + rcases hx with hxV | hxU <;> rcases hy with hyV | hyU + · exact (hnotV ⟨hxV, hyV⟩).elim + · rw [hxV_card hxV, hyU_card hyU] at hmain + omega + · have hxV' : x ∉ divisionUnion Δ := (hU_sub hxU).2 + have hyU' : y ∉ U := fun h => (hU_sub h).2 hyV + rw [hxV_not_card hxV', hyU_not_card hyU'] at hmain + omega + · exact (hnotU ⟨hxU, hyU⟩).elim + +/-- **Graph Minors VI, (2.4)** (page 118): +"If $\Delta$ is cross-free and $x, y \in W$, then +$$\begin{aligned} +\Delta(x, y) - \Delta^*(x, y) &= 1 &&\text{if } x, y \in V \\ +&= -1 &&\text{if } x, y \in U. \\ +&= 0 &&\text{otherwise.} +\end{aligned}$$" -/ +theorem theorem_2_4_proof : Statement24 := by + intro S _ C U Δ x y hC hΔ hV_fin hV_sub hU hCF hx hy + obtain ⟨φ⟩ := hC + have hinj := injective_oArcMap φ + let U₀ := oArcMap φ ⁻¹' U + let Δ₀ := (preimage (oArcMap φ)) '' Δ + have hU_sub : U ⊆ C \ divisionUnion Δ := isDualPointSet_subset_diff hU + obtain ⟨hU_eq, hΔ_eq, hV₀_fin, hU₀⟩ := oArcMap_division_data φ hV_fin hV_sub hU + have hΔ₀ : IsDivision Δ₀ := by + rw [← isDivision_oArcMap_iff φ, hΔ_eq] + exact hΔ + have hCF₀ : IsCrossFree (univ : Set Circle) Δ₀ := by + rw [← isCrossFree_oArcMap_iff φ, hΔ_eq] + exact hCF + have hW_sub : divisionUnion Δ ∪ U ⊆ C := union_subset hV_sub (hU_sub.trans sdiff_subset) + let x₀ := φ.symm ⟨x, hW_sub hx⟩ + let y₀ := φ.symm ⟨y, hW_sub hy⟩ + have hx₀_eq : oArcMap φ x₀ = x := by simp [oArcMap, x₀] + have hy₀_eq : oArcMap φ y₀ = y := by simp [oArcMap, y₀] + have hx₀_V : x₀ ∈ divisionUnion Δ₀ ↔ x ∈ divisionUnion Δ := by + rw [← hinj.mem_set_image, ← divisionUnion_oArcMap φ, hΔ_eq, hx₀_eq] + have hy₀_V : y₀ ∈ divisionUnion Δ₀ ↔ y ∈ divisionUnion Δ := by + rw [← hinj.mem_set_image, ← divisionUnion_oArcMap φ, hΔ_eq, hy₀_eq] + have hx₀_U : x₀ ∈ U₀ ↔ x ∈ U := by + change oArcMap φ x₀ ∈ U ↔ x ∈ U + rw [hx₀_eq] + have hy₀_U : y₀ ∈ U₀ ↔ y ∈ U := by + change oArcMap φ y₀ ∈ U ↔ y ∈ U + rw [hy₀_eq] + have hx₀ : x₀ ∈ divisionUnion Δ₀ ∪ U₀ := by + rw [mem_union, hx₀_V, hx₀_U] + exact hx + have hy₀ : y₀ ∈ divisionUnion Δ₀ ∪ U₀ := by + rw [mem_union, hy₀_V, hy₀_U] + exact hy + have hcount₁ : divisionCount C Δ x y = divisionCount (univ : Set Circle) Δ₀ x₀ y₀ := by + rw [← hΔ_eq, ← hx₀_eq, ← hy₀_eq, divisionCount_oArcMap] + have hcount₂ : divisionCount C (dualDivision C U Δ) x y = + divisionCount (univ : Set Circle) (dualDivision (univ : Set Circle) U₀ Δ₀) x₀ y₀ := by + rw [← hU_eq, ← hΔ_eq, dualDivision_oArcMap, ← hx₀_eq, ← hy₀_eq, divisionCount_oArcMap] + rw [hcount₁, hcount₂, ← hx₀_V, ← hy₀_V, ← hx₀_U, ← hy₀_U] + exact theorem_2_4_univ U₀ Δ₀ x₀ y₀ hΔ₀ hV₀_fin hU₀ hCF₀ hx₀ hy₀ + +end GraphMinor.GM06 diff --git a/LeanPool/GraphMinor/GM06/Section2Dual.lean b/LeanPool/GraphMinor/GM06/Section2Dual.lean new file mode 100644 index 0000000000..4e478e7337 --- /dev/null +++ b/LeanPool/GraphMinor/GM06/Section2Dual.lean @@ -0,0 +1,1050 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.Defs + +/-! +# Graph Minors VI, Section 2: Dual Divisions and Theorems (2.1)–(2.3) + +This file formalizes the topological transfer between an $O$-arc $C \subseteq S$ and `Circle`, +the segment and dual point set structure on `Circle`, and proves (2.1), (2.2), and (2.3) of +Robertson and Seymour, *Graph Minors. VI. Disjoint paths across a disc*, J. Combin. Theory +Ser. B **41** (1986), 115–138 (pages 117–118). +-/ + +@[expose] public section + +namespace GraphMinor.GM06 + +open Set Function Topology GraphMinor.Surface + +universe u + +/-! ## 1. Transfer between an $O$-Arc $C \subseteq S$ and `Circle` -/ + +/-- The topological embedding $\text{Circle} \to S$ associated with a homeomorphism +$\phi \colon \text{Circle} \simeqₜ C$. -/ +def oArcMap {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) : Circle → S := + Subtype.val ∘ φ + +theorem isEmbedding_oArcMap {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) : + IsEmbedding (oArcMap φ) := + IsEmbedding.subtypeVal.comp φ.isEmbedding + +theorem injective_oArcMap {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) : + Injective (oArcMap φ) := + (isEmbedding_oArcMap φ).injective + +@[simp] +theorem oArcMap_mem {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) (z : Circle) : + oArcMap φ z ∈ C := + (φ z).2 + +@[simp] +theorem range_oArcMap {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) : + range (oArcMap φ) = C := by + ext x + simp only [oArcMap, mem_range, comp_apply] + exact ⟨fun ⟨z, hz⟩ => hz ▸ (φ z).2, fun hx => ⟨φ.symm ⟨x, hx⟩, by simp⟩⟩ + +theorem diff_image_oArcMap {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) + (s : Set Circle) : C \ (oArcMap φ '' s) = oArcMap φ '' sᶜ := by + have hrange := range_oArcMap φ + rw [← image_univ] at hrange + rw [compl_eq_univ_sdiff, image_sdiff (injective_oArcMap φ), hrange] + +/-- On `Circle` with $C = \text{univ}$, `CrossesOn univ` agrees with +`circleCrosses circleStdCoord`. -/ +theorem crossesOn_univ_iff_circleStdCoord {a c b d : Circle} : + CrossesOn (univ : Set Circle) a c b d ↔ circleCrosses circleStdCoord a c b d := by + simp only [CrossesOn, Surface.PairsCrossOn, mem_univ, true_and, ← compl_eq_univ_sdiff] + constructor + · rintro ⟨hac, hbd, hab, had, hcb, hcd, hcc⟩ + exact (connectedComponentIn_compl_pair_ne_iff_circleCrosses hac hbd hab had hcb hcd).mp hcc + · intro h + exact ⟨h.1, h.2.1, h.2.2.1, h.2.2.2.1, h.2.2.2.2.1, h.2.2.2.2.2.1, + (connectedComponentIn_compl_pair_ne_iff_circleCrosses + h.1 h.2.1 h.2.2.1 h.2.2.2.1 h.2.2.2.2.1 h.2.2.2.2.2.1).mpr h⟩ + +/-- On `Circle` with $C = \text{univ}$, `CrossesOn univ` agrees with +`circleCrosses (circleCoordFrom x)` for any basepoint $x \in \text{Circle}$. -/ +theorem crossesOn_univ_iff_circleCoordFrom (x : Circle) {a c b d : Circle} : + CrossesOn (univ : Set Circle) a c b d ↔ circleCrosses (circleCoordFrom x) a c b d := by + rw [crossesOn_univ_iff_circleStdCoord, circleCrosses_circleCoordFrom_iff] + +/-- Characterization of `CrossesOn univ` on `Circle` directly in terms of `a.angleDiff`. -/ +theorem crossesOn_univ_iff_angleDiff {a c b d : Circle} : + CrossesOn (univ : Set Circle) a c b d ↔ + a ≠ c ∧ b ≠ d ∧ a ≠ b ∧ a ≠ d ∧ c ≠ b ∧ c ≠ d ∧ + (a.angleDiff b < a.angleDiff c ↔ ¬ a.angleDiff d < a.angleDiff c) := by + rw [crossesOn_univ_iff_circleStdCoord, circleCrosses_circleStdCoord_iff_angleDiff] + +/-- `CrossesOn C` is preserved and reflected by `oArcMap φ`. -/ +theorem crossesOn_oArcMap_iff {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) + {a c b d : Circle} : + CrossesOn C (oArcMap φ a) (oArcMap φ c) (oArcMap φ b) (oArcMap φ d) ↔ + CrossesOn (univ : Set Circle) a c b d := by + have hinj := injective_oArcMap φ + have hemb := isEmbedding_oArcMap φ + have hpair : C \ {oArcMap φ a, oArcMap φ c} = oArcMap φ '' ({a, c} : Set Circle)ᶜ := by + rw [← diff_image_oArcMap φ] + simp + simp only [CrossesOn, Surface.PairsCrossOn, oArcMap_mem, mem_univ, true_and, hinj.ne_iff, + ← compl_eq_univ_sdiff] + refine and_congr_right fun hac => and_congr_right fun hbd => + and_congr_right fun hab => and_congr_right fun had => + and_congr_right fun hcb => and_congr_right fun hcd => ?_ + have hb_mem : b ∈ ({a, c} : Set Circle)ᶜ := by simp [hab.symm, hcb.symm] + have hd_mem : d ∈ ({a, c} : Set Circle)ᶜ := by simp [had.symm, hcd.symm] + rw [hpair, ← isEmbedding_image_connectedComponentIn hemb hb_mem, + ← isEmbedding_image_connectedComponentIn hemb hd_mem, ne_eq, ne_eq, image_eq_image hinj] + +theorem CrossesOn.symm_left {S : Type u} [TopologicalSpace S] {C : Set S} {a c b d : S} + (h : CrossesOn C a c b d) : CrossesOn C c a b d := by + rcases h with ⟨ha, hb, hc, hd, hac, hbd, hab, had, hcb, hcd, hcc⟩ + rw [pair_comm] at hcc + exact ⟨hc, hb, ha, hd, hac.symm, hbd, hcb, hcd, hab, had, hcc⟩ + +theorem CrossesOn.symm_right {S : Type u} [TopologicalSpace S] {C : Set S} {a c b d : S} + (h : CrossesOn C a c b d) : CrossesOn C a c d b := by + rcases h with ⟨ha, hb, hc, hd, hac, hbd, hab, had, hcb, hcd, hcc⟩ + exact ⟨ha, hd, hc, hb, hac, hbd.symm, had, hab, hcd, hcb, hcc.symm⟩ + +theorem CrossesOn.comm {S : Type u} [TopologicalSpace S] {C : Set S} (hC : IsOArc C) + {a c b d : S} (h : CrossesOn C a c b d) : CrossesOn C b d a c := by + obtain ⟨φ⟩ := hC + have ha : a ∈ C := h.1 + have hb : b ∈ C := h.2.1 + have hc : c ∈ C := h.2.2.1 + have hd : d ∈ C := h.2.2.2.1 + let a' := φ.symm ⟨a, ha⟩ + let b' := φ.symm ⟨b, hb⟩ + let c' := φ.symm ⟨c, hc⟩ + let d' := φ.symm ⟨d, hd⟩ + have ha' : oArcMap φ a' = a := by simp [oArcMap, a'] + have hb' : oArcMap φ b' = b := by simp [oArcMap, b'] + have hc' : oArcMap φ c' = c := by simp [oArcMap, c'] + have hd' : oArcMap φ d' = d := by simp [oArcMap, d'] + rw [← ha', ← hb', ← hc', ← hd'] at h ⊢ + rw [crossesOn_oArcMap_iff, crossesOn_univ_iff_circleStdCoord] at h ⊢ + exact (circleCrosses_comm circleStdCoord a' c' b' d').mp h + +theorem not_crossesOn_trans {S : Type u} [TopologicalSpace S] {C : Set S} (hC : IsOArc C) + {a c b₁ b₂ b₃ : S} (ha : a ∈ C) (hc : c ∈ C) + (hb₁ : b₁ ∈ C) (hb₂ : b₂ ∈ C) (hb₃ : b₃ ∈ C) + (ha₂ : a ≠ b₂) (hc₂ : c ≠ b₂) + (h12 : ¬ CrossesOn C a c b₁ b₂) (h23 : ¬ CrossesOn C a c b₂ b₃) : + ¬ CrossesOn C a c b₁ b₃ := by + obtain ⟨φ⟩ := hC + let a' := φ.symm ⟨a, ha⟩ + let c' := φ.symm ⟨c, hc⟩ + let b₁' := φ.symm ⟨b₁, hb₁⟩ + let b₂' := φ.symm ⟨b₂, hb₂⟩ + let b₃' := φ.symm ⟨b₃, hb₃⟩ + have ha' : oArcMap φ a' = a := by simp [oArcMap, a'] + have hc' : oArcMap φ c' = c := by simp [oArcMap, c'] + have hb₁' : oArcMap φ b₁' = b₁ := by simp [oArcMap, b₁'] + have hb₂' : oArcMap φ b₂' = b₂ := by simp [oArcMap, b₂'] + have hb₃' : oArcMap φ b₃' = b₃ := by simp [oArcMap, b₃'] + rw [← ha', ← hc', ← hb₁', ← hb₂'] at h12 + rw [← ha', ← hc', ← hb₂', ← hb₃'] at h23 + rw [← ha', ← hc', ← hb₁', ← hb₃'] + rw [crossesOn_oArcMap_iff, crossesOn_univ_iff_circleStdCoord] at h12 h23 ⊢ + exact not_circleCrosses_trans circleStdCoord + (fun h => ha₂ (ha' ▸ hb₂' ▸ congrArg (oArcMap φ) h)) + (fun h => hc₂ (hc' ▸ hb₂' ▸ congrArg (oArcMap φ) h)) + h12 h23 + +theorem crossesOn_four_point {S : Type u} [TopologicalSpace S] {C : Set S} (hC : IsOArc C) + {u₁ u₂ u₃ u₄ v₁ v₂ : S} (hv₁ : v₁ ∈ C) (hv₂ : v₂ ∈ C) + (hv₁u₃ : v₁ ≠ u₃) (hv₂u₃ : v₂ ≠ u₃) + (hv₁u₄ : v₁ ≠ u₄) (hv₂u₄ : v₂ ≠ u₄) + (hu : CrossesOn C u₁ u₃ u₂ u₄) (hv : CrossesOn C v₁ v₂ u₁ u₂) : + CrossesOn C v₁ v₂ u₁ u₃ ∨ CrossesOn C v₁ v₂ u₂ u₄ := by + obtain ⟨φ⟩ := hC + have hu₁ : u₁ ∈ C := hu.1 + have hu₂ : u₂ ∈ C := hu.2.1 + have hu₃ : u₃ ∈ C := hu.2.2.1 + have hu₄ : u₄ ∈ C := hu.2.2.2.1 + let u₁' := φ.symm ⟨u₁, hu₁⟩ + let u₂' := φ.symm ⟨u₂, hu₂⟩ + let u₃' := φ.symm ⟨u₃, hu₃⟩ + let u₄' := φ.symm ⟨u₄, hu₄⟩ + let v₁' := φ.symm ⟨v₁, hv₁⟩ + let v₂' := φ.symm ⟨v₂, hv₂⟩ + have hu₁' : oArcMap φ u₁' = u₁ := by simp [oArcMap, u₁'] + have hu₂' : oArcMap φ u₂' = u₂ := by simp [oArcMap, u₂'] + have hu₃' : oArcMap φ u₃' = u₃ := by simp [oArcMap, u₃'] + have hu₄' : oArcMap φ u₄' = u₄ := by simp [oArcMap, u₄'] + have hv₁' : oArcMap φ v₁' = v₁ := by simp [oArcMap, v₁'] + have hv₂' : oArcMap φ v₂' = v₂ := by simp [oArcMap, v₂'] + rw [← hu₁', ← hu₂', ← hu₃', ← hu₄', crossesOn_oArcMap_iff, + crossesOn_univ_iff_circleStdCoord] at hu + rw [← hv₁', ← hv₂', ← hu₁', ← hu₂', crossesOn_oArcMap_iff, + crossesOn_univ_iff_circleStdCoord] at hv + rw [← hv₁', ← hv₂', ← hu₁', ← hu₃', ← hu₂', ← hu₄', + crossesOn_oArcMap_iff, crossesOn_oArcMap_iff, + crossesOn_univ_iff_circleStdCoord, crossesOn_univ_iff_circleStdCoord] + exact four_point_circleCrosses circleStdCoord hu hv + (fun h => hv₁u₃ (hv₁' ▸ hu₃' ▸ congrArg (oArcMap φ) h)) + (fun h => hv₂u₃ (hv₂' ▸ hu₃' ▸ congrArg (oArcMap φ) h)) + (fun h => hv₁u₄ (hv₁' ▸ hu₄' ▸ congrArg (oArcMap φ) h)) + (fun h => hv₂u₄ (hv₂' ▸ hu₄' ▸ congrArg (oArcMap φ) h)) + +/-! ## 2. Equivalence Properties of `dualEquivRel` and Proof of (2.1) -/ + +theorem dualEquivRel_refl {S : Type u} [TopologicalSpace S] (C : Set S) (Δ : Set (Set S)) + (u : S) : dualEquivRel C Δ u u := by + rintro ⟨δ, _, v, _, v', _, hcross⟩ + exact hcross.2.2.2.2.2.1 rfl + +theorem dualEquivRel_symm {S : Type u} [TopologicalSpace S] {C : Set S} {Δ : Set (Set S)} + {u u' : S} (h : dualEquivRel C Δ u u') : dualEquivRel C Δ u' u := by + rintro ⟨δ, hδ, v, hv, v', hv', hcross⟩ + exact h ⟨δ, hδ, v, hv, v', hv', hcross.symm_right⟩ + +theorem dualEquivRel_trans {S : Type u} [TopologicalSpace S] {C U : Set S} {Δ : Set (Set S)} + (hC : IsOArc C) (hV_sub : divisionUnion Δ ⊆ C) (hU_sub : U ⊆ C \ divisionUnion Δ) + {u₁ u₂ u₃ : S} (hu₁ : u₁ ∈ U) (hu₂ : u₂ ∈ U) (hu₃ : u₃ ∈ U) + (h12 : dualEquivRel C Δ u₁ u₂) (h23 : dualEquivRel C Δ u₂ u₃) : + dualEquivRel C Δ u₁ u₃ := by + rintro ⟨δ, hδ, v, hv, v', hv', hcross⟩ + have hv_mem : v ∈ divisionUnion Δ := ⟨δ, hδ, hv⟩ + have hv'_mem : v' ∈ divisionUnion Δ := ⟨δ, hδ, hv'⟩ + have h12' : ¬ CrossesOn C v v' u₁ u₂ := fun h => h12 ⟨δ, hδ, v, hv, v', hv', h⟩ + have h23' : ¬ CrossesOn C v v' u₂ u₃ := fun h => h23 ⟨δ, hδ, v, hv, v', hv', h⟩ + exact not_crossesOn_trans hC (hV_sub hv_mem) (hV_sub hv'_mem) + (hU_sub hu₁).1 (hU_sub hu₂).1 (hU_sub hu₃).1 + (fun h => (hU_sub hu₂).2 (h ▸ hv_mem)) + (fun h => (hU_sub hu₂).2 (h ▸ hv'_mem)) + h12' h23' hcross + +theorem isDualPointSet_subset_diff {S : Type u} [TopologicalSpace S] {C V U : Set S} + (hU : IsDualPointSet C V U) : U ⊆ C \ V := by + rcases V.eq_empty_or_nonempty with rfl | hne + · rw [hU.1 rfl] + exact empty_subset _ + · exact (hU.2 hne).1 + +theorem dualDivision_mem_eq_of_mem {S : Type u} [TopologicalSpace S] {C U : Set S} + {Δ : Set (Set S)} (hC : IsOArc C) (hV_sub : divisionUnion Δ ⊆ C) + (hU_sub : U ⊆ C \ divisionUnion Δ) {δ_star : Set S} (hδ : δ_star ∈ dualDivision C U Δ) + {u : S} (hu : u ∈ δ_star) : + δ_star = {u' ∈ U | dualEquivRel C Δ u u'} := by + rcases hδ with ⟨u₀, hu₀, rfl⟩ + simp only [mem_ofPred_eq] at hu + ext u' + simp only [mem_ofPred_eq] + refine and_congr_right fun hu' => ⟨?_, ?_⟩ + · intro h₀ + exact dualEquivRel_trans hC hV_sub hU_sub hu.1 hu₀ hu' (dualEquivRel_symm hu.2) h₀ + · intro h₁ + exact dualEquivRel_trans hC hV_sub hU_sub hu₀ hu.1 hu' hu.2 h₁ + +/-- **Graph Minors VI, (2.1)** (page 117): +"$\Delta^*$ is cross-free, for any $\Delta$." -/ +theorem theorem_2_1_proof : Statement21 := by + intro S _ C U Δ hC _hΔ hV_sub hU + have hU_sub : U ⊆ C \ divisionUnion Δ := isDualPointSet_subset_diff hU + rintro ⟨δ₁, hδ₁, δ₂, hδ₂, hne, u₁, hu₁, u₃, hu₃, u₂, hu₂, u₄, hu₄, hcross⟩ + have hδ₁_eq := dualDivision_mem_eq_of_mem hC hV_sub hU_sub hδ₁ hu₁ + have hδ₂_eq := dualDivision_mem_eq_of_mem hC hV_sub hU_sub hδ₂ hu₂ + have hu₁_U : u₁ ∈ U := by rw [hδ₁_eq] at hu₁; exact hu₁.1 + have hu₃_rel : dualEquivRel C Δ u₁ u₃ := by rw [hδ₁_eq] at hu₃; exact hu₃.2 + have hu₂_U : u₂ ∈ U := by rw [hδ₂_eq] at hu₂; exact hu₂.1 + have hu₄_rel : dualEquivRel C Δ u₂ u₄ := by rw [hδ₂_eq] at hu₄; exact hu₄.2 + have hu₃_U : u₃ ∈ U := by rw [hδ₁_eq] at hu₃; exact hu₃.1 + have hu₄_U : u₄ ∈ U := by rw [hδ₂_eq] at hu₄; exact hu₄.1 + have hnot_rel : ¬ dualEquivRel C Δ u₁ u₂ := by + intro h12 + have hu₂_in_δ₁ : u₂ ∈ δ₁ := by + rw [hδ₁_eq] + exact ⟨hu₂_U, h12⟩ + exact hne ((dualDivision_mem_eq_of_mem hC hV_sub hU_sub hδ₁ hu₂_in_δ₁).trans hδ₂_eq.symm) + unfold dualEquivRel at hnot_rel + push Not at hnot_rel + obtain ⟨δ, hδ, v₁, hv₁, v₂, hv₂, hv_cross⟩ := hnot_rel + have hv₁_V : v₁ ∈ divisionUnion Δ := ⟨δ, hδ, hv₁⟩ + have hv₂_V : v₂ ∈ divisionUnion Δ := ⟨δ, hδ, hv₂⟩ + rcases crossesOn_four_point (u₁ := u₁) (u₂ := u₂) (u₃ := u₃) (u₄ := u₄) (v₁ := v₁) (v₂ := v₂) + hC (hV_sub hv₁_V) (hV_sub hv₂_V) + (fun h => (hU_sub hu₃_U).2 (h ▸ hv₁_V)) + (fun h => (hU_sub hu₃_U).2 (h ▸ hv₂_V)) + (fun h => (hU_sub hu₄_U).2 (h ▸ hv₁_V)) + (fun h => (hU_sub hu₄_U).2 (h ▸ hv₂_V)) + hcross hv_cross with h13 | h24 + · exact hu₃_rel ⟨δ, hδ, v₁, hv₁, v₂, hv₂, h13⟩ + · exact hu₄_rel ⟨δ, hδ, v₁, hv₁, v₂, hv₂, h24⟩ + +/-! ## 3. Segments and Dual Point Sets on `Circle` and on $O$-Arcs -/ + +theorem nextSegment_mem_segmentsOf_univ {V : Set Circle} (hV : V.Finite) {v : Circle} + (hv : v ∈ V) : nextSegment V v ∈ segmentsOf (univ : Set Circle) V := by + obtain ⟨z, hz⟩ := nextSegment_nonempty hV hv + have hz_compl : z ∈ (univ : Set Circle) \ V := ⟨trivial, nextSegment_subset_compl hz⟩ + refine ⟨⟨z, hz_compl, ?_⟩, nonempty_homeomorph_Ioo_nextSegment hV hv⟩ + rw [← compl_eq_univ_sdiff] + exact connectedComponentIn_compl_eq_nextSegment hV hv hz + +theorem prevSegment_mem_segmentsOf_univ {V : Set Circle} (hV : V.Finite) {v : Circle} + (hv : v ∈ V) : prevSegment V v ∈ segmentsOf (univ : Set Circle) V := by + obtain ⟨v_prev, hv_prev, heq⟩ := exists_nextSegment_eq_prevSegment hV hv + rw [heq] + exact nextSegment_mem_segmentsOf_univ hV hv_prev + +theorem mem_segmentsOf_univ_iff {V : Set Circle} (hV : V.Finite) (hne : V.Nonempty) + {seg : Set Circle} : + seg ∈ segmentsOf (univ : Set Circle) V ↔ ∃ v ∈ V, seg = nextSegment V v := by + constructor + · rintro ⟨⟨z, hz, rfl⟩, _⟩ + rw [← compl_eq_univ_sdiff] at hz ⊢ + obtain ⟨v, ⟨hv, hzv⟩, _⟩ := exists_unique_nextSegment_of_mem_compl hV hne hz + exact ⟨v, hv, connectedComponentIn_compl_eq_nextSegment hV hv hzv⟩ + · rintro ⟨v, hv, rfl⟩ + exact nextSegment_mem_segmentsOf_univ hV hv + +theorem exists_unique_mem_nextSegment_of_isDualPointSet {V U : Set Circle} (hV : V.Finite) + (hU : IsDualPointSet (univ : Set Circle) V U) {v : Circle} (hv : v ∈ V) : + ∃ u, U ∩ nextSegment V v = {u} := by + have hne : V.Nonempty := ⟨v, hv⟩ + have hseg := nextSegment_mem_segmentsOf_univ hV hv + exact ncard_eq_one.mp ((hU.2 hne).2 _ hseg) + +theorem exists_unique_mem_prevSegment_of_isDualPointSet {V U : Set Circle} (hV : V.Finite) + (hU : IsDualPointSet (univ : Set Circle) V U) {v : Circle} (hv : v ∈ V) : + ∃ u, U ∩ prevSegment V v = {u} := by + have hne : V.Nonempty := ⟨v, hv⟩ + have hseg := prevSegment_mem_segmentsOf_univ hV hv + exact ncard_eq_one.mp ((hU.2 hne).2 _ hseg) + +theorem finite_of_isDualPointSet_univ {V U : Set Circle} (hV : V.Finite) + (hU : IsDualPointSet (univ : Set Circle) V U) : U.Finite := by + rcases V.eq_empty_or_nonempty with rfl | hne + · rw [hU.1 rfl] + exact finite_empty + · have hU_sub : U ⊆ ⋃ v ∈ V, (U ∩ nextSegment V v) := by + intro u hu + have hu_compl : u ∈ Vᶜ := ((hU.2 hne).1 hu).2 + obtain ⟨v, ⟨hv, huv⟩, _⟩ := exists_unique_nextSegment_of_mem_compl hV hne hu_compl + exact mem_biUnion hv ⟨hu, huv⟩ + refine (hV.biUnion fun v hv => ?_).subset hU_sub + obtain ⟨u, hu⟩ := exists_unique_mem_nextSegment_of_isDualPointSet hV hU hv + rw [hu] + exact finite_singleton u + +theorem nextSegment_dual_properties {V U : Set Circle} + (hU : IsDualPointSet (univ : Set Circle) V U) {v u : Circle} (hv : v ∈ V) + (hu : U ∩ nextSegment V v = {u}) : + u ∈ U ∧ u ≠ v ∧ + (∀ w ∈ V \ {v}, v.angleDiff u < v.angleDiff w) ∧ + (∀ u' ∈ U \ {u}, ∃ w ∈ V \ {v}, v.angleDiff u < v.angleDiff w ∧ v.angleDiff w < v.angleDiff u') + := by + have hu_mem : u ∈ U ∩ nextSegment V v := by rw [hu]; exact mem_singleton u + have huU : u ∈ U := hu_mem.1 + have hu_seg : u ∈ nextSegment V v := hu_mem.2 + have hU_compl : U ⊆ Vᶜ := fun x hx => ((hU.2 ⟨v, hv⟩).1 hx).2 + refine ⟨huU, hu_seg.1, hu_seg.2, fun u' hu' => ?_⟩ + have hu'_not : u' ∉ nextSegment V v := by + intro h + have hmem : u' ∈ U ∩ nextSegment V v := ⟨hu'.1, h⟩ + rw [hu, mem_singleton_iff] at hmem + exact hu'.2 hmem + have hu'_ne_v : u' ≠ v := fun h => hU_compl hu'.1 (h ▸ hv) + simp only [nextSegment, mem_ofPred_eq, not_and, not_forall, not_lt] at hu'_not + obtain ⟨w, hw, hle⟩ := hu'_not hu'_ne_v + have hwu' : w ≠ u' := fun h => hU_compl hu'.1 (h ▸ hw.1) + have hlt : v.angleDiff w < v.angleDiff u' := + lt_of_le_of_ne hle ((circleCoordFrom v).injective.ne hwu') + exact ⟨w, hw, hu_seg.2 w hw, hlt⟩ + +theorem prevSegment_dual_properties {V U : Set Circle} + (hU : IsDualPointSet (univ : Set Circle) V U) {v u : Circle} (hv : v ∈ V) + (hu : U ∩ prevSegment V v = {u}) : + u ∈ U ∧ u ≠ v ∧ + (∀ w ∈ V \ {v}, u.angleDiff v < w.angleDiff v) ∧ + (∀ u' ∈ U \ {u}, ∃ w ∈ V \ {v}, u.angleDiff v < w.angleDiff v ∧ w.angleDiff v < u'.angleDiff v) + := by + have hu_mem : u ∈ U ∩ prevSegment V v := by rw [hu]; exact mem_singleton u + have huU : u ∈ U := hu_mem.1 + have hu_seg : u ∈ prevSegment V v := hu_mem.2 + have hU_compl : U ⊆ Vᶜ := fun x hx => ((hU.2 ⟨v, hv⟩).1 hx).2 + refine ⟨huU, hu_seg.1, hu_seg.2, fun u' hu' => ?_⟩ + have hu'_not : u' ∉ prevSegment V v := by + intro h + have hmem : u' ∈ U ∩ prevSegment V v := ⟨hu'.1, h⟩ + rw [hu, mem_singleton_iff] at hmem + exact hu'.2 hmem + have hu'_ne_v : u' ≠ v := fun h => hU_compl hu'.1 (h ▸ hv) + simp only [prevSegment, mem_ofPred_eq, not_and, not_forall, not_lt] at hu'_not + obtain ⟨w, hw, hle⟩ := hu'_not hu'_ne_v + have hwu' : w ≠ u' := fun h => hU_compl hu'.1 (h ▸ hw.1) + have hsum_w := Circle.angleDiff_add_angleDiff hw.2 + have hsum_u' := Circle.angleDiff_add_angleDiff hu'_ne_v + have hvw_ne : v.angleDiff w ≠ v.angleDiff u' := (circleCoordFrom v).injective.ne hwu' + have hlt : w.angleDiff v < u'.angleDiff v := by grind [-Circle.angleDiff] + exact ⟨w, hw, hu_seg.2 w hw, hlt⟩ + +/-- Symmetry of `IsDualPointSet` on `Circle`: if $U$ is a dual point set for $(C, V)$ with $V$ +finite, then $V$ is a dual point set for $(C, U)$. -/ +theorem isDualPointSet_univ_symm {V U : Set Circle} (hV : V.Finite) + (hU : IsDualPointSet (univ : Set Circle) V U) : + IsDualPointSet (univ : Set Circle) U V := by + have hU_fin : U.Finite := finite_of_isDualPointSet_univ hV hU + refine ⟨?_, ?_⟩ + · intro hU_emp + by_contra hV_ne + obtain ⟨v, hv⟩ := nonempty_iff_ne_empty.mpr hV_ne + obtain ⟨u, hu⟩ := exists_unique_mem_nextSegment_of_isDualPointSet hV hU hv + rw [hU_emp, empty_inter] at hu + exact singleton_ne_empty u hu.symm + · intro hU_ne + have hV_ne : V.Nonempty := by + by_contra hV_emp + rw [not_nonempty_iff_eq_empty] at hV_emp + exact hU_ne.ne_empty (hU.1 hV_emp) + have hU_sub : U ⊆ (univ : Set Circle) \ V := (hU.2 hV_ne).1 + have hV_sub : V ⊆ (univ : Set Circle) \ U := fun v hv => ⟨trivial, fun hu => (hU_sub hu).2 hv⟩ + refine ⟨hV_sub, fun seg hseg => ?_⟩ + rw [mem_segmentsOf_univ_iff hU_fin hU_ne] at hseg + obtain ⟨u, hu, rfl⟩ := hseg + obtain ⟨v₀, ⟨hv₀, huv₀⟩, _⟩ := exists_unique_nextSegment_of_mem_compl hV hV_ne (hU_sub hu).2 + obtain ⟨u₀, hu₀_eq⟩ := exists_unique_mem_nextSegment_of_isDualPointSet hV hU hv₀ + have hu₀ : u = u₀ := by + have hmem : u ∈ U ∩ nextSegment V v₀ := ⟨hu, huv₀⟩ + rwa [hu₀_eq, mem_singleton_iff] at hmem + rw [← hu₀] at hu₀_eq + obtain ⟨_, huv₀_ne, hvw, hu'w⟩ := nextSegment_dual_properties hU hv₀ hu₀_eq + obtain ⟨v_next, hv_next, hmin⟩ := exists_min_on_finite hV hV_ne (Circle.angleDiff u) + have hv_next_in : v_next ∈ V ∩ nextSegment U u := by + refine ⟨hv_next, fun h => (hV_sub hv_next).2 (h ▸ hu), fun u' hu' => ?_⟩ + obtain ⟨w, hw, hlt1, hlt2⟩ := hu'w u' hu' + have hmin_w : u.angleDiff v_next ≤ u.angleDiff w := hmin w hw.1 + have hv₀u_pos := Circle.angleDiff_pos huv₀_ne.symm + have heq_w := angleDiff_eq_of_angleDiff (x := v₀) (a := u) (b := w) + have heq_u' := angleDiff_eq_of_angleDiff (x := v₀) (a := u) (b := u') + grind [-Circle.angleDiff] + rw [ncard_eq_one] + refine ⟨v_next, Subset.antisymm ?_ (singleton_subset_iff.mpr hv_next_in)⟩ + rintro v'' ⟨hv'', hv''_seg⟩ + rw [mem_singleton_iff] + by_contra hne'' + have hmin'' : u.angleDiff v_next ≤ u.angleDiff v'' := hmin v'' hv'' + have hlt'' : u.angleDiff v_next < u.angleDiff v'' := + lt_of_le_of_ne hmin'' ((circleCoordFrom u).injective.ne (Ne.symm hne'')) + obtain ⟨u'', hu''_eq⟩ := exists_unique_mem_nextSegment_of_isDualPointSet hV hU hv_next + obtain ⟨hu''U, hu''_ne, hvw'', _⟩ := nextSegment_dual_properties hU hv_next hu''_eq + have hlt_v'' : v_next.angleDiff u'' < v_next.angleDiff v'' := hvw'' v'' ⟨hv'', hne''⟩ + have huv_pos := Circle.angleDiff_pos (Ne.symm hv_next_in.2.1) + have hvp_u''_pos := Circle.angleDiff_pos hu''_ne.symm + have huv''_lt := Circle.angleDiff_lt_two_pi u v'' + have heq_v'' := angleDiff_eq_of_angleDiff (x := u) (a := v_next) (b := v'') + have heq_u'' := angleDiff_eq_of_angleDiff (x := u) (a := v_next) (b := u'') + have hu''_ne_u : u'' ≠ u := by + rintro rfl + have h0 : u''.angleDiff u'' = 0 := circleCoordFrom_self u'' + split_ifs at heq_v'' heq_u'' <;> linarith + have hu''_lt_v'' : u.angleDiff u'' < u.angleDiff v'' := by + split_ifs at heq_v'' heq_u'' <;> linarith + have hcontra := hv''_seg.2 u'' ⟨hu''U, hu''_ne_u⟩ + linarith + +theorem isOArc_univ_circle : IsOArc (univ : Set Circle) := + ⟨(Homeomorph.Set.univ Circle).symm⟩ + +theorem isSegmentOf_oArcMap_iff {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) + {V seg : Set Circle} : + IsSegmentOf C (oArcMap φ '' V) (oArcMap φ '' seg) ↔ + IsSegmentOf (univ : Set Circle) V seg := by + have hinj := injective_oArcMap φ + have hemb := isEmbedding_oArcMap φ + simp only [IsSegmentOf, componentsIn, diff_image_oArcMap, ← compl_eq_univ_sdiff] + refine and_congr ?_ ?_ + · constructor + · rintro ⟨x, ⟨z, hz, rfl⟩, heq⟩ + dsimp only at heq + rw [← isEmbedding_image_connectedComponentIn hemb hz, image_eq_image hinj] at heq + exact ⟨z, hz, heq⟩ + · rintro ⟨z, hz, rfl⟩ + exact ⟨oArcMap φ z, mem_image_of_mem _ hz, + (isEmbedding_image_connectedComponentIn hemb hz).symm⟩ + · constructor + · rintro ⟨e⟩ + exact ⟨e.trans (hemb.homeomorphImage seg).symm⟩ + · rintro ⟨e⟩ + exact ⟨e.trans (hemb.homeomorphImage seg)⟩ + +theorem segmentsOf_oArcMap {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) + (V : Set Circle) : + segmentsOf C (oArcMap φ '' V) = (image (oArcMap φ)) '' segmentsOf (univ : Set Circle) V := by + ext s + simp only [segmentsOf, mem_ofPred_eq, mem_image] + constructor + · intro hs + obtain ⟨x, hx, rfl⟩ := hs.1 + have hxC : x ∈ C := hx.1 + have hsub : connectedComponentIn (C \ (oArcMap φ '' V)) x ⊆ range (oArcMap φ) := by + rw [range_oArcMap] + exact (connectedComponentIn_subset _ _).trans sdiff_subset + have heq := image_preimage_eq_of_subset hsub + refine ⟨oArcMap φ ⁻¹' connectedComponentIn (C \ (oArcMap φ '' V)) x, ?_, heq⟩ + rwa [← isSegmentOf_oArcMap_iff φ, heq] + · rintro ⟨seg, hseg, rfl⟩ + exact (isSegmentOf_oArcMap_iff φ).mpr hseg + +theorem isDualPointSet_oArcMap_iff {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) + {V U : Set Circle} : + IsDualPointSet C (oArcMap φ '' V) (oArcMap φ '' U) ↔ + IsDualPointSet (univ : Set Circle) V U := by + have hinj := injective_oArcMap φ + simp only [IsDualPointSet, image_eq_empty, image_nonempty, diff_image_oArcMap, + ← compl_eq_univ_sdiff, image_subset_image_iff hinj, segmentsOf_oArcMap] + refine and_congr Iff.rfl (imp_congr_right fun _ => and_congr_right fun _ => ?_) + constructor + · intro h seg hseg + have h1 := h (oArcMap φ '' seg) (mem_image_of_mem _ hseg) + rwa [← image_inter hinj, ncard_image_of_injective _ hinj] at h1 + · rintro h _ ⟨seg, hseg, rfl⟩ + rw [← image_inter hinj, ncard_image_of_injective _ hinj] + exact h seg hseg + +theorem dualEquivRel_oArcMap_iff {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) + {Δ : Set (Set Circle)} {u u' : Circle} : + dualEquivRel C ((image (oArcMap φ)) '' Δ) (oArcMap φ u) (oArcMap φ u') ↔ + dualEquivRel (univ : Set Circle) Δ u u' := by + simp only [dualEquivRel, mem_image, exists_exists_and_eq_and, crossesOn_oArcMap_iff] + +theorem dualDivision_oArcMap {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) + (U : Set Circle) (Δ : Set (Set Circle)) : + dualDivision C (oArcMap φ '' U) ((image (oArcMap φ)) '' Δ) = + (image (oArcMap φ)) '' dualDivision (univ : Set Circle) U Δ := by + rw [dualDivision, dualDivision, image_image, image_image] + congr 1 + ext u x + simp only [mem_ofPred_eq, mem_image] + constructor + · rintro ⟨⟨z, hz, rfl⟩, hrel⟩ + exact ⟨z, ⟨hz, (dualEquivRel_oArcMap_iff φ).mp hrel⟩, rfl⟩ + · rintro ⟨z, ⟨hz, hrel⟩, rfl⟩ + exact ⟨⟨z, hz, rfl⟩, (dualEquivRel_oArcMap_iff φ).mpr hrel⟩ + +theorem divisionUnion_oArcMap {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) + (Δ : Set (Set Circle)) : + divisionUnion ((image (oArcMap φ)) '' Δ) = oArcMap φ '' divisionUnion Δ := by + ext x + simp only [divisionUnion, mem_sUnion, mem_image, exists_exists_and_eq_and] + tauto + +theorem doubleDualDivision_oArcMap {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) + (U : Set Circle) (Δ : Set (Set Circle)) : + doubleDualDivision C (oArcMap φ '' U) ((image (oArcMap φ)) '' Δ) = + (image (oArcMap φ)) '' doubleDualDivision (univ : Set Circle) U Δ := by + simp only [doubleDualDivision, divisionUnion_oArcMap, dualDivision_oArcMap] + +theorem isCrossFree_oArcMap_iff {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) + {Δ : Set (Set Circle)} : + IsCrossFree C ((image (oArcMap φ)) '' Δ) ↔ IsCrossFree (univ : Set Circle) Δ := by + have hinj := injective_oArcMap φ + simp only [IsCrossFree, mem_image, exists_exists_and_eq_and, ne_eq, image_eq_image hinj, + crossesOn_oArcMap_iff] + +theorem isDivision_oArcMap_iff {S : Type u} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) + {Δ : Set (Set Circle)} : + IsDivision ((image (oArcMap φ)) '' Δ) ↔ IsDivision Δ := by + have hinj := injective_oArcMap φ + constructor + · rintro ⟨hfin, hne_fin, hdisj⟩ + refine ⟨hfin.of_finite_image (image_injective.mpr hinj).injOn, ?_, ?_⟩ + · intro δ hδ + exact (hne_fin _ (mem_image_of_mem _ hδ)).of_image + · intro δ₁ hδ₁ δ₂ hδ₂ hne + have h := hdisj (mem_image_of_mem _ hδ₁) (mem_image_of_mem _ hδ₂) + (fun heq => hne ((image_eq_image hinj).mp heq)) + exact (disjoint_image_iff hinj).mp h + · rintro ⟨hfin, hne_fin, hdisj⟩ + refine ⟨hfin.image _, ?_, ?_⟩ + · rintro _ ⟨δ, hδ, rfl⟩ + exact (hne_fin δ hδ).image _ + · rintro _ ⟨δ₁, hδ₁, rfl⟩ _ ⟨δ₂, hδ₂, rfl⟩ hne + have h := hdisj hδ₁ hδ₂ (fun heq => hne (congrArg _ heq)) + exact (disjoint_image_iff hinj).mpr h + +theorem divisionUnion_dualDivision {S : Type u} [TopologicalSpace S] (C U : Set S) + (Δ : Set (Set S)) : divisionUnion (dualDivision C U Δ) = U := by + ext x + simp only [divisionUnion, dualDivision, mem_sUnion, mem_image, exists_exists_and_eq_and, + mem_ofPred_eq] + exact ⟨fun ⟨_, _, hx, _⟩ => hx, fun hx => ⟨x, hx, hx, dualEquivRel_refl C Δ x⟩⟩ + +theorem isDivision_dualDivision_univ {U : Set Circle} {Δ : Set (Set Circle)} + (hV_fin : (divisionUnion Δ).Finite) + (hU : IsDualPointSet (univ : Set Circle) (divisionUnion Δ) U) : + IsDivision (dualDivision (univ : Set Circle) U Δ) := by + have hU_fin : U.Finite := finite_of_isDualPointSet_univ hV_fin hU + have hU_sub : U ⊆ (univ : Set Circle) \ divisionUnion Δ := isDualPointSet_subset_diff hU + refine ⟨hU_fin.image _, ?_, ?_⟩ + · rintro _ ⟨u, hu, rfl⟩ + exact ⟨u, hu, dualEquivRel_refl _ _ u⟩ + · intro δ₁ hδ₁ δ₂ hδ₂ hne + change Disjoint δ₁ δ₂ + rw [disjoint_left] + intro u hu₁ hu₂ + have h1 := dualDivision_mem_eq_of_mem isOArc_univ_circle (subset_univ _) hU_sub hδ₁ hu₁ + have h2 := dualDivision_mem_eq_of_mem isOArc_univ_circle (subset_univ _) hU_sub hδ₂ hu₂ + exact hne (h1.trans h2.symm) + +/-- Circle coordinates transport a division and its dual point set and recover both by image. -/ +theorem oArcMap_division_data {S : Type u} [TopologicalSpace S] {C U : Set S} + (φ : Circle ≃ₜ C) {Δ : Set (Set S)} (hV_fin : (divisionUnion Δ).Finite) + (hV_sub : divisionUnion Δ ⊆ C) (hU : IsDualPointSet C (divisionUnion Δ) U) : + let U₀ := oArcMap φ ⁻¹' U + let Δ₀ := (preimage (oArcMap φ)) '' Δ + oArcMap φ '' U₀ = U ∧ (image (oArcMap φ)) '' Δ₀ = Δ ∧ + (divisionUnion Δ₀).Finite ∧ IsDualPointSet (univ : Set Circle) (divisionUnion Δ₀) U₀ := by + have hinj := injective_oArcMap φ + have hrange := range_oArcMap φ + let U₀ := oArcMap φ ⁻¹' U + let Δ₀ := (preimage (oArcMap φ)) '' Δ + have hU_eq : oArcMap φ '' U₀ = U := + image_preimage_eq_of_subset ((isDualPointSet_subset_diff hU).trans + (sdiff_subset.trans hrange.symm.subset)) + have hΔ_eq : (image (oArcMap φ)) '' Δ₀ = Δ := by + ext δ + simp only [Δ₀, mem_image, exists_exists_and_eq_and] + constructor + · rintro ⟨δ', hδ', rfl⟩ + have hsub : δ' ⊆ range (oArcMap φ) := by + rw [hrange] + exact (subset_sUnion_of_mem hδ').trans hV_sub + rwa [image_preimage_eq_of_subset hsub] + · intro hδ + have hsub : δ ⊆ range (oArcMap φ) := by + rw [hrange] + exact (subset_sUnion_of_mem hδ).trans hV_sub + exact ⟨δ, hδ, image_preimage_eq_of_subset hsub⟩ + have hV₀_fin : (divisionUnion Δ₀).Finite := by + refine Finite.of_finite_image ?_ hinj.injOn + rw [← divisionUnion_oArcMap φ, hΔ_eq] + exact hV_fin + have hU₀ : IsDualPointSet (univ : Set Circle) (divisionUnion Δ₀) U₀ := by + rw [← isDualPointSet_oArcMap_iff φ, ← divisionUnion_oArcMap φ, hΔ_eq, hU_eq] + exact hU + exact ⟨hU_eq, hΔ_eq, hV₀_fin, hU₀⟩ + +/-- The dual point set of a finite division of an `O`-arc gives a division. -/ +theorem isDivision_dualDivision_of_isOArc {S : Type u} [TopologicalSpace S] + {C U : Set S} {Δ : Set (Set S)} + (hC : IsOArc C) (hV_fin : (divisionUnion Δ).Finite) (hV_sub : divisionUnion Δ ⊆ C) + (hU : IsDualPointSet C (divisionUnion Δ) U) : + IsDivision (dualDivision C U Δ) := by + obtain ⟨φ⟩ := hC + obtain ⟨hU_eq, hΔ_eq, hV₀_fin, hU₀⟩ := oArcMap_division_data φ hV_fin hV_sub hU + rw [← hU_eq, ← hΔ_eq, dualDivision_oArcMap, isDivision_oArcMap_iff] + exact isDivision_dualDivision_univ hV₀_fin hU₀ + +/-! ## 4. Proof of (2.2) -/ + +theorem theorem_2_2_univ (U : Set Circle) (Δ : Set (Set Circle)) + (hΔ : IsDivision Δ) (hV_fin : (divisionUnion Δ).Finite) + (hU : IsDualPointSet (univ : Set Circle) (divisionUnion Δ) U) + (hCF : IsCrossFree (univ : Set Circle) Δ) : + doubleDualDivision (univ : Set Circle) U Δ = Δ := by + let V := divisionUnion Δ + have hU_sub : U ⊆ (univ : Set Circle) \ V := isDualPointSet_subset_diff hU + let Δ_star := dualDivision (univ : Set Circle) U Δ + have hrel_iff : ∀ v ∈ V, ∀ v' ∈ V, + dualEquivRel (univ : Set Circle) Δ_star v v' ↔ ∃ δ ∈ Δ, v ∈ δ ∧ v' ∈ δ := by + intro v hv v' hv' + constructor + · intro hrel + by_contra! hnot_same + have ⟨δ, hδ, hvδ⟩ := hv + have hv'_not_δ : v' ∉ δ := hnot_same δ hδ hvδ + have hδ_fin : δ.Finite := hV_fin.subset (subset_sUnion_of_mem hδ) + have hδ_ne : δ.Nonempty := ⟨v, hvδ⟩ + obtain ⟨v₁, hv₁δ, hmax₁⟩ := exists_max_on_finite hδ_fin hδ_ne (Circle.angleDiff v') + obtain ⟨v₂, hv₂δ, hmin₂⟩ := exists_min_on_finite hδ_fin hδ_ne (Circle.angleDiff v') + have hv₁V : v₁ ∈ V := ⟨δ, hδ, hv₁δ⟩ + have hv₂V : v₂ ∈ V := ⟨δ, hδ, hv₂δ⟩ + have hv'v₁ : v' ≠ v₁ := fun h => hv'_not_δ (h ▸ hv₁δ) + have hv'v₂ : v' ≠ v₂ := fun h => hv'_not_δ (h ▸ hv₂δ) + have hv'v : v' ≠ v := fun h => hv'_not_δ (h ▸ hvδ) + obtain ⟨u₁, hu₁_eq⟩ := exists_unique_mem_nextSegment_of_isDualPointSet hV_fin hU hv₁V + obtain ⟨hu₁U, hu₁v₁, hvw₁, _⟩ := nextSegment_dual_properties hU hv₁V hu₁_eq + obtain ⟨u₂, hu₂_eq⟩ := exists_unique_mem_prevSegment_of_isDualPointSet hV_fin hU hv₂V + obtain ⟨hu₂U, hu₂v₂, hvw₂, _⟩ := prevSegment_dual_properties hU hv₂V hu₂_eq + have hv₁u₁_lt_v₁v' : v₁.angleDiff u₁ < v₁.angleDiff v' := hvw₁ v' ⟨hv', hv'v₁⟩ + have hu₂v₂_lt_v'v₂ : u₂.angleDiff v₂ < v'.angleDiff v₂ := hvw₂ v' ⟨hv', hv'v₂⟩ + have hv₁u₁_pos := Circle.angleDiff_pos hu₁v₁.symm + have hv'v₁_pos := Circle.angleDiff_pos hv'v₁ + have hv'v₂_pos := Circle.angleDiff_pos hv'v₂ + have hu₂v₂_pos := Circle.angleDiff_pos hu₂v₂ + have hv'u₁_ne : v' ≠ u₁ := fun h => (hU_sub hu₁U).2 (h ▸ hv') + have hv'u₂_ne : v' ≠ u₂ := fun h => (hU_sub hu₂U).2 (h ▸ hv') + have hv'u₁_pos := Circle.angleDiff_pos hv'u₁_ne + have hv'u₂_pos := Circle.angleDiff_pos hv'u₂_ne + have hv'u₁_lt_2pi := Circle.angleDiff_lt_two_pi v' u₁ + have hv'u₂_lt_2pi := Circle.angleDiff_lt_two_pi v' u₂ + have hv'v₁_lt_2pi := Circle.angleDiff_lt_two_pi v' v₁ + have hv'v₂_lt_2pi := Circle.angleDiff_lt_two_pi v' v₂ + have hsum_v'v₁ := Circle.angleDiff_add_angleDiff hv'v₁ + have heq_u₁ := angleDiff_eq_of_angleDiff (x := v') (a := v₁) (b := u₁) + have hv'v₁_lt_u₁ : v'.angleDiff v₁ < v'.angleDiff u₁ := by grind [-Circle.angleDiff] + have hsum_u₂v₂ := Circle.angleDiff_add_angleDiff hu₂v₂ + have hsum_v'v₂ := Circle.angleDiff_add_angleDiff hv'v₂ + have heq_u₂ := angleDiff_eq_of_angleDiff (x := v') (a := u₂) (b := v₂) + have hv'u₂_lt_v₂ : v'.angleDiff u₂ < v'.angleDiff v₂ := by grind [-Circle.angleDiff] + have hv₂_le_v : v'.angleDiff v₂ ≤ v'.angleDiff v := hmin₂ v hvδ + have hv_le_v₁ : v'.angleDiff v ≤ v'.angleDiff v₁ := hmax₁ v hvδ + have hno_V_1 : ∀ w ∈ V, v'.angleDiff w ≤ v'.angleDiff u₁ → v'.angleDiff w ≤ v'.angleDiff v₁ + := by + intro w hw hle + rcases eq_or_ne w v₁ with rfl | hwv₁ + · exact le_rfl + · have hlt := hvw₁ w ⟨hw, hwv₁⟩ + have hv'w_lt_2pi := Circle.angleDiff_lt_two_pi v' w + have hv₁w_pos := Circle.angleDiff_pos hwv₁.symm + have heq_w := angleDiff_eq_of_angleDiff (x := v') (a := v₁) (b := w) + grind [-Circle.angleDiff] + have hno_V_2 : ∀ w ∈ V, v'.angleDiff u₂ ≤ v'.angleDiff w → v'.angleDiff v₂ ≤ v'.angleDiff w + := by + intro w hw hle + rcases eq_or_ne w v₂ with rfl | hwv₂ + · exact le_rfl + · have hlt := hvw₂ w ⟨hw, hwv₂⟩ + have hv'w_ne : v' ≠ w := by + rintro rfl + have : v'.angleDiff v' = 0 := circleCoordFrom_self v' + linarith + have hv'w_pos := Circle.angleDiff_pos hv'w_ne + have hv'w_lt_2pi := Circle.angleDiff_lt_two_pi v' w + have hwv₂_pos := Circle.angleDiff_pos hwv₂ + have hsum_wv₂ := Circle.angleDiff_add_angleDiff hwv₂ + have heq_w := angleDiff_eq_of_angleDiff (x := v') (a := w) (b := v₂) + grind [-Circle.angleDiff] + have hu₁u₂_rel : dualEquivRel (univ : Set Circle) Δ u₁ u₂ := by + rintro ⟨δ', hδ', w₁, hw₁, w₂, hw₂, hcross⟩ + have hw₁V : w₁ ∈ V := ⟨δ', hδ', hw₁⟩ + have hw₂V : w₂ ∈ V := ⟨δ', hδ', hw₂⟩ + have hcross' := hcross.comm isOArc_univ_circle + rw [crossesOn_univ_iff_circleCoordFrom v'] at hcross' + rcases hcross' with ⟨hu₁u₂_ne, hw₁w₂_ne, _, _, _, _, hiff⟩ + simp only [onOpenArc, circleCoordFrom] at hiff + have hw₁_in_iff : (min (v'.angleDiff u₁) (v'.angleDiff u₂) < v'.angleDiff w₁ ∧ + v'.angleDiff w₁ < max (v'.angleDiff u₁) (v'.angleDiff u₂)) ↔ + (v'.angleDiff v₂ ≤ v'.angleDiff w₁ ∧ v'.angleDiff w₁ ≤ v'.angleDiff v₁) := by + have := hno_V_1 w₁ hw₁V + have := hno_V_2 w₁ hw₁V + grind [-Circle.angleDiff] + have hw₂_in_iff : (min (v'.angleDiff u₁) (v'.angleDiff u₂) < v'.angleDiff w₂ ∧ + v'.angleDiff w₂ < max (v'.angleDiff u₁) (v'.angleDiff u₂)) ↔ + (v'.angleDiff v₂ ≤ v'.angleDiff w₂ ∧ v'.angleDiff w₂ ≤ v'.angleDiff v₁) := by + have := hno_V_1 w₂ hw₂V + have := hno_V_2 w₂ hw₂V + grind [-Circle.angleDiff] + rw [hw₁_in_iff, hw₂_in_iff] at hiff + have hδ_ne_δ' : δ ≠ δ' := by + rintro rfl + have hw₁_b : v'.angleDiff v₂ ≤ v'.angleDiff w₁ ∧ v'.angleDiff w₁ ≤ v'.angleDiff v₁ := + ⟨hmin₂ w₁ hw₁, hmax₁ w₁ hw₁⟩ + have hw₂_b : v'.angleDiff v₂ ≤ v'.angleDiff w₂ ∧ v'.angleDiff w₂ ≤ v'.angleDiff v₁ := + ⟨hmin₂ w₂ hw₂, hmax₁ w₂ hw₂⟩ + tauto + have hdisj : Disjoint δ δ' := hΔ.2.2 hδ hδ' hδ_ne_δ' + have hw₁_ne_v₁ : w₁ ≠ v₁ := fun h => hdisj.ne_of_mem hv₁δ (h ▸ hw₁) rfl + have hw₁_ne_v₂ : w₁ ≠ v₂ := fun h => hdisj.ne_of_mem hv₂δ (h ▸ hw₁) rfl + have hw₂_ne_v₁ : w₂ ≠ v₁ := fun h => hdisj.ne_of_mem hv₁δ (h ▸ hw₂) rfl + have hw₂_ne_v₂ : w₂ ≠ v₂ := fun h => hdisj.ne_of_mem hv₂δ (h ▸ hw₂) rfl + have hw₁_ne_v₁_ang : v'.angleDiff w₁ ≠ v'.angleDiff v₁ := + (circleCoordFrom v').injective.ne hw₁_ne_v₁ + have hw₁_ne_v₂_ang : v'.angleDiff w₁ ≠ v'.angleDiff v₂ := + (circleCoordFrom v').injective.ne hw₁_ne_v₂ + have hw₂_ne_v₁_ang : v'.angleDiff w₂ ≠ v'.angleDiff v₁ := + (circleCoordFrom v').injective.ne hw₂_ne_v₁ + have hw₂_ne_v₂_ang : v'.angleDiff w₂ ≠ v'.angleDiff v₂ := + (circleCoordFrom v').injective.ne hw₂_ne_v₂ + have hv₁_ne_v₂ : v₁ ≠ v₂ := by + intro h + subst h + grind [-Circle.angleDiff] + have hv_cross : CrossesOn (univ : Set Circle) v₁ v₂ w₁ w₂ := by + rw [crossesOn_univ_iff_circleCoordFrom v'] + refine ⟨hv₁_ne_v₂, hw₁w₂_ne, hw₁_ne_v₁.symm, hw₂_ne_v₁.symm, + hw₁_ne_v₂.symm, hw₂_ne_v₂.symm, ?_⟩ + simp only [onOpenArc, circleCoordFrom] + grind [-Circle.angleDiff] + exact hCF ⟨δ, hδ, δ', hδ', hδ_ne_δ', v₁, hv₁δ, v₂, hv₂δ, w₁, hw₁, w₂, hw₂, hv_cross⟩ + let δ_star := {u' ∈ U | dualEquivRel (univ : Set Circle) Δ u₁ u'} + have hδ_star_mem : δ_star ∈ Δ_star := ⟨u₁, hu₁U, rfl⟩ + have hu₁_in : u₁ ∈ δ_star := ⟨hu₁U, dualEquivRel_refl _ _ u₁⟩ + have hu₂_in : u₂ ∈ δ_star := ⟨hu₂U, hu₁u₂_rel⟩ + have hu_cross : CrossesOn (univ : Set Circle) u₁ u₂ v v' := by + rw [crossesOn_univ_iff_circleCoordFrom v'] + have hu₁u₂_ne : u₁ ≠ u₂ := fun h => by + have : v'.angleDiff u₁ = v'.angleDiff u₂ := congrArg (Circle.angleDiff v') h + linarith + have hu₁v_ne : u₁ ≠ v := fun h => (hU_sub hu₁U).2 (h ▸ hv) + have hu₂v_ne : u₂ ≠ v := fun h => (hU_sub hu₂U).2 (h ▸ hv) + refine ⟨hu₁u₂_ne, hv'v.symm, hu₁v_ne, hv'u₁_ne.symm, hu₂v_ne, hv'u₂_ne.symm, ?_⟩ + simp only [onOpenArc, circleCoordFrom] + have hv'0 : v'.angleDiff v' = 0 := circleCoordFrom_self v' + grind [-Circle.angleDiff] + exact hrel ⟨δ_star, hδ_star_mem, u₁, hu₁_in, u₂, hu₂_in, hu_cross⟩ + · rintro ⟨δ, hδ, hvδ, hv'δ⟩ ⟨δ_star, hδ_star, u₁, hu₁, u₂, hu₂, hcross⟩ + have hδ_star_eq := dualDivision_mem_eq_of_mem isOArc_univ_circle + (subset_univ _) hU_sub hδ_star hu₁ + rw [hδ_star_eq] at hu₂ + exact hu₂.2 ⟨δ, hδ, v, hvδ, v', hv'δ, hcross.comm isOArc_univ_circle⟩ + ext s + simp only [doubleDualDivision, dualDivision, mem_image] + constructor + · rintro ⟨v, hv, rfl⟩ + obtain ⟨δ, hδ, hvδ⟩ := hv + convert hδ using 1 + ext v' + simp only [mem_ofPred_eq] + constructor + · rintro ⟨hv', hrel⟩ + obtain ⟨δ', hδ', hvδ', hv'δ'⟩ := (hrel_iff v ⟨δ, hδ, hvδ⟩ v' hv').mp hrel + have heq : δ = δ' := by + by_contra hne + exact (hΔ.2.2 hδ hδ' hne).ne_of_mem hvδ hvδ' rfl + exact heq ▸ hv'δ' + · intro hv'δ + have hv' : v' ∈ V := ⟨δ, hδ, hv'δ⟩ + exact ⟨hv', (hrel_iff v ⟨δ, hδ, hvδ⟩ v' hv').mpr ⟨δ, hδ, hvδ, hv'δ⟩⟩ + · intro hδ + obtain ⟨v, hvδ⟩ := hΔ.2.1 s hδ + have hv : v ∈ V := ⟨s, hδ, hvδ⟩ + refine ⟨v, hv, ?_⟩ + ext v' + simp only [mem_ofPred_eq] + constructor + · rintro ⟨hv', hrel⟩ + obtain ⟨δ', hδ', hvδ', hv'δ'⟩ := (hrel_iff v hv v' hv').mp hrel + have heq : s = δ' := by + by_contra hne + exact (hΔ.2.2 hδ hδ' hne).ne_of_mem hvδ hvδ' rfl + exact heq ▸ hv'δ' + · intro hv's + have hv' : v' ∈ V := ⟨s, hδ, hv's⟩ + exact ⟨hv', (hrel_iff v hv v' hv').mpr ⟨s, hδ, hvδ, hv's⟩⟩ + +/-- **Graph Minors VI, (2.2)** (page 117): +"If $\Delta$ is cross-free then $\Delta^{**} = \Delta$." -/ +theorem theorem_2_2_proof : Statement22 := by + intro S _ C U Δ hC hΔ hV_fin hV_sub hU hCF + obtain ⟨φ⟩ := hC + let U₀ := oArcMap φ ⁻¹' U + let Δ₀ := (preimage (oArcMap φ)) '' Δ + obtain ⟨hU_eq, hΔ_eq, hV₀_fin, hU₀⟩ := oArcMap_division_data φ hV_fin hV_sub hU + have hΔ₀ : IsDivision Δ₀ := by + rw [← isDivision_oArcMap_iff φ, hΔ_eq] + exact hΔ + have hCF₀ : IsCrossFree (univ : Set Circle) Δ₀ := by + rw [← isCrossFree_oArcMap_iff φ, hΔ_eq] + exact hCF + rw [← hU_eq, ← hΔ_eq, doubleDualDivision_oArcMap, theorem_2_2_univ U₀ Δ₀ hΔ₀ hV₀_fin hU₀ hCF₀] + +/-! ## 5. Proof of (2.3) -/ + +/-- For a basepoint $c \in \text{Circle}$ and a subset $\gamma \subseteq W$, the set of points +$w \in W$ lying in the half-open interval $(a, b]$ in the linear order of `c.angleDiff` for some +$a, b \in \gamma$. -/ +private def spanSet (c : Circle) (W γ : Set Circle) : Set Circle := + {w ∈ W | ∃ a ∈ γ, ∃ b ∈ γ, c.angleDiff a < c.angleDiff w ∧ c.angleDiff w ≤ c.angleDiff b} + +private lemma spanSet_subset (c : Circle) (W γ : Set Circle) : spanSet c W γ ⊆ W := + fun _ hx => hx.1 + +private lemma spanSet_strict_mono_of_contained {c a b : Circle} {W γ γ' : Set Circle} + (hW_fin : W.Finite) (haγ : a ∈ γ) (hbγ : b ∈ γ) (hbW : b ∈ W) + (hab : c.angleDiff a < c.angleDiff b) + (hγ'_sub : ∀ z ∈ γ', c.angleDiff a < c.angleDiff z ∧ c.angleDiff z < c.angleDiff b) : + (spanSet c W γ').ncard < (spanSet c W γ).ncard := by + refine ncard_lt_ncard (ssubset_iff_subset_ne.mpr ⟨?_, ?_⟩) (hW_fin.subset (spanSet_subset c W γ)) + · rintro w ⟨hwW, z₁, hz₁, z₂, hz₂, hlt₁, hle₂⟩ + have hz₁_b := (hγ'_sub z₁ hz₁).1 + have hz₂_b := (hγ'_sub z₂ hz₂).2 + exact ⟨hwW, a, haγ, b, hbγ, hz₁_b.trans hlt₁, hle₂.trans hz₂_b.le⟩ + · intro heq + have hb_in : b ∈ spanSet c W γ := ⟨hbW, a, haγ, b, hbγ, hab, le_rfl⟩ + rw [← heq] at hb_in + rcases hb_in with ⟨_, z₁, _, z₂, hz₂, _, hle₂⟩ + exact (not_lt_of_ge hle₂) (hγ'_sub z₂ hz₂).2 + +theorem theorem_2_3_univ (U : Set Circle) (Δ : Set (Set Circle)) + (hΔ : IsDivision Δ) (hV_fin : (divisionUnion Δ).Finite) + (hU : IsDualPointSet (univ : Set Circle) (divisionUnion Δ) U) + (hW_ne : (divisionUnion Δ ∪ U).Nonempty) : + ∃ γ ∈ Δ ∪ dualDivision (univ : Set Circle) U Δ, γ.ncard = 1 := by + let V := divisionUnion Δ + let W := V ∪ U + let Δ_star := dualDivision (univ : Set Circle) U Δ + have hU_fin : U.Finite := finite_of_isDualPointSet_univ hV_fin hU + have hW_fin : W.Finite := hV_fin.union hU_fin + have hU_sub : U ⊆ (univ : Set Circle) \ V := isDualPointSet_subset_diff hU + have hΔ_star_div : IsDivision Δ_star := isDivision_dualDivision_univ hV_fin hU + have hV_ne : V.Nonempty := by + rcases V.eq_empty_or_nonempty with hV_emp | hV_ne + · have hU_emp : U = ∅ := hU.1 hV_emp + exfalso + rcases hW_ne with ⟨x, hxV | hxU⟩ + · exact (hV_emp ▸ hxV : x ∈ (∅ : Set Circle)).elim + · exact (hU_emp ▸ hxU : x ∈ (∅ : Set Circle)).elim + · exact hV_ne + obtain ⟨v₀, hv₀⟩ := hV_ne + obtain ⟨δ₀, hδ₀, _⟩ := hv₀ + have hAll_fin : (Δ ∪ Δ_star).Finite := hΔ.1.union hΔ_star_div.1 + have hAll_ne : (Δ ∪ Δ_star).Nonempty := ⟨δ₀, Or.inl hδ₀⟩ + obtain ⟨x₀, hx₀⟩ := hW_ne + obtain ⟨c, hc⟩ := nextSegment_nonempty hW_fin hx₀ + have hcW : c ∉ W := nextSegment_subset_compl hc + obtain ⟨γ, hγ_in, hγ_min_fin⟩ := + hAll_fin.toFinset.exists_min_image (fun γ => (spanSet c W γ).ncard) + (hAll_fin.toFinset_nonempty.mpr hAll_ne) + have hγ_mem : γ ∈ Δ ∪ Δ_star := hAll_fin.mem_toFinset.mp hγ_in + have hγ_min : ∀ γ' ∈ Δ ∪ Δ_star, (spanSet c W γ).ncard ≤ (spanSet c W γ').ncard := + fun γ' hγ' => hγ_min_fin γ' (hAll_fin.mem_toFinset.mpr hγ') + refine ⟨γ, hγ_mem, ?_⟩ + have hγ_ne_fin : γ.Nonempty ∧ γ.Finite ∧ γ ⊆ W := by + rcases hγ_mem with hγΔ | hγΔ_star + · have hsub : γ ⊆ W := (subset_sUnion_of_mem hγΔ).trans subset_union_left + exact ⟨hΔ.2.1 γ hγΔ, hW_fin.subset hsub, hsub⟩ + · have hsub : γ ⊆ divisionUnion Δ_star := subset_sUnion_of_mem hγΔ_star + rw [divisionUnion_dualDivision] at hsub + have hsubW : γ ⊆ W := hsub.trans subset_union_right + exact ⟨hΔ_star_div.2.1 γ hγΔ_star, hW_fin.subset hsubW, hsubW⟩ + obtain ⟨a, haγ, hmin_a⟩ := exists_min_on_finite hγ_ne_fin.2.1 hγ_ne_fin.1 (Circle.angleDiff c) + obtain ⟨b, hbγ, hmax_b⟩ := exists_max_on_finite hγ_ne_fin.2.1 hγ_ne_fin.1 (Circle.angleDiff c) + rcases eq_or_ne a b with rfl | hab_ne + · have hγ_eq : γ = {a} := by + ext z + simp only [mem_singleton_iff] + refine ⟨fun hz => ?_, fun h => h.symm ▸ haγ⟩ + have hle1 := hmin_a z hz + have hle2 := hmax_b z hz + exact (circleCoordFrom c).injective (le_antisymm hle2 hle1) + rw [hγ_eq, ncard_singleton] + · exfalso + have hab_lt : c.angleDiff a < c.angleDiff b := + lt_of_le_of_ne (hmin_a b hbγ) ((circleCoordFrom c).injective.ne hab_ne) + have haW : a ∈ W := hγ_ne_fin.2.2 haγ + have hbW : b ∈ W := hγ_ne_fin.2.2 hbγ + have hca_ne : c ≠ a := fun h => hcW (h ▸ haW) + have hcb_ne : c ≠ b := fun h => hcW (h ▸ hbW) + have hca_pos := Circle.angleDiff_pos hca_ne + have hcb_lt_2pi := Circle.angleDiff_lt_two_pi c b + have heq_ab := angleDiff_eq_of_angleDiff (x := c) (a := a) (b := b) + rcases hγ_mem with hγΔ | hγΔ_star + · have haV : a ∈ V := ⟨γ, hγΔ, haγ⟩ + have hbV : b ∈ V := ⟨γ, hγΔ, hbγ⟩ + obtain ⟨u, hu_eq⟩ := exists_unique_mem_nextSegment_of_isDualPointSet hV_fin hU haV + obtain ⟨huU, hua_ne, hvw, _⟩ := nextSegment_dual_properties hU haV hu_eq + have hau_lt_ab : a.angleDiff u < a.angleDiff b := hvw b ⟨hbV, hab_ne.symm⟩ + have hau_pos := Circle.angleDiff_pos hua_ne.symm + have huW : u ∈ W := Or.inr huU + have hcu_ne : c ≠ u := fun h => hcW (h ▸ huW) + have hcu_pos := Circle.angleDiff_pos hcu_ne + have hcu_lt_2pi := Circle.angleDiff_lt_two_pi c u + have heq_au := angleDiff_eq_of_angleDiff (x := c) (a := a) (b := u) + have hcu_in : c.angleDiff a < c.angleDiff u ∧ c.angleDiff u < c.angleDiff b := by + grind [-Circle.angleDiff] + let γ' := {u' ∈ U | dualEquivRel (univ : Set Circle) Δ u u'} + have hγ'_mem : γ' ∈ Δ ∪ Δ_star := Or.inr ⟨u, huU, rfl⟩ + have hγ'_sub : ∀ u' ∈ γ', c.angleDiff a < c.angleDiff u' ∧ c.angleDiff u' < c.angleDiff b + := by + intro u' ⟨hu'U, hrel⟩ + rcases eq_or_ne u' u with rfl | hu'u_ne + · exact hcu_in + · by_contra hnot + have hau_ne : a ≠ u := hua_ne.symm + have hbu_ne : b ≠ u := fun h => (hU_sub huU).2 (h ▸ hbV) + have hau'_ne : a ≠ u' := fun h => (hU_sub hu'U).2 (h ▸ haV) + have hbu'_ne : b ≠ u' := fun h => (hU_sub hu'U).2 (h ▸ hbV) + have hau'_ang : c.angleDiff a ≠ c.angleDiff u' := (circleCoordFrom c).injective.ne hau'_ne + have hbu'_ang : c.angleDiff b ≠ c.angleDiff u' := (circleCoordFrom c).injective.ne hbu'_ne + have hcross : CrossesOn (univ : Set Circle) a b u u' := by + rw [crossesOn_univ_iff_circleCoordFrom c] + refine ⟨hab_ne, hu'u_ne.symm, hau_ne, hau'_ne, hbu_ne, hbu'_ne, ?_⟩ + simp only [onOpenArc, circleCoordFrom] + grind [-Circle.angleDiff] + exact hrel ⟨γ, hγΔ, a, haγ, b, hbγ, hcross⟩ + have hlt_card := spanSet_strict_mono_of_contained hW_fin haγ hbγ hbW hab_lt hγ'_sub + exact (not_lt_of_ge (hγ_min γ' hγ'_mem)) hlt_card + · have hγ_sub_U : γ ⊆ U := by + have hsub : γ ⊆ divisionUnion Δ_star := subset_sUnion_of_mem hγΔ_star + rwa [divisionUnion_dualDivision] at hsub + have haU : a ∈ U := hγ_sub_U haγ + have hbU : b ∈ U := hγ_sub_U hbγ + have hU_symm := isDualPointSet_univ_symm hV_fin hU + obtain ⟨v, hv_eq⟩ := exists_unique_mem_nextSegment_of_isDualPointSet hU_fin hU_symm haU + obtain ⟨hvV, hva_ne, hvu, _⟩ := nextSegment_dual_properties hU_symm haU hv_eq + have hav_lt_ab : a.angleDiff v < a.angleDiff b := hvu b ⟨hbU, hab_ne.symm⟩ + have hav_pos := Circle.angleDiff_pos hva_ne.symm + have hvW : v ∈ W := Or.inl hvV + have hcv_ne : c ≠ v := fun h => hcW (h ▸ hvW) + have hcv_pos := Circle.angleDiff_pos hcv_ne + have hcv_lt_2pi := Circle.angleDiff_lt_two_pi c v + have heq_av := angleDiff_eq_of_angleDiff (x := c) (a := a) (b := v) + have hcv_in : c.angleDiff a < c.angleDiff v ∧ c.angleDiff v < c.angleDiff b := by + grind [-Circle.angleDiff] + have ⟨γ', hγ'Δ, hvγ'⟩ := hvV + have hγ'_mem : γ' ∈ Δ ∪ Δ_star := Or.inl hγ'Δ + have hγ_eq := dualDivision_mem_eq_of_mem isOArc_univ_circle (subset_univ _) hU_sub hγΔ_star + haγ + have hab_rel : dualEquivRel (univ : Set Circle) Δ a b := by + rw [hγ_eq] at hbγ + exact hbγ.2 + have hγ'_sub : ∀ v' ∈ γ', c.angleDiff a < c.angleDiff v' ∧ c.angleDiff v' < c.angleDiff b + := by + intro v' hv'γ' + have hv'V : v' ∈ V := ⟨γ', hγ'Δ, hv'γ'⟩ + rcases eq_or_ne v' v with rfl | hv'v_ne + · exact hcv_in + · by_contra hnot + have hav_ne : a ≠ v := hva_ne.symm + have hbv_ne : b ≠ v := fun h => (hU_sub hbU).2 (h ▸ hvV) + have hav'_ne : a ≠ v' := fun h => (hU_sub haU).2 (h ▸ hv'V) + have hbv'_ne : b ≠ v' := fun h => (hU_sub hbU).2 (h ▸ hv'V) + have hav'_ang : c.angleDiff a ≠ c.angleDiff v' := (circleCoordFrom c).injective.ne hav'_ne + have hbv'_ang : c.angleDiff b ≠ c.angleDiff v' := (circleCoordFrom c).injective.ne hbv'_ne + have hcross : CrossesOn (univ : Set Circle) a b v v' := by + rw [crossesOn_univ_iff_circleCoordFrom c] + refine ⟨hab_ne, hv'v_ne.symm, hav_ne, hav'_ne, hbv_ne, hbv'_ne, ?_⟩ + simp only [onOpenArc, circleCoordFrom] + grind [-Circle.angleDiff] + exact hab_rel ⟨γ', hγ'Δ, v, hvγ', v', hv'γ', hcross.comm isOArc_univ_circle⟩ + have hlt_card := spanSet_strict_mono_of_contained hW_fin haγ hbγ hbW hab_lt hγ'_sub + exact (not_lt_of_ge (hγ_min γ' hγ'_mem)) hlt_card + +/-- **Graph Minors VI, (2.3)** (page 118): +"If $W \ne \emptyset$, one of $\Delta, \Delta^*$ has a member with cardinality $1$." -/ +theorem theorem_2_3_proof : Statement23 := by + intro S _ C U Δ hC hΔ hV_fin hV_sub hU hW_ne + obtain ⟨φ⟩ := hC + have hinj := injective_oArcMap φ + let U₀ := oArcMap φ ⁻¹' U + let Δ₀ := (preimage (oArcMap φ)) '' Δ + obtain ⟨hU_eq, hΔ_eq, hV₀_fin, hU₀⟩ := oArcMap_division_data φ hV_fin hV_sub hU + have hΔ₀ : IsDivision Δ₀ := by + rw [← isDivision_oArcMap_iff φ, hΔ_eq] + exact hΔ + have hW₀_ne : (divisionUnion Δ₀ ∪ U₀).Nonempty := by + have heq : oArcMap φ '' (divisionUnion Δ₀ ∪ U₀) = divisionUnion Δ ∪ U := by + rw [image_union, ← divisionUnion_oArcMap φ, hΔ_eq, hU_eq] + exact (heq ▸ hW_ne).of_image + obtain ⟨γ₀, hγ₀_mem, hγ₀_card⟩ := theorem_2_3_univ U₀ Δ₀ hΔ₀ hV₀_fin hU₀ hW₀_ne + refine ⟨oArcMap φ '' γ₀, ?_, ?_⟩ + · rw [← hΔ_eq, ← hU_eq, dualDivision_oArcMap, ← image_union] + exact mem_image_of_mem _ hγ₀_mem + · rw [ncard_image_of_injective _ hinj] + exact hγ₀_card + +end GraphMinor.GM06 diff --git a/LeanPool/GraphMinor/GM06/Section3Basic.lean b/LeanPool/GraphMinor/GM06/Section3Basic.lean new file mode 100644 index 0000000000..0b3d878c3c --- /dev/null +++ b/LeanPool/GraphMinor/GM06/Section3Basic.lean @@ -0,0 +1,1337 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.Section2Count +public import LeanPool.GraphMinor.GM06.DiscRegions +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import Mathlib.Combinatorics.Graph.Delete +import Mathlib.Combinatorics.Graph.Lattice + +/-! +# Graph Minors VI, Section 3: Duality Symmetry, Reductions (3.3), and Dual Chains (3.5) + +This file proves the foundational results of Section 3 of Robertson and Seymour, +*Graph Minors. VI. Disjoint paths across a disc*, J. Combin. Theory Ser. B **41** (1986), +115–138 (pages 119–122): +- `theorem_3_1`: **Graph Minors VI, (3.1)** ($G^{**} = G$ for a connected proper drawing on a disc). +- `theorem_3_3_i`: **Graph Minors VI, (3.3)(i)** (deleting a singleton member $\{v\} \in \Delta$). +- `theorem_3_3_ii`: **Graph Minors VI, (3.3)(ii)** (deleting a component disjoint from + $\operatorname{bd}(\Sigma)$). +- `theorem_3_3_iii`: **Graph Minors VI, (3.3)(iii)** (infeasibility when $\delta \in \Delta$ meets + two components). +- `theorem_3_3_iv`: **Graph Minors VI, (3.3)(iv)** (decomposing across components of $G$). +- `theorem_3_5`: **Graph Minors VI, (3.5)** (correspondence between $(x, y)$-chains of $G^*$ and $G$ + preserving redundancy). +-/ + +@[expose] public section + +namespace GraphMinor.Surface.GraphWalk + +open Set Graph + +universe u v + +variable {α : Type u} {β : Type v} {G H : Graph α β} + +/-- Lift a walk along a subgraph inclusion `H ≤ G`. -/ +def mono {u v : α} (hle : H ≤ G) : GraphWalk H u v → GraphWalk G u v + | .nil hv => .nil (hle.vertexSet_mono hv) + | .cons h rest => .cons (h.mono hle) (rest.mono hle) + +@[simp] +theorem support_mono {u v : α} (hle : H ≤ G) (W : GraphWalk H u v) : + (W.mono hle).support = W.support := by + induction W with + | nil _ => rfl + | cons _ _ ih => simp [mono, support, ih] + +@[simp] +theorem edges_mono {u v : α} (hle : H ≤ G) (W : GraphWalk H u v) : + (W.mono hle).edges = W.edges := by + induction W with + | nil _ => rfl + | cons _ _ ih => simp [mono, edges, ih] + +@[simp] +theorem length_mono {u v : α} (hle : H ≤ G) (W : GraphWalk H u v) : + (W.mono hle).length = W.length := by + simp [length] + +theorem isSimpleClosed_mono {u : α} {hle : H ≤ G} {W : GraphWalk H u u} + (hW : W.IsSimpleClosed) : (W.mono hle).IsSimpleClosed := + ⟨by simpa using hW.1, by simpa using hW.2⟩ + +/-- Lift a walk in `G` to an induced subgraph `G.induce X` when all its vertices lie in `X`. -/ +def toInduce {u v : α} {X : Set α} (W : GraphWalk G u v) + (hX : ∀ x ∈ W.support, x ∈ X) : GraphWalk (G.induce X) u v := + match W with + | .nil _ => .nil (hX u (by simp [support])) + | .cons h rest => + have hu : u ∈ X := hX u (by simp [support]) + have hv : _ ∈ X := by + apply hX + cases rest <;> simp [support] + .cons ⟨h, hu, hv⟩ (rest.toInduce fun x hx => hX x (by simp [support, hx])) + +end GraphMinor.Surface.GraphWalk + +namespace GraphMinor.GM06 + +open Set Function Topology Graph GraphMinor.Surface + +universe u v + +/-! ## 1. Forests and Connected Components of Multigraphs -/ + +theorem isGraphForest_of_le {α : Type u} {β : Type v} {H G : Graph α β} + (hle : H ≤ G) (hG : IsGraphForest G) : IsGraphForest H := by + intro u W hW + rw [← W.length_mono hle] + exact hG u (W.mono hle) (W.isSimpleClosed_mono hW) + +/-- The set of vertices of `G` reachable by a walk from `x`. -/ +def reachSet {α : Type u} {β : Type v} (G : Graph α β) (x : α) : Set α := + {y ∈ V(G) | Nonempty (GraphWalk G x y)} + +/-- The canonical connected component of `G` containing `x`, defined as `G.induce (reachSet G x)`. +-/ +def compOf {α : Type u} {β : Type v} (G : Graph α β) (x : α) : Graph α β := + G.induce (reachSet G x) + +theorem reachSet_subset {α : Type u} {β : Type v} (G : Graph α β) (x : α) : + reachSet G x ⊆ V(G) := + fun _ hy => hy.1 + +@[simp] +theorem vertexSet_compOf {α : Type u} {β : Type v} (G : Graph α β) (x : α) : + V(compOf G x) = reachSet G x := + rfl + +theorem compOf_le {α : Type u} {β : Type v} (G : Graph α β) (x : α) : + compOf G x ≤ G := + G.induce_le (reachSet_subset G x) + +theorem self_mem_reachSet {α : Type u} {β : Type v} {G : Graph α β} {x : α} (hx : x ∈ V(G)) : + x ∈ reachSet G x := + ⟨hx, ⟨.nil hx⟩⟩ + +theorem reachSet_step {α : Type u} {β : Type v} {G : Graph α β} {x u v : α} {e : β} + (hu : u ∈ reachSet G x) (hlink : G.IsLink e u v) : v ∈ reachSet G x := by + obtain ⟨_, ⟨W⟩⟩ := hu + exact ⟨hlink.right_mem, ⟨W.append (.cons hlink (.nil hlink.right_mem))⟩⟩ + +theorem walk_support_subset_reachSet {α : Type u} {β : Type v} {G : Graph α β} {x u v : α} + (hu : u ∈ reachSet G x) (W : GraphWalk G u v) : + ∀ z ∈ W.support, z ∈ reachSet G x := by + induction W with + | nil _ => + intro z hz + simp only [GraphWalk.support, List.mem_singleton] at hz + exact hz ▸ hu + | cons h rest ih => + intro z hz + simp only [GraphWalk.support, List.mem_cons] at hz + rcases hz with rfl | hz + · exact hu + · exact ih (reachSet_step hu h) z hz + +theorem isGraphConnected_compOf {α : Type u} {β : Type v} {G : Graph α β} {x : α} + (hx : x ∈ V(G)) : IsGraphConnected (compOf G x) := by + refine ⟨⟨x, self_mem_reachSet hx⟩, fun u hu v hv => ?_⟩ + rcases hu with ⟨huG, ⟨Wxu⟩⟩ + rcases hv with ⟨_, ⟨Wxv⟩⟩ + let Wuv : GraphWalk G u v := Wxu.reverse.append Wxv + have hu' : u ∈ reachSet G x := ⟨huG, ⟨Wxu⟩⟩ + exact ⟨Wuv.toInduce (walk_support_subset_reachSet hu' Wuv)⟩ + +theorem le_compOf_of_isGraphConnected {α : Type u} {β : Type v} {G C : Graph α β} {x : α} + (hCG : C ≤ G) (hConn : IsGraphConnected C) (hx : x ∈ V(C)) : + C ≤ compOf G x := by + have hsub : V(C) ⊆ reachSet G x := by + intro y hy + obtain ⟨W⟩ := hConn.2 x hx y hy + exact ⟨hCG.vertexSet_mono hy, ⟨W.mono hCG⟩⟩ + refine ⟨hsub, fun e u v hlink => ?_⟩ + exact ⟨hlink.mono hCG, hsub hlink.left_mem, hsub hlink.right_mem⟩ + +theorem isGraphComponent_compOf {α : Type u} {β : Type v} {G : Graph α β} {x : α} + (hx : x ∈ V(G)) : IsGraphComponent (compOf G x) G := by + refine ⟨compOf_le G x, isGraphConnected_compOf hx, fun C' hle hC'G hConn => ?_⟩ + have hxC' : x ∈ V(C') := hle.vertexSet_mono (self_mem_reachSet hx) + exact le_antisymm (le_compOf_of_isGraphConnected hC'G hConn hxC') hle + +theorem IsGraphComponent.eq_compOf_of_mem {α : Type u} {β : Type v} {G C : Graph α β} + (hC : IsGraphComponent C G) {x : α} (hx : x ∈ V(C)) : + C = compOf G x := by + have hxG : x ∈ V(G) := hC.1.vertexSet_mono hx + exact (hC.2.2 (compOf G x) (le_compOf_of_isGraphConnected hC.1 hC.2.1 hx) + (compOf_le G x) (isGraphConnected_compOf hxG)).symm + +theorem IsGraphComponent.eq_of_mem_mem {α : Type u} {β : Type v} {G C₁ C₂ : Graph α β} + (h₁ : IsGraphComponent C₁ G) (h₂ : IsGraphComponent C₂ G) {x : α} + (hx₁ : x ∈ V(C₁)) (hx₂ : x ∈ V(C₂)) : C₁ = C₂ := by + rw [h₁.eq_compOf_of_mem hx₁, h₂.eq_compOf_of_mem hx₂] + +theorem IsGraphComponent.disjoint_vertexSet_of_ne {α : Type u} {β : Type v} {G C₁ C₂ : Graph α β} + (h₁ : IsGraphComponent C₁ G) (h₂ : IsGraphComponent C₂ G) (hne : C₁ ≠ C₂) : + Disjoint V(C₁) V(C₂) := + disjoint_left.mpr fun _ hx₁ hx₂ => hne (h₁.eq_of_mem_mem h₂ hx₁ hx₂) + +theorem IsGraphComponent.disjoint_edgeSet_of_ne {α : Type u} {β : Type v} {G C₁ C₂ : Graph α β} + (h₁ : IsGraphComponent C₁ G) (h₂ : IsGraphComponent C₂ G) (hne : C₁ ≠ C₂) : + Disjoint E(C₁) E(C₂) := by + refine disjoint_left.mpr fun e he₁ he₂ => ?_ + obtain ⟨u, v, hl₁⟩ := C₁.exists_isLink_of_mem_edgeSet he₁ + obtain ⟨x, y, hl₂⟩ := C₂.exists_isLink_of_mem_edgeSet he₂ + have h1 := hl₁.mono h₁.1 + have h2 := hl₂.mono h₂.1 + rcases h1.left_eq_or_eq h2 with rfl | rfl + · exact disjoint_left.mp (h₁.disjoint_vertexSet_of_ne h₂ hne) hl₁.left_mem hl₂.left_mem + · exact disjoint_left.mp (h₁.disjoint_vertexSet_of_ne h₂ hne) hl₁.left_mem hl₂.right_mem + +theorem IsGraphComponent.mem_iff_of_isLink {α : Type u} {β : Type v} {G C : Graph α β} + (hC : IsGraphComponent C G) {e : β} {u v : α} (hlink : G.IsLink e u v) : + u ∈ V(C) ↔ v ∈ V(C) := by + constructor + · intro hu + rw [hC.eq_compOf_of_mem hu] + exact reachSet_step (self_mem_reachSet (hC.1.vertexSet_mono hu)) hlink + · intro hv + rw [hC.eq_compOf_of_mem hv] + exact reachSet_step (self_mem_reachSet (hC.1.vertexSet_mono hv)) hlink.symm + +theorem IsGraphComponent.isLink_iff_of_mem {α : Type u} {β : Type v} {G C : Graph α β} + (hC : IsGraphComponent C G) {e : β} {u v : α} (hu : u ∈ V(C)) : + C.IsLink e u v ↔ G.IsLink e u v := by + constructor + · exact fun h => h.mono hC.1 + · intro hlink + have hv : v ∈ V(C) := (hC.mem_iff_of_isLink hlink).mp hu + have heq := hC.eq_compOf_of_mem hu + rw [heq] at hu hv ⊢ + exact ⟨hlink, hu, hv⟩ + +theorem IsGraphComponent.le_of_isGraphConnected {α : Type u} {β : Type v} {G C K : Graph α β} + (hC : IsGraphComponent C G) (hKG : K ≤ G) (hK : IsGraphConnected K) + {x : α} (hxK : x ∈ V(K)) (hxC : x ∈ V(C)) : K ≤ C := by + rw [hC.eq_compOf_of_mem hxC] + exact le_compOf_of_isGraphConnected hKG hK hxK + +/-! ## 2. Proof of Theorem (3.1) -/ + +/-- **Graph Minors VI, (3.1)** (page 120): +"If $G$ is connected and properly drawn on a disc $\Sigma$, then $G^{**} = G$. (More precisely, the +drawing of $G$ is a drawing of $G^{**}$.)" -/ +theorem theorem_3_1_proof : Statement31.{u} := by + intro S _ G G_dual hS hConn hDual + have : T2Space S := t2Space_of_isClosedDiscSpace hS + exact hDual.symm_of_connected hS hConn + +/-! ## 3. Proofs of (3.3)(i)–(iv) -/ + +/-- Deleting the vertex set of a connected component `C` from `H` preserves all other connected +components of `H`. -/ +private theorem isGraphComponent_deleteVerts_iff {α : Type u} {β : Type v} + {H C K : Graph α β} (hC : IsGraphComponent C H) : + IsGraphComponent K (H.deleteVerts V(C)) ↔ IsGraphComponent K H ∧ K ≠ C := by + constructor + · intro hK + obtain ⟨x, hxK⟩ := hK.2.1.1 + have hx_del : x ∈ V(H) \ V(C) := by + rw [← vertexSet_deleteVerts] + exact hK.1.vertexSet_mono hxK + have hCH : IsGraphComponent (compOf H x) H := isGraphComponent_compOf hx_del.1 + have hne : compOf H x ≠ C := by + intro heq + have hx_in : x ∈ V(compOf H x) := self_mem_reachSet hx_del.1 + rw [heq] at hx_in + exact hx_del.2 hx_in + have hdisj : Disjoint V(compOf H x) V(C) := hCH.disjoint_vertexSet_of_ne hC hne + have hcomp_le : compOf H x ≤ H.deleteVerts V(C) := by + refine ⟨?_, fun e u v hlink => ?_⟩ + · rw [vertexSet_deleteVerts] + exact subset_sdiff.mpr ⟨reachSet_subset H x, hdisj⟩ + · rw [deleteVerts_isLink] + exact ⟨hlink.1, disjoint_left.mp hdisj hlink.2.1, disjoint_left.mp hdisj hlink.2.2⟩ + have hK_le_H : K ≤ H := hK.1.trans deleteVerts_le + have hK_le_comp : K ≤ compOf H x := + le_compOf_of_isGraphConnected hK_le_H hK.2.1 hxK + have hK_eq : K = compOf H x := + (hK.2.2 (compOf H x) hK_le_comp hcomp_le (isGraphConnected_compOf hx_del.1)).symm + rw [hK_eq] + exact ⟨hCH, hne⟩ + · rintro ⟨hK, hne⟩ + have hdisj : Disjoint V(K) V(C) := hK.disjoint_vertexSet_of_ne hC hne + have hK_le : K ≤ H.deleteVerts V(C) := by + refine ⟨?_, fun e u v hlink => ?_⟩ + · rw [vertexSet_deleteVerts] + exact subset_sdiff.mpr ⟨hK.1.vertexSet_mono, hdisj⟩ + · rw [deleteVerts_isLink] + exact ⟨hlink.mono hK.1, disjoint_left.mp hdisj hlink.left_mem, + disjoint_left.mp hdisj hlink.right_mem⟩ + refine ⟨hK_le, hK.2.1, fun K' hKK' hK'del hK'conn => ?_⟩ + exact hK.2.2 K' hKK' (hK'del.trans deleteVerts_le) hK'conn + +/-- Adding an isolated vertex `v ∉ V(H')` to a graph `H'`. -/ +private def addIsolatedVertex {α : Type u} {β : Type v} (H' : Graph α β) (v : α) : Graph α β where + vertexSet := V(H') ∪ {v} + edgeSet := E(H') + IsLink e x y := H'.IsLink e x y + isLink_symm _ he := H'.isLink_symm he + eq_or_eq_of_isLink_of_isLink _ _ _ _ _ h1 h2 := h1.left_eq_or_eq h2 + edge_mem_iff_exists_isLink e := H'.edge_mem_iff_exists_isLink e + left_mem_of_isLink _ _ _ h := Or.inl h.left_mem + +private theorem le_addIsolatedVertex {α : Type u} {β : Type v} (H' : Graph α β) (v : α) : + H' ≤ addIsolatedVertex H' v := + ⟨subset_union_left, fun _ _ _ h => h⟩ + +private def walkToSub {α : Type u} {β : Type v} {H' : Graph α β} {v : α} + {x y : α} (hx : x ∈ V(H')) : + GraphWalk (addIsolatedVertex H' v) x y → GraphWalk H' x y + | .nil _ => .nil hx + | .cons h rest => + have h' : H'.IsLink _ _ _ := h + .cons h' (walkToSub h'.right_mem rest) + +@[simp] +private theorem support_walkToSub {α : Type u} {β : Type v} {H' : Graph α β} {v : α} + {x y : α} (hx : x ∈ V(H')) (W : GraphWalk (addIsolatedVertex H' v) x y) : + (walkToSub hx W).support = W.support := by + induction W with + | nil _ => rfl + | cons h rest ih => + have h' : H'.IsLink _ _ _ := h + simp [walkToSub, GraphWalk.support, ih h'.right_mem] + +@[simp] +private theorem edges_walkToSub {α : Type u} {β : Type v} {H' : Graph α β} {v : α} + {x y : α} (hx : x ∈ V(H')) (W : GraphWalk (addIsolatedVertex H' v) x y) : + (walkToSub hx W).edges = W.edges := by + induction W with + | nil _ => rfl + | cons h rest ih => + have h' : H'.IsLink _ _ _ := h + simp [walkToSub, GraphWalk.edges, ih h'.right_mem] + +private theorem isGraphForest_addIsolatedVertex {α : Type u} {β : Type v} {H' : Graph α β} {v : α} + (hF : IsGraphForest H') : IsGraphForest (addIsolatedVertex H' v) := by + intro u W hW + cases W with + | nil _ => rfl + | cons h rest => + have h' : H'.IsLink _ _ _ := h + have hu : u ∈ V(H') := h'.left_mem + let W' : GraphWalk H' u u := walkToSub hu (.cons h rest) + have hW' : W'.IsSimpleClosed := by + refine ⟨?_, ?_⟩ + · rw [support_walkToSub] + exact hW.1 + · rw [edges_walkToSub] + exact hW.2 + have hlen : (GraphWalk.cons h rest).length = W'.length := by + simp [GraphWalk.length, W'] + rw [hlen] + exact hF u W' hW' + +private theorem compOf_addIsolatedVertex_self {α : Type u} {β : Type v} {H' : Graph α β} {v : α} + (hv : v ∉ V(H')) : + compOf (addIsolatedVertex H' v) v = Graph.noEdge ({v} : Set α) β := by + have hreach : reachSet (addIsolatedVertex H' v) v = {v} := by + ext x + simp only [reachSet, mem_ofPred_eq, mem_singleton_iff] + constructor + · rintro ⟨_, ⟨W⟩⟩ + cases W with + | nil _ => rfl + | cons h _ => + have h' : H'.IsLink _ _ _ := h + exact absurd h'.left_mem hv + · rintro rfl + exact ⟨Or.inr rfl, ⟨.nil (Or.inr rfl)⟩⟩ + refine Graph.ext ?_ fun e x y => ?_ + · simp [compOf, hreach] + · simp only [compOf, induce_isLink, hreach, mem_singleton_iff, noEdge_isLink, iff_false, not_and] + intro hlink hx _ + have h' : H'.IsLink _ _ _ := hlink + exact hv (hx ▸ h'.left_mem) + +private theorem isGraphComponent_noEdge_addIsolatedVertex {α : Type u} {β : Type v} + {H' : Graph α β} {v : α} (hv : v ∉ V(H')) : + IsGraphComponent (Graph.noEdge ({v} : Set α) β) (addIsolatedVertex H' v) := by + rw [← compOf_addIsolatedVertex_self hv] + exact isGraphComponent_compOf (Or.inr rfl) + +private theorem compOf_addIsolatedVertex_of_mem {α : Type u} {β : Type v} + {H' : Graph α β} {v x : α} (hx : x ∈ V(H')) : + compOf (addIsolatedVertex H' v) x = compOf H' x := by + have hreach : reachSet (addIsolatedVertex H' v) x = reachSet H' x := by + ext y + simp only [reachSet, mem_ofPred_eq] + constructor + · rintro ⟨_, ⟨W⟩⟩ + let W' := walkToSub hx W + exact ⟨W'.mem_vertexSet_of_mem_support W'.end_mem_support, ⟨W'⟩⟩ + · rintro ⟨hy, ⟨W⟩⟩ + exact ⟨Or.inl hy, ⟨W.mono (le_addIsolatedVertex H' v)⟩⟩ + refine Graph.ext ?_ fun e a b => ?_ + · simp [compOf, hreach] + · rw [compOf, compOf, induce_isLink, induce_isLink, hreach] + rfl + +private theorem isGraphComponent_addIsolatedVertex_iff {α : Type u} {β : Type v} + {H' K : Graph α β} {v : α} (hv : v ∉ V(H')) : + IsGraphComponent K (addIsolatedVertex H' v) ↔ + K = Graph.noEdge ({v} : Set α) β ∨ IsGraphComponent K H' := by + constructor + · intro hK + obtain ⟨x, hxK⟩ := hK.2.1.1 + have hx_mem : x ∈ V(H') ∪ {v} := hK.1.vertexSet_mono hxK + rcases hx_mem with hxH' | rfl + · right + rw [hK.eq_compOf_of_mem hxK, compOf_addIsolatedVertex_of_mem hxH'] + exact isGraphComponent_compOf hxH' + · left + rw [hK.eq_compOf_of_mem hxK, compOf_addIsolatedVertex_self hv] + · rintro (rfl | hK) + · exact isGraphComponent_noEdge_addIsolatedVertex hv + · obtain ⟨x, hxK⟩ := hK.2.1.1 + have hxH' : x ∈ V(H') := hK.1.vertexSet_mono hxK + rw [hK.eq_compOf_of_mem hxK, ← compOf_addIsolatedVertex_of_mem hxH'] + exact isGraphComponent_compOf (Or.inl hxH') + +/-- **Graph Minors VI, (3.3)(i)** (page 120): +"If $|\delta| = 1$ for some $\delta \in \Delta$, and $\delta = \{v\}$ say, then $\Delta$ is feasible +in $G$ if and only if $\Delta - \{\delta\}$ is feasible in the graph obtained from $G$ by deleting +$v$." -/ +theorem theorem_3_3_i : Statement33i.{u, v} := by + classical + intro α β G Δ v hΔ hΔ_sub hv_mem + have hv_in_G : v ∈ V(G) := hΔ_sub ⟨{v}, hv_mem, rfl⟩ + have hΔ'_div : IsDivision (Δ \ {{v}}) := + ⟨hΔ.1.subset sdiff_subset, fun δ hδ => hΔ.2.1 δ hδ.1, hΔ.2.2.subset sdiff_subset⟩ + have hΔ'_sub : divisionUnion (Δ \ {{v}}) ⊆ V(G.deleteVerts {v}) := by + rintro x ⟨δ, ⟨hδ, hδ_ne⟩, hxδ⟩ + rw [vertexSet_deleteVerts, mem_sdiff, mem_singleton_iff] + refine ⟨hΔ_sub ⟨δ, hδ, hxδ⟩, ?_⟩ + rintro rfl + exact (hΔ.2.2 hδ hv_mem hδ_ne).ne_of_mem hxδ rfl rfl + constructor + · rintro ⟨H, _, _, hHG, hF, H_comp, hinj, hcomp, hcomps_eq⟩ + let Cv := H_comp {v} + have hCv_comp : IsGraphComponent Cv H := (hcomp {v} hv_mem).1 + have hv_in_Cv : v ∈ V(Cv) := (hcomp {v} hv_mem).2 rfl + let H' := H.deleteVerts V(Cv) + refine ⟨H', hΔ'_div, hΔ'_sub, ?_, isGraphForest_of_le deleteVerts_le hF, H_comp, + hinj.mono sdiff_subset, ?_, ?_⟩ + · refine ⟨?_, fun e x y hlink => ?_⟩ + · rw [vertexSet_deleteVerts, vertexSet_deleteVerts] + exact sdiff_subset_sdiff hHG.vertexSet_mono (singleton_subset_iff.mpr hv_in_Cv) + · rw [deleteVerts_isLink] at hlink ⊢ + exact ⟨hlink.1.mono hHG, fun hxv => hlink.2.1 (mem_singleton_iff.mp hxv ▸ hv_in_Cv), + fun hyv => hlink.2.2 (mem_singleton_iff.mp hyv ▸ hv_in_Cv)⟩ + · intro δ hδ + have hne : H_comp δ ≠ Cv := fun heq => hδ.2 (hinj hδ.1 hv_mem heq) + exact ⟨(isGraphComponent_deleteVerts_iff hCv_comp).mpr ⟨(hcomp δ hδ.1).1, hne⟩, + (hcomp δ hδ.1).2⟩ + · ext K + change IsGraphComponent K (H.deleteVerts V(Cv)) ↔ K ∈ H_comp '' (Δ \ {{v}}) + rw [isGraphComponent_deleteVerts_iff hCv_comp, mem_image] + constructor + · rintro ⟨hKH, hne⟩ + have hK_mem : K ∈ graphComponents H := hKH + rw [hcomps_eq] at hK_mem + obtain ⟨δ, hδ, rfl⟩ := hK_mem + exact ⟨δ, ⟨hδ, fun h => hne (congrArg H_comp (mem_singleton_iff.mp h))⟩, rfl⟩ + · rintro ⟨δ, ⟨hδ, hδ_ne⟩, rfl⟩ + exact ⟨(hcomp δ hδ).1, fun heq => hδ_ne (hinj hδ hv_mem heq)⟩ + · rintro ⟨H', _, _, hH'G, hF', H'_comp, hinj', hcomp', hcomps'_eq⟩ + have hv_not_H' : v ∉ V(H') := by + intro hvH' + have := hH'G.vertexSet_mono hvH' + rw [vertexSet_deleteVerts, mem_sdiff, mem_singleton_iff] at this + exact this.2 rfl + let H := addIsolatedVertex H' v + let H_comp : Set α → Graph α β := fun δ => + if δ = {v} then Graph.noEdge ({v} : Set α) β else H'_comp δ + have hnoEdge_not_H' : ∀ δ ∈ Δ \ {{v}}, H'_comp δ ≠ Graph.noEdge ({v} : Set α) β := by + intro δ hδ heq + have hsub : V(H'_comp δ) ⊆ V(H') := (hcomp' δ hδ).1.1.vertexSet_mono + have hv_in : v ∈ V(H'_comp δ) := by rw [heq]; exact rfl + exact hv_not_H' (hsub hv_in) + refine ⟨H, hΔ, hΔ_sub, ?_, isGraphForest_addIsolatedVertex hF', H_comp, ?_, ?_, ?_⟩ + · refine ⟨union_subset (hH'G.vertexSet_mono.trans ?_) + (singleton_subset_iff.mpr hv_in_G), fun e x y hlink => ?_⟩ + · rw [vertexSet_deleteVerts] + exact sdiff_subset + · have h' : H'.IsLink e x y := hlink + exact (h'.mono hH'G).mono deleteVerts_le + · intro δ₁ hδ₁ δ₂ hδ₂ heq + dsimp only [H_comp] at heq + by_cases h1 : δ₁ = {v} <;> by_cases h2 : δ₂ = {v} + · rw [h1, h2] + · simp only [h1, h2, ↓reduceIte] at heq + exact absurd heq.symm (hnoEdge_not_H' δ₂ ⟨hδ₂, h2⟩) + · simp only [h1, h2, ↓reduceIte] at heq + exact absurd heq (hnoEdge_not_H' δ₁ ⟨hδ₁, h1⟩) + · simp only [h1, h2, ↓reduceIte] at heq + exact hinj' ⟨hδ₁, h1⟩ ⟨hδ₂, h2⟩ heq + · intro δ hδ + dsimp only [H_comp] + by_cases h : δ = {v} + · subst h + simp only [↓reduceIte] + exact ⟨isGraphComponent_noEdge_addIsolatedVertex hv_not_H', subset_rfl⟩ + · simp only [h, ↓reduceIte] + exact ⟨(isGraphComponent_addIsolatedVertex_iff hv_not_H').mpr + (Or.inr (hcomp' δ ⟨hδ, h⟩).1), (hcomp' δ ⟨hδ, h⟩).2⟩ + · ext K + change IsGraphComponent K (addIsolatedVertex H' v) ↔ K ∈ H_comp '' Δ + rw [isGraphComponent_addIsolatedVertex_iff hv_not_H', mem_image] + constructor + · rintro (rfl | hKH') + · refine ⟨{v}, hv_mem, ?_⟩ + simp [H_comp] + · have hK_mem : K ∈ graphComponents H' := hKH' + rw [hcomps'_eq] at hK_mem + obtain ⟨δ, ⟨hδ, hδ_ne⟩, rfl⟩ := hK_mem + refine ⟨δ, hδ, ?_⟩ + have hne : δ ≠ {v} := fun h => hδ_ne (mem_singleton_iff.mpr h) + simp [H_comp, hne] + · rintro ⟨δ, hδ, rfl⟩ + dsimp only [H_comp] + by_cases h : δ = {v} + · simp [h] + · simp only [h, ↓reduceIte] + exact Or.inr (hcomp' δ ⟨hδ, h⟩).1 + +/-- **Graph Minors VI, (3.3)(ii)** (page 120): +"If $G$ has a component $G'$ with no vertex in $\operatorname{bd}(\Sigma)$ then $\Delta$ is feasible +in $G$ if and only if it is feasible in the graph obtained from $G$ by deleting $V(G')$." -/ +theorem theorem_3_3_ii : Statement33ii.{u} := by + intro S _ G G' Δ hΔ hΔ_sub hG'_comp hdisj + have hΔ_del : divisionUnion Δ ⊆ V(G.toGraph.deleteVerts V(G')) := by + intro x hx + have hx_bd : x ∈ G.V ∩ bd S := hΔ_sub hx + rw [vertexSet_deleteVerts] + exact ⟨hx_bd.1, disjoint_right.mp hdisj hx_bd.2⟩ + constructor + · rintro ⟨H, _, _, hHG, hF, H_comp, hinj, hcomp, hcomps_eq⟩ + have hH_disj : Disjoint V(H) V(G') := by + refine disjoint_left.mpr fun x hxH hxG' => ?_ + have hcomp_x : compOf H x ∈ graphComponents H := isGraphComponent_compOf hxH + rw [hcomps_eq] at hcomp_x + obtain ⟨δ, hδ, hcomp_eq⟩ := hcomp_x + have hx_in_δcomp : x ∈ V(H_comp δ) := by + rw [hcomp_eq] + exact self_mem_reachSet hxH + obtain ⟨y, hyδ⟩ := hΔ.2.1 δ hδ + have hy_bd : y ∈ G.V ∩ bd S := hΔ_sub ⟨δ, hδ, hyδ⟩ + have hy_in_δcomp : y ∈ V(H_comp δ) := (hcomp δ hδ).2 hyδ + have hle_G' : H_comp δ ≤ G' := + hG'_comp.le_of_isGraphConnected ((hcomp δ hδ).1.1.trans hHG) (hcomp δ hδ).1.2.1 + hx_in_δcomp hxG' + exact disjoint_left.mp hdisj (hle_G'.vertexSet_mono hy_in_δcomp) hy_bd.2 + have hH_le : H ≤ G.toGraph.deleteVerts V(G') := by + refine ⟨?_, fun e u v hlink => ?_⟩ + · rw [vertexSet_deleteVerts] + exact subset_sdiff.mpr ⟨hHG.vertexSet_mono, hH_disj⟩ + · rw [deleteVerts_isLink] + exact ⟨hlink.mono hHG, disjoint_left.mp hH_disj hlink.left_mem, + disjoint_left.mp hH_disj hlink.right_mem⟩ + exact ⟨H, hΔ, hΔ_del, hH_le, hF, H_comp, hinj, hcomp, hcomps_eq⟩ + · rintro ⟨H, _, _, hH_del, hF, H_comp, hinj, hcomp, hcomps_eq⟩ + exact ⟨H, hΔ, hΔ_sub.trans inter_subset_left, hH_del.trans deleteVerts_le, + hF, H_comp, hinj, hcomp, hcomps_eq⟩ + +/-- **Graph Minors VI, (3.3)(iii)** (page 121): +"If there exists $\delta \in \Delta$ which intersects more than one component of $G$ then $\Delta$ +is not feasible in $G$." -/ +theorem theorem_3_3_iii : Statement33iii.{u, v} := by + intro α β G Δ δ G₁ G₂ hδ hG₁ hG₂ hne ⟨u, huδ, huG₁⟩ ⟨v, hvδ, hvG₂⟩ ⟨H, _, _, hHG, _, H_comp, _, + hcomp, _⟩ + have hu_comp : u ∈ V(H_comp δ) := (hcomp δ hδ).2 huδ + have hv_comp : v ∈ V(H_comp δ) := (hcomp δ hδ).2 hvδ + have hle₁ : H_comp δ ≤ G₁ := + hG₁.le_of_isGraphConnected ((hcomp δ hδ).1.1.trans hHG) (hcomp δ hδ).1.2.1 hu_comp huG₁ + have hvG₁ : v ∈ V(G₁) := hle₁.vertexSet_mono hv_comp + exact hne (hG₁.eq_of_mem_mem hG₂ hvG₁ hvG₂) + +/-- Union of a finite family of pairwise vertex-disjoint and edge-disjoint subgraphs of `G`. -/ +def graphUnionFamily {α : Type u} {β : Type v} {k : ℕ} (G : Graph α β) + (H_fam : Fin k → Graph α β) : Graph α β := + (G.restrict (⋃ i : Fin k, E(H_fam i))).induce (⋃ i : Fin k, V(H_fam i)) + +theorem graphUnionFamily_le {α : Type u} {β : Type v} {k : ℕ} (G : Graph α β) + (H_fam : Fin k → Graph α β) (hle : ∀ i : Fin k, H_fam i ≤ G) : + graphUnionFamily G H_fam ≤ G := by + refine (induce_le ?_).trans restrict_le + exact iUnion_subset fun i => (hle i).vertexSet_mono + +theorem le_graphUnionFamily {α : Type u} {β : Type v} {k : ℕ} (G : Graph α β) + (H_fam : Fin k → Graph α β) (hle : ∀ i : Fin k, H_fam i ≤ G) (i : Fin k) : + H_fam i ≤ graphUnionFamily G H_fam := by + refine ⟨subset_iUnion (fun j => V(H_fam j)) i, fun e x y hlink => ?_⟩ + simp only [graphUnionFamily, induce_isLink, restrict_isLink, mem_iUnion] + exact ⟨⟨⟨i, hlink.edge_mem⟩, hlink.mono (hle i)⟩, ⟨i, hlink.left_mem⟩, ⟨i, hlink.right_mem⟩⟩ + +theorem graphUnionFamily_isLink_iff {α : Type u} {β : Type v} {k : ℕ} (G : Graph α β) + (H_fam : Fin k → Graph α β) (hle : ∀ i : Fin k, H_fam i ≤ G) + (_hE_disj : Pairwise fun i j : Fin k => Disjoint E(H_fam i) E(H_fam j)) + {e : β} {x y : α} : + (graphUnionFamily G H_fam).IsLink e x y ↔ ∃ i : Fin k, (H_fam i).IsLink e x y := by + simp only [graphUnionFamily, induce_isLink, restrict_isLink, mem_iUnion] + constructor + · rintro ⟨⟨⟨i, hei⟩, hGlink⟩, _, _⟩ + exact ⟨i, ((hle i).isLink_iff hei).mpr hGlink⟩ + · rintro ⟨i, hlink⟩ + exact ⟨⟨⟨i, hlink.edge_mem⟩, hlink.mono (hle i)⟩, + ⟨i, hlink.left_mem⟩, ⟨i, hlink.right_mem⟩⟩ + +private def walkUnionToMember {α : Type u} {β : Type v} {k : ℕ} {G : Graph α β} + {H_fam : Fin k → Graph α β} (hle : ∀ i : Fin k, H_fam i ≤ G) + (hV_disj : Pairwise fun i j : Fin k => Disjoint V(H_fam i) V(H_fam j)) + (hE_disj : Pairwise fun i j : Fin k => Disjoint E(H_fam i) E(H_fam j)) + {i : Fin k} {x y : α} (hx : x ∈ V(H_fam i)) : + GraphWalk (graphUnionFamily G H_fam) x y → GraphWalk (H_fam i) x y + | .nil _ => .nil hx + | .cons h rest => + have hlink_i : (H_fam i).IsLink _ x _ := by + obtain ⟨j, hj⟩ := (graphUnionFamily_isLink_iff G H_fam hle hE_disj).mp h + rcases eq_or_ne i j with rfl | hne + · exact hj + · exact absurd hj.left_mem (disjoint_left.mp (hV_disj hne) hx) + .cons hlink_i (walkUnionToMember hle hV_disj hE_disj hlink_i.right_mem rest) + +@[simp] +private theorem support_walkUnionToMember {α : Type u} {β : Type v} {k : ℕ} {G : Graph α β} + {H_fam : Fin k → Graph α β} (hle : ∀ i : Fin k, H_fam i ≤ G) + (hV_disj : Pairwise fun i j : Fin k => Disjoint V(H_fam i) V(H_fam j)) + (hE_disj : Pairwise fun i j : Fin k => Disjoint E(H_fam i) E(H_fam j)) + {i : Fin k} {x y : α} (hx : x ∈ V(H_fam i)) + (W : GraphWalk (graphUnionFamily G H_fam) x y) : + (walkUnionToMember hle hV_disj hE_disj hx W).support = W.support := by + induction W with + | nil _ => rfl + | cons h rest ih => + simp [walkUnionToMember, GraphWalk.support, ih] + +@[simp] +private theorem edges_walkUnionToMember {α : Type u} {β : Type v} {k : ℕ} {G : Graph α β} + {H_fam : Fin k → Graph α β} (hle : ∀ i : Fin k, H_fam i ≤ G) + (hV_disj : Pairwise fun i j : Fin k => Disjoint V(H_fam i) V(H_fam j)) + (hE_disj : Pairwise fun i j : Fin k => Disjoint E(H_fam i) E(H_fam j)) + {i : Fin k} {x y : α} (hx : x ∈ V(H_fam i)) + (W : GraphWalk (graphUnionFamily G H_fam) x y) : + (walkUnionToMember hle hV_disj hE_disj hx W).edges = W.edges := by + induction W with + | nil _ => rfl + | cons h rest ih => + simp [walkUnionToMember, GraphWalk.edges, ih] + +theorem isGraphForest_graphUnionFamily {α : Type u} {β : Type v} {k : ℕ} {G : Graph α β} + {H_fam : Fin k → Graph α β} (hle : ∀ i : Fin k, H_fam i ≤ G) + (hV_disj : Pairwise fun i j : Fin k => Disjoint V(H_fam i) V(H_fam j)) + (hE_disj : Pairwise fun i j : Fin k => Disjoint E(H_fam i) E(H_fam j)) + (hF : ∀ i : Fin k, IsGraphForest (H_fam i)) : + IsGraphForest (graphUnionFamily G H_fam) := by + intro u W hW + cases W with + | nil _ => rfl + | cons h rest => + obtain ⟨i, hi⟩ := (graphUnionFamily_isLink_iff G H_fam hle hE_disj).mp h + let W' := walkUnionToMember hle hV_disj hE_disj hi.left_mem (.cons h rest) + have hW' : W'.IsSimpleClosed := by + refine ⟨?_, ?_⟩ + · rw [support_walkUnionToMember] + exact hW.1 + · rw [edges_walkUnionToMember] + exact hW.2 + have hlen : (GraphWalk.cons h rest).length = W'.length := by + simp [GraphWalk.length, W'] + rw [hlen] + exact hF i u W' hW' + +theorem compOf_graphUnionFamily_of_mem {α : Type u} {β : Type v} {k : ℕ} {G : Graph α β} + {H_fam : Fin k → Graph α β} (hle : ∀ i : Fin k, H_fam i ≤ G) + (hV_disj : Pairwise fun i j : Fin k => Disjoint V(H_fam i) V(H_fam j)) + (hE_disj : Pairwise fun i j : Fin k => Disjoint E(H_fam i) E(H_fam j)) + {i : Fin k} {x : α} (hx : x ∈ V(H_fam i)) : + compOf (graphUnionFamily G H_fam) x = compOf (H_fam i) x := by + have hreach : reachSet (graphUnionFamily G H_fam) x = reachSet (H_fam i) x := by + ext y + simp only [reachSet, mem_ofPred_eq] + constructor + · rintro ⟨_, ⟨W⟩⟩ + let W' := walkUnionToMember hle hV_disj hE_disj hx W + exact ⟨W'.mem_vertexSet_of_mem_support W'.end_mem_support, ⟨W'⟩⟩ + · rintro ⟨hy, ⟨W⟩⟩ + exact ⟨mem_iUnion.mpr ⟨i, hy⟩, ⟨W.mono (le_graphUnionFamily G H_fam hle i)⟩⟩ + refine Graph.ext ?_ fun e a b => ?_ + · simp [compOf, hreach] + · rw [compOf, compOf, induce_isLink, induce_isLink, hreach, + graphUnionFamily_isLink_iff G H_fam hle hE_disj] + constructor + · rintro ⟨⟨j, hj⟩, ha, hb⟩ + rcases eq_or_ne i j with rfl | hne + · exact ⟨hj, ha, hb⟩ + · exact absurd hj.left_mem (disjoint_left.mp (hV_disj hne) ha.1) + · rintro ⟨hi, ha, hb⟩ + exact ⟨⟨i, hi⟩, ha, hb⟩ + +theorem isGraphComponent_graphUnionFamily_iff {α : Type u} {β : Type v} {k : ℕ} + {G : Graph α β} {H_fam : Fin k → Graph α β} (hle : ∀ i : Fin k, H_fam i ≤ G) + (hV_disj : Pairwise fun i j : Fin k => Disjoint V(H_fam i) V(H_fam j)) + (hE_disj : Pairwise fun i j : Fin k => Disjoint E(H_fam i) E(H_fam j)) + {K : Graph α β} : + IsGraphComponent K (graphUnionFamily G H_fam) ↔ + ∃ i : Fin k, IsGraphComponent K (H_fam i) := by + constructor + · intro hK + obtain ⟨x, hxK⟩ := hK.2.1.1 + have hxU : x ∈ ⋃ i : Fin k, V(H_fam i) := hK.1.vertexSet_mono hxK + obtain ⟨i, hxi⟩ := mem_iUnion.mp hxU + refine ⟨i, ?_⟩ + rw [hK.eq_compOf_of_mem hxK, compOf_graphUnionFamily_of_mem hle hV_disj hE_disj hxi] + exact isGraphComponent_compOf hxi + · rintro ⟨i, hK⟩ + obtain ⟨x, hxK⟩ := hK.2.1.1 + have hxi : x ∈ V(H_fam i) := hK.1.vertexSet_mono hxK + rw [hK.eq_compOf_of_mem hxK, ← compOf_graphUnionFamily_of_mem hle hV_disj hE_disj hxi] + exact isGraphComponent_compOf (mem_iUnion.mpr ⟨i, hxi⟩) + +/-- **Graph Minors VI, (3.3)(iv)** (page 121): +"If $G$ has components $G_1, \dots, G_k$ for $k \ge 2$, and (ii), (iii) do not apply, let +$(\Delta_1, \dots, \Delta_k)$ be the partition of $\Delta$ such that* $$\bigcup \Delta_i = +V(G_i) \cap bd(\Sigma) \qquad (1 \le i \le k);$$ *then $\Delta$ is feasible in $G$ if and +only if $\Delta_i$ is feasible in $G_i$ for each $i$." -/ +theorem theorem_3_3_iv : Statement33iv.{u} := by + classical + intro S _ G Δ k G_comp Δ_part _hk hΔ hΔ_union hinj_G hG_comps hΔ_part hΔ_cov + have hG_comp : ∀ i : Fin k, IsGraphComponent (G_comp i) G.toGraph := by + intro i + have hmem : G_comp i ∈ graphComponents G.toGraph := by + rw [hG_comps] + exact mem_range_self i + exact hmem + have hG_V_disj : Pairwise fun i j : Fin k => Disjoint V(G_comp i) V(G_comp j) := + fun _ _ hne => (hG_comp _).disjoint_vertexSet_of_ne (hG_comp _) + (fun heq => hne (hinj_G trivial trivial heq)) + have hG_E_disj : Pairwise fun i j : Fin k => Disjoint E(G_comp i) E(G_comp j) := + fun _ _ hne => (hG_comp _).disjoint_edgeSet_of_ne (hG_comp _) + (fun heq => hne (hinj_G trivial trivial heq)) + have hsub_part : ∀ i : Fin k, Δ_part i ⊆ Δ := by + intro i δ hδ + rw [hΔ_part i] at hδ + exact hδ.1 + have hΔ_part_div : ∀ i : Fin k, IsDivision (Δ_part i) := by + intro i + exact ⟨hΔ.1.subset (hsub_part i), fun δ hδ => hΔ.2.1 δ (hsub_part i hδ), + hΔ.2.2.subset (hsub_part i)⟩ + have hΔ_part_sub : ∀ i : Fin k, divisionUnion (Δ_part i) ⊆ V(G_comp i) := by + intro i x ⟨δ, hδ, hxδ⟩ + rw [hΔ_part i] at hδ + exact hδ.2 hxδ + have hΔ_uniq_i : ∀ δ ∈ Δ, ∀ i j : Fin k, δ ⊆ V(G_comp i) → δ ⊆ V(G_comp j) → i = j := by + intro δ hδ i j hi hj + obtain ⟨x, hxδ⟩ := hΔ.2.1 δ hδ + by_contra hne + exact disjoint_left.mp (hG_V_disj hne) (hi hxδ) (hj hxδ) + constructor + · rintro ⟨H, _, _, hHG, hF, H_comp, hinj_H, hcomp_H, hcomps_H⟩ i + have hH_comp_in_Gi : ∀ δ ∈ Δ, ∀ j : Fin k, δ ⊆ V(G_comp j) → H_comp δ ≤ G_comp j := by + intro δ hδ j hsub + obtain ⟨y, hyδ⟩ := hΔ.2.1 δ hδ + exact (hG_comp j).le_of_isGraphConnected ((hcomp_H δ hδ).1.1.trans hHG) + (hcomp_H δ hδ).1.2.1 ((hcomp_H δ hδ).2 hyδ) (hsub hyδ) + let H_i := H.induce (V(H) ∩ V(G_comp i)) + have hHi_le_H : H_i ≤ H := H.induce_le inter_subset_left + have hHi_le_Gi : H_i ≤ G_comp i := by + refine ⟨inter_subset_right, fun e x y hlink => ?_⟩ + exact ((hG_comp i).isLink_iff_of_mem hlink.2.1.2).mpr (hlink.1.mono hHG) + have hcomp_in_Hi : ∀ K : Graph S (Set S), + IsGraphComponent K H_i ↔ ∃ δ ∈ Δ_part i, K = H_comp δ := by + intro K + constructor + · intro hK + obtain ⟨x, hxK⟩ := hK.2.1.1 + have hx_mem : x ∈ V(H) ∩ V(G_comp i) := hK.1.vertexSet_mono hxK + have hcomp_x : compOf H x ∈ graphComponents H := isGraphComponent_compOf hx_mem.1 + rw [hcomps_H] at hcomp_x + obtain ⟨δ, hδ, hcomp_eq⟩ := hcomp_x + obtain ⟨j, hj⟩ := hΔ_cov δ hδ + have hle_j : H_comp δ ≤ G_comp j := hH_comp_in_Gi δ hδ j hj + have hx_in_δ : x ∈ V(H_comp δ) := by + rw [hcomp_eq] + exact self_mem_reachSet hx_mem.1 + have hij : i = j := by + by_contra hne + exact disjoint_left.mp (hG_V_disj hne) hx_mem.2 (hle_j.vertexSet_mono hx_in_δ) + subst hij + have hδ_in_part : δ ∈ Δ_part i := by + rw [hΔ_part i] + exact ⟨hδ, hj⟩ + have hδ_le_Hi : H_comp δ ≤ H_i := by + refine ⟨subset_inter (hcomp_H δ hδ).1.1.vertexSet_mono hle_j.vertexSet_mono, + fun e u v hlink => ?_⟩ + exact ⟨hlink.mono (hcomp_H δ hδ).1.1, + ⟨(hcomp_H δ hδ).1.1.vertexSet_mono hlink.left_mem, + hle_j.vertexSet_mono hlink.left_mem⟩, + ⟨(hcomp_H δ hδ).1.1.vertexSet_mono hlink.right_mem, + hle_j.vertexSet_mono hlink.right_mem⟩⟩ + have hK_le_δ : K ≤ H_comp δ := + (hcomp_H δ hδ).1.le_of_isGraphConnected (hK.1.trans hHi_le_H) hK.2.1 hxK hx_in_δ + exact ⟨δ, hδ_in_part, (hK.2.2 (H_comp δ) hK_le_δ hδ_le_Hi (hcomp_H δ hδ).1.2.1).symm⟩ + · rintro ⟨δ, hδ_part, rfl⟩ + have hδ_part' := hδ_part + rw [hΔ_part i] at hδ_part' + have hle_i : H_comp δ ≤ G_comp i := hH_comp_in_Gi δ hδ_part'.1 i hδ_part'.2 + have hδ_le_Hi : H_comp δ ≤ H_i := by + refine ⟨subset_inter (hcomp_H δ hδ_part'.1).1.1.vertexSet_mono hle_i.vertexSet_mono, + fun e u v hlink => ?_⟩ + exact ⟨hlink.mono (hcomp_H δ hδ_part'.1).1.1, + ⟨(hcomp_H δ hδ_part'.1).1.1.vertexSet_mono hlink.left_mem, + hle_i.vertexSet_mono hlink.left_mem⟩, + ⟨(hcomp_H δ hδ_part'.1).1.1.vertexSet_mono hlink.right_mem, + hle_i.vertexSet_mono hlink.right_mem⟩⟩ + refine ⟨hδ_le_Hi, (hcomp_H δ hδ_part'.1).1.2.1, fun K' hle hK'Hi hK'conn => ?_⟩ + exact (hcomp_H δ hδ_part'.1).1.2.2 K' hle (hK'Hi.trans hHi_le_H) hK'conn + refine ⟨H_i, hΔ_part_div i, hΔ_part_sub i, hHi_le_Gi, isGraphForest_of_le hHi_le_H hF, + H_comp, hinj_H.mono (hsub_part i), ?_, ?_⟩ + · intro δ hδ + exact ⟨(hcomp_in_Hi (H_comp δ)).mpr ⟨δ, hδ, rfl⟩, (hcomp_H δ (hsub_part i hδ)).2⟩ + · ext K + change IsGraphComponent K H_i ↔ K ∈ H_comp '' Δ_part i + rw [hcomp_in_Hi, mem_image] + exact ⟨fun ⟨δ, hδ, heq⟩ => ⟨δ, hδ, heq.symm⟩, fun ⟨δ, hδ, heq⟩ => ⟨δ, hδ, heq.symm⟩⟩ + · intro hFeas + choose H_fam hReal using hFeas + have hle_G : ∀ i : Fin k, H_fam i ≤ G.toGraph := + fun i => (hReal i).2.2.1.trans (hG_comp i).1 + have hV_disj : Pairwise fun i j : Fin k => Disjoint V(H_fam i) V(H_fam j) := + fun i j hne => (hG_V_disj hne).mono (hReal i).2.2.1.vertexSet_mono + (hReal j).2.2.1.vertexSet_mono + have hE_disj : Pairwise fun i j : Fin k => Disjoint E(H_fam i) E(H_fam j) := + fun i j hne => (hG_E_disj hne).mono (hReal i).2.2.1.edgeSet_mono + (hReal j).2.2.1.edgeSet_mono + choose H_comp_fam hinj_fam hcomp_fam hcomps_fam using fun i => (hReal i).2.2.2.2 + have hΔ_cov_all : ∀ δ : Set S, ∃ i : Fin k, δ ∈ Δ → δ ⊆ V(G_comp i) := by + intro δ + by_cases hδ : δ ∈ Δ + · obtain ⟨i, hi⟩ := hΔ_cov δ hδ + exact ⟨i, fun _ => hi⟩ + · exact ⟨⟨0, by omega⟩, fun h => False.elim (hδ h)⟩ + choose idxOf hidxOf_sub using hΔ_cov_all + have hidxOf_spec : ∀ δ ∈ Δ, δ ∈ Δ_part (idxOf δ) := by + intro δ hδ + rw [hΔ_part (idxOf δ)] + exact ⟨hδ, hidxOf_sub δ hδ⟩ + have hidxOf_eq : ∀ δ ∈ Δ, ∀ i : Fin k, δ ∈ Δ_part i → idxOf δ = i := by + intro δ hδ i hi + rw [hΔ_part i] at hi + exact hΔ_uniq_i δ hδ (idxOf δ) i (hidxOf_sub δ hδ) hi.2 + let H := graphUnionFamily G.toGraph H_fam + let H_comp : Set S → Graph S (Set S) := fun δ => H_comp_fam (idxOf δ) δ + have hΔ_sub_G : divisionUnion Δ ⊆ V(G.toGraph) := by + rw [hΔ_union] + exact inter_subset_left + refine ⟨H, hΔ, hΔ_sub_G, + graphUnionFamily_le G.toGraph H_fam hle_G, + isGraphForest_graphUnionFamily hle_G hV_disj hE_disj (fun i => (hReal i).2.2.2.1), + H_comp, ?_, ?_, ?_⟩ + · intro δ₁ hδ₁ δ₂ hδ₂ heq + have h1 := hidxOf_spec δ₁ hδ₁ + have h2 := hidxOf_spec δ₂ hδ₂ + obtain ⟨x, hx⟩ := (hcomp_fam (idxOf δ₁) δ₁ h1).1.2.1.1 + have hx1 : x ∈ V(H_fam (idxOf δ₁)) := + (hcomp_fam (idxOf δ₁) δ₁ h1).1.1.vertexSet_mono hx + have hx2 : x ∈ V(H_fam (idxOf δ₂)) := by + have hx' : x ∈ V(H_comp δ₂) := heq ▸ hx + exact (hcomp_fam (idxOf δ₂) δ₂ h2).1.1.vertexSet_mono hx' + have hij : idxOf δ₁ = idxOf δ₂ := by + by_contra hne + exact disjoint_left.mp (hV_disj hne) hx1 hx2 + dsimp only [H_comp] at heq + rw [← hij] at heq h2 + exact hinj_fam (idxOf δ₁) h1 h2 heq + · intro δ hδ + have h_part := hidxOf_spec δ hδ + exact ⟨(isGraphComponent_graphUnionFamily_iff hle_G hV_disj hE_disj).mpr + ⟨idxOf δ, (hcomp_fam (idxOf δ) δ h_part).1⟩, + (hcomp_fam (idxOf δ) δ h_part).2⟩ + · ext K + change IsGraphComponent K (graphUnionFamily G.toGraph H_fam) ↔ K ∈ H_comp '' Δ + rw [isGraphComponent_graphUnionFamily_iff hle_G hV_disj hE_disj, mem_image] + constructor + · rintro ⟨i, hKi⟩ + have hK_mem : K ∈ graphComponents (H_fam i) := hKi + rw [hcomps_fam i] at hK_mem + obtain ⟨δ, hδ_i, rfl⟩ := hK_mem + have hδ : δ ∈ Δ := by rw [hΔ_part i] at hδ_i; exact hδ_i.1 + refine ⟨δ, hδ, ?_⟩ + dsimp only [H_comp] + rw [hidxOf_eq δ hδ i hδ_i] + · rintro ⟨δ, hδ, rfl⟩ + exact ⟨idxOf δ, (hcomp_fam (idxOf δ) δ (hidxOf_spec δ hδ)).1⟩ + +/-- **Graph Minors VI, (3.3)** (pages 120–121): +"(3.3) (i) *If $|\delta| = 1$ for some $\delta \in \Delta$, and $\delta = \{v\}$ say, then $\Delta$ +is feasible in $G$ if and only if $\Delta - \{\delta\}$ is feasible in the graph obtained from $G$ +by deleting $v$.* +(ii) *If $G$ has a component $G'$ with no vertex in $bd(\Sigma)$ then $\Delta$ is feasible in $G$ if +and only if it is feasible in the graph obtained from $G$ by deleting $V(G')$.* +(iii) *If there exists $\delta \in \Delta$ which intersects more than one component of $G$ then +$\Delta$ is not feasible in $G$.* +(iv) *If $G$ has components $G_1, \dots, G_k$ for $k \ge 2$, and (ii), (iii) do not apply, let +$(\Delta_1, \dots, \Delta_k)$ be the partition of $\Delta$ such that* $$\bigcup \Delta_i = V(G_i) +\cap bd(\Sigma) \qquad (1 \le i \le k);$$ *then $\Delta$ is feasible in $G$ if and only if +$\Delta_i$ +is feasible in $G_i$ for each $i$.*" -/ +theorem theorem_3_3_proof : + Statement33i.{u, v} ∧ Statement33ii.{u} ∧ Statement33iii.{u, v} ∧ Statement33iv.{u} := + ⟨theorem_3_3_i, theorem_3_3_ii, theorem_3_3_iii, theorem_3_3_iv⟩ + +/-! ## 4. Proof of Theorem (3.5) -/ + +private theorem not_compactSpace_Ioo : ¬ CompactSpace (Ioo (0 : ℝ) 1) := by + intro h + have hcomp : IsCompact (Ioo (0 : ℝ) 1) := isCompact_iff_compactSpace.mpr h + have hcl : IsClosed (Ioo (0 : ℝ) 1) := hcomp.isClosed + have hmem : (0 : ℝ) ∈ Ioo (0 : ℝ) 1 := by + rw [← hcl.closure_eq, closure_Ioo zero_ne_one] + exact left_mem_Icc.mpr zero_le_one + exact lt_irrefl 0 hmem.1 + +theorem nonempty_of_mem_segmentsOf {S : Type u} [TopologicalSpace S] {C V seg : Set S} + (hC : IsOArc C) (hseg : seg ∈ segmentsOf C V) : V.Nonempty := by + by_contra hne + rw [not_nonempty_iff_eq_empty] at hne + subst hne + obtain ⟨φ⟩ := hC + have hEmpty : oArcMap φ '' (∅ : Set Circle) = ∅ := image_empty _ + rw [← hEmpty, segmentsOf_oArcMap] at hseg + obtain ⟨seg₀, ⟨⟨z, _, rfl⟩, ⟨e⟩⟩, _⟩ := hseg + have hseg₀_univ : connectedComponentIn ((univ : Set Circle) \ ∅) z = univ := by + rw [sdiff_empty, connectedComponentIn_univ] + exact PreconnectedSpace.connectedComponent_eq_univ z + rw [hseg₀_univ] at e + have hcomp : CompactSpace (Ioo (0 : ℝ) 1) := + (e.trans (Homeomorph.Set.univ Circle)).symm.compactSpace + exact not_compactSpace_Ioo hcomp + +theorem connectedComponentIn_mem_segmentsOf {S : Type u} [TopologicalSpace S] + {C V : Set S} (hC : IsOArc C) (hV_fin : V.Finite) (hV_sub : V ⊆ C) (hV_ne : V.Nonempty) + {w : S} (hw : w ∈ C \ V) : + connectedComponentIn (C \ V) w ∈ segmentsOf C V := by + obtain ⟨φ⟩ := hC + have hinj := injective_oArcMap φ + have hemb := isEmbedding_oArcMap φ + let V₀ := oArcMap φ ⁻¹' V + have hV_eq : oArcMap φ '' V₀ = V := + image_preimage_eq_of_subset (hV_sub.trans (range_oArcMap φ).symm.subset) + have hV₀_fin : V₀.Finite := by + refine Finite.of_finite_image ?_ hinj.injOn + rwa [hV_eq] + have hV₀_ne : V₀.Nonempty := by + obtain ⟨v, hv⟩ := hV_ne + rw [← hV_eq] at hv + obtain ⟨v₀, hv₀, _⟩ := hv + exact ⟨v₀, hv₀⟩ + let w₀ := φ.symm ⟨w, hw.1⟩ + have hw₀_map : oArcMap φ w₀ = w := by simp [oArcMap, w₀] + have hw₀_compl : w₀ ∈ V₀ᶜ := by + intro h + apply hw.2 + rw [← hV_eq, ← hw₀_map] + exact mem_image_of_mem (oArcMap φ) h + rw [← hV_eq, segmentsOf_oArcMap, diff_image_oArcMap] + refine ⟨connectedComponentIn V₀ᶜ w₀, ?_, ?_⟩ + · obtain ⟨v₀, ⟨hv₀, hw₀v₀⟩, _⟩ := exists_unique_nextSegment_of_mem_compl hV₀_fin hV₀_ne hw₀_compl + rw [connectedComponentIn_compl_eq_nextSegment hV₀_fin hv₀ hw₀v₀] + exact nextSegment_mem_segmentsOf_univ hV₀_fin hv₀ + · rw [← hw₀_map, isEmbedding_image_connectedComponentIn hemb hw₀_compl] + +/-- In a dual drawing pair `(G, G_dual)` on a closed disc `S`, a dual vertex `w ∈ r ∩ G_dual.V` +(for `r ∈ G.R`) lies in `bd S` if and only if `r` is peripheral in `G`. -/ +private theorem dual_vertex_mem_bd_iff_peripheral {S : Type u} [TopologicalSpace S] + {G G_dual : Drawing S} (hC : IsOArc (bd S)) (hDual : IsDiscDualDrawingPair G G_dual) + {r : Set S} (hr : r ∈ G.R) {w : S} (hw : w ∈ r ∧ w ∈ G_dual.V) : + w ∈ bd S ↔ ∃ seg ∈ segmentsOf (bd S) (G.V ∩ bd S), seg ⊆ r := by + have hG_prop : G.IsProper := hDual.1 + have hV_disj : G.V ∩ G_dual.V = ∅ := hDual.2.2.1 + have hR_uniq := hDual.2.2.2.1 + have hU1 : IsDualPointSet (bd S) (G.V ∩ bd S) (G_dual.V ∩ bd S) := + hDual.2.2.2.2.2.2.2.2.1 + have hbd_sub_compl : bd S \ (G.V ∩ bd S) ⊆ univ \ G.U := by + rintro z ⟨hz_bd, hz_not⟩ + refine ⟨trivial, fun hzU => hz_not ⟨hG_prop ⟨hz_bd, hzU⟩, hz_bd⟩⟩ + have hr_eq : r = connectedComponentIn (univ \ G.U) w := by + obtain ⟨z, hz, rfl⟩ := hr + exact connectedComponentIn_eq hw.1 + constructor + · intro hw_bd + have hw_not_V : w ∉ G.V := fun hwV => by + have : w ∈ G.V ∩ G_dual.V := ⟨hwV, hw.2⟩ + rw [hV_disj] at this + exact this + have hw_diff : w ∈ bd S \ (G.V ∩ bd S) := ⟨hw_bd, fun h => hw_not_V h.1⟩ + have hV_ne : (G.V ∩ bd S).Nonempty := by + by_contra hne + rw [not_nonempty_iff_eq_empty] at hne + have hEmpty := hU1.1 hne + have hw_in : w ∈ G_dual.V ∩ bd S := ⟨hw.2, hw_bd⟩ + rw [hEmpty] at hw_in + exact hw_in + have hV_fin : (G.V ∩ bd S).Finite := G.finite_V.subset inter_subset_left + refine ⟨connectedComponentIn (bd S \ (G.V ∩ bd S)) w, + connectedComponentIn_mem_segmentsOf hC hV_fin inter_subset_right hV_ne hw_diff, ?_⟩ + rw [hr_eq] + exact isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn hw_diff) + ((connectedComponentIn_subset _ _).trans hbd_sub_compl) + · rintro ⟨seg, hseg, hseg_sub⟩ + have hV_ne : (G.V ∩ bd S).Nonempty := nonempty_of_mem_segmentsOf hC hseg + have hcard := (hU1.2 hV_ne).2 seg hseg + obtain ⟨w', hw'_mem⟩ := nonempty_of_ncard_ne_zero (by omega : ((G_dual.V ∩ bd S) ∩ seg).ncard ≠ + 0) + have hw'_eq : w' = w := + (hR_uniq r hr).unique ⟨hseg_sub hw'_mem.2, hw'_mem.1.1⟩ hw + exact hw'_eq ▸ hw'_mem.1.2 + +open Classical in +/-- Map a chain term of `G_dual` to the corresponding chain term of `G`. -/ +private noncomputable def dualChainTerm {S : Type u} [TopologicalSpace S] (G : Drawing S) : + ChainTerm S → ChainTerm S + | .inl w => .inr (connectedComponentIn (univ \ G.U) w) + | .inr r_dual => + if h : ∃ v, v ∈ r_dual ∧ v ∈ G.V then .inl (Classical.choose h) else .inr r_dual + +private theorem dualChainTerm_inr_eq {S : Type u} [TopologicalSpace S] + {G G_dual : Drawing S} (hDual : IsDiscDualDrawingPair G G_dual) + {r_dual : Set S} (hr : r_dual ∈ G_dual.R) {v : S} (hv : v ∈ r_dual ∧ v ∈ G.V) : + dualChainTerm G (.inr r_dual) = .inl v := by + have hex : ∃ v', v' ∈ r_dual ∧ v' ∈ G.V := ⟨v, hv⟩ + dsimp only [dualChainTerm] + simp only [hex, ↓reduceDIte] + congr 1 + exact (hDual.2.2.2.2.2.1 r_dual hr).unique (Classical.choose_spec hex) hv + +private theorem dualChainTerm_valid {S : Type u} [TopologicalSpace S] + {G G_dual : Drawing S} (hDual : IsDiscDualDrawingPair G G_dual) + {t : ChainTerm S} (ht : t.IsValid G_dual) : + (dualChainTerm G t).IsValid G := by + cases t with + | inl w => + obtain ⟨r, hr, hwr⟩ := hDual.2.2.2.2.1 w ht + obtain ⟨z, hz, rfl⟩ := hr + have heq : connectedComponentIn (univ \ G.U) w = connectedComponentIn (univ \ G.U) z := + (connectedComponentIn_eq hwr).symm + dsimp only [dualChainTerm, ChainTerm.IsValid] + rw [heq] + exact ⟨z, hz, rfl⟩ + | inr r_dual => + obtain ⟨v, hv, _⟩ := hDual.2.2.2.2.2.1 r_dual ht + rw [dualChainTerm_inr_eq hDual ht hv] + exact hv.2 + +private theorem dualChainTerm_isVertex_iff {S : Type u} [TopologicalSpace S] + {G G_dual : Drawing S} (hDual : IsDiscDualDrawingPair G G_dual) + {t : ChainTerm S} (ht : t.IsValid G_dual) : + (dualChainTerm G t).IsVertex ↔ ¬ t.IsVertex := by + cases t with + | inl w => + simp [dualChainTerm, ChainTerm.IsVertex] + | inr r_dual => + obtain ⟨v, hv, _⟩ := hDual.2.2.2.2.2.1 r_dual ht + rw [dualChainTerm_inr_eq hDual ht hv] + simp [ChainTerm.IsVertex] + +private theorem dualChainTerm_areIncident {S : Type u} [TopologicalSpace S] + {G G_dual : Drawing S} (hDual : IsDiscDualDrawingPair G G_dual) + {t₁ t₂ : ChainTerm S} (hinc : ChainTerm.AreIncident G_dual t₁ t₂) : + ChainTerm.AreIncident G (dualChainTerm G t₁) (dualChainTerm G t₂) := by + cases t₁ with + | inl w => + cases t₂ with + | inl _ => exact False.elim hinc + | inr r_dual => + rcases hinc with ⟨hw, hr_dual, hw_cl⟩ + obtain ⟨r, hr, hwr⟩ := hDual.2.2.2.2.1 w hw + have hr_eq : connectedComponentIn (univ \ G.U) w = r := by + obtain ⟨z, hz, rfl⟩ := hr + exact (connectedComponentIn_eq hwr).symm + obtain ⟨v, hv, _⟩ := hDual.2.2.2.2.2.1 r_dual hr_dual + rw [dualChainTerm_inr_eq hDual hr_dual hv] + dsimp only [dualChainTerm, ChainTerm.AreIncident] + rw [hr_eq] + exact ⟨hv.2, hr, (hDual.2.2.2.2.2.2.2.1 v hv.2 r hr w ⟨hwr, hw⟩ r_dual hr_dual hv.1).mpr + hw_cl⟩ + | inr r_dual => + cases t₂ with + | inl w => + rcases hinc with ⟨hw, hr_dual, hw_cl⟩ + obtain ⟨r, hr, hwr⟩ := hDual.2.2.2.2.1 w hw + have hr_eq : connectedComponentIn (univ \ G.U) w = r := by + obtain ⟨z, hz, rfl⟩ := hr + exact (connectedComponentIn_eq hwr).symm + obtain ⟨v, hv, _⟩ := hDual.2.2.2.2.2.1 r_dual hr_dual + rw [dualChainTerm_inr_eq hDual hr_dual hv] + dsimp only [dualChainTerm, ChainTerm.AreIncident] + rw [hr_eq] + exact ⟨hv.2, hr, (hDual.2.2.2.2.2.2.2.1 v hv.2 r hr w ⟨hwr, hw⟩ r_dual hr_dual hv.1).mpr + hw_cl⟩ + | inr _ => exact False.elim hinc + +private theorem dualChainTerm_isPeripheral_iff {S : Type u} [TopologicalSpace S] + {G G_dual : Drawing S} (hC : IsOArc (bd S)) (hDual : IsDiscDualDrawingPair G G_dual) + {t : ChainTerm S} (ht : t.IsValid G_dual) : + (dualChainTerm G t).IsPeripheral G ↔ t.IsPeripheral G_dual := by + cases t with + | inl w => + obtain ⟨r, hr, hwr⟩ := hDual.2.2.2.2.1 w ht + have hr_eq : connectedComponentIn (univ \ G.U) w = r := by + obtain ⟨z, hz, rfl⟩ := hr + exact (connectedComponentIn_eq hwr).symm + dsimp only [dualChainTerm, ChainTerm.IsPeripheral] + rw [hr_eq] + exact ⟨fun ⟨_, hseg⟩ => ⟨ht, (dual_vertex_mem_bd_iff_peripheral hC hDual hr ⟨hwr, ht⟩).mpr + hseg⟩, + fun ⟨_, hw_bd⟩ => ⟨hr, (dual_vertex_mem_bd_iff_peripheral hC hDual hr ⟨hwr, ht⟩).mp hw_bd⟩⟩ + | inr r_dual => + obtain ⟨v, hv, _⟩ := hDual.2.2.2.2.2.1 r_dual ht + rw [dualChainTerm_inr_eq hDual ht hv] + dsimp only [ChainTerm.IsPeripheral] + have hiff := dual_vertex_mem_bd_iff_peripheral hC hDual.symm ht hv + exact ⟨fun ⟨_, hv_bd⟩ => ⟨ht, hiff.mp hv_bd⟩, fun ⟨_, hseg⟩ => ⟨hv.2, hiff.mpr hseg⟩⟩ + +private theorem dualChainTerm_matchesEnd {S : Type u} [TopologicalSpace S] + {G G_dual : Drawing S} (hDual : IsDiscDualDrawingPair G G_dual) + {z : S} (hz : z ∈ G_dual.V ∪ G.V) {t : ChainTerm S} (ht : t.IsValid G_dual) + (hm : t.MatchesEnd z) : + (dualChainTerm G t).MatchesEnd z ∧ (z ∈ G_dual.V ↔ t.IsVertex) ∧ (z ∈ G.V ↔ ¬ t.IsVertex) := by + have hV_disj : G.V ∩ G_dual.V = ∅ := hDual.2.2.1 + cases t with + | inl w => + dsimp only [ChainTerm.MatchesEnd] at hm + subst hm + obtain ⟨r, hr, hwr⟩ := hDual.2.2.2.2.1 w ht + have hw_compl : w ∈ univ \ G.U := by + obtain ⟨x₀, _, rfl⟩ := hr + exact connectedComponentIn_subset _ _ hwr + have hw_not_GV : w ∉ G.V := fun hwG => by + have : w ∈ G.V ∩ G_dual.V := ⟨hwG, ht⟩ + rw [hV_disj] at this + exact this + dsimp only [dualChainTerm, ChainTerm.MatchesEnd, ChainTerm.IsVertex] + exact ⟨mem_connectedComponentIn hw_compl, + ⟨fun _ => trivial, fun _ => ht⟩, + ⟨fun h => False.elim (hw_not_GV h), fun h => False.elim (h trivial)⟩⟩ + | inr r_dual => + dsimp only [ChainTerm.MatchesEnd] at hm + obtain ⟨v, hv, huniq⟩ := hDual.2.2.2.2.2.1 r_dual ht + rw [dualChainTerm_inr_eq hDual ht hv] + have hz_compl : z ∈ univ \ G_dual.U := by + obtain ⟨x₀, _, rfl⟩ := ht + exact connectedComponentIn_subset _ _ hm + have hz_not_GdV : z ∉ G_dual.V := fun hzGd => hz_compl.2 (G_dual.V_subset_U hzGd) + have hz_GV : z ∈ G.V := by + rcases hz with hzGd | hzG + · exact False.elim (hz_not_GdV hzGd) + · exact hzG + have hvz : v = z := (huniq z ⟨hm, hz_GV⟩).symm + dsimp only [ChainTerm.MatchesEnd, ChainTerm.IsVertex] + exact ⟨hvz, + ⟨fun h => False.elim (hz_not_GdV h), fun h => False.elim h⟩, + ⟨fun _ => not_false, fun _ => hz_GV⟩⟩ + +private def chainNonVertexLength {S : Type u} (A : List (ChainTerm S)) : ℕ := + (A.filter (fun t => !decide t.IsVertex)).length + +private theorem chainLength_map_dualChainTerm {S : Type u} [TopologicalSpace S] + {G G_dual : Drawing S} (hDual : IsDiscDualDrawingPair G G_dual) + {A_dual : List (ChainTerm S)} (hvalid : ∀ t ∈ A_dual, t.IsValid G_dual) : + chainLength (A_dual.map (dualChainTerm G)) = chainNonVertexLength A_dual := by + unfold chainLength chainNonVertexLength + induction A_dual with + | nil => rfl + | cons a rest ih => + have ha : a.IsValid G_dual := hvalid a List.mem_cons_self + have hrest : ∀ t ∈ rest, t.IsValid G_dual := + fun t ht => hvalid t (List.mem_cons_of_mem a ht) + have hiff : decide (dualChainTerm G a).IsVertex = !decide a.IsVertex := by + rw [← decide_not] + exact decide_eq_decide.mpr (dualChainTerm_isVertex_iff hDual ha) + simp only [List.map_cons, List.filter_cons, hiff] + cases (!decide a.IsVertex) <;> simp [ih hrest] + +private theorem isChain_map_of_imp {α β : Type*} {R₁ : α → α → Prop} {R₂ : β → β → Prop} + (f : α → β) (himp : ∀ a b, R₁ a b → R₂ (f a) (f b)) : + ∀ L : List α, L.IsChain R₁ → (L.map f).IsChain R₂ + | [], _ => List.isChain_nil + | [_], _ => List.isChain_singleton _ + | a :: b :: rest, h => by + obtain ⟨hab, hrest⟩ := List.isChain_cons_cons.mp h + exact List.isChain_cons_cons.mpr ⟨himp a b hab, isChain_map_of_imp f himp (b :: rest) hrest⟩ + +private theorem alternating_chainLength_diff {S : Type u} : + ∀ (L : List (ChainTerm S)) (hL : L ≠ []), + L.IsChain (fun a b => (a.IsVertex ↔ ¬ b.IsVertex)) → + (((L.head hL).IsVertex ∧ (L.getLast hL).IsVertex → + (chainLength L : ℤ) - (chainNonVertexLength L : ℤ) = 1) ∧ + (¬ (L.head hL).IsVertex ∧ ¬ (L.getLast hL).IsVertex → + (chainLength L : ℤ) - (chainNonVertexLength L : ℤ) = -1) ∧ + (¬ ((L.head hL).IsVertex ∧ (L.getLast hL).IsVertex) → + ¬ (¬ (L.head hL).IsVertex ∧ ¬ (L.getLast hL).IsVertex) → + (chainLength L : ℤ) - (chainNonVertexLength L : ℤ) = 0)) + | [], hL, _ => False.elim (hL rfl) + | [a], _, _ => by + by_cases ha : a.IsVertex <;> + simp [chainLength, chainNonVertexLength, ha] + | a :: b :: rest, _, hChain => by + obtain ⟨hab, hrest⟩ := List.isChain_cons_cons.mp hChain + have hne : b :: rest ≠ [] := List.cons_ne_nil b rest + have ih := alternating_chainLength_diff (b :: rest) hne hrest + have hlast : (a :: b :: rest).getLast (List.cons_ne_nil a _) = (b :: rest).getLast hne := + List.getLast_cons hne + have hhead_b : (b :: rest).head hne = b := rfl + rw [hhead_b] at ih + by_cases ha : a.IsVertex + · have hb : ¬ b.IsVertex := hab.mp ha + have hlen_v : chainLength (a :: b :: rest) = chainLength (b :: rest) + 1 := by + simp [chainLength, ha] + have hlen_r : chainNonVertexLength (a :: b :: rest) = chainNonVertexLength (b :: rest) := by + simp [chainNonVertexLength, ha] + by_cases hl : ((b :: rest).getLast hne).IsVertex + · have ih0 := ih.2.2 (fun h => hb h.1) (fun h => h.2 hl) + refine ⟨fun _ => by omega, fun h => False.elim (h.1 ha), fun h1 _ => ?_⟩ + exact False.elim (h1 ⟨ha, by rwa [hlast]⟩) + · have ih1 := ih.2.1 ⟨hb, hl⟩ + refine ⟨fun h => False.elim (hl (hlast ▸ h.2)), fun h => False.elim (h.1 ha), + fun _ _ => by omega⟩ + · have hb : b.IsVertex := by + by_contra hnb + exact ha (hab.mpr hnb) + have hlen_v : chainLength (a :: b :: rest) = chainLength (b :: rest) := by + simp [chainLength, ha] + have hlen_r : chainNonVertexLength (a :: b :: rest) = + chainNonVertexLength (b :: rest) + 1 := by + simp [chainNonVertexLength, ha] + by_cases hl : ((b :: rest).getLast hne).IsVertex + · have ih1 := ih.1 ⟨hb, hl⟩ + refine ⟨fun h => False.elim (ha h.1), fun h => False.elim (h.2 (hlast ▸ hl)), + fun _ _ => by omega⟩ + · have ih0 := ih.2.2 (fun h => hl h.2) (fun h => h.1 hb) + refine ⟨fun h => False.elim (ha h.1), fun _ => by omega, fun _ h2 => ?_⟩ + exact False.elim (h2 ⟨ha, by rwa [hlast]⟩) + +/-- **Graph Minors VI, (3.5)** (page 121): +"If $G$ is connected, any $(x, y)$-chain of $G^*$ corresponds to an $(x, y)$-chain of $G$, and if +$\Delta$ is cross-free the $\Delta^*$-redundancy of the first chain equals the $\Delta$-redundancy +of the second." -/ +theorem theorem_3_5_proof : Statement35.{u} := by + intro S _ G G_dual Δ x y A_dual hS hConn hΔ hΔ_union hCF hDual₀ hx hy hChain + have hDual : IsDiscDualDrawingPair G G_dual := hDual₀.to_pair hS hConn + have hC : IsOArc (bd S) := hS.isOArc_bd + have hV_fin : (divisionUnion Δ).Finite := by + rw [hΔ_union] + exact G.finite_V.subset inter_subset_left + have hV_sub : divisionUnion Δ ⊆ bd S := by + rw [hΔ_union] + exact inter_subset_right + have hU1 : IsDualPointSet (bd S) (divisionUnion Δ) (G_dual.V ∩ bd S) := by + rw [hΔ_union] + exact hDual.2.2.2.2.2.2.2.2.1 + let A := A_dual.map (dualChainTerm G) + have hA_ne : A ≠ [] := by + simp [A, hChain.ne_nil] + have hx_V : x ∈ G_dual.V ∪ G.V := by + rw [hΔ_union] at hx + rcases hx with hx | hx + · exact Or.inl hx.1 + · exact Or.inr hx.1 + have hy_V : y ∈ G_dual.V ∪ G.V := by + rw [hΔ_union] at hy + rcases hy with hy | hy + · exact Or.inl hy.1 + · exact Or.inr hy.1 + have hhead_valid : (A_dual.head hChain.ne_nil).IsValid G_dual := + hChain.valid _ (List.head_mem hChain.ne_nil) + have hlast_valid : (A_dual.getLast hChain.ne_nil).IsValid G_dual := + hChain.valid _ (List.getLast_mem hChain.ne_nil) + have hhead_match := dualChainTerm_matchesEnd hDual hx_V hhead_valid hChain.head_matches + have hlast_match := dualChainTerm_matchesEnd hDual hy_V hlast_valid hChain.last_matches + refine ⟨A, ?_, ?_⟩ + · refine ⟨hA_ne, ?_, ?_, ?_, ?_, ?_⟩ + · intro t ht + obtain ⟨t₀, ht₀, rfl⟩ := List.mem_map.mp ht + exact dualChainTerm_valid hDual (hChain.valid t₀ ht₀) + · exact isChain_map_of_imp (dualChainTerm G) + (fun a b hab => dualChainTerm_areIncident hDual hab) A_dual hChain.isChain + · rw [List.head_map] + exact hhead_match.1 + · rw [List.getLast_map] + exact hlast_match.1 + · intro i + have hi_lt : i.1 < A_dual.length := by + have := i.2 + simpa [A] using this + let i₀ : Fin A_dual.length := ⟨i.1, hi_lt⟩ + have hget : A[i] = dualChainTerm G A_dual[i₀] := by simp [A, i₀] + have hlen_iff : (i.1 = 0 ∨ i.1 + 1 = A.length) ↔ (i₀.1 = 0 ∨ i₀.1 + 1 = A_dual.length) := by + simp [A, i₀] + have hvalid_i₀ : A_dual[i₀].IsValid G_dual := + hChain.valid _ (List.getElem_mem i₀.2) + rw [hget, hlen_iff, dualChainTerm_isPeripheral_iff hC hDual hvalid_i₀] + exact hChain.peripheral_iff i₀ + · have hlen_A : chainLength A = chainNonVertexLength A_dual := + chainLength_map_dualChainTerm hDual hChain.valid + have halt : A_dual.IsChain (fun a b => (a.IsVertex ↔ ¬ b.IsVertex)) := by + refine hChain.isChain.imp fun a b hab => ?_ + cases a <;> cases b <;> simp [ChainTerm.AreIncident, ChainTerm.IsVertex] at hab ⊢ + have hdiff_L := alternating_chainLength_diff A_dual hChain.ne_nil halt + have hx_W : x ∈ divisionUnion Δ ∪ (G_dual.V ∩ bd S) := hx.symm + have hy_W : y ∈ divisionUnion Δ ∪ (G_dual.V ∩ bd S) := hy.symm + have hdiff_Δ := theorem_2_4_proof (bd S) (G_dual.V ∩ bd S) Δ x y + hC hΔ hV_fin hV_sub hU1 hCF hx_W hy_W + have hx_bd : x ∈ bd S := by + rw [hΔ_union] at hx + rcases hx with hx | hx <;> exact hx.2 + have hy_bd : y ∈ bd S := by + rw [hΔ_union] at hy + rcases hy with hy | hy <;> exact hy.2 + have hx_U_iff : x ∈ G_dual.V ∩ bd S ↔ (A_dual.head hChain.ne_nil).IsVertex := + ⟨fun h => hhead_match.2.1.mp h.1, fun h => ⟨hhead_match.2.1.mpr h, hx_bd⟩⟩ + have hy_U_iff : y ∈ G_dual.V ∩ bd S ↔ (A_dual.getLast hChain.ne_nil).IsVertex := + ⟨fun h => hlast_match.2.1.mp h.1, fun h => ⟨hlast_match.2.1.mpr h, hy_bd⟩⟩ + have hx_V_iff : x ∈ divisionUnion Δ ↔ ¬ (A_dual.head hChain.ne_nil).IsVertex := by + rw [hΔ_union] + exact ⟨fun h => hhead_match.2.2.mp h.1, fun h => ⟨hhead_match.2.2.mpr h, hx_bd⟩⟩ + have hy_V_iff : y ∈ divisionUnion Δ ↔ ¬ (A_dual.getLast hChain.ne_nil).IsVertex := by + rw [hΔ_union] + exact ⟨fun h => hlast_match.2.2.mp h.1, fun h => ⟨hlast_match.2.2.mpr h, hy_bd⟩⟩ + unfold chainRedundancy + rw [hlen_A] + by_cases h1 : (A_dual.head hChain.ne_nil).IsVertex ∧ (A_dual.getLast hChain.ne_nil).IsVertex + · have hL := hdiff_L.1 h1 + have hD := hdiff_Δ.2.1 ⟨hx_U_iff.mpr h1.1, hy_U_iff.mpr h1.2⟩ + omega + · by_cases h2 : ¬ (A_dual.head hChain.ne_nil).IsVertex ∧ ¬ (A_dual.getLast + hChain.ne_nil).IsVertex + · have hL := hdiff_L.2.1 h2 + have hD := hdiff_Δ.1 ⟨hx_V_iff.mpr h2.1, hy_V_iff.mpr h2.2⟩ + omega + · have hL := hdiff_L.2.2 h1 h2 + have hD := hdiff_Δ.2.2 + (fun h => h2 ⟨hx_V_iff.mp h.1, hy_V_iff.mp h.2⟩) + (fun h => h1 ⟨hx_U_iff.mp h.1, hy_U_iff.mp h.2⟩) + omega + +end GraphMinor.GM06 diff --git a/LeanPool/GraphMinor/GM06/Section3Dual.lean b/LeanPool/GraphMinor/GM06/Section3Dual.lean new file mode 100644 index 0000000000..3cc77344b1 --- /dev/null +++ b/LeanPool/GraphMinor/GM06/Section3Dual.lean @@ -0,0 +1,1075 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.Section2Count +public import LeanPool.GraphMinor.GM06.Section3Basic +import LeanPool.GraphMinor.Surface.Crossing +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import Mathlib.Analysis.Convex.PathConnected + +/-! +# Graph Minors VI, Section 3: Disjoint Janiszewski on a Disc, Region Connectivity, and (3.2) + +This file proves: +- `disc_janiszewski_disjoint`: Janiszewski's theorem for disjoint closed subsets of a closed disc + space `S`, deduced from `janiszewski` in `ℂ` via a radial retraction-and-coning map `ℂ → S`. +- `same_region_of_no_component_crosses`: if `u₁, u₂ ∈ bd S \ Γ.U` and no connected component of a + proper drawing `Γ` on `S` has two boundary vertices crossing `{u₁, u₂}` on `bd S`, then `u₁` and + `u₂` lie in the same region of `Γ`. +- `theorem_3_2`: **Graph Minors VI, (3.2)** ($\Delta$ is feasible in $G$ if and only if $\Delta^*$ + is feasible in $G^*$). +-/ + +public section + +namespace GraphMinor.GM06 + +open Set Function Topology Metric Graph GraphMinor.Surface GraphMinor.GM11 + +universe u v + +/-! ## 1. Closed Disc Space Crossing and Walk Point-Sets -/ + +theorem isClosedDisc_univ_of_isClosedDiscSpace {S : Type u} [TopologicalSpace S] + (hDisc : IsClosedDiscSpace S) : IsClosedDisc (univ : Set S) := by + rcases hDisc with ⟨e⟩ + exact ⟨e.trans (Homeomorph.Set.univ S).symm⟩ + +theorem discBd_univ_eq_bd {S : Type u} [TopologicalSpace S] : + discBd (univ : Set S) = bd S := by + have h := image_bd_homeomorph (Homeomorph.Set.univ S) + simpa [discBd, Homeomorph.Set.univ] using h + +theorem crossesOn_iff_pairsCrossOn_discBd_univ {S : Type u} [TopologicalSpace S] + (a c b d : S) : + CrossesOn (bd S) a c b d ↔ PairsCrossOn (discBd (univ : Set S)) a c b d := by + rw [discBd_univ_eq_bd] + +/-- Transfer `disc_crossing` to `S` when `IsClosedDiscSpace S`. -/ +theorem discCrossing_of_isClosedDiscSpace + {S : Type u} [TopologicalSpace S] (hDisc : IsClosedDiscSpace S) + {A B : Set S} {a c b d : S} + (hA_comp : IsCompact A) (hB_comp : IsCompact B) + (hA_conn : IsConnected A) (hB_conn : IsConnected B) + (ha : a ∈ A) (hc : c ∈ A) (hb : b ∈ B) (hd : d ∈ B) + (hcross : CrossesOn (bd S) a c b d) : + (A ∩ B).Nonempty := by + exact disc_crossing (univ : Set S) A B a c b d + (isClosedDisc_univ_of_isClosedDiscSpace hDisc) + (subset_univ A) (subset_univ B) + hA_comp hB_comp hA_conn hB_conn ha hc hb hd + ((crossesOn_iff_pairsCrossOn_discBd_univ a c b d).mp hcross) + +theorem isCompact_closure_edge {S : Type u} [TopologicalSpace S] + (G : Drawing S) {e : Set S} (he : e ∈ G.E) : + IsCompact (closure e) := by + rcases G.edge_cond e he with ⟨u, v, _, _, f, _, _⟩ | ⟨u, _, ⟨f⟩⟩ + · have : CompactSpace (closure e) := f.compactSpace + exact isCompact_iff_compactSpace.mpr this + · have : CompactSpace (closure e) := f.compactSpace + exact isCompact_iff_compactSpace.mpr this + +theorem isConnected_closure_edge {S : Type u} [TopologicalSpace S] + (G : Drawing S) {e : Set S} (he : e ∈ G.E) : + IsConnected (closure e) := by + rcases G.edge_cond e he with ⟨u, v, _, _, f, _, _⟩ | ⟨u, _, ⟨f⟩⟩ + · have : ConnectedSpace (closure e) := f.surjective.connectedSpace f.continuous + exact isConnected_iff_connectedSpace.mpr this + · have : ConnectedSpace (closure e) := f.surjective.connectedSpace f.continuous + exact isConnected_iff_connectedSpace.mpr this + +theorem disjoint_edges_of_ne {S : Type u} [TopologicalSpace S] + (G : Drawing S) {e₁ e₂ : Set S} (he₁ : e₁ ∈ G.E) (he₂ : e₂ ∈ G.E) (hne : e₁ ≠ e₂) : + Disjoint e₁ e₂ := by + rw [Set.disjoint_iff_inter_eq_empty] + by_contra hnon + have hnon_empty : (e₁ ∩ e₂).Nonempty := nonempty_iff_ne_empty.mpr hnon + have hpc : IsPathConnected (e₁ ∪ e₂) := he₁.2.2.1.union he₂.2.2.1 hnon_empty + have hsub : e₁ ∪ e₂ ⊆ G.U \ G.V := union_subset he₁.2.1 he₂.2.1 + have heq₁ : e₁ ∪ e₂ = e₁ := he₁.2.2.2 (e₁ ∪ e₂) hsub hpc subset_union_left + have heq₂ : e₁ ∪ e₂ = e₂ := he₂.2.2.2 (e₁ ∪ e₂) hsub hpc subset_union_right + exact hne (heq₁.symm.trans heq₂) + +theorem closure_edge_eq_union_ends {S : Type u} [TopologicalSpace S] + (G : Drawing S) {e : Set S} {u v : S} + (hlink : G.toGraph.IsLink e u v) (hne : u ≠ v) : + closure e = e ∪ {u, v} := by + rcases hlink with ⟨he, huV, hvV, hcap⟩ + rcases G.edge_cond e he with ⟨u', v', _, hcap', f, hf0, hf1⟩ | ⟨u', hcap', _⟩ + · have hpair : ({u', v'} : Set S) = {u, v} := hcap'.symm.trans hcap + have h_ioo_pc : IsPathConnected {t : unitInterval | (t : ℝ) ∈ Ioo (0 : ℝ) 1} := by + have hconv : Convex ℝ (Ioo (0 : ℝ) 1) := convex_Ioo 0 1 + have hpc0 : IsPathConnected (Ioo (0 : ℝ) 1) := + hconv.isPathConnected ⟨1 / 2, by constructor <;> linarith⟩ + let clamp : ℝ → unitInterval := fun x => + ⟨max 0 (min 1 x), le_max_left 0 _, max_le zero_le_one (min_le_left 1 x)⟩ + have hclamp_cont : Continuous clamp := + (continuous_const.max (continuous_const.min continuous_id)).subtype_mk _ + have himg : clamp '' Ioo (0 : ℝ) 1 = {t : unitInterval | (t : ℝ) ∈ Ioo (0 : ℝ) 1} := by + ext t + constructor + · rintro ⟨x, hx, rfl⟩ + simp only [clamp, mem_ofPred_eq] + have hmin : min 1 x = x := min_eq_right (le_of_lt hx.2) + have hmax : max 0 (min 1 x) = x := by rw [hmin]; exact max_eq_right (le_of_lt hx.1) + rw [hmax] + exact hx + · intro ht + refine ⟨(t : ℝ), ht, Subtype.ext ?_⟩ + simp only [clamp] + have hmin : min 1 (t : ℝ) = (t : ℝ) := min_eq_right (le_of_lt ht.2) + rw [hmin] + exact max_eq_right (le_of_lt ht.1) + rw [← himg] + exact hpc0.image hclamp_cont + let phi : unitInterval → S := fun t => (f t).1 + have hphi_cont : Continuous phi := continuous_subtype_val.comp f.continuous + have himg_eq : phi '' {t : unitInterval | (t : ℝ) ∈ Ioo (0 : ℝ) 1} = closure e \ G.V := by + ext z + constructor + · rintro ⟨t, ht, rfl⟩ + refine ⟨(f t).2, ?_⟩ + intro hzV + have hz_mem : phi t ∈ closure e ∩ G.V := ⟨(f t).2, hzV⟩ + rw [hcap'] at hz_mem + rcases hz_mem with hzu | hzv + · have ht0 : t = 0 := f.injective (Subtype.ext (hzu.trans hf0.symm)) + subst ht0 + exact lt_irrefl (0 : ℝ) ht.1 + · have ht1 : t = 1 := f.injective (Subtype.ext (hzv.trans hf1.symm)) + subst ht1 + exact lt_irrefl (1 : ℝ) ht.2 + · rintro ⟨hz_cl, hz_notV⟩ + let t : unitInterval := f.symm ⟨z, hz_cl⟩ + have hft : phi t = z := congrArg Subtype.val (f.apply_symm_apply ⟨z, hz_cl⟩) + refine ⟨t, ?_, hft⟩ + have ht0 : (t : ℝ) ≠ 0 := by + intro h0 + have ht_eq : t = 0 := Subtype.ext h0 + have hz_eq : z = u' := by rw [← hft, ht_eq]; exact hf0 + have hu'V : u' ∈ G.V := by + have : u' ∈ closure e ∩ G.V := by rw [hcap']; exact mem_insert u' {v'} + exact this.2 + exact hz_notV (hz_eq ▸ hu'V) + have ht1 : (t : ℝ) ≠ 1 := by + intro h1 + have ht_eq : t = 1 := Subtype.ext h1 + have hz_eq : z = v' := by rw [← hft, ht_eq]; exact hf1 + have hv'V : v' ∈ G.V := by + have : v' ∈ closure e ∩ G.V := by rw [hcap']; exact mem_insert_of_mem u' rfl + exact this.2 + exact hz_notV (hz_eq ▸ hv'V) + exact ⟨lt_of_le_of_ne t.2.1 (Ne.symm ht0), lt_of_le_of_ne t.2.2 ht1⟩ + have hpc_diff : IsPathConnected (closure e \ G.V) := by + rw [← himg_eq] + exact h_ioo_pc.image hphi_cont + have hsub_diff : closure e \ G.V ⊆ G.U \ G.V := by + have hclU : closure e ⊆ G.U := G.isClosed_U.closure_subset_iff.mpr (he.2.1.trans sdiff_subset) + exact sdiff_subset_sdiff_left hclU + have he_sub_diff : e ⊆ closure e \ G.V := + subset_sdiff.mpr ⟨subset_closure, disjoint_left.mpr fun _ hxe hxV => (he.2.1 hxe).2 hxV⟩ + have hdiff_eq : closure e \ G.V = e := + he.2.2.2 (closure e \ G.V) hsub_diff hpc_diff he_sub_diff + calc closure e + _ = (closure e \ G.V) ∪ (closure e ∩ G.V) := (sdiff_union_inter (closure e) G.V).symm + _ = e ∪ {u, v} := by rw [hdiff_eq, hcap] + · exfalso + have hpair : ({u, v} : Set S) = {u'} := hcap.symm.trans hcap' + have hu_eq : u = u' := by + have : u ∈ ({u, v} : Set S) := mem_insert u {v} + rw [hpair] at this + exact mem_singleton_iff.mp this + have hv_eq : v = u' := by + have : v ∈ ({u, v} : Set S) := mem_insert_of_mem u rfl + rw [hpair] at this + exact mem_singleton_iff.mp this + exact hne (hu_eq.trans hv_eq.symm) + +/-- Every walk in a subgraph `C ≤ G.toGraph` produces a compact connected point-set in `S` +contained in `V(C) ∪ ⋃ e ∈ E(C), e` (skipping self-loop steps). -/ +theorem exists_compact_connected_of_walk {S : Type u} [TopologicalSpace S] + (G : Drawing S) {C : Graph S (Set S)} (hCG : C ≤ G.toGraph) + {u v : S} (W : GraphWalk C u v) : + ∃ K : Set S, IsCompact K ∧ IsConnected K ∧ u ∈ K ∧ v ∈ K ∧ + K ⊆ V(C) ∪ ⋃ e ∈ E(C), e ∧ + K ⊆ G.U ∧ K ∩ G.V ⊆ V(C) := by + induction W with + | @nil u hu => + refine ⟨{u}, isCompact_singleton, isConnected_singleton, + mem_singleton u, mem_singleton u, ?_, ?_, ?_⟩ + · intro x hx + left + exact (mem_singleton_iff.mp hx) ▸ hu + · intro x hx + rw [mem_singleton_iff.mp hx] + exact G.V_subset_U (hCG.vertexSet_mono hu) + · intro x hx + exact (mem_singleton_iff.mp hx.1) ▸ hu + | @cons u w v e hlink _ ih => + rcases ih with ⟨K', hK'_comp, hK'_conn, hwK', hvK', hK'_sub, hK'_U, hK'_V⟩ + rcases eq_or_ne u w with rfl | hne + · exact ⟨K', hK'_comp, hK'_conn, hwK', hvK', hK'_sub, hK'_U, hK'_V⟩ + · have hlinkG : G.toGraph.IsLink e u w := hlink.mono hCG + have hcl_eq : closure e = e ∪ {u, w} := closure_edge_eq_union_ends G hlinkG hne + have hu_cl : u ∈ closure e := by + rw [hcl_eq]; exact Or.inr (mem_insert u {w}) + have hw_cl : w ∈ closure e := by + rw [hcl_eq]; exact Or.inr (mem_insert_of_mem u rfl) + refine ⟨closure e ∪ K', + (isCompact_closure_edge G hlinkG.1).union hK'_comp, + IsConnected.union ⟨w, hw_cl, hwK'⟩ (isConnected_closure_edge G hlinkG.1) hK'_conn, + Or.inl hu_cl, Or.inr hvK', ?_, ?_, ?_⟩ + · intro x hx + rcases hx with hx_cl | hxK' + · rw [hcl_eq] at hx_cl + rcases hx_cl with hxe | (rfl | rfl) + · right + exact mem_iUnion₂.mpr ⟨e, hlink.edge_mem, hxe⟩ + · left; exact hlink.left_mem + · left; exact hlink.right_mem + · exact hK'_sub hxK' + · have hcl_U : closure e ⊆ G.U := + G.isClosed_U.closure_subset_iff.mpr (hlinkG.1.2.1.trans sdiff_subset) + exact union_subset hcl_U hK'_U + · intro x hx + rcases hx with ⟨hx_cl | hxK', hxV⟩ + · have hx_cap : x ∈ closure e ∩ G.V := ⟨hx_cl, hxV⟩ + rw [hlinkG.2.2.2] at hx_cap + rcases hx_cap with rfl | rfl + · exact hlink.left_mem + · exact hlink.right_mem + · exact hK'_V ⟨hxK', hxV⟩ + +/-! ## 2. Janiszewski's Theorem for Disjoint Closed Sets on a Closed Disc Space -/ + +/-- **Janiszewski's theorem on a closed disc space** (disjoint case): if `K₁, K₂ ⊆ S` are disjoint +closed subsets of a closed disc space `S`, `a, b ∉ K₁ ∪ K₂`, and `b` lies in the same connected +component as `a` in both `univ \ K₁` and `univ \ K₂`, then `b` lies in the same connected component +as `a` in `univ \ (K₁ ∪ K₂)`. -/ +theorem disc_janiszewski_disjoint {S : Type u} [TopologicalSpace S] (hS : IsClosedDiscSpace S) + {K₁ K₂ : Set S} (hK₁ : IsClosed K₁) (hK₂ : IsClosed K₂) (hdisj : Disjoint K₁ K₂) + {a b : S} (ha : a ∉ K₁ ∪ K₂) (hb : b ∉ K₁ ∪ K₂) + (hab₁ : b ∈ connectedComponentIn (univ \ K₁) a) + (hab₂ : b ∈ connectedComponentIn (univ \ K₂) a) : + b ∈ connectedComponentIn (univ \ (K₁ ∪ K₂)) a := by + obtain ⟨φ⟩ := hS + let a₀ : EuclideanPlane := (φ.symm a).1 + have ha₀ : a₀ ∈ ClosedUnitDisc := (φ.symm a).2 + let ρ : EuclideanPlane → EuclideanPlane := fun x => (max (1 : ℝ) ‖x‖)⁻¹ • x + have hρ_cont : Continuous ρ := by + refine (Continuous.inv₀ (continuous_const.max continuous_norm) ?_).smul continuous_id + intro x + positivity + have hρ_mem : ∀ x : EuclideanPlane, ρ x ∈ ClosedUnitDisc := by + intro x + rw [ClosedUnitDisc, mem_closedBall_zero_iff, norm_smul, Real.norm_eq_abs, abs_inv] + have hpos : 0 < max (1 : ℝ) ‖x‖ := by positivity + rw [abs_of_pos hpos, inv_mul_le_iff₀ hpos, mul_one] + exact le_max_right 1 ‖x‖ + have hρ_id : ∀ x : ClosedUnitDisc, ρ x.1 = x.1 := by + intro x + have hx1 : ‖x.1‖ ≤ 1 := mem_closedBall_zero_iff.mp x.2 + simp [ρ, max_eq_left hx1] + let t : EuclideanPlane → ℝ := fun x => min 1 (max 0 (‖x‖ - 1)) + have ht_cont : Continuous t := + continuous_const.min (continuous_const.max (continuous_norm.sub continuous_const)) + have ht0 : ∀ x, 0 ≤ t x := fun x => le_min zero_le_one (le_max_left 0 _) + have ht1 : ∀ x, t x ≤ 1 := fun x => min_le_left 1 _ + let τ : EuclideanPlane → EuclideanPlane := fun x => (1 - t x) • ρ x + t x • a₀ + have hτ_cont : Continuous τ := + ((continuous_const.sub ht_cont).smul hρ_cont).add (ht_cont.smul continuous_const) + have hτ_mem : ∀ x : EuclideanPlane, τ x ∈ ClosedUnitDisc := by + intro x + exact convex_closedBall (0 : EuclideanPlane) 1 (hρ_mem x) ha₀ + (sub_nonneg.mpr (ht1 x)) (ht0 x) (sub_add_cancel 1 (t x)) + have hτ_id : ∀ x : ClosedUnitDisc, τ x.1 = x.1 := by + intro x + have hx1 : ‖x.1‖ ≤ 1 := mem_closedBall_zero_iff.mp x.2 + have htx : t x.1 = 0 := by + dsimp [t] + rw [max_eq_left (by linarith), min_eq_right zero_le_one] + simp [τ, htx, hρ_id x] + have hτ_far : ∀ x : EuclideanPlane, 2 ≤ ‖x‖ → τ x = a₀ := by + intro x hx2 + have htx : t x = 1 := by + dsimp [t] + rw [max_eq_right (by linarith), min_eq_left (by linarith)] + simp [τ, htx] + let F : ℂ → S := fun z => φ ⟨τ (complexPlane z), hτ_mem (complexPlane z)⟩ + have hF_cont : Continuous F := + φ.continuous.comp ((hτ_cont.comp complexPlane.continuous).subtype_mk _) + let emb : S → ℂ := fun s => complexPlane.symm (φ.symm s).1 + have hemb_cont : Continuous emb := + complexPlane.symm.continuous.comp (continuous_subtype_val.comp φ.symm.continuous) + have hF_emb : ∀ s : S, F (emb s) = s := by + intro s + dsimp [F, emb] + have h_eq : (⟨τ (complexPlane (complexPlane.symm (φ.symm s).1)), + hτ_mem (complexPlane (complexPlane.symm (φ.symm s).1))⟩ : ClosedUnitDisc) = φ.symm s := by + ext + simp [hτ_id (φ.symm s)] + rw [h_eq, φ.apply_symm_apply] + have hF_far : ∀ z : ℂ, 2 ≤ ‖z‖ → F z = a := by + intro z hz2 + dsimp [F] + have hnorm : 2 ≤ ‖complexPlane z‖ := by rwa [LinearIsometryEquiv.norm_map] + have h_eq : (⟨τ (complexPlane z), hτ_mem (complexPlane z)⟩ : ClosedUnitDisc) = φ.symm a := + Subtype.ext (hτ_far (complexPlane z) hnorm) + rw [h_eq, φ.apply_symm_apply] + let L₁ : Set ℂ := F ⁻¹' K₁ + let L₂ : Set ℂ := F ⁻¹' K₂ + have hL₁_comp : IsCompact L₁ := by + refine (isCompact_closedBall (0 : ℂ) 2).of_isClosed_subset (hK₁.preimage hF_cont) ?_ + intro z hz + rw [mem_closedBall_zero_iff] + by_contra hlt + have hz_a : F z = a := hF_far z (le_of_not_ge hlt) + exact ha (Or.inl (hz_a ▸ hz)) + have hL₂_comp : IsCompact L₂ := by + refine (isCompact_closedBall (0 : ℂ) 2).of_isClosed_subset (hK₂.preimage hF_cont) ?_ + intro z hz + rw [mem_closedBall_zero_iff] + by_contra hlt + have hz_a : F z = a := hF_far z (le_of_not_ge hlt) + exact ha (Or.inr (hz_a ▸ hz)) + have hL_inter : L₁ ∩ L₂ = ∅ := by + ext z + simp only [L₁, L₂, mem_inter_iff, mem_preimage, mem_empty_iff_false, iff_false, not_and] + exact fun h1 h2 => disjoint_left.mp hdisj h1 h2 + have hemb_a : emb a ∉ L₁ ∪ L₂ := by + simp only [L₁, L₂, mem_union, mem_preimage, hF_emb] + exact ha + have hemb_b : emb b ∉ L₁ ∪ L₂ := by + simp only [L₁, L₂, mem_union, mem_preimage, hF_emb] + exact hb + have hemb_ab₁ : emb b ∈ connectedComponentIn L₁ᶜ (emb a) := by + refine (isPreconnected_connectedComponentIn.image emb + hemb_cont.continuousOn).subset_connectedComponentIn ?_ ?_ (mem_image_of_mem emb hab₁) + · exact mem_image_of_mem emb (mem_connectedComponentIn ⟨mem_univ a, fun h => ha (Or.inl h)⟩) + · rintro _ ⟨s, hs, rfl⟩ + change F (emb s) ∉ K₁ + rw [hF_emb] + exact (connectedComponentIn_subset _ _ hs).2 + have hemb_ab₂ : emb b ∈ connectedComponentIn L₂ᶜ (emb a) := by + refine (isPreconnected_connectedComponentIn.image emb + hemb_cont.continuousOn).subset_connectedComponentIn ?_ ?_ (mem_image_of_mem emb hab₂) + · exact mem_image_of_mem emb (mem_connectedComponentIn ⟨mem_univ a, fun h => ha (Or.inr h)⟩) + · rintro _ ⟨s, hs, rfl⟩ + change F (emb s) ∉ K₂ + rw [hF_emb] + exact (connectedComponentIn_subset _ _ hs).2 + have h_jan := janiszewski hL₁_comp hL₂_comp (by rw [hL_inter]; exact isPreconnected_empty) + hemb_a hemb_b hemb_ab₁ hemb_ab₂ + refine (isPreconnected_connectedComponentIn.image F + hF_cont.continuousOn).subset_connectedComponentIn ?_ ?_ ⟨emb b, h_jan, hF_emb b⟩ + · exact ⟨emb a, mem_connectedComponentIn hemb_a, hF_emb a⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact ⟨mem_univ _, connectedComponentIn_subset _ _ hz⟩ + +/-! ## 3. Point-Sets of Graph Components and Region Connectivity -/ + +/-- The point-set of a subgraph `C` of a drawing `Γ`: `V(C) ∪ ⋃ e ∈ E(C), e`. -/ +@[expose] def compPointSet {S : Type u} (C : Graph S (Set S)) : Set S := + V(C) ∪ ⋃ e ∈ E(C), e + +theorem compPointSet_eq_closure_union {S : Type u} [TopologicalSpace S] [T2Space S] + (Γ : Drawing S) {C : Graph S (Set S)} (hC : IsGraphComponent C Γ.toGraph) : + compPointSet C = V(C) ∪ ⋃ e ∈ E(C), closure e := by + ext x + simp only [compPointSet, mem_union, mem_iUnion, exists_prop] + constructor + · rintro (hxV | ⟨e, heC, hxe⟩) + · exact Or.inl hxV + · exact Or.inr ⟨e, heC, subset_closure hxe⟩ + · rintro (hxV | ⟨e, heC, hxcl⟩) + · exact Or.inl hxV + · obtain ⟨u, v, hlinkC⟩ := C.exists_isLink_of_mem_edgeSet heC + have hlinkG : Γ.toGraph.IsLink e u v := hlinkC.mono hC.1 + obtain ⟨γ, hγ, _, _, _, himg, hcl, hlinkγ⟩ := exists_edge_param_isLink Γ hlinkG.1 + have hpair : ({γ 0, γ 1} : Set S) = {u, v} := hlinkγ.2.2.2.symm.trans hlinkG.2.2.2 + rw [hcl] at hxcl + obtain ⟨t, rfl⟩ := hxcl + by_cases ht0 : t = 0 + · subst ht0 + have : γ 0 ∈ ({u, v} : Set S) := hpair ▸ mem_insert (γ 0) {γ 1} + rcases this with h1 | h2 + · exact Or.inl (h1 ▸ hlinkC.left_mem) + · exact Or.inl (mem_singleton_iff.mp h2 ▸ hlinkC.right_mem) + · by_cases ht1 : t = 1 + · subst ht1 + have : γ 1 ∈ ({u, v} : Set S) := hpair ▸ mem_insert_of_mem (γ 0) rfl + rcases this with h1 | h2 + · exact Or.inl (h1 ▸ hlinkC.left_mem) + · exact Or.inl (mem_singleton_iff.mp h2 ▸ hlinkC.right_mem) + · right + refine ⟨e, heC, ?_⟩ + rw [← himg] + exact ⟨t, ⟨unitInterval.pos_iff_ne_zero.mpr ht0, + unitInterval.lt_one_iff_ne_one.mpr ht1⟩, rfl⟩ + +theorem isClosed_compPointSet {S : Type u} [TopologicalSpace S] [T2Space S] + (Γ : Drawing S) {C : Graph S (Set S)} (hC : IsGraphComponent C Γ.toGraph) : + IsClosed (compPointSet C) := by + rw [compPointSet_eq_closure_union Γ hC] + have hV_fin : V(C).Finite := Γ.finite_V.subset hC.1.vertexSet_mono + have hE_fin : E(C).Finite := Γ.finite_edges.subset hC.1.edgeSet_mono + exact hV_fin.isClosed.union (hE_fin.isClosed_biUnion fun e _ => isClosed_closure) + +theorem disjoint_compPointSet_of_ne {S : Type u} [TopologicalSpace S] + (Γ : Drawing S) {C₁ C₂ : Graph S (Set S)} + (h₁ : IsGraphComponent C₁ Γ.toGraph) (h₂ : IsGraphComponent C₂ Γ.toGraph) (hne : C₁ ≠ C₂) : + Disjoint (compPointSet C₁) (compPointSet C₂) := by + have hV_disj : Disjoint V(C₁) V(C₂) := h₁.disjoint_vertexSet_of_ne h₂ hne + have hE_disj : Disjoint E(C₁) E(C₂) := h₁.disjoint_edgeSet_of_ne h₂ hne + refine disjoint_left.mpr fun z hz1 hz2 => ?_ + rcases hz1 with hzV1 | hzE1 <;> rcases hz2 with hzV2 | hzE2 + · exact disjoint_left.mp hV_disj hzV1 hzV2 + · simp only [mem_iUnion, exists_prop] at hzE2 + rcases hzE2 with ⟨e₂, he₂C, hze₂⟩ + have he₂G : e₂ ∈ Γ.E := h₂.1.edgeSet_mono he₂C + exact (he₂G.2.1 hze₂).2 (h₁.1.vertexSet_mono hzV1) + · simp only [mem_iUnion, exists_prop] at hzE1 + rcases hzE1 with ⟨e₁, he₁C, hze₁⟩ + have he₁G : e₁ ∈ Γ.E := h₁.1.edgeSet_mono he₁C + exact (he₁G.2.1 hze₁).2 (h₂.1.vertexSet_mono hzV2) + · simp only [mem_iUnion, exists_prop] at hzE1 hzE2 + rcases hzE1 with ⟨e₁, he₁C, hze₁⟩ + rcases hzE2 with ⟨e₂, he₂C, hze₂⟩ + have he_ne : e₁ ≠ e₂ := fun h => disjoint_left.mp hE_disj he₁C (h ▸ he₂C) + exact disjoint_left.mp + (disjoint_edges_of_ne Γ (h₁.1.edgeSet_mono he₁C) (h₂.1.edgeSet_mono he₂C) he_ne) hze₁ hze₂ + +theorem finite_graphComponents {S : Type u} [TopologicalSpace S] (Γ : Drawing S) : + (graphComponents Γ.toGraph).Finite := by + refine (Γ.finite_V.image (compOf Γ.toGraph)).subset fun C hC => ?_ + obtain ⟨v, hv⟩ := hC.2.1.1 + exact ⟨v, hC.1.vertexSet_mono hv, (hC.eq_compOf_of_mem hv).symm⟩ + +theorem biUnion_compPointSet_eq_U {S : Type u} [TopologicalSpace S] [T2Space S] + (Γ : Drawing S) : + (⋃ C ∈ graphComponents Γ.toGraph, compPointSet C) = Γ.U := by + ext x + simp only [mem_iUnion, exists_prop, compPointSet, mem_union] + constructor + · rintro ⟨C, hC, hxV | ⟨e, heC, hxe⟩⟩ + · exact Γ.V_subset_U (hC.1.vertexSet_mono hxV) + · exact ((hC.1.edgeSet_mono heC).2.1 hxe).1 + · intro hxU + by_cases hxV : x ∈ Γ.V + · exact ⟨compOf Γ.toGraph x, isGraphComponent_compOf hxV, Or.inl (self_mem_reachSet hxV)⟩ + · obtain ⟨e, he, hxe⟩ := Γ.exists_edge_of_mem hxU hxV + obtain ⟨γ, _, h0, _, _, _, _, hlink⟩ := exists_edge_param_isLink Γ he + have hC : IsGraphComponent (compOf Γ.toGraph (γ 0)) Γ.toGraph := isGraphComponent_compOf h0 + have heC : e ∈ E(compOf Γ.toGraph (γ 0)) := + ((hC.isLink_iff_of_mem (self_mem_reachSet h0)).mpr hlink).edge_mem + exact ⟨compOf Γ.toGraph (γ 0), hC, Or.inr ⟨e, heC, hxe⟩⟩ + +theorem compPointSet_inter_bd_eq {S : Type u} [TopologicalSpace S] + (Γ : Drawing S) (hProper : Γ.IsProper) {C : Graph S (Set S)} + (hC : IsGraphComponent C Γ.toGraph) : + compPointSet C ∩ bd S = V(C) ∩ bd S := by + ext x + simp only [compPointSet, mem_inter_iff, mem_union, mem_iUnion, exists_prop] + constructor + · rintro ⟨hxV | ⟨e, heC, hxe⟩, hxbd⟩ + · exact ⟨hxV, hxbd⟩ + · have heG : e ∈ Γ.E := hC.1.edgeSet_mono heC + have hxV : x ∈ Γ.V := hProper ⟨hxbd, (heG.2.1 hxe).1⟩ + exact ((heG.2.1 hxe).2 hxV).elim + · rintro ⟨hxV, hxbd⟩ + exact ⟨Or.inl hxV, hxbd⟩ + +/-- If `u₁, u₂ ∈ bd S \ Γ.U` and no connected component `C` of a proper drawing `Γ` on a closed +disc space `S` has two boundary vertices `v₁, v₂ ∈ V(C) ∩ bd S` crossing `{u₁, u₂}` on `bd S`, +then `u₁` and `u₂` lie in the same region of `Γ`. -/ +theorem same_region_of_no_component_crosses {S : Type u} [TopologicalSpace S] + (hS : IsClosedDiscSpace S) (Γ : Drawing S) (hProper : Γ.IsProper) + {u₁ u₂ : S} (hu₁_bd : u₁ ∈ bd S) (hu₂_bd : u₂ ∈ bd S) + (hu₁_U : u₁ ∉ Γ.U) (hu₂_U : u₂ ∉ Γ.U) + (hno_cross : ∀ C ∈ graphComponents Γ.toGraph, + ∀ v₁ ∈ V(C) ∩ bd S, ∀ v₂ ∈ V(C) ∩ bd S, ¬ CrossesOn (bd S) v₁ v₂ u₁ u₂) : + connectedComponentIn (univ \ Γ.U) u₁ = connectedComponentIn (univ \ Γ.U) u₂ := by + classical + have : T2Space S := t2Space_of_isClosedDiscSpace hS + rcases eq_or_ne u₁ u₂ with rfl | hne + · rfl + obtain ⟨φ⟩ := hS.isOArc_bd + have hinj := injective_oArcMap φ + let x : Circle := φ.symm ⟨u₁, hu₁_bd⟩ + let y : Circle := φ.symm ⟨u₂, hu₂_bd⟩ + have hx_map : oArcMap φ x = u₁ := by simp [oArcMap, x] + have hy_map : oArcMap φ y = u₂ := by simp [oArcMap, y] + have hxy : x ≠ y := fun h => hne (hx_map ▸ hy_map ▸ congrArg (oArcMap φ) h) + let B₁ : Set S := oArcMap φ '' range (Circle.path x y) + let B₂ : Set S := oArcMap φ '' range (Circle.path y x) + have hB₁_conn : IsPreconnected B₁ := + (isConnected_range (Circle.path x y).continuous).isPreconnected.image _ + (isEmbedding_oArcMap φ).continuous.continuousOn + have hB₂_conn : IsPreconnected B₂ := + (isConnected_range (Circle.path y x).continuous).isPreconnected.image _ + (isEmbedding_oArcMap φ).continuous.continuousOn + have hu₁_B₁ : u₁ ∈ B₁ := ⟨x, ⟨0, (Circle.path x y).source⟩, hx_map⟩ + have hu₂_B₁ : u₂ ∈ B₁ := ⟨y, ⟨1, (Circle.path x y).target⟩, hy_map⟩ + have hu₁_B₂ : u₁ ∈ B₂ := ⟨x, ⟨1, (Circle.path y x).target⟩, hx_map⟩ + have hu₂_B₂ : u₂ ∈ B₂ := ⟨y, ⟨0, (Circle.path y x).source⟩, hy_map⟩ + let C₁_set := {C ∈ graphComponents Γ.toGraph | V(C) ∩ bd S ⊆ B₂} + let C₂_set := {C ∈ graphComponents Γ.toGraph | ¬ (V(C) ∩ bd S ⊆ B₂)} + let K₁ : Set S := ⋃ C ∈ C₁_set, compPointSet C + let K₂ : Set S := ⋃ C ∈ C₂_set, compPointSet C + have hC₁_fin : C₁_set.Finite := (finite_graphComponents Γ).subset fun _ h => h.1 + have hC₂_fin : C₂_set.Finite := (finite_graphComponents Γ).subset fun _ h => h.1 + have hK₁_closed : IsClosed K₁ := + hC₁_fin.isClosed_biUnion fun C hC => isClosed_compPointSet Γ hC.1 + have hK₂_closed : IsClosed K₂ := + hC₂_fin.isClosed_biUnion fun C hC => isClosed_compPointSet Γ hC.1 + have hK_union : K₁ ∪ K₂ = Γ.U := by + rw [← biUnion_compPointSet_eq_U Γ] + ext z + simp only [K₁, K₂, C₁_set, C₂_set, mem_union, mem_iUnion, exists_prop] + constructor + · rintro (⟨C, ⟨hC, _⟩, hz⟩ | ⟨C, ⟨hC, _⟩, hz⟩) <;> exact ⟨C, hC, hz⟩ + · rintro ⟨C, hC, hz⟩ + by_cases hsub : V(C) ∩ bd S ⊆ B₂ + · exact Or.inl ⟨C, ⟨hC, hsub⟩, hz⟩ + · exact Or.inr ⟨C, ⟨hC, hsub⟩, hz⟩ + have hK_disj : Disjoint K₁ K₂ := by + refine disjoint_left.mpr ?_ + rintro z hz1 hz2 + simp only [K₁, K₂, mem_iUnion, exists_prop] at hz1 hz2 + rcases hz1 with ⟨C₁, hC₁, hzC₁⟩ + rcases hz2 with ⟨C₂, hC₂, hzC₂⟩ + have hne_C : C₁ ≠ C₂ := fun h => hC₂.2 (h ▸ hC₁.2) + exact disjoint_left.mp (disjoint_compPointSet_of_ne Γ hC₁.1 hC₂.1 hne_C) hzC₁ hzC₂ + have hB₁_inter_B₂ : B₁ ∩ B₂ = {u₁, u₂} := by + dsimp only [B₁, B₂] + rw [← image_inter hinj, Circle.range_path_inter_range_path hxy, image_pair, hx_map, hy_map] + have hB₁_sub : B₁ ⊆ univ \ K₁ := by + rintro z ⟨w, hw, rfl⟩ + refine ⟨mem_univ _, ?_⟩ + simp only [K₁, mem_iUnion, exists_prop, not_exists, not_and] + intro C hC hzC + have hz_bd : oArcMap φ w ∈ bd S := oArcMap_mem φ w + have hz_V : oArcMap φ w ∈ V(C) ∩ bd S := by + rw [← compPointSet_inter_bd_eq Γ hProper hC.1] + exact ⟨hzC, hz_bd⟩ + have hz_B₂ : oArcMap φ w ∈ B₂ := hC.2 hz_V + have hz_pair : oArcMap φ w ∈ ({u₁, u₂} : Set S) := + hB₁_inter_B₂ ▸ ⟨⟨w, hw, rfl⟩, hz_B₂⟩ + have hz_U : oArcMap φ w ∈ Γ.U := by + rw [← hK_union] + exact Or.inl (mem_iUnion₂.mpr ⟨C, hC, hzC⟩) + rcases hz_pair with h1 | h2 + · exact hu₁_U (h1 ▸ hz_U) + · exact hu₂_U (mem_singleton_iff.mp h2 ▸ hz_U) + have hB₂_sub : B₂ ⊆ univ \ K₂ := by + rintro z ⟨w₂, hw₂, rfl⟩ + refine ⟨mem_univ _, ?_⟩ + simp only [K₂, mem_iUnion, exists_prop, not_exists, not_and] + intro C hC hzC + have hv₂_bd : oArcMap φ w₂ ∈ bd S := oArcMap_mem φ w₂ + have hv₂_V : oArcMap φ w₂ ∈ V(C) ∩ bd S := by + rw [← compPointSet_inter_bd_eq Γ hProper hC.1] + exact ⟨hzC, hv₂_bd⟩ + obtain ⟨v₁, hv₁_V, hv₁_notB₂⟩ := not_subset.mp hC.2 + let w₁ : Circle := φ.symm ⟨v₁, hv₁_V.2⟩ + have hw₁_map : oArcMap φ w₁ = v₁ := by simp [oArcMap, w₁] + have hw₁_arc : w₁ ∈ circleOpenArc x y := by + rw [← compl_range_circlePath hxy.symm] + intro hw₁_in + exact hv₁_notB₂ ⟨w₁, hw₁_in, hw₁_map⟩ + have hw₂_notB₁ : oArcMap φ w₂ ∉ B₁ := by + intro hz_B₁ + have hz_pair : oArcMap φ w₂ ∈ ({u₁, u₂} : Set S) := + hB₁_inter_B₂ ▸ ⟨hz_B₁, ⟨w₂, hw₂, rfl⟩⟩ + have hz_U : oArcMap φ w₂ ∈ Γ.U := by + rw [← hK_union] + exact Or.inr (mem_iUnion₂.mpr ⟨C, hC, hzC⟩) + rcases hz_pair with h1 | h2 + · exact hu₁_U (h1 ▸ hz_U) + · exact hu₂_U (mem_singleton_iff.mp h2 ▸ hz_U) + have hw₂_arc : w₂ ∈ circleOpenArc y x := by + rw [← compl_range_circlePath hxy] + intro hw₂_in + exact hw₂_notB₁ ⟨w₂, hw₂_in, rfl⟩ + have hcross_circle : CrossesOn (univ : Set Circle) x y w₁ w₂ := by + have hw₁_not : w₁ ∉ ({x, y} : Set Circle) := by + change w₁ ∈ ({x, y} : Set Circle)ᶜ + rw [compl_pair_eq_union_circleOpenArc hxy] + exact Or.inl hw₁_arc + have hw₂_not : w₂ ∉ ({x, y} : Set Circle) := by + change w₂ ∈ ({x, y} : Set Circle)ᶜ + rw [compl_pair_eq_union_circleOpenArc hxy] + exact Or.inr hw₂_arc + have hw₁w₂ : w₁ ≠ w₂ := fun h => + (disjoint_circleOpenArc hxy).ne_of_mem hw₁_arc hw₂_arc h + refine ⟨trivial, trivial, trivial, trivial, hxy, hw₁w₂, + fun h => hw₁_not (Or.inl h.symm), fun h => hw₂_not (Or.inl h.symm), + fun h => hw₁_not (Or.inr h.symm), fun h => hw₂_not (Or.inr h.symm), ?_⟩ + rw [← compl_eq_univ_sdiff, + connectedComponentIn_compl_pair_eq_left hxy hw₁_arc, + connectedComponentIn_compl_pair_eq_right hxy hw₂_arc] + intro heq + obtain ⟨z₀, hz₀⟩ := nonempty_circleOpenArc hxy + exact (disjoint_circleOpenArc hxy).ne_of_mem hz₀ (heq ▸ hz₀) rfl + have hcross_bd : CrossesOn (bd S) v₁ (oArcMap φ w₂) u₁ u₂ := by + rw [← hw₁_map, ← hx_map, ← hy_map, crossesOn_oArcMap_iff] + exact hcross_circle.comm isOArc_univ_circle + exact hno_cross C hC.1 v₁ hv₁_V (oArcMap φ w₂) hv₂_V hcross_bd + have hu₁_notK : u₁ ∉ K₁ ∪ K₂ := hK_union.symm ▸ hu₁_U + have hu₂_notK : u₂ ∉ K₁ ∪ K₂ := hK_union.symm ▸ hu₂_U + have hab₁ : u₂ ∈ connectedComponentIn (univ \ K₁) u₁ := + hB₁_conn.subset_connectedComponentIn hu₁_B₁ hB₁_sub hu₂_B₁ + have hab₂ : u₂ ∈ connectedComponentIn (univ \ K₂) u₁ := + hB₂_conn.subset_connectedComponentIn hu₁_B₂ hB₂_sub hu₂_B₂ + have h_jan := disc_janiszewski_disjoint hS hK₁_closed hK₂_closed hK_disj + hu₁_notK hu₂_notK hab₁ hab₂ + rw [hK_union] at h_jan + exact connectedComponentIn_eq h_jan + +/-! ## 4. Spanning Trees and Proof of Theorem (3.2) -/ + +private def walkToRestrictDiff {α : Type u} {β : Type v} {C : Graph α β} {e₀ : β} + {x y : α} (W : GraphWalk C x y) + (hedges : ∀ e ∈ W.edges, e ≠ e₀) : GraphWalk (C.restrict (E(C) \ {e₀})) x y := + match W with + | .nil hx => .nil hx + | @GraphWalk.cons _ _ _ x v y e h rest => + have hne : e ≠ e₀ := hedges e (by simp [GraphWalk.edges]) + have hlink' : (C.restrict (E(C) \ {e₀})).IsLink e x v := by + rw [restrict_isLink] + exact ⟨⟨h.edge_mem, hne⟩, h⟩ + .cons hlink' + (walkToRestrictDiff rest fun e' he' => hedges e' (by simp [GraphWalk.edges, he'])) + +private theorem walkAvoidEdge {α : Type u} {β : Type v} {C : Graph α β} {e₀ : β} {u₀ w₀ : α} + (hlink₀ : C.IsLink e₀ u₀ w₀) + (P : GraphWalk (C.restrict (E(C) \ {e₀})) w₀ u₀) + {x y : α} (W : GraphWalk C x y) : + Nonempty (GraphWalk (C.restrict (E(C) \ {e₀})) x y) := by + classical + induction W with + | nil hx => exact ⟨.nil hx⟩ + | @cons a b y e h rest ih => + obtain ⟨W_rest⟩ := ih + rcases eq_or_ne a b with rfl | hab + · exact ⟨W_rest⟩ + · rcases eq_or_ne e e₀ with rfl | hne + · rcases h.left_eq_or_eq hlink₀ with rfl | rfl + · rcases h.symm.left_eq_or_eq hlink₀ with rfl | rfl + · exact (hab rfl).elim + · exact ⟨P.reverse.append W_rest⟩ + · rcases h.symm.left_eq_or_eq hlink₀.symm with rfl | rfl + · exact (hab rfl).elim + · exact ⟨P.append W_rest⟩ + · have hlink' : (C.restrict (E(C) \ {e₀})).IsLink e a b := by + rw [restrict_isLink] + exact ⟨⟨h.edge_mem, hne⟩, h⟩ + exact ⟨.cons hlink' W_rest⟩ + +/-- Every connected graph with finitely many edges has a spanning tree (a connected forest subgraph +with the same vertex set). -/ +theorem exists_spanning_tree {α : Type u} {β : Type v} {C : Graph α β} + (hE_fin : E(C).Finite) (hConn : IsGraphConnected C) : + ∃ T : Graph α β, T ≤ C ∧ V(T) = V(C) ∧ IsGraphConnected T ∧ IsGraphForest T := by + classical + induction hn : E(C).ncard using Nat.strong_induction_on generalizing C with + | _ n ih => + by_cases hF : IsGraphForest C + · exact ⟨C, le_rfl, rfl, hConn, hF⟩ + · unfold IsGraphForest at hF + push Not at hF + obtain ⟨u₀, W, hW_sc, hW_len⟩ := hF + cases W with + | nil _ => exact (hW_len rfl).elim + | @cons _ w₀ _ e₀ hlink₀ rest => + have hnodup : (e₀ :: rest.edges).Nodup := hW_sc.2 + have he₀_not_rest : e₀ ∉ rest.edges := (List.nodup_cons.mp hnodup).1 + let C' := C.restrict (E(C) \ {e₀}) + have hE_C' : E(C') = E(C) \ {e₀} := by + ext e + simp only [C', edgeSet_restrict, mem_inter_iff, mem_sdiff, mem_singleton_iff] + tauto + let P : GraphWalk C' w₀ u₀ := + walkToRestrictDiff rest (fun e he h => he₀_not_rest (h ▸ he)) + have hConn' : IsGraphConnected C' := by + refine ⟨hConn.1, fun x hx y hy => ?_⟩ + obtain ⟨W_xy⟩ := hConn.2 x hx y hy + exact walkAvoidEdge hlink₀ P W_xy + have hE'_fin : E(C').Finite := hE_fin.subset (hE_C' ▸ sdiff_subset) + have hlt : E(C').ncard < n := by + rw [hE_C', ← hn] + exact ncard_sdiff_singleton_lt_of_mem hlink₀.edge_mem hE_fin + obtain ⟨T, hTC', hVT, hConnT, hFT⟩ := ih _ hlt hE'_fin hConn' rfl + exact ⟨T, hTC'.trans restrict_le, hVT, hConnT, hFT⟩ + +theorem isDivision_dualDivision {S : Type u} [TopologicalSpace S] + {C U : Set S} {Δ : Set (Set S)} + (hC : IsOArc C) (hV_fin : (divisionUnion Δ).Finite) (hV_sub : divisionUnion Δ ⊆ C) + (hU : IsDualPointSet C (divisionUnion Δ) U) : + IsDivision (dualDivision C U Δ) := + isDivision_dualDivision_of_isOArc hC hV_fin hV_sub hU + +theorem isFeasible_empty {α β : Type*} (G : Graph α β) : + IsFeasible G (∅ : Set (Set α)) := by + refine ⟨⊥, ⟨finite_empty, fun _ h => False.elim h, fun _ h => False.elim h⟩, ?_, bot_le, ?_, + fun _ => ⊥, injOn_empty _, fun _ h => False.elim h, ?_⟩ + · simp [divisionUnion] + · intro u W _ + cases W with + | nil hu => exact False.elim hu + | cons h _ => exact False.elim h.left_mem + · ext C + simp only [graphComponents, mem_ofPred_eq, image_empty, mem_empty_iff_false, iff_false] + intro hC + rcases hC.2.1.1 with ⟨v, hv⟩ + exact hC.1.vertexSet_mono hv + +private theorem span_V_eq_self {S : Type u} [TopologicalSpace S] [T2Space S] + (G : Drawing S) (E' : Set (Set S)) : + (G.span G.V E').V = G.V := by + refine Subset.antisymm (G.spanV_subset G.V E') ?_ + intro v hv + exact Or.inl ⟨hv, hv⟩ + +private def walkSpanToSubgraph {S : Type u} [TopologicalSpace S] [T2Space S] + {G : Drawing S} {H : Graph S (Set S)} (hHG : H ≤ G.toGraph) + {x y : S} (hx : x ∈ V(H)) : + GraphWalk (G.span G.V E(H)).toGraph x y → GraphWalk H x y + | .nil _ => .nil hx + | @GraphWalk.cons _ _ _ x v y e h rest => + have heH : e ∈ E(H) := by + have he_span : e ∈ (G.span G.V E(H)).E := h.1 + rw [G.span_E G.V E(H)] at he_span + exact he_span.1 + have hV_eq : (G.span G.V E(H)).V = G.V := span_V_eq_self G E(H) + have hG : G.toGraph.IsLink e x v := by + refine ⟨hHG.edgeSet_mono heH, ?_, ?_, ?_⟩ + · have := h.2.1; rwa [hV_eq] at this + · have := h.2.2.1; rwa [hV_eq] at this + · have := h.2.2.2; rwa [hV_eq] at this + have hH : H.IsLink e x v := (hHG.isLink_iff heH).mpr hG + .cons hH (walkSpanToSubgraph hHG hH.right_mem rest) + +private theorem isFeasible_of_dual_components {S : Type u} [TopologicalSpace S] + {C U : Set S} {Δ : Set (Set S)} {G_dual : Drawing S} {K_star : Graph S (Set S)} + (hC : IsOArc C) (hV_sub : divisionUnion Δ ⊆ C) (hU_sub : U ⊆ C \ divisionUnion Δ) + (hK_le : K_star ≤ G_dual.toGraph) (hU_vertices : U ⊆ V(K_star)) : + let Δ_star := dualDivision C U Δ + IsDivision Δ_star → divisionUnion Δ_star = U → + (∀ u₁ ∈ U, ∀ u₂ ∈ U, Nonempty (GraphWalk K_star u₁ u₂) → dualEquivRel C Δ u₁ u₂) → + (∀ u₁ ∈ U, ∀ u₂ ∈ U, dualEquivRel C Δ u₁ u₂ → Nonempty (GraphWalk K_star u₁ u₂)) → + IsFeasible G_dual.toGraph Δ_star := by + classical + intro Δ_star hΔ_star_div hΔ_star_union h_walk_imp_equiv h_equiv_imp_walk + have : Finite Δ_star := hΔ_star_div.1 + obtain ⟨k, ⟨enum₀⟩⟩ := Finite.exists_equiv_fin Δ_star + let enum : Fin k ≃ Δ_star := enum₀.symm + have hrep : ∀ i : Fin k, (enum i).1.Nonempty := fun i => hΔ_star_div.2.1 (enum i).1 (enum i).2 + let u₀ : Fin k → S := fun i => (hrep i).some + have hu₀_mem : ∀ i : Fin k, u₀ i ∈ (enum i).1 := fun i => (hrep i).some_mem + have hu₀_U : ∀ i : Fin k, u₀ i ∈ U := fun i => + hΔ_star_union ▸ ⟨(enum i).1, (enum i).2, hu₀_mem i⟩ + have hu₀_V : ∀ i : Fin k, u₀ i ∈ V(K_star) := fun i => hU_vertices (hu₀_U i) + let C_fam : Fin k → Graph S (Set S) := fun i => compOf K_star (u₀ i) + have hC_comp : ∀ i : Fin k, IsGraphComponent (C_fam i) K_star := + fun i => isGraphComponent_compOf (hu₀_V i) + have hδ_sub_C : ∀ i : Fin k, (enum i).1 ⊆ V(C_fam i) := by + intro i u hu + have hu_U : u ∈ U := hΔ_star_union ▸ ⟨(enum i).1, (enum i).2, hu⟩ + have hδ_eq := dualDivision_mem_eq_of_mem hC hV_sub hU_sub (enum i).2 (hu₀_mem i) + have hequiv : dualEquivRel C Δ (u₀ i) u := by + rw [hδ_eq] at hu + exact hu.2 + exact ⟨hU_vertices hu_U, h_equiv_imp_walk (u₀ i) (hu₀_U i) u hu_U hequiv⟩ + have hC_ne : ∀ {i j : Fin k}, i ≠ j → C_fam i ≠ C_fam j := by + intro i j hne heq + have hu_in : u₀ j ∈ V(C_fam i) := heq ▸ self_mem_reachSet (hu₀_V j) + have hequiv : dualEquivRel C Δ (u₀ i) (u₀ j) := + h_walk_imp_equiv (u₀ i) (hu₀_U i) (u₀ j) (hu₀_U j) hu_in.2 + have hδ_eq := dualDivision_mem_eq_of_mem hC hV_sub hU_sub (enum i).2 (hu₀_mem i) + have hu₀j_in_i : u₀ j ∈ (enum i).1 := by + rw [hδ_eq] + exact ⟨hu₀_U j, hequiv⟩ + have hne_δ : (enum i).1 ≠ (enum j).1 := fun h => hne (enum.injective (Subtype.ext h)) + exact (hΔ_star_div.2.2 (enum i).2 (enum j).2 hne_δ).ne_of_mem hu₀j_in_i (hu₀_mem j) rfl + have hT_exists : ∀ i : Fin k, ∃ T : Graph S (Set S), + T ≤ C_fam i ∧ V(T) = V(C_fam i) ∧ IsGraphConnected T ∧ IsGraphForest T := by + intro i + have hE_fin : E(C_fam i).Finite := + G_dual.finite_edges.subset ((hC_comp i).1.trans hK_le).edgeSet_mono + exact exists_spanning_tree hE_fin (hC_comp i).2.1 + choose T_fam hT_le hT_V hT_conn hT_forest using hT_exists + have hT_le_Gd : ∀ i : Fin k, T_fam i ≤ G_dual.toGraph := + fun i => (hT_le i).trans ((hC_comp i).1.trans hK_le) + have hT_V_disj : Pairwise fun i j : Fin k => Disjoint V(T_fam i) V(T_fam j) := by + intro i j hne + rw [hT_V i, hT_V j] + exact (hC_comp i).disjoint_vertexSet_of_ne (hC_comp j) (hC_ne hne) + have hT_E_disj : Pairwise fun i j : Fin k => Disjoint E(T_fam i) E(T_fam j) := by + intro i j hne + exact ((hC_comp i).disjoint_edgeSet_of_ne (hC_comp j) (hC_ne hne)).mono + (hT_le i).edgeSet_mono (hT_le j).edgeSet_mono + have hT_is_comp_self : ∀ i : Fin k, IsGraphComponent (T_fam i) (T_fam i) := + fun i => ⟨le_rfl, hT_conn i, fun C' hle hle' _ => le_antisymm hle' hle⟩ + have hcomp_in_Ti : ∀ (i : Fin k) (K : Graph S (Set S)), + IsGraphComponent K (T_fam i) ↔ K = T_fam i := by + intro i K + refine ⟨fun hK => (hK.2.2 (T_fam i) hK.1 le_rfl (hT_conn i)).symm, ?_⟩ + rintro rfl + exact hT_is_comp_self i + let H_star := graphUnionFamily G_dual.toGraph T_fam + let H_star_comp : Set S → Graph S (Set S) := fun δ => + if hδ : δ ∈ Δ_star then T_fam (enum.symm ⟨δ, hδ⟩) else ⊥ + have hΔ_star_sub_Gd : divisionUnion Δ_star ⊆ V(G_dual.toGraph) := by + rw [hΔ_star_union] + exact hU_vertices.trans hK_le.vertexSet_mono + refine ⟨H_star, hΔ_star_div, hΔ_star_sub_Gd, + graphUnionFamily_le G_dual.toGraph T_fam hT_le_Gd, + isGraphForest_graphUnionFamily hT_le_Gd hT_V_disj hT_E_disj hT_forest, + H_star_comp, ?_, ?_, ?_⟩ + · intro δ₁ hδ₁ δ₂ hδ₂ heq + dsimp only [H_star_comp] at heq + simp only [hδ₁, hδ₂, ↓reduceDIte] at heq + let i₁ := enum.symm ⟨δ₁, hδ₁⟩ + let i₂ := enum.symm ⟨δ₂, hδ₂⟩ + have hi_eq : i₁ = i₂ := by + by_contra hne + have h_v : u₀ i₁ ∈ V(T_fam i₁) := by rw [hT_V i₁]; exact self_mem_reachSet (hu₀_V i₁) + have h_v2 : u₀ i₁ ∈ V(T_fam i₂) := heq ▸ h_v + exact disjoint_left.mp (hT_V_disj hne) h_v h_v2 + exact congrArg Subtype.val (enum.symm.injective hi_eq) + · intro δ hδ + dsimp only [H_star_comp] + simp only [hδ, ↓reduceDIte] + let i := enum.symm ⟨δ, hδ⟩ + have hi_val : (enum i).1 = δ := congrArg Subtype.val (enum.apply_symm_apply ⟨δ, hδ⟩) + refine ⟨(isGraphComponent_graphUnionFamily_iff hT_le_Gd hT_V_disj hT_E_disj).mpr + ⟨i, hT_is_comp_self i⟩, ?_⟩ + rw [hT_V i, ← hi_val] + exact hδ_sub_C i + · ext K + change IsGraphComponent K H_star ↔ K ∈ H_star_comp '' Δ_star + rw [isGraphComponent_graphUnionFamily_iff hT_le_Gd hT_V_disj hT_E_disj, mem_image] + constructor + · rintro ⟨i, hKi⟩ + rw [hcomp_in_Ti i K] at hKi + subst hKi + refine ⟨(enum i).1, (enum i).2, ?_⟩ + dsimp only [H_star_comp] + simp [(enum i).2] + · rintro ⟨δ, hδ, rfl⟩ + dsimp only [H_star_comp] + simp only [hδ, ↓reduceDIte] + exact ⟨enum.symm ⟨δ, hδ⟩, hT_is_comp_self _⟩ + +/-- Forward direction of Graph Minors VI, (3.2): if `Δ` is feasible in `G`, then `Δ*` is feasible +in `G_dual`. -/ +theorem isFeasible_dualDivision_of_isFeasible {S : Type u} [TopologicalSpace S] + (hS : IsClosedDiscSpace S) {G G_dual : Drawing S} {Δ : Set (Set S)} + (hDual : IsDiscDualDrawing G G_dual) (_hΔ : IsDivision Δ) + (hΔ_union : divisionUnion Δ = G.V ∩ bd S) + (hFeas : IsFeasible G.toGraph Δ) : + IsFeasible G_dual.toGraph (dualDivision (bd S) (G_dual.V ∩ bd S) Δ) := by + classical + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + let U := G_dual.V ∩ bd S + let Δ_star := dualDivision (bd S) U Δ + have hC : IsOArc (bd S) := hS.isOArc_bd + have hV_fin : (divisionUnion Δ).Finite := by + rw [hΔ_union] + exact G.finite_V.subset inter_subset_left + have hV_sub : divisionUnion Δ ⊆ bd S := by + rw [hΔ_union] + exact inter_subset_right + have hU : IsDualPointSet (bd S) (divisionUnion Δ) U := by + rw [hΔ_union] + exact hDual.2.2.2.2.1 + have hU_sub : U ⊆ bd S \ divisionUnion Δ := isDualPointSet_subset_diff hU + have hΔ_star_div : IsDivision Δ_star := isDivision_dualDivision hC hV_fin hV_sub hU + have hΔ_star_union : divisionUnion Δ_star = U := divisionUnion_dualDivision (bd S) U Δ + obtain ⟨H, _, _, hHG, _, H_comp, hinj_H, hcomp_H, _⟩ := hFeas + obtain ⟨edgeEquiv, hedge⟩ := hDual.2.2.2.2.2.2 + let Γ' : Drawing S := G.span G.V E(H) + have hsub_Γ' : Γ'.IsSubdrawing G := Drawing.span_isSubdrawing G G.V E(H) + have hΓ'_V : Γ'.V = G.V := span_V_eq_self G E(H) + have hprop_Γ' : Γ'.IsProper := by + rintro x ⟨hxbd, hxU⟩ + rw [hΓ'_V] + exact hDual.1 ⟨hxbd, hsub_Γ'.U_subset hxU⟩ + let E_star : Set (Set S) := + {e' ∈ G_dual.E | ∃ e : G.E, (edgeEquiv e).1 = e' ∧ e.1 ∉ E(H)} + let K_star : Graph S (Set S) := G_dual.toGraph.restrict E_star + have hK_le : K_star ≤ G_dual.toGraph := restrict_le + -- 1. Walk in K_star between u₁, u₂ ∈ U implies dualEquivRel (bd S) Δ u₁ u₂ + have h_walk_imp_equiv : ∀ u₁ ∈ U, ∀ u₂ ∈ U, + Nonempty (GraphWalk K_star u₁ u₂) → dualEquivRel (bd S) Δ u₁ u₂ := by + rintro u₁ _ u₂ _ ⟨W⟩ ⟨δ, hδ, v₁, hv₁, v₂, hv₂, hcross⟩ + have hCδ : IsGraphComponent (H_comp δ) H := (hcomp_H δ hδ).1 + have hv₁C : v₁ ∈ V(H_comp δ) := (hcomp_H δ hδ).2 hv₁ + have hv₂C : v₂ ∈ V(H_comp δ) := (hcomp_H δ hδ).2 hv₂ + obtain ⟨W_H⟩ := hCδ.2.1.2 v₁ hv₁C v₂ hv₂C + obtain ⟨K_H, hKH_comp, hKH_conn, hv₁_KH, hv₂_KH, hKH_sub, hKH_U, _⟩ := + exists_compact_connected_of_walk G (hCδ.1.trans hHG) W_H + obtain ⟨K_W, hKW_comp, hKW_conn, hu₁_KW, hu₂_KW, hKW_sub, hKW_U, _⟩ := + exists_compact_connected_of_walk G_dual hK_le W + obtain ⟨z, hzH, hzW⟩ := discCrossing_of_isClosedDiscSpace hS + hKH_comp hKW_comp hKH_conn hKW_conn hv₁_KH hv₂_KH hu₁_KW hu₂_KW hcross + rcases hKH_sub hzH with hzVH | hzEH + · exact disjoint_left.mp hDual.disjoint_V_dual_U + ((hCδ.1.trans hHG).vertexSet_mono hzVH) (hKW_U hzW) + · rcases hKW_sub hzW with hzVW | hzEW + · obtain ⟨r, hr, hzr⟩ := hDual.2.2.2.1 z hzVW + exact region_subset hr hzr (hKH_U hzH) + · simp only [mem_iUnion, exists_prop] at hzEH hzEW + obtain ⟨e₁, he₁C, hze₁⟩ := hzEH + obtain ⟨e', he'K, hze'⟩ := hzEW + have he₁H : e₁ ∈ E(H) := hCδ.1.edgeSet_mono he₁C + have he₁G : e₁ ∈ G.E := hHG.edgeSet_mono he₁H + have he'E : e' ∈ E_star := he'K.2 + obtain ⟨_, e₀, rfl, he₀_notH⟩ := he'E + have hz_cap : z ∈ (edgeEquiv e₀).1 ∩ G.U := ⟨hze', hKH_U hzH⟩ + rw [(hedge e₀).1] at hz_cap + have heq_e : e₁ = e₀.1 := by + by_contra hne + exact disjoint_left.mp (disjoint_edges_of_ne G he₁G e₀.2 hne) hze₁ hz_cap.2 + exact he₀_notH (heq_e ▸ he₁H) + -- 2. dualEquivRel (bd S) Δ u₁ u₂ implies a walk in K_star between u₁ and u₂ + have h_equiv_imp_walk : ∀ u₁ ∈ U, ∀ u₂ ∈ U, + dualEquivRel (bd S) Δ u₁ u₂ → Nonempty (GraphWalk K_star u₁ u₂) := by + intro u₁ hu₁ u₂ hu₂ hequiv + have hu₁_not_GU : u₁ ∉ G.U := by + obtain ⟨r, hr, hur⟩ := hDual.2.2.2.1 u₁ hu₁.1 + exact region_subset hr hur + have hu₂_not_GU : u₂ ∉ G.U := by + obtain ⟨r, hr, hur⟩ := hDual.2.2.2.1 u₂ hu₂.1 + exact region_subset hr hur + have hu₁_not_Γ'U : u₁ ∉ Γ'.U := fun h => hu₁_not_GU (hsub_Γ'.U_subset h) + have hu₂_not_Γ'U : u₂ ∉ Γ'.U := fun h => hu₂_not_GU (hsub_Γ'.U_subset h) + have hno_cross : ∀ C ∈ graphComponents Γ'.toGraph, + ∀ v₁ ∈ V(C) ∩ bd S, ∀ v₂ ∈ V(C) ∩ bd S, ¬ CrossesOn (bd S) v₁ v₂ u₁ u₂ := by + intro C hC v₁ hv₁ v₂ hv₂ hcross + have hv₁_div : v₁ ∈ divisionUnion Δ := by + rw [hΔ_union] + have hv₁_Γ' : v₁ ∈ Γ'.V := hC.1.vertexSet_mono hv₁.1 + rw [hΓ'_V] at hv₁_Γ' + exact ⟨hv₁_Γ', hv₁.2⟩ + have hv₂_div : v₂ ∈ divisionUnion Δ := by + rw [hΔ_union] + have hv₂_Γ' : v₂ ∈ Γ'.V := hC.1.vertexSet_mono hv₂.1 + rw [hΓ'_V] at hv₂_Γ' + exact ⟨hv₂_Γ', hv₂.2⟩ + obtain ⟨δ₁, hδ₁, hv₁_δ₁⟩ := hv₁_div + obtain ⟨δ₂, hδ₂, hv₂_δ₂⟩ := hv₂_div + have hv₁_H : v₁ ∈ V(H) := + (hcomp_H δ₁ hδ₁).1.1.vertexSet_mono ((hcomp_H δ₁ hδ₁).2 hv₁_δ₁) + obtain ⟨W_C⟩ := hC.2.1.2 v₁ hv₁.1 v₂ hv₂.1 + let W_H : GraphWalk H v₁ v₂ := walkSpanToSubgraph hHG hv₁_H (W_C.mono hC.1) + have hv₂_in_comp1 : v₂ ∈ V(H_comp δ₁) := by + rw [(hcomp_H δ₁ hδ₁).1.eq_compOf_of_mem ((hcomp_H δ₁ hδ₁).2 hv₁_δ₁)] + exact ⟨W_H.mem_vertexSet_of_mem_support W_H.end_mem_support, ⟨W_H⟩⟩ + have hv₂_in_comp2 : v₂ ∈ V(H_comp δ₂) := (hcomp_H δ₂ hδ₂).2 hv₂_δ₂ + have hδ_eq : δ₁ = δ₂ := hinj_H hδ₁ hδ₂ + ((hcomp_H δ₁ hδ₁).1.eq_of_mem_mem (hcomp_H δ₂ hδ₂).1 hv₂_in_comp1 hv₂_in_comp2) + subst hδ_eq + exact hequiv ⟨δ₁, hδ₁, v₁, hv₁_δ₁, v₂, hv₂_δ₂, hcross⟩ + have hsame_reg := same_region_of_no_component_crosses hS Γ' hprop_Γ' + hu₁.2 hu₂.2 hu₁_not_Γ'U hu₂_not_Γ'U hno_cross + let r' := connectedComponentIn (univ \ Γ'.U) u₁ + have hr' : r' ∈ Γ'.R := ⟨u₁, ⟨mem_univ u₁, hu₁_not_Γ'U⟩, rfl⟩ + obtain ⟨r₁, hr₁, hu₁_r₁⟩ := hDual.2.2.2.1 u₁ hu₁.1 + obtain ⟨r₂, hr₂, hu₂_r₂⟩ := hDual.2.2.2.1 u₂ hu₂.1 + have hs₁ : r₁ ⊆ r' := subset_region hr' (region_isPreconnected hr₁) + (disjoint_left.mpr fun y hy h => region_subset hr₁ hy (hsub_Γ'.U_subset h)) + hu₁_r₁ (mem_connectedComponentIn ⟨mem_univ u₁, hu₁_not_Γ'U⟩) + have hs₂ : r₂ ⊆ r' := subset_region hr' (region_isPreconnected hr₂) + (disjoint_left.mpr fun y hy h => region_subset hr₂ hy (hsub_Γ'.U_subset h)) + hu₂_r₂ (by dsimp [r']; rw [hsame_reg]; exact mem_connectedComponentIn ⟨mem_univ u₂, + hu₂_not_Γ'U⟩) + let Z : Set (Set S) := {r ∈ G.R | ∃ w ∈ r ∩ G_dual.V, w ∈ reachSet K_star u₁} + have hz₁ : r₁ ∈ Z := ⟨hr₁, u₁, ⟨hu₁_r₁, hu₁.1⟩, self_mem_reachSet hu₁.1⟩ + by_contra hnot_walk + have hz₂ : r₂ ∉ Z := by + rintro ⟨_, w, ⟨hw_r₂, hw_V⟩, hw_reach⟩ + have hwu₂ : w = u₂ := (hDual.2.2.1 r₂ hr₂).unique ⟨hw_r₂, hw_V⟩ ⟨hu₂_r₂, hu₂.1⟩ + exact hnot_walk (hwu₂ ▸ hw_reach).2 + obtain ⟨e₀, he₀G, he₀_not, a, b, haZ, hbZ, _, _, hia, hib⟩ := + disc_theorem_5_1 hS hDual.1 hsub_Γ' hr' hr₁ hz₁ hr₂ hz₂ hs₁ hs₂ + have haR : a ∈ G.R := hia.2.1 + have hbR : b ∈ G.R := hib.2.1 + have hab_ne : a ≠ b := fun h => hbZ (h ▸ haZ) + have ha_inc : e₀ ⊆ closure a := disc_edge_subset_closure_of_incident hS hDual.1 he₀G haR hia.2.2 + have hb_inc : e₀ ⊆ closure b := disc_edge_subset_closure_of_incident hS hDual.1 he₀G hbR hib.2.2 + have hall_inc : ∀ r ∈ G.R, G.EdgeRegionIncident e₀ r → r = a ∨ r = b := by + intro r hr hinc + have hr_inc : e₀ ⊆ closure r := disc_edge_subset_closure_of_incident hS hDual.1 he₀G hr + hinc.2.2 + rcases disc_region_incident_two hS hDual.1 he₀G haR hbR hr ha_inc hb_inc hr_inc with + hab | har | hbr + · exact (hab_ne hab).elim + · exact Or.inl har.symm + · exact Or.inr hbr.symm + obtain ⟨_, w_a, hwa_mem, hwa_reach⟩ := haZ + obtain ⟨w_b, hwb_mem, _⟩ := hDual.2.2.1 b hbR + let e_sub : G.E := ⟨e₀, he₀G⟩ + have hlink_dual : G_dual.toGraph.IsLink (edgeEquiv e_sub).1 w_a w_b := + ((hedge e_sub).2.2.2.2 a haR b hbR w_a hwa_mem w_b hwb_mem).mpr ⟨hia, hib, hall_inc⟩ + have he'_star : (edgeEquiv e_sub).1 ∈ E_star := by + refine ⟨(edgeEquiv e_sub).2, e_sub, rfl, ?_⟩ + intro he₀H + apply he₀_not + rw [G.span_E G.V E(H)] + exact ⟨he₀H, he₀G⟩ + have hlink_K : K_star.IsLink (edgeEquiv e_sub).1 w_a w_b := by + rw [restrict_isLink] + exact ⟨he'_star, hlink_dual⟩ + exact hbZ ⟨hbR, w_b, hwb_mem, reachSet_step hwa_reach hlink_K⟩ + -- 3. Assemble a forest realization of Δ_star in G_dual.toGraph + change IsFeasible G_dual.toGraph Δ_star + by_cases hΔ_star_empty : Δ_star = ∅ + · rw [hΔ_star_empty] + exact isFeasible_empty G_dual.toGraph + exact isFeasible_of_dual_components hC hV_sub hU_sub hK_le inter_subset_left + hΔ_star_div hΔ_star_union h_walk_imp_equiv h_equiv_imp_walk + +/-- **Graph Minors VI, (3.2)** (page 120): +"Let $G$ be a connected graph, properly drawn on a disc $\Sigma$. Let $\Delta$ be a +cross-free division with* $$\bigcup \Delta = V(G) \cap bd(\Sigma).$$ *Let the drawing of +$G^*$ be chosen so that* $$\bigcup \Delta^* = V(G^*) \cap bd(\Sigma).$$ *Then $\Delta$ is +feasible in $G$ if and only if $\Delta^*$ is feasible in $G^*$." -/ +theorem theorem_3_2_proof : Statement32.{u} := by + intro S _ G G_dual Δ hS hConn hΔ hΔ_union hCF hDual + constructor + · exact isFeasible_dualDivision_of_isFeasible hS hDual hΔ hΔ_union + · intro hFeas_dual + have hDual_symm : IsDiscDualDrawing G_dual G := hDual.symm_of_connected hS hConn + let U := G_dual.V ∩ bd S + let Δ_star := dualDivision (bd S) U Δ + have hC : IsOArc (bd S) := hS.isOArc_bd + have hV_fin : (divisionUnion Δ).Finite := by + rw [hΔ_union] + exact G.finite_V.subset inter_subset_left + have hV_sub : divisionUnion Δ ⊆ bd S := by + rw [hΔ_union] + exact inter_subset_right + have hU : IsDualPointSet (bd S) (divisionUnion Δ) U := by + rw [hΔ_union] + exact hDual.2.2.2.2.1 + have hΔ_star_div : IsDivision Δ_star := isDivision_dualDivision hC hV_fin hV_sub hU + have hΔ_star_union : divisionUnion Δ_star = G_dual.V ∩ bd S := + divisionUnion_dualDivision (bd S) U Δ + have hFeas_double := + isFeasible_dualDivision_of_isFeasible hS hDual_symm hΔ_star_div hΔ_star_union hFeas_dual + have h_double : dualDivision (bd S) (G.V ∩ bd S) Δ_star = Δ := by + rw [← hΔ_union] + exact theorem_2_2_proof (bd S) U Δ hC hΔ hV_fin hV_sub hU hCF + rwa [h_double] at hFeas_double + +end GraphMinor.GM06 diff --git a/LeanPool/GraphMinor/GM06/Section3Induce.lean b/LeanPool/GraphMinor/GM06/Section3Induce.lean new file mode 100644 index 0000000000..2c5858b5a8 --- /dev/null +++ b/LeanPool/GraphMinor/GM06/Section3Induce.lean @@ -0,0 +1,1266 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.Section3Dual +public import LeanPool.GraphMinor.GM06.RegionCurve +import Mathlib.Analysis.Convex.PathConnected + +/-! +# Graph Minors VI, Section 3: Induced Subdrawings and Chain Reductions for (3.6) + +This file develops the subdrawing reduction machinery for the sufficiency proof of +Robertson and Seymour, *Graph Minors. VI. Disjoint paths across a disc*, (3.6) (page 122): +- `induceDrawing G V'`: the subdrawing of `G` induced by a subset of vertices `V' ⊆ G.V`, + matching `G.toGraph.induce V'` and `G.toGraph.deleteVerts S`. +- `isConnected_compPointSet`: the point-set `compPointSet C` of a connected component `C` of + `G.toGraph` is connected. +- `exists_region_of_same_component_compl` and `liftChain_of_subdrawing`: lifting `(x, y)`-chains + from an induced subdrawing `G₁` to `G` via `disc_janiszewski_disjoint`. +-/ + +public section + +namespace GraphMinor.GM06 + +open Set Function Topology Metric Graph GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Induced Subdrawings `induceDrawing` -/ + +/-- The subdrawing of `G` induced by a subset of vertices `V'`: its vertices are `V' ∩ G.V` and its +edges are the edges of `G` whose ends both lie in `V'`. -/ +def induceDrawing [T1Space S] (G : Drawing S) (V' : Set S) : Drawing S := + G.span V' {e ∈ G.E | closure e ∩ G.V ⊆ V'} + +theorem induceDrawing_V [T1Space S] (G : Drawing S) {V' : Set S} (hV' : V' ⊆ G.V) : + (induceDrawing G V').V = V' := by + rw [induceDrawing, Drawing.span_V, Drawing.spanV, inter_eq_left.mpr hV'] + refine subset_antisymm (union_subset subset_rfl ?_) subset_union_left + rintro x hx + obtain ⟨e, ⟨⟨_, hsub⟩, _⟩, hx_cap⟩ := mem_iUnion₂.mp hx + exact hsub hx_cap + +theorem induceDrawing_E [T1Space S] (G : Drawing S) (V' : Set S) : + (induceDrawing G V').E = {e ∈ G.E | closure e ∩ G.V ⊆ V'} := by + rw [induceDrawing, Drawing.span_E] + ext e + simp only [mem_inter_iff, mem_ofPred_eq] + tauto + +theorem induceDrawing_U [T1Space S] (G : Drawing S) {V' : Set S} (hV' : V' ⊆ G.V) : + (induceDrawing G V').U = V' ∪ ⋃ e ∈ (induceDrawing G V').E, e := by + have h1 : (induceDrawing G V').U = + (induceDrawing G V').V ∪ ⋃ e ∈ {e ∈ G.E | closure e ∩ G.V ⊆ V'} ∩ G.E, closure e := rfl + rw [h1, induceDrawing_V G hV', induceDrawing_E] + ext x + simp only [mem_union, mem_inter_iff, mem_ofPred_eq, mem_iUnion, exists_prop] + constructor + · rintro (hxV' | ⟨e, ⟨⟨heG, hsub⟩, _⟩, hxcl⟩) + · exact Or.inl hxV' + · by_cases hxV : x ∈ G.V + · exact Or.inl (hsub ⟨hxcl, hxV⟩) + · right + refine ⟨e, ⟨heG, hsub⟩, ?_⟩ + rw [← G.closure_diff_V heG] + exact ⟨hxcl, hxV⟩ + · rintro (hxV' | ⟨e, ⟨heG, hsub⟩, hxe⟩) + · exact Or.inl hxV' + · exact Or.inr ⟨e, ⟨⟨heG, hsub⟩, heG⟩, subset_closure hxe⟩ + +theorem induceDrawing_U_inter_V [T1Space S] (G : Drawing S) {V' : Set S} (hV' : V' ⊆ G.V) : + (induceDrawing G V').U ∩ G.V = V' := by + rw [induceDrawing_U G hV'] + ext x + simp only [mem_inter_iff, mem_union, mem_iUnion, exists_prop] + constructor + · rintro ⟨hxV' | ⟨e, heE, hxe⟩, hxV⟩ + · exact hxV' + · rw [induceDrawing_E] at heE + have heG : e ∈ G.E := heE.1 + exact ((heG.2.1 hxe).2 hxV).elim + · intro hxV' + exact ⟨Or.inl hxV', hV' hxV'⟩ + +theorem induceDrawing_isSubdrawing [T1Space S] (G : Drawing S) {V' : Set S} (hV' : V' ⊆ G.V) : + (induceDrawing G V').IsSubdrawing G := by + refine ⟨?_, ?_⟩ + · rw [induceDrawing_V G hV'] + exact hV' + · rw [induceDrawing_E] + exact fun _ he => he.1 + +theorem induceDrawing_isProper [T1Space S] (G : Drawing S) (hProper : G.IsProper) + {V' : Set S} (hV' : V' ⊆ G.V) : + (induceDrawing G V').IsProper := by + rintro x ⟨hxbd, hxU'⟩ + have hsub := (induceDrawing_isSubdrawing G hV').U_subset + have hxV : x ∈ G.V := hProper ⟨hxbd, hsub hxU'⟩ + rw [induceDrawing_V G hV', ← induceDrawing_U_inter_V G hV'] + exact ⟨hxU', hxV⟩ + +theorem induceDrawing_toGraph_eq_induce [T1Space S] (G : Drawing S) {V' : Set S} + (hV' : V' ⊆ G.V) : + (induceDrawing G V').toGraph = G.toGraph.induce V' := by + refine Graph.ext ?_ fun e x y => ?_ + · change (induceDrawing G V').V = V' + exact induceDrawing_V G hV' + · change (e ∈ (induceDrawing G V').E ∧ x ∈ (induceDrawing G V').V ∧ + y ∈ (induceDrawing G V').V ∧ closure e ∩ (induceDrawing G V').V = {x, y}) ↔ + (G.toGraph.induce V').IsLink e x y + rw [induce_isLink, induceDrawing_V G hV', induceDrawing_E] + constructor + · rintro ⟨⟨heG, hsub⟩, hxV', hyV', hcap⟩ + have hcap_G : closure e ∩ G.V = {x, y} := by + rw [← hcap] + ext z + simp only [mem_inter_iff] + exact ⟨fun ⟨hzcl, hzV⟩ => ⟨hzcl, hsub ⟨hzcl, hzV⟩⟩, + fun ⟨hzcl, hzV'⟩ => ⟨hzcl, hV' hzV'⟩⟩ + exact ⟨⟨heG, hV' hxV', hV' hyV', hcap_G⟩, hxV', hyV'⟩ + · rintro ⟨⟨heG, _, _, hcap_G⟩, hxV', hyV'⟩ + have hsub : closure e ∩ G.V ⊆ V' := by + rw [hcap_G] + rintro z (rfl | hzy) + · exact hxV' + · rw [mem_singleton_iff.mp hzy] + exact hyV' + have hcap : closure e ∩ V' = {x, y} := by + rw [← hcap_G] + ext z + simp only [mem_inter_iff] + exact ⟨fun ⟨hzcl, hzV'⟩ => ⟨hzcl, hV' hzV'⟩, + fun ⟨hzcl, hzV⟩ => ⟨hzcl, hsub ⟨hzcl, hzV⟩⟩⟩ + exact ⟨⟨heG, hsub⟩, hxV', hyV', hcap⟩ + +theorem induceDrawing_toGraph_deleteVerts [T1Space S] (G : Drawing S) (X : Set S) : + (induceDrawing G (G.V \ X)).toGraph = G.toGraph.deleteVerts X := by + rw [induceDrawing_toGraph_eq_induce G sdiff_subset] + refine Graph.ext ?_ fun e x y => ?_ + · rw [vertexSet_deleteVerts] + rfl + · rw [induce_isLink, deleteVerts_isLink] + exact ⟨fun ⟨hl, hx, hy⟩ => ⟨hl, hx.2, hy.2⟩, + fun ⟨hl, hx, hy⟩ => ⟨hl, ⟨hl.left_mem, hx⟩, ⟨hl.right_mem, hy⟩⟩⟩ + +theorem induceDrawing_toGraph_of_component [T1Space S] (G : Drawing S) + {C : Graph S (Set S)} (hC : IsGraphComponent C G.toGraph) : + (induceDrawing G V(C)).toGraph = C := by + obtain ⟨x, hx⟩ := hC.2.1.1 + rw [induceDrawing_toGraph_eq_induce G hC.1.vertexSet_mono] + have heq := hC.eq_compOf_of_mem hx + rw [heq] + rfl + +theorem induceDrawing_E_of_component [T2Space S] (G : Drawing S) + {C : Graph S (Set S)} (hC : IsGraphComponent C G.toGraph) : + (induceDrawing G V(C)).E = E(C) := by + rw [induceDrawing_E] + ext e + simp only [mem_ofPred_eq] + constructor + · rintro ⟨heG, hsub⟩ + obtain ⟨γ, _, h0, _, _, _, _, hlink⟩ := exists_edge_param_isLink G heG + have h0_cl : γ 0 ∈ closure e ∩ G.V := by + rw [hlink.2.2.2]; exact mem_insert (γ 0) {γ 1} + exact ((hC.isLink_iff_of_mem (hsub h0_cl)).mpr hlink).edge_mem + · intro heC + obtain ⟨u, v, hlinkC⟩ := C.exists_isLink_of_mem_edgeSet heC + have hlinkG := hlinkC.mono hC.1 + refine ⟨hlinkG.1, ?_⟩ + rw [hlinkG.2.2.2] + rintro z (rfl | hzv) + · exact hlinkC.left_mem + · rw [mem_singleton_iff.mp hzv] + exact hlinkC.right_mem + +theorem induceDrawing_U_of_component [T2Space S] (G : Drawing S) + {C : Graph S (Set S)} (hC : IsGraphComponent C G.toGraph) : + (induceDrawing G V(C)).U = compPointSet C := by + rw [induceDrawing_U G hC.1.vertexSet_mono, induceDrawing_E_of_component G hC, compPointSet] + +/-! ## 2. Connectedness of `compPointSet` and Unions of Components -/ + +theorem isConnected_compPointSet [T2Space S] (G : Drawing S) + {C : Graph S (Set S)} (hC : IsGraphComponent C G.toGraph) : + IsConnected (compPointSet C) := by + obtain ⟨x₀, hx₀⟩ := hC.2.1.1 + have h_join : ∀ z ∈ compPointSet C, + ∃ K ⊆ compPointSet C, IsConnected K ∧ x₀ ∈ K ∧ z ∈ K := by + intro z hz + rcases hz with hzV | hzE + · obtain ⟨W⟩ := hC.2.1.2 x₀ hx₀ z hzV + obtain ⟨K, _, hK_conn, hx₀K, hzK, hK_sub, _, _⟩ := + exists_compact_connected_of_walk G hC.1 W + exact ⟨K, hK_sub, hK_conn, hx₀K, hzK⟩ + · simp only [mem_iUnion, exists_prop] at hzE + rcases hzE with ⟨e, heC, hze⟩ + obtain ⟨u, v, hlinkC⟩ := C.exists_isLink_of_mem_edgeSet heC + obtain ⟨W⟩ := hC.2.1.2 x₀ hx₀ u hlinkC.left_mem + obtain ⟨KW, _, hKW_conn, hx₀W, huW, hKW_sub, _, _⟩ := + exists_compact_connected_of_walk G hC.1 W + have hlinkG : G.toGraph.IsLink e u v := hlinkC.mono hC.1 + have hu_cl : u ∈ closure e := by + have : u ∈ closure e ∩ G.V := by rw [hlinkG.2.2.2]; exact mem_insert u {v} + exact this.1 + have hcl_sub : closure e ⊆ compPointSet C := by + rw [compPointSet_eq_closure_union G hC] + intro y hy + exact Or.inr (mem_iUnion₂.mpr ⟨e, heC, hy⟩) + refine ⟨KW ∪ closure e, union_subset hKW_sub hcl_sub, + hKW_conn.union ⟨u, huW, hu_cl⟩ (isConnected_closure_edge G hlinkG.1), + Or.inl hx₀W, Or.inr (subset_closure hze)⟩ + choose! K hK_sub hK_conn hx₀K hzK using h_join + have h_eq : compPointSet C = ⋃₀ (K '' compPointSet C) := by + ext z + simp only [mem_sUnion, mem_image, exists_exists_and_eq_and] + exact ⟨fun hz => ⟨z, hz, hzK z hz⟩, fun ⟨w, hw, hzw⟩ => hK_sub w hw hzw⟩ + refine ⟨⟨x₀, Or.inl hx₀⟩, ?_⟩ + rw [h_eq] + refine isPreconnected_sUnion x₀ (K '' compPointSet C) ?_ ?_ + · rintro _ ⟨z, hz, rfl⟩ + exact hx₀K z hz + · rintro _ ⟨z, hz, rfl⟩ + exact (hK_conn z hz).isPreconnected + +/-- If `S_comp ⊆ graphComponents G.toGraph` is a family of components of `G` and +`V' = ⋃ C ∈ S_comp, V(C)`, then `(induceDrawing G V').U = ⋃ C ∈ S_comp, compPointSet C` and +`G.U \ (induceDrawing G V').U = ⋃ C ∈ graphComponents G.toGraph \ S_comp, compPointSet C`. -/ +theorem induceDrawing_U_biUnion_components [T2Space S] (G : Drawing S) + {S_comp : Set (Graph S (Set S))} (hS_comp : S_comp ⊆ graphComponents G.toGraph) : + let V' := ⋃ C ∈ S_comp, V(C) + (induceDrawing G V').U = (⋃ C ∈ S_comp, compPointSet C) ∧ + G.U \ (induceDrawing G V').U = + (⋃ C ∈ graphComponents G.toGraph \ S_comp, compPointSet C) := by + intro V' + have hV' : V' ⊆ G.V := iUnion₂_subset fun C hC => (hS_comp hC).1.vertexSet_mono + have hE_iff : ∀ e, e ∈ (induceDrawing G V').E ↔ ∃ C ∈ S_comp, e ∈ E(C) := by + intro e + rw [induceDrawing_E] + constructor + · rintro ⟨heG, hsub⟩ + obtain ⟨γ, _, h0, _, _, _, _, hlink⟩ := exists_edge_param_isLink G heG + have h0_cl : γ 0 ∈ closure e ∩ G.V := by + rw [hlink.2.2.2]; exact mem_insert (γ 0) {γ 1} + have h0_V' : γ 0 ∈ V' := hsub h0_cl + obtain ⟨C, hC_S, h0_C⟩ := mem_iUnion₂.mp h0_V' + have hC := hS_comp hC_S + exact ⟨C, hC_S, ((hC.isLink_iff_of_mem h0_C).mpr hlink).edge_mem⟩ + · rintro ⟨C, hC_S, heC⟩ + have hC := hS_comp hC_S + obtain ⟨u, v, hlinkC⟩ := C.exists_isLink_of_mem_edgeSet heC + have hlinkG := hlinkC.mono hC.1 + refine ⟨hlinkG.1, ?_⟩ + rw [hlinkG.2.2.2] + rintro z (rfl | hzv) + · exact mem_iUnion₂.mpr ⟨C, hC_S, hlinkC.left_mem⟩ + · rw [mem_singleton_iff.mp hzv] + exact mem_iUnion₂.mpr ⟨C, hC_S, hlinkC.right_mem⟩ + have hU_eq : (induceDrawing G V').U = ⋃ C ∈ S_comp, compPointSet C := by + rw [induceDrawing_U G hV'] + ext x + simp only [V', compPointSet, mem_union, mem_iUnion, exists_prop, hE_iff] + constructor + · rintro (⟨C, hC_S, hxV⟩ | ⟨e, ⟨C, hC_S, heC⟩, hxe⟩) + · exact ⟨C, hC_S, Or.inl hxV⟩ + · exact ⟨C, hC_S, Or.inr ⟨e, heC, hxe⟩⟩ + · rintro ⟨C, hC_S, hxV | ⟨e, heC, hxe⟩⟩ + · exact Or.inl ⟨C, hC_S, hxV⟩ + · exact Or.inr ⟨e, ⟨C, hC_S, heC⟩, hxe⟩ + refine ⟨hU_eq, ?_⟩ + rw [hU_eq, ← biUnion_compPointSet_eq_U G] + ext x + simp only [mem_sdiff, mem_iUnion, exists_prop] + constructor + · rintro ⟨⟨C, hC, hxC⟩, hnot⟩ + refine ⟨C, ⟨hC, fun hC_S => hnot ⟨C, hC_S, hxC⟩⟩, hxC⟩ + · rintro ⟨C, ⟨hC, hnot_S⟩, hxC⟩ + refine ⟨⟨C, hC, hxC⟩, ?_⟩ + rintro ⟨C', hC'_S, hxC'⟩ + have hne : C ≠ C' := fun heq => hnot_S (heq ▸ hC'_S) + exact disjoint_left.mp (disjoint_compPointSet_of_ne G hC (hS_comp hC'_S) hne) hxC hxC' + +/-! ## 3. Master Region-Lifting and Chain-Lifting Lemmas -/ + +/-- Entry into a region `r'` of `G₁` from a point `a ∈ closure r' \ K₂` where `K₂ = G.U \ G₁.U` is +closed: there exists a region `r ∈ G.R` with `r ⊆ r'`, `a ∈ closure r`, `(a ∈ r' → a ∈ r)`, and +`∃ p ∈ r, p ∈ connectedComponentIn (univ \ K₂) a`. -/ +theorem exists_subregion_at_point (hS : IsClosedDiscSpace S) {G G₁ : Drawing S} + (hProper₁ : G₁.IsProper) (hSub : G₁.IsSubdrawing G) (hK₂_closed : IsClosed (G.U \ G₁.U)) + {r' : Set S} (hr' : r' ∈ G₁.R) {a : S} (ha_cl : a ∈ closure r') + (ha_not : a ∉ G.U \ G₁.U) : + ∃ r ∈ G.R, r ⊆ r' ∧ a ∈ closure r ∧ (a ∈ r' → a ∈ r) ∧ + ∃ p ∈ r, p ∈ connectedComponentIn (univ \ (G.U \ G₁.U)) a := by + let K₂ := G.U \ G₁.U + have h_r'_diff : r' \ K₂ ⊆ univ \ G.U := by + intro z hz + exact ⟨mem_univ z, fun hzU => hz.2 ⟨hzU, region_subset hr' hz.1⟩⟩ + by_cases ha_in : a ∈ r' + · have ha_not_G : a ∉ G.U := fun hzU => ha_not ⟨hzU, region_subset hr' ha_in⟩ + let r := connectedComponentIn (univ \ G.U) a + have hrG : r ∈ G.R := ⟨a, ⟨mem_univ a, ha_not_G⟩, rfl⟩ + have ha_r : a ∈ r := mem_connectedComponentIn ⟨mem_univ a, ha_not_G⟩ + have hr_sub : r ⊆ r' := by + rcases hr' with ⟨z₀, _, rfl⟩ + rw [connectedComponentIn_eq ha_in] + exact connectedComponentIn_mono a (sdiff_subset_sdiff_right hSub.U_subset) + exact ⟨r, hrG, hr_sub, subset_closure ha_r, fun _ => ha_r, + a, ha_r, mem_connectedComponentIn ⟨mem_univ a, ha_not⟩⟩ + · obtain ⟨γ, hγ0, hγ_pos⟩ := exists_region_entry_path G₁ hS hProper₁ r' hr' a ha_cl + have h0_open : (0 : unitInterval) ∈ γ ⁻¹' (univ \ K₂) := by + change γ 0 ∈ univ \ K₂ + rw [hγ0] + exact ⟨mem_univ a, ha_not⟩ + have h_open : IsOpen (γ ⁻¹' (univ \ K₂)) := + (isOpen_univ.sdiff hK₂_closed).preimage γ.continuous + obtain ⟨ε, hε_pos, hball⟩ := Metric.isOpen_iff.mp h_open 0 h0_open + let δ : ℝ := min (1 / 2) (ε / 2) + have hδ_pos : 0 < δ := lt_min (by norm_num) (half_pos hε_pos) + have hδ_le_one : δ ≤ 1 := (min_le_left _ _).trans (by norm_num) + let t₀ : unitInterval := ⟨δ, le_of_lt hδ_pos, hδ_le_one⟩ + have ht₀_pos : (0 : unitInterval) < t₀ := hδ_pos + have hIcc_sub : γ '' Icc 0 t₀ ⊆ univ \ K₂ := by + rintro _ ⟨t, ht, rfl⟩ + apply hball + rw [Metric.mem_ball, Subtype.dist_eq, Real.dist_eq] + change |t.1 - 0| < ε + rw [sub_zero, abs_of_nonneg t.2.1] + exact lt_of_le_of_lt ht.2 (lt_of_le_of_lt (min_le_right _ _) (half_lt_self hε_pos)) + have hIoc_sub : γ '' Ioc 0 t₀ ⊆ univ \ G.U := by + rintro _ ⟨t, ht, rfl⟩ + exact h_r'_diff ⟨hγ_pos t ht.1, (hIcc_sub ⟨t, ⟨le_of_lt ht.1, ht.2⟩, rfl⟩).2⟩ + let p := γ t₀ + have hp_not_G : p ∉ G.U := (hIoc_sub ⟨t₀, ⟨ht₀_pos, le_rfl⟩, rfl⟩).2 + let r := connectedComponentIn (univ \ G.U) p + have hrG : r ∈ G.R := ⟨p, ⟨mem_univ p, hp_not_G⟩, rfl⟩ + have hp_r : p ∈ r := mem_connectedComponentIn ⟨mem_univ p, hp_not_G⟩ + have hr_sub : r ⊆ r' := by + rcases hr' with ⟨z₀, _, rfl⟩ + rw [connectedComponentIn_eq (hγ_pos t₀ ht₀_pos)] + exact connectedComponentIn_mono p (sdiff_subset_sdiff_right hSub.U_subset) + have hIoc_conn : IsPreconnected (γ '' Ioc 0 t₀) := by + have h_real : IsPreconnected (Ioc (0 : ℝ) δ) := convex_Ioc 0 δ |>.isPreconnected + let emb : ℝ → unitInterval := fun x => projIcc 0 1 zero_le_one x + have hemb_eq : emb '' Ioc 0 δ = Ioc (0 : unitInterval) t₀ := by + ext t + constructor + · rintro ⟨x, hx, rfl⟩ + have hx_mem : x ∈ Icc (0 : ℝ) 1 := ⟨le_of_lt hx.1, hx.2.trans hδ_le_one⟩ + change projIcc 0 1 zero_le_one x ∈ Ioc (0 : unitInterval) t₀ + rw [projIcc_of_mem zero_le_one hx_mem] + exact hx + · intro ht + exact ⟨t.1, ht, projIcc_val zero_le_one t⟩ + rw [← hemb_eq, ← image_comp] + exact h_real.image _ (γ.continuous.comp continuous_projIcc).continuousOn + have hIoc_in_r : γ '' Ioc 0 t₀ ⊆ r := + hIoc_conn.subset_connectedComponentIn ⟨t₀, ⟨ht₀_pos, le_rfl⟩, rfl⟩ hIoc_sub + have ha_cl_r : a ∈ closure r := by + have h0_cl : (0 : unitInterval) ∈ closure (Ioc 0 t₀) := by + rw [Metric.mem_closure_iff] + intro η hη + let s : ℝ := min δ (η / 2) + have hs_pos : 0 < s := lt_min hδ_pos (half_pos hη) + have hs_le : s ≤ δ := min_le_left _ _ + have hs_mem : s ∈ unitInterval := ⟨le_of_lt hs_pos, hs_le.trans hδ_le_one⟩ + refine ⟨⟨s, hs_mem⟩, ⟨hs_pos, hs_le⟩, ?_⟩ + rw [dist_comm, Subtype.dist_eq, Real.dist_eq] + change |s - 0| < η + rw [sub_zero, abs_of_nonneg (le_of_lt hs_pos)] + exact lt_of_le_of_lt (min_le_right _ _) (half_lt_self hη) + have ha_img : a ∈ closure (γ '' Ioc 0 t₀) := by + rw [← hγ0] + exact image_closure_subset_closure_image γ.continuous ⟨0, h0_cl, rfl⟩ + exact closure_mono hIoc_in_r ha_img + have hIcc_conn : IsPreconnected (γ '' Icc 0 t₀) := by + have h_real : IsPreconnected (Icc (0 : ℝ) δ) := convex_Icc 0 δ |>.isPreconnected + let emb : ℝ → unitInterval := fun x => projIcc 0 1 zero_le_one x + have hemb_eq : emb '' Icc 0 δ = Icc (0 : unitInterval) t₀ := by + ext t + constructor + · rintro ⟨x, hx, rfl⟩ + have hx_mem : x ∈ Icc (0 : ℝ) 1 := ⟨hx.1, hx.2.trans hδ_le_one⟩ + change projIcc 0 1 zero_le_one x ∈ Icc (0 : unitInterval) t₀ + rw [projIcc_of_mem zero_le_one hx_mem] + exact hx + · intro ht + exact ⟨t.1, ht, projIcc_val zero_le_one t⟩ + rw [← hemb_eq, ← image_comp] + exact h_real.image _ (γ.continuous.comp continuous_projIcc).continuousOn + have hp_comp : p ∈ connectedComponentIn (univ \ K₂) a := by + refine hIcc_conn.subset_connectedComponentIn ?_ hIcc_sub ⟨t₀, ⟨t₀.2.1, le_rfl⟩, rfl⟩ + exact ⟨0, ⟨le_rfl, t₀.2.1⟩, hγ0⟩ + exact ⟨r, hrG, hr_sub, ha_cl_r, fun h => (ha_in h).elim, p, hp_r, hp_comp⟩ + +/-- **Master Region-Lifting Lemma**: if `G₁` is a subdrawing of `G` such that `K₂ := G.U \ G₁.U` +is closed, `r' ∈ G₁.R`, and `a, b ∈ closure r' \ K₂` lie in the same connected component of +`univ \ K₂`, then there exists a single region `r ∈ G.R` with `r ⊆ r'`, `a ∈ closure r`, +`b ∈ closure r`, `(a ∈ r' → a ∈ r)`, and `(b ∈ r' → b ∈ r)`. -/ +theorem exists_region_of_same_component_compl (hS : IsClosedDiscSpace S) {G G₁ : Drawing S} + (hProper₁ : G₁.IsProper) (hSub : G₁.IsSubdrawing G) (hK₂_closed : IsClosed (G.U \ G₁.U)) + {r' : Set S} (hr' : r' ∈ G₁.R) {a b : S} + (ha_cl : a ∈ closure r') (hb_cl : b ∈ closure r') + (ha_not : a ∉ G.U \ G₁.U) (hb_not : b ∉ G.U \ G₁.U) + (h_same : b ∈ connectedComponentIn (univ \ (G.U \ G₁.U)) a) : + ∃ r ∈ G.R, r ⊆ r' ∧ a ∈ closure r ∧ b ∈ closure r ∧ + (a ∈ r' → a ∈ r) ∧ (b ∈ r' → b ∈ r) := by + let K₁ := G₁.U + let K₂ := G.U \ G₁.U + obtain ⟨r_a, hr_a, hr_a_sub, ha_cl_r, ha_in_r, p_a, hp_a_r, hp_a_comp⟩ := + exists_subregion_at_point hS hProper₁ hSub hK₂_closed hr' ha_cl ha_not + obtain ⟨r_b, hr_b, hr_b_sub, hb_cl_r, hb_in_r, p_b, hp_b_r, hp_b_comp⟩ := + exists_subregion_at_point hS hProper₁ hSub hK₂_closed hr' hb_cl hb_not + have hK_union : K₁ ∪ K₂ = G.U := union_sdiff_cancel hSub.U_subset + have hK_disj : Disjoint K₁ K₂ := disjoint_sdiff_self_right + have hp_a_not : p_a ∉ K₁ ∪ K₂ := by + rw [hK_union] + exact region_subset hr_a hp_a_r + have hp_b_not : p_b ∉ K₁ ∪ K₂ := by + rw [hK_union] + exact region_subset hr_b hp_b_r + have hp_ab₁ : p_b ∈ connectedComponentIn (univ \ K₁) p_a := by + have hp_a_r' : p_a ∈ r' := hr_a_sub hp_a_r + have hp_b_r' : p_b ∈ r' := hr_b_sub hp_b_r + rcases hr' with ⟨z₀, _, h_r'_eq⟩ + have hp_a_c : p_a ∈ connectedComponentIn (univ \ G₁.U) z₀ := h_r'_eq ▸ hp_a_r' + have hp_b_c : p_b ∈ connectedComponentIn (univ \ G₁.U) z₀ := h_r'_eq ▸ hp_b_r' + change p_b ∈ connectedComponentIn (univ \ G₁.U) p_a + rw [← connectedComponentIn_eq hp_a_c] + exact hp_b_c + have hp_ab₂ : p_b ∈ connectedComponentIn (univ \ K₂) p_a := by + rw [← connectedComponentIn_eq hp_a_comp, connectedComponentIn_eq h_same] + exact hp_b_comp + have hp_ab := disc_janiszewski_disjoint hS G₁.isClosed_U hK₂_closed hK_disj + hp_a_not hp_b_not hp_ab₁ hp_ab₂ + rw [hK_union] at hp_ab + have hr_eq : r_a = r_b := by + have h1 : r_a = connectedComponentIn (univ \ G.U) p_a := by + rcases hr_a with ⟨z₀, _, rfl⟩ + exact connectedComponentIn_eq hp_a_r + have h2 : r_b = connectedComponentIn (univ \ G.U) p_b := by + rcases hr_b with ⟨z₀, _, rfl⟩ + exact connectedComponentIn_eq hp_b_r + rw [h1, h2, connectedComponentIn_eq hp_ab] + rw [← hr_eq] at hb_cl_r hb_in_r + exact ⟨r_a, hr_a, hr_a_sub, ha_cl_r, hb_cl_r, ha_in_r, hb_in_r⟩ + +/-- A region `r ∈ Γ.R` of a proper drawing `Γ` on a closed disc space `S` with +`(Γ.V ∩ bd S).Nonempty` is peripheral if and only if `(r ∩ bd S).Nonempty`. -/ +theorem isPeripheral_inr_iff_inter_bd_nonempty (hS : IsClosedDiscSpace S) {Γ : Drawing S} + (hProper : Γ.IsProper) (hV_ne : (Γ.V ∩ bd S).Nonempty) {r : Set S} (hr : r ∈ Γ.R) : + ChainTerm.IsPeripheral Γ (.inr r) ↔ (r ∩ bd S).Nonempty := by + simp only [ChainTerm.IsPeripheral] + constructor + · rintro ⟨_, seg, ⟨⟨z, hz, rfl⟩, _⟩, hseg_sub⟩ + exact ⟨z, hseg_sub (mem_connectedComponentIn hz), hz.1⟩ + · rintro ⟨z, hzr, hzbd⟩ + refine ⟨hr, ?_⟩ + have hz_not_U : z ∉ Γ.U := region_subset hr hzr + have hz_diff : z ∈ bd S \ (Γ.V ∩ bd S) := + ⟨hzbd, fun h => hz_not_U (Γ.V_subset_U h.1)⟩ + have hseg : connectedComponentIn (bd S \ (Γ.V ∩ bd S)) z ∈ segmentsOf (bd S) (Γ.V ∩ bd S) := + connectedComponentIn_mem_segmentsOf hS.isOArc_bd + (Γ.finite_V.subset inter_subset_left) inter_subset_right hV_ne hz_diff + refine ⟨connectedComponentIn (bd S \ (Γ.V ∩ bd S)) z, hseg, ?_⟩ + have h_diff_sub : bd S \ (Γ.V ∩ bd S) ⊆ univ \ Γ.U := by + rintro w ⟨hw_bd, hw_not⟩ + exact ⟨mem_univ w, fun hwU => hw_not ⟨hProper ⟨hw_bd, hwU⟩, hw_bd⟩⟩ + rcases hr with ⟨z₀, _, rfl⟩ + rw [connectedComponentIn_eq hzr] + exact isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn hz_diff) + ((connectedComponentIn_subset _ _).trans h_diff_sub) + +/-- Monotonicity of `divisionCount` with respect to subset inclusion `Δ' ⊆ Δ`. -/ +theorem divisionCount_le_of_subset {C : Set S} {Δ' Δ : Set (Set S)} + (hΔ : IsDivision Δ) (hsub : Δ' ⊆ Δ) (x y : S) : + divisionCount C Δ' x y ≤ divisionCount C Δ x y := by + unfold divisionCount + refine ncard_le_ncard (fun δ hδ => ⟨hsub hδ.1, hδ.2⟩) ?_ + exact hΔ.1.subset fun _ h => h.1 + +omit [TopologicalSpace S] in +private theorem decide_isVertex_match (t : ChainTerm S) (f : Set S → Set S) : + decide (match t with | .inl v => .inl v | .inr r' => .inr (f r') : ChainTerm S).IsVertex = + decide t.IsVertex := by + cases t <;> rfl + +private theorem chain_endpoints_in_region_closure + {G₁ : Drawing S} {U₁ : Set S} {x y : S} {A : List (ChainTerm S)} + (hChain : IsXYChain G₁ x y A) (hx_mem : x ∈ G₁.U ∪ U₁) (hy_mem : y ∈ G₁.U ∪ U₁) : + let leftPt := ChainTerm.leftEndpoint A x + let rightPt := ChainTerm.rightEndpoint A y + (∀ (i : Fin A.length) (r' : Set S), + A[i.1]'i.2 = .inr r' → leftPt i ∈ closure r' ∧ leftPt i ∈ G₁.U ∪ U₁) ∧ + (∀ (i : Fin A.length) (r' : Set S), + A[i.1]'i.2 = .inr r' → rightPt i ∈ closure r' ∧ rightPt i ∈ G₁.U ∪ U₁) := by + intro leftPt rightPt + have h_chain_rel : ∀ (j : ℕ) (hj : j + 1 < A.length), + ChainTerm.AreIncident G₁ A[j] A[j + 1] := + fun j hj => List.isChain_iff_getElem.mp hChain.isChain j hj + have h_left_props : ∀ (i : Fin A.length) (r' : Set S), + A[i.1]'i.2 = .inr r' → leftPt i ∈ closure r' ∧ leftPt i ∈ G₁.U ∪ U₁ := by + intro i r' hir + by_cases hi0 : i.1 = 0 + · have hhead : A.head hChain.ne_nil = A[i.1]'i.2 := by + rw [List.head_eq_getElem_zero]; congr 1; omega + have hmatch := hChain.head_matches + rw [hhead, hir] at hmatch + have hleft : leftPt i = x := by + dsimp only [leftPt, ChainTerm.leftEndpoint]; rw [hir]; simp only [hi0, ite_true] + rw [hleft] + exact ⟨subset_closure hmatch, hx_mem⟩ + · have hprev_lt : i.1 - 1 < A.length := Nat.lt_of_le_of_lt (Nat.sub_le _ _) i.2 + have hstep : (i.1 - 1) + 1 < A.length := by omega + have hinc := h_chain_rel (i.1 - 1) hstep + have h_idx_eq : A[(i.1 - 1) + 1]'hstep = A[i.1]'i.2 := by congr 1; omega + rw [h_idx_eq, hir] at hinc + rcases h_prev : A[i.1 - 1]'hprev_lt with v | r'' + · rw [h_prev] at hinc + have hleft : leftPt i = v := by + dsimp only [leftPt, ChainTerm.leftEndpoint]; rw [hir]; simp only [hi0, ↓reduceIte, h_prev] + rw [hleft] + exact ⟨hinc.2.2, Or.inl (G₁.V_subset_U hinc.1)⟩ + · rw [h_prev] at hinc; exact False.elim hinc + have h_right_props : ∀ (i : Fin A.length) (r' : Set S), + A[i.1]'i.2 = .inr r' → rightPt i ∈ closure r' ∧ rightPt i ∈ G₁.U ∪ U₁ := by + intro i r' hir + by_cases hi1 : i.1 + 1 = A.length + · have hlast : A.getLast hChain.ne_nil = A[i.1]'i.2 := by + rw [List.getLast_eq_getElem]; congr 1; omega + have hmatch := hChain.last_matches + rw [hlast, hir] at hmatch + have hright : rightPt i = y := by + dsimp only [rightPt, ChainTerm.rightEndpoint]; rw [hir]; simp only [hi1, ↓reduceDIte] + rw [hright] + exact ⟨subset_closure hmatch, hy_mem⟩ + · have hnext_lt : i.1 + 1 < A.length := Nat.lt_of_le_of_ne (Nat.succ_le_of_lt i.2) hi1 + have hinc := h_chain_rel i.1 hnext_lt + rw [hir] at hinc + rcases h_next : A[i.1 + 1]'hnext_lt with v | r'' + · rw [h_next] at hinc + have hright : rightPt i = v := by + dsimp only [rightPt, ChainTerm.rightEndpoint] + rw [hir] + simp only [hi1, ↓reduceDIte, h_next] + rw [hright] + exact ⟨hinc.2.2, Or.inl (G₁.V_subset_U hinc.1)⟩ + · rw [h_next] at hinc; exact False.elim hinc + exact ⟨h_left_props, h_right_props⟩ + +omit [TopologicalSpace S] in +private theorem chainLength_eq_of_vertex_indicators {A B : List (ChainTerm S)} + (hmap : A.map (fun t => decide t.IsVertex) = B.map (fun t => decide t.IsVertex)) : + chainLength A = chainLength B := by + unfold chainLength + have h_count : ∀ L : List (ChainTerm S), + (L.filter (fun t => decide t.IsVertex)).length = + (L.map (fun t => decide t.IsVertex)).count true := by + intro L + induction L with + | nil => rfl + | cons hd tl ih => + by_cases h : decide hd.IsVertex + · simp [List.filter, h, ih] + · simp [List.filter, h, ih] + rw [h_count, h_count, hmap] + +private theorem chainEndpoint_mem_boundary {G G₁ : Drawing S} {U₁ : Set S} + (hU₁ : U₁ ⊆ bd S \ G.U) {z : S} (hz : z ∈ U₁ ∪ (G₁.V ∩ bd S)) : z ∈ bd S := + hz.elim (fun hz' => (hU₁ hz').1) And.right + +/-- **Master Chain-Lifting Theorem**: if `G₁` is a proper subdrawing of a proper drawing `G` on a +closed disc space `S` such that `K₂ := G.U \ G₁.U` is closed, `(G₁.V ∩ bd S).Nonempty`, +`U₁ ⊆ bd S \ G.U`, and `G₁.U ∪ U₁` lies in a single connected component of `univ \ K₂`, then every +`(x, y)`-chain `A` of `G₁` (for `x, y ∈ U₁ ∪ (G₁.V ∩ bd S)`) lifts to an `(x, y)`-chain `A_G` of +`G` with `chainLength A_G = chainLength A`. -/ +theorem liftChain_of_subdrawing (hS : IsClosedDiscSpace S) {G G₁ : Drawing S} + (hProper : G.IsProper) (hProper₁ : G₁.IsProper) + (hSub : G₁.IsSubdrawing G) (hK₂_closed : IsClosed (G.U \ G₁.U)) + (hV₁_ne : (G₁.V ∩ bd S).Nonempty) {U₁ : Set S} (hU₁ : U₁ ⊆ bd S \ G.U) + (h_same_comp : ∀ a ∈ G₁.U ∪ U₁, ∀ b ∈ G₁.U ∪ U₁, + b ∈ connectedComponentIn (univ \ (G.U \ G₁.U)) a) + {x y : S} (hx : x ∈ U₁ ∪ (G₁.V ∩ bd S)) (hy : y ∈ U₁ ∪ (G₁.V ∩ bd S)) + {A : List (ChainTerm S)} (hChain : IsXYChain G₁ x y A) : + ∃ A_G : List (ChainTerm S), IsXYChain G x y A_G ∧ chainLength A_G = chainLength A := by + have hm : 0 < A.length := List.length_pos_of_ne_nil hChain.ne_nil + have hVG_ne : (G.V ∩ bd S).Nonempty := + hV₁_ne.mono (inter_subset_inter_left _ hSub.1) + have hmem {z : S} (hz : z ∈ U₁ ∪ (G₁.V ∩ bd S)) : z ∈ G₁.U ∪ U₁ := + hz.elim Or.inr (fun h => Or.inl (G₁.V_subset_U h.1)) + have h_not_K₂ : ∀ z ∈ G₁.U ∪ U₁, z ∉ G.U \ G₁.U := by + rintro z (hzG₁ | hzU₁) hzK₂ + · exact hzK₂.2 hzG₁ + · exact (hU₁ hzU₁).2 hzK₂.1 + let leftPt := ChainTerm.leftEndpoint A x + let rightPt := ChainTerm.rightEndpoint A y + have h_chain_rel : ∀ (j : ℕ) (hj : j + 1 < A.length), + ChainTerm.AreIncident G₁ A[j] A[j + 1] := + fun j hj => List.isChain_iff_getElem.mp hChain.isChain j hj + obtain ⟨h_left_props, h_right_props⟩ := chain_endpoints_in_region_closure hChain (hmem hx) + (hmem hy) + have h_lift_reg : ∀ (i : Fin A.length) (r' : Set S), A[i.1]'i.2 = .inr r' → + ∃ r ∈ G.R, r ⊆ r' ∧ leftPt i ∈ closure r ∧ rightPt i ∈ closure r ∧ + (leftPt i ∈ r' → leftPt i ∈ r) ∧ (rightPt i ∈ r' → rightPt i ∈ r) := by + intro i r' hir + have hr' : r' ∈ G₁.R := by + have hv := hChain.valid (A[i.1]'i.2) (List.getElem_mem i.2) + simpa [hir, ChainTerm.IsValid] using hv + obtain ⟨hl_cl, hl_mem⟩ := h_left_props i r' hir + obtain ⟨hr_cl, hr_mem⟩ := h_right_props i r' hir + exact exists_region_of_same_component_compl hS hProper₁ hSub hK₂_closed hr' + hl_cl hr_cl (h_not_K₂ _ hl_mem) (h_not_K₂ _ hr_mem) + (h_same_comp _ hl_mem _ hr_mem) + choose! r_lift hr_lift_R hr_lift_sub hr_lift_left_cl hr_lift_right_cl + hr_lift_left_in hr_lift_right_in using h_lift_reg + let termG : Fin A.length → ChainTerm S := fun i => + match A[i.1]'i.2 with + | .inl v => .inl v + | .inr r' => .inr (r_lift i r') + let A_G : List (ChainTerm S) := List.ofFn termG + have hlen_eq : A_G.length = A.length := List.length_ofFn + have hne_nil : A_G ≠ [] := List.ne_nil_of_length_pos (hlen_eq.symm ▸ hm) + have hget : ∀ (j : ℕ) (hj : j < A_G.length), + A_G[j]'hj = termG ⟨j, hlen_eq ▸ hj⟩ := fun j hj => by simp [A_G] + refine ⟨A_G, ⟨hne_nil, ?_, ?_, ?_, ?_, ?_⟩, ?_⟩ + · intro t ht + obtain ⟨j, hj, rfl⟩ := List.getElem_of_mem ht + rw [hget j hj] + have hv := hChain.valid (A[j]'(hlen_eq ▸ hj)) (List.getElem_mem _) + change (termG ⟨j, hlen_eq ▸ hj⟩).IsValid G + dsimp only [termG] + split + · rename_i v hv_eq + rw [hv_eq] at hv + exact hSub.1 hv + · rename_i r hr_eq + exact hr_lift_R _ r hr_eq + · rw [List.isChain_iff_getElem] + intro j hj + have hj_lt : j < A_G.length := Nat.lt_of_succ_lt hj + rw [hget j hj_lt, hget (j + 1) hj] + have hjA : j + 1 < A.length := hlen_eq ▸ hj + let i : Fin A.length := ⟨j, Nat.lt_of_succ_lt hjA⟩ + let i1 : Fin A.length := ⟨j + 1, hjA⟩ + have hinc := h_chain_rel j hjA + change ChainTerm.AreIncident G (termG i) (termG i1) + dsimp only [termG] + rcases hir : A[i.1]'i.2 with v | r' + · rw [hir] at hinc + rcases hir1 : A[i1.1]'i1.2 with v' | r'' + · rw [hir1] at hinc; exact False.elim hinc + · rw [hir1] at hinc + have hleft : leftPt i1 = v := by + dsimp only [leftPt, ChainTerm.leftEndpoint, i1] + rw [hir1] + simp only [Nat.succ_ne_zero, ↓reduceIte] + have h_idx : A[(j + 1) - 1]'(Nat.lt_of_le_of_lt (Nat.sub_le _ _) hjA) = A[i.1]'i.2 := rfl + rw [h_idx, hir] + refine ⟨hSub.1 hinc.1, hr_lift_R i1 r'' hir1, ?_⟩ + rw [← hleft] + exact hr_lift_left_cl i1 r'' hir1 + · rw [hir] at hinc + rcases hir1 : A[i1.1]'i1.2 with v' | r'' + · rw [hir1] at hinc + have hne_last : i.1 + 1 ≠ A.length := ne_of_lt hjA + have hright : rightPt i = v' := by + dsimp only [rightPt, ChainTerm.rightEndpoint]; rw [hir]; simp only [hne_last, ↓reduceDIte] + have h_idx : A[i.1 + 1]'hjA = A[i1.1]'i1.2 := rfl + rw [h_idx, hir1] + refine ⟨hSub.1 hinc.1, hr_lift_R i r' hir, ?_⟩ + rw [← hright] + exact hr_lift_right_cl i r' hir + · rw [hir1] at hinc; exact False.elim hinc + · have hhead_G : A_G.head hne_nil = termG ⟨0, hm⟩ := by + rw [List.head_eq_getElem_zero, hget] + have hhead_A : A.head hChain.ne_nil = A[0]'hm := List.head_eq_getElem_zero _ + have hmatch := hChain.head_matches + rw [hhead_A] at hmatch + rw [hhead_G] + dsimp only [termG] + rcases hir0 : A[0]'hm with v | r' + · rw [hir0] at hmatch; exact hmatch + · rw [hir0] at hmatch + change x ∈ r_lift ⟨0, hm⟩ r' + have hleft : leftPt ⟨0, hm⟩ = x := by + dsimp only [leftPt, ChainTerm.leftEndpoint]; rw [hir0]; simp only [ite_true] + rw [← hleft] + exact hr_lift_left_in ⟨0, hm⟩ r' hir0 (hleft.symm ▸ hmatch) + · let i_last : Fin A.length := ⟨A.length - 1, Nat.sub_lt hm zero_lt_one⟩ + have hlast_G : A_G.getLast hne_nil = termG i_last := by + rw [List.getLast_eq_getElem, hget] + congr 1; ext; dsimp [i_last]; omega + have hlast_A : A.getLast hChain.ne_nil = A[i_last.1]'i_last.2 := + List.getLast_eq_getElem _ + have hmatch := hChain.last_matches + rw [hlast_A] at hmatch + rw [hlast_G] + dsimp only [termG] + rcases hir_last : A[i_last.1]'i_last.2 with v | r' + · rw [hir_last] at hmatch; exact hmatch + · rw [hir_last] at hmatch + change y ∈ r_lift i_last r' + have hi1 : i_last.1 + 1 = A.length := by dsimp [i_last]; omega + have hright : rightPt i_last = y := by + dsimp only [rightPt, ChainTerm.rightEndpoint]; rw [hir_last]; simp only [hi1, ↓reduceDIte] + rw [← hright] + exact hr_lift_right_in i_last r' hir_last (hright.symm ▸ hmatch) + · intro iG + let i : Fin A.length := ⟨iG.1, hlen_eq ▸ iG.2⟩ + have hper_A := hChain.peripheral_iff i + change (A_G[iG.1]'iG.2).IsPeripheral G ↔ (iG.1 = 0 ∨ iG.1 + 1 = A_G.length) + rw [hget iG.1 iG.2] + change (termG i).IsPeripheral G ↔ (i.1 = 0 ∨ i.1 + 1 = A_G.length) + rw [hlen_eq] + suffices h_iff : (termG i).IsPeripheral G ↔ (A[i.1]'i.2).IsPeripheral G₁ by + exact h_iff.trans hper_A + dsimp only [termG] + rcases hir : A[i.1]'i.2 with v | r' + · have hv : v ∈ G₁.V := by + have hval := hChain.valid (A[i.1]'i.2) (List.getElem_mem i.2) + simpa [hir, ChainTerm.IsValid] using hval + simp only [ChainTerm.IsPeripheral] + exact ⟨fun h => ⟨hv, h.2⟩, fun h => ⟨hSub.1 hv, h.2⟩⟩ + · have hr' : r' ∈ G₁.R := by + have hval := hChain.valid (A[i.1]'i.2) (List.getElem_mem i.2) + simpa [hir, ChainTerm.IsValid] using hval + have hr : r_lift i r' ∈ G.R := hr_lift_R i r' hir + have hr_sub : r_lift i r' ⊆ r' := hr_lift_sub i r' hir + rw [isPeripheral_inr_iff_inter_bd_nonempty hS hProper hVG_ne hr, + isPeripheral_inr_iff_inter_bd_nonempty hS hProper₁ hV₁_ne hr'] + constructor + · exact fun h => h.mono (inter_subset_inter_left _ hr_sub) + · intro h_non + have h_ends : i.1 = 0 ∨ i.1 + 1 = A.length := by + rw [← hper_A] + change (A[i.1]'i.2).IsPeripheral G₁ + rw [hir, isPeripheral_inr_iff_inter_bd_nonempty hS hProper₁ hV₁_ne hr'] + exact h_non + rcases h_ends with hi0 | hi1 + · have hhead_A : A.head hChain.ne_nil = A[i.1]'i.2 := by + rw [List.head_eq_getElem_zero]; congr 1; omega + have hmatch := hChain.head_matches + rw [hhead_A, hir] at hmatch + change x ∈ r' at hmatch + have hleft : leftPt i = x := by + dsimp only [leftPt, ChainTerm.leftEndpoint]; rw [hir]; simp only [hi0, ite_true] + have hx_r : x ∈ r_lift i r' := by + rw [← hleft] + exact hr_lift_left_in i r' hir (hleft.symm ▸ hmatch) + exact ⟨x, hx_r, chainEndpoint_mem_boundary hU₁ hx⟩ + · have hlast_A : A.getLast hChain.ne_nil = A[i.1]'i.2 := by + rw [List.getLast_eq_getElem]; congr 1; omega + have hmatch := hChain.last_matches + rw [hlast_A, hir] at hmatch + change y ∈ r' at hmatch + have hright : rightPt i = y := by + dsimp only [rightPt, ChainTerm.rightEndpoint]; rw [hir]; simp only [hi1, ↓reduceDIte] + have hy_r : y ∈ r_lift i r' := by + rw [← hright] + exact hr_lift_right_in i r' hir (hright.symm ▸ hmatch) + exact ⟨y, hy_r, chainEndpoint_mem_boundary hU₁ hy⟩ + · have h_map : A_G.map (fun t => decide t.IsVertex) = A.map (fun t => decide t.IsVertex) := by + refine List.ext_getElem (by simp [hlen_eq]) fun j hj₁ hj₂ => ?_ + simp only [List.getElem_map] + have hjG : j < A_G.length := by simpa using hj₁ + rw [hget j hjG] + let i : Fin A.length := ⟨j, hlen_eq ▸ hjG⟩ + exact decide_isVertex_match (A[i.1]'i.2) (r_lift i) + exact chainLength_eq_of_vertex_indicators h_map + +/-! ## 4. Restricting a Dual Point Set to a Subset `V' ⊆ V` -/ + +omit [TopologicalSpace S] in +theorem nextSegment_subset_of_subset {V' V : Set Circle} (hsub : V' ⊆ V) (v : Circle) : + nextSegment V v ⊆ nextSegment V' v := + fun _ hz => ⟨hz.1, fun w hw => hz.2 w ⟨hsub hw.1, hw.2⟩⟩ + +omit [TopologicalSpace S] in +theorem range_circlePath_subset_insert_nextSegment {V : Set Circle} {v u : Circle} + (hu : u ∈ nextSegment V v) : + range (Circle.path v u) ⊆ insert v (nextSegment V v) := by + have hvu : v ≠ u := hu.1.symm + intro z hz + rcases eq_or_ne z v with rfl | hzv + · exact mem_insert z _ + · right + rcases eq_or_ne z u with rfl | hzu + · exact hu + · have hz_compl : z ∈ ({v, u} : Set Circle)ᶜ := by simp [hzv, hzu] + rw [compl_pair_eq_union_circleOpenArc hvu] at hz_compl + have hz_not_uv : z ∉ circleOpenArc u v := by + rw [← compl_range_circlePath hvu, mem_compl_iff, not_not] + exact hz + have hz_arc : z ∈ circleOpenArc v u := hz_compl.resolve_right hz_not_uv + rw [mem_circleOpenArc_iff_angleDiff hvu] at hz_arc + exact ⟨hzv, fun w hw => lt_trans hz_arc.2 (hu.2 w hw)⟩ + +omit [TopologicalSpace S] in +theorem exists_dualPointSet_subset_of_subset_univ {V V' U : Set Circle} + (hV_fin : V.Finite) (hU : IsDualPointSet (univ : Set Circle) V U) (hV' : V' ⊆ V) : + ∃ U' ⊆ U, IsDualPointSet (univ : Set Circle) V' U' ∧ + ∀ u' ∈ U', ∃ v' ∈ V', u' ∈ nextSegment V v' ∧ + ∃ K ⊆ insert v' (nextSegment V v'), IsConnected K ∧ v' ∈ K ∧ u' ∈ K := by + let U' : Set Circle := ⋃ v' ∈ V', (U ∩ nextSegment V v') + have hU'_sub : U' ⊆ U := iUnion₂_subset fun _ _ => inter_subset_left + refine ⟨U', hU'_sub, ?_, ?_⟩ + · refine ⟨?_, ?_⟩ + · intro hV'_emp + simp [U', hV'_emp] + · intro hV'_ne + have hV_ne : V.Nonempty := hV'_ne.mono hV' + have hU_compl : U ⊆ (univ : Set Circle) \ V := (hU.2 hV_ne).1 + have hU'_compl : U' ⊆ (univ : Set Circle) \ V' := + hU'_sub.trans (hU_compl.trans (sdiff_subset_sdiff subset_rfl hV')) + refine ⟨hU'_compl, fun seg hseg => ?_⟩ + have hV'_fin : V'.Finite := hV_fin.subset hV' + rw [mem_segmentsOf_univ_iff hV'_fin hV'_ne] at hseg + obtain ⟨v', hv', rfl⟩ := hseg + obtain ⟨u', hu'_eq⟩ := exists_unique_mem_nextSegment_of_isDualPointSet hV_fin hU (hV' hv') + have hu'_mem : u' ∈ U ∩ nextSegment V v' := by + rw [hu'_eq]; exact mem_singleton u' + have h_inter_eq : U' ∩ nextSegment V' v' = {u'} := by + apply Subset.antisymm + · rintro z ⟨hzU', hz_seg'⟩ + obtain ⟨v'', hv'', hzU, hz_seg⟩ := mem_iUnion₂.mp hzU' + have hz_seg'' : z ∈ nextSegment V' v'' := + nextSegment_subset_of_subset hV' v'' hz_seg + have hz_compl : z ∈ V'ᶜ := nextSegment_subset_compl hz_seg' + have h_uniq := + (exists_unique_nextSegment_of_mem_compl hV'_fin hV'_ne hz_compl).unique + ⟨hv'', hz_seg''⟩ ⟨hv', hz_seg'⟩ + subst h_uniq + have hz_in : z ∈ U ∩ nextSegment V v'' := ⟨hzU, hz_seg⟩ + rwa [hu'_eq] at hz_in + · rw [singleton_subset_iff] + exact ⟨mem_biUnion hv' hu'_mem, nextSegment_subset_of_subset hV' v' hu'_mem.2⟩ + rw [h_inter_eq, ncard_singleton] + · intro u' hu' + obtain ⟨v', hv', _, hu'_seg⟩ := mem_iUnion₂.mp hu' + refine ⟨v', hv', hu'_seg, range (Circle.path v' u'), + range_circlePath_subset_insert_nextSegment hu'_seg, + isConnected_range (Circle.path v' u').continuous, + ⟨0, (Circle.path v' u').source⟩, ⟨1, (Circle.path v' u').target⟩⟩ + +/-- For any finite subset `V ⊆ C` of an $O$-arc `C`, any dual point set `U` for `(C, V)`, and any +subset `V' ⊆ V`, there exists a subset `U' ⊆ U` that is a dual point set for `(C, V')` such that +each `u' ∈ U'` is joined to some `v' ∈ V'` inside `{v'} ∪ seg₀` for some segment +`seg₀ ∈ segmentsOf C V`. -/ +theorem exists_dualPointSet_subset_of_subset {C V V' U : Set S} + (hC : IsOArc C) (hV_sub : V ⊆ C) (hV_fin : V.Finite) + (hU : IsDualPointSet C V U) (hV' : V' ⊆ V) : + ∃ U' ⊆ U, IsDualPointSet C V' U' ∧ + ∀ u' ∈ U', ∃ v' ∈ V', ∃ seg₀ ∈ segmentsOf C V, + u' ∈ seg₀ ∧ ∃ K ⊆ insert v' seg₀, IsConnected K ∧ v' ∈ K ∧ u' ∈ K := by + obtain ⟨φ⟩ := hC + have hinj := injective_oArcMap φ + have hrange := range_oArcMap φ + let V_c : Set Circle := oArcMap φ ⁻¹' V + let V'_c : Set Circle := oArcMap φ ⁻¹' V' + let U_c : Set Circle := oArcMap φ ⁻¹' U + have hV_eq : oArcMap φ '' V_c = V := + image_preimage_eq_of_subset (hV_sub.trans hrange.symm.subset) + have hV'_eq : oArcMap φ '' V'_c = V' := + image_preimage_eq_of_subset ((hV'.trans hV_sub).trans hrange.symm.subset) + have hU_sub_C : U ⊆ C := (isDualPointSet_subset_diff hU).trans sdiff_subset + have hU_eq : oArcMap φ '' U_c = U := + image_preimage_eq_of_subset (hU_sub_C.trans hrange.symm.subset) + have hVc_fin : V_c.Finite := by + refine Finite.of_finite_image ?_ hinj.injOn + rwa [hV_eq] + have hUc : IsDualPointSet (univ : Set Circle) V_c U_c := by + rwa [← isDualPointSet_oArcMap_iff φ, hV_eq, hU_eq] + have hV'c : V'_c ⊆ V_c := preimage_mono hV' + obtain ⟨U'_c, hU'c_sub, hU'c_dual, hU'c_conn⟩ := + exists_dualPointSet_subset_of_subset_univ hVc_fin hUc hV'c + refine ⟨oArcMap φ '' U'_c, ?_, ?_, ?_⟩ + · rw [← hU_eq] + exact image_mono hU'c_sub + · rw [← hV'_eq, isDualPointSet_oArcMap_iff φ] + exact hU'c_dual + · rintro _ ⟨u'_c, hu'_c, rfl⟩ + obtain ⟨v'_c, hv'_c, hu'_seg, K_c, hKc_sub, hKc_conn, hv'_Kc, hu'_Kc⟩ := + hU'c_conn u'_c hu'_c + have hv'_V' : oArcMap φ v'_c ∈ V' := by + rw [← hV'_eq]; exact mem_image_of_mem _ hv'_c + have hseg_mem : oArcMap φ '' nextSegment V_c v'_c ∈ segmentsOf C V := by + rw [← hV_eq, segmentsOf_oArcMap φ] + exact mem_image_of_mem _ (nextSegment_mem_segmentsOf_univ hVc_fin (hV'c hv'_c)) + refine ⟨oArcMap φ v'_c, hv'_V', oArcMap φ '' nextSegment V_c v'_c, hseg_mem, + mem_image_of_mem _ hu'_seg, oArcMap φ '' K_c, ?_, + hKc_conn.image _ (isEmbedding_oArcMap φ).continuous.continuousOn, + mem_image_of_mem _ hv'_Kc, mem_image_of_mem _ hu'_Kc⟩ + rw [← image_insert_eq] + exact image_mono hKc_sub + +/-! ## 5. Reductions for `(3.3)(ii)`, `(3.3)(iii)`, and `(3.3)(iv)` -/ + +theorem isConnected_of_isOArc {C : Set S} (hC : IsOArc C) : IsConnected C := by + obtain ⟨φ⟩ := hC + rw [← range_oArcMap φ] + exact isConnected_range (isEmbedding_oArcMap φ).continuous + +theorem isCompact_compPointSet [T2Space S] (G : Drawing S) {C : Graph S (Set S)} + (hC : IsGraphComponent C G.toGraph) : IsCompact (compPointSet C) := by + rw [compPointSet_eq_closure_union G hC] + have hV_fin : V(C).Finite := G.finite_V.subset hC.1.vertexSet_mono + have hE_fin : E(C).Finite := G.finite_edges.subset hC.1.edgeSet_mono + exact hV_fin.isCompact.union (hE_fin.isCompact_biUnion fun e he => + isCompact_closure_edge G (hC.1.edgeSet_mono he)) + +/-- Monotonicity of `IsFeasible` with respect to subgraph inclusion `G₁ ≤ G₂`. -/ +theorem IsFeasible.mono {α : Type u} {β : Type*} {G₁ G₂ : Graph α β} {Δ : Set (Set α)} + (hle : G₁ ≤ G₂) (hF : IsFeasible G₁ Δ) : IsFeasible G₂ Δ := by + rcases hF with ⟨H, hΔ, hΔ_sub, hHG₁, hFor, H_comp, hinj, hcomp, hcomps_eq⟩ + exact ⟨H, hΔ, hΔ_sub.trans hle.vertexSet_mono, hHG₁.trans hle, hFor, + H_comp, hinj, hcomp, hcomps_eq⟩ + +/-- **Case (3.3)(ii) Reduction** (Graph Minors VI, page 122, Case 3): +If `(G.V ∩ bd S).Nonempty` and `G` has an internal component `C₀ ∈ graphComponents G.toGraph` +with `V(C₀) ∩ bd S = ∅`, then the subdrawing `G_bd` induced by the union of all components meeting +`bd S` satisfies `G_bd.V.ncard + G_bd.R.ncard < G.V.ncard + G.R.ncard`, `G_bd.V ∩ bd S = G.V ∩ bd +S`, +every chain of `G_bd` has non-negative redundancy, and `IsFeasible G_bd.toGraph Δ → IsFeasible +G.toGraph Δ`. -/ +theorem exists_reduction_of_internal_component (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) (hVG_ne : (G.V ∩ bd S).Nonempty) + {C₀ : Graph S (Set S)} (hC₀ : C₀ ∈ graphComponents G.toGraph) + (hC₀_disj : V(C₀) ∩ bd S = ∅) + {Δ : Set (Set S)} {U : Set S} + (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) + (hRed : ∀ x ∈ U ∪ (G.V ∩ bd S), ∀ y ∈ U ∪ (G.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G x y A → 0 ≤ chainRedundancy G Δ x y A) : + ∃ G' : Drawing S, G'.IsProper ∧ G'.IsSubdrawing G ∧ + G'.V.ncard + G'.R.ncard < G.V.ncard + G.R.ncard ∧ + G'.V ∩ bd S = G.V ∩ bd S ∧ + (∀ x ∈ U ∪ (G'.V ∩ bd S), ∀ y ∈ U ∪ (G'.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G' x y A → 0 ≤ chainRedundancy G' Δ x y A) ∧ + (IsFeasible G'.toGraph Δ → IsFeasible G.toGraph Δ) := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + let S_bd : Set (Graph S (Set S)) := {C ∈ graphComponents G.toGraph | (V(C) ∩ bd S).Nonempty} + have hS_bd_sub : S_bd ⊆ graphComponents G.toGraph := fun _ h => h.1 + let V_bd : Set S := ⋃ C ∈ S_bd, V(C) + have hV_bd_sub : V_bd ⊆ G.V := iUnion₂_subset fun C hC => hC.1.1.vertexSet_mono + let G' : Drawing S := induceDrawing G V_bd + have hProper' : G'.IsProper := induceDrawing_isProper G hProper hV_bd_sub + have hSub' : G'.IsSubdrawing G := induceDrawing_isSubdrawing G hV_bd_sub + have hG'_V : G'.V = V_bd := induceDrawing_V G hV_bd_sub + have hV'_bd_eq : G'.V ∩ bd S = G.V ∩ bd S := by + rw [hG'_V] + apply Subset.antisymm (inter_subset_inter_left _ hV_bd_sub) + rintro v ⟨hvV, hv_bd⟩ + refine ⟨mem_iUnion₂.mpr ⟨compOf G.toGraph v, ?_, self_mem_reachSet hvV⟩, hv_bd⟩ + exact ⟨isGraphComponent_compOf hvV, ⟨v, self_mem_reachSet hvV, hv_bd⟩⟩ + obtain ⟨v₀, hv₀C₀⟩ := hC₀.2.1.1 + have hv₀G : v₀ ∈ G.V := hC₀.1.vertexSet_mono hv₀C₀ + have hv₀_not : v₀ ∉ G'.V := by + rw [hG'_V] + intro hv₀_in + obtain ⟨C, ⟨hC_comp, hC_ne⟩, hv₀C⟩ := mem_iUnion₂.mp hv₀_in + have heq : C₀ = C := hC₀.eq_of_mem_mem hC_comp hv₀C₀ hv₀C + rw [← heq, hC₀_disj] at hC_ne + exact not_nonempty_empty hC_ne + have hV_lt : G'.V.ncard < G.V.ncard := + ncard_lt_ncard ⟨hSub'.1, fun h => hv₀_not (h hv₀G)⟩ G.finite_V + have hR_le : G'.R.ncard ≤ G.R.ncard := + disc_region_ncard_le_of_isSubdrawing hS hProper hSub' + obtain ⟨hU'_eq, hK₂_eq⟩ := induceDrawing_U_biUnion_components G hS_bd_sub + have hK₂_fin : (graphComponents G.toGraph \ S_bd).Finite := + (finite_graphComponents G).subset sdiff_subset + have hK₂_closed : IsClosed (G.U \ G'.U) := by + rw [hK₂_eq] + exact hK₂_fin.isClosed_biUnion fun C hC => isClosed_compPointSet G hC.1 + have h_bd_disj_K₂ : Disjoint (bd S) (G.U \ G'.U) := by + rw [hK₂_eq] + refine disjoint_left.mpr fun x hx_bd hx_union => ?_ + obtain ⟨C, ⟨hC_comp, hC_not⟩, hxC⟩ := mem_iUnion₂.mp hx_union + have hx_inter : x ∈ compPointSet C ∩ bd S := ⟨hxC, hx_bd⟩ + rw [compPointSet_inter_bd_eq G hProper hC_comp] at hx_inter + exact hC_not ⟨hC_comp, ⟨x, hx_inter⟩⟩ + have h_U'_bd_conn : IsConnected (G'.U ∪ bd S) := by + obtain ⟨b₀, _, hb₀_bd⟩ := hVG_ne + have h_fam_conn : ∀ C ∈ S_bd, IsConnected (compPointSet C ∪ bd S) := by + intro C hC + refine IsConnected.union ?_ (isConnected_compPointSet G hC.1) + (isConnected_of_isOArc hS.isOArc_bd) + rw [compPointSet_inter_bd_eq G hProper hC.1] + exact hC.2 + have h_union_eq : G'.U ∪ bd S = + ⋃₀ (insert (bd S) ((fun C => compPointSet C ∪ bd S) '' S_bd)) := by + change (induceDrawing G V_bd).U ∪ bd S = _ + rw [hU'_eq] + ext x + simp only [mem_union, mem_iUnion, exists_prop, sUnion_insert, mem_sUnion, mem_image, + exists_exists_and_eq_and] + constructor + · rintro (⟨C, hC, hxC⟩ | hx_bd) + · exact Or.inr ⟨C, hC, Or.inl hxC⟩ + · exact Or.inl hx_bd + · rintro (hx_bd | ⟨C, hC, hxC | hx_bd⟩) + · exact Or.inr hx_bd + · exact Or.inl ⟨C, hC, hxC⟩ + · exact Or.inr hx_bd + refine ⟨⟨b₀, Or.inr hb₀_bd⟩, ?_⟩ + rw [h_union_eq] + refine isPreconnected_sUnion b₀ _ ?_ ?_ + · rintro _ (rfl | ⟨C, _, rfl⟩) + · exact hb₀_bd + · exact Or.inr hb₀_bd + · rintro _ (rfl | ⟨C, hC, rfl⟩) + · exact (isConnected_of_isOArc hS.isOArc_bd).isPreconnected + · exact (h_fam_conn C hC).isPreconnected + have h_U'_bd_sub : G'.U ∪ bd S ⊆ univ \ (G.U \ G'.U) := by + rintro x (hxU' | hx_bd) + · exact ⟨mem_univ x, fun h => h.2 hxU'⟩ + · exact ⟨mem_univ x, disjoint_left.mp h_bd_disj_K₂ hx_bd⟩ + have hU_sub : U ⊆ bd S \ G.U := by + have h1 := isDualPointSet_subset_diff hU + intro u hu + obtain ⟨hu_bd, hu_not_V⟩ := h1 hu + exact ⟨hu_bd, fun huU => hu_not_V ⟨hProper ⟨hu_bd, huU⟩, hu_bd⟩⟩ + have h_same_comp : ∀ a ∈ G'.U ∪ U, ∀ b ∈ G'.U ∪ U, + b ∈ connectedComponentIn (univ \ (G.U \ G'.U)) a := by + intro a ha b hb + have ha' : a ∈ G'.U ∪ bd S := ha.imp_right fun h => (hU_sub h).1 + have hb' : b ∈ G'.U ∪ bd S := hb.imp_right fun h => (hU_sub h).1 + exact h_U'_bd_conn.isPreconnected.subset_connectedComponentIn ha' h_U'_bd_sub hb' + have h_toGraph_le : G'.toGraph ≤ G.toGraph := by + change (induceDrawing G V_bd).toGraph ≤ G.toGraph + rw [induceDrawing_toGraph_eq_induce G hV_bd_sub] + exact induce_le hV_bd_sub + refine ⟨G', hProper', hSub', by omega, hV'_bd_eq, ?_, IsFeasible.mono h_toGraph_le⟩ + intro x hx y hy A hChain' + have hxG : x ∈ U ∪ (G.V ∩ bd S) := by rwa [← hV'_bd_eq] + have hyG : y ∈ U ∪ (G.V ∩ bd S) := by rwa [← hV'_bd_eq] + obtain ⟨A_G, hChainG, hlen_eq⟩ := liftChain_of_subdrawing hS hProper hProper' hSub' + hK₂_closed (hV'_bd_eq.symm ▸ hVG_ne) hU_sub h_same_comp hx hy hChain' + have hredG := hRed x hxG y hyG A_G hChainG + unfold chainRedundancy at hredG ⊢ + rw [← hlen_eq] + exact hredG + +/-- **Case (3.3)(iii) Exclusion** (Graph Minors VI, page 122, Case 4): +If `0 ≤ chainRedundancy G Δ x y A` holds for every chain `A` of `G`, then no member `δ ∈ Δ` +can intersect two distinct components `C₁ ≠ C₂` of `G.toGraph`. -/ +theorem not_component_split_of_chainRedundancy_nonneg (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hΔ_sub : divisionUnion Δ ⊆ G.V ∩ bd S) + {U : Set S} (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) + (hRed : ∀ x ∈ U ∪ (G.V ∩ bd S), ∀ y ∈ U ∪ (G.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G x y A → 0 ≤ chainRedundancy G Δ x y A) + {δ₀ : Set S} (hδ₀ : δ₀ ∈ Δ) + {C₁ C₂ : Graph S (Set S)} (hC₁ : C₁ ∈ graphComponents G.toGraph) + (hC₂ : C₂ ∈ graphComponents G.toGraph) (hne : C₁ ≠ C₂) + (h₁ : (δ₀ ∩ V(C₁)).Nonempty) (h₂ : (δ₀ ∩ V(C₂)).Nonempty) : False := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + obtain ⟨a, haδ₀, haC₁⟩ := h₁ + obtain ⟨b, hbδ₀, hbC₂⟩ := h₂ + have ha_bd : a ∈ G.V ∩ bd S := hΔ_sub ⟨δ₀, hδ₀, haδ₀⟩ + have hb_bd : b ∈ G.V ∩ bd S := hΔ_sub ⟨δ₀, hδ₀, hbδ₀⟩ + have hVG_ne : (G.V ∩ bd S).Nonempty := ⟨a, ha_bd⟩ + let S_bd : Set (Graph S (Set S)) := {C ∈ graphComponents G.toGraph | (V(C) ∩ bd S).Nonempty} + let Δ_G : Set (Set S) := (fun C => V(C) ∩ bd S) '' S_bd + have hΔG_div : IsDivision Δ_G := by + have hfin : S_bd.Finite := (finite_graphComponents G).subset fun _ h => h.1 + refine ⟨hfin.image _, ?_, ?_⟩ + · rintro _ ⟨C, hC, rfl⟩ + exact hC.2 + · rintro _ ⟨C, hC, rfl⟩ _ ⟨C', hC', rfl⟩ hne_set + refine disjoint_left.mpr fun x hx hx' => hne_set ?_ + rw [hC.1.eq_of_mem_mem hC'.1 hx.1 hx'.1] + have hΔG_union : divisionUnion Δ_G = G.V ∩ bd S := by + ext x + simp only [divisionUnion, Δ_G, mem_sUnion, mem_image, exists_exists_and_eq_and] + constructor + · rintro ⟨C, hC, hxC, hx_bd⟩ + exact ⟨hC.1.1.vertexSet_mono hxC, hx_bd⟩ + · rintro ⟨hxV, hx_bd⟩ + exact ⟨compOf G.toGraph x, ⟨isGraphComponent_compOf hxV, ⟨x, self_mem_reachSet hxV, hx_bd⟩⟩, + self_mem_reachSet hxV, hx_bd⟩ + have hΔG_cf : IsCrossFree (bd S) Δ_G := by + rintro ⟨_, ⟨C, hC, rfl⟩, _, ⟨C', hC', rfl⟩, hne_set, u₁, hu₁, u₃, hu₃, u₂, hu₂, u₄, hu₄, hcr⟩ + have hne_C : C ≠ C' := fun heq => hne_set (congrArg (fun K => V(K) ∩ bd S) heq) + have h_inter := discCrossing_of_isClosedDiscSpace hS + (A := compPointSet C) (B := compPointSet C') + (isCompact_compPointSet G hC.1) (isCompact_compPointSet G hC'.1) + (isConnected_compPointSet G hC.1) (isConnected_compPointSet G hC'.1) + (Or.inl hu₁.1) (Or.inl hu₃.1) + (Or.inl hu₂.1) (Or.inl hu₄.1) hcr + obtain ⟨z, hzC, hzC'⟩ := h_inter + exact disjoint_left.mp (disjoint_compPointSet_of_ne G hC.1 hC'.1 hne_C) hzC hzC' + have hU_ΔG : IsDualPointSet (bd S) (divisionUnion Δ_G) U := by + rwa [hΔG_union] + have h_dd := theorem_2_2_proof (bd S) U Δ_G hS.isOArc_bd hΔG_div + (hΔG_union ▸ G.finite_V.inter_of_left _) + (hΔG_union ▸ inter_subset_right) hU_ΔG hΔG_cf + have h_not_equiv : ¬ dualEquivRel (bd S) (dualDivision (bd S) U Δ_G) a b := by + intro h_equiv + have ha_div : a ∈ divisionUnion Δ_G := by rw [hΔG_union]; exact ha_bd + have hb_div : b ∈ divisionUnion Δ_G := by rw [hΔG_union]; exact hb_bd + let δ_a : Set S := {v' ∈ divisionUnion Δ_G | + dualEquivRel (bd S) (dualDivision (bd S) U Δ_G) a v'} + have hδ_a_mem : δ_a ∈ doubleDualDivision (bd S) U Δ_G := ⟨a, ha_div, rfl⟩ + rw [h_dd] at hδ_a_mem + obtain ⟨C, hC, hC_eq⟩ := hδ_a_mem + dsimp only at hC_eq + have ha_in : a ∈ V(C) ∩ bd S := by + rw [hC_eq]; exact ⟨ha_div, dualEquivRel_refl _ _ a⟩ + have hb_in : b ∈ V(C) ∩ bd S := by + rw [hC_eq]; exact ⟨hb_div, h_equiv⟩ + have hC₁_eq : C₁ = C := hC₁.eq_of_mem_mem hC.1 haC₁ ha_in.1 + have hC₂_eq : C₂ = C := hC₂.eq_of_mem_mem hC.1 hbC₂ hb_in.1 + exact hne (hC₁_eq.trans hC₂_eq.symm) + unfold dualEquivRel at h_not_equiv + push Not at h_not_equiv + obtain ⟨δ_star, hδ_star, u₁, hu₁, u₂, hu₂, hcross_u_ab⟩ := h_not_equiv + have hU_sub_diff : U ⊆ bd S \ divisionUnion Δ_G := isDualPointSet_subset_diff hU_ΔG + have hδ_star_eq := dualDivision_mem_eq_of_mem hS.isOArc_bd + (hΔG_union ▸ inter_subset_right) hU_sub_diff hδ_star hu₁ + have hu₁_U : u₁ ∈ U := by rw [hδ_star_eq] at hu₁; exact hu₁.1 + have hu₂_U : u₂ ∈ U := by rw [hδ_star_eq] at hu₂; exact hu₂.1 + have hu₁₂_rel : dualEquivRel (bd S) Δ_G u₁ u₂ := by rw [hδ_star_eq] at hu₂; exact hu₂.2 + have hU_sub_bd : U ⊆ bd S \ G.U := by + rw [hΔG_union] at hU_sub_diff + intro u hu + obtain ⟨hu_bd, hu_not_V⟩ := hU_sub_diff hu + exact ⟨hu_bd, fun huU => hu_not_V ⟨hProper ⟨hu_bd, huU⟩, hu_bd⟩⟩ + have h_no_comp_cross : ∀ C ∈ graphComponents G.toGraph, + ∀ v₁ ∈ V(C) ∩ bd S, ∀ v₂ ∈ V(C) ∩ bd S, ¬ CrossesOn (bd S) v₁ v₂ u₁ u₂ := by + intro C hC v₁ hv₁ v₂ hv₂ hcr + have hC_bd : C ∈ S_bd := ⟨hC, ⟨v₁, hv₁⟩⟩ + exact hu₁₂_rel ⟨V(C) ∩ bd S, ⟨C, hC_bd, rfl⟩, v₁, hv₁, v₂, hv₂, hcr⟩ + have h_same_reg := same_region_of_no_component_crosses hS G hProper + (hU_sub_bd hu₁_U).1 (hU_sub_bd hu₂_U).1 + (hU_sub_bd hu₁_U).2 (hU_sub_bd hu₂_U).2 h_no_comp_cross + let r : Set S := connectedComponentIn (univ \ G.U) u₁ + have hr_R : r ∈ G.R := ⟨u₁, ⟨mem_univ u₁, (hU_sub_bd hu₁_U).2⟩, rfl⟩ + have hu₁_r : u₁ ∈ r := mem_connectedComponentIn ⟨mem_univ u₁, (hU_sub_bd hu₁_U).2⟩ + have hu₂_r : u₂ ∈ r := by + change u₂ ∈ connectedComponentIn (univ \ G.U) u₁ + rw [h_same_reg] + exact mem_connectedComponentIn ⟨mem_univ u₂, (hU_sub_bd hu₂_U).2⟩ + have hr_per : ChainTerm.IsPeripheral G (.inr r) := by + rw [isPeripheral_inr_iff_inter_bd_nonempty hS hProper hVG_ne hr_R] + exact ⟨u₁, hu₁_r, (hU_sub_bd hu₁_U).1⟩ + have hChain_r : IsXYChain G u₁ u₂ [.inr r] := by + refine ⟨List.cons_ne_nil _ _, ?_, List.isChain_singleton _, hu₁_r, hu₂_r, ?_⟩ + · intro t ht + rw [List.mem_singleton.mp ht] + exact hr_R + · intro ⟨i, hi⟩ + have hi0 : i = 0 := Nat.lt_one_iff.mp hi + subst hi0 + simpa using hr_per + have hred := hRed u₁ (Or.inl hu₁_U) u₂ (Or.inl hu₂_U) [.inr r] hChain_r + have hlen0 : chainLength ([.inr r] : List (ChainTerm S)) = 0 := by + simp [chainLength, ChainTerm.IsVertex] + have hcount_pos : 1 ≤ divisionCount (bd S) Δ u₁ u₂ := by + unfold divisionCount + have hδ₀_in : δ₀ ∈ {δ ∈ Δ | (δ ∩ {u₁, u₂}).Nonempty ∨ + ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn (bd S) u v u₁ u₂} := by + refine ⟨hδ₀, Or.inr ⟨a, haδ₀, b, hbδ₀, ?_⟩⟩ + exact hcross_u_ab.comm hS.isOArc_bd + have h_fin : {δ ∈ Δ | (δ ∩ {u₁, u₂}).Nonempty ∨ + ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn (bd S) u v u₁ u₂}.Finite := + hΔ.1.subset fun _ h => h.1 + exact ncard_pos h_fin |>.mpr ⟨δ₀, hδ₀_in⟩ + unfold chainRedundancy at hred + omega + +/-- **Case (3.3)(iv) Component Reduction** (Graph Minors VI, page 122, Case 4): +For any component `C_i ∈ graphComponents G.toGraph` with `(V(C_i) ∩ bd S).Nonempty` and any +sub-division `Δ_i ⊆ Δ` with `divisionUnion Δ_i = V(C_i) ∩ bd S`, the induced drawing +`G_i = induceDrawing G V(C_i)` has a dual point set `U_i ⊆ U` for `(bd S, G_i.V ∩ bd S)` such +that every chain of `G_i` has non-negative redundancy with respect to `Δ_i`. -/ +theorem exists_dualPointSet_and_chainRedundancy_of_component [T1Space S] (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) + {C_i : Graph S (Set S)} (hC_i : C_i ∈ graphComponents G.toGraph) + (hCi_bd : (V(C_i) ∩ bd S).Nonempty) + {Δ Δ_i : Set (Set S)} (hΔ : IsDivision Δ) (hΔ_i_sub : Δ_i ⊆ Δ) + {U : Set S} (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) + (hRed : ∀ x ∈ U ∪ (G.V ∩ bd S), ∀ y ∈ U ∪ (G.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G x y A → 0 ≤ chainRedundancy G Δ x y A) : + let G_i := induceDrawing G V(C_i) + ∃ U_i ⊆ U, IsDualPointSet (bd S) (G_i.V ∩ bd S) U_i ∧ + (∀ x ∈ U_i ∪ (G_i.V ∩ bd S), ∀ y ∈ U_i ∪ (G_i.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G_i x y A → 0 ≤ chainRedundancy G_i Δ_i x y A) := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + let G_i := induceDrawing G V(C_i) + change ∃ U_i ⊆ U, IsDualPointSet (bd S) (G_i.V ∩ bd S) U_i ∧ + (∀ x ∈ U_i ∪ (G_i.V ∩ bd S), ∀ y ∈ U_i ∪ (G_i.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G_i x y A → 0 ≤ chainRedundancy G_i Δ_i x y A) + have hVi_sub : V(C_i) ⊆ G.V := hC_i.1.vertexSet_mono + have hProper_i : G_i.IsProper := induceDrawing_isProper G hProper hVi_sub + have hSub_i : G_i.IsSubdrawing G := induceDrawing_isSubdrawing G hVi_sub + have hGi_V : G_i.V = V(C_i) := induceDrawing_V G hVi_sub + have hGi_U : G_i.U = compPointSet C_i := induceDrawing_U_of_component G hC_i + have hVi_bd_sub : G_i.V ∩ bd S ⊆ G.V ∩ bd S := inter_subset_inter_left _ hSub_i.1 + obtain ⟨U_i, hUi_sub, hUi_dual, hUi_conn⟩ := exists_dualPointSet_subset_of_subset + hS.isOArc_bd inter_subset_right (G.finite_V.inter_of_left _) hU hVi_bd_sub + have hS_i_sub : ({C_i} : Set (Graph S (Set S))) ⊆ graphComponents G.toGraph := + singleton_subset_iff.mpr hC_i + obtain ⟨_, hK₂_eq⟩ := induceDrawing_U_biUnion_components G hS_i_sub + have h_V_sUnion : (⋃ C ∈ ({C_i} : Set (Graph S (Set S))), V(C)) = V(C_i) := by simp + have hK₂_eq' : G.U \ G_i.U = ⋃ C ∈ graphComponents G.toGraph \ {C_i}, compPointSet C := by + change G.U \ (induceDrawing G V(C_i)).U = _ + rwa [← h_V_sUnion] + have hK₂_fin : (graphComponents G.toGraph \ {C_i}).Finite := + (finite_graphComponents G).subset sdiff_subset + have hK₂_closed : IsClosed (G.U \ G_i.U) := by + rw [hK₂_eq'] + exact hK₂_fin.isClosed_biUnion fun C hC => isClosed_compPointSet G hC.1 + have hU_sub_bd : U ⊆ bd S \ G.U := by + have h1 := isDualPointSet_subset_diff hU + intro u hu + obtain ⟨hu_bd, hu_not_V⟩ := h1 hu + exact ⟨hu_bd, fun huU => hu_not_V ⟨hProper ⟨hu_bd, huU⟩, hu_bd⟩⟩ + have hUi_sub_bd : U_i ⊆ bd S \ G.U := hUi_sub.trans hU_sub_bd + have hGi_bd_ne : (G_i.V ∩ bd S).Nonempty := hGi_V.symm ▸ hCi_bd + obtain ⟨v₀, hv₀⟩ := hCi_bd + have hv₀_Gi : v₀ ∈ G_i.U := G_i.V_subset_U (hGi_V.symm ▸ hv₀.1) + have hGi_sub_compl : G_i.U ⊆ univ \ (G.U \ G_i.U) := fun z hz => ⟨mem_univ z, fun h => h.2 hz⟩ + have hGi_conn : IsConnected G_i.U := hGi_U ▸ isConnected_compPointSet G hC_i + have h_in_cc_v₀ : ∀ z ∈ G_i.U ∪ U_i, z ∈ connectedComponentIn (univ \ (G.U \ G_i.U)) v₀ := by + rintro z (hz_Gi | hz_Ui) + · exact hGi_conn.isPreconnected.subset_connectedComponentIn hv₀_Gi hGi_sub_compl hz_Gi + · obtain ⟨v', hv', seg₀, hseg₀, _, K, hK_sub, hK_conn, hv'_K, hz_K⟩ := hUi_conn z hz_Ui + have hv'_Gi : v' ∈ G_i.U := G_i.V_subset_U hv'.1 + have hv'_cc : v' ∈ connectedComponentIn (univ \ (G.U \ G_i.U)) v₀ := + hGi_conn.isPreconnected.subset_connectedComponentIn hv₀_Gi hGi_sub_compl hv'_Gi + have hseg_sub : seg₀ ⊆ bd S \ G.U := by + rcases hseg₀.1 with ⟨w, hw, rfl⟩ + refine (connectedComponentIn_subset _ _).trans fun x hx => + ⟨hx.1, fun hxU => hx.2 ⟨hProper ⟨hx.1, hxU⟩, hx.1⟩⟩ + have hK_compl : K ⊆ univ \ (G.U \ G_i.U) := by + refine hK_sub.trans ?_ + rintro x (rfl | hx_seg) + · exact hGi_sub_compl hv'_Gi + · exact ⟨mem_univ x, fun h => (hseg_sub hx_seg).2 h.1⟩ + rw [connectedComponentIn_eq hv'_cc] + exact hK_conn.isPreconnected.subset_connectedComponentIn hv'_K hK_compl hz_K + have h_same_comp : ∀ a ∈ G_i.U ∪ U_i, ∀ b ∈ G_i.U ∪ U_i, + b ∈ connectedComponentIn (univ \ (G.U \ G_i.U)) a := by + intro a ha b hb + rw [← connectedComponentIn_eq (h_in_cc_v₀ a ha)] + exact h_in_cc_v₀ b hb + refine ⟨U_i, hUi_sub, hUi_dual, fun x hx y hy A hChain_i => ?_⟩ + have hxG : x ∈ U ∪ (G.V ∩ bd S) := hx.imp (fun h => hUi_sub h) (fun h => hVi_bd_sub h) + have hyG : y ∈ U ∪ (G.V ∩ bd S) := hy.imp (fun h => hUi_sub h) (fun h => hVi_bd_sub h) + obtain ⟨A_G, hChainG, hlen_eq⟩ := liftChain_of_subdrawing hS hProper hProper_i hSub_i + hK₂_closed hGi_bd_ne hUi_sub_bd h_same_comp hx hy hChain_i + have hredG := hRed x hxG y hyG A_G hChainG + have hdiv_le : divisionCount (bd S) Δ_i x y ≤ divisionCount (bd S) Δ x y := + divisionCount_le_of_subset hΔ hΔ_i_sub x y + unfold chainRedundancy at hredG ⊢ + omega + +end GraphMinor.GM06 diff --git a/LeanPool/GraphMinor/GM06/Section3InduceSingleton.lean b/LeanPool/GraphMinor/GM06/Section3InduceSingleton.lean new file mode 100644 index 0000000000..7a67d11907 --- /dev/null +++ b/LeanPool/GraphMinor/GM06/Section3InduceSingleton.lean @@ -0,0 +1,1481 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.Section3Induce + +/-! +# Graph Minors VI, Section 3: Singleton-Deletion Reduction for (3.6) + +This file formalizes the singleton-deletion reduction (`(3.3)(i)`, Case 2 of the proof of `(3.6)` +on page 122 of Robertson and Seymour, *Graph Minors. VI. Disjoint paths across a disc*, +J. Combin. Theory Ser. B **41** (1986), 115–138): +if `{v} ∈ Δ`, deleting `v` from `G` and `{v}` from `Δ` produces a smaller proper drawing +`G' = induceDrawing G (G.V \ {v})` and division `Δ' = Δ \ {{v}}` preserving non-negative chain +redundancy. +-/ + +public section + +namespace GraphMinor.GM06 + +open Set Function Topology Graph GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Triangle Inequality and Singleton Removal for `divisionCount` -/ + +/-- Triangle inequality for `divisionCount` on an $O$-arc `C` when the middle point `y` is not in +`divisionUnion Δ`. -/ +theorem divisionCount_le_add_of_not_mem {C : Set S} (hC : IsOArc C) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hV_sub : divisionUnion Δ ⊆ C) + {x y z : S} (hx : x ∈ C) (hy : y ∈ C) (hz : z ∈ C) (hy_not : y ∉ divisionUnion Δ) : + divisionCount C Δ x z ≤ divisionCount C Δ x y + divisionCount C Δ y z := by + let S_xz := {δ ∈ Δ | (δ ∩ {x, z}).Nonempty ∨ ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn C u v x z} + let S_xy := {δ ∈ Δ | (δ ∩ {x, y}).Nonempty ∨ ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn C u v x y} + let S_yz := {δ ∈ Δ | (δ ∩ {y, z}).Nonempty ∨ ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn C u v y z} + have h_sub : S_xz ⊆ S_xy ∪ S_yz := by + rintro δ ⟨hδ, hcond⟩ + rcases hcond with ⟨w, hwδ, hwxz⟩ | ⟨u, huδ, v, hvδ, hcr⟩ + · rcases hwxz with rfl | hwz + · exact Or.inl ⟨hδ, Or.inl ⟨w, hwδ, mem_insert w {y}⟩⟩ + · rw [mem_singleton_iff] at hwz + subst hwz + exact Or.inr ⟨hδ, Or.inl ⟨w, hwδ, mem_insert_of_mem y (mem_singleton w)⟩⟩ + · have hu_div : u ∈ divisionUnion Δ := ⟨δ, hδ, huδ⟩ + have hv_div : v ∈ divisionUnion Δ := ⟨δ, hδ, hvδ⟩ + have huy : u ≠ y := fun h => hy_not (h ▸ hu_div) + have hvy : v ≠ y := fun h => hy_not (h ▸ hv_div) + by_cases hcr_xy : CrossesOn C u v x y + · exact Or.inl ⟨hδ, Or.inr ⟨u, huδ, v, hvδ, hcr_xy⟩⟩ + · have hcr_yz : CrossesOn C u v y z := by + by_contra hcr_yz + exact not_crossesOn_trans hC (hV_sub hu_div) (hV_sub hv_div) + hx hy hz huy hvy hcr_xy hcr_yz hcr + exact Or.inr ⟨hδ, Or.inr ⟨u, huδ, v, hvδ, hcr_yz⟩⟩ + have hxy_fin : S_xy.Finite := hΔ.1.subset fun _ h => h.1 + have hyz_fin : S_yz.Finite := hΔ.1.subset fun _ h => h.1 + unfold divisionCount + exact (ncard_le_ncard h_sub (hxy_fin.union hyz_fin)).trans (ncard_union_le S_xy S_yz) + +/-- If `divisionCount C Δ x y = 0` and `x, y, z ∈ C` with `y ∉ divisionUnion Δ`, then +`divisionCount C Δ x z ≤ divisionCount C Δ y z`. -/ +theorem divisionCount_le_of_left_eq_zero {C : Set S} (hC : IsOArc C) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hV_sub : divisionUnion Δ ⊆ C) + {x y z : S} (hx : x ∈ C) (hy : y ∈ C) (hz : z ∈ C) (hy_not : y ∉ divisionUnion Δ) + (h0 : divisionCount C Δ x y = 0) : + divisionCount C Δ x z ≤ divisionCount C Δ y z := by + have h := divisionCount_le_add_of_not_mem hC hΔ hV_sub hx hy hz hy_not + omega + +/-- If `divisionCount C Δ y z = 0` and `x, y, z ∈ C` with `y ∉ divisionUnion Δ`, then +`divisionCount C Δ x z ≤ divisionCount C Δ x y`. -/ +theorem divisionCount_le_of_right_eq_zero {C : Set S} (hC : IsOArc C) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hV_sub : divisionUnion Δ ⊆ C) + {x y z : S} (hx : x ∈ C) (hy : y ∈ C) (hz : z ∈ C) (hy_not : y ∉ divisionUnion Δ) + (h0 : divisionCount C Δ y z = 0) : + divisionCount C Δ x z ≤ divisionCount C Δ x y := by + have h := divisionCount_le_add_of_not_mem hC hΔ hV_sub hx hy hz hy_not + omega + +/-- Removing a singleton member `{v} ∈ Δ` decreases `divisionCount C Δ x v` by `1`. -/ +theorem divisionCount_sdiff_singleton_right (C : Set S) {Δ : Set (Set S)} (hΔ : IsDivision Δ) + {v : S} (hv : {v} ∈ Δ) (x : S) : + divisionCount C Δ x v = divisionCount C (Δ \ {{v}}) x v + 1 := by + let S_full := {δ ∈ Δ | (δ ∩ {x, v}).Nonempty ∨ ∃ a ∈ δ, ∃ b ∈ δ, CrossesOn C a b x v} + let S_del := {δ ∈ Δ \ {{v}} | (δ ∩ {x, v}).Nonempty ∨ ∃ a ∈ δ, ∃ b ∈ δ, CrossesOn C a b x v} + have h_eq : S_full = insert {v} S_del := by + ext δ + simp only [S_full, S_del, mem_ofPred_eq, mem_sdiff, mem_singleton_iff, mem_insert_iff] + constructor + · rintro ⟨hδ, hcond⟩ + rcases eq_or_ne δ {v} with rfl | hne + · exact Or.inl rfl + · exact Or.inr ⟨⟨hδ, hne⟩, hcond⟩ + · rintro (rfl | ⟨⟨hδ, _⟩, hcond⟩) + · refine ⟨hv, Or.inl ⟨v, rfl, mem_insert_of_mem x (mem_singleton v)⟩⟩ + · exact ⟨hδ, hcond⟩ + have h_not_mem : {v} ∉ S_del := fun h => h.1.2 rfl + have h_fin : S_del.Finite := hΔ.1.subset fun _ h => h.1.1 + unfold divisionCount + change S_full.ncard = S_del.ncard + 1 + rw [h_eq, ncard_insert_of_notMem h_not_mem h_fin] + +/-- Removing a singleton member `{v} ∈ Δ` decreases `divisionCount C Δ v y` by `1`. -/ +theorem divisionCount_sdiff_singleton_left (C : Set S) {Δ : Set (Set S)} (hΔ : IsDivision Δ) + {v : S} (hv : {v} ∈ Δ) (y : S) : + divisionCount C Δ v y = divisionCount C (Δ \ {{v}}) v y + 1 := by + let S_full := {δ ∈ Δ | (δ ∩ {v, y}).Nonempty ∨ ∃ a ∈ δ, ∃ b ∈ δ, CrossesOn C a b v y} + let S_del := {δ ∈ Δ \ {{v}} | (δ ∩ {v, y}).Nonempty ∨ ∃ a ∈ δ, ∃ b ∈ δ, CrossesOn C a b v y} + have h_eq : S_full = insert {v} S_del := by + ext δ + simp only [S_full, S_del, mem_ofPred_eq, mem_sdiff, mem_singleton_iff, mem_insert_iff] + constructor + · rintro ⟨hδ, hcond⟩ + rcases eq_or_ne δ {v} with rfl | hne + · exact Or.inl rfl + · exact Or.inr ⟨⟨hδ, hne⟩, hcond⟩ + · rintro (rfl | ⟨⟨hδ, _⟩, hcond⟩) + · refine ⟨hv, Or.inl ⟨v, rfl, mem_insert v {y}⟩⟩ + · exact ⟨hδ, hcond⟩ + have h_not_mem : {v} ∉ S_del := fun h => h.1.2 rfl + have h_fin : S_del.Finite := hΔ.1.subset fun _ h => h.1.1 + unfold divisionCount + change S_full.ncard = S_del.ncard + 1 + rw [h_eq, ncard_insert_of_notMem h_not_mem h_fin] + +/-! ## 2. Peripheral Regions, Dual Points, and Short Chains in `G` -/ + +/-- If a region `r ∈ G.R` of a proper drawing `G` on a closed disc space `S` (with +`(G.V ∩ bd S).Nonempty`) meets `bd S`, and `U` is a dual point set for `(bd S, G.V ∩ bd S)`, then +`r` contains a point of `U`. -/ +theorem exists_mem_U_of_region_inter_bd_nonempty (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) (hVG_ne : (G.V ∩ bd S).Nonempty) + {U : Set S} (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) + {r : Set S} (hr : r ∈ G.R) (hr_bd : (r ∩ bd S).Nonempty) : + ∃ u ∈ U, u ∈ r := by + have hr_per : ChainTerm.IsPeripheral G (.inr r) := + (isPeripheral_inr_iff_inter_bd_nonempty hS hProper hVG_ne hr).mpr hr_bd + obtain ⟨_, seg, hseg, hseg_sub⟩ := hr_per + have h_card : (U ∩ seg).ncard = 1 := (hU.2 hVG_ne).2 seg hseg + obtain ⟨u, hu_eq⟩ := ncard_eq_one.mp h_card + have hu_mem : u ∈ U ∩ seg := by rw [hu_eq]; exact mem_singleton u + exact ⟨u, hu_mem.1, hseg_sub hu_mem.2⟩ + +/-- If `x, y ∈ U ∪ (G.V ∩ bd S)` both lie in a peripheral region `r ∈ G.R`, then `[.inr r]` is an +`(x, y)`-chain of `G` of length `0`, so non-negative chain redundancy implies +`divisionCount (bd S) Δ x y = 0`. -/ +theorem divisionCount_eq_zero_of_mem_region (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) (hVG_ne : (G.V ∩ bd S).Nonempty) + {Δ : Set (Set S)} {U : Set S} (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) + (hRed : ∀ a ∈ U ∪ (G.V ∩ bd S), ∀ b ∈ U ∪ (G.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G a b A → 0 ≤ chainRedundancy G Δ a b A) + {r : Set S} (hr : r ∈ G.R) {x y : S} + (hx : x ∈ U ∪ (G.V ∩ bd S)) (hy : y ∈ U ∪ (G.V ∩ bd S)) + (hxr : x ∈ r) (hyr : y ∈ r) : + divisionCount (bd S) Δ x y = 0 := by + have hx_bd : x ∈ bd S := by + rcases hx with hxU | hxV + · exact (isDualPointSet_subset_diff hU hxU).1 + · exact hxV.2 + have hr_per : ChainTerm.IsPeripheral G (.inr r) := by + rw [isPeripheral_inr_iff_inter_bd_nonempty hS hProper hVG_ne hr] + exact ⟨x, hxr, hx_bd⟩ + have hChain : IsXYChain G x y [.inr r] := by + refine ⟨List.cons_ne_nil _ _, ?_, List.isChain_singleton _, hxr, hyr, ?_⟩ + · intro t ht + rw [List.mem_singleton.mp ht] + exact hr + · intro ⟨i, hi⟩ + have hi0 : i = 0 := Nat.lt_one_iff.mp hi + subst hi0 + simpa using hr_per + have hred := hRed x hx y hy [.inr r] hChain + have hlen : chainLength ([.inr r] : List (ChainTerm S)) = 0 := by + simp [chainLength, ChainTerm.IsVertex] + unfold chainRedundancy at hred + omega + +/-- If `{v} ∈ Δ`, `r ∈ G.R`, `u ∈ U ∪ (G.V ∩ bd S)`, `u ∈ r`, and `v ∈ closure r`, then +`[.inr r, .inl v]` is a `(u, v)`-chain of `G` and `[.inl v, .inr r]` is a `(v, u)`-chain of `G`, +both of length `1`, so `divisionCount (bd S) (Δ \ {{v}}) u v = 0` and +`divisionCount (bd S) (Δ \ {{v}}) v u = 0`. -/ +theorem divisionCount_sdiff_eq_zero_of_region_incident_v (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hΔ_sub : divisionUnion Δ ⊆ G.V ∩ bd S) + {v : S} (hv : {v} ∈ Δ) + {U : Set S} (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) + (hRed : ∀ a ∈ U ∪ (G.V ∩ bd S), ∀ b ∈ U ∪ (G.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G a b A → 0 ≤ chainRedundancy G Δ a b A) + {r : Set S} (hr : r ∈ G.R) {u : S} (hu : u ∈ U ∪ (G.V ∩ bd S)) + (hur : u ∈ r) (hvr : v ∈ closure r) : + divisionCount (bd S) (Δ \ {{v}}) u v = 0 ∧ + divisionCount (bd S) (Δ \ {{v}}) v u = 0 := by + have hv_bd : v ∈ G.V ∩ bd S := hΔ_sub ⟨{v}, hv, rfl⟩ + have hVG_ne : (G.V ∩ bd S).Nonempty := ⟨v, hv_bd⟩ + have hu_bd : u ∈ bd S := by + rcases hu with huU | huV + · exact (isDualPointSet_subset_diff hU huU).1 + · exact huV.2 + have hr_per : ChainTerm.IsPeripheral G (.inr r) := by + rw [isPeripheral_inr_iff_inter_bd_nonempty hS hProper hVG_ne hr] + exact ⟨u, hur, hu_bd⟩ + have hv_per : ChainTerm.IsPeripheral G (.inl v) := hv_bd + have hChain1 : IsXYChain G u v [.inr r, .inl v] := by + refine ⟨List.cons_ne_nil _ _, ?_, ?_, hur, rfl, ?_⟩ + · intro t ht + rcases List.mem_cons.mp ht with rfl | ht' + · exact hr + · rw [List.mem_singleton.mp ht'] + exact hv_bd.1 + · rw [List.isChain_cons_cons] + exact ⟨⟨hv_bd.1, hr, hvr⟩, List.isChain_singleton _⟩ + · intro ⟨i, hi⟩ + have hi_cases : i = 0 ∨ i = 1 := by change i < 2 at hi; omega + rcases hi_cases with rfl | rfl + · simpa using hr_per + · simpa using hv_per + have hChain2 : IsXYChain G v u [.inl v, .inr r] := by + refine ⟨List.cons_ne_nil _ _, ?_, ?_, rfl, hur, ?_⟩ + · intro t ht + rcases List.mem_cons.mp ht with rfl | ht' + · exact hv_bd.1 + · rw [List.mem_singleton.mp ht'] + exact hr + · rw [List.isChain_cons_cons] + exact ⟨⟨hv_bd.1, hr, hvr⟩, List.isChain_singleton _⟩ + · intro ⟨i, hi⟩ + have hi_cases : i = 0 ∨ i = 1 := by change i < 2 at hi; omega + rcases hi_cases with rfl | rfl + · simpa using hv_per + · simpa using hr_per + have hlen1 : chainLength ([.inr r, .inl v] : List (ChainTerm S)) = 1 := rfl + have hlen2 : chainLength ([.inl v, .inr r] : List (ChainTerm S)) = 1 := rfl + have hred1 := hRed u hu v (Or.inr hv_bd) [.inr r, .inl v] hChain1 + have hred2 := hRed v (Or.inr hv_bd) u hu [.inl v, .inr r] hChain2 + have hdiv1 := divisionCount_sdiff_singleton_right (bd S) hΔ hv u + have hdiv2 := divisionCount_sdiff_singleton_left (bd S) hΔ hv u + unfold chainRedundancy at hred1 hred2 + omega + +/-! ## 3. Subregions of `G` Inside a Region `r'` of `G'` -/ + +/-- For any subdrawing `G' ⊆ G` of a proper drawing `G` on a closed disc space `S`, any region +`r' ∈ G'.R`, and any point `a ∈ closure r'` (with `a ∉ G.U` if `a ∈ r'`), there exists a region +`r ∈ G.R` such that `r ⊆ r'`, `a ∈ closure r`, and `(a ∈ r' → a ∈ r)`. -/ +theorem exists_subregion_closure_of_mem_closure (hS : IsClosedDiscSpace S) + {G G' : Drawing S} (hProper : G.IsProper) (hSub : G'.IsSubdrawing G) + {r' : Set S} (hr' : r' ∈ G'.R) {a : S} (ha : a ∈ closure r') + (ha_not_U : a ∈ r' → a ∉ G.U) : + ∃ r ∈ G.R, r ⊆ r' ∧ a ∈ closure r ∧ (a ∈ r' → a ∈ r) := by + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + by_cases ha_in : a ∈ r' + · have haU : a ∉ G.U := ha_not_U ha_in + obtain ⟨r, hr, har⟩ := exists_region_of_notMem haU + have hr_sub : r ⊆ r' := subset_region hr' (region_isPreconnected hr) + (disjoint_left.mpr fun y hy h => region_subset hr hy (hSub.U_subset h)) har ha_in + exact ⟨r, hr, hr_sub, subset_closure har, fun _ => har⟩ + · let S_sub : Set (Set S) := {r ∈ G.R | r ⊆ r'} + have hS_fin : S_sub.Finite := (disc_finite_R hS G hProper).subset fun _ h => h.1 + have hr'_sub_cl : r' ⊆ closure (⋃ r ∈ S_sub, r) := by + intro x hxr' + rw [mem_closure_iff] + intro O hO hxO + obtain ⟨y, ⟨hyO, hyr'⟩, hyU⟩ := + disc_exists_notMem_U hS hProper (hO.inter (region_isOpen hr')) ⟨x, hxO, hxr'⟩ + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem hyU + have hr_sub : r ⊆ r' := subset_region hr' (region_isPreconnected hr) + (disjoint_left.mpr fun z hz h => region_subset hr hz (hSub.U_subset h)) hyr hyr' + exact ⟨y, hyO, mem_iUnion₂.mpr ⟨r, ⟨hr, hr_sub⟩, hyr⟩⟩ + have hcl_sub : closure r' ⊆ ⋃ r ∈ S_sub, closure r := by + rw [← hS_fin.closure_biUnion] + exact closure_minimal hr'_sub_cl isClosed_closure + obtain ⟨r, ⟨hr, hr_sub⟩, ha_cl⟩ := mem_iUnion₂.mp (hcl_sub ha) + exact ⟨r, hr, hr_sub, ha_cl, fun h => (ha_in h).elim⟩ + +/-- If `G' = induceDrawing G (G.V \ {v})` for a proper drawing `G` on a closed disc space `S`, +`r' ∈ G'.R`, and `r₁, r₂ ∈ G.R` satisfy `r₁ ⊆ r'` and `r₂ ⊆ r'`, then either `r₁ = r₂` or +`v ∈ closure r₁ ∧ v ∈ closure r₂`. -/ +theorem subregion_eq_or_mem_closure_of_delete_vertex [T1Space S] (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) (v : S) + {r' r₁ r₂ : Set S} (hr' : r' ∈ (induceDrawing G (G.V \ {v})).R) + (hr₁ : r₁ ∈ G.R) (hr₂ : r₂ ∈ G.R) (hs₁ : r₁ ⊆ r') (hs₂ : r₂ ⊆ r') : + r₁ = r₂ ∨ (v ∈ closure r₁ ∧ v ∈ closure r₂) := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + rcases eq_or_ne r₁ r₂ with rfl | hne + · exact Or.inl rfl + · right + have hSub : (induceDrawing G (G.V \ {v})).IsSubdrawing G := + induceDrawing_isSubdrawing G sdiff_subset + have h_aux : ∀ {c d : Set S}, c ∈ G.R → d ∈ G.R → c ⊆ r' → d ⊆ r' → c ≠ d → + v ∈ closure c := by + intro c d hc hd hcs hds hcd + obtain ⟨e, heG, he_not, a, b, ha_mem, _, _, _, hia, _⟩ := + disc_theorem_5_1 hS hProper hSub (Z := {c}) hr' hc (mem_singleton c) hd + (fun h => hcd (mem_singleton_iff.mp h).symm) hcs hds + rw [mem_singleton_iff] at ha_mem + subst ha_mem + have he_cl : e ⊆ closure a := + disc_edge_subset_closure_of_incident hS hProper hia.1 hia.2.1 hia.2.2 + have hcl_sub : closure e ⊆ closure a := closure_minimal he_cl isClosed_closure + rw [induceDrawing_E] at he_not + have h_not_sub : ¬ (closure e ∩ G.V ⊆ G.V \ {v}) := fun h => he_not ⟨heG, h⟩ + obtain ⟨z, ⟨hz_cl, hzV⟩, hz_not⟩ := not_subset.mp h_not_sub + have hzv : z = v := by + by_contra hzv + exact hz_not ⟨hzV, hzv⟩ + subst hzv + exact hcl_sub hz_cl + exact ⟨h_aux hr₁ hr₂ hs₁ hs₂ hne, h_aux hr₂ hr₁ hs₂ hs₁ hne.symm⟩ + +/-! ## 4. Chain Redundancy Under Singleton Deletion -/ + +/-- If `a ∈ r₁` and `b ∈ r₂` for two subregions `r₁, r₂ ∈ G.R` of the same region `r'` of +`induceDrawing G (G.V \ {v})`, then `divisionCount (bd S) (Δ \ {{v}}) a b = 0`. -/ +private lemma divisionCount_sdiff_eq_zero_of_subregions [T1Space S] (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hΔ_sub : divisionUnion Δ ⊆ G.V ∩ bd S) + {v : S} (hv : {v} ∈ Δ) + {U : Set S} (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) + (hRed : ∀ a ∈ U ∪ (G.V ∩ bd S), ∀ b ∈ U ∪ (G.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G a b A → 0 ≤ chainRedundancy G Δ a b A) + {r' r₁ r₂ : Set S} (hr' : r' ∈ (induceDrawing G (G.V \ {v})).R) + (hr₁ : r₁ ∈ G.R) (hr₂ : r₂ ∈ G.R) (hr₁_sub : r₁ ⊆ r') (hr₂_sub : r₂ ⊆ r') + {a b : S} (ha : a ∈ U ∪ (G.V ∩ bd S)) (hb : b ∈ U ∪ (G.V ∩ bd S)) + (har₁ : a ∈ r₁) (hbr₂ : b ∈ r₂) : + divisionCount (bd S) (Δ \ {{v}}) a b = 0 := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have hVG_ne : (G.V ∩ bd S).Nonempty := ⟨v, hΔ_sub ⟨{v}, hv, rfl⟩⟩ + have hU_sub_bd : U ⊆ bd S \ G.U := by + have h1 := isDualPointSet_subset_diff hU + intro u hu + exact ⟨(h1 hu).1, fun huU => (h1 hu).2 ⟨hProper ⟨(h1 hu).1, huU⟩, (h1 hu).1⟩⟩ + rcases subregion_eq_or_mem_closure_of_delete_vertex hS hProper v hr' + hr₁ hr₂ hr₁_sub hr₂_sub with rfl | ⟨hva, hvb⟩ + · have h0 := divisionCount_eq_zero_of_mem_region hS hProper hVG_ne hU hRed + hr₁ ha hb har₁ hbr₂ + have hle := divisionCount_le_of_subset (C := bd S) hΔ (sdiff_subset : Δ \ {{v}} ⊆ Δ) a b + omega + · have h1 := (divisionCount_sdiff_eq_zero_of_region_incident_v hS hProper hΔ hΔ_sub + hv hU hRed hr₁ ha har₁ hva).1 + have h2 := (divisionCount_sdiff_eq_zero_of_region_incident_v hS hProper hΔ hΔ_sub + hv hU hRed hr₂ hb hbr₂ hvb).2 + have hΔ'_div : IsDivision (Δ \ {{v}}) := + ⟨hΔ.1.subset sdiff_subset, fun δ hδ => hΔ.2.1 δ hδ.1, hΔ.2.2.subset sdiff_subset⟩ + have hΔ'_sub_bd : divisionUnion (Δ \ {{v}}) ⊆ bd S := + (sUnion_mono sdiff_subset).trans (hΔ_sub.trans inter_subset_right) + have hv_not_Δ' : v ∉ divisionUnion (Δ \ {{v}}) := by + rintro ⟨δ, ⟨hδ, hne⟩, hvδ⟩ + exact (hΔ.2.2 hδ hv hne).ne_of_mem hvδ rfl rfl + have ha_bd : a ∈ bd S := ha.elim (fun h => (hU_sub_bd h).1) (fun h => h.2) + have hb_bd : b ∈ bd S := hb.elim (fun h => (hU_sub_bd h).1) (fun h => h.2) + have hv_bd : v ∈ bd S := (hΔ_sub ⟨{v}, hv, rfl⟩).2 + have htri := divisionCount_le_add_of_not_mem hS.isOArc_bd hΔ'_div hΔ'_sub_bd + ha_bd hv_bd hb_bd hv_not_Δ' + omega + +/-- Case `A'.length = 1` of singleton deletion: if `A'` is a 1-term `(x, y)`-chain of +`G' = induceDrawing G (G.V \ {v})`, then `0 ≤ chainRedundancy G' (Δ \ {{v}}) x y A'`. -/ +theorem chainRedundancy_nonneg_of_length_one [T1Space S] (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hΔ_sub : divisionUnion Δ ⊆ G.V ∩ bd S) + {v : S} (hv : {v} ∈ Δ) + {U U' : Set S} (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) (hU'_sub : U' ⊆ U) + (hRed : ∀ a ∈ U ∪ (G.V ∩ bd S), ∀ b ∈ U ∪ (G.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G a b A → 0 ≤ chainRedundancy G Δ a b A) + {x y : S} (hx : x ∈ U' ∪ ((induceDrawing G (G.V \ {v})).V ∩ bd S)) + (hy : y ∈ U' ∪ ((induceDrawing G (G.V \ {v})).V ∩ bd S)) + {A' : List (ChainTerm S)} (hChain : IsXYChain (induceDrawing G (G.V \ {v})) x y A') + (hlen1 : A'.length = 1) : + 0 ≤ chainRedundancy (induceDrawing G (G.V \ {v})) (Δ \ {{v}}) x y A' := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + let G' := induceDrawing G (G.V \ {v}) + let Δ' := Δ \ {{v}} + have hSub : G'.IsSubdrawing G := induceDrawing_isSubdrawing G sdiff_subset + have hxG : x ∈ U ∪ (G.V ∩ bd S) := + hx.imp (fun h => hU'_sub h) (fun h => ⟨hSub.1 h.1, h.2⟩) + have hyG : y ∈ U ∪ (G.V ∩ bd S) := + hy.imp (fun h => hU'_sub h) (fun h => ⟨hSub.1 h.1, h.2⟩) + obtain ⟨t₀, rfl⟩ := List.length_eq_one_iff.mp hlen1 + have ht₀_val := hChain.valid t₀ (List.mem_singleton_self t₀) + have hhead : ([t₀] : List (ChainTerm S)).head hChain.ne_nil = t₀ := rfl + have hlast : ([t₀] : List (ChainTerm S)).getLast hChain.ne_nil = t₀ := rfl + have hmatch_x := hChain.head_matches + have hmatch_y := hChain.last_matches + rw [hhead] at hmatch_x + rw [hlast] at hmatch_y + rcases t₀ with w | r' + · change w ∈ G'.V at ht₀_val + change w = x at hmatch_x + change w = y at hmatch_y + subst hmatch_x hmatch_y + have hw_per : ChainTerm.IsPeripheral G (.inl w) := by + have hper' := (hChain.peripheral_iff ⟨0, Nat.zero_lt_one⟩).mpr (Or.inl rfl) + exact ⟨hSub.1 hper'.1, hper'.2⟩ + have hChainG : IsXYChain G w w [.inl w] := by + refine ⟨List.cons_ne_nil _ _, ?_, List.isChain_singleton _, rfl, rfl, ?_⟩ + · intro t ht; rw [List.mem_singleton.mp ht]; exact hSub.1 ht₀_val + · intro ⟨i, hi⟩ + have hi0 : i = 0 := Nat.lt_one_iff.mp hi + subst hi0 + simpa using hw_per + have hredG := hRed w hxG w hxG [.inl w] hChainG + have hdiv_le := divisionCount_le_of_subset (C := bd S) hΔ (sdiff_subset : Δ' ⊆ Δ) w w + unfold chainRedundancy at hredG ⊢ + omega + · change r' ∈ G'.R at ht₀_val + change x ∈ r' at hmatch_x + change y ∈ r' at hmatch_y + have hU_sub_bd : U ⊆ bd S \ G.U := by + have h1 := isDualPointSet_subset_diff hU + intro u hu + exact ⟨(h1 hu).1, fun huU => (h1 hu).2 ⟨hProper ⟨(h1 hu).1, huU⟩, (h1 hu).1⟩⟩ + have hx_not_U : x ∉ G.U := by + rcases hx with hxU' | hxV' + · exact (hU_sub_bd (hU'_sub hxU')).2 + · exact fun _ => region_subset ht₀_val hmatch_x (G'.V_subset_U hxV'.1) + have hy_not_U : y ∉ G.U := by + rcases hy with hyU' | hyV' + · exact (hU_sub_bd (hU'_sub hyU')).2 + · exact fun _ => region_subset ht₀_val hmatch_y (G'.V_subset_U hyV'.1) + obtain ⟨r_x, hr_x, hr_x_sub, _, hxr_x_in⟩ := + exists_subregion_closure_of_mem_closure hS hProper hSub ht₀_val + (subset_closure hmatch_x) (fun _ => hx_not_U) + obtain ⟨r_y, hr_y, hr_y_sub, _, hyr_y_in⟩ := + exists_subregion_closure_of_mem_closure hS hProper hSub ht₀_val + (subset_closure hmatch_y) (fun _ => hy_not_U) + have hxr_x : x ∈ r_x := hxr_x_in hmatch_x + have hyr_y : y ∈ r_y := hyr_y_in hmatch_y + have hdiv0 := divisionCount_sdiff_eq_zero_of_subregions hS hProper hΔ hΔ_sub hv hU hRed + ht₀_val hr_x hr_y hr_x_sub hr_y_sub hxG hyG hxr_x hyr_y + have hlen0 : chainLength ([.inr r'] : List (ChainTerm S)) = 0 := rfl + unfold chainRedundancy + omega + +/-- Criterion for `IsXYChain` in terms of index-wise properties when `2 ≤ L.length`. -/ +private lemma isXYChain_of_getElem (G : Drawing S) (a b : S) (L : List (ChainTerm S)) + (hlen : 2 ≤ L.length) + (hvalid : ∀ i : Fin L.length, ChainTerm.IsValid G L[i]) + (hadj : ∀ (i : ℕ) (hi : i + 1 < L.length), + ChainTerm.AreIncident G (L[i]'(Nat.lt_of_succ_lt hi)) (L[i + 1]'hi)) + (hhead : ChainTerm.MatchesEnd a (L[0]'(by omega))) + (hlast : ChainTerm.MatchesEnd b (L[L.length - 1]'(by omega))) + (hper_zero : ChainTerm.IsPeripheral G (L[0]'(by omega))) + (hper_last : ChainTerm.IsPeripheral G (L[L.length - 1]'(by omega))) + (hper_mid : ∀ (i : ℕ) (hi : i < L.length), 0 < i → i + 1 < L.length → + ¬ ChainTerm.IsPeripheral G (L[i]'hi)) : + IsXYChain G a b L := by + have hne : L ≠ [] := List.ne_nil_of_length_pos (by omega) + refine ⟨hne, ?_, ?_, ?_, ?_, ?_⟩ + · intro t ht + obtain ⟨i, hi, rfl⟩ := List.mem_iff_getElem.mp ht + exact hvalid ⟨i, hi⟩ + · rw [List.isChain_iff_getElem] + intro i hi + exact hadj i hi + · rw [List.head_eq_getElem_zero] + exact hhead + · rw [List.getLast_eq_getElem] + exact hlast + · intro ⟨i, hi⟩ + change ChainTerm.IsPeripheral G (L[i]'hi) ↔ i = 0 ∨ i + 1 = L.length + constructor + · intro hper + by_contra hnot + have h1 : i ≠ 0 := fun h0 => hnot (Or.inl h0) + have h2 : i + 1 ≠ L.length := fun hl => hnot (Or.inr hl) + exact hper_mid i hi (Nat.pos_of_ne_zero h1) (by omega) hper + · rintro (rfl | hl) + · exact hper_zero + · have hi_eq : i = L.length - 1 := by omega + subst hi_eq + exact hper_last + +omit [TopologicalSpace S] in +private lemma chainLength_append (L₁ L₂ : List (ChainTerm S)) : + chainLength (L₁ ++ L₂) = chainLength L₁ + chainLength L₂ := by + simp [chainLength, List.filter_append] + +omit [TopologicalSpace S] in +private lemma chainLength_cons (t : ChainTerm S) (L : List (ChainTerm S)) : + chainLength (t :: L) = (if t.IsVertex then 1 else 0) + chainLength L := by + by_cases h : t.IsVertex <;> simp [chainLength, h, Nat.add_comm] + +omit [TopologicalSpace S] in +private lemma chainLength_eq_of_isVertex_eq {L₁ L₂ : List (ChainTerm S)} + (hlen : L₁.length = L₂.length) + (hisV : ∀ (i : ℕ) (hi : i < L₁.length), + ChainTerm.IsVertex (L₁[i]'hi) ↔ ChainTerm.IsVertex (L₂[i]'(hlen ▸ hi))) : + chainLength L₁ = chainLength L₂ := by + induction L₁ generalizing L₂ with + | nil => + cases L₂ with + | nil => rfl + | cons _ _ => simp at hlen + | cons a L₁ ih => + cases L₂ with + | nil => simp at hlen + | cons b L₂ => + simp only [List.length_cons, Nat.add_right_cancel_iff] at hlen + have h0 : a.IsVertex ↔ b.IsVertex := hisV 0 (Nat.zero_lt_succ _) + have hite : (if a.IsVertex then 1 else 0) = (if b.IsVertex then 1 else 0) := by + by_cases ha : a.IsVertex + · have hb : b.IsVertex := h0.mp ha + simp [ha, hb] + · have hb : ¬ b.IsVertex := fun hb => ha (h0.mpr hb) + simp [ha, hb] + have htail : chainLength L₁ = chainLength L₂ := + ih hlen (fun i hi => hisV (i + 1) (Nat.succ_lt_succ hi)) + rw [chainLength_cons, chainLength_cons, hite, htail] + +omit [TopologicalSpace S] in +private lemma chainLength_drop_antitone (L : List (ChainTerm S)) {k₁ k₂ : ℕ} (h : k₁ ≤ k₂) : + chainLength (L.drop k₂) ≤ chainLength (L.drop k₁) := by + have hd : (L.drop k₁).take (k₂ - k₁) ++ L.drop k₂ = L.drop k₁ := by + have h1 := List.take_append_drop (k₂ - k₁) (L.drop k₁) + rwa [List.drop_drop, Nat.add_sub_of_le h] at h1 + have hc := congrArg chainLength hd + rw [chainLength_append] at hc + omega + +omit [TopologicalSpace S] in +private lemma chainLength_take_add_drop_le (A : List (ChainTerm S)) + {j₁ j₂ : ℕ} (hj₁ : j₁ < A.length) (hle : j₁ ≤ j₂) + (hnotV : ¬ ChainTerm.IsVertex (A[j₁]'hj₁)) : + chainLength (A.take (j₁ + 1)) + chainLength (A.drop j₂) ≤ chainLength A := by + have hsplit : chainLength (A.take (j₁ + 1)) + chainLength (A.drop (j₁ + 1)) = chainLength A := by + rw [← chainLength_append, List.take_append_drop] + have hcons : A.drop j₁ = A[j₁] :: A.drop (j₁ + 1) := List.drop_eq_getElem_cons hj₁ + have hite0 : (if (A[j₁]'hj₁).IsVertex then 1 else 0) = 0 := by + simp [hnotV] + have hdrop_eq : chainLength (A.drop j₁) = chainLength (A.drop (j₁ + 1)) := by + rw [hcons, chainLength_cons, hite0, zero_add] + have hmono := chainLength_drop_antitone A hle + omega + +/-- Raw left-anchored lift of `A'[i]` to a chain term of `G`. -/ +private lemma exists_left_raw_term [T1Space S] (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) (v : S) + {U U' : Set S} (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) (hU'_sub : U' ⊆ U) + (hVG_ne : (G.V ∩ bd S).Nonempty) + {x y : S} (hx : x ∈ U' ∪ ((induceDrawing G (G.V \ {v})).V ∩ bd S)) + {A' : List (ChainTerm S)} (hChain : IsXYChain (induceDrawing G (G.V \ {v})) x y A') + (i : Fin A'.length) : + ∃ t : ChainTerm S, + t.IsValid G ∧ + (t.IsVertex ↔ (A'[i]).IsVertex) ∧ + (∀ w, A'[i] = .inl w ↔ t = .inl w) ∧ + (∀ r', A'[i] = .inr r' → ∃ r ∈ G.R, t = .inr r ∧ r ⊆ r') ∧ + (i.1 = 0 → t.MatchesEnd x ∧ t.IsPeripheral G) ∧ + (∀ (h0 : 0 < i.1) (w : S), + A'[i.1 - 1]'(by omega) = .inl w → ChainTerm.AreIncident G (.inl w) t) := by + let G' := induceDrawing G (G.V \ {v}) + have hSub : G'.IsSubdrawing G := induceDrawing_isSubdrawing G sdiff_subset + have hval' : (A'[i]).IsValid G' := hChain.valid A'[i] (List.getElem_mem _) + rcases hAi : A'[i] with w | r' + · rw [hAi] at hval' + change w ∈ G'.V at hval' + refine ⟨.inl w, hSub.1 hval', Iff.rfl, fun _ => Iff.rfl, ?_, ?_, ?_⟩ + · intro _ h; cases h + · intro hi0 + have hhead : A'.head hChain.ne_nil = A'[i] := by + rw [List.head_eq_getElem_zero] + congr 1 + exact hi0.symm + have hm := hChain.head_matches + rw [hhead, hAi] at hm + have hper' := (hChain.peripheral_iff i).mpr (Or.inl hi0) + rw [hAi] at hper' + exact ⟨hm, hSub.1 hper'.1, hper'.2⟩ + · intro h0 w' hw' + have hadj' := List.isChain_iff_getElem.mp hChain.isChain (i.1 - 1) (by omega) + have hidx : i.1 - 1 + 1 = i.1 := Nat.sub_add_cancel h0 + change ChainTerm.AreIncident G' (A'[i.1 - 1]'(by omega)) (A'[i.1 - 1 + 1]'(by omega)) at hadj' + simp only [hidx] at hadj' + have hAi' : A'[i.1] = .inl w := hAi + rw [hw', hAi'] at hadj' + exact False.elim hadj' + · rw [hAi] at hval' + change r' ∈ G'.R at hval' + by_cases hi0 : i.1 = 0 + · have hhead : A'.head hChain.ne_nil = A'[i] := by + rw [List.head_eq_getElem_zero] + congr 1 + exact hi0.symm + have hmx : x ∈ r' := by + have hm := hChain.head_matches + rw [hhead, hAi] at hm + exact hm + have hU_sub_bd : U ⊆ bd S \ G.U := by + have h1 := isDualPointSet_subset_diff hU + intro u hu + exact ⟨(h1 hu).1, fun huU => (h1 hu).2 ⟨hProper ⟨(h1 hu).1, huU⟩, (h1 hu).1⟩⟩ + have hx_not_U : x ∉ G.U := by + rcases hx with hxU' | hxV' + · exact (hU_sub_bd (hU'_sub hxU')).2 + · exact fun _ => region_subset hval' hmx (G'.V_subset_U hxV'.1) + have hx_bd : x ∈ bd S := by + rcases hx with hxU' | hxV' + · exact (hU_sub_bd (hU'_sub hxU')).1 + · exact hxV'.2 + obtain ⟨r, hr, hr_sub, _, hxr_in⟩ := + exists_subregion_closure_of_mem_closure hS hProper hSub hval' + (subset_closure hmx) (fun _ => hx_not_U) + have hxr : x ∈ r := hxr_in hmx + have hper_r : ChainTerm.IsPeripheral G (.inr r) := + (isPeripheral_inr_iff_inter_bd_nonempty hS hProper hVG_ne hr).mpr ⟨x, hxr, hx_bd⟩ + refine ⟨.inr r, hr, Iff.rfl, ?_, ?_, fun _ => ⟨hxr, hper_r⟩, fun h0 => by omega⟩ + · intro w; constructor <;> intro h <;> cases h + · intro r'' hr'' + cases hr'' + exact ⟨r, hr, rfl, hr_sub⟩ + · have h0 : 0 < i.1 := Nat.pos_of_ne_zero hi0 + have hadj' := List.isChain_iff_getElem.mp hChain.isChain (i.1 - 1) (by omega) + have hidx : i.1 - 1 + 1 = i.1 := Nat.sub_add_cancel h0 + change ChainTerm.AreIncident G' (A'[i.1 - 1]'(by omega)) (A'[i.1 - 1 + 1]'(by omega)) at hadj' + simp only [hidx] at hadj' + have hAi' : A'[i.1] = .inr r' := hAi + rw [hAi'] at hadj' + rcases hprev : A'[i.1 - 1]'(by omega) with w₀ | r₀ + · rw [hprev] at hadj' + rcases hadj' with ⟨hw₀_V', _, hw₀_cl⟩ + have hw₀_not_r' : w₀ ∉ r' := fun h => region_subset hval' h (G'.V_subset_U hw₀_V') + obtain ⟨r, hr, hr_sub, hw₀_clr, _⟩ := + exists_subregion_closure_of_mem_closure hS hProper hSub hval' + hw₀_cl (fun h => absurd h hw₀_not_r') + refine ⟨.inr r, hr, Iff.rfl, ?_, ?_, fun h => absurd h hi0, ?_⟩ + · intro w; constructor <;> intro h <;> cases h + · intro r'' hr'' + cases hr'' + exact ⟨r, hr, rfl, hr_sub⟩ + · intro _ w hw + rw [hprev] at hw + cases hw + exact ⟨hSub.1 hw₀_V', hr, hw₀_clr⟩ + · rw [hprev] at hadj' + exact False.elim hadj' + +/-- Raw right-anchored lift of `A'[i]` to a chain term of `G`. -/ +private lemma exists_right_raw_term [T1Space S] (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) (v : S) + {U U' : Set S} (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) (hU'_sub : U' ⊆ U) + (hVG_ne : (G.V ∩ bd S).Nonempty) + {x y : S} (hy : y ∈ U' ∪ ((induceDrawing G (G.V \ {v})).V ∩ bd S)) + {A' : List (ChainTerm S)} (hChain : IsXYChain (induceDrawing G (G.V \ {v})) x y A') + (i : Fin A'.length) : + ∃ t : ChainTerm S, + t.IsValid G ∧ + (t.IsVertex ↔ (A'[i]).IsVertex) ∧ + (∀ w, A'[i] = .inl w ↔ t = .inl w) ∧ + (∀ r', A'[i] = .inr r' → ∃ r ∈ G.R, t = .inr r ∧ r ⊆ r') ∧ + (i.1 + 1 = A'.length → t.MatchesEnd y ∧ t.IsPeripheral G) ∧ + (∀ (h1 : i.1 + 1 < A'.length) (w : S), + A'[i.1 + 1]'h1 = .inl w → ChainTerm.AreIncident G t (.inl w)) := by + let G' := induceDrawing G (G.V \ {v}) + have hSub : G'.IsSubdrawing G := induceDrawing_isSubdrawing G sdiff_subset + have hval' : (A'[i]).IsValid G' := hChain.valid A'[i] (List.getElem_mem _) + rcases hAi : A'[i] with w | r' + · rw [hAi] at hval' + change w ∈ G'.V at hval' + refine ⟨.inl w, hSub.1 hval', Iff.rfl, fun _ => Iff.rfl, ?_, ?_, ?_⟩ + · intro _ h; cases h + · intro hilast + have hlast : A'.getLast hChain.ne_nil = A'[i] := by + rw [List.getLast_eq_getElem] + congr 1 + omega + have hm := hChain.last_matches + rw [hlast, hAi] at hm + have hper' := (hChain.peripheral_iff i).mpr (Or.inr hilast) + rw [hAi] at hper' + exact ⟨hm, hSub.1 hper'.1, hper'.2⟩ + · intro h1 w' hw' + have hadj' := List.isChain_iff_getElem.mp hChain.isChain i.1 h1 + change ChainTerm.AreIncident G' (A'[i]) (A'[i.1 + 1]'h1) at hadj' + rw [hAi, hw'] at hadj' + exact False.elim hadj' + · rw [hAi] at hval' + change r' ∈ G'.R at hval' + by_cases hilast : i.1 + 1 = A'.length + · have hlast : A'.getLast hChain.ne_nil = A'[i] := by + rw [List.getLast_eq_getElem] + congr 1 + omega + have hmy : y ∈ r' := by + have hm := hChain.last_matches + rw [hlast, hAi] at hm + exact hm + have hU_sub_bd : U ⊆ bd S \ G.U := by + have h1 := isDualPointSet_subset_diff hU + intro u hu + exact ⟨(h1 hu).1, fun huU => (h1 hu).2 ⟨hProper ⟨(h1 hu).1, huU⟩, (h1 hu).1⟩⟩ + have hy_not_U : y ∉ G.U := by + rcases hy with hyU' | hyV' + · exact (hU_sub_bd (hU'_sub hyU')).2 + · exact fun _ => region_subset hval' hmy (G'.V_subset_U hyV'.1) + have hy_bd : y ∈ bd S := by + rcases hy with hyU' | hyV' + · exact (hU_sub_bd (hU'_sub hyU')).1 + · exact hyV'.2 + obtain ⟨r, hr, hr_sub, _, hyr_in⟩ := + exists_subregion_closure_of_mem_closure hS hProper hSub hval' + (subset_closure hmy) (fun _ => hy_not_U) + have hyr : y ∈ r := hyr_in hmy + have hper_r : ChainTerm.IsPeripheral G (.inr r) := + (isPeripheral_inr_iff_inter_bd_nonempty hS hProper hVG_ne hr).mpr ⟨y, hyr, hy_bd⟩ + refine ⟨.inr r, hr, Iff.rfl, ?_, ?_, fun _ => ⟨hyr, hper_r⟩, fun h1 => by omega⟩ + · intro w; constructor <;> intro h <;> cases h + · intro r'' hr'' + cases hr'' + exact ⟨r, hr, rfl, hr_sub⟩ + · have h1 : i.1 + 1 < A'.length := by omega + have hadj' := List.isChain_iff_getElem.mp hChain.isChain i.1 h1 + change ChainTerm.AreIncident G' (A'[i]) (A'[i.1 + 1]'h1) at hadj' + rw [hAi] at hadj' + rcases hnext : A'[i.1 + 1]'h1 with w₀ | r₀ + · rw [hnext] at hadj' + rcases hadj' with ⟨hw₀_V', _, hw₀_cl⟩ + have hw₀_not_r' : w₀ ∉ r' := fun h => region_subset hval' h (G'.V_subset_U hw₀_V') + obtain ⟨r, hr, hr_sub, hw₀_clr, _⟩ := + exists_subregion_closure_of_mem_closure hS hProper hSub hval' + hw₀_cl (fun h => absurd h hw₀_not_r') + refine ⟨.inr r, hr, Iff.rfl, ?_, ?_, fun h => absurd h hilast, ?_⟩ + · intro w; constructor <;> intro h <;> cases h + · intro r'' hr'' + cases hr'' + exact ⟨r, hr, rfl, hr_sub⟩ + · intro _ w hw + rw [hnext] at hw + cases hw + exact ⟨hSub.1 hw₀_V', hr, hw₀_clr⟩ + · rw [hnext] at hadj' + exact False.elim hadj' + +/-- Any lift `t` of an internal term `A'[i]` (`0 < i` and `i + 1 < A'.length`) is non-peripheral +in `G`. -/ +private lemma not_isPeripheral_of_sub_internal [T1Space S] (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) (v : S) (hVG_ne : (G.V ∩ bd S).Nonempty) + (hVG'_ne : ((induceDrawing G (G.V \ {v})).V ∩ bd S).Nonempty) + {x y : S} {A' : List (ChainTerm S)} + (hChain : IsXYChain (induceDrawing G (G.V \ {v})) x y A') + (i : Fin A'.length) (h0 : 0 < i.1) (h1 : i.1 + 1 < A'.length) + {t : ChainTerm S} + (hinl : ∀ w, A'[i] = .inl w ↔ t = .inl w) + (hinr : ∀ r', A'[i] = .inr r' → ∃ r ∈ G.R, t = .inr r ∧ r ⊆ r') : + ¬ t.IsPeripheral G := by + let G' := induceDrawing G (G.V \ {v}) + have hProper' : G'.IsProper := induceDrawing_isProper G hProper sdiff_subset + have hnot_per' : ¬ (A'[i]).IsPeripheral G' := by + rw [hChain.peripheral_iff i] + omega + have hval' : (A'[i]).IsValid G' := hChain.valid A'[i] (List.getElem_mem _) + rcases hAi : A'[i] with w | r' + · have ht : t = .inl w := (hinl w).mp hAi + rw [ht] + rw [hAi] at hnot_per' hval' + intro hper + exact hnot_per' ⟨hval', hper.2⟩ + · obtain ⟨r, hr, rfl, hr_sub⟩ := hinr r' hAi + rw [hAi] at hnot_per' hval' + change r' ∈ G'.R at hval' + intro hper + obtain ⟨z, hzr, hz_bd⟩ := + (isPeripheral_inr_iff_inter_bd_nonempty hS hProper hVG_ne hr).mp hper + exact hnot_per' ((isPeripheral_inr_iff_inter_bd_nonempty hS hProper' hVG'_ne hval').mpr + ⟨z, hr_sub hzr, hz_bd⟩) + +/-- If two lifts `t₁, t₂` of `A'[i]` differ, then `A'[i]` is not a vertex and both `t₁` and `t₂` +are incident to `.inl v` in `G`. -/ +private lemma incident_v_of_sub_ne [T1Space S] (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) {v : S} (hv_V : v ∈ G.V) + {x y : S} {A' : List (ChainTerm S)} + (hChain : IsXYChain (induceDrawing G (G.V \ {v})) x y A') + (i : Fin A'.length) {t₁ t₂ : ChainTerm S} + (hinl₁ : ∀ w, A'[i] = .inl w ↔ t₁ = .inl w) + (hinr₁ : ∀ r', A'[i] = .inr r' → ∃ r ∈ G.R, t₁ = .inr r ∧ r ⊆ r') + (hinl₂ : ∀ w, A'[i] = .inl w ↔ t₂ = .inl w) + (hinr₂ : ∀ r', A'[i] = .inr r' → ∃ r ∈ G.R, t₂ = .inr r ∧ r ⊆ r') + (hne : t₁ ≠ t₂) : + ¬ (A'[i]).IsVertex ∧ ChainTerm.AreIncident G t₁ (.inl v) ∧ + ChainTerm.AreIncident G (.inl v) t₂ := by + have hval' : (A'[i]).IsValid (induceDrawing G (G.V \ {v})) := + hChain.valid A'[i] (List.getElem_mem _) + rcases hAi : A'[i] with w | r' + · exfalso + exact hne (((hinl₁ w).mp hAi).trans ((hinl₂ w).mp hAi).symm) + · rw [hAi] at hval' + obtain ⟨r₁, hr₁, rfl, hr₁_sub⟩ := hinr₁ r' hAi + obtain ⟨r₂, hr₂, rfl, hr₂_sub⟩ := hinr₂ r' hAi + have hr_ne : r₁ ≠ r₂ := fun h => hne (congrArg Sum.inr h) + rcases subregion_eq_or_mem_closure_of_delete_vertex hS hProper v hval' + hr₁ hr₂ hr₁_sub hr₂_sub with heq | ⟨hv₁, hv₂⟩ + · exact absurd heq hr_ne + · exact ⟨not_false, ⟨hv_V, hr₁, hv₁⟩, ⟨hv_V, hr₂, hv₂⟩⟩ + +/-- Left endpoint adjustment at `i = 0` when `2 ≤ A'.length`. -/ +private lemma exists_left_endpoint_adjustment [T1Space S] (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hΔ_sub : divisionUnion Δ ⊆ G.V ∩ bd S) + {v : S} (hv : {v} ∈ Δ) + {U : Set S} (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) + (hRed : ∀ a ∈ U ∪ (G.V ∩ bd S), ∀ b ∈ U ∪ (G.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G a b A → 0 ≤ chainRedundancy G Δ a b A) + {x y : S} (hxG : x ∈ U ∪ (G.V ∩ bd S)) (hyG : y ∈ U ∪ (G.V ∩ bd S)) + {A' : List (ChainTerm S)} (hChain : IsXYChain (induceDrawing G (G.V \ {v})) x y A') + (hlen2 : 2 ≤ A'.length) + {t_L₀ t_R₀ : ChainTerm S} + (hinl_L : ∀ w, A'[0]'(by omega) = .inl w ↔ t_L₀ = .inl w) + (hinr_L : ∀ r', A'[0]'(by omega) = .inr r' → ∃ r ∈ G.R, t_L₀ = .inr r ∧ r ⊆ r') + (h0_L : t_L₀.MatchesEnd x ∧ t_L₀.IsPeripheral G) + (hinl_R : ∀ w, A'[0]'(by omega) = .inl w ↔ t_R₀ = .inl w) + (hinr_R : ∀ r', A'[0]'(by omega) = .inr r' → ∃ r ∈ G.R, t_R₀ = .inr r ∧ r ⊆ r') : + ∃ (x_eff : S) (t_L₀' : ChainTerm S), + x_eff ∈ U ∪ (G.V ∩ bd S) ∧ + divisionCount (bd S) (Δ \ {{v}}) x y ≤ divisionCount (bd S) (Δ \ {{v}}) x_eff y ∧ + (t_L₀' = t_L₀ ∨ t_L₀' = t_R₀) ∧ + t_L₀'.MatchesEnd x_eff ∧ t_L₀'.IsPeripheral G ∧ + (t_L₀' ≠ t_R₀ → ¬ t_R₀.IsPeripheral G) := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have hVG_ne : (G.V ∩ bd S).Nonempty := ⟨v, hΔ_sub ⟨{v}, hv, rfl⟩⟩ + by_cases hcase : t_R₀.IsPeripheral G ∧ t_L₀ ≠ t_R₀ + · rcases hcase with ⟨hper_R, hne⟩ + have hval' : (A'[0]'(by omega)).IsValid (induceDrawing G (G.V \ {v})) := + hChain.valid (A'[0]'(by omega)) (List.getElem_mem _) + rcases hA0 : A'[0]'(by omega) with w | r' + · exfalso + exact hne (((hinl_L w).mp hA0).trans ((hinl_R w).mp hA0).symm) + · rw [hA0] at hval' + obtain ⟨r₁, hr₁, ht_L₀, hr₁_sub⟩ := hinr_L r' hA0 + obtain ⟨r₂, hr₂, ht_R₀, hr₂_sub⟩ := hinr_R r' hA0 + have hxr₁ : x ∈ r₁ := by + have hm := h0_L.1 + rw [ht_L₀] at hm + exact hm + have hper_r₂ : ChainTerm.IsPeripheral G (.inr r₂) := ht_R₀ ▸ hper_R + have hr₂_bd : (r₂ ∩ bd S).Nonempty := + (isPeripheral_inr_iff_inter_bd_nonempty hS hProper hVG_ne hr₂).mp hper_r₂ + obtain ⟨x₀, hx₀U, hx₀r₂⟩ := + exists_mem_U_of_region_inter_bd_nonempty hS hProper hVG_ne hU hr₂ hr₂_bd + have hx₀G : x₀ ∈ U ∪ (G.V ∩ bd S) := Or.inl hx₀U + have hdiv0 := divisionCount_sdiff_eq_zero_of_subregions hS hProper hΔ hΔ_sub hv hU hRed + hval' hr₁ hr₂ hr₁_sub hr₂_sub hxG hx₀G hxr₁ hx₀r₂ + have hU_sub_bd : U ⊆ bd S \ G.U := by + have h1 := isDualPointSet_subset_diff hU + intro u hu + exact ⟨(h1 hu).1, fun huU => (h1 hu).2 ⟨hProper ⟨(h1 hu).1, huU⟩, (h1 hu).1⟩⟩ + have hx_bd : x ∈ bd S := hxG.elim (fun h => (hU_sub_bd h).1) (fun h => h.2) + have hx₀_bd : x₀ ∈ bd S := (hU_sub_bd hx₀U).1 + have hy_bd : y ∈ bd S := hyG.elim (fun h => (hU_sub_bd h).1) (fun h => h.2) + have hx₀_not : x₀ ∉ divisionUnion (Δ \ {{v}}) := fun h => + (hU_sub_bd hx₀U).2 (G.V_subset_U (hΔ_sub ((sUnion_mono sdiff_subset) h)).1) + have hΔ'_div : IsDivision (Δ \ {{v}}) := + ⟨hΔ.1.subset sdiff_subset, fun δ hδ => hΔ.2.1 δ hδ.1, hΔ.2.2.subset sdiff_subset⟩ + have hΔ'_sub_bd : divisionUnion (Δ \ {{v}}) ⊆ bd S := + (sUnion_mono sdiff_subset).trans (hΔ_sub.trans inter_subset_right) + have hle := divisionCount_le_of_left_eq_zero hS.isOArc_bd hΔ'_div hΔ'_sub_bd + hx_bd hx₀_bd hy_bd hx₀_not hdiv0 + have hm₀ : t_R₀.MatchesEnd x₀ := by + rw [ht_R₀] + exact hx₀r₂ + exact ⟨x₀, t_R₀, hx₀G, hle, Or.inr rfl, hm₀, hper_R, fun h => absurd rfl h⟩ + · refine ⟨x, t_L₀, hxG, le_rfl, Or.inl rfl, h0_L.1, h0_L.2, ?_⟩ + intro hne hper_R + exact hcase ⟨hper_R, hne⟩ + +/-- Right endpoint adjustment at `i = A'.length - 1` when `2 ≤ A'.length`. -/ +private lemma exists_right_endpoint_adjustment [T1Space S] (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hΔ_sub : divisionUnion Δ ⊆ G.V ∩ bd S) + {v : S} (hv : {v} ∈ Δ) + {U : Set S} (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) + (hRed : ∀ a ∈ U ∪ (G.V ∩ bd S), ∀ b ∈ U ∪ (G.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G a b A → 0 ≤ chainRedundancy G Δ a b A) + {x_eff y : S} (hx_effG : x_eff ∈ U ∪ (G.V ∩ bd S)) (hyG : y ∈ U ∪ (G.V ∩ bd S)) + {x : S} {A' : List (ChainTerm S)} (hChain : IsXYChain (induceDrawing G (G.V \ {v})) x y A') + (hlen2 : 2 ≤ A'.length) + {t_Ll t_Rl : ChainTerm S} + (hinl_L : ∀ w, A'[A'.length - 1]'(by omega) = .inl w ↔ t_Ll = .inl w) + (hinr_L : ∀ r', A'[A'.length - 1]'(by omega) = .inr r' → ∃ r ∈ G.R, t_Ll = .inr r ∧ r ⊆ r') + (hinl_R : ∀ w, A'[A'.length - 1]'(by omega) = .inl w ↔ t_Rl = .inl w) + (hinr_R : ∀ r', A'[A'.length - 1]'(by omega) = .inr r' → ∃ r ∈ G.R, t_Rl = .inr r ∧ r ⊆ r') + (hl_R : t_Rl.MatchesEnd y ∧ t_Rl.IsPeripheral G) : + ∃ (y_eff : S) (t_Rl' : ChainTerm S), + y_eff ∈ U ∪ (G.V ∩ bd S) ∧ + divisionCount (bd S) (Δ \ {{v}}) x_eff y ≤ divisionCount (bd S) (Δ \ {{v}}) x_eff y_eff ∧ + (t_Rl' = t_Rl ∨ t_Rl' = t_Ll) ∧ + t_Rl'.MatchesEnd y_eff ∧ t_Rl'.IsPeripheral G ∧ + (t_Ll ≠ t_Rl' → ¬ t_Ll.IsPeripheral G) := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have hVG_ne : (G.V ∩ bd S).Nonempty := ⟨v, hΔ_sub ⟨{v}, hv, rfl⟩⟩ + by_cases hcase : t_Ll.IsPeripheral G ∧ t_Ll ≠ t_Rl + · rcases hcase with ⟨hper_L, hne⟩ + have hval' : (A'[A'.length - 1]'(by omega)).IsValid (induceDrawing G (G.V \ {v})) := + hChain.valid (A'[A'.length - 1]'(by omega)) (List.getElem_mem _) + rcases hAl : A'[A'.length - 1]'(by omega) with w | r' + · exfalso + exact hne (((hinl_L w).mp hAl).trans ((hinl_R w).mp hAl).symm) + · rw [hAl] at hval' + obtain ⟨r₁, hr₁, ht_Ll, hr₁_sub⟩ := hinr_L r' hAl + obtain ⟨r₂, hr₂, ht_Rl, hr₂_sub⟩ := hinr_R r' hAl + have hyr₂ : y ∈ r₂ := by + have hm := hl_R.1 + rw [ht_Rl] at hm + exact hm + have hper_r₁ : ChainTerm.IsPeripheral G (.inr r₁) := ht_Ll ▸ hper_L + have hr₁_bd : (r₁ ∩ bd S).Nonempty := + (isPeripheral_inr_iff_inter_bd_nonempty hS hProper hVG_ne hr₁).mp hper_r₁ + obtain ⟨y₀, hy₀U, hy₀r₁⟩ := + exists_mem_U_of_region_inter_bd_nonempty hS hProper hVG_ne hU hr₁ hr₁_bd + have hy₀G : y₀ ∈ U ∪ (G.V ∩ bd S) := Or.inl hy₀U + have hdiv0 := divisionCount_sdiff_eq_zero_of_subregions hS hProper hΔ hΔ_sub hv hU hRed + hval' hr₁ hr₂ hr₁_sub hr₂_sub hy₀G hyG hy₀r₁ hyr₂ + have hU_sub_bd : U ⊆ bd S \ G.U := by + have h1 := isDualPointSet_subset_diff hU + intro u hu + exact ⟨(h1 hu).1, fun huU => (h1 hu).2 ⟨hProper ⟨(h1 hu).1, huU⟩, (h1 hu).1⟩⟩ + have hx_eff_bd : x_eff ∈ bd S := hx_effG.elim (fun h => (hU_sub_bd h).1) (fun h => h.2) + have hy₀_bd : y₀ ∈ bd S := (hU_sub_bd hy₀U).1 + have hy_bd : y ∈ bd S := hyG.elim (fun h => (hU_sub_bd h).1) (fun h => h.2) + have hy₀_not : y₀ ∉ divisionUnion (Δ \ {{v}}) := fun h => + (hU_sub_bd hy₀U).2 (G.V_subset_U (hΔ_sub ((sUnion_mono sdiff_subset) h)).1) + have hΔ'_div : IsDivision (Δ \ {{v}}) := + ⟨hΔ.1.subset sdiff_subset, fun δ hδ => hΔ.2.1 δ hδ.1, hΔ.2.2.subset sdiff_subset⟩ + have hΔ'_sub_bd : divisionUnion (Δ \ {{v}}) ⊆ bd S := + (sUnion_mono sdiff_subset).trans (hΔ_sub.trans inter_subset_right) + have hle := divisionCount_le_of_right_eq_zero hS.isOArc_bd hΔ'_div hΔ'_sub_bd + hx_eff_bd hy₀_bd hy_bd hy₀_not hdiv0 + have hm₀ : t_Ll.MatchesEnd y₀ := by + rw [ht_Ll] + exact hy₀r₁ + exact ⟨y₀, t_Ll, hy₀G, hle, Or.inr rfl, hm₀, hper_L, fun h => absurd rfl h⟩ + · refine ⟨y, t_Rl, hyG, le_rfl, Or.inl rfl, hl_R.1, hl_R.2, ?_⟩ + intro hne hper_L + exact hcase ⟨hper_L, hne⟩ + +/-- Combined per-index chain lift data for `2 ≤ A'.length`. -/ +private lemma exists_chain_lift_data [T1Space S] (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hΔ_sub : divisionUnion Δ ⊆ G.V ∩ bd S) + {v : S} (hv : {v} ∈ Δ) + {U U' : Set S} (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) (hU'_sub : U' ⊆ U) + (hVG'_ne : ((induceDrawing G (G.V \ {v})).V ∩ bd S).Nonempty) + (hRed : ∀ a ∈ U ∪ (G.V ∩ bd S), ∀ b ∈ U ∪ (G.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G a b A → 0 ≤ chainRedundancy G Δ a b A) + {x y : S} (hx : x ∈ U' ∪ ((induceDrawing G (G.V \ {v})).V ∩ bd S)) + (hy : y ∈ U' ∪ ((induceDrawing G (G.V \ {v})).V ∩ bd S)) + {A' : List (ChainTerm S)} (hChain : IsXYChain (induceDrawing G (G.V \ {v})) x y A') + (hlen2 : 2 ≤ A'.length) : + ∃ (x_eff y_eff : S) (t_L t_R : Fin A'.length → ChainTerm S), + x_eff ∈ U ∪ (G.V ∩ bd S) ∧ + y_eff ∈ U ∪ (G.V ∩ bd S) ∧ + divisionCount (bd S) (Δ \ {{v}}) x y ≤ divisionCount (bd S) (Δ \ {{v}}) x_eff y_eff ∧ + (∀ i : Fin A'.length, (t_L i).IsValid G ∧ (t_R i).IsValid G) ∧ + (∀ i : Fin A'.length, + ((t_L i).IsVertex ↔ (A'[i]).IsVertex) ∧ ((t_R i).IsVertex ↔ (A'[i]).IsVertex)) ∧ + (t_L ⟨0, by omega⟩).MatchesEnd x_eff ∧ (t_L ⟨0, by omega⟩).IsPeripheral G ∧ + (t_R ⟨A'.length - 1, by omega⟩).MatchesEnd y_eff ∧ + (t_R ⟨A'.length - 1, by omega⟩).IsPeripheral G ∧ + (∀ (i : ℕ) (hi : i + 1 < A'.length), + ChainTerm.AreIncident G (t_R ⟨i, Nat.lt_of_succ_lt hi⟩) (t_L ⟨i + 1, hi⟩)) ∧ + (∀ i : Fin A'.length, 0 < i.1 → (i.1 + 1 < A'.length ∨ t_L i ≠ t_R i) → + ¬ (t_L i).IsPeripheral G) ∧ + (∀ i : Fin A'.length, i.1 + 1 < A'.length → (0 < i.1 ∨ t_L i ≠ t_R i) → + ¬ (t_R i).IsPeripheral G) ∧ + (∀ i : Fin A'.length, t_L i ≠ t_R i → + ¬ (A'[i]).IsVertex ∧ ChainTerm.AreIncident G (t_L i) (.inl v) ∧ + ChainTerm.AreIncident G (.inl v) (t_R i)) := by + let G' := induceDrawing G (G.V \ {v}) + have hSub : G'.IsSubdrawing G := induceDrawing_isSubdrawing G sdiff_subset + have hv_bd : v ∈ G.V ∩ bd S := hΔ_sub ⟨{v}, hv, rfl⟩ + have hVG_ne : (G.V ∩ bd S).Nonempty := ⟨v, hv_bd⟩ + have hxG : x ∈ U ∪ (G.V ∩ bd S) := + hx.imp (fun h => hU'_sub h) (fun h => ⟨hSub.1 h.1, h.2⟩) + have hyG : y ∈ U ∪ (G.V ∩ bd S) := + hy.imp (fun h => hU'_sub h) (fun h => ⟨hSub.1 h.1, h.2⟩) + choose t_L_raw hL_val hL_isV hL_inl hL_inr hL_0 hL_inc using + exists_left_raw_term hS hProper v hU hU'_sub hVG_ne hx hChain + choose t_R_raw hR_val hR_isV hR_inl hR_inr hR_last hR_inc using + exists_right_raw_term hS hProper v hU hU'_sub hVG_ne hy hChain + let i₀ : Fin A'.length := ⟨0, by omega⟩ + let il : Fin A'.length := ⟨A'.length - 1, by omega⟩ + have hil_add : il.1 + 1 = A'.length := Nat.sub_add_cancel (by omega) + obtain ⟨x_eff, t_L₀', hx_effG, hdiv_x, hL₀_eq, hm_x, hper_x, hnot_per_R₀⟩ := + exists_left_endpoint_adjustment hS hProper hΔ hΔ_sub hv hU hRed hxG hyG hChain hlen2 + (hL_inl i₀) (hL_inr i₀) (hL_0 i₀ rfl) (hR_inl i₀) (hR_inr i₀) + obtain ⟨y_eff, t_Rl', hy_effG, hdiv_y, hRl_eq, hm_y, hper_y, hnot_per_Ll⟩ := + exists_right_endpoint_adjustment hS hProper hΔ hΔ_sub hv hU hRed hx_effG hyG hChain hlen2 + (hL_inl il) (hL_inr il) (hR_inl il) (hR_inr il) (hR_last il hil_add) + let t_L : Fin A'.length → ChainTerm S := fun i => if i = i₀ then t_L₀' else t_L_raw i + let t_R : Fin A'.length → ChainTerm S := fun i => if i = il then t_Rl' else t_R_raw i + have ht_L_cases : ∀ i, t_L i = t_L_raw i ∨ t_L i = t_R_raw i := by + intro i + dsimp [t_L] + split_ifs with h + · subst h; exact hL₀_eq + · exact Or.inl rfl + have ht_R_cases : ∀ i, t_R i = t_R_raw i ∨ t_R i = t_L_raw i := by + intro i + dsimp [t_R] + split_ifs with h + · subst h; exact hRl_eq + · exact Or.inl rfl + have ht_L_inl : ∀ i w, A'[i] = .inl w ↔ t_L i = .inl w := by + intro i w + rcases ht_L_cases i with h | h <;> rw [h] + · exact hL_inl i w + · exact hR_inl i w + have ht_R_inl : ∀ i w, A'[i] = .inl w ↔ t_R i = .inl w := by + intro i w + rcases ht_R_cases i with h | h <;> rw [h] + · exact hR_inl i w + · exact hL_inl i w + have ht_L_inr : ∀ i r', A'[i] = .inr r' → ∃ r ∈ G.R, t_L i = .inr r ∧ r ⊆ r' := by + intro i r' hr' + rcases ht_L_cases i with h | h <;> rw [h] + · exact hL_inr i r' hr' + · exact hR_inr i r' hr' + have ht_R_inr : ∀ i r', A'[i] = .inr r' → ∃ r ∈ G.R, t_R i = .inr r ∧ r ⊆ r' := by + intro i r' hr' + rcases ht_R_cases i with h | h <;> rw [h] + · exact hR_inr i r' hr' + · exact hL_inr i r' hr' + refine ⟨x_eff, y_eff, t_L, t_R, hx_effG, hy_effG, hdiv_x.trans hdiv_y, ?_, ?_, ?_, ?_, ?_, ?_, + ?_, ?_, ?_, ?_⟩ + · intro i + constructor + · rcases ht_L_cases i with h | h <;> rw [h] + · exact hL_val i + · exact hR_val i + · rcases ht_R_cases i with h | h <;> rw [h] + · exact hR_val i + · exact hL_val i + · intro i + constructor + · rcases ht_L_cases i with h | h <;> rw [h] + · exact hL_isV i + · exact hR_isV i + · rcases ht_R_cases i with h | h <;> rw [h] + · exact hR_isV i + · exact hL_isV i + · simp [t_L, i₀, hm_x] + · simp [t_L, i₀, hper_x] + · simp [t_R, il, hm_y] + · simp [t_R, il, hper_y] + · intro i hi + have hne_il : (⟨i, Nat.lt_of_succ_lt hi⟩ : Fin A'.length) ≠ il := by + intro h + have := congrArg Fin.val h + dsimp [il] at this + omega + have hne_i₀ : (⟨i + 1, hi⟩ : Fin A'.length) ≠ i₀ := by + intro h + have := congrArg Fin.val h + dsimp [i₀] at this + omega + have hR_eq : t_R ⟨i, Nat.lt_of_succ_lt hi⟩ = t_R_raw ⟨i, Nat.lt_of_succ_lt hi⟩ := by + simp [t_R, hne_il] + have hL_eq : t_L ⟨i + 1, hi⟩ = t_L_raw ⟨i + 1, hi⟩ := by + simp [t_L, hne_i₀] + rw [hR_eq, hL_eq] + have hadj' := List.isChain_iff_getElem.mp hChain.isChain i hi + rcases hAi : A'[i]'(Nat.lt_of_succ_lt hi) with w | r' + · have hR_w : t_R_raw ⟨i, Nat.lt_of_succ_lt hi⟩ = .inl w := + (hR_inl ⟨i, Nat.lt_of_succ_lt hi⟩ w).mp hAi + rw [hR_w] + exact hL_inc ⟨i + 1, hi⟩ (Nat.zero_lt_succ i) w hAi + · rcases hAi1 : A'[i + 1]'hi with w₁ | r₁' + · have hL_w₁ : t_L_raw ⟨i + 1, hi⟩ = .inl w₁ := + (hL_inl ⟨i + 1, hi⟩ w₁).mp hAi1 + rw [hL_w₁] + exact hR_inc ⟨i, Nat.lt_of_succ_lt hi⟩ hi w₁ hAi1 + · rw [hAi, hAi1] at hadj' + exact False.elim hadj' + · intro i h0 hcond + have hne_i₀ : i ≠ i₀ := by + intro h + have := congrArg Fin.val h + dsimp [i₀] at this + omega + have hL_eq : t_L i = t_L_raw i := by simp [t_L, hne_i₀] + rcases hcond with h1 | hne + · exact not_isPeripheral_of_sub_internal hS hProper v hVG_ne hVG'_ne hChain i h0 h1 + (ht_L_inl i) (ht_L_inr i) + · by_cases h1 : i.1 + 1 < A'.length + · exact not_isPeripheral_of_sub_internal hS hProper v hVG_ne hVG'_ne hChain i h0 h1 + (ht_L_inl i) (ht_L_inr i) + · have hil_eq : i = il := Fin.ext (by dsimp [il]; omega) + subst hil_eq + rw [hL_eq] at hne ⊢ + have hR_il : t_R il = t_Rl' := by simp [t_R] + rw [hR_il] at hne + exact hnot_per_Ll hne + · intro i h1 hcond + have hne_il : i ≠ il := by + intro h + have := congrArg Fin.val h + dsimp [il] at this + omega + have hR_eq : t_R i = t_R_raw i := by simp [t_R, hne_il] + rcases hcond with h0 | hne + · exact not_isPeripheral_of_sub_internal hS hProper v hVG_ne hVG'_ne hChain i h0 h1 + (ht_R_inl i) (ht_R_inr i) + · by_cases h0 : 0 < i.1 + · exact not_isPeripheral_of_sub_internal hS hProper v hVG_ne hVG'_ne hChain i h0 h1 + (ht_R_inl i) (ht_R_inr i) + · have hi₀_eq : i = i₀ := Fin.ext (by dsimp [i₀]; omega) + subst hi₀_eq + rw [hR_eq] at hne ⊢ + have hL_i₀ : t_L i₀ = t_L₀' := by simp [t_L] + rw [hL_i₀] at hne + exact hnot_per_R₀ hne + · intro i hne + exact incident_v_of_sub_ne hS hProper hv_bd.1 hChain i + (ht_L_inl i) (ht_L_inr i) (ht_R_inl i) (ht_R_inr i) hne + +omit [TopologicalSpace S] in +private theorem first_last_chain_mismatch {n : ℕ} {t_L t_R : Fin n → ChainTerm S} + (h_ex_ne : ∃ i, t_L i ≠ t_R i) : + ∃ j₁ j₂ : Fin n, t_L j₁ ≠ t_R j₁ ∧ t_L j₂ ≠ t_R j₂ ∧ j₁.1 ≤ j₂.1 ∧ + (∀ i : Fin n, i.1 < j₁.1 → t_L i = t_R i) ∧ + (∀ i : Fin n, j₂.1 < i.1 → t_L i = t_R i) := by + classical + let S_mis : Finset (Fin n) := Finset.univ.filter (fun i => t_L i ≠ t_R i) + have hS_ne : S_mis.Nonempty := by + obtain ⟨i, hi⟩ := h_ex_ne + exact ⟨i, Finset.mem_filter.mpr ⟨Finset.mem_univ i, hi⟩⟩ + let j₁ : Fin n := S_mis.min' hS_ne + let j₂ : Fin n := S_mis.max' hS_ne + have hj₁_ne : t_L j₁ ≠ t_R j₁ := (Finset.mem_filter.mp (Finset.min'_mem S_mis hS_ne)).2 + have hj₂_ne : t_L j₂ ≠ t_R j₂ := (Finset.mem_filter.mp (Finset.max'_mem S_mis hS_ne)).2 + have hj_le : j₁.1 ≤ j₂.1 := Finset.min'_le S_mis j₂ (Finset.max'_mem S_mis hS_ne) + have hj₁_min : ∀ i : Fin n, i.1 < j₁.1 → t_L i = t_R i := by + intro i hi + by_contra hne + have hmem : i ∈ S_mis := Finset.mem_filter.mpr ⟨Finset.mem_univ i, hne⟩ + have hle : j₁.1 ≤ i.1 := Finset.min'_le S_mis i hmem + omega + have hj₂_max : ∀ i : Fin n, j₂.1 < i.1 → t_L i = t_R i := by + intro i hi + by_contra hne + have hmem : i ∈ S_mis := Finset.mem_filter.mpr ⟨Finset.mem_univ i, hne⟩ + have hle : i.1 ≤ j₂.1 := Finset.le_max' S_mis i hmem + omega + exact ⟨j₁, j₂, hj₁_ne, hj₂_ne, hj_le, hj₁_min, hj₂_max⟩ + +private theorem divisionCount_sdiff_singleton_le_add + (hS : IsClosedDiscSpace S) {G : Drawing S} {Δ : Set (Set S)} {U : Set S} + (hΔ : IsDivision Δ) (hΔ_sub : divisionUnion Δ ⊆ G.V ∩ bd S) + (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) {v x y : S} (hv : {v} ∈ Δ) + (hv_bd : v ∈ bd S) (hx : x ∈ U ∪ (G.V ∩ bd S)) (hy : y ∈ U ∪ (G.V ∩ bd S)) : + divisionCount (bd S) (Δ \ {{v}}) x y ≤ + divisionCount (bd S) (Δ \ {{v}}) x v + divisionCount (bd S) (Δ \ {{v}}) v y := by + have hx_bd : x ∈ bd S := hx.elim (fun h => (isDualPointSet_subset_diff hU h).1) And.right + have hy_bd : y ∈ bd S := hy.elim (fun h => (isDualPointSet_subset_diff hU h).1) And.right + have hΔ'_div : IsDivision (Δ \ {{v}}) := + ⟨hΔ.1.subset sdiff_subset, fun δ hδ => hΔ.2.1 δ hδ.1, hΔ.2.2.subset sdiff_subset⟩ + have hΔ'_sub_bd : divisionUnion (Δ \ {{v}}) ⊆ bd S := + (sUnion_mono sdiff_subset).trans (hΔ_sub.trans inter_subset_right) + have hv_not_Δ' : v ∉ divisionUnion (Δ \ {{v}}) := by + rintro ⟨δ, ⟨hδ, hne⟩, hvδ⟩ + exact (hΔ.2.2 hδ hv hne).ne_of_mem hvδ rfl rfl + exact divisionCount_le_add_of_not_mem hS.isOArc_bd hΔ'_div hΔ'_sub_bd + hx_bd hv_bd hy_bd hv_not_Δ' + +/-- Case `2 ≤ A'.length` of singleton deletion: if `A'` is an `(x, y)`-chain of +`G' = induceDrawing G (G.V \ {v})` with `2 ≤ A'.length`, then +`0 ≤ chainRedundancy G' (Δ \ {{v}}) x y A'`. -/ +theorem chainRedundancy_nonneg_of_length_ge_two [T1Space S] (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hΔ_sub : divisionUnion Δ ⊆ G.V ∩ bd S) + {v : S} (hv : {v} ∈ Δ) + {U U' : Set S} (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) (hU'_sub : U' ⊆ U) + (hVG'_ne : ((induceDrawing G (G.V \ {v})).V ∩ bd S).Nonempty) + (hRed : ∀ a ∈ U ∪ (G.V ∩ bd S), ∀ b ∈ U ∪ (G.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G a b A → 0 ≤ chainRedundancy G Δ a b A) + {x y : S} (hx : x ∈ U' ∪ ((induceDrawing G (G.V \ {v})).V ∩ bd S)) + (hy : y ∈ U' ∪ ((induceDrawing G (G.V \ {v})).V ∩ bd S)) + {A' : List (ChainTerm S)} (hChain : IsXYChain (induceDrawing G (G.V \ {v})) x y A') + (hlen2 : 2 ≤ A'.length) : + 0 ≤ chainRedundancy (induceDrawing G (G.V \ {v})) (Δ \ {{v}}) x y A' := by + classical + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have hv_bd : v ∈ G.V ∩ bd S := hΔ_sub ⟨{v}, hv, rfl⟩ + obtain ⟨x_eff, y_eff, t_L, t_R, hx_effG, hy_effG, hdiv_xy, hval, hisV, + hm_x, hper_x, hm_y, hper_y, hadj, hnot_per_L, hnot_per_R, hmis⟩ := + exists_chain_lift_data hS hProper hΔ hΔ_sub hv hU hU'_sub hVG'_ne hRed hx hy hChain hlen2 + by_cases h_all_eq : ∀ i : Fin A'.length, t_L i = t_R i + · let L := List.ofFn t_L + have hL_len : L.length = A'.length := List.length_ofFn + have hChainL : IsXYChain G x_eff y_eff L := by + refine isXYChain_of_getElem G x_eff y_eff L (by omega) ?_ ?_ ?_ ?_ ?_ ?_ ?_ + · intro ⟨i, hi⟩ + change ChainTerm.IsValid G (L[i]'hi) + simp only [L, List.getElem_ofFn] + exact (hval ⟨i, hL_len ▸ hi⟩).1 + · intro i hi + simp only [L, List.getElem_ofFn] + have hi' : i + 1 < A'.length := hL_len ▸ hi + rw [h_all_eq ⟨i, Nat.lt_of_succ_lt hi'⟩] + exact hadj i hi' + · simp only [L, List.getElem_ofFn]; exact hm_x + · simp only [L, List.getElem_ofFn, hL_len] + rw [h_all_eq ⟨A'.length - 1, by omega⟩] + exact hm_y + · simp only [L, List.getElem_ofFn]; exact hper_x + · simp only [L, List.getElem_ofFn, hL_len] + rw [h_all_eq ⟨A'.length - 1, by omega⟩] + exact hper_y + · intro i hi h0 h1 + simp only [L, List.getElem_ofFn] + exact hnot_per_L ⟨i, hL_len ▸ hi⟩ h0 (Or.inl (by dsimp; omega)) + have hlen_eq : chainLength L = chainLength A' := by + refine chainLength_eq_of_isVertex_eq hL_len fun i hi => ?_ + simp only [L, List.getElem_ofFn] + exact (hisV ⟨i, hL_len ▸ hi⟩).1 + have hredL := hRed x_eff hx_effG y_eff hy_effG L hChainL + have hdiv_sub := divisionCount_le_of_subset (C := bd S) hΔ + (sdiff_subset : Δ \ {{v}} ⊆ Δ) x_eff y_eff + unfold chainRedundancy at hredL ⊢ + omega + · have h_ex_ne : ∃ i : Fin A'.length, t_L i ≠ t_R i := by + by_contra h + exact h_all_eq fun i => not_not.mp fun hi => h ⟨i, hi⟩ + obtain ⟨j₁, j₂, hj₁_ne, hj₂_ne, hj_le, hj₁_min, hj₂_max⟩ := + first_last_chain_mismatch h_ex_ne + have hj₁_lt : j₁.1 < A'.length := j₁.2 + have hj₂_lt : j₂.1 < A'.length := j₂.2 + let L_list := List.ofFn t_L + let R_list := List.ofFn t_R + let P := L_list.take (j₁.1 + 1) ++ [.inl v] + let Q := (.inl v) :: R_list.drop j₂.1 + have hL_take_len : (L_list.take (j₁.1 + 1)).length = j₁.1 + 1 := by + simp [L_list] + have hP_len : P.length = j₁.1 + 2 := by + simp [P, hL_take_len] + have hP_get_lt : ∀ (k : ℕ) (hk : k < j₁.1 + 1), + P[k]'(by omega) = t_L ⟨k, by omega⟩ := by + intro k hk + have hk' : k < (L_list.take (j₁.1 + 1)).length := by omega + rw [List.getElem_append_left hk', List.getElem_take, List.getElem_ofFn] + have hP_get_last : P[j₁.1 + 1]'(by omega) = .inl v := by + have hk' : (L_list.take (j₁.1 + 1)).length ≤ j₁.1 + 1 := by omega + rw [List.getElem_append_right hk'] + simp [hL_take_len] + have hR_drop_len : (R_list.drop j₂.1).length = A'.length - j₂.1 := by + simp [R_list] + have hQ_len : Q.length = A'.length - j₂.1 + 1 := by + simp [Q, hR_drop_len] + have hQ_get_zero : Q[0]'(by omega) = .inl v := rfl + have hQ_get_succ : ∀ (k : ℕ) (hk0 : 0 < k) (hk : k < Q.length), + Q[k]'hk = t_R ⟨j₂.1 + (k - 1), by omega⟩ := by + intro k hk0 hk + rcases Nat.exists_eq_succ_of_ne_zero (Nat.ne_of_gt hk0) with ⟨m, rfl⟩ + simp [Q, R_list] + have hChainP : IsXYChain G x_eff v P := by + refine isXYChain_of_getElem G x_eff v P (by omega) ?_ ?_ ?_ ?_ ?_ ?_ ?_ + · intro ⟨k, hk⟩ + by_cases hk_lt : k < j₁.1 + 1 + · change ChainTerm.IsValid G (P[k]'hk) + rw [hP_get_lt k hk_lt] + exact (hval ⟨k, by omega⟩).1 + · have hk_eq : k = j₁.1 + 1 := by omega + subst hk_eq + change ChainTerm.IsValid G (P[j₁.1 + 1]'hk) + rw [hP_get_last] + exact hv_bd.1 + · intro k hk + by_cases hk_lt : k < j₁.1 + · rw [hP_get_lt k (by omega), hP_get_lt (k + 1) (by omega)] + have heq := hj₁_min ⟨k, by omega⟩ hk_lt + rw [heq] + exact hadj k (by omega) + · have hk_eq : k = j₁.1 := by omega + subst hk_eq + rw [hP_get_lt j₁.1 (by omega), hP_get_last] + exact (hmis j₁ hj₁_ne).2.1 + · rw [hP_get_lt 0 (by omega)]; exact hm_x + · have hlast_idx : P.length - 1 = j₁.1 + 1 := by omega + simp only [hlast_idx, hP_get_last] + rfl + · rw [hP_get_lt 0 (by omega)]; exact hper_x + · have hlast_idx : P.length - 1 = j₁.1 + 1 := by omega + simp only [hlast_idx, hP_get_last] + exact hv_bd + · intro k hk hk0 hk1 + have hk_lt : k < j₁.1 + 1 := by omega + rw [hP_get_lt k hk_lt] + by_cases hk_eq : k = j₁.1 + · subst hk_eq + exact hnot_per_L j₁ hk0 (Or.inr hj₁_ne) + · exact hnot_per_L ⟨k, by omega⟩ hk0 (Or.inl (by dsimp; omega)) + have hChainQ : IsXYChain G v y_eff Q := by + refine isXYChain_of_getElem G v y_eff Q (by omega) ?_ ?_ ?_ ?_ ?_ ?_ ?_ + · intro ⟨k, hk⟩ + by_cases hk0 : k = 0 + · subst hk0 + change ChainTerm.IsValid G (Q[0]'hk) + rw [hQ_get_zero] + exact hv_bd.1 + · change ChainTerm.IsValid G (Q[k]'hk) + rw [hQ_get_succ k (Nat.pos_of_ne_zero hk0) hk] + exact (hval ⟨j₂.1 + (k - 1), by omega⟩).2 + · intro k hk + by_cases hk0 : k = 0 + · subst hk0 + rw [hQ_get_zero, hQ_get_succ 1 Nat.zero_lt_one hk] + simpa using (hmis j₂ hj₂_ne).2.2 + · have hk_pos : 0 < k := Nat.pos_of_ne_zero hk0 + rw [hQ_get_succ k hk_pos (Nat.lt_of_succ_lt hk), + hQ_get_succ (k + 1) (Nat.zero_lt_succ k) hk] + have hidx_next : j₂.1 + (k + 1 - 1) = j₂.1 + (k - 1) + 1 := by omega + have hgt : j₂.1 < j₂.1 + (k - 1) + 1 := by omega + have heq := hj₂_max ⟨j₂.1 + (k - 1) + 1, by omega⟩ hgt + have hfin_eq : (⟨j₂.1 + (k + 1 - 1), by omega⟩ : Fin A'.length) = + ⟨j₂.1 + (k - 1) + 1, by omega⟩ := Fin.ext hidx_next + rw [hfin_eq, ← heq] + exact hadj (j₂.1 + (k - 1)) (by omega) + · rw [hQ_get_zero]; rfl + · rw [hQ_get_succ (Q.length - 1) (by omega) (by omega)] + have hfin_eq : (⟨j₂.1 + (Q.length - 1 - 1), by omega⟩ : Fin A'.length) = + ⟨A'.length - 1, by omega⟩ := Fin.ext (by dsimp; omega) + rw [hfin_eq] + exact hm_y + · rw [hQ_get_zero]; exact hv_bd + · rw [hQ_get_succ (Q.length - 1) (by omega) (by omega)] + have hfin_eq : (⟨j₂.1 + (Q.length - 1 - 1), by omega⟩ : Fin A'.length) = + ⟨A'.length - 1, by omega⟩ := Fin.ext (by dsimp; omega) + rw [hfin_eq] + exact hper_y + · intro k hk hk0 hk1 + rw [hQ_get_succ k hk0 hk] + by_cases hk1_eq : k = 1 + · subst hk1_eq + have hfin_eq : (⟨j₂.1 + (1 - 1), by omega⟩ : Fin A'.length) = j₂ := + Fin.ext (by dsimp) + rw [hfin_eq] + exact hnot_per_R j₂ (by omega) (Or.inr hj₂_ne) + · exact hnot_per_R ⟨j₂.1 + (k - 1), by omega⟩ (by dsimp; omega) (Or.inl (by dsimp; omega)) + have hP_chainLen : chainLength P = chainLength (A'.take (j₁.1 + 1)) + 1 := by + have h1 : chainLength P = chainLength (L_list.take (j₁.1 + 1)) + 1 := by + rw [chainLength_append] + rfl + have h2 : chainLength (L_list.take (j₁.1 + 1)) = chainLength (A'.take (j₁.1 + 1)) := by + have hlen_eq : (L_list.take (j₁.1 + 1)).length = (A'.take (j₁.1 + 1)).length := by + simp [L_list] + refine chainLength_eq_of_isVertex_eq hlen_eq fun k hk => ?_ + rw [List.getElem_take, List.getElem_take, List.getElem_ofFn] + exact (hisV ⟨k, by omega⟩).1 + omega + have hQ_chainLen : chainLength Q = 1 + chainLength (A'.drop j₂.1) := by + have h1 : chainLength Q = 1 + chainLength (R_list.drop j₂.1) := by + rw [chainLength_cons] + rfl + have h2 : chainLength (R_list.drop j₂.1) = chainLength (A'.drop j₂.1) := by + have hlen_eq : (R_list.drop j₂.1).length = (A'.drop j₂.1).length := by + simp [R_list] + refine chainLength_eq_of_isVertex_eq hlen_eq fun k hk => ?_ + rw [List.getElem_drop, List.getElem_drop, List.getElem_ofFn] + exact (hisV ⟨j₂.1 + k, by omega⟩).2 + omega + have hsum_le : chainLength P + chainLength Q ≤ chainLength A' + 2 := by + have htake_drop := chainLength_take_add_drop_le A' j₁.2 hj_le (hmis j₁ hj₁_ne).1 + omega + have hredP := hRed x_eff hx_effG v (Or.inr hv_bd) P hChainP + have hredQ := hRed v (Or.inr hv_bd) y_eff hy_effG Q hChainQ + have htri := divisionCount_sdiff_singleton_le_add hS hΔ hΔ_sub hU hv hv_bd.2 hx_effG hy_effG + have hsdiff_L := divisionCount_sdiff_singleton_right (bd S) hΔ hv x_eff + have hsdiff_R := divisionCount_sdiff_singleton_left (bd S) hΔ hv y_eff + unfold chainRedundancy at hredP hredQ ⊢ + omega + +/-- Combined chain redundancy preservation under deleting a singleton `{v} ∈ Δ`: +every `(x, y)`-chain `A'` of `G' = induceDrawing G (G.V \ {v})` has +`0 ≤ chainRedundancy G' (Δ \ {{v}}) x y A'`. -/ +theorem chainRedundancy_nonneg_of_delete_singleton [T1Space S] (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hΔ_sub : divisionUnion Δ ⊆ G.V ∩ bd S) + {v : S} (hv : {v} ∈ Δ) + {U U' : Set S} (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) (hU'_sub : U' ⊆ U) + (hU'_dual : IsDualPointSet (bd S) ((induceDrawing G (G.V \ {v})).V ∩ bd S) U') + (hRed : ∀ a ∈ U ∪ (G.V ∩ bd S), ∀ b ∈ U ∪ (G.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G a b A → 0 ≤ chainRedundancy G Δ a b A) + {x y : S} (hx : x ∈ U' ∪ ((induceDrawing G (G.V \ {v})).V ∩ bd S)) + (hy : y ∈ U' ∪ ((induceDrawing G (G.V \ {v})).V ∩ bd S)) + {A' : List (ChainTerm S)} (hChain : IsXYChain (induceDrawing G (G.V \ {v})) x y A') : + 0 ≤ chainRedundancy (induceDrawing G (G.V \ {v})) (Δ \ {{v}}) x y A' := by + have hVG'_ne : ((induceDrawing G (G.V \ {v})).V ∩ bd S).Nonempty := by + by_contra hemp + rw [not_nonempty_iff_eq_empty] at hemp + have hU'_emp : U' = ∅ := hU'_dual.1 hemp + rw [hU'_emp, hemp, union_empty] at hx + exact hx + have hpos : 0 < A'.length := List.length_pos_of_ne_nil hChain.ne_nil + by_cases hlen1 : A'.length = 1 + · exact chainRedundancy_nonneg_of_length_one hS hProper hΔ hΔ_sub hv hU hU'_sub hRed + hx hy hChain hlen1 + · exact chainRedundancy_nonneg_of_length_ge_two hS hProper hΔ hΔ_sub hv hU hU'_sub hVG'_ne hRed + hx hy hChain (by omega) + +/-- **Case (3.3)(i) Singleton Reduction** (Graph Minors VI, page 122, Case 1): +If `{v} ∈ Δ`, then `G' = induceDrawing G (G.V \ {v})` and `Δ' = Δ \ {{v}}` satisfy: +- `G'.IsProper` and `G'.V.ncard + G'.R.ncard < G.V.ncard + G.R.ncard` +- `IsDivision Δ'` and `divisionUnion Δ' = G'.V ∩ bd S` (when `divisionUnion Δ = G.V ∩ bd S`) +- there exists a dual point set `U' ⊆ U` for `(bd S, G'.V ∩ bd S)` such that every chain of `G'` + has non-negative redundancy with respect to `Δ'` +- `IsFeasible G'.toGraph Δ' → IsFeasible G.toGraph Δ`. -/ +theorem exists_reduction_of_singleton_mem [T1Space S] (hS : IsClosedDiscSpace S) + {G : Drawing S} (hProper : G.IsProper) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hΔ_eq : divisionUnion Δ = G.V ∩ bd S) + {v : S} (hv : {v} ∈ Δ) + {U : Set S} (hU : IsDualPointSet (bd S) (G.V ∩ bd S) U) + (hRed : ∀ a ∈ U ∪ (G.V ∩ bd S), ∀ b ∈ U ∪ (G.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G a b A → 0 ≤ chainRedundancy G Δ a b A) : + let G' := induceDrawing G (G.V \ {v}) + let Δ' := Δ \ {{v}} + G'.IsProper ∧ G'.IsSubdrawing G ∧ + G'.V.ncard + G'.R.ncard < G.V.ncard + G.R.ncard ∧ + IsDivision Δ' ∧ divisionUnion Δ' = G'.V ∩ bd S ∧ + (∃ U' ⊆ U, IsDualPointSet (bd S) (G'.V ∩ bd S) U' ∧ + ∀ x ∈ U' ∪ (G'.V ∩ bd S), ∀ y ∈ U' ∪ (G'.V ∩ bd S), + ∀ A' : List (ChainTerm S), IsXYChain G' x y A' → 0 ≤ chainRedundancy G' Δ' x y A') ∧ + (IsFeasible G'.toGraph Δ' → IsFeasible G.toGraph Δ) := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + let G' := induceDrawing G (G.V \ {v}) + let Δ' := Δ \ {{v}} + change G'.IsProper ∧ G'.IsSubdrawing G ∧ + G'.V.ncard + G'.R.ncard < G.V.ncard + G.R.ncard ∧ + IsDivision Δ' ∧ divisionUnion Δ' = G'.V ∩ bd S ∧ + (∃ U' ⊆ U, IsDualPointSet (bd S) (G'.V ∩ bd S) U' ∧ + ∀ x ∈ U' ∪ (G'.V ∩ bd S), ∀ y ∈ U' ∪ (G'.V ∩ bd S), + ∀ A' : List (ChainTerm S), IsXYChain G' x y A' → 0 ≤ chainRedundancy G' Δ' x y A') ∧ + (IsFeasible G'.toGraph Δ' → IsFeasible G.toGraph Δ) + have hProper' : G'.IsProper := induceDrawing_isProper G hProper sdiff_subset + have hSub' : G'.IsSubdrawing G := induceDrawing_isSubdrawing G sdiff_subset + have hG'_V : G'.V = G.V \ {v} := induceDrawing_V G sdiff_subset + have hΔ_sub : divisionUnion Δ ⊆ G.V ∩ bd S := hΔ_eq.subset + have hv_bd : v ∈ G.V ∩ bd S := hΔ_sub ⟨{v}, hv, rfl⟩ + have hV_lt : G'.V.ncard < G.V.ncard := by + rw [hG'_V] + exact ncard_lt_ncard ⟨sdiff_subset, fun h => (h hv_bd.1).2 rfl⟩ G.finite_V + have hR_le : G'.R.ncard ≤ G.R.ncard := + disc_region_ncard_le_of_isSubdrawing hS hProper hSub' + have hΔ'_div : IsDivision Δ' := + ⟨hΔ.1.subset sdiff_subset, fun δ hδ => hΔ.2.1 δ hδ.1, hΔ.2.2.subset sdiff_subset⟩ + have hΔ'_eq : divisionUnion Δ' = G'.V ∩ bd S := by + rw [hG'_V] + ext x + simp only [divisionUnion, mem_sUnion, mem_inter_iff, mem_sdiff, mem_singleton_iff] + constructor + · rintro ⟨δ, ⟨hδ, hne⟩, hxδ⟩ + have hx_bd : x ∈ G.V ∩ bd S := hΔ_sub ⟨δ, hδ, hxδ⟩ + refine ⟨⟨hx_bd.1, ?_⟩, hx_bd.2⟩ + rintro rfl + exact (hΔ.2.2 hδ hv hne).ne_of_mem hxδ rfl rfl + · rintro ⟨⟨hxV, hxv⟩, hx_bd⟩ + have hx_union : x ∈ divisionUnion Δ := hΔ_eq.symm ▸ ⟨hxV, hx_bd⟩ + obtain ⟨δ, hδ, hxδ⟩ := hx_union + refine ⟨δ, ⟨hδ, ?_⟩, hxδ⟩ + rintro rfl + exact hxv hxδ + have hV'_bd_sub : G'.V ∩ bd S ⊆ G.V ∩ bd S := inter_subset_inter_left _ hSub'.1 + obtain ⟨U', hU'_sub, hU'_dual, _⟩ := exists_dualPointSet_subset_of_subset + hS.isOArc_bd inter_subset_right (G.finite_V.inter_of_left _) hU hV'_bd_sub + refine ⟨hProper', hSub', by omega, hΔ'_div, hΔ'_eq, + ⟨U', hU'_sub, hU'_dual, fun x hx y hy A' hChain => + chainRedundancy_nonneg_of_delete_singleton hS hProper hΔ hΔ_sub hv hU hU'_sub hU'_dual hRed + hx hy hChain⟩, ?_⟩ + intro hFeas' + have htoGraph : G'.toGraph = G.toGraph.deleteVerts {v} := + induceDrawing_toGraph_deleteVerts G {v} + rw [htoGraph] at hFeas' + exact (theorem_3_3_i G.toGraph Δ v hΔ (hΔ_sub.trans inter_subset_left) hv).mpr hFeas' + +end GraphMinor.GM06 diff --git a/LeanPool/GraphMinor/GM06/Section3Main.lean b/LeanPool/GraphMinor/GM06/Section3Main.lean new file mode 100644 index 0000000000..0447eb4ef8 --- /dev/null +++ b/LeanPool/GraphMinor/GM06/Section3Main.lean @@ -0,0 +1,1048 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.Section3Dual +import LeanPool.GraphMinor.GM06.Section3InduceSingleton +import LeanPool.GraphMinor.GM06.RegionCurve +import LeanPool.GraphMinor.GM12.Section3DiscChainCarrier +import LeanPool.GraphMinor.Surface.JordanDomain +import Mathlib.Analysis.Convex.PathConnected + +/-! +# Graph Minors VI, Section 3: Separating Sets of Chains and Proof of Theorem (3.6) + +This file proves the topological results of Graph Minors VI, Section 3 (pages 119–122): +- `exists_separatingSet_of_isXYChain`: every $(x, y)$-chain $A$ in a proper drawing $G$ on a closed + disc space $S$ gives a compact connected separating set $F \subseteq S$ from $x$ to $y$ meeting + $U(G)$ only at the vertex terms of $A$. +- `isCrossFree_of_isFeasible` and `chainRedundancy_nonneg_of_isFeasible`: necessity of conditions + (i) and (ii) of (3.6), proved with zero unproved hypotheses using `disc_crossing` and + `exists_region_curve`. +- `isFeasible_of_isCrossFree_of_chainRedundancy_nonneg` and + `isFeasible_iff_of_exists_isDiscDualDrawing`: the full sufficiency induction of (3.6) on + $|V(G)| + |R(G)|$ via the five cases of the paper (pages 121–122). +- `region_inter_segmentsOf_subsingleton`, `exists_dual_vertices_of_connected`, and + `exists_isDiscDualDrawing_of_edges_empty`: boundary segment uniqueness, dual vertex placement, + and the edgeless base case for disc dual drawings. +-/ + +public section + +namespace GraphMinor.GM06 + +open Set Function Topology Graph GraphMinor.Surface GraphMinor.GM11 + +universe u + +/-! ## 1. Separating Sets of $(x, y)$-Chains and Necessity in (3.6) -/ + +/-- Every $(x, y)$-chain $A$ in a proper drawing $G$ on a closed disc space $S$ yields a compact +connected set $F \subseteq S$ containing $x$ and $y$ such that +$F \cap U(G) \subseteq \{v \in V(G) \mid \text{Sum.inl } v \in A\}$. -/ +theorem exists_separatingSet_of_isXYChain + {S : Type u} [TopologicalSpace S] {G : Drawing S} {x y : S} {A : List (ChainTerm S)} + (hDisc : IsClosedDiscSpace S) (hProper : G.IsProper) + (hChain : IsXYChain G x y A) : + ∃ F : Set S, IsCompact F ∧ IsConnected F ∧ x ∈ F ∧ y ∈ F ∧ + F ∩ G.U ⊆ {v ∈ G.V | Sum.inl v ∈ A} := by + obtain ⟨F, hcompact, hpath, hx, hy, hmeet, -⟩ := + GM12.exists_path_connected_carrier_of_disc_chain hDisc hProper hChain + exact ⟨F, hcompact, hpath.isConnected, hx, hy, hmeet⟩ + +/-- Necessity of (3.6)(i): If $\Delta$ is feasible in $G$ on a closed disc space $S$, then $\Delta$ +is cross-free on $\operatorname{bd}(S)$. -/ +theorem isCrossFree_of_isFeasible + {S : Type u} [TopologicalSpace S] {G : Drawing S} {Δ : Set (Set S)} + (hDisc : IsClosedDiscSpace S) (hFeas : IsFeasible G.toGraph Δ) : + IsCrossFree (bd S) Δ := by + rcases hFeas with ⟨H, _, _, hHG, _, H_comp, hInj, hComp, _⟩ + rintro ⟨δ₁, hδ₁, δ₂, hδ₂, hne, a, ha, c, hc, b, hb, d, hd, hcross⟩ + let C₁ := H_comp δ₁ + let C₂ := H_comp δ₂ + have hC_ne : C₁ ≠ C₂ := fun heq => hne (hInj hδ₁ hδ₂ heq) + have hC₁ : IsGraphComponent C₁ H := (hComp δ₁ hδ₁).1 + have hC₂ : IsGraphComponent C₂ H := (hComp δ₂ hδ₂).1 + have haC₁ : a ∈ V(C₁) := (hComp δ₁ hδ₁).2 ha + have hcC₁ : c ∈ V(C₁) := (hComp δ₁ hδ₁).2 hc + have hbC₂ : b ∈ V(C₂) := (hComp δ₂ hδ₂).2 hb + have hdC₂ : d ∈ V(C₂) := (hComp δ₂ hδ₂).2 hd + obtain ⟨W₁⟩ := hC₁.2.1.2 a haC₁ c hcC₁ + obtain ⟨W₂⟩ := hC₂.2.1.2 b hbC₂ d hdC₂ + obtain ⟨K₁, hK₁_comp, hK₁_conn, haK₁, hcK₁, hK₁_sub, _, _⟩ := + exists_compact_connected_of_walk G (hC₁.1.trans hHG) W₁ + obtain ⟨K₂, hK₂_comp, hK₂_conn, hbK₂, hdK₂, hK₂_sub, _, _⟩ := + exists_compact_connected_of_walk G (hC₂.1.trans hHG) W₂ + have hmeet := discCrossing_of_isClosedDiscSpace hDisc + hK₁_comp hK₂_comp hK₁_conn hK₂_conn haK₁ hcK₁ hbK₂ hdK₂ hcross + rcases hmeet with ⟨z, hz1, hz2⟩ + have hV_disj : Disjoint V(C₁) V(C₂) := + hC₁.disjoint_vertexSet_of_ne hC₂ hC_ne + have hE_disj : Disjoint E(C₁) E(C₂) := + hC₁.disjoint_edgeSet_of_ne hC₂ hC_ne + have hz1_in : z ∈ V(C₁) ∪ ⋃ e ∈ E(C₁), e := hK₁_sub hz1 + have hz2_in : z ∈ V(C₂) ∪ ⋃ e ∈ E(C₂), e := hK₂_sub hz2 + rcases hz1_in with hzV1 | hzE1 <;> rcases hz2_in with hzV2 | hzE2 + · exact disjoint_left.mp hV_disj hzV1 hzV2 + · simp only [mem_iUnion, exists_prop] at hzE2 + rcases hzE2 with ⟨e₂, he₂C, hze₂⟩ + have he₂G : e₂ ∈ G.E := (hC₂.1.trans hHG).edgeSet_mono he₂C + have hzV : z ∈ G.V := (hC₁.1.trans hHG).vertexSet_mono hzV1 + exact (he₂G.2.1 hze₂).2 hzV + · simp only [mem_iUnion, exists_prop] at hzE1 + rcases hzE1 with ⟨e₁, he₁C, hze₁⟩ + have he₁G : e₁ ∈ G.E := (hC₁.1.trans hHG).edgeSet_mono he₁C + have hzV : z ∈ G.V := (hC₂.1.trans hHG).vertexSet_mono hzV2 + exact (he₁G.2.1 hze₁).2 hzV + · simp only [mem_iUnion, exists_prop] at hzE1 hzE2 + rcases hzE1 with ⟨e₁, he₁C, hze₁⟩ + rcases hzE2 with ⟨e₂, he₂C, hze₂⟩ + have he₁G : e₁ ∈ G.E := (hC₁.1.trans hHG).edgeSet_mono he₁C + have he₂G : e₂ ∈ G.E := (hC₂.1.trans hHG).edgeSet_mono he₂C + have he_ne : e₁ ≠ e₂ := by + intro heq + subst heq + exact disjoint_left.mp hE_disj he₁C he₂C + exact disjoint_left.mp (disjoint_edges_of_ne G he₁G he₂G he_ne) hze₁ hze₂ + +open Classical in +/-- Necessity of (3.6)(ii): If $\Delta$ is feasible in $G$ on a closed disc space $S$, then every +$(x, y)$-chain $A$ in $G$ has non-negative $\Delta$-redundancy. -/ +theorem chainRedundancy_nonneg_of_isFeasible + {S : Type u} [TopologicalSpace S] {G : Drawing S} {Δ : Set (Set S)} {x y : S} + {A : List (ChainTerm S)} + (hDisc : IsClosedDiscSpace S) (hProper : G.IsProper) + (hUnion : divisionUnion Δ = G.V ∩ bd S) + (hFeas : IsFeasible G.toGraph Δ) + (hChain : IsXYChain G x y A) : + 0 ≤ chainRedundancy G Δ x y A := by + unfold chainRedundancy + suffices hle : divisionCount (bd S) Δ x y ≤ chainLength A by omega + rcases hFeas with ⟨H, _, _, hHG, _, H_comp, hInj, hComp, _⟩ + obtain ⟨F, hF_comp, hF_conn, hxF, hyF, hF_sub⟩ := + exists_separatingSet_of_isXYChain hDisc hProper hChain + let S_cnt : Set (Set S) := + {δ ∈ Δ | (δ ∩ {x, y}).Nonempty ∨ ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn (bd S) u v x y} + have h_hit : ∀ δ ∈ S_cnt, ∃ w : S, w ∈ V(H_comp δ) ∧ Sum.inl w ∈ A := by + rintro δ ⟨hδΔ, hδ_cond⟩ + let C := H_comp δ + have hC : IsGraphComponent C H := (hComp δ hδΔ).1 + have hδ_sub : δ ⊆ V(C) := (hComp δ hδΔ).2 + rcases hδ_cond with ⟨z, hzδ, hzxy⟩ | ⟨u, huδ, v, hvδ, hcross⟩ + · have hzC : z ∈ V(C) := hδ_sub hzδ + have hzV : z ∈ G.V := by + have : z ∈ divisionUnion Δ := mem_sUnion_of_mem hzδ hδΔ + rw [hUnion] at this + exact this.1 + refine ⟨z, hzC, ?_⟩ + rcases hzxy with rfl | rfl + · have hmatch := hChain.head_matches + rcases hhead : A.head hChain.ne_nil with w | r + · rw [hhead] at hmatch + change w = z at hmatch + subst hmatch + rw [← hhead] + exact List.head_mem hChain.ne_nil + · rw [hhead] at hmatch + change z ∈ r at hmatch + have hrR : r ∈ G.R := by + have hv := hChain.valid (A.head hChain.ne_nil) (List.head_mem hChain.ne_nil) + simpa [hhead, ChainTerm.IsValid] using hv + exfalso + exact not_mem_U_of_mem_region G hrR hmatch (G.V_subset_U hzV) + · have hmatch := hChain.last_matches + rcases hlast : A.getLast hChain.ne_nil with w | r + · rw [hlast] at hmatch + change w = z at hmatch + subst hmatch + rw [← hlast] + exact List.getLast_mem hChain.ne_nil + · rw [hlast] at hmatch + change z ∈ r at hmatch + have hrR : r ∈ G.R := by + have hv := hChain.valid (A.getLast hChain.ne_nil) (List.getLast_mem hChain.ne_nil) + simpa [hlast, ChainTerm.IsValid] using hv + exfalso + exact not_mem_U_of_mem_region G hrR hmatch (G.V_subset_U hzV) + · have huC : u ∈ V(C) := hδ_sub huδ + have hvC : v ∈ V(C) := hδ_sub hvδ + obtain ⟨W⟩ := hC.2.1.2 u huC v hvC + obtain ⟨KW, hKW_comp, hKW_conn, huKW, hvKW, _, hKW_U, hKW_V⟩ := + exists_compact_connected_of_walk G (hC.1.trans hHG) W + have hmeet := discCrossing_of_isClosedDiscSpace hDisc + hKW_comp hF_comp hKW_conn hF_conn huKW hvKW hxF hyF hcross + rcases hmeet with ⟨w, hw_walk, hw_F⟩ + have hw_U : w ∈ G.U := hKW_U hw_walk + have hw_in : w ∈ {v ∈ G.V | Sum.inl v ∈ A} := hF_sub ⟨hw_F, hw_U⟩ + have hwC : w ∈ V(C) := hKW_V ⟨hw_walk, hw_in.1⟩ + exact ⟨w, hwC, hw_in.2⟩ + choose f hf_comp hf_mem using h_hit + have h_le1 : S_cnt.ncard ≤ {w : S | Sum.inl w ∈ A}.ncard := by + have h_inj' : InjOn (fun δ : Set S => if h : δ ∈ S_cnt then f δ h else x) S_cnt := by + intro δ₁ hδ₁ δ₂ hδ₂ heq + simp only [hδ₁, hδ₂, ↓reduceDIte] at heq + have hwC₁ : f δ₁ hδ₁ ∈ V(H_comp δ₁) := hf_comp δ₁ hδ₁ + have hwC₂ : f δ₂ hδ₂ ∈ V(H_comp δ₂) := hf_comp δ₂ hδ₂ + rw [heq] at hwC₁ + have hC₁ : IsGraphComponent (H_comp δ₁) H := (hComp δ₁ hδ₁.1).1 + have hC₂ : IsGraphComponent (H_comp δ₂) H := (hComp δ₂ hδ₂.1).1 + have hC_eq : H_comp δ₁ = H_comp δ₂ := hC₁.eq_of_mem_mem hC₂ hwC₁ hwC₂ + exact hInj hδ₁.1 hδ₂.1 hC_eq + have h_maps' : MapsTo (fun δ : Set S => if h : δ ∈ S_cnt then f δ h else x) + S_cnt {w : S | Sum.inl w ∈ A} := by + intro δ hδ + simp only [hδ, ↓reduceDIte] + exact hf_mem δ hδ + exact ncard_le_ncard_of_injOn _ h_maps' h_inj' (finite_inl_mem A) + exact h_le1.trans (ncard_inl_mem_le_chainLength A) + +/-! ## 2. Sufficiency and Proof of Theorem (3.6) -/ + +/-- If `a` and `b` lie in the same segment `s ∈ segmentsOf C (divisionUnion Δ)`, then +`divisionCount C Δ a b = 0`. -/ +private lemma divisionCount_eq_zero_of_same_segment {S : Type u} [TopologicalSpace S] + {C : Set S} {Δ : Set (Set S)} {s : Set S} (hs : s ∈ segmentsOf C (divisionUnion Δ)) + {a b : S} (ha : a ∈ s) (hb : b ∈ s) : + divisionCount C Δ a b = 0 := by + rcases hs.1 with ⟨z₀, _, rfl⟩ + have hs_sub : connectedComponentIn (C \ divisionUnion Δ) z₀ ⊆ C \ divisionUnion Δ := + connectedComponentIn_subset _ _ + have ha_not : a ∉ divisionUnion Δ := (hs_sub ha).2 + have hb_not : b ∉ divisionUnion Δ := (hs_sub hb).2 + unfold divisionCount + have h_emp : {δ ∈ Δ | (δ ∩ {a, b}).Nonempty ∨ ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn C u v a b} = ∅ := by + refine eq_empty_of_forall_notMem fun δ ⟨hδ, hcond⟩ => ?_ + rcases hcond with ⟨w, hwδ, rfl | rfl⟩ | ⟨u, huδ, v, hvδ, hcr⟩ + · exact ha_not ⟨δ, hδ, hwδ⟩ + · exact hb_not ⟨δ, hδ, hwδ⟩ + · have hs_uv : connectedComponentIn (C \ divisionUnion Δ) z₀ ⊆ C \ {u, v} := by + refine hs_sub.trans (sdiff_subset_sdiff subset_rfl ?_) + rintro w (rfl | rfl) + · exact ⟨δ, hδ, huδ⟩ + · exact ⟨δ, hδ, hvδ⟩ + have hb_cc : b ∈ connectedComponentIn (C \ {u, v}) a := + isPreconnected_connectedComponentIn.subset_connectedComponentIn ha hs_uv hb + exact hcr.2.2.2.2.2.2.2.2.2.2 (connectedComponentIn_eq hb_cc) + rw [h_emp, ncard_empty] + +/-- If `x, x' ∈ C` either are equal or lie in the same segment of `C \ divisionUnion Δ`, and +similarly for `y, y' ∈ C`, then `divisionCount C Δ x' y' = divisionCount C Δ x y`. -/ +private lemma divisionCount_eq_of_same_segment {S : Type u} [TopologicalSpace S] + {C : Set S} (hC : IsOArc C) {Δ : Set (Set S)} (hΔ : IsDivision Δ) + (hV_sub : divisionUnion Δ ⊆ C) {x x' y y' : S} + (hx : x ∈ C) (hx' : x' ∈ C) (hy : y ∈ C) (hy' : y' ∈ C) + (hxx' : x' = x ∨ ∃ s ∈ segmentsOf C (divisionUnion Δ), x ∈ s ∧ x' ∈ s) + (hyy' : y' = y ∨ ∃ s ∈ segmentsOf C (divisionUnion Δ), y ∈ s ∧ y' ∈ s) : + divisionCount C Δ x' y' = divisionCount C Δ x y := by + have h1 : divisionCount C Δ x' y' = divisionCount C Δ x y' := by + rcases hxx' with rfl | ⟨s, hs, hxs, hx's⟩ + · rfl + · have hs_sub : s ⊆ C \ divisionUnion Δ := by + rcases hs.1 with ⟨z₀, _, rfl⟩ + exact connectedComponentIn_subset _ _ + have hx_not : x ∉ divisionUnion Δ := (hs_sub hxs).2 + have hx'_not : x' ∉ divisionUnion Δ := (hs_sub hx's).2 + have h0_xx' := divisionCount_eq_zero_of_same_segment hs hxs hx's + have h0_x'x := divisionCount_eq_zero_of_same_segment hs hx's hxs + exact le_antisymm + (divisionCount_le_of_left_eq_zero hC hΔ hV_sub hx' hx hy' hx_not h0_x'x) + (divisionCount_le_of_left_eq_zero hC hΔ hV_sub hx hx' hy' hx'_not h0_xx') + have h2 : divisionCount C Δ x y' = divisionCount C Δ x y := by + rcases hyy' with rfl | ⟨s, hs, hys, hy's⟩ + · rfl + · have hs_sub : s ⊆ C \ divisionUnion Δ := by + rcases hs.1 with ⟨z₀, _, rfl⟩ + exact connectedComponentIn_subset _ _ + have hy_not : y ∉ divisionUnion Δ := (hs_sub hys).2 + have hy'_not : y' ∉ divisionUnion Δ := (hs_sub hy's).2 + have h0_yy' := divisionCount_eq_zero_of_same_segment hs hys hy's + have h0_y'y := divisionCount_eq_zero_of_same_segment hs hy's hys + exact le_antisymm + (divisionCount_le_of_right_eq_zero hC hΔ hV_sub hx hy hy' hy_not h0_yy') + (divisionCount_le_of_right_eq_zero hC hΔ hV_sub hx hy' hy hy'_not h0_y'y) + exact h1.trans h2 + +/-- Transfer of non-negative chain redundancy between any two dual point sets `U` and `U'` for +`(bd S, divisionUnion Δ)`. -/ +theorem chainRedundancy_nonneg_of_isDualPointSet {S : Type u} [TopologicalSpace S] + (hS : IsClosedDiscSpace S) {G : Drawing S} (hProper : G.IsProper) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hΔ_eq : divisionUnion Δ = G.V ∩ bd S) + {U U' : Set S} (hU : IsDualPointSet (bd S) (divisionUnion Δ) U) + (hU' : IsDualPointSet (bd S) (divisionUnion Δ) U') + (hRed : ∀ x ∈ U ∪ divisionUnion Δ, ∀ y ∈ U ∪ divisionUnion Δ, + ∀ A : List (ChainTerm S), IsXYChain G x y A → 0 ≤ chainRedundancy G Δ x y A) : + ∀ x' ∈ U' ∪ divisionUnion Δ, ∀ y' ∈ U' ∪ divisionUnion Δ, + ∀ A : List (ChainTerm S), IsXYChain G x' y' A → 0 ≤ chainRedundancy G Δ x' y' A := by + have hV_sub : divisionUnion Δ ⊆ bd S := hΔ_eq ▸ inter_subset_right + have hV_fin : (divisionUnion Δ).Finite := hΔ_eq ▸ G.finite_V.inter_of_left _ + have hU_sub : U ⊆ bd S \ divisionUnion Δ := isDualPointSet_subset_diff hU + have hU'_sub : U' ⊆ bd S \ divisionUnion Δ := isDualPointSet_subset_diff hU' + have h_corr : ∀ z' ∈ U' ∪ divisionUnion Δ, + ∃ z ∈ U ∪ divisionUnion Δ, z ∈ bd S ∧ z' ∈ bd S ∧ + (z' = z ∨ ∃ s ∈ segmentsOf (bd S) (divisionUnion Δ), z ∈ s ∧ z' ∈ s) ∧ + (∀ t : ChainTerm S, t.IsValid G → (t.MatchesEnd z' ↔ t.MatchesEnd z)) := by + rintro z' (hz'U' | hz'V) + · have hz'_diff : z' ∈ bd S \ divisionUnion Δ := hU'_sub hz'U' + have hV_ne : (divisionUnion Δ).Nonempty := by + by_contra hemp + rw [not_nonempty_iff_eq_empty] at hemp + have hU'_emp : U' = ∅ := hU'.1 hemp + rw [hU'_emp] at hz'U' + exact hz'U' + let s := connectedComponentIn (bd S \ divisionUnion Δ) z' + have hs_mem : s ∈ segmentsOf (bd S) (divisionUnion Δ) := + connectedComponentIn_mem_segmentsOf hS.isOArc_bd hV_fin hV_sub hV_ne hz'_diff + have hz'_s : z' ∈ s := mem_connectedComponentIn hz'_diff + obtain ⟨z, hz_eq⟩ := ncard_eq_one.mp ((hU.2 hV_ne).2 s hs_mem) + have hz_mem : z ∈ U ∩ s := by rw [hz_eq]; exact mem_singleton z + have hs_compl : s ⊆ univ \ G.U := by + refine (connectedComponentIn_subset _ _).trans fun w hw => ⟨mem_univ w, fun hwU => ?_⟩ + apply hw.2 + rw [hΔ_eq] + exact ⟨hProper ⟨hw.1, hwU⟩, hw.1⟩ + refine ⟨z, Or.inl hz_mem.1, (hU_sub hz_mem.1).1, hz'_diff.1, + Or.inr ⟨s, hs_mem, hz_mem.2, hz'_s⟩, ?_⟩ + rintro (v | r) hval + · change (v = z' ↔ v = z) + have hvV : v ∈ G.V := hval + have hz'_not_V : z' ∉ G.V := fun h => (hs_compl hz'_s).2 (G.V_subset_U h) + have hz_not_V : z ∉ G.V := fun h => (hs_compl hz_mem.2).2 (G.V_subset_U h) + exact ⟨fun h => (hz'_not_V (h ▸ hvV)).elim, fun h => (hz_not_V (h ▸ hvV)).elim⟩ + · change (z' ∈ r ↔ z ∈ r) + have hrR : r ∈ G.R := hval + rcases (mem_R_iff G).mp hrR with ⟨w₀, _, rfl⟩ + have hz_cc : z ∈ connectedComponentIn (univ \ G.U) z' := + isPreconnected_connectedComponentIn.subset_connectedComponentIn hz'_s hs_compl hz_mem.2 + constructor + · intro hz'_r + rw [connectedComponentIn_eq hz'_r] + exact hz_cc + · intro hz_r + rw [connectedComponentIn_eq hz_r, ← connectedComponentIn_eq hz_cc] + exact mem_connectedComponentIn (hs_compl hz'_s) + · exact ⟨z', Or.inr hz'V, hV_sub hz'V, hV_sub hz'V, Or.inl rfl, fun _ _ => Iff.rfl⟩ + intro x' hx' y' hy' A hChain' + obtain ⟨x, hx, hx_bd, hx'_bd, hxx', hm_x⟩ := h_corr x' hx' + obtain ⟨y, hy, hy_bd, hy'_bd, hyy', hm_y⟩ := h_corr y' hy' + have hChain : IsXYChain G x y A := + ⟨hChain'.ne_nil, hChain'.valid, hChain'.isChain, + (hm_x _ (hChain'.valid _ (List.head_mem hChain'.ne_nil))).mp hChain'.head_matches, + (hm_y _ (hChain'.valid _ (List.getLast_mem hChain'.ne_nil))).mp hChain'.last_matches, + hChain'.peripheral_iff⟩ + have hdiv_eq := divisionCount_eq_of_same_segment hS.isOArc_bd hΔ hV_sub + hx_bd hx'_bd hy_bd hy'_bd hxx' hyy' + have hred := hRed x hx y hy A hChain + unfold chainRedundancy at hred ⊢ + rw [hdiv_eq] + exact hred + +/-- For any one-way dual drawing `IsDiscDualDrawing G G_dual`, `G_dual.V.ncard = G.R.ncard`. -/ +theorem IsDiscDualDrawing.ncard_dual_V_eq_ncard_R {S : Type u} [TopologicalSpace S] + (hS : IsClosedDiscSpace S) {G G_dual : Drawing S} (hDual : IsDiscDualDrawing G G_dual) : + G_dual.V.ncard = G.R.ncard := by + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + let f : S → Set S := fun w => connectedComponentIn (univ \ G.U) w + have hf_img : f '' G_dual.V = G.R := by + ext r + simp only [mem_image, f] + constructor + · rintro ⟨w, hw, rfl⟩ + obtain ⟨r₀, hr₀, hwr₀⟩ := hDual.2.2.2.1 w hw + have heq : r₀ = connectedComponentIn (univ \ G.U) w := by + obtain ⟨z₀, _, rfl⟩ := (mem_R_iff G).mp hr₀ + exact connectedComponentIn_eq hwr₀ + exact heq ▸ hr₀ + · intro hr + obtain ⟨w, ⟨hwr, hwV⟩, _⟩ := hDual.2.2.1 r hr + refine ⟨w, hwV, ?_⟩ + obtain ⟨z₀, _, rfl⟩ := (mem_R_iff G).mp hr + exact (connectedComponentIn_eq hwr).symm + have hf_inj : InjOn f G_dual.V := by + intro w₁ hw₁ w₂ hw₂ heq + dsimp only [f] at heq + obtain ⟨r₁, hr₁, hw₁_r⟩ := hDual.2.2.2.1 w₁ hw₁ + have hr₁_eq : r₁ = connectedComponentIn (univ \ G.U) w₁ := by + obtain ⟨z₀, _, rfl⟩ := (mem_R_iff G).mp hr₁ + exact connectedComponentIn_eq hw₁_r + have hw₂_r₁ : w₂ ∈ r₁ := by + rw [hr₁_eq, heq] + obtain ⟨r₂, hr₂, hw₂_r⟩ := hDual.2.2.2.1 w₂ hw₂ + exact mem_connectedComponentIn ⟨mem_univ w₂, region_subset hr₂ hw₂_r⟩ + exact (hDual.2.2.1 r₁ hr₁).unique ⟨hw₁_r, hw₁⟩ ⟨hw₂_r₁, hw₂⟩ + rw [← hf_img, hf_inj.ncard_image] + +/-- For a connected proper drawing `G` on a closed disc space `S` and a dual drawing +`IsDiscDualDrawing G G_dual`, `G_dual.V.ncard + G_dual.R.ncard = G.V.ncard + G.R.ncard`. -/ +theorem IsDiscDualDrawing.ncard_V_add_ncard_R_eq {S : Type u} [TopologicalSpace S] + (hS : IsClosedDiscSpace S) {G G_dual : Drawing S} (hConn : IsGraphConnected G.toGraph) + (hDual : IsDiscDualDrawing G G_dual) : + G_dual.V.ncard + G_dual.R.ncard = G.V.ncard + G.R.ncard := by + have h1 := hDual.ncard_dual_V_eq_ncard_R hS + have h2 := (hDual.symm_of_connected hS hConn).ncard_dual_V_eq_ncard_R hS + omega + +/-- If `G.V` is nonempty and `G.toGraph` is not connected, then `2 ≤ (graphComponents +G.toGraph).ncard`. -/ +private lemma two_le_ncard_graphComponents_of_not_connected {S : Type u} [TopologicalSpace S] + (G : Drawing S) (hV_ne : G.V.Nonempty) (hNotConn : ¬ IsGraphConnected G.toGraph) : + 2 ≤ (graphComponents G.toGraph).ncard := by + obtain ⟨v₀, hv₀⟩ := hV_ne + have h_ex : ∃ v₁ ∈ G.V, compOf G.toGraph v₀ ≠ compOf G.toGraph v₁ := by + by_contra h_all + push Not at h_all + apply hNotConn + refine ⟨⟨v₀, hv₀⟩, fun u hu v hv => ?_⟩ + have hu_in : u ∈ reachSet G.toGraph v₀ := by + have : u ∈ V(compOf G.toGraph u) := self_mem_reachSet hu + rwa [← h_all u hu] at this + have hv_in : v ∈ reachSet G.toGraph v₀ := by + have : v ∈ V(compOf G.toGraph v) := self_mem_reachSet hv + rwa [← h_all v hv] at this + obtain ⟨_, ⟨Wu⟩⟩ := hu_in + obtain ⟨_, ⟨Wv⟩⟩ := hv_in + exact ⟨Wu.reverse.append Wv⟩ + obtain ⟨v₁, hv₁, hne⟩ := h_ex + have h_pair_sub : ({compOf G.toGraph v₀, compOf G.toGraph v₁} : Set (Graph S (Set S))) ⊆ + graphComponents G.toGraph := by + rintro C (rfl | rfl) + · exact isGraphComponent_compOf hv₀ + · exact isGraphComponent_compOf hv₁ + have h_card_pair : ({compOf G.toGraph v₀, compOf G.toGraph v₁} : Set (Graph S (Set S))).ncard = 2 + := + ncard_pair hne + rw [← h_card_pair] + exact ncard_le_ncard h_pair_sub (finite_graphComponents G) + +/-- Sufficiency half of **Graph Minors VI, (3.6)** (page 122), proved by strong induction on +`G.V.ncard + G.R.ncard` following the paper's five cases. -/ +theorem isFeasible_of_isCrossFree_of_chainRedundancy_nonneg {S : Type u} [TopologicalSpace S] + (hS : IsClosedDiscSpace S) + (hDualExists : ∀ (G : Drawing S), G.IsProper → IsGraphConnected G.toGraph → + ∃ G_dual : Drawing S, IsDiscDualDrawing G G_dual) + {G : Drawing S} (hProper : G.IsProper) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hΔ_eq : divisionUnion Δ = G.V ∩ bd S) + {U : Set S} (hU : IsDualPointSet (bd S) (divisionUnion Δ) U) + (hCF : IsCrossFree (bd S) Δ) + (hRed : ∀ x ∈ U ∪ divisionUnion Δ, ∀ y ∈ U ∪ divisionUnion Δ, + ∀ A : List (ChainTerm S), IsXYChain G x y A → 0 ≤ chainRedundancy G Δ x y A) : + IsFeasible G.toGraph Δ := by + classical + have : T2Space S := t2Space_of_isClosedDiscSpace hS + induction hn : G.V.ncard + G.R.ncard using Nat.strong_induction_on generalizing G Δ U with + | ind n ih => + -- Case 1: Δ = ∅ + by_cases hΔ_emp : Δ = ∅ + · subst hΔ_emp + exact isFeasible_empty G.toGraph + have hΔ_ne : Δ.Nonempty := nonempty_iff_ne_empty.mpr hΔ_emp + obtain ⟨δ₀, hδ₀⟩ := hΔ_ne + obtain ⟨v₀, hv₀⟩ := hΔ.2.1 δ₀ hδ₀ + have hv₀_bd : v₀ ∈ G.V ∩ bd S := hΔ_eq ▸ ⟨δ₀, hδ₀, hv₀⟩ + have hVG_ne : (G.V ∩ bd S).Nonempty := ⟨v₀, hv₀_bd⟩ + have hU_G : IsDualPointSet (bd S) (G.V ∩ bd S) U := hΔ_eq ▸ hU + have hRed_G : ∀ a ∈ U ∪ (G.V ∩ bd S), ∀ b ∈ U ∪ (G.V ∩ bd S), + ∀ A : List (ChainTerm S), IsXYChain G a b A → 0 ≤ chainRedundancy G Δ a b A := by + simpa [hΔ_eq] using hRed + -- Case 2: |δ| = 1 for some δ ∈ Δ + by_cases h_sing : ∃ v : S, {v} ∈ Δ + · obtain ⟨v, hv⟩ := h_sing + obtain ⟨hProper', _, hlt, hΔ', hΔ'_eq, ⟨U', _, hU'_dual, hRed'⟩, hFeas_imp⟩ := + exists_reduction_of_singleton_mem hS hProper hΔ hΔ_eq hv hU_G hRed_G + let G' := induceDrawing G (G.V \ {v}) + let Δ' := Δ \ {{v}} + have hCF' : IsCrossFree (bd S) Δ' := + fun ⟨δ₁, hδ₁, δ₂, hδ₂, rest⟩ => hCF ⟨δ₁, hδ₁.1, δ₂, hδ₂.1, rest⟩ + exact hFeas_imp (ih (G'.V.ncard + G'.R.ncard) (hn ▸ hlt) hProper' hΔ' hΔ'_eq + (hΔ'_eq.symm ▸ hU'_dual) hCF' (by simpa [hΔ'_eq] using hRed') rfl) + -- Case 3: Some component of G has no vertex in bd(S) + by_cases h_int : ∃ C₀ ∈ graphComponents G.toGraph, V(C₀) ∩ bd S = ∅ + · obtain ⟨C₀, hC₀, hC₀_disj⟩ := h_int + obtain ⟨G', hProper', _, hlt, hV'_bd_eq, hRed', hFeas_imp⟩ := + exists_reduction_of_internal_component hS hProper hVG_ne hC₀ hC₀_disj hU_G hRed_G + have hΔ_eq' : divisionUnion Δ = G'.V ∩ bd S := hΔ_eq.trans hV'_bd_eq.symm + exact hFeas_imp (ih (G'.V.ncard + G'.R.ncard) (hn ▸ hlt) hProper' hΔ hΔ_eq' + hU hCF (by simpa [hΔ_eq'] using hRed') rfl) + -- Case 4: G is not connected + by_cases hConn : IsGraphConnected G.toGraph + · -- Case 5: G is connected and |δ| ≥ 2 for all δ ∈ Δ + obtain ⟨G_dual, hDual⟩ := hDualExists G hProper hConn + let U_dual := G_dual.V ∩ bd S + let Δ_dual := dualDivision (bd S) U_dual Δ + have hC : IsOArc (bd S) := hS.isOArc_bd + have hV_fin : (divisionUnion Δ).Finite := hΔ_eq ▸ G.finite_V.inter_of_left _ + have hV_sub : divisionUnion Δ ⊆ bd S := hΔ_eq ▸ inter_subset_right + have hU_dual : IsDualPointSet (bd S) (divisionUnion Δ) U_dual := hΔ_eq ▸ hDual.2.2.2.2.1 + have hRed_dual := chainRedundancy_nonneg_of_isDualPointSet hS hProper hΔ hΔ_eq hU hU_dual hRed + have hΔ_dual_div : IsDivision Δ_dual := isDivision_dualDivision hC hV_fin hV_sub hU_dual + have hΔ_dual_eq : divisionUnion Δ_dual = G_dual.V ∩ bd S := + divisionUnion_dualDivision (bd S) U_dual Δ + have hCF_dual : IsCrossFree (bd S) Δ_dual := + theorem_2_1_proof (bd S) U_dual Δ hC hΔ hV_sub hU_dual + have hW_ne : (divisionUnion Δ ∪ U_dual).Nonempty := ⟨v₀, Or.inl (hΔ_eq.symm ▸ hv₀_bd)⟩ + obtain ⟨γ, hγ_mem, hγ_card⟩ := theorem_2_3_proof (bd S) U_dual Δ hC hΔ hV_fin hV_sub hU_dual + hW_ne + obtain ⟨u, rfl⟩ := ncard_eq_one.mp hγ_card + have hu_dual : {u} ∈ Δ_dual := hγ_mem.resolve_left fun huΔ => h_sing ⟨u, huΔ⟩ + have hSymm := hDual.symm_of_connected hS hConn + have hU_symm : IsDualPointSet (bd S) (G_dual.V ∩ bd S) (G.V ∩ bd S) := hSymm.2.2.2.2.1 + have hRed_G_dual : ∀ a ∈ (G.V ∩ bd S) ∪ (G_dual.V ∩ bd S), + ∀ b ∈ (G.V ∩ bd S) ∪ (G_dual.V ∩ bd S), + ∀ A_dual : List (ChainTerm S), IsXYChain G_dual a b A_dual → + 0 ≤ chainRedundancy G_dual Δ_dual a b A_dual := by + intro a ha b hb A_dual hChain_dual + have ha' : a ∈ U_dual ∪ divisionUnion Δ := by + rw [hΔ_eq]; exact ha.symm + have hb' : b ∈ U_dual ∪ divisionUnion Δ := by + rw [hΔ_eq]; exact hb.symm + obtain ⟨A, hChainA, hred_eq⟩ := + theorem_3_5_proof G G_dual Δ a b A_dual hS hConn hΔ hΔ_eq hCF hDual ha' hb' hChain_dual + rw [hred_eq] + exact hRed_dual a ha' b hb' A hChainA + obtain ⟨hProper_d', _, hlt_d, hΔ_d', hΔ_d'_eq, ⟨U_d', _, hU_d'_dual, hRed_d'⟩, hFeas_d_imp⟩ := + exists_reduction_of_singleton_mem hS hDual.2.1 hΔ_dual_div hΔ_dual_eq hu_dual hU_symm + hRed_G_dual + let G_dual' := induceDrawing G_dual (G_dual.V \ {u}) + let Δ_dual' := Δ_dual \ {{u}} + have hcard_eq := hDual.ncard_V_add_ncard_R_eq hS hConn + have hlt_n : G_dual'.V.ncard + G_dual'.R.ncard < n := by + dsimp only [G_dual'] + omega + have hCF_d' : IsCrossFree (bd S) Δ_dual' := + fun ⟨δ₁, hδ₁, δ₂, hδ₂, rest⟩ => hCF_dual ⟨δ₁, hδ₁.1, δ₂, hδ₂.1, rest⟩ + have hFeas_d' := ih (G_dual'.V.ncard + G_dual'.R.ncard) hlt_n hProper_d' hΔ_d' hΔ_d'_eq + (hΔ_d'_eq.symm ▸ hU_d'_dual) hCF_d' (by simpa [hΔ_d'_eq] using hRed_d') rfl + have hFeas_dual : IsFeasible G_dual.toGraph Δ_dual := hFeas_d_imp hFeas_d' + exact (theorem_3_2_proof G G_dual Δ hS hConn hΔ hΔ_eq hCF hDual).mpr hFeas_dual + · -- G is not connected + have h2_le : 2 ≤ (graphComponents G.toGraph).ncard := + two_le_ncard_graphComponents_of_not_connected G ⟨v₀, hv₀_bd.1⟩ hConn + have h_comps_fin : (graphComponents G.toGraph).Finite := finite_graphComponents G + let k := (graphComponents G.toGraph).ncard + have hk : 2 ≤ k := h2_le + have h_card_coe : Nat.card (graphComponents G.toGraph) = k := + Nat.card_coe_set_eq (graphComponents G.toGraph) + have : Finite (graphComponents G.toGraph) := h_comps_fin.to_subtype + let enum : Fin k ≃ graphComponents G.toGraph := + (Finite.equivFinOfCardEq h_card_coe).symm + let G_comp : Fin k → Graph S (Set S) := fun i => (enum i).1 + let Δ_part : Fin k → Set (Set S) := fun i => {δ ∈ Δ | δ ⊆ V(G_comp i)} + have hinj_G : InjOn G_comp univ := by + intro i _ j _ heq + exact enum.injective (Subtype.ext heq) + have hG_comps : graphComponents G.toGraph = range G_comp := by + ext C + simp only [mem_range, G_comp] + exact ⟨fun hC => ⟨enum.symm ⟨C, hC⟩, congrArg Subtype.val (enum.apply_symm_apply ⟨C, hC⟩)⟩, + by rintro ⟨i, rfl⟩; exact (enum i).2⟩ + have hΔ_cov : ∀ δ ∈ Δ, ∃ i : Fin k, δ ⊆ V(G_comp i) := by + intro δ hδ + obtain ⟨a, haδ⟩ := hΔ.2.1 δ hδ + have ha_bd : a ∈ G.V ∩ bd S := hΔ_eq ▸ ⟨δ, hδ, haδ⟩ + let C_a := compOf G.toGraph a + have hCa_mem : C_a ∈ graphComponents G.toGraph := isGraphComponent_compOf ha_bd.1 + let i := enum.symm ⟨C_a, hCa_mem⟩ + have hGi_eq : G_comp i = C_a := congrArg Subtype.val (enum.apply_symm_apply ⟨C_a, hCa_mem⟩) + refine ⟨i, fun b hbδ => ?_⟩ + by_contra hb_not + have hb_bd : b ∈ G.V ∩ bd S := hΔ_eq ▸ ⟨δ, hδ, hbδ⟩ + let C_b := compOf G.toGraph b + have hCb_mem : C_b ∈ graphComponents G.toGraph := isGraphComponent_compOf hb_bd.1 + have hCa_ne_Cb : C_a ≠ C_b := by + intro heq + apply hb_not + rw [hGi_eq, heq] + exact self_mem_reachSet hb_bd.1 + exact not_component_split_of_chainRedundancy_nonneg hS hProper hΔ hΔ_eq.subset hU_G hRed_G + hδ hCa_mem hCb_mem hCa_ne_Cb + ⟨a, haδ, self_mem_reachSet ha_bd.1⟩ ⟨b, hbδ, self_mem_reachSet hb_bd.1⟩ + refine (theorem_3_3_iv G Δ k G_comp Δ_part hk hΔ hΔ_eq hinj_G hG_comps + (fun _ => rfl) hΔ_cov).mpr fun i => ?_ + have hCi_mem : G_comp i ∈ graphComponents G.toGraph := (enum i).2 + have hCi_bd : (V(G_comp i) ∩ bd S).Nonempty := by + by_contra hemp + rw [not_nonempty_iff_eq_empty] at hemp + exact h_int ⟨G_comp i, hCi_mem, hemp⟩ + let G_i := induceDrawing G V(G_comp i) + have hGi_toGraph : G_i.toGraph = G_comp i := + induceDrawing_toGraph_of_component G hCi_mem + have hProper_i : G_i.IsProper := + induceDrawing_isProper G hProper hCi_mem.1.vertexSet_mono + have hSub_i : G_i.IsSubdrawing G := + induceDrawing_isSubdrawing G hCi_mem.1.vertexSet_mono + have hGi_V : G_i.V = V(G_comp i) := + induceDrawing_V G hCi_mem.1.vertexSet_mono + have hlt_i : G_i.V.ncard + G_i.R.ncard < n := by + let j : Fin k := ⟨(i.1 + 1) % k, Nat.mod_lt _ (by omega)⟩ + have hij : i ≠ j := by + intro heq + have hval : i.1 = (i.1 + 1) % k := congrArg Fin.val heq + have hi_lt : i.1 < k := i.2 + by_cases h_last : i.1 + 1 = k + · rw [h_last, Nat.mod_self] at hval; omega + · rw [Nat.mod_eq_of_lt (by omega)] at hval; omega + have hCj_mem : G_comp j ∈ graphComponents G.toGraph := (enum j).2 + obtain ⟨w_j, hw_j⟩ := hCj_mem.2.1.1 + have hw_j_G : w_j ∈ G.V := hCj_mem.1.vertexSet_mono hw_j + have hw_j_not : w_j ∉ G_i.V := by + rw [hGi_V] + intro hw_i + have heq := hCi_mem.eq_of_mem_mem hCj_mem hw_i hw_j + exact hij (hinj_G trivial trivial heq) + have hV_lt : G_i.V.ncard < G.V.ncard := + ncard_lt_ncard ⟨hSub_i.1, fun h => hw_j_not (h hw_j_G)⟩ G.finite_V + have hR_le : G_i.R.ncard ≤ G.R.ncard := + disc_region_ncard_le_of_isSubdrawing hS hProper hSub_i + omega + have hΔi_sub : Δ_part i ⊆ Δ := fun _ h => h.1 + have hΔi_div : IsDivision (Δ_part i) := + ⟨hΔ.1.subset hΔi_sub, fun δ hδ => hΔ.2.1 δ hδ.1, hΔ.2.2.subset hΔi_sub⟩ + have hΔi_eq : divisionUnion (Δ_part i) = G_i.V ∩ bd S := by + rw [hGi_V] + ext x + simp only [divisionUnion, Δ_part, mem_sUnion, mem_ofPred_eq, mem_inter_iff] + constructor + · rintro ⟨δ, ⟨hδ, hδ_sub⟩, hxδ⟩ + have hx_bd : x ∈ G.V ∩ bd S := hΔ_eq ▸ ⟨δ, hδ, hxδ⟩ + exact ⟨hδ_sub hxδ, hx_bd.2⟩ + · rintro ⟨hx_Ci, hx_bd⟩ + have hx_union : x ∈ divisionUnion Δ := hΔ_eq.symm ▸ ⟨hCi_mem.1.vertexSet_mono hx_Ci, + hx_bd⟩ + obtain ⟨δ, hδ, hxδ⟩ := hx_union + obtain ⟨j, hj⟩ := hΔ_cov δ hδ + have heq_ij : G_comp i = G_comp j := + hCi_mem.eq_of_mem_mem (enum j).2 hx_Ci (hj hxδ) + exact ⟨δ, ⟨hδ, heq_ij ▸ hj⟩, hxδ⟩ + have hCF_i : IsCrossFree (bd S) (Δ_part i) := + fun ⟨δ₁, hδ₁, δ₂, hδ₂, rest⟩ => hCF ⟨δ₁, hδ₁.1, δ₂, hδ₂.1, rest⟩ + obtain ⟨U_i, _, hUi_dual, hRed_i⟩ := + exists_dualPointSet_and_chainRedundancy_of_component hS hProper hCi_mem hCi_bd + hΔ hΔi_sub hU_G hRed_G + rw [← hGi_toGraph] + exact ih (G_i.V.ncard + G_i.R.ncard) hlt_i hProper_i hΔi_div hΔi_eq + (hΔi_eq.symm ▸ hUi_dual) hCF_i (by simpa [hΔi_eq] using hRed_i) rfl + +/-! ## 3. Boundary Segments, Dual Vertices, and Base Case of Dual Drawing Existence -/ + +/-- Every segment `s ∈ segmentsOf C V` is non-empty. -/ +theorem segment_nonempty {S : Type u} [TopologicalSpace S] {C V s : Set S} + (hs : s ∈ segmentsOf C V) : s.Nonempty := by + obtain ⟨⟨x, hx, rfl⟩, _⟩ := hs + exact ⟨x, mem_connectedComponentIn hx⟩ + +/-- Distinct segments `s₁ ≠ s₂` of `segmentsOf C V` are disjoint. -/ +theorem disjoint_of_mem_segmentsOf_ne {S : Type u} [TopologicalSpace S] {C V s₁ s₂ : Set S} + (hs₁ : s₁ ∈ segmentsOf C V) (hs₂ : s₂ ∈ segmentsOf C V) (hne : s₁ ≠ s₂) : + Disjoint s₁ s₂ := by + obtain ⟨⟨x₁, _, rfl⟩, _⟩ := hs₁ + obtain ⟨⟨x₂, _, rfl⟩, _⟩ := hs₂ + refine disjoint_left.mpr fun z hz₁ hz₂ => hne ?_ + exact (connectedComponentIn_eq hz₁).trans (connectedComponentIn_eq hz₂).symm + +/-- On `Circle`, points `u₁ ∈ s₁` and `u₂ ∈ s₂` in distinct segments `s₁ ≠ s₂` of +`segmentsOf univ V` are separated by a pair of vertices `v₁, v₂ ∈ V` with +`CrossesOn univ v₁ v₂ u₁ u₂`. -/ +theorem exists_crossesOn_univ_of_mem_segmentsOf_ne {V s₁ s₂ : Set Circle} + (hV_fin : V.Finite) (hs₁ : s₁ ∈ segmentsOf (univ : Set Circle) V) + (hs₂ : s₂ ∈ segmentsOf (univ : Set Circle) V) (hne : s₁ ≠ s₂) + {u₁ u₂ : Circle} (hu₁ : u₁ ∈ s₁) (hu₂ : u₂ ∈ s₂) : + ∃ v₁ ∈ V, ∃ v₂ ∈ V, CrossesOn (univ : Set Circle) v₁ v₂ u₁ u₂ := by + have hV_ne : V.Nonempty := nonempty_of_mem_segmentsOf isOArc_univ_circle hs₁ + have hu₁_compl : u₁ ∈ Vᶜ := by + obtain ⟨⟨x₁, _, rfl⟩, _⟩ := hs₁ + exact (connectedComponentIn_subset _ _ hu₁).2 + have hu₂_compl : u₂ ∈ Vᶜ := by + obtain ⟨⟨x₂, _, rfl⟩, _⟩ := hs₂ + exact (connectedComponentIn_subset _ _ hu₂).2 + have hu₂_not_s₁ : u₂ ∉ s₁ := + disjoint_left.mp (disjoint_of_mem_segmentsOf_ne hs₂ hs₁ hne.symm) hu₂ + obtain ⟨v₁, hv₁, rfl⟩ := (mem_segmentsOf_univ_iff hV_fin hV_ne).mp hs₁ + have hu₂_ne_v₁ : u₂ ≠ v₁ := fun h => hu₂_compl (h ▸ hv₁) + simp only [nextSegment, mem_ofPred_eq, not_and, not_forall, not_lt] at hu₂_not_s₁ + obtain ⟨v₂, hv₂, hle⟩ := hu₂_not_s₁ hu₂_ne_v₁ + have hv₁_ne_v₂ : v₁ ≠ v₂ := Ne.symm hv₂.2 + have hu₁_ne_u₂ : u₁ ≠ u₂ := fun h => + disjoint_left.mp (disjoint_of_mem_segmentsOf_ne hs₁ hs₂ hne) hu₁ (h ▸ hu₂) + have hv₁_ne_u₁ : v₁ ≠ u₁ := Ne.symm hu₁.1 + have hv₁_ne_u₂ : v₁ ≠ u₂ := Ne.symm hu₂_ne_v₁ + have hv₂_ne_u₁ : v₂ ≠ u₁ := fun h => hu₁_compl (h ▸ hv₂.1) + have hv₂_ne_u₂ : v₂ ≠ u₂ := fun h => hu₂_compl (h ▸ hv₂.1) + have hlt₁ : v₁.angleDiff u₁ < v₁.angleDiff v₂ := hu₁.2 v₂ hv₂ + refine ⟨v₁, hv₁, v₂, hv₂.1, crossesOn_univ_iff_angleDiff.mpr + ⟨hv₁_ne_v₂, hu₁_ne_u₂, hv₁_ne_u₁, hv₁_ne_u₂, hv₂_ne_u₁, hv₂_ne_u₂, ?_⟩⟩ + exact ⟨fun _ => not_lt.mpr hle, fun _ => hlt₁⟩ + +/-- On any `O`-arc `C`, points `u₁ ∈ s₁` and `u₂ ∈ s₂` in distinct segments `s₁ ≠ s₂` of +`segmentsOf C V` are separated by a pair of vertices `v₁, v₂ ∈ V` with `CrossesOn C v₁ v₂ u₁ u₂`. -/ +theorem exists_crossesOn_of_mem_segmentsOf_ne {S : Type u} [TopologicalSpace S] + {C V s₁ s₂ : Set S} (hC : IsOArc C) (hV_fin : V.Finite) (hV_sub : V ⊆ C) + (hs₁ : s₁ ∈ segmentsOf C V) (hs₂ : s₂ ∈ segmentsOf C V) (hne : s₁ ≠ s₂) + {u₁ u₂ : S} (hu₁ : u₁ ∈ s₁) (hu₂ : u₂ ∈ s₂) : + ∃ v₁ ∈ V, ∃ v₂ ∈ V, CrossesOn C v₁ v₂ u₁ u₂ := by + obtain ⟨φ⟩ := hC + have hinj := injective_oArcMap φ + let V₀ := oArcMap φ ⁻¹' V + have hV_eq : oArcMap φ '' V₀ = V := + image_preimage_eq_of_subset (hV_sub.trans (range_oArcMap φ).symm.subset) + have hV₀_fin : V₀.Finite := by + refine Finite.of_finite_image ?_ hinj.injOn + rwa [hV_eq] + rw [← hV_eq, segmentsOf_oArcMap φ] at hs₁ hs₂ + obtain ⟨s₁₀, hs₁₀, rfl⟩ := hs₁ + obtain ⟨s₂₀, hs₂₀, rfl⟩ := hs₂ + have hne₀ : s₁₀ ≠ s₂₀ := fun h => hne (congrArg _ h) + obtain ⟨u₁₀, hu₁₀, rfl⟩ := hu₁ + obtain ⟨u₂₀, hu₂₀, rfl⟩ := hu₂ + obtain ⟨v₁₀, hv₁₀, v₂₀, hv₂₀, hcr₀⟩ := + exists_crossesOn_univ_of_mem_segmentsOf_ne hV₀_fin hs₁₀ hs₂₀ hne₀ hu₁₀ hu₂₀ + refine ⟨oArcMap φ v₁₀, ?_, oArcMap φ v₂₀, ?_, (crossesOn_oArcMap_iff φ).mpr hcr₀⟩ + · rw [← hV_eq]; exact mem_image_of_mem _ hv₁₀ + · rw [← hV_eq]; exact mem_image_of_mem _ hv₂₀ + +/-- In a connected proper drawing `G` on a closed disc `S`, every region `r ∈ G.R` intersects +at most one boundary segment `s ∈ segmentsOf (bd S) (G.V ∩ bd S)`. -/ +theorem region_inter_segmentsOf_subsingleton {S : Type u} [TopologicalSpace S] + (hS : IsClosedDiscSpace S) {G : Drawing S} (hProper : G.IsProper) + (hConn : IsGraphConnected G.toGraph) {r s₁ s₂ : Set S} (hr : r ∈ G.R) + (hs₁ : s₁ ∈ segmentsOf (bd S) (G.V ∩ bd S)) + (hs₂ : s₂ ∈ segmentsOf (bd S) (G.V ∩ bd S)) + (h₁ : (r ∩ s₁).Nonempty) (h₂ : (r ∩ s₂).Nonempty) : s₁ = s₂ := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + by_contra hne + obtain ⟨u₁, hu₁r, hu₁s⟩ := h₁ + obtain ⟨u₂, hu₂r, hu₂s⟩ := h₂ + obtain ⟨v₁, hv₁, v₂, hv₂, hcr⟩ := + exists_crossesOn_of_mem_segmentsOf_ne hS.isOArc_bd + (G.finite_V.subset inter_subset_left) inter_subset_right hs₁ hs₂ hne hu₁s hu₂s + obtain ⟨W⟩ := hConn.2 v₁ hv₁.1 v₂ hv₂.1 + obtain ⟨K_G, hKG_comp, hKG_conn, hv₁_KG, hv₂_KG, _, hKG_U, _⟩ := + exists_compact_connected_of_walk G le_rfl W + obtain ⟨γ, hγ0, hγ1, hγ_int⟩ := + exists_region_curve G hS hProper r hr u₁ (subset_closure hu₁r) u₂ (subset_closure hu₂r) + have hγ_sub_r : range γ ⊆ r := by + rintro z ⟨t, rfl⟩ + by_cases ht0 : (t : ℝ) = 0 + · have hteq : t = 0 := Subtype.ext ht0 + rwa [hteq, hγ0] + · by_cases ht1 : (t : ℝ) = 1 + · have hteq : t = 1 := Subtype.ext ht1 + rwa [hteq, hγ1] + · exact hγ_int t ⟨lt_of_le_of_ne t.2.1 (Ne.symm ht0), lt_of_le_of_ne t.2.2 ht1⟩ + obtain ⟨z, hzG, hzγ⟩ := discCrossing_of_isClosedDiscSpace hS + hKG_comp (isCompact_range γ.continuous) hKG_conn (isConnected_range γ.continuous) + hv₁_KG hv₂_KG ⟨0, hγ0⟩ ⟨1, hγ1⟩ hcr + exact not_mem_U_of_mem_region G hr (hγ_sub_r hzγ) (hKG_U hzG) + +/-- If `G` is a connected proper drawing on a closed disc `S` with `G.E = ∅`, then `G` has a +disc dual drawing `G_dual` satisfying `IsDiscDualDrawing G G_dual`. -/ +theorem exists_isDiscDualDrawing_of_edges_empty {S : Type u} [TopologicalSpace S] + (hS : IsClosedDiscSpace S) {G : Drawing S} (hProper : G.IsProper) + (hConn : IsGraphConnected G.toGraph) (hE : G.E = ∅) : + ∃ G_dual : Drawing S, IsDiscDualDrawing G G_dual := by + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + obtain ⟨φ_disc⟩ := hS + have : ConnectedSpace ClosedUnitDisc := + Subtype.connectedSpace ((convex_closedBall (0 : EuclideanPlane) 1).isConnected ⟨0, by simp⟩) + have : PreconnectedSpace S := (φ_disc.surjective.connectedSpace + φ_disc.continuous).toPreconnectedSpace + have hS : IsClosedDiscSpace S := ⟨φ_disc⟩ + obtain ⟨v₀, hv₀⟩ := hConn.1 + have hv₀_V : v₀ ∈ G.V := hv₀ + have hV_eq : G.V = {v₀} := by + ext v + simp only [mem_singleton_iff] + constructor + · intro hv + obtain ⟨W⟩ := hConn.2 v hv v₀ hv₀ + cases W with + | nil => rfl + | cons hlink _ => + have he : _ ∈ G.E := hlink.edge_mem + rw [hE] at he + exact False.elim he + · rintro rfl + exact hv₀_V + have hU_eq : G.U = {v₀} := by + rw [G.U_eq, hE, hV_eq] + simp + have hcompl_conn : IsPreconnected (univ \ G.U) := by + rw [hU_eq] + exact disc_isPreconnected_sdiff_finite hS isOpen_univ isPreconnected_univ (finite_singleton v₀) + have hw₀_exists : ∃ w₀ : S, w₀ ∈ univ \ G.U ∧ + IsDualPointSet (bd S) (G.V ∩ bd S) ({w₀} ∩ bd S) := by + by_cases hv₀_bd : v₀ ∈ bd S + · have hV_bd : G.V ∩ bd S = {v₀} := by + rw [hV_eq, inter_eq_left.mpr (singleton_subset_iff.mpr hv₀_bd)] + obtain ⟨φ⟩ := hS.isOArc_bd + have hinj := injective_oArcMap φ + let z₀ := φ.symm ⟨v₀, hv₀_bd⟩ + have hz₀_map : oArcMap φ '' {z₀} = {v₀} := by + rw [image_singleton] + simp [oArcMap, z₀] + have hnext_eq : nextSegment ({z₀} : Set Circle) z₀ = ({z₀} : Set Circle)ᶜ := by + ext z + simp [nextSegment, compl_eq_univ_sdiff] + have hseg_univ : segmentsOf (univ : Set Circle) {z₀} = {({z₀} : Set Circle)ᶜ} := by + ext seg + rw [mem_segmentsOf_univ_iff (finite_singleton z₀) (singleton_nonempty z₀)] + simp [hnext_eq] + have hseg_bd : segmentsOf (bd S) (G.V ∩ bd S) = {bd S \ {v₀}} := by + rw [hV_bd, ← hz₀_map, segmentsOf_oArcMap φ, hseg_univ, image_singleton, + ← diff_image_oArcMap φ, hz₀_map] + have hmem_seg : bd S \ {v₀} ∈ segmentsOf (bd S) (G.V ∩ bd S) := by + rw [hseg_bd]; exact mem_singleton _ + obtain ⟨w₀, hw₀_bd, hw₀_ne⟩ := segment_nonempty hmem_seg + have hw₀_compl : w₀ ∈ univ \ G.U := by + rw [hU_eq]; exact ⟨trivial, hw₀_ne⟩ + have hw₀_inter : ({w₀} : Set S) ∩ bd S = {w₀} := + inter_eq_left.mpr (singleton_subset_iff.mpr hw₀_bd) + refine ⟨w₀, hw₀_compl, ?_⟩ + refine ⟨?_, ?_⟩ + · intro hemp + rw [hV_bd] at hemp + exact absurd hemp (singleton_ne_empty v₀) + · intro _ + have hw₀_sub : ({w₀} : Set S) ⊆ bd S \ {v₀} := + singleton_subset_iff.mpr ⟨hw₀_bd, hw₀_ne⟩ + rw [hw₀_inter, hseg_bd, hV_bd] + refine ⟨hw₀_sub, fun seg hseg => ?_⟩ + rw [mem_singleton_iff.mp hseg, inter_eq_left.mpr hw₀_sub] + exact ncard_singleton w₀ + · have hV_bd : G.V ∩ bd S = ∅ := by + rw [hV_eq, singleton_inter_eq_empty] + exact hv₀_bd + obtain ⟨D, D', hD, _, hv₀_D', _, hD_sub, hD_bd⟩ := + disc_exists_closedDisc_nbhd hS (isOpen_univ.sdiff (isClosed_bd_of_isClosedDiscSpace hS)) + ⟨mem_univ v₀, hv₀_bd⟩ hv₀_bd + obtain ⟨ψ⟩ := IsClosedDisc.isOArc_discBd hD + let w₀ : S := (ψ 1).1 + have hw₀_discBd : w₀ ∈ discBd D := (ψ 1).2 + have hw₀_diff : w₀ ∈ D \ D' := hD_bd.symm ▸ hw₀_discBd + have hw₀_ne_v₀ : w₀ ≠ v₀ := fun h => hw₀_diff.2 (h ▸ hv₀_D') + have hw₀_not_bd : w₀ ∉ bd S := (hD_sub hw₀_diff.1).2 + have hw₀_compl : w₀ ∈ univ \ G.U := by + rw [hU_eq]; exact ⟨trivial, mem_singleton_iff.not.mpr hw₀_ne_v₀⟩ + have hw₀_inter : ({w₀} : Set S) ∩ bd S = ∅ := + singleton_inter_eq_empty.mpr hw₀_not_bd + refine ⟨w₀, hw₀_compl, ?_⟩ + rw [hV_bd, hw₀_inter] + exact ⟨fun _ => rfl, fun h => False.elim (not_nonempty_empty h)⟩ + obtain ⟨w₀, hw₀_compl, hDualPt⟩ := hw₀_exists + have hR_eq : G.R = {univ \ G.U} := by + ext r + simp only [Drawing.R, componentsIn, mem_singleton_iff] + constructor + · rintro ⟨z, hz, rfl⟩ + exact Subset.antisymm (connectedComponentIn_subset _ _) + (hcompl_conn.subset_connectedComponentIn hz subset_rfl) + · rintro rfl + exact ⟨w₀, hw₀_compl, Subset.antisymm (connectedComponentIn_subset _ _) + (hcompl_conn.subset_connectedComponentIn hw₀_compl subset_rfl)⟩ + let G_dual : Drawing S := { + U := {w₀} + V := {w₀} + V_subset_U := Subset.rfl + isClosed_U := isClosed_singleton + finite_V := finite_singleton w₀ + finite_edges := by + refine finite_empty.subset ?_ + rintro C ⟨⟨x, hx⟩, hsub, -⟩ + exact False.elim ((hsub hx).2 (hsub hx).1) + edge_cond := by + rintro C ⟨⟨x, hx⟩, hsub, -⟩ + exact False.elim ((hsub hx).2 (hsub hx).1) + } + have hGd_V : G_dual.V = {w₀} := rfl + have hGd_U : G_dual.U = {w₀} := rfl + have hGd_E : G_dual.E = ∅ := by + ext C + simp only [mem_empty_iff_false, iff_false] + rintro ⟨⟨x, hx⟩, hsub, -⟩ + exact (hsub hx).2 (hsub hx).1 + refine ⟨G_dual, hProper, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rintro x ⟨_, hxU⟩ + rwa [hGd_U] at hxU + · intro r hr + rw [hR_eq, mem_singleton_iff] at hr + subst hr + refine ⟨w₀, ⟨hw₀_compl, rfl⟩, fun w hw => mem_singleton_iff.mp hw.2⟩ + · intro w hw + rw [hGd_V, mem_singleton_iff] at hw + subst hw + exact ⟨univ \ G.U, by rw [hR_eq]; exact mem_singleton _, hw₀_compl⟩ + · rwa [hGd_V] + · intro v₁ hv₁ v₂ hv₂ _ + rw [hV_eq, mem_singleton_iff] at hv₁ hv₂ + exact hv₁.trans hv₂.symm + · have : IsEmpty G.E := hE ▸ isEmpty_coe_sort.mpr rfl + have : IsEmpty G_dual.E := hGd_E ▸ isEmpty_coe_sort.mpr rfl + exact ⟨Equiv.equivOfIsEmpty G.E G_dual.E, fun e => isEmptyElim e⟩ + +/-- Every non-empty open subset `O` of a closed disc space `S` contains a point outside `bd S`. -/ +theorem open_sdiff_bd_nonempty {S : Type u} [TopologicalSpace S] (hS : IsClosedDiscSpace S) + {O : Set S} (hO : IsOpen O) (hne : O.Nonempty) : (O \ bd S).Nonempty := by + obtain ⟨z, hz⟩ := hne + by_cases hz_bd : z ∈ bd S + · obtain ⟨φ⟩ := hS + have hbd_img := image_bd_homeomorph φ + rw [bd_closedUnitDisc] at hbd_img + let c : ClosedUnitDisc := φ.symm z + have hc_in : c ∈ φ ⁻¹' O := by + change φ c ∈ O + rw [φ.apply_symm_apply] + exact hz + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp (hO.preimage φ.continuous) c hc_in + let δ : ℝ := min (ε / 2) (1 / 2) + have hδ_pos : 0 < δ := lt_min (half_pos hε) (by norm_num) + have hδ_lt_one : δ < 1 := lt_of_le_of_lt (min_le_right _ _) (by norm_num) + have hδ_lt_ε : δ < ε := lt_of_le_of_lt (min_le_left _ _) (half_lt_self hε) + have hc_norm : ‖(c : EuclideanPlane)‖ ≤ 1 := mem_closedBall_zero_iff.mp c.2 + let t : ℝ := 1 - δ + have ht_nonneg : 0 ≤ t := by linarith + have ht_lt_one : t < 1 := by dsimp [t]; linarith + have hy_mem : t • (c : EuclideanPlane) ∈ ClosedUnitDisc := by + change t • (c : EuclideanPlane) ∈ Metric.closedBall 0 1 + rw [Metric.mem_closedBall, dist_zero_right, norm_smul, + Real.norm_eq_abs, abs_of_nonneg ht_nonneg] + nlinarith + let y : ClosedUnitDisc := ⟨t • (c : EuclideanPlane), hy_mem⟩ + have hy_in_O : φ y ∈ O := by + apply hball + rw [Metric.mem_ball, Subtype.dist_eq, dist_eq_norm] + have hdiff : y.1 - c.1 = (-δ) • c.1 := by + dsimp [y, t] + rw [sub_smul, one_smul, sub_sub_cancel_left, neg_smul] + rw [hdiff, norm_smul, Real.norm_eq_abs, abs_neg, abs_of_pos hδ_pos] + nlinarith + have hy_not_bd : φ y ∉ bd S := by + rw [← hbd_img] + rintro ⟨c', hc', hφc'⟩ + have heq : c' = y := φ.injective hφc' + subst heq + have h1 : ‖y.1‖ = 1 := by simpa [UnitCircle] using hc' + have hlt : ‖y.1‖ < 1 := by + dsimp [y] + rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg ht_nonneg] + nlinarith + linarith + exact ⟨φ y, hy_in_O, hy_not_bd⟩ + · exact ⟨z, hz, hz_bd⟩ + +/-- For any connected proper drawing `G` on a closed disc `S`, there exists a finite set `W` of +dual vertices containing a unique vertex in each region `r ∈ G.R` such that `W ∩ bd S` is a dual +point set for `(bd S, G.V ∩ bd S)`. -/ +theorem exists_dual_vertices_of_connected {S : Type u} [TopologicalSpace S] + (hS : IsClosedDiscSpace S) {G : Drawing S} (hProper : G.IsProper) + (hConn : IsGraphConnected G.toGraph) : + ∃ W : Set S, W.Finite ∧ + (∀ r ∈ G.R, ∃! w, w ∈ r ∧ w ∈ W) ∧ + (∀ w ∈ W, ∃ r ∈ G.R, w ∈ r) ∧ + IsDualPointSet (bd S) (G.V ∩ bd S) (W ∩ bd S) := by + classical + have : T2Space S := t2Space_of_isClosedDiscSpace hS + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hS + have hseg_sub_compl : ∀ s ∈ segmentsOf (bd S) (G.V ∩ bd S), s ⊆ univ \ G.U := by + intro s hs z hz + obtain ⟨⟨x, _, rfl⟩, _⟩ := hs + have hz_diff : z ∈ bd S \ (G.V ∩ bd S) := connectedComponentIn_subset _ _ hz + exact ⟨trivial, fun hzU => hz_diff.2 ⟨hProper ⟨hz_diff.1, hzU⟩, hz_diff.1⟩⟩ + have hseg_sub_region : ∀ r ∈ G.R, ∀ s ∈ segmentsOf (bd S) (G.V ∩ bd S), + (r ∩ s).Nonempty → s ⊆ r := by + rintro r hr s hs ⟨u, hur, hus⟩ z hz + have hs' := hs + obtain ⟨⟨x, _, rfl⟩, _⟩ := hs' + exact subset_region hr isPreconnected_connectedComponentIn + (disjoint_left.mpr fun q hq => (hseg_sub_compl _ hs hq).2) hus hur hz + have hw_exists : ∀ r : G.R, ∃ w : S, w ∈ r.1 ∧ + ((∃ s ∈ segmentsOf (bd S) (G.V ∩ bd S), (r.1 ∩ s).Nonempty) → + ∃ s ∈ segmentsOf (bd S) (G.V ∩ bd S), w ∈ s) ∧ + (¬ (∃ s ∈ segmentsOf (bd S) (G.V ∩ bd S), (r.1 ∩ s).Nonempty) → w ∉ bd S) := by + intro r + by_cases h_seg : ∃ s ∈ segmentsOf (bd S) (G.V ∩ bd S), (r.1 ∩ s).Nonempty + · have h_seg' := h_seg + obtain ⟨s, hs, hrs⟩ := h_seg' + obtain ⟨w, hws⟩ := segment_nonempty hs + exact ⟨w, hseg_sub_region r.1 r.2 s hs hrs hws, fun _ => ⟨s, hs, hws⟩, + fun hnot => False.elim (hnot h_seg)⟩ + · obtain ⟨w, hwr, hw_not_bd⟩ := + open_sdiff_bd_nonempty hS (region_isOpen r.2) (region_nonempty r.2) + exact ⟨w, hwr, fun h => False.elim (h_seg h), fun _ => hw_not_bd⟩ + choose w_of hw_in hw_seg hw_not_bd using hw_exists + let W : Set S := range w_of + have hR_fin : G.R.Finite := disc_finite_R hS G hProper + have : Finite G.R := hR_fin.to_subtype + refine ⟨W, finite_range w_of, ?_, ?_, ?_⟩ + · intro r hr + let r_sub : G.R := ⟨r, hr⟩ + refine ⟨w_of r_sub, ⟨hw_in r_sub, mem_range_self r_sub⟩, ?_⟩ + rintro w ⟨hwr, ⟨r', rfl⟩⟩ + have heq : r' = r_sub := Subtype.ext (region_eq_of_mem r'.2 hr (hw_in r') hwr) + rw [heq] + · rintro _ ⟨r, rfl⟩ + exact ⟨r.1, r.2, hw_in r⟩ + · refine ⟨?_, ?_⟩ + · intro hV_emp + ext x + simp only [mem_inter_iff, mem_empty_iff_false, iff_false, not_and] + rintro ⟨r, rfl⟩ hx_bd + have h_no_seg : ¬ ∃ s ∈ segmentsOf (bd S) (G.V ∩ bd S), (r.1 ∩ s).Nonempty := by + rintro ⟨s, hs, _⟩ + have hne := nonempty_of_mem_segmentsOf hS.isOArc_bd hs + rw [hV_emp] at hne + exact not_nonempty_empty hne + exact hw_not_bd r h_no_seg hx_bd + · intro _ + refine ⟨?_, fun seg hseg => ?_⟩ + · rintro x ⟨⟨r, rfl⟩, hx_bd⟩ + exact ⟨hx_bd, fun hxV => region_subset r.2 (hw_in r) (G.V_subset_U hxV.1)⟩ + · obtain ⟨u, hus⟩ := segment_nonempty hseg + obtain ⟨r, hr, hur⟩ := exists_region_of_notMem (hseg_sub_compl seg hseg hus).2 + let r_sub : G.R := ⟨r, hr⟩ + have h_non : (r ∩ seg).Nonempty := ⟨u, hur, hus⟩ + obtain ⟨s', hs', hws'⟩ := hw_seg r_sub ⟨seg, hseg, h_non⟩ + have hs'_eq : s' = seg := + region_inter_segmentsOf_subsingleton hS hProper hConn hr hs' hseg + ⟨w_of r_sub, hw_in r_sub, hws'⟩ h_non + rw [hs'_eq] at hws' + have hw_bd : w_of r_sub ∈ bd S := by + obtain ⟨⟨x, _, rfl⟩, _⟩ := hseg + exact (connectedComponentIn_subset _ _ hws').1 + have hw_mem_inter : w_of r_sub ∈ (W ∩ bd S) ∩ seg := + ⟨⟨mem_range_self r_sub, hw_bd⟩, hws'⟩ + rw [ncard_eq_one] + refine ⟨w_of r_sub, Subset.antisymm ?_ (singleton_subset_iff.mpr hw_mem_inter)⟩ + rintro x ⟨⟨⟨r', rfl⟩, _⟩, hx_seg⟩ + rw [mem_singleton_iff] + have hx_in_r : w_of r' ∈ r := hseg_sub_region r hr seg hseg h_non hx_seg + have hr'_eq : r' = r_sub := Subtype.ext (region_eq_of_mem r'.2 hr (hw_in r') hx_in_r) + rw [hr'_eq] + +/-- Complete equivalence of **Graph Minors VI, (3.6)** (pages 121–122), combining necessity +(`isCrossFree_of_isFeasible` and `chainRedundancy_nonneg_of_isFeasible`) and the sufficiency +induction (`isFeasible_of_isCrossFree_of_chainRedundancy_nonneg`). -/ +theorem isFeasible_iff_of_exists_isDiscDualDrawing {S : Type u} [TopologicalSpace S] + (hS : IsClosedDiscSpace S) + (hDualExists : ∀ (G : Drawing S), G.IsProper → IsGraphConnected G.toGraph → + ∃ G_dual : Drawing S, IsDiscDualDrawing G G_dual) + (G : Drawing S) (Δ : Set (Set S)) {U : Set S} + (hProper : G.IsProper) (hΔ : IsDivision Δ) (hΔ_eq : divisionUnion Δ = G.V ∩ bd S) + (hU : IsDualPointSet (bd S) (divisionUnion Δ) U) : + IsFeasible G.toGraph Δ ↔ + IsCrossFree (bd S) Δ ∧ + ∀ x ∈ U ∪ divisionUnion Δ, ∀ y ∈ U ∪ divisionUnion Δ, + ∀ A : List (ChainTerm S), IsXYChain G x y A → 0 ≤ chainRedundancy G Δ x y A := + ⟨fun hFeas => + ⟨isCrossFree_of_isFeasible hS hFeas, + fun _ _ _ _ _ hChain => + chainRedundancy_nonneg_of_isFeasible hS hProper hΔ_eq hFeas hChain⟩, + fun ⟨hCF, hRed⟩ => + isFeasible_of_isCrossFree_of_chainRedundancy_nonneg hS hDualExists hProper hΔ hΔ_eq hU hCF + hRed⟩ + +end GraphMinor.GM06 diff --git a/LeanPool/GraphMinor/GM07/AlphaExists.lean b/LeanPool/GraphMinor/GM07/AlphaExists.lean new file mode 100644 index 0000000000..44d7039ecf --- /dev/null +++ b/LeanPool/GraphMinor/GM07/AlphaExists.lean @@ -0,0 +1,591 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section11 +public import LeanPool.GraphMinor.GM07.Section11f +public import LeanPool.GraphMinor.GM11.LocalCone +public import LeanPool.GraphMinor.GM11.GlueFaces +public import LeanPool.GraphMinor.GM19.Conditional +import LeanPool.GraphMinor.GM19.Section6a +import LeanPool.GraphMinor.Surface.Epstein + +/-! +# Existence of `α(G)` Candidates (`GM19.GM07AlphaExistsStatement`) + +This file proves the remark in Graph Minors VII, Section 5 (page 230) on the existence of a +solid, connected, `G`-normal, non-near-planar subset `X ⊆ S` (`IsAlphaCandidate G X`) on any +connected surface without boundary (`bd S = ∅`) that is not a 2-sphere (`¬ IsSphere S`), +unconditionally concluding `GM19.GM07AlphaExistsStatement`. + +## Main results +- `exists_goodOpen`: Every point `z : S` on a closed surface `S` has an open neighborhood `O` + contained in a closed disc `D` such that any two points `x, y ∈ O \ G.U` are joined by a path in + `D` and a homotopic path in `(G.U \ G.V)ᶜ`. +- `exists_homotopic_normal_path`: Every path in `S` with endpoints outside `G.U` is homotopic with + fixed endpoints to a `G`-normal path in `(G.U \ G.V)ᶜ`. +- `exists_homotopic_normal_curve`: Every closed curve `φ : C(Circle, S)` on a closed connected + surface `S` is homotopic in `S` to a `G`-normal closed curve `ψ : C(Circle, S)`. +- `gm07_alpha_exists_core`: Unconditional proof of `GM19.GM07AlphaExistsStatement`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Function Topology Metric Filter unitInterval +open GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- An open set `O` is *good* for a drawing `G` if `O` is contained in a closed disc `D` and any +two points `x, y ∈ O \ G.U` are joined by a path `p` in `D` and a homotopic path `q` in +`(G.U \ G.V)ᶜ`. -/ +def GoodOpen (G : Drawing S) (O : Set S) : Prop := + IsOpen O ∧ ∃ D : Set S, IsClosedDisc D ∧ O ⊆ D ∧ + ∀ x ∈ O \ G.U, ∀ y ∈ O \ G.U, + ∃ (p q : Path x y), (∀ u, p u ∈ D) ∧ (∀ u, q u ∈ (G.U \ G.V)ᶜ) ∧ p.Homotopic q + +theorem goodOpen_of_joinedIn (G : Drawing S) {O D : Set S} (hO : IsOpen O) (hD : IsClosedDisc D) + (hOD : O ⊆ D) + (hjoin : ∀ x ∈ O \ G.U, ∀ y ∈ O \ G.U, JoinedIn (D ∩ (G.U \ G.V)ᶜ) x y) : + GoodOpen G O := by + refine ⟨hO, D, hD, hOD, fun x hx y hy => ?_⟩ + obtain ⟨p, hp⟩ := hjoin x hx y hy + exact ⟨p, p, fun u => (hp u).1, fun u => (hp u).2, Path.Homotopic.refl p⟩ + +/-- In a locally path-connected space, any two points in a preconnected subset `A` of an open set +`U` are joined by a path in `U`. -/ +theorem joinedIn_of_isOpen_of_isPreconnected [LocallyPathConnectedSpace S] + {U A : Set S} (hU : IsOpen U) (hA : IsPreconnected A) (hAU : A ⊆ U) + {x y : S} (hx : x ∈ A) (hy : y ∈ A) : + JoinedIn U x y := by + have hsub := hA.subset_connectedComponentIn hx hAU + have hpc : IsPathConnected (connectedComponentIn U x) := + (hU.connectedComponentIn).isConnected_iff_isPathConnected.mp + ⟨⟨x, mem_connectedComponentIn (hAU hx)⟩, isPreconnected_connectedComponentIn⟩ + exact (hpc.joinedIn x (mem_connectedComponentIn (hAU hx)) y (hsub hy)).mono + (connectedComponentIn_subset U x) + +/-- Case 1: Every point `z ∉ G.U` has a good open neighborhood. -/ +theorem exists_goodOpen_of_notMem_U (hS : IsClosedSurface S) (G : Drawing S) {z : S} + (hz : z ∉ G.U) : + ∃ O : Set S, z ∈ O ∧ GoodOpen G O := by + have : T2Space S := hS.2.1 + obtain ⟨D, D', hD, hD', hzD', hD'D, hDU, -⟩ := + exists_closedDisc_nbhd hS G.isClosed_U.isOpen_compl hz + refine ⟨D', hzD', goodOpen_of_joinedIn G hD' hD hD'D fun x hx y hy => ?_⟩ + refine (hD.isPathConnected.joinedIn x (hD'D hx.1) y (hD'D hy.1)).mono fun w hw => ?_ + exact ⟨hw, fun h => hDU hw h.1⟩ + +/-- Case 2a: A polar chart at a vertex `z ∈ G.V` gives a good open neighborhood. -/ +theorem exists_goodOpen_of_isPolar [T2Space S] {G : Drawing S} {z : S} (hzV : z ∈ G.V) + {Φ : C(ClosedUnitDisc, S)} (hp : IsPolar G z Φ) : + ∃ O : Set S, z ∈ O ∧ GoodOpen G O := by + have : CompactSpace ClosedUnitDisc := isCompact_iff_compactSpace.mp (isCompact_closedBall 0 1) + have hemb : IsEmbedding Φ := (Φ.continuous.isClosedEmbedding hp.inj).isEmbedding + have hD : IsClosedDisc (range Φ) := ⟨hemb.toHomeomorph⟩ + refine ⟨interior (range Φ), hp.nhd, + goodOpen_of_joinedIn G isOpen_interior hD interior_subset fun x hx y hy => ?_⟩ + have hray_join : ∀ w ∈ interior (range Φ) \ G.U, + JoinedIn (range Φ ∩ (G.U \ G.V)ᶜ) z w := by + intro w ⟨hw_int, hwU⟩ + obtain ⟨u, rfl⟩ := interior_subset hw_int + have huc : u ≠ polarCentre := by + rintro rfl + exact hwU (hp.centre.symm ▸ G.V_subset_U hzV) + have hcont : Continuous fun t : I => Φ (discScale t u) := + (Φ.continuous.comp continuous_discScale).comp (Continuous.prodMk continuous_id + continuous_const) + refine ⟨⟨⟨fun t => Φ (discScale t u), hcont⟩, by simp [discScale_zero, hp.centre], + by simp [discScale_one]⟩, fun t => ⟨mem_range_self _, ?_⟩⟩ + change Φ (discScale t u) ∈ (G.U \ G.V)ᶜ + rcases eq_or_lt_of_le (unitInterval.nonneg t) with h0 | h0 + · have ht0 : t = 0 := Subtype.ext h0.symm + rw [ht0, discScale_zero, hp.centre] + exact fun h => h.2 hzV + · obtain ⟨a, ha, h1, h2⟩ := hp.ray u huc t h0 + intro hU_diff + rcases ha with (⟨v, hv, rfl⟩ | he) | hr + · exact hwU (h1.symm ▸ G.V_subset_U hv) + · exact hwU (he.2.1 h1).1 + · exact region_subset hr h2 hU_diff.1 + exact (hray_join x hx).symm.trans (hray_join y hy) + +/-- Case 2: Every vertex `z ∈ G.V` has a good open neighborhood. -/ +theorem exists_goodOpen_of_mem_V (hS : IsClosedSurface S) (G : Drawing S) {z : S} + (hzV : z ∈ G.V) : + ∃ O : Set S, z ∈ O ∧ GoodOpen G O := by + classical + have : T2Space S := hS.2.1 + have : Nonempty S := ⟨z⟩ + have : LocallyPathConnectedSpace S := IsClosedSurface.locallyPathConnectedSpace hS + obtain ⟨γ, hγ⟩ := exists_edgePar G + by_cases h2 : 2 ≤ Nat.card (halfEdges G γ z) + · obtain ⟨Φ, hΦ⟩ := exists_isPolar_of_sectors hS hγ hzV h2 + exact exists_goodOpen_of_isPolar hzV hΦ + · have hfinH : Finite (halfEdges G γ z) := (finite_halfEdges G γ z).to_subtype + have hss : Subsingleton (halfEdges G γ z) := + Finite.card_le_one_iff_subsingleton.mp (by omega) + rcases isEmpty_or_nonempty (halfEdges G γ z) with h0 | ⟨⟨⟨e, b⟩, he, hb⟩⟩ + · have hno : ∀ g ∈ G.E, z ∉ closure g := by + intro g hg hzg + obtain ⟨b, hb⟩ := exists_end_eq hγ hg hzV hzg + exact h0.false ⟨(g, b), hg, hb⟩ + let T : Set S := (G.V \ {z}) ∪ ⋃ g ∈ G.E, closure g + have hT : IsClosed T := (G.finite_V.subset sdiff_subset).isClosed.union + (G.finite_edges.isClosed_biUnion fun _ _ => isClosed_closure) + have hzT : z ∉ T := by + rintro (h | h) + · exact h.2 rfl + · obtain ⟨g, hg, hzg⟩ := mem_iUnion₂.mp h + exact hno g hg hzg + obtain ⟨D, D', hD, hD', hzD', hD'D, hDT, -⟩ := + exists_closedDisc_nbhd hS hT.isOpen_compl hzT + refine ⟨D', hzD', goodOpen_of_joinedIn G hD' hD hD'D fun x hx y hy => ?_⟩ + refine (hD.isPathConnected.joinedIn x (hD'D hx.1) y (hD'D hy.1)).mono fun w hw => ⟨hw, ?_⟩ + rintro ⟨hwU, hwV⟩ + obtain ⟨g, hg, hwg⟩ := G.exists_edge_of_mem hwU hwV + exact hDT hw (Or.inr (mem_iUnion₂.mpr ⟨g, hg, subset_closure hwg⟩)) + · have hleaf : ∀ f ∈ G.E, f ≠ e → z ∉ closure f := by + intro f hf hfe hzf + obtain ⟨b', hb'⟩ := exists_end_eq hγ hf hzV hzf + have := congrArg (fun k : halfEdges G γ z => k.1.1) + (hss.elim ⟨(f, b'), hf, hb'⟩ ⟨(e, b), he, hb⟩) + exact hfe this + have hzcl : z ∈ closure e := by + have := end_mem_closure hγ he b + rwa [hb] at this + have hnot_loop : ∃ u : S, u ≠ z ∧ closure e ∩ G.V = {u, z} ∧ IsLineWithEnds (closure e) u z + := by + rcases G.edge_cond e he with ⟨u, v, huv, hcap, hl⟩ | ⟨u, hu, -⟩ + · have hz_uv : z = u ∨ z = v := by + have : z ∈ closure e ∩ G.V := ⟨hzcl, hzV⟩ + rwa [hcap, mem_insert_iff, mem_singleton_iff] at this + rcases hz_uv with rfl | rfl + · exact ⟨v, huv.symm, by rw [pair_comm]; exact hcap, hl.symm⟩ + · exact ⟨u, huv, hcap, hl⟩ + · exfalso + have hend : ∀ c, γ e (endOf c) = z := by + intro c + have h₁ : γ e (endOf c) ∈ closure e ∩ G.V := by + refine ⟨end_mem_closure hγ he c, ?_⟩ + cases c + · exact hγ.zero e he + · exact hγ.one e he + have h₂ : z ∈ closure e ∩ G.V := ⟨hzcl, hzV⟩ + rw [hu] at h₁ h₂ + exact h₁.trans h₂.symm + have := congrArg (fun k : halfEdges G γ z => k.1.2) + (hss.elim ⟨(e, true), he, hend true⟩ ⟨(e, false), he, hend false⟩) + simp at this + obtain ⟨u, huz, hcap, hL⟩ := hnot_loop + obtain ⟨D, D', hD, hD', hzD', hD'D, -, -⟩ := + exists_closedDisc_nbhd hS isOpen_univ (mem_univ z) + obtain ⟨Z, hZ, hzZ, hZ_conn⟩ := + exists_leaf_nbhd hS G he huz hcap hL hleaf hD' hzD' + refine ⟨Z ∩ D', ⟨hzZ, hzD'⟩, + goodOpen_of_joinedIn G (hZ.inter hD') hD (inter_subset_right.trans hD'D) + fun x hx y hy => ?_⟩ + obtain ⟨A, hA_conn, hA_disj, hxA, hyA, hAD'⟩ := + hZ_conn x hx.1.1 hx.2 y hy.1.1 hy.2 + have hAU : A ⊆ D' \ G.U := fun w hw => ⟨hAD' hw, disjoint_left.mp hA_disj hw⟩ + have hj := joinedIn_of_isOpen_of_isPreconnected (hD'.sdiff G.isClosed_U) hA_conn hAU hxA hyA + exact hj.mono fun w ⟨hwD', hwU⟩ => ⟨hD'D hwD', fun h => hwU h.1⟩ + +theorem pathsHomotopic_of_mem_disc {D : Set S} (hD : IsClosedDisc D) {a b : S} + (p q : Path a b) (hp : ∀ u, p u ∈ D) (hq : ∀ u, q u ∈ D) : + p.Homotopic q := by + have ha : a ∈ D := by simpa using hp 0 + have hb : b ∈ D := by simpa using hp 1 + exact (hD.isSimplyConnectedSet.pathsHomotopic + (pathCod p ha hb hp) (pathCod q ha hb hq)).map + (f := (⟨Subtype.val, continuous_subtype_val⟩ : C(D, S))) + +theorem path_trans_mem {A : Set S} {a b c : S} {p : Path a b} {q : Path b c} + (hp : ∀ u, p u ∈ A) (hq : ∀ u, q u ∈ A) (u : I) : (p.trans q) u ∈ A := by + have : (p.trans q) u ∈ range p ∪ range q := Path.trans_range p q ▸ mem_range_self u + rcases this with ⟨v, hv⟩ | ⟨v, hv⟩ + · exact hv ▸ hp v + · exact hv ▸ hq v + +theorem path_symm_mem {A : Set S} {a b : S} {p : Path a b} + (hp : ∀ u, p u ∈ A) (u : I) : p.symm u ∈ A := by + rw [Path.symm_apply] + exact hp _ + +theorem path_homotopic_symm {a b : S} {p q : Path a b} (h : p.Homotopic q) : + p.symm.Homotopic q.symm := by + obtain ⟨H⟩ := h + exact ⟨H.symm₂⟩ + +theorem IsEdgeChart.lower_pathConnected {G : Drawing S} {γ : I → S} {t₀ a b : I} + {M : ℂ → S} (c : IsEdgeChart G γ t₀ M a b) : + IsPathConnected (M '' IsEdgeChart.lower) := by + have hzl : (⟨0, -1 / 2⟩ : ℂ) ∈ IsEdgeChart.lower := by + refine ⟨?_, by norm_num⟩ + rw [mem_closedBall, dist_zero_right] + have : ‖(⟨0, -1 / 2⟩ : ℂ)‖ = 1 / 2 := by + rw [Complex.norm_def, Complex.normSq_mk] + rw [show (0 : ℝ) * 0 + -1 / 2 * (-1 / 2) = (1 / 2) ^ 2 by ring] + exact Real.sqrt_sq (by norm_num) + linarith + refine ⟨M ⟨0, -1 / 2⟩, ⟨_, hzl, rfl⟩, ?_⟩ + rintro _ ⟨w, hw, rfl⟩ + obtain ⟨p, hp⟩ := (IsEdgeChart.convex_lower.isPathConnected ⟨_, hzl⟩).joinedIn _ hzl w hw + exact ⟨{ toFun := fun u => M (p u) + continuous_toFun := c.cont.comp_continuous p.continuous fun u => (hp u).1 + source' := by simp + target' := by simp }, fun u => ⟨p u, hp u, rfl⟩⟩ + +theorem IsEdgeChart.upper_pathConnected {G : Drawing S} {γ : I → S} {t₀ a b : I} + {M : ℂ → S} (c : IsEdgeChart G γ t₀ M a b) : + IsPathConnected (M '' IsEdgeChart.upper) := by + have hzu : (⟨0, 1 / 2⟩ : ℂ) ∈ IsEdgeChart.upper := by + refine ⟨?_, by norm_num⟩ + rw [mem_closedBall, dist_zero_right] + have : ‖(⟨0, 1 / 2⟩ : ℂ)‖ = 1 / 2 := by + rw [Complex.norm_def, Complex.normSq_mk] + rw [show (0 : ℝ) * 0 + 1 / 2 * (1 / 2) = (1 / 2) ^ 2 by ring] + exact Real.sqrt_sq (by norm_num) + linarith + refine ⟨M ⟨0, 1 / 2⟩, ⟨_, hzu, rfl⟩, ?_⟩ + rintro _ ⟨w, hw, rfl⟩ + obtain ⟨p, hp⟩ := (IsEdgeChart.convex_upper.isPathConnected ⟨_, hzu⟩).joinedIn _ hzu w hw + exact ⟨{ toFun := fun u => M (p u) + continuous_toFun := c.cont.comp_continuous p.continuous fun u => (hp u).1 + source' := by simp + target' := by simp }, fun u => ⟨p u, hp u, rfl⟩⟩ + +/-- Case 3: Every point `z ∈ e` (`e ∈ G.E`) has a good open neighborhood. -/ +theorem exists_goodOpen_of_mem_edge (hS : IsClosedSurface S) (G : Drawing S) {e : Set S} + (he : e ∈ G.E) {z : S} (hz : z ∈ e) : + ∃ O : Set S, z ∈ O ∧ GoodOpen G O := by + have : T2Space S := hS.2.1 + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + obtain ⟨γ, hγ, hγ0, hγ1, hinj, hγe⟩ := exists_edge_param G he + let T : Set I := {t : I | ∃ O : Set S, γ t ∈ O ∧ GoodOpen G O} + have h0T : (0 : I) ∈ T := exists_goodOpen_of_mem_V hS G hγ0 + have h1T : (1 : I) ∈ T := exists_goodOpen_of_mem_V hS G hγ1 + have hT_open : IsOpen T := by + rw [isOpen_iff_forall_mem_open] + rintro t ⟨O, htO, hGO⟩ + exact ⟨γ ⁻¹' O, fun s hs => ⟨O, hs, hGO⟩, hGO.1.preimage hγ, htO⟩ + have hT_closed : IsClosed T := by + rw [← closure_subset_iff_isClosed] + intro t₀ ht₀_cl + rcases eq_or_lt_of_le (unitInterval.nonneg t₀) with h0 | h0 + · exact (Subtype.ext h0.symm : t₀ = 0) ▸ h0T + rcases eq_or_lt_of_le (unitInterval.le_one t₀) with h1 | h1 + · exact (Subtype.ext h1 : t₀ = 1) ▸ h1T + have ht₀ : t₀ ∈ Ioo (0 : I) 1 := ⟨h0, h1⟩ + obtain ⟨M, a, b, g₁, g₂, _, g₄, g₅, _, g₇, g₈, g₉, g₁₀, g₁₁⟩ := + exists_edge_chart hS G he hγ hγ0 hγ1 hinj hγe ht₀ ht₀.1 ht₀.2 + have c : IsEdgeChart G γ t₀ M a b := ⟨g₁, g₂, g₄, g₅, g₇, g₈, g₉, g₁₀, g₁₁⟩ + let O : Set S := M '' ball 0 1 + have hO_open : IsOpen O := by + change IsOpen (M '' ball 0 1) + rw [← c.discInt_eq] + exact c.isClosedDisc.isOpen_discInt hman + have ht₀_O : γ t₀ ∈ O := ⟨0, by simp, c.zero⟩ + have hOD : O ⊆ c.disc := image_mono ball_subset_closedBall + obtain ⟨t₁, ⟨ht₁_ab, ⟨O₁, ht₁_O₁, hO₁_open, D₁, hD₁, hO₁D₁, hO₁_join⟩⟩⟩ := + mem_closure_iff.mp ht₀_cl (Ioo a b) isOpen_Ioo ⟨c.left, c.right⟩ + have hγt₁_ball : γ t₁ ∈ M '' {z | z ∈ ball (0 : ℂ) 1 ∧ z.im = 0} := by + rw [c.ball_eq] + exact ⟨t₁, ht₁_ab, rfl⟩ + obtain ⟨z₁, ⟨hz₁_ball, hz₁_im⟩, hMz₁⟩ := hγt₁_ball + have hγt₁_O : γ t₁ ∈ O₁ ∩ O := ⟨ht₁_O₁, z₁, hz₁_ball, hMz₁⟩ + obtain ⟨E, E', hE, hE', hγt₁_E', hE'E, hE_sub, -⟩ := + exists_closedDisc_nbhd hS (hO₁_open.inter hO_open) hγt₁_O + have hcont_z₁ : ContinuousAt M z₁ := + c.cont.continuousAt (mem_of_superset (isOpen_ball.mem_nhds hz₁_ball) ball_subset_closedBall) + have hnhds : M ⁻¹' E' ∩ ball (0 : ℂ) 1 ∈ 𝓝 z₁ := + Filter.inter_mem (hcont_z₁.preimage_mem_nhds (hE'.mem_nhds (hMz₁.symm ▸ hγt₁_E'))) + (isOpen_ball.mem_nhds hz₁_ball) + obtain ⟨δ, hδ_pos, hδ_ball⟩ := Metric.mem_nhds_iff.mp hnhds + let w_low : ℂ := z₁ - ((δ / 2 : ℝ) : ℂ) * Complex.I + let w_up : ℂ := z₁ + ((δ / 2 : ℝ) : ℂ) * Complex.I + have hw_low_mem : w_low ∈ ball z₁ δ := by + rw [mem_ball, dist_eq_norm, sub_sub_cancel_left, norm_neg, norm_mul, Complex.norm_I, mul_one, + Complex.norm_real, Real.norm_eq_abs, abs_of_pos (half_pos hδ_pos)] + linarith + have hw_up_mem : w_up ∈ ball z₁ δ := by + rw [mem_ball, dist_eq_norm, add_sub_cancel_left, norm_mul, Complex.norm_I, mul_one, + Complex.norm_real, Real.norm_eq_abs, abs_of_pos (half_pos hδ_pos)] + linarith + have hw_low_in : w_low ∈ IsEdgeChart.lower := by + refine ⟨ball_subset_closedBall (hδ_ball hw_low_mem).2, ?_⟩ + simp [w_low, hz₁_im] + linarith + have hw_up_in : w_up ∈ IsEdgeChart.upper := by + refine ⟨ball_subset_closedBall (hδ_ball hw_up_mem).2, ?_⟩ + simp [w_up, hz₁_im] + linarith + let x_L : S := M w_low + let x_U : S := M w_up + have hx_L_L : x_L ∈ M '' IsEdgeChart.lower := ⟨w_low, hw_low_in, rfl⟩ + have hx_U_U : x_U ∈ M '' IsEdgeChart.upper := ⟨w_up, hw_up_in, rfl⟩ + have hx_L_E' : x_L ∈ E' := (hδ_ball hw_low_mem).1 + have hx_U_E' : x_U ∈ E' := (hδ_ball hw_up_mem).1 + have hx_L_notU : x_L ∉ G.U := disjoint_left.mp c.lower_disjoint hx_L_L + have hx_U_notU : x_U ∉ G.U := disjoint_left.mp c.upper_disjoint hx_U_U + obtain ⟨p₁, q₀, hp₁D₁, hq₀G, hp₁q₀⟩ := + hO₁_join x_L ⟨(hE_sub (hE'E hx_L_E')).1, hx_L_notU⟩ + x_U ⟨(hE_sub (hE'E hx_U_E')).1, hx_U_notU⟩ + obtain ⟨p₀, hp₀E⟩ := hE.isPathConnected.joinedIn x_L (hE'E hx_L_E') x_U (hE'E hx_U_E') + have hp₀D : ∀ u, p₀ u ∈ c.disc := fun u => hOD (hE_sub (hp₀E u)).2 + have hp₀D₁ : ∀ u, p₀ u ∈ D₁ := fun u => hO₁D₁ (hE_sub (hp₀E u)).1 + have hp₀q₀ : p₀.Homotopic q₀ := + (pathsHomotopic_of_mem_disc hD₁ p₀ p₁ hp₀D₁ hp₁D₁).trans hp₁q₀ + have hL_sub : M '' IsEdgeChart.lower ⊆ c.disc ∩ (G.U \ G.V)ᶜ := by + rintro _ ⟨w, hw, rfl⟩ + exact ⟨⟨w, hw.1, rfl⟩, fun h => disjoint_left.mp c.lower_disjoint ⟨w, hw, rfl⟩ h.1⟩ + have hU_sub : M '' IsEdgeChart.upper ⊆ c.disc ∩ (G.U \ G.V)ᶜ := by + rintro _ ⟨w, hw, rfl⟩ + exact ⟨⟨w, hw.1, rfl⟩, fun h => disjoint_left.mp c.upper_disjoint ⟨w, hw, rfl⟩ h.1⟩ + have h_side : ∀ w ∈ O \ G.U, w ∈ M '' IsEdgeChart.lower ∨ w ∈ M '' IsEdgeChart.upper := by + rintro _ ⟨⟨z, hz, rfl⟩, hnU⟩ + rcases IsEdgeChart.cases_of_closedBall (ball_subset_closedBall hz) with h | h | h + · exact Or.inl ⟨z, h, rfl⟩ + · exact absurd ((c.mem_U z (ball_subset_closedBall hz)).mpr h) hnU + · exact Or.inr ⟨z, h, rfl⟩ + refine ⟨O, ht₀_O, hO_open, c.disc, c.isClosedDisc, hOD, fun x hx y hy => ?_⟩ + rcases h_side x hx with hxL | hxU <;> rcases h_side y hy with hyL | hyU + · obtain ⟨p, hp⟩ := ((IsEdgeChart.lower_pathConnected c).joinedIn x hxL y hyL).mono hL_sub + exact ⟨p, p, fun u => (hp u).1, fun u => (hp u).2, Path.Homotopic.refl p⟩ + · obtain ⟨α, hα⟩ := ((IsEdgeChart.lower_pathConnected c).joinedIn x hxL x_L hx_L_L).mono hL_sub + obtain ⟨β, hβ⟩ := ((IsEdgeChart.upper_pathConnected c).joinedIn x_U hx_U_U y hyU).mono hU_sub + refine ⟨α.trans (p₀.trans β), α.trans (q₀.trans β), + path_trans_mem (fun u => (hα u).1) (path_trans_mem hp₀D fun u => (hβ u).1), + path_trans_mem (fun u => (hα u).2) (path_trans_mem hq₀G fun u => (hβ u).2), + (Path.Homotopic.refl α).hcomp (hp₀q₀.hcomp (Path.Homotopic.refl β))⟩ + · obtain ⟨α, hα⟩ := ((IsEdgeChart.upper_pathConnected c).joinedIn x hxU x_U hx_U_U).mono hU_sub + obtain ⟨β, hβ⟩ := ((IsEdgeChart.lower_pathConnected c).joinedIn x_L hx_L_L y hyL).mono hL_sub + refine ⟨α.trans (p₀.symm.trans β), α.trans (q₀.symm.trans β), + path_trans_mem (fun u => (hα u).1) (path_trans_mem (path_symm_mem hp₀D) fun u => (hβ u).1), + path_trans_mem (fun u => (hα u).2) (path_trans_mem (path_symm_mem hq₀G) fun u => (hβ u).2), + (Path.Homotopic.refl α).hcomp ((path_homotopic_symm hp₀q₀).hcomp (Path.Homotopic.refl β))⟩ + · obtain ⟨p, hp⟩ := ((IsEdgeChart.upper_pathConnected c).joinedIn x hxU y hyU).mono hU_sub + exact ⟨p, p, fun u => (hp u).1, fun u => (hp u).2, Path.Homotopic.refl p⟩ + have hT_univ : T = univ := IsClopen.eq_univ ⟨hT_closed, hT_open⟩ ⟨0, h0T⟩ + obtain ⟨t, -, rfl⟩ : z ∈ γ '' Ioo 0 1 := hγe.symm ▸ hz + have htT : t ∈ T := hT_univ.symm ▸ mem_univ t + exact htT + +/-- Every point `z : S` on a closed surface `S` has a good open neighborhood for `G`. -/ +theorem exists_goodOpen (hS : IsClosedSurface S) (G : Drawing S) (z : S) : + ∃ O : Set S, z ∈ O ∧ GoodOpen G O := by + by_cases hzV : z ∈ G.V + · exact exists_goodOpen_of_mem_V hS G hzV + · by_cases hzU : z ∈ G.U + · obtain ⟨e, he, hze⟩ := G.exists_edge_of_mem hzU hzV + exact exists_goodOpen_of_mem_edge hS G he hze + · exact exists_goodOpen_of_notMem_U hS G hzU + +/-- Every path `p : Path a b` in `S` with endpoints `a, b ∉ G.U` is homotopic with fixed endpoints +to a path `q : Path a b` in `(G.U \ G.V)ᶜ`. -/ +theorem exists_homotopic_normal_path (hS : IsClosedSurface S) (G : Drawing S) {a b : S} + (p : Path a b) (ha : a ∉ G.U) (hb : b ∉ G.U) : + ∃ q : Path a b, p.Homotopic q ∧ ∀ u, q u ∈ (G.U \ G.V)ᶜ := by + have : T2Space S := hS.2.1 + let good : Set I → Prop := fun W => IsOpen W ∧ ∃ U : Set S, GoodOpen G U ∧ ∀ t ∈ W, p t ∈ U + have hcover : (univ : Set I) ⊆ ⋃ W : {W : Set I // good W}, W.1 := by + intro t _ + obtain ⟨U, htU, hGU⟩ := exists_goodOpen hS G (p t) + exact mem_iUnion.mpr ⟨⟨p ⁻¹' U, hGU.1.preimage p.continuous, U, hGU, fun _ hw => hw⟩, htU⟩ + obtain ⟨t, ht0, htmono, ⟨n₀, hn₀⟩, htW⟩ := + exists_monotone_Icc_subset_open_cover_unitInterval + (fun W : {W : Set I // good W} => W.2.1) hcover + have key : ∀ n (U : Set S), GoodOpen G U → p (t n) ∈ U → + ∃ (x : S) (α : Path (p (t n)) x) (q : Path (p 0) x), + x ∈ U \ G.U ∧ (∀ u, α u ∈ U) ∧ (∀ u, q u ∈ (G.U \ G.V)ᶜ) ∧ + (p.subpath 0 (t n)).Homotopic (q.trans α.symm) := by + intro n + induction n with + | zero => + intro U _ hpU + rw [ht0] at hpU ⊢ + have hp0 : p 0 ∉ G.U := by rw [p.source]; exact ha + refine ⟨p 0, Path.refl (p 0), Path.refl (p 0), ⟨hpU, hp0⟩, + fun _ => hpU, fun _ h => hp0 h.1, ?_⟩ + rw [Path.subpath_self] + exact (Path.Homotopic.refl_trans (Path.refl (p 0))).symm + | succ n ih => + intro U' hU' hp_U' + obtain ⟨⟨W, _, U_n, hUn, hW_Un⟩, hsub⟩ := htW n + have hle : t n ≤ t (n + 1) := htmono (Nat.le_succ n) + have hp_Un : ∀ w ∈ Icc (t n) (t (n + 1)), p w ∈ U_n := fun w hw => hW_Un w (hsub hw) + obtain ⟨x_n, α_n, q_n, hx_n, hα_n, hq_n, hhom_n⟩ := + ih U_n hUn (hp_Un (t n) ⟨le_rfl, hle⟩) + obtain ⟨hUn_open, D_n, hD_n, hUn_Dn, hUn_join⟩ := hUn + have hp_inter : p (t (n + 1)) ∈ U_n ∩ U' := ⟨hp_Un (t (n + 1)) ⟨hle, le_rfl⟩, hp_U'⟩ + obtain ⟨E, E', hE, hE', hp_E', hE'E, hE_sub, -⟩ := + exists_closedDisc_nbhd hS (hUn_open.inter hU'.1) hp_inter + obtain ⟨x', hx'_E', hx'_notU⟩ := + exists_notMem_U (Γ := G) hS hE' ⟨p (t (n + 1)), hp_E'⟩ + obtain ⟨α', hα'E⟩ := hE.isPathConnected.joinedIn (p (t (n + 1))) (hE'E hp_E') x' (hE'E hx'_E') + have hx'_Un : x' ∈ U_n \ G.U := ⟨(hE_sub (hE'E hx'_E')).1, hx'_notU⟩ + obtain ⟨r, s, hrD, hsG, hrs⟩ := hUn_join x_n hx_n x' hx'_Un + have hpiece : ∀ u, (p.subpath (t n) (t (n + 1))) u ∈ D_n := by + intro u + have : (p.subpath (t n) (t (n + 1))) u ∈ p '' uIcc (t n) (t (n + 1)) := by + rw [← Path.range_subpath] + exact mem_range_self u + obtain ⟨v, hv, hv'⟩ := this + rw [uIcc_of_le hle] at hv + rw [← hv'] + exact hUn_Dn (hp_Un v hv) + have h_disc_hom : (α_n.symm.trans (p.subpath (t n) (t (n + 1)))).Homotopic (r.trans α'.symm) + := + pathsHomotopic_of_mem_disc hD_n _ _ + (path_trans_mem (path_symm_mem fun u => hUn_Dn (hα_n u)) hpiece) + (path_trans_mem hrD (path_symm_mem fun u => hUn_Dn (hE_sub (hα'E u)).1)) + have h_step_hom : (p.subpath 0 (t (n + 1))).Homotopic ((q_n.trans s).trans α'.symm) := by + refine (Path.Homotopic.subpath_trans_subpath p 0 (t n) (t (n + 1))).symm.trans ?_ + refine (hhom_n.hcomp (Path.Homotopic.refl _)).trans ?_ + refine (Path.Homotopic.trans_assoc q_n α_n.symm _).trans ?_ + refine ((Path.Homotopic.refl q_n).hcomp (h_disc_hom.trans (hrs.hcomp + (Path.Homotopic.refl α'.symm)))).trans ?_ + exact (Path.Homotopic.trans_assoc q_n s α'.symm).symm + exact ⟨x', α', q_n.trans s, ⟨(hE_sub (hE'E hx'_E')).2, hx'_notU⟩, + fun u => (hE_sub (hα'E u)).2, path_trans_mem hq_n hsG, h_step_hom⟩ + obtain ⟨D_b, D'_b, hD_b, hD'_b, hb_D', hD'D_b, hDb_U, -⟩ := + exists_closedDisc_nbhd hS G.isClosed_U.isOpen_compl hb + have hGood_b : GoodOpen G D'_b := by + refine goodOpen_of_joinedIn G hD'_b hD_b hD'D_b fun x hx y hy => ?_ + refine (hD_b.isPathConnected.joinedIn x (hD'D_b hx.1) y (hD'D_b hy.1)).mono fun w hw => ?_ + exact ⟨hw, fun h => hDb_U hw h.1⟩ + have htn₀ : t n₀ = 1 := hn₀ n₀ le_rfl + have hp_tn₀ : p (t n₀) = b := by rw [htn₀, p.target] + obtain ⟨x, α, q, _, hα_D', hqG, hhom⟩ := key n₀ D'_b hGood_b (hp_tn₀.symm ▸ hb_D') + have hα_G : ∀ u, α.symm u ∈ (G.U \ G.V)ᶜ := fun u => by + rw [Path.symm_apply] + exact fun h => hDb_U (hD'D_b (hα_D' _)) h.1 + let q_final : Path a b := (q.trans α.symm).cast p.source.symm hp_tn₀.symm + refine ⟨q_final, ?_, fun u => ?_⟩ + · have hsub01 : (p.subpath 0 (t n₀)).cast p.source.symm hp_tn₀.symm = p := by + ext u + change (p.subpath 0 (t n₀)) u = p u + rw [htn₀, Path.subpath_zero_one] + rfl + rw [← hsub01] + exact Path.Homotopic.pathCast hhom p.source.symm hp_tn₀.symm + · change (q.trans α.symm) u ∈ (G.U \ G.V)ᶜ + exact path_trans_mem hqG hα_G u + +/-- Every closed curve `φ : C(Circle, S)` on a closed connected surface `S` is homotopic in `S` to +a `G`-normal closed curve `ψ : C(Circle, S)` (`range ψ ⊆ (G.U \ G.V)ᶜ`). -/ +theorem exists_homotopic_normal_curve [ConnectedSpace S] (hS : IsClosedSurface S) (G : Drawing S) + (φ : C(Circle, S)) : + ∃ ψ : C(Circle, S), range ψ ⊆ (G.U \ G.V)ᶜ ∧ ClosedCurvesHomotopicIn univ φ ψ := by + have : T2Space S := hS.2.1 + have : LocallyPathConnectedSpace S := IsClosedSurface.locallyPathConnectedSpace hS + have : PathConnectedSpace S := PathConnectedSpace.of_locallyPathConnectedSpace + obtain ⟨x₀, -, hx₀_notU⟩ := + exists_notMem_U (Γ := G) hS isOpen_univ ⟨φ 1, mem_univ _⟩ + obtain ⟨α⟩ := PathConnectedSpace.joined (φ 1) x₀ + let p₀ : Path (φ 1) (φ 1) := + { toFun := fun t => φ (arcParam 1 t) + continuous_toFun := by fun_prop + source' := by simp + target' := by simp } + let p₁ : Path (φ 1) (φ 1) := p₀.trans (α.trans α.symm) + have hp₀_p₁ : p₀.Homotopic p₁ := + (Path.Homotopic.trans_refl p₀).symm.trans + ((Path.Homotopic.refl p₀).hcomp (Path.Homotopic.trans_symm α).symm) + let f₁ : C(I, S) := ⟨fun t => p₁ t, p₁.continuous⟩ + have hf₁ : f₁ 0 = f₁ 1 := by simp [f₁] + let φ₁ : C(Circle, S) := loopLift 1 f₁ hf₁ + let g_u : C(S, (univ : Set S)) := ⟨fun x => ⟨x, mem_univ x⟩, by fun_prop⟩ + have hhom₁ : ClosedCurvesHomotopicIn univ φ φ₁ := + closedCurvesHomotopicIn_of_path 1 φ φ₁ (p₀.map g_u.continuous) (p₁.map g_u.continuous) + (fun _ => rfl) + (fun t => (loopLift_apply 1 f₁ hf₁ t).symm) + (hp₀_p₁.map g_u) + have hx₀_range : x₀ ∈ range p₁ := by + change x₀ ∈ range (p₀.trans (α.trans α.symm)) + rw [Path.trans_range, Path.trans_range] + exact Or.inr (Or.inl ⟨1, α.target⟩) + obtain ⟨t₁, ht₁⟩ := hx₀_range + let z₁ : Circle := arcParam 1 t₁ + have hφ₁_z₁ : φ₁ z₁ ∉ G.U := by + change loopLift 1 f₁ hf₁ (arcParam 1 t₁) ∉ G.U + rw [loopLift_apply] + change p₁ t₁ ∉ G.U + rw [ht₁] + exact hx₀_notU + let p₂ : Path (φ₁ z₁) (φ₁ z₁) := + { toFun := fun t => φ₁ (arcParam z₁ t) + continuous_toFun := by fun_prop + source' := by simp + target' := by simp } + obtain ⟨q, hp₂_q, hq_G⟩ := exists_homotopic_normal_path hS G p₂ hφ₁_z₁ hφ₁_z₁ + let f₂ : C(I, S) := ⟨fun t => q t, q.continuous⟩ + have hf₂ : f₂ 0 = f₂ 1 := by simp [f₂] + let ψ : C(Circle, S) := loopLift z₁ f₂ hf₂ + have hhom₂ : ClosedCurvesHomotopicIn univ φ₁ ψ := + closedCurvesHomotopicIn_of_path z₁ φ₁ ψ (p₂.map g_u.continuous) (q.map g_u.continuous) + (fun _ => rfl) + (fun t => (loopLift_apply z₁ f₂ hf₂ t).symm) + (hp₂_q.map g_u) + refine ⟨ψ, ?_, GraphMinor.Surface.ClosedCurvesHomotopicIn.trans hhom₁ hhom₂⟩ + rintro _ ⟨w, rfl⟩ + obtain ⟨t, rfl⟩ := arcParam_surjective z₁ w + change loopLift z₁ f₂ hf₂ (arcParam z₁ t) ∈ (G.U \ G.V)ᶜ + rw [loopLift_apply] + exact hq_G t + +/-- Every `O`-arc in a Hausdorff space is solid (`IsSolid`). -/ +theorem IsOArc.isSolid [T2Space S] {F : Set S} (hF : IsOArc F) : IsSolid F := by + obtain ⟨φ⟩ := hF + let f : I → S := fun t => (φ (arcParam 1 t)).1 + have hf : Continuous f := continuous_subtype_val.comp (φ.continuous.comp (arcParam 1).continuous) + have hrange : F = range f := by + ext x + constructor + · intro hx + obtain ⟨t, ht⟩ := arcParam_surjective 1 (φ.symm ⟨x, hx⟩) + exact ⟨t, by simp [f, ht]⟩ + · rintro ⟨t, rfl⟩ + exact (φ (arcParam 1 t)).2 + rw [hrange] + exact ⟨isLocallyArcConnected_of_locJoin fun x hx => locJoin_range hf hx, + (isCompact_range hf).isClosed⟩ + +/-- Unconditional proof of `GM19.GM07AlphaExistsStatement` (Graph Minors VII, Section 5, page 230). +-/ +theorem gm07_alpha_exists_core : GraphMinor.GM19.GM07AlphaExistsStatement.{u} := by + intro S _ _ hS hconn hbd hsph G + have : T2Space S := hS.2.1 + have hS_closed : IsClosedSurface S := isClosedSurface_of_bd_eq_empty hS hbd + obtain ⟨F₀, hF₀_oarc, hF₀_not_null⟩ := + GraphMinor.GM19.exists_not_nullHomotopic hS hbd hsph + obtain ⟨e₀⟩ := hF₀_oarc + let φ₀ : C(Circle, S) := ⟨fun z => (e₀ z).1, continuous_subtype_val.comp e₀.continuous⟩ + have hφ₀_not_null : ¬ ClosedCurveIsNullHomotopicIn univ φ₀ := fun h => hF₀_not_null ⟨e₀, h⟩ + obtain ⟨ψ, hψ_norm, hhom⟩ := exists_homotopic_normal_curve hS_closed G φ₀ + have hψ_not_null : ¬ ClosedCurveIsNullHomotopicIn univ ψ := fun h => + hφ₀_not_null (null_of_homotopic subset_rfl hhom h) + obtain ⟨F, hF_oarc, hF_sub, hF_not_null⟩ := theorem_11_2_proof hS ψ hψ_not_null + have hF_ne : F.Nonempty := by + obtain ⟨φF⟩ := hF_oarc + exact ⟨(φF 1).1, (φF 1).2⟩ + refine ⟨F, IsOArc.isSolid hF_oarc, + ⟨hF_ne, IsArcConnected.isPreconnected (IsOArc.isArcConnected hF_oarc)⟩, + fun x ⟨hxF, hxU⟩ => by_contra fun hxV => hψ_norm (hF_sub hxF) ⟨hxU, hxV⟩, ?_⟩ + rintro (⟨Δ, hΔ, hFΔ⟩ | ⟨C, ⟨x, hx, rfl⟩, _⟩) + · exact hF_not_null + (isNullHomotopicOArcIn_of_subset_disc hF_oarc (subset_univ Δ) hΔ hFΔ) + · rw [hbd] at hx + exact hx + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/ArcPlace.lean b/LeanPool/GraphMinor/GM07/ArcPlace.lean new file mode 100644 index 0000000000..156cb4b626 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/ArcPlace.lean @@ -0,0 +1,268 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.DiscPlace +import LeanPool.GraphMinor.GM15.LineMove +import LeanPool.GraphMinor.Surface.DiscsInSurface + +/-! +# Straightening arcs onto arcs + +Step 2 of the proof of (9.1), page 243, takes "a homeomorphism of $\Sigma$ which fixes every point +of $bd(\Sigma)$ and maps the middle third of $f_i$ +onto the whole of $e_i$ ($1 \le i \le r$)". This file proves that such a homeomorphism exists, for +any two families of disjoint lines off the +boundary (`exists_line_family_placement`). + +The proof has three steps. +1. Each line lies in a closed disc that it crosses as a chord, and the discs of one family are + disjoint (`exists_line_discs`). +2. A homeomorphism of the surface fixing the boundary moves the first discs onto the second ones, + with the ends of each line going to the ends of + the other line (`exists_disc_family_placement`). +3. In each disc of the second family we now have two chords with the same ends. A homeomorphism of + the disc that fixes its boundary moves one chord + onto the other (`GM15.exists_homeo_moving_line`), and it extends by the identity to the whole + surface (`exists_homeo_of_disc`). +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The frontier of a closed disc in a surface lies in the boundary of the disc: the points of the +disc off its boundary are the image of the +open ball under a chart, which is open. -/ +theorem frontier_subset_discBd_of_surface [T2Space S] (hS : IsSurface S) {D : Set S} + (hD : IsClosedDisc D) : frontier D ⊆ discBd D := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hopen : IsOpen (g '' ball (0 : ℂ) 1) := c.isOpen_image_ball hS.2.2 + have hint : g '' ball (0 : ℂ) 1 ⊆ interior D := hopen.subset_interior_iff.mpr + (c.g_subset ball_subset_closedBall) + intro x ⟨hxc, hxi⟩ + have hxD : x ∈ D := hD.isCompact.isClosed.closure_eq ▸ hxc + rw [← (c.union_ball).1] at hxD + exact hxD.resolve_left fun hx => hxi (hint hx) + +/-- A homeomorphism of a closed disc of a surface that fixes the boundary of the disc extends by the +identity to a homeomorphism of the +surface. -/ +theorem exists_homeo_of_disc [T2Space S] (hS : IsSurface S) {D : Set S} + (hD : IsClosedDisc D) {Ψ Ψ' : S → S} (h1 : MapsTo Ψ D D) + (h2 : MapsTo Ψ' D D) (h3 : ContinuousOn Ψ D) (h4 : ContinuousOn Ψ' D) (h5 : LeftInvOn Ψ' Ψ D) + (h6 : LeftInvOn Ψ Ψ' D) + (h7 : ∀ x ∈ discBd D, Ψ x = x) : ∃ g : S ≃ₜ S, (∀ x ∈ D, g x = Ψ x) ∧ ∀ x ∉ D, g x = x := by + classical + have hDc : IsClosed D := hD.isCompact.isClosed + have hfr := frontier_subset_discBd_of_surface hS hD + have h7' : ∀ x ∈ discBd D, Ψ' x = x := fun x hx => by + have := h5 (discBd_subset D hx) + rwa [h7 x hx] at this + have hc : ∀ {Φ : S → S}, ContinuousOn Φ D → (∀ x ∈ discBd D, Φ x = x) → Continuous fun x + => if x ∈ D then Φ x else x := fun hΦ hΦb => + continuous_if (fun a ha => hΦb a (hfr ha)) (by rwa [Set.ofPred_mem_eq, hDc.closure_eq]) + continuous_id.continuousOn + refine ⟨⟨⟨fun x => if x ∈ D then Ψ x else x, fun x => if x ∈ D then Ψ' x else x, fun x => ?_, + fun x => ?_⟩, hc h3 h7, hc h4 h7'⟩, + fun x hx => by simp [hx], fun x hx => by simp [hx]⟩ + · by_cases hx : x ∈ D + · simp only [hx, h1 hx, ↓reduceIte] + exact h5 hx + · simp only [hx, ↓reduceIte] + · by_cases hx : x ∈ D + · simp only [hx, h2 hx, ↓reduceIte] + exact h6 hx + · simp only [hx, ↓reduceIte] + +/-- The image of a line under a homeomorphism is a line, with the images of the ends as ends. -/ +theorem isLineWithEnds_homeo_image {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) + (e : S ≃ₜ S) : IsLineWithEnds (e '' L) (e a) (e b) := by + obtain ⟨f, hfa, hfb⟩ := hL + refine ⟨f.trans (e.image L), ?_, ?_⟩ + · change e (f 0).1 = e a + rw [hfa] + · change e (f 1).1 = e b + rw [hfb] + +/-- The two ends of a line are distinct. -/ +theorem ne_of_isLineWithEnds {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) : a ≠ b := by + obtain ⟨f, hfa, hfb⟩ := hL + intro he + have h1 : f 0 = f 1 := Subtype.ext (hfa.trans (he.trans hfb.symm)) + exact zero_ne_one (f.injective h1) + +private theorem image_trans (φ ψ : S ≃ₜ S) (X : Set S) : (φ.trans ψ) '' X = ψ '' (φ '' X) := by + rw [image_image] + rfl + +/-- Disjoint closed discs around finitely many disjoint lines off the boundary, each line a chord of +its disc. -/ +theorem exists_line_discs [T2Space S] {M : Type} [TopologicalSpace M] (hM : IsSurface M) + (h : S ≃ₜ M) {ι : Type*} [Finite ι] (L : ι → Set S) + (a b : ι → S) (hL : ∀ i, IsLineWithEnds (L i) (a i) (b i)) (hLL : Pairwise fun i j => Disjoint + (L i) (L j)) + (hLb : ∀ i, Disjoint (L i) (bd S)) : + ∃ B : ι → Set S, (∀ i, IsClosedDisc (B i) ∧ L i ⊆ B i ∧ Disjoint (B i) (bd S) ∧ L i ∩ discBd + (B i) = {a i, b i}) ∧ + Pairwise fun i j => Disjoint (B i) (B j) := by + classical + have hLc : ∀ i, IsClosed (L i) := fun i => GraphMinor.GM15.isClosed_of_isLineWithEnds (hL i) + have key : ∀ F : Set ι, F.Finite → ∃ B : ι → Set S, + (∀ i ∈ F, IsClosedDisc (B i) ∧ L i ⊆ B i ∧ Disjoint (B i) (bd S) ∧ L i ∩ discBd (B i) + = {a i, b i}) ∧ + (∀ i ∈ F, ∀ j ∉ F, Disjoint (B i) (L j)) ∧ ∀ i ∈ F, ∀ j ∈ F, i ≠ j → Disjoint (B i) (B j) + := by + intro F hF + induction F, hF using Set.Finite.induction_on with + | empty => exact ⟨fun _ => ∅, by simp, by simp, by simp⟩ + | @insert i F hiF hF ih => + obtain ⟨B, h1, h2, h3⟩ := ih + set Z : Set S := (⋃ j ∈ F, B j) ∪ ⋃ j ∈ (insert i F)ᶜ, L j with hZ + have hZc : IsClosed Z := (hF.isClosed_biUnion fun j hj => (h1 j + hj).1.isCompact.isClosed).union + ((toFinite _).isClosed_biUnion fun j _ => hLc j) + have hLZ : L i ⊆ Zᶜ := by + rintro x hx (hxZ | hxZ) + · obtain ⟨j, hj, hxB⟩ := mem_iUnion₂.mp hxZ + exact disjoint_left.mp (h2 j hj i hiF) hxB hx + · obtain ⟨j, hj, hxL⟩ := mem_iUnion₂.mp hxZ + have hne : i ≠ j := fun he => hj (he ▸ mem_insert i F) + exact disjoint_left.mp (hLL hne) hx hxL + obtain ⟨D, hD1, hD2, hD3, hD4, -, -, hD7⟩ := exists_chord_disc hM h (hL i) + (disjoint_iff_inter_eq_empty.mp (hLb i)) hZc.isOpen_compl hLZ + have hDoff : ∀ j ∈ F, Disjoint D (B j) := fun j hj => by + rw [disjoint_left] + exact fun x hx hx' => hD3 hx (.inl (mem_iUnion₂.mpr ⟨j, hj, hx'⟩)) + have hne : ∀ j ∈ F, j ≠ i := fun j hj he => hiF (he ▸ hj) + refine ⟨Function.update B i D, ?_, ?_, ?_⟩ + · rintro j (rfl | hj) + · rw [Function.update_self] + exact ⟨hD1, hD2, hD4, hD7⟩ + · rw [Function.update_of_ne (hne j hj)] + exact h1 j hj + · rintro j (rfl | hj) k hk + · rw [Function.update_self, disjoint_left] + exact fun x hx hx' => hD3 hx (.inr (mem_iUnion₂.mpr ⟨k, hk, hx'⟩)) + · rw [Function.update_of_ne (hne j hj)] + exact h2 j hj k fun hk' => hk (.inr hk') + · rintro j (rfl | hj) k (rfl | hk) hjk + · exact absurd rfl hjk + · rw [Function.update_self, Function.update_of_ne (hne k hk)] + exact hDoff k hk + · rw [Function.update_self, Function.update_of_ne (hne j hj)] + exact (hDoff j hj).symm + · rw [Function.update_of_ne (hne j hj), Function.update_of_ne (hne k hk)] + exact h3 j hj k hk hjk + obtain ⟨B, h1, -, h3⟩ := key univ (toFinite _) + exact ⟨B, fun i => h1 i (mem_univ i), fun i j hij => h3 i (mem_univ i) j (mem_univ j) hij⟩ + +/-- **Straightening arcs.** Let `L i` and `L' i` be two finite families of lines, each family +pairwise disjoint and off the boundary. Then a +homeomorphism of the surface fixing every point of the boundary maps each `L i` onto `L' i`, with +the ends `a i, b i` going to `a' i, b' i`. +This is the homeomorphism of step 2 of (9.1), page 243, which "maps the middle third of $f_i$ onto +the whole of $e_i$". -/ +theorem exists_line_family_placement (hS : IsSurface S) [ConnectedSpace S] {M : Type} + [TopologicalSpace M] (hM : IsSurface M) (h : S ≃ₜ M) + {ι : Type*} [Finite ι] (L L' : ι → Set S) (a b a' b' : ι → S) (hL : ∀ i, IsLineWithEnds (L i) + (a i) (b i)) + (hL' : ∀ i, IsLineWithEnds (L' i) (a' i) (b' i)) (hLL : Pairwise fun i j => Disjoint (L i) + (L j)) + (hLL' : Pairwise fun i j => Disjoint (L' i) (L' j)) (hLb : ∀ i, Disjoint (L i) (bd S)) + (hL'b : ∀ i, Disjoint (L' i) (bd S)) : + ∃ ψ : S ≃ₜ S, (∀ x ∈ bd S, ψ x = x) ∧ ∀ i, ψ '' L i = L' i ∧ ψ (a i) = a' i ∧ ψ (b i) = b' i + := by + classical + have ht2 : T2Space S := hS.2.1 + -- Step 1: discs around the lines. + obtain ⟨A, hA, hAA⟩ := exists_line_discs hM h L a b hL hLL hLb + obtain ⟨B, hB, hBB⟩ := exists_line_discs hM h L' a' b' hL' hLL' hL'b + have hmem : ∀ {D L : Set S} {x y : S}, L ∩ discBd D = {x, y} → x ∈ discBd D ∧ y ∈ discBd D + := fun {D L x y} he => by + have hx : x ∈ L ∩ discBd D := he ▸ mem_insert x {y} + have hy : y ∈ L ∩ discBd D := he ▸ mem_insert_of_mem x rfl + exact ⟨hx.2, hy.2⟩ + -- Step 2: the discs `A i` go onto the discs `B i`, with the ends of the lines going to the ends. + obtain ⟨e, hebd, he⟩ := exists_disc_family_placement hS A B (fun i => (hA i).1) (fun i => + (hB i).1) hAA hBB (fun i => (hA i).2.2.1) + (fun i => (hB i).2.2.1) a b a' b' (fun i => (hmem (hA i).2.2.2).1) (fun i => (hmem + (hA i).2.2.2).2) (fun i => ne_of_isLineWithEnds (hL i)) + (fun i => (hmem (hB i).2.2.2).1) (fun i => (hmem (hB i).2.2.2).2) (fun i + => ne_of_isLineWithEnds (hL' i)) + -- Step 3: in each disc `B i`, the image of `L i` and the line `L' i` are chords with the same + -- ends. + have hchord : ∀ i, ∃ g : S ≃ₜ S, (∀ x ∉ B i, g x = x) ∧ (∀ x ∈ discBd (B i), g x = x) ∧ g '' + (e '' L i) = L' i := by + intro i + obtain ⟨h1, h2, h3⟩ := he i + have hline : IsLineWithEnds (e '' L i) (a' i) (b' i) := h2 ▸ h3 ▸ isLineWithEnds_homeo_image + (hL i) e + have hsub : e '' L i ⊆ B i := h1 ▸ image_mono (hA i).2.1 + have hbd : discBd (B i) = e '' discBd (A i) := by + rw [← h1] + exact (isClosedDisc_image_of_injOn (hA i).1 e.continuous e.injective.injOn).2 + have hcap : e '' L i ∩ discBd (B i) = {a' i, b' i} := by + rw [hbd, ← image_inter e.injective, (hA i).2.2.2, image_pair, h2, h3] + obtain ⟨Ψ, Ψ', m1, m2, c1, c2, l1, l2, hfix, himg⟩ := GraphMinor.GM15.exists_homeo_moving_line + (hB i).1 (ne_of_isLineWithEnds (hL' i)) hline (hL' i) hsub + (hB i).2.1 hcap (hB i).2.2.2 + obtain ⟨g, hg1, hg2⟩ := exists_homeo_of_disc hS (hB i).1 m1 m2 c1 c2 l1 l2 hfix + refine ⟨g, hg2, fun x hx => (hg1 x (discBd_subset _ hx)).trans (hfix x hx), ?_⟩ + rw [← himg] + exact image_congr fun x hx => hg1 x (hsub hx) + choose g hg1 hg2 hg3 using hchord + -- Compose the moves of the discs; each one is the identity off its disc. + have key : ∀ F : Set ι, F.Finite → ∃ φ : S ≃ₜ S, (∀ x, (∀ j ∈ F, x ∉ B j) → φ x = x) ∧ + (∀ i ∈ F, φ '' (e '' L i) = L' i) ∧ + ∀ i, ∀ x ∈ discBd (B i), φ x = x := by + intro F hF + induction F, hF using Set.Finite.induction_on with + | empty => exact ⟨Homeomorph.refl S, fun _ _ => rfl, by simp, fun _ _ _ => rfl⟩ + | @insert i F hiF hF ih => + obtain ⟨φ, hφ1, hφ2, hφ3⟩ := ih + have hoff : ∀ {x : S} {j : ι}, x ∈ B j → ∀ k, k ≠ j → x ∉ B k := fun {x j} hx k hk hxk + => disjoint_left.mp (hBB hk) hxk hx + refine ⟨φ.trans (g i), fun x hx => ?_, ?_, fun k x hx => ?_⟩ + · rw [Homeomorph.trans_apply, hφ1 x fun j hj => hx j (.inr hj)] + exact hg1 i x (hx i (mem_insert i F)) + · rintro j (rfl | hj) + · have hfix : φ '' (e '' L j) = e '' L j := by + refine (image_congr fun x hx => hφ1 x fun k hk => ?_).trans (image_id _) + have hxB : x ∈ B j := (he j).1 ▸ image_mono (hA j).2.1 hx + exact hoff hxB k fun hkj => hiF (hkj ▸ hk) + rw [image_trans, hfix, hg3] + · rw [image_trans, hφ2 j hj] + refine (image_congr fun x hx => hg1 i x ?_).trans (image_id _) + exact hoff ((hB j).2.1 hx) i fun hij => hiF (hij ▸ hj) + · rw [Homeomorph.trans_apply, hφ3 k x hx] + by_cases hki : k = i + · subst hki + exact hg2 k x hx + · exact hg1 i x (hoff (discBd_subset _ hx) i (Ne.symm hki)) + obtain ⟨φ, hφ1, hφ2, hφ3⟩ := key univ (toFinite _) + have hnotB : ∀ x ∈ bd S, ∀ j ∈ (univ : Set ι), x ∉ B j := fun x hx j _ hxB => disjoint_left.mp + (hB j).2.2.1 hxB hx + refine ⟨e.trans φ, fun x hx => ?_, fun i => ⟨?_, ?_, ?_⟩⟩ + · rw [Homeomorph.trans_apply, hebd x hx] + exact hφ1 x (hnotB x hx) + · rw [image_trans] + exact hφ2 i (mem_univ i) + · rw [Homeomorph.trans_apply, (he i).2.1] + exact hφ3 i _ (hmem (hB i).2.2.2).1 + · rw [Homeomorph.trans_apply, (he i).2.2] + exact hφ3 i _ (hmem (hB i).2.2.2).2 + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/BdChart.lean b/LeanPool/GraphMinor/GM07/BdChart.lean new file mode 100644 index 0000000000..19e7ddf428 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/BdChart.lean @@ -0,0 +1,398 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffSlide + +/-! +# A half rectangle around an arc of the boundary + +For (4.4) of Graph Minors VII we need a chart of `Σ` around an arc of `bd(Σ)`: a rectangle with the +arc on its bottom side (`exists_bd_chart`). Cap the cuffs to get a closed surface. There a strip +around the arc is given by `exists_stripChart_of_arc`, and one half of the strip lies in `Σ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Complex GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] + +/-- A chart `χ` from the rectangle `[x₁, x₂] × [0, δ]` to `Σ`, with the bottom side in `bd(Σ)`. The +part of the rectangle without the top and the two lateral sides is open in `Σ`. -/ +structure IsBdChart (χ : ℂ → S) (x₁ x₂ δ : ℝ) : Prop where + hx : x₁ < x₂ + hδ : 0 < δ + cont : ContinuousOn χ (Icc x₁ x₂ ×ℂ Icc 0 δ) + inj : InjOn χ (Icc x₁ x₂ ×ℂ Icc 0 δ) + isOpen : IsOpen (χ '' (Ioo x₁ x₂ ×ℂ Ico 0 δ)) + bd : ∀ w ∈ Icc x₁ x₂ ×ℂ Icc 0 δ, χ w ∈ bd S ↔ w.im = 0 + +private theorem convex_portion_cannot_cross_cuff + {S : Type} + [TopologicalSpace S] + (T : Type) + [TopologicalSpace T] + (j : S → T) + (hj : IsClosedEmbedding j) + (O : Set ℂ) + (K : ℂ → T) + (hK : StripChart O K) + (R : Set ℂ) + (hRO : R ⊆ O) + (hfr : frontier (range j) = j '' bd S) + (hbdaxis : ∀ w ∈ R, K w ∈ j '' bd S → w.im = 0) : + ∀ {P : ℝ → Prop}, Convex ℝ {w | w ∈ R ∧ P w.im} → (∀ (r : ℝ), P r → r ≠ 0) → ∀ w ∈ R, ∀ w' ∈ + R, P w.im → P w'.im → K w ∈ range j → K w' ∈ range j := by + intro P hconv hP w hw w' hw' h1 h2 h3 + by_contra hn + have hset : IsPreconnected (K '' {w : ℂ | w ∈ R ∧ P w.im}) := + hconv.isPreconnected.image K (hK.hc.mono fun z hz => hRO hz.1) + have hcov : K '' {w : ℂ | w ∈ R ∧ P w.im} ⊆ range j ∪ closure (range j)ᶜ := fun z _ => by + by_cases hzr : z ∈ range j + · exact .inl hzr + · exact .inr (subset_closure hzr) + obtain ⟨z, ⟨w₀, hw₀, rfl⟩, hz⟩ := isPreconnected_closed_iff.mp hset _ _ hj.isClosed_range + isClosed_closure hcov + ⟨K w, ⟨w, ⟨hw, h1⟩, rfl⟩, h3⟩ ⟨K w', ⟨w', ⟨hw', h2⟩, rfl⟩, subset_closure hn⟩ + have hz' : K w₀ ∈ frontier (range j) := by + rw [frontier_eq_closure_inter_closure, hj.isClosed_range.closure_eq] + exact hz + rw [hfr] at hz' + exact hP _ hw₀.2 (hbdaxis w₀ hw₀.1 hz') + +private theorem boundary_chart_has_consistent_inward_side + {S : Type} + [TopologicalSpace S] + (hS : IsSurface S) + {g : ℝ → S} + {a : ℝ} + {b : ℝ} + {c : ℝ} + {d : ℝ} + (hac : a ≤ c) (hdb : d ≤ b) + (hbd : ∀ u ∈ Icc a b, g u ∈ bd S) + (T : Type) + [TopologicalSpace T] + (j : S → T) + (hj : IsClosedEmbedding j) + (par : ↑unitInterval → ℝ) + (K : ℂ → T) + (R : Set ℂ) + (haxis : ∀ w ∈ R, w.im = 0 → ∃ u, par u ∈ Icc c d ∧ K w = j (g (par u))) + (hup : ∀ w ∈ R, ∀ w' ∈ R, 0 < w.im → 0 < w'.im → K w ∈ range j → K w' ∈ range j) + (hlo : ∀ w ∈ R, ∀ w' ∈ R, w.im < 0 → w'.im < 0 → K w ∈ range j → K w' ∈ range j) + (Wo : Set ℂ) + (hWoR : Wo ⊆ R) + (hKW : IsOpen (K '' Wo)) + (m : ℝ) + (hmW : ↑m ∈ Wo) + (um : ↑unitInterval) + (hKm : K ↑m = j (g (par um))) + (hfm : K ↑m ∈ frontier (range j)) : + ∃ s : ℝ, (s = 1 ∨ s = -1) ∧ (∀ w ∈ R, 0 < s * w.im → K w ∈ range j) ∧ + ∀ w ∈ R, s * w.im < 0 → K w ∉ range j := by + obtain ⟨w₁, hw₁, hw₁n⟩ : ∃ w₁ ∈ Wo, K w₁ ∉ range j := by + have h2 : K (m : ℂ) ∈ closure (range j)ᶜ := by + rw [frontier_eq_closure_inter_closure] at hfm + exact hfm.2 + obtain ⟨z, hz1, hz2⟩ := mem_closure_iff.mp h2 _ hKW (mem_image_of_mem K hmW) + obtain ⟨w, hw, rfl⟩ := hz1 + exact ⟨w, hw, hz2⟩ + obtain ⟨w₂, hw₂, hw₂r, hw₂b⟩ : ∃ w₂ ∈ Wo, K w₂ ∈ range j ∧ w₂.im ≠ 0 := by + have h2 := mem_closure_compl_bd (hS.2.2 (g (par um))) + have h3 : IsOpen (j ⁻¹' (K '' Wo)) := hKW.preimage hj.continuous + have hoc : g (par um) ∈ j ⁻¹' (K '' Wo) := by + rw [mem_preimage, ← hKm] + exact mem_image_of_mem K hmW + obtain ⟨z, hz1, hz2⟩ := mem_closure_iff.mp h2 _ h3 hoc + obtain ⟨w, hw, he⟩ := hz1 + refine ⟨w, hw, he ▸ ⟨z, rfl⟩, fun h0 => ?_⟩ + obtain ⟨u, hp, he'⟩ := haxis w (hWoR hw) h0 + rw [he] at he' + rw [hj.injective he'] at hz2 + exact hz2 (hbd _ ⟨by linarith [hp.1], by linarith [hp.2]⟩) + have hw₁b : w₁.im ≠ 0 := fun h0 => by + obtain ⟨u, -, he⟩ := haxis w₁ (hWoR hw₁) h0 + exact hw₁n (he ▸ ⟨_, rfl⟩) + rcases lt_or_gt_of_ne hw₂b with hneg | hpos + · refine ⟨-1, .inr rfl, fun w hw h => hlo _ (hWoR hw₂) _ hw hneg (by linarith) hw₂r, + fun w hw h h' => hw₁n ?_⟩ + have hw₁pos : 0 < w₁.im := by + rcases lt_or_gt_of_ne hw₁b with h1 | h1 + · exact absurd (hlo _ (hWoR hw₂) _ (hWoR hw₁) hneg h1 hw₂r) hw₁n + · exact h1 + exact hup _ hw _ (hWoR hw₁) (by linarith) hw₁pos h' + · refine ⟨1, .inl rfl, fun w hw h => hup _ (hWoR hw₂) _ hw hpos (by linarith) hw₂r, + fun w hw h h' => hw₁n ?_⟩ + have hw₁neg : w₁.im < 0 := by + rcases lt_or_gt_of_ne hw₁b with h1 | h1 + · exact h1 + · exact absurd (hup _ (hWoR hw₂) _ (hWoR hw₁) hpos h1 hw₂r) hw₁n + exact hlo _ hw _ (hWoR hw₁) (by linarith) hw₁neg h' + +private theorem inner_half_strip_has_open_image + {S : Type} + [TopologicalSpace S] + (T : Type) + [TopologicalSpace T] + (j : S → T) + (hj : IsClosedEmbedding j) + (K : ℂ → T) + (x₁ : ℝ) + (x₂ : ℝ) + (δ : ℝ) (hδ : 0 < δ) + (hWoR : (Ioo x₁ x₂ ×ℂ Ioo (-δ) δ) ⊆ (Icc x₁ x₂ ×ℂ Icc (-δ) δ)) + (hKW : IsOpen (K '' (Ioo x₁ x₂ ×ℂ Ioo (-δ) δ))) + (s : ℝ) + (hs2 : ∀ w ∈ (Icc x₁ x₂ ×ℂ Icc (-δ) δ), s * w.im < 0 → K w ∉ range j) + (hs0 : s * s = 1) + (σ : ℂ → ℂ) + (hσre : ∀ (w : ℂ), (σ w).re = w.re) + (hσim : ∀ (w : ℂ), (σ w).im = s * w.im) + (habss : ∀ (y : ℝ), |s * y| = |y|) + (χ : ℂ → S) + (hχ : ∀ w ∈ (Icc x₁ x₂ ×ℂ Icc 0 δ), j (χ w) = K (σ w)) : + IsOpen (χ '' (Ioo x₁ x₂ ×ℂ Ico 0 δ)) := by + let R := Icc x₁ x₂ ×ℂ Icc (-δ) δ + let Wo := Ioo x₁ x₂ ×ℂ Ioo (-δ) δ + let Q := Icc x₁ x₂ ×ℂ Icc 0 δ + have hBQ : Ioo x₁ x₂ ×ℂ Ico 0 δ ⊆ Q := fun w hw => ⟨Ioo_subset_Icc_self hw.1, + Ico_subset_Icc_self hw.2⟩ + have he : χ '' (Ioo x₁ x₂ ×ℂ Ico 0 δ) = j ⁻¹' (K '' Wo) := by + ext z + constructor + · rintro ⟨w, hw, rfl⟩ + rw [mem_preimage, hχ w (hBQ hw)] + refine mem_image_of_mem K ⟨?_, ?_⟩ + · rw [mem_preimage, hσre] + exact hw.1 + · rw [mem_preimage, hσim, mem_Ioo, ← abs_lt, habss, abs_lt] + exact ⟨by linarith [hw.2.1], hw.2.2⟩ + · rintro ⟨w, hw, he⟩ + have hnonneg : 0 ≤ s * w.im := by + by_contra hn + exact hs2 w (hWoR hw) (not_le.mp hn) (he ▸ ⟨z, rfl⟩) + let w' : ℂ := (w.re : ℂ) + ((s * w.im : ℝ) : ℂ) * I + have hw're : w'.re = w.re := by simp [w'] + have hw'im : w'.im = s * w.im := by simp [w'] + have hσw' : σ w' = w := by + apply Complex.ext + · rw [hσre, hw're] + · rw [hσim, hw'im, ← mul_assoc, hs0, one_mul] + have hlt : s * w.im < δ := by + have := abs_lt.mpr hw.2 + rw [← habss] at this + exact (abs_lt.mp this).2 + have hw'B : w' ∈ Ioo x₁ x₂ ×ℂ Ico 0 δ := by + constructor + · rw [mem_preimage, hw're] + exact hw.1 + · rw [mem_preimage, hw'im] + exact ⟨hnonneg, hlt⟩ + refine ⟨w', hw'B, hj.injective ?_⟩ + rw [hχ w' (hBQ hw'B), hσw', he] + rw [he] + exact hKW.preimage hj.continuous + +/-- **A half rectangle around an arc of `bd(Σ)`.** Let `g` be an arc of `bd(Σ)` on `[a, b]`, and let +`Z` be a closed set that misses the part of `g` on `[c, d]`, with `a < c < d < b`. Then there is a +chart that misses `Z`, with the part of `g` between `c` and `d` inside its bottom side. -/ +theorem exists_bd_chart (hS : IsSurface S) {g : ℝ → S} {a b c d : ℝ} (hg : Continuous g) + (hac : a < c) (hcd : c < d) (hdb : d < b) + (hi : InjOn g (Icc a b)) (hbd : ∀ u ∈ Icc a b, g u ∈ bd S) (hrest : IsClosed + (bd S \ g '' Ioo a b)) {Z : Set S} (hZ : IsClosed Z) + (hZg : ∀ u ∈ Icc c d, g u ∉ Z) : ∃ (χ : ℂ → S) (x₁ x₂ δ : ℝ), IsBdChart χ x₁ x₂ δ ∧ + (∀ w ∈ Icc x₁ x₂ ×ℂ Icc 0 δ, χ w ∉ Z) ∧ + ∀ u ∈ Ioo c d, ∃ x ∈ Ioo x₁ x₂, χ (x : ℂ) = g u := by + classical + have ht2S : T2Space S := hS.2.1 + have hcS : CompactSpace S := hS.1 + have hab : a < b := by linarith + obtain ⟨T, tT, j, O, K, θ, hT, hj, hfr, hpar, hparm, hpars, hK, hθc, hθm, hθ⟩ := + exists_capped_strip_chart hS hg hab hi + have ht2 : T2Space T := hT.2.1 + have hcT : CompactSpace T := hT.1 + let par : unitInterval → ℝ := fun u => a + u.1 * (b - a) + let A : unitInterval → T := fun u => j (g (par u)) + change StrictMono par at hparm + change ∀ r ∈ Icc a b, ∃ u, par u = r at hpars + change ∀ u, (θ u : ℂ) ∈ O ∧ K (θ u) = A u at hθ + obtain ⟨uc, huc⟩ := hpars c ⟨hac.le, by linarith⟩ + obtain ⟨ud, hud⟩ := hpars d ⟨by linarith, hdb.le⟩ + have hucd : uc < ud := hparm.lt_iff_lt.mp (by rw [huc, hud]; exact hcd) + set x₁ := θ uc with hx₁ + set x₂ := θ ud with hx₂ + have hx : x₁ < x₂ := hθm hucd + have hreal : ∀ r ∈ Icc x₁ x₂, ∃ u : unitInterval, par u ∈ Icc c d ∧ θ u = r := fun r hr => by + obtain ⟨u, hu', he⟩ := intermediate_value_Icc hucd.le hθc.continuousOn hr + refine ⟨u, ⟨?_, ?_⟩, he⟩ + · rw [← huc] + exact hparm.monotone hu'.1 + · rw [← hud] + exact hparm.monotone hu'.2 + let Z₂ : Set T := j '' Z ∪ j '' (bd S \ g '' Ioo a b) + have hZ₂ : IsClosed Z₂ := (hj.isClosedMap _ hZ).union (hj.isClosedMap _ hrest) + have hAZ : ∀ u : unitInterval, par u ∈ Icc c d → A u ∉ Z₂ := fun u hp => by + rintro (⟨z, hz, e⟩ | ⟨z, hz, e⟩) + · rw [hj.injective e] at hz + exact hZg _ hp hz + · rw [hj.injective e] at hz + exact hz.2 ⟨_, ⟨by linarith [hp.1], by linarith [hp.2]⟩, rfl⟩ + let Ω : Set ℂ := O ∩ K ⁻¹' Z₂ᶜ + have hΩ : IsOpen Ω := hK.hc.isOpen_inter_preimage hK.isOpen hZ₂.isOpen_compl + have hcpt : IsCompact (((↑) : ℝ → ℂ) '' Icc x₁ x₂) := isCompact_Icc.image continuous_ofReal + have hsubΩ : ((↑) : ℝ → ℂ) '' Icc x₁ x₂ ⊆ Ω := by + rintro _ ⟨r, hr, rfl⟩ + obtain ⟨u, hp, rfl⟩ := hreal r hr + refine ⟨(hθ u).1, ?_⟩ + simp only [mem_preimage, mem_compl_iff] + rw [(hθ u).2] + exact hAZ u hp + obtain ⟨δ₀, hδ₀, hth⟩ := hcpt.exists_thickening_subset_open hΩ hsubΩ + let δ := δ₀ / 2 + have hδ : 0 < δ := by simp only [δ]; linarith + let R : Set ℂ := Icc x₁ x₂ ×ℂ Icc (-δ) δ + have hRΩ : R ⊆ Ω := fun z hz => by + refine hth (mem_thickening_iff.mpr ⟨(z.re : ℂ), ⟨z.re, hz.1, rfl⟩, ?_⟩) + have h1 : z - (z.re : ℂ) = (z.im : ℂ) * I := by + apply Complex.ext <;> simp + rw [dist_eq_norm, h1, norm_mul, Complex.norm_I, mul_one, Complex.norm_real, Real.norm_eq_abs] + have := abs_le.mpr hz.2 + simp only [δ] at this + linarith + have hRO : R ⊆ O := fun z hz => (hRΩ hz).1 + have hbdaxis : ∀ w ∈ R, K w ∈ j '' bd S → w.im = 0 := fun w hw h => by + obtain ⟨z, hz, e'⟩ := h + have h2 : z ∈ g '' Ioo a b := by + by_contra hn + exact (hRΩ hw).2 (.inr ⟨z, ⟨hz, hn⟩, e'⟩) + obtain ⟨r, hr, rfl⟩ := h2 + obtain ⟨u, hu'⟩ := hpars r ⟨hr.1.le, hr.2.le⟩ + have h3 : K w = K (θ u) := by + rw [(hθ u).2, ← e'] + simp only [A, hu'] + have h4 := hK.hi (hRO hw) (hθ u).1 h3 + rw [h4] + simp + have haxis : ∀ w ∈ R, w.im = 0 → ∃ u : unitInterval, par u ∈ Icc c d ∧ K w = j (g (par u)) + := fun w hw h0 => by + obtain ⟨u, hp, hr⟩ := hreal _ hw.1 + refine ⟨u, hp, ?_⟩ + have h2 : w = (θ u : ℂ) := by + apply Complex.ext + · simp [hr] + · simp [h0] + rw [h2, (hθ u).2] + have hside : ∀ {P : ℝ → Prop}, Convex ℝ {w : ℂ | w ∈ R ∧ P w.im} → (∀ r, P r → r ≠ 0) + → ∀ w ∈ R, ∀ w' ∈ R, P w.im → P w'.im → + K w ∈ range j → K w' ∈ range j := by + exact convex_portion_cannot_cross_cuff (S := S) T j hj O K hK R hRO hfr hbdaxis + have hRconv : Convex ℝ R := ((convex_Icc x₁ x₂).linear_preimage Complex.reLm).inter ((convex_Icc + (-δ) δ).linear_preimage Complex.imLm) + have hup : ∀ w ∈ R, ∀ w' ∈ R, 0 < w.im → 0 < w'.im → K w ∈ range j → K w' ∈ range j := + hside (P := fun r => 0 < r) (hRconv.inter (convex_halfSpace_im_gt 0)) fun r hr => hr.ne' + have hlo : ∀ w ∈ R, ∀ w' ∈ R, w.im < 0 → w'.im < 0 → K w ∈ range j → K w' ∈ range j := + hside (P := fun r => r < 0) (hRconv.inter (convex_halfSpace_im_lt 0)) fun r hr => hr.ne + -- The two sides of the bottom. + let Wo : Set ℂ := Ioo x₁ x₂ ×ℂ Ioo (-δ) δ + have hWoo : IsOpen Wo := isOpen_Ioo.reProdIm isOpen_Ioo + have hWoR : Wo ⊆ R := fun w hw => ⟨Ioo_subset_Icc_self hw.1, Ioo_subset_Icc_self hw.2⟩ + have hKW : IsOpen (K '' Wo) := hK.ho _ hWoo fun z hz => hRO (hWoR hz) + let m := (x₁ + x₂) / 2 + have hm : m ∈ Icc x₁ x₂ := ⟨by simp only [m]; linarith, by simp only [m]; linarith⟩ + have hmW : (m : ℂ) ∈ Wo := by + refine ⟨?_, ?_⟩ + · rw [mem_preimage, ofReal_re] + exact ⟨by simp only [m]; linarith, by simp only [m]; linarith⟩ + · rw [mem_preimage, ofReal_im] + exact ⟨by linarith, hδ⟩ + obtain ⟨um, hpm, hKm⟩ := haxis (m : ℂ) (hWoR hmW) (by simp) + have hgm : g (par um) ∈ bd S := hbd _ ⟨by linarith [hpm.1], by linarith [hpm.2]⟩ + have hfm : K (m : ℂ) ∈ frontier (range j) := by + rw [hfr, hKm] + exact mem_image_of_mem j hgm + have hOrientation : ∃ s : ℝ, (s = 1 ∨ s = -1) ∧ (∀ w ∈ R, 0 < s * w.im → K w ∈ range j) ∧ + (∀ w ∈ R, s * w.im < 0 → K w ∉ range j) := by + exact boundary_chart_has_consistent_inward_side (S := S) hS (g := g) (a := a) (b := b) (c := + c) (d := d) hac.le hdb.le hbd T j hj par K R haxis hup hlo Wo hWoR hKW m hmW um hKm hfm + obtain ⟨s, hs, hs1, hs2⟩ := hOrientation + have hs0 : s * s = 1 := by rcases hs with rfl | rfl <;> norm_num + let σ : ℂ → ℂ := fun w => (w.re : ℂ) + ((s * w.im : ℝ) : ℂ) * I + have hσc : Continuous σ := by simp only [σ]; fun_prop + have hσre : ∀ w, (σ w).re = w.re := fun w => by simp [σ] + have hσim : ∀ w, (σ w).im = s * w.im := fun w => by simp [σ] + let Q : Set ℂ := Icc x₁ x₂ ×ℂ Icc 0 δ + have habss : ∀ y : ℝ, |s * y| = |y| := fun y => by rcases hs with rfl | rfl <;> simp + have hσR : ∀ w ∈ Q, σ w ∈ R := fun w hw => by + refine ⟨by rw [mem_preimage, hσre]; exact hw.1, ?_⟩ + rw [mem_preimage, hσim, mem_Icc, ← abs_le, habss, abs_le] + exact ⟨by linarith [hw.2.1], hw.2.2⟩ + have hσr : ∀ w ∈ Q, K (σ w) ∈ range j := fun w hw => by + by_cases h0 : w.im = 0 + · obtain ⟨u, -, he⟩ := haxis (σ w) (hσR w hw) (by rw [hσim, h0]; simp) + exact he ▸ ⟨_, rfl⟩ + · refine hs1 _ (hσR w hw) ?_ + rw [hσim, ← mul_assoc, hs0, one_mul] + exact lt_of_le_of_ne hw.2.1 (Ne.symm h0) + have hσinj : ∀ w w', σ w = σ w' → w = w' := fun w w' h => by + have h1 : w.re = w'.re := by rw [← hσre w, ← hσre w', h] + have h2 : s * w.im = s * w'.im := by rw [← hσim w, ← hσim w', h] + have h3 : s * (s * w.im) = s * (s * w'.im) := by rw [h2] + rw [← mul_assoc, ← mul_assoc, hs0, one_mul, one_mul] at h3 + exact Complex.ext h1 h3 + have hne : Nonempty S := ⟨g a⟩ + let χ : ℂ → S := fun w => Function.invFun j (K (σ w)) + have hχ : ∀ w ∈ Q, j (χ w) = K (σ w) := fun w hw => Function.invFun_eq (hσr w hw) + have hcont : ContinuousOn χ Q := by + rw [hj.isInducing.continuousOn_iff] + exact ((hK.hc.comp hσc.continuousOn fun w hw => hRO (hσR w hw))).congr fun w hw => hχ w hw + have hinj : InjOn χ Q := fun w hw w' hw' h => by + have h1 : K (σ w) = K (σ w') := by rw [← hχ w hw, ← hχ w' hw', h] + exact hσinj _ _ (hK.hi (hRO (hσR w hw)) (hRO (hσR w' hw')) h1) + have hopen : IsOpen (χ '' (Ioo x₁ x₂ ×ℂ Ico 0 δ)) := by + exact inner_half_strip_has_open_image (S := S) T j hj K x₁ x₂ δ hδ hWoR hKW s hs2 hs0 σ hσre + hσim + habss χ hχ + have hbdiff : ∀ w ∈ Q, χ w ∈ bd S ↔ w.im = 0 := fun w hw => by + constructor + · intro h + have h1 : K (σ w) ∈ j '' bd S := by rw [← hχ w hw]; exact mem_image_of_mem j h + have h2 := hbdaxis _ (hσR w hw) h1 + rw [hσim] at h2 + rcases mul_eq_zero.mp h2 with h3 | h3 + · rcases hs with rfl | rfl <;> norm_num at h3 + · exact h3 + · intro h0 + obtain ⟨u, hp, he⟩ := haxis (σ w) (hσR w hw) (by rw [hσim, h0]; simp) + have h1 : χ w = g (par u) := hj.injective (by rw [hχ w hw, he]) + rw [h1] + exact hbd _ ⟨by linarith [hp.1], by linarith [hp.2]⟩ + refine ⟨χ, x₁, x₂, δ, ⟨hx, hδ, hcont, hinj, hopen, hbdiff⟩, fun w hw hz => ?_, fun u hu' => ?_⟩ + · refine (hRΩ (hσR w hw)).2 (.inl ⟨_, hz, ?_⟩) + exact hχ w hw + · obtain ⟨v, hv⟩ := hpars u ⟨by linarith [hu'.1], by linarith [hu'.2]⟩ + have hv1 : uc < v := hparm.lt_iff_lt.mp (by rw [huc, hv]; exact hu'.1) + have hv2 : v < ud := hparm.lt_iff_lt.mp (by rw [hud, hv]; exact hu'.2) + refine ⟨θ v, ⟨hθm hv1, hθm hv2⟩, ?_⟩ + have hmem : (θ v : ℂ) ∈ Q := ⟨by simpa using (⟨(hθm hv1).le, (hθm hv2).le⟩ : θ v ∈ Icc x₁ x₂), + by simpa using hδ.le⟩ + refine hj.injective ?_ + rw [hχ _ hmem] + have hσθ : σ (θ v : ℂ) = (θ v : ℂ) := by + apply Complex.ext + · rw [hσre] + · rw [hσim] + simp + rw [hσθ, (hθ v).2] + simp only [A, hv] + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Bridge.lean b/LeanPool/GraphMinor/GM07/Bridge.lean new file mode 100644 index 0000000000..081aa4e9c3 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Bridge.lean @@ -0,0 +1,151 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section11 +public import LeanPool.GraphMinor.GM07.AlphaExists +public import LeanPool.GraphMinor.GM07.Section5a +public import LeanPool.GraphMinor.GM07.Section5b +public import LeanPool.GraphMinor.GM11.Cited +public import LeanPool.GraphMinor.GM12.Cited +public import LeanPool.GraphMinor.GM14.Cited +public import LeanPool.GraphMinor.GM19.Conditional +import LeanPool.GraphMinor.Surface.OpenDisc +import LeanPool.GraphMinor.Surface.CutIArc +import LeanPool.GraphMinor.Surface.CutLoop +import LeanPool.GraphMinor.Surface.NormalWord +import LeanPool.GraphMinor.Surface.DiscsInSurface +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.GM07.Section11b +import LeanPool.GraphMinor.GM07.Section11f + +/-! +# Bridge Theorems for Graph Minors VII + +This file connects the results of `GraphMinor/GM07/` to the cited statement definitions in +`GraphMinor/GM11/Cited.lean`, `GraphMinor/GM12/Cited.lean`, `GraphMinor/GM14/Cited.lean`, and +`GraphMinor/GM19/Conditional.lean`: +- `gm07_theorem_4_2`: proves `GM14.GM07Theorem42Statement` from `Surface.open_disc` with + no hypotheses (using `isClosedSurface_of_bd_eq_empty` and + `subBd_eq_discBd_of_bd_eq_empty` from `Section11.lean`). +- `gm07_theorem_5_1`: proves `GM12.GM07Theorem51Statement` from `theorem_5_1`. +- `gm07_theorem_5_2`: proves `GM12.GM07Theorem52Statement` from `theorem_5_2`. +- `gm07_theorem_5_5`: proves `GM12.GM07Theorem55Statement` from `theorem_5_5`. +- `gm07_theorem_11_2`: proves `GM11.GM07Theorem112Statement` from `theorem_11_2`. +- `gm07_theorem_11_9`: proves `GM14.GM07Theorem119Statement` from `gm07_theorem_11_9_closed`. +- `gm07_theorem_11_10`: proves `GM11.GM07Theorem1110Statement` from `theorem_11_10`. +- `gm07_planar_iff`: proves `GM19.GM07PlanarIffStatement` from `theorem_5_1`. +- `gm07_alpha_exists`: proves `GM19.GM07AlphaExistsStatement` from `gm07_alpha_exists_core`. +- `gm07_theorem_11_9_closed` and `gm07_theorem_11_9_subset`: prove the closed-surface (`bd S = ∅`, + for `GM14.IsArcSimplyConnected`) and general-surface (`IsSimplyConnectedSubset`) forms of + Graph Minors VII, (11.9). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM12 GraphMinor.GM14 + +universe u + +/-- Unconditional proof of `GM14.GM07Theorem42Statement` (Graph Minors VII, (4.2), page 222) from +`Surface.open_disc`. Because `bd S = ∅`, `S` is a closed surface +(`isClosedSurface_of_bd_eq_empty`) and `subBd Δ = discBd Δ` for every closed disc `Δ ⊆ S` +(`subBd_eq_discBd_of_bd_eq_empty`). -/ +theorem gm07_theorem_4_2 : + GM07Theorem42Statement.{u} := by + intro S _ _ hS hconn hbd Y hY_conn hY_open hY_oarc + have hS_closed : IsClosedSurface S := isClosedSurface_of_bd_eq_empty hS hbd + refine Surface.open_disc S Y hS_closed hconn hY_conn hY_open fun F hFY hF => ?_ + obtain ⟨Δ, hΔ, hsub, hΔY⟩ := hY_oarc F hF hFY + rw [subBd_eq_discBd_of_bd_eq_empty hS hbd hΔ] at hsub + exact ⟨Δ, hΔY, hΔ, hsub⟩ + +/-- Unconditional proof of `GM12.GM07Theorem51Statement` (Graph Minors VII, (5.1), page 230). -/ +theorem gm07_theorem_5_1 : + GM07Theorem51Statement.{u} := by + intro S _ hS hconn X hX_solid hX_ne + exact @theorem_5_1_proof S _ hS hconn X hX_solid hX_ne + +/-- Unconditional proof of `GM12.GM07Theorem52Statement` (Graph Minors VII, (5.2), page 230). -/ +theorem gm07_theorem_5_2 : + GM07Theorem52Statement.{u} := by + intro S _ hS C X _ hX_solid hXC + exact @theorem_5_2_proof S _ hS X C hX_solid hXC + +/-- Unconditional proof of `GM12.GM07Theorem55Statement` (Graph Minors VII, (5.5), page 231). -/ +theorem gm07_theorem_5_5 : + GM07Theorem55Statement.{u} := by + intro S _ hS hconn G hG R hR hZ_ne + rw [@theorem_5_5_proof S _ hS hconn G hG R hR (closure (⋃₀ R)) rfl hZ_ne] + constructor + · intro h F hF_norm hF_oarc hF_sub + exact h F hF_sub hF_norm hF_oarc + · intro h F hF_sub hF_norm hF_oarc + exact h F hF_norm hF_oarc hF_sub + +/-- Unconditional proof of `GM11.GM07Theorem112Statement` (Graph Minors VII, (11.2), page 249). -/ +theorem gm07_theorem_11_2 : + GM07Theorem112Statement.{u} := by + intro S _ hS φ hφ + exact theorem_11_2_proof hS φ hφ + +/-- Proof of `GM11.GM07Theorem1110Statement` (Graph Minors VII, (11.10), page 253). -/ +theorem gm07_theorem_11_10 : + GM07Theorem1110Statement.{u} := by + intro S _ _ hS hconn Z hZ_solid hZ_flat + exact @theorem_11_10_proof S _ hS hconn Z hZ_solid hZ_flat + +/-- Unconditional proof of `GM19.GM07PlanarIffStatement` (Graph Minors VII, (5.1), page 230). -/ +theorem gm07_planar_iff : + GM19.GM07PlanarIffStatement.{u} := by + intro S _ _ hS hconn X hX_solid hX_ne + exact @theorem_5_1_proof S _ hS hconn X hX_solid hX_ne + +/-- Unconditional proof of `GM19.GM07AlphaExistsStatement` (Graph Minors VII, Section 5, page 230). +-/ +theorem gm07_alpha_exists : + GM19.GM07AlphaExistsStatement.{u} := + gm07_alpha_exists_core + +/-- Proof of Graph Minors VII, (11.9) (page 253) for closed surfaces (`bd S = ∅`, the setting of +Graph Minors XIV), yielding `GM14.IsArcSimplyConnected Y`. -/ +theorem gm07_theorem_11_9_closed : + ∀ (S : Type u) [TopologicalSpace S], + IsSurface S → ConnectedSpace S → bd S = ∅ → + ∀ Z : Set S, IsFlat Z → IsLocallyArcConnected Z → + (IsClosed Z ∨ IsArcConnected Z) → + ∃ Y : Set S, IsOpen Y ∧ IsArcSimplyConnected Y ∧ Z ⊆ Y := by + intro S _ hS hconn hbd Z hZ_flat hZ_lac hZ_cl_or_arc + obtain ⟨Y, hZY, hY_open, hY_asc, _⟩ := + @theorem_11_9_closed S _ hS hbd hconn Z + hZ_flat hZ_lac hZ_cl_or_arc + exact ⟨Y, hY_open, hY_asc, hZY⟩ + +/-- Closed-surface case of VII (11.9), with the general form in `gm07_theorem_11_9_subset`. -/ +theorem gm07_theorem_11_9 : + GM07Theorem119Statement.{u} := by + intro S _ _ hS hconn hbd Z hZ_flat hZ_lac hZ_cl_or_arc + exact gm07_theorem_11_9_closed S hS hconn hbd Z hZ_flat hZ_lac hZ_cl_or_arc + +/-- Proof of Graph Minors VII, (11.9) (page 253) for all surfaces (with possibly nonempty boundary), +using `IsSimplyConnectedSubset Y` (`discBd Δ = F`). -/ +theorem gm07_theorem_11_9_subset : + ∀ (S : Type u) [TopologicalSpace S], + IsSurface S → ConnectedSpace S → + ∀ Z : Set S, IsFlat Z → IsLocallyArcConnected Z → + (IsClosed Z ∨ IsArcConnected Z) → + ∃ Y : Set S, IsOpen Y ∧ IsSimplyConnectedSubset Y ∧ Z ⊆ Y := by + intro S _ hS hconn Z hZ_flat hZ_lac hZ_cl_or_arc + obtain ⟨Y, hZY, hY_open, hY_sc, _⟩ := + @theorem_11_9_proof S _ hS hconn Z hZ_flat hZ_lac hZ_cl_or_arc + exact ⟨Y, hY_open, hY_sc, hZY⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CapMap.lean b/LeanPool/GraphMinor/GM07/CapMap.lean new file mode 100644 index 0000000000..efb8401043 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CapMap.lean @@ -0,0 +1,423 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section5 +public import LeanPool.GraphMinor.GM07.Section8 +public import LeanPool.GraphMinor.GM07.Taper + +/-! +# Maps between capped surfaces + +A homeomorphism of the boundaries of two closed discs extends to the discs, radially +(`exists_radial`). So a map of surfaces +that is one to one between two cuffs extends to the surfaces with discs pasted on these cuffs +(`exists_cap_map`). In particular +two ways of pasting a disc on a cuff are the same (`IsPlanarInCappedCuff.of_cap`). + +`isPlanar_of_homotopy` says when a solid set is planar: each `O`-arc of it is homotopic into a +closed disc. With this we compare a +set with its image under a map homotopic to the identity, without moving the discs. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 + +universe u v + +local notation "𝕀" => unitInterval + +variable {Y Y' : Type u} {S S' : Type v} [TopologicalSpace Y] [TopologicalSpace Y'] + [TopologicalSpace S] [TopologicalSpace S'] + +/-- The radial extension of a map of the circle to the closed ball. -/ +theorem exists_radial {b : ℂ → ℂ} (hb : ContinuousOn b (sphere 0 1)) (hm : MapsTo b (sphere 0 1) + (sphere 0 1)) + (hi : InjOn b (sphere 0 1)) (hs : SurjOn b (sphere 0 1) (sphere 0 1)) : + ∃ G : ℂ → ℂ, ContinuousOn G (closedBall 0 1) ∧ (∀ z ∈ sphere (0 : ℂ) 1, G z = b z) ∧ InjOn G + (closedBall 0 1) ∧ + (∀ z ∈ closedBall (0 : ℂ) 1, ‖G z‖ = ‖z‖) ∧ SurjOn G (closedBall 0 1) (closedBall 0 1) := by + classical + let u : ℂ → ℂ := fun z => z / (‖z‖ : ℂ) + have hus : ∀ z : ℂ, z ≠ 0 → u z ∈ sphere (0 : ℂ) 1 := fun z hz => by + rw [mem_sphere_zero_iff_norm] + simp [u, hz] + let G : ℂ → ℂ := fun z => (‖z‖ : ℂ) * b (u z) + have hn : ∀ z : ℂ, ‖G z‖ = ‖z‖ := fun z => by + by_cases hz : z = 0 + · simp [G, hz] + · have h1 := mem_sphere_zero_iff_norm.mp (hm (hus z hz)) + simp [G, h1] + have hzu : ∀ z : ℂ, z ≠ 0 → (‖z‖ : ℂ) * u z = z := fun z hz => by + have : (‖z‖ : ℂ) ≠ 0 := by simpa using hz + simp only [u] + field_simp + refine ⟨G, ?_, ?_, ?_, fun z _ => hn z, ?_⟩ + · intro z hz + by_cases h0 : z = 0 + · subst h0 + have hG0 : G 0 = 0 := by simp [G] + apply ContinuousAt.continuousWithinAt + rw [ContinuousAt, hG0, tendsto_zero_iff_norm_tendsto_zero] + simp only [hn] + exact tendsto_norm_zero + · have h3 : ContinuousOn (fun z => b (u z)) {z | z ≠ 0} := by + refine hb.comp ?_ fun x hx => hus x hx + exact fun x hx => (ContinuousAt.continuousWithinAt + (continuousAt_id.div (Complex.continuous_ofReal.continuousAt.comp + continuous_norm.continuousAt) (by simpa using hx))) + have h4 : ContinuousAt (fun z => b (u z)) z := h3.continuousAt (isOpen_ne.mem_nhds h0) + exact ((Complex.continuous_ofReal.continuousAt.comp continuous_norm.continuousAt).mul + h4).continuousWithinAt + · intro z hz + have h1 : ‖z‖ = 1 := mem_sphere_zero_iff_norm.mp hz + have h2 : u z = z := by simp [u, h1] + simp [G, h1, h2] + · intro z _ w _ he + have h1 : ‖z‖ = ‖w‖ := by rw [← hn z, ← hn w, he] + by_cases hz : z = 0 + · subst hz + rw [norm_zero] at h1 + exact (norm_eq_zero.mp h1.symm).symm + have hw : w ≠ 0 := fun h => hz (norm_eq_zero.mp (by rw [h1, h, norm_zero])) + have h2 : (‖z‖ : ℂ) ≠ 0 := by simpa using hz + have h3 : b (u z) = b (u w) := by + simp only [G, h1] at he + exact mul_left_cancel₀ (by rw [← h1]; exact h2) he + have h4 := hi (hus z hz) (hus w hw) h3 + rw [← hzu z hz, ← hzu w hw, h4, h1] + · intro w hw + have hw' : ‖w‖ ≤ 1 := mem_closedBall_zero_iff.mp hw + by_cases h0 : w = 0 + · exact ⟨0, by simp, by simp [G, h0]⟩ + obtain ⟨z, hz, he⟩ := hs (hus w h0) + have hz1 : ‖z‖ = 1 := mem_sphere_zero_iff_norm.mp hz + have hz0 : z ≠ 0 := fun h => by simp [h] at hz1 + refine ⟨(‖w‖ : ℂ) * z, mem_closedBall_zero_iff.mpr ?_, ?_⟩ + · simpa [hz1] using hw' + · have hne : (‖w‖ : ℂ) ≠ 0 := by simpa using h0 + have h1 : ‖(‖w‖ : ℂ) * z‖ = ‖w‖ := by simp [hz1] + have h2 : u ((‖w‖ : ℂ) * z) = z := by + simp only [u, h1] + field_simp + simp only [G, h1, h2, he] + exact hzu w h0 + +/-- A map of surfaces that is one to one from a cuff onto a cuff extends to the surfaces with discs +on these cuffs. It takes the +disc onto the disc, one to one, and the inside to the inside. -/ +theorem exists_cap_map {C : Set Y} {C₀ : Set S} {jY : Y → Y'} {DY : Set Y'} {j : S + → S'} {D : Set S'} + [CompactSpace Y] [T2Space Y'] + (hY : IsCappedCuff C Y' jY DY) (hS : IsCappedCuff C₀ S' j D) {φ : Y → S} (hφ : Continuous φ) + (hb : BijOn φ C C₀) + (hne : C.Nonempty) : + ∃ Ψ : Y' → S', Continuous Ψ ∧ (∀ y, Ψ (jY y) = j (φ y)) ∧ MapsTo Ψ DY D ∧ InjOn Ψ DY + ∧ SurjOn Ψ DY D ∧ + MapsTo Ψ (discInt DY) (discInt D) := by + classical + obtain ⟨h₁, g₁, c₁⟩ := hY.isClosedDisc.exists_isChart + obtain ⟨h₂, g₂, c₂⟩ := hS.isClosedDisc.exists_isChart + have : Nonempty Y := hne.nonempty + let J : Y' → Y := Function.invFun jY + have hJ : ∀ y, J (jY y) = y := Function.leftInverse_invFun hY.isEmbedding.injective + have hemb : IsClosedEmbedding jY := hY.isEmbedding.continuous.isClosedEmbedding + hY.isEmbedding.injective + have hJc : ContinuousOn J (range jY) := by + rw [continuousOn_iff_continuous_domRestrict] + have : (range jY).domRestrict J = hY.isEmbedding.toHomeomorph.symm := by + funext y + obtain ⟨y, x, rfl⟩ := y + change J (jY x) = _ + rw [hJ] + exact (hY.isEmbedding.toHomeomorph.symm_apply_apply x).symm + rw [this] + exact Homeomorph.continuous _ + have hbdY : discBd DY = jY '' C := hY.discBd_eq + have hbdS : discBd D = j '' C₀ := hS.discBd_eq + let P : Y' → S' := fun x => j (φ (J x)) + have hPc : ContinuousOn P (range jY) := hS.isEmbedding.continuous.comp_continuousOn + (hφ.comp_continuousOn hJc) + have hPb : ∀ y ∈ C, P (jY y) ∈ discBd D := fun y hy => by + change j (φ (J (jY y))) ∈ _ + rw [hJ, hbdS] + exact mem_image_of_mem j (hb.mapsTo hy) + have hgs : ∀ z ∈ sphere (0 : ℂ) 1, g₁ z ∈ jY '' C := fun z hz => hbdY ▸ c₁.g_sphere ▸ + mem_image_of_mem g₁ hz + let f : ℂ → ℂ := fun z => h₂ (P (g₁ z)) + have hfc : ContinuousOn f (sphere 0 1) := by + refine c₂.hc.comp (hPc.comp (c₁.gc.mono sphere_subset_closedBall) ?_) ?_ + · intro z hz + obtain ⟨y, -, he⟩ := hgs z hz + exact ⟨y, he⟩ + · intro z hz + obtain ⟨y, hy, he⟩ := hgs z hz + change P (g₁ z) ∈ D + rw [← he] + exact Surface.discBd_subset _ (hPb y hy) + have hfm : MapsTo f (sphere 0 1) (sphere 0 1) := fun z hz => by + obtain ⟨y, hy, he⟩ := hgs z hz + change h₂ (P (g₁ z)) ∈ _ + rw [← he, ← c₂.bd] + exact mem_image_of_mem h₂ (hPb y hy) + have hP2 : ∀ y ∈ C, g₂ (h₂ (P (jY y))) = P (jY y) := fun y hy => c₂.gh (Surface.discBd_subset _ + (hPb y hy)) + have hfi : InjOn f (sphere 0 1) := fun z hz w hw he => by + obtain ⟨y, hy, hey⟩ := hgs z hz + obtain ⟨y', hy', hey'⟩ := hgs w hw + change h₂ (P (g₁ z)) = h₂ (P (g₁ w)) at he + rw [← hey, ← hey'] at he + have h1 := congrArg g₂ he + rw [hP2 y hy, hP2 y' hy'] at h1 + change j (φ (J (jY y))) = j (φ (J (jY y'))) at h1 + rw [hJ, hJ] at h1 + have h2 := hb.injOn hy hy' (hS.isEmbedding.injective h1) + have h3 : g₁ z = g₁ w := by rw [← hey, ← hey', h2] + rw [← c₁.hg (sphere_subset_closedBall hz), ← c₁.hg (sphere_subset_closedBall hw), h3] + have hfs : SurjOn f (sphere 0 1) (sphere 0 1) := fun w hw => by + have h1 : g₂ w ∈ discBd D := c₂.g_sphere ▸ mem_image_of_mem g₂ hw + rw [hbdS] at h1 + obtain ⟨s, hs, he⟩ := h1 + obtain ⟨y, hy, rfl⟩ := hb.surjOn hs + have h2 : jY y ∈ discBd DY := hbdY ▸ mem_image_of_mem jY hy + rw [← c₁.g_sphere] at h2 + obtain ⟨z, hz, hez⟩ := h2 + refine ⟨z, hz, ?_⟩ + change h₂ (P (g₁ z)) = w + rw [hez] + change h₂ (j (φ (J (jY y)))) = w + rw [hJ, he, c₂.hg (sphere_subset_closedBall hw)] + obtain ⟨G, hGc, hGs, hGi, hGn, hGo⟩ := exists_radial hfc hfm hfi hfs + have hGm : ∀ z ∈ closedBall (0 : ℂ) 1, G z ∈ closedBall (0 : ℂ) 1 := fun z hz => + mem_closedBall_zero_iff.mpr (by rw [hGn z hz]; exact mem_closedBall_zero_iff.mp hz) + let Ψ : Y' → S' := fun x => if x ∈ DY then g₂ (G (h₁ x)) else P x + have hcov : DY ∪ range jY = univ := by rw [union_comm]; exact hY.union_eq + have hmeet : range jY ∩ DY = jY '' C := hY.inter_eq + have h1c : ContinuousOn Ψ DY := by + have h3 : ContinuousOn (fun x => g₂ (G (h₁ x))) DY := c₂.gc.comp (hGc.comp c₁.hc c₁.hm) fun x + hx => hGm _ (c₁.hm hx) + exact h3.congr fun x hx => ite_eq_left hx + have hagree : ∀ y ∈ C, g₂ (G (h₁ (jY y))) = P (jY y) := fun y hy => by + have h3 : jY y ∈ discBd DY := hbdY ▸ mem_image_of_mem jY hy + have h4 : h₁ (jY y) ∈ sphere (0 : ℂ) 1 := c₁.bd ▸ mem_image_of_mem h₁ h3 + rw [hGs _ h4] + change g₂ (h₂ (P (g₁ (h₁ (jY y))))) = _ + rw [c₁.gh (hY.isClosedDisc.isCompact.isClosed |> fun _ => Surface.discBd_subset _ h3), hP2 y hy] + have hΨj : ∀ y, Ψ (jY y) = j (φ y) := fun y => by + change (if jY y ∈ DY then _ else _) = _ + split_ifs with h3 + · have h4 : jY y ∈ range jY ∩ DY := ⟨mem_range_self y, h3⟩ + rw [hmeet] at h4 + obtain ⟨y', hy', he⟩ := h4 + rw [hemb.injective he] at hy' + rw [hagree y hy'] + change j (φ (J (jY y))) = _ + rw [hJ] + · change j (φ (J (jY y))) = _ + rw [hJ] + have h2c : ContinuousOn Ψ (range jY) := by + refine hPc.congr ?_ + rintro _ ⟨y, rfl⟩ + rw [hΨj] + change _ = j (φ (J (jY y))) + rw [hJ] + have hΨd : ∀ x ∈ DY, Ψ x = g₂ (G (h₁ x)) := fun x hx => ite_eq_left hx + refine ⟨Ψ, ?_, hΨj, ?_, ?_, ?_, ?_⟩ + · rw [← continuousOn_univ, ← hcov] + exact h1c.union_of_isClosed h2c hY.isClosedDisc.isCompact.isClosed hemb.isClosed_range + · intro x hx + rw [hΨd x hx] + exact c₂.gm (hGm _ (c₁.hm hx)) + · intro x hx x' hx' he + rw [hΨd x hx, hΨd x' hx'] at he + have h3 := congrArg h₂ he + rw [c₂.hg (hGm _ (c₁.hm hx)), c₂.hg (hGm _ (c₁.hm hx'))] at h3 + have h4 := hGi (c₁.hm hx) (c₁.hm hx') h3 + rw [← c₁.gh hx, ← c₁.gh hx', h4] + · intro w hw + obtain ⟨z, hz, he⟩ := hGo (c₂.hm hw) + refine ⟨g₁ z, c₁.gm hz, ?_⟩ + rw [hΨd _ (c₁.gm hz), c₁.hg hz, he, c₂.gh hw] + · rintro x ⟨hx, hxb⟩ + rw [hΨd x hx] + have h3 : ‖h₁ x‖ < 1 := by + refine lt_of_le_of_ne (mem_closedBall_zero_iff.mp (c₁.hm hx)) fun he => hxb ?_ + rw [← c₁.g_sphere] + exact ⟨h₁ x, mem_sphere_zero_iff_norm.mpr he, c₁.gh hx⟩ + refine ⟨c₂.gm (hGm _ (c₁.hm hx)), fun hb' => ?_⟩ + have h4 : h₂ (g₂ (G (h₁ x))) ∈ sphere (0 : ℂ) 1 := c₂.bd ▸ mem_image_of_mem h₂ hb' + rw [c₂.hg (hGm _ (c₁.hm hx)), mem_sphere_zero_iff_norm, hGn _ (c₁.hm hx)] at h4 + exact h3.ne h4 + +/-- If a set is planar in one surface with a disc pasted on `C`, then it is planar in all of them. +-/ +theorem isPlanarInCappedCuff_of_cap (hY : IsSurface Y) {C X : Set Y} {T : Type u} [TopologicalSpace + T] {j : Y → T} {D : Set T} + (hc : IsCappedCuff C T j D) (hX : IsPlanar (j '' X)) : IsPlanarInCappedCuff C X := by + have : CompactSpace Y := hY.1 + have : T2Space T := hc.isSurface.2.1 + have hne : C.Nonempty := by + obtain ⟨y, hy, rfl⟩ := hc.cuff + exact ⟨y, mem_connectedComponentIn hy⟩ + refine ⟨hc.cuff, ⟨T, inferInstance, j, D, hc, hX⟩, fun T₂ _ j₂ D₂ hc₂ => ?_⟩ + have : T2Space T₂ := hc₂.isSurface.2.1 + obtain ⟨Ψ, hΨc, hΨj, -, hΨi, -, hΨo⟩ := exists_cap_map hc hc₂ continuous_id (bijOn_id C) hne + have hman : ∀ x : T, IsManifoldPoint x := hc.isSurface.2.2 + have hcov : ∀ x, x ∈ range j ∨ x ∈ discInt D := fun x => by + rcases (hc.union_eq.ge (mem_univ x)) with h | h + · exact .inl h + · by_cases hb : x ∈ discBd D + · rw [hc.discBd_eq] at hb + obtain ⟨y, -, rfl⟩ := hb + exact .inl (mem_range_self y) + · exact .inr ⟨h, hb⟩ + have hdis : ∀ y, ∀ x ∈ discInt D, j₂ y ≠ Ψ x := fun y x hx he => by + have h1 := hΨo hx + rw [← he] at h1 + have h2 : j₂ y ∈ range j₂ ∩ D₂ := ⟨mem_range_self y, h1.1⟩ + rw [hc₂.inter_eq, ← hc₂.discBd_eq] at h2 + exact h1.2 h2 + have hinj : Function.Injective Ψ := fun x x' he => by + rcases hcov x with ⟨y, rfl⟩ | hx <;> rcases hcov x' with ⟨y', rfl⟩ | hx' + · rw [hΨj, hΨj] at he + exact congrArg j (hc₂.isEmbedding.injective he) + · rw [hΨj] at he + exact (hdis y x' hx' he).elim + · rw [hΨj] at he + exact (hdis y' x hx he.symm).elim + · exact hΨi hx.1 hx'.1 he + obtain ⟨Δ, hΔ, hsub⟩ := hX + refine ⟨Ψ '' Δ, isClosedDisc_image_of_injective hΨc hinj hΔ, ?_⟩ + rintro _ ⟨y, hy, rfl⟩ + have h1 : j y ∈ Δ := hsub (mem_image_of_mem j hy) + exact ⟨j y, h1, hΨj y⟩ + +/-- `O`-arc images: a one to one continuous map carries a parametrization along. -/ +theorem exists_param_image {A : Type*} {B : Type*} [TopologicalSpace A] [TopologicalSpace B] + [T2Space B] {F : Set A} + (f : Circle ≃ₜ F) {g : A → B} (hg : Continuous g) (hi : InjOn g F) : + ∃ e : Circle ≃ₜ (g '' F), ∀ w, (e w).1 = g (f w).1 := by + let k : Circle → g '' F := fun w => ⟨g (f w).1, (f w).1, (f w).2, rfl⟩ + have hkc : Continuous k := Continuous.subtype_mk (hg.comp (continuous_subtype_val.comp + f.continuous)) _ + have hkb : Function.Bijective k := by + constructor + · intro w w' he + have h1 : g (f w).1 = g (f w').1 := congrArg Subtype.val he + exact f.injective (Subtype.ext (hi (f w).2 (f w').2 h1)) + · rintro ⟨_, x, hx, rfl⟩ + exact ⟨f.symm ⟨x, hx⟩, Subtype.ext (by simp [k])⟩ + exact ⟨Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective k hkb) hkc, fun w => rfl⟩ + +/-- A curve homotopic into a closed disc is null-homotopic. -/ +theorem null_of_homotopy_into_disc {T : Type v} [TopologicalSpace T] {H : 𝕀 × Y → T} + (hH : Continuous H) {f : Circle → Y} + (hf : Continuous f) {Δ : Set T} (hΔ : IsClosedDisc Δ) (h1 : ∀ w, H (1, f w) ∈ Δ) : + ClosedCurveIsNullHomotopicIn univ ⟨fun w => H (0, f w), hH.comp (continuous_const.prodMk hf)⟩ + := by + let b : C(Circle, T) := ⟨fun w => H (1, f w), hH.comp (continuous_const.prodMk hf)⟩ + have hn : ClosedCurveIsNullHomotopicIn Δ b := hΔ.isSimplyConnectedSet.2 b (by + rintro _ ⟨w, rfl⟩ + exact h1 w) + refine null_of_homotopic (subset_univ Δ) ?_ hn + exact ⟨⟨fun q => H (q.2, f q.1), hH.comp ((continuous_snd).prodMk (hf.comp continuous_fst))⟩, + fun _ => mem_univ _, fun _ => rfl, fun _ => rfl⟩ + +/-- A solid set is planar if the image of each of its `O`-arcs is null-homotopic. -/ +theorem isPlanar_of_null {T : Type u} [TopologicalSpace T] [CompactSpace Y] [T2Space Y] + (hT : IsSurface T) [ConnectedSpace T] + {j : Y → T} (hj : IsEmbedding j) {X : Set Y} (hX : IsSolid X) (hne : ¬ IsSphere T + ∨ j '' X ≠ univ) + (h1 : ∀ F, IsOArc F → F ⊆ X → ∀ f : Circle → Y, Continuous f → range f = F → ∀ hc : Continuous + (fun w => j (f w)), + ClosedCurveIsNullHomotopicIn univ ⟨fun w => j (f w), hc⟩) : IsPlanar (j '' X) := by + have : T2Space T := hT.2.1 + have hcl : IsClosedEmbedding j := hj.continuous.isClosedEmbedding hj.injective + rw [theorem_5_1_of_not_isSphere hT hne (isSolid_image_of_isClosedEmbedding hcl hX)] + intro F hF hFX + have hsub : F ⊆ range j := hFX.trans (image_subset_range _ _) + have hF₀ : IsOArc (j ⁻¹' F) := IsOArc.pull_of_embedding hj hF hsub + have hF₀X : j ⁻¹' F ⊆ X := fun y hy => by + obtain ⟨y', hy', he⟩ := hFX hy + rwa [← hj.injective he] + obtain ⟨f⟩ := id hF₀ + obtain ⟨e, he⟩ := exists_param_image f hj.continuous hj.injective.injOn + have himg : j '' (j ⁻¹' F) = F := image_preimage_eq_of_subset hsub + rw [isPlanar_iff_isNullHomotopicOArc_of_isOArc hT hF, ← himg] + refine ⟨e, ?_⟩ + have hfc : Continuous fun w => (f w).1 := continuous_subtype_val.comp f.continuous + have h2 := h1 _ hF₀ hF₀X _ hfc (by + ext y + constructor + · rintro ⟨w, rfl⟩ + exact (f w).2 + · intro hy + exact ⟨f.symm ⟨y, hy⟩, by simp⟩) (hj.continuous.comp hfc) + convert h2 using 2 + ext w + simp [he] + +/-- A solid set is planar if each of its `O`-arcs is homotopic into a closed disc. -/ +theorem isPlanar_of_homotopy {T : Type u} [TopologicalSpace T] [CompactSpace Y] [T2Space Y] + (hT : IsSurface T) [ConnectedSpace T] + {j : Y → T} (hj : IsEmbedding j) {X : Set Y} (hX : IsSolid X) (hne : ¬ IsSphere T + ∨ j '' X ≠ univ) {H : 𝕀 × Y → T} + (hH : Continuous H) (h0 : ∀ y, H (0, y) = j y) + (h1 : ∀ F, IsOArc F → F ⊆ X → ∃ Δ, IsClosedDisc Δ ∧ ∀ y ∈ F, H (1, y) ∈ Δ) : IsPlanar (j '' X) + := by + refine isPlanar_of_null hT hj hX hne fun F hF hFX f hf hrange hc => ?_ + obtain ⟨Δ, hΔ, hs⟩ := h1 F hF hFX + have h2 := null_of_homotopy_into_disc hH hf hΔ fun w => hs _ (hrange ▸ mem_range_self w) + convert h2 using 2 + ext w + simp [h0] + +/-- The inverse of a one to one map on a compact set, as a disc: the preimage of a closed disc is a +closed disc if the map is +one to one on it. -/ +theorem isClosedDisc_preimage_of_injOn {A B : Type*} [TopologicalSpace A] [TopologicalSpace B] + [CompactSpace A] [T2Space B] + {f : A → B} (hf : Continuous f) (hs : Function.Surjective f) {Δ : Set B} (hΔ : IsClosedDisc Δ) + (hi : InjOn f (f ⁻¹' Δ)) : + IsClosedDisc (f ⁻¹' Δ) ∧ discBd (f ⁻¹' Δ) = f ⁻¹' discBd Δ := by + obtain ⟨b, hb⟩ : Δ.Nonempty := by + obtain ⟨h⟩ := id hΔ + exact ⟨_, (h ⟨0, mem_closedBall_self zero_le_one⟩).2⟩ + have : Nonempty A := ⟨(hs b).choose⟩ + have hK : IsCompact (f ⁻¹' Δ) := (hΔ.isCompact.isClosed.preimage hf).isCompact + obtain ⟨g, hgc, hgl⟩ := exists_inv_of_compactOn hK hf.continuousOn hi + have him : f '' (f ⁻¹' Δ) = Δ := image_preimage_eq Δ hs + rw [him] at hgc + have hr : RightInvOn g f Δ := fun y hy => by + obtain ⟨x, rfl⟩ := hs y + rw [hgl (show x ∈ f ⁻¹' Δ from hy)] + have hl : LeftInvOn f g Δ := hr + have hgK : g '' Δ = f ⁻¹' Δ := by + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + change f (g y) ∈ Δ + rwa [hl hy] + · intro hx + exact ⟨f x, hx, hgl hx⟩ + obtain ⟨h1, h2⟩ := hΔ.image hgc hf.continuousOn hl + rw [hgK] at h1 h2 + refine ⟨h1, h2.trans ?_⟩ + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + change f (g y) ∈ discBd Δ + rwa [hl (Surface.discBd_subset _ hy)] + · intro hx + exact ⟨f x, hx, hgl (Surface.discBd_subset _ hx : f x ∈ Δ)⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CollarPush.lean b/LeanPool/GraphMinor/GM07/CollarPush.lean new file mode 100644 index 0000000000..c1a98cb038 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CollarPush.lean @@ -0,0 +1,1125 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.TameDisc +public import LeanPool.GraphMinor.GM07.Defs +public import Mathlib.AlgebraicTopology.FundamentalGroupoid.Basic + +/-! +# Pushing a collar across an annulus + +The step of Graph Minors VII, (6.1), page 238: "Loosely, we regard $\Sigma'$ as a subset of +$\Sigma$" and "By replacing $H$ by a homotopic forest if necessary". +We take two annuli that share their outer circle, the second inside the first. Then the part of the +surface off the inner annulus is the image of the whole +surface under a map `h` that fixes everything off the outer annulus, and `h` is homotopic to the +identity. The annuli are given by charts on `1 ≤ ‖z‖ ≤ 2`. + +We twist the first chart so that the path traced by a chosen point of the inner circle is homotopic +to a chosen path `Q` (`exists_collar_push`). This needs a lift of the angle of `Q`, and a straight +line homotopy in polar coordinates. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface + +universe u + +/-- The annulus `1 ≤ ‖z‖ ≤ 2`. -/ +def collarAnnulus : Set ℂ := {z | 1 ≤ ‖z‖ ∧ ‖z‖ ≤ 2} + +/-- The annulus without its outer circle. -/ +def collarOpen : Set ℂ := {z | 1 ≤ ‖z‖ ∧ ‖z‖ < 2} + +/-- The radial push of the annulus onto its outer circle. -/ +noncomputable def radialPush (t : ℝ) (z : ℂ) : ℂ := (((1 - t) * ‖z‖ + 2 * t : ℝ) : ℂ) * dirOf z + +theorem collarOpen_subset : collarOpen ⊆ collarAnnulus := fun _ hz => ⟨hz.1, hz.2.le⟩ + +theorem ne_zero_of_mem_collar {z : ℂ} (hz : z ∈ collarAnnulus) : z ≠ 0 := fun h => by + have := hz.1 + rw [h, norm_zero] at this + linarith + +theorem norm_real_mul_dirOf {r : ℝ} (hr : 0 ≤ r) {z : ℂ} (hz : z ≠ 0) : ‖(r : ℂ) * dirOf z‖ = r + := by + rw [norm_mul, norm_dirOf hz, mul_one, Complex.norm_real, Real.norm_of_nonneg hr] + +theorem norm_radialPush {t : ℝ} (ht0 : 0 ≤ t) (ht1 : t ≤ 1) {z : ℂ} (hz : z ∈ collarAnnulus) : + ‖radialPush t z‖ = (1 - t) * ‖z‖ + 2 * t := by + have h1 := hz.1 + refine norm_real_mul_dirOf ?_ (ne_zero_of_mem_collar hz) + nlinarith + +theorem radialPush_mem {t : ℝ} (ht0 : 0 ≤ t) (ht1 : t ≤ 1) {z : ℂ} (hz : z ∈ collarAnnulus) : + radialPush t z ∈ collarAnnulus := by + have h1 := hz.1 + have h2 := hz.2 + have := norm_radialPush ht0 ht1 hz + constructor <;> rw [this] <;> nlinarith + +theorem radialPush_zero {z : ℂ} (hz : z ≠ 0) : radialPush 0 z = z := by + have := eq_mul_dirOf hz + simp only [radialPush] + rw [show ((1 - 0) * ‖z‖ + 2 * 0 : ℝ) = ‖z‖ by ring] + exact this.symm + +theorem radialPush_of_norm {t : ℝ} {z : ℂ} (hz : ‖z‖ = 2) : radialPush t z = z := by + have h0 : z ≠ 0 := fun h => by + rw [h, norm_zero] at hz + norm_num at hz + have := eq_mul_dirOf h0 + simp only [radialPush] + rw [show ((1 - t) * ‖z‖ + 2 * t : ℝ) = ‖z‖ by rw [hz]; ring] + exact this.symm + +theorem continuousOn_radialPush : ContinuousOn (fun q : ℝ × ℂ => radialPush q.1 q.2) + (univ ×ˢ collarAnnulus) := by + have h : ContinuousOn (fun q : ℝ × ℂ => dirOf q.2) (univ ×ˢ collarAnnulus) := + continuousOn_dirOf.comp continuous_snd.continuousOn fun q hq => ne_zero_of_mem_collar hq.2 + simp only [radialPush] + refine ContinuousOn.mul ?_ h + exact Complex.continuous_ofReal.comp_continuousOn (by fun_prop) + +variable {S : Type*} [TopologicalSpace S] + +/-- A chart of an annulus in `S`. -/ +structure IsCollarChart (c : ℂ → S) (c' : S → ℂ) : Prop where + cont : ContinuousOn c collarAnnulus + cont' : ContinuousOn c' (c '' collarAnnulus) + left : LeftInvOn c' c collarAnnulus + +theorem IsCollarChart.injOn {c : ℂ → S} {c' : S → ℂ} (h : IsCollarChart c c') : InjOn c + collarAnnulus := + h.left.injOn + +theorem IsCollarChart.mem_of_mem {c : ℂ → S} {c' : S → ℂ} (h : IsCollarChart c c') {x : S} + (hx : x ∈ c '' collarAnnulus) : c' x ∈ collarAnnulus ∧ c (c' x) = x := by + obtain ⟨z, hz, rfl⟩ := hx + rw [h.left hz] + exact ⟨hz, rfl⟩ + +/-- A self map of the annulus that keeps norms carries a chart to a chart. -/ +theorem IsCollarChart.comp {c : ℂ → S} {c' : S → ℂ} (h : IsCollarChart c c') {f f' : ℂ → ℂ} + (hf : ContinuousOn f collarAnnulus) (hf' : ContinuousOn f' collarAnnulus) + (hn : ∀ z ∈ collarAnnulus, ‖f z‖ = ‖z‖) (hn' : ∀ z ∈ collarAnnulus, ‖f' z‖ = ‖z‖) + (hl : ∀ z ∈ collarAnnulus, f' (f z) = z) (hr : ∀ z ∈ collarAnnulus, f (f' z) = z) : + IsCollarChart (c ∘ f) (f' ∘ c') := by + have hm : MapsTo f collarAnnulus collarAnnulus := fun z hz => ⟨(hn z hz).ge.trans' hz.1, + (hn z hz).le.trans hz.2⟩ + have hm' : MapsTo f' collarAnnulus collarAnnulus := fun z hz => ⟨(hn' z hz).ge.trans' hz.1, + (hn' z hz).le.trans hz.2⟩ + have him : ∀ B : Set ℂ, B ⊆ collarAnnulus → (∀ z ∈ collarAnnulus, f z ∈ B ↔ z ∈ B) → (c ∘ f) '' B + = c '' B := fun B hB hiff => by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨f z, (hiff z (hB hz)).mpr hz, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + refine ⟨f' z, ?_, by simp [hr z (hB hz)]⟩ + refine (hiff _ (hm' (hB hz))).mp ?_ + rwa [hr z (hB hz)] + have hA : (c ∘ f) '' collarAnnulus = c '' collarAnnulus := him _ Subset.rfl fun z hz => ⟨fun _ + => hz, fun _ => hm hz⟩ + refine ⟨h.cont.comp hf hm, ?_, fun z hz => ?_⟩ + · rw [hA] + exact hf'.comp h.cont' fun x hx => (h.mem_of_mem hx).1 + · simp [h.left (hm hz), hl z hz] + +/-- The map that fixes the point off the open annulus, and is `E ∘ c'` on it. -/ +noncomputable def chartSwap (c E : ℂ → S) (c' : S → ℂ) (x : S) : S := open Classical in if x ∈ c '' + collarOpen then E (c' x) else x + +/-- The radial push of the annulus in `S`. -/ +noncomputable def chartPush (c : ℂ → S) (c' : S → ℂ) (t : ℝ) (x : S) : S + := open Classical in if x ∈ c '' collarOpen then c (radialPush t (c' x)) else x + +/-- Gluing a map on the annulus to a map off its open part. -/ +theorem continuous_glue {W : Type*} [TopologicalSpace W] [T2Space S] {c : ℂ + → S} {c' : S → ℂ} (h : IsCollarChart c c') (hO : IsOpen (c '' collarOpen)) {π : W → S} + (hπ : Continuous π) + {f g : W → S} (hf : ContinuousOn f (π ⁻¹' (c '' collarAnnulus))) (hg : ContinuousOn g (π ⁻¹' + (c '' collarOpen)ᶜ)) (he : ∀ w, ∀ z, ‖z‖ = 2 → z ∈ collarAnnulus → π w = c z → f w = g w) : + Continuous fun w => open Classical in if π w ∈ c '' collarOpen then f w else g w := by + classical + have hcA : IsClosed (c '' collarAnnulus) := by + have hK : IsCompact collarAnnulus := by + refine Metric.isCompact_of_isClosed_isBounded ?_ ?_ + · exact (isClosed_le continuous_const continuous_norm).inter (isClosed_le continuous_norm + continuous_const) + · exact (Metric.isBounded_closedBall (x := (0 : ℂ)) (r := 2)).subset fun z hz + => by simpa using hz.2 + exact (hK.image_of_continuousOn h.cont).isClosed + have hsub : c '' collarOpen ⊆ c '' collarAnnulus := image_mono collarOpen_subset + have hO' : IsOpen (π ⁻¹' (c '' collarOpen)) := hO.preimage hπ + have hcl : closure {w | π w ∈ c '' collarOpen} ⊆ π ⁻¹' (c '' collarAnnulus) := + closure_minimal (fun w hw => hsub hw) (hcA.preimage hπ) + have hcl' : closure {w | ¬ π w ∈ c '' collarOpen} ⊆ π ⁻¹' (c '' collarOpen)ᶜ := + closure_minimal (fun w hw => hw) hO'.isClosed_compl + refine continuous_if ?_ (hf.mono hcl) (hg.mono hcl') + intro w hw + have h1 : w ∈ closure {w | π w ∈ c '' collarOpen} := hw.1 + have h2 : w ∉ π ⁻¹' (c '' collarOpen) := fun hc => by + have := hO'.frontier_eq ▸ hw + exact this.2 hc + obtain ⟨z, hz, hzw⟩ := hcl h1 + refine he w z ?_ hz hzw.symm + refine le_antisymm hz.2 (not_lt.mp fun hlt => h2 ⟨z, ⟨hz.1, hlt⟩, hzw⟩) + +variable [T2Space S] [CompactSpace S] + +omit [T2Space S] [CompactSpace S] in +theorem IsCollarChart.outer_not_mem {c : ℂ → S} {c' : S → ℂ} (h : IsCollarChart c c') {z : ℂ} + (hz : z ∈ collarAnnulus) (h2 : ‖z‖ = 2) : c z ∉ c '' collarOpen := by + rintro ⟨y, hy, he⟩ + have := h.injOn (collarOpen_subset hy) hz he + rw [this] at hy + exact hy.2.ne h2 + +omit [T2Space S] [CompactSpace S] in +theorem chartPush_zero {c : ℂ → S} {c' : S → ℂ} (h : IsCollarChart c c') + (x : S) : chartPush c c' 0 x = x := by + classical + simp only [chartPush] + split_ifs with hx + · obtain ⟨hz, hzx⟩ := h.mem_of_mem (image_mono collarOpen_subset hx) + rw [radialPush_zero (ne_zero_of_mem_collar hz), hzx] + · rfl + +omit [CompactSpace S] in +theorem continuous_chartPush {c : ℂ → S} {c' : S → ℂ} (h : IsCollarChart c c') (hO : IsOpen + (c '' collarOpen)) {W : Type*} [TopologicalSpace W] {t : W → ℝ} {π : W → S} (ht : Continuous t) + (hπ : Continuous π) + (ht0 : ∀ w, 0 ≤ t w) (ht1 : ∀ w, t w ≤ 1) : Continuous fun w => chartPush c c' (t w) (π w) := by + have h1 : ContinuousOn (fun w => c' (π w)) (π ⁻¹' (c '' collarAnnulus)) + := h.cont'.comp hπ.continuousOn fun w hw => hw + have h2 : ContinuousOn (fun w => radialPush (t w) (c' (π w))) (π ⁻¹' (c '' collarAnnulus)) := + continuousOn_radialPush.comp (ht.continuousOn.prodMk h1) fun w hw => ⟨mem_univ _, + (h.mem_of_mem hw).1⟩ + have h3 : ContinuousOn (fun w => c (radialPush (t w) (c' (π w)))) (π ⁻¹' (c '' collarAnnulus)) := + h.cont.comp h2 fun w hw => radialPush_mem (ht0 w) (ht1 w) (h.mem_of_mem hw).1 + refine continuous_glue h hO hπ h3 hπ.continuousOn fun w z hz hzA he => ?_ + rw [he, h.left hzA, radialPush_of_norm hz] + +omit [CompactSpace S] in +theorem continuous_chartSwap {c E : ℂ → S} {c' E' : S → ℂ} (h : IsCollarChart c c') (hO : IsOpen + (c '' collarOpen)) (hE : IsCollarChart E E') (he : ∀ z, ‖z‖ = 2 → E z = c z) : Continuous + (chartSwap c E c') := by + have h1 : ContinuousOn (fun x => E (c' x)) (c '' collarAnnulus) := hE.cont.comp h.cont' fun x hx + => (h.mem_of_mem hx).1 + refine continuous_glue h hO continuous_id h1 continuousOn_id fun x z hz hzA hx => ?_ + rw [id] at hx + rw [hx, h.left hzA, he z hz] + +omit [TopologicalSpace S] [T2Space S] [CompactSpace S] in +theorem chartSwap_of_not_mem {c E : ℂ → S} {c' : S → ℂ} {x : S} (hx : x ∉ c '' collarOpen) : + chartSwap c E c' x = x := by + classical + simp only [chartSwap, ite_eq_right hx] + +omit [TopologicalSpace S] [T2Space S] [CompactSpace S] in +theorem chartPush_of_not_mem {c : ℂ → S} {c' : S → ℂ} {t : ℝ} {x : S} + (hx : x ∉ c '' collarOpen) : chartPush c c' t x = x := by + classical + simp only [chartPush, ite_eq_right hx] + +omit [T2Space S] [CompactSpace S] in +theorem chartPush_one_not_mem {c : ℂ → S} {c' : S → ℂ} (h : IsCollarChart c c') + (x : S) : chartPush c c' 1 x ∉ c '' collarOpen := by + classical + simp only [chartPush] + split_ifs with hx + · obtain ⟨hz, -⟩ := h.mem_of_mem (image_mono collarOpen_subset hx) + refine h.outer_not_mem (radialPush_mem zero_le_one le_rfl hz) ?_ + rw [norm_radialPush zero_le_one le_rfl hz] + ring + · exact hx + +/-- The homotopy from the identity to `chartSwap`: push out to the outer circle, then come back by +`chartSwap`. -/ +noncomputable def collarHomotopy (c E : ℂ → S) (c' : S → ℂ) (q : ℝ × S) : S := + if q.1 ≤ 1 / 2 then chartPush c c' (2 * q.1) q.2 else chartSwap c E c' (chartPush c c' + (2 - 2 * q.1) q.2) + +omit [CompactSpace S] in +theorem continuous_collarHomotopy {c E : ℂ → S} {c' E' : S → ℂ} (h : IsCollarChart c c') + (hO : IsOpen (c '' collarOpen)) (hE : IsCollarChart E E') (he : ∀ z, ‖z‖ = 2 → E z = c z) : + Continuous fun q : unitInterval × S => collarHomotopy c E c' (q.1.1, q.2) := by + let p : unitInterval × S → ℝ := fun q => max 0 (min 1 (2 * q.1.1)) + let p' : unitInterval × S → ℝ := fun q => max 0 (min 1 (2 - 2 * q.1.1)) + have hp : Continuous p := by fun_prop + have hp' : Continuous p' := by fun_prop + have hp0 : ∀ q, 0 ≤ p q := fun q => le_max_left _ _ + have hp1 : ∀ q, p q ≤ 1 := fun q => max_le zero_le_one (min_le_left _ _) + have hp0' : ∀ q, 0 ≤ p' q := fun q => le_max_left _ _ + have hp1' : ∀ q, p' q ≤ 1 := fun q => max_le zero_le_one (min_le_left _ _) + have c1 := continuous_chartPush h hO hp continuous_snd hp0 hp1 + have c2 := (continuous_chartSwap h hO hE he).comp (continuous_chartPush h hO hp' continuous_snd + hp0' hp1') + have hmain : Continuous fun q : unitInterval × S => if q.1.1 ≤ 1 / 2 then chartPush c c' + (p q) q.2 else (chartSwap c E c' ∘ fun q => chartPush c c' (p' q) q.2) q := by + refine Continuous.if_le c1 c2 (by fun_prop) continuous_const ?_ + intro q hq + have h1 : p q = 1 := by + simp only [p] + rw [hq] + norm_num + have h2 : p' q = 1 := by + simp only [p'] + rw [hq] + norm_num + simp only [comp_apply] + rw [h1, h2, chartSwap_of_not_mem (chartPush_one_not_mem h _)] + convert hmain using 2 with q + simp only [collarHomotopy, comp_apply] + split_ifs with hq + · have ht0 := q.1.2.1 + have h1 : p q = 2 * q.1.1 := by + simp only [p] + rw [min_eq_right (by linarith), max_eq_right (by linarith)] + rw [h1] + · have ht1 := q.1.2.2 + have h1 : p' q = 2 - 2 * q.1.1 := by + simp only [p'] + rw [min_eq_right (by linarith), max_eq_right (by linarith)] + rw [h1] + +/-- The twist of the annulus by the angle `κ` on the outer circle. -/ +noncomputable def collarTwist (κ : ℝ) (z : ℂ) : ℂ := z * Complex.exp (((κ * + (‖z‖ - 1) : ℝ) : ℂ) * Complex.I) + +theorem norm_collarTwist (κ : ℝ) (z : ℂ) : ‖collarTwist κ z‖ = ‖z‖ := by + rw [collarTwist, norm_mul, Complex.norm_exp_ofReal_mul_I, mul_one] + +theorem continuous_collarTwist (κ : ℝ) : Continuous (collarTwist κ) := by + unfold collarTwist + fun_prop + +theorem collarTwist_neg (κ : ℝ) (z : ℂ) : collarTwist (-κ) (collarTwist κ z) = z := by + rw [collarTwist, norm_collarTwist, collarTwist, mul_assoc, ← Complex.exp_add] + have : ((κ * (‖z‖ - 1) : ℝ) : ℂ) * Complex.I + ((-κ * (‖z‖ - 1) : ℝ) : ℂ) * Complex.I = 0 := by + push_cast + ring + rw [this, Complex.exp_zero, mul_one] + +/-- A map of the annulus that keeps radii, given by a map `u` from the unit circle to the circle of +radius 2. -/ +noncomputable def fiberMap (u : ℂ → ℂ) (z : ℂ) : ℂ := ((‖z‖ / 2 : ℝ) : ℂ) * u (dirOf z) + +theorem continuousOn_fiberMap {u : ℂ → ℂ} (hu : ContinuousOn u {w | ‖w‖ = 1}) : ContinuousOn + (fiberMap u) collarAnnulus := by + have h1 : ContinuousOn dirOf collarAnnulus := continuousOn_dirOf.mono fun z hz + => ne_zero_of_mem_collar hz + have h2 : ContinuousOn (fun z => u (dirOf z)) collarAnnulus := hu.comp h1 fun z hz => norm_dirOf + (ne_zero_of_mem_collar hz) + unfold fiberMap + refine ContinuousOn.mul ?_ h2 + exact Complex.continuous_ofReal.comp_continuousOn (by fun_prop) + +theorem norm_fiberMap {u : ℂ → ℂ} (hn : ∀ w, ‖w‖ = 1 → ‖u w‖ = 2) {z : ℂ} + (hz : z ∈ collarAnnulus) : ‖fiberMap u z‖ = ‖z‖ := by + have h0 := ne_zero_of_mem_collar hz + rw [fiberMap, norm_mul, hn _ (norm_dirOf h0), Complex.norm_real, + Real.norm_of_nonneg (by positivity)] + ring + +theorem dirOf_fiberMap {u : ℂ → ℂ} (hn : ∀ w, ‖w‖ = 1 → ‖u w‖ = 2) {z : ℂ} + (hz : z ∈ collarAnnulus) : dirOf (fiberMap u z) = u (dirOf z) / 2 := by + have h0 := ne_zero_of_mem_collar hz + have h1 := norm_fiberMap hn hz + have h2 : (‖z‖ : ℂ) ≠ 0 := by simpa using h0 + have h3 : fiberMap u z ≠ 0 := by + rw [← norm_ne_zero_iff, h1] + exact norm_ne_zero_iff.mpr h0 + have h4 := eq_mul_dirOf h3 + rw [h1] at h4 + nth_rw 1 [fiberMap] at h4 + push_cast at h4 + have h5 : (‖z‖ : ℂ) * (u (dirOf z) / 2) = (‖z‖ : ℂ) * dirOf (fiberMap u z) := by + rw [← h4] + ring + exact (mul_left_cancel₀ h2 h5).symm + +theorem fiberMap_inv {u v : ℂ → ℂ} (hn : ∀ w, ‖w‖ = 1 → ‖u w‖ = 2) (huv : ∀ w, ‖w‖ = 1 → v + (u w / 2) = 2 * w) {z : ℂ} (hz : z ∈ collarAnnulus) : fiberMap v (fiberMap u z) = z := by + have h0 := ne_zero_of_mem_collar hz + rw [fiberMap, norm_fiberMap hn hz, dirOf_fiberMap hn hz, huv _ (norm_dirOf h0)] + nth_rw 3 [eq_mul_dirOf h0] + push_cast + ring + +theorem path_homotopic_of_map {X : Type*} [TopologicalSpace X] {x y : X} {p q : Path x y} {H : + unitInterval × unitInterval → X} (hH : Continuous H) (h0 : ∀ t, H (0, t) = p t) (h1 : ∀ t, H + (1, t) = q t) + (hx : ∀ u, H (u, 0) = x) (hy : ∀ u, H (u, 1) = y) : p.Homotopic q := by + refine ⟨⟨⟨⟨H, hH⟩, ?_, ?_⟩, ?_⟩⟩ + · intro t + simpa using h0 t + · intro t + simpa using h1 t + · rintro u t (rfl | rfl) + · simpa using hx u + · simpa using hy u + +private theorem collar_inclusion_from_open_and_outer_images + {S : Type*} + {c : ℂ → S} + {e : ℂ → S} + (hout : e '' {z | ‖z‖ = 2} = c '' {z | ‖z‖ = 2}) + (hsub : e '' collarOpen ⊆ c '' collarOpen) : + e '' collarAnnulus ⊆ c '' collarAnnulus := by + rintro _ ⟨z, hz, rfl⟩ + rcases hz.2.lt_or_eq with hlt | heq + · exact image_mono collarOpen_subset (hsub ⟨z, ⟨hz.1, hlt⟩, rfl⟩) + · obtain ⟨y, hy, hye⟩ := hout.le ⟨z, heq, rfl⟩ + exact ⟨y, ⟨by rw [show ‖y‖ = 2 from hy]; norm_num, (show ‖y‖ = 2 from hy).le⟩, hye⟩ + +private theorem adjusted_collar_agrees_on_outer_circle + {S : Type*} + {e : ℂ → S} + {e' : S → ℂ} + (t₁ : ℂ → S) + (hemem : ∀ x ∈ e '' {z | ‖z‖ = 2}, ‖e' x‖ = 2 ∧ e (e' x) = x) + (hto : ∀ {w : ℂ}, ‖w‖ = 1 → t₁ (2 * w) ∈ e '' {z | ‖z‖ = 2}) + (hs2 : {z | ‖z‖ = 2} ⊆ collarAnnulus) + (z : ℂ) + (hz : ‖z‖ = 2) : + (e ∘ fiberMap (fun w => e' (t₁ (2 * w)))) z = t₁ z := by + let u := fun w => e' (t₁ (2 * w)) + have hzA : z ∈ collarAnnulus := hs2 hz + have hdn : ‖dirOf z‖ = 1 := norm_dirOf (ne_zero_of_mem_collar hzA) + have h2d : 2 * dirOf z = z := by + nth_rw 2 [eq_mul_dirOf (ne_zero_of_mem_collar hzA)] + rw [hz] + norm_num + have hf : fiberMap u z = u (dirOf z) := by + rw [fiberMap, hz] + norm_num + change e (fiberMap u z) = t₁ z + rw [hf] + change e (e' (t₁ (2 * dirOf z))) = t₁ z + rw [h2d] + simpa only [h2d] using (hemem _ (hto hdn)).2 + +private theorem lifted_angle_gives_collar_homotopy + {S : Type*} + [TopologicalSpace S] + {c : ℂ → S} + {e : ℂ → S} + {c' : S → ℂ} + (hc : IsCollarChart c c') + {w₀ : ℂ} + {w₁ : ℂ} + (h₀ : ‖w₀‖ = 1) + (L : Path (c w₀) (e (2 * w₁))) + (ℓ : ↑unitInterval → ℂ) + (hℓc : Continuous ℓ) + (hℓA : ∀ (t : ↑unitInterval), ℓ t ∈ collarAnnulus) + (hℓe : ∀ (t : ↑unitInterval), c (ℓ t) = L t) + (hℓ0 : ℓ 0 = w₀) + (hℓn1 : ‖ℓ 1‖ = 2) + (θ : C(↑unitInterval, ℝ)) + (hθ : ∀ (t : ↑unitInterval), Complex.exp (↑(θ t) * Complex.I) = dirOf (ℓ t)) + (hθ0 : Complex.exp (↑(θ 0) * Complex.I) = w₀) + (hθ1 : Complex.exp (↑(θ 1) * Complex.I) = ℓ 1 / 2) + (R₁' : Path (c w₀) (e (2 * w₁))) + (hR₁' : ∀ (t : unitInterval), + R₁' t = (c ∘ collarTwist (θ 1 - θ 0)) (((1 + (t : ℝ) : ℝ) : ℂ) * w₀)) : + L.Homotopic R₁' := by + let κ := θ 1 - θ 0 + let t₁ := c ∘ collarTwist κ + let hz : unitInterval × unitInterval → ℂ := fun q => (((1 - q.1.1) * ‖ℓ q.2‖ + q.1.1 * + (1 + q.2.1) : ℝ) : ℂ) * + Complex.exp ((((1 - q.1.1) * θ q.2 + q.1.1 * (θ 0 + κ * q.2.1) : ℝ) : ℂ) * Complex.I) + have hzc : Continuous hz := by + simp only [hz] + have := θ.continuous + fun_prop + have hzA : ∀ q, hz q ∈ collarAnnulus := fun q => by + have hn : ‖hz q‖ = (1 - q.1.1) * ‖ℓ q.2‖ + q.1.1 * (1 + q.2.1) := by + have h1 := q.1.2.1 + have h2 := q.1.2.2 + have h3 := q.2.2.1 + have h4 := (hℓA q.2).1 + simp only [hz] + rw [norm_mul, Complex.norm_exp_ofReal_mul_I, mul_one, Complex.norm_real, + Real.norm_of_nonneg (by nlinarith)] + have h1 := q.1.2.1 + have h2 := q.1.2.2 + have h3 := q.2.2.1 + have h4 := q.2.2.2 + have h5 := (hℓA q.2).1 + have h6 := (hℓA q.2).2 + constructor <;> rw [hn] <;> nlinarith + refine path_homotopic_of_map (H := fun q => c (hz q)) (hc.cont.comp_continuous hzc hzA) (fun t + => ?_) (fun t => ?_) (fun w => ?_) fun w => ?_ + · simp only [hz, Set.Icc.coe_zero, sub_zero, one_mul, zero_mul, add_zero] + rw [hθ, ← eq_mul_dirOf (ne_zero_of_mem_collar (hℓA t))] + exact hℓe t + · simp only [hz, Set.Icc.coe_one, sub_self, zero_mul, one_mul, zero_add] + rw [hR₁'] + simp only [comp_apply, collarTwist] + congr 1 + have hn : ‖((1 + t.1 : ℝ) : ℂ) * w₀‖ = 1 + t.1 := by + have h1 := t.2.1 + rw [norm_mul, h₀, mul_one, Complex.norm_real, Real.norm_of_nonneg (by linarith)] + rw [hn] + rw [← hθ0, mul_assoc, ← Complex.exp_add] + congr 2 + dsimp [κ] + push_cast + ring + · simp only [hz, Set.Icc.coe_zero, mul_zero, add_zero, mul_one] + have hn1 : ‖ℓ 0‖ = 1 := by rw [hℓ0, h₀] + rw [hn1, show (1 - w.1) * 1 + w.1 = 1 by ring, show (1 - w.1) * θ 0 + w.1 * θ 0 + = θ 0 by ring, hθ0] + simp + · simp only [hz, Set.Icc.coe_one] + have h3 : ((1 - w.1) * ‖ℓ 1‖ + w.1 * (1 + 1) : ℝ) = 2 := by + rw [hℓn1] + ring + have h4 : ((1 - w.1) * θ 1 + w.1 * (θ 0 + κ * 1) : ℝ) = θ 1 := by + simp only [κ] + ring + rw [h3, h4, hθ1, show (((2 : ℝ) : ℂ) * (ℓ 1 / 2)) = ℓ 1 by push_cast; ring, hℓe, L.target] + +private theorem collar_motion_follows_radial_paths + {S : Type*} [TopologicalSpace S] {c e t₁ : ℂ → S} {e' t₁' : S → ℂ} + (he : IsCollarChart e e') {w₀ w₁ : ℂ} (h₀ : ‖w₀‖ = 1) (h₁ : ‖w₁‖ = 1) + (hw1A : ∀ {w : ℂ}, ‖w‖ = 1 → w ∈ collarAnnulus) + (hw1O : ∀ {w : ℂ}, ‖w‖ = 1 → w ∈ collarOpen) + (h2A : ∀ {w : ℂ}, ‖w‖ = 1 → 2 * w ∈ collarAnnulus) + (R₂ : Path (e w₁) (e (2 * w₁))) + (hR₂ : ∀ t : unitInterval, R₂ t = e (((1 + (t : ℝ) : ℝ) : ℂ) * w₁)) + (ht : IsCollarChart t₁ t₁') (htw₀ : t₁ w₀ = c w₀) (htb : t₁ (2 * w₀) = e (2 * w₁)) + (hht : ∀ z ∈ collarOpen, (chartSwap t₁ (e ∘ fiberMap (fun w => e' (t₁ (2 * w)))) t₁') (t₁ z) = + (e ∘ fiberMap (fun w => e' (t₁ (2 * w)))) z) + (R₁' : Path (c w₀) (e (2 * w₁))) + (hR₁' : ∀ t : unitInterval, R₁' t = t₁ (((1 + (t : ℝ) : ℝ) : ℂ) * w₀)) + (P : Path (c w₀) (e w₁)) + (hP : ∀ t : unitInterval, P t = collarHomotopy t₁ (e ∘ fiberMap (fun w => e' (t₁ (2 * w)))) + t₁' (t.1, c w₀)) + (hunit : ∀ {τ : ℝ}, 0 ≤ τ → τ ≤ 1 → radialPush τ w₀ = ((1 + τ : ℝ) : ℂ) * w₀) : + P = R₁'.trans R₂.symm := by + let u := fun w => e' (t₁ (2 * w)) + let E := e ∘ fiberMap u + ext t + rw [hP] + rw [Path.trans_apply] + simp only [collarHomotopy] + conv_lhs => rw [← htw₀] + have hc1 : ∀ τ : ℝ, chartPush t₁ t₁' τ (t₁ w₀) = t₁ (radialPush τ w₀) := fun τ => by + simp only [chartPush] + rw [ite_eq_left ⟨w₀, hw1O h₀, rfl⟩, ht.left (hw1A h₀)] + by_cases hle : (t : ℝ) ≤ 1 / 2 + · rw [ite_eq_left hle, dite_eq_left hle, hR₁', hc1, + hunit (by have := t.2.1; linarith) (by linarith)] + · rw [ite_eq_right hle, dite_eq_right hle, hc1] + have h1 := t.2.2 + have hle' : 1 / 2 < (t : ℝ) := not_le.mp hle + rw [hunit (by linarith) (by linarith)] + have hOm : ((1 + (2 - 2 * t.1) : ℝ) : ℂ) * w₀ ∈ collarOpen := by + have : ‖((1 + (2 - 2 * t.1) : ℝ) : ℂ) * w₀‖ = 1 + (2 - 2 * t.1) := by + rw [norm_mul, h₀, mul_one, Complex.norm_real, Real.norm_of_nonneg (by linarith)] + constructor <;> rw [this] <;> linarith + rw [show chartSwap t₁ E t₁' (t₁ (((1 + (2 - 2 * t.1) : ℝ) : ℂ) * w₀)) = E _ from hht _ hOm] + rw [Path.symm_apply, comp_apply, hR₂] + simp only [E, comp_apply] + have hu0 : u w₀ = 2 * w₁ := by + simp only [u] + rw [htb, he.left (h2A h₁)] + have hn : ‖((1 + (2 - 2 * t.1) : ℝ) : ℂ) * w₀‖ = 1 + (2 - 2 * t.1) := by + rw [norm_mul, h₀, mul_one, Complex.norm_real, Real.norm_of_nonneg (by linarith)] + have hd : dirOf (((1 + (2 - 2 * t.1) : ℝ) : ℂ) * w₀) = w₀ := by + rw [dirOf_mul_pos (by linarith) (by rintro rfl; simp at h₀), dirOf_of_norm_one h₀] + rw [fiberMap, hn, hd, hu0] + congr 1 + simp only [unitInterval.coe_symm_eq] + push_cast + ring + +omit [T2Space S] [CompactSpace S] in +private theorem exists_aligned_collar_chart {e t₁ : ℂ → S} {e' t₁' : S → ℂ} + (he : IsCollarChart e e') (ht : IsCollarChart t₁ t₁') + (hout : e '' {z | ‖z‖ = 2} = t₁ '' {z | ‖z‖ = 2}) : + let E := e ∘ fiberMap (fun w => e' (t₁ (2 * w))) + ∃ E' : S → ℂ, IsCollarChart E E' ∧ + (∀ z, ‖z‖ = 2 → E z = t₁ z) ∧ E '' collarOpen = e '' collarOpen ∧ + E '' {z | ‖z‖ = 1} = e '' {z | ‖z‖ = 1} ∧ + (∀ w₀ w₁, ‖w₀‖ = 1 → ‖w₁‖ = 1 → t₁ (2 * w₀) = e (2 * w₁) → E w₀ = e w₁) := by + intro E + have hw1A : ∀ {w : ℂ}, ‖w‖ = 1 → w ∈ collarAnnulus := + fun {w} hw => ⟨hw.ge, by rw [hw]; norm_num⟩ + have h2w : ∀ {w : ℂ}, ‖w‖ = 1 → ‖2 * w‖ = 2 := fun {w} hw => by simp [hw] + have h2A : ∀ {w : ℂ}, ‖w‖ = 1 → 2 * w ∈ collarAnnulus := + fun {w} hw => ⟨by rw [h2w hw]; norm_num, (h2w hw).le⟩ + have hs2 : {z : ℂ | ‖z‖ = 2} ⊆ collarAnnulus := by + intro z hz + change ‖z‖ = 2 at hz + exact ⟨by rw [hz]; norm_num, hz.le⟩ + have hemem : ∀ x ∈ e '' {z | ‖z‖ = 2}, ‖e' x‖ = 2 ∧ e (e' x) = x := by + rintro _ ⟨z, hz, rfl⟩ + have hzA : z ∈ collarAnnulus := hs2 hz + rw [he.left hzA] + exact ⟨hz, rfl⟩ + have htmem : ∀ x ∈ t₁ '' {z | ‖z‖ = 2}, ‖t₁' x‖ = 2 ∧ t₁ (t₁' x) = x := by + rintro _ ⟨z, hz, rfl⟩ + have hzA : z ∈ collarAnnulus := hs2 hz + rw [ht.left hzA] + exact ⟨hz, rfl⟩ + have heo : ∀ {w : ℂ}, ‖w‖ = 1 → e (2 * w) ∈ t₁ '' {z | ‖z‖ = 2} := + fun {w} hw => hout ▸ ⟨_, h2w hw, rfl⟩ + have hto : ∀ {w : ℂ}, ‖w‖ = 1 → t₁ (2 * w) ∈ e '' {z | ‖z‖ = 2} := + fun {w} hw => hout.symm ▸ ⟨_, h2w hw, rfl⟩ + let u : ℂ → ℂ := fun w => e' (t₁ (2 * w)) + let v : ℂ → ℂ := fun w => t₁' (e (2 * w)) + have h2c : Continuous fun w : ℂ => 2 * w := by fun_prop + have hu : ContinuousOn u {w | ‖w‖ = 1} := by + have h1 : ContinuousOn (fun w : ℂ => t₁ (2 * w)) {w | ‖w‖ = 1} := ht.cont.comp h2c.continuousOn + fun w hw => h2A hw + exact he.cont'.comp h1 fun w hw => image_mono hs2 (hto hw) + have hv : ContinuousOn v {w | ‖w‖ = 1} := by + have h1 : ContinuousOn (fun w : ℂ => e (2 * w)) {w | ‖w‖ = 1} := he.cont.comp h2c.continuousOn + fun w hw => h2A hw + exact ht.cont'.comp h1 fun w hw => image_mono hs2 (heo hw) + have hnu : ∀ w, ‖w‖ = 1 → ‖u w‖ = 2 := fun w hw => (hemem _ (hto hw)).1 + have hnv : ∀ w, ‖w‖ = 1 → ‖v w‖ = 2 := fun w hw => (htmem _ (heo hw)).1 + have huv : ∀ w, ‖w‖ = 1 → v (u w / 2) = 2 * w := fun w hw => by + simp only [v] + rw [show 2 * (u w / 2) = u w by ring] + simp only [u] + rw [(hemem _ (hto hw)).2, ht.left (h2A hw)] + have hvu : ∀ w, ‖w‖ = 1 → u (v w / 2) = 2 * w := fun w hw => by + simp only [u] + rw [show 2 * (v w / 2) = v w by ring] + simp only [v] + rw [(htmem _ (heo hw)).2, he.left (h2A hw)] + have hnfu : ∀ z ∈ collarAnnulus, ‖fiberMap u z‖ = ‖z‖ := fun z hz => norm_fiberMap hnu hz + have hnfv : ∀ z ∈ collarAnnulus, ‖fiberMap v z‖ = ‖z‖ := fun z hz => norm_fiberMap hnv hz + let E' : S → ℂ := fiberMap v ∘ e' + have hE : IsCollarChart E E' := he.comp (continuousOn_fiberMap hu) (continuousOn_fiberMap hv) + hnfu hnfv (fun z hz => fiberMap_inv hnu huv hz) fun z hz => fiberMap_inv hnv hvu hz + have hEout : ∀ z, ‖z‖ = 2 → E z = t₁ z := fun z hz => by + exact adjusted_collar_agrees_on_outer_circle (S := S) (e := e) (e' := e') t₁ hemem hto hs2 z + hz + have hbijE : ∀ B : Set ℂ, B ⊆ collarAnnulus → (∀ z w : ℂ, ‖z‖ = ‖w‖ → (z ∈ B ↔ w ∈ B)) → E '' B + = e '' B := fun B hBA hB => by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨_, (hB _ _ (hnfu z (hBA hz))).mpr hz, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + refine ⟨fiberMap v z, (hB _ _ (hnfv z (hBA hz))).mpr hz, ?_⟩ + change e (fiberMap u (fiberMap v z)) = e z + rw [fiberMap_inv hnv hvu (hBA hz)] + have hEO : E '' collarOpen = e '' collarOpen := hbijE _ collarOpen_subset fun z w h => by + simp only [collarOpen, mem_ofPred_eq, h] + have hE1 : E '' {z | ‖z‖ = 1} = e '' {z | ‖z‖ = 1} := + hbijE _ (fun _ hz => hw1A hz) fun z w h => by + simp only [mem_ofPred_eq, h] + refine ⟨E', hE, hEout, hEO, hE1, ?_⟩ + intro w₀ w₁ h₀ h₁ htb + have hu0 : u w₀ = 2 * w₁ := by + simp only [u] + rw [htb, he.left (h2A h₁)] + have hf : fiberMap u w₀ = w₁ := by + rw [fiberMap, dirOf_of_norm_one h₀, hu0, h₀] + push_cast + ring + change e (fiberMap u w₀) = e w₁ + rw [hf] + +omit [T2Space S] [CompactSpace S] in +private theorem collar_radial_path {b : ℂ → S} {b' : S → ℂ} + (hb : IsCollarChart b b') {w : ℂ} (hw : ‖w‖ = 1) : + ∃ R : Path (b w) (b (2 * w)), + ∀ t : unitInterval, R t = b (((1 + t.1 : ℝ) : ℂ) * w) := by + have hm : ∀ t : unitInterval, ((1 + t.1 : ℝ) : ℂ) * w ∈ collarAnnulus := fun t => by + have h1 := t.2.1 + have h2 := t.2.2 + have : ‖((1 + t.1 : ℝ) : ℂ) * w‖ = 1 + t.1 := by + rw [norm_mul, hw, mul_one, Complex.norm_real, Real.norm_of_nonneg (by linarith)] + constructor <;> rw [this] <;> linarith + have hcont : Continuous fun t : unitInterval => b (((1 + t.1 : ℝ) : ℂ) * w) := + hb.cont.comp_continuous (by fun_prop) hm + refine ⟨⟨⟨_, hcont⟩, ?_, ?_⟩, fun _ => rfl⟩ + · simp + · simp only [Set.Icc.coe_one] + norm_num + +omit [CompactSpace S] in +/-- **Pushing a collar.** Two annuli share their outer circle, the second inside the first. A map +`h` of `S` onto the part off the first annulus and in the second fixes all points +off the first annulus. It is homotopic to the identity, by a homotopy that also fixes those points, +and the path traced by `c w₀` is homotopic to `Q`. -/ +theorem exists_collar_push {c e : ℂ → S} {c' e' : S → ℂ} (hc : IsCollarChart c c') (hO : IsOpen + (c '' collarOpen)) (he : IsCollarChart e e') (hout : e '' {z | ‖z‖ = 2} = c '' {z | ‖z‖ = 2}) + (hsub : e '' collarOpen ⊆ c '' collarOpen) {w₀ w₁ : ℂ} (h₀ : ‖w₀‖ = 1) (h₁ : ‖w₁‖ = 1) + (Q : Path (c w₀) (e w₁)) (hQ : range Q ⊆ c '' collarAnnulus) : + ∃ (h : S → S) (Φ : unitInterval × S → S), Continuous h ∧ Continuous Φ ∧ Injective h ∧ + (∀ x ∉ c '' collarOpen, h x = x ∧ ∀ t, Φ (t, x) = x) ∧ + (∀ x, Φ (0, x) = x) ∧ (∀ x, Φ (1, x) = h x) ∧ + range h = (c '' collarOpen)ᶜ ∪ e '' collarOpen ∧ h '' (c '' {z | ‖z‖ = 1}) = e '' {z | ‖z‖ + = 1} ∧ h (c w₀) = e w₁ ∧ + ∃ P : Path (c w₀) (e w₁), (∀ t, P t = Φ (t, c w₀)) ∧ P.Homotopic Q := by + classical + -- the path `L`: `Q`, then the radial line of `e` at `w₁` + have hw1A : ∀ {w : ℂ}, ‖w‖ = 1 → w ∈ collarAnnulus := fun {w} hw => ⟨hw.ge, by rw [hw]; norm_num⟩ + have hw1O : ∀ {w : ℂ}, ‖w‖ = 1 → w ∈ collarOpen := fun {w} hw => ⟨hw.ge, by rw [hw]; norm_num⟩ + have h2w : ∀ {w : ℂ}, ‖w‖ = 1 → ‖2 * w‖ = 2 := fun {w} hw => by simp [hw] + have h2A : ∀ {w : ℂ}, ‖w‖ = 1 → 2 * w ∈ collarAnnulus := + fun {w} hw => ⟨by rw [h2w hw]; norm_num, (h2w hw).le⟩ + have heA : e '' collarAnnulus ⊆ c '' collarAnnulus := by + exact collar_inclusion_from_open_and_outer_images (S := S) (c := c) (e := e) hout hsub + obtain ⟨R₂, hR₂⟩ := collar_radial_path he h₁ + let L : Path (c w₀) (e (2 * w₁)) := Q.trans R₂ + have hLA : ∀ t, L t ∈ c '' collarAnnulus := by + intro t + have : range L ⊆ c '' collarAnnulus := by + rw [Path.trans_range] + refine union_subset hQ ?_ + rintro _ ⟨t, rfl⟩ + rw [hR₂ t] + refine heA ⟨_, ?_, rfl⟩ + have h1 := t.2.1 + have h2 := t.2.2 + have : ‖((1 + t.1 : ℝ) : ℂ) * w₁‖ = 1 + t.1 := by + rw [norm_mul, h₁, mul_one, Complex.norm_real, Real.norm_of_nonneg (by linarith)] + constructor <;> rw [this] <;> linarith + exact this (mem_range_self t) + let ℓ : unitInterval → ℂ := fun t => c' (L t) + have hℓc : Continuous ℓ := hc.cont'.comp_continuous L.continuous hLA + have hℓA : ∀ t, ℓ t ∈ collarAnnulus := fun t => (hc.mem_of_mem (hLA t)).1 + have hℓe : ∀ t, c (ℓ t) = L t := fun t => (hc.mem_of_mem (hLA t)).2 + have hℓ0 : ℓ 0 = w₀ := by + change c' (L 0) = w₀ + rw [L.source] + exact hc.left (hw1A h₀) + have hℓn1 : ‖ℓ 1‖ = 2 := by + obtain ⟨y, hy, hye⟩ := hout.le ⟨2 * w₁, h2w h₁, rfl⟩ + change ‖c' (L 1)‖ = 2 + have hy' : ‖y‖ = 2 := hy + have hyA : y ∈ collarAnnulus := ⟨by rw [hy']; norm_num, hy'.le⟩ + rw [L.target, ← hye, hc.left hyA] + exact hy + -- the angle of `ℓ` + let direction : unitInterval → Circle := fun t => + ⟨dirOf (ℓ t), by + simpa [Submonoid.unitSphere] using norm_dirOf (ne_zero_of_mem_collar (hℓA t))⟩ + let γ : C(unitInterval, Circle) := ⟨direction, by + refine Continuous.subtype_mk ?_ _ + exact continuousOn_dirOf.comp_continuous hℓc fun t => ne_zero_of_mem_collar (hℓA t)⟩ + obtain ⟨θ, hθ⟩ : ∃ θ : C(unitInterval, ℝ), ∀ t, Complex.exp ((θ t : ℂ) * Complex.I) = dirOf (ℓ t) + := by + refine ⟨Circle.isCoveringMap_exp.liftPath γ (Complex.arg (γ 0 : ℂ)) (Circle.exp_arg + (γ 0)).symm, fun t => ?_⟩ + have := congr_fun (Circle.isCoveringMap_exp.liftPath_lifts γ (Complex.arg (γ 0 : ℂ)) + (Circle.exp_arg (γ 0)).symm) t + have h2 := congrArg (fun z : Circle => (z : ℂ)) this + simp only [comp_apply, Circle.coe_exp] at h2 + exact h2 + let κ : ℝ := θ 1 - θ 0 + have hθ0 : Complex.exp ((θ 0 : ℂ) * Complex.I) = w₀ := by + rw [hθ, hℓ0, dirOf_of_norm_one h₀] + have hθ1 : Complex.exp ((θ 1 : ℂ) * Complex.I) = ℓ 1 / 2 := by + have h0 : ℓ 1 ≠ 0 := ne_zero_of_mem_collar (hℓA 1) + have h3 := eq_mul_dirOf h0 + rw [hℓn1, ← hθ] at h3 + nth_rw 1 [h3] + push_cast + ring + -- the twisted chart + have hnt : ∀ (κ : ℝ), ∀ z ∈ collarAnnulus, ‖collarTwist κ z‖ = ‖z‖ := fun κ z _ + => norm_collarTwist κ z + have htw : ∀ κ, ∀ z, collarTwist κ (collarTwist (-κ) z) = z := fun κ z => by + have := collarTwist_neg (-κ) z + rwa [neg_neg] at this + let t₁ : ℂ → S := c ∘ collarTwist κ + let t₁' : S → ℂ := collarTwist (-κ) ∘ c' + have ht : IsCollarChart t₁ t₁' := hc.comp (continuous_collarTwist κ).continuousOn + (continuous_collarTwist (-κ)).continuousOn (hnt κ) (hnt (-κ)) + (fun z _ => collarTwist_neg κ z) fun z _ => htw κ z + have hbij : ∀ B : Set ℂ, (∀ z w : ℂ, ‖z‖ = ‖w‖ → (z ∈ B ↔ w ∈ B)) → t₁ '' B = c '' B := fun B hB + => by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨_, (hB _ _ (norm_collarTwist κ z)).mpr hz, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + refine ⟨collarTwist (-κ) z, (hB _ _ (norm_collarTwist _ z)).mpr hz, ?_⟩ + simp only [t₁, comp_apply, htw] + have htO : t₁ '' collarOpen = c '' collarOpen := hbij _ fun z w h => by + simp only [collarOpen, mem_ofPred_eq, h] + have htA : t₁ '' collarAnnulus = c '' collarAnnulus := hbij _ fun z w h => by + simp only [collarAnnulus, mem_ofPred_eq, h] + have ht1 : t₁ '' {z | ‖z‖ = 1} = c '' {z | ‖z‖ = 1} := hbij _ fun z w h => by + simp only [mem_ofPred_eq, h] + have ht2 : t₁ '' {z | ‖z‖ = 2} = c '' {z | ‖z‖ = 2} := hbij _ fun z w h => by + simp only [mem_ofPred_eq, h] + have htw₀ : t₁ w₀ = c w₀ := by + simp [t₁, collarTwist, h₀] + have htb : t₁ (2 * w₀) = e (2 * w₁) := by + have h1 : collarTwist κ (2 * w₀) = ℓ 1 := by + rw [collarTwist, h2w h₀, ← hθ0, mul_assoc, ← Complex.exp_add] + have : (θ 0 : ℂ) * Complex.I + ((κ * (2 - 1) : ℝ) : ℂ) * Complex.I = (θ 1 : ℂ) * Complex.I + := by + simp only [κ] + push_cast + ring + rw [this, hθ1] + ring + simp only [t₁, comp_apply, h1, hℓe, L.target] + let E : ℂ → S := e ∘ fiberMap (fun w => e' (t₁ (2 * w))) + obtain ⟨E', hE, hEout, hEO, hE1, hEpoints⟩ := + exists_aligned_collar_chart he ht (hout.trans ht2.symm) + let h : S → S := chartSwap t₁ E t₁' + let Φ : unitInterval × S → S := fun q => collarHomotopy t₁ E t₁' (q.1.1, q.2) + have hOt : IsOpen (t₁ '' collarOpen) := htO ▸ hO + have hc_h : Continuous h := continuous_chartSwap ht hOt hE hEout + have hc_Φ : Continuous Φ := continuous_collarHomotopy ht hOt hE hEout + have hsubE : E '' collarOpen ⊆ t₁ '' collarOpen := by + rw [hEO, htO] + exact hsub + have hht : ∀ z ∈ collarOpen, h (t₁ z) = E z := fun z hz => by + simp only [h, chartSwap] + rw [ite_eq_left ⟨z, hz, rfl⟩, ht.left (collarOpen_subset hz)] + have hinj : Injective h := by + intro x y hxy + by_cases hx : x ∈ t₁ '' collarOpen <;> by_cases hy : y ∈ t₁ '' collarOpen + · obtain ⟨z, hz, rfl⟩ := hx + obtain ⟨z', hz', rfl⟩ := hy + rw [hht z hz, hht z' hz'] at hxy + rw [hE.injOn (collarOpen_subset hz) (collarOpen_subset hz') hxy] + · obtain ⟨z, hz, rfl⟩ := hx + rw [hht z hz, show h y = y from chartSwap_of_not_mem hy] at hxy + exact absurd (hxy ▸ hsubE ⟨z, hz, rfl⟩) hy + · obtain ⟨z, hz, rfl⟩ := hy + rw [hht z hz, show h x = x from chartSwap_of_not_mem hx] at hxy + exact absurd (hxy.symm ▸ hsubE ⟨z, hz, rfl⟩) hx + · rwa [show h y = y from chartSwap_of_not_mem hy, show h x = x from chartSwap_of_not_mem hx] + at hxy + have hΦ0 : ∀ x, Φ (0, x) = x := fun x => by + simp only [Φ, collarHomotopy, Set.Icc.coe_zero] + rw [ite_eq_left (by norm_num), mul_zero, chartPush_zero ht] + have hΦ1 : ∀ x, Φ (1, x) = h x := fun x => by + simp only [Φ, collarHomotopy, Set.Icc.coe_one] + rw [ite_eq_right (by norm_num), show (2 : ℝ) - 2 * 1 = 0 by ring, chartPush_zero ht] + have hΦoff : ∀ x, x ∉ t₁ '' collarOpen → ∀ t, Φ (t, x) = x := fun x hx t => by + simp only [Φ, collarHomotopy] + split_ifs + · exact chartPush_of_not_mem hx + · rw [chartPush_of_not_mem hx] + exact chartSwap_of_not_mem hx + have hE2 : E w₀ = e w₁ := hEpoints w₀ w₁ h₀ h₁ htb + have hhw : h (c w₀) = e w₁ := by + rw [← htw₀, hht _ (hw1O h₀), hE2] + refine ⟨h, Φ, hc_h, hc_Φ, hinj, fun x hx => ?_, hΦ0, hΦ1, ?_, ?_, hhw, ?_⟩ + · rw [← htO] at hx + exact ⟨chartSwap_of_not_mem hx, hΦoff x hx⟩ + · rw [← htO, ← hEO] + ext y + constructor + · rintro ⟨x, rfl⟩ + by_cases hx : x ∈ t₁ '' collarOpen + · obtain ⟨z, hz, rfl⟩ := hx + rw [hht z hz] + exact .inr ⟨z, hz, rfl⟩ + · rw [show h x = x from chartSwap_of_not_mem hx] + exact .inl hx + · rintro (hy | ⟨z, hz, rfl⟩) + · exact ⟨y, chartSwap_of_not_mem hy⟩ + · exact ⟨t₁ z, hht z hz⟩ + · rw [← ht1, ← hE1, image_image] + refine image_congr fun z hz => hht z (hw1O hz) + obtain ⟨R₁, hR₁⟩ := collar_radial_path ht h₀ + let R₁' : Path (c w₀) (e (2 * w₁)) := R₁.cast htw₀.symm htb.symm + have hR₁' : ∀ t : unitInterval, R₁' t = t₁ (((1 + t.1 : ℝ) : ℂ) * w₀) := fun t => hR₁ t + have hLR : L.Homotopic R₁' := by + exact lifted_angle_gives_collar_homotopy (S := S) (c := c) (e := e) (c' := c') hc (w₀ := w₀) + (w₁ := w₁) h₀ L ℓ hℓc hℓA hℓe hℓ0 hℓn1 θ hθ hθ0 hθ1 R₁' hR₁' + let P : Path (c w₀) (e w₁) := ⟨⟨fun t => Φ (t, c w₀), hc_Φ.comp (continuous_id.prodMk + continuous_const)⟩, hΦ0 _, by + change Φ (1, c w₀) = e w₁ + rw [hΦ1, hhw]⟩ + have hunit : ∀ {τ : ℝ}, 0 ≤ τ → τ ≤ 1 → radialPush τ w₀ = ((1 + τ : ℝ) : ℂ) * w₀ := fun {τ} h0 h1 + => by + rw [radialPush, dirOf_of_norm_one h₀, h₀] + congr 2 + ring + have hPeq : P = R₁'.trans R₂.symm := by + exact collar_motion_follows_radial_paths he h₀ h₁ hw1A hw1O h2A R₂ hR₂ ht htw₀ htb hht + R₁' hR₁' P (fun _ => rfl) hunit + refine ⟨P, fun _ => rfl, ?_⟩ + rw [hPeq] + have h1 : (R₁'.trans R₂.symm).Homotopic (L.trans R₂.symm) := Path.Homotopic.hcomp hLR.symm + (Path.Homotopic.refl _) + have h2 : (L.trans R₂.symm).Homotopic (Q.trans (R₂.trans R₂.symm)) := ⟨Path.Homotopy.transAssoc Q + R₂ R₂.symm⟩ + have h3 : (Q.trans (R₂.trans R₂.symm)).Homotopic (Q.trans (Path.refl _)) := Path.Homotopic.hcomp + (Path.Homotopic.refl _) ⟨(Path.Homotopy.reflTransSymm R₂).symm⟩ + have h4 : (Q.trans (Path.refl _)).Homotopic Q := ⟨Path.Homotopy.transRefl Q⟩ + exact h1.trans (h2.trans (h3.trans h4)) + +section Capped + +variable {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] [T2Space T] [CompactSpace S] + +theorem isPathConnected_collarAnnulus : IsPathConnected collarAnnulus := by + have h1 : IsPathConnected (Icc (1 : ℝ) 2 ×ˢ (univ : Set ℝ)) := + ((convex_Icc (1 : ℝ) 2).prod convex_univ).isPathConnected ⟨(1, 0), by simp⟩ + have h2 : Continuous fun q : ℝ × ℝ => (q.1 : ℂ) * Complex.exp ((q.2 : ℂ) * Complex.I) := by + fun_prop + have h3 := h1.image h2 + convert h3 using 1 + ext z + constructor + · intro hz + refine ⟨(‖z‖, Complex.arg z), ⟨⟨hz.1, hz.2⟩, mem_univ _⟩, ?_⟩ + exact Complex.norm_mul_exp_arg_mul_I z + · rintro ⟨⟨r, θ⟩, ⟨⟨h1, h2⟩, -⟩, rfl⟩ + have : ‖(r : ℂ) * Complex.exp ((θ : ℂ) * Complex.I)‖ = r := by + rw [norm_mul, Complex.norm_exp_ofReal_mul_I, mul_one, Complex.norm_real, + Real.norm_of_nonneg (by linarith)] + simp only at h1 h2 ⊢ + constructor <;> simp only [this] <;> assumption + +/-- A chart in `S` of the part of the disc `Y` off the disc `E`. -/ +theorem exists_collar_chart (hman : ∀ x : T, IsManifoldPoint x) [Nonempty S] {j : S → T} + (hj : IsEmbedding j) {D E Y : Set T} (hE : IsClosedDisc E) (hY : IsClosedDisc Y) + (hEY : E ⊆ Y \ discBd Y) + (hD : IsClosedDisc D) (hDE : D ⊆ E) (hcov : range j ∪ D = univ) (hbdD : discBd D ⊆ range j) : + ∃ (c : ℂ → S) (c' : S → ℂ), IsCollarChart c c' ∧ c '' {z | ‖z‖ = 1} = j ⁻¹' discBd E + ∧ c '' {z | ‖z‖ = 2} = j ⁻¹' discBd Y ∧ c '' collarOpen = j ⁻¹' (discInt Y \ discInt E) ∧ + c '' collarAnnulus = j ⁻¹' (Y \ discInt E) := by + classical + obtain ⟨p⟩ := hE.isOArc_discBd + obtain ⟨c, c', hcc, hc'c, hmc, hmc', hl, hr, hcE, hcb, hcp⟩ := exists_disc_collar hE hY hEY p + obtain ⟨pr, hprc, hprl⟩ := exists_inv_of_compactOn (K := (univ : Set S)) isCompact_univ + hj.continuous.continuousOn hj.injective.injOn + have hAb : collarAnnulus ⊆ Metric.closedBall 0 2 := fun z hz => by simpa using hz.2 + have hinj : InjOn c (Metric.closedBall 0 2) := hl.injOn + have hdisc : discInt D ⊆ discInt E := discInt_mono hman hD hDE + have hs1 : c '' {z | ‖z‖ = 1} = discBd E := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + have h2 : c z = _ := hcp ⟨z, by simpa [Submonoid.unitSphere] using hz⟩ + rw [h2] + exact (p _).2 + · intro hx + refine ⟨(p.symm ⟨x, hx⟩ : Circle), by simp, ?_⟩ + rw [hcp] + simp + have hin1 : ∀ z, ‖z‖ < 1 → c z ∉ discBd E ∪ (Y \ E) ∧ c z ∈ E := fun z hz => by + have hb : z ∈ Metric.closedBall (0 : ℂ) 2 := by simpa using (hz.le.trans one_le_two) + have hzE : c z ∈ E := hcE ▸ mem_image_of_mem c (by simpa using hz.le) + refine ⟨?_, hzE⟩ + rintro (h | h) + · rw [← hs1] at h + obtain ⟨y, hy, he⟩ := h + have hyb : y ∈ Metric.closedBall (0 : ℂ) 2 := by + have : ‖y‖ = 1 := hy + simp [this] + rw [hinj hyb hb he] at hy + exact hz.ne hy + · exact h.2 hzE + have hoff : ∀ z ∈ collarAnnulus, c z ∉ discInt E := fun z hz h => by + by_cases h1 : ‖z‖ = 1 + · exact h.2 (hs1 ▸ mem_image_of_mem c h1) + · have hlt : 1 < ‖z‖ := lt_of_le_of_ne hz.1 (Ne.symm h1) + obtain ⟨y, hy, he⟩ := hcE.ge h.1 + have hyb : y ∈ Metric.closedBall (0 : ℂ) 2 := by + have : ‖y‖ ≤ 1 := by simpa using hy + simp only [mem_closedBall_zero_iff] + linarith + rw [hinj hyb (hAb hz) he] at hy + have : ‖z‖ ≤ 1 := by simpa using hy + linarith + have hrange : ∀ z ∈ collarAnnulus, c z ∈ range j := fun z hz => by + rcases hcov.ge (mem_univ (c z)) with h | h + · exact h + · by_cases hb : c z ∈ discBd D + · exact hbdD hb + · exact absurd (hdisc ⟨h, hb⟩) (hoff z hz) + have hjpr : ∀ y ∈ range j, j (pr y) = y := by + rintro _ ⟨x, rfl⟩ + rw [hprl (mem_univ x)] + have hcY : ∀ x, x ∈ Y → ∃ z, ‖z‖ ≤ 2 ∧ c z = x := fun x hx => ⟨c' x, by simpa using hmc' hx, hr + hx⟩ + have hsame : ∀ B : Set ℂ, B ⊆ collarAnnulus → (fun z => pr (c z)) '' B = j ⁻¹' (c '' B) + := fun B hB => by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨z, hz, (hjpr _ (hrange z (hB hz))).symm⟩ + · rintro ⟨z, hz, he⟩ + refine ⟨z, hz, ?_⟩ + change pr (c z) = x + rw [he, hprl (mem_univ x)] + have hprS : {z : ℂ | ‖z‖ = 1} ⊆ collarAnnulus := fun z hz => by + have h : ‖z‖ = 1 := hz + exact ⟨h.ge, by rw [h]; norm_num⟩ + have hprT : {z : ℂ | ‖z‖ = 2} ⊆ collarAnnulus := fun z hz => by + have h : ‖z‖ = 2 := hz + exact ⟨by rw [h]; norm_num, h.le⟩ + have hs2 : c '' {z | ‖z‖ = 2} = discBd Y := by + rw [← hcb] + congr 1 + ext z + simp + have hA : c '' collarAnnulus = Y \ discInt E := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨hmc (hAb hz), hoff z hz⟩ + · rintro ⟨hx, hxi⟩ + obtain ⟨z, hz, rfl⟩ := hcY x hx + refine ⟨z, ⟨?_, hz⟩, rfl⟩ + by_contra hlt + obtain ⟨h1, h2⟩ := hin1 z (not_le.mp hlt) + exact hxi ⟨h2, fun hb => h1 (.inl hb)⟩ + have hO : c '' collarOpen = discInt Y \ discInt E := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + refine ⟨⟨hmc (hAb (collarOpen_subset hz)), fun hb => ?_⟩, hoff z (collarOpen_subset hz)⟩ + rw [← hs2] at hb + obtain ⟨y, hy, he⟩ := hb + have hyA : y ∈ collarAnnulus := hprT hy + rw [hinj (hAb hyA) (hAb (collarOpen_subset hz)) he] at hy + exact hz.2.ne hy + · rintro ⟨⟨hx, hxb⟩, hxi⟩ + obtain ⟨z, hzA, rfl⟩ := hA.ge ⟨hx, hxi⟩ + refine ⟨z, ⟨hzA.1, lt_of_le_of_ne hzA.2 fun h2 => hxb ?_⟩, rfl⟩ + exact hs2 ▸ mem_image_of_mem c h2 + have hYU : ContinuousOn (fun x => c' (j x)) ((fun z => pr (c z)) '' collarAnnulus) := by + refine hc'c.comp hj.continuous.continuousOn ?_ + rintro _ ⟨z, hz, rfl⟩ + change j (pr (c z)) ∈ Y + rw [hjpr _ (hrange z hz)] + exact hmc (hAb hz) + refine ⟨fun z => pr (c z), fun x => c' (j x), ⟨?_, hYU, ?_⟩, ?_, ?_, ?_, ?_⟩ + · refine ContinuousOn.comp (t := j '' univ) hprc (hcc.mono hAb) fun z hz => ?_ + rw [image_univ] + exact hrange z hz + · intro z hz + change c' (j (pr (c z))) = z + rw [hjpr _ (hrange z hz), hl (hAb hz)] + · rw [hsame _ hprS, hs1] + · rw [hsame _ hprT, hs2] + · rw [hsame _ collarOpen_subset, hO] + · rw [hsame _ Subset.rfl, hA] + +end Capped + +/-- A path in `S` between the two circles of the annulus, inside the disc `Y`. -/ +theorem exists_path_in_collar {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] + [CompactSpace S] {C : Set S} {j : S → T} {D Δ Y : Set T} (hc : IsCappedCuff C T j D) + (_hΔ : IsClosedDisc Δ) + (hDΔ : D ⊆ Δ) (hY : IsClosedDisc Y) (hΔY : Δ ⊆ Y \ discBd Y) {x₀ a₁ : S} (hx₀ : x₀ ∈ C) + (ha : j a₁ ∈ discBd Δ) : ∃ Q : Path x₀ a₁, ∀ t, j (Q t) ∈ Y := by + have hT := hc.isSurface + have : T2Space T := hT.2.1 + have : Nonempty S := ⟨x₀⟩ + have hbdD : discBd D ⊆ range j := by + rw [hc.discBd_eq] + exact image_subset_range _ _ + obtain ⟨c, c', hcc, -, -, -, hA⟩ := exists_collar_chart hT.2.2 hc.isEmbedding hc.isClosedDisc hY + (fun x hx => hΔY (hDΔ hx)) hc.isClosedDisc Subset.rfl hc.union_eq hbdD + have hp : IsPathConnected (c '' collarAnnulus) := isPathConnected_collarAnnulus.image' hcc.cont + have hmem : ∀ y, j y ∈ Y → y ∈ c '' collarAnnulus := fun y hy => by + rw [hA] + refine ⟨hy, fun hi => hi.2 ?_⟩ + rw [hc.discBd_eq] + have h2 : j y ∈ range j ∩ D := ⟨mem_range_self y, hi.1⟩ + rwa [hc.inter_eq] at h2 + have hx₀_bd : j x₀ ∈ discBd D := by + rw [hc.discBd_eq] + exact mem_image_of_mem j hx₀ + have h1 : j x₀ ∈ Y := (hΔY (hDΔ (Surface.discBd_subset _ hx₀_bd))).1 + have h2 : j a₁ ∈ Y := (hΔY (Surface.discBd_subset _ ha)).1 + obtain ⟨Q, hQ⟩ := (hp.joinedIn _ (hmem _ h1) _ (hmem _ h2)) + refine ⟨Q, fun t => ?_⟩ + have := hQ t + rw [hA] at this + exact this.1 + +/-- **Pushing a cuff out to the boundary of a disc.** See the top of the file. Here `D` is the disc +pasted on the cuff `C`, and `Δ` is a larger disc inside `Y`. -/ +theorem exists_capped_push {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] [CompactSpace + S] {C : Set S} {j : S → T} {D Δ Y : Set T} (hc : IsCappedCuff C T j D) (hΔ : IsClosedDisc Δ) + (hDΔ : D ⊆ Δ) (hY : IsClosedDisc Y) (hΔY : Δ ⊆ Y \ discBd Y) (_hbΔ : discBd Δ ⊆ range j) {x₀ a₁ + : S} (hx₀ : x₀ ∈ C) (ha : j a₁ ∈ discBd Δ) (Q : Path x₀ a₁) (hQ : ∀ t, j (Q t) ∈ Y) : + ∃ (h : S → S) (Φ : unitInterval × S → S), Continuous h ∧ Continuous Φ ∧ Injective h ∧ + (∀ x, j x ∉ discInt Y → h x = x ∧ ∀ t, Φ (t, x) = x) ∧ + (∀ x, Φ (0, x) = x) ∧ (∀ x, Φ (1, x) = h x) ∧ + range h = j ⁻¹' (discInt Δ)ᶜ ∧ h '' C = j ⁻¹' discBd Δ ∧ h x₀ = a₁ ∧ ∃ P : Path x₀ a₁, + (∀ t, P t = Φ (t, x₀)) ∧ P.Homotopic Q := by + have hT := hc.isSurface + have : T2Space T := hT.2.1 + have : T2Space S := hc.isEmbedding.t2Space + have : Nonempty S := ⟨x₀⟩ + have hman := hT.2.2 + have hbdD : discBd D ⊆ range j := by + rw [hc.discBd_eq] + exact image_subset_range _ _ + have hC : j ⁻¹' discBd D = C := by + rw [hc.discBd_eq] + exact preimage_image_eq _ hc.isEmbedding.injective + have hin : ∀ y, j y ∉ discInt D := fun y hi => hi.2 (by + rw [hc.discBd_eq] + have h2 : j y ∈ range j ∩ D := ⟨mem_range_self y, hi.1⟩ + rwa [hc.inter_eq] at h2) + obtain ⟨c, c', hcc, hc1, hc2, hcO, hcA⟩ := exists_collar_chart hman hc.isEmbedding + hc.isClosedDisc hY (fun x hx => hΔY (hDΔ hx)) hc.isClosedDisc Subset.rfl hc.union_eq hbdD + obtain ⟨e, e', hec, he1, he2, heO, -⟩ := exists_collar_chart hman hc.isEmbedding hΔ hY hΔY + hc.isClosedDisc hDΔ hc.union_eq hbdD + have hO : IsOpen (c '' collarOpen) := by + rw [hcO] + have : j ⁻¹' (discInt Y \ discInt D) = j ⁻¹' discInt Y := by + ext y + exact ⟨fun h => h.1, fun h => ⟨h, hin y⟩⟩ + rw [this] + exact (hY.isOpen_discInt hman).preimage hc.isEmbedding.continuous + have hx : x₀ ∈ c '' {z | ‖z‖ = 1} := by + rw [hc1, hC] + exact hx₀ + have hax : a₁ ∈ e '' {z | ‖z‖ = 1} := by + rw [he1] + exact ha + obtain ⟨w₀, h₀, rfl⟩ := hx + obtain ⟨w₁, h₁, rfl⟩ := hax + have hsub : e '' collarOpen ⊆ c '' collarOpen := by + rw [heO, hcO] + exact fun y hy => ⟨hy.1, hin y⟩ + obtain ⟨h, Φ, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ := exists_collar_push hcc hO hec + (he2.trans hc2.symm) hsub h₀ h₁ Q fun y hy => by + obtain ⟨t, rfl⟩ := hy + rw [hcA] + exact ⟨hQ t, hin _⟩ + refine ⟨h, Φ, h1, h2, h3, fun x hx => h4 x ?_, h5, h6, ?_, ?_, h9, h10⟩ + · rw [hcO] + exact fun hh => hx hh.1 + · rw [h7, hcO, heO] + ext y + constructor + · rintro (hy | hy) hi + · exact hy ⟨(discInt_mono hman hΔ (fun x hx => (hΔY hx).1 ) ) hi, hin y⟩ + · exact hy.2 hi + · intro hy + by_cases hyY : j y ∈ discInt Y + · exact .inr ⟨hyY, hy⟩ + · exact .inl fun hh => hyY hh.1 + · rw [← hC, ← hc1, h8, he1] + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffArc.lean b/LeanPool/GraphMinor/GM07/CuffArc.lean new file mode 100644 index 0000000000..7dc2ac324f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffArc.lean @@ -0,0 +1,968 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffFinger +public import LeanPool.GraphMinor.GM09.Section9 +public import LeanPool.GraphMinor.Surface.Triangulate + +/-! +# The `O`-arcs `A'` and `A` of (6.1) + +Graph Minors VII, (6.1), page 237: "Let us choose a $G$-normal $O$-arc $A'$ surrounding $C$ with +$|V(G) \cap A'| \le 1$, such that as many vertices and edges of $G$ as possible are included in the +union +of $A'$ with its inside." and then "It follows that we may choose a $G$-normal $O$-arc $A$ +surrounding $C$, with $A' - A$ inside $A$, and with $|V(G) \cap A| = 2$." + +We phrase this with the closed disc `Δ` of `Σ + CHat` that an `O`-arc bounds. The paper says "The +maximality condition now implies" that `|V(G) ∩ A'| = 1`, and that the region at `A'` has a vertex +outside. +The case that needs care is that all edges on the outer side of this region are loops at the vertex +of `A'`. A loop lies in the closure of the region, so it lies in the disc given by (5.7), and it +bounds +a disc there. If that disc holds `C`, a parallel copy of the loop beats `A'`. If no such disc holds +`C`, then these discs and the region fill `Σ + CHat`, which is then a disc. This is why the count +has edges. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] {T : Type u} [TopologicalSpace T] + +/-- A closed disc of `Σ + CHat` around the pasted disc `D`, with a `G`-normal boundary with at most +`r` vertices. -/ +def IsCuffDisc (G : Drawing S) (j : S → T) (D : Set T) (r : ℕ) (Δ : Set T) : Prop := + IsClosedDisc Δ ∧ D ⊆ Δ ∧ G.IsNormal (j ⁻¹' discBd Δ) ∧ (G.V ∩ j ⁻¹' discBd Δ).ncard ≤ r + +/-- The number of vertices and edges of `G` in a set of `Σ + CHat`. -/ +noncomputable def cuffCount (G : Drawing S) (j : S → T) (Δ : Set T) : ℕ := + (G.V ∩ j ⁻¹' Δ).ncard + {e ∈ G.E | j '' e ⊆ Δ}.ncard + +omit [TopologicalSpace T] in +theorem cuffCount_le (G : Drawing S) (j : S → T) (Δ : Set T) : cuffCount G j Δ + ≤ G.V.ncard + G.E.ncard := + add_le_add (ncard_le_ncard inter_subset_left G.finite_V) (ncard_le_ncard + (sep_subset _ _) G.finite_edges) + +omit [TopologicalSpace T] in +theorem cuffCount_lt (G : Drawing S) (j : S → T) {Δ Δ' : Set T} (h : Δ ⊆ Δ') (hnew : + (∃ x ∈ G.V, j x ∈ Δ' ∧ j x ∉ Δ) ∨ ∃ e ∈ G.E, j '' e ⊆ Δ' ∧ ¬ j '' e ⊆ Δ) : cuffCount G j Δ < + cuffCount G j Δ' := by + have h1 : G.V ∩ j ⁻¹' Δ ⊆ G.V ∩ j ⁻¹' Δ' := inter_subset_inter_right _ (preimage_mono h) + have h2 : {e ∈ G.E | j '' e ⊆ Δ} ⊆ {e ∈ G.E | j '' e ⊆ Δ'} := fun e he => ⟨he.1, he.2.trans h⟩ + have hf1 : (G.V ∩ j ⁻¹' Δ').Finite := G.finite_V.subset inter_subset_left + have hf2 : {e ∈ G.E | j '' e ⊆ Δ'}.Finite := G.finite_edges.subset (sep_subset _ _) + rcases hnew with ⟨x, hx, h3, h4⟩ | ⟨e, he, h3, h4⟩ + · have : (G.V ∩ j ⁻¹' Δ).ncard < (G.V ∩ j ⁻¹' Δ').ncard := ncard_lt_ncard ⟨h1, fun h5 => h4 + (h5 ⟨hx, h3⟩).2⟩ hf1 + exact add_lt_add_of_lt_of_le this (ncard_le_ncard h2 hf2) + · have : {e ∈ G.E | j '' e ⊆ Δ}.ncard < {e ∈ G.E | j '' e ⊆ Δ'}.ncard + := ncard_lt_ncard ⟨h2, fun h5 => h4 (h5 ⟨he, h3⟩).2⟩ hf2 + exact add_lt_add_of_le_of_lt (ncard_le_ncard h1 hf1) this + +omit [TopologicalSpace T] in +/-- A disc with the most vertices and edges, in a family that is not empty. -/ +theorem exists_max_count (G : Drawing S) (j : S → T) {P : Set T → Prop} {Δ₀ : Set T} + (h₀ : P Δ₀) : ∃ Δ, P Δ ∧ ∀ Δ', P Δ' → cuffCount G j Δ' ≤ cuffCount G j Δ := by + have hne : {n | ∃ Δ, P Δ ∧ cuffCount G j Δ = n}.Nonempty := ⟨_, Δ₀, h₀, rfl⟩ + have hb : BddAbove {n | ∃ Δ, P Δ ∧ cuffCount G j Δ = n} := ⟨G.V.ncard + G.E.ncard, by + rintro _ ⟨Δ, -, rfl⟩ + exact cuffCount_le G j Δ⟩ + obtain ⟨Δ, hΔ, he⟩ := Nat.sSup_mem hne hb + exact ⟨Δ, hΔ, fun Δ' hΔ' => by + rw [he] + exact le_csSup hb ⟨Δ', hΔ', rfl⟩⟩ + +section Cap + +variable {C : Set S} {j : S → T} {D : Set T} + +theorem not_mem_discInt_cap (hc : IsCappedCuff C T j D) (y : S) : j y ∉ discInt D := fun hi => hi.2 + (by + rw [hc.discBd_eq] + have h2 : j y ∈ range j ∩ D := ⟨mem_range_self y, hi.1⟩ + rwa [hc.inter_eq] at h2) + +theorem discBd_subset_range (hc : IsCappedCuff C T j D) {Δ : Set T} (hDΔ : D ⊆ Δ) : discBd Δ ⊆ + range j := by + have hman := hc.isSurface.2.2 + have hi : discInt D ⊆ discInt Δ := discInt_mono hman hc.isClosedDisc hDΔ + intro x hx + rcases hc.union_eq.ge (mem_univ x) with h | h + · exact h + · by_cases hb : x ∈ discBd D + · rw [hc.discBd_eq] at hb + exact image_subset_range _ _ hb + · exact absurd hx (hi ⟨h, hb⟩).2 + +theorem image_preimage_bd (hc : IsCappedCuff C T j D) {Δ : Set T} (hDΔ : D ⊆ Δ) : j '' + (j ⁻¹' discBd Δ) = discBd Δ := + image_preimage_eq_of_subset (discBd_subset_range hc hDΔ) + +theorem isOArc_preimage_bd (hc : IsCappedCuff C T j D) {Δ : Set T} (hΔ : IsClosedDisc Δ) + (hDΔ : D ⊆ Δ) : IsOArc (j ⁻¹' discBd Δ) := + pull_oArc hc.isEmbedding hΔ.isOArc_discBd (discBd_subset_range hc hDΔ) + +variable [ConnectedSpace S] + +theorem surrounds_of_disc (hS : IsSurface S) (hC : C ∈ cuffs S) (hc : IsCappedCuff C T j D) + (hns : ¬ IsSphere T) {Δ : Set T} (hΔ : IsClosedDisc Δ) (hDΔ : D ⊆ Δ) : SurroundsCuff + (j ⁻¹' discBd Δ) C := by + have hT := hc.isSurface + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have : T2Space T := hT.2.1 + have : ConnectedSpace T := hc.connectedSpace hS + have hO := isOArc_preimage_bd hc hΔ hDΔ + refine ⟨hC, isPlanarInCappedCuff_of_cap hS hc ⟨Δ, hΔ, ?_⟩, fun hp => ?_⟩ + · rw [image_preimage_bd hc hDΔ] + exact Surface.discBd_subset _ + · have hnull := (isPlanar_iff_isNullHomotopicOArc_of_isOArc hS hO).mp hp + obtain ⟨E, hE, hbd⟩ := nullHomotopicOArc_bounds_disc hS hO hnull + obtain ⟨h1, h2⟩ := isClosedDisc_image_of_injOn hE hc.isEmbedding.continuous + hc.isEmbedding.injective.injOn + have heq := eq_of_discBd_eq hT hns h1 hΔ (by rw [h2, hbd, image_preimage_bd hc hDΔ]) + obtain ⟨z, hz⟩ := hc.isClosedDisc.nonempty_discInt + have : z ∈ j '' E := heq ▸ hDΔ hz.1 + obtain ⟨y, -, rfl⟩ := this + exact not_mem_discInt_cap hc y hz + +omit [ConnectedSpace S] in +theorem exists_disc_of_surrounds (hS : IsSurface S) (hc : IsCappedCuff C T j D) {F : Set S} + (hF : IsOArc F) (hs : SurroundsCuff F C) : ∃ Δ, IsClosedDisc Δ ∧ D ⊆ Δ ∧ discBd Δ = j '' F := by + have hT := hc.isSurface + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have : T2Space T := hT.2.1 + have hman := hT.2.2 + have hO : IsOArc (j '' F) := by + obtain ⟨f⟩ := id hF + exact ⟨f.trans (hc.isEmbedding.homeomorphImage F)⟩ + have hnull := (isPlanar_iff_isNullHomotopicOArc_of_isOArc hT hO).mp (hs.2.1.2.2 T j D hc) + obtain ⟨Δ, hΔ, hbd⟩ := nullHomotopicOArc_bounds_disc hT hO hnull + refine ⟨Δ, hΔ, ?_, hbd⟩ + have hoff : Disjoint (discInt D) (discBd Δ) := by + rw [hbd, disjoint_left] + rintro _ h ⟨y, -, rfl⟩ + exact not_mem_discInt_cap hc y h + refine disc_subset_of_int_off_bd hman hc.isClosedDisc hΔ hoff ?_ + by_contra hne + have hdis : ∀ x ∈ Δ, x ∉ discInt D := fun x hx hi => hne ⟨x, hi, hx⟩ + have hr : Δ ⊆ range j := fun x hx => by + rcases hc.union_eq.ge (mem_univ x) with h | h + · exact h + · by_contra hxr + refine hdis x hx ⟨h, fun hb => hxr ?_⟩ + rw [hc.discBd_eq] at hb + exact image_subset_range _ _ hb + have hcl : IsClosedEmbedding j := hc.isEmbedding.continuous.isClosedEmbedding + hc.isEmbedding.injective + have : Nonempty S := by + obtain ⟨φ⟩ := id hF + exact ⟨(φ 1).1⟩ + obtain ⟨hE, -⟩ := isClosedDisc_preimage hcl hΔ hr + refine hs.2.2 ⟨_, hE, fun y hy => ?_⟩ + have : j y ∈ discBd Δ := hbd ▸ mem_image_of_mem j hy + exact Surface.discBd_subset Δ this + +/-- The complement of a closed disc in a connected surface is connected, if the boundary of the disc +is off the boundary of the surface. -/ +theorem isPreconnected_compl_disc [T2Space T] [PreconnectedSpace T] (hman : ∀ x : T, + IsManifoldPoint x) {Δ : Set T} (hΔ : IsClosedDisc Δ) (hint : ∀ x ∈ discBd Δ, IsInteriorPoint x) : + IsPreconnected Δᶜ := by + classical + obtain ⟨E, hE, hin, -⟩ := exists_disc_around hman hΔ hint isOpen_univ (subset_univ _) + obtain ⟨p⟩ := hΔ.isOArc_discBd + obtain ⟨c, c', hc, hc', hm, hm', hl, hr, hcE, hcb, hcp⟩ := exists_disc_collar hΔ hE hin p + -- the open annulus between the discs + let Q : Set T := discInt E \ Δ + have hQc : IsPreconnected Q := by + have h1 : IsPreconnected (Ioo (1 : ℝ) 2 ×ˢ (univ : Set ℝ)) := ((convex_Ioo _ _).prod + convex_univ).isPreconnected + have h2 : Continuous fun q : ℝ × ℝ => (q.1 : ℂ) * Complex.exp ((q.2 : ℂ) * Complex.I) := by + fun_prop + have hmem : ∀ q ∈ Ioo (1 : ℝ) 2 ×ˢ (univ : Set ℝ), ‖(q.1 : ℂ) * Complex.exp + ((q.2 : ℂ) * Complex.I)‖ = q.1 := fun q hq => by + rw [norm_mul, Complex.norm_exp_ofReal_mul_I, mul_one, Complex.norm_real, + Real.norm_of_nonneg (by linarith [hq.1.1])] + have h3 : ContinuousOn c ((fun q : ℝ × ℝ => (q.1 : ℂ) * Complex.exp + ((q.2 : ℂ) * Complex.I)) '' Ioo (1 : ℝ) 2 ×ˢ (univ : Set ℝ)) := hc.mono (by + rintro _ ⟨q, hq, rfl⟩ + simp only [Metric.mem_closedBall, dist_zero_right] + rw [hmem q hq] + exact hq.1.2.le) + have h4 := (h1.image _ h2.continuousOn).image _ h3 + convert h4 using 1 + ext x + constructor + · rintro ⟨⟨hx, hxb⟩, hxΔ⟩ + refine ⟨c' x, ⟨(‖c' x‖, Complex.arg (c' x)), ⟨⟨?_, ?_⟩, mem_univ _⟩, + Complex.norm_mul_exp_arg_mul_I _⟩, hr hx⟩ + · by_contra hle + exact hxΔ (hcE ▸ ⟨c' x, by simpa using not_lt.mp hle, hr hx⟩) + · have h5 : ‖c' x‖ ≤ 2 := by simpa using hm' hx + refine lt_of_le_of_ne h5 fun h6 => hxb ?_ + rw [← hcb] + exact ⟨c' x, by simpa using h6, hr hx⟩ + · rintro ⟨_, ⟨q, hq, rfl⟩, rfl⟩ + have hn := hmem q hq + set z := (q.1 : ℂ) * Complex.exp ((q.2 : ℂ) * Complex.I) with hz + have hzb : z ∈ Metric.closedBall (0 : ℂ) 2 := by + simp only [mem_closedBall_zero_iff] + rw [hn] + exact hq.1.2.le + have hinj := hl.injOn + refine ⟨⟨hm hzb, fun hb => ?_⟩, fun hxΔ => ?_⟩ + · rw [← hcb] at hb + obtain ⟨y, hy, he⟩ := hb + rw [hinj (Metric.sphere_subset_closedBall hy) hzb he] at hy + have : ‖z‖ = 2 := by simpa using hy + linarith [hq.1.2] + · rw [← hcE] at hxΔ + obtain ⟨y, hy, he⟩ := hxΔ + have hyb : y ∈ Metric.closedBall (0 : ℂ) 2 := Metric.closedBall_subset_closedBall + one_le_two hy + rw [hinj hyb hzb he] at hy + have : ‖z‖ ≤ 1 := by simpa using hy + linarith [hq.1.1] + have hQO : IsOpen Q := (hE.isOpen_discInt hman).inter hΔ.isClosed.isOpen_compl + have hYO : IsOpen Δᶜ := hΔ.isClosed.isOpen_compl + have hEi : IsOpen (discInt E) := hE.isOpen_discInt hman + intro u v hu hv hsub ⟨x, hxY, hxu⟩ ⟨y, hyY, hyv⟩ + by_contra hcon + have hdis : Δᶜ ∩ (u ∩ v) = ∅ := by + rw [eq_empty_iff_forall_notMem] + intro z hz + exact hcon ⟨z, hz.1, hz.2⟩ + have hdisj : ∀ z, z ∈ Δᶜ → z ∈ u → z ∈ v → False := fun z h1 h2 h3 => + (eq_empty_iff_forall_notMem.mp hdis z) ⟨h1, h2, h3⟩ + rcases hQc.subset_or_subset (u := u ∩ Δᶜ) (v := v ∩ Δᶜ) (hu.inter hYO) (hv.inter hYO) + (disjoint_left.mpr fun z h1 h2 => hdisj z h1.2 h1.1 h2.1) (fun z hz => by + rcases hsub hz.2 with h | h + · exact .inl ⟨h, hz.2⟩ + · exact .inr ⟨h, hz.2⟩) with hQu | hQv + · -- then `v` cannot meet the complement + have hA : IsOpen (discInt E ∪ (u ∩ Δᶜ)) := hEi.union (hu.inter hYO) + have hB : IsOpen (v ∩ Δᶜ) := hv.inter hYO + have hdisAB : Disjoint (discInt E ∪ (u ∩ Δᶜ)) (v ∩ Δᶜ) := by + rw [disjoint_left] + rintro z (hz | hz) hz' + · exact hdisj z hz'.2 (hQu ⟨hz, hz'.2⟩).1 hz'.1 + · exact hdisj z hz.2 hz.1 hz'.1 + have hcov : (univ : Set T) ⊆ (discInt E ∪ (u ∩ Δᶜ)) ∪ (v ∩ Δᶜ) := fun z _ => by + by_cases hz : z ∈ Δ + · exact .inl (.inl (hin hz)) + · rcases hsub hz with h | h + · exact .inl (.inr ⟨h, hz⟩) + · exact .inr ⟨h, hz⟩ + rcases isPreconnected_univ.subset_or_subset hA hB hdisAB hcov with h | h + · exact disjoint_left.mp hdisAB (h (mem_univ y)) ⟨hyv, hyY⟩ + · obtain ⟨z, hz⟩ := hE.nonempty_discInt + exact disjoint_left.mp hdisAB (.inl hz) (h (mem_univ z)) + · have hA : IsOpen (discInt E ∪ (v ∩ Δᶜ)) := hEi.union (hv.inter hYO) + have hB : IsOpen (u ∩ Δᶜ) := hu.inter hYO + have hdisAB : Disjoint (discInt E ∪ (v ∩ Δᶜ)) (u ∩ Δᶜ) := by + rw [disjoint_left] + rintro z (hz | hz) hz' + · exact hdisj z hz'.2 hz'.1 (hQv ⟨hz, hz'.2⟩).1 + · exact hdisj z hz.2 hz'.1 hz.1 + have hcov : (univ : Set T) ⊆ (discInt E ∪ (v ∩ Δᶜ)) ∪ (u ∩ Δᶜ) := fun z _ => by + by_cases hz : z ∈ Δ + · exact .inl (.inl (hin hz)) + · rcases hsub hz with h | h + · exact .inr ⟨h, hz⟩ + · exact .inl (.inr ⟨h, hz⟩) + rcases isPreconnected_univ.subset_or_subset hA hB hdisAB hcov with h | h + · exact disjoint_left.mp hdisAB (h (mem_univ x)) ⟨hxu, hxY⟩ + · obtain ⟨z, hz⟩ := hE.nonempty_discInt + exact disjoint_left.mp hdisAB (.inl hz) (h (mem_univ z)) + +omit [ConnectedSpace S] in +/-- An edge that meets the closure of a region lies in the closure of the region. -/ +theorem closure_edge_subset_of_isProper (hS : IsSurface S) [ConnectedSpace S] {G : + Drawing S} (hG : G.IsProper) {e r : Set S} (he : e ∈ G.E) (hr : r ∈ G.R) (hm : + (e ∩ closure r).Nonempty) : closure e ⊆ closure r := by + have : T2Space S := hS.2.1 + obtain ⟨R, tR, i, -, Γ, hR, hRc, hi, -, -, -, hΓU, hΓV, hΓV', hmap⟩ + := exists_capped_drawing hS G hG + obtain ⟨ℛ, hℛ, hZ, -⟩ := hmap {r} (singleton_subset_iff.mpr hr) + rw [sUnion_singleton] at hZ + obtain ⟨𝒜, h𝒜, hc⟩ := isGammaNice_closure_sUnion_regions hR Γ hℛ + obtain ⟨y, hye, hyr⟩ := hm + have hoffV : ∀ x ∈ e, i x ∈ Γ.U ∧ i x ∉ Γ.V := fun x hx => by + have hxU : x ∈ G.U \ G.V := he.2.1 hx + refine ⟨hΓU ▸ mem_image_of_mem i (.inl hxU.1), fun hv => ?_⟩ + obtain ⟨w, hw, hwe⟩ := hΓV' hv + rw [hi.injective hwe] at hw + rcases hw with h | h + · exact hxU.2 h + · exact hxU.2 (hG ⟨h, hxU.1⟩) + have hjy : i y ∈ closure (⋃₀ ℛ) := by + rw [← hZ] + exact mem_image_of_mem i hyr + rw [hc] at hjy + obtain ⟨a, ha, hya⟩ := hjy + have hae : i '' e ⊆ a := by + rcases h𝒜 ha with (⟨v, hv, rfl⟩ | h1) | h1 + · exact absurd (show i y ∈ Γ.V from by + have : i y = v := hya + rw [this] + exact hv) (hoffV y hye).2 + · have hpc : IsPathConnected (i '' e) := he.2.2.1.image hi.continuous + have hsub : a ∪ i '' e ⊆ Γ.U \ Γ.V := union_subset h1.2.1 (by + rintro _ ⟨x, hx, rfl⟩ + exact hoffV x hx) + have hu : a ∪ i '' e = a := h1.2.2.2 _ hsub (h1.2.2.1.union hpc ⟨i y, hya, mem_image_of_mem i + hye⟩) subset_union_left + exact hu ▸ subset_union_right + · obtain ⟨x, -, rfl⟩ := (mem_R_iff Γ).mp h1 + exact absurd (hoffV y hye).1 (connectedComponentIn_subset _ _ hya).2 + refine closure_minimal (fun x hx => ?_) isClosed_closure + have h1 : i x ∈ ⋃₀ 𝒜 := ⟨a, ha, hae (mem_image_of_mem i hx)⟩ + rw [← hc, ← hZ] at h1 + obtain ⟨w, hw, he'⟩ := h1 + rwa [← hi.injective he'] + +/-- Each boundary point of a closed disc is a limit of points off the disc, if the boundary is off +the boundary of the surface. -/ +theorem discBd_subset_closure_compl [T2Space T] (hman : ∀ x : T, IsManifoldPoint x) {Δ : Set T} + (hΔ : IsClosedDisc Δ) (hint : ∀ x ∈ discBd Δ, IsInteriorPoint x) : discBd Δ ⊆ closure Δᶜ := by + classical + obtain ⟨E, hE, hin, -⟩ := exists_disc_around hman hΔ hint isOpen_univ (subset_univ _) + obtain ⟨p⟩ := hΔ.isOArc_discBd + obtain ⟨c, c', hc, hc', hm, hm', hl, hr, hcE, hcb, hcp⟩ := exists_disc_collar hΔ hE hin p + intro x hx + obtain ⟨w, hw⟩ : ∃ w : Circle, (p w).1 = x := ⟨p.symm ⟨x, hx⟩, by simp⟩ + have hnw : ‖(w : ℂ)‖ = 1 := Circle.norm_coe w + let f : ℝ → ℂ := fun t => (t : ℂ) * w + have hf : Continuous f := by fun_prop + have hfn : ∀ t ∈ Ioc (1 : ℝ) 2, ‖f t‖ = t := fun t ht => by + simp only [f] + rw [norm_mul, hnw, mul_one, Complex.norm_real, Real.norm_of_nonneg (by linarith [ht.1])] + let s : Set ℂ := Metric.closedBall 0 2 \ Metric.closedBall 0 1 + have hfs : MapsTo f (Ioc 1 2) s := fun t ht => ⟨by + simp only [mem_closedBall_zero_iff] + rw [hfn t ht] + exact ht.2, by + simp only [mem_closedBall_zero_iff] + rw [hfn t ht] + exact not_le.mpr ht.1⟩ + have h1 : (w : ℂ) ∈ closure s := by + have h2 : (1 : ℝ) ∈ closure (Ioc (1 : ℝ) 2) := by + rw [closure_Ioc (by norm_num)] + exact ⟨le_rfl, by norm_num⟩ + have h3 := map_mem_closure hf h2 hfs + simpa [f] using h3 + have hsub : s ⊆ Metric.closedBall 0 2 := sdiff_subset + have hw2 : (w : ℂ) ∈ Metric.closedBall (0 : ℂ) 2 := by + simp only [mem_closedBall_zero_iff, hnw] + norm_num + have h4 : c w ∈ closure (c '' s) := ((hc _ hw2).mono hsub).mem_closure_image h1 + rw [hcp, hw] at h4 + refine closure_mono ?_ h4 + rintro _ ⟨z, hz, rfl⟩ hzΔ + rw [← hcE] at hzΔ + obtain ⟨y, hy, he⟩ := hzΔ + have hyb : y ∈ Metric.closedBall (0 : ℂ) 2 := Metric.closedBall_subset_closedBall one_le_two hy + rw [hl.injOn hyb hz.1 he] at hy + exact hz.2 hy + +omit [ConnectedSpace S] in +theorem isOpen_image_diff_cap (hc : IsCappedCuff C T j D) {O : Set S} + (hO : IsOpen O) : ∃ O' : Set T, IsOpen O' ∧ O = j ⁻¹' O' := by + obtain ⟨O', h1, h2⟩ := hc.isEmbedding.isInducing.isOpen_iff.mp hO + exact ⟨O', h1, h2.symm⟩ + +omit [ConnectedSpace S] in +theorem compl_disc_subset_range (hc : IsCappedCuff C T j D) {Δ : Set T} + (hDΔ : D ⊆ Δ) : Δᶜ ⊆ range j := fun x hx => by + rcases hc.union_eq.ge (mem_univ x) with h | h + · exact h + · exact absurd (hDΔ h) hx + +variable [T1Space S] + +omit [ConnectedSpace S] [T1Space S] in +theorem region_off_U {G : Drawing S} {r : Set S} (hr : r ∈ G.R) {x : S} (hx : x ∈ r) : x ∉ G.U := by + obtain ⟨y, -, rfl⟩ := (mem_R_iff G).mp hr + exact (connectedComponentIn_subset _ _ hx).2 + +omit [T1Space S] in +/-- **An outer edge is a loop.** Suppose that all vertices on the closure of the region `r` lie in +`Δ`. Then an edge of `G` on the closure of `r` and off `Δ` is a loop at the vertex of the boundary +of `Δ`, and it bounds a disc in the disc `E₀`, which holds the closure of `r`. -/ +theorem outer_edge_loop (hS : IsSurface S) (hc : IsCappedCuff C T j D) {G : Drawing S} + (hG : G.IsProper) {Δ E₀ : Set T} (hΔ : IsClosedDisc Δ) (hcount : (G.V ∩ j ⁻¹' discBd Δ).ncard + ≤ 1) {r e : Set S} (hr : r ∈ G.R) (hE₀ : IsClosedDisc E₀) + (hrE : j '' closure r ⊆ E₀) (hvert : ∀ b ∈ G.V, b ∈ closure r → j b ∈ Δ) (he : e ∈ G.E) (hme : + (e ∩ closure r).Nonempty) (hoff : Disjoint (j '' e) Δ) : + ∃ a ∈ G.V, j a ∈ discBd Δ ∧ closure e = e ∪ {a} ∧ ∃ B, IsClosedDisc B ∧ discBd B + = j '' closure e := by + have hT := hc.isSurface + have : T2Space S := hS.2.1 + have : T2Space T := hT.2.1 + have hman := hT.2.2 + have hclr : closure e ⊆ closure r := closure_edge_subset_of_isProper hS hG he hr hme + have hbdv : ∀ v ∈ closure e, v ∈ G.V → j v ∈ discBd Δ := fun v hv hvV => by + by_contra hnb + have hi : j v ∈ discInt Δ := ⟨hvert v hvV (hclr hv), hnb⟩ + have h1 : j v ∈ closure (j '' e) := image_closure_subset_closure_image + hc.isEmbedding.continuous (mem_image_of_mem j hv) + obtain ⟨z, hz1, hz2⟩ := mem_closure_iff.mp h1 _ (hΔ.isOpen_discInt hman) hi + exact disjoint_left.mp hoff hz2 hz1.1 + have hu : ∀ {u v : S}, u ∈ G.V → v ∈ G.V → j u ∈ discBd Δ → j v ∈ discBd Δ → u = v + := fun {u v} hu hv h1 h2 => + (ncard_le_one (G.finite_V.subset inter_subset_left)).mp hcount u ⟨hu, h1⟩ v ⟨hv, h2⟩ + obtain ⟨u, hcap, hO⟩ : ∃ u : S, closure e ∩ G.V = {u} ∧ IsOArc (closure e) := by + rcases G.edge_cond e he with ⟨u, v, huv, hcap, -⟩ | h + · exfalso + have h1 : u ∈ closure e ∩ G.V := by + rw [hcap] + exact .inl rfl + have h2 : v ∈ closure e ∩ G.V := by + rw [hcap] + exact .inr rfl + exact huv (hu h1.2 h2.2 (hbdv u h1.1 h1.2) (hbdv v h2.1 h2.2)) + · exact h + have hu1 : u ∈ closure e ∩ G.V := by + rw [hcap] + exact rfl + refine ⟨u, hu1.2, hbdv u hu1.1 hu1.2, ?_, ?_⟩ + · apply subset_antisymm + · intro x hx + by_cases hxV : x ∈ G.V + · have h2 : x ∈ closure e ∩ G.V := ⟨hx, hxV⟩ + rw [hcap] at h2 + exact .inr h2 + · have h3 : x ∈ closure e \ G.V := ⟨hx, hxV⟩ + rw [GM09.closure_edge_diff_V_eq G he] at h3 + exact .inl h3 + · rintro x (hx | hx) + · exact subset_closure hx + · rw [hx] + exact hu1.1 + · have hO' : IsOArc (j '' closure e) := by + obtain ⟨f⟩ := id hO + exact ⟨f.trans (hc.isEmbedding.homeomorphImage _)⟩ + have hsub : j '' closure e ⊆ E₀ := (image_mono hclr).trans hrE + obtain ⟨B, -, hB, hbd⟩ := nullHomotopicOArcIn_bounds_disc hT hO' hsub + (isNullHomotopicOArcIn_of_subset_disc hO' subset_rfl hE₀ hsub) + exact ⟨B, hB, hbd⟩ + +omit [ConnectedSpace S] [T1Space S] in +/-- **A loop around the cuff.** If the disc of an outer loop holds `D`, then a parallel copy of the +loop bounds a disc with more of `G` than `Δ` has. -/ +theorem outer_loop_beats [T2Space S] (hc : IsCappedCuff C T j D) {G : Drawing S} + {Δ B : Set T} {e : Set S} {a : S} (hΔ : IsClosedDisc Δ) (hDΔ : D ⊆ Δ) (he : e ∈ G.E) + (hoff : Disjoint (j '' e) Δ) (ha : a ∈ G.V) (haΔ : j a ∈ discBd Δ) + (hcl : closure e = e ∪ {a}) (hB : IsClosedDisc B) (hbd : discBd B = j '' closure e) + (hDB : D ⊆ B) (hint : ∀ x ∈ discBd B, IsInteriorPoint x) (hcj : IsClosedEmbedding j) : + ∃ Δ₂, IsCuffDisc G j D 1 Δ₂ ∧ cuffCount G j Δ < cuffCount G j Δ₂ := by + classical + have hT := hc.isSurface + have : T2Space T := hT.2.1 + have hman := hT.2.2 + have hii := hcj.injective + have hsu : Δ ⊆ B := by + refine disc_subset_of_int_off_bd hman hΔ hB ?_ ?_ + · rw [disjoint_left, hbd, hcl, image_union] + rintro x hx (h | h) + · exact disjoint_left.mp hoff h hx.1 + · rw [image_singleton, mem_singleton_iff] at h + subst h + exact hx.2 haΔ + · obtain ⟨z, hz⟩ := hc.isClosedDisc.nonempty_discInt + exact ⟨z, discInt_mono hman hc.isClosedDisc hDΔ hz, hDB hz.1⟩ + obtain ⟨E, hE, hBE, -⟩ := exists_disc_around hman hB hint isOpen_univ (subset_univ _) + have hZ : IsClosed (j '' (G.U \ e)) := hcj.isClosedMap _ (isClosed_U_sdiff_edge G he) + obtain ⟨Δ₂, h1, h2, -, -, h5, -, h7⟩ := exists_disc_push_off hB hE hBE hZ + have hee : ∀ x ∈ e, j x ∈ B := fun x hx => Surface.discBd_subset B (hbd ▸ mem_image_of_mem j + (subset_closure hx)) + have hnoZ : ∀ x ∈ e, j x ∉ j '' (G.U \ e) := fun x hx ⟨y, hy, hxy⟩ => hy.2 (hii hxy ▸ hx) + have hUa : ∀ x ∈ G.U, j x ∈ discBd Δ₂ → x = a := fun x hxU hx => by + by_cases hxe : x ∈ e + · exact absurd (h5 ⟨hx, hee x hxe⟩) (hnoZ x hxe) + · have h8 := h7 ⟨hx, mem_image_of_mem j ⟨hxU, hxe⟩⟩ + rw [hbd, hcl, image_union] at h8 + rcases h8 with ⟨y, hy, hxy⟩ | ⟨y, hy, hxy⟩ + · exact absurd (hii hxy ▸ hy) hxe + · rw [← hii hxy] + exact hy + refine ⟨Δ₂, ⟨h1, hDB.trans h2, fun x hx => ?_, ?_⟩, cuffCount_lt G j (hsu.trans h2) (.inr ⟨e, + he, ?_, ?_⟩)⟩ + · rw [hUa x hx.2 hx.1] + exact ha + · have hsub : G.V ∩ j ⁻¹' discBd Δ₂ ⊆ ({a} : Set S) := + fun x hx => hUa x (G.V_subset_U hx.1) hx.2 + exact (ncard_le_ncard hsub).trans (by simp) + · rintro _ ⟨x, hx, rfl⟩ + exact h2 (hee x hx) + · obtain ⟨x, hx⟩ := he.1 + exact fun h => disjoint_left.mp hoff (mem_image_of_mem j hx) (h (mem_image_of_mem j hx)) + +omit [T1Space S] in +/-- **The region and its loops fill the surface.** Suppose that the disc `B e` of each outer edge +`e` misses `D`, in the sense that `D` is not inside. Then the region `r` and the discs `B e` hold +every point off `Δ`. In the proof this set +is open, and its closure adds no point off `Δ`, because the only frontier of `r` off `Δ` lies on the +outer edges and those lie in the discs. -/ +theorem outer_fills (hS : IsSurface S) (hc : IsCappedCuff C T j D) {G : Drawing S} (hG : G.IsProper) + {Δ : Set T} {r : Set S} {p : S} (hΔ : IsClosedDisc Δ) (hDΔ : D ⊆ Δ) + (hn : G.IsNormal (j ⁻¹' discBd Δ)) + (hint : ∀ x ∈ discBd Δ, IsInteriorPoint x) (hr : r ∈ G.R) (hpr : p ∈ r) (hpΔ : j p ∈ discBd Δ) + (hvert : ∀ b ∈ G.V, b ∈ closure r → j b ∈ Δ) (hcj : IsClosedEmbedding j) {B : Set S + → Set T} {a : Set S → S} + (hB : ∀ e ∈ {e ∈ G.E | (e ∩ closure r).Nonempty ∧ Disjoint (j '' e) Δ}, IsClosedDisc (B e) + ∧ discBd (B e) = j '' closure e ∧ closure e = e ∪ {a e} ∧ j (a e) ∈ discBd Δ ∧ ¬ D ⊆ B e + ∧ ∀ x ∈ discBd (B e), IsInteriorPoint x) : + Δᶜ ⊆ j '' r ∪ ⋃ e ∈ {e ∈ G.E | (e ∩ closure r).Nonempty ∧ Disjoint (j '' e) Δ}, B e := by + classical + have hT := hc.isSurface + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := hS.locallyConnected + have : T2Space T := hT.2.1 + have : ConnectedSpace T := hc.connectedSpace hS + have hman := hT.2.2 + have hii := hcj.injective + set 𝓛 : Set (Set S) := {e ∈ G.E | (e ∩ closure r).Nonempty ∧ Disjoint (j '' e) Δ} with h𝓛 + have hfin : 𝓛.Finite := G.finite_edges.subset (sep_subset _ _) + have hpU : p ∉ G.U := region_off_U hr hpr + -- the region misses each disc + have hrB : ∀ e ∈ 𝓛, Disjoint (j '' r) (B e) := fun e he => by + obtain ⟨hBd, hbd, hcl, haΔ, hDB, -⟩ := hB e he + have hrpre : IsPreconnected (j '' r) := (region_isPreconnected hr).image _ + hcj.continuous.continuousOn + have hoffbd : Disjoint (j '' r) (discBd (B e)) := by + rw [hbd, disjoint_left] + rintro _ ⟨x, hx, rfl⟩ ⟨y, hy, he'⟩ + rw [← hii he'] at hx + exact region_off_U hr hx (G.closure_subset_U he.1 hy) + have hIoff : discInt Δ ⊆ (B e)ᶜ := by + have hd : Disjoint (discInt Δ) (frontier (B e)) := by + refine Disjoint.mono_right (frontier_disc_subset hman hBd) ?_ + rw [disjoint_left, hbd, hcl, image_union] + rintro x hx (h | h) + · exact disjoint_left.mp he.2.2 h hx.1 + · rw [image_singleton, mem_singleton_iff] at h + subst h + exact hx.2 haΔ + rcases inside_or_off hΔ.isPreconnected_discInt hBd.isClosed hd with h | h + · refine absurd ?_ hDB + have h3 : Δ ⊆ B e := hΔ.subset_closure_discInt.trans (closure_minimal + (h.trans interior_subset) hBd.isClosed) + exact hDΔ.trans h3 + · exact h + have hp1 : j p ∉ B e := fun hin => by + by_cases hb : j p ∈ discBd (B e) + · exact disjoint_left.mp hoffbd (mem_image_of_mem j hpr) hb + · obtain ⟨z, hz1, hz2⟩ := mem_closure_iff.mp (hΔ.subset_closure_discInt + (Surface.discBd_subset Δ hpΔ)) _ (hBd.isOpen_discInt hman) ⟨hin, hb⟩ + exact hIoff hz2 hz1.1 + rcases inside_or_off hrpre hBd.isClosed (hoffbd.mono_right (frontier_disc_subset hman hBd)) + with h | h + · exact absurd (interior_subset (h (mem_image_of_mem j hpr))) hp1 + · exact disjoint_left.mpr fun x hx hx' => h hx hx' + -- the set is open + obtain ⟨O, hO, hrO⟩ := isOpen_image_diff_cap hc (region_isOpen hr) + have hOr : O \ Δ ⊆ j '' r := fun x hx => by + obtain ⟨y, rfl⟩ := compl_disc_subset_range hc hDΔ hx.2 + exact ⟨y, hrO ▸ hx.1, rfl⟩ + let u : Set T := (j '' r ∪ ⋃ e ∈ 𝓛, B e) \ Δ + have huo : IsOpen u := by + rw [isOpen_iff_mem_nhds] + rintro x ⟨hx | hx, hxΔ⟩ + · have hxO : x ∈ O := by + obtain ⟨y, hy, rfl⟩ := hx + have : y ∈ j ⁻¹' O := hrO ▸ hy + exact this + exact Filter.mem_of_superset ((hO.sdiff hΔ.isClosed).mem_nhds ⟨hxO, + hxΔ⟩) fun z hz => ⟨.inl (hOr hz), hz.2⟩ + · obtain ⟨e, he, hxB⟩ := mem_iUnion₂.mp hx + obtain ⟨hBd, hbd, hcl, haΔ, hDB, hbi⟩ := hB e he + by_cases hb : x ∈ discBd (B e) + · obtain ⟨y, hy, rfl⟩ := hbd ▸ hb + have hye : y ∈ e := by + rcases hcl ▸ hy with h | h + · exact h + · rw [h] at hxΔ + exact absurd (Surface.discBd_subset Δ haΔ) hxΔ + obtain ⟨E, hE, hBE, -⟩ := exists_disc_around hman hBd hbi isOpen_univ (subset_univ _) + have hZc : IsClosed (j '' (G.U \ e)) := hcj.isClosedMap _ (isClosed_U_sdiff_edge G he.1) + have hW : IsOpen (j '' (G.U \ e) ∪ Δ)ᶜ := (hZc.union hΔ.isClosed).isOpen_compl + have hyW : j y ∈ (j '' (G.U \ e) ∪ Δ)ᶜ := by + rintro (⟨z, hz, he'⟩ | h) + · exact hz.2 (hii he' ▸ hye) + · exact hxΔ h + obtain ⟨N, hNo, hyN, hNW, hNp, -⟩ := exists_side_nbhd hman hBd hE hBE hb hW hyW + have hNr : N \ B e ⊆ j '' r := by + have hNoff : ∀ z ∈ N, z ∉ Δ := fun z hz h => hNW hz (.inr h) + have hsubr : N \ B e ⊆ range j := fun z hz => compl_disc_subset_range hc hDΔ + (hNoff z hz.1) + have hpre : IsPreconnected (j ⁻¹' (N \ B e)) := by + rw [← hcj.isInducing.isPreconnected_image, image_preimage_eq_of_subset hsubr] + exact hNp + obtain ⟨w, hw, hwN⟩ : (j '' r ∩ N).Nonempty := by + have hyc : y ∈ closure r := by + obtain ⟨z, hz1, hz2⟩ := he.2.1 + have : e ∈ G.E := he.1 + exact closure_edge_subset_of_isProper hS hG he.1 hr ⟨z, hz1, hz2⟩ (subset_closure hye) + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp hyc _ (hNo.preimage hcj.continuous) hyN + exact ⟨j w, mem_image_of_mem j hw2, hw1⟩ + obtain ⟨w', hw'r, rfl⟩ := hw + have hsubU : j ⁻¹' (N \ B e) ⊆ G.Uᶜ := fun z hz hzU => by + by_cases hze : z ∈ e + · exact hz.2 (Surface.discBd_subset (B e) (hbd ▸ mem_image_of_mem j + (subset_closure hze))) + · exact hNW hz.1 (.inl (mem_image_of_mem j ⟨hzU, hze⟩)) + have hw'in : w' ∈ j ⁻¹' (N \ B e) := ⟨hwN, disjoint_left.mp (hrB e he) + (mem_image_of_mem j hw'r)⟩ + intro z hz + obtain ⟨t, rfl⟩ := hsubr hz + obtain ⟨q, -, rfl⟩ := (mem_R_iff G).mp hr + have h1 : j ⁻¹' (N \ B e) ⊆ connectedComponentIn (univ \ G.U) w' + := hpre.subset_connectedComponentIn hw'in fun z hz => ⟨mem_univ z, hsubU hz⟩ + rw [connectedComponentIn_eq hw'r] + exact mem_image_of_mem j (h1 hz) + refine Filter.mem_of_superset (hNo.mem_nhds hyN) fun z hz => ?_ + have hzΔ : z ∉ Δ := fun h => hNW hz (.inr h) + by_cases hzB : z ∈ B e + · exact ⟨.inr (mem_iUnion₂.mpr ⟨e, he, hzB⟩), hzΔ⟩ + · exact ⟨.inl (hNr ⟨hz, hzB⟩), hzΔ⟩ + · refine Filter.mem_of_superset (((hBd.isOpen_discInt hman).sdiff hΔ.isClosed).mem_nhds + ⟨⟨hxB, hb⟩, hxΔ⟩) fun z hz => ?_ + exact ⟨.inr (mem_iUnion₂.mpr ⟨e, he, hz.1.1⟩), hz.2⟩ + -- it meets the complement of the disc + have hne : (Δᶜ ∩ u).Nonempty := by + have hpO : j p ∈ O := by + have : p ∈ j ⁻¹' O := hrO ▸ hpr + exact this + obtain ⟨z, hz1, hz2⟩ := mem_closure_iff.mp (discBd_subset_closure_compl hman hΔ hint hpΔ) _ hO + hpO + exact ⟨z, hz2, .inl (hOr ⟨hz1, hz2⟩), hz2⟩ + -- no point off the disc is a limit of the set without being in it + have hcl : closure u ∩ Δᶜ ⊆ u := by + rintro x ⟨hxc, hxΔ⟩ + have hcu : closure u ⊆ j '' closure r ∪ ⋃ e ∈ 𝓛, B e := by + refine closure_minimal ?_ ((hcj.isClosedMap _ isClosed_closure).union + (hfin.isClosed_biUnion fun e he => (hB e he).1.isClosed)) + rintro z ⟨hz | hz, -⟩ + · obtain ⟨y, hy, rfl⟩ := hz + exact .inl (mem_image_of_mem j (subset_closure hy)) + · exact .inr hz + rcases hcu hxc with ⟨y, hy, rfl⟩ | h + · rcases closure_region_subset hr hy with h | hyU + · exact ⟨.inl (mem_image_of_mem j h), hxΔ⟩ + · by_cases hyV : y ∈ G.V + · exact absurd (hvert y hyV hy) hxΔ + · obtain ⟨e, he, hye⟩ := G.exists_edge_of_mem hyU hyV + have hpc : IsPreconnected (j '' e) := he.2.2.1.isConnected.isPreconnected.image _ + hcj.continuous.continuousOn + have hdf : Disjoint (j '' e) (frontier Δ) := by + refine Disjoint.mono_right (frontier_disc_subset hman hΔ) ?_ + rw [disjoint_left] + rintro _ ⟨z, hz, rfl⟩ hzb + have hzU : z ∈ G.U \ G.V := he.2.1 hz + exact hzU.2 (hn ⟨hzb, hzU.1⟩) + have hee : e ∈ 𝓛 := by + refine ⟨he, ⟨y, hye, hy⟩, ?_⟩ + rcases inside_or_off hpc hΔ.isClosed hdf with h | h + · exact absurd (interior_subset (h (mem_image_of_mem j hye))) hxΔ + · exact disjoint_left.mpr fun z hz hz' => h hz hz' + obtain ⟨hBd, hbd, -⟩ := hB e hee + exact ⟨.inr (mem_iUnion₂.mpr ⟨e, hee, Surface.discBd_subset (B e) + (hbd ▸ mem_image_of_mem j (subset_closure hye))⟩), hxΔ⟩ + · exact ⟨.inr h, hxΔ⟩ + have hfinal := (isPreconnected_compl_disc hman hΔ hint).subset_of_closure_inter_subset huo hne hcl + exact fun x hx => (hfinal hx).1 + +omit [T1Space S] in +/-- A set of `𝒜_r(C)` meets no other cuff, if `r` and the number of vertices of the other cuff add +up to less than `α(G)`. -/ +theorem off_other_cuffs (hS : IsSurface S) {a b c : ℕ} (habc : 3 ≤ 3 * a + 3 * b + c) + (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) (hcyl : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 2)) {G : + Drawing S} (hG : G.IsProper) (hC : C ∈ cuffs S) {r : ℕ} + (hα : ∀ C₁ ∈ cuffs S, C₁ ≠ C → r + (G.V ∩ C₁).ncard < alpha G) {y : S} (hy : y ∈ scriptA G r C) + (hb : y ∈ bd S) (hyC : y ∉ C) : False := by + have h1 : y ∈ ⋃₀ cuffs S := by + rw [sUnion_cuffs] + exact hb + obtain ⟨C₁, hC₁, hyC₁⟩ := h1 + have hne : C₁ ≠ C := fun h => hyC (h ▸ hyC₁) + have h2 := theorem_5_3_proof hS hcyl G hC hC₁ hne.symm (hα C₁ hC₁ hne) + have h3 : y ∈ scriptA G (G.V ∩ C₁).ncard C₁ := ⟨C₁, isScriptASet_cuff hS habc hm hG hC₁ le_rfl, + hyC₁⟩ + exact eq_empty_iff_forall_notMem.mp h2 y ⟨hy, h3⟩ + +omit [T1Space S] in +/-- The boundary of a cuff disc gives a set of `𝒜_r(C)`. -/ +theorem IsCuffDisc.isScriptASet (hS : IsSurface S) (hC : C ∈ cuffs S) (hc : IsCappedCuff C T j D) + (hns : ¬ IsSphere T) {G : Drawing S} {r : ℕ} {Δ : Set T} (hd : IsCuffDisc G j D r Δ) : + IsScriptASet G r C (j ⁻¹' discBd Δ) := by + have hO := isOArc_preimage_bd hc hd.1 hd.2.1 + exact ⟨isSolid_of_isOArc hS hO, isConnected_of_isOArc hO, hd.2.2.1, + surrounds_of_disc hS hC hc hns hd.1 hd.2.1, hd.2.2.2⟩ + +omit [T1Space S] in +/-- A cuff disc is off the boundary of `Σ + CHat`. -/ +theorem IsCuffDisc.disjoint_bd (hS : IsSurface S) {a b c : ℕ} (habc : 3 ≤ 3 * a + 3 * b + c) + (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) (hcyl : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 2)) {G : + Drawing S} (hG : G.IsProper) (hC : C ∈ cuffs S) + (hc : IsCappedCuff C T j D) (hbT : bd T = j '' (bd S \ C)) {r : ℕ} (hα : ∀ C₁ ∈ cuffs S, C₁ ≠ C + → r + (G.V ∩ C₁).ncard < alpha G) {Δ : Set T} (hd : IsCuffDisc G j D r Δ) : Disjoint Δ (bd T) + := by + have hT := hc.isSurface + have : T2Space T := hT.2.1 + have hns : ¬ IsSphere T := not_isSphere_cap hS habc hm hc + rw [disjoint_left] + intro x hx hxb + by_cases hb : x ∈ discBd Δ + · obtain ⟨y, hy, rfl⟩ := hbT ▸ hxb + exact off_other_cuffs hS habc hm hcyl hG hC hα ⟨_, hd.isScriptASet hS hC hc hns, hb⟩ hy.1 hy.2 + · exact hxb (isInteriorPoint_of_mem_discInt hT.2.2 hd.1 ⟨hx, hb⟩) + +omit [T1Space S] in +omit [ConnectedSpace S] in +/-- An `O`-arc that surrounds `C` with at most one vertex can not lie outside a disc that has gained +a vertex over a maximal cuff disc. -/ +theorem two_le_of_surrounds (hS : IsSurface S) (hc : IsCappedCuff C T j D) {G : Drawing S} {Δ' Δ₁ : + Set T} (hΔ₁ : IsClosedDisc Δ₁) (hD₁ : D ⊆ Δ₁) (hsub : Δ' ⊆ Δ₁) (hmax : ∀ Δ, IsCuffDisc G j D 1 Δ + → cuffCount G j Δ ≤ cuffCount G j Δ') + {b : S} (hbV : b ∈ G.V) (hb₁ : j b ∈ Δ₁) (hb : j b ∉ Δ') {F : Set S} (hn : G.IsNormal F) + (hF : IsOArc F) (hs : SurroundsCuff F C) (hoff : Disjoint (j '' F) (discInt Δ₁)) : 2 ≤ + (G.V ∩ F).ncard := by + have hT := hc.isSurface + have : T2Space T := hT.2.1 + have hman := hT.2.2 + by_contra hlt + obtain ⟨E, hE, hDE, hbd⟩ := exists_disc_of_surrounds hS hc hF hs + have hinj := hc.isEmbedding.injective + have hsu : Δ₁ ⊆ E := by + refine disc_subset_of_int_off_bd hman hΔ₁ hE ?_ ?_ + · rw [hbd] + exact hoff.symm + · obtain ⟨z, hz⟩ := hc.isClosedDisc.nonempty_discInt + exact ⟨z, discInt_mono hman hc.isClosedDisc hD₁ hz, hDE hz.1⟩ + have hpre : j ⁻¹' discBd E = F := by + rw [hbd, preimage_image_eq _ hinj] + have hd : IsCuffDisc G j D 1 E := ⟨hE, hDE, by rwa [hpre], by + rw [hpre] + omega⟩ + have h1 := hmax E hd + have h2 := cuffCount_lt G j (hsub.trans hsu) (.inl ⟨b, hbV, hsu hb₁, hb⟩) + omega + +/-- **The choice of `A` in (6.1).** There is a disc of `Σ + CHat` around `D` whose boundary has +exactly two vertices of `G`, off the other cuffs, and such that an `O`-arc on the far side that +surrounds `C` has at least two vertices. -/ +theorem exists_two_vertex_disc (hS : IsSurface S) {a b c : ℕ} (habc : 3 ≤ 3 * a + 3 * b + c) + (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) (hcyl : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 2)) {G : + Drawing S} (hG : G.IsProper) (hC : C ∈ cuffs S) + (hc : IsCappedCuff C T j D) (hbT : bd T = j '' (bd S \ C)) (hsmall : (G.V ∩ C).ncard ≤ 1) + (hα : 9 ≤ alpha G) (hα₂ : ∀ C₁ ∈ cuffs S, C₁ ≠ C → 2 + (G.V ∩ C₁).ncard < alpha G) {C₁ : Set + S} (hC₁ : C₁ ∈ cuffs S) (hne : C₁ ≠ C) : + ∃ Δ, IsCuffDisc G j D 2 Δ ∧ (G.V ∩ j ⁻¹' discBd Δ).ncard = 2 ∧ Disjoint Δ (bd T) + ∧ ∀ F, G.IsNormal F → IsOArc F → SurroundsCuff F C → Disjoint (j '' F) (discInt Δ) → 2 ≤ + (G.V ∩ F).ncard := by + classical + have hT := hc.isSurface + have : T2Space S := hS.2.1 + have : T2Space T := hT.2.1 + have : CompactSpace S := hS.1 + have hman := hT.2.2 + have hcj : IsClosedEmbedding j := hc.isEmbedding.continuous.isClosedEmbedding + hc.isEmbedding.injective + have hii := hcj.injective + have hns : ¬ IsSphere T := not_isSphere_cap hS habc hm hc + have hCsub : C ⊆ bd S := connectedComponentIn_subset_of_cuff hC + have hpreD : j ⁻¹' discBd D = C := by + rw [hc.discBd_eq, preimage_image_eq _ hii] + have hα₁ : ∀ C₁ ∈ cuffs S, C₁ ≠ C → 1 + (G.V ∩ C₁).ncard < alpha G := fun C₁ h1 h2 => by + have := hα₂ C₁ h1 h2 + omega + have hD₀ : IsCuffDisc G j D 1 D := ⟨hc.isClosedDisc, subset_rfl, by + rw [hpreD] + exact fun x hx => hG ⟨hCsub hx.1, hx.2⟩, by rwa [hpreD]⟩ + obtain ⟨Δ', hd, hmax⟩ := exists_max_count G j hD₀ + have hscr := hd.isScriptASet hS hC hc hns + have hoff := hd.disjoint_bd hS habc hm hcyl hG hC hc hbT hα₁ + have hint : ∀ x ∈ discBd Δ', IsInteriorPoint x := fun x hx => by + by_contra h + exact disjoint_left.mp hoff (Surface.discBd_subset Δ' hx) h + obtain ⟨hΔ', hDΔ', hn, hcount⟩ := id hd + have hO := isOArc_preimage_bd hc hΔ' hDΔ' + have hVf : (G.V ∩ j ⁻¹' discBd Δ').Finite := G.finite_V.subset inter_subset_left + obtain ⟨p, hpA, hpV⟩ : ∃ p ∈ j ⁻¹' discBd Δ', p ∉ G.V := by + by_contra hall + push Not at hall + obtain ⟨φ⟩ := id hO + have hfin : (j ⁻¹' discBd Δ').Finite := G.finite_V.subset hall + refine (isConnected_of_isOArc hO).isPreconnected.infinite_of_nontrivial ⟨φ 1, (φ 1).2, + φ (Circle.exp Real.pi), (φ _).2, fun h3 => ?_⟩ hfin + have h4 : (1 : Circle) = Circle.exp Real.pi := φ.injective (Subtype.ext h3) + have h5 : ((1 : Circle) : ℂ) = (Circle.exp Real.pi : ℂ) := congrArg _ h4 + rw [Circle.coe_exp, Complex.exp_pi_mul_I, Circle.coe_one] at h5 + norm_num at h5 + have hpU : p ∉ G.U := fun h => hpV (hn ⟨hpA, h⟩) + obtain ⟨r, hr, hpr⟩ := exists_region_of_notMem hpU + have hpΔ : j p ∈ discBd Δ' := hpA + have hrA : r ⊆ scriptA G 1 C := region_subset_scriptA hS hr ⟨p, hpr, _, hscr, hpA⟩ + obtain ⟨E₀, hE₀, hrE₀⟩ := (theorem_5_7_proof hS hm habc hG hC (r := 1) (by omega)).2.2 T j D hc + have hrE : j '' closure r ⊆ E₀ := by + have h1 : closure r ⊆ j ⁻¹' E₀ := closure_minimal (fun x hx => hrE₀ (mem_image_of_mem j + (hrA hx))) (hE₀.isClosed.preimage hcj.continuous) + rintro _ ⟨x, hx, rfl⟩ + exact h1 hx + have hbdS : ∀ {x : S}, j x ∈ bd T → x ∈ bd S ∧ x ∉ C := fun {x} hx => by + obtain ⟨y, hy, he⟩ := hbT ▸ hx + exact hii he ▸ hy + have hroff : ∀ x ∈ r, j x ∉ bd T := fun x hx h => + off_other_cuffs hS habc hm hcyl hG hC hα₁ (hrA hx) (hbdS h).1 (hbdS h).2 + by_cases hcase : ∃ b ∈ G.V, b ∈ closure r ∧ j b ∉ Δ' + · -- a vertex on the region outside the disc: run a finger to it + obtain ⟨w, hwV, hwc, hwΔ⟩ := hcase + have hXc : IsClosed (j ⁻¹' Δ') := hΔ'.isClosed.preimage hcj.continuous + have hjoin : JoinedIn (r ∪ {w}) p w := by + have hnw : w ∈ (G.U \ G.V)ᶜ := fun h => h.2 hwV + have hnp : p ∈ (G.U \ G.V)ᶜ := fun h => hpU h.1 + refine (joinedIn_region_union_pair hS hG hr (subset_closure hpr) hnp hwc hnw).mono ?_ + rintro z (hz | rfl | rfl) + · exact .inl hz + · exact .inl hpr + · exact .inr rfl + obtain ⟨x, hxX, L, hLZ, hL, hLX⟩ := exists_whisker_line hXc (Surface.discBd_subset Δ' hpΔ) hwΔ + hjoin + have hxw : x ≠ w := fun h => hwΔ (h ▸ hxX) + have hxL : x ∈ L := hL.left_mem + have hwL : w ∈ L := hL.right_mem + have hxr : x ∈ r := by + rcases hLZ hxL with h | h + · exact h + · exact absurd h hxw + have hLU : ∀ z ∈ L, z ∈ G.U → z = w := fun z hz hzU => by + rcases hLZ hz with h | h + · exact absurd hzU (region_off_U hr h) + · exact h + have hxb : j x ∈ discBd Δ' := by + by_contra hnb + have hxi : j x ∈ discInt Δ' := ⟨hxX, hnb⟩ + obtain ⟨z, hz1, hz2⟩ := mem_closure_iff.mp (closure_line_diff_ends hL hxL) (j ⁻¹' discInt Δ') + ((hΔ'.isOpen_discInt hman).preimage hcj.continuous) hxi + have hzx : z = x := hLX ⟨hz2.1, hz1.1⟩ + exact hz2.2 (.inl hzx) + have hLA : L ∩ j ⁻¹' discBd Δ' ⊆ {x} := fun z hz => hLX ⟨hz.1, Surface.discBd_subset Δ' hz.2⟩ + have hsubV : G.V ∩ (j ⁻¹' discBd Δ' ∪ L) ⊆ insert w (G.V ∩ j ⁻¹' discBd Δ') := by + rintro z ⟨hzV, hz | hz⟩ + · exact .inr ⟨hzV, hz⟩ + · exact .inl (hLU z hz (G.V_subset_U hzV)) + have hcard2 : (G.V ∩ (j ⁻¹' discBd Δ' ∪ L)).ncard ≤ 2 := (ncard_le_ncard hsubV + (hVf.insert w)).trans ((ncard_insert_le _ _).trans (by omega)) + have hscr2 : IsScriptASet G 2 C (j ⁻¹' discBd Δ' ∪ L) := hscr.whisker hS hxb hL hLA (fun z hz + => by + rw [hLU z hz.1 hz.2] + exact hwV) hcard2 + have hLoff : ∀ z ∈ L, j z ∉ bd T := fun z hz h => + off_other_cuffs hS habc hm hcyl hG hC hα₂ ⟨_, hscr2, .inr hz⟩ (hbdS h).1 (hbdS h).2 + obtain ⟨e⟩ := (cappedCuff_homeo_model hS hm hC hc).2 + have hZc : IsClosed (j '' G.U) := hcj.isClosedMap _ G.isClosed_U + obtain ⟨Δ₁, h1, h2, h3, h4, h5, h6⟩ := exists_finger_of_homeo hT e hΔ' + (image_line hc.isEmbedding hL) (hii.ne hxw) hxb + (by + rintro _ ⟨⟨z, hz, rfl⟩, hzΔ⟩ + rw [show z = x from hLX ⟨hz, hzΔ⟩] + rfl) hwΔ hZc (mem_image_of_mem j (G.V_subset_U hwV)) + (by + rintro _ ⟨⟨z, hz, rfl⟩, ⟨y, hy, he⟩⟩ + rw [hLU z hz (hii he ▸ hy)] + rfl) + (by + rw [disjoint_left] + rintro t (ht | ⟨z, hz, rfl⟩) htb + · exact disjoint_left.mp hoff ht htb + · exact hLoff z hz htb) + have hvert₁ : ∀ y ∈ G.U, j y ∈ discBd Δ₁ → y = w ∨ y ∈ G.V ∩ j ⁻¹' discBd Δ' := fun y hy hb + => by + rcases h5 ⟨hb, mem_image_of_mem j hy⟩ with ⟨h7, -⟩ | h7 + · exact .inr ⟨hn ⟨h7, hy⟩, h7⟩ + · exact .inl (hii h7) + have hn₁ : G.IsNormal (j ⁻¹' discBd Δ₁) := fun y hy => by + rcases hvert₁ y hy.2 hy.1 with rfl | h + · exact hwV + · exact h.1 + have hwA : w ∉ G.V ∩ j ⁻¹' discBd Δ' := fun h => hwΔ (Surface.discBd_subset Δ' h.2) + have hset : G.V ∩ j ⁻¹' discBd Δ₁ = insert w (G.V ∩ j ⁻¹' discBd Δ') := by + ext y + constructor + · rintro ⟨hyV, hy⟩ + exact hvert₁ y (G.V_subset_U hyV) hy + · rintro (rfl | ⟨hyV, hy⟩) + · exact ⟨hwV, h3⟩ + · exact ⟨hyV, h4 ⟨hy, mem_image_of_mem j (G.V_subset_U hyV)⟩⟩ + have hcard : (G.V ∩ j ⁻¹' discBd Δ₁).ncard = (G.V ∩ j ⁻¹' discBd Δ').ncard + 1 := by + rw [hset, ncard_insert_of_notMem hwA hVf] + have hgain : cuffCount G j Δ' < cuffCount G j Δ₁ := cuffCount_lt G j h2 + (.inl ⟨w, hwV, Surface.discBd_subset Δ₁ h3, hwΔ⟩) + have hone : (G.V ∩ j ⁻¹' discBd Δ').ncard = 1 := by + by_contra hne1 + have h0 : (G.V ∩ j ⁻¹' discBd Δ').ncard = 0 := by omega + have hle := hmax Δ₁ ⟨h1, hDΔ'.trans h2, hn₁, by omega⟩ + omega + refine ⟨Δ₁, ⟨h1, hDΔ'.trans h2, hn₁, by omega⟩, by omega, h6, fun F hFn hFO hFs hFoff => ?_⟩ + exact two_le_of_surrounds hS hc h1 (hDΔ'.trans h2) h2 hmax hwV (Surface.discBd_subset Δ₁ h3) + hwΔ hFn hFO hFs hFoff + · -- no vertex outside: the region and its loops give a contradiction + exfalso + push Not at hcase + have hcl : ∀ e ∈ {e ∈ G.E | (e ∩ closure r).Nonempty ∧ Disjoint (j '' e) Δ'}, ∃ (a : S) + (B : Set T), IsClosedDisc B ∧ discBd B = j '' closure e ∧ closure e = e ∪ {a} + ∧ j a ∈ discBd Δ' ∧ a ∈ G.V ∧ ∀ x ∈ discBd B, IsInteriorPoint x := by + intro e he + obtain ⟨a, haV, haΔ, hcle, B, hB, hbd⟩ := outer_edge_loop hS hc hG hΔ' hcount hr hE₀ hrE + hcase he.1 he.2.1 he.2.2 + refine ⟨a, B, hB, hbd, hcle, haΔ, haV, fun x hx => ?_⟩ + by_contra hnot + obtain ⟨y, hy, rfl⟩ := hbd ▸ hx + have hb : j y ∈ bd T := hnot + rw [hcle] at hy + rcases hy with hy | hy + · have hyU := he.1.2.1 hy + exact hyU.2 (hG ⟨(hbdS hb).1, hyU.1⟩) + · rw [hy] at hb + exact disjoint_left.mp hoff (Surface.discBd_subset Δ' haΔ) hb + have : Nonempty S := ⟨p⟩ + choose! a' B hB hbd hcle haΔ haV hbi using hcl + by_cases hin : ∃ e ∈ {e ∈ G.E | (e ∩ closure r).Nonempty ∧ Disjoint (j '' e) Δ'}, D ⊆ B e + · obtain ⟨e, he, hDB⟩ := hin + obtain ⟨Δ₂, h1, h2⟩ := outer_loop_beats hc hΔ' hDΔ' he.1 he.2.2 (haV e he) (haΔ e he) + (hcle e he) (hB e he) (hbd e he) hDB (hbi e he) hcj + have := hmax Δ₂ h1 + omega + · push Not at hin + have hfill := outer_fills hS hc hG hΔ' hDΔ' hn hint hr hpr hpΔ hcase hcj (B := B) (a + := a') fun e he => ⟨hB e he, hbd e he, hcle e he, haΔ e he, hin e he, hbi e he⟩ + obtain ⟨y, hy⟩ := (isConnected_of_isOArc ((cuff_statement.{u} S hS).2.2 C₁ hC₁)).nonempty + have hyb : y ∈ bd S := connectedComponentIn_subset_of_cuff hC₁ hy + have hyC : y ∉ C := fun h => disjoint_left.mp (cuffs_disjoint hC₁ hC hne) hy h + have hjb : j y ∈ bd T := hbT ▸ mem_image_of_mem j ⟨hyb, hyC⟩ + rcases hfill (fun h => disjoint_left.mp hoff h hjb) with ⟨z, hz, he'⟩ | h + · exact hroff z hz (he' ▸ hjb) + · obtain ⟨e, he, hxB⟩ := mem_iUnion₂.mp h + by_cases hb : j y ∈ discBd (B e) + · exact hjb (hbi e he _ hb) + · exact hjb (isInteriorPoint_of_mem_discInt hman (hB e he) ⟨hxB, hb⟩) + +end Cap + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffArcWalk.lean b/LeanPool/GraphMinor/GM07/CuffArcWalk.lean new file mode 100644 index 0000000000..a82fc8a3a0 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffArcWalk.lean @@ -0,0 +1,601 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffArc +public import LeanPool.GraphMinor.GM07.SideDisc +public import LeanPool.GraphMinor.GM12.Section3OneDiscComplement +public import LeanPool.GraphMinor.GM11.PerimeterPull + +/-! +# The path of `G` from `C` to `A`, in (6.1) + +Graph Minors VII, (6.1), page 238: "if $V(G) \cap C \ne \emptyset$ there is a path of $G$ between +$C$ and $a_1$ not using $a_2$. (If $V(G) \cap C \ne \emptyset$ there is such a path, because $G$ is +boundary-linked.)" + +We fill in the reason. Suppose the vertices that a walk from the vertex of `C` can reach strictly +inside `A` have no neighbour on `A`. Then we chart a neighbourhood of the disc into the sphere, and +grow a disc from the pasted disc over these vertices with +`exists_disc_of_side`. Its boundary is an `O`-arc that surrounds `C` and misses `G`, against +boundary-linkage. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +/-- Carry a drawing by a map that is an embedding on a compact set holding it. -/ +theorem exists_transport {S R : Type*} [TopologicalSpace S] [TopologicalSpace R] [T2Space S] + [T2Space R] {K : Set S} (hK : IsCompact K) (hne : K.Nonempty) {κ : S → R} (hc : ContinuousOn κ K) + (hi : InjOn κ K) (G : Drawing S) (hU : G.U ⊆ K) : + ∃ Γ : Drawing R, Γ.U = κ '' G.U ∧ Γ.V = κ '' G.V ∧ Γ.E = image κ '' G.E := by + classical + have : CompactSpace K := isCompact_iff_compactSpace.mp hK + have : Nonempty K := hne.to_subtype + have hv : IsClosedEmbedding ((↑) : K → S) := hK.isClosed.isClosedEmbedding_subtypeVal + obtain ⟨P, hPU, hPV, hm⟩ := exists_pull_drawing hv G (by rwa [Subtype.range_coe]) + have hlc : Continuous (K.domRestrict κ) := hc.domRestrict + have hli : Injective (K.domRestrict κ) := fun a b h => Subtype.ext (hi a.2 b.2 h) + obtain ⟨Γ, hΓ⟩ := exists_image_matched (hlc.isClosedEmbedding hli) P + have hsub : ∀ {A : Set S}, A ⊆ K → K.domRestrict κ '' ((↑) ⁻¹' A) = κ '' A := fun {A} hA => by + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + exact ⟨y.1, hy, rfl⟩ + · rintro ⟨y, hy, rfl⟩ + exact ⟨⟨y, hA hy⟩, hy, rfl⟩ + refine ⟨Γ, ?_, ?_, ?_⟩ + · rw [← hΓ.image_U, sdiff_empty, hPU, hsub hU] + · rw [← hΓ.image_V, sdiff_empty, hPV, hsub (G.V_subset_U.trans hU)] + · rw [hΓ.image_E, hm.image_E] + ext f + constructor + · rintro ⟨e, he, rfl⟩ + exact ⟨(↑) '' e, ⟨e, he, rfl⟩, by rw [image_image]; rfl⟩ + · rintro ⟨_, ⟨e, he, rfl⟩, rfl⟩ + exact ⟨e, he, by rw [image_image]; rfl⟩ + +/-- A chart of the plane into a sphere. -/ +theorem exists_sphere_chart : ∃ (R : Type) (_ : TopologicalSpace R) (ι : ℂ → R), T2Space R + ∧ IsClosedSurface R ∧ IsSphere R ∧ Continuous ι ∧ Injective ι := by + have hT2 : T2Space (OnePoint EuclideanPlane) := inferInstance + have hTs : IsClosedSurface (OnePoint EuclideanPlane) := (GM11.IsSphere.isClosedSurface + ⟨Homeomorph.refl _⟩).1 + refine ⟨OnePoint EuclideanPlane, inferInstance, fun z => ((Complex.orthonormalBasisOneI.repr z : + EuclideanPlane) : OnePoint EuclideanPlane), hT2, hTs, ⟨Homeomorph.refl _⟩, ?_, ?_⟩ + · exact OnePoint.continuous_coe.comp Complex.orthonormalBasisOneI.repr.continuous + · exact fun a b h => Complex.orthonormalBasisOneI.repr.injective (OnePoint.coe_injective h) + +section Cap + +variable {S : Type u} [TopologicalSpace S] {T : Type u} [TopologicalSpace T] {C : Set S} {j : S + → T} {D : Set T} + +/-- An edge with an end strictly inside a disc, whose boundary it misses, lies strictly inside. -/ +theorem edge_inside [T2Space T] (hman : ∀ x : T, IsManifoldPoint x) {G : Drawing S} + (hj : Continuous j) {Δ : Set T} (hΔ : IsClosedDisc Δ) (hn : G.IsNormal + (j ⁻¹' discBd Δ)) {e : Set S} (he : e ∈ G.E) {x : S} (hx : x ∈ closure e) + (hxi : j x ∈ discInt Δ) : j '' e ⊆ discInt Δ := by + have hpc : IsPreconnected (j '' e) := he.2.2.1.isConnected.isPreconnected.image _ hj.continuousOn + have hdb : Disjoint (j '' e) (discBd Δ) := by + rw [disjoint_left] + rintro _ ⟨z, hz, rfl⟩ hzb + have hzU := he.2.1 hz + exact hzU.2 (hn ⟨hzb, hzU.1⟩) + rcases inside_or_off hpc hΔ.isClosed (hdb.mono_right (frontier_disc_subset hman hΔ)) with h | h + · exact fun z hz => ⟨interior_subset (h hz), disjoint_left.mp hdb hz⟩ + · exfalso + have h1 : j x ∈ closure (j '' e) := image_closure_subset_closure_image hj + (mem_image_of_mem j hx) + obtain ⟨z, hz1, hz2⟩ := mem_closure_iff.mp h1 _ (hΔ.isOpen_discInt hman) hxi + exact h hz2 hz1.1 + +private theorem spanned_vertices_inside_disc + {S : Type u} + [TopologicalSpace S] + [T1Space S] + {T : Type u} + [TopologicalSpace T] + {j : S → T} + (hcj : IsClosedEmbedding j) + {G : Drawing S} + {Δ : Set T} + (hΔ : IsClosedDisc Δ) + [T2Space T] : + let Gi : Drawing S := G.span (j ⁻¹' Δ) {e | j '' e ⊆ Δ} + Gi.V ⊆ G.V ∩ j ⁻¹' Δ := by + intro Gi + rintro x (hx | hx) + · exact ⟨hx.2, hx.1⟩ + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + refine ⟨hxe.2, ?_⟩ + have h1 : closure e ⊆ j ⁻¹' Δ := closure_minimal (fun z hz => he.1 (mem_image_of_mem j hz)) + (hΔ.isClosed.preimage hcj.continuous) + exact h1 hxe.1 + +private theorem spanned_drawing_inside_disc + {S : Type u} + [TopologicalSpace S] + [T1Space S] + {T : Type u} + [TopologicalSpace T] + {j : S → T} + (hcj : IsClosedEmbedding j) + {G : Drawing S} + {Δ : Set T} + (hΔ : IsClosedDisc Δ) + [T2Space T] : + let Gi : Drawing S := G.span (j ⁻¹' Δ) {e | j '' e ⊆ Δ} + (Gi.V ⊆ G.V ∩ j ⁻¹' Δ) → + Gi.U ⊆ j ⁻¹' Δ := by + intro Gi hGiV + rintro x (hx | hx) + · exact (hGiV hx).2 + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + have h1 : closure e ⊆ j ⁻¹' Δ := closure_minimal (fun z hz => he.1 (mem_image_of_mem j hz)) + (hΔ.isClosed.preimage hcj.continuous) + exact h1 hxe + +private theorem chart_image_edge_closure + {S : Type u} + [TopologicalSpace S] + {T : Type u} + {j : S → T} + [CompactSpace S] + (E : Set T) + (R : Type) + [TopologicalSpace R] + [T2Space R] + (τ : T → R) + (Gi : Drawing S) + (hκc : ContinuousOn (τ ∘ j) (j ⁻¹' E)) + (hGiK : Gi.U ⊆ j ⁻¹' E) : + let κ : S → R := τ ∘ j + ∀ (e : Set S), + (e ∈ Gi.E) → + closure (κ '' e) = κ '' closure e := by + intro κ e he + have hcl : closure e ⊆ j ⁻¹' E := (Gi.closure_subset_U he).trans hGiK + apply subset_antisymm + · exact closure_minimal (image_mono subset_closure) + ((isClosed_closure.isCompact.image_of_continuousOn (hκc.mono hcl)).isClosed) + · exact (hκc.mono hcl).image_closure + +private theorem transport_cuff_reachability_to_chart + {S : Type u} + [TopologicalSpace S] + {T : Type u} + [TopologicalSpace T] + {C : Set S} + {j : S → T} + {D : Set T} + (hc : IsCappedCuff C T j D) + (hcj : IsClosedEmbedding j) + {G : Drawing S} + {Δ : Set T} + (hΔ : IsClosedDisc Δ) + (hn : G.IsNormal (j ⁻¹' discBd Δ)) + {K : Set S} + (hKi : ∀ u ∈ K, j u ∈ discInt Δ) + {ρ : S → ℕ} + (hreach : ∀ u ∈ K, u ∉ C → ∃ e ∈ G.E, ∃ w ∈ K, w ≠ u ∧ u ∈ closure e ∧ w ∈ closure e ∧ ρ w < ρ + u) + [T2Space T] + (hman : ∀ (x : T), IsManifoldPoint x) + (E : Set T) + (R : Type) + [TopologicalSpace R] + (τ : T → R) + (Gi : Drawing S) + (hGiE : Gi.E = {e | j '' e ⊆ Δ} ∩ G.E) + (hEs : j ⁻¹' Δ ⊆ j ⁻¹' E) + (hκi : InjOn (τ ∘ j) (j ⁻¹' E)) + (Γ : Drawing R) + (hΓE : Γ.E = image (τ ∘ j) '' Gi.E) : + let κ : S → R := τ ∘ j + (∀ e ∈ Gi.E, closure (κ '' e) = κ '' closure e) → + (discBd (τ '' D) = τ '' discBd D) → + ∀ (ρR : R → ℕ), + (∀ {x : S}, x ∈ j ⁻¹' E → ρR (κ x) = ρ x) → + ∀ u ∈ κ '' K, u ∉ discBd (τ '' D) → ∃ e ∈ Γ.E, ∃ w ∈ κ '' K, w ≠ u ∧ u ∈ closure e ∧ w ∈ + closure e ∧ (w ∉ discBd (τ '' D) → ρR w < ρR u) := by + intro κ hclos hB₀b ρR hρR + rintro _ ⟨u', hu', rfl⟩ hnb + have huE := hEs (hKi u' hu').1 + have huC : u' ∉ C := fun h => hnb (by + rw [hB₀b] + refine ⟨j u', ?_, rfl⟩ + rw [hc.discBd_eq] + exact mem_image_of_mem j h) + obtain ⟨e, he, w, hw, hne', h1, h2, h3⟩ := hreach u' hu' huC + have hei : e ∈ Gi.E := by + rw [hGiE] + exact ⟨(edge_inside hman hcj.continuous hΔ hn he h1 (hKi u' hu')).trans sdiff_subset, he⟩ + have hwE := hEs (hKi w hw).1 + refine ⟨κ '' e, by rw [hΓE]; exact ⟨e, hei, rfl⟩, κ w, ⟨w, hw, rfl⟩, + fun h => hne' (hκi hwE huE h), ?_, ?_, fun _ => ?_⟩ + · rw [hclos e hei] + exact mem_image_of_mem κ h1 + · rw [hclos e hei] + exact mem_image_of_mem κ h2 + · rw [hρR hwE, hρR huE] + exact h3 + +/-- **An `O`-arc off `G` around the cuff.** Let `K` be a set of vertices strictly inside `Δ`, with +all vertices of `C`, closed under neighbours, and such that each vertex of `K` off `C` has a +neighbour in `K` that is closer to `C`, as `ρ` measures. +Then a disc around `D` has a boundary that misses `G`. -/ +theorem exists_free_disc [T2Space S] [CompactSpace S] [Nonempty S] (hc : IsCappedCuff C T j D) + (hcj : IsClosedEmbedding j) {G : Drawing S} (hG : G.IsProper) (hCsub : C ⊆ bd S) {Δ : Set T} + (hΔ : IsClosedDisc Δ) (hDΔ : D ⊆ Δ) (hn : G.IsNormal (j ⁻¹' discBd Δ)) + (hint : ∀ x ∈ discBd Δ, IsInteriorPoint x) + {K : Set S} (hKV : K ⊆ G.V) (hKi : ∀ u ∈ K, j u ∈ discInt Δ) (hCK : G.V ∩ C ⊆ K) + (hedge : ∀ e ∈ G.E, ∀ u ∈ K, u ∈ closure e → ∀ w ∈ G.V, w ∈ closure e → w ∈ K) {ρ : S → ℕ} + (hreach : ∀ u ∈ K, u ∉ C → ∃ e ∈ G.E, ∃ w ∈ K, w ≠ u ∧ u ∈ closure e ∧ w ∈ closure e + ∧ ρ w < ρ u) : ∃ B, IsClosedDisc B ∧ D ⊆ B ∧ Disjoint (discBd B) (j '' G.U) := by + classical + have hT := hc.isSurface + have : T2Space T := hT.2.1 + have : CompactSpace T := hT.1 + have hman := hT.2.2 + have hii := hcj.injective + -- a slightly larger disc that touches `Δ` only on `G` + have hZc : IsClosed (j '' G.U) := hcj.isClosedMap _ G.isClosed_U + obtain ⟨E, hE, hΔE, -⟩ := exists_disc_around hman hΔ hint isOpen_univ (subset_univ _) + obtain ⟨Δp, hΔp, hsp, hpE, hoffZ, hb1, hb2, hb3⟩ := exists_disc_push_off hΔ hE hΔE hZc + have hDp : D ⊆ Δp := hDΔ.trans hsp + obtain ⟨p⟩ := hΔp.isOArc_discBd + obtain ⟨c, c', hcc, hcc', hm, hm', hl, hr, hcE, hcb, -⟩ := exists_disc_collar hΔp hE hpE p + obtain ⟨R, tR, ι, hR2, hRc, hRs, hιc, hιi⟩ := exists_sphere_chart + let τ : T → R := ι ∘ c' + have hτc : ContinuousOn τ E := hιc.comp_continuousOn hcc' + have hτi : InjOn τ E := fun x hx y hy h => by + have h1 : c' x = c' y := hιi h + rw [← hr hx, ← hr hy, h1] + -- the part of `G` in `Δ` + let Gi : Drawing S := G.span (j ⁻¹' Δ) {e | j '' e ⊆ Δ} + have hGiE : Gi.E = {e | j '' e ⊆ Δ} ∩ G.E := G.span_E _ _ + have hGiV : Gi.V ⊆ G.V ∩ j ⁻¹' Δ := by + exact spanned_vertices_inside_disc (S := S) (T := T) (j := j) hcj (G := G) (Δ := Δ) hΔ + have hGiU : Gi.U ⊆ j ⁻¹' Δ := by + exact spanned_drawing_inside_disc (S := S) (T := T) (j := j) hcj (G := G) (Δ := Δ) hΔ hGiV + have hEs : j ⁻¹' Δ ⊆ j ⁻¹' E := preimage_mono fun x hx => (hΔE hx).1 + have hmap : ∀ {x : S}, x ∈ j ⁻¹' E → j x ∈ E := fun h => h + have hKc : IsCompact (j ⁻¹' E) := (hE.isClosed.preimage hcj.continuous).isCompact + have hκc : ContinuousOn (τ ∘ j) (j ⁻¹' E) := hτc.comp hcj.continuous.continuousOn fun x hx => hx + have hκi : InjOn (τ ∘ j) (j ⁻¹' E) := fun x hx y hy h => hii (hτi hx hy h) + have hne : (j ⁻¹' E).Nonempty := by + obtain ⟨z, hz⟩ := (isConnected_of_isOArc hc.isClosedDisc.isOArc_discBd).nonempty + have hz' := hz + rw [hc.discBd_eq] at hz' + obtain ⟨y, -, rfl⟩ := hz' + exact ⟨y, (hΔE (hDΔ (Surface.discBd_subset D hz))).1⟩ + have hGiK : Gi.U ⊆ j ⁻¹' E := hGiU.trans hEs + obtain ⟨Γ, hΓU, hΓV, hΓE⟩ := exists_transport hKc hne hκc hκi Gi hGiK + let κ : S → R := τ ∘ j + -- closures of carried edges + have hclos : ∀ e ∈ Gi.E, closure (κ '' e) = κ '' closure e := fun e he => by + exact chart_image_edge_closure (S := S) (T := T) (j := j) E R τ Gi hκc hGiK e he + have hGiUU : Gi.U ⊆ G.U := by + rintro x (hx | hx) + · exact G.V_subset_U (hGiV hx).1 + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact G.closure_subset_U he.2 hxe + have hinV : ∀ y ∈ G.V, j y ∈ Δ → y ∈ Gi.V := fun y hy h => .inl ⟨h, hy⟩ + have hDE : D ⊆ E := fun x hx => (hΔE (hDΔ hx)).1 + have hpE' : Δp ⊆ E := fun x hx => (hpE hx).1 + obtain ⟨hB₀, hB₀b⟩ := isClosedDisc_image hc.isClosedDisc (hτc.mono hDE) (hτi.mono hDE) + obtain ⟨hΛ, hΛb⟩ := isClosedDisc_image hΔp (hτc.mono hpE') (hτi.mono hpE') + obtain ⟨hE₀, hE₀b⟩ := GM12.isClosedDisc_closure_compl_of_sphere hRc hRs hΛ + have hRman : ∀ x : R, IsManifoldPoint x := fun x => (hRc.2.2 x).isManifoldPoint + have hE₀cl : ∀ {z}, z ∈ Δp → τ z ∈ closure (univ \ τ '' Δp) → z ∈ discBd Δp := fun {z} hz h => by + by_contra hnb + have hi : τ z ∈ discInt (τ '' Δp) := ⟨mem_image_of_mem τ hz, fun hb => by + rw [hΛb] at hb + obtain ⟨w, hw, he⟩ := hb + exact hnb (hτi (hpE' hz) (hpE' (Surface.discBd_subset Δp hw)) he.symm ▸ hw)⟩ + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp h _ (hΛ.isOpen_discInt hRman) hi + exact hw2.2 hw1.1 + have hGiEs : ∀ {e}, e ∈ Gi.E → e ∈ G.E := fun {e} he => by + rw [hGiE] at he + exact he.2 + have hzC : ∀ {z : T} {y : S}, z ∈ discBd D → z = j y → y ∈ C := fun {z y} hz h => by + rw [hc.discBd_eq] at hz + obtain ⟨w, hw, he⟩ := hz + rw [← hii (he.trans h)] + exact hw + have hBb : ∀ {y : S}, j y ∈ E → κ y ∈ discBd (τ '' D) → y ∈ C := fun {y} hy h => by + rw [hB₀b] at h + obtain ⟨z, hz, he⟩ := h + exact hzC hz (hτi (hDE (Surface.discBd_subset D hz)) hy he) + have hd : Disjoint (τ '' D) (closure (univ \ τ '' Δp)) := by + rw [disjoint_left] + rintro _ ⟨z, hz, rfl⟩ h + have h1 := hE₀cl (hDp hz) h + have h2 := hb1 ⟨h1, hDΔ hz⟩ + have h3 := hb3 ⟨h1, h2⟩ + obtain ⟨y, hy, rfl⟩ := h2 + have h4 : j y ∈ range j ∩ D := ⟨mem_range_self y, hz⟩ + rw [hc.inter_eq] at h4 + obtain ⟨w, hw, he⟩ := h4 + have hyC : y ∈ C := hii he ▸ hw + exact (hKi y (hCK ⟨hG ⟨hCsub hyC, hy⟩, hyC⟩)).2 h3 + have hbd' : Γ.U ∩ discBd (τ '' D) ⊆ Γ.V := by + rintro _ ⟨hx, hb⟩ + rw [hΓU] at hx + obtain ⟨y, hy, rfl⟩ := hx + have hyC := hBb (hGiK hy) hb + rw [hΓV] + exact ⟨y, hinV y (hG ⟨hCsub hyC, hGiUU hy⟩) (hGiU hy), rfl⟩ + have hint' : Disjoint Γ.U (discInt (τ '' D)) := by + rw [disjoint_left] + intro x hx hi + rw [hΓU] at hx + obtain ⟨y, hy, rfl⟩ := hx + obtain ⟨⟨z, hz, he⟩, hnb⟩ := hi + have hzy : z = j y := hτi (hDE hz) (hGiK hy) he + refine not_mem_discInt_cap hc y ⟨hzy ▸ hz, fun hb => hnb ?_⟩ + rw [hB₀b] + exact ⟨j y, hb, rfl⟩ + have hΛm : ∀ y ∈ Gi.U, κ y ∈ τ '' Δp := fun y hy => mem_image_of_mem τ (hsp (hGiU hy)) + have hEU : Γ.U ∩ closure (univ \ τ '' Δp) ⊆ Γ.V := by + rintro _ ⟨hx, hb⟩ + rw [hΓU] at hx + obtain ⟨y, hy, rfl⟩ := hx + have h1 := hE₀cl (hsp (hGiU hy)) hb + have h2 := hb3 ⟨h1, mem_image_of_mem j (hGiUU hy)⟩ + rw [hΓV] + exact ⟨y, hinV y (hn ⟨h2, hGiUU hy⟩) (hGiU hy), rfl⟩ + have hEint : Disjoint Γ.U (discInt (closure (univ \ τ '' Δp))) := by + rw [disjoint_left] + intro x hx hi + rw [hΓU] at hx + obtain ⟨y, hy, rfl⟩ := hx + have h1 := hE₀cl (hsp (hGiU hy)) hi.1 + refine hi.2 ?_ + rw [hE₀b, hΛb] + exact mem_image_of_mem τ h1 + have hKV' : κ '' K ⊆ Γ.V := by + rw [hΓV] + exact image_mono fun u hu => hinV u (hKV hu) (hKi u hu).1 + have hcuff : Γ.V ∩ discBd (τ '' D) ⊆ κ '' K ∪ ∅ := by + rintro _ ⟨hx, hb⟩ + rw [hΓV] at hx + obtain ⟨y, hy, rfl⟩ := hx + have hyC := hBb (hGiK (Gi.V_subset_U hy)) hb + exact .inl ⟨y, hCK ⟨(hGiV hy).1, hyC⟩, rfl⟩ + have hKE : Disjoint (κ '' K) (closure (univ \ τ '' Δp)) := by + rw [disjoint_left] + rintro _ ⟨u, hu, rfl⟩ h + have h1 := hE₀cl (hsp (hKi u hu).1) h + have h2 := hb1 ⟨h1, (hKi u hu).1⟩ + exact (hKi u hu).2 (hb3 ⟨h1, h2⟩) + have hmemcl : ∀ {e a}, e ∈ Gi.E → a ∈ j ⁻¹' E → κ a ∈ closure (κ '' e) → a ∈ closure e + := fun {e a} he ha h => by + rw [hclos e he] at h + obtain ⟨b, hb, hab⟩ := h + exact hκi ((hGiK (Gi.closure_subset_U he hb))) ha hab ▸ hb + have hedge' : ∀ e ∈ Γ.E, ∀ u ∈ κ '' K, u ∈ closure e → ∀ w ∈ Γ.V, w ∈ closure e → w ∈ κ '' K ∪ ∅ + := by + intro e he u hu huc w hw hwc + rw [hΓE] at he + obtain ⟨e', he', rfl⟩ := he + obtain ⟨u', hu', rfl⟩ := hu + rw [hΓV] at hw + obtain ⟨w', hw', rfl⟩ := hw + have h1 := hmemcl he' (hEs (hKi u' hu').1) huc + have h2 := hmemcl he' (hGiK (Gi.V_subset_U hw')) hwc + exact .inl ⟨w', hedge e' (hGiEs he') u' hu' h1 w' (hGiV hw').1 h2, rfl⟩ + let ρR : R → ℕ := fun x => ρ (invFunOn κ (j ⁻¹' E) x) + have hρR : ∀ {x}, x ∈ j ⁻¹' E → ρR (κ x) = ρ x := fun {x} hx => by + change ρ (invFunOn κ (j ⁻¹' E) (κ x)) = ρ x + rw [hκi.leftInvOn_invFunOn hx] + have hreach' : ∀ u ∈ κ '' K, u ∉ discBd (τ '' D) → ∃ e ∈ Γ.E, ∃ w ∈ κ '' K, w ≠ u ∧ u ∈ closure e + ∧ w ∈ closure e ∧ (w ∉ discBd (τ '' D) → ρR w < ρR u) := by + exact transport_cuff_reachability_to_chart (S := S) (T := T) (C := C) (j := j) (D := D) hc hcj + (G := G) (Δ := Δ) hΔ hn (K := K) hKi (ρ := ρ) hreach hman E R τ Gi hGiE hEs hκi Γ hΓE + hclos hB₀b ρR hρR + obtain ⟨B, hB, hB₀B, hBE, hBU⟩ := exists_disc_of_side hRc hRs Γ (X := ∅) hB₀ hE₀ hd hbd' hint' + hEU hEint hKV' (empty_subset _) (empty_disjoint _) hcuff hKE hedge' hreach' + have hBΛ : B ⊆ τ '' Δp := fun x hx => by + by_contra hn' + refine disjoint_left.mp hBE ⟨subset_closure ⟨mem_univ x, hn'⟩, fun hb => hn' ?_⟩ hx + rw [hE₀b] at hb + exact Surface.discBd_subset _ hb + have : Nonempty T := ⟨j (Classical.arbitrary S)⟩ + obtain ⟨ρ', hρc, hρl⟩ := exists_inv_of_compactOn hE.isClosed.isCompact hτc hτi + have hρcB : ContinuousOn ρ' B := hρc.mono (hBΛ.trans (image_mono hpE')) + have hρiB : InjOn ρ' B := fun x hx y hy h => by + obtain ⟨a, ha, rfl⟩ := hBΛ hx + obtain ⟨b, hb, rfl⟩ := hBΛ hy + rw [hρl (hpE' ha), hρl (hpE' hb)] at h + rw [h] + obtain ⟨hB', hbB'⟩ := isClosedDisc_image hB hρcB hρiB + refine ⟨ρ' '' B, hB', fun z hz => ⟨τ z, hB₀B (mem_image_of_mem τ hz), hρl (hDE hz)⟩, ?_⟩ + rw [hbB', disjoint_left] + rintro _ ⟨x, hx, rfl⟩ ⟨y, hyU, he⟩ + obtain ⟨w, hw, rfl⟩ := hBΛ (Surface.discBd_subset B hx) + rw [hρl (hpE' hw)] at he + subst he + have hjΔ : j y ∈ Δ := by + by_contra hnΔ + exact disjoint_left.mp hoffZ ⟨hw, hnΔ⟩ (mem_image_of_mem j hyU) + have hyi : y ∈ Gi.U := by + by_cases hyV : y ∈ G.V + · exact Gi.V_subset_U (hinV y hyV hjΔ) + · obtain ⟨e, he, hye⟩ := G.exists_edge_of_mem hyU hyV + have hi : j y ∈ discInt Δ := ⟨hjΔ, fun hb => hyV (hn ⟨hb, hyU⟩)⟩ + have h1 := (edge_inside hman hcj.continuous hΔ hn he (subset_closure hye) hi).trans + sdiff_subset + exact .inr (mem_iUnion₂.mpr ⟨e, ⟨h1, he⟩, subset_closure hye⟩) + have h5 : τ (j y) ∈ Γ.U := by + rw [hΓU] + exact ⟨y, hyi, rfl⟩ + exact hBU ⟨hx, h5⟩ + +/-- Two distinct vertices on the closure of an edge are its ends. -/ +theorem isLink_of_mem_closure {G : Drawing S} {e : Set S} (he : e ∈ G.E) {u w : S} (hne : u ≠ w) + (hu : u ∈ closure e ∩ G.V) (hw : w ∈ closure e ∩ G.V) : G.toGraph.IsLink e u w := by + refine ⟨he, hu.2, hw.2, ?_⟩ + rcases G.edge_cond e he with ⟨p, q, -, hcap, -⟩ | ⟨p, hcap, -⟩ + · rw [hcap] at hu hw ⊢ + rcases hu with rfl | rfl <;> rcases hw with rfl | rfl + · exact absurd rfl hne + · rfl + · exact pair_comm _ _ + · exact absurd rfl hne + · rw [hcap] at hu hw + exact absurd (hu.trans hw.symm) hne + +theorem walk_edges_inside [T2Space T] (hman : ∀ x : T, IsManifoldPoint x) {G : Drawing S} + (hj : Continuous j) {Δ : Set T} (hΔ : IsClosedDisc Δ) (hn : G.IsNormal + (j ⁻¹' discBd Δ)) {x y : S} (W : GraphWalk G.toGraph x y) + (hs : ∀ v ∈ W.support, j v ∈ discInt Δ) : ∀ e ∈ W.edges, j '' e ⊆ discInt Δ := by + induction W with + | nil _ => simp [GraphWalk.edges] + | cons hl rest ih => + intro e he + rcases List.mem_cons.mp he with rfl | he + · refine edge_inside hman hj hΔ hn hl.1 ?_ (hs _ (List.mem_cons_self)) + have h1 : _ ∈ closure _ ∩ G.V := hl.2.2.2 ▸ mem_insert _ _ + exact h1.1 + · exact ih (fun v hv => hs v (List.mem_cons_of_mem _ hv)) e he + +/-- **The path of `G` from `C` to `A`.** If `C` has one vertex `c₀`, then a simple walk of `G` goes +from a vertex `a₁` of the boundary of `Δ` to `c₀`, strictly inside `Δ` after its start. -/ +theorem exists_walk_to_arc (hS : IsSurface S) [ConnectedSpace S] (hC : C ∈ cuffs S) + (hc : IsCappedCuff C T j D) (hns : ¬ IsSphere T) {G : Drawing S} (hbl : IsBoundaryLinked G) {Δ : + Set T} (hΔ : IsClosedDisc Δ) (hDΔ : D ⊆ Δ) (hn : G.IsNormal (j ⁻¹' discBd Δ)) + (hint : ∀ x ∈ discBd Δ, IsInteriorPoint x) {c₀ : S} (hone : G.V ∩ C = {c₀}) : + ∃ a₁ ∈ G.V, j a₁ ∈ discBd Δ ∧ ∃ W : GraphWalk G.toGraph a₁ c₀, W.IsSimple ∧ + (∀ v ∈ W.support, v ≠ a₁ → j v ∈ discInt Δ) ∧ ∀ e ∈ W.edges, j '' e ⊆ discInt Δ := by + classical + have hT := hc.isSurface + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have : T2Space T := hT.2.1 + have hman := hT.2.2 + have hcj : IsClosedEmbedding j := hc.isEmbedding.continuous.isClosedEmbedding + hc.isEmbedding.injective + have hG := hbl.1 + have hc₀ : c₀ ∈ G.V ∩ C := by + rw [hone] + exact rfl + have hc₀Δ : j c₀ ∈ Δ := hDΔ (Surface.discBd_subset D (by + rw [hc.discBd_eq] + exact mem_image_of_mem j hc₀.2)) + have hnil : c₀ ∈ G.toGraph.vertexSet := hc₀.1 + by_cases hc₀b : j c₀ ∈ discBd Δ + · exact ⟨c₀, hc₀.1, hc₀b, .nil hnil, by simp [GraphWalk.IsSimple, GraphWalk.support], + by simp [GraphWalk.support], by simp [GraphWalk.edges]⟩ + let Q : ∀ {u : S}, GraphWalk G.toGraph u c₀ → Prop := fun W => ∀ v ∈ W.support, j v ∈ discInt Δ + let K : Set S := {u | ∃ W : GraphWalk G.toGraph u c₀, Q W} + have hc₀K : c₀ ∈ K := ⟨.nil hnil, fun v hv => by + simp only [GraphWalk.support, List.mem_singleton] at hv + subst hv + exact ⟨hc₀Δ, hc₀b⟩⟩ + have hstart : ∀ {u : S} (W : GraphWalk G.toGraph u c₀), u ∈ W.support := fun W + => W.start_mem_support + by_cases hit : ∃ u ∈ K, ∃ a ∈ G.V, j a ∈ discBd Δ ∧ ∃ e, G.toGraph.IsLink e a u + · obtain ⟨u, ⟨W, hW⟩, a, haV, hab, e, hl⟩ := hit + obtain ⟨W', hs, hsup, hed⟩ := GM09.exists_isSimple_subwalk (GraphWalk.cons hl W) + have hin : ∀ v ∈ W'.support, v ≠ a → j v ∈ discInt Δ := fun v hv hne => by + rcases List.mem_cons.mp (hsup v hv) with rfl | h + · exact absurd rfl hne + · exact hW v h + refine ⟨a, haV, hab, W', hs, hin, ?_⟩ + clear hsup hed + revert hs hin + cases W' with + | nil _ => simp [GraphWalk.edges] + | @cons _ v₁ _ f hl' rest => + intro hs hin + have hrest : ∀ v ∈ rest.support, j v ∈ discInt Δ := fun v hv => hin v + (List.mem_cons_of_mem _ hv) (fun h => (List.nodup_cons.mp hs).1 (h ▸ hv)) + intro e' he' + rcases List.mem_cons.mp he' with h | he' + · rw [h] + refine edge_inside hman hcj.continuous hΔ hn hl'.1 ?_ (hrest _ rest.start_mem_support) + have h1 : v₁ ∈ closure f ∩ G.V := by + rw [hl'.2.2.2] + exact mem_insert_of_mem _ rfl + exact h1.1 + · exact walk_edges_inside hman hcj.continuous hΔ hn rest hrest e' he' + exfalso + push Not at hit + let ρ : S → ℕ := fun u => sInf {n | ∃ W : GraphWalk G.toGraph u c₀, Q W ∧ W.length = n} + have hρle : ∀ {u : S} (W : GraphWalk G.toGraph u c₀), Q W → ρ u ≤ W.length := fun W h + => Nat.sInf_le ⟨W, h, rfl⟩ + have hρex : ∀ u ∈ K, ∃ W : GraphWalk G.toGraph u c₀, Q W ∧ W.length = ρ u := fun u ⟨W, h⟩ + => Nat.sInf_mem (s := {n | ∃ W : GraphWalk G.toGraph u c₀, Q W ∧ W.length = n}) ⟨_, W, h, rfl⟩ + have hKV : K ⊆ G.V := fun u ⟨W, _⟩ => by + cases W with + | nil hv => exact hv + | cons hl _ => exact hl.2.1 + have hKi : ∀ u ∈ K, j u ∈ discInt Δ := fun u ⟨W, h⟩ => h u (hstart W) + have hCK : G.V ∩ C ⊆ K := by + rw [hone] + rintro _ rfl + exact hc₀K + have hedge : ∀ e ∈ G.E, ∀ u ∈ K, u ∈ closure e → ∀ w ∈ G.V, w ∈ closure e → w ∈ K := by + intro e he u hu huc w hw hwc + by_cases huw : u = w + · exact huw ▸ hu + have hl : G.toGraph.IsLink e w u := isLink_of_mem_closure he (Ne.symm huw) ⟨hwc, hw⟩ ⟨huc, hKV + hu⟩ + obtain ⟨W, hW⟩ := id hu + refine ⟨.cons hl W, fun v hv => ?_⟩ + rcases List.mem_cons.mp hv with rfl | hv + · have hin := edge_inside hman hcj.continuous hΔ hn he huc (hKi u hu) + have h1 : j v ∈ Δ := by + have h2 : closure e ⊆ j ⁻¹' Δ := closure_minimal (fun z hz => (hin + (mem_image_of_mem j hz)).1) (hΔ.isClosed.preimage hcj.continuous) + exact h2 hwc + exact ⟨h1, fun hb => hit u hu v hw hb e hl⟩ + · exact hW v hv + have hreach : ∀ u ∈ K, u ∉ C → ∃ e ∈ G.E, ∃ w ∈ K, w ≠ u ∧ u ∈ closure e ∧ w ∈ closure e + ∧ ρ w < ρ u := by + intro u hu huC + obtain ⟨W, hW, hlen⟩ := hρex u hu + have hne : u ≠ c₀ := fun h => huC (h ▸ hc₀.2) + cases W with + | nil _ => exact absurd rfl hne + | @cons _ v _ e hl rest => + have hrestQ : Q rest := fun v hv => hW v (List.mem_cons_of_mem _ hv) + have hlen' : rest.length + 1 = ρ u := by simpa [GraphWalk.length] using hlen + have h1 : ρ v ≤ rest.length := hρle rest hrestQ + have hmem : u ∈ closure e ∩ G.V ∧ v ∈ closure e ∩ G.V := by + have h2 := hl.2.2.2 + exact ⟨h2 ▸ mem_insert _ _, h2 ▸ mem_insert_of_mem _ rfl⟩ + refine ⟨e, hl.1, v, ⟨rest, hrestQ⟩, fun h => ?_, hmem.1.1, hmem.2.1, by omega⟩ + subst h + have := hρle rest hrestQ + omega + have : Nonempty S := ⟨c₀⟩ + obtain ⟨B, hB, hDB, hoff⟩ := exists_free_disc hc hcj hG (connectedComponentIn_subset_of_cuff hC) + hΔ hDΔ hn hint hKV hKi hCK hedge hreach + have hF := isOArc_preimage_bd hc hB hDB + have hnF : G.IsNormal (j ⁻¹' discBd B) := fun y hy => absurd (mem_image_of_mem j hy.2) + (disjoint_left.mp hoff hy.1) + have h1 := hbl.2 C hC _ hnF hF (surrounds_of_disc hS hC hc hns hB hDB) + have h2 : G.V ∩ j ⁻¹' discBd B = ∅ := by + rw [eq_empty_iff_forall_notMem] + intro y hy + exact disjoint_left.mp hoff hy.2 (mem_image_of_mem j (G.V_subset_U hy.1)) + rw [hone, h2] at h1 + simp at h1 + +end Cap + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffBoxBuild.lean b/LeanPool/GraphMinor/GM07/CuffBoxBuild.lean new file mode 100644 index 0000000000..d1b2a46e95 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffBoxBuild.lean @@ -0,0 +1,768 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffChart + +/-! +# The boxes around one cuff + +Graph Minors VII, (5.9), page 235. Each cell of the annulus between `D` and `E` gets a chart from +the square `[0,1] × [0,1]`. Above level `1` we follow the rays of a collar of `E`, up to level `2`. +Two neighbouring boxes agree on their common side. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {T : Type u} [TopologicalSpace T] [T2Space T] {ι : Type*} + +/-- The data of a box around a cuff. `S k` is the common side over the line `q k`. -/ +structure IsCuffBoxes (D E Δ : Set T) (q : ι → Set T) (x t : ι → T) (F : Set (CellRec T ι)) + (Φ : CellRec T ι → ℝ × ℝ → T) (S : ι → ℝ → T) (μ : CellRec T ι → ℝ → T) : Prop where + cont : ∀ c ∈ F, ContinuousOn (Φ c) cuffBox + inj : ∀ c ∈ F, InjOn (Φ c) cuffBox + mapsΔ : ∀ c ∈ F, MapsTo (Φ c) cuffBox Δ + sideInj : ∀ k, InjOn (S k) (Icc 0 2) + left : ∀ c ∈ F, ∀ w ∈ Icc (0 : ℝ) 2, Φ c (0, w) = S c.i w + right : ∀ c ∈ F, ∀ w ∈ Icc (0 : ℝ) 2, Φ c (1, w) = S c.i' w + top : ∀ c ∈ F, ∀ m ∈ Icc (0 : ℝ) 1, Φ c (m, 1) = μ c m + param : ∀ c ∈ F, IsParam c.b (t c.i) (t c.i') (μ c) + sideIn : ∀ k, ∀ w ∈ Icc (0 : ℝ) 1, S k w ∈ q k + sideOf : ∀ k, ∀ y ∈ q k, ∃ w ∈ Icc (0 : ℝ) 1, S k w = y + sideOne : ∀ k, S k 1 = t k + sideZero : ∀ k, S k 0 = x k + inE : ∀ c ∈ F, ∀ p ∈ cuffBox, Φ c p ∈ E ↔ p.2 ≤ 1 + inR : ∀ c ∈ F, ∀ p ∈ cuffBox, p.2 ≤ 1 → Φ c p ∈ c.R + onBd : ∀ c ∈ F, ∀ p ∈ cuffBox, Φ c p ∈ discBd E ↔ p.2 = 1 + inD : ∀ c ∈ F, ∀ p ∈ cuffBox, Φ c p ∈ D ↔ p.2 = 0 + bdΔ : ∀ c ∈ F, ∀ p ∈ cuffBox, Φ c p ∈ discBd Δ ↔ p.2 = 2 + cover : ∀ y ∈ Δ \ discInt D, ∃ c ∈ F, ∃ p ∈ cuffBox, Φ c p = y + meet : ∀ c ∈ F, ∀ c' ∈ F, ∀ p p', p ∈ cuffBox → p' ∈ cuffBox → Φ c p = Φ c' p' → (c = c' ∧ p + = p') ∨ (p.2 = p'.2 ∧ (p.1 = 0 ∨ p.1 = 1) ∧ (p'.1 = 0 ∨ p'.1 = 1) ∧ ∀ w ∈ Icc (0 : ℝ) 2, Φ c + (p.1, w) = Φ c' (p'.1, w)) + +variable {D E Δ : Set T} {q : ι → Set T} {x t : ι → T} + +/-- The point of level `w` over the point `y` of the boundary of `E`. -/ +noncomputable def rayPoint (col : ℂ → T) (pi : T → Circle) (w : ℝ) (y : T) : T := col ((w : ℂ) * + (pi y : ℂ)) + +/-- The map of a box. -/ +noncomputable def boxMap (ξ : ℂ → T) (col : ℂ → T) (pi : T → Circle) (m : ℝ → T) (p : ℝ × ℝ) : T := + if p.2 ≤ 1 then ξ ⟨p.1, p.2⟩ else rayPoint col pi p.2 (m p.1) + +/-- The side over a line. -/ +noncomputable def lineSide (col : ℂ → T) (pi : T → Circle) (r : ℝ → T) (y : T) (w : ℝ) : T := + if w ≤ 1 then r w else rayPoint col pi w y + +private theorem collar_ray_eq + {T : Type u} + (col : ℂ → T) + (hcinj : InjOn col (closedBall 0 2)) + (hmemb : ∀ {w : ℝ} (u : Circle), w ∈ Icc 0 2 → (w : ℂ) * (u : ℂ) ∈ closedBall 0 2) + (hnm : ∀ {w : ℝ} (u : Circle), 0 ≤ w → ‖(w : ℂ) * (u : ℂ)‖ = w) + {w : ℝ} + {w' : ℝ} + {u : Circle} + {u' : Circle} + (hw : w ∈ Icc 0 2) + (hw' : w' ∈ Icc 0 2) + (he : col (↑w * ↑u) = col (↑w' * ↑u')) : + w = w' ∧ (0 < w → u = u') := by + have h1 := hcinj (hmemb u hw) (hmemb u' hw') he + have h2 : w = w' := by + have := congrArg norm h1 + rwa [hnm u hw.1, hnm u' hw'.1] at this + refine ⟨h2, fun h0 => ?_⟩ + subst h2 + have h3 : (w : ℂ) ≠ 0 := by exact_mod_cast h0.ne' + exact Circle.ext (mul_left_cancel₀ h3 h1) + +private theorem cuff_box_injective + {T : Type u} + [TopologicalSpace T] + {ι : Type*} + {E : Set T} + {x : ι → T} + {t : ι → T} + (F : Set (CellRec T ι)) + (col : ℂ → T) + (pi : T → Circle) + (hpiinj : InjOn pi (discBd E)) + (hray : ∀ {w w' : ℝ} {u u' : Circle}, w ∈ Icc 0 2 → w' ∈ Icc 0 2 → col (↑w * ↑u) = col (↑w' * + ↑u') → w = w' ∧ (0 < w → u = u')) + (r : ι → ℝ → T) + (μ : CellRec T ι → ℝ → T) + (α : CellRec T ι → ℝ → T) + (hμα : ∀ c ∈ F, IsParam c.b (t c.i) (t c.i') (μ c) ∧ IsParam c.a (x c.i) (x c.i') (α c)) + (ξ : CellRec T ι → ℂ → T) + (hξ : ∀ c ∈ F, ContinuousOn (ξ c) unitSq ∧ InjOn (ξ c) unitSq ∧ ξ c '' unitSq = c.R ∧ ∀ z ∈ + frontier unitSq, ξ c z = cellBd (r c.i) (r c.i') (α c) (μ c) z) + (Φ : CellRec T ι → ℝ × ℝ → T) + (hsq : ∀ {p : ℝ × ℝ}, p ∈ cuffBox → p.2 ≤ 1 → { re := p.1, im := p.2 } ∈ unitSq) + (hΦlow : ∀ (c : CellRec T ι) {p : ℝ × ℝ}, p.2 ≤ 1 → Φ c p = ξ c { re := p.1, im := p.2 }) + (hΦhigh : ∀ (c : CellRec T ι) {p : ℝ × ℝ}, ¬p.2 ≤ 1 → Φ c p = rayPoint col pi p.2 (μ c p.1)) + (hR : ∀ c ∈ F, ∀ p ∈ cuffBox, p.2 ≤ 1 → Φ c p ∈ c.R) + (hRE : ∀ c ∈ F, c.R ⊆ E) + (hmemray : ∀ (w : ℝ) (y : T), rayPoint col pi w y = col (↑w * ↑(pi y))) + (hμE : ∀ c ∈ F, ∀ m ∈ Icc 0 1, μ c m ∈ discBd E) + (hinE : ∀ c ∈ F, ∀ p ∈ cuffBox, Φ c p ∈ E ↔ p.2 ≤ 1) + (c : CellRec T ι) + (hc : c ∈ F) + (p : ℝ × ℝ) + (hp : p ∈ cuffBox) + (p' : ℝ × ℝ) + (hp' : p' ∈ cuffBox) + (he : Φ c p = Φ c p') : + p = p' := by + by_cases h1 : p.2 ≤ 1 <;> by_cases h2 : p'.2 ≤ 1 + · rw [hΦlow c h1, hΦlow c h2] at he + have h3 := (hξ c hc).2.1 (hsq hp h1) (hsq hp' h2) he + exact Prod.ext (congrArg Complex.re h3) (congrArg Complex.im h3) + · exact absurd ((hinE c hc p' hp').mp (he ▸ hRE c hc (hR c hc p hp h1))) h2 + · exact absurd ((hinE c hc p hp).mp (he.symm ▸ hRE c hc (hR c hc p' hp' h2))) h1 + · rw [hΦhigh c h1, hΦhigh c h2, hmemray, hmemray] at he + obtain ⟨h3, h4⟩ := hray hp.2 hp'.2 he + have h5 := h4 (by linarith [not_le.mp h1]) + have h6 := (hμα c hc).1.inj hp.1 hp'.1 (hpiinj (hμE c hc _ hp.1) (hμE c hc _ hp'.1) h5) + exact Prod.ext h6 h3 + +private theorem cuff_side_injective + {T : Type u} + [TopologicalSpace T] + {ι : Type*} + {E : Set T} + {q : ι → Set T} + {x : ι → T} + {t : ι → T} + (col : ℂ → T) + (pi : T → Circle) + (hmemb : ∀ {w : ℝ} (u : Circle), w ∈ Icc 0 2 → (w : ℂ) * (u : ℂ) ∈ closedBall 0 2) + (hnm : ∀ {w : ℝ} (u : Circle), 0 ≤ w → ‖(w : ℂ) * (u : ℂ)‖ = w) + (hray : ∀ {w w' : ℝ} {u u' : Circle}, w ∈ Icc 0 2 → w' ∈ Icc 0 2 → col (↑w * ↑u) = col (↑w' * + ↑u') → w = w' ∧ (0 < w → u = u')) + (hE' : ∀ {z : ℂ}, z ∈ closedBall 0 2 → (col z ∈ E ↔ ‖z‖ ≤ 1)) + (r : ι → ℝ → T) + (hr : ∀ (k : ι), IsParam (q k) (x k) (t k) (r k)) + (S : ι → ℝ → T) + (hSlow : ∀ (k : ι) {w : ℝ}, w ≤ 1 → S k w = r k w) + (hShigh : ∀ (k : ι) {w : ℝ}, ¬w ≤ 1 → S k w = rayPoint col pi w (t k)) + (hmemray : ∀ (w : ℝ) (y : T), rayPoint col pi w y = col (↑w * ↑(pi y))) + (hrE : ∀ (k : ι), ∀ w ∈ Icc 0 1, r k w ∈ E) + (k : ι) + (w : ℝ) + (hw : w ∈ Icc 0 2) + (w' : ℝ) + (hw' : w' ∈ Icc 0 2) + (he : S k w = S k w') : + w = w' := by + have hoffS : ∀ w ∈ Icc (0 : ℝ) 2, ¬ w ≤ 1 → S k w ∉ E := fun w hw h1 => by + rw [hShigh k h1, hmemray, hE' (hmemb _ hw), hnm _ hw.1] + exact h1 + by_cases h1 : w ≤ 1 <;> by_cases h2 : w' ≤ 1 + · rw [hSlow k h1, hSlow k h2] at he + exact (hr k).inj ⟨hw.1, h1⟩ ⟨hw'.1, h2⟩ he + · have h3 := hrE k w ⟨hw.1, h1⟩ + rw [← hSlow k h1, he] at h3 + exact absurd h3 (hoffS w' hw' h2) + · have h3 := hrE k w' ⟨hw'.1, h2⟩ + rw [← hSlow k h2, ← he] at h3 + exact absurd h3 (hoffS w hw h1) + · rw [hShigh k h1, hShigh k h2, hmemray, hmemray] at he + exact (hray hw hw' he).1 + +private theorem cuff_box_continuous + {T : Type u} + [TopologicalSpace T] + {ι : Type*} + {E : Set T} + {x : ι → T} + {t : ι → T} + (F : Set (CellRec T ι)) + (col : ℂ → T) + (hcc : ContinuousOn col (closedBall 0 2)) + (pi : T → Circle) + (hpic : ContinuousOn pi (discBd E)) + (hcolp : ∀ y ∈ discBd E, col ↑(pi y) = y) + (hmemb : ∀ {w : ℝ} (u : Circle), w ∈ Icc 0 2 → (w : ℂ) * (u : ℂ) ∈ closedBall 0 2) + (r : ι → ℝ → T) + (μ : CellRec T ι → ℝ → T) + (α : CellRec T ι → ℝ → T) + (hμα : ∀ c ∈ F, IsParam c.b (t c.i) (t c.i') (μ c) ∧ IsParam c.a (x c.i) (x c.i') (α c)) + (ξ : CellRec T ι → ℂ → T) + (hξ : ∀ c ∈ F, ContinuousOn (ξ c) unitSq ∧ InjOn (ξ c) unitSq ∧ ξ c '' unitSq = c.R ∧ ∀ z ∈ + frontier unitSq, ξ c z = cellBd (r c.i) (r c.i') (α c) (μ c) z) + (Φ : CellRec T ι → ℝ × ℝ → T) + (hsq : ∀ {p : ℝ × ℝ}, p ∈ cuffBox → p.2 ≤ 1 → { re := p.1, im := p.2 } ∈ unitSq) + (hΦlow : ∀ (c : CellRec T ι) {p : ℝ × ℝ}, p.2 ≤ 1 → Φ c p = ξ c { re := p.1, im := p.2 }) + (hΦhigh : ∀ (c : CellRec T ι) {p : ℝ × ℝ}, ¬p.2 ≤ 1 → Φ c p = rayPoint col pi p.2 (μ c p.1)) + (htop : ∀ c ∈ F, ∀ m ∈ Icc 0 1, Φ c (m, 1) = μ c m) + (hμE : ∀ c ∈ F, ∀ m ∈ Icc 0 1, μ c m ∈ discBd E) + (c : CellRec T ι) + (hc : c ∈ F) : + ContinuousOn (Φ c) cuffBox := by + have hto : Continuous fun p : ℝ × ℝ => (⟨p.1, p.2⟩ : ℂ) := + Complex.equivRealProdCLM.symm.continuous + have hsplit : cuffBox = {p | p ∈ cuffBox ∧ p.2 ≤ 1} ∪ {p | p ∈ cuffBox ∧ 1 ≤ p.2} := by + ext p + simp only [mem_union, mem_ofPred_eq] + constructor + · intro h1 + rcases le_total p.2 1 with h2 | h2 + · exact .inl ⟨h1, h2⟩ + · exact .inr ⟨h1, h2⟩ + · rintro (h1 | h1) <;> exact h1.1 + have hcb : IsClosed cuffBox := isCompact_cuffBox.isClosed + have hlowMaps : MapsTo (fun p : ℝ × ℝ => (⟨p.1, p.2⟩ : ℂ)) + {p | p ∈ cuffBox ∧ p.2 ≤ 1} unitSq := fun _ hp => hsq hp.1 hp.2 + have h1 : ContinuousOn (Φ c) {p | p ∈ cuffBox ∧ p.2 ≤ 1} := + ((hξ c hc).1.comp hto.continuousOn hlowMaps).congr fun _ hp => hΦlow c hp.2 + have hμm : ∀ p : ℝ × ℝ, p ∈ {p | p ∈ cuffBox ∧ 1 ≤ p.2} → μ c p.1 ∈ discBd E := fun p hp + => hμE c hc _ hp.1.1 + have hfst : MapsTo Prod.fst {p : ℝ × ℝ | p ∈ cuffBox ∧ 1 ≤ p.2} (Icc 0 1) := + fun _ hp => hp.1.1 + have h3 : ContinuousOn (fun p : ℝ × ℝ => μ c p.1) {p | p ∈ cuffBox ∧ 1 ≤ p.2} := + (hμα c hc).1.cont.comp continuous_fst.continuousOn hfst + have h4 : ContinuousOn (fun p : ℝ × ℝ => ((pi (μ c p.1) : Circle) : ℂ)) {p | p ∈ cuffBox ∧ 1 + ≤ p.2} := continuous_subtype_val.comp_continuousOn (hpic.comp h3 hμm) + have h5 : ContinuousOn (fun p : ℝ × ℝ => ((p.2 : ℝ) : ℂ) * ((pi (μ c p.1) : Circle) : ℂ)) {p | + p ∈ cuffBox ∧ 1 ≤ p.2} := (Complex.continuous_ofReal.comp continuous_snd).continuousOn.mul h4 + have h2 : ContinuousOn (Φ c) {p | p ∈ cuffBox ∧ 1 ≤ p.2} := by + refine (hcc.comp h5 fun p hp => hmemb _ hp.1.2).congr fun p hp => ?_ + by_cases h6 : p.2 ≤ 1 + · have h7 : p.2 = 1 := le_antisymm h6 hp.2 + have h8 : p = (p.1, 1) := Prod.ext rfl h7 + rw [h8, htop c hc _ hp.1.1] + simp only [comp_apply, Complex.ofReal_one, one_mul] + exact (hcolp _ (hμE c hc _ hp.1.1)).symm + · rw [hΦhigh c h6] + rfl + rw [hsplit] + exact h1.union_of_isClosed h2 (hcb.inter (isClosed_le continuous_snd continuous_const)) + (hcb.inter (isClosed_le continuous_const continuous_snd)) + +private theorem cuff_boxes_overlap_on_sides + {T : Type u} + [TopologicalSpace T] + {ι : Type*} + {D : Set T} + {E : Set T} + {q : ι → Set T} + {x : ι → T} + {t : ι → T} + (hq : ∀ (k : ι), IsCrossLine D E (q k) (x k) (t k)) + (F : Set (CellRec T ι)) + (hF : IsCellFamily D E q x t univ F) + (col : ℂ → T) + (pi : T → Circle) + (hpiinj : InjOn pi (discBd E)) + (hray : ∀ {w w' : ℝ} {u u' : Circle}, w ∈ Icc 0 2 → w' ∈ Icc 0 2 → col (↑w * ↑u) = col (↑w' * + ↑u') → w = w' ∧ (0 < w → u = u')) + (μ : CellRec T ι → ℝ → T) + (Φ : CellRec T ι → ℝ × ℝ → T) + (S : ι → ℝ → T) + (hΦhigh : ∀ (c : CellRec T ι) {p : ℝ × ℝ}, ¬p.2 ≤ 1 → Φ c p = rayPoint col pi p.2 (μ c p.1)) + (hShigh : ∀ (k : ι) {w : ℝ}, ¬w ≤ 1 → S k w = rayPoint col pi w (t k)) + (htop : ∀ c ∈ F, ∀ m ∈ Icc 0 1, Φ c (m, 1) = μ c m) + (hR : ∀ c ∈ F, ∀ p ∈ cuffBox, p.2 ≤ 1 → Φ c p ∈ c.R) + (hRE : ∀ c ∈ F, c.R ⊆ E) + (hmemray : ∀ (w : ℝ) (y : T), rayPoint col pi w y = col (↑w * ↑(pi y))) + (hμE : ∀ c ∈ F, ∀ m ∈ Icc 0 1, μ c m ∈ discBd E) + (hinE : ∀ c ∈ F, ∀ p ∈ cuffBox, Φ c p ∈ E ↔ p.2 ≤ 1) + (hinj : ∀ c ∈ F, InjOn (Φ c) cuffBox) + (hsideE : ∀ c ∈ F, ∀ (k : ι), k = c.i ∨ k = c.i' → ∃ e, (e = 0 ∨ e = 1) ∧ ∀ w ∈ Icc 0 2, Φ c + (e, w) = S k w) + (hSof : ∀ (k : ι), ∀ y ∈ q k, ∃ w ∈ Icc 0 1, S k w = y) + (hboxe : ∀ {e w : ℝ}, e = 0 ∨ e = 1 → w ∈ Icc 0 2 → (e, w) ∈ cuffBox) + (c : CellRec T ι) + (hc : c ∈ F) + (c' : CellRec T ι) + (hc' : c' ∈ F) + (p : ℝ × ℝ) + (p' : ℝ × ℝ) + (hp : p ∈ cuffBox) + (hp' : p' ∈ cuffBox) + (he : Φ c p = Φ c' p') : + c = c' ∧ p = p' ∨ p.2 = p'.2 ∧ (p.1 = 0 ∨ p.1 = 1) ∧ (p'.1 = 0 ∨ p'.1 = 1) ∧ ∀ w ∈ Icc 0 2, Φ + c (p.1, w) = Φ c' (p'.1, w) := by + by_cases hne : c = c' + · subst hne + exact .inl ⟨rfl, hinj c hc hp hp' he⟩ + right + have hfin : ∀ {k : ι} {w₀ : ℝ}, (k = c.i ∨ k = c.i') → (k = c'.i ∨ k = c'.i') → w₀ ∈ Icc + (0 : ℝ) 2 → Φ c p = S k w₀ → Φ c' p' = S k w₀ → p.2 = p'.2 ∧ (p.1 = 0 ∨ p.1 = 1) ∧ (p'.1 = 0 + ∨ p'.1 = 1) ∧ ∀ w ∈ Icc (0 : ℝ) 2, Φ c (p.1, w) = Φ c' (p'.1, w) := fun {k w₀} h1 h2 hw h3 h4 + => by + obtain ⟨e, he0, heS⟩ := hsideE c hc k h1 + obtain ⟨e', he0', heS'⟩ := hsideE c' hc' k h2 + have h5 : p = (e, w₀) := hinj c hc hp (hboxe he0 hw) (h3.trans (heS w₀ hw).symm) + have h6 : p' = (e', w₀) := hinj c' hc' hp' (hboxe he0' hw) (h4.trans (heS' w₀ hw).symm) + subst h5 h6 + exact ⟨rfl, he0, he0', fun w hw' => (heS w hw').trans (heS' w hw').symm⟩ + by_cases h1 : p.2 ≤ 1 + · have h2 : p'.2 ≤ 1 := (hinE c' hc' p' hp').mp (he ▸ hRE c hc (hR c hc p hp h1)) + obtain ⟨k, hk, hk', hw⟩ := hF.meet c hc c' hc' hne _ (hR c hc p hp h1) + (he ▸ hR c' hc' p' hp' h2) + obtain ⟨w₀, hw₀, h3⟩ := hSof k _ hw + exact hfin hk hk' ⟨hw₀.1, by linarith [hw₀.2]⟩ h3.symm (he.symm.trans h3.symm) + · have h2 : ¬ p'.2 ≤ 1 := fun h2 => h1 ((hinE c hc p hp).mp (he.symm ▸ hRE c' hc' + (hR c' hc' p' hp' h2))) + have he' := he + rw [hΦhigh c h1, hΦhigh c' h2, hmemray, hmemray] at he' + obtain ⟨h3, h4⟩ := hray hp.2 hp'.2 he' + have h5 := hpiinj (hμE c hc _ hp.1) (hμE c' hc' _ hp'.1) (h4 (by linarith [not_le.mp h1])) + have hRm : ∀ c ∈ F, ∀ m ∈ Icc (0 : ℝ) 1, μ c m ∈ c.R := fun c hc m hm => + htop c hc m hm ▸ hR c hc _ ⟨hm, zero_le_one, by norm_num⟩ le_rfl + obtain ⟨k, hk, hk', hw⟩ := hF.meet c hc c' hc' hne _ (hRm c hc _ hp.1) + (h5 ▸ hRm c' hc' _ hp'.1) + have h6 : μ c p.1 = t k := by + have h7 : μ c p.1 ∈ q k ∩ discBd E := ⟨hw, hμE c hc _ hp.1⟩ + rwa [(hq k).top] at h7 + have hup : ∀ {c₀}, c₀ ∈ F → (k = c₀.i ∨ k = c₀.i') → ∀ {p₀ : ℝ × ℝ}, p₀ ∈ cuffBox → ¬ p₀.2 + ≤ 1 → μ c₀ p₀.1 = t k → Φ c₀ p₀ = S k p₀.2 := fun {c₀} hc₀ hk₀ {p₀} hp₀ h7 h8 => by + rw [hΦhigh c₀ h7, hShigh k h7, h8] + exact hfin (w₀ := p.2) hk hk' hp.2 (hup hc hk hp h1 h6) (by + rw [h3] + exact hup hc' hk' hp' h2 (h5 ▸ h6)) + +private theorem cuff_box_mem_inner_disc + {T : Type u} + [TopologicalSpace T] + {ι : Type*} + {D : Set T} + {E : Set T} + {q : ι → Set T} + {x : ι → T} + {t : ι → T} + (hDE : D ⊆ E \ discBd E) + (F : Set (CellRec T ι)) + (hF : IsCellFamily D E q x t univ F) + (μ : CellRec T ι → ℝ → T) + (α : CellRec T ι → ℝ → T) + (hμα : ∀ c ∈ F, IsParam c.b (t c.i) (t c.i') (μ c) ∧ IsParam c.a (x c.i) (x c.i') (α c)) + (Φ : CellRec T ι → ℝ × ℝ → T) + (hR : ∀ c ∈ F, ∀ p ∈ cuffBox, p.2 ≤ 1 → Φ c p ∈ c.R) + (hinE : ∀ c ∈ F, ∀ p ∈ cuffBox, Φ c p ∈ E ↔ p.2 ≤ 1) + (hinj : ∀ c ∈ F, InjOn (Φ c) cuffBox) + (hlow0 : ∀ c ∈ F, ∀ m ∈ Icc 0 1, Φ c (m, 0) = α c m) + (haD : ∀ c ∈ F, ∀ {y : T}, y ∈ c.a → y ∈ D) + (c : CellRec T ι) + (hc : c ∈ F) + (p : ℝ × ℝ) + (hp : p ∈ cuffBox) : + Φ c p ∈ D ↔ p.2 = 0 := by + constructor + · intro h1 + have h2 : p.2 ≤ 1 := (hinE c hc p hp).mp (hDE h1).1 + have h3 : Φ c p ∈ c.R ∩ D := ⟨hR c hc p hp h2, h1⟩ + rw [(hF.cell c hc).botCap] at h3 + obtain ⟨m, hm, h4⟩ := (hμα c hc).2.exists_of_mem h3 + have h5 := hinj c hc hp + (⟨hm, le_rfl, by norm_num⟩ : (m, (0 : ℝ)) ∈ cuffBox) (by rw [hlow0 c hc m hm, h4]) + rw [h5] + · intro h1 + have h8 : p = (p.1, 0) := Prod.ext rfl h1 + rw [h8, hlow0 c hc _ hp.1] + exact haD c hc ((hμα c hc).2.mem hp.1) + +private theorem cuff_boxes_cover_annulus + {T : Type u} + [TopologicalSpace T] + {ι : Type*} + {D : Set T} + {E : Set T} + {Δ : Set T} + {q : ι → Set T} + {x : ι → T} + {t : ι → T} + (F : Set (CellRec T ι)) + (hF : IsCellFamily D E q x t univ F) + (pE : Circle ≃ₜ ↑(discBd E)) + (col : ℂ → T) + (col' : T → ℂ) + (hcm' : MapsTo col' Δ (closedBall 0 2)) + (hcr : RightInvOn col' col Δ) + (pi : T → Circle) + (hpi : ∀ (y : T) (h : y ∈ discBd E), pi y = pE.symm ⟨y, h⟩) + (hE' : ∀ {z : ℂ}, z ∈ closedBall 0 2 → (col z ∈ E ↔ ‖z‖ ≤ 1)) + (r : ι → ℝ → T) + (μ : CellRec T ι → ℝ → T) + (α : CellRec T ι → ℝ → T) + (hμα : ∀ c ∈ F, IsParam c.b (t c.i) (t c.i') (μ c) ∧ IsParam c.a (x c.i) (x c.i') (α c)) + (ξ : CellRec T ι → ℂ → T) + (hξ : ∀ c ∈ F, ContinuousOn (ξ c) unitSq ∧ InjOn (ξ c) unitSq ∧ ξ c '' unitSq = c.R ∧ ∀ z ∈ + frontier unitSq, ξ c z = cellBd (r c.i) (r c.i') (α c) (μ c) z) + (Φ : CellRec T ι → ℝ × ℝ → T) + (hΦlow : ∀ (c : CellRec T ι) {p : ℝ × ℝ}, p.2 ≤ 1 → Φ c p = ξ c { re := p.1, im := p.2 }) + (hΦhigh : ∀ (c : CellRec T ι) {p : ℝ × ℝ}, ¬p.2 ≤ 1 → Φ c p = rayPoint col pi p.2 (μ c p.1)) + (hmemray : ∀ (w : ℝ) (y : T), rayPoint col pi w y = col (↑w * ↑(pi y))) + (hlow0 : ∀ c ∈ F, ∀ m ∈ Icc 0 1, Φ c (m, 0) = α c m) + (y : T) + (hy : y ∈ Δ \ discInt D) : + ∃ c ∈ F, ∃ p ∈ cuffBox, Φ c p = y := by + by_cases hyE : y ∈ E + · by_cases hyD : y ∈ D + · have hb : y ∈ discBd D := by + by_contra h1 + exact hy.2 ⟨hyD, h1⟩ + obtain ⟨c, hc, h1⟩ := hF.botCover y hb + obtain ⟨m, hm, h2⟩ := (hμα c hc).2.exists_of_mem h1 + exact ⟨c, hc, (m, 0), ⟨hm, le_rfl, by norm_num⟩, by rw [hlow0 c hc m hm, h2]⟩ + · rcases hF.cover y hyE with h1 | ⟨c, hc, h1⟩ + · exact absurd h1 hyD + · rw [← (hξ c hc).2.2.1] at h1 + obtain ⟨z, hz, rfl⟩ := h1 + exact ⟨c, hc, (z.re, z.im), ⟨hz.1, hz.2.1, by linarith [hz.2.2]⟩, by rw [hΦlow c hz.2.2]⟩ + · have hz2 := hcm' hy.1 + have hcz := hcr hy.1 + set z := col' y with hz + have hn : ¬ ‖z‖ ≤ 1 := fun h1 => hyE (hcz ▸ (hE' hz2).mpr h1) + have hn2 : ‖z‖ ≤ 2 := by simpa using hz2 + have hnp : ‖z‖ ≠ 0 := by + have := not_le.mp hn + linarith + obtain ⟨u, hu⟩ : ∃ u : Circle, (‖z‖ : ℂ) * (u : ℂ) = z := by + refine ⟨⟨z / ‖z‖, ?_⟩, ?_⟩ + · rw [Submonoid.unitSphere, Submonoid.mem_mk, Subsemigroup.mem_mk, + mem_sphere_zero_iff_norm, norm_div, Complex.norm_real, norm_norm] + exact div_self hnp + · change (‖z‖ : ℂ) * (z / ‖z‖) = z + have : (‖z‖ : ℂ) ≠ 0 := by exact_mod_cast hnp + field_simp + obtain ⟨c, hc, hb⟩ := hF.topCover (pE u).1 (pE u).2 + obtain ⟨m, hm, h2⟩ := (hμα c hc).1.exists_of_mem hb + refine ⟨c, hc, (m, ‖z‖), ⟨hm, norm_nonneg _, hn2⟩, ?_⟩ + rw [hΦhigh c hn, hmemray] + simp only + rw [h2, hpi _ (pE u).2] + simp only [Subtype.coe_eta, Homeomorph.symm_apply_apply, hu] + exact hcz + +private theorem cuff_box_meets_middle_boundary + {T : Type u} + [TopologicalSpace T] + {ι : Type*} + {D : Set T} + {E : Set T} + {q : ι → Set T} + {x : ι → T} + {t : ι → T} + (F : Set (CellRec T ι)) + (hF : IsCellFamily D E q x t univ F) + (hsph : discBd E ⊆ E) + (μ : CellRec T ι → ℝ → T) + (α : CellRec T ι → ℝ → T) + (hμα : ∀ c ∈ F, IsParam c.b (t c.i) (t c.i') (μ c) ∧ IsParam c.a (x c.i) (x c.i') (α c)) + (Φ : CellRec T ι → ℝ × ℝ → T) + (htop : ∀ c ∈ F, ∀ m ∈ Icc 0 1, Φ c (m, 1) = μ c m) + (hR : ∀ c ∈ F, ∀ p ∈ cuffBox, p.2 ≤ 1 → Φ c p ∈ c.R) + (hμE : ∀ c ∈ F, ∀ m ∈ Icc 0 1, μ c m ∈ discBd E) + (hinE : ∀ c ∈ F, ∀ p ∈ cuffBox, Φ c p ∈ E ↔ p.2 ≤ 1) + (hinj : ∀ c ∈ F, InjOn (Φ c) cuffBox) + (c : CellRec T ι) + (hc : c ∈ F) + (p : ℝ × ℝ) + (hp : p ∈ cuffBox) : + Φ c p ∈ discBd E ↔ p.2 = 1 := by + constructor + · intro h1 + have h2 : p.2 ≤ 1 := (hinE c hc p hp).mp (hsph h1) + have h3 : Φ c p ∈ c.R ∩ discBd E := ⟨hR c hc p hp h2, h1⟩ + rw [(hF.cell c hc).topCap] at h3 + obtain ⟨m, hm, h4⟩ := (hμα c hc).1.exists_of_mem h3 + have h5 := hinj c hc hp + (⟨hm, zero_le_one, by norm_num⟩ : (m, (1 : ℝ)) ∈ cuffBox) (by rw [htop c hc m hm, h4]) + rw [h5] + · intro h1 + have h8 : p = (p.1, 1) := Prod.ext rfl h1 + rw [h8, htop c hc _ hp.1] + exact hμE c hc _ hp.1 + +private theorem cuff_box_agrees_on_left_side + {T : Type u} + [TopologicalSpace T] + {ι : Type*} + {t : ι → T} + (F : Set (CellRec T ι)) + (col : ℂ → T) + (pi : T → Circle) + (r : ι → ℝ → T) + (μ : CellRec T ι → ℝ → T) + (α : CellRec T ι → ℝ → T) + (ξ : CellRec T ι → ℂ → T) + (hξ : ∀ c ∈ F, ContinuousOn (ξ c) unitSq ∧ InjOn (ξ c) unitSq ∧ ξ c '' unitSq = c.R ∧ ∀ z ∈ + frontier unitSq, ξ c z = cellBd (r c.i) (r c.i') (α c) (μ c) z) + (Φ : CellRec T ι → ℝ × ℝ → T) + (S : ι → ℝ → T) + (hfr : ∀ {m w : ℝ}, m ∈ Icc 0 1 → w ∈ Icc 0 1 → m = 0 ∨ m = 1 ∨ w = 0 ∨ w = 1 → { re := m, im + := w } ∈ frontier unitSq) + (hΦlow : ∀ (c : CellRec T ι) {p : ℝ × ℝ}, p.2 ≤ 1 → Φ c p = ξ c { re := p.1, im := p.2 }) + (hΦhigh : ∀ (c : CellRec T ι) {p : ℝ × ℝ}, ¬p.2 ≤ 1 → Φ c p = rayPoint col pi p.2 (μ c p.1)) + (hSlow : ∀ (k : ι) {w : ℝ}, w ≤ 1 → S k w = r k w) + (hShigh : ∀ (k : ι) {w : ℝ}, ¬w ≤ 1 → S k w = rayPoint col pi w (t k)) + (hμ0 : ∀ c ∈ F, μ c 0 = t c.i) + (hz01 : (0 : ℝ) ∈ Icc 0 1) + (c : CellRec T ι) + (hc : c ∈ F) + (w : ℝ) + (hw : w ∈ Icc 0 2) : + Φ c (0, w) = S c.i w := by + by_cases h1 : w ≤ 1 + · rw [hΦlow c h1, hSlow _ h1] + simp only + rw [(hξ c hc).2.2.2 _ (hfr hz01 ⟨hw.1, h1⟩ (.inl rfl))] + exact cellBd_left rfl + · rw [hΦhigh c h1, hShigh _ h1] + simp only [hμ0 c hc] + +private theorem cuff_box_agrees_on_right_side + {T : Type u} + [TopologicalSpace T] + {ι : Type*} + {t : ι → T} + (F : Set (CellRec T ι)) + (col : ℂ → T) + (pi : T → Circle) + (r : ι → ℝ → T) + (μ : CellRec T ι → ℝ → T) + (α : CellRec T ι → ℝ → T) + (ξ : CellRec T ι → ℂ → T) + (hξ : ∀ c ∈ F, ContinuousOn (ξ c) unitSq ∧ InjOn (ξ c) unitSq ∧ ξ c '' unitSq = c.R ∧ ∀ z ∈ + frontier unitSq, ξ c z = cellBd (r c.i) (r c.i') (α c) (μ c) z) + (Φ : CellRec T ι → ℝ × ℝ → T) + (S : ι → ℝ → T) + (hfr : ∀ {m w : ℝ}, m ∈ Icc 0 1 → w ∈ Icc 0 1 → m = 0 ∨ m = 1 ∨ w = 0 ∨ w = 1 → { re := m, im + := w } ∈ frontier unitSq) + (hΦlow : ∀ (c : CellRec T ι) {p : ℝ × ℝ}, p.2 ≤ 1 → Φ c p = ξ c { re := p.1, im := p.2 }) + (hΦhigh : ∀ (c : CellRec T ι) {p : ℝ × ℝ}, ¬p.2 ≤ 1 → Φ c p = rayPoint col pi p.2 (μ c p.1)) + (hSlow : ∀ (k : ι) {w : ℝ}, w ≤ 1 → S k w = r k w) + (hShigh : ∀ (k : ι) {w : ℝ}, ¬w ≤ 1 → S k w = rayPoint col pi w (t k)) + (hμ1 : ∀ c ∈ F, μ c 1 = t c.i') + (ho01 : (1 : ℝ) ∈ Icc 0 1) + (c : CellRec T ι) + (hc : c ∈ F) + (w : ℝ) + (hw : w ∈ Icc 0 2) : + Φ c (1, w) = S c.i' w := by + by_cases h1 : w ≤ 1 + · rw [hΦlow c h1, hSlow _ h1] + simp only + rw [(hξ c hc).2.2.2 _ (hfr ho01 ⟨hw.1, h1⟩ (.inr (.inl rfl)))] + exact cellBd_right rfl + · rw [hΦhigh c h1, hShigh _ h1] + simp only [hμ1 c hc] + +/-- **The boxes around one cuff.** -/ +theorem exists_cuff_boxes [Finite ι] (hman : ∀ x : T, IsManifoldPoint x) (hD : IsClosedDisc D) + (hE : IsClosedDisc E) (hΔ : IsClosedDisc Δ) (hDE : D ⊆ E \ discBd E) (hEΔ : E ⊆ Δ \ discBd Δ) + (hq : ∀ k, IsCrossLine D E (q k) (x k) (t k)) (hdis : ∀ k k', k ≠ k' → Disjoint (q k) + (q k')) {i₀ i₁ : ι} (hi : i₀ ≠ i₁) : + ∃ F Φ S μ, IsCellFamily D E q x t univ F ∧ IsCuffBoxes D E Δ q x t F Φ S μ := by + classical + obtain ⟨F, hF⟩ := exists_cell_family hman hD hE hDE hq hdis hi + obtain ⟨pE⟩ := hE.isOArc_discBd + obtain ⟨col, col', hcc, hcc', hcm, hcm', hcl, hcr, hc1, hc2, hcp⟩ := exists_disc_collar hE hΔ hEΔ + pE + have hcinj : InjOn col (closedBall 0 2) := fun a ha b hb he => by + rw [← hcl ha, ← hcl hb, he] + have hsph : discBd E ⊆ E := Surface.discBd_subset E + let pi : T → Circle := fun y => if h : y ∈ discBd E then pE.symm ⟨y, h⟩ else 1 + have hpi : ∀ y (h : y ∈ discBd E), pi y = pE.symm ⟨y, h⟩ := fun y h => dite_eq_left h + have hpic : ContinuousOn pi (discBd E) := by + rw [continuousOn_iff_continuous_domRestrict] + have : (discBd E).domRestrict pi = fun y => pE.symm y := by + funext y + exact hpi y.1 y.2 + rw [this] + exact pE.symm.continuous + have hpiinj : InjOn pi (discBd E) := fun a ha b hb he => by + rw [hpi a ha, hpi b hb] at he + exact congrArg Subtype.val (pE.symm.injective he) + have hcolp : ∀ y ∈ discBd E, col (pi y : ℂ) = y := fun y hy => by + rw [hcp, hpi y hy] + simp + have hnu : ∀ u : Circle, ‖(u : ℂ)‖ = 1 := fun u => Circle.norm_coe u + have hmemb : ∀ {w : ℝ} (u : Circle), w ∈ Icc (0 : ℝ) 2 → (w : ℂ) * (u : ℂ) ∈ closedBall (0 : ℂ) 2 + := fun {w} u hw => by + rw [mem_closedBall_zero_iff, norm_mul, hnu, mul_one, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg hw.1] + exact hw.2 + have hnm : ∀ {w : ℝ} (u : Circle), 0 ≤ w → ‖(w : ℂ) * (u : ℂ)‖ = w := fun {w} u hw => by + rw [norm_mul, hnu, mul_one, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg hw] + have hray : ∀ {w w' : ℝ} {u u' : Circle}, w ∈ Icc (0 : ℝ) 2 → w' ∈ Icc (0 : ℝ) 2 → col ((w : ℂ) * + (u : ℂ)) = col ((w' : ℂ) * (u' : ℂ)) → w = w' ∧ (0 < w → u = u') := fun {w w' u u'} hw hw' he + => by + exact collar_ray_eq (T := T) col hcinj hmemb hnm (w := w) (w' := w') (u := u) (u' := u') hw + hw' he + have hE' : ∀ {z : ℂ}, z ∈ closedBall (0 : ℂ) 2 → (col z ∈ E ↔ ‖z‖ ≤ 1) := fun {z} hz => by + rw [← hc1] + constructor + · rintro ⟨y, hy, he⟩ + have := hcinj (closedBall_subset_closedBall (by norm_num) hy) hz he + simpa [this] using hy + · intro h1 + exact ⟨z, by simpa using h1, rfl⟩ + have hΔ' : ∀ {z : ℂ}, z ∈ closedBall (0 : ℂ) 2 → (col z ∈ discBd Δ ↔ ‖z‖ = 2) := fun {z} hz => by + rw [← hc2] + constructor + · rintro ⟨y, hy, he⟩ + have := hcinj (sphere_subset_closedBall hy) hz he + simpa [this] using hy + · intro h1 + exact ⟨z, by simpa using h1, rfl⟩ + have hparE : ∀ {c}, c ∈ F → ∀ {m}, m ∈ Icc (0 : ℝ) 1 → ∀ {μ₀ : ℝ → T}, IsParam c.b (t c.i) + (t c.i') μ₀ → μ₀ m ∈ discBd E := fun {c} hc {m} hm {μ₀} h1 => by + have h2 : μ₀ m ∈ c.R ∩ discBd E := by + rw [(hF.cell c hc).topCap] + exact h1.mem hm + exact h2.2 + -- The choices of parametrizations and charts. + have hlam : ∀ k, ∃ r, IsParam (q k) (x k) (t k) r := fun k => exists_isParam (hq k).line + choose r hr using hlam + have hb : ∀ c : CellRec T ι, ∃ μ₀ α, c ∈ F → IsParam c.b (t c.i) (t c.i') μ₀ ∧ IsParam c.a + (x c.i) (x c.i') α := fun c => by + by_cases hc : c ∈ F + · obtain ⟨μ₀, h1⟩ := exists_isParam (hF.cell c hc).top + obtain ⟨α, h2⟩ := exists_isParam (hF.cell c hc).bottom + exact ⟨μ₀, α, fun _ => ⟨h1, h2⟩⟩ + · exact ⟨fun _ => x c.i, fun _ => x c.i, fun h => absurd h hc⟩ + choose μ α hμα using hb + have hξ : ∀ c : CellRec T ι, ∃ ξ : ℂ → T, c ∈ F → ContinuousOn ξ unitSq ∧ InjOn ξ unitSq + ∧ ξ '' unitSq = c.R ∧ ∀ z ∈ frontier unitSq, ξ z = cellBd (r c.i) (r c.i') (α c) (μ c) z + := fun c => by + by_cases hc : c ∈ F + · obtain ⟨ξ, h1⟩ := exists_cell_chart (hF.cell c hc) (hr c.i) (hr c.i') (hμα c hc).2 + (hμα c hc).1 + exact ⟨ξ, fun _ => h1⟩ + · exact ⟨fun _ => x c.i, fun h => absurd h hc⟩ + choose ξ hξ using hξ + let Φ : CellRec T ι → ℝ × ℝ → T := fun c => boxMap (ξ c) col pi (μ c) + let S : ι → ℝ → T := fun k => lineSide col pi (r k) (t k) + have hsq : ∀ {p : ℝ × ℝ}, p ∈ cuffBox → p.2 ≤ 1 → (⟨p.1, p.2⟩ : ℂ) ∈ unitSq := fun {p} hp h1 + => ⟨hp.1, hp.2.1, h1⟩ + have hfr : ∀ {m w : ℝ}, m ∈ Icc (0 : ℝ) 1 → w ∈ Icc (0 : ℝ) 1 → (m = 0 ∨ m = 1 ∨ w = 0 ∨ w = 1) → + (⟨m, w⟩ : ℂ) ∈ frontier unitSq := fun h1 h2 h3 => by + rw [frontier_unitSq] + exact ⟨⟨h1, h2⟩, h3⟩ + have hΦlow : ∀ c {p : ℝ × ℝ}, p.2 ≤ 1 → Φ c p = ξ c ⟨p.1, p.2⟩ := fun c {p} h1 => ite_eq_left h1 + have hΦhigh : ∀ c {p : ℝ × ℝ}, ¬ p.2 ≤ 1 → Φ c p = rayPoint col pi p.2 (μ c p.1) := fun c {p} h1 + => ite_eq_right h1 + have hSlow : ∀ k {w : ℝ}, w ≤ 1 → S k w = r k w := fun k {w} h1 => ite_eq_left h1 + have hShigh : ∀ k {w : ℝ}, ¬ w ≤ 1 → S k w = rayPoint col pi w (t k) := fun k {w} h1 + => ite_eq_right h1 + have htE : ∀ k, t k ∈ discBd E := fun k => by + have h1 : t k ∈ q k ∩ discBd E := by + rw [(hq k).top] + rfl + exact h1.2 + have hrD : ∀ k, x k ∈ D := fun k => Surface.discBd_subset _ (hq k).xbd + have hμ0 : ∀ c ∈ F, μ c 0 = t c.i := fun c hc => (hμα c hc).1.zero + have hμ1 : ∀ c ∈ F, μ c 1 = t c.i' := fun c hc => (hμα c hc).1.one + have hz01 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := ⟨le_rfl, zero_le_one⟩ + have ho01 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := ⟨zero_le_one, le_rfl⟩ + have hleft : ∀ c ∈ F, ∀ w ∈ Icc (0 : ℝ) 2, Φ c (0, w) = S c.i w := fun c hc w hw => by + exact cuff_box_agrees_on_left_side (T := T) (ι := ι) (t := t) F col pi r μ α ξ hξ Φ S hfr + hΦlow hΦhigh hSlow hShigh hμ0 hz01 c hc w hw + have hright : ∀ c ∈ F, ∀ w ∈ Icc (0 : ℝ) 2, Φ c (1, w) = S c.i' w := fun c hc w hw => by + exact cuff_box_agrees_on_right_side (T := T) (ι := ι) (t := t) F col pi r μ α ξ hξ Φ S hfr + hΦlow hΦhigh hSlow hShigh hμ1 ho01 c hc w hw + have htop : ∀ c ∈ F, ∀ m ∈ Icc (0 : ℝ) 1, Φ c (m, 1) = μ c m := fun c hc m hm => by + rw [hΦlow c le_rfl] + simp only + rw [(hξ c hc).2.2.2 _ (hfr hm ho01 (.inr (.inr (.inr rfl))))] + exact cellBd_high (hr _) (hr _) (hμα c hc).1 rfl + have hR : ∀ c ∈ F, ∀ p ∈ cuffBox, p.2 ≤ 1 → Φ c p ∈ c.R := fun c hc p hp h1 => by + rw [hΦlow c h1, ← (hξ c hc).2.2.1] + exact mem_image_of_mem _ (hsq hp h1) + have hRE : ∀ c ∈ F, c.R ⊆ E := fun c hc => (hF.cell c hc).subE + have hmemray : ∀ w y, rayPoint col pi w y = col ((w : ℂ) * (pi y : ℂ)) := fun _ _ => rfl + have hμE : ∀ c ∈ F, ∀ m ∈ Icc (0 : ℝ) 1, μ c m ∈ discBd E := fun c hc m hm => hparE hc hm + (hμα c hc).1 + have hinE : ∀ c ∈ F, ∀ p ∈ cuffBox, Φ c p ∈ E ↔ p.2 ≤ 1 := fun c hc p hp => by + by_cases h1 : p.2 ≤ 1 + · exact ⟨fun _ => h1, fun _ => hRE c hc (hR c hc p hp h1)⟩ + · rw [hΦhigh c h1, hmemray, hE' (hmemb _ hp.2), hnm _ hp.2.1] + have hoff : ∀ c ∈ F, ∀ p ∈ cuffBox, ¬ p.2 ≤ 1 → Φ c p ∉ E := fun c hc p hp h1 h2 => h1 + ((hinE c hc p hp).mp h2) + have hinj : ∀ c ∈ F, InjOn (Φ c) cuffBox := fun c hc p hp p' hp' he => by + exact cuff_box_injective (T := T) (ι := ι) (E := E) (x := x) (t := t) F col pi hpiinj hray r μ + α hμα ξ hξ Φ hsq hΦlow hΦhigh hR hRE hmemray hμE hinE c hc p hp p' hp' he + have hsideE : ∀ c ∈ F, ∀ k, (k = c.i ∨ k = c.i') → ∃ e : ℝ, (e = 0 ∨ e = 1) ∧ ∀ w ∈ Icc + (0 : ℝ) 2, Φ c (e, w) = S k w := fun c hc k hk => by + rcases hk with rfl | rfl + · exact ⟨0, .inl rfl, hleft c hc⟩ + · exact ⟨1, .inr rfl, hright c hc⟩ + have hSmem : ∀ k, ∀ w ∈ Icc (0 : ℝ) 1, S k w ∈ q k := fun k w hw => by + rw [hSlow k hw.2] + exact (hr k).mem hw + have hSof : ∀ k, ∀ y ∈ q k, ∃ w ∈ Icc (0 : ℝ) 1, S k w = y := fun k y hy => by + obtain ⟨w, hw, rfl⟩ := (hr k).exists_of_mem hy + exact ⟨w, hw, hSlow k hw.2⟩ + have hS1 : ∀ k, S k 1 = t k := fun k => by + rw [hSlow k le_rfl] + exact (hr k).one + have hS0 : ∀ k, S k 0 = x k := fun k => by + rw [hSlow k zero_le_one] + exact (hr k).zero + have hrE : ∀ k, ∀ w ∈ Icc (0 : ℝ) 1, r k w ∈ E := fun k w hw => (hq k).sub ((hr k).mem hw) + have hSinj : ∀ k, InjOn (S k) (Icc 0 2) := fun k w hw w' hw' he => by + exact cuff_side_injective (T := T) (ι := ι) (E := E) (q := q) (x := x) (t := t) col pi hmemb + hnm hray hE' r hr S hSlow hShigh hmemray hrE k w hw w' hw' he + have hboxe : ∀ {e w : ℝ}, (e = 0 ∨ e = 1) → w ∈ Icc (0 : ℝ) 2 → (e, w) ∈ cuffBox + := fun {e w} h1 h2 => by + refine ⟨?_, h2⟩ + rcases h1 with rfl | rfl + · exact hz01 + · exact ho01 + have hcont : ∀ c ∈ F, ContinuousOn (Φ c) cuffBox := fun c hc => by + exact cuff_box_continuous (T := T) (ι := ι) (E := E) (x := x) (t := t) F col hcc pi hpic hcolp + hmemb r μ α hμα ξ hξ Φ hsq hΦlow hΦhigh htop hμE c hc + have hmeet : ∀ c ∈ F, ∀ c' ∈ F, ∀ p p', p ∈ cuffBox → p' ∈ cuffBox → Φ c p = Φ c' p' → (c = c' + ∧ p = p') ∨ (p.2 = p'.2 ∧ (p.1 = 0 ∨ p.1 = 1) ∧ (p'.1 = 0 ∨ p'.1 = 1) ∧ ∀ w ∈ Icc + (0 : ℝ) 2, Φ c (p.1, w) = Φ c' (p'.1, w)) := fun c hc c' hc' p p' hp hp' he => by + exact cuff_boxes_overlap_on_sides (T := T) (ι := ι) (D := D) (E := E) (q := q) (x := x) (t := + t) hq F hF col pi hpiinj hray μ Φ S hΦhigh hShigh htop hR hRE hmemray hμE hinE hinj hsideE + hSof hboxe c hc c' hc' p p' hp hp' he + have hbd : ∀ c ∈ F, ∀ p ∈ cuffBox, Φ c p ∈ discBd E ↔ p.2 = 1 := fun c hc p hp => by + exact cuff_box_meets_middle_boundary (T := T) (ι := ι) (D := D) (E := E) (q := q) (x := x) (t + := t) F hF hsph μ α hμα Φ htop hR hμE hinE hinj c hc p hp + have hlow0 : ∀ c ∈ F, ∀ m ∈ Icc (0 : ℝ) 1, Φ c (m, 0) = α c m := fun c hc m hm => by + rw [hΦlow c zero_le_one] + simp only + rw [(hξ c hc).2.2.2 _ (hfr hm hz01 (.inr (.inr (.inl rfl))))] + exact cellBd_low (hr _) (hr _) (hμα c hc).2 rfl + have haD : ∀ c ∈ F, ∀ {y}, y ∈ c.a → y ∈ D := fun c hc {y} hy => Surface.discBd_subset _ + ((hF.cell c hc).aBd hy) + have hin0 : ∀ c ∈ F, ∀ p ∈ cuffBox, Φ c p ∈ D ↔ p.2 = 0 := fun c hc p hp => by + exact cuff_box_mem_inner_disc (T := T) (ι := ι) (D := D) (E := E) (q := q) (x := x) (t := t) + hDE F hF μ α hμα Φ hR hinE hinj hlow0 haD c hc p hp + have hinΔ : ∀ c ∈ F, ∀ p ∈ cuffBox, Φ c p ∈ discBd Δ ↔ p.2 = 2 := fun c hc p hp => by + by_cases h1 : p.2 ≤ 1 + · refine ⟨fun h2 => absurd h2 (hEΔ (hRE c hc (hR c hc p hp h1))).2, fun h2 => ?_⟩ + linarith + · rw [hΦhigh c h1, hmemray, hΔ' (hmemb _ hp.2), hnm _ hp.2.1] + have hmaps : ∀ c ∈ F, MapsTo (Φ c) cuffBox Δ := fun c hc p hp => by + by_cases h1 : p.2 ≤ 1 + · exact (hEΔ (hRE c hc (hR c hc p hp h1))).1 + · rw [hΦhigh c h1, hmemray] + exact hcm (hmemb _ hp.2) + have hcover : ∀ y ∈ Δ \ discInt D, ∃ c ∈ F, ∃ p ∈ cuffBox, Φ c p = y := fun y hy => by + exact cuff_boxes_cover_annulus (T := T) (ι := ι) (D := D) (E := E) (Δ := Δ) (q := q) (x := x) + (t := t) F hF pE col col' hcm' hcr pi hpi hE' r μ α hμα ξ hξ Φ hΦlow hΦhigh hmemray hlow0 y + hy + exact ⟨F, Φ, S, μ, hF, hcont, hinj, hmaps, hSinj, hleft, hright, htop, + fun c hc => (hμα c hc).1, hSmem, hSof, hS1, hS0, hinE, hR, hbd, hin0, hinΔ, hcover, hmeet⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffBoxes.lean b/LeanPool/GraphMinor/GM07/CuffBoxes.lean new file mode 100644 index 0000000000..d67939461c --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffBoxes.lean @@ -0,0 +1,503 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffMenger + +/-! +# Boxes around the cuffs + +Graph Minors VII, (5.9), page 235: the move from `G` to `G'`. We cut the part of the surface near +the cuffs into boxes `[0,1] × [0,2]`, with the cuff at level `0`. +Two boxes meet only along their vertical sides. A map of each box into itself that fixes the top, +and that agrees on the sides, gives a map of the surface. It is homotopic to the identity by the +straight line homotopy in each box. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +/-- The box `[0,1] × [0,2]`. -/ +def cuffBox : Set (ℝ × ℝ) := Icc 0 1 ×ˢ Icc 0 2 + +/-- The straight line from `p` to `q` in the plane. -/ +def boxLine (τ : ℝ) (p q : ℝ × ℝ) : ℝ × ℝ := ((1 - τ) * p.1 + τ * q.1, (1 - τ) * p.2 + τ * q.2) + +theorem isCompact_cuffBox : IsCompact cuffBox := isCompact_Icc.prod isCompact_Icc + +theorem boxLine_self (τ : ℝ) (p : ℝ × ℝ) : boxLine τ p p = p := + Prod.ext (by simp only [boxLine]; ring) (by simp only [boxLine]; ring) + +theorem boxLine_zero (p q : ℝ × ℝ) : boxLine 0 p q = p := + Prod.ext (by simp only [boxLine]; ring) (by simp only [boxLine]; ring) + +theorem boxLine_one (p q : ℝ × ℝ) : boxLine 1 p q = q := + Prod.ext (by simp only [boxLine]; ring) (by simp only [boxLine]; ring) + +theorem boxLine_mem {τ : ℝ} (h0 : 0 ≤ τ) (h1 : τ ≤ 1) {p q : ℝ × ℝ} (hp : p ∈ cuffBox) + (hq : q ∈ cuffBox) : boxLine τ p q ∈ cuffBox := by + obtain ⟨⟨h2, h3⟩, h4, h5⟩ := hp + obtain ⟨⟨h6, h7⟩, h8, h9⟩ := hq + have h10 : 0 ≤ 1 - τ := by linarith + refine ⟨⟨?_, ?_⟩, ?_, ?_⟩ <;> simp only [boxLine] <;> nlinarith + +variable {S : Type u} [TopologicalSpace S] {ι : Type*} + +/-- Boxes in the surface. They are one to one, they meet only along vertical sides, and the part +below the top is open in the surface. -/ +structure IsBoxSystem (φ : ι → ℝ × ℝ → S) : Prop where + cont : ∀ i, ContinuousOn (φ i) cuffBox + inj : ∀ i, InjOn (φ i) cuffBox + meet : ∀ i i' p p', p ∈ cuffBox → p' ∈ cuffBox → φ i p = φ i' p' → (i = i' ∧ p = p') ∨ (p.2 + = p'.2 ∧ (p.1 = 0 ∨ p.1 = 1) ∧ (p'.1 = 0 ∨ p'.1 = 1) ∧ ∀ w ∈ Icc (0 : ℝ) 2, φ i (p.1, w) = φ i' + (p'.1, w)) + isOpen : IsOpen (⋃ i, φ i '' {p ∈ cuffBox | p.2 < 2}) + +/-- A map of each box into itself, which fixes the top, and which on the sides only changes the +level by `ℓ`. -/ +structure IsBoxMap (r : ι → ℝ × ℝ → ℝ × ℝ) (ℓ : ℝ → ℝ) : Prop where + cont : ∀ i, ContinuousOn (r i) cuffBox + maps : ∀ i, MapsTo (r i) cuffBox cuffBox + top : ∀ i p, p ∈ cuffBox → p.2 = 2 → r i p = p + side : ∀ i m w, (m = 0 ∨ m = 1) → w ∈ Icc (0 : ℝ) 2 → r i (m, w) = (m, ℓ w) + +variable {φ : ι → ℝ × ℝ → S} {r : ι → ℝ × ℝ → ℝ × ℝ} {ℓ : ℝ → ℝ} + +/-- The value of the homotopy does not depend on the box. -/ +theorem IsBoxSystem.well_defined (h : IsBoxSystem φ) (hr : IsBoxMap r ℓ) {i i' : ι} {p p' : ℝ × ℝ} + (hp : p ∈ cuffBox) (hp' : p' ∈ cuffBox) (he : φ i p = φ i' p') (τ : ℝ) (h0 : 0 ≤ τ) (h1 : τ + ≤ 1) : φ i (boxLine τ p (r i p)) = φ i' (boxLine τ p' (r i' p')) := by + rcases h.meet i i' p p' hp hp' he with ⟨rfl, rfl⟩ | ⟨hw, hm, hm', hf⟩ + · rfl + · have h2 : r i p = (p.1, ℓ p.2) := hr.side i p.1 p.2 hm hp.2 + have h3 : r i' p' = (p'.1, ℓ p'.2) := hr.side i' p'.1 p'.2 hm' hp'.2 + have h4 : ∀ m : ℝ, ((1 - τ) * m + τ * m) = m := fun m => by ring + have h5 : (p.1, ℓ p.2) ∈ cuffBox := h2 ▸ hr.maps i hp + have hq : (1 - τ) * p.2 + τ * ℓ p.2 ∈ Icc (0 : ℝ) 2 := (boxLine_mem h0 h1 hp h5).2 + rw [h2, h3] + simp only [boxLine, h4] + rw [← hw] + exact hf _ hq + +/-- **The homotopy of a box map.** -/ +theorem IsBoxSystem.exists_homotopy [Finite ι] [T2Space S] (h : IsBoxSystem φ) (hr : IsBoxMap r ℓ) : + ∃ Ψ : unitInterval × S → S, Continuous Ψ ∧ (∀ x, Ψ (0, x) = x) ∧ (∀ i p τ, p ∈ cuffBox → Ψ + (τ, φ i p) = φ i (boxLine τ p (r i p))) ∧ ∀ x τ, (∀ i, x ∉ φ i '' cuffBox) → Ψ (τ, x) = x + := by + classical + have hnU : ∀ i, IsCompact (φ i '' cuffBox) := fun i => isCompact_cuffBox.image_of_continuousOn + (h.cont i) + obtain ⟨θ, hθ⟩ : ∃ θ : ι → S → ℝ × ℝ, ∀ i, ContinuousOn (θ i) (φ i '' cuffBox) ∧ LeftInvOn (θ i) + (φ i) cuffBox := by + by_cases hne : Nonempty (ℝ × ℝ) + · have := fun i => Surface.exists_inv_of_compactOn isCompact_cuffBox (h.cont i) (h.inj i) + choose θ hθ₁ hθ₂ using this + exact ⟨θ, fun i => ⟨hθ₁ i, hθ₂ i⟩⟩ + · exact absurd ⟨(0, 0)⟩ hne + let Ψ : unitInterval × S → S := fun q => if hx : ∃ i, q.2 ∈ φ i '' cuffBox then φ hx.choose + (boxLine q.1 (θ hx.choose q.2) (r hx.choose (θ hx.choose q.2))) else q.2 + have hval : ∀ i p (τ : unitInterval), p ∈ cuffBox → Ψ (τ, φ i p) = φ i (boxLine τ p (r i p)) + := fun i p τ hp => by + have hx : ∃ i', φ i p ∈ φ i' '' cuffBox := ⟨i, mem_image_of_mem _ hp⟩ + simp only [Ψ, dite_eq_left hx] + have hs := hx.choose_spec + generalize hx.choose = i₀ at hs ⊢ + obtain ⟨p', hp', he⟩ := hs + rw [← he, (hθ _).2 hp'] + exact h.well_defined hr hp' hp he τ τ.2.1 τ.2.2 + have hoff : ∀ x τ, (∀ i, x ∉ φ i '' cuffBox) → Ψ (τ, x) = x := fun x τ hx => by + have : ¬ ∃ i, x ∈ φ i '' cuffBox := by + push Not + exact hx + simp only [Ψ, dite_eq_right this] + let O : Set S := ⋃ i, φ i '' {p ∈ cuffBox | p.2 < 2} + have hcov : ∀ i : Option ι, IsClosed (match i with + | some i => (univ : Set unitInterval) ×ˢ (φ i '' cuffBox) + | none => univ ×ˢ Oᶜ) := fun i => by + rcases i with _ | i + · exact isClosed_univ.prod h.isOpen.isClosed_compl + · exact isClosed_univ.prod (hnU i).isClosed + have hcont : Continuous Ψ := by + refine LocallyFinite.continuous (locallyFinite_of_finite _) ?_ hcov ?_ + · ext q + simp only [mem_iUnion, mem_univ, iff_true] + by_cases hq : q.2 ∈ O + · obtain ⟨i, p, hp, he⟩ := mem_iUnion.mp hq + exact ⟨some i, mem_univ _, p, hp.1, he⟩ + · exact ⟨none, mem_univ _, hq⟩ + · rintro (_ | i) + · refine continuous_snd.continuousOn.congr fun q hq => ?_ + by_cases hx : ∃ i, q.2 ∈ φ i '' cuffBox + · obtain ⟨i, p, hp, he⟩ := hx + have h2 : p.2 = 2 := by + by_contra hne + exact hq.2 (mem_iUnion.mpr ⟨i, p, ⟨hp, lt_of_le_of_ne hp.2.2 hne⟩, he⟩) + obtain ⟨τ, x⟩ := q + simp only at he + subst he + rw [hval i p τ hp, hr.top i p hp h2, boxLine_self] + · push Not at hx + exact hoff q.2 q.1 hx + · have hg : ContinuousOn (fun q : unitInterval × S => φ i (boxLine q.1 (θ i q.2) (r i + (θ i q.2)))) (univ ×ˢ (φ i '' cuffBox)) := by + have hθm : ∀ x ∈ φ i '' cuffBox, θ i x ∈ cuffBox := by + rintro _ ⟨p, hp, rfl⟩ + rw [(hθ i).2 hp] + exact hp + have h2 : ContinuousOn (fun q : unitInterval × S => θ i q.2) (univ ×ˢ (φ i '' cuffBox)) + := (hθ i).1.comp continuousOn_snd fun q hq => hq.2 + have h3 : ContinuousOn (fun q : unitInterval × S => r i (θ i q.2)) (univ ×ˢ + (φ i '' cuffBox)) := (hr.cont i).comp h2 fun q hq => hθm _ hq.2 + refine (h.cont i).comp ?_ fun q hq => boxLine_mem q.1.2.1 q.1.2.2 (hθm _ hq.2) (hr.maps i + (hθm _ hq.2)) + have hτ : ContinuousOn (fun q : unitInterval × S => (q.1 : ℝ)) (univ ×ˢ (φ i '' cuffBox)) + := (continuous_subtype_val.comp continuous_fst).continuousOn + simp only [boxLine] + exact ((continuousOn_const.sub hτ).mul h2.fst |>.add (hτ.mul h3.fst)).prodMk + ((continuousOn_const.sub hτ).mul h2.snd |>.add (hτ.mul h3.snd)) + refine hg.congr fun q hq => ?_ + obtain ⟨τ, x⟩ := q + obtain ⟨p, hp, rfl⟩ := hq.2 + simp only + rw [hval i p τ hp, (hθ i).2 hp] + refine ⟨Ψ, hcont, fun x => ?_, fun i p τ hp => hval i p τ hp, hoff⟩ + by_cases hx : ∃ i, x ∈ φ i '' cuffBox + · obtain ⟨i, p, hp, rfl⟩ := hx + rw [hval i p 0 hp] + simp [boxLine_zero] + · push Not at hx + exact hoff x 0 hx + +/-- The fraction of the way from the graph of `f` to the top of the box. -/ +noncomputable def boxLevel (f : ℝ → ℝ) (p : ℝ × ℝ) : ℝ := max 0 ((p.2 - f p.1) / (2 - f p.1)) + +/-- The map of a box: everything under the graph of `f` goes to the bottom, by `g`, and the part +above the graph of `f` is stretched over the box. The map `g` of the bottom fades out towards the +top. -/ +noncomputable def boxCollapse (g f : ℝ → ℝ) (p : ℝ × ℝ) : ℝ × ℝ := + (boxLevel f p * p.1 + (1 - boxLevel f p) * g p.1, 2 * boxLevel f p) + +/-- The conditions on the functions `g` and `f` of a box. -/ +structure IsCollapseData (g f : ℝ → ℝ) : Prop where + gcont : ContinuousOn g (Icc 0 1) + fcont : ContinuousOn f (Icc 0 1) + gmono : MonotoneOn g (Icc 0 1) + g0 : g 0 = 0 + g1 : g 1 = 1 + f1 : ∀ m ∈ Icc (0 : ℝ) 1, 1 ≤ f m ∧ f m ≤ 3 / 2 + f0 : f 0 = 1 + f1' : f 1 = 1 + +section Collapse + +variable {g f : ℝ → ℝ} + +theorem IsCollapseData.gmem (h : IsCollapseData g f) {m : ℝ} (hm : m ∈ Icc (0 : ℝ) 1) : g m ∈ Icc + (0 : ℝ) 1 := + ⟨h.g0 ▸ h.gmono ⟨le_rfl, zero_le_one⟩ hm hm.1, h.g1 ▸ h.gmono hm ⟨zero_le_one, le_rfl⟩ hm.2⟩ + +theorem IsCollapseData.level_mem (h : IsCollapseData g f) {p : ℝ × ℝ} + (hp : p ∈ cuffBox) : boxLevel f p ∈ Icc (0 : ℝ) 1 := by + obtain ⟨h1, h2⟩ := h.f1 p.1 hp.1 + have h3 : 0 < 2 - f p.1 := by linarith + refine ⟨le_max_left _ _, max_le zero_le_one ?_⟩ + rw [div_le_one h3] + linarith [hp.2.2] + +theorem boxLevel_eq_zero (h : IsCollapseData g f) {p : ℝ × ℝ} (hp : p ∈ cuffBox) : boxLevel f p + = 0 ↔ p.2 ≤ f p.1 := by + obtain ⟨h1, h2⟩ := h.f1 p.1 hp.1 + have h3 : 0 < 2 - f p.1 := by linarith + simp only [boxLevel] + rw [max_eq_left_iff, div_le_iff₀ h3] + constructor <;> intro h4 <;> linarith + +theorem boxLevel_of_lt (h : IsCollapseData g f) {p : ℝ × ℝ} (hp : p ∈ cuffBox) (hlt : f p.1 + ≤ p.2) : boxLevel f p = (p.2 - f p.1) / (2 - f p.1) := by + obtain ⟨h1, h2⟩ := h.f1 p.1 hp.1 + have h3 : 0 < 2 - f p.1 := by linarith + exact max_eq_right (div_nonneg (by linarith) h3.le) + +theorem continuousOn_boxLevel (h : IsCollapseData g f) : ContinuousOn (boxLevel f) cuffBox := by + have h1 : ContinuousOn (fun p : ℝ × ℝ => f p.1) cuffBox := h.fcont.comp continuousOn_fst fun p hp + => hp.1 + have h2 : ContinuousOn (fun p : ℝ × ℝ => (p.2 - f p.1) / (2 - f p.1)) cuffBox := + (continuousOn_snd.sub h1).div (continuousOn_const.sub h1) fun p hp => by + have := (h.f1 p.1 hp.1).2 + linarith + exact continuous_max.comp_continuousOn (continuousOn_const.prodMk h2) + +theorem continuousOn_boxCollapse (h : IsCollapseData g f) : ContinuousOn (boxCollapse g f) cuffBox + := by + have h1 := continuousOn_boxLevel h + have h2 : ContinuousOn (fun p : ℝ × ℝ => g p.1) cuffBox := h.gcont.comp continuousOn_fst fun p hp + => hp.1 + exact (h1.mul continuousOn_fst |>.add ((continuousOn_const.sub h1).mul h2)).prodMk + (continuousOn_const.mul h1) + +theorem boxCollapse_mem (h : IsCollapseData g f) {p : ℝ × ℝ} (hp : p ∈ cuffBox) : boxCollapse g f p + ∈ cuffBox := by + obtain ⟨h1, h2⟩ := h.level_mem hp + obtain ⟨h3, h4⟩ := h.gmem hp.1 + obtain ⟨h5, h6⟩ := hp.1 + have h7 : 0 ≤ 1 - boxLevel f p := by linarith + refine ⟨⟨?_, ?_⟩, ?_, ?_⟩ <;> simp only [boxCollapse] <;> nlinarith + +theorem boxCollapse_top (h : IsCollapseData g f) {p : ℝ × ℝ} (hp : p ∈ cuffBox) (h2 : p.2 + = 2) : boxCollapse g f p = p := by + obtain ⟨h3, h4⟩ := h.f1 p.1 hp.1 + have h5 : boxLevel f p = 1 := by + rw [boxLevel_of_lt h hp (by linarith), h2] + exact div_self (by linarith) + refine Prod.ext ?_ ?_ <;> simp only [boxCollapse, h5, h2] <;> ring + +/-- The level on the sides of a box. -/ +noncomputable def sideLevel (w : ℝ) : ℝ := 2 * max 0 (w - 1) + +theorem boxCollapse_side (h : IsCollapseData g f) {m w : ℝ} (hm : m = 0 ∨ m = 1) : boxCollapse g f + (m, w) = (m, sideLevel w) := by + have hf : f m = 1 := by + rcases hm with rfl | rfl + · exact h.f0 + · exact h.f1' + have hg : g m = m := by + rcases hm with rfl | rfl + · exact h.g0 + · exact h.g1 + refine Prod.ext ?_ ?_ + · simp only [boxCollapse, hg] + ring + · simp only [boxCollapse, boxLevel, sideLevel, hf] + norm_num + +/-- Above the graph of `f`, the map of the box is one to one. -/ +theorem boxCollapse_inj (h : IsCollapseData g f) {p q : ℝ × ℝ} (hp : p ∈ cuffBox) + (hq : q ∈ cuffBox) (hpf : f p.1 < p.2) (hqf : f q.1 < q.2) (he : boxCollapse g f p + = boxCollapse g f q) : p = q := by + have h1 : boxLevel f p = boxLevel f q := by + have := congrArg Prod.snd he + simp only [boxCollapse] at this + linarith + have hl : 0 < boxLevel f p := lt_of_le_of_ne (h.level_mem hp).1 fun h2 => absurd + ((boxLevel_eq_zero h hp).mp h2.symm) (not_le.mpr hpf) + have hl1 := (h.level_mem hp).2 + have h2 : p.1 = q.1 := by + have h3 := congrArg Prod.fst he + simp only [boxCollapse, ← h1] at h3 + by_contra hne + rcases lt_or_gt_of_ne hne with h4 | h4 + · have h5 := h.gmono hp.1 hq.1 h4.le + nlinarith + · have h5 := h.gmono hq.1 hp.1 h4.le + nlinarith + have hfe : f p.1 = f q.1 := by rw [h2] + obtain ⟨h3, h4⟩ := h.f1 p.1 hp.1 + have h5 : 0 < 2 - f p.1 := by linarith + have h6 := boxLevel_of_lt h hp hpf.le + have h7 := boxLevel_of_lt h hq hqf.le + rw [h1, h7, ← hfe] at h6 + have h8 : q.2 - f p.1 = p.2 - f p.1 := by + rwa [div_left_inj₀ h5.ne'] at h6 + exact Prod.ext h2 (by linarith) + +/-- Each point of the box above the bottom comes from above the graph of `f`. -/ +theorem boxCollapse_surj (h : IsCollapseData g f) {q : ℝ × ℝ} (hq : q ∈ cuffBox) + (h0 : 0 < q.2) : ∃ p ∈ cuffBox, f p.1 < p.2 ∧ boxCollapse g f p = q := by + set l := q.2 / 2 with hl + have hl0 : 0 < l := by positivity + have hl1 : l ≤ 1 := by + have := hq.2.2 + rw [hl] + linarith + let G : ℝ → ℝ := fun m => l * m + (1 - l) * g m + have hGc : ContinuousOn G (Icc 0 1) := (continuousOn_const.mul continuousOn_id).add + (continuousOn_const.mul h.gcont) + have hG0 : G 0 = 0 := by simp [G, h.g0] + have hG1 : G 1 = 1 := by simp only [G, h.g1]; ring + have hsub : Icc (G 0) (G 1) ⊆ G '' Icc 0 1 := intermediate_value_Icc zero_le_one hGc + obtain ⟨m, hm, hmq⟩ := hsub (by rw [hG0, hG1]; exact hq.1) + obtain ⟨h3, h4⟩ := h.f1 m hm + have h5 : 0 < 2 - f m := by linarith + let w := f m + l * (2 - f m) + have hw : w ∈ Icc (0 : ℝ) 2 := by + simp only [w] + constructor <;> nlinarith + have hp : (m, w) ∈ cuffBox := ⟨hm, hw⟩ + have hgt : f m < w := by + simp only [w] + nlinarith + have hlev : boxLevel f (m, w) = l := by + rw [boxLevel_of_lt h hp hgt.le] + simp only [w] + field_simp + ring + refine ⟨(m, w), hp, hgt, Prod.ext ?_ ?_⟩ + · simp only [boxCollapse, hlev] + exact hmq + · simp only [boxCollapse, hlev, hl] + ring + +end Collapse + +section System + +variable {g f : ι → ℝ → ℝ} + +/-- The bottoms of the boxes. -/ +def boxBottom (φ : ι → ℝ × ℝ → S) : Set S := ⋃ i, (fun m : ℝ => φ i (m, 0)) '' Icc 0 1 + +/-- A point of the surface that is not under the graph of `f` in any box. -/ +def IsAboveGraph (φ : ι → ℝ × ℝ → S) (f : ι → ℝ → ℝ) (x : S) : Prop := ∀ i p, p ∈ cuffBox → φ i p + = x → f i p.1 < p.2 + +theorem isBoxMap_collapse (hd : ∀ i, IsCollapseData (g i) (f i)) : IsBoxMap (fun i => boxCollapse + (g i) (f i)) sideLevel := + ⟨fun i => continuousOn_boxCollapse (hd i), fun i _ hp => boxCollapse_mem (hd i) hp, fun i _ hp h2 + => boxCollapse_top (hd i) hp h2, fun i _ _ hm _ => boxCollapse_side (hd i) hm⟩ + +/-- A point above the graph that goes to a side of the box was on that side. -/ +theorem side_of_boxCollapse {g₀ f₀ : ℝ → ℝ} (h : IsCollapseData g₀ f₀) {p : ℝ × ℝ} + (hp : p ∈ cuffBox) (hpf : f₀ p.1 < p.2) (hs : (boxCollapse g₀ f₀ p).1 = 0 ∨ + (boxCollapse g₀ f₀ p).1 = 1) : p.1 = 0 ∨ p.1 = 1 := by + have hl : 0 < boxLevel f₀ p := lt_of_le_of_ne (h.level_mem hp).1 fun h2 => absurd + ((boxLevel_eq_zero h hp).mp h2.symm) (not_le.mpr hpf) + obtain ⟨-, hl1⟩ := h.level_mem hp + obtain ⟨h3, h4⟩ := h.gmem hp.1 + obtain ⟨h5, h6⟩ := hp.1 + have h7 : 0 ≤ 1 - boxLevel f₀ p := by linarith + simp only [boxCollapse] at hs + rcases hs with hs | hs + · left + have h8 : boxLevel f₀ p * p.1 = 0 := by nlinarith [mul_nonneg h7 h3, mul_nonneg hl.le h5] + exact (mul_eq_zero.mp h8).resolve_left hl.ne' + · right + have h8 : boxLevel f₀ p * (1 - p.1) = 0 := by + nlinarith [mul_nonneg h7 (sub_nonneg.mpr h4), mul_nonneg hl.le (sub_nonneg.mpr h6)] + have := (mul_eq_zero.mp h8).resolve_left hl.ne' + linarith + +theorem sideLevel_inj {w w' : ℝ} (h1 : 1 < w) (h2 : 1 < w') (he : sideLevel w = sideLevel w') : w + = w' := by + simp only [sideLevel] at he + rw [max_eq_right (by linarith), max_eq_right (by linarith)] at he + linarith + +variable [T2Space S] + +omit [T2Space S] in +/-- The map of the surface at the end of the homotopy is one to one on the points above the graphs. +-/ +theorem IsBoxSystem.inj_above (h : IsBoxSystem φ) (hd : ∀ i, IsCollapseData (g i) (f i)) {ρ : S + → S} (hρ : ∀ i p, p ∈ cuffBox → ρ (φ i p) = φ i (boxCollapse (g i) (f i) p)) (hρ' : ∀ x, + (∀ i, x ∉ φ i '' cuffBox) → ρ x = x) {x y : S} (hx : IsAboveGraph φ f x) + (hy : IsAboveGraph φ f y) (he : ρ x = ρ y) : x = y := by + by_cases hxb : ∃ i, x ∈ φ i '' cuffBox + · obtain ⟨i, p, hp, rfl⟩ := hxb + by_cases hyb : ∃ i, y ∈ φ i '' cuffBox + · obtain ⟨i', q, hq, rfl⟩ := hyb + rw [hρ i p hp, hρ i' q hq] at he + have hpf := hx i p hp rfl + have hqf := hy i' q hq rfl + rcases h.meet i i' _ _ (boxCollapse_mem (hd i) hp) (boxCollapse_mem + (hd i') hq) he with ⟨rfl, h1⟩ | ⟨h1, h2, h3, h4⟩ + · rw [boxCollapse_inj (hd i) hp hq hpf hqf h1] + · have hm := side_of_boxCollapse (hd i) hp hpf h2 + have hm' := side_of_boxCollapse (hd i') hq hqf h3 + have hp' : p = (p.1, p.2) := rfl + have hq' : q = (q.1, q.2) := rfl + have h5 := boxCollapse_side (w := p.2) (hd i) hm + have h6 := boxCollapse_side (w := q.2) (hd i') hm' + rw [← hp'] at h5 + rw [← hq'] at h6 + rw [h5, h6] at h1 h4 + have hf1 : f i p.1 = 1 := by + rcases hm with hm | hm <;> rw [hm] + · exact (hd i).f0 + · exact (hd i).f1' + have hf2 : f i' q.1 = 1 := by + rcases hm' with hm' | hm' <;> rw [hm'] + · exact (hd i').f0 + · exact (hd i').f1' + have h7 : p.2 = q.2 := sideLevel_inj (hf1 ▸ hpf) (hf2 ▸ hqf) h1 + have h8 := h4 p.2 hp.2 + rw [hp', h8, h7] + · push Not at hyb + rw [hρ i p hp, hρ' y hyb] at he + exact absurd (mem_image_of_mem (φ i) (boxCollapse_mem (hd i) hp)) (he ▸ hyb i) + · push Not at hxb + by_cases hyb : ∃ i, y ∈ φ i '' cuffBox + · obtain ⟨i, q, hq, rfl⟩ := hyb + rw [hρ i q hq, hρ' x hxb] at he + exact absurd (mem_image_of_mem (φ i) (boxCollapse_mem (hd i) hq)) (he ▸ hxb i) + · push Not at hyb + rwa [hρ' x hxb, hρ' y hyb] at he + +omit [T2Space S] in +/-- Each point off the bottoms comes from a point above the graphs. -/ +theorem IsBoxSystem.surj_above (h : IsBoxSystem φ) (hd : ∀ i, IsCollapseData (g i) (f i)) {ρ : S + → S} (hρ : ∀ i p, p ∈ cuffBox → ρ (φ i p) = φ i (boxCollapse (g i) (f i) p)) (hρ' : ∀ x, + (∀ i, x ∉ φ i '' cuffBox) → ρ x = x) {y : S} (hy : y ∉ boxBottom φ) : ∃ x, IsAboveGraph φ f x + ∧ ρ x = y := by + by_cases hyb : ∃ i, y ∈ φ i '' cuffBox + · obtain ⟨i, q, hq, rfl⟩ := hyb + have hq0 : 0 < q.2 := by + refine lt_of_le_of_ne hq.2.1 fun h0 => hy (mem_iUnion.mpr ⟨i, q.1, hq.1, ?_⟩) + change φ i (q.1, 0) = φ i q + rw [h0] + obtain ⟨p, hp, hpf, hpe⟩ := boxCollapse_surj (hd i) hq hq0 + refine ⟨φ i p, fun i' p' hp' he => ?_, by rw [hρ i p hp, hpe]⟩ + rcases h.meet i' i p' p hp' hp he with ⟨rfl, rfl⟩ | ⟨h1, h2, h3, -⟩ + · exact hpf + · have hf1 : f i' p'.1 = 1 := by + rcases h2 with hm | hm <;> rw [hm] + · exact (hd i').f0 + · exact (hd i').f1' + have hf2 : f i p.1 = 1 := by + rcases h3 with hm | hm <;> rw [hm] + · exact (hd i).f0 + · exact (hd i).f1' + rw [hf1, h1, ← hf2] + exact hpf + · push Not at hyb + exact ⟨y, fun i p hp he => absurd (mem_image_of_mem (φ i) hp) (he ▸ hyb i), hρ' y hyb⟩ + +omit [T2Space S] in +/-- The points above the graphs do not go to the bottoms, and the other points of the boxes do. -/ +theorem IsBoxSystem.not_bottom_above (h : IsBoxSystem φ) (hd : ∀ i, IsCollapseData (g i) + (f i)) {ρ : S → S} (hρ : ∀ i p, p ∈ cuffBox → ρ (φ i p) = φ i (boxCollapse (g i) (f i) p)) + (hρ' : ∀ x, (∀ i, x ∉ φ i '' cuffBox) → ρ x = x) {x : S} (hx : IsAboveGraph φ f x) : ρ x ∉ + boxBottom φ := by + rintro hb + obtain ⟨i', m, hm, he⟩ := mem_iUnion.mp hb + have hb0 : (m, (0 : ℝ)) ∈ cuffBox := ⟨hm, by norm_num, by norm_num⟩ + by_cases hxb : ∃ i, x ∈ φ i '' cuffBox + · obtain ⟨i, p, hp, rfl⟩ := hxb + rw [hρ i p hp] at he + have hl : 0 < boxLevel (f i) p := lt_of_le_of_ne ((hd i).level_mem hp).1 fun h2 => absurd + ((boxLevel_eq_zero (hd i) hp).mp h2.symm) (not_le.mpr (hx i p hp rfl)) + have hlev : 0 < (boxCollapse (g i) (f i) p).2 := by + simp only [boxCollapse] + linarith + rcases h.meet i' i _ _ hb0 (boxCollapse_mem (hd i) hp) he with ⟨-, h1⟩ | ⟨h1, -⟩ + · rw [← h1] at hlev + simp at hlev + · simp only at h1 + linarith + · push Not at hxb + rw [hρ' x hxb] at he + exact hxb i' (he ▸ mem_image_of_mem _ hb0) + +end System + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffCells.lean b/LeanPool/GraphMinor/GM07/CuffCells.lean new file mode 100644 index 0000000000..5e7ecd7a2f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffCells.lean @@ -0,0 +1,1067 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffBoxes +public import LeanPool.GraphMinor.GM12.Section6Sides +public import LeanPool.GraphMinor.Surface.DiscPolygon + +/-! +# Cutting an annulus into cells + +Graph Minors VII, (5.9), page 235. The paths `Q_i(C)` are disjoint lines across the annulus between +the cuff `C` and the circuit `N(C)`. They cut the annulus into cells, one for each pair of +neighbouring lines. +A cell is a closed disc with its boundary in four parts: an arc of the cuff, an arc of the circuit, +and two lines. Each further line across a cell cuts it into two cells. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {T : Type u} [TopologicalSpace T] [T2Space T] + +/-- A cell of the annulus between `D` and `E`: a disc with bottom `a` on `D`, top `b` on `E`, and +sides `l` and `l'`. -/ +structure IsCell (D E R a b l l' : Set T) (x x' t t' : T) : Prop where + disc : IsClosedDisc R + bottom : IsLineWithEnds a x x' + top : IsLineWithEnds b t t' + left : IsLineWithEnds l x t + right : IsLineWithEnds l' x' t' + bd_eq : discBd R = a ∪ l' ∪ b ∪ l + al : a ∩ l = {x} + ar : a ∩ l' = {x'} + bl : b ∩ l = {t} + br : b ∩ l' = {t'} + ab : Disjoint a b + ll : Disjoint l l' + botCap : R ∩ D = a + aBd : a ⊆ discBd D + topCap : R ∩ discBd E = b + subE : R ⊆ E + +variable {D E R a b l l' : Set T} {x x' t t' : T} + +omit [T2Space T] in +/-- The mirror image of a cell. -/ +theorem IsCell.swap (h : IsCell D E R a b l l' x x' t t') : IsCell D E R a b l' l x' x t' t := + ⟨h.disc, h.bottom.symm, h.top.symm, h.right, h.left, by rw [h.bd_eq]; ac_rfl, + h.ar, h.al, h.br, h.bl, h.ab, h.ll.symm, h.botCap, h.aBd, h.topCap, h.subE⟩ + +omit [T2Space T] in +theorem IsCell.a_sub (h : IsCell D E R a b l l' x x' t t') : a ⊆ discBd R := by + rw [h.bd_eq] + exact fun z hz => .inl (.inl (.inl hz)) + +omit [T2Space T] in +theorem IsCell.b_sub (h : IsCell D E R a b l l' x x' t t') : b ⊆ discBd R := by + rw [h.bd_eq] + exact fun z hz => .inl (.inr hz) + +omit [T2Space T] in +theorem IsCell.l_sub (h : IsCell D E R a b l l' x x' t t') : l ⊆ discBd R := by + rw [h.bd_eq] + exact fun z hz => .inr hz + +omit [T2Space T] in +theorem IsCell.r_sub (h : IsCell D E R a b l l' x x' t t') : l' ⊆ discBd R := by + rw [h.bd_eq] + exact fun z hz => .inl (.inl (.inr hz)) + +omit [T2Space T] in +/-- One half of a cell cut by a line `q` from `y` on the bottom to `z` on the top. -/ +theorem IsCell.half (h : IsCell D E R a b l l' x x' t t') {q a₁ a₂ b₁ b₂ E₁ E₂ : Set T} {y z : T} + (hq : IsLineWithEnds q y z) (hqb : q ∩ discBd R = {y, z}) (hxy : x ≠ y) (ht : t ≠ z) + (ha₁ : IsLineWithEnds a₁ x y) (ha₂ : IsLineWithEnds a₂ y x') (hau : a₁ ∪ a₂ = a) (hai : a₁ ∩ a₂ + = {y}) (hb₁ : IsLineWithEnds b₁ t z) (hb₂ : IsLineWithEnds b₂ z t') (hbu : b₁ ∪ b₂ = b) + (hbi : b₁ ∩ b₂ = {z}) + (h1 : IsClosedDisc E₁) (h2 : discBd E₁ = (a₁ ∪ l ∪ b₁) ∪ q) (h2' : discBd E₂ = + (a₂ ∪ l' ∪ b₂) ∪ q) (h3 : E₁ ∪ E₂ = R) (h4 : E₁ ∩ E₂ = q) : IsCell D E E₁ a₁ b₁ l q x y t z + := by + have hyb : y ∉ b := fun hy => disjoint_left.mp h.ab (hau ▸ (Or.inr (ha₂.left_mem) : y ∈ a₁ ∪ a₂)) + hy + have hza : z ∉ a := fun hz => disjoint_left.mp h.ab hz (hbu ▸ (Or.inr + (hb₂.left_mem) : z ∈ b₁ ∪ b₂)) + have ha₁a : a₁ ⊆ a := hau ▸ subset_union_left + have ha₂a : a₂ ⊆ a := hau ▸ subset_union_right + have hb₁b : b₁ ⊆ b := hbu ▸ subset_union_left + have hb₂b : b₂ ⊆ b := hbu ▸ subset_union_right + have hE₁R : E₁ ⊆ R := h3 ▸ subset_union_left + have hqe : ∀ {w}, w ∈ q → w ∈ discBd R → w = y ∨ w = z := fun {w} h5 h6 => by + have : w ∈ q ∩ discBd R := ⟨h5, h6⟩ + rwa [hqb] at this + refine ⟨h1, ha₁, hb₁, h.left, hq, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, hE₁R.trans h.subE⟩ + · rw [h2] + ac_rfl + · refine subset_antisymm (fun w hw => ?_) ?_ + · have h5 : w ∈ a ∩ l := ⟨ha₁a hw.1, hw.2⟩ + rwa [h.al] at h5 + · rintro _ rfl + exact ⟨ha₁.left_mem, h.left.left_mem⟩ + · refine subset_antisymm (fun w hw => ?_) ?_ + · rcases hqe hw.2 (h.a_sub (ha₁a hw.1)) with rfl | rfl + · rfl + · exact absurd (ha₁a hw.1) hza + · rintro _ rfl + exact ⟨ha₁.right_mem, hq.left_mem⟩ + · refine subset_antisymm (fun w hw => ?_) ?_ + · have h5 : w ∈ b ∩ l := ⟨hb₁b hw.1, hw.2⟩ + rwa [h.bl] at h5 + · rintro _ rfl + exact ⟨hb₁.left_mem, h.left.right_mem⟩ + · refine subset_antisymm (fun w hw => ?_) ?_ + · rcases hqe hw.2 (h.b_sub (hb₁b hw.1)) with rfl | rfl + · exact absurd (hb₁b hw.1) hyb + · rfl + · rintro _ rfl + exact ⟨hb₁.right_mem, hq.right_mem⟩ + · exact h.ab.mono ha₁a hb₁b + · rw [disjoint_left] + intro w hw hwq + rcases hqe hwq (h.l_sub hw) with rfl | rfl + · have h5 : w ∈ a ∩ l := ⟨ha₂a ha₂.left_mem, hw⟩ + rw [h.al] at h5 + exact hxy h5.symm + · have h5 : w ∈ b ∩ l := ⟨hb₂b hb₂.left_mem, hw⟩ + rw [h.bl] at h5 + exact ht h5.symm + · refine subset_antisymm ?_ fun w hw => ?_ + · rintro w ⟨hw, hb⟩ + have hwa : w ∈ a := h.botCap ▸ (⟨hE₁R hw, hb⟩ : w ∈ R ∩ D) + rw [← hau] at hwa + rcases hwa with h5 | h5 + · exact h5 + · have h6 : w ∈ E₂ := Surface.discBd_subset _ (h2' ▸ .inl (.inl (.inl h5))) + rcases hqe (h4 ▸ ⟨hw, h6⟩) (h.a_sub (ha₂a h5)) with rfl | rfl + · exact ha₁.right_mem + · exact absurd (ha₂a h5) hza + · refine ⟨Surface.discBd_subset _ (h2 ▸ .inl (.inl (.inl hw))), ?_⟩ + have : w ∈ R ∩ D := h.botCap ▸ ha₁a hw + exact this.2 + · exact ha₁a.trans h.aBd + · refine subset_antisymm ?_ fun w hw => ?_ + · rintro w ⟨hw, hb⟩ + have hwa : w ∈ b := h.topCap ▸ (⟨hE₁R hw, hb⟩ : w ∈ R ∩ discBd E) + rw [← hbu] at hwa + rcases hwa with h5 | h5 + · exact h5 + · have h6 : w ∈ E₂ := Surface.discBd_subset _ (h2' ▸ .inl (.inr h5)) + rcases hqe (h4 ▸ ⟨hw, h6⟩) (h.b_sub (hb₂b h5)) with rfl | rfl + · exact absurd (hb₂b h5) hyb + · exact hb₁.right_mem + · refine ⟨Surface.discBd_subset _ (h2 ▸ .inl (.inr hw)), ?_⟩ + have : w ∈ R ∩ discBd E := h.topCap ▸ hb₁b hw + exact this.2 + +/-- A disc inside a disc with the same boundary is equal to it, since the part of the interior of +the large disc in the small one is open and closed. -/ +theorem disc_eq_of_subset_of_bd_eq (hman : ∀ x : T, IsManifoldPoint x) {A B : Set T} + (hA : IsClosedDisc A) (hB : IsClosedDisc B) (hAB : A ⊆ B) (hbd : discBd A = discBd B) : A = B + := by + refine subset_antisymm hAB ?_ + have h1 : discInt B ⊆ discInt A ∨ Disjoint (discInt B) A := hA.side hman + hB.isPreconnected_discInt (by + rw [hbd, disjoint_left] + exact fun x hx => hx.2) + rcases h1 with h1 | h1 + · intro x hx + by_cases hb : x ∈ discBd B + · exact Surface.discBd_subset _ (hbd ▸ hb) + · exact discInt_subset _ (h1 ⟨hx, hb⟩) + · obtain ⟨z, hz⟩ := hA.nonempty_discInt + exact absurd (discInt_subset _ hz) (disjoint_left.mp h1 (discInt_mono hman hA hAB hz)) + +/-- The image of a line by a map that is one to one on it is a line. -/ +theorem isLineWithEnds_image {X : Type*} [TopologicalSpace X] {Z : Set X} {a b : X} + (hl : IsLineWithEnds Z a b) {g : X → T} (hc : ContinuousOn g Z) (hi : InjOn g Z) : IsLineWithEnds + (g '' Z) (g a) (g b) := by + obtain ⟨f, h0, h1⟩ := hl + let e : unitInterval → T := fun t => g (f t).1 + have hec : Continuous e := hc.comp_continuous (continuous_subtype_val.comp f.continuous) fun t => + (f t).2 + have hei : Injective e := fun s t he => f.injective (Subtype.ext (hi (f s).2 (f t).2 he)) + have hemb := hec.isClosedEmbedding hei + have hr : range e = g '' Z := by + ext y + constructor + · rintro ⟨t, rfl⟩ + exact mem_image_of_mem g (f t).2 + · rintro ⟨z, hz, rfl⟩ + exact ⟨f.symm ⟨z, hz⟩, by simp [e]⟩ + refine ⟨hemb.isEmbedding.toHomeomorph.trans (Homeomorph.setCongr hr), ?_, ?_⟩ + · change e 0 = g a + simp only [e, h0] + · change e 1 = g b + simp only [e, h1] + +/-- A chord of a disc, by a chart from the unit disc. -/ +theorem exists_chord_any {D : Set T} (hD : IsClosedDisc D) {a b : T} (ha : a ∈ discBd D) + (hb : b ∈ discBd D) (hab : a ≠ b) : ∃ F, IsLineWithEnds F a b ∧ F ⊆ D ∧ F ∩ discBd D = {a, b} + := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hbd : ∀ x ∈ discBd D, h x ∈ sphere (0 : ℂ) 1 := fun x hx => c.bd ▸ mem_image_of_mem h hx + have hsub := Surface.discBd_subset D + have hne : h a ≠ h b := fun he => hab (by rw [← c.gh (hsub ha), ← c.gh (hsub hb), he]) + obtain ⟨hU, hUb⟩ := closedBall_disc (s := 1) one_pos + have hbU : ∀ x ∈ discBd D, h x ∈ discBd (closedBall (0 : ℂ) 1) := fun x hx => hUb ▸ hbd x hx + obtain ⟨F, hF, hFs, hFc⟩ := Surface.exists_chord hU (hbU a ha) (hbU b hb) hne + have hg : InjOn g F := fun p hp q hq he => by + rw [← c.hg (hFs hp), ← c.hg (hFs hq), he] + have hl := isLineWithEnds_image hF (c.gc.mono hFs) hg + rw [c.gh (hsub ha), c.gh (hsub hb)] at hl + refine ⟨g '' F, hl, ?_, subset_antisymm ?_ ?_⟩ + · rintro _ ⟨p, hp, rfl⟩ + exact c.gm (hFs hp) + · rintro _ ⟨⟨p, hp, rfl⟩, h1⟩ + have h2 : h (g p) ∈ discBd (closedBall (0 : ℂ) 1) := hbU _ h1 + rw [c.hg (hFs hp)] at h2 + have h3 : p ∈ F ∩ discBd (closedBall (0 : ℂ) 1) := ⟨hp, h2⟩ + rw [hFc] at h3 + rcases h3 with rfl | rfl + · exact .inl (c.gh (hsub ha)) + · exact .inr (c.gh (hsub hb)) + · rintro _ (rfl | rfl) + · exact ⟨hl.left_mem, ha⟩ + · exact ⟨hl.right_mem, hb⟩ + +/-- A line from the disc `D` to the boundary of the disc `E`. -/ +structure IsCrossLine (D E q : Set T) (x t : T) : Prop where + line : IsLineWithEnds q x t + sub : q ⊆ E + bot : q ∩ D = {x} + top : q ∩ discBd E = {t} + xbd : x ∈ discBd D + +theorem exists_mem_diff_of_line {c : Set T} {x y : T} (h : IsLineWithEnds c x y) : + (c \ {x, y}).Nonempty := by + by_contra hne + rw [not_nonempty_iff_eq_empty] at hne + have h1 := h.subset_closure_diff h.left_mem + simp [hne] at h1 + +/-- One side of the chord through `D` gives a cell, and the part of `D` on that side is the rest of +it. -/ +theorem exists_cell_of_side (hman : ∀ x : T, IsManifoldPoint x) {D E X D₁ D₂ a A B c l r : Set T} + {x x' t t' : T} (hD : D₁ ∪ D₂ = D) (hE : discBd E = A ∪ B) (hX : IsClosedDisc X) (hbd : discBd X + = A ∪ (l ∪ c ∪ r)) + (hD₁ : IsClosedDisc D₁) (hbD₁ : discBd D₁ = a ∪ c) (hs : D₁ \ c ⊆ X) (hD₂ : D₂ ∩ X ⊆ c) + (hB : X ∩ B ⊆ A) (hc : IsLineWithEnds c x x') (hac : a ∩ c = {x, x'}) + (ha : IsLineWithEnds a x x') (hA : IsLineWithEnds A t t') (hl : IsLineWithEnds l x t) + (hr : IsLineWithEnds r x' t') (hxx : x ≠ x') + (hll : Disjoint l r) (haBd : a ⊆ discBd D) (hXE : X ⊆ E) (hlD : l ∩ D = {x}) (hrD : r ∩ D + = {x'}) (hlE : l ∩ discBd E = {t}) (hrE : r ∩ discBd E = {t'}) (hDE : Disjoint D (discBd E)) : + ∃ R, IsCell D E R a A l r x x' t t' ∧ R ∪ D₁ = X := by + have hcD₁ : c ⊆ D₁ := fun z hz => Surface.discBd_subset _ (hbD₁ ▸ .inr hz) + have haD₁ : a ⊆ D₁ := fun z hz => Surface.discBd_subset _ (hbD₁ ▸ .inl hz) + have hD₁D : D₁ ⊆ D := hD ▸ subset_union_left + have hAE : A ⊆ discBd E := hE ▸ subset_union_left + have hBX : ∀ z ∈ c, z ∈ X := fun z hz => Surface.discBd_subset _ (hbd ▸ .inr (.inl (.inr hz))) + have haX : a ⊆ X := fun z hz => by + by_cases h1 : z ∈ c + · exact hBX z h1 + · exact hs ⟨haD₁ hz, h1⟩ + have hlone : ∀ {z}, z ∈ l → z ∈ D → z = x := fun {z} h1 h2 => by + have : z ∈ l ∩ D := ⟨h1, h2⟩ + rwa [hlD] at this + have hrone : ∀ {z}, z ∈ r → z ∈ D → z = x' := fun {z} h1 h2 => by + have : z ∈ r ∩ D := ⟨h1, h2⟩ + rwa [hrD] at this + have hltop : ∀ {z}, z ∈ l → z ∈ discBd E → z = t := fun {z} h1 h2 => by + have : z ∈ l ∩ discBd E := ⟨h1, h2⟩ + rwa [hlE] at this + have hrtop : ∀ {z}, z ∈ r → z ∈ discBd E → z = t' := fun {z} h1 h2 => by + have : z ∈ r ∩ discBd E := ⟨h1, h2⟩ + rwa [hrE] at this + have hxl : x ∈ l := hl.left_mem + have htl : t ∈ l := hl.right_mem + have hxr : x' ∈ r := hr.left_mem + have htr : t' ∈ r := hr.right_mem + have hxc : x ∈ c := hc.left_mem + have hxc' : x' ∈ c := hc.right_mem + have hxD : x ∈ D := hD₁D (hcD₁ hxc) + have hxD' : x' ∈ D := hD₁D (hcD₁ hxc') + have htA : t ∈ A := hA.left_mem + have htA' : t' ∈ A := hA.right_mem + have hAoff : ∀ {z}, z ∈ A → z ∉ D := fun {z} h1 h2 => disjoint_left.mp hDE h2 (hAE h1) + have hl1 : l ∩ A = {t} := subset_antisymm (fun z hz => hltop hz.1 (hAE hz.2)) (by + rintro _ rfl + exact ⟨htl, htA⟩) + have hr1 : r ∩ A = {t'} := subset_antisymm (fun z hz => hrtop hz.1 (hAE hz.2)) (by + rintro _ rfl + exact ⟨htr, htA'⟩) + have hM1 : IsLineWithEnds (l ∪ A) x t' := hl.union hA hl1 + have hM2 : IsLineWithEnds ((l ∪ A) ∪ r) x x' := hM1.union hr.symm (by + refine subset_antisymm ?_ ?_ + · rintro z ⟨h1 | h1, h2⟩ + · exact absurd h2 (disjoint_left.mp hll h1) + · exact hrtop h2 (hAE h1) + · rintro _ rfl + exact ⟨.inr htA', htr⟩) + have hMoff : ∀ {z}, z ∈ (l ∪ A) ∪ r → z ∈ D → z = x ∨ z = x' := fun {z} h1 h2 => by + rcases h1 with (h1 | h1) | h1 + · exact .inl (hlone h1 h2) + · exact absurd h2 (hAoff h1) + · exact .inr (hrone h1 h2) + have hmem : ∀ {M : Set T}, x ∈ M → x' ∈ M → ∀ {K : Set T}, K ⊆ D → x ∈ K → x' ∈ K + → M ∩ D ⊆ {x, x'} → K ∩ M = {x, x'} := fun {M} h1 h2 {K} h3 h4 h5 h6 => subset_antisymm + (fun z hz => h6 ⟨hz.2, h3 hz.1⟩) (by + rintro _ (rfl | rfl) + · exact ⟨h4, h1⟩ + · exact ⟨h5, h2⟩) + have hMsub : ((l ∪ A) ∪ r) ∩ D ⊆ {x, x'} := fun z hz => hMoff hz.1 hz.2 + have hMx : x ∈ (l ∪ A) ∪ r := .inl (.inl hxl) + have hMx' : x' ∈ (l ∪ A) ∪ r := .inr hxr + have hcD : c ⊆ D := hcD₁.trans hD₁D + have haD : a ⊆ D := haD₁.trans hD₁D + have hbdX : discBd X = c ∪ ((l ∪ A) ∪ r) := by + rw [hbd] + ac_rfl + obtain ⟨E₁, E₂, h1, h2, hu, hin, hb1, hb2⟩ := GM12.split_with_arcs hX ha hc hM2 + (hmem hMx hMx' hcD hxc hxc' hMsub) hac (hmem hMx hMx' haD ha.left_mem ha.right_mem hMsub) hbdX + haX hxx + have hE₁X : E₁ ⊆ X := hu ▸ subset_union_left + have hE₂X : E₂ ⊆ X := hu ▸ subset_union_right + have hce₁ : c ⊆ E₁ := fun z hz => Surface.discBd_subset _ (hb1 ▸ .inl hz) + have hint : discInt D₁ ⊆ X := fun z hz => by + by_cases h3 : z ∈ c + · exact hBX z h3 + · exact hs ⟨hz.1, h3⟩ + have hsub : D₁ ⊆ E₁ := by + have hd : Disjoint (discInt D₁) (E₁ ∩ E₂) := by + rw [hin, disjoint_left] + exact fun z hz h3 => hz.2 (hbD₁ ▸ .inl h3) + rcases GM12.subset_side h1.isClosed h2.isClosed hD₁.isPreconnected_discInt + (by rw [hu]; exact hint) hd with h3 | h3 + · exact hD₁.subset_closure_discInt.trans (closure_minimal h3 h1.isClosed) + · exfalso + have h4 : D₁ ⊆ E₂ := hD₁.subset_closure_discInt.trans (closure_minimal h3 h2.isClosed) + obtain ⟨z, hz, hne⟩ := exists_mem_diff_of_line hc + have h5 : z ∈ a := hin ▸ (⟨hce₁ hz, h4 (hcD₁ hz)⟩ : z ∈ E₁ ∩ E₂) + exact hne (hac ▸ (⟨h5, hz⟩ : z ∈ a ∩ c)) + have heq : D₁ = E₁ := disc_eq_of_subset_of_bd_eq hman hD₁ h1 hsub + (by rw [hbD₁, hb1]; exact union_comm _ _) + have hE₂a : E₂ ∩ D₁ = a := by + rw [heq, inter_comm] + exact hin + have hsubE : ∀ z ∈ (l ∪ A) ∪ r, z ∈ E₂ := fun z hz => Surface.discBd_subset _ (hb2 ▸ .inl hz) + have haE₂ : a ⊆ E₂ := fun z hz => Surface.discBd_subset _ (hb2 ▸ .inr hz) + refine ⟨E₂, ⟨h2, ha, hA, hl, hr, ?_, subset_antisymm (fun z hz => hlone hz.2 + (haD hz.1)) ?_, subset_antisymm (fun z hz => hrone hz.2 (haD hz.1)) ?_, hl1 ▸ inter_comm _ _, + hr1 ▸ inter_comm _ _, ?_, hll, ?_, haBd, ?_, hE₂X.trans hXE⟩, ?_⟩ + · rw [hb2] + ac_rfl + · rintro _ rfl + exact ⟨ha.left_mem, hxl⟩ + · rintro _ rfl + exact ⟨ha.right_mem, hxr⟩ + · rw [disjoint_left] + exact fun z h3 h4 => hAoff h4 (haD h3) + · refine subset_antisymm ?_ fun z hz => ⟨haE₂ hz, haD hz⟩ + rintro z ⟨h3, h4⟩ + rw [← hD] at h4 + rcases h4 with h4 | h4 + · exact hE₂a ▸ (⟨h3, h4⟩ : z ∈ E₂ ∩ D₁) + · have h5 := hD₂ ⟨h4, hE₂X h3⟩ + exact hE₂a ▸ (⟨h3, hcD₁ h5⟩ : z ∈ E₂ ∩ D₁) + · refine subset_antisymm ?_ fun z hz => ⟨hsubE z (.inl (.inr hz)), hAE hz⟩ + rintro z ⟨h3, h4⟩ + rw [hE] at h4 + rcases h4 with h4 | h4 + · exact h4 + · exact hB ⟨hE₂X h3, h4⟩ + · rw [heq, union_comm] + exact hu + +omit [T2Space T] in +/-- Two points of the chord side cannot both lie on one side. -/ +theorem not_both_sides {X Y D D₁ D₂ c : Set T} {z : T} (hman : ∀ x : T, IsManifoldPoint x) + (hDd : IsClosedDisc D) (hY : IsClosedDisc Y) (hXY : X ∩ Y ⊆ discBd Y) (hz : z ∈ c) + (hzD : z ∈ discInt D) (hcX : c ⊆ X) (hcY : c ⊆ Y) (hD : D₁ ∪ D₂ = D) (h1 : D₁ \ c ⊆ X) + (h2 : D₂ \ c ⊆ X) : False := by + have hzc : z ∈ closure (discInt Y) := hY.subset_closure_discInt (hcY hz) + obtain ⟨y, hyD, hyY⟩ := mem_closure_iff.mp hzc _ (hDd.isOpen_discInt hman) hzD + have hyX : y ∈ X := by + by_cases h3 : y ∈ c + · exact hcX h3 + · have h4 : y ∈ D₁ ∪ D₂ := hD ▸ hyD.1 + rcases h4 with h4 | h4 + · exact h1 ⟨h4, h3⟩ + · exact h2 ⟨h4, h3⟩ + exact hyY.2 (hXY ⟨hyX, hyY.1⟩) + +/-- **The first two cells.** Two lines across the annulus between `D` and `E`, joined by a chord of +`D`, cut `E` into two discs. Each holds one half of `D` and one cell. -/ +theorem exists_two_cells (hman : ∀ x : T, IsManifoldPoint x) {D E l r : Set T} {x x' t t' : T} + (hD : IsClosedDisc D) (hE : IsClosedDisc E) (hDE : D ⊆ E \ discBd E) (hl : IsCrossLine D E l x t) + (hr : IsCrossLine D E r x' t') (hll : Disjoint l r) : + ∃ R₁ R₂ a₁ a₂ b₁ b₂, IsCell D E R₁ a₁ b₁ l r x x' t t' ∧ IsCell D E R₂ a₂ b₂ l r x x' t t' + ∧ R₁ ∩ R₂ ⊆ l ∪ r ∧ a₁ ∪ a₂ = discBd D ∧ b₁ ∪ b₂ = discBd E ∧ R₁ ∪ R₂ ∪ D = E := by + have hxx : x ≠ x' := fun h => disjoint_left.mp hll hl.line.left_mem (h ▸ hr.line.left_mem) + have hxD : x ∈ D := Surface.discBd_subset _ hl.xbd + have htE : t ∈ discBd E := (hl.top ▸ (mem_singleton t) : t ∈ l ∩ discBd E).2 + have htE' : t' ∈ discBd E := (hr.top ▸ (mem_singleton t') : t' ∈ r ∩ discBd E).2 + have htt : t ≠ t' := fun h => disjoint_left.mp hll hl.line.right_mem (h ▸ hr.line.right_mem) + have hdis : Disjoint D (discBd E) := disjoint_left.mpr fun z hz h => (hDE hz).2 h + obtain ⟨c, hc, hcD, hcb⟩ := exists_chord_any hD hl.xbd hr.xbd hxx + obtain ⟨D₁, D₂, a₁, a₂, ha₁, ha₂, hau, hai, hD₁, hD₂, hDu, hDi, hbD₁, hbD₂⟩ + := GM12.split_disc hD hcD hxx hc hcb + obtain ⟨A, B, hA, hB, hu, hi⟩ := hE.isOArc_discBd.lines htE htE' htt + have hcl : l ∩ c = {x} := subset_antisymm (fun z hz => hl.bot ▸ (⟨hz.1, hcD hz.2⟩ : z ∈ l ∩ D)) + (by + rintro _ rfl + exact ⟨hl.line.left_mem, hc.left_mem⟩) + have hL₁ : IsLineWithEnds (l ∪ c) t x' := hl.line.symm.union hc hcl + have hrone : ∀ {z}, z ∈ r → z ∈ D → z = x' := fun {z} h1 h2 => by + have : z ∈ r ∩ D := ⟨h1, h2⟩ + rwa [hr.bot] at this + have hL₂ : IsLineWithEnds (l ∪ c ∪ r) t t' := hL₁.union hr.line (by + refine subset_antisymm ?_ ?_ + · rintro z ⟨h1 | h1, h2⟩ + · exact absurd h2 (disjoint_left.mp hll h1) + · exact hrone h2 (hcD h1) + · rintro _ rfl + exact ⟨.inr hc.right_mem, hr.line.left_mem⟩) + have hLE : ∀ z ∈ l ∪ c ∪ r, z ∈ discBd E → z = t ∨ z = t' := fun z hz h1 => by + rcases hz with (h2 | h2) | h2 + · have h3 : z ∈ l ∩ discBd E := ⟨h2, h1⟩ + rw [hl.top] at h3 + exact .inl h3 + · exact absurd h1 (disjoint_left.mp hdis (hcD h2)) + · have h3 : z ∈ r ∩ discBd E := ⟨h2, h1⟩ + rw [hr.top] at h3 + exact .inr h3 + have hLs : ∀ {K : Set T}, K ⊆ discBd E → t ∈ K → t' ∈ K → (l ∪ c ∪ r) ∩ K = {t, t'} + := fun {K} h1 h2 h3 => subset_antisymm (fun z hz => hLE z hz.1 (h1 hz.2)) (by + rintro _ (rfl | rfl) + · exact ⟨.inl (.inl hl.line.right_mem), h2⟩ + · exact ⟨.inr hr.line.right_mem, h3⟩) + have hAE : A ⊆ discBd E := hu ▸ subset_union_left + have hBE : B ⊆ discBd E := hu ▸ subset_union_right + have hLsub : l ∪ c ∪ r ⊆ E := union_subset (union_subset hl.sub fun z hz => (hDE + (hcD hz)).1) hr.sub + obtain ⟨X, Y, hX, hY, hun, hin, hbX, hbY⟩ := GM12.split_with_arcs hE hL₂ hA hB hi + (hLs hAE hA.left_mem hA.right_mem) (hLs hBE hB.left_mem hB.right_mem) hu.symm hLsub htt + have hXE : X ⊆ E := hun ▸ subset_union_left + have hYE : Y ⊆ E := hun ▸ subset_union_right + have hLD : ∀ z ∈ l ∪ c ∪ r, z ∈ D → z ∈ c := fun z hz h1 => by + rcases hz with (h2 | h2) | h2 + · have h3 : z ∈ l ∩ D := ⟨h2, h1⟩ + rw [hl.bot] at h3 + exact h3 ▸ hc.left_mem + · exact h2 + · exact hrone h2 h1 ▸ hc.right_mem + have hside : ∀ {K : Set T}, IsClosedDisc K → K ⊆ D → c ⊆ discBd K → K \ c ⊆ X ∨ K \ c ⊆ Y + := fun {K} h1 h2 h3 => by + refine GM12.subset_side hX.isClosed hY.isClosed ?_ + (by rw [hun]; exact fun z hz => (hDE (h2 hz.1)).1) ?_ + · refine h1.isPreconnected_discInt.subset_closure (fun z hz => ⟨hz.1, + fun h4 => hz.2 (h3 h4)⟩) fun z hz => h1.subset_closure_discInt hz.1 + · rw [hin, disjoint_left] + exact fun z hz h4 => hz.2 (hLD z h4 (h2 hz.1)) + have hcsub : c ⊆ l ∪ c ∪ r := fun z hz => .inl (.inr hz) + obtain ⟨z, hz, hne⟩ := exists_mem_diff_of_line hc + have hzD : z ∈ discInt D := ⟨hcD hz, fun h1 => hne (hcb ▸ (⟨hz, h1⟩ : z ∈ c ∩ discBd D))⟩ + have hLX : l ∪ c ∪ r ⊆ X := fun z hz => Surface.discBd_subset _ (hbX ▸ .inr hz) + have hLY : l ∪ c ∪ r ⊆ Y := fun z hz => Surface.discBd_subset _ (hbY ▸ .inr hz) + have hcX := hcsub.trans hLX + have hcY := hcsub.trans hLY + have hXYb : X ∩ Y ⊆ discBd Y := fun z hz => hbY ▸ .inr (hin ▸ hz) + have hYXb : Y ∩ X ⊆ discBd X := fun z hz => hbX ▸ .inr (hin ▸ (inter_comm X Y) ▸ hz) + have hD₁D : D₁ ⊆ D := hDu ▸ subset_union_left + have hD₂D : D₂ ⊆ D := hDu ▸ subset_union_right + have hcb₁ : c ⊆ discBd D₁ := fun z hz => hbD₁ ▸ .inr hz + have hcb₂ : c ⊆ discBd D₂ := fun z hz => hbD₂ ▸ .inr hz + -- The two halves of `D` lie on different sides. + have key : ∀ {X Y A B D₁ D₂ a₁ a₂ : Set T}, IsClosedDisc X → IsClosedDisc Y → X ∩ Y = l ∪ c ∪ r + → discBd X = A ∪ (l ∪ c ∪ r) → discBd Y = B ∪ (l ∪ c ∪ r) → IsLineWithEnds A t t' + → IsLineWithEnds B t t' → discBd E = A ∪ B → X ∪ Y = E → IsClosedDisc D₁ → IsClosedDisc D₂ + → D₁ ∪ D₂ = D → D₁ \ c ⊆ X → D₂ \ c ⊆ Y → discBd D₁ = a₁ ∪ c → discBd D₂ = a₂ ∪ c → a₁ ∩ c + = {x, x'} → a₂ ∩ c = {x, x'} → IsLineWithEnds a₁ x x' → IsLineWithEnds a₂ x x' + → a₁ ⊆ discBd D → a₂ ⊆ discBd D → ∃ R₁ R₂, IsCell D E R₁ a₁ A l r x x' t t' + ∧ IsCell D E R₂ a₂ B l r x x' t t' ∧ R₁ ∪ D₁ = X ∧ R₂ ∪ D₂ = Y := by + intro X Y A B D₁ D₂ a₁ a₂ hX hY hin hbX hbY hA hB hE' hun hD₁ hD₂ hDu h1 h2 hbD₁ hbD₂ hac₁ hac₂ + ha₁ ha₂ haB₁ haB₂ + have hXE : X ⊆ E := hun ▸ subset_union_left + have hYE : Y ⊆ E := hun ▸ subset_union_right + have hXYc : ∀ w ∈ X, w ∈ Y → w ∈ l ∪ c ∪ r := fun w h3 h4 => hin ▸ ⟨h3, h4⟩ + obtain ⟨R₁, hR₁, hu₁⟩ := exists_cell_of_side hman hDu hE' hX hbX hD₁ hbD₁ h1 (fun w hw => by + by_cases h3 : w ∈ c + · exact h3 + · exact hLD w (hXYc w hw.2 (h2 ⟨hw.1, h3⟩)) (hDu ▸ .inr hw.1)) (fun w hw => by + have h3 : w ∈ l ∪ c ∪ r := hXYc w hw.1 (Surface.discBd_subset _ (hbY ▸ .inl hw.2)) + have h4 := hLE w h3 (hE' ▸ .inr hw.2) + rcases h4 with rfl | rfl + · exact hA.left_mem + · exact hA.right_mem) hc hac₁ ha₁ hA hl.line hr.line hxx hll haB₁ hXE hl.bot hr.bot hl.top + hr.top hdis + obtain ⟨R₂, hR₂, hu₂⟩ := exists_cell_of_side hman + (by rw [union_comm]; exact hDu) (by rw [union_comm]; exact hE') hY hbY hD₂ hbD₂ h2 + (fun w hw => by + by_cases h3 : w ∈ c + · exact h3 + · exact hLD w (hXYc w (h1 ⟨hw.1, h3⟩) hw.2) (hDu ▸ .inl hw.1)) (fun w hw => by + have h3 : w ∈ l ∪ c ∪ r := hXYc w (Surface.discBd_subset _ (hbX ▸ .inl hw.2)) hw.1 + have h4 := hLE w h3 (hE' ▸ .inl hw.2) + rcases h4 with rfl | rfl + · exact hB.left_mem + · exact hB.right_mem) hc hac₂ ha₂ hB hl.line hr.line hxx hll haB₂ hYE hl.bot hr.bot hl.top + hr.top hdis + exact ⟨R₁, R₂, hR₁, hR₂, hu₁, hu₂⟩ + have hac : ∀ {M : Set T}, M ⊆ discBd D → x ∈ M → x' ∈ M → M ∩ c = {x, x'} := fun {M} h1 h2 h3 + => subset_antisymm (fun w hw => hcb ▸ (⟨hw.2, h1 hw.1⟩ : w ∈ c ∩ discBd D)) (by + rintro _ (rfl | rfl) + · exact ⟨h2, hc.left_mem⟩ + · exact ⟨h3, hc.right_mem⟩) + have hac₁ := hac (hau ▸ subset_union_left) ha₁.left_mem ha₁.right_mem + have hac₂ := hac (hau ▸ subset_union_right) ha₂.left_mem ha₂.right_mem + have hfinal : ∀ {R₁ R₂ D₁ D₂ X Y : Set T}, R₁ ∪ D₁ = X → R₂ ∪ D₂ = Y → D₁ ∪ D₂ = D → X ∩ Y + = l ∪ c ∪ r → X ∪ Y = E → (R₁ ∩ D = a₁ ∨ True) → R₁ ∩ D ⊆ discBd D → R₂ ∩ D ⊆ discBd D + → R₁ ∩ R₂ ⊆ l ∪ r ∧ R₁ ∪ R₂ ∪ D = E := by + intro R₁ R₂ D₁ D₂ X Y h1 h2 h3 h4 h5 _ h6 h7 + constructor + · intro w hw + have h8 : w ∈ X ∩ Y := ⟨h1 ▸ .inl hw.1, h2 ▸ .inl hw.2⟩ + rw [h4] at h8 + rcases h8 with (h9 | h9) | h9 + · exact .inl h9 + · have h10 : w ∈ c ∩ discBd D := ⟨h9, h6 ⟨hw.1, hcD h9⟩⟩ + rw [hcb] at h10 + rcases h10 with rfl | rfl + · exact .inl hl.line.left_mem + · exact .inr hr.line.left_mem + · exact .inr h9 + · rw [← h5, ← h1, ← h2, ← h3] + ac_rfl + rcases hside hD₁ hD₁D hcb₁ with h1 | h1 <;> rcases hside hD₂ hD₂D hcb₂ with h2 | h2 + · exact (not_both_sides hman hD hY hXYb hz hzD hcX hcY hDu h1 h2).elim + · obtain ⟨R₁, R₂, hR₁, hR₂, hu₁, hu₂⟩ := key hX hY hin hbX hbY hA hB hu.symm hun hD₁ hD₂ hDu h1 + h2 hbD₁ hbD₂ hac₁ hac₂ ha₁ ha₂ (hau ▸ subset_union_left) (hau ▸ subset_union_right) + obtain ⟨h3, h4⟩ := hfinal hu₁ hu₂ hDu hin hun (.inr trivial) (fun w hw => hau ▸ .inl + (hR₁.botCap ▸ hw)) (fun w hw => hau ▸ .inr (hR₂.botCap ▸ hw)) + exact ⟨R₁, R₂, a₁, a₂, A, B, hR₁, hR₂, h3, hau, hu, h4⟩ + · obtain ⟨R₁, R₂, hR₁, hR₂, hu₁, hu₂⟩ := key hX hY hin hbX hbY hA hB hu.symm hun hD₂ hD₁ + (by rw [union_comm]; exact hDu) h2 h1 hbD₂ hbD₁ hac₂ hac₁ ha₂ ha₁ + (hau ▸ subset_union_right) (hau ▸ subset_union_left) + obtain ⟨h3, h4⟩ := hfinal hu₁ hu₂ (by rw [union_comm]; exact hDu) hin hun (.inr trivial) + (fun w hw => hau ▸ .inr (hR₁.botCap ▸ hw)) (fun w hw => hau ▸ .inl (hR₂.botCap ▸ hw)) + exact ⟨R₁, R₂, a₂, a₁, A, B, hR₁, hR₂, h3, by rw [union_comm]; exact hau, hu, h4⟩ + · exact (not_both_sides hman hD hX hYXb hz hzD hcY hcX hDu h1 h2).elim + +/-- A cell of a family: its disc, its bottom and top arcs, and the indices of its two sides. -/ +structure CellRec (T : Type u) (ι : Type*) where + /-- The closed disc of the cell. -/ + R : Set T + /-- The bottom boundary arc on the inner disc. -/ + a : Set T + /-- The top boundary arc on the outer disc. -/ + b : Set T + /-- The index of the left side. -/ + i : ι + /-- The index of the right side. -/ + i' : ι + +/-- The cells of the annulus between `D` and `E` cut by the lines with index in `s`. -/ +structure IsCellFamily {ι : Type*} (D E : Set T) (q : ι → Set T) (x t : ι → T) (s : Set ι) (F : Set + (CellRec T ι)) : Prop where + finite : F.Finite + cell : ∀ c ∈ F, IsCell D E c.R c.a c.b (q c.i) (q c.i') (x c.i) (x c.i') (t c.i) (t c.i') + meet : ∀ c ∈ F, ∀ c' ∈ F, c ≠ c' → ∀ w, w ∈ c.R → w ∈ c'.R → ∃ k, (k = c.i ∨ k = c.i') ∧ (k + = c'.i ∨ k = c'.i') ∧ w ∈ q k + cover : ∀ w ∈ E, w ∈ D ∨ ∃ c ∈ F, w ∈ c.R + botCover : ∀ w ∈ discBd D, ∃ c ∈ F, w ∈ c.a + topCover : ∀ w ∈ discBd E, ∃ c ∈ F, w ∈ c.b + side : ∀ c ∈ F, c.i ∈ s ∧ c.i' ∈ s + used : ∀ k ∈ s, ∃ c ∈ F, c.i = k ∨ c.i' = k + +section Family + +variable {ι : Type*} {q : ι → Set T} {x t : ι → T} + +private theorem inserted_line_interior_avoids_cell_boundary + {T : Type u} + [TopologicalSpace T] + {D : Set T} + {E : Set T} + {ι : Type*} + {q : ι → Set T} + {x : ι → T} + {t : ι → T} + {s : Set ι} + {F : Set (CellRec T ι)} + (h : IsCellFamily D E q x t s F) + {j : ι} + (hoff : ∀ k ∈ s, ∀ {w : T}, w ∈ q j → w ∉ q k) + (hqD : ∀ {w : T}, w ∈ q j → w ∈ D → w = x j) + (hqE : ∀ {w : T}, w ∈ q j → w ∈ discBd E → w = t j) + (hbE : ∀ c ∈ F, ∀ {w : T}, w ∈ c.b → w ∈ discBd E) + (haD : ∀ c ∈ F, ∀ {w : T}, w ∈ c.a → w ∈ D) : + let Z : Set T := q j \ {x j, t j} + ∀ (c : CellRec T ι), + (c ∈ F) → + Disjoint Z (discBd c.R) := by + intro Z c hc + rw [disjoint_left] + rintro w ⟨h1, h2⟩ h3 + rw [(h.cell c hc).bd_eq] at h3 + rcases h3 with ((h3 | h3) | h3) | h3 + · exact h2 (.inl (hqD h1 (haD c hc h3))) + · exact hoff _ (h.side c hc).2 h1 h3 + · exact h2 (.inr (hqE h1 (hbE c hc h3))) + · exact hoff _ (h.side c hc).1 h1 h3 + +private theorem inserted_line_interior_stays_in_cell + {T : Type u} + [TopologicalSpace T] + [T2Space T] + {D : Set T} + {E : Set T} + {ι : Type*} + {q : ι → Set T} + {x : ι → T} + {t : ι → T} + (hman : ∀ (x : T), IsManifoldPoint x) + {s : Set ι} + {F : Set (CellRec T ι)} + (h : IsCellFamily D E q x t s F) + (hq : ∀ (k : ι), IsCrossLine D E (q k) (x k) (t k)) + {j : ι} + (hoff : ∀ k ∈ s, ∀ {w : T}, w ∈ q j → w ∉ q k) + (hqD : ∀ {w : T}, w ∈ q j → w ∈ D → w = x j) + (c₀ : CellRec T ι) + (hc₀ : c₀ ∈ F) + (hxa : x j ∈ c₀.a) + (hcell : IsCell D E c₀.R c₀.a c₀.b (q c₀.i) (q c₀.i') (x c₀.i) (x c₀.i') (t c₀.i) (t c₀.i')) + (hs₁ : c₀.i ∈ s) + (hs₂ : c₀.i' ∈ s) : + let Z : Set T := q j \ {x j, t j} + (∀ c ∈ F, Disjoint Z (discBd c.R)) → + Z ⊆ discInt c₀.R := by + intro Z hZbd + rcases hcell.disc.side hman (hq j).line.isPreconnected_diff (hZbd c₀ hc₀) with h1 | h1 + · exact h1 + · exfalso + have hcl : IsClosed (⋃ c ∈ F \ {c₀}, c.R) := (h.finite.subset sdiff_subset).isClosed_biUnion + fun c hc => (h.cell c hc.1).disc.isClosed + have hsub : Z ⊆ ⋃ c ∈ F \ {c₀}, c.R := fun w hw => by + have hwD : w ∉ D := fun h2 => hw.2 (.inl (hqD hw.1 h2)) + rcases h.cover w ((hq j).sub hw.1) with h2 | ⟨c, hc, h2⟩ + · exact absurd h2 hwD + · refine mem_iUnion₂.mpr ⟨c, ⟨hc, ?_⟩, h2⟩ + rintro rfl + exact disjoint_left.mp h1 hw h2 + have h2 : x j ∈ ⋃ c ∈ F \ {c₀}, c.R := closure_minimal hsub hcl + ((hq j).line.subset_closure_diff (hq j).line.left_mem) + obtain ⟨c, hc, h3⟩ := mem_iUnion₂.mp h2 + have hne' : c₀ ≠ c := fun he => hc.2 he.symm + obtain ⟨k, hk, -, h4⟩ := h.meet c₀ hc₀ c hc.1 hne' _ (hcell.a_sub hxa |> + Surface.discBd_subset _) h3 + have hks : k ∈ s := by + rcases hk with rfl | rfl + · exact hs₁ + · exact hs₂ + exact hoff k hks (hq j).line.left_mem h4 + +private theorem right_end_on_cell_top + {T : Type u} + [TopologicalSpace T] + {D : Set T} + {E : Set T} + {ι : Type*} + {q : ι → Set T} + {x : ι → T} + {t : ι → T} + (hq : ∀ (k : ι), IsCrossLine D E (q k) (x k) (t k)) + {j : ι} + (c₀ : CellRec T ι) + (hcell : IsCell D E c₀.R c₀.a c₀.b (q c₀.i) (q c₀.i') (x c₀.i) (x c₀.i') (t c₀.i) (t c₀.i')) + (hqR : q j ⊆ c₀.R) : + t j ∈ c₀.b := by + have h1 : t j ∈ c₀.R ∩ discBd E := ⟨hqR (hq j).line.right_mem, by + have h2 : t j ∈ q j ∩ discBd E := by + rw [(hq j).top] + rfl + exact h2.2⟩ + rwa [hcell.topCap] at h1 + +private theorem split_cell_arcs_meet_only_at_new_ends + {T : Type u} + [TopologicalSpace T] + {ι : Type*} + {x : ι → T} + {t : ι → T} + {j : ι} + (c₀ : CellRec T ι) + (hx₁ : x j ≠ x c₀.i) + (hx₂ : x j ≠ x c₀.i') + (ht₁ : t j ≠ t c₀.i) + (ht₂ : t j ≠ t c₀.i') + (a₁ : Set T) + (a₂ : Set T) + (ha₁ : IsLineWithEnds a₁ (x c₀.i) (x j)) + (ha₂ : IsLineWithEnds a₂ (x j) (x c₀.i')) + (b₁ : Set T) + (b₂ : Set T) + (hb₁ : IsLineWithEnds b₁ (t c₀.i) (t j)) + (hb₂ : IsLineWithEnds b₂ (t j) (t c₀.i')) + (ha₁s : a₁ ⊆ c₀.a) + (ha₂s : a₂ ⊆ c₀.a) + (hb₁s : b₁ ⊆ c₀.b) + (hb₂s : b₂ ⊆ c₀.b) + (l : Set T) + (r : Set T) + (hal : ∀ {w : T}, w ∈ c₀.a → w ∈ l → w = x c₀.i) + (har : ∀ {w : T}, w ∈ c₀.a → w ∈ r → w = x c₀.i') + (hbl : ∀ {w : T}, w ∈ c₀.b → w ∈ l → w = t c₀.i) + (hbr : ∀ {w : T}, w ∈ c₀.b → w ∈ r → w = t c₀.i') + (hab : ∀ {w : T}, w ∈ c₀.a → w ∉ c₀.b) + (hlr : ∀ {w : T}, w ∈ l → w ∉ r) + (ha₁₂ : ∀ {w : T}, w ∈ a₁ → w ∈ a₂ → w = x j) + (hb₁₂ : ∀ {w : T}, w ∈ b₁ → w ∈ b₂ → w = t j) : + (a₁ ∪ l ∪ b₁) ∩ (a₂ ∪ r ∪ b₂) = {x j, t j} := by + refine subset_antisymm ?_ ?_ + · rintro w ⟨(h1 | h1) | h1, (h2 | h2) | h2⟩ + · exact .inl (ha₁₂ h1 h2) + · have h3 := har (ha₁s h1) h2 + exact absurd (ha₁₂ (h3 ▸ h1) ha₂.right_mem) hx₂.symm + · exact absurd (hb₂s h2) (hab (ha₁s h1)) + · have h3 := hal (ha₂s h2) h1 + exact absurd (ha₁₂ ha₁.left_mem (h3 ▸ h2)) hx₁.symm + · exact absurd h2 (hlr h1) + · have h3 := hbl (hb₂s h2) h1 + exact absurd (hb₁₂ hb₁.left_mem (h3 ▸ h2)) ht₁.symm + · exact absurd (hb₁s h1) (hab (ha₂s h2)) + · have h3 := hbr (hb₁s h1) h2 + exact absurd (hb₁₂ (h3 ▸ h1) hb₂.right_mem) ht₂.symm + · exact .inr (hb₁₂ h1 h2) + · rintro _ (rfl | rfl) + · exact ⟨.inl (.inl ha₁.right_mem), .inl (.inl ha₂.left_mem)⟩ + · exact ⟨.inr hb₁.right_mem, .inr hb₂.left_mem⟩ + +private theorem inserted_line_meets_boundary_route_only_at_ends + {T : Type u} + [TopologicalSpace T] + {D : Set T} + {E : Set T} + {ι : Type*} + {q : ι → Set T} + {x : ι → T} + {t : ι → T} + {s : Set ι} + {F : Set (CellRec T ι)} + (hq : ∀ (k : ι), IsCrossLine D E (q k) (x k) (t k)) + {j : ι} + (hoff : ∀ k ∈ s, ∀ {w : T}, w ∈ q j → w ∉ q k) + (hqD : ∀ {w : T}, w ∈ q j → w ∈ D → w = x j) + (hqE : ∀ {w : T}, w ∈ q j → w ∈ discBd E → w = t j) + (c₀ : CellRec T ι) + (hc₀ : c₀ ∈ F) + (hbE : ∀ c ∈ F, ∀ {w : T}, w ∈ c.b → w ∈ discBd E) + (haD : ∀ c ∈ F, ∀ {w : T}, w ∈ c.a → w ∈ D) + {A₀ : Set T} + {B₀ : Set T} + (h1 : A₀ ⊆ c₀.a) + (h2 : B₀ ⊆ c₀.b) + (k : ι) + (hk : k ∈ s) + (h3 : x j ∈ A₀) + (h4 : t j ∈ B₀) : + q j ∩ (A₀ ∪ q k ∪ B₀) = {x j, t j} := by + refine subset_antisymm ?_ ?_ + · rintro w ⟨h5, (h6 | h6) | h6⟩ + · exact .inl (hqD h5 (haD c₀ hc₀ (h1 h6))) + · exact absurd h6 (hoff k hk h5) + · exact .inr (hqE h5 (hbE c₀ hc₀ (h2 h6))) + · rintro _ (rfl | rfl) + · exact ⟨(hq j).line.left_mem, .inl (.inl h3)⟩ + · exact ⟨(hq j).line.right_mem, .inr h4⟩ + +/-- A further line across the annulus lies in one cell, and it cuts that cell into two. -/ +theorem IsCellFamily.insert (hman : ∀ x : T, IsManifoldPoint x) {s : Set ι} {F : Set (CellRec T ι)} + (h : IsCellFamily D E q x t s F) (hDE : Disjoint D (discBd E)) (hq : ∀ k, IsCrossLine D E (q k) + (x k) (t k)) (hdis : ∀ k k', k ≠ k' → Disjoint (q k) (q k')) {j : ι} + (hj : j ∉ s) : ∃ F', IsCellFamily D E q x t (insert j s) F' := by + classical + have hne : ∀ k ∈ s, k ≠ j := fun k hk he => hj (he ▸ hk) + have hoff : ∀ k ∈ s, ∀ {w}, w ∈ q j → w ∉ q k := fun k hk {w} h1 h2 => disjoint_left.mp (hdis k j + (hne k hk)) h2 h1 + have hxt : x j ≠ t j := fun he => disjoint_left.mp hDE (Surface.discBd_subset _ (hq j).xbd) (by + have h1 : t j ∈ q j ∩ discBd E := by + rw [(hq j).top] + rfl + exact he ▸ h1.2) + have hqD : ∀ {w}, w ∈ q j → w ∈ D → w = x j := fun {w} h1 h2 => by + have h3 : w ∈ q j ∩ D := ⟨h1, h2⟩ + rwa [(hq j).bot] at h3 + have hqE : ∀ {w}, w ∈ q j → w ∈ discBd E → w = t j := fun {w} h1 h2 => by + have h3 : w ∈ q j ∩ discBd E := ⟨h1, h2⟩ + rwa [(hq j).top] at h3 + obtain ⟨c₀, hc₀, hxa⟩ := h.botCover _ (hq j).xbd + have hcell := h.cell c₀ hc₀ + obtain ⟨hs₁, hs₂⟩ := h.side c₀ hc₀ + have hbE : ∀ c ∈ F, ∀ {w}, w ∈ c.b → w ∈ discBd E := fun c hc {w} h1 => by + have h2 : w ∈ c.R ∩ discBd E := by + rw [(h.cell c hc).topCap] + exact h1 + exact h2.2 + have haD : ∀ c ∈ F, ∀ {w}, w ∈ c.a → w ∈ D := fun c hc {w} h1 => by + have h2 : w ∈ c.R ∩ D := by + rw [(h.cell c hc).botCap] + exact h1 + exact h2.2 + set Z := q j \ {x j, t j} with hZ + have hZbd : ∀ c ∈ F, Disjoint Z (discBd c.R) := fun c hc => by + exact inserted_line_interior_avoids_cell_boundary (T := T) (D := D) (E := E) (ι := ι) (q := q) + (x := x) (t := t) (s := s) (F := F) h (j := j) hoff hqD hqE hbE haD c hc + have hZin : Z ⊆ discInt c₀.R := by + exact inserted_line_interior_stays_in_cell (T := T) (D := D) (E := E) (ι := ι) (q := q) (x := + x) (t := t) hman (s := s) (F := F) h hq (j := j) hoff hqD c₀ hc₀ hxa hcell hs₁ hs₂ hZbd + have hqR : q j ⊆ c₀.R := fun w hw => closure_minimal (hZin.trans (discInt_subset _)) + hcell.disc.isClosed ((hq j).line.subset_closure_diff hw) + have htb : t j ∈ c₀.b := by + exact right_end_on_cell_top (T := T) (D := D) (E := E) (ι := ι) (q := q) (x := x) (t := t) hq + (j := j) c₀ hcell hqR + have hend : ∀ k ∈ s, ∀ {w}, w ∈ q k → w ∉ q j := fun k hk {w} h1 h2 => hoff k hk h2 h1 + have hx₁ : x j ≠ x c₀.i := fun he => hoff _ hs₁ (hq j).line.left_mem (he ▸ (hq _).line.left_mem) + have hx₂ : x j ≠ x c₀.i' := fun he => hoff _ hs₂ (hq j).line.left_mem (he ▸ (hq _).line.left_mem) + have ht₁ : t j ≠ t c₀.i := fun he => hoff _ hs₁ (hq j).line.right_mem (he ▸ (hq _).line.right_mem) + have ht₂ : t j ≠ t c₀.i' := fun he => hoff _ hs₂ (hq j).line.right_mem (he ▸ + (hq _).line.right_mem) + obtain ⟨a₁, a₂, ha₁, ha₂, hau, hai⟩ := hcell.bottom.split hxa hx₁ hx₂ + obtain ⟨b₁, b₂, hb₁, hb₂, hbu, hbi⟩ := hcell.top.split htb ht₁ ht₂ + have ha₁s : a₁ ⊆ c₀.a := hau ▸ subset_union_left + have ha₂s : a₂ ⊆ c₀.a := hau ▸ subset_union_right + have hb₁s : b₁ ⊆ c₀.b := hbu ▸ subset_union_left + have hb₂s : b₂ ⊆ c₀.b := hbu ▸ subset_union_right + set l := q c₀.i with hl + set r := q c₀.i' with hr + have hal : ∀ {w}, w ∈ c₀.a → w ∈ l → w = x c₀.i := fun {w} h1 h2 => by + have h3 : w ∈ c₀.a ∩ l := ⟨h1, h2⟩ + rwa [hcell.al] at h3 + have har : ∀ {w}, w ∈ c₀.a → w ∈ r → w = x c₀.i' := fun {w} h1 h2 => by + have h3 : w ∈ c₀.a ∩ r := ⟨h1, h2⟩ + rwa [hcell.ar] at h3 + have hbl : ∀ {w}, w ∈ c₀.b → w ∈ l → w = t c₀.i := fun {w} h1 h2 => by + have h3 : w ∈ c₀.b ∩ l := ⟨h1, h2⟩ + rwa [hcell.bl] at h3 + have hbr : ∀ {w}, w ∈ c₀.b → w ∈ r → w = t c₀.i' := fun {w} h1 h2 => by + have h3 : w ∈ c₀.b ∩ r := ⟨h1, h2⟩ + rwa [hcell.br] at h3 + have hab : ∀ {w}, w ∈ c₀.a → w ∉ c₀.b := fun {w} h1 h2 => disjoint_left.mp hcell.ab h1 h2 + have hlr : ∀ {w}, w ∈ l → w ∉ r := fun {w} h1 h2 => disjoint_left.mp hcell.ll h1 h2 + have ha₁₂ : ∀ {w}, w ∈ a₁ → w ∈ a₂ → w = x j := fun {w} h1 h2 => by + have h3 : w ∈ a₁ ∩ a₂ := ⟨h1, h2⟩ + rwa [hai] at h3 + have hb₁₂ : ∀ {w}, w ∈ b₁ → w ∈ b₂ → w = t j := fun {w} h1 h2 => by + have h3 : w ∈ b₁ ∩ b₂ := ⟨h1, h2⟩ + rwa [hbi] at h3 + -- The two arcs of the boundary of the cell between the ends of the line. + have hM₁a : IsLineWithEnds (a₁ ∪ l) (x j) (t c₀.i) := ha₁.symm.union hcell.left (subset_antisymm + (fun w hw => hal (ha₁s hw.1) hw.2) (by + rintro _ rfl + exact ⟨ha₁.left_mem, hcell.left.left_mem⟩)) + have hM₁ : IsLineWithEnds ((a₁ ∪ l) ∪ b₁) (x j) (t j) := hM₁a.union hb₁ (subset_antisymm (by + rintro w ⟨h1 | h1, h2⟩ + · exact absurd (hb₁s h2) (hab (ha₁s h1)) + · exact hbl (hb₁s h2) h1) (by + rintro _ rfl + exact ⟨.inr hcell.left.right_mem, hb₁.left_mem⟩)) + have hM₂a : IsLineWithEnds (a₂ ∪ r) (x j) (t c₀.i') := ha₂.union hcell.right (subset_antisymm + (fun w hw => har (ha₂s hw.1) hw.2) (by + rintro _ rfl + exact ⟨ha₂.right_mem, hcell.right.left_mem⟩)) + have hM₂ : IsLineWithEnds ((a₂ ∪ r) ∪ b₂) (x j) (t j) := hM₂a.union hb₂.symm (subset_antisymm (by + rintro w ⟨h1 | h1, h2⟩ + · exact absurd (hb₂s h2) (hab (ha₂s h1)) + · exact hbr (hb₂s h2) h1) (by + rintro _ rfl + exact ⟨.inr hcell.right.right_mem, hb₂.right_mem⟩)) + have hM₁₂ : ((a₁ ∪ l) ∪ b₁) ∩ ((a₂ ∪ r) ∪ b₂) = {x j, t j} := by + exact split_cell_arcs_meet_only_at_new_ends (T := T) (ι := ι) (x := x) (t := t) (j := j) c₀ + hx₁ hx₂ ht₁ ht₂ a₁ a₂ ha₁ ha₂ b₁ b₂ hb₁ hb₂ ha₁s ha₂s hb₁s hb₂s l r hal har hbl hbr hab hlr + ha₁₂ hb₁₂ + have hqM : ∀ {A₀ B₀ : Set T}, A₀ ⊆ c₀.a → B₀ ⊆ c₀.b → ∀ k ∈ s, x j ∈ A₀ → t j ∈ B₀ → q j ∩ + ((A₀ ∪ q k) ∪ B₀) = {x j, t j} := fun {A₀ B₀} h1 h2 k hk h3 h4 => by + exact inserted_line_meets_boundary_route_only_at_ends (T := T) (D := D) (E := E) (ι := ι) (q + := q) (x := x) (t := t) (s := s) (F := F) hq (j := j) hoff hqD hqE c₀ hc₀ hbE haD (A₀ := A₀) + (B₀ := B₀) h1 h2 k hk h3 h4 + have hqM₁ := hqM ha₁s hb₁s c₀.i hs₁ ha₁.right_mem hb₁.right_mem + have hqM₂ := hqM ha₂s hb₂s c₀.i' hs₂ ha₂.left_mem hb₂.left_mem + have hbdR : discBd c₀.R = ((a₁ ∪ l) ∪ b₁) ∪ ((a₂ ∪ r) ∪ b₂) := by + rw [hcell.bd_eq, ← hau, ← hbu] + ac_rfl + obtain ⟨E₁, E₂, h1, h2, hu, hin, hb1, hb2⟩ := GM12.split_with_arcs hcell.disc + (hq j).line hM₁ hM₂ hM₁₂ hqM₁ hqM₂ hbdR hqR hxt + have hqb : q j ∩ discBd c₀.R = {x j, t j} := by + rw [hbdR, inter_union_distrib_left, hqM₁, hqM₂, union_self] + have hcell₁ : IsCell D E E₁ a₁ b₁ l (q j) (x c₀.i) (x j) (t c₀.i) (t j) := hcell.half + (hq j).line hqb hx₁.symm ht₁.symm ha₁ ha₂ hau hai hb₁ hb₂ hbu hbi h1 hb1 hb2 hu hin + have hcell₂ : IsCell D E E₂ a₂ b₂ (q j) r (x j) (x c₀.i') (t j) (t c₀.i') := + (hcell.swap.half (hq j).line hqb hx₂.symm ht₂.symm + ha₂.symm ha₁.symm (by rw [union_comm]; exact hau) (by rw [inter_comm]; exact hai) hb₂.symm + hb₁.symm (by rw [union_comm]; exact hbu) (by rw [inter_comm]; exact hbi) h2 hb2 hb1 + (by rw [union_comm]; exact hu) (by rw [inter_comm]; exact hin)).swap + have hE₁R : E₁ ⊆ c₀.R := hu ▸ subset_union_left + have hE₂R : E₂ ⊆ c₀.R := hu ▸ subset_union_right + have hlE₁ : l ⊆ E₁ := hcell₁.l_sub.trans (Surface.discBd_subset _) + have hrE₂ : r ⊆ E₂ := hcell₂.r_sub.trans (Surface.discBd_subset _) + let c₁ : CellRec T ι := ⟨E₁, a₁, b₁, c₀.i, j⟩ + let c₂ : CellRec T ι := ⟨E₂, a₂, b₂, j, c₀.i'⟩ + have hin' : ∀ {w}, w ∈ E₁ → w ∈ E₂ → w ∈ q j := fun {w} h3 h4 => hin ▸ (⟨h3, h4⟩ : w ∈ E₁ ∩ E₂) + have hc₁ : ∀ c ∈ F, c ≠ c₀ → ∀ w, w ∈ E₁ → w ∈ c.R → ∃ k, (k = c₀.i ∨ k = j) ∧ (k = c.i ∨ k + = c.i') ∧ w ∈ q k := fun c hc hne w h3 h4 => by + obtain ⟨k, hk, hk', hw⟩ := h.meet c₀ hc₀ c hc hne.symm w (hE₁R h3) h4 + rcases hk with rfl | rfl + · exact ⟨_, .inl rfl, hk', hw⟩ + · exact absurd (hin' h3 (hrE₂ hw)) (hend _ hs₂ hw) + have hc₂ : ∀ c ∈ F, c ≠ c₀ → ∀ w, w ∈ E₂ → w ∈ c.R → ∃ k, (k = j ∨ k = c₀.i') ∧ (k = c.i ∨ k + = c.i') ∧ w ∈ q k := fun c hc hne w h3 h4 => by + obtain ⟨k, hk, hk', hw⟩ := h.meet c₀ hc₀ c hc hne.symm w (hE₂R h3) h4 + rcases hk with rfl | rfl + · exact absurd (hin' (hlE₁ hw) h3) (hend _ hs₁ hw) + · exact ⟨_, .inr rfl, hk', hw⟩ + refine ⟨Insert.insert c₁ (Insert.insert c₂ (F \ {c₀})), ⟨((h.finite.subset sdiff_subset).insert + _).insert _, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩⟩ + · rintro c (rfl | rfl | hc) + · exact hcell₁ + · exact hcell₂ + · exact h.cell c hc.1 + · rintro c (rfl | rfl | hc) c' (rfl | rfl | hc') hne w h3 h4 + · exact absurd rfl hne + · exact ⟨j, .inr rfl, .inl rfl, hin' h3 h4⟩ + · obtain ⟨k, h5, h6, h7⟩ := hc₁ c' hc'.1 hc'.2 w h3 h4 + exact ⟨k, h5, h6, h7⟩ + · exact ⟨j, .inl rfl, .inr rfl, hin' h4 h3⟩ + · exact absurd rfl hne + · obtain ⟨k, h5, h6, h7⟩ := hc₂ c' hc'.1 hc'.2 w h3 h4 + exact ⟨k, h5, h6, h7⟩ + · obtain ⟨k, h5, h6, h7⟩ := hc₁ c hc.1 hc.2 w h4 h3 + exact ⟨k, h6, h5, h7⟩ + · obtain ⟨k, h5, h6, h7⟩ := hc₂ c hc.1 hc.2 w h4 h3 + exact ⟨k, h6, h5, h7⟩ + · exact h.meet c hc.1 c' hc'.1 hne w h3 h4 + · intro w hw + rcases h.cover w hw with h3 | ⟨c, hc, h3⟩ + · exact .inl h3 + · by_cases he : c = c₀ + · subst he + rw [← hu] at h3 + rcases h3 with h3 | h3 + · exact .inr ⟨c₁, .inl rfl, h3⟩ + · exact .inr ⟨c₂, .inr (.inl rfl), h3⟩ + · exact .inr ⟨c, .inr (.inr ⟨hc, he⟩), h3⟩ + · intro w hw + obtain ⟨c, hc, h3⟩ := h.botCover w hw + by_cases he : c = c₀ + · subst he + rw [← hau] at h3 + rcases h3 with h3 | h3 + · exact ⟨c₁, .inl rfl, h3⟩ + · exact ⟨c₂, .inr (.inl rfl), h3⟩ + · exact ⟨c, .inr (.inr ⟨hc, he⟩), h3⟩ + · intro w hw + obtain ⟨c, hc, h3⟩ := h.topCover w hw + by_cases he : c = c₀ + · subst he + rw [← hbu] at h3 + rcases h3 with h3 | h3 + · exact ⟨c₁, .inl rfl, h3⟩ + · exact ⟨c₂, .inr (.inl rfl), h3⟩ + · exact ⟨c, .inr (.inr ⟨hc, he⟩), h3⟩ + · rintro c (rfl | rfl | hc) + · exact ⟨.inr hs₁, .inl rfl⟩ + · exact ⟨.inl rfl, .inr hs₂⟩ + · exact ⟨.inr (h.side c hc.1).1, .inr (h.side c hc.1).2⟩ + · rintro k (rfl | hk) + · exact ⟨c₁, .inl rfl, .inr rfl⟩ + · obtain ⟨c, hc, h3⟩ := h.used k hk + by_cases he : c = c₀ + · subst he + rcases h3 with h3 | h3 + · exact ⟨c₁, .inl rfl, .inl h3⟩ + · exact ⟨c₂, .inr (.inl rfl), .inr h3⟩ + · exact ⟨c, .inr (.inr ⟨hc, he⟩), h3⟩ + +/-- **The cells of the annulus.** All the lines together cut the annulus between `D` and `E` into +cells, each with two of the lines as its sides. -/ +theorem exists_cell_family [Finite ι] (hman : ∀ x : T, IsManifoldPoint x) (hD : IsClosedDisc D) + (hE : IsClosedDisc E) (hDE : D ⊆ E \ discBd E) (hq : ∀ k, IsCrossLine D E (q k) (x k) (t k)) + (hdis : ∀ k k', k ≠ k' → Disjoint (q k) (q k')) {i₀ i₁ : ι} (hi : i₀ ≠ i₁) : ∃ F, IsCellFamily + D E q x t univ F := by + classical + have := Fintype.ofFinite ι + have hd : Disjoint D (discBd E) := disjoint_left.mpr fun z hz h => (hDE hz).2 h + obtain ⟨R₁, R₂, a₁, a₂, b₁, b₂, h₁, h₂, hm, ha, hb, hc⟩ := exists_two_cells hman hD hE hDE + (hq i₀) (hq i₁) (hdis _ _ hi) + let c₁ : CellRec T ι := ⟨R₁, a₁, b₁, i₀, i₁⟩ + let c₂ : CellRec T ι := ⟨R₂, a₂, b₂, i₀, i₁⟩ + have hbase : IsCellFamily D E q x t {i₀, i₁} {c₁, c₂} := by + refine ⟨by simp, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rintro c (rfl | rfl) + · exact h₁ + · exact h₂ + · rintro c (rfl | rfl) c' (rfl | rfl) hne w h3 h4 + · exact absurd rfl hne + · rcases hm ⟨h3, h4⟩ with h5 | h5 + · exact ⟨i₀, .inl rfl, .inl rfl, h5⟩ + · exact ⟨i₁, .inr rfl, .inr rfl, h5⟩ + · rcases hm ⟨h4, h3⟩ with h5 | h5 + · exact ⟨i₀, .inl rfl, .inl rfl, h5⟩ + · exact ⟨i₁, .inr rfl, .inr rfl, h5⟩ + · exact absurd rfl hne + · intro w hw + rw [← hc] at hw + rcases hw with (h3 | h3) | h3 + · exact .inr ⟨c₁, .inl rfl, h3⟩ + · exact .inr ⟨c₂, .inr rfl, h3⟩ + · exact .inl h3 + · intro w hw + rw [← ha] at hw + rcases hw with h3 | h3 + · exact ⟨c₁, .inl rfl, h3⟩ + · exact ⟨c₂, .inr rfl, h3⟩ + · intro w hw + rw [← hb] at hw + rcases hw with h3 | h3 + · exact ⟨c₁, .inl rfl, h3⟩ + · exact ⟨c₂, .inr rfl, h3⟩ + · rintro c (rfl | rfl) + · exact ⟨.inl rfl, .inr rfl⟩ + · exact ⟨.inl rfl, .inr rfl⟩ + · rintro k (rfl | rfl) + · exact ⟨c₁, .inl rfl, .inl rfl⟩ + · exact ⟨c₁, .inl rfl, .inr rfl⟩ + have hall : ∀ s : Finset ι, ∃ F, IsCellFamily D E q x t ({i₀, i₁} ∪ (s : Set ι)) F := fun s => by + induction s using Finset.induction_on with + | empty => exact ⟨_, by simpa using hbase⟩ + | insert j s _ ih => + obtain ⟨F, hF⟩ := ih + by_cases hj : j ∈ ({i₀, i₁} ∪ (s : Set ι)) + · refine ⟨F, ?_⟩ + have : ({i₀, i₁} ∪ ((Insert.insert j s : Finset ι) : Set ι)) = {i₀, i₁} ∪ (s : Set ι) := by + rw [Finset.coe_insert, union_insert] + exact insert_eq_of_mem hj + rwa [this] + · obtain ⟨F', hF'⟩ := hF.insert hman hd hq hdis hj + refine ⟨F', ?_⟩ + have : ({i₀, i₁} ∪ ((Insert.insert j s : Finset ι) : Set ι)) = Insert.insert j ({i₀, i₁} ∪ + (s : Set ι)) := by + rw [Finset.coe_insert, union_insert] + rwa [this] + obtain ⟨F, hF⟩ := hall Finset.univ + exact ⟨F, by simpa using hF⟩ + +end Family + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffChart.lean b/LeanPool/GraphMinor/GM07/CuffChart.lean new file mode 100644 index 0000000000..4f9539f70f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffChart.lean @@ -0,0 +1,368 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffCells +public import LeanPool.GraphMinor.Surface.FanSquare + +/-! +# Charts of the cells + +Graph Minors VII, (5.9), page 235. A cell of the annulus around a cuff is a closed disc with a +boundary in four parts. We give it a chart from the unit square, which on each side of the square is +a given parametrization of that part. Two neighbouring cells use the same parametrization of their +common side, so their charts agree there. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {T : Type u} [TopologicalSpace T] [T2Space T] + +/-- A parametrization of a line by the interval `[0,1]`. -/ +structure IsParam (L : Set T) (u v : T) (p : ℝ → T) : Prop where + cont : ContinuousOn p (Icc 0 1) + inj : InjOn p (Icc 0 1) + image : p '' Icc 0 1 = L + zero : p 0 = u + one : p 1 = v + +omit [T2Space T] in +theorem exists_isParam {L : Set T} {u v : T} (h : IsLineWithEnds L u v) : ∃ p, IsParam L u v p := by + obtain ⟨f, h0, h1⟩ := h + let p : ℝ → T := fun s => (f (projIcc 0 1 zero_le_one s)).1 + have hc : Continuous p := continuous_subtype_val.comp (f.continuous.comp continuous_projIcc) + refine ⟨p, hc.continuousOn, fun a ha b hb he => ?_, ?_, ?_, ?_⟩ + · have h2 := f.injective (Subtype.ext he) + have h3 := congrArg Subtype.val h2 + rwa [projIcc_of_mem zero_le_one ha, projIcc_of_mem zero_le_one hb] at h3 + · ext y + constructor + · rintro ⟨s, -, rfl⟩ + exact (f _).2 + · intro hy + refine ⟨(f.symm ⟨y, hy⟩).1, (f.symm ⟨y, hy⟩).2, ?_⟩ + simp [p, projIcc_val] + · change (f (projIcc 0 1 zero_le_one 0)).1 = u + rw [projIcc_left] + exact h0 + · change (f (projIcc 0 1 zero_le_one 1)).1 = v + rw [projIcc_right] + exact h1 + +omit [T2Space T] in +theorem IsParam.symm_eq {L : Set T} {u v : T} {p : ℝ → T} (h : IsParam L u v p) {s s' : ℝ} + (hs : s ∈ Icc (0 : ℝ) 1) (hs' : s' ∈ Icc (0 : ℝ) 1) (he : p s = p s') : s = s' := h.inj hs hs' he + +omit [T2Space T] in +theorem IsParam.mem {L : Set T} {u v : T} {p : ℝ → T} (h : IsParam L u v p) {s : ℝ} (hs : s ∈ Icc + (0 : ℝ) 1) : p s ∈ L := h.image ▸ mem_image_of_mem p hs + +omit [T2Space T] in +theorem IsParam.exists_of_mem {L : Set T} {u v : T} {p : ℝ → T} (h : IsParam L u v p) {y : T} + (hy : y ∈ L) : ∃ s ∈ Icc (0 : ℝ) 1, p s = y := by + rw [← h.image] at hy + exact hy + +/-- The four sides of the unit square. -/ +theorem frontier_unitSq : frontier unitSq = {z | z ∈ unitSq ∧ (z.re = 0 ∨ z.re = 1 ∨ z.im = 0 + ∨ z.im = 1)} := by + have hcl : IsClosed unitSq := isClosed_Icc.reProdIm isClosed_Icc + rw [frontier, hcl.closure_eq, unitSq, Complex.interior_reProdIm, interior_Icc] + ext z + constructor + · rintro ⟨hz, h5⟩ + refine ⟨hz, ?_⟩ + obtain ⟨⟨h1, h2⟩, h3, h4⟩ := hz + by_contra hne + push Not at hne + obtain ⟨h6, h7, h8, h9⟩ := hne + exact h5 ⟨⟨lt_of_le_of_ne h1 h6.symm, lt_of_le_of_ne h2 h7⟩, lt_of_le_of_ne h3 h8.symm, + lt_of_le_of_ne h4 h9⟩ + · rintro ⟨hz, h5⟩ + refine ⟨hz, ?_⟩ + rintro ⟨⟨h6, h7⟩, h8, h9⟩ + have h6' : 0 < z.re := h6 + have h7' : z.re < 1 := h7 + have h8' : 0 < z.im := h8 + have h9' : z.im < 1 := h9 + rcases h5 with h5 | h5 | h5 | h5 <;> linarith + +variable {D E R a b l l' : Set T} {x x' t t' : T} + +/-- The boundary map of a cell, on the sides of the square. -/ +noncomputable def cellBd (pl pr pb pt : ℝ → T) (z : ℂ) : T := + if z.re = 0 then pl z.im else if z.re = 1 then pr z.im else if z.im = 0 then pb z.re else pt z.re + +section Bd + +variable {pl pr pb pt : ℝ → T} (h : IsCell D E R a b l l' x x' t t') (hl : IsParam l x t pl) + (hr : IsParam l' x' t' pr) (hb : IsParam a x x' pb) (ht : IsParam b t t' pt) + +include hb ht hl hr + +omit [TopologicalSpace T] [T2Space T] hl hr hb ht in +theorem cellBd_left {z : ℂ} (hz : z.re = 0) : cellBd pl pr pb pt z = pl z.im := ite_eq_left hz + +omit [TopologicalSpace T] [T2Space T] hl hr hb ht in +theorem cellBd_right {z : ℂ} (hz : z.re = 1) : cellBd pl pr pb pt z = pr z.im := by + simp [cellBd, hz] + +omit [T2Space T] ht in +theorem cellBd_low {z : ℂ} (hz : z.im = 0) : cellBd pl pr pb pt z = pb z.re := by + by_cases h0 : z.re = 0 + · rw [cellBd, ite_eq_left h0, hz, h0, hl.zero, hb.zero] + · by_cases h1 : z.re = 1 + · rw [cellBd, ite_eq_right h0, ite_eq_left h1, hz, h1, hr.zero, hb.one] + · simp [cellBd, h0, h1, hz] + +omit [T2Space T] hb in +theorem cellBd_high {z : ℂ} (hz : z.im = 1) : cellBd pl pr pb pt z = pt z.re := by + by_cases h0 : z.re = 0 + · rw [cellBd, ite_eq_left h0, hz, h0, hl.one, ht.zero] + · by_cases h1 : z.re = 1 + · rw [cellBd, ite_eq_right h0, ite_eq_left h1, hz, h1, hr.one, ht.one] + · simp [cellBd, h0, h1, hz] + +omit [T2Space T] in +theorem continuousOn_cellBd : ContinuousOn (cellBd pl pr pb pt) (frontier unitSq) := by + have hs : frontier unitSq = ({z | z ∈ unitSq ∧ z.re = 0} ∪ {z | z ∈ unitSq ∧ z.re = 1}) ∪ + ({z | z ∈ unitSq ∧ z.im = 0} ∪ {z | z ∈ unitSq ∧ z.im = 1}) := by + rw [frontier_unitSq] + ext z + simp only [mem_ofPred_eq, mem_union] + tauto + have hcl : IsClosed unitSq := isClosed_Icc.reProdIm isClosed_Icc + have hc : ∀ {g : ℂ → ℝ}, Continuous g → ∀ c : ℝ, IsClosed {z | z ∈ unitSq ∧ g z = c} := fun hg c + => hcl.inter (isClosed_eq hg continuous_const) + have him {A : Set ℂ} (hA : A ⊆ unitSq) : MapsTo Complex.im A (Icc 0 1) := + fun _ hz => (hA hz).2 + have hre {A : Set ℂ} (hA : A ⊆ unitSq) : MapsTo Complex.re A (Icc 0 1) := + fun _ hz => (hA hz).1 + have h1 : ContinuousOn (cellBd pl pr pb pt) {z | z ∈ unitSq ∧ z.re = 0} := + (hl.cont.comp Complex.continuous_im.continuousOn + (him (A := {z | z ∈ unitSq ∧ z.re = 0}) fun _ hz => hz.1)).congr fun _ hz => + cellBd_left hz.2 + have h2 : ContinuousOn (cellBd pl pr pb pt) {z | z ∈ unitSq ∧ z.re = 1} := + (hr.cont.comp Complex.continuous_im.continuousOn + (him (A := {z | z ∈ unitSq ∧ z.re = 1}) fun _ hz => hz.1)).congr fun _ hz => + cellBd_right hz.2 + have h3 : ContinuousOn (cellBd pl pr pb pt) {z | z ∈ unitSq ∧ z.im = 0} := + (hb.cont.comp Complex.continuous_re.continuousOn + (hre (A := {z | z ∈ unitSq ∧ z.im = 0}) fun _ hz => hz.1)).congr fun _ hz => + cellBd_low (pt := pt) hl hr hb hz.2 + have h4 : ContinuousOn (cellBd pl pr pb pt) {z | z ∈ unitSq ∧ z.im = 1} := + (ht.cont.comp Complex.continuous_re.continuousOn + (hre (A := {z | z ∈ unitSq ∧ z.im = 1}) fun _ hz => hz.1)).congr fun _ hz => + cellBd_high (pb := pb) hl hr ht hz.2 + rw [hs] + exact (h1.union_of_isClosed h2 (hc Complex.continuous_re 0) (hc Complex.continuous_re + 1)).union_of_isClosed (h3.union_of_isClosed h4 (hc Complex.continuous_im 0) + (hc Complex.continuous_im 1)) ((hc Complex.continuous_re 0).union + (hc Complex.continuous_re 1)) ((hc Complex.continuous_im 0).union + (hc Complex.continuous_im 1)) + +include h + +omit [T2Space T] in +theorem cellBd_sides {z z' : ℂ} (hz : z ∈ frontier unitSq) (hz' : z' ∈ frontier unitSq) + (he : cellBd pl pr pb pt z = cellBd pl pr pb pt z') : z = z' := by + rw [frontier_unitSq] at hz hz' + obtain ⟨⟨hzr, hzi⟩, hs⟩ := hz + obtain ⟨⟨hzr', hzi'⟩, hs'⟩ := hz' + have hL := cellBd_left (pl := pl) (pr := pr) (pb := pb) (pt := pt) (z := z) + have hL' := cellBd_left (pl := pl) (pr := pr) (pb := pb) (pt := pt) (z := z') + have hR (hz : z.re = 1) : cellBd pl pr pb pt z = pr z.im := cellBd_right hz + have hR' (hz' : z'.re = 1) : cellBd pl pr pb pt z' = pr z'.im := cellBd_right hz' + have hB := cellBd_low (pt := pt) hl hr hb (z := z) + have hB' := cellBd_low (pt := pt) hl hr hb (z := z') + have hT := cellBd_high (pb := pb) hl hr ht (z := z) + have hT' := cellBd_high (pb := pb) hl hr ht (z := z') + have hmeet : ∀ {A B : Set T} {c : T}, A ∩ B = {c} → ∀ {w}, w ∈ A → w ∈ B → w = c + := fun {A B c} h1 {w} h2 h3 => by + have h4 : w ∈ A ∩ B := ⟨h2, h3⟩ + rwa [h1] at h4 + have hlr : ∀ {w}, w ∈ l → w ∈ l' → False := fun {w} h1 h2 => disjoint_left.mp h.ll h1 h2 + have hab : ∀ {w}, w ∈ a → w ∈ b → False := fun {w} h1 h2 => disjoint_left.mp h.ab h1 h2 + have hzero : ∀ {P : Set T} {u v : T} {p : ℝ → T}, IsParam P u v p → ∀ {s}, s ∈ Icc (0 : ℝ) 1 + → p s = u → s = 0 := fun {P u v p} hp {s} hs h1 => hp.inj hs ⟨le_rfl, zero_le_one⟩ + (h1.trans hp.zero.symm) + have hone : ∀ {P : Set T} {u v : T} {p : ℝ → T}, IsParam P u v p → ∀ {s}, s ∈ Icc (0 : ℝ) 1 → p s + = v → s = 1 := fun {P u v p} hp {s} hs h1 => hp.inj hs ⟨zero_le_one, le_rfl⟩ + (h1.trans hp.one.symm) + rcases hs with hs | hs | hs | hs <;> rcases hs' with hs' | hs' | hs' | hs' + · rw [hL hs, hL' hs'] at he + exact Complex.ext (hs.trans hs'.symm) (hl.inj hzi hzi' he) + · rw [hL hs, hR' hs'] at he + exact (hlr (hl.mem hzi) (he ▸ hr.mem hzi')).elim + · rw [hL hs, hB' hs'] at he + have h1 := hmeet h.al (hb.mem hzr') (he ▸ hl.mem hzi) + exact Complex.ext (hs.trans (hzero hb hzr' h1).symm) ((hzero hl hzi + (he.trans h1)).trans hs'.symm) + · rw [hL hs, hT' hs'] at he + have h1 := hmeet h.bl (ht.mem hzr') (he ▸ hl.mem hzi) + exact Complex.ext (hs.trans (hzero ht hzr' h1).symm) ((hone hl hzi + (he.trans h1)).trans hs'.symm) + · rw [hR hs, hL' hs'] at he + exact (hlr (hl.mem hzi') (he ▸ hr.mem hzi)).elim + · rw [hR hs, hR' hs'] at he + exact Complex.ext (hs.trans hs'.symm) (hr.inj hzi hzi' he) + · rw [hR hs, hB' hs'] at he + have h1 := hmeet h.ar (hb.mem hzr') (he ▸ hr.mem hzi) + exact Complex.ext (hs.trans (hone hb hzr' h1).symm) ((hzero hr hzi + (he.trans h1)).trans hs'.symm) + · rw [hR hs, hT' hs'] at he + have h1 := hmeet h.br (ht.mem hzr') (he ▸ hr.mem hzi) + exact Complex.ext (hs.trans (hone ht hzr' h1).symm) ((hone hr hzi (he.trans h1)).trans hs'.symm) + · rw [hB hs, hL' hs'] at he + have h1 := hmeet h.al (hb.mem hzr) (he.symm ▸ hl.mem hzi') + exact Complex.ext ((hzero hb hzr h1).trans hs'.symm) (hs.trans (hzero hl hzi' + (he.symm.trans h1)).symm) + · rw [hB hs, hR' hs'] at he + have h1 := hmeet h.ar (hb.mem hzr) (he.symm ▸ hr.mem hzi') + exact Complex.ext ((hone hb hzr h1).trans hs'.symm) (hs.trans (hzero hr hzi' + (he.symm.trans h1)).symm) + · rw [hB hs, hB' hs'] at he + exact Complex.ext (hb.inj hzr hzr' he) (hs.trans hs'.symm) + · rw [hB hs, hT' hs'] at he + exact (hab (hb.mem hzr) (he.symm ▸ ht.mem hzr')).elim + · rw [hT hs, hL' hs'] at he + have h1 := hmeet h.bl (ht.mem hzr) (he.symm ▸ hl.mem hzi') + exact Complex.ext ((hzero ht hzr h1).trans hs'.symm) (hs.trans (hone hl hzi' + (he.symm.trans h1)).symm) + · rw [hT hs, hR' hs'] at he + have h1 := hmeet h.br (ht.mem hzr) (he.symm ▸ hr.mem hzi') + exact Complex.ext ((hone ht hzr h1).trans hs'.symm) (hs.trans (hone hr hzi' + (he.symm.trans h1)).symm) + · rw [hT hs, hB' hs'] at he + exact (hab (hb.mem hzr') (he ▸ ht.mem hzr)).elim + · rw [hT hs, hT' hs'] at he + exact Complex.ext (ht.inj hzr hzr' he) (hs.trans hs'.symm) + +omit [T2Space T] in +theorem cellBd_image : cellBd pl pr pb pt '' frontier unitSq = discBd R := by + have hIm : ∀ {P : Set T} {u v : T} {p : ℝ → T}, IsParam P u v p → ∀ y ∈ P, ∃ s ∈ Icc + (0 : ℝ) 1, p s = y := fun hp y hy => hp.exists_of_mem hy + have hmemz : ∀ {m w : ℝ}, m ∈ Icc (0 : ℝ) 1 → w ∈ Icc (0 : ℝ) 1 → (⟨m, w⟩ : ℂ) ∈ unitSq + := fun h1 h2 => ⟨h1, h2⟩ + rw [h.bd_eq, frontier_unitSq] + ext y + constructor + · rintro ⟨z, ⟨⟨hzr, hzi⟩, hs⟩, rfl⟩ + rcases hs with hs | hs | hs | hs + · rw [cellBd_left hs] + exact .inr (hl.mem hzi) + · rw [cellBd_right hs] + exact .inl (.inl (.inr (hr.mem hzi))) + · rw [cellBd_low (pt := pt) hl hr hb hs] + exact .inl (.inl (.inl (hb.mem hzr))) + · rw [cellBd_high (pb := pb) hl hr ht hs] + exact .inl (.inr (ht.mem hzr)) + · rintro (((hy | hy) | hy) | hy) + · obtain ⟨s, hs, rfl⟩ := hIm hb y hy + exact ⟨⟨s, 0⟩, ⟨hmemz hs ⟨le_rfl, zero_le_one⟩, .inr (.inr (.inl rfl))⟩, + cellBd_low (pt := pt) hl hr hb rfl⟩ + · obtain ⟨s, hs, rfl⟩ := hIm hr y hy + exact ⟨⟨1, s⟩, ⟨hmemz ⟨zero_le_one, le_rfl⟩ hs, .inr (.inl rfl)⟩, + cellBd_right rfl⟩ + · obtain ⟨s, hs, rfl⟩ := hIm ht y hy + exact ⟨⟨s, 1⟩, ⟨hmemz hs ⟨zero_le_one, le_rfl⟩, .inr (.inr (.inr rfl))⟩, + cellBd_high (pb := pb) hl hr ht rfl⟩ + · obtain ⟨s, hs, rfl⟩ := hIm hl y hy + exact ⟨⟨0, s⟩, ⟨hmemz ⟨le_rfl, zero_le_one⟩ hs, .inl rfl⟩, cellBd_left rfl⟩ + +omit [T2Space T] in +/-- **The chart of a cell.** -/ +theorem exists_cell_chart : ∃ ξ : ℂ → T, ContinuousOn ξ unitSq ∧ InjOn ξ unitSq ∧ ξ '' unitSq = R + ∧ ∀ z ∈ frontier unitSq, ξ z = cellBd pl pr pb pt z := by + classical + obtain ⟨hU, hUb⟩ := unitSq_disc + obtain ⟨e⟩ := hU.isOArc_discBd + obtain ⟨h₀, g₀, c₀, hg₀⟩ := exists_chart_extending hU e + obtain ⟨hR, gR, cR⟩ := h.disc.exists_isChart + have hfr : ∀ w : Circle, (e w).1 ∈ frontier unitSq := fun w => hUb ▸ (e w).2 + have hβR : ∀ z ∈ frontier unitSq, cellBd pl pr pb pt z ∈ discBd R := fun z hz + => cellBd_image h hl hr hb ht ▸ mem_image_of_mem _ hz + have hsubR := Surface.discBd_subset R + let ψ : Circle → ℂ := fun w => hR (cellBd pl pr pb pt (e w).1) + have hψc : Continuous ψ := by + have h1 : Continuous fun w : Circle => cellBd pl pr pb pt (e w).1 := + (continuousOn_cellBd hl hr hb ht).comp_continuous (continuous_subtype_val.comp e.continuous) + hfr + exact cR.hc.comp_continuous h1 fun w => hsubR (hβR _ (hfr w)) + have hψi : Injective ψ := fun w w' he => by + have h1 := cR.gh (hsubR (hβR _ (hfr w))) + have h2 := cR.gh (hsubR (hβR _ (hfr w'))) + have h3 : cellBd pl pr pb pt (e w).1 = cellBd pl pr pb pt (e w').1 := by + rw [← h1, ← h2] + exact congrArg gR he + exact e.injective (Subtype.ext (cellBd_sides h hl hr hb ht (hfr w) (hfr w') h3)) + obtain ⟨hB, hBb⟩ := closedBall_disc (s := 1) one_pos + have hψr : range ψ = discBd (closedBall (0 : ℂ) 1) := by + rw [hBb, ← cR.bd] + ext y + constructor + · rintro ⟨w, rfl⟩ + exact mem_image_of_mem hR (hβR _ (hfr w)) + · rintro ⟨r, hr', rfl⟩ + rw [← cellBd_image h hl hr hb ht] at hr' + obtain ⟨z, hz, rfl⟩ := hr' + refine ⟨e.symm ⟨z, hUb ▸ hz⟩, ?_⟩ + simp [ψ] + let φ : Circle ≃ₜ discBd (closedBall (0 : ℂ) 1) := ((hψc.isClosedEmbedding + hψi).isEmbedding.toHomeomorph).trans (Homeomorph.setCongr hψr) + have hφ : ∀ w, (φ w).1 = ψ w := fun w => rfl + obtain ⟨h₁, g₁, c₁, hg₁⟩ := exists_chart_extending hB φ + refine ⟨fun z => gR (g₁ (h₀ z)), ?_, ?_, ?_, ?_⟩ + · exact cR.gc.comp (c₁.gc.comp c₀.hc c₀.hm) fun z hz => c₁.gm (c₀.hm hz) + · intro z hz z' hz' he + have h1 := c₁.hg (c₀.hm hz) + have h2 := c₁.hg (c₀.hm hz') + have h3 := cR.hg (c₁.gm (c₀.hm hz)) + have h4 := cR.hg (c₁.gm (c₀.hm hz')) + have h5 : g₁ (h₀ z) = g₁ (h₀ z') := by + rw [← h3, ← h4] + exact congrArg hR he + have h6 : h₀ z = h₀ z' := by + rw [← h1, ← h2] + exact congrArg h₁ h5 + rw [← c₀.gh hz, ← c₀.gh hz', h6] + · ext y + constructor + · rintro ⟨z, hz, rfl⟩ + exact cR.gm (c₁.gm (c₀.hm hz)) + · intro hy + have h1 := cR.hm hy + have h2 := c₁.hm h1 + refine ⟨g₀ (h₁ (hR y)), c₀.gm h2, ?_⟩ + simp only + rw [c₀.hg h2, c₁.gh h1, cR.gh hy] + · intro z hz + obtain ⟨θ, hθ⟩ : ∃ θ : ℝ, Circle.exp θ = e.symm ⟨z, hUb ▸ hz⟩ := Circle.exp_surjective _ + have hzw : z = (e (Circle.exp θ)).1 := by + rw [hθ] + simp + have hmem : eC θ ∈ closedBall (0 : ℂ) 1 := by + rw [eC_eq_cis', mem_closedBall_zero_iff] + simp [cis'] + have h1 : h₀ z = eC θ := by + rw [hzw, ← hg₀ θ, c₀.hg hmem] + simp only + rw [h1, hg₁ θ, hφ] + change gR (hR (cellBd pl pr pb pt (e (Circle.exp θ)).1)) = _ + rw [cR.gh (hsubR (hβR _ (hfr _))), ← hzw] + +end Bd + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffCollapse.lean b/LeanPool/GraphMinor/GM07/CuffCollapse.lean new file mode 100644 index 0000000000..62d1a058b6 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffCollapse.lean @@ -0,0 +1,203 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffBoxBuild +public import LeanPool.GraphMinor.GM07.CuffForest + +/-! +# The graph after the collapse + +Graph Minors VII, (5.9), pages 235 and 236. The map `ρ` is one to one on the set `A`, and no point +outside `A` goes to a point of `ρ '' A`. If all edges of a graph lie in `A`, then its image is a +drawing whose edges are the images of the edges. An edge whose two ends go to one point becomes a +loop. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- Two lines with the same ends that meet only at the ends form an `O`-arc. -/ +theorem isOArc_of_two_lines {L₁ L₂ : Set S} {p q : S} (h₁ : IsLineWithEnds L₁ p q) + (h₂ : IsLineWithEnds L₂ p q) (hi : L₁ ∩ L₂ = {p, q}) : IsOArc (L₁ ∪ L₂) := by + obtain ⟨a, ha, rfl, h0, h1⟩ := h₁.exists_arc + obtain ⟨b, hb, rfl, h0', h1'⟩ := h₂.exists_arc + refine oArc_of_two_arcs ha hb (h0.trans h0'.symm) (h1.trans h1'.symm) fun s t he => ?_ + have hm : a s ∈ range a ∩ range b := ⟨⟨s, rfl⟩, ⟨t, he.symm⟩⟩ + rw [hi] at hm + rcases hm with h3 | h3 + · left + exact ⟨ha.2 (h3.trans h0.symm), hb.2 (he.symm.trans h3 |>.trans h0'.symm)⟩ + · right + exact ⟨ha.2 (h3.trans h1.symm), hb.2 (he.symm.trans h3 |>.trans h1'.symm)⟩ + +/-- A line whose image is one to one, except that the two ends go to one point, has image an +`O`-arc. -/ +theorem isOArc_image_of_ends {L : Set S} {u v : S} (hL : IsLineWithEnds L u v) {ρ : S → S} + (hc : Continuous ρ) (hi : ∀ x ∈ L, ∀ y ∈ L, ρ x = ρ y → x = y ∨ (x = u ∧ y = v) ∨ (x = v ∧ y + = u)) (huv : u ≠ v) (he : ρ u = ρ v) : IsOArc (ρ '' L) := by + obtain ⟨z, hz, hne⟩ := exists_mem_diff_of_line hL + have hzu : z ≠ u := fun h => hne (.inl h) + have hzv : z ≠ v := fun h => hne (.inr h) + obtain ⟨L₁, L₂, h₁, h₂, hu, hin⟩ := hL.split hz hzu hzv + have hL₁ : L₁ ⊆ L := hu ▸ subset_union_left + have hL₂ : L₂ ⊆ L := hu ▸ subset_union_right + have hv₁ : v ∉ L₁ := fun h => by + have h3 : v ∈ L₁ ∩ L₂ := ⟨h, h₂.right_mem⟩ + rw [hin] at h3 + exact hzv h3.symm + have hu₂ : u ∉ L₂ := fun h => by + have h3 : u ∈ L₁ ∩ L₂ := ⟨h₁.left_mem, h⟩ + rw [hin] at h3 + exact hzu h3.symm + have hinj₁ : InjOn ρ L₁ := fun a ha b hb hab => by + rcases hi a (hL₁ ha) b (hL₁ hb) hab with h | ⟨-, rfl⟩ | ⟨rfl, -⟩ + · exact h + · exact absurd hb hv₁ + · exact absurd ha hv₁ + have hinj₂ : InjOn ρ L₂ := fun a ha b hb hab => by + rcases hi a (hL₂ ha) b (hL₂ hb) hab with h | ⟨rfl, -⟩ | ⟨-, rfl⟩ + · exact h + · exact absurd ha hu₂ + · exact absurd hb hu₂ + have hl₁ := isLineWithEnds_image h₁ hc.continuousOn hinj₁ + have hl₂ := isLineWithEnds_image h₂ hc.continuousOn hinj₂ + rw [← he] at hl₂ + rw [← hu, image_union] + refine isOArc_of_two_lines hl₁ hl₂.symm (subset_antisymm ?_ ?_) + · rintro _ ⟨⟨a, ha, rfl⟩, ⟨b, hb, hab⟩⟩ + rcases hi b (hL₂ hb) a (hL₁ ha) hab with h | ⟨h3, -⟩ | ⟨-, h4⟩ + · have h5 : a ∈ L₁ ∩ L₂ := ⟨ha, h ▸ hb⟩ + rw [hin] at h5 + refine .inr ?_ + rw [show a = z from h5] + rfl + · exact absurd (h3 ▸ hb) hu₂ + · refine .inl ?_ + rw [h4] + · rintro _ (rfl | rfl) + · exact ⟨mem_image_of_mem ρ h₁.left_mem, ⟨v, h₂.right_mem, he.symm⟩⟩ + · exact ⟨mem_image_of_mem ρ h₁.right_mem, mem_image_of_mem ρ h₂.left_mem⟩ + +variable [CompactSpace S] + +/-- **The image of a graph.** All edges of `G` lie in `A`. Each point of `A` is the only point with +its image. Then the image of `G` is a drawing, with the images of the edges as edges. -/ +theorem exists_collapse_drawing [Nonempty S] {ρ : S → S} (hρ : Continuous ρ) {A : Set S} + (hA : ∀ x ∈ A, ∀ y, ρ y = ρ x → y = x) (G : Drawing S) (hU : G.U \ G.V ⊆ A) : ∃ G' : Drawing S, + G'.U = ρ '' G.U ∧ G'.V = ρ '' G.V ∧ G'.E = image ρ '' G.E := by + classical + have hcm : IsClosedMap ρ := hρ.isClosedMap + set F := G.U \ G.V with hF + have hset : ρ '' G.U \ ρ '' G.V = ρ '' F := by + ext y + constructor + · rintro ⟨⟨x, hx, rfl⟩, h1⟩ + exact ⟨x, ⟨hx, fun h2 => h1 (mem_image_of_mem ρ h2)⟩, rfl⟩ + · rintro ⟨x, ⟨hx, h1⟩, rfl⟩ + refine ⟨mem_image_of_mem ρ hx, ?_⟩ + rintro ⟨z, hz, he⟩ + rw [hA x (hU ⟨hx, h1⟩) z he] at hz + exact h1 hz + let g : S → S := invFunOn ρ F + have hgl : ∀ x ∈ F, g (ρ x) = x := fun x hx => hA x (hU hx) _ (invFunOn_eq ⟨x, hx, rfl⟩) + have hgc : ContinuousOn g (ρ '' F) := by + refine continuousOn_iff_isClosed.mpr fun C hC => ⟨ρ '' C, hcm C hC, ?_⟩ + ext y + constructor + · rintro ⟨hy, hyF⟩ + obtain ⟨x, hx, rfl⟩ := hyF + rw [mem_preimage, hgl x hx] at hy + exact ⟨mem_image_of_mem ρ hy, mem_image_of_mem ρ hx⟩ + · rintro ⟨⟨z, hz, he⟩, hyF⟩ + obtain ⟨x, hx, rfl⟩ := hyF + refine ⟨?_, mem_image_of_mem ρ hx⟩ + rw [mem_preimage, hgl x hx, ← hA x (hU hx) z he] + exact hz + have harc : arcComponentsIn (ρ '' F) = image ρ '' arcComponentsIn F + := arcComponentsIn_image hρ.continuousOn hgc hgl + have hcl : ∀ e : Set S, closure (ρ '' e) = ρ '' closure e := fun e => + (image_closure_subset_closure_image hρ).antisymm' (closure_minimal (image_mono subset_closure) + (hcm _ isClosed_closure)) + have heF : ∀ e ∈ G.E, e ⊆ F := fun e he => he.2.1 + have hcap : ∀ e ∈ G.E, closure (ρ '' e) ∩ ρ '' G.V = ρ '' (closure e ∩ G.V) := fun e he => by + rw [hcl] + refine subset_antisymm ?_ (image_inter_subset _ _ _) + rintro _ ⟨⟨x, hx, rfl⟩, ⟨v, hv, hvx⟩⟩ + by_cases hxV : x ∈ G.V + · exact mem_image_of_mem ρ ⟨hx, hxV⟩ + · have hxU : x ∈ G.U := G.closure_subset_U he hx + have := hA x (hU ⟨hxU, hxV⟩) v hvx + exact absurd (this ▸ hv) hxV + have hinj : ∀ e ∈ G.E, ∀ x ∈ closure e, ∀ y ∈ closure e, ρ x = ρ y → x = y ∨ (x ∈ closure e ∩ G.V + ∧ y ∈ closure e ∩ G.V) := fun e he x hx y hy hxy => by + by_cases hxV : x ∈ G.V + · by_cases hyV : y ∈ G.V + · exact .inr ⟨⟨hx, hxV⟩, hy, hyV⟩ + · exact .inl (hA y (hU ⟨G.closure_subset_U he hy, hyV⟩) x hxy) + · exact .inl (hA x (hU ⟨G.closure_subset_U he hx, hxV⟩) y hxy.symm).symm + let Γ : Drawing S := + { U := ρ '' G.U + V := ρ '' G.V + V_subset_U := image_mono G.V_subset_U + isClosed_U := hcm _ G.isClosed_U + finite_V := G.finite_V.image _ + finite_edges := by + rw [hset, harc] + exact G.finite_edges.image _ + edge_cond := by + rw [hset, harc] + rintro _ ⟨e, he, rfl⟩ + rcases G.edge_cond e he with ⟨u, v, h1, h2, h3⟩ | ⟨u, h2, h3⟩ + · by_cases hρe : ρ u = ρ v + · refine .inr ⟨ρ u, by rw [hcap e he, h2, image_pair, hρe, pair_eq_singleton], ?_⟩ + rw [hcl] + refine isOArc_image_of_ends h3 hρ (fun x hx y hy hxy => ?_) h1 hρe + rcases hinj e he x hx y hy hxy with h4 | ⟨h4, h5⟩ + · exact .inl h4 + · rw [h2] at h4 h5 + rcases h4 with rfl | rfl <;> rcases h5 with rfl | rfl + · exact .inl rfl + · exact .inr (.inl ⟨rfl, rfl⟩) + · exact .inr (.inr ⟨rfl, rfl⟩) + · exact .inl rfl + · refine .inl ⟨ρ u, ρ v, hρe, by rw [hcap e he, h2, image_pair], ?_⟩ + rw [hcl] + refine isLineWithEnds_image h3 hρ.continuousOn fun x hx y hy hxy => ?_ + rcases hinj e he x hx y hy hxy with h4 | ⟨h4, h5⟩ + · exact h4 + · rw [h2] at h4 h5 + rcases h4 with rfl | rfl <;> rcases h5 with rfl | rfl + · rfl + · exact absurd hxy hρe + · exact absurd hxy.symm hρe + · rfl + · refine .inr ⟨ρ u, by rw [hcap e he, h2, image_singleton], ?_⟩ + rw [hcl] + have hii : InjOn ρ (closure e) := fun x hx y hy hxy => by + rcases hinj e he x hx y hy hxy with h4 | ⟨h4, h5⟩ + · exact h4 + · rw [h2] at h4 h5 + exact h4.trans h5.symm + have hcomp : IsCompact (closure e) := isClosed_closure.isCompact + obtain ⟨f', hf', hl⟩ := Surface.exists_inv_of_compactOn hcomp hρ.continuousOn hii + exact h3.image hρ.continuousOn hf' hl } + refine ⟨Γ, rfl, rfl, ?_⟩ + change arcComponentsIn (ρ '' G.U \ ρ '' G.V) = _ + rw [hset, harc] + rfl + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffCollar.lean b/LeanPool/GraphMinor/GM07/CuffCollar.lean new file mode 100644 index 0000000000..d6156dd40e --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffCollar.lean @@ -0,0 +1,641 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +import LeanPool.GraphMinor.GM07.Section46Final +public import LeanPool.GraphMinor.GM07.CuffGlue +public import LeanPool.GraphMinor.GM07.Section11c + +/-! +# The collars around the cuffs and conditions (i) and (ii) of (4.6) + +Graph Minors VII, (5.9), pages 235-237. A collar around one cuff `C` is what the first half of the +proof of (5.9) gives at `C`. Here we put the collars of all the cuffs together and prove the claims +(a) and (b) of the paper, in the form of conditions (i) and (ii) of (4.6) for the collapsed graph +`G'`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] {ι : Type*} + +/-- The collar of one cuff `C`. The boxes `φ` run from `C` to level `2`. The set `Mo` is the side of +the circuit `AC` (the circuit `B_β(C)` of the paper) that has `C`, and `AC` carries the arcs `reach` +back to `A(C)`. The sets `Mo₂` and `Mo₃` are the parts of `Mo` outside `N(C)` and outside the boxes. +-/ +structure IsCuffCollar (G : Drawing S) (C : Set S) (r v : ℕ) (Mo AC Mo₂ Mo₃ : Set S) (φ : ι → ℝ × ℝ + → S) (g f : ι → ℝ → ℝ) (Tr : S → Drawing S) : Prop where + box : IsBoxSystem φ + data : ∀ i, IsCollapseData (g i) (f i) + bottom : ∀ i p, p ∈ cuffBox → (φ i p ∈ bd S ↔ p.2 = 0) + bottomC : ∀ i p, p ∈ cuffBox → p.2 = 0 → φ i p ∈ C + allBottom : C ⊆ boxBottom φ + graphU : ∀ i p, p ∈ cuffBox → p.2 = f i p.1 → φ i p ∈ G.U → φ i p ∈ G.V + graphV : ∀ i p, p ∈ cuffBox → p.2 = f i p.1 → φ i p ∈ G.V → φ i (g i p.1, 0) ∈ G.V ∩ C ∧ φ i p ∈ + (Tr (φ i (g i p.1, 0))).V + corner : ∀ x ∈ G.V ∩ C, ∃ i e, (e = (0 : ℝ) ∨ e = 1) ∧ φ i (e, 0) = x ∧ φ i (e, 1) ∈ G.V + cornerV : ∀ i e, (e = (0 : ℝ) ∨ e = 1) → φ i (e, 0) ∈ G.V ∩ C + gstrict : ∀ i, ∀ m ∈ Icc (0 : ℝ) 1, ∀ m' ∈ Icc (0 : ℝ) 1, g i m = g i m' → 0 < g i m → g i m < 1 + → m = m' + tree : ∀ x ∈ G.V ∩ C, (Tr x).IsSubdrawing G ∧ IsGraphForest (Tr x).toGraph ∧ x ∈ (Tr x).V ∧ + (∀ a ∈ (Tr x).U, ∃ i p, p ∈ cuffBox ∧ φ i p = a ∧ p.2 ≤ f i p.1 ∧ φ i (g i p.1, 0) = x) ∧ ∀ a ∈ + (Tr x).V, ∀ b ∈ (Tr x).V, Nonempty (GraphWalk (Tr x).toGraph a b) + closedMo : IsClosed Mo + openMo : IsOpen (Mo \ AC) + cMo : C ⊆ Mo + inMo : ∀ i p, p ∈ cuffBox → φ i p ∈ Mo \ AC + circ : ∃ A : Drawing S, A.IsSubdrawing G ∧ A.IsCircuit ∧ A.U = AC + surrounds : SurroundsCuff AC C + planarMo : IsPlanarInCappedCuff C Mo + reach : ∀ y ∈ AC, y ∈ G.V → ∃ X, IsScriptASet G r C X ∧ y ∈ X + inner : ∀ F : Set S, IsOArc F → G.IsNormal F → (G.V ∩ F).ncard ≤ v → SurroundsCuff F C → + (∀ z ∈ F, ¬ IsBelowGraph φ f z) → False + mo₂ : Mo₂ ⊆ Mo + mo₃ : Mo₃ ⊆ Mo + above₂ : ∀ z ∈ Mo₂, z ∈ G.U → ∀ i p, p ∈ cuffBox → φ i p = z → f i p.1 < p.2 + off₃ : ∀ z ∈ Mo₃, ∀ i, z ∉ φ i '' cuffBox + touch : ∀ (ρ : S → S) (A B : Set S), Continuous ρ → (∀ x ∈ A, ∀ y, ρ y = ρ x → y = x) → + (∀ x ∈ G.V ∩ C, ∀ a ∈ (Tr x).U, ρ a = x) → (∀ z ∈ A, ρ z ∈ B → z ∈ G.U → z ∈ G.V) → + (∀ Z : Set S, Z ⊆ A ∩ G.V → ρ '' Z ⊆ B → Z.ncard < v) → (∀ z ∈ Mo₂, z ∈ G.U → z ∈ A) → + (∀ z ∈ Mo₃, z ∈ G.U → z ∈ A ∧ ρ z = z) → IsOArc B → (B ∩ (G.V ∩ C)).Nonempty + → IsNullHomotopicOArc B ∨ (IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) + +theorem lineEnds_subset [T2Space S] {L : Set S} {p q : S} (hl : IsLineWithEnds L p q) : lineEnds L + ⊆ {p, q} := by + rintro z ⟨w, hw⟩ + by_contra hz + simp only [mem_insert_iff, mem_singleton_iff, not_or] at hz + have hzL : z ∈ L := hw.left_mem + obtain ⟨L₁, L₂, h₁, h₂, hu, hi⟩ := hl.split hzL (Ne.symm (Ne.symm hz.1)) hz.2 + have hY : IsPreconnected (L \ {z}) := by + refine hw.isPreconnected_diff.subset_closure (sdiff_subset_sdiff_right (by simp)) fun y hy => ?_ + have h1 : y ∈ closure (L \ {z, w}) := hw.subset_closure_diff hy.1 + exact h1 + have hd : Disjoint (L \ {z}) (L₁ ∩ L₂) := by + rw [hi, disjoint_right] + rintro _ rfl h + exact h.2 rfl + rcases GM12.subset_side h₁.isCompact.isClosed h₂.isCompact.isClosed hY + (sdiff_subset.trans hu.ge) hd with h3 | h3 + · have h4 : q ∈ L₁ ∩ L₂ := ⟨h3 ⟨hl.right_mem, Ne.symm hz.2⟩, h₂.right_mem⟩ + rw [hi] at h4 + exact hz.2 h4.symm + · have h4 : p ∈ L₁ ∩ L₂ := ⟨h₁.left_mem, h3 ⟨hl.left_mem, Ne.symm hz.1⟩⟩ + rw [hi] at h4 + exact hz.1 h4.symm + +/-- Along a curve from one of finitely many disjoint closed sets to another, there is a part that +runs from one set to another and misses all of them in between. -/ +theorem exists_gap_between_sets {K : Type*} [Finite K] {τ : ℝ → S} (hτ : ContinuousOn τ + (Icc 0 1)) {Mo : K → Set S} (hcl : ∀ c, IsClosed (Mo c)) (hdis : ∀ c c', c ≠ c' → Disjoint (Mo c) + (Mo c')) {c₀ c₁ : K} (hne : c₀ ≠ c₁) (h0 : τ 0 ∈ Mo c₀) (h1 : τ 1 ∈ Mo c₁) : + ∃ t₁ t₂ c₂, 0 ≤ t₁ ∧ t₁ < t₂ ∧ t₂ ≤ 1 ∧ c₂ ≠ c₀ ∧ τ t₁ ∈ Mo c₀ ∧ τ t₂ ∈ Mo c₂ + ∧ ∀ t ∈ Ioo t₁ t₂, ∀ c, τ t ∉ Mo c := by + classical + have hmem01 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 ∧ (1 : ℝ) ∈ Icc (0 : ℝ) 1 := ⟨⟨le_rfl, zero_le_one⟩, + zero_le_one, le_rfl⟩ + have hc₀ : IsCompact {t | t ∈ Icc (0 : ℝ) 1 ∧ τ t ∈ Mo c₀} := isCompact_Icc.of_isClosed_subset + (hτ.preimage_isClosed_of_isClosed isClosed_Icc (hcl c₀)) (fun _ ht => ht.1) + obtain ⟨t₁, ht₁, hmax⟩ := hc₀.exists_isMaxOn ⟨0, hmem01.1, h0⟩ continuous_id.continuousOn + let Y : Set S := ⋃ c, ⋃ _ : c ≠ c₀, Mo c + have hYc : IsClosed Y := isClosed_iUnion_of_finite fun c => by + by_cases h : c ≠ c₀ + · simpa [h] using hcl c + · simp [h] + have hc₁ : IsCompact {t | t ∈ Icc t₁ 1 ∧ τ t ∈ Y} := + isCompact_Icc.of_isClosed_subset + ((hτ.mono (Icc_subset_Icc_left ht₁.1.1)).preimage_isClosed_of_isClosed isClosed_Icc hYc) + (fun _ ht => ht.1) + have h1Y : τ 1 ∈ Y := mem_iUnion₂.mpr ⟨c₁, hne.symm, h1⟩ + obtain ⟨t₂, ht₂, hmin⟩ := hc₁.exists_isMinOn ⟨1, ⟨ht₁.1.2, le_rfl⟩, h1Y⟩ + continuous_id.continuousOn + obtain ⟨c₂, hc₂, ht₂Y⟩ := mem_iUnion₂.mp ht₂.2 + have hlt : t₁ < t₂ := by + refine lt_of_le_of_ne ht₂.1.1 fun h => ?_ + rw [← h] at ht₂Y + exact disjoint_left.mp (hdis _ _ hc₂) ht₂Y ht₁.2 + refine ⟨t₁, t₂, c₂, ht₁.1.1, hlt, ht₂.1.2, hc₂, ht₁.2, ht₂Y, fun t ht c hc => ?_⟩ + have htI : t ∈ Icc (0 : ℝ) 1 := ⟨ht₁.1.1.trans ht.1.le, ht.2.le.trans ht₂.1.2⟩ + by_cases h : c = c₀ + · subst h + exact absurd (hmax ⟨htI, hc⟩) (not_le.mpr ht.1) + · have h2 : τ t ∈ Y := mem_iUnion₂.mpr ⟨c, h, hc⟩ + exact absurd (hmin ⟨⟨ht.1.le, htI.2⟩, h2⟩) (not_le.mpr ht.2) + +/-- An end of a gap that lies in the open part of a set is impossible. -/ +theorem gap_end_off {τ : ℝ → S} {t₁ t₂ t : ℝ} (hlt : t₁ < t₂) (hτ : ContinuousOn τ (Icc t₁ t₂)) + (ht : t ∈ Icc t₁ t₂) {W : Set S} (hW : IsOpen W) (hoff : ∀ s ∈ Ioo t₁ t₂, τ s ∉ W) : τ t ∉ W := by + intro h + have h1 : τ t ∈ closure (τ '' Ioo t₁ t₂) := by + have hc : ContinuousOn τ (closure (Ioo t₁ t₂)) := by rwa [closure_Ioo hlt.ne] + exact hc.image_closure (mem_image_of_mem τ (by rwa [closure_Ioo hlt.ne])) + obtain ⟨z, hz, hz'⟩ := mem_closure_iff.mp h1 W hW h + obtain ⟨s, hs, rfl⟩ := hz' + exact hoff s hs hz + +section Glue + +variable [T2Space S] {G G₁ G' : Drawing S} {r v : ℕ} {ι : cuffs S → Type*} {Mo AC Mo₂ Mo₃ : cuffs S + → Set S} {φ : ∀ c, ι c → ℝ × ℝ → S} {g f : ∀ c, ι c → ℝ → ℝ} {Tr : cuffs S → S → Drawing S} + +/-- All the boxes together. -/ +abbrev allφ (φ : ∀ c, ι c → ℝ × ℝ → S) : (Σ c, ι c) → ℝ × ℝ → S := fun i => φ i.1 i.2 + +/-- All the height functions together. -/ +abbrev allf (f : ∀ c, ι c → ℝ → ℝ) : (Σ c, ι c) → ℝ → ℝ := fun i => f i.1 i.2 + +omit [T2Space S] in +theorem exists_cuff_of_bd {x : S} (hx : x ∈ bd S) : ∃ c : cuffs S, x ∈ c.1 := by + have h : x ∈ ⋃₀ cuffs S := (sUnion_cuffs (S := S)).symm ▸ hx + obtain ⟨C, hC, hxC⟩ := h + exact ⟨⟨C, hC⟩, hxC⟩ + +omit [T2Space S] in +theorem mem_scriptA_of_isScriptASet {C X : Set S} {y : S} (hX : IsScriptASet G r C X) + (hy : y ∈ X) : y ∈ scriptA G r C := + ⟨X, hX, hy⟩ + +/-- Collars of different cuffs are disjoint. This uses (5.3) for the circuits, and then the fact +that a set that is open and closed is everything. -/ +theorem collars_disjoint (hS : IsSurface S) [ConnectedSpace S] (hcyl : ¬ Nonempty + (S ≃ₜ SurfaceModel 0 0 2)) (h : ∀ c, IsCuffCollar G c.1 r v (Mo c) (AC c) (Mo₂ c) (Mo₃ c) (φ c) + (g c) (f c) (Tr c)) (hα : r + r < alpha G) {c c' : cuffs S} (hne : c ≠ c') : Disjoint (Mo c) + (Mo c') := by + have hne' : c.1 ≠ c'.1 := fun he => hne (Subtype.ext he) + have hA : ∀ {c c' : cuffs S}, c ≠ c' → Disjoint (AC c) (AC c') := fun {c c'} hne => by + obtain ⟨A, hA, hAc, hAU⟩ := (h c).circ + obtain ⟨A', hA', hAc', hAU'⟩ := (h c').circ + have hV : Disjoint A.V A'.V := by + rw [disjoint_left] + intro y hy hy' + obtain ⟨X, hX, hyX⟩ := (h c).reach y (hAU ▸ A.V_subset_U hy) (hA.1 hy) + obtain ⟨X', hX', hyX'⟩ := (h c').reach y (hAU' ▸ A'.V_subset_U hy') (hA'.1 hy') + have h5 := theorem_5_3_proof hS hcyl G c.2 c'.2 (fun he => hne (Subtype.ext he)) hα + exact (eq_empty_iff_forall_notMem.mp h5 y) ⟨mem_scriptA_of_isScriptASet hX hyX, + mem_scriptA_of_isScriptASet hX' hyX'⟩ + rw [← hAU, ← hAU'] + exact disjoint_U_of_disjoint_V hA hA' hV + have hAM : ∀ {c c' : cuffs S}, c ≠ c' → Disjoint (AC c) (Mo c') := fun {c c'} hne => by + obtain ⟨A, -, hAc, hAU⟩ := (h c).circ + have hconn : IsPreconnected (AC c) := by + exact hAU ▸ (isConnected_of_isOArc (IsCircuit.isOArc_U hAc)).isPreconnected + have hO1 : IsOpen (Mo c' \ AC c') := (h c').openMo + have hO2 : IsOpen (Mo c')ᶜ := (h c').closedMo.isOpen_compl + have hdj : Disjoint (Mo c' \ AC c') (Mo c')ᶜ := disjoint_left.mpr fun x hx hx' => hx' hx.1 + have hsub : AC c ⊆ (Mo c' \ AC c') ∪ (Mo c')ᶜ := fun x hx => by + by_cases hxM : x ∈ Mo c' + · exact .inl ⟨hxM, disjoint_left.mp (hA hne) hx⟩ + · exact .inr hxM + rcases hconn.subset_or_subset hO1 hO2 hdj hsub with h1 | h1 + · exfalso + have h2 : IsPlanarInCappedCuff c'.1 (AC c) := (h c').planarMo.mono (h1.trans sdiff_subset) + exact hcyl (surroundsCuff_and_planarInCappedCuff_imp_cylinder hS c.2 c'.2 (fun he => hne + (Subtype.ext he)) (hAU ▸ (IsCircuit.isOArc_U hAc)) (h c).surrounds h2) + · exact disjoint_left.mpr fun x hx hx' => h1 hx hx' + rw [disjoint_iff_inter_eq_empty] + by_contra hne₀ + have hclo : IsClopen (Mo c ∩ Mo c') := by + refine ⟨(h c).closedMo.inter (h c').closedMo, ?_⟩ + have heq : Mo c ∩ Mo c' = (Mo c \ AC c) ∩ (Mo c' \ AC c') := by + ext x + constructor + · rintro ⟨h1, h2⟩ + exact ⟨⟨h1, fun h3 => disjoint_left.mp (hAM hne) h3 h2⟩, h2, + fun h3 => disjoint_left.mp (hAM hne.symm) h3 h1⟩ + · rintro ⟨h1, h2⟩ + exact ⟨h1.1, h2.1⟩ + rw [heq] + exact (h c).openMo.inter (h c').openMo + have huniv := hclo.eq_univ (nonempty_iff_ne_empty.mpr hne₀) + obtain ⟨A, -, hAc, hAU⟩ := (h c).circ + have hne₁ : (AC c).Nonempty := by + rw [← hAU] + exact (isConnected_of_isOArc (IsCircuit.isOArc_U hAc)).nonempty + obtain ⟨x, hx⟩ := hne₁ + have h2 : x ∈ Mo c ∩ Mo c' := huniv ▸ mem_univ x + exact disjoint_left.mp (hAM hne) hx h2.2 + +/-- All the graph lifts together. -/ +noncomputable def allTr (G : Drawing S) (Tr : cuffs S → S → Drawing S) : S → Drawing S := by + classical + exact fun x => if h : ∃ c : cuffs S, x ∈ c.1 then Tr h.choose x else G + +omit [T2Space S] in +theorem allTr_eq {c : cuffs S} {x : S} (hx : x ∈ c.1) (hd : ∀ c c' : cuffs S, c ≠ c' + → Disjoint c.1 c'.1) : allTr G Tr x = Tr c x := by + classical + have h : ∃ c : cuffs S, x ∈ c.1 := ⟨c, hx⟩ + have h2 : h.choose = c := by + by_contra hne + exact disjoint_left.mp (hd _ _ hne) h.choose_spec hx + rw [allTr, dite_eq_left h, h2] + +omit [T2Space S] in +/-- The collars together make a frame. -/ +theorem collars_frame (h : ∀ c, IsCuffCollar G c.1 r v (Mo c) (AC c) (Mo₂ c) (Mo₃ c) (φ c) (g c) + (f c) (Tr c)) (hdis : ∀ c c' : cuffs S, c ≠ c' → Disjoint (Mo c) (Mo c')) : IsCollapseFrame G + (allφ φ) (fun i => g i.1 i.2) (allf f) (allTr G Tr) := by + classical + have hdc : ∀ c c' : cuffs S, c ≠ c' → Disjoint c.1 c'.1 := fun c c' hne => (hdis c c' hne).mono + (h c).cMo (h c').cMo + refine ⟨⟨fun i => (h i.1).box.cont i.2, fun i => (h i.1).box.inj i.2, ?_, ?_⟩, fun i => + (h i.1).data i.2, fun i => (h i.1).bottom i.2, ?_, fun i => (h i.1).graphU i.2, fun i p hp he + hv => ?_, ?_, ?_⟩ + · rintro ⟨c, a⟩ ⟨c', a'⟩ p p' hp hp' he + by_cases hcc : c = c' + · subst hcc + rcases (h c).box.meet a a' p p' hp hp' he with ⟨rfl, h1⟩ | h1 + · exact .inl ⟨rfl, h1⟩ + · exact .inr h1 + · have he' : φ c a p = φ c' a' p' := he + have h1 := ((h c).inMo a p hp).1 + rw [he'] at h1 + exact absurd h1 (disjoint_left.mp (hdis c c' hcc).symm ((h c').inMo a' p' hp').1) + · have heq : (⋃ i : Σ c, ι c, allφ φ i '' {p ∈ cuffBox | p.2 < 2}) = ⋃ c, ⋃ a, φ c a '' {p ∈ + cuffBox | p.2 < 2} := iUnion_sigma _ + rw [heq] + exact isOpen_iUnion fun c => (h c).box.isOpen + · intro x hx + obtain ⟨c, hc⟩ := exists_cuff_of_bd hx + obtain ⟨a, ha⟩ := mem_iUnion.mp ((h c).allBottom hc) + exact mem_iUnion.mpr ⟨⟨c, a⟩, ha⟩ + · obtain ⟨h1, h2⟩ := (h i.1).graphV i.2 p hp he hv + refine ⟨⟨h1.1, cuff_subset_bd i.1.2 h1.2⟩, ?_⟩ + rw [allTr_eq h1.2 hdc] + exact h2 + · intro x hx + obtain ⟨c, hc⟩ := exists_cuff_of_bd hx.2 + obtain ⟨a, e, h1, h2, h3⟩ := (h c).corner x ⟨hx.1, hc⟩ + exact ⟨⟨c, a⟩, e, h1, h2, h3⟩ + · intro x hx + obtain ⟨c, hc⟩ := exists_cuff_of_bd hx.2 + rw [allTr_eq hc hdc] + obtain ⟨h1, h2, h3, h4, h5⟩ := (h c).tree x ⟨hx.1, hc⟩ + refine ⟨h1, h2, h3, fun a ha => ?_, h5⟩ + obtain ⟨i, p, hp, h6, h7, h8⟩ := h4 a ha + exact ⟨⟨c, i⟩, p, hp, h6, h7, h8⟩ + +variable {ρ : S → S} {Ψ : unitInterval × S → S} + +omit [T2Space S] in +/-- A point above the graphs, that `ρ` sends to a `G'`-normal set, and that is on `G`, is a vertex +of `G`. -/ +theorem IsGlued.normal_up {ι' : Type*} {φ' : ι' → ℝ × ℝ → S} {g' f' : ι' → ℝ → ℝ} {Tr' : S + → Drawing S} (hg : IsGlued G G₁ G' ρ Ψ φ' g' f' Tr') {B : Set S} (hB : G'.IsNormal B) {z : S} + (hz : IsAboveGraph φ' f' z) (hzB : ρ z ∈ B) (hzU : z ∈ G.U) : z ∈ G.V := by + have h1 : ρ z ∈ G'.U := by + rw [hg.col.imU] + exact mem_image_of_mem ρ (hg.upU z hz hzU) + have h2 : ρ z ∈ G'.V := hB ⟨hzB, h1⟩ + rw [hg.col.imV] at h2 + obtain ⟨w, hw, he⟩ := h2 + have h3 : w = z := hg.col.inj z hz w he + exact hg.downV z hz (h3 ▸ hw) + +/-- **Claim (a)** of the proof of (5.9), which is condition (i) of (4.6) for `G'`. -/ +theorem claim_a (hS : IsSurface S) [ConnectedSpace S] (hcyl : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 2)) + (h : ∀ c, IsCuffCollar G c.1 r v (Mo c) (AC c) (Mo₂ c) (Mo₃ c) (φ c) (g c) (f c) (Tr c)) + (hdis : ∀ c c' : cuffs S, c ≠ c' → Disjoint (Mo c) (Mo c')) [Finite (cuffs S)] + (hg : IsGlued G G₁ G' ρ Ψ (allφ φ) (fun i => g i.1 i.2) (allf f) (allTr G Tr)) (hα : r + + (r + v) < alpha G) (hα' : r + v + r < alpha G) {B : Set S} (hB : G'.IsNormal B) + (hI : IsIArc B) (hc : (G'.V ∩ B).ncard ≤ v) : ∃ C ∈ cuffs S, lineEnds B ⊆ C := by + classical + obtain ⟨p, q, hp, hq, hl⟩ := hI + obtain ⟨c₀, hc₀⟩ := exists_cuff_of_bd hp + obtain ⟨c₁, hc₁⟩ := exists_cuff_of_bd hq + by_cases hcc : c₀ = c₁ + · subst hcc + refine ⟨c₀.1, c₀.2, (lineEnds_subset hl).trans ?_⟩ + rintro z (rfl | rfl) + · exact hc₀ + · exact hc₁ + exfalso + obtain ⟨τ, hτ⟩ := exists_isParam hl + have h01 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 ∧ (1 : ℝ) ∈ Icc (0 : ℝ) 1 := ⟨⟨le_rfl, zero_le_one⟩, + zero_le_one, le_rfl⟩ + obtain ⟨t₁, t₂, c₂, h0, hlt, h1, hc₂, ht₁, ht₂, hgap⟩ := + exists_gap_between_sets hτ.cont (fun c => (h c).closedMo) hdis hcc + (by rw [hτ.zero]; exact (h c₀).cMo hc₀) + (by rw [hτ.one]; exact (h c₁).cMo hc₁) + have hsub : Icc t₁ t₂ ⊆ Icc (0 : ℝ) 1 := Icc_subset_Icc h0 h1 + have hcont := hτ.cont.mono hsub + have hoffMo : ∀ t ∈ Icc t₁ t₂, ∀ c, τ t ∉ Mo c \ AC c := fun t ht c => gap_end_off hlt hcont ht + (h c).openMo fun s hs hs' => hgap s hs c hs'.1 + have hoffBox : ∀ t ∈ Icc t₁ t₂, ∀ i : Σ c, ι c, τ t ∉ allφ φ i '' cuffBox := fun t ht i => by + rintro ⟨p', hp', he⟩ + exact hoffMo t ht i.1 (he ▸ (h i.1).inMo i.2 p' hp') + have hab : ∀ t ∈ Icc t₁ t₂, IsAboveGraph (allφ φ) (allf f) (τ t) := fun t ht i p' hp' he + => absurd (mem_image_of_mem _ hp') (he ▸ hoffBox t ht i) + have hρ : ∀ t ∈ Icc t₁ t₂, ρ (τ t) = τ t := fun t ht => hg.voff _ (hoffBox t ht) + have hτB : ∀ t ∈ Icc t₁ t₂, τ t ∈ B := fun t ht => hτ.mem (hsub ht) + set L₀ : Set S := τ '' Icc t₁ t₂ with hL₀ + have hl₀ : IsLineWithEnds L₀ (τ t₁) (τ t₂) := isLineWithEnds_image (isLine_Icc hlt) hcont + (hτ.inj.mono hsub) + have hnorm : ∀ z ∈ L₀, z ∈ G.U → z ∈ G.V := by + rintro _ ⟨t, ht, rfl⟩ hU + exact hg.normal_up hB (hab t ht) (by rw [hρ t ht]; exact hτB t ht) hU + have ht₁m : t₁ ∈ Icc t₁ t₂ := ⟨le_rfl, hlt.le⟩ + have ht₂m : t₂ ∈ Icc t₁ t₂ := ⟨hlt.le, le_rfl⟩ + have hAU : ∀ c, AC c ⊆ G.U := fun c => by + obtain ⟨A, hA, -, hAU⟩ := (h c).circ + exact hAU ▸ hA.U_subset + have hu : τ t₁ ∈ AC c₀ := by + by_contra hn + exact hoffMo t₁ ht₁m c₀ ⟨ht₁, hn⟩ + have hu' : τ t₂ ∈ AC c₂ := by + by_contra hn + exact hoffMo t₂ ht₂m c₂ ⟨ht₂, hn⟩ + obtain ⟨X₁, hX₁, huX⟩ := (h c₀).reach _ hu (hnorm _ (mem_image_of_mem τ ht₁m) (hAU _ hu)) + obtain ⟨X₂, hX₂, huX'⟩ := (h c₂).reach _ hu' (hnorm _ (mem_image_of_mem τ ht₂m) (hAU _ hu')) + have hcard₀ : (G.V ∩ L₀).ncard ≤ v := by + refine le_trans (ncard_le_ncard ?_ (G'.finite_V.subset inter_subset_left)) hc + rintro _ ⟨hV, t, ht, rfl⟩ + refine ⟨?_, hτB t ht⟩ + rw [hg.col.imV] + exact ⟨τ t, hg.upV _ (hab t ht) hV, hρ t ht⟩ + obtain ⟨hs₁, hc₁', hn₁, -, hk₁⟩ := id hX₁ + have hX : IsScriptASet G (r + v) c₀.1 (X₁ ∪ L₀) := by + refine surrounds_of_superset hS hcyl hX₁ subset_union_left (theorem_11_6_proof hS hs₁ + (isSolid_of_isLineWithEnds hS hl₀)) (hc₁'.union ⟨_, huX, hl₀.left_mem⟩ ⟨⟨_, hl₀.left_mem⟩, + GM12.line_conn hl₀⟩) ?_ ?_ (by omega) hα + · rintro z ⟨hz | hz, hzU⟩ + · exact hn₁ ⟨hz, hzU⟩ + · exact hnorm z hz hzU + · rw [inter_union_distrib_left] + exact (ncard_union_le _ _).trans (add_le_add hk₁ hcard₀) + have h5 := theorem_5_3_proof hS hcyl G c₀.2 c₂.2 (fun he => hc₂ (Subtype.ext he).symm) hα' + exact (eq_empty_iff_forall_notMem.mp h5 (τ t₂)) ⟨mem_scriptA_of_isScriptASet hX (.inr + (mem_image_of_mem τ ht₂m)), mem_scriptA_of_isScriptASet hX₂ huX'⟩ + +omit [T2Space S] in +/-- A curve that is pushed by a homotopy to a null-homotopic `O`-arc: if `F` is null-homotopic and +`ρ` maps `F` homeomorphically to `B`, then `B` is null-homotopic. -/ +theorem nullHomotopic_of_push {F B : Set S} (hc : Continuous Ψ) (h0 : ∀ x, Ψ (0, x) = x) + (h1 : ∀ x, Ψ (1, x) = ρ x) (e : F ≃ₜ B) (he : ∀ x, (e x : S) = ρ x) + (hF : IsNullHomotopicOArc F) : IsNullHomotopicOArc B := by + obtain ⟨ψ, hψ⟩ := hF + refine ⟨ψ.trans e, closedCurveIsNullHomotopicIn_of_homotopic ?_ hψ⟩ + refine ⟨⟨fun p => Ψ (unitInterval.symm p.2, (ψ p.1).1), by fun_prop⟩, fun _ => mem_univ _, + fun x => ?_, fun x => ?_⟩ + · change Ψ (unitInterval.symm 0, _) = _ + rw [unitInterval.symm_zero, h1] + exact (he (ψ x)).symm + · change Ψ (unitInterval.symm 1, _) = _ + rw [unitInterval.symm_one, h0] + rfl + +/-- **Claim (b)** of the proof of (5.9), which is condition (ii) of (4.6) for `G'`. -/ +theorem claim_b (hS : IsSurface S) (h : ∀ c, IsCuffCollar G c.1 r v (Mo c) + (AC c) (Mo₂ c) (Mo₃ c) (φ c) (g c) (f c) (Tr c)) (hdis : ∀ c c' : cuffs S, c ≠ c' → Disjoint + (Mo c) (Mo c')) [Finite (cuffs S)] [∀ c, Finite (ι c)] (hF : IsCollapseFrame G (allφ φ) (fun i + => g i.1 i.2) (allf f) (allTr G Tr)) (hg : IsGlued G G₁ G' ρ Ψ (allφ φ) (fun i => g i.1 i.2) + (allf f) (allTr G Tr)) (hα : v < alpha G) {B : Set S} (hB : G'.IsNormal B) (hO : IsOArc B) + (hc : (G'.V ∩ B).ncard ≤ v) : IsNullHomotopicOArc B ∨ ∃ C ∈ cuffs S, + IsNullHomotopicOArcInCappedCuff C B ∧ G'.V ∩ C ⊆ B := by + classical + have : CompactSpace S := hS.1 + have hdc : ∀ c c' : cuffs S, c ≠ c' → Disjoint c.1 c'.1 := fun c c' hne => (hdis c c' hne).mono + (h c).cMo (h c').cMo + have hρeq : ρ = fun x => Ψ (1, x) := funext fun x => (hg.col.one x).symm + have hρc : Continuous ρ := by + rw [hρeq] + have := hg.col.contΨ + fun_prop + set A : Set S := {x | IsAboveGraph (allφ φ) (allf f) x} with hA + have hinj : ∀ x ∈ A, ∀ y, ρ y = ρ x → y = x := hg.col.inj + have hnorm : ∀ z ∈ A, ρ z ∈ B → z ∈ G.U → z ∈ G.V := fun z hz h1 h2 => hg.normal_up hB hz h1 h2 + by_cases hX : (B ∩ (G.V ∩ bd S)).Nonempty + · obtain ⟨x₀, hx₀B, hx₀⟩ := hX + obtain ⟨c, hc₀⟩ := exists_cuff_of_bd hx₀.2 + have hx₀V : x₀ ∈ G'.V ∩ B := ⟨(hg.bdV.symm ▸ hx₀ : x₀ ∈ G'.V ∩ bd S).1, hx₀B⟩ + have hcount : ∀ Z : Set S, Z ⊆ A ∩ G.V → ρ '' Z ⊆ B → Z.ncard < v := fun Z hZ hZB => by + have hi : InjOn ρ Z := fun a ha b hb he => (hinj a (hZ ha).1 b he.symm).symm + rw [← hi.ncard_image] + have hsub : ρ '' Z ⊆ (G'.V ∩ B) \ {x₀} := by + rintro _ ⟨z, hz, rfl⟩ + refine ⟨⟨?_, hZB (mem_image_of_mem ρ hz)⟩, fun he => (hg.above_iff z).mp (hZ hz).1 ?_⟩ + · rw [hg.col.imV] + exact mem_image_of_mem ρ (hg.upV z (hZ hz).1 (hZ hz).2) + · have he' : ρ z = x₀ := he + rw [he'] + exact hx₀.2 + have hfin : ((G'.V ∩ B) \ {x₀}).Finite := (G'.finite_V.subset inter_subset_left).subset + sdiff_subset + have h1 := ncard_le_ncard hsub hfin + rw [ncard_sdiff_singleton_of_mem hx₀V] at h1 + have h2 : 0 < (G'.V ∩ B).ncard := (ncard_pos (G'.finite_V.subset inter_subset_left)).mpr ⟨_, + hx₀V⟩ + omega + have hoffOther : ∀ z ∈ Mo c, ∀ (i : Σ c, ι c), ∀ p, p ∈ cuffBox → allφ φ i p = z → i.1 = c + := fun z hz i p hp he => by + by_contra hne + exact disjoint_left.mp (hdis _ _ hne) (he ▸ ((h i.1).inMo i.2 p hp).1) hz + have hab : ∀ z ∈ Mo₂ c, z ∈ G.U → z ∈ A := fun z hz hU i p hp he => by + obtain ⟨c', a⟩ := i + have hcc : c' = c := hoffOther z ((h c).mo₂ hz) ⟨c', a⟩ p hp he + subst hcc + exact (h c').above₂ z hz hU a p hp he + have hoff3 : ∀ z ∈ Mo₃ c, ∀ i : Σ c, ι c, z ∉ allφ φ i '' cuffBox := fun z hz i => by + rintro ⟨p, hp, he⟩ + obtain ⟨c', a⟩ := i + have hcc : c' = c := hoffOther z ((h c).mo₃ hz) ⟨c', a⟩ p hp he + subst hcc + exact (h c').off₃ z hz a ⟨p, hp, he⟩ + have hid : ∀ z ∈ Mo₃ c, z ∈ G.U → z ∈ A ∧ ρ z = z := fun z hz _ => ⟨fun i p hp he => absurd + (mem_image_of_mem _ hp) (he ▸ hoff3 z hz i), hg.voff z (hoff3 z hz)⟩ + have htree : ∀ x ∈ G.V ∩ c.1, ∀ a ∈ (Tr c x).U, ρ a = x := fun x hx a ha => by + have hxb : x ∈ G.V ∩ bd S := ⟨hx.1, cuff_subset_bd c.2 hx.2⟩ + obtain ⟨-, -, -, h4, -⟩ := hg.col.tree x hxb + exact h4 a (by rw [allTr_eq hx.2 hdc]; exact ha) + rcases (h c).touch ρ A B hρc hinj htree hnorm hcount hab hid hO ⟨x₀, hx₀B, hx₀.1, hc₀⟩ with h1 + | ⟨h1, h2⟩ + · exact .inl h1 + · refine .inr ⟨c.1, c.2, h1, fun z hz => h2 ⟨?_, hz.2⟩⟩ + have h3 : z ∈ G'.V ∩ bd S := ⟨hz.1, cuff_subset_bd c.2 hz.2⟩ + exact (hg.bdV ▸ h3 : z ∈ G.V ∩ bd S).1 + -- Now `B` misses the vertices on the boundary, and we lift it to an `O`-arc off the part below + -- the graphs. + have hXoff : ∀ z ∈ B, z ∈ G.V → z ∉ bd S := fun z hz hV hb => hX ⟨z, hz, hV, hb⟩ + have hdata := hF.data + have hBo := isOpen_below hF.box hdata + set Y : Set S := {z | ρ z ∈ B ∧ ¬ IsBelowGraph (allφ φ) (allf f) z} with hY + have hYcl : IsClosed Y := (hO.isCompact.isClosed.preimage hρc).inter hBo.isClosed_compl + have hcorner : ∀ (i : Σ c, ι c) (e : ℝ), (e = 0 ∨ e = 1) → allφ φ i (e, 0) ∉ B := fun i e he hb + => by + have h1 := (h i.1).cornerV i.2 e he + exact hXoff _ hb h1.1 (cuff_subset_bd i.1.2 h1.2) + have hgraph : ∀ z ∈ Y, z ∉ A → ∃ (i : Σ c, ι c) (p : ℝ × ℝ), p ∈ cuffBox ∧ allφ φ i p = z ∧ p.2 + = allf f i p.1 := fun z hz hzA => by + simp only [hA, mem_ofPred_eq, IsAboveGraph] at hzA + push Not at hzA + obtain ⟨i, p, hp, he, hle⟩ := hzA + refine ⟨i, p, hp, he, le_antisymm hle (not_lt.mp fun hlt => hz.2 ⟨i, p, hp, he, hlt⟩)⟩ + have hgmid : ∀ (i : Σ c, ι c) (p : ℝ × ℝ), p ∈ cuffBox → p.2 = allf f i p.1 → ρ (allφ φ i p) ∈ B + → ρ (allφ φ i p) = allφ φ i (g i.1 i.2 p.1, 0) ∧ 0 < g i.1 i.2 p.1 ∧ g i.1 i.2 p.1 < 1 + := fun i p hp hgr hb => by + have h1 : ρ (allφ φ i p) = allφ φ i (g i.1 i.2 p.1, 0) := by + rw [hg.val i p hp, boxCollapse_under (hdata i) hp hgr.le] + rw [h1] at hb + have hm := (hdata i).gmem hp.1 + refine ⟨h1, lt_of_le_of_ne hm.1 fun he => ?_, lt_of_le_of_ne hm.2 fun he => ?_⟩ + · exact hcorner i 0 (.inl rfl) (by rw [← he] at hb; exact hb) + · exact hcorner i 1 (.inr rfl) (by rw [he] at hb; exact hb) + have hinjY : InjOn ρ Y := fun z hz z' hz' he => by + by_cases hza : z ∈ A + · exact (hinj z hza z' he.symm).symm + by_cases hza' : z' ∈ A + · exact hinj z' hza' z he + obtain ⟨i, p, hp, rfl, hgr⟩ := hgraph z hz hza + obtain ⟨i', p', hp', rfl, hgr'⟩ := hgraph z' hz' hza' + obtain ⟨h1, h2, h3⟩ := hgmid i p hp hgr hz.1 + obtain ⟨h1', h2', h3'⟩ := hgmid i' p' hp' hgr' hz'.1 + rw [h1, h1'] at he + have hbx : (g i.1 i.2 p.1, (0 : ℝ)) ∈ cuffBox := ⟨⟨h2.le, h3.le⟩, le_rfl, by norm_num⟩ + have hbx' : (g i'.1 i'.2 p'.1, (0 : ℝ)) ∈ cuffBox := ⟨⟨h2'.le, h3'.le⟩, le_rfl, by norm_num⟩ + rcases hF.box.meet i i' _ _ hbx hbx' he with ⟨rfl, h4⟩ | ⟨-, h4, -⟩ + · have h5 : g i.1 i.2 p.1 = g i.1 i.2 p'.1 := congrArg Prod.fst h4 + have h6 := (h i.1).gstrict i.2 p.1 hp.1 p'.1 hp'.1 h5 h2 h3 + have h7 : p.2 = p'.2 := by + rw [hgr, hgr', h6] + rw [show p = p' from Prod.ext h6 h7] + · rcases h4 with h4 | h4 + · exact absurd h4 h2.ne' + · exact absurd h4 h3.ne + have hsurj : ∀ y ∈ B, ∃ z ∈ Y, ρ z = y := fun y hy => by + by_cases hyb : y ∈ boxBottom (allφ φ) + · obtain ⟨i, m₀, hm₀, rfl⟩ := mem_iUnion.mp hyb + have hne0 : m₀ ≠ 0 := fun he => hcorner i 0 (.inl rfl) (by rw [he] at hy; exact hy) + have hne1 : m₀ ≠ 1 := fun he => hcorner i 1 (.inr rfl) (by rw [he] at hy; exact hy) + have hsubI : Icc (g i.1 i.2 0) (g i.1 i.2 1) ⊆ g i.1 i.2 '' Icc 0 1 + := intermediate_value_Icc zero_le_one (hdata i).gcont + rw [(hdata i).g0, (hdata i).g1] at hsubI + obtain ⟨m, hm, hgm⟩ := hsubI hm₀ + have hfm := (hdata i).f1 m hm + have hp : (m, allf f i m) ∈ cuffBox := ⟨hm, by linarith [hfm.1], by linarith [hfm.2]⟩ + have hm0 : m ≠ 0 := fun he => hne0 (by rw [← hgm, he]; exact (hdata i).g0) + have hm1 : m ≠ 1 := fun he => hne1 (by rw [← hgm, he]; exact (hdata i).g1) + have hval : ρ (allφ φ i (m, allf f i m)) = allφ φ i (m₀, 0) := by + rw [hg.val i _ hp, boxCollapse_under (hdata i) hp le_rfl] + change allφ φ i (g i.1 i.2 m, 0) = _ + rw [hgm] + refine ⟨_, ⟨?_, ?_⟩, hval⟩ + · rwa [hval] + · rintro ⟨i', p', hp', he, hlt⟩ + rcases hF.box.meet i' i p' _ hp' hp he with ⟨rfl, h1⟩ | ⟨-, -, h1, -⟩ + · rw [h1] at hlt + exact lt_irrefl _ hlt + · rcases h1 with h1 | h1 + · exact hm0 h1 + · exact hm1 h1 + · obtain ⟨x, hx, he⟩ := hF.box.surj_above hdata hg.val hg.voff hyb + exact ⟨x, ⟨he ▸ hy, not_below_of_above hx⟩, he⟩ + have hYimg : ρ '' Y = B := by + refine subset_antisymm ?_ fun y hy => ?_ + · rintro _ ⟨z, hz, rfl⟩ + exact hz.1 + · obtain ⟨z, hz, he⟩ := hsurj y hy + exact ⟨z, hz, he⟩ + have hYc : CompactSpace Y := isCompact_iff_compactSpace.mp hYcl.isCompact + let e₀ : Y → B := fun z => ⟨ρ z.1, z.2.1⟩ + have he₀ : Bijective e₀ := by + refine ⟨fun z z' he => Subtype.ext (hinjY z.2 z'.2 (congrArg Subtype.val he)), fun y => ?_⟩ + obtain ⟨z, hz, he⟩ := hsurj y.1 y.2 + exact ⟨⟨z, hz⟩, Subtype.ext he⟩ + have he₀c : Continuous e₀ := by + fun_prop + let e : Y ≃ₜ B := he₀c.homeoOfEquivCompactToT2 (f := Equiv.ofBijective e₀ he₀) + have hYO : IsOArc Y := by + obtain ⟨ψ⟩ := hO + exact ⟨ψ.trans e.symm⟩ + have hYU : ∀ z ∈ Y, z ∈ G.U → z ∈ G.V := fun z hz hU => by + by_cases hza : z ∈ A + · exact hnorm z hza hz.1 hU + · obtain ⟨i, p, hp, rfl, hgr⟩ := hgraph z hz hza + exact hF.graphU i p hp hgr hU + have hYA : ∀ z ∈ Y, z ∈ G.V → z ∈ A := fun z hz hV => by + by_contra hza + obtain ⟨i, p, hp, rfl, hgr⟩ := hgraph z hz hza + obtain ⟨h1, h2, h3⟩ := hgmid i p hp hgr hz.1 + obtain ⟨h4, -⟩ := hF.graphV i p hp hgr hV + have h5 := hz.1 + rw [h1] at h5 + exact hXoff _ h5 h4.1 h4.2 + have hcard : (G.V ∩ Y).ncard ≤ v := by + have hi : InjOn ρ (G.V ∩ Y) := hinjY.mono inter_subset_right + rw [← hi.ncard_image] + refine le_trans (ncard_le_ncard ?_ (G'.finite_V.subset inter_subset_left)) hc + rintro _ ⟨z, ⟨hV, hz⟩, rfl⟩ + refine ⟨?_, hz.1⟩ + rw [hg.col.imV] + exact mem_image_of_mem ρ (hg.upV z (hYA z hz hV) hV) + have hnear : IsNearPlanar Y := by + by_contra hn + have h1 := alpha_le_of_candidate (G := G) (X := Y) ⟨isSolid_of_isOArc hS hYO, + isConnected_of_isOArc hYO, fun z hz => hYU z hz.1 hz.2, hn⟩ + rw [inter_comm] at h1 + omega + have hpush : IsPlanar Y → IsNullHomotopicOArc B := fun hp => by + have h1 := (isPlanar_iff_isNullHomotopicOArc_of_isOArc hS hYO).mp hp + exact nullHomotopic_of_push hg.col.contΨ hg.col.zero hg.col.one e (fun x => rfl) h1 + by_cases hp : IsPlanar Y + · exact .inl (hpush hp) + rcases hnear with hn | ⟨C, hC, hn⟩ + · exact absurd hn hp + exact ((h ⟨C, hC⟩).inner Y hYO (fun z hz => hYU z hz.1 hz.2) hcard ⟨hC, hn, + hp⟩ fun z hz hz' => hz.2 (by + obtain ⟨i, p, hp', he, hlt⟩ := hz' + exact ⟨⟨⟨C, hC⟩, i⟩, p, hp', he, hlt⟩)).elim + +/-- The end of the proof of (5.9): the collars let us apply (4.6) to `G'`, and a forest of `G'` +lifts to `G`. -/ +theorem isGFeasible_of_collars [T1Space S] (hS : IsSurface S) [ConnectedSpace S] (hcuffs : 2 ≤ + (cuffs S).ncard) (hcyl : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 2)) {k : ℕ} {H : Drawing S} + (hG : G.IsProper) (hbd_card : (G.V ∩ bd S).ncard ≤ 2 * k) (h : ∀ c, IsCuffCollar G c.1 r + (vSurface S k) (Mo c) (AC c) (Mo₂ c) (Mo₃ c) (φ c) (g c) (f c) (Tr c)) [∀ c, Finite (ι c)] + (hα₀ : r + r < alpha G) (hα : r + (r + vSurface S k) < alpha G) + (hα' : r + vSurface S k + r < alpha G) (hα₁ : vSurface S k < alpha G) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) (hH : IsSurfaceForest H) + (hbd_eq : G.V ∩ bd S = H.V ∩ bd S) : IsGFeasible G H := by + have : CompactSpace S := hS.1 + have : Finite (cuffs S) := (finite_of_ncard_pos (by omega) : (cuffs S).Finite).to_subtype + have : Nonempty S := ConnectedSpace.toNonempty + have hdis : ∀ c c' : cuffs S, c ≠ c' → Disjoint (Mo c) (Mo c') := fun c c' hne + => collars_disjoint hS hcyl h hα₀ hne + have hF := collars_frame h hdis + have hbd : IsClosed (bd S) := (cuff_statement.{u} S hS).1 + obtain ⟨G₁, G', ρ, Ψ, hg⟩ := hF.exists_collapse hbd + have hbdV := hg.bdV + have hproper : G'.IsProper := by + rintro z ⟨hzb, hzU⟩ + rw [hg.col.imU] at hzU + obtain ⟨a, ha, rfl⟩ := hzU + rw [hg.col.imV] + refine ⟨a, ?_, rfl⟩ + by_contra hn + exact (hg.above_iff a).mp (hg.col.off ⟨ha, hn⟩) hzb + have hfe : IsGFeasible G' H := by + refine theorem_4_6_proof hS hcuffs k G' H hproper (by rw [hbdV]; exact hbd_card) + (fun B h1 h2 h3 => claim_a hS hcyl h hdis hg hα hα' h1 h2 h3) + (fun B h1 h2 h3 => claim_b hS h hdis hF hg hα₁ h1 h2 h3) (fun C hC => ?_) hH + (by rw [hbdV]; exact hbd_eq) + have hsub : G.V ∩ C ⊆ G'.V ∩ C := fun z hz => by + have h1 : z ∈ G'.V ∩ bd S := hbdV ▸ (⟨hz.1, cuff_subset_bd hC hz.2⟩ : z ∈ G.V ∩ bd S) + exact ⟨h1.1, hz.2⟩ + exact (hiii C hC).trans (ncard_le_ncard hsub (G'.finite_V.subset inter_subset_left)) + exact hg.col.isGFeasible hS hG hH hbd_eq.symm hfe + +end Glue + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffCollarBuild.lean b/LeanPool/GraphMinor/GM07/CuffCollarBuild.lean new file mode 100644 index 0000000000..6a699e4d56 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffCollarBuild.lean @@ -0,0 +1,973 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffLines + +/-! +# From the core of a cuff to its collar + +Graph Minors VII, (5.9), page 235. The boxes of the core, with the height over `N(C)` and the ramps +over the pieces `N_i(C)`, make the collar of the cuff. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] [T2Space S] + +variable {G : Drawing S} {C : Set S} {j : S → T} {D : Set T} {r v ks m : ℕ} {Y E₀ Δ' Do : Set T} + {Nk Bo : Drawing S} {R : Fin ks → Drawing S} {x t : Fin ks → S} {Q : ∀ i, GraphWalk G.toGraph + (x i) (t i)} {L : Fin m → Drawing S} {El : Fin m → Set T} {N : Drawing S} + +/-- The graph with the edges of `N(C)` taken out. -/ +noncomputable def withoutEdges (G N : Drawing S) : Drawing S := G.span G.V (G.E \ N.E) + +theorem withoutEdges_V (G N : Drawing S) : (withoutEdges G N).V = G.V := by + refine subset_antisymm ?_ fun v hv => ?_ + · exact (G.span_isSubdrawing _ _).1 + · change v ∈ G.spanV _ _ + exact Or.inl ⟨hv, hv⟩ + +theorem withoutEdges_E (G N : Drawing S) : (withoutEdges G N).E = G.E \ N.E := by + rw [withoutEdges, G.span_E] + exact inter_eq_left.mpr sdiff_subset + +theorem mem_withoutEdges_or {z : S} (hz : z ∈ G.U) : z ∈ + (withoutEdges G N).U ∨ z ∈ N.U := by + by_cases hV : z ∈ G.V + · exact .inl ((withoutEdges G N).V_subset_U (by rw [withoutEdges_V]; exact hV)) + · obtain ⟨e, he, hze⟩ := G.exists_edge_of_mem hz hV + by_cases heN : e ∈ N.E + · exact .inr (N.closure_subset_U heN (subset_closure hze)) + · exact .inl ((withoutEdges G N).closure_subset_U + (by rw [withoutEdges_E]; exact ⟨he, heN⟩) (subset_closure hze)) + +theorem mem_V_of_withoutEdges (hN : N.IsSubdrawing G) {z : S} (hz : z ∈ (withoutEdges G N).U) + (hzN : z ∈ N.U) : z ∈ G.V := by + by_contra hV + have hV' : z ∉ (withoutEdges G N).V := by rwa [withoutEdges_V] + obtain ⟨e, he, hze⟩ := (withoutEdges G N).exists_edge_of_mem hz hV' + have hVN : z ∉ N.V := fun h1 => hV (hN.1 h1) + obtain ⟨e', he', hze'⟩ := N.exists_edge_of_mem hzN hVN + rw [withoutEdges_E] at he + exact he.2 (arcComponent_eq he.1 (hN.2 he') hze hze' ▸ he') + +private theorem cuff_box_lies_in_uncapped_surface + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + [T2Space S] + {G : Drawing S} + {C : Set S} + {j : S → T} + {D : Set T} + {ks : ℕ} + {E₀ : Set T} + {Δ' : Set T} + {x : Fin ks → S} + {t : Fin ks → S} + {Q : (i : Fin ks) → GraphWalk G.toGraph (x i) (t i)} + (hc : IsCappedCuff C T j D) + (F : Set (CellRec T (Fin ks))) + (Φ : CellRec T (Fin ks) → ℝ × ℝ → T) + (Sd : Fin ks → ℝ → T) + (μ : CellRec T (Fin ks) → ℝ → T) + (hfam : IsCellFamily D E₀ (fun k => j '' (walkDrawing G (Q k)).U) (fun k => j (x k)) (fun k => + j (t k)) univ F) + (hb : IsCuffBoxes D E₀ Δ' (fun k => j '' (walkDrawing G (Q k)).U) (fun k => j (x k)) (fun k => + j (t k)) F Φ Sd μ) + (c : CellRec T (Fin ks)) + (hcF : c ∈ F) + (p : ℝ × ℝ) + (hp : p ∈ cuffBox) : + Φ c p ∈ range j := by + by_contra hn + have h1 : Φ c p ∈ D := by + rcases hc.union_eq.ge (mem_univ (Φ c p)) with h2 | h2 + · exact absurd h2 hn + · exact h2 + have h2 : p.2 = 0 := (hb.inD c hcF p hp).mp h1 + have h3 : Φ c p ∈ c.R ∩ D := ⟨hb.inR c hcF p hp (by rw [h2]; exact zero_le_one), h1⟩ + rw [(hfam.cell c hcF).botCap] at h3 + have h4 := (hfam.cell c hcF).aBd h3 + rw [hc.discBd_eq] at h4 + exact hn (image_subset_range _ _ h4) + +private theorem cuff_box_height_set_closed + {S : Type u} + {T : Type u} + [TopologicalSpace S] + {ks : ℕ} + (F : Set (CellRec T (Fin ks))) + (φ : ↥F → ℝ × ℝ → S) + (hbs : IsBoxSystem φ) + (Go : Drawing S) : + let Z : ↥F → Set (ℝ × ℝ) := fun c => {p | p ∈ cuffBox ∧ 1 ≤ p.2 ∧ φ c p ∈ Go.U} + ∀ (c : ↥F), + IsClosed (Z c) := by + intro Z c + have h1 : IsClosed {p : ℝ × ℝ | p ∈ cuffBox ∧ 1 ≤ p.2} := isCompact_cuffBox.isClosed.inter + (isClosed_le continuous_const continuous_snd) + have hs : {p : ℝ × ℝ | p ∈ cuffBox ∧ 1 ≤ p.2} ⊆ cuffBox := fun _ hp => hp.1 + have h2 := ((hbs.cont c).mono hs).preimage_isClosed_of_isClosed h1 Go.isClosed_U + convert h2 using 1 + ext p + exact ⟨fun hp => ⟨⟨hp.1, hp.2.1⟩, hp.2.2⟩, fun hp => ⟨hp.1.1, hp.1.2, hp.2⟩⟩ + +private theorem cuff_box_top_graph_points_are_vertices + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + [T2Space S] + {G : Drawing S} + {C : Set S} + {j : S → T} + {D : Set T} + {r : ℕ} + {v : ℕ} + {ks : ℕ} + {m : ℕ} + {Y : Set T} + {E₀ : Set T} + {Δ' : Set T} + {Do : Set T} + {Nk : Drawing S} + {Bo : Drawing S} + {R : Fin ks → Drawing S} + {x : Fin ks → S} + {t : Fin ks → S} + {Q : (i : Fin ks) → GraphWalk G.toGraph (x i) (t i)} + {L : Fin m → Drawing S} + {El : Fin m → Set T} + (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) + (F : Set (CellRec T (Fin ks))) + (φ : ↥F → ℝ × ℝ → S) : + let Go : Drawing S := withoutEdges G Nk + let Z : ↥F → Set (ℝ × ℝ) := fun c => {p | p ∈ cuffBox ∧ 1 ≤ p.2 ∧ φ c p ∈ Go.U} + (∀ (c : ↥F), IsClosed (Z c)) → + (∀ (c : ↥F), (0, 1) ∈ Z c) → + let f : ↥F → ℝ → ℝ := fun c => topHeight (Z c) + (∀ (c : ↥F), ∀ p ∈ cuffBox, φ c p ∈ Nk.U ↔ p.2 = 1) → + (∀ (c : ↥F), ∀ p ∈ cuffBox, φ c p ∈ G.U → 1 < p.2 → f c p.1 < p.2) → + (∀ (c : ↥F) (m : ℝ), 1 ≤ f c m) → + ∀ (c : ↥F), + ∀ (p : ℝ × ℝ), + (p ∈ cuffBox) → + (p.2 = f c p.1) → + (φ c p ∈ G.U) → + p.2 = 1 ∧ φ c p ∈ G.V := by + intro Go Z hZcl hZ0 f hNk hF1 hfge c p hp he hU + have h1 : p.2 = 1 := by + by_contra hne + have hgt : 1 < p.2 := lt_of_le_of_ne (he ▸ hfge c _) (Ne.symm hne) + exact absurd (hF1 c p hp hU hgt) (he ▸ lt_irrefl _) + refine ⟨h1, ?_⟩ + have h2 : topHeight (Z c) p.1 = 1 := by + have h3 : f c p.1 = 1 := he ▸ h1 + exact h3 + have h3 := topHeight_eq_one (hZcl c) ⟨_, hZ0 c⟩ h2 + have hpeq : (p.1, (1 : ℝ)) = p := Prod.ext rfl h1.symm + rw [hpeq] at h3 + exact mem_V_of_withoutEdges h.nkSub h3.2.2 ((hNk c p hp).mpr h1) + +private theorem every_radial_line_is_a_box_side + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + [T2Space S] + {G : Drawing S} + {j : S → T} + {D : Set T} + {ks : ℕ} + {E₀ : Set T} + {x : Fin ks → S} + {t : Fin ks → S} + {Q : (i : Fin ks) → GraphWalk G.toGraph (x i) (t i)} + (F : Set (CellRec T (Fin ks))) + (Sd : Fin ks → ℝ → T) + (hfam : IsCellFamily D E₀ (fun k => j '' (walkDrawing G (Q k)).U) (fun k => j (x k)) (fun k => + j (t k)) univ F) + (φ : ↥F → ℝ × ℝ → S) + (hL : ∀ (c : ↥F), ∀ w ∈ Icc 0 2, j (φ c (0, w)) = Sd c.1.i w) + (hRt : ∀ (c : ↥F), ∀ w ∈ Icc 0 2, j (φ c (1, w)) = Sd c.1.i' w) + (i : Fin ks) : + ∃ (c : ↥F) (e : ℝ), (e = 0 ∨ e = 1) ∧ (∀ w ∈ Icc 0 2, j (φ c (e, w)) = Sd i w) ∧ (e = 0 → c.1.i + = i) ∧ (e + = 1 → c.1.i' = i) := by + obtain ⟨c, hcF, hci | hci⟩ := hfam.used i (mem_univ i) + · refine ⟨⟨c, hcF⟩, 0, .inl rfl, fun w hw => ?_, fun _ => hci, fun h1 => absurd h1 zero_ne_one⟩ + rw [hL _ w hw] + exact hci ▸ rfl + · refine ⟨⟨c, hcF⟩, 1, .inr rfl, fun w hw => ?_, fun h1 => absurd h1 one_ne_zero, fun _ => hci⟩ + rw [hRt _ w hw] + exact hci ▸ rfl + +private theorem box_top_orders_radial_trees + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + [T2Space S] + {G : Drawing S} + {C : Set S} + {j : S → T} + {D : Set T} + {r : ℕ} + {v : ℕ} + {ks : ℕ} + {m : ℕ} + {Y : Set T} + {E₀ : Set T} + {Δ' : Set T} + {Do : Set T} + {Nk : Drawing S} + {Bo : Drawing S} + {R : Fin ks → Drawing S} + {x : Fin ks → S} + {t : Fin ks → S} + {Q : (i : Fin ks) → GraphWalk G.toGraph (x i) (t i)} + {L : Fin m → Drawing S} + {El : Fin m → Set T} + (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) + (F : Set (CellRec T (Fin ks))) + (Sd : Fin ks → ℝ → T) + (φ : ↥F → ℝ × ℝ → S) + (hbs : IsBoxSystem φ) + (hbx : ∀ {m w : ℝ}, m ∈ Icc 0 1 → w ∈ Icc 0 2 → (m, w) ∈ cuffBox) + (h0I : (0 : ℝ) ∈ Icc 0 1) + (h1I : (1 : ℝ) ∈ Icc 0 1) + (h12 : (1 : ℝ) ∈ Icc 0 2) + (hφ01 : ∀ (c : ↥F), φ c (0, 1) = t c.1.i) + (hφ11 : ∀ (c : ↥F), φ c (1, 1) = t c.1.i') + (hNk : ∀ (c : ↥F), ∀ p ∈ cuffBox, φ c p ∈ Nk.U ↔ p.2 = 1) + (hRp : ∀ (i : Fin ks), IsPreconnected (R i).U) + (hRd : ∀ (i i' : Fin ks), i ≠ i' → Disjoint (R i).U (R i').U) + (htinj : Injective t) + (hused : ∀ (i : Fin ks), ∃ (c : ↥F) (e : ℝ), (e = 0 ∨ e = 1) ∧ (∀ w ∈ Icc 0 2, j (φ c (e, w)) + = Sd i w) ∧ + (e = 0 → c.1.i = i) ∧ (e = 1 → c.1.i' = i)) + (hφside : ∀ (i : Fin ks) (c : ↥F) (e : ℝ), (∀ w ∈ Icc 0 2, j (φ c (e, w)) = Sd i w) → φ c (e, + 0) = x i ∧ φ c (e, 1) = t i) + (c : ↥F) : + ∃ a b, 0 ≤ a ∧ a < b ∧ b ≤ 1 ∧ ∀ m ∈ Icc 0 1, ∀ (i : Fin ks), φ c (m, 1) ∈ (R i).U → i = + c.1.i ∧ m ≤ a ∨ i = c.1.i' ∧ b ≤ m := by + have hmem : ∀ m ∈ Icc (0 : ℝ) 1, (m, (1 : ℝ)) ∈ cuffBox := fun m hm => hbx hm h12 + let τ : ℝ → S := fun m => φ c (m, 1) + have hτ : IsParam (τ '' Icc 0 1) (t c.1.i) (t c.1.i') τ := by + refine ⟨(hbs.cont c).comp (Continuous.continuousOn (by fun_prop)) hmem, fun m hm m' hm' he + => congrArg Prod.fst (hbs.inj c (hmem m hm) (hmem m' hm') he), rfl, hφ01 c, hφ11 c⟩ + have hP : τ '' Icc 0 1 ⊆ Nk.U := by + rintro _ ⟨m, hm, rfl⟩ + exact (hNk c _ (hmem m hm)).mpr rfl + have hlr : c.1.i ≠ c.1.i' := fun he => by + have h1 : φ c (0, 1) = φ c (1, 1) := by rw [hφ01, hφ11, he] + have h2 := congrArg Prod.fst (hbs.inj c (hmem 0 h0I) (hmem 1 h1I) h1) + exact zero_ne_one h2 + have hoff : ∀ i, i ≠ c.1.i → i ≠ c.1.i' → t i ∉ τ '' Icc 0 1 := by + rintro i h1 h2 ⟨m, hm, he⟩ + obtain ⟨c', e, he', hs, h3, h4⟩ := hused i + have heI : e ∈ Icc (0 : ℝ) 1 := by + rcases he' with rfl | rfl + · exact h0I + · exact h1I + have h5 : φ c (m, 1) = φ c' (e, 1) := he.trans (hφside i c' e hs).2.symm + rcases hbs.meet c c' _ _ (hmem m hm) (hmem e heI) h5 with ⟨rfl, h6⟩ | ⟨-, h6, -⟩ + · rcases he' with rfl | rfl + · exact h1 (h3 rfl).symm + · exact h2 (h4 rfl).symm + · rcases h6 with h6 | h6 + · have h7 : m = 0 := h6 + rw [h7] at he + exact h1 (htinj (he.symm.trans (hφ01 c))) + · have h7 : m = 1 := h6 + rw [h7] at he + exact h2 (htinj (he.symm.trans (hφ11 c))) + exact exists_top_split (IsCircuit.isOArc_U h.nkCirc) h.Rsub hRp hRd h.tmem hlr hτ hP hoff + +private theorem cuff_tree_union_is_forest + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + [T2Space S] + {G : Drawing S} + {C : Set S} + {j : S → T} + {D : Set T} + {r : ℕ} + {v : ℕ} + {ks : ℕ} + {m : ℕ} + {Y : Set T} + {E₀ : Set T} + {Δ' : Set T} + {Do : Set T} + {Nk : Drawing S} + {Bo : Drawing S} + {R : Fin ks → Drawing S} + {x : Fin ks → S} + {t : Fin ks → S} + {Q : (i : Fin ks) → GraphWalk G.toGraph (x i) (t i)} + {L : Fin m → Drawing S} + {El : Fin m → Set T} + [T2Space T] + (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) + [ConnectedSpace S] + (hman : ∀ (x : T), IsManifoldPoint x) + (hj : Continuous j) + (hji : Injective j) + (hCD : ∀ z ∈ C, j z ∈ D) + (Tdr : Fin ks → Drawing S) + (hT4 : ∀ (i : Fin ks), (Tdr i).U = (R i).U ∪ (walkDrawing G (Q i)).U) + (hRT : ∀ (i : Fin ks), (R i).IsSubdrawing (Tdr i)) + (hWp : ∀ (i : Fin ks), (walkDrawing G (Q i)).IsPathBetween (x i) (t i)) + (htW : ∀ (i : Fin ks), t i ∈ (walkDrawing G (Q i)).V) + (i : Fin ks) : + IsGraphForest (Tdr i).toGraph := by + obtain ⟨a', b', hp⟩ := h.Rpath i + refine isForest_of_two_paths hp (hWp i) (hRT i) (hT4 i) (h.tmem i) ((walkDrawing G + (Q i)).V_subset_U (htW i)) ?_ + rintro z ⟨hz, hz'⟩ + rcases h.Q_inside hman hj hji hCD i z hz' with h1 | h1 + · exact h1 + · exact absurd (h.bdE ▸ mem_image_of_mem j ((h.Rsub i).U_subset hz)) h1.2 + +private theorem cuff_tree_vertices_reach_collar_vertex + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + [T2Space S] + {G : Drawing S} + {C : Set S} + {j : S → T} + {D : Set T} + {r : ℕ} + {v : ℕ} + {ks : ℕ} + {m : ℕ} + {Y : Set T} + {E₀ : Set T} + {Δ' : Set T} + {Do : Set T} + {Nk : Drawing S} + {Bo : Drawing S} + {R : Fin ks → Drawing S} + {x : Fin ks → S} + {t : Fin ks → S} + {Q : (i : Fin ks) → GraphWalk G.toGraph (x i) (t i)} + {L : Fin m → Drawing S} + {El : Fin m → Set T} + (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) + (Tdr : Fin ks → Drawing S) + (hT2 : ∀ (i : Fin ks), (Tdr i).V = (R i).V ∪ (walkDrawing G (Q i)).V) + (hRT : ∀ (i : Fin ks), (R i).IsSubdrawing (Tdr i)) + (hWT : ∀ (i : Fin ks), (walkDrawing G (Q i)).IsSubdrawing (Tdr i)) + (hWp : ∀ (i : Fin ks), (walkDrawing G (Q i)).IsPathBetween (x i) (t i)) + (htW : ∀ (i : Fin ks), t i ∈ (walkDrawing G (Q i)).V) + (i : Fin ks) + (y : S) + (hy : y ∈ (Tdr i).V) : + Nonempty (GraphWalk (Tdr i).toGraph y (t i)) := by + rw [hT2 i] at hy + rcases hy with hy | hy + · obtain ⟨a', b', hp⟩ := h.Rpath i + obtain ⟨W⟩ := exists_walk_of_isPathBetween hp hy (h.tmem i) + obtain ⟨W', -, -⟩ := (hRT i).exists_walk_up W + exact ⟨W'⟩ + · obtain ⟨W⟩ := exists_walk_of_isPathBetween (hWp i) hy (htW i) + obtain ⟨W', -, -⟩ := (hWT i).exists_walk_up W + exact ⟨W'⟩ + +private theorem cuff_tree_points_have_box_coordinates + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + [T2Space S] + {G : Drawing S} + {C : Set S} + {j : S → T} + {D : Set T} + {r : ℕ} + {v : ℕ} + {ks : ℕ} + {m : ℕ} + {Y : Set T} + {E₀ : Set T} + {Δ' : Set T} + {Do : Set T} + {Nk : Drawing S} + {Bo : Drawing S} + {R : Fin ks → Drawing S} + {x : Fin ks → S} + {t : Fin ks → S} + {Q : (i : Fin ks) → GraphWalk G.toGraph (x i) (t i)} + {L : Fin m → Drawing S} + {El : Fin m → Set T} + [T2Space T] + (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) + (hC : C ∈ cuffs S) + (hc : IsCappedCuff C T j D) + (hG : G.IsProper) + (hman : ∀ (x : T), IsManifoldPoint x) + (hji : Injective j) + (F : Set (CellRec T (Fin ks))) + (Φ : CellRec T (Fin ks) → ℝ × ℝ → T) + (Sd : Fin ks → ℝ → T) + (μ : CellRec T (Fin ks) → ℝ → T) + (hfam : IsCellFamily D E₀ (fun k => j '' (walkDrawing G (Q k)).U) (fun k => j (x k)) (fun k => + j (t k)) univ F) + (hb : IsCuffBoxes D E₀ Δ' (fun k => j '' (walkDrawing G (Q k)).U) (fun k => j (x k)) (fun k => + j (t k)) F Φ Sd μ) + (φ : ↥F → ℝ × ℝ → S) + (hφ : ∀ (c : ↥F), ∀ p ∈ cuffBox, j (φ c p) = Φ (↑c) p) + (hbx : ∀ {m w : ℝ}, m ∈ Icc 0 1 → w ∈ Icc 0 2 → (m, w) ∈ cuffBox) + (h0I : (0 : ℝ) ∈ Icc 0 1) + (h1I : (1 : ℝ) ∈ Icc 0 1) + (h12 : (1 : ℝ) ∈ Icc 0 2) + (f : ↥F → ℝ → ℝ) + (hfge : ∀ (c : ↥F) (m : ℝ), 1 ≤ f c m) + (hused : ∀ (i : Fin ks), ∃ (c : ↥F) (e : ℝ), (e = 0 ∨ e = 1) ∧ (∀ w ∈ Icc 0 2, j (φ c (e, w)) + = Sd i w) ∧ + (e = 0 → c.1.i = i) ∧ (e = 1 → c.1.i' = i)) + (hφside : ∀ (i : Fin ks) (c : ↥F) (e : ℝ), (∀ w ∈ Icc 0 2, j (φ c (e, w)) = Sd i w) → φ c (e, + 0) = x i ∧ φ c (e, 1) = t i) + (g : ↥F → ℝ → ℝ) + (hd : ∀ (c : ↥F), IsCollapseData (g c) (f c)) + (hg3 : ∀ (c : ↥F), ∀ m ∈ Icc 0 1, ∀ (i : Fin ks), φ c (m, 1) ∈ (R i).U → φ c (g c m, 0) = x i) + (Tdr : Fin ks → Drawing S) + (hT4 : ∀ (i : Fin ks), (Tdr i).U = (R i).U ∪ (walkDrawing G (Q i)).U) + (i : Fin ks) + (a' : S) + (ha' : a' ∈ (Tdr i).U) : + ∃ c, ∃ p ∈ cuffBox, φ c p = a' ∧ p.2 ≤ f c p.1 ∧ φ c (g c p.1, 0) = x i := by + rw [hT4 i] at ha' + rcases ha' with ha' | ha' + · have hb1 : j a' ∈ discBd E₀ := h.bdE ▸ mem_image_of_mem j ((h.Rsub i).U_subset ha') + obtain ⟨c, hcF, hab'⟩ := hfam.topCover _ hb1 + obtain ⟨m', hm', he⟩ := (hb.param c hcF).exists_of_mem hab' + have hbm := hbx hm' h12 + have he' : φ ⟨c, hcF⟩ (m', 1) = a' := hji (by rw [hφ ⟨c, hcF⟩ _ hbm, hb.top c hcF m' hm', he]) + exact ⟨⟨c, hcF⟩, (m', 1), hbm, he', hfge _ _, hg3 ⟨c, hcF⟩ m' hm' i (he' ▸ ha')⟩ + · obtain ⟨w, hw, he⟩ := (h.crossLine hG hC hman hc i) |> fun hl => hb.sideOf i (j a') + (mem_image_of_mem j ha') + obtain ⟨c, e, he', hs, h3, h4⟩ := hused i + have hw2 : w ∈ Icc (0 : ℝ) 2 := ⟨hw.1, by linarith [hw.2]⟩ + have heI : e ∈ Icc (0 : ℝ) 1 := by + rcases he' with rfl | rfl + · exact h0I + · exact h1I + have hge : g c e = e := by + rcases he' with rfl | rfl + · exact (hd c).g0 + · exact (hd c).g1 + refine ⟨c, (e, w), hbx heI hw2, hji (by rw [hs w hw2, he]), hw.2.trans (hfge _ _), ?_⟩ + change φ c (g c e, 0) = x i + rw [hge] + exact (hφside i c e hs).1 + +private theorem boundary_in_collar_maps_into_cap + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + {G : Drawing S} + {C : Set S} + {j : S → T} + {D : Set T} + {r : ℕ} + {v : ℕ} + {ks : ℕ} + {m : ℕ} + {Y : Set T} + {E₀ : Set T} + {Δ' : Set T} + {Do : Set T} + {Nk : Drawing S} + {Bo : Drawing S} + {R : Fin ks → Drawing S} + {x : Fin ks → S} + {t : Fin ks → S} + {Q : (i : Fin ks) → GraphWalk G.toGraph (x i) (t i)} + {L : Fin m → Drawing S} + {El : Fin m → Set T} + (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) + (hC : C ∈ cuffs S) + (hc : IsCappedCuff C T j D) + (hbT : bd T = j '' (bd S \ C)) + (hji : Injective j) + (hCD : ∀ z ∈ C, j z ∈ D) + (z : S) + (hz : j z ∈ Δ') : + z ∈ bd S ↔ j z ∈ D := by + constructor + · intro hb1 + by_cases hzC : z ∈ C + · exact hCD z hzC + · exfalso + have h1 : j z ∈ bd T := hbT ▸ mem_image_of_mem j ⟨hb1, hzC⟩ + exact disjoint_left.mp h.offO (h.ΔO hz).1 h1 + · intro hzD + have hzr : j z ∈ range j ∩ D := ⟨mem_range_self z, hzD⟩ + rw [hc.inter_eq] at hzr + obtain ⟨z', hz', he⟩ := hzr + exact cuff_subset_bd hC (hji he ▸ hz') + +private theorem box_bottom_lies_on_cuff + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + [T2Space S] + {G : Drawing S} + {C : Set S} + {j : S → T} + {D : Set T} + {ks : ℕ} + {E₀ : Set T} + {Δ' : Set T} + {x : Fin ks → S} + {t : Fin ks → S} + {Q : (i : Fin ks) → GraphWalk G.toGraph (x i) (t i)} + (hc : IsCappedCuff C T j D) + (hji : Injective j) + (F : Set (CellRec T (Fin ks))) + (Φ : CellRec T (Fin ks) → ℝ × ℝ → T) + (Sd : Fin ks → ℝ → T) + (μ : CellRec T (Fin ks) → ℝ → T) + (hb : IsCuffBoxes D E₀ Δ' (fun k => j '' (walkDrawing G (Q k)).U) (fun k => j (x k)) (fun k => + j (t k)) F Φ Sd μ) + (φ : ↥F → ℝ × ℝ → S) + (hφ : ∀ (c : ↥F), ∀ p ∈ cuffBox, j (φ c p) = Φ (↑c) p) + (c : ↥F) + (p : ℝ × ℝ) + (hp : p ∈ cuffBox) + (h0 : p.2 = 0) : + φ c p ∈ C := by + have h1 : j (φ c p) ∈ range j ∩ D := ⟨mem_range_self _, by + rw [hφ c p hp] + exact (hb.inD c.1 c.2 p hp).mpr h0⟩ + rw [hc.inter_eq] at h1 + obtain ⟨z', hz', he⟩ := h1 + exact hji he ▸ hz' + +private theorem cuff_collar_inner_arc_obstruction + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + [T2Space S] + {G : Drawing S} + {C : Set S} + {j : S → T} + {D : Set T} + {r : ℕ} + {v : ℕ} + {ks : ℕ} + {m : ℕ} + {Y : Set T} + {E₀ : Set T} + {Δ' : Set T} + {Do : Set T} + {Nk : Drawing S} + {Bo : Drawing S} + {R : Fin ks → Drawing S} + {x : Fin ks → S} + {t : Fin ks → S} + {Q : (i : Fin ks) → GraphWalk G.toGraph (x i) (t i)} + {L : Fin m → Drawing S} + {El : Fin m → Set T} + (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) + (hc : IsCappedCuff C T j D) + (hji : Injective j) + (F : Set (CellRec T (Fin ks))) + (Φ : CellRec T (Fin ks) → ℝ × ℝ → T) + (Sd : Fin ks → ℝ → T) + (μ : CellRec T (Fin ks) → ℝ → T) + (hb : IsCuffBoxes D E₀ Δ' (fun k => j '' (walkDrawing G (Q k)).U) (fun k => j (x k)) (fun k => + j (t k)) F Φ Sd μ) + (φ : ↥F → ℝ × ℝ → S) + (hφ : ∀ (c : ↥F), ∀ p ∈ cuffBox, j (φ c p) = Φ (↑c) p) + (f : ↥F → ℝ → ℝ) + (hfge : ∀ (c : ↥F) (m : ℝ), 1 ≤ f c m) + (B : Set S) + (hO : IsOArc B) + (hn : G.IsNormal B) + (hcard : (G.V ∩ B).ncard ≤ v) + (hs : SurroundsCuff B C) + (hbelow : ∀ z ∈ B, ¬IsBelowGraph φ f z) : + False := by + refine h.inner B hO hn hcard hs (disjoint_left.mpr fun z hz hzB => ?_) + have hzE := hz + have h1 : j z ∈ Δ' := (h.EΔ hz.1).1 + obtain ⟨c, hcF, p, hp, he⟩ := hb.cover (j z) ⟨h1, not_mem_discInt_cap hc z⟩ + have hz' : φ ⟨c, hcF⟩ p = z := hji (by rw [hφ ⟨c, hcF⟩ p hp, he]) + refine hbelow z hzB ⟨⟨c, hcF⟩, p, hp, hz', ?_⟩ + have h2 : p.2 ≤ 1 := (hb.inE c hcF p hp).mp (he ▸ hzE.1) + have h3 : p.2 ≠ 1 := fun h4 => hzE.2 (he ▸ (hb.onBd c hcF p hp).mpr h4) + exact lt_of_lt_of_le (lt_of_le_of_ne h2 h3) (hfge _ _) + +private theorem assemble_cuff_collar + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + [T2Space S] + {G : Drawing S} + {C : Set S} + {j : S → T} + {D : Set T} + {r : ℕ} + {v : ℕ} + {ks : ℕ} + {m : ℕ} + {Y : Set T} + {E₀ : Set T} + {Δ' : Set T} + {Do : Set T} + {Nk : Drawing S} + {Bo : Drawing S} + {R : Fin ks → Drawing S} + {x : Fin ks → S} + {t : Fin ks → S} + {Q : (i : Fin ks) → GraphWalk G.toGraph (x i) (t i)} + {L : Fin m → Drawing S} + {El : Fin m → Set T} + [T2Space T] + (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) + (hS : IsSurface S) + [ConnectedSpace S] + (hC : C ∈ cuffs S) + (hc : IsCappedCuff C T j D) + (hns : ¬IsSphere T) + (hT : IsSurface T) + (hj : Continuous j) + (hji : Injective j) + (hCD : ∀ z ∈ C, j z ∈ D) + (F : Set (CellRec T (Fin ks))) + (Φ : CellRec T (Fin ks) → ℝ × ℝ → T) + (Sd : Fin ks → ℝ → T) + (μ : CellRec T (Fin ks) → ℝ → T) + (hb : IsCuffBoxes D E₀ Δ' (fun k => j '' (walkDrawing G (Q k)).U) (fun k => j (x k)) (fun k => + j (t k)) F Φ Sd μ) + (φ : ↥F → ℝ × ℝ → S) + (hφ : ∀ (c : ↥F), ∀ p ∈ cuffBox, j (φ c p) = Φ (↑c) p) + (hbs : IsBoxSystem φ) + (hφ00 : ∀ (c : ↥F), φ c (0, 0) = x c.1.i) + (hφ10 : ∀ (c : ↥F), φ c (1, 0) = x c.1.i') + (f : ↥F → ℝ → ℝ) + (hF1 : ∀ (c : ↥F), ∀ p ∈ cuffBox, φ c p ∈ G.U → 1 < p.2 → f c p.1 < p.2) + (hF2 : ∀ (c : ↥F), ∀ p ∈ cuffBox, p.2 = f c p.1 → φ c p ∈ G.U → p.2 = 1 ∧ φ c p ∈ G.V) + (hused : ∀ (i : Fin ks), ∃ (c : ↥F) (e : ℝ), (e = 0 ∨ e = 1) ∧ (∀ w ∈ Icc 0 2, j (φ c (e, w)) + = Sd i w) ∧ + (e = 0 → c.1.i = i) ∧ (e = 1 → c.1.i' = i)) + (hφside : ∀ (i : Fin ks) (c : ↥F) (e : ℝ), (∀ w ∈ Icc 0 2, j (φ c (e, w)) = Sd i w) → φ c (e, + 0) = x i ∧ φ c (e, 1) = t i) + (a : ↥F → ℝ) + (b : ↥F → ℝ) + (hab : ∀ (c : ↥F), a c < b c) : + let g : ↥F → ℝ → ℝ := fun c => clampRamp (a c) (b c) + (∀ (c : ↥F), IsCollapseData (g c) (f c)) → + ∀ (Tdr : Fin ks → Drawing S), + (∀ (i : Fin ks), (Tdr i).IsSubdrawing G) → + (∀ (i : Fin ks), (Tdr i).V = (R i).V ∪ (walkDrawing G (Q i)).V) → + (∀ (i : Fin ks), (Tdr i).U = (R i).U ∪ (walkDrawing G (Q i)).U) → + (∀ (i : Fin ks), x i ∈ (walkDrawing G (Q i)).V) → + (∀ (i : Fin ks), IsGraphForest (Tdr i).toGraph) → + (∀ (i : Fin ks), ∀ y ∈ (Tdr i).V, Nonempty (GraphWalk (Tdr i).toGraph y (t i))) → + ∀ (Tr : S → Drawing S), + (∀ (i : Fin ks), Tr (x i) = Tdr i) → + (∀ (i : Fin ks), ∀ a' ∈ (Tdr i).U, ∃ c, ∃ p ∈ cuffBox, φ c p = a' ∧ p.2 ≤ f c p.1 ∧ φ + c (g c p.1, 0) = x i) → + (D ⊆ Δ') → + (D ⊆ Do) → + (∀ z ∈ C, z ∈ j ⁻¹' Do) → + (j ⁻¹' discBd Do = Bo.U) → + (∀ (c : ↥F), ∀ p ∈ cuffBox, φ c p ∈ bd S ↔ p.2 = 0) → + (∀ (c : ↥F), ∀ p ∈ cuffBox, p.2 = 0 → φ c p ∈ C) → + (∀ (c : ↥F), ∀ p ∈ cuffBox, p.2 = f c p.1 → φ c p ∈ G.V → φ c (g c p.1, 0) ∈ G.V ∩ C ∧ + φ c p ∈ (Tr (φ c (g c p.1, 0))).V) → + (∀ (B : Set S), IsOArc B → G.IsNormal B → (G.V ∩ B).ncard ≤ v → SurroundsCuff B C → + (∀ z ∈ B, ¬IsBelowGraph φ f z) → False) → + IsCuffCollar G C r v (j ⁻¹' Do) Bo.U (j ⁻¹' (Do \ E₀)) (j ⁻¹' (Do \ Δ')) φ g f Tr := by + intro g hd Tdr hT1 hT2 hT4 hxW hforest hreach Tr hTr hrep hDΔ hDO hCMo hpreO hbottom hbottomC + hgV hinner + exact + { box := hbs + data := hd + bottom := hbottom + bottomC := hbottomC + allBottom := fun z hz => by + obtain ⟨c, hcF, p, hp, he⟩ := hb.cover (j z) ⟨hDΔ (hCD z hz), not_mem_discInt_cap hc z⟩ + have h2 : p.2 = 0 := (hb.inD c hcF p hp).mp (he ▸ hCD z hz) + have hpeq : (p.1, (0 : ℝ)) = p := Prod.ext rfl h2.symm + refine mem_iUnion.mpr ⟨⟨c, hcF⟩, p.1, hp.1, hji ?_⟩ + change j (φ ⟨c, hcF⟩ (p.1, 0)) = j z + rw [hpeq, hφ ⟨c, hcF⟩ p hp, he] + graphU := fun c p hp he hU => (hF2 c p hp he hU).2 + graphV := hgV + corner := fun y hy => by + obtain ⟨i, rfl⟩ := h.x_surj y hy + obtain ⟨c, e, he', hs, -, -⟩ := hused i + exact ⟨c, e, he', (hφside i c e hs).1, by rw [(hφside i c e hs).2]; exact h.tV i⟩ + cornerV := fun c e he => by + rcases he with rfl | rfl + · rw [hφ00] + exact h.xmem _ + · rw [hφ10] + exact h.xmem _ + gstrict := fun c m _ m' _ he h0 h1 => clampRamp_strict (hab c) he h0 h1 + tree := fun y hy => by + obtain ⟨i, rfl⟩ := h.x_surj y hy + rw [hTr] + refine ⟨hT1 i, hforest i, hT2 i ▸ .inr (hxW i), hrep i, fun a' ha' b' hb'' => ?_⟩ + obtain ⟨W₁⟩ := hreach i a' ha' + obtain ⟨W₂⟩ := hreach i b' hb'' + exact ⟨W₁.append W₂.reverse⟩ + closedMo := h.discO.isClosed.preimage hj + openMo := by + have heq : j ⁻¹' Do \ Bo.U = j ⁻¹' discInt Do := by + rw [← hpreO] + rfl + rw [heq] + exact (h.discO.isOpen_discInt hT.2.2).preimage hj + cMo := hCMo + inMo := fun c p hp => by + have h1 := h.ΔO (hb.mapsΔ c.1 c.2 hp) + rw [← hpreO] + refine ⟨?_, ?_⟩ + · change j (φ c p) ∈ Do + rw [hφ c p hp] + exact h1.1 + · change j (φ c p) ∉ discBd Do + rw [hφ c p hp] + exact h1.2 + circ := ⟨Bo, h.boSub, h.boCirc, rfl⟩ + surrounds := hpreO ▸ surrounds_of_disc hS hC hc hns h.discO hDO + planarMo := isPlanarInCappedCuff_of_cap hS hc ⟨Do, h.discO, image_preimage_subset _ _⟩ + reach := fun y hy hV => h.reach y (mem_V_of_subdrawing h.boSub hy hV) + inner := hinner + mo₂ := preimage_mono sdiff_subset + mo₃ := preimage_mono sdiff_subset + above₂ := fun z hz hU c p hp he => by + have h1 : ¬ p.2 ≤ 1 := fun h2 => hz.2 (by + rw [← he, hφ c p hp] + exact (hb.inE c.1 c.2 p hp).mpr h2) + exact hF1 c p hp (he ▸ hU) (not_le.mp h1) + off₃ := fun z hz c => by + rintro ⟨p, hp, rfl⟩ + refine hz.2 ?_ + rw [hφ c p hp] + exact hb.mapsΔ c.1 c.2 hp + touch := fun ρ A B hρ _ htr hnorm hcount hab' hid hO hne => h.touch hS hc hns hρ + (fun i a' ha' => htr (x i) (h.xmem i) a' (by + rw [hTr, hT4 i] + exact .inl ha')) hnorm hcount (fun z h1 h2 h3 => hab' z ⟨h1, + h2⟩ h3) (fun z h1 h2 h3 => hid z ⟨h1, h2⟩ h3) h.x_surj hO hne } + +/-- **The collar of a cuff.** -/ +theorem IsCuffCore.exists_collar [T2Space T] (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L + El) (hS : IsSurface S) [ConnectedSpace S] (hC : C ∈ cuffs S) (hc : IsCappedCuff C T j D) + (hbT : bd T = j '' (bd S \ C)) (hG : G.IsProper) (hns : ¬ IsSphere T) : + ∃ (ι : Type u) (_ : Finite ι) (Mo AC Mo₂ Mo₃ : Set S) (φ : ι → ℝ × ℝ → S) (g f : ι → ℝ → ℝ) + (Tr : S → Drawing S), IsCuffCollar G C r v Mo AC Mo₂ Mo₃ φ g f Tr := by + classical + have hT := hc.isSurface + have : CompactSpace S := hS.1 + have : ConnectedSpace T := hc.connectedSpace hS + have : Nonempty S := ConnectedSpace.toNonempty + have hman := hT.2.2 + have hj := hc.isEmbedding.continuous + have hji := hc.isEmbedding.injective + have hCD : ∀ z ∈ C, j z ∈ D := fun z hz => Surface.discBd_subset D (hc.discBd_eq ▸ + mem_image_of_mem j hz) + have hDE : D ⊆ E₀ \ discBd E₀ := h.DinE + have hk := h.ks2 + obtain ⟨F, Φ, Sd, μ, hfam, hb⟩ := + exists_cuff_boxes hman hc.isClosedDisc h.discE h.discΔ hDE h.EΔ (h.crossLine hG hC hman hc) + (fun _ _ hne => h.lines_disjoint hji hne) + (i₀ := ⟨0, by omega⟩) (i₁ := ⟨1, by omega⟩) (by simp) + have hFf : Finite F := hfam.finite.to_subtype + have hrange : ∀ c ∈ F, ∀ p ∈ cuffBox, Φ c p ∈ range j := fun c hcF p hp => by + exact cuff_box_lies_in_uncapped_surface (S := S) (T := T) (G := G) (C := C) (j := j) (D := D) + (ks := ks) (E₀ := E₀) (Δ' := Δ') (x := x) (t := t) (Q := Q) hc F Φ Sd μ hfam hb c hcF p hp + let φ : F → ℝ × ℝ → S := fun c p => invFun j (Φ c.1 p) + have hφ : ∀ c p, p ∈ cuffBox → j (φ c p) = Φ c.1 p := fun c p hp => invFun_eq + (hrange c.1 c.2 p hp) + have hbs : IsBoxSystem φ := isBoxSystem_of_lift hc hb hman h.discΔ hφ + have hbx : ∀ {m w : ℝ}, m ∈ Icc (0 : ℝ) 1 → w ∈ Icc (0 : ℝ) 2 → (m, w) ∈ cuffBox := fun hm hw + => ⟨hm, hw⟩ + have h0I : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := ⟨le_rfl, zero_le_one⟩ + have h1I : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := ⟨zero_le_one, le_rfl⟩ + have h02 : (0 : ℝ) ∈ Icc (0 : ℝ) 2 := ⟨le_rfl, by norm_num⟩ + have h12 : (1 : ℝ) ∈ Icc (0 : ℝ) 2 := ⟨zero_le_one, by norm_num⟩ + have hL : ∀ (c : F), ∀ w ∈ Icc (0 : ℝ) 2, j (φ c (0, w)) = Sd c.1.i w := fun c w hw => by + rw [hφ c _ (hbx h0I hw)] + exact hb.left c.1 c.2 w hw + have hRt : ∀ (c : F), ∀ w ∈ Icc (0 : ℝ) 2, j (φ c (1, w)) = Sd c.1.i' w := fun c w hw => by + rw [hφ c _ (hbx h1I hw)] + exact hb.right c.1 c.2 w hw + have hφ00 : ∀ c : F, φ c (0, 0) = x c.1.i := fun c => hji (by rw [hL c 0 h02, hb.sideZero]) + have hφ01 : ∀ c : F, φ c (0, 1) = t c.1.i := fun c => hji (by rw [hL c 1 h12, hb.sideOne]) + have hφ10 : ∀ c : F, φ c (1, 0) = x c.1.i' := fun c => hji (by rw [hRt c 0 h02, hb.sideZero]) + have hφ11 : ∀ c : F, φ c (1, 1) = t c.1.i' := fun c => hji (by rw [hRt c 1 h12, hb.sideOne]) + -- the heights + set Go := withoutEdges G Nk with hGo + let Z : F → Set (ℝ × ℝ) := fun c => {p | p ∈ cuffBox ∧ 1 ≤ p.2 ∧ φ c p ∈ Go.U} + have hZcl : ∀ c, IsClosed (Z c) := fun c => by + exact cuff_box_height_set_closed (S := S) (T := T) (ks := ks) F φ hbs Go c + have hZ0 : ∀ c, ((0 : ℝ), (1 : ℝ)) ∈ Z c := fun c => ⟨hbx h0I h12, le_rfl, by + rw [hφ01 c] + exact Go.V_subset_U (by rw [hGo, withoutEdges_V]; exact h.tV _)⟩ + have hZ1 : ∀ c, ((1 : ℝ), (1 : ℝ)) ∈ Z c := fun c => ⟨hbx h1I h12, le_rfl, by + rw [hφ11 c] + exact Go.V_subset_U (by rw [hGo, withoutEdges_V]; exact h.tV _)⟩ + let f : F → ℝ → ℝ := fun c => topHeight (Z c) + have hNk : ∀ c p, p ∈ cuffBox → (φ c p ∈ Nk.U ↔ p.2 = 1) := fun c p hp => by + rw [← hb.onBd c.1 c.2 p hp, ← hφ c p hp, h.bdE] + exact hji.mem_set_image.symm + have hF1 : ∀ c p, p ∈ cuffBox → φ c p ∈ G.U → 1 < p.2 → f c p.1 < p.2 := fun c p hp hU hlt => by + rcases mem_withoutEdges_or (N := Nk) hU with h1 | h1 + · have h2 := topHeight_le (Z := Z c) (m := p.1) (w := p.2) ⟨hp, hlt.le, h1⟩ hlt.le + change topHeight (Z c) p.1 < p.2 + linarith + · exact absurd ((hNk c p hp).mp h1) hlt.ne' + have hfge : ∀ c m, 1 ≤ f c m := fun c m => (topHeight_bounds _ m).1 + have hF2 : ∀ c p, p ∈ cuffBox → p.2 = f c p.1 → φ c p ∈ G.U → p.2 = 1 ∧ φ c p ∈ G.V + := fun c p hp he hU => by + exact cuff_box_top_graph_points_are_vertices (S := S) (T := T) (G := G) (C := C) (j := j) (D + := D) (r := r) (v := v) (ks := ks) (m := m) (Y := Y) (E₀ := E₀) (Δ' := Δ') (Do := Do) (Nk := + Nk) (Bo := Bo) (R := R) (x := x) (t := t) (Q := Q) (L := L) (El := El) h F φ hZcl hZ0 + hNk hF1 hfge c p hp he hU + -- the ramps + have hRp : ∀ i, IsPreconnected (R i).U := fun i => by + obtain ⟨a, b, hp⟩ := h.Rpath i + exact isPreconnected_of_isPathBetween hp + have hRd : ∀ i i', i ≠ i' → Disjoint (R i).U (R i').U := fun i i' hne => disjoint_U_of_disjoint_V + (h.Rsub i) (h.Rsub i') (h.Rdis i i' hne) + have htinj : Injective t := fun i i' he => by + by_contra hne + exact disjoint_left.mp (h.Rdis i i' hne) (h.tmem i) (he ▸ h.tmem i') + have hused : ∀ i, ∃ (c : F) (e : ℝ), (e = 0 ∨ e = 1) ∧ (∀ w ∈ Icc (0 : ℝ) 2, j (φ c (e, w)) + = Sd i w) ∧ (e = 0 → c.1.i = i) ∧ (e = 1 → c.1.i' = i) := fun i => by + exact every_radial_line_is_a_box_side (S := S) (T := T) (G := G) (j := j) (D := D) (ks := ks) + (E₀ := E₀) (x := x) (t := t) (Q := Q) F Sd hfam φ hL hRt i + have hφside : ∀ (i) (c : F) (e : ℝ), (∀ w ∈ Icc (0 : ℝ) 2, j (φ c (e, w)) = Sd i w) → φ c (e, 0) + = x i ∧ φ c (e, 1) = t i := fun i c e hs => ⟨hji (by rw [hs 0 h02, hb.sideZero]), hji + (by rw [hs 1 h12, hb.sideOne])⟩ + have hsplit : ∀ c : F, ∃ a b : ℝ, 0 ≤ a ∧ a < b ∧ b ≤ 1 ∧ ∀ m ∈ Icc (0 : ℝ) 1, ∀ i, φ c (m, 1) ∈ + (R i).U → (i = c.1.i ∧ m ≤ a) ∨ (i = c.1.i' ∧ b ≤ m) := fun c => by + exact box_top_orders_radial_trees (S := S) (T := T) (G := G) (C := C) (j := j) (D := D) (r := + r) (v := v) (ks := ks) (m := m) (Y := Y) (E₀ := E₀) (Δ' := Δ') (Do := Do) (Nk := Nk) (Bo := + Bo) (R := R) (x := x) (t := t) (Q := Q) (L := L) (El := El) h F Sd φ hbs hbx h0I h1I h12 + hφ01 hφ11 hNk hRp hRd htinj hused hφside c + choose a b ha hab hb' hsp using hsplit + let g : F → ℝ → ℝ := fun c => clampRamp (a c) (b c) + have hd : ∀ c, IsCollapseData (g c) (f c) := fun c => isCollapseData_ramp (ha c) (hab c) (hb' c) + (hZ0 c) (hZ1 c) + have hg3 : ∀ c, ∀ m ∈ Icc (0 : ℝ) 1, ∀ i, φ c (m, 1) ∈ (R i).U → φ c (g c m, 0) = x i + := fun c m hm i hi => by + rcases hsp c m hm i hi with ⟨rfl, h1⟩ | ⟨rfl, h1⟩ + · rw [show g c m = 0 from clampRamp_low (hab c) h1] + exact hφ00 c + · rw [show g c m = 1 from clampRamp_high (hab c) h1] + exact hφ10 c + -- the trees + have hRG : ∀ i, (R i).IsSubdrawing G := fun i => (h.Rsub i).trans h.nkSub + have hWs := fun i => walkDrawing_isSubdrawing G (Q i) + have hunion := fun i => exists_union_drawing (hRG i) (hWs i) + choose Tdr hT1 hT2 hT3 hT4 using hunion + have hRT : ∀ i, (R i).IsSubdrawing (Tdr i) := fun i => ⟨hT2 i ▸ subset_union_left, hT3 i ▸ + subset_union_left⟩ + have hWT : ∀ i, (walkDrawing G (Q i)).IsSubdrawing (Tdr i) := fun i + => ⟨hT2 i ▸ subset_union_right, hT3 i ▸ subset_union_right⟩ + have hWp := fun i => walkDrawing_isPathBetween G (h.Qsimple i) + have htW : ∀ i, t i ∈ (walkDrawing G (Q i)).V := fun i => by + rw [walkDrawing_V] + exact (Q i).end_mem_support + have hxW : ∀ i, x i ∈ (walkDrawing G (Q i)).V := fun i => by + rw [walkDrawing_V] + exact (Q i).start_mem_support + have hforest : ∀ i, IsGraphForest (Tdr i).toGraph := fun i => by + exact cuff_tree_union_is_forest (S := S) (T := T) (G := G) (C := C) (j := j) (D := D) (r := r) + (v := v) (ks := ks) (m := m) (Y := Y) (E₀ := E₀) (Δ' := Δ') (Do := Do) (Nk := Nk) (Bo := Bo) + (R := R) (x := x) (t := t) (Q := Q) (L := L) (El := El) h hman hj hji hCD Tdr hT4 hRT hWp + htW i + have hreach : ∀ i, ∀ y ∈ (Tdr i).V, Nonempty (GraphWalk (Tdr i).toGraph y (t i)) := fun i y hy + => by + exact cuff_tree_vertices_reach_collar_vertex (S := S) (T := T) (G := G) (C := C) (j := j) (D + := D) (r := r) (v := v) (ks := ks) (m := m) (Y := Y) (E₀ := E₀) (Δ' := Δ') (Do := Do) (Nk := + Nk) (Bo := Bo) (R := R) (x := x) (t := t) (Q := Q) (L := L) (El := El) h Tdr hT2 hRT hWT hWp + htW i y hy + let Tr : S → Drawing S := fun y => if hy : ∃ i, x i = y then Tdr hy.choose else G + have hTr : ∀ i, Tr (x i) = Tdr i := fun i => by + have hy : ∃ i', x i' = x i := ⟨i, rfl⟩ + have h1 : hy.choose = i := h.x_injective hy.choose_spec + change (if hy : ∃ i', x i' = x i then Tdr hy.choose else G) = Tdr i + rw [dite_eq_left hy, h1] + have hrep : ∀ i, ∀ a' ∈ (Tdr i).U, ∃ c p, p ∈ cuffBox ∧ φ c p = a' ∧ p.2 ≤ f c p.1 ∧ φ c + (g c p.1, 0) = x i := fun i a' ha' => by + exact cuff_tree_points_have_box_coordinates (S := S) (T := T) (G := G) (C := C) (j := j) (D := + D) (r := r) (v := v) (ks := ks) (m := m) (Y := Y) (E₀ := E₀) (Δ' := Δ') (Do := Do) (Nk := + Nk) (Bo := Bo) (R := R) (x := x) (t := t) (Q := Q) (L := L) (El := El) h hC hc hG hman hji F + Φ Sd μ hfam hb φ hφ hbx h0I h1I h12 f hfge hused hφside g hd hg3 Tdr hT4 i a' ha' + have hbdΔ : ∀ z, j z ∈ Δ' → (z ∈ bd S ↔ j z ∈ D) := fun z hz => by + exact boundary_in_collar_maps_into_cap (S := S) (T := T) (G := G) (C := C) (j := j) (D := D) + (r := r) (v := v) (ks := ks) (m := m) (Y := Y) (E₀ := E₀) (Δ' := Δ') (Do := Do) (Nk := Nk) + (Bo := Bo) (R := R) (x := x) (t := t) (Q := Q) (L := L) (El := El) h hC hc hbT hji hCD z hz + have hDΔ : D ⊆ Δ' := hDE.trans (sdiff_subset.trans (h.EΔ.trans sdiff_subset)) + have hDO : D ⊆ Do := hDΔ.trans (h.ΔO.trans sdiff_subset) + have hCMo : ∀ z ∈ C, z ∈ j ⁻¹' Do := fun z hz => hDO (hCD z hz) + have hpreO : j ⁻¹' discBd Do = Bo.U := by + rw [h.bdO] + exact preimage_image_eq _ hji + have hbottom : ∀ c p, p ∈ cuffBox → (φ c p ∈ bd S ↔ p.2 = 0) := fun c p hp => by + have h1 : j (φ c p) ∈ Δ' := by + rw [hφ c p hp] + exact hb.mapsΔ c.1 c.2 hp + rw [hbdΔ _ h1, hφ c p hp] + exact hb.inD c.1 c.2 p hp + have hbottomC : ∀ c p, p ∈ cuffBox → p.2 = 0 → φ c p ∈ C := fun c p hp h0 => by + exact box_bottom_lies_on_cuff (S := S) (T := T) (G := G) (C := C) (j := j) (D := D) (ks := ks) + (E₀ := E₀) (Δ' := Δ') (x := x) (t := t) (Q := Q) hc hji F Φ Sd μ hb φ hφ c p hp h0 + have hgV : ∀ c p, p ∈ cuffBox → p.2 = f c p.1 → φ c p ∈ G.V → φ c (g c p.1, 0) ∈ G.V ∩ C + ∧ φ c p ∈ (Tr (φ c (g c p.1, 0))).V := fun c p hp he hV => by + obtain ⟨h1, -⟩ := hF2 c p hp he (G.V_subset_U hV) + have hp1 : (p.1, (1 : ℝ)) = p := Prod.ext rfl h1.symm + have hN := mem_V_of_subdrawing h.nkSub ((hNk c p hp).mpr h1) hV + obtain ⟨i, hi⟩ := h.Rcov _ hN + have h3 := hg3 c p.1 hp.1 i (by rw [hp1]; exact (R i).V_subset_U hi) + rw [h3, hTr, hT2 i] + exact ⟨h.xmem i, .inl hi⟩ + have hinner : ∀ B : Set S, IsOArc B → G.IsNormal B → (G.V ∩ B).ncard ≤ v → SurroundsCuff B C → + (∀ z ∈ B, ¬ IsBelowGraph φ f z) → False := fun B hO hn hcard hs hbelow => by + exact cuff_collar_inner_arc_obstruction (S := S) (T := T) (G := G) (C := C) (j := j) (D := D) + (r := r) (v := v) (ks := ks) (m := m) (Y := Y) (E₀ := E₀) (Δ' := Δ') (Do := Do) (Nk := Nk) + (Bo := Bo) (R := R) (x := x) (t := t) (Q := Q) (L := L) (El := El) h hc hji F Φ Sd μ hb φ hφ + f hfge B hO hn hcard hs hbelow + have collar : IsCuffCollar G C r v (j ⁻¹' Do) Bo.U (j ⁻¹' (Do \ E₀)) (j ⁻¹' (Do \ Δ')) + φ g f Tr := by + exact assemble_cuff_collar (S := S) (T := T) (G := G) (C := C) (j := j) (D := D) (r := r) (v + := v) (ks := ks) (m := m) (Y := Y) (E₀ := E₀) (Δ' := Δ') (Do := Do) (Nk := Nk) (Bo := Bo) (R + := R) (x := x) (t := t) (Q := Q) (L := L) (El := El) h hS hC hc hns hT hj hji hCD F Φ Sd μ + hb φ hφ hbs hφ00 hφ10 f hF1 hF2 hused hφside a b hab hd Tdr hT1 hT2 hT4 hxW hforest hreach + Tr hTr hrep hDΔ hDO hCMo hpreO hbottom hbottomC hgV hinner + exact ⟨F, inferInstance, j ⁻¹' Do, Bo.U, j ⁻¹' (Do \ E₀), j ⁻¹' (Do \ Δ'), φ, g, f, Tr, collar⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffCore.lean b/LeanPool/GraphMinor/GM07/CuffCore.lean new file mode 100644 index 0000000000..5693a21327 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffCore.lean @@ -0,0 +1,504 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffCollar + +/-! +# The core of a collar + +Graph Minors VII, (5.9), pages 234-235. For one cuff `C` we collect what the first half of the +paper's proof gives: the disc of `A(C)`, the circuits `B_i(C)`, the circuit `N(C)` cut in pieces +`N_i(C)`, the paths `Q_i`, and the ends of the paths `P_i` past `N(C)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] + +/-- A simple walk that meets the circuit `N` only at its last vertex stays on one side of the +circuit. Here `Ω` and `Ω'` are the two sides, as open sets of `T`. -/ +theorem walk_stays_side {G N : Drawing S} (hN : N.IsSubdrawing G) {j : S → T} + (hj : Continuous j) {Ω Ω' : Set T} (hΩ : IsOpen Ω) (hΩ' : IsOpen Ω') + (hd : Disjoint Ω Ω') (hcov : ∀ z, z ∉ N.U → j z ∈ Ω ∪ Ω') (hoffΩ : ∀ z, j z ∈ Ω + → z ∉ N.U) {y t : S} (W : GraphWalk G.toGraph y t) (hs : W.IsSimple) + (hoff : ∀ z ∈ W.support, z ≠ t → z ∉ N.V) (hy : j y ∈ Ω) : + (∀ z ∈ W.support, z = t ∨ j z ∈ Ω) ∧ ∀ e ∈ W.edges, ∀ z ∈ e, j z ∈ Ω := by + induction W with + | nil _ => + refine ⟨fun z hz => .inl (List.mem_singleton.mp hz), fun e he => ?_⟩ + simp [GraphWalk.edges] at he + | @cons u' v' w' e h r ih => + have hoffU : u' ∉ N.U := hoffΩ u' hy + have hcl : u' ∈ closure e := (h.2.2.2 ▸ mem_insert _ _ : u' ∈ closure e ∩ G.V).1 + have hcl' : v' ∈ closure e := (h.2.2.2 ▸ mem_insert_of_mem _ rfl : v' ∈ closure e ∩ G.V).1 + have heN : e ∉ N.E := fun h1 => hoffU (N.closure_subset_U h1 hcl) + have heoff : ∀ x ∈ e, x ∉ N.U := fun x hx hxU => by + have hxV : x ∉ N.V := fun h2 => (h.1.2.1 hx).2 (hN.1 h2) + obtain ⟨e', he'', hxe'⟩ := N.exists_edge_of_mem hxU hxV + exact heN (arcComponent_eq h.1 (hN.2 he'') hx hxe' ▸ he'') + have hpre : IsPreconnected (j '' e) := h.1.2.2.1.isConnected.isPreconnected.image _ + hj.continuousOn + have hmeet : (j '' e ∩ Ω).Nonempty := by + have h2 : j u' ∈ closure (j '' e) := map_mem_closure hj hcl fun x hx => mem_image_of_mem j hx + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp h2 _ hΩ hy + exact ⟨w, hw2, hw1⟩ + have hsub : j '' e ⊆ Ω ∪ Ω' := by + rintro _ ⟨x, hx, rfl⟩ + exact hcov x (heoff x hx) + have heΩ : j '' e ⊆ Ω := hpre.subset_left_of_subset_union hΩ hΩ' hd hsub hmeet + have hnd : r.support.Nodup := (List.nodup_cons.mp hs).2 + by_cases hvt : v' = w' + · subst hvt + have hr : r.support = [v'] ∧ r.edges = [] := by + cases r with + | nil _ => exact ⟨rfl, rfl⟩ + | cons h' r' => + have h1 : (_ :: r'.support).Nodup := hnd + exact absurd r'.end_mem_support (List.nodup_cons.mp h1).1 + refine ⟨fun z hz => ?_, fun e' he' z hz => ?_⟩ + · rw [GraphWalk.support, List.mem_cons, hr.1, List.mem_singleton] at hz + rcases hz with rfl | rfl + · exact .inr hy + · exact .inl rfl + · rw [GraphWalk.edges, List.mem_cons, hr.2] at he' + rcases he' with rfl | he' + · exact heΩ (mem_image_of_mem j hz) + · simp at he' + · have hvN : v' ∉ N.U := fun hU => hoff v' (List.mem_cons_of_mem _ r.start_mem_support) hvt + (mem_V_of_subdrawing hN hU h.2.2.1) + have hvΩ : j v' ∈ Ω := by + rcases hcov v' hvN with h1 | h1 + · exact h1 + · have h2 : j v' ∈ closure (j '' e) := map_mem_closure hj hcl' fun x hx + => mem_image_of_mem j hx + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp h2 _ hΩ' h1 + exact absurd hw1 (disjoint_left.mp hd (heΩ hw2)) + obtain ⟨i1, i2⟩ := ih hnd (fun z' hz' hne => hoff z' (List.mem_cons_of_mem _ hz') hne) hvΩ + refine ⟨fun z hz => ?_, fun e' he' z hz => ?_⟩ + · rw [GraphWalk.support, List.mem_cons] at hz + rcases hz with rfl | hz + · exact .inr hy + · exact i1 z hz + · rw [GraphWalk.edges, List.mem_cons] at he' + rcases he' with rfl | he' + · exact heΩ (mem_image_of_mem j hz) + · exact i2 e' he' z hz + +/-- The form of `walk_stays_side` for all the points of a walk. -/ +theorem walk_U_stays_side [T2Space S] {G N : Drawing S} (hN : N.IsSubdrawing G) {j : S → T} + (hj : Continuous j) {Ω Ω' : Set T} (hΩ : IsOpen Ω) (hΩ' : IsOpen Ω') + (hd : Disjoint Ω Ω') (hcov : ∀ z, z ∉ N.U → j z ∈ Ω ∪ Ω') (hoffΩ : ∀ z, j z ∈ Ω + → z ∉ N.U) {y t : S} (W : GraphWalk G.toGraph y t) (hs : W.IsSimple) + (hoff : ∀ z ∈ W.support, z ≠ t → z ∉ N.V) (hy : j y ∈ Ω) : + ∀ z ∈ (walkDrawing G W).U, z = t ∨ j z ∈ Ω := fun z hz => by + obtain ⟨h1, h2⟩ := walk_stays_side hN hj hΩ hΩ' hd hcov hoffΩ W hs hoff hy + rcases walk_U_cases hz with h3 | ⟨e, he, hze⟩ + · exact h1 z h3 + · exact .inr (h2 e he z hze) + +/-- The part of a path past a circuit `N`. Let `P` be a path of `G` that ends off the disc `E` of +`N`, and that meets `N`. Then `P` has a connected part from a vertex of `N` to the end, whose other +points are off `E`. The vertex is in any `Rv` that has all the vertices shared by `P` and `N`. -/ +theorem exists_gate [T2Space S] [T2Space T] (hman : ∀ x : T, IsManifoldPoint x) {G N P : Drawing S} + (hN : N.IsSubdrawing G) (hP : P.IsSubdrawing G) {j : S → T} (hj : Continuous j) + (hji : Injective j) {E : Set T} (hE : IsClosedDisc E) (hb : discBd E = j '' N.U) {u v : S} + (hpath : P.IsPathBetween u v) (hv : j v ∉ E) (hmeet : (P.V ∩ N.V).Nonempty) : + ∃ Γ w, IsPreconnected Γ ∧ Γ ⊆ P.U ∧ w ∈ Γ ∧ v ∈ Γ ∧ w ∈ P.V ∩ N.V ∧ ∀ z ∈ Γ, z ≠ w → j z ∉ E + := by + classical + obtain ⟨W₀, hs₀, hV₀, hE₀⟩ := hpath + obtain ⟨W, hsW, heW⟩ := hP.exists_walk_up W₀ + have hvs : v ∈ W.support := by + rw [hsW] + exact W₀.end_mem_support + obtain ⟨y₀, hy₀, hy₀N⟩ := hmeet + have hsupP : ∀ z ∈ W.support, z ∈ P.V := fun z hz => by + rw [hV₀] + rw [hsW] at hz + exact hz + have hy₀W : y₀ ∈ W.support := by + rw [hsW] + rw [hV₀] at hy₀ + exact hy₀ + obtain ⟨w, hwN, T', hT'e, hT's, hT'A⟩ := exists_last_in N.V W ⟨y₀, hy₀W, hy₀N⟩ + obtain ⟨W₁, hs₁, hs₁', he₁⟩ := GraphWalk.exists_isSimple T'.reverse + have hsup : ∀ z ∈ W₁.support, z ∈ T'.support := fun z hz => by + have h1 := hs₁' z hz + rwa [GraphWalk.support_reverse, List.mem_reverse] at h1 + have hedg : ∀ e ∈ W₁.edges, e ∈ W.edges := fun e he => by + have h1 := he₁ e he + rw [GraphWalk.edges_reverse, List.mem_reverse] at h1 + exact hT'e.subset h1 + have hP' : ∀ z ∈ (walkDrawing G W₁).U, z ∈ P.U := fun z hz => by + rcases walk_U_cases hz with h1 | ⟨e, he, hze⟩ + · exact P.V_subset_U (hsupP z (hT's z (hsup z h1))) + · have h2 : e ∈ P.E := by + rw [hE₀, ← heW] + exact hedg e he + exact P.closure_subset_U h2 (subset_closure hze) + have hd : Disjoint Eᶜ (discInt E) := disjoint_left.mpr fun x hx hx' => hx hx'.1 + have hstay := walk_U_stays_side hN hj hE.isClosed.isOpen_compl (hE.isOpen_discInt hman) hd + (fun z hz => by + by_cases h1 : j z ∈ E + · exact .inr ⟨h1, fun h2 => hz (by + rw [hb] at h2 + obtain ⟨x, hx, he⟩ := h2 + exact hji he ▸ hx)⟩ + · exact .inl h1) (fun z hz hU => hz (Surface.discBd_subset E (hb ▸ mem_image_of_mem j hU))) W₁ + hs₁ (fun z hz hne hzN => hne (hT'A z (hsup z hz) hzN)) hv + have hpb := walkDrawing_isPathBetween G hs₁ + refine ⟨(walkDrawing G W₁).U, w, isPreconnected_of_isPathBetween hpb, hP', ?_, ?_, ⟨?_, hwN⟩, + fun z hz hne => ?_⟩ + · exact (mem_walkDrawing_U G W₁).mpr (.inl W₁.end_mem_support) + · exact (mem_walkDrawing_U G W₁).mpr (.inl W₁.start_mem_support) + · exact hsupP w (hT's w T'.start_mem_support) + · rcases hstay z hz with h1 | h1 + · exact absurd h1 hne + · exact h1 + +/-- What the first half of the proof of (5.9) gives at one cuff `C`, in the capped surface `T`. Here +`Nk` is `N(C)` with its disc `E₀`, the `R i` are the pieces `N_i(C)`, the walks `Q i` go from the +vertices `x i` on `C` to the vertices `t i` of `R i`, and `Bo` with the disc `Do` is the outermost +circuit. The disc `Δ'` is where the boxes will be. The circuits `L i` in their discs `El i` are the +circuits `B_j(C)` past `N(C)`, all in the disc `Y`. -/ +structure IsCuffCore (G : Drawing S) (C : Set S) (j : S → T) (D : Set T) (r v : ℕ) {ks m : ℕ} + (Y E₀ Δ' Do : Set T) (Nk Bo : Drawing S) (R : Fin ks → Drawing S) (x t : Fin ks → S) + (Q : ∀ i, GraphWalk G.toGraph (x i) (t i)) (L : Fin m → Drawing S) (El : Fin m + → Set T) : Prop where + nkSub : Nk.IsSubdrawing G + nkCirc : Nk.IsCircuit + discE : IsClosedDisc E₀ + bdE : discBd E₀ = j '' Nk.U + DinE : D ⊆ discInt E₀ + discΔ : IsClosedDisc Δ' + EΔ : E₀ ⊆ Δ' \ discBd Δ' + discO : IsClosedDisc Do + boSub : Bo.IsSubdrawing G + boCirc : Bo.IsCircuit + bdO : discBd Do = j '' Bo.U + ΔO : Δ' ⊆ Do \ discBd Do + offO : Disjoint Do (bd T) + reach : ∀ y ∈ Bo.V, ∃ X, IsScriptASet G r C X ∧ y ∈ X + Rsub : ∀ i, (R i).IsSubdrawing Nk + Rpath : ∀ i, ∃ a b, (R i).IsPathBetween a b + Rdis : ∀ i i', i ≠ i' → Disjoint (R i).V (R i').V + Rcov : ∀ y ∈ Nk.V, ∃ i, y ∈ (R i).V + xmem : ∀ i, x i ∈ G.V ∩ C + tmem : ∀ i, t i ∈ (R i).V + Qsimple : ∀ i, (Q i).IsSimple + Qin : ∀ i, ∀ z ∈ (Q i).support, z = t i ∨ z ∈ G.V ∩ j ⁻¹' discInt E₀ + Qdis : ∀ i i', i ≠ i' → Disjoint {z | z ∈ (Q i).support} {z | z ∈ (Q i').support} + ks2 : 2 ≤ ks + kcard : ks = (G.V ∩ C).ncard + inner : ∀ F : Set S, IsOArc F → G.IsNormal F → (G.V ∩ F).ncard ≤ v → SurroundsCuff F C → Disjoint + (j ⁻¹' discInt E₀) F → False + discY : IsClosedDisc Y + YO : Y ⊆ Do + ΔY : Δ' ⊆ Y + layerSub : ∀ i, (L i).IsSubdrawing G + layerDisc : ∀ i, IsClosedDisc (El i) + layerBd : ∀ i, discBd (El i) = j '' (L i).U + layerIn : ∀ i, D ⊆ discInt (El i) + layerY : ∀ i, El i ⊆ Y + layerOff : ∀ i, Disjoint Δ' (discBd (El i)) + layerDis : ∀ i i', i ≠ i' → Disjoint (L i).V (L i').V + mv : v ≤ 2 * m + gates : ∀ i, ∃ (Γ : Fin v → Set S) (w y : Fin v → S), (∀ a, IsPreconnected (Γ a) ∧ Γ a ⊆ G.U + ∧ w a ∈ Γ a ∧ y a ∈ Γ a ∧ w a ∈ (R i).V ∧ j (y a) ∉ Y ∧ j (y a) ∈ Do ∧ ∀ z ∈ Γ a, z ≠ w a + → j z ∉ E₀ ∧ j z ∈ Do) ∧ ∀ a a', a ≠ a' → Disjoint (G.V ∩ Γ a) (G.V ∩ Γ a') + +private theorem inner_surrounding_arc_forbidden + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + (hS : IsSurface S) + {C : Set S} + {j : S → T} + {D : Set T} + (hc : IsCappedCuff C T j D) + {G : Drawing S} + {v : ℕ} + [T2Space T] + (hman : ∀ (x : T), IsManifoldPoint x) + (hji : Injective j) + (ks : ℕ) + (hks : 2 ≤ ks) + (ra : ℕ) + (hra : ra = v * ks) + (hks1 : ks ≤ ra) + (E : Set T) + (hd : IsCuffDisc G j D ra E) + (hmax : ∀ (Δ' : Set T), IsCuffDisc G j D ra Δ' → cuffCount G j Δ' ≤ cuffCount G j E) + (Δ : Set T) + (β : ℕ) + (B : ℕ → Drawing S) + (Ds : ℕ → Set T) + (hn : IsCuffNest G j C E (ra + (β + 3)) (β + 3) B Ds Δ) + (Δ₂ : Set T) + (N : Fin β → Drawing S) + (En : Fin β → Set T) + (hsd : ∀ {t t' : ℕ}, t < t' → t' < β + 3 → Ds t ⊆ Ds t' \ discBd (Ds t')) + (hE0 : E ⊆ Ds 0) + (hEn : ∀ (l : Fin β), IsClosedDisc (En l) ∧ discBd (En l) = j '' (N l).U ∧ Ds 1 ⊆ En l ∧ En l + ⊆ Δ₂) + (hDint : ∀ (l : Fin β), D ⊆ discInt (En l)) + (l0 : Fin β) + (F : Set S) + (hO : IsOArc F) + (hnF : G.IsNormal F) + (hcard : (G.V ∩ F).ncard ≤ v) + (hs : SurroundsCuff F C) + (hdj : Disjoint (j ⁻¹' discInt (En l0)) F) : + False := by + obtain ⟨Δ_F, hΔF, hDF, hbF⟩ := exists_disc_of_surrounds hS hc hO hs + have hpre : j ⁻¹' discBd Δ_F = F := by + rw [hbF] + exact preimage_image_eq F hji + have hB' : IsCuffDisc G j D ra Δ_F := by + refine ⟨hΔF, hDF, ?_, ?_⟩ + · rw [hpre] + exact hnF + · rw [hpre] + refine hcard.trans ?_ + rw [hra] + nlinarith + have h5 := hmax Δ_F hB' + have hoffI : Disjoint (discInt (En l0)) (discBd Δ_F) := by + rw [hbF, disjoint_left] + rintro _ h6 ⟨y, hy, rfl⟩ + exact disjoint_left.mp hdj h6 hy + obtain ⟨d, hdD⟩ := hc.isClosedDisc.nonempty_discInt + have hsubF : En l0 ⊆ Δ_F := disc_subset_of_int_off_bd hman (hEn l0).1 hΔF hoffI ⟨d, hDint l0 + hdD.1, hDF hdD.1⟩ + have hE₂ : E ⊆ Δ_F := hE0.trans ((hsd (by omega) (by omega)).trans (sdiff_subset.trans + ((hEn l0).2.2.1.trans hsubF))) + have hinf : (B 0).U.Infinite := by + have h6 := isOArc_infinite_any (hn.disc 0 (by omega)).isOArc_discBd + rw [hn.bd_eq 0 (by omega)] at h6 + exact fun hf => h6 (hf.image j) + obtain ⟨y, hy, hyV⟩ := (hinf.sdiff (B 0).finite_V).nonempty + obtain ⟨e, he, hye⟩ := (B 0).exists_edge_of_mem hy hyV + have heG : e ∈ G.E := (hn.sub 0 (by omega)).2 he + have hnew : ∃ e ∈ G.E, j '' e ⊆ Δ_F ∧ ¬ j '' e ⊆ E := by + refine ⟨e, heG, ?_, fun h6 => ?_⟩ + · rintro _ ⟨y', hy', rfl⟩ + have h7 : j y' ∈ discBd (Ds 0) := by + rw [hn.bd_eq 0 (by omega)] + exact mem_image_of_mem j (he.2.1 hy').1 + exact hsubF ((hEn l0).2.2.1 (hn.mono (Nat.zero_le 1) (by omega) + (Surface.discBd_subset _ h7))) + · have h7 := h6 (mem_image_of_mem j hye) + have h8 : j y ∉ discInt E := fun h9 => disjoint_left.mp (hn.offE 0 (by omega)) h9 hy + have h9 : j y ∈ discBd E := by + by_contra h10 + exact h8 ⟨h7, h10⟩ + exact (heG.2.1 hye).2 (hd.2.2.1 ⟨h9, (heG.2.1 hye).1⟩) + have h6 := cuffCount_lt G j hE₂ (.inr hnew) + omega + +/-- **The core at one cuff.** This is the first half of the proof of (5.9), pages 234-235: `A(C)` +with its maximal choice, the circuits, the paths of (5.8), the pieces `N_i(C)`, and the paths `Q_i`. +-/ +theorem exists_cuff_core (hS : IsSurface S) [ConnectedSpace S] {a b c : ℕ} (hm : Nonempty + (S ≃ₜ SurfaceModel a b c)) (habc : 3 ≤ 3 * a + 3 * b + c) (hcyl : ¬ Nonempty + (S ≃ₜ SurfaceModel 0 0 2)) {C : Set S} (hC : C ∈ cuffs S) {j : S → T} {D : Set T} + (hc : IsCappedCuff C T j D) (hbT : bd T = j '' (bd S \ C)) {G : Drawing S} (hG : G.IsProper) + (hns : ¬ IsSphere T) (hbl : IsBoundaryLinked G) {v : ℕ} (hv2 : 2 ≤ v) (hev : v ≤ 2 * + (v / 2)) (hks : 2 ≤ (G.V ∩ C).ncard) (hkv : (G.V ∩ C).ncard ≤ v) + (hα₁ : v * (G.V ∩ C).ncard + (v / 2 + (G.V ∩ C).ncard + 2 + 3) < alpha G) (hα₂ : v * + (G.V ∩ C).ncard + (v * (G.V ∩ C).ncard + (v / 2 + (G.V ∩ C).ncard + 2 + 3)) < alpha G) + (hα₃ : ∀ C₁ ∈ cuffs S, C₁ ≠ C → v * (G.V ∩ C).ncard + (v / 2 + (G.V ∩ C).ncard + 2 + 3) + + (G.V ∩ C₁).ncard < alpha G) (hα₄ : 9 * (v * (G.V ∩ C).ncard + (v / 2 + + (G.V ∩ C).ncard + 2 + 3) + 1) ≤ 2 * alpha G) : + ∃ (Y E₀ Δ' Do : Set T) (Nk Bo : Drawing S) (R : Fin (G.V ∩ C).ncard → Drawing S) (x t : Fin + (G.V ∩ C).ncard → S) (Q : ∀ i, GraphWalk G.toGraph (x i) (t i)) (L : Fin (v / 2) → Drawing S) + (El : Fin (v / 2) → Set T), IsCuffCore G C j D (v * (G.V ∩ C).ncard + (v / 2 + + (G.V ∩ C).ncard + 2 + 3)) v Y E₀ Δ' Do Nk Bo R x t Q L El := by + classical + have hT := hc.isSurface + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have : T2Space T := hT.2.1 + have : ConnectedSpace T := hc.connectedSpace hS + have hman := hT.2.2 + have hcont := hc.isEmbedding.continuous + have hji := hc.isEmbedding.injective + set ks := (G.V ∩ C).ncard with hksdef + set ra := v * ks with hra + have hpreC : j ⁻¹' discBd D = C := by + rw [hc.discBd_eq] + exact preimage_image_eq C hji + have hks1 : ks ≤ ra := by + rw [hra] + nlinarith + have h₀ : IsCuffDisc G j D ra D := by + refine ⟨hc.isClosedDisc, subset_rfl, ?_, ?_⟩ + · rw [hpreC] + exact fun z hz => hG ⟨cuff_subset_bd hC hz.1, hz.2⟩ + · rw [hpreC] + exact hks1 + obtain ⟨E, hd, hmax⟩ := exists_max_count G j h₀ + obtain ⟨Δ, hΔ, hA⟩ := exists_scriptA_disc hS hm habc hG hC hc hα₄ + have hEΔ : E ⊆ Δ := by + refine disc_subset_of_bd_subset hT hns hΔ hd.1 ?_ + rw [← image_preimage_bd hc hd.2.1] + rintro _ ⟨z, hz, rfl⟩ + have h1 := hd.isScriptASet hS hC hc hns + refine hA z ⟨_, ⟨h1.1, h1.2.1, h1.2.2.1, h1.2.2.2.1, h1.2.2.2.2.trans + (Nat.le_add_right _ _)⟩, hz⟩ + set β := v / 2 + ks + 2 with hβdef + obtain ⟨B, Ds, hn⟩ := exists_cuff_nest hS hm habc hcyl hC hc hbT hG hd hα₁ hα₂ hα₃ hΔ hEΔ hA (s + := β + 3) le_rfl (by omega) + obtain ⟨D₁, Δ₂, P, u, v', N, En, hD₁, hΔ₂, h1, h2, h3, h4, hg⟩ := hn.exists_grid + hS hc hd hmax (β := β) (by omega) + have hkβ : ks < β := by omega + have hvk : 2 ≤ v * ks := hks.trans hks1 + obtain ⟨R, hR1, hR2, hR3, hR4⟩ := hg.exists_groups (by omega) (by omega) hvk ⟨ks, hkβ⟩ + have hsd : ∀ {t t'}, t < t' → t' < β + 3 → Ds t ⊆ Ds t' \ discBd (Ds t') := fun htt ht + => hn.subset_diff hman hji htt ht + have hE0 : E ⊆ Ds 0 := hn.mem 0 (by omega) + have hDs0 : Ds 0 ⊆ discInt (Ds 1) := hsd (by omega) (by omega) + have hEn : ∀ l, IsClosedDisc (En l) ∧ discBd (En l) = j '' (N l).U ∧ Ds 1 ⊆ En l ∧ En l ⊆ Δ₂ + := fun l => by + obtain ⟨-, -, c1, c2, c3, c4⟩ := hg.circuit l + exact ⟨c1, c2, h1.trans c3, c4⟩ + have hDint : ∀ l, D ⊆ discInt (En l) := fun l => (hd.2.1.trans (hE0.trans hDs0)).trans + (discInt_mono hman (hn.disc 1 (by omega)) (hEn l).2.2.1) + have hoff : Disjoint Δ₂ (bd T) := (hn.off (β + 2) (by omega)).mono_left (h4.trans sdiff_subset) + obtain ⟨x, t, Q, hQ, hQd⟩ := hg.exists_Q_walks hS hC hc hns hbl hDint hoff hkv hkβ (fun i => + (hR1 i).1) hR2 hR4 + have hlt : ∀ l l' : Fin β, l < l' → En l ⊆ discInt (En l') := fun l l' hll z hz => by + refine ⟨hg.mono l l' hll.le hz, fun hb => ?_⟩ + by_cases hzi : z ∈ discBd (En l) + · rw [(hEn l).2.1] at hzi + rw [(hEn l').2.1] at hb + obtain ⟨y, hy, rfl⟩ := hzi + obtain ⟨y', hy', he⟩ := hb + have h5 := disjoint_U_of_disjoint_V (hg.circuit l).1 (hg.circuit l').1 + (hg.circuit_disj l l' hll.ne) + exact disjoint_left.mp h5 hy (hji he ▸ hy') + · exact (discInt_mono hman (hEn l).1 (hg.mono l l' hll.le) ⟨hz, hzi⟩).2 hb + have hmono : ∀ l l' : Fin β, l ≤ l' → En l ⊆ En l' := hg.mono + set l0 : Fin β := ⟨ks, hkβ⟩ with hl0 + set l1 : Fin β := ⟨ks + 1, by omega⟩ with hl1 + set lY : Fin β := ⟨v / 2 + ks, by omega⟩ with hlY + set lT : Fin β := ⟨v / 2 + ks + 1, by omega⟩ with hlT + have hl01 : l0 < l1 := by simp [hl0, hl1, Fin.lt_def] + have hint : ∀ z ∈ discBd (En l0), IsInteriorPoint z := fun z hz => by + by_contra hb + exact disjoint_left.mp hoff ((hEn l0).2.2.2 (Surface.discBd_subset _ hz)) hb + obtain ⟨Δ', hΔ', hEΔ', hΔ'sub⟩ := exists_disc_around hman (hEn l0).1 hint + ((hEn l1).1.isOpen_discInt hman) ((Surface.discBd_subset _).trans (hlt l0 l1 hl01)) + have hΔ'1 : Δ' ⊆ discInt (En l1) := hΔ'sub.trans (union_subset (hlt l0 l1 hl01) subset_rfl) + have hΔ'l : ∀ l : Fin β, l1 ≤ l → Δ' ⊆ discInt (En l) := fun l hl => by + rcases hl.lt_or_eq with h5 | rfl + · exact hΔ'1.trans (sdiff_subset.trans (hlt l1 l h5)) + · exact hΔ'1 + have hl1Y : l1 ≤ lY := by + simp only [hl1, hlY, Fin.le_def] + omega + have hYout : ∀ y, j y ∈ discBd Δ₂ → j y ∉ En lY := fun y hy hyY => by + have h5 : En lY ⊆ discInt Δ₂ := fun z hz => discInt_mono hman (hEn lT).1 (hEn lT).2.2.2 + (hlt lY lT (by simp [hlY, hlT, Fin.lt_def]) hz) + exact (h5 hyY).2 hy + have hE0Y : En l0 ⊆ En lY := hmono _ _ (hl01.le.trans hl1Y) + -- the ends of the paths past `N(C)` + have hgate : ∀ i, ∀ a : Fin (v * ks), (P a).V ∩ (N l0).V ⊆ (R i).V → ∃ Γ w, IsPreconnected Γ + ∧ Γ ⊆ (P a).U ∧ w ∈ Γ ∧ v' a ∈ Γ ∧ w ∈ (P a).V ∩ (N l0).V ∧ ∀ z ∈ Γ, z ≠ w → j z ∉ En l0 + := fun i a hsub => by + obtain ⟨c1, c2, c3, c4, c5⟩ := hg.path a + refine exists_gate hman (hg.circuit l0).1 c1 hcont hji (hEn l0).1 (hEn l0).2.1 c4 (fun hin + => hYout _ c3 (hE0Y hin)) ?_ + obtain ⟨Q', x', y', -, -, hV, W, -, hWV, -⟩ := hg.inter a l0 + exact ⟨x', hV ▸ (hWV ▸ W.start_mem_support : x' ∈ Q'.V)⟩ + have hinner : ∀ F : Set S, IsOArc F → G.IsNormal F → (G.V ∩ F).ncard ≤ v → SurroundsCuff F C + → Disjoint (j ⁻¹' discInt (En l0)) F → False := fun F hO hnF hcard hs hdj => by + exact inner_surrounding_arc_forbidden (S := S) (T := T) hS (C := C) + (j := j) (D := D) hc (G := G) (v := v) hman hji ks hks ra hra hks1 E hd hmax Δ β B + Ds hn Δ₂ N En hsd hE0 hEn hDint l0 F hO hnF hcard hs hdj + have hgates : ∀ i, ∃ (Γ : Fin v → Set S) (w y : Fin v → S), (∀ a, IsPreconnected (Γ a) + ∧ Γ a ⊆ G.U ∧ w a ∈ Γ a ∧ y a ∈ Γ a ∧ w a ∈ (R i).V ∧ j (y a) ∉ En lY ∧ j (y a) ∈ Ds (β + 2) + ∧ ∀ z ∈ Γ a, z ≠ w a → j z ∉ En l0 ∧ j z ∈ Ds (β + 2)) ∧ ∀ a a', a ≠ a' → Disjoint + (G.V ∩ Γ a) (G.V ∩ Γ a') := fun i => by + obtain ⟨f', hf', hfR⟩ := hR4 i + choose Γ w c1 c2 c3 c4 c5 c6 using fun a => hgate i (f' a) (hfR a) + have hin : ∀ a, ∀ z ∈ (P (f' a)).U, j z ∈ Ds (β + 2) := fun a z hz => h4 ((hg.path + (f' a)).2.2.2.2 (mem_image_of_mem j hz)).1 |>.1 + refine ⟨Γ, w, fun a => v' (f' a), fun a => ⟨c1 a, (c2 a).trans (hg.path + (f' a)).1.U_subset, c3 a, c4 a, hfR a (c5 a), hYout _ (hg.path (f' a)).2.2.1, hin a _ (c2 a + (c4 a)), fun z hz hne => ⟨c6 a z hz hne, hin a z (c2 a hz)⟩⟩, fun a a' hne => ?_⟩ + rw [disjoint_left] + rintro z ⟨hzV, hz⟩ ⟨-, hz'⟩ + have h5 := mem_V_of_subdrawing (hg.path (f' a)).1 (c2 a hz) hzV + have h6 := mem_V_of_subdrawing (hg.path (f' a')).1 (c2 a' hz') hzV + exact disjoint_left.mp (hg.path_disj _ _ (hf'.ne hne)) h5 h6 + have hβ2 : β + 2 < β + 3 := by omega + have hlay : ∀ i : Fin (v / 2), ks + 1 + i.1 < β := fun i => by + have := i.2 + omega + exact ⟨En lY, En l0, Δ', Ds (β + 2), N l0, B (β + 2), R, x, t, Q, fun i => N ⟨ks + 1 + i.1, + hlay i⟩, fun i => En ⟨ks + 1 + i.1, hlay i⟩, + { nkSub := (hg.circuit l0).1 + nkCirc := (hg.circuit l0).2.1 + discE := (hEn l0).1 + bdE := (hEn l0).2.1 + DinE := hDint l0 + discΔ := hΔ' + EΔ := hEΔ' + discO := hn.disc _ hβ2 + boSub := hn.sub _ hβ2 + boCirc := hn.circuit _ hβ2 + bdO := hn.bd_eq _ hβ2 + ΔO := (hΔ'1.trans (sdiff_subset.trans (hEn l1).2.2.2)).trans h4 + offO := hn.off _ hβ2 + reach := fun y hy => by + obtain ⟨X, hX, hyX, -⟩ := hn.reach _ hβ2 y hy + exact ⟨X, hX, hyX⟩ + Rsub := fun i => (hR1 i).1 + Rpath := fun i => (hR1 i).2 + Rdis := hR2 + Rcov := hR3 + xmem := fun i => (hQ i).1 + tmem := fun i => (hQ i).2.1 + Qsimple := fun i => (hQ i).2.2.1 + Qin := fun i => (hQ i).2.2.2 + Qdis := hQd + ks2 := hks + kcard := rfl + inner := hinner + discY := (hEn lY).1 + YO := (hEn lY).2.2.2.trans (h4.trans sdiff_subset) + ΔY := (hΔ'l lY hl1Y).trans sdiff_subset + layerSub := fun i => (hg.circuit _).1 + layerDisc := fun i => (hEn _).1 + layerBd := fun i => (hEn _).2.1 + layerIn := fun i => hDint _ + layerY := fun i => hmono _ _ (by + simp only [hlY, Fin.le_def] + have := i.2 + omega) + layerOff := fun i => disjoint_left.mpr fun z hz hz' => (hΔ'l _ (by + simp only [hl1, Fin.le_def] + omega) hz).2 hz' + layerDis := fun i i' hne => hg.circuit_disj _ _ (fun he => hne (Fin.ext (by + have := congrArg Fin.val he + simp only at this + omega))) + mv := hev + gates := hgates }⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffFinal.lean b/LeanPool/GraphMinor/GM07/CuffFinal.lean new file mode 100644 index 0000000000..522fe10476 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffFinal.lean @@ -0,0 +1,144 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffCollarBuild + +/-! +# Graph Minors VII, (5.9) + +This is the end of the proof of (5.9), pages 233-237. It puts together the core and the collar at +each cuff, with the numbers of the paper, and then uses `isGFeasible_of_collars`. + +(5.9) rests on (4.6), which is `theorem_4_6`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The number `v(Σ, k)` has the form `6X + 2k` with `X ≥ 1`, if `Σ` has at least two cuffs. -/ +theorem vSurface_form {a b c : ℕ} (hc : 2 ≤ c) (he : Nonempty (S ≃ₜ SurfaceModel a b c)) + (k : ℕ) : ∃ X, 1 ≤ X ∧ vSurface S k = 6 * X + 2 * k := by + have hne : {v : ℕ | ∃ a b c : ℕ, Nonempty (S ≃ₜ SurfaceModel a b c) ∧ v + = vModel a b c k}.Nonempty := ⟨_, a, b, c, he, rfl⟩ + obtain ⟨a', b', c', he', hv⟩ := Nat.sInf_mem hne + have hc' : c' = c := by + rw [← ncard_cuffs_of_homeomorph_surfaceModel he', ncard_cuffs_of_homeomorph_surfaceModel he] + refine ⟨(2 * a' + b' + c' - 1) * (wMaxModel a' b' c' k + 2 * muModel a' b' c' k + 1), ?_, ?_⟩ + · exact Nat.mul_pos (by omega) (by omega) + · change sInf _ = _ + rw [hv, vModel, mul_assoc] + +/-- The sums of (5.9). -/ +theorem collar_numbers {k X K K' α A P v h : ℕ} (hv : v = 6 * X + 2 * k) (hX : 1 ≤ X) (hk : 2 ≤ k) + (hK : K + 2 ≤ 2 * k) (hA : A + 2 * v ≤ 2 * P) (hA' : v ≤ A) (hP : 2 * v ≤ P) (hα : 9 * P < α) + (hK' : K' ≤ 2 * k) (hh : h = v / 2) : + A + (h + K + 2 + 3) + 1 ≤ 2 * P ∧ A + (h + K + 2 + 3) < α ∧ A + (A + (h + K + 2 + 3)) < α ∧ A + + (h + K + 2 + 3) + K' < α ∧ 9 * (A + (h + K + 2 + 3) + 1) ≤ 2 * α := by + have h1 : v / 2 = 3 * X + k := by omega + omega + +/-- Graph Minors VII, (5.9) (pages 233–237): +"(5.9) *Let $\Sigma \cong \Sigma(a, b, c)$, where $c \ge 2$ and $(a, b, c) \ne (0, 0, 2)$. Let +$k \ge 0$ be an integer. Let $G$ be a boundary-linked proper graph in $\Sigma$ with +$|V(G) \cap \mathrm{bd}(\Sigma)| \le 2k$ and with $\alpha(G) > 9k v(\Sigma, k)$, such that for +every cuff $C$, $|V(G) \cap C| \ge 2$. Let $H$ be a forest in $\Sigma$ with +$V(G) \cap \mathrm{bd}(\Sigma) = V(H) \cap \mathrm{bd}(\Sigma)$. Then $H$ is $G$-feasible.*" + +See `IsCuffCore` for the parts of the proof at one cuff, `IsCuffCollar` for what they give, and +`isGFeasible_of_collars` for the final step. -/ +theorem theorem_5_9_proof + [T1Space S] (hS : IsSurface S) {a b c : ℕ} (hc : 2 ≤ c) (hne : (a, b, c) ≠ (0, 0, 2)) + (he : Nonempty (S ≃ₜ SurfaceModel a b c)) + (k : ℕ) (G H : Drawing S) + (hBL : IsBoundaryLinked G) (hbd_card : (G.V ∩ bd S).ncard ≤ 2 * k) + (halpha : 9 * k * vSurface S k < alpha G) + (hcuff2 : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) + (hH : IsSurfaceForest H) (hbd_eq : G.V ∩ bd S = H.V ∩ bd S) : + IsGFeasible G H := by + classical + have : ConnectedSpace S := connectedSpace_of_model he + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have habc : 3 ≤ 3 * a + 3 * b + c := by + by_contra hlt + have h1 : a = 0 := by omega + have h2 : b = 0 := by omega + have h3 : c = 2 := by omega + exact hne (by rw [h1, h2, h3]) + have hcyl : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 2) := not_cylinder_of_model habc he + have hG := hBL.1 + have hnc := ncard_cuffs_of_homeomorph_surfaceModel he + obtain ⟨X, hX, hv⟩ := vSurface_form hc he k + set v := vSurface S k with hvdef + have hfinV : ∀ A : Set S, (G.V ∩ A).Finite := fun A => G.finite_V.subset inter_subset_left + have hKsum : ∀ C ∈ cuffs S, (G.V ∩ C).ncard + 2 ≤ 2 * k := fun C hC => by + obtain ⟨C₁, hC₁, hne₁⟩ := exists_ne_of_one_lt_ncard (s := cuffs S) (by rw [hnc]; omega) C + have hd : Disjoint (G.V ∩ C) (G.V ∩ C₁) := (disjoint_cuffs hC hC₁ hne₁.symm).mono + inter_subset_right inter_subset_right + have h1 := ncard_union_eq hd (hfinV C) (hfinV C₁) + have hsub : (G.V ∩ C) ∪ (G.V ∩ C₁) ⊆ G.V ∩ bd S := union_subset (inter_subset_inter_right _ + (cuff_subset_bd hC)) (inter_subset_inter_right _ (cuff_subset_bd hC₁)) + have h2 := ncard_le_ncard hsub (hfinV _) + have h3 := hcuff2 C₁ hC₁ + omega + have hC₀ : (cuffs S).Nonempty := nonempty_of_ncard_ne_zero (by omega) + obtain ⟨C₀, hC₀m⟩ := hC₀ + have hk : 2 ≤ k := by + have h1 := hKsum C₀ hC₀m + have h2 := hcuff2 C₀ hC₀m + omega + set P := k * v with hPdef + have hα : 9 * P < alpha G := by + have h1 : 9 * P = 9 * k * v := by rw [hPdef]; ring + omega + have hP : 2 * v ≤ P := by + rw [hPdef] + exact Nat.mul_le_mul_right v hk + have hcol : ∀ c' : cuffs S, ∃ (ι : Type u) (_ : Finite ι) (Mo AC Mo₂ Mo₃ : Set S) (φ : ι → ℝ × ℝ + → S) (g f : ι → ℝ → ℝ) (Tr : S → Drawing S), IsCuffCollar G c'.1 (2 * P) v Mo AC Mo₂ Mo₃ φ g f + Tr := fun c' => by + obtain ⟨C, hC⟩ := c' + obtain ⟨T, tT, j, D, hcap, hbT⟩ := exists_cappedCuff hS hC + have hT := hcap.isSurface + have : T2Space T := hT.2.1 + have hns : ¬ IsSphere T := not_isSphere_cap hS habc he hcap + have hK := hKsum C hC + have hK2 := hcuff2 C hC + have hA : v * (G.V ∩ C).ncard + 2 * v ≤ 2 * P := by + have h1 : v * ((G.V ∩ C).ncard + 2) ≤ v * (2 * k) := Nat.mul_le_mul_left v hK + rw [hPdef] + nlinarith + have hA' : v ≤ v * (G.V ∩ C).ncard := Nat.le_mul_of_pos_right v (by omega) + have hnum := fun K' (hK' : K' ≤ 2 * k) => collar_numbers (K' := K') hv hX hk hK hA hA' hP hα + hK' rfl + obtain ⟨n1, n2, n3, -, n5⟩ := hnum 0 (by omega) + obtain ⟨Y, E₀, Δ', Do, Nk, Bo, R, x, t, Q, L, El, hcore⟩ := exists_cuff_core hS he habc hcyl hC + hcap hbT hG hns hBL (v := v) (by omega) (by omega) hK2 (by omega) n2 n3 (fun C₁ hC₁ hne₁ => by + have h1 := hKsum C₁ hC₁ + exact (hnum _ (by omega)).2.2.2.1) n5 + have hcore' : IsCuffCore G C j D (2 * P) v Y E₀ Δ' Do Nk Bo R x t Q L El := { hcore with + reach := fun y hy => by + obtain ⟨X', hX', hyX⟩ := hcore.reach y hy + exact ⟨X', ⟨hX'.1, hX'.2.1, hX'.2.2.1, hX'.2.2.2.1, hX'.2.2.2.2.trans (by omega)⟩, hyX⟩ } + exact hcore'.exists_collar hS hC hcap hbT hG hns + choose ι hfin Mo AC Mo₂ Mo₃ φ g f Tr hcoll using hcol + have : ∀ c', Finite (ι c') := hfin + have hvP : v ≤ P := by omega + exact isGFeasible_of_collars hS (by omega) hcyl hG hbd_card hcoll (by omega) (by omega) + (by omega) (by omega) hcuff2 hH hbd_eq + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffFinger.lean b/LeanPool/GraphMinor/GM07/CuffFinger.lean new file mode 100644 index 0000000000..2ee2741697 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffFinger.lean @@ -0,0 +1,428 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffShift +public import LeanPool.GraphMinor.GM07.JoinDiscs +public import LeanPool.GraphMinor.Surface.AddCrosscap + +/-! +# Three facts on discs in a surface with boundary + +These are used in the choice of the `O`-arcs `A'` and `A` in the proof of Graph Minors VII, (6.1), +page 237: which disc holds which (`disc_subset_of_int_off_bd`), the outer side of a disc near a +point of its +boundary (`exists_side_nbhd`), and a finger from a disc to a point outside it (`exists_finger`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 Metric + +universe u + +variable {T : Type u} [TopologicalSpace T] [T2Space T] + +omit [T2Space T] in +theorem inside_or_off {X B : Set T} (hX : IsPreconnected X) (hB : IsClosed B) (hf : Disjoint X + (frontier B)) : X ⊆ interior B ∨ X ⊆ Bᶜ := by + have hcov : X ⊆ interior B ∪ Bᶜ := fun x hx => by + by_cases h1 : x ∈ B + · refine .inl ?_ + by_contra h2 + exact disjoint_left.mp hf hx ⟨subset_closure h1, h2⟩ + · exact .inr h1 + have hd : Disjoint (interior B) Bᶜ := disjoint_left.mpr fun x hx hx' => hx' (interior_subset hx) + exact hX.subset_or_subset isOpen_interior hB.isOpen_compl hd hcov + +theorem frontier_disc_subset (hman : ∀ x : T, IsManifoldPoint x) {Δ : Set T} + (hΔ : IsClosedDisc Δ) : frontier Δ ⊆ discBd Δ := by + rintro x hx + have h1 : x ∈ Δ := hΔ.isClosed.frontier_subset hx + by_contra hb + exact hx.2 (interior_maximal (discInt_subset Δ) (hΔ.isOpen_discInt hman) ⟨h1, hb⟩) + +/-- If the inside of `Δ₁` misses the boundary of `Δ₂`, and the insides meet, then `Δ₁ ⊆ Δ₂`. -/ +theorem disc_subset_of_int_off_bd (hman : ∀ x : T, IsManifoldPoint x) {Δ₁ Δ₂ : Set T} + (h₁ : IsClosedDisc Δ₁) (h₂ : IsClosedDisc Δ₂) (hoff : Disjoint (discInt Δ₁) (discBd Δ₂)) (hm : + (discInt Δ₁ ∩ Δ₂).Nonempty) : Δ₁ ⊆ Δ₂ := by + have hf : Disjoint (discInt Δ₁) (frontier Δ₂) := hoff.mono_right (frontier_disc_subset hman h₂) + rcases inside_or_off h₁.isPreconnected_discInt h₂.isClosed hf with h | h + · have : closure (discInt Δ₁) ⊆ Δ₂ := closure_minimal (h.trans interior_subset) h₂.isClosed + exact h₁.subset_closure_discInt.trans this + · obtain ⟨x, hx, hx'⟩ := hm + exact absurd hx' (h hx) + +omit [T2Space T] in +/-- Near a point of the boundary of a disc, the part off the disc is connected and not empty. -/ +theorem exists_side_nbhd (hman : ∀ x : T, IsManifoldPoint x) {B E : Set T} (hB : IsClosedDisc B) + (hE : IsClosedDisc E) (hBE : B ⊆ E \ discBd E) {x : T} (hx : x ∈ discBd B) {W : Set T} + (hW : IsOpen W) (hxW : x ∈ W) : + ∃ N, IsOpen N ∧ x ∈ N ∧ N ⊆ W ∧ IsPreconnected (N \ B) ∧ (N \ B).Nonempty := by + classical + obtain ⟨p⟩ := hB.isOArc_discBd + obtain ⟨c, c', hc, hc', hm, hm', hl, hr, hin, hs, hcp⟩ := exists_disc_collar hB hE hBE p + let w₀ : Circle := p.symm ⟨x, hx⟩ + have hcw : c w₀ = x := by + rw [hcp] + simp [w₀] + have hw1 : ‖(w₀ : ℂ)‖ = 1 := by simp + have hw₀ : (w₀ : ℂ) ≠ 0 := by simp + -- the part of the open ball that goes into `W` + have hV : IsOpen (ball (0 : ℂ) 2 ∩ c ⁻¹' W) := (hc.mono + ball_subset_closedBall).isOpen_inter_preimage isOpen_ball hW + have hw₀V : (w₀ : ℂ) ∈ ball (0 : ℂ) 2 ∩ c ⁻¹' W := ⟨by simp, by rw [mem_preimage, hcw]; exact hxW⟩ + obtain ⟨ε, hε, hεV⟩ := Metric.isOpen_iff.mp hV _ hw₀V + let δ : ℝ := min (ε / 4) (1 / 4) + have hδ : 0 < δ := lt_min (by positivity) (by norm_num) + have hδ1 : δ ≤ 1 / 4 := min_le_right _ _ + have hδε : δ ≤ ε / 4 := min_le_left _ _ + -- the box around `w₀` + let un : ℂ → ℂ := fun z => z / w₀ + have hun : Continuous un := by fun_prop + have hnun : ∀ z, ‖un z‖ = ‖z‖ := fun z => by simp [un] + let Box : Set ℂ := {z | 0 < (un z).re ∧ |‖z‖ - 1| < δ ∧ |(un z).im| < δ} + have hBoxO : IsOpen Box := by + have e : Box = {z | 0 < (un z).re} ∩ ({z | |‖z‖ - 1| < δ} ∩ {z | |(un z).im| < δ}) := rfl + rw [e] + refine (isOpen_lt continuous_const (Complex.continuous_re.comp hun)).inter + ((isOpen_lt ?_ continuous_const).inter (isOpen_lt ?_ continuous_const)) + · fun_prop + · exact (Complex.continuous_im.comp hun).abs + have hBoxε : ∀ z ∈ Box, z ∈ ball (w₀ : ℂ) ε := fun z hz => by + obtain ⟨h1, h2, h3⟩ := hz + obtain ⟨h2l, h2r⟩ := abs_lt.mp h2 + have h3' := abs_lt.mp h3 + set u := un z with hu + have hn : ‖u‖ = ‖z‖ := hnun z + have hsq : u.re * u.re + u.im * u.im = ‖u‖ * ‖u‖ := by + rw [← Complex.normSq_apply, Complex.normSq_eq_norm_sq] + ring + have hre : u.re ≤ ‖u‖ := Complex.re_le_norm u + have hlow : 1 - 2 * δ ≤ u.re := by + rw [hn] at hsq + by_contra hc + push Not at hc + nlinarith + have hz' : z - w₀ = (u - 1) * w₀ := by + rw [hu] + simp only [un] + field_simp + have hb : ‖u - 1‖ ≤ |u.re - 1| + |u.im| := by + have := Complex.norm_le_abs_re_add_abs_im (u - 1) + simpa using this + have hb1 : |u.re - 1| ≤ 2 * δ := abs_le.mpr ⟨by linarith, by linarith⟩ + rw [mem_ball, dist_eq_norm, hz', norm_mul, hw1, mul_one] + linarith [h3'.1, h3'.2, abs_lt.mpr h3', abs_nonneg u.im] + have hBoxb : Box ⊆ ball (0 : ℂ) 2 := fun z hz => (hεV (hBoxε z hz)).1 + have hBoxW : Box ⊆ c ⁻¹' W := fun z hz => (hεV (hBoxε z hz)).2 + have hw₀Box : (w₀ : ℂ) ∈ Box := by + have : un (w₀ : ℂ) = 1 := div_self hw₀ + refine ⟨by simp [this], ?_, by simp [this, hδ]⟩ + rw [hw1] + simpa using hδ + have hb2 : ball (0 : ℂ) 2 ⊆ closedBall 0 2 := ball_subset_closedBall + have hint : discInt E = c '' ball 0 2 := by + ext y + constructor + · rintro ⟨hy, hyb⟩ + refine ⟨c' y, ?_, hr hy⟩ + have h1 : ‖c' y‖ ≤ 2 := by simpa using hm' hy + refine mem_ball_zero_iff.mpr (lt_of_le_of_ne h1 fun h2 => hyb ?_) + rw [← hs, ← hr hy] + exact mem_image_of_mem c (by simpa using h2) + · rintro ⟨z, hz, rfl⟩ + refine ⟨hm (hb2 hz), fun hb => ?_⟩ + rw [← hs] at hb + obtain ⟨y, hy, he⟩ := hb + rw [hl.injOn (sphere_subset_closedBall hy) (hb2 hz) he] at hy + have h1 : ‖z‖ = 2 := by simpa using hy + have h2 : ‖z‖ < 2 := by simpa using hz + linarith + let f : ℝ × ℝ → ℂ := fun q => (((Real.sqrt (q.1 * q.1 - q.2 * q.2) : ℝ) : ℂ) + + (q.2 : ℂ) * Complex.I) * w₀ + have hfc : Continuous f := by + have := Real.continuous_sqrt + fun_prop + let P : Set (ℝ × ℝ) := Ioo 1 (1 + δ) ×ˢ Ioo (-δ) δ + have hPc : IsPreconnected P := ((convex_Ioo _ _).prod (convex_Ioo _ _)).isPreconnected + have hunf : ∀ q : ℝ × ℝ, un (f q) = ((Real.sqrt (q.1 * q.1 - q.2 * q.2) : ℝ) : ℂ) + + (q.2 : ℂ) * Complex.I := fun q => by + simp only [un, f] + field_simp + have hnf : ∀ q : ℝ × ℝ, q ∈ P → ‖f q‖ = q.1 := fun q hq => by + have h1 := hq.1.1 + have h2 := hq.2.1 + have h3 := hq.2.2 + have hpos : 0 ≤ q.1 * q.1 - q.2 * q.2 := by nlinarith + rw [← hnun, hunf, Complex.norm_def, Complex.normSq_apply] + simp only [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, mul_zero, + Complex.ofReal_im, Complex.I_im, mul_one, sub_self, add_zero, Complex.add_im, Complex.mul_im, + zero_add] + rw [Real.mul_self_sqrt hpos] + rw [show q.1 * q.1 - q.2 * q.2 + q.2 * q.2 = q.1 * q.1 by ring, + Real.sqrt_mul_self (by linarith)] + have hfB : ∀ q ∈ P, f q ∈ Box := fun q hq => by + have hn := hnf q hq + have h1 := hq.1.1 + have h2 := hq.1.2 + have h3 := hq.2.1 + have h4 := hq.2.2 + have hpos : 0 < q.1 * q.1 - q.2 * q.2 := by nlinarith + refine ⟨?_, ?_, ?_⟩ + · rw [hunf] + simpa using hpos + · rw [hn] + exact abs_lt.mpr ⟨by linarith, by linarith⟩ + · rw [hunf] + simpa using abs_lt.mpr ⟨h3, h4⟩ + have hdiff : c '' Box \ B = c '' (f '' P) := by + ext y + constructor + · rintro ⟨⟨z, hz, rfl⟩, hzB⟩ + have hzn : 1 < ‖z‖ := by + by_contra hle + exact hzB (hin ▸ mem_image_of_mem c (by simpa using not_lt.mp hle)) + obtain ⟨h1, h2, h3⟩ := hz + have hsq : (un z).re * (un z).re + (un z).im * (un z).im = ‖z‖ * ‖z‖ := by + rw [← hnun, ← Complex.normSq_apply, Complex.normSq_eq_norm_sq] + ring + refine ⟨z, ⟨(‖z‖, (un z).im), ⟨⟨hzn, ?_⟩, abs_lt.mp h3⟩, ?_⟩, rfl⟩ + · have := (abs_lt.mp h2).2 + linarith + · have h4 : Real.sqrt (‖z‖ * ‖z‖ - (un z).im * (un z).im) = (un z).re := by + rw [show ‖z‖ * ‖z‖ - (un z).im * (un z).im = (un z).re * (un z).re by linarith] + exact Real.sqrt_mul_self h1.le + simp only [f] + rw [h4, Complex.re_add_im] + simp only [un] + field_simp + · rintro ⟨_, ⟨q, hq, rfl⟩, rfl⟩ + have hn := hnf q hq + have h1 := hq.1.1 + have h2 := hq.1.2 + have h3 := hq.2.1 + have h4 := hq.2.2 + have hpos : 0 < q.1 * q.1 - q.2 * q.2 := by nlinarith + have hBq : f q ∈ Box := hfB q hq + refine ⟨⟨f q, hBq, rfl⟩, fun hin' => ?_⟩ + rw [← hin] at hin' + obtain ⟨y, hy, he⟩ := hin' + have hyb : y ∈ closedBall (0 : ℂ) 2 := by + have : ‖y‖ ≤ 1 := by simpa using hy + simp only [mem_closedBall_zero_iff] + linarith + rw [hl.injOn hyb (hb2 (hBoxb hBq)) he] at hy + have : ‖f q‖ ≤ 1 := by simpa using hy + linarith + refine ⟨c '' Box, ?_, ⟨w₀, hw₀Box, hcw⟩, ?_, ?_, ?_⟩ + · have : c '' Box = discInt E ∩ c' ⁻¹' Box := by + ext y + constructor + · rintro ⟨z, hz, rfl⟩ + refine ⟨hint ▸ mem_image_of_mem c (hBoxb hz), ?_⟩ + rw [mem_preimage, hl (hb2 (hBoxb hz))] + exact hz + · rintro ⟨hy, hyB⟩ + exact ⟨c' y, hyB, hr hy.1⟩ + rw [this] + have h1 := hc'.mono (discInt_subset E) + exact h1.isOpen_inter_preimage (hE.isOpen_discInt hman) hBoxO + · rintro _ ⟨z, hz, rfl⟩ + exact hBoxW hz + · rw [hdiff] + refine (hPc.image _ hfc.continuousOn).image _ (hc.mono ?_) + rintro _ ⟨q, hq, rfl⟩ + exact hb2 (hBoxb (hfB q hq)) + · rw [hdiff] + refine ⟨_, _, ⟨(1 + δ / 2, 0), ⟨⟨by linarith, by linarith⟩, ⟨by linarith, hδ⟩⟩, rfl⟩, rfl⟩ + +/-- **A finger from a disc to a point outside it.** We add to `Δ` a thin disc around the line `L`. +The new boundary meets the closed set `Z` only where the old boundary did, and at `b`. The new disc +meets `Z` only in `Δ` and at `b`. -/ +theorem exists_finger {T : Type} [TopologicalSpace T] (hT : IsSurface T) {Δ L Z : Set T} {p b : T} + (hΔ : IsClosedDisc Δ) (hL : IsLineWithEnds L p b) (hpb : p ≠ b) (hp : p ∈ discBd Δ) + (hLΔ : L ∩ Δ ⊆ {p}) (hb : b ∉ Δ) + (hZ : IsClosed Z) (hbZ : b ∈ Z) (hLZ : L ∩ Z ⊆ {b}) (hoff : Disjoint (Δ ∪ L) (bd T)) : + ∃ Δ₁, IsClosedDisc Δ₁ ∧ Δ ⊆ Δ₁ ∧ b ∈ discBd Δ₁ ∧ discBd Δ ∩ Z ⊆ discBd Δ₁ ∧ discBd Δ₁ ∩ Z ⊆ + (discBd Δ ∩ Z) ∪ {b} ∧ Disjoint Δ₁ (bd T) ∧ + Δ₁ ∩ Z ⊆ Δ ∪ {b} := by + classical + have : CompactSpace T := hT.1 + have : T2Space T := hT.2.1 + obtain ⟨R, tR, i, K, hR, hi, hK, hcov, hcap, -⟩ := exists_capAll T hT + have : T2Space R := hR.2.1 + have hii := hi.injective + have hpΔ : p ∈ Δ := Surface.discBd_subset _ hp + have hpL : p ∈ L := hL.left_mem + have hbL : b ∈ L := hL.right_mem + have hpZ : p ∉ Z := fun h => hpb (hLZ ⟨hpL, h⟩) + have hoffK : ∀ x ∈ Δ ∪ L, i x ∉ K := fun x hx hK' => by + have h1 : i x ∈ range i ∩ K := ⟨mem_range_self x, hK'⟩ + rw [hcap] at h1 + obtain ⟨y, hy, he⟩ := h1 + rw [hii he] at hy + exact disjoint_left.mp hoff hx hy + have hline := image_line hi.isEmbedding hL + let Y : Set R := i '' (Δ ∪ Z) ∪ K + have hYc : IsClosed Y := (hi.isClosedMap _ (hΔ.isClosed.union hZ)).union hK + have hLY : i '' L ∩ Y ⊆ {i p, i b} := by + rintro _ ⟨⟨x, hx, rfl⟩, hxY⟩ + rcases hxY with ⟨y, hy, he⟩ | hxK + · rw [hii he] at hy + rcases hy with hy | hy + · exact .inl (by rw [show x = p from hLΔ ⟨hx, hy⟩]) + · exact .inr (by rw [show x = b from hLZ ⟨hx, hy⟩]; rfl) + · exact absurd hxK (hoffK x (.inr hx)) + obtain ⟨Ln, -, -, hLn, hLnL, hLnY, hpLn, hbLn, -⟩ := exists_edge_lens hR hline + (hii.ne hpb) hYc hLY + obtain ⟨hA, hAb⟩ := isClosedDisc_image hΔ hi.continuous.continuousOn hii.injOn + have hsL : i p ∈ Ln ∧ i b ∈ Ln := ⟨Surface.discBd_subset _ hpLn, Surface.discBd_subset _ hbLn⟩ + have hLnY' : ∀ x ∈ Ln, x ∈ Y → x = i p ∨ x = i b := fun x hx hy => hLnY ⟨hx, hy⟩ + have hAB : i '' Δ ∩ Ln = {i p} := by + ext x + constructor + · rintro ⟨⟨y, hy, rfl⟩, hyL⟩ + rcases hLnY' _ hyL (.inl ⟨y, .inl hy, rfl⟩) with h | h + · exact h + · rw [hii h] at hy + exact absurd hy hb + · rintro rfl + exact ⟨mem_image_of_mem i hpΔ, hsL.1⟩ + let W : Set R := (i '' Z ∪ K)ᶜ + have hW : IsOpen W := ((hi.isClosedMap _ hZ).union hK).isOpen_compl + have hpW : i p ∈ W := by + rintro (⟨y, hy, he⟩ | hK') + · rw [hii he] at hy + exact hpZ hy + · exact hoffK p (.inl hpΔ) hK' + obtain ⟨D, hD, h1, h2, -, h4, h5⟩ := exists_join hR hA hLn hAB + (by rw [hAb]; exact mem_image_of_mem i hp) hpLn hW hpW + have hbW : ∀ x ∈ Z, i x ∉ W := fun x hx h => h (.inl (mem_image_of_mem i hx)) + have hLnr : Ln ⊆ range i := fun x hx => by + rcases hcov.ge (mem_univ x) with h | h + · exact h + · rcases hLnY' x hx (.inr h) with rfl | rfl <;> exact mem_range_self _ + have hDr : D ⊆ range i := fun x hx => by + rcases h2 hx with (⟨y, -, rfl⟩ | h) | h + · exact mem_range_self y + · exact hLnr h + · rcases hcov.ge (mem_univ x) with h' | h' + · exact h' + · exact absurd (.inr h') h + have : Nonempty T := ⟨p⟩ + obtain ⟨hD₁, hbd⟩ := isClosedDisc_preimage hi hD hDr + refine ⟨i ⁻¹' D, hD₁, fun x hx => h1 (.inl (mem_image_of_mem i hx)), ?_, ?_, ?_, ?_, ?_⟩ + · rw [hbd] + exact h4 ⟨.inr hbLn, hbW b hbZ⟩ + · rintro x ⟨hx, hxZ⟩ + rw [hbd] + refine h4 ⟨.inl ?_, hbW x hxZ⟩ + rw [hAb] + exact mem_image_of_mem i hx + · rintro x ⟨hx, hxZ⟩ + rw [hbd] at hx + rcases h5 hx with (h | h) | h + · rw [hAb] at h + obtain ⟨y, hy, he⟩ := h + rw [hii he] at hy + exact .inl ⟨hy, hxZ⟩ + · rcases hLnY' _ (Surface.discBd_subset _ h) (.inl ⟨x, .inr hxZ, rfl⟩) with h' | h' + · rw [hii h'] at hxZ + exact absurd hxZ hpZ + · exact .inr (hii h') + · exact absurd h (hbW x hxZ) + · rw [disjoint_left] + intro x hx hxb + have hxK : i x ∈ K := by + have h6 : i x ∈ i '' bd T := mem_image_of_mem i hxb + rw [← hcap] at h6 + exact h6.2 + rcases h2 hx with (⟨y, hy, he⟩ | h) | h + · rw [hii he] at hy + exact hoffK x (.inl hy) hxK + · rcases hLnY' _ h (.inr hxK) with h' | h' + · rw [hii h'] at hxK + exact hoffK p (.inl hpΔ) hxK + · rw [hii h'] at hxK + exact hoffK b (.inr hbL) hxK + · exact h (.inr hxK) + · rintro x ⟨hx, hxZ⟩ + rcases h2 hx with (⟨y, hy, he⟩ | h) | h + · rw [hii he] at hy + exact .inl hy + · rcases hLnY' _ h (.inl ⟨x, .inr hxZ, rfl⟩) with h' | h' + · exact .inl (hii h' ▸ hpΔ) + · exact .inr (hii h') + · exact absurd h (hbW x hxZ) + +/-- The same for a surface in any universe that is homeomorphic to one in the lowest universe, such +as a surface model. -/ +theorem exists_finger_of_homeo {T : Type u} [TopologicalSpace T] {T₀ : Type} [TopologicalSpace T₀] + (hT : IsSurface T) (e : T ≃ₜ T₀) {Δ L Z : Set T} {p b : T} (hΔ : IsClosedDisc Δ) + (hL : IsLineWithEnds L p b) (hpb : p ≠ b) + (hp : p ∈ discBd Δ) (hLΔ : L ∩ Δ ⊆ {p}) (hb : b ∉ Δ) (hZ : IsClosed Z) (hbZ : b ∈ Z) + (hLZ : L ∩ Z ⊆ {b}) (hoff : Disjoint (Δ ∪ L) (bd T)) : + ∃ Δ₁, IsClosedDisc Δ₁ ∧ Δ ⊆ Δ₁ ∧ b ∈ discBd Δ₁ ∧ discBd Δ ∩ Z ⊆ discBd Δ₁ ∧ discBd Δ₁ ∩ Z ⊆ + (discBd Δ ∩ Z) ∪ {b} ∧ Disjoint Δ₁ (bd T) := by + classical + have : T2Space T := hT.2.1 + have hT₀ : IsSurface T₀ := isSurface_of_homeo e hT + have : T2Space T₀ := hT₀.2.1 + have hbdT : ∀ x, e x ∈ bd T₀ ↔ x ∈ bd T := fun x => not_congr (isInteriorPoint_homeomorph_iff e x) + obtain ⟨hΔ₀, hb₀⟩ := isClosedDisc_image hΔ e.continuous.continuousOn e.injective.injOn + have hmem : ∀ {x : T} {A : Set T}, e x ∈ e '' A ↔ x ∈ A := fun {x A} => e.injective.mem_set_image + have hline : IsLineWithEnds (e '' L) (e p) (e b) := image_line e.isEmbedding hL + obtain ⟨Δ₁, h1, h2, h3, h4, h5, h6, -⟩ := exists_finger hT₀ (Δ := e '' Δ) (L := e '' L) (Z + := e '' Z) + hΔ₀ hline (e.injective.ne hpb) (by rw [hb₀]; exact mem_image_of_mem e hp) + (by + rintro _ ⟨⟨x, hx, rfl⟩, hy⟩ + have := hLΔ ⟨hx, hmem.mp hy⟩ + rw [show x = p from this] + rfl) (fun h => hb (hmem.mp h)) (e.isClosedMap _ hZ) (mem_image_of_mem e hbZ) + (by + rintro _ ⟨⟨x, hx, rfl⟩, hy⟩ + have := hLZ ⟨hx, hmem.mp hy⟩ + rw [show x = b from this] + rfl) + (by + rw [disjoint_left] + rintro _ (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩) hy + · exact disjoint_left.mp hoff (.inl hx) ((hbdT x).mp hy) + · exact disjoint_left.mp hoff (.inr hx) ((hbdT x).mp hy)) + have hsym : Function.LeftInverse e.symm e := e.left_inv + obtain ⟨hD, hDb⟩ := isClosedDisc_image h1 e.symm.continuous.continuousOn e.symm.injective.injOn + have hee : ∀ {A : Set T₀} {x : T}, x ∈ e.symm '' A ↔ e x ∈ A := fun {A x} => by + constructor + · rintro ⟨y, hy, rfl⟩ + simpa using hy + · intro h + exact ⟨e x, h, by simp⟩ + refine ⟨e.symm '' Δ₁, hD, fun x hx => hee.mpr (h2 (mem_image_of_mem e hx)), ?_, ?_, ?_, ?_⟩ + · rw [hDb] + exact hee.mpr h3 + · rintro x ⟨hx, hxZ⟩ + rw [hDb] + refine hee.mpr (h4 ⟨?_, mem_image_of_mem e hxZ⟩) + rw [hb₀] + exact mem_image_of_mem e hx + · rintro x ⟨hx, hxZ⟩ + rw [hDb] at hx + rcases h5 ⟨hee.mp hx, mem_image_of_mem e hxZ⟩ with ⟨h7, -⟩ | h7 + · rw [hb₀] at h7 + exact .inl ⟨hmem.mp h7, hxZ⟩ + · exact .inr (e.injective h7) + · rw [disjoint_left] + intro x hx hxb + exact disjoint_left.mp h6 (hee.mp hx) ((hbdT x).mpr hxb) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffForest.lean b/LeanPool/GraphMinor/GM07/CuffForest.lean new file mode 100644 index 0000000000..8d4250ddde --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffForest.lean @@ -0,0 +1,655 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffArcWalk +public import LeanPool.GraphMinor.GM11.Separate +public import LeanPool.GraphMinor.GM11.OArcCircuit +public import LeanPool.GraphMinor.GM11.EvenCircuit +public import LeanPool.GraphMinor.GM11.Section4 +public import LeanPool.GraphMinor.GM07.Matched + +/-! +# From `H'` back to `H`, in (6.1) + +Graph Minors VII, (6.1), page 238: "By our inductive hypothesis $H'$ is $G'$-feasible, and so $H$ is +$G$-feasible as required." + +The paper moves `H` by a homotopy, so that it runs through `a₁` and `a₂`, and then restricts it to +`Σ'`. We do not move `H`. Instead we add the new vertices to `H` as isolated vertices, and we pull +back along the shift `h` of the +collar. The forest found by induction, carried by `h`, together with the path of `G` from `C` to +`a₁`, is a subdrawing of `G`. The square of the homotopy `Φ` gives the homotopy of curves. It is a +fill-in of the sentence of the paper, with the same forest. + +Two facts make this short. A forest contains no `O`-arc, so its point set is flat, and so two curves +in it with the same ends are homotopic. A walk of the new forest projects to a walk of the old one, +by contracting the path. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A forest contains no `O`-arc. -/ +theorem noOArc_of_forest [T2Space S] [ConnectedSpace S] {H : Drawing S} + (hf : IsGraphForest H.toGraph) {X : Set S} (hX : IsOArc X) (hs : X ⊆ H.U) : False := by + obtain ⟨C, ⟨u, W, hW, hpos, -, -⟩, hsub, -⟩ := exists_circuit_of_oArc hX hs + obtain ⟨W', hsup, hed⟩ := hsub.exists_walk_up W + have h1 : W'.IsSimpleClosed := by + unfold GraphWalk.IsSimpleClosed + rw [hsup, hed] + exact hW + have h2 := hf u W' h1 + have h3 : W'.length = W.length := by + unfold GraphWalk.length + rw [hed] + omega + +/-- The point set of a forest is flat. -/ +theorem isFlat_U_of_forest (hS : IsSurface S) [ConnectedSpace S] {H : Drawing S} + (hf : IsGraphForest H.toGraph) : IsFlat H.U := by + have : T2Space S := hS.2.1 + exact isFlat_of_forall_isNullHomotopicOArc hS fun F hFZ hF => (noOArc_of_forest hf hF hFZ).elim + +/-- A drawing whose point set has no `O`-arc is a forest. -/ +theorem isForest_of_noOArc [T2Space S] {H : Drawing S} (h : ∀ F, IsOArc F → F ⊆ H.U + → False) : IsGraphForest H.toGraph := by + intro u W hW + by_contra hne + have hC := isCircuit_walkDrawing H hW (Nat.pos_of_ne_zero hne) + exact h _ (IsCircuit.isOArc_U hC) (walkDrawing_isSubdrawing H W).U_subset + +/-- An `O`-arc has two points. -/ +theorem IsOArc.exists_ne {X : Set S} (hX : IsOArc X) (x : S) : ∃ y ∈ X, y ≠ x := by + obtain ⟨φ⟩ := id hX + by_contra hall + push Not at hall + have h3 : (φ 1).1 = (φ (Circle.exp Real.pi)).1 := by + rw [hall _ (φ 1).2, hall _ (φ _).2] + have h4 : (1 : Circle) = Circle.exp Real.pi := φ.injective (Subtype.ext h3) + have h5 : ((1 : Circle) : ℂ) = (Circle.exp Real.pi : ℂ) := congrArg _ h4 + rw [Circle.coe_exp, Complex.exp_pi_mul_I, Circle.coe_one] at h5 + norm_num at h5 + +/-- The union of two subdrawings. -/ +theorem exists_union_drawing [T1Space S] {G A B : Drawing S} (hA : A.IsSubdrawing G) + (hB : B.IsSubdrawing G) : ∃ D : Drawing S, D.IsSubdrawing G ∧ D.V = A.V ∪ B.V ∧ D.E = A.E ∪ B.E + ∧ D.U = A.U ∪ B.U := by + have hE : (G.span (A.V ∪ B.V) (A.E ∪ B.E)).E = A.E ∪ B.E := by + rw [G.span_E] + exact inter_eq_left.mpr (union_subset hA.2 hB.2) + have hV : (G.span (A.V ∪ B.V) (A.E ∪ B.E)).V = A.V ∪ B.V := by + rw [G.span_V] + apply subset_antisymm + · rintro x (hx | hx) + · exact hx.1 + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + rcases he.1 with h | h + · rw [← hA.closure_inter_V h] at hxe + exact .inl hxe.2 + · rw [← hB.closure_inter_V h] at hxe + exact .inr hxe.2 + · rintro x (hx | hx) + · exact .inl ⟨.inl hx, hA.1 hx⟩ + · exact .inl ⟨.inr hx, hB.1 hx⟩ + refine ⟨_, Drawing.span_isSubdrawing G _ _, hV, hE, ?_⟩ + rw [Drawing.U_eq, hV, hE, A.U_eq, B.U_eq, biUnion_union] + ext x + simp only [mem_union] + tauto + +theorem mem_V_of_subdrawing {F G : Drawing S} (h : F.IsSubdrawing G) {x : S} (hx : x ∈ F.U) + (hV : x ∈ G.V) : x ∈ F.V := by + by_contra hn + obtain ⟨e, he, hxe⟩ := F.exists_edge_of_mem hx hn + exact (h.2 he).2.1 hxe |>.2 hV + +/-- The vertices of a walk are its start and points of its edges. -/ +theorem walk_support_mem {H : Drawing S} {u v : S} (W : GraphWalk H.toGraph u v) : ∀ x ∈ W.support, + x = u ∨ ∃ e ∈ W.edges, x ∈ closure e := by + induction W with + | nil _ => + intro x hx + simp only [GraphWalk.support, List.mem_singleton] at hx + exact .inl hx + | @cons a b c e hl rest ih => + intro x hx + rcases List.mem_cons.mp hx with rfl | hx + · exact .inl rfl + · rcases ih x hx with rfl | ⟨f, hf, hxf⟩ + · have h1 : x ∈ closure e ∩ H.V := by + rw [hl.2.2.2] + exact mem_insert_of_mem _ rfl + exact .inr ⟨e, List.mem_cons_self, h1.1⟩ + · exact .inr ⟨f, List.mem_cons_of_mem _ hf, hxf⟩ + +/-- **The square of a homotopy.** If `ψ` maps the unit square to `Σ`, then the bottom side is +homotopic to the left side, then the top side, then the right side backwards. -/ +theorem homotopic_square (ψ : C(unitInterval × unitInterval, S)) : ∀ {a b a' b' : S} (_ : a = ψ + (0, 0)) (_ : b = ψ (1, 0)) (_ : a' = ψ (0, 1)) (_ : b' = ψ (1, 1)) (p : Path a b) (l : Path a a') + (m : Path a' b') (r : Path b b'), + (∀ t, p t = ψ (t, 0)) → (∀ t, l t = ψ (0, t)) → (∀ t, m t = ψ (t, 1)) → (∀ t, r t = ψ (1, t)) + → p.Homotopic (l.trans (m.trans r.symm)) := by + rintro _ _ _ _ rfl rfl rfl rfl p l m r hp hl hm hr + let u : Path (0 : unitInterval) 1 := ⟨ContinuousMap.id _, rfl, rfl⟩ + let bottom : Path ((0, 0) : unitInterval × unitInterval) (1, 0) := u.prod (Path.refl 0) + let top : Path ((0, 1) : unitInterval × unitInterval) (1, 1) := u.prod (Path.refl 1) + let left : Path ((0, 0) : unitInterval × unitInterval) (0, 1) := (Path.refl 0).prod u + let right : Path ((1, 0) : unitInterval × unitInterval) (1, 1) := (Path.refl 1).prod u + have : SimplyConnectedSpace (unitInterval × unitInterval) := by + have : ContractibleSpace unitInterval := + (convex_Icc (0 : ℝ) 1).contractibleSpace ⟨0, by simp⟩ + infer_instance + have h := (SimplyConnectedSpace.paths_homotopic bottom (left.trans (top.trans right.symm))).map ψ + simp only [Path.map_trans] at h + have e1 : bottom.map ψ.continuous = p := by + ext t + exact (hp t).symm + have e2 : left.map ψ.continuous = l := by + ext t + exact (hl t).symm + have e3 : top.map ψ.continuous = m := by + ext t + exact (hm t).symm + have e4 : right.map ψ.continuous = r := by + ext t + exact (hr t).symm + have e5 : right.symm.map ψ.continuous = r.symm := by + rw [← Path.map_symm, e4] + rwa [e1, e2, e3, e5] at h + +/-- A homotopy of paths is a homotopy of curves. -/ +theorem curvesHomotopic_of_homotopic {a b : S} {p q : Path a b} (h : p.Homotopic q) (φ ψ : Curve S) + (hφ : ∀ t, φ t = p t) (hψ : ∀ t, ψ t = q t) : CurvesHomotopic φ ψ := by + obtain ⟨F⟩ := h + refine ⟨F.toContinuousMap.comp ⟨Prod.swap, continuous_swap⟩, fun _ => mem_univ _, ?_, ?_, ?_, + ?_, ?_, ?_⟩ + · intro x + simp [hφ] + · intro x + simp [hψ] + · intro y + simp [hφ] + · intro y + simp [hψ] + · intro y + simp [hφ] + · intro y + simp [hψ] + +private theorem union_with_attached_path_is_forest + {S : Type u} + [TopologicalSpace S] + [T1Space S] + [ConnectedSpace S] + {h : S → S} + {G : Drawing S} + {x₀ : S} + {x₁ : S} + [T2Space S] + (W : GraphWalk G.toGraph x₁ (h x₀)) + (hLO : ∀ (X : Set S), IsOArc X → ¬X ⊆ (walkDrawing G W).U) + (F₀ : Drawing S) + (F : Drawing S) + (hFU : F.U = F₀.U ∪ (walkDrawing G W).U) + (hF₀F : F₀.IsSubdrawing F) + (ha₁ : h x₀ ∈ F₀.V) + (hmeet : (walkDrawing G W).U ∩ F₀.U ⊆ {h x₀}) + (ha₁L : h x₀ ∈ (walkDrawing G W).U) + (hF₀f : IsGraphForest F₀.toGraph) : + IsGraphForest F.toGraph := by + refine isForest_of_noOArc (H := F) fun X hX hsub => ?_ + have hpre : IsPreconnected (X \ {h x₀}) := by + by_cases hm' : h x₀ ∈ X + · obtain ⟨Cc, hCc, hCF, hCU⟩ := exists_circuit_of_oArc hX hsub + rw [← hCU] + exact isPreconnected_U_diff hCc (mem_V_of_subdrawing hCF (hCU ▸ hm') (hF₀F.1 ha₁)) + · rw [sdiff_singleton_eq_self hm'] + exact (isConnected_of_isOArc hX).isPreconnected + have hcov : X \ {h x₀} ⊆ F₀.U ∪ (walkDrawing G W).U := fun z hz => hFU ▸ hsub hz.1 + by_cases hb : (X \ {h x₀} ∩ F₀.U).Nonempty ∧ (X \ {h x₀} ∩ (walkDrawing G W).U).Nonempty + · obtain ⟨z, hz, hzA, hzB⟩ := isPreconnected_closed_iff.mp hpre _ _ F₀.isClosed_U + (walkDrawing G W).isClosed_U hcov hb.1 hb.2 + exact hz.2 (hmeet ⟨hzB, hzA⟩) + · have hF₀a : h x₀ ∈ F₀.U := F₀.V_subset_U ha₁ + by_cases h1 : (X \ {h x₀} ∩ F₀.U).Nonempty + · have h2 : X \ {h x₀} ∩ (walkDrawing G W).U = ∅ := not_nonempty_iff_eq_empty.mp fun h3 + => hb ⟨h1, h3⟩ + refine noOArc_of_forest hF₀f hX fun z hz => ?_ + by_cases hza : z = h x₀ + · exact hza ▸ hF₀a + · rcases hcov ⟨hz, hza⟩ with h3 | h3 + · exact h3 + · exact absurd ⟨⟨hz, hza⟩, h3⟩ (eq_empty_iff_forall_notMem.mp h2 z) + · refine hLO X hX fun z hz => ?_ + by_cases hza : z = h x₀ + · exact hza ▸ ha₁L + · rcases hcov ⟨hz, hza⟩ with h3 | h3 + · exact absurd ⟨z, ⟨hz, hza⟩, h3⟩ h1 + · exact h3 + +private theorem walk_steps_lift_to_shifted_forest + {S : Type u} + [TopologicalSpace S] + [T1Space S] + {h : S → S} + {G : Drawing S} + {x₀ : S} + {x₁ : S} + (H₂ : Drawing S) + (W : GraphWalk G.toGraph x₁ (h x₀)) + (F₀ : Drawing S) + (F : Drawing S) + (hFE : F.E = F₀.E ∪ (walkDrawing G W).E) + (hF₀F : F₀.IsSubdrawing F) + (hLF : (walkDrawing G W).IsSubdrawing F) + (hx₀H₂ : x₀ ∈ H₂.V) + (ψ : S → S) + (hψc : IsCarry F₀ H₂ ψ F₀.V) + (π : S → S) + (hπW : ∀ v ∈ W.support, π v = x₀) + (hπ₀ : ∀ v ∈ F₀.V, π v = ψ v) : + ∀ (e : Set S) (x y : S), F.toGraph.IsLink e x y → ∃ _ : GraphWalk H₂.toGraph (π x) (π y), True + := by + intro e x y hl + have hmem : x ∈ closure e ∩ F.V ∧ y ∈ closure e ∩ F.V := by + have h2 := hl.2.2.2 + exact ⟨h2 ▸ mem_insert _ _, h2 ▸ mem_insert_of_mem _ rfl⟩ + rcases hFE ▸ hl.1 with he | he + · have hclU : closure e ⊆ F₀.U := F₀.closure_subset_U he + have hx : x ∈ F₀.V := mem_V_of_subdrawing hF₀F (hclU hmem.1.1) hmem.1.2 + have hy : y ∈ F₀.V := mem_V_of_subdrawing hF₀F (hclU hmem.2.1) hmem.2.2 + have hl₀ : F₀.toGraph.IsLink e x y := (hF₀F.isLink_iff he).mpr hl + obtain ⟨R, -⟩ := hψc.walk (.cons hl₀ (.nil hy)) hx (ψ x) (ψ y) rfl rfl + rw [hπ₀ x hx, hπ₀ y hy] + exact ⟨R, trivial⟩ + · have hlL := (hLF.isLink_iff he).mpr hl + have hxs : x ∈ W.support := by + have := hlL.2.1 + rwa [walkDrawing_V] at this + have hys : y ∈ W.support := by + have := hlL.2.2.1 + rwa [walkDrawing_V] at this + rw [hπW x hxs, hπW y hys] + exact ⟨.nil hx₀H₂, trivial⟩ + +private theorem conclude_shifted_forest_feasible + {S : Type u} + [TopologicalSpace S] + [T1Space S] + (hS : IsSurface S) + [ConnectedSpace S] + {C : Set S} + {h : S → S} + {Φ : ↑unitInterval × S → S} + (hs : IsCuffShift C h Φ) + {G : Drawing S} + {G' : Drawing S} + {H : Drawing S} + (hH : IsSurfaceForest H) + {x₀ : S} + {x₁ : S} + (hx₀V : x₀ ∈ G'.V ∩ bd S) + (hHC : ∀ s ∈ H.V ∩ bd S, s ∈ C → s = x₀ ∧ x₁ = x₀) + [T2Space S] + [CompactSpace S] + (H₂ : Drawing S) + (β : S ≃ₜ S) + (hβ : ∀ x ∈ bd S, β x = x) + (W : GraphWalk G.toGraph x₁ (h x₀)) + (hLm : (walkDrawing G W).U ∩ h '' G'.U ⊆ {h x₀}) + (hLO : ∀ (X : Set S), IsOArc X → ¬X ⊆ (walkDrawing G W).U) + (hWb : ∀ v ∈ W.support, v ∈ bd S → v ∈ C) + (P : Path x₀ (h x₀)) + (Q : Path x₀ (h x₀)) + (hP : ∀ (t : ↑unitInterval), P t = Φ (t, x₀)) + (hPQ : P.Homotopic Q) + (hQ : x₀ ∈ H.V → ∀ (t : ↑unitInterval), Q t ∈ (walkDrawing G W).U) + (H' : Drawing S) + (hf₁ : IsGraphForest (mapDrawingHomeo β H').toGraph) + (hpaths : ∀ s ∈ (mapDrawingHomeo β H').V ∩ bd S, ∀ t ∈ (mapDrawingHomeo β H').V ∩ bd S, s ≠ t + → ((∃ P₁ : GraphWalk (mapDrawingHomeo β H').toGraph s t, P₁.IsSimple) ↔ + ∃ P₂ : GraphWalk H₂.toGraph s t, P₂.IsSimple) ∧ ∀ (P₁ : GraphWalk (mapDrawingHomeo β + H').toGraph s t) (P₂ : GraphWalk H₂.toGraph s t) (φ₁ φ₂ : Curve S), P₁.IsSimple → + P₂.IsSimple → CurveTracesWalk (mapDrawingHomeo β H') φ₁ P₁ → CurveTracesWalk H₂ φ₂ P₂ → + CurvesHomotopic φ₁ φ₂) + (hbdβ : ∀ {A : Set S} {x : S}, x ∈ bd S → (x ∈ ⇑β '' A ↔ x ∈ A)) + (hsub₁ : (mapDrawingHomeo β H).IsSubdrawing (mapDrawingHomeo β H')) + (hE₁ : (mapDrawingHomeo β H').E = (mapDrawingHomeo β H).E) + (F₀ : Drawing S) + (hF₀ : IsMatched H₂ F₀ h ∅) + (hF₀U : F₀.U = h '' H₂.U) + (F : Drawing S) + (hFG : F.IsSubdrawing G) + (hFV : F.V = F₀.V ∪ (walkDrawing G W).V) + (hFE : F.E = F₀.E ∪ (walkDrawing G W).E) + (hFU : F.U = F₀.U ∪ (walkDrawing G W).U) + (hF₀F : F₀.IsSubdrawing F) + (hLF : (walkDrawing G W).IsSubdrawing F) + (hx₀H₂ : x₀ ∈ H₂.V) + (ha₁ : h x₀ ∈ F₀.V) + (hmeet : (walkDrawing G W).U ∩ F₀.U ⊆ {h x₀}) + (ha₁L : h x₀ ∈ (walkDrawing G W).U) + (hFf : IsGraphForest F.toGraph) + (hFp : F.IsProper) + (π : S → S) + (hx₀U : x₀ ∈ H₂.U) + (hπW : ∀ v ∈ W.support, π v = x₀) + (hwalk : ∀ {u v : S}, GraphWalk F.toGraph u v → + ∃ _ : GraphWalk H₂.toGraph (π u) (π v), True) + (hsV : ∀ s ∈ H.V ∩ bd S, s ∈ H₂.V) + (hπs : ∀ s ∈ H.V ∩ bd S, π s = s) + (hWF : ∃ _ : GraphWalk F.toGraph x₁ (h x₀), True) + (hsF : ∀ s ∈ H.V ∩ bd S, ∃ _ : GraphWalk F.toGraph s (h s), True) + (hH₁V : ∀ s ∈ H.V ∩ bd S, s ∈ (mapDrawingHomeo β H).V) + (hH₁'V : ∀ s ∈ H.V ∩ bd S, s ∈ (mapDrawingHomeo β H').V ∩ bd S) + (hFVb : F.V ∩ bd S = H.V ∩ bd S) : + IsGFeasible G H := by + classical + have hreduce : ∀ s ∈ H.V ∩ bd S, ∀ t ∈ H.V ∩ bd S, ∀ _ : GraphWalk F.toGraph s t, ∃ P : GraphWalk + H₂.toGraph s t, P.IsSimple := by + intro s hs' t ht' R + obtain ⟨R₁, -⟩ := hwalk R + rw [hπs s hs', hπs t ht'] at R₁ + obtain ⟨P, hP', -, -⟩ := GM09.exists_isSimple_subwalk R₁ + exact ⟨P, hP'⟩ + have hdown : ∀ s ∈ H.V ∩ bd S, ∀ t, ∀ P : GraphWalk (mapDrawingHomeo β H').toGraph s t, + P.IsSimple → ∃ P₁ : GraphWalk (mapDrawingHomeo β H).toGraph s t, P₁.IsSimple := by + intro s hs' t P hP' + have hsupp : ∀ x ∈ P.support, x ∈ (mapDrawingHomeo β H).V := fun x hx => by + rcases walk_support_mem P x hx with rfl | ⟨e, he, hxe⟩ + · exact hH₁V _ hs' + · have hee : e ∈ (mapDrawingHomeo β H).E := hE₁ ▸ mem_E_of_mem_edges P he + exact mem_V_of_subdrawing hsub₁ ((mapDrawingHomeo β H).closure_subset_U hee hxe) + (P.mem_vertexSet_of_mem_support hx) + obtain ⟨P₁, h1, -⟩ := hsub₁.exists_walk_down P hsupp (fun e he => hE₁ ▸ mem_E_of_mem_edges P he) + refine ⟨P₁, ?_⟩ + unfold GraphWalk.IsSimple + rw [h1] + exact hP' + have hups : ∀ s ∈ H.V ∩ bd S, ∀ t ∈ H.V ∩ bd S, ∀ _ : GraphWalk H₂.toGraph s t, ∃ P : GraphWalk + F.toGraph s t, P.IsSimple := by + intro s hs' t ht' R + obtain ⟨R₁, -⟩ := hF₀.carry.walk R ⟨hsV s hs', by simp⟩ (h s) (h t) rfl rfl + obtain ⟨R₂, -, -⟩ := hF₀F.exists_walk_up R₁ + obtain ⟨A, -⟩ := hsF s hs' + obtain ⟨B', -⟩ := hsF t ht' + obtain ⟨P, hP', -, -⟩ := GM09.exists_isSimple_subwalk (A.append (R₂.append B'.reverse)) + exact ⟨P, hP'⟩ + -- the path that each boundary vertex follows, and a copy of it in `F` + have hlift : ∀ s ∈ H.V ∩ bd S, ∃ (l l' : Path s (h s)), (∀ t, l t = Φ (t, s)) ∧ (∀ t, l' t ∈ F.U) + ∧ l.Homotopic l' := by + intro s hs' + have hsFU : s ∈ F.U := F.V_subset_U (hFVb.symm ▸ hs' : s ∈ F.V ∩ bd S).1 + let l : Path s (h s) := ⟨⟨fun t => Φ (t, s), by + have := hs.contΦ + fun_prop⟩, by simp [hs.zero], by simp [hs.one]⟩ + have hl : ∀ t, l t = Φ (t, s) := fun _ => rfl + by_cases hsC : s ∈ C + · obtain ⟨h1, -⟩ := hHC s hs' hsC + subst h1 + have hlP : l = P := by + ext t + exact (hP t).symm + refine ⟨l, Q, hl, fun t => hFU ▸ .inr (hQ hs'.1 t), hlP ▸ hPQ⟩ + · have hconst : ∀ t, l t = s := fun t => (hs.fix s hs'.2 hsC).2 t + exact ⟨l, l, hl, fun t => by rw [hconst]; exact hsFU, Path.Homotopic.refl _⟩ + have hthe : ∀ s ∈ H.V ∩ bd S, s ∈ H₂.V ∩ bd S := fun s hs' => ⟨hsV s hs', hs'.2⟩ + have hV₃ : (mapDrawingHomeo β H).V ∩ bd S = H.V ∩ bd S := by + ext x + exact and_congr_left fun hx => hbdβ hx + refine ⟨F, ⟨hFp, hFf⟩, ⟨β, hβ, (hH.map_homeo β).1, hFp, (hH.map_homeo β).2, hFf, + hV₃.trans hFVb.symm, ?_⟩, hFG⟩ + intro s hs₁ t ht₁ hne + have hs' : s ∈ H.V ∩ bd S := hV₃ ▸ hs₁ + have ht' : t ∈ H.V ∩ bd S := hV₃ ▸ ht₁ + have hp := hpaths s (hH₁'V s hs') t (hH₁'V t ht') hne + refine ⟨⟨fun ⟨P₁, hP₁⟩ => ?_, fun ⟨P₂, _⟩ => ?_⟩, ?_⟩ + · obtain ⟨P', hP', -⟩ := hsub₁.exists_walk_up P₁ + have hsim : P'.IsSimple := by + unfold GraphWalk.IsSimple + rw [hP'] + exact hP₁ + obtain ⟨R, -⟩ := hp.1.mp ⟨P', hsim⟩ + exact hups s hs' t ht' R + · obtain ⟨R, hR⟩ := hreduce s hs' t ht' P₂ + obtain ⟨P', hP'⟩ := hp.1.mpr ⟨R, hR⟩ + exact hdown s hs' t P' hP' + · intro P₁ P₂ φ₁ φ₂ hP₁ hP₂ ht₁' ht₂ + obtain ⟨R, hR⟩ := hreduce s hs' t ht' P₂ + obtain ⟨P', hP'⟩ := hp.1.mpr ⟨R, hR⟩ + obtain ⟨φ', hφ'⟩ := exists_curveTracesWalk P' + obtain ⟨φ'', hφ''⟩ := exists_curveTracesWalk R + have ha := hp.2 P' R φ' φ'' hP' hR hφ' hφ'' + have hb : CurvesHomotopic φ₁ φ' := by + refine IsFlat.curvesHomotopic (isFlat_U_of_forest hS hf₁) ((CurveTracesWalk.range_subset P₁ + φ₁ ht₁').trans hsub₁.U_subset) (CurveTracesWalk.range_subset P' φ' hφ') ?_ ?_ + · rw [ht₁'.endpoints.1, hφ'.endpoints.1] + · rw [ht₁'.endpoints.2, hφ'.endpoints.2] + obtain ⟨e0, e1⟩ := hφ''.endpoints + let p : Path s t := (⟨φ'', rfl, rfl⟩ : Path (φ'' 0) (φ'' 1)).cast e0.symm e1.symm + have hpt : ∀ u, p u = φ'' u := fun _ => rfl + obtain ⟨l, l', hl, hl'F, hll⟩ := hlift s hs' + obtain ⟨r, r', hr, hr'F, hrr⟩ := hlift t ht' + let m : Path (h s) (h t) := p.map hs.cont + have hmt : ∀ u, m u = h (φ'' u) := fun _ => rfl + let ψq : C(unitInterval × unitInterval, S) := ⟨fun q => Φ (q.2, p q.1), by + have := hs.contΦ + fun_prop⟩ + have hsq := homotopic_square ψq (a := s) (b := t) (a' := h s) (b' := h t) + (by simp [ψq, hs.zero]) (by simp [ψq, hs.zero]) (by simp [ψq, hs.one]) + (by simp [ψq, hs.one]) p l m r + (fun u => (hs.zero _).symm) (fun u => by rw [hl]; simp [ψq]) + (fun u => (hs.one _).symm) (fun u => by rw [hr]; simp [ψq]) + have hcomp := hsq.trans (hll.hcomp (Path.Homotopic.hcomp (Path.Homotopic.refl m) hrr.symm₂)) + let κ : Curve S := (l'.trans (m.trans r'.symm)).toContinuousMap + have hc : CurvesHomotopic φ'' κ := curvesHomotopic_of_homotopic hcomp φ'' κ hpt (fun _ => rfl) + have hκr : range κ ⊆ F.U := by + change range (l'.trans (m.trans r'.symm)) ⊆ F.U + rw [Path.trans_range, Path.trans_range, Path.symm_range] + rintro x (⟨u, rfl⟩ | ⟨u, rfl⟩ | ⟨u, rfl⟩) + · exact hl'F u + · rw [hmt] + have h1 : φ'' u ∈ H₂.U := CurveTracesWalk.range_subset R φ'' hφ'' (mem_range_self u) + exact hF₀F.U_subset (hF₀U ▸ mem_image_of_mem h h1) + · exact hr'F u + have hd : CurvesHomotopic κ φ₂ := by + refine IsFlat.curvesHomotopic (isFlat_U_of_forest hS hFf) hκr (CurveTracesWalk.range_subset + P₂ φ₂ ht₂) ?_ ?_ + · rw [ht₂.endpoints.1] + exact (l'.trans (m.trans r'.symm)).source + · rw [ht₂.endpoints.2] + exact (l'.trans (m.trans r'.symm)).target + exact CurvesHomotopic.trans hb (CurvesHomotopic.trans ha (CurvesHomotopic.trans hc hd)) + +/-- **From the feasibility of `H'` to that of `H`.** Let `h` be a shift of the cuff `C`, and let +`G'` be the graph that `h` carries into `G`. Let `H'` be `H` with isolated vertices added, on the +vertices of `G'` on the boundary. A walk `W` of `G` runs from `x₁` to `a₁ = h x₀`, and it meets +the image of `G'` only at `a₁`. If `H` has a vertex on `C`, then it is `x₀`, the walk starts there, +and the path `Q` along the walk is homotopic to the path traced by `x₀`. Then a forest for `H'` in +`G'` gives a forest for `H` in `G`. -/ +theorem isGFeasible_of_shift [T1Space S] (hS : IsSurface S) [ConnectedSpace S] {C : Set S} {h : S + → S} {Φ : unitInterval × S → S} (hs : IsCuffShift C h Φ) {G G' G₁ H : Drawing S} + (hG : G.IsProper) (hH : IsSurfaceForest H) (hVb : G.V ∩ bd S = H.V ∩ bd S) + (hm : IsMatched G' G₁ h ∅) (hG₁ : G₁.IsSubdrawing G) {B : Set S} {hf : B.Finite} {hB : Disjoint + B H.U} (hVb' : (addIsolated H B hf hB).V ∩ bd S = G'.V ∩ bd S) + {x₀ a₁ x₁ : S} (hx₀ : h x₀ = a₁) (hx₀V : x₀ ∈ G'.V ∩ bd S) (W : GraphWalk G.toGraph x₁ a₁) + (hLm : (walkDrawing G W).U ∩ h '' G'.U ⊆ {a₁}) (hLO : ∀ X, IsOArc X → ¬ X ⊆ + (walkDrawing G W).U) + (hWb : ∀ v ∈ W.support, v ∈ bd S → v ∈ C) (hHC : ∀ s ∈ H.V ∩ bd S, s ∈ C → s = x₀ ∧ x₁ = x₀) + (P Q : Path x₀ a₁) (hP : ∀ t, P t = Φ (t, x₀)) (hPQ : P.Homotopic Q) (hQ : x₀ ∈ H.V + → ∀ t, Q t ∈ (walkDrawing G W).U) + (hfe : IsGFeasible G' (addIsolated H B hf hB)) : IsGFeasible G H := by + classical + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have hcl := hs.isClosedEmbedding + obtain ⟨H₂, ⟨hH₂p, hH₂f⟩, ⟨β, hβ, hhom⟩, hH₂G⟩ := hfe + have : Nonempty S := ⟨x₀⟩ + subst hx₀ + have hI : (addIsolated H B hf hB).E = H.E := by + change arcComponentsIn ((H.U ∪ B) \ (H.V ∪ B)) = arcComponentsIn (H.U \ H.V) + congr 1 + ext x + simp only [mem_sdiff, mem_union, not_or] + constructor + · rintro ⟨h1 | h1, h2, h3⟩ + · exact ⟨h1, h2⟩ + · exact absurd h1 h3 + · rintro ⟨h1, h2⟩ + exact ⟨.inl h1, h2, fun h3 => disjoint_left.mp hB h3 h1⟩ + set H' := addIsolated H B hf hB with hH' + have hH'V : H'.V = H.V ∪ B := rfl + have hH'U : H'.U = H.U ∪ B := rfl + obtain ⟨hp₁, hp₂, hf₁, hf₂, hV₂, hpaths⟩ := hhom + have hbdβ : ∀ {A : Set S} {x : S}, x ∈ bd S → (x ∈ β '' A ↔ x ∈ A) := fun {A x} hx => by + constructor + · rintro ⟨y, hy, he⟩ + have : β y = β x := he.trans (hβ x hx).symm + rwa [← β.injective this] + · intro h + exact ⟨x, h, hβ x hx⟩ + have hH₂V : ∀ {x : S}, x ∈ bd S → (x ∈ H₂.V ↔ x ∈ H'.V) := fun {x} hx => by + have h1 : x ∈ (mapDrawingHomeo β H').V ∩ bd S ↔ x ∈ H₂.V ∩ bd S := by rw [hV₂] + constructor + · intro h + exact (hbdβ hx).mp (h1.mpr ⟨h, hx⟩).1 + · intro h + exact (h1.mp ⟨(hbdβ hx).mpr h, hx⟩).1 + have hsub₁ : (mapDrawingHomeo β H).IsSubdrawing (mapDrawingHomeo β H') := by + refine ⟨image_mono subset_union_left, ?_⟩ + rw [mapDrawingHomeo_E, mapDrawingHomeo_E, hI] + have hE₁ : (mapDrawingHomeo β H').E = (mapDrawingHomeo β H).E := by + rw [mapDrawingHomeo_E, mapDrawingHomeo_E, hI] + obtain ⟨F₀, hF₀⟩ := exists_image_matched hcl H₂ + have hF₀V : F₀.V = h '' H₂.V := by + rw [← hF₀.image_V, sdiff_empty] + have hF₀U : F₀.U = h '' H₂.U := by + rw [← hF₀.image_U, sdiff_empty] + have hF₀G : F₀.IsSubdrawing G := by + refine ⟨?_, ?_⟩ + · rw [hF₀V] + rintro _ ⟨x, hx, rfl⟩ + refine hG₁.1 ?_ + rw [← hm.image_V, sdiff_empty] + exact mem_image_of_mem h (hH₂G.1 hx) + · rw [hF₀.image_E] + rintro _ ⟨e, he, rfl⟩ + refine hG₁.2 ?_ + rw [hm.image_E] + exact mem_image_of_mem _ (hH₂G.2 he) + obtain ⟨F, hFG, hFV, hFE, hFU⟩ := exists_union_drawing hF₀G (walkDrawing_isSubdrawing G W) + have hF₀F : F₀.IsSubdrawing F := ⟨hFV ▸ subset_union_left, hFE ▸ subset_union_left⟩ + have hLF : (walkDrawing G W).IsSubdrawing F := ⟨hFV ▸ subset_union_right, hFE ▸ + subset_union_right⟩ + have hx₀H₂ : x₀ ∈ H₂.V := (hH₂V hx₀V.2).mpr (by + have : x₀ ∈ H'.V ∩ bd S := hVb' ▸ hx₀V + exact this.1) + have ha₁ : h x₀ ∈ F₀.V := hF₀V ▸ mem_image_of_mem h hx₀H₂ + have hmeet : (walkDrawing G W).U ∩ F₀.U ⊆ {h x₀} := fun x hx => hLm ⟨hx.1, by + rw [hF₀U] at hx + exact image_mono hH₂G.U_subset hx.2⟩ + have ha₁L : h x₀ ∈ (walkDrawing G W).U := (mem_walkDrawing_U G W).mpr (.inl W.end_mem_support) + have hF₀f : IsGraphForest F₀.toGraph := hF₀.isGraphForest_iff.mp hH₂f + have hFf : IsGraphForest F.toGraph := by + exact union_with_attached_path_is_forest (S := S) (h := h) (G := G) (x₀ := x₀) (x₁ := x₁) W + hLO F₀ F hFU hF₀F ha₁ hmeet ha₁L hF₀f + have hFp : F.IsProper := fun x hx => mem_V_of_subdrawing hFG hx.2 (hG ⟨hx.1, hFG.U_subset hx.2⟩) + obtain ⟨ψ, hψl, hψr, hψc⟩ := hF₀.exists_inverse + let π : S → S := fun v => if v ∈ W.support then x₀ else ψ v + have hx₀U : x₀ ∈ H₂.U := H₂.V_subset_U hx₀H₂ + have hπW : ∀ v ∈ W.support, π v = x₀ := fun v hv => ite_eq_left hv + have hπ₀ : ∀ v ∈ F₀.V, π v = ψ v := fun v hv => by + by_cases hvs : v ∈ W.support + · have h1 : v = h x₀ := hmeet ⟨(mem_walkDrawing_U G W).mpr (.inl hvs), F₀.V_subset_U hv⟩ + simp only [π, ite_eq_left hvs] + rw [h1, hψl x₀ hx₀U] + · simp only [π, ite_eq_right hvs] + have hstep : ∀ e x y, F.toGraph.IsLink e x y → ∃ _ : GraphWalk H₂.toGraph (π x) (π y), True := by + exact walk_steps_lift_to_shifted_forest (S := S) (h := h) (G := G) (x₀ := x₀) (x₁ := x₁) H₂ W + F₀ F hFE hF₀F hLF hx₀H₂ ψ hψc π hπW hπ₀ + have hwalk : ∀ {u v : S} (_ : GraphWalk F.toGraph u v), ∃ _ : GraphWalk H₂.toGraph (π u) + (π v), True := by + intro u v R + induction R with + | @nil v hv => + by_cases hvs : v ∈ W.support + · rw [hπW v hvs] + exact ⟨.nil hx₀H₂, trivial⟩ + · have hv' : v ∈ F.V := hv + rw [hFV] at hv' + rcases hv' with h1 | h1 + · rw [hπ₀ v h1] + exact ⟨.nil (hψc.mem v h1).2, trivial⟩ + · rw [walkDrawing_V] at h1 + exact absurd h1 hvs + | cons hl _ ih => + obtain ⟨R₁, -⟩ := hstep _ _ _ hl + obtain ⟨R₂, -⟩ := ih + exact ⟨R₁.append R₂, trivial⟩ + have hsV : ∀ s ∈ H.V ∩ bd S, s ∈ H₂.V := fun s hs' => (hH₂V hs'.2).mpr (.inl hs'.1) + have hπs : ∀ s ∈ H.V ∩ bd S, π s = s := fun s hs' => by + by_cases hsC : s ∈ C + · obtain ⟨h1, h2⟩ := hHC s hs' hsC + have : s ∈ W.support := by + rw [h1.trans h2.symm] + exact W.start_mem_support + rw [hπW s this] + exact h1.symm + · have h1 : s ∉ W.support := fun hsw => hsC (hWb s hsw hs'.2) + simp only [π, ite_eq_right h1] + have h2 := hψl s (H₂.V_subset_U (hsV s hs')) + rwa [(hs.fix s hs'.2 hsC).1] at h2 + have hWF : ∃ W' : GraphWalk F.toGraph x₁ (h x₀), True := by + obtain ⟨W₁, -, -⟩ := (walkDrawing_isSubdrawing G W).exists_walk_down W (by + rw [walkDrawing_V] + exact fun x hx => hx) (by + rw [walkDrawing_E] + exact fun e he => he) + obtain ⟨W₂, -, -⟩ := hLF.exists_walk_up W₁ + exact ⟨W₂, trivial⟩ + have hsF : ∀ s ∈ H.V ∩ bd S, ∃ _ : GraphWalk F.toGraph s (h s), True := fun s hs' => by + by_cases hsC : s ∈ C + · obtain ⟨h1, h2⟩ := hHC s hs' hsC + obtain ⟨W₂, -⟩ := hWF + have e2 : h s = h x₀ := by rw [h1] + rw [e2, h1.trans h2.symm] + exact ⟨W₂, trivial⟩ + · rw [(hs.fix s hs'.2 hsC).1] + refine ⟨.nil (hF₀F.1 ?_), trivial⟩ + have := mem_image_of_mem h (hsV s hs') + rw [(hs.fix s hs'.2 hsC).1, ← hF₀V] at this + exact this + have hH₁V : ∀ s ∈ H.V ∩ bd S, s ∈ (mapDrawingHomeo β H).V := fun s hs' => (hbdβ hs'.2).mpr hs'.1 + have hH₁'V : ∀ s ∈ H.V ∩ bd S, s ∈ (mapDrawingHomeo β H').V ∩ bd S := fun s hs' => ⟨hsub₁.1 + (hH₁V s hs'), hs'.2⟩ + have hFVb : F.V ∩ bd S = H.V ∩ bd S := by + apply subset_antisymm + · rintro x ⟨hx, hb⟩ + have : x ∈ G.V ∩ bd S := ⟨hFG.1 hx, hb⟩ + rwa [hVb] at this + · intro s hs' + refine ⟨?_, hs'.2⟩ + obtain ⟨R, -⟩ := hsF s hs' + exact R.mem_vertexSet_of_mem_support R.start_mem_support + have shift_feasible_forest : IsGFeasible G H := by + exact conclude_shifted_forest_feasible (S := S) hS (C := C) (h := h) (Φ := Φ) hs (G := G) (G' + := G') (H := H) hH (x₀ := x₀) (x₁ := x₁) hx₀V hHC H₂ β hβ W hLm hLO hWb P Q hP hPQ hQ H' hf₁ + hpaths hbdβ hsub₁ hE₁ F₀ hF₀ hF₀U F hFG hFV hFE hFU hF₀F hLF hx₀H₂ ha₁ hmeet ha₁L hFf hFp + π hx₀U hπW hwalk hsV hπs hWF hsF hH₁V hH₁'V hFVb + exact shift_feasible_forest + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffFrame.lean b/LeanPool/GraphMinor/GM07/CuffFrame.lean new file mode 100644 index 0000000000..3c98836330 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffFrame.lean @@ -0,0 +1,325 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffNest +import LeanPool.GraphMinor.Surface.Circle + +/-! +# Parallel copies of the circuits, and the grid of page 234 + +Graph Minors VII, (5.9), page 234. A circuit of `G` that bounds a disc has a parallel copy `H(C)`, +just outside it, which is a `G`-normal `O`-arc with the same vertices. +We apply the grid theorem (5.8) to the part of the surface between the parallel copies of two +circuits of the nest. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] + +/-- An `O`-arc is infinite. -/ +theorem isOArc_infinite_any {Y : Type*} [TopologicalSpace Y] {F : Set Y} + (hF : IsOArc F) : F.Infinite := + hF.infinite + +/-- The closure of an edge adds only vertices. -/ +theorem closure_edge_subset_union [T2Space S] (H : Drawing S) {e : Set S} + (he : e ∈ H.E) : closure e ⊆ e ∪ H.V := fun x hx => by + obtain ⟨γ, hγc, h0, h1, -, himg⟩ := exists_edge_param H he + have hc : closure e ⊆ range γ := by + refine closure_minimal (fun y hy => ?_) (isCompact_range hγc).isClosed + rw [← himg] at hy + obtain ⟨t, -, rfl⟩ := hy + exact ⟨t, rfl⟩ + obtain ⟨t, rfl⟩ := hc hx + by_cases h3 : t ∈ Ioo (0 : unitInterval) 1 + · exact .inl (himg ▸ mem_image_of_mem _ h3) + · have : t = 0 ∨ t = 1 := by + by_contra hn + push Not at hn + exact h3 ⟨unitInterval.pos_iff_ne_zero.mpr hn.1, unitInterval.lt_one_iff_ne_one.mpr hn.2⟩ + rcases this with rfl | rfl + · exact .inr h0 + · exact .inr h1 + +/-- **The parallel copy of a circuit.** "Let $H(C)$ be a $G$-normal $O$-arc surrounding $C$, with +$V(G) \cap H(C) = V(N(C))$, such +that the points of $U(G)$ inside $H(C)$ are the points of $U(G)$ inside $U(N(C))$ together +with the points in the edges of $N(C)$" (page 235). -/ +theorem exists_parallel_disc [T2Space S] [T2Space T] {G c : Drawing S} + (hcG : c.IsSubdrawing G) {j : S → T} (hj : IsClosedEmbedding j) {B F : Set T} + (hB : IsClosedDisc B) (hF : IsClosedDisc F) (hBF : B ⊆ F \ discBd F) (hbd : discBd B + = j '' c.U) : + ∃ B', IsClosedDisc B' ∧ B ⊆ B' ∧ B' ⊆ F \ discBd F ∧ G.IsNormal (j ⁻¹' discBd B') + ∧ G.V ∩ j ⁻¹' discBd B' = c.V ∧ ∀ x ∈ G.U, j x ∈ B' → j x ∈ B := by + classical + let Z₀ : Set S := G.V ∪ ⋃ e ∈ {e ∈ G.E | e ∉ c.E}, closure e + have hZ₀ : IsClosed Z₀ := by + refine G.finite_V.isClosed.union ?_ + exact (G.finite_edges.subset (sep_subset _ _)).isClosed_biUnion fun _ _ => isClosed_closure + have hZ : IsClosed (j '' Z₀) := hj.isClosedMap _ hZ₀ + obtain ⟨B', h1, h2, h3, h4, h5, h6, h7⟩ := exists_disc_push_off hB hF hBF hZ + have hin : ∀ {x}, x ∈ G.V → j x ∈ j '' Z₀ := fun hx => mem_image_of_mem j (.inl hx) + have hedge : ∀ {x e}, x ∈ e → e ∈ G.E → e ∉ c.E → j x ∈ j '' Z₀ := fun {x e} hx he hc + => mem_image_of_mem j (.inr (mem_iUnion₂.mpr ⟨e, ⟨he, hc⟩, subset_closure hx⟩)) + have hoff : ∀ {x e}, j x ∈ j '' Z₀ → x ∉ G.V → e ∈ c.E → x ∈ e → False := fun {x e} hx hV he hxe + => by + obtain ⟨y, hy, hyx⟩ := hx + have hyx' := hj.injective hyx + subst hyx' + rcases hy with hy | hy + · exact hV hy + · obtain ⟨e', ⟨he', hc⟩, hy⟩ := mem_iUnion₂.mp hy + by_cases hy' : y ∈ e' + · exact hc (arcComponent_eq (hcG.2 he) he' hxe hy' ▸ he) + · exact hV ((closure_edge_subset_union G he' hy).resolve_left hy') + have hbU : ∀ {x}, j x ∈ discBd B → x ∈ c.U := fun {x} hx => by + rw [hbd] at hx + obtain ⟨y, hy, he⟩ := hx + exact hj.injective he ▸ hy + refine ⟨B', h1, h2, h3, ?_, ?_, ?_⟩ + · rintro x ⟨hx, hU⟩ + by_contra hV + obtain ⟨e, he, hxe⟩ := G.exists_edge_of_mem hU hV + by_cases hc : e ∈ c.E + · have hxc : x ∈ c.U := hc.2.1 hxe |>.1 + exact hoff (h5 ⟨hx, Surface.discBd_subset _ (hbd ▸ mem_image_of_mem j hxc)⟩) hV hc hxe + · have h8 := h7 ⟨hx, hedge hxe he hc⟩ + have hxc := hbU h8 + have hxV : x ∉ c.V := fun h => hV (hcG.1 h) + obtain ⟨e', he', hxe'⟩ := c.exists_edge_of_mem hxc hxV + exact hc (arcComponent_eq (hcG.2 he') he hxe' hxe ▸ he') + · refine subset_antisymm (fun x hx => ?_) fun x hx => ?_ + · exact mem_V_of_subdrawing hcG (hbU (h7 ⟨hx.2, hin hx.1⟩)) hx.1 + · have hxc := c.V_subset_U hx + exact ⟨hcG.1 hx, h6 ⟨hbd ▸ mem_image_of_mem j hxc, hin (hcG.1 hx)⟩⟩ + · intro x hU hx + by_contra hxB + by_cases hV : x ∈ G.V + · exact disjoint_left.mp h4 ⟨hx, hxB⟩ (hin hV) + · obtain ⟨e, he, hxe⟩ := G.exists_edge_of_mem hU hV + by_cases hc : e ∈ c.E + · exact hxB (Surface.discBd_subset _ (hbd ▸ mem_image_of_mem j (hc.2.1 hxe |>.1))) + · exact disjoint_left.mp h4 ⟨hx, hxB⟩ (hedge hxe he hc) + +/-- The nest of circuits `C_j` of page 234, for a cuff disc `E`, in a disc `Δ`. -/ +structure IsCuffNest (G : Drawing S) (j : S → T) (C : Set S) (E : Set T) (r : ℕ) (s : ℕ) (B : ℕ + → Drawing S) (Ds : ℕ → Set T) (Δ : Set T) : Prop where + circuit : ∀ t < s, (B t).IsCircuit + sub : ∀ t < s, (B t).IsSubdrawing G + offE : ∀ t < s, Disjoint (j ⁻¹' discInt E) (B t).U + disc : ∀ t < s, IsClosedDisc (Ds t) + bd_eq : ∀ t < s, discBd (Ds t) = j '' (B t).U + mem : ∀ t < s, E ⊆ Ds t + inΔ : ∀ t < s, Ds t ⊆ Δ + off : ∀ t < s, Disjoint (Ds t) (bd T) + reach : ∀ t < s, ∀ y ∈ (B t).V, ∃ X, IsScriptASet G r C X ∧ y ∈ X ∧ j ⁻¹' discBd E ⊆ X + disj : ∀ t t', t < t' → t' < s → Disjoint (B t).U (B t').U + nest : ∀ t t', t < t' → t' < s → Ds t ⊆ Ds t' + +/-- **The nest exists.** -/ +theorem exists_cuff_nest (hS : IsSurface S) [ConnectedSpace S] {a b c : ℕ} (hm : Nonempty + (S ≃ₜ SurfaceModel a b c)) (habc : 3 ≤ 3 * a + 3 * b + c) (hcyl : ¬ Nonempty + (S ≃ₜ SurfaceModel 0 0 2)) {C : Set S} (hC : C ∈ cuffs S) {j : S → T} {D : Set T} + (hc : IsCappedCuff C T j D) (hbT : bd T = j '' (bd S \ C)) {G : Drawing S} + (hG : G.IsProper) {ra n : ℕ} {E : Set T} + (hd : IsCuffDisc G j D ra E) (h₁ : ra + n < alpha G) (h₂ : ra + (ra + n) < alpha G) + (h₃ : ∀ C₁ ∈ cuffs S, C₁ ≠ C → ra + n + (G.V ∩ C₁).ncard < alpha G) {Δ : Set T} + (hΔ : IsClosedDisc Δ) (hEΔ : E ⊆ Δ) (hA : ∀ z ∈ scriptA G (ra + n) C, j z ∈ Δ) {s : ℕ} + (hs : s ≤ n) (hs0 : 0 < s) : + ∃ B Ds, IsCuffNest G j C E (ra + n) s B Ds Δ := by + classical + obtain ⟨W, tW, hWc, i, K, G₁, Γ, r₀, p, h⟩ := exists_layer_setup hS hm hC hc hbT hG hd h₁ h₂ h₃ + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have : T2Space T := hc.isSurface.2.1 + have : T2Space W := h.closedW.2.1 + obtain ⟨B, Ds, h1, h2⟩ := h.exists_nest hS habc hm hcyl hC hΔ hEΔ hA hs + let f : ℕ → Fin s := fun t => if ht : t < s then ⟨t, ht⟩ else ⟨0, hs0⟩ + have hf : ∀ t (ht : t < s), f t = ⟨t, ht⟩ := fun t ht => dite_eq_left ht + refine ⟨B ∘ f, Ds ∘ f, ⟨fun t ht => ?_, fun t ht => ?_, fun t ht => ?_, fun t ht => ?_, fun t ht + => ?_, fun t ht => ?_, fun t ht => ?_, fun t ht => ?_, fun t ht => ?_, fun t t' htt ht + => ?_, fun t t' htt ht => ?_⟩⟩ + · exact (h1 (f t)).1 + · have h3 := (h1 (f t)).2.1 + exact ⟨h3.1.trans h.sub.1, h3.2.trans h.sub.2⟩ + · rw [disjoint_left] + intro x hx hU + have h3 := (h1 (f t)).2.1.U_subset hU + rw [h.U] at h3 + exact h3.2 hx + · exact (h1 (f t)).2.2.1 + · exact (h1 (f t)).2.2.2.1 + · exact (h1 (f t)).2.2.2.2.1 + · exact (h1 (f t)).2.2.2.2.2.1 + · exact (h1 (f t)).2.2.2.2.2.2.1 + · exact (h1 (f t)).2.2.2.2.2.2.2 + · have hlt : f t < f t' := by + rw [hf t (htt.trans ht), hf t' ht] + exact htt + exact (h2 _ _ hlt).1 + · have hlt : f t < f t' := by + rw [hf t (htt.trans ht), hf t' ht] + exact htt + exact (h2 _ _ hlt).2 + +/-- The discs of the nest are strictly nested. -/ +theorem IsCuffNest.subset_diff {G : Drawing S} {j : S → T} {C : Set S} {E : Set T} {r s + : ℕ} {B : ℕ → Drawing S} {Ds : ℕ → Set T} {Δ : Set T} (h : IsCuffNest G j C E r s B Ds Δ) + (hman : ∀ x : T, IsManifoldPoint x) (hj : Injective j) {t t' : ℕ} (htt : t < t') (ht : t' < s) : + Ds t ⊆ Ds t' \ discBd (Ds t') := fun x hx => by + refine ⟨h.nest t t' htt ht hx, fun hb => ?_⟩ + by_cases h3 : x ∈ discBd (Ds t) + · rw [h.bd_eq t (htt.trans ht)] at h3 + rw [h.bd_eq t' ht] at hb + obtain ⟨y, hy, rfl⟩ := h3 + obtain ⟨y', hy', he⟩ := hb + exact disjoint_left.mp (h.disj t t' htt ht) hy (hj he ▸ hy') + · exact (discInt_mono hman (h.disc t (htt.trans ht)) (h.nest t t' htt ht) ⟨hx, h3⟩).2 hb + +/-- The discs of the nest are nested. -/ +theorem IsCuffNest.mono {G : Drawing S} {j : S → T} {C : Set S} {E : Set T} {r s : ℕ} {B : ℕ + → Drawing S} {Ds : ℕ → Set T} {Δ : Set T} (h : IsCuffNest G j C E r s B Ds Δ) {t t' : ℕ} (htt : t + ≤ t') (ht : t' < s) : Ds t ⊆ Ds t' := by + rcases htt.lt_or_eq with h1 | rfl + · exact h.nest t t' h1 ht + · exact Subset.refl _ + +/-- The grid of page 234: the paths `P_i` and the circuits `B_j(C)` between two discs. -/ +structure IsCuffGrid (G : Drawing S) (j : S → T) (D₁ Δ₂ : Set T) {r s : ℕ} (P : Fin r → Drawing S) + (u v : Fin r → S) (B : Fin s → Drawing S) (E : Fin s → Set T) : Prop where + path : ∀ i, (P i).IsSubdrawing G ∧ j (u i) ∈ discBd D₁ ∧ j (v i) ∈ discBd Δ₂ ∧ + (P i).IsPathBetween (u i) (v i) ∧ j '' (P i).U ⊆ Δ₂ \ discInt D₁ + path_disj : ∀ i i', i ≠ i' → Disjoint (P i).V (P i').V + circuit : ∀ l, (B l).IsSubdrawing G ∧ (B l).IsCircuit ∧ IsClosedDisc (E l) ∧ discBd (E l) = j '' + (B l).U ∧ D₁ ⊆ E l ∧ E l ⊆ Δ₂ + mono : ∀ l l', l ≤ l' → E l ⊆ E l' + circuit_disj : ∀ l l', l ≠ l' → Disjoint (B l).V (B l').V + inter : ∀ i l, ∃ (Q : Drawing S) (x y : S), Q.IsSubdrawing G ∧ Q.U = (P i).U ∩ (B l).U ∧ Q.V = + (P i).V ∩ (B l).V ∧ Q.IsPathBetween x y + +/-- **The application of (5.8) on page 234.** Take the parallel copies `D₁` of the circuit `C_1` and +`Δ₂` of the circuit `C_{β+1}`. A disc between them with fewer than `r` vertices on its boundary +would contradict the choice of `E`, and a line across them meets `β` disjoint circuits. So (5.8) +gives `r` paths and `β` circuits. -/ +theorem IsCuffNest.exists_grid {G : Drawing S} {j : S → T} {C : Set S} {D E : Set T} {r : ℕ} {B : + ℕ → Drawing S} {Ds : ℕ → Set T} {Δ : Set T} {ra β : ℕ} (h : IsCuffNest G j C E r (β + 3) B Ds Δ) + (hS : IsSurface S) [ConnectedSpace S] (hc : IsCappedCuff C T j D) (hd : IsCuffDisc G j D ra E) + (hmax : ∀ Δ', IsCuffDisc G j D ra Δ' → cuffCount G j Δ' ≤ cuffCount G j E) (hβ : 1 ≤ β) : + ∃ (D₁ Δ₂ : Set T) (P : Fin ra → Drawing S) (u v : Fin ra → S) (N : Fin β → Drawing S) + (En : Fin β → Set T), IsClosedDisc D₁ ∧ IsClosedDisc Δ₂ ∧ Ds 1 ⊆ D₁ ∧ D₁ ⊆ Ds 2 \ discBd + (Ds 2) ∧ Ds (β + 1) ⊆ Δ₂ ∧ Δ₂ ⊆ Ds (β + 2) \ discBd (Ds (β + 2)) + ∧ IsCuffGrid G j D₁ Δ₂ P u v N En := by + classical + have hT := hc.isSurface + have : T2Space T := hT.2.1 + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have hman := hT.2.2 + have hcj : IsClosedEmbedding j := hc.isEmbedding.continuous.isClosedEmbedding + hc.isEmbedding.injective + have hji := hc.isEmbedding.injective + have hsd : ∀ {t t'}, t < t' → t' < β + 3 → Ds t ⊆ Ds t' \ discBd (Ds t') := fun htt ht + => h.subset_diff hman hji htt ht + obtain ⟨D₁, p1, p2, p3, p4, -, -⟩ := exists_parallel_disc (h.sub 1 (by omega)) hcj (h.disc 1 + (by omega)) (h.disc 2 (by omega)) (hsd (by omega) (by omega)) (h.bd_eq 1 (by omega)) + obtain ⟨Δ₂, q1, q2, q3, q4, -, -⟩ := exists_parallel_disc (h.sub (β + 1) (by omega)) hcj (h.disc + (β + 1) (by omega)) (h.disc (β + 2) (by omega)) (hsd (by omega) (by omega)) (h.bd_eq (β + 1) + (by omega)) + have hsub2 : ∀ t, t ≤ β + 1 → Ds t ⊆ Δ₂ := fun t ht => (h.mono ht (by omega)).trans q2 + have hin : D₁ ⊆ Δ₂ \ discBd Δ₂ := fun x hx => by + have h1 := p3 hx + refine ⟨hsub2 2 (by omega) h1.1, fun h2 => ?_⟩ + exact (discInt_mono hman (h.disc 2 (by omega)) (hsub2 2 (by omega)) h1).2 h2 + have hDE := hd.2.1 + have hE₁ : E ⊆ D₁ := (h.mem 1 (by omega)).trans p2 + have hr : Δ₂ \ discInt D₁ ⊆ range j := fun x hx => by + by_contra hxr + rcases hc.union_eq.ge (mem_univ x) with h1 | h1 + · exact hxr h1 + · refine hx.2 (discInt_mono hman hc.isClosedDisc (hDE.trans hE₁) ⟨h1, fun hb => hxr ?_⟩) + rw [hc.discBd_eq] at hb + exact image_subset_range _ _ hb + have hint : ∀ x ∈ discBd Δ₂, IsInteriorPoint x := fun x hx => by + by_contra hb + exact disjoint_left.mp (h.off (β + 2) (by omega)) (q3 (Surface.discBd_subset _ hx)).1 hb + -- discs between + have hi : ∀ B', IsClosedDisc B' → D₁ ⊆ B' → B' ⊆ Δ₂ → G.IsNormal (j ⁻¹' discBd B') → ra ≤ + (G.V ∩ j ⁻¹' discBd B').ncard := fun B' h1 h2 _ h4 => by + by_contra hlt + have hB' : IsCuffDisc G j D ra B' := ⟨h1, hDE.trans (hE₁.trans h2), h4, by omega⟩ + have h5 := hmax B' hB' + have hinf : (B 0).U.Infinite := by + have h6 := isOArc_infinite_any (h.disc 0 (by omega)).isOArc_discBd + rw [h.bd_eq 0 (by omega)] at h6 + exact fun hf => h6 (hf.image j) + obtain ⟨x, hx, hxV⟩ := (hinf.sdiff (B 0).finite_V).nonempty + obtain ⟨e, he, hxe⟩ := (B 0).exists_edge_of_mem hx hxV + have heG : e ∈ G.E := (h.sub 0 (by omega)).2 he + have hE₂ : E ⊆ B' := hE₁.trans h2 + have hnew : ∃ e ∈ G.E, j '' e ⊆ B' ∧ ¬ j '' e ⊆ E := by + refine ⟨e, heG, ?_, fun h6 => ?_⟩ + · rintro _ ⟨y, hy, rfl⟩ + have h7 : j y ∈ discBd (Ds 0) := by + rw [h.bd_eq 0 (by omega)] + exact mem_image_of_mem j (he.2.1 hy).1 + exact h2 (p2 (h.mono (Nat.zero_le 1) (by omega) (Surface.discBd_subset _ h7))) + · have h7 := h6 (mem_image_of_mem j hxe) + have h8 : j x ∉ discInt E := fun h9 => disjoint_left.mp (h.offE 0 (by omega)) h9 hx + have h9 : j x ∈ discBd E := by + by_contra h10 + exact h8 ⟨h7, h10⟩ + exact (heG.2.1 hxe).2 (hd.2.2.1 ⟨h9, (heG.2.1 hxe).1⟩) + have h6 := cuffCount_lt G j hE₂ (.inr hnew) + omega + -- lines across + have hii : ∀ L u v, IsLineWithEnds L u v → u ∈ discBd D₁ → v ∈ discBd Δ₂ → L ⊆ Δ₂ → Disjoint L + (discInt D₁) → G.IsNormal (j ⁻¹' L) → β ≤ (G.V ∩ j ⁻¹' L).ncard := fun L u v h1 h2 h3 h4 _ h6 + => by + have hex : ∀ t : Fin β, ∃ y, y ∈ G.V ∩ j ⁻¹' L ∧ y ∈ (B (t.1 + 2)).U := fun t => by + have ht1 : t.1 + 2 ≤ β + 1 := by omega + have ht2 : t.1 + 2 < β + 3 := by omega + have hne : ¬ Disjoint L (discBd (Ds (t.1 + 2))) := fun hdis => by + rcases inside_or_off (isPreconnected_of_isLine h1) (h.disc _ ht2).isClosed (hdis.mono_right + (frontier_disc_subset hman (h.disc _ ht2))) with h7 | h7 + · have h8 : v ∈ discInt (Ds (t.1 + 2)) := ⟨interior_subset (h7 h1.right_mem), + disjoint_left.mp hdis h1.right_mem⟩ + exact (discInt_mono hman (h.disc _ ht2) (hsub2 _ ht1) h8).2 h3 + · exact h7 h1.left_mem (h.mono (by omega) ht2 (p3 (Surface.discBd_subset _ h2)).1) + obtain ⟨z, hzL, hzb⟩ := not_disjoint_iff.mp hne + rw [h.bd_eq _ ht2] at hzb + obtain ⟨y, hy, rfl⟩ := hzb + exact ⟨y, ⟨h6 ⟨hzL, (h.sub _ ht2).U_subset hy⟩, hzL⟩, hy⟩ + choose f hf1 hf2 using hex + have hinj : Injective f := fun t t' he => by + by_contra hne + have hne' : t.1 ≠ t'.1 := fun h7 => hne (Fin.ext h7) + rcases lt_or_gt_of_ne hne' with h7 | h7 + · exact disjoint_left.mp (h.disj (t.1 + 2) (t'.1 + 2) (by omega) (by omega)) (hf2 t) + (he ▸ hf2 t') + · exact disjoint_left.mp (h.disj (t'.1 + 2) (t.1 + 2) (by omega) (by omega)) (hf2 t') + (he ▸ hf2 t) + have h8 := ncard_image_of_injective (univ : Set (Fin β)) hinj + rw [ncard_univ, Nat.card_fin] at h8 + rw [← h8] + refine ncard_le_ncard ?_ (G.finite_V.subset inter_subset_left) + rintro _ ⟨t, -, rfl⟩ + exact hf1 t + obtain ⟨P, u, v, N, En, g1, g2, g3, g4, g5, g6⟩ := exists_disc_grid hman hcj p1 q1 hin hr p4 q4 + hint hi hii + exact ⟨D₁, Δ₂, P, u, v, N, En, p1, q1, p2, p3, q2, q3, g1, g2, g3, g4, g5, g6⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffGlue.lean b/LeanPool/GraphMinor/GM07/CuffGlue.lean new file mode 100644 index 0000000000..239628579a --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffGlue.lean @@ -0,0 +1,328 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffOrder + +/-! +# The collapse map of a system of boxes + +Graph Minors VII, (5.9), page 235. From a system of boxes around the cuffs, with `H(C)` the graphs +of the functions `f`, we get the map `ρ`, the part `G₁` of `G` above the graphs, and the graph `G'`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {ι : Type*} + +/-- The facts on the boxes. -/ +structure IsCollapseFrame (G : Drawing S) (φ : ι → ℝ × ℝ → S) (g f : ι → ℝ → ℝ) (Tr : S + → Drawing S) : Prop where + box : IsBoxSystem φ + data : ∀ i, IsCollapseData (g i) (f i) + bottom : ∀ i p, p ∈ cuffBox → (φ i p ∈ bd S ↔ p.2 = 0) + allBottom : bd S ⊆ boxBottom φ + graphU : ∀ i p, p ∈ cuffBox → p.2 = f i p.1 → φ i p ∈ G.U → φ i p ∈ G.V + graphV : ∀ i p, p ∈ cuffBox → p.2 = f i p.1 → φ i p ∈ G.V → φ i (g i p.1, 0) ∈ G.V ∩ bd S + ∧ φ i p ∈ (Tr (φ i (g i p.1, 0))).V + corner : ∀ x ∈ G.V ∩ bd S, ∃ i e, (e = (0 : ℝ) ∨ e = 1) ∧ φ i (e, 0) = x ∧ φ i (e, 1) ∈ G.V + tree : ∀ x ∈ G.V ∩ bd S, (Tr x).IsSubdrawing G ∧ IsGraphForest (Tr x).toGraph ∧ x ∈ (Tr x).V ∧ + (∀ a ∈ (Tr x).U, ∃ i p, p ∈ cuffBox ∧ φ i p = a ∧ p.2 ≤ f i p.1 ∧ φ i (g i p.1, 0) = x) ∧ ∀ a ∈ + (Tr x).V, ∀ b ∈ (Tr x).V, Nonempty (GraphWalk (Tr x).toGraph a b) + +theorem boxCollapse_under {g f : ℝ → ℝ} (hd : IsCollapseData g f) {p : ℝ × ℝ} (hp : p ∈ cuffBox) + (hle : p.2 ≤ f p.1) : boxCollapse g f p = (g p.1, 0) := by + have h1 := (boxLevel_eq_zero hd hp).mpr hle + refine Prod.ext ?_ ?_ + · simp [boxCollapse, h1] + · simp [boxCollapse, h1] + +/-- The level on a side of the box for the map that picks out the part below the graph. -/ +noncomputable def lowLevel (w : ℝ) : ℝ := 2 * (1 - max 0 (1 - w)) + +/-- The map of a box that goes to level `2` exactly from the part on or above the graph. -/ +noncomputable def lowMap (f : ℝ → ℝ) (p : ℝ × ℝ) : ℝ × ℝ := (p.1, 2 * (1 - max 0 + ((f p.1 - p.2) / f p.1))) + +theorem isBoxMap_lowMap {g f : ι → ℝ → ℝ} (hd : ∀ i, IsCollapseData (g i) (f i)) : IsBoxMap (fun i + => lowMap (f i)) lowLevel := by + refine ⟨fun i => ?_, fun i p hp => ?_, fun i p hp h2 => ?_, fun i m w hm hw => ?_⟩ + · have h1 : ContinuousOn (fun p : ℝ × ℝ => f i p.1) cuffBox := (hd i).fcont.comp continuousOn_fst + fun p hp => hp.1 + have h2 : ContinuousOn (fun p : ℝ × ℝ => (f i p.1 - p.2) / f i p.1) cuffBox := + (h1.sub continuousOn_snd).div h1 fun p hp => by + have := ((hd i).f1 p.1 hp.1).1 + linarith + have h3 : ContinuousOn (fun p : ℝ × ℝ => max 0 ((f i p.1 - p.2) / f i p.1)) cuffBox + := continuous_max.comp_continuousOn (continuousOn_const.prodMk h2) + exact continuousOn_fst.prodMk (continuousOn_const.mul (continuousOn_const.sub h3)) + · obtain ⟨h1, h2⟩ := (hd i).f1 p.1 hp.1 + have h3 : 0 < f i p.1 := by linarith + have h4 : (f i p.1 - p.2) / f i p.1 ≤ 1 := by + rw [div_le_one h3] + linarith [hp.2.1] + have h5 := le_max_left 0 ((f i p.1 - p.2) / f i p.1) + have h6 : max 0 ((f i p.1 - p.2) / f i p.1) ≤ 1 := max_le zero_le_one h4 + refine ⟨hp.1, ?_, ?_⟩ <;> simp only [lowMap] <;> linarith + · obtain ⟨h1, h3⟩ := (hd i).f1 p.1 hp.1 + have h4 : 0 < f i p.1 := by linarith + have h5 : (f i p.1 - p.2) / f i p.1 ≤ 0 := by + rw [h2] + exact div_nonpos_of_nonpos_of_nonneg (by linarith) h4.le + refine Prod.ext rfl ?_ + change 2 * (1 - max 0 ((f i p.1 - p.2) / f i p.1)) = p.2 + rw [max_eq_left h5, h2] + ring + · have hf : f i m = 1 := by + rcases hm with rfl | rfl + · exact (hd i).f0 + · exact (hd i).f1' + simp [lowMap, lowLevel, hf] + +variable [Finite ι] {G : Drawing S} {φ : ι → ℝ × ℝ → S} {g f : ι → ℝ → ℝ} {Tr : S → Drawing S} + +/-- The points strictly below a graph. -/ +def IsBelowGraph (φ : ι → ℝ × ℝ → S) (f : ι → ℝ → ℝ) (x : S) : Prop := ∃ i p, p ∈ cuffBox ∧ φ i p + = x ∧ p.2 < f i p.1 + +omit [TopologicalSpace S] [T2Space S] [Finite ι] in +theorem not_below_of_above {x : S} (hx : IsAboveGraph φ f x) : ¬ IsBelowGraph φ f x + := fun ⟨i, p, hp, he, hlt⟩ => absurd (hx i p hp he) (not_lt.mpr hlt.le) + +theorem isOpen_below (h : IsBoxSystem φ) (hd : ∀ i, IsCollapseData (g i) + (f i)) : IsOpen {x | IsBelowGraph φ f x} := by + obtain ⟨Ψ, hc, h0, hb, hoff⟩ := h.exists_homotopy (isBoxMap_lowMap hd) + have hcl : Continuous fun x => Ψ (1, x) := by fun_prop + have hval : ∀ i p, p ∈ cuffBox → Ψ (1, φ i p) = φ i (lowMap (f i) p) := fun i p hp => by + have h1 := hb i p 1 hp + rwa [Set.Icc.coe_one, boxLine_one] at h1 + have hset : {x | IsBelowGraph φ f x} = (fun x => Ψ (1, x)) ⁻¹' (⋃ i, φ i '' {p | p ∈ cuffBox + ∧ p.2 < 2}) := by + ext x + constructor + · rintro ⟨i, p, hp, rfl, hlt⟩ + obtain ⟨h1, h3⟩ := (hd i).f1 p.1 hp.1 + have h4 : 0 < f i p.1 := by linarith + have hm := (isBoxMap_lowMap hd).maps i hp + refine mem_iUnion.mpr ⟨i, lowMap (f i) p, ⟨hm, ?_⟩, (hval i p hp).symm⟩ + have h5 : 0 < (f i p.1 - p.2) / f i p.1 := div_pos (by linarith) h4 + have h6 := le_max_right 0 ((f i p.1 - p.2) / f i p.1) + change 2 * (1 - max 0 ((f i p.1 - p.2) / f i p.1)) < 2 + linarith + · intro hx + obtain ⟨i', p', ⟨hp', hlt⟩, he⟩ := mem_iUnion.mp hx + by_cases hb' : ∃ i, x ∈ φ i '' cuffBox + · obtain ⟨i, p, hp, rfl⟩ := hb' + by_cases hlt' : p.2 < f i p.1 + · exact ⟨i, p, hp, rfl, hlt'⟩ + · exfalso + push Not at hlt' + obtain ⟨h1, h3⟩ := (hd i).f1 p.1 hp.1 + have h4 : 0 < f i p.1 := by linarith + have h5 : (f i p.1 - p.2) / f i p.1 ≤ 0 := div_nonpos_of_nonpos_of_nonneg + (by linarith) h4.le + have h6 : lowMap (f i) p = (p.1, 2) := by + refine Prod.ext rfl ?_ + change 2 * (1 - max 0 ((f i p.1 - p.2) / f i p.1)) = 2 + rw [max_eq_left h5] + ring + have h7 : (p.1, (2 : ℝ)) ∈ cuffBox := ⟨hp.1, by norm_num, le_rfl⟩ + have h8 : φ i' p' = φ i (p.1, 2) := by + rw [he] + change Ψ (1, φ i p) = _ + rw [hval i p hp, h6] + rcases h.meet i' i p' _ hp' h7 h8 with ⟨-, h9⟩ | ⟨h9, -⟩ + · rw [h9] at hlt + exact lt_irrefl _ hlt + · simp only at h9 + linarith + · push Not at hb' + have h1 : Ψ (1, x) = x := hoff x 1 hb' + have h2 : φ i' p' = x := he.trans h1 + exact (hb' i' (h2 ▸ mem_image_of_mem (φ i') hp')).elim + rw [hset] + exact h.isOpen.preimage hcl + +/-- What the collapse map of a frame gives. -/ +structure IsGlued (G G₁ G' : Drawing S) (ρ : S → S) (Ψ : unitInterval × S → S) (φ : ι → ℝ × ℝ → S) + (g f : ι → ℝ → ℝ) (Tr : S → Drawing S) : Prop where + col : IsCollapse G G₁ G' ρ Ψ (G.V ∩ bd S) {x | IsAboveGraph φ f x} Tr + val : ∀ i p, p ∈ cuffBox → ρ (φ i p) = φ i (boxCollapse (g i) (f i) p) + voff : ∀ x, (∀ i, x ∉ φ i '' cuffBox) → ρ x = x + upU : ∀ z, IsAboveGraph φ f z → z ∈ G.U → z ∈ G₁.U + downV : ∀ z, IsAboveGraph φ f z → z ∈ G₁.V → z ∈ G.V + down : ∀ z ∈ G₁.U, IsAboveGraph φ f z ∨ ∃ i p, p ∈ cuffBox ∧ φ i p = z ∧ p.2 = f i p.1 ∧ z ∈ G.V + above_iff : ∀ x, IsAboveGraph φ f x ↔ ρ x ∉ bd S + upV : ∀ z, IsAboveGraph φ f z → z ∈ G.V → z ∈ G₁.V + bdV : G'.V ∩ bd S = G.V ∩ bd S + +/-- The collapse data of a frame. -/ +theorem IsCollapseFrame.exists_collapse [CompactSpace S] [Nonempty S] + (h : IsCollapseFrame G φ g f Tr) (hbdc : IsClosed (bd S)) : + ∃ (G₁ G' : Drawing S) (ρ : S → S) (Ψ : unitInterval × S → S), IsGlued G G₁ G' ρ Ψ φ g f Tr := by + classical + have hd := h.data + obtain ⟨Ψ, hc, h0, hb, hoff⟩ := h.box.exists_homotopy (isBoxMap_collapse hd) + let ρ : S → S := fun x => Ψ (1, x) + have hρc : Continuous ρ := by fun_prop + have hval : ∀ i p, p ∈ cuffBox → ρ (φ i p) = φ i (boxCollapse (g i) (f i) p) := fun i p hp => by + have h1 := hb i p 1 hp + rwa [Set.Icc.coe_one, boxLine_one] at h1 + have hvoff : ∀ x, (∀ i, x ∉ φ i '' cuffBox) → ρ x = x := fun x hx => hoff x 1 hx + set A : Set S := {x | IsAboveGraph φ f x} with hA + have hbot : ∀ i (m : ℝ), m ∈ Icc (0 : ℝ) 1 → φ i (m, 0) ∈ bd S := fun i m hm => + (h.bottom i (m, 0) ⟨hm, le_rfl, by norm_num⟩).mpr rfl + have hnotA : ∀ x, x ∉ A → ∃ i p, p ∈ cuffBox ∧ φ i p = x ∧ p.2 ≤ f i p.1 := fun x hx => by + simp only [hA, mem_ofPred_eq, IsAboveGraph] at hx + push Not at hx + obtain ⟨i, p, hp, he, hle⟩ := hx + exact ⟨i, p, hp, he, hle⟩ + have hunder : ∀ i p, p ∈ cuffBox → p.2 ≤ f i p.1 → boxCollapse (g i) (f i) p = (g i p.1, 0) + := fun i p hp hle => boxCollapse_under (hd i) hp hle + have hrb : ∀ x, x ∈ A ↔ ρ x ∉ bd S := fun x => by + constructor + · intro hx hb' + have h1 : bd S ⊆ boxBottom φ := h.allBottom + exact h.box.not_bottom_above hd hval hvoff hx (h1 hb') + · intro hx + by_contra hn + obtain ⟨i, p, hp, rfl, hle⟩ := hnotA x hn + rw [hval i p hp, hunder i p hp hle] at hx + exact hx (hbot i _ ((hd i).gmem hp.1)) + have hAo : IsOpen A := by + have : A = ρ ⁻¹' (bd S)ᶜ := by + ext x + exact hrb x + rw [this] + exact hbdc.isOpen_compl.preimage hρc + have hinj : ∀ x ∈ A, ∀ y, ρ y = ρ x → y = x := fun x hx y he => by + have hy : y ∈ A := (hrb y).mpr (he ▸ (hrb x).mp hx) + exact h.box.inj_above hd hval hvoff hy hx he + have hBo := isOpen_below h.box hd + have hdisAB : ∀ x, x ∈ A → ¬ IsBelowGraph φ f x := fun x hx ⟨i, p, hp, he, hlt⟩ => absurd + (hx i p hp he) (not_lt.mpr hlt.le) + let E₁ : Set (Set S) := {e | e ∈ G.E ∧ e ⊆ A} + let V₁ : Set S := {v | v ∈ G.V ∧ ¬ IsBelowGraph φ f v} + have hclA : ∀ e ∈ E₁, ∀ z ∈ closure e, ¬ IsBelowGraph φ f z := fun e he z hz hbz => by + obtain ⟨w, hw, hwB⟩ := mem_closure_iff.mp hz _ hBo hbz + exact hdisAB w (he.2 hwB) hw + have hV₁ : G.spanV V₁ E₁ = V₁ := by + refine subset_antisymm ?_ fun v hv => .inl ⟨hv, hv.1⟩ + rintro v (hv | hv) + · exact hv.1 + · obtain ⟨e, he, hv⟩ := mem_iUnion₂.mp hv + exact ⟨hv.2, hclA e he.1 v hv.1⟩ + set G₁ : Drawing S := G.span V₁ E₁ with hG₁ + have hG₁V : G₁.V = V₁ := hV₁ + have hG₁E : G₁.E = E₁ := by + rw [hG₁, G.span_E] + exact inter_eq_left.mpr fun e he => he.1 + have hsub : G₁.IsSubdrawing G := Drawing.span_isSubdrawing G _ _ + have hoffU : G₁.U \ G₁.V ⊆ A := by + rintro z ⟨hz, hzV⟩ + obtain ⟨e, he, hze⟩ := G₁.exists_edge_of_mem hz hzV + rw [hG₁E] at he + exact he.2 hze + obtain ⟨G', hU, hV, hE⟩ := exists_collapse_drawing hρc hinj G₁ hoffU + have hvert : ∀ v ∈ G₁.V, v ∈ A ∨ (ρ v ∈ G.V ∩ bd S ∧ v ∈ (Tr (ρ v)).V) := fun v hv => by + rw [hG₁V] at hv + by_cases hvA : v ∈ A + · exact .inl hvA + · obtain ⟨i, p, hp, rfl, hle⟩ := hnotA v hvA + have heq : p.2 = f i p.1 := le_antisymm hle (not_lt.mp fun hlt => hv.2 ⟨i, p, hp, rfl, hlt⟩) + obtain ⟨h1, h2⟩ := h.graphV i p hp heq hv.1 + rw [hval i p hp, hunder i p hp hle] + exact .inr ⟨h1, h2⟩ + have hcol : IsCollapse G G₁ G' ρ Ψ (G.V ∩ bd S) A Tr := by + refine ⟨hc, fun x => ?_, fun _ => rfl, fun x hx τ => ?_, hinj, hsub, hoffU, hU, hV, hE, rfl, + hvert, fun x hx => ?_⟩ + · have h1 := h0 x + exact h1 + · obtain ⟨i, e, he, rfl, -⟩ := h.corner x hx + have hp : (e, (0 : ℝ)) ∈ cuffBox := by + rcases he with rfl | rfl + · exact ⟨⟨le_rfl, zero_le_one⟩, le_rfl, by norm_num⟩ + · exact ⟨⟨zero_le_one, le_rfl⟩, le_rfl, by norm_num⟩ + rw [hb i _ τ hp, boxCollapse_side (hd i) he] + have h1 : sideLevel 0 = 0 := by simp [sideLevel] + rw [h1, boxLine_self] + · obtain ⟨h1, h2, h3, h4, h5⟩ := h.tree x hx + refine ⟨h1, h2, h3, fun a ha => ?_, h5⟩ + obtain ⟨i, p, hp, rfl, hle, he⟩ := h4 a ha + rw [hval i p hp, hunder i p hp hle, he] + have hfe : ∀ i (e : ℝ), (e = 0 ∨ e = 1) → f i e = 1 := fun i e he => by + rcases he with rfl | rfl + · exact (hd i).f0 + · exact (hd i).f1' + have hge : ∀ i (e : ℝ), (e = 0 ∨ e = 1) → g i e = e := fun i e he => by + rcases he with rfl | rfl + · exact (hd i).g0 + · exact (hd i).g1 + refine ⟨G₁, G', ρ, Ψ, hcol, hval, hvoff, fun z hz hzU => ?_, fun z _ hz => hsub.1 hz, + fun z hz => ?_, hrb, fun z hz hzV => hG₁V ▸ ⟨hzV, hdisAB z hz⟩, ?_⟩ + · by_cases hzV : z ∈ G.V + · exact G₁.V_subset_U (hG₁V ▸ ⟨hzV, hdisAB z hz⟩) + · obtain ⟨e, he, hze⟩ := G.exists_edge_of_mem hzU hzV + -- An edge that meets `A` lies in `A`, as it misses the graphs. + have heU : e ⊆ A ∪ {x | IsBelowGraph φ f x} := fun y hy => by + by_cases hyA : y ∈ A + · exact .inl hyA + · obtain ⟨i, p, hp, rfl, hle⟩ := hnotA y hyA + rcases hle.lt_or_eq with hlt | heq + · exact .inr ⟨i, p, hp, rfl, hlt⟩ + · exact absurd (h.graphU i p hp heq ((he.2.1 hy).1)) (he.2.1 hy).2 + have hsubA : e ⊆ A := by + have hpc := he.2.2.1.isConnected.isPreconnected + by_contra hn + obtain ⟨y, hy, hyA⟩ := not_subset.mp hn + have hyB : y ∈ {x | IsBelowGraph φ f x} := (heU hy).resolve_left hyA + obtain ⟨w, -, hw'⟩ := hpc A _ hAo hBo heU ⟨z, hze, hz⟩ ⟨y, hy, hyB⟩ + exact hdisAB w hw'.1 hw'.2 + exact G₁.closure_subset_U (hG₁E ▸ (⟨he, hsubA⟩ : e ∈ E₁)) (subset_closure hze) + · by_cases hzV : z ∈ G₁.V + · by_cases hzA : z ∈ A + · exact .inl hzA + · obtain ⟨i, p, hp, rfl, hle⟩ := hnotA z hzA + have hz' : φ i p ∈ V₁ := hG₁V ▸ hzV + exact .inr ⟨i, p, hp, rfl, le_antisymm hle (not_lt.mp fun hlt => hz'.2 ⟨i, p, hp, rfl, + hlt⟩), hz'.1⟩ + · exact .inl (hoffU ⟨hz, hzV⟩) + · ext x + constructor + · rintro ⟨hx, hxb⟩ + rw [hV] at hx + obtain ⟨a, ha, rfl⟩ := hx + rcases hvert a ha with h1 | h1 + · exact absurd hxb ((hrb a).mp h1) + · exact h1.1 + · intro hx + obtain ⟨i, e, he, rfl, hv⟩ := h.corner x hx + have hp : (e, (1 : ℝ)) ∈ cuffBox := by + rcases he with rfl | rfl + · exact ⟨⟨le_rfl, zero_le_one⟩, zero_le_one, by norm_num⟩ + · exact ⟨⟨zero_le_one, le_rfl⟩, zero_le_one, by norm_num⟩ + refine ⟨?_, hx.2⟩ + rw [hV] + refine ⟨φ i (e, 1), hG₁V ▸ ⟨hv, ?_⟩, ?_⟩ + · rintro ⟨i', p, hp', he', hlt⟩ + rcases h.box.meet i' i p _ hp' hp he' with ⟨rfl, h1⟩ | ⟨h1, h2, -⟩ + · rw [h1, show f i' (e, (1 : ℝ)).1 = 1 from hfe i' e he] at hlt + exact lt_irrefl _ hlt + · rw [hfe i' _ h2] at hlt + exact hlt.ne h1 + · rw [hval i _ hp, hunder i _ hp (by rw [show f i (e, (1 : ℝ)).1 = 1 from hfe i e he]), + show g i (e, (1 : ℝ)).1 = e from hge i e he] + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffGrid.lean b/LeanPool/GraphMinor/GM07/CuffGrid.lean new file mode 100644 index 0000000000..38a1eac666 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffGrid.lean @@ -0,0 +1,924 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffArcWalk +public import LeanPool.GraphMinor.GM07.CylinderCap +public import LeanPool.GraphMinor.GM07.CuffForest +public import LeanPool.GraphMinor.GM09.ArcSides + +/-! +# The grid between two nested discs + +Graph Minors VII, (5.9), page 234: "we may apply (5.8) to the portion of $\Sigma$ between $C_1$ and +$C_\beta$". The portion lies in a disc of `Σ + CHat`, and need not be a surface that we have +by name. So we carry it to a sphere by a chart of a neighbourhood of the disc, and use +`exists_cylinder_grid` there. The two discs have `G`-normal boundaries, so a set that is normal for +the part of `G` between them is `G`-normal. The result is `exists_disc_grid`. With `s = 0` it is +also the "planar form of Menger's theorem" of page 235. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] + +/-- A path carried by a map that is one to one on it is a path. -/ +theorem transport_isPathBetween {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + [T2Space Y] {P : Drawing X} {Q : Drawing Y} {θ : X → Y} (hK : IsCompact P.U) + (hc : ContinuousOn θ P.U) (hi : InjOn θ P.U) + (hV : Q.V = θ '' P.V) (hE : Q.E = image θ '' P.E) {a b : X} (h : P.IsPathBetween a b) : + Q.IsPathBetween (θ a) (θ b) := by + refine GM14.Whitney.isPathBetween_map (P := P) (Q := Q) θ (image θ) ?_ hV hE + (hi.mono P.V_subset_U) h + rintro f y z ⟨hf, hy, hz, hc'⟩ + have hclU := P.closure_subset_U hf + have hcl : closure (θ '' f) = θ '' closure f := by + apply subset_antisymm + · exact closure_minimal (image_mono subset_closure) ((hK.of_isClosed_subset isClosed_closure + hclU).image_of_continuousOn (hc.mono hclU)).isClosed + · exact (hc.mono hclU).image_closure + refine ⟨hE ▸ mem_image_of_mem _ hf, hV ▸ mem_image_of_mem θ hy, hV ▸ mem_image_of_mem θ hz, ?_⟩ + rw [hcl, hV, ← image_inter_on (s := closure f) (t := P.V) (fun a ha b hb e => hi + (P.V_subset_U ha) (hclU hb) e), hc', image_pair] + +private theorem inner_disc_boundary_count + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + [T2Space T] + {j : S → T} + {G : Drawing S} + {D₁ : Set T} + {Δ₂ : Set T} + {r : ℕ} + (hi : ∀ (B : Set T), IsClosedDisc B → D₁ ⊆ B → B ⊆ Δ₂ → G.IsNormal (j ⁻¹' discBd B) → r ≤ (G.V + ∩ j ⁻¹' discBd B).ncard) + (E : Set T) + (R : Type) + [TopologicalSpace R] + (hRc : IsClosedSurface R) + (τ : T → R) + (hD₁E : D₁ ⊆ E) : + let A : Set T := Δ₂ \ discInt D₁ + ∀ (Γ : Drawing R), + ∀ (ρ : R → T), + (LeftInvOn ρ τ E) → + (∀ y ∈ τ '' E, τ (ρ y) = y) → + (∀ (x : R), IsManifoldPoint x) → + (IsClosedDisc (τ '' D₁)) → + let Δ' : Set R := τ '' Δ₂ + ∀ (D₂' : Set R), + (∀ {z : T}, z ∈ discInt D₁ → τ z ∈ discInt (τ '' D₁)) → + (Δ' ⊆ τ '' E) → + (∀ {X : Set T}, X ⊆ A → τ '' X ∩ Γ.U ⊆ Γ.V → G.IsNormal (j ⁻¹' X)) → + (∀ {X : Set T}, X ⊆ A → τ '' X ∩ Γ.U ⊆ Γ.V → (G.V ∩ j ⁻¹' X).ncard ≤ (τ '' X ∩ + Γ.U).ncard) → + (∀ {B : Set R}, Disjoint (discInt D₂') B → B ⊆ Δ') → + (∀ {B : Set R}, B ⊆ Δ' → τ '' ρ '' B = B) → + (∀ {B : Set R}, B ⊆ Δ' → ρ '' B ⊆ Δ₂) → + (∀ {B : Set R}, B ⊆ Δ' → ContinuousOn ρ B) → + (∀ {B : Set R}, B ⊆ Δ' → InjOn ρ B) → + ∀ (B : Set R), + (IsClosedDisc B) → + (τ '' D₁ ⊆ B) → + (Disjoint (discInt D₂') B) → + (discBd B ∩ Γ.U ⊆ Γ.V) → + r ≤ (discBd B ∩ Γ.U).ncard := by + intro A Γ ρ hρl hτρ hRman hD₁' Δ' D₂' hτint₁ hΔ'E hnormal hcount hA₁ hρimg hρin hρcon hρinj B hB + h3 h4 h5 + have hBΔ := hA₁ h4 + obtain ⟨hB₀, hB₀b⟩ := isClosedDisc_image hB (hρcon hBΔ) (hρinj hBΔ) + have hD₁B : D₁ ⊆ ρ '' B := fun z hz => ⟨τ z, h3 (mem_image_of_mem τ hz), hρl (hD₁E hz)⟩ + have hbA : discBd (ρ '' B) ⊆ A := fun x hx => by + refine ⟨hρin hBΔ (Surface.discBd_subset _ hx), fun h6 => ?_⟩ + have h7 : τ x ∈ discInt (τ '' D₁) := hτint₁ h6 + have hintSub : discInt (τ '' D₁) ⊆ B := fun _ hz => h3 hz.1 + have h8 : τ x ∈ interior B := interior_maximal hintSub (hD₁'.isOpen_discInt hRman) h7 + have h9 : τ x ∈ discBd B := by + rw [hB₀b] at hx + obtain ⟨y, hy, rfl⟩ := hx + rw [hτρ y (hΔ'E (hBΔ (Surface.discBd_subset _ hy)))] + exact hy + rw [← IsClosedDisc.frontier_eq_discBd hRc hB] at h9 + exact h9.2 h8 + have hτb : τ '' discBd (ρ '' B) = discBd B := by + rw [hB₀b] + exact hρimg ((Surface.discBd_subset B).trans hBΔ) + have h6 : τ '' discBd (ρ '' B) ∩ Γ.U ⊆ Γ.V := by rwa [hτb] + have h7 := hi _ hB₀ hD₁B (hρin hBΔ) (hnormal hbA h6) + have h8 := hcount hbA h6 + rw [hτb] at h8 + exact h7.trans h8 + +private theorem boundary_path_vertex_count + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + [T2Space T] + {j : S → T} + {G : Drawing S} + {D₁ : Set T} + {Δ₂ : Set T} + {s : ℕ} + (hii : ∀ (L : Set T) (u v : T), IsLineWithEnds L u v → u ∈ discBd D₁ → v ∈ discBd Δ₂ → L ⊆ Δ₂ + → Disjoint L (discInt D₁) → G.IsNormal (j ⁻¹' L) → s ≤ (G.V ∩ j ⁻¹' L).ncard) + (E : Set T) + (R : Type) + [TopologicalSpace R] + (τ : T → R) + (hΔ₂E : Δ₂ ⊆ E) + (hD₁E : D₁ ⊆ E) : + let A : Set T := Δ₂ \ discInt D₁ + ∀ (Γ : Drawing R), + ∀ (ρ : R → T), + (LeftInvOn ρ τ E) → + (discBd (τ '' D₁) = τ '' discBd D₁) → + let Δ' : Set R := τ '' Δ₂ + (discBd Δ' = τ '' discBd Δ₂) → + ∀ (D₂' : Set R), + (discBd D₂' = discBd Δ') → + (∀ {z : T}, z ∈ discInt D₁ → τ z ∈ discInt (τ '' D₁)) → + (∀ {X : Set T}, X ⊆ A → τ '' X ∩ Γ.U ⊆ Γ.V → G.IsNormal (j ⁻¹' X)) → + (∀ {X : Set T}, X ⊆ A → τ '' X ∩ Γ.U ⊆ Γ.V → (G.V ∩ j ⁻¹' X).ncard ≤ (τ '' X ∩ + Γ.U).ncard) → + (∀ {B : Set R}, Disjoint (discInt D₂') B → B ⊆ Δ') → + (∀ {B : Set R}, B ⊆ Δ' → τ '' ρ '' B = B) → + (∀ {B : Set R}, B ⊆ Δ' → ρ '' B ⊆ Δ₂) → + (∀ {B : Set R}, B ⊆ Δ' → ContinuousOn ρ B) → + (∀ {B : Set R}, B ⊆ Δ' → InjOn ρ B) → + ∀ (L : Set R), + ∀ (u : R), + ∀ (v : R), + (IsLineWithEnds L u v) → + (u ∈ discBd (τ '' D₁)) → + (v ∈ discBd D₂') → + (L ∩ Γ.U ⊆ Γ.V) → + (Disjoint L (discInt (τ '' D₁))) → + (Disjoint L (discInt D₂')) → + s ≤ (L ∩ Γ.V).ncard := by + intro A Γ ρ hρl hD₁b Δ' hΔb D₂' hD₂b hτint₁ hnormal hcount hA₁ hρimg hρin hρcon hρinj L u v h3 + h4 h5 h6 h7 h8 + have hLΔ := hA₁ h8.symm + have hL₀ := GM09.IsLineWithEnds.image_of_injOn h3 (hρcon hLΔ) (hρinj hLΔ) + rw [hD₁b] at h4 + rw [hD₂b, hΔb] at h5 + obtain ⟨u₀, hu₀, rfl⟩ := h4 + obtain ⟨v₀, hv₀, rfl⟩ := h5 + have hτL := hρimg hLΔ + have hdj : Disjoint (ρ '' L) (discInt D₁) := by + rw [disjoint_left] + rintro _ ⟨y, hy, rfl⟩ hi + obtain ⟨z, hz, rfl⟩ := hLΔ hy + rw [hρl (hΔ₂E hz)] at hi + exact disjoint_left.mp h7 hy (hτint₁ hi) + have hLA : ρ '' L ⊆ A := fun x hx => ⟨hρin hLΔ hx, fun h9 => disjoint_left.mp hdj hx h9⟩ + have h9 : τ '' (ρ '' L) ∩ Γ.U ⊆ Γ.V := by + rw [hτL] + exact h6 + rw [hρl (hD₁E (Surface.discBd_subset _ hu₀)), hρl (hΔ₂E (Surface.discBd_subset _ hv₀))] at hL₀ + have h10 := hii _ _ _ hL₀ hu₀ hv₀ (hρin hLΔ) hdj (hnormal hLA h9) + have h11 := hcount hLA h9 + rw [hτL] at h11 + have h12 : L ∩ Γ.U ⊆ L ∩ Γ.V := fun x hx => ⟨hx.1, h6 hx⟩ + exact h10.trans (h11.trans (ncard_le_ncard h12 (Γ.finite_V.subset inter_subset_right))) + +private theorem pull_subdrawing_from_grid + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [T2Space S] + {j : S → T} + {G : Drawing S} + (E : Set T) + (R : Type) + [TopologicalSpace R] + [T2Space R] + (τ : T → R) : + ∀ (A : Set T), + let Gi : Drawing S := G.span (j ⁻¹' A) {e | j '' e ⊆ A} + (Gi.E = {e | j '' e ⊆ A} ∩ G.E) → + (Gi.V ⊆ G.V ∩ j ⁻¹' A) → + ∀ (Γ : Drawing R), + (Γ.U = τ ∘ j '' Gi.U) → + (Γ.V = τ ∘ j '' Gi.V) → + (Γ.E = image (τ ∘ j) '' Gi.E) → + let κ : S → R := τ ∘ j + ∀ (θ : R → S), + (ContinuousOn θ (τ ∘ j '' j ⁻¹' E)) → + ∀ [CompactSpace R], + (∀ {x : S}, x ∈ Gi.U → θ (κ x) = x) → + (Γ.U ⊆ κ '' j ⁻¹' E) → + (∀ {y : R}, y ∈ Γ.U → κ (θ y) = y) → + ∀ (D' : Drawing R), + (D'.IsSubdrawing Γ) → + (D'.U.Nonempty) → + ∃ D : Drawing S, D.IsSubdrawing G ∧ κ '' D.U = D'.U ∧ κ '' D.V = D'.V ∧ D.U ⊆ Gi.U ∧ D.U = θ + '' D'.U ∧ D.V = θ '' D'.V ∧ D.E = image θ '' D'.E := by + intro A Gi hGiE hGiV Γ hΓU hΓV hΓE κ θ hθc _ hθκ hΓK hκθ D' hD' hne + have hDU := hD'.U_subset + have hc : ContinuousOn θ D'.U := hθc.mono (hDU.trans hΓK) + have hin' : InjOn θ D'.U := fun x hx y hy e => by rw [← hκθ (hDU hx), ← hκθ (hDU hy), e] + obtain ⟨D, h3, h4, h5⟩ := exists_transport D'.isClosed_U.isCompact hne hc hin' D' subset_rfl + have hDΓ : D.U ⊆ Gi.U := by + rw [h3] + rintro _ ⟨y, hy, rfl⟩ + have h6 := hDU hy + rw [hΓU] at h6 + obtain ⟨x, hx, rfl⟩ := h6 + rwa [hθκ hx] + have hsubV : D.V ⊆ G.V := by + rw [h4] + rintro _ ⟨y, hy, rfl⟩ + have h6 := hD'.1 hy + rw [hΓV] at h6 + obtain ⟨x, hx, rfl⟩ := h6 + rw [hθκ (Gi.V_subset_U hx)] + exact (hGiV hx).1 + have hsubE : D.E ⊆ G.E := by + rw [h5] + rintro _ ⟨f, hf, rfl⟩ + have h6 := hD'.2 hf + rw [hΓE] at h6 + obtain ⟨e, he, rfl⟩ := h6 + have hee : e ⊆ Gi.U := fun z hz => Gi.closure_subset_U he (subset_closure hz) + have h7 : image θ (image κ e) = e := by + rw [image_image] + exact (image_congr fun z hz => hθκ (hee hz)).trans (image_id' e) + rw [h7] + rw [hGiE] at he + exact he.2 + have himg : ∀ {W : Set R}, W ⊆ D'.U → κ '' (θ '' W) = W := fun {W} hW => by + rw [image_image] + exact (image_congr fun y hy => hκθ (hDU (hW hy))).trans (image_id' W) + refine ⟨D, ⟨hsubV, hsubE⟩, ?_, ?_, hDΓ, h3, h4, h5⟩ + · rw [h3] + exact himg subset_rfl + · rw [h4] + exact himg D'.V_subset_U + +private theorem transport_disc_grid + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + [T2Space S] + [T2Space T] + [ConnectedSpace S] + {j : S → T} + (hcj : IsClosedEmbedding j) + {G : Drawing S} + {D₁ : Set T} + {Δ₂ : Set T} + {r : ℕ} + {s : ℕ} + (hii' : Injective j) + (E : Set T) + (R : Type) + [TopologicalSpace R] + [T2Space R] + (hRc : IsClosedSurface R) + (τ : T → R) + (hD₁E : D₁ ⊆ E) : + let A : Set T := Δ₂ \ discInt D₁ + ∀ (Gi : Drawing S), + (Gi.U ⊆ j ⁻¹' A) → + (InjOn (τ ∘ j) (j ⁻¹' E)) → + (Gi.U ⊆ j ⁻¹' E) → + ∀ (Γ : Drawing R), + (Γ.V = τ ∘ j '' Gi.V) → + let κ : S → R := τ ∘ j + ∀ (θ : R → S), + ∀ (ρ : R → T), + (LeftInvOn ρ τ E) → + (IsClosedDisc (τ '' D₁)) → + let Δ' : Set R := τ '' Δ₂ + ∀ (D₂' : Set R), + (IsClosedDisc D₂') → + (∀ {y : S}, y ∈ Gi.U → κ y ∈ τ '' D₁ → j y ∈ discBd D₁) → + (∀ {y : S}, y ∈ Gi.U → κ y ∈ D₂' → j y ∈ discBd Δ₂) → + (Disjoint Γ.U (discInt (τ '' D₁))) → + (Disjoint Γ.U (discInt D₂')) → + (∀ {B : Set R}, Disjoint (discInt D₂') B → B ⊆ Δ') → + (∀ {B : Set R}, B ⊆ Δ' → ρ '' B ⊆ Δ₂) → + (∀ {B : Set R}, B ⊆ Δ' → ContinuousOn ρ B) → + (∀ {B : Set R}, B ⊆ Δ' → InjOn ρ B) → + ∀ (p₁ : R), + (p₁ ∈ discInt (τ '' D₁)) → + ∀ (p₂ : R), + (p₂ ∈ discInt D₂') → + ∀ [CompactSpace R], + ∀ (P' : Fin r → Drawing R), + ∀ (u' : Fin r → R), + ∀ (v' : Fin r → R), + ∀ (B' : Fin s → Drawing R), + ∀ (E' : Fin s → Set R), + (∀ (i : Fin r), (P' i).IsSubdrawing Γ ∧ u' i ∈ τ '' D₁ ∧ v' i ∈ D₂' ∧ (P' + i).IsPathBetween (u' i) (v' i)) → + (∀ (i i' : Fin r), i ≠ i' → Disjoint (P' i).V (P' i').V) → + (∀ (j : Fin s), (B' j).IsSubdrawing Γ ∧ (B' j).IsCircuit ∧ IsClosedDisc (E' j) ∧ discBd + (E' j) = (B' j).U ∧ p₁ ∈ E' j ∧ p₂ ∉ E' j) → + (∀ (j j' : Fin s), j ≤ j' → E' j ⊆ E' j') → + (∀ (j j' : Fin s), j ≠ j' → Disjoint (B' j).V (B' j').V) → + (∀ (i : Fin r) (j : Fin s), ∃ (Q : Drawing R) (x y : R), Q.IsSubdrawing Γ ∧ Q.U = (P' i).U ∩ + (B' j).U ∧ Q.V + = (P' i).V ∩ (B' j).V ∧ Q.IsPathBetween x y) → + (∀ {x : S}, x ∈ Gi.U → θ (κ x) = x) → + (∀ {y : R}, y ∈ Γ.U → κ (θ y) = y) → + (∀ (D' : Drawing R), D'.IsSubdrawing Γ → D'.U.Nonempty → ∃ D : Drawing S, D.IsSubdrawing G + ∧ κ + '' D.U = D'.U ∧ κ '' D.V = D'.V ∧ D.U ⊆ Gi.U ∧ D.U = θ '' D'.U ∧ D.V = θ '' D'.V ∧ D.E = + image θ '' D'.E) → + (∀ {X : Drawing R} {a b : R}, X.IsPathBetween a b → X.U.Nonempty) → + (∀ {D' : Drawing R}, D'.IsSubdrawing Γ → InjOn θ D'.U) → + (∀ {D' : Drawing R}, D'.IsSubdrawing Γ → ContinuousOn θ D'.U) → + ∀ (P : Fin r → Drawing S), + (∀ (i : Fin r), (P i).IsSubdrawing G) → + (∀ (i : Fin r), κ '' (P i).U = (P' i).U) → + (∀ (i : Fin r), κ '' (P i).V = (P' i).V) → + (∀ (i : Fin r), (P i).U ⊆ Gi.U) → + (∀ (i : Fin r), (P i).IsPathBetween (θ (u' i)) (θ (v' i))) → + ∀ (B : Fin s → Drawing S), + (∀ (l : Fin s), (B l).IsSubdrawing G) → + (∀ (l : Fin s), κ '' (B l).U = (B' l).U) → + (∀ (l : Fin s), κ '' (B l).V = (B' l).V) → + (∀ (l : Fin s), (B l).U ⊆ Gi.U) → + ∃ (P : Fin r → Drawing S) (u v : Fin r → S) (B : Fin s → Drawing S) (E : Fin s → Set T), (∀ i, + (P i).IsSubdrawing G ∧ j (u i) ∈ discBd D₁ ∧ j (v i) ∈ discBd Δ₂ ∧ (P i).IsPathBetween (u i) + (v i) ∧ j '' (P i).U ⊆ Δ₂ \ discInt D₁) ∧ (∀ i i', i ≠ i' → Disjoint (P i).V (P i').V) ∧ (∀ + l, (B l).IsSubdrawing G ∧ (B l).IsCircuit ∧ IsClosedDisc (E l) ∧ discBd (E l) = j '' (B l).U + ∧ D₁ ⊆ E l ∧ E l ⊆ Δ₂) ∧ (∀ l l', l ≤ l' → E l ⊆ E l') ∧ (∀ l l', l ≠ l' → Disjoint (B l).V + (B l').V) ∧ ∀ i l, ∃ (Q : Drawing S) (x y : S), Q.IsSubdrawing G ∧ Q.U = (P i).U ∩ (B l).U ∧ + Q.V = (P i).V ∩ (B l).V ∧ Q.IsPathBetween x y := by + intro A Gi hGiU hκi hGiK Γ hΓV κ θ ρ hρl hD₁' Δ' D₂' hD₂' hκD₁ hκD₂ hi₁ hi₂ hA₁ hρin hρcon hρinj + p₁ hp₁ p₂ hp₂ this P' u' v' B' E' hP hPd hB hEm hBd hQ hθκ hκθ hpull hnonU hthe hcthe P hPs + hPU hPV hPG hPp B hBs hBU hBV hBG + classical + have hmemκ : ∀ {X : Set S} {x : S}, X ⊆ Gi.U → x ∈ Gi.U → κ x ∈ κ '' X → x ∈ X + := fun {X x} hX hx h => by + obtain ⟨y, hy, he⟩ := h + exact hκi (hGiK (hX hy)) (hGiK hx) he ▸ hy + have hsplit : ∀ {X Y Z : Set S} {X' Y' Z' : Set R}, X ⊆ Gi.U → Y ⊆ Gi.U → Z ⊆ Gi.U → κ '' X = X' + → κ '' Y = Y' → κ '' Z = Z' → Z' = X' ∩ Y' → Z = X ∩ Y := fun {X Y Z X' Y' Z'} hX hY hZ h3 h4 + h5 h6 => by + ext x + constructor + · intro hx + have h7 : κ x ∈ X' ∩ Y' := h6 ▸ h5 ▸ mem_image_of_mem κ hx + exact ⟨hmemκ hX (hZ hx) (h3 ▸ h7.1), hmemκ hY (hZ hx) (h4 ▸ h7.2)⟩ + · rintro ⟨hx, hy⟩ + have h7 : κ x ∈ Z' := h6 ▸ ⟨h3 ▸ mem_image_of_mem κ hx, h4 ▸ mem_image_of_mem κ hy⟩ + exact hmemκ hZ (hX hx) (h5 ▸ h7) + have hE'data : ∀ l, E' l ⊆ Δ' ∧ τ '' D₁ ⊆ E' l := fun l => by + obtain ⟨c1, c2, c3, c4, c5, c6⟩ := hB l + have hf₁ : Disjoint (discInt (τ '' D₁)) (discBd (E' l)) := by + rw [c4] + exact hi₁.symm.mono_right c1.U_subset + have hf₂ : Disjoint (discInt D₂') (discBd (E' l)) := by + rw [c4] + exact hi₂.symm.mono_right c1.U_subset + constructor + · refine hA₁ (disjoint_left.mpr fun y hy h => c6 ?_) + exact side_of_disc hRc hD₂' c3 hf₂ hy hp₂ h + · have h3 : discInt (τ '' D₁) ⊆ E' l := fun y hy => side_of_disc hRc hD₁' c3 hf₁ hp₁ hy c5 + exact hD₁'.subset_closure_discInt.trans (closure_minimal h3 c3.isClosed) + have hEl : ∀ l, IsClosedDisc (ρ '' E' l) ∧ discBd (ρ '' E' l) = j '' (B l).U := fun l => by + obtain ⟨c1, c2, c3, c4, -⟩ := hB l + obtain ⟨h3, h4⟩ := isClosedDisc_image c3 (hρcon (hE'data l).1) (hρinj (hE'data l).1) + refine ⟨h3, h4.trans ?_⟩ + rw [c4, ← hBU l, image_image] + exact image_congr fun z hz => hρl (hGiK (hBG l hz)) + have hBcirc : ∀ l, (B l).IsCircuit := fun l => by + have hO : IsOArc (B l).U := by + have h3 := (hEl l).1.isOArc_discBd + rw [(hEl l).2] at h3 + have h4 := pull_oArc hcj.isEmbedding h3 (image_subset_range _ _) + rwa [preimage_image_eq _ hii'] at h4 + obtain ⟨X, h3, h4, h5⟩ := exists_circuit_of_oArc hO (hBs l).U_subset + have hV : X.V = (B l).V := subset_antisymm (fun x hx => mem_V_of_subdrawing (hBs l) + (h5 ▸ X.V_subset_U hx) (h4.1 hx)) fun x hx => mem_V_of_subdrawing h4 (h5.symm ▸ + (B l).V_subset_U hx) ((hBs l).1 hx) + have hE : X.E = (B l).E := by + unfold Drawing.E + rw [h5, hV] + have : X = B l := Drawing.ext_of_V_E hV hE + exact this ▸ h3 + have hstart : ∀ i, u' i ∈ (P' i).V ∧ v' i ∈ (P' i).V := fun i => by + obtain ⟨-, -, -, W, -, hV, -⟩ := hP i + exact ⟨by rw [hV]; exact W.start_mem_support, by rw [hV]; exact W.end_mem_support⟩ + have hΓmem : ∀ {y}, y ∈ Γ.V → θ y ∈ Gi.V := fun {y} hy => by + rw [hΓV] at hy + obtain ⟨x, hx, rfl⟩ := hy + rwa [hθκ (Gi.V_subset_U hx)] + refine ⟨P, fun i => θ (u' i), fun i => θ (v' i), B, fun l => ρ '' E' l, fun i + => ⟨hPs i, ?_, ?_, hPp i, ?_⟩, fun i i' hne => ?_, fun l => ⟨hBs l, hBcirc l, (hEl l).1, + (hEl l).2, ?_, hρin (hE'data l).1⟩, fun l l' hl => image_mono (hEm l l' hl), fun l l' hne + => ?_, fun i l => ?_⟩ + · have h3 := hΓmem ((hP i).1.1 (hstart i).1) + refine hκD₁ (Gi.V_subset_U h3) ?_ + rw [hκθ ((hP i).1.U_subset ((P' i).V_subset_U (hstart i).1))] + exact (hP i).2.1 + · have h3 := hΓmem ((hP i).1.1 (hstart i).2) + refine hκD₂ (Gi.V_subset_U h3) ?_ + rw [hκθ ((hP i).1.U_subset ((P' i).V_subset_U (hstart i).2))] + exact (hP i).2.2.1 + · rintro _ ⟨y, hy, rfl⟩ + exact hGiU (hPG i hy) + · rw [disjoint_left] + intro x h3 h4 + exact disjoint_left.mp (hPd i i' hne) (hPV i ▸ mem_image_of_mem κ h3) + (hPV i' ▸ mem_image_of_mem κ h4) + · intro z hz + exact ⟨τ z, (hE'data l).2 (mem_image_of_mem τ hz), hρl (hD₁E hz)⟩ + · rw [disjoint_left] + intro x h3 h4 + exact disjoint_left.mp (hBd l l' hne) (hBV l ▸ mem_image_of_mem κ h3) + (hBV l' ▸ mem_image_of_mem κ h4) + · obtain ⟨Q', x, y, c1, c2, c3, c4⟩ := hQ i l + obtain ⟨D, h3, h4, h5, h6, h7, h8, h9⟩ := hpull _ c1 (hnonU c4) + refine ⟨D, θ x, θ y, h3, hsplit (hPG i) (hBG l) h6 (hPU i) (hBU l) h4 c2, hsplit + ((P i).V_subset_U.trans (hPG i)) ((B l).V_subset_U.trans (hBG l)) (D.V_subset_U.trans h6) + (hPV i) (hBV l) h5 c3, ?_⟩ + exact transport_isPathBetween Q'.isClosed_U.isCompact (hcthe c1) (hthe c1) h8 h9 c4 + +private theorem spanned_drawing_in_grid_region + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [T1Space S] + {j : S → T} + {G : Drawing S} + (A : Set T) : + let Gi : Drawing S := G.span (j ⁻¹' A) {e | j '' e ⊆ A} + (∀ {e : Set S}, j '' e ⊆ A → closure e ⊆ j ⁻¹' A) → + (Gi.V ⊆ G.V ∩ j ⁻¹' A) → + Gi.U ⊆ j ⁻¹' A := by + intro Gi hclA hGiV + rintro x (hx | hx) + · exact (hGiV hx).2 + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact hclA he.1 hxe + +private theorem grid_region_points_in_spanned_drawing + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [T1Space S] + [TopologicalSpace T] + [T2Space T] + (hT : ∀ (x : T), IsManifoldPoint x) + {j : S → T} + (hcj : IsClosedEmbedding j) + {G : Drawing S} + {D₁ : Set T} + {Δ₂ : Set T} + (h₁ : IsClosedDisc D₁) + (h₂ : IsClosedDisc Δ₂) + (hn₁ : G.IsNormal (j ⁻¹' discBd D₁)) + (hn₂ : G.IsNormal (j ⁻¹' discBd Δ₂)) : + let A : Set T := Δ₂ \ discInt D₁ + let Gi : Drawing S := G.span (j ⁻¹' A) {e | j '' e ⊆ A} + (Gi.E = {e | j '' e ⊆ A} ∩ G.E) → + (∀ y ∈ G.V, j y ∈ A → y ∈ Gi.V) → + ∀ (x : S), + (x ∈ G.U) → + (j x ∈ A) → + x ∈ Gi.U := by + intro A Gi hGiE hinV x hx hA + by_cases hxV : x ∈ G.V + · exact Gi.V_subset_U (hinV x hxV hA) + obtain ⟨e, he, hxe⟩ := G.exists_edge_of_mem hx hxV + have hpc : IsPreconnected (j '' e) := he.2.2.1.isConnected.isPreconnected.image _ + hcj.continuous.continuousOn + have hoff : ∀ {Y : Set T}, G.IsNormal (j ⁻¹' Y) → Disjoint (j '' e) Y := fun {Y} hY => by + rw [disjoint_left] + rintro _ ⟨z, hz, rfl⟩ hzb + have hzU := he.2.1 hz + exact hzU.2 (hY ⟨hzb, hzU.1⟩) + have hsub : j '' e ⊆ A := by + have h3 := inside_or_off hpc h₁.isClosed ((hoff hn₁).mono_right (frontier_disc_subset hT h₁)) + have h4 := inside_or_off hpc h₂.isClosed ((hoff hn₂).mono_right (frontier_disc_subset hT h₂)) + have h5 : j '' e ⊆ (D₁)ᶜ := h3.resolve_left fun h => hA.2 ⟨interior_subset (h + (mem_image_of_mem j hxe)), disjoint_left.mp (hoff hn₁) (mem_image_of_mem j hxe)⟩ + have h6 : j '' e ⊆ interior Δ₂ := h4.resolve_right fun h => h (mem_image_of_mem j hxe) hA.1 + exact fun z hz => ⟨interior_subset (h6 hz), fun h7 => h5 hz h7.1⟩ + have hmem : e ∈ Gi.E := by + rw [hGiE] + exact ⟨hsub, he⟩ + exact Gi.closure_subset_U hmem (subset_closure hxe) + +private theorem pull_grid_paths + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [T2Space S] + {G : Drawing S} + {D₁ : Set T} + {r : ℕ} + (R : Type) + [TopologicalSpace R] + (τ : T → R) + (Gi : Drawing S) + (Γ : Drawing R) + (κ : S → R) + (θ : R → S) + (D₂' : Set R) + [CompactSpace R] + (P' : Fin r → Drawing R) + (u' : Fin r → R) + (v' : Fin r → R) + (hP : ∀ (i : Fin r), (P' i).IsSubdrawing Γ ∧ u' i ∈ τ '' D₁ ∧ v' i ∈ D₂' ∧ (P' + i).IsPathBetween (u' i) (v' i)) + (hpull : ∀ (D' : Drawing R), D'.IsSubdrawing Γ → D'.U.Nonempty → ∃ D : Drawing S, + D.IsSubdrawing G ∧ κ '' + D.U = D'.U ∧ κ '' D.V = D'.V ∧ D.U ⊆ Gi.U ∧ D.U = θ '' D'.U ∧ D.V = θ '' D'.V ∧ D.E = image + θ '' D'.E) + (hnonU : ∀ {X : Drawing R} {a b : R}, X.IsPathBetween a b → X.U.Nonempty) + (hthe : ∀ {D' : Drawing R}, D'.IsSubdrawing Γ → InjOn θ D'.U) + (hcthe : ∀ {D' : Drawing R}, D'.IsSubdrawing Γ → ContinuousOn θ D'.U) + (i : Fin r) : + ∃ D : Drawing S, D.IsSubdrawing G ∧ κ '' D.U = (P' i).U ∧ κ '' D.V = (P' i).V ∧ D.U ⊆ Gi.U ∧ + D.IsPathBetween (θ (u' i)) (θ (v' i)) := by + obtain ⟨c1, -, -, c4⟩ := hP i + obtain ⟨D, h3, h4, h5, h6, h7, h8, h9⟩ := hpull _ c1 (hnonU c4) + exact ⟨D, h3, h4, h5, h6, transport_isPathBetween (P' i).isClosed_U.isCompact (hcthe c1) + (hthe c1) h8 h9 c4⟩ + +private theorem pull_grid_circuits + {S : Type u} + [TopologicalSpace S] + {G : Drawing S} + {s : ℕ} + (R : Type) + [TopologicalSpace R] + [T2Space R] + (Gi : Drawing S) + (Γ : Drawing R) + (κ : S → R) + (θ : R → S) + (p₁ : R) + (p₂ : R) + (B' : Fin s → Drawing R) + (E' : Fin s → Set R) + (hB : ∀ (j : Fin s), (B' j).IsSubdrawing Γ ∧ (B' j).IsCircuit ∧ IsClosedDisc (E' j) ∧ discBd + (E' j) = (B' j).U ∧ p₁ ∈ E' j ∧ p₂ ∉ E' j) + (hpull : ∀ (D' : Drawing R), D'.IsSubdrawing Γ → D'.U.Nonempty → ∃ D : Drawing S, + D.IsSubdrawing G ∧ κ '' + D.U = D'.U ∧ κ '' D.V = D'.V ∧ D.U ⊆ Gi.U ∧ D.U = θ '' D'.U ∧ D.V = θ '' D'.V ∧ D.E = image + θ '' D'.E) + (l : Fin s) : + ∃ D : Drawing S, D.IsSubdrawing G ∧ κ '' D.U = (B' l).U ∧ κ '' D.V = (B' l).V ∧ D.U ⊆ Gi.U := by + obtain ⟨c1, c2, -⟩ := hB l + have hne : (B' l).U.Nonempty := (GM14.isOArc_of_isCircuit c2 |> isConnected_of_isOArc).nonempty + obtain ⟨D, h3, h4, h5, h6, -⟩ := hpull _ c1 hne + exact ⟨D, h3, h4, h5, h6⟩ + +private theorem grid_on_outer_disc_is_at_vertices + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + {j : S → T} + {D₁ : Set T} + {Δ₂ : Set T} + (R : Type) + [TopologicalSpace R] + (τ : T → R) + (Gi : Drawing S) + (Γ : Drawing R) + (hΓU : Γ.U = τ ∘ j '' Gi.U) + (hΓV : Γ.V = τ ∘ j '' Gi.V) : + let κ : S → R := τ ∘ j + ∀ (D₂' : Set R), + (∀ {y : S}, y ∈ Gi.U → j y ∈ discBd D₁ ∪ discBd Δ₂ → y ∈ Gi.V) → + (∀ {y : S}, y ∈ Gi.U → κ y ∈ D₂' → j y ∈ discBd Δ₂) → + Γ.U ∩ D₂' ⊆ Γ.V := by + intro κ D₂' hbdV hκD₂ + rintro _ ⟨hx, hb⟩ + rw [hΓU] at hx + obtain ⟨y, hy, rfl⟩ := hx + rw [hΓV] + exact ⟨y, hbdV hy (.inr (hκD₂ hy hb)), rfl⟩ + +private theorem grid_avoids_outer_disc_interior + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + {j : S → T} + {D₁ : Set T} + {Δ₂ : Set T} + (R : Type) + [TopologicalSpace R] + (τ : T → R) : + let A : Set T := Δ₂ \ discInt D₁ + ∀ (Gi : Drawing S), + (Gi.U ⊆ j ⁻¹' A) → + ∀ (Γ : Drawing R), + (Γ.U = τ ∘ j '' Gi.U) → + let Δ' : Set R := τ '' Δ₂ + ∀ (D₂' : Set R), + (∀ {x : R}, x ∈ discInt D₂' → x ∉ Δ') → + Disjoint Γ.U (discInt D₂') := by + intro A Gi hGiU Γ hΓU Δ' D₂' hint₂ + rw [disjoint_left] + intro x hx hi + rw [hΓU] at hx + obtain ⟨y, hy, rfl⟩ := hx + exact hint₂ hi (mem_image_of_mem τ (hGiU hy).1) + +private theorem inner_disc_hit_pulls_back_to_boundary + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + {j : S → T} + {D₁ : Set T} + {Δ₂ : Set T} + (E : Set T) + (R : Type) + (τ : T → R) + (hτi : InjOn τ E) + (hD₁E : D₁ ⊆ E) : + let A : Set T := Δ₂ \ discInt D₁ + ∀ (Gi : Drawing S), + (Gi.U ⊆ j ⁻¹' A) → + (Gi.U ⊆ j ⁻¹' E) → + let κ : S → R := τ ∘ j + ∀ {y : S}, + (y ∈ Gi.U) → + (κ y ∈ τ '' D₁) → + j y ∈ discBd D₁ := by + intro A Gi hGiU hGiK κ y hy h + obtain ⟨z, hz, he⟩ := h + have h3 : z = j y := hτi (hD₁E hz) (hGiK hy) he + by_contra hb + exact (hGiU hy).2 ⟨h3 ▸ hz, hb⟩ + +private theorem outer_disc_hit_pulls_back_to_boundary + {S : Type u} + {T : Type u} + [TopologicalSpace S] + [TopologicalSpace T] + {j : S → T} + {D₁ : Set T} + {Δ₂ : Set T} + (R : Type) + [TopologicalSpace R] + (τ : T → R) : + let A : Set T := Δ₂ \ discInt D₁ + ∀ (Gi : Drawing S), + (Gi.U ⊆ j ⁻¹' A) → + let κ : S → R := τ ∘ j + ∀ (Δ' : Set R), + ∀ (D₂' : Set R), + (∀ {x : R}, x ∈ discInt Δ' → x ∉ D₂') → + (∀ {z : T}, z ∈ Δ₂ → z ∉ discBd Δ₂ → τ z ∈ discInt Δ') → + ∀ {y : S}, + (y ∈ Gi.U) → + (κ y ∈ D₂') → + j y ∈ discBd Δ₂ := by + intro A Gi hGiU κ Δ' D₂' hnotΔ hτint y hy h + by_contra hb + exact hnotΔ (hτint (hGiU hy).1 hb) h + +/-- **The portion between two discs.** Let `D₁` lie strictly inside `Δ₂`, with `G`-normal +boundaries. If all discs between them have at least `r` vertices on their boundaries, and all lines +across have at least `s` vertices, then there are `r` paths and `s` circuits between them, with +nested discs, and the intersection of each path and circuit is a path. -/ +theorem exists_disc_grid [T2Space S] [T2Space T] [ConnectedSpace S] (hT : ∀ x : T, IsManifoldPoint + x) {j : S → T} (hcj : IsClosedEmbedding j) {G : Drawing S} {D₁ Δ₂ : Set T} (h₁ : IsClosedDisc D₁) + (h₂ : IsClosedDisc Δ₂) + (hin : D₁ ⊆ Δ₂ \ discBd Δ₂) (hr : Δ₂ \ discInt D₁ ⊆ range j) (hn₁ : G.IsNormal + (j ⁻¹' discBd D₁)) (hn₂ : G.IsNormal (j ⁻¹' discBd Δ₂)) (hint : ∀ x ∈ discBd Δ₂, + IsInteriorPoint x) {r s : ℕ} + (hi : ∀ B, IsClosedDisc B → D₁ ⊆ B → B ⊆ Δ₂ → G.IsNormal (j ⁻¹' discBd B) → r ≤ + (G.V ∩ j ⁻¹' discBd B).ncard) + (hii : ∀ L u v, IsLineWithEnds L u v → u ∈ discBd D₁ → v ∈ discBd Δ₂ → L ⊆ Δ₂ → Disjoint L + (discInt D₁) → G.IsNormal (j ⁻¹' L) → s ≤ (G.V ∩ j ⁻¹' L).ncard) : + ∃ (P : Fin r → Drawing S) (u v : Fin r → S) (B : Fin s → Drawing S) (E : Fin s → Set T), + (∀ i, (P i).IsSubdrawing G ∧ j (u i) ∈ discBd D₁ ∧ j (v i) ∈ discBd Δ₂ ∧ (P i).IsPathBetween + (u i) (v i) ∧ j '' (P i).U ⊆ Δ₂ \ discInt D₁) ∧ + (∀ i i', i ≠ i' → Disjoint (P i).V (P i').V) ∧ + (∀ l, (B l).IsSubdrawing G ∧ (B l).IsCircuit ∧ IsClosedDisc (E l) ∧ discBd (E l) = j '' + (B l).U ∧ D₁ ⊆ E l ∧ E l ⊆ Δ₂) ∧ + (∀ l l', l ≤ l' → E l ⊆ E l') ∧ + (∀ l l', l ≠ l' → Disjoint (B l).V (B l').V) ∧ + ∀ i l, ∃ (Q : Drawing S) (x y : S), Q.IsSubdrawing G ∧ Q.U = (P i).U ∩ (B l).U ∧ Q.V = + (P i).V ∩ (B l).V ∧ Q.IsPathBetween x y := by + classical + have hii' := hcj.injective + obtain ⟨E, hE, hΔE, -⟩ := Surface.exists_disc_around hT h₂ hint isOpen_univ (subset_univ _) + obtain ⟨p⟩ := h₂.isOArc_discBd + obtain ⟨c, c', hcc, hcc', hm, hm', hl, hr', hcE, hcb, -⟩ := exists_disc_collar h₂ hE hΔE p + obtain ⟨R, tR, ι, hR2, hRc, hRs, hιc, hιi⟩ := exists_sphere_chart + let τ : T → R := ι ∘ c' + have hτc : ContinuousOn τ E := hιc.comp_continuousOn hcc' + have hτi : InjOn τ E := fun x hx y hy h => by + have h1 : c' x = c' y := hιi h + rw [← hr' hx, ← hr' hy, h1] + have hΔ₂E : Δ₂ ⊆ E := fun x hx => (hΔE hx).1 + have hD₁E : D₁ ⊆ E := fun x hx => hΔ₂E (hin hx).1 + -- the part of `G` between the discs + let A : Set T := Δ₂ \ discInt D₁ + have hAc : IsClosed A := h₂.isClosed.inter (h₁.isOpen_discInt hT).isClosed_compl + let Gi : Drawing S := G.span (j ⁻¹' A) {e | j '' e ⊆ A} + have hGiE : Gi.E = {e | j '' e ⊆ A} ∩ G.E := G.span_E _ _ + have hclA : ∀ {e : Set S}, j '' e ⊆ A → closure e ⊆ j ⁻¹' A := fun {e} he => closure_minimal + (fun z hz => he (mem_image_of_mem j hz)) (hAc.preimage hcj.continuous) + have hGiV : Gi.V ⊆ G.V ∩ j ⁻¹' A := by + rintro x (hx | hx) + · exact ⟨hx.2, hx.1⟩ + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact ⟨hxe.2, hclA he.1 hxe.1⟩ + have hGiU : Gi.U ⊆ j ⁻¹' A := by + exact spanned_drawing_in_grid_region (S := S) (T := T) (j := j) (G := G) A hclA hGiV + have hGiUU : Gi.U ⊆ G.U := (Drawing.span_isSubdrawing G _ _).U_subset + have hinV : ∀ y ∈ G.V, j y ∈ A → y ∈ Gi.V := fun y hy h => .inl ⟨h, hy⟩ + -- points of `G` in `A` are in the part + have hmemU : ∀ x ∈ G.U, j x ∈ A → x ∈ Gi.U := fun x hx hA => by + exact grid_region_points_in_spanned_drawing (S := S) (T := T) hT (j := j) hcj (G := G) (D₁ := + D₁) (Δ₂ := Δ₂) h₁ h₂ hn₁ hn₂ hGiE hinV x hx hA + -- the chart to a sphere + have hKc : IsCompact (j ⁻¹' E) := hcj.isCompact_preimage hE.isCompact + have hκc : ContinuousOn (τ ∘ j) (j ⁻¹' E) := hτc.comp hcj.continuous.continuousOn fun x hx => hx + have hκi : InjOn (τ ∘ j) (j ⁻¹' E) := fun x hx y hy h => hii' (hτi hx hy h) + have hAE : j ⁻¹' A ⊆ j ⁻¹' E := preimage_mono fun x hx => hΔ₂E hx.1 + have hGiK : Gi.U ⊆ j ⁻¹' E := hGiU.trans hAE + have hAne : (j ⁻¹' E).Nonempty := by + obtain ⟨z, hz⟩ := (isConnected_of_isOArc h₂.isOArc_discBd).nonempty + obtain ⟨y, hy⟩ := hr ⟨Surface.discBd_subset _ hz, fun h3 => (hin h3.1).2 hz⟩ + exact ⟨y, by rw [mem_preimage, hy]; exact hΔ₂E (Surface.discBd_subset _ hz)⟩ + have : Nonempty S := ⟨hAne.some⟩ + obtain ⟨Γ, hΓU, hΓV, hΓE⟩ := exists_transport hKc hAne hκc hκi Gi hGiK + let κ : S → R := τ ∘ j + obtain ⟨θ, hθc, hθl⟩ := Surface.exists_inv_of_compactOn hKc hκc hκi + have : Nonempty T := ⟨j hAne.some⟩ + obtain ⟨ρ, hρc, hρl⟩ := Surface.exists_inv_of_compactOn hE.isCompact hτc hτi + have hτρ : ∀ y ∈ τ '' E, τ (ρ y) = y := fun y hy => by + obtain ⟨x, hx, rfl⟩ := hy + rw [hρl hx] + have hRman : ∀ x : R, IsManifoldPoint x := fun x => (hRc.2.2 x).isManifoldPoint + obtain ⟨hD₁', hD₁b⟩ := isClosedDisc_image h₁ (hτc.mono hD₁E) (hτi.mono hD₁E) + obtain ⟨hΔ', hΔb⟩ := isClosedDisc_image h₂ (hτc.mono hΔ₂E) (hτi.mono hΔ₂E) + obtain ⟨hD₂', hD₂b⟩ := GM12.isClosedDisc_closure_compl_of_sphere hRc hRs hΔ' + set Δ' := τ '' Δ₂ with hΔ'def + set D₂' := closure (univ \ Δ') with hD₂'def + have hoffD : ∀ {x}, x ∉ Δ' → x ∈ discInt D₂' := fun {x} hx => ⟨subset_closure ⟨mem_univ x, hx⟩, + fun hb => hx (Surface.discBd_subset Δ' (hD₂b ▸ hb))⟩ + have hnotΔ : ∀ {x}, x ∈ discInt Δ' → x ∉ D₂' := fun {x} hx h => by + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp h _ (hΔ'.isOpen_discInt hRman) hx + exact hw2.2 hw1.1 + have hint₂ : ∀ {x}, x ∈ discInt D₂' → x ∉ Δ' := fun {x} hx h => by + refine hnotΔ ⟨h, fun hb => hx.2 ?_⟩ hx.1 + rw [hD₂b] + exact hb + have hτint : ∀ {z}, z ∈ Δ₂ → z ∉ discBd Δ₂ → τ z ∈ discInt Δ' := fun {z} hz hb + => ⟨mem_image_of_mem τ hz, fun h => by + rw [hΔb] at h + obtain ⟨w, hw, he⟩ := h + exact hb ((hτi (hΔ₂E (Surface.discBd_subset _ hw)) (hΔ₂E hz) he) ▸ hw)⟩ + have hd : Disjoint (τ '' D₁) D₂' := by + rw [disjoint_left] + rintro _ ⟨z, hz, rfl⟩ h + exact hnotΔ (hτint (hin hz).1 (hin hz).2) h + -- vertices and the two boundaries + have hbdV : ∀ {y : S}, y ∈ Gi.U → j y ∈ discBd D₁ ∪ discBd Δ₂ → y ∈ Gi.V := fun {y} hy h => by + refine hinV y ?_ (hGiU hy) + rcases h with h | h + · exact hn₁ ⟨h, hGiUU hy⟩ + · exact hn₂ ⟨h, hGiUU hy⟩ + have hκD₁ : ∀ {y : S}, y ∈ Gi.U → κ y ∈ τ '' D₁ → j y ∈ discBd D₁ := fun {y} hy h => by + exact inner_disc_hit_pulls_back_to_boundary (S := S) (T := T) (j := j) (D₁ := D₁) (Δ₂ := Δ₂) E + R τ hτi hD₁E Gi hGiU hGiK (y := y) hy h + have hκD₂ : ∀ {y : S}, y ∈ Gi.U → κ y ∈ D₂' → j y ∈ discBd Δ₂ := fun {y} hy h => by + exact outer_disc_hit_pulls_back_to_boundary (S := S) (T := T) (j := j) (D₁ := D₁) (Δ₂ := Δ₂) R + τ Gi hGiU Δ' D₂' hnotΔ hτint (y := y) hy h + have hU₁ : Γ.U ∩ τ '' D₁ ⊆ Γ.V := by + rintro _ ⟨hx, hb⟩ + rw [hΓU] at hx + obtain ⟨y, hy, rfl⟩ := hx + rw [hΓV] + exact ⟨y, hbdV hy (.inl (hκD₁ hy hb)), rfl⟩ + have hi₁ : Disjoint Γ.U (discInt (τ '' D₁)) := by + rw [disjoint_left] + intro x hx hi + rw [hΓU] at hx + obtain ⟨y, hy, rfl⟩ := hx + have h3 := hκD₁ hy hi.1 + exact hi.2 (hD₁b ▸ ⟨j y, h3, rfl⟩) + have hU₂ : Γ.U ∩ D₂' ⊆ Γ.V := by + exact grid_on_outer_disc_is_at_vertices (S := S) (T := T) (j := j) (D₁ := D₁) (Δ₂ := Δ₂) R τ + Gi Γ hΓU hΓV D₂' hbdV hκD₂ + have hi₂ : Disjoint Γ.U (discInt D₂') := by + exact grid_avoids_outer_disc_interior (S := S) (T := T) (j := j) (D₁ := D₁) (Δ₂ := Δ₂) R τ + Gi hGiU Γ hΓU D₂' hint₂ + have hτint₁ : ∀ {z}, z ∈ discInt D₁ → τ z ∈ discInt (τ '' D₁) := fun {z} hz + => ⟨mem_image_of_mem τ hz.1, fun hb => hz.2 (by + rw [hD₁b] at hb + obtain ⟨w, hw, he⟩ := hb + exact hτi (hD₁E (Surface.discBd_subset _ hw)) (hD₁E hz.1) he ▸ hw)⟩ + -- a set of the sphere in the chart + have hΔ'E : Δ' ⊆ τ '' E := image_mono hΔ₂E + have hnormal : ∀ {X : Set T}, X ⊆ A → τ '' X ∩ Γ.U ⊆ Γ.V → G.IsNormal (j ⁻¹' X) := fun {X} hXA h + => by + rintro x ⟨hx, hxU⟩ + have hy := hmemU x hxU (hXA hx) + have h3 : κ x ∈ τ '' X ∩ Γ.U := ⟨mem_image_of_mem τ hx, hΓU ▸ mem_image_of_mem κ hy⟩ + have h4 := h h3 + rw [hΓV] at h4 + obtain ⟨y, hy', he⟩ := h4 + rw [← hκi (hGiK (Gi.V_subset_U hy')) (hGiK hy) he] + exact (hGiV hy').1 + have hcount : ∀ {X : Set T}, X ⊆ A → τ '' X ∩ Γ.U ⊆ Γ.V → (G.V ∩ j ⁻¹' X).ncard ≤ + (τ '' X ∩ Γ.U).ncard := fun {X} hXA h => by + have hsub : κ '' (G.V ∩ j ⁻¹' X) ⊆ τ '' X ∩ Γ.U := by + rintro _ ⟨y, ⟨hy, hyX⟩, rfl⟩ + exact ⟨mem_image_of_mem τ hyX, hΓU ▸ mem_image_of_mem κ (Gi.V_subset_U (hinV y hy (hXA hyX)))⟩ + have hi' : InjOn κ (G.V ∩ j ⁻¹' X) := hκi.mono fun y hy => hΔ₂E (hXA hy.2).1 + rw [← hi'.ncard_image] + exact ncard_le_ncard hsub (Γ.finite_V.subset h) + have hA₁ : ∀ {B : Set R}, Disjoint (discInt D₂') B → B ⊆ Δ' := fun {B} h x hx => by + by_contra hn + exact disjoint_left.mp h (hoffD hn) hx + have hρimg : ∀ {B : Set R}, B ⊆ Δ' → τ '' (ρ '' B) = B := fun {B} h => by + rw [image_image] + exact (image_congr fun y hy => hτρ y (hΔ'E (h hy))).trans (image_id' B) + have hρin : ∀ {B : Set R}, B ⊆ Δ' → ρ '' B ⊆ Δ₂ := fun {B} h => by + rintro _ ⟨y, hy, rfl⟩ + obtain ⟨z, hz, rfl⟩ := h hy + rw [hρl (hΔ₂E hz)] + exact hz + have hρcon : ∀ {B : Set R}, B ⊆ Δ' → ContinuousOn ρ B := fun {B} h => hρc.mono (h.trans hΔ'E) + have hρinj : ∀ {B : Set R}, B ⊆ Δ' → InjOn ρ B := fun {B} h x hx y hy e => by + rw [← hτρ x (hΔ'E (h hx)), ← hτρ y (hΔ'E (h hy)), e] + have hhi : ∀ B, IsClosedDisc B → τ '' D₁ ⊆ B → Disjoint (discInt D₂') B → discBd B ∩ Γ.U ⊆ Γ.V + → r ≤ (discBd B ∩ Γ.U).ncard := fun B hB h3 h4 h5 => by + exact inner_disc_boundary_count (S := S) (T := T) (j := j) (G := G) (D₁ := D₁) (Δ₂ := Δ₂) (r + := r) hi E R hRc τ hD₁E Γ ρ hρl hτρ hRman hD₁' D₂' hτint₁ hΔ'E hnormal hcount hA₁ hρimg + hρin hρcon hρinj B hB h3 h4 h5 + have hhii : ∀ (L : Set R) (u v : R), IsLineWithEnds L u v → u ∈ discBd (τ '' D₁) → v ∈ discBd D₂' + → L ∩ Γ.U ⊆ Γ.V → Disjoint L (discInt (τ '' D₁)) → Disjoint L (discInt D₂') → s ≤ + (L ∩ Γ.V).ncard := fun L u v h3 h4 h5 h6 h7 h8 => by + exact boundary_path_vertex_count (S := S) (T := T) (j := j) (G := G) (D₁ := D₁) (Δ₂ := Δ₂) (s + := s) hii E R τ hΔ₂E hD₁E Γ ρ hρl hD₁b hΔb D₂' hD₂b hτint₁ hnormal hcount hA₁ hρimg + hρin hρcon hρinj L u v h3 h4 h5 h6 h7 h8 + -- the grid in the sphere + obtain ⟨p₁, hp₁⟩ := hD₁'.nonempty_discInt + obtain ⟨p₂, hp₂⟩ := hD₂'.nonempty_discInt + have : CompactSpace R := hRc.1 + have : ConnectedSpace R := by + obtain ⟨e⟩ := hRs + exact e.symm.surjective.connectedSpace e.symm.continuous + obtain ⟨P', u', v', B', E', hP, hPd, hB, hEm, hBd, hQ⟩ := exists_cylinder_grid hRc hRs Γ hD₁' + hD₂' hd hU₁ hi₁ hU₂ hi₂ hp₁ hp₂ hhi hhii + have hθκ : ∀ {x}, x ∈ Gi.U → θ (κ x) = x := fun {x} hx => hθl (hGiK hx) + have hΓK : Γ.U ⊆ κ '' (j ⁻¹' E) := by + rw [hΓU] + exact image_mono hGiK + have hκθ : ∀ {y}, y ∈ Γ.U → κ (θ y) = y := fun {y} hy => by + rw [hΓU] at hy + obtain ⟨x, hx, rfl⟩ := hy + rw [hθκ hx] + have hpull : ∀ D' : Drawing R, D'.IsSubdrawing Γ → D'.U.Nonempty → ∃ D : Drawing S, + D.IsSubdrawing G ∧ κ '' D.U = D'.U ∧ κ '' D.V = D'.V ∧ D.U ⊆ Gi.U ∧ D.U = θ '' D'.U ∧ D.V + = θ '' D'.V ∧ D.E = image θ '' D'.E := fun D' hD' hne => by + exact pull_subdrawing_from_grid (S := S) (T := T) (j := j) (G := G) E R τ A hGiE hGiV Γ hΓU + hΓV hΓE θ hθc hθκ hΓK hκθ D' hD' hne + have hnonU : ∀ {X : Drawing R} {a b : R}, X.IsPathBetween a b → X.U.Nonempty := fun {X a b} h + => by + obtain ⟨W, -, hV, -⟩ := h + exact ⟨a, X.V_subset_U (by rw [hV]; exact W.start_mem_support)⟩ + have hthe : ∀ {D' : Drawing R}, D'.IsSubdrawing Γ → InjOn θ D'.U := fun {D'} hD' x hx y hy e => by + rw [← hκθ (hD'.U_subset hx), ← hκθ (hD'.U_subset hy), e] + have hcthe : ∀ {D' : Drawing R}, D'.IsSubdrawing Γ → ContinuousOn θ D'.U := fun {D'} hD' + => hθc.mono (hD'.U_subset.trans hΓK) + have hPex : ∀ i, ∃ (D : Drawing S), D.IsSubdrawing G ∧ κ '' D.U = (P' i).U ∧ κ '' D.V = (P' i).V + ∧ D.U ⊆ Gi.U ∧ D.IsPathBetween (θ (u' i)) (θ (v' i)) := fun i => by + exact pull_grid_paths (S := S) (T := T) (G := G) (D₁ := D₁) (r := r) R τ Gi Γ κ θ D₂' P' u' v' + hP hpull hnonU hthe hcthe i + choose P hPs hPU hPV hPG hPp using hPex + have hBex : ∀ l, ∃ (D : Drawing S), D.IsSubdrawing G ∧ κ '' D.U = (B' l).U ∧ κ '' D.V = (B' l).V + ∧ D.U ⊆ Gi.U := fun l => by + exact pull_grid_circuits (S := S) (G := G) (s := s) R Gi Γ κ θ p₁ p₂ B' E' hB hpull l + choose B hBs hBU hBV hBG using hBex + exact transport_disc_grid (S := S) (T := T) (j := j) hcj (G := G) (D₁ := D₁) (Δ₂ := Δ₂) (r := + r) (s := s) hii' E R hRc τ hD₁E Gi hGiU hκi hGiK Γ hΓV θ ρ hρl hD₁' D₂' hD₂' hκD₁ + hκD₂ hi₁ hi₂ hA₁ hρin hρcon hρinj p₁ hp₁ p₂ hp₂ P' u' v' B' E' hP hPd hB hEm hBd hQ hθκ hκθ + hpull hnonU hthe hcthe P hPs hPU hPV hPG hPp B hBs hBU hBV hBG + + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffIncidences.lean b/LeanPool/GraphMinor/GM07/CuffIncidences.lean new file mode 100644 index 0000000000..2bbc7b9651 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffIncidences.lean @@ -0,0 +1,282 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section2Euler +import LeanPool.GraphMinor.GM11.DrawingOps +import LeanPool.GraphMinor.Surface.Circle +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.Classification + + +/-! +# Incidences along a cuff of a drawing + +Cuff components belonging to the edge set supply either one incident loop or two +distinct incident edges at each boundary vertex. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +private theorem mem_closure_nextSegment {V : Set Circle} (hV : V.Finite) {v : Circle} + (hv : v ∈ V) : v ∈ closure (nextSegment V v) := by + obtain ⟨L, hL0, hL2pi, hseg⟩ : ∃ L : ℝ, 0 < L ∧ L ≤ 2 * Real.pi ∧ + nextSegment V v = arcOfLength v L := by + rcases (V \ {v}).eq_empty_or_nonempty with hemp | hne + · have hV_eq : V = {v} := Subset.antisymm (sdiff_eq_empty.mp hemp) (singleton_subset_iff.mpr hv) + refine ⟨2 * Real.pi, Real.two_pi_pos, le_rfl, ?_⟩ + rw [hV_eq, nextSegment_singleton] + ext z + simp only [mem_compl_iff, mem_singleton_iff, arcOfLength, mem_ofPred_eq] + exact ⟨fun h => ⟨Circle.angleDiff_pos (Ne.symm h), Circle.angleDiff_lt_two_pi v z⟩, + fun ⟨hpos, _⟩ h => by subst h; simp [Circle.angleDiff] at hpos⟩ + · obtain ⟨v_next, hv_next, hmin⟩ := exists_min_on_finite hV.sdiff hne (Circle.angleDiff v) + have hne_v : v ≠ v_next := Ne.symm hv_next.2 + refine ⟨v.angleDiff v_next, Circle.angleDiff_pos hne_v, + (Circle.angleDiff_lt_two_pi v v_next).le, ?_⟩ + rw [nextSegment_eq_circleOpenArc_of_min hv_next hmin] + ext z + rw [mem_circleOpenArc_iff_angleDiff hne_v] + rfl + rw [hseg, _root_.mem_closure_iff] + intro U hU hvU + let γ : ℝ → Circle := fun t => Circle.exp (L * t) * v + have hγ_cont : Continuous γ := + (Circle.exp.continuous.comp (continuous_const.mul continuous_id)).mul continuous_const + have hγ0 : γ 0 = v := by simp [γ] + have hpre : IsOpen (γ ⁻¹' U) := hU.preimage hγ_cont + have h0_mem : (0 : ℝ) ∈ γ ⁻¹' U := by simp [hγ0, hvU] + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hpre 0 h0_mem + let t₀ : ℝ := min (ε / 2) (1 / 2) + have ht₀_pos : 0 < t₀ := lt_min (half_pos hε) (by norm_num) + have ht₀_lt1 : t₀ < 1 := lt_of_le_of_lt (min_le_right _ _) (by norm_num) + have ht₀_ball : t₀ ∈ Metric.ball (0 : ℝ) ε := by + rw [Metric.mem_ball, Real.dist_eq, sub_zero, abs_of_pos ht₀_pos] + exact lt_of_le_of_lt (min_le_left _ _) (half_lt_self hε) + refine ⟨γ t₀, hball ht₀_ball, ?_⟩ + have ht0 : 0 < L * t₀ := mul_pos hL0 ht₀_pos + have htL : L * t₀ < L := by nlinarith + have ht2pi : L * t₀ < 2 * Real.pi := htL.trans_le hL2pi + simp only [arcOfLength, mem_ofPred_eq, γ, angleDiff_exp_mul ht0 ht2pi] + exact ⟨ht0, htL⟩ + +/-- On `Circle`, for any finite subset `V` and `v ∈ V`, `v ∈ closure (prevSegment V v)`. -/ +private theorem mem_closure_prevSegment {V : Set Circle} (hV : V.Finite) {v : Circle} + (hv : v ∈ V) : v ∈ closure (prevSegment V v) := by + obtain ⟨L, hL0, hL2pi, hseg⟩ : ∃ L : ℝ, 0 < L ∧ L ≤ 2 * Real.pi ∧ + ∀ t ∈ Ioo (0 : ℝ) 1, Circle.exp (-(L * t)) * v ∈ prevSegment V v := by + rcases (V \ {v}).eq_empty_or_nonempty with hemp | hne + · have hV_eq : V = {v} := Subset.antisymm (sdiff_eq_empty.mp hemp) (singleton_subset_iff.mpr hv) + refine ⟨Real.pi, Real.pi_pos, by linarith [Real.pi_pos], fun t ht => ?_⟩ + rw [hV_eq, prevSegment_singleton, mem_compl_iff, mem_singleton_iff] + intro h + have h1 : Circle.exp (-(Real.pi * t)) = Circle.exp 0 := by + rw [Circle.exp_zero, ← mul_left_inj v, one_mul] + exact h + have hinj := Circle.exp_injOn_Ioc (a := -Real.pi) (b := Real.pi) (by linarith [Real.pi_pos]) + have ht_mem : -(Real.pi * t) ∈ Ioc (-Real.pi) Real.pi := + ⟨by nlinarith [ht.2, Real.pi_pos], by nlinarith [ht.1, Real.pi_pos]⟩ + have h0_mem : (0 : ℝ) ∈ Ioc (-Real.pi) Real.pi := ⟨by linarith [Real.pi_pos], Real.pi_pos.le⟩ + have heq := hinj ht_mem h0_mem h1 + nlinarith [ht.1, Real.pi_pos] + · obtain ⟨v_prev, hv_prev, hmax⟩ := exists_max_on_finite hV.sdiff hne (Circle.angleDiff v) + have hvv' : v_prev ≠ v := hv_prev.2 + let L := v_prev.angleDiff v + have hL0 : 0 < L := Circle.angleDiff_pos hvv' + have hL2pi : L < 2 * Real.pi := Circle.angleDiff_lt_two_pi v_prev v + refine ⟨L, hL0, hL2pi.le, fun t ht => ?_⟩ + rw [prevSegment_eq_nextSegment_of_max hv hv_prev hmax] + let z := Circle.exp (-(L * t)) * v + have hz_eq : z = Circle.exp (L * (1 - t)) * v_prev := by + dsimp [z, L] + have hexp := Circle.exp_angleDiff_mul (x := v_prev) (y := v) + calc + Circle.exp (-(v_prev.angleDiff v * t)) * v + = Circle.exp (-(v_prev.angleDiff v * t)) * + (Circle.exp (v_prev.angleDiff v) * v_prev) := by rw [hexp] + _ = (Circle.exp (-(v_prev.angleDiff v * t)) * + Circle.exp (v_prev.angleDiff v)) * v_prev := by rw [mul_assoc] + _ = Circle.exp (v_prev.angleDiff v * (1 - t)) * v_prev := by + rw [← Circle.exp_add] + congr 2 + ring + change z ∈ nextSegment V v_prev + rw [hz_eq] + have ht1_pos : 0 < L * (1 - t) := mul_pos hL0 (sub_pos.mpr ht.2) + have ht1_lt : L * (1 - t) < L := by nlinarith [ht.1] + have ht1_2pi : L * (1 - t) < 2 * Real.pi := ht1_lt.trans hL2pi + have hang := angleDiff_exp_mul (v := v_prev) ht1_pos ht1_2pi + refine ⟨?_, fun w hw => ?_⟩ + · intro h + have hpos := ht1_pos + rw [← hang, h] at hpos + simp [Circle.angleDiff] at hpos + · rcases eq_or_ne w v with rfl | hwv + · rw [hang] + exact ht1_lt + · have hw_mem : w ∈ V \ {v} := ⟨hw.1, hwv⟩ + have hle_w := hmax w hw_mem + have hlt_w : v.angleDiff w < v.angleDiff v_prev := + lt_of_le_of_ne hle_w ((circleCoordFrom v).injective.ne hw.2) + have hsum_vv' := Circle.angleDiff_add_angleDiff hvv' + have hsum_wv := Circle.angleDiff_add_angleDiff hwv + have hw_pos := Circle.angleDiff_pos hwv.symm + have hvp_pos := Circle.angleDiff_pos hvv'.symm + have hzp_pos : 0 < v_prev.angleDiff (Circle.exp (L * (1 - t)) * v_prev) := by + rw [hang]; exact ht1_pos + have heq_w := angleDiff_eq_of_angleDiff (x := v) (a := v_prev) (b := w) + have hL_lt : L < v_prev.angleDiff w := by + dsimp [L] at * + grind [-Circle.angleDiff] + rw [hang] + exact ht1_lt.trans hL_lt + rw [_root_.mem_closure_iff] + intro U hU hvU + let γ : ℝ → Circle := fun t => Circle.exp (-(L * t)) * v + have hγ_cont : Continuous γ := + (Circle.exp.continuous.comp (continuous_neg.comp (continuous_const.mul continuous_id))).mul + continuous_const + have hγ0 : γ 0 = v := by simp [γ] + have hpre : IsOpen (γ ⁻¹' U) := hU.preimage hγ_cont + have h0_mem : (0 : ℝ) ∈ γ ⁻¹' U := by simp [hγ0, hvU] + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hpre 0 h0_mem + let t₀ : ℝ := min (ε / 2) (1 / 2) + have ht₀_pos : 0 < t₀ := lt_min (half_pos hε) (by norm_num) + have ht₀_lt1 : t₀ < 1 := lt_of_le_of_lt (min_le_right _ _) (by norm_num) + have ht₀_ball : t₀ ∈ Metric.ball (0 : ℝ) ε := by + rw [Metric.mem_ball, Real.dist_eq, sub_zero, abs_of_pos ht₀_pos] + exact lt_of_le_of_lt (min_le_left _ _) (half_lt_self hε) + exact ⟨γ t₀, hball ht₀_ball, hseg t₀ ⟨ht₀_pos, ht₀_lt1⟩⟩ + +/-- The two cuff incidences used in VII (4.6), page 225: either one +boundary loop or two distinct incident boundary edges. -/ +theorem exists_cuff_incident_edges_of_edge_cover (hS : IsSurface S) + {J : Drawing S} (hEdges : arcComponentsIn (bd S \ J.V) ⊆ J.E) {v : S} + (hvV : v ∈ J.V) (hv_bd : v ∈ bd S) : + (∃ e ∈ J.E, e ⊆ bd S ∧ J.VertexIncident v e ∧ (tilde e).ncard = 1) ∨ + (∃ e₁ ∈ J.E, ∃ e₂ ∈ J.E, e₁ ≠ e₂ ∧ + e₁ ⊆ bd S ∧ e₂ ⊆ bd S ∧ J.VertexIncident v e₁ ∧ J.VertexIncident v e₂) := by + have : T2Space S := hS.2.1 + let C : Set S := connectedComponentIn (bd S) v + have hC_cuff : C ∈ cuffs S := ⟨v, hv_bd, rfl⟩ + have hvC : v ∈ C := mem_connectedComponentIn hv_bd + obtain ⟨φ_C⟩ := (cuff_statement S hS).2.2 C hC_cuff + let ι : Circle → S := Subtype.val ∘ φ_C + have hι_cont : Continuous ι := continuous_subtype_val.comp φ_C.continuous + have hι_inj : Function.Injective ι := Subtype.val_injective.comp φ_C.injective + let V_C : Set Circle := ι ⁻¹' J.V + have hVC_fin : V_C.Finite := J.finite_V.preimage hι_inj.injOn + let w₀ : Circle := φ_C.symm ⟨v, hvC⟩ + have hw₀_ι : ι w₀ = v := by simp [ι, w₀] + have hw₀_VC : w₀ ∈ V_C := by + rw [mem_preimage, hw₀_ι] + exact hvV + have hι_compl : ι '' (V_Cᶜ) = C \ J.V := by + ext x + simp only [V_C, ι, Function.comp_apply, mem_image, mem_compl_iff, mem_preimage, Set.mem_sdiff] + exact ⟨by rintro ⟨z, hz, rfl⟩; exact ⟨(φ_C z).2, hz⟩, + fun ⟨hxC, hxV⟩ => ⟨φ_C.symm ⟨x, hxC⟩, by simpa using hxV, by simp⟩⟩ + obtain ⟨g, hg_cont, hgi⟩ := + exists_inv_of_compactOn (isCompact_univ (X := Circle)) hι_cont.continuousOn hι_inj.injOn + have harc_C : arcComponentsIn (C \ J.V) = image ι '' arcComponentsIn (V_Cᶜ) := by + rw [← hι_compl] + exact GM11.arcComponentsIn_image hι_cont.continuousOn + (hg_cont.mono (image_mono (subset_univ _))) (fun z _ => hgi (mem_univ z)) + obtain ⟨harc_VC, _⟩ := Net.arcComponentsIn_compl_circle hVC_fin ⟨w₀, hw₀_VC⟩ + have harc_C_sub_bd : arcComponentsIn (C \ J.V) ⊆ arcComponentsIn (bd S \ J.V) := by + let 𝓐 : Set (Set S) := cuffs S \ {C} + have h𝓐_fin : 𝓐.Finite := (cuff_statement S hS).2.1.subset sdiff_subset + have hC_closed : IsClosed C := Net.isClosed_of_mem_cuffs hS hC_cuff + have h𝓐_closed : IsClosed (⋃₀ 𝓐) := + h𝓐_fin.isClosed_sUnion fun C' hC' => Net.isClosed_of_mem_cuffs hS hC'.1 + have hdisj : Disjoint C (⋃₀ 𝓐) := by + rw [Set.disjoint_left] + rintro x hxC ⟨C', ⟨hC'cuff, hC'ne⟩, hxC'⟩ + exact Set.disjoint_left.mp (cuffs_disjoint hC_cuff hC'cuff (Ne.symm hC'ne)) hxC hxC' + have hbd_eq : bd S \ J.V = (C \ J.V) ∪ ((⋃₀ 𝓐) \ J.V) := by + have hunion : C ∪ ⋃₀ 𝓐 = bd S := by + rw [← sUnion_insert, insert_sdiff_singleton, insert_eq_of_mem hC_cuff, sUnion_cuffs] + rw [← union_sdiff_distrib, hunion] + rw [hbd_eq, GM11.arcComponentsIn_union hC_closed h𝓐_closed sdiff_subset sdiff_subset + (fun x _ hxC hx𝓐 => Set.disjoint_left.mp hdisj hxC hx𝓐)] + exact subset_union_left + have hseg_mem_E : ∀ w ∈ V_C, ι '' nextSegment V_C w ∈ J.E := by + intro w hw + apply hEdges (harc_C_sub_bd ?_) + rw [harc_C, harc_VC] + exact ⟨nextSegment V_C w, ⟨w, hw, rfl⟩, rfl⟩ + have hseg_sub_bd : ∀ w ∈ V_C, ι '' nextSegment V_C w ⊆ bd S := by + rintro w _ _ ⟨z, _, rfl⟩ + exact sUnion_cuffs (S := S) ▸ ⟨C, hC_cuff, (φ_C z).2⟩ + let e₁ := ι '' nextSegment V_C w₀ + have he₁_E : e₁ ∈ J.E := hseg_mem_E w₀ hw₀_VC + have hv_cl_e₁ : v ∈ closure e₁ := by + rw [← hw₀_ι] + exact image_closure_subset_closure_image hι_cont + ⟨w₀, mem_closure_nextSegment hVC_fin hw₀_VC, rfl⟩ + have hv_inc_e₁ : J.VertexIncident v e₁ := ⟨hvV, Or.inl he₁_E, hv_cl_e₁⟩ + have hv_tilde_e₁ : v ∈ tilde e₁ := (vertexIncident_iff_mem_tilde J hvV he₁_E).mp hv_inc_e₁ + -- Split on whether `V_C \ {w₀}` is empty (`|C ∩ J.V| = 1`) or nonempty (`|C ∩ J.V| ≥ 2`). + rcases (V_C \ {w₀}).eq_empty_or_nonempty with hemp | hne + · -- `V_C = {w₀}`, so `e₁` is a loop edge (`(tilde e₁).ncard = 1`). + have htilde_e₁_sub : tilde e₁ ⊆ {v} := by + rw [tilde_eq_closure_inter_V J he₁_E] + rintro x ⟨hxcl, hxV⟩ + have hxC : x ∈ C := + Net.isClosed_of_mem_cuffs hS hC_cuff |>.closure_subset_iff.mpr + (by rintro _ ⟨z, _, rfl⟩; exact (φ_C z).2) hxcl + let z : Circle := φ_C.symm ⟨x, hxC⟩ + have hz_VC : z ∈ V_C := by + rw [mem_preimage] + simpa [ι, z] using hxV + have hzw₀ : z = w₀ := by + by_contra hne + exact hemp.subset ⟨hz_VC, hne⟩ + have hx_eq : x = ι z := by simp [ι, z] + rw [hx_eq, hzw₀, hw₀_ι] + rfl + have htilde_e₁_eq : tilde e₁ = {v} := + Subset.antisymm htilde_e₁_sub (singleton_subset_iff.mpr hv_tilde_e₁) + have hncard_e₁ : (tilde e₁).ncard = 1 := by rw [htilde_e₁_eq, ncard_singleton] + exact .inl ⟨e₁, he₁_E, hseg_sub_bd w₀ hw₀_VC, hv_inc_e₁, hncard_e₁⟩ + · obtain ⟨w₁, hw₁_prev, hmax⟩ := exists_max_on_finite hVC_fin.sdiff hne (Circle.angleDiff w₀) + have hprev_eq := prevSegment_eq_nextSegment_of_max hw₀_VC hw₁_prev hmax + have hw₁_VC : w₁ ∈ V_C := hw₁_prev.1 + have hw₁_ne : w₁ ≠ w₀ := hw₁_prev.2 + let e₂ := ι '' nextSegment V_C w₁ + have he₂_E : e₂ ∈ J.E := hseg_mem_E w₁ hw₁_VC + have hv_cl_e₂ : v ∈ closure e₂ := by + dsimp only [e₂] + rw [← hw₀_ι, ← hprev_eq] + exact image_closure_subset_closure_image hι_cont + ⟨w₀, mem_closure_prevSegment hVC_fin hw₀_VC, rfl⟩ + have hv_inc_e₂ : J.VertexIncident v e₂ := ⟨hvV, Or.inl he₂_E, hv_cl_e₂⟩ + have he₁_ne_e₂ : e₁ ≠ e₂ := by + intro h_eq + obtain ⟨z, hz₁⟩ := nextSegment_nonempty hVC_fin hw₀_VC + have hz₂_img : ι z ∈ e₂ := h_eq ▸ ⟨z, hz₁, rfl⟩ + rcases hz₂_img with ⟨z', hz', hι_eq⟩ + have hzz' : z = z' := hι_inj hι_eq.symm + subst hzz' + have hz_compl : z ∈ V_Cᶜ := nextSegment_subset_compl hz₁ + obtain ⟨_, _, huniq⟩ := exists_unique_nextSegment_of_mem_compl hVC_fin ⟨w₀, hw₀_VC⟩ hz_compl + exact hw₁_ne (huniq w₁ ⟨hw₁_VC, hz'⟩ |>.trans (huniq w₀ ⟨hw₀_VC, hz₁⟩).symm) + exact .inr ⟨e₁, he₁_E, e₂, he₂_E, he₁_ne_e₂, + hseg_sub_bd w₀ hw₀_VC, hseg_sub_bd w₁ hw₁_VC, hv_inc_e₁, hv_inc_e₂⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffLayers.lean b/LeanPool/GraphMinor/GM07/CuffLayers.lean new file mode 100644 index 0000000000..ecd6fac208 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffLayers.lean @@ -0,0 +1,471 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffGrid +public import LeanPool.GraphMinor.GM07.RegionNest +public import LeanPool.GraphMinor.GM07.Section5b + +/-! +# The layers around `A(C)` + +Graph Minors VII, (5.9), page 234: the sets `Z_j` are closures of unions of regions of `G`, and +"there is a circuit $C_j$ of $G$ with $U(C_j) \subseteq Z_j$, such that $Z_j - U(C_j)$ is inside the +$O$-arc $U(C_j)$". These are the layers of regions of `RegionNest.lean`. There the surface is a +sphere. Here the layers lie in a disc of a closed surface, and we find the circuits by a chart of +a neighbourhood of the disc into a sphere (`exists_layer_circuit_in_disc`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +variable {W : Type} [TopologicalSpace W] [T2Space W] + +/-- A point of the closed set of a family of regions that is off the boundary of the family is an +interior point of that set. -/ +theorem mem_interior_of_off_boundary [ConnectedSpace W] (hS : IsClosedSurface W) {Γ : Drawing W} {Z + : Set (Set W)} (hZ : Z ⊆ Γ.R) {x : W} (hx : x ∈ ⋃ r ∈ Z, closure r) (hxN : x ∉ + (boundaryDrawing Γ Z).U) : + x ∈ interior (⋃ r ∈ Z, closure r) := by + classical + have hlc : LocallyConnectedSpace W := IsClosedSurface.locallyConnectedSpace hS + have hfin : Γ.R.Finite := finite_R hS Γ + obtain ⟨r, hr, hxr⟩ := mem_iUnion₂.mp hx + have hFc : IsClosed (⋃ r' ∈ Γ.R \ Z, closure r') := (hfin.subset sdiff_subset).isClosed_biUnion + fun _ _ => isClosed_closure + have hxF : x ∉ ⋃ r' ∈ Γ.R \ Z, closure r' := fun h => by + obtain ⟨r', hr', hxr'⟩ := mem_iUnion₂.mp h + by_cases hxV : x ∈ Γ.V + · refine hxN ((boundaryDrawing Γ Z).V_subset_U ((mem_boundaryDrawing_V hS).mpr ⟨⟨r, hr, hxV, + .inr (hZ hr), hxr⟩, r', hr', hxV, .inr hr'.1, hxr'⟩)) + by_cases hxU : x ∈ Γ.U + · obtain ⟨e, he, hxe⟩ := Γ.exists_edge_of_mem hxU hxV + have hin : e ∈ (boundaryDrawing Γ Z).E := mem_boundaryDrawing_E.mpr ⟨⟨r, hr, he, hZ hr, x, + hxe, hxr⟩, r', hr', he, hr'.1, x, hxe, hxr'⟩ + exact hxN ((boundaryDrawing Γ Z).closure_subset_U hin (subset_closure hxe)) + · have hx' : x ∈ connectedComponentIn (univ \ Γ.U) x := mem_connectedComponentIn ⟨mem_univ x, + hxU⟩ + have hR : connectedComponentIn (univ \ Γ.U) x ∈ Γ.R := (mem_R_iff Γ).mpr ⟨x, hxU, rfl⟩ + obtain ⟨y, hy1, hy2⟩ := mem_closure_iff.mp hxr _ (region_isOpen hR) hx' + obtain ⟨y', hy1', hy2'⟩ := mem_closure_iff.mp hxr' _ (region_isOpen hR) hx' + have e1 := region_eq_of_mem_atom hR (.inr (hZ hr)) hy1 hy2 + have e2 := region_eq_of_mem_atom hR (.inr hr'.1) hy1' hy2' + exact hr'.2 (e2 ▸ e1.symm ▸ hr) + refine mem_interior.mpr ⟨(⋃ r' ∈ Γ.R \ Z, closure r')ᶜ, fun y hy => ?_, hFc.isOpen_compl, hxF⟩ + have hprop : Γ.IsProper := fun z hz => absurd (hS.2.2 z) hz.1 + have hS' : IsSurface W := ⟨hS.1, hS.2.1, fun z => (hS.2.2 z).isManifoldPoint⟩ + have h1 : y ∈ closure (⋃₀ Γ.R) := (closure_sUnion_regions_eq_univ hS' hprop).symm ▸ mem_univ y + rw [hfin.closure_sUnion] at h1 + obtain ⟨r', hr', hyr'⟩ := mem_iUnion₂.mp h1 + by_cases h2 : r' ∈ Z + · exact mem_iUnion₂.mpr ⟨r', h2, hyr'⟩ + · exact absurd (mem_iUnion₂.mpr ⟨r', ⟨hr', h2⟩, hyr'⟩) hy + +/-- The boundary of a family of regions lies in the closed set of the family. -/ +theorem boundary_subset_regions (hS : IsClosedSurface W) {Γ : Drawing W} {Z : + Set (Set W)} : (boundaryDrawing Γ Z).U ⊆ ⋃ r ∈ Z, closure r := fun x hx => by + by_cases hv : x ∈ (boundaryDrawing Γ Z).V + · obtain ⟨⟨r, hr, h1⟩, -⟩ := (mem_boundaryDrawing_V hS).mp hv + exact mem_iUnion₂.mpr ⟨r, hr, h1.2.2⟩ + · obtain ⟨e, he, hxe⟩ := (boundaryDrawing Γ Z).exists_edge_of_mem hx hv + obtain ⟨⟨r, hr, h1⟩, -⟩ := mem_boundaryDrawing_E.mp he + exact mem_iUnion₂.mpr ⟨r, hr, closure_edge_subset hS h1.1 h1.2.1 h1.2.2 (subset_closure hxe)⟩ + +/-- **A circuit around a family of regions in a disc.** If the closed set of a family of regions +lies strictly inside a disc `Ω` of a closed surface, the boundary of the family holds a +circuit that bounds a disc in `Ω` around a given point of the family. -/ +theorem exists_layer_circuit_in_disc [ConnectedSpace W] (hS : IsClosedSurface W) {Γ : Drawing W} {Z + : Set (Set W)} (hZ : Z ⊆ Γ.R) {r₀ : Set W} (h₀ : r₀ ∈ Z) {p : W} (hp : p ∈ r₀) {Ω : Set W} + (hΩ : IsClosedDisc Ω) + (hsub : ⋃ r ∈ Z, closure r ⊆ discInt Ω) : ∃ (C : Drawing W) (D : Set W), C.IsCircuit + ∧ C.IsSubdrawing (boundaryDrawing Γ Z) ∧ IsClosedDisc D ∧ discBd D = C.U ∧ p ∈ D ∧ D ⊆ Ω := by + classical + have hman : ∀ x : W, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hfin : Γ.R.Finite := finite_R hS Γ + have : CompactSpace W := hS.1 + obtain ⟨E, hE, hΩE, -⟩ := Surface.exists_disc_around hman hΩ (fun x _ => hS.2.2 x) isOpen_univ + (subset_univ _) + obtain ⟨q⟩ := hΩ.isOArc_discBd + obtain ⟨c, c', hcc, hcc', hm, hm', hl, hr', hcE, hcb, -⟩ := exists_disc_collar hΩ hE hΩE q + obtain ⟨R, tR, ι, hR2, hRc, hRs, hιc, hιi⟩ := exists_sphere_chart + have : CompactSpace R := hRc.1 + have : ConnectedSpace R := by + obtain ⟨e⟩ := hRs + exact e.symm.surjective.connectedSpace e.symm.continuous + have hRman : ∀ x : R, IsManifoldPoint x := fun x => (hRc.2.2 x).isManifoldPoint + have hlcR : LocallyConnectedSpace R := IsClosedSurface.locallyConnectedSpace hRc + let τ : W → R := ι ∘ c' + have hτc : ContinuousOn τ E := hιc.comp_continuousOn hcc' + have hτi : InjOn τ E := fun x hx y hy h => by + have h1 : c' x = c' y := hιi h + rw [← hr' hx, ← hr' hy, h1] + have hΩE' : Ω ⊆ E := fun x hx => (hΩE hx).1 + set N := boundaryDrawing Γ Z with hN + have hNs : N.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + set L₀ : Set W := ⋃ r ∈ Z, closure r with hL₀ + have hNL : N.U ⊆ L₀ := boundary_subset_regions hS + have hL₀c : IsClosed L₀ := (hfin.subset hZ).isClosed_biUnion fun _ _ => isClosed_closure + have hL₀Ω : L₀ ⊆ Ω := fun x hx => (hsub hx).1 + have hNE : N.U ⊆ E := (hNL.trans hL₀Ω).trans hΩE' + have hne : E.Nonempty := ⟨p, hΩE' (hL₀Ω (mem_iUnion₂.mpr ⟨r₀, h₀, subset_closure hp⟩))⟩ + obtain ⟨M, hMU, hMV, hME⟩ := exists_transport hE.isCompact hne hτc hτi N hNE + obtain ⟨ρ, hρc, hρl⟩ := Surface.exists_inv_of_compactOn hE.isCompact hτc hτi + have hτρ : ∀ y ∈ τ '' E, τ (ρ y) = y := fun y hy => by + obtain ⟨x, hx, rfl⟩ := hy + rw [hρl hx] + obtain ⟨hΩ', hΩb⟩ := isClosedDisc_image hΩ (hτc.mono hΩE') (hτi.mono hΩE') + obtain ⟨hD₂, hD₂b⟩ := GM12.isClosedDisc_closure_compl_of_sphere hRc hRs hΩ' + set Ω' := τ '' Ω with hΩ'def + set D₂ := closure (univ \ Ω') with hD₂def + have hoffD : ∀ {x}, x ∉ Ω' → x ∈ discInt D₂ := fun {x} hx => ⟨subset_closure ⟨mem_univ x, hx⟩, + fun hb => hx (Surface.discBd_subset Ω' (hD₂b ▸ hb))⟩ + have hnotΩ : ∀ {x}, x ∈ discInt Ω' → x ∉ D₂ := fun {x} hx h => by + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp h _ (hΩ'.isOpen_discInt hRman) hx + exact hw2.2 hw1.1 + have hint₂ : ∀ {x}, x ∈ discInt D₂ → x ∉ Ω' := fun {x} hx h => by + refine hnotΩ ⟨h, fun hb => hx.2 ?_⟩ hx.1 + rw [hD₂b] + exact hb + have hτint : ∀ {z}, z ∈ discInt Ω → τ z ∈ discInt Ω' := fun {z} hz => ⟨mem_image_of_mem τ hz.1, + fun h => by + rw [hΩb] at h + obtain ⟨w, hw, he⟩ := h + exact hz.2 ((hτi (hΩE' (Surface.discBd_subset _ hw)) (hΩE' hz.1) he) ▸ hw)⟩ + -- the points of the layers off `N` form an open set + set L := τ '' L₀ with hL + have hLc : IsClosed L := ((hL₀c.isCompact).image_of_continuousOn (hτc.mono + (hL₀Ω.trans hΩE'))).isClosed + have hLΩ : L ⊆ Ω' := image_mono hL₀Ω + have hMoffL : ∀ {y}, y ∈ L₀ → y ∉ N.U → τ y ∉ M.U := fun {y} hy h1 h2 => by + rw [hMU] at h2 + obtain ⟨w, hw, he⟩ := h2 + exact h1 (hτi (hNE hw) (hΩE' (hL₀Ω hy)) he ▸ hw) + have hYo : IsOpen (L \ M.U) := by + refine isOpen_iff_forall_mem_open.mpr fun x hx => ?_ + obtain ⟨⟨y, hy, rfl⟩, hxM⟩ := hx + have hyN : y ∉ N.U := fun h => hxM (hMU ▸ mem_image_of_mem τ h) + have hyint := mem_interior_of_off_boundary hS hZ hy hyN + have hO : IsOpen (ρ ⁻¹' (interior L₀) ∩ discInt Ω') := by + have hρo : ContinuousOn ρ (discInt Ω') := hρc.mono fun z hz => image_mono hΩE' hz.1 + rw [inter_comm] + exact hρo.isOpen_inter_preimage (hΩ'.isOpen_discInt hRman) isOpen_interior + refine ⟨(ρ ⁻¹' (interior L₀) ∩ discInt Ω') ∩ M.Uᶜ, ?_, hO.inter M.isClosed_U.isOpen_compl, + ⟨?_, hτint (hsub hy)⟩, hxM⟩ + · rintro z ⟨⟨hz1, hz2⟩, hz3⟩ + refine ⟨?_, hz3⟩ + obtain ⟨w, hw, rfl⟩ := hz2.1 + have h4 : ρ (τ w) = w := hρl (hΩE' hw) + exact mem_image_of_mem τ (h4 ▸ interior_subset hz1 : w ∈ L₀) + · change ρ (τ y) ∈ interior L₀ + rw [hρl (hΩE' (hL₀Ω hy))] + exact hyint + obtain ⟨a, ha⟩ := hD₂.nonempty_discInt + have haΩ := hint₂ ha + have hpL : p ∈ L₀ := mem_iUnion₂.mpr ⟨r₀, h₀, subset_closure hp⟩ + have hpU : p ∉ Γ.U := fun h => by + obtain ⟨x, -, hx⟩ := (mem_R_iff Γ).mp (hZ h₀) + exact (connectedComponentIn_subset _ _ (hx ▸ hp : p ∈ connectedComponentIn (univ \ Γ.U) x)).2 h + have hpM : τ p ∉ M.U := hMoffL hpL fun h => hpU (hNs.U_subset h) + have hUQ : M.U ⊆ ({τ p, a} : Set R)ᶜ := fun x hx h => by + rcases h with rfl | rfl + · exact hpM hx + · refine haΩ ?_ + rw [hMU] at hx + obtain ⟨w, hw, rfl⟩ := hx + exact mem_image_of_mem τ (hL₀Ω (hNL hw)) + have hnot : ¬ ∀ F, IsOArc F → F ⊆ M.U → ∃ Δ, IsClosedDisc Δ ∧ Δ ⊆ ({τ p, a} : Set R)ᶜ ∧ discBd Δ + = F := fun h => by + obtain ⟨r, hr, har, hpr⟩ := same_region_of_discs (Q := ({τ p, a} : Set R)ᶜ) (a := a) (b + := τ p) hRc hRs (by simp) (by simp) _ M rfl hUQ h + have hrM : ∀ {x}, x ∈ r → x ∉ M.U := fun {x} hx h1 => by + obtain ⟨y, -, hy⟩ := (mem_R_iff M).mp hr + exact (connectedComponentIn_subset _ _ (hy ▸ hx : x ∈ connectedComponentIn + (univ \ M.U) y)).2 h1 + have hsubY : r ⊆ L \ M.U := by + refine IsPreconnected.subset_left_of_subset_union (v := (closure + (L \ M.U))ᶜ) hYo isClosed_closure.isOpen_compl ?_ ?_ ?_ (region_isPreconnected hr) + · exact disjoint_left.mpr fun x h1 h2 => h2 (subset_closure h1) + · intro x hx + by_cases hc : x ∈ closure (L \ M.U) + · exact .inl ⟨closure_minimal sdiff_subset hLc hc, hrM hx⟩ + · exact .inr hc + · exact ⟨τ p, hpr, mem_image_of_mem τ hpL, hpM⟩ + exact haΩ (hLΩ (hsubY har).1) + push Not at hnot + obtain ⟨F, hF, hFU, hno⟩ := hnot + obtain ⟨C', hC', hC's, hC'U⟩ := exists_circuit_of_oArc hF hFU + obtain ⟨Δ₁, Δ₂, -, hΔ₁, hΔ₂, hb₁, hb₂, hcup, hcap, -, -⟩ := sphere_disc R hRs F hF + have hpF : τ p ∉ F := fun h => hUQ (hFU h) (.inl rfl) + have haF : a ∉ F := fun h => hUQ (hFU h) (.inr rfl) + have hhit : ∀ Δ, IsClosedDisc Δ → discBd Δ = F → τ p ∈ Δ ∨ a ∈ Δ := fun Δ h1 h2 => by + by_contra hn + push Not at hn + refine hno Δ h1 (fun x hx h3 => ?_) h2 + rcases h3 with rfl | rfl + · exact hn.1 hx + · exact hn.2 hx + have hex : ∃ D', IsClosedDisc D' ∧ discBd D' = F ∧ τ p ∈ D' ∧ a ∉ D' := by + have hcovp : τ p ∈ Δ₁ ∪ Δ₂ := hcup ▸ mem_univ _ + by_cases h1 : τ p ∈ Δ₁ + · refine ⟨Δ₁, hΔ₁, hb₁, h1, fun h2 => ?_⟩ + rcases hhit Δ₂ hΔ₂ hb₂ with h3 | h3 + · exact hpF (hcap ▸ ⟨h1, h3⟩) + · exact haF (hcap ▸ ⟨h2, h3⟩) + · have h2 : τ p ∈ Δ₂ := hcovp.resolve_left h1 + have h3 : a ∈ Δ₁ := (hhit Δ₁ hΔ₁ hb₁).resolve_left h1 + exact ⟨Δ₂, hΔ₂, hb₂, h2, fun h4 => haF (hcap ▸ ⟨h3, h4⟩)⟩ + obtain ⟨D', hD', hD'b, hpD', haD'⟩ := hex + have hD'Ω : D' ⊆ Ω' := fun x hx => by + by_contra hn + have hf : Disjoint (discInt D₂) (discBd D') := by + rw [hD'b, disjoint_left] + intro y hy1 hy2 + refine hint₂ hy1 ?_ + have := hFU hy2 + rw [hMU] at this + obtain ⟨w, hw, rfl⟩ := this + exact mem_image_of_mem τ (hL₀Ω (hNL hw)) + exact haD' (side_of_disc hRc hD₂ hD' hf (hoffD hn) ha hx) + have hEsub : Ω' ⊆ τ '' E := image_mono hΩE' + have hρcon : ContinuousOn ρ D' := hρc.mono (hD'Ω.trans hEsub) + have hρinj : InjOn ρ D' := fun x hx y hy e => by + rw [← hτρ x (hEsub (hD'Ω hx)), ← hτρ y (hEsub (hD'Ω hy)), e] + obtain ⟨hD, hDb⟩ := isClosedDisc_image hD' hρcon hρinj + have hF' : F ⊆ D' := hD'b ▸ Surface.discBd_subset D' + have hC'Ub : C'.U ⊆ D' := hC'U ▸ hF' + obtain ⟨C, hCU, hCV, hCE⟩ := exists_transport C'.isClosed_U.isCompact (isConnected_of_isOArc + (hC'U ▸ hF)).nonempty (hρcon.mono hC'Ub) (hρinj.mono hC'Ub) C' subset_rfl + have hρM : ∀ {x}, x ∈ N.U → ρ (τ x) = x := fun {x} hx => hρl (hNE hx) + have hCsub : C.IsSubdrawing N := by + refine ⟨?_, ?_⟩ + · rw [hCV] + rintro _ ⟨y, hy, rfl⟩ + have h6 := hC's.1 hy + rw [hMV] at h6 + obtain ⟨x, hx, rfl⟩ := h6 + rwa [hρM (N.V_subset_U hx)] + · rw [hCE] + rintro _ ⟨f, hf, rfl⟩ + have h6 := hC's.2 hf + rw [hME] at h6 + obtain ⟨e, he, rfl⟩ := h6 + have hee : e ⊆ N.U := fun z hz => N.closure_subset_U he (subset_closure hz) + have h7 : image ρ (image τ e) = e := by + rw [image_image] + exact (image_congr fun z hz => hρM (hee hz)).trans (image_id' e) + rwa [h7] + have hbd : discBd (ρ '' D') = C.U := by + rw [hDb, hD'b, hCU, hC'U] + have hO : IsOArc C.U := hbd ▸ hD.isOArc_discBd + obtain ⟨X, h3, h4, h5⟩ := exists_circuit_of_oArc hO (hCsub.U_subset.trans hNs.U_subset) + have hCΓ := hCsub.trans hNs + have hV : X.V = C.V := subset_antisymm (fun x hx => mem_V_of_subdrawing hCΓ + (h5 ▸ X.V_subset_U hx) (h4.1 hx)) fun x hx => mem_V_of_subdrawing h4 + (h5.symm ▸ C.V_subset_U hx) (hCΓ.1 hx) + have hEq : X.E = C.E := by + unfold Drawing.E + rw [h5, hV] + have hXC : X = C := Drawing.ext_of_V_E hV hEq + refine ⟨C, ρ '' D', hXC ▸ h3, hCsub, hD, hbd, ⟨τ p, hpD', hρl (hΩE' (hL₀Ω hpL))⟩, ?_⟩ + rintro _ ⟨y, hy, rfl⟩ + obtain ⟨z, hz, rfl⟩ := hD'Ω hy + rw [hρl (hΩE' hz)] + exact hz + +/-- In a sphere, a disc whose boundary lies inside another disc, with a point off both, lies in the +other disc. -/ +theorem disc_subset_of_sphere {R : Type} [TopologicalSpace R] [T2Space R] + (hS : IsClosedSurface R) (hsph : IsSphere R) {D D' : Set R} (hD : IsClosedDisc D) + (hD' : IsClosedDisc D') {a : R} (ha : a ∉ D) (ha' : a ∉ D') + (hb : discBd D ⊆ interior D') : D ⊆ D' := by + have hfrD : frontier D = discBd D := IsClosedDisc.frontier_eq_discBd hS hD + obtain ⟨hE, hbE⟩ := GM12.isClosedDisc_closure_compl_of_sphere hS hsph hD' + have hcompl : discInt (closure (univ \ D')) = D'ᶜ := by + ext x + have hfx : x ∈ discBd D' ↔ x ∈ closure D' ∩ closure D'ᶜ := by + rw [← IsClosedDisc.frontier_eq_discBd hS hD', frontier_eq_closure_inter_closure] + rw [discInt, hbE, mem_sdiff, hfx, hD'.isClosed.closure_eq, ← compl_eq_univ_sdiff] + constructor + · rintro ⟨h1, h2⟩ h3 + exact h2 ⟨h3, h1⟩ + · intro h + exact ⟨subset_closure h, fun h3 => h h3.1⟩ + have hX : IsPreconnected D'ᶜ := hcompl ▸ hE.isPreconnected_discInt + have hdis2 : Disjoint D'ᶜ (frontier D) := by + rw [hfrD] + exact disjoint_left.mpr fun x h1 h2 => h1 (interior_subset (hb h2)) + rcases inside_or_outside hX hD.isClosed hdis2 with h | h + · exact absurd (interior_subset (h ha')) ha + · exact fun x hx => by + by_contra hn + exact h hn hx + +/-- **Two discs in a disc.** If two discs lie in a disc `Ω`, and the boundary of the first lies +inside the second, then the first lies in the second. -/ +theorem disc_subset_of_disc {X : Type*} [TopologicalSpace X] [T2Space X] + (hman : ∀ x : X, IsManifoldPoint x) {Ω D D' : Set X} (hΩ : IsClosedDisc Ω) + (hint : ∀ x ∈ discBd Ω, IsInteriorPoint x) (hD : IsClosedDisc D) (hD' : IsClosedDisc D') + (hDΩ : D ⊆ Ω) (hD'Ω : D' ⊆ Ω) + (hb : discBd D ⊆ discInt D') : D ⊆ D' := by + obtain ⟨E, hE, hΩE, -⟩ := Surface.exists_disc_around hman hΩ hint isOpen_univ (subset_univ _) + obtain ⟨q⟩ := hΩ.isOArc_discBd + obtain ⟨c, c', hcc, hcc', hm, hm', hl, hr', hcE, hcb, -⟩ := exists_disc_collar hΩ hE hΩE q + obtain ⟨R, tR, ι, hR2, hRc, hRs, hιc, hιi⟩ := exists_sphere_chart + have : ConnectedSpace R := by + obtain ⟨e⟩ := hRs + exact e.symm.surjective.connectedSpace e.symm.continuous + have hRman : ∀ x : R, IsManifoldPoint x := fun x => (hRc.2.2 x).isManifoldPoint + let τ : X → R := ι ∘ c' + have hτc : ContinuousOn τ E := hιc.comp_continuousOn hcc' + have hτi : InjOn τ E := fun x hx y hy h => by + have h1 : c' x = c' y := hιi h + rw [← hr' hx, ← hr' hy, h1] + have hΩE' : Ω ⊆ E := fun x hx => (hΩE hx).1 + obtain ⟨hΩ', -⟩ := isClosedDisc_image hΩ (hτc.mono hΩE') (hτi.mono hΩE') + obtain ⟨hD₂, hD₂b⟩ := GM12.isClosedDisc_closure_compl_of_sphere hRc hRs hΩ' + obtain ⟨a, ha⟩ := hD₂.nonempty_discInt + have haΩ : a ∉ τ '' Ω := fun h => by + have h1 : a ∈ discInt (τ '' Ω) := ⟨h, fun hb' => ha.2 (hD₂b ▸ hb')⟩ + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp ha.1 _ (hΩ'.isOpen_discInt hRman) h1 + exact hw2.2 hw1.1 + obtain ⟨h1, h2⟩ := isClosedDisc_image hD (hτc.mono (hDΩ.trans hΩE')) (hτi.mono (hDΩ.trans hΩE')) + obtain ⟨h3, h4⟩ := isClosedDisc_image hD' (hτc.mono (hD'Ω.trans hΩE')) (hτi.mono + (hD'Ω.trans hΩE')) + have hin : discBd (τ '' D) ⊆ interior (τ '' D') := by + rw [h2] + rintro _ ⟨y, hy, rfl⟩ + exact interior_maximal (discInt_subset _) (h3.isOpen_discInt hRman) (by + refine ⟨mem_image_of_mem τ (hb hy).1, fun h5 => ?_⟩ + rw [h4] at h5 + obtain ⟨w, hw, he⟩ := h5 + exact (hb hy).2 ((hτi (hΩE' (hD'Ω (Surface.discBd_subset _ hw))) + (hΩE' (hDΩ (Surface.discBd_subset _ hy))) he) ▸ hw)) + have hsub := disc_subset_of_sphere hRc hRs h1 h3 (fun h => haΩ (image_mono hDΩ h)) (fun h => haΩ + (image_mono hD'Ω h)) hin + intro x hx + obtain ⟨y, hy, he⟩ := hsub (mem_image_of_mem τ hx) + exact hτi (hΩE' (hD'Ω hy)) (hΩE' (hDΩ hx)) he ▸ hy + +/-- **A disc with its boundary in a smaller disc.** If a disc `D` lies in a disc `Ω` of a closed +surface, and the boundary of `D` lies in a disc `Δ` strictly inside `Ω`, then `D` lies in `Δ`. The +reason is that `Ω` without `Δ` is connected, misses the boundary of `D`, and has a point off `D`. -/ +theorem disc_subset_of_bd_in_disc {X : Type} [TopologicalSpace X] [T2Space X] + (hS : IsClosedSurface X) {Ω Δ D : Set X} (hΩ : IsClosedDisc Ω) (hΔ : IsClosedDisc Δ) + (hD : IsClosedDisc D) (hin : Δ ⊆ Ω \ discBd Ω) (hDΩ : D ⊆ Ω) (hb : discBd D ⊆ Δ) : D ⊆ Δ := by + have hman : ∀ x : X, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + obtain ⟨q⟩ := hΔ.isOArc_discBd + obtain ⟨c, c', hcc, hcc', hm, hm', hl, hr', hcE, hcb, -⟩ := exists_disc_collar hΔ hΩ hin q + -- the part of `Ω` off `Δ` + let A : Set ℂ := Metric.closedBall 0 2 \ Metric.closedBall 0 1 + have hAc : IsPreconnected A := by + have hs : IsPreconnected (Metric.sphere (0 : ℂ) 1) := isPreconnected_sphere (by + rw [Complex.rank_real_complex] + norm_num) 0 1 + have : A = (fun w : ℝ × ℂ => (w.1 : ℂ) * w.2) '' (Set.Ioc 1 2 ×ˢ Metric.sphere (0 : ℂ) 1) := by + ext z + simp only [A, mem_sdiff, Metric.mem_closedBall, dist_zero_right, mem_image, mem_prod, + mem_Ioc, Prod.exists, not_le, mem_sphere_zero_iff_norm] + constructor + · rintro ⟨h1, h2⟩ + have h0 : (‖z‖ : ℂ) ≠ 0 := by + exact_mod_cast (by linarith : ‖z‖ ≠ 0) + refine ⟨‖z‖, z / ‖z‖, ⟨⟨h2, h1⟩, ?_⟩, by field_simp⟩ + rw [norm_div, Complex.norm_real, norm_norm, div_self (by linarith)] + · rintro ⟨r, w, ⟨⟨h1, h2⟩, h3⟩, rfl⟩ + simp only [norm_mul, h3, mul_one, Complex.norm_real, Real.norm_eq_abs] + rw [abs_of_pos (by linarith)] + exact ⟨h2, h1⟩ + rw [this] + refine (isPreconnected_Ioc.prod hs).image _ ?_ + refine Continuous.continuousOn ?_ + fun_prop + have hAs : A ⊆ Metric.closedBall 0 2 := sdiff_subset + have hcA : ContinuousOn c A := hcc.mono hAs + have hX : IsPreconnected (c '' A) := hAc.image c hcA + have hA1 : ∀ x ∈ Δ, x ∈ c '' Metric.closedBall 0 1 := fun x hx => hcE ▸ hx + have hoff : Disjoint (c '' A) Δ := disjoint_left.mpr fun x hx h1 => by + obtain ⟨z, hz, rfl⟩ := hx + obtain ⟨z', hz', he⟩ := hA1 _ h1 + have hz'2 : z' ∈ Metric.closedBall (0 : ℂ) 2 := Metric.closedBall_subset_closedBall + (by norm_num) hz' + have : z' = z := by rw [← hl hz'2, he, hl hz.1] + exact hz.2 (this ▸ hz') + have hfr : frontier D = discBd D := IsClosedDisc.frontier_eq_discBd hS hD + have hdis : Disjoint (c '' A) (frontier D) := by + rw [hfr] + exact hoff.mono_right hb + -- a boundary point of `Ω` is off `D` + have hne : (Metric.sphere (0 : ℂ) 2).Nonempty := ⟨2, by simp⟩ + obtain ⟨z₂, hz₂⟩ := hne + have hyb : c z₂ ∈ discBd Ω := hcb ▸ mem_image_of_mem c hz₂ + have hyA : c z₂ ∈ c '' A := by + refine ⟨z₂, ⟨Metric.sphere_subset_closedBall hz₂, fun h1 => ?_⟩, rfl⟩ + have h2 : ‖z₂‖ = 2 := by simpa using hz₂ + have h3 : ‖z₂‖ ≤ 1 := by simpa using h1 + linarith + have hyD : c z₂ ∉ D := fun h1 => by + by_cases h2 : c z₂ ∈ discBd D + · exact disjoint_left.mp hdis hyA (hfr ▸ h2) + · exact (discInt_mono hman hD hDΩ ⟨h1, h2⟩).2 hyb + rcases inside_or_outside hX hD.isClosed hdis with h | h + · exact absurd (interior_subset (h hyA)) hyD + · intro x hx + have hxΩ := hDΩ hx + by_contra hxn + have hc2 := hm' hxΩ + have hne1 : c' x ∉ Metric.closedBall (0 : ℂ) 1 := fun h1 => hxn (hcE ▸ ⟨c' x, h1, hr' hxΩ⟩) + exact h ⟨c' x, ⟨hc2, hne1⟩, hr' hxΩ⟩ hx + +/-- **The nest of the layers in a disc.** If the first `s` layers around a region lie strictly +inside a disc of a closed surface, they give `s` disjoint nested circuits. -/ +theorem exists_region_nest_in_disc [ConnectedSpace W] (hS : IsClosedSurface W) {Γ : Drawing W} {r₀ + : Set W} (h₀ : r₀ ∈ Γ.R) {p : W} (hp : p ∈ r₀) {Ω : Set W} (hΩ : IsClosedDisc Ω) {s : ℕ} + (hsub : ∀ t < s, ⋃ r ∈ regLayer Γ r₀ t, closure r ⊆ discInt Ω) : + ∃ (C : Fin s → Drawing W) (D : Fin s → Set W), (∀ t, (C t).IsCircuit ∧ (C t).IsSubdrawing + (boundaryDrawing Γ (regLayer Γ r₀ t)) ∧ IsClosedDisc (D t) ∧ discBd (D t) = (C t).U ∧ p ∈ D t + ∧ D t ⊆ Ω) ∧ + ∀ t t', t < t' → Disjoint (C t).V (C t').V ∧ D t ⊆ D t' := by + classical + have hman : ∀ x : W, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hex : ∀ t : Fin s, ∃ (C : Drawing W) (D : Set W), C.IsCircuit ∧ C.IsSubdrawing + (boundaryDrawing Γ (regLayer Γ r₀ t)) ∧ IsClosedDisc D ∧ discBd D = C.U ∧ p ∈ D ∧ D ⊆ Ω + := fun t => + exists_layer_circuit_in_disc hS (regLayer_subset h₀ t) (regLayer_mono + (Nat.zero_le t) rfl) hp hΩ (hsub t t.2) + choose C D hC hCs hD hb hpD hDΩ using hex + refine ⟨C, D, fun t => ⟨hC t, hCs t, hD t, hb t, hpD t, hDΩ t⟩, fun t t' htt => ?_⟩ + have hin : ∀ {x}, x ∈ (C t).U → x ∈ ⋃ r ∈ regLayer Γ r₀ t, closure r := fun {x} hx + => boundary_subset_layer hS ((hCs t).U_subset hx) + have hfr' : frontier (D t') = (C t').U := by + rw [IsClosedDisc.frontier_eq_discBd hS (hD t'), hb t'] + have hoff : ∀ {x}, x ∈ (C t').U → x ∈ ⋃ r ∈ regLayer Γ r₀ t, closure r → False := fun {x} hx h + => boundary_off_layer hS h₀ (Fin.lt_def.mp htt) ((hCs t').U_subset hx) h + refine ⟨disjoint_left.mpr fun x h1 h2 => hoff ((C t').V_subset_U h2) (hin + ((C t).V_subset_U h1)), ?_⟩ + have hL := isPreconnected_layer h₀ t + have hpL : p ∈ ⋃ r ∈ regLayer Γ r₀ t, closure r := mem_iUnion₂.mpr ⟨r₀, regLayer_mono + (Nat.zero_le _) rfl, subset_closure hp⟩ + have hdis : Disjoint (⋃ r ∈ regLayer Γ r₀ t, closure r) (frontier (D t')) := by + rw [hfr'] + exact disjoint_left.mpr fun x h1 h2 => hoff h2 h1 + have hint : (⋃ r ∈ regLayer Γ r₀ t, closure r) ⊆ interior (D t') := by + rcases inside_or_outside hL (hD t').isClosed hdis with h | h + · exact h + · exact absurd (hpD t') (h hpL) + refine disc_subset_of_disc hman hΩ (fun x _ => hS.2.2 x) (hD t) (hD t') (hDΩ t) (hDΩ t') fun x hx + => ?_ + have h1 := hint (hin (hb t ▸ hx)) + refine ⟨interior_subset h1, fun h2 => ?_⟩ + rw [← IsClosedDisc.frontier_eq_discBd hS (hD t')] at h2 + exact h2.2 h1 + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffLift.lean b/LeanPool/GraphMinor/GM07/CuffLift.lean new file mode 100644 index 0000000000..802c9f0839 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffLift.lean @@ -0,0 +1,556 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffCollapse +public import LeanPool.GraphMinor.GM07.PushForest + +/-! +# From the graph after the collapse back to the graph + +Graph Minors VII, (5.9), page 236: "if it is $G'$-feasible then $H$ is $G$-feasible". The map `ρ` +carries the edges of `G₁` to the edges of `G'`. It collapses a tree `Tr x` of `G`, built from a path +`N_i(C)` and a path `Q_i(C)`, to the vertex `x` of the cuff. A forest in `G'` lifts to a forest in +`G`, by taking the edges that map to it and all the trees. Since `ρ` is homotopic to the identity, +the lift has the same homotopy class. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The facts on the collapse map that we use to lift a forest. -/ +structure IsCollapse (G G₁ G' : Drawing S) (ρ : S → S) (Ψ : unitInterval × S → S) (X A : Set S) + (Tr : S → Drawing S) : Prop where + contΨ : Continuous Ψ + zero : ∀ x, Ψ (0, x) = x + one : ∀ x, Ψ (1, x) = ρ x + fix : ∀ x ∈ X, ∀ τ, Ψ (τ, x) = x + inj : ∀ x ∈ A, ∀ y, ρ y = ρ x → y = x + sub : G₁.IsSubdrawing G + off : G₁.U \ G₁.V ⊆ A + imU : G'.U = ρ '' G₁.U + imV : G'.V = ρ '' G₁.V + imE : G'.E = image ρ '' G₁.E + X_eq : X = G.V ∩ bd S + vert : ∀ v ∈ G₁.V, v ∈ A ∨ (ρ v ∈ X ∧ v ∈ (Tr (ρ v)).V) + tree : ∀ x ∈ X, (Tr x).IsSubdrawing G ∧ IsGraphForest (Tr x).toGraph ∧ x ∈ (Tr x).V ∧ (∀ a ∈ + (Tr x).U, ρ a = x) ∧ ∀ a ∈ (Tr x).V, ∀ b ∈ (Tr x).V, Nonempty (GraphWalk (Tr x).toGraph a b) + +variable {G G₁ G' H : Drawing S} {ρ : S → S} {Ψ : unitInterval × S → S} {X A : Set S} {Tr : S + → Drawing S} + +/-- A curve is homotopic to its image by `ρ`, if its ends are in `X`. -/ +theorem IsCollapse.curvesHomotopic (h : IsCollapse G G₁ G' ρ Ψ X A Tr) {φ φ' : Curve S} + (h0 : φ 0 ∈ X) (h1 : φ 1 ∈ X) (he : ∀ u, φ' u = ρ (φ u)) : CurvesHomotopic φ φ' := by + have hc := h.contΨ + refine ⟨⟨fun q => Ψ (q.2, φ q.1), by fun_prop⟩, fun _ => mem_univ _, fun x => h.zero _, + fun x => ?_, fun y => h.fix _ h0 _, fun y => ?_, fun y => h.fix _ h1 _, fun y => ?_⟩ + · change Ψ (1, φ x) = φ' x + rw [h.one, he] + · change Ψ (y, φ 0) = φ' 0 + rw [h.fix _ h0, he, ← h.one, h.fix _ h0] + · change Ψ (y, φ 1) = φ' 1 + rw [h.fix _ h1, he, ← h.one, h.fix _ h1] + +variable [T2Space S] + +private theorem forest_lift_maps_into_forest + {S : Type u} + [TopologicalSpace S] + [T1Space S] + {G : Drawing S} + {G₁ : Drawing S} + {ρ : S → S} + {X : Set S} + {Tr : S → Drawing S} + (H₂ : Drawing S) + (hXV : ∀ x ∈ X, x ∈ H₂.V) : + let E₁ : Set (Set S) := {e | e ∈ G₁.E ∧ ρ '' e ∈ H₂.E} + ∀ (VF : Set S), + let EF : Set (Set S) := E₁ ∪ ⋃ x ∈ X, (Tr x).E + (∀ x ∈ X, ∀ a ∈ (Tr x).U, ρ a = x) → + (∀ e ∈ G₁.E, ∀ z ∈ closure e, ρ z ∈ closure (ρ '' e)) → + let F : Drawing S := G.span VF EF + (∀ a ∈ F.V, ρ a ∈ H₂.V) → + ∀ (a : S), + (a ∈ F.U) → + ρ a ∈ H₂.U := by + intro E₁ VF EF hρT hclE F hFρ a ha + rcases ha with ha | ha + · exact H₂.V_subset_U (hFρ a ha) + · obtain ⟨e, he, ha⟩ := mem_iUnion₂.mp ha + rcases he.1 with he₁ | he₁ + · exact H₂.closure_subset_U he₁.2 (hclE e he₁.1 a ha) + · obtain ⟨x, hx, he₂⟩ := mem_iUnion₂.mp he₁ + rw [hρT x hx a ((Tr x).closure_subset_U he₂ ha)] + exact H₂.V_subset_U (hXV x hx) + +private theorem project_lifted_forest_walk + {S : Type u} + [TopologicalSpace S] + {ρ : S → S} + {X : Set S} + {Tr : S → Drawing S} + (H₂ : Drawing S) + (E₁ : Set (Set S)) + (F : Drawing S) + (hFρ : ∀ a ∈ F.V, ρ a ∈ H₂.V) + (hlink : ∀ {e : Set S} {a b : S}, e ∈ E₁ → F.toGraph.IsLink e a b → H₂.toGraph.IsLink (ρ '' e) + (ρ a) (ρ b)) + (htreeLink : ∀ {e : Set S} {a b : S}, e ∉ E₁ → F.toGraph.IsLink e a b → ρ a = ρ b ∧ ∃ x ∈ X, e + ∈ (Tr x).E ∧ a ∈ (Tr x).V ∧ b ∈ (Tr x).V) + (himage : ∀ {e e' : Set S}, e ∈ E₁ → e' ∈ E₁ → ρ '' e = ρ '' e' → e = e') : + ∀ {u v : S} (R : GraphWalk F.toGraph u v), R.edges.Nodup → ∃ R' : GraphWalk H₂.toGraph (ρ u) + (ρ v), + R'.edges.Nodup ∧ (∀ e' ∈ + R'.edges, ∃ e ∈ R.edges, e ∈ E₁ ∧ e' = ρ '' e) ∧ ∀ e ∈ R.edges, e ∈ E₁ → ρ '' e ∈ R'.edges + := by + intro u v R + induction R with + | @nil v hv => + intro _ + exact ⟨.nil (hFρ v hv), by simp [GraphWalk.edges], by simp [GraphWalk.edges], + by simp [GraphWalk.edges]⟩ + | @cons u w v e hl rest ih => + intro hn + have hn' : e ∉ rest.edges ∧ rest.edges.Nodup := by + simpa [GraphWalk.edges] using hn + obtain ⟨R', h1, h2, h3⟩ := ih hn'.2 + by_cases he : e ∈ E₁ + · refine ⟨.cons (hlink he hl) R', ?_, ?_, ?_⟩ + · refine List.nodup_cons.mpr ⟨fun h4 => ?_, h1⟩ + obtain ⟨e₀, he₀, he₁, h5⟩ := h2 _ h4 + exact hn'.1 (himage he he₁ h5 ▸ he₀) + · intro e' he' + rcases List.mem_cons.mp he' with rfl | he' + · exact ⟨e, List.mem_cons_self, he, rfl⟩ + · obtain ⟨e₀, he₀, he₁, h5⟩ := h2 _ he' + exact ⟨e₀, List.mem_cons_of_mem _ he₀, he₁, h5⟩ + · intro e₀ he₀ he₁ + rcases List.mem_cons.mp he₀ with rfl | he₀ + · exact List.mem_cons_self + · exact List.mem_cons_of_mem _ (h3 e₀ he₀ he₁) + · have h4 := (htreeLink he hl).1 + rw [h4] + refine ⟨R', h1, fun e' he' => ?_, fun e₀ he₀ he₁ => ?_⟩ + · obtain ⟨e₀, he₀, he₁, h5⟩ := h2 _ he' + exact ⟨e₀, List.mem_cons_of_mem _ he₀, he₁, h5⟩ + · rcases List.mem_cons.mp he₀ with rfl | he₀ + · exact absurd he₁ he + · exact h3 e₀ he₀ he₁ + +private theorem walk_without_uncontracted_edges_stays_in_tree + {S : Type u} + [TopologicalSpace S] + {ρ : S → S} + {X : Set S} + {Tr : S → Drawing S} + (E₁ : Set (Set S)) + (hρT : ∀ x ∈ X, ∀ a ∈ (Tr x).U, ρ a = x) + (F : Drawing S) + (htreeLink : ∀ {e : Set S} {a b : S}, e ∉ E₁ → F.toGraph.IsLink e a b → ρ a = ρ b ∧ ∃ x ∈ X, e + ∈ (Tr x).E ∧ a ∈ (Tr x).V ∧ b ∈ (Tr x).V) : + ∀ {u v : S} (R : GraphWalk F.toGraph u v), (∀ e ∈ R.edges, e ∉ E₁) → ∀ x ∈ X, u ∈ (Tr x).V → + (∀ z ∈ R.support, z ∈ (Tr x).V) ∧ ∀ e ∈ R.edges, e ∈ (Tr x).E := by + intro u v R + induction R with + | @nil v hv => + intro _ x _ hu + exact ⟨by simpa [GraphWalk.support] using hu, by simp [GraphWalk.edges]⟩ + | @cons u w v e hl rest ih => + intro hE x hx hu + have he : e ∉ E₁ := hE e List.mem_cons_self + obtain ⟨-, x', hx', h1, h2, h3⟩ := htreeLink he hl + have hxx : x' = x := by + rw [← hρT x' hx' u ((Tr x').V_subset_U h2), hρT x hx u ((Tr x).V_subset_U hu)] + subst hxx + obtain ⟨h4, h5⟩ := ih (fun f hf => hE f (List.mem_cons_of_mem _ hf)) x' hx h3 + refine ⟨fun z hz => ?_, fun f hf => ?_⟩ + · rcases List.mem_cons.mp hz with rfl | hz + · exact hu + · exact h4 z hz + · rcases List.mem_cons.mp hf with rfl | hf + · exact h1 + · exact h5 f hf + +private theorem lift_is_graph_forest + {S : Type u} + [TopologicalSpace S] + {G : Drawing S} + {G₁ : Drawing S} + {G' : Drawing S} + {ρ : S → S} + {Ψ : ↑unitInterval × S → S} + {X : Set S} + {A : Set S} + {Tr : S → Drawing S} + (h : IsCollapse G G₁ G' ρ Ψ X A Tr) + (H₂ : Drawing S) + (hH₂f : IsGraphForest H₂.toGraph) + (E₁ : Set (Set S)) + (F : Drawing S) + (hTF : ∀ x ∈ X, (Tr x).IsSubdrawing F) + (htreeLink : ∀ {e : Set S} {a b : S}, e ∉ E₁ → F.toGraph.IsLink e a b → ρ a = ρ b ∧ ∃ x ∈ X, e + ∈ (Tr x).E ∧ a ∈ (Tr x).V ∧ b ∈ (Tr x).V) + (hproj : ∀ {u v : S} (R : GraphWalk F.toGraph u v), R.edges.Nodup → ∃ R' : GraphWalk H₂.toGraph + (ρ u) (ρ v), + R'.edges.Nodup ∧ (∀ + e' ∈ R'.edges, ∃ e ∈ R.edges, e ∈ E₁ ∧ e' = ρ '' e) ∧ ∀ e ∈ R.edges, e ∈ E₁ → ρ '' e ∈ + R'.edges) + (hstay : ∀ {u v : S} (R : GraphWalk F.toGraph u v), (∀ e ∈ R.edges, e ∉ E₁) → ∀ x ∈ X, u ∈ (Tr + x).V → (∀ z ∈ R.support, z ∈ (Tr x).V) ∧ ∀ e ∈ R.edges, e ∈ (Tr x).E) : + IsGraphForest F.toGraph := by + intro u W hW + obtain ⟨R', h1, h2, h3⟩ := hproj W hW.2 + have h4 := trail_length_of_eq hH₂f rfl R' h1 + have hR : R'.edges = [] := List.length_eq_zero_iff.mp h4 + have hnone : ∀ e ∈ W.edges, e ∉ E₁ := fun e he he₁ => by + have := h3 e he he₁ + rw [hR] at this + simp at this + by_contra hne + cases W with + | nil hv => exact hne rfl + | @cons u w _ e hl rest => + obtain ⟨-, x, hx, -, h5, -⟩ := htreeLink (hnone e List.mem_cons_self) hl + obtain ⟨h6, h7⟩ := hstay _ hnone x hx h5 + obtain ⟨W', h8, h9⟩ := (hTF x hx).exists_walk_down (GraphWalk.cons hl rest) h6 h7 + have h10 : W'.IsSimpleClosed := by + unfold GraphWalk.IsSimpleClosed + rw [h8, h9] + exact hW + have h11 := (h.tree x hx).2.1 _ W' h10 + apply hne + unfold GraphWalk.length at h11 ⊢ + rw [h9] at h11 + exact h11 + +private theorem lift_walk_between_fibres + {S : Type u} + [TopologicalSpace S] + {G : Drawing S} + {G₁ : Drawing S} + {G' : Drawing S} + {ρ : S → S} + {Ψ : ↑unitInterval × S → S} + {X : Set S} + {A : Set S} + {Tr : S → Drawing S} + (h : IsCollapse G G₁ G' ρ Ψ X A Tr) + (H₂ : Drawing S) + (hH₂G : H₂.IsSubdrawing G') : + let E₁ : Set (Set S) := {e | e ∈ G₁.E ∧ ρ '' e ∈ H₂.E} + let VF : Set S := (⋃ x ∈ X, (Tr x).V) ∪ {v | v ∈ G₁.V ∧ ρ v ∈ H₂.V} + let EF : Set (Set S) := E₁ ∪ ⋃ x ∈ X, (Tr x).E + (∀ e ∈ E₁, ∀ w ∈ closure e, w ∈ G.V → w ∈ G₁.V ∧ ρ w ∈ H₂.V) → + ∀ (F : Drawing S), + (F.V = VF) → + (F.E = EF) → + (F.IsSubdrawing G) → + (∀ e ∈ G₁.E, closure (ρ '' e) ∩ G'.V = ρ '' (closure e ∩ G₁.V)) → + (∀ a ∈ F.V, ∀ b ∈ F.V, ρ a = ρ b → Nonempty (GraphWalk F.toGraph a b)) → + ∀ {u v : S}, GraphWalk H₂.toGraph u v → ∀ a ∈ F.V, ρ a = u → ∀ b ∈ F.V, ρ b = v → Nonempty + (GraphWalk F.toGraph a b) := by + intro E₁ VF EF hVF F hFV hFE hFG hcap hfib u v R + induction R with + | @nil v hv => + intro a ha h1 b hb h2 + exact hfib a ha b hb (h1.trans h2.symm) + | @cons u w v e' hl rest ih => + intro a ha h1 b hb h2 + have he' : e' ∈ H₂.E := hl.1 + have he'G : e' ∈ G'.E := hH₂G.2 he' + rw [h.imE] at he'G + obtain ⟨e, he, rfl⟩ := he'G + have heE₁ : e ∈ E₁ := ⟨he, he'⟩ + obtain ⟨p, q, hpq⟩ : ∃ p q, closure e ∩ G₁.V = {p, q} := by + rcases G₁.edge_cond e he with ⟨p, q, -, h3, -⟩ | ⟨p, h3, -⟩ + · exact ⟨p, q, h3⟩ + · exact ⟨p, p, by rw [h3, pair_eq_singleton]⟩ + have hl' := hl.2.2.2 + have hco : closure (ρ '' e) ∩ H₂.V = closure (ρ '' e) ∩ G'.V := by + refine subset_antisymm (fun z hz => ⟨hz.1, hH₂G.1 hz.2⟩) fun z hz => ⟨hz.1, + mem_V_of_subdrawing hH₂G (H₂.closure_subset_U he' hz.1) hz.2⟩ + rw [hco, hcap e he, hpq, image_pair] at hl' + have hmem : ∀ z ∈ ({p, q} : Set S), z ∈ closure e ∩ G₁.V := fun z hz => hpq ▸ hz + have hFm : ∀ z ∈ ({p, q} : Set S), z ∈ F.V := fun z hz => hFV ▸ .inr (hVF e heE₁ z + (hmem z hz).1 (h.sub.1 (hmem z hz).2)) + have hlinkF : ∀ {y z}, y ∈ ({p, q} : Set S) → z ∈ ({p, q} : Set S) → ({y, z} : Set S) = {p, q} + → F.toGraph.IsLink e y z := fun {y z} hy hz he₂ => by + refine ⟨hFE ▸ .inl heE₁, hFm y hy, hFm z hz, ?_⟩ + rw [he₂, ← hpq] + refine subset_antisymm (fun w hw => ⟨hw.1, mem_V_of_subdrawing h.sub + (G₁.closure_subset_U he hw.1) (hFG.1 hw.2)⟩) fun w hw => ⟨hw.1, hFm w (hpq ▸ hw)⟩ + -- The two ends of the step. + have hend : ∃ y z, y ∈ ({p, q} : Set S) ∧ z ∈ ({p, q} : Set S) ∧ ({y, z} : Set S) = {p, q} + ∧ ρ y = u ∧ ρ z = w := by + rcases Set.pair_eq_pair_iff.mp hl' with ⟨h3, h4⟩ | ⟨h3, h4⟩ + · exact ⟨p, q, .inl rfl, .inr rfl, rfl, h3, h4⟩ + · exact ⟨q, p, .inr rfl, .inl rfl, pair_comm q p, h4, h3⟩ + obtain ⟨y, z, hy, hz, hyz, h3, h4⟩ := hend + obtain ⟨R₁⟩ := hfib a ha y (hFm y hy) (h1.trans h3.symm) + obtain ⟨R₂⟩ := ih z (hFm z hz) h4 b hb h2 + exact ⟨R₁.append (.cons (hlinkF hy hz hyz) R₂)⟩ + +private theorem boundary_fixed_image_membership + {S : Type u} + [TopologicalSpace S] + (β : S ≃ₜ S) + (hβ : ∀ x ∈ bd S, β x = x) + {B : Set S} + {x : S} + (hx : x ∈ bd S) : + x ∈ ⇑β '' B ↔ x ∈ B := by + constructor + · rintro ⟨y, hy, he⟩ + have : β y = β x := he.trans (hβ x hx).symm + rwa [← β.injective this] + · intro h + exact ⟨x, h, hβ x hx⟩ + +private theorem lifted_forest_span_vertices + {S : Type u} + [TopologicalSpace S] + {G : Drawing S} + {G₁ : Drawing S} + {G' : Drawing S} + {ρ : S → S} + {Ψ : ↑unitInterval × S → S} + {X : Set S} + {A : Set S} + {Tr : S → Drawing S} + (h : IsCollapse G G₁ G' ρ Ψ X A Tr) + (H₂ : Drawing S) : + let E₁ : Set (Set S) := {e | e ∈ G₁.E ∧ ρ '' e ∈ H₂.E} + let VF : Set S := (⋃ x ∈ X, (Tr x).V) ∪ {v | v ∈ G₁.V ∧ ρ v ∈ H₂.V} + let EF : Set (Set S) := E₁ ∪ ⋃ x ∈ X, (Tr x).E + (∀ x ∈ X, (Tr x).IsSubdrawing G) → + (∀ e ∈ E₁, ∀ w ∈ closure e, w ∈ G.V → w ∈ G₁.V ∧ ρ w ∈ H₂.V) → + G.spanV VF EF = VF := by + intro E₁ VF EF hTsub hVF + refine subset_antisymm ?_ ?_ + · rintro w (hw | hw) + · exact hw.1 + · obtain ⟨e, he, hw⟩ := mem_iUnion₂.mp hw + rcases he.1 with he₁ | he₁ + · exact .inr (hVF e he₁ w hw.1 hw.2) + · obtain ⟨x, hx, he₂⟩ := mem_iUnion₂.mp he₁ + exact .inl (mem_iUnion₂.mpr ⟨x, hx, mem_V_of_subdrawing (hTsub x hx) + ((Tr x).closure_subset_U he₂ hw.1) hw.2⟩) + · intro w hw + refine .inl ⟨hw, ?_⟩ + rcases hw with hw | hw + · obtain ⟨x, hx, hw⟩ := mem_iUnion₂.mp hw + exact (hTsub x hx).1 hw + · exact h.sub.1 hw.1 + +/-- **The lift of a forest.** -/ +theorem IsCollapse.isGFeasible [CompactSpace S] [T1Space S] (hS : IsSurface S) [ConnectedSpace S] + (h : IsCollapse G G₁ G' ρ Ψ X A Tr) (hG : G.IsProper) (hH : IsSurfaceForest H) (hV : H.V ∩ bd S + = X) (hfe : IsGFeasible G' H) : IsGFeasible G H := by + classical + obtain ⟨H₂, ⟨hH₂p, hH₂f⟩, ⟨β, hβ, hhom⟩, hH₂G⟩ := hfe + obtain ⟨hp₁, hp₂, hf₁, hf₂, hV₂, hpaths⟩ := hhom + have hbdβ : ∀ {B : Set S} {x : S}, x ∈ bd S → (x ∈ β '' B ↔ x ∈ B) := fun {B x} hx => by + exact boundary_fixed_image_membership (S := S) β hβ (B := B) (x := x) hx + have hV₃ : (mapDrawingHomeo β H).V ∩ bd S = H.V ∩ bd S := by + ext x + exact and_congr_left fun hx => hbdβ hx + have hXH₂ : H₂.V ∩ bd S = X := by + rw [← hV₂, hV₃, hV] + have hXV : ∀ x ∈ X, x ∈ H₂.V := fun x hx => (hXH₂.symm ▸ hx : x ∈ H₂.V ∩ bd S).1 + have hρX : ∀ x ∈ X, ρ x = x := fun x hx => by + rw [← h.one, h.fix x hx] + let E₁ : Set (Set S) := {e | e ∈ G₁.E ∧ image ρ e ∈ H₂.E} + let VF : Set S := (⋃ x ∈ X, (Tr x).V) ∪ {v | v ∈ G₁.V ∧ ρ v ∈ H₂.V} + let EF : Set (Set S) := E₁ ∪ ⋃ x ∈ X, (Tr x).E + have hTsub : ∀ x ∈ X, (Tr x).IsSubdrawing G := fun x hx => (h.tree x hx).1 + have hρT : ∀ x ∈ X, ∀ a ∈ (Tr x).U, ρ a = x := fun x hx => (h.tree x hx).2.2.2.1 + have hclE : ∀ e ∈ G₁.E, ∀ z ∈ closure e, ρ z ∈ closure (ρ '' e) := fun e _ z hz + => image_closure_subset_closure_image (by + have := h.contΨ + have hρc : Continuous ρ := by + have : ρ = fun x => Ψ (1, x) := funext fun x => (h.one x).symm + rw [this] + fun_prop + exact hρc) (mem_image_of_mem ρ hz) + have hρc : Continuous ρ := by + have := h.contΨ + have : ρ = fun x => Ψ (1, x) := funext fun x => (h.one x).symm + rw [this] + fun_prop + have hcl : ∀ e : Set S, closure (ρ '' e) = ρ '' closure e := fun e => + (image_closure_subset_closure_image hρc).antisymm' (closure_minimal (image_mono subset_closure) + (hρc.isClosedMap _ isClosed_closure)) + -- A vertex of `G` on an edge of `E₁` lies in `VF`. + have hVF : ∀ e ∈ E₁, ∀ w ∈ closure e, w ∈ G.V → w ∈ G₁.V ∧ ρ w ∈ H₂.V := fun e he w hw hwV => by + have h1 : w ∈ G₁.V := mem_V_of_subdrawing h.sub (G₁.closure_subset_U he.1 hw) hwV + refine ⟨h1, mem_V_of_subdrawing hH₂G (H₂.closure_subset_U he.2 (hclE e he.1 w hw)) + (h.imV ▸ mem_image_of_mem ρ h1)⟩ + have hEG : EF ⊆ G.E := by + rintro e (he | he) + · exact h.sub.2 he.1 + · obtain ⟨x, hx, he⟩ := mem_iUnion₂.mp he + exact (hTsub x hx).2 he + have hFV' : G.spanV VF EF = VF := by + exact lifted_forest_span_vertices (S := S) (G := G) (G₁ := G₁) (G' := G') (ρ := ρ) (Ψ := Ψ) (X + := X) (A := A) (Tr := Tr) h H₂ hTsub hVF + set F : Drawing S := G.span VF EF with hF + have hFV : F.V = VF := hFV' + have hFE : F.E = EF := by + rw [hF, G.span_E] + exact inter_eq_left.mpr hEG + have hFG : F.IsSubdrawing G := ⟨G.spanV_subset _ _, by rw [hFE]; exact hEG⟩ + have hTF : ∀ x ∈ X, (Tr x).IsSubdrawing F := fun x hx => ⟨fun w hw => hFV ▸ .inl + (mem_iUnion₂.mpr ⟨x, hx, hw⟩), fun e he => hFE ▸ .inr (mem_iUnion₂.mpr ⟨x, hx, he⟩)⟩ + have hFcase : ∀ a ∈ F.V, a ∈ A ∨ (ρ a ∈ X ∧ a ∈ (Tr (ρ a)).V) := fun a ha => by + rw [hFV] at ha + rcases ha with ha | ha + · obtain ⟨x, hx, ha⟩ := mem_iUnion₂.mp ha + have h1 := hρT x hx a ((Tr x).V_subset_U ha) + rw [← h1] at hx ha + exact .inr ⟨hx, ha⟩ + · exact h.vert a ha.1 + have hFρ : ∀ a ∈ F.V, ρ a ∈ H₂.V := fun a ha => by + rw [hFV] at ha + rcases ha with ha | ha + · obtain ⟨x, hx, ha⟩ := mem_iUnion₂.mp ha + rw [hρT x hx a ((Tr x).V_subset_U ha)] + exact hXV x hx + · exact ha.2 + have hFU : ∀ a ∈ F.U, ρ a ∈ H₂.U := fun a ha => by + exact forest_lift_maps_into_forest (S := S) (G := G) (G₁ := G₁) (ρ := ρ) (X := X) (Tr := Tr) + H₂ hXV VF hρT hclE hFρ a ha + have hFVb : F.V ∩ bd S = X := by + refine subset_antisymm ?_ ?_ + · rintro x ⟨hx, hb⟩ + rw [h.X_eq] + exact ⟨hFG.1 hx, hb⟩ + · intro x hx + exact ⟨(hTF x hx).1 (h.tree x hx).2.2.1, (h.X_eq ▸ hx : x ∈ G.V ∩ bd S).2⟩ + have hFp : F.IsProper := fun x hx => mem_V_of_subdrawing hFG hx.2 (hG ⟨hx.1, hFG.U_subset hx.2⟩) + -- A link over an edge of `E₁`. + have hcap : ∀ e ∈ G₁.E, closure (ρ '' e) ∩ G'.V = ρ '' (closure e ∩ G₁.V) := fun e he => by + rw [hcl, h.imV] + refine subset_antisymm ?_ (image_inter_subset _ _ _) + rintro _ ⟨⟨z, hz, rfl⟩, ⟨v, hv, hvz⟩⟩ + by_cases hzV : z ∈ G₁.V + · exact mem_image_of_mem ρ ⟨hz, hzV⟩ + · have h1 := h.inj z (h.off ⟨G₁.closure_subset_U he hz, hzV⟩) v hvz + exact absurd (h1 ▸ hv) hzV + have hlink : ∀ {e a b}, e ∈ E₁ → F.toGraph.IsLink e a b → H₂.toGraph.IsLink (ρ '' e) (ρ a) (ρ b) + := fun {e a b} he hl => by + have hg : G.toGraph.IsLink e a b := (hFG.isLink_iff (hFE ▸ .inl he)).mp hl + have hg₁ : G₁.toGraph.IsLink e a b := (h.sub.isLink_iff he.1).mpr hg + refine (hH₂G.isLink_iff he.2).mpr ⟨h.imE ▸ mem_image_of_mem _ he.1, + h.imV ▸ mem_image_of_mem ρ hg₁.2.1, h.imV ▸ mem_image_of_mem ρ hg₁.2.2.1, ?_⟩ + rw [hcap e he.1, hg₁.2.2.2, image_pair] + have htreeLink : ∀ {e a b}, e ∉ E₁ → F.toGraph.IsLink e a b → ρ a = ρ b ∧ ∃ x ∈ X, e ∈ (Tr x).E + ∧ a ∈ (Tr x).V ∧ b ∈ (Tr x).V := fun {e a b} he hl => by + have h1 : e ∈ EF := hFE ▸ hl.1 + rcases h1 with h1 | h1 + · exact absurd h1 he + · obtain ⟨x, hx, h2⟩ := mem_iUnion₂.mp h1 + have h3 := hl.2.2.2 + have ha : a ∈ closure e := (h3.symm ▸ mem_insert a {b} : a ∈ closure e ∩ F.V).1 + have hb : b ∈ closure e := (h3.symm ▸ mem_insert_of_mem a rfl : b ∈ closure e ∩ F.V).1 + have hcl' := (Tr x).closure_subset_U h2 + refine ⟨by rw [hρT x hx a (hcl' ha), hρT x hx b (hcl' hb)], x, hx, h2, mem_V_of_subdrawing + (hTsub x hx) (hcl' ha) (hFG.1 hl.2.1), mem_V_of_subdrawing (hTsub x hx) (hcl' hb) + (hFG.1 hl.2.2.1)⟩ + have himage : ∀ {e e' : Set S}, e ∈ G₁.E → e' ∈ G₁.E → image ρ e = image ρ e' → e = e' + := fun {e e'} he he' hi => by + have hA' : ∀ {f}, f ∈ G₁.E → f ⊆ A := fun {f} hf => (hf.2.1).trans h.off + have hsub : ∀ {f f' : Set S}, f ⊆ A → f' ⊆ A → image ρ f = image ρ f' → f ⊆ f' + := fun {f f'} h1 h2 h3 z hz => by + have h4 : ρ z ∈ ρ '' f' := h3 ▸ mem_image_of_mem ρ hz + obtain ⟨z', hz', he'⟩ := h4 + rw [← h.inj z (h1 hz) z' he'] + exact hz' + exact subset_antisymm (hsub (hA' he) (hA' he') hi) (hsub (hA' he') (hA' he) hi.symm) + -- The projection of a trail of `F`. + have hproj : ∀ {u v : S} (R : GraphWalk F.toGraph u v), R.edges.Nodup + → ∃ R' : GraphWalk H₂.toGraph (ρ u) (ρ v), R'.edges.Nodup ∧ (∀ e' ∈ R'.edges, ∃ e ∈ R.edges, e + ∈ E₁ ∧ e' = image ρ e) ∧ ∀ e ∈ R.edges, e ∈ E₁ → image ρ e ∈ R'.edges := by + exact project_lifted_forest_walk (S := S) (ρ := ρ) (X := X) (Tr := Tr) H₂ E₁ F hFρ + hlink htreeLink (fun he he' => himage he.1 he'.1) + have hstay : ∀ {u v : S} (R : GraphWalk F.toGraph u v), (∀ e ∈ R.edges, e ∉ E₁) → ∀ x ∈ X, u ∈ + (Tr x).V → (∀ z ∈ R.support, z ∈ (Tr x).V) ∧ ∀ e ∈ R.edges, e ∈ (Tr x).E := by + exact walk_without_uncontracted_edges_stays_in_tree (S := S) (ρ := ρ) (X := X) (Tr := Tr) E₁ + hρT F htreeLink + have hFf : IsGraphForest F.toGraph := by + exact lift_is_graph_forest (S := S) (G := G) (G₁ := G₁) (G' := G') (ρ := ρ) (Ψ := Ψ) (X := X) + (A := A) (Tr := Tr) h H₂ hH₂f E₁ F hTF htreeLink hproj hstay + have hfib : ∀ a ∈ F.V, ∀ b ∈ F.V, ρ a = ρ b → Nonempty (GraphWalk F.toGraph a b) + := fun a ha b hb he => by + rcases hFcase a ha with h1 | ⟨h1, h2⟩ + · rw [h.inj a h1 b he.symm] + exact ⟨.nil ha⟩ + · rcases hFcase b hb with h3 | ⟨-, h4⟩ + · rw [h.inj b h3 a he] + exact ⟨.nil hb⟩ + · rw [← he] at h4 + obtain ⟨R⟩ := (h.tree _ h1).2.2.2.2 a h2 b h4 + obtain ⟨R', -, -⟩ := (hTF _ h1).exists_walk_up R + exact ⟨R'⟩ + have hup : ∀ {u v : S} (R : GraphWalk H₂.toGraph u v), ∀ a ∈ F.V, ρ a = u → ∀ b ∈ F.V, ρ b = v + → Nonempty (GraphWalk F.toGraph a b) := by + exact lift_walk_between_fibres (S := S) (G := G) (G₁ := G₁) (G' := G') (ρ := ρ) (Ψ := Ψ) (X := + X) (A := A) (Tr := Tr) h H₂ hH₂G hVF F hFV hFE hFG hcap hfib + refine ⟨F, ⟨hFp, hFf⟩, ⟨β, hβ, (hH.map_homeo β).1, hFp, (hH.map_homeo β).2, hFf, + hV₃.trans (hV.trans hFVb.symm), ?_⟩, hFG⟩ + intro s hs₁ t ht₁ hne + have hsX : s ∈ X := by + rw [← hV, ← hV₃] + exact hs₁ + have htX : t ∈ X := by + rw [← hV, ← hV₃] + exact ht₁ + have hmemH : ∀ x ∈ X, x ∈ H₂.V ∩ bd S := fun x hx => hXH₂.symm ▸ hx + have hsF : s ∈ F.V := (hFVb.symm ▸ hsX : s ∈ F.V ∩ bd S).1 + have htF : t ∈ F.V := (hFVb.symm ▸ htX : t ∈ F.V ∩ bd S).1 + have hp := hpaths s hs₁ t ht₁ hne + have hdown : ∀ P₂ : GraphWalk F.toGraph s t, P₂.IsSimple → ∃ R : GraphWalk H₂.toGraph s t, + R.IsSimple := fun P₂ hP₂ => by + obtain ⟨R', -, -, -⟩ := hproj P₂ hP₂.edges_nodup + rw [hρX s hsX, hρX t htX] at R' + obtain ⟨R, hR, -, -⟩ := GM09.exists_isSimple_subwalk R' + exact ⟨R, hR⟩ + refine ⟨⟨fun ⟨P₁, hP₁⟩ => ?_, fun ⟨P₂, hP₂⟩ => hp.1.mpr (hdown P₂ hP₂)⟩, ?_⟩ + · obtain ⟨R, -⟩ := hp.1.mp ⟨P₁, hP₁⟩ + obtain ⟨W⟩ := hup R s hsF (hρX s hsX) t htF (hρX t htX) + obtain ⟨P, hP, -, -⟩ := GM09.exists_isSimple_subwalk W + exact ⟨P, hP⟩ + · intro P₁ P₂ φ₁ φ₂ hP₁ hP₂ ht₁' ht₂ + obtain ⟨R, hR⟩ := hdown P₂ hP₂ + obtain ⟨φ'', hφ''⟩ := exists_curveTracesWalk R + have ha := hp.2 P₁ R φ₁ φ'' hP₁ hR ht₁' hφ'' + let κ : Curve S := ⟨fun u => ρ (φ₂ u), hρc.comp φ₂.continuous⟩ + have hκ : ∀ u, κ u = ρ (φ₂ u) := fun _ => rfl + have h0 := ht₂.endpoints.1 + have h1 := ht₂.endpoints.2 + have hκr : range κ ⊆ H₂.U := by + rintro _ ⟨u, rfl⟩ + exact hFU _ (CurveTracesWalk.range_subset P₂ φ₂ ht₂ (mem_range_self u)) + have hc : CurvesHomotopic φ'' κ := by + refine IsFlat.curvesHomotopic (isFlat_U_of_forest hS hH₂f) (CurveTracesWalk.range_subset R + φ'' hφ'') hκr ?_ ?_ + · rw [hφ''.endpoints.1, hκ, h0, hρX s hsX] + · rw [hφ''.endpoints.2, hκ, h1, hρX t htX] + have hd : CurvesHomotopic φ₂ κ := h.curvesHomotopic (h0 ▸ hsX) (h1 ▸ htX) hκ + exact CurvesHomotopic.trans ha (CurvesHomotopic.trans hc (CurvesHomotopicIn.symm hd)) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffLines.lean b/LeanPool/GraphMinor/GM07/CuffLines.lean new file mode 100644 index 0000000000..0046516e5c --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffLines.lean @@ -0,0 +1,174 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffTree + +/-! +# The lines of the paths `Q_i` and the boxes in `Σ` + +Graph Minors VII, (5.9), page 235. The paths `Q_i` give lines in the capped surface that cut the +disc `E₀` in cells, so the box construction applies. We then bring the boxes back to `Σ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] + +variable {G : Drawing S} {C : Set S} {j : S → T} {D : Set T} {r v ks m : ℕ} {Y E₀ Δ' Do : Set T} + {Nk Bo : Drawing S} {R : Fin ks → Drawing S} {x t : Fin ks → S} {Q : ∀ i, GraphWalk G.toGraph + (x i) (t i)} {L : Fin m → Drawing S} {El : Fin m → Set T} + +theorem IsCuffCore.x_injective (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) : + Injective x := fun i i' he => by + by_contra hne + have h1 : x i ∈ {z | z ∈ (Q i).support} := (Q i).start_mem_support + have h2 : x i ∈ {z | z ∈ (Q i').support} := by + rw [he] + exact (Q i').start_mem_support + exact disjoint_left.mp (h.Qdis i i' hne) h1 h2 + +theorem IsCuffCore.x_surj (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) : ∀ y ∈ G.V ∩ + C, ∃ i, x i = y := by + have hsub : range x ⊆ G.V ∩ C := by + rintro _ ⟨i, rfl⟩ + exact h.xmem i + have hfin : (G.V ∩ C).Finite := G.finite_V.subset inter_subset_left + have hcard : (G.V ∩ C).ncard ≤ (range x).ncard := by + rw [← image_univ, h.x_injective.injOn.ncard_image, ncard_univ, Nat.card_eq_fintype_card, + Fintype.card_fin] + exact h.kcard.ge + have heq := eq_of_subset_of_ncard_le hsub hcard hfin + intro y hy + rw [← heq] at hy + exact hy + +theorem IsCuffCore.tU (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) + (i : Fin ks) : t i ∈ Nk.U := (h.Rsub i).U_subset ((R i).V_subset_U (h.tmem i)) + +theorem IsCuffCore.tV (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) + (i : Fin ks) : t i ∈ G.V := h.nkSub.1 ((h.Rsub i).1 (h.tmem i)) + +/-- The points of `Q i` other than `t i` are strictly inside the disc of `N(C)`. -/ +theorem IsCuffCore.Q_inside (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) [T2Space S] + [T2Space T] (hman : ∀ x : T, IsManifoldPoint x) (hj : Continuous j) (hji : Injective j) + (hCD : ∀ z ∈ C, j z ∈ D) (i : Fin ks) : ∀ z ∈ (walkDrawing G (Q i)).U, z = t i + ∨ j z ∈ discInt E₀ := by + have hbU : ∀ z, j z ∈ discBd E₀ ↔ z ∈ Nk.U := fun z => by + rw [h.bdE] + exact hji.mem_set_image + have hd : Disjoint (discInt E₀) E₀ᶜ := disjoint_left.mpr fun z hz hz' => hz' hz.1 + refine walk_U_stays_side h.nkSub hj (h.discE.isOpen_discInt hman) + h.discE.isClosed.isOpen_compl hd (fun z hz => ?_) (fun z hz hU => hz.2 ((hbU z).mpr hU)) (Q i) + (h.Qsimple i) (fun z hz hne hzN => ?_) (h.DinE (hCD _ (h.xmem i).2)) + · by_cases h1 : j z ∈ E₀ + · exact .inl ⟨h1, fun h2 => hz ((hbU z).mp h2)⟩ + · exact .inr h1 + · rcases h.Qin i z hz with h1 | h1 + · exact hne h1 + · exact h1.2.2 ((hbU z).mpr (Nk.V_subset_U hzN)) + +/-- The line of `Q i` in the capped surface crosses from `D` to the boundary of `E₀`. -/ +theorem IsCuffCore.crossLine (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) [T2Space S] + [T2Space T] (hG : G.IsProper) (hC : C ∈ cuffs S) (hman : ∀ x : T, IsManifoldPoint x) + (hc : IsCappedCuff C T j D) (i : Fin ks) : IsCrossLine D E₀ (j '' (walkDrawing G (Q i)).U) (j + (x i)) (j (t i)) := by + have hj := hc.isEmbedding.continuous + have hji := hc.isEmbedding.injective + have hCD : ∀ z ∈ C, j z ∈ D := fun z hz => Surface.discBd_subset D (hc.discBd_eq ▸ + mem_image_of_mem j hz) + have hin := h.Q_inside hman hj hji hCD i + have hxint := h.DinE (hCD _ (h.xmem i).2) + have htb : j (t i) ∈ discBd E₀ := h.bdE ▸ mem_image_of_mem j (h.tU i) + have hne : x i ≠ t i := fun he => hxint.2 (he ▸ htb) + have hpath := walkDrawing_isPathBetween G (h.Qsimple i) + have hline := isLine_of_isPathBetween hpath hne + have hxU : x i ∈ (walkDrawing G (Q i)).U := hline.left_mem + have htU : t i ∈ (walkDrawing G (Q i)).U := hline.right_mem + refine ⟨isLineWithEnds_image hline hj.continuousOn hji.injOn, ?_, ?_, ?_, + Surface.discBd_subset D |> fun _ => hc.discBd_eq ▸ mem_image_of_mem j (h.xmem i).2⟩ + · rintro _ ⟨z, hz, rfl⟩ + rcases hin z hz with rfl | h1 + · exact Surface.discBd_subset _ htb + · exact h1.1 + · refine subset_antisymm ?_ (singleton_subset_iff.mpr ⟨mem_image_of_mem j hxU, + hCD _ (h.xmem i).2⟩) + rintro _ ⟨⟨z, hz, rfl⟩, hzD⟩ + have hzr : j z ∈ range j ∩ D := ⟨mem_range_self z, hzD⟩ + rw [hc.inter_eq] at hzr + obtain ⟨z', hz', he⟩ := hzr + have hzC : z ∈ C := hji he ▸ hz' + have hzG : z ∈ G.U := (walkDrawing_isSubdrawing G (Q i)).U_subset hz + have hzV : z ∈ G.V := hG ⟨cuff_subset_bd hC hzC, hzG⟩ + obtain ⟨i', rfl⟩ := h.x_surj z ⟨hzV, hzC⟩ + have hs : x i' ∈ (Q i).support := by + have h1 := mem_V_of_subdrawing (walkDrawing_isSubdrawing G (Q i)) hz hzV + rwa [walkDrawing_V] at h1 + by_cases hii : i = i' + · subst hii + rfl + · exact absurd (Q i').start_mem_support (disjoint_left.mp (h.Qdis i i' hii) hs) + · refine subset_antisymm ?_ (singleton_subset_iff.mpr ⟨mem_image_of_mem j htU, htb⟩) + rintro _ ⟨⟨z, hz, rfl⟩, hzb⟩ + rcases hin z hz with rfl | h1 + · rfl + · exact absurd hzb h1.2 + +theorem IsCuffCore.lines_disjoint (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) + [T2Space S] (hji : Injective j) {i i' : Fin ks} (hne : i ≠ i') : Disjoint (j '' (walkDrawing G + (Q i)).U) (j '' (walkDrawing G (Q i')).U) := by + rw [disjoint_image_iff hji] + refine disjoint_U_of_disjoint_V (walkDrawing_isSubdrawing G (Q i)) (walkDrawing_isSubdrawing G + (Q i')) ?_ + rw [walkDrawing_V, walkDrawing_V] + exact h.Qdis i i' hne + +variable {ι : Type*} {F : Set (CellRec T ι)} {Φ : CellRec T ι → ℝ × ℝ → T} {Sd : ι → ℝ + → T} {μ : CellRec T ι → ℝ → T} {q : ι → Set T} {tx tt : ι → T} {φ : F → ℝ × ℝ → S} + +/-- The boxes, brought back to `Σ`, are a box system. -/ +theorem isBoxSystem_of_lift (hc : IsCappedCuff C T j D) (hb : IsCuffBoxes D E₀ Δ' q tx tt F Φ Sd μ) + (hman : ∀ x : T, IsManifoldPoint x) (hΔ : IsClosedDisc Δ') (hφ : ∀ c p, p ∈ cuffBox → j (φ c p) + = Φ c.1 p) : IsBoxSystem φ := by + have hj := hc.isEmbedding.continuous + have hji := hc.isEmbedding.injective + refine ⟨fun c => ?_, fun c p hp p' hp' he => hb.inj c.1 c.2 hp hp' ?_, + fun c c' p p' hp hp' he => ?_, ?_⟩ + · rw [hc.isEmbedding.isInducing.continuousOn_iff] + exact (hb.cont c.1 c.2).congr fun p hp => hφ c p hp + · rw [← hφ c p hp, ← hφ c p' hp', he] + · have he' : Φ c.1 p = Φ c'.1 p' := by rw [← hφ c p hp, ← hφ c' p' hp', he] + rcases hb.meet c.1 c.2 c'.1 c'.2 p p' hp hp' he' with ⟨h1, h2⟩ | ⟨h1, h2, h3, h4⟩ + · exact .inl ⟨Subtype.ext h1, h2⟩ + · refine .inr ⟨h1, h2, h3, fun w hw => hji ?_⟩ + rw [hφ c (p.1, w) ⟨hp.1, hw⟩, hφ c' (p'.1, w) ⟨hp'.1, hw⟩] + exact h4 w hw + · have heq : (⋃ c, φ c '' {p ∈ cuffBox | p.2 < 2}) = j ⁻¹' discInt Δ' := by + ext z + simp only [mem_iUnion, mem_preimage] + constructor + · rintro ⟨c, p, ⟨hp, hlt⟩, rfl⟩ + rw [hφ c p hp] + exact ⟨hb.mapsΔ c.1 c.2 hp, fun h1 => hlt.ne ((hb.bdΔ c.1 c.2 p hp).mp h1)⟩ + · intro hz + obtain ⟨c, hcF, p, hp, he⟩ := hb.cover (j z) ⟨hz.1, not_mem_discInt_cap hc z⟩ + refine ⟨⟨c, hcF⟩, p, ⟨hp, lt_of_le_of_ne hp.2.2 fun h1 => hz.2 (he ▸ + (hb.bdΔ c hcF p hp).mpr h1)⟩, hji ?_⟩ + rw [hφ ⟨c, hcF⟩ p hp] + exact he + rw [heq] + exact (hΔ.isOpen_discInt hman).preimage hj + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffMenger.lean b/LeanPool/GraphMinor/GM07/CuffMenger.lean new file mode 100644 index 0000000000..d5b6af8d85 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffMenger.lean @@ -0,0 +1,635 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffSegments +public import LeanPool.GraphMinor.Menger.SimpleGraph + +/-! +# The paths `Q_i(C)` + +Graph Minors VII, (5.9), page 235: "we may deduce from Menger's theorem, applied to the graph +obtained from $G$ by contracting $N_i(C)$ to a single vertex for each $i$ with $1 \le i \le k(C)$, +that there are $k(C)$ mutually vertex-disjoint paths $Q_1, \dots, Q_{k(C)}$ of $G$, such that for +each $i$, $Q_i$ has one end in $C$, the other in $V(N_i(C))$, and all its other vertices and edges +are inside $U(N(C))$". + +Here we take the part of `G` on the vertex set `In` inside `N(C)`, and we add one new vertex for +each `N_i(C)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The graph on the vertices in `In`, with one new vertex for each set `R i`. -/ +def contractGraph (G : Drawing S) (In : Set S) {k : ℕ} (R : Fin k → Set S) : SimpleGraph + (In ⊕ Fin k) where + Adj p q := match p, q with + | .inl a, .inl b => a ≠ b ∧ ∃ e, G.toGraph.IsLink e a.1 b.1 + | .inl a, .inr i => ∃ t ∈ R i, ∃ e, G.toGraph.IsLink e a.1 t + | .inr i, .inl a => ∃ t ∈ R i, ∃ e, G.toGraph.IsLink e a.1 t + | .inr _, .inr _ => False + symm := ⟨fun p q h => by + rcases p with a | i <;> rcases q with b | j + · obtain ⟨h1, e, h2⟩ := h + exact ⟨h1.symm, e, h2.symm⟩ + · exact h + · exact h + · exact h⟩ + loopless := ⟨fun p h => by + rcases p with a | i + · exact h.1 rfl + · exact h⟩ + +variable {G : Drawing S} {In : Set S} {k : ℕ} {R : Fin k → Set S} + +/-- A walk of `G` that stays in `In` up to its last vertex gives a walk of the contracted graph. -/ +theorem exists_contract_walk {y t : S} (W : GraphWalk G.toGraph y t) (hIn : ∀ z ∈ W.support, z ≠ t + → z ∈ In) {i : Fin k} (ht : t ∈ R i) (hy : y ∈ In) (hne : y ≠ t) : + ∃ w : (contractGraph G In R).Walk (.inl ⟨y, hy⟩) (.inr i), ∀ p ∈ w.support, p = .inr i + ∨ ∃ z, ∃ hz : z ∈ In, p = .inl ⟨z, hz⟩ ∧ z ∈ W.support := by + classical + induction W with + | nil _ => exact absurd rfl hne + | @cons u' v' w' e' h r ih => + have hup : ∀ z ∈ r.support, z ∈ (GraphWalk.cons h r).support := fun z hz + => List.mem_cons_of_mem _ hz + by_cases hv : v' = w' + · subst hv + have hadj : (contractGraph G In R).Adj (.inl ⟨u', hy⟩) (.inr i) := ⟨v', ht, e', h⟩ + refine ⟨.cons hadj .nil, fun p hp => ?_⟩ + simp only [SimpleGraph.Walk.support_cons, SimpleGraph.Walk.support_nil, List.mem_cons, + List.not_mem_nil, or_false] at hp + rcases hp with rfl | rfl + · exact .inr ⟨u', hy, rfl, List.mem_cons_self⟩ + · exact .inl rfl + · have hvIn : v' ∈ In := hIn v' (hup _ r.start_mem_support) hv + obtain ⟨w₁, hw₁⟩ := ih (fun z hz hzt => hIn z (hup z hz) hzt) ht hvIn hv + by_cases hu : u' = v' + · subst hu + refine ⟨w₁, fun p hp => ?_⟩ + rcases hw₁ p hp with h1 | ⟨z, hz, h1, h2⟩ + · exact .inl h1 + · exact .inr ⟨z, hz, h1, hup z h2⟩ + · have hadj : (contractGraph G In R).Adj (.inl ⟨u', hy⟩) (.inl ⟨v', hvIn⟩) := ⟨fun h1 => hu + (congrArg Subtype.val h1), e', h⟩ + refine ⟨.cons hadj w₁, fun p hp => ?_⟩ + rw [SimpleGraph.Walk.support_cons, List.mem_cons] at hp + rcases hp with rfl | hp + · exact .inr ⟨u', hy, rfl, List.mem_cons_self⟩ + · rcases hw₁ p hp with h1 | ⟨z, hz, h1, h2⟩ + · exact .inl h1 + · exact .inr ⟨z, hz, h1, hup z h2⟩ + +/-- A path of the contracted graph with only its last vertex new gives a path of `G`. -/ +theorem exists_lift_walk (hRoff : ∀ i, Disjoint (R i) In) {p q : In ⊕ Fin k} (w : + (contractGraph G In R).Walk p q) (hw : w.IsPath) : + ∀ (y : In) (i : Fin k), p = .inl y → q = .inr i → (∀ j, .inr j ∈ w.support → j = i) + → ∃ t ∈ R i, ∃ W : GraphWalk G.toGraph y.1 t, W.IsSimple ∧ ∀ z ∈ W.support, z = t + ∨ ∃ hz : z ∈ In, .inl ⟨z, hz⟩ ∈ w.support := by + classical + induction w with + | nil => + intro y i h1 h2 + rw [h1] at h2 + exact absurd h2 (by simp) + | @cons p' q' r' hadj rest ih => + intro y i h1 h2 h3 + subst h1 h2 + have hp := SimpleGraph.Walk.cons_isPath_iff _ _ |>.mp hw + rcases q' with b | j + · obtain ⟨hne, e, hl⟩ := hadj + obtain ⟨t, ht, W, h4, h5⟩ := ih hp.1 b i rfl rfl fun j hj => h3 j (List.mem_cons_of_mem _ hj) + refine ⟨t, ht, .cons hl W, ?_, fun z hz => ?_⟩ + · change (y.1 :: W.support).Nodup + refine List.nodup_cons.mpr ⟨fun h6 => ?_, h4⟩ + rcases h5 _ h6 with h7 | ⟨h8, h7⟩ + · exact disjoint_left.mp (hRoff i) ht (h7 ▸ y.2) + · exact hp.2 h7 + · rw [GraphWalk.support, List.mem_cons] at hz + rcases hz with rfl | hz + · exact .inr ⟨y.2, List.mem_cons_self⟩ + · rcases h5 z hz with h6 | ⟨h6, h7⟩ + · exact .inl h6 + · exact .inr ⟨h6, List.mem_cons_of_mem _ h7⟩ + · have hji : j = i := h3 j (List.mem_cons_of_mem _ rest.start_mem_support) + subst hji + have hnil : rest = .nil := + SimpleGraph.Walk.eq_nil_iff_nil.mpr (SimpleGraph.Walk.isPath_iff_nil.mp hp.1) + subst hnil + obtain ⟨t, ht, e, hl⟩ := hadj + refine ⟨t, ht, .cons hl (.nil hl.right_mem), ?_, fun z hz => ?_⟩ + · change [y.1, t].Nodup + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_false_eq_true, + List.nodup_nil, and_true] + exact fun h4 => disjoint_left.mp (hRoff j) ht (h4 ▸ y.2) + · simp only [GraphWalk.support, List.mem_cons, List.not_mem_nil, or_false] at hz + rcases hz with rfl | rfl + · exact .inr ⟨y.2, List.mem_cons_self⟩ + · exact .inl rfl + +/-- **Menger's theorem for the contracted graph.** If each set of fewer than `k` vertices and new +vertices leaves a walk from `A` to a set `R i`, then there are `k` disjoint paths, the `i`th from +`A` to `R i`, with all vertices but the last in `In`. -/ +theorem exists_paths_to_groups (hfin : In.Finite) (hRoff : ∀ i, Disjoint (R i) In) + (hRdis : ∀ i i', i ≠ i' → Disjoint (R i) (R i')) {A : Set S} (hAIn : A ⊆ In) + (hconn : ∀ (I : Finset (Fin k)) (V' : Finset S), I.card + V'.card < k → ∃ i, i ∉ I + ∧ ∃ x ∈ A, ∃ t ∈ R i, x ≠ t ∧ ∃ W : GraphWalk G.toGraph x t, ∀ z ∈ W.support, z ≠ t → z ∈ In + ∧ z ∉ V') : + ∃ (x t : Fin k → S) (Q : ∀ i, GraphWalk G.toGraph (x i) (t i)), (∀ i, x i ∈ A ∧ t i ∈ R i ∧ + (Q i).IsSimple ∧ ∀ z ∈ (Q i).support, z = t i ∨ z ∈ In) ∧ ∀ i i', i ≠ i' → Disjoint {z | z ∈ + (Q i).support} {z | z ∈ (Q i').support} := by + classical + have : Finite In := hfin.to_subtype + have hF : Finite (In ⊕ Fin k) := inferInstance + let K := contractGraph G In R + let A' : Set (In ⊕ Fin k) := {p | ∃ a : In, a.1 ∈ A ∧ p = .inl a} + let B' : Set (In ⊕ Fin k) := range .inr + have hmen : HasDisjointPaths K A' B' k := by + refine Menger.exists_disjointPaths K A' B' hF k fun S' hS' => ?_ + by_contra hlt + push Not at hlt + have hS'f : S'.Finite := toFinite _ + let I : Finset (Fin k) := Finset.univ.filter fun i => .inr i ∈ S' + let V' : Finset S := (hS'f.toFinset.preimage (fun z : In => (Sum.inl z : In ⊕ Fin k)) + Sum.inl_injective.injOn).image Subtype.val + have hcard : I.card + V'.card ≤ S'.ncard := by + let pre := hS'f.toFinset.preimage (fun z : In => (Sum.inl z : In ⊕ Fin k)) + Sum.inl_injective.injOn + have h1 : V'.card ≤ pre.card := Finset.card_image_le + have h2 : (I.image Sum.inr ∪ pre.image Sum.inl).card = I.card + pre.card := by + rw [Finset.card_union_of_disjoint, Finset.card_image_of_injective _ Sum.inr_injective, + Finset.card_image_of_injective _ Sum.inl_injective] + · rw [Finset.disjoint_left] + intro p h3 h4 + obtain ⟨_, -, rfl⟩ := Finset.mem_image.mp h3 + obtain ⟨_, -, h5⟩ := Finset.mem_image.mp h4 + exact absurd h5 (by simp) + have h3 : (I.image Sum.inr ∪ pre.image Sum.inl) ⊆ hS'f.toFinset := by + intro p hp + rcases Finset.mem_union.mp hp with h4 | h4 + · obtain ⟨j, h5, rfl⟩ := Finset.mem_image.mp h4 + exact hS'f.mem_toFinset.mpr (Finset.mem_filter.mp h5).2 + · obtain ⟨z, h5, rfl⟩ := Finset.mem_image.mp h4 + exact Finset.mem_preimage.mp h5 + have h4 := Finset.card_le_card h3 + rw [ncard_eq_toFinset_card S' hS'f] + omega + obtain ⟨i, hi, x, hxA, t, ht, hxt, W, hW⟩ := hconn I V' (by omega) + obtain ⟨w, hw⟩ := exists_contract_walk (G := G) (In := In) (R := R) W (fun z hz hzt => + (hW z hz hzt).1) ht (hAIn hxA) hxt + let P : PathFromTo K A' B' := ⟨_, _, w.bypass, w.bypass_isPath, ⟨⟨x, hAIn hxA⟩, hxA, rfl⟩, ⟨i, + rfl⟩⟩ + obtain ⟨p, hp, hpS⟩ := hS' P + rcases hw p (SimpleGraph.Walk.support_bypass_subset_support w hp) with rfl | ⟨z, hz, rfl, hzW⟩ + · exact hi (Finset.mem_filter.mpr ⟨Finset.mem_univ _, hpS⟩) + · by_cases hzt : z = t + · exact disjoint_left.mp (hRoff i) ht (hzt ▸ hz) + · refine (hW z hzW hzt).2 (Finset.mem_image.mpr ⟨⟨z, hz⟩, ?_, rfl⟩) + simpa using hpS + obtain ⟨P, hdis⟩ := hmen + have hsup : ∀ ι ι', ι ≠ ι' → ∀ p, p ∈ (P ι).walk.support → p ∉ (P ι').walk.support + := fun ι ι' hne p h1 h2 => disjoint_left.mp (hdis hne) h1 h2 + choose r hr using fun ι => (P ι).last_mem + have hrinj : Injective r := fun ι ι' he => by + by_contra hne + refine hsup ι ι' hne (.inr (r ι)) ?_ ?_ + · rw [hr ι] + exact (P ι).walk.end_mem_support + · rw [he, hr ι'] + exact (P ι').walk.end_mem_support + have hrbij : Bijective r := ⟨hrinj, Finite.injective_iff_surjective.mp hrinj⟩ + let e := Equiv.ofBijective r hrbij + have hlast : ∀ ι j, .inr j ∈ (P ι).walk.support → j = r ι := fun ι j hj => by + have h1 : r (e.symm j) = j := e.apply_symm_apply j + by_cases h2 : ι = e.symm j + · rw [h2, h1] + · exfalso + refine hsup ι _ h2 _ hj ?_ + have h3 : (Sum.inr j : In ⊕ Fin k) = (P (e.symm j)).last := (congrArg Sum.inr h1.symm).trans + (hr _) + have h4 : ∀ p, p = (P (e.symm j)).last → p ∈ (P (e.symm j)).walk.support := by + rintro _ rfl + exact (P _).walk.end_mem_support + exact h4 _ h3 + have hlift : ∀ ι, ∃ (a : In) (t : S) (W : GraphWalk G.toGraph a.1 t), a.1 ∈ A ∧ (P ι).first + = .inl a ∧ t ∈ R (r ι) ∧ W.IsSimple ∧ ∀ z ∈ W.support, z = t ∨ ∃ hz : z ∈ In, .inl ⟨z, hz⟩ ∈ + (P ι).walk.support := fun ι => by + obtain ⟨a, ha, h1⟩ := (P ι).first_mem + obtain ⟨t, ht, W, h2, h3⟩ := exists_lift_walk (hRoff := hRoff) (P ι).walk (P ι).isPath a + (r ι) h1 (hr ι).symm (hlast ι) + exact ⟨a, t, W, ha, h1, ht, h2, h3⟩ + choose a t W h1 h2 h3 h4 h5 using hlift + have hre : ∀ i, r (e.symm i) = i := fun i => e.apply_symm_apply i + refine ⟨fun i => (a (e.symm i)).1, fun i => t (e.symm i), fun i => W (e.symm i), + fun i => ⟨h1 _, ?_, h4 _, fun z hz => ?_⟩, fun i i' hne => ?_⟩ + · have := h3 (e.symm i) + rwa [hre] at this + · rcases h5 _ z hz with h6 | ⟨h6, -⟩ + · exact .inl h6 + · exact .inr h6 + · have hne' : e.symm i ≠ e.symm i' := fun h => hne (e.symm.injective h) + have ht1 : t (e.symm i) ∈ R i := by + have := h3 (e.symm i) + rwa [hre] at this + have ht2 : t (e.symm i') ∈ R i' := by + have := h3 (e.symm i') + rwa [hre] at this + rw [disjoint_left] + intro z hz hz' + rcases h5 _ z hz with h6 | ⟨h6, h7⟩ <;> rcases h5 _ z hz' with h8 | ⟨h8, h9⟩ + · exact disjoint_left.mp (hRdis i i' hne) ht1 (by rw [← h6, h8]; exact ht2) + · exact disjoint_left.mp (hRoff i) ht1 (h6 ▸ h8) + · exact disjoint_left.mp (hRoff i') ht2 (h8 ▸ h6) + · exact hsup _ _ hne' _ h7 h9 + +variable {T : Type u} [TopologicalSpace T] + +/-- Two subdrawings without a common vertex have no common point. -/ +theorem disjoint_U_of_disjoint_V {G A B : Drawing S} (hA : A.IsSubdrawing G) + (hB : B.IsSubdrawing G) (hV : Disjoint A.V B.V) : Disjoint A.U B.U := by + rw [disjoint_left] + intro x hxA hxB + by_cases hxV : x ∈ G.V + · exact disjoint_left.mp hV (mem_V_of_subdrawing hA hxA hxV) (mem_V_of_subdrawing hB hxB hxV) + · obtain ⟨e, he, hxe⟩ := A.exists_edge_of_mem hxA fun h => hxV (hA.1 h) + obtain ⟨e', he', hxe'⟩ := B.exists_edge_of_mem hxB fun h => hxV (hB.1 h) + have hee : e = e' := arcComponent_eq (hA.2 he) (hB.2 he') hxe hxe' + subst hee + have hne : (closure e ∩ A.V).Nonempty := by + rcases A.edge_cond e he with ⟨u, v, -, h1, -⟩ | ⟨u, h1, -⟩ + · exact ⟨u, h1 ▸ mem_insert _ _⟩ + · exact ⟨u, h1 ▸ mem_singleton _⟩ + obtain ⟨u, hu1, hu2⟩ := hne + exact disjoint_left.mp hV hu2 (mem_V_of_subdrawing hB (B.closure_subset_U he' hu1) (hA.1 hu2)) + +section Grid + +variable [T2Space S] [T2Space T] {G : Drawing S} {j : S → T} {D₁ Δ₂ : Set T} {r s : ℕ} {P : Fin r + → Drawing S} {u v : Fin r → S} {B : Fin s → Drawing S} {E : Fin s → Set T} + +omit [T2Space T] in +omit [T2Space S] in +theorem IsCuffGrid.disjoint_U (h : IsCuffGrid G j D₁ Δ₂ P u v B E) {l l' : Fin s} + (hne : l ≠ l') : Disjoint (B l).U (B l').U := + disjoint_U_of_disjoint_V (h.circuit l).1 (h.circuit l').1 (h.circuit_disj l l' hne) + +omit [T2Space T] in +omit [T2Space S] in +/-- The discs of the grid are strictly nested. -/ +theorem IsCuffGrid.subset_diff (h : IsCuffGrid G j D₁ Δ₂ P u v B E) (hman : ∀ x : T, + IsManifoldPoint x) (hj : Injective j) {l l' : Fin s} (hlt : l < l') : E l ⊆ E l' \ discBd (E l') + := fun x hx => by + refine ⟨h.mono l l' hlt.le hx, fun hb => ?_⟩ + obtain ⟨-, -, h1, h2, -⟩ := h.circuit l + by_cases h3 : x ∈ discBd (E l) + · rw [h2] at h3 + rw [(h.circuit l').2.2.2.1] at hb + obtain ⟨y, hy, rfl⟩ := h3 + obtain ⟨y', hy', he⟩ := hb + exact disjoint_left.mp (h.disjoint_U hlt.ne) hy (hj he ▸ hy') + · exact (discInt_mono hman h1 (h.mono l l' hlt.le) ⟨hx, h3⟩).2 hb + +omit [T2Space T] in +/-- **The subpaths `N_i(C)` of a circuit of the grid.** -/ +theorem IsCuffGrid.exists_groups {v' k : ℕ} {P : Fin (v' * k) → Drawing S} {u v : Fin (v' * k) → S} + (h : IsCuffGrid G j D₁ Δ₂ P u v B E) (hk : 0 < k) (hv : 0 < v') (hvk : 2 ≤ v' * k) (l : Fin s) : + ∃ R : Fin k → Drawing S, (∀ i, (R i).IsSubdrawing (B l) ∧ ∃ a b, (R i).IsPathBetween a b) ∧ + (∀ i i', i ≠ i' → Disjoint (R i).V (R i').V) ∧ (∀ x ∈ (B l).V, ∃ i, x ∈ (R i).V) + ∧ ∀ i, ∃ f : Fin v' → Fin (v' * k), Injective f ∧ ∀ t, (P (f t)).V ∩ (B l).V ⊆ (R i).V := by + classical + choose Q x y h1 h2 h3 h4 using fun ι => h.inter ι l + have hsub : ∀ ι, (Q ι).IsSubdrawing (B l) := fun ι => by + refine ⟨fun z hz => ?_, fun e he => ?_⟩ + · have := h3 ι + exact (this ▸ hz : z ∈ (P ι).V ∩ (B l).V).2 + · obtain ⟨z, hz⟩ := he.1 + have hzU : z ∈ (B l).U := by + have := (h2 ι) + exact (this ▸ (he.2.1 hz).1 : z ∈ (P ι).U ∩ (B l).U).2 + have heG := (h1 ι).2 he + have hzV : z ∉ (B l).V := fun h5 => (heG.2.1 hz).2 ((h.circuit l).1.1 h5) + obtain ⟨e', he', hze'⟩ := (B l).exists_edge_of_mem hzU hzV + exact arcComponent_eq heG ((h.circuit l).1.2 he') hz hze' ▸ he' + have hdis : ∀ ι ι', ι ≠ ι' → Disjoint (Q ι).V (Q ι').V := fun ι ι' hne => by + rw [h3, h3] + exact (h.path_disj ι ι' hne).mono inter_subset_left inter_subset_left + obtain ⟨R, h5, h6, h7, h8⟩ := exists_circuit_groups (h.circuit l).2.1 hk hv hvk Q hsub (fun ι + => ⟨x ι, y ι, h4 ι⟩) hdis + refine ⟨R, h5, h6, h7, fun i => ?_⟩ + obtain ⟨f, hf, hf'⟩ := h8 i + exact ⟨f, hf, fun t => by + rw [← h3] + exact hf' t⟩ + +end Grid + +/-- **Walks that stay inside a disc.** A walk of `G` that starts inside the disc `Δ`, whose boundary +is a circuit of `G`, stays inside until it reaches the circuit. -/ +theorem walk_stays_inside [T2Space T] (hman : ∀ x : T, IsManifoldPoint x) {G N : + Drawing S} (hN : N.IsSubdrawing G) {j : S → T} (hj : Continuous j) (hji : Injective j) {Δ : Set + T} (hΔ : IsClosedDisc Δ) (hb : discBd Δ = j '' N.U) {y t : S} (W : GraphWalk G.toGraph y t) + (hs : W.IsSimple) (hoff : ∀ z ∈ W.support, z ≠ t → z ∉ N.V) (hy : j y ∈ discInt Δ) : + ∀ z ∈ W.support, z = t ∨ j z ∈ discInt Δ := by + induction W with + | nil _ => + intro z hz + exact .inl (List.mem_singleton.mp hz) + | @cons u' v' w' e h r ih => + have hheld : j v' ∈ Δ := by + have hoffU : u' ∉ N.U := fun h1 => hy.2 (hb ▸ mem_image_of_mem j h1) + have heN : e ∉ N.E := fun h1 => hoffU (N.closure_subset_U h1 ((h.2.2.2 ▸ mem_insert _ _ : u' + ∈ closure e ∩ G.V).1)) + have hebd : Disjoint (j '' e) (frontier Δ) := by + rw [disjoint_left] + rintro _ ⟨x, hx, rfl⟩ hf + have h1 := frontier_disc_subset hman hΔ hf + rw [hb] at h1 + obtain ⟨x', hx', he'⟩ := h1 + have hxU : x ∈ N.U := hji he' ▸ hx' + have hxV : x ∉ N.V := fun h2 => (h.1.2.1 hx).2 (hN.1 h2) + obtain ⟨e', he'', hxe'⟩ := N.exists_edge_of_mem hxU hxV + exact heN (arcComponent_eq h.1 (hN.2 he'') hx hxe' ▸ he'') + have hpre : IsPreconnected (j '' e) := h.1.2.2.1.isConnected.isPreconnected.image _ + hj.continuousOn + have hcl : u' ∈ closure e := (h.2.2.2 ▸ mem_insert _ _ : u' ∈ closure e ∩ G.V).1 + have hcl' : v' ∈ closure e := (h.2.2.2 ▸ mem_insert_of_mem _ rfl : v' ∈ closure e ∩ G.V).1 + have hmeet : (j '' e ∩ Δ).Nonempty := by + have h2 : j u' ∈ closure (j '' e) := map_mem_closure hj hcl fun x hx + => mem_image_of_mem j hx + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp h2 _ (hΔ.isOpen_discInt hman) hy + exact ⟨w, hw2, hw1.1⟩ + rcases inside_or_off hpre hΔ.isClosed hebd with h1 | h1 + · exact closure_minimal (h1.trans interior_subset) hΔ.isClosed (map_mem_closure hj hcl' fun x + hx => mem_image_of_mem j hx) + · obtain ⟨w, hw1, hw2⟩ := hmeet + exact absurd hw2 (h1 hw1) + intro z hz + rw [GraphWalk.support, List.mem_cons] at hz + rcases hz with rfl | hz + · exact .inr hy + · have hnd : r.support.Nodup := (List.nodup_cons.mp hs).2 + by_cases hvt : v' = w' + · subst hvt + cases r with + | nil _ => exact .inl (List.mem_singleton.mp hz) + | cons h' r' => + have h1 : (_ :: r'.support).Nodup := hnd + exact absurd r'.end_mem_support (List.nodup_cons.mp h1).1 + · have hint : j v' ∈ discInt Δ := by + refine ⟨hheld, fun hbv => ?_⟩ + rw [hb] at hbv + obtain ⟨x, hx, he'⟩ := hbv + have hvU : v' ∈ N.U := hji he' ▸ hx + exact hoff v' (List.mem_cons_of_mem _ r.start_mem_support) hvt + (mem_V_of_subdrawing hN hvU h.2.2.1) + exact ih hnd (fun z' hz' hne => hoff z' (List.mem_cons_of_mem _ hz') hne) hint z hz + +/-- Among `n` disjoint sets, a set of fewer than `n` points misses one. -/ +theorem exists_avoiding {α : Type*} {n : ℕ} (A : Fin n → Set α) (hA : ∀ i i', i ≠ i' → Disjoint + (A i) (A i')) (X : Finset α) (hX : X.card < n) : ∃ i, ∀ z ∈ X, z ∉ A i := by + classical + by_contra hn + push Not at hn + choose f hf hfA using hn + have hinj : Injective fun i => (⟨f i, hf i⟩ : X) := fun i i' he => by + by_contra hne + have h1 : f i = f i' := congrArg Subtype.val he + exact disjoint_left.mp (hA i i' hne) (hfA i) (h1 ▸ hfA i') + have h2 := Fintype.card_le_of_injective _ hinj + simp at h2 + omega + +/-- A walk through two vertices holds a walk between them. -/ +theorem exists_walk_between {α β : Type*} {K : Graph α β} {a b : α} (W : GraphWalk K a b) {x y : α} + (hx : x ∈ W.support) (hy : y ∈ W.support) : ∃ W' : GraphWalk K x y, ∀ z ∈ W'.support, z ∈ + W.support := by + obtain ⟨W₁, W₂, rfl⟩ := W.exists_append_of_mem hx + rcases (GraphWalk.mem_support_append W₁ W₂).mp hy with h | h + · obtain ⟨A, B, rfl⟩ := W₁.exists_append_of_mem h + refine ⟨B.reverse, fun z hz => ?_⟩ + rw [GraphWalk.support_reverse, List.mem_reverse] at hz + exact (GraphWalk.mem_support_append _ _).mpr (.inl ((GraphWalk.mem_support_append _ _).mpr + (.inr hz))) + · obtain ⟨A, B, rfl⟩ := W₂.exists_append_of_mem h + exact ⟨A, fun z hz => (GraphWalk.mem_support_append _ _).mpr (.inr + ((GraphWalk.mem_support_append _ _).mpr (.inl hz)))⟩ + +/-- **The paths from `C` to `B_s(C)`.** "since $G$ is boundary-linked, there exist $k(C)$ mutually +vertex-disjoint paths of $G$, each +between $C$ and $B_s(C)$" (page 235), by the grid theorem with no circuits. -/ +theorem IsCuffGrid.exists_link_paths (hS : IsSurface S) [ConnectedSpace S] {C : Set S} + (hC : C ∈ cuffs S) {D D₁ Δ₂ : Set T} {j : S → T} (hc : IsCappedCuff C T j D) + (hns : ¬ IsSphere T) {G : Drawing S} (hbl : IsBoundaryLinked G) {r β : ℕ} {P : Fin r + → Drawing S} {u v : Fin r → S} {B : Fin β → Drawing S} {E : Fin β → Set T} + (h : IsCuffGrid G j D₁ Δ₂ P u v B E) + (hDint : ∀ l, D ⊆ discInt (E l)) (hoff : Disjoint Δ₂ (bd T)) {s s' : Fin β} (hss : s < s') : + ∃ (L : Fin (G.V ∩ C).ncard → Drawing S) (a b : Fin (G.V ∩ C).ncard → S), (∀ i, + (L i).IsSubdrawing G ∧ a i ∈ C ∧ b i ∈ (B s).V ∧ (L i).IsPathBetween (a i) (b i) ∧ j '' + (L i).U ⊆ E s' \ discBd (E s')) ∧ ∀ i i', i ≠ i' → Disjoint (L i).V (L i').V := by + classical + have hT := hc.isSurface + have : T2Space T := hT.2.1 + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have hman := hT.2.2 + have hcj : IsClosedEmbedding j := hc.isEmbedding.continuous.isClosedEmbedding + hc.isEmbedding.injective + have hji := hc.isEmbedding.injective + obtain ⟨-, -, hEs, hbds, -, -⟩ := h.circuit s + obtain ⟨-, -, hEs', -, -, hEsΔ⟩ := h.circuit s' + obtain ⟨Bs, p1, p2, p3, p4, p5, -⟩ := exists_parallel_disc (h.circuit s).1 hcj hEs hEs' + (h.subset_diff hman hji hss) hbds + have hCU : C ⊆ bd S := fun x hx => by + have : x ∈ ⋃₀ cuffs S := ⟨C, hC, hx⟩ + rwa [sUnion_cuffs] at this + have hbC : j ⁻¹' discBd D = C := by + rw [hc.discBd_eq, preimage_image_eq _ hji] + have hin : D ⊆ Bs \ discBd Bs := fun x hx => by + have h1 := discInt_mono hman hEs p2 (hDint s hx) + exact ⟨h1.1, h1.2⟩ + have hr : Bs \ discInt D ⊆ range j := fun x hx => by + by_contra hxr + rcases hc.union_eq.ge (mem_univ x) with h1 | h1 + · exact hxr h1 + · refine hx.2 ⟨h1, fun hb => hxr ?_⟩ + rw [hc.discBd_eq] at hb + exact image_subset_range _ _ hb + have hn₁ : G.IsNormal (j ⁻¹' discBd D) := by + rw [hbC] + rintro x ⟨hx, hU⟩ + exact hbl.1 ⟨hCU hx, hU⟩ + have hint : ∀ x ∈ discBd Bs, IsInteriorPoint x := fun x hx => by + by_contra hb + exact disjoint_left.mp hoff (hEsΔ (p3 (Surface.discBd_subset _ hx)).1) hb + have hi : ∀ B', IsClosedDisc B' → D ⊆ B' → B' ⊆ Bs → G.IsNormal (j ⁻¹' discBd B') → + (G.V ∩ C).ncard ≤ (G.V ∩ j ⁻¹' discBd B').ncard := fun B' h1 h2 _ h4 => + hbl.2 C hC _ h4 (isOArc_preimage_bd hc h1 h2) (surrounds_of_disc hS hC hc hns h1 h2) + obtain ⟨L, a, b, -, -, g1, g2, -⟩ := exists_disc_grid (s := 0) hman hcj hc.isClosedDisc p1 hin hr + hn₁ p4 hint hi (fun _ _ _ _ _ _ _ _ _ => Nat.zero_le _) + refine ⟨L, a, b, fun i => ?_, g2⟩ + obtain ⟨h1, h2, h3, h4, h5⟩ := g1 i + refine ⟨h1, ?_, ?_, h4, ?_⟩ + · have : a i ∈ j ⁻¹' discBd D := h2 + rwa [hbC] at this + · obtain ⟨W, -, hV, -⟩ := id h4 + have h6 : b i ∈ (L i).V := by + rw [hV] + exact W.end_mem_support + have : b i ∈ G.V ∩ j ⁻¹' discBd Bs := ⟨h1.1 h6, h3⟩ + rwa [p5] at this + · rintro _ ⟨x, hx, rfl⟩ + have h6 := h5 (mem_image_of_mem j hx) + exact p3 h6.1 + +/-- **The paths `Q_i(C)`** of page 235. The circuit `N(C)` is `B l₀` with `l₀ = k(C)`, so the +circuits before it are `k(C)` in number. -/ +theorem IsCuffGrid.exists_Q_walks (hS : IsSurface S) [ConnectedSpace S] {C : Set S} + (hC : C ∈ cuffs S) {D D₁ Δ₂ : Set T} {j : S → T} (hc : IsCappedCuff C T j D) + (hns : ¬ IsSphere T) {G : Drawing S} (hbl : IsBoundaryLinked G) {v' β : ℕ} {P : Fin (v' * + (G.V ∩ C).ncard) → Drawing S} {u v : Fin (v' * (G.V ∩ C).ncard) → S} {B : Fin β + → Drawing S} {E : Fin β → Set T} (h : IsCuffGrid G j D₁ Δ₂ P u v B E) + (hDint : ∀ l, D ⊆ discInt (E l)) (hoff : Disjoint Δ₂ (bd T)) (hkv : (G.V ∩ C).ncard ≤ v') + (hkβ : (G.V ∩ C).ncard < β) {R : Fin (G.V ∩ C).ncard → Drawing S} (hR₁ : ∀ i, + (R i).IsSubdrawing (B ⟨_, hkβ⟩)) (hR₂ : ∀ i i', i ≠ i' → Disjoint (R i).V (R i').V) + (hR₃ : ∀ i, ∃ f : Fin v' → Fin (v' * (G.V ∩ C).ncard), Injective f ∧ ∀ t, (P (f t)).V ∩ + (B ⟨_, hkβ⟩).V ⊆ (R i).V) : + ∃ (x t : Fin (G.V ∩ C).ncard → S) (Q : ∀ i, GraphWalk G.toGraph (x i) (t i)), + (∀ i, x i ∈ G.V ∩ C ∧ t i ∈ (R i).V ∧ (Q i).IsSimple ∧ ∀ z ∈ (Q i).support, z = t i + ∨ z ∈ G.V ∩ j ⁻¹' discInt (E ⟨_, hkβ⟩)) ∧ ∀ i i', i ≠ i' → Disjoint {z | z ∈ + (Q i).support} {z | z ∈ (Q i').support} := by + classical + have hT := hc.isSurface + have : T2Space T := hT.2.1 + have : T2Space S := hS.2.1 + have hman := hT.2.2 + have hji := hc.isEmbedding.injective + have hjc := hc.isEmbedding.continuous + let l₀ : Fin β := ⟨(G.V ∩ C).ncard, hkβ⟩ + obtain ⟨hN, -, hEl, hbl₀, -, -⟩ := h.circuit l₀ + let In : Set S := G.V ∩ j ⁻¹' discInt (E l₀) + have hbU : ∀ {z}, z ∈ (B l₀).U → j z ∉ discInt (E l₀) := fun {z} hz h1 => h1.2 + (hbl₀ ▸ mem_image_of_mem j hz) + have hRoff : ∀ i, Disjoint (R i).V In := fun i => disjoint_left.mpr fun z hz h1 => hbU + ((B l₀).V_subset_U ((hR₁ i).1 hz)) h1.2 + have hAIn : G.V ∩ C ⊆ In := fun z hz => by + refine ⟨hz.1, hDint l₀ (Surface.discBd_subset _ ?_)⟩ + rw [hc.discBd_eq] + exact mem_image_of_mem j hz.2 + refine exists_paths_to_groups (G := G) (In := In) (R := fun i => (R i).V) + (G.finite_V.subset inter_subset_left) hRoff hR₂ hAIn fun I V' hIV => ?_ + have hsmall : V'.card < (G.V ∩ C).ncard := by omega + -- a circuit before `N(C)` that misses `V'` + have hltβ : ∀ s : Fin (G.V ∩ C).ncard, s.1 < β := fun s => s.2.trans hkβ + obtain ⟨s, hs⟩ := exists_avoiding (fun s : Fin (G.V ∩ C).ncard => (B ⟨s.1, hltβ s⟩).V) + (fun s s' hne => h.circuit_disj _ _ fun he => hne (Fin.ext (Fin.mk.inj_iff.mp he))) V' hsmall + let s₀ : Fin β := ⟨s.1, hltβ s⟩ + have hs₀ : s₀ < l₀ := s.2 + obtain ⟨L, a, b, hL, hLd⟩ := h.exists_link_paths hS hC hc hns hbl hDint hoff hs₀ + obtain ⟨i₀, hi₀⟩ := exists_avoiding (fun i => (L i).V) hLd V' hsmall + -- a group not in `I` + obtain ⟨r, hr⟩ : ∃ r, r ∉ I := by + by_contra hn + push Not at hn + have h1 : I = Finset.univ := Finset.eq_univ_iff_forall.mpr hn + rw [h1] at hIV + simp at hIV + obtain ⟨f, hf, hfR⟩ := hR₃ r + obtain ⟨t₀, ht₀⟩ := exists_avoiding (fun t => (P (f t)).V) (fun t t' hne + => h.path_disj _ _ fun he => hne (hf he)) V' (by omega) + obtain ⟨hL₁, ha, hb, hLp, hLU⟩ := hL i₀ + obtain ⟨W₁, -, hW₁V, -⟩ := id hLp + obtain ⟨Z₁, hZ₁, -⟩ := hL₁.exists_walk_up W₁ + -- along `B_s(C)` + obtain ⟨c₀, W₂, -, -, hW₂V, -⟩ := id (h.circuit s₀).2.1 + obtain ⟨Z₂, hZ₂, -⟩ := (h.circuit s₀).1.exists_walk_up W₂ + have hsup₂ : ∀ {z}, z ∈ Z₂.support ↔ z ∈ (B s₀).V := fun {z} => by + rw [hZ₂, hW₂V] + rfl + -- along `P` + obtain ⟨hP₁, -, -, hPp, -⟩ := h.path (f t₀) + obtain ⟨W₃, -, hW₃V, -⟩ := id hPp + obtain ⟨Z₃, hZ₃, -⟩ := hP₁.exists_walk_up W₃ + have hsup₃ : ∀ {z}, z ∈ Z₃.support ↔ z ∈ (P (f t₀)).V := fun {z} => by + rw [hZ₃, hW₃V] + rfl + have hmeet : ∀ l, ∃ z, z ∈ (P (f t₀)).V ∧ z ∈ (B l).V := fun l => by + obtain ⟨Q, x, y, -, -, h3, W, -, h4, -⟩ := h.inter (f t₀) l + have h5 : x ∈ Q.V := by + rw [h4] + exact W.start_mem_support + rw [h3] at h5 + exact ⟨x, h5⟩ + obtain ⟨y₁, hy₁P, hy₁B⟩ := hmeet s₀ + obtain ⟨y₂, hy₂P, hy₂B⟩ := hmeet l₀ + obtain ⟨Y₂, hY₂⟩ := exists_walk_between Z₂ (hsup₂.mpr hb) (hsup₂.mpr hy₁B) + obtain ⟨Y₃, hY₃⟩ := exists_walk_between Z₃ (hsup₃.mpr hy₁P) (hsup₃.mpr hy₂P) + let Z := Z₁.append (Y₂.append Y₃) + have hZsup : ∀ {z}, z ∈ Z.support → z ∈ (L i₀).V ∨ z ∈ (B s₀).V ∨ z ∈ (P (f t₀)).V := fun {z} hz + => by + rcases (GraphWalk.mem_support_append _ _).mp hz with h1 | h1 + · left + rw [hZ₁, hW₁V] at * + exact h1 + · rcases (GraphWalk.mem_support_append _ _).mp h1 with h2 | h2 + · exact .inr (.inl (hsup₂.mp (hY₂ z h2))) + · exact .inr (.inr (hsup₃.mp (hY₃ z h2))) + have hZV : ∀ {z}, z ∈ Z.support → z ∈ G.V := fun {z} hz => by + rcases hZsup hz with h1 | h1 | h1 + · exact hL₁.1 h1 + · exact (h.circuit s₀).1.1 h1 + · exact hP₁.1 h1 + have hZoff : ∀ {z}, z ∈ Z.support → z ∉ V' := fun {z} hz hV => by + rcases hZsup hz with h1 | h1 | h1 + · exact hi₀ z hV h1 + · exact hs z hV h1 + · exact ht₀ z hV h1 + have hZR : ∀ {z}, z ∈ Z.support → z ∈ (B l₀).V → z ∈ (R r).V := fun {z} hz hzB => by + rcases hZsup hz with h1 | h1 | h1 + · have h2 := hLU (mem_image_of_mem j ((L i₀).V_subset_U h1)) + refine absurd (?_ : j z ∈ discBd (E l₀)) ?_ + · rw [hbl₀] + exact mem_image_of_mem j ((B l₀).V_subset_U hzB) + · exact fun h3 => h2.2 h3 + · exact absurd hzB (disjoint_left.mp (h.circuit_disj s₀ l₀ hs₀.ne) h1) + · exact hfR t₀ ⟨h1, hzB⟩ + -- the first vertex on `N(C)` + have hend : y₂ ∈ Z.support := (GraphWalk.mem_support_append _ _).mpr (.inr + ((GraphWalk.mem_support_append _ _).mpr (.inr Y₃.end_mem_support))) + obtain ⟨t, htB, W₄, W₅, hsplit, hW₅⟩ := exists_last_hit_split Z.reverse (X := (B l₀).V) + ⟨y₂, by rwa [GraphWalk.support_reverse, List.mem_reverse], hy₂B⟩ + have hsub₅ : ∀ z ∈ W₅.reverse.support, z ∈ Z.support := fun z hz => by + rw [GraphWalk.support_reverse, List.mem_reverse] at hz + have h1 : z ∈ Z.reverse.support := (GraphWalk.mem_support_append W₄ W₅).mpr (.inr hz) |> fun h2 + => by + rwa [← hsplit] at h2 + rw [GraphWalk.support_reverse, List.mem_reverse] at h1 + exact h1 + obtain ⟨W₆, hW₆s, hW₆, -⟩ := GM09.exists_isSimple_subwalk W₅.reverse + have hsub₆ : ∀ z ∈ W₆.support, z ∈ Z.support := fun z hz => hsub₅ z (hW₆ z hz) + have hoffN : ∀ z ∈ W₆.support, z ≠ t → z ∉ (B l₀).V := fun z hz hne hzB => by + have h1 := hW₆ z hz + rw [GraphWalk.support_reverse, List.mem_reverse] at h1 + exact hne (hW₅ z h1 hzB) + have haZ : a i₀ ∈ In := hAIn ⟨hL₁.1 (by rw [hW₁V]; exact W₁.start_mem_support), ha⟩ + have hin := walk_stays_inside hman (h.circuit l₀).1 hjc hji hEl hbl₀ W₆ hW₆s hoffN haZ.2 + have htZ : t ∈ Z.support := hsub₆ t W₆.end_mem_support + refine ⟨r, hr, a i₀, ⟨hL₁.1 (by rw [hW₁V]; exact W₁.start_mem_support), ha⟩, + t, hZR htZ htB, fun he => ?_, W₆, fun z hz hzt => ⟨?_, hZoff (hsub₆ z hz)⟩⟩ + · exact disjoint_left.mp (hRoff r) (hZR htZ htB) (he ▸ haZ) + · exact ⟨hZV (hsub₆ z hz), (hin z hz).resolve_left hzt⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffNest.lean b/LeanPool/GraphMinor/GM07/CuffNest.lean new file mode 100644 index 0000000000..1b94c26f1d --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffNest.lean @@ -0,0 +1,430 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffReach +public import LeanPool.GraphMinor.GM07.CuffStep + +/-! +# The circuits around `A(C)` + +Graph Minors VII, (5.9), page 234. We fix a cuff `C` and a cuff disc `E` with boundary `A(C)`. We +erase `G` strictly inside `E`, and take the layers of regions around the region of `E`, in a closed +surface `W` that holds `Σ + CHat`. +`IsLayerSetup` holds this data. A chain of regions gives a set `X` as on page 234, so the layers +stay in the disc that holds `𝒜_{2kv-1}(C)`, and we get the circuits `C_j`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] {W : Type} [TopologicalSpace W] + +/-- The data for the layers around a cuff disc `E`: the part `G₁` of `G` off the inside of `E`, +carried to a closed surface `W` by `i ∘ j`, and the region `r₀` of the result that holds a point `p` +of the inside of `E`. -/ +structure IsLayerSetup (G : Drawing S) {C : Set S} (j : S → T) (D : Set T) (ra : ℕ) (E : Set T) + (i : T → W) (K : Set W) (G₁ : Drawing S) (Γ : Drawing W) (r₀ : Set W) (p : T) (n : ℕ) : Prop where + disc : IsCuffDisc G j D ra E + cap : IsCappedCuff C T j D + sub : G₁.IsSubdrawing G + U : G₁.U = G.U ∩ (j ⁻¹' discInt E)ᶜ + V : G₁.V = G.V ∩ (j ⁻¹' discInt E)ᶜ + embed : IsClosedEmbedding i + closedW : IsClosedSurface W + closedK : IsClosed K + union : range i ∪ K = univ + inter : range i ∩ K = i '' bd T + matched : IsMatched G₁ Γ (i ∘ j) ∅ + region : r₀ ∈ Γ.R + inside : p ∈ discInt E + mem : i p ∈ r₀ + bdT : bd T = j '' (bd S \ C) + proper : G.IsProper + α₁ : ra + n < alpha G + α₂ : ra + (ra + n) < alpha G + α₃ : ∀ C₁ ∈ cuffs S, C₁ ≠ C → ra + n + (G.V ∩ C₁).ncard < alpha G + +variable {G G₁ : Drawing S} {C : Set S} {j : S → T} {D : Set T} {ra : ℕ} {E : Set T} {i : T + → W} {K : Set W} {Γ : Drawing W} {r₀ : Set W} {p : T} {n : ℕ} + +/-- The inside of the surface in `W` is open. -/ +theorem IsLayerSetup.isOpen_inside (h : IsLayerSetup (C := C) G j D ra E i K G₁ Γ r₀ p + n) : IsOpen (i '' (bd T)ᶜ) := by + have : i '' (bd T)ᶜ = Kᶜ := by + ext x + constructor + · rintro ⟨t, ht, rfl⟩ hK + have h1 : i t ∈ range i ∩ K := ⟨mem_range_self t, hK⟩ + rw [h.inter] at h1 + obtain ⟨t', ht', he⟩ := h1 + exact ht (h.embed.injective he ▸ ht') + · intro hx + rcases (h.union.ge (mem_univ x)) with ⟨t, rfl⟩ | h1 + · refine ⟨t, fun hb => hx ?_, rfl⟩ + have : i t ∈ i '' bd T := mem_image_of_mem i hb + rw [← h.inter] at this + exact this.2 + · exact absurd h1 hx + rw [this] + exact h.closedK.isOpen_compl + +/-- The vertices of `G` that a set of few vertices of the carried graph comes from. -/ +theorem IsLayerSetup.exists_lift + (h : IsLayerSetup (C := C) G j D ra E i K G₁ Γ r₀ p n) {A : Set W} {Y : Finset W} (hYV : + (Y : Set W) ⊆ Γ.V) (hA : A ⊆ (Y : Set W) ∪ Γ.Uᶜ) : + ∃ X' : Set S, X' ⊆ G.V ∧ X'.ncard ≤ Y.card ∧ ∀ z ∈ G.U, j z ∉ discInt E → i (j z) ∈ A → z ∈ X' + := by + classical + have hm := h.matched + have hii : Injective (i ∘ j) := h.embed.injective.comp h.cap.isEmbedding.injective + have hΓV : Γ.V = (i ∘ j) '' G₁.V := by simpa using hm.image_V.symm + have hΓU : Γ.U = (i ∘ j) '' G₁.U := by simpa using hm.image_U.symm + refine ⟨G₁.V ∩ (i ∘ j) ⁻¹' Y, fun x hx => h.sub.1 hx.1, ?_, fun z hz h1 h2 => ?_⟩ + · have h3 : ((i ∘ j) '' (G₁.V ∩ (i ∘ j) ⁻¹' Y)) ⊆ Y := by + rintro _ ⟨x, hx, rfl⟩ + exact hx.2 + have h4 := ncard_le_ncard h3 Y.finite_toSet + rwa [ncard_image_of_injective _ hii, ncard_coe_finset] at h4 + · have hzU : z ∈ G₁.U := by + rw [h.U] + exact ⟨hz, h1⟩ + have hmem : (i ∘ j) z ∈ Γ.U := hΓU ▸ mem_image_of_mem _ hzU + rcases hA h2 with h3 | h3 + · have h4 := hYV h3 + rw [hΓV] at h4 + obtain ⟨w, hw, he⟩ := h4 + rw [← hii he] + exact ⟨hw, by rw [mem_preimage, he]; exact h3⟩ + · exact absurd hmem h3 + +section Reach + +variable [T2Space S] [CompactSpace S] [T2Space T] [T2Space W] + +omit [T2Space S] [CompactSpace S] [T2Space T] [T2Space W] in +/-- A set that a chain of regions gives lies in `E` or in a set `X` of page 234. -/ +theorem IsLayerSetup.reach (h : IsLayerSetup (C := C) G j D ra E i K G₁ Γ r₀ p n) + (hS : IsSurface S) [ConnectedSpace S] {a b c : ℕ} (habc : 3 ≤ 3 * a + 3 * b + c) (hm : Nonempty + (S ≃ₜ SurfaceModel a b c)) (hcyl : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 2)) (hC : C ∈ cuffs S) + {A : Set W} (hA : IsPathConnected A) (h₀ : r₀ ⊆ A) {Y : Finset W} (hcard : Y.card ≤ n) (hYV : + (Y : Set W) ⊆ Γ.V) (hAY : A ⊆ (Y : Set W) ∪ Γ.Uᶜ) {y : W} (hy : y ∈ A) : + ∃ t, y = i t ∧ t ∉ bd T ∧ (t ∈ E ∨ ∃ z X, t = j z ∧ IsScriptASet G (ra + n) C X ∧ z ∈ X + ∧ j ⁻¹' discBd E ⊆ X) := by + obtain ⟨X', h1, h2, h3⟩ := h.exists_lift hYV hAY + exact exists_reach_in_closed hS habc hm hcyl hC h.cap h.bdT h.proper h.disc h.embed + h.isOpen_inside hA (Surface.discInt_subset _ h.inside) (h₀ h.mem) h1 + (h2.trans hcard) h3 h.α₁ h.α₂ h.α₃ hy + +omit [T2Space W] in +/-- A point in the closure of a region and off the drawing lies in the region. -/ +theorem mem_region_of_mem_closure (hW : IsClosedSurface W) {Γ : Drawing W} {r : Set W} + (hr : r ∈ Γ.R) {y : W} (hy : y ∈ closure r) (hU : y ∉ Γ.U) : y ∈ r := by + have hlc : LocallyConnectedSpace W := IsClosedSurface.locallyConnectedSpace hW + obtain ⟨x, hx, rfl⟩ := (mem_R_iff Γ).mp hr + have hO : IsOpen (univ \ Γ.U) := isOpen_univ.sdiff Γ.isClosed_U + have hyO : y ∈ univ \ Γ.U := ⟨mem_univ y, hU⟩ + have h1 : IsOpen (connectedComponentIn (univ \ Γ.U) y) := hO.connectedComponentIn + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp hy _ h1 (mem_connectedComponentIn hyO) + rw [connectedComponentIn_eq hw2, ← connectedComponentIn_eq hw1] + exact mem_connectedComponentIn hyO + +omit [T2Space S] [CompactSpace S] [T2Space T] [T2Space W] in +/-- The vertices on the closure of a region of layer `t` are reached with one more vertex. -/ +theorem IsLayerSetup.vertex_reach (h : IsLayerSetup (C := C) G j D ra E i K G₁ Γ r₀ p n) + (hS : IsSurface S) [ConnectedSpace S] {a b c : ℕ} (habc : 3 ≤ 3 * a + 3 * b + c) (hm : Nonempty + (S ≃ₜ SurfaceModel a b c)) (hcyl : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 2)) (hC : C ∈ cuffs S) + {t : ℕ} (htn : t + 1 ≤ n) {r : Set W} (hr : r ∈ regLayer Γ r₀ t) {y : W} (hy : y ∈ Γ.V) + (hyr : y ∈ closure r) : + ∃ t, y = i t ∧ t ∉ bd T ∧ (t ∈ E ∨ ∃ z X, t = j z ∧ IsScriptASet G (ra + n) C X ∧ z ∈ X + ∧ j ⁻¹' discBd E ⊆ X) := by + classical + obtain ⟨A, hA, h1, h2, Y, hc, hYV, hAY⟩ := exists_chain_set h.closedW h.region t r hr + have hrR : r ∈ Γ.R := regLayer_subset h.region t hr + have hrne : r.Nonempty := by + obtain ⟨x, hx, rfl⟩ := (mem_R_iff Γ).mp hrR + exact ⟨x, mem_connectedComponentIn ⟨mem_univ x, hx⟩⟩ + obtain ⟨w, hw⟩ := hrne + have hA' : IsPathConnected (A ∪ insert y r) := hA.union (isPathConnected_insert_region_surface + h.closedW hrR hy hyr) ⟨w, h2 hw, mem_insert_of_mem _ hw⟩ + refine h.reach hS habc hm hcyl hC hA' (h1.trans subset_union_left) (Y := insert y Y) + ((Finset.card_insert_le _ _).trans (by omega)) ?_ ?_ (.inr (mem_insert _ _)) + · rw [Finset.coe_insert] + exact insert_subset hy hYV + · rw [Finset.coe_insert] + rintro x (hx | rfl | hx) + · rcases hAY hx with h3 | h3 + · exact .inl (.inr h3) + · exact .inr h3 + · exact .inl (.inl rfl) + · rcases hAY (h2 hx) with h3 | h3 + · exact .inl (.inr h3) + · exact .inr h3 + +omit [T2Space S] [CompactSpace S] [T2Space T] [T2Space W] in +/-- **The closures of the layers lie in the disc of `𝒜`.** This is "`Y_j(A(C)) ⊆ Δ(C)`" on page 234. +They also miss the boundary of `Σ + CHat`. -/ +theorem IsLayerSetup.closure_layer_subset (h : IsLayerSetup (C := C) G j D ra E i K G₁ Γ r₀ p n) + (hS : IsSurface S) [ConnectedSpace S] {a b c : ℕ} (habc : 3 ≤ 3 * a + 3 * b + c) (hm : Nonempty + (S ≃ₜ SurfaceModel a b c)) (hcyl : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 2)) (hC : C ∈ cuffs S) + {Y : Set T} (hYc : IsClosed Y) (hEY : E ⊆ Y) (hA : ∀ z ∈ scriptA G (ra + n) C, j z ∈ Y) {t : ℕ} + (htn : t + 1 ≤ n) {r : Set W} (hr : r ∈ regLayer Γ r₀ t) : closure r ⊆ i '' Y ∧ Disjoint + (closure r) (i '' bd T) := by + classical + obtain ⟨A, hA', h1, h2, Z, hc, hYV, hAY⟩ := exists_chain_set h.closedW h.region t r hr + have hrR : r ∈ Γ.R := regLayer_subset h.region t hr + have hreach := fun {y} hy => h.reach hS habc hm hcyl hC hA' h1 (Y := Z) (hc.trans + (by omega)) hYV hAY (y := y) hy + have hmemA : ∀ z X, IsScriptASet G (ra + n) C X → z ∈ X → z ∈ scriptA G (ra + n) C + := fun z X h3 h4 => ⟨X, ⟨h3.1, h3.2.1, h3.2.2.1, h3.2.2.2.1, h3.2.2.2.2⟩, h4⟩ + have hinY : r ⊆ i '' Y := fun y hy => by + obtain ⟨t', rfl, -, h3⟩ := hreach (h2 hy) + refine mem_image_of_mem i ?_ + rcases h3 with h3 | ⟨z, X, rfl, h3, h4, -⟩ + · exact hEY h3 + · exact hA z (hmemA z X h3 h4) + refine ⟨closure_minimal hinY (h.embed.isClosedMap _ hYc), disjoint_left.mpr ?_⟩ + rintro y hy ⟨b', hb', rfl⟩ + by_cases hU : i b' ∈ Γ.U + · have hb2 := hb' + rw [h.bdT] at hb2 + obtain ⟨g, ⟨hg, -⟩, rfl⟩ := hb2 + have hΓU : Γ.U = (i ∘ j) '' G₁.U := by simpa using h.matched.image_U.symm + have hΓV : Γ.V = (i ∘ j) '' G₁.V := by simpa using h.matched.image_V.symm + rw [hΓU] at hU + obtain ⟨g', hg', he⟩ := hU + have hgg : g' = g := h.cap.isEmbedding.injective (h.embed.injective he) + subst hgg + have hgV : g' ∈ G.V := h.proper ⟨hg, by + have : g' ∈ G.U ∩ (j ⁻¹' discInt E)ᶜ := h.U ▸ hg' + exact this.1⟩ + have hgV₁ : g' ∈ G₁.V := by + rw [h.V] + have : g' ∈ G.U ∩ (j ⁻¹' discInt E)ᶜ := h.U ▸ hg' + exact ⟨hgV, this.2⟩ + obtain ⟨t', h3, h4, -⟩ := h.vertex_reach hS habc hm hcyl hC htn hr (hΓV ▸ mem_image_of_mem + (i ∘ j) hgV₁) hy + exact h4 (h.embed.injective h3 ▸ hb') + · obtain ⟨t', h3, h4, -⟩ := hreach (h2 (mem_region_of_mem_closure h.closedW hrR hy hU)) + exact h4 (h.embed.injective h3 ▸ hb') + +/-- **The circuits `C_j`.** This is page 234: the layers around `E` give disjoint nested circuits of +`G` in the disc `Δ(C)`, off the boundary of `Σ + CHat`. Each vertex on them is reached as on page +234, by a set `X` that holds `A(C)`. -/ +theorem IsLayerSetup.exists_nest [ConnectedSpace W] (h : IsLayerSetup (C + := C) G j D ra E i K G₁ Γ r₀ p n) (hS : IsSurface S) [ConnectedSpace S] {a b c : ℕ} (habc : 3 + ≤ 3 * a + 3 * b + c) (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) (hcyl : ¬ Nonempty + (S ≃ₜ SurfaceModel 0 0 2)) (hC : C ∈ cuffs S) + {Δ : Set T} (hΔ : IsClosedDisc Δ) (hEΔ : E ⊆ Δ) (hA : ∀ z ∈ scriptA G + (ra + n) C, j z ∈ Δ) {s : ℕ} (hs : s ≤ n) : + ∃ (B : Fin s → Drawing S) (Ds : Fin s → Set T), (∀ t, (B t).IsCircuit ∧ (B t).IsSubdrawing G₁ + ∧ IsClosedDisc (Ds t) ∧ discBd (Ds t) = j '' (B t).U ∧ E ⊆ Ds t ∧ Ds t ⊆ Δ ∧ Disjoint (Ds t) + (bd T) ∧ + ∀ y ∈ (B t).V, ∃ X, IsScriptASet G (ra + n) C X ∧ y ∈ X ∧ j ⁻¹' discBd E ⊆ X) ∧ + ∀ t t', t < t' → Disjoint (B t).U (B t').U ∧ Ds t ⊆ Ds t' := by + classical + have hW := h.closedW + have hT := h.cap.isSurface + have hmW : ∀ x : W, IsManifoldPoint x := fun x => (hW.2.2 x).isManifoldPoint + have hci := h.embed.continuous + have hii := h.embed.injective + have hji := h.cap.isEmbedding.injective + have hΔW : IsClosedDisc (i '' Δ) := isClosedDisc_image_of_injective hci hii hΔ + obtain ⟨Ω, hΩ, hin, -⟩ := Surface.exists_disc_around hmW hΔW (fun x _ => hW.2.2 x) isOpen_univ + (subset_univ _) + have hlay : ∀ t, t < s → ∀ r ∈ regLayer Γ r₀ t, closure r ⊆ i '' Δ ∧ Disjoint (closure r) + (i '' bd T) := fun t ht r hr => h.closure_layer_subset hS habc hm hcyl hC hΔ.isClosed hEΔ hA + (by omega) hr + have hsub : ∀ t < s, ⋃ r ∈ regLayer Γ r₀ t, closure r ⊆ discInt Ω := fun t ht + => iUnion₂_subset fun r hr => (hlay t ht r hr).1.trans hin + obtain ⟨C', D', h1, h2⟩ := exists_region_nest_in_disc hW h.region h.mem hΩ hsub + have hUin : ∀ t : Fin s, ∀ {x}, x ∈ (C' t).U → ∃ r ∈ regLayer Γ r₀ t, x ∈ closure r + := fun t {x} hx => by + obtain ⟨-, h3, -⟩ := h1 t + have := boundary_subset_layer hW (h3.U_subset hx) + simpa using this + have hbdΩ : ∀ t, discBd (D' t) ⊆ i '' Δ := fun t x hx => by + obtain ⟨-, -, -, h4, -⟩ := h1 t + obtain ⟨r, hr, h5⟩ := hUin t (h4 ▸ hx) + exact (hlay t t.2 r hr).1 h5 + have hD'Δ : ∀ t, D' t ⊆ i '' Δ := fun t => disc_subset_of_bd_in_disc hW hΩ hΔW (h1 t).2.2.1 hin + (h1 t).2.2.2.2.2 (hbdΩ t) + have hne : Nonempty T := ⟨p⟩ + have hTc : CompactSpace T := hT.1 + have hpre : ∀ t, IsClosedDisc (i ⁻¹' D' t) ∧ discBd (i ⁻¹' D' t) = i ⁻¹' discBd (D' t) := fun t + => by + have hsr : D' t ⊆ range i := (hD'Δ t).trans (image_subset_range _ _) + have h3 : IsClosedDisc (i ⁻¹' D' t) := isClosedDisc_preimage_of_subset_range hci hii + (h1 t).2.2.1 hsr + have h4 := (isClosedDisc_image_of_injOn h3 hci hii.injOn).2 + rw [image_preimage_eq_of_subset hsr] at h4 + rw [h4, preimage_image_eq _ hii] + exact ⟨h3, rfl⟩ + have hsubs : ∀ t, (C' t).IsSubdrawing Γ := fun t => by + have h3 : (boundaryDrawing Γ (regLayer Γ r₀ t)).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ + _ + exact ⟨(h1 t).2.1.1.trans h3.1, (h1 t).2.1.2.trans h3.2⟩ + have hpull := fun t => exists_pull h.matched (hsubs t) + choose B hB₁ hB₂ hB₃ hB₄ using hpull + have hBU : ∀ t, j '' (B t).U = i ⁻¹' (C' t).U := fun t => by + rw [← hB₂ t, image_comp, preimage_image_eq _ hii] + have hBs : ∀ t, (B t).IsSubdrawing G₁ := hB₁ + refine ⟨B, fun t => i ⁻¹' D' t, fun t => ⟨?_, hB₁ t, (hpre t).1, ?_, ?_, ?_, ?_, ?_⟩, + fun t t' htt => ⟨?_, ?_⟩⟩ + · have h3 := (hpre t).1.isOArc_discBd + rw [(hpre t).2, (h1 t).2.2.2.1, ← hBU t] at h3 + have h4 := pull_oArc h.cap.isEmbedding h3 (image_subset_range _ _) + rw [preimage_image_eq _ hji] at h4 + obtain ⟨X, h5, h6, h7⟩ := exists_circuit_of_oArc h4 (Subset.refl _) + have hV : X.V = (B t).V := subset_antisymm h6.1 fun x hx => mem_V_of_subdrawing h6 (h7.symm ▸ + (B t).V_subset_U hx) hx + have hE : X.E = (B t).E := by + unfold Drawing.E + rw [h7, hV] + have : X = B t := Drawing.ext_of_V_E hV hE + exact this ▸ h5 + · rw [(hpre t).2, (h1 t).2.2.2.1, hBU t] + · have hEd := h.disc.1 + have h3 : Disjoint (discInt E) (frontier (i ⁻¹' D' t)) := by + refine disjoint_left.mpr fun x hx hf => ?_ + have h4 := frontier_disc_subset hT.2.2 (hpre t).1 hf + rw [(hpre t).2, (h1 t).2.2.2.1, ← hBU t] at h4 + obtain ⟨g, hg, rfl⟩ := h4 + have hg₁ : g ∈ G₁.U := (hB₁ t).U_subset hg + rw [h.U] at hg₁ + exact hg₁.2 hx + rcases inside_or_off hEd.isPreconnected_discInt (hpre t).1.isClosed h3 with h4 | h4 + · exact hEd.subset_closure_discInt.trans (closure_minimal (h4.trans interior_subset) + (hpre t).1.isClosed) + · exact absurd (h1 t).2.2.2.2.1 (h4 h.inside) + · intro x hx + obtain ⟨y, hy, he⟩ := hD'Δ t hx + exact hii he ▸ hy + · rw [disjoint_left] + intro x hx hb + by_cases h3 : x ∈ discBd (i ⁻¹' D' t) + · rw [(hpre t).2] at h3 + obtain ⟨r, hr, h5⟩ := hUin t ((h1 t).2.2.2.1 ▸ h3) + exact disjoint_left.mp (hlay t t.2 r hr).2 h5 (mem_image_of_mem i hb) + · exact hb (Surface.isInteriorPoint_of_mem_discInt hT.2.2 (hpre t).1 ⟨hx, h3⟩) + · intro y hy + have h3 : i (j y) ∈ (C' t).V := by + rw [← hB₃ t] + exact ⟨y, hy, rfl⟩ + obtain ⟨⟨r, hr, h4⟩, -⟩ := (mem_boundaryDrawing_V hW).mp ((h1 t).2.1.1 h3) + obtain ⟨t', ht', -, h5⟩ := h.vertex_reach hS habc hm hcyl hC + (show t.1 + 1 ≤ n by omega) hr ((hsubs t).1 h3) h4.2.2 + have hjt : j y = t' := hii ht' + subst hjt + rcases h5 with h5 | ⟨z, X, h5, h6, h7, h8⟩ + · have hyU : y ∈ G₁.U := (hB₁ t).U_subset ((B t).V_subset_U hy) + rw [h.U] at hyU + have hsc := h.disc.isScriptASet hS hC h.cap (not_isSphere_cap hS habc hm h.cap) + refine ⟨j ⁻¹' discBd E, ⟨hsc.1, hsc.2.1, hsc.2.2.1, hsc.2.2.2.1, + hsc.2.2.2.2.trans (by omega)⟩, ?_, Subset.refl _⟩ + by_contra h6 + exact hyU.2 ⟨h5, h6⟩ + · have hzy : y = z := hji h5 + subst hzy + exact ⟨X, h6, h7, h8⟩ + · rw [disjoint_left] + intro x h3 h4 + have h5 : i (j x) ∈ (C' t).U := by + rw [← hB₂ t] + exact ⟨x, h3, rfl⟩ + have h6 : i (j x) ∈ (C' t').U := by + rw [← hB₂ t'] + exact ⟨x, h4, rfl⟩ + exact boundary_off_layer hW h.region (Fin.lt_def.mp htt) ((h1 t').2.1.U_subset h6) + (boundary_subset_layer hW ((h1 t).2.1.U_subset h5)) + · exact preimage_mono (h2 t t' htt).2 + +end Reach + +/-- **The layer data exists.** Each cuff disc `E` gives layer data, in the closed surface got by +capping the cuffs of the surface model of `Σ + CHat`. -/ +theorem exists_layer_setup (hS : IsSurface S) [ConnectedSpace S] {a b c : ℕ} (hm : Nonempty + (S ≃ₜ SurfaceModel a b c)) (hC : C ∈ cuffs S) (hc : IsCappedCuff C T j D) (hbT : bd T = j '' + (bd S \ C)) (hG : G.IsProper) (hd : IsCuffDisc G j D ra E) (h₁ : ra + n < alpha G) (h₂ : ra + + (ra + n) < alpha G) + (h₃ : ∀ C₁ ∈ cuffs S, C₁ ≠ C → ra + n + (G.V ∩ C₁).ncard < alpha G) : + ∃ (W : Type) (_ : TopologicalSpace W) (_ : ConnectedSpace W) (i : T → W) (K : Set W) + (G₁ : Drawing S) (Γ : Drawing W) (r₀ : Set W) (p : T), IsLayerSetup (C + := C) G j D ra E i K G₁ Γ r₀ p n := by + classical + have hT := hc.isSurface + have : T2Space T := hT.2.1 + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have hman := hT.2.2 + obtain ⟨hΔ, hDE, hn, -⟩ := id hd + obtain ⟨-, ⟨e⟩⟩ := cappedCuff_homeo_model hS hm hC hc + have hM : IsSurface (SurfaceModel a b (c - 1)) := isSurface_of_homeo e hT + have hMc : ConnectedSpace (SurfaceModel a b (c - 1)) := connectedSpace_of_model ⟨Homeomorph.refl + _⟩ + obtain ⟨W, tW, i', K, hW, hi', hK, hun, hin, hconn⟩ := exists_capAll _ hM + have hWc := hconn hMc + have : T2Space W := hW.2.1 + let i : T → W := i' ∘ e + have hi : IsClosedEmbedding i := hi'.comp e.isClosedEmbedding + have hri : range i = range i' := by + rw [range_comp, e.surjective.range_eq, image_univ] + have hibd : i '' bd T = i' '' bd (SurfaceModel a b (c - 1)) := by + rw [image_comp, image_bd_homeomorph e] + have hcj : IsClosedEmbedding j := hc.isEmbedding.continuous.isClosedEmbedding + hc.isEmbedding.injective + let Z : Set S := j ⁻¹' discInt E + have hZo : IsOpen Z := (hΔ.isOpen_discInt hman).preimage hcj.continuous + have hedge : ∀ e ∈ G.E, (∃ y ∈ e, y ∉ Z) → Disjoint e Z := by + rintro e he ⟨y, hye, hyZ⟩ + have hpc : IsPreconnected (j '' e) := he.2.2.1.isConnected.isPreconnected.image _ + hcj.continuous.continuousOn + have hdb : Disjoint (j '' e) (discBd E) := by + rw [disjoint_left] + rintro _ ⟨z, hz, rfl⟩ hzb + have hzU := he.2.1 hz + exact hzU.2 (hn ⟨hzb, hzU.1⟩) + rcases inside_or_off hpc hΔ.isClosed (hdb.mono_right (frontier_disc_subset hman hΔ)) with h1 | + h1 + · exact absurd (⟨interior_subset (h1 (mem_image_of_mem j hye)), + disjoint_left.mp hdb (mem_image_of_mem j hye)⟩ : j y ∈ discInt E) hyZ + · rw [disjoint_left] + exact fun z hz hzZ => h1 (mem_image_of_mem j hz) hzZ.1 + obtain ⟨G₁, hG₁, hG₁U, hG₁V⟩ := exists_outside_drawing hZo hedge + have hcij : IsClosedEmbedding (i ∘ j) := hi.comp hcj + obtain ⟨Γ, hΓ⟩ := exists_image_matched hcij G₁ + obtain ⟨p, hp⟩ := hΔ.nonempty_discInt + have hΓU : Γ.U = (i ∘ j) '' G₁.U := by simpa using hΓ.image_U.symm + have hpoff : i p ∉ Γ.U := fun h1 => by + rw [hΓU] at h1 + obtain ⟨g, hg, he⟩ := h1 + rw [hG₁U] at hg + have h2 : j g = p := hi.injective he + exact hg.2 (show j g ∈ discInt E from h2 ▸ hp) + have hreg : connectedComponentIn (univ \ Γ.U) (i p) ∈ Γ.R := (mem_R_iff Γ).mpr ⟨i p, hpoff, rfl⟩ + refine ⟨W, tW, hWc, i, K, G₁, Γ, _, p, ⟨hd, hc, hG₁, hG₁U, hG₁V, hi, hW, hK, ?_, ?_, hΓ, hreg, + hp, mem_connectedComponentIn ⟨mem_univ _, hpoff⟩, hbT, hG, h₁, h₂, h₃⟩⟩ + · rw [hri, hun] + · rw [hri, hin, hibd] + +/-- **The disc `Δ(C)`.** This is the start of the proof of (5.9) on page 234: `𝒜_R(C)` is planar in +`Σ + CHat` by (5.7), and a cuff disc whose boundary lies in `𝒜_R(C)` lies in the disc. -/ +theorem exists_scriptA_disc (hS : IsSurface S) [ConnectedSpace S] {a b c : ℕ} (hm : Nonempty + (S ≃ₜ SurfaceModel a b c)) (habc : 3 ≤ 3 * a + 3 * b + c) (hG : G.IsProper) (hC : C ∈ cuffs S) + (hc : IsCappedCuff C T j D) {R : ℕ} (hR : 9 * (R + 1) ≤ 2 * alpha G) : + ∃ Δ, IsClosedDisc Δ ∧ ∀ z ∈ scriptA G R C, j z ∈ Δ := by + obtain ⟨Δ, h1, h2⟩ := (theorem_5_7_proof hS hm habc hG hC hR).2.2 T j D hc + exact ⟨Δ, h1, fun z hz => h2 (mem_image_of_mem j hz)⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffOrder.lean b/LeanPool/GraphMinor/GM07/CuffOrder.lean new file mode 100644 index 0000000000..706703775c --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffOrder.lean @@ -0,0 +1,209 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffLift + +/-! +# The order of the vertices on a top arc + +Graph Minors VII, (5.9), page 235. The paths `N_i(C)` are disjoint, and each holds one end `t_i`. So +an arc of `N(C)` between two neighbouring ends `t_l` and `t_r` holds first a piece of `N_l(C)` and +then a piece of `N_r(C)`, and nothing else. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +theorem isLine_Icc {a b : ℝ} (h : a < b) : IsLineWithEnds (Icc a b) a b := by + let e : unitInterval → ℝ := fun s => a + s.1 * (b - a) + have hc : Continuous e := by fun_prop + have hne : b - a ≠ 0 := (sub_pos.mpr h).ne' + have hi : Injective e := fun s s' he => by + have h1 : s.1 * (b - a) = s'.1 * (b - a) := by + simp only [e] at he + linarith + exact Subtype.ext (mul_right_cancel₀ hne h1) + have hr : range e = Icc a b := by + ext y + constructor + · rintro ⟨s, rfl⟩ + have h1 := s.2.1 + have h2 := s.2.2 + have h3 := sub_pos.mpr h + simp only [e] + constructor <;> nlinarith + · intro hy + have h3 := sub_pos.mpr h + refine ⟨⟨(y - a) / (b - a), div_nonneg (by linarith [hy.1]) h3.le, + (div_le_one h3).mpr (by linarith [hy.2])⟩, ?_⟩ + simp only [e] + field_simp + ring + refine ⟨(hc.isClosedEmbedding hi).isEmbedding.toHomeomorph.trans (Homeomorph.setCongr hr), ?_, ?_⟩ + · change e 0 = a + simp [e] + · change e 1 = b + simp [e] + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- A line in an `O`-arc is one of the two arcs between its ends. -/ +theorem exists_other_arc {F P : Set S} {u v : S} (hF : IsOArc F) (hP : IsLineWithEnds P u v) + (hPF : P ⊆ F) (huv : u ≠ v) : ∃ P', IsLineWithEnds P' u v ∧ P ∪ P' = F ∧ P ∩ P' = {u, v} := by + obtain ⟨A, B, hA, hB, hu, hi⟩ := hF.lines (hPF hP.left_mem) (hPF hP.right_mem) huv + have key : ∀ {A B : Set S}, IsLineWithEnds A u v → IsLineWithEnds B u v → A ∪ B = F → A ∩ B + = {u, v} → P \ {u, v} ⊆ A → P = A := fun {A B} hA hB hu hi hs => by + have h1 : P ⊆ A := by + have h2 : P ⊆ closure (P \ {u, v}) := fun z hz => hP.subset_closure_diff hz + exact h2.trans (closure_minimal hs hA.isCompact.isClosed) + refine subset_antisymm h1 ?_ + intro z hz + by_contra hzP + have hzu : z ≠ u := fun h => hzP (h ▸ hP.left_mem) + have hzv : z ≠ v := fun h => hzP (h ▸ hP.right_mem) + obtain ⟨L₁, L₂, h₁, h₂, hu', hi'⟩ := hA.split hz hzu hzv + have hd : Disjoint P (L₁ ∩ L₂) := by + rw [hi', disjoint_singleton_right] + exact hzP + rcases GM12.subset_side h₁.isCompact.isClosed h₂.isCompact.isClosed (GM12.line_conn hP) + (by rw [hu']; exact h1) hd with h3 | h3 + · have h4 : v ∈ L₁ ∩ L₂ := ⟨h3 hP.right_mem, h₂.right_mem⟩ + rw [hi'] at h4 + exact hzv h4.symm + · have h4 : u ∈ L₁ ∩ L₂ := ⟨h₁.left_mem, h3 hP.left_mem⟩ + rw [hi'] at h4 + exact hzu h4.symm + have hd : Disjoint (P \ {u, v}) (A ∩ B) := by + rw [hi] + exact disjoint_left.mpr fun z hz h => hz.2 h + rcases GM12.subset_side hA.isCompact.isClosed hB.isCompact.isClosed hP.isPreconnected_diff + (by rw [hu]; exact fun z hz => hPF hz.1) hd with h1 | h1 + · rw [key hA hB hu hi h1] + exact ⟨B, hB, hu, hi⟩ + · rw [key hB hA (by rw [union_comm]; exact hu) (by rw [inter_comm]; exact hi) h1] + exact ⟨A, hA, by rw [union_comm]; exact hu, by rw [inter_comm]; exact hi⟩ + +/-- A connected set in an `O`-arc that misses the two ends of a line in the `O`-arc is inside the +line or misses it. -/ +theorem subset_line_or_off {F P Y : Set S} {u v : S} (hF : IsOArc F) (hP : IsLineWithEnds P u v) + (hPF : P ⊆ F) (huv : u ≠ v) (hY : IsPreconnected Y) (hYF : Y ⊆ F) (hu : u ∉ Y) + (hv : v ∉ Y) {y : S} (hy : y ∈ Y) (hyP : y ∈ P) : Y ⊆ P := by + obtain ⟨P', hl, h1, h2⟩ := exists_other_arc hF hP hPF huv + have hd : Disjoint Y (P ∩ P') := by + rw [h2, disjoint_left] + rintro z hz (rfl | rfl) + · exact hu hz + · exact hv hz + rcases GM12.subset_side hP.isCompact.isClosed hl.isCompact.isClosed hY + (by rw [h1]; exact hYF) hd with h3 | h3 + · exact h3 + · have h4 : y ∈ P ∩ P' := ⟨hyP, h3 hy⟩ + exact (disjoint_left.mp hd hy h4).elim + +theorem IsParam.isLine {P : Set S} {u v : S} {p : ℝ → S} (h : IsParam P u v p) : IsLineWithEnds P u + v := by + have h1 := isLineWithEnds_image (isLine_Icc (zero_lt_one' ℝ)) h.cont h.inj + rwa [h.image, h.zero, h.one] at h1 + +variable {N : Drawing S} {ι : Type*} {R : ι → Drawing S} {t : ι → S} + +/-- The set of a subdrawing of a path is connected, in the case of a path. -/ +theorem isPreconnected_of_isPathBetween {P : Drawing S} {a b : S} (hP : P.IsPathBetween a b) : + IsPreconnected P.U := by + by_cases hab : a = b + · subst hab + obtain ⟨W, hW, hV, hE⟩ := hP + have hnil : ∀ x ∈ P.U, x = a := fun x hx => by + by_cases hxV : x ∈ P.V + · rw [hV] at hxV + cases W with + | nil _ => simpa [GraphWalk.support] using hxV + | cons _ r => + exact absurd (List.nodup_cons.mp hW).1 (by simpa using r.end_mem_support) + · obtain ⟨e, he, -⟩ := P.exists_edge_of_mem hx hxV + rw [hE] at he + cases W with + | nil _ => simp [GraphWalk.edges] at he + | cons _ r => + exact absurd (List.nodup_cons.mp hW).1 (by simpa using r.end_mem_support) + have hU : P.U ⊆ {a} := hnil + rcases subset_singleton_iff_eq.mp hU with h | h + · rw [h] + exact isPreconnected_empty + · rw [h] + exact isPreconnected_singleton + · exact GM12.line_conn (isLine_of_isPathBetween hP hab) + +/-- **The order on a top arc.** Let `P` be a line in the circuit `N` from `t l` to `t r`, and let +the `R i` be connected pieces of `N` with `t i` in `R i`, where no other `t i` is on `P`. Then on +`P` first comes the part of `R l`, and last the part of `R r`, and no other piece meets `P`. -/ +theorem exists_top_split (hN : IsOArc N.U) (hR : ∀ i, (R i).IsSubdrawing N) + (hRp : ∀ i, IsPreconnected (R i).U) (hdis : ∀ i i', i ≠ i' → Disjoint (R i).U (R i').U) + (ht : ∀ i, t i ∈ (R i).V) {l r : ι} (hlr : l ≠ r) {τ : ℝ → S} {P : Set S} (hτ : IsParam P (t l) + (t r) τ) (hP : P ⊆ N.U) (hoff : ∀ i, i ≠ l → i ≠ r → t i ∉ P) : + ∃ a b : ℝ, 0 ≤ a ∧ a < b ∧ b ≤ 1 ∧ ∀ m ∈ Icc (0 : ℝ) 1, ∀ i, τ m ∈ (R i).U → (i = l ∧ m ≤ a) ∨ + (i = r ∧ b ≤ m) := by + classical + have hUU : ∀ {i i' : ι} {z}, i ≠ i' → z ∈ (R i).U → z ∉ (R i').U := fun {i i' z} h1 h2 h3 + => disjoint_left.mp (hdis i i' h1) h2 h3 + have htU : ∀ i, t i ∈ (R i).U := fun i => (R i).V_subset_U (ht i) + have hne : t l ≠ t r := fun h => hUU hlr (htU l) (h ▸ htU r) + have hmem01 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 ∧ (1 : ℝ) ∈ Icc (0 : ℝ) 1 := ⟨⟨le_rfl, zero_le_one⟩, + zero_le_one, le_rfl⟩ + have hsub : ∀ i, (R i).U ⊆ N.U := fun i => (hR i).U_subset + have hthird : ∀ m ∈ Icc (0 : ℝ) 1, ∀ i, τ m ∈ (R i).U → i = l ∨ i = r := fun m hm i hi => by + by_contra hc + push Not at hc + obtain ⟨h1, h2⟩ := hc + have h3 : (R i).U ⊆ P := subset_line_or_off hN hτ.isLine hP hne (hRp i) (hsub i) (hUU h1.symm + (htU l)) (hUU h2.symm (htU r)) hi (hτ.mem hm) + exact hoff i h1 h2 (h3 (htU i)) + have hbad : ∀ m ∈ Icc (0 : ℝ) 1, ∀ m' ∈ Icc (0 : ℝ) 1, m < m' → τ m ∈ (R r).U → τ m' ∈ (R l).U + → False := fun m hm m' hm' hlt h1 h2 => by + have hm0 : m ≠ 0 := fun h => hUU hlr (htU l) (by rw [← hτ.zero, ← h]; exact h1) + have hlt1 : m < 1 := lt_of_lt_of_le hlt hm'.2 + have hs : Icc m 1 ⊆ Icc (0 : ℝ) 1 := Icc_subset_Icc_left hm.1 + have hl₀ : IsLineWithEnds (τ '' Icc m 1) (τ m) (τ 1) := isLineWithEnds_image (isLine_Icc hlt1) + (hτ.cont.mono hs) (hτ.inj.mono hs) + rw [hτ.one] at hl₀ + have hPs : τ '' Icc m 1 ⊆ N.U := fun z hz => by + obtain ⟨s, hs', rfl⟩ := hz + exact hP (hτ.mem (hs hs')) + have hne' : τ m ≠ t r := fun h => absurd (hτ.inj hm hmem01.2 (h.trans hτ.one.symm)) hlt1.ne + have h3 : (R l).U ⊆ τ '' Icc m 1 := subset_line_or_off hN hl₀ hPs hne' (hRp l) (hsub l) + (hUU hlr.symm h1) (hUU hlr.symm (htU r)) h2 ⟨m', ⟨hlt.le, hm'.2⟩, rfl⟩ + obtain ⟨s, hs', he⟩ := h3 (htU l) + have h4 : s = 0 := hτ.inj (hs hs') hmem01.1 (he.trans hτ.zero.symm) + have h5 : m ≤ 0 := h4 ▸ hs'.1 + exact hm0 (le_antisymm h5 hm.1) + have hcomp : ∀ i, IsCompact {m | m ∈ Icc (0 : ℝ) 1 ∧ τ m ∈ (R i).U} := fun i => by + have h1 := hτ.cont.preimage_isClosed_of_isClosed isClosed_Icc (R i).isClosed_U + exact isCompact_Icc.of_isClosed_subset h1 (fun _ hm => hm.1) + obtain ⟨a, ha, hamax⟩ := (hcomp l).exists_isMaxOn + ⟨0, hmem01.1, by rw [hτ.zero]; exact htU l⟩ continuous_id.continuousOn + obtain ⟨b, hb, hbmin⟩ := (hcomp r).exists_isMinOn + ⟨1, hmem01.2, by rw [hτ.one]; exact htU r⟩ continuous_id.continuousOn + have hab : a < b := by + by_contra hc + push Not at hc + rcases hc.lt_or_eq with h1 | h1 + · exact hbad b hb.1 a ha.1 h1 hb.2 ha.2 + · exact hUU hlr ha.2 (h1 ▸ hb.2) + refine ⟨a, b, ha.1.1, hab, hb.1.2, fun m hm i hi => ?_⟩ + rcases hthird m hm i hi with rfl | rfl + · exact .inl ⟨rfl, hamax ⟨hm, hi⟩⟩ + · exact .inr ⟨rfl, hbmin ⟨hm, hi⟩⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffReach.lean b/LeanPool/GraphMinor/GM07/CuffReach.lean new file mode 100644 index 0000000000..1f785d81dd --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffReach.lean @@ -0,0 +1,302 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffLayers + +/-! +# Sets that reach out from `A(C)` + +Graph Minors VII, (5.9), page 234: "there is a solid, connected, $G$-normal set $X \subseteq \Sigma$ +with $y \in X$ and $A(C) \subseteq X$, with $$ |V(G) \cap X| \le j + |V(G) \cap A(C)| \le +\frac{1}{2}v + k(C) + 2 + vk(C) \le 2kv - 1 < \alpha(G) $$ since $k(C) \le 2k - 2$. Hence $X$ +surrounds $C$". +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A line is connected. -/ +theorem isPreconnected_of_isLine {Y : Type*} [TopologicalSpace Y] {L : Set Y} {u v : Y} + (h : IsLineWithEnds L u v) : IsPreconnected L := by + obtain ⟨f, -, -⟩ := id h + have h3 : range (fun t => (f t).1) = L := by + rw [show (fun t => (f t).1) = Subtype.val ∘ f from rfl, f.surjective.range_comp, + Subtype.range_coe] + exact h3 ▸ isPreconnected_range (by fun_prop) + +/-- "Hence `X` surrounds `C`": a solid connected `G`-normal set with few vertices that holds a set +surrounding `C` surrounds `C`, by (5.3). -/ +theorem surrounds_of_superset (hS : IsSurface S) [ConnectedSpace S] (hcyl : ¬ Nonempty + (S ≃ₜ SurfaceModel 0 0 2)) {G : Drawing S} {C F X : Set S} {r r' : ℕ} (hF : IsScriptASet G r C F) + (hFX : F ⊆ X) (hsol : IsSolid X) (hcon : IsConnected X) (hn : G.IsNormal X) + (hcard : (G.V ∩ X).ncard ≤ r') (hα : r' < alpha G) (hα' : r + r' < alpha G) : IsScriptASet G r' + C X := by + have hC : C ∈ cuffs S := hF.2.2.2.1.1 + have hnear : IsNearPlanar X := by + by_contra hnp + have h1 : IsAlphaCandidate G X := ⟨hsol, hcon, hn, hnp⟩ + have h2 : alpha G ≤ (X ∩ G.V).ncard := Nat.sInf_le ⟨X, h1, rfl⟩ + rw [inter_comm] at h2 + omega + have hnotp : ¬ IsPlanar X := fun ⟨Δ, h1, h2⟩ => hF.2.2.2.1.2.2 ⟨Δ, h1, hFX.trans h2⟩ + rcases hnear with h | ⟨C₁, hC₁, h⟩ + · exact absurd h hnotp + · by_cases he : C₁ = C + · subst he + exact ⟨hsol, hcon, hn, ⟨hC₁, h, hnotp⟩, hcard⟩ + · exfalso + obtain ⟨x, hx⟩ := hF.2.1.nonempty + have h3 : x ∈ scriptA G r C := ⟨F, ⟨hF.1, hF.2.1, hF.2.2.1, hF.2.2.2.1, hF.2.2.2.2⟩, hx⟩ + have h4 : x ∈ scriptA G r' C₁ := ⟨X, ⟨hsol, hcon, hn, ⟨hC₁, h, hnotp⟩, hcard⟩, hFX hx⟩ + have h5 := theorem_5_3_proof hS hcyl G hC hC₁ (Ne.symm he) hα' + exact (h5 ▸ (⟨h3, h4⟩ : x ∈ scriptA G r C ∩ scriptA G r' C₁) : x ∈ (∅ : Set S)) + +variable {T : Type u} [TopologicalSpace T] {C : Set S} {j : S → T} {D : Set T} + +/-- **The set `X` of page 234.** A path in `Σ + CHat` from a cuff disc `E` to a point `t` off it, +which meets `G` off the inside of `E` in at most `n` vertices, gives a set `X` that surrounds `C`, +holds `t` and the boundary of `E`, +and has at most `n` more vertices. -/ +theorem exists_reach_of_path (hS : IsSurface S) [ConnectedSpace S] (hcyl : ¬ Nonempty + (S ≃ₜ SurfaceModel 0 0 2)) (hC : C ∈ cuffs S) (hc : IsCappedCuff C T j D) + (hns : ¬ IsSphere T) {G : Drawing S} {ra n : ℕ} {E : Set T} (hd : IsCuffDisc G j D ra E) + {δ : unitInterval → T} (hδ : Continuous δ) (h0 : δ 0 ∈ E) (h1 : δ 1 ∉ E) {X' : Set S} + (hX'V : X' ⊆ G.V) (hX'c : X'.ncard ≤ n) (hnorm : ∀ z ∈ G.U, j z ∉ discInt E → j z ∈ range δ + → z ∈ X') (hα : ra + n < alpha G) (hα' : ra + (ra + n) < alpha G) : + ∃ z X, δ 1 = j z ∧ IsScriptASet G (ra + n) C X ∧ z ∈ X ∧ j ⁻¹' discBd E ⊆ X := by + classical + have hT := hc.isSurface + have : T2Space T := hT.2.1 + have hman := hT.2.2 + have hS2 : T2Space S := hS.2.1 + obtain ⟨hΔ, hDE, hn, hcount⟩ := id hd + have hj := hc.isEmbedding + have hclS : IsClosed {τ | δ τ ∈ E} := hΔ.isClosed.preimage hδ + have hne : {τ | δ τ ∈ E}.Nonempty := ⟨0, h0⟩ + let σ := sSup {τ | δ τ ∈ E} + have hσ : δ σ ∈ E := hclS.csSup_mem hne (OrderTop.bddAbove _) + have haft : ∀ τ, σ < τ → δ τ ∉ E := fun τ h3 h4 => absurd (le_sSup (show τ ∈ {τ | δ τ ∈ E} from + h4)) (not_le.mpr h3) + have hσ1 : σ < 1 := lt_of_le_of_ne le_top fun h3 => h1 (h3 ▸ hσ) + -- the part after the last time in `E` + have hbd : δ σ ∈ discBd E := by + refine frontier_disc_subset hman hΔ ?_ + rw [frontier_eq_closure_inter_closure] + refine ⟨subset_closure hσ, ?_⟩ + have h3 : σ ∈ closure (Ioi σ) := by + rw [closure_Ioi' (a := σ) ⟨1, hσ1⟩] + exact self_mem_Ici + exact map_mem_closure hδ h3 fun τ hτ => haft τ hτ + have hσv : (0 : ℝ) ≤ σ.1 ∧ σ.1 < 1 := ⟨σ.2.1, hσ1⟩ + let f : unitInterval → unitInterval := fun u => ⟨σ.1 + (1 - σ.1) * u.1, by + have := u.2.1 + have := u.2.2 + constructor <;> nlinarith [hσv.1, hσv.2]⟩ + have hfc : Continuous f := by + refine Continuous.subtype_mk ?_ _ + fun_prop + let δ' : unitInterval → T := δ ∘ f + have hδ'c : Continuous δ' := hδ.comp hfc + have hf0 : f 0 = σ := Subtype.ext (by simp [f]) + have hf1 : f 1 = 1 := Subtype.ext (by simp [f]) + have hne' : δ' 0 ≠ δ' 1 := by + simp only [δ', comp_apply, hf0, hf1] + exact fun h3 => h1 (h3 ▸ hσ) + obtain ⟨e, hec, hei, he0, he1, her⟩ := exists_arc_of_path hδ'c hne' + simp only [δ', comp_apply, hf0, hf1] at he0 he1 + have hoff : ∀ {x}, x ∈ range e → x ∉ E ∨ x = δ σ := fun {x} hx => by + obtain ⟨u, rfl⟩ := her hx + by_cases hu : u = 0 + · subst hu + exact .inr (by simp [δ', hf0]) + · refine .inl (haft _ ?_) + have h3 : (0 : ℝ) < u.1 := lt_of_le_of_ne u.2.1 fun h => hu (Subtype.ext h.symm) + change σ.1 < σ.1 + (1 - σ.1) * u.1 + nlinarith [hσv.2] + have hrδ : range e ⊆ range δ := fun x hx => by + obtain ⟨u, rfl⟩ := her hx + exact ⟨f u, rfl⟩ + have hbr := discBd_subset_range hc hDE + have hrj : range e ⊆ range j := fun x hx => by + rcases hoff hx with h3 | h3 + · exact compl_disc_subset_range hc hDE h3 + · exact h3 ▸ hbr hbd + have hl : IsLineWithEnds (range e) (δ σ) (δ 1) := by + obtain ⟨u₀, hu₀⟩ := hbr hbd + have : CompactSpace unitInterval := inferInstance + have hem : IsEmbedding e := (hec.isClosedEmbedding hei).isEmbedding + refine ⟨(hem.toHomeomorph), ?_, ?_⟩ + · exact he0 + · exact he1 + obtain ⟨u₀, hu₀⟩ := hbr hbd + obtain ⟨z, hz⟩ := hrj (show δ 1 ∈ range e from ⟨1, he1⟩) + rw [← hu₀, ← hz] at hl + have hL' := pull_line hj hl hrj + set L' := j ⁻¹' range e with hL'def + set F := j ⁻¹' discBd E with hFdef + have hu₀F : u₀ ∈ F := by + change j u₀ ∈ discBd E + rw [hu₀] + exact hbd + have hO := isOArc_preimage_bd hc hΔ hDE + have hsol : IsSolid (F ∪ L') := theorem_11_6_proof hS (isSolid_of_isOArc hS hO) + (isSolid_of_isLineWithEnds hS hL') + have hLp : IsPreconnected L' := isPreconnected_of_isLine hL' + have hcon : IsConnected (F ∪ L') := (isConnected_of_isOArc hO).union ⟨u₀, hu₀F, hL'.left_mem⟩ + ⟨⟨u₀, hL'.left_mem⟩, hLp⟩ + have hcase : ∀ {w}, w ∈ L' → w ∈ G.U → w ∈ X' ∨ w ∈ F := fun {w} hw hU => by + rcases hoff hw with h3 | h3 + · exact .inl (hnorm w hU (fun h4 => h3 h4.1) (hrδ hw)) + · refine .inr ?_ + change j w ∈ discBd E + rw [h3] + exact hbd + have hnormal : G.IsNormal (F ∪ L') := by + rintro w ⟨hw | hw, hU⟩ + · exact hn ⟨hw, hU⟩ + · rcases hcase hw hU with h3 | h3 + · exact hX'V h3 + · exact hn ⟨h3, hU⟩ + have hcard : (G.V ∩ (F ∪ L')).ncard ≤ ra + n := by + have hsub : G.V ∩ (F ∪ L') ⊆ (G.V ∩ F) ∪ X' := by + rintro w ⟨hV, hw | hw⟩ + · exact .inl ⟨hV, hw⟩ + · rcases hcase hw (G.V_subset_U hV) with h3 | h3 + · exact .inr h3 + · exact .inl ⟨hV, h3⟩ + have hfin : ((G.V ∩ F) ∪ X').Finite := (G.finite_V.subset inter_subset_left).union + (G.finite_V.subset hX'V) + have h3 := ncard_le_ncard hsub hfin + have h4 := ncard_union_le (G.V ∩ F) X' + omega + refine ⟨z, F ∪ L', hz.symm, surrounds_of_superset hS hcyl (hd.isScriptASet hS hC hc hns) + subset_union_left hsol hcon hnormal hcard hα hα', .inr hL'.right_mem, subset_union_left⟩ + +/-- **Reaching out along a connected set of a closed surface.** Let `Σ + CHat` sit in a closed +surface `W`, by `i`, and let `A` be a path-connected set of `W` from a cuff disc `E`, that meets `G` +off the inside of `E` in at most `n` vertices. Then +`A` stays in `Σ + CHat`, and each point of `A` is in `E` or in a set `X` as on page 234. -/ +theorem exists_reach_in_closed {W : Type} [TopologicalSpace W] + (hS : IsSurface S) [ConnectedSpace S] {a b c : ℕ} (habc : 3 ≤ 3 * a + 3 * b + c) (hm : Nonempty + (S ≃ₜ SurfaceModel a b c)) (hcyl : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 2)) (hC : C ∈ cuffs S) + (hc : IsCappedCuff C T j D) (hbT : bd T = j '' (bd S \ C)) {G : Drawing S} + (hG : G.IsProper) {ra n : ℕ} {E : Set T} (hd : IsCuffDisc G j D ra E) {i : T → W} + (hi : IsClosedEmbedding i) (hopen : IsOpen (i '' (bd T)ᶜ)) + {A : Set W} (hA : IsPathConnected A) {p : T} (hpE : p ∈ E) (hpA : i p ∈ A) {X' : Set S} + (hX'V : X' ⊆ G.V) (hX'c : X'.ncard ≤ n) (hnorm : ∀ z ∈ G.U, j z ∉ discInt E → i (j z) ∈ A + → z ∈ X') (hα : ra + n < alpha G) (hα' : ra + (ra + n) < alpha G) + (hα₂ : ∀ C₁ ∈ cuffs S, C₁ ≠ C → ra + n + (G.V ∩ C₁).ncard < alpha G) {y : W} (hy : y ∈ A) : + ∃ t, y = i t ∧ t ∉ bd T ∧ (t ∈ E ∨ ∃ z X, t = j z ∧ IsScriptASet G (ra + n) C X ∧ z ∈ X + ∧ j ⁻¹' discBd E ⊆ X) := by + classical + have hT := hc.isSurface + have : T2Space T := hT.2.1 + have : T2Space S := hS.2.1 + have : Nonempty T := ⟨p⟩ + have hii := hi.injective + have hns : ¬ IsSphere T := not_isSphere_cap hS habc hm hc + have hα₁ : ∀ C₁ ∈ cuffs S, C₁ ≠ C → ra + (G.V ∩ C₁).ncard < alpha G := fun C₁ h1 h2 => by + have := hα₂ C₁ h1 h2 + omega + obtain ⟨γ, hγ⟩ := hA.joinedIn _ hpA _ hy + have hrange : ∀ τ, γ τ ∈ A := hγ + -- the claim for a time up to which `γ` stays in `Σ + CHat` + have key : ∀ τ : unitInterval, (∀ τ', τ' ≤ τ → γ τ' ∈ range i) → ∃ t, γ τ = i t ∧ t ∉ bd T ∧ + (t ∈ E ∨ ∃ z X, t = j z ∧ IsScriptASet G (ra + n) C X ∧ z ∈ X ∧ j ⁻¹' discBd E ⊆ X) := fun τ hτ + => by + obtain ⟨t, ht⟩ := hτ τ le_rfl + refine ⟨t, ht.symm, ?_⟩ + by_cases htE : t ∈ E + · exact ⟨fun hb => disjoint_left.mp (hd.disjoint_bd hS habc hm hcyl hG hC hc hbT (r + := ra) hα₁) htE hb, .inl htE⟩ + let g : unitInterval → unitInterval := fun u => ⟨u.1 * τ.1, by + have := u.2.1 + have := u.2.2 + have := τ.2.1 + have := τ.2.2 + constructor <;> nlinarith⟩ + have hgc : Continuous g := by + refine Continuous.subtype_mk ?_ _ + fun_prop + have hgle : ∀ u, g u ≤ τ := fun u => by + change u.1 * τ.1 ≤ τ.1 + nlinarith [u.2.2, τ.2.1] + let δ : unitInterval → T := fun u => invFun i (γ (g u)) + have hδi : ∀ u, i (δ u) = γ (g u) := fun u => invFun_eq (hτ _ (hgle u)) + have hδc : Continuous δ := by + rw [hi.isEmbedding.continuous_iff] + have : (i ∘ δ) = γ ∘ g := funext hδi + rw [this] + exact γ.continuous.comp hgc + have hg0 : g 0 = 0 := Subtype.ext (by simp [g]) + have hg1 : g 1 = τ := Subtype.ext (by simp [g]) + have hδ0 : δ 0 = p := hii (by rw [hδi, hg0, γ.source]) + have hδ1 : δ 1 = t := hii (by rw [hδi, hg1, ht]) + obtain ⟨z, X, h1, h2, h3, h4⟩ := exists_reach_of_path hS hcyl hC hc hns hd hδc (hδ0 ▸ hpE) + (hδ1 ▸ htE) hX'V hX'c (fun w hw h5 h6 => hnorm w hw h5 (by + obtain ⟨u, hu⟩ := h6 + rw [← hu, hδi] + exact hrange _)) hα hα' + rw [hδ1] at h1 + refine ⟨fun hb => ?_, .inr ⟨z, X, h1, h2, h3, h4⟩⟩ + rw [hbT, h1] at hb + obtain ⟨w, hw, he⟩ := hb + have hwz : w = z := hc.isEmbedding.injective he + subst hwz + exact off_other_cuffs hS habc hm hcyl hG hC hα₂ (⟨X, ⟨h2.1, h2.2.1, h2.2.2.1, h2.2.2.2.1, + h2.2.2.2.2⟩, h3⟩) hw.1 hw.2 + let P : Set unitInterval := {τ | ∀ τ', τ' ≤ τ → γ τ' ∈ range i} + have hPd : ∀ {x y}, y ≤ x → x ∈ P → y ∈ P := fun {x y} h h1 τ' h2 => h1 τ' (h2.trans h) + have hPc : IsClosed P := by + rw [← closure_subset_iff_isClosed] + intro x hx τ' h1 + rcases h1.lt_or_eq with h2 | rfl + · obtain ⟨y, hy1, hy2⟩ := mem_closure_iff.mp hx _ isOpen_Ioi h2 + exact hy2 τ' (le_of_lt hy1) + · have h3 : γ τ' ∈ closure (γ '' P) := image_closure_subset_closure_image γ.continuous + (mem_image_of_mem γ hx) + exact closure_minimal (by + rintro _ ⟨y, hy, rfl⟩ + exact hy y le_rfl) hi.isClosed_range h3 + have hPo : IsOpen P := by + refine isOpen_iff_mem_nhds.mpr fun x hx => ?_ + have hO : IsOpen (γ ⁻¹' (i '' (bd T)ᶜ)) := hopen.preimage γ.continuous + have hxO : x ∈ γ ⁻¹' (i '' (bd T)ᶜ) := by + obtain ⟨t, h1, h2, -⟩ := key x hx + exact ⟨t, h2, h1.symm⟩ + obtain ⟨ε, hε, hb⟩ := Metric.isOpen_iff.mp hO x hxO + refine Filter.mem_of_superset (Metric.ball_mem_nhds x hε) fun y hy τ' h1 => ?_ + rcases le_total τ' x with h2 | h2 + · exact hx τ' h2 + · have h3 : τ' ∈ Metric.ball x ε := by + have h4 : (x : ℝ) ≤ τ' := h2 + have h5 : (τ' : ℝ) ≤ y := h1 + rw [Metric.mem_ball, Subtype.dist_eq, Real.dist_eq] at hy ⊢ + rw [abs_of_nonneg (by linarith)] + rw [abs_of_nonneg (by linarith)] at hy + linarith + obtain ⟨t, -, ht⟩ := hb h3 + exact ⟨t, ht⟩ + have h0P : (0 : unitInterval) ∈ P := fun τ' h1 => by + rw [le_antisymm h1 bot_le] + exact ⟨p, by + rw [show (0 : unitInterval) = ⊥ from rfl, ← show (0 : unitInterval) = ⊥ from rfl, γ.source]⟩ + have h1P : P = univ := IsClopen.eq_univ ⟨hPc, hPo⟩ ⟨0, h0P⟩ + obtain ⟨t, h1, h2⟩ := key 1 (show (1 : unitInterval) ∈ P from h1P ▸ mem_univ _) + exact ⟨t, by rw [← h1, γ.target], h2⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffSegments.lean b/LeanPool/GraphMinor/GM07/CuffSegments.lean new file mode 100644 index 0000000000..40ed39c947 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffSegments.lean @@ -0,0 +1,479 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffFrame + +/-! +# The subpaths `N_i(C)` + +Graph Minors VII, (5.9), page 235: "we may choose mutually vertex-disjoint subpaths $N_1(C), \dots, +N_{k(C)}(C)$ of $N(C)$, such that (i) $V(N_1(C)) \cup \dots \cup V(N_{k(C)}(C)) = V(N(C))$, and (ii) +for $1 \le i \le k(C)$, exactly $v$ of $P_1, \dots, P_{vk(C)}$ intersect $N(C)$ in a subpath of +$N_i(C)$". + +We first do the counting on a line. Each of the `P_i` meets the circuit in an interval of positions, +and we cut the positions into `k` groups by counting the intervals from the left. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +/-- **Groups of intervals.** Let `v * k` disjoint nonempty intervals of positions be given. Then the +positions can be cut into `k` groups, in order along the line, so that each group holds `v` of the +intervals. -/ +theorem exists_interval_groups {m k v : ℕ} (hk : 0 < k) (hv : 0 < v) (A : Fin (v * k) → Set ℕ) + (hne : ∀ ι, (A ι).Nonempty) (hlt : ∀ ι, ∀ x ∈ A ι, x < m) (hint : ∀ ι, (A ι).OrdConnected) + (hdis : ∀ ι ι', ι ≠ ι' → Disjoint (A ι) (A ι')) : + ∃ g : ℕ → ℕ, Monotone g ∧ (∀ x, g x < k) ∧ (∀ i < k, ∃ x < m, g x = i) ∧ ∀ i < k, ∃ f : Fin v + → Fin (v * k), Injective f ∧ ∀ t, ∀ x ∈ A (f t), g x = i := by + classical + have hNe : ∀ ι, sInf (A ι) ∈ A ι := fun ι => Nat.sInf_mem (hne ι) + let a : Fin (v * k) → ℕ := fun ι => sInf (A ι) + have ha : ∀ ι, a ι ∈ A ι := hNe + have hle : ∀ ι, ∀ x ∈ A ι, a ι ≤ x := fun ι x hx => Nat.sInf_le hx + have hainj : Injective a := fun ι ι' he => by + by_contra hne' + exact disjoint_left.mp (hdis ι ι' hne') (ha ι) (he ▸ ha ι') + let c : ℕ → ℕ := fun x => (Finset.univ.filter fun ι => a ι ≤ x).card + have hcm : Monotone c := fun x y hxy => Finset.card_le_card fun ι hι => by + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hι ⊢ + exact hι.trans hxy + have hclt : ∀ {x y}, (∃ ι, x < a ι ∧ a ι ≤ y) → c x < c y := fun {x y} ⟨ι, h1, h2⟩ => by + refine Finset.card_lt_card ⟨fun ι' hι => ?_, fun hs => ?_⟩ + · simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hι ⊢ + exact hι.trans (h1.le.trans h2) + · have := hs (Finset.mem_filter.mpr ⟨Finset.mem_univ _, h2⟩) + have := (Finset.mem_filter.mp this).2 + omega + have hcpos : ∀ ι, 0 < c (a ι) := fun ι => Finset.card_pos.mpr ⟨ι, Finset.mem_filter.mpr + ⟨Finset.mem_univ _, le_rfl⟩⟩ + have hcle : ∀ x, c x ≤ v * k := fun x => by + have := Finset.card_filter_le (Finset.univ : Finset (Fin (v * k))) fun ι => a ι ≤ x + simpa using this + have hconst : ∀ ι, ∀ x ∈ A ι, c x = c (a ι) := fun ι x hx => by + refine Finset.card_bij (fun ι' _ => ι') (fun ι' hι' => ?_) (fun _ _ _ _ h => h) (fun ι' hι' + => ⟨ι', ?_, rfl⟩) + · simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hι' ⊢ + by_contra hgt + push Not at hgt + have h1 : a ι' ∈ A ι := (hint ι).out (ha ι) hx ⟨hgt.le, hι'⟩ + by_cases he : ι = ι' + · subst he + omega + · exact disjoint_left.mp (hdis ι ι' he) h1 (ha ι') + · simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hι' ⊢ + exact hι'.trans (hle ι x hx) + let rank : Fin (v * k) → Fin (v * k) := fun ι => ⟨c (a ι) - 1, by + have := hcle (a ι) + have := hcpos ι + omega⟩ + have hrinj : Injective rank := fun ι ι' he => by + have h1 : c (a ι) - 1 = c (a ι') - 1 := congrArg Fin.val he + have h2 := hcpos ι + have h3 := hcpos ι' + by_contra hne' + have h4 : a ι ≠ a ι' := fun h => hne' (hainj h) + rcases lt_or_gt_of_ne h4 with h5 | h5 + · have := hclt (x := a ι) (y := a ι') ⟨ι', h5, le_rfl⟩ + omega + · have := hclt (x := a ι') (y := a ι) ⟨ι, h5, le_rfl⟩ + omega + have hrbij : Surjective rank := Finite.injective_iff_surjective.mp hrinj + let g : ℕ → ℕ := fun x => min ((c x - 1) / v) (k - 1) + refine ⟨g, fun x y hxy => ?_, fun x => by simp only [g]; omega, fun i hi => ?_, fun i hi => ?_⟩ + · refine min_le_min (Nat.div_le_div_right ?_) le_rfl + have := hcm hxy + omega + · have hb : v * i < v * k := Nat.mul_lt_mul_of_pos_left hi hv + obtain ⟨ι, hι⟩ := hrbij ⟨v * i, hb⟩ + have h1 : c (a ι) - 1 = v * i := congrArg Fin.val hι + refine ⟨a ι, hlt ι _ (ha ι), ?_⟩ + simp only [g] + rw [h1, Nat.mul_div_cancel_left _ hv] + omega + · have hb : ∀ t : Fin v, v * i + t.1 < v * k := fun t => by + have h1 : v * (i + 1) ≤ v * k := Nat.mul_le_mul_left _ hi + rw [Nat.mul_succ] at h1 + omega + let f : Fin v → Fin (v * k) := fun t => (Equiv.ofBijective rank ⟨hrinj, hrbij⟩).symm ⟨v * i + + t.1, hb t⟩ + have hf : ∀ t, c (a (f t)) - 1 = v * i + t.1 := fun t => by + have : rank (f t) = ⟨v * i + t.1, hb t⟩ := (Equiv.ofBijective rank ⟨hrinj, + hrbij⟩).apply_symm_apply _ + exact congrArg Fin.val this + refine ⟨f, fun t t' he => ?_, fun t x hx => ?_⟩ + · have h1 := hf t + have h2 := hf t' + rw [he] at h1 + exact Fin.ext (by omega) + · simp only [g] + rw [hconst _ x hx, hf t, Nat.mul_add_div hv, Nat.div_eq_of_lt t.2] + omega + +section Walks + +variable {α : Type*} {β : Type*} {K : Graph α β} + +/-- An edge of a closed walk splits the walk. -/ +theorem exists_split_at_edge {u v : α} (W : GraphWalk K u v) {e : β} (he : e ∈ W.edges) : ∃ + (a b : α) (A : GraphWalk K u a) (h : K.IsLink e a b) (B : GraphWalk K b v), W = A.append + (.cons h B) := by + induction W with + | nil _ => simp [GraphWalk.edges] at he + | @cons u' v' w e' hl r ih => + by_cases h1 : e = e' + · subst h1 + exact ⟨u', v', .nil hl.left_mem, hl, r, rfl⟩ + · have h2 : e ∈ r.edges := by + simpa [GraphWalk.edges, h1] using he + obtain ⟨a, b, A, h, B, rfl⟩ := ih h2 + exact ⟨a, b, .cons hl A, h, B, rfl⟩ + +/-- **Opening a circuit at an edge.** Removing an edge from a simple closed walk leaves a simple +walk through all vertices and the other edges. -/ +theorem exists_open_walk {u : α} (W : GraphWalk K u u) + (hs : W.IsSimpleClosed) {e : β} (he : e ∈ W.edges) : ∃ (a b : α) (L : GraphWalk K b a), + L.IsSimple ∧ (∀ x, x ∈ L.support ↔ x ∈ W.support) ∧ ∀ f, f ∈ W.edges → f ≠ e → f ∈ L.edges := by + classical + obtain ⟨a, b, A, h, B, rfl⟩ := exists_split_at_edge W he + refine ⟨a, b, B.append A, ?_, fun x => ?_, fun f hf hne => ?_⟩ + · have h1 := hs.1 + change (B.append A).support.Nodup + rw [GraphWalk.support_append] at h1 ⊢ + have h2 : A.support.tail ++ (GraphWalk.cons h B).support.tail = (A.support ++ + (GraphWalk.cons h B).support.tail).tail := by + cases A <;> simp [GraphWalk.support] + rw [← h2] at h1 + have h3 : (GraphWalk.cons h B).support.tail = B.support := rfl + rw [h3] at h1 + exact List.Perm.nodup_iff List.perm_append_comm |>.mp h1 + · simp only [GraphWalk.mem_support_append, GraphWalk.support, List.mem_cons] + constructor + · rintro (h1 | h1) + · exact .inr (.inr h1) + · exact .inl h1 + · rintro (h1 | rfl | h1) + · exact .inr h1 + · exact .inr A.end_mem_support + · exact .inl h1 + · rw [GraphWalk.edges_append, List.mem_append] at hf ⊢ + rcases hf with h1 | h1 + · exact .inr h1 + · simp only [GraphWalk.edges, List.mem_cons] at h1 + exact .inl (h1.resolve_left hne) + +theorem mem_support_of_mem_edges {u v : α} (W : GraphWalk K u v) {e : β} + (he : e ∈ W.edges) {c d : α} (hl : K.IsLink e c d) : c ∈ W.support ∧ d ∈ W.support := by + induction W with + | nil _ => simp [GraphWalk.edges] at he + | @cons u' v' w e' h r ih => + by_cases h1 : e = e' + · subst h1 + rcases hl.eq_and_eq_or_eq_and_eq h with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨List.mem_cons_self, List.mem_cons_of_mem _ r.start_mem_support⟩ + · exact ⟨List.mem_cons_of_mem _ r.start_mem_support, List.mem_cons_self⟩ + · have h2 : e ∈ r.edges := by + simpa [GraphWalk.edges, h1] using he + have h3 := ih h2 + exact ⟨List.mem_cons_of_mem _ h3.1, List.mem_cons_of_mem _ h3.2⟩ + +/-- Two vertices joined by an edge of a simple walk are next to each other on it. -/ +theorem idxOf_adjacent [DecidableEq α] {u v : α} (W : GraphWalk K u v) (hs : W.IsSimple) {e : β} + (he : e ∈ W.edges) {c d : α} (hl : K.IsLink e c d) : + W.support.idxOf d = W.support.idxOf c + 1 ∨ W.support.idxOf c = W.support.idxOf d + 1 := by + induction W with + | nil _ => simp [GraphWalk.edges] at he + | @cons u' v' w e' h r ih => + have hnd : u' ∉ r.support ∧ r.support.Nodup := by + have := hs + simpa [GraphWalk.IsSimple, GraphWalk.support] using this + have hsup : (GraphWalk.cons h r).support = u' :: r.support := rfl + rw [hsup] + have hv0 : r.support.idxOf v' = 0 := by + cases r <;> simp [GraphWalk.support] + have hvne : v' ≠ u' := fun h1 => hnd.1 (h1 ▸ r.start_mem_support) + by_cases h1 : e = e' + · subst h1 + rcases hl.eq_and_eq_or_eq_and_eq h with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · left + rw [List.idxOf_cons_self, List.idxOf_cons_ne _ hvne.symm, hv0] + · right + rw [List.idxOf_cons_self, List.idxOf_cons_ne _ hvne.symm, hv0] + · have h2 : e ∈ r.edges := by + simpa [GraphWalk.edges, h1] using he + obtain ⟨h3, h4⟩ := mem_support_of_mem_edges r h2 hl + have hc : c ≠ u' := fun h5 => hnd.1 (h5 ▸ h3) + have hd : d ≠ u' := fun h5 => hnd.1 (h5 ▸ h4) + rw [List.idxOf_cons_ne _ hc.symm, List.idxOf_cons_ne _ hd.symm] + have := ih hnd.2 h2 + omega + +/-- The positions on a simple walk of the vertices of a walk along its edges form an interval. -/ +theorem ordConnected_idxOf [DecidableEq α] {a b : α} (L : GraphWalk K a b) + (hs : L.IsSimple) {u v : α} (R : GraphWalk K u v) (hR : ∀ e ∈ R.edges, e ∈ L.edges) : + (((L.support.idxOf) '' {x | x ∈ R.support}) : Set ℕ).OrdConnected := by + induction R with + | @nil v₀ h => + have hset : {x | x ∈ (GraphWalk.nil h).support} = ({v₀} : Set α) := by + ext x + simp [GraphWalk.support] + rw [hset, image_singleton] + exact ordConnected_singleton + | @cons u' v' w e' h r ih => + have h1 := ih fun e he => hR e (List.mem_cons_of_mem _ he) + have h2 := idxOf_adjacent L hs (hR e' List.mem_cons_self) h + have hset : {x | x ∈ (GraphWalk.cons h r).support} = insert u' {x | x ∈ r.support} := by + ext x + simp [GraphWalk.support] + rw [hset, image_insert_eq] + have hv : L.support.idxOf v' ∈ (L.support.idxOf) '' {x | x ∈ r.support} + := mem_image_of_mem _ r.start_mem_support + refine ⟨fun x hx y hy z hz => ?_⟩ + set p := L.support.idxOf u' with hp + have hins : ∀ w, w ∈ insert p (L.support.idxOf '' {x | x ∈ r.support}) → w = p + ∨ w ∈ L.support.idxOf '' {x | x ∈ r.support} := fun w hw => hw + by_cases hzp : z = p + · exact hzp ▸ mem_insert _ _ + · refine mem_insert_of_mem _ ?_ + have hbet : ∀ {x' y'}, x' ∈ (L.support.idxOf '' {x | x ∈ r.support}) → y' ∈ + (L.support.idxOf '' {x | x ∈ r.support}) → x' ≤ z → z ≤ y' → z ∈ + (L.support.idxOf '' {x | x ∈ r.support}) := fun h3 h4 h5 h6 => h1.out h3 h4 ⟨h5, h6⟩ + rcases hins x hx with rfl | h3 <;> rcases hins y hy with rfl | h4 + · exact (hzp (le_antisymm hz.2 hz.1)).elim + · have h5 : L.support.idxOf v' ≤ z := by + have := hz.1 + omega + exact hbet hv h4 h5 hz.2 + · have h5 : z ≤ L.support.idxOf v' := by + have := hz.2 + omega + exact hbet h3 hv hz.1 h5 + · exact hbet h3 h4 hz.1 hz.2 + +/-- **A piece of a simple walk**, between two positions. -/ +theorem exists_walk_piece [DecidableEq α] {u v : α} (L : GraphWalk K u v) + (hs : L.IsSimple) {i j : ℕ} (hij : i ≤ j) (hj : j < L.support.length) : + ∃ (x y : α) (M : GraphWalk K x y), M.IsSimple ∧ L.support.idxOf x = i + ∧ ∀ z, z ∈ M.support ↔ z ∈ L.support ∧ i ≤ L.support.idxOf z ∧ L.support.idxOf z ≤ j := by + induction L generalizing i j with + | @nil u' h => + simp only [GraphWalk.support, List.length_singleton, Nat.lt_one_iff] at hj + have hi : i = 0 := by omega + subst hi hj + refine ⟨u', u', .nil h, hs, by simp [GraphWalk.support], fun z => ?_⟩ + simp only [GraphWalk.support, List.mem_singleton] + constructor + · rintro rfl + simp + · exact fun h1 => h1.1 + | @cons u' v' w e' h r ih => + have hnd : u' ∉ r.support ∧ r.support.Nodup := by + have := hs + simpa [GraphWalk.IsSimple, GraphWalk.support] using this + have hsup : (GraphWalk.cons h r).support = u' :: r.support := rfl + have hidx : ∀ z ∈ r.support, (u' :: r.support).idxOf z = r.support.idxOf z + 1 := fun z hz + => List.idxOf_cons_ne _ fun h1 => hnd.1 (h1 ▸ hz) + rw [hsup] at hj ⊢ + simp only [List.length_cons] at hj + rcases i with _ | i + · rcases j with _ | j + · refine ⟨u', u', .nil h.left_mem, by simp [GraphWalk.IsSimple, GraphWalk.support], + by simp, fun z => ?_⟩ + simp only [GraphWalk.support, List.mem_cons, List.not_mem_nil, or_false] + constructor + · rintro rfl + simp + · rintro ⟨rfl | h1, -, h3⟩ + · rfl + · rw [hidx z h1] at h3 + omega + · obtain ⟨x, y, M, h1, h2, h3⟩ := ih hnd.2 (Nat.zero_le j) (by omega) + have hxv : x = v' := by + have hxm : x ∈ M.support := M.start_mem_support + have hxr := ((h3 x).mp hxm).1 + cases r with + | nil _ => simpa [GraphWalk.support] using hxr + | cons _ _ => + simp only [GraphWalk.support, List.mem_cons] at hxr h2 ⊢ + rcases hxr with h4 | h4 + · exact h4 + · by_contra h5 + rw [List.idxOf_cons_ne _ (Ne.symm h5)] at h2 + omega + subst hxv + refine ⟨u', y, .cons h M, ?_, by simp, fun z => ?_⟩ + · change (u' :: M.support).Nodup + refine List.nodup_cons.mpr ⟨fun h4 => hnd.1 ((h3 _).mp h4).1, h1⟩ + · simp only [GraphWalk.support, List.mem_cons] + constructor + · rintro (rfl | h4) + · simp + · obtain ⟨h5, -, h6⟩ := (h3 z).mp h4 + refine ⟨.inr h5, Nat.zero_le _, ?_⟩ + rw [hidx z h5] + omega + · rintro ⟨rfl | h4, -, h5⟩ + · exact .inl rfl + · rw [hidx z h4] at h5 + exact .inr ((h3 z).mpr ⟨h4, Nat.zero_le _, by omega⟩) + · obtain ⟨x, y, M, h1, h2, h3⟩ := ih hnd.2 (Nat.le_of_succ_le_succ (by omega : i + 1 + ≤ j - 1 + 1)) (by omega) + have hxm : x ∈ r.support := ((h3 x).mp M.start_mem_support).1 + refine ⟨x, y, M, h1, by rw [hidx x hxm, h2], fun z => ?_⟩ + rw [h3 z] + simp only [List.mem_cons] + constructor + · rintro ⟨h4, h5, h6⟩ + rw [hidx z h4] + exact ⟨.inr h4, by omega, by omega⟩ + · rintro ⟨rfl | h4, h5, h6⟩ + · simp at h5 + · rw [hidx z h4] at h5 h6 + exact ⟨h4, by omega, by omega⟩ + +/-- An edge of a walk leaves a set that the walk leaves. -/ +theorem exists_leaving_edge {u v : α} (W : GraphWalk K u v) (X : Set α) {x y : α} + (hx : x ∈ W.support) (hy : y ∈ W.support) (hxX : x ∈ X) (hyX : y ∉ X) : ∃ e ∈ W.edges, ∃ c d, + K.IsLink e c d ∧ c ∈ X ∧ d ∉ X := by + induction W generalizing x y with + | nil _ => + simp only [GraphWalk.support, List.mem_singleton] at hx hy + exact absurd (hy ▸ hx ▸ hxX) hyX + | @cons u' v' w e' h r ih => + simp only [GraphWalk.support, List.mem_cons] at hx hy + have hup : ∀ {e}, e ∈ r.edges → e ∈ (GraphWalk.cons h r).edges := fun he + => List.mem_cons_of_mem _ he + have hhd : e' ∈ (GraphWalk.cons h r).edges := List.mem_cons_self + rcases hx with rfl | hx + · rcases hy with rfl | hy + · exact absurd hxX hyX + · by_cases hv : v' ∈ X + · obtain ⟨e, he, r'⟩ := ih r.start_mem_support hy hv hyX + exact ⟨e, hup he, r'⟩ + · exact ⟨e', hhd, x, v', h, hxX, hv⟩ + · rcases hy with rfl | hy + · by_cases hv : v' ∈ X + · exact ⟨e', hhd, v', y, h.symm, hv, hyX⟩ + · obtain ⟨e, he, r'⟩ := ih hx r.start_mem_support hxX hv + exact ⟨e, hup he, r'⟩ + · obtain ⟨e, he, r'⟩ := ih hx hy hxX hyX + exact ⟨e, hup he, r'⟩ + +end Walks + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +/-- **The subpaths `N_i(C)`.** Let `v * k` vertex-disjoint paths lie in a circuit `N`, with at least +two of them. Then `N` has `k` vertex-disjoint subpaths that cover its vertices, and each subpath +holds `v` of the paths. This is page 235, (i) and (ii). -/ +theorem exists_circuit_groups {N : Drawing S} (hN : N.IsCircuit) {k v : ℕ} (hk : 0 < k) + (hv : 0 < v) (hvk : 2 ≤ v * k) (Q : Fin (v * k) → Drawing S) (hQ : ∀ ι, (Q ι).IsSubdrawing N) + (hQp : ∀ ι, ∃ x y, (Q ι).IsPathBetween x y) (hdis : ∀ ι ι', ι ≠ ι' → Disjoint (Q ι).V + (Q ι').V) : + ∃ R : Fin k → Drawing S, (∀ i, (R i).IsSubdrawing N ∧ ∃ a b, (R i).IsPathBetween a b) ∧ + (∀ i i', i ≠ i' → Disjoint (R i).V (R i').V) ∧ (∀ x ∈ N.V, ∃ i, x ∈ (R i).V) + ∧ ∀ i, ∃ f : Fin v → Fin (v * k), Injective f ∧ ∀ t, (Q (f t)).V ⊆ (R i).V := by + classical + obtain ⟨u, W, hW, hlen, hV, hE⟩ := id hN + have hmem : ∀ ι, ∃ w, w ∈ (Q ι).V := fun ι => by + obtain ⟨x, y, W', -, h1, -⟩ := hQp ι + exact ⟨x, by rw [h1]; exact W'.start_mem_support⟩ + let ι₀ : Fin (v * k) := ⟨0, by omega⟩ + let ι₁ : Fin (v * k) := ⟨1, by omega⟩ + have h01 : ι₀ ≠ ι₁ := fun h => by simp [ι₀, ι₁, Fin.ext_iff] at h + obtain ⟨a₀, ha₀⟩ := hmem ι₀ + obtain ⟨a₁, ha₁⟩ := hmem ι₁ + have hsupp : ∀ {x ι}, x ∈ (Q ι).V → x ∈ W.support := fun {x ι} hx => by + have := (hQ ι).1 hx + rwa [hV] at this + obtain ⟨e, heW, c, d, hl, hc, hd⟩ := exists_leaving_edge W (Q ι₀).V (hsupp ha₀) (hsupp ha₁) ha₀ + (fun h => disjoint_left.mp (hdis ι₀ ι₁ h01) h ha₁) + -- `e` is in no path + have hoffe : ∀ ι, e ∉ (Q ι).E := fun ι he => by + have hcl : closure e ⊆ (Q ι).U := (Q ι).closure_subset_U he + have hmemc : c ∈ closure e ∧ d ∈ closure e := by + have h2 := hl.2.2.2 + exact ⟨(h2 ▸ mem_insert _ _ : c ∈ closure e ∩ N.V).1, (h2 ▸ mem_insert_of_mem _ rfl : d ∈ + closure e ∩ N.V).1⟩ + have hcV : c ∈ (Q ι).V := mem_V_of_subdrawing (hQ ι) (hcl hmemc.1) hl.2.1 + have hdV : d ∈ (Q ι).V := mem_V_of_subdrawing (hQ ι) (hcl hmemc.2) hl.2.2.1 + by_cases he' : ι = ι₀ + · exact hd (he' ▸ hdV) + · exact disjoint_left.mp (hdis ι ι₀ he') hcV hc + obtain ⟨a', b', L, hLs, hLsup, hLe⟩ := exists_open_walk W hW heW + let m := L.support.length + let A : Fin (v * k) → Set ℕ := fun ι => L.support.idxOf '' (Q ι).V + have hA : ∀ ι, ∀ x ∈ (Q ι).V, x ∈ L.support := fun ι x hx => (hLsup x).mpr (hsupp hx) + have hint : ∀ ι, (A ι).OrdConnected := fun ι => by + obtain ⟨x, y, W', -, h1, h1'⟩ := hQp ι + obtain ⟨X, hX₁, hX₂⟩ := (hQ ι).exists_walk_up W' + have h2 : A ι = L.support.idxOf '' {z | z ∈ X.support} := by + simp only [A] + rw [h1, hX₁] + rw [h2] + refine ordConnected_idxOf L hLs X fun f hf => ?_ + rw [hX₂] at hf + have hfQ : f ∈ (Q ι).E := h1' ▸ hf + have hfN : f ∈ N.E := (hQ ι).2 hfQ + rw [hE] at hfN + exact hLe f hfN fun h3 => hoffe ι (h3 ▸ hfQ) + have hAdis : ∀ ι ι', ι ≠ ι' → Disjoint (A ι) (A ι') := fun ι ι' hne => by + rw [disjoint_left] + rintro _ ⟨x, hx, rfl⟩ ⟨x', hx', he⟩ + have : x' = x := (List.idxOf_inj (hA ι' x' hx')).mp he + exact disjoint_left.mp (hdis ι ι' hne) hx (this ▸ hx') + obtain ⟨g, hgm, hgk, hgs, hgf⟩ := exists_interval_groups (m := m) hk hv A (fun ι => by + obtain ⟨w, hw⟩ := hmem ι + exact ⟨_, mem_image_of_mem _ hw⟩) (by + rintro ι _ ⟨x, hx, rfl⟩ + exact List.idxOf_lt_length_iff.mpr (hA ι x hx)) hint hAdis + have hex : ∀ i : Fin k, ∃ (x y : S) (M : GraphWalk N.toGraph x y), M.IsSimple + ∧ ∀ z, z ∈ M.support ↔ z ∈ L.support ∧ g (L.support.idxOf z) = i.1 := fun i => by + obtain ⟨x₀, hx₀, hx₀g⟩ := hgs i.1 i.2 + let F := (Finset.range m).filter fun p => g p = i.1 + have hF : F.Nonempty := ⟨x₀, Finset.mem_filter.mpr ⟨Finset.mem_range.mpr hx₀, hx₀g⟩⟩ + have h1 := Finset.mem_filter.mp (F.min'_mem hF) + have h2 := Finset.mem_filter.mp (F.max'_mem hF) + obtain ⟨x, y, M, h3, -, h4⟩ := exists_walk_piece L hLs (F.min'_le _ (F.max'_mem hF)) + (Finset.mem_range.mp h2.1) + refine ⟨x, y, M, h3, fun z => ?_⟩ + rw [h4] + constructor + · rintro ⟨h5, h6, h7⟩ + refine ⟨h5, le_antisymm ?_ ?_⟩ + · exact (hgm h7).trans_eq h2.2 + · exact h1.2.symm.le.trans (hgm h6) + · rintro ⟨h5, h6⟩ + have h7 : L.support.idxOf z ∈ F := Finset.mem_filter.mpr ⟨Finset.mem_range.mpr + (List.idxOf_lt_length_iff.mpr h5), h6⟩ + exact ⟨h5, F.min'_le _ h7, F.le_max' _ h7⟩ + choose x y M hMs hM using hex + have hRV : ∀ i, (walkDrawing N (M i)).V = {z | z ∈ (M i).support} := fun i => walkDrawing_V N + (M i) + refine ⟨fun i => walkDrawing N (M i), fun i => ⟨walkDrawing_isSubdrawing N (M i), x i, y i, + walkDrawing_isPathBetween N (hMs i)⟩, fun i i' hne => ?_, fun z hz => ?_, fun i => ?_⟩ + · rw [disjoint_left, hRV, hRV] + intro z h1 h2 + have h3 := ((hM i z).mp h1).2 + have h4 := ((hM i' z).mp h2).2 + exact hne (Fin.ext (h3.symm.trans h4)) + · have hz' : z ∈ L.support := (hLsup z).mpr (by rw [hV] at hz; exact hz) + refine ⟨⟨g (L.support.idxOf z), hgk _⟩, ?_⟩ + rw [hRV] + exact (hM _ z).mpr ⟨hz', rfl⟩ + · obtain ⟨f, hf, hfg⟩ := hgf i.1 i.2 + refine ⟨f, hf, fun t z hz => ?_⟩ + rw [hRV] + exact (hM i z).mpr ⟨hA _ z hz, hfg t _ (mem_image_of_mem _ hz)⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffShift.lean b/LeanPool/GraphMinor/GM07/CuffShift.lean new file mode 100644 index 0000000000..bf1353b0d9 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffShift.lean @@ -0,0 +1,330 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CollarPush +public import LeanPool.GraphMinor.GM07.CylinderCap +public import LeanPool.GraphMinor.GM07.GoodEdge + +/-! +# Moving a cuff to an `O`-arc + +The first half of the step of Graph Minors VII, (6.1), page 238. The paper cuts `Σ` along an `O`-arc +`A` around a cuff `C`, keeps the part `Σ'` outside `A`, and says "Loosely, we regard $\Sigma'$ as a +subset of $\Sigma$". We make this exact by a map `h : Σ → Σ` onto the part outside `A` that is +homotopic to the identity and fixes the other cuffs (`IsCuffShift`). The graph `G'` of the paper is +the +preimage of `G` under `h`. + +The paper does not say why `α(G') ≥ α(G)`. Since `h` is homotopic to the identity, the image of a +candidate of `G'` is a candidate of `G` with the same vertices (`alpha_le_of_shift`). Also `G'` +has some candidate, as any proper graph has (`exists_alphaCandidate`): two cuffs joined by a normal +line. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +local notation "𝕀" => unitInterval + +/-- The preimage of a drawing under a closed embedding whose range holds it. -/ +theorem exists_pull_drawing {S : Type*} {T : Type*} [TopologicalSpace S] [TopologicalSpace T] + [Nonempty S] {j : S → T} (hj : IsClosedEmbedding j) + (Γ : Drawing T) + (hU : Γ.U ⊆ range j) : ∃ G : Drawing S, G.U = j ⁻¹' Γ.U ∧ G.V = j ⁻¹' Γ.V ∧ IsMatched G Γ j ∅ + := by + classical + have hVr : Γ.V ⊆ range j := Γ.V_subset_U.trans hU + have himU : j '' (j ⁻¹' Γ.U) = Γ.U := image_preimage_eq_of_subset hU + have himV : j '' (j ⁻¹' Γ.V) = Γ.V := image_preimage_eq_of_subset hVr + have hset : j '' (j ⁻¹' Γ.U \ j ⁻¹' Γ.V) = Γ.U \ Γ.V := by + rw [image_sdiff hj.injective, himU, himV] + have harc : ∀ {F : Set S}, arcComponentsIn (j '' F) = image j '' arcComponentsIn F := fun {F} + => by + refine arcComponentsIn_image (g := invFun j) hj.continuous.continuousOn ?_ fun x _ + => leftInverse_invFun hj.injective x + rw [hj.isInducing.continuousOn_iff] + refine continuousOn_id.congr ?_ + rintro _ ⟨x, -, rfl⟩ + simp [leftInverse_invFun hj.injective x] + have hcl : ∀ e : Set S, closure (j '' e) = j '' closure e := fun e => + (image_closure_subset_closure_image hj.continuous).antisymm' (closure_minimal + (image_mono subset_closure) (hj.isClosedMap _ isClosed_closure)) + have hE : ∀ e ∈ arcComponentsIn (j ⁻¹' Γ.U \ j ⁻¹' Γ.V), j '' e ∈ Γ.E := fun e he => by + change j '' e ∈ arcComponentsIn (Γ.U \ Γ.V) + rw [← hset, harc] + exact mem_image_of_mem _ he + have hpre : ∀ e : Set S, j ⁻¹' (j '' e) = e := fun e => preimage_image_eq _ hj.injective + let G : Drawing S := + { U := j ⁻¹' Γ.U + V := j ⁻¹' Γ.V + V_subset_U := preimage_mono Γ.V_subset_U + isClosed_U := Γ.isClosed_U.preimage hj.continuous + finite_V := Γ.finite_V.preimage hj.injective.injOn + finite_edges := Set.Finite.of_finite_image (Γ.finite_edges.subset (by + rintro _ ⟨e, he, rfl⟩ + exact hE e he)) (image_injective.mpr hj.injective).injOn + edge_cond := by + intro e he + have hcap : closure (j '' e) ∩ Γ.V = j '' (closure e ∩ j ⁻¹' Γ.V) := by + rw [hcl, image_inter hj.injective, himV] + rcases Γ.edge_cond _ (hE e he) with ⟨u, v, h1, h2, h3⟩ | ⟨u, h2, h3⟩ + · have hu : u ∈ Γ.V := (h2.ge (mem_insert _ _)).2 + have hv : v ∈ Γ.V := (h2.ge (mem_insert_of_mem _ rfl)).2 + obtain ⟨u', rfl⟩ := hVr hu + obtain ⟨v', rfl⟩ := hVr hv + refine .inl ⟨u', v', fun h => h1 (by rw [h]), ?_, ?_⟩ + · apply image_injective.mpr hj.injective + rw [← hcap, h2, image_pair] + · rw [hcl] at h3 + have := pull_line hj.isEmbedding h3 (image_subset_range _ _) + rwa [hpre] at this + · have hu : u ∈ Γ.V := (h2.ge rfl).2 + obtain ⟨u', rfl⟩ := hVr hu + refine .inr ⟨u', ?_, ?_⟩ + · apply image_injective.mpr hj.injective + rw [← hcap, h2, image_singleton] + · rw [hcl] at h3 + have := pull_oArc hj.isEmbedding h3 (image_subset_range _ _) + rwa [hpre] at this } + refine ⟨G, rfl, rfl, hj.continuous, hj.injective.injOn, empty_subset _, + fun _ _ => disjoint_empty _, by simpa using himU, by simpa using himV, ?_⟩ + change Γ.E = image j '' arcComponentsIn (j ⁻¹' Γ.U \ j ⁻¹' Γ.V) + rw [← harc, hset] + rfl + +variable {S : Type u} [TopologicalSpace S] + +/-- A map of `S` into itself that is homotopic to the identity, and fixes the points of all cuffs +but `C` during the homotopy. -/ +structure IsCuffShift (C : Set S) (h : S → S) (Φ : 𝕀 × S → S) : Prop where + cont : Continuous h + contΦ : Continuous Φ + inj : Injective h + zero : ∀ x, Φ (0, x) = x + one : ∀ x, Φ (1, x) = h x + fix : ∀ x ∈ bd S, x ∉ C → h x = x ∧ ∀ t, Φ (t, x) = x + +variable {C : Set S} {h : S → S} {Φ : 𝕀 × S → S} {T : Type u} [TopologicalSpace T] + +theorem IsCuffShift.isClosedEmbedding [CompactSpace S] [T2Space S] (hs : IsCuffShift C h Φ) : + IsClosedEmbedding h := + hs.cont.isClosedEmbedding hs.inj + +/-- A solid set that is planar stays planar under the shift. -/ +theorem IsCuffShift.planar_image [CompactSpace S] [T2Space S] (hs : IsCuffShift C h Φ) + (hT : IsSurface T) [ConnectedSpace T] (hns : ¬ IsSphere T) {j : S → T} + (hj : IsEmbedding j) {X : Set S} (hX : IsSolid X) + (hp : IsPlanar (j '' X)) : IsPlanar (j '' (h '' X)) := by + obtain ⟨Δ, hΔ, hs'⟩ := hp + have h1 := isPlanar_of_homotopy (j := j ∘ h) (X := X) (H := fun q => j (Φ + (unitInterval.symm q.1, q.2))) hT (hj.comp hs.isClosedEmbedding.isEmbedding) hX (.inl hns) + (hj.continuous.comp (hs.contΦ.comp ((unitInterval.continuous_symm.comp continuous_fst).prodMk + continuous_snd))) (fun y => by simp [hs.one]) + fun F _ hFX => ⟨Δ, hΔ, fun y hy => by + have : Φ (unitInterval.symm 1, y) = y := by simp [hs.zero] + simp only [this] + exact hs' (mem_image_of_mem j (hFX hy))⟩ + rwa [image_comp] at h1 + +/-- A solid set is planar if its image under the shift is planar. -/ +theorem IsCuffShift.planar_of_image [CompactSpace S] [T2Space S] (hs : IsCuffShift C h Φ) + (hT : IsSurface T) [ConnectedSpace T] (hns : ¬ IsSphere T) {j : S → T} + (hj : IsEmbedding j) {X : Set S} (hX : IsSolid X) + (hp : IsPlanar (j '' (h '' X))) : IsPlanar (j '' X) := by + obtain ⟨Δ, hΔ, hs'⟩ := hp + refine isPlanar_of_homotopy (H := fun q => j (Φ q)) hT hj hX (.inl hns) + (hj.continuous.comp hs.contΦ) (fun y => by simp [hs.zero]) + fun F _ hFX => ⟨Δ, hΔ, fun y hy => ?_⟩ + simp only [hs.one] + exact hs' (mem_image_of_mem j (mem_image_of_mem h (hFX hy))) + +variable {a b c : ℕ} + +/-- Planarity in `Σ + CHat` is the same before and after the shift. -/ +theorem IsCuffShift.planarInCap_iff (hS : IsSurface S) [ConnectedSpace S] (hs : IsCuffShift C h Φ) + (habc : 3 ≤ 3 * a + 3 * b + c) (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) {C₁ X : Set S} + (hC₁ : IsCuff C₁) + (hX : IsSolid X) : IsPlanarInCappedCuff C₁ (h '' X) ↔ IsPlanarInCappedCuff C₁ X := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + obtain ⟨T₁, tT, j, D, hc, -⟩ := exists_cappedCuff hS hC₁ + have hT := hc.isSurface + have : ConnectedSpace T₁ := hc.connectedSpace hS + have hns := not_isSphere_cap hS habc hm hc + constructor + · rintro ⟨-, -, h2⟩ + exact isPlanarInCappedCuff_of_cap hS hc (hs.planar_of_image hT hns hc.isEmbedding hX + (h2 _ j D hc)) + · rintro ⟨-, -, h2⟩ + exact isPlanarInCappedCuff_of_cap hS hc (hs.planar_image hT hns hc.isEmbedding hX (h2 _ j D hc)) + +/-- Planarity in `Σ` is the same before and after the shift. -/ +theorem IsCuffShift.planar_iff (hS : IsSurface S) [ConnectedSpace S] (hs : IsCuffShift C h Φ) + (hns : ¬ IsSphere S) {X : Set S} (hX : IsSolid X) : IsPlanar (h '' X) ↔ IsPlanar X := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + constructor + · intro hp + simpa using hs.planar_of_image hS hns IsEmbedding.id hX (by simpa using hp) + · intro hp + simpa using hs.planar_image hS hns IsEmbedding.id hX (by simpa using hp) + +theorem IsCuffShift.nearPlanar_iff (hS : IsSurface S) [ConnectedSpace S] (hs : IsCuffShift C h Φ) + (habc : 3 ≤ 3 * a + 3 * b + c) (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) + (hns : ¬ IsSphere S) {X : Set S} + (hX : IsSolid X) : IsNearPlanar (h '' X) ↔ IsNearPlanar X := by + unfold IsNearPlanar + rw [hs.planar_iff hS hns hX] + refine or_congr Iff.rfl (exists_congr fun C₁ => and_congr_right fun hC₁ + => hs.planarInCap_iff hS habc hm hC₁ hX) + +theorem IsCuffShift.surrounds_iff (hS : IsSurface S) [ConnectedSpace S] (hs : IsCuffShift C h Φ) + (habc : 3 ≤ 3 * a + 3 * b + c) (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) + (hns : ¬ IsSphere S) {X C₁ : Set S} + (hC₁ : C₁ ∈ cuffs S) (hX : IsSolid X) : SurroundsCuff (h '' X) C₁ ↔ SurroundsCuff X C₁ := by + unfold SurroundsCuff + rw [hs.planar_iff hS hns hX, hs.planarInCap_iff hS habc hm hC₁ hX] + +/-- Every proper graph has a candidate for `α`, if there are two cuffs: the cuffs, joined by a +normal line. -/ +theorem exists_alphaCandidate (hS : IsSurface S) [ConnectedSpace S] (habc : 3 + ≤ 3 * a + 3 * b + c) (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) (hcyl : ¬ Nonempty + (S ≃ₜ SurfaceModel 0 0 2)) + {G : Drawing S} (hG : G.IsProper) {C₁ C₂ : Set S} (h₁ : C₁ ∈ cuffs S) (h₂ : C₂ ∈ cuffs S) + (hne : C₁ ≠ C₂) : ∃ X, IsAlphaCandidate G X := by + have : T2Space S := hS.2.1 + have hsub : ∀ {C : Set S}, C ∈ cuffs S → C ⊆ bd S := fun hC => + connectedComponentIn_subset_of_cuff hC + have hA₁ := isScriptASet_cuff hS habc hm hG h₁ le_rfl + have hA₂ := isScriptASet_cuff hS habc hm hG h₂ le_rfl + obtain ⟨x, hx⟩ := hA₁.2.1.1 + obtain ⟨y, hy⟩ := hA₂.2.1.1 + have hxy : x ≠ y := fun e => by + have := cuffs_disjoint h₁ h₂ hne + exact disjoint_left.mp this hx (e ▸ hy) + have hnorm : ∀ {C : Set S}, C ⊆ bd S → ∀ {z}, z ∈ C → z ∈ (G.U \ G.V)ᶜ := fun hC z hz hU => hU.2 + (hG ⟨hC hz, hU.1⟩) + obtain ⟨X₀, hX₀, hfin, -⟩ := distPoint_exists_arc hS hG hxy + obtain ⟨P, hP, hPn, -⟩ := exists_normal_arc_of_lineWithEnds hS hG (hnorm (hsub h₁) hx) (hnorm + (hsub h₂) hy) hX₀ hfin + have hsolP : IsSolid P := isSolid_of_isLineWithEnds hS hP + have hcP : IsPreconnected P := by + obtain ⟨f, -, -⟩ := id hP + have h3 := isPreconnected_range (continuous_subtype_val.comp f.continuous) + rwa [range_comp, f.surjective.range_eq, image_univ, Subtype.range_coe] at h3 + have hxP : x ∈ P := by + obtain ⟨f, h0, -⟩ := id hP + rw [← h0] + exact (f 0).2 + have hyP : y ∈ P := by + obtain ⟨f, -, h0⟩ := id hP + rw [← h0] + exact (f 1).2 + have hsol : IsSolid (C₁ ∪ P ∪ C₂) := theorem_11_6_proof hS (theorem_11_6_proof hS hA₁.1 hsolP) + hA₂.1 + have hconn : IsConnected (C₁ ∪ P ∪ C₂) := by + refine ⟨⟨x, .inl (.inl hx)⟩, ?_⟩ + have h1 : IsPreconnected (C₁ ∪ P) := hA₁.2.1.2.union x hx hxP hcP + exact h1.union y (.inr hyP) hy hA₂.2.1.2 + refine ⟨_, hsol, hconn, ?_, ?_⟩ + · rintro z ⟨(hz | hz) | hz, hU⟩ + · exact hG ⟨hsub h₁ hz, hU⟩ + · exact hPn ⟨hz, hU⟩ + · exact hG ⟨hsub h₂ hz, hU⟩ + · rintro (hp | ⟨C₀, hC₀, hp⟩) + · exact hA₁.2.2.2.1.2.2 (IsPlanar.mono hp (fun z hz => .inl (.inl hz))) + · by_cases he : C₀ = C₁ + · have hne' : C₂ ≠ C₀ := by rw [he]; exact hne.symm + exact hcyl (surroundsCuff_and_planarInCappedCuff_imp_cylinder hS h₂ hC₀ hne' + ((cuff_statement.{u} S hS).2.2 C₂ h₂) hA₂.2.2.2.1 (hp.mono fun z hz => .inr hz)) + · exact hcyl (surroundsCuff_and_planarInCappedCuff_imp_cylinder hS h₁ hC₀ (Ne.symm he) + ((cuff_statement.{u} S hS).2.2 C₁ h₁) hA₁.2.2.2.1 (hp.mono fun z hz => .inl (.inl hz))) + +section Graph + +variable {G G' : Drawing S} + +theorem image_inter_pull (hV : G'.V = h ⁻¹' G.V) (X : Set S) : G.V ∩ h '' X = h '' (G'.V ∩ X) := by + rw [hV, inter_comm, inter_comm _ X] + exact (image_inter_preimage h X G.V).symm + +/-- The image of a candidate of `G'` is a candidate of `G` with as many vertices. -/ +theorem alpha_le_of_shift (hS : IsSurface S) [ConnectedSpace S] + (hs : IsCuffShift C h Φ) (habc : 3 ≤ 3 * a + 3 * b + c) (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) + (hns : ¬ IsSphere S) + (hU : G'.U = h ⁻¹' G.U) (hV : G'.V = h ⁻¹' G.V) (hex : ∃ X, IsAlphaCandidate G' X) : alpha G + ≤ alpha G' := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + obtain ⟨X₀, hX₀⟩ := hex + refine le_csInf ⟨_, X₀, hX₀, rfl⟩ ?_ + rintro _ ⟨X, ⟨h1, h2, h3, h4⟩, rfl⟩ + have hc : IsAlphaCandidate G (h '' X) := by + refine ⟨isSolid_image_of_isClosedEmbedding hs.isClosedEmbedding h1, h2.image _ + hs.cont.continuousOn, ?_, fun hn => h4 ((hs.nearPlanar_iff hS habc hm hns h1).mp hn)⟩ + rintro _ ⟨⟨y, hy, rfl⟩, hyU⟩ + have : y ∈ G'.V := h3 ⟨hy, by rw [hU]; exact hyU⟩ + rw [hV] at this + exact this + refine (alpha_le_of_candidate hc).trans (le_of_eq ?_) + rw [inter_comm, image_inter_pull hV, ncard_image_of_injective _ hs.inj, inter_comm] + +/-- The preimage of `G` is boundary-linked, if `G` is, and no `O`-arc in the range of `h` around `C` +has fewer vertices than the new cuff. -/ +theorem boundaryLinked_of_shift (hS : IsSurface S) [ConnectedSpace S] + (hs : IsCuffShift C h Φ) (habc : 3 ≤ 3 * a + 3 * b + c) (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) + (hns : ¬ IsSphere S) + (hU : G'.U = h ⁻¹' G.U) (hV : G'.V = h ⁻¹' G.V) (hp : G'.IsProper) (hbl : IsBoundaryLinked G) + (hCc : C ∈ cuffs S) (hmax : ∀ F, G.IsNormal F → IsOArc F → SurroundsCuff F C → F ⊆ range h → + (G'.V ∩ C).ncard ≤ (G.V ∩ F).ncard) : IsBoundaryLinked G' := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + refine ⟨hp, fun C₁ hC₁ F hFn hFO hFs => ?_⟩ + have hsol : IsSolid F := isSolid_of_isOArc hS hFO + have hnorm : G.IsNormal (h '' F) := by + rintro _ ⟨⟨y, hy, rfl⟩, hyU⟩ + have : y ∈ G'.V := hFn ⟨hy, by rw [hU]; exact hyU⟩ + rw [hV] at this + exact this + have hO : IsOArc (h '' F) := by + obtain ⟨f⟩ := id hFO + exact ⟨f.trans (hs.isClosedEmbedding.isEmbedding.homeomorphImage F)⟩ + have hs' : SurroundsCuff (h '' F) C₁ := (hs.surrounds_iff hS habc hm hns hC₁ hsol).mpr hFs + have hc : (G.V ∩ h '' F).ncard = (G'.V ∩ F).ncard := by + rw [image_inter_pull hV, ncard_image_of_injective _ hs.inj] + rw [← hc] + by_cases he : C₁ = C + · subst he + exact hmax _ hnorm hO hs' (image_subset_range _ _) + · have h1 := hbl.2 C₁ hC₁ _ hnorm hO hs' + refine le_trans (le_of_eq ?_) h1 + congr 1 + ext x + constructor + · rintro ⟨hx, hxC⟩ + have hb : x ∈ bd S := connectedComponentIn_subset_of_cuff hC₁ hxC + have hnC : x ∉ C := fun hxC' => disjoint_left.mp (cuffs_disjoint hC₁ hCc he) hxC hxC' + rw [hV, mem_preimage, (hs.fix x hb hnC).1] at hx + exact ⟨hx, hxC⟩ + · rintro ⟨hx, hxC⟩ + have hb : x ∈ bd S := connectedComponentIn_subset_of_cuff hC₁ hxC + have hnC : x ∉ C := fun hxC' => disjoint_left.mp (cuffs_disjoint hC₁ hCc he) hxC hxC' + refine ⟨?_, hxC⟩ + rw [hV, mem_preimage, (hs.fix x hb hnC).1] + exact hx + +end Graph + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffSlide.lean b/LeanPool/GraphMinor/GM07/CuffSlide.lean new file mode 100644 index 0000000000..93f1149cfd --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffSlide.lean @@ -0,0 +1,797 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.MatchDiscs + +/-! +# Moving points along the cuffs + +The matching from `exists_matching_of_discs` has its ends close to the points of `Y`, at places that +depend on the forest. The +statement of Graph Minors VII, (3.4) (page 220), asks for a set `X` fixed in advance. So we slide +the ends along the cuffs to the +points of `X`, by a homeomorphism of `Σ` that fixes the forest. We get the slide in the closed +surface with the cuffs capped, in a +thin rectangle around a piece of a cuff (`exists_bd_slide`). This slide keeps the two sides of the +cuff apart, so it restricts to `Σ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Complex GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] + +/-- An injective arc on an interval has a strip chart in the surface obtained by capping. -/ +theorem exists_capped_strip_chart (hS : IsSurface S) {g : ℝ → S} {a b : ℝ} + (hg : Continuous g) (hab : a < b) (hi : InjOn g (Icc a b)) : + ∃ (T : Type) (_ : TopologicalSpace T) (j : S → T) (O : Set ℂ) (K : ℂ → T) + (θ : unitInterval → ℝ), + IsClosedSurface T ∧ IsClosedEmbedding j ∧ frontier (range j) = j '' bd S ∧ + let par : unitInterval → ℝ := fun u => a + u.1 * (b - a) + (∀ u, par u ∈ Icc a b) ∧ StrictMono par ∧ (∀ r ∈ Icc a b, ∃ u, par u = r) ∧ + StripChart O K ∧ Continuous θ ∧ StrictMono θ ∧ + ∀ u, (θ u : ℂ) ∈ O ∧ K (θ u) = j (g (par u)) := by + have ht2S : T2Space S := hS.2.1 + have hcS : CompactSpace S := hS.1 + obtain ⟨T, tT, j, K', hT, hj, hK', hu, hi', -⟩ := exists_capAll S hS + have ht2 : T2Space T := hT.2.1 + have hcT : CompactSpace T := hT.1 + have hab' : 0 < b - a := sub_pos.mpr hab + let par : unitInterval → ℝ := fun u => a + u.1 * (b - a) + have hpar : ∀ u, par u ∈ Icc a b := fun u => by + have h0 := u.2.1 + have h1 := u.2.2 + exact ⟨by simp only [par]; nlinarith, by simp only [par]; nlinarith⟩ + have hparc : Continuous par := by simp only [par]; fun_prop + have hparm : StrictMono par := fun s t h => by + have h' : s.1 < t.1 := h + simp only [par] + nlinarith + have hpars : ∀ r ∈ Icc a b, ∃ u, par u = r := fun r hr => by + refine ⟨⟨(r - a) / (b - a), div_nonneg (by linarith [hr.1]) hab'.le, + (div_le_one hab').mpr (by linarith [hr.2])⟩, ?_⟩ + simp only [par] + field_simp + ring + let A : unitInterval → T := fun u => j (g (par u)) + have hA : IsArcMap A := ⟨hj.continuous.comp (hg.comp hparc), fun s t h => hparm.injective (hi + (hpar s) (hpar t) (hj.injective h))⟩ + obtain ⟨O, K, θ, hK, hθc, hθm, hθ⟩ := exists_stripChart_of_arc hT hA + exact ⟨T, tT, j, O, K, θ, hT, hj, cap_frontier hT hj hK' hu hi', + hpar, hparm, hpars, hK, hθc, hθm, hθ⟩ + +/-- **A slide along a piece of `bd(Σ)`.** If `g` is an arc in `bd(Σ)` that misses the closed set +`Z`, there is a homeomorphism of `Σ` +that fixes `Z` and moves `g m` to `g x`. -/ +theorem exists_bd_slide (hS : IsSurface S) {g : ℝ → S} {a x m b : ℝ} (hg : Continuous g) + (hax : a < x) (hxm : x < m) (hmb : m < b) + (hi : InjOn g (Icc a b)) (_hbd : ∀ u ∈ Icc a b, g u ∈ bd S) (hrest : IsClosed + (bd S \ g '' Ioo a b)) {Z : Set S} (hZ : IsClosed Z) + (hZg : ∀ u ∈ Icc a b, g u ∉ Z) : ∃ α : S ≃ₜ S, (∀ z ∈ Z, α z = z) ∧ α (g m) = g x := by + have ht2S : T2Space S := hS.2.1 + have hcS : CompactSpace S := hS.1 + have hab : a < b := by linarith + obtain ⟨T, tT, j, O, K, θ, hT, hj, hfr, hpar, hparm, hpars, hK, hθc, hθm, hθ⟩ := + exists_capped_strip_chart hS hg hab hi + have ht2 : T2Space T := hT.2.1 + have hcT : CompactSpace T := hT.1 + let par : unitInterval → ℝ := fun u => a + u.1 * (b - a) + let A : unitInterval → T := fun u => j (g (par u)) + change StrictMono par at hparm + change ∀ r ∈ Icc a b, ∃ u, par u = r at hpars + change ∀ u, (θ u : ℂ) ∈ O ∧ K (θ u) = A u at hθ + -- The points in the chart. + obtain ⟨ux, hux⟩ := hpars x ⟨hax.le, by linarith⟩ + obtain ⟨um, hum⟩ := hpars m ⟨by linarith, hmb.le⟩ + have hux0 : (0 : unitInterval) < ux := hparm.lt_iff_lt.mp (by rw [hux]; simpa [par] using hax) + have hum1 : um < 1 := hparm.lt_iff_lt.mp (by rw [hum]; simpa [par] using hmb) + have huxm : ux < um := hparm.lt_iff_lt.mp (by rw [hux, hum]; exact hxm) + set x' := θ ux with hx' + set m' := θ um with hm' + set a' := (θ 0 + x') / 2 with ha' + set b' := (θ 1 + m') / 2 with hb' + have h0x : θ 0 < x' := hθm hux0 + have hxm' : x' < m' := hθm huxm + have hm1 : m' < θ 1 := hθm hum1 + have ha1 : θ 0 < a' := by linarith + have ha2 : a' < x' := by linarith + have hb1 : m' < b' := by linarith + have hb2 : b' < θ 1 := by linarith + have hreal : ∀ r ∈ Icc a' b', ∃ u : unitInterval, u ≠ 0 ∧ u ≠ 1 ∧ θ u = r := fun r hr => by + obtain ⟨u, hu'⟩ := intermediate_value_univ (0 : unitInterval) 1 hθc (show r ∈ Icc (θ 0) + (θ 1) from ⟨by linarith [hr.1], by linarith [hr.2]⟩) + refine ⟨u, ?_, ?_, hu'⟩ + · rintro rfl + linarith [hr.1, hu'.symm] + · rintro rfl + linarith [hr.2, hu'.symm] + -- The closed set the rectangle must miss. + let Z₂ : Set T := j '' Z ∪ j '' (bd S \ g '' Ioo a b) + have hZ₂ : IsClosed Z₂ := (hj.isClosedMap _ hZ).union (hj.isClosedMap _ hrest) + have hparIoo : ∀ u : unitInterval, u ≠ 0 → u ≠ 1 → par u ∈ Ioo a b := fun u h0 h1 => by + have h2 : 0 < u.1 := unitInterval.pos_iff_ne_zero.mpr h0 + have h3 : u.1 < 1 := unitInterval.lt_one_iff_ne_one.mpr h1 + exact ⟨by simp only [par]; nlinarith, by simp only [par]; nlinarith⟩ + have hAZ : ∀ u : unitInterval, u ≠ 0 → u ≠ 1 → A u ∉ Z₂ := fun u h0 h1 => by + rintro (⟨z, hz, e⟩ | ⟨z, hz, e⟩) + · rw [hj.injective e] at hz + exact hZg _ (hpar u) hz + · rw [hj.injective e] at hz + exact hz.2 ⟨_, hparIoo u h0 h1, rfl⟩ + let Ω : Set ℂ := O ∩ K ⁻¹' Z₂ᶜ + have hΩ : IsOpen Ω := hK.hc.isOpen_inter_preimage hK.isOpen hZ₂.isOpen_compl + have hcpt : IsCompact (((↑) : ℝ → ℂ) '' Icc a' b') := isCompact_Icc.image continuous_ofReal + have hsubΩ : ((↑) : ℝ → ℂ) '' Icc a' b' ⊆ Ω := by + rintro _ ⟨r, hr, rfl⟩ + obtain ⟨u, h0, h1, rfl⟩ := hreal r hr + refine ⟨(hθ u).1, ?_⟩ + simp only [mem_preimage, mem_compl_iff] + rw [(hθ u).2] + exact hAZ u h0 h1 + obtain ⟨δ₀, hδ₀, hth⟩ := hcpt.exists_thickening_subset_open hΩ hsubΩ + let δ := δ₀ / 2 + have hδ : 0 < δ := by simp only [δ]; linarith + let R : Set ℂ := Icc a' b' ×ℂ Icc (-δ) δ + have hRΩ : R ⊆ Ω := fun z hz => by + refine hth (mem_thickening_iff.mpr ⟨(z.re : ℂ), ⟨z.re, hz.1, rfl⟩, ?_⟩) + have h1 : z - (z.re : ℂ) = (z.im : ℂ) * I := by + apply Complex.ext <;> simp + rw [dist_eq_norm, h1, norm_mul, Complex.norm_I, mul_one, Complex.norm_real, Real.norm_eq_abs] + have := abs_le.mpr hz.2 + simp only [δ] at this + linarith + have hRO : R ⊆ O := fun z hz => (hRΩ hz).1 + obtain ⟨ψ, hψc, hψm, hψa, hψb, hψx, hψl⟩ := exists_slide_fun ha2 hxm' hb1 + obtain ⟨e, he1, he2, he3⟩ := exists_slide hK (a := a') (b := b') (ε := δ) + (by linarith) hδ hRO hψc hψm hψa hψb hψl + -- The two sides of the rectangle. + have hbdaxis : ∀ w ∈ R, K w ∈ j '' bd S → w.im = 0 := fun w hw h => by + obtain ⟨z, hz, e'⟩ := h + have h2 : z ∈ g '' Ioo a b := by + by_contra hn + exact (hRΩ hw).2 (.inr ⟨z, ⟨hz, hn⟩, e'⟩) + obtain ⟨r, hr, rfl⟩ := h2 + obtain ⟨u, hu'⟩ := hpars r ⟨hr.1.le, hr.2.le⟩ + have h3 : K w = K (θ u) := by + rw [(hθ u).2, ← e'] + simp only [A, hu'] + have h4 := hK.hi (hRO hw) (hθ u).1 h3 + rw [h4] + simp + have hside : ∀ {P : ℝ → Prop}, Convex ℝ {w : ℂ | w ∈ R ∧ P w.im} → (∀ r, P r → r ≠ 0) + → ∀ w ∈ R, ∀ w' ∈ R, P w.im → P w'.im → + K w ∈ range j → K w' ∈ range j := fun {P} hconv hP w hw w' hw' h1 h2 h3 => by + by_contra hn + have hset : IsPreconnected (K '' {w : ℂ | w ∈ R ∧ P w.im}) := + hconv.isPreconnected.image K (hK.hc.mono fun z hz => hRO hz.1) + have hcov : K '' {w : ℂ | w ∈ R ∧ P w.im} ⊆ range j ∪ closure (range j)ᶜ := fun z _ => by + by_cases hzr : z ∈ range j + · exact .inl hzr + · exact .inr (subset_closure hzr) + obtain ⟨z, ⟨w₀, hw₀, rfl⟩, hz⟩ := isPreconnected_closed_iff.mp hset _ _ hj.isClosed_range + isClosed_closure hcov + ⟨K w, ⟨w, ⟨hw, h1⟩, rfl⟩, h3⟩ ⟨K w', ⟨w', ⟨hw', h2⟩, rfl⟩, subset_closure hn⟩ + have hz' : K w₀ ∈ frontier (range j) := by + rw [frontier_eq_closure_inter_closure, hj.isClosed_range.closure_eq] + exact hz + rw [hfr] at hz' + exact hP _ hw₀.2 (hbdaxis w₀ hw₀.1 hz') + have hRconv : Convex ℝ R := ((convex_Icc a' b').linear_preimage Complex.reLm).inter ((convex_Icc + (-δ) δ).linear_preimage Complex.imLm) + have hup : Convex ℝ {w : ℂ | w ∈ R ∧ 0 < w.im} := hRconv.inter (convex_halfSpace_im_gt 0) + have hlo : Convex ℝ {w : ℂ | w ∈ R ∧ w.im < 0} := hRconv.inter (convex_halfSpace_im_lt 0) + have hsameR : ∀ w ∈ R, ∀ w' ∈ R, w.im = w'.im → (K w ∈ range j → K w' ∈ range j) + := fun w hw w' hw' him h => by + rcases lt_trichotomy w.im 0 with h0 | h0 | h0 + · exact hside (P := fun r => r < 0) hlo (fun r hr => hr.ne) w hw w' hw' h0 (him ▸ h0) h + · have : w'.im = 0 := him ▸ h0 + have h2 : w' = (w'.re : ℂ) := by + apply Complex.ext <;> simp [this] + obtain ⟨u, -, -, hu'⟩ := hreal _ hw'.1 + rw [h2, ← hu', (hθ u).2] + exact ⟨_, rfl⟩ + · exact hside (P := fun r => 0 < r) hup (fun r hr => hr.ne') w hw w' hw' h0 (him ▸ h0) h + have hinv : ∀ z, z ∈ range j ↔ e z ∈ range j := fun z => by + by_cases hz : z ∈ K '' R + · obtain ⟨w, hw, rfl⟩ := hz + obtain ⟨w', hw', -, him, he⟩ := he3 w hw + rw [he] + exact ⟨hsameR w hw w' hw' him.symm, hsameR w' hw' w hw him⟩ + · rw [he1 z hz] + let hjh := hj.isEmbedding.toHomeomorph + let α : S ≃ₜ S := hjh.trans ((e.subtype hinv).trans hjh.symm) + have hα : ∀ s, j (α s) = e (j s) := fun s => by + have h1 : hjh (α s) = (e.subtype hinv) (hjh s) := by + simp only [α, Homeomorph.trans_apply, Homeomorph.apply_symm_apply] + exact congrArg Subtype.val h1 + refine ⟨α, fun z hz => hj.injective ?_, hj.injective ?_⟩ + · rw [hα, he1] + rintro ⟨w, hw, h⟩ + exact (hRΩ hw).2 (.inl ⟨z, hz, h.symm⟩) + · rw [hα] + have h1 : j (g m) = K m' := by + rw [hm', (hθ um).2] + simp only [A, hum] + have h2 : j (g x) = K x' := by + rw [hx', (hθ ux).2] + simp only [A, hux] + rw [h1, h2, he2 m' ⟨by linarith, by linarith⟩, hψx] + +/-- **Many slides at once.** If the arcs `g i` are disjoint and miss the closed set `Z`, then one +homeomorphism of `Σ` fixes `Z` and moves +`g i (m i)` to `g i (x i)` for all `i`. -/ +theorem exists_bd_slides (hS : IsSurface S) {ι : Type*} [Finite ι] {g : ι → ℝ → S} {a x m b : ι + → ℝ} (hg : ∀ i, Continuous (g i)) + (hax : ∀ i, a i < x i) (hxm : ∀ i, x i < m i) (hmb : ∀ i, m i < b i) (hi : ∀ i, InjOn (g i) + (Icc (a i) (b i))) + (hbd : ∀ i, ∀ u ∈ Icc (a i) (b i), g i u ∈ bd S) (hrest : ∀ i, IsClosed (bd S \ g i '' Ioo + (a i) (b i))) {Z : Set S} (hZ : IsClosed Z) + (hZg : ∀ i, ∀ u ∈ Icc (a i) (b i), g i u ∉ Z) + (hdis : ∀ i j, i ≠ j → Disjoint (g i '' Icc (a i) (b i)) (g j '' Icc (a j) (b j))) : + ∃ α : S ≃ₜ S, (∀ z ∈ Z, α z = z) ∧ ∀ i, α (g i (m i)) = g i (x i) := by + classical + have ht2S : T2Space S := hS.2.1 + have : Fintype ι := Fintype.ofFinite ι + have hArc : ∀ i, IsClosed (g i '' Icc (a i) (b i)) := fun i => (isCompact_Icc.image + (hg i)).isClosed + have key : ∀ J : Finset ι, ∃ α : S ≃ₜ S, (∀ z ∈ Z, α z = z) ∧ (∀ i ∈ J, α (g i (m i)) = g i + (x i)) ∧ + ∀ i, i ∉ J → ∀ u ∈ Icc (a i) (b i), α (g i u) = g i u := by + intro J + induction J using Finset.induction_on with + | empty => + exact ⟨Homeomorph.refl S, fun _ _ => rfl, by simp, fun _ _ _ _ => rfl⟩ + | insert i₀ J hi₀ ih => + obtain ⟨α, h1, h2, h3⟩ := ih + let Z' : Set S := Z ∪ ⋃ i ∈ {i | i ≠ i₀}, g i '' Icc (a i) (b i) + have hZ' : IsClosed Z' := hZ.union ((toFinite _).isClosed_biUnion fun i _ => hArc i) + have hZ'g : ∀ u ∈ Icc (a i₀) (b i₀), g i₀ u ∉ Z' := fun u hu => by + rintro (h | h) + · exact hZg i₀ u hu h + · obtain ⟨i, hi', h4⟩ := mem_iUnion₂.mp h + exact disjoint_left.mp (hdis i i₀ hi') h4 ⟨u, hu, rfl⟩ + obtain ⟨β, h4, h5⟩ := exists_bd_slide hS (hg i₀) (hax i₀) (hxm i₀) (hmb i₀) (hi i₀) (hbd i₀) + (hrest i₀) hZ' hZ'g + have hxI : ∀ i, x i ∈ Icc (a i) (b i) := fun i => ⟨(hax i).le, by linarith [hxm i, hmb i]⟩ + have hmI : ∀ i, m i ∈ Icc (a i) (b i) := fun i => ⟨by linarith [hax i, hxm i], (hmb i).le⟩ + refine ⟨α.trans β, fun z hz => ?_, fun i hi' => ?_, fun i hi' u hu => ?_⟩ + · rw [Homeomorph.trans_apply, h1 z hz, h4 z (.inl hz)] + · rw [Homeomorph.trans_apply] + rcases Finset.mem_insert.mp hi' with rfl | h6 + · rw [h3 _ hi₀ _ (hmI _), h5] + · have hne : i ≠ i₀ := fun e => hi₀ (e ▸ h6) + rw [h2 i h6] + exact h4 _ (.inr (mem_iUnion₂.mpr ⟨i, hne, _, hxI i, rfl⟩)) + · have hne : i ≠ i₀ := fun e => hi' (e ▸ Finset.mem_insert_self _ _) + have hJ : i ∉ J := fun e => hi' (Finset.mem_insert_of_mem e) + rw [Homeomorph.trans_apply, h3 i hJ u hu] + exact h4 _ (.inr (mem_iUnion₂.mpr ⟨i, hne, _, hu, rfl⟩)) + obtain ⟨α, h1, h2, -⟩ := key Finset.univ + exact ⟨α, h1, fun i => h2 i (Finset.mem_univ i)⟩ + +/-- Each point of `bd(Σ)` has a parameter of its cuff, with the point at a place `q` of our choice +on the circle. -/ +theorem exists_cuffParam (hS : IsSurface S) {y : S} (hy : y ∈ bd S) (q : Circle) : ∃ f : ℝ + → S, Continuous f ∧ (∀ t, Circle.exp t = q → f t = y) ∧ + InjOn f (Ioc (-Real.pi) Real.pi) ∧ f (-Real.pi) = f Real.pi ∧ (∀ t ∈ Icc + (-Real.pi) Real.pi, f t ∈ bd S) ∧ + IsClosed (bd S \ f '' Icc (-Real.pi) Real.pi) := by + classical + have ht2 : T2Space S := hS.2.1 + obtain ⟨hcl, hfin, harc⟩ := cuff_statement.{0} S hS + let C : Set S := connectedComponentIn (bd S) y + have hC : C ∈ cuffs S := ⟨y, hy, rfl⟩ + obtain ⟨φ⟩ := harc C hC + have hyC : y ∈ C := mem_connectedComponentIn hy + let p : Circle := φ.symm ⟨y, hyC⟩ * q⁻¹ + let f : ℝ → S := fun t => (φ (p * Circle.exp t)).1 + have hfc : Continuous f := continuous_subtype_val.comp (φ.continuous.comp + (continuous_const.mul Circle.exp.continuous)) + have hCb : C ⊆ bd S := connectedComponentIn_subset _ _ + have hinj : InjOn f (Ioc (-Real.pi) Real.pi) := fun s hs t ht h => by + have h1 := φ.injective (Subtype.ext h) + have h2 : Circle.exp s = Circle.exp t := mul_left_cancel h1 + exact Circle.invOn_arg_exp.1.injOn hs ht h2 + have hper : f (-Real.pi) = f Real.pi := by + have h1 : Circle.exp (-Real.pi) = Circle.exp Real.pi := by + have h2 := Circle.periodic_exp (-Real.pi) + rw [show -Real.pi + 2 * Real.pi = Real.pi by ring] at h2 + exact h2.symm + simp only [f, h1] + have himg : f '' Icc (-Real.pi) Real.pi = C := by + ext x + constructor + · rintro ⟨t, -, rfl⟩ + exact (φ _).2 + · intro hx + obtain ⟨t, ht, h⟩ := Circle.surjOn_exp_neg_pi_pi (mem_univ (p⁻¹ * φ.symm ⟨x, hx⟩)) + refine ⟨t, ⟨ht.1.le, ht.2⟩, ?_⟩ + simp [f, h] + have hrest : bd S \ C = ⋃₀ ((cuffs S) \ {C}) := by + ext x + constructor + · rintro ⟨h1, h2⟩ + refine ⟨connectedComponentIn (bd S) x, ⟨⟨x, h1, rfl⟩, ?_⟩, mem_connectedComponentIn h1⟩ + intro h3 + exact h2 (h3 ▸ mem_connectedComponentIn h1) + · rintro ⟨D, ⟨⟨z, hz, rfl⟩, hne⟩, hx⟩ + refine ⟨connectedComponentIn_subset _ _ hx, fun h2 => hne ?_⟩ + change connectedComponentIn (bd S) z = C + rw [connectedComponentIn_eq hx] + exact (connectedComponentIn_eq h2).symm + refine ⟨f, hfc, ?_, hinj, hper, fun t ht => hCb (himg ▸ mem_image_of_mem f ht), ?_⟩ + · intro t ht + simp [f, p, ht] + · rw [himg, hrest] + refine (hfin.subset sdiff_subset).isClosed_sUnion fun D hD => ?_ + exact (harc D hD.1).isCompact.isClosed + +/-- Each point of `bd(Σ)` has a parameter of its cuff, with the point at `0`. -/ +theorem exists_cuffMark (hS : IsSurface S) {y : S} (hy : y ∈ bd S) : ∃ f : ℝ → S, Continuous f + ∧ f 0 = y ∧ + InjOn f (Ioc (-Real.pi) Real.pi) ∧ f (-Real.pi) = f Real.pi ∧ (∀ t ∈ Icc + (-Real.pi) Real.pi, f t ∈ bd S) ∧ + IsClosed (bd S \ f '' Icc (-Real.pi) Real.pi) := by + obtain ⟨f, h1, h2, h3⟩ := exists_cuffParam hS hy 1 + exact ⟨f, h1, h2 0 (by simp), h3⟩ + +/-- Each point of `bd(Σ)` has a parameter of its cuff, with the point at the seam `π`. -/ +theorem exists_cuffSeam (hS : IsSurface S) {y : S} (hy : y ∈ bd S) : ∃ f : ℝ → S, Continuous f + ∧ f Real.pi = y ∧ + InjOn f (Ioc (-Real.pi) Real.pi) ∧ f (-Real.pi) = f Real.pi ∧ (∀ t ∈ Icc + (-Real.pi) Real.pi, f t ∈ bd S) ∧ + IsClosed (bd S \ f '' Icc (-Real.pi) Real.pi) := by + obtain ⟨f, h1, h2, h3⟩ := exists_cuffParam hS hy (Circle.exp Real.pi) + exact ⟨f, h1, h2 _ rfl, h3⟩ + +/-- A homeomorphism that fixes a drawing point by point does not change it. -/ +theorem mapDrawingHomeo_eq_self {α : S ≃ₜ S} {H : Drawing S} (h : ∀ z ∈ H.U, α z + = z) : mapDrawingHomeo α H = H := by + have h1 : α '' H.U = H.U := by + ext z + constructor + · rintro ⟨w, hw, rfl⟩ + rwa [h w hw] + · exact fun hz => ⟨z, hz, h z hz⟩ + have h2 : α '' H.V = H.V := by + ext z + constructor + · rintro ⟨w, hw, rfl⟩ + rwa [h w (H.V_subset_U hw)] + · exact fun hz => ⟨z, hz, h z (H.V_subset_U hz)⟩ + cases H + simp only [mapDrawingHomeo, Drawing.mk.injEq] + exact ⟨h1, h2⟩ + +/-- Pieces of the cuffs around the points of a finite set `Y`, with disjoint doubles. -/ +theorem exists_marks (hS : IsSurface S) {Y : Set S} (hY : Y ⊆ bd S) (hf : Y.Finite) : + ∃ (f : S → ℝ → S) (ε : S → ℝ), (∀ y ∈ Y, CuffMark (f y) (ε y) y) ∧ + ∀ y ∈ Y, ∀ y' ∈ Y, y ≠ y' → Disjoint (f y '' Icc (-(2 * ε y)) (2 * ε y)) (f y' '' Icc + (-(2 * ε y')) (2 * ε y')) := by + classical + have ht2 : T2Space S := hS.2.1 + obtain ⟨O, hO, hd⟩ := hf.t2_separation + have key : ∀ y : S, ∃ (g : ℝ → S) (e : ℝ), y ∈ Y → CuffMark g e y ∧ g '' Icc (-(2 * e)) + (2 * e) ⊆ O y := fun y => by + by_cases hy : y ∈ Y + · obtain ⟨g, hc, h0, hi, hp, hb, hr⟩ := exists_cuffMark hS (hY hy) + have hopen : IsOpen (g ⁻¹' O y) := (hO y).2.preimage hc + have hz : (0 : ℝ) ∈ g ⁻¹' O y := by + rw [mem_preimage, h0] + exact (hO y).1 + obtain ⟨r, hr0, hball⟩ := Metric.isOpen_iff.mp hopen 0 hz + have hmin : 0 < min (r / 4) (1 / 2) := lt_min (by linarith) (by norm_num) + refine ⟨g, min (r / 4) (1 / 2), fun _ => ⟨⟨hc, h0, hmin, ?_, hi, hp, hb, hr⟩, ?_⟩⟩ + · linarith [min_le_right (r / 4) (1 / 2 : ℝ)] + · rintro _ ⟨t, ht, rfl⟩ + refine hball (mem_ball_zero_iff.mpr ?_) + have h1 := min_le_left (r / 4) (1 / 2 : ℝ) + rw [Real.norm_eq_abs, abs_lt] + exact ⟨by linarith [ht.1], by linarith [ht.2]⟩ + · exact ⟨fun _ => y, 0, fun h => (hy h).elim⟩ + choose f ε hfe using key + exact ⟨f, ε, fun y hy => (hfe y hy).1, fun y hy y' hy' hne => + (hd hy hy' hne).mono (hfe y hy).2 (hfe y' hy').2⟩ + +/-- **A matching around a forest.** From marks on the cuffs at `Y = V(H) ∩ bd(Σ)`, we get the discs +of `exists_forest_thick` and the matching of +`exists_matching_of_discs`. Its ends lie on the marks, it strictly surrounds `H`, and it surrounds +other forests in the same discs. -/ +theorem exists_thick_matching (hS : IsSurface S) {Y : Set S} {H : Drawing S} + (hHf : IsSurfaceForest H) (hHY : H.V ∩ bd S = Y) {f : S → ℝ → S} {ε : S → ℝ} + (hm : ∀ y ∈ Y, CuffMark (f y) (ε y) y) + (hd : ∀ y ∈ Y, ∀ y' ∈ Y, y ≠ y' → Disjoint (f y '' Icc (-(2 * ε y)) (2 * ε y)) (f y' '' Icc + (-(2 * ε y')) (2 * ε y'))) : + ∃ (c : S → Set S) (σ₁ σ₂ : S → ℝ) (G : Drawing S), (∀ y ∈ Y, 0 < σ₁ y ∧ σ₁ y < ε y ∧ 0 < σ₂ y + ∧ σ₂ y < ε y) ∧ IsMatching G ∧ + G.V = (⋃ y ∈ Y, {f y (σ₁ y), f y (-σ₂ y)}) ∧ MatchingStrictlySurroundsForest G H ∧ + (∀ y ∈ Y, IsClosedDisc (c y) ∧ y ∈ discBd (c y) ∧ ∃ O, IsOpen O ∧ y ∈ O ∧ O \ bd S ⊆ discInt + (c y)) ∧ + (∀ u ∈ Y, ∀ v ∈ Y, c u ≠ c v → Disjoint (c u) (c v)) ∧ (∀ y ∈ Y, Disjoint (discInt (c y)) + (bd S)) ∧ + ∀ H' : Drawing S, H'.V ∩ bd S = Y → (∀ u ∈ Y, ∀ v ∈ Y, c u = c v → Nonempty + (GraphWalk H'.toGraph u v)) → + (∀ e ∈ H'.E, ∀ u ∈ H'.V, ∀ y ∈ Y, u ∈ closure e → u ∈ c y → closure e ⊆ c y) → + (∀ y ∈ Y, ∀ z ∈ H'.U, z ∈ discBd (c y) → z ∈ Y) → MatchingStrictlySurroundsForest G H' := by + classical + have ht2 : T2Space S := hS.2.1 + have hpi := Real.pi_gt_three + have hf : Y.Finite := H.finite_V.subset fun y hy => (hHY ▸ hy : y ∈ H.V ∩ bd S).1 + have hε0 : ∀ y ∈ Y, 0 < ε y := fun y hy => (hm y hy).pos + have hε1 : ∀ y ∈ Y, ε y < 1 := fun y hy => (hm y hy).lt + have hinj : ∀ y ∈ Y, ∀ u ∈ Icc (-(2 * ε y)) (2 * ε y), ∀ v ∈ Icc (-(2 * ε y)) (2 * ε y), f y u + = f y v → u = v := fun y hy u hu v hv h => by + have h1 := hε1 y hy + exact (hm y hy).inj ⟨by linarith [hu.1], by linarith [hu.2]⟩ ⟨by linarith [hv.1], + by linarith [hv.2]⟩ h + have honBd : ∀ y ∈ Y, ∀ u ∈ Icc (-(2 * ε y)) (2 * ε y), f y u ∈ bd S := fun y hy u hu => by + have h1 := hε1 y hy + exact (hm y hy).onBd u ⟨by linarith [hu.1], by linarith [hu.2]⟩ + have hdis : ∀ y ∈ Y, ∀ y' ∈ Y, y ≠ y' → ∀ u ∈ Icc (-(2 * ε y)) (2 * ε y), ∀ v ∈ Icc (-(2 * ε y')) + (2 * ε y'), f y u ≠ f y' v := + fun y hy y' hy' hne u hu v hv e => disjoint_left.mp (hd y hy y' hy' hne) ⟨u, hu, rfl⟩ ⟨v, hv, + e.symm⟩ + have hY' : Y = H.V ∩ bd S := hHY.symm + have hprop : ∀ z ∈ H.U, z ∈ bd S → z ∈ H.V := fun z h1 h2 => hHf.1 ⟨h2, h1⟩ + have hYm : ∀ z, z ∈ H.V → z ∈ bd S → z ∈ Y := fun z h1 h2 => hHY ▸ (⟨h1, h2⟩ : z ∈ H.V ∩ bd S) + obtain ⟨c, σ₁, σ₂, h1, h2, h3, h4, h5, h6, h7, h8, h9⟩ := exists_forest_thick hS hHf (f := f) (ε + := ε) (fun y hy => hm y (hY' ▸ hy)) + have hσ : ∀ y ∈ Y, 0 < σ₁ y ∧ σ₁ y < ε y ∧ 0 < σ₂ y ∧ σ₂ y < ε y ∧ f y '' Icc (-σ₂ y) + (σ₁ y) ⊆ discBd (c y) ∧ + ∃ O, IsOpen O ∧ f y '' Ioo (-σ₂ y) (σ₁ y) ⊆ O ∧ O ⊆ c y ∧ O \ bd S ⊆ discInt (c y) + := fun y hy => h8 y (hY' ▸ hy) + have hsubI : ∀ y ∈ Y, Icc (-σ₂ y) (σ₁ y) ⊆ Icc (-(2 * ε y)) (2 * ε y) := fun y hy u hu => by + obtain ⟨a1, a2, a3, a4, -⟩ := hσ y hy + exact ⟨by linarith [hu.1], by linarith [hu.2]⟩ + have h0m : ∀ y ∈ Y, (0 : ℝ) ∈ Icc (-(2 * ε y)) (2 * ε y) := fun y hy => by + have := hε0 y hy + exact ⟨by linarith, by linarith⟩ + have hYH : ∀ y ∈ Y, y ∈ H.V := fun y hy => (hY' ▸ hy : y ∈ H.V ∩ bd S).1 + obtain ⟨G, hG1, hG2, hG4, hG3'⟩ := exists_matching_of_discs hf (c := c) (ℓ := fun y => f y '' Icc + (-σ₂ y) (σ₁ y)) (s := fun y => f y (σ₁ y)) + (t := fun y => f y (-σ₂ y)) (fun y hy => h1 y (hYH y hy)) (fun y hy => h7 y (hYH y hy)) + (fun u hu v hv h => h3 u (hYH u hu) v (hYH v hv) h) (fun y hy => by + obtain ⟨a1, a2, a3, a4, a5, O, a6, a7, a8, -⟩ := hσ y hy + have hlt : -σ₂ y < σ₁ y := by linarith + have hne : f y (σ₁ y) ≠ f y (-σ₂ y) := fun e => by + have := hinj y hy _ (hsubI y hy ⟨hlt.le, le_rfl⟩) _ (hsubI y hy ⟨le_rfl, hlt.le⟩) e + linarith + have hmemy : y = f y 0 := (hm y hy).zero.symm + have h0I : (0 : ℝ) ∈ Icc (-σ₂ y) (σ₁ y) := ⟨by linarith, by linarith⟩ + refine ⟨(isLine_of_injOn (hm y hy).cont hlt fun u hu v hv e => hinj y hy u (hsubI y hy hu) v + (hsubI y hy hv) e).symm, hne, a5, ?_, ⟨0, h0I, hmemy.symm⟩, ?_, ?_, O, a6, ?_, a8⟩ + · rintro _ ⟨u, hu, rfl⟩ + exact honBd y hy u (hsubI y hy hu) + · intro e + have := hinj y hy 0 (h0m y hy) _ (hsubI y hy ⟨hlt.le, le_rfl⟩) + (by rw [(hm y hy).zero]; exact e) + linarith + · intro e + have := hinj y hy 0 (h0m y hy) _ (hsubI y hy ⟨le_rfl, hlt.le⟩) + (by rw [(hm y hy).zero]; exact e) + linarith + · rintro z ⟨⟨u, hu, rfl⟩, hz⟩ + exact a7 ⟨u, ⟨lt_of_le_of_ne hu.1 fun e => hz (.inr (congrArg _ e.symm)), + lt_of_le_of_ne hu.2 fun e => hz (.inl (congrArg _ e))⟩, rfl⟩) + (fun y hy y' hy' hne => disjoint_left.mpr fun z hz hz' => by + obtain ⟨u, hu, rfl⟩ := hz + obtain ⟨v, hv, e⟩ := hz' + exact hdis y hy y' hy' hne u (hsubI y hy hu) v (hsubI y' hy' hv) e.symm) + (fun v hv z hz => by + obtain ⟨y, hy, h10⟩ := mem_iUnion₂.mp (h9 v (hYH v hv) hz) + exact mem_iUnion₂.mpr ⟨y, hY' ▸ hy, h10⟩) + have hG3 : MatchingStrictlySurroundsForest G H := hG3' H hHY (fun u hu v hv h => h2 u + (hYH u hu) v (hYH v hv) h) + (fun e he u hu y hy huc huy => by + have h10 := h4 e he u hu huc + by_cases h11 : c u = c y + · exact h11 ▸ h10 + · exact (disjoint_left.mp (h3 u hu y (hYH y hy) h11) (h5 u hu) huy).elim) + (fun y hy z hz hzb => hYm z (h6 y (hYH y hy) z hz hzb).1 (h6 y (hYH y hy) z hz hzb).2) + refine ⟨c, σ₁, σ₂, G, fun y hy => ?_, hG1, hG2, hG3, fun y hy => ?_, + fun u hu v hv h => h3 u (hYH u hu) v (hYH v hv) h, fun y hy => ?_, hG3'⟩ + · obtain ⟨a1, a2, a3, a4, -⟩ := hσ y hy + exact ⟨a1, a2, a3, a4⟩ + · obtain ⟨a1, a2, a3, a4, a5, O, a6, a7, a8, a9⟩ := hσ y hy + have h0I : (0 : ℝ) ∈ Icc (-σ₂ y) (σ₁ y) := ⟨by linarith, by linarith⟩ + have h0J : (0 : ℝ) ∈ Ioo (-σ₂ y) (σ₁ y) := ⟨by linarith, by linarith⟩ + exact ⟨h1 y (hYH y hy), a5 ⟨0, h0I, (hm y hy).zero⟩, O, a6, a7 ⟨0, h0J, (hm y hy).zero⟩, a9⟩ + · refine disjoint_left.mpr fun z hz hzb => hz.2 ?_ + obtain ⟨y', hy', h10⟩ := mem_iUnion₂.mp (h9 y (hYH y hy) ⟨hz.1, hzb⟩) + have h11 := (hσ y' (hY' ▸ hy')).2.2.2.2.1 h10 + by_cases h12 : c y = c y' + · exact h12 ▸ h11 + · exact (disjoint_left.mp (h3 y (hYH y hy) y' (hY'.symm ▸ hy' |> fun h => + (h : y' ∈ H.V ∩ bd S).1) h12) hz.1 (GM11.discBd_subset _ h11)).elim + +omit [TopologicalSpace S] in +private theorem marked_cuff_point_has_signed_parameter + {S : Type} + {Y : Set S} + (f : S → ℝ → S) + (ε : S → ℝ) + (hε0 : ∀ y ∈ Y, 0 < ε y) : + ∀ (p : ↑Y × Bool), ∃ u ∈ Icc (-(2 * ε ↑p.1)) (2 * ε ↑p.1), u ≠ 0 ∧ (p.2 = true → 0 < u) ∧ (p.2 + = false → u < 0) ∧ + (fun p : Y × Bool => if p.2 = true then f (↑p.1) (ε ↑p.1) else f (↑p.1) (-ε ↑p.1)) p + = f (↑p.1) u := by + let pt := fun p : Y × Bool => if p.2 = true then f (↑p.1) (ε ↑p.1) else f (↑p.1) (-ε ↑p.1) + rintro ⟨y, b⟩ + have h0 : 0 < ε y := hε0 y y.2 + cases b + · refine ⟨-ε y, ⟨?_, ?_⟩, neg_ne_zero.mpr h0.ne', (fun h => by cases h), + fun _ => neg_lt_zero.mpr h0, rfl⟩ + · change -(2 * ε y) ≤ -ε y + linarith + · change -ε y ≤ 2 * ε y + linarith + · refine ⟨ε y, ⟨?_, ?_⟩, h0.ne', fun _ => h0, (fun h => by cases h), rfl⟩ + · change -(2 * ε y) ≤ ε y + linarith + · change ε y ≤ 2 * ε y + linarith + +omit [TopologicalSpace S] in +private theorem marked_cuff_points_are_distinct + {S : Type} + {Y : Set S} + (f : S → ℝ → S) + (ε : S → ℝ) + (hinj : ∀ y ∈ Y, ∀ u ∈ Icc (-(2 * ε y)) (2 * ε y), ∀ v ∈ Icc (-(2 * ε y)) (2 * ε y), f y u = f + y v → u = v) + (hdis : ∀ y ∈ Y, ∀ y' ∈ Y, y ≠ y' → ∀ u ∈ Icc (-(2 * ε y)) (2 * ε y), ∀ v ∈ Icc (-(2 * ε y')) + (2 * ε y'), f y u ≠ f y' v) + (pt : ↑Y × Bool → S) + (hptI : ∀ (p : ↑Y × Bool), ∃ u ∈ Icc (-(2 * ε ↑p.1)) (2 * ε ↑p.1), u ≠ 0 ∧ (p.2 = true → 0 < + u) ∧ (p.2 = false → u < 0) ∧ pt p = f (↑p.1) u) : + Function.Injective pt := by + rintro ⟨y, b⟩ ⟨y', b'⟩ h + obtain ⟨u, hu, -, hp1, hn1, e1⟩ := hptI ⟨y, b⟩ + obtain ⟨v, hv, -, hp2, hn2, e2⟩ := hptI ⟨y', b'⟩ + simp only at hu hv hp1 hn1 hp2 hn2 e1 e2 + rw [e1, e2] at h + by_cases hy : y = y' + · subst hy + have huv := hinj y y.2 u hu v hv h + have hb : b = b' := by + cases b <;> cases b' <;> simp_all <;> linarith + rw [hb] + · exact (hdis y y.2 y' y'.2 (fun e => hy (Subtype.ext e)) u hu v hv h).elim + +/-- **Graph Minors VII, (3.4), claim (1) (page 220).** For a finite set `Y` in `bd(Σ)`, there is a +set `X ⊆ bd(Σ)` with `|X| = 2|Y|` such that each +`Y`-forest is strictly surrounded by some `X`-matching. The route is as in the paper: take discs +around the components of the forest (`exists_forest_thick`), cut +their boundaries at `bd(Σ)` (`exists_matching_of_discs`), and slide the ends of the lines to `X` +(`exists_bd_slides`). -/ +theorem exists_forest_matching (hS : IsSurface S) {Y : Set S} (hY : Y ⊆ bd S) (hf : Y.Finite) : + ∃ X : Set S, X ⊆ bd S ∧ X.Finite ∧ X.ncard = 2 * Y.ncard ∧ ∀ H : Drawing S, IsYForest Y H → + ∃ G : Drawing S, IsXMatching X G ∧ MatchingStrictlySurroundsForest G H := by + classical + have ht2 : T2Space S := hS.2.1 + have hpi := Real.pi_gt_three + obtain ⟨f, ε, hm, hd⟩ := exists_marks hS hY hf + have hε0 : ∀ y ∈ Y, 0 < ε y := fun y hy => (hm y hy).pos + have hε1 : ∀ y ∈ Y, ε y < 1 := fun y hy => (hm y hy).lt + have hinj : ∀ y ∈ Y, ∀ u ∈ Icc (-(2 * ε y)) (2 * ε y), ∀ v ∈ Icc (-(2 * ε y)) (2 * ε y), f y u + = f y v → u = v := fun y hy u hu v hv h => by + have h1 := hε1 y hy + exact (hm y hy).inj ⟨by linarith [hu.1], by linarith [hu.2]⟩ ⟨by linarith [hv.1], + by linarith [hv.2]⟩ h + have honBd : ∀ y ∈ Y, ∀ u ∈ Icc (-(2 * ε y)) (2 * ε y), f y u ∈ bd S := fun y hy u hu => by + have h1 := hε1 y hy + exact (hm y hy).onBd u ⟨by linarith [hu.1], by linarith [hu.2]⟩ + have hdis : ∀ y ∈ Y, ∀ y' ∈ Y, y ≠ y' → ∀ u ∈ Icc (-(2 * ε y)) (2 * ε y), ∀ v ∈ Icc (-(2 * ε y')) + (2 * ε y'), f y u ≠ f y' v := + fun y hy y' hy' hne u hu v hv e => disjoint_left.mp (hd y hy y' hy' hne) ⟨u, hu, rfl⟩ ⟨v, hv, + e.symm⟩ + have hpt : ∀ y ∈ Y, ∀ δ, |δ| ≤ 2 * ε y → δ ∈ Icc (-(2 * ε y)) (2 * ε y) := fun y _ δ h + => abs_le.mp h + let pt : ↥Y × Bool → S := fun p => if p.2 then f p.1 (ε p.1) else f p.1 (-ε p.1) + have hptI : ∀ p : ↥Y × Bool, ∃ u ∈ Icc (-(2 * ε p.1)) (2 * ε p.1), + u ≠ 0 ∧ (p.2 = true → 0 < u) ∧ (p.2 = false → u < 0) ∧ pt p = f p.1 u := by + exact marked_cuff_point_has_signed_parameter (S := S) (Y := Y) f ε hε0 + have hptinj : Function.Injective pt := by + exact marked_cuff_points_are_distinct (S := S) (Y := Y) f ε hinj hdis pt hptI + let X : Set S := range pt + have : Finite Y := hf.to_subtype + have hXfin : X.Finite := finite_range pt + have hXb : X ⊆ bd S := by + rintro _ ⟨p, rfl⟩ + obtain ⟨u, hu, -, -, -, e⟩ := hptI p + rw [e] + exact honBd _ p.1.2 u hu + have hXcard : X.ncard = 2 * Y.ncard := by + have h1 : X.ncard = Nat.card (↥Y × Bool) := by + rw [← Nat.card_coe_set_eq] + exact Nat.card_congr (Equiv.ofInjective pt hptinj).symm + rw [h1, Nat.card_prod, Nat.card_eq_fintype_card (α := Bool), Fintype.card_bool, + Nat.card_coe_set_eq] + ring + refine ⟨X, hXb, hXfin, hXcard, fun H hH => ?_⟩ + obtain ⟨hHf, hHY⟩ := hH + have hprop : ∀ z ∈ H.U, z ∈ bd S → z ∈ H.V := fun z h1 h2 => hHf.1 ⟨h2, h1⟩ + have hYm : ∀ z, z ∈ H.V → z ∈ bd S → z ∈ Y := fun z h1 h2 => hHY ▸ (⟨h1, h2⟩ : z ∈ H.V ∩ bd S) + obtain ⟨c, σ₁, σ₂, G, hσ, hG1, hG2, hG3, -, -, -, -⟩ := exists_thick_matching hS hHf hHY hm hd + have h0m : ∀ y ∈ Y, (0 : ℝ) ∈ Icc (-(2 * ε y)) (2 * ε y) := fun y hy => by + have := hε0 y hy + exact ⟨by linarith, by linarith⟩ + -- The slides. + let sg : ↥Y × Bool → ℝ := fun p => if p.2 then -1 else 1 + let g : ↥Y × Bool → ℝ → S := fun p u => f p.1 (sg p * u) + let a : ↥Y × Bool → ℝ := fun p => -(2 * ε p.1) + let x : ↥Y × Bool → ℝ := fun p => -ε p.1 + let m : ↥Y × Bool → ℝ := fun p => if p.2 then -σ₁ p.1 else -σ₂ p.1 + let b : ↥Y × Bool → ℝ := fun p => m p / 2 + have hsg : ∀ p, sg p = -1 ∨ sg p = 1 := fun p => by + simp only [sg] + split_ifs + · exact .inl rfl + · exact .inr rfl + have hsgm : ∀ p, sg p * sg p = 1 := fun p => by + rcases hsg p with h | h <;> rw [h] <;> norm_num + have hmm : ∀ p : ↥Y × Bool, x p < m p ∧ m p < 0 := fun p => by + obtain ⟨a1, a2, a3, a4⟩ := hσ p.1 p.1.2 + simp only [m, x] + split_ifs + · exact ⟨by linarith, by linarith⟩ + · exact ⟨by linarith, by linarith⟩ + have hax : ∀ p, a p < x p := fun p => by + have := hε0 p.1 p.1.2 + simp only [a, x] + linarith + have hmb : ∀ p, m p < b p := fun p => by + have := (hmm p).2 + simp only [b] + linarith + have hb0 : ∀ p, b p < 0 := fun p => by + have := (hmm p).2 + simp only [b] + linarith + have hpar : ∀ p, ∀ u ∈ Icc (a p) (b p), sg p * u ∈ Icc (-(2 * ε p.1)) (2 * ε p.1) := fun p u hu + => by + have h10 := hu.1 + have h11 := hb0 p + have h12 := hu.2 + simp only [a] at h10 + rcases hsg p with h | h <;> rw [h] + · exact ⟨by linarith, by linarith⟩ + · exact ⟨by linarith, by linarith⟩ + have hparne : ∀ p, ∀ u ∈ Icc (a p) (b p), sg p * u ≠ 0 := fun p u hu e => by + have h11 := hb0 p + have h12 := hu.2 + rcases hsg p with h | h <;> rw [h] at e <;> linarith + have hZg : ∀ p, ∀ u ∈ Icc (a p) (b p), g p u ∉ H.U := fun p u hu h => by + have hb' := honBd _ p.1.2 _ (hpar p u hu) + have hV := hprop _ h hb' + have hmemY : f p.1 (sg p * u) ∈ Y := hYm _ hV hb' + by_cases he : f p.1 (sg p * u) = p.1.1 + · have h0 : f p.1 0 = p.1.1 := (hm _ p.1.2).zero + exact hparne p u hu (hinj _ p.1.2 _ (hpar p u hu) 0 (h0m _ p.1.2) (he.trans h0.symm)) + · exact hdis _ hmemY _ p.1.2 he 0 (h0m _ hmemY) _ (hpar p u hu) ((hm _ hmemY).zero) + have hxI : ∀ p, x p ∈ Icc (a p) (b p) := fun p => ⟨(hax p).le, by linarith [(hmm p).1, hmb p]⟩ + have hmI : ∀ p, m p ∈ Icc (a p) (b p) := fun p => ⟨by linarith [(hmm p).1, hax p], (hmb p).le⟩ + obtain ⟨α, hα1, hα2⟩ := exists_bd_slides hS (g := g) (a := a) (x := x) (m := m) (b := b) (fun p + => (hm _ p.1.2).cont.comp (by fun_prop)) + hax (fun p => (hmm p).1) hmb + (fun p u hu v hv e => by + have h10 := hinj _ p.1.2 _ (hpar p u hu) _ (hpar p v hv) e + have h11 := congrArg (sg p * ·) h10 + simp only [← mul_assoc, hsgm, one_mul] at h11 + exact h11) + (fun p u hu => honBd _ p.1.2 _ (hpar p u hu)) + (fun p => by + have h0 : 0 < ε p.1 := hε0 p.1 p.1.2 + have h1' := hε1 p.1 p.1.2 + have h2' := hb0 p + have h3' : a p = -(2 * ε p.1) := rfl + have h4' := hmb p + rcases hsg p with h | h + · have heq : g p '' Ioo (a p) (b p) = f p.1 '' Ioo (-b p) (-a p) := by + ext z + constructor + · rintro ⟨u, hu, rfl⟩ + exact ⟨-u, ⟨by linarith [hu.2], by linarith [hu.1]⟩, by simp [g, h]⟩ + · rintro ⟨u, hu, rfl⟩ + exact ⟨-u, ⟨by linarith [hu.2], by linarith [hu.1]⟩, by simp [g, h]⟩ + rw [heq] + exact (hm _ p.1.2).isClosed_rest' (by linarith) (by linarith) (by linarith [hax p, + (hmm p).1]) + · have heq : g p '' Ioo (a p) (b p) = f p.1 '' Ioo (a p) (b p) := by + ext z + constructor + · rintro ⟨u, hu, rfl⟩ + exact ⟨u, hu, by simp [g, h]⟩ + · rintro ⟨u, hu, rfl⟩ + exact ⟨u, hu, by simp [g, h]⟩ + rw [heq] + exact (hm _ p.1.2).isClosed_rest' (by linarith) (by linarith) (by linarith [hax p, + (hmm p).1])) + H.isClosed_U hZg + (fun p q hne => disjoint_left.mpr fun z hz hz' => by + obtain ⟨u, hu, rfl⟩ := hz + obtain ⟨v, hv, e⟩ := hz' + by_cases hy : p.1.1 = q.1.1 + · have hpq : p.1 = q.1 := Subtype.ext hy + have hbne : p.2 ≠ q.2 := fun e' => hne (Prod.ext hpq e') + have h10 : f q.1 (sg q * v) = f p.1 (sg p * u) := e + rw [← hpq] at h10 + have hvp := hpar q v hv + rw [← hpq] at hvp + have h11 := hinj _ p.1.2 _ hvp _ (hpar p u hu) h10 + have hu0 := hb0 p + have hv0 := hb0 q + have hu1 := hu.2 + have hv1 := hv.2 + have hsgs : ∀ r : ↥Y × Bool, sg r = if r.2 then -1 else 1 := fun _ => rfl + rw [hsgs p, hsgs q] at h11 + cases hp2 : p.2 <;> cases hq2 : q.2 + · exact hbne (hp2.trans hq2.symm) + · simp only [hp2, hq2] at h11 + norm_num at h11 + linarith + · simp only [hp2, hq2] at h11 + norm_num at h11 + linarith + · exact hbne (hp2.trans hq2.symm) + · exact hdis _ p.1.2 _ q.1.2 hy _ (hpar p u hu) _ (hpar q v hv) e.symm) + have hFix : mapDrawingHomeo α H = H := mapDrawingHomeo_eq_self hα1 + have hXG : α '' G.V = X := by + rw [hG2] + have hval₁ : ∀ y : Y, α (f y (σ₁ y)) = f y (ε y) := fun y => by + have := hα2 (y, true) + simpa [g, sg, m, x] using this + have hval₂ : ∀ y : Y, α (f y (-σ₂ y)) = f y (-ε y) := fun y => by + have := hα2 (y, false) + simpa [g, sg, m, x] using this + ext z + constructor + · rintro ⟨w, hw, rfl⟩ + obtain ⟨y, hy, hw'⟩ := mem_iUnion₂.mp hw + rcases hw' with rfl | rfl + · exact ⟨(⟨y, hy⟩, true), by simpa [pt] using (hval₁ ⟨y, hy⟩).symm⟩ + · exact ⟨(⟨y, hy⟩, false), by simpa [pt] using (hval₂ ⟨y, hy⟩).symm⟩ + · rintro ⟨⟨y, c'⟩, rfl⟩ + cases c' + · exact ⟨f y (-σ₂ y), mem_iUnion₂.mpr ⟨y, y.2, .inr rfl⟩, by simpa [pt] using hval₂ y⟩ + · exact ⟨f y (σ₁ y), mem_iUnion₂.mpr ⟨y, y.2, .inl rfl⟩, by simpa [pt] using hval₁ y⟩ + have hXm : IsXMatching (α '' G.V) (mapDrawingHomeo α G) := IsXMatching.map_homeo α ⟨hG1, rfl⟩ + rw [hXG] at hXm + have hsur := MatchingStrictlySurroundsForest.map_homeo α (G' := mapDrawingHomeo α G) rfl hG3 + rw [hFix] at hsur + exact ⟨_, hXm, hsur⟩ + +/-- Graph Minors VII, (3.4), claim (1) (page 220), as the statement used in Sections 3, 7, and 9. -/ +theorem forestSurroundingMatching.{u} : ForestSurroundingMatchingStatement.{u} := by + intro S _ hS Y hY hf + have : T2Space S := hS.2.1 + obtain ⟨S₀, tS₀, ⟨β⟩⟩ := exists_homeo_type_zero hS + have hS₀ : IsSurface S₀ := isSurface_of_homeo β hS + have : T2Space S₀ := hS₀.2.1 + have hY₀ : β '' Y ⊆ bd S₀ := by + rw [← image_bd_homeomorph β] + exact image_mono hY + obtain ⟨X₀, hX₀_bd, hX₀_fin, hX₀_card, hX₀_surr⟩ := + exists_forest_matching hS₀ hY₀ (hf.image β) + refine ⟨β.symm '' X₀, ?_, hX₀_fin.image β.symm, ?_, fun H hH => ?_⟩ + · rw [← image_bd_homeomorph β.symm] + exact image_mono hX₀_bd + · rw [ncard_image_of_injective _ β.symm.injective, hX₀_card, + ncard_image_of_injective _ β.injective] + · obtain ⟨G₀, hG₀_match, hG₀_surr⟩ := hX₀_surr (mapDrawingHomeo β H) (hH.map_homeo β) + refine ⟨mapDrawingHomeo β.symm G₀, hG₀_match.map_homeo β.symm, ?_⟩ + have hsur := MatchingStrictlySurroundsForest.map_homeo β.symm + (G' := mapDrawingHomeo β.symm G₀) rfl hG₀_surr + rwa [mapDrawingHomeo_symm_mapDrawingHomeo] at hsur + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffStep.lean b/LeanPool/GraphMinor/GM07/CuffStep.lean new file mode 100644 index 0000000000..c29e7b02b0 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffStep.lean @@ -0,0 +1,561 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffForest +public import LeanPool.GraphMinor.GM11.Ties +public import LeanPool.GraphMinor.Surface.ModelCriterion + +/-! +# The step of (6.1) + +Graph Minors VII, (6.1), page 237. We take a cuff `C` with at most one vertex, the disc `Δ` of `Σ + +CHat` around it from `exists_two_vertex_disc`, and shift `C` onto the boundary `A` of `Δ`. The new +surface is `Σ` itself. It stands for the part of `Σ` outside `A`, which the shift `h` covers. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] {T : Type u} [TopologicalSpace T] {C : Set S} {j : S + → T} {D : Set T} + +/-- A vertex on the closure of an edge of a walk is on the walk. -/ +theorem walk_closure_vertex {G : Drawing S} {u v : S} (W : GraphWalk G.toGraph u v) : ∀ e ∈ + W.edges, ∀ x ∈ closure e, x ∈ G.V → x ∈ W.support := by + induction W with + | nil _ => simp [GraphWalk.edges] + | cons hl rest ih => + intro e he x hx hxV + rcases List.mem_cons.mp he with rfl | he + · have h1 : x ∈ closure e ∩ G.V := ⟨hx, hxV⟩ + rw [hl.2.2.2] at h1 + rcases h1 with rfl | rfl + · exact List.mem_cons_self + · exact List.mem_cons_of_mem _ rest.start_mem_support + · exact List.mem_cons_of_mem _ (ih e he x hx hxV) + +/-- The part of `G` off an open set whose frontier is `G`-normal. -/ +theorem exists_outside_drawing [T1Space S] {G : Drawing S} {Z : Set S} (hZ : IsOpen Z) + (hedge : ∀ e ∈ G.E, (∃ y ∈ e, y ∉ Z) → Disjoint e Z) : + ∃ G₁ : Drawing S, G₁.IsSubdrawing G ∧ G₁.U = G.U ∩ Zᶜ ∧ G₁.V = G.V ∩ Zᶜ := by + classical + let G₁ := G.span Zᶜ {e | Disjoint e Z} + have hsub : G₁.IsSubdrawing G := Drawing.span_isSubdrawing G _ _ + have hE : ∀ e ∈ ({e | Disjoint e Z} ∩ G.E : Set (Set S)), closure e ⊆ Zᶜ := fun e he => + (Disjoint.closure_left he.1 hZ).le_compl_right + have hV : G₁.V ⊆ Zᶜ := by + rintro x (hx | hx) + · exact hx.1 + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact hE e he hxe.1 + refine ⟨G₁, hsub, subset_antisymm (subset_inter hsub.U_subset ?_) ?_, + subset_antisymm (subset_inter hsub.1 hV) ?_⟩ + · rintro x (hx | hx) + · exact hV hx + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact hE e he hxe + · rintro x ⟨hxU, hxZ⟩ + by_cases hxV : x ∈ G.V + · exact .inl (.inl ⟨hxZ, hxV⟩) + · obtain ⟨e, he, hxe⟩ := G.exists_edge_of_mem hxU hxV + exact .inr (mem_iUnion₂.mpr ⟨e, ⟨hedge e he ⟨x, hxe, hxZ⟩, he⟩, subset_closure hxe⟩) + · rintro x ⟨hxV, hxZ⟩ + exact .inl ⟨hxZ, hxV⟩ + +/-- **The data of the arc.** Two vertices of the boundary of `Δ`, a point `x₀` of `C`, a path `Q` +from `x₀` to the first vertex, and a walk of `G` to the first vertex that is `Q` if `x₀` is a +vertex. -/ +theorem exists_pendant_walk [T1Space S] (hS : IsSurface S) [ConnectedSpace S] (hC : C ∈ cuffs S) + (hc : IsCappedCuff C T j D) (hns : ¬ IsSphere T) {G : Drawing S} (hbl : IsBoundaryLinked G) {Δ Y + : Set T} (hΔ : IsClosedDisc Δ) (hDΔ : D ⊆ Δ) (hn : G.IsNormal (j ⁻¹' discBd Δ)) + (hint : ∀ x ∈ discBd Δ, IsInteriorPoint x) (hsmall : (G.V ∩ C).ncard ≤ 1) (h2 : + (G.V ∩ j ⁻¹' discBd Δ).ncard = 2) (hY : IsClosedDisc Y) (hΔY : Δ ⊆ Y \ discBd Y) : + ∃ (a₁ a₂ x₀ x₁ : S) (W : GraphWalk G.toGraph x₁ a₁) (Q : Path x₀ a₁), a₁ ≠ a₂ + ∧ G.V ∩ j ⁻¹' discBd Δ = {a₁, a₂} ∧ x₀ ∈ C ∧ (∀ t, j (Q t) ∈ Y) ∧ (∀ x ∈ + (walkDrawing G W).U, x = a₁ ∨ j x ∈ discInt Δ) ∧ (∀ X, IsOArc X → ¬ X ⊆ + (walkDrawing G W).U) ∧ + (∀ s ∈ G.V ∩ C, s = x₀ ∧ x₁ = x₀) ∧ (x₀ ∈ G.V → ∀ t, Q t ∈ (walkDrawing G W).U) := by + classical + have hT := hc.isSurface + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have : T2Space T := hT.2.1 + have hcj : IsClosedEmbedding j := hc.isEmbedding.continuous.isClosedEmbedding + hc.isEmbedding.injective + have hnilU : ∀ {a : S} (ha : a ∈ G.V), (walkDrawing G (GraphWalk.nil (G := G.toGraph) ha)).U + = {a} := fun {a} ha => by + ext x + rw [mem_walkDrawing_U] + simp [GraphWalk.support, GraphWalk.edges] + have hnilO : ∀ {a : S} (ha : a ∈ G.V) (X : Set S), IsOArc X → ¬ X ⊆ (walkDrawing G (GraphWalk.nil + (G := G.toGraph) ha)).U := fun {a} ha X hX hs => by + rw [hnilU ha] at hs + obtain ⟨y, hy, hne⟩ := IsOArc.exists_ne hX a + exact hne (hs hy) + obtain ⟨p, q, hpq, hset⟩ := ncard_eq_two.mp h2 + have hbdV : ∀ {x : S}, x ∈ ({p, q} : Set S) → x ∈ G.V ∧ j x ∈ discBd Δ := fun {x} hx => by + rw [← hset] at hx + exact hx + rcases (ncard_le_one_iff_eq (G.finite_V.subset inter_subset_left)).mp hsmall with hemp | ⟨c₀, + hone⟩ + · -- no vertex on the cuff + obtain ⟨x₀, hx₀⟩ := (isConnected_of_isOArc ((cuff_statement.{u} S hS).2.2 C hC)).nonempty + obtain ⟨Q, hQ⟩ := exists_path_in_collar hc hΔ hDΔ hY hΔY hx₀ (hbdV (.inl rfl)).2 + have ha := (hbdV (x := p) (.inl rfl)).1 + refine ⟨p, q, x₀, p, .nil ha, Q, hpq, hset, hx₀, hQ, fun x hx => ?_, hnilO ha, + fun s hs => ?_, fun h => ?_⟩ + · rw [hnilU ha] at hx + exact .inl hx + · exact absurd (hemp ▸ hs) (notMem_empty s) + · exact absurd (hemp ▸ (⟨h, hx₀⟩ : x₀ ∈ G.V ∩ C)) (notMem_empty x₀) + · have hc₀ : c₀ ∈ G.V ∩ C := by + rw [hone] + exact rfl + obtain ⟨a₁, ha₁, hab, W₀, hs₀, hin₀, hed₀⟩ := exists_walk_to_arc hS hC hc hns hbl hΔ hDΔ hn + hint hone + have ha₁m : a₁ ∈ ({p, q} : Set S) := hset ▸ (⟨ha₁, hab⟩ : a₁ ∈ G.V ∩ j ⁻¹' discBd Δ) + obtain ⟨a₂, hne₂, hset₂⟩ : ∃ a₂, a₁ ≠ a₂ ∧ G.V ∩ j ⁻¹' discBd Δ = {a₁, a₂} := by + rcases ha₁m with rfl | rfl + · exact ⟨q, hpq, hset⟩ + · exact ⟨p, hpq.symm, hset.trans (pair_comm _ _)⟩ + have hsC : ∀ s ∈ G.V ∩ C, s = c₀ := fun s hs => by + rw [hone] at hs + exact hs + by_cases heq : c₀ = a₁ + · subst heq + refine ⟨c₀, a₂, c₀, c₀, .nil ha₁, Path.refl _, hne₂, hset₂, hc₀.2, fun _ => ?_, + fun x hx => ?_, hnilO ha₁, fun s hs => ⟨hsC s hs, rfl⟩, fun _ t => ?_⟩ + · exact (hΔY (hDΔ (Surface.discBd_subset D (by + rw [hc.discBd_eq] + exact mem_image_of_mem j hc₀.2)))).1 + · rw [hnilU ha₁] at hx + exact .inl hx + · rw [hnilU ha₁] + exact rfl + · let W : GraphWalk G.toGraph c₀ a₁ := W₀.reverse + have hsW : W.IsSimple := by + unfold GraphWalk.IsSimple + rw [GraphWalk.support_reverse] + exact List.nodup_reverse.mpr hs₀ + have hsupp : ∀ v, v ∈ W.support ↔ v ∈ W₀.support := fun v => by + rw [GraphWalk.support_reverse, List.mem_reverse] + have hedg : ∀ e, e ∈ W.edges ↔ e ∈ W₀.edges := fun e => by + rw [GraphWalk.edges_reverse, List.mem_reverse] + have hL : IsLineWithEnds (walkDrawing G W).U c₀ a₁ := isLine_of_isPathBetween + (walkDrawing_isPathBetween G hsW) heq + have hLint : ∀ x ∈ (walkDrawing G W).U, x = a₁ ∨ j x ∈ discInt Δ := fun x hx => by + by_cases hxa : x = a₁ + · exact .inl hxa + refine .inr ?_ + rcases (mem_walkDrawing_U G W).mp hx with h | ⟨e, he, hxe⟩ + · exact hin₀ x ((hsupp x).mp h) hxa + · by_cases hxV : x ∈ G.V + · exact hin₀ x ((hsupp x).mp (walk_closure_vertex W e he x hxe hxV)) hxa + · have heE : e ∈ G.E := mem_E_of_mem_edges W he + have : x ∈ e := by + rw [← GM09.closure_edge_diff_V_eq G heE] + exact ⟨hxe, hxV⟩ + exact hed₀ e ((hedg e).mp he) (mem_image_of_mem j this) + obtain ⟨f, hf0, hf1⟩ := id hL + let Q : Path c₀ a₁ := ⟨⟨fun t => (f t).1, continuous_subtype_val.comp f.continuous⟩, hf0, hf1⟩ + have hQL : ∀ t, Q t ∈ (walkDrawing G W).U := fun t => (f t).2 + refine ⟨a₁, a₂, c₀, c₀, W, Q, hne₂, hset₂, hc₀.2, fun t => ?_, hLint, fun X hX hs + => not_isOArc_of_subset_line (IsLineWithEnds.isLine hL) hX hs, fun s hs + => ⟨hsC s hs, rfl⟩, fun _ => hQL⟩ + have hj : j (Q t) ∈ Δ := by + rcases hLint _ (hQL t) with h | h + · rw [h] + exact Surface.discBd_subset Δ hab + · exact h.1 + exact (hΔY hj).1 + +/-- For any surface `S ≃ₜ SurfaceModel a b c`, the number of cuffs is `c`. -/ +theorem ncard_cuffs_of_homeomorph_surfaceModel {a b c : ℕ} (he : Nonempty + (S ≃ₜ SurfaceModel a b c)) : (cuffs S).ncard = c := by + rcases he with ⟨e⟩ + obtain ⟨ht, f, hf⟩ := presents_ew a b c + have : T2Space (SurfaceModel a b c) := ht + rw [ncard_cuffs_congr e, ncard_cuffs hf] + +theorem two_mul_le_vSurface {a b c : ℕ} (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) (k : ℕ) : 2 * k + ≤ vSurface S k := + le_csInf ⟨_, a, b, c, hm, rfl⟩ (by + rintro _ ⟨_, _, _, _, rfl⟩ + exact Nat.le_add_left _ _) + +/-- Adding isolated vertices keeps a forest. -/ +theorem IsSurfaceForest.addIsolated [T1Space S] (hS : IsSurface S) [ConnectedSpace S] {H : Drawing + S} (hH : IsSurfaceForest H) {B : Set S} (hf : B.Finite) (hB : Disjoint B H.U) : IsSurfaceForest + (GM07.addIsolated H B hf hB) := by + have : T2Space S := hS.2.1 + refine ⟨?_, isForest_of_noOArc fun X hX hs => ?_⟩ + · rintro x ⟨hb, hx | hx⟩ + · exact .inl (hH.1 ⟨hb, hx⟩) + · exact .inr hx + · have hpre := (isConnected_of_isOArc hX).isPreconnected + by_cases h1 : (X ∩ H.U).Nonempty + · by_cases h2 : (X ∩ B).Nonempty + · obtain ⟨z, -, hz1, hz2⟩ := isPreconnected_closed_iff.mp hpre _ _ H.isClosed_U hf.isClosed + hs h1 h2 + exact disjoint_left.mp hB hz2 hz1 + · refine noOArc_of_forest hH.2 hX fun z hz => ?_ + rcases hs hz with h3 | h3 + · exact h3 + · exact absurd ⟨z, hz, h3⟩ h2 + · have hXB : X ⊆ B := fun z hz => by + rcases hs hz with h3 | h3 + · exact absurd ⟨z, hz, h3⟩ h1 + · exact h3 + obtain ⟨y, hy⟩ := (isConnected_of_isOArc hX).nonempty + obtain ⟨y', hy', hne⟩ := IsOArc.exists_ne hX y + exact hpre.infinite_of_nontrivial ⟨y', hy', y, hy, hne⟩ (hf.subset hXB) + +private theorem pulled_vertices_on_shifted_cuff + (S : Type u) + [TopologicalSpace S] + (G : Drawing S) + (C : Set S) + (T : Type u) + [TopologicalSpace T] + (j : S → T) + (Δ : Set T) + (a₁ : S) + (a₂ : S) + (x₀ : S) + (hset : G.V ∩ j ⁻¹' discBd Δ = {a₁, a₂}) + (hx₀C : x₀ ∈ C) + (h : S → S) + (hhi : Injective h) + (hh0 : h x₀ = a₁) + (c₂ : S) + (hc₂C : c₂ ∈ C) + (hc₂ : h c₂ = a₂) + (G' : Drawing S) + (hG'V : G'.V = h ⁻¹' G.V) + (hCA : ∀ x ∈ C, j (h x) ∈ discBd Δ) + (hx₀V : x₀ ∈ G'.V) + (hc₂V : c₂ ∈ G'.V) : + G'.V ∩ C = {x₀, c₂} := by + apply subset_antisymm + · rintro x ⟨hxV, hxC⟩ + rw [hG'V] at hxV + have h1 : h x ∈ G.V ∩ j ⁻¹' discBd Δ := ⟨hxV, hCA x hxC⟩ + rw [hset] at h1 + rcases h1 with h2 | h2 + · exact .inl (hhi (h2.trans hh0.symm)) + · exact .inr (hhi (h2.trans hc₂.symm)) + · rintro x (rfl | rfl) + · exact ⟨hx₀V, hx₀C⟩ + · exact ⟨hc₂V, hc₂C⟩ + +private theorem one_fewer_small_cuff + (S : Type u) + [TopologicalSpace S] + (g₀ : ℕ) + (G : Drawing S) + (hcount : {C | C ∈ cuffs S ∧ (G.V ∩ C).ncard ≤ 1}.ncard = g₀ + 1) + (C : Set S) + (hC : C ∈ cuffs S) + (hsmall : (G.V ∩ C).ncard ≤ 1) + (G' : Drawing S) + (hG'C2 : (G'.V ∩ C).ncard = 2) + (hother : ∀ C' ∈ cuffs S, C' ≠ C → G'.V ∩ C' = G.V ∩ C') : + {C' | C' ∈ cuffs S ∧ (G'.V ∩ C').ncard ≤ 1}.ncard = g₀ := by + have heq : {C' ∈ cuffs S | (G'.V ∩ C').ncard ≤ 1} = {C' ∈ cuffs S | (G.V ∩ C').ncard ≤ 1} \ {C} + := by + ext C' + constructor + · rintro ⟨h1, h2⟩ + have hne' : C' ≠ C := fun e => by + rw [e, hG'C2] at h2 + omega + exact ⟨⟨h1, hother C' h1 hne' ▸ h2⟩, hne'⟩ + · rintro ⟨⟨h1, h2⟩, h3⟩ + exact ⟨h1, (hother C' h1 h3).symm ▸ h2⟩ + have hmem : C ∈ {C' ∈ cuffs S | (G.V ∩ C').ncard ≤ 1} := ⟨hC, hsmall⟩ + rw [heq, ncard_sdiff_singleton_of_mem hmem, hcount] + rfl + +private theorem isolated_vertices_restore_boundary_agreement + (S : Type u) + [TopologicalSpace S] + [T1Space S] + (G : Drawing S) + (H : Drawing S) + (hVeq : G.V ∩ bd S = H.V ∩ bd S) + (C : Set S) + (x₀ : S) + (hsC : ∀ s ∈ G.V ∩ C, s = x₀) + (h : S → S) + (Φ : ↑unitInterval × S → S) + (hs : IsCuffShift C h Φ) + (c₂ : S) + (G' : Drawing S) + (hG'V : G'.V = h ⁻¹' G.V) + (hx₀V : x₀ ∈ G'.V) + (hc₂V : c₂ ∈ G'.V) + (hG'C : G'.V ∩ C = {x₀, c₂}) : + let B : Set S := {x₀, c₂} \ H.V + ∀ (hBf : B.Finite), + ∀ (hB : Disjoint B H.U), + (addIsolated H B hBf hB).V ∩ bd S = G'.V ∩ bd S := by + intro B hBf hB + change (H.V ∪ B) ∩ bd S = G'.V ∩ bd S + ext x + constructor + · rintro ⟨hx | hx, hb⟩ + · refine ⟨?_, hb⟩ + have hxG : x ∈ G.V ∩ bd S := hVeq.symm ▸ (⟨hx, hb⟩ : x ∈ H.V ∩ bd S) + by_cases hxC : x ∈ C + · rw [hsC x ⟨hxG.1, hxC⟩] + exact hx₀V + · rw [hG'V, mem_preimage, (hs.fix x hb hxC).1] + exact hxG.1 + · rcases hx.1 with rfl | rfl + · exact ⟨hx₀V, hb⟩ + · exact ⟨hc₂V, hb⟩ + · rintro ⟨hx, hb⟩ + refine ⟨?_, hb⟩ + by_cases hxC : x ∈ C + · have h1 : x ∈ ({x₀, c₂} : Set S) := hG'C ▸ (⟨hx, hxC⟩ : x ∈ G'.V ∩ C) + by_cases h2 : x ∈ H.V + · exact .inl h2 + · exact .inr ⟨h1, h2⟩ + · rw [hG'V, mem_preimage, (hs.fix x hb hxC).1] at hx + have : x ∈ H.V ∩ bd S := hVeq ▸ (⟨hx, hb⟩ : x ∈ G.V ∩ bd S) + exact .inl this.1 + +/-- Graph Minors VII, Section 6, inductive step in the proof of (6.1) (pages 237–238): +When `g = {C ∈ cuffs S | (G.V ∩ C).ncard ≤ 1}.ncard = g₀ + 1`, choosing a cuff `C` with +`|V(G) ∩ C| ≤ 1` and cutting along the surrounding `O`-arc `A` with `|V(G) ∩ A| = 2` yields a +surface `S' ≃ₜ S`, a boundary-linked proper graph `G'` in `S'`, and a forest `H'` in `S'` with +`g₀` cuffs containing `≤ 1` vertex of `G'`, such that `IsGFeasible G' H'` implies +`IsGFeasible G H`. The bound `g₀ + 1 ≤ k` says that `2k - 2g` is not negative, as it is in the +paper: subtraction here is cut off at `0`, and +the conclusion fails for `k = 0`. -/ +theorem smallCuffReductionStep (S : Type u) [TopologicalSpace S] [T1Space S] (hS : IsSurface S) + (a b c : ℕ) (hc2 : 2 ≤ c) (hne : (a, b, c) ≠ (0, 0, 2)) (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) + (k g₀ : ℕ) (G H : Drawing S) (hk : g₀ + 1 ≤ k) (hbl : IsBoundaryLinked G) + (hcount : {C ∈ cuffs S | (G.V ∩ C).ncard ≤ 1}.ncard = g₀ + 1) (hbdc : (G.V ∩ bd S).ncard + ≤ 2 * k - 2 * (g₀ + 1)) + (hα : 9 * k * vSurface S k < alpha G) (hHf : IsSurfaceForest H) (hVeq : G.V ∩ bd S + = H.V ∩ bd S) : + ∃ (S' : Type u) (_ : TopologicalSpace S') (_ : T1Space S') (G' H' : Drawing S'), + IsSurface S' ∧ Nonempty (S' ≃ₜ SurfaceModel a b c) ∧ + IsBoundaryLinked G' ∧ + {C' ∈ cuffs S' | (G'.V ∩ C').ncard ≤ 1}.ncard = g₀ ∧ + (G'.V ∩ bd S').ncard ≤ 2 * k - 2 * g₀ ∧ + 9 * k * vSurface S' k < alpha G' ∧ + IsSurfaceForest H' ∧ G'.V ∩ bd S' = H'.V ∩ bd S' ∧ + (IsGFeasible G' H' → IsGFeasible G H) := by + classical + have : ConnectedSpace S := connectedSpace_of_model hm + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have habc : 3 ≤ 3 * a + 3 * b + c := by + by_contra hlt + have h1 : a = 0 := by omega + have h2 : b = 0 := by omega + have h3 : c = 2 := by omega + exact hne (by rw [h1, h2, h3]) + have hcyl : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 2) := not_cylinder_of_model habc hm + have hG := hbl.1 + have hnsS : ¬ IsSphere S := not_isSphere_of_model hm (by omega) + obtain ⟨C, hC, hsmall⟩ : {C ∈ cuffs S | (G.V ∩ C).ncard ≤ 1}.Nonempty := + nonempty_of_ncard_ne_zero (by rw [hcount]; omega) + have hfinC : (cuffs S).Finite := (cuff_statement.{u} S hS).2.1 + have hnc := ncard_cuffs_of_homeomorph_surfaceModel hm + obtain ⟨C₁, hC₁, hC₁ne⟩ := exists_ne_of_one_lt_ncard (s := cuffs S) (by rw [hnc]; omega) C + have hCsub : ∀ {C' : Set S}, C' ∈ cuffs S → C' ⊆ bd S := fun hC' => + connectedComponentIn_subset_of_cuff hC' + obtain ⟨T, tT, j, D, hcap, hbT⟩ := exists_cappedCuff hS hC + have hT := hcap.isSurface + have : T2Space T := hT.2.1 + have hman := hT.2.2 + have hcj : IsClosedEmbedding j := hcap.isEmbedding.continuous.isClosedEmbedding + hcap.isEmbedding.injective + have hii := hcj.injective + have hns : ¬ IsSphere T := not_isSphere_cap hS habc hm hcap + have hv := two_mul_le_vSurface hm k + have hk1 : 1 ≤ k := by omega + have hbig : 2 * k + 9 ≤ 9 * k * vSurface S k := by + have h1 : 9 * k * (2 * k) ≤ 9 * k * vSurface S k := Nat.mul_le_mul_left _ hv + nlinarith + have hα₂ : ∀ C' ∈ cuffs S, C' ≠ C → 2 + (G.V ∩ C').ncard < alpha G := fun C' h1 _ => by + have h2 : (G.V ∩ C').ncard ≤ (G.V ∩ bd S).ncard := ncard_le_ncard (inter_subset_inter_right _ + (hCsub h1)) (G.finite_V.subset inter_subset_left) + omega + obtain ⟨Δ, hd, h2v, hoffT, hmaxF⟩ := exists_two_vertex_disc hS habc hm hcyl hG hC hcap hbT hsmall + (by omega) hα₂ hC₁ hC₁ne + obtain ⟨hΔ, hDΔ, hn, -⟩ := hd + have hint : ∀ x ∈ discBd Δ, IsInteriorPoint x := fun x hx => by + by_contra h + exact disjoint_left.mp hoffT (Surface.discBd_subset Δ hx) h + obtain ⟨Y, hY, hΔY, hYW⟩ := exists_disc_around hman hΔ hint (isClosed_bd T).isOpen_compl + (fun x hx hb => disjoint_left.mp hoffT (Surface.discBd_subset Δ hx) hb) + have hYoff : ∀ x, x ∈ Y → x ∉ bd T := fun x hx hb => by + rcases hYW hx with h | h + · exact disjoint_left.mp hoffT h hb + · exact h hb + obtain ⟨a₁, a₂, x₀, x₁, W, Q, hne₁₂, hset, hx₀C, hQY, hLint, hLO, hsC, hQL⟩ + := exists_pendant_walk hS hC hcap hns hbl hΔ hDΔ hn hint hsmall h2v hY hΔY + have ha₁ : a₁ ∈ G.V ∩ j ⁻¹' discBd Δ := hset ▸ mem_insert _ _ + have ha₂ : a₂ ∈ G.V ∩ j ⁻¹' discBd Δ := hset ▸ mem_insert_of_mem _ rfl + obtain ⟨h, Φ, hhc, hΦc, hhi, hfix, hzero, hone, hrange, himC, hh0, P, hP, hPQ⟩ + := exists_capped_push hcap hΔ hDΔ hY hΔY (discBd_subset_range hcap hDΔ) hx₀C ha₁.2 Q hQY + have hs : IsCuffShift C h Φ := ⟨hhc, hΦc, hhi, hzero, hone, fun x hb hx => hfix x fun hi + => hYoff _ hi.1 (hbT ▸ mem_image_of_mem j ⟨hb, hx⟩)⟩ + have hcl := hs.isClosedEmbedding + obtain ⟨c₂, hc₂C, hc₂⟩ : ∃ c₂ ∈ C, h c₂ = a₂ := by + have : a₂ ∈ h '' C := himC ▸ ha₂.2 + exact this + -- the part of `G` outside `A` + let Z : Set S := j ⁻¹' discInt Δ + have hZo : IsOpen Z := (hΔ.isOpen_discInt hman).preimage hcj.continuous + have hrZ : ∀ x, h x ∉ Z := fun x hx => by + have : h x ∈ j ⁻¹' (discInt Δ)ᶜ := hrange ▸ mem_range_self x + exact this hx + have hedge : ∀ e ∈ G.E, (∃ y ∈ e, y ∉ Z) → Disjoint e Z := by + rintro e he ⟨y, hye, hyZ⟩ + have hpc : IsPreconnected (j '' e) := he.2.2.1.isConnected.isPreconnected.image _ + hcj.continuous.continuousOn + have hdb : Disjoint (j '' e) (discBd Δ) := by + rw [disjoint_left] + rintro _ ⟨z, hz, rfl⟩ hzb + have hzU := he.2.1 hz + exact hzU.2 (hn ⟨hzb, hzU.1⟩) + rcases inside_or_off hpc hΔ.isClosed (hdb.mono_right (frontier_disc_subset hman hΔ)) with h1 | + h1 + · exact absurd (⟨interior_subset (h1 (mem_image_of_mem j hye)), + disjoint_left.mp hdb (mem_image_of_mem j hye)⟩ : j y ∈ discInt Δ) hyZ + · rw [disjoint_left] + exact fun z hz hzZ => h1 (mem_image_of_mem j hz) hzZ.1 + obtain ⟨G₁, hG₁, hG₁U, hG₁V⟩ := exists_outside_drawing hZo hedge + have hrU : G₁.U ⊆ range h := fun x hx => by + rw [hrange] + rw [hG₁U] at hx + exact hx.2 + have : Nonempty S := ⟨x₀⟩ + obtain ⟨G', hG'U₁, hG'V₁, hmat⟩ := exists_pull_drawing hcl G₁ hrU + have hG'U : G'.U = h ⁻¹' G.U := by + rw [hG'U₁, hG₁U] + ext x + exact ⟨fun hx => hx.1, fun hx => ⟨hx, hrZ x⟩⟩ + have hG'V : G'.V = h ⁻¹' G.V := by + rw [hG'V₁, hG₁V] + ext x + exact ⟨fun hx => hx.1, fun hx => ⟨hx, hrZ x⟩⟩ + have hCA : ∀ x ∈ C, j (h x) ∈ discBd Δ := fun x hx => by + have : h x ∈ j ⁻¹' discBd Δ := himC ▸ mem_image_of_mem h hx + exact this + have hG'p : G'.IsProper := by + rintro x ⟨hb, hxU⟩ + rw [hG'U] at hxU + rw [hG'V] + by_cases hxC : x ∈ C + · exact hn ⟨hCA x hxC, hxU⟩ + · have h1 := (hs.fix x hb hxC).1 + change h x ∈ G.V + rw [h1] + rw [mem_preimage, h1] at hxU + exact hG ⟨hb, hxU⟩ + have hx₀V : x₀ ∈ G'.V := by + rw [hG'V] + change h x₀ ∈ G.V + rw [hh0] + exact ha₁.1 + have hc₂V : c₂ ∈ G'.V := by + rw [hG'V] + change h c₂ ∈ G.V + rw [hc₂] + exact ha₂.1 + have hx₀c₂ : x₀ ≠ c₂ := fun e => hne₁₂ (by rw [← hh0, e, hc₂]) + have hG'C : G'.V ∩ C = {x₀, c₂} := by + exact pulled_vertices_on_shifted_cuff S G C T j Δ a₁ a₂ x₀ hset hx₀C h + hhi hh0 c₂ hc₂C hc₂ G' hG'V hCA hx₀V hc₂V + have hG'C2 : (G'.V ∩ C).ncard = 2 := by + rw [hG'C] + exact ncard_pair hx₀c₂ + have hbl' : IsBoundaryLinked G' := boundaryLinked_of_shift hS hs habc hm hnsS hG'U hG'V hG'p hbl + hC fun F h1 h2 h3 h4 => by + rw [hG'C2] + refine hmaxF F h1 h2 h3 ?_ + rw [disjoint_left] + rintro _ ⟨y, hy, rfl⟩ hi + obtain ⟨z, rfl⟩ := h4 hy + exact hrZ z hi + have hαle : alpha G ≤ alpha G' := alpha_le_of_shift hS hs habc hm hnsS hG'U hG'V + (exists_alphaCandidate hS habc hm hcyl hG'p hC hC₁ hC₁ne.symm) + have hother : ∀ C' ∈ cuffs S, C' ≠ C → G'.V ∩ C' = G.V ∩ C' := fun C' h1 h2 => by + ext x + refine and_congr_left fun hx => ?_ + have hxC : x ∉ C := fun h3 => disjoint_left.mp (cuffs_disjoint h1 hC h2) hx h3 + have h3 := (hs.fix x (hCsub h1 hx) hxC).1 + rw [hG'V, mem_preimage, h3] + have hcount' : {C' ∈ cuffs S | (G'.V ∩ C').ncard ≤ 1}.ncard = g₀ := by + exact one_fewer_small_cuff S g₀ G hcount C hC hsmall G' hG'C2 hother + have hbdsub : G'.V ∩ bd S ⊆ (G'.V ∩ C) ∪ (G.V ∩ bd S) := by + rintro x ⟨hxV, hb⟩ + by_cases hxC : x ∈ C + · exact .inl ⟨hxV, hxC⟩ + · refine .inr ⟨?_, hb⟩ + rw [hG'V, mem_preimage, (hs.fix x hb hxC).1] at hxV + exact hxV + have hbdc' : (G'.V ∩ bd S).ncard ≤ 2 * k - 2 * g₀ := by + have h1 := ncard_le_ncard hbdsub ((G'.finite_V.subset inter_subset_left).union + (G.finite_V.subset inter_subset_left)) + have h2 := ncard_union_le (G'.V ∩ C) (G.V ∩ bd S) + omega + -- the forest with the two new vertices + let B : Set S := ({x₀, c₂} : Set S) \ H.V + have hBf : B.Finite := (toFinite ({x₀, c₂} : Set S)).subset sdiff_subset + have hB : Disjoint B H.U := by + rw [disjoint_left] + rintro x ⟨hx, hxV⟩ hxU + have hxC : x ∈ C := by + rcases hx with rfl | rfl + · exact hx₀C + · exact hc₂C + exact hxV (hHf.1 ⟨hCsub hC hxC, hxU⟩) + have hHf' : IsSurfaceForest (addIsolated H B hBf hB) := hHf.addIsolated hS hBf hB + have hVb' : (addIsolated H B hBf hB).V ∩ bd S = G'.V ∩ bd S := by + exact isolated_vertices_restore_boundary_agreement S G H hVeq C x₀ + (fun s hs => (hsC s hs).1) h Φ hs c₂ G' hG'V hx₀V hc₂V hG'C hBf hB + have hLm : (walkDrawing G W).U ∩ h '' G'.U ⊆ {a₁} := by + rintro x ⟨hx, y, -, rfl⟩ + rcases hLint _ hx with h1 | h1 + · exact h1 + · exact absurd h1 (hrZ y) + have hWb : ∀ v ∈ W.support, v ∈ bd S → v ∈ C := fun v hv hb => by + by_contra hvC + have h1 := hLint v ((mem_walkDrawing_U G W).mpr (.inl hv)) + have h2 : j v ∈ Δ := by + rcases h1 with h3 | h3 + · rw [h3] + exact Surface.discBd_subset Δ ha₁.2 + · exact h3.1 + exact disjoint_left.mp hoffT h2 (hbT ▸ mem_image_of_mem j ⟨hb, hvC⟩) + have hHC : ∀ s ∈ H.V ∩ bd S, s ∈ C → s = x₀ ∧ x₁ = x₀ := fun s hs' hsC' => by + have : s ∈ G.V ∩ bd S := hVeq.symm ▸ hs' + exact hsC s ⟨this.1, hsC'⟩ + have hQ' : x₀ ∈ H.V → ∀ t, Q t ∈ (walkDrawing G W).U := fun hx => by + have : x₀ ∈ G.V ∩ bd S := hVeq.symm ▸ (⟨hx, hCsub hC hx₀C⟩ : x₀ ∈ H.V ∩ bd S) + exact hQL this.1 + refine ⟨S, inferInstance, inferInstance, G', addIsolated H B hBf hB, hS, hm, hbl', hcount', + hbdc', lt_of_lt_of_le hα hαle, hHf', hVb'.symm, ?_⟩ + exact fun hfe => isGFeasible_of_shift hS hs hG hHf hVeq hmat hG₁ hVb' hh0 ⟨hx₀V, + hCsub hC hx₀C⟩ W hLm hLO hWb hHC P Q hP hPQ hQ' hfe + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffTouch.lean b/LeanPool/GraphMinor/GM07/CuffTouch.lean new file mode 100644 index 0000000000..98639842ff --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffTouch.lean @@ -0,0 +1,250 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffCore + +/-! +# An `O`-arc through a vertex of a cuff + +Graph Minors VII, (5.9), page 237: the second half of claim (b). An `O`-arc through a vertex of the +cuff `C` that has few other vertices stays near `C`, and it must go through every vertex of `G` on +`C`, or else it is null-homotopic. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] + +/-- A connected set with a point inside a disc and a point off the disc meets the boundary of the +disc. -/ +theorem exists_mem_discBd_of_preconnected [T2Space T] (hman : ∀ x : T, IsManifoldPoint x) {E Z : + Set T} (hE : IsClosedDisc E) (hZ : IsPreconnected Z) {p q : T} (hp : p ∈ Z) (hpi : p ∈ discInt E) + (hq : q ∈ Z) (hqo : q ∉ E) : ∃ z ∈ Z, z ∈ discBd E := by + by_contra hn + push Not at hn + rcases hE.side hman hZ (disjoint_left.mpr hn) with h1 | h1 + · exact hqo (h1 hq).1 + · exact disjoint_left.mp h1 hp hpi.1 + +/-- An `O`-arc with a point inside a disc and a point off the disc meets the boundary of the disc at +two points at least. -/ +theorem exists_two_crossings [T2Space S] [T2Space T] (hman : ∀ x : T, IsManifoldPoint x) {j : S + → T} (hj : Continuous j) {B : Set S} (hO : IsOArc B) {E : Set T} (hE : IsClosedDisc E) {x y : S} + (hx : x ∈ B) (hy : y ∈ B) (hxi : j x ∈ discInt E) (hyo : j y ∉ E) : ∃ p ∈ B, ∃ p' ∈ B, p ≠ p' + ∧ j p ∈ discBd E ∧ j p' ∈ discBd E := by + have hne : x ≠ y := fun h => hyo (h ▸ hxi.1) + obtain ⟨A₁, A₂, h1, h2, hu, hi⟩ := hO.lines hx hy hne + have hc : ∀ {A : Set S}, IsLineWithEnds A x y → ∃ p ∈ A, j p ∈ discBd E := fun {A} hA => by + obtain ⟨z, ⟨p, hp, rfl⟩, hz⟩ := exists_mem_discBd_of_preconnected hman hE + ((GM12.line_conn hA).image j hj.continuousOn) (mem_image_of_mem j hA.left_mem) hxi + (mem_image_of_mem j hA.right_mem) hyo + exact ⟨p, hp, hz⟩ + obtain ⟨p, hp, hpb⟩ := hc h1 + obtain ⟨p', hp', hpb'⟩ := hc h2 + refine ⟨p, hu ▸ .inl hp, p', hu ▸ .inr hp', fun he => ?_, hpb, hpb'⟩ + have h3 : p ∈ A₁ ∩ A₂ := ⟨hp, he ▸ hp'⟩ + rw [hi] at h3 + rcases h3 with rfl | h3 + · exact hxi.2 hpb + · have h4 : p = y := h3 + subst h4 + exact hyo (Surface.discBd_subset _ hpb) + +variable {G : Drawing S} {C : Set S} {j : S → T} {D : Set T} {r v ks m : ℕ} {Y E₀ Δ' Do : Set T} + {Nk Bo : Drawing S} {R : Fin ks → Drawing S} {x t : Fin ks → S} {Q : ∀ i, GraphWalk G.toGraph + (x i) (t i)} {L : Fin m → Drawing S} {El : Fin m → Set T} + +/-- The first step: an `O`-arc through a vertex of `C` stays in the disc `Y`, since otherwise it +would cross each of the circuits `L i` twice. -/ +theorem IsCuffCore.oArc_in_Y (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) [T2Space S] + [T2Space T] (hman : ∀ x : T, IsManifoldPoint x) (hj : Continuous j) (hji : Injective j) + (hCD : ∀ z ∈ C, j z ∈ D) {ρ : S → S} {A B : Set S} (hnorm : ∀ z ∈ A, ρ z ∈ B → z ∈ G.U + → z ∈ G.V) (hcount : ∀ Z : Set S, Z ⊆ A ∩ G.V → ρ '' Z ⊆ B → Z.ncard < v) + (hid : ∀ z, j z ∈ Do → j z ∉ Δ' → z ∈ G.U → z ∈ A ∧ ρ z = z) (hO : IsOArc B) {x₀ : S} + (hx₀ : x₀ ∈ B) (hx₀C : x₀ ∈ C) : ∀ y ∈ B, j y ∈ Y := by + classical + intro y₀ hy₀ + by_contra hyY + have hcross := fun i => exists_two_crossings hman hj hO (h.layerDisc i) hx₀ hy₀ (h.layerIn i + (hCD x₀ hx₀C)) (fun h1 => hyY (h.layerY i h1)) + choose p hp p' hp' hne hb hb' using hcross + have hprop : ∀ i (z : S), z ∈ B → j z ∈ discBd (El i) → z ∈ A ∩ (L i).V ∧ ρ z = z + := fun i z hz hzb => by + have hzU : z ∈ (L i).U := by + have h1 := hzb + rw [h.layerBd i] at h1 + obtain ⟨z', hz', he⟩ := h1 + exact hji he ▸ hz' + have hzG : z ∈ G.U := (h.layerSub i).U_subset hzU + have hin : j z ∈ Y := h.layerY i (Surface.discBd_subset _ hzb) + obtain ⟨h1, h2⟩ := hid z (h.YO hin) (fun h3 => disjoint_left.mp (h.layerOff i) h3 hzb) hzG + have hV := hnorm z h1 (by rw [h2]; exact hz) hzG + exact ⟨⟨h1, mem_V_of_subdrawing (h.layerSub i) hzU hV⟩, h2⟩ + let f : Fin m × Bool → S := fun q => if q.2 then p q.1 else p' q.1 + have hfp : ∀ q, f q ∈ B ∧ j (f q) ∈ discBd (El q.1) := fun q => by + rcases q with ⟨i, _ | _⟩ + · exact ⟨hp' i, hb' i⟩ + · exact ⟨hp i, hb i⟩ + have hfinj : Injective f := by + rintro ⟨i, b⟩ ⟨i', b'⟩ he + have h1 := (hprop i _ (hfp (i, b)).1 (hfp (i, b)).2).1.2 + have h2 := (hprop i' _ (hfp (i', b')).1 (hfp (i', b')).2).1.2 + by_cases hii : i = i' + · subst hii + rcases b with _ | _ <;> rcases b' with _ | _ + · rfl + · exact absurd he.symm (hne i) + · exact absurd he (hne i) + · rfl + · have h3 : f (i, b) ∈ (L i').V := he ▸ h2 + exact absurd h3 (disjoint_left.mp (h.layerDis i i' hii) h1) + have hZ := hcount (range f) (by + rintro _ ⟨q, rfl⟩ + obtain ⟨h1, -⟩ := hprop q.1 _ (hfp q).1 (hfp q).2 + exact ⟨h1.1, (h.layerSub q.1).1 h1.2⟩) (by + rintro _ ⟨_, ⟨q, rfl⟩, rfl⟩ + rw [(hprop q.1 _ (hfp q).1 (hfp q).2).2] + exact (hfp q).1) + have hcard : (range f).ncard = 2 * m := by + rw [← image_univ, hfinj.injOn.ncard_image, ncard_univ] + simp [Nat.card_eq_fintype_card, mul_comm] + have := h.mv + omega + +/-- The second step, the part of the paper's proof with the paths past `N_i(C)`. If `B` bounds a +disc `Δ_B` of `T` in `Y` around `D`, then `B` goes through every vertex of `G` on `C`. Otherwise the +images of the `v` paths past the piece `N_i(C)` give `v` vertices of `B`. -/ +theorem IsCuffCore.oArc_all_vertices (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) + [T2Space T] (hman : ∀ x : T, IsManifoldPoint x) (hj : Continuous j) + (hji : Injective j) (hCD : ∀ z ∈ C, j z ∈ D) {ρ : S → S} {A B : Set S} (hρ : Continuous ρ) + (htree : ∀ i, ∀ a ∈ (R i).U, ρ a = x i) (hnorm : ∀ z ∈ A, ρ z ∈ B → z ∈ G.U → z ∈ G.V) + (hcount : ∀ Z : Set S, Z ⊆ A ∩ G.V → ρ '' Z ⊆ B → Z.ncard < v) (hab : ∀ z, j z ∈ Do + → j z ∉ E₀ → z ∈ G.U → z ∈ A) (hid : ∀ z, j z ∈ Do → j z ∉ Δ' → z ∈ G.U → z ∈ A ∧ ρ z + = z) (hx : ∀ y ∈ G.V ∩ C, ∃ i, x i = y) {Δ_B : Set T} (hΔ : IsClosedDisc Δ_B) + (hbd : discBd Δ_B = j '' B) (hsub : Δ_B ⊆ Y) (hDB : D ⊆ Δ_B) : G.V ∩ C ⊆ B := by + classical + intro y hy + by_contra hyB + obtain ⟨i, rfl⟩ := hx y hy + obtain ⟨Γ, w, y', hgate, hdis⟩ := h.gates i + have hcross : ∀ a, ∃ z ∈ Γ a, z ≠ w a ∧ ρ z ∈ B := fun a => by + obtain ⟨h1, h2, h3, h4, h5, h6, h7, h8⟩ := hgate a + have hrw : ρ (w a) = x i := htree i _ ((R i).V_subset_U h5) + obtain ⟨hA', hρy⟩ := hid (y' a) h7 (fun h9 => h6 (h.ΔY h9)) (h2 h4) + have hconn : IsPreconnected ((j ∘ ρ) '' Γ a) := h1.image _ (hj.comp hρ).continuousOn + have hint : j (x i) ∈ discInt Δ_B := by + refine ⟨hDB (hCD _ hy.2), fun hb => ?_⟩ + rw [hbd] at hb + obtain ⟨z, hz, he⟩ := hb + exact hyB (hji he ▸ hz) + obtain ⟨_, ⟨z, hz, rfl⟩, hzb⟩ := exists_mem_discBd_of_preconnected hman hΔ hconn + (mem_image_of_mem _ h3 : (j ∘ ρ) (w a) ∈ _) (by simpa [hrw] using hint) + (mem_image_of_mem _ h4 : (j ∘ ρ) (y' a) ∈ _) (by + simp only [comp_apply, hρy] + exact fun h9 => h6 (hsub h9)) + rw [hbd] at hzb + obtain ⟨b, hb, he⟩ := hzb + have hzB : ρ z ∈ B := hji he ▸ hb + refine ⟨z, hz, fun he' => ?_, hzB⟩ + rw [he', hrw] at hzB + exact hyB hzB + choose z hz hzw hzB using hcross + have hzA : ∀ a, z a ∈ A ∩ G.V := fun a => by + obtain ⟨h1, h2, h3, h4, h5, h6, h7, h8⟩ := hgate a + obtain ⟨h9, h10⟩ := h8 (z a) (hz a) (hzw a) + have h11 := hab _ h10 h9 (h2 (hz a)) + exact ⟨h11, hnorm _ h11 (hzB a) (h2 (hz a))⟩ + have hinj : Injective z := fun a a' he => by + by_contra hne + have h1 : z a ∈ G.V ∩ Γ a' := by + rw [he] + exact ⟨(hzA a').2, hz a'⟩ + exact disjoint_left.mp (hdis a a' hne) ⟨(hzA a).2, hz a⟩ h1 + have hZ := hcount (range z) (by + rintro _ ⟨a, rfl⟩ + exact hzA a) (by + rintro _ ⟨_, ⟨a, rfl⟩, rfl⟩ + exact hzB a) + have hcard : (range z).ncard = v := by + rw [← image_univ, hinj.injOn.ncard_image, ncard_univ] + simp [Nat.card_eq_fintype_card] + omega + +/-- **The `O`-arc through a vertex of a cuff.** This is the case `L > 0` of claim (b) of the proof +of (5.9). -/ +theorem IsCuffCore.touch (h : IsCuffCore G C j D r v Y E₀ Δ' Do Nk Bo R x t Q L El) + (hS : IsSurface S) [ConnectedSpace S] (hc : IsCappedCuff C T j D) (hns : ¬ IsSphere T) {ρ : S + → S} {A B : Set S} (hρ : Continuous ρ) (htree : ∀ i, ∀ a ∈ (R i).U, ρ a = x i) + (hnorm : ∀ z ∈ A, ρ z ∈ B → z ∈ G.U → z ∈ G.V) (hcount : ∀ Z : Set S, Z ⊆ A ∩ G.V + → ρ '' Z ⊆ B → Z.ncard < v) (hab : ∀ z, j z ∈ Do → j z ∉ E₀ → z ∈ G.U → z ∈ A) + (hid : ∀ z, j z ∈ Do → j z ∉ Δ' → z ∈ G.U → z ∈ A ∧ ρ z = z) + (hx : ∀ y ∈ G.V ∩ C, ∃ i, x i = y) (hO : IsOArc B) (hne : (B ∩ + (G.V ∩ C)).Nonempty) : IsNullHomotopicOArc B ∨ (IsNullHomotopicOArcInCappedCuff C B + ∧ G.V ∩ C ⊆ B) := by + classical + have hT := hc.isSurface + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have : T2Space T := hT.2.1 + have : ConnectedSpace T := hc.connectedSpace hS + have hman := hT.2.2 + have hcont := hc.isEmbedding.continuous + have hji := hc.isEmbedding.injective + have hCD : ∀ z ∈ C, j z ∈ D := fun z hz => Surface.discBd_subset D (hc.discBd_eq ▸ + mem_image_of_mem j hz) + obtain ⟨x₀, hx₀, hx₀V⟩ := hne + have hin := h.oArc_in_Y hman hcont hji hCD hnorm hcount hid hO hx₀ hx₀V.2 + have hO' : IsOArc (j '' B) := by + obtain ⟨f⟩ := id hO + exact ⟨f.trans (hc.isEmbedding.homeomorphImage B)⟩ + have hplY : IsPlanar (j '' B) := ⟨Y, h.discY, by + rintro _ ⟨z, hz, rfl⟩ + exact hin z hz⟩ + have hnull := (isPlanar_iff_isNullHomotopicOArc_of_isOArc hT hO').mp hplY + obtain ⟨Δ_B, hΔ, hbd⟩ := nullHomotopicOArc_bounds_disc hT hO' hnull + have hsub : Δ_B ⊆ Y := disc_subset_of_bd_subset hT hns h.discY hΔ (by + rw [hbd] + rintro _ ⟨z, hz, rfl⟩ + exact hin z hz) + by_cases hDB : D ⊆ Δ_B + · refine .inr ⟨?_, h.oArc_all_vertices hman hcont hji hCD hρ htree hnorm hcount hab hid hx hΔ hbd + hsub hDB⟩ + have hP : IsPlanarInCappedCuff C B := isPlanarInCappedCuff_of_cap hS hc hplY + refine ⟨hc.cuff, hO, fun S' _ j' D' hcap => ?_⟩ + have hO'' : IsOArc (j' '' B) := by + obtain ⟨f⟩ := id hO + exact ⟨f.trans (hcap.isEmbedding.homeomorphImage B)⟩ + exact (isPlanar_iff_isNullHomotopicOArc_of_isOArc hcap.isSurface hO'').mp (hP.2.2 S' j' D' hcap) + · have hoff : Disjoint (discInt D) (discBd Δ_B) := by + rw [hbd, disjoint_left] + rintro _ h1 ⟨y, -, rfl⟩ + exact not_mem_discInt_cap hc y h1 + have hdis : ∀ z ∈ Δ_B, z ∉ discInt D := fun z hz hi => hDB (disc_subset_of_int_off_bd hman + hc.isClosedDisc hΔ hoff ⟨z, hi, hz⟩) + have hr : Δ_B ⊆ range j := fun z hz => by + by_contra hzr + rcases hc.union_eq.ge (mem_univ z) with h1 | h1 + · exact hzr h1 + · refine hdis z hz ⟨h1, fun hb => hzr ?_⟩ + rw [hc.discBd_eq] at hb + exact image_subset_range _ _ hb + have hdisc := isClosedDisc_preimage_of_subset_range hcont hji hΔ hr + have hpl : IsPlanar B := ⟨_, hdisc, fun z hz => by + have h1 : j z ∈ discBd Δ_B := hbd ▸ mem_image_of_mem j hz + exact Surface.discBd_subset Δ_B h1⟩ + exact .inl ((isPlanar_iff_isNullHomotopicOArc_of_isOArc hS hO).mp hpl) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffTree.lean b/LeanPool/GraphMinor/GM07/CuffTree.lean new file mode 100644 index 0000000000..13fff4bca8 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffTree.lean @@ -0,0 +1,187 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffTouch + +/-! +# The height functions and the trees of a collar + +Graph Minors VII, (5.9), page 235. The heights `f` say how far up each box the collapse starts, and +the ramps `g` say how the top of a box maps to the bottom. The trees are the unions of `N_i(C)` and +`Q_i`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +/-- The height over the top of a box: it is `1` at the points of `Z` on level `1`, and above that +elsewhere. -/ +noncomputable def topHeight (Z : Set (ℝ × ℝ)) (m : ℝ) : ℝ := 1 + 1 / 2 * min 1 (infDist (m, + (1 : ℝ)) Z) + +/-- The ramp from `0` to `1` between `a` and `b`. -/ +noncomputable def clampRamp (a b m : ℝ) : ℝ := max 0 (min 1 ((m - a) / (b - a))) + +theorem topHeight_bounds (Z : Set (ℝ × ℝ)) (m : ℝ) : 1 ≤ topHeight Z m ∧ topHeight Z m ≤ 3 / 2 := by + have h1 : 0 ≤ min 1 (infDist (m, (1 : ℝ)) Z) := le_min zero_le_one infDist_nonneg + have h2 : min 1 (infDist (m, (1 : ℝ)) Z) ≤ 1 := min_le_left _ _ + constructor <;> simp only [topHeight] <;> linarith + +theorem topHeight_le {Z : Set (ℝ × ℝ)} {m w : ℝ} (h : (m, w) ∈ Z) (hw : 1 ≤ w) : topHeight Z m + ≤ 1 + (w - 1) / 2 := by + have h1 : infDist (m, (1 : ℝ)) Z ≤ dist (m, (1 : ℝ)) (m, w) := infDist_le_dist_of_mem h + have h2 : dist (m, (1 : ℝ)) (m, w) = w - 1 := by + rw [Prod.dist_eq, dist_self, Real.dist_eq, abs_sub_comm, abs_of_nonneg (by linarith)] + exact max_eq_right (by linarith) + have h3 := min_le_right 1 (infDist (m, (1 : ℝ)) Z) + simp only [topHeight] + linarith + +theorem topHeight_eq_one {Z : Set (ℝ × ℝ)} (hc : IsClosed Z) (hne : Z.Nonempty) {m : ℝ} + (h : topHeight Z m = 1) : (m, (1 : ℝ)) ∈ Z := by + have h1 : min 1 (infDist (m, (1 : ℝ)) Z) = 0 := by + simp only [topHeight] at h + linarith + have h2 : infDist (m, (1 : ℝ)) Z = 0 := by + rcases min_choice 1 (infDist (m, (1 : ℝ)) Z) with h3 | h3 + · rw [h3] at h1 + exact absurd h1 one_ne_zero + · rwa [h3] at h1 + exact (hc.mem_iff_infDist_zero hne).mpr h2 + +theorem isCollapseData_ramp {Z : Set (ℝ × ℝ)} {a b : ℝ} (ha : 0 ≤ a) (hab : a < b) (hb : b ≤ 1) + (h0 : ((0 : ℝ), (1 : ℝ)) ∈ Z) (h1 : ((1 : ℝ), (1 : ℝ)) ∈ Z) : IsCollapseData (clampRamp a b) + (topHeight Z) := by + have hd : 0 < b - a := by linarith + have hone : ∀ {m : ℝ}, (m, (1 : ℝ)) ∈ Z → topHeight Z m = 1 := fun {m} hm => by + have h2 : infDist (m, (1 : ℝ)) Z = 0 := infDist_zero_of_mem hm + simp [topHeight, h2] + refine ⟨?_, ?_, ?_, ?_, ?_, fun m _ => topHeight_bounds Z m, hone h0, hone h1⟩ + · have : Continuous (clampRamp a b) := by + unfold clampRamp + fun_prop (disch := exact hd.ne') + exact this.continuousOn + · have : Continuous (topHeight Z) := by + unfold topHeight + have h2 : Continuous fun m : ℝ => infDist (m, (1 : ℝ)) Z := (continuous_infDist_pt Z).comp + (by fun_prop) + fun_prop + exact this.continuousOn + · intro m _ m' _ hm + have h2 : (m - a) / (b - a) ≤ (m' - a) / (b - a) := div_le_div_of_nonneg_right + (by linarith) hd.le + exact max_le_max le_rfl (min_le_min le_rfl h2) + · have h2 : (0 - a) / (b - a) ≤ 0 := div_nonpos_of_nonpos_of_nonneg (by linarith) hd.le + exact max_eq_left ((min_le_right _ _).trans h2) + · have h2 : 1 ≤ (1 - a) / (b - a) := by + rw [le_div_iff₀ hd] + linarith + simp [clampRamp, min_eq_left h2] + +theorem clampRamp_low {a b m : ℝ} (hab : a < b) (h : m ≤ a) : clampRamp a b m = 0 := by + have h2 : (m - a) / (b - a) ≤ 0 := div_nonpos_of_nonpos_of_nonneg (by linarith) (by linarith) + exact max_eq_left ((min_le_right _ _).trans h2) + +theorem clampRamp_high {a b m : ℝ} (hab : a < b) (h : b ≤ m) : clampRamp a b m = 1 := by + have h2 : 1 ≤ (m - a) / (b - a) := by + rw [le_div_iff₀ (by linarith)] + linarith + simp [clampRamp, min_eq_left h2] + +theorem clampRamp_strict {a b m m' : ℝ} (hab : a < b) (he : clampRamp a b m = clampRamp a b m') + (h0 : 0 < clampRamp a b m) (h1 : clampRamp a b m < 1) : m = m' := by + have hd : b - a ≠ 0 := by + have : 0 < b - a := by linarith + exact this.ne' + have hval : ∀ {n : ℝ}, 0 < clampRamp a b n → clampRamp a b n < 1 → clampRamp a b n = (n - a) / + (b - a) := fun {n} h2 h3 => by + unfold clampRamp at h2 h3 ⊢ + have h4 : 0 < min 1 ((n - a) / (b - a)) := by + rcases max_choice 0 (min 1 ((n - a) / (b - a))) with h5 | h5 + · rw [h5] at h2 + exact absurd h2 (lt_irrefl _) + · rwa [h5] at h2 + rw [max_eq_right h4.le] at h3 ⊢ + rcases min_choice 1 ((n - a) / (b - a)) with h5 | h5 + · rw [h5] at h3 + exact absurd h3 (lt_irrefl _) + · exact h5 + have h2 := hval h0 h1 + have h3 := hval (he ▸ h0) (he ▸ h1) + rw [h2, h3] at he + have h4 := (div_left_inj₀ hd).mp he + linarith + +variable {S : Type u} [TopologicalSpace S] + +/-- A path contains no `O`-arc. -/ +theorem no_oArc_of_path [T2Space S] {P : Drawing S} {a b : S} + (hP : P.IsPathBetween a b) {J : Set S} (hJ : IsOArc J) (hs : J ⊆ P.U) : False := by + by_cases hab : a = b + · subst hab + obtain ⟨W, hW, hV, hE⟩ := hP + have hW0 : W.support = [a] ∧ W.edges = [] := by + cases W with + | nil _ => exact ⟨rfl, rfl⟩ + | cons _ r => exact absurd r.end_mem_support (List.nodup_cons.mp hW).1 + have hsing : P.U ⊆ {a} := fun x hx => by + by_cases hxV : x ∈ P.V + · rw [hV, mem_ofPred_eq, hW0.1, List.mem_singleton] at hxV + exact hxV + · obtain ⟨e, he, -⟩ := P.exists_edge_of_mem hx hxV + rw [hE, mem_ofPred_eq, hW0.2] at he + simp at he + exact (isOArc_infinite_any hJ) ((finite_singleton a).subset (hs.trans hsing)) + · obtain ⟨f, -, -⟩ := isLine_of_isPathBetween hP hab + exact not_isOArc_of_subset_line ⟨f⟩ hJ hs + +/-- Two paths that meet in just one vertex make a forest. -/ +theorem isForest_of_two_paths [T2Space S] [ConnectedSpace S] {F A B : Drawing S} {a b c d y : S} + (hA : A.IsPathBetween a b) (hB : B.IsPathBetween c d) (hAF : A.IsSubdrawing F) (hFU : F.U + = A.U ∪ B.U) (hy : y ∈ A.V) (hyB : y ∈ B.U) (hmeet : A.U ∩ B.U ⊆ {y}) : IsGraphForest F.toGraph + := by + refine isForest_of_noOArc (H := F) fun X hX hsub => ?_ + have hpre : IsPreconnected (X \ {y}) := by + by_cases hm : y ∈ X + · obtain ⟨Cc, hCc, hCF, hCU⟩ := exists_circuit_of_oArc hX hsub + rw [← hCU] + exact isPreconnected_U_diff hCc (mem_V_of_subdrawing hCF (hCU ▸ hm) (hAF.1 hy)) + · rw [sdiff_singleton_eq_self hm] + exact (isConnected_of_isOArc hX).isPreconnected + have hdj : Disjoint (X \ {y}) (A.U ∩ B.U) := by + rw [disjoint_left] + intro z hz hz' + exact hz.2 (hmeet hz') + rcases GM12.subset_side A.isClosed_U B.isClosed_U hpre (fun z hz => hFU ▸ hsub hz.1) hdj with h1 + | h1 + · refine no_oArc_of_path hA hX fun z hz => ?_ + by_cases hzy : z = y + · exact hzy ▸ A.V_subset_U hy + · exact h1 ⟨hz, hzy⟩ + · refine no_oArc_of_path hB hX fun z hz => ?_ + by_cases hzy : z = y + · exact hzy ▸ hyB + · exact h1 ⟨hz, hzy⟩ + +/-- In a path, any two vertices are joined by a walk. -/ +theorem exists_walk_of_isPathBetween {P : Drawing S} {a b : S} (hP : P.IsPathBetween a b) {y y' : + S} (hy : y ∈ P.V) (hy' : y' ∈ P.V) : Nonempty (GraphWalk P.toGraph y y') := by + obtain ⟨W, -, hV, -⟩ := hP + rw [hV] at hy hy' + obtain ⟨_, rfl, T₁, -⟩ := exists_last_in {y} W ⟨y, hy, rfl⟩ + obtain ⟨_, rfl, T₂, -⟩ := exists_last_in {y'} W ⟨y', hy', rfl⟩ + exact ⟨T₁.append T₂.reverse⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CuffWalk.lean b/LeanPool/GraphMinor/GM07/CuffWalk.lean new file mode 100644 index 0000000000..d94de52971 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CuffWalk.lean @@ -0,0 +1,450 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.FlatMinimal +public import LeanPool.GraphMinor.GM17.RegionFrontier +public import LeanPool.GraphMinor.GM17.PasteCuff +public import LeanPool.GraphMinor.GM19.FragmentRegion + +/-! +# From a flat complement to a path between cuffs + +This file is the end of the topological part of the proof of (4.3) of Graph Minors VII (page 223). +Let `Y` be connected, flat and such that closed discs with boundary in `Y` lie in `Y`. Paste a +closed disc onto +each cuff. By (4.2) the set `Y` is an open disc in the new surface, and so its frontier is +connected. It follows that `U(K) ∪ bd(Σ)` is connected, and hence `K` has a path between two cuffs +(`exists_walk_between_cuffs`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] + +/-- The complement of an open disc in a connected compact surface does not split into two disjoint +nonempty closed sets. Otherwise the connected frontier of the disc lies in one of them, and the +other one is open. -/ +theorem not_split_of_isOpenDisc {T : Type} [TopologicalSpace T] [T2Space T] [CompactSpace T] + [ConnectedSpace T] {O P Q : Set T} (hO : IsOpenDisc O) (hP : IsClosed P) (hQ : IsClosed Q) + (hd : Disjoint P Q) + (hu : Oᶜ = P ∪ Q) (hPn : P.Nonempty) (hQn : Q.Nonempty) : False := by + have hF := GM17.isPreconnected_frontier hO + have hFs : closure O \ O ⊆ P ∪ Q := fun z hz => hu ▸ hz.2 + have haux : ∀ {P Q : Set T}, IsClosed P → IsClosed Q → Disjoint P Q → Oᶜ = P ∪ Q → P.Nonempty + → Q.Nonempty → closure O \ O ⊆ P → False := fun {P Q} hP hQ hd hu hPn hQn hs => by + have hQO : Disjoint Q (closure O) := disjoint_left.mpr fun z hz hc => by + have h1 : z ∉ O := by + have : z ∈ Oᶜ := hu ▸ .inr hz + exact this + exact disjoint_left.mp hd (hs ⟨hc, h1⟩) hz + have hQo : IsOpen Q := by + have e : Q = (closure O ∪ P)ᶜ := by + ext z + constructor + · rintro hz (h | h) + · exact disjoint_left.mp hQO hz h + · exact disjoint_left.mp hd h hz + · intro hz + have h1 : z ∉ O := fun h => hz (.inl (subset_closure h)) + have : z ∈ Oᶜ := h1 + rw [hu] at this + exact this.resolve_left fun h => hz (.inr h) + rw [e] + exact (isClosed_closure.union hP).isOpen_compl + rcases isClopen_iff.mp ⟨hQ, hQo⟩ with h | h + · exact hQn.ne_empty h + · obtain ⟨z, hz⟩ := hPn + exact disjoint_left.mp hd hz (h ▸ mem_univ z) + by_cases h1 : closure O \ O ⊆ P + · exact haux hP hQ hd hu hPn hQn h1 + by_cases h2 : closure O \ O ⊆ Q + · exact haux hQ hP hd.symm (by rw [union_comm]; exact hu) hQn hPn h2 + obtain ⟨a, ha, haP⟩ := not_subset.mp h1 + obtain ⟨b, hb, hbQ⟩ := not_subset.mp h2 + have haQ : a ∈ Q := (hFs ha).resolve_left haP + have hbP : b ∈ P := (hFs hb).resolve_right hbQ + obtain ⟨z, -, hz⟩ := isPreconnected_closed_iff.mp hF P Q hP hQ hFs ⟨b, hb, hbP⟩ ⟨a, ha, haQ⟩ + exact disjoint_left.mp hd hz.1 hz.2 + +variable [T1Space S] + +omit [T1Space S] in +theorem edge_eq_of_mem {K : Drawing S} {e f : Set S} (he : e ∈ K.E) (hf : f ∈ K.E) {z : S} + (hze : z ∈ e) (hzf : z ∈ f) : e = f := + arcComponent_eq he hf hze hzf + +/-- The vertices joined by a walk of `K` to a vertex on `C`. -/ +def reachFrom (K : Drawing S) (C : Set S) : Set S := {y | ∃ a ∈ K.V ∩ C, Nonempty + (GraphWalk K.toGraph a y)} + +omit [T1Space S] in +theorem reachFrom_subset (K : Drawing S) (C : Set S) : reachFrom K C ⊆ K.V := by + rintro y ⟨a, -, ⟨W⟩⟩ + exact W.mem_vertexSet_of_mem_support W.end_mem_support + +omit [T1Space S] in +theorem reachFrom_step {K : Drawing S} {C : Set S} {e : Set S} (he : e ∈ K.E) {y z : S} + (hy : y ∈ reachFrom K C) (hye : y ∈ closure e) (hz : z ∈ closure e ∩ K.V) : + z ∈ reachFrom K C := by + have hyV := reachFrom_subset K C hy + by_cases hyz : y = z + · exact hyz ▸ hy + obtain ⟨a, ha, ⟨W⟩⟩ := hy + refine ⟨a, ha, ⟨W.append (.cons (e := e) ⟨he, hyV, hz.2, ?_⟩ (.nil hz.2))⟩⟩ + rcases K.edge_cond e he with ⟨u, v, -, hcap, -⟩ | ⟨u, hcap, -⟩ + · have h1 : y ∈ ({u, v} : Set S) := hcap ▸ ⟨hye, hyV⟩ + have h2 : z ∈ ({u, v} : Set S) := hcap ▸ hz + rw [hcap] + rcases h1 with rfl | h1 <;> rcases h2 with rfl | h2 + · exact (hyz rfl).elim + · obtain rfl : z = v := h2 + rfl + · obtain rfl : y = v := h1 + exact pair_comm _ _ + · obtain rfl : y = v := h1 + obtain rfl : z = y := h2 + exact (hyz rfl).elim + · have h1 : y ∈ ({u} : Set S) := hcap ▸ ⟨hye, hyV⟩ + have h2 : z ∈ ({u} : Set S) := hcap ▸ hz + exact (hyz (h1.trans h2.symm)).elim + +private theorem cuff_reachability_sides_disjoint + {S : Type} + [TopologicalSpace S] + {C : Set S} + (hC : C ∈ cuffs S) + {K : Drawing S} + (hsubc : ∀ D ∈ cuffs S, D ⊆ bd S) : + let EP : Set (Set S) := {e | e ∈ K.E ∧ (closure e ∩ reachFrom K C).Nonempty} + let EQ : Set (Set S) := {e | e ∈ K.E ∧ closure e ∩ reachFrom K C = ∅} + let P : Set S := C ∪ reachFrom K C ∪ ⋃ e ∈ EP, closure e + let Q : Set S := bd S \ C ∪ K.V \ reachFrom K C ∪ ⋃ e ∈ EQ, closure e + (∀ z ∈ P, z ∈ K.V → z ∈ reachFrom K C) → + (∀ z ∈ P, z ∈ bd S → z ∈ C) → + (∀ z ∈ Q, z ∈ K.V → z ∉ reachFrom K C) → + (∀ z ∈ Q, z ∈ bd S → z ∉ C) → + Disjoint P Q := by + intro EP EQ P Q ha hb hc hd + refine disjoint_left.mpr ?_ + intro z hzP hzQ + by_cases hv : z ∈ K.V + · exact hc z hzQ hv (ha z hzP hv) + by_cases hbz : z ∈ bd S + · exact hd z hzQ hbz (hb z hzP hbz) + obtain ⟨e, he, hze⟩ : ∃ e ∈ EP, z ∈ closure e := by + rcases hzP with (h | h) | h + · exact (hbz (hsubc C hC h)).elim + · exact (hv (reachFrom_subset K C h)).elim + · obtain ⟨e, he, hz⟩ := mem_iUnion₂.mp h + exact ⟨e, he, hz⟩ + obtain ⟨f, hf, hzf⟩ : ∃ f ∈ EQ, z ∈ closure f := by + rcases hzQ with (h | h) | h + · exact (hbz h.1).elim + · exact (hv h.1).elim + · obtain ⟨e, he, hz⟩ := mem_iUnion₂.mp h + exact ⟨e, he, hz⟩ + have h1 : z ∈ e := by + rw [← K.closure_diff_V he.1] + exact ⟨hze, hv⟩ + have h2 : z ∈ f := by + rw [← K.closure_diff_V hf.1] + exact ⟨hzf, hv⟩ + have : e = f := edge_eq_of_mem he.1 hf.1 h1 h2 + obtain ⟨y, hy⟩ := he.2 + have h3 : y ∈ closure f ∩ reachFrom K C := this ▸ hy + rw [hf.2] at h3 + exact h3 + +private theorem capped_cuff_sides_disjoint + {S : Type} + [TopologicalSpace S] + {C : Set S} + (P : Set S) + (Q : Set S) + (hb : ∀ z ∈ P, z ∈ bd S → z ∈ C) + (hd : ∀ z ∈ Q, z ∈ bd S → z ∉ C) + (hPQ : Disjoint P Q) + (T : Type) + [TopologicalSpace T] + (j : S → T) + (hj : IsClosedEmbedding j) + (𝓓 : Set (Set T)) + (h𝓓d : ∀ D ∈ 𝓓, ∀ D' ∈ 𝓓, D ≠ D' → Disjoint D D') + (htr : ∀ D ∈ 𝓓, j ⁻¹' D ⊆ bd S) + (htrC : ∀ D ∈ 𝓓, (j ⁻¹' D ∩ C).Nonempty → j ⁻¹' D ⊆ C) : + let DP : Set (Set T) := {D | D ∈ 𝓓 ∧ (j ⁻¹' D ∩ C).Nonempty} + let DQ : Set (Set T) := {D | D ∈ 𝓓 ∧ ¬(j ⁻¹' D ∩ C).Nonempty} + Disjoint (j '' P ∪ ⋃₀ DP) (j '' Q ∪ ⋃₀ DQ) := by + intro DP DQ + rw [disjoint_left] + rintro z (⟨y, hy, rfl⟩ | ⟨D, hD, hz⟩) (⟨y', hy', e⟩ | ⟨D', hD', hz'⟩) + · obtain rfl := hj.injective e + exact disjoint_left.mp hPQ hy hy' + · have hyb : y ∈ bd S := htr D' hD'.1 hz' + exact hD'.2 ⟨y, hz', hb y hy hyb⟩ + · subst e + have hyb : y' ∈ bd S := htr D hD.1 hz + exact hd y' hy' hyb (htrC D hD.1 hD.2 hz) + · by_cases heq : D = D' + · subst heq + exact hD'.2 hD.2 + · exact disjoint_left.mp (h𝓓d D hD.1 D' hD'.1 heq) hz hz' + +/-- **The end of the proof of (4.3)** (Graph Minors VII, page 223). -/ +theorem exists_walk_between_cuffs (hS : IsSurface S) [ConnectedSpace S] {C C' : Set S} + (hC : C ∈ cuffs S) (hC' : C' ∈ cuffs S) (hne : C ≠ C') {K : Drawing S} (hK : K.IsProper) + (hY : IsPreconnected (offSet K)) (hYn : (offSet K).Nonempty) (hflat : IsFlat (offSet K)) + (hdisc : ∀ Δ : Set S, IsClosedDisc Δ → discBd Δ ⊆ offSet K → Δ ⊆ offSet K) : + ∃ a ∈ K.V ∩ C, ∃ b ∈ K.V ∩ (bd S \ C), Nonempty (GraphWalk K.toGraph a b) := by + classical + have ht2 : T2Space S := hS.2.1 + have hbc : IsClosed (bd S) := (cuff_statement.{0} S hS).1 + have hfinc : (cuffs S).Finite := (cuff_statement.{0} S hS).2.1 + have hclc : ∀ D ∈ cuffs S, IsClosed D := fun D hD => ((cuff_statement.{0} S hS).2.2 D + hD).isCompact.isClosed + have hsubc : ∀ D ∈ cuffs S, D ⊆ bd S := fun D hD => by + obtain ⟨x, -, rfl⟩ := hD + exact connectedComponentIn_subset _ _ + have hbdC : IsClosed (bd S \ C) := by + have e : bd S \ C = ⋃ D ∈ cuffs S \ {C}, D := by + ext z + constructor + · intro hz + refine mem_iUnion₂.mpr ⟨connectedComponentIn (bd S) z, ⟨⟨z, hz.1, rfl⟩, fun h => ?_⟩, + mem_connectedComponentIn hz.1⟩ + exact hz.2 (mem_singleton_iff.mp h ▸ mem_connectedComponentIn hz.1) + · intro hz + obtain ⟨D, hD, hzD⟩ := mem_iUnion₂.mp hz + exact ⟨hsubc D hD.1 hzD, fun h => hD.2 (GM17.cuffs_disjoint_eq hD.1 hC hzD h)⟩ + rw [e] + exact (hfinc.subset sdiff_subset).isClosed_biUnion fun D hD => hclc D hD.1 + by_contra hno + have hnobd : ∀ y ∈ reachFrom K C, y ∈ bd S → y ∈ C := fun y hy hb => by + by_contra hyC + obtain ⟨a, ha, hW⟩ := hy + exact hno ⟨a, ha, y, ⟨reachFrom_subset K C ⟨a, ha, hW⟩, hb, hyC⟩, hW⟩ + have hVC : ∀ z ∈ K.V, z ∈ C → z ∈ reachFrom K C := fun z hz hzC => ⟨z, ⟨hz, hzC⟩, ⟨.nil hz⟩⟩ + have hbU : ∀ z ∈ K.U, z ∈ bd S → z ∈ K.V := fun z h1 h2 => hK ⟨h2, h1⟩ + let EP : Set (Set S) := {e | e ∈ K.E ∧ (closure e ∩ reachFrom K C).Nonempty} + let EQ : Set (Set S) := {e | e ∈ K.E ∧ closure e ∩ reachFrom K C = ∅} + let P : Set S := C ∪ reachFrom K C ∪ ⋃ e ∈ EP, closure e + let Q : Set S := (bd S \ C) ∪ (K.V \ reachFrom K C) ∪ ⋃ e ∈ EQ, closure e + have hfinE : K.E.Finite := K.finite_edges + have hfinV : K.V.Finite := K.finite_V + have hEPfin : EP.Finite := hfinE.subset fun _ he => he.1 + have hEQfin : EQ.Finite := hfinE.subset fun _ he => he.1 + have hPc : IsClosed P := ((hclc C hC).union (hfinV.subset (reachFrom_subset K C)).isClosed).union + (hEPfin.isClosed_biUnion fun _ _ => isClosed_closure) + have hQc : IsClosed Q := (hbdC.union (hfinV.subset sdiff_subset).isClosed).union + (hEQfin.isClosed_biUnion fun _ _ => isClosed_closure) + have ha : ∀ z ∈ P, z ∈ K.V → z ∈ reachFrom K C := by + rintro z ((h | h) | h) hv + · exact hVC z hv h + · exact h + · obtain ⟨e, he, hz⟩ := mem_iUnion₂.mp h + obtain ⟨y, hy, hy'⟩ := he.2 + exact reachFrom_step he.1 hy' hy ⟨hz, hv⟩ + have hb : ∀ z ∈ P, z ∈ bd S → z ∈ C := fun z hz hbz => by + rcases hz with (h | h) | h + · exact h + · exact hnobd z h hbz + · obtain ⟨e, he, hz⟩ := mem_iUnion₂.mp h + exact hnobd z (ha z (.inr (mem_iUnion₂.mpr ⟨e, he, hz⟩)) (hbU z + (K.closure_subset_U he.1 hz) hbz)) hbz + have hc : ∀ z ∈ Q, z ∈ K.V → z ∉ reachFrom K C := fun z hz hv hr => by + rcases hz with (h | h) | h + · exact h.2 (hnobd z hr h.1) + · exact h.2 hr + · obtain ⟨e, he, hz⟩ := mem_iUnion₂.mp h + have : z ∈ closure e ∩ reachFrom K C := ⟨hz, hr⟩ + rw [he.2] at this + exact this + have hd : ∀ z ∈ Q, z ∈ bd S → z ∉ C := fun z hz hbz hzC => by + have hzU : z ∈ K.V → False := fun hv => hc z hz hv (hVC z hv hzC) + rcases hz with (h | h) | h + · exact h.2 hzC + · exact hzU h.1 + · obtain ⟨e, he, hz⟩ := mem_iUnion₂.mp h + exact hzU (hbU z (K.closure_subset_U he.1 hz) hbz) + have hPQ : Disjoint P Q := by + exact cuff_reachability_sides_disjoint (S := S) (C := C) hC (K := K) hsubc ha hb hc + hd + have hPs : P ⊆ K.U ∪ bd S := by + rintro z ((h | h) | h) + · exact .inr (hsubc C hC h) + · exact .inl (K.V_subset_U (reachFrom_subset K C h)) + · obtain ⟨e, he, hz⟩ := mem_iUnion₂.mp h + exact .inl (K.closure_subset_U he.1 hz) + have hQs : Q ⊆ K.U ∪ bd S := by + rintro z ((h | h) | h) + · exact .inr h.1 + · exact .inl (K.V_subset_U h.1) + · obtain ⟨e, he, hz⟩ := mem_iUnion₂.mp h + exact .inl (K.closure_subset_U he.1 hz) + have hcov : K.U ∪ bd S ⊆ P ∪ Q := by + rintro z (h | h) + · rw [K.U_eq] at h + rcases h with h | h + · by_cases hr : z ∈ reachFrom K C + · exact .inl (.inl (.inr hr)) + · exact .inr (.inl (.inr ⟨h, hr⟩)) + · obtain ⟨e, he, hz⟩ := mem_iUnion₂.mp h + by_cases hr : (closure e ∩ reachFrom K C).Nonempty + · exact .inl (.inr (mem_iUnion₂.mpr ⟨e, ⟨he, hr⟩, hz⟩)) + · exact .inr (.inr (mem_iUnion₂.mpr ⟨e, ⟨he, not_nonempty_iff_eq_empty.mp hr⟩, hz⟩)) + · by_cases hzC : z ∈ C + · exact .inl (.inl (.inl hzC)) + · exact .inr (.inl (.inl ⟨h, hzC⟩)) + -- Now paste discs onto the cuffs. + obtain ⟨T, tT, j, Kc, hT, hj, hKc, hu, hi, hcon, 𝓓, h𝓓f, h𝓓u, h𝓓, h𝓓d⟩ := exists_capAll_discs S hS + have hconT : ConnectedSpace T := hcon inferInstance + have ht2T : T2Space T := hT.2.1 + have hcT : CompactSpace T := hT.1 + have hUb : IsClosed (K.U ∪ bd S) := K.isClosed_U.union hbc + let O : Set T := j '' offSet K + have hOc : Oᶜ = j '' (K.U ∪ bd S) ∪ Kc := by + ext z + constructor + · intro hz + by_cases hzK : z ∈ Kc + · exact .inr hzK + · rcases (hu.symm ▸ mem_univ z : z ∈ range j ∪ Kc) with ⟨y, rfl⟩ | h + · refine .inl ⟨y, ?_, rfl⟩ + by_contra hy + exact hz ⟨y, hy, rfl⟩ + · exact (hzK h).elim + · rintro (⟨y, hy, rfl⟩ | h) ⟨y', hy', e⟩ + · obtain rfl := hj.injective e + exact hy' hy + · have : j y' ∈ range j ∩ Kc := ⟨⟨y', rfl⟩, e ▸ h⟩ + rw [hi] at this + obtain ⟨y'', hy'', e'⟩ := this + obtain rfl := hj.injective e' + exact hy' (.inr hy'') + have hOo : IsOpen O := by + have : O = (j '' (K.U ∪ bd S) ∪ Kc)ᶜ := by rw [← hOc, compl_compl] + rw [this] + exact ((hj.isClosedMap _ hUb).union hKc).isOpen_compl + have hOconn : IsConnected O := ⟨hYn.image j, hY.image j hj.continuous.continuousOn⟩ + have hdiscT : ∀ F : Set T, F ⊆ O → IsOArc F → ∃ Δ : Set T, Δ ⊆ O ∧ IsClosedDisc Δ ∧ discBd Δ = F + := fun F hF hFO => by + have hFr : F ⊆ range j := hF.trans (image_subset_range _ _) + have hF₀ : IsOArc (j ⁻¹' F) := IsOArc.pull_of_embedding hj.isEmbedding hFO hFr + have hF₀Y : j ⁻¹' F ⊆ offSet K := fun z hz => by + obtain ⟨y, hy, e⟩ := hF hz + exact hj.injective e ▸ hy + obtain ⟨Δ, hΔ, hΔb⟩ := nullHomotopicOArc_bounds_disc hS hF₀ (isNullHomotopicOArc_of_isFlat + hflat hF₀Y hF₀) + have him := hΔ.image_injOn hj.continuous.continuousOn hj.injective.injOn + refine ⟨j '' Δ, image_mono (hdisc Δ hΔ (hΔb ▸ hF₀Y)), him.1, ?_⟩ + rw [him.2, hΔb, image_preimage_eq_of_subset hFr] + have hOdisc : IsOpenDisc O := by + rcases open_disc T O hT hconT hOconn hOo hdiscT with ⟨-, h⟩ | h + · exfalso + obtain ⟨c, hc'⟩ : C.Nonempty := by + obtain ⟨x, hx, rfl⟩ := hC + exact ⟨x, mem_connectedComponentIn hx⟩ + obtain ⟨y, hy, e⟩ := (h ▸ mem_univ (j c) : j c ∈ O) + obtain rfl := hj.injective e + exact (mem_offSet.mp hy).2 (hsubc C hC hc') + · exact h + -- Each disc meets the surface inside one cuff, or misses `C`. + have htr : ∀ D ∈ 𝓓, j ⁻¹' D ⊆ bd S := fun D hD z hz => by + have h1 : j z ∈ range j ∩ Kc := ⟨⟨z, rfl⟩, h𝓓u ▸ mem_sUnion_of_mem hz hD⟩ + rw [hi] at h1 + obtain ⟨y, hy, e⟩ := h1 + exact hj.injective e ▸ hy + have htrp : ∀ D ∈ 𝓓, IsPreconnected (j ⁻¹' D) := fun D hD => by + rw [← hj.isInducing.isPreconnected_image, image_preimage_eq_inter_range] + exact (h𝓓 D hD).2.1 + have htrC : ∀ D ∈ 𝓓, (j ⁻¹' D ∩ C).Nonempty → j ⁻¹' D ⊆ C := fun D hD ⟨x, hx, hxC⟩ => by + obtain ⟨c, hc', rfl⟩ := hC + rw [connectedComponentIn_eq hxC] + exact (htrp D hD).subset_connectedComponentIn hx (htr D hD) + let DP : Set (Set T) := {D | D ∈ 𝓓 ∧ (j ⁻¹' D ∩ C).Nonempty} + let DQ : Set (Set T) := {D | D ∈ 𝓓 ∧ ¬ (j ⁻¹' D ∩ C).Nonempty} + have hclosedD : ∀ {A : Set (Set T)}, A ⊆ 𝓓 → IsClosed (⋃₀ A) := fun {A} hA => + (h𝓓f.subset hA).isClosed_sUnion fun D hD => (h𝓓 D (hA hD)).1.isCompact.isClosed + have hdisjoint : Disjoint (j '' P ∪ ⋃₀ DP) (j '' Q ∪ ⋃₀ DQ) := by + exact capped_cuff_sides_disjoint (S := S) (C := C) P Q hb hd hPQ T j hj 𝓓 h𝓓d htr htrC + have hunion : Oᶜ = (j '' P ∪ ⋃₀ DP) ∪ (j '' Q ∪ ⋃₀ DQ) := by + rw [hOc] + apply Subset.antisymm + · rintro z (⟨y, hy, rfl⟩ | h) + · rcases hcov hy with h | h + · exact .inl (.inl ⟨y, h, rfl⟩) + · exact .inr (.inl ⟨y, h, rfl⟩) + · rw [← h𝓓u] at h + obtain ⟨D, hD, hz⟩ := h + by_cases hn : (j ⁻¹' D ∩ C).Nonempty + · exact .inl (.inr ⟨D, ⟨hD, hn⟩, hz⟩) + · exact .inr (.inr ⟨D, ⟨hD, hn⟩, hz⟩) + · rintro z ((⟨y, hy, rfl⟩ | ⟨D, hD, hz⟩) | (⟨y, hy, rfl⟩ | ⟨D, hD, hz⟩)) + · exact .inl ⟨y, hPs hy, rfl⟩ + · exact .inr (h𝓓u ▸ mem_sUnion_of_mem hz hD.1) + · exact .inl ⟨y, hQs hy, rfl⟩ + · exact .inr (h𝓓u ▸ mem_sUnion_of_mem hz hD.1) + obtain ⟨c, hc'⟩ : C.Nonempty := by + obtain ⟨x, hx, rfl⟩ := hC + exact ⟨x, mem_connectedComponentIn hx⟩ + obtain ⟨c₂, hc₂⟩ : C'.Nonempty := by + obtain ⟨x, hx, rfl⟩ := hC' + exact ⟨x, mem_connectedComponentIn hx⟩ + have hDP : IsClosed (⋃₀ DP) := hclosedD (A := DP) fun _ hD => hD.1 + have hDQ : IsClosed (⋃₀ DQ) := hclosedD (A := DQ) fun _ hD => hD.1 + refine not_split_of_isOpenDisc hOdisc ((hj.isClosedMap _ hPc).union hDP) + ((hj.isClosedMap _ hQc).union hDQ) hdisjoint hunion + ⟨j c, .inl ⟨c, .inl (.inl hc'), rfl⟩⟩ ?_ + exact ⟨j c₂, .inl ⟨c₂, .inl (.inl ⟨hsubc C' hC' hc₂, fun h => hne (GM17.cuffs_disjoint_eq hC hC' + h hc₂)⟩), rfl⟩⟩ + +/-- The set off a proper graph is not empty. -/ +theorem offSet_nonempty (hS : IsSurface S) [ConnectedSpace S] {C : Set S} {C' : Set S} + (hC : C ∈ cuffs S) (hC' : C' ∈ cuffs S) (hne : C ≠ C') {K : Drawing S} (hK : K.IsProper) : + (offSet K).Nonempty := by + classical + have ht2 : T2Space S := hS.2.1 + have hfin : K.V.Finite := K.finite_V + obtain ⟨p, hp⟩ : ((bd S)ᶜ \ K.V).Nonempty := by + by_contra hem + have hsub : (bd S)ᶜ ⊆ K.V := fun z hz => by + by_contra hzV + exact hem ⟨z, hz, hzV⟩ + have hu : (univ : Set S) ⊆ K.V := by + rw [← (GM19.dense_interior' hS).closure_eq] + exact closure_minimal hsub hfin.isClosed + obtain ⟨a, ha⟩ : C.Nonempty := by + obtain ⟨x, hx, rfl⟩ := hC + exact ⟨x, mem_connectedComponentIn hx⟩ + obtain ⟨b, hb⟩ : C'.Nonempty := by + obtain ⟨x, hx, rfl⟩ := hC' + exact ⟨x, mem_connectedComponentIn hx⟩ + have hab : a ≠ b := fun h => hne (GM17.cuffs_disjoint_eq hC hC' ha (h ▸ hb)) + have hinf : (univ : Set S).Infinite := isPreconnected_univ.infinite_of_nontrivial ⟨a, trivial, + b, trivial, hab⟩ + exact hinf (hfin.subset hu) + by_cases hpU : p ∈ K.U + · obtain ⟨e, he, hpe⟩ : ∃ e ∈ K.E, p ∈ e := by + rw [K.U_eq] at hpU + rcases hpU with h | h + · exact (hp.2 h).elim + · obtain ⟨e, he, hpe⟩ := mem_iUnion₂.mp h + refine ⟨e, he, ?_⟩ + rw [← K.closure_diff_V he] + exact ⟨hpe, hp.2⟩ + obtain ⟨-, A, -, -, -, -, hA, -, -, -, -, hAp, -, -, -, -⟩ := exists_edge_sides hS hK he hpe + exact hAp.nonempty.mono hA + · exact ⟨p, mem_offSet.mpr ⟨hpU, hp.1⟩⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CutBounds.lean b/LeanPool/GraphMinor/GM07/CutBounds.lean new file mode 100644 index 0000000000..6a0f906765 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CutBounds.lean @@ -0,0 +1,658 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CutEdge +import LeanPool.GraphMinor.GM19.Section6a + +/-! +# Graph Minors VII, (7.1) and (7.2) + +We prove that cutting along a good edge keeps `α` large (`cut_alpha_bound`) and keeps the graph +boundary-linked +(`cut_boundaryLinked`). + +The tool is `IsCapPair`. Let `C₀` be a cuff of `S`. Paste a disc on `C₀` to get `T`, and paste a +disc on the cuff of `Y` over `C₀` +to get `T'`. The cutting map extends to `Ψ : T' → T`. It is one to one away from `e`, so closed +discs of `T` that miss `e` lift +to closed discs of `T'`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +local notation "𝕀" => unitInterval + +variable {S Y T T' : Type u} [TopologicalSpace S] [TopologicalSpace Y] [TopologicalSpace T] + [TopologicalSpace T'] + +/-- A disc can be pasted on each cuff. -/ +theorem exists_cappedCuff (hS : IsSurface S) {C : Set S} (hC : IsCuff C) : + ∃ (T : Type u) (_ : TopologicalSpace T) (j : S → T) (D : Set T), IsCappedCuff C T j D ∧ bd T + = j '' (bd S \ C) := by + obtain ⟨T, t, j, D, h1, h2, h3, h4, h5, h6, h7⟩ := paste_disc.{u} S C hS hC + exact ⟨T, t, j, D, ⟨hC, h1, h2.isEmbedding, h3, h6, h4, h5⟩, h7⟩ + +/-- A map keeps null-homotopy. -/ +theorem null_comp {Z : Set Y} {c : C(Circle, Y)} (h : ClosedCurveIsNullHomotopicIn Z c) {m : Y → T} + (hm : Continuous m) + (hc : Continuous fun w => m (c w)) : ClosedCurveIsNullHomotopicIn univ ⟨fun w => m (c w), hc⟩ + := by + obtain ⟨p, -, ψ, -, h2, h3⟩ := h + refine ⟨m p, mem_univ _, ⟨fun q => m (ψ q), hm.comp ψ.continuous⟩, fun _ => mem_univ _, + fun x => ?_, fun x => ?_⟩ + · simp [h2] + · simp [h3] + +/-- A curve in a closed disc is null-homotopic. -/ +theorem null_of_disc {f : Circle → Y} (hf : Continuous f) {Δ : Set Y} (hΔ : IsClosedDisc Δ) + (h : ∀ w, f w ∈ Δ) : + ClosedCurveIsNullHomotopicIn Δ ⟨f, hf⟩ := + hΔ.isSimplyConnectedSet.2 ⟨f, hf⟩ (by + rintro _ ⟨w, rfl⟩ + exact h w) + +/-- A closed disc goes to a closed disc under a map one to one on it. -/ +theorem isClosedDisc_image_of_injOn {A B : Type*} [TopologicalSpace A] [TopologicalSpace B] + [T2Space B] {Δ : Set A} + (hΔ : IsClosedDisc Δ) {f : A → B} (hf : Continuous f) (hi : InjOn f Δ) : + IsClosedDisc (f '' Δ) ∧ discBd (f '' Δ) = f '' discBd Δ := by + have : Nonempty A := by + obtain ⟨h⟩ := id hΔ + exact ⟨(h ⟨0, mem_closedBall_self zero_le_one⟩).1⟩ + obtain ⟨g, hgc, hgl⟩ := exists_inv_of_compactOn hΔ.isCompact hf.continuousOn hi + exact hΔ.image hf.continuousOn hgc hgl + +/-- A surface with a model is connected. -/ +theorem connectedSpace_of_model {T : Type u} [TopologicalSpace T] {a b c : ℕ} (h : Nonempty + (T ≃ₜ SurfaceModel a b c)) : + ConnectedSpace T := by + obtain ⟨e⟩ := h + have := (modelCriterion.1 a b c).2 + exact e.symm.surjective.connectedSpace e.symm.continuous + +/-- Pasting a disc on a surface with `3a + 3b + c ≥ 3` does not give a sphere. -/ +theorem not_isSphere_cap (hS : IsSurface S) {a b c : ℕ} (h3 : 3 ≤ 3 * a + 3 * b + c) (h : Nonempty + (S ≃ₜ SurfaceModel a b c)) + {C : Set S} {j : S → T} {D : Set T} (hc : IsCappedCuff C T j D) : ¬ IsSphere T := by + have : CompactSpace S := hS.1 + have : T2Space T := hc.isSurface.2.1 + obtain ⟨e⟩ := h + obtain ⟨h0, hm⟩ := paste_model hS hc.cuff hc.isSurface + (hc.isEmbedding.continuous.isClosedEmbedding hc.isEmbedding.injective) + hc.isClosedDisc hc.union_eq hc.inter_eq hc.discBd_eq e + refine not_isSphere_of_model hm ?_ + omega + +/-- A one to one map of a closed set onto a solid set: the set is solid too. -/ +theorem isSolid_preimage_of_injOn [CompactSpace Y] [T2Space S] {f : Y → S} (hf : Continuous f) + (hs : Function.Surjective f) + {Z : Set S} (hZ : IsSolid Z) (hi : InjOn f (f ⁻¹' Z)) : IsSolid (f ⁻¹' Z) := by + have hcl : ∀ K : Set Y, IsClosed K → IsClosed (f '' K) := fun K hK => + (hK.isCompact.image hf).isClosed + have hZc : IsClosed (f ⁻¹' Z) := hZ.2.preimage hf + refine ⟨?_, hZc⟩ + intro x hx U hU hxU + let W : Set S := (f '' (f ⁻¹' Z \ U))ᶜ + have hWo : IsOpen W := (hcl _ (hZc.sdiff hU)).isOpen_compl + have hxW : f x ∈ W := by + rintro ⟨y, ⟨hy, hyU⟩, he⟩ + exact hyU (hi hy hx he ▸ hxU) + obtain ⟨V₀, hV₀, hxV, hVo, harc⟩ := hZ.1 (f x) hx W hWo hxW + refine ⟨f ⁻¹' V₀ ∩ U, inter_subset_right, ⟨hxV, hxU⟩, (hVo.preimage hf).inter hU, ?_⟩ + rintro a ⟨ha, haV, -⟩ b ⟨hb, hbV, -⟩ hab + obtain ⟨L, hLs, l, h0, h1⟩ := harc (f a) ⟨ha, haV⟩ (f b) ⟨hb, hbV⟩ fun h => hab (hi ha hb h) + have hLc : IsClosed L := by + have h := isCompact_range (continuous_subtype_val.comp l.continuous) + rw [range_comp, l.surjective.range_eq, image_univ, Subtype.range_coe] at h + exact h.isClosed + have : CompactSpace (f ⁻¹' L) := isCompact_iff_compactSpace.mp (hLc.preimage hf).isCompact + let k : f ⁻¹' L → L := fun p => ⟨f p.1, p.2⟩ + have hkc : Continuous k := Continuous.subtype_mk (hf.comp continuous_subtype_val) _ + have hinL : ∀ p : f ⁻¹' L, p.1 ∈ f ⁻¹' Z := fun p => (hLs p.2).1 + have hkb : Function.Bijective k := by + constructor + · intro p p' he + exact Subtype.ext (hi (hinL p) (hinL p') (congrArg Subtype.val he)) + · rintro ⟨s, hs'⟩ + obtain ⟨p, rfl⟩ := hs s + exact ⟨⟨p, hs'⟩, rfl⟩ + let kh : f ⁻¹' L ≃ₜ L := Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective k hkb) hkc + have hlift : ∀ {p z}, p ∈ f ⁻¹' Z → f p = z → ∀ q : L, q.1 = z → (kh.symm q).1 = p + := fun {p z} hp hz q hq => by + apply hi (hinL _) hp + have h5 : k (kh.symm q) = q := kh.apply_symm_apply q + have h6 : f (kh.symm q).1 = q.1 := congrArg Subtype.val h5 + rw [h6, hq, hz] + refine ⟨f ⁻¹' L, ?_, l.trans kh.symm, ?_, ?_⟩ + · intro p hp + refine ⟨(hLs hp).1, (hLs hp).2, ?_⟩ + by_contra hpU + exact hV₀ (hLs hp).2 ⟨p, ⟨(hLs hp).1, hpU⟩, rfl⟩ + · exact hlift ha rfl _ h0 + · exact hlift hb rfl _ h1 + +/-- The extension of the cutting map to the surfaces with discs pasted on a cuff `C₀` of `S` and on +the cuff over it. -/ +structure IsCapPair (φ : Y → S) (e C₀ : Set S) (j : S → T) (D : Set T) (j' : Y → T') (D' : Set T') + (Ψ : T' → T) : Prop where + capS : IsCappedCuff C₀ T j D + capY : IsCappedCuff (φ ⁻¹' C₀) T' j' D' + bdY : bd T' = j' '' (bd Y \ φ ⁻¹' C₀) + cont : Continuous Ψ + comm : ∀ y, Ψ (j' y) = j (φ y) + surj : Function.Surjective Ψ + inj : ∀ x x', Ψ x = Ψ x' → x = x' ∨ Ψ x ∈ j '' e + inner : MapsTo Ψ (discInt D') (discInt D) + +/-- Edges are connected. -/ +theorem isPreconnected_of_edge {G : Drawing S} {e : Set S} (he : e ∈ G.E) : IsPreconnected e := + he.2.2.1.isConnected.isPreconnected + +namespace IsCutAlongEdge + +variable [T1Space S] {G : Drawing S} {e : Set S} {a b c : ℕ} {φ : Y → S} {G' : Drawing Y} + +omit [T1Space S] in +theorem exists_capPair (hc : IsCutAlongEdge G e a b c Y φ G') (hS : IsSurface S) {C₀ : Set S} + (hC : C₀ ∈ cuffs S) : + ∃ (T T' : Type u) (_ : TopologicalSpace T) (_ : TopologicalSpace T') (j : S → T) (D : Set T) + (j' : Y → T') (D' : Set T') + (Ψ : T' → T), IsCapPair φ e C₀ j D j' D' Ψ := by + obtain ⟨hcuff, hb⟩ := hc.cuff_lift hS hC + obtain ⟨T, tT, j, D, hcS, -⟩ := exists_cappedCuff hS hC + obtain ⟨T', tT', j', D', hcY, hbdY⟩ := exists_cappedCuff hc.isSurface hcuff + have : CompactSpace Y := hc.isSurface.1 + have : T2Space T' := hcY.isSurface.2.1 + have : T2Space T := hcS.isSurface.2.1 + have hne : (φ ⁻¹' C₀).Nonempty := by + obtain ⟨y, hy, hye⟩ := hcuff + exact ⟨y, hye ▸ mem_connectedComponentIn hy⟩ + obtain ⟨Ψ, hΨc, hΨj, hΨm, hΨi, hΨs, hΨo⟩ := exists_cap_map hcY hcS hc.continuous hb hne + have hcov : ∀ x, x ∈ range j' ∨ x ∈ discInt D' := fun x => by + rcases (hcY.union_eq.ge (mem_univ x)) with h | h + · exact .inl h + · by_cases hx : x ∈ discBd D' + · rw [hcY.discBd_eq] at hx + obtain ⟨y, -, rfl⟩ := hx + exact .inl (mem_range_self y) + · exact .inr ⟨h, hx⟩ + have hdis : ∀ y, ∀ x ∈ discInt D', j (φ y) ≠ Ψ x := fun y x hx he => by + have h1 := hΨo hx + rw [← he] at h1 + have h2 : j (φ y) ∈ range j ∩ D := ⟨mem_range_self _, h1.1⟩ + rw [hcS.inter_eq, ← hcS.discBd_eq] at h2 + exact h1.2 h2 + refine ⟨T, T', tT, tT', j, D, j', D', Ψ, hcS, hcY, hbdY, hΨc, hΨj, ?_, ?_, hΨo⟩ + · intro t + rcases hcS.union_eq.ge (mem_univ t) with ⟨s, rfl⟩ | h + · obtain ⟨y, rfl⟩ := hc.surjective s + exact ⟨j' y, hΨj y⟩ + · obtain ⟨x, -, hx⟩ := hΨs h + exact ⟨x, hx⟩ + · intro x x' he + rcases hcov x with ⟨y, rfl⟩ | hx <;> rcases hcov x' with ⟨y', rfl⟩ | hx' + · rw [hΨj, hΨj] at he + rcases hc.inj y y' (hcS.isEmbedding.injective he) with h | h + · exact .inl (congrArg j' h) + · exact .inr (by rw [hΨj]; exact mem_image_of_mem j h) + · rw [hΨj] at he + exact (hdis y x' hx' he).elim + · rw [hΨj] at he + exact (hdis y' x hx he.symm).elim + · exact .inl (hΨi hx.1 hx'.1 he) + +end IsCutAlongEdge + +/-- A closed disc of `T` that misses `e` lifts to `T'`. -/ +theorem IsCapPair.lift {φ : Y → S} {e C₀ : Set S} {j : S → T} {D : Set T} {j' : Y + → T'} {D' : Set T'} {Ψ : T' → T} + (hp : IsCapPair φ e C₀ j D j' D' Ψ) {Δ : Set T} (hΔ : IsClosedDisc Δ) (hm : Disjoint Δ + (j '' e)) : + IsClosedDisc (Ψ ⁻¹' Δ) := by + have : CompactSpace T' := hp.capY.isSurface.1 + have : T2Space T := hp.capS.isSurface.2.1 + refine (isClosedDisc_preimage_of_injOn hp.cont hp.surj hΔ fun x hx x' _ he => ?_).1 + exact (hp.inj x x' he).resolve_right (disjoint_left.mp hm hx) + +/-- A set that is planar on `T'`: its `O`-arcs have images under `Ψ` in closed discs of `T` that +miss `e`. -/ +theorem IsCapPair.planar_of_discs {φ : Y → S} {e C₀ : Set S} {j : S → T} {D : Set T} {j' : Y + → T'} {D' : Set T'} {Ψ : T' → T} + (hY : IsSurface Y) [ConnectedSpace Y] (hp : IsCapPair φ e C₀ j D j' D' Ψ) + {X : Set Y} (hX : IsSolid X) + (h : ∀ F, IsOArc F → F ⊆ X → ∃ Δ, IsClosedDisc Δ ∧ Disjoint Δ (j '' e) ∧ ∀ y ∈ F, j (φ y) ∈ Δ) : + IsPlanarInCappedCuff (φ ⁻¹' C₀) X := by + have : CompactSpace Y := hY.1 + have : T2Space Y := hY.2.1 + have hT' := hp.capY.isSurface + have : ConnectedSpace T' := hp.capY.connectedSpace hY + refine isPlanarInCappedCuff_of_cap hY hp.capY (isPlanar_of_null hT' hp.capY.isEmbedding hX + (.inr (IsCappedCuff.image_ne_univ hp.capY X)) fun F hF hFX f hf hr hc => ?_) + obtain ⟨Δ, hΔ, hm, hs⟩ := h F hF hFX + have h1 := null_of_disc hc (hp.lift hΔ hm) fun w => by + change Ψ (j' (f w)) ∈ Δ + rw [hp.comm] + exact hs _ (hr ▸ mem_range_self w) + exact null_comp (m := id) (c := ⟨fun w => j' (f w), hc⟩) h1 continuous_id hc + +section Bounds + +variable [T1Space S] {G : Drawing S} {e : Set S} {a b c : ℕ} {φ : Y → S} {G' : Drawing Y} + +/-- A near-planar push gives a near-planar set. -/ +theorem nearPlanar_of_push (hY : IsSurface Y) [ConnectedSpace Y] (hns : ¬ IsSphere Y) {H : 𝕀 × Y + → Y} (hH : Continuous H) + (h0 : ∀ y, H (0, y) = y) {X : Set Y} (hX : IsSolid X) (hp : IsNearPlanar ((fun y => H + (1, y)) '' X)) : IsNearPlanar X := by + rcases hp with hp | ⟨C, hC, hp⟩ + · exact .inl (planar_of_push hY hH h0 hX (.inl hns) hp) + · exact .inr ⟨C, hC, planarCap_of_push hY hH h0 hX hp⟩ + +omit [T1Space S] in +/-- A set of `Y` whose image is planar in `S` is planar in `Y` with a disc on the new cuff. -/ +theorem IsCutAlongEdge.planarNew_of_planar (hc : IsCutAlongEdge G e a b c Y φ G') + (hS : IsSurface S) [ConnectedSpace S] + {X : Set Y} (hX : IsSolid X) (hns : ¬ IsSphere S) (hp : ∀ F, F ⊆ X + → IsOArc F → IsPlanar (φ '' F)) : + IsPlanarInCappedCuff (φ ⁻¹' closure e) X := by + have hY := hc.isSurface + have : CompactSpace Y := hY.1 + have : T2Space Y := hY.2.1 + obtain ⟨ι, E, H, hcap, hH, h0, h1⟩ := hc.uncut + refine isPlanarInCappedCuff_of_cap hY hcap (isPlanar_of_homotopy hS hcap.isEmbedding hX + (.inl hns) hH h0 fun F hF hFX => ?_) + obtain ⟨Δ, hΔ, hs⟩ := hp F hFX hF + exact ⟨Δ, hΔ, fun y hy => by + rw [h1] + exact hs (mem_image_of_mem φ hy)⟩ + +omit [T1Space S] in +/-- The key step of (7.1): a candidate of `G'` has at least `r` vertices. -/ +theorem IsCutAlongEdge.candidate_ge (hc : IsCutAlongEdge G e a b c Y φ G') + (hS : IsSurface S) [ConnectedSpace S] + [ConnectedSpace Y] (hnsS : ¬ IsSphere S) (hnsY : ¬ IsSphere Y) {r : ℕ} (hr : 1 ≤ r) + (hα : ∀ X, IsAlphaCandidate G X → r ≤ (X ∩ G.V).ncard) (hnot : ¬ e ⊆ allCuffsInsideSet G + (r - 1)) {X : Set Y} + (hX : IsAlphaCandidate G' X) : r ≤ (X ∩ G'.V).ncard := by + have hYs := hc.isSurface + have : CompactSpace Y := hYs.1 + have : T2Space Y := hYs.2.1 + have : T2Space S := hS.2.1 + obtain ⟨hXs, hXc, hXn, hXp⟩ := hX + by_contra hlt + push Not at hlt + obtain ⟨H, hH, h0, hinj, hpush⟩ := hc.exists_push + have hρc : Continuous fun y => H (1, y) := hH.comp (continuous_const.prodMk continuous_id) + obtain ⟨hn, hN, hcnt⟩ := hpush X hXn + obtain ⟨hi, hnorm, hcnt2⟩ := hc.image_facts hn hN + have hX₁s := isSolid_image_of_injOn hρc hXs hinj.injOn + have hX₁c := hXc.image _ hρc.continuousOn + have hX₂s := isSolid_image_of_injOn hc.continuous hX₁s hi + have hX₂c := hX₁c.image φ hc.continuous.continuousOn + have hcount : (φ '' ((fun y => H (1, y)) '' X) ∩ G.V).ncard = (X ∩ G'.V).ncard := by + rw [inter_comm, hcnt2, hcnt, inter_comm] + have hnear : IsNearPlanar (φ '' ((fun y => H (1, y)) '' X)) := by + by_contra hnp + have := hα _ ⟨hX₂s, hX₂c, hnorm, hnp⟩ + omega + refine hXp (nearPlanar_of_push hYs hnsY hH h0 hXs ?_) + by_cases hpl : IsPlanar (φ '' ((fun y => H (1, y)) '' X)) + · obtain ⟨Δ, hΔ, hsub⟩ := hpl + exact .inr ⟨_, hc.newCuff, hc.planarNew_of_planar hS hX₁s hnsS fun F hF _ => ⟨Δ, hΔ, + (image_mono hF).trans hsub⟩⟩ + obtain ⟨C₀, hC₀, hcap⟩ := hnear.resolve_left hpl + obtain ⟨T, T', tT, tT', j, D, j', D', Ψ, hp⟩ := hc.exists_capPair hS hC₀ + refine .inr ⟨_, (hc.cuff_lift hS hC₀).1, hp.planar_of_discs hYs hX₁s fun F hF hFX + => ?_⟩ + have hT := hp.capS.isSurface + have : T2Space T := hT.2.1 + have hj := hp.capS.isEmbedding + have hF₂ : IsOArc (j '' (φ '' F)) := by + obtain ⟨f⟩ := id hF + obtain ⟨e', -⟩ := exists_param_image f (g := fun y => j (φ y)) (hj.continuous.comp + hc.continuous) + fun x hx y hy he => hi (hFX hx) (hFX hy) (hj.injective he) + rw [image_image] + exact ⟨e'⟩ + have hplan : IsPlanar (j '' (φ '' F)) := by + obtain ⟨Δ, hΔ, hsub⟩ := hcap.2.2 T j D hp.capS + exact ⟨Δ, hΔ, (image_mono (image_mono hFX)).trans hsub⟩ + have hnull := (isPlanar_iff_isNullHomotopicOArc_of_isOArc hT hF₂).mp hplan + obtain ⟨Δ, hΔ, hbd⟩ := nullHomotopicOArc_bounds_disc hT hF₂ hnull + refine ⟨Δ, hΔ, ?_, fun y hy => Surface.discBd_subset _ (hbd ▸ mem_image_of_mem j + (mem_image_of_mem φ hy))⟩ + by_contra hmeet + obtain ⟨_, hx, s, hs, rfl⟩ := not_disjoint_iff.mp hmeet + refine hnot fun p hpe => ?_ + have heA : ∀ x ∈ e, x ∉ φ '' ((fun y => H (1, y)) '' X) := fun x hx hA => + hc.notMem_V hx (hnorm ⟨hA, hc.mem_U hx⟩) + have hs' : s ∈ univ \ φ '' ((fun y => H (1, y)) '' X) := ⟨mem_univ _, heA s hs⟩ + have heK : e ⊆ connectedComponentIn (univ \ φ '' ((fun y => H (1, y)) '' X)) s := + (isPreconnected_of_edge hc.mem_E).subset_connectedComponentIn hs fun x hx + => ⟨mem_univ _, heA x hx⟩ + have hKA := connectedComponentIn_subset (univ \ φ '' ((fun y => H (1, y)) '' X)) s + have hside := IsClosedDisc.side hT.2.2 hΔ + ((isPreconnected_connectedComponentIn (F := univ \ φ '' ((fun y => H (1, y)) '' X)) (x + := s)).image j hj.continuous.continuousOn) + (by + rw [hbd, disjoint_left] + rintro _ ⟨z, hz, rfl⟩ ⟨w, hw, he⟩ + exact (hKA hz).2 ((hj.injective he) ▸ image_mono hFX hw)) + have hKd : j '' connectedComponentIn (univ \ φ '' ((fun y => H (1, y)) '' X)) s ⊆ Δ := by + rcases hside with h | h + · exact h.trans (discInt_subset Δ) + · exact (disjoint_left.mp h (mem_image_of_mem j (heK hs)) hx).elim + have hA : IsScriptASet G (r - 1) C₀ (φ '' ((fun y => H (1, y)) '' X)) := + ⟨hX₂s, hX₂c, hnorm, ⟨hC₀, hcap, hpl⟩, by rw [inter_comm, hcount]; omega⟩ + refine mem_iUnion₂.mpr ⟨C₀, ⟨hC₀, ?_⟩, ?_⟩ + · obtain ⟨z, hz⟩ := hX₂c.nonempty + exact ⟨z, _, ⟨hA.1, hA.2.1, hA.2.2.1, hA.2.2.2.1, hA.2.2.2.2⟩, hz⟩ + · exact ⟨_, ⟨_, hA, .inr ⟨⟨s, hs', rfl⟩, T, tT, j, D, Δ, hp.capS, hΔ, by + rw [hbd] + exact image_mono (image_mono hFX), hKd⟩⟩, heK hpe⟩ + +omit [T1Space S] in +/-- (7.1): candidates of `G` give candidates of `G'`. -/ +theorem IsCutAlongEdge.candidate_preimage (hc : IsCutAlongEdge G e a b c Y φ G') + (hS : IsSurface S) [ConnectedSpace S] + (hnsS : ¬ IsSphere S) {X : Set S} (hX : IsAlphaCandidate G X) : IsAlphaCandidate G' (φ ⁻¹' X) + := by + have hYs := hc.isSurface + have : CompactSpace Y := hYs.1 + have : T2Space Y := hYs.2.1 + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + obtain ⟨hs, hcn, hn, hp⟩ := hX + have hoff : ∀ x ∈ X, x ∉ e := fun x hx he => hc.notMem_V he (hn ⟨hx, hc.mem_U he⟩) + have hi : InjOn φ (φ ⁻¹' X) := fun x hx y _ he => (hc.inj x y he).resolve_right (hoff _ hx) + have hK : IsCompact (φ ⁻¹' X) := (hs.2.preimage hc.continuous).isCompact + have : Nonempty Y := by + obtain ⟨x, -⟩ := hcn.nonempty + exact ⟨(hc.surjective x).choose⟩ + obtain ⟨g, hgc, hgl⟩ := exists_inv_of_compactOn hK hc.continuous.continuousOn hi + have him : φ '' (φ ⁻¹' X) = X := image_preimage_eq _ hc.surjective + rw [him] at hgc + have hr : RightInvOn g φ X := fun y hy => by + obtain ⟨x, rfl⟩ := hc.surjective y + rw [hgl (show x ∈ φ ⁻¹' X from hy)] + have hgim : g '' X = φ ⁻¹' X := by + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + change φ (g y) ∈ X + rwa [hr hy] + · intro hx + exact ⟨φ x, hx, hgl hx⟩ + refine ⟨isSolid_preimage_of_injOn hc.continuous hc.surjective hs hi, hgim ▸ hcn.image g hgc, + ?_, fun hnp => hp ?_⟩ + · rintro x ⟨hx, hU⟩ + rw [hc.preimage_U] at hU + rw [hc.preimage_V] + exact hn ⟨hx, hU.1⟩ + have hlift : ∀ f : Circle → S, Continuous f → range f ⊆ X → Continuous fun w => g (f w) + := fun f hf hr' => + hgc.comp_continuous hf fun w => hr' (mem_range_self w) + have hgX : ∀ {f : Circle → S}, range f ⊆ X → ∀ w, φ (g (f w)) = f w := fun hr' w => hr (hr' + (mem_range_self w)) + rcases hnp with ⟨Δ, hΔ, hsub⟩ | ⟨C, hC, hcap⟩ + · refine .inl ?_ + have h := isPlanar_of_null hS (j := id) IsEmbedding.id hs (.inl hnsS) fun F _ hFX f hf hrf hc' + => by + have h1 : range f ⊆ X := hrf.le.trans hFX + have h2 := null_of_disc (hlift f hf h1) hΔ fun w => hsub (show φ (g (f w)) ∈ X by + rw [hgX h1] + exact h1 (mem_range_self w)) + have h3 := null_comp h2 hc.continuous (hc.continuous.comp (hlift f hf h1)) + convert h3 using 2 + ext w + exact (hgX h1 w).symm + simpa using h + · rcases hc.cuff_cases hS hC with rfl | ⟨C₀, hC₀, rfl⟩ + · refine .inl ?_ + obtain ⟨ι, E, H, hcap', hH, h0, h1⟩ := hc.uncut + obtain ⟨Δ, hΔ, hsub⟩ := hcap.2.2 S ι E hcap' + have h := isPlanar_of_null hS (j := id) IsEmbedding.id hs (.inl hnsS) fun F _ hFX f hf hrf + hc' => by + have h1' : range f ⊆ X := hrf.le.trans hFX + have h2 := null_of_homotopy_into_disc (H := fun q : 𝕀 × Y => H (unitInterval.symm q.1, q.2)) + (hH.comp ((unitInterval.continuous_symm.comp continuous_fst).prodMk continuous_snd)) + (hlift f hf h1') hΔ fun w => by + have hwX : φ (g (f w)) ∈ X := by + rw [hgX h1'] + exact h1' (mem_range_self w) + simpa [h0] using hsub (mem_image_of_mem ι hwX) + convert h2 using 2 + ext w + simp [h1, hgX h1' w] + simpa using h + · refine .inr ⟨C₀, hC₀, ?_⟩ + obtain ⟨T, T', tT, tT', j, D, j', D', Ψ, hp'⟩ := hc.exists_capPair hS hC₀ + obtain ⟨Δ, hΔ, hsub⟩ := hcap.2.2 T' j' D' hp'.capY + have hT := hp'.capS.isSurface + have : ConnectedSpace T := hp'.capS.connectedSpace hS + refine isPlanarInCappedCuff_of_cap hS hp'.capS (isPlanar_of_null hT hp'.capS.isEmbedding hs + (.inr (IsCappedCuff.image_ne_univ hp'.capS X)) fun F _ hFX f hf hrf hc' => ?_) + have h1' : range f ⊆ X := hrf.le.trans hFX + have hc2 : Continuous fun w => j' (g (f w)) := hp'.capY.isEmbedding.continuous.comp + (hlift f hf h1') + have h2 := null_of_disc hc2 hΔ fun w => hsub (mem_image_of_mem j' (show φ (g (f w)) ∈ X by + rw [hgX h1'] + exact h1' (mem_range_self w))) + have h3 := null_comp h2 hp'.cont (hp'.cont.comp hc2) + convert h3 using 2 + ext w + simp [hp'.comm, hgX h1' w] + +omit [T1Space S] in +/-- Graph Minors VII, (7.1). -/ +theorem IsCutAlongEdge.alpha_bound (hc : IsCutAlongEdge G e a b c Y φ G') (hS : IsSurface S) + (h3 : 3 ≤ 3 * a + 3 * b + c) + (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) {r : ℕ} (hr : 2 ≤ r) (hα : 9 * r ≤ 2 * alpha G) + (hnot : ¬ e ⊆ allCuffsInsideSet G (r - 1)) : r ≤ alpha G' := by + have : ConnectedSpace S := connectedSpace_of_model hm + have : ConnectedSpace Y := connectedSpace_of_model hc.homeo_model + have hnsS : ¬ IsSphere S := not_isSphere_of_model hm (by omega) + have hnsY : ¬ IsSphere Y := not_isSphere_of_model hc.homeo_model (by omega) + have hne : {n : ℕ | ∃ X : Set S, IsAlphaCandidate G X ∧ (X ∩ G.V).ncard = n}.Nonempty := by + by_contra h + rw [not_nonempty_iff_eq_empty] at h + have h0 : alpha G = 0 := by simp [alpha, h] + omega + obtain ⟨_, X₀, hX₀, -⟩ := hne + have hαG : ∀ X, IsAlphaCandidate G X → r ≤ (X ∩ G.V).ncard := fun X hX => by + have h1 : alpha G ≤ (X ∩ G.V).ncard := Nat.sInf_le ⟨X, hX, rfl⟩ + omega + refine le_csInf ⟨_, _, hc.candidate_preimage hS hnsS hX₀, rfl⟩ ?_ + rintro _ ⟨X, hX, rfl⟩ + exact hc.candidate_ge hS hnsS hnsY (by omega) hαG hnot hX + +omit [T1Space S] in +/-- The new cuff has two vertices. -/ +theorem IsCutAlongEdge.ncard_new (hc : IsCutAlongEdge G e a b c Y φ G') : + (G'.V ∩ φ ⁻¹' closure e).ncard = 2 := by + have h1 : G'.V ∩ φ ⁻¹' closure e = φ ⁻¹' tilde e := by + rw [GraphMinor.GM19.tilde_eq_inter_V G hc.mem_E, hc.preimage_V, inter_comm] + rfl + have hi : InjOn φ (φ ⁻¹' tilde e) := fun x hx y _ he => (hc.inj x y he).resolve_right fun h + => hx.2 h + rw [h1, ← hi.ncard_image, image_preimage_eq _ hc.surjective, hc.not_loop] + +omit [T1Space S] in +theorem connectedComponentIn_subset_of_cuff {C₀ : Set S} (h : C₀ ∈ cuffs S) : C₀ ⊆ bd S := by + obtain ⟨y, -, rfl⟩ := h + exact connectedComponentIn_subset _ _ + +omit [T1Space S] in +/-- Graph Minors VII, (7.2). -/ +theorem IsCutAlongEdge.boundaryLinked (hc : IsCutAlongEdge G e a b c Y φ G') (hS : IsSurface S) + (h3 : 3 ≤ 3 * a + 3 * b + c) + (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) (hBL : IsBoundaryLinked G) + (hno : ¬ ∃ A : Set S, G.IsNormal A ∧ IsNullHomotopicOArc A ∧ (G.V ∩ A).ncard ≤ 1 + ∧ IsInsideOArc e A) : + IsBoundaryLinked G' := by + have : ConnectedSpace S := connectedSpace_of_model hm + have : ConnectedSpace Y := connectedSpace_of_model hc.homeo_model + have hnsY : ¬ IsSphere Y := not_isSphere_of_model hc.homeo_model (by omega) + have hYs := hc.isSurface + have : CompactSpace Y := hYs.1 + have : T2Space Y := hYs.2.1 + have : T2Space S := hS.2.1 + refine ⟨hc.isProper, fun C hC F hFn hF hsur => ?_⟩ + obtain ⟨H, hH, h0, hinj, hpush⟩ := hc.exists_push + have hρc : Continuous fun y => H (1, y) := hH.comp (continuous_const.prodMk continuous_id) + obtain ⟨hn, hN, hcnt⟩ := hpush F hFn + obtain ⟨hi, hnorm, hcnt2⟩ := hc.image_facts hn hN + have hsur₁ := surrounds_of_push hYs hH h0 hinj hF hnsY hsur + have hρe : IsEmbedding fun y => H (1, y) := (hρc.isClosedEmbedding hinj).isEmbedding + have hF₁ : IsOArc ((fun y => H (1, y)) '' F) := GM11.isOArc_image hF hρc.continuousOn hinj.injOn + rw [← hcnt, ← hcnt2] + obtain ⟨f⟩ := id hF₁ + obtain ⟨e₂, he₂⟩ := exists_param_image f hc.continuous hi + have hF₂ : IsOArc (φ '' ((fun y => H (1, y)) '' F)) := ⟨e₂⟩ + rcases hc.cuff_cases hS hC with rfl | ⟨C₀, hC₀, rfl⟩ + · rw [hc.ncard_new] + by_contra hlt + push Not at hlt + have hnull : IsNullHomotopicOArc (φ '' ((fun y => H (1, y)) '' F)) := by + obtain ⟨ι, E, H', hcap', hH', h0', h1'⟩ := hc.uncut + obtain ⟨Δ, hΔ, hsub⟩ := hsur₁.2.1.2.2 S ι E hcap' + refine ⟨e₂, ?_⟩ + have hfc : Continuous fun w => (f w).1 := continuous_subtype_val.comp f.continuous + have h2 := null_of_homotopy_into_disc (H := fun q : 𝕀 × Y => H' (unitInterval.symm q.1, q.2)) + (hH'.comp ((unitInterval.continuous_symm.comp continuous_fst).prodMk continuous_snd)) hfc + hΔ fun w => by + simpa [h0'] using hsub (mem_image_of_mem ι (f w).2) + convert h2 using 2 + ext w + simp [he₂, h1'] + obtain ⟨Δ, hΔ, hbd⟩ := nullHomotopicOArc_bounds_disc hS hF₂ hnull + have heA : ∀ x ∈ e, x ∉ φ '' ((fun y => H (1, y)) '' F) := fun x hx hA => + hc.notMem_V hx (hnorm ⟨hA, hc.mem_U hx⟩) + have hside := IsClosedDisc.side hS.2.2 hΔ (isPreconnected_of_edge hc.mem_E) (by + rw [hbd, disjoint_left] + exact heA) + rcases hside with h | h + · exact hno ⟨_, hnorm, hnull, by omega, fun x hx => .inl ⟨hnull, Δ, hΔ, hbd, (h hx).1, + heA x hx⟩⟩ + · exfalso + have hlift := (isClosedDisc_preimage_of_injOn hc.continuous hc.surjective hΔ fun x hx x' _ he + => + (hc.inj x x' he).resolve_right (disjoint_right.mp h hx)).1 + refine hsur₁.2.2 ⟨_, hlift, ?_⟩ + intro y hy + have h5 : φ y ∈ discBd Δ := by + rw [hbd] + exact mem_image_of_mem φ hy + exact Surface.discBd_subset Δ h5 + · obtain ⟨hcuff, hb⟩ := hc.cuff_lift hS hC₀ + have hC'b : φ ⁻¹' C₀ ⊆ bd Y := fun y hy => by + rw [hc.bd_eq] + exact .inl (show φ y ∈ bd S from connectedComponentIn_subset_of_cuff hC₀ hy) + have hC'N : φ ⁻¹' C₀ ∩ φ ⁻¹' closure e ⊆ G'.V := fun y hy => + (hc.bd_inter hy.2 (connectedComponentIn_subset_of_cuff hC₀ hy.1)).elim + have hC'count : (G'.V ∩ φ ⁻¹' C₀).ncard = (G.V ∩ C₀).ncard := by + have h1 := (hc.image_facts (A := φ ⁻¹' C₀) (fun y hy => hc.isProper ⟨hC'b hy.1, hy.2⟩) + hC'N).2.2 + rw [image_preimage_eq _ hc.surjective] at h1 + exact h1.symm + rw [hC'count] + refine hBL.2 C₀ hC₀ _ hnorm hF₂ ?_ + obtain ⟨T, T', tT, tT', j, D, j', D', Ψ, hp⟩ := hc.exists_capPair hS hC₀ + have hT := hp.capS.isSurface + have hT' := hp.capY.isSurface + have : T2Space T := hT.2.1 + have : T2Space T' := hT'.2.1 + have : CompactSpace T' := hT'.1 + have : ConnectedSpace T := hp.capS.connectedSpace hS + have hj := hp.capS.isEmbedding + have hj' := hp.capY.isEmbedding + have hF₃ : IsOArc (j' '' ((fun y => H (1, y)) '' F)) := GM11.isOArc_image hF₁ + hj'.continuous.continuousOn hj'.injective.injOn + have hnull := (isPlanar_iff_isNullHomotopicOArc_of_isOArc hT' hF₃).mp + (hsur₁.2.1.2.2 T' j' D' hp.capY) + obtain ⟨Δ₆, hΔ₆, hbd₆⟩ := nullHomotopicOArc_bounds_disc hT' hF₃ hnull + have hinjΨ : InjOn Ψ Δ₆ := by + have hover : ∀ x ∈ Δ₆, Ψ x ∉ j '' e := by + rintro x hx ⟨s, hs, hse⟩ + have hxr : x ∈ range j' := by + by_contra hnr + have hxD : x ∈ D' := (hp.capY.union_eq.ge (mem_univ x)).resolve_left hnr + have hxi : x ∈ discInt D' := ⟨hxD, fun hb' => hnr (by + rw [hp.capY.discBd_eq] at hb' + exact image_subset_range _ _ hb')⟩ + have h1 := hp.inner hxi + rw [← hse] at h1 + have h2 : j s ∈ range j ∩ D := ⟨mem_range_self s, h1.1⟩ + rw [hp.capS.inter_eq, ← hp.capS.discBd_eq] at h2 + exact h1.2 h2 + obtain ⟨y, rfl⟩ := hxr + rw [hp.comm] at hse + have hys : φ y = s := (hj.injective hse).symm ▸ rfl + have hyN : y ∈ φ ⁻¹' closure e := by + change φ y ∈ closure e + rw [hys] + exact subset_closure hs + have hyb : j' y ∈ bd T' := by + rw [hp.bdY] + refine ⟨y, ⟨?_, ?_⟩, rfl⟩ + · rw [hc.bd_eq] + exact .inr hyN + · intro hyC + exact hc.bd_inter hyN (connectedComponentIn_subset_of_cuff hC₀ hyC) + have hyd : j' y ∈ discBd Δ₆ := by + by_contra hnb + exact hyb (isInteriorPoint_of_mem_discInt hT'.2.2 hΔ₆ ⟨hx, hnb⟩) + rw [hbd₆] at hyd + obtain ⟨y', hy', hee⟩ := hyd + rw [hj'.injective hee] at hy' + have h4 := hN ⟨hy', hyN⟩ + rw [hc.preimage_V] at h4 + exact hc.notMem_V (hys ▸ hs) h4 + exact fun x hx x' _ he => (hp.inj x x' he).resolve_right (hover x hx) + obtain ⟨hΔ₇, hbd₇⟩ := isClosedDisc_image_of_injOn hΔ₆ hp.cont hinjΨ + have hbd₈ : discBd (Ψ '' Δ₆) = j '' (φ '' ((fun y => H (1, y)) '' F)) := by + rw [hbd₇, hbd₆, image_image, image_image, image_image, image_image] + exact image_congr fun y _ => hp.comm _ + refine ⟨hC₀, isPlanarInCappedCuff_of_cap hS hp.capS ⟨_, hΔ₇, hbd₈ ▸ Surface.discBd_subset _⟩, + fun hplan => ?_⟩ + have hnull₂ := (isPlanar_iff_isNullHomotopicOArc_of_isOArc hS hF₂).mp hplan + obtain ⟨Δ₅, hΔ₅, hbd₅⟩ := nullHomotopicOArc_bounds_disc hS hF₂ hnull₂ + obtain ⟨hΔ₉, hbd₉⟩ := isClosedDisc_image_of_injOn hΔ₅ hj.continuous hj.injective.injOn + have heq := eq_of_discBd_eq hT (not_isSphere_cap hS h3 hm hp.capS) hΔ₉ hΔ₇ + (by rw [hbd₉, hbd₅, hbd₈]) + have hsubr : Δ₆ ⊆ range j' := by + intro x hx + by_contra hnr + have hxD : x ∈ D' := (hp.capY.union_eq.ge (mem_univ x)).resolve_left hnr + have hxi : x ∈ discInt D' := ⟨hxD, fun hb' => hnr (by + rw [hp.capY.discBd_eq] at hb' + exact image_subset_range _ _ hb')⟩ + have h1 := hp.inner hxi + have h2 : Ψ x ∈ j '' Δ₅ := heq ▸ mem_image_of_mem Ψ hx + obtain ⟨s, -, hs⟩ := h2 + have h3' : Ψ x ∈ range j ∩ D := ⟨⟨s, hs⟩, h1.1⟩ + rw [hp.capS.inter_eq, ← hp.capS.discBd_eq] at h3' + exact h1.2 h3' + refine hsur₁.2.2 ⟨_, isClosedDisc_preimage_of_subset_range hj'.continuous hj'.injective hΔ₆ + hsubr, fun y hy => ?_⟩ + have h5 : j' y ∈ discBd Δ₆ := by + rw [hbd₆] + exact mem_image_of_mem j' hy + exact Surface.discBd_subset Δ₆ h5 + +end Bounds + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CutBuild.lean b/LeanPool/GraphMinor/GM07/CutBuild.lean new file mode 100644 index 0000000000..62f62b35c2 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CutBuild.lean @@ -0,0 +1,310 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CutEdge +public import LeanPool.GraphMinor.GM07.CutDraw +import LeanPool.GraphMinor.GM19.Section6a +import LeanPool.GraphMinor.GM11.Forest +import LeanPool.GraphMinor.GM06.Euler +import LeanPool.GraphMinor.Surface.AddCrosscap +import LeanPool.GraphMinor.Surface.Classification +import LeanPool.GraphMinor.Surface.PasteModel + +/-! +# Cutting along an edge + +A non-loop edge off the boundary can be cut along (`exists_cut`). The cut surface is `S` with the +inside of the disc of the slit +removed, and the cutting map is the end of the homotopy of the slit (`IsSlit`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +local notation "𝕀" => unitInterval + +variable {S : Type u} [TopologicalSpace S] + +/-- `remove_disc` for a surface in any universe. -/ +theorem remove_disc_homeo {M : Type} [TopologicalSpace M] (hS : IsSurface S) + (h : S ≃ₜ M) {E : Set S} (hE : IsClosedDisc E) + (hint : ∀ x ∈ discBd E, IsInteriorPoint x) : + IsClosed (discInt E)ᶜ ∧ IsSurface ↥(discInt E)ᶜ ∧ bd ↥(discInt E)ᶜ = Subtype.val ⁻¹' + (bd S ∪ discBd E) := by + have ht2 : T2Space S := hS.2.1 + have hM : IsSurface M := isSurface_of_homeo h hS + have hl : LeftInvOn h.symm h E := fun x _ => h.symm_apply_apply x + obtain ⟨hE', hbd'⟩ := hE.image h.continuous.continuousOn h.symm.continuous.continuousOn hl + have hmem : ∀ {x : S} {A : Set S}, h x ∈ h '' A ↔ x ∈ A := h.injective.mem_set_image + have hint' : ∀ x ∈ discBd (h '' E), IsInteriorPoint x := fun x hx => by + rw [hbd'] at hx + obtain ⟨y, hy, rfl⟩ := hx + by_contra hb + have h1 : h y ∈ bd M := hb + rw [← image_bd_homeomorph h] at h1 + exact (show y ∈ bd S from hmem.mp h1) (hint y hy) + obtain ⟨-, hs', hb'⟩ := remove_disc hM hE' hint' + have hin : ∀ x, x ∈ (discInt E)ᶜ ↔ h x ∈ (discInt (h '' E))ᶜ := fun x => by + simp only [mem_compl_iff, discInt, mem_sdiff, hbd', hmem] + let β : ↥(discInt E)ᶜ ≃ₜ ↥(discInt (h '' E))ᶜ := h.subtype hin + refine ⟨(hE.isOpen_discInt hS.2.2).isClosed_compl, isSurface_of_homeo β.symm hs', ?_⟩ + ext y + have h1 : y ∈ bd ↥(discInt E)ᶜ ↔ β y ∈ bd ↥(discInt (h '' E))ᶜ := by + rw [← image_bd_homeomorph β] + exact β.injective.mem_set_image.symm + rw [h1, hb'] + change h y.1 ∈ bd M ∪ discBd (h '' E) ↔ y.1 ∈ bd S ∪ discBd E + rw [hbd', ← image_bd_homeomorph h, mem_union, mem_union, hmem, hmem] + +/-- Removing the inside of a closed disc off the boundary keeps a surface connected. -/ +theorem connectedSpace_remove (hS : IsSurface S) [ConnectedSpace S] {E : Set S} + (hE : IsClosedDisc E) + (hcl : IsClosed (discInt E)ᶜ) : ConnectedSpace ↥(discInt E)ᶜ := by + have ht2 : T2Space S := hS.2.1 + have hO := hE.isOArc_discBd + have hNc : IsConnected (discBd E) := isConnected_of_isOArc hO + have hsub : discBd E ⊆ (discInt E)ᶜ := fun x hx hi => hi.2 hx + obtain ⟨x₀, hx₀⟩ := hNc.nonempty + let n : ↥(discInt E)ᶜ := ⟨x₀, hsub hx₀⟩ + have hNp : IsPreconnected (Subtype.val ⁻¹' discBd E : Set ↥(discInt E)ᶜ) := by + rw [Topology.IsInducing.subtypeVal.isPreconnected_image.symm, + image_preimage_eq_of_subset (fun x hx => ⟨⟨x, hsub hx⟩, rfl⟩)] + exact hNc.isPreconnected + have key : ∀ B : Set ↥(discInt E)ᶜ, IsClopen B → Disjoint B (Subtype.val ⁻¹' discBd E) → B = ∅ + := by + intro B hB hd + have hemb := hcl.isClosedEmbedding_subtypeVal + have hc : IsClosed (Subtype.val '' B) := hemb.isClosedMap B hB.1 + obtain ⟨O, hO', rfl⟩ := Topology.IsInducing.subtypeVal.isOpen_iff.mp hB.2 + have heq : Subtype.val '' (Subtype.val ⁻¹' O : Set ↥(discInt E)ᶜ) = O ∩ Eᶜ := by + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + refine ⟨hy, fun hyE => ?_⟩ + by_cases hb : y.1 ∈ discBd E + · exact disjoint_left.mp hd hy hb + · exact y.2 ⟨hyE, hb⟩ + · rintro ⟨hx, hxE⟩ + exact ⟨⟨x, fun hi => hxE hi.1⟩, hx, rfl⟩ + have ho : IsOpen (O ∩ Eᶜ) := hO'.inter hE.isCompact.isClosed.isOpen_compl + rw [heq] at hc + have hcl' : IsClopen (O ∩ Eᶜ) := ⟨hc, ho⟩ + rcases isClopen_iff.mp hcl' with h | h + · rw [eq_empty_iff_forall_notMem] + intro y hy + have : y.1 ∈ O ∩ Eᶜ := heq ▸ mem_image_of_mem _ hy + rw [h] at this + exact this + · have : x₀ ∈ O ∩ Eᶜ := h ▸ mem_univ _ + exact (this.2 (Surface.discBd_subset _ hx₀)).elim + have hpc : PreconnectedSpace ↥(discInt E)ᶜ := by + rw [preconnectedSpace_iff_clopen] + intro B hB + have hn := hNp.subset_isClopen (t := B) hB + by_cases hnB : n ∈ B + · refine .inr ?_ + have h1 := key Bᶜ hB.compl (by + rw [disjoint_left] + intro y hy hyN + exact hy (hn ⟨n, hx₀, hnB⟩ hyN)) + exact compl_empty_iff.mp h1 + · refine .inl (key B hB ?_) + have hnc := hNp.subset_isClopen (t := Bᶜ) hB.compl ⟨n, hx₀, hnB⟩ + rw [disjoint_left] + exact fun y hy hyN => hnc hyN hy + exact { toPreconnectedSpace := hpc, toNonempty := ⟨n⟩ } + +theorem exists_cut [T1Space S] (hS : IsSurface S) {a b c : ℕ} (hm : Nonempty + (S ≃ₜ SurfaceModel a b c)) (G : Drawing S) + (hG : G.IsProper) {e : Set S} (he : e ∈ G.E) (hl : (tilde e).ncard = 2) (hd : closure e ∩ bd S + = ∅) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (_ : T1Space Y) (φ : Y → S) (G' : Drawing Y), + IsCutAlongEdge G e a b c Y φ G' := by + classical + have ht2 : T2Space S := hS.2.1 + have hcS : CompactSpace S := hS.1 + have hconn : ConnectedSpace S := by + obtain ⟨h⟩ := id hm + have := (modelCriterion.1 a b c).2 + exact h.symm.surjective.connectedSpace h.symm.continuous + obtain ⟨h⟩ := id hm + have hM : IsSurface (SurfaceModel a b c) := (modelCriterion.1 a b c).1 + have hline : ∃ u v : S, u ≠ v ∧ closure e ∩ G.V = {u, v} ∧ IsLineWithEnds (closure e) u v := by + rcases G.edge_cond e he with h1 | ⟨u, hcap, -⟩ + · exact h1 + · rw [GraphMinor.GM19.tilde_eq_inter_V G he, hcap] at hl + simp at hl + obtain ⟨u, v, huv, hcap, hL⟩ := hline + obtain ⟨E, κ, hs⟩ := exists_slit hM h hL hd + have hmemV : ∀ s, s ∈ closure e → s ∉ e → s = u ∨ s = v := fun s hs1 hs2 => by + have h1 : s ∉ closure e \ G.V := fun h2 => hs2 (by rw [G.closure_diff_V he] at h2; exact h2) + have h2 : s ∈ closure e ∩ G.V := ⟨hs1, by_contra fun h3 => h1 ⟨hs1, h3⟩⟩ + rw [hcap] at h2 + simpa using h2 + have hint : ∀ x ∈ discBd E, IsInteriorPoint x := fun x hx => by + by_contra hb + have h1 : x ∈ E ∩ bd S := ⟨Surface.discBd_subset _ hx, hb⟩ + rw [hs.off_bd] at h1 + exact h1 + obtain ⟨hcl, hYs, hbdY⟩ := remove_disc_homeo hS h hs.disc hint + have : CompactSpace ↥(discInt E)ᶜ := hYs.1 + have : T2Space ↥(discInt E)ᶜ := hYs.2.1 + have hYc := connectedSpace_remove hS hs.disc hcl + let φ : ↥(discInt E)ᶜ → S := fun y => κ (1, y.1) + have hφc : Continuous φ := hs.cont.comp (continuous_const.prodMk continuous_subtype_val) + have hφs : Function.Surjective φ := fun y => by + obtain ⟨x, hx, he'⟩ := hs.onto y + exact ⟨⟨x, hx⟩, he'⟩ + have hpre : ∀ y, φ y ∈ closure e ↔ y.1 ∈ discBd E := fun y => by + constructor + · intro hy + have h1 : y.1 ∈ E := by + by_contra hn + exact hs.off _ hn hy + by_contra hn + exact y.2 ⟨h1, hn⟩ + · exact hs.fold _ + have hinj : ∀ x y, φ x = φ y → x = y ∨ φ x ∈ e := fun x y he' => by + rcases hs.inj x.1 y.1 x.2 y.2 he' with h1 | ⟨h1, -, h2, h3⟩ + · exact .inl (Subtype.ext h1) + · refine .inr (by_contra fun hn => ?_) + rcases hmemV _ ((hpre x).mpr h1) hn with h4 | h4 + · exact h2 h4 + · exact h3 h4 + have hU₁ : (G.deleteEdge e).U = G.U \ e := deleteEdge_U G he + have hV₁ : (G.deleteEdge e).V = G.V := deleteEdge_V G e + have hi : InjOn φ (φ ⁻¹' (G.deleteEdge e).U) := fun x hx y _ he' => by + rw [mem_preimage, hU₁] at hx + exact (hinj x y he').resolve_right hx.2 + let G' := pullDrawing (G.deleteEdge e) hφc hφs hi + have hbd_eq : bd ↥(discInt E)ᶜ = φ ⁻¹' (bd S ∪ closure e) := by + rw [hbdY] + ext y + simp only [mem_preimage, mem_union] + rw [hpre, hs.bd_iff] + have hNeq : φ ⁻¹' closure e = Subtype.val ⁻¹' discBd E := by + ext y + exact hpre y + have hNc : IsConnected (discBd E) := isConnected_of_isOArc hs.disc.isOArc_discBd + have hsub : discBd E ⊆ (discInt E)ᶜ := fun x hx hi => hi.2 hx + have hvN : Subtype.val '' (Subtype.val ⁻¹' discBd E : Set ↥(discInt E)ᶜ) = discBd E := + image_preimage_eq_of_subset fun x hx => ⟨⟨x, hsub hx⟩, rfl⟩ + have hNcp : IsPreconnected (Subtype.val ⁻¹' discBd E : Set ↥(discInt E)ᶜ) := by + rw [Topology.IsInducing.subtypeVal.isPreconnected_image.symm, hvN] + exact hNc.isPreconnected + have hN : φ ⁻¹' closure e ∈ cuffs ↥(discInt E)ᶜ := by + rw [hNeq] + obtain ⟨x₀, hx₀⟩ := hNc.nonempty + have hnb : (⟨x₀, hsub hx₀⟩ : ↥(discInt E)ᶜ) ∈ bd ↥(discInt E)ᶜ := by + rw [hbdY] + exact .inr hx₀ + refine ⟨⟨x₀, hsub hx₀⟩, hnb, Subset.antisymm ?_ ?_⟩ + · have hconn' : IsPreconnected (connectedComponentIn (bd ↥(discInt E)ᶜ) ⟨x₀, hsub hx₀⟩) := + isPreconnected_connectedComponentIn + intro y hy + by_contra hyN + have h1 := connectedComponentIn_subset _ _ hy + rw [hbdY] at h1 + have hyb : y.1 ∈ bd S := h1.resolve_right hyN + have hP : IsClosed (Subtype.val ⁻¹' bd S : Set ↥(discInt E)ᶜ) := + (isClosed_bd S).preimage continuous_subtype_val + have hQ : IsClosed (Subtype.val ⁻¹' discBd E : Set ↥(discInt E)ᶜ) := + hs.disc.isOArc_discBd.isCompact.isClosed.preimage continuous_subtype_val + obtain ⟨z, -, hz1, hz2⟩ := isPreconnected_closed_iff.mp hconn' _ _ hP hQ (fun z hz => by + have h2 := connectedComponentIn_subset _ _ hz + rw [hbdY] at h2 + exact h2) ⟨y, hy, hyb⟩ ⟨_, mem_connectedComponentIn hnb, hx₀⟩ + have h3 : z.1 ∈ E ∩ bd S := ⟨Surface.discBd_subset _ hz2, hz1⟩ + rw [hs.off_bd] at h3 + exact h3 + · refine hNcp.subset_connectedComponentIn hx₀ fun y hy => ?_ + rw [hbdY] + exact .inr hy + have hcap' : IsCappedCuff (φ ⁻¹' closure e) S Subtype.val E := by + have hI : Subtype.val '' (φ ⁻¹' closure e) = discBd E := by rw [hNeq, hvN] + have hran : range (Subtype.val : ↥(discInt E)ᶜ → S) = (discInt E)ᶜ := Subtype.range_coe + refine ⟨hN, hS, Topology.IsEmbedding.subtypeVal, hs.disc, hI.symm, ?_, ?_⟩ + · rw [hran] + ext x + simp only [mem_union, mem_compl_iff, mem_univ, iff_true] + by_cases hx : x ∈ discInt E + · exact .inr hx.1 + · exact .inl hx + · rw [hran, hI] + ext x + constructor + · rintro ⟨h1, h2⟩ + by_contra h3 + exact h1 ⟨h2, h3⟩ + · exact fun hx => ⟨hsub hx, Surface.discBd_subset _ hx⟩ + refine ⟨↥(discInt E)ᶜ, inferInstance, inferInstance, φ, G', he, hl, hd, hYs, ?_, ?_, ?_, ?_, + ?_, hinj, hN, hbd_eq, ?_, ?_, ?_, ?_⟩ + · obtain ⟨a', b', c', ⟨m⟩⟩ := classification _ hYs hYc + obtain ⟨h0, ⟨m'⟩⟩ := paste_model hYs hN hS hcl.isClosedEmbedding_subtypeVal hs.disc + hcap'.union_eq hcap'.inter_eq + hcap'.discBd_eq m + obtain ⟨h1, h2, h3⟩ := (modelCriterion.2 a' b' (c' - 1) a b c).mp ⟨m'.symm.trans h⟩ + obtain ⟨m''⟩ := (modelCriterion.2 a' b' c' a b (c + 1)).mpr ⟨by omega, h2, h3⟩ + exact ⟨m.trans m''⟩ + · exact hφc.isClosedMap.isQuotientMap hφc hφs + · rintro y ⟨hy, hU⟩ + change φ y ∈ (G.deleteEdge e).V + change φ y ∈ (G.deleteEdge e).U at hU + rw [hU₁] at hU + rw [hV₁] + rw [hbd_eq] at hy + rcases hy with hy | hy + · exact hG ⟨hy, hU.1⟩ + · have h2 : φ y ∈ closure e ∩ G.V := by + refine ⟨hy, ?_⟩ + have h3 : φ y ∈ ({u, v} : Set S) := by simpa using hmemV _ hy hU.2 + rw [← hcap] at h3 + exact h3.2 + exact h2.2 + · change φ ⁻¹' (G.deleteEdge e).U = φ ⁻¹' (G.U \ e) + rw [hU₁] + · change φ ⁻¹' (G.deleteEdge e).V = φ ⁻¹' G.V + rw [hV₁] + · exact ⟨Subtype.val, E, fun q => κ (q.1, q.2.1), hcap', hs.cont.comp (continuous_fst.prodMk + (continuous_subtype_val.comp continuous_snd)), + fun y => hs.c0 y.1, fun y => rfl⟩ + · intro x + refine (Set.Finite.preimage Subtype.val_injective.injOn (hs.fiber x)).subset ?_ + intro y hy + exact ⟨y.2, hy⟩ + · intro x + obtain ⟨a, b, hab⟩ := hs.pair x + refine (ncard_le_ncard_of_injOn Subtype.val (fun y hy => hab ⟨y.2, hy⟩) + Subtype.val_injective.injOn (toFinite _)).trans ?_ + exact (ncard_insert_le a {b}).trans (by rw [ncard_singleton]) + · intro x hx + have hxV : x ∉ G.V := (he.2.1 hx).2 + have huv : u ∈ G.V ∧ v ∈ G.V := by + have hu : u ∈ closure e ∩ G.V := hcap ▸ (Or.inl rfl : u ∈ ({u, v} : Set S)) + have hv : v ∈ closure e ∩ G.V := hcap ▸ (Or.inr rfl : v ∈ ({u, v} : Set S)) + exact ⟨hu.2, hv.2⟩ + obtain ⟨y, y', hne, hy, hy', h1, h2⟩ := hs.two x (subset_closure hx) + (fun h => hxV (h ▸ huv.1)) (fun h => hxV (h ▸ huv.2)) + have hyi : ∀ z ∈ discBd E, z ∉ discInt E := fun z hz hi => hi.2 hz + have hsub : ({⟨y, hyi y hy⟩, ⟨y', hyi y' hy'⟩} : Set ↥(discInt E)ᶜ) ⊆ φ ⁻¹' {x} := by + rintro z (rfl | rfl) + · exact h1 + · exact h2 + have hfin : (φ ⁻¹' {x}).Finite := + (Set.Finite.preimage Subtype.val_injective.injOn (hs.fiber x)).subset fun z hz => ⟨z.2, hz⟩ + refine le_trans (le_of_eq ?_) (ncard_le_ncard hsub hfin) + rw [ncard_pair fun h => hne (congrArg Subtype.val h)] + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CutConnected.lean b/LeanPool/GraphMinor/GM07/CutConnected.lean new file mode 100644 index 0000000000..db94089d9d --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CutConnected.lean @@ -0,0 +1,379 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.ShrinkForest +public import LeanPool.GraphMinor.GM07.FlatMinimal +public import LeanPool.GraphMinor.GM07.Section11f +public import LeanPool.GraphMinor.Surface.TriLocal +public import LeanPool.GraphMinor.Surface.SurfacePull + +/-! +# The part of a cut surface over a tree is connected + +Let `T` be a component of a forest `L` with no `O`-arc and no `I`-arc, and let `φ` be the map of the +cut along `U(L)`. We show that `φ⁻¹(T)` is connected (`isPreconnected_preimage_tree`). This is what +lets us see `φ⁻¹(T)` as an arc of a cuff in (4.4) of Graph Minors VII. + +The reason is that a forest does not separate an open set. A line with a free end does not separate, +because a path that crosses it can be moved off it by the slide `exists_line_slide` +(`isPreconnected_sdiff_line`). Lines are removed in the order of a growth +(`isPreconnected_sdiff_growth`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S S' : Type} [TopologicalSpace S] [TopologicalSpace S'] + +/-- **A line with an end outside `X` does not separate the open set `X`.** A path in `X` misses that +end, so it misses a piece of the line next to it. The slide of the rest of the line into a small set +off the path gives a path off the line. -/ +theorem isPreconnected_sdiff_line (hS : IsSurface S) {X : Set S} (hXo : IsOpen X) + (hXc : IsPreconnected X) {c : unitInterval → S} (hc : IsArcMap c) (h0 : c 0 ∉ X) + (hin : ∀ s, s ≠ 0 → c s ∈ X) (hbd : ∀ s, s ≠ 0 → c s ∉ bd S) : + IsPreconnected (X \ range c) := by + classical + have ht2 : T2Space S := hS.2.1 + rcases (X \ range c).eq_empty_or_nonempty with he | hne + · rw [he] + exact isPreconnected_empty + refine (IsPathConnected.isConnected ?_).isPreconnected + rw [isPathConnected_iff] + refine ⟨hne, fun u hu v hv => ?_⟩ + have hXp : IsPathConnected X := isPathConnected_of_isOpen hS hXo ⟨⟨u, hu.1⟩, hXc⟩ + have hJ : JoinedIn X u v := hXp.joinedIn u hu.1 v hv.1 + let γ := hJ.somePath + have hγ : ∀ t, γ t ∈ X := hJ.somePath_mem + have hGc : IsClosed (range γ) := (isCompact_range γ.continuous).isClosed + obtain ⟨t, ht0, ht1, htN⟩ := exists_initial hc.1 hGc.isOpen_compl (by + rintro ⟨w, hw⟩ + exact h0 (hw ▸ hγ w)) + obtain ⟨A, hA, hA0, hAf, hfA, -⟩ := exists_tail hc ht0 ht1 + have hne0 : ∀ s', t < s' → s' ≠ 0 := fun s' h h0 => by + rw [h0] at h + exact absurd (show t.1 < 0 from h) (not_lt.mpr t.2.1) + have ht00 : t ≠ 0 := fun h => by + rw [h] at ht0 + simp at ht0 + let Y : Set S := c '' Iic t + have hYc : IsClosed Y := (isClosed_Iic.isCompact.image hc.1).isClosed + let Z : Set S := Xᶜ ∪ {u, v} ∪ Y + have hZc : IsClosed Z := (hXo.isClosed_compl.union (toFinite _).isClosed).union hYc + have hoff : ∀ s, A s ∉ bd S := fun s h => by + by_cases hs : s = 0 + · rw [hs, hA0] at h + exact hbd t ht00 h + · obtain ⟨s', hs', he⟩ := hAf s hs + exact hbd s' (hne0 s' hs') (he ▸ h) + let N : Set S := X ∩ (range γ)ᶜ + have hN : IsOpen N := hXo.inter hGc.isOpen_compl + have hA0N : A 0 ∈ N := by + rw [hA0] + exact ⟨hin t ht00, htN t le_rfl⟩ + obtain ⟨α, -, hz, hA'⟩ := exists_line_slide hS hA hoff hZc (fun s hs h => by + obtain ⟨s', hs', he⟩ := hAf s hs + rw [he] at h + rcases h with (h | h) | ⟨s'', hs'', he'⟩ + · exact h (hin s' (hne0 s' hs')) + · rcases h with h | h + · exact hu.2 ⟨s', h⟩ + · exact hv.2 ⟨s', h⟩ + · have := hc.2 he' + exact absurd (show s'' ≤ t from hs'') (not_le.mpr (this ▸ hs'))) hN hA0N + have huN : u ∉ N := fun h => h.2 ⟨0, γ.source⟩ + have hvN : v ∉ N := fun h => h.2 ⟨1, γ.target⟩ + have hαu : α u = u := by + rcases hz u (.inl (.inr (.inl rfl))) with h | h + · exact h + · exact (huN h.1).elim + have hαv : α v = v := by + rcases hz v (.inl (.inr (.inr rfl))) with h | h + · exact h + · exact (hvN h.1).elim + have hs1 : α.symm u = u := by rw [Homeomorph.symm_apply_eq, hαu] + have hs2 : α.symm v = v := by rw [Homeomorph.symm_apply_eq, hαv] + refine ⟨(γ.map α.symm.continuous).cast hs1.symm hs2.symm, fun s => ?_⟩ + change α.symm (γ s) ∈ X \ range c + set w := α.symm (γ s) with hw + have hαw : α w = γ s := by rw [hw, Homeomorph.apply_symm_apply] + have hoffG : α w ∈ range γ := ⟨s, hαw.symm⟩ + constructor + · by_contra hwX + rcases hz w (.inl (.inl hwX)) with h' | h' + · rw [hαw] at h' + exact hwX (h' ▸ hγ s) + · exact hwX h'.1.1 + · rintro ⟨s', hs'⟩ + by_cases hst : s' ≤ t + · rcases hz w (.inr ⟨s', hst, hs'⟩) with h' | h' + · rw [h'] at hoffG + exact htN s' hst (hs' ▸ hoffG) + · exact h'.2.2 hoffG + · obtain ⟨s'', he⟩ := hfA s' (le_of_not_ge hst) + have h1 := hA' s'' + rw [he, hs'] at h1 + exact h1.2 hoffG + +/-- **A free line in `X` off the boundary does not separate `X`.** -/ +theorem isPreconnected_sdiff_free (hS : IsSurface S) {X : Set S} (hXo : IsOpen X) + (hXc : IsPreconnected X) (hXb : Disjoint X (bd S)) {c : unitInterval → S} (hc : IsArcMap c) + (hin : ∀ s, c s ∈ X) : + IsPreconnected (X \ range c) := by + classical + have ht2 : T2Space S := hS.2.1 + obtain ⟨T, tT, j, Kc, hT, hj, hKc, hu, hi', -⟩ := exists_capAll S hS + have : T2Space T := hT.2.1 + obtain ⟨N', hN', hNe⟩ := hj.isInducing.isOpen_iff.mp hXo + have himg : j '' X = N' ∩ Kcᶜ := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + refine ⟨(hNe ▸ hx : x ∈ j ⁻¹' N'), fun hk => ?_⟩ + have : j x ∈ j '' bd S := by + rw [← hi'] + exact ⟨mem_range_self _, hk⟩ + obtain ⟨x', hx', he⟩ := this + exact disjoint_left.mp hXb hx (hj.injective he ▸ hx') + · rintro ⟨h1, h2⟩ + rcases hu.symm ▸ mem_univ y with ⟨x, rfl⟩ | h + · exact ⟨x, hNe ▸ (h1 : x ∈ j ⁻¹' N'), rfl⟩ + · exact (h2 h).elim + have hp := IsPreconnected.diff_point hT (hXc.image j hj.continuous.continuousOn) + (by rw [himg]; exact hN'.inter hKc.isOpen_compl) (j (c 0)) + have hX₁c : IsPreconnected (X \ {c 0}) := by + rw [← hj.isInducing.isPreconnected_image, image_sdiff hj.injective, image_singleton] + exact hp + have h := isPreconnected_sdiff_line hS (hXo.sdiff isClosed_singleton) hX₁c hc (fun h => h.2 rfl) + (fun s hs => ⟨hin s, fun h => hs (hc.2 h)⟩) fun s _ h => disjoint_left.mp hXb (hin s) h + have he : (X \ {c 0}) \ range c = X \ range c := by + ext z + constructor + · exact fun h => ⟨h.1.1, h.2⟩ + · exact fun h => ⟨⟨h.1, fun hz => h.2 ⟨0, hz.symm⟩⟩, h.2⟩ + rwa [he] at h + +/-- **A forest does not separate.** Remove the lines of a growth from an open connected set `X` one +at a time. Each line either misses `X` or lies in it, apart from its first end. -/ +theorem isPreconnected_sdiff_growth (hS : IsSurface S) {B : Set S} {l : List (Set S)} {k : ℕ} + (h : IsGrowth B l k) : + ∀ X : Set S, bd S ⊆ B → IsOpen X → IsPreconnected X → Disjoint X B → (∀ A ∈ l, Disjoint A X + ∨ A ⊆ X ∪ B) → IsPreconnected (X \ listUnion l) := by + classical + have ht2 : T2Space S := hS.2.1 + have hlines : ∀ {A X B : Set S} {l : List (Set S)}, IsClosed A → (∀ A' ∈ A :: l, Disjoint A' X + ∨ A' ⊆ X ∪ B) → ∀ A' ∈ l, Disjoint A' (X \ A) ∨ A' ⊆ (X \ A) ∪ (B ∪ A) + := fun {A X B l} _ h A' hA' => by + rcases h A' (List.mem_cons_of_mem _ hA') with h1 | h1 + · exact .inl (h1.mono_right sdiff_subset) + · refine .inr fun z hz => ?_ + by_cases hzA : z ∈ A + · exact .inr (.inr hzA) + · rcases h1 hz with h2 | h2 + · exact .inl ⟨h2, hzA⟩ + · exact .inr (.inl h2) + have hlines' : ∀ {A X B : Set S} {l : List (Set S)}, (∀ A' ∈ A :: l, Disjoint A' X ∨ A' ⊆ X ∪ B) + → ∀ A' ∈ l, Disjoint A' X ∨ A' ⊆ X ∪ (B ∪ A) := fun {A X B l} h A' hA' => by + rcases h A' (List.mem_cons_of_mem _ hA') with h1 | h1 + · exact .inl h1 + · exact .inr fun z hz => (h1 hz).imp id .inl + have hset : ∀ {A X : Set S} {l : List (Set S)}, X \ listUnion (A :: l) = (X \ A) \ listUnion l + := fun {A X l} => by + ext z + simp only [listUnion_cons, mem_sdiff, mem_union] + tauto + have hset' : ∀ {A X : Set S} {l : List (Set S)}, Disjoint A X → X \ listUnion (A :: l) + = X \ listUnion l := fun {A X l} hd => by + ext z + simp only [listUnion_cons, mem_sdiff, mem_union] + constructor + · exact fun h => ⟨h.1, fun h' => h.2 (.inr h')⟩ + · refine fun h => ⟨h.1, ?_⟩ + rintro (h' | h') + · exact disjoint_left.mp hd h' h.1 + · exact h.2 h' + induction h with + | nil B => + intro X _ _ hc _ _ + simpa using hc + | @free B A l k hA hd _ ih => + intro X hb hXo hXc hXB hl + rcases hl A List.mem_cons_self with h1 | h1 + · rw [hset' h1] + refine ih X (hb.trans subset_union_left) hXo hXc ?_ (hlines' hl) + exact disjoint_union_right.mpr ⟨hXB, h1.symm⟩ + · obtain ⟨f⟩ := hA + have hL : IsLineWithEnds A (f 0).1 (f 1).1 := ⟨f, rfl, rfl⟩ + have hAc := hL.isCompact.isClosed + have hc : IsArcMap fun t => (f t).1 := ⟨by fun_prop, fun x y h => f.injective (Subtype.ext h)⟩ + have hr : range (fun t => (f t).1) = A := by + ext z + exact ⟨by rintro ⟨t, rfl⟩; exact (f t).2, fun hz => ⟨f.symm ⟨z, hz⟩, by simp⟩⟩ + have hAX : ∀ t, (f t).1 ∈ X := fun t => (h1 (f t).2).resolve_right fun h => by + have : (f t).1 ∈ A ∩ B := ⟨(f t).2, h⟩ + rw [hd] at this + exact this + have h2 := isPreconnected_sdiff_free hS hXo hXc (hXB.mono_right hb) hc hAX + rw [hr] at h2 + rw [hset] + refine ih (X \ A) (hb.trans subset_union_left) (hXo.sdiff hAc) h2 ?_ (hlines hAc hl) + exact disjoint_union_right.mpr ⟨hXB.mono_left sdiff_subset, disjoint_sdiff_left⟩ + | @attached B A l k p q hA hd _ ih => + intro X hb hXo hXc hXB hl + rcases hl A List.mem_cons_self with h1 | h1 + · rw [hset' h1] + refine ih X (hb.trans subset_union_left) hXo hXc ?_ (hlines' hl) + exact disjoint_union_right.mpr ⟨hXB, h1.symm⟩ + · obtain ⟨f, h0, h2⟩ := hA + have hL : IsLineWithEnds A p q := ⟨f, h0, h2⟩ + have hAc := hL.isCompact.isClosed + have hc : IsArcMap fun t => (f t).1 := ⟨by fun_prop, fun x y h => f.injective (Subtype.ext h)⟩ + have hr : range (fun t => (f t).1) = A := by + ext z + exact ⟨by rintro ⟨t, rfl⟩; exact (f t).2, fun hz => ⟨f.symm ⟨z, hz⟩, by simp⟩⟩ + have hoffB : ∀ s, s ≠ 0 → (f s).1 ∉ B := fun s hs h => by + have h3 : (f s).1 ∈ A ∩ B := ⟨(f s).2, h⟩ + rw [hd] at h3 + have h4 : (f s).1 = (f 0).1 := h3.trans h0.symm + exact hs (f.injective (Subtype.ext h4)) + have hpB : (f 0).1 ∈ B := by + have : p ∈ A ∩ B := by rw [hd]; rfl + rw [h0] + exact this.2 + have h3 := isPreconnected_sdiff_line hS hXo hXc hc (fun h => disjoint_left.mp hXB h hpB) + (fun s hs => (h1 (f s).2).resolve_right (hoffB s hs)) fun s hs h => hoffB s hs (hb h) + rw [hr] at h3 + rw [hset] + refine ih (X \ A) (hb.trans subset_union_left) (hXo.sdiff hAc) h3 ?_ (hlines hAc hl) + exact disjoint_union_right.mpr ⟨hXB.mono_left sdiff_subset, disjoint_sdiff_left⟩ + +theorem IsGrowth.isLine {B : Set S} {l : List (Set S)} {k : ℕ} (h : IsGrowth B l k) : ∀ A ∈ l, + IsLine A := by + induction h with + | nil B => simp + | free hA _ _ ih => + intro A' h + rcases List.mem_cons.mp h with rfl | h + · exact hA + · exact ih A' h + | attached hA _ _ ih => + intro A' h + rcases List.mem_cons.mp h with rfl | h + · obtain ⟨f, -, -⟩ := hA + exact ⟨f⟩ + · exact ih A' h + +theorem IsLine.isPreconnected {A : Set S} (h : IsLine A) : IsPreconnected A := by + obtain ⟨f⟩ := h + have hr : A = range fun t => (f t).1 := by + ext z + exact ⟨fun hz => ⟨f.symm ⟨z, hz⟩, by simp⟩, by rintro ⟨t, rfl⟩; exact (f t).2⟩ + rw [hr] + exact isPreconnected_range (by fun_prop) + +/-- **The part of a cut surface over a component of the forest is connected.** A small connected +open set `W` around `T` stays connected when the forest and `bd(Σ)` are removed. So its preimage off +`bd(Σ')` is connected, and `φ⁻¹(T)` lies in the closure of this preimage. -/ +theorem isPreconnected_preimage_tree (hS : IsSurface S) {L : Drawing S} {φ : S' → S} + (hJ : IsCutAlongGraph L S' φ) (hN : NoArcs L) {T : Set S} (hT : IsPreconnected T) + (hTc : IsClosed T) (hrest : IsClosed (L.U \ T)) : + IsPreconnected (φ ⁻¹' T) := by + classical + have ht2 : T2Space S := hS.2.1 + have hY := hJ.isSurface + have : CompactSpace S' := hY.1 + have : T2Space S' := hY.2.1 + have hlc := hS.locallyConnected + have hcont := hJ.quotientMap.continuous + rcases T.eq_empty_or_nonempty with rfl | ⟨t₀, ht₀⟩ + · simpa using isPreconnected_empty + rw [isPreconnected_iff_subset_of_disjoint_closed] + intro u v hu hv hsub huv + have hAc : IsClosed (φ ⁻¹' T) := hTc.preimage hcont + obtain ⟨U', V', hU', hV', huU, hvV, hd⟩ := normal_separation (hu.inter hAc) (hv.inter hAc) + (disjoint_iff_inter_eq_empty.mpr (by + ext z + have := Set.ext_iff.mp huv z + simp only [mem_inter_iff, mem_empty_iff_false, iff_false] at this ⊢ + tauto)) + let E : Set S' := (U' ∪ V')ᶜ + have hEc : IsClosed E := (hU'.union hV').isClosed_compl + have hφE : IsClosed (φ '' E) := hcont.isClosedMap _ hEc + let P : Set S := (φ '' E ∪ (L.U \ T))ᶜ + have hPo : IsOpen P := (hφE.union hrest).isOpen_compl + have hTP : T ⊆ P := by + rintro t ht (⟨e, he, rfl⟩ | h) + · rcases hsub ht with h | h + · exact he (.inl (huU ⟨h, ht⟩)) + · exact he (.inr (hvV ⟨h, ht⟩)) + · exact h.2 ht + let W : Set S := connectedComponentIn P t₀ + have hWo : IsOpen W := hPo.connectedComponentIn + have hTW : T ⊆ W := hT.subset_connectedComponentIn ht₀ hTP + have hWP : W ⊆ P := connectedComponentIn_subset _ _ + obtain ⟨l, k, hg, hun, -⟩ := exists_growth _ L rfl hJ.isProper hN + have hUl : listUnion l = L.U := by rw [hun, ← U_eq_biUnion_closure hJ.noIsolated] + let X : Set S := W \ bd S + have hXo : IsOpen X := hWo.sdiff (isClosed_bd S) + have hXc : IsPreconnected X := isPreconnected_diff_bd hS hWo isPreconnected_connectedComponentIn + have hl : ∀ A ∈ l, Disjoint A X ∨ A ⊆ X ∪ bd S := fun A hA => by + have hAL : A ⊆ L.U := fun z hz => hUl ▸ (mem_sUnion_of_mem hz hA : z ∈ listUnion l) + have hcov : A ⊆ T ∪ (L.U \ T) := fun z hz => by + by_cases hzT : z ∈ T + · exact .inl hzT + · exact .inr ⟨hAL hz, hzT⟩ + rcases (isPreconnected_iff_subset_of_disjoint_closed.mp (IsLine.isPreconnected + (hg.isLine A hA))) _ _ hTc hrest hcov (by + ext z + simp only [mem_inter_iff, mem_sdiff, mem_empty_iff_false, iff_false] + tauto) with h | h + · refine .inr fun z hz => ?_ + by_cases hb : z ∈ bd S + · exact .inr hb + · exact .inl ⟨hTW (h hz), hb⟩ + · refine .inl (disjoint_left.mpr fun z hz hzX => ?_) + exact hWP hzX.1 (.inr (h hz)) + have hX₀ := isPreconnected_sdiff_growth hS hg X subset_rfl hXo hXc disjoint_sdiff_left hl + have hF : IsClosed (bd S ∪ L.U) := (isClosed_bd S).union L.isClosed_U + have hm : GM19.IsCutMap φ (bd S ∪ L.U) := hJ.toSet.isCutMap + have hsubF : X \ listUnion l ⊆ (bd S ∪ L.U)ᶜ := by + rintro z ⟨hz, hzl⟩ (h | h) + · exact hz.2 h + · exact hzl (hUl ▸ h) + have hC₀ := GM19.isPreconnected_preimage_of_isCutMap hm hF hsubF hX₀ + set C₀ : Set S' := φ ⁻¹' (X \ listUnion l) with hC₀def + have hAcl : φ ⁻¹' T ⊆ closure C₀ := fun x hx => by + have h1 := mem_closure_compl_bd (hY.2.2 x) + have h2 := (hWo.preimage hcont).inter_closure ⟨hTW hx, h1⟩ + refine closure_mono (fun y hy => ?_) h2 + have hyF : φ y ∉ bd S ∪ L.U := fun h => hy.2 (by rw [← hJ.preimage_bd_union_U]; exact h) + refine ⟨⟨hy.1, fun h => hyF (.inl h)⟩, fun h => hyF (.inr (hUl ▸ h))⟩ + have hC : IsPreconnected (C₀ ∪ φ ⁻¹' T) := hC₀.subset_closure subset_union_left + (union_subset subset_closure hAcl) + have hCsub : C₀ ∪ φ ⁻¹' T ⊆ U' ∪ V' := by + have key : ∀ y, φ y ∈ P → y ∈ U' ∪ V' := fun y hy => by + by_contra hn + exact hy (.inl ⟨y, hn, rfl⟩) + rintro y (hy | hy) + · exact key y (hWP hy.1.1) + · exact key y (hTP hy) + rcases hC.subset_or_subset hU' hV' hd hCsub with h | h + · refine .inl fun x hx => ?_ + rcases hsub hx with h1 | h1 + · exact h1 + · exact (disjoint_left.mp hd (h (.inr hx)) (hvV ⟨h1, hx⟩)).elim + · refine .inr fun x hx => ?_ + rcases hsub hx with h1 | h1 + · exact (disjoint_left.mp hd (huU ⟨h1, hx⟩) (h (.inr hx))).elim + · exact h1 + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CutDraw.lean b/LeanPool/GraphMinor/GM07/CutDraw.lean new file mode 100644 index 0000000000..75880b6ca1 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CutDraw.lean @@ -0,0 +1,217 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.GM07.Taper + +/-! +# Pulling a drawing back along a map + +Let `f : Y → S` be a continuous onto map from a compact space that is one to one over `U(G)`. Then +`f⁻¹(G)` is a drawing in `Y` +(`pullDrawing`), since `f` is a homeomorphism over `U(G)`. We use this to define the graph left +after cutting along an edge. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u v + +variable {Y : Type u} {S : Type v} [TopologicalSpace Y] [TopologicalSpace S] + +/-- `f` is a homeomorphism over a closed set on whose preimage it is one to one. -/ +theorem exists_homeo_preimage [CompactSpace Y] [T2Space S] {f : Y → S} (hf : Continuous f) + (hs : Function.Surjective f) + {K : Set S} (hK : IsClosed K) (hi : InjOn f (f ⁻¹' K)) : + ∃ k : f ⁻¹' K ≃ₜ K, ∀ p, (k p).1 = f p.1 := by + have : CompactSpace (f ⁻¹' K) := isCompact_iff_compactSpace.mp (hK.preimage hf).isCompact + let m : f ⁻¹' K → K := fun p => ⟨f p.1, p.2⟩ + have hmc : Continuous m := Continuous.subtype_mk (hf.comp continuous_subtype_val) _ + have hmb : Function.Bijective m := by + constructor + · intro p p' he + exact Subtype.ext (hi p.2 p'.2 (congrArg Subtype.val he)) + · rintro ⟨s, hs'⟩ + obtain ⟨p, rfl⟩ := hs s + exact ⟨⟨p, hs'⟩, rfl⟩ + exact ⟨Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective m hmb) hmc, fun p => rfl⟩ + +/-- A subset of `K` is path connected exactly when its preimage is. -/ +theorem isPathConnected_preimage_iff [CompactSpace Y] [T2Space S] {f : Y → S} (hf : Continuous f) + (hs : Function.Surjective f) {K A : Set S} (hK : IsClosed K) (hi : InjOn f (f ⁻¹' K)) + (hA : A ⊆ K) : + IsPathConnected (f ⁻¹' A) ↔ IsPathConnected A := by + constructor + · intro h + have h1 := h.image hf + rwa [image_preimage_eq _ hs] at h1 + · intro h + obtain ⟨k, hk⟩ := exists_homeo_preimage hf hs hK hi + have hAe : f ⁻¹' A = (fun x => (k.symm x).1) '' ((↑) ⁻¹' A : Set K) := by + ext y + constructor + · intro hy + refine ⟨⟨f y, hA hy⟩, hy, ?_⟩ + have h2 : k ⟨y, hA hy⟩ = ⟨f y, hA hy⟩ := Subtype.ext (hk _) + rw [← h2] + change (k.symm (k _)).1 = y + rw [k.symm_apply_apply] + · rintro ⟨x, hx, rfl⟩ + change f (k.symm x).1 ∈ A + rw [← hk, k.apply_symm_apply] + exact hx + rw [hAe] + have h3 : IsPathConnected ((↑) ⁻¹' A : Set K) := by + rw [Topology.IsInducing.subtypeVal.isPathConnected_iff, image_preimage_eq_of_subset + (by simpa using hA)] + exact h + exact h3.image (continuous_subtype_val.comp k.symm.continuous) + +theorem arcComponentsIn_preimage [CompactSpace Y] [T2Space S] {f : Y → S} (hf : Continuous f) + (hs : Function.Surjective f) + {K F : Set S} (hK : IsClosed K) (hi : InjOn f (f ⁻¹' K)) (hF : F ⊆ K) : + arcComponentsIn (f ⁻¹' F) = preimage f '' arcComponentsIn F := by + have hconn := fun {A : Set S} (h : A ⊆ K) => isPathConnected_preimage_iff hf hs hK hi h + ext D + constructor + · rintro ⟨hne, hsub, hpc, hmax⟩ + have hD : f ⁻¹' (f '' D) = D := by + ext y + constructor + · rintro ⟨x, hx, he⟩ + have h1 : x ∈ f ⁻¹' K := hF (hsub hx) + have h2 : y ∈ f ⁻¹' K := by + change f y ∈ K + rw [← he] + exact h1 + rwa [← hi h1 h2 he] + · exact fun hy => ⟨y, hy, rfl⟩ + refine ⟨f '' D, ⟨hne.image f, ?_, hpc.image hf, fun A hA hpA hCA => ?_⟩, hD⟩ + · rintro _ ⟨x, hx, rfl⟩ + exact hsub hx + · have h1 : D ⊆ f ⁻¹' A := fun x hx => hCA (mem_image_of_mem f hx) + have h2 := hmax _ (preimage_mono hA) ((hconn (hA.trans hF)).mpr hpA) h1 + rw [← h2, image_preimage_eq _ hs] + · rintro ⟨C, ⟨hne, hsub, hpc, hmax⟩, rfl⟩ + refine ⟨?_, preimage_mono hsub, (hconn (hsub.trans hF)).mpr hpc, fun B hB hpB hDB => ?_⟩ + · obtain ⟨x, hx⟩ := hne + obtain ⟨y, rfl⟩ := hs x + exact ⟨y, hx⟩ + · have hsA : f '' B ⊆ F := by + rintro _ ⟨x, hx, rfl⟩ + exact hB hx + have h1 : C ⊆ f '' B := fun x hx => by + obtain ⟨y, rfl⟩ := hs x + exact ⟨y, hDB hx, rfl⟩ + have h2 := hmax _ hsA (hpB.image hf) h1 + apply Subset.antisymm _ hDB + intro y hy + change f y ∈ C + rw [← h2] + exact mem_image_of_mem f hy + +theorem closure_preimage_of_injOn [CompactSpace Y] [T2Space S] {f : Y → S} (hf : Continuous f) + (hs : Function.Surjective f) + {C : Set S} (hi : InjOn f (f ⁻¹' closure C)) : closure (f ⁻¹' C) = f ⁻¹' closure C := by + apply Subset.antisymm (closure_minimal (preimage_mono subset_closure) + (isClosed_closure.preimage hf)) + intro y hy + obtain ⟨k, hk⟩ := exists_homeo_preimage hf hs isClosed_closure hi + have hx : (⟨f y, hy⟩ : closure C) ∈ closure ((↑) ⁻¹' C : Set (closure C)) := by + rw [Topology.IsInducing.subtypeVal.closure_eq_preimage_closure_image] + change f y ∈ closure ((↑) '' ((↑) ⁻¹' C : Set (closure C))) + rwa [image_preimage_eq_of_subset (by simpa using subset_closure)] + have hg : Continuous fun x : closure C => (k.symm x).1 := continuous_subtype_val.comp + k.symm.continuous + have h1 := map_mem_closure hg hx (t := f ⁻¹' C) fun x hx' => by + change f (k.symm x).1 ∈ C + rw [← hk, k.apply_symm_apply] + exact hx' + have h2 : k.symm ⟨f y, hy⟩ = ⟨y, hy⟩ := by + rw [Homeomorph.symm_apply_eq] + exact Subtype.ext (hk ⟨y, hy⟩).symm + simpa [h2] using h1 + +/-- The preimage of a drawing under a map one to one over it. -/ +def pullDrawing [CompactSpace Y] [T2Space S] (G₁ : Drawing S) {f : Y → S} (hf : Continuous f) + (hs : Function.Surjective f) (hi : InjOn f (f ⁻¹' G₁.U)) : Drawing Y where + U := f ⁻¹' G₁.U + V := f ⁻¹' G₁.V + V_subset_U := preimage_mono G₁.V_subset_U + isClosed_U := G₁.isClosed_U.preimage hf + finite_V := G₁.finite_V.preimage (hi.mono (preimage_mono G₁.V_subset_U)) + finite_edges := by + rw [← preimage_sdiff, arcComponentsIn_preimage hf hs G₁.isClosed_U hi sdiff_subset] + exact G₁.finite_edges.image _ + edge_cond := by + rw [← preimage_sdiff, arcComponentsIn_preimage hf hs G₁.isClosed_U hi sdiff_subset] + rintro _ ⟨C, hC, rfl⟩ + have hCU : closure C ⊆ G₁.U := closure_minimal (hC.2.1.trans sdiff_subset) G₁.isClosed_U + have hic : InjOn f (f ⁻¹' closure C) := hi.mono (preimage_mono hCU) + rw [closure_preimage_of_injOn hf hs hic, ← preimage_inter] + obtain ⟨k, hk⟩ := exists_homeo_preimage hf hs isClosed_closure hic + have hlift : ∀ q : closure C, f (k.symm q).1 = q.1 := fun q => by + rw [← hk, k.apply_symm_apply] + rcases G₁.edge_cond C hC with ⟨u, v, huv, hcap, l, h0, h1⟩ | ⟨u, hcap, ⟨l⟩⟩ + · left + refine ⟨(k.symm (l 0)).1, (k.symm (l 1)).1, ?_, ?_, l.trans k.symm, rfl, rfl⟩ + · intro h + have h2 := congrArg f h + rw [hlift, hlift, h0, h1] at h2 + exact huv h2 + · rw [hcap] + ext y + have hu : (k.symm (l 0)).1 ∈ f ⁻¹' closure C := (k.symm (l 0)).2 + have hv : (k.symm (l 1)).1 ∈ f ⁻¹' closure C := (k.symm (l 1)).2 + have hucl : f (k.symm (l 0)).1 = u := by rw [hlift, h0] + have hvcl : f (k.symm (l 1)).1 = v := by rw [hlift, h1] + have hmem : ∀ z, z ∈ closure C ∩ G₁.V ↔ z = u ∨ z = v := fun z => by rw [hcap]; simp + simp only [mem_preimage, mem_insert_iff, mem_singleton_iff] + constructor + · rintro (h | h) + · have hy : y ∈ f ⁻¹' closure C := by + change f y ∈ closure C + rw [h] + exact ((hmem u).mpr (.inl rfl)).1 + exact .inl (hic hy hu (h.trans hucl.symm)) + · have hy : y ∈ f ⁻¹' closure C := by + change f y ∈ closure C + rw [h] + exact ((hmem v).mpr (.inr rfl)).1 + exact .inr (hic hy hv (h.trans hvcl.symm)) + · rintro (rfl | rfl) + · exact .inl hucl + · exact .inr hvcl + · right + obtain ⟨y, hy⟩ := hs u + refine ⟨y, ?_, ⟨l.trans k.symm⟩⟩ + rw [hcap] + ext z + simp only [mem_preimage, mem_singleton_iff] + constructor + · intro h + have hu : u ∈ closure C ∩ G₁.V := by rw [hcap]; rfl + have hy' : y ∈ f ⁻¹' closure C := by + change f y ∈ closure C + rw [hy] + exact hu.1 + have hz : z ∈ f ⁻¹' closure C := by + change f z ∈ closure C + rw [h] + exact hu.1 + exact hic hz hy' (h.trans hy.symm) + · rintro rfl + exact hy + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CutEdge.lean b/LeanPool/GraphMinor/GM07/CutEdge.lean new file mode 100644 index 0000000000..91e92e4452 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CutEdge.lean @@ -0,0 +1,372 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CapMap +public import LeanPool.GraphMinor.GM07.Slit +public import LeanPool.GraphMinor.GM07.Open +import LeanPool.GraphMinor.GM19.Section6a + +/-! +# What cutting along an edge does + +Let `φ : Y → S` cut `S` along the closure of an edge `e` of `G`, and let `G'` be the graph left on +`Y`. This file holds the +facts that (7.1) and (7.2) share. A `G'`-normal set `A` that meets the new cuff only in vertices is +carried by `φ` one to one +to a `G`-normal set with the same number of vertices (`IsCutAlongEdge.image_facts`). Every +`G'`-normal set can be brought to this +form by a map homotopic to the identity (`IsCutAlongEdge.exists_push`). A closed disc that misses +`e` lifts to `Y` +(`IsCutAlongEdge.isClosedDisc_preimage`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +local notation "𝕀" => unitInterval + +variable {S Y : Type u} [TopologicalSpace S] [TopologicalSpace Y] + +/-- A surface with a model other than `Σ(0, 0, 0)` is not a sphere. -/ +theorem not_isSphere_of_model {T : Type u} [TopologicalSpace T] {a b c : ℕ} (h : Nonempty + (T ≃ₜ SurfaceModel a b c)) + (hne : ¬ (a = 0 ∧ b = 0 ∧ c = 0)) : ¬ IsSphere T := by + intro hs + obtain ⟨e⟩ := h + obtain ⟨e_s⟩ := id hs + obtain ⟨e_m⟩ := GraphMinor.GM19.isSphere_model + have hcrit := (modelCriterion.2 a b c 0 0 0).mp ⟨e.symm.trans (e_s.trans e_m.symm)⟩ + have hb : b = 0 := hcrit.2.2.mpr rfl + omega + +/-- A map homotopic to the identity keeps a set that is not planar not planar. -/ +theorem planar_of_push (hY : IsSurface Y) [ConnectedSpace Y] {H : 𝕀 × Y → Y} (hH : Continuous H) + (h0 : ∀ y, H (0, y) = y) + {X : Set Y} (hX : IsSolid X) (hne : ¬ IsSphere Y ∨ X ≠ univ) (hp : IsPlanar ((fun y => H + (1, y)) '' X)) : IsPlanar X := by + have : CompactSpace Y := hY.1 + have : T2Space Y := hY.2.1 + obtain ⟨Δ, hΔ, hs⟩ := hp + have h := isPlanar_of_homotopy hY (j := id) IsEmbedding.id hX (by simpa using hne) hH h0 + fun F _ hF => ⟨Δ, hΔ, fun y hy => hs (mem_image_of_mem _ (hF hy))⟩ + simpa using h + +/-- The inner part of a pasted disc misses the surface. -/ +theorem IsCappedCuff.image_ne_univ {T : Type u} [TopologicalSpace T] {C : Set Y} {j : Y + → T} {D : Set T} + (hc : IsCappedCuff C T j D) (X : Set Y) : j '' X ≠ univ := by + intro he + have : T2Space T := hc.isSurface.2.1 + obtain ⟨hh, g, cc⟩ := hc.isClosedDisc.exists_isChart + have h1 : g 0 ∈ discInt D := by + rw [discInt, mem_sdiff] + refine ⟨cc.gm (by simp), fun hb => ?_⟩ + have h2 : hh (g 0) ∈ sphere (0 : ℂ) 1 := cc.bd ▸ mem_image_of_mem hh hb + rw [cc.hg (by simp)] at h2 + simp at h2 + have h2 : g 0 ∈ j '' X := he ▸ mem_univ _ + obtain ⟨y, -, hy⟩ := h2 + have h3 : g 0 ∈ range j ∩ D := ⟨⟨y, hy⟩, h1.1⟩ + rw [hc.inter_eq, ← hc.discBd_eq] at h3 + exact h1.2 h3 + +/-- The same in a surface with a disc pasted on a cuff. -/ +theorem planarCap_of_push (hY : IsSurface Y) [ConnectedSpace Y] {H : 𝕀 × Y → Y} (hH : Continuous H) + (h0 : ∀ y, H (0, y) = y) + {X C : Set Y} (hX : IsSolid X) (hp : IsPlanarInCappedCuff C ((fun y => H + (1, y)) '' X)) : IsPlanarInCappedCuff C X := by + have : CompactSpace Y := hY.1 + have : T2Space Y := hY.2.1 + obtain ⟨hC, ⟨T, tT, j, D, hc, Δ, hΔ, hs⟩, -⟩ := hp + have hT := hc.isSurface + have : T2Space T := hT.2.1 + have : ConnectedSpace T := hc.connectedSpace hY + have hH' : Continuous fun q : 𝕀 × Y => j (H q) := hc.isEmbedding.continuous.comp hH + refine isPlanarInCappedCuff_of_cap hY hc + (isPlanar_of_homotopy hT hc.isEmbedding hX ?_ hH' (fun y => by rw [h0]) fun F _ hF => + ⟨Δ, hΔ, fun y hy => hs ⟨_, mem_image_of_mem _ (hF hy), rfl⟩⟩) + exact .inr (IsCappedCuff.image_ne_univ hc X) + +/-- An `O`-arc that surrounds a cuff still does so after a one to one map homotopic to the identity. +-/ +theorem surrounds_of_push (hY : IsSurface Y) [ConnectedSpace Y] {H : 𝕀 × Y → Y} (hH : Continuous H) + (h0 : ∀ y, H (0, y) = y) + (hi : Function.Injective fun y => H (1, y)) {F C : Set Y} (hF : IsOArc F) (hne : ¬ IsSphere Y) + (hs : SurroundsCuff F C) : SurroundsCuff ((fun y => H (1, y)) '' F) C := by + have : CompactSpace Y := hY.1 + have : T2Space Y := hY.2.1 + have hFs : IsSolid F := isSolid_of_isOArc hY hF + refine ⟨hs.1, ?_, fun hp => hs.2.2 (planar_of_push hY hH h0 hFs (.inl hne) hp)⟩ + obtain ⟨T, tT, j, D, hc, Δ, hΔ, hsub⟩ := hs.2.1.2.1 + have hT := hc.isSurface + have : T2Space T := hT.2.1 + have : ConnectedSpace T := hc.connectedSpace hY + have hρc : Continuous fun y => H (1, y) := hH.comp (continuous_const.prodMk continuous_id) + have hρ : IsEmbedding fun y => H (1, y) := (hρc.isClosedEmbedding hi).isEmbedding + have hemb : IsEmbedding fun y => j (H (1, y)) := hc.isEmbedding.comp hρ + let H' : 𝕀 × Y → T := fun q => j (H (unitInterval.symm q.1, q.2)) + have hH' : Continuous H' := hc.isEmbedding.continuous.comp + (hH.comp ((unitInterval.continuous_symm.comp continuous_fst).prodMk continuous_snd)) + have hp := isPlanar_of_homotopy hT hemb hFs (.inr ?_) hH' (fun y => by simp [H']) fun F' _ hF' => + ⟨Δ, hΔ, fun y hy => by + have h1 : j y ∈ Δ := hsub (mem_image_of_mem j (hF' hy)) + simpa [H', h0] using h1⟩ + · refine isPlanarInCappedCuff_of_cap hY hc ?_ + rwa [image_image] + · have h2 := IsCappedCuff.image_ne_univ hc ((fun y => H (1, y)) '' F) + rwa [image_image] at h2 + +/-- A one to one map on a compact solid set keeps it solid. -/ +theorem isSolid_image_of_injOn [CompactSpace Y] [T2Space S] {f : Y → S} + (hf : Continuous f) {Z : Set Y} (hZ : IsSolid Z) + (hi : InjOn f Z) : IsSolid (f '' Z) := by + have hcl : ∀ K : Set Y, IsClosed K → IsClosed (f '' K) := fun K hK => + (hK.isCompact.image hf).isClosed + refine ⟨?_, hcl Z hZ.2⟩ + rintro _ ⟨z, hz, rfl⟩ U hU hzU + obtain ⟨V, hVs, hzV, hVo, harc⟩ := hZ.1 z hz (f ⁻¹' U) (hU.preimage hf) hzU + let W : Set S := (f '' (Z \ V))ᶜ + have hWo : IsOpen W := (hcl _ (hZ.2.sdiff hVo)).isOpen_compl + have hzW : f z ∈ W := by + rintro ⟨x, ⟨hx, hxV⟩, he⟩ + exact hxV (hi hx hz he ▸ hzV) + refine ⟨W ∩ U, inter_subset_right, ⟨hzW, hzU⟩, hWo.inter hU, ?_⟩ + have hin : ∀ {a}, a ∈ Z → f a ∈ W → a ∈ V := fun {a} ha hw => by + by_contra hV + exact hw ⟨a, ⟨ha, hV⟩, rfl⟩ + rintro _ ⟨⟨a, ha, rfl⟩, haW, -⟩ _ ⟨⟨b, hb, rfl⟩, hbW, -⟩ hab + obtain ⟨L, hLs, g, h0, h1⟩ := harc a ⟨ha, hin ha haW⟩ b ⟨hb, hin hb hbW⟩ fun h => hab + (congrArg f h) + have hLZ : InjOn f L := hi.mono fun x hx => (hLs hx).1 + let k : 𝕀 → f '' L := fun t => ⟨f (g t).1, _, (g t).2, rfl⟩ + have hkc : Continuous k := Continuous.subtype_mk (hf.comp (continuous_subtype_val.comp + g.continuous)) _ + have hkb : Function.Bijective k := by + constructor + · intro t t' he + exact g.injective (Subtype.ext (hLZ (g t).2 (g t').2 (congrArg Subtype.val he))) + · rintro ⟨_, x, hx, rfl⟩ + exact ⟨g.symm ⟨x, hx⟩, Subtype.ext (by simp [k])⟩ + refine ⟨f '' L, ?_, Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective k hkb) hkc, ?_, ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + exact ⟨⟨x, (hLs hx).1, rfl⟩, by + intro hc + obtain ⟨x', ⟨_, hx'⟩, he⟩ := hc + exact hx' (hi ‹_› (hLs hx).1 he ▸ (hLs hx).2), hVs (hLs hx).2⟩ + · change f (g 0).1 = _ + rw [h0] + · change f (g 1).1 = _ + rw [h1] + +namespace IsCutAlongEdge + +variable [T1Space S] {G : Drawing S} {e : Set S} {a b c : ℕ} {φ : Y → S} {G' : Drawing Y} + +omit [T1Space S] in +theorem continuous (hc : IsCutAlongEdge G e a b c Y φ G') : Continuous φ + := hc.quotientMap.continuous + +omit [T1Space S] in +theorem surjective (hc : IsCutAlongEdge G e a b c Y φ G') : Function.Surjective φ + := hc.quotientMap.surjective + +omit [T1Space S] in +theorem notMem_V (hc : IsCutAlongEdge G e a b c Y φ G') {x : S} (hx : x ∈ e) : x ∉ G.V := fun hV => + (hc.mem_E.2.1 hx).2 hV + +omit [T1Space S] in +theorem mem_U (hc : IsCutAlongEdge G e a b c Y φ G') {x : S} (hx : x ∈ e) : x ∈ G.U := + (hc.mem_E.2.1 hx).1 + +omit [T1Space S] in +theorem bd_inter (hc : IsCutAlongEdge G e a b c Y φ G') {x : S} (hx : x ∈ closure e) : x ∉ bd S + := fun hb => by + have : x ∈ closure e ∩ bd S := ⟨hx, hb⟩ + rw [hc.disjoint_bd] at this + exact this + +omit [T1Space S] in +/-- A `G'`-normal set that meets the new cuff only in vertices goes one to one to a `G`-normal set +with as many vertices. -/ +theorem image_facts (hc : IsCutAlongEdge G e a b c Y φ G') {A : Set Y} (hA : G'.IsNormal A) + (hN : A ∩ φ ⁻¹' closure e ⊆ G'.V) : + InjOn φ A ∧ G.IsNormal (φ '' A) ∧ (G.V ∩ φ '' A).ncard = (G'.V ∩ A).ncard := by + have hoff : ∀ {x}, x ∈ A → φ x ∉ e := fun {x} hx he => by + have h1 : x ∈ G'.V := hN ⟨hx, subset_closure he⟩ + rw [hc.preimage_V] at h1 + exact hc.notMem_V he h1 + have hi : InjOn φ A := fun x hx y _ he => (hc.inj x y he).resolve_right (hoff hx) + refine ⟨hi, ?_, ?_⟩ + · rintro _ ⟨⟨x, hx, rfl⟩, hU⟩ + have h1 : x ∈ G'.V := hA ⟨hx, by rw [hc.preimage_U]; exact ⟨hU, hoff hx⟩⟩ + rw [hc.preimage_V] at h1 + exact h1 + · have h1 : G.V ∩ φ '' A = φ '' (G'.V ∩ A) := by + ext s + constructor + · rintro ⟨hV, x, hx, rfl⟩ + exact ⟨x, ⟨by rw [hc.preimage_V]; exact hV, hx⟩, rfl⟩ + · rintro ⟨x, ⟨hV, hx⟩, rfl⟩ + rw [hc.preimage_V] at hV + exact ⟨hV, x, hx, rfl⟩ + rw [h1, (hi.mono inter_subset_right).ncard_image] + +omit [T1Space S] in +theorem isCuff_new (hc : IsCutAlongEdge G e a b c Y φ G') : IsCuff (φ ⁻¹' closure e) := hc.newCuff + +omit [T1Space S] in +/-- Each `G'`-normal set can be pushed off the new cuff, keeping its vertices. -/ +theorem exists_push (hc : IsCutAlongEdge G e a b c Y φ G') : + ∃ H : 𝕀 × Y → Y, Continuous H ∧ (∀ y, H (0, y) = y) ∧ (Function.Injective fun y => H (1, y)) ∧ + ∀ A : Set Y, G'.IsNormal A → G'.IsNormal ((fun y => H (1, y)) '' A) ∧ + ((fun y => H (1, y)) '' A) ∩ φ ⁻¹' closure e ⊆ G'.V ∧ + (G'.V ∩ (fun y => H (1, y)) '' A).ncard = (G'.V ∩ A).ncard := by + obtain ⟨-, -, hO⟩ := cuff_statement.{u} Y hc.isSurface + obtain ⟨f⟩ := hO _ hc.isCuff_new + obtain ⟨H, hH, h0, hi, hfix, hback, hcuff⟩ := exists_taper hc.isSurface hc.isCuff_new f + G'.isClosed_U + refine ⟨H, hH, h0, hi, fun A hA => ?_⟩ + have h1 : ∀ x ∈ A, H (1, x) ∈ G'.U → H (1, x) ∈ G'.V := fun x hx hU => by + have h2 := hback x hU + rw [hfix x h2] + exact hA ⟨hx, h2⟩ + refine ⟨?_, ?_, ?_⟩ + · rintro _ ⟨⟨x, hx, rfl⟩, hU⟩ + exact h1 x hx hU + · rintro _ ⟨⟨x, hx, rfl⟩, hN⟩ + exact h1 x hx (hcuff x hN) + · congr 1 + ext s + constructor + · rintro ⟨hV, x, hx, rfl⟩ + have h2 := hback x (G'.V_subset_U hV) + have h3 : H (1, x) = x := hfix x h2 + refine ⟨hV, ?_⟩ + change H (1, x) ∈ A + rwa [h3] + · rintro ⟨hV, hs⟩ + exact ⟨hV, s, hs, hfix s (G'.V_subset_U hV)⟩ + +omit [T1Space S] in +/-- The part of `bd Y` over `bd S` is a copy of `bd S`, and it lies apart from the new cuff. -/ +theorem exists_bd_inverse (hc : IsCutAlongEdge G e a b c Y φ G') (hS : IsSurface S) : + InjOn φ (φ ⁻¹' bd S) ∧ ∃ g : S → Y, ContinuousOn g (bd S) ∧ RightInvOn g φ (bd S) ∧ MapsTo g + (bd S) (φ ⁻¹' bd S) := by + have : CompactSpace Y := hc.isSurface.1 + have : T2Space S := hS.2.1 + have hi : InjOn φ (φ ⁻¹' bd S) := fun x hx y _ he => + (hc.inj x y he).resolve_right fun h => hc.bd_inter (subset_closure h) hx + refine ⟨hi, ?_⟩ + have hK : IsCompact (φ ⁻¹' bd S) := ((isClosed_bd S).preimage hc.continuous).isCompact + have : Nonempty Y := by + obtain ⟨x, -⟩ := nonempty_of_ncard_ne_zero (s := tilde e) (by rw [hc.not_loop]; omega) + exact ⟨(hc.surjective x).choose⟩ + obtain ⟨g, hgc, hgl⟩ := exists_inv_of_compactOn hK hc.continuous.continuousOn hi + have him : φ '' (φ ⁻¹' bd S) = bd S := image_preimage_eq _ hc.surjective + rw [him] at hgc + have hr : RightInvOn g φ (bd S) := fun y hy => by + obtain ⟨x, rfl⟩ := hc.surjective y + rw [hgl (show x ∈ φ ⁻¹' bd S from hy)] + exact ⟨g, hgc, hr, fun y hy => by + change φ (g y) ∈ bd S + rwa [hr hy]⟩ + +omit [T1Space S] in +/-- The component of `bd Y` at a point over `bd S` is the preimage of the component of `bd S`. -/ +theorem component_eq (hc : IsCutAlongEdge G e a b c Y φ G') (hS : IsSurface S) {y : Y} + (hy : φ y ∈ bd S) : + connectedComponentIn (bd Y) y = φ ⁻¹' connectedComponentIn (bd S) (φ y) := by + obtain ⟨hi, g, hgc, hgr, hgm⟩ := hc.exists_bd_inverse hS + have hyb : y ∈ bd Y := by + rw [hc.bd_eq] + exact .inl hy + have hsub : ∀ {K : Set S}, K ⊆ bd S → φ ⁻¹' K = g '' K := fun {K} hK => by + ext x + constructor + · intro hx + refine ⟨φ x, hx, hi (hgm (hK hx)) (hK hx) ?_⟩ + exact hgr (hK hx) + · rintro ⟨s, hs, rfl⟩ + change φ (g s) ∈ K + rwa [hgr (hK hs)] + have hCb := connectedComponentIn_subset (bd S) (φ y) + apply Subset.antisymm + · have hP : IsClosed (φ ⁻¹' bd S) := (isClosed_bd S).preimage hc.continuous + have hN : IsClosed (φ ⁻¹' closure e) := isClosed_closure.preimage hc.continuous + have hconn : IsPreconnected (connectedComponentIn (bd Y) y) := + isPreconnected_connectedComponentIn + have hsubP : connectedComponentIn (bd Y) y ⊆ φ ⁻¹' bd S := by + intro x hx + by_contra hxP + have h1 := connectedComponentIn_subset _ _ hx + rw [hc.bd_eq] at h1 + have hxN : x ∈ φ ⁻¹' closure e := h1.resolve_left hxP + have hyin : y ∈ connectedComponentIn (bd Y) y := mem_connectedComponentIn hyb + obtain ⟨z, -, hz1, hz2⟩ := isPreconnected_closed_iff.mp hconn _ _ hP hN (fun z hz => by + have h2 := connectedComponentIn_subset _ _ hz + rw [hc.bd_eq] at h2 + exact h2) ⟨y, hyin, hy⟩ ⟨x, hx, hxN⟩ + exact hc.bd_inter hz2 hz1 + have himg : IsPreconnected (φ '' connectedComponentIn (bd Y) y) := hconn.image _ + hc.continuous.continuousOn + intro x hx + exact himg.subset_connectedComponentIn ⟨y, mem_connectedComponentIn hyb, rfl⟩ (by + rintro _ ⟨z, hz, rfl⟩ + exact hsubP hz) ⟨x, hx, rfl⟩ + · rw [hsub hCb] + have hconn : IsPreconnected (g '' connectedComponentIn (bd S) (φ y)) := + isPreconnected_connectedComponentIn.image _ (hgc.mono hCb) + refine hconn.subset_connectedComponentIn ?_ ?_ + · refine ⟨φ y, mem_connectedComponentIn hy, ?_⟩ + exact hi (hgm hy) hy (hgr hy) + · rintro _ ⟨s, hs, rfl⟩ + rw [hc.bd_eq] + exact .inl (hgm (hCb hs)) + +omit [T1Space S] in +/-- The two ways the cuffs of `Y` arise. -/ +theorem cuff_cases (hc : IsCutAlongEdge G e a b c Y φ G') (hS : IsSurface S) {C : Set Y} + (hC : C ∈ cuffs Y) : + C = φ ⁻¹' closure e ∨ ∃ C₀ ∈ cuffs S, C = φ ⁻¹' C₀ := by + obtain ⟨y, hy, rfl⟩ := hC + have hyb := hy + rw [hc.bd_eq] at hy + rcases hy with hy | hy + · exact .inr ⟨_, ⟨φ y, hy, rfl⟩, hc.component_eq hS hy⟩ + · obtain ⟨n, -, hn⟩ := hc.newCuff + refine .inl ?_ + have hy' : y ∈ φ ⁻¹' closure e := hy + rw [← hn] at hy' ⊢ + exact (connectedComponentIn_eq hy').symm + +omit [T1Space S] in +/-- The cuffs of `S` lift. -/ +theorem cuff_lift (hc : IsCutAlongEdge G e a b c Y φ G') (hS : IsSurface S) {C₀ : Set S} + (hC : C₀ ∈ cuffs S) : + φ ⁻¹' C₀ ∈ cuffs Y ∧ BijOn φ (φ ⁻¹' C₀) C₀ := by + obtain ⟨hi, -⟩ := hc.exists_bd_inverse hS + obtain ⟨s, hs, rfl⟩ := hC + obtain ⟨y, rfl⟩ := hc.surjective s + have hCb := connectedComponentIn_subset (bd S) (φ y) + refine ⟨⟨y, ?_, hc.component_eq hS hs⟩, mapsTo_preimage _ _, hi.mono (preimage_mono hCb), ?_⟩ + · rw [hc.bd_eq] + exact .inl hs + · intro x hx + obtain ⟨z, rfl⟩ := hc.surjective x + exact ⟨z, hx, rfl⟩ + +end IsCutAlongEdge + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CutEdges.lean b/LeanPool/GraphMinor/GM07/CutEdges.lean new file mode 100644 index 0000000000..edcc503d1b --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CutEdges.lean @@ -0,0 +1,702 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.RootedCut +import LeanPool.GraphMinor.GM06.Section3Dual +import LeanPool.GraphMinor.GM19.Section6a +import LeanPool.GraphMinor.GM07.ArcPlace + +/-! +# Step 2 of (9.1) + +See page 243. We cut along edges `e₁, ..., e_r` of `G`, one for each edge `f_i` of `H`, by (7.4). +The paper then takes "a homeomorphism of +$\Sigma$ which fixes every point of $bd(\Sigma)$ and maps the middle third of $f_i$ onto the whole +of $e_i$" (`exists_line_family_placement`), and +replaces `H` by its image. "Let $H' = (U(H) - Y, V(H) \cup Z)$ where $Y = e_1 \cup \dots \cup e_r$ +and $Z$ is the set of all ends of +$e_1, \dots, e_r$." Before the homeomorphism, this is the drawing obtained from `H` by removing the +open middle third of each edge +(`exists_split_middle`), which is a forest. Its image under the homeomorphism meets each `ē_i` in +the two ends of `e_i` only, so it lifts to the +cut surface `Σ_r`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- The first end of the middle third of the unit interval. -/ +@[expose] noncomputable def third₁ : I := ⟨1 / 3, by norm_num, by norm_num⟩ +/-- The second end of the middle third of the unit interval. -/ +@[expose] noncomputable def third₂ : I := ⟨2 / 3, by norm_num, by norm_num⟩ + +theorem third₁_pos : (0 : I) < third₁ := by + rw [← Subtype.coe_lt_coe] + norm_num [third₁] + +theorem third_lt : third₁ < third₂ := by + rw [← Subtype.coe_lt_coe] + norm_num [third₁, third₂] + +theorem third₂_lt : third₂ < 1 := by + rw [← Subtype.coe_lt_coe] + norm_num [third₂] + +/-- The part of an edge between two inner parameters is a line. -/ +theorem EdgeParam.middle_line {H : Drawing S} {f : Set S} {γ : I → S} + (hγ : EdgeParam H f γ) {t t' : I} (h0 : 0 < t) (htt : t < t') + (h1 : t' < 1) : IsLineWithEnds (γ '' Icc t t') (γ t) (γ t') := by + have hIcc : Icc t t' ⊆ Ioo (0 : I) 1 := fun y hy => ⟨h0.trans_le hy.1, hy.2.trans_lt h1⟩ + have hinj : InjOn γ (Icc t t') := hγ.inj.mono hIcc + have hmaps : ∀ z, lerpI t t' z ∈ Icc t t' := fun z => by + rw [← range_lerpI htt.le] + exact mem_range_self z + have ha : IsArcMap (subArc γ t t') := ⟨hγ.cont.comp (continuous_lerpI _ _), fun x y he + => lerpI_injective htt.ne (hinj (hmaps x) (hmaps y) he)⟩ + have hL := isLineWithEnds_range_of_arc ha + rwa [range_subArc _ htt.le, subArc_zero, subArc_one] at hL + +omit [T2Space S] in +/-- The middle third of an edge lies in the edge. -/ +theorem EdgeParam.middle_subset {H : Drawing S} {f : Set S} {γ : I → S} + (hγ : EdgeParam H f γ) : γ '' Icc third₁ third₂ ⊆ f := by + rintro _ ⟨y, hy, rfl⟩ + exact hγ.mem_edge (third₁_pos.trans_le hy.1) (hy.2.trans_lt third₂_lt) + +/-- Removing the middle third of each edge of `H`. The marks of the split are the ends of the middle +thirds, and the new drawing meets each +middle third in its two ends only. -/ +theorem exists_split_middle [Nonempty S] (Hd : SurfaceDigraph S) : + ∃ (γ : Set S → I → S) (β : Set S × Bool → I → S) (τ : Set S × Bool → I) (hs : IsSplit Hd.G β τ), + (∀ f ∈ Hd.G.E, EdgeParam Hd.G f (γ f) ∧ γ f 0 = Hd.plus f ∧ γ f 1 = Hd.minus f) ∧ + (∀ f ∈ Hd.G.E, β (f, false) 0 = Hd.plus f ∧ β (f, true) 0 = Hd.minus f) ∧ + (∀ f ∈ Hd.G.E, β (f, false) (τ (f, false)) = γ f third₁ ∧ β (f, true) (τ (f, true)) + = γ f third₂) ∧ + ∀ f ∈ Hd.G.E, hs.drawing.U ∩ γ f '' Icc third₁ third₂ = {γ f third₁, γ f third₂} := by + classical + set H := Hd.G with hHd + have hor : ∀ f, f ∈ H.E → ∃ γ : I → S, EdgeParam H f γ ∧ γ 0 = Hd.plus f ∧ γ 1 = Hd.minus f + := fun f hf => + exists_oriented_param hf (Hd.ends_eq f hf) + choose! γ hγ hγ0 hγ1 using hor + have h0 := third₁_pos + have h1 := third_lt + have h2 := third₂_lt + let β : Set S × Bool → I → S := fun q => cond q.2 (γ q.1 ∘ σ) (γ q.1) + let τ : Set S × Bool → I := fun q => cond q.2 (σ third₂) third₁ + have hsym1 : ∀ {u : I}, u < 1 → 0 < σ u := fun {u} hu => by + rw [← unitInterval.symm_one, unitInterval.symm_lt_symm] + exact hu + have hsym0 : ∀ {u : I}, 0 < u → σ u < 1 := fun {u} hu => by + rw [← unitInterval.symm_zero, unitInterval.symm_lt_symm] + exact hu + have hrev : ∀ {u v : I}, v ≤ σ u → u ≤ σ v := fun {u v} huv => by + have := unitInterval.symm_le_symm.mpr huv + rwa [unitInterval.symm_symm] at this + have hs : IsSplit H β τ := by + refine ⟨?_, ?_, ?_, ?_⟩ + · rintro ⟨f, b⟩ hf + cases b + · exact hγ f hf + · exact (hγ f hf).rev + · rintro ⟨f, b⟩ hf + cases b + · exact h0 + · exact hsym1 h2 + · rintro ⟨f, b⟩ hf + cases b + · exact h1.trans h2 + · exact hsym0 (h0.trans h1) + · intro f hf + rw [disjoint_left] + rintro _ ⟨y, hy, rfl⟩ ⟨u, hu, he⟩ + change γ f (σ u) = γ f y at he + have hu1 : σ u ∈ Ioo (0 : I) 1 := ⟨hsym1 (hu.2.trans_lt (hsym0 (h0.trans h1))), hsym0 hu.1⟩ + have hy1 : y ∈ Ioo (0 : I) 1 := ⟨hy.1, (show y ≤ third₁ from hy.2).trans_lt (h1.trans h2)⟩ + have heq := (hγ f hf).inj hu1 hy1 he + have h9 : third₂ ≤ σ u := hrev hu.2 + have h10 : y ≤ third₁ := hy.2 + exact absurd (h1.trans_le (h9.trans (heq.le.trans h10))) (lt_irrefl _) + have hm₂ : ∀ f, β (f, true) (τ (f, true)) = γ f third₂ := fun f => by + change γ f (σ (σ third₂)) = _ + rw [unitInterval.symm_symm] + refine ⟨γ, β, τ, hs, fun f hf => ⟨hγ f hf, hγ0 f hf, hγ1 f hf⟩, fun f hf => ⟨hγ0 f hf, ?_⟩, + fun f _ => ⟨rfl, hm₂ f⟩, fun f hf => ?_⟩ + · change γ f (σ 0) = _ + rw [unitInterval.symm_zero, hγ1 f hf] + · have hγf := hγ f hf + have hU₃ : hs.drawing.U ⊆ H.U := by + refine union_subset H.V_subset_U (iUnion₂_subset fun q hq => ?_) + rintro _ ⟨y, -, rfl⟩ + exact (hs.param q hq).subset_U hq y + have hqf : (f, false) ∈ halves H := hf + have hqt : (f, true) ∈ halves H := hf + apply Subset.antisymm + · rintro x ⟨hxU, y, hy, rfl⟩ + by_cases hyt : y = third₁ + · left + rw [hyt] + by_cases hyt' : y = third₂ + · right + rw [hyt'] + rfl + exfalso + have ht : third₁ < y := lt_of_le_of_ne hy.1 (Ne.symm hyt) + have ht' : y < third₂ := lt_of_le_of_ne hy.2 hyt' + have hy0 : 0 < y := h0.trans ht + have hy1 : y < 1 := ht'.trans h2 + have hyI : y ∈ Ioo (0 : I) 1 := ⟨hy0, hy1⟩ + have hedge := hγf.mem_edge hy0 hy1 + rcases hxU with hV | hxU + · exact hγf.not_V hf hy0 hy1 hV + obtain ⟨q, hq, hxq⟩ := mem_iUnion₂.mp hxU + rcases mem_closed_half hxq with h9 | h9 + · exact hγf.not_V hf hy0 hy1 (h9 ▸ (hs.param q hq).mem0) + have hsame : q.1 = f := by + by_contra hne + exact disjoint_left.mp (GraphMinor.GM06.disjoint_edges_of_ne H hq hf hne) + (hs.halfRest_subset hq h9) hedge + obtain ⟨g, b⟩ := q + change g = f at hsame + subst hsame + cases b + · obtain ⟨u, hu, he⟩ := h9 + have hu' : u ∈ Ioo (0 : I) 1 := ⟨hu.1, (show u ≤ third₁ from hu.2).trans_lt (h1.trans h2)⟩ + have := hγf.inj hu' hyI he + exact absurd (this ▸ hu.2 : y ≤ third₁) (not_le.mpr ht) + · obtain ⟨u, hu, he⟩ := h9 + change γ g (σ u) = γ g y at he + have hu' : σ u ∈ Ioo (0 : I) 1 := ⟨hsym1 (hu.2.trans_lt (hsym0 (h0.trans h1))), hsym0 hu.1⟩ + have := hγf.inj hu' hyI he + have h10 : third₂ ≤ σ u := hrev hu.2 + exact absurd (this ▸ h10) (not_le.mpr ht') + · rintro x (rfl | hx) + · exact ⟨hs.drawing.V_subset_U (.inr ⟨(f, false), hqf, rfl⟩), third₁, ⟨le_rfl, h1.le⟩, rfl⟩ + · rw [mem_singleton_iff] at hx + subst hx + refine ⟨?_, third₂, ⟨h1.le, le_rfl⟩, rfl⟩ + rw [← hm₂] + exact hs.drawing.V_subset_U (.inr ⟨(f, true), hqt, rfl⟩) + +omit [T2Space S] in +/-- The closure of an edge that is not a loop is a line between its two ends. -/ +theorem isLineWithEnds_closure_of_ends (G : Drawing S) {e : Set S} (he : e ∈ G.E) (hloop : + (tilde e).ncard = 2) {p m : S} + (hpm : ({p, m} : Set S) = tilde e) : IsLineWithEnds (closure e) p m := by + rw [← hpm] at hloop + rcases G.edge_cond e he with ⟨u, v, -, hcap, hL⟩ | ⟨u, hcap, -⟩ + · have h1 : ({p, m} : Set S) = {u, v} := by + rw [hpm, GraphMinor.GM19.tilde_eq_inter_V G he, hcap] + have h6 : p ∈ ({u, v} : Set S) := by rw [← h1]; simp + have h7 : m ∈ ({u, v} : Set S) := by rw [← h1]; simp + have h8 : u ∈ ({p, m} : Set S) := by rw [h1]; simp + have h9 : v ∈ ({p, m} : Set S) := by rw [h1]; simp + simp only [mem_insert_iff, mem_singleton_iff] at h6 h7 h8 h9 + by_cases hc : p = u ∧ m = v + · rw [hc.1, hc.2] + exact hL + · have h10 : p = v ∧ m = u := by grind + rw [h10.1, h10.2] + exact hL.symm + · rw [hpm, GraphMinor.GM19.tilde_eq_inter_V G he, hcap] at hloop + simp at hloop + +private theorem matched_forest_meets_cut_at_ends + {S : Type u} + [TopologicalSpace S] + (Hd : SurfaceDigraph S) + (Gd : SurfaceDigraph S) + (γ : Set S → ↑I → S) + (β : Set S × Bool → ↑I → S) + (τ : Set S × Bool → ↑I) + (hmk : ∀ f ∈ Hd.G.E, β (f, false) (τ (f, false)) = γ f third₁ ∧ β (f, true) (τ (f, true)) = γ + f third₂) + (ε : Set S → Set S) + (e : S ≃ₜ S) + (mk₁ : Set S → S) + (hmk₁ : mk₁ = fun f => β (f, false) (τ (f, false))) + (mk₂ : Set S → S) + (hmk₂ : mk₂ = fun f => β (f, true) (τ (f, true))) + (hplace : ∀ f ∈ Hd.G.E, ⇑e '' γ f '' Icc third₁ third₂ = closure (ε f) ∧ e (mk₁ f) = Gd.plus + (ε f) ∧ e (mk₂ f) = Gd.minus (ε f)) + (H₃ : Drawing S) + (hmid : ∀ f ∈ Hd.G.E, H₃.U ∩ γ f '' Icc third₁ third₂ = {γ f third₁, γ f third₂}) : + let Hc : Drawing S := mapDrawingHomeo e H₃ + ∀ f ∈ Hd.G.E, ∀ x ∈ Hc.U, x ∈ closure (ε f) → x = Gd.plus (ε f) ∨ x = Gd.minus (ε f) := by + intro Hc + rintro f hf _ ⟨y, hy, rfl⟩ hx + rw [← (hplace f hf).1] at hx + obtain ⟨y', hy', he⟩ := hx + have hyy := e.injective he + subst hyy + have h1 : y' ∈ H₃.U ∩ γ f '' Icc third₁ third₂ := ⟨hy, hy'⟩ + rw [hmid f hf] at h1 + rcases h1 with rfl | h1 + · left + rw [← (hplace f hf).2.1, hmk₁] + simp only + rw [(hmk f hf).1] + · rw [mem_singleton_iff] at h1 + subst h1 + right + rw [← (hplace f hf).2.2, hmk₂] + simp only + rw [(hmk f hf).2] + +private theorem matched_forest_avoids_cut_edges + {S : Type u} + [TopologicalSpace S] + (Hd : SurfaceDigraph S) + (Gd : SurfaceDigraph S) + (S_r : Type u) + [TopologicalSpace S_r] + (θ : S_r → S) + (G_r : Drawing S_r) + (𝓔 : Set (Set S)) + (hmc : IsMultiCut Gd.G 𝓔 θ G_r) + (ε : Set S → Set S) + (hεs : ∀ e' ∈ 𝓔, ∃ f ∈ Hd.G.E, ε f = e') + (Hc : Drawing S) + (hCap : ∀ f ∈ Hd.G.E, ∀ x ∈ Hc.U, x ∈ closure (ε f) → x = Gd.plus (ε f) ∨ x = Gd.minus (ε f)) : + ∀ x ∈ Hc.U, x ∉ ⋃₀ 𝓔 := by + rintro x hx ⟨e', he', hxe⟩ + obtain ⟨f, hf, rfl⟩ := hεs e' he' + have hnV : x ∉ Gd.G.V := ((hmc.sub he').2.1 hxe).2 + rcases hCap f hf x hx (subset_closure hxe) with rfl | rfl + · exact hnV (Gd.plus_mem _ (hmc.sub he')) + · exact hnV (Gd.minus_mem _ (hmc.sub he')) + +private theorem matching_preserves_original_boundary_vertices + {S : Type u} + [TopologicalSpace S] + [T2Space S] + (Hd : SurfaceDigraph S) + (hH : Hd.IsProper) + (β : Set S × Bool → ↑I → S) + (τ : Set S × Bool → ↑I) + (hsp : IsSplit Hd.G β τ) + (e : S ≃ₜ S) + (hebd : ∀ x ∈ bd S, e x = x) + (hesymm : ∀ x ∈ bd S, e.symm x = x) : + let H₃ : Drawing S := hsp.drawing + let Hc : Drawing S := mapDrawingHomeo e H₃ + ∀ x ∈ bd S, x ∈ Hc.V ↔ x ∈ Hd.G.V := by + intro H₃ Hc x hx + have hxU : x ∉ H₃.V \ Hd.G.V := by + rintro ⟨h1 | ⟨q, hq, rfl⟩, h2⟩ + · exact h2 h1 + · exact h2 (hH ⟨hx, (hsp.param q hq).subset_U hq _⟩) + constructor + · rintro ⟨y, hy, rfl⟩ + have : y = e y := by + have h := hesymm _ hx + rwa [e.symm_apply_apply] at h + rw [← this] at hxU ⊢ + by_contra hn + exact hxU ⟨hy, hn⟩ + · intro h1 + exact ⟨x, .inl h1, hebd x hx⟩ + +private theorem matching_preserves_cut_edge_vertices + {S : Type u} + [TopologicalSpace S] + (Hd : SurfaceDigraph S) + (Gd : SurfaceDigraph S) + (S_r : Type u) + [TopologicalSpace S_r] + (θ : S_r → S) + (G_r : Drawing S_r) + (𝓔 : Set (Set S)) + (hmc : IsMultiCut Gd.G 𝓔 θ G_r) + (ε : Set S → Set S) + (hεs : ∀ e' ∈ 𝓔, ∃ f ∈ Hd.G.E, ε f = e') + (Hc : Drawing S) + (hpV : ∀ f ∈ Hd.G.E, Gd.plus (ε f) ∈ Hc.V) + (hmV : ∀ f ∈ Hd.G.E, Gd.minus (ε f) ∈ Hc.V) + (hCap : ∀ f ∈ Hd.G.E, ∀ x ∈ Hc.U, x ∈ closure (ε f) → x = Gd.plus (ε f) ∨ x = Gd.minus (ε f)) : + ∀ e' ∈ 𝓔, ∀ x ∈ closure e', x ∈ Hc.V ↔ x ∈ Gd.G.V := by + intro e' he' x hx + obtain ⟨f, hf, rfl⟩ := hεs e' he' + constructor + · intro h1 + rcases hCap f hf x (Hc.V_subset_U h1) hx with rfl | rfl + · exact Gd.plus_mem _ (hmc.sub he') + · exact Gd.minus_mem _ (hmc.sub he') + · intro h1 + have h2 : x ∈ tilde (ε f) := by + rw [GraphMinor.GM19.tilde_eq_inter_V Gd.G (hmc.sub he')] + exact ⟨hx, h1⟩ + rw [← Gd.ends_eq _ (hmc.sub he')] at h2 + rcases h2 with rfl | h2 + · exact hpV f hf + · rw [mem_singleton_iff] at h2 + subst h2 + exact hmV f hf + +private theorem cut_boundary_projects_to_boundary_or_cut_edge + {S : Type u} + [TopologicalSpace S] + (Gd : SurfaceDigraph S) + (S_r : Type u) + [TopologicalSpace S_r] + (θ : S_r → S) + (G_r : Drawing S_r) + (𝓔 : Set (Set S)) + (hmc : IsMultiCut Gd.G 𝓔 θ G_r) + (x : S_r) + (hx : x ∈ bd S_r) : + θ x ∈ bd S ∨ ∃ e' ∈ 𝓔, θ x ∈ closure e' := by + rw [hmc.bd_eq] at hx + rcases hx with h1 | h1 + · exact .inl h1 + · obtain ⟨e', he', h2⟩ := mem_iUnion₂.mp h1 + exact .inr ⟨e', he', h2⟩ + +private theorem forest_vertices_have_boundary_representatives + {S : Type u} + [TopologicalSpace S] + (Hd : SurfaceDigraph S) + (Gd : SurfaceDigraph S) + (S_r : Type u) + [TopologicalSpace S_r] + (θ : S_r → S) + (G_r : Drawing S_r) + (𝓔 : Set (Set S)) + (hmc : IsMultiCut Gd.G 𝓔 θ G_r) + (hs : Surjective θ) + (β : Set S × Bool → ↑I → S) + (τ : Set S × Bool → ↑I) + (hsp : IsSplit Hd.G β τ) + (e : S ≃ₜ S) + (hesymm : ∀ x ∈ bd S, e.symm x = x) + (Hc : Drawing S) + (hbdV : ∀ x ∈ bd S, x ∈ Hc.V ↔ x ∈ Hd.G.V) + (Mid : Drawing S_r) + (w : S_r → S) + (hwb : ∀ s ∈ bd S_r, w s = e.symm (θ s)) + (hMidV : ∀ s ∈ bd S_r, θ s ∈ Hc.V → s ∈ Mid.V ∩ bd S_r) + (zp : Set S → S_r) + (hzp1 : ∀ f ∈ Hd.G.E, zp f ∈ Mid.V ∩ bd S_r) + (hzp3 : ∀ f ∈ Hd.G.E, splitOwner Hd.G β τ (w (zp f)) = Hd.plus f) + (zm : Set S → S_r) + (hzm1 : ∀ f ∈ Hd.G.E, zm f ∈ Mid.V ∩ bd S_r) + (hzm3 : ∀ f ∈ Hd.G.E, splitOwner Hd.G β τ (w (zm f)) = Hd.minus f) + (hiso : ∀ v ∈ Hd.G.V \ bd S, ¬IsIsolatedVertex Hd.G v) : + ∀ v ∈ Hd.G.V, ∃ s ∈ Mid.V ∩ bd S_r, splitOwner Hd.G β τ (w s) = v ∧ (v ∈ bd S → θ s = v) := by + intro v hv + by_cases hb : v ∈ bd S + · obtain ⟨s, hs'⟩ := hs v + have hsb : s ∈ bd S_r := by + rw [hmc.bd_eq, mem_preimage, hs'] + exact .inl hb + refine ⟨s, hMidV s hsb (by rw [hs', hbdV v hb]; exact hv), ?_, fun _ => hs'⟩ + rw [hwb s hsb, hs', hesymm v hb] + exact hsp.owner_V hv + · have hn := hiso v ⟨hv, hb⟩ + simp only [IsIsolatedVertex, not_and, not_forall, not_not] at hn + obtain ⟨f, hf, hinc⟩ := hn hv + have h1 : v ∈ tilde f := by + rw [GraphMinor.GM19.tilde_eq_inter_V Hd.G hf] + exact ⟨hinc.2.2, hv⟩ + rw [← Hd.ends_eq f hf] at h1 + rcases h1 with rfl | h1 + · exact ⟨zp f, hzp1 f hf, hzp3 f hf, fun h => absurd h hb⟩ + · rw [mem_singleton_iff] at h1 + subst h1 + exact ⟨zm f, hzm1 f hf, hzm3 f hf, fun h => absurd h hb⟩ + +private theorem lifted_cut_forest_is_proper + {S : Type u} + [TopologicalSpace S] + (Hd : SurfaceDigraph S) + (Gd : SurfaceDigraph S) + (S_r : Type u) + [TopologicalSpace S_r] + (θ : S_r → S) + (𝓔 : Set (Set S)) + (ε : Set S → Set S) + (hεs : ∀ e' ∈ 𝓔, ∃ f ∈ Hd.G.E, ε f = e') + (Hc : Drawing S) + (hpV : ∀ f ∈ Hd.G.E, Gd.plus (ε f) ∈ Hc.V) + (hmV : ∀ f ∈ Hd.G.E, Gd.minus (ε f) ∈ Hc.V) + (hCap : ∀ f ∈ Hd.G.E, ∀ x ∈ Hc.U, x ∈ closure (ε f) → x = Gd.plus (ε f) ∨ x = Gd.minus (ε f)) + (H' : Drawing S_r) + (hU : H'.U = θ ⁻¹' Hc.U) + (hH'V : H'.V = θ ⁻¹' Hc.V) + (hbdU : ∀ x ∈ bd S, x ∈ Hc.U → x ∈ Hc.V) + (hbdcases : ∀ x ∈ bd S_r, θ x ∈ bd S ∨ ∃ e' ∈ 𝓔, θ x ∈ closure e') : + H'.IsProper := by + rintro x ⟨hx, hxU⟩ + rw [hU] at hxU + rw [hH'V] + rcases hbdcases x hx with h1 | ⟨e', he', h1⟩ + · exact hbdU _ h1 hxU + · obtain ⟨f, hf, rfl⟩ := hεs e' he' + rcases hCap f hf _ hxU h1 with h2 | h2 + · rw [mem_preimage, h2] + exact hpV f hf + · rw [mem_preimage, h2] + exact hmV f hf + +private theorem lifted_cut_forest_agrees_on_boundary + {S : Type u} + [TopologicalSpace S] + (Gd : SurfaceDigraph S) + (S_r : Type u) + [TopologicalSpace S_r] + (θ : S_r → S) + (G_r : Drawing S_r) + (𝓔 : Set (Set S)) + (hmc : IsMultiCut Gd.G 𝓔 θ G_r) + (Hc : Drawing S) + (H' : Drawing S_r) + (hH'V : H'.V = θ ⁻¹' Hc.V) + (hbdV' : ∀ x ∈ bd S_r, θ x ∈ Hc.V ↔ θ x ∈ Gd.G.V) : + G_r.V ∩ bd S_r = H'.V ∩ bd S_r := by + ext x + refine and_congr_left fun hx => ?_ + rw [hH'V, hmc.preV] + exact (hbdV' x hx).symm + +private theorem endpoint_preimage_mem_cut_boundary {S S_r : Type u} + [TopologicalSpace S] [TopologicalSpace S_r] {Gd : SurfaceDigraph S} + {θ : S_r → S} {G_r : Drawing S_r} {𝓔 : Set (Set S)} (hmc : IsMultiCut Gd.G 𝓔 θ G_r) + {edge : Set S} (he : edge ∈ 𝓔) {z : S_r} + (hz : θ z = Gd.plus edge ∨ θ z = Gd.minus edge) : z ∈ bd S_r := by + rw [hmc.bd_eq] + have hEnd : θ z ∈ tilde edge := by + rw [← Gd.ends_eq _ (hmc.sub he)] + rcases hz with hz | hz <;> simp [hz] + exact .inr (mem_iUnion₂.mpr ⟨edge, he, hEnd.1⟩) + +/-- Step 2 of (9.1): cutting along one edge of `G` for each edge of `H` turns the question of a +minor into a question of feasibility of a forest. -/ +theorem cutEdgesForestReduction {S : Type u} [TopologicalSpace S] [T1Space S] (hS : IsSurface S) + (a b c : ℕ) (h3 : 3 ≤ 3 * a + 3 * b + c) + (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) (Hd : SurfaceDigraph S) (hH : Hd.IsProper) + (hg0 : numInternalIsolatedVertices Hd.G = 0) (k c₀ : ℕ) + (hk : 2 * k ≥ 4 * Hd.G.E.ncard + (Hd.G.V ∩ bd S).ncard + 2 * c + 2) (Gd : SurfaceDigraph S) + (hbd_eq : Gd.G.V ∩ bd S = Hd.G.V ∩ bd S) (hBL : IsBoundaryLinked Gd.G) + (halpha : alpha Gd.G ≥ 42 * k * 5 ^ Hd.G.E.ncard * vModel a b c₀ k) : + ∃ (S_r : Type u) (_ : TopologicalSpace S_r) (_ : T1Space S_r) (G_r H' : Drawing S_r), + IsSurface S_r ∧ Nonempty (S_r ≃ₜ SurfaceModel a b (c + Hd.G.E.ncard)) ∧ IsBoundaryLinked G_r + ∧ 42 * k * vModel a b c₀ k ≤ alpha G_r ∧ + (G_r.V ∩ bd S_r).ncard + 2 * (c + Hd.G.E.ncard) + 2 ≤ 2 * k ∧ IsSurfaceForest H' + ∧ G_r.V ∩ bd S_r = H'.V ∩ bd S_r ∧ + (IsGFeasible G_r H' → IsBoundaryRootedMinor Hd Gd) := by + classical + have ht2 : T2Space S := hS.2.1 + have hcS : CompactSpace S := hS.1 + have hConn : ConnectedSpace S := connectedSpace_of_model hm + have hneS : Nonempty S := inferInstance + have hM : IsSurface (SurfaceModel a b c) := (modelCriterion.1 a b c).1 + obtain ⟨hh⟩ := id hm + have hk1 : 1 ≤ k := by omega + have hv1 : 1 ≤ vModel a b c₀ k := by + have := two_mul_k_le_vModel a b c₀ k + omega + have hcount : (Gd.G.V ∩ bd S).ncard + 2 * Hd.G.E.ncard ≤ 2 * k := by + rw [hbd_eq] + omega + obtain ⟨S_r, tS_r, t1S_r, θ, G_r, 𝓔, hmc, hnc, hSr, hmr, hBLr, hαr, hcardr⟩ + := exists_multiCut hS h3 hm Gd.G hBL hk1 hv1 hcount halpha _ le_rfl + have ht2r : T2Space S_r := hSr.2.1 + have hcr : CompactSpace S_r := hSr.1 + have hs := hmc.quot.surjective + have hcθ := hmc.quot.continuous + have hneR : Nonempty S_r := by + obtain ⟨x⟩ := hneS + obtain ⟨y, -⟩ := hs x + exact ⟨y⟩ + obtain ⟨γ, β, τ, hsp, hγ, hor, hmk, hmid⟩ := exists_split_middle Hd + -- Match the edges of `H` with the edges we cut along. + have hfE : Finite Hd.G.E := Hd.G.finite_edges + have hf𝓔 : Finite 𝓔 := hmc.finite + have hcard : Nat.card Hd.G.E = Nat.card 𝓔 := by rw [Nat.card_coe_set_eq, Nat.card_coe_set_eq, hnc] + obtain ⟨eqv⟩ : Nonempty (Hd.G.E ≃ 𝓔) := Finite.card_eq.mp hcard + let ε : Set S → Set S := fun f => if hf : f ∈ Hd.G.E then (eqv ⟨f, hf⟩).1 else ∅ + have hεv : ∀ i : Hd.G.E, ε i = (eqv i).1 := fun i => by + change (if hf : i.1 ∈ Hd.G.E then (eqv ⟨i.1, hf⟩).1 else ∅) = _ + rw [dite_eq_left i.2] + have hε : ∀ f ∈ Hd.G.E, ε f ∈ 𝓔 := fun f hf => by + have := hεv ⟨f, hf⟩ + simp only at this + rw [this] + exact (eqv _).2 + have hεi : ∀ f ∈ Hd.G.E, ∀ f' ∈ Hd.G.E, f ≠ f' → ε f ≠ ε f' := fun f hf f' hf' hne he => by + have h1 := hεv ⟨f, hf⟩ + have h2 := hεv ⟨f', hf'⟩ + simp only at h1 h2 + rw [h1, h2] at he + exact hne (congrArg Subtype.val (eqv.injective (Subtype.ext he))) + have hεs : ∀ e' ∈ 𝓔, ∃ f ∈ Hd.G.E, ε f = e' := fun e' he' => by + obtain ⟨i, hi⟩ := eqv.surjective ⟨e', he'⟩ + refine ⟨i.1, i.2, ?_⟩ + rw [hεv, hi] + -- The middle thirds of the edges of `H`, and the closures of the edges we cut along, are disjoint + -- lines off the boundary. + have hends : ∀ e' ∈ 𝓔, Gd.plus e' ≠ Gd.minus e' := fun e' he' hpe => by + have h1 := hmc.not_loop e' he' + rw [← Gd.ends_eq e' (hmc.sub he'), hpe] at h1 + simp at h1 + have hmidL : ∀ f ∈ Hd.G.E, IsLineWithEnds (γ f '' Icc third₁ third₂) (γ f third₁) (γ f third₂) + := fun f hf => + (hγ f hf).1.middle_line third₁_pos third_lt third₂_lt + have hmidD : Pairwise fun i j : Hd.G.E => Disjoint (γ i '' Icc third₁ third₂) + (γ j '' Icc third₁ third₂) := fun i j hij => + (GraphMinor.GM06.disjoint_edges_of_ne Hd.G i.2 j.2 fun he => hij (Subtype.ext he)).mono + (hγ i i.2).1.middle_subset (hγ j j.2).1.middle_subset + have hmidb : ∀ f ∈ Hd.G.E, Disjoint (γ f '' Icc third₁ third₂) (bd S) := fun f hf => by + rw [disjoint_left] + intro x hx hb + have h1 := hf.2.1 ((hγ f hf).1.middle_subset hx) + exact h1.2 (hH ⟨hb, h1.1⟩) + have hclL : ∀ e' ∈ 𝓔, IsLineWithEnds (closure e') (Gd.plus e') (Gd.minus e') := fun e' he' => + isLineWithEnds_closure_of_ends Gd.G (hmc.sub he') (hmc.not_loop e' he') (Gd.ends_eq e' + (hmc.sub he')) + -- A homeomorphism `ψ` of `Σ` fixing `bd(Σ)` maps the middle third of each `f` onto the whole of + -- `ε f`, by `exists_line_family_placement`. + obtain ⟨e, hebd, heA⟩ := exists_line_family_placement hS hM hh (fun i : Hd.G.E + => γ i '' Icc third₁ third₂) (fun i => closure (ε i)) + (fun i => γ i third₁) (fun i => γ i third₂) (fun i => Gd.plus (ε i)) (fun i => Gd.minus (ε i)) + (fun i => hmidL i i.2) + (fun i => hclL _ (hε i i.2)) hmidD (fun i j hij => hmc.disj _ (hε i i.2) _ (hε j j.2) + (hεi i i.2 j j.2 fun he => hij (Subtype.ext he))) + (fun i => hmidb i i.2) (fun i => disjoint_iff_inter_eq_empty.mpr + (disjoint_iff_inter_eq_empty.mp (hmc.off_bd _ (hε i i.2)))) + set mk₁ : Set S → S := fun f => β (f, false) (τ (f, false)) with hmk₁ + set mk₂ : Set S → S := fun f => β (f, true) (τ (f, true)) with hmk₂ + have hplace : ∀ f ∈ Hd.G.E, e '' (γ f '' Icc third₁ third₂) = closure (ε f) ∧ e (mk₁ f) = Gd.plus + (ε f) ∧ e (mk₂ f) = Gd.minus (ε f) := + fun f hf => by + obtain ⟨h1, h2, h3⟩ := heA ⟨f, hf⟩ + refine ⟨h1, ?_, ?_⟩ + · rw [hmk₁] + simp only + rw [(hmk f hf).1] + exact h2 + · rw [hmk₂] + simp only + rw [(hmk f hf).2] + exact h3 + have hesymm : ∀ x ∈ bd S, e.symm x = x := fun x hx => by + rw [Homeomorph.symm_apply_eq, hebd x hx] + set H₃ := hsp.drawing with hH₃ + set Hc := mapDrawingHomeo e H₃ with hHc + have hmk₁V : ∀ f ∈ Hd.G.E, mk₁ f ∈ H₃.V := fun f hf => .inr ⟨(f, false), hf, rfl⟩ + have hmk₂V : ∀ f ∈ Hd.G.E, mk₂ f ∈ H₃.V := fun f hf => .inr ⟨(f, true), hf, rfl⟩ + have hpV : ∀ f ∈ Hd.G.E, Gd.plus (ε f) ∈ Hc.V := fun f hf => ⟨_, hmk₁V f hf, (hplace f hf).2.1⟩ + have hmV : ∀ f ∈ Hd.G.E, Gd.minus (ε f) ∈ Hc.V := fun f hf => ⟨_, hmk₂V f hf, (hplace f hf).2.2⟩ + have hHU₃ : H₃.U ⊆ Hd.G.U := by + refine union_subset Hd.G.V_subset_U (iUnion₂_subset fun q hq => ?_) + rintro _ ⟨y, -, rfl⟩ + exact (hsp.param q hq).subset_U hq y + -- The drawing `Hc` meets the closure of each `ε f` in its ends only. + have hCap : ∀ f ∈ Hd.G.E, ∀ x ∈ Hc.U, x ∈ closure (ε f) → x = Gd.plus (ε f) ∨ x = Gd.minus (ε f) + := by + exact matched_forest_meets_cut_at_ends (S := S) Hd Gd γ β τ hmk ε e mk₁ hmk₁ mk₂ hmk₂ hplace + H₃ hmid + have hoff : ∀ x ∈ Hc.U, x ∉ ⋃₀ 𝓔 := by + exact matched_forest_avoids_cut_edges (S := S) Hd Gd S_r θ G_r 𝓔 hmc ε hεs Hc hCap + have hi : InjOn θ (θ ⁻¹' Hc.U) := fun x hx y _ he => (hmc.inj x y he).resolve_right (hoff _ hx) + set H' := pullDrawing Hc hcθ hs hi with hH' + have hH'V : H'.V = θ ⁻¹' Hc.V := rfl + have hH'U : H'.U = θ ⁻¹' Hc.U := rfl + have hbackd : mapDrawingHomeo e.symm Hc = H₃ := by + rw [hHc, mapDrawingHomeo_trans, e.self_trans_symm, mapDrawingHomeo_refl] + have m₁ : IsMatched H' H₃ (e.symm ∘ θ) ∅ := by + have := (matched_pullDrawing Hc hcθ hs hi).post e.symm + rwa [hbackd] at this + -- Points of the boundary. + have hbdV : ∀ x ∈ bd S, (x ∈ Hc.V ↔ x ∈ Hd.G.V) := by + exact matching_preserves_original_boundary_vertices (S := S) Hd hH β τ hsp e hebd hesymm + have hbdU : ∀ x ∈ bd S, x ∈ Hc.U → x ∈ Hc.V := by + rintro x hx ⟨y, hy, rfl⟩ + have : y = e y := by + have h := hesymm _ hx + rwa [e.symm_apply_apply] at h + rw [hbdV _ hx, ← this] + exact hH ⟨this ▸ hx, hHU₃ hy⟩ + have hclV : ∀ e' ∈ 𝓔, ∀ x ∈ closure e', (x ∈ Hc.V ↔ x ∈ Gd.G.V) := by + exact matching_preserves_cut_edge_vertices (S := S) Hd Gd S_r θ G_r 𝓔 hmc ε hεs Hc hpV hmV + hCap + have hbdcases : ∀ x ∈ bd S_r, θ x ∈ bd S ∨ ∃ e' ∈ 𝓔, θ x ∈ closure e' := fun x hx => by + exact cut_boundary_projects_to_boundary_or_cut_edge (S := S) Gd S_r θ G_r 𝓔 hmc x hx + have hbdV' : ∀ x ∈ bd S_r, (θ x ∈ Hc.V ↔ θ x ∈ Gd.G.V) := fun x hx => by + rcases hbdcases x hx with h1 | ⟨e', he', h1⟩ + · rw [hbdV _ h1] + have h2 : (Gd.G.V ∩ bd S : Set S) = Hd.G.V ∩ bd S := hbd_eq + constructor + · intro h3 + exact (h2 ▸ (⟨h3, h1⟩ : θ x ∈ Hd.G.V ∩ bd S) : θ x ∈ Gd.G.V ∩ bd S).1 + · intro h3 + exact (h2 ▸ (⟨h3, h1⟩ : θ x ∈ Gd.G.V ∩ bd S) : θ x ∈ Hd.G.V ∩ bd S).1 + · exact hclV e' he' _ h1 + have hprop : H'.IsProper := by + exact lifted_cut_forest_is_proper (S := S) Hd Gd S_r θ 𝓔 ε hεs Hc hpV hmV hCap H' rfl hH'V hbdU + hbdcases + have hforest : IsSurfaceForest H' := ⟨hprop, m₁.isGraphForest_iff.mpr hsp.isGraphForest⟩ + have hVeq : G_r.V ∩ bd S_r = H'.V ∩ bd S_r := by + exact lifted_cut_forest_agrees_on_boundary (S := S) Gd S_r θ G_r 𝓔 hmc Hc H' hH'V hbdV' + have hcardG : (G_r.V ∩ bd S_r).ncard + 2 * (c + Hd.G.E.ncard) + 2 ≤ 2 * k := by + rw [hbd_eq] at hcardr + omega + refine ⟨S_r, tS_r, t1S_r, G_r, H', hSr, hmr, hBLr, by simpa using hαr, hcardG, hforest, hVeq, ?_⟩ + rintro ⟨H'', -, ⟨α, hα, hhom⟩, hsub⟩ + set Mid := mapDrawingHomeo α H' with hMid + have hαs : ∀ s ∈ bd S_r, α.symm s = s := fun s hs' => by + rw [Homeomorph.symm_apply_eq, hα s hs'] + set w : S_r → S := (e.symm ∘ θ) ∘ α.symm with hw + have M : IsMatched Mid H₃ w ∅ := m₁.pre α + have hwb : ∀ s ∈ bd S_r, w s = e.symm (θ s) := fun s hs' => by + simp only [hw, comp_apply, hαs s hs'] + have hMidV : ∀ s ∈ bd S_r, θ s ∈ Hc.V → s ∈ Mid.V ∩ bd S_r := fun s hs' h1 + => ⟨⟨s, h1, hα s hs'⟩, hs'⟩ + have hzp : ∀ f, f ∈ Hd.G.E → ∃ z, z ∈ Mid.V ∩ bd S_r ∧ θ z = Gd.plus (ε f) ∧ splitOwner Hd.G β τ + (w z) = Hd.plus f := fun f hf => by + obtain ⟨z, hz⟩ := hs (Gd.plus (ε f)) + have hb := endpoint_preimage_mem_cut_boundary hmc (hε f hf) (.inl hz) + refine ⟨z, hMidV z hb (hz ▸ hpV f hf), hz, ?_⟩ + rw [hwb z hb, hz, ← (hplace f hf).2.1, e.symm_apply_apply, ← (hor f hf).1] + exact hsp.owner_mark (q := (f, false)) hf + have hzm : ∀ f, f ∈ Hd.G.E → ∃ z, z ∈ Mid.V ∩ bd S_r ∧ θ z = Gd.minus (ε f) ∧ splitOwner Hd.G β τ + (w z) = Hd.minus f := fun f hf => by + obtain ⟨z, hz⟩ := hs (Gd.minus (ε f)) + have hb := endpoint_preimage_mem_cut_boundary hmc (hε f hf) (.inr hz) + refine ⟨z, hMidV z hb (hz ▸ hmV f hf), hz, ?_⟩ + rw [hwb z hb, hz, ← (hplace f hf).2.2, e.symm_apply_apply, ← (hor f hf).2] + exact hsp.owner_mark (q := (f, true)) hf + choose! zp hzp1 hzp2 hzp3 using hzp + choose! zm hzm1 hzm2 hzm3 using hzm + have hiso : ∀ v ∈ Hd.G.V \ bd S, ¬ IsIsolatedVertex Hd.G v := fun v hv hisov => by + have hfin : {v ∈ Hd.G.V \ bd S | IsIsolatedVertex Hd.G v}.Finite := Hd.G.finite_V.subset fun x + hx => hx.1.1 + have := (Set.ncard_eq_zero hfin).mp hg0 + exact (this ▸ (⟨hv, hisov⟩ : v ∈ {v ∈ Hd.G.V \ bd S | IsIsolatedVertex Hd.G v}) : v ∈ + (∅ : Set S)) + have hrep : ∀ v, v ∈ Hd.G.V → ∃ s, s ∈ Mid.V ∩ bd S_r ∧ splitOwner Hd.G β τ (w s) = v ∧ (v ∈ bd S + → θ s = v) := by + exact forest_vertices_have_boundary_representatives (S := S) Hd Gd S_r θ G_r 𝓔 hmc hs β τ hsp + e hesymm Hc hbdV Mid w hwb hMidV zp hzp1 hzp3 zm hzm1 hzm3 hiso + choose! ρ hρ1 hρ2 hρ3 using hrep + exact isBoundaryRootedMinor_of_forest (O := splitOwner Hd.G β τ) hbd_eq.symm hmc M hsub hhom + (fun W => hsp.owner_walk W) + (fun x hx y hy he hne => hsp.exists_simple_walk hx hy he hne) (fun v hv + => ⟨hρ1 v hv, hρ2 v hv⟩) (fun v hv => hρ3 v hv.1 hv.2) hε hεi + (fun f hf => ⟨hzp1 f hf, hzp2 f hf, hzp3 f hf⟩) (fun f hf => ⟨hzm1 f hf, hzm2 f hf, hzm3 f hf⟩) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CutFeasible.lean b/LeanPool/GraphMinor/GM07/CutFeasible.lean new file mode 100644 index 0000000000..399f99f741 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CutFeasible.lean @@ -0,0 +1,588 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.MoveOff +public import LeanPool.GraphMinor.GM07.Matched +public import LeanPool.GraphMinor.GM07.CutDraw +public import LeanPool.GraphMinor.GM07.Section4 +import LeanPool.GraphMinor.GM07.Section6 +import LeanPool.GraphMinor.GM19.Section6a + +/-! +# Feasibility across a cut + +The step of (7.5), page 241. We move `H` off `ē`, take its preimage `H'` in `Σ_e`, and add the two +ends `a'` and `b'` of the cut as isolated +vertices. A homeomorphism of `Σ_e` fixing the boundary fixes the new cuff pointwise, so it comes +down to a homeomorphism of `Σ` that fixes +`ē`. A forest in `φ_e⁻¹(G \ e)` misses `e`, so it comes down to a forest in `G`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +section Cut + +variable {S S_e : Type u} [TopologicalSpace S] [TopologicalSpace S_e] [T2Space S] [CompactSpace + S_e] [T2Space S_e] + {G : Drawing S} {e : Set S} {a b c : ℕ} {φ : S_e → S} {G_e : Drawing S_e} + +omit [T2Space S] [CompactSpace S_e] [T2Space S_e] in +/-- A homeomorphism of `Σ_e` fixing the boundary comes down to `Σ`. -/ +theorem IsCutAlongEdge.exists_descent (hCut : IsCutAlongEdge G e a b c S_e φ G_e) (α' : S_e ≃ₜ S_e) + (hfix : ∀ x ∈ bd S_e, α' x = x) : + ∃ α : S ≃ₜ S, ∀ x, φ (α' x) = α (φ x) := by + classical + have hq := hCut.quotientMap + have hsurj := hq.surjective + have hbd : ∀ x, φ x ∈ e → x ∈ bd S_e := fun x hx => by + rw [hCut.bd_eq] + exact .inr (subset_closure hx) + have hdown : ∀ β : S_e ≃ₜ S_e, (∀ x ∈ bd S_e, β x = x) → ∃ d : S → S, Continuous d ∧ ∀ x, d (φ x) + = φ (β x) := fun β hβ => by + have hfib : ∀ x y, φ x = φ y → φ (β x) = φ (β y) := fun x y he => by + rcases hCut.inj x y he with rfl | hx + · rfl + · rw [hβ x (hbd x hx), hβ y (hbd y (he ▸ hx)), he] + let d : S → S := fun y => φ (β (surjInv hsurj y)) + have hd : ∀ x, d (φ x) = φ (β x) := fun x => hfib _ _ (surjInv_eq hsurj (φ x)) + refine ⟨d, hq.continuous_iff.mpr ?_, hd⟩ + have : d ∘ φ = φ ∘ β := funext hd + rw [this] + exact hq.continuous.comp β.continuous + obtain ⟨d₁, hd₁, h₁⟩ := hdown α' hfix + obtain ⟨d₂, hd₂, h₂⟩ := hdown α'.symm fun x hx => by + rw [Homeomorph.symm_apply_eq, hfix x hx] + refine ⟨⟨⟨d₁, d₂, fun y => ?_, fun y => ?_⟩, hd₁, hd₂⟩, fun x => (h₁ x).symm⟩ + · obtain ⟨x, rfl⟩ := hsurj y + rw [h₁, h₂, Homeomorph.symm_apply_apply] + · obtain ⟨x, rfl⟩ := hsurj y + rw [h₂, h₁, Homeomorph.apply_symm_apply] + +omit [T2Space S] [CompactSpace S_e] [T2Space S_e] in +theorem IsCutAlongEdge.injOn_off (hCut : IsCutAlongEdge G e a b c S_e φ G_e) {K : Set S} + (hK : Disjoint K e) : InjOn φ (φ ⁻¹' K) := fun x hx y _ he => + (hCut.inj x y he).resolve_right fun h => disjoint_left.mp hK hx h + +omit [T2Space S_e] in +/-- Each edge of `G_e` is the preimage of an edge of `G` other than `e`. -/ +theorem IsCutAlongEdge.exists_edge (hCut : IsCutAlongEdge G e a b c S_e φ G_e) {f₁ : Set S_e} + (hf₁ : f₁ ∈ G_e.E) : + φ '' f₁ ∈ G.E ∧ Disjoint (φ '' f₁) e ∧ f₁ = φ ⁻¹' (φ '' f₁) := by + have hs := hCut.quotientMap.surjective + have hc := hCut.quotientMap.continuous + set D := G.deleteEdge e with hD + have hDU : D.U = G.U \ e := deleteEdge_U G hCut.mem_E + have hDV : D.V = G.V := deleteEdge_V G e + have hi : InjOn φ (φ ⁻¹' D.U) := hCut.injOn_off (by rw [hDU]; exact disjoint_sdiff_left) + have hE : arcComponentsIn (φ ⁻¹' (D.U \ D.V)) = preimage φ '' D.E := arcComponentsIn_preimage hc + hs D.isClosed_U hi sdiff_subset + have heq : G_e.U \ G_e.V = φ ⁻¹' (D.U \ D.V) := by + rw [hCut.preimage_U, hCut.preimage_V, hDU, hDV] + rfl + have hf₂ : f₁ ∈ arcComponentsIn (φ ⁻¹' (D.U \ D.V)) := heq ▸ hf₁ + rw [hE] at hf₂ + obtain ⟨C, hC, rfl⟩ := hf₂ + have hCE : C ∈ G.E \ {e} := deleteEdge_E G e ▸ hC + rw [image_preimage_eq C hs] + refine ⟨hCE.1, ?_, rfl⟩ + have : C ⊆ D.U := subset_closure.trans (D.closure_subset_U hC) + rw [hDU] at this + exact disjoint_left.mpr fun x hx hxe => (this hx).2 hxe + +/-- The image in `G` of a subgraph of `G_e`. -/ +@[expose] noncomputable def cutImage (G : Drawing S) (φ : S_e → S) (H₁ : Drawing S_e) : Drawing S := + G.span (φ '' H₁.V) (image φ '' H₁.E) + +omit [T2Space S_e] in +/-- A subgraph of a graph that lies over `G` matches its image. -/ +theorem matched_cutImage_of {H₁ G_e : Drawing S_e} (hc : Continuous φ) (hinj : InjOn φ G_e.U) + (hVe : G_e.V = φ ⁻¹' G.V) + (hEe : ∀ f₁ ∈ G_e.E, φ '' f₁ ∈ G.E) (hsub : H₁.IsSubdrawing G_e) : + IsMatched H₁ (cutImage G φ H₁) φ ∅ := by + have hcl : ∀ f₁ : Set S_e, closure (φ '' f₁) = φ '' closure f₁ := fun f₁ => + (image_closure_subset_closure_image hc).antisymm' (closure_minimal (image_mono subset_closure) + (isClosed_closure.isCompact.image hc).isClosed) + have hUs := hsub.U_subset + have hE : image φ '' H₁.E ∩ G.E = image φ '' H₁.E := inter_eq_left.mpr (by + rintro _ ⟨f₁, hf₁, rfl⟩ + exact hEe _ (hsub.2 hf₁)) + have hVs : φ '' H₁.V ∩ G.V = φ '' H₁.V := inter_eq_left.mpr (by + rintro _ ⟨x, hx, rfl⟩ + have : x ∈ G_e.V := hsub.1 hx + rw [hVe] at this + exact this) + have hV : (cutImage G φ H₁).V = φ '' H₁.V := by + change G.spanV _ _ = _ + rw [Drawing.spanV, hE, hVs] + refine union_eq_left.mpr (iUnion₂_subset ?_) + rintro _ ⟨f₁, hf₁, rfl⟩ x ⟨hx, hxV⟩ + rw [hcl] at hx + obtain ⟨y, hy, rfl⟩ := hx + refine ⟨y, ?_, rfl⟩ + by_contra hn + have h1 : y ∈ closure f₁ \ H₁.V := ⟨hy, hn⟩ + rw [H₁.closure_diff_V hf₁] at h1 + have h2 := (hsub.2 hf₁).2.1 h1 + apply h2.2 + rw [hVe] + exact hxV + have hU : (cutImage G φ H₁).U = φ '' H₁.U := by + change G.spanU _ _ = _ + rw [Drawing.spanU] + have : G.spanV (φ '' H₁.V) (image φ '' H₁.E) = φ '' H₁.V := hV + rw [this, hE, H₁.U_eq, image_union, image_iUnion₂] + congr 1 + ext x + simp only [mem_iUnion, exists_prop, mem_image, ← hcl] + constructor + · rintro ⟨_, ⟨f₁, hf₁, rfl⟩, hx⟩ + exact ⟨f₁, hf₁, hx⟩ + · rintro ⟨f₁, hf₁, hx⟩ + exact ⟨_, ⟨f₁, hf₁, rfl⟩, hx⟩ + refine ⟨hc, hinj.mono hUs, empty_subset _, fun _ _ => disjoint_empty _, by rw [hU, + sdiff_empty], by rw [hV, sdiff_empty], ?_⟩ + rw [cutImage, Drawing.span_E, hE] + +omit [T2Space S_e] in +theorem IsCutAlongEdge.matched_cutImage (hCut : IsCutAlongEdge G e a b c S_e φ G_e) {H₁ : Drawing + S_e} (hsub : H₁.IsSubdrawing G_e) : + IsMatched H₁ (cutImage G φ H₁) φ ∅ := + matched_cutImage_of hCut.quotientMap.continuous (fun x hx y _ he => + (hCut.inj x y he).resolve_right (by + have := hx + rw [hCut.preimage_U] at this + exact this.2)) hCut.preimage_V (fun f₁ hf₁ => (hCut.exists_edge hf₁).1) hsub + +/-- `H₀` off `ē`, in `Σ_e`, with the two ends of the cut added. -/ +noncomputable def cutLift (H₀ : Drawing S) (u v : S) (hB : Disjoint + ({u, v} : Set S) H₀.U) (hc : Continuous φ) (hs : Surjective φ) + (hi : InjOn φ (φ ⁻¹' (addIsolated H₀ {u, v} (by simp) hB).U)) : Drawing S_e := + pullDrawing (addIsolated H₀ {u, v} (by simp) hB) hc hs hi + +omit [T2Space S_e] in +theorem IsCutAlongEdge.matched_cutLift (hCut : IsCutAlongEdge G e a b c S_e φ G_e) {H₀ : Drawing S} + {u v : S} {u' v' : S_e} (hu : φ u' = u) (hv : φ v' = v) + (huniq : ∀ x, φ x = u ∨ φ x = v → x = u' ∨ x = v') (hB : Disjoint ({u, v} : Set S) H₀.U) + (hi : InjOn φ (φ ⁻¹' (addIsolated H₀ {u, v} (by simp) hB).U)) : + IsMatched (cutLift H₀ u v hB hCut.quotientMap.continuous hCut.quotientMap.surjective hi) H₀ φ + {u', v'} := by + classical + have hc := hCut.quotientMap.continuous + have hs := hCut.quotientMap.surjective + set H' := cutLift H₀ u v hB hc hs hi with hH' + have hUd : H'.U = φ ⁻¹' (H₀.U ∪ {u, v}) := rfl + have hVd : H'.V = φ ⁻¹' (H₀.V ∪ {u, v}) := rfl + have hoff : ∀ x, x ∈ H₀.U → x ≠ u ∧ x ≠ v := fun x hx => by + constructor + · rintro rfl + exact disjoint_left.mp hB (by simp) hx + · rintro rfl + exact disjoint_left.mp hB (by simp) hx + have hEd : H'.E = preimage φ '' H₀.E := by + have h : H'.U \ H'.V = φ ⁻¹' (H₀.U \ H₀.V) := by + rw [hUd, hVd] + ext x + simp only [mem_sdiff, mem_preimage, mem_union, mem_insert_iff, mem_singleton_iff, not_or] + constructor + · rintro ⟨h1 | h1 | h1, h2, h3⟩ + · exact ⟨h1, h2⟩ + · exact absurd h1 h3.1 + · exact absurd h1 h3.2 + · rintro ⟨h1, h2⟩ + exact ⟨.inl h1, h2, (hoff _ h1).1, (hoff _ h1).2⟩ + change arcComponentsIn (H'.U \ H'.V) = _ + rw [h] + exact arcComponentsIn_preimage hc hs H₀.isClosed_U (hi.mono (preimage_mono subset_union_left)) + sdiff_subset + have himg : ∀ {P : Set S}, P ⊆ H₀.U → φ '' (φ ⁻¹' (P ∪ {u, v}) \ {u', v'}) = P := fun {P} hP => by + ext y + constructor + · rintro ⟨x, ⟨hx1, hx2⟩, rfl⟩ + rcases hx1 with h1 | h1 + · exact h1 + · exact absurd (huniq x (by simpa using h1)) (by simpa using hx2) + · intro hy + obtain ⟨x, rfl⟩ := hs y + refine ⟨x, ⟨.inl hy, ?_⟩, rfl⟩ + rintro (rfl | rfl) + · exact (hoff _ (hP hy)).1 hu + · exact (hoff _ (hP hy)).2 hv + refine ⟨hc, hi, ?_, ?_, himg subset_rfl, himg H₀.V_subset_U, ?_⟩ + · rintro x (rfl | rfl) + · exact .inr (by simp [hu]) + · exact .inr (by simp [hv]) + · intro f hf + rw [hEd] at hf + obtain ⟨C, hC, rfl⟩ := hf + have hiC : InjOn φ (φ ⁻¹' closure C) := hi.mono (preimage_mono ((H₀.closure_subset_U hC).trans + subset_union_left)) + rw [closure_preimage_of_injOn hc hs hiC, disjoint_left] + rintro x hx (rfl | rfl) + · exact (hoff _ (H₀.closure_subset_U hC hx)).1 hu + · exact (hoff _ (H₀.closure_subset_U hC hx)).2 hv + · rw [hEd, image_image] + have : (fun C => φ '' (φ ⁻¹' C)) = id := funext fun C => image_preimage_eq C hs + change H₀.E = (fun C => φ '' (φ ⁻¹' C)) '' H₀.E + rw [this, image_id] + +end Cut + +private theorem lifted_forest_has_cut_boundary_vertices + {S : Type u} + {S_e : Type u} + [TopologicalSpace S] + [TopologicalSpace S_e] + (G : Drawing S) + (e : Set S) + (φ : S_e → S) + (G_e : Drawing S_e) + (u : S) + (v : S) + (hucap : u ∈ closure e ∩ G.V) + (hvcap : v ∈ closure e ∩ G.V) + (H₀ : Drawing S) + (hH₀bd : H₀.V ∩ bd S = G.V ∩ bd S) + (H' : Drawing S_e) + (hVd : ∀ (x : S_e), x ∈ H'.V ↔ φ x ∈ H₀.V ∨ φ x = u ∨ φ x = v) + (hbde : ∀ (x : S_e), x ∈ bd S_e ↔ φ x ∈ bd S ∨ φ x ∈ closure e) + (hGVe : ∀ (x : S_e), x ∈ G_e.V ↔ φ x ∈ G.V) + (huU : ∀ (x : S_e), φ x ∈ closure e → φ x ∉ H₀.U) + (hcapE : ∀ (x : S_e), φ x ∈ closure e → φ x ∈ G.V → φ x = u ∨ φ x = v) : + G_e.V ∩ bd S_e = H'.V ∩ bd S_e := by + ext x + constructor + · rintro ⟨h1, h2⟩ + refine ⟨?_, h2⟩ + rw [hGVe] at h1 + rw [hVd] + rcases (hbde x).mp h2 with h3 | h3 + · have : φ x ∈ H₀.V ∩ bd S := by + rw [hH₀bd] + exact ⟨h1, h3⟩ + exact .inl this.1 + · exact .inr (hcapE x h3 h1) + · rintro ⟨h1, h2⟩ + refine ⟨?_, h2⟩ + rw [hGVe] + rcases (hVd x).mp h1 with h3 | h3 | h3 + · rcases (hbde x).mp h2 with h4 | h4 + · have : φ x ∈ G.V ∩ bd S := by + rw [← hH₀bd] + exact ⟨h3, h4⟩ + exact this.1 + · exact absurd (H₀.V_subset_U h3) (huU x h4) + · rw [h3] + exact hucap.2 + · rw [h3] + exact hvcap.2 + +private theorem cut_boundary_vertex_count + {S : Type u} + {S_e : Type u} + [TopologicalSpace S] + [TopologicalSpace S_e] + (a : ℕ) + (b : ℕ) + (G : Drawing S) + (e : Set S) + (φ : S_e → S) + (G_e : Drawing S_e) + (hCut : IsCutAlongEdge G e a b 1 S_e φ G_e) + (u : S) + (v : S) + (heV : ∀ x ∈ e, x ∉ G.V) + (u' : S_e) + (v' : S_e) + (huniq : ∀ (x : S_e), φ x = u ∨ φ x = v → x = u' ∨ x = v') + (hne' : u' ≠ v') + (hbde : ∀ (x : S_e), x ∈ bd S_e ↔ φ x ∈ bd S ∨ φ x ∈ closure e) + (hGVe : ∀ (x : S_e), x ∈ G_e.V ↔ φ x ∈ G.V) + (hcapE : ∀ (x : S_e), φ x ∈ closure e → φ x ∈ G.V → φ x = u ∨ φ x = v) : + (G_e.V ∩ bd S_e).ncard ≤ (G.V ∩ bd S).ncard + 2 := by + have hfinG : (G.V ∩ bd S).Finite := G.finite_V.subset inter_subset_left + have hsub : G_e.V ∩ bd S_e ⊆ ((G_e.V ∩ bd S_e) \ {u', v'}) ∪ {u', v'} := fun x hx => by + by_cases h : x ∈ ({u', v'} : Set S_e) + · exact .inr h + · exact .inl ⟨hx, h⟩ + have hmaps : MapsTo φ ((G_e.V ∩ bd S_e) \ {u', v'}) (G.V ∩ bd S) := fun x hx => by + have h1 := (hGVe x).mp hx.1.1 + refine ⟨h1, ?_⟩ + rcases (hbde x).mp hx.1.2 with h2 | h2 + · exact h2 + · exact absurd (huniq x (hcapE x h2 h1)) hx.2 + have hinj : InjOn φ ((G_e.V ∩ bd S_e) \ {u', v'}) := fun x hx y hy hxy => by + refine (hCut.inj x y hxy).resolve_right fun h1 => ?_ + exact heV _ h1 (hmaps hx).1 + have hfin : ((G_e.V ∩ bd S_e) \ {u', v'}).Finite := Set.Finite.of_injOn hmaps hinj hfinG + calc (G_e.V ∩ bd S_e).ncard ≤ (((G_e.V ∩ bd S_e) \ {u', v'}) ∪ {u', v'}).ncard + := ncard_le_ncard hsub (hfin.union (by simp)) + _ ≤ ((G_e.V ∩ bd S_e) \ {u', v'}).ncard + ({u', v'} : Set S_e).ncard := ncard_union_le _ _ + _ ≤ (G.V ∩ bd S).ncard + 2 := by + refine Nat.add_le_add (ncard_le_ncard_of_injOn φ hmaps hinj hfinG) ?_ + rw [ncard_pair hne'] + +private theorem few_small_cuffs_after_cut + {S : Type u} + {S_e : Type u} + [TopologicalSpace S] + [TopologicalSpace S_e] + (a : ℕ) + (b : ℕ) + (G : Drawing S) + (e : Set S) + (φ : S_e → S) + (G_e : Drawing S_e) + (hCut : IsCutAlongEdge G e a b 1 S_e φ G_e) + (hSe : IsSurface S_e) + (u : S) + (v : S) + (hucap : u ∈ closure e ∩ G.V) + (hvcap : v ∈ closure e ∩ G.V) + (H₀ : Drawing S) + (u' : S_e) + (hu : φ u' = u) + (v' : S_e) + (hv : φ v' = v) + (huniq : ∀ (x : S_e), φ x = u ∨ φ x = v → x = u' ∨ x = v') + (hne' : u' ≠ v') + (H' : Drawing S_e) + (hmat : IsMatched H' H₀ φ {u', v'}) + (hGVe : ∀ (x : S_e), x ∈ G_e.V ↔ φ x ∈ G.V) : + {C | C ∈ cuffs S_e ∧ (G_e.V ∩ C).ncard ≤ 1}.ncard ≤ 1 := by + have hcuffs : (cuffs S_e).ncard = 2 := ncard_cuffs_of_homeomorph_surfaceModel hCut.homeo_model + have hfin : (cuffs S_e).Finite := (cuff_statement.{u} S_e hSe).2.1 + have hnew := hCut.newCuff + have hsub : {C ∈ cuffs S_e | (G_e.V ∩ C).ncard ≤ 1} ⊆ cuffs S_e \ {φ ⁻¹' closure e} := by + rintro C ⟨hC, hle⟩ + refine ⟨hC, fun hCe => ?_⟩ + rw [mem_singleton_iff] at hCe + subst hCe + have hp : ({u', v'} : Set S_e) ⊆ G_e.V ∩ φ ⁻¹' closure e := by + rintro x (rfl | rfl) + · exact ⟨(hGVe _).mpr (by rw [hu]; exact hucap.2), by rw [mem_preimage, hu]; exact hucap.1⟩ + · exact ⟨(hGVe _).mpr (by rw [hv]; exact hvcap.2), by rw [mem_preimage, hv]; exact hvcap.1⟩ + have := ncard_le_ncard hp (G_e.finite_V.subset inter_subset_left) + rw [ncard_pair hne'] at this + omega + have h1 := ncard_le_ncard hsub (hfin.sdiff) + rw [ncard_sdiff_singleton_of_mem hnew] at h1 + omega + +/-- **The step of (7.5), page 241.** Given a cut edge `e` with `α(G_e) ≥ ⌊28kv/3⌋`, moving `H` off +`ē` and adding the two ends of the cut gives a forest `H'` +in `Σ_e` such that `|V(G_e) ∩ bd(Σ_e)| ≤ 2k - 2g`, where `g` counts the cuffs of `Σ_e` with at most +one vertex, and `H'` being `G_e`-feasible makes `H` +`G`-feasible. The paper applies (6.1) here, but its hypothesis `≤ 2k - 2c` fails, since the cut adds +two vertices. What holds, and what the proof of (6.1) uses, +is the bound here. See the correction to the proof of (7.5) in `corrections/GM07.md`. -/ +theorem oneCuffCutEdgeFeasibilityStep {S S_e : Type u} [TopologicalSpace S] [TopologicalSpace S_e] + [T1Space S] + (hS : IsSurface S) (a b : ℕ) (hm : Nonempty + (S ≃ₜ SurfaceModel a b 1)) + (k : ℕ) (G H : Drawing S) (e : Set S) (φ : S_e → S) (G_e : Drawing S_e) + (hcard : (G.V ∩ bd S).ncard + 4 ≤ 2 * k) + (hH : IsSurfaceForest H) (hbdeq : G.V ∩ bd S = H.V ∩ bd S) + (hCut : IsCutAlongEdge G e a b 1 S_e φ G_e) + (hα : (28 * k * vModel a b 2 k) / 3 ≤ alpha G_e) : + ∃ H' : Drawing S_e, + IsSurfaceForest H' ∧ G_e.V ∩ bd S_e = H'.V ∩ bd S_e ∧ + (G_e.V ∩ bd S_e).ncard ≤ 2 * k - 2 * {C ∈ cuffs S_e | (G_e.V ∩ C).ncard ≤ 1}.ncard ∧ + 9 * k * vSurface S_e k < alpha G_e ∧ + (IsGFeasible G_e H' → IsGFeasible G H) := by + classical + have ht2 : T2Space S := hS.2.1 + have hcS : CompactSpace S := hS.1 + have hSe := hCut.isSurface + have ht2e : T2Space S_e := hSe.2.1 + have hce : CompactSpace S_e := hSe.1 + have hConn : ConnectedSpace S := connectedSpace_of_model hm + have hc := hCut.quotientMap.continuous + have hs := hCut.quotientMap.surjective + have hneS : Nonempty S := inferInstance + have hneSe : Nonempty S_e := by + obtain ⟨x⟩ := hneS + obtain ⟨y, -⟩ := hs x + exact ⟨y⟩ + have he := hCut.mem_E + have hd := hCut.disjoint_bd + have hl := hCut.not_loop + obtain ⟨u, v, huv, hcap, hL⟩ : ∃ u v : S, u ≠ v ∧ closure e ∩ G.V = {u, v} ∧ IsLineWithEnds + (closure e) u v := by + rcases G.edge_cond e he with h1 | ⟨u, hcap, -⟩ + · exact h1 + · rw [GraphMinor.GM19.tilde_eq_inter_V G he, hcap] at hl + simp at hl + have hucap : u ∈ closure e ∩ G.V := by rw [hcap]; simp + have hvcap : v ∈ closure e ∩ G.V := by rw [hcap]; simp + have heV : ∀ x ∈ e, x ∉ G.V := fun x hx => (he.2.1 hx).2 + obtain ⟨hmo⟩ := id hm + have hM : IsSurface (SurfaceModel a b 1) := (modelCriterion.1 a b 1).1 + obtain ⟨β, hβfix, hβoff⟩ := exists_move_off_line hS hM hmo hH hL hd + set H₀ := mapDrawingHomeo β H with hH₀def + have hH₀ : IsSurfaceForest H₀ := hH.map_homeo β + have hoff : Disjoint H₀.U (closure e) := hβoff + have hH₀bd : H₀.V ∩ bd S = G.V ∩ bd S := by + rw [hbdeq] + ext x + constructor + · rintro ⟨⟨y, hy, rfl⟩, hb⟩ + have hyx : y = β y := by + apply β.injective + rw [hβfix _ hb] + rw [← hyx] at hb ⊢ + exact ⟨hy, hb⟩ + · rintro ⟨hx, hb⟩ + exact ⟨⟨x, hx, hβfix x hb⟩, hb⟩ + obtain ⟨u', hu⟩ := hs u + obtain ⟨v', hv⟩ := hs v + have huniq : ∀ x, φ x = u ∨ φ x = v → x = u' ∨ x = v' := by + rintro x (h | h) + · exact .inl ((hCut.inj x u' (h.trans hu.symm)).resolve_right fun h1 => heV _ h1 (h ▸ hucap.2)) + · exact .inr ((hCut.inj x v' (h.trans hv.symm)).resolve_right fun h1 => heV _ h1 (h ▸ hvcap.2)) + have hne' : u' ≠ v' := fun h => huv (by rw [← hu, ← hv, h]) + have hB : Disjoint ({u, v} : Set S) H₀.U := by + rw [disjoint_left] + rintro x (rfl | rfl) hx + · exact disjoint_left.mp hoff hx hucap.1 + · exact disjoint_left.mp hoff hx hvcap.1 + have hi : InjOn φ (φ ⁻¹' (addIsolated H₀ {u, v} (by simp) hB).U) := by + refine hCut.injOn_off ?_ + rw [disjoint_left] + rintro x (hx | rfl | rfl) hxe + · exact disjoint_left.mp hoff hx (subset_closure hxe) + · exact heV _ hxe hucap.2 + · exact heV _ hxe hvcap.2 + set H' := cutLift H₀ u v hB hc hs hi with hH' + have hmat : IsMatched H' H₀ φ {u', v'} := hCut.matched_cutLift hu hv huniq hB hi + have hUd : ∀ x, x ∈ H'.U ↔ φ x ∈ H₀.U ∨ φ x = u ∨ φ x = v := fun x => Iff.rfl + have hVd : ∀ x, x ∈ H'.V ↔ φ x ∈ H₀.V ∨ φ x = u ∨ φ x = v := fun x => Iff.rfl + have hbde : ∀ x, x ∈ bd S_e ↔ φ x ∈ bd S ∨ φ x ∈ closure e := fun x => by + rw [hCut.bd_eq] + rfl + have hGVe : ∀ x, x ∈ G_e.V ↔ φ x ∈ G.V := fun x => by + rw [hCut.preimage_V] + rfl + have hbdoff : ∀ x, x ∈ closure e → x ∉ bd S := fun x h1 h2 => by + have : x ∈ closure e ∩ bd S := ⟨h1, h2⟩ + rw [hd] at this + exact this + have huU : ∀ x, φ x ∈ closure e → φ x ∉ H₀.U := fun x h1 h2 => disjoint_left.mp hoff h2 h1 + have hcapE : ∀ x, φ x ∈ closure e → φ x ∈ G.V → φ x = u ∨ φ x = v := fun x h1 h2 => by + have : φ x ∈ closure e ∩ G.V := ⟨h1, h2⟩ + rw [hcap] at this + simpa using this + have hbdE : G_e.V ∩ bd S_e = H'.V ∩ bd S_e := by + exact lifted_forest_has_cut_boundary_vertices (S := S) (S_e := S_e) G e φ G_e u v hucap hvcap + H₀ hH₀bd H' hVd hbde hGVe huU hcapE + have hproper : H'.IsProper := by + rintro x ⟨hb, hU⟩ + rw [hVd] + rcases (hUd x).mp hU with h1 | h1 + · rcases (hbde x).mp hb with h2 | h2 + · exact .inl (hH₀.1 ⟨h2, h1⟩) + · exact absurd h1 (huU x h2) + · exact .inr h1 + have hforest : IsSurfaceForest H' := ⟨hproper, hmat.isGraphForest_iff.mpr hH₀.2⟩ + -- The count on the boundary. + have hZ : (G_e.V ∩ bd S_e).ncard ≤ (G.V ∩ bd S).ncard + 2 := by + exact cut_boundary_vertex_count (S := S) (S_e := S_e) a b G e φ G_e hCut u v heV u' v' huniq + hne' hbde hGVe hcapE + have hg : {C ∈ cuffs S_e | (G_e.V ∩ C).ncard ≤ 1}.ncard ≤ 1 := by + exact few_small_cuffs_after_cut (S := S) (S_e := S_e) a b G e φ G_e hCut hSe u v hucap hvcap + H₀ u' hu v' hv huniq hne' H' hmat hGVe + have hvm : 2 * k ≤ vModel a b 2 k := by + unfold vModel + omega + have hk : 2 ≤ k := by omega + have halpha : 9 * k * vSurface S_e k < alpha G_e := by + have h1 : vSurface S_e k ≤ vModel a b 2 k := vSurface_le_vModel hCut.homeo_model k + set w := vModel a b 2 k + have h2 : 9 * k * vSurface S_e k ≤ 9 * k * w := Nat.mul_le_mul_left _ h1 + have h3' : 9 * k * w + 1 ≤ 28 * k * w / 3 := by + rw [Nat.le_div_iff_mul_le (by norm_num)] + nlinarith + omega + refine ⟨H', hforest, hbdE, by omega, halpha, ?_⟩ + -- Feasibility comes down. + rintro ⟨H₁, hH₁, ⟨α', hα'fix, hhom⟩, hsub⟩ + obtain ⟨α, hcomm⟩ := hCut.exists_descent α' hα'fix + have hαfix : ∀ x ∈ bd S, α x = x := fun x hx => by + obtain ⟨y, rfl⟩ := hs x + rw [← hcomm, hα'fix y ((hbde y).mpr (.inl hx))] + set H₂ := cutImage G φ H₁ with hH₂ + have m₂ : IsMatched H₁ H₂ φ ∅ := hCut.matched_cutImage hsub + have hBfix : α' '' {u', v'} = {u', v'} := by + rw [image_pair, hα'fix u' ((hbde _).mpr (.inr (hu ▸ hucap.1))), + hα'fix v' ((hbde _).mpr (.inr (hv ▸ hvcap.1)))] + have m₁ : IsMatched (mapDrawingHomeo α' H') (mapDrawingHomeo α H₀) φ {u', v'} + := hBfix ▸ hmat.map α' α hcomm + have hbdhom : (mapDrawingHomeo α' H').V ∩ bd S_e = H₁.V ∩ bd S_e := hhom.2.2.2.2.1 + have hp₂ : H₂.IsProper := by + rintro x ⟨hb, hU⟩ + rw [← m₂.image_U, sdiff_empty] at hU + obtain ⟨y, hy, rfl⟩ := hU + rw [← m₂.image_V, sdiff_empty] + exact ⟨y, hH₁.1 ⟨(hbde y).mpr (.inl hb), hy⟩, rfl⟩ + have hlift : ∀ s ∈ (mapDrawingHomeo α H₀).V ∩ bd S, ∃ x, φ x = s ∧ x ∈ + (mapDrawingHomeo α' H').V \ {u', v'} ∧ x ∈ bd S_e ∧ x ∈ H₁.V \ ∅ := by + rintro _ ⟨⟨y, hy, rfl⟩, hb⟩ + have hyb : y = α y := by + apply α.injective + rw [hαfix _ hb] + rw [← hyb] at hb ⊢ + obtain ⟨x, rfl⟩ := hs y + have hxb : x ∈ bd S_e := (hbde x).mpr (.inl hb) + have hxV : x ∈ (mapDrawingHomeo α' H').V := ⟨x, (hVd x).mpr (.inl hy), hα'fix x hxb⟩ + have hx₁ : x ∈ H₁.V ∩ bd S_e := by + rw [← hbdhom] + exact ⟨hxV, hxb⟩ + refine ⟨x, rfl, ⟨hxV, ?_⟩, hxb, hx₁.1, not_false⟩ + rintro (rfl | rfl) + · exact huU _ (hu ▸ hucap.1) (H₀.V_subset_U hy) + · exact huU _ (hv ▸ hvcap.1) (H₀.V_subset_U hy) + have hV : (mapDrawingHomeo α H₀).V ∩ bd S = H₂.V ∩ bd S := by + ext s + constructor + · intro h1 + obtain ⟨x, rfl, -, -, hx, -⟩ := hlift s h1 + refine ⟨?_, h1.2⟩ + rw [← m₂.image_V, sdiff_empty] + exact ⟨x, hx, rfl⟩ + · rintro ⟨h1, hb⟩ + rw [← m₂.image_V, sdiff_empty] at h1 + obtain ⟨x, hx, rfl⟩ := h1 + have hxb : x ∈ bd S_e := (hbde x).mpr (.inl hb) + have h2 : x ∈ (mapDrawingHomeo α' H').V ∩ bd S_e := by + rw [hbdhom] + exact ⟨hx, hxb⟩ + obtain ⟨z, hz, hzx⟩ := h2.1 + have hzeq : z = x := by + apply α'.injective + rw [hzx, hα'fix x hxb] + subst hzeq + refine ⟨⟨φ z, ?_, hαfix _ hb⟩, hb⟩ + rcases (hVd z).mp hz with h3 | h3 | h3 + · exact h3 + · exact absurd hb (hbdoff _ (h3 ▸ hucap.1)) + · exact absurd hb (hbdoff _ (h3 ▸ hvcap.1)) + have hfin := m₁.forestsHomotopic m₂ hhom (hH₀.map_homeo α).1 hp₂ hV hlift + refine ⟨H₂, ⟨hp₂, m₂.isGraphForest_iff.mp hH₁.2⟩, ⟨β.trans α, fun x hx => ?_, ?_⟩, + Drawing.span_isSubdrawing _ _ _⟩ + · simp [Homeomorph.trans_apply, hβfix x hx, hαfix x hx] + · rw [← mapDrawingHomeo_trans] + exact hfin + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CutForest.lean b/LeanPool/GraphMinor/GM07/CutForest.lean new file mode 100644 index 0000000000..55a825dab2 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CutForest.lean @@ -0,0 +1,324 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CutLines +public import LeanPool.GraphMinor.GM07.CutBuild +public import LeanPool.GraphMinor.GM07.TameDisc +public import LeanPool.GraphMinor.GM12.Section4FiniteLineDrawing +public import LeanPool.GraphMinor.Surface.CutIArc +public import LeanPool.GraphMinor.GM17.PasteCuff +import LeanPool.GraphMinor.GM19.Section6a + +/-! +# Cutting along a forest + +The surface `Σ'` in the proof of Graph Minors VII, (4.6) (page 225) comes from cutting along a +forest whose trees each meet `bd(Σ)` in at most one point. We grow such a forest one line at a time +(`IsGrowth`). A new line either misses +what is there, or meets it in one end. A line that misses it adds a cuff (`exists_cut_free_line`). A +line attached by one end leaves the surface as it was, since cutting along its far part adds a cuff, +and cutting along its near part joins this cuff +to the old one (`exists_cut_attached`). After the first line, the other lines lift to the cut +surface and grow there in the same way (`IsGrowth.lift`), so the cut goes by induction +(`exists_cut_growth`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM19 + +universe u + +variable {S S₁ S₂ : Type u} [TopologicalSpace S] [TopologicalSpace S₁] [TopologicalSpace S₂] + +/-- A cut does not change if `F` changes only on the boundary. -/ +theorem IsCutAlongSet.congr {F F' : Set S} {θ : S₁ → S} (h : IsCutAlongSet F θ) (he : bd S ∪ F + = bd S ∪ F') : IsCutAlongSet F' θ := + ⟨h.isSurface, h.quotientMap, he ▸ h.preimage_bd, h.interior_inj, h.finite_fiber⟩ + +/-- Nothing is cut by the identity. -/ +theorem isCutAlongSet_id (hS : IsSurface S) : IsCutAlongSet (∅ : Set S) (id : S → S) := + ⟨hS, Topology.IsQuotientMap.id, by simp, fun _ _ _ h => h, fun x => by simp⟩ + +/-- A cut along `F` is one to one off `bd S ∪ F`. -/ +theorem IsCutAlongSet.isCutMap {F : Set S} {θ : S₁ → S} (h : IsCutAlongSet F θ) : IsCutMap θ + (bd S ∪ F) := by + refine ⟨h.quotientMap.continuous, h.quotientMap.surjective, fun x hx y _ he => h.interior_inj x + (fun hb => hx ?_) y he, h.finite_fiber, h.preimage_bd.subset⟩ + rw [← h.preimage_bd] at hb + exact hb + +/-- **Cutting along a line off the boundary** adds a cuff. -/ +theorem exists_cut_free_line (hS : IsSurface S) {a b c : ℕ} (hm : Nonempty + (S ≃ₜ SurfaceModel a b c)) {A : Set S} {u v : S} (hA : IsLineWithEnds A u v) (hd : A ∩ bd S = ∅) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (θ : Y → S), IsCutAlongSet A θ ∧ IsCutMap θ A + ∧ Nonempty (Y ≃ₜ SurfaceModel a b (c + 1)) ∧ θ ⁻¹' A ∈ cuffs Y := by + classical + have ht2 : T2Space S := hS.2.1 + have hne : u ≠ v := hA.ne' + have huA : u ∈ A := hA.left_mem + have hvA : v ∈ A := hA.right_mem + have hsubA : ({u, v} : Set S) ⊆ A := by + rintro z (rfl | rfl) + · exact huA + · exact hvA + have hAV : A ∩ {u, v} = {u, v} := inter_eq_right.mpr hsubA + obtain ⟨H, hU, hV, hE⟩ := GM12.exists_drawing_of_finite_lines (S := S) (ι := Unit) (V := {u, v}) + (by simp) (E := {()}) (finite_singleton _) (fun _ => A) (fun _ => u) (fun _ => v) + (fun _ _ => hA) (fun _ _ => hne) (fun _ _ => hAV) (fun _ hi _ hj hij => absurd rfl hij) + have hHU : H.U = A := by + rw [hU, biUnion_singleton] + exact union_eq_right.mpr hsubA + have he : A \ {u, v} ∈ H.E := by + rw [hE] + exact ⟨(), rfl, rfl⟩ + have hcl : closure (A \ {u, v}) = A := + Subset.antisymm (closure_minimal sdiff_subset hA.isCompact.isClosed) hA.subset_closure_diff + have hl : (tilde (A \ {u, v})).ncard = 2 := by + rw [GM19.tilde_eq_inter_V H he, hcl, hV, hAV, ncard_pair hne] + have hG : H.IsProper := fun z hz => ((eq_empty_iff_forall_notMem.mp hd z) ⟨hHU ▸ hz.2, hz.1⟩).elim + have ht1 : T1Space S := inferInstance + obtain ⟨Y, tY, _, θ, G', hc⟩ := exists_cut hS hm H hG he hl (by rw [hcl]; exact hd) + refine ⟨Y, tY, θ, hcl ▸ IsCutAlongSet.of_cutAlongEdge hc, ?_, hc.homeo_model, hcl ▸ hc.newCuff⟩ + refine ⟨hc.quotientMap.continuous, hc.quotientMap.surjective, fun x hx y _ hxy => ?_, + hc.finite_fiber, fun x hx => ?_⟩ + · exact (hc.inj x y hxy).resolve_right fun h => hx h.1 + · rw [hc.bd_eq, hcl] + exact .inr hx + +/-- **Cutting along a line attached to the boundary by one end** leaves the model as it was. -/ +theorem exists_cut_attached (hS : IsSurface S) {a b c : ℕ} (hm : Nonempty + (S ≃ₜ SurfaceModel a b c)) {A : Set S} {p q : S} (hA : IsLineWithEnds A p q) (hd : A ∩ bd S + = {p}) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (θ : Y → S), IsCutAlongSet A θ ∧ Nonempty + (Y ≃ₜ SurfaceModel a b c) := by + classical + have ht2 : T2Space S := hS.2.1 + obtain ⟨α, hα, hr, h0, h1⟩ := hA.exists_arc + obtain ⟨t, ht0, ht1⟩ := exists_between (show (0 : unitInterval) < 1 from zero_lt_one) + have hmA : α t ∈ A := hr ▸ mem_range_self t + have hmp : α t ≠ p := fun h => ht0.ne' (hα.2 (h.trans h0.symm)) + have hmq : α t ≠ q := fun h => ht1.ne (hα.2 (h.trans h1.symm)) + obtain ⟨A₁, A₂, hA₁, hA₂, hun, hin⟩ := hA.split hmA hmp hmq + have hA₂d : A₂ ∩ bd S = ∅ := by + refine eq_empty_iff_forall_notMem.mpr fun z hz => ?_ + have hzp : z = p := by + have : z ∈ A ∩ bd S := ⟨hun ▸ Or.inr hz.1, hz.2⟩ + rw [hd] at this + exact this + subst hzp + have : z ∈ A₁ ∩ A₂ := ⟨hA₁.left_mem, hz.1⟩ + rw [hin] at this + exact hmp this.symm + obtain ⟨Y₁, tY₁, θ, hcut, hmap, ⟨e₁⟩, hN⟩ := exists_cut_free_line hS hm hA₂ hA₂d + have hY₁ : IsSurface Y₁ := hcut.isSurface + have : CompactSpace Y₁ := hY₁.1 + have : T2Space Y₁ := hY₁.2.1 + have hconn : ConnectedSpace Y₁ := by + have := (modelCriterion.1 a b (c + 1)).2 + exact e₁.symm.surjective.connectedSpace e₁.symm.continuous + obtain ⟨F, m', p', hF, hm', hp', him, hinj, hpre⟩ := exists_lift_line hmap hA₂.isCompact.isClosed + hA₁.symm (by rw [hin]) + have hm'F : m' ∈ F := hF.left_mem + have hp'F : p' ∈ F := hF.right_mem + have hA₁₂ : ∀ z ∈ F, θ z ∈ A₁ := fun z hz => him ▸ mem_image_of_mem θ hz + have hbd : F ∩ bd Y₁ = {m', p'} := by + ext z + constructor + · rintro ⟨hz, hzb⟩ + rw [← hcut.preimage_bd] at hzb + rcases hzb with h | h + · have : θ z ∈ A ∩ bd S := ⟨hun ▸ Or.inl (hA₁₂ z hz), h⟩ + rw [hd] at this + exact .inr (hinj hz hp'F (this.trans hp'.symm)) + · have : θ z ∈ A₁ ∩ A₂ := ⟨hA₁₂ z hz, h⟩ + rw [hin] at this + exact .inl (hinj hz hm'F (this.trans hm'.symm)) + · rintro (rfl | rfl) + · refine ⟨hm'F, ?_⟩ + rw [← hcut.preimage_bd] + refine .inr ?_ + rw [hm'] + exact hA₂.left_mem + · refine ⟨hp'F, ?_⟩ + rw [← hcut.preimage_bd] + refine .inl ?_ + rw [hp'] + have : p ∈ A ∩ bd S := by rw [hd]; rfl + exact this.2 + have hmb : m' ∈ bd Y₁ := (show m' ∈ F ∩ bd Y₁ by rw [hbd]; exact .inl rfl).2 + have hne : m' ≠ p' := hF.ne' + obtain ⟨S', tS', ψ, hS', hψ, hdiff, -, -⟩ := cutIArc Y₁ F m' p' hY₁ hconn hne hbd hF + have hcomp : connectedComponentIn (bd Y₁) m' ≠ connectedComponentIn (bd Y₁) p' := by + intro he + have hmN : m' ∈ θ ⁻¹' A₂ := by + rw [mem_preimage, hm'] + exact hA₂.left_mem + have hpb : p' ∈ bd Y₁ := (show p' ∈ F ∩ bd Y₁ by rw [hbd]; exact .inr rfl).2 + obtain ⟨x₀, -, hNe⟩ := hN + have hpN : p' ∈ θ ⁻¹' A₂ := by + rw [← hNe] at hmN ⊢ + rw [connectedComponentIn_eq hmN, he] + exact mem_connectedComponentIn hpb + have hpA₂ : p ∈ A₂ := by simpa [mem_preimage, hp'] using hpN + have : p ∈ A₁ ∩ A₂ := ⟨hA₁.left_mem, hpA₂⟩ + rw [hin] at this + exact hmp this.symm + obtain ⟨-, a', b', c', ⟨e₂⟩, ⟨e₃⟩⟩ := hdiff hcomp + obtain ⟨hc', ha', hb'⟩ := (modelCriterion.2 a' b' (c' + 1) a b (c + 1)).mp ⟨e₂.symm.trans e₁⟩ + obtain ⟨e₄⟩ := (modelCriterion.2 a' b' c' a b c).mpr ⟨by omega, ha', hb'⟩ + have hcut₂ : IsCutAlongSet F ψ := IsCutAlongSet.of_isCutting hS' hY₁ hF.isCompact.isClosed hψ + have hbdeq : bd Y₁ ∪ F = bd Y₁ ∪ θ ⁻¹' A₁ := by + have hsub : θ ⁻¹' A₂ ⊆ bd Y₁ := hmap.2.2.2.2 + ext z + constructor + · rintro (h | h) + · exact .inl h + · exact .inr (hA₁₂ z h) + · rintro (h | h) + · exact .inl h + · have : z ∈ θ ⁻¹' (A₁ ∪ A₂) := .inl h + rw [hpre] at this + rcases this with h' | h' + · exact .inr h' + · exact .inl (hsub h') + have hfin := hcut.comp (hcut₂.congr hbdeq) + rw [union_comm, hun] at hfin + exact ⟨S', tS', θ ∘ ψ, hfin, ⟨e₃.trans e₄⟩⟩ + +/-- A forest grown one line at a time from a set `B`. Each new line misses what is there, or meets +it in exactly one end, and the number counts the lines that miss it. -/ +inductive IsGrowth : Set S → List (Set S) → ℕ → Prop + | nil (B : Set S) : IsGrowth B [] 0 + | free {B A : Set S} {l : List (Set S)} {k : ℕ} (hA : IsLine A) (hd : A ∩ B = ∅) (h : IsGrowth + (B ∪ A) l k) : IsGrowth B (A :: l) (k + 1) + | attached {B A : Set S} {l : List (Set S)} {k : ℕ} {p q : S} (hA : IsLineWithEnds A p q) + (hd : A ∩ B = {p}) (h : IsGrowth (B ∪ A) l k) : IsGrowth B (A :: l) k + +/-- The union of a list of sets. -/ +def listUnion (l : List (Set S)) : Set S := ⋃₀ {A | A ∈ l} + +omit [TopologicalSpace S] in +@[simp] theorem listUnion_nil : listUnion ([] : List (Set S)) = ∅ := by simp [listUnion] + +omit [TopologicalSpace S] in +@[simp] theorem listUnion_cons {A : Set S} {l : List (Set S)} : listUnion (A :: l) + = A ∪ listUnion l := by + ext z + simp [listUnion] + +/-- A growth lifts through a cut. -/ +theorem IsGrowth.lift [CompactSpace S₁] [T2Space S₁] [T2Space S] {B₀ B : Set S} {θ : S₁ → S} + (hθ : IsCutMap θ B₀) (hB₀ : IsClosed B₀) {l : List (Set S)} {k : ℕ} (h : IsGrowth B l k) + (hsub : B₀ ⊆ B) : + ∃ l' : List (Set S₁), l'.length = l.length ∧ IsGrowth (θ ⁻¹' B) l' k ∧ θ ⁻¹' (B ∪ listUnion l) + = θ ⁻¹' B ∪ listUnion l' := by + have key : ∀ {A : Set S} {p q : S} {B : Set S}, B₀ ⊆ B → IsLineWithEnds A p q → A ∩ B ⊆ {p} → + ∃ (A' : Set S₁) (p' q' : S₁), IsLineWithEnds A' p' q' ∧ θ p' = p ∧ θ '' A' = A ∧ InjOn θ A' + ∧ θ ⁻¹' (B ∪ A) = θ ⁻¹' B ∪ A' := by + intro A p q B hs hA hd + obtain ⟨A', p', q', hl, hp, -, him, hinj, hpre⟩ := exists_lift_line hθ hB₀ hA (fun z hz + => hd ⟨hz.1, hs hz.2⟩) + refine ⟨A', p', q', hl, hp, him, hinj, ?_⟩ + ext z + constructor + · rintro (h | h) + · exact .inl h + · have : z ∈ θ ⁻¹' (A ∪ B₀) := .inl h + rw [hpre] at this + rcases this with h' | h' + · exact .inr h' + · exact .inl (hs h') + · rintro (h | h) + · exact .inl h + · exact .inr (him ▸ mem_image_of_mem θ h) + induction h with + | nil B => exact ⟨[], rfl, .nil _, by simp⟩ + | @free B A l k hA hd _ ih => + obtain ⟨f⟩ := hA + have hA' : IsLineWithEnds A (f 0).1 (f 1).1 := ⟨f, rfl, rfl⟩ + obtain ⟨A', p', q', hl, -, him, -, heq⟩ := key hsub hA' (by rw [hd]; exact empty_subset _) + obtain ⟨l', hlen, hg, hpre⟩ := ih (hsub.trans subset_union_left) + have hlin : IsLine A' := by + obtain ⟨g, -, -⟩ := hl + exact ⟨g⟩ + refine ⟨A' :: l', by simp [hlen], .free hlin ?_ (heq ▸ hg), ?_⟩ + · refine eq_empty_iff_forall_notMem.mpr fun z hz => ?_ + have : θ z ∈ A ∩ B := ⟨him ▸ mem_image_of_mem θ hz.1, hz.2⟩ + rw [hd] at this + exact this + · rw [listUnion_cons, listUnion_cons, ← union_assoc, hpre, heq, union_assoc] + | @attached B A l k p q hA hd _ ih => + obtain ⟨A', p', q', hl, hp, him, hinj, heq⟩ := key hsub hA (by rw [hd]) + obtain ⟨l', hlen, hg, hpre⟩ := ih (hsub.trans subset_union_left) + have hpB : p ∈ B := (show p ∈ A ∩ B by rw [hd]; rfl).2 + refine ⟨A' :: l', by simp [hlen], .attached hl ?_ (heq ▸ hg), ?_⟩ + · ext z + constructor + · rintro ⟨hz, hzB⟩ + have : θ z ∈ A ∩ B := ⟨him ▸ mem_image_of_mem θ hz, hzB⟩ + rw [hd] at this + exact hinj hz hl.left_mem (this.trans hp.symm) + · rintro rfl + exact ⟨hl.left_mem, show θ _ ∈ B by rw [hp]; exact hpB⟩ + · rw [listUnion_cons, listUnion_cons, ← union_assoc, hpre, heq, union_assoc] + +/-- **Cutting along a grown forest.** Only the lines that start a new tree away from `bd S` add a +cuff. -/ +theorem exists_cut_growth {a b : ℕ} (n : ℕ) : ∀ {S : Type u} [TopologicalSpace S] + (_ : IsSurface S) {c : ℕ} (_ : Nonempty (S ≃ₜ SurfaceModel a b c)) {l : List (Set S)} {k : ℕ}, + l.length = n → IsGrowth (bd S) l k → ∃ (Y : Type u) (_ : TopologicalSpace Y) (θ : Y + → S), IsCutAlongSet (listUnion l) θ ∧ Nonempty (Y ≃ₜ SurfaceModel a b (c + k)) := by + induction n with + | zero => + intro S _ hS c hm l k hl hg + obtain rfl : l = [] := List.length_eq_zero_iff.mp hl + have hk : k = 0 := by + cases hg + rfl + subst hk + exact ⟨S, inferInstance, id, by simpa using isCutAlongSet_id hS, hm⟩ + | succ n ih => + intro S _ hS c hm l k hl hg + have : T2Space S := hS.2.1 + have step : ∀ {A : Set S} {l' : List (Set S)} {k' c' : ℕ} {Y : Type u} [TopologicalSpace Y] {θ + : Y → S}, l'.length = n → IsGrowth (bd S ∪ A) l' k' → IsCutAlongSet A θ → Nonempty + (Y ≃ₜ SurfaceModel a b c') → IsClosed A → + ∃ (Y' : Type u) (_ : TopologicalSpace Y') (θ' : Y' → S), IsCutAlongSet + (A ∪ listUnion l') θ' ∧ Nonempty (Y' ≃ₜ SurfaceModel a b (c' + k')) := by + intro A l' k' c' Y _ θ hlen hg' hcut hmY hcl + have hY := hcut.isSurface + have : CompactSpace Y := hY.1 + have : T2Space Y := hY.2.1 + obtain ⟨l'', hlen', hg'', hpre⟩ := hg'.lift hcut.isCutMap ((isClosed_bd S).union hcl) + subset_rfl + rw [hcut.preimage_bd] at hg'' + obtain ⟨Y', tY', θ', hcut', hmY'⟩ := ih hY hmY (hlen'.trans hlen) hg'' + have hb : bd Y ∪ listUnion l'' = bd Y ∪ θ ⁻¹' listUnion l' := by + rw [← hcut.preimage_bd, ← hpre, preimage_union] + exact ⟨Y', tY', θ ∘ θ', hcut.comp (hcut'.congr hb), hmY'⟩ + cases hg with + | nil _ => simp at hl + | free hA hd h => + obtain ⟨f⟩ := hA + have hA' : IsLineWithEnds _ (f 0).1 (f 1).1 := ⟨f, rfl, rfl⟩ + obtain ⟨Y, tY, θ, hcut, -, hmY, -⟩ := exists_cut_free_line hS hm hA' hd + have := step (by simpa using hl) h hcut hmY hA'.isCompact.isClosed + rw [listUnion_cons, ← Nat.add_assoc, Nat.add_right_comm] + exact this + | attached hA hd h => + obtain ⟨Y, tY, θ, hcut, hmY⟩ := exists_cut_attached hS hm hA hd + have := step (by simpa using hl) h hcut hmY hA.isCompact.isClosed + rw [listUnion_cons] + exact this + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CutLines.lean b/LeanPool/GraphMinor/GM07/CutLines.lean new file mode 100644 index 0000000000..a1f335d7bf --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CutLines.lean @@ -0,0 +1,177 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CutStages +public import LeanPool.GraphMinor.GM07.DiscPlace + +/-! +# Lifting a line through a cut + +Let `θ` undo a cut, so that `θ` is one to one off a closed set `B`. An arc that meets `B` at most at +its first point lifts to an arc (`exists_lift_arc`). The lift off `B` is forced. The point to prove +is that the lift has one limit +at the first point, even though the fiber over it can have several points: the fiber is finite, and +the preimage of a small piece of the arc is connected, so it stays near one point of the fiber. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM19 + +universe u + +local notation "𝕀" => unitInterval + +variable {Y S : Type u} [TopologicalSpace Y] [TopologicalSpace S] + +theorem exists_Iio_subset {N : Set 𝕀} (hN : IsOpen N) (h0 : (0 : 𝕀) ∈ N) : ∃ e : 𝕀, 0 < e + ∧ Iio e ⊆ N := by + have h := (nhds_bot_basis (α := 𝕀)).mem_iff.mp (hN.mem_nhds h0) + exact h + +/-- Over the first point of the arc, the closure of the lift off `B` has at most one point. -/ +theorem eq_of_mem_closure_lift [CompactSpace Y] [T2Space Y] [T2Space S] {B : Set S} {θ : Y → S} + (hθ : IsCutMap θ B) (hB : IsClosed B) {a : 𝕀 → S} (ha : IsArcMap a) (hoff : ∀ t, t ≠ 0 → a t ∉ B) + {x y : Y} (hx : x ∈ closure (θ ⁻¹' (a '' {t | t ≠ 0}))) (hy : y ∈ closure (θ ⁻¹' + (a '' {t | t ≠ 0}))) (hx0 : θ x = a 0) (hy0 : θ y = a 0) : x = y := by + classical + by_contra hne + have hfin : (θ ⁻¹' {a 0} \ {x}).Finite := (hθ.2.2.2.1 (a 0)).subset sdiff_subset + obtain ⟨U, V, hU, hV, hxU, hsV, hUV⟩ := SeparatedNhds.of_finite (finite_singleton x) hfin + (by simp) + have hxU' : x ∈ U := hxU rfl + have hyV : y ∈ V := hsV ⟨hy0, fun h => hne (Eq.symm h)⟩ + have hK : IsClosed (θ '' (U ∪ V)ᶜ) := hθ.1.isClosedMap _ (hU.union hV).isClosed_compl + have h0 : (0 : 𝕀) ∈ a ⁻¹' (θ '' (U ∪ V)ᶜ)ᶜ := by + rintro ⟨z, hz, he⟩ + by_cases hzx : z = x + · exact hz (.inl (hzx ▸ hxU')) + · exact hz (.inr (hsV ⟨he, hzx⟩)) + obtain ⟨e, he, hsub⟩ := exists_Iio_subset (hK.isOpen_compl.preimage ha.1) h0 + let W : Set Y := θ ⁻¹' (a '' Ioo 0 e) + have hWsub : W ⊆ U ∪ V := fun z ⟨t, ht, hz⟩ => by + by_contra hn + exact hsub ht.2 ⟨z, hn, hz.symm⟩ + have hWp : IsPreconnected W := isPreconnected_preimage_of_isCutMap hθ hB (by + rintro _ ⟨t, ht, rfl⟩ + exact hoff t ht.1.ne') (isPreconnected_Ioo.image a ha.1.continuousOn) + have hclosed : IsClosed (θ ⁻¹' (a '' Ici e)) := ((isClosed_Ici.isCompact.image + ha.1).isClosed).preimage hθ.1 + have hcov : θ ⁻¹' (a '' {t | t ≠ 0}) ⊆ W ∪ θ ⁻¹' (a '' Ici e) := fun z ⟨t, ht, hz⟩ => by + by_cases hte : t < e + · exact .inl ⟨t, ⟨unitInterval.pos_iff_ne_zero.mpr ht, hte⟩, hz⟩ + · exact .inr ⟨t, not_lt.mp hte, hz⟩ + have hin : ∀ {z : Y}, z ∈ closure (θ ⁻¹' (a '' {t | t ≠ 0})) → θ z = a 0 → z ∈ closure W + := fun hz h0z => by + have h1 := closure_mono hcov hz + rw [closure_union, hclosed.closure_eq] at h1 + rcases h1 with h1 | ⟨t, ht, h2⟩ + · exact h1 + · have : t = 0 := ha.2 (h2.trans h0z) + exact absurd (mem_Ici.mp ht) (by rw [this]; exact not_le.mpr he) + rcases IsPreconnected.subset_or_subset hU hV hUV hWsub hWp with h | h + · obtain ⟨z, hzV, hzW⟩ := mem_closure_iff.mp (hin hy hy0) V hV hyV + exact disjoint_left.mp hUV (h hzW) hzV + · obtain ⟨z, hzU, hzW⟩ := mem_closure_iff.mp (hin hx hx0) U hU hxU' + exact disjoint_left.mp hUV hzU (h hzW) + +/-- **An arc lifts through a cut.** An arc that meets `B` at most at its first point lifts to an +arc. -/ +theorem exists_lift_arc [CompactSpace Y] [T2Space Y] [T2Space S] {B : Set S} {θ : Y → S} + (hθ : IsCutMap θ B) (hB : IsClosed B) {a : 𝕀 → S} (ha : IsArcMap a) (hoff : ∀ t, t ≠ 0 + → a t ∉ B) : + ∃ b : 𝕀 → Y, IsArcMap b ∧ ∀ t, θ (b t) = a t := by + classical + let W : Set Y := θ ⁻¹' (a '' {t | t ≠ 0}) + have hTc : IsCompact (closure W) := isClosed_closure.isCompact + have hsub : ∀ z ∈ closure W, ∃ t, θ z = a t := fun z hz => by + have hc : IsClosed (θ ⁻¹' range a) := (isCompact_range ha.1).isClosed.preimage hθ.1 + have h1 : closure W ⊆ θ ⁻¹' range a := closure_minimal (fun w ⟨t, _, hw⟩ => ⟨t, hw⟩) hc + obtain ⟨t, ht⟩ := h1 hz + exact ⟨t, ht.symm⟩ + have hon : ∀ t, ∃ z ∈ closure W, θ z = a t := fun t => by + by_cases ht : t = 0 + · subst ht + by_contra hn + have hcl : IsClosed (θ '' closure W) := hθ.1.isClosedMap _ isClosed_closure + have h0 : (0 : 𝕀) ∈ a ⁻¹' (θ '' closure W)ᶜ := fun ⟨z, hz, he⟩ => hn ⟨z, hz, he⟩ + obtain ⟨e, he, hs⟩ := exists_Iio_subset (hcl.isOpen_compl.preimage ha.1) h0 + obtain ⟨m, hm0, hme⟩ := exists_between he + obtain ⟨z, hz⟩ := hθ.2.1 (a m) + exact hs hme ⟨z, subset_closure ⟨m, hm0.ne', hz.symm⟩, hz⟩ + · obtain ⟨z, hz⟩ := hθ.2.1 (a t) + exact ⟨z, subset_closure ⟨t, ht, hz.symm⟩, hz⟩ + have hinj : InjOn θ (closure W) := fun x hx y hy he => by + obtain ⟨t, ht⟩ := hsub x hx + by_cases h0 : t = 0 + · subst h0 + exact eq_of_mem_closure_lift hθ hB ha hoff hx hy ht (he ▸ ht) + · have h1 : θ x ∈ Bᶜ := ht ▸ hoff t h0 + exact hθ.2.2.1 h1 (show θ y ∈ Bᶜ from he ▸ h1) he + have : CompactSpace (closure W) := isCompact_iff_compactSpace.mp hTc + let j : closure W → S := fun z => θ z.1 + have hj : Continuous j := hθ.1.comp continuous_subtype_val + have hji : Function.Injective j := fun x y he => Subtype.ext (hinj x.2 y.2 he) + have hemb := hj.isClosedEmbedding hji + choose z hzT hz using hon + let b' : 𝕀 → closure W := fun t => ⟨z t, hzT t⟩ + have hb' : Continuous b' := by + rw [hemb.isInducing.continuous_iff] + have : j ∘ b' = a := funext hz + rw [this] + exact ha.1 + refine ⟨fun t => z t, ⟨continuous_subtype_val.comp hb', fun s t he => ha.2 ?_⟩, hz⟩ + have he' : z s = z t := he + rw [← hz s, ← hz t, he'] + +/-- **A line lifts through a cut.** -/ +theorem exists_lift_line [CompactSpace Y] [T2Space Y] [T2Space S] {B : Set S} {θ : Y → S} + (hθ : IsCutMap θ B) (hB : IsClosed B) {A : Set S} {p q : S} (hA : IsLineWithEnds A p q) + (hAB : A ∩ B ⊆ {p}) : + ∃ (A' : Set Y) (p' q' : Y), IsLineWithEnds A' p' q' ∧ θ p' = p ∧ θ q' = q ∧ θ '' A' = A + ∧ InjOn θ A' ∧ θ ⁻¹' (A ∪ B) = A' ∪ θ ⁻¹' B := by + obtain ⟨a, ha, hr, ha0, ha1⟩ := hA.exists_arc + have hoff : ∀ t, t ≠ 0 → a t ∉ B := fun t ht hb => by + have h1 : a t = p := hAB ⟨hr ▸ mem_range_self t, hb⟩ + exact ht (ha.2 (h1.trans ha0.symm)) + obtain ⟨b, hb, hba⟩ := exists_lift_arc hθ hB ha hoff + have hrθ : θ '' range b = A := by + rw [← hr, ← range_comp] + congr 1 + exact funext hba + refine ⟨range b, b 0, b 1, ?_, by rw [hba, ha0], by rw [hba, ha1], hrθ, ?_, ?_⟩ + · exact isLineWithEnds_range_of_arc hb + · rintro _ ⟨s, rfl⟩ _ ⟨t, rfl⟩ he + rw [ha.2 (by rw [← hba, ← hba, he] : a s = a t)] + · ext z + constructor + · rintro (hz | hz) + · rw [← hr] at hz + obtain ⟨t, ht⟩ := hz + by_cases h0 : t = 0 + · subst h0 + by_cases hpB : p ∈ B + · exact .inr (show θ z ∈ B by rw [← ht, ha0]; exact hpB) + · have h1 : θ z ∈ Bᶜ := by rw [← ht, ha0]; exact hpB + have h2 : θ (b 0) ∈ Bᶜ := by rw [hba, ha0]; exact hpB + exact .inl ⟨0, hθ.2.2.1 h2 h1 (by rw [hba, ht])⟩ + · have h1 : θ z ∈ Bᶜ := by rw [← ht]; exact hoff t h0 + have h2 : θ (b t) ∈ Bᶜ := by rw [hba]; exact hoff t h0 + exact .inl ⟨t, hθ.2.2.1 h2 h1 (by rw [hba, ht])⟩ + · exact .inr hz + · rintro (⟨t, rfl⟩ | hz) + · refine .inl ?_ + rw [hba, ← hr] + exact mem_range_self t + · exact .inr hz + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CutStages.lean b/LeanPool/GraphMinor/GM07/CutStages.lean new file mode 100644 index 0000000000..13e8a1d75f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CutStages.lean @@ -0,0 +1,99 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Open +public import LeanPool.GraphMinor.Surface.CutParallel +public import LeanPool.GraphMinor.GM19.CutMap + +/-! +# Cutting in stages + +The surface `Σ'` in the proof of Graph Minors VII, (4.6) (page 225) is got by cutting along a +forest. We do this one edge at a time. `IsCutAlongSet F θ` lists what a cut along `F` must satisfy, +and +`IsCutAlongSet.comp` says that two cuts in a row make a cut along the union. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +universe u + +variable {S S₁ S₂ : Type u} [TopologicalSpace S] [TopologicalSpace S₁] [TopologicalSpace S₂] + +/-- `θ` cuts `S` along `F`, as in `IsCutAlongGraph` but for a set: `θ` is a quotient map with finite +fibers, the boundary of the cut surface lies over `bd S ∪ F`, and `θ` is injective off that +boundary. -/ +structure IsCutAlongSet (F : Set S) (θ : S₁ → S) : Prop where + isSurface : IsSurface S₁ + quotientMap : Topology.IsQuotientMap θ + preimage_bd : θ ⁻¹' (bd S ∪ F) = bd S₁ + interior_inj : ∀ x ∈ (bd S₁)ᶜ, ∀ y : S₁, θ x = θ y → x = y + finite_fiber : ∀ x, (θ ⁻¹' {x}).Finite + +/-- A cut along `F₁`, followed by a cut along the preimage of `F₂`, is a cut along `F₁ ∪ F₂`. -/ +theorem IsCutAlongSet.comp {F₁ F₂ : Set S} {θ₁ : S₁ → S} {θ₂ : S₂ → S₁} (h₁ : IsCutAlongSet F₁ θ₁) + (h₂ : IsCutAlongSet (θ₁ ⁻¹' F₂) θ₂) : + IsCutAlongSet (F₁ ∪ F₂) (θ₁ ∘ θ₂) := by + have hbd : (θ₁ ∘ θ₂) ⁻¹' (bd S ∪ (F₁ ∪ F₂)) = bd S₂ := by + rw [← h₂.preimage_bd, ← h₁.preimage_bd, ← preimage_union, preimage_comp, union_assoc] + refine ⟨h₂.isSurface, h₁.quotientMap.comp h₂.quotientMap, hbd, fun x hx y hxy => ?_, fun x => ?_⟩ + · have hx₁ : θ₂ x ∉ bd S₁ := fun h => hx (by + rw [← h₂.preimage_bd] + exact Or.inl h) + exact h₂.interior_inj x hx y (h₁.interior_inj _ hx₁ _ hxy) + · have : (θ₁ ∘ θ₂) ⁻¹' {x} = ⋃ y ∈ θ₁ ⁻¹' {x}, θ₂ ⁻¹' {y} := by + ext z + simp + rw [this] + exact (h₁.finite_fiber x).biUnion fun y _ => h₂.finite_fiber y + +/-- A cut along a set is a cut along a graph with that set as its points, when the graph is proper +and has no isolated vertices. -/ +theorem IsCutAlongSet.isCutAlongGraph {J : Drawing S} {θ : S₁ → S} (h : IsCutAlongSet J.U θ) + (hp : J.IsProper) (hn : HasNoIsolatedVertices J) : + IsCutAlongGraph J S₁ θ := + ⟨hp, hn, h.isSurface, h.quotientMap, h.preimage_bd, h.interior_inj, h.finite_fiber⟩ + +/-- The cut along an edge built by `exists_cut` is a cut along the closure of the edge. -/ +theorem IsCutAlongSet.of_cutAlongEdge {G : Drawing S} {e : Set S} {a b c : ℕ} {θ : S₁ + → S} {G' : Drawing S₁} (hc : IsCutAlongEdge G e a b c S₁ θ G') : IsCutAlongSet (closure e) θ := by + refine ⟨hc.isSurface, hc.quotientMap, hc.bd_eq.symm, fun x hx y hxy => ?_, hc.finite_fiber⟩ + refine (hc.inj x y hxy).resolve_right fun h => hx ?_ + rw [hc.bd_eq] + exact Or.inr (subset_closure h) + +/-- A cutting map of a compact surface along a closed set, such as the one given by `cutIArc`, is a +cut along that set. -/ +theorem IsCutAlongSet.of_isCutting (hS₁ : IsSurface S₁) (hS : IsSurface S) {F : Set S} + (hF : IsClosed F) {θ : S₁ → S} (hc : IsCutting θ F) : IsCutAlongSet F θ := by + have : CompactSpace S₁ := hS₁.1 + have : T2Space S₁ := hS₁.2.1 + have : T2Space S := hS.2.1 + refine ⟨hS₁, hc.1.isClosedMap.isQuotientMap hc.1 hc.2.1, ?_, fun x hx y hxy => ?_, + (GM19.IsCutting.isCutMap hc).2.2.2.1⟩ + · ext y + constructor + · rintro (h | h) + · by_cases hyF : θ y ∈ F + · exact hc.2.2.2.2 hyF + · exact bd_lift hc hF h hyF + · exact hc.2.2.2.2 h + · intro hy + by_cases hyF : θ y ∈ F + · exact Or.inr hyF + · exact Or.inl (bd_of_bd hc hF hy hyF) + · have hxF : θ x ∉ F := fun h => hx (hc.2.2.2.2 h) + exact hc.2.2.1 hxF (show θ y ∈ Fᶜ from hxy ▸ hxF) hxy + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CylinderCap.lean b/LeanPool/GraphMinor/GM07/CylinderCap.lean new file mode 100644 index 0000000000..6aed3047fe --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CylinderCap.lean @@ -0,0 +1,540 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CylinderGrid +public import LeanPool.GraphMinor.GM07.Matched +public import LeanPool.GraphMinor.GM14.RigidMap +public import LeanPool.GraphMinor.GM11.DrawingOps +public import LeanPool.GraphMinor.GM12.Section3ModelComplexity + +/-! +# From the capped cylinder back to the cylinder + +Capping the two cuffs of a cylinder gives a sphere. `exists_image_matched` puts a drawing in the +sphere, and `exists_pull` and `pull_path` bring subdrawings and paths back. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Graph GraphMinor.Surface GraphMinor.GM11 + +universe u + +section Pull + +variable {S : Type u} [TopologicalSpace S] [CompactSpace S] [T2Space S] {T : Type*} + [TopologicalSpace T] [T2Space T] {G : Drawing S} {Γ : Drawing T} {j : S → T} + +omit [CompactSpace S] [T2Space S] [T2Space T] in +/-- The homeomorphism from the preimage of a subset of the range of an embedding. -/ +theorem exists_pull_homeo (hj : IsEmbedding j) {L : Set T} (hL : L ⊆ range j) : ∃ e : j ⁻¹' L ≃ₜ L, + ∀ x, (e x).1 = j x.1 := by + have heq : j '' (j ⁻¹' L) = L := image_preimage_eq_of_subset hL + exact ⟨(hj.homeomorphImage (j ⁻¹' L)).trans (Homeomorph.setCongr heq), fun x => rfl⟩ + +omit [CompactSpace S] [T2Space S] [T2Space T] in +theorem pull_line (hj : IsEmbedding j) {L : Set T} {u v : S} (hl : IsLineWithEnds L (j u) (j v)) + (hL : L ⊆ range j) : IsLineWithEnds (j ⁻¹' L) u v := by + obtain ⟨e, he⟩ := exists_pull_homeo hj hL + obtain ⟨f, h0, h1⟩ := hl + refine ⟨f.trans e.symm, hj.injective ?_, hj.injective ?_⟩ + · rw [← he] + simpa using h0 + · rw [← he] + simpa using h1 + +omit [CompactSpace S] [T2Space S] [T2Space T] in +theorem pull_oArc (hj : IsEmbedding j) {L : Set T} (hl : IsOArc L) (hL : L ⊆ range j) : IsOArc + (j ⁻¹' L) := by + obtain ⟨e, -⟩ := exists_pull_homeo hj hL + obtain ⟨f⟩ := hl + exact ⟨f.trans e.symm⟩ + +omit [CompactSpace S] in +omit [T2Space S] [T2Space T] in +theorem image_line (hj : IsEmbedding j) {L : Set S} {u v : S} (hl : IsLineWithEnds L u v) : + IsLineWithEnds (j '' L) (j u) (j v) := by + obtain ⟨f, h0, h1⟩ := hl + refine ⟨f.trans (hj.homeomorphImage L), ?_, ?_⟩ + · change j (f 0).1 = j u + rw [h0] + · change j (f 1).1 = j v + rw [h1] + +omit [CompactSpace S] in +omit [T2Space S] [T2Space T] in +/-- The image of a drawing under a closed embedding. -/ +theorem exists_image_matched [Nonempty S] (hj : IsClosedEmbedding j) (G : Drawing S) : ∃ Γ : + Drawing T, IsMatched G Γ j ∅ := by + classical + have hset : j '' G.U \ j '' G.V = j '' (G.U \ G.V) := (image_sdiff hj.injective _ _).symm + have harc : ∀ {F : Set S}, arcComponentsIn (j '' F) = image j '' arcComponentsIn F := fun {F} + => by + refine arcComponentsIn_image (g := invFun j) hj.continuous.continuousOn ?_ fun x _ + => leftInverse_invFun hj.injective x + rw [hj.isInducing.continuousOn_iff] + refine continuousOn_id.congr ?_ + rintro _ ⟨x, -, rfl⟩ + simp [leftInverse_invFun hj.injective x] + have hcl : ∀ e : Set S, closure (j '' e) = j '' closure e := fun e => + (image_closure_subset_closure_image hj.continuous).antisymm' (closure_minimal + (image_mono subset_closure) (hj.isClosedMap _ isClosed_closure)) + have hcap : ∀ e : Set S, closure (j '' e) ∩ j '' G.V = j '' (closure e ∩ G.V) := fun e => by + rw [hcl, image_inter hj.injective] + let Γ : Drawing T := + { U := j '' G.U + V := j '' G.V + V_subset_U := image_mono G.V_subset_U + isClosed_U := hj.isClosedMap _ G.isClosed_U + finite_V := G.finite_V.image _ + finite_edges := by + rw [hset, harc] + exact G.finite_edges.image _ + edge_cond := by + rw [hset, harc] + rintro _ ⟨e, he, rfl⟩ + rcases G.edge_cond e he with ⟨u, v, h1, h2, h3⟩ | ⟨u, h2, h3⟩ + · refine .inl ⟨j u, j v, hj.injective.ne h1, by rw [hcap, h2, image_pair], ?_⟩ + rw [hcl] + exact image_line hj.isEmbedding h3 + · refine .inr ⟨j u, by rw [hcap, h2, image_singleton], ?_⟩ + rw [hcl] + exact h3.elim fun φ => ⟨φ.trans (hj.isEmbedding.homeomorphImage _)⟩ } + have hE : Γ.E = image j '' G.E := by + change arcComponentsIn (j '' G.U \ j '' G.V) = _ + rw [hset, harc] + rfl + exact ⟨Γ, ⟨hj.continuous, hj.injective.injOn, empty_subset _, fun _ _ => disjoint_empty _, + by simp [Γ], by simp [Γ], hE⟩⟩ + +/-- A subdrawing of the image comes from a subdrawing. -/ +theorem exists_pull (h : IsMatched G Γ j ∅) {D' : Drawing T} (hD : D'.IsSubdrawing Γ) : ∃ D : + Drawing S, D.IsSubdrawing G ∧ j '' D.U = D'.U ∧ j '' D.V = D'.V ∧ image j '' D.E = D'.E := by + classical + have hVΓ : Γ.V = j '' G.V := by simpa using h.image_V.symm + let D := G.span (j ⁻¹' D'.V) {e | j '' e ∈ D'.E} + have hDE : D.E = {e ∈ G.E | j '' e ∈ D'.E} := by + rw [G.span_E] + exact inter_comm _ _ + have hDV : D.V = j ⁻¹' D'.V ∩ G.V := by + refine subset_antisymm ?_ (fun x hx => .inl hx) + rintro x (hx | hx) + · exact hx + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + have h3 : j x ∈ closure (j '' e) ∩ Γ.V := + ⟨by rw [h.closure_image]; exact ⟨x, hxe.1, rfl⟩, by rw [hVΓ]; exact ⟨x, hxe.2, rfl⟩⟩ + rw [← hD.closure_inter_V he.1] at h3 + exact ⟨h3.2, hxe.2⟩ + have hIV : j '' D.V = D'.V := by + rw [hDV] + refine subset_antisymm ?_ fun y hy => ?_ + · rintro _ ⟨x, hx, rfl⟩ + exact hx.1 + · have h3 := hD.1 hy + rw [hVΓ] at h3 + obtain ⟨x, hx, rfl⟩ := h3 + exact ⟨x, ⟨hy, hx⟩, rfl⟩ + have hIE : image j '' D.E = D'.E := by + rw [hDE] + refine subset_antisymm ?_ fun f hf => ?_ + · rintro _ ⟨e, he, rfl⟩ + exact he.2 + · have h3 := hD.2 hf + rw [h.image_E] at h3 + obtain ⟨e, he, rfl⟩ := h3 + exact ⟨e, ⟨he, hf⟩, rfl⟩ + refine ⟨D, Drawing.span_isSubdrawing G _ _, ?_, hIV, hIE⟩ + rw [D.U_eq, D'.U_eq, image_union, hIV, ← hIE] + congr 1 + ext y + simp only [mem_image, mem_iUnion, exists_prop] + constructor + · rintro ⟨x, ⟨e, he, hx⟩, rfl⟩ + exact ⟨_, ⟨e, he, rfl⟩, by rw [h.closure_image]; exact ⟨x, hx, rfl⟩⟩ + · rintro ⟨_, ⟨e, he, rfl⟩, hy⟩ + rw [h.closure_image] at hy + obtain ⟨x, hx, rfl⟩ := hy + exact ⟨x, ⟨e, he, hx⟩, rfl⟩ + +omit [T2Space S] in +/-- A path of the image comes from a path. -/ +theorem pull_path (h : IsMatched G Γ j ∅) (hj : Injective j) {D : Drawing S} {D' : Drawing T} + (hU : j '' D.V = D'.V) (hE : image j '' D.E = D'.E) {a b : S} (hp : D'.IsPathBetween (j a) + (j b)) : + D.IsPathBetween a b := by + have : Nonempty S := ⟨a⟩ + have hg : ∀ x, invFun j (j x) = x := leftInverse_invFun hj + have hmap := GM14.Whitney.isPathBetween_map (P := D') (Q := D) (invFun j) + (preimage j) ?_ ?_ ?_ ?_ hp + · rwa [hg, hg] at hmap + · rintro f y z ⟨hf, hy, hz, hc⟩ + rw [← hE] at hf + rw [← hU] at hy hz + obtain ⟨e, he, rfl⟩ := hf + obtain ⟨y, hy, rfl⟩ := hy + obtain ⟨z, hz, rfl⟩ := hz + rw [preimage_image_eq _ hj, hg, hg] + refine ⟨he, hy, hz, ?_⟩ + apply image_injective.mpr hj + rw [image_inter hj, ← h.closure_image, hU, hc, image_pair] + · rw [← hU, image_image] + simp [hg] + · rw [← hE, image_image] + simp [preimage_image_eq _ hj] + · rw [← hU] + rintro _ ⟨x, -, rfl⟩ _ ⟨y, -, rfl⟩ he + rw [hg, hg] at he + rw [he] + +end Pull + +section Cap + +variable {S : Type u} [TopologicalSpace S] + +/-- Capping both cuffs of a cylinder gives a sphere. -/ +theorem exists_sphere_cap (hS : IsSurface S) (he : Nonempty (S ≃ₜ SurfaceModel 0 0 2)) {C₁ C₂ : Set + S} (hcuffs : cuffs S = {C₁, C₂}) (hne : C₁ ≠ C₂) : + ∃ (T : Type) (_ : TopologicalSpace T) (j : S → T) (D₁ D₂ : Set T), IsClosedSurface T + ∧ IsSphere T ∧ ConnectedSpace T ∧ IsClosedEmbedding j ∧ IsClosedDisc D₁ ∧ IsClosedDisc D₂ + ∧ Disjoint D₁ D₂ ∧ + discBd D₁ = j '' C₁ ∧ discBd D₂ = j '' C₂ ∧ range j ∪ D₁ ∪ D₂ = univ ∧ range j ∩ D₁ = j '' C₁ + ∧ range j ∩ D₂ = j '' C₂ := by + have hT2 : T2Space S := hS.2.1 + have hcompact : CompactSpace S := hS.1 + obtain ⟨e₀⟩ := id he + have : ConnectedSpace S := by + have := (isSurface_model 0 0 2).2 + exact e₀.symm.surjective.connectedSpace e₀.symm.continuous + have hC₁ : C₁ ∈ cuffs S := by rw [hcuffs]; simp + have hC₂ : C₂ ∈ cuffs S := by rw [hcuffs]; simp + have hdis : Disjoint C₁ C₂ := cuffs_disjoint hC₁ hC₂ hne + have hbdS : bd S = C₁ ∪ C₂ := by rw [← sUnion_cuffs, hcuffs, sUnion_pair] + obtain ⟨Y, tY, j₁, D₁', hcap₁, hbdY⟩ := exists_cappedCuff hS hC₁ + obtain ⟨-, ⟨e₁⟩⟩ := cappedCuff_homeo_model hS he hC₁ hcap₁ + have hY : IsSurface Y := hcap₁.isSurface + have : T2Space Y := hY.2.1 + have : ConnectedSpace Y := by + have := (isSurface_model 0 0 1).2 + exact e₁.symm.surjective.connectedSpace e₁.symm.continuous + have hbdY' : bd Y = j₁ '' C₂ := by + rw [hbdY, hbdS, union_sdiff_left, sdiff_eq_left.mpr hdis.symm] + have hC₂Y : j₁ '' C₂ ∈ cuffs Y := by + obtain ⟨x, hx, hxe⟩ := id hC₂ + have hp : IsPreconnected C₂ := hxe ▸ isPreconnected_connectedComponentIn + have hxC : x ∈ C₂ := by + rw [← hxe] + exact mem_connectedComponentIn hx + have hbp : IsPreconnected (bd Y) := hbdY' ▸ hp.image _ hcap₁.isEmbedding.continuous.continuousOn + have hy : j₁ x ∈ bd Y := hbdY' ▸ mem_image_of_mem _ hxC + refine ⟨j₁ x, hy, ?_⟩ + rw [hbp.connectedComponentIn hy, hbdY'] + obtain ⟨Z, tZ, j₂, D₂', hcap₂, hbdZ⟩ := exists_cappedCuff hY hC₂Y + obtain ⟨-, ⟨e₂⟩⟩ := cappedCuff_homeo_model hY ⟨e₁⟩ hC₂Y hcap₂ + have hZ : IsSurface Z := hcap₂.isSurface + have : T2Space Z := hZ.2.1 + have : CompactSpace Z := hZ.1 + obtain ⟨s₀⟩ := GM12.isSphere_model_zero + let s : Z ≃ₜ OnePoint EuclideanPlane := e₂.trans s₀ + have hbdZ' : bd Z = ∅ := by rw [hbdZ, hbdY', sdiff_self, image_empty] + have hTcs : CompactSpace (OnePoint EuclideanPlane) := s.compactSpace + have hTt2 : T2Space (OnePoint EuclideanPlane) := s.t2Space + have hTs : IsClosedSurface (OnePoint EuclideanPlane) := by + refine ⟨hTcs, hTt2, fun x => ?_⟩ + have h3 : IsInteriorPoint (s.symm x) := by + by_contra hn + have h4 : s.symm x ∈ bd Z := hn + rw [hbdZ'] at h4 + exact h4 + have := (isInteriorPoint_homeomorph_iff s (s.symm x)).mpr h3 + rwa [s.apply_symm_apply] at this + have hj₁ := hcap₁.isEmbedding + have hj₂ := hcap₂.isEmbedding + let f₂ : Y → OnePoint EuclideanPlane := s ∘ j₂ + have hf₂c : Continuous f₂ := s.continuous.comp hj₂.continuous + have hf₂i : Injective f₂ := s.injective.comp hj₂.injective + let j : S → OnePoint EuclideanPlane := f₂ ∘ j₁ + have hjc : Continuous j := hf₂c.comp hj₁.continuous + have hji : Injective j := hf₂i.comp hj₁.injective + obtain ⟨hd1, hb1⟩ := isClosedDisc_image hcap₁.isClosedDisc hf₂c.continuousOn hf₂i.injOn + obtain ⟨hd2, hb2⟩ := isClosedDisc_image hcap₂.isClosedDisc s.continuous.continuousOn + s.injective.injOn + have hm₁ : ∀ {y}, y ∈ D₁' → ∀ c, j₁ c = y → c ∈ C₁ := fun {y} hy c hc => by + have h3 : y ∈ range j₁ ∩ D₁' := ⟨⟨c, hc⟩, hy⟩ + rw [hcap₁.inter_eq] at h3 + obtain ⟨c', hc', he⟩ := h3 + exact hj₁.injective (he.trans hc.symm) ▸ hc' + have hm₂ : ∀ {y}, j₂ y ∈ D₂' → ∃ c ∈ C₂, j₁ c = y := fun {y} hy => by + have h3 : j₂ y ∈ range j₂ ∩ D₂' := ⟨⟨y, rfl⟩, hy⟩ + rw [hcap₂.inter_eq] at h3 + obtain ⟨y', ⟨c, hc, rfl⟩, he⟩ := h3 + exact ⟨c, hc, hj₂.injective he⟩ + refine ⟨OnePoint EuclideanPlane, inferInstance, j, f₂ '' D₁', s '' D₂', hTs, ⟨Homeomorph.refl _⟩, + (haveI := (isSurface_model 0 0 0).2; s₀.surjective.connectedSpace s₀.continuous), + hjc.isClosedEmbedding hji, hd1, hd2, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · refine disjoint_left.mpr ?_ + rintro _ ⟨y, hy, rfl⟩ ⟨z, hz, he⟩ + have hzy : z = j₂ y := s.injective he + subst hzy + obtain ⟨c, hc, rfl⟩ := hm₂ hz + exact disjoint_left.mp hdis (hm₁ hy c rfl) hc + · rw [hb1, hcap₁.discBd_eq, image_image] + rfl + · rw [hb2, hcap₂.discBd_eq, image_image, image_image] + rfl + · refine eq_univ_of_forall fun x => ?_ + have h3 : s.symm x ∈ range j₂ ∪ D₂' := hcap₂.union_eq ▸ mem_univ _ + rcases h3 with ⟨y, hy⟩ | h3 + · have h4 : y ∈ range j₁ ∪ D₁' := hcap₁.union_eq ▸ mem_univ _ + have hx : x = f₂ y := by + change x = s (j₂ y) + rw [hy, s.apply_symm_apply] + rcases h4 with ⟨c, rfl⟩ | h4 + · exact .inl (.inl ⟨c, hx.symm⟩) + · exact .inl (.inr ⟨y, h4, hx.symm⟩) + · exact .inr ⟨_, h3, s.apply_symm_apply x⟩ + · ext x + constructor + · rintro ⟨⟨c, rfl⟩, y, hy, he⟩ + have h3 : j₁ c = y := (hf₂i he).symm + exact ⟨c, hm₁ hy c h3, rfl⟩ + · rintro ⟨c, hc, rfl⟩ + refine ⟨mem_range_self c, j₁ c, ?_, rfl⟩ + have h3 : j₁ c ∈ range j₁ ∩ D₁' := by + rw [hcap₁.inter_eq] + exact ⟨c, hc, rfl⟩ + exact h3.2 + · ext x + constructor + · rintro ⟨⟨c, rfl⟩, z, hz, he⟩ + have hzy : z = j₂ (j₁ c) := s.injective he + subst hzy + obtain ⟨c', hc', he'⟩ := hm₂ hz + exact ⟨c, hj₁.injective he' ▸ hc', rfl⟩ + · rintro ⟨c, hc, rfl⟩ + refine ⟨mem_range_self c, j₂ (j₁ c), ?_, rfl⟩ + have h3 : j₂ (j₁ c) ∈ range j₂ ∩ D₂' := by + rw [hcap₂.inter_eq] + exact ⟨_, ⟨c, hc, rfl⟩, rfl⟩ + exact h3.2 + +/-- An `O`-arc of the cylinder that separates two points off the cylinder is not null-homotopic. -/ +theorem not_null_of_separating (hS : IsSurface S) {T : Type} [TopologicalSpace T] + [T2Space T] (hsph : IsSphere T) {j : S → T} (hj : IsClosedEmbedding j) {F : Set S} + (hF : IsOArc F) {B : Set T} + (hB : IsClosedDisc B) (hb : discBd B = j '' F) {p a : T} (hpB : p ∈ B) (haB : a ∉ B) + (hp : p ∉ range j) (ha : a ∉ range j) : ¬ IsNullHomotopicOArc F := by + intro hnull + obtain ⟨Δ, hΔ, hbΔ⟩ := nullHomotopicOArc_bounds_disc hS hF hnull + obtain ⟨hd, hbd⟩ := isClosedDisc_image hΔ hj.continuous.continuousOn hj.injective.injOn + have hO : IsOArc (j '' F) := hb ▸ hB.isOArc_discBd + obtain ⟨Δ₁, Δ₂, -, h1, h2, b1, b2, hcup, -, -, huniq⟩ := sphere_disc T hsph _ hO + have hset : discBd (j '' Δ) = j '' F := by rw [hbd, hbΔ] + have hBeq := huniq B hB hb + have hΔeq := huniq _ hd hset + have hra : ∀ {x}, x ∈ j '' Δ → x ∈ range j := fun {x} hx => image_subset_range _ _ hx + rcases hBeq with rfl | rfl <;> rcases hΔeq with h | h + · exact hp (hra (h ▸ hpB)) + · have : a ∈ B ∪ Δ₂ := hcup ▸ mem_univ a + exact ha (hra (h ▸ this.resolve_left haB)) + · have : a ∈ Δ₁ ∪ B := hcup ▸ mem_univ a + exact ha (hra (h ▸ this.resolve_right haB)) + · exact hp (hra (h ▸ hpB)) + +end Cap + +variable {S : Type u} [TopologicalSpace S] + +/-- Graph Minors VII, (5.8) (page 233; essentially Theorem (4.1) of Graph Minors III): +"(5.8) *Let $\Sigma$ be a cylinder and let $C_1, C_2$ be the two cuffs. Let $G$ be a proper graph in +$\Sigma$. Let $r, s \ge 0$ be integers. Suppose that* +*(i) every $G$-normal $O$-arc $F$ with $|F \cap V(G)| < r$ is null-homotopic, and* +*(ii) every $G$-normal $I$-arc $F$ with $|F \cap V(G)| < s$ has both its ends in the same cuff.* +*Then there are mutually vertex-disjoint paths $P_1, \dots, P_r$ of $G$, each between $C_1$ and +$C_2$, and mutually vertex-disjoint circuits $B_1, \dots, B_s$ of $G$, none null-homotopic, such +that for $1 \le i \le r$ and $1 \le j \le s$ the intersection of $P_i$ and $B_j$ is a path.*" -/ +theorem theorem_5_8_proof (hS : IsSurface S) (he : Nonempty + (S ≃ₜ SurfaceModel 0 0 2)) {C₁ C₂ : Set S} (hcuffs : cuffs S = {C₁, C₂}) (hne : C₁ ≠ C₂) + (G : Drawing S) (r s : ℕ) (hG : G.IsProper) + (hi : ∀ F : Set S, G.IsNormal F → IsOArc F → (F ∩ G.V).ncard < r → IsNullHomotopicOArc F) + (hii : ∀ F : Set S, G.IsNormal F → IsIArc F → (F ∩ G.V).ncard < s → lineEnds F ⊆ C₁ + ∨ lineEnds F ⊆ C₂) : + ∃ (P : Fin r → Drawing S) (u v : Fin r → S) (B : Fin s → Drawing S), + (∀ i : Fin r, (P i).IsSubdrawing G ∧ u i ∈ C₁ ∧ v i ∈ C₂ ∧ (P i).IsPathBetween (u i) (v i)) ∧ + (∀ i i' : Fin r, i ≠ i' → Disjoint (P i).V (P i').V) ∧ + (∀ j : Fin s, (B j).IsSubdrawing G ∧ IsOArc (B j).U ∧ ¬ IsNullHomotopicOArc (B j).U) ∧ + (∀ j j' : Fin s, j ≠ j' → Disjoint (B j).V (B j').V) ∧ + (∀ (i : Fin r) (j : Fin s), ∃ Q : Drawing S, ∃ x y : S, Q.U = (P i).U ∩ (B j).U ∧ Q.V = + (P i).V ∩ (B j).V ∧ Q.IsPathBetween x y) := by + classical + have hT2 : T2Space S := hS.2.1 + have hcp : CompactSpace S := hS.1 + obtain ⟨T, tT, j, D₁, D₂, hTs, hsph, hconn, hj, h₁, h₂, hd, hb₁, hb₂, hcov, hin₁, hin₂⟩ + := exists_sphere_cap hS he hcuffs hne + have hT2T : T2Space T := hTs.2.1 + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hTs.2.2 x).isManifoldPoint + have hC₁ : C₁ ∈ cuffs S := by rw [hcuffs]; simp + have hC₂ : C₂ ∈ cuffs S := by rw [hcuffs]; simp + have hdis : Disjoint C₁ C₂ := cuffs_disjoint hC₁ hC₂ hne + have hbdS : ∀ {x}, x ∈ C₁ ∪ C₂ → x ∈ bd S := fun {x} hx => by + rw [← sUnion_cuffs, hcuffs, sUnion_pair] + exact hx + have : Nonempty S := by + obtain ⟨x, hx⟩ := isOArc_nonempty (cuff_isOArc hS hC₁) + exact ⟨x⟩ + obtain ⟨Γ, hm⟩ := exists_image_matched hj G + have hΓU : Γ.U = j '' G.U := by simpa using hm.image_U.symm + have hΓV : Γ.V = j '' G.V := by simpa using hm.image_V.symm + have hs₁ : ∀ {x}, j x ∈ D₁ → x ∈ C₁ := fun {x} hx => by + have h3 : j x ∈ range j ∩ D₁ := ⟨⟨x, rfl⟩, hx⟩ + rw [hin₁] at h3 + obtain ⟨y, hy, he⟩ := h3 + exact hj.injective he ▸ hy + have hs₂ : ∀ {x}, j x ∈ D₂ → x ∈ C₂ := fun {x} hx => by + have h3 : j x ∈ range j ∩ D₂ := ⟨⟨x, rfl⟩, hx⟩ + rw [hin₂] at h3 + obtain ⟨y, hy, he⟩ := h3 + exact hj.injective he ▸ hy + have hnormal : ∀ {x}, x ∈ C₁ ∪ C₂ → x ∈ G.U → x ∈ G.V := fun {x} h3 h4 => hG ⟨hbdS h3, h4⟩ + have hU₁ : Γ.U ∩ D₁ ⊆ Γ.V := by + rw [hΓU, hΓV] + rintro _ ⟨⟨x, hx, rfl⟩, h3⟩ + exact ⟨x, hnormal (.inl (hs₁ h3)) hx, rfl⟩ + have hU₂ : Γ.U ∩ D₂ ⊆ Γ.V := by + rw [hΓU, hΓV] + rintro _ ⟨⟨x, hx, rfl⟩, h3⟩ + exact ⟨x, hnormal (.inr (hs₂ h3)) hx, rfl⟩ + have hoffI₁ : ∀ x, j x ∉ discInt D₁ := fun x h => h.2 (hb₁ ▸ mem_image_of_mem j (hs₁ h.1)) + have hoffI₂ : ∀ x, j x ∉ discInt D₂ := fun x h => h.2 (hb₂ ▸ mem_image_of_mem j (hs₂ h.1)) + have hi₁ : Disjoint Γ.U (discInt D₁) := by + rw [hΓU] + refine disjoint_left.mpr ?_ + rintro _ ⟨x, -, rfl⟩ + exact hoffI₁ x + have hi₂ : Disjoint Γ.U (discInt D₂) := by + rw [hΓU] + refine disjoint_left.mpr ?_ + rintro _ ⟨x, -, rfl⟩ + exact hoffI₂ x + obtain ⟨p, hp⟩ := h₁.nonempty_discInt + obtain ⟨a, ha⟩ := h₂.nonempty_discInt + have hpr : p ∉ range j := by + rintro ⟨x, rfl⟩ + exact hoffI₁ x hp + have har : a ∉ range j := by + rintro ⟨x, rfl⟩ + exact hoffI₂ x ha + have hrng : ∀ {X : Set T}, Disjoint X (discInt D₁) → Disjoint X (discInt D₂) → X ⊆ range j + := fun {X} h3 h4 z hz => by + have hc : z ∈ range j ∪ D₁ ∪ D₂ := hcov ▸ mem_univ z + rcases hc with (h | h) | h + · exact h + · have hb : z ∈ discBd D₁ := by + by_contra hn + exact disjoint_left.mp h3 hz ⟨h, hn⟩ + rw [hb₁] at hb + exact image_subset_range _ _ hb + · have hb : z ∈ discBd D₂ := by + by_contra hn + exact disjoint_left.mp h4 hz ⟨h, hn⟩ + rw [hb₂] at hb + exact image_subset_range _ _ hb + have hpull : ∀ {X : Set T}, X ⊆ range j → X ∩ Γ.U ⊆ Γ.V → G.IsNormal (j ⁻¹' X) ∧ + (j ⁻¹' X ∩ G.V).ncard = (X ∩ Γ.U).ncard := fun {X} h3 h4 => by + have hnor : G.IsNormal (j ⁻¹' X) := fun x hx => by + have h5 := h4 ⟨hx.1, hΓU ▸ mem_image_of_mem j hx.2⟩ + rw [hΓV] at h5 + obtain ⟨y, hy, he⟩ := h5 + exact hj.injective he ▸ hy + refine ⟨hnor, ?_⟩ + have h6 : j '' (j ⁻¹' X ∩ G.V) = X ∩ Γ.U := by + refine subset_antisymm ?_ fun z hz => ?_ + · rintro _ ⟨x, hx, rfl⟩ + exact ⟨hx.1, hΓU ▸ mem_image_of_mem j (G.V_subset_U hx.2)⟩ + · have h7 := h4 hz + rw [hΓV] at h7 + obtain ⟨x, hx, rfl⟩ := h7 + exact ⟨x, ⟨hz.1, hx⟩, rfl⟩ + rw [← h6, ncard_image_of_injective _ hj.injective] + have hi' : ∀ B, IsClosedDisc B → D₁ ⊆ B → Disjoint (discInt D₂) B → discBd B ∩ Γ.U ⊆ Γ.V → r ≤ + (discBd B ∩ Γ.U).ncard := fun B hB hsub hdisB hbn => by + by_contra hlt + have hX1 : Disjoint (discBd B) (discInt D₁) := disjoint_left.mpr fun z h3 h4 => + (discInt_mono hman h₁ hsub h4).2 h3 + have hX2 : Disjoint (discBd B) (discInt D₂) := disjoint_left.mpr fun z h3 h4 + => disjoint_left.mp hdisB h4 (Surface.discBd_subset _ h3) + have hXr := hrng hX1 hX2 + obtain ⟨hnor, hcard⟩ := hpull hXr hbn + have hFO := pull_oArc hj.isEmbedding hB.isOArc_discBd hXr + have hnull := hi _ hnor hFO (by omega) + exact not_null_of_separating hS hsph hj hFO hB (image_preimage_eq_of_subset hXr).symm + (hsub hp.1) (fun h => disjoint_left.mp hdisB ha h) hpr har hnull + have hii' : ∀ (L : Set T) (u v : T), IsLineWithEnds L u v → u ∈ discBd D₁ → v ∈ discBd D₂ + → L ∩ Γ.U ⊆ Γ.V → Disjoint L (discInt D₁) → Disjoint L (discInt D₂) → s ≤ (L ∩ Γ.V).ncard + := fun L u v hl hu hv hLU h3 h4 => by + by_contra hlt + have hXr := hrng h3 h4 + obtain ⟨hnor, hcard⟩ := hpull hXr hLU + have hset : L ∩ Γ.V = L ∩ Γ.U := subset_antisymm (fun z hz => ⟨hz.1, Γ.V_subset_U hz.2⟩) fun z + hz => ⟨hz.1, hLU hz⟩ + rw [hb₁] at hu + rw [hb₂] at hv + obtain ⟨u₀, hu₀, rfl⟩ := hu + obtain ⟨v₀, hv₀, rfl⟩ := hv + have hFl := pull_line hj.isEmbedding hl hXr + have hI : IsIArc (j ⁻¹' L) := ⟨u₀, v₀, hbdS (.inl hu₀), hbdS (.inr hv₀), hFl⟩ + rcases hii _ hnor hI (by rw [hcard, ← hset]; omega) with h | h + · exact disjoint_left.mp hdis (h (show v₀ ∈ lineEnds _ from ⟨u₀, hFl.symm⟩)) hv₀ + · exact disjoint_left.mp hdis hu₀ (h (show u₀ ∈ lineEnds _ from ⟨v₀, hFl⟩)) + obtain ⟨P', u', v', B', E', hP, hPd, hB, -, hBd, hQ⟩ := exists_cylinder_grid hTs hsph Γ h₁ h₂ hd + hU₁ hi₁ hU₂ hi₂ hp ha hi' hii' + have hends : ∀ i, ∃ x y, x ∈ C₁ ∧ y ∈ C₂ ∧ j x = u' i ∧ j y = v' i := fun i => by + obtain ⟨c1, c2, c3, W, -, hV, -⟩ := hP i + have h3 : u' i ∈ Γ.V := c1.1 (by rw [hV]; exact W.start_mem_support) + have h4 : v' i ∈ Γ.V := c1.1 (by rw [hV]; exact W.end_mem_support) + rw [hΓV] at h3 h4 + obtain ⟨x, -, hx⟩ := h3 + obtain ⟨y, -, hy⟩ := h4 + exact ⟨x, y, hs₁ (hx ▸ c2), hs₂ (hy ▸ c3), hx, hy⟩ + choose u v hu hv hju hjv using hends + choose P hPs hPU hPV hPE using fun i => exists_pull hm (hP i).1 + choose B hBs hBU hBV hBE using fun i => exists_pull hm (hB i).1 + have hdV : ∀ {X Y : Drawing S} {X' Y' : Drawing T}, j '' X.V = X'.V → j '' Y.V = Y'.V + → Disjoint X'.V Y'.V → Disjoint X.V Y.V := fun {X Y X' Y'} h3 h4 h5 => by + rw [← h3, ← h4] at h5 + exact (disjoint_image_iff hj.injective).mp h5 + refine ⟨P, u, v, B, fun i => ⟨hPs i, hu i, hv i, ?_⟩, fun i i' hne' => hdV (hPV i) (hPV i') + (hPd i i' hne'), fun l => ⟨hBs l, ?_⟩, fun l l' hne' => hdV (hBV l) (hBV l') + (hBd l l' hne'), fun i l => ?_⟩ + · refine pull_path hm hj.injective (hPV i) (hPE i) ?_ + rw [hju, hjv] + exact (hP i).2.2.2 + · obtain ⟨-, c2, hΔ, hbΔ, hpΔ, haΔ⟩ := hB l + have hO' := GM14.isOArc_of_isCircuit c2 + have hsub : (B' l).U ⊆ range j := hBU l ▸ image_subset_range _ _ + have hO : IsOArc (B l).U := by + have := pull_oArc hj.isEmbedding hO' hsub + rwa [← hBU, preimage_image_eq _ hj.injective] at this + exact ⟨hO, not_null_of_separating hS hsph hj hO hΔ (hbΔ.trans (hBU l).symm) hpΔ haΔ hpr har⟩ + · obtain ⟨Q', x', y', hQs, hQU, hQV, hQp⟩ := hQ i l + obtain ⟨Q, -, h3, h4, h5⟩ := exists_pull hm hQs + obtain ⟨W, -, hV, -⟩ := id hQp + have hx : x' ∈ j '' Q.V := by rw [h4, hV]; exact W.start_mem_support + have hy : y' ∈ j '' Q.V := by rw [h4, hV]; exact W.end_mem_support + obtain ⟨x, -, rfl⟩ := hx + obtain ⟨y, -, rfl⟩ := hy + refine ⟨Q, x, y, image_injective.mpr hj.injective ?_, image_injective.mpr hj.injective ?_, + pull_path hm hj.injective h4 h5 hQp⟩ + · rw [h3, hQU, image_inter hj.injective, hPU, hBU] + · rw [h4, hQV, image_inter hj.injective, hPV, hBV] + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CylinderGrid.lean b/LeanPool/GraphMinor/GM07/CylinderGrid.lean new file mode 100644 index 0000000000..13170ef9ef --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CylinderGrid.lean @@ -0,0 +1,535 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CylinderTrim +public import LeanPool.GraphMinor.GM07.CylinderPaths +public import LeanPool.GraphMinor.GM07.RegionNest +public import LeanPool.GraphMinor.GM16.LineDrawingPath + +/-! +# The grid in a capped cylinder + +This is the proof of Graph Minors VII, (5.8), in a sphere with two disjoint discs. The paper says +that (5.8) is Graph Minors III, (4.1). That theorem takes a nest and a family of paths and +uncrosses them. Here the paths come from Menger's theorem (`exists_cylinder_paths`), the nest from +layers of regions (`exists_region_nest`), and the uncrossing is +`GM09.PlanarNests.planar_nest_uncrossing`, used through the wheels of `CylinderWheel`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM09.PlanarNests + +local notation "I" => unitInterval + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +/-- A chain of regions from one disc to the other gives a line that meets the drawing in the +vertices of the chain. -/ +theorem exists_cross_line (hS : IsClosedSurface T) {Γ : Drawing T} {D₁ D₂ : Set T} + (h₁ : IsClosedDisc D₁) (h₂ : IsClosedDisc D₂) (hd : Disjoint D₁ D₂) {r₀ r₂ : Set T} {p a : T} + (h₀ : r₀ ∈ Γ.R) + (hp : p ∈ r₀) (hp₁ : p ∈ D₁) (ha : a ∈ r₂) (ha₂ : a ∈ D₂) {t : ℕ} + (hmem : r₂ ∈ regLayer Γ r₀ t) : + ∃ (L : Set T) (u v : T), IsLineWithEnds L u v ∧ u ∈ discBd D₁ ∧ v ∈ discBd D₂ ∧ L ∩ Γ.U ⊆ Γ.V + ∧ Disjoint L (discInt D₁) ∧ Disjoint L (discInt D₂) ∧ (L ∩ Γ.V).ncard ≤ t := by + classical + obtain ⟨A, a1, a2, a3, X, b1, b2, b3⟩ := exists_chain_set hS h₀ t r₂ hmem + have hpa : p ≠ a := fun h => disjoint_left.mp hd hp₁ (h ▸ ha₂) + obtain ⟨γ, hγ⟩ := (a1.joinedIn p (a2 hp) a (a3 ha)) + obtain ⟨e, hec, hei, he0, he1, her⟩ := exists_arc_of_path γ.continuous (by simpa using hpa) + have heA : ∀ τ, e τ ∈ A := fun τ => by + obtain ⟨σ, hσ⟩ := her (mem_range_self τ) + exact hσ ▸ hγ σ + rw [γ.source] at he0 + rw [γ.target] at he1 + have hc₁ : IsCompact (e ⁻¹' D₁) := (h₁.isClosed.preimage hec).isCompact + obtain ⟨t₁, ht₁, htop⟩ := hc₁.exists_isGreatest ⟨0, by simpa [he0] using hp₁⟩ + have hc₂ : IsCompact (Ici t₁ ∩ e ⁻¹' D₂) := (isClosed_Ici.inter (h₂.isClosed.preimage + hec)).isCompact + obtain ⟨t₂, ⟨htt, ht₂⟩, hlow⟩ := + hc₂.exists_isLeast ⟨1, unitInterval.le_one _, by simpa [he1] using ha₂⟩ + have hlt : t₁ < t₂ := lt_of_le_of_ne htt fun h => disjoint_left.mp hd ht₁ (h ▸ ht₂) + have hgap : (0 : ℝ) < (t₂ : ℝ) - t₁ := sub_pos.mpr hlt + let r : I → I := fun σ => ⟨t₁ + σ * ((t₂ : ℝ) - t₁), by + have h3 := mul_nonneg σ.2.1 hgap.le + have h4 := mul_le_of_le_one_left hgap.le σ.2.2 + exact ⟨by linarith [t₁.2.1], by linarith [t₂.2.2]⟩⟩ + have hrc : Continuous r := Continuous.subtype_mk (by fun_prop) _ + have hr0 : r 0 = t₁ := Subtype.ext (by simp [r]) + have hr1 : r 1 = t₂ := Subtype.ext (by simp [r]) + have hri : Injective r := fun σ σ' he => by + have h3 : (σ : ℝ) * ((t₂ : ℝ) - t₁) = σ' * ((t₂ : ℝ) - t₁) := by + have := congrArg Subtype.val he + simp only [r] at this + linarith + exact Subtype.ext (mul_right_cancel₀ hgap.ne' h3) + let φ : I → T := e ∘ r + have hφ : IsArcMap φ := ⟨hec.comp hrc, hei.comp hri⟩ + have hφ0 : φ 0 ∈ D₁ := by + change e (r 0) ∈ D₁ + rw [hr0] + exact ht₁ + have hφ1 : φ 1 ∈ D₂ := by + change e (r 1) ∈ D₂ + rw [hr1] + exact ht₂ + have hoff₁ : ∀ σ : I, 0 < σ → φ σ ∉ D₁ := fun σ hσ h => by + have h3 : r σ ≤ t₁ := htop h + have h4 : (r σ : ℝ) ≤ t₁ := h3 + have h5 : (0 : ℝ) < σ := hσ + have h6 := mul_pos h5 hgap + simp only [r] at h4 + linarith + have hoff₂ : ∀ σ : I, σ < 1 → φ σ ∉ D₂ := fun σ hσ h => by + have h7 : (r σ : ℝ) = t₁ + σ * ((t₂ : ℝ) - t₁) := rfl + have h8 : (t₁ : ℝ) ≤ r σ := by + rw [h7] + linarith [mul_nonneg σ.2.1 hgap.le] + have h3 : t₂ ≤ r σ := hlow ⟨h8, h⟩ + have h4 : (t₂ : ℝ) ≤ r σ := h3 + have h5 : (σ : ℝ) < 1 := hσ + have h6 := mul_lt_mul_of_pos_right h5 hgap + linarith + have hb₁ : φ 0 ∈ discBd D₁ := by + rw [← IsClosedDisc.frontier_eq_discBd hS h₁, frontier_eq_closure_inter_closure] + refine ⟨subset_closure hφ0, ?_⟩ + have h3 : (0 : I) ∈ closure (Ioi (0 : I)) := by + rw [closure_Ioi' ⟨1, zero_lt_one⟩] + exact le_refl _ + exact map_mem_closure hφ.1 h3 fun σ hσ => hoff₁ σ hσ + have hb₂ : φ 1 ∈ discBd D₂ := by + rw [← IsClosedDisc.frontier_eq_discBd hS h₂, frontier_eq_closure_inter_closure] + refine ⟨subset_closure hφ1, ?_⟩ + have h3 : (1 : I) ∈ closure (Iio (1 : I)) := by + rw [closure_Iio' ⟨0, zero_lt_one⟩] + exact le_refl _ + exact map_mem_closure hφ.1 h3 fun σ hσ => hoff₂ σ hσ + have hLA : ∀ z ∈ range φ, z ∈ A := by + rintro _ ⟨σ, rfl⟩ + exact heA _ + have hLX : range φ ∩ Γ.U ⊆ X := fun z hz => by + rcases b3 (hLA z hz.1) with h | h + · exact h + · exact absurd hz.2 h + refine ⟨range φ, φ 0, φ 1, isLineWithEnds_range_of_arc hφ, hb₁, hb₂, fun z hz => b2 (hLX hz), + ?_, ?_, ?_⟩ + · refine disjoint_left.mpr ?_ + rintro _ ⟨σ, rfl⟩ ⟨h3, h4⟩ + rcases eq_or_lt_of_le (unitInterval.nonneg σ) with h | h + · have h5 : σ = 0 := Subtype.ext h.symm + exact h4 (h5 ▸ hb₁) + · exact hoff₁ σ h h3 + · refine disjoint_left.mpr ?_ + rintro _ ⟨σ, rfl⟩ ⟨h3, h4⟩ + rcases eq_or_lt_of_le (unitInterval.le_one σ) with h | h + · have h5 : σ = 1 := Subtype.ext h + exact h4 (h5 ▸ hb₂) + · exact hoff₂ σ h h3 + · have h3 : range φ ∩ Γ.V ⊆ (X : Set T) := fun z hz => hLX ⟨hz.1, Γ.V_subset_U hz.2⟩ + have h4 := Set.ncard_le_ncard h3 X.finite_toSet + rw [Set.ncard_coe_finset] at h4 + omega + +/-- Points of the interior of a disc lie on one side of a disc whose boundary misses it. -/ +theorem side_of_disc (hS : IsClosedSurface T) {D Δ : Set T} (hD : IsClosedDisc D) + (hΔ : IsClosedDisc Δ) (hf : Disjoint (discInt D) (discBd Δ)) {x y : T} (hx : x ∈ discInt D) + (hy : y ∈ discInt D) + (h : x ∈ Δ) : y ∈ Δ := by + rw [← IsClosedDisc.frontier_eq_discBd hS hΔ] at hf + rcases inside_or_outside hD.isPreconnected_discInt hΔ.isClosed hf with h1 | h1 + · exact interior_subset (h1 hy) + · exact absurd h (h1 hx) + +/-- Extend a path across the two discs by the spokes at its ends. -/ +theorem exists_extended_path {Γ H C₁ C₂ : Drawing T} {D₁ D₂ E₁ E₂ : Set T} {q : T → T} {ℓ : T + → Set T} (w : IsWheeled Γ H C₁ C₂ D₁ D₂ E₁ E₂ q ℓ) (hd : Disjoint D₁ D₂) + (hi₁ : Disjoint Γ.U (discInt D₁)) (hi₂ : Disjoint Γ.U (discInt D₂)) {P : Drawing T} {u v : T} + (hP : P.IsSubdrawing Γ) (hu : u ∈ Γ.V ∩ D₁) (hv : v ∈ Γ.V ∩ D₂) + (hpath : P.IsPathBetween u v) : + ∃ P' : Drawing T, P'.IsSubdrawing H ∧ P'.IsPathBetween (q u) (q v) ∧ P'.V ⊆ P.V ∪ {q u, q v} + ∧ P'.U = ℓ u ∪ P.U ∪ ℓ v := by + have hu' : u ∈ Γ.V ∩ (D₁ ∪ D₂) := ⟨hu.1, .inl hu.2⟩ + have hv' : v ∈ Γ.V ∩ (D₁ ∪ D₂) := ⟨hv.1, .inr hv.2⟩ + obtain ⟨hlu, hneu, heu⟩ := w.line u hu' + obtain ⟨hlv, hnev, hev⟩ := w.line v hv' + obtain ⟨cu1, cu2, cu3⟩ := w.cap₁ u hu + obtain ⟨cv1, cv2, cv3⟩ := w.cap₂ v hv + have huv : u ≠ v := fun h => disjoint_left.mp hd hu.2 (h ▸ hv.2) + have hPL := isLine_of_isPathBetween hpath huv + have huP : u ∈ P.U := hPL.left_mem + have hvP : v ∈ P.U := hPL.right_mem + have hPV : ∀ {z}, z ∈ P.U → z ∈ Γ.U := fun {z} h => hP.U_subset h + have hm1 : ℓ u ∩ P.U = {u} := by + ext z + constructor + · rintro ⟨h3, h4⟩ + have hb : z ∈ discBd D₁ := by + by_contra hn + exact disjoint_left.mp hi₁ (hPV h4) ⟨cu1 h3, hn⟩ + have : z ∈ ℓ u ∩ discBd D₁ := ⟨h3, hb⟩ + rwa [cu2] at this + · rintro rfl + exact ⟨hlu.left_mem, huP⟩ + have hm2 : P.U ∩ ℓ v = {v} := by + ext z + constructor + · rintro ⟨h4, h3⟩ + have hb : z ∈ discBd D₂ := by + by_contra hn + exact disjoint_left.mp hi₂ (hPV h4) ⟨cv1 h3, hn⟩ + have : z ∈ ℓ v ∩ discBd D₂ := ⟨h3, hb⟩ + rwa [cv2] at this + · rintro rfl + exact ⟨hvP, hlv.left_mem⟩ + have huvd : ∀ z, z ∈ ℓ u → z ∈ ℓ v → False := fun z h3 h4 => disjoint_left.mp hd (cu1 h3) (cv1 h4) + obtain ⟨W, -, hWV, -⟩ := id hpath + have huV : u ∈ P.V := by rw [hWV]; exact W.start_mem_support + have hvV : v ∈ P.V := by rw [hWV]; exact W.end_mem_support + let A := lineDrawing hlu.symm hneu.symm + let B := lineDrawing hlv hnev + have g1 : A.U ∩ P.U ⊆ A.V ∩ P.V := fun z hz => by + have h3 : z ∈ ℓ u ∩ P.U := hz + rw [hm1] at h3 + obtain rfl := h3 + exact ⟨.inr rfl, huV⟩ + let G₁ := A.glue P g1 + have g2 : G₁.U ∩ B.U ⊆ G₁.V ∩ B.V := by + rintro z ⟨h3 | h3, h4⟩ + · exact (huvd z h3 h4).elim + · have h5 : z ∈ P.U ∩ ℓ v := ⟨h3, h4⟩ + rw [hm2] at h5 + obtain rfl := h5 + exact ⟨.inr hvV, .inl rfl⟩ + let G := G₁.glue B g2 + have hLine : IsLineWithEnds G.U (q u) (q v) := by + have h3 := Surface.IsLineWithEnds.union hlu.symm hPL hm1 + refine Surface.IsLineWithEnds.union h3 hlv ?_ + ext z + constructor + · rintro ⟨h4 | h4, h5⟩ + · exact (huvd z h4 h5).elim + · have : z ∈ P.U ∩ ℓ v := ⟨h4, h5⟩ + rwa [hm2] at this + · rintro rfl + exact ⟨.inr hvP, hlv.left_mem⟩ + have hquv : q u ≠ q v := fun h => huvd _ hlu.right_mem (h ▸ hlv.right_mem) + have hqu : q u ∈ H.V := (w.ends hu').2.2.2.2.2 + have hqv : q v ∈ H.V := (w.ends hv').2.2.2.2.2 + refine ⟨G, ⟨?_, ?_⟩, GM16.drawing_isPathBetween_of_isLine_U hLine hquv (.inl (.inl (.inl rfl))) + (.inr (.inr rfl)), ?_, rfl⟩ + · rintro z ((h | h) | h | h) + · rcases h with rfl | rfl + · exact hqu + · exact w.sub.1 hu.1 + · exact w.sub.1 (hP.1 h) + · obtain rfl := h + exact w.sub.1 hv.1 + · obtain rfl := h + exact hqv + · change (A.glue P g1 |>.glue B g2).E ⊆ _ + rw [Drawing.glue_E, Drawing.glue_E, lineDrawing_E, lineDrawing_E] + rintro e ((h | h) | h) + · obtain rfl := h + rw [pair_comm] + exact heu + · exact w.sub.2 (hP.2 h) + · obtain rfl := h + exact hev + · rintro z ((h | h) | h | h) + · rcases h with rfl | rfl + · exact .inr (.inl rfl) + · exact .inl huV + · exact .inl h + · obtain rfl := h + exact .inl hvV + · obtain rfl := h + exact .inr (.inr rfl) + +/-- The sequence of the inner circuit, the nest, and the outer circuit. -/ +def nestAt {X : Type*} (a b : X) (s : ℕ) (f : Fin s → X) : ℕ → X + | 0 => a + | t + 1 => if h : t < s then f ⟨t, h⟩ else b + +theorem nestAt_succ {X : Type*} (a b : X) (s : ℕ) (f : Fin s → X) (t : Fin s) : nestAt a b s f + (t + 1) = f t := by + simp [nestAt] + +theorem nestAt_last {X : Type*} (a b : X) (s : ℕ) (f : Fin s → X) : nestAt a b s f (s + 1) = b := by + simp [nestAt] + +theorem nest_cases {s j : ℕ} (hj : j < s + 2) : j = 0 ∨ (∃ t : Fin s, j = t + 1) ∨ j = s + 1 := by + rcases j with _ | t + · exact .inl rfl + · by_cases h : t < s + · exact .inr (.inl ⟨⟨t, h⟩, rfl⟩) + · exact .inr (.inr (by omega)) + +/-- The inner circle, the nest, and the outer circle form a nest of `H`. -/ +theorem isDiscNest_of_layers {Γ H C₁ C₂ : Drawing T} {D₁ D₂ E₁ E₂ Δ : Set T} {q : T → T} {ℓ : T + → Set T} (w : IsWheeled Γ H C₁ C₂ D₁ D₂ E₁ E₂ q ℓ) (hΔ : IsClosedDisc Δ) (hbΔ : discBd Δ = C₂.U) + (hE₁Δ : E₁ ⊆ Δ) {s : ℕ} {N : Fin s → Drawing T} {Dn : Fin s → Set T} + (hN : ∀ t, (N t).IsCircuit ∧ (N t).IsSubdrawing Γ ∧ IsClosedDisc (Dn t) ∧ discBd (Dn t) = + (N t).U ∧ E₁ ⊆ Dn t ∧ Dn t ⊆ Δ) (hNN : ∀ t t', t < t' → Disjoint (N t).V (N t').V + ∧ Dn t ⊆ Dn t') + (hΓ₁ : Disjoint Γ.V C₁.V) (hΓ₂ : Disjoint Γ.V C₂.V) (h12 : Disjoint C₁.V C₂.V) : + IsDiscNest H Δ C₁ C₂ (fun j : Fin (s + 2) => nestAt C₁ C₂ s N j) := by + have hNV : ∀ t, ∀ x ∈ (N t).V, x ∈ Γ.V := fun t x hx => (hN t).2.1.1 hx + set F := nestAt C₁ C₂ s N with hF + set d := nestAt E₁ Δ s Dn with hd + have hprop : ∀ j, j < s + 2 → (F j).IsSubdrawing H ∧ (F j).IsCircuit ∧ IsClosedDisc (d j) + ∧ discBd (d j) = (F j).U ∧ d j ⊆ Δ := fun j hj => by + rcases nest_cases hj with rfl | ⟨t, rfl⟩ | rfl + · exact ⟨w.sub₁, w.circ₁, w.disc₁, w.bd₁, hE₁Δ⟩ + · rw [hF, hd, nestAt_succ, nestAt_succ] + obtain ⟨h1, h2, h3, h4, -, h6⟩ := hN t + exact ⟨h2.trans w.sub, h1, h3, h4, h6⟩ + · rw [hF, hd, nestAt_last, nestAt_last] + exact ⟨w.sub₂, w.circ₂, hΔ, hbΔ, Subset.rfl⟩ + have hins : ∀ j, j < s + 2 → GM14.discIns Δ (F j) = d j := fun j hj => by + obtain ⟨-, h2, h3, h4, h5⟩ := hprop j hj + exact ((GM14.discIns_spec hΔ h2 (h4 ▸ (Surface.discBd_subset _).trans h5)).2 + (d j) h5 h3 h4).symm + have hlt : ∀ i j, i < j → j < s + 2 → Disjoint (F i).V (F j).V ∧ d i ⊆ d j := fun i j hij hj => by + rcases nest_cases (hij.trans hj) with rfl | ⟨t, rfl⟩ | rfl + · rcases nest_cases hj with rfl | ⟨t', rfl⟩ | rfl + · omega + · rw [hF, hd, nestAt_succ, nestAt_succ] + exact ⟨disjoint_left.mpr fun x h1 h2 => disjoint_left.mp hΓ₁ (hNV t' x h2) h1, + (hN t').2.2.2.2.1⟩ + · rw [hF, hd, nestAt_last, nestAt_last] + exact ⟨h12, hE₁Δ⟩ + · rcases nest_cases hj with rfl | ⟨t', rfl⟩ | rfl + · omega + · rw [hF, hd, nestAt_succ, nestAt_succ, nestAt_succ, nestAt_succ] + exact hNN t t' (Fin.lt_def.mpr (by omega)) + · rw [hF, hd, nestAt_succ, nestAt_succ, nestAt_last, nestAt_last] + exact ⟨disjoint_left.mpr fun x h1 h2 => disjoint_left.mp hΓ₂ (hNV t x h1) h2, + (hN t).2.2.2.2.2⟩ + · omega + refine ⟨fun j => ?_, fun i j hne => ?_, fun i j hij => ?_, fun _ => ⟨rfl, nestAt_last _ _ _ _⟩⟩ + · obtain ⟨h1, h2, -, h4, h5⟩ := hprop j j.2 + exact ⟨h1, h2, h4 ▸ (Surface.discBd_subset _).trans h5⟩ + · rcases lt_or_gt_of_ne hne with h | h + · exact (hlt i j h j.2).1 + · exact (hlt j i h i.2).1.symm + · change GM14.discIns Δ (F i) ⊆ GM14.discIns Δ (F j) + rw [hins i i.2, hins j j.2] + rcases eq_or_lt_of_le (Fin.le_def.mp hij) with h | h + · rw [h] + · exact (hlt i j h j.2).2 + +/-- **(5.8) in the capped cylinder.** -/ +theorem exists_cylinder_grid (hS : IsClosedSurface T) (hsph : IsSphere T) [ConnectedSpace T] + (Γ : Drawing T) {D₁ D₂ : Set T} (h₁ : IsClosedDisc D₁) (h₂ : IsClosedDisc D₂) + (hd : Disjoint D₁ D₂) + (hU₁ : Γ.U ∩ D₁ ⊆ Γ.V) (hi₁ : Disjoint Γ.U (discInt D₁)) (hU₂ : Γ.U ∩ D₂ ⊆ Γ.V) + (hi₂ : Disjoint Γ.U (discInt D₂)) {p a : T} (hp : p ∈ discInt D₁) + (ha : a ∈ discInt D₂) {r s : ℕ} + (hi : ∀ B, IsClosedDisc B → D₁ ⊆ B → Disjoint (discInt D₂) B → discBd B ∩ Γ.U ⊆ Γ.V → r ≤ + (discBd B ∩ Γ.U).ncard) + (hii : ∀ (L : Set T) (u v : T), IsLineWithEnds L u v → u ∈ discBd D₁ → v ∈ discBd D₂ + → L ∩ Γ.U ⊆ Γ.V → Disjoint L (discInt D₁) → Disjoint L (discInt D₂) → s ≤ (L ∩ Γ.V).ncard) : + ∃ (P : Fin r → Drawing T) (u v : Fin r → T) (B : Fin s → Drawing T) (E : Fin s → Set T), (∀ i, + (P i).IsSubdrawing Γ ∧ u i ∈ D₁ ∧ v i ∈ D₂ ∧ (P i).IsPathBetween (u i) (v i)) ∧ + (∀ i i', i ≠ i' → Disjoint (P i).V (P i').V) ∧ + (∀ j, (B j).IsSubdrawing Γ ∧ (B j).IsCircuit ∧ IsClosedDisc (E j) ∧ discBd (E j) = (B j).U + ∧ p ∈ E j ∧ a ∉ E j) ∧ + (∀ j j', j ≤ j' → E j ⊆ E j') ∧ + (∀ j j', j ≠ j' → Disjoint (B j).V (B j').V) ∧ + ∀ i j, ∃ (Q : Drawing T) (x y : T), Q.IsSubdrawing Γ ∧ Q.U = (P i).U ∩ (B j).U ∧ Q.V = + (P i).V ∩ (B j).V ∧ Q.IsPathBetween x y := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hlc : LocallyConnectedSpace T := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨P₀, u₀, v₀, hP₀, hP₀d⟩ := exists_cylinder_paths hS hsph Γ h₁ h₂ hd hU₁ hi₁ hU₂ hi₂ hi + -- the nest from the layers + have hpU : p ∉ Γ.U := fun h => disjoint_left.mp hi₁ h hp + have haU : a ∉ Γ.U := fun h => disjoint_left.mp hi₂ h ha + let r₀ := connectedComponentIn (univ \ Γ.U) p + let r₂ := connectedComponentIn (univ \ Γ.U) a + have hr₀ : r₀ ∈ Γ.R := (mem_R_iff Γ).mpr ⟨p, hpU, rfl⟩ + have hr₂ : r₂ ∈ Γ.R := (mem_R_iff Γ).mpr ⟨a, haU, rfl⟩ + have hpr : p ∈ r₀ := mem_connectedComponentIn ⟨mem_univ _, hpU⟩ + have har : a ∈ r₂ := mem_connectedComponentIn ⟨mem_univ _, haU⟩ + have hfar : ∀ t < s, r₂ ∉ regLayer Γ r₀ t := fun t ht hmem => by + obtain ⟨L, u, v, c1, c2, c3, c4, c5, c6, c7⟩ := exists_cross_line hS h₁ h₂ hd hr₀ hpr hp.1 har + ha.1 hmem + have := hii L u v c1 c2 c3 c4 c5 c6 + omega + obtain ⟨N, Dn, hN, hNN⟩ := exists_region_nest hS hsph hr₀ hr₂ hpr har hfar + -- the wheels + obtain ⟨H, C₁, C₂, E₁, E₂, q, ℓ, w⟩ := exists_wheeled Γ h₁ h₂ hd hi₁ hi₂ + have hC₁I : ∀ x ∈ C₁.U, x ∈ discInt D₁ := fun x hx => w.in₁ (Surface.discBd_subset _ (w.bd₁ ▸ hx)) + have hC₂I : ∀ x ∈ C₂.U, x ∈ discInt D₂ := fun x hx => w.in₂ (Surface.discBd_subset _ (w.bd₂ ▸ hx)) + have hΓ₁ : Disjoint Γ.V C₁.V := disjoint_left.mpr fun x h3 h4 => disjoint_left.mp hi₁ + (Γ.V_subset_U h3) (hC₁I x (C₁.V_subset_U h4)) + have hΓ₂ : Disjoint Γ.V C₂.V := disjoint_left.mpr fun x h3 h4 => disjoint_left.mp hi₂ + (Γ.V_subset_U h3) (hC₂I x (C₂.V_subset_U h4)) + have h12 : Disjoint C₁.V C₂.V := disjoint_left.mpr fun x h3 h4 => disjoint_left.mp hd (hC₁I x + (C₁.V_subset_U h3)).1 (hC₂I x (C₂.V_subset_U h4)).1 + have hE₁I : E₁ ⊆ discInt D₁ := w.in₁ + have hE₂I : E₂ ⊆ discInt D₂ := w.in₂ + obtain ⟨hΔ, hbΔ₀⟩ := GM12.isClosedDisc_closure_compl_of_sphere hS hsph w.disc₂ + set Δ := closure (univ \ E₂) with hΔdef + have hbΔ : discBd Δ = C₂.U := hbΔ₀.trans w.bd₂ + have hoffΔ : ∀ {x}, x ∉ E₂ → x ∈ Δ := fun {x} hx => subset_closure ⟨mem_univ x, hx⟩ + have hnotΔ : ∀ {x}, x ∈ discInt E₂ → x ∉ Δ := fun {x} hx h => by + obtain ⟨y, hy1, hy2⟩ := mem_closure_iff.mp h _ (w.disc₂.isOpen_discInt hman) hx + exact hy2.2 hy1.1 + have hE₁Δ : E₁ ⊆ Δ := fun x hx => hoffΔ fun h => disjoint_left.mp hd (hE₁I hx).1 (hE₂I h).1 + have hbI : ∀ {X : Drawing T}, X.IsSubdrawing Γ → ∀ {Y}, discBd Y = X.U → Disjoint (discInt D₁) + (discBd Y) ∧ Disjoint (discInt D₂) (discBd Y) := fun {X} hX {Y} hY => by + rw [hY] + exact ⟨hi₁.symm.mono_right hX.U_subset, hi₂.symm.mono_right hX.U_subset⟩ + have hN' : ∀ t, (N t).IsCircuit ∧ (N t).IsSubdrawing Γ ∧ IsClosedDisc (Dn t) ∧ discBd (Dn t) = + (N t).U ∧ E₁ ⊆ Dn t ∧ Dn t ⊆ Δ := fun t => by + obtain ⟨c1, c2, c3, c4, c5, c6⟩ := hN t + have hf := hbI c2 c4 + refine ⟨c1, c2, c3, c4, fun x hx => side_of_disc hS h₁ c3 hf.1 hp (hE₁I hx) c5, + fun x hx => hoffΔ fun h => c6 ?_⟩ + exact side_of_disc hS h₂ c3 hf.2 (hE₂I h) ha hx + have hnest := isDiscNest_of_layers w hΔ hbΔ hE₁Δ hN' hNN hΓ₁ hΓ₂ h12 + -- the paths, extended by spokes + have hends : ∀ i, u₀ i ∈ Γ.V ∩ D₁ ∧ v₀ i ∈ Γ.V ∩ D₂ := fun i => by + obtain ⟨c1, c2, c3, W, -, hV, -⟩ := hP₀ i + exact ⟨⟨c1.1 (by rw [hV]; exact W.start_mem_support), c2⟩, + ⟨c1.1 (by rw [hV]; exact W.end_mem_support), c3⟩⟩ + have hstart : ∀ i, u₀ i ∈ (P₀ i).V ∧ v₀ i ∈ (P₀ i).V := fun i => by + obtain ⟨-, -, -, W, -, hV, -⟩ := hP₀ i + exact ⟨by rw [hV]; exact W.start_mem_support, by rw [hV]; exact W.end_mem_support⟩ + have hext : ∀ i, ∃ P' : Drawing T, P'.IsSubdrawing H ∧ P'.IsPathBetween (q (u₀ i)) (q (v₀ i)) + ∧ P'.V ⊆ (P₀ i).V ∪ {q (u₀ i), q (v₀ i)} ∧ P'.U = ℓ (u₀ i) ∪ (P₀ i).U ∪ ℓ (v₀ i) := fun i => + exists_extended_path w hd hi₁ hi₂ (hP₀ i).1 (hends i).1 (hends i).2 (hP₀ i).2.2.2 + choose P₁ hP₁H hP₁p hP₁V hP₁U using hext + have hq₁ := fun i => w.q₁ _ (hends i).1 + have hq₂ := fun i => w.q₂ _ (hends i).2 + have hu' : ∀ i, u₀ i ∈ Γ.V ∩ (D₁ ∪ D₂) := fun i => ⟨(hends i).1.1, .inl (hends i).1.2⟩ + have hv' : ∀ i, v₀ i ∈ Γ.V ∩ (D₁ ∪ D₂) := fun i => ⟨(hends i).2.1, .inr (hends i).2.2⟩ + have hquu : ∀ i i', i ≠ i' → q (u₀ i) ≠ q (u₀ i') := fun i i' hne he => by + have hne' : u₀ i ≠ u₀ i' := fun h => disjoint_left.mp (hP₀d i i' hne) (hstart i).1 (h ▸ + (hstart i').1) + exact disjoint_left.mp (w.disj _ (hu' i) _ (hu' i') hne') (w.line _ (hu' i)).1.right_mem (he ▸ + (w.line _ (hu' i')).1.right_mem) + have hqvv : ∀ i i', i ≠ i' → q (v₀ i) ≠ q (v₀ i') := fun i i' hne he => by + have hne' : v₀ i ≠ v₀ i' := fun h => disjoint_left.mp (hP₀d i i' hne) (hstart i).2 (h ▸ + (hstart i').2) + exact disjoint_left.mp (w.disj _ (hv' i) _ (hv' i') hne') (w.line _ (hv' i)).1.right_mem (he ▸ + (w.line _ (hv' i')).1.right_mem) + have hP₁dis : ∀ i i', i ≠ i' → Disjoint (P₁ i).V (P₁ i').V := fun i i' hne + => disjoint_left.mpr fun z h3 h4 => by + have hΓz : ∀ k, z ∈ (P₀ k).V → z ∈ Γ.V := fun k h => (hP₀ k).1.1 h + have hc1 : ∀ k, z = q (u₀ k) → z ∈ C₁.V := fun k h => h ▸ hq₁ k + have hc2 : ∀ k, z = q (v₀ k) → z ∈ C₂.V := fun k h => h ▸ hq₂ k + rcases hP₁V i h3 with h5 | h5 | h5 <;> rcases hP₁V i' h4 with h6 | h6 | h6 + · exact disjoint_left.mp (hP₀d i i' hne) h5 h6 + · exact disjoint_left.mp hΓ₁ (hΓz i h5) (hc1 i' h6) + · exact disjoint_left.mp hΓ₂ (hΓz i h5) (hc2 i' h6) + · exact disjoint_left.mp hΓ₁ (hΓz i' h6) (hc1 i h5) + · exact hquu i i' hne (h5.symm.trans h6) + · exact disjoint_left.mp h12 (hc1 i h5) (hc2 i' h6) + · exact disjoint_left.mp hΓ₂ (hΓz i' h6) (hc2 i h5) + · exact disjoint_left.mp h12 (hc1 i' h6) (hc2 i h5) + · exact hqvv i i' hne (h5.symm.trans h6) + have hP₁Δ : ∀ i, (P₁ i).U ⊆ Δ := fun i => by + rw [hP₁U] + refine union_subset (union_subset (fun z hz => hoffΔ fun h => ?_) (fun z hz => hoffΔ fun h + => ?_)) fun z hz => ?_ + · exact disjoint_left.mp hd ((w.cap₁ _ (hends i).1).1 hz) (hE₂I h).1 + · exact disjoint_left.mp hi₂ ((hP₀ i).1.U_subset hz) (hE₂I h) + · by_cases h : z ∈ E₂ + · have h3 : z ∈ ℓ (v₀ i) ∩ E₂ := ⟨hz, h⟩ + rw [(w.cap₂ _ (hends i).2).2.2] at h3 + obtain rfl := h3 + exact Surface.discBd_subset _ (hbΔ ▸ C₂.V_subset_U (hq₂ i)) + · exact hoffΔ h + have hpaths : IsDiscPaths H Δ C₁ C₂ P₁ := ⟨fun i => ⟨hP₁H i, hP₁Δ i, _, hq₁ i, _, hq₂ i, hP₁p i⟩, + fun i i' hne => hP₁dis i i' hne⟩ + -- the uncrossing + obtain ⟨C, Pu, hC, hPu, hinf⟩ := planar_nest_uncrossing hS hΔ hbΔ ⟨_, hnest⟩ ⟨P₁, hpaths⟩ + obtain ⟨hCdata, hCdis, hCmono, hCend⟩ := hC + obtain ⟨hC0, hCl⟩ := hCend (by omega) + let i₀ : Fin (s + 2) := ⟨0, by omega⟩ + let il : Fin (s + 2) := ⟨s + 2 - 1, by omega⟩ + let idx : Fin s → Fin (s + 2) := fun j => ⟨j + 1, by omega⟩ + have hidx0 : ∀ j, idx j ≠ i₀ := fun j h => by + have := congrArg Fin.val h + simp [idx, i₀] at this + have hidxl : ∀ j, idx j ≠ il := fun j h => by + have h3 := congrArg Fin.val h + have h4 := j.2 + simp only [idx, il] at h3 + omega + have hBC₁ : ∀ j, Disjoint (C (idx j)).V C₁.V := fun j => by + have : Disjoint (C (idx j)).V (C i₀).V := hCdis (hidx0 j) + rwa [show C i₀ = C₁ from hC0] at this + have hBC₂ : ∀ j, Disjoint (C (idx j)).V C₂.V := fun j => by + have : Disjoint (C (idx j)).V (C il).V := hCdis (hidxl j) + rwa [show C il = C₂ from hCl] at this + have hBΓ : ∀ j, (C (idx j)).IsSubdrawing Γ := fun j => by + obtain ⟨c1, -, -⟩ := hCdata (idx j) + have hVΓ : ∀ x ∈ (C (idx j)).V, x ∈ Γ.V := fun x hx => by + have h3 := c1.1 hx + rw [w.V] at h3 + rcases h3 with (h | h) | h + · exact h + · exact absurd h (disjoint_left.mp (hBC₁ j) hx) + · exact absurd h (disjoint_left.mp (hBC₂ j) hx) + refine ⟨hVΓ, fun e he => ?_⟩ + obtain ⟨y, z, hl⟩ := ((C (idx j)).toGraph.edge_mem_iff_exists_isLink e).mp he + exact w.mem_E_of_link hΓ₁ hΓ₂ ((c1.isLink_iff he).mp hl) (hVΓ y hl.2.1) (hVΓ z hl.2.2.1) + have htrim : ∀ i, ∃ (P : Drawing T) (u v : T), P.IsSubdrawing Γ ∧ P.IsSubdrawing (Pu i) ∧ u ∈ D₁ + ∧ v ∈ D₂ ∧ P.IsPathBetween u v ∧ + ∀ B : Drawing T, B.IsSubdrawing H → Disjoint B.V C₁.V → Disjoint B.V C₂.V → B.V ∩ + (Pu i).V ⊆ P.V ∧ B.E ∩ (Pu i).E ⊆ P.E := fun i => by + obtain ⟨c1, -, a', ha', b', hb', hpa⟩ := hPu.1 i + have h3 := (hinf i₀ i).isPreconnected_U + have h4 := (hinf il i).isPreconnected_U + rw [show C i₀ = C₁ from hC0] at h3 + rw [show C il = C₂ from hCl] at h4 + exact exists_trimmed_path w hΓ₁ hΓ₂ h12 c1 ha' hb' hpa h3 h4 + choose P u v hPΓ hPPu hu hv hPp hPB using htrim + refine ⟨P, u, v, fun j => C (idx j), fun j => GM14.discIns Δ (C (idx j)), fun i + => ⟨hPΓ i, hu i, hv i, hPp i⟩, fun i i' hne => (hPu.2 hne).mono (hPPu i).1 (hPPu i').1, fun j + => ⟨hBΓ j, (hCdata (idx j)).2.1, ?_⟩, + fun j j' hj => hCmono (Fin.le_def.mpr (by simpa [idx] using hj)), fun j j' hne => hCdis fun h + => hne (Fin.ext (by simpa [idx] using congrArg Fin.val h)), fun i j => ?_⟩ + · obtain ⟨-, c2, c3⟩ := hCdata (idx j) + obtain ⟨⟨d1, d2, d3⟩, -⟩ := GM14.discIns_spec hΔ c2 c3 + have hE₁eq : GM14.discIns Δ C₁ = E₁ := ((GM14.discIns_spec hΔ w.circ₁ (w.bd₁ ▸ + (Surface.discBd_subset _).trans hE₁Δ)).2 E₁ hE₁Δ w.disc₁ w.bd₁).symm + have hmono : E₁ ⊆ GM14.discIns Δ (C (idx j)) := by + have h3 : GM14.discIns Δ (C i₀) ⊆ GM14.discIns Δ (C (idx j)) := hCmono (Fin.le_def.mpr + (Nat.zero_le _)) + rwa [show C i₀ = C₁ from hC0, hE₁eq] at h3 + have hf := hbI (hBΓ j) d3 + refine ⟨d2, d3, ?_, ?_⟩ + · obtain ⟨z, hz⟩ := w.disc₁.nonempty_discInt + exact side_of_disc hS h₁ d2 hf.1 (hE₁I hz.1) hp (hmono hz.1) + · intro haΔ + obtain ⟨z, hz⟩ := w.disc₂.nonempty_discInt + exact hnotΔ hz (d1 (side_of_disc hS h₂ d2 hf.2 ha (hE₂I hz.1) haΔ)) + · have hBH := (hCdata (idx j)).1 + have hPuH := (hPu.1 i).1 + have hPH := (hPPu i).trans hPuH + obtain ⟨hV, hE⟩ := hPB i (C (idx j)) hBH (hBC₁ j) (hBC₂ j) + have heq : Drawing.inf Γ (P i) (C (idx j)) = Drawing.inf H (C (idx j)) (Pu i) := by + refine Drawing.ext_of_V_E ?_ ?_ + · rw [Drawing.inf_V (hPΓ i) (hBΓ j), Drawing.inf_V hBH hPuH] + exact subset_antisymm (fun x hx => ⟨hx.2, (hPPu i).1 hx.1⟩) fun x hx => ⟨hV hx, hx.1⟩ + · rw [Drawing.inf_E (hPΓ i), Drawing.inf_E hBH] + exact subset_antisymm (fun x hx => ⟨hx.2, (hPPu i).2 hx.1⟩) fun x hx => ⟨hE hx, hx.1⟩ + obtain ⟨x, y, hxy⟩ := hinf (idx j) i + exact ⟨_, x, y, Drawing.inf_isSubdrawing _ _ _, Drawing.inf_U (hPΓ i) (hBΓ j), + Drawing.inf_V (hPΓ i) (hBΓ j), heq ▸ hxy⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CylinderPaths.lean b/LeanPool/GraphMinor/GM07/CylinderPaths.lean new file mode 100644 index 0000000000..c0d0ffb306 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CylinderPaths.lean @@ -0,0 +1,128 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.SideDisc +public import LeanPool.GraphMinor.GM16.DrawingSkeletonPaths +public import LeanPool.GraphMinor.Menger.Basic +public import LeanPool.GraphMinor.Thomas.Separator + +/-! +# Disjoint paths across a cylinder + +Graph Minors VII, (5.8), condition (i) says that every `O`-arc that is normal, not null-homotopic, +meets the graph in at least `r` vertices. The paper gets the `r` paths from this +in one word, by Menger's theorem. Here `exists_cylinder_paths` is that step in a sphere with two +disjoint discs. A vertex set `X` that separates the discs gives, by +`exists_disc_of_side`, a closed disc about the first disc whose boundary meets the drawing inside +`X`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +/-- **Menger's theorem across a cylinder.** -/ +theorem exists_cylinder_paths (hS : IsClosedSurface T) (hsph : IsSphere T) + (Γ : Drawing T) {D₁ D₂ : Set T} (h₁ : IsClosedDisc D₁) (h₂ : IsClosedDisc D₂) + (hd : Disjoint D₁ D₂) + (hU₁ : Γ.U ∩ D₁ ⊆ Γ.V) (hi₁ : Disjoint Γ.U (discInt D₁)) (hU₂ : Γ.U ∩ D₂ ⊆ Γ.V) + (hi₂ : Disjoint Γ.U (discInt D₂)) {r : ℕ} + (hi : ∀ B, IsClosedDisc B → D₁ ⊆ B → Disjoint (discInt D₂) B → discBd B ∩ Γ.U ⊆ Γ.V → r ≤ + (discBd B ∩ Γ.U).ncard) : + ∃ (P : Fin r → Drawing T) (u v : Fin r → T), (∀ i, (P i).IsSubdrawing Γ ∧ u i ∈ D₁ ∧ v i ∈ D₂ ∧ + (P i).IsPathBetween (u i) (v i)) ∧ ∀ i i', i ≠ i' → Disjoint (P i).V (P i').V := by + classical + set Z₁ := Γ.V ∩ D₁ with hZ₁ + set Z₂ := Γ.V ∩ D₂ with hZ₂ + have hZ₁V : Z₁ ⊆ Γ.toHypergraph.vertexSet := inter_subset_left + have hZ₂V : Z₂ ⊆ Γ.toHypergraph.vertexSet := inter_subset_left + by_cases hp : HasDisjointPaths Γ.toHypergraph.skeleton Z₁ Z₂ r + · obtain ⟨Q, hQ⟩ := hp + have hex : ∀ i, ∃ P : Drawing T, P.IsPathBetween (Q i).first (Q i).last ∧ P.IsSubdrawing Γ + ∧ P.V = {x | x ∈ (Q i).walk.support} := fun i => + GraphMinor.GM16.drawing_path_of_skeleton_path (Q i).first_mem.1 (Q i).walk (Q i).isPath + choose P hP hPs hPV using hex + refine ⟨P, fun i => (Q i).first, fun i => (Q i).last, fun i => ⟨hPs i, (Q i).first_mem.2, + (Q i).last_mem.2, hP i⟩, fun i i' hne => ?_⟩ + rw [hPV, hPV] + exact hQ hne + · exfalso + obtain ⟨X, hsep, hlt⟩ := Thomas.exists_separates_lt_of_not_hasDisjointPaths Γ.toHypergraph hZ₁V + hZ₂V hp + set K₀ := Γ.toHypergraph.skeleton + set K := Thomas.sepCompLeft K₀ Γ.V X Z₁ with hK + have hXV : X ⊆ Γ.V := hsep.1 + let P : T → ℕ → Prop := fun u n => ∃ z ∈ Z₁ \ X, ∃ p : K₀.Walk z u, + (∀ w ∈ p.support, w ∈ Γ.V \ X) ∧ p.length = n + have hne : ∀ u ∈ K, {n | P u n}.Nonempty := + fun u ⟨_, z, hz, p, hp⟩ => ⟨_, z, hz, p, hp, rfl⟩ + let ρ : T → ℕ := fun u => sInf {n | P u n} + have hρ : ∀ u ∈ K, P u (ρ u) := fun u hu => Nat.sInf_mem (s := {n | P u n}) (hne u hu) + have hKsub : K ⊆ Γ.V \ X := Thomas.sepCompLeft_subset_sdiff _ _ _ _ + have hedge : ∀ e ∈ Γ.E, ∀ u ∈ K, u ∈ closure e → ∀ w ∈ Γ.V, w ∈ closure e → w ∈ K ∪ X + := fun e he u hu hue w hw hwe => by + by_cases huw : u = w + · exact .inl (huw ▸ hu) + by_contra hn + have hw' : w ∈ Thomas.sepCompRight K₀ Γ.V X Z₁ := by + refine ⟨⟨hw, fun h => hn (.inr h)⟩, fun h => hn (.inl h)⟩ + exact Thomas.not_adj_sepCompLeft_sepCompRight hu hw' ⟨huw, e, ⟨he, (hKsub hu).1, hue⟩, ⟨he, + hw, hwe⟩⟩ + have hZbd : ∀ {z}, z ∈ Z₁ → z ∈ discBd D₁ := fun {z} hz => by + by_contra hn + exact disjoint_left.mp hi₁ (Γ.V_subset_U hz.1) ⟨hz.2, hn⟩ + have hreach : ∀ u ∈ K, u ∉ discBd D₁ → ∃ e ∈ Γ.E, ∃ w ∈ K, w ≠ u ∧ u ∈ closure e + ∧ w ∈ closure e ∧ (w ∉ discBd D₁ → ρ w < ρ u) := fun u hu hub => by + obtain ⟨z, hz, p, hp, hl⟩ := hρ u hu + have huz : u ≠ z := fun h => hub (h ▸ hZbd hz.1) + obtain ⟨w, hadj, q, hq⟩ := SimpleGraph.Walk.exists_eq_cons_of_ne huz p.reverse + obtain ⟨huw, e, h1, h2⟩ := hadj + have hsup : ∀ y ∈ q.support, y ∈ Γ.V \ X := fun y hy => hp y (by + have : y ∈ p.reverse.support := by + rw [hq] + exact List.mem_cons_of_mem _ hy + rwa [SimpleGraph.Walk.support_reverse, List.mem_reverse] at this) + have hsup' : ∀ y ∈ q.reverse.support, y ∈ Γ.V \ X := fun y hy => hsup y + (by rwa [SimpleGraph.Walk.support_reverse, List.mem_reverse] at hy) + have hw : w ∈ K := ⟨hsup w q.start_mem_support, z, hz, q.reverse, hsup'⟩ + refine ⟨e, h1.1, w, hw, huw.symm, h1.2.2, h2.2.2, fun _ => ?_⟩ + have hle : ρ w ≤ q.reverse.length := Nat.sInf_le ⟨z, hz, q.reverse, hsup', rfl⟩ + have hlen : q.length + 1 = p.length := by + have h3 : p.reverse.length = q.length + 1 := by + rw [hq] + rfl + rw [SimpleGraph.Walk.length_reverse] at h3 + exact h3.symm + rw [SimpleGraph.Walk.length_reverse] at hle + omega + have hc : Γ.V ∩ discBd D₁ ⊆ K ∪ X := fun x hx => by + by_cases hxX : x ∈ X + · exact .inr hxX + · have hz : x ∈ Z₁ := ⟨hx.1, Surface.discBd_subset _ hx.2⟩ + exact .inl ⟨⟨hx.1, hxX⟩, x, ⟨hz, hxX⟩, SimpleGraph.Walk.nil, fun w hw => by + rw [SimpleGraph.Walk.support_nil, List.mem_singleton] at hw + exact hw ▸ ⟨hx.1, hxX⟩⟩ + have hke : Disjoint K D₂ := disjoint_left.mpr fun u hu hu₂ => by + obtain ⟨hV, z, hz, p, hp⟩ := hu + obtain ⟨x, hx, hxX⟩ := hsep.2 hz.1 (⟨hV.1, hu₂⟩ : u ∈ Z₂) p (fun w hw => (hp w hw).1) + exact (hp x hx).2 hxX + obtain ⟨B, hB, hsub, hdis, hbdB⟩ := exists_disc_of_side (K := K) (X := X) (ρ + := ρ) hS hsph Γ h₁ h₂ hd (fun x hx => hU₁ ⟨hx.1, Surface.discBd_subset _ hx.2⟩) hi₁ hU₂ hi₂ + (fun x hx => (hKsub hx).1) hXV + (Thomas.disjoint_sepCompLeft_sep _ _ _ _).symm hc hke hedge hreach + have hle := hi B hB hsub hdis (hbdB.trans hXV) + have := Set.ncard_le_ncard hbdB (Γ.finite_V.subset hXV) + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CylinderTrim.lean b/LeanPool/GraphMinor/GM07/CylinderTrim.lean new file mode 100644 index 0000000000..c0f87bcdd6 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CylinderTrim.lean @@ -0,0 +1,433 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CylinderWheel +public import LeanPool.GraphMinor.GM09.PlanarNests +public import LeanPool.GraphMinor.GM11.Section6 + +/-! +# Trimming the paths back to the cylinder + +The uncrossing gives paths between the two circles of the wheels (`CylinderWheel`). Each meets a +circle in a path, so what lies before its last vertex on the first circle and after its +next vertex on the second lies on the circles. The part between has a spoke at each end, and without +these spokes it is a path of the original drawing. It meets each circuit of the nest +exactly as the long path does (`exists_trimmed_path`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM09.PlanarNests + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +section Walks + +variable {α β : Type*} {G : Graph α β} + +theorem walk_append_assoc {a b c d : α} (X : GraphWalk G a b) (Y : GraphWalk G b c) + (Z : GraphWalk G c d) : + (X.append Y).append Z = X.append (Y.append Z) := by + induction X with + | nil h => rfl + | cons h r ih => simp [GraphWalk.append, ih] + +/-- Cut a walk at its last vertex in `X`. -/ +theorem exists_last_hit_split {a b : α} (W : GraphWalk G a b) {X : Set α} + (hne : ∃ x ∈ W.support, x ∈ X) : + ∃ v ∈ X, ∃ (W₁ : GraphWalk G a v) (W₂ : GraphWalk G v b), W = W₁.append W₂ + ∧ ∀ x ∈ W₂.support, x ∈ X → x = v := by + induction W with + | @nil a h => + obtain ⟨x, hx, hxX⟩ := hne + have hxa : x = a := List.mem_singleton.mp hx + exact ⟨a, hxa ▸ hxX, .nil h, .nil h, rfl, fun y hy _ => List.mem_singleton.mp hy⟩ + | @cons a y b e h r ih => + by_cases hr : ∃ x ∈ r.support, x ∈ X + · obtain ⟨v, hv, W₁, W₂, rfl, h2⟩ := ih hr + exact ⟨v, hv, .cons h W₁, W₂, rfl, h2⟩ + · obtain ⟨x, hx, hxX⟩ := hne + rcases List.mem_cons.mp hx with rfl | hx + · refine ⟨x, hxX, .nil h.left_mem, .cons h r, rfl, fun z hz hzX => ?_⟩ + rcases List.mem_cons.mp hz with rfl | hz + · rfl + · exact (hr ⟨z, hz, hzX⟩).elim + · exact (hr ⟨x, hx, hxX⟩).elim + +/-- The first edge of a walk. -/ +theorem exists_cons_of_ne {a b : α} (W : GraphWalk G a b) (hab : a ≠ b) : ∃ (c : α) (e : β) + (h : G.IsLink e a c) (W₀ : GraphWalk G c b), W = .cons h W₀ := by + cases W with + | nil _ => exact absurd rfl hab + | cons h r => exact ⟨_, _, h, r, rfl⟩ + +/-- The last edge of a walk. -/ +theorem exists_snoc {a b : α} (W : GraphWalk G a b) (hab : 0 < W.length) : + ∃ (c : α) (e : β) (W₀ : GraphWalk G a c) (h : G.IsLink e c b), W = W₀.append (.cons h + (.nil h.right_mem)) := by + induction W with + | nil _ => simp at hab + | @cons a y b e h r ih => + by_cases hy : 0 < r.length + · obtain ⟨c, e', W₀, h', rfl⟩ := ih hy + exact ⟨c, e', .cons h W₀, h', rfl⟩ + · cases r with + | nil _ => exact ⟨a, e, .nil h.left_mem, h, rfl⟩ + | cons _ _ => simp at hy + +/-- All edges of a walk with vertices in `X`. -/ +theorem edges_of_support {a b : α} (W : GraphWalk G a b) {X : Set α} {F : Set β} + (hX : ∀ x ∈ W.support, x ∈ X) (h : ∀ e x y, G.IsLink e x y → x ∈ X → y ∈ X + → e ∈ F) : ∀ e ∈ W.edges, e ∈ F := by + induction W with + | nil _ => simp + | cons hl r ih => + intro e he + rcases List.mem_cons.mp he with rfl | he + · exact h _ _ _ hl (hX _ (by simp)) (hX _ (by simp [r.start_mem_support])) + · exact ih (fun x hx => hX x (by simp [hx])) e he + +end Walks + +/-- If a connected part `D` of a simple walk has a vertex on each side of `w`, it holds `w`. -/ +theorem mem_of_sides {P D : Drawing T} {a w b : T} (A : GraphWalk P.toGraph a w) + (R : GraphWalk P.toGraph w b) (hs : (A.append R).IsSimple) (hV : P.V = {x | x ∈ + (A.append R).support}) + (hE : P.E = {e | e ∈ (A.append R).edges}) (hD : D.IsSubdrawing P) + (hc : IsPreconnected D.U) {x y : T} (hx : x ∈ A.support) (hxD : x ∈ D.U) (hy : y ∈ R.support) + (hyD : y ∈ D.U) : w ∈ D.V := by + let X := walkDrawing P A + let Y := walkDrawing P R + have hxX : x ∈ X.U := (mem_walkDrawing_U P A).mpr (.inl hx) + have hyY : y ∈ Y.U := (mem_walkDrawing_U P R).mpr (.inl hy) + have hcov : D.U ⊆ X.U ∪ Y.U := fun z hz => by + have hzP := hD.U_subset hz + rw [P.U_eq] at hzP + rcases hzP with h | h + · rw [hV] at h + rcases (GraphWalk.mem_support_append A R).mp h with h | h + · exact .inl ((mem_walkDrawing_U P A).mpr (.inl h)) + · exact .inr ((mem_walkDrawing_U P R).mpr (.inl h)) + · obtain ⟨e, he, hze⟩ := mem_iUnion₂.mp h + rw [hE] at he + have he' : e ∈ (A.append R).edges := he + rw [GraphWalk.edges_append, List.mem_append] at he' + rcases he' with h | h + · exact .inl ((mem_walkDrawing_U P A).mpr (.inr ⟨e, h, hze⟩)) + · exact .inr ((mem_walkDrawing_U P R).mpr (.inr ⟨e, h, hze⟩)) + obtain ⟨z, hzD, hzX, hzY⟩ := isPreconnected_closed_iff.mp hc X.U Y.U X.isClosed_U Y.isClosed_U + hcov ⟨x, hxD, hxX⟩ ⟨y, hyD, hyY⟩ + have hnd : (A.edges ++ R.edges).Nodup := by + rw [← GraphWalk.edges_append] + exact hs.edges_nodup + have hdE : Disjoint X.E Y.E := by + rw [walkDrawing_E, walkDrawing_E] + exact disjoint_left.mpr fun e h1 h2 => (List.nodup_append.mp hnd).2.2 e h1 e h2 rfl + have hin := U_inter_of_disjoint (walkDrawing_isSubdrawing P A) (walkDrawing_isSubdrawing P R) hdE + have hz : z ∈ X.V ∩ Y.V := by + rw [← hin] + exact ⟨hzX, hzY⟩ + have hzA : z ∈ A.support := by + have := hz.1 + rwa [walkDrawing_V] at this + have hzR : z ∈ R.support := by + have := hz.2 + rwa [walkDrawing_V] at this + have hnd2 : (A.support ++ R.support.tail).Nodup := by + rw [← GraphWalk.support_append] + exact hs + have hzw : z = w := by + rw [R.support_eq_cons] at hzR + rcases List.mem_cons.mp hzR with h | h + · exact h + · exact ((List.nodup_append.mp hnd2).2.2 z hzA z h rfl).elim + subst hzw + by_contra hn + obtain ⟨e, he, hze⟩ := D.exists_edge_of_mem hzD hn + have hwV : z ∈ P.V := A.mem_vertexSet_of_mem_support hzA + exact (hD.2 he).2.1 hze |>.2 hwV + +variable {Γ H C₁ C₂ : Drawing T} {D₁ D₂ E₁ E₂ : Set T} {q : T → T} {ℓ : T → Set T} + +omit [T2Space T] in +theorem IsWheeled.swap (w : IsWheeled Γ H C₁ C₂ D₁ D₂ E₁ E₂ q ℓ) : IsWheeled Γ H C₂ C₁ D₂ D₁ E₂ E₁ + q ℓ where + sub := w.sub + sub₁ := w.sub₂ + sub₂ := w.sub₁ + circ₁ := w.circ₂ + circ₂ := w.circ₁ + disc₁ := w.disc₂ + disc₂ := w.disc₁ + in₁ := w.in₂ + in₂ := w.in₁ + bd₁ := w.bd₂ + bd₂ := w.bd₁ + V := by rw [w.V, union_right_comm] + U := by rw [w.U, union_right_comm Γ.U, union_comm D₂ D₁] + E := fun e he => by + rw [union_comm D₂ D₁] + rcases w.E e he with h | h | h | h + · exact .inl h + · exact .inr (.inr (.inl h)) + · exact .inr (.inl h) + · exact .inr (.inr (.inr h)) + q₁ := w.q₂ + q₂ := w.q₁ + line := by + rw [union_comm D₂ D₁] + exact w.line + cap₁ := w.cap₂ + cap₂ := w.cap₁ + disj := by + rw [union_comm D₂ D₁] + exact w.disj + +theorem IsWheeled.ends (w : IsWheeled Γ H C₁ C₂ D₁ D₂ E₁ E₂ q ℓ) {x : T} (hx : x ∈ Γ.V ∩ + (D₁ ∪ D₂)) : closure (ℓ x \ {x, q x}) = ℓ x ∧ x ∈ ℓ x ∧ q x ∈ ℓ x ∧ x ∈ H.V ∧ q x ∈ C₁.V ∪ C₂.V + ∧ q x ∈ H.V := by + obtain ⟨hl, -, -⟩ := w.line x hx + have hq : q x ∈ C₁.V ∪ C₂.V := by + obtain ⟨hV, h | h⟩ := hx + · exact .inl (w.q₁ x ⟨hV, h⟩) + · exact .inr (w.q₂ x ⟨hV, h⟩) + refine ⟨closure_sdiff_pair hl, hl.left_mem, hl.right_mem, w.sub.1 hx.1, hq, ?_⟩ + rcases hq with h | h + · exact w.sub₁.1 h + · exact w.sub₂.1 h + +/-- An edge between two vertices of `Γ` is an edge of `Γ`, since the circles and the spokes have +ends on the circles. -/ +theorem IsWheeled.mem_E_of_link (w : IsWheeled Γ H C₁ C₂ D₁ D₂ E₁ E₂ q ℓ) (hΓ₁ : Disjoint Γ.V C₁.V) + (hΓ₂ : Disjoint Γ.V C₂.V) {e : Set T} {y z : T} (hl : H.toGraph.IsLink e y z) (hy : y ∈ Γ.V) + (hz : z ∈ Γ.V) : e ∈ Γ.E := by + have hcap := hl.2.2.2 + have hyc : y ∈ closure e ∩ H.V := by rw [hcap]; simp + rcases w.E e hl.1 with h | h | h | ⟨x, hx, rfl⟩ + · exact h + · have : y ∈ closure e ∩ C₁.V := by rw [w.sub₁.closure_inter_V h]; exact hyc + exact absurd this.2 (disjoint_left.mp hΓ₁ hy) + · have : y ∈ closure e ∩ C₂.V := by rw [w.sub₂.closure_inter_V h]; exact hyc + exact absurd this.2 (disjoint_left.mp hΓ₂ hy) + · obtain ⟨h1, -, h3, -, h5, h6⟩ := w.ends hx + have h7 : q x ∈ closure (ℓ x \ {x, q x}) ∩ H.V := ⟨by rw [h1]; exact h3, h6⟩ + rw [hcap] at h7 + have h8 : q x ∈ Γ.V := by + rcases h7 with h | h + · exact h ▸ hy + · exact (mem_singleton_iff.mp h) ▸ hz + rcases h5 with h | h + · exact absurd h (disjoint_left.mp hΓ₁ h8) + · exact absurd h (disjoint_left.mp hΓ₂ h8) + +/-- An edge that leaves the first circle is a spoke, so it goes to a vertex of `Γ` on `D₁`. -/ +theorem IsWheeled.mem_of_link_off (w : IsWheeled Γ H C₁ C₂ D₁ D₂ E₁ E₂ q ℓ) + (hΓ₁ : Disjoint Γ.V C₁.V) (h12 : Disjoint C₁.V C₂.V) {e : Set T} {y z : T} + (hl : H.toGraph.IsLink e y z) (hy : y ∈ C₁.V) (hz : z ∉ C₁.V) : z ∈ Γ.V ∩ D₁ := by + have hcap := hl.2.2.2 + have hyc : y ∈ closure e ∩ H.V := by rw [hcap]; simp + have hzc : z ∈ closure e ∩ H.V := by rw [hcap]; simp + rcases w.E e hl.1 with h | h | h | ⟨x, hx, rfl⟩ + · have : y ∈ closure e ∩ Γ.V := by rw [w.sub.closure_inter_V h]; exact hyc + exact absurd hy (disjoint_left.mp hΓ₁ this.2) + · have : z ∈ closure e ∩ C₁.V := by rw [w.sub₁.closure_inter_V h]; exact hzc + exact absurd this.2 hz + · have : y ∈ closure e ∩ C₂.V := by rw [w.sub₂.closure_inter_V h]; exact hyc + exact absurd this.2 (disjoint_left.mp h12 hy) + · obtain ⟨h1, h2, h3, h4, h5, h6⟩ := w.ends hx + have h7 : x ∈ closure (ℓ x \ {x, q x}) ∩ H.V := ⟨by rw [h1]; exact h2, h4⟩ + have h8 : q x ∈ closure (ℓ x \ {x, q x}) ∩ H.V := ⟨by rw [h1]; exact h3, h6⟩ + rw [hcap] at h7 h8 + have hne := (w.line x hx).2.1 + have hxz : x = z := by + rcases h7 with h | h + · exact absurd hy (h ▸ disjoint_left.mp hΓ₁ hx.1) + · exact h + subst hxz + have hqy : q x = y := by + rcases h8 with h | h + · exact h + · exact absurd (mem_singleton_iff.mp h).symm hne + obtain ⟨hV, h | h⟩ := hx + · exact ⟨hV, h⟩ + · exact absurd (w.q₂ x ⟨hV, h⟩) (hqy ▸ disjoint_left.mp h12 hy) + +/-- **Trimming a path of `H` to a path of `Γ`.** -/ +theorem exists_trimmed_path (w : IsWheeled Γ H C₁ C₂ D₁ D₂ E₁ E₂ q ℓ) (hΓ₁ : Disjoint Γ.V C₁.V) + (hΓ₂ : Disjoint Γ.V C₂.V) (h12 : Disjoint C₁.V C₂.V) {Pl : Drawing T} {a b : T} + (hs : Pl.IsSubdrawing H) + (ha : a ∈ C₁.V) (hb : b ∈ C₂.V) (hP : Pl.IsPathBetween a b) (h1 : IsPreconnected + (Drawing.inf H C₁ Pl).U) (h2 : IsPreconnected (Drawing.inf H C₂ Pl).U) : + ∃ (P : Drawing T) (u v : T), P.IsSubdrawing Γ ∧ P.IsSubdrawing Pl ∧ u ∈ D₁ ∧ v ∈ D₂ + ∧ P.IsPathBetween u v ∧ + ∀ B : Drawing T, B.IsSubdrawing H → Disjoint B.V C₁.V → Disjoint B.V C₂.V → B.V ∩ Pl.V ⊆ P.V + ∧ B.E ∩ Pl.E ⊆ P.E := by + obtain ⟨W, hW, hV, hE⟩ := hP + obtain ⟨c, hc, A, R, hWeq, hR⟩ := exists_last_hit_split W ⟨a, W.start_mem_support, ha⟩ + obtain ⟨d, hd, M, Z, hReq, hM⟩ := GM09.PlanarNests.exists_first_hit_split R ⟨b, + R.end_mem_support, hb⟩ + subst hWeq + subst hReq + obtain ⟨hAs, hRs⟩ := GM09.isSimple_of_append hW + obtain ⟨hMs, hZs⟩ := GM09.isSimple_of_append hRs + have hcd : c ≠ d := fun h => disjoint_left.mp h12 hc (h ▸ hd) + obtain ⟨x, e₁, h₁, M', hMeq⟩ := exists_cons_of_ne M hcd + have hPlH : ∀ {e y z}, Pl.toGraph.IsLink e y z → H.toGraph.IsLink e y z := fun {e y z} hl => + (hs.isLink_iff hl.1).mp hl + -- the first edge of `M` is a spoke + have hcM : c ∉ M'.support := by + have := hMs + rw [hMeq] at this + exact (List.nodup_cons.mp this).1 + have hxC : x ∉ C₁.V := fun h => hcM (by + have hM : x ∈ M.support := by + rw [hMeq] + exact List.mem_cons_of_mem _ M'.start_mem_support + have h3 : x = c := hR x ((GraphWalk.mem_support_append M Z).mpr (.inl hM)) h + exact h3 ▸ M'.start_mem_support) + have hx := w.mem_of_link_off hΓ₁ h12 (hPlH h₁) hc hxC + have hxd : x ≠ d := fun h => disjoint_left.mp hΓ₂ hx.1 (h ▸ hd) + have hlen : 0 < M'.length := by + by_contra hn + exact hxd (GraphWalk.eq_of_length_eq_zero (W := M') (by omega)) + obtain ⟨y, e₂, M₀, h₂', hM'eq⟩ := exists_snoc M' hlen + have hM's : M'.IsSimple := by + have := hMs + rw [hMeq] at this + exact GraphWalk.IsSimple.of_cons this + have hM₀s : M₀.IsSimple := (GM09.isSimple_of_append (hM'eq ▸ hM's)).1 + have hdM₀ : d ∉ M₀.support := by + have := hM's + rw [hM'eq] at this + have h3 : (M₀.support ++ [d]).Nodup := by + have h4 := this + unfold GraphWalk.IsSimple at h4 + rw [GraphWalk.support_append] at h4 + exact h4 + exact fun h => (List.nodup_append.mp h3).2.2 d h d (by simp) rfl + have hM₀M : ∀ z ∈ M₀.support, z ∈ M.support := fun z hz => by + rw [hMeq] + refine List.mem_cons_of_mem _ ?_ + rw [hM'eq] + exact (GraphWalk.mem_support_append _ _).mpr (.inl hz) + have hyC : y ∉ C₂.V := fun h => hdM₀ (by + have h3 := hM y (hM₀M y M₀.end_mem_support) h + exact h3 ▸ M₀.end_mem_support) + have hy := w.swap.mem_of_link_off hΓ₂ h12.symm (hPlH h₂').symm hd hyC + have hdCc : ∀ {z}, z ∈ M₀.support → z ≠ c := fun {z} hz h => hcM (by + rw [hM'eq] + exact (GraphWalk.mem_support_append _ _).mpr (.inl (h ▸ hz))) + have hM₀Γ : ∀ z ∈ M₀.support, z ∈ Γ.V := fun z hz => by + have hzW : z ∈ (A.append (M.append Z)).support := (GraphWalk.mem_support_append _ _).mpr (.inr + ((GraphWalk.mem_support_append _ _).mpr (.inl (hM₀M z hz)))) + have hzH : z ∈ H.V := hs.1 (hV ▸ hzW) + rw [w.V] at hzH + rcases hzH with (h | h) | h + · exact h + · exact absurd (hR z ((GraphWalk.mem_support_append M Z).mpr (.inl (hM₀M z hz))) h) (hdCc hz) + · have := hM z (hM₀M z hz) h + exact absurd (this ▸ hz) hdM₀ + have hM₀E : ∀ e ∈ M₀.edges, e ∈ Γ.E := edges_of_support M₀ hM₀Γ fun e y z hl hy hz + => w.mem_E_of_link hΓ₁ hΓ₂ (hPlH hl) hy hz + have hMsub : ∀ z ∈ M.support, z = c ∨ z ∈ M₀.support ∨ z = d := fun z hz => by + rw [hMeq] at hz + rcases List.mem_cons.mp hz with h | h + · exact .inl h + · rw [hM'eq] at h + rcases (GraphWalk.mem_support_append _ _).mp h with h | h + · exact .inr (.inl h) + · rcases List.mem_cons.mp h with h | h + · exact .inr (.inl (h ▸ M₀.end_mem_support)) + · exact .inr (.inr (by simpa using h)) + have hMed : ∀ e ∈ M.edges, e = e₁ ∨ e ∈ M₀.edges ∨ e = e₂ := fun e he => by + rw [hMeq] at he + rcases List.mem_cons.mp he with h | h + · exact .inl h + · rw [hM'eq, GraphWalk.edges_append] at h + rcases List.mem_append.mp h with h | h + · exact .inr (.inl h) + · exact .inr (.inr (by simpa using h)) + have haPl : a ∈ Pl.V := by rw [hV]; exact GraphWalk.start_mem_support _ + have hbPl : b ∈ Pl.V := by rw [hV]; exact GraphWalk.end_mem_support _ + have hcPl : c ∈ Pl.V := by + rw [hV] + exact (GraphWalk.mem_support_append _ _).mpr (.inr ((GraphWalk.mem_support_append _ _).mpr + (.inl M.start_mem_support))) + have hdPl : d ∈ Pl.V := by + rw [hV] + exact (GraphWalk.mem_support_append _ _).mpr (.inr ((GraphWalk.mem_support_append _ _).mpr + (.inl M.end_mem_support))) + have hDA := Drawing.inf_isSubdrawing_right w.sub₁ hs + have hDZ := Drawing.inf_isSubdrawing_right w.sub₂ hs + have hmemV : ∀ {C : Drawing T}, C.IsSubdrawing H → ∀ {z}, z ∈ C.V → z ∈ Pl.V → z ∈ + (Drawing.inf H C Pl).U := fun {C} hC {z} h3 h4 => + (Drawing.inf H C Pl).V_subset_U (by rw [Drawing.inf_V hC hs]; exact ⟨h3, h4⟩) + have hAin : ∀ z ∈ A.support, z ∈ C₁.V := fun z hz => by + obtain ⟨A₁, A₂, rfl⟩ := GraphWalk.exists_append_of_mem A hz + have hass := walk_append_assoc A₁ A₂ (M.append Z) + rw [hass] at hV hE hW + have := mem_of_sides A₁ (A₂.append (M.append Z)) hW hV hE hDA h1 (x := a) (y + := c) A₁.start_mem_support (hmemV w.sub₁ ha haPl) + ((GraphWalk.mem_support_append _ _).mpr (.inr ((GraphWalk.mem_support_append _ _).mpr + (.inl M.start_mem_support)))) (hmemV w.sub₁ hc hcPl) + rw [Drawing.inf_V w.sub₁ hs] at this + exact this.1 + have hZin : ∀ z ∈ Z.support, z ∈ C₂.V := fun z hz => by + obtain ⟨Z₁, Z₂, rfl⟩ := GraphWalk.exists_append_of_mem Z hz + rw [← walk_append_assoc M Z₁ Z₂, ← walk_append_assoc A (M.append Z₁) Z₂] at hV hE hW + have := mem_of_sides (A.append (M.append Z₁)) Z₂ hW hV hE hDZ h2 (x := d) (y := b) + ((GraphWalk.mem_support_append _ _).mpr (.inr ((GraphWalk.mem_support_append _ _).mpr + (.inl M.end_mem_support)))) (hmemV w.sub₂ hd hdPl) Z₂.end_mem_support (hmemV w.sub₂ hb hbPl) + rw [Drawing.inf_V w.sub₂ hs] at this + exact this.1 + refine ⟨walkDrawing Pl M₀, x, y, ⟨?_, ?_⟩, walkDrawing_isSubdrawing Pl M₀, hx.2, hy.2, + walkDrawing_isPathBetween Pl hM₀s, fun B hB hB₁ hB₂ => ⟨?_, ?_⟩⟩ + · rw [walkDrawing_V] + exact hM₀Γ + · rw [walkDrawing_E] + exact hM₀E + · rintro z ⟨hzB, hzP⟩ + rw [walkDrawing_V] + rw [hV] at hzP + rcases (GraphWalk.mem_support_append _ _).mp hzP with h | h + · exact absurd (hAin z h) (disjoint_left.mp hB₁ hzB) + · rcases (GraphWalk.mem_support_append _ _).mp h with h | h + · rcases hMsub z h with rfl | h | rfl + · exact absurd hc (disjoint_left.mp hB₁ hzB) + · exact h + · exact absurd hd (disjoint_left.mp hB₂ hzB) + · exact absurd (hZin z h) (disjoint_left.mp hB₂ hzB) + · rintro e ⟨heB, heP⟩ + have hend : ∀ z, z ∈ closure e → z ∈ H.V → z ∈ B.V := fun z h3 h4 => by + have : z ∈ closure e ∩ B.V := by rw [hB.closure_inter_V heB]; exact ⟨h3, h4⟩ + exact this.2 + obtain ⟨l, m, hlm⟩ := (Pl.toGraph.edge_mem_iff_exists_isLink e).mp heP + have hlc : l ∈ closure e := by + have : l ∈ closure e ∩ Pl.V := by rw [hlm.2.2.2]; simp + exact this.1 + have hlH : l ∈ H.V := hs.1 hlm.2.1 + rw [walkDrawing_E] + have heW : e ∈ (A.append (M.append Z)).edges := by rw [hE] at heP; exact heP + rw [GraphWalk.edges_append, GraphWalk.edges_append, List.mem_append, List.mem_append] at heW + rcases heW with h | h | h + · have := hAin l (GraphWalk.left_mem_support_of_mem_edges A h hlm) + exact absurd this (disjoint_left.mp hB₁ (hend l hlc hlH)) + · rcases hMed e h with rfl | h | rfl + · have h3 : c ∈ closure e ∩ Pl.V := by rw [h₁.2.2.2]; simp + exact absurd hc (disjoint_left.mp hB₁ (hend c h3.1 (hs.1 h3.2))) + · exact h + · have h3 : d ∈ closure e ∩ Pl.V := by rw [h₂'.2.2.2]; simp + exact absurd hd (disjoint_left.mp hB₂ (hend d h3.1 (hs.1 h3.2))) + · have := hZin l (GraphWalk.left_mem_support_of_mem_edges Z h hlm) + exact absurd this (disjoint_left.mp hB₂ (hend l hlc hlH)) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/CylinderWheel.lean b/LeanPool/GraphMinor/GM07/CylinderWheel.lean new file mode 100644 index 0000000000..43e77310ed --- /dev/null +++ b/LeanPool/GraphMinor/GM07/CylinderWheel.lean @@ -0,0 +1,359 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.DiscPlace +public import LeanPool.GraphMinor.GM07.Slit +public import LeanPool.GraphMinor.GM11.OArcCircuit +public import LeanPool.GraphMinor.GM11.RadialChord +public import LeanPool.GraphMinor.GM11.RadialBasics + +/-! +# Wheels in the caps + +The uncrossing of Graph Minors III, (4.1), needs an inner and an outer circuit that the nest does +not touch, while (5.8) has only the cuffs, which the nest may touch. So inside each +cap we draw a smaller circle, with one spoke from each vertex on the cuff to the circle +(`exists_wheel`). This changes nothing in the cylinder. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +local notation "I" => unitInterval + +variable {T : Type*} [TopologicalSpace T] [T2Space T] + +/-- A smaller circle in a disc, with disjoint spokes from given points of the boundary. -/ +theorem exists_wheel {D : Set T} (hD : IsClosedDisc D) {A : Set T} (hAD : A ⊆ discBd D) : + ∃ (E : Set T) (q : T → T) (ℓ : T → Set T), IsClosedDisc E ∧ E ⊆ discInt D ∧ + (∀ x ∈ A, q x ∈ discBd E ∧ IsLineWithEnds (ℓ x) x (q x) ∧ x ≠ q x ∧ ℓ x ⊆ D ∧ ℓ x ∩ discBd D + = {x} ∧ ℓ x ∩ E = {q x}) ∧ + ∀ x ∈ A, ∀ y ∈ A, x ≠ y → Disjoint (ℓ x) (ℓ y) := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hunit : ∀ x ∈ A, ‖h x‖ = 1 := fun x hx => by + have : h x ∈ h '' discBd D := ⟨x, hAD hx, rfl⟩ + rw [c.bd] at this + simpa using this + have hxD : ∀ x ∈ A, x ∈ D := fun x hx => Surface.discBd_subset _ (hAD hx) + have hgh : ∀ x ∈ A, g (h x) = x := fun x hx => c.gh (hxD x hx) + let ray : T → I → ℂ := fun x t => ((1 - (t : ℝ) / 2 : ℝ) : ℂ) * h x + have hnorm : ∀ x ∈ A, ∀ t : I, ‖ray x t‖ = 1 - (t : ℝ) / 2 := fun x hx t => by + have h1 : (0 : ℝ) ≤ 1 - (t : ℝ) / 2 := by linarith [t.2.2] + simp only [ray, norm_mul, hunit x hx, mul_one, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg h1] + have hball : ∀ x ∈ A, ∀ t, ray x t ∈ closedBall (0 : ℂ) 1 := fun x hx t => by + simp only [mem_closedBall, dist_zero_right, hnorm x hx] + linarith [t.2.1] + have hcont : ∀ x, Continuous (ray x) := fun x => by + simp only [ray] + fun_prop + have hinj : ∀ x ∈ A, ∀ y ∈ A, ∀ t t', g (ray x t) = g (ray y t') → x = y ∧ t = t' + := fun x hx y hy t t' he => by + have h1 := c.injOn (hball x hx t) (hball y hy t') he + have h2 := congrArg norm h1 + rw [hnorm x hx, hnorm y hy] at h2 + have htt : t = t' := Subtype.ext (by linarith) + subst htt + have h3 : ((1 - (t : ℝ) / 2 : ℝ) : ℂ) ≠ 0 := by + have : (1 - (t : ℝ) / 2 : ℝ) ≠ 0 := by linarith [t.2.2] + exact_mod_cast this + have h4 : h x = h y := mul_left_cancel₀ h3 h1 + refine ⟨?_, rfl⟩ + rw [← hgh x hx, ← hgh y hy, h4] + let arc : T → I → T := fun x t => g (ray x t) + have harc : ∀ x ∈ A, IsArcMap (arc x) := fun x hx => + ⟨c.gc.comp_continuous (hcont x) (hball x hx), fun t t' he => (hinj x hx x hx t t' he).2⟩ + have harc0 : ∀ x ∈ A, arc x 0 = x := fun x hx => by + simp only [arc, ray, Set.Icc.coe_zero, zero_div, sub_zero, Complex.ofReal_one, one_mul] + exact hgh x hx + have hs : closedBall (0 : ℂ) (1 / 2) ⊆ closedBall 0 1 := closedBall_subset_closedBall + (by norm_num) + obtain ⟨hb1, hb2⟩ := closedBall_disc (s := 1 / 2) (by norm_num) + obtain ⟨hE, hbE⟩ := c.disc_g hs hb1 + rw [hb2] at hbE + refine ⟨g '' closedBall 0 (1 / 2), fun x => arc x 1, fun x => range (arc x), hE, ?_, + fun x hx => ⟨?_, ?_, ?_, ?_, ?_, ?_⟩, fun x hx y hy hne => ?_⟩ + · rw [c.discInt_eq] + exact image_mono fun z hz => by + simp only [mem_closedBall, dist_zero_right, mem_ball] at hz ⊢ + linarith + · rw [hbE] + refine ⟨ray x 1, ?_, rfl⟩ + simp only [mem_sphere, dist_zero_right, hnorm x hx, Set.Icc.coe_one] + norm_num + · have := isLineWithEnds_range_of_arc (harc x hx) + rwa [harc0 x hx] at this + · intro he + exact zero_ne_one ((harc x hx).2 ((harc0 x hx).trans he)) + · rintro _ ⟨t, rfl⟩ + exact c.gm (hball x hx t) + · ext z + constructor + · rintro ⟨⟨t, rfl⟩, hz⟩ + rw [← c.g_sphere] at hz + obtain ⟨w, hw, he⟩ := hz + have h1 : w = ray x t := c.injOn (sphere_subset_closedBall hw) (hball x hx t) he + have h2 : ‖ray x t‖ = 1 := by + rw [← h1] + simpa using hw + rw [hnorm x hx] at h2 + have h3 : t = 0 := Subtype.ext (by + have : (t : ℝ) = 0 := by linarith + simpa using this) + rw [h3, mem_singleton_iff, harc0 x hx] + · rintro rfl + exact ⟨⟨0, harc0 _ hx⟩, hAD hx⟩ + · ext z + constructor + · rintro ⟨⟨t, rfl⟩, w, hw, he⟩ + have h1 : w = ray x t := c.injOn (hs hw) (hball x hx t) he + have h2 : ‖ray x t‖ ≤ 1 / 2 := by + rw [← h1] + simpa using hw + rw [hnorm x hx] at h2 + have h3 : t = 1 := Subtype.ext (by + have : (1 : ℝ) ≤ (t : ℝ) := by linarith + have h4 : (t : ℝ) ≤ 1 := t.2.2 + simpa using le_antisymm h4 this) + rw [h3] + rfl + · rintro rfl + refine ⟨⟨1, rfl⟩, ray x 1, ?_, rfl⟩ + simp only [mem_closedBall, dist_zero_right, hnorm x hx, Set.Icc.coe_one] + norm_num + · refine disjoint_left.mpr ?_ + rintro _ ⟨t, rfl⟩ ⟨t', he⟩ + exact hne (hinj y hy x hx t' t he).1.symm + +/-- Add disjoint lines between vertices to a drawing. -/ +theorem exists_add_lines (Γ : Drawing T) (s : Finset T) (ℓ : T → Set T) (a b : T → T) + (hl : ∀ x ∈ s, IsLineWithEnds (ℓ x) (a x) (b x) ∧ a x ≠ b x ∧ a x ∈ Γ.V ∧ b x ∈ Γ.V + ∧ ℓ x ∩ Γ.U ⊆ {a x, b x}) + (hd : ∀ x ∈ s, ∀ y ∈ s, x ≠ y → Disjoint (ℓ x) (ℓ y)) : + ∃ H : Drawing T, H.U = Γ.U ∪ ⋃ x ∈ s, ℓ x ∧ H.V = Γ.V ∧ H.E = Γ.E ∪ (fun x + => ℓ x \ {a x, b x}) '' s := by + classical + induction s using Finset.induction_on with + | empty => exact ⟨Γ, by simp, rfl, by simp⟩ + | insert x s hx ih => + obtain ⟨H, h1, h2, h3⟩ := ih (fun y hy => hl y (Finset.mem_insert_of_mem hy)) + (fun y hy z hz => hd y (Finset.mem_insert_of_mem hy) z (Finset.mem_insert_of_mem hz)) + obtain ⟨hL, hne, ha, hb, hcap⟩ := hl x (Finset.mem_insert_self x s) + have hsub : H.U ∩ (lineDrawing hL hne).U ⊆ H.V ∩ (lineDrawing hL hne).V := by + rintro z ⟨hz, hzL⟩ + change z ∈ ℓ x at hzL + rw [h1] at hz + rcases hz with hz | hz + · have h4 := hcap ⟨hzL, hz⟩ + refine ⟨?_, h4⟩ + rw [h2] + rcases h4 with rfl | rfl + · exact ha + · exact hb + · obtain ⟨y, hy, hzy⟩ := mem_iUnion₂.mp hz + have hxy : x ≠ y := fun h => hx (h ▸ hy) + exact absurd hzy (disjoint_left.mp (hd x (Finset.mem_insert_self x s) y + (Finset.mem_insert_of_mem hy) hxy) hzL) + refine ⟨H.glue (lineDrawing hL hne) hsub, ?_, ?_, ?_⟩ + · change H.U ∪ ℓ x = _ + rw [h1, Finset.set_biUnion_insert, union_assoc, union_comm (⋃ y ∈ s, ℓ y)] + · change H.V ∪ {a x, b x} = _ + rw [h2] + exact union_eq_left.mpr (insert_subset ha (singleton_subset_iff.mpr hb)) + · rw [Drawing.glue_E, lineDrawing_E, h3, Finset.coe_insert, image_insert_eq, union_assoc, + union_singleton] + +/-- A drawing with an `O`-arc as point set and at least one vertex is a circuit. -/ +theorem isCircuit_of_isOArc_U [ConnectedSpace T] {C : Drawing T} (hC : IsOArc C.U) : C.IsCircuit + := by + obtain ⟨C', h1, h2, h3⟩ := exists_circuit_of_oArc hC (Subset.refl C.U) + have hV : C'.V = C.V := by + refine subset_antisymm h2.1 fun x hx => ?_ + by_contra hn + obtain ⟨e, he, hxe⟩ := C'.exists_edge_of_mem (h3.symm ▸ C.V_subset_U hx) hn + exact (h2.2 he).2.1 hxe |>.2 hx + have : C' = C := by + cases C + cases C' + simp only at h3 hV + subst h3 hV + rfl + exact this ▸ h1 + +/-- `H` is `Γ` with a wheel added in each of the discs `D₁` and `D₂`. The circle `Cᵢ` bounds the +disc `Eᵢ`, and `ℓ x` is the spoke from a vertex `x` of `Γ` on `Dᵢ` to `q x` on the circle. -/ +structure IsWheeled (Γ H C₁ C₂ : Drawing T) (D₁ D₂ E₁ E₂ : Set T) (q : T → T) (ℓ : T + → Set T) : Prop where + sub : Γ.IsSubdrawing H + sub₁ : C₁.IsSubdrawing H + sub₂ : C₂.IsSubdrawing H + circ₁ : C₁.IsCircuit + circ₂ : C₂.IsCircuit + disc₁ : IsClosedDisc E₁ + disc₂ : IsClosedDisc E₂ + in₁ : E₁ ⊆ discInt D₁ + in₂ : E₂ ⊆ discInt D₂ + bd₁ : discBd E₁ = C₁.U + bd₂ : discBd E₂ = C₂.U + V : H.V = Γ.V ∪ C₁.V ∪ C₂.V + U : H.U = Γ.U ∪ C₁.U ∪ C₂.U ∪ ⋃ x ∈ Γ.V ∩ (D₁ ∪ D₂), ℓ x + E : ∀ e ∈ H.E, e ∈ Γ.E ∨ e ∈ C₁.E ∨ e ∈ C₂.E ∨ ∃ x ∈ Γ.V ∩ (D₁ ∪ D₂), e = ℓ x \ {x, q x} + q₁ : ∀ x ∈ Γ.V ∩ D₁, q x ∈ C₁.V + q₂ : ∀ x ∈ Γ.V ∩ D₂, q x ∈ C₂.V + line : ∀ x ∈ Γ.V ∩ (D₁ ∪ D₂), IsLineWithEnds (ℓ x) x (q x) ∧ x ≠ q x ∧ ℓ x \ {x, q x} ∈ H.E + cap₁ : ∀ x ∈ Γ.V ∩ D₁, ℓ x ⊆ D₁ ∧ ℓ x ∩ discBd D₁ = {x} ∧ ℓ x ∩ E₁ = {q x} + cap₂ : ∀ x ∈ Γ.V ∩ D₂, ℓ x ⊆ D₂ ∧ ℓ x ∩ discBd D₂ = {x} ∧ ℓ x ∩ E₂ = {q x} + disj : ∀ x ∈ Γ.V ∩ (D₁ ∪ D₂), ∀ y ∈ Γ.V ∩ (D₁ ∪ D₂), x ≠ y → Disjoint (ℓ x) (ℓ y) + +/-- Wheels exist. -/ +theorem exists_wheeled [ConnectedSpace T] (Γ : Drawing T) {D₁ D₂ : Set T} (h₁ : IsClosedDisc D₁) + (h₂ : IsClosedDisc D₂) (hd : Disjoint D₁ D₂) + (hi₁ : Disjoint Γ.U (discInt D₁)) (hi₂ : Disjoint Γ.U (discInt D₂)) : + ∃ (H C₁ C₂ : Drawing T) (E₁ E₂ : Set T) (q : T → T) (ℓ : T → Set T), IsWheeled Γ H C₁ C₂ D₁ D₂ + E₁ E₂ q ℓ := by + classical + have hbdA : ∀ {D : Set T}, Disjoint Γ.U (discInt D) → Γ.V ∩ D ⊆ discBd D := fun {D} hi x hx => by + by_contra hn + exact disjoint_left.mp hi (Γ.V_subset_U hx.1) ⟨hx.2, hn⟩ + obtain ⟨E₁, q₁, ℓ₁, hE₁, hE₁D, hw₁, hd₁⟩ := exists_wheel h₁ (hbdA hi₁) + obtain ⟨E₂, q₂, ℓ₂, hE₂, hE₂D, hw₂, hd₂⟩ := exists_wheel h₂ (hbdA hi₂) + have hcircle : ∀ {E : Set T} {q : T → T} {A : Set T}, IsClosedDisc E → A.Finite → + (∀ x ∈ A, q x ∈ discBd E) → ∃ C : Drawing T, C.U = discBd E ∧ q '' A ⊆ C.V + := fun {E q A} hE hA hq => by + obtain ⟨z, hz⟩ := isOArc_nonempty hE.isOArc_discBd + obtain ⟨C, c1, c2⟩ := exists_drawing_on_oArc hE.isOArc_discBd ((hA.image q).union + (finite_singleton z)) ⟨z, .inr rfl⟩ + (union_subset (by rintro _ ⟨x, hx, rfl⟩; exact hq x hx) (singleton_subset_iff.mpr hz)) + exact ⟨C, c1, c2 ▸ subset_union_left⟩ + have hA₁ : (Γ.V ∩ D₁).Finite := Γ.finite_V.subset inter_subset_left + have hA₂ : (Γ.V ∩ D₂).Finite := Γ.finite_V.subset inter_subset_left + obtain ⟨C₁, c1U, c1q⟩ := hcircle hE₁ hA₁ fun x hx => (hw₁ x hx).1 + obtain ⟨C₂, c2U, c2q⟩ := hcircle hE₂ hA₂ fun x hx => (hw₂ x hx).1 + have hc₁ : C₁.IsCircuit := isCircuit_of_isOArc_U (c1U.symm ▸ hE₁.isOArc_discBd) + have hc₂ : C₂.IsCircuit := isCircuit_of_isOArc_U (c2U.symm ▸ hE₂.isOArc_discBd) + have hE₁₁ : E₁ ⊆ D₁ := hE₁D.trans sdiff_subset + have hE₂₂ : E₂ ⊆ D₂ := hE₂D.trans sdiff_subset + have hΓE₁ : ∀ z ∈ Γ.U, z ∉ E₁ := fun z hz h => disjoint_left.mp hi₁ hz (hE₁D h) + have hΓE₂ : ∀ z ∈ Γ.U, z ∉ E₂ := fun z hz h => disjoint_left.mp hi₂ hz (hE₂D h) + have hC₁E : C₁.U ⊆ E₁ := c1U ▸ Surface.discBd_subset _ + have hC₂E : C₂.U ⊆ E₂ := c2U ▸ Surface.discBd_subset _ + have hEE : ∀ z, z ∈ E₁ → z ∈ E₂ → False := fun z h3 h4 => disjoint_left.mp hd (hE₁₁ h3) (hE₂₂ h4) + have g1 : Γ.U ∩ C₁.U ⊆ Γ.V ∩ C₁.V := fun z hz => absurd (hC₁E hz.2) (hΓE₁ z hz.1) + let G₁ := Γ.glue C₁ g1 + have g2 : G₁.U ∩ C₂.U ⊆ G₁.V ∩ C₂.V := by + rintro z ⟨h3 | h3, h4⟩ + · exact absurd (hC₂E h4) (hΓE₂ z h3) + · exact (hEE z (hC₁E h3) (hC₂E h4)).elim + let G := G₁.glue C₂ g2 + let q : T → T := fun x => if x ∈ D₁ then q₁ x else q₂ x + let ℓ : T → Set T := fun x => if x ∈ D₁ then ℓ₁ x else ℓ₂ x + have hq1 : ∀ {x}, x ∈ D₁ → q x = q₁ x ∧ ℓ x = ℓ₁ x := fun {x} hx => by simp [q, ℓ, hx] + have hq2 : ∀ {x}, x ∈ D₂ → q x = q₂ x ∧ ℓ x = ℓ₂ x := fun {x} hx => by + have : x ∉ D₁ := fun h => disjoint_left.mp hd h hx + simp [q, ℓ, this] + have hGU : ∀ {z}, z ∈ G.U → z ∈ Γ.U ∨ z ∈ C₁.U ∨ z ∈ C₂.U := fun {z} hz => by + rcases hz with (h | h) | h + · exact .inl h + · exact .inr (.inl h) + · exact .inr (.inr h) + have hcap1 : ∀ x ∈ Γ.V ∩ D₁, ℓ₁ x ∩ G.U ⊆ {x, q₁ x} := fun x hx z ⟨hz, hzG⟩ => by + obtain ⟨-, -, -, h3, h4, h5⟩ := hw₁ x hx + rcases hGU hzG with h | h | h + · have hb : z ∈ discBd D₁ := by + by_contra hn + exact disjoint_left.mp hi₁ h ⟨h3 hz, hn⟩ + have : z ∈ ℓ₁ x ∩ discBd D₁ := ⟨hz, hb⟩ + rw [h4] at this + exact .inl this + · have : z ∈ ℓ₁ x ∩ E₁ := ⟨hz, hC₁E h⟩ + rw [h5] at this + exact .inr this + · exact (disjoint_left.mp hd (h3 hz) (hE₂₂ (hC₂E h))).elim + have hcap2 : ∀ x ∈ Γ.V ∩ D₂, ℓ₂ x ∩ G.U ⊆ {x, q₂ x} := fun x hx z ⟨hz, hzG⟩ => by + obtain ⟨-, -, -, h3, h4, h5⟩ := hw₂ x hx + rcases hGU hzG with h | h | h + · have hb : z ∈ discBd D₂ := by + by_contra hn + exact disjoint_left.mp hi₂ h ⟨h3 hz, hn⟩ + have : z ∈ ℓ₂ x ∩ discBd D₂ := ⟨hz, hb⟩ + rw [h4] at this + exact .inl this + · exact (disjoint_left.mp hd (hE₁₁ (hC₁E h)) (h3 hz)).elim + · have : z ∈ ℓ₂ x ∩ E₂ := ⟨hz, hC₂E h⟩ + rw [h5] at this + exact .inr this + have hfin : (Γ.V ∩ (D₁ ∪ D₂)).Finite := Γ.finite_V.subset inter_subset_left + have hdisj : ∀ x ∈ Γ.V ∩ (D₁ ∪ D₂), ∀ y ∈ Γ.V ∩ (D₁ ∪ D₂), x ≠ y → Disjoint (ℓ x) (ℓ y) := by + rintro x ⟨hxV, hx | hx⟩ y ⟨hyV, hy | hy⟩ hne + · rw [(hq1 hx).2, (hq1 hy).2] + exact hd₁ x ⟨hxV, hx⟩ y ⟨hyV, hy⟩ hne + · rw [(hq1 hx).2, (hq2 hy).2] + exact hd.mono (hw₁ x ⟨hxV, hx⟩).2.2.2.1 (hw₂ y ⟨hyV, hy⟩).2.2.2.1 + · rw [(hq2 hx).2, (hq1 hy).2] + exact hd.symm.mono (hw₂ x ⟨hxV, hx⟩).2.2.2.1 (hw₁ y ⟨hyV, hy⟩).2.2.2.1 + · rw [(hq2 hx).2, (hq2 hy).2] + exact hd₂ x ⟨hxV, hx⟩ y ⟨hyV, hy⟩ hne + have hq₁V : ∀ x ∈ Γ.V ∩ D₁, q x ∈ C₁.V := fun x hx => by + rw [(hq1 hx.2).1] + exact c1q ⟨x, hx, rfl⟩ + have hq₂V : ∀ x ∈ Γ.V ∩ D₂, q x ∈ C₂.V := fun x hx => by + rw [(hq2 hx.2).1] + exact c2q ⟨x, hx, rfl⟩ + have hl : ∀ x ∈ hfin.toFinset, IsLineWithEnds (ℓ x) (id x) (q x) ∧ id x ≠ q x ∧ id x ∈ G.V + ∧ q x ∈ G.V ∧ ℓ x ∩ G.U ⊆ {id x, q x} := fun x hx => by + rw [Finite.mem_toFinset] at hx + obtain ⟨hxV, hx1 | hx2⟩ := hx + · obtain ⟨-, h3, h4, -⟩ := hw₁ x ⟨hxV, hx1⟩ + have h5 := hq₁V x ⟨hxV, hx1⟩ + rw [(hq1 hx1).1, (hq1 hx1).2] at * + exact ⟨h3, h4, .inl (.inl hxV), .inl (.inr h5), hcap1 x ⟨hxV, hx1⟩⟩ + · obtain ⟨-, h3, h4, -⟩ := hw₂ x ⟨hxV, hx2⟩ + have h5 := hq₂V x ⟨hxV, hx2⟩ + rw [(hq2 hx2).1, (hq2 hx2).2] at * + exact ⟨h3, h4, .inl (.inl hxV), .inr h5, hcap2 x ⟨hxV, hx2⟩⟩ + obtain ⟨H, hHU, hHV, hHE⟩ := exists_add_lines G hfin.toFinset ℓ id q hl (fun x hx y hy hne + => hdisj x (hfin.mem_toFinset.mp hx) y (hfin.mem_toFinset.mp hy) hne) + have hGE : G.E = Γ.E ∪ C₁.E ∪ C₂.E := by + rw [Drawing.glue_E, Drawing.glue_E] + have hEsub : G.E ⊆ H.E := hHE ▸ subset_union_left + refine ⟨H, C₁, C₂, E₁, E₂, q, ℓ, ⟨⟨?_, ?_⟩, ⟨?_, ?_⟩, ⟨?_, ?_⟩, hc₁, hc₂, hE₁, hE₂, hE₁D, hE₂D, + c1U.symm, c2U.symm, hHV, ?_, ?_, hq₁V, hq₂V, ?_, ?_, ?_, hdisj⟩⟩ + · exact fun x hx => hHV ▸ .inl (.inl hx) + · exact fun e he => hEsub (hGE ▸ .inl (.inl he)) + · exact fun x hx => hHV ▸ .inl (.inr hx) + · exact fun e he => hEsub (hGE ▸ .inl (.inr he)) + · exact fun x hx => hHV ▸ .inr hx + · exact fun e he => hEsub (hGE ▸ .inr he) + · rw [hHU] + simp only [Finite.mem_toFinset] + rfl + · intro e he + rw [hHE, hGE] at he + rcases he with ((h | h) | h) | ⟨x, hx, rfl⟩ + · exact .inl h + · exact .inr (.inl h) + · exact .inr (.inr (.inl h)) + · exact .inr (.inr (.inr ⟨x, hfin.mem_toFinset.mp hx, rfl⟩)) + · intro x hx + obtain ⟨h3, h4, -⟩ := hl x (hfin.mem_toFinset.mpr hx) + refine ⟨h3, h4, ?_⟩ + rw [hHE] + exact .inr ⟨x, hfin.mem_toFinset.mpr hx, rfl⟩ + · intro x hx + rw [(hq1 hx.2).1, (hq1 hx.2).2] + exact (hw₁ x hx).2.2.2 + · intro x hx + rw [(hq2 hx.2).1, (hq2 hx.2).2] + exact (hw₂ x hx).2.2.2 + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Defs.lean b/LeanPool/GraphMinor/GM07/Defs.lean new file mode 100644 index 0000000000..97c60c1c5a --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Defs.lean @@ -0,0 +1,974 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.TopologyStatements +public import LeanPool.GraphMinor.GM11.Defs +public import LeanPool.GraphMinor.GM14.Defs + +/-! +# Definitions of Graph Minors VII + +This file formalizes the definitions of N. Robertson and P. D. Seymour, +*Graph Minors. VII. Disjoint paths on a surface*, J. Combin. Theory Ser. B 45 (1988) 212–254. + +## Match with `Surface.Drawing` + +In Section 2 (page 214), Graph Minors VII defines a "graph" in a surface `Σ` as a pair +`G = (U(G), V(G))` where `U(G) ⊆ Σ`, `V(G) ⊆ U(G)` is finite, `U(G) - V(G)` has only finitely +many components (called *edges*), and for each edge `e`, `(e, closure e)` is homeomorphic either to +`((0, 1), [0, 1])` or to `(S¹ - {x}, S¹)`. + +This matches `GraphMinor.Surface.Drawing S` from `GraphMinor/Surface/Defs.lean`: +- A `Drawing S` is given by `(U, V)` with `U` closed, `V ⊆ U` finite, and `E = componentsIn (U \ V)` + finite. +- Each edge `e ∈ G.E` has `tilde e = closure e \ e ⊆ V` of size `1` (a loop, where `closure e` is an + `O`-arc, so `(e, closure e) ≃ (S¹ - {x}, S¹)`) or size `2` (a non-loop, where `closure e` is a + line with `lineEnds (closure e) = tilde e`, so `(e, closure e) ≃ ((0, 1), [0, 1])`). +- Because `V` is finite and each of the finitely many edges has compact closure `e ∪ tilde e ⊆ U`, + `U = V ∪ ⋃ e ∈ E, closure e` is automatically closed in `Σ`. +- A subset `X ⊆ Σ` is `G`-normal in VII's sense (`X ∩ e = ∅` for each edge `e` of `G`) if and only + if `X ∩ G.U ⊆ G.V`, which is `G.IsNormal X` (`isNormal_iff_disjoint_edges`). +- A graph `G` in `Σ` is proper in VII's sense (`bd(Σ)` is `G`-normal) if and only if + `bd S ∩ G.U ⊆ G.V`, which is `G.IsProper` (`isProper_iff_isNormal_bd`). +- A region of `G` is a component of `Σ - U(G)`, which is `r ∈ G.R`. + +## Sections covered + +- **Section 2 (Surfaces and Nets, pages 213–218):** `deleteBd` (`J - bd(Σ)`), `IsBoundaryIArc`, + `IsIsolatedVertex`, `HasNoIsolatedVertices`, `pullbackDrawing` + (`φ⁻¹(G)`), `imageDrawing` (`φ(H)`), `Net`, `Net.seamU`, `Net.seamV`, `Net.IsSeamGraphFor`, + `IsSeamGraph`, `Net.IsNormalFor`, `Net.IsMinimalFor`, and edge types (iii) and (iv) of `J'`. +- **Section 3 (Matchings and Forests, pages 218–221):** `AreSimilarIArcs`, `AreParallelIArcs`, + `IsMatching`, `IsXMatching`, `AreCongruentMatchings`, `IsSurfaceForest`, `IsYForest`, + `Drawing.mapHomeo`, `ForestsHomoplastic`, `MatchingSurroundsForest`, `IsW36Bound`, `wSurface` + (`w(Σ, k, n)`). +- **Section 4 (The Main Result, First Version, pages 221–230):** `IsGFeasible`, `IsCappedCuff` + (`Σ + Ĉ`), `IsNullHomotopicOArcInCappedCuff`, `IsPlanarInCappedCuff`, `wMaxModel`, `muModel`, + `vModel`, `vSurface` (`v(Σ, k)`). +- **Section 5 (The Main Result, Second Version, pages 230–237):** `IsNearPlanar`, `SurroundsCuff`, + `IsAlphaCandidate`, `alpha` (`α(G)`), `scriptA` (`𝒜_r(C)`), `distPoint` (`d(x, y)`), + `distSet` (`d(x, A)`), `nearSet` (`Y_t(A)`), `IsPointInsideNullOArc`, + `IsPointInsideSurroundingOArc`, `IsPointInsideOArc`, `IsInsideOArc`, `IsBoundaryLinked`. +- **Section 7 (Adding New Cuffs, pages 238–241):** `IsScriptASet`, `IsInnerHole`, + `cuffInsideSet` (`Δ_r(C)`), `allCuffsInsideSet` (`Δ_r`). +- **Section 8 (Schismatic sets, page 241):** `IsX1Arc`, `IsX2Arc`, `IsX3Arc`, `IsSchismatic`. +- **Section 9 (Minors, pages 242–246):** `SurfaceDigraph` (`(G, G⁺, G⁻)`), + `SurfaceDigraph.IsProper`, `IsBoundaryRootedMinor`, `IsDigraphMinor`, + `numInternalIsolatedVertices`, `GM07Theorem91Statement`, `GM07Theorem92Statement`, + `HasDisjointPathsBetween`, `maxDisjointPaths` (`k(X, Y)`). +- **Section 11 (Appendix, pages 248–254):** `IsArcComponentOf` and the topological predicates + `IsFlat`, `IsArcConnected`, `IsLocallyArcConnected`, `IsSolid`, `IsPlanar`, + `IsArcSimplyConnected`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 + +universe u v + +variable {S : Type u} [TopologicalSpace S] + +/-! ## Section 2: Surfaces and Nets (pages 213–218) -/ + +/-- Every point `x ∈ F` belongs to `pathComponentIn F x ∈ arcComponentsIn F`. -/ +theorem pathComponentIn_mem_arcComponentsIn {F : Set S} {x : S} (hx : x ∈ F) : + pathComponentIn F x ∈ arcComponentsIn F := + GraphMinor.Surface.mem_arcComponentsIn_of_mem hx + +/-- Equivalence between `Drawing.IsNormal` (`X ∩ G.U ⊆ G.V`) and Graph Minors VII's definition +(Section 2, page 214): "If $G$ is a graph in $\Sigma$, a subset $X \subseteq \Sigma$ is *$G$-normal* +if $X \cap e = +\emptyset$ for each edge $e$ of $G$." -/ +theorem isNormal_iff_disjoint_edges (G : Drawing S) (X : Set S) : + G.IsNormal X ↔ ∀ e ∈ G.E, X ∩ e = ∅ := by + constructor + · intro h e he + rw [eq_empty_iff_forall_notMem] + rintro x ⟨hxX, hxe⟩ + have hxU : x ∈ G.U \ G.V := he.2.1 hxe + exact hxU.2 (h ⟨hxX, hxU.1⟩) + · intro h x ⟨hxX, hxU⟩ + by_contra hxV + have hxUV : x ∈ G.U \ G.V := ⟨hxU, hxV⟩ + have heE : pathComponentIn (G.U \ G.V) x ∈ G.E := + pathComponentIn_mem_arcComponentsIn hxUV + have hempty := h _ heE + exact hempty.subset ⟨hxX, mem_pathComponentIn_self hxUV⟩ + +/-- Equivalence between `Drawing.IsProper` (`bd S ∩ G.U ⊆ G.V`) and Graph Minors VII's definition +(Section 2, page 214): "A graph $G$ in $\Sigma$ is *proper* if $bd(\Sigma)$ is $G$-normal." -/ +theorem isProper_iff_isNormal_bd (G : Drawing S) : + G.IsProper ↔ G.IsNormal (bd S) := + Iff.rfl + +/-- "If $J$ is a graph in $\Sigma$ with $bd(\Sigma) \subseteq U(J)$, then for every edge $e$ of +$J$, either $e \subseteq bd(\Sigma)$ or $e \cap bd(\Sigma) = \emptyset$." (Graph Minors VII, Section +2, page 214). -/ +def HasBoundaryEdgesOrDisjoint (J : Drawing S) : Prop := + bd S ⊆ J.U ∧ ∀ e ∈ J.E, e ⊆ bd S ∨ e ∩ bd S = ∅ + +/-- "We denote by $J - bd(\Sigma)$ the subgraph $(V(J) \cup (U(J) - bd(\Sigma)), V(J))$ of such a +graph $J$." +(Graph Minors VII, Section 2, page 214). Here `J - bd(Σ)` is the subdrawing of `J` obtained by +retaining all vertices of `J` and those edges of `J` that are disjoint from `bd(Σ)`. -/ +noncomputable def deleteBd [T1Space S] (J : Drawing S) : Drawing S := + J.span J.V {e ∈ J.E | e ∩ bd S = ∅} + +/-- "An $I$-arc $F$ is a *boundary $I$-arc* if $F \subseteq bd(\Sigma)$." +(Graph Minors VII, Section 2, page 214). -/ +def IsBoundaryIArc (F : Set S) : Prop := + IsIArc F ∧ F ⊆ bd S + +/-- A vertex `v ∈ V(G)` is an *isolated vertex* of `G` if no edge of `G` is incident with `v`. -/ +def IsIsolatedVertex (G : Drawing S) (v : S) : Prop := + v ∈ G.V ∧ ∀ e ∈ G.E, ¬ G.VertexIncident v e + +/-- A graph `G` in `Σ` has *no isolated vertices* if every vertex of `G` is incident with at least +one edge of `G` (Graph Minors VII, Section 2, page 215). -/ +def HasNoIsolatedVertices (G : Drawing S) : Prop := + ∀ v ∈ G.V, ∃ e ∈ G.E, G.VertexIncident v e + +/-- The predicate that a pair `(U, V)` of subsets of `S` forms a valid `Drawing S`. -/ +def IsDrawingPair (U V : Set S) : Prop := + ∃ G : Drawing S, G.U = U ∧ G.V = V + +/-- "If $G$ is a proper graph in $\Sigma$ and $U(J)$ is $G$-normal, then $(\phi^{-1}(U(G)), +\phi^{-1}(V(G)))$ is a proper graph in $\Sigma'$, which we denote by $\phi^{-1}(G)$." (Graph Minors +VII, Section 2, page 215). -/ +def IsPullbackDrawing {S' : Type v} [TopologicalSpace S'] (φ : S' → S) (G : Drawing S) + (G' : Drawing S') : Prop := + G'.U = φ ⁻¹' G.U ∧ G'.V = φ ⁻¹' G.V + +open Classical in +/-- Construct `φ⁻¹(G)` as a `Drawing S'` when `(φ⁻¹(U(G)), φ⁻¹(V(G)))` is a drawing pair, or return +a default drawing otherwise. -/ +noncomputable def pullbackDrawing {S' : Type v} [TopologicalSpace S'] (φ : S' → S) + (G : Drawing S) (fallback : Drawing S') : Drawing S' := + if h : ∃ G' : Drawing S', IsPullbackDrawing φ G G' then Classical.choose h else fallback + +/-- "$\phi(H)$ denotes the graph $(\phi(U(H)), \phi(V(H)))$." (Graph Minors VII, Section 4, page +223). -/ +def IsImageDrawing {S' : Type v} [TopologicalSpace S'] (φ : S' → S) (H' : Drawing S') + (H : Drawing S) : Prop := + H.U = φ '' H'.U ∧ H.V = φ '' H'.V + +open Classical in +/-- Construct `φ(H')` as a `Drawing S` when `(φ(U(H')), φ(V(H')))` is a drawing pair, or return a +default drawing otherwise. -/ +noncomputable def imageDrawing {S' : Type v} [TopologicalSpace S'] (φ : S' → S) + (H' : Drawing S') (fallback : Drawing S) : Drawing S := + if h : ∃ H : Drawing S, IsImageDrawing φ H' H then Classical.choose h else fallback + +/-- "A *net* $(\Delta, \Pi)$ for a connected surface $\Sigma$ is a closed disc $\Delta$ together +with a set $$\Pi = \{\{f_1, g_1\}, \dots, \{f_r, g_r\}\},$$ where $f_1, g_1, \dots, f_r, +g_r$ are arc-maps of pairwise internally disjoint boundary $I$-arcs in $\Delta$, such that +$\Sigma$ can be obtained by pasting $f_1 = g_1$, $f_2 = g_2$, \dots, $f_r = g_r$. Let $\phi +\colon \Delta \to \Sigma$ be the associated surjection." +(Graph Minors VII, Section 2, page 215). +We represent `Δ` as a subspace `Δ : Set S` or a space `D : Type u` homeomorphic to the closed unit +disc, with `r` pairs `(f i, g i)` of embeddings of `unitInterval` into `bd D` whose images are +pairwise internally disjoint boundary `I`-arcs in `D`, and the associated quotient surjection +`φ : D → S`. -/ +structure Net (S : Type u) [TopologicalSpace S] where + /-- The closed disc `Δ`. -/ + D : Type u + [topD : TopologicalSpace D] + /-- `Δ` is a surface homeomorphic to the closed unit disc. -/ + isSurface_D : IsSurface D + isClosedDisc_D : IsClosedDisc (univ : Set D) + /-- The number `r` of pasted pairs in `Π = {{f₁, g₁}, …, {f_r, g_r}}`. -/ + r : ℕ + /-- The first arc-map `f_i : [0, 1] → Δ` of the `i`-th pair in `Π`. -/ + f : Fin r → Curve D + /-- The second arc-map `g_i : [0, 1] → Δ` of the `i`-th pair in `Π`. -/ + g : Fin r → Curve D + /-- The associated surjection `φ : Δ → Σ`. -/ + φ : D → S + /-- Each `f_i` is an injective arc-map into `bd(Δ)`. -/ + injective_f : ∀ i : Fin r, Function.Injective (f i) + range_f_subset_bd : ∀ i : Fin r, range (f i) ⊆ bd D + /-- Each `g_i` is an injective arc-map into `bd(Δ)`. -/ + injective_g : ∀ i : Fin r, Function.Injective (g i) + range_g_subset_bd : ∀ i : Fin r, range (g i) ⊆ bd D + /-- The `2r` boundary `I`-arcs `range (f_i)` and `range (g_i)` are pairwise internally disjoint: + any point in the open interior `(0, 1)` of one arc does not lie on any other arc. -/ + internally_disjoint_ff : ∀ i j : Fin r, i ≠ j → + ∀ x ∈ Ioo (0 : unitInterval) 1, f i x ∉ range (f j) + internally_disjoint_gg : ∀ i j : Fin r, i ≠ j → + ∀ x ∈ Ioo (0 : unitInterval) 1, g i x ∉ range (g j) + internally_disjoint_fg : ∀ i j : Fin r, + ∀ x ∈ Ioo (0 : unitInterval) 1, f i x ∉ range (g j) + internally_disjoint_gf : ∀ i j : Fin r, + ∀ x ∈ Ioo (0 : unitInterval) 1, g i x ∉ range (f j) + /-- `φ` is a quotient map obtained by pasting `f_i(x) = g_i(x)` for `0 ≤ x ≤ 1`. -/ + quotientMap_φ : Topology.IsQuotientMap φ + pasting_eq : ∀ (i : Fin r) (x : unitInterval), φ (f i x) = φ (g i x) + /-- On `Δ - bd(Δ)`, `φ` makes no identifications with any other point of `Δ`. -/ + interior_inj : ∀ x ∈ (bd D)ᶜ, ∀ y : D, φ x = φ y → x = y + /-- Two points of `bd(Δ)` have the same image under `φ` if and only if they are identified by the + equivalence relation generated by `f_i(x) = g_i(x)` (`0 ≤ x ≤ 1`). -/ + bd_eq_iff : ∀ x y : D, φ x = φ y ↔ + Relation.EqvGen (fun a b : D => ∃ (i : Fin r) (t : unitInterval), + a = f i t ∧ b = g i t) x y + +attribute [instance] Net.topD + +namespace Net + +/-- The point set `U = {φ(x) : x ∈ bd(Δ)}` of the seam graph of a net `(Δ, Π)` +(Graph Minors VII, Section 2, page 215). -/ +def seamU (N : Net S) : Set S := + N.φ '' bd N.D + +/-- The vertex set `V = {z ∈ Σ : for some {f, g} ∈ Π, f has an end in φ⁻¹(z)}` of the seam graph +of a net `(Δ, Π)` (Graph Minors VII, Section 2, page 215). Since `φ(f_i(0)) = φ(g_i(0))` and +`φ(f_i(1)) = φ(g_i(1))`, these are the images under `φ` of the ends `f_i(0), f_i(1)`. -/ +def seamV (N : Net S) : Set S := + {z : S | ∃ i : Fin N.r, N.φ (N.f i 0) = z ∨ N.φ (N.f i 1) = z} + +/-- "Let $J = (U, V)$, where $U = \{\phi(x) \colon x \in bd(\Delta)\}$ and $$V = \{z \in \Sigma +\colon \text{for some } \{f, g\} \in \Pi\text{, } f \text{ has an end in } \phi^{-1}(z)\}.$$ +Then, provided that $\Pi \ne \emptyset$, $J$ is a graph which we call the *seam graph* for +the net $(\Delta, \Pi)$." +(Graph Minors VII, Section 2, page 215). -/ +def IsSeamGraphFor (N : Net S) (J : Drawing S) : Prop := + 0 < N.r ∧ J.U = N.seamU ∧ J.V = N.seamV + +/-- "Let $(\Delta, \Pi)$ be a net for $\Sigma$, and let $G$ be a proper graph in $\Sigma$. We say +that $(\Delta, \Pi)$ is *$G$-normal* if $U(J)$ is $G$-normal, where $J$ is the seam graph +for $(\Delta, \Pi)$." +(Graph Minors VII, Section 2, page 216). -/ +def IsNormalFor (N : Net S) (G : Drawing S) : Prop := + ∃ J : Drawing S, N.IsSeamGraphFor J ∧ G.IsNormal J.U + +/-- The quantity `|φ⁻¹(V(G)) ∩ bd(Δ)|` minimized in condition (ii) of a minimal net +(Graph Minors VII, Section 2, page 216). -/ +noncomputable def bdVertexPreimageCard (N : Net S) (G : Drawing S) : ℕ := + (N.φ ⁻¹' G.V ∩ bd N.D).ncard + +/-- "Let $G$ be a proper graph in a connected surface $\Sigma$. A net $(\Delta, \Pi)$ with +associated surjection $\phi \colon \Delta \to \Sigma$ is *minimal* (with respect to $G$) if +(i) it is $G$-normal, (ii) among all $G$-normal nets, $(\Delta, \Pi)$ has $|\phi^{-1}(V(G)) +\cap bd(\Delta)|$ minimum, and (iii) among all $G$-normal nets satisfying (ii), $(\Delta, +\Pi)$ has $|\Pi|$ minimum." +(Graph Minors VII, Section 2, page 216). -/ +def IsMinimalFor (N : Net S) (G : Drawing S) : Prop := + N.IsNormalFor G ∧ + (∀ N' : Net S, N'.IsNormalFor G → N.bdVertexPreimageCard G ≤ N'.bdVertexPreimageCard G) ∧ + (∀ N' : Net S, N'.IsNormalFor G → N'.bdVertexPreimageCard G ≤ N.bdVertexPreimageCard G → + N.r ≤ N'.r) + +end Net + +/-- `J` is a *seam graph for some net* for `Σ` (Graph Minors VII, Section 2, (2.1), page 215). -/ +def IsSeamGraph (J : Drawing S) : Prop := + ∃ N : Net S, N.IsSeamGraphFor J + +/-- Type (iii) edge of `J'` (Graph Minors VII, Section 2, page 217): +"edges $e$ such that $e \cap bd(\Sigma) = \emptyset$ and for all $z \in e$, $\phi^{-1}(z) +\subseteq C_1$". -/ +def IsNetEdgeType3 (N : Net S) (C₁ : Set N.D) (e : Set S) : Prop := + e ∩ bd S = ∅ ∧ ∀ z ∈ e, N.φ ⁻¹' {z} ⊆ C₁ + +/-- Type (iv) edge of `J'` (Graph Minors VII, Section 2, page 217): +"edges $e$ such that $e \cap bd(\Sigma) = \emptyset$ and for all $z \in e$, $\phi^{-1}(z) +\subseteq C_2$". -/ +def IsNetEdgeType4 (N : Net S) (C₂ : Set N.D) (e : Set S) : Prop := + e ∩ bd S = ∅ ∧ ∀ z ∈ e, N.φ ⁻¹' {z} ⊆ C₂ + +/-! ## Section 3: Matchings and Forests (pages 218–221) -/ + +/-- "Let $\Sigma$ be a surface and let $F, F'$ be proper $I$-arcs in $\Sigma$. We say that $F$ is +*similar* to $F'$ if there is a homeomorphism $\alpha \colon \Sigma \to \Sigma$ such that +$\alpha(F) = F'$." +(Graph Minors VII, Section 3, page 218). -/ +def AreSimilarIArcs (F F' : Set S) : Prop := + ∃ α : S ≃ₜ S, α '' F = F' + +/-- "Two proper $I$-arcs $F, F'$, are *parallel* if there is a homeomorphism $\alpha \colon +\Sigma \to \Sigma$ such that $\alpha(F) = F'$ and $\alpha(x) = x$ for all $x \in +bd(\Sigma)$." +(Graph Minors VII, Section 3, page 219). -/ +def AreParallelIArcs (F F' : Set S) : Prop := + ∃ α : S ≃ₜ S, α '' F = F' ∧ ∀ x ∈ bd S, α x = x + +/-- The valency of a vertex `v` in a drawing `G`, counting non-loop incident edges once and loop +edges (`(tilde e).ncard = 1`) twice (Graph Minors VII, Section 2, page 216, and Section 4, +page 225: "where $d(z)$ is the valency of $z$ in $J$, counting loops twice"). -/ +noncomputable def vertexValency (G : Drawing S) (v : S) : ℕ := + {e ∈ G.E | G.VertexIncident v e ∧ (tilde e).ncard = 2}.ncard + + 2 * {e ∈ G.E | G.VertexIncident v e ∧ (tilde e).ncard = 1}.ncard + +/-- "A *matching* in a surface $\Sigma$ is a proper graph $G$ in $\Sigma$ with $V(G) \subseteq +bd(\Sigma)$, in which every vertex has valency $1$." (Graph Minors VII, Section 3, page 219). -/ +def IsMatching (G : Drawing S) : Prop := + G.IsProper ∧ G.V ⊆ bd S ∧ ∀ v ∈ G.V, vertexValency G v = 1 + +/-- "For $X \subseteq bd(\Sigma)$, an *$X$-matching* is a matching $G$ with $V(G) = X$." +(Graph Minors VII, Section 3, page 219). -/ +def IsXMatching (X : Set S) (G : Drawing S) : Prop := + IsMatching G ∧ G.V = X + +/-- "Two $X$-matchings $G, G'$ in $\Sigma$ are said to be *congruent* if there is a homeomorphism +$\alpha \colon \Sigma \to \Sigma$ such that $\alpha(U(G)) = U(G')$ and $\alpha(x) = x$ for +all $x \in bd(\Sigma)$." +(Graph Minors VII, Section 3, page 219). -/ +def AreCongruentMatchings (G G' : Drawing S) : Prop := + ∃ α : S ≃ₜ S, α '' G.U = G'.U ∧ ∀ x ∈ bd S, α x = x + +/-- "A *forest* in a surface $\Sigma$ is a proper graph in $\Sigma$ with no circuits." +(Graph Minors VII, Section 3, page 220). In `Surface/Defs.lean`, `IsGraphForest G.toGraph` states +that `G.toGraph` has no circuits (every non-empty walk from a vertex to itself repeats an edge). -/ +def IsSurfaceForest (H : Drawing S) : Prop := + H.IsProper ∧ IsGraphForest H.toGraph + +/-- "For $Y \subseteq bd(\Sigma)$, a $Y$-*forest* is a forest $H$ with $V(H) \cap bd(\Sigma) = Y$." +(Graph Minors VII, Section 3, page 220). -/ +def IsYForest (Y : Set S) (H : Drawing S) : Prop := + IsSurfaceForest H ∧ H.V ∩ bd S = Y + +/-- The image of the arc-components of `F` under a homeomorphism `α`. -/ +theorem arcComponentsIn_image_homeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') + (F : Set S) : arcComponentsIn (α '' F) = (image α) '' arcComponentsIn F := by + ext C' + simp only [arcComponentsIn, mem_ofPred_eq, mem_image] + constructor + · rintro ⟨hne', hsub', hpc', hmax'⟩ + refine ⟨α.symm '' C', ⟨hne'.image α.symm, ?_, hpc'.image α.symm.continuous, ?_⟩, ?_⟩ + · rintro x ⟨y, hy, rfl⟩ + rcases hsub' hy with ⟨z, hz, rfl⟩ + simpa using hz + · intro D hDF hDpc hsubD + have hD' : α '' D = C' := by + refine hmax' (α '' D) (image_mono hDF) (hDpc.image α.continuous) ?_ + rintro y hy + have : α.symm y ∈ D := hsubD ⟨y, hy, rfl⟩ + exact ⟨α.symm y, this, α.apply_symm_apply y⟩ + calc + D = α.symm '' (α '' D) := by ext z; simp + _ = α.symm '' C' := by rw [hD'] + · ext y + simp + · rintro ⟨C, ⟨hne, hsub, hpc, hmax⟩, rfl⟩ + refine ⟨hne.image α, image_mono hsub, hpc.image α.continuous, ?_⟩ + intro D' hD'F hD'pc hsubD' + have hD : α.symm '' D' = C := by + refine hmax (α.symm '' D') ?_ (hD'pc.image α.symm.continuous) ?_ + · rintro x ⟨y, hy, rfl⟩ + rcases hD'F hy with ⟨z, hz, rfl⟩ + simpa using hz + · rintro x hx + exact ⟨α x, hsubD' ⟨x, hx, rfl⟩, α.symm_apply_apply x⟩ + calc + D' = α '' (α.symm '' D') := by ext y; simp + _ = α '' C := by rw [hD] + +/-- The image `α(H)` of a drawing `H` under a homeomorphism `α : Σ ≃ₜ Σ'` +(Graph Minors VII, Section 3, page 220). -/ +def mapDrawingHomeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') (H : Drawing S) : + Drawing S' where + U := α '' H.U + V := α '' H.V + V_subset_U := image_mono H.V_subset_U + isClosed_U := (α.isClosed_image).mpr H.isClosed_U + finite_V := H.finite_V.image α + finite_edges := by + have hdiff : α '' H.U \ α '' H.V = α '' (H.U \ H.V) := + (image_sdiff α.injective H.U H.V).symm + rw [hdiff, arcComponentsIn_image_homeo] + exact H.finite_edges.image (image α) + edge_cond := by + have hdiff : α '' H.U \ α '' H.V = α '' (H.U \ H.V) := + (image_sdiff α.injective H.U H.V).symm + intro e' he' + rw [hdiff, arcComponentsIn_image_homeo] at he' + rcases he' with ⟨e, he, rfl⟩ + have hcap : closure (α '' e) ∩ α '' H.V = α '' (closure e ∩ H.V) := by + rw [← α.image_closure, ← Set.image_inter α.injective] + rcases H.edge_cond e he with ⟨u, v, huv, hcap_e, hL⟩ | ⟨u, hcap_e, hO⟩ + · left + refine ⟨α u, α v, fun h => huv (α.injective h), ?_, ?_⟩ + · rw [hcap, hcap_e, image_pair] + · rw [← α.image_closure] + rcases hL with ⟨f, hf0, hf1⟩ + refine ⟨f.trans (α.image (closure e)), ?_, ?_⟩ + · change α (f 0).1 = α u + rw [hf0] + · change α (f 1).1 = α v + rw [hf1] + · right + refine ⟨α u, ?_, ?_⟩ + · rw [hcap, hcap_e, image_singleton] + · rw [← α.image_closure] + rcases hO with ⟨f⟩ + exact ⟨f.trans (α.image (closure e))⟩ + +/-- "We say that forests $H_1, H_2$ in $\Sigma$ are *homoplastic* if there is a homeomorphism +$\alpha \colon \Sigma \to \Sigma$ such that (i) $\alpha(x) = x$ for all $x \in bd(\Sigma)$, +and (ii) the forest $\alpha(H_1)$ is homotopic in $\Sigma$ to $H_2$." +(Graph Minors VII, Section 3, page 220). -/ +def ForestsHomoplastic (H₁ H₂ : Drawing S) : Prop := + ∃ α : S ≃ₜ S, (∀ x ∈ bd S, α x = x) ∧ ForestsHomotopic (mapDrawingHomeo α H₁) H₂ + +/-- "We say $Z \subseteq \Sigma$ is *simply connected* if $Z$ is arc-connected and every $O$-arc $F +\subseteq Z$ bounds a closed disc $\Delta \subseteq Z$." (Graph Minors VII, Section 11, page 253; +Section 2, page 214: "there is a closed disc $\Delta \subseteq \Sigma$ with $bd(\Delta) = F$"). -/ +def IsSimplyConnectedSubset (Z : Set S) : Prop := + IsArcConnected Z ∧ + ∀ F : Set S, IsOArc F → F ⊆ Z → ∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F ∧ Δ ⊆ Z + +/-- "An $X$-matching $G$ surrounds a $Y$-forest $H$ if $U(G) \cap U(H) = \emptyset$ and for each +component $H'$ of $H$ with $V(H') \cap bd(\Sigma) \ne \emptyset$ there is a simply connected region +of $G$ including $U(H')$." +(Graph Minors VII, Section 3, proof of (3.4), page 220). -/ +def MatchingSurroundsForest (G H : Drawing S) : Prop := + G.U ∩ H.U = ∅ ∧ + ∀ H' : Drawing S, H'.IsSubdrawing H → H'.IsConnected → (H'.V ∩ bd S).Nonempty → + ∃ r ∈ G.R, IsSimplyConnectedSubset r ∧ H'.U ⊆ r + +/-- The property of an integer `w` satisfying Graph Minors VII, (3.6) (page 221) for `(Σ, k, n)`: +"for every matching $G$ in $\Sigma$ with $|V(G)| \le 2n$ and every forest $H$ in $\Sigma$ +with $|V(H) \cap bd(\Sigma)| \le k$, there is a forest $H'$ homoplastic to $H$ with +$|U(G) \cap U(H')| \le w(\Sigma, k, n)$." -/ +def IsW36Bound (S : Type u) [TopologicalSpace S] (k n w : ℕ) : Prop := + ∀ G H : Drawing S, IsMatching G → G.V.ncard ≤ 2 * n → + IsSurfaceForest H → (H.V ∩ bd S).ncard ≤ k → + ∃ H' : Drawing S, IsSurfaceForest H' ∧ ForestsHomoplastic H H' ∧ + (G.U ∩ H'.U).Finite ∧ (G.U ∩ H'.U).ncard ≤ w + +/-- The integer `w(Σ, k, n)` of Graph Minors VII, (3.6) (page 221): the least `w : ℕ` satisfying +`IsW36Bound S k n w`. -/ +noncomputable def wSurface (S : Type u) [TopologicalSpace S] (k n : ℕ) : ℕ := + sInf {w : ℕ | IsW36Bound S k n w} + +/-! ## Section 4: The Main Result, First Version (pages 221–230) -/ + +/-- "Let $G$ be a graph in $\Sigma$, and let $H$ be a forest in $\Sigma$. If there exists a +forest $H'$ homoplastic to $H$ which is a subgraph of $G$, we say that $H$ is +*$G$-feasible*." +(Graph Minors VII, Section 4, page 221). -/ +def IsGFeasible (G H : Drawing S) : Prop := + ∃ H' : Drawing S, IsSurfaceForest H' ∧ ForestsHomoplastic H H' ∧ H'.IsSubdrawing G + +/-- "If $C$ is a cuff of a surface $\Sigma$, we denote by $\Sigma + \hat{C}$ the surface obtained +by pasting a closed disc onto $C$." (Graph Minors VII, Section 4, page 224). +Using `PasteDiscStatement` from `GraphMinor/Surface/TopologyStatements.lean`, `IsCappedCuff C S' j +D` +states that `S'` is a surface, `j : S → S'` is a topological embedding, `D ⊆ S'` is a closed disc +with `discBd D = j '' C`, and `range j ∪ D = univ` with `range j ∩ D = j '' C`. -/ +structure IsCappedCuff (C : Set S) (S' : Type u) [TopologicalSpace S'] (j : S → S') + (D : Set S') : Prop where + cuff : IsCuff C + isSurface : IsSurface S' + isEmbedding : IsEmbedding j + isClosedDisc : IsClosedDisc D + discBd_eq : discBd D = j '' C + union_eq : range j ∪ D = univ + inter_eq : range j ∩ D = j '' C + +/-- An `O`-arc `B ⊆ Σ` is *null-homotopic in `Σ + Ĉ`* (Graph Minors VII, Section 4, (4.6)(ii), +page 224): for every capped surface `Σ + Ĉ` obtained by pasting a closed disc onto the cuff `C`, +the +image of `B` in `Σ + Ĉ` is a null-homotopic `O`-arc. -/ +def IsNullHomotopicOArcInCappedCuff (C B : Set S) : Prop := + IsCuff C ∧ IsOArc B ∧ + ∀ (S' : Type u) [TopologicalSpace S'] (j : S → S') (D : Set S'), + IsCappedCuff C S' j D → IsNullHomotopicOArc (j '' B) + +/-- A subset `X ⊆ Σ` is *planar in `Σ + Ĉ`* (Graph Minors VII, Section 5, page 230): for some +(equivalently, every) capped surface `Σ + Ĉ` obtained by pasting a closed disc onto the cuff `C`, +the image `j '' X` is included in a closed disc `Δ ⊆ Σ + Ĉ`. -/ +def IsPlanarInCappedCuff (C X : Set S) : Prop := + IsCuff C ∧ + (∃ (S' : Type u) (_ : TopologicalSpace S') (j : S → S') (D : Set S'), + IsCappedCuff C S' j D ∧ IsPlanar (j '' X)) ∧ + (∀ (S' : Type u) [TopologicalSpace S'] (j : S → S') (D : Set S'), + IsCappedCuff C S' j D → IsPlanar (j '' X)) + +/-- "Let $w$ be the maximum of $$w(\Sigma', 2k, 3(2a + b + c - 1))$$ (as in (3.6)), taken over +all surfaces $\Sigma' \cong \Sigma(a, b, c')$, where $c' \le 2(2a + b + c - 1)$." +(Graph Minors VII, Section 4, page 224). Since `w(Σ', k, n)` is invariant under homeomorphism, we +take the maximum over `c' ≤ 2(2a + b + c - 1)` using the canonical surface model +`SurfaceModel a b c'`. -/ +noncomputable def wMaxModel (a b c k : ℕ) : ℕ := + (Finset.range (2 * (2 * a + b + c - 1) + 1)).sup fun c' => + wSurface (SurfaceModel a b c') (2 * k) (3 * (2 * a + b + c - 1)) + +/-- "`μ = 2(2a + b + c)(k + w) + 2k`" (Graph Minors VII, Section 4, page 224). -/ +noncomputable def muModel (a b c k : ℕ) : ℕ := + 2 * (2 * a + b + c) * (k + wMaxModel a b c k) + 2 * k + +/-- "v &= 6(2a + b + c - 1)(w + 2\mu + 1) + 2k. \end{aligned}$$ We define $v(\Sigma, k) = v$." +(Graph Minors VII, Section 4, page 224). -/ +noncomputable def vModel (a b c k : ℕ) : ℕ := + 6 * (2 * a + b + c - 1) * (wMaxModel a b c k + 2 * muModel a b c k + 1) + 2 * k + +/-- The function `v(Σ, k)` of Graph Minors VII, Section 4 (page 224): for a surface `Σ ≅ Σ(a, b, +c)`, +`v(Σ, k) = vModel a b c k`. -/ +noncomputable def vSurface (S : Type u) [TopologicalSpace S] (k : ℕ) : ℕ := + sInf {v : ℕ | ∃ a b c : ℕ, Nonempty (S ≃ₜ SurfaceModel a b c) ∧ v = vModel a b c k} + +/-! ## Section 5: The Main Result, Second Version (pages 230–237) -/ + +/-- "We say that $X \subseteq \Sigma$ is *near-planar* if either $X$ is planar, or $X$ is planar in +$\Sigma + \hat{C}$, for some cuff $C$." (Graph Minors VII, Section 5, page 230). -/ +def IsNearPlanar (X : Set S) : Prop := + IsPlanar X ∨ ∃ C ∈ cuffs S, IsPlanarInCappedCuff C X + +/-- "We say that $X$ *surrounds* cuff $C$ (in $\Sigma$) if $X$ is planar in $\Sigma + \hat{C}$ but +not in $\Sigma$." +(Graph Minors VII, Section 5, page 230). -/ +def SurroundsCuff (X C : Set S) : Prop := + C ∈ cuffs S ∧ IsPlanarInCappedCuff C X ∧ ¬ IsPlanar X + +/-- A candidate set `X ⊆ Σ` in the definition of `α(G)` (Graph Minors VII, Section 5, page 230): +`X` is solid, connected, `G`-normal, and not near-planar. -/ +def IsAlphaCandidate (G : Drawing S) (X : Set S) : Prop := + IsSolid X ∧ IsConnected X ∧ G.IsNormal X ∧ ¬ IsNearPlanar X + +/-- "Let $G$ be a proper graph in $\Sigma$. We define $\alpha(G)$ to be the minimum of $|X \cap +V(G)|$, taken over all solid connected $G$-normal sets $X \subseteq \Sigma$ which are not +near-planar." +(Graph Minors VII, Section 5, page 230). -/ +noncomputable def alpha (G : Drawing S) : ℕ := + sInf {n : ℕ | ∃ X : Set S, IsAlphaCandidate G X ∧ (X ∩ G.V).ncard = n} + +/-- "If $G$ is proper in $\Sigma$, $C$ is a cuff of $\Sigma$, and $r \ge 0$ is an integer, we +define ... $\mathscr{A}_r(C)$ to be the union of all solid connected $G$-normal sets $X +\subseteq \Sigma$ which surround $C$ and for which $|V(G) \cap X| \le r$. If there is no +such $X$, $\mathscr{A}_r(C)$ is defined to be $\emptyset$." +(Graph Minors VII, Section 5, pages 230–231). -/ +def scriptA (G : Drawing S) (r : ℕ) (C : Set S) : Set S := + ⋃₀ {X : Set S | IsSolid X ∧ IsConnected X ∧ G.IsNormal X ∧ SurroundsCuff X C ∧ + (G.V ∩ X).ncard ≤ r} + +open Classical in +/-- "Let $G$ be a proper graph in $\Sigma$. If $x, y \in \Sigma$ are distinct, we define $d(x, y)$ +to be $\min |U(G) \cap X|$, the minimum being taken over all $[0, 1]$-arcs $X$ with ends $x, y$. ... +If $x = y$, we ... define $d(x, y) = 0$ if $x \notin U(G)$, and $d(x, y) = 1$ if $x \in U(G)$." +(Graph Minors VII, Section 5, page 231). -/ +noncomputable def distPoint (G : Drawing S) (x y : S) : ℕ := + if x = y then + if x ∈ G.U then 1 else 0 + else + sInf {n : ℕ | ∃ X : Set S, IsLineWithEnds X x y ∧ (G.U ∩ X).Finite ∧ (G.U ∩ X).ncard = n} + +/-- "If ... $x \in \Sigma$ and $A \subseteq \Sigma$ is non-empty, we define $d(x, A)$ to be +$\min d(x, y)$, taken over all $y \in A$" (Graph Minors VII, Section 5, pages 231–232). -/ +noncomputable def distSet (G : Drawing S) (x : S) (A : Set S) : ℕ := + sInf (distPoint G x '' A) + +/-- "and for any integer $t \ge 0$ we define $$ Y_t(A) = \{x \in \Sigma : d(x, A) \le t\}. $$" +(Graph Minors VII, Section 5, page 232). -/ +def nearSet (G : Drawing S) (t : ℕ) (A : Set S) : Set S := + {x : S | ∃ y ∈ A, distPoint G x y ≤ t} + +/-- "If $\Sigma \cong \Sigma(a, b, c)$ where $3a + 3b + c \ge 3$, and $F$ is a null-homotopic +$O$-arc, then there is a unique closed disc $\Delta \subseteq \Sigma$ with boundary $F$. If +$x \in \Delta - F$ we say that $x$ is *inside* $F$ (in $\Sigma$)." (Graph Minors VII, Section 5, +page 232). -/ +def IsPointInsideNullOArc (F : Set S) (x : S) : Prop := + IsNullHomotopicOArc F ∧ ∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F ∧ x ∈ Δ \ F + +/-- "If $F$ is an $O$-arc surrounding a cuff $C$ and $x \in \Sigma$, we say that $x$ is *inside* $F$ +in $\Sigma$ if it is inside $F$ in $\Sigma + \hat{C}$." (Graph Minors VII, Section 5, page 232). -/ +def IsPointInsideSurroundingOArc (C F : Set S) (x : S) : Prop := + IsOArc F ∧ SurroundsCuff F C ∧ + (∃ (S' : Type u) (_ : TopologicalSpace S') (j : S → S') (D : Set S'), + IsCappedCuff C S' j D ∧ IsPointInsideNullOArc (j '' F) (j x)) ∧ + (∀ (S' : Type u) [TopologicalSpace S'] (j : S → S') (D : Set S'), + IsCappedCuff C S' j D → IsPointInsideNullOArc (j '' F) (j x)) + +/-- A point `x ∈ Σ` is *inside* an `O`-arc `F` in `Σ` (either `F` is null-homotopic or `F` surrounds +some cuff `C` of `Σ`; Graph Minors VII, Section 5, page 232). -/ +def IsPointInsideOArc (F : Set S) (x : S) : Prop := + IsPointInsideNullOArc F x ∨ ∃ C ∈ cuffs S, IsPointInsideSurroundingOArc C F x + +/-- "If $X \subseteq \Sigma$, we say that $X$ is *inside* $F$ if every $x \in X$ is inside $F$." +(Graph Minors VII, Section 5, page 232). -/ +def IsInsideOArc (X F : Set S) : Prop := + ∀ x ∈ X, IsPointInsideOArc F x + +/-- "Let $G$ be a proper graph in $\Sigma$. We say that $G$ is *boundary-linked* if for every +cuff $C$ of $\Sigma$ and every $G$-normal $O$-arc $F$ surrounding $C$, $|V(G) \cap F| \ge +|V(G) \cap C|$." +(Graph Minors VII, Section 5, page 233). -/ +def IsBoundaryLinked (G : Drawing S) : Prop := + G.IsProper ∧ + ∀ C ∈ cuffs S, ∀ F : Set S, G.IsNormal F → IsOArc F → SurroundsCuff F C → + (G.V ∩ C).ncard ≤ (G.V ∩ F).ncard + +/-! ## Section 7: Adding New Cuffs (pages 238–241) -/ + +/-- The sets whose union is `𝒜_r(C)` (Graph Minors VII, Section 5, pages 230–231): solid, connected, +`G`-normal, surrounding +`C`, with at most `r` vertices of `G`. -/ +def IsScriptASet (G : Drawing S) (r : ℕ) (C X : Set S) : Prop := + IsSolid X ∧ IsConnected X ∧ G.IsNormal X ∧ SurroundsCuff X C ∧ (G.V ∩ X).ncard ≤ r + +/-- A *hole* of `X` around `C`: a component `K` of `Σ - X` that lies in a closed disc of `Σ + CHat` +with boundary in `X`. -/ +def IsInnerHole (C X K : Set S) : Prop := + K ∈ componentsIn (univ \ X) ∧ + ∃ (S' : Type u) (_ : TopologicalSpace S') (j : S → S') (D Δ : Set S'), + IsCappedCuff C S' j D ∧ IsClosedDisc Δ ∧ discBd Δ ⊆ j '' X ∧ j '' K ⊆ Δ + +/-- The set `Δ_r(C)` of Graph Minors VII, Section 7 (page 238), which the paper calls the set of +points inside an `O`-arc +`A_r(C) ⊆ bd(Σ) ∪ U(G)` with `A_r(C) ⊆ 𝒜_{r+1}(C)` and `𝒜_r(C)` inside `A_r(C)`. + +No such `O`-arc exists as printed. A point of `𝒜_{r+1}(C)` lies in a `G`-normal set, so it is not on +an edge. Thus `A_r(C)` would +lie in `bd(Σ)`, and it would be `C`, which has no points inside it. We take what the proofs of (7.1) +and (7.3) use: `Δ_r(C)` is +the set of points of the sets `X` of `𝒜_r(C)` and of their holes around `C`. So it is `𝒜_r(C)` with +its holes filled in, the +set bounded by the `O`-arc of the paper. See the correction on page 238 in `corrections/GM07.md`. -/ +def cuffInsideSet (G : Drawing S) (r : ℕ) (C : Set S) : Set S := + ⋃₀ {Y : Set S | ∃ X : Set S, IsScriptASet G r C X ∧ (Y = X ∨ IsInnerHole C X Y)} + +/-- "We define $\Delta_r$ to be the union of $\Delta_r(C)$ taken over all cuffs $C$ with +$\mathcal{A}_r(C) \ne \emptyset$." +(Graph Minors VII, Section 7, page 238). -/ +def allCuffsInsideSet (G : Drawing S) (r : ℕ) : Set S := + ⋃ C ∈ {C ∈ cuffs S | (scriptA G r C).Nonempty}, cuffInsideSet G r C + +/-! ## Section 8: Schismatic sets (page 241) -/ + +/-- An `X₁`-arc in `Σ` (Graph Minors VII, Section 8, page 241): +"$G_1$ has exactly two vertices ($u$, $v$ say) and three edges, one a loop on $u$, one a loop +on $v$, and the other joining $u$, $v$". Thus `X` is the union of two disjoint `O`-arcs `A₁, A₂` and +a +`[0, 1]`-arc `P` with ends `u ∈ A₁` and `v ∈ A₂` meeting `A₁ ∪ A₂` only at `{u, v}`. -/ +def IsX1Arc (X : Set S) : Prop := + ∃ A₁ A₂ P : Set S, ∃ u v : S, + IsOArc A₁ ∧ IsOArc A₂ ∧ Disjoint A₁ A₂ ∧ + IsLineWithEnds P u v ∧ u ∈ A₁ ∧ v ∈ A₂ ∧ + P ∩ A₁ = {u} ∧ P ∩ A₂ = {v} ∧ X = A₁ ∪ A₂ ∪ P + +/-- An `X₂`-arc in `Σ` (Graph Minors VII, Section 8, page 241): +"$G_2$ has exactly one vertex and two edges". Thus `X` is the union of two `O`-arcs `A₁, A₂` +intersecting at a single point `u`. -/ +def IsX2Arc (X : Set S) : Prop := + ∃ A₁ A₂ : Set S, ∃ u : S, + IsOArc A₁ ∧ IsOArc A₂ ∧ A₁ ∩ A₂ = {u} ∧ X = A₁ ∪ A₂ + +/-- An `X₃`-arc in `Σ` (Graph Minors VII, Section 8, page 241): +"$G_3$ has two vertices and three edges, mutually parallel". Thus `X` is the union of three +`[0, 1]`-arcs `P₁, P₂, P₃` with common distinct ends `u, v`, pairwise intersecting only at +`{u, v}`. -/ +def IsX3Arc (X : Set S) : Prop := + ∃ P₁ P₂ P₃ : Set S, ∃ u v : S, + u ≠ v ∧ IsLineWithEnds P₁ u v ∧ IsLineWithEnds P₂ u v ∧ IsLineWithEnds P₃ u v ∧ + P₁ ∩ P₂ = {u, v} ∧ P₁ ∩ P₃ = {u, v} ∧ P₂ ∩ P₃ = {u, v} ∧ X = P₁ ∪ P₂ ∪ P₃ + +/-- "We say that $X \subseteq \Sigma$ is *schismatic* if $X$ is either an $O$-arc or an $X_i$-arc +for some $i$, and $X$ is not near-planar, and every proper subset of $X$ which is an $O$-arc +is near-planar." +(Graph Minors VII, Section 8, page 241). Here `i ∈ {1, 2, 3}`. -/ +def IsSchismatic (X : Set S) : Prop := + (IsOArc X ∨ IsX1Arc X ∨ IsX2Arc X ∨ IsX3Arc X) ∧ + ¬ IsNearPlanar X ∧ + ∀ F : Set S, IsOArc F → F ⊂ X → IsNearPlanar F + +/-! ## Section 9: Minors (pages 242–246) -/ + +/-- "A digraph $(G, G^+, G^-)$ in a surface $\Sigma$ consists of a graph $G$ in $\Sigma$ and two +functions $G^+, G^- \colon E(G) \to V(G)$ such that for every edge $e$ of $G$, $\{G^+(e), +G^-(e)\} = \bar{e} - e$." +(Graph Minors VII, Section 9, page 242). -/ +structure SurfaceDigraph (S : Type u) [TopologicalSpace S] where + /-- The underlying graph `G` in `Σ`. -/ + G : Drawing S + /-- The head function `G⁺ : E(G) → V(G)`. -/ + plus : Set S → S + /-- The tail function `G⁻ : E(G) → V(G)`. -/ + minus : Set S → S + /-- For every edge `e` of `G`, `G⁺(e) ∈ V(G)`. -/ + plus_mem : ∀ e ∈ G.E, plus e ∈ G.V + /-- For every edge `e` of `G`, `G⁻(e) ∈ V(G)`. -/ + minus_mem : ∀ e ∈ G.E, minus e ∈ G.V + /-- For every edge `e` of `G`, `{G⁺(e), G⁻(e)} = eBar - e`. -/ + ends_eq : ∀ e ∈ G.E, ({plus e, minus e} : Set S) = tilde e + +namespace SurfaceDigraph + +/-- "The digraph is proper if `G` is proper." (Graph Minors VII, Section 9, page 242). -/ +def IsProper (D : SurfaceDigraph S) : Prop := + D.G.IsProper + +end SurfaceDigraph + +/-- "Let $(G, G^+, G^-)$, $(H, H^+, H^-)$ be proper digraphs in $\Sigma$. We say that $(H, H^+, +H^-)$ is a *boundary-rooted minor* of $(G, G^+, G^-)$ if $V(H) \cap bd(\Sigma) = V(G) \cap +bd(\Sigma)$ and if for each vertex $v$ of $H$ there is a non-null connected subgraph +$\phi(v)$ of $G$, and for each edge $e$ of $H$ there is an edge $\phi(e)$ of $G$, such that +(i) for distinct $v, v' \in V(H)$, $\phi(v)$ and $\phi(v')$ are vertex-disjoint, (ii) for +distinct $e, e' \in E(H)$, $\phi(e)$ and $\phi(e')$ are distinct, (iii) for $v \in V(H)$ and +$e \in E(H)$, $\phi(e)$ is not an edge of $\phi(v)$, (iv) for $e \in E(H)$, $G^+(\phi(e))$ +is a vertex of $\phi(H^+(e))$, and $G^-(\phi(e))$ is a vertex of $\phi(H^-(e))$, and (v) for +$v \in V(H) \cap bd(\Sigma)$, $v$ is a vertex of $\phi(v)$." +(Graph Minors VII, Section 9, page 242). -/ +def IsBoundaryRootedMinor (H G : SurfaceDigraph S) : Prop := + H.G.V ∩ bd S = G.G.V ∩ bd S ∧ + ∃ (φv : S → Drawing S) (φe : Set S → Set S), + (∀ v ∈ H.G.V, (φv v).IsSubdrawing G.G ∧ (φv v).V.Nonempty ∧ (φv v).IsConnected) ∧ + (∀ e ∈ H.G.E, φe e ∈ G.G.E) ∧ + -- (i) for distinct v, v' ∈ V(H), φ(v) and φ(v') are vertex-disjoint + (∀ v ∈ H.G.V, ∀ v' ∈ H.G.V, v ≠ v' → Disjoint (φv v).V (φv v').V) ∧ + -- (ii) for distinct e, e' ∈ E(H), φ(e) and φ(e') are distinct + (∀ e ∈ H.G.E, ∀ e' ∈ H.G.E, e ≠ e' → φe e ≠ φe e') ∧ + -- (iii) for v ∈ V(H) and e ∈ E(H), φ(e) is not an edge of φ(v) + (∀ v ∈ H.G.V, ∀ e ∈ H.G.E, φe e ∉ (φv v).E) ∧ + -- (iv) for e ∈ E(H), G⁺(φ(e)) is a vertex of φ(H⁺(e)), and G⁻(φ(e)) is a vertex of φ(H⁻(e)) + (∀ e ∈ H.G.E, G.plus (φe e) ∈ (φv (H.plus e)).V ∧ G.minus (φe e) ∈ (φv (H.minus e)).V) ∧ + -- (v) for v ∈ V(H) ∩ bd(Σ), v is a vertex of φ(v) + (∀ v ∈ H.G.V ∩ bd S, v ∈ (φv v).V) + +/-- "If $bd(\Sigma) = \emptyset$ and $(H, H^+, H^-)$, $(G, G^+, G^-)$ are digraphs in $\Sigma$, +and the first is a boundary-rooted minor of the second, we say that it is a *minor* of the +second." +(Graph Minors VII, Section 9, page 243). -/ +def IsDigraphMinor (H G : SurfaceDigraph S) : Prop := + bd S = ∅ ∧ IsBoundaryRootedMinor H G + +/-- The number `g` of isolated vertices of `H` which are not in `bd(Σ)` +(Graph Minors VII, Section 9, (9.1), page 242). -/ +noncomputable def numInternalIsolatedVertices (H : Drawing S) : ℕ := + {v ∈ H.V \ bd S | IsIsolatedVertex H v}.ncard + +/-- Statement of Graph Minors VII, (9.1) (pages 242–243): +"Let $\Sigma \cong \Sigma(a, b, c)$ where $3a + 3b + c \ge 3$. Let $(H, H^+, H^-)$ be a +proper digraph in $\Sigma$. Let $g$ be the number of isolated vertices of $H$ which are not +in $bd(\Sigma)$. Let $k$ be an integer with* $$2k \ge 4|E(H)| + 4g + |V(H) \cap bd(\Sigma)| ++ 2c + 2$$ *and let $c_0$ be an integer with $c_0 \ge c + |E(H)| + g + 1$. Let $(G, G^+, +G^-)$ be a proper digraph in $\Sigma$ such that* ... (i) $V(G) \cap bd(\Sigma) = V(H) \cap +bd(\Sigma)$, (ii) $G$ *is boundary-linked, and* (iii) $\alpha(G) \ge 42k 5^{(g+|E(H)|)} +v(\Sigma(a, b, c_0), k)$. *Then $(H, H^+, H^-)$ is a boundary-rooted minor of $(G, G^+, +G^-)$." -/ +def GM07Theorem91Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsSurface S → + ∀ a b c : ℕ, 3 * a + 3 * b + c ≥ 3 → Nonempty (S ≃ₜ SurfaceModel a b c) → + ∀ H : SurfaceDigraph S, H.IsProper → + ∀ k c₀ : ℕ, + let g := numInternalIsolatedVertices H.G + 2 * k ≥ 4 * H.G.E.ncard + 4 * g + (H.G.V ∩ bd S).ncard + 2 * c + 2 → + c₀ ≥ c + H.G.E.ncard + g + 1 → + ∀ G : SurfaceDigraph S, G.IsProper → + G.G.V ∩ bd S = H.G.V ∩ bd S → + IsBoundaryLinked G.G → + alpha G.G ≥ 42 * k * 5 ^ (g + H.G.E.ncard) * vModel a b c₀ k → + IsBoundaryRootedMinor H G + +/-- Statement of Graph Minors VII, (9.2) (page 244): +"Let $\Sigma \cong \Sigma(a, b, 0)$ where $a + b \ge 1$, and let $(H, H^+, H^-)$ be a digraph +in $\Sigma$. Then there is a number $N$ such that $(H, H^+, H^-)$ is a minor of every +digraph $(G, G^+, G^-)$ in $\Sigma$ with $\alpha(G) \ge N$." -/ +def GM07Theorem92Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsSurface S → + ∀ a b : ℕ, a + b ≥ 1 → Nonempty (S ≃ₜ SurfaceModel a b 0) → + ∀ H : SurfaceDigraph S, + ∃ N : ℕ, ∀ G : SurfaceDigraph S, alpha G.G ≥ N → IsDigraphMinor H G + +/-- There exist `k` mutually vertex-disjoint paths `P₁, …, P_k` of `G`, each with initial vertex in +`X` and terminal vertex in `Y` (Graph Minors VII, Section 9, page 244). -/ +def HasDisjointPathsBetween (G : Drawing S) (X Y : Set S) (k : ℕ) : Prop := + ∃ (P : Fin k → Drawing S) (s t : Fin k → S), + (∀ i : Fin k, (P i).IsSubdrawing G ∧ s i ∈ X ∧ t i ∈ Y ∧ (P i).IsPathBetween (s i) (t i)) ∧ + ∀ i j : Fin k, i ≠ j → Disjoint (P i).V (P j).V + +/-- "If $G$ is a proper graph in a surface $\Sigma$, and $X, Y \subseteq \Sigma$ are disjoint, we +define $k(X, Y)$ to be the maximum value of $k$ such that there are paths $P_1, \dots, P_k$ +of $G$, mutually disjoint, and each with initial vertex in $X$ and terminal vertex in $Y$." +(Graph Minors VII, Section 9, page 244). -/ +noncomputable def maxDisjointPaths (G : Drawing S) (X Y : Set S) : ℕ := + sSup {k : ℕ | HasDisjointPathsBetween G X Y k} + +/-- `84(t + 2) v(Σ(0, 0, t + 4), 2t + 4)` where `t = |V(H)| + |E(H)|`. Graph Minors VII, +(9.3)–(9.5) (pages 244–246), takes `r = 84(t + 2) 5^t v(Σ(0, 0, t + 4), 2t + 4)`, which is this +number times `5 ^ t`. -/ +noncomputable def rCylinderBound (H : Drawing S) : ℕ := + let t := H.V.ncard + H.E.ncard + 84 * (t + 2) * vModel 0 0 (t + 4) (2 * t + 4) + +/-- In a cylinder `Σ` with cuffs `C₁, C₂`, disjoint non-null-homotopic `O`-arcs `F₁, F₂` occur on +`Σ` in the order `C₁, F₂, F₁, C₂` (Graph Minors VII, Section 9, (9.3)(i), page 244): `F₂` separates +`C₁` from `F₁ ∪ C₂`, and `F₁` separates `C₁ ∪ F₂` from `C₂` (equivalently, in `Σ + Ĉ₁`, `C₁` is +inside `F₂` and `F₂` is inside `F₁`). -/ +def CylinderOArcsInOrder (C₁ F₂ F₁ C₂ : Set S) : Prop := + C₁ ∈ cuffs S ∧ C₂ ∈ cuffs S ∧ C₁ ≠ C₂ ∧ + IsOArc F₁ ∧ IsOArc F₂ ∧ Disjoint F₁ F₂ ∧ + ¬ IsNullHomotopicOArc F₁ ∧ ¬ IsNullHomotopicOArc F₂ ∧ + SurroundsCuff F₂ C₁ ∧ SurroundsCuff F₁ C₁ ∧ + IsInsideOArc F₂ F₁ + +/-! ## Section 11: Appendix (pages 248–254) -/ + +/-- "The arc-components of $Z \subseteq \Sigma$ are the maximal arc-connected subsets of $Z$; +they partition $Z$." (Graph Minors VII, Section 11, page 251). -/ +def IsArcComponentOf (A Z : Set S) : Prop := + Maximal (fun B : Set S => B ⊆ Z ∧ IsArcConnected B) A + +/-! ### Small structural checks -/ + +/-- The empty drawing in any space `S` has no vertices and no edges, and is proper and a forest. -/ +def emptyDrawing (S : Type u) [TopologicalSpace S] : Drawing S where + U := ∅ + V := ∅ + V_subset_U := Subset.rfl + isClosed_U := isClosed_empty + finite_V := finite_empty + finite_edges := by + have : arcComponentsIn ((∅ : Set S) \ ∅) = ∅ := by + ext C + constructor + · intro h + exfalso + exact h.1.ne_empty (subset_empty_iff.mp (h.2.1.trans sdiff_subset)) + · intro h + exact False.elim h + rw [this] + exact finite_empty + edge_cond := by + intro e he + exfalso + exact he.1.ne_empty (subset_empty_iff.mp (he.2.1.trans sdiff_subset)) + +/-- The empty digraph `(∅, _, _)` in a nonempty space `S` is proper and is a boundary-rooted minor +of itself. -/ +noncomputable def emptySurfaceDigraph (S : Type u) [TopologicalSpace S] [Nonempty S] : + SurfaceDigraph S where + G := emptyDrawing S + plus := fun _ => Classical.arbitrary S + minus := fun _ => Classical.arbitrary S + plus_mem := fun _ he => False.elim (he.1.ne_empty (subset_empty_iff.mp + (he.2.1.trans sdiff_subset))) + minus_mem := fun _ he => False.elim (he.1.ne_empty (subset_empty_iff.mp + (he.2.1.trans sdiff_subset))) + ends_eq := fun _ he => False.elim (he.1.ne_empty (subset_empty_iff.mp + (he.2.1.trans sdiff_subset))) + +/-- Every proper digraph is a boundary-rooted minor of itself when each vertex `v ∈ V(H)` is mapped +to the single-vertex subdrawing `({v}, {v})` and each edge to itself. -/ +theorem isBoundaryRootedMinor_refl [T1Space S] (H : SurfaceDigraph S) : + IsBoundaryRootedMinor H H := by + have hspanV : ∀ {v : S}, v ∈ H.G.V → (H.G.span {v} ∅).V = {v} := by + intro v hv + simp [Drawing.span_V, Drawing.spanV, hv] + refine ⟨rfl, fun v => H.G.span {v} ∅, id, ?_, fun _ h => h, ?_, ?_, ?_, ?_, ?_⟩ + · intro v hv + refine ⟨⟨H.G.spanV_subset {v} ∅, ?_⟩, ?_, ?_⟩ + · rw [H.G.span_E] + exact inter_subset_right + · rw [hspanV hv] + exact singleton_nonempty v + · refine ⟨by rw [hspanV hv]; exact singleton_nonempty v, ?_⟩ + intro u hu w hw + have huV : u ∈ ((H.G.span {v} ∅).toGraph).vertexSet := hu + rw [hspanV hv] at hu hw + rcases mem_singleton_iff.mp hu with rfl + rcases mem_singleton_iff.mp hw with rfl + exact ⟨.nil huV⟩ + · intro v hv v' hv' hne + rw [hspanV hv, hspanV hv'] + exact disjoint_singleton.mpr hne + · intro _ _ _ _ hne + exact hne + · intro v _ e _ + rw [H.G.span_E, empty_inter] + exact notMem_empty e + · intro e he + rw [hspanV (H.plus_mem e he), hspanV (H.minus_mem e he)] + exact ⟨mem_singleton _, mem_singleton _⟩ + · intro v hv + rw [hspanV hv.1] + exact mem_singleton v + +/-- Strengthened surrounding relation for Graph Minors VII, (3.4) (page 220). The paper's definition +omits that distinct components of `H` meeting `bd(Σ)` lie in distinct regions of `G`. Here, in +addition to +`MatchingSurroundsForest G H`, distinct components of `H` meeting `bd(Σ)` lie in distinct regions +of `G` (so any two boundary vertices of `H` lying in the same region of `G` are joined by a simple +walk in `H`). Without this condition, Claim (2) of (3.4) fails on a closed disc when a single region +of `G` contains two boundary vertices `y₁, y₂ ∈ Y`. -/ +def MatchingStrictlySurroundsForest (G H : Drawing S) : Prop := + MatchingSurroundsForest G H ∧ + ∀ s ∈ H.V ∩ bd S, ∀ t ∈ H.V ∩ bd S, s ≠ t → + ∀ r ∈ G.R, s ∈ r → t ∈ r → ∃ P : GraphWalk H.toGraph s t, P.IsSimple + +/-- Graph Minors VII, (3.4), Claim (1) (page 220): +For any surface `Σ` and finite `Y ⊆ bd(Σ)`, choosing pairwise disjoint boundary `I`-arcs `F_y` +(`y ∈ Y`) with `y ∈ F_y \ lineEnds F_y` and letting `X` be the set of ends of all the `F_y` +(`|X| = 2|Y|`), every `Y`-forest `H` in `Σ` is surrounded by some `X`-matching `G` in `Σ` +(obtained by thickening each component of `H` into a closed disc meeting `bd(Σ)` in the +corresponding `F_y`). The surrounding here is the strict one. The statement is proved as +`forestSurroundingMatching` in `GM07/CuffSlide.lean`. -/ +def ForestSurroundingMatchingStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S], IsSurface S → + ∀ {Y : Set S}, Y ⊆ bd S → Y.Finite → + ∃ X : Set S, X ⊆ bd S ∧ X.Finite ∧ X.ncard = 2 * Y.ncard ∧ + ∀ H : Drawing S, IsYForest Y H → + ∃ G : Drawing S, IsXMatching X G ∧ MatchingStrictlySurroundsForest G H + +/-- Graph Minors VII, (3.5) (page 221): +"(3.5) *For every matching $G$ in $\Sigma$ and every homoplasty class $\mathscr{B}$ there exists +$H \in \mathscr{B}$ with $U(G) \cap U(H)$ finite.*" The statement is proved as +`forestMatchingFiniteIntersection` in `GM07/Section35.lean`. -/ +def ForestMatchingFiniteIntersectionStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S], IsSurface S → + ∀ G H₀ : Drawing S, IsMatching G → IsSurfaceForest H₀ → + ∃ H : Drawing S, IsSurfaceForest H ∧ ForestsHomoplastic H₀ H ∧ (G.U ∩ H.U).Finite + +/-- Graph Minors VII, (4.1) (page 221): +Translation on a closed disc `Δ` between Theorem (3.6) of Graph Minors VI (`GM06.Statement36`, +stated in terms of divisions and `(x, y)`-chains) and Graph Minors VII, (4.1) (stated in terms of +`IsGFeasible G H` and `G`-normal proper `I`-arcs `F` separating components of `H`). The statement +is proved as `discFeasibilityArcTranslation` in `GM07/Section41.lean`. -/ +def DiscFeasibilityArcTranslationStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsSurface S → IsClosedDisc (univ : Set S) → + ∀ G H : Drawing S, G.IsProper → IsSurfaceForest H → + H.V ∩ bd S = G.V ∩ bd S → + (IsGFeasible G H ↔ + ∀ (F : Set S) (s t : S) (C₁ C₂ : Set S), + G.IsNormal F → IsProperIArc F → IsLineWithEnds F s t → + componentsIn (bd S \ {s, t}) = {C₁, C₂} → C₁ ≠ C₂ → + {V₀ : Set S | ∃ H' : Drawing S, + GM06.IsGraphComponent H'.toGraph H.toGraph ∧ V₀ = H'.V ∧ + (V₀ ∩ C₁).Nonempty ∧ (V₀ ∩ C₂).Nonempty ∧ s ∉ V₀ ∧ t ∉ V₀}.ncard ≤ + (G.V ∩ (F \ {s, t})).ncard) + +/-- Corrected conclusion of Graph Minors VII, (4.3) (pages 222–223). The indexed paths may +repeat when a path has no internal vertex. The printed statement reads: +"(4.3) *Let $\Sigma$ be a connected surface with at least two cuffs, and let $G$ be a proper graph +in $\Sigma$. Let $v \ge 0$ be an integer, and suppose that every $G$-normal $O$-arc $F$ with +$F \cap bd(\Sigma) = \emptyset$ and $|V(G) \cap F| \le v$ is null-homotopic. Let $C$ be a cuff. +Then there are at least $v + 1$ paths of $G$, each with one end in $C$ and the other in +$bd(\Sigma) - C$, mutually vertex-disjoint except for their ends.*" -/ +def CuffToRestDisjointPathsStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsSurface S → ConnectedSpace S → 2 ≤ (cuffs S).ncard → + ∀ (G : Drawing S) (v : ℕ), G.IsProper → + (∀ F : Set S, G.IsNormal F → IsOArc F → F ∩ bd S = ∅ → (G.V ∩ F).ncard ≤ v → + IsNullHomotopicOArc F) → + ∀ C ∈ cuffs S, + ∃ (P : Fin (v + 1) → Drawing S) (s t : Fin (v + 1) → S), + (∀ i : Fin (v + 1), (P i).IsSubdrawing G ∧ s i ∈ C ∧ t i ∈ bd S \ C ∧ + (P i).IsPathBetween (s i) (t i)) ∧ + (∀ i j : Fin (v + 1), i ≠ j → + Disjoint ((P i).V \ {s i, t i}) ((P j).V \ {s j, t j})) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/DiscChain.lean b/LeanPool/GraphMinor/GM07/DiscChain.lean new file mode 100644 index 0000000000..db4c319c05 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/DiscChain.lean @@ -0,0 +1,295 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.DualExists +public import LeanPool.GraphMinor.GM06.RegionCurve +public import LeanPool.GraphMinor.GM07.Section11 +public import LeanPool.GraphMinor.GM11.Section6 +public import LeanPool.GraphMinor.GM14.Section6c +public import LeanPool.GraphMinor.Surface.CutLift + +/-! +# From a chain to a normal arc in a disc + +(4.1) of Graph Minors VII (page 221) is (3.6) of Graph Minors VI, "stated in different language". +The chains of VI are lists of vertices and +regions. The arcs of VII are lines. Here we go from a chain with distinct ends `x, y` to a proper +`I`-arc from `x` to `y` that meets `G` only in +vertices of the chain (`exists_arc_of_chain`). The line runs inside the regions of the chain, off +`bd(Σ)`, and through the vertices of the chain. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM06 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A closed disc that is all of `S` makes `S` a closed disc space. -/ +theorem isClosedDiscSpace_of_univ (hD : IsClosedDisc (univ : Set S)) : IsClosedDiscSpace S := by + obtain ⟨φ⟩ := hD + exact ⟨φ.trans (Homeomorph.Set.univ S)⟩ + +theorem discBd_univ_eq : discBd (univ : Set S) = bd S := by + simpa [discBd, Homeomorph.Set.univ] using image_bd_homeomorph (Homeomorph.Set.univ S) + +/-- A region without `bd(Σ)` is path connected. -/ +theorem isPathConnected_region_sdiff_bd (hDS : IsClosedDiscSpace S) (G : Drawing S) {r : Set S} + (hr : r ∈ G.R) : + IsPathConnected (r \ bd S) := by + have : LocallyPathConnectedSpace S := locallyPathConnectedSpace_of_isClosedDiscSpace hDS + have ho : IsOpen r := isOpen_region hDS G hr + have hc : IsPreconnected r := (isPathConnected_region hDS G hr).isConnected.isPreconnected + have hne : r.Nonempty := (isPathConnected_region hDS G hr).nonempty + have ho' : IsOpen (r \ bd S) := ho.sdiff (isClosed_bd_of_isClosedDiscSpace hDS) + exact ho'.isConnected_iff_isPathConnected.mp ⟨open_sdiff_bd_nonempty hDS ho hne, + isPreconnected_sdiff_bd_of_isOpen hDS ho hc⟩ + +/-- From a point in the closure of a region there is a curve into the region that leaves `bd(Σ)` at +once. -/ +theorem exists_entry (hD : IsClosedDisc (univ : Set S)) {G : Drawing S} + (hG : G.IsProper) {r : Set S} (hr : r ∈ G.R) {p : S} (hp : p ∈ closure r) : + ∃ α : C(unitInterval, S), α 0 = p ∧ ∀ t : unitInterval, 0 < (t : ℝ) → α t ∈ r \ bd S := by + have hDS := isClosedDiscSpace_of_univ hD + by_cases hpU : p ∈ G.U + · exact exists_region_entry_path_of_mem_U G hDS hG r hr p hp hpU + obtain ⟨β, hβ0, hβ⟩ := exists_region_entry_path G hDS hG r hr p hp + have hdis : Disjoint (range β) G.U := disjoint_left.mpr fun z ⟨t, ht⟩ hz => by + rcases eq_or_lt_of_le (t.2.1 : (0 : ℝ) ≤ t) with h0 | h0 + · have : t = 0 := Subtype.ext h0.symm + rw [this, hβ0] at ht + exact hpU (ht ▸ hz) + · rcases hr with ⟨z₀, -, rfl⟩ + exact (connectedComponentIn_subset _ _ (hβ t h0)).2 (ht ▸ hz) + have hsub : range β ⊆ r := region_subset_of_isPreconnected G hr (isPreconnected_range + β.continuous) hdis ⟨β 1, ⟨1, rfl⟩, hβ 1 (by simp)⟩ + have hpr : p ∈ r := hsub ⟨0, hβ0⟩ + by_cases hpb : p ∈ bd S + · exact exists_curve_of_half_nbhd hD (isOpen_region hDS G hr) (by rwa [discBd_univ_eq]) hpr + (fun z hz => ⟨hz.1.1, by rw [discBd_univ_eq] at hz; exact hz.2⟩) + · exact ⟨ContinuousMap.const _ p, rfl, fun _ _ => ⟨hpr, hpb⟩⟩ + +/-- The set in the surface that a term of a chain stands for: a vertex, or a region without `bd(Σ)`. +-/ +def termSet : ChainTerm S → Set S + | .inl v => {v} + | .inr r => r \ bd S + +theorem isPathConnected_insert_region (hD : IsClosedDisc (univ : Set S)) {G : Drawing S} + (hG : G.IsProper) {r : Set S} (hr : r ∈ G.R) {v : S} (hv : v ∈ closure r) : + IsPathConnected ({v} ∪ (r \ bd S)) := by + have hDS := isClosedDiscSpace_of_univ hD + obtain ⟨α, h0, h1⟩ := exists_entry hD hG hr hv + have heq : {v} ∪ (r \ bd S) = range α ∪ (r \ bd S) := by + apply subset_antisymm + · rintro z (rfl | hz) + · exact .inl ⟨0, h0⟩ + · exact .inr hz + · rintro z (⟨t, rfl⟩ | hz) + · rcases eq_or_lt_of_le (t.2.1 : (0 : ℝ) ≤ t) with h2 | h2 + · have : t = 0 := Subtype.ext h2.symm + rw [this, h0] + exact .inl rfl + · exact .inr (h1 t h2) + · exact .inr hz + rw [heq] + have hpc : PathConnectedSpace unitInterval := isPathConnected_iff_pathConnectedSpace.mp + ((convex_Icc (0 : ℝ) 1).isPathConnected ⟨0, by simp⟩) + have hrange : IsPathConnected (range α) := isPathConnected_range α.continuous + exact hrange.union (isPathConnected_region_sdiff_bd hDS G hr) ⟨α 1, ⟨1, rfl⟩, h1 1 (by simp)⟩ + +theorem isPathConnected_termSet_union (hD : IsClosedDisc (univ : Set S)) {G : Drawing S} + (hG : G.IsProper) {t t' : ChainTerm S} (h : ChainTerm.AreIncident G t t') : + IsPathConnected (termSet t ∪ termSet t') := by + rcases t with v | r <;> rcases t' with v' | r' + · exact h.elim + · exact isPathConnected_insert_region hD hG h.2.1 h.2.2 + · rw [union_comm] + exact isPathConnected_insert_region hD hG h.2.1 h.2.2 + · exact h.elim + +/-- The sets of the terms of a chain have a path connected union. -/ +theorem isPathConnected_chain (hD : IsClosedDisc (univ : Set S)) {G : Drawing S} (hG : G.IsProper) : + ∀ {A : List (ChainTerm S)}, A ≠ [] → (∀ t ∈ A, t.IsValid G) → A.IsChain + (ChainTerm.AreIncident G) → IsPathConnected (⋃ t ∈ A, termSet t) + | [], h, _, _ => (h rfl).elim + | [t], _, hv, _ => by + have hDS := isClosedDiscSpace_of_univ hD + simp only [List.mem_singleton, iUnion_iUnion_eq_left] + rcases t with v | r + · exact isPathConnected_singleton v + · exact isPathConnected_region_sdiff_bd hDS G (hv (.inr r) (by simp)) + | t :: t' :: l, _, hv, hc => by + rw [List.isChain_cons_cons] at hc + have ih := isPathConnected_chain hD hG (A := t' :: l) (by simp) (fun u hu => hv u + (List.mem_cons_of_mem _ hu)) hc.2 + have hsplit : (⋃ u ∈ t :: t' :: l, termSet u) = (termSet t ∪ termSet t') ∪ ⋃ u ∈ t' :: l, + termSet u := by + ext z + simp only [mem_iUnion, List.mem_cons, exists_prop, mem_union] + constructor + · rintro ⟨u, rfl | hu, hz⟩ + · exact .inl (.inl hz) + · exact .inr ⟨u, hu, hz⟩ + · rintro ((h | h) | ⟨u, hu, h⟩) + · exact ⟨t, .inl rfl, h⟩ + · exact ⟨t', .inr (.inl rfl), h⟩ + · exact ⟨u, .inr hu, h⟩ + rw [hsplit] + have hne : (termSet t').Nonempty := by + have hDS := isClosedDiscSpace_of_univ hD + rcases t' with v | r + · exact ⟨v, rfl⟩ + · exact (isPathConnected_region_sdiff_bd hDS G (hv (.inr r) (by simp))).nonempty + obtain ⟨z, hz⟩ := hne + refine (isPathConnected_termSet_union hD hG hc.1).union ih ⟨z, .inr hz, ?_⟩ + simp only [mem_iUnion, exists_prop] + exact ⟨t', by simp, hz⟩ + +/-- An end of a chain is joined to the sets of the terms. -/ +theorem exists_end_joined (hD : IsClosedDisc (univ : Set S)) {G : Drawing S} + (hG : G.IsProper) {A : List (ChainTerm S)} {t : ChainTerm S} (ht : t ∈ A) + (hv : t.IsValid G) {x : S} (hx : t.MatchesEnd x) : ∃ a ∈ ⋃ u ∈ A, termSet u, JoinedIn + ({x} ∪ ⋃ u ∈ A, termSet u) x a := by + have hmem : ∀ z ∈ termSet t, z ∈ ⋃ u ∈ A, termSet u := fun z hz => by + simp only [mem_iUnion, exists_prop] + exact ⟨t, ht, hz⟩ + rcases t with v | r + · obtain rfl : v = x := hx + exact ⟨v, hmem v rfl, JoinedIn.refl (.inl rfl)⟩ + · obtain ⟨α, h0, h1⟩ := exists_entry hD hG hv (subset_closure hx) + refine ⟨α 1, hmem _ (h1 1 (by simp)), ⟨⟨α, h0, rfl⟩, fun t => ?_⟩⟩ + rcases eq_or_lt_of_le (t.2.1 : (0 : ℝ) ≤ t) with h2 | h2 + · have : t = 0 := Subtype.ext h2.symm + change α t ∈ _ + rw [this, h0] + exact .inl rfl + · exact .inr (hmem _ (h1 t h2)) + +/-- A term of a chain that is a vertex in `bd(Σ)` is an end of the chain. -/ +theorem inl_mem_bd_eq {G : Drawing S} {x y : S} {A : List (ChainTerm S)} + (hA : IsXYChain G x y A) {v : S} (hv : Sum.inl v ∈ A) (hb : v ∈ bd S) : v = x ∨ v = y := by + obtain ⟨i, hi, h⟩ := List.getElem_of_mem hv + have hvG : v ∈ G.V := hA.valid _ hv + have hp : (A[i]).IsPeripheral G := by + rw [h] + exact ⟨hvG, hb⟩ + rcases (hA.peripheral_iff ⟨i, hi⟩).mp hp with h0 | h1 + · left + have h2 : A.head hA.ne_nil = Sum.inl v := by + rw [List.head_eq_getElem] + simp only at h0 + simp only [← h0] + exact h + have h3 := hA.head_matches + rw [h2] at h3 + exact h3 + · right + have h2 : A.getLast hA.ne_nil = Sum.inl v := by + rw [List.getLast_eq_getElem] + simp only at h1 + have h3 : A.length - 1 = i := by omega + simp only [h3] + exact h + have h3 := hA.last_matches + rw [h2] at h3 + exact h3 + +/-- **From a chain to an arc.** A chain between distinct points `x, y` of `bd(Σ)` gives a proper +`I`-arc from `x` to `y` that is `G`-normal, and +whose vertices of `G` other than `x, y` are terms of the chain. -/ +theorem exists_arc_of_chain (hD : IsClosedDisc (univ : Set S)) [T2Space S] {G : Drawing S} + (hG : G.IsProper) {x y : S} {A : List (ChainTerm S)} (hA : IsXYChain G x y A) + (hx : x ∈ bd S) (hy : y ∈ bd S) (hne : x ≠ y) : + ∃ F, IsLineWithEnds F x y ∧ F ∩ bd S = {x, y} ∧ G.IsNormal F ∧ ∀ w ∈ F, w ∈ G.V → w ≠ x → w ≠ y + → .inl w ∈ A := by + have hmemA : ∀ t ∈ A, t.IsValid G := hA.valid + have hcon := isPathConnected_chain hD hG hA.ne_nil hA.valid hA.isChain + obtain ⟨a, ha, hJa⟩ := exists_end_joined hD hG (List.head_mem hA.ne_nil) (hA.valid _ + (List.head_mem hA.ne_nil)) hA.head_matches + obtain ⟨b, hb, hJb⟩ := exists_end_joined hD hG (List.getLast_mem hA.ne_nil) (hA.valid _ + (List.getLast_mem hA.ne_nil)) hA.last_matches + let Zc : Set S := ⋃ u ∈ A, termSet u + let Z : Set S := {x} ∪ Zc ∪ {y} + have hJ : JoinedIn Z x y := by + have h1 : JoinedIn Z x a := hJa.mono subset_union_left + have h2 : JoinedIn Z a b := (hcon.joinedIn a ha b hb).mono ((subset_union_right).trans + subset_union_left) + have h3 : JoinedIn Z y b := hJb.mono (union_subset ((subset_union_right)) + ((subset_union_right).trans subset_union_left)) + exact (h1.trans h2).trans h3.symm + obtain ⟨F, hFZ, hF⟩ := ((joinedIn_iff_eq_or_exists_isLineWithEnds hJ.source_mem hJ.target_mem).mp + hJ).resolve_left hne + have hZ : ∀ z ∈ Z, z = x ∨ z = y ∨ (.inl z ∈ A ∧ z ∉ bd S) ∨ (z ∉ G.U ∧ z ∉ bd S) := by + rintro z ((rfl | hz) | rfl) + · exact .inl rfl + · simp only [Zc, mem_iUnion, exists_prop] at hz + obtain ⟨t, ht, hzt⟩ := hz + rcases t with v | r + · obtain rfl : z = v := hzt + by_cases hzb : z ∈ bd S + · rcases inl_mem_bd_eq hA ht hzb with h | h + · exact .inl h + · exact .inr (.inl h) + · exact .inr (.inr (.inl ⟨ht, hzb⟩)) + · have hr : r ∈ G.R := hA.valid _ ht + refine .inr (.inr (.inr ⟨?_, hzt.2⟩)) + rcases hr with ⟨z₀, -, rfl⟩ + exact (connectedComponentIn_subset _ _ hzt.1).2 + · exact .inr (.inl rfl) + refine ⟨F, hF, ?_, ?_, ?_⟩ + · apply subset_antisymm + · rintro z ⟨hz, hzb⟩ + rcases hZ z (hFZ hz) with h | h | ⟨-, h⟩ | ⟨-, h⟩ + · exact .inl h + · exact .inr h + · exact (h hzb).elim + · exact (h hzb).elim + · rintro z (rfl | h) + · exact ⟨hF.left_mem, hx⟩ + · obtain rfl : z = y := h + exact ⟨hF.right_mem, hy⟩ + · rintro z ⟨hzF, hzU⟩ + rcases hZ z (hFZ hzF) with rfl | rfl | ⟨h, -⟩ | ⟨h, -⟩ + · exact hG ⟨hx, hzU⟩ + · exact hG ⟨hy, hzU⟩ + · have : ChainTerm.IsValid G (Sum.inl z) := hA.valid _ h + exact this + · exact (h hzU).elim + · intro w hw hV h1 h2 + rcases hZ w (hFZ hw) with h | h | ⟨h, -⟩ | ⟨h, -⟩ + · exact (h1 h).elim + · exact (h2 h).elim + · exact h + · exact (h (G.V_subset_U hV)).elim + +/-- Two distinct points cut an `O`-arc into two components. -/ +theorem exists_two_comps [T2Space S] {C : Set S} (hC : IsOArc C) {x y : S} (hx : x ∈ C) + (hy : y ∈ C) (hne : x ≠ y) : + ∃ C₁ C₂, componentsIn (C \ {x, y}) = {C₁, C₂} ∧ C₁ ≠ C₂ := by + obtain ⟨A, B, hA, hB, hU, hI⟩ := hC.lines hx hy hne + have hsub : ∀ {L : Set S}, IsLineWithEnds L x y → closure (L \ {x, y}) ⊆ L := fun hL + => closure_minimal sdiff_subset hL.isCompact.isClosed + have hAB : Disjoint (closure (A \ {x, y})) (B \ {x, y}) := disjoint_left.mpr fun z h1 h2 => h2.2 + (hI ▸ ⟨hsub hA h1, h2.1⟩) + have hBA : Disjoint (A \ {x, y}) (closure (B \ {x, y})) := disjoint_left.mpr fun z h1 h2 => h1.2 + (hI ▸ ⟨h1.1, hsub hB h2⟩) + refine ⟨A \ {x, y}, B \ {x, y}, ?_, fun e => ?_⟩ + · rw [← componentsIn_union_eq_pair (GM11.IsLineWithEnds.isPreconnected_sdiff_pair hA) + (GM11.IsLineWithEnds.isPreconnected_sdiff_pair hB) (GM14.IsLineWithEnds.nonempty_sdiff_pair + hA) (GM14.IsLineWithEnds.nonempty_sdiff_pair hB) hAB hBA, ← union_sdiff_distrib, hU] + · obtain ⟨z, hz⟩ := GM14.IsLineWithEnds.nonempty_sdiff_pair hA + exact disjoint_left.mp (hAB.mono_left subset_closure) hz (e ▸ hz) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/DiscPlace.lean b/LeanPool/GraphMinor/GM07/DiscPlace.lean new file mode 100644 index 0000000000..d5bdc57103 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/DiscPlace.lean @@ -0,0 +1,319 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.MoveOff +public import LeanPool.GraphMinor.Surface.Collar +import LeanPool.GraphMinor.GM12.Section4MarkedDiscMatch + +/-! +# Placing discs + +Tools for step 2 of (9.1), page 243. Finitely many disjoint closed discs off the boundary go onto +finitely many others, with two marked boundary +points of each going to two given ones, by a homeomorphism fixing the boundary +(`exists_disc_family_placement`). We cap all the cuffs and move one +disc at a time, keeping the caps and the discs already placed fixed. A line off the boundary is a +chord of a closed disc inside any open set +around it (`exists_chord_disc`). `GraphMinor/GM07/ArcPlace.lean` uses both to map lines onto lines. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +/-- Finitely many disjoint discs off the boundary go to others, with two marked points on each +boundary, by a homeomorphism fixing the boundary. -/ +theorem exists_disc_family_placement {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) [ConnectedSpace S] {ι : Type*} [Finite ι] (A B : ι → Set S) + (hA : ∀ i, IsClosedDisc (A i)) (hB : ∀ i, IsClosedDisc (B i)) (hAA : Pairwise fun i j + => Disjoint (A i) (A j)) + (hBB : Pairwise fun i j => Disjoint (B i) (B j)) (hAb : ∀ i, Disjoint (A i) (bd S)) + (hBb : ∀ i, Disjoint (B i) (bd S)) + (a b a' b' : ι → S) (ha : ∀ i, a i ∈ discBd (A i)) (hb : ∀ i, b i ∈ discBd (A i)) + (hab : ∀ i, a i ≠ b i) + (ha' : ∀ i, a' i ∈ discBd (B i)) (hb' : ∀ i, b' i ∈ discBd (B i)) (hab' : ∀ i, a' i ≠ b' i) : + ∃ e : S ≃ₜ S, (∀ x ∈ bd S, e x = x) ∧ ∀ i, e '' A i = B i ∧ e (a i) = a' i ∧ e (b i) = b' i + := by + classical + have ht2 : T2Space S := hS.2.1 + obtain ⟨T, tT, j, K, hT, hj, hK, hun, hint, hconn, 𝓓, hfD, hUD, hdD, hdisjD⟩ + := exists_capAll_discs S hS + have : ConnectedSpace T := hconn inferInstance + have ht2T : T2Space T := hT.2.1 + have hjinj := hj.injective + have hjc := hj.continuous + -- The images in the capped surface. + have hdisc : ∀ {D : Set S}, IsClosedDisc D → IsClosedDisc (j '' D) ∧ discBd (j '' D) + = j '' discBd D := fun hD => + isClosedDisc_image_of_injOn hD hjc hjinj.injOn + have hoffK : ∀ {D : Set S}, Disjoint D (bd S) → Disjoint (j '' D) K := fun {D} hD => by + rw [disjoint_left] + rintro _ ⟨x, hx, rfl⟩ hK' + have h1 : j x ∈ range j ∩ K := ⟨mem_range_self _, hK'⟩ + rw [hint] at h1 + obtain ⟨y, hy, he⟩ := h1 + rw [hjinj he] at hy + exact disjoint_left.mp hD hx hy + have hdisjimg : ∀ {D D' : Set S}, Disjoint D D' → Disjoint (j '' D) (j '' D') := fun h => + (disjoint_image_iff hjinj).mpr h + have key : ∀ F : Set ι, F.Finite → ∃ e : T ≃ₜ T, (∀ z ∈ K, e z = z) ∧ ∀ i ∈ F, e '' (j '' A i) + = j '' B i ∧ e (j (a i)) = j (a' i) ∧ e (j (b i)) = j (b' i) := by + intro F hF + induction F, hF using Set.Finite.induction_on with + | empty => exact ⟨Homeomorph.refl T, fun _ _ => rfl, by simp⟩ + | @insert i F hi hF ih => + obtain ⟨e, hefix, he⟩ := ih + -- The discs to protect: the caps, and the discs placed so far. + let D : 𝓓 ⊕ F → Set T := Sum.elim (fun d => d.1) fun l => j '' B l.1 + have hD : ∀ l, IsClosedDisc (D l) := fun l => by + rcases l with d | l + · exact (hdD d.1 d.2).1 + · exact (hdisc (hB l.1)).1 + have hKsub : ∀ d ∈ 𝓓, d ⊆ K := fun d hd => hUD ▸ subset_sUnion_of_mem hd + have hDD : Pairwise fun l m => Disjoint (D l) (D m) := by + rintro (d | l) (d' | m) hne + · exact hdisjD d.1 d.2 d'.1 d'.2 fun h => hne (congrArg Sum.inl (Subtype.ext h)) + · exact ((hoffK (hBb m.1)).mono_right (hKsub d.1 d.2)).symm + · exact (hoffK (hBb l.1)).mono_right (hKsub d'.1 d'.2) + · exact hdisjimg (hBB fun h => hne (congrArg Sum.inr (Subtype.ext h))) + have hei := isClosedDisc_image_of_injOn (hdisc (hA i)).1 e.continuous e.injective.injOn + have hAD : Disjoint (e '' (j '' A i)) (⋃ l, D l) := by + rw [disjoint_iUnion_right] + rintro (d | l) + · rw [disjoint_left] + rintro _ ⟨x, hx, rfl⟩ hz + have h1 : e x = x := by + have h2 := hefix _ (hKsub d.1 d.2 hz) + exact e.injective h2 + rw [h1] at hz + exact disjoint_left.mp (hoffK (hAb i)) hx (hKsub d.1 d.2 hz) + · change Disjoint _ (j '' B l.1) + rw [← (he l.1 l.2).1] + refine (disjoint_image_iff e.injective).mpr (hdisjimg (hAA ?_)) + rintro rfl + exact hi l.2 + have hBD : Disjoint (j '' B i) (⋃ l, D l) := by + rw [disjoint_iUnion_right] + rintro (d | l) + · exact (hoffK (hBb i)).mono_right (hKsub d.1 d.2) + · refine hdisjimg (hBB ?_) + rintro rfl + exact hi l.2 + have hbdmem : ∀ {x : S}, x ∈ discBd (A i) → e (j x) ∈ discBd (e '' (j '' A i)) := fun {x} hx + => by + rw [hei.2, (hdisc (hA i)).2] + exact ⟨j x, ⟨x, hx, rfl⟩, rfl⟩ + have hbdB : ∀ {x : S}, x ∈ discBd (B i) → j x ∈ discBd (j '' B i) := fun {x} hx => by + rw [(hdisc (hB i)).2] + exact ⟨x, hx, rfl⟩ + have : Finite 𝓓 := hfD + have : Finite F := hF + obtain ⟨g, hg1, hg2, hg3, hg4⟩ := GraphMinor.GM12.exists_marked_disc_match_fixing_discs hT D + hD hDD hei.1 (hdisc (hB i)).1 hAD hBD + (hbdmem (ha i)) (hbdmem (hb i)) (fun h => hab i (hjinj (e.injective h))) (hbdB (ha' i)) + (hbdB (hb' i)) fun h => hab' i (hjinj h) + refine ⟨e.trans g, fun z hz => ?_, ?_⟩ + · rw [Homeomorph.trans_apply, hefix z hz] + rw [← hUD] at hz + obtain ⟨d, hd, hzd⟩ := hz + exact hg4 (.inl ⟨d, hd⟩) z hzd + · rintro l (rfl | hl) + · refine ⟨?_, hg2, hg3⟩ + rw [← hg1] + change (g ∘ e) '' _ = _ + rw [image_comp] + · obtain ⟨h1, h2, h3⟩ := he l hl + have hfixB : ∀ z ∈ j '' B l, g z = z := fun z hz => hg4 (.inr ⟨l, hl⟩) z hz + have hmem : ∀ {x : S}, x ∈ B l → g (j x) = j x := fun {x} hx => hfixB _ ⟨x, hx, rfl⟩ + refine ⟨?_, ?_, ?_⟩ + · change (fun x => g (e x)) '' _ = _ + rw [show (fun x => g (e x)) = g ∘ e from rfl, image_comp, h1] + exact (image_congr hfixB).trans (image_id' _) + · rw [Homeomorph.trans_apply, h2, hmem (Surface.discBd_subset _ (ha' l))] + · rw [Homeomorph.trans_apply, h3, hmem (Surface.discBd_subset _ (hb' l))] + obtain ⟨e, hefix, he⟩ := key univ (toFinite _) + -- Restrict to the surface. + have hrange : ∀ (e₀ : T ≃ₜ T), (∀ z ∈ K, e₀ z = z) → ∀ x, e₀ (j x) ∈ range j := fun e₀ h0 x => by + by_contra hn + have h1 : e₀ (j x) ∈ K := (hun.ge (mem_univ _)).resolve_left hn + have h2 := h0 _ h1 + have h3 : e₀ (j x) = j x := e₀.injective h2 + rw [h3] at hn + exact hn (mem_range_self x) + have hne : Nonempty S := inferInstance + let J : T → S := invFun j + have hJ : ∀ x, J (j x) = x := leftInverse_invFun hjinj + have hjJ : ∀ y ∈ range j, j (J y) = y := fun y ⟨x, hx⟩ => by rw [← hx, hJ] + have hefixs : ∀ z ∈ K, e.symm z = z := fun z hz => by + rw [Homeomorph.symm_apply_eq, hefix z hz] + have hdown : ∀ (e₀ : T ≃ₜ T), (∀ z ∈ K, e₀ z = z) → ∃ d : S → S, Continuous d ∧ ∀ x, j (d x) = e₀ + (j x) := fun e₀ h0 => by + refine ⟨fun x => J (e₀ (j x)), ?_, fun x => hjJ _ (hrange e₀ h0 x)⟩ + rw [hj.isEmbedding.continuous_iff] + have : j ∘ (fun x => J (e₀ (j x))) = e₀ ∘ j := funext fun x => hjJ _ (hrange e₀ h0 x) + rw [this] + exact e₀.continuous.comp hjc + obtain ⟨d₁, hd₁, h₁⟩ := hdown e hefix + obtain ⟨d₂, hd₂, h₂⟩ := hdown e.symm hefixs + have hbdK : ∀ x ∈ bd S, j x ∈ K := fun x hx => by + have : j x ∈ j '' bd S := ⟨x, hx, rfl⟩ + rw [← hint] at this + exact this.2 + refine ⟨⟨⟨d₁, d₂, fun x => hjinj ?_, fun x => hjinj ?_⟩, hd₁, hd₂⟩, fun x hx => hjinj ?_, + fun i => ?_⟩ + · rw [h₂, h₁, Homeomorph.symm_apply_apply] + · rw [h₁, h₂, Homeomorph.apply_symm_apply] + · exact (h₁ x).trans (hefix _ (hbdK x hx)) + · obtain ⟨h1, h2, h3⟩ := he i (mem_univ i) + refine ⟨?_, hjinj ((h₁ _).trans h2), hjinj ((h₁ _).trans h3)⟩ + apply hjinj.image_injective + change j '' (d₁ '' A i) = _ + rw [← h1, ← image_comp, ← image_comp] + exact image_congr fun x _ => h₁ x + +theorem isLineWithEnds_range_of_arc {X : Type*} [TopologicalSpace X] [T2Space X] {a : unitInterval + → X} (ha : IsArcMap a) : IsLineWithEnds (range a) (a 0) (a 1) := + ⟨(ha.1.isClosedEmbedding ha.2).isEmbedding.toHomeomorph, rfl, rfl⟩ + +theorem exists_line_chart {S : Type u} [TopologicalSpace S] {M : Type} [TopologicalSpace M] + (hM : IsSurface M) (h : S ≃ₜ M) {L : Set S} {u v : S} + (hL : IsLineWithEnds L u v) (hd : L ∩ bd S = ∅) {W : Set S} (hW : IsOpen W) (hLW : L ⊆ W) : + ∃ (K₀ : ℂ → S) (s : ℝ), 0 < s ∧ s < 1 ∧ ContinuousOn K₀ (closedBall 0 1) ∧ InjOn K₀ + (closedBall 0 1) ∧ K₀ '' closedBall 0 1 ⊆ W ∧ + (∀ z ∈ closedBall (0 : ℂ) 1, K₀ z ∉ bd S) ∧ K₀ (-s : ℝ) = u ∧ K₀ (s : ℝ) = v + ∧ ∀ x, x ∈ L ↔ ∃ z ∈ closedBall (0 : ℂ) 1, z.im = 0 ∧ |z.re| ≤ s ∧ K₀ z = x := by + have hbd : h '' bd S = bd M := image_bd_homeomorph h + have hb : ∀ x, x ∈ bd S ↔ h x ∈ bd M := fun x => by + rw [← hbd] + exact ⟨fun hx => ⟨x, hx, rfl⟩, fun ⟨y, hy, he⟩ => h.injective he ▸ hy⟩ + have hL' : IsLineWithEnds (h '' L) (h u) (h v) := by + obtain ⟨f, h0, h1⟩ := hL + refine ⟨f.trans (h.image L), ?_, ?_⟩ + · change h (f 0).1 = h u + rw [h0] + · change h (f 1).1 = h v + rw [h1] + obtain ⟨K₀, s, h1, h2, h3, h4, h5, h6, h7, h8, h9⟩ := exists_line_chart_aux hM hL' + (by rw [← hbd, ← image_inter h.injective, hd, image_empty]) + ((h.isOpenMap _ hW)) (image_mono hLW) + have hinv : ∀ x, h (h.symm x) = x := h.apply_symm_apply + refine ⟨h.symm ∘ K₀, s, h1, h2, h.symm.continuous.comp_continuousOn h3, + h.symm.injective.comp_injOn h4, ?_, fun z hz hb' => h6 z hz ?_, ?_, ?_, fun x => ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + obtain ⟨y, hy, he⟩ := h5 ⟨z, hz, rfl⟩ + change h.symm (K₀ z) ∈ W + rw [← he, h.symm_apply_apply] + exact hy + · have := (hb _).mp hb' + simpa [hinv] using this + · change h.symm (K₀ ((-s : ℝ) : ℂ)) = u + rw [h7, h.symm_apply_apply] + · change h.symm (K₀ ((s : ℝ) : ℂ)) = v + rw [h8, h.symm_apply_apply] + · constructor + · intro hx + obtain ⟨z, hz, h10, h11, h12⟩ := (h9 (h x)).mp ⟨x, hx, rfl⟩ + exact ⟨z, hz, h10, h11, by simp [h12]⟩ + · rintro ⟨z, hz, h10, h11, rfl⟩ + obtain ⟨y, hy, he⟩ := (h9 (K₀ z)).mpr ⟨z, hz, h10, h11, rfl⟩ + change h.symm (K₀ z) ∈ L + rw [← he, h.symm_apply_apply] + exact hy + +theorem isClosedDisc_of_chart {S : Type*} [TopologicalSpace S] [T2Space S] {K₀ : ℂ → S} + (hc : ContinuousOn K₀ (closedBall 0 1)) (hi : InjOn K₀ (closedBall 0 1)) + {c : ℂ} {ε : ℝ} (hε : 0 < ε) (hsub : closedBall c ε ⊆ closedBall 0 1) : + IsClosedDisc (K₀ '' closedBall c ε) ∧ discBd (K₀ '' closedBall c ε) = K₀ '' sphere c ε := by + have hne : Nonempty ℂ := ⟨0⟩ + let K₁ : ℂ → S := fun z => K₀ (c + z) + have hmap : ∀ z ∈ closedBall (0 : ℂ) ε, c + z ∈ closedBall c ε := fun z hz => by + rw [mem_closedBall, dist_eq_norm] + simpa using hz + have hc₁ : ContinuousOn K₁ (closedBall 0 ε) := (hc.mono hsub).comp (by fun_prop) hmap + have hi₁ : InjOn K₁ (closedBall 0 ε) := fun z hz w hw he => by + simpa using hi (hsub (hmap z hz)) (hsub (hmap w hw)) he + obtain ⟨hD, hDb⟩ := closedBall_disc hε + obtain ⟨K', hK'c, hK'l⟩ := Surface.exists_inv_of_compactOn (isCompact_closedBall _ _) hc₁ hi₁ + obtain ⟨hE, hEb⟩ := hD.image hc₁ hK'c hK'l + have h1 : K₁ '' closedBall 0 ε = K₀ '' closedBall c ε := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨_, hmap z hz, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + refine ⟨z - c, by simpa [dist_eq_norm] using hz, by simp [K₁]⟩ + have h2 : K₁ '' sphere 0 ε = K₀ '' sphere c ε := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨c + z, by simpa [dist_eq_norm] using hz, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + refine ⟨z - c, by simpa [dist_eq_norm] using hz, by simp [K₁]⟩ + rw [hDb, h2] at hEb + rw [h1] at hE hEb + exact ⟨hE, hEb⟩ + +/-- A disc around a line off the boundary, inside a given open set, with the line as a chord. -/ +theorem exists_chord_disc {S : Type u} [TopologicalSpace S] [T2Space S] {M : Type} + [TopologicalSpace M] (hM : IsSurface M) (h : S ≃ₜ M) {L : Set S} {u v : S} + (hL : IsLineWithEnds L u v) (hd : L ∩ bd S = ∅) {W : Set S} (hW : IsOpen W) (hLW : L ⊆ W) : + ∃ B, IsClosedDisc B ∧ L ⊆ B ∧ B ⊆ W ∧ Disjoint B (bd S) ∧ u ∈ discBd B ∧ v ∈ discBd B + ∧ L ∩ discBd B = {u, v} := by + obtain ⟨K₀, s, hs0, hs1, hc, hi, h1, h2, h3, h4, h5⟩ := exists_line_chart hM h hL hd hW hLW + have hsub : closedBall (0 : ℂ) s ⊆ closedBall 0 1 := closedBall_subset_closedBall hs1.le + obtain ⟨hB, hBb⟩ := isClosedDisc_of_chart hc hi hs0 hsub + have hsph : ∀ σ : ℝ, |σ| = s → (σ : ℂ) ∈ sphere (0 : ℂ) s := fun σ hσ => by + rw [mem_sphere_zero_iff_norm, Complex.norm_real, Real.norm_eq_abs, hσ] + refine ⟨K₀ '' closedBall 0 s, hB, fun x hx => ?_, (image_mono hsub).trans h1, ?_, ?_, ?_, ?_⟩ + · obtain ⟨z, hz, him, hre, rfl⟩ := (h5 x).mp hx + refine ⟨z, ?_, rfl⟩ + have : z = (z.re : ℂ) := Complex.ext (by simp) (by simp [him]) + rw [mem_closedBall_zero_iff, this, Complex.norm_real, Real.norm_eq_abs] + simpa using hre + · rw [disjoint_left] + rintro _ ⟨z, hz, rfl⟩ + exact h2 z (hsub hz) + · rw [hBb, ← h3] + exact ⟨_, by simp [abs_of_pos hs0], rfl⟩ + · rw [hBb, ← h4] + exact ⟨_, by simp [abs_of_pos hs0], rfl⟩ + · rw [hBb] + apply Subset.antisymm + · rintro x ⟨hxL, w, hw, rfl⟩ + obtain ⟨z, hz, him, hre, he⟩ := (h5 _).mp hxL + have hw1 : w ∈ closedBall (0 : ℂ) 1 := hsub (sphere_subset_closedBall hw) + have hzw : z = w := hi hz hw1 he + subst hzw + have hzr : z = (z.re : ℂ) := Complex.ext (by simp) (by simp [him]) + have hn : |z.re| = s := by + rw [mem_sphere_zero_iff_norm, hzr, Complex.norm_real, Real.norm_eq_abs] at hw + simpa using hw + rcases abs_eq hs0.le |>.mp hn with h6 | h6 + · right + rw [mem_singleton_iff, ← h4, hzr, h6] + · left + rw [← h3, hzr, h6] + · have hu : u ∈ L := (h5 u).mpr + ⟨_, hsub (sphere_subset_closedBall (hsph (-s) (by simp [abs_of_pos hs0]))), + by simp, by simp [abs_of_pos hs0], h3⟩ + have hv : v ∈ L := (h5 v).mpr + ⟨_, hsub (sphere_subset_closedBall (hsph s (by simp [abs_of_pos hs0]))), + by simp, by simp [abs_of_pos hs0], h4⟩ + rintro x (rfl | hx) + · exact ⟨hu, _, hsph (-s) (by simp [abs_of_pos hs0]), h3⟩ + · rw [mem_singleton_iff] at hx + subst hx + exact ⟨hv, _, hsph s (by simp [abs_of_pos hs0]), h4⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/DiscPrune.lean b/LeanPool/GraphMinor/GM07/DiscPrune.lean new file mode 100644 index 0000000000..54f14ecb7c --- /dev/null +++ b/LeanPool/GraphMinor/GM07/DiscPrune.lean @@ -0,0 +1,428 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.DiscPush +public import LeanPool.GraphMinor.GM07.CutEdge +import LeanPool.GraphMinor.GM19.FragmentOuter +import LeanPool.GraphMinor.GM07.CutBounds + +/-! +# Deleting what lies in a small disc + +Let `Δ` be a closed disc whose boundary is `G`-normal with at most one vertex, and let `G'` be `G` +with the inside of `Δ` removed. +The paper says "it is easy to see that `α(G') = α(G)`" in the proof of (7.3). We prove the +inequality it needs: each candidate for +`α(G')` gives a candidate for `α(G)` with at most as many vertices (`exists_candidate_of_prune`). + +The candidate `X'` of `G'` may run inside `Δ`. We first thin it: for each cuff, and for `Σ` itself, +we keep an `O`-arc of `X'` that +shows `X'` is not planar there, and we join these `O`-arcs by lines in `X'`. This thin set misses +some point `p` of the inside of `Δ`, +and we project from `p` to the boundary of `Δ`. The image of each `O`-arc is homotopic to it, so by +(11.2) it holds an `O`-arc with +the same property. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +local notation "𝕀" => unitInterval + +variable {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] + +/-- A line of a connected closed surface holds no open set. This is `GM19.line_subset_closure_compl` +for surfaces in any universe: +we move the line to a model by classification. -/ +theorem line_subset_closure_compl_of_closed [ConnectedSpace T] (hT : IsClosedSurface T) {L : Set T} + {a b : T} (hl : IsLineWithEnds L a b) : + L ⊆ closure Lᶜ := by + have : T2Space T := hT.2.1 + have : CompactSpace T := hT.1 + have hsurf : IsSurface T := hT.isSurface + obtain ⟨p, q, c, ⟨e⟩⟩ := classification.{u} T hsurf inferInstance + have hM : IsClosedSurface (SurfaceModel p q c) := by + refine ⟨e.surjective.compactSpace e.continuous, e.symm.isEmbedding.t2Space, fun x => ?_⟩ + have h1 := (isInteriorPoint_homeomorph_iff e (e.symm x)).mpr (hT.2.2 _) + simpa using h1 + have : T2Space (SurfaceModel p q c) := hM.2.1 + have : ConnectedSpace (SurfaceModel p q c) := e.surjective.connectedSpace e.continuous + have hl' : IsLineWithEnds (e '' L) (e a) (e b) := by + obtain ⟨f, h0, h1⟩ := hl + exact ⟨f.trans (e.isEmbedding.homeomorphImage L), congrArg e h0, congrArg e h1⟩ + intro x hx + have h1 := GM19.line_subset_closure_compl hM hl' (mem_image_of_mem e hx) + rw [← e.image_compl, ← e.image_closure] at h1 + obtain ⟨y, hy, he⟩ := h1 + rwa [← e.injective he] + +/-- A finite union of lines does not hold the inside of a closed disc. -/ +theorem exists_mem_discInt_off (hS : IsSurface S) [ConnectedSpace S] {Δ : Set S} + (hΔ : IsClosedDisc Δ) {𝓛 : Set (Set S)} + (hf : 𝓛.Finite) (hl : ∀ L ∈ 𝓛, ∃ a b, IsLineWithEnds L a b) : ∃ p ∈ discInt Δ, p ∉ ⋃₀ 𝓛 := by + obtain ⟨T, tT, j, K, hT, hj, hK, hu, hi, hconn⟩ := exists_capAll S hS + have : ConnectedSpace T := hconn inferInstance + have ht2 : T2Space T := hT.2.1 + have hS2 : T2Space S := hS.2.1 + have hman := hS.2.2 + have hgood : ∀ {𝓜 : Set (Set S)}, 𝓜.Finite → (∀ L ∈ 𝓜, ∃ a b, IsLineWithEnds L a b) → + IsClosed (j '' ⋃₀ 𝓜) ∧ Dense (j '' ⋃₀ 𝓜)ᶜ := fun {𝓜} hf' => by + induction 𝓜, hf' using Set.Finite.induction_on with + | empty => + intro _ + simp + | @insert L 𝓜 _ _ ih => + intro h + obtain ⟨h1, h2⟩ := ih fun L' hL' => h L' (mem_insert_of_mem _ hL') + obtain ⟨a, b, f, h0, h1'⟩ := h L (mem_insert _ _) + have hLc : IsCompact L := by + have h3 := isCompact_range (continuous_subtype_val.comp f.continuous) + rwa [range_comp, f.surjective.range_eq, image_univ, Subtype.range_coe] at h3 + have hline : IsLineWithEnds (j '' L) (j a) (j b) := by + refine ⟨f.trans (hj.isEmbedding.homeomorphImage L), ?_, ?_⟩ + · exact congrArg j h0 + · exact congrArg j h1' + have hcl : IsClosed (j '' L) := (hLc.image hj.continuous).isClosed + have hd : Dense (j '' L)ᶜ := fun x => by + by_cases hx : x ∈ j '' L + · exact line_subset_closure_compl_of_closed hT hline hx + · exact subset_closure hx + rw [sUnion_insert, image_union] + refine ⟨hcl.union h1, ?_⟩ + rw [compl_union] + exact hd.inter_of_isOpen_left h2 hcl.isOpen_compl + obtain ⟨-, hd⟩ := hgood hf hl + obtain ⟨h₁, g₁, cc⟩ := hΔ.exists_isChart + have hno : (discInt Δ).Nonempty := by + refine ⟨g₁ 0, cc.gm (by simp), fun hb => ?_⟩ + have h2 : h₁ (g₁ 0) ∈ sphere (0 : ℂ) 1 := cc.bd ▸ mem_image_of_mem h₁ hb + rw [cc.hg (by simp)] at h2 + simp at h2 + obtain ⟨p₁, hp₁⟩ := hno + obtain ⟨O, hO, hOe⟩ := hj.isInducing.isOpen_iff.mp (hΔ.isOpen_discInt hman) + have hoffK : ∀ {y}, y ∈ discInt Δ → j y ∉ K := fun {y} hy hc => by + have h1 : j y ∈ range j ∩ K := ⟨mem_range_self y, hc⟩ + rw [hi] at h1 + obtain ⟨z, hz, he⟩ := h1 + rw [hj.injective he] at hz + exact hz (isInteriorPoint_of_mem_discInt hman hΔ hy) + have hp₁O : j p₁ ∈ O ∩ Kᶜ := ⟨by + change p₁ ∈ j ⁻¹' O + rw [hOe] + exact hp₁, hoffK hp₁⟩ + obtain ⟨t, ⟨htO, htK⟩, htA⟩ := hd.inter_open_nonempty _ (hO.inter hK.isOpen_compl) ⟨_, hp₁O⟩ + have htr : t ∈ range j := (hu.ge (mem_univ t)).resolve_right htK + obtain ⟨p, rfl⟩ := htr + refine ⟨p, ?_, fun hc => htA (mem_image_of_mem j hc)⟩ + rw [← hOe] + exact htO + +/-- `O`-arcs split into two lines. -/ +theorem exists_two_lines [T2Space S] {F : Set S} (hF : IsOArc F) : + ∃ A B : Set S, (∃ a b, IsLineWithEnds A a b) ∧ (∃ a b, IsLineWithEnds B a b) ∧ F = A ∪ B := by + obtain ⟨φ⟩ := id hF + have hne : (φ 1).1 ≠ (φ (-1)).1 := fun h => by + have := φ.injective (Subtype.ext h) + have h' := congrArg (fun z : Circle => (z : ℂ)) this + norm_num at h' + obtain ⟨A, B, hA, hB, hu, -⟩ := hF.lines (φ 1).2 (φ (-1)).2 hne + exact ⟨A, B, ⟨_, _, hA⟩, ⟨_, _, hB⟩, hu.symm⟩ + +/-- A subset of a finite union of lines. -/ +def IsThin (X : Set S) : Prop := ∃ 𝓛 : Set (Set S), 𝓛.Finite ∧ (∀ L ∈ 𝓛, ∃ a b, IsLineWithEnds L a + b) ∧ X ⊆ ⋃₀ 𝓛 + +theorem isThin_iUnion {ι : Type*} [Finite ι] {P : ι → Set S} (h : ∀ i, IsThin (P i)) : IsThin + (⋃ i, P i) := by + choose 𝓛 h1 h2 h3 using h + refine ⟨⋃ i, 𝓛 i, finite_iUnion h1, ?_, ?_⟩ + · intro L hL + obtain ⟨i, hi⟩ := mem_iUnion.mp hL + exact h2 i L hi + · refine iUnion_subset fun i x hx => ?_ + obtain ⟨L, hL, hxL⟩ := h3 i hx + exact ⟨L, mem_iUnion.mpr ⟨i, hL⟩, hxL⟩ + +theorem isThin_union {A B : Set S} (hA : IsThin A) (hB : IsThin B) : IsThin (A ∪ B) := by + obtain ⟨𝓛, h1, h2, h3⟩ := hA + obtain ⟨𝓜, h4, h5, h6⟩ := hB + refine ⟨𝓛 ∪ 𝓜, h1.union h4, ?_, ?_⟩ + · rintro L (hL | hL) + · exact h2 L hL + · exact h5 L hL + · rw [sUnion_union] + exact union_subset_union h3 h6 + +theorem isThin_of_line {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : IsThin L := + ⟨{L}, finite_singleton L, fun _ hL => hL ▸ ⟨a, b, h⟩, by simp⟩ + +theorem isThin_of_isOArc [T2Space S] {F : Set S} (h : IsOArc F) : IsThin F := by + obtain ⟨A, B, ⟨a, b, hA⟩, ⟨c, d, hB⟩, rfl⟩ := exists_two_lines h + exact isThin_union (isThin_of_line hA) (isThin_of_line hB) + +/-- A set not planar in `T` has an `O`-arc that shows this and survives homotopy. -/ +theorem exists_obstruction {Y : Type u} [TopologicalSpace Y] [CompactSpace Y] [T2Space Y] + (hT : IsSurface T) [ConnectedSpace T] + {j : Y → T} (hj : IsEmbedding j) {X : Set Y} (hX : IsSolid X) (hne : ¬ IsSphere T + ∨ j '' X ≠ univ) + (hn : ¬ IsPlanar (j '' X)) : + ∃ A : Set Y, IsOArc A ∧ A ⊆ X ∧ ∃ f : C(Circle, Y), range f = A ∧ ∀ ψ : C(Circle, Y), + ClosedCurvesHomotopicIn univ f ψ → + ∃ A' : Set Y, IsOArc A' ∧ A' ⊆ range ψ ∧ ¬ IsPlanar (j '' A') := by + have : T2Space T := hT.2.1 + by_contra hno + refine hn (isPlanar_of_null hT hj hX hne fun F hF hFX f hf hr hc => ?_) + by_contra hnull + refine hno ⟨F, hF, hFX, ⟨f, hf⟩, hr, fun ψ hψ => ?_⟩ + have hψc : Continuous fun w => j (ψ w) := hj.continuous.comp ψ.continuous + have hnn : ¬ ClosedCurveIsNullHomotopicIn univ ⟨fun w => j (ψ w), hψc⟩ := fun h => by + apply hnull + refine null_of_homotopic (subset_univ _) ?_ h + obtain ⟨Ψ, -, h0, h1⟩ := hψ + refine ⟨⟨fun q => j (Ψ q), hj.continuous.comp Ψ.continuous⟩, fun _ => mem_univ _, + fun x => ?_, fun x => ?_⟩ + · simp [h0] + · simp [h1] + obtain ⟨F', hF', hsub, hnot⟩ := theorem_11_2_proof hT _ hnn + have hsubr : F' ⊆ range j := fun x hx => by + obtain ⟨w, hw⟩ := hsub hx + exact ⟨ψ w, hw⟩ + refine ⟨j ⁻¹' F', IsOArc.pull_of_embedding hj hF' hsubr, ?_, ?_⟩ + · intro y hy + obtain ⟨w, hw⟩ := hsub hy + exact ⟨w, hj.injective hw⟩ + · rw [image_preimage_eq_of_subset hsubr, isPlanar_iff_isNullHomotopicOArc_of_isOArc hT hF'] + exact hnot + +/-- The sets that show that `X` is not near-planar: for each cuff `C`, and for `none`, an `O`-arc. +-/ +theorem exists_obstructions (hS : IsSurface S) [ConnectedSpace S] (hns : ¬ IsSphere S) {X : Set S} + (hX : IsSolid X) + (hn : ¬ IsNearPlanar X) : + ∀ i : Option (cuffs S), ∃ A : Set S, IsOArc A ∧ A ⊆ X ∧ ∃ f : C(Circle, S), range f = A ∧ + ∀ ψ : C(Circle, S), ClosedCurvesHomotopicIn univ f ψ → + ∃ A' : Set S, IsOArc A' ∧ A' ⊆ range ψ ∧ + ((i = none ∧ ¬ IsPlanar A') ∨ ∃ C : cuffs S, i = some C ∧ ¬ IsPlanarInCappedCuff C.1 A') + := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + rintro (_ | ⟨C, hC⟩) + · have hn1 : ¬ IsPlanar (id '' X) := by + rw [image_id] + exact fun h => hn (.inl h) + obtain ⟨A, h1, h2, f, h3, h4⟩ := exists_obstruction hS (j := id) IsEmbedding.id hX + (.inl hns) hn1 + refine ⟨A, h1, h2, f, h3, fun ψ hψ => ?_⟩ + obtain ⟨A', h5, h6, h7⟩ := h4 ψ hψ + rw [image_id] at h7 + exact ⟨A', h5, h6, .inl ⟨rfl, h7⟩⟩ + · obtain ⟨T, tT, j, D, hc, -⟩ := exists_cappedCuff hS hC + have hT := hc.isSurface + have : ConnectedSpace T := hc.connectedSpace hS + have hn1 : ¬ IsPlanar (j '' X) := fun h => hn (.inr ⟨C, hC, isPlanarInCappedCuff_of_cap hS hc + h⟩) + obtain ⟨A, h1, h2, f, h3, h4⟩ := exists_obstruction hT hc.isEmbedding hX (.inr + (IsCappedCuff.image_ne_univ hc X)) hn1 + refine ⟨A, h1, h2, f, h3, fun ψ hψ => ?_⟩ + obtain ⟨A', h5, h6, h7⟩ := h4 ψ hψ + exact ⟨A', h5, h6, .inr ⟨⟨C, hC⟩, rfl, fun hp => h7 (hp.2.2 T j D hc)⟩⟩ + +/-- A solid connected set is path-connected. -/ +theorem isPathConnected_of_solid (hS : IsSurface S) {X : Set S} (hX : IsSolid X) + (hc : IsConnected X) : IsPathConnected X := by + have : T2Space S := hS.2.1 + have harc := theorem_11_4_proof hS hc hX.1 + obtain ⟨a, ha⟩ := hc.1 + refine ⟨a, ha, fun b hb => ?_⟩ + by_cases hab : a = b + · subst hab + exact JoinedIn.refl ha + · exact (joinedIn_iff_eq_or_exists_isLineWithEnds ha hb).mpr (.inr (harc a ha b hb hab)) + +theorem isSolid_empty_set : IsSolid (∅ : Set S) := + ⟨fun _ hz => hz.elim, isClosed_empty⟩ + +theorem isSolid_sUnion_of_finite (hS : IsSurface S) {𝒵 : Set (Set S)} (hf : 𝒵.Finite) + (h : ∀ Z ∈ 𝒵, IsSolid Z) : IsSolid (⋃₀ 𝒵) := by + induction 𝒵, hf using Set.Finite.induction_on with + | empty => simpa using isSolid_empty_set + | @insert Z 𝒵 _ _ ih => + rw [sUnion_insert] + exact theorem_11_6_proof hS (h Z (mem_insert _ _)) (ih fun Z' hZ' => h Z' + (mem_insert_of_mem _ hZ')) + +theorem isPathConnected_of_isOArc {F : Set S} (hF : IsOArc F) : IsPathConnected F := by + obtain ⟨φ⟩ := id hF + have hrange : F = range (fun w : Circle => (φ w).1) := by + ext x + exact ⟨fun hx => ⟨φ.symm ⟨x, hx⟩, by simp⟩, by rintro ⟨w, rfl⟩; exact (φ w).2⟩ + rw [hrange] + exact isPathConnected_range (continuous_subtype_val.comp φ.continuous) + +/-- Join finitely many `O`-arcs of a path-connected set by lines of this set. -/ +theorem exists_solid_join (hS : IsSurface S) {ι : Type*} [Finite ι] {i₀ : ι} {Y : Set S} + (hY : IsPathConnected Y) {B : ι → Set S} + (hB : ∀ i, IsOArc (B i)) (hs : ∀ i, B i ⊆ Y) : + ∃ X : Set S, IsSolid X ∧ IsConnected X ∧ (∀ i, B i ⊆ X) ∧ X ⊆ Y ∧ IsThin X := by + have : T2Space S := hS.2.1 + have hne : ∀ i, (B i).Nonempty := fun i => (isConnected_of_isOArc (hB i)).1 + obtain ⟨b₀, hb₀⟩ := hne i₀ + have hP : ∀ i, ∃ P : Set S, IsThin P ∧ IsSolid P ∧ P ⊆ Y ∧ IsPreconnected (P ∪ B i ∪ B i₀) := by + intro i + obtain ⟨b, hb⟩ := hne i + have hj := hY.joinedIn b₀ (hs i₀ hb₀) b (hs i hb) + have hu : ∀ {A : Set S}, IsPreconnected A → (b₀ ∈ A ∨ b ∈ A) → b₀ ∈ A ∧ b ∈ A → IsPreconnected + (A ∪ B i ∪ B i₀) := by + intro A hA _ hba + exact (hA.union b hba.2 hb (isConnected_of_isOArc (hB i)).isPreconnected).union b₀ + (.inl hba.1) hb₀ + (isConnected_of_isOArc (hB i₀)).isPreconnected + rcases (joinedIn_iff_eq_or_exists_isLineWithEnds (hs i₀ hb₀) (hs i hb)).mp hj with rfl | ⟨L, + hL, hl⟩ + · refine ⟨B i₀, isThin_of_isOArc (hB i₀), isSolid_of_isOArc hS (hB i₀), hs i₀, ?_⟩ + exact hu (isConnected_of_isOArc (hB i₀)).isPreconnected (.inl hb₀) ⟨hb₀, hb₀⟩ + · obtain ⟨f, h0, h1⟩ := id hl + have hLc : IsPreconnected L := by + have h3 := isPreconnected_range (continuous_subtype_val.comp f.continuous) + rwa [range_comp, f.surjective.range_eq, image_univ, Subtype.range_coe] at h3 + have hb0L : b₀ ∈ L := h0 ▸ (f 0).2 + have hbL : b ∈ L := h1 ▸ (f 1).2 + exact ⟨L, isThin_of_line hl, isSolid_of_isLineWithEnds hS hl, hL, hu hLc (.inl hb0L) ⟨hb0L, + hbL⟩⟩ + choose P h1 h2 h3 h4 using hP + have hsol : IsSolid (⋃ i, (P i ∪ B i ∪ B i₀)) := by + rw [← sUnion_range] + refine isSolid_sUnion_of_finite hS (finite_range _) ?_ + rintro _ ⟨i, rfl⟩ + exact theorem_11_6_proof hS (theorem_11_6_proof hS (h2 i) (isSolid_of_isOArc hS (hB i))) + (isSolid_of_isOArc hS (hB i₀)) + refine ⟨⋃ i, (P i ∪ B i ∪ B i₀), hsol, ⟨⟨b₀, mem_iUnion.mpr ⟨i₀, .inr hb₀⟩⟩, ?_⟩, ?_, ?_, ?_⟩ + · exact isPreconnected_iUnion ⟨b₀, mem_iInter.mpr fun i => Or.inr hb₀⟩ h4 + · exact fun i x hx => mem_iUnion.mpr ⟨i, .inl (.inr hx)⟩ + · exact iUnion_subset fun i => union_subset (union_subset (h3 i) (hs i)) (hs i₀) + · exact isThin_iUnion fun i => isThin_union (isThin_union (h1 i) (isThin_of_isOArc (hB i))) + (isThin_of_isOArc (hB i₀)) + +/-- A candidate for `α(G')` gives a candidate for `α(G)` with no more vertices, when `G'` is `G` +with the inside of a disc removed. +The disc has a `G`-normal boundary with at most one vertex. -/ +theorem exists_candidate_of_prune (hS : IsSurface S) [ConnectedSpace S] + (hns : ¬ IsSphere S) {G G' : Drawing S} {Δ : Set S} + (hΔ : IsClosedDisc Δ) (hF : G.IsNormal (discBd Δ)) (hone : (G.V ∩ discBd Δ).Subsingleton) + (hU : G.U \ discInt Δ ⊆ G'.U) (hV : G'.V ⊆ G.V) {X' : Set S} (hX' : IsAlphaCandidate G' X') : + ∃ X : Set S, IsAlphaCandidate G X ∧ X ∩ G.V ⊆ X' ∩ G'.V := by + classical + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have hman := hS.2.2 + obtain ⟨hsol, hcon, hnorm, hnear⟩ := hX' + have : Finite (cuffs S) := (cuff_statement.{u} S hS).2.1.to_subtype + choose A hA hAX f hfr hobs using exists_obstructions hS hns hsol hnear + obtain ⟨X₀, hX₀s, hX₀c, hAX₀, hX₀X, hthin⟩ := + exists_solid_join hS (i₀ := (none : Option (cuffs S))) (isPathConnected_of_solid hS hsol hcon) + hA hAX + have hX₀cl : IsClosed X₀ := hX₀s.2 + obtain ⟨h, g, cc⟩ := hΔ.exists_isChart + have hint := hΔ.isOpen_discInt hman + -- Choose the centre of the projection. + have hcentre : ∃ c : ℂ, ‖c‖ < 1 ∧ g c ∉ X₀ ∧ ∀ y ∈ X₀, ∀ v ∈ G.V ∩ discBd Δ, v ∉ X₀ → y ∈ Δ → + g (mobius (-c) (mobius c (h y) / (‖mobius c (h y)‖ : ℂ))) ≠ v := by + by_cases hv : ∃ v ∈ G.V ∩ discBd Δ, v ∉ X₀ + · obtain ⟨v, hv, hvX⟩ := hv + obtain ⟨c, hc, hgc, hpre⟩ := exists_centre_near cc hv.2 hX₀cl.isOpen_compl hvX + refine ⟨c, hc, hgc, fun y hy v' hv' _ hyD he => ?_⟩ + have hvv : v' = v := hone hv' hv + subst hvv + have hne : h y ≠ c := fun hc' => hgc (by rw [← hc', cc.gh hyD]; exact hy) + refine hpre y hyD hne ?_ hy + have hvD := Surface.discBd_subset _ hv.2 + have hsp : ‖mobius c (h y) / (‖mobius c (h y)‖ : ℂ)‖ ≤ 1 := by + rw [norm_div] + simp only [Complex.norm_real, norm_norm] + exact div_self_le_one _ + have hmem : mobius (-c) (mobius c (h y) / (‖mobius c (h y)‖ : ℂ)) ∈ closedBall (0 : ℂ) 1 := + mem_closedBall_zero_iff.mpr (norm_mobius_le (by simpa using hc) hsp) + rw [← he, cc.hg hmem, mobius_mobius_neg hc hsp] + · push Not at hv + obtain ⟨𝓛, hf, hl, hsub⟩ := hthin + obtain ⟨p, hp, hpoff⟩ := exists_mem_discInt_off hS hΔ hf hl + have hpn : ‖h p‖ < 1 := by + have h1 : ‖h p‖ ≤ 1 := mem_closedBall_zero_iff.mp (cc.hm hp.1) + refine lt_of_le_of_ne h1 fun he => hp.2 ?_ + have h2 : h p ∈ sphere (0 : ℂ) 1 := mem_sphere_zero_iff_norm.mpr he + rw [← cc.bd] at h2 + obtain ⟨z, hz, hze⟩ := h2 + have h3 := cc.gh (Surface.discBd_subset _ hz) + rw [hze, cc.gh hp.1] at h3 + rwa [h3] + refine ⟨h p, hpn, ?_, fun y _ v hv' hvX => absurd (hv v hv') hvX⟩ + rw [cc.gh hp.1] + exact fun hc => hpoff (hsub hc) + obtain ⟨c, hc, hcX, hmiss⟩ := hcentre + obtain ⟨R, hRc, hR0, hRoff, hRin, hRform⟩ := exists_disc_push hΔ hint hX₀cl cc hc hcX + let m : S → S := fun y => R (1, y) + have hmc : ContinuousOn m X₀ := hRc.comp (by fun_prop) fun y hy => ⟨mem_univ _, hy⟩ + have hYp : IsPathConnected (m '' X₀) := (isPathConnected_of_solid hS hX₀s hX₀c).image' hmc + -- The image of each `O`-arc is homotopic to it. + have hB : ∀ i, ∃ B : Set S, IsOArc B ∧ B ⊆ m '' X₀ ∧ + ((i = none ∧ ¬ IsPlanar B) ∨ ∃ C : cuffs S, i = some C ∧ ¬ IsPlanarInCappedCuff C.1 B) := by + intro i + have hfX : ∀ w, f i w ∈ X₀ := fun w => hAX₀ i (hfr i ▸ mem_range_self w) + have hHc : Continuous fun q : Circle × 𝕀 => R (q.2, f i q.1) := + hRc.comp_continuous (by fun_prop) fun q => ⟨mem_univ _, hfX q.1⟩ + let ψ : C(Circle, S) := ⟨fun w => R (1, f i w), hHc.comp (by fun_prop : Continuous fun w : + Circle => (w, (1 : 𝕀)))⟩ + have hψ : ClosedCurvesHomotopicIn univ (f i) ψ := + ⟨⟨_, hHc⟩, fun _ => mem_univ _, fun x => hR0 _, fun x => rfl⟩ + obtain ⟨B, hB, hBr, hBo⟩ := hobs i ψ hψ + refine ⟨B, hB, hBr.trans ?_, hBo⟩ + rintro _ ⟨w, rfl⟩ + exact ⟨f i w, hfX w, rfl⟩ + choose B hBo hBY hBn using hB + obtain ⟨X, hXs, hXc, hBX, hXY, -⟩ := exists_solid_join hS (i₀ := (none : Option + (cuffs S))) hYp hBo hBY + -- Points of the image in `G`. + have hkey : ∀ y ∈ X₀, m y ∈ G.U → m y ∈ X₀ ∧ m y ∈ G'.V := by + intro y hy hU' + by_cases hi : y ∈ discInt Δ + · have hb := hRin y hy hi + have hmv : m y ∈ G.V := hF ⟨hb, hU'⟩ + have hvX : m y ∈ X₀ := by + by_contra hn + exact hmiss y hy _ ⟨hmv, hb⟩ hn hi.1 (hRform y hy hi.1).symm + have hoff : m y ∉ discInt Δ := fun h' => h'.2 hb + exact ⟨hvX, hnorm ⟨hX₀X hvX, hU ⟨hU', hoff⟩⟩⟩ + · have he : m y = y := hRoff y hy hi + rw [he] at hU' ⊢ + exact ⟨hy, hnorm ⟨hX₀X hy, hU ⟨hU', hi⟩⟩⟩ + refine ⟨X, ⟨hXs, hXc, ?_, ?_⟩, ?_⟩ + · rintro x ⟨hxX, hxU⟩ + obtain ⟨y, hy, rfl⟩ := hXY hxX + exact hV (hkey y hy hxU).2 + · rintro (hp | ⟨C, hC, hp⟩) + · rcases hBn none with ⟨-, h1⟩ | ⟨C, h1, -⟩ + · exact h1 (IsPlanar.mono hp (hBX none)) + · cases h1 + · rcases hBn (some ⟨C, hC⟩) with ⟨h1, -⟩ | ⟨C', h1, h2⟩ + · cases h1 + · have h3 : (⟨C, hC⟩ : cuffs S) = C' := Option.some.inj h1 + subst h3 + exact h2 (IsPlanarInCappedCuff.mono hp (hBX _)) + · rintro x ⟨hxX, hxV⟩ + obtain ⟨y, hy, rfl⟩ := hXY hxX + have := hkey y hy (G.V_subset_U hxV) + exact ⟨hX₀X this.1, this.2⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/DiscPush.lean b/LeanPool/GraphMinor/GM07/DiscPush.lean new file mode 100644 index 0000000000..563a1029b2 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/DiscPush.lean @@ -0,0 +1,366 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CapMap + +/-! +# Pushing a set out of a closed disc + +Let `Δ` be a closed disc and `p` a point of its inside. Radial projection from `p` moves all of `Δ - +p` to the boundary. Given a +point `v` of the boundary and an open set `N` around `v`, we can choose `p` so that only points of +`N` go to `v` (`exists_disc_push`). +Möbius maps of the unit disc give a chart with `p` at the centre. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface Complex + +universe u + +local notation "𝕀" => unitInterval + +/-- The Möbius map of the unit disc that takes `c` to `0`. -/ +noncomputable def mobius (c z : ℂ) : ℂ := (z - c) / (1 - (starRingEnd ℂ) c * z) + +theorem mobius_denom_ne {c z : ℂ} (hc : ‖c‖ < 1) (hz : ‖z‖ ≤ 1) : 1 - (starRingEnd ℂ) c * z ≠ 0 + := by + intro h + have h1 : (starRingEnd ℂ) c * z = 1 := by + linear_combination -h + have h2 : ‖(starRingEnd ℂ) c * z‖ = 1 := by rw [h1]; simp + rw [norm_mul, Complex.norm_conj] at h2 + nlinarith [norm_nonneg c, norm_nonneg z] + +/-- `|1 - cBar z|² - |z - c|² = (1 - |z|²)(1 - |c|²)`. -/ +theorem mobius_identity (c z : ℂ) : + ‖1 - (starRingEnd ℂ) c * z‖ ^ 2 - ‖z - c‖ ^ 2 = (1 - ‖z‖ ^ 2) * (1 - ‖c‖ ^ 2) := by + simp only [← Complex.normSq_eq_norm_sq, Complex.normSq_apply] + simp + ring + +theorem norm_mobius_le {c z : ℂ} (hc : ‖c‖ < 1) (hz : ‖z‖ ≤ 1) : ‖mobius c z‖ ≤ 1 := by + have hd := mobius_denom_ne hc hz + have hp : 0 < ‖1 - (starRingEnd ℂ) c * z‖ := norm_pos_iff.mpr hd + rw [mobius, norm_div, div_le_one hp] + have h1 := mobius_identity c z + have h2 : 0 ≤ (1 - ‖z‖ ^ 2) * (1 - ‖c‖ ^ 2) := + mul_nonneg (by nlinarith [norm_nonneg z]) (by nlinarith [norm_nonneg c]) + have h3 : ‖z - c‖ ^ 2 ≤ ‖1 - (starRingEnd ℂ) c * z‖ ^ 2 := by linarith + exact (pow_le_pow_iff_left₀ (norm_nonneg _) hp.le two_ne_zero).mp h3 + +theorem norm_mobius_eq_one {c z : ℂ} (hc : ‖c‖ < 1) (hz : ‖z‖ = 1) : ‖mobius c z‖ = 1 := by + have hd := mobius_denom_ne hc hz.le + have hp : 0 < ‖1 - (starRingEnd ℂ) c * z‖ := norm_pos_iff.mpr hd + rw [mobius, norm_div, div_eq_one_iff_eq hp.ne'] + have h1 := mobius_identity c z + rw [hz] at h1 + have h3 : ‖z - c‖ ^ 2 = ‖1 - (starRingEnd ℂ) c * z‖ ^ 2 := by nlinarith + exact (pow_left_inj₀ (norm_nonneg _) hp.le two_ne_zero).mp h3 + +theorem mobius_neg_mobius {c z : ℂ} (hc : ‖c‖ < 1) (hz : ‖z‖ ≤ 1) : mobius (-c) (mobius c z) = z + := by + have hd := mobius_denom_ne hc hz + have hw : mobius c z * (1 - (starRingEnd ℂ) c * z) = z - c := by + rw [mobius] + exact div_mul_cancel₀ _ hd + have key : mobius c z + c = z * (1 + (starRingEnd ℂ) c * mobius c z) := by + apply mul_right_cancel₀ hd + linear_combination (1 - z * (starRingEnd ℂ) c) * hw + have hdenom : 1 - (starRingEnd ℂ) (-c) * mobius c z = 1 + (starRingEnd ℂ) c * mobius c z := by + simp + have hne : 1 + (starRingEnd ℂ) c * mobius c z ≠ 0 := by + intro h0 + rw [h0, mul_zero] at key + have h1 : mobius c z = -c := by linear_combination key + rw [h1] at h0 + have h2 := mobius_denom_ne (c := c) (z := c) hc hc.le + apply h2 + linear_combination h0 + change (mobius c z - -c) / (1 - (starRingEnd ℂ) (-c) * mobius c z) = z + rw [sub_neg_eq_add, hdenom, div_eq_iff hne, key] + +theorem mobius_mobius_neg {c z : ℂ} (hc : ‖c‖ < 1) (hz : ‖z‖ ≤ 1) : mobius c (mobius (-c) z) = z + := by + have h := mobius_neg_mobius (c := -c) (by simpa using hc) hz + rwa [neg_neg] at h + +theorem continuousOn_mobius {c : ℂ} (hc : ‖c‖ < 1) : ContinuousOn (mobius c) (closedBall 0 1) := by + refine ContinuousOn.div (by fun_prop) (by fun_prop) fun z hz => ?_ + exact mobius_denom_ne hc (mem_closedBall_zero_iff.mp hz) + +/-- A chart of a closed disc with a given point at the centre. -/ +theorem IsChart.recenter {S : Type u} [TopologicalSpace S] {D : Set S} {h : S → ℂ} {g : ℂ → S} + (cc : IsChart D h g) + {c : ℂ} (hc : ‖c‖ < 1) : IsChart D (fun x => mobius c (h x)) (fun z => g (mobius (-c) z)) := by + have hc' : ‖-c‖ < 1 := by simpa using hc + have hb : ∀ {c : ℂ}, ‖c‖ < 1 → MapsTo (mobius c) (closedBall 0 1) (closedBall 0 1) := fun hc z hz + => + mem_closedBall_zero_iff.mpr (norm_mobius_le hc (mem_closedBall_zero_iff.mp hz)) + refine ⟨(continuousOn_mobius hc).comp cc.hc cc.hm, cc.gc.comp (continuousOn_mobius hc') + (hb hc'), ?_, ?_, ?_, ?_, ?_⟩ + · exact fun x hx => hb hc (cc.hm hx) + · exact fun z hz => cc.gm (hb hc' hz) + · intro x hx + change g (mobius (-c) (mobius c (h x))) = x + rw [mobius_neg_mobius hc (mem_closedBall_zero_iff.mp (cc.hm hx)), cc.gh hx] + · intro z hz + change mobius c (h (g (mobius (-c) z))) = z + rw [cc.hg (hb hc' hz), mobius_mobius_neg hc (mem_closedBall_zero_iff.mp hz)] + · ext w + constructor + · rintro ⟨x, hx, rfl⟩ + have h1 : h x ∈ sphere (0 : ℂ) 1 := cc.bd ▸ mem_image_of_mem h hx + exact mem_sphere_zero_iff_norm.mpr (norm_mobius_eq_one hc (mem_sphere_zero_iff_norm.mp h1)) + · intro hw + have hw1 := mem_sphere_zero_iff_norm.mp hw + have h1 : mobius (-c) w ∈ sphere (0 : ℂ) 1 := mem_sphere_zero_iff_norm.mpr + (norm_mobius_eq_one hc' hw1) + rw [← cc.bd] at h1 + obtain ⟨x, hx, he⟩ := h1 + exact ⟨x, hx, by + change mobius c (h x) = w + rw [he, mobius_mobius_neg hc hw1.le]⟩ + +variable {S : Type u} [TopologicalSpace S] + +/-- Radial projection in a chart: for a compact set that misses the centre, a homotopy into the +complement of the inside of the +disc, fixing what lies off the inside. -/ +theorem exists_radial_push [T2Space S] {D : Set S} {h : S → ℂ} {g : ℂ → S} (cc : IsChart D h g) + (hD : IsClosedDisc D) + {K : Set S} (hK : IsClosed K) (h0 : g 0 ∉ K) (hdisc : IsClosed (discInt D)ᶜ) : + ∃ R : 𝕀 × S → S, ContinuousOn R (univ ×ˢ K) ∧ (∀ y, R (0, y) = y) ∧ (∀ t y, y ∉ discInt D → R + (t, y) = y) ∧ + (∀ y ∈ K, y ∈ D → ‖h y‖ ≠ 0 ∧ R (1, y) = g (h y / (‖h y‖ : ℂ))) ∧ (∀ t, ∀ y ∈ K, y ∈ D → R + (t, y) ∈ D) := by + classical + have hsphere : ∀ y ∈ D, y ∉ discInt D → ‖h y‖ = 1 := fun y hy hn => by + have h1 : y ∈ discBd D := by + by_contra h2 + exact hn ⟨hy, h2⟩ + exact mem_sphere_zero_iff_norm.mp (cc.bd ▸ mem_image_of_mem h h1) + have hne : ∀ y ∈ K, y ∈ D → ‖h y‖ ≠ 0 := fun y hy hyD hn => by + have h1 : h y = 0 := norm_eq_zero.mp hn + apply h0 + rw [← h1, cc.gh hyD] + exact hy + let B : 𝕀 → ℂ → ℂ := fun t z => (((1 - t.1 : ℝ) : ℂ) + (t.1 : ℂ) / (‖z‖ : ℂ)) * z + have hBb : ∀ t, ∀ z : ℂ, ‖z‖ ≤ 1 → z ≠ 0 → ‖B t z‖ ≤ 1 := fun t z hz h0' => by + have h1 : B t z = ((1 - t.1 : ℝ) : ℂ) * z + (t.1 : ℂ) * (z / (‖z‖ : ℂ)) := by + simp only [B] + ring + have ht0 := t.2.1 + have ht1 := t.2.2 + have h2 : ‖z / (‖z‖ : ℂ)‖ = 1 := by + have : ‖z‖ ≠ 0 := by simpa using h0' + simp [this] + calc ‖B t z‖ ≤ ‖((1 - t.1 : ℝ) : ℂ) * z‖ + ‖(t.1 : ℂ) * (z / (‖z‖ : ℂ))‖ := by + rw [h1] + exact norm_add_le _ _ + _ = (1 - t.1) * ‖z‖ + t.1 := by + rw [norm_mul, norm_mul, h2, Complex.norm_real, Complex.norm_real, + Real.norm_of_nonneg (by linarith), + Real.norm_of_nonneg ht0, mul_one] + _ ≤ 1 := by nlinarith + let R : 𝕀 × S → S := fun q => if q.2 ∈ discInt D then g (B q.1 (h q.2)) else q.2 + have hBone : ∀ t, ∀ z : ℂ, ‖z‖ = 1 → B t z = z := fun t z hz => by + simp [B, hz] + refine ⟨R, ?_, ?_, ?_, ?_, ?_⟩ + · have hA : IsClosed (univ ×ˢ (K ∩ D) : Set (𝕀 × S)) := isClosed_univ.prod + (hK.inter hD.isCompact.isClosed) + have hB : IsClosed (univ ×ˢ (K ∩ (discInt D)ᶜ) : Set (𝕀 × S)) := isClosed_univ.prod + (hK.inter hdisc) + have hcov : (univ ×ˢ K : Set (𝕀 × S)) = (univ ×ˢ (K ∩ D)) ∪ (univ ×ˢ (K ∩ (discInt D)ᶜ)) := by + ext ⟨t, y⟩ + simp only [mem_prod, mem_univ, true_and, mem_union, mem_inter_iff, mem_compl_iff] + constructor + · intro hy + by_cases hi : y ∈ discInt D + · exact .inl ⟨hy, hi.1⟩ + · exact .inr ⟨hy, hi⟩ + · rintro (hy | hy) <;> exact hy.1 + have h1 : ContinuousOn R (univ ×ˢ (K ∩ D)) := by + have he : EqOn (fun q : 𝕀 × S => g (B q.1 (h q.2))) R (univ ×ˢ (K ∩ D)) := by + rintro ⟨t, y⟩ ⟨-, hy, hyD⟩ + simp only [R] + split_ifs with hi + · rfl + · rw [hBone t _ (hsphere y hyD hi), cc.gh hyD] + refine ContinuousOn.congr ?_ he.symm + have hhc : ContinuousOn (fun q : 𝕀 × S => h q.2) (univ ×ˢ (K ∩ D)) := + cc.hc.comp continuousOn_snd fun q hq => hq.2.2 + have hnorm : ContinuousOn (fun q : 𝕀 × S => ((‖h q.2‖ : ℝ) : ℂ)) (univ ×ˢ (K ∩ D)) := + Complex.continuous_ofReal.comp_continuousOn hhc.norm + have ht : Continuous fun q : 𝕀 × S => ((q.1.1 : ℝ) : ℂ) := + Complex.continuous_ofReal.comp (continuous_subtype_val.comp continuous_fst) + have ht' : Continuous fun q : 𝕀 × S => ((1 - q.1.1 : ℝ) : ℂ) := + Complex.continuous_ofReal.comp (continuous_const.sub (continuous_subtype_val.comp + continuous_fst)) + have hb : ContinuousOn (fun q : 𝕀 × S => B q.1 (h q.2)) (univ ×ˢ (K ∩ D)) := + (ht'.continuousOn.add (ht.continuousOn.div hnorm fun q hq => by + have := hne q.2 hq.2.1 hq.2.2 + simpa using this)).mul hhc + refine cc.gc.comp hb fun q hq => ?_ + refine mem_closedBall_zero_iff.mpr (hBb q.1 _ (mem_closedBall_zero_iff.mp (cc.hm hq.2.2)) ?_) + exact norm_ne_zero_iff.mp (hne q.2 hq.2.1 hq.2.2) + have h2 : ContinuousOn R (univ ×ˢ (K ∩ (discInt D)ᶜ)) := by + refine continuous_snd.continuousOn.congr ?_ + rintro ⟨t, y⟩ ⟨-, -, hi⟩ + simp only [R] + rw [ite_eq_right hi] + rw [hcov] + exact h1.union_of_isClosed h2 hA hB + · intro y + simp only [R] + split_ifs with hy + · simp [B, cc.gh hy.1] + · rfl + · intro t y hy + simp [R, hy] + · intro y hy hyD + refine ⟨hne y hy hyD, ?_⟩ + by_cases hi : y ∈ discInt D + · have h1 : (((1 - (1 : 𝕀).1 : ℝ) : ℂ) + ((1 : 𝕀).1 : ℂ) / (‖h y‖ : ℂ)) * h y = h y / + (‖h y‖ : ℂ) := by + simp + ring + simp only [R, ite_eq_left hi, B, h1] + · have h1 := hsphere y hyD hi + simp only [R, ite_eq_right hi, h1] + simp [cc.gh hyD] + · intro t y hy hyD + simp only [R] + split_ifs with hi + · refine cc.gm (mem_closedBall_zero_iff.mpr (hBb t _ (mem_closedBall_zero_iff.mp + (cc.hm hyD)) ?_)) + exact norm_ne_zero_iff.mp (hne y hy hyD) + · exact hyD + +/-- The point at the centre can be chosen so that the radial projection takes only points near `v` +to `v`. -/ +theorem exists_centre_near {D : Set S} {h : S → ℂ} {g : ℂ → S} + (cc : IsChart D h g) {v : S} (hv : v ∈ discBd D) + {N : Set S} (hN : IsOpen N) (hvN : v ∈ N) : + ∃ c : ℂ, ‖c‖ < 1 ∧ g c ∈ N ∧ ∀ y ∈ D, h y ≠ c → mobius c (h y) / (‖mobius c (h y)‖ : ℂ) + = mobius c (h v) → y ∈ N := by + have hu : ‖h v‖ = 1 := mem_sphere_zero_iff_norm.mp (cc.bd ▸ mem_image_of_mem h hv) + have hvD : v ∈ D := Surface.discBd_subset _ hv + set u := h v with hudef + have hcont : ContinuousOn (fun s : ℝ => g ((s : ℂ) * u)) (Icc 0 1) := by + refine cc.gc.comp (by fun_prop) fun s hs => ?_ + rw [mem_closedBall_zero_iff, norm_mul, hu, mul_one, Complex.norm_real, Real.norm_of_nonneg hs.1] + exact hs.2 + have hg1 : g ((1 : ℝ) * u) = v := by + simp only [ofReal_one, one_mul] + exact cc.gh hvD + have hnh : (fun s : ℝ => g ((s : ℂ) * u)) ⁻¹' N ∈ 𝓝[Icc 0 1] (1 : ℝ) := + (hcont 1 ⟨zero_le_one, le_rfl⟩) (hN.mem_nhds (by + change g (((1 : ℝ) : ℂ) * u) ∈ N + rw [hg1] + exact hvN)) + obtain ⟨ε, hε, hball⟩ := Metric.mem_nhdsWithin_iff.mp hnh + set a : ℝ := max (1 / 2) (1 - ε / 2) with ha + have ha1 : a < 1 := max_lt (by norm_num) (by linarith) + have ha0 : 1 / 2 ≤ a := le_max_left _ _ + have hIcc : ∀ s ∈ Icc a 1, g ((s : ℂ) * u) ∈ N := fun s hs => by + refine hball ⟨?_, ?_⟩ + · rw [mem_ball, Real.dist_eq, abs_lt] + have := le_max_right (1 / 2 : ℝ) (1 - ε / 2) + constructor <;> linarith [hs.1, hs.2] + · exact ⟨by linarith [hs.1], hs.2⟩ + have hc : ‖(a : ℂ) * u‖ < 1 := by + rw [norm_mul, hu, mul_one, Complex.norm_real, Real.norm_of_nonneg (by linarith)] + exact ha1 + refine ⟨(a : ℂ) * u, hc, hIcc a ⟨le_rfl, ha1.le⟩, fun y hy hne he => ?_⟩ + have huu : (starRingEnd ℂ) u * u = 1 := by + rw [mul_comm, Complex.mul_conj, Complex.normSq_eq_norm_sq, hu] + simp + have hzn : ‖h y‖ ≤ 1 := mem_closedBall_zero_iff.mp (cc.hm hy) + have hmu : mobius ((a : ℂ) * u) u = u := by + have hd : (1 : ℂ) - (a : ℂ) ≠ 0 := by + have : ((1 - a : ℝ) : ℂ) ≠ 0 := by + exact_mod_cast (show 1 - a ≠ 0 by linarith) + simpa using this + rw [mobius, map_mul, Complex.conj_ofReal, mul_assoc, huu, mul_one] + field_simp + rw [hmu] at he + set w := mobius ((a : ℂ) * u) (h y) with hw + have hw0 : w ≠ 0 := by + intro h0 + have h1 : h y - (a : ℂ) * u = 0 := by + have h2 := mobius_denom_ne hc hzn + have h3 := div_eq_zero_iff.mp (show (h y - (a : ℂ) * u) / (1 - (starRingEnd ℂ) + ((a : ℂ) * u) * h y) = 0 from h0) + exact h3.resolve_right h2 + exact hne (sub_eq_zero.mp h1) + have hwn : ‖w‖ ≠ 0 := norm_ne_zero_iff.mpr hw0 + have hwu : w = ((‖w‖ : ℝ) : ℂ) * u := by + have hc0 : ((‖w‖ : ℝ) : ℂ) ≠ 0 := by exact_mod_cast hwn + rw [← he, mul_div_cancel₀ _ hc0] + set τ := ‖w‖ with hτ + have hτ0 : 0 < τ := lt_of_le_of_ne (norm_nonneg _) hwn.symm + have hτ1 : τ ≤ 1 := norm_mobius_le hc hzn + have hback := mobius_neg_mobius hc hzn + rw [← hw, hwu] at hback + have hden : (0 : ℝ) < 1 + a * τ := by nlinarith + have hs : h y = (((τ + a) / (1 + a * τ) : ℝ) : ℂ) * u := by + rw [← hback, mobius, map_neg, map_mul, Complex.conj_ofReal, neg_mul, sub_neg_eq_add] + have h1 : (a : ℂ) * (starRingEnd ℂ) u * ((τ : ℂ) * u) = (a : ℂ) * τ := by + linear_combination (a : ℂ) * τ * huu + rw [h1] + have hd : (1 : ℂ) + (a : ℂ) * τ ≠ 0 := by + have : ((1 + a * τ : ℝ) : ℂ) ≠ 0 := by exact_mod_cast hden.ne' + simpa using this + push_cast + field_simp + ring + have hmem : (τ + a) / (1 + a * τ) ∈ Icc a 1 := by + constructor + · rw [le_div_iff₀ hden] + have h5 : a * a ≤ 1 := by nlinarith + nlinarith [mul_le_mul_of_nonneg_right h5 hτ0.le] + · rw [div_le_one hden] + nlinarith + have := hIcc _ hmem + rwa [← hs, cc.gh hy] at this + +/-- Project a compact set off the inside of a closed disc, from a point of the inside that it +misses. The second conclusion is about +the map at time one. The last one controls what goes to a point `v` of the boundary. -/ +theorem exists_disc_push [T2Space S] {D K : Set S} (hD : IsClosedDisc D) (hint : IsOpen + (discInt D)) (hK : IsClosed K) + {h : S → ℂ} {g : ℂ → S} (cc : IsChart D h g) {c : ℂ} (hc : ‖c‖ < 1) (hcK : g c ∉ K) : + ∃ R : 𝕀 × S → S, ContinuousOn R (univ ×ˢ K) ∧ (∀ y, R (0, y) = y) ∧ + (∀ y ∈ K, y ∉ discInt D → R (1, y) = y) ∧ (∀ y ∈ K, y ∈ discInt D → R (1, y) ∈ discBd D) ∧ + ∀ y ∈ K, y ∈ D → R (1, y) = g (mobius (-c) (mobius c (h y) / (‖mobius c (h y)‖ : ℂ))) := by + have cc' := IsChart.recenter cc hc + have hg0 : mobius (-c) 0 = c := by simp [mobius] + have h0 : g (mobius (-c) 0) ∉ K := by rwa [hg0] + obtain ⟨R, h1, h2, h3, h4, -⟩ := exists_radial_push cc' hD hK h0 hint.isClosed_compl + refine ⟨R, h1, h2, fun y _ hy => h3 1 y hy, fun y hy hi => ?_, fun y hy hyD => (h4 y hy hyD).2⟩ + obtain ⟨hne, he⟩ := h4 y hy hi.1 + rw [he] + set w := mobius c (h y) with hw + have hb : w / (‖w‖ : ℂ) ∈ sphere (0 : ℂ) 1 := by + have hwn : (‖w‖ : ℝ) ≠ 0 := hne + simp [hwn] + rw [← cc'.bd] at hb + obtain ⟨x, hx, hxe⟩ := hb + have := cc'.gh (Surface.discBd_subset _ hx) + change g (mobius (-c) (mobius c (h x))) = x at this + change mobius c (h x) = _ at hxe + rw [← hxe, this] + exact hx + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/FiniteCross.lean b/LeanPool/GraphMinor/GM07/FiniteCross.lean new file mode 100644 index 0000000000..cf4c5e7fc6 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/FiniteCross.lean @@ -0,0 +1,228 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffSlide +public import LeanPool.GraphMinor.GM07.Section11 + +/-! +# Lines that cross a set in finitely many points + +Graph Minors VII, (3.5) (page 221), is left to the reader. Its proof needs a way to join two points +of a connected open set in a surface +by a line that meets a drawing in finitely many points. This file gives one +(`exists_line_finite_cross`). Near each point of the set `Z` +that we must cross, `Z` is an arc, so a straight segment in a strip chart around this arc crosses +`Z` at most once. The points we can +reach with finitely many crossings then fill the connected open set. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Complex GraphMinor.Surface GraphMinor.GM11 + +variable {T : Type} [TopologicalSpace T] + +/-- `a` and `b` are joined inside `O` with finitely many points of `Z`. -/ +def FinReach (O Z : Set T) (a b : T) : Prop := ∃ K ⊆ O, (K ∩ Z).Finite ∧ JoinedIn K a b + +theorem FinReach.trans {O Z : Set T} {a b c : T} (h₁ : FinReach O Z a b) + (h₂ : FinReach O Z b c) : FinReach O Z a c := by + obtain ⟨K₁, h1, h2, h3⟩ := h₁ + obtain ⟨K₂, h4, h5, h6⟩ := h₂ + refine ⟨K₁ ∪ K₂, union_subset h1 h4, ?_, (h3.mono subset_union_left).trans + (h6.mono subset_union_right)⟩ + rw [union_inter_distrib_right] + exact h2.union h5 + +theorem FinReach.symm {O Z : Set T} {a b : T} (h : FinReach O Z a b) : FinReach O Z b a := by + obtain ⟨K, h1, h2, h3⟩ := h + exact ⟨K, h1, h2, h3.symm⟩ + +/-- A set `N` around a point, in which any two points off `Z` are joined with finitely many +crossings, and each open set around the point has +points of `N` off `Z`. -/ +theorem exists_good_nhd (hT : IsClosedSurface T) {O Z : Set T} (hO : IsOpen O) (hZ : IsClosed Z) + (hloc : ∀ z ∈ O ∩ Z, ∃ (a : unitInterval → T) (W : Set T), IsArcMap a ∧ IsOpen W ∧ z ∈ W + ∧ z ∈ a '' Ioo 0 1 ∧ range a ⊆ Z ∧ Z ∩ W ⊆ range a) + {z : T} (hz : z ∈ O) : + ∃ N, IsOpen N ∧ z ∈ N ∧ N ⊆ O ∧ (∀ p ∈ N \ Z, ∀ q ∈ N \ Z, FinReach O Z p q) ∧ ∀ W, IsOpen W + → z ∈ W → ((W ∩ N) \ Z).Nonempty := by + have ht2 : T2Space T := hT.2.1 + by_cases hzZ : z ∈ Z + · obtain ⟨a, W₀, ha, hW₀, hzW, ⟨t, ht, rfl⟩, hra, hZW⟩ := hloc z ⟨hz, hzZ⟩ + obtain ⟨Os, K, θ, hK, hθc, hθm, hθ⟩ := exists_stripChart_of_arc hT ha + have hK0 : K (θ t) = a t := (hθ t).2 + let Ω : Set ℂ := Os ∩ K ⁻¹' (O ∩ W₀) + have hΩ : IsOpen Ω := hK.hc.isOpen_inter_preimage hK.isOpen (hO.inter hW₀) + have hmem : (θ t : ℂ) ∈ Ω := ⟨(hθ t).1, by rw [mem_preimage, hK0]; exact ⟨hz, hzW⟩⟩ + obtain ⟨δ₀, hδ₀, hball⟩ := Metric.isOpen_iff.mp hΩ _ hmem + have h1 : θ 0 < θ t := hθm ht.1 + have h2 : θ t < θ 1 := hθm ht.2 + let δ := min δ₀ (min (θ t - θ 0) (θ 1 - θ t)) + have hδ : 0 < δ := lt_min hδ₀ (lt_min (by linarith) (by linarith)) + have hδ1 : δ ≤ δ₀ := min_le_left _ _ + have hδ2 : δ ≤ θ t - θ 0 := (min_le_right _ _).trans (min_le_left _ _) + have hδ3 : δ ≤ θ 1 - θ t := (min_le_right _ _).trans (min_le_right _ _) + let B : Set ℂ := ball (θ t : ℂ) δ + have hBΩ : B ⊆ Ω := (ball_subset_ball hδ1).trans hball + have hBO : B ⊆ Os := fun w hw => (hBΩ hw).1 + have hreal : ∀ w ∈ B, w.im = 0 → ∃ u, w = θ u := fun w hw him => by + have h3 : |w.re - θ t| < δ := by + have h4 : w - (θ t : ℂ) = ((w.re - θ t : ℝ) : ℂ) := by + apply Complex.ext <;> simp [him] + have h5 : dist w (θ t : ℂ) < δ := hw + rwa [dist_eq_norm, h4, Complex.norm_real, Real.norm_eq_abs] at h5 + obtain ⟨h6, h7⟩ := abs_lt.mp h3 + obtain ⟨u, hu⟩ := intermediate_value_univ (0 : unitInterval) 1 hθc (show w.re ∈ Icc (θ 0) + (θ 1) from ⟨by linarith, by linarith⟩) + refine ⟨u, Complex.ext ?_ ?_⟩ + · simp [hu] + · simp [him] + have hKZ : ∀ w ∈ B, K w ∈ Z ↔ w.im = 0 := fun w hw => by + constructor + · intro h3 + obtain ⟨u, hu⟩ := hZW ⟨h3, (hBΩ hw).2.2⟩ + have h4 : K w = K (θ u) := by rw [(hθ u).2, hu] + rw [hK.hi (hBO hw) (hθ u).1 h4] + simp + · intro h3 + obtain ⟨u, rfl⟩ := hreal w hw h3 + rw [(hθ u).2] + exact hra ⟨u, rfl⟩ + have hopenN : IsOpen (K '' B) := hK.ho _ isOpen_ball hBO + refine ⟨K '' B, hopenN, ⟨_, mem_ball_self hδ, hK0⟩, ?_, ?_, ?_⟩ + · rintro _ ⟨w, hw, rfl⟩ + exact (hBΩ hw).2.1 + · rintro _ ⟨⟨w, hw, rfl⟩, hp⟩ _ ⟨⟨w', hw', rfl⟩, hq⟩ + have him : w.im ≠ 0 := fun h => hp ((hKZ w hw).mpr h) + have him' : w'.im ≠ 0 := fun h => hq ((hKZ w' hw').mpr h) + have hsub : segment ℝ w w' ⊆ B := (convex_ball _ _).segment_subset hw hw' + refine ⟨K '' segment ℝ w w', ?_, ?_, ?_⟩ + · rintro _ ⟨v, hv, rfl⟩ + exact (hBΩ (hsub hv)).2.1 + · have hsg : (segment ℝ w w' ∩ {v | v.im = 0}).Subsingleton := by + rintro x ⟨hx, hx0⟩ y ⟨hy, hy0⟩ + rw [segment_eq_image] at hx hy + obtain ⟨s₁, -, rfl⟩ := hx + obtain ⟨s₂, -, rfl⟩ := hy + simp only [mem_ofPred_eq, add_im, Complex.real_smul, mul_im, ofReal_re, ofReal_im, + zero_mul, add_zero] at hx0 hy0 + have h3 : (s₁ - s₂) * (w'.im - w.im) = 0 := by linarith + rcases mul_eq_zero.mp h3 with h4 | h4 + · rw [show s₁ = s₂ by linarith] + · have h5 : w'.im = w.im := by linarith + rw [h5] at hx0 + exact (him (by linarith)).elim + refine (hsg.finite.image K).subset ?_ + rintro _ ⟨⟨v, hv, rfl⟩, hvZ⟩ + exact ⟨v, ⟨hv, (hKZ v (hsub hv)).mp hvZ⟩, rfl⟩ + · have hj : JoinedIn (segment ℝ w w') w w' := + ((convex_segment w w').isPathConnected ⟨w, left_mem_segment ℝ w w'⟩).joinedIn _ + (left_mem_segment ℝ w w') _ (right_mem_segment ℝ w w') + exact hj.map (hK.hc.mono fun v hv => hBO (hsub hv)) + · intro W hW hzW' + have hop : IsOpen (B ∩ K ⁻¹' W ∩ Os) := by + have hopen := hK.hc.isOpen_inter_preimage hK.isOpen hW + simpa only [inter_assoc, inter_comm Os] using isOpen_ball.inter hopen + have hWmem : (θ t : ℂ) ∈ K ⁻¹' W := by + rw [mem_preimage, hK0] + exact hzW' + have hin : (θ t : ℂ) ∈ B ∩ K ⁻¹' W ∩ Os := ⟨⟨mem_ball_self hδ, hWmem⟩, (hθ t).1⟩ + obtain ⟨ε, hε, hb⟩ := Metric.isOpen_iff.mp hop _ hin + let w : ℂ := (θ t : ℂ) + ((ε / 2 : ℝ) : ℂ) * I + have hw : w ∈ ball (θ t : ℂ) ε := by + rw [mem_ball, dist_eq_norm] + simp only [w, add_sub_cancel_left, norm_mul, Complex.norm_I, mul_one, Complex.norm_real, + Real.norm_eq_abs] + rw [abs_of_pos (by linarith)] + linarith + obtain ⟨⟨h3, h4⟩, -⟩ := hb hw + refine ⟨K w, ⟨h4, ⟨w, h3, rfl⟩⟩, fun h5 => ?_⟩ + have := (hKZ w h3).mp h5 + simp only [w, add_im, ofReal_im, mul_im, ofReal_re, I_im, I_re, mul_one, mul_zero, + zero_add, add_zero] at this + linarith + · obtain ⟨U, h, g, c, hUO, hg0⟩ := (hT.2.2 z).exists_ballChart (hO.inter hZ.isOpen_compl) ⟨hz, + hzZ⟩ (R := 1) (by norm_num) + have hzU : z ∈ U := hg0 ▸ c.gm (mem_ball_self one_pos) + have hdis : U ∩ Z = ∅ := by + ext x + simp only [mem_inter_iff, mem_empty_iff_false, iff_false, not_and] + exact fun hx h => (hUO hx).2 h + refine ⟨U, c.isOpen, hzU, fun x hx => (hUO hx).1, + fun p hp q hq => ⟨U, fun x hx => (hUO hx).1, by rw [hdis]; exact finite_empty, ?_⟩, + fun W _ hzW => ⟨z, ⟨hzW, hzU⟩, hzZ⟩⟩ + have hj : JoinedIn (ball (0 : ℂ) 1) (h p) (h q) := + ((convex_ball (0 : ℂ) 1).isPathConnected ⟨0, mem_ball_self one_pos⟩).joinedIn _ (c.hm hp.1) _ + (c.hm hq.1) + have hj2 := hj.map c.gc + rw [c.gh hp.1, c.gh hq.1] at hj2 + exact hj2.mono (by + rintro _ ⟨x, hx, rfl⟩ + exact c.gm hx) + +/-- **Joining points with finitely many crossings.** In a closed surface, let `O` be a connected +open set and `Z` a closed set which is +an arc near each of its points in `O`. Then any two distinct points of `O` off `Z` are joined in `O` +with finitely many crossings of `Z`. -/ +theorem finReach_of_connected (hT : IsClosedSurface T) {O Z : Set T} (hO : IsOpen O) + (hc : IsPreconnected O) (hZ : IsClosed Z) + (hloc : ∀ z ∈ O ∩ Z, ∃ (a : unitInterval → T) (W : Set T), IsArcMap a ∧ IsOpen W ∧ z ∈ W + ∧ z ∈ a '' Ioo 0 1 ∧ range a ⊆ Z ∧ Z ∩ W ⊆ range a) + {x y : T} (hx : x ∈ O \ Z) (hy : y ∈ O \ Z) : FinReach O Z x y := by + classical + have hgood := fun z hz => exists_good_nhd hT hO hZ hloc (z := z) hz + let P : T → Prop := fun z => ∃ N, IsOpen N ∧ z ∈ N ∧ N ⊆ O ∧ (∀ p ∈ N \ Z, ∀ q ∈ N \ Z, FinReach + O Z p q) ∧ ∃ p ∈ N \ Z, FinReach O Z x p + let A : Set T := {z | P z} + let B : Set T := {z | z ∈ O ∧ ¬ P z} + have hAo : IsOpen A := isOpen_iff_forall_mem_open.mpr fun z hz => by + obtain ⟨N, h1, h2, h3, h4, h5⟩ := hz + exact ⟨N, fun w hw => ⟨N, h1, hw, h3, h4, h5⟩, h1, h2⟩ + have hBo : IsOpen B := isOpen_iff_forall_mem_open.mpr fun z hz => by + obtain ⟨N, h1, h2, h3, h4, -⟩ := hgood z hz.1 + refine ⟨N, fun w hw => ⟨h3 hw, fun hP => hz.2 ?_⟩, h1, h2⟩ + obtain ⟨N', h5, h6, -, h8, p, hp, h9⟩ := hP + obtain ⟨M, -, h11, -, -, h12⟩ := hgood w (h3 hw) + obtain ⟨q, ⟨⟨hq1, hq2⟩, hq3⟩, hq4⟩ := h12 (N ∩ N') (h1.inter h5) ⟨hw, h6⟩ + exact ⟨N, h1, h2, h3, h4, q, ⟨hq1, hq4⟩, h9.trans (h8 p hp q ⟨hq2, hq4⟩)⟩ + have hxA : x ∈ A := by + obtain ⟨N, h1, h2, h3, h4, -⟩ := hgood x hx.1 + exact ⟨N, h1, h2, h3, h4, x, ⟨h2, hx.2⟩, {x}, by simpa using hx.1, + (finite_singleton x).subset inter_subset_left, JoinedIn.refl rfl⟩ + have hcov : O ⊆ A ∪ B := fun z hz => by + by_cases h : P z + · exact .inl h + · exact .inr ⟨hz, h⟩ + have hdis : O ∩ (A ∩ B) = ∅ := by + ext z + simp only [mem_inter_iff, mem_empty_iff_false, iff_false, not_and] + exact fun _ h1 h2 => h2.2 h1 + by_cases hyA : y ∈ A + · obtain ⟨N, -, h2, -, h4, p, hp, h5⟩ := hyA + exact h5.trans (h4 p hp y ⟨h2, hy.2⟩) + · exfalso + obtain ⟨z, hz⟩ := hc A B hAo hBo hcov ⟨x, hx.1, hxA⟩ ⟨y, hy.1, hy.1, hyA⟩ + have : z ∈ O ∩ (A ∩ B) := hz + rw [hdis] at this + exact this + +/-- The line form of `finReach_of_connected`. -/ +theorem FinReach.exists_line [T2Space T] {O Z : Set T} {a b : T} (h : FinReach O Z a b) + (hne : a ≠ b) : + ∃ L ⊆ O, IsLineWithEnds L a b ∧ (L ∩ Z).Finite := by + obtain ⟨K, h1, h2, h3⟩ := h + obtain ⟨L, hL, hl⟩ := ((joinedIn_iff_eq_or_exists_isLineWithEnds h3.source_mem h3.target_mem).mp + h3).resolve_left hne + exact ⟨L, hL.trans h1, hl, h2.subset (inter_subset_inter_left _ hL)⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/FlatEdges.lean b/LeanPool/GraphMinor/GM07/FlatEdges.lean new file mode 100644 index 0000000000..474b6152dd --- /dev/null +++ b/LeanPool/GraphMinor/GM07/FlatEdges.lean @@ -0,0 +1,606 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section35 +public import LeanPool.GraphMinor.GM07.Section41 +public import LeanPool.GraphMinor.GM07.CutBounds +public import LeanPool.GraphMinor.GM11.FlatCover +public import LeanPool.GraphMinor.GM14.Section6c + +/-! +# Adding lines to a flat set + +This file is the first half of the proof of (4.3) of Graph Minors VII (pages 222 and 223). The paper +picks a set `Y` maximal among the unions of +regions, edges and vertices all of whose `O`-arcs are null-homotopic, and says that it is "easy to +see" that `Y` contains every edge at a vertex of `Y`. +Here is the reason (`IsFlat.union_line`, `IsFlat.union_edge`). A line `L` with an end in `Y` has a +thin closed disc around it, the disc of +`exists_edge_lens`. Its boundary lies in `Y`, except possibly for the other end of `L`, so by (11.3) +adding the inside of the disc keeps `Y` flat. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] + +theorem IsFlat.mono {Y Y' : Set S} (h : IsFlat Y) (hs : Y' ⊆ Y) : IsFlat Y' := fun φ hφ => h φ + (hφ.trans hs) + +/-- A line without one end joins each of its points to the other end. -/ +theorem joinedIn_line_sdiff {R : Set S} {u x a : S} (hR : IsLineWithEnds R u x) (ha : a ∈ R) + (hne : a ≠ u) : JoinedIn (R \ {u}) a x := by + obtain ⟨f, h0, h1⟩ := hR + let g : unitInterval → S := fun t => (f t).1 + have hg : Continuous g := continuous_subtype_val.comp f.continuous + have hconv : IsPathConnected (Ioc (0 : ℝ) 1) := + (convex_Ioc 0 1).isPathConnected ⟨1, by norm_num, le_rfl⟩ + have hu : ∀ t : unitInterval, 0 < (t : ℝ) → g t ≠ u := fun t ht e => by + have : f t = f 0 := Subtype.ext (e.trans h0.symm) + have h2 := f.injective this + rw [h2] at ht + simp at ht + let s := f.symm ⟨a, ha⟩ + have hs : g s = a := by simp [g, s] + have hs0 : 0 < (s : ℝ) := by + rcases eq_or_lt_of_le (s.2.1 : (0 : ℝ) ≤ s) with h | h + · have : s = 0 := Subtype.ext h.symm + rw [this] at hs + exact (hne (hs.symm.trans h0)).elim + · exact h + have hmem : ∀ t ∈ Ioc (0 : ℝ) 1, t ∈ Icc (0 : ℝ) 1 := fun t ht => ⟨ht.1.le, ht.2⟩ + obtain ⟨γ, hγ⟩ := hconv.joinedIn _ ⟨hs0, s.2.2⟩ 1 ⟨by norm_num, le_rfl⟩ + let c : C(unitInterval, unitInterval) := ⟨fun t => ⟨γ t, hmem _ (hγ t)⟩, Continuous.subtype_mk + γ.continuous _⟩ + refine ⟨⟨⟨fun t => g (c t), hg.comp c.continuous⟩, ?_, ?_⟩, fun t => ?_⟩ + · have : c 0 = s := Subtype.ext (by simp [c]) + change g (c 0) = a + rw [this, hs] + · have : c 1 = 1 := Subtype.ext (by simp [c]) + change g (c 1) = x + rw [this] + exact h1 + · exact ⟨(f (c t)).2, hu _ (hγ t).1⟩ + +/-- A set that holds an `O`-arc except for at most one point, and a point `x` of the `O`-arc, is +arc-connected. -/ +theorem isArcConnected_oArc_part [T2Space S] {C W : Set S} (hC : IsOArc C) {x u : S} (hx : x ∈ C) + (hu : u ∈ C) (hne : x ≠ u) (hW : W ⊆ C) (hrest : C \ {u} ⊆ W) : + IsArcConnected W := by + obtain ⟨P, Q, hP, hQ, hPQ, -⟩ := hC.lines hu hx hne.symm + have hJ : ∀ a ∈ W, JoinedIn W a x := fun a ha => by + have hline : ∀ {R : Set S}, IsLineWithEnds R u x → R ⊆ C → a ∈ R → JoinedIn W a x + := fun {R} hR hRC haR => by + by_cases h : a = u + · have hRW : R ⊆ W := fun z hz => by + by_cases hzu : z = u + · rw [hzu, ← h] + exact ha + · exact hrest ⟨hRC hz, hzu⟩ + rw [h] + exact ((joinedIn_iff_eq_or_exists_isLineWithEnds hR.left_mem hR.right_mem).mpr (.inr ⟨R, + subset_rfl, hR⟩)).mono hRW + · exact (joinedIn_line_sdiff hR haR h).mono fun z hz => hrest ⟨hRC hz.1, hz.2⟩ + have : a ∈ P ∪ Q := hPQ ▸ hW ha + rcases this with h | h + · exact hline hP (hPQ ▸ subset_union_left) h + · exact hline hQ (hPQ ▸ subset_union_right) h + intro a ha b hb hab + have h := (hJ a ha).trans (hJ b hb).symm + exact ((joinedIn_iff_eq_or_exists_isLineWithEnds ha hb).mp h).resolve_left hab + +/-- A connected set of a capped surface that misses the cuffs, with a point of the inside of the +surface in its closure, lies in the surface. -/ +theorem subset_range_of_side {T : Type} [TopologicalSpace T] {j : S → T} {K : Set T} + (hT : IsClosedSurface T) (hj : IsClosedEmbedding j) (hK : IsClosed K) (hu : range j ∪ K = univ) + (hi : range j ∩ K = j '' bd S) {A : Set T} (hA : IsPreconnected A) (hbd : Disjoint A + (j '' bd S)) {x₀ : S} (hx₀ : x₀ ∉ bd S) (hcl : j x₀ ∈ closure A) : A ⊆ range j := by + have hfr : frontier (range j) = j '' bd S := cap_frontier hT hj hK hu hi + refine subset_of_preconnected_frontier hA hj.isClosed_range (hfr ▸ hbd) ?_ + have h1 : j x₀ ∈ interior (range j) := by + have h2 : j x₀ ∉ frontier (range j) := by + rw [hfr] + rintro ⟨x, hx, e⟩ + rw [hj.injective e] at hx + exact hx₀ hx + by_contra h3 + exact h2 ⟨subset_closure ⟨x₀, rfl⟩, h3⟩ + obtain ⟨z, hz, hzA⟩ := mem_closure_iff.mp hcl _ isOpen_interior h1 + exact ⟨z, hzA, interior_subset hz⟩ + +/-- A thin closed disc `Δ` around a line `L` that meets a closed set `W` and the boundary of the +surface only at its ends. The inside of `Δ` is `L` without its ends together with two +path-connected open-side sets `A` and `B`, and each point of `L` other than its ends lies in the +closure of both sides. We get `Δ` from `exists_edge_lens_sides` in the capped surface. Both +sides lie in the surface, because they are connected, they miss the cuffs and they touch the inside +of the surface along `L`. -/ +theorem exists_line_lens (hS : IsSurface S) {L W : Set S} {x u : S} (hL : IsLineWithEnds L x u) + (hW : IsClosed W) (hLW : L ∩ W ⊆ {x, u}) (hLb : L ∩ bd S ⊆ {x, u}) : + ∃ Δ A B : Set S, IsClosedDisc Δ ∧ L ⊆ Δ ∧ Δ ∩ (W ∪ bd S) ⊆ {x, u} ∧ x ∈ discBd Δ ∧ u ∈ discBd Δ + ∧ discBd Δ ∩ L ⊆ {x, u} ∧ IsOpen (Δ \ discBd Δ) ∧ Δ \ discBd Δ ⊆ A ∪ B ∪ L ∧ + A ⊆ Δ \ discBd Δ ∧ B ⊆ Δ \ discBd Δ ∧ Disjoint A B ∧ Disjoint A L ∧ Disjoint B L + ∧ IsPathConnected A ∧ IsPathConnected B ∧ L \ {x, u} ⊆ closure A ∧ L \ {x, u} ⊆ closure B + := by + classical + have ht2 : T2Space S := hS.2.1 + have hS2 : CompactSpace S := hS.1 + have hbc : IsClosed (bd S) := (cuff_statement.{0} S hS).1 + obtain ⟨T, tT, j, K, hT, hj, hK, hu, hi, -⟩ := exists_capAll S hS + have ht2T : T2Space T := hT.2.1 + have hman : ∀ z : T, IsManifoldPoint z := fun z => (hT.2.2 z).isManifoldPoint + have hne : x ≠ u := fun e => by + obtain ⟨f, h0, h1⟩ := hL + have : f 0 = f 1 := Subtype.ext (h0.trans (e.trans h1.symm)) + exact zero_ne_one (f.injective this) + have hl' := hL.map_of_embedding hj.isEmbedding + have hne' : j x ≠ j u := fun e => hne (hj.injective e) + let Zl : Set T := j '' (W ∪ bd S) + have hZl : IsClosed Zl := hj.isClosedMap _ (hW.union hbc) + have hLZ : (j '' L) ∩ Zl ⊆ {j x, j u} := by + rintro _ ⟨⟨z, hz, rfl⟩, z', hz', e⟩ + obtain rfl := hj.injective e + have : z' ∈ ({x, u} : Set S) := by + rcases hz' with h | h + · exact hLW ⟨hz, h⟩ + · exact hLb ⟨hz, h⟩ + rcases this with rfl | h + · exact .inl rfl + · exact .inr (congrArg j h) + obtain ⟨D, A, B, hD, hLD, hDZ, hxD, huD, hDL, hDeq, hAc, hBc, -, -, hAL, hBL, hLA, hLB, -, -, + hAB, hA', hB'⟩ := exists_edge_lens_sides hT hl' hne' hZl hLZ + obtain ⟨x₀, hx₀, hx₀e⟩ : ∃ x₀ ∈ L, x₀ ∉ ({x, u} : Set S) := by + obtain ⟨z, hz⟩ := GM14.IsLineWithEnds.nonempty_sdiff_pair hL + exact ⟨z, hz.1, hz.2⟩ + have hx₀b : x₀ ∉ bd S := fun h => hx₀e (hLb ⟨hx₀, h⟩) + have hside : ∀ {A' : Set T}, A' ⊆ D → IsPreconnected A' → Disjoint A' (j '' L) + → j '' L ⊆ closure A' → A' ⊆ range j := fun {A'} hs hc hd hcl => by + refine subset_range_of_side hT hj hK hu hi hc (disjoint_left.mpr ?_) hx₀b (hcl ⟨x₀, hx₀, rfl⟩) + rintro z hz ⟨y, hy, rfl⟩ + have h1 : j y ∈ Zl := ⟨y, .inr hy, rfl⟩ + have h2 := hDZ ⟨hs hz, h1⟩ + refine disjoint_left.mp hd hz ?_ + rcases h2 with h3 | h3 + · exact h3 ▸ hl'.left_mem + · exact (mem_singleton_iff.mp h3) ▸ hl'.right_mem + have hAD : A ⊆ D := fun z hz => hDeq ▸ .inl (.inl hz) + have hBD : B ⊆ D := fun z hz => hDeq ▸ .inl (.inr hz) + have hDr : D ⊆ range j := by + rw [hDeq] + refine union_subset (union_subset (hside hAD hAc hAL hLA) (hside hBD hBc hBL hLB)) ?_ + exact image_subset_range _ _ + have hΔ : IsClosedDisc (j ⁻¹' D) := isClosedDisc_preimage_of_subset_range hj.continuous + hj.injective hD hDr + have him := hΔ.image_injOn hj.continuous.continuousOn hj.injective.injOn + have hDim : j '' (j ⁻¹' D) = D := image_preimage_eq_of_subset hDr + have hbdeq : j ⁻¹' discBd D = discBd (j ⁻¹' D) := by + rw [hDim] at him + rw [him.2, preimage_image_eq _ hj.injective] + have hin : j ⁻¹' D \ discBd (j ⁻¹' D) = j ⁻¹' (D \ discBd D) := by + rw [← hbdeq] + rfl + have hopen : IsOpen (j ⁻¹' D \ discBd (j ⁻¹' D)) := by + rw [hin] + exact (hD.isOpen_discInt hman).preimage hj.continuous + have hpc : ∀ {A₀ : Set T}, A₀ ⊆ D → IsPathConnected (A₀ \ discBd D) → IsPathConnected (j ⁻¹' + (A₀ \ discBd D)) := fun {A₀} hs hc => by + rw [hj.isInducing.isPathConnected_iff, image_preimage_eq_of_subset (sdiff_subset.trans + (hs.trans hDr))] + exact hc + have hend : ∀ z ∈ L \ {x, u}, j z ∉ discBd D := fun z hz h => by + rcases hDL ⟨h, z, hz.1, rfl⟩ with h2 | h2 + · exact hz.2 (.inl (hj.injective h2)) + · exact hz.2 (.inr (hj.injective h2)) + have hcl : ∀ {A₀ : Set T}, A₀ ⊆ D → j '' L ⊆ closure A₀ → L \ {x, u} ⊆ closure (j ⁻¹' + (A₀ \ discBd D)) := fun {A₀} hs hc z hz => by + rw [mem_closure_iff] + intro O hO hzO + obtain ⟨O', hO', rfl⟩ := hj.isInducing.isOpen_iff.mp hO + have h1 : j z ∈ O' ∩ (D \ discBd D) := ⟨hzO, hLD ⟨z, hz.1, rfl⟩, hend z hz⟩ + obtain ⟨y, hy, hyA⟩ := mem_closure_iff.mp (hc ⟨z, hz.1, rfl⟩) _ (hO'.inter + (hD.isOpen_discInt hman)) h1 + obtain ⟨y', rfl⟩ := hDr hy.2.1 + exact ⟨y', hy.1, hyA, hy.2.2⟩ + refine ⟨j ⁻¹' D, j ⁻¹' (A \ discBd D), j ⁻¹' (B \ discBd D), hΔ, fun z hz + => hLD ⟨z, hz, rfl⟩, ?_, ?_, ?_, ?_, hopen, ?_, ?_, ?_, ?_, ?_, ?_, hpc hAD hA', hpc hBD hB', + hcl hAD hLA, hcl hBD hLB⟩ + · rintro z ⟨hz, hz'⟩ + rcases hDZ ⟨hz, z, hz', rfl⟩ with h | h + · exact .inl (hj.injective h) + · exact .inr (hj.injective h) + · rw [← hbdeq] + exact hxD + · rw [← hbdeq] + exact huD + · rintro z ⟨hz, hzL⟩ + rw [← hbdeq] at hz + rcases hDL ⟨hz, z, hzL, rfl⟩ with h | h + · exact .inl (hj.injective h) + · exact .inr (hj.injective h) + · rw [hin] + rintro z ⟨hz, hz'⟩ + have : j z ∈ A ∪ B ∪ j '' L := hDeq ▸ hz + rcases this with (h | h) | ⟨z', hz'', e⟩ + · exact .inl (.inl ⟨h, hz'⟩) + · exact .inl (.inr ⟨h, hz'⟩) + · exact .inr (hj.injective e ▸ hz'') + · rw [hin] + exact fun z hz => ⟨hAD hz.1, hz.2⟩ + · rw [hin] + exact fun z hz => ⟨hBD hz.1, hz.2⟩ + · exact disjoint_left.mpr fun z hz hz' => disjoint_left.mp hAB hz.1 hz'.1 + · exact disjoint_left.mpr fun z hz hz' => disjoint_left.mp hAL hz.1 ⟨z, hz', rfl⟩ + · exact disjoint_left.mpr fun z hz hz' => disjoint_left.mp hBL hz.1 ⟨z, hz', rfl⟩ + +/-- **Adding a line to a flat set.** Let `Y` be flat and let `L` be a line with an end `x` in `Y`, +such that everything off `L`, a closed set `W` and `bd(Σ)` lies in `Y`. Then +`Y` stays flat when we add `L` without its ends. The proof is in the module docstring. -/ +theorem IsFlat.union_line (hS : IsSurface S) {Y W L : Set S} {x u : S} (hY : IsFlat Y) + (hL : IsLineWithEnds L x u) (hW : IsClosed W) (hLW : L ∩ W ⊆ {x, u}) (hLb : L ∩ bd S ⊆ {x, u}) + (hxY : x ∈ Y) (hrest : ∀ z, z ∉ W → z ∉ bd S → z ∉ L → z ∈ Y) : IsFlat (Y ∪ (L \ {x, u})) := by + classical + have ht2 : T2Space S := hS.2.1 + have hne : x ≠ u := fun e => by + obtain ⟨f, h0, h1⟩ := hL + have : f 0 = f 1 := Subtype.ext (h0.trans (e.trans h1.symm)) + exact zero_ne_one (f.injective this) + obtain ⟨Δ, -, -, hΔ, hLD, hDZ, hxC, huC, hDL, -⟩ := exists_line_lens hS hL hW hLW hLb + have hnotin : ∀ z ∈ discBd Δ, z ≠ x → z ≠ u → z ∉ W ∧ z ∉ bd S ∧ z ∉ L := fun z hz h1 h2 => by + have hzD : z ∈ Δ := GM11.discBd_subset _ hz + have hend : z ∉ ({x, u} : Set S) := by + rintro (h | h) + · exact h1 h + · exact h2 h + exact ⟨fun h => hend (hDZ ⟨hzD, .inl h⟩), fun h => hend (hDZ ⟨hzD, .inr h⟩), + fun h => hend (hDL ⟨hz, h⟩)⟩ + have harc : IsArcConnected (Y ∩ discBd Δ) := isArcConnected_oArc_part + (IsClosedDisc.isOArc_discBd hΔ) hxC huC hne inter_subset_right fun z hz => by + by_cases hzx : z = x + · exact ⟨hzx ▸ hxY, hz.1⟩ + · obtain ⟨h1, h2, h3⟩ := hnotin z hz.1 hzx hz.2 + exact ⟨hrest z h1 h2 h3, hz.1⟩ + refine IsFlat.mono ((theorem_11_3_proof hS hΔ harc).2 hY) (union_subset_union_right _ fun z hz + => ?_) + refine ⟨hLD hz.1, fun hb => hz.2 ?_⟩ + exact hDL ⟨hb, hz.1⟩ + +/-- In a flat set, paths with the same ends are homotopic. -/ +theorem IsFlat.flat {A : Set S} (hA : IsFlat A) : Flat A := fun a b p q hp hq => by + obtain ⟨ψ, -, h0, h1, h2, -, h3, -⟩ := IsFlat.curvesHomotopic hA (φ₁ := p.toContinuousMap) (φ₂ + := q.toContinuousMap) + (by rintro _ ⟨u, rfl⟩; exact hp u) (by rintro _ ⟨u, rfl⟩; exact hq u) (by simp) (by simp) + refine ⟨⟨⟨⟨fun w => ψ (w.2, w.1), by fun_prop⟩, fun x => ?_, fun x => ?_⟩, fun t x hx => ?_⟩⟩ + · exact h0 x + · exact h1 x + · rcases hx with rfl | hx + · exact h2 t + · obtain rfl : x = 1 := hx + exact h3 t + +/-- A flat set in the sense of paths is flat. -/ +theorem Flat.isFlat {A : Set S} (hA : Flat A) : IsFlat A := fun φ hφ => by + have hK' := flat_univ_iff.mpr hA + let a : (univ : Set S) := ⟨φ (arcParam 1 0), trivial⟩ + let γ : Path a a := + ⟨⟨fun t => ⟨φ (arcParam 1 t), trivial⟩, by fun_prop⟩, rfl, Subtype.ext (by simp [a])⟩ + have hγ : ∀ u, γ u ∈ (Subtype.val ⁻¹' A : Set (univ : Set S)) := fun u => hφ ⟨_, rfl⟩ + have hh : γ.Homotopic (Path.refl a) := hK' _ _ hγ fun _ => by simpa using hγ 0 + exact ⟨a.1, a.2, closedCurvesHomotopicIn_of_path 1 φ (ContinuousMap.const _ a.1) γ (Path.refl a) + (fun _ => rfl) (fun _ => rfl) hh⟩ + +/-- **Adding a disc that joins two pieces of a flat open set.** Let `c₁` and `c₂` be disjoint +path-connected open subsets of a flat open set `Y`, and let `N` be the inside of a closed +disc. Suppose that `N` meets `Y` only in two path-connected sets, one in `c₁` and one in `c₂`. Then +`Y ∪ N` is flat. This is the step of the proof of (4.3) of Graph Minors VII (page 222) in which an +edge +between two components of `Y` is added to `Y`, and the proof is the van Kampen argument in +`flat_iUnion_cover`. A closed curve lies either in `Y` without `c₁`, `c₂`, or in `c₁ ∪ c₂ ∪ N`. -/ +theorem IsFlat.union_bridge {Y Δ A B c₁ c₂ : Set S} (hY : IsFlat Y) (h1Y : c₁ ⊆ Y) (h2Y : c₂ ⊆ Y) + (h1o : IsOpen c₁) (h2o : IsOpen c₂) (h1p : IsPathConnected c₁) (h2p : IsPathConnected c₂) + (hd : Disjoint c₁ c₂) (hrest : IsOpen (Y \ (c₁ ∪ c₂))) (hΔ : IsClosedDisc Δ) (hNo : IsOpen + (Δ \ discBd Δ)) (hA : IsPathConnected A) (hB : IsPathConnected B) (hAe : A = c₁ ∩ + (Δ \ discBd Δ)) (hBe : B = c₂ ∩ (Δ \ discBd Δ)) + (hYN : Y ∩ (Δ \ discBd Δ) ⊆ c₁ ∪ c₂) : IsFlat (Y ∪ (Δ \ discBd Δ)) := by + classical + set N := Δ \ discBd Δ with hN + have hAN : A ⊆ N := hAe ▸ inter_subset_right + have hBN : B ⊆ N := hBe ▸ inter_subset_right + have hNp : IsPathConnected N := by + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + have e : N = g '' Metric.ball 0 1 := c.discInt_eq + rw [e] + exact ((convex_ball 0 1).isPathConnected ⟨0, by simp⟩).image' + (c.gc.mono Metric.ball_subset_closedBall) + obtain ⟨a, ha⟩ := hA.nonempty + obtain ⟨b, hb⟩ := hB.nonempty + have hNf : Flat N := IsFlat.flat (fun φ hφ => ?_) + rotate_left + · obtain ⟨c, hc, h⟩ := null_of_disc φ.continuous hΔ (fun w => (hφ ⟨w, rfl⟩).1) + exact ⟨c, trivial, h.mono (subset_univ _)⟩ + let O : Fin 3 → Set S := ![c₁, c₂, N] + let bs : Fin 3 → S := ![a, b, a] + have hOo : ∀ i, IsOpen (O i) := by + intro i + fin_cases i + · exact h1o + · exact h2o + · exact hNo + have hOp : ∀ i, IsPathConnected (O i) := by + intro i + fin_cases i + · exact h1p + · exact h2p + · exact hNp + have hOb : ∀ i, bs i ∈ O i := by + intro i + fin_cases i + · exact (hAe.subset ha).1 + · exact (hBe.subset hb).1 + · exact hAN ha + have hOf : ∀ i, Flat (O i) := by + intro i + fin_cases i + · exact IsFlat.flat (IsFlat.mono hY h1Y) + · exact IsFlat.flat (IsFlat.mono hY h2Y) + · exact hNf + have hNs : ∀ {P : Set S}, P ⊆ N → ∀ z ∈ P, ∀ w ∈ P, IsPathConnected P + → ∃ f : GM11.Cl z w, GM11.Arw N f := fun hs z hz w hw hc => by + have hj := hc.joinedIn z hz w hw + exact ⟨GM11.Cl.mk hj.somePath, hj.somePath, fun u => hs (hj.somePath_mem u), rfl⟩ + have hF : Flat (⋃ i, O i) := by + refine flat_iUnion_cover hNf O bs hOo hOb hOp hOf fun i j y hi hj => ?_ + have hto : ∀ i, y ∈ O i → y ∈ N → ∃ f : GM11.Cl (bs i) y, GM11.Arw (O i) f ∧ GM11.Arw N f := by + intro i hi hyN + fin_cases i + · have hyA : y ∈ A := hAe.symm.subset ⟨hi, hyN⟩ + have hj := hA.joinedIn a ha y hyA + have hm : ∀ u, hj.somePath u ∈ c₁ ∩ N := fun u => hAe.subset (hj.somePath_mem u) + exact ⟨GM11.Cl.mk hj.somePath, ⟨hj.somePath, fun u => (hm u).1, rfl⟩, hj.somePath, + fun u => (hm u).2, rfl⟩ + · have hyB : y ∈ B := hBe.symm.subset ⟨hi, hyN⟩ + have hj := hB.joinedIn b hb y hyB + have hm : ∀ u, hj.somePath u ∈ c₂ ∩ N := fun u => hBe.subset (hj.somePath_mem u) + exact ⟨GM11.Cl.mk hj.somePath, ⟨hj.somePath, fun u => (hm u).1, rfl⟩, hj.somePath, + fun u => (hm u).2, rfl⟩ + · have hj := hNp.joinedIn a (hAN ha) y hyN + exact ⟨GM11.Cl.mk hj.somePath, ⟨hj.somePath, hj.somePath_mem, rfl⟩, hj.somePath, + hj.somePath_mem, rfl⟩ + by_cases hyN : y ∈ N + · obtain ⟨f, hf, hf'⟩ := hto i hi hyN + obtain ⟨g, hg, hg'⟩ := hto j hj hyN + exact ⟨f, g.symm, hf, hg.symm, hf'.trans hg'.symm⟩ + · have hsame : i = j := by + fin_cases i <;> fin_cases j <;> first + | rfl + | exact (hyN hi).elim + | exact (hyN hj).elim + | exact (disjoint_left.mp hd hi hj).elim + | exact (disjoint_left.mp hd hj hi).elim + subst hsame + have hjn := (hOp i).joinedIn (bs i) (hOb i) y hi + have hf : GM11.Arw (O i) (GM11.Cl.mk hjn.somePath) := ⟨hjn.somePath, hjn.somePath_mem, rfl⟩ + refine ⟨_, _, hf, hf.symm, ?_⟩ + rw [GM11.cl_trans_symm] + have hbN : bs i ∈ N := by + fin_cases i + · exact hAN ha + · exact hBN hb + · exact hAN ha + exact GM11.arw_refl hbN + have hIF : IsFlat (⋃ i, O i) := Flat.isFlat hF + intro φ hφ + have hpre : IsPreconnected (range φ) := isPreconnected_range φ.continuous + have hunion : (⋃ i, O i) = c₁ ∪ c₂ ∪ N := by + ext z + simp only [mem_iUnion, Fin.exists_fin_succ, O, mem_union] + simp + tauto + have hWo : IsOpen (⋃ i, O i) := isOpen_iUnion hOo + have hdis : Disjoint (⋃ i, O i) (Y \ (c₁ ∪ c₂)) := by + rw [hunion, disjoint_left] + rintro z (h | h) hz + · exact hz.2 h + · exact hz.2 (hYN ⟨hz.1, h⟩) + have hcov : range φ ⊆ (⋃ i, O i) ∪ (Y \ (c₁ ∪ c₂)) := fun z hz => by + by_cases h : z ∈ c₁ ∪ c₂ + · refine .inl ?_ + rw [hunion] + exact .inl h + · rcases hφ hz with h1 | h1 + · exact .inr ⟨h1, h⟩ + · refine .inl ?_ + rw [hunion] + exact .inr h1 + rcases hpre.subset_or_subset hWo hrest hdis hcov with h | h + · exact hIF φ h + · exact hY φ (h.trans sdiff_subset) + +/-- An `O`-arc cut into two lines at `x` and `w`. Near `w` it has a third line `R` between two +points `a`, `b` of the two lines. It holds `w` and not `x`, and the rest of the `O`-arc is a closed +set `R'`. -/ +theorem exists_piece_around [T2Space S] {C P Q : Set S} {x w a b : S} (hO : IsOArc C) + (hP : IsLineWithEnds P x w) (hQ : IsLineWithEnds Q x w) (hPQ : P ∪ Q = C) (hPQi : P ∩ Q = {x, w}) + (ha : a ∈ P \ {x, w}) (hb : b ∈ Q \ {x, w}) : ∃ R R' : Set S, IsLineWithEnds R a b + ∧ IsClosed R' ∧ R ∪ R' = C ∧ R ∩ R' ⊆ {a, b} ∧ w ∈ R ∧ x ∉ R := by + have hPs : P ⊆ C := hPQ ▸ subset_union_left + have hQs : Q ⊆ C := hPQ ▸ subset_union_right + have hab : a ≠ b := fun h => ha.2 (hPQi ▸ ⟨ha.1, h ▸ hb.1⟩) + obtain ⟨R₀, R₁, hR₀, hR₁, hRu, hRi⟩ := hO.lines (hPs ha.1) (hQs hb.1) hab + have hxa : x ≠ a := fun h => ha.2 (.inl h.symm) + have hxb : x ≠ b := fun h => hb.2 (.inl h.symm) + have hwa : w ≠ a := fun h => ha.2 (.inr h.symm) + have hwb : w ≠ b := fun h => hb.2 (.inr h.symm) + have hsep : ∀ {R₂ : Set S}, IsLineWithEnds R₂ a b → R₂ ⊆ C → x ∉ R₂ → w ∉ R₂ → False + := fun {R₂} hR₂ hs hx' hw' => by + have hc := (isConnected_line hR₂).isPreconnected + have hcov : R₂ ⊆ P ∪ Q := hPQ ▸ hs + obtain ⟨z, hz, h1⟩ := isPreconnected_closed_iff.mp hc P Q hP.isCompact.isClosed + hQ.isCompact.isClosed hcov ⟨a, hR₂.left_mem, ha.1⟩ ⟨b, hR₂.right_mem, hb.1⟩ + have : z ∈ ({x, w} : Set S) := hPQi ▸ h1 + rcases this with rfl | h + · exact hx' hz + · exact hw' ((mem_singleton_iff.mp h) ▸ hz) + have hwm : w ∈ R₀ ∪ R₁ := hRu ▸ hPs hP.right_mem + have hRs₀ : R₀ ⊆ C := hRu ▸ subset_union_left + have hRs₁ : R₁ ⊆ C := hRu ▸ subset_union_right + have hnot : ∀ z, z ≠ a → z ≠ b → z ∈ R₀ → z ∉ R₁ := fun z h1 h2 h3 h4 => by + rcases (hRi ▸ ⟨h3, h4⟩ : z ∈ ({a, b} : Set S)) with h | h + · exact h1 h + · exact h2 h + rcases hwm with h | h + · exact ⟨R₀, R₁, hR₀, hR₁.isCompact.isClosed, hRu, hRi.subset, h, + fun h2 => hsep hR₁ hRs₁ (hnot x hxa hxb h2) (hnot w hwa hwb h)⟩ + · exact ⟨R₁, R₀, hR₁, hR₀.isCompact.isClosed, by rwa [union_comm], + by rw [inter_comm]; exact hRi.subset, h, + fun h2 => hsep hR₀ hRs₀ (fun h3 => hnot x hxa hxb h3 h2) (fun h3 => hnot w hwa hwb h3 h)⟩ + +/-- Let `e` be a loop of a proper graph, cut into two lines `P` and `Q` at `s` and `t`. If `s` lies +in a flat set `Y` that holds all of `Σ` off `U(G)` and `bd(Σ)`, then `Y` stays flat when we add both +lines. -/ +theorem IsFlat.union_pair (hS : IsSurface S) {G : Drawing S} (hG : G.IsProper) {Y : Set S} + (hY : IsFlat Y) (hrest : ∀ z, z ∉ G.U → z ∉ bd S → z ∈ Y) {e : Set S} (he : e ∈ G.E) {u : S} + (hcap : closure e ∩ G.V = {u}) {P Q : Set S} {s t : S} (hP : IsLineWithEnds P s t) + (hQ : IsLineWithEnds Q s t) (hPQ : P ∪ Q = closure e) (hPQi : P ∩ Q = {s, t}) (hu : u ∈ + ({s, t} : Set S)) (hsY : s ∈ Y) : + IsFlat (Y ∪ (P \ {s, t}) ∪ (Q \ {s, t})) := by + have ht2 : T2Space S := hS.2.1 + have hW0 : IsClosed (G.U \ e) := isClosed_U_sdiff_edge G he + have hclU : closure e ⊆ G.U := G.closure_subset_U he + have hdiff : closure e \ G.V = e := G.closure_diff_V he + have hinV : ∀ z ∈ closure e, z ∉ e → z = u := fun z h1 h2 => by + have h3 : z ∈ G.V := by + by_contra h3 + apply h2 + rw [← hdiff] + exact ⟨h1, h3⟩ + have hm : z ∈ closure e ∩ G.V := ⟨h1, h3⟩ + rw [hcap] at hm + exact hm + have hbV : ∀ z ∈ closure e, z ∈ bd S → z = u := fun z h1 h2 => by + have hm : z ∈ closure e ∩ G.V := ⟨h1, hG ⟨h2, hclU h1⟩⟩ + rw [hcap] at hm + exact hm + have hmain : ∀ {Y' R R' : Set S}, IsFlat Y' → Y ⊆ Y' → s ∈ Y' → IsLineWithEnds R s t + → IsLineWithEnds R' s t → R ∪ R' = closure e → R ∩ R' = {s, t} → IsFlat (Y' ∪ (R \ {s, t})) + := fun {Y' R R'} hF hs hsY' hR hR' hu' hi => by + have hRs : R ⊆ closure e := hu' ▸ subset_union_left + refine IsFlat.union_line hS hF hR (hW0.union hR'.isCompact.isClosed) ?_ ?_ hsY' fun z h1 h2 h3 + => hs (hrest z (fun h => ?_) h2) + · rintro z ⟨hz, h | h⟩ + · have := hinV z (hRs hz) h.2 + exact this ▸ hu + · have : z ∈ R ∩ R' := ⟨hz, h⟩ + rwa [hi] at this + · rintro z ⟨hz, hb⟩ + have := hbV z (hRs hz) hb + exact this ▸ hu + · by_cases h4 : z ∈ e + · have : z ∈ R ∪ R' := hu' ▸ subset_closure h4 + rcases this with h5 | h5 + · exact h3 h5 + · exact h1 (.inr h5) + · exact h1 (.inl ⟨h, h4⟩) + have hF1 := hmain hY subset_rfl hsY hP hQ hPQ hPQi + exact hmain hF1 subset_union_left (.inl hsY) hQ hP + (by rwa [union_comm]) (by rwa [inter_comm]) + +/-- A flat set that holds all of `Σ` off `U(G)` and `bd(Σ)`, and a point of a loop `e`, stays flat +when we add `e`. -/ +theorem IsFlat.union_loop (hS : IsSurface S) {G : Drawing S} (hG : G.IsProper) {Y : Set S} + (hY : IsFlat Y) (hrest : ∀ z, z ∉ G.U → z ∉ bd S → z ∈ Y) {e : Set S} (he : e ∈ G.E) {u : S} + (hcap : closure e ∩ G.V = {u}) (hO : IsOArc (closure e)) {w : S} (hwe : w ∈ e) + (hwY : w ∈ Y) : IsFlat (Y ∪ e) := by + have ht2 : T2Space S := hS.2.1 + have hu : u ∈ closure e ∩ G.V := by + rw [hcap] + rfl + have hoff : ∀ z ∈ e, z ∉ G.V := fun z hz => by + have h : z ∈ closure e \ G.V := by + rw [G.closure_diff_V he] + exact hz + exact h.2 + have hwu : w ≠ u := fun h => hoff w hwe (h ▸ hu.2) + obtain ⟨P, Q, hP, hQ, hPQ, hPQi⟩ := hO.lines (subset_closure hwe) hu.1 hwu + refine IsFlat.mono (IsFlat.union_pair hS hG hY hrest he hcap hP hQ hPQ hPQi + (.inr rfl) hwY) fun z hz => ?_ + rcases hz with hz | hz + · exact .inl (.inl hz) + by_cases hzw : z = w + · exact .inl (.inl (hzw ▸ hwY)) + have hzu : z ≠ u := fun h => hoff z hz (h ▸ hu.2) + have : z ∈ P ∪ Q := hPQ ▸ subset_closure hz + rcases this with h | h + · exact .inl (.inr ⟨h, by simp [hzw, hzu]⟩) + · exact .inr ⟨h, by simp [hzw, hzu]⟩ + +/-- **Adding an edge at a vertex of a flat set.** Let `Y` be flat, hold all of `Σ` off `U(G)` and +`bd(Σ)`, and hold an end of the edge `e` of the proper graph `G`. +Then `Y ∪ e` is flat. For a loop we cut `ē` at a point `w` into two lines, add them in turn by +`IsFlat.union_line`, and then add `w` with a line around it. -/ +theorem IsFlat.union_edge (hS : IsSurface S) {G : Drawing S} (hG : G.IsProper) {Y : Set S} + (hY : IsFlat Y) (hrest : ∀ z, z ∉ G.U → z ∉ bd S → z ∈ Y) {e : Set S} (he : e ∈ G.E) {x : S} + (hx : x ∈ closure e) (hxV : x ∈ G.V) (hxY : x ∈ Y) : IsFlat (Y ∪ e) := by + classical + have ht2 : T2Space S := hS.2.1 + have hW0 : IsClosed (G.U \ e) := isClosed_U_sdiff_edge G he + have hclU : closure e ⊆ G.U := G.closure_subset_U he + have hdiff : closure e \ G.V = e := G.closure_diff_V he + have hoff : ∀ z ∈ e, z ∉ G.V := fun z hz => by + have h : z ∈ closure e \ G.V := by + rw [hdiff] + exact hz + exact h.2 + have hinV : ∀ z ∈ closure e, z ∉ e → z ∈ G.V := fun z h1 h2 => by + by_contra h3 + apply h2 + rw [← hdiff] + exact ⟨h1, h3⟩ + have hbV : ∀ z ∈ closure e, z ∈ bd S → z ∈ G.V := fun z h1 h2 => hG ⟨h2, hclU h1⟩ + rcases G.edge_cond e he with ⟨u, v, huv, hcap, hl⟩ | ⟨u, hcap, hO⟩ + · -- `e` is a line. + have hxe : x ∈ ({u, v} : Set S) := hcap ▸ ⟨hx, hxV⟩ + obtain ⟨u', hu', hl'⟩ : ∃ u', closure e ∩ G.V = {x, u'} ∧ IsLineWithEnds (closure e) x u' := by + rcases hxe with rfl | h + · exact ⟨v, hcap, hl⟩ + · obtain rfl : x = v := h + exact ⟨u, by rw [hcap, pair_comm], hl.symm⟩ + have hW : closure e ∩ (G.U \ e) ⊆ {x, u'} := fun z hz => hu' ▸ ⟨hz.1, hinV z hz.1 hz.2.2⟩ + have hb : closure e ∩ bd S ⊆ {x, u'} := fun z hz => hu' ▸ ⟨hz.1, hbV z hz.1 hz.2⟩ + refine IsFlat.mono (IsFlat.union_line hS hY hl' hW0 hW hb hxY fun z h1 h2 h3 => hrest z (fun h + => h3 ?_) h2) (union_subset_union_right _ fun z hz => ?_) + · by_contra h4 + exact h1 ⟨h, fun h5 => h4 (subset_closure h5)⟩ + · refine ⟨subset_closure hz, fun h => ?_⟩ + have h1 : z ∈ closure e ∩ G.V := hu' ▸ h + exact hoff z hz h1.2 + · -- `e` is a loop at `x`. + have hxu : x = u := by + have : x ∈ ({u} : Set S) := hcap ▸ ⟨hx, hxV⟩ + exact this + subst hxu + obtain ⟨w, hwe⟩ : e.Nonempty := he.2.2.1.nonempty + have hwx : x ≠ w := fun h => hoff w hwe (h ▸ hxV) + obtain ⟨P, Q, hP, hQ, hPQ, hPQi⟩ := hO.lines hx (subset_closure hwe) hwx + have hF2 := IsFlat.union_pair hS hG hY hrest he hcap hP hQ hPQ hPQi (.inl rfl) hxY + obtain ⟨a, ha⟩ := GM14.IsLineWithEnds.nonempty_sdiff_pair hP + obtain ⟨b, hb⟩ := GM14.IsLineWithEnds.nonempty_sdiff_pair hQ + have hmem : a ∈ e := by + by_contra h + have hm : a ∈ closure e ∩ G.V := ⟨hPQ ▸ .inl ha.1, hinV a (hPQ ▸ .inl ha.1) h⟩ + rw [hcap] at hm + exact ha.2 (.inl hm) + refine IsFlat.mono (IsFlat.union_loop hS hG hF2 (fun z h1 h2 => .inl (.inl + (hrest z h1 h2))) he hcap hO hmem (.inl (.inr ha))) ?_ + exact union_subset_union_left _ (subset_union_left.trans subset_union_left) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/FlatMinimal.lean b/LeanPool/GraphMinor/GM07/FlatMinimal.lean new file mode 100644 index 0000000000..3fa1db6e5b --- /dev/null +++ b/LeanPool/GraphMinor/GM07/FlatMinimal.lean @@ -0,0 +1,406 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.FlatEdges +public import LeanPool.GraphMinor.GM07.GoodEdge + +/-! +# A smallest graph with a flat complement + +This file is the middle part of the proof of (4.3) of Graph Minors VII (pages 222 and 223). The +paper takes a maximal flat set `Y`. Here we take instead a smallest subgraph `K` of `G`, avoiding a +given set of vertices, for which the set `offSet K`, the part of the surface off `U(K)` and off +`bd(Σ)`, is flat. Then `offSet K` is the set `Y` of the paper, and maximal `Y` means smallest `K`. + +The two facts on `Y` in the paper are `isPreconnected_offSet`, which says that `Y` is connected, and +`disc_subset_offSet`, which says that every closed disc with boundary in `Y` lies in `Y`. For the +first, +an edge with different components of `Y` on its two sides can be added to `Y`, by +`IsFlat.union_bridge`. If there is no such edge, then the components of `Y` extend over the edges to +a partition +of the surface without its vertices and cuffs, and this set is connected. For the second, `Y ∪ Δ` is +flat by (11.3). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] + +/-- The part of the surface off a graph and off the boundary. -/ +def offSet (K : Drawing S) : Set S := (K.U ∪ bd S)ᶜ + +theorem mem_offSet {K : Drawing S} {z : S} : z ∈ offSet K ↔ z ∉ K.U ∧ z ∉ bd S := by + simp [offSet] + +theorem isOpen_offSet (hS : IsSurface S) (K : Drawing S) : IsOpen (offSet K) := + (K.isClosed_U.union (cuff_statement.{0} S hS).1).isOpen_compl + +/-- A connected open set of a surface is path-connected. -/ +theorem isPathConnected_of_isOpen (hS : IsSurface S) {Z : Set S} (ho : IsOpen Z) + (hc : IsConnected Z) : IsPathConnected Z := by + have ht2 : T2Space S := hS.2.1 + have h := isArcConnected_iff_joinedIn.mp (theorem_11_4_proof hS hc + (isLocallyArcConnected_of_isOpen hS ho)) + exact isPathConnected_iff.mpr ⟨hc.1, h⟩ + +/-- A point `p` of an edge `e` of a proper graph `K` lies inside a closed disc that meets `offSet K` +in two path-connected sides `A` and `B`, with `p` in the closure of both. If `offSet K` stays flat +when we add the inside of +the disc, then it also stays flat when we add `e`. For an edge that is a line the disc holds all of +`e`. For a loop the disc holds only a piece of `e`, and we add the rest with `IsFlat.union_loop`. -/ +theorem exists_edge_sides (hS : IsSurface S) {K : Drawing S} (hK : K.IsProper) {e : Set S} + (he : e ∈ K.E) {p : S} (hp : p ∈ e) : + ∃ Δ A B : Set S, IsClosedDisc Δ ∧ IsOpen (Δ \ discBd Δ) ∧ p ∈ Δ \ discBd Δ ∧ A ⊆ offSet K + ∧ B ⊆ offSet K ∧ A ⊆ Δ \ discBd Δ ∧ B ⊆ Δ \ discBd Δ ∧ + offSet K ∩ (Δ \ discBd Δ) ⊆ A ∪ B ∧ IsPathConnected A ∧ IsPathConnected B ∧ p ∈ closure A + ∧ p ∈ closure B ∧ + (IsFlat (offSet K ∪ (Δ \ discBd Δ)) → IsFlat (offSet K ∪ e)) := by + classical + have ht2 : T2Space S := hS.2.1 + have hdiff : closure e \ K.V = e := K.closure_diff_V he + have hclU : closure e ⊆ K.U := K.closure_subset_U he + have hoff : ∀ z ∈ e, z ∉ K.V := fun z hz => by + have h : z ∈ closure e \ K.V := by + rw [hdiff] + exact hz + exact h.2 + have hinV : ∀ z ∈ closure e, z ∉ e → z ∈ K.V := fun z h1 h2 => by + by_contra h3 + apply h2 + rw [← hdiff] + exact ⟨h1, h3⟩ + obtain ⟨R, R', a, b, hl, hR'c, hRu, hRi, hpR, hpa, hpb, hRV, hcase⟩ : ∃ (R R' : Set S) + (a b : S), IsLineWithEnds R a b ∧ IsClosed R' ∧ R ∪ R' = closure e ∧ R ∩ R' ⊆ {a, b} ∧ p ∈ R + ∧ p ≠ a ∧ p ≠ b ∧ + R ∩ K.V ⊆ {a, b} ∧ (e ⊆ R \ {a, b} ∨ ∃ u, closure e ∩ K.V = {u} ∧ IsOArc (closure e)) := by + rcases K.edge_cond e he with ⟨u, v, huv, hcap, hl⟩ | ⟨u, hcap, hO⟩ + · have hne : ∀ z ∈ e, z ∉ ({u, v} : Set S) := fun z hz h => hoff z hz (hcap.symm.subset h).2 + refine ⟨closure e, ∅, u, v, hl, isClosed_empty, by simp, by simp, subset_closure hp, + fun h => hne p hp (.inl h), fun h => hne p hp (.inr h), hcap.subset, + .inl fun z hz => ⟨subset_closure hz, hne z hz⟩⟩ + · have hu : u ∈ closure e ∩ K.V := by + rw [hcap] + rfl + have hup : u ≠ p := fun h => hoff p hp (h ▸ hu.2) + obtain ⟨P, Q, hP, hQ, hPQ, hPQi⟩ := hO.lines hu.1 (subset_closure hp) hup + obtain ⟨c, hc⟩ := GM14.IsLineWithEnds.nonempty_sdiff_pair hP + obtain ⟨d, hd⟩ := GM14.IsLineWithEnds.nonempty_sdiff_pair hQ + obtain ⟨R, R', hR, hR'c, hu', hi, hwR, hxR⟩ := exists_piece_around hO hP hQ hPQ hPQi hc hd + refine ⟨R, R', c, d, hR, hR'c, hu', hi, hwR, fun h => hc.2 (.inr h.symm), + fun h => hd.2 (.inr h.symm), fun z hz => ?_, .inr ⟨u, hcap, hO⟩⟩ + have hm : z ∈ closure e ∩ K.V := ⟨hu' ▸ .inl hz.1, hz.2⟩ + rw [hcap] at hm + obtain rfl : z = u := hm + exact (hxR hz.1).elim + have hRs : R ⊆ closure e := hRu ▸ subset_union_left + have hWc : IsClosed ((K.U \ e) ∪ R') := (isClosed_U_sdiff_edge K he).union hR'c + have hLW : R ∩ ((K.U \ e) ∪ R') ⊆ {a, b} := by + rintro z ⟨hz, h | h⟩ + · exact hRV ⟨hz, hinV z (hRs hz) h.2⟩ + · exact hRi ⟨hz, h⟩ + have hLb : R ∩ bd S ⊆ {a, b} := fun z hz => hRV ⟨hz.1, hK ⟨hz.2, hclU (hRs hz.1)⟩⟩ + obtain ⟨Δ, A, B, hΔ, hLD, hDZ, haC, hbC, hDL, hNo, hsub, hAN, hBN, -, hAL, hBL, hAp, hBp, hAc, + hBc⟩ := exists_line_lens hS hl hWc hLW hLb + have hends : ∀ z ∈ Δ \ discBd Δ, z ∉ ({a, b} : Set S) := fun z hz h => by + rcases h with rfl | h + · exact hz.2 haC + · exact hz.2 ((mem_singleton_iff.mp h) ▸ hbC) + have hpN : p ∈ Δ \ discBd Δ := ⟨hLD hpR, fun h => by + rcases hDL ⟨h, hpR⟩ with h2 | h2 + · exact hpa h2 + · exact hpb h2⟩ + have hinY : ∀ z ∈ Δ \ discBd Δ, z ∉ R → z ∈ offSet K := fun z hz hzR => by + refine mem_offSet.mpr ⟨fun hU => ?_, fun hb => hends z hz (hDZ ⟨hz.1, .inr hb⟩)⟩ + by_cases hze : z ∈ e + · have : z ∈ R ∪ R' := hRu ▸ subset_closure hze + rcases this with h | h + · exact hzR h + · exact hends z hz (hDZ ⟨hz.1, .inl (.inr h)⟩) + · exact hends z hz (hDZ ⟨hz.1, .inl (.inl ⟨hU, hze⟩)⟩) + have hne : p ∈ R \ {a, b} := ⟨hpR, by simp [hpa, hpb]⟩ + refine ⟨Δ, A, B, hΔ, hNo, hpN, fun z hz => hinY z (hAN hz) (disjoint_left.mp hAL hz), fun z hz + => hinY z (hBN hz) (disjoint_left.mp hBL hz), hAN, hBN, ?_, hAp, hBp, hAc hne, hBc hne, fun hF + => ?_⟩ + · rintro z ⟨hz, hzN⟩ + rcases hsub hzN with (h | h) | h + · exact .inl h + · exact .inr h + · exact ((mem_offSet.mp hz).1 (hclU (hRs h))).elim + · rcases hcase with hs | ⟨u, hcap, hO⟩ + · refine IsFlat.mono hF (union_subset_union_right _ fun z hz => ?_) + have h2 := hs hz + refine ⟨hLD h2.1, fun h3 => h2.2 (hDL ⟨h3, h2.1⟩)⟩ + · refine IsFlat.mono (IsFlat.union_loop hS hK hF (fun z h1 h2 => .inl (mem_offSet.mpr ⟨h1, + h2⟩)) he hcap hO hp (.inr hpN)) ?_ + exact union_subset_union_left _ subset_union_left + +/-- **The set `Y` is connected** (Graph Minors VII, page 222). If `offSet K` is flat and cannot take +any edge of `K`, then it is connected. -/ +theorem isPreconnected_offSet (hS : IsSurface S) [ConnectedSpace S] {K : Drawing S} + (hK : K.IsProper) (hY : IsFlat (offSet K)) (hmin : ∀ e ∈ K.E, ¬ IsFlat (offSet K ∪ e)) : + IsPreconnected (offSet K) := by + classical + have ht2 : T2Space S := hS.2.1 + have hlc : LocallyConnectedSpace S := hS.locallyConnected + have hYo : IsOpen (offSet K) := isOpen_offSet hS K + generalize hYdef : offSet K = Y at hY hmin hYo ⊢ + let comp : S → Set S := fun z => connectedComponentIn Y z + have hco : ∀ z, IsOpen (comp z) := fun z => hYo.connectedComponentIn + have hcs : ∀ z, comp z ⊆ Y := fun z => connectedComponentIn_subset Y z + have hself : ∀ z ∈ Y, z ∈ comp z := fun z hz => mem_connectedComponentIn hz + have hsame : ∀ z w, w ∈ comp z → comp z = comp w := fun z w h => connectedComponentIn_eq h + have hpcomp : ∀ z ∈ Y, IsPathConnected (comp z) := fun z hz => isPathConnected_of_isOpen hS + (hco z) ⟨⟨z, hself z hz⟩, isPreconnected_connectedComponentIn⟩ + have hdis : ∀ z w, comp z ≠ comp w → Disjoint (comp z) (comp w) := fun z w hne + => disjoint_left.mpr fun x h1 h2 => hne ((hsame z x h1).trans (hsame w x h2).symm) + have hsub : ∀ {A : Set S}, IsPreconnected A → ∀ a ∈ A, A ⊆ Y → A ⊆ comp a := fun hA a ha hs + => hA.subset_connectedComponentIn ha hs + have hloc : ∀ p ∈ (bd S)ᶜ \ K.V, (∃ z ∈ Y, ∃ N, IsOpen N ∧ p ∈ N ∧ N ∩ Y ⊆ comp z) + ∧ p ∈ closure Y := by + intro p hp + by_cases hpU : p ∈ K.U + · obtain ⟨e, he, hpe⟩ : ∃ e ∈ K.E, p ∈ e := by + rw [K.U_eq] at hpU + rcases hpU with h | h + · exact (hp.2 h).elim + · obtain ⟨e, he, hpe⟩ := mem_iUnion₂.mp h + refine ⟨e, he, ?_⟩ + rw [← K.closure_diff_V he] + exact ⟨hpe, hp.2⟩ + obtain ⟨Δ, A, B, hΔ, hNo, hpN, hAY, hBY, hAN, hBN, hYN, hAp, hBp, hpA, hpB, hflat⟩ + := exists_edge_sides hS hK he hpe + rw [hYdef] at hAY hBY hYN hflat + obtain ⟨a, ha⟩ := hAp.nonempty + obtain ⟨b, hb⟩ := hBp.nonempty + have hAc := hsub hAp.isConnected.isPreconnected a ha hAY + have hBc := hsub hBp.isConnected.isPreconnected b hb hBY + by_cases heq : comp a = comp b + · refine ⟨⟨a, hAY ha, _, hNo, hpN, fun z hz => ?_⟩, closure_mono hAY hpA⟩ + rcases hYN ⟨hz.2, hz.1⟩ with h | h + · exact hAc h + · exact heq ▸ hBc h + · exfalso + refine hmin e he (hflat ?_) + have hd := hdis a b heq + refine IsFlat.union_bridge hY (hcs a) (hcs b) (hco a) (hco b) (hpcomp a (hAY ha)) (hpcomp b + (hBY hb)) hd ?_ hΔ hNo hAp hBp ?_ ?_ ?_ + · refine isOpen_iff_forall_mem_open.mpr fun x hx => ⟨comp x, fun y hy => ⟨hcs x hy, ?_⟩, + hco x, hself x hx.1⟩ + rintro (h | h) + · exact hx.2 (.inl ((hsame a y h).trans (hsame x y hy).symm ▸ hself x hx.1)) + · exact hx.2 (.inr ((hsame b y h).trans (hsame x y hy).symm ▸ hself x hx.1)) + · refine Subset.antisymm (fun z hz => ⟨hAc hz, hAN hz⟩) fun z hz => ?_ + rcases hYN ⟨hcs a hz.1, hz.2⟩ with h | h + · exact h + · exact (disjoint_left.mp hd hz.1 (hBc h)).elim + · refine Subset.antisymm (fun z hz => ⟨hBc hz, hBN hz⟩) fun z hz => ?_ + rcases hYN ⟨hcs b hz.1, hz.2⟩ with h | h + · exact (disjoint_left.mp hd (hAc h) hz.1).elim + · exact h + · intro z hz + rcases hYN hz with h | h + · exact .inl (hAc h) + · exact .inr (hBc h) + · have hpY : p ∈ Y := by + rw [← hYdef] + exact mem_offSet.mpr ⟨hpU, hp.1⟩ + exact ⟨⟨p, hpY, _, hco p, hself p hpY, inter_subset_left⟩, subset_closure hpY⟩ + rcases Y.eq_empty_or_nonempty with rfl | ⟨z₀, hz₀⟩ + · exact isPreconnected_empty + have hYM : Y ⊆ (bd S)ᶜ \ K.V := fun z hz => by + rw [← hYdef] at hz + have h := mem_offSet.mp hz + exact ⟨h.2, fun hv => h.1 (K.V_subset_U hv)⟩ + have hall : ∀ z ∈ Y, comp z = comp z₀ := by + intro z₁ hz₁ + by_contra hne + let u : Set S := ⋃₀ {N | IsOpen N ∧ N ∩ Y ⊆ comp z₀} + let v : Set S := ⋃₀ {N | IsOpen N ∧ ∃ z ∈ Y, comp z ≠ comp z₀ ∧ N ∩ Y ⊆ comp z} + have huo : IsOpen u := isOpen_sUnion fun N hN => hN.1 + have hvo : IsOpen v := isOpen_sUnion fun N hN => hN.1 + have hcov : (bd S)ᶜ \ K.V ⊆ u ∪ v := fun p hp => by + obtain ⟨⟨z, hz, N, hNo, hpN, hN⟩, -⟩ := hloc p hp + by_cases h : comp z = comp z₀ + · exact .inl ⟨N, ⟨hNo, h ▸ hN⟩, hpN⟩ + · exact .inr ⟨N, ⟨hNo, z, hz, h, hN⟩, hpN⟩ + have hz₀u : z₀ ∈ u := ⟨comp z₀, ⟨hco z₀, inter_subset_left⟩, hself z₀ hz₀⟩ + have hz₁v : z₁ ∈ v := ⟨comp z₁, ⟨hco z₁, z₁, hz₁, hne, inter_subset_left⟩, hself z₁ hz₁⟩ + obtain ⟨p, hpM, ⟨N₁, ⟨hN₁o, hN₁⟩, hp₁⟩, ⟨N₂, ⟨hN₂o, z, hz, hc, hN₂⟩, hp₂⟩⟩ := + isPreconnected_interior_sdiff_finite hS K.finite_V u v huo hvo hcov ⟨z₀, hYM hz₀, hz₀u⟩ ⟨z₁, + hYM hz₁, hz₁v⟩ + obtain ⟨y, hy, hyY⟩ := mem_closure_iff.mp (hloc p hpM).2 _ (hN₁o.inter hN₂o) ⟨hp₁, hp₂⟩ + exact hc ((hsame z y (hN₂ ⟨hy.2, hyY⟩)).trans (hsame z₀ y (hN₁ ⟨hy.1, hyY⟩)).symm) + have heq : Y = comp z₀ := Subset.antisymm (fun z hz => hall z hz ▸ hself z hz) (hcs z₀) + rw [heq] + exact isPreconnected_connectedComponentIn + +/-- A subgraph of `G` that avoids `X` and has a flat complement. -/ +def IsFlatSub (G : Drawing S) (X : Set S) (K : Drawing S) : Prop := + K.IsSubdrawing G ∧ Disjoint K.V X ∧ IsFlat (offSet K) + +/-- The size of a graph. -/ +noncomputable def graphSize (K : Drawing S) : ℕ := K.V.ncard + K.E.ncard + +theorem exists_smallest_flatSub {G : Drawing S} {X : Set S} (h : ∃ K, IsFlatSub G X K) : ∃ K, + IsFlatSub G X K ∧ ∀ K', IsFlatSub G X K' → graphSize K ≤ graphSize K' := by + classical + have hex : ∃ n, ∃ K, IsFlatSub G X K ∧ graphSize K = n := by + obtain ⟨K, hK⟩ := h + exact ⟨_, K, hK, rfl⟩ + obtain ⟨K, hK, hn⟩ := Nat.find_spec hex + exact ⟨K, hK, fun K' hK' => hn ▸ Nat.find_min' hex ⟨K', hK', rfl⟩⟩ + +theorem IsSubdrawing.trans' {A B C : Drawing S} (h : A.IsSubdrawing B) + (h' : B.IsSubdrawing C) : A.IsSubdrawing C := + ⟨h.1.trans h'.1, h.2.trans h'.2⟩ + +/-- The subgraph of `K` with vertices `V'` and edges `E'`. -/ +theorem exists_sub [T1Space S] {K : Drawing S} {V' : Set S} {E' : Set (Set S)} (hV : V' ⊆ K.V) + (hE : E' ⊆ K.E) (hc : ∀ e ∈ E', closure e ∩ K.V ⊆ V') : + ∃ K' : Drawing S, K'.IsSubdrawing K ∧ K'.V = V' ∧ K'.E = E' := by + refine ⟨K.span V' E', K.span_isSubdrawing V' E', ?_, ?_⟩ + · rw [K.span_V] + unfold Drawing.spanV + refine Subset.antisymm (union_subset inter_subset_left (iUnion₂_subset fun e he + => hc e he.1)) fun z hz => .inl ⟨hz, hV hz⟩ + · rw [K.span_E, inter_eq_left.mpr hE] + +/-- A smallest `K` cannot take any edge. -/ +theorem not_isFlat_union_edge [T1Space S] {G : Drawing S} {X : Set S} {K : Drawing S} + (hK : IsFlatSub G X K) (hmin : ∀ K', IsFlatSub G X K' → graphSize K ≤ graphSize K') {e : Set S} + (he : e ∈ K.E) : + ¬ IsFlat (offSet K ∪ e) := by + classical + intro hF + obtain ⟨K', hs, hV, hE⟩ := exists_sub (K := K) (V' := K.V) (E' := K.E \ {e}) subset_rfl + sdiff_subset fun f _ => inter_subset_right + have hgood : IsFlatSub G X K' := by + refine ⟨IsSubdrawing.trans' hs hK.1, hV ▸ hK.2.1, IsFlat.mono hF fun z hz => ?_⟩ + have h := mem_offSet.mp hz + by_cases hzU : z ∈ K.U + · refine .inr ?_ + rw [K.U_eq] at hzU + rcases hzU with h1 | h1 + · exact (h.1 (K'.V_subset_U (hV ▸ h1))).elim + · obtain ⟨f, hf, hzf⟩ := mem_iUnion₂.mp h1 + by_cases hfe : f = e + · subst hfe + rw [← K.closure_diff_V hf] + exact ⟨hzf, fun hv => h.1 (K'.V_subset_U (hV ▸ hv))⟩ + · have hfE : f ∈ K'.E := hE ▸ ⟨hf, hfe⟩ + exact (h.1 (K'.closure_subset_U hfE hzf)).elim + · exact .inl (mem_offSet.mpr ⟨hzU, h.2⟩) + have h1 := hmin K' hgood + have hfin : K.E.Finite := K.finite_edges + have h2 : K'.E.ncard < K.E.ncard := by + rw [hE] + exact ncard_lt_ncard ⟨sdiff_subset, fun h => (h he).2 rfl⟩ hfin + unfold graphSize at h1 + rw [hV] at h1 + omega + +/-- **Every closed disc with boundary in `Y` lies in `Y`** (Graph Minors VII, page 222). -/ +theorem disc_subset_offSet (hS : IsSurface S) {G : Drawing S} {X : Set S} {K : Drawing S} + (hK : IsFlatSub G X K) (hmin : ∀ K', IsFlatSub G X K' → graphSize K ≤ graphSize K') {Δ : Set S} + (hΔ : IsClosedDisc Δ) (hF : discBd Δ ⊆ offSet K) : Δ ⊆ offSet K := by + classical + have ht2 : T2Space S := hS.2.1 + have hman : ∀ x : S, IsManifoldPoint x := hS.2.2 + have hNo : IsOpen (Δ \ discBd Δ) := hΔ.isOpen_discInt hman + have hΔc : IsClosed Δ := hΔ.isCompact.isClosed + have hbdΔ : Disjoint Δ (bd S) := disjoint_left.mpr fun z hz hb => by + by_cases h : z ∈ discBd Δ + · exact (mem_offSet.mp (hF h)).2 hb + · exact hb (isInteriorPoint_of_mem_discInt hman hΔ ⟨hz, h⟩) + have harc : IsArcConnected (offSet K ∩ discBd Δ) := by + rw [inter_eq_right.mpr hF] + exact IsOArc.isArcConnected (IsClosedDisc.isOArc_discBd hΔ) + have hflat : IsFlat (offSet K ∪ Δ) := by + refine IsFlat.mono ((theorem_11_3_proof hS hΔ harc).2 hK.2.2) (union_subset subset_union_left + fun z hz => ?_) + by_cases h : z ∈ discBd Δ + · exact .inl (hF h) + · exact .inr ⟨hz, h⟩ + have hV : ∀ v ∈ K.U ∩ Δ, v ∈ Δ \ discBd Δ := fun v hv => ⟨hv.2, fun h => (mem_offSet.mp + (hF h)).1 hv.1⟩ + obtain ⟨K', hs, hV', hE'⟩ := exists_sub (K := K) (V' := K.V \ Δ) (E' := {f | f ∈ K.E + ∧ Disjoint f Δ}) sdiff_subset (fun f hf => hf.1) fun f hf v hv => by + refine ⟨hv.2, fun hvΔ => ?_⟩ + obtain ⟨z, hz, hzf⟩ := mem_closure_iff.mp hv.1 _ hNo (hV v ⟨K.V_subset_U hv.2, hvΔ⟩) + exact disjoint_left.mp hf.2 hzf hz.1 + have hgood : IsFlatSub G X K' := by + refine ⟨IsSubdrawing.trans' hs hK.1, hV' ▸ hK.2.1.mono_left sdiff_subset, + IsFlat.mono hflat fun z hz => ?_⟩ + have h := mem_offSet.mp hz + by_cases hzU : z ∈ K.U + · refine .inr ?_ + by_contra hzΔ + rw [K.U_eq] at hzU + rcases hzU with h1 | h1 + · exact h.1 (K'.V_subset_U (hV' ▸ ⟨h1, hzΔ⟩)) + · obtain ⟨f, hf, hzf⟩ := mem_iUnion₂.mp h1 + by_cases hd : Disjoint f Δ + · exact h.1 (K'.closure_subset_U (hE' ▸ ⟨hf, hd⟩) hzf) + · have hzV : z ∉ K.V := fun hv => h.1 (K'.V_subset_U (hV' ▸ ⟨hv, hzΔ⟩)) + have hzef : z ∈ f := by + rw [← K.closure_diff_V hf] + exact ⟨hzf, hzV⟩ + obtain ⟨w, hwf, hwΔ⟩ := not_disjoint_iff.mp hd + have hfc : IsPreconnected f := isPreconnected_of_edge hf + have hfU : f ⊆ K.U := fun y hy => K.closure_subset_U hf (subset_closure hy) + have hcov : f ⊆ (Δ \ discBd Δ) ∪ Δᶜ := fun y hy => by + by_cases hyΔ : y ∈ Δ + · exact .inl (hV y ⟨hfU hy, hyΔ⟩) + · exact .inr hyΔ + rcases hfc.subset_or_subset hNo hΔc.isOpen_compl (disjoint_left.mpr fun y h1 h2 + => h2 h1.1) hcov with h2 | h2 + · exact hzΔ (h2 hzef).1 + · exact h2 hwf hwΔ + · exact .inl (mem_offSet.mpr ⟨hzU, h.2⟩) + by_contra hne + obtain ⟨z, hzΔ, hzY⟩ := not_subset.mp hne + have hzU : z ∈ K.U := by + by_contra h + exact hzY (mem_offSet.mpr ⟨h, disjoint_left.mp hbdΔ hzΔ⟩) + have h1 := hmin K' hgood + have hfV : K.V.Finite := K.finite_V + have hfE : K.E.Finite := K.finite_edges + have hle1 : K'.V.ncard ≤ K.V.ncard := by + rw [hV'] + exact ncard_le_ncard sdiff_subset hfV + have hle2 : K'.E.ncard ≤ K.E.ncard := by + rw [hE'] + exact ncard_le_ncard (fun f hf => hf.1) hfE + unfold graphSize at h1 + have hlt : K'.V.ncard < K.V.ncard ∨ K'.E.ncard < K.E.ncard := by + rw [K.U_eq] at hzU + rcases hzU with h2 | h2 + · left + rw [hV'] + exact ncard_lt_ncard ⟨sdiff_subset, fun h => (h h2).2 hzΔ⟩ hfV + · obtain ⟨f, hf, hzf⟩ := mem_iUnion₂.mp h2 + by_cases hzV : z ∈ K.V + · left + rw [hV'] + exact ncard_lt_ncard ⟨sdiff_subset, fun h => (h hzV).2 hzΔ⟩ hfV + · right + have hzef : z ∈ f := by + rw [← K.closure_diff_V hf] + exact ⟨hzf, hzV⟩ + rw [hE'] + refine ncard_lt_ncard ⟨fun g hg => hg.1, fun h => ?_⟩ hfE + exact disjoint_left.mp (h hf).2 hzef hzΔ + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/ForestFlat.lean b/LeanPool/GraphMinor/GM07/ForestFlat.lean new file mode 100644 index 0000000000..bb1c5c7eba --- /dev/null +++ b/LeanPool/GraphMinor/GM07/ForestFlat.lean @@ -0,0 +1,316 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.PullForest +public import LeanPool.GraphMinor.GM07.FlatEdges +public import LeanPool.GraphMinor.GM11.Theorem64 +public import LeanPool.GraphMinor.GM11.Section7b + +/-! +# Forests are flat + +A closed curve in a forest drawn in a surface is null-homotopic (`isFlat_forest`). So two curves in +the forest with the same ends are homotopic. This is used in (4.5) of Graph Minors VII (page 223), +where curves of two forests are compared without following them edge by edge. + +The proof peels off a leaf (`exists_forest_leaf`). If `L` is a line that meets a closed set `T` only +in one end `x`, then `T ∪ L` shrinks onto `T` by pulling `L` along itself to `x`, so a closed curve +in `T ∪ L` is homotopic to one in `T` (`IsFlat.union_line_end`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] + +/-- A simple walk has distinct edges. -/ +theorem nodup_edges_of_simple {G : Drawing S} {a b : S} (W : GraphWalk G.toGraph a b) + (hW : W.IsSimple) : W.edges.Nodup := by + induction W with + | nil _ => simp [GraphWalk.edges] + | @cons a y b e hl r ih => + have hnd := List.nodup_cons.mp hW + refine List.nodup_cons.mpr ⟨fun h => hnd.1 ?_, ih hnd.2⟩ + have hp : a ∈ closure e ∩ G.V := by + rw [hl.2.2.2] + exact Or.inl rfl + exact mem_support_of_mem_closure r h hp.1 hp.2 + +/-- A subdrawing of a forest is a forest. -/ +theorem IsGraphForest.of_subdrawing {G G' : Drawing S} (hG : IsGraphForest G.toGraph) + (h : G'.IsSubdrawing G) : IsGraphForest G'.toGraph := by + have hup : ∀ {a b : S} (W : GraphWalk G'.toGraph a b), ∃ W₀ : GraphWalk G.toGraph a b, W₀.edges + = W.edges := by + intro a b W + induction W with + | nil hv => exact ⟨.nil (h.1 hv), rfl⟩ + | cons hl r ih => + obtain ⟨W₀, hW₀⟩ := ih + exact ⟨.cons ((h.isLink_iff hl.1).mp hl) W₀, by simp [GraphWalk.edges, hW₀]⟩ + intro u W hW + obtain ⟨W₀, hW₀⟩ := hup W + have h0 := length_eq_zero_of_trail hG _ _ W₀ rfl (hW₀ ▸ hW.2) + have hl : W₀.length = W.length := congrArg List.length hW₀ + omega + +/-- An edge of a forest has a line as its closure, since a loop is a circuit. -/ +theorem edge_line_of_forest {G : Drawing S} (hF : IsGraphForest G.toGraph) {e : Set S} + (he : e ∈ G.E) : ∃ u v, u ≠ v ∧ closure e ∩ G.V = {u, v} ∧ IsLineWithEnds (closure e) u v := by + rcases G.edge_cond e he with h1 | ⟨u, hcap, -⟩ + · exact h1 + · exfalso + have huV : u ∈ G.V := (show u ∈ closure e ∩ G.V by rw [hcap]; rfl).2 + have hl : G.toGraph.IsLink e u u := ⟨he, huV, huV, by rw [hcap, pair_eq_singleton]⟩ + have h0 := hF u (.cons hl (.nil huV)) (by simp [GraphWalk.IsSimpleClosed, GraphWalk.support, + GraphWalk.edges]) + simp [GraphWalk.length, GraphWalk.edges] at h0 + +/-- A forest with an edge has a leaf: a vertex in the closure of just one edge. -/ +theorem exists_forest_leaf {G : Drawing S} (hF : IsGraphForest G.toGraph) + (hE : G.E.Nonempty) : + ∃ e ∈ G.E, ∃ y x, x ≠ y ∧ closure e ∩ G.V = {y, x} ∧ (∀ f ∈ G.E, f ≠ e → y ∉ closure f) + ∧ IsLineWithEnds (closure e) y x := by + classical + let P : ℕ → Prop := fun n => ∃ (a b : S) (W : GraphWalk G.toGraph a b), W.IsSimple ∧ W.length = n + have hbound : ∀ n, P n → n ≤ G.V.ncard := by + rintro n ⟨a, b, W, hs, rfl⟩ + have h1 : W.support.toFinset ⊆ G.finite_V.toFinset := fun x hx => + G.finite_V.mem_toFinset.mpr (W.mem_vertexSet_of_mem_support (List.mem_toFinset.mp hx)) + have h2 := Finset.card_le_card h1 + rw [List.toFinset_card_of_nodup hs, GraphWalk.length_support', + ← ncard_eq_toFinset_card _ G.finite_V] at h2 + omega + obtain ⟨e₀, he₀⟩ := hE + obtain ⟨u₀, v₀, huv₀, hcap₀, -⟩ := edge_line_of_forest hF he₀ + have huV : u₀ ∈ G.V := (show u₀ ∈ closure e₀ ∩ G.V by rw [hcap₀]; exact .inl rfl).2 + have hvV : v₀ ∈ G.V := (show v₀ ∈ closure e₀ ∩ G.V by rw [hcap₀]; exact .inr rfl).2 + have hP1 : P 1 := ⟨u₀, v₀, .cons ⟨he₀, huV, hvV, hcap₀⟩ (.nil hvV), by + simpa [GraphWalk.IsSimple, GraphWalk.support] using huv₀, rfl⟩ + have h1 : 1 ≤ G.V.ncard := hbound 1 hP1 + obtain ⟨y, b, W, hW, hl⟩ : P (Nat.findGreatest P G.V.ncard) := Nat.findGreatest_spec h1 hP1 + have hlen : 1 ≤ W.length := hl ▸ Nat.le_findGreatest h1 hP1 + have hmax : ∀ (a' b' : S) (W' : GraphWalk G.toGraph a' b'), W'.IsSimple → W'.length ≤ W.length + := fun a' b' W' hs' => by + rw [hl] + exact Nat.le_findGreatest (hbound _ ⟨a', b', W', hs', rfl⟩) ⟨a', b', W', hs', rfl⟩ + clear_value P + cases W with + | nil _ => simp [GraphWalk.length, GraphWalk.edges] at hlen + | @cons _ x _ e hl' r => + have hnd := List.nodup_cons.mp hW + have hxy : x ≠ y := fun h => hnd.1 (h ▸ r.start_mem_support) + refine ⟨e, hl'.1, y, x, hxy, hl'.2.2.2, fun f hf hne hyf => ?_, ?_⟩ + · set W₀ : GraphWalk G.toGraph y b := .cons hl' r with hW₀ + obtain ⟨u, v, huv, hcap, hline⟩ := edge_line_of_forest hF hf + have hyV : y ∈ G.V := hl'.2.1 + have hy' : y ∈ closure f ∩ G.V := ⟨hyf, hyV⟩ + obtain ⟨z, hzy, hcap'⟩ : ∃ z, z ≠ y ∧ closure f ∩ G.V = {y, z} := by + rw [hcap] at hy' + rcases hy' with rfl | h + · exact ⟨v, huv.symm, hcap⟩ + · obtain rfl : y = v := h + exact ⟨u, huv, by rw [hcap, pair_comm]⟩ + have hzV : z ∈ G.V := (show z ∈ closure f ∩ G.V by rw [hcap']; exact .inr rfl).2 + have hlink : G.toGraph.IsLink f z y := ⟨hf, hzV, hyV, by rw [hcap', pair_comm]⟩ + by_cases hz : z ∈ W₀.support + · obtain ⟨W', hs, he, -⟩ := GraphWalk.exists_prefix W₀ hW hz + have hfW : f ∉ W₀.edges := fun h => by + rcases List.mem_cons.mp h with h1 | h1 + · exact hne h1 + · exact hnd.1 (mem_support_of_mem_closure r h1 hyf hyV) + have h0 := length_eq_zero_of_trail hF _ _ (GraphWalk.cons hlink W') rfl + (List.nodup_cons.mpr ⟨fun h => hfW (he f h), nodup_edges_of_simple W' hs⟩) + simp [GraphWalk.length, GraphWalk.edges] at h0 + · have h1 := hmax z b (.cons hlink W₀) (List.nodup_cons.mpr ⟨hz, hW⟩) + have h2 : (GraphWalk.cons hlink W₀).length = W₀.length + 1 := rfl + omega + · obtain ⟨u, v, huv, hcap, hline⟩ := edge_line_of_forest hF hl'.1 + have hc := hl'.2.2.2 + have hy' : y ∈ ({u, v} : Set S) := hcap ▸ (show y ∈ closure e ∩ G.V by + rw [hc] + exact .inl rfl) + have hx' : x ∈ ({u, v} : Set S) := hcap ▸ (show x ∈ closure e ∩ G.V by + rw [hc] + exact .inr rfl) + rcases hy' with rfl | h + · rcases hx' with rfl | h' + · exact absurd rfl hxy + · obtain rfl : x = v := h' + exact hline + · obtain rfl : y = v := h + rcases hx' with rfl | h' + · exact hline.symm + · exact absurd h' hxy + +/-- **Adding a line by one end.** Let `T` be closed and flat, and let `L` be a line with `L ∩ T = +{x}`, where `x` is an end of `L`. Then `T ∪ L` is flat. A closed curve in `T ∪ L` is pulled along +`L` to `x`, which gives a homotopic curve in `T`. -/ +theorem IsFlat.union_line_end {T L : Set S} {x y : S} (hT : IsClosed T) (hf : IsFlat T) + (hL : IsLineWithEnds L x y) (hLT : L ∩ T = {x}) (hLc : IsClosed L) : IsFlat (T ∪ L) := by + classical + obtain ⟨f, h0, -⟩ := hL + let u : S → unitInterval := fun z => if h : z ∈ L then f.symm ⟨z, h⟩ else 0 + have hu : ContinuousOn u L := by + rw [continuousOn_iff_continuous_domRestrict] + have : L.domRestrict u = f.symm := by + ext z + simp [u, Set.domRestrict] + rw [this] + exact f.symm.continuous + have hux : u x = 0 := by + have hxL : x ∈ L := by + have : x ∈ L ∩ T := by rw [hLT]; rfl + exact this.1 + have : f.symm ⟨x, hxL⟩ = 0 := by + rw [Homeomorph.symm_apply_eq] + exact Subtype.ext h0.symm + simp [u, hxL, this] + let sc : unitInterval × unitInterval → unitInterval := fun p => projIcc 0 1 zero_le_one + ((1 - p.1.1) * p.2.1) + have hsc : Continuous sc := continuous_projIcc.comp (by fun_prop) + intro φ hφ + let Ψ : Circle × unitInterval → S := fun p => if φ p.1 ∈ L then (f (sc (p.2, u + (φ p.1)))).1 else φ p.1 + have hA : IsClosed ((φ ⁻¹' L) ×ˢ (univ : Set unitInterval)) := (hLc.preimage φ.continuous).prod + isClosed_univ + have hB : IsClosed ((φ ⁻¹' T) ×ˢ (univ : Set unitInterval)) := (hT.preimage φ.continuous).prod + isClosed_univ + have hcA : ContinuousOn Ψ ((φ ⁻¹' L) ×ˢ univ) := by + have h1 : ContinuousOn (fun p : Circle × unitInterval => u (φ p.1)) ((φ ⁻¹' L) ×ˢ univ) := + hu.comp (φ.continuous.comp continuous_fst).continuousOn fun p hp => hp.1 + have h2 : ContinuousOn (fun p : Circle × unitInterval => (f (sc (p.2, u (φ p.1)))).1) + ((φ ⁻¹' L) ×ˢ univ) := + (continuous_subtype_val.comp f.continuous).comp_continuousOn (hsc.comp_continuousOn + (continuous_snd.continuousOn.prodMk h1)) + refine h2.congr fun p hp => ?_ + exact ite_eq_left hp.1 + have hcB : ContinuousOn Ψ ((φ ⁻¹' T) ×ˢ univ) := by + refine (φ.continuous.comp continuous_fst).continuousOn.congr fun p hp => ?_ + by_cases hpL : φ p.1 ∈ L + · have hpx : φ p.1 = x := by + have : φ p.1 ∈ L ∩ T := ⟨hpL, hp.1⟩ + rw [hLT] at this + exact this + have hs : sc (p.2, 0) = 0 := by + ext + simp [sc] + change (if φ p.1 ∈ L then _ else _) = φ p.1 + rw [ite_eq_left hpL, hpx, hux, hs, h0] + · exact ite_eq_right hpL + have hcov : ((φ ⁻¹' L) ×ˢ (univ : Set unitInterval)) ∪ ((φ ⁻¹' T) ×ˢ univ) = univ := by + ext p + simp only [mem_union, mem_prod, mem_preimage, mem_univ, and_true, iff_true] + rcases hφ ⟨p.1, rfl⟩ with h | h + · exact .inr h + · exact .inl h + have hΨ : Continuous Ψ := by + rw [← continuousOn_univ, ← hcov] + exact hcA.union_of_isClosed hcB hA hB + let ψ : C(Circle × unitInterval, S) := ⟨Ψ, hΨ⟩ + let φ' : C(Circle, S) := ⟨fun c => Ψ (c, 1), by fun_prop⟩ + have hend : range φ' ⊆ T := by + rintro _ ⟨c, rfl⟩ + change (if φ c ∈ L then _ else _) ∈ T + by_cases hc : φ c ∈ L + · have hs : sc (1, u (φ c)) = 0 := by + ext + simp [sc] + rw [ite_eq_left hc, hs, h0] + have : x ∈ L ∩ T := by rw [hLT]; rfl + exact this.2 + · rw [ite_eq_right hc] + exact (hφ ⟨c, rfl⟩).resolve_right hc + refine null_of_homotopic (subset_univ _) ?_ (hf φ' hend) + refine ⟨ψ, fun _ => mem_univ _, fun c => ?_, fun c => rfl⟩ + change (if φ c ∈ L then _ else _) = φ c + by_cases hc : φ c ∈ L + · have hs : ∀ t, sc (0, t) = t := fun t => by + ext + simp [sc] + rw [ite_eq_left hc, hs] + have : u (φ c) = f.symm ⟨φ c, hc⟩ := by simp [u, hc] + rw [this, Homeomorph.apply_symm_apply] + · exact ite_eq_right hc + +/-- **A forest in a Hausdorff space is flat.** -/ +theorem isFlat_forest [T2Space S] {G : Drawing S} (hG : IsGraphForest G.toGraph) : IsFlat G.U := by + classical + induction hn : G.E.ncard generalizing G with + | zero => + have hfin : G.E.Finite := G.finite_edges + have hE : G.E = ∅ := (ncard_eq_zero hfin).mp hn + have hU : G.U = G.V := by + rw [G.U_eq, hE] + simp + rw [hU] + exact Flat.isFlat (flat_of_finite G.finite_V) + | succ n ih => + have hne : G.E.Nonempty := by + have hfin : G.E.Finite := G.finite_edges + rw [← ncard_pos hfin] + omega + obtain ⟨e, he, y, x, hxy, hcap, hleaf, hline⟩ := exists_forest_leaf hG hne + have hsub := deleteEdge_isSubdrawing G e + have hcard : (G.deleteEdge e).E.ncard = n := by + rw [deleteEdge_E, ncard_sdiff_singleton_of_mem he] + omega + have hfl := ih (IsGraphForest.of_subdrawing hG hsub) hcard + have hV : (G.deleteEdge e).V = G.V := GM06.deleteEdge_V G e + let T : Set S := (G.V \ {y}) ∪ ⋃ f ∈ G.E \ {e}, closure f + have hTc : IsClosed T := ((G.finite_V.subset sdiff_subset).isClosed).union + (((G.finite_edges.subset sdiff_subset).isClosed_biUnion) fun f _ => isClosed_closure) + have hTU : T ⊆ (G.deleteEdge e).U := by + rw [(G.deleteEdge e).U_eq, hV, deleteEdge_E] + exact union_subset_union_left _ sdiff_subset + have hyT : y ∉ T := by + rintro (h | h) + · exact h.2 rfl + · obtain ⟨f, hf, hyf⟩ := mem_iUnion₂.mp h + exact hleaf f hf.1 hf.2 hyf + have hline' := hline.symm + have hLT : closure e ∩ T = {x} := by + ext z + constructor + · rintro ⟨hz, hzT⟩ + by_cases hzV : z ∈ G.V + · have : z ∈ closure e ∩ G.V := ⟨hz, hzV⟩ + rw [hcap] at this + rcases this with rfl | h + · exact (hyT hzT).elim + · exact h + · exfalso + rcases hzT with h | h + · exact hzV h.1 + · obtain ⟨f, hf, hzf⟩ := mem_iUnion₂.mp h + have h1 : z ∈ f := by rw [← G.closure_diff_V hf.1]; exact ⟨hzf, hzV⟩ + have h2 : z ∈ e := by rw [← G.closure_diff_V he]; exact ⟨hz, hzV⟩ + exact hf.2 (arcComponent_eq hf.1 he h1 h2) + · rintro rfl + have hxc : z ∈ closure e ∩ G.V := by rw [hcap]; exact .inr rfl + exact ⟨hxc.1, .inl ⟨hxc.2, hxy⟩⟩ + have hU : G.U = T ∪ closure e := by + rw [G.U_eq] + refine Subset.antisymm (union_subset (fun z hz => ?_) (iUnion₂_subset fun f hf => ?_)) ?_ + · by_cases hzy : z = y + · exact .inr (hzy ▸ (show y ∈ closure e ∩ G.V by rw [hcap]; exact .inl rfl).1) + · exact .inl (.inl ⟨hz, hzy⟩) + · by_cases hfe : f = e + · exact hfe ▸ subset_union_right + · exact fun z hz => .inl (.inr (mem_biUnion (show f ∈ G.E \ {e} from ⟨hf, hfe⟩) hz)) + · refine union_subset (union_subset (sdiff_subset.trans subset_union_left) ?_) ?_ + · exact iUnion₂_subset fun f hf z hz => .inr (mem_biUnion hf.1 hz) + · exact fun z hz => .inr (mem_biUnion he hz) + rw [hU] + exact IsFlat.union_line_end hTc (IsFlat.mono hfl hTU) hline' hLT isClosed_closure + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/ForestParts.lean b/LeanPool/GraphMinor/GM07/ForestParts.lean new file mode 100644 index 0000000000..48148d77a4 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/ForestParts.lean @@ -0,0 +1,312 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CutConnected +public import LeanPool.GraphMinor.GM19.FragmentOuter +public import LeanPool.GraphMinor.GM19.FragmentCapping +public import Mathlib.Topology.Baire.LocallyCompactRegular + +/-! +# Preparing a forest for (4.4) + +Here are the first steps of (4.4) of Graph Minors VII. A forest `L` with no `O`-arc and no `I`-arc +falls into finitely many parts (`exists_parts`), and one move carries each part into any open set +around a finite set of points of that part (`exists_gather`). Also, a move can take a finite set of +points off the boundary away from a given forest (`exists_move_off`). This needs that a forest holds +no open set (`exists_off_drawing`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S T : Type} [TopologicalSpace S] [TopologicalSpace T] + +/-- Each point of a line in a closed surface is a limit of points outside the line. -/ +theorem line_subset_closure_compl_cap (hT : IsClosedSurface T) {L : Set T} {a b : T} + (hl : IsLineWithEnds L a b) : L ⊆ closure Lᶜ := by + have : T2Space T := hT.2.1 + exact GM19.line_subset_closure_compl hT hl + +/-- **A forest holds no open set.** Every nonempty open set has a point off the forest. Pass to the +capped closed surface. The complement of each line there is open and dense, and there are finitely +many lines. -/ +theorem exists_off_drawing (hS : IsSurface S) {H : Drawing S} (hH : IsGraphForest H.toGraph) {X : + Set S} (hX : IsOpen X) (hne : X.Nonempty) : ∃ x ∈ X, x ∉ H.U := by + classical + have ht2S : T2Space S := hS.2.1 + obtain ⟨T, tT, j, Kc, hT, hj, hKc, hu, hi', -⟩ := exists_capAll S hS + have ht2 : T2Space T := hT.2.1 + have hcT : CompactSpace T := hT.1 + have hEfin : H.E.Finite := H.finite_edges + have hline : ∀ e ∈ H.E, IsOpen (j '' closure e)ᶜ ∧ Dense (j '' closure e)ᶜ := fun e he => by + obtain ⟨u, v, -, -, hl⟩ := edge_line_of_forest hH he + have hl' : IsLineWithEnds (j '' closure e) (j u) (j v) := by + obtain ⟨f, h0, h1⟩ := hl + exact ⟨f.trans (hj.isEmbedding.homeomorphImage _), congrArg j h0, congrArg j h1⟩ + have hc : IsClosed (j '' closure e) := hj.isClosedMap _ isClosed_closure + refine ⟨hc.isOpen_compl, ?_⟩ + rw [dense_iff_closure_eq, eq_univ_iff_forall] + intro p + by_cases hp : p ∈ j '' closure e + · exact line_subset_closure_compl_cap hT hl' hp + · exact subset_closure hp + let D : Set T := ⋂ e ∈ H.E, (j '' closure e)ᶜ + have hDd : Dense D := dense_biInter_of_isOpen (fun e he => (hline e he).1) hEfin.countable fun e + he => (hline e he).2 + have hDo : IsOpen D := hEfin.isOpen_biInter fun e he => (hline e he).1 + have hVd : Dense (j '' H.V)ᶜ := GM19.dense_compl_finite hT.2.2 (H.finite_V.image j) + have hVo : IsOpen (j '' H.V)ᶜ := (H.finite_V.image j).isClosed.isOpen_compl + have hDD : Dense (D ∩ (j '' H.V)ᶜ) := hDd.inter_of_isOpen_left hVd hDo + -- The image of the open set off the boundary. + obtain ⟨x₀, hx₀⟩ := hne + obtain ⟨y₀, hy₀X, hy₀b⟩ := mem_closure_iff.mp (mem_closure_compl_bd (hS.2.2 x₀)) X hX hx₀ + let Y : Set S := X \ bd S + have hYo : IsOpen Y := hX.sdiff (isClosed_bd S) + obtain ⟨N', hN', hNe⟩ := hj.isInducing.isOpen_iff.mp hYo + have himg : j '' Y = N' ∩ Kcᶜ := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + refine ⟨(hNe ▸ hx : x ∈ j ⁻¹' N'), fun hk => ?_⟩ + have : j x ∈ j '' bd S := by + rw [← hi'] + exact ⟨mem_range_self _, hk⟩ + obtain ⟨x', hx', he⟩ := this + exact hx.2 (hj.injective he ▸ hx') + · rintro ⟨h1, h2⟩ + rcases hu.symm ▸ mem_univ y with ⟨x, rfl⟩ | h + · exact ⟨x, hNe ▸ (h1 : x ∈ j ⁻¹' N'), rfl⟩ + · exact (h2 h).elim + obtain ⟨_, ⟨x, hx, rfl⟩, hxD, hxV⟩ := hDD.inter_open_nonempty (j '' Y) + (by rw [himg]; exact hN'.inter hKc.isOpen_compl) ⟨j y₀, y₀, ⟨hy₀X, hy₀b⟩, rfl⟩ + refine ⟨x, hx.1, fun hU => ?_⟩ + rw [H.U_eq] at hU + rcases hU with h | h + · exact hxV (mem_image_of_mem j h) + · obtain ⟨e, he, h⟩ := mem_iUnion₂.mp h + exact mem_iInter₂.mp hxD e he (mem_image_of_mem j h) + +/-- **Moving points off a forest.** A move takes a finite set of points off the boundary away from a +forest `H`. Points are done one at a time, each by a slide along a short line from a point off `H`. +-/ +theorem exists_move_off (hS : IsSurface S) {H : Drawing S} (hH : IsGraphForest H.toGraph) {A : Set + S} (hA : A.Finite) (hAb : ∀ a ∈ A, a ∉ bd S) : ∃ M : S ≃ₜ S, IsMove M ∧ ∀ a ∈ A, M a ∉ H.U := by + classical + have ht2 : T2Space S := hS.2.1 + have hlc := hS.locallyConnected + induction A, hA using Set.Finite.induction_on with + | empty => exact ⟨Homeomorph.refl S, IsMove.refl, by simp⟩ + | @insert a A₀ ha₀ hA₀ ih => + obtain ⟨M₀, hm₀, h₀⟩ := ih fun x hx => hAb x (mem_insert_of_mem _ hx) + set b := M₀ a with hb + have hbb : b ∉ bd S := fun h => hAb a (mem_insert _ _) (by + have h1 : M₀ b = b := hm₀.1 b h + have h2 : b = a := M₀.injective h1 + exact h2 ▸ h) + let Z : Set S := M₀ '' A₀ + have hZf : Z.Finite := hA₀.image _ + have hbZ : b ∉ Z := by + rintro ⟨x, hx, he⟩ + exact ha₀ (M₀.injective he ▸ hx) + by_cases hbU : b ∉ H.U + · refine ⟨M₀, hm₀, fun x hx => ?_⟩ + rcases hx with rfl | hx + · exact hbU + · exact h₀ x hx + rw [not_not] at hbU + have hXo : IsOpen (bd S ∪ Z)ᶜ := ((isClosed_bd S).union hZf.isClosed).isOpen_compl + have hbX : b ∈ (bd S ∪ Z)ᶜ := by + rintro (h | h) + · exact hbb h + · exact hbZ h + let W : Set S := connectedComponentIn (bd S ∪ Z)ᶜ b + have hWo : IsOpen W := hXo.connectedComponentIn + have hbW : b ∈ W := mem_connectedComponentIn hbX + have hWX : W ⊆ (bd S ∪ Z)ᶜ := connectedComponentIn_subset _ _ + have hWp : IsPathConnected W := isPathConnected_of_isOpen hS hWo ⟨⟨b, hbW⟩, + isPreconnected_connectedComponentIn⟩ + obtain ⟨r, hrW, hrU⟩ := exists_off_drawing hS hH hWo ⟨b, hbW⟩ + have hrb : r ≠ b := fun h => hrU (h ▸ hbU) + rcases (joinedIn_iff_eq_or_exists_isLineWithEnds hrW hbW).mp (hWp.joinedIn r hrW b hbW) with h + | ⟨L, hLW, hL⟩ + · exact (hrb h).elim + obtain ⟨f, hf0, hf1⟩ := hL + have hc : IsArcMap fun t => (f t).1 := ⟨by fun_prop, fun x y h => f.injective (Subtype.ext h)⟩ + have hcW : ∀ t, (f t).1 ∈ W := fun t => hLW (f t).2 + let N : Set S := (H.U ∪ Z)ᶜ + have hNo : IsOpen N := (H.isClosed_U.union hZf.isClosed).isOpen_compl + obtain ⟨α, hmα, hz, hl⟩ := exists_line_slide hS hc (fun t h => hWX (hcW t) + (.inl h)) hZf.isClosed (fun t _ h => hWX (hcW t) (.inr h)) hNo (by + show (f 0).1 ∈ N + rw [hf0] + rintro (h | h) + · exact hrU h + · exact hWX hrW (.inr h)) + refine ⟨M₀.trans α, hm₀.trans hmα, fun x hx => ?_⟩ + rw [Homeomorph.trans_apply] + rcases hx with rfl | hx + · have h1 := hl 1 + simp only [hf1] at h1 + exact fun h => h1 (.inl h) + · have hxZ : M₀ x ∈ Z := mem_image_of_mem _ hx + rcases hz _ hxZ with h | h + · rw [h] + exact h₀ x hx + · exact (h.1 (.inr hxZ)).elim + +/-- **The parts of a drawing with no isolated vertices.** They are the connected components of +`U(L)`. -/ +theorem exists_parts {L : Drawing S} (hn : HasNoIsolatedVertices L) : ∃ K : Set + (Set S), K.Finite ∧ (∀ C ∈ K, IsPreconnected C ∧ IsClosed C ∧ IsClosed (L.U \ C) ∧ C ⊆ L.U) ∧ + (∀ x ∈ L.U, ∃ C ∈ K, x ∈ C) ∧ + (∀ C ∈ K, ∀ D ∈ K, C ≠ D → Disjoint C D) ∧ ∀ A, A ⊆ L.U → IsPreconnected A → ∀ C ∈ K, A ⊆ C + ∨ Disjoint A C := by + classical + have hEfin : L.E.Finite := L.finite_edges + have hcl : ∀ e ∈ L.E, IsPreconnected (closure e) := fun e he => + he.2.2.1.isConnected.isPreconnected.closure + have hne : ∀ e : L.E, ∃ x, x ∈ e.1 := fun e => e.2.2.2.1.nonempty + choose p hp using hne + have hpU : ∀ e : L.E, p e ∈ L.U := fun e => L.closure_subset_U e.2 (subset_closure (hp e)) + let comp : S → Set S := fun x => connectedComponentIn L.U x + have hc0 : ∀ x ∈ L.U, x ∈ comp x := fun x hx => mem_connectedComponentIn hx + have hsame : ∀ x ∈ L.U, ∀ A, A ⊆ L.U → IsPreconnected A → x ∈ A → A ⊆ comp x + := fun x _ A hA hp hxA => hp.subset_connectedComponentIn hxA hA + have heq : ∀ {x y : S}, y ∈ comp x → comp x = comp y := fun h => connectedComponentIn_eq h + let K : Set (Set S) := range fun e : L.E => comp (p e) + have hUe : ∀ x ∈ L.U, ∃ e : L.E, x ∈ closure e.1 := fun x hx => by + rw [U_eq_biUnion_closure hn] at hx + obtain ⟨e, he, h⟩ := mem_iUnion₂.mp hx + exact ⟨⟨e, he⟩, h⟩ + have hclsub : ∀ e : L.E, closure e.1 ⊆ comp (p e) := fun e => hsame _ (hpU e) _ + (L.closure_subset_U e.2) (hcl e.1 e.2) (subset_closure (hp e)) + have hdich : ∀ A, A ⊆ L.U → IsPreconnected A → ∀ x ∈ L.U, A ⊆ comp x ∨ Disjoint A (comp x) + := fun A hA hAp x hx => by + by_cases h : Disjoint A (comp x) + · exact .inr h + · obtain ⟨y, hyA, hyC⟩ := not_disjoint_iff.mp h + left + rw [heq hyC] + exact hsame y (hA hyA) A hA hAp hyA + have hK : ∀ C ∈ K, ∃ x ∈ L.U, C = comp x := by + rintro _ ⟨e, rfl⟩ + exact ⟨p e, hpU e, rfl⟩ + have : Finite L.E := hEfin.to_subtype + refine ⟨K, finite_range _, ?_, fun x hx => ?_, ?_, ?_⟩ + · intro C hC + obtain ⟨x, hx, rfl⟩ := hK C hC + have hsub : comp x ⊆ L.U := connectedComponentIn_subset _ _ + refine ⟨isPreconnected_connectedComponentIn, ?_, ?_, hsub⟩ + · refine isClosed_of_closure_subset ?_ + exact hsame x hx _ (closure_minimal hsub L.isClosed_U) + isPreconnected_connectedComponentIn.closure (subset_closure (hc0 x hx)) + · have he : L.U \ comp x = ⋃ e ∈ {e ∈ L.E | Disjoint (closure e) (comp x)}, closure e := by + ext z + constructor + · rintro ⟨hz, hzc⟩ + obtain ⟨e, hz'⟩ := hUe z hz + refine mem_iUnion₂.mpr ⟨e.1, ⟨e.2, ?_⟩, hz'⟩ + rcases hdich _ (L.closure_subset_U e.2) (hcl e.1 e.2) x hx with h | h + · exact absurd (h hz') hzc + · exact h + · intro hz + obtain ⟨e, he, hz⟩ := mem_iUnion₂.mp hz + exact ⟨L.closure_subset_U he.1 hz, disjoint_left.mp he.2 hz⟩ + rw [he] + exact (hEfin.subset (sep_subset _ _)).isClosed_biUnion fun _ _ => isClosed_closure + · obtain ⟨e, he⟩ := hUe x hx + exact ⟨comp (p e), ⟨e, rfl⟩, hclsub e he⟩ + · intro C hC D hD hne + obtain ⟨x, hx, rfl⟩ := hK C hC + obtain ⟨y, hy, rfl⟩ := hK D hD + rcases hdich _ (connectedComponentIn_subset _ _) isPreconnected_connectedComponentIn y hy with + h | h + · exact (hne ((heq (h (hc0 x hx))).trans (heq (hc0 x hx)).symm).symm).elim + · exact h + · intro A hA hAp C hC + obtain ⟨x, hx, rfl⟩ := hK C hC + exact hdich A hA hAp x hx + +/-- **One move gathers every part.** Each part `C` of a forest `L` with no `O`-arc and no `I`-arc +has a finite subset `R C`, such that one move carries each part `C` into any open set `N C` around +`R C`, provided these open sets are disjoint and miss the other parts. A part is moved while all +other parts stay fixed, so the moves for different parts do not interfere. -/ +theorem exists_gather (hS : IsSurface S) {L : Drawing S} (hP : L.IsProper) + (hn : HasNoIsolatedVertices L) (hNo : NoArcs L) {K : Set (Set S)} (hK : K.Finite) + (hparts : ∀ C ∈ K, IsPreconnected C ∧ IsClosed C ∧ IsClosed (L.U \ C) ∧ C ⊆ L.U) + (hcover : ∀ x ∈ L.U, ∃ C ∈ K, x ∈ C) (hdis : ∀ C ∈ K, ∀ D ∈ K, C ≠ D → Disjoint C D) + (hdich : ∀ A, A ⊆ L.U → IsPreconnected A → ∀ C ∈ K, A ⊆ C ∨ Disjoint A C) : + ∃ R : Set S → Set S, (∀ C ∈ K, (R C).Finite ∧ R C ⊆ C) ∧ ∀ N : Set S → Set S, (∀ C ∈ K, IsOpen + (N C) ∧ R C ⊆ N C) → (∀ C ∈ K, ∀ D ∈ K, C ≠ D → Disjoint (N C) (N D) ∧ Disjoint (N C) D) → + ∃ G : S ≃ₜ S, IsMove G ∧ ∀ C ∈ K, ∀ z ∈ C, G z ∈ N C := by + classical + have ht2 : T2Space S := hS.2.1 + obtain ⟨l, k, hg, hun, -⟩ := exists_growth _ L rfl hP hNo + have hUl : listUnion l = L.U := by rw [hun, ← U_eq_biUnion_closure hn] + have hlines : ∀ A ∈ l, A ⊆ L.U := fun A hA z hz => hUl ▸ (mem_sUnion_of_mem hz hA : z ∈ listUnion + l) + have hpart : ∀ C, C ∈ K → ∃ R : Set S, R.Finite ∧ R ⊆ C ∧ ∀ W : Set S, IsClosed W → Disjoint W C + → ∀ N, IsOpen N → R ⊆ N → Disjoint N W → ∃ α : S ≃ₜ S, IsMove α ∧ (∀ z ∈ C, α z ∈ N) + ∧ ∀ z ∈ W, α z = z := fun C hC => by + obtain ⟨R, hRf, hRC, -, h⟩ := exists_shrink_part hS hg ∅ C isClosed_empty (by simp) (by + rintro z ⟨h1, -⟩ + simpa using h1) fun A hA => hdich A (hlines A hA) (IsLine.isPreconnected + (hg.isLine A hA)) C hC + refine ⟨R, hRf, hRC, fun W hW hWC N hN hRN hNW => ?_⟩ + obtain ⟨α, hm, h1, h2⟩ := h W hW hWC N hN (empty_subset _) hRN hNW + refine ⟨α, hm, fun z hz => h1 z (.inr ⟨?_, hz⟩), h2⟩ + rw [hUl] + exact (hparts C hC).2.2.2 hz + choose! R hR using hpart + refine ⟨R, fun C hC => ⟨(hR C hC).1, (hR C hC).2.1⟩, fun N hN hND => ?_⟩ + have key : ∀ J : Set (Set S), J.Finite → J ⊆ K → ∃ G : S ≃ₜ S, IsMove G ∧ + (∀ C ∈ J, ∀ z ∈ C, G z ∈ N C) ∧ ∀ C ∈ K, C ∉ J → ∀ z ∈ C, G z = z := by + intro J hJ + induction J, hJ using Set.Finite.induction_on with + | empty => exact fun _ => ⟨Homeomorph.refl S, IsMove.refl, by simp, fun _ _ _ _ _ => rfl⟩ + | @insert C₀ J hC₀ _ ih => + intro hsub + obtain ⟨G, hm, h1, h2⟩ := ih fun x hx => hsub (mem_insert_of_mem _ hx) + have hC₀K := hsub (mem_insert _ _) + obtain ⟨-, -, hrest, hC₀U⟩ := hparts C₀ hC₀K + have hC₀fix : ∀ z ∈ C₀, G z = z := h2 C₀ hC₀K hC₀ + obtain ⟨α, hmα, ha1, ha2⟩ := (hR C₀ hC₀K).2.2 (L.U \ C₀) hrest disjoint_sdiff_left + (G ⁻¹' N C₀) ((hN C₀ hC₀K).1.preimage G.continuous) (fun r hr => by + have hrC := (hR C₀ hC₀K).2.1 hr + change G r ∈ N C₀ + rw [hC₀fix r hrC] + exact (hN C₀ hC₀K).2 hr) (disjoint_left.mpr fun z hz hzW => by + obtain ⟨D, hDK, hzD⟩ := hcover z hzW.1 + have hne : C₀ ≠ D := fun h => hzW.2 (h ▸ hzD) + have hz' : G z ∈ N C₀ := hz + by_cases hDJ : D ∈ J + · exact disjoint_left.mp (hND C₀ hC₀K D hDK hne).1 hz' (h1 D hDJ z hzD) + · rw [h2 D hDK hDJ z hzD] at hz' + exact disjoint_left.mp (hND C₀ hC₀K D hDK hne).2 hz' hzD) + refine ⟨α.trans G, hmα.trans hm, fun C hC z hz => ?_, fun C hC hCn z hz => ?_⟩ + · rw [Homeomorph.trans_apply] + rcases hC with rfl | hC + · exact ha1 z hz + · have hCK := hsub (mem_insert_of_mem _ hC) + have hne : C ≠ C₀ := fun h => hC₀ (h ▸ hC) + rw [ha2 z ⟨(hparts C hCK).2.2.2 hz, disjoint_left.mp (hdis C hCK C₀ hC₀K hne) hz⟩] + exact h1 C hC z hz + · rw [Homeomorph.trans_apply] + have hCJ : C ∉ J := fun h => hCn (mem_insert_of_mem _ h) + have hne : C ≠ C₀ := fun h => hCn (h ▸ mem_insert _ _) + rw [ha2 z ⟨(hparts C hC).2.2.2 hz, disjoint_left.mp (hdis C hC C₀ hC₀K hne) hz⟩, + h2 C hC hCJ z hz] + obtain ⟨G, hm, h1, -⟩ := key K hK subset_rfl + exact ⟨G, hm, h1⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/ForestPeel.lean b/LeanPool/GraphMinor/GM07/ForestPeel.lean new file mode 100644 index 0000000000..f76389a17d --- /dev/null +++ b/LeanPool/GraphMinor/GM07/ForestPeel.lean @@ -0,0 +1,445 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CutForest +public import LeanPool.GraphMinor.GM11.Forest +public import LeanPool.GraphMinor.GM11.Section6 +public import LeanPool.GraphMinor.GM11.RadialBasics +public import LeanPool.GraphMinor.GM11.Walks +public import LeanPool.GraphMinor.GM06.DiscRegions +public import LeanPool.GraphMinor.GM06.Euler +public import LeanPool.GraphMinor.GM07.CuffWalk + +/-! +# A forest grows one line at a time + +Let `L` be a proper graph such that `U(L)` includes no `O`-arc and no `I`-arc, as in Graph Minors +VII, (4.4) (page 223). We list the closures of its edges so that each one meets what comes before +it, and `bd(Σ)`, in at most one end +(`exists_growth`). The list comes from peeling leaves. A longest path of `L` has an end off `bd(Σ)`, +since otherwise the path is an `I`-arc, and this end is a leaf, since another edge there would +extend the path or close an `O`-arc +(`exists_leaf`). Taking an edge away keeps the hypotheses, as `U(L)` shrinks. + +We also count. An attached line adds one new vertex off `bd(Σ)` and a free line adds two, so the +number of free lines is the number of vertices off `bd(Σ)` less the number of edges. This gives the +bound on the cuffs of `Σ'` on page 226. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +theorem GraphWalk.length_support' {α β : Type*} {G : Graph α β} {u v : α} + (W : GraphWalk G u v) : W.support.length = W.length + 1 := by + induction W with + | nil _ => rfl + | cons _ r ih => + simp only [GraphWalk.support, List.length_cons, ih] + rfl + +/-- A prefix of a simple walk up to a vertex on it. -/ +theorem GraphWalk.exists_prefix {α β : Type*} {G : Graph α β} {u v x : α} (W : GraphWalk G u v) + (hW : W.IsSimple) (hx : x ∈ W.support) : + ∃ W' : GraphWalk G u x, W'.IsSimple ∧ (∀ e ∈ W'.edges, e ∈ W.edges) + ∧ ∀ z ∈ W'.support, z ∈ W.support := by + classical + induction W with + | @nil a hv => + obtain rfl : x = a := by simpa [GraphWalk.support] using hx + exact ⟨.nil hv, by simp [GraphWalk.IsSimple, GraphWalk.support], by simp [GraphWalk.edges], + fun z hz => hz⟩ + | @cons a y b e hl r ih => + have hnd := List.nodup_cons.mp hW + by_cases hxa : x = a + · subst hxa + exact ⟨.nil hl.left_mem, by simp [GraphWalk.IsSimple, GraphWalk.support], + by simp [GraphWalk.edges], by simp [GraphWalk.support]⟩ + · have hxr : x ∈ r.support := (List.mem_cons.mp hx).resolve_left hxa + obtain ⟨W', hs, he, hz⟩ := ih hnd.2 hxr + refine ⟨.cons hl W', ?_, fun f hf => ?_, fun z hz' => ?_⟩ + · exact List.nodup_cons.mpr ⟨fun h => hnd.1 (hz _ h), hs⟩ + · rcases List.mem_cons.mp hf with rfl | h + · exact List.mem_cons_self + · exact List.mem_cons_of_mem _ (he f h) + · rcases List.mem_cons.mp hz' with rfl | h + · exact List.mem_cons_self + · exact List.mem_cons_of_mem _ (hz z h) + +/-- `U(G)` includes no `O`-arc and no `I`-arc. -/ +def NoArcs (G : Drawing S) : Prop := (∀ F ⊆ G.U, ¬ IsOArc F) ∧ ∀ F ⊆ G.U, ¬ IsIArc F + +theorem NoArcs.mono {G G' : Drawing S} (h : NoArcs G) (hU : G'.U ⊆ G.U) : NoArcs G' := + ⟨fun F hF => h.1 F (hF.trans hU), fun F hF => h.2 F (hF.trans hU)⟩ + +/-- With no `O`-arc in `U(G)`, every edge has a line as its closure. -/ +theorem NoArcs.edge_line {G : Drawing S} (h : NoArcs G) {e : Set S} (he : e ∈ G.E) : ∃ u v, u ≠ v + ∧ closure e ∩ G.V = {u, v} ∧ IsLineWithEnds (closure e) u v := by + rcases G.edge_cond e he with h1 | ⟨u, -, hF⟩ + · exact h1 + · exact (h.1 _ (G.closure_subset_U he) hF).elim + +theorem mem_E_of_mem_edges {G : Drawing S} {a b : S} (W : GraphWalk G.toGraph a b) {e : Set S} + (he : e ∈ W.edges) : e ∈ G.E := by + induction W with + | nil _ => simp [GraphWalk.edges] at he + | cons hl r ih => + rcases List.mem_cons.mp he with rfl | h + · exact hl.1 + · exact ih h + +/-- A vertex in the closure of an edge of a walk lies on the walk. -/ +theorem mem_support_of_mem_closure {G : Drawing S} {a b : S} (W : GraphWalk G.toGraph a b) {e : Set + S} (he : e ∈ W.edges) {p : S} (hp : p ∈ closure e) (hV : p ∈ G.V) : p ∈ W.support := by + induction W with + | nil _ => simp [GraphWalk.edges] at he + | @cons a y b f hl r ih => + rcases List.mem_cons.mp he with rfl | h + · have h1 : p ∈ closure e ∩ G.V := ⟨hp, hV⟩ + rw [hl.2.2.2] at h1 + rcases h1 with rfl | h2 + · exact List.mem_cons_self + · exact List.mem_cons_of_mem _ (mem_singleton_iff.mp h2 ▸ r.start_mem_support) + · exact List.mem_cons_of_mem _ (ih h) + +theorem walk_subset_U {G : Drawing S} {a b : S} (W : GraphWalk G.toGraph a b) : + ({x | x ∈ W.support} ∪ ⋃ e ∈ {e | e ∈ W.edges}, closure e) ⊆ G.U := by + apply union_subset + · exact fun x hx => G.V_subset_U (W.mem_vertexSet_of_mem_support hx) + · exact iUnion₂_subset fun e he => G.closure_subset_U (mem_E_of_mem_edges W he) + +/-- The first edge of a longest simple walk is a leaf at the first vertex. -/ +theorem leaf_of_longest [T2Space S] {G : Drawing S} (hN : NoArcs G) {y b : S} + (W : GraphWalk G.toGraph y b) (hW : W.IsSimple) (hlen : 1 ≤ W.length) + (hmax : ∀ (a' b' : S) (W' : GraphWalk G.toGraph a' b'), W'.IsSimple → W'.length ≤ W.length) : + ∃ e ∈ G.E, ∃ x, x ≠ y ∧ closure e ∩ G.V = {y, x} ∧ ∀ f ∈ G.E, f ≠ e → y ∉ closure f := by + classical + cases W with + | nil _ => simp [GraphWalk.length, GraphWalk.edges] at hlen + | @cons _ x _ e hl r => + have hnd := List.nodup_cons.mp hW + refine ⟨e, hl.1, x, fun h => hnd.1 (h ▸ r.start_mem_support), hl.2.2.2, fun f hf hne hyf => ?_⟩ + set W₀ : GraphWalk G.toGraph y b := .cons hl r with hW₀ + obtain ⟨u, v, huv, hcap, hline⟩ := hN.edge_line hf + have hyV : y ∈ G.V := hl.2.1 + have hy' : y ∈ closure f ∩ G.V := ⟨hyf, hyV⟩ + obtain ⟨z, hzy, hcap', hline'⟩ : ∃ z, z ≠ y ∧ closure f ∩ G.V = {y, z} ∧ IsLineWithEnds + (closure f) y z := by + rw [hcap] at hy' + rcases hy' with rfl | h + · exact ⟨v, huv.symm, hcap, hline⟩ + · obtain rfl : y = v := h + exact ⟨u, huv, by rw [hcap, pair_comm], hline.symm⟩ + have hzV : z ∈ G.V := (show z ∈ closure f ∩ G.V by rw [hcap']; exact .inr rfl).2 + by_cases hz : z ∈ W₀.support + · obtain ⟨W', hs, he, hsup⟩ := GraphWalk.exists_prefix W₀ hW hz + have hfW : f ∉ W₀.edges := fun h => by + rcases List.mem_cons.mp h with h1 | h1 + · exact hne h1 + · exact hnd.1 (mem_support_of_mem_closure r h1 hyf hyV) + have hL := walk_isLine G W' hs hzy.symm + refine hN.1 _ (union_subset (walk_subset_U W') (G.closure_subset_U hf)) + (isOArc_union hL hline' ?_) + rintro p ⟨hp, hpf⟩ + have hpc : p ∈ closure f ∩ G.V → p ∈ ({y, z} : Set S) := fun h => hcap' ▸ h + rcases hp with hp | hp + · exact hpc ⟨hpf, W'.mem_vertexSet_of_mem_support hp⟩ + · obtain ⟨g, hg, hpg⟩ := mem_iUnion₂.mp hp + have hgE := mem_E_of_mem_edges W' hg + by_cases hpV : p ∈ G.V + · exact hpc ⟨hpf, hpV⟩ + · have h1 : p ∈ f := by rw [← G.closure_diff_V hf]; exact ⟨hpf, hpV⟩ + have h2 : p ∈ g := by rw [← G.closure_diff_V hgE]; exact ⟨hpg, hpV⟩ + exact (hfW (arcComponent_eq hgE hf h2 h1 ▸ he g hg)).elim + · have hlink : G.toGraph.IsLink f z y := ⟨hf, hzV, hyV, by rw [hcap', pair_comm]⟩ + have h1 := hmax z b (.cons hlink W₀) (List.nodup_cons.mpr ⟨hz, hW⟩) + have h2 : (GraphWalk.cons hlink W₀).length = W₀.length + 1 := rfl + omega + +/-- **A leaf off the boundary.** -/ +theorem exists_leaf [T2Space S] {G : Drawing S} (hN : NoArcs G) (hE : G.E.Nonempty) : + ∃ e ∈ G.E, ∃ y x, x ≠ y ∧ closure e ∩ G.V = {y, x} ∧ y ∉ bd S ∧ (∀ f ∈ G.E, f ≠ e + → y ∉ closure f) ∧ IsLineWithEnds (closure e) y x := by + classical + let P : ℕ → Prop := fun n => ∃ (a b : S) (W : GraphWalk G.toGraph a b), W.IsSimple ∧ W.length = n + have hbound : ∀ n, P n → n ≤ G.V.ncard := by + rintro n ⟨a, b, W, hs, rfl⟩ + have h1 : W.support.toFinset ⊆ G.finite_V.toFinset := fun x hx => + G.finite_V.mem_toFinset.mpr (W.mem_vertexSet_of_mem_support (List.mem_toFinset.mp hx)) + have h2 := Finset.card_le_card h1 + rw [List.toFinset_card_of_nodup hs, GraphWalk.length_support', + ← ncard_eq_toFinset_card _ G.finite_V] at h2 + omega + obtain ⟨e₀, he₀⟩ := hE + obtain ⟨u, v, huv, hcap, -⟩ := hN.edge_line he₀ + have huV : u ∈ G.V := (show u ∈ closure e₀ ∩ G.V by rw [hcap]; exact .inl rfl).2 + have hvV : v ∈ G.V := (show v ∈ closure e₀ ∩ G.V by rw [hcap]; exact .inr rfl).2 + have hP1 : P 1 := ⟨u, v, .cons ⟨he₀, huV, hvV, hcap⟩ (.nil hvV), by + simpa [GraphWalk.IsSimple, GraphWalk.support] using huv, rfl⟩ + have h1 : 1 ≤ G.V.ncard := hbound 1 hP1 + obtain ⟨a, b, W, hs, hl⟩ : P (Nat.findGreatest P G.V.ncard) := Nat.findGreatest_spec h1 hP1 + have hlen : 1 ≤ W.length := hl ▸ Nat.le_findGreatest h1 hP1 + have hmax : ∀ (a' b' : S) (W' : GraphWalk G.toGraph a' b'), W'.IsSimple → W'.length ≤ W.length + := fun a' b' W' hs' => by + rw [hl] + exact Nat.le_findGreatest (hbound _ ⟨a', b', W', hs', rfl⟩) ⟨a', b', W', hs', rfl⟩ + have hab : a ≠ b := by + cases W with + | nil _ => simp [GraphWalk.length, GraphWalk.edges] at hlen + | cons hl' r => + have hnd := List.nodup_cons.mp hs + exact fun h => hnd.1 (h ▸ r.end_mem_support) + have finish : ∀ {y b : S} (W : GraphWalk G.toGraph y b), W.IsSimple → 1 ≤ W.length → (∀ + (a' b' : S) (W' : GraphWalk G.toGraph a' b'), W'.IsSimple → W'.length ≤ W.length) → y ∉ bd S → + ∃ e ∈ G.E, ∃ y x, x ≠ y ∧ closure e ∩ G.V = {y, x} ∧ y ∉ bd S ∧ (∀ f ∈ G.E, f ≠ e + → y ∉ closure f) ∧ IsLineWithEnds (closure e) y x := by + intro y b W hs hlen hmax hy + obtain ⟨e, he, x, hxy, hcap, hleaf⟩ := leaf_of_longest hN W hs hlen hmax + obtain ⟨u, v, huv, hcap', hline⟩ := hN.edge_line he + have hy' : y ∈ ({u, v} : Set S) := hcap' ▸ (show y ∈ closure e ∩ G.V by + rw [hcap] + exact .inl rfl) + have hx' : x ∈ ({u, v} : Set S) := hcap' ▸ (show x ∈ closure e ∩ G.V by + rw [hcap] + exact .inr rfl) + refine ⟨e, he, y, x, hxy, hcap, hy, hleaf, ?_⟩ + rcases hy' with rfl | h + · rcases hx' with rfl | h' + · exact absurd rfl hxy + · obtain rfl : x = v := h' + exact hline + · obtain rfl : y = v := h + rcases hx' with rfl | h' + · exact hline.symm + · exact absurd h' hxy + by_cases ha : a ∈ bd S + · by_cases hb : b ∈ bd S + · exact (hN.2 _ (walk_subset_U W) ⟨a, b, ha, hb, walk_isLine G W hs hab⟩).elim + · have hlr : W.reverse.length = W.length := by + have h2 := GraphWalk.length_support' W.reverse + rw [GraphWalk.support_reverse, List.length_reverse, GraphWalk.length_support'] at h2 + omega + refine finish W.reverse ?_ (hlr ▸ hlen) (fun a' b' W' hs' => hlr ▸ hmax a' b' W' hs') hb + change W.reverse.support.Nodup + rw [GraphWalk.support_reverse] + exact List.nodup_reverse.mpr hs + · exact finish W hs hlen hmax ha + +omit [TopologicalSpace S] in +theorem listUnion_append {l : List (Set S)} {A : Set S} : listUnion (l ++ [A]) = listUnion l ∪ A + := by + ext z + simp [listUnion, or_comm] + +theorem IsGrowth.snoc_free {B A : Set S} {l : List (Set S)} {k : ℕ} (h : IsGrowth B l k) + (hA : IsLine A) (hd : A ∩ (B ∪ listUnion l) = ∅) : IsGrowth B (l ++ [A]) (k + 1) := by + induction h with + | nil B => exact .free hA (by simpa using hd) (.nil _) + | free hA' hd' _ ih => + rw [List.cons_append, Nat.add_right_comm] + exact .free hA' hd' (ih (by rwa [listUnion_cons, ← union_assoc] at hd)) + | attached hA' hd' _ ih => + rw [List.cons_append] + exact .attached hA' hd' (ih (by rwa [listUnion_cons, ← union_assoc] at hd)) + +theorem IsGrowth.snoc_attached {B A : Set S} {l : List (Set S)} {k : ℕ} {p q : S} + (h : IsGrowth B l k) (hA : IsLineWithEnds A p q) (hd : A ∩ (B ∪ listUnion l) = {p}) : IsGrowth B + (l ++ [A]) k := by + induction h with + | nil B => exact .attached hA (by simpa using hd) (.nil _) + | free hA' hd' _ ih => + rw [List.cons_append] + exact .free hA' hd' (ih (by rwa [listUnion_cons, ← union_assoc] at hd)) + | attached hA' hd' _ ih => + rw [List.cons_append] + exact .attached hA' hd' (ih (by rwa [listUnion_cons, ← union_assoc] at hd)) + +/-- The vertices of `G` off `bd(Σ)` that lie on edges. -/ +def endsOff (G : Drawing S) : Set S := {x | x ∉ bd S ∧ x ∈ G.V ∧ ∃ e ∈ G.E, x ∈ closure e} + +theorem finite_endsOff (G : Drawing S) : (endsOff G).Finite := G.finite_V.subset fun _ h => h.2.1 + +/-- **A forest as a list of lines.** The closures of the edges of a proper graph whose point set +includes no `O`-arc and no `I`-arc grow from `bd(Σ)` one at a time, and the number of lines that +start a new tree is the number of vertices +on edges off `bd(Σ)` less the number of edges. -/ +theorem exists_growth [T2Space S] (n : ℕ) : ∀ G : Drawing S, G.E.ncard = n → G.IsProper → NoArcs G → + ∃ (l : List (Set S)) (k : ℕ), IsGrowth (bd S) l k ∧ listUnion l = (⋃ e ∈ G.E, closure e) + ∧ k + n = (endsOff G).ncard := by + classical + induction n with + | zero => + intro G hn _ _ + have hE : G.E = ∅ := (ncard_eq_zero G.finite_edges).mp hn + have hoff : endsOff G = ∅ := eq_empty_iff_forall_notMem.mpr fun x hx => by + obtain ⟨e, he, -⟩ := hx.2.2 + rw [hE] at he + exact he + exact ⟨[], 0, .nil _, by simp [hE], by simp [hoff]⟩ + | succ n ih => + intro G hn hG hN + have hne : G.E.Nonempty := by + rw [nonempty_iff_ne_empty] + intro h + rw [h] at hn + simp at hn + obtain ⟨e, he, y, x, hxy, hcap, hy, hleaf, hA⟩ := exists_leaf hN hne + have hE' : (G.deleteEdge e).E = G.E \ {e} := deleteEdge_E G e + have hV' : (G.deleteEdge e).V = G.V := GM06.deleteEdge_V G e + have hU' : (G.deleteEdge e).U ⊆ G.U := by + rw [deleteEdge_U G he] + exact sdiff_subset + obtain ⟨l, k, hg, hl, hc⟩ := ih (G.deleteEdge e) + (by rw [hE', ncard_sdiff_singleton_of_mem he, hn]; rfl) + (GM06.deleteEdge_isProper hG e) (hN.mono hU') + let R : Set S := ⋃ f ∈ (G.deleteEdge e).E, closure f + have hyV : y ∈ G.V := (show y ∈ closure e ∩ G.V by rw [hcap]; exact .inl rfl).2 + have hxV : x ∈ G.V := (show x ∈ closure e ∩ G.V by rw [hcap]; exact .inr rfl).2 + have hyc : y ∈ closure e := (show y ∈ closure e ∩ G.V by rw [hcap]; exact .inl rfl).1 + have hxc : x ∈ closure e := (show x ∈ closure e ∩ G.V by rw [hcap]; exact .inr rfl).1 + have hyR : y ∉ R := fun h => by + obtain ⟨f, hf, hyf⟩ := mem_iUnion₂.mp h + rw [hE'] at hf + exact hleaf f hf.1 hf.2 hyf + have hcapR : closure e ∩ (bd S ∪ R) ⊆ {x} := by + rintro p ⟨hp, hpB⟩ + by_cases hpV : p ∈ G.V + · have h1 : p ∈ closure e ∩ G.V := ⟨hp, hpV⟩ + rw [hcap] at h1 + rcases h1 with rfl | h1 + · rcases hpB with h2 | h2 + · exact (hy h2).elim + · exact (hyR h2).elim + · exact h1 + · have hpe : p ∈ e := by rw [← G.closure_diff_V he]; exact ⟨hp, hpV⟩ + rcases hpB with h2 | h2 + · exact (hpV (hG ⟨h2, G.closure_subset_U he hp⟩)).elim + · obtain ⟨f, hf, hpf⟩ := mem_iUnion₂.mp h2 + rw [hE'] at hf + have hpf' : p ∈ f := by rw [← G.closure_diff_V hf.1]; exact ⟨hpf, hpV⟩ + exact (hf.2 (mem_singleton_iff.mpr (arcComponent_eq hf.1 he hpf' hpe))).elim + have hun : (⋃ f ∈ G.E, closure f) = R ∪ closure e := by + ext z + simp only [mem_iUnion₂, mem_union, R, hE', mem_sdiff, mem_singleton_iff] + constructor + · rintro ⟨f, hf, hz⟩ + by_cases hfe : f = e + · exact .inr (hfe ▸ hz) + · exact .inl ⟨f, ⟨hf, hfe⟩, hz⟩ + · rintro (⟨f, hf, hz⟩ | hz) + · exact ⟨f, hf.1, hz⟩ + · exact ⟨e, he, hz⟩ + have hyoff : y ∉ endsOff (G.deleteEdge e) := fun h => by + obtain ⟨f, hf, hyf⟩ := h.2.2 + exact hyR (mem_iUnion₂.mpr ⟨f, hf, hyf⟩) + have hsubE : ∀ {z : S}, z ∈ endsOff (G.deleteEdge e) → z ∈ endsOff G := fun {z} h => by + obtain ⟨hz, hzV, f, hf, hzf⟩ := h + rw [hE'] at hf + exact ⟨hz, hV' ▸ hzV, f, hf.1, hzf⟩ + have hsplit : ∀ {z : S}, z ∈ endsOff G → z = y ∨ z = x ∨ z ∈ endsOff (G.deleteEdge e) + := fun {z} h => by + obtain ⟨hz, hzV, f, hf, hzf⟩ := h + by_cases hfe : f = e + · subst hfe + have h1 : z ∈ closure f ∩ G.V := ⟨hzf, hzV⟩ + rw [hcap] at h1 + rcases h1 with h1 | h1 + · exact .inl h1 + · exact .inr (.inl h1) + · exact .inr (.inr ⟨hz, hV'.symm ▸ hzV, f, by rw [hE']; exact ⟨hf, hfe⟩, hzf⟩) + by_cases hx : x ∈ bd S ∪ R + · have hcapx : closure e ∩ (bd S ∪ listUnion l) = {x} := by + rw [hl] + exact Subset.antisymm hcapR (singleton_subset_iff.mpr ⟨hxc, hx⟩) + refine ⟨l ++ [closure e], k, hg.snoc_attached hA.symm hcapx, by rw [listUnion_append, hl, + hun], ?_⟩ + have hoff : endsOff G = insert y (endsOff (G.deleteEdge e)) := by + ext z + constructor + · intro h + rcases hsplit h with rfl | rfl | h1 + · exact .inl rfl + · refine .inr ⟨h.1, hV'.symm ▸ h.2.1, ?_⟩ + rcases hx with h2 | h2 + · exact (h.1 h2).elim + · obtain ⟨f, hf, hzf⟩ := mem_iUnion₂.mp h2 + exact ⟨f, hf, hzf⟩ + · exact .inr h1 + · rintro (rfl | h) + · exact ⟨hy, hyV, e, he, hyc⟩ + · exact hsubE h + rw [hoff, ncard_insert_of_notMem hyoff (finite_endsOff _), ← hc] + omega + · have hcapx : closure e ∩ (bd S ∪ listUnion l) = ∅ := by + rw [hl] + refine eq_empty_iff_forall_notMem.mpr fun p hp => ?_ + obtain rfl : p = x := hcapR hp + exact hx hp.2 + have hlin : IsLine (closure e) := by + obtain ⟨f, -, -⟩ := hA + exact ⟨f⟩ + refine ⟨l ++ [closure e], k + 1, hg.snoc_free hlin hcapx, by rw [listUnion_append, hl, + hun], ?_⟩ + have hxoff : x ∉ endsOff (G.deleteEdge e) := fun h => by + obtain ⟨f, hf, hxf⟩ := h.2.2 + exact hx (.inr (mem_iUnion₂.mpr ⟨f, hf, hxf⟩)) + have hxb : x ∉ bd S := fun h => hx (.inl h) + have hoff : endsOff G = insert y (insert x (endsOff (G.deleteEdge e))) := by + ext z + constructor + · intro h + rcases hsplit h with h1 | h1 | h1 + · exact .inl h1 + · exact .inr (.inl h1) + · exact .inr (.inr h1) + · rintro (rfl | rfl | h) + · exact ⟨hy, hyV, e, he, hyc⟩ + · exact ⟨hxb, hxV, e, he, hxc⟩ + · exact hsubE h + have hynot : y ∉ insert x (endsOff (G.deleteEdge e)) := by + rintro (h | h) + · exact hxy h.symm + · exact hyoff h + rw [hoff, ncard_insert_of_notMem hynot ((finite_endsOff _).insert _), + ncard_insert_of_notMem hxoff (finite_endsOff _), ← hc] + omega + +theorem U_eq_biUnion_closure {G : Drawing S} (hn : HasNoIsolatedVertices G) : G.U + = ⋃ e ∈ G.E, closure e := by + refine Subset.antisymm (fun z hz => ?_) (iUnion₂_subset fun e he => G.closure_subset_U he) + by_cases hzV : z ∈ G.V + · obtain ⟨e, he, hi⟩ := hn z hzV + exact mem_iUnion₂.mpr ⟨e, he, hi.2.2⟩ + · have hzc : z ∈ G.U \ G.V := ⟨hz, hzV⟩ + have hmem : pathComponentIn (G.U \ G.V) z ∈ G.E := + GraphMinor.Surface.mem_arcComponentsIn_of_mem hzc + exact mem_iUnion₂.mpr ⟨_, hmem, subset_closure (mem_pathComponentIn_self hzc)⟩ + +/-- **Cutting along a forest.** For a proper graph `L` with no isolated vertices, whose point set +includes no `O`-arc and no `I`-arc, the cut along `U(L)` exists, and it has the model of (4.6) (page +226). -/ +theorem exists_isCutAlongGraph (hS : IsSurface S) {a b c : ℕ} (hm : Nonempty + (S ≃ₜ SurfaceModel a b c)) {L : Drawing S} (hL : L.IsProper) (hn : HasNoIsolatedVertices L) + (hN : NoArcs L) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (θ : Y → S) (k : ℕ), IsCutAlongGraph L Y θ ∧ Nonempty + (Y ≃ₜ SurfaceModel a b (c + k)) ∧ k + L.E.ncard = (endsOff L).ncard := by + have : T2Space S := hS.2.1 + obtain ⟨l, k, hg, hl, hc⟩ := exists_growth _ L rfl hL hN + obtain ⟨Y, tY, θ, hcut, hmY⟩ := exists_cut_growth _ hS hm rfl hg + rw [hl, ← U_eq_biUnion_closure hn] at hcut + exact ⟨Y, tY, θ, k, hcut.isCutAlongGraph hL hn, hmY, hc⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/ForestQuotient.lean b/LeanPool/GraphMinor/GM07/ForestQuotient.lean new file mode 100644 index 0000000000..b70918ba1e --- /dev/null +++ b/LeanPool/GraphMinor/GM07/ForestQuotient.lean @@ -0,0 +1,395 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.PullForest + +/-! +# Identifying vertices of a forest + +This is the combinatorial part of the proof of (4.5) of Graph Minors VII (page 223). There, `φ(H')` +is shown to be a forest from a shortest cyclic sequence of paths `P'_1, ..., P'_k` in distinct +components. We record this with a graph. + +Let `X` be a set of vertices of a forest, let `f` identify some vertices of `X`, and let `c` name +the class of a vertex under paths. The graph `classGraph f c X` has a node for each value of `f`, a +node for each class, and for each `x` in `X` an edge from `f x` +to `c x`. A simple closed walk in it passes through distinct classes, which is what minimality of +`k` gives in the paper. If the graph after identifying is a forest, then `classGraph` is a forest +(`classGraph_forest`). Conversely, if `classGraph` is a forest +and `G` is a forest with the same classes on `X`, then the graph after identifying `G` is a forest +(`quotient_forest`). Since homotopic forests have the same classes on the boundary, this gives the +forest claim of (4.5). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +variable {α β β' γ κ : Type*} + +/-- The graph with a node for each value of `f`, a node for each class, and an edge from `f x` to `c +x` for each `x` in `X`. -/ +def classGraph (f : α → γ) (c : α → κ) (X : Set α) : Graph (γ ⊕ κ) α where + vertexSet := univ + IsLink x p q := x ∈ X ∧ ((p = .inl (f x) ∧ q = .inr (c x)) ∨ (p = .inr (c x) ∧ q = .inl (f x))) + edgeSet := X + isLink_symm _ _ := ⟨fun _ _ h => ⟨h.1, h.2.elim (fun h1 => .inr ⟨h1.2, h1.1⟩) (fun h1 + => .inl ⟨h1.2, h1.1⟩)⟩⟩ + eq_or_eq_of_isLink_of_isLink {e x y v w} h1 h2 := by + rcases h1.2 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> rcases h2.2 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> simp + edge_mem_iff_exists_isLink e := ⟨fun he => ⟨_, _, he, .inl ⟨rfl, rfl⟩⟩, fun ⟨_, _, h⟩ => h.1⟩ + left_mem_of_isLink _ _ _ _ := mem_univ _ + +/-- A walk of `classGraph` that ends at a value node turns into a walk of the graph after +identifying. Each class on the walk gives one path, and edges of different classes differ. -/ +theorem class_walk {H : Graph γ β} {f : α → γ} {c : α → κ} {X : Set α} {t : β → κ} + (hpath : ∀ x ∈ X, ∀ y ∈ X, c x = c y → x ≠ y → ∃ W : GraphWalk H (f x) (f y), 0 < W.length + ∧ W.edges.Nodup ∧ ∀ e ∈ W.edges, t e = c x) + {u v : γ ⊕ κ} (T : GraphWalk (classGraph f c X) u v) (hs : T.IsSimple) (hE : T.edges.Nodup) + (b : γ) (hv : v = .inl b) (hb : b ∈ H.vertexSet) : + (∀ a, u = .inl a → ∃ W : GraphWalk H a b, W.edges.Nodup ∧ ∀ e ∈ W.edges, Sum.inr + (t e) ∈ T.support) ∧ + (∀ k, u = .inr k → ∀ x ∈ X, c x = k → x ∉ T.edges → ∃ W : GraphWalk H (f x) b, 0 < W.length + ∧ W.edges.Nodup ∧ ∀ e ∈ W.edges, Sum.inr (t e) ∈ T.support) := by + classical + induction T with + | nil _ => + subst hv + refine ⟨fun a ha => ?_, fun k hk => ?_⟩ + · obtain rfl : b = a := Sum.inl.inj ha + exact ⟨.nil hb, by simp [GraphWalk.edges], by simp [GraphWalk.edges]⟩ + · simp at hk + | @cons u u' v y hl r ih => + have hnd := List.nodup_cons.mp hs + have hnE := List.nodup_cons.mp hE + obtain ⟨ihl, ihr⟩ := ih hnd.2 hnE.2 hv + refine ⟨fun a ha => ?_, fun k hk x hx hxk hxE => ?_⟩ + · subst ha + rcases hl.2 with ⟨h1, rfl⟩ | ⟨h1, -⟩ + · obtain rfl : a = f y := Sum.inl.inj h1 + obtain ⟨W, -, hN, hS⟩ := ihr (c y) rfl y hl.1 rfl hnE.1 + exact ⟨W, hN, fun e he => List.mem_cons_of_mem _ (hS e he)⟩ + · simp at h1 + · subst hk + rcases hl.2 with ⟨h1, -⟩ | ⟨h1, rfl⟩ + · simp at h1 + · have hky : k = c y := Sum.inr.inj h1 + have hxy : x ≠ y := by + rintro rfl + exact hxE List.mem_cons_self + obtain ⟨P, hP, hPn, hPt⟩ := hpath x hx y hl.1 (hxk.trans hky) hxy + obtain ⟨W, hN, hS⟩ := ihl (f y) rfl + refine ⟨P.append W, ?_, ?_, fun e he => ?_⟩ + · rw [GraphWalk.length_append] + omega + · rw [GraphWalk.edges_append] + refine List.Nodup.append hPn hN fun e he he' => ?_ + have h2 := hS e he' + rw [hPt e he, hxk] at h2 + exact hnd.1 h2 + · rw [GraphWalk.edges_append] at he + rcases List.mem_append.mp he with h | h + · rw [hPt e h, hxk] + exact List.mem_cons_self + · exact List.mem_cons_of_mem _ (hS e h) + +/-- **From the forest after identifying to `classGraph`.** -/ +theorem classGraph_forest {H : Graph γ β} {f : α → γ} {c : α → κ} {X : Set α} {t : β → κ} + (hH : IsGraphForest H) (hV : ∀ x ∈ X, f x ∈ H.vertexSet) + (hpath : ∀ x ∈ X, ∀ y ∈ X, c x = c y → x ≠ y → ∃ W : GraphWalk H (f x) (f y), 0 < W.length + ∧ W.edges.Nodup ∧ ∀ e ∈ W.edges, t e = c x) : IsGraphForest (classGraph f c X) := by + classical + have key : ∀ (a : γ) (W : GraphWalk (classGraph f c X) (.inl a) (.inl a)), W.IsSimpleClosed + → W.length = 0 := by + intro a W hW + cases W with + | nil _ => rfl + | @cons _ y _ x hl r => + exfalso + have hrs : r.IsSimple := hW.1 + have hE := List.nodup_cons.mp hW.2 + rcases hl.2 with ⟨h1, rfl⟩ | ⟨h1, -⟩ + · obtain rfl : a = f x := Sum.inl.inj h1 + obtain ⟨-, h2⟩ := class_walk hpath r hrs hE.2 (f x) rfl (hV x hl.1) + obtain ⟨W, hP, hN, -⟩ := h2 (c x) rfl x hl.1 rfl hE.1 + have := length_eq_zero_of_trail hH _ _ W rfl hN + omega + · simp at h1 + intro u W hW + rcases u with a | k + · exact key a W hW + · cases W with + | nil _ => rfl + | @cons _ y _ x hl r => + exfalso + rcases hl.2 with ⟨h1, -⟩ | ⟨h1, rfl⟩ + · simp at h1 + · have hl' : (classGraph f c X).IsLink x (.inr k) (.inl (f x)) := hl + let W' : GraphWalk (classGraph f c X) (.inl (f x)) (.inl (f x)) := r.append (.cons hl' + (.nil (mem_univ _))) + have hW' : W'.IsSimpleClosed := by + have hrs : r.support.Nodup := hW.1 + have hE := hW.2 + constructor + · have h2 : W'.support.tail = r.support.tail ++ [Sum.inl (f x)] := by + rw [GraphWalk.support_append, r.support_eq_cons, List.cons_append, List.tail_cons] + rfl + rw [h2] + have hp : (r.support.tail ++ [Sum.inl (f x)]).Perm r.support := by + rw [r.support_eq_cons, List.tail_cons] + exact List.perm_append_singleton _ _ + exact hp.nodup_iff.mpr hrs + · have h2 : W'.edges = r.edges ++ [x] := by + rw [GraphWalk.edges_append] + rfl + rw [h2] + exact (List.perm_append_singleton _ _).nodup_iff.mpr hE + have h0 := key _ W' hW' + have h1' : W'.length = r.length + 1 := by + rw [GraphWalk.length_append] + rfl + omega + +/-- The graph `G` with a new node for each value of `f` on `X`, and an edge from `x` to the node `f +x`. A walk may jump from `x` to another point of its fiber through this node. -/ +def starGraph (G : Graph α β) (f : α → γ) (X : Set α) : Graph (α ⊕ γ) (β ⊕ α) where + vertexSet := univ + IsLink e p q := match e with + | .inl e => ∃ u v, p = .inl u ∧ q = .inl v ∧ G.IsLink e u v + | .inr x => x ∈ X ∧ ((p = .inl x ∧ q = .inr (f x)) ∨ (p = .inr (f x) ∧ q = .inl x)) + edgeSet := {e | match e with + | .inl e => e ∈ G.edgeSet + | .inr x => x ∈ X} + isLink_symm e _ := ⟨fun a b h => by + rcases e with e | x + · obtain ⟨u, v, rfl, rfl, h⟩ := h + exact ⟨v, u, rfl, rfl, h.symm⟩ + · exact ⟨h.1, h.2.elim (fun h1 => .inr ⟨h1.2, h1.1⟩) (fun h1 => .inl ⟨h1.2, h1.1⟩)⟩⟩ + eq_or_eq_of_isLink_of_isLink {e x y v w} h1 h2 := by + rcases e with e | x' + · obtain ⟨u, u', rfl, rfl, h⟩ := h1 + obtain ⟨a, a', rfl, rfl, h'⟩ := h2 + rcases G.eq_or_eq_of_isLink_of_isLink h h' with rfl | rfl + · exact .inl rfl + · exact .inr rfl + · rcases h1.2 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> rcases h2.2 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> simp + edge_mem_iff_exists_isLink e := by + rcases e with e | x + · constructor + · intro he + obtain ⟨u, v, h⟩ := (G.edge_mem_iff_exists_isLink e).mp he + exact ⟨_, _, u, v, rfl, rfl, h⟩ + · rintro ⟨_, _, u, v, -, -, h⟩ + exact (G.edge_mem_iff_exists_isLink e).mpr ⟨u, v, h⟩ + · exact ⟨fun he => ⟨_, _, he, .inl ⟨rfl, rfl⟩⟩, fun ⟨_, _, h⟩ => h.1⟩ + left_mem_of_isLink _ _ _ _ := mem_univ _ + +/-- The node of `classGraph` for a node of `starGraph`. -/ +def starNode (c : α → κ) : α ⊕ γ → γ ⊕ κ + | .inl v => .inr (c v) + | .inr z => .inl z + +/-- Collapsing the edges of `G` maps a walk of `starGraph` to a walk of `classGraph`, keeping the +labels of the new edges. -/ +theorem star_collapse {G : Graph α β} {f : α → γ} {c : α → κ} {X : Set α} + (hc : ∀ e p q, G.IsLink e p q → c p = c q) {u v : α ⊕ γ} (T : GraphWalk (starGraph G f X) u v) : + ∃ W : GraphWalk (classGraph f c X) (starNode c u) (starNode c v), W.edges = T.edges.filterMap + (fun e => e.elim (fun _ => none) some) := by + induction T with + | nil _ => exact ⟨.nil (mem_univ _), rfl⟩ + | @cons a b d e hl r ih => + obtain ⟨W, hW⟩ := ih + rcases e with e | x + · obtain ⟨p, q, rfl, rfl, h⟩ := hl + have hcq : c p = c q := hc e p q h + rw [show starNode c (.inl p) = starNode c (.inl q) by simp [starNode, hcq]] + exact ⟨W, by rw [hW]; rfl⟩ + · refine ⟨GraphWalk.cons (e := x) ?_ W, ?_⟩ + · rcases hl.2 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨hl.1, .inr ⟨rfl, rfl⟩⟩ + · exact ⟨hl.1, .inl ⟨rfl, rfl⟩⟩ + · change x :: W.edges = _ + rw [hW] + rfl + +/-- A walk of `starGraph` from a vertex of `G` with no new edge is a walk of `G`. -/ +theorem star_no_jump {G : Graph α β} {f : α → γ} {X : Set α} {p q : α ⊕ γ} (T : GraphWalk + (starGraph G f X) p q) (hT : ∀ x, Sum.inr x ∉ T.edges) (u : α) (hu : u ∈ G.vertexSet) (hp : p + = .inl u) : + ∃ (v : α) (W : GraphWalk G u v), q = .inl v ∧ T.edges = W.edges.map Sum.inl := by + induction T generalizing u with + | @nil p' hv => + subst hp + exact ⟨u, .nil hu, rfl, rfl⟩ + | @cons a b d e hl r ih => + subst hp + rcases e with e | x + · obtain ⟨p, q', hp, rfl, h⟩ := hl + obtain rfl : u = p := Sum.inl.inj hp + obtain ⟨v, W, hv, hE⟩ := ih (fun x hx => hT x (List.mem_cons_of_mem _ hx)) q' h.right_mem rfl + exact ⟨v, .cons h W, hv, by simp [GraphWalk.edges, hE]⟩ + · exact (hT x List.mem_cons_self).elim + +/-- **From `classGraph` back to the forest after identifying.** Let `P` be the graph after +identifying the vertices of `G`, so that each link of `P` lifts to a link of `G`, and let `G` be a +forest with `c` constant along its edges. If two vertices in one fiber +are distinct then they lie in `X`. A circuit of `P` lifts to a closed walk of `starGraph` with +distinct edges, which collapses to a closed walk of `classGraph` with distinct edges. -/ +theorem quotient_forest {G : Graph α β} {P : Graph γ β'} {f : α → γ} {c : α → κ} {X : Set α} {ι : β + → β'} (hG : IsGraphForest G) (hB : IsGraphForest (classGraph f c X)) + (hc : ∀ e p q, G.IsLink e p q → c p = c q) + (hlift : ∀ e a b, P.IsLink e a b → ∃ e' p q, G.IsLink e' p q ∧ f p = a ∧ f q = b ∧ ι e' = e) + (hjump : ∀ p ∈ G.vertexSet, ∀ q ∈ G.vertexSet, f p = f q → p ≠ q → p ∈ X + ∧ q ∈ X) : IsGraphForest P := by + classical + have hstar : ∀ (u : α ⊕ γ) (T : GraphWalk (starGraph G f X) u u), T.edges.Nodup → T.length = 0 + := by + intro u T hT + obtain ⟨W, hW⟩ := star_collapse hc T (f := f) + have hnd : W.edges.Nodup := by + rw [hW] + refine List.Nodup.filterMap ?_ hT + rintro (e | x) (e' | x') y hy hy' + · simp at hy + · simp at hy + · simp at hy' + · simp only [Sum.elim_inr, Option.mem_def, Option.some.injEq] at hy hy' + rw [hy, hy'] + have h0 := length_eq_zero_of_trail hB _ _ W rfl hnd + have hno : ∀ x, Sum.inr x ∉ T.edges := fun x hx => by + have hm : x ∈ W.edges := by + rw [hW] + exact List.mem_filterMap.mpr ⟨_, hx, rfl⟩ + have : W.edges = [] := List.length_eq_zero_iff.mp h0 + rw [this] at hm + simp at hm + rcases u with u | z + · have hu : u ∈ G.vertexSet ∨ T.length = 0 := by + cases T with + | nil _ => exact .inr rfl + | @cons _ b _ e hl r => + rcases e with e | x + · obtain ⟨p, q, hp, -, h⟩ := hl + exact .inl (Sum.inl.inj hp ▸ h.left_mem) + · exact (hno x List.mem_cons_self).elim + rcases hu with hu | hu + swap + · exact hu + obtain ⟨v, W', hv, hE⟩ := star_no_jump T hno u hu rfl + obtain rfl : u = v := Sum.inl.inj hv + have hnd' : W'.edges.Nodup := by + rw [hE] at hT + exact List.Nodup.of_map _ hT + have h1 := length_eq_zero_of_trail hG _ _ W' rfl hnd' + change T.edges.length = 0 + rw [hE, List.length_map] + exact h1 + · cases T with + | nil _ => rfl + | @cons _ b _ e hl r => + rcases e with e | x + · obtain ⟨p, q, hp, -, -⟩ := hl + simp at hp + · exact (hno x List.mem_cons_self).elim + have hlw : ∀ {a b : γ} (r : GraphWalk P a b), r.IsSimple → r.edges.Nodup → ∀ p ∈ G.vertexSet, f p + = a → ∃ q ∈ G.vertexSet, f q = b ∧ ∃ T : GraphWalk (starGraph G f X) (.inl p) (.inl q), + T.edges.Nodup ∧ (∀ x, Sum.inr x ∈ T.edges → f x ∈ r.support ∧ f x ≠ b) + ∧ ∀ e', Sum.inl e' ∈ T.edges → ι e' ∈ r.edges := by + intro a b r + induction r with + | nil _ => + intro _ _ p hp hf + exact ⟨p, hp, hf, .nil (mem_univ _), by simp [GraphWalk.edges], by simp [GraphWalk.edges], + by simp [GraphWalk.edges]⟩ + | @cons a a' b e hl r ih => + intro hs hE p hp hfp + have hnd := List.nodup_cons.mp hs + have hnE := List.nodup_cons.mp hE + obtain ⟨e', p₁, q₁, hl', hp₁, hq₁, hι⟩ := hlift e a a' hl + obtain ⟨q, hq, hfq, T, hTn, hTs, hTe⟩ := ih hnd.2 hnE.2 q₁ hl'.right_mem hq₁ + have hlk : (starGraph G f X).IsLink (.inl e') (.inl p₁) (.inl q₁) := ⟨p₁, q₁, rfl, rfl, hl'⟩ + have hstep : Sum.inl e' ∉ T.edges := fun h => hnE.1 (hι ▸ hTe e' h) + have hba : a ≠ b := fun h => hnd.1 (h ▸ r.end_mem_support) + by_cases hpp : p = p₁ + · subst hpp + refine ⟨q, hq, hfq, .cons hlk T, List.nodup_cons.mpr ⟨hstep, hTn⟩, fun x hx => ?_, + fun e'' he'' => ?_⟩ + · rcases List.mem_cons.mp hx with h | h + · simp at h + · exact ⟨List.mem_cons_of_mem _ (hTs x h).1, (hTs x h).2⟩ + · rcases List.mem_cons.mp he'' with h | h + · rw [Sum.inl.inj h, hι] + exact List.mem_cons_self + · exact List.mem_cons_of_mem _ (hTe e'' h) + · obtain ⟨hpX, hp₁X⟩ := hjump p hp p₁ hl'.left_mem (hfp.trans hp₁.symm) hpp + have h1 : (starGraph G f X).IsLink (.inr p) (.inl p) (.inr a) := + ⟨hpX, .inl ⟨rfl, by rw [hfp]⟩⟩ + have h2 : (starGraph G f X).IsLink (.inr p₁) (.inr a) (.inl p₁) + := ⟨hp₁X, .inr ⟨by rw [hp₁], rfl⟩⟩ + have hout : ∀ x, f x = a → Sum.inr x ∉ T.edges := fun x hx h => hnd.1 (hx ▸ (hTs x h).1) + refine ⟨q, hq, hfq, .cons h1 (.cons h2 (.cons hlk T)), ?_, fun x hx => ?_, + fun e'' he'' => ?_⟩ + · simp only [GraphWalk.edges, List.nodup_cons, List.mem_cons, Sum.inr.injEq, + reduceCtorEq, false_or, not_or] + exact ⟨⟨hpp, hout p hfp⟩, hout p₁ hp₁, hstep, hTn⟩ + · simp only [GraphWalk.edges, List.mem_cons, Sum.inr.injEq, reduceCtorEq, false_or] at hx + rcases hx with rfl | rfl | h + · exact ⟨hfp ▸ List.mem_cons_self, hfp ▸ hba⟩ + · exact ⟨hp₁ ▸ List.mem_cons_self, hp₁ ▸ hba⟩ + · exact ⟨List.mem_cons_of_mem _ (hTs x h).1, (hTs x h).2⟩ + · simp only [GraphWalk.edges, List.mem_cons, reduceCtorEq, false_or] at he'' + rcases he'' with h | h + · rw [Sum.inl.inj h, hι] + exact List.mem_cons_self + · exact List.mem_cons_of_mem _ (hTe e'' h) + intro a W hW + cases W with + | nil _ => rfl + | @cons _ a' _ e hl r => + exfalso + have hE := List.nodup_cons.mp hW.2 + obtain ⟨e', p₀, q₀, hl', hp₀, hq₀, hι⟩ := hlift e a a' hl + obtain ⟨q, hq, hfq, T, hTn, hTs, hTe⟩ := hlw r hW.1 hE.2 q₀ hl'.right_mem hq₀ + have hlk : (starGraph G f X).IsLink (.inl e') (.inl p₀) (.inl q₀) := ⟨p₀, q₀, rfl, rfl, hl'⟩ + have hstep : Sum.inl e' ∉ T.edges := fun h => hE.1 (hι ▸ hTe e' h) + by_cases hqp : q = p₀ + · subst hqp + have := hstar _ (.cons hlk T) (List.nodup_cons.mpr ⟨hstep, hTn⟩) + simp [GraphWalk.length, GraphWalk.edges] at this + · obtain ⟨hqX, hpX⟩ := hjump q hq p₀ hl'.left_mem (hfq.trans hp₀.symm) hqp + have h1 : (starGraph G f X).IsLink (.inr q) (.inl q) (.inr a) := + ⟨hqX, .inl ⟨rfl, by rw [hfq]⟩⟩ + have h2 : (starGraph G f X).IsLink (.inr p₀) (.inr a) (.inl p₀) + := ⟨hpX, .inr ⟨by rw [hp₀], rfl⟩⟩ + have hout : ∀ x, f x = a → Sum.inr x ∉ T.edges := fun x hx h => (hTs x h).2 hx + let C : GraphWalk (starGraph G f X) (.inl p₀) (.inl p₀) := (GraphWalk.cons hlk T).append + (.cons h1 (.cons h2 (.nil (mem_univ _)))) + have hCe : C.edges = (Sum.inl e' :: T.edges) ++ [Sum.inr q, Sum.inr p₀] := by + rw [GraphWalk.edges_append] + rfl + have hC : C.edges.Nodup := by + rw [hCe] + refine List.Nodup.append (List.nodup_cons.mpr ⟨hstep, hTn⟩) (by simp [hqp]) fun x hx hx' + => ?_ + simp only [List.mem_cons, List.not_mem_nil, or_false] at hx hx' + rcases hx' with rfl | rfl + · rcases hx with h | h + · simp at h + · exact hout q hfq h + · rcases hx with h | h + · simp at h + · exact hout p₀ hp₀ h + have := hstar _ C hC + rw [GraphWalk.length_append] at this + simp [GraphWalk.length, GraphWalk.edges] at this + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/GoodEdge.lean b/LeanPool/GraphMinor/GM07/GoodEdge.lean new file mode 100644 index 0000000000..e5cf544acc --- /dev/null +++ b/LeanPool/GraphMinor/GM07/GoodEdge.lean @@ -0,0 +1,892 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.LoopSides +import LeanPool.GraphMinor.GM19.FragmentExtend +import LeanPool.GraphMinor.GM19.Section6a + +/-! +# A good edge to cut along + +This file proves (7.3). The proof follows the paper's induction on the number of edges. Where the +paper uses the `O`-arc `A_{r-1}(C)`, +which does not exist as printed (see the correction on page 238 in `corrections/GM07.md`), we take +the edge between a region in `Δ_{r-1}(C)` and a region outside it. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +local notation "𝕀" => unitInterval + +variable {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] + +/-- A disc in a closed surface, or in the interior of a surface, inside a given open set. -/ +theorem exists_disc_in_open {y : S} (hy : IsInteriorPoint y) {W : Set S} + (hW : IsOpen W) (hyW : y ∈ W) : + ∃ D, IsClosedDisc D ∧ y ∈ discInt D ∧ D ⊆ W := by + obtain ⟨U, h, g, c, hUW, hy'⟩ := hy.exists_ballChart hW hyW (R := 2) (by norm_num) + have hsub : closedBall (0 : ℂ) 1 ⊆ ball 0 2 := closedBall_subset_ball (by norm_num) + have hconv := isClosedDisc_of_convex (convex_closedBall (0 : ℂ) 1) (by + rw [interior_closedBall _ one_ne_zero] + exact ⟨0, by simp⟩) isBounded_closedBall isClosed_closedBall + obtain ⟨h1, h2⟩ := c.image_disc hconv.1 hsub + have hb : discBd (closedBall (0 : ℂ) 1) = sphere 0 1 := by + rw [hconv.2, frontier_closedBall _ one_ne_zero] + refine ⟨_, h1, ⟨⟨0, by simp, hy'⟩, ?_⟩, ?_⟩ + · rw [h2, hb] + rintro ⟨z, hz, he⟩ + have h3 : z = 0 := by + have h4 := congrArg h (he.trans hy'.symm) + rw [c.hg (hsub (sphere_subset_closedBall hz)), c.hg (show (0 : ℂ) ∈ ball 0 2 by simp)] at h4 + exact h4 + rw [h3] at hz + simp at hz + · rintro _ ⟨z, hz, rfl⟩ + exact hUW (c.gm (hsub hz)) + +/-- A closed disc whose boundary lies in another closed disc lies in it, off the sphere. -/ +theorem disc_subset_of_bd_subset (hT : IsSurface T) [ConnectedSpace T] + (hns : ¬ IsSphere T) {Δ₀ Δ : Set T} (hΔ₀ : IsClosedDisc Δ₀) + (hΔ : IsClosedDisc Δ) (hb : discBd Δ ⊆ Δ₀) : Δ ⊆ Δ₀ := by + have hO := hΔ.isOArc_discBd + obtain ⟨φ⟩ := id hO + have hn : IsNullHomotopicOArcIn Δ₀ (discBd Δ) := ⟨φ, hΔ₀.isSimplyConnectedSet.2 _ (by + rintro _ ⟨w, rfl⟩ + exact hb (φ w).2)⟩ + obtain ⟨Δ₃, hs, hd, hbd⟩ := nullHomotopicOArcIn_bounds_disc hT hO hb hn + rwa [eq_of_discBd_eq hT hns hΔ hd hbd.symm] + +variable [T1Space S] [T1Space T] + +omit [T1Space S] [T1Space T] in +/-- A map from one cap to another, over the identity of `S`, is one to one. -/ +theorem exists_cap_injective (hS : IsSurface S) {C : Set S} {T' : Type u} [TopologicalSpace T'] {j + : S → T} {D : Set T} {j' : S → T'} + {D' : Set T'} (hc : IsCappedCuff C T j D) (hc' : IsCappedCuff C T' j' D') : + ∃ Ψ : T' → T, Continuous Ψ ∧ Injective Ψ ∧ ∀ y, Ψ (j' y) = j y := by + have : CompactSpace S := hS.1 + have : T2Space T := hc.isSurface.2.1 + have : T2Space T' := hc'.isSurface.2.1 + have hne : C.Nonempty := by + obtain ⟨y, hy, rfl⟩ := hc.cuff + exact ⟨y, mem_connectedComponentIn hy⟩ + obtain ⟨Ψ, hΨc, hΨj, hΨm, hΨi, -, hΨo⟩ := exists_cap_map hc' hc continuous_id (bijOn_id C) hne + simp only [id] at hΨj + refine ⟨Ψ, hΨc, ?_, hΨj⟩ + have hcross : ∀ (a : T') (y : S), a ∈ D' → Ψ a = j y → a = j' y := by + intro a y ha he + by_cases hi : a ∈ discInt D' + · have h1 := hΨo hi + have h2 : j y ∈ range j ∩ D := ⟨mem_range_self y, he ▸ h1.1⟩ + rw [hc.inter_eq, ← hc.discBd_eq] at h2 + exact absurd h2 (he ▸ h1.2) + · have hb : a ∈ discBd D' := by + by_contra hn + exact hi ⟨ha, hn⟩ + rw [hc'.discBd_eq] at hb + obtain ⟨z, -, rfl⟩ := hb + rw [hΨj] at he + rw [hc.isEmbedding.injective he] + intro a b he + have hA : a ∈ range j' ∪ D' := hc'.union_eq ▸ mem_univ a + have hB : b ∈ range j' ∪ D' := hc'.union_eq ▸ mem_univ b + rcases hA with ⟨x, rfl⟩ | hA <;> rcases hB with ⟨y, rfl⟩ | hB + · rw [hΨj, hΨj] at he + rw [hc.isEmbedding.injective he] + · exact (hcross b x hB (by rw [← he, hΨj])).symm + · exact hcross a y hA (by rw [he, hΨj]) + · exact hΨi hA hB he + +omit [T1Space S] [T1Space T] in +/-- A hole of `X` lies in a disc with boundary in `X` in each cap. -/ +theorem IsInnerHole.in_cap (hS : IsSurface S) {C X K : Set S} (hh : IsInnerHole C X K) {j : S + → T} {D : Set T} + (hc : IsCappedCuff C T j D) : ∃ Δ, IsClosedDisc Δ ∧ discBd Δ ⊆ j '' X ∧ j '' K ⊆ Δ := by + obtain ⟨-, S', tS, j', D', Δ', hc', hΔ', hb, hk⟩ := hh + have : T2Space T := hc.isSurface.2.1 + obtain ⟨Ψ, hΨc, hΨi, hΨj⟩ := exists_cap_injective hS hc hc' + obtain ⟨h1, h2⟩ := isClosedDisc_image_of_injOn hΔ' hΨc hΨi.injOn + refine ⟨Ψ '' Δ', h1, ?_, ?_⟩ + · rw [h2] + rintro _ ⟨_, hz, rfl⟩ + obtain ⟨y, hy, rfl⟩ := hb hz + exact ⟨y, hy, (hΨj y).symm⟩ + · rintro _ ⟨y, hy, rfl⟩ + exact ⟨j' y, hk (mem_image_of_mem j' hy), hΨj y⟩ + +omit [T1Space S] in +/-- A cuff is not planar. -/ +theorem not_isPlanar_cuff (hS : IsSurface S) [ConnectedSpace S] {a b c : ℕ} (habc : 3 + ≤ 3 * a + 3 * b + c) + (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) {C : Set S} (hC : C ∈ cuffs S) : ¬ IsPlanar C := by + intro hp + have : T2Space S := hS.2.1 + have hO : IsOArc C := (cuff_statement.{u} S hS).2.2 C hC + obtain ⟨T, tT, j, D, hc, -⟩ := exists_cappedCuff hS hC + have hT := hc.isSurface + have : T2Space T := hT.2.1 + have : ConnectedSpace T := hc.connectedSpace hS + have hnull := (isPlanar_iff_isNullHomotopicOArc_of_isOArc hS hO).mp hp + obtain ⟨Δ, hΔ, hbd⟩ := nullHomotopicOArc_bounds_disc hS hO hnull + obtain ⟨h1, h2⟩ := isClosedDisc_image_of_injOn hΔ hc.isEmbedding.continuous + hc.isEmbedding.injective.injOn + have heq := eq_of_discBd_eq hT (not_isSphere_cap hS habc hm hc) h1 hc.isClosedDisc + (by rw [h2, hbd, hc.discBd_eq]) + obtain ⟨hh, g, cc⟩ := hc.isClosedDisc.exists_isChart + have hp0 : g 0 ∈ discInt D := by + refine ⟨cc.gm (by simp), fun hb => ?_⟩ + have h2' : hh (g 0) ∈ Metric.sphere (0 : ℂ) 1 := cc.bd ▸ mem_image_of_mem hh hb + rw [cc.hg (by simp)] at h2' + simp at h2' + have h3 : g 0 ∈ j '' Δ := heq ▸ hp0.1 + obtain ⟨y, -, hy⟩ := h3 + have h4 : g 0 ∈ range j ∩ D := ⟨⟨y, hy⟩, hp0.1⟩ + rw [hc.inter_eq, ← hc.discBd_eq] at h4 + exact hp0.2 h4 + +omit [T1Space S] in +/-- A cuff surrounds itself. -/ +theorem isScriptASet_cuff (hS : IsSurface S) [ConnectedSpace S] {a b c : ℕ} (habc : 3 + ≤ 3 * a + 3 * b + c) + (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) {G : Drawing S} (hG : G.IsProper) {C : Set S} + (hC : C ∈ cuffs S) {r : ℕ} + (hr : (G.V ∩ C).ncard ≤ r) : IsScriptASet G r C C := by + have hO : IsOArc C := (cuff_statement.{u} S hS).2.2 C hC + have : T2Space S := hS.2.1 + obtain ⟨T, tT, j, D, hc, -⟩ := exists_cappedCuff hS hC + have hsub : C ⊆ bd S := by + obtain ⟨y, -, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + refine ⟨isSolid_of_isOArc hS hO, isConnected_of_isOArc hO, fun z hz => hG ⟨hsub hz.1, hz.2⟩, + ⟨hC, ?_, not_isPlanar_cuff hS habc hm hC⟩, hr⟩ + refine isPlanarInCappedCuff_of_cap hS hc ⟨D, hc.isClosedDisc, ?_⟩ + rw [← hc.discBd_eq] + exact Surface.discBd_subset _ + +omit [T1Space S] in +/-- The inside of a connected surface stays connected after removing finitely many points. -/ +theorem isPreconnected_interior_sdiff_finite (hS : IsSurface S) [ConnectedSpace S] {P : Set S} + (hP : P.Finite) : + IsPreconnected ((bd S)ᶜ \ P) := by + have ht2 : T2Space S := hS.2.1 + obtain ⟨T, tT, j, K, hT, hj, hK, hu, hi, hconn⟩ := exists_capAll S hS + have : ConnectedSpace T := hconn inferInstance + have : T2Space T := hT.2.1 + have : CompactSpace T := hT.1 + obtain ⟨p, q, c, ⟨e⟩⟩ := classification.{u} T hT.isSurface inferInstance + have hM : IsClosedSurface (SurfaceModel p q c) := by + refine ⟨e.surjective.compactSpace e.continuous, e.symm.isEmbedding.t2Space, fun x => ?_⟩ + have h1 := (isInteriorPoint_homeomorph_iff e (e.symm x)).mpr (hT.2.2 _) + simpa using h1 + have : T2Space (SurfaceModel p q c) := hM.2.1 + have : ConnectedSpace (SurfaceModel p q c) := e.surjective.connectedSpace e.continuous + have hd : IsPreconnected (bd S)ᶜ := by + rw [compl_eq_univ_sdiff] + exact isPreconnected_diff_bd hS isOpen_univ isPreconnected_univ + have hemb : IsEmbedding fun x => e (j x) := e.isEmbedding.comp hj.isEmbedding + have him : (fun x => e (j x)) '' (bd S)ᶜ = e '' Kᶜ := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + refine ⟨j x, fun hk => hx ?_, rfl⟩ + have h1 : j x ∈ range j ∩ K := ⟨mem_range_self x, hk⟩ + rw [hi] at h1 + obtain ⟨z, hz, he⟩ := h1 + rwa [← hj.injective he] + · rintro ⟨t, ht, rfl⟩ + have h1 : t ∈ range j := (hu.ge (mem_univ t)).resolve_right ht + obtain ⟨x, rfl⟩ := h1 + refine ⟨x, fun hx => ht ?_, rfl⟩ + have h2 : j x ∈ range j ∩ K := by + rw [hi] + exact mem_image_of_mem j hx + exact h2.2 + have hO : IsOpen (e '' Kᶜ) := e.isOpenMap _ hK.isOpen_compl + have hOc : IsPreconnected (e '' Kᶜ) := by + rw [← him] + exact hd.image _ hemb.continuous.continuousOn + have h1 := GM19.isPreconnected_sdiff_finite hM hO hOc (hP.image fun x => e (j x)) + have h2 : e '' Kᶜ \ (fun x => e (j x)) '' P = (fun x => e (j x)) '' ((bd S)ᶜ \ P) := by + rw [← him] + ext y + constructor + · rintro ⟨⟨x, hx, rfl⟩, hn⟩ + exact ⟨x, ⟨hx, fun hp => hn (mem_image_of_mem _ hp)⟩, rfl⟩ + · rintro ⟨x, ⟨hx, hp⟩, rfl⟩ + refine ⟨mem_image_of_mem _ hx, ?_⟩ + rintro ⟨z, hz, he⟩ + exact hp (hemb.injective he ▸ hz) + rw [h2] at h1 + exact hemb.isInducing.isPreconnected_image.mp h1 + +omit [T1Space S] in +/-- Two regions with a common point are equal. -/ +theorem region_eq_of_mem {G : Drawing S} {ρ ρ' : Set S} (hρ : ρ ∈ G.R) (hρ' : ρ' ∈ G.R) {x : S} + (hx : x ∈ ρ) (hx' : x ∈ ρ') : ρ = ρ' := by + obtain ⟨a, -, rfl⟩ := hρ + obtain ⟨b, -, rfl⟩ := hρ' + rw [connectedComponentIn_eq hx, connectedComponentIn_eq hx'] + +omit [T1Space S] in +/-- A candidate for `α(G)` exists when `α(G) > 0`, and it gives the bound. -/ +theorem exists_candidate_of_alpha_pos {G : Drawing S} (h : 0 < alpha G) : ∃ X, IsAlphaCandidate G X + := by + have hne : {n : ℕ | ∃ X : Set S, IsAlphaCandidate G X ∧ (X ∩ G.V).ncard = n}.Nonempty := by + by_contra hn + rw [not_nonempty_iff_eq_empty] at hn + have : alpha G = 0 := by + rw [alpha, hn] + exact Nat.sInf_empty + omega + obtain ⟨n, X, hX, -⟩ := hne + exact ⟨X, hX⟩ + +omit [T1Space S] in +theorem alpha_le_of_candidate {G : Drawing S} {X : Set S} (hX : IsAlphaCandidate G X) : alpha G ≤ + (X ∩ G.V).ncard := + Nat.sInf_le ⟨X, hX, rfl⟩ + +section Fill + +variable (hS : IsSurface S) [ConnectedSpace S] {a b c : ℕ} (habc : 3 ≤ 3 * a + 3 * b + c) + (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) + {G : Drawing S} (hG : G.IsProper) {r : ℕ} + +include hS habc hm + +omit [T1Space S] [T1Space T] in +/-- `Δ_r(C)` lies in the disc of (5.7). -/ +theorem cuffInsideSet_image_subset {C : Set S} {j : S → T} {D Δ₀ : Set T} + (hc : IsCappedCuff C T j D) (hΔ₀ : IsClosedDisc Δ₀) + (hsub : j '' scriptA G r C ⊆ Δ₀) : j '' cuffInsideSet G r C ⊆ Δ₀ := by + have hT := hc.isSurface + have : ConnectedSpace T := hc.connectedSpace hS + rintro _ ⟨y, ⟨Y, ⟨X, hX, hY⟩, hy⟩, rfl⟩ + rcases hY with rfl | hh + · exact hsub (mem_image_of_mem j (show y ∈ scriptA G r C from ⟨Y, hX, hy⟩)) + · obtain ⟨Δ, hΔ, hb, hk⟩ := hh.in_cap hS hc + have h1 : discBd Δ ⊆ Δ₀ := hb.trans ((image_mono fun x hx => show x ∈ scriptA G r C from ⟨X, + hX, hx⟩).trans hsub) + exact disc_subset_of_bd_subset hT (not_isSphere_cap hS habc hm hc) hΔ₀ hΔ h1 (hk + (mem_image_of_mem j hy)) + +omit habc hm in +omit [T1Space S] in +/-- A region that meets `Δ_r(C)` lies in `𝒜_r(C)` or in a hole of a member of it. -/ +theorem region_of_meets_fill {C ρ : Set S} (hρ : ρ ∈ G.R) (hm' : (ρ ∩ cuffInsideSet G r + C).Nonempty) : + ρ ⊆ scriptA G r C ∨ ∃ X K, IsScriptASet G r C X ∧ IsInnerHole C X K ∧ ρ ⊆ K := by + obtain ⟨y, hyρ, Y, ⟨X, hX, hY⟩, hy⟩ := hm' + by_cases hmeet : (ρ ∩ X).Nonempty + · obtain ⟨z, hz, hzX⟩ := hmeet + exact .inl (region_subset_scriptA hS hρ ⟨z, hz, X, hX, hzX⟩) + · rcases hY with rfl | hh + · exact absurd ⟨y, hyρ, hy⟩ hmeet + · refine .inr ⟨X, Y, hX, hh, ?_⟩ + obtain ⟨w, hw, rfl⟩ := hh.1 + rw [connectedComponentIn_eq hy] + refine (region_isPreconnected hρ).subset_connectedComponentIn hyρ fun z hz => ⟨mem_univ _, + fun hzX => hmeet ⟨z, hz, hzX⟩⟩ + +omit habc hm in +omit [T1Space S] in +theorem subset_fill_of_region {C ρ : Set S} (hρ : ρ ∈ G.R) (hm' : (ρ ∩ cuffInsideSet G r + C).Nonempty) : + ρ ⊆ cuffInsideSet G r C := by + rcases region_of_meets_fill hS hρ hm' with h | ⟨X, K, hX, hK, h⟩ + · rintro z hz + obtain ⟨X, hX, hzX⟩ := h hz + exact ⟨X, ⟨X, hX, .inl rfl⟩, hzX⟩ + · exact fun z hz => ⟨K, ⟨X, hX, .inr hK⟩, h hz⟩ + +include hG + +omit [T1Space S] in +/-- There is a region in `Δ_r(C)`, and a region off it, with an edge in the closure of both. -/ +theorem exists_frontier_edge (hr : 9 * (r + 1) ≤ 2 * alpha G) (hcuff : ∀ C ∈ cuffs S, + (G.V ∩ C).ncard ≤ r) {C : Set S} (hC : C ∈ cuffs S) : + ∃ f ∈ G.E, ∃ ρ ∈ G.R, ∃ ρ' ∈ G.R, ρ ⊆ cuffInsideSet G r C ∧ Disjoint ρ' (cuffInsideSet G r C) + ∧ f ⊆ closure ρ ∧ f ⊆ closure ρ' := by + classical + have ht2 : T2Space S := hS.2.1 + have hcpt : CompactSpace S := hS.1 + have hlc : LocallyConnectedSpace S := hS.locallyConnected + set Fill := cuffInsideSet G r C with hFill + have hRfin : G.R.Finite := finite_regions_of_isProper hS hG + have hsplit : ∀ ρ ∈ G.R, ρ ⊆ Fill ∨ Disjoint ρ Fill := fun ρ hρ => by + by_cases h : (ρ ∩ Fill).Nonempty + · exact .inl (subset_fill_of_region hS hρ h) + · exact .inr (disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp h)) + let 𝓘 : Set (Set S) := {ρ ∈ G.R | ρ ⊆ Fill} + let 𝓞 : Set (Set S) := {ρ ∈ G.R | Disjoint ρ Fill} + have hS1 : IsScriptASet G r C C := isScriptASet_cuff hS habc hm hG hC (hcuff C hC) + have hCFill : C ⊆ Fill := fun x hx => ⟨C, ⟨C, hS1, .inl rfl⟩, hx⟩ + have hbdC : C ⊆ bd S := by + obtain ⟨y, -, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + -- A region in `Fill`. + have hIne : 𝓘.Nonempty := by + have hO : IsOArc C := (cuff_statement.{u} S hS).2.2 C hC + obtain ⟨x, hx, hxV⟩ : ∃ x ∈ C, x ∉ G.V := by + by_contra hn + push Not at hn + exact infinite_of_isOArc hO (G.finite_V.subset hn) + have hxU : x ∉ G.U := fun h => hxV (hG ⟨hbdC hx, h⟩) + let ρ := connectedComponentIn (univ \ G.U) x + have hρ : ρ ∈ G.R := ⟨x, ⟨mem_univ _, hxU⟩, rfl⟩ + exact ⟨ρ, hρ, subset_fill_of_region hS hρ ⟨x, mem_connectedComponentIn ⟨mem_univ _, hxU⟩, + hCFill hx⟩⟩ + -- A region off `Fill`: otherwise a candidate would be planar in the capped surface. + have hOne : 𝓞.Nonempty := by + by_contra hn + have hall : ∀ ρ ∈ G.R, ρ ⊆ Fill := fun ρ hρ => (hsplit ρ hρ).resolve_right fun h + => hn ⟨ρ, hρ, h⟩ + obtain ⟨T, tT, j, D, hc, -⟩ := exists_cappedCuff hS hC + have hpl := theorem_5_7_proof hS hm habc hG hC hr + obtain ⟨Δ₀, hΔ₀, hsub⟩ := hpl.2.2 T j D hc + have ht2' : T2Space T := hc.isSurface.2.1 + have hfs := cuffInsideSet_image_subset hS habc hm hc hΔ₀ hsub + have hcl : IsClosed (j ⁻¹' Δ₀) := hΔ₀.isCompact.isClosed.preimage hc.isEmbedding.continuous + have huniv : (univ : Set S) ⊆ j ⁻¹' Δ₀ := by + rw [← closure_sUnion_regions_eq_univ hS hG] + refine closure_minimal (sUnion_subset fun ρ hρ x hx => ?_) hcl + exact hfs (mem_image_of_mem j (hall ρ hρ hx)) + obtain ⟨X, hX⟩ := exists_candidate_of_alpha_pos (G := G) (by omega) + exact hX.2.2.2 (.inr ⟨C, hC, isPlanarInCappedCuff_of_cap hS hc ⟨Δ₀, hΔ₀, fun z ⟨y, _, + hy⟩ => hy ▸ huniv (mem_univ y)⟩⟩) + -- The inside of `S` off the vertices is connected, so the two closed sets meet there. + let A : Set S := ⋃ ρ ∈ 𝓘, closure ρ + let B : Set S := ⋃ ρ ∈ 𝓞, closure ρ + have hAc : IsClosed A := (hRfin.subset (sep_subset _ _)).isClosed_biUnion fun _ _ + => isClosed_closure + have hBc : IsClosed B := (hRfin.subset (sep_subset _ _)).isClosed_biUnion fun _ _ + => isClosed_closure + have hcover : (univ : Set S) ⊆ A ∪ B := by + rw [← closure_sUnion_regions_eq_univ hS hG] + refine closure_minimal (sUnion_subset fun ρ hρ x hx => ?_) (hAc.union hBc) + rcases hsplit ρ hρ with h | h + · exact .inl (mem_biUnion (show ρ ∈ 𝓘 from ⟨hρ, h⟩) (subset_closure hx)) + · exact .inr (mem_biUnion (show ρ ∈ 𝓞 from ⟨hρ, h⟩) (subset_closure hx)) + let W : Set S := (bd S)ᶜ \ G.V + have hW : IsPreconnected W := isPreconnected_interior_sdiff_finite hS G.finite_V + have hpoint : ∀ ρ ∈ G.R, (W ∩ closure ρ).Nonempty := fun ρ hρ => by + obtain ⟨x, hx⟩ := region_nonempty hρ + obtain ⟨y, hy, hyb⟩ := mem_closure_iff.mp (mem_closure_compl_bd (hS.2.2 x)) ρ + (region_isOpen hρ) hx + refine ⟨y, ⟨hyb, fun hV => ?_⟩, subset_closure hy⟩ + obtain ⟨w, -, hw⟩ := hρ + have hyOutside : y ∈ univ \ G.U := connectedComponentIn_subset _ _ (hw ▸ hy) + exact hyOutside.2 (G.V_subset_U hV) + obtain ⟨ρ₁, hρ₁⟩ := hIne + obtain ⟨ρ₂, hρ₂⟩ := hOne + obtain ⟨x, hxW, hxA, hxB⟩ := isPreconnected_closed_iff.mp hW A B hAc hBc (fun x _ => hcover + (mem_univ x)) + (by + obtain ⟨x, h1, h2⟩ := hpoint ρ₁ hρ₁.1 + exact ⟨x, h1, mem_biUnion hρ₁ h2⟩) + (by + obtain ⟨x, h1, h2⟩ := hpoint ρ₂ hρ₂.1 + exact ⟨x, h1, mem_biUnion hρ₂ h2⟩) + obtain ⟨ρ, hρ, hxρ⟩ := mem_iUnion₂.mp hxA + obtain ⟨ρ', hρ', hxρ'⟩ := mem_iUnion₂.mp hxB + have hne : ρ ≠ ρ' := by + rintro rfl + obtain ⟨y, hy⟩ := region_nonempty hρ.1 + exact disjoint_left.mp hρ'.2 hy (hρ.2 hy) + have hxU : x ∈ G.U := by + by_contra hn + let ρ₃ := connectedComponentIn (univ \ G.U) x + have hρ₃ : ρ₃ ∈ G.R := ⟨x, ⟨mem_univ _, hn⟩, rfl⟩ + have hxρ₃ : x ∈ ρ₃ := mem_connectedComponentIn ⟨mem_univ _, hn⟩ + obtain ⟨y, hy, hyρ⟩ := mem_closure_iff.mp hxρ _ (region_isOpen hρ₃) hxρ₃ + obtain ⟨y', hy', hyρ'⟩ := mem_closure_iff.mp hxρ' _ (region_isOpen hρ₃) hxρ₃ + exact hne ((region_eq_of_mem hρ.1 hρ₃ hyρ hy).trans (region_eq_of_mem hρ₃ hρ'.1 hy' hyρ')) + rw [G.U_eq] at hxU + obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp (hxU.resolve_left hxW.2) + have hxf' : x ∈ f := by + rw [← G.closure_diff_V hf] + exact ⟨hxf, hxW.2⟩ + exact ⟨f, hf, ρ, hρ.1, ρ', hρ'.1, hρ.2, hρ'.2, + subset_closure.trans (edge_closure_subset_closure_region hS hG hf hρ.1 hxf' hxρ), + subset_closure.trans (edge_closure_subset_closure_region hS hG hf hρ'.1 hxf' hxρ')⟩ + +omit hG in +omit [T1Space S] hS [ConnectedSpace S] in +/-- The surface is not a cylinder. -/ +theorem not_cylinder_of_model : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 2) := by + rintro ⟨e'⟩ + obtain ⟨e₀⟩ := hm + have hcrit := (modelCriterion.2 a b c 0 0 2).mp ⟨e₀.symm.trans e'⟩ + have hb0 : b = 0 := hcrit.2.2.mpr rfl + omega + +omit hG habc hm hS [ConnectedSpace S] in +omit [T1Space S] in +theorem isNormal_off_edge {G : Drawing S} {X f : Set S} (hX : G.IsNormal X) (hf : f ∈ G.E) {z : S} + (hz : z ∈ f) : z ∉ X := fun hzX => + (hf.2.1 hz).2 (hX ⟨hzX, (hf.2.1 hz).1⟩) + +omit hG habc hm [ConnectedSpace S] in +omit [T1Space S] in +theorem isOpen_of_mem_componentsIn {X K : Set S} (hX : IsClosed X) (hK : K ∈ componentsIn + (univ \ X)) : IsOpen K := by + have : LocallyConnectedSpace S := hS.locallyConnected + obtain ⟨w, -, rfl⟩ := hK + have h : IsOpen (univ \ X) := isOpen_univ.sdiff hX + exact h.connectedComponentIn + +omit [T1Space S] in +/-- The facts on an edge between a region in `Δ_r(C)` and a region off it. -/ +theorem frontier_edge_good (hr : 9 * (r + 1) ≤ 2 * alpha G) (hr1 : 1 ≤ r) + (hred : NoEdgeInSmallDisc G) {C : Set S} (hC : C ∈ cuffs S) + (hcuff : ∀ C ∈ cuffs S, (G.V ∩ C).ncard ≤ r) {f ρ ρ' : Set S} (hf : f ∈ G.E) (hρ : ρ ∈ G.R) + (hρ' : ρ' ∈ G.R) + (hin : ρ ⊆ cuffInsideSet G r C) (hout : Disjoint ρ' (cuffInsideSet G r C)) + (hfρ : f ⊆ closure ρ) (hfρ' : f ⊆ closure ρ') : + (∀ z ∈ f, ∀ C' ∈ cuffs S, z ∉ cuffInsideSet G r C') ∧ Disjoint (closure f) (bd S) ∧ + (tilde f).ncard = 2 := by + classical + have ht2 : T2Space S := hS.2.1 + have hcpt : CompactSpace S := hS.1 + have hlc : LocallyConnectedSpace S := hS.locallyConnected + have hcyl := not_cylinder_of_model habc hm + have hdis : ∀ {r₁ r₂ : ℕ} {C₁ C₂ : Set S}, r₁ + r₂ < alpha G → C₁ ∈ cuffs S → C₂ ∈ cuffs S + → C₁ ≠ C₂ → + ∀ x, x ∈ scriptA G r₁ C₁ → x ∉ scriptA G r₂ C₂ := fun hlt h1 h2 hne x hx hx' => by + have := theorem_5_3_proof hS hcyl G h1 h2 hne hlt + exact (eq_empty_iff_forall_notMem.mp this x) ⟨hx, hx'⟩ + obtain ⟨z₀, hz₀⟩ := hf.2.2.1.nonempty + have hclosρ : closure f ⊆ closure ρ := edge_closure_subset_closure_region hS hG hf hρ hz₀ + (hfρ hz₀) + have hclosρ' : closure f ⊆ closure ρ' := edge_closure_subset_closure_region hS hG hf hρ' hz₀ + (hfρ' hz₀) + -- `f` misses `Δ_r(C)`, since a hole is open and `ρ'` misses it. + have hA : ∀ z ∈ f, z ∉ cuffInsideSet G r C := by + rintro z hz ⟨Y, ⟨X, hX, hY⟩, hzY⟩ + rcases hY with rfl | hh + · exact isNormal_off_edge hX.2.2.1 hf hz hzY + · have hYo := isOpen_of_mem_componentsIn hS hX.1.2 hh.1 + obtain ⟨w, hwY, hwρ⟩ := mem_closure_iff.mp (hfρ' hz) Y hYo hzY + exact disjoint_left.mp hout hwρ ⟨Y, ⟨X, hX, .inr hh⟩, hwY⟩ + -- `ρ` lies in `𝒜_r(C)`, since the frontier of a hole lies in `X`. + have hB : ρ ⊆ scriptA G r C := by + obtain ⟨y, hy⟩ := region_nonempty hρ + rcases region_of_meets_fill hS hρ ⟨y, hy, hin hy⟩ with h | ⟨X, K, hX, hK, hsub⟩ + · exact h + · exfalso + have hzX : z₀ ∉ X := isNormal_off_edge hX.2.2.1 hf hz₀ + have hK₃ : connectedComponentIn (univ \ X) z₀ ∈ componentsIn (univ \ X) + := ⟨z₀, ⟨mem_univ _, hzX⟩, rfl⟩ + have hopen := isOpen_of_mem_componentsIn hS hX.1.2 hK₃ + have hmem : z₀ ∈ connectedComponentIn (univ \ X) z₀ := mem_connectedComponentIn ⟨mem_univ _, + hzX⟩ + obtain ⟨w, hw, hwρ⟩ := mem_closure_iff.mp (hfρ hz₀) _ hopen hmem + have hwK := hsub hwρ + obtain ⟨b', hb', rfl⟩ := hK.1 + rw [connectedComponentIn_eq hwK, ← connectedComponentIn_eq hw] at hK + exact hA z₀ hz₀ ⟨_, ⟨X, hX, .inr hK⟩, hmem⟩ + have hbdC : ∀ {C' : Set S}, C' ∈ cuffs S → C' ⊆ bd S := fun {C'} hC' => by + obtain ⟨y, -, rfl⟩ := hC' + exact connectedComponentIn_subset _ _ + have hscript : ∀ {C' : Set S}, C' ∈ cuffs S → IsScriptASet G r C' C' := fun hC' => + isScriptASet_cuff hS habc hm hG hC' (hcuff _ hC') + have hC1 : ∀ z ∈ f, ∀ C' ∈ cuffs S, z ∉ cuffInsideSet G r C' := by + rintro z hz C' hC' ⟨Y, ⟨X', hX', hY⟩, hzY⟩ + by_cases hCC : C' = C + · subst hCC + exact hA z hz ⟨Y, ⟨X', hX', hY⟩, hzY⟩ + rcases hY with rfl | hh + · exact isNormal_off_edge hX'.2.2.1 hf hz hzY + · have hYo := isOpen_of_mem_componentsIn hS hX'.1.2 hh.1 + obtain ⟨y, hyY, hyρ⟩ := mem_closure_iff.mp (hfρ hz) Y hYo hzY + obtain ⟨X, hX, hyX⟩ := hB hyρ + have hX' : IsScriptASet G r C X := hX + by_cases hmeet : (X ∩ X').Nonempty + · obtain ⟨p, hp, hp'⟩ := hmeet + exact hdis (by omega) hC hC' (Ne.symm hCC) p ⟨X, hX', hp⟩ ⟨X', ‹IsScriptASet G r C' X'›, + hp'⟩ + · have hsub : X ⊆ Y := by + obtain ⟨w, -, rfl⟩ := hh.1 + rw [connectedComponentIn_eq hyY] + exact hX'.2.1.isPreconnected.subset_connectedComponentIn hyX fun q hq => + ⟨mem_univ _, fun hq' => hmeet ⟨q, hq, hq'⟩⟩ + obtain ⟨T, tT, j, D, hc, -⟩ := exists_cappedCuff hS hC' + have : T2Space T := hc.isSurface.2.1 + obtain ⟨Δ, hΔ, -, hk⟩ := hh.in_cap hS hc + have hpl : IsPlanarInCappedCuff C' X := isPlanarInCappedCuff_of_cap hS hc ⟨Δ, hΔ, + (image_mono hsub).trans hk⟩ + have hs' : IsScriptASet G r C' X := ⟨hX'.1, hX'.2.1, hX'.2.2.1, ⟨hC', hpl, + hX'.2.2.2.1.2.2⟩, hX'.2.2.2.2⟩ + exact hdis (by omega) hC hC' (Ne.symm hCC) y ⟨X, hX', hyX⟩ ⟨X, hs', hyX⟩ + -- `f` misses the boundary. + have hC2 : Disjoint (closure f) (bd S) := by + rw [disjoint_left] + intro u hu hub + have huU : u ∈ G.U := G.closure_subset_U hf hu + have huV : u ∈ G.V := hG ⟨hub, huU⟩ + have hunorm : u ∈ (G.U \ G.V)ᶜ := fun h => h.2 huV + have hC' : connectedComponentIn (bd S) u ∈ cuffs S := ⟨u, hub, rfl⟩ + have huC' : u ∈ connectedComponentIn (bd S) u := mem_connectedComponentIn hub + set C' := connectedComponentIn (bd S) u with hC'def + have hoffU : ∀ {ρ₀ : Set S}, ρ₀ ∈ G.R → ∀ q ∈ ρ₀, q ∉ G.U := fun {ρ₀} hρ₀ q hq hU => by + obtain ⟨w, -, hw⟩ := hρ₀ + have hqOutside : q ∈ univ \ G.U := connectedComponentIn_subset _ _ (hw ▸ hq) + exact hqOutside.2 hU + by_cases hCC : C' = C + · -- At an end on `C`, a line from `C` gives a member of `𝒜_r(C)` that meets `ρ'`. + rw [hCC] at huC' + obtain ⟨w, hwρ', hj⟩ := joinedIn_region_of_mem_closure hS hG hρ' (hclosρ' hu) hunorm + have hwC : w ∉ C := fun h => disjoint_left.mp hout hwρ' ⟨C, ⟨C, hscript hC, .inl rfl⟩, h⟩ + have hCcl : IsClosed C := (isCompact_of_isOArc ((cuff_statement.{u} S hS).2.2 C hC)).isClosed + obtain ⟨x, hx, L, hL, hl, hLX⟩ := exists_whisker_line hCcl huC' hwC hj + have hLn : G.IsNormal L := by + rintro q ⟨hq, hU⟩ + rcases hL hq with h | h + · exact absurd hU (hoffU hρ' q h) + · rw [show q = u from h] + exact huV + have hcount : G.V ∩ (C ∪ L) ⊆ G.V ∩ C := by + rintro q ⟨hqV, hq | hq⟩ + · exact ⟨hqV, hq⟩ + · rcases hL hq with h | h + · exact absurd (G.V_subset_U hqV) (hoffU hρ' q h) + · exact ⟨hqV, (show q = u from h) ▸ huC'⟩ + have hs := IsScriptASet.whisker hS (r' := r) (hscript hC) hx hl hLX hLn + ((ncard_le_ncard hcount (G.finite_V.subset inter_subset_left)).trans (hcuff C hC)) + have hwL : w ∈ L := by + obtain ⟨g, -, h1⟩ := id hl + rw [← h1] + exact (g 1).2 + exact disjoint_left.mp hout hwρ' ⟨C ∪ L, ⟨C ∪ L, hs, .inl rfl⟩, .inr hwL⟩ + · -- At an end on another cuff, a line from `𝒜_r(C)` gives a point of both. + obtain ⟨w, hwρ, hj⟩ := joinedIn_region_of_mem_closure hS hG hρ (hclosρ hu) hunorm + obtain ⟨X, hX, hwX⟩ := hB hwρ + have hX' : IsScriptASet G r C X := hX + have hu' : u ∈ scriptA G r C' := ⟨C', hscript hC', huC'⟩ + by_cases huX : u ∈ X + · exact hdis (by omega) hC hC' (Ne.symm hCC) u ⟨X, hX', huX⟩ hu' + · obtain ⟨x, hx, L, hL, hl, hLX⟩ := exists_whisker_line hX'.1.2 hwX huX hj.symm + have hLn : G.IsNormal L := by + rintro q ⟨hq, hU⟩ + rcases hL hq with h | h + · exact absurd hU (hoffU hρ q h) + · rw [show q = u from h] + exact huV + have hcount : G.V ∩ (X ∪ L) ⊆ (G.V ∩ X) ∪ {u} := by + rintro q ⟨hqV, hq | hq⟩ + · exact .inl ⟨hqV, hq⟩ + · rcases hL hq with h | h + · exact absurd (G.V_subset_U hqV) (hoffU hρ q h) + · exact .inr h + have hc' : (G.V ∩ (X ∪ L)).ncard ≤ r + 1 := by + refine (ncard_le_ncard hcount ((G.finite_V.subset inter_subset_left).union + (finite_singleton u))).trans ?_ + refine (ncard_union_le _ _).trans ?_ + rw [ncard_singleton] + exact Nat.add_le_add_right hX'.2.2.2.2 1 + have hs := IsScriptASet.whisker hS hX' hx hl hLX hLn hc' + have huL : u ∈ L := by + obtain ⟨g, -, h1⟩ := id hl + rw [← h1] + exact (g 1).2 + exact hdis (r₁ := r + 1) (by omega) hC hC' (Ne.symm hCC) u ⟨X ∪ L, hs, .inr huL⟩ hu' + refine ⟨hC1, hC2, ?_⟩ + rw [GraphMinor.GM19.tilde_eq_inter_V G hf] + rcases G.edge_cond f hf with ⟨u, v, huv, hcap, -⟩ | ⟨v, hcap, hO⟩ + · rw [hcap] + exact ncard_pair huv + · exfalso + obtain ⟨K, h1, h2, h3, h4, h5, h6⟩ := exists_loop_sides hS hm (not_isSphere_of_model hm + (by omega)) hf hcap hO hC2 hred + have hcount : (K ∩ G.V).ncard ≤ 1 := by + have : K ∩ G.V ⊆ {v} := fun x hx => h4 ⟨hx.2, hx.1⟩ + simpa using ncard_le_ncard this + have hnear : IsNearPlanar K := by + by_contra hn + have := alpha_le_of_candidate (G := G) ⟨h1, h2, h3, hn⟩ + omega + rcases hnear with hp | ⟨C'', hC'', hp⟩ + · exact h5 hp + · have hs : IsScriptASet G r C'' K := ⟨h1, h2, h3, ⟨hC'', hp, h5⟩, by + rw [inter_comm] + omega⟩ + by_cases hCC : C'' = C + · subst hCC + obtain ⟨q, hqρ, hqK⟩ := h6 z₀ hz₀ ρ' hρ' (hfρ' hz₀) + exact disjoint_left.mp hout hqρ ⟨K, ⟨K, hs, .inl rfl⟩, hqK⟩ + · obtain ⟨q, hqρ, hqK⟩ := h6 z₀ hz₀ ρ hρ (hfρ hz₀) + exact hdis (by omega) hC hC'' (Ne.symm hCC) q (hB hqρ) ⟨K, hs, hqK⟩ + +end Fill + +/-- With no edges and no cuffs, `α(G) = 0`: an isolated vertex lies in a small disc, and we push a +candidate out of it. -/ +theorem alpha_eq_zero_of_no_edges (hS : IsSurface S) [ConnectedSpace S] (hns : ¬ IsSphere S) + (hb : bd S = ∅) {G : Drawing S} + (hE : G.E = ∅) {X₀ : Set S} (hX₀ : IsAlphaCandidate G X₀) : alpha G = 0 := by + classical + have ht2 : T2Space S := hS.2.1 + have hVs : ∀ W : Set S, W ⊆ G.V → (G.span W ∅).V = W := fun W hW => by + rw [Drawing.span_V, Drawing.spanV] + simp [inter_eq_left.mpr hW] + have hUs : ∀ W : Set S, W ⊆ G.V → (G.span W ∅).U = W := fun W hW => by + rw [Drawing.span_U, Drawing.spanU, Drawing.spanV] + simp [inter_eq_left.mpr hW] + have key : ∀ W : Set S, W.Finite → W ⊆ G.V → ∃ X, IsAlphaCandidate (G.span W ∅) X ∧ X ∩ W = ∅ + := by + intro W hW + induction W, hW using Set.Finite.induction_on with + | empty => + intro _ + refine ⟨X₀, ⟨hX₀.1, hX₀.2.1, ?_, hX₀.2.2.2⟩, inter_empty _⟩ + rw [Drawing.IsNormal, hUs ∅ (empty_subset _), inter_empty] + exact empty_subset _ + | @insert v W hvW hfin ih => + intro hsub + have hWsub : W ⊆ G.V := (subset_insert _ _).trans hsub + obtain ⟨X', hX', hoff⟩ := ih hWsub + have hint : IsInteriorPoint v := by + by_contra hn + have : v ∈ bd S := hn + rw [hb] at this + exact this + obtain ⟨Δ, hΔ, hvΔ, hsubΔ⟩ := exists_disc_in_open hint hfin.isClosed.isOpen_compl hvW + have hbdoff : ∀ z ∈ discBd Δ, z ∉ insert v W := by + intro z hz hzi + rcases hzi with rfl | hzW + · exact hvΔ.2 hz + · exact hsubΔ (Surface.discBd_subset _ hz) hzW + obtain ⟨X, hX, hXs⟩ := exists_candidate_of_prune hS hns (G := G.span (insert v W) ∅) (G' + := G.span W ∅) hΔ + (by + rintro z ⟨hz, hzU⟩ + rw [hUs _ hsub] at hzU + exact absurd hzU (hbdoff z hz)) + (by + rintro z ⟨hzV, hz⟩ + rw [hVs _ hsub] at hzV + exact absurd hzV (hbdoff z hz)) + (by + rw [hUs _ hsub, hUs _ hWsub] + rintro z ⟨rfl | hz, hzi⟩ + · exact absurd hvΔ hzi + · exact hz) + (by + rw [hVs _ hsub, hVs _ hWsub] + exact subset_insert _ _) hX' + refine ⟨X, hX, ?_⟩ + rw [eq_empty_iff_forall_notMem] + rintro z ⟨hzX, hzi⟩ + have h1 := hXs ⟨hzX, by rw [hVs _ hsub]; exact hzi⟩ + rw [hVs _ hWsub] at h1 + exact (eq_empty_iff_forall_notMem.mp hoff z) h1 + obtain ⟨X, hX, hoff⟩ := key G.V G.finite_V subset_rfl + have hc : IsAlphaCandidate G X := by + refine ⟨hX.1, hX.2.1, fun z hz => ?_, hX.2.2.2⟩ + have h1 := hz.2 + rw [G.U_eq, hE] at h1 + simpa using h1 + have := alpha_le_of_candidate hc + rw [hoff, ncard_empty] at this + omega + +section Reduced + +variable (hS : IsSurface S) [ConnectedSpace S] {a b c : ℕ} (habc : 3 ≤ 3 * a + 3 * b + c) + (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) + {G : Drawing S} (hG : G.IsProper) {r : ℕ} + +include hS habc hm hG + +/-- (7.3) when no small disc holds an edge. -/ +theorem exists_good_edge_reduced (hr : 9 * (r + 1) ≤ 2 * alpha G) (hr1 : 1 ≤ r) + (hred : NoEdgeInSmallDisc G) + (hcuff : ∀ C ∈ cuffs S, (G.V ∩ C).ncard ≤ r) : + ∃ e ∈ G.E, (tilde e).ncard = 2 ∧ Disjoint (closure e) (bd S) ∧ ¬ e ⊆ allCuffsInsideSet G r := by + classical + have ht2 : T2Space S := hS.2.1 + by_cases hne : (cuffs S).Nonempty + · obtain ⟨C, hC⟩ := hne + obtain ⟨f, hf, ρ, hρ, ρ', hρ', hin, hout, hfρ, hfρ'⟩ := exists_frontier_edge hS habc hm hG hr + hcuff hC + obtain ⟨h1, h2, h3⟩ := frontier_edge_good hS habc hm hG hr hr1 hred hC hcuff hf hρ hρ' hin hout + hfρ hfρ' + refine ⟨f, hf, h3, h2, fun hsub => ?_⟩ + obtain ⟨z, hz⟩ := hf.2.2.1.nonempty + obtain ⟨C', ⟨hC', -⟩, hzC⟩ := mem_iUnion₂.mp (hsub hz) + exact h1 z hz C' hC' hzC + · have hcuffs : cuffs S = ∅ := not_nonempty_iff_eq_empty.mp hne + have hb : bd S = ∅ := by + rw [← sUnion_cuffs, hcuffs, sUnion_empty] + have hall : allCuffsInsideSet G r = ∅ := by + simp [allCuffsInsideSet, hcuffs] + have hns := not_isSphere_of_model hm (by omega) + obtain ⟨X, hX⟩ := exists_candidate_of_alpha_pos (G := G) (by omega) + have hE : G.E.Nonempty := by + by_contra hn + have := alpha_eq_zero_of_no_edges hS hns hb (not_nonempty_iff_eq_empty.mp hn) hX + omega + obtain ⟨f, hf⟩ := hE + have hd : Disjoint (closure f) (bd S) := by rw [hb]; exact disjoint_empty _ + refine ⟨f, hf, ?_, hd, ?_⟩ + · rw [GraphMinor.GM19.tilde_eq_inter_V G hf] + rcases G.edge_cond f hf with ⟨u, v, huv, hcap, -⟩ | ⟨v, hcap, hO⟩ + · rw [hcap] + exact ncard_pair huv + · exfalso + obtain ⟨K, h1, h2, h3, h4, h5, -⟩ := exists_loop_sides hS hm hns hf hcap hO hd hred + have hcount : (K ∩ G.V).ncard ≤ 1 := by + have : K ∩ G.V ⊆ {v} := fun x hx => h4 ⟨hx.2, hx.1⟩ + simpa using ncard_le_ncard this + have := alpha_le_of_candidate (G := G) ⟨h1, h2, h3, fun hn => by + rcases hn with hp | ⟨C, hC, -⟩ + · exact h5 hp + · exact hne ⟨C, hC⟩⟩ + omega + · rw [hall] + intro hs + obtain ⟨z, hz⟩ := hf.2.2.1.nonempty + exact hs hz + +end Reduced + +/-- What (7.3) asks of an edge, without the cut. -/ +def IsGoodCutEdge (G : Drawing S) (r : ℕ) (e : Set S) : Prop := + e ∈ G.E ∧ (tilde e).ncard = 2 ∧ Disjoint (closure e) (bd S) ∧ ¬ e ⊆ allCuffsInsideSet G r ∧ + ¬ ∃ F : Set S, G.IsNormal F ∧ IsNullHomotopicOArc F ∧ (G.V ∩ F).ncard ≤ 1 ∧ IsInsideOArc e F + +/-- `G` with the inside of `Δ` removed. -/ +noncomputable def pruneDisc (G : Drawing S) (Δ : Set S) : Drawing S := + G.span (G.V \ discInt Δ) {e | Disjoint e (discInt Δ)} + +theorem pruneDisc_V_subset (G : Drawing S) (Δ : Set S) : (pruneDisc G Δ).V ⊆ G.V + := G.spanV_subset _ _ + +theorem pruneDisc_U_subset (G : Drawing S) (Δ : Set S) : (pruneDisc G Δ).U ⊆ G.U := by + refine union_subset ((pruneDisc_V_subset G Δ).trans G.V_subset_U) ?_ + exact iUnion₂_subset fun e he => G.closure_subset_U he.2 + +theorem pruneDisc_inter_V (G : Drawing S) (Δ : Set S) {x : S} (hx : x ∈ (pruneDisc G Δ).U) + (hV : x ∈ G.V) : x ∈ (pruneDisc G Δ).V := by + rcases hx with hx | hx + · exact hx + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact .inr (mem_iUnion₂.mpr ⟨e, he, hxe, hV⟩) + +theorem pruneDisc_U_of_off (hman : ∀ x : S, IsManifoldPoint x) [T2Space S] {G : Drawing S} {Δ : Set + S} (hΔ : IsClosedDisc Δ) + (hF : G.IsNormal (discBd Δ)) : G.U \ discInt Δ ⊆ (pruneDisc G Δ).U := by + rintro x ⟨hxU, hxi⟩ + rw [G.U_eq] at hxU + rcases hxU with hV | hx + · exact .inl (.inl ⟨⟨hV, hxi⟩, hV⟩) + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + have hoff : Disjoint e (discBd Δ) := by + rw [disjoint_left] + exact fun z hz hb => (he.2.1 hz).2 (hF ⟨hb, (he.2.1 hz).1⟩) + rcases hΔ.side hman he.2.2.1.isConnected.isPreconnected hoff with hin | hdj + · have hxD : x ∈ Δ := closure_minimal (hin.trans (discInt_subset Δ)) hΔ.isCompact.isClosed hxe + have hxb : x ∈ discBd Δ := by + by_contra hn + exact hxi ⟨hxD, hn⟩ + have hV : x ∈ G.V := hF ⟨hxb, G.closure_subset_U he hxe⟩ + exact .inl (.inl ⟨⟨hV, hxi⟩, hV⟩) + · refine .inr (mem_iUnion₂.mpr ⟨e, ⟨?_, he⟩, hxe⟩) + exact hdj.mono_right (discInt_subset Δ) + +section Induction + +variable (hS : IsSurface S) [ConnectedSpace S] {a b c : ℕ} (habc : 3 ≤ 3 * a + 3 * b + c) + (hm : Nonempty (S ≃ₜ SurfaceModel a b c)) + +include hS habc hm + +/-- (7.3) without the cut, by induction on the number of edges. -/ +theorem exists_good_edge {r : ℕ} (hr1 : 1 ≤ r) : ∀ (n : ℕ) (G : Drawing S), G.E.ncard = n + → G.IsProper → + 9 * (r + 1) ≤ 2 * alpha G → (∀ C ∈ cuffs S, (G.V ∩ C).ncard ≤ r) → ∃ e, IsGoodCutEdge G r e + := by + classical + have ht2 : T2Space S := hS.2.1 + have hman := hS.2.2 + have hns := not_isSphere_of_model hm (by omega) + intro n + induction n using Nat.strong_induction_on with + | _ n ih => + intro G hn hG hr hcuff + by_cases hred : NoEdgeInSmallDisc G + · obtain ⟨e, he, h1, h2, h3⟩ := exists_good_edge_reduced hS habc hm hG hr hr1 hred hcuff + exact ⟨e, he, h1, h2, h3, fun ⟨F, h4, h5, h6, h7⟩ => hred ⟨F, e, h4, h5, h6, he, h7⟩⟩ + -- A small disc holds an edge: remove the inside of the disc. + obtain ⟨F, e, hFn, hnull, hcount, he, hins⟩ := not_not.mp hred + obtain ⟨z, hz⟩ := he.2.2.1.nonempty + have hO : IsOArc F := by + obtain ⟨φ, -⟩ := hnull + exact ⟨φ⟩ + obtain ⟨Δ, hΔ, hbd, hzΔ⟩ : ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = F ∧ z ∈ Δ := by + rcases hins z hz with ⟨-, Δ, hΔ, hbd, hzΔ⟩ | ⟨C, -, -, hsur, -⟩ + · exact ⟨Δ, hΔ, hbd, hzΔ.1⟩ + · exact absurd ((isPlanar_iff_isNullHomotopicOArc_of_isOArc hS hO).mpr hnull) hsur.2.2 + subst hbd + have hoff : Disjoint e (discBd Δ) := by + rw [disjoint_left] + exact fun w hw hb => (he.2.1 hw).2 (hFn ⟨hb, (he.2.1 hw).1⟩) + have heI : e ⊆ discInt Δ := (hΔ.side hman he.2.2.1.isConnected.isPreconnected hoff).resolve_right + fun h => + disjoint_left.mp h hz hzΔ + set G' := pruneDisc G Δ with hG' + have hVs := pruneDisc_V_subset G Δ + have hUs := pruneDisc_U_subset G Δ + have hnormal : ∀ {X : Set S}, G.IsNormal X → G'.IsNormal X := fun {X} hX x hx => + pruneDisc_inter_V G Δ hx.2 (hX ⟨hx.1, hUs hx.2⟩) + have hcardle : ∀ X : Set S, (G'.V ∩ X).ncard ≤ (G.V ∩ X).ncard := fun X => + ncard_le_ncard (inter_subset_inter_left _ hVs) (G.finite_V.subset inter_subset_left) + have hG'p : G'.IsProper := hnormal hG + have hEs : G'.E = {e | Disjoint e (discInt Δ)} ∩ G.E := G.span_E _ _ + have hlt : G'.E.ncard < n := by + rw [← hn] + refine ncard_lt_ncard ?_ G.finite_edges + refine ⟨fun f hf => (hEs ▸ hf : f ∈ _ ∩ G.E).2, fun hsub => ?_⟩ + have h1 : e ∈ G'.E := hsub he + rw [hEs] at h1 + exact disjoint_left.mp h1.1 hz (heI hz) + have hαpos : 0 < alpha G := by omega + have hαle : alpha G ≤ alpha G' := by + obtain ⟨X₀, hX₀⟩ := exists_candidate_of_alpha_pos hαpos + have hne : {n : ℕ | ∃ X : Set S, IsAlphaCandidate G' X ∧ (X ∩ G'.V).ncard = n}.Nonempty := + ⟨_, X₀, ⟨hX₀.1, hX₀.2.1, hnormal hX₀.2.2.1, hX₀.2.2.2⟩, rfl⟩ + obtain ⟨X', hX', hcard⟩ := Nat.sInf_mem hne + have hone : (G.V ∩ discBd Δ).Subsingleton := fun x hx y hy => + (ncard_le_one (G.finite_V.subset inter_subset_left)).mp hcount x hx y hy + obtain ⟨X, hX, hXs⟩ := exists_candidate_of_prune hS hns hΔ hFn hone + (pruneDisc_U_of_off hman hΔ hFn) hVs hX' + calc alpha G ≤ (X ∩ G.V).ncard := alpha_le_of_candidate hX + _ ≤ (X' ∩ G'.V).ncard := ncard_le_ncard hXs (G'.finite_V.subset inter_subset_right) + _ = alpha G' := hcard + obtain ⟨e', he', h1, h2, h3, h4⟩ := ih _ hlt G' rfl hG'p (by omega) fun C hC => (hcardle C).trans + (hcuff C hC) + have hscript : ∀ {C X : Set S}, IsScriptASet G r C X → IsScriptASet G' r C X := fun hX => + ⟨hX.1, hX.2.1, hnormal hX.2.2.1, hX.2.2.2.1, (hcardle _).trans hX.2.2.2.2⟩ + refine ⟨e', (hEs ▸ he' : e' ∈ _ ∩ G.E).2, h1, h2, fun hsub => h3 (hsub.trans ?_), ?_⟩ + · intro x hx + obtain ⟨C, ⟨hC, y, X₁, hX₁, hy⟩, Y, ⟨X, hX, hY⟩, hxY⟩ := mem_iUnion₂.mp hx + exact mem_iUnion₂.mpr ⟨C, ⟨hC, y, X₁, hscript hX₁, hy⟩, Y, ⟨X, hscript hX, hY⟩, hxY⟩ + · rintro ⟨F', h5, h6, h7, h8⟩ + exact h4 ⟨F', hnormal h5, h6, (hcardle _).trans h7, h8⟩ + +end Induction + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/GrowForest.lean b/LeanPool/GraphMinor/GM07/GrowForest.lean new file mode 100644 index 0000000000..a52db2069d --- /dev/null +++ b/LeanPool/GraphMinor/GM07/GrowForest.lean @@ -0,0 +1,468 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.FiniteCross +public import LeanPool.GraphMinor.GM11.Ties + +/-! +# Growing a forest one line at a time + +To prove Graph Minors VII, (3.5) (page 221), we build a forest with given points on `bd(Σ)`, inside +given discs. We start from one point +in each disc. For each other point `y`, we take a line from `y` to the start point of its disc, and +stop at the first point where it hits +what we have built. This file records this process. A state is a finite set `V` of vertices and a +finite set `𝓛` of lines between them (`IsGrown`). The union contains no `O`-arc, because a line +added at one point cannot be part of an `O`-arc. So the drawing we get at the end is a forest +(`exists_grown_forest`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] + +/-- The point set of a state. -/ +def grownU (V : Set S) (𝓛 : Set (Set S)) : Set S := V ∪ ⋃₀ 𝓛 + +/-- Two vertices are joined by a line of the state. -/ +def GrownAdj (V : Set S) (𝓛 : Set (Set S)) (u v : S) : Prop := ∃ A ∈ 𝓛, A ∩ V = {u, v} + +/-- A state of the process. Here `E` is the set of points allowed outside `Q`, the set `Z` must be +met in a finite set, and each line lies in a set of `𝒟`. -/ +structure IsGrown (E Q Z : Set S) (𝒟 : Set (Set S)) (V : Set S) (𝓛 : Set (Set S)) : Prop where + finV : V.Finite + finL : 𝓛.Finite + subV : V ⊆ E ∪ Q + line : ∀ A ∈ 𝓛, ∃ a b, IsLineWithEnds A a b ∧ a ≠ b ∧ A ∩ V = {a, b} + meet : ∀ A ∈ 𝓛, ∀ A' ∈ 𝓛, A ≠ A' → A ∩ A' ⊆ V + subL : ∀ A ∈ 𝓛, A ⊆ E ∪ Q + disc : ∀ A ∈ 𝓛, ∃ D ∈ 𝒟, A ⊆ D + finZ : (grownU V 𝓛 ∩ Z).Finite + noO : ∀ F, IsOArc F → F ⊆ grownU V 𝓛 → False + +theorem IsGrown.isClosed_U [T2Space S] {E Q Z : Set S} {𝒟 : Set (Set S)} {V : Set S} {𝓛 : Set + (Set S)} (h : IsGrown E Q Z 𝒟 V 𝓛) : + IsClosed (grownU V 𝓛) := by + refine h.finV.isClosed.union (h.finL.isClosed_sUnion fun A hA => ?_) + obtain ⟨a, b, h1, -⟩ := h.line A hA + exact h1.isCompact.isClosed + +variable [T2Space S] + +omit [TopologicalSpace S] [T2Space S] in +theorem reach_mono {r r' : S → S → Prop} (h : ∀ u v, r u v → Relation.ReflTransGen r' u v) {u v : + S} (hr : Relation.ReflTransGen r u v) : + Relation.ReflTransGen r' u v := by + induction hr with + | refl => exact .refl + | tail _ h2 ih => exact ih.trans (h _ _ h2) + +/-- Making a point of a state into a vertex. -/ +theorem IsGrown.subdivide {E Q Z : Set S} {𝒟 : Set (Set S)} {V : Set S} {𝓛 : Set (Set S)} + (h : IsGrown E Q Z 𝒟 V 𝓛) {p : S} (hp : p ∈ grownU V 𝓛) + (hpE : p ∈ E ∪ Q) : ∃ V' 𝓛', IsGrown E Q Z 𝒟 V' 𝓛' ∧ p ∈ V' ∧ V ⊆ V' ∧ grownU V' 𝓛' + = grownU V 𝓛 ∧ + (∀ u v, GrownAdj V 𝓛 u v → Relation.ReflTransGen (GrownAdj V' 𝓛') u v) ∧ (∀ x ∈ V', x ∈ V + ∨ ∃ u ∈ V, Relation.ReflTransGen (GrownAdj V' 𝓛') x u) := by + classical + by_cases hpV : p ∈ V + · exact ⟨V, 𝓛, h, hpV, subset_rfl, rfl, fun u v huv => .single huv, fun x hx => .inl hx⟩ + obtain ⟨A, hA, hpA⟩ : ∃ A ∈ 𝓛, p ∈ A := by + rcases hp with hp | ⟨A, hA, hpA⟩ + · exact (hpV hp).elim + · exact ⟨A, hA, hpA⟩ + obtain ⟨a, b, hl, hab, hcap⟩ := h.line A hA + have haV : a ∈ V := (hcap ▸ (Or.inl rfl) : a ∈ A ∩ V).2 + have hbV : b ∈ V := (hcap ▸ (Or.inr rfl) : b ∈ A ∩ V).2 + obtain ⟨A₁, A₂, h₁, h₂, hU, hI⟩ := hl.split hpA (fun e => hpV (e ▸ haV)) (fun e => hpV (e ▸ hbV)) + have hsub₁ : A₁ ⊆ A := hU ▸ subset_union_left + have hsub₂ : A₂ ⊆ A := hU ▸ subset_union_right + have hoff : ∀ A' ∈ 𝓛, A' ≠ A → p ∉ A' := fun A' hA' hne hp' => hpV (h.meet A hA A' hA' hne.symm + ⟨hpA, hp'⟩) + have hcap' : ∀ A' ∈ 𝓛, A' ≠ A → A' ∩ insert p V = A' ∩ V := fun A' hA' hne => by + rw [inter_insert_of_notMem (hoff A' hA' hne)] + have hb₁ : b ∉ A₁ := fun h3 => hpV (by + have : b ∈ A₁ ∩ A₂ := ⟨h3, h₂.right_mem⟩ + rw [hI] at this + exact (mem_singleton_iff.mp this) ▸ hbV) + have ha₂ : a ∉ A₂ := fun h3 => hpV (by + have : a ∈ A₁ ∩ A₂ := ⟨h₁.left_mem, h3⟩ + rw [hI] at this + exact (mem_singleton_iff.mp this) ▸ haV) + have hc₁ : A₁ ∩ insert p V = {a, p} := by + ext z + constructor + · rintro ⟨h3, rfl | h4⟩ + · exact .inr rfl + · have : z ∈ A ∩ V := ⟨hsub₁ h3, h4⟩ + rw [hcap] at this + rcases this with rfl | h5 + · exact .inl rfl + · exact (hb₁ (mem_singleton_iff.mp h5 ▸ h3)).elim + · rintro (rfl | rfl) + · exact ⟨h₁.left_mem, .inr haV⟩ + · exact ⟨h₁.right_mem, .inl rfl⟩ + have hc₂ : A₂ ∩ insert p V = {p, b} := by + ext z + constructor + · rintro ⟨h3, rfl | h4⟩ + · exact .inl rfl + · have : z ∈ A ∩ V := ⟨hsub₂ h3, h4⟩ + rw [hcap] at this + rcases this with rfl | h5 + · exact (ha₂ h3).elim + · exact .inr h5 + · rintro (rfl | rfl) + · exact ⟨h₂.left_mem, .inl rfl⟩ + · exact ⟨h₂.right_mem, .inr hbV⟩ + have hne₁ : a ≠ p := fun e => hpV (e ▸ haV) + have hne₂ : p ≠ b := fun e => hpV (e ▸ hbV) + have hL' : ∀ B ∈ insert A₁ (insert A₂ (𝓛 \ {A})), B = A₁ ∨ B = A₂ ∨ (B ∈ 𝓛 ∧ B ≠ A) := fun B hB + => by + rcases hB with rfl | rfl | ⟨h3, h4⟩ + · exact .inl rfl + · exact .inr (.inl rfl) + · exact .inr (.inr ⟨h3, h4⟩) + have hAU : grownU (insert p V) (insert A₁ (insert A₂ (𝓛 \ {A}))) = grownU V 𝓛 := by + ext z + constructor + · rintro ((rfl | hz) | ⟨B, hB, hz⟩) + · exact hp + · exact .inl hz + · rcases hL' B hB with rfl | rfl | ⟨h3, -⟩ + · exact .inr ⟨A, hA, hsub₁ hz⟩ + · exact .inr ⟨A, hA, hsub₂ hz⟩ + · exact .inr ⟨B, h3, hz⟩ + · rintro (hz | ⟨B, hB, hz⟩) + · exact .inl (.inr hz) + · by_cases hBA : B = A + · subst hBA + have : z ∈ A₁ ∪ A₂ := hU ▸ hz + rcases this with h3 | h3 + · exact .inr ⟨A₁, .inl rfl, h3⟩ + · exact .inr ⟨A₂, .inr (.inl rfl), h3⟩ + · exact .inr ⟨B, .inr (.inr ⟨hB, hBA⟩), hz⟩ + have hadj₁ : GrownAdj (insert p V) (insert A₁ (insert A₂ (𝓛 \ {A}))) a p := ⟨A₁, .inl rfl, hc₁⟩ + have hadj₁' : GrownAdj (insert p V) (insert A₁ (insert A₂ (𝓛 \ {A}))) p a + := ⟨A₁, .inl rfl, by rw [hc₁, pair_comm]⟩ + have hadj₂ : GrownAdj (insert p V) (insert A₁ (insert A₂ (𝓛 \ {A}))) p b := ⟨A₂, .inr + (.inl rfl), hc₂⟩ + have hadj₂' : GrownAdj (insert p V) (insert A₁ (insert A₂ (𝓛 \ {A}))) b p := ⟨A₂, .inr + (.inl rfl), by rw [hc₂, pair_comm]⟩ + refine ⟨insert p V, insert A₁ (insert A₂ (𝓛 \ {A})), ⟨h.finV.insert p, + ((h.finL.subset sdiff_subset).insert _).insert _, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩, + .inl rfl, subset_insert _ _, hAU, ?_, ?_⟩ + · rintro z (rfl | hz) + · exact hpE + · exact h.subV hz + · intro B hB + rcases hL' B hB with rfl | rfl | ⟨h3, h4⟩ + · exact ⟨a, p, h₁, hne₁, hc₁⟩ + · exact ⟨p, b, h₂, hne₂, hc₂⟩ + · obtain ⟨u, v, h5, h6, h7⟩ := h.line B h3 + exact ⟨u, v, h5, h6, by rw [hcap' B h3 h4, h7]⟩ + · have hAll : ∀ B ∈ insert A₁ (insert A₂ (𝓛 \ {A})), ∀ B' ∈ insert A₁ (insert A₂ + (𝓛 \ {A})), B ≠ A₁ → B' = A₁ ∨ B' = A₂ → B ≠ A₂ → B ∩ B' ⊆ insert p V := by + intro B hB B' _ hne1 hB' hne2 + rcases hL' B hB with rfl | rfl | ⟨h3, h4⟩ + · exact (hne1 rfl).elim + · exact (hne2 rfl).elim + · rintro z ⟨h5, h6⟩ + have h7 : z ∈ A := by + rcases hB' with rfl | rfl + · exact hsub₁ h6 + · exact hsub₂ h6 + exact .inr (h.meet B h3 A hA h4 ⟨h5, h7⟩) + intro B hB B' hB' hne + rcases hL' B hB with rfl | rfl | ⟨h3, h4⟩ <;> rcases hL' B' hB' with h5 | h5 | ⟨h6, h7⟩ + · exact (hne h5.symm).elim + · subst h5 + rw [hI] + exact fun z hz => .inl hz + · rw [inter_comm] + exact hAll B' hB' B hB (fun e => (hoff B' h6 h7) (e ▸ h₁.right_mem)) (.inl rfl) (fun e => + (hoff B' h6 h7) (e ▸ h₂.left_mem)) + · subst h5 + rw [inter_comm, hI] + exact fun z hz => .inl hz + · exact (hne h5.symm).elim + · rw [inter_comm] + exact hAll B' hB' B hB (fun e => (hoff B' h6 h7) (e ▸ h₁.right_mem)) (.inr rfl) (fun e => + (hoff B' h6 h7) (e ▸ h₂.left_mem)) + · exact hAll B hB B' hB' (fun e => (hoff B h3 h4) (e ▸ h₁.right_mem)) (.inl h5) (fun e => + (hoff B h3 h4) (e ▸ h₂.left_mem)) + · exact hAll B hB B' hB' (fun e => (hoff B h3 h4) (e ▸ h₁.right_mem)) (.inr h5) (fun e => + (hoff B h3 h4) (e ▸ h₂.left_mem)) + · exact (h.meet B h3 B' h6 hne).trans (subset_insert _ _) + · intro B hB + rcases hL' B hB with rfl | rfl | ⟨h3, -⟩ + · exact hsub₁.trans (h.subL A hA) + · exact hsub₂.trans (h.subL A hA) + · exact h.subL B h3 + · intro B hB + rcases hL' B hB with rfl | rfl | ⟨h3, -⟩ + · obtain ⟨D, hD, h4⟩ := h.disc A hA + exact ⟨D, hD, hsub₁.trans h4⟩ + · obtain ⟨D, hD, h4⟩ := h.disc A hA + exact ⟨D, hD, hsub₂.trans h4⟩ + · exact h.disc B h3 + · rw [hAU] + exact h.finZ + · rw [hAU] + exact h.noO + · rintro u v ⟨B, hB, hc⟩ + by_cases hBA : B = A + · subst hBA + rw [hcap] at hc + have huv : (u = a ∧ v = b) ∨ (u = b ∧ v = a) := by + have h3 : u ∈ ({a, b} : Set S) := hc ▸ .inl rfl + have h4 : v ∈ ({a, b} : Set S) := hc ▸ .inr rfl + have h5 : a ∈ ({u, v} : Set S) := hc ▸ .inl rfl + have h6 : b ∈ ({u, v} : Set S) := hc ▸ .inr rfl + simp only [mem_insert_iff, mem_singleton_iff] at h3 h4 h5 h6 + rcases h3 with rfl | rfl <;> rcases h4 with rfl | rfl <;> simp_all + rcases huv with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact (Relation.ReflTransGen.single hadj₁).tail hadj₂ + · exact (Relation.ReflTransGen.single hadj₂').tail hadj₁' + · exact .single ⟨B, .inr (.inr ⟨hB, hBA⟩), by rw [hcap' B hB hBA, hc]⟩ + · rintro x (rfl | hx) + · exact .inr ⟨a, haV, .single hadj₁'⟩ + · exact .inl hx + +/-- Adding a line at one point of a state. -/ +theorem IsGrown.pendant {E Q Z : Set S} {𝒟 : Set (Set S)} {V : Set S} {𝓛 : Set (Set S)} + (h : IsGrown E Q Z 𝒟 V 𝓛) {y p : S} {P D : Set S} (hl : IsLineWithEnds P y p) + (hy : y ∉ grownU V 𝓛) (hpV : p ∈ V) (hcap : P ∩ grownU V 𝓛 = {p}) (hPE : P ⊆ insert y E ∪ Q) + (hD : D ∈ 𝒟) (hPD : P ⊆ D) (hPZ : (P ∩ Z).Finite) : + IsGrown (insert y E) Q Z 𝒟 (insert y V) (insert P 𝓛) ∧ + (∀ u v, GrownAdj V 𝓛 u v → GrownAdj (insert y V) (insert P 𝓛) u v) ∧ GrownAdj (insert y V) + (insert P 𝓛) y p := by + have hyV : y ∉ V := fun e => hy (.inl e) + have hyL : ∀ A ∈ 𝓛, y ∉ A := fun A hA e => hy (.inr ⟨A, hA, e⟩) + have hyp : y ≠ p := fun e => hyV (e ▸ hpV) + have hcapA : ∀ A ∈ 𝓛, A ∩ insert y V = A ∩ V := fun A hA => by rw [inter_insert_of_notMem + (hyL A hA)] + have hcapP : P ∩ insert y V = {y, p} := by + ext z + constructor + · rintro ⟨h3, rfl | h4⟩ + · exact .inl rfl + · have : z ∈ P ∩ grownU V 𝓛 := ⟨h3, .inl h4⟩ + rw [hcap] at this + exact .inr this + · rintro (rfl | rfl) + · exact ⟨hl.left_mem, .inl rfl⟩ + · exact ⟨hl.right_mem, .inr hpV⟩ + have hPA : ∀ A ∈ 𝓛, P ∩ A ⊆ {p} := fun A hA z hz => by + have : z ∈ P ∩ grownU V 𝓛 := ⟨hz.1, .inr ⟨A, hA, hz.2⟩⟩ + rwa [hcap] at this + have hE : E ∪ Q ⊆ insert y E ∪ Q := union_subset_union_left _ (subset_insert _ _) + have hUeq : grownU (insert y V) (insert P 𝓛) = grownU V 𝓛 ∪ P := by + ext z + constructor + · rintro ((rfl | hz) | ⟨B, rfl | hB, hz⟩) + · exact .inr hl.left_mem + · exact .inl (.inl hz) + · exact .inr hz + · exact .inl (.inr ⟨B, hB, hz⟩) + · rintro ((hz | ⟨B, hB, hz⟩) | hz) + · exact .inl (.inr hz) + · exact .inr ⟨B, .inr hB, hz⟩ + · exact .inr ⟨P, .inl rfl, hz⟩ + refine ⟨⟨h.finV.insert y, h.finL.insert P, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩, fun u v ⟨A, hA, + hc⟩ => ⟨A, .inr hA, by rw [hcapA A hA, hc]⟩, ⟨P, .inl rfl, hcapP⟩⟩ + · rintro z (rfl | hz) + · exact .inl (.inl rfl) + · exact hE (h.subV hz) + · rintro A (rfl | hA) + · exact ⟨y, p, hl, hyp, hcapP⟩ + · obtain ⟨a, b, h1, h2, h3⟩ := h.line A hA + exact ⟨a, b, h1, h2, by rw [hcapA A hA, h3]⟩ + · rintro A (rfl | hA) A' (rfl | hA') hne + · exact (hne rfl).elim + · exact (hPA A' hA').trans (fun z hz => .inr (mem_singleton_iff.mp hz ▸ hpV)) + · rw [inter_comm] + exact (hPA A hA).trans (fun z hz => .inr (mem_singleton_iff.mp hz ▸ hpV)) + · exact (h.meet A hA A' hA' hne).trans (subset_insert _ _) + · rintro A (rfl | hA) + · exact hPE + · exact (h.subL A hA).trans hE + · rintro A (rfl | hA) + · exact ⟨D, hD, hPD⟩ + · exact h.disc A hA + · rw [hUeq, union_inter_distrib_right] + exact h.finZ.union hPZ + · intro F hF hsub + rw [hUeq] at hsub + have hi : grownU V 𝓛 ∩ P ⊆ {p} := by + rw [inter_comm, hcap] + rcases GM11.IsOArc.subset_or_subset hF h.isClosed_U hl.isCompact.isClosed hsub hi with h1 | h1 + · exact h.noO F hF h1 + · exact not_isOArc_of_subset_line (IsLineWithEnds.isLine hl) hF h1 + +/-- A line from outside a closed set to a point of it has a first point in the set. -/ +theorem exists_first_hit {P U : Set S} {y r : S} (hl : IsLineWithEnds P y r) (hU : IsClosed U) + (hr : r ∈ U) (hy : y ∉ U) : + ∃ p P', p ∈ U ∧ IsLineWithEnds P' y p ∧ P' ⊆ P ∧ P' ∩ U = {p} := by + obtain ⟨a, ha, rfl, rfl, rfl⟩ := hl.exists_arc + have hcl : IsClosed (a ⁻¹' U) := hU.preimage ha.1 + obtain ⟨τ, hτ, hle⟩ := hcl.isCompact.exists_isLeast ⟨1, hr⟩ + have hτ0 : 0 < τ := unitInterval.pos_iff_ne_zero.mpr fun e => hy (e ▸ hτ) + have hcap : a '' Iic τ ∩ U = {a τ} := by + ext z + constructor + · rintro ⟨⟨t, ht, rfl⟩, h2⟩ + rw [(le_antisymm ht (hle h2) : t = τ)] + rfl + · rintro rfl + exact ⟨⟨τ, le_rfl, rfl⟩, hτ⟩ + by_cases hτ1 : τ < 1 + · exact ⟨a τ, a '' Iic τ, hτ, (split_at ha hτ0 hτ1).1, image_mono (subset_univ _) |>.trans + (by rw [image_univ]), hcap⟩ + · have h1 : τ = 1 := le_antisymm unitInterval.le_one' (not_lt.mp hτ1) + subst h1 + refine ⟨a 1, a '' Iic 1, hτ, ?_, ?_, hcap⟩ + · have : a '' Iic 1 = range a := by + rw [← image_univ] + congr 1 + ext t + simp [unitInterval.le_one'] + rw [this] + exact ha.isLineWithEnds + · rintro _ ⟨t, -, rfl⟩ + exact ⟨t, rfl⟩ + +/-- **The forest grows.** Let `R` be a finite set of start points, and suppose that each other point +`y` of a finite set `Y` has a line `P y` to a +point of `R`, inside `Q` apart from its ends and inside a set of `𝒟`, which meets `Z` in a finite +set. Then there is a state with vertices `Y` and +some points of `Q`, in which each vertex is joined to a point of `R`. -/ +theorem exists_grown {Y R Q Z : Set S} {𝒟 : Set (Set S)} (hRf : R.Finite) (hYf : Y.Finite) + (hRY : R ⊆ Y) (hYQ : Disjoint Y Q) + (hP : ∀ y ∈ Y, y ∉ R → ∃ r ∈ R, ∃ P, ∃ D ∈ 𝒟, IsLineWithEnds P y r ∧ P ⊆ D ∧ P \ {y, r} ⊆ Q ∧ + (P ∩ Z).Finite) : + ∃ V 𝓛, IsGrown Y Q Z 𝒟 V 𝓛 ∧ Y ⊆ V ∧ ∀ x ∈ V, ∃ r ∈ R, Relation.ReflTransGen (GrownAdj V 𝓛) x r + := by + classical + have key : ∀ I : Finset S, ↑I ⊆ Y \ R → ∃ V 𝓛, IsGrown (R ∪ ↑I) Q Z 𝒟 V 𝓛 ∧ R ∪ ↑I ⊆ V + ∧ ∀ x ∈ V, ∃ r ∈ R, Relation.ReflTransGen (GrownAdj V 𝓛) x r := by + intro I + induction I using Finset.induction_on with + | empty => + intro _ + have h0 : IsGrown R Q Z 𝒟 R ∅ := by + refine ⟨hRf, finite_empty, subset_union_left, by simp, by simp, by simp, by simp, ?_, ?_⟩ + · refine hRf.subset ?_ + rintro z ⟨h1 | ⟨A, hA, -⟩, -⟩ + · exact h1 + · exact hA.elim + · intro F hF hsub + have : F ⊆ R := by + intro z hz + rcases hsub hz with h1 | ⟨A, hA, -⟩ + · exact h1 + · exact hA.elim + exact infinite_of_isOArc hF (hRf.subset this) + exact ⟨R, ∅, by simpa using h0, by simp, fun x hx => ⟨x, hx, .refl⟩⟩ + | insert y I hyI ih => + intro hsub + have hsub' : (↑I : Set S) ⊆ Y \ R := fun z hz => hsub (Finset.mem_insert_of_mem hz) + have hyY : y ∈ Y \ R := hsub (Finset.mem_insert_self _ _) + obtain ⟨V, 𝓛, hG, hV, hR⟩ := ih hsub' + obtain ⟨r, hr, P, D, hD, hl, hPD, hPQ, hPZ⟩ := hP y hyY.1 hyY.2 + have hrV : r ∈ V := hV (.inl hr) + have hyQ : y ∉ Q := disjoint_left.mp hYQ hyY.1 + have hyU : y ∉ grownU V 𝓛 := by + rintro (h1 | ⟨A, hA, h1⟩) + · rcases h1' : hG.subV h1 with h2 | h2 + · rcases h2 with h2 | h2 + · exact hyY.2 h2 + · exact hyI h2 + · exact hyQ h2 + · rcases hG.subL A hA h1 with h2 | h2 + · rcases h2 with h2 | h2 + · exact hyY.2 h2 + · exact hyI h2 + · exact hyQ h2 + obtain ⟨p, P', hpU, hl', hsubP, hcap⟩ := exists_first_hit hl hG.isClosed_U (.inl hrV) hyU + have hpE : p ∈ (R ∪ ↑I) ∪ Q := by + have hpP : p ∈ P := hsubP hl'.right_mem + by_cases h1 : p ∈ ({y, r} : Set S) + · rcases h1 with rfl | rfl + · exact (hyU hpU).elim + · exact .inl (.inl hr) + · exact .inr (hPQ ⟨hpP, h1⟩) + obtain ⟨V₁, 𝓛₁, hG₁, hpV₁, hVV₁, hU₁, hadj₁, hnew₁⟩ := hG.subdivide hpU hpE + have hyU₁ : y ∉ grownU V₁ 𝓛₁ := hU₁ ▸ hyU + have hPE : P' ⊆ insert y (R ∪ ↑I) ∪ Q := fun z hz => by + by_cases h1 : z ∈ ({y, r} : Set S) + · rcases h1 with rfl | rfl + · exact .inl (.inl rfl) + · exact .inl (.inr (.inl hr)) + · exact .inr (hPQ ⟨hsubP hz, h1⟩) + obtain ⟨hG₂, hadj₂, hyp⟩ := hG₁.pendant hl' hyU₁ hpV₁ (hU₁ ▸ hcap) hPE hD (hsubP.trans hPD) + (hPZ.subset (inter_subset_inter_left _ hsubP)) + have hmono₁ : ∀ {u v}, Relation.ReflTransGen (GrownAdj V 𝓛) u v → Relation.ReflTransGen + (GrownAdj V₁ 𝓛₁) u v := reach_mono hadj₁ + have hmono₂ : ∀ {u v}, Relation.ReflTransGen (GrownAdj V₁ 𝓛₁) u v → Relation.ReflTransGen + (GrownAdj (insert y V₁) (insert P' 𝓛₁)) u v := + reach_mono fun u v h => .single (hadj₂ u v h) + have hreach₁ : ∀ x ∈ V₁, ∃ r ∈ R, Relation.ReflTransGen (GrownAdj V₁ 𝓛₁) x r := fun x hx => by + rcases hnew₁ x hx with h1 | ⟨u, hu, h1⟩ + · obtain ⟨r', hr', h2⟩ := hR x h1 + exact ⟨r', hr', hmono₁ h2⟩ + · obtain ⟨r', hr', h2⟩ := hR u hu + exact ⟨r', hr', h1.trans (hmono₁ h2)⟩ + refine ⟨insert y V₁, insert P' 𝓛₁, ?_, ?_, ?_⟩ + · have e : R ∪ ↑(insert y I) = insert y (R ∪ (↑I : Set S)) := by + ext z + simp only [mem_union, Finset.mem_coe, Finset.mem_insert, mem_insert_iff] + tauto + rw [e] + exact hG₂ + · rintro z (hz | hz) + · exact .inr (hVV₁ (hV (.inl hz))) + · rcases Finset.mem_insert.mp hz with rfl | h1 + · exact .inl rfl + · exact .inr (hVV₁ (hV (.inr h1))) + · rintro x (rfl | hx) + · obtain ⟨r', hr', h2⟩ := hreach₁ p hpV₁ + exact ⟨r', hr', (Relation.ReflTransGen.single hyp).trans (hmono₂ h2)⟩ + · obtain ⟨r', hr', h2⟩ := hreach₁ x hx + exact ⟨r', hr', hmono₂ h2⟩ + obtain ⟨V, 𝓛, h1, h2, h3⟩ := key (hYf.subset (sdiff_subset (t := R))).toFinset + (by rw [Finite.coe_toFinset]) + have e : R ∪ ↑(hYf.subset (sdiff_subset (t := R))).toFinset = Y := by + rw [Finite.coe_toFinset] + ext z + constructor + · rintro (h | h) + · exact hRY h + · exact h.1 + · intro h + by_cases h' : z ∈ R + · exact .inl h' + · exact .inr ⟨h, h'⟩ + rw [e] at h1 h2 + exact ⟨V, 𝓛, h1, h2, h3⟩ + +/-- A drawing whose point set contains no `O`-arc is a forest. -/ +theorem isGraphForest_of_noOArc {H : Drawing S} (h : ∀ F, IsOArc F → F ⊆ H.U + → False) : IsGraphForest H.toGraph := by + intro u W hW + by_contra hne + have hC := isCircuit_walkDrawing H hW (Nat.pos_of_ne_zero hne) + exact h _ (IsCircuit.isOArc_U hC) (walkDrawing_isSubdrawing H W).U_subset + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/JoinDiscs.lean b/LeanPool/GraphMinor/GM07/JoinDiscs.lean new file mode 100644 index 0000000000..d5ff96da53 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/JoinDiscs.lean @@ -0,0 +1,610 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.StarDisc + +/-! +# Joining two closed discs that touch in a point + +Two closed discs `A` and `B` of a closed surface that meet in one point `p` of their boundaries lie +in one +closed disc, which adds only a small neighbourhood of `p` (`exists_join`). This is the step that +makes a chain of +discs into one disc in the thickening of a forest in Graph Minors VII, (3.4), claim (1) (page 220). + +We take a star disc `R` around `p` for the drawing made of the two boundaries. Then `bd(A)` is a +chord of `R`, and one +side of it lies in `A`, and the same holds for `B`. The union of `A` with the other side of its +chord is a disc. So +is `B` without the side in `R`, and these two discs meet in an arc of `bd(R)`. So `disc_union` +applies. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] + +private theorem disc_inter_collar_eq_boundary_arc + {S : Type} [TopologicalSpace S] + {A : Set S} + (hsubA : discBd A ⊆ A) + (ℓA : Set S) + (EA : Set S) + (disA : Disjoint (EA \ ℓA) A) + (hℓAE : ℓA ⊆ EA) + (hℓAb : ℓA ⊆ discBd A) : + A ∩ EA = ℓA := by + ext x + constructor + · rintro ⟨h1, h2⟩ + by_contra h3 + exact disjoint_left.mp disA ⟨h2, h3⟩ h1 + · exact fun h => ⟨hsubA (hℓAb h), hℓAE h⟩ + +/-- **Joining two discs at a point.** -/ +theorem exists_join (hS : IsClosedSurface S) {A B : Set S} (hA : IsClosedDisc A) + (hB : IsClosedDisc B) {p : S} + (hAB : A ∩ B = {p}) (hpA : p ∈ discBd A) (hpB : p ∈ discBd B) {W : Set S} (hW : IsOpen W) + (hpW : p ∈ W) : + ∃ D, IsClosedDisc D ∧ A ∪ B ⊆ D ∧ D ⊆ A ∪ B ∪ W ∧ p ∈ discInt D ∧ + (discBd A ∪ discBd B) \ W ⊆ discBd D ∧ + discBd D ⊆ discBd A ∪ discBd B ∪ W := by + classical + have ht2 : T2Space S := hS.2.1 + have hbA := hA.isOArc_discBd + have hbB := hB.isOArc_discBd + have hsubB : discBd B ⊆ B := GM11.discBd_subset B + -- The drawing made of the two boundaries. + obtain ⟨ΓA, hAU, hAV⟩ := exists_loop_drawing hbA hpA + obtain ⟨ΓB, hBU, hBV⟩ := exists_loop_drawing hbB hpB + have hmeet : ΓA.U ∩ ΓB.U ⊆ ΓA.V ∩ ΓB.V := by + rw [hAU, hBU, hAV, hBV] + rintro x ⟨h1, h2⟩ + have : x ∈ A ∩ B := ⟨GM11.discBd_subset A h1, hsubB h2⟩ + rw [hAB] at this + exact ⟨this, this⟩ + let Γ := ΓA.glue ΓB hmeet + have hΓU : Γ.U = discBd A ∪ discBd B := by + change ΓA.U ∪ ΓB.U = _ + rw [hAU, hBU] + have hΓV : p ∈ Γ.V := Or.inl (hAV ▸ rfl) + have hinV : ∀ x, x ∈ discBd A ∩ discBd B → x ∈ Γ.V := fun x hx => Or.inl (by + have : x ∈ A ∩ B := ⟨GM11.discBd_subset A hx.1, hsubB hx.2⟩ + rw [hAB] at this + rw [hAV] + exact this) + have nA : IsGammaNice Γ (discBd A) := + nice_of_cover hbA.isCompact.isClosed hbB.isCompact.isClosed (le_of_eq hΓU) + (hΓU ▸ subset_union_left) hinV + have nB : IsGammaNice Γ (discBd B) := + nice_of_cover hbB.isCompact.isClosed hbA.isCompact.isClosed + (le_of_eq (hΓU.trans (union_comm _ _))) + (hΓU ▸ subset_union_right) fun x hx => hinV x ⟨hx.2, hx.1⟩ + obtain ⟨wA, hwA, hwAp⟩ := hbA.exists_ne p + obtain ⟨wB, hwB, hwBp⟩ := hbB.exists_ne p + have hW' : IsOpen (W \ {wA, wB}) := hW.sdiff (Set.toFinite _).isClosed + have hpW' : p ∈ W \ {wA, wB} := ⟨hpW, by rintro (e | e); exacts [hwAp e.symm, hwBp e.symm]⟩ + obtain ⟨R, hR, hRW⟩ := exists_starDisc hS Γ hΓV hW' hpW' + have hRW₁ : R ⊆ W := hRW.trans sdiff_subset + have hwAR : wA ∉ R := fun h => (hRW h).2 (.inl rfl) + have hwBR : wB ∉ R := fun h => (hRW h).2 (.inr rfl) + obtain ⟨ℓA, s, t, ΔA, EA, cA, cA', lA, hst, eA, dA, dEA, uA, iA, lcA, lcA', ucA, icA, bΔA, bEA, + hbdA, pA, ΔAA, disA⟩ := + exists_disc_sides hS hR hA hpA hwA hwAR nA + obtain ⟨ℓB, s', t', ΔB, EB, cB, cB', lB, hst', eB, dB, dEB, uB, iB, lcB, lcB', ucB, icB, bΔB, + bEB, hbdB, pB, ΔBB, disB⟩ := + exists_disc_sides hS hR hB hpB hwB hwBR nB + have hRc : IsClosed R := hR.disc.isClosed + have hpi : p ∈ discInt R := hR.mem + have hpbd : p ∉ discBd R := hpi.2 + have hbR : discBd R ⊆ R := GM11.discBd_subset R + have hℓAE : ℓA ⊆ EA := fun x hx => ((iA ▸ hx : x ∈ ΔA ∩ EA)).2 + have hℓAb : ℓA ⊆ discBd A := fun x hx => (eA ▸ hx : x ∈ discBd A ∩ R).1 + have hℓBb : ℓB ⊆ discBd B := fun x hx => (eB ▸ hx : x ∈ discBd B ∩ R).1 + have hℓBR : ℓB ⊆ R := fun x hx => (eB ▸ hx : x ∈ discBd B ∩ R).2 + have hbEA : ℓA ⊆ discBd EA := fun x hx => bEA ▸ Or.inr hx + obtain ⟨d1, b1⟩ := disc_union A EA ℓA s t hA dEA lA + (disc_inter_collar_eq_boundary_arc (GM11.discBd_subset A) ℓA EA disA hℓAE hℓAb) hℓAb hbEA + -- The part of `B` in `R`. + have hBR : ∀ x ∈ B, x ∈ R → x ∈ ΔB := fun x h1 h2 => by + by_contra h3 + have h4 : x ∈ ΔB ∪ EB := uB ▸ h2 + rcases h4 with h4 | h4 + · exact h3 h4 + · have h5 : x ∉ ℓB := fun h6 => h3 ((iB ▸ h6 : x ∈ ΔB ∩ EB).1) + exact disjoint_left.mp disB ⟨h4, h5⟩ h1 + have hsubR : ΔB ⊆ R := fun x hx => uB ▸ Or.inl hx + have hcBR : cB ⊆ discBd R := fun x hx => ucB ▸ Or.inl hx + have hbm : discBd ΔB ∩ discBd B = ℓB := by + ext x + constructor + · rintro ⟨h1, h2⟩ + rw [bΔB] at h1 + rcases h1 with h1 | h1 + · rw [eB] + exact ⟨h2, hbR (hcBR h1)⟩ + · exact h1 + · exact fun h => ⟨bΔB ▸ Or.inr h, hℓBb h⟩ + obtain ⟨d2, b2, m2⟩ := disc_difference ΔB B ℓB s' t' dB hB ΔBB lB hbm + set B' : Set S := closure (B \ ΔB) with hB' + have hBc : IsClosed B := hB.isClosed + have hB'B : B' ⊆ B := closure_minimal sdiff_subset hBc + have hends : ∀ x, x ∈ ℓB → x ∈ discBd R → x = s' ∨ x = t' := fun x h1 h2 => by + have : x ∈ ℓB ∩ discBd R := ⟨h1, h2⟩ + rw [hbdB] at this + exact this + have hcBm : discBd ΔB \ (ℓB \ {s', t'}) = cB := by + ext x + constructor + · rintro ⟨h1, h2⟩ + rw [bΔB] at h1 + rcases h1 with h1 | h1 + · exact h1 + · have h3 : x ∈ ({s', t'} : Set S) := by + by_contra h3 + exact h2 ⟨h1, h3⟩ + rcases h3 with rfl | rfl + · exact lcB.left_mem + · exact lcB.right_mem + · intro h + refine ⟨bΔB ▸ Or.inl h, fun h1 => h1.2 ?_⟩ + exact hends x h1.1 (hcBR h) + rw [hcBm] at m2 + have hΔE : ΔB ⊆ EA := fun x hx => by + have h1 : x ∈ ΔA ∪ EA := uA ▸ hsubR hx + rcases h1 with h1 | h1 + · have h2 : x ∈ A ∩ B := ⟨ΔAA h1, ΔBB hx⟩ + rw [hAB] at h2 + exact hℓAE (by rw [mem_singleton_iff.mp h2]; exact pA) + · exact h1 + have hpΔ : p ∈ ΔB := (iB ▸ pB : p ∈ ΔB ∩ EB).1 + have hmid : (A ∪ EA) ∩ B' = cB := by + ext x + constructor + · rintro ⟨h1 | h1, h2⟩ + · have h3 : x ∈ A ∩ B := ⟨h1, hB'B h2⟩ + rw [hAB] at h3 + have h4 : x = p := h3 + rw [h4] at h2 + have h5 : p ∈ cB := m2 ▸ ⟨h2, hpΔ⟩ + exact (hpbd (hcBR h5)).elim + · have h3 : x ∈ R := uA ▸ Or.inr h1 + exact m2 ▸ ⟨h2, hBR x (hB'B h2) h3⟩ + · intro h + have h1 : x ∈ B' ∩ ΔB := m2 ▸ h + exact ⟨.inr (hΔE h1.2), h1.1⟩ + have hcbd : cB ⊆ discBd (A ∪ EA) := fun x hx => by + rw [b1] + have h1 : x ∈ cA ∪ cA' := ucA ▸ hcBR hx + have hxΔ : x ∈ ΔB := (m2 ▸ hx : x ∈ B' ∩ ΔB).2 + have hxp : x ≠ p := fun e => hpbd (e ▸ hcBR hx) + have hxb : x ∈ discBd EA := by + rcases h1 with h1 | h1 + · have h2 : x ∈ ΔA := by + have : x ∈ discBd ΔA := bΔA ▸ Or.inl h1 + exact GM11.discBd_subset _ this + have h3 : x ∈ A ∩ B := ⟨ΔAA h2, ΔBB hxΔ⟩ + rw [hAB] at h3 + exact (hxp h3).elim + · exact bEA ▸ Or.inl h1 + refine ⟨.inr hxb, fun h2 => h2.2 ?_⟩ + have h3 : x ∈ ℓA ∩ discBd R := ⟨h2.1, hcBR hx⟩ + rw [hbdA] at h3 + exact h3 + have hcbd' : cB ⊆ discBd B' := fun x hx => by + rw [b2] + have h1 : x ∈ discBd ΔB := bΔB ▸ Or.inl hx + refine ⟨.inl h1, fun h2 => h2.2 ?_⟩ + exact hends x h2.1 (hcBR hx) + obtain ⟨d3, b3⟩ := disc_union (A ∪ EA) B' cB s' t' d1 d2 lcB hmid hcbd hcbd' + have hne₁ : p ≠ s ∧ p ≠ t := ⟨fun e => hpbd (by + have : s ∈ ℓA ∩ discBd R := by rw [hbdA]; exact .inl rfl + rw [e] + exact this.2), fun e => hpbd (by + have : t ∈ ℓA ∩ discBd R := by rw [hbdA]; exact .inr rfl + rw [e] + exact this.2)⟩ + have hne₂ : p ≠ s' ∧ p ≠ t' := ⟨fun e => hpbd (by + have : s' ∈ ℓB ∩ discBd R := by rw [hbdB]; exact .inl rfl + rw [e] + exact this.2), fun e => hpbd (by + have : t' ∈ ℓB ∩ discBd R := by rw [hbdB]; exact .inr rfl + rw [e] + exact this.2)⟩ + have hEAR : EA ⊆ R := fun x hx => uA ▸ Or.inr hx + have hbEsub : discBd EA ⊆ R := GM11.discBd_subset EA |>.trans hEAR + have hbΔsub : discBd ΔB ⊆ R := (GM11.discBd_subset ΔB).trans hsubR + have hcBnW : ∀ x, x ∉ W → x ∉ cB := fun x hx h => hx (hRW₁ (hbR (hcBR h))) + refine ⟨(A ∪ EA) ∪ B', d3, ?_, ?_, ⟨?_, ?_⟩, ?_, ?_⟩ + · rintro x (h | h) + · exact .inl (.inl h) + · by_cases h1 : x ∈ ΔB + · exact .inl (.inr (hΔE h1)) + · exact .inr (subset_closure ⟨h, h1⟩) + · rintro x ((h | h) | h) + · exact .inl (.inl h) + · exact .inr (hRW₁ (hEAR h)) + · exact .inl (.inr (hB'B h)) + · exact .inl (.inl (GM11.discBd_subset A hpA)) + · rw [b3] + rintro ⟨h1 | h1, -⟩ + · rw [b1] at h1 + exact h1.2 ⟨pA, by rintro (e | e); exacts [hne₁.1 e, hne₁.2 e]⟩ + · rw [b2] at h1 + exact h1.2 ⟨pB, by rintro (e | e); exacts [hne₂.1 e, hne₂.2 e]⟩ + · rintro x ⟨h1 | h1, h2⟩ + · rw [b3, b1] + exact ⟨.inl ⟨.inl h1, fun h3 => h2 (hRW₁ (eA ▸ h3.1 : x ∈ discBd A ∩ R).2)⟩, + fun h3 => hcBnW x h2 h3.1⟩ + · rw [b3, b2] + exact ⟨.inr ⟨.inr h1, fun h3 => h2 (hRW₁ (eB ▸ h3.1 : x ∈ discBd B ∩ R).2)⟩, + fun h3 => hcBnW x h2 h3.1⟩ + · intro x hx + rw [b3] at hx + rcases hx.1 with h1 | h1 + · rw [b1] at h1 + rcases h1.1 with h2 | h2 + · exact .inl (.inl h2) + · exact .inr (hRW₁ (hbEsub h2)) + · rw [b2] at h1 + rcases h1.1 with h2 | h2 + · exact .inr (hRW₁ (hbΔsub h2)) + · exact .inl (.inr h2) + +/-- **Joining two discs along a line.** Two disjoint closed discs and a line between their +boundaries lie in one closed +disc, which adds no point of the closed set `Z`, and keeps the points of `Z` on the two boundaries +on its boundary. -/ +theorem exists_merge (hS : IsClosedSurface S) {D₁ D₂ L Z : Set S} {p q : S} (h₁ : IsClosedDisc D₁) + (h₂ : IsClosedDisc D₂) + (hd : Disjoint D₁ D₂) (hL : IsLineWithEnds L p q) (hp : p ∈ discBd D₁) (hq : q ∈ discBd D₂) + (hLD : L ∩ (D₁ ∪ D₂) ⊆ {p, q}) (hZ : IsClosed Z) (hLZ : Disjoint L Z) : + ∃ D, IsClosedDisc D ∧ D₁ ∪ D₂ ⊆ D ∧ D ⊆ D₁ ∪ D₂ ∪ Zᶜ ∧ L ⊆ discInt D ∧ discInt D₁ ⊆ discInt D + ∧ discInt D₂ ⊆ discInt D ∧ + (discBd D₁ ∪ discBd D₂) ∩ Z ⊆ discBd D ∧ discBd D ⊆ discBd D₁ ∪ discBd D₂ ∪ Zᶜ := by + have ht2 : T2Space S := hS.2.1 + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hpD₁ : p ∈ D₁ := GM11.discBd_subset D₁ hp + have hqD₂ : q ∈ D₂ := GM11.discBd_subset D₂ hq + have hpq : p ≠ q := fun e => disjoint_left.mp hd hpD₁ (e ▸ hqD₂) + have hpZ : p ∉ Z := disjoint_left.mp hLZ hL.left_mem + have hqZ : q ∉ Z := disjoint_left.mp hLZ hL.right_mem + have hc₁ := h₁.isClosed + have hc₂ := h₂.isClosed + have hZ₁ : IsClosed (D₁ ∪ D₂ ∪ Z) := (hc₁.union hc₂).union hZ + have hLZ₁ : L ∩ (D₁ ∪ D₂ ∪ Z) ⊆ {p, q} := by + rintro x ⟨hxL, hx | hx⟩ + · exact hLD ⟨hxL, hx⟩ + · exact (disjoint_left.mp hLZ hxL hx).elim + obtain ⟨E, -, -, hE, hLE, hEZ, hpE, hqE, hbL, -⟩ := exists_edge_lens hS hL hpq hZ₁ hLZ₁ + have hEm : ∀ z ∈ E, z ∈ D₁ ∪ D₂ ∪ Z → z = p ∨ z = q := fun z h1 h2 => hEZ ⟨h1, h2⟩ + have hED₁ : D₁ ∩ E = {p} := by + ext z + constructor + · rintro ⟨h1, h2⟩ + rcases hEm z h2 (.inl (.inl h1)) with e | e + · exact e + · exact (disjoint_left.mp hd h1 (e ▸ hqD₂)).elim + · rintro rfl + exact ⟨hpD₁, hLE hL.left_mem⟩ + have hW₁ : IsOpen (D₂ ∪ Z)ᶜ := (hc₂.union hZ).isOpen_compl + have hpW₁ : p ∈ (D₂ ∪ Z)ᶜ := by + rintro (h | h) + · exact disjoint_left.mp hd hpD₁ h + · exact hpZ h + obtain ⟨D', d', hsub', hsup', hpi', hb', hb''⟩ := exists_join hS h₁ hE hED₁ hp hpE hW₁ hpW₁ + have hqbd : q ∈ discBd D' := hb' ⟨.inr hqE, fun h => h (.inl hqD₂)⟩ + have hD'D₂ : D' ∩ D₂ = {q} := by + ext z + constructor + · rintro ⟨h1, h2⟩ + rcases hsup' h1 with (h3 | h3) | h3 + · exact (disjoint_left.mp hd h3 h2).elim + · rcases hEm z h3 (.inl (.inr h2)) with e | e + · exact (disjoint_left.mp hd hpD₁ (e ▸ h2)).elim + · exact e + · exact (h3 (.inl h2)).elim + · rintro rfl + exact ⟨GM11.discBd_subset D' hqbd, hqD₂⟩ + obtain ⟨D, d, hsub, hsup, hqi, hb, hb₂⟩ := exists_join hS d' h₂ hD'D₂ hqbd hq hZ.isOpen_compl hqZ + have hD'D : D' ⊆ D := subset_union_left.trans hsub + have hEoff : ∀ z ∈ E, z ∈ Z → False := fun z h1 h2 => by + rcases hEm z h1 (.inr h2) with e | e + · exact hpZ (e ▸ h2) + · exact hqZ (e ▸ h2) + refine ⟨D, d, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rintro z (h | h) + · exact hD'D (hsub' (.inl h)) + · exact hsub (.inr h) + · intro z hz + by_cases hzZ : z ∈ Z + · rcases hsup hz with (h1 | h1) | h1 + · rcases hsup' h1 with (h2 | h2) | h2 + · exact .inl (.inl h2) + · exact (hEoff z h2 hzZ).elim + · exact (h2 (.inr hzZ)).elim + · exact .inl (.inr h1) + · exact (h1 hzZ).elim + · exact .inr hzZ + · intro z hz + by_cases h1 : z = p + · rw [h1] + exact discInt_mono hman d' hD'D hpi' + by_cases h2 : z = q + · rw [h2] + exact hqi + have h3 : z ∉ discBd E := fun h => by + rcases hbL ⟨h, hz⟩ with e | e + · exact h1 e + · exact h2 e + exact discInt_mono hman hE (subset_union_right.trans (hsub'.trans hD'D)) ⟨hLE hz, h3⟩ + · exact discInt_mono hman h₁ (subset_union_left.trans (hsub'.trans hD'D)) + · exact discInt_mono hman h₂ (subset_union_right.trans hsub) + · rintro z ⟨h | h, hzZ⟩ + · exact hb ⟨.inl (hb' ⟨.inl h, fun h3 => h3 (.inr hzZ)⟩), fun h3 => h3 hzZ⟩ + · exact hb ⟨.inr h, fun h3 => h3 hzZ⟩ + · intro z hz + by_cases hzZ : z ∈ Z + · rcases hb₂ hz with (h1 | h1) | h1 + · rcases hb'' h1 with (h2 | h2) | h2 + · exact .inl (.inl h2) + · exact (hEoff z (GM11.discBd_subset E h2) hzZ).elim + · exact (h2 (.inr hzZ)).elim + · exact .inl (.inr h1) + · exact (h1 hzZ).elim + · exact .inr hzZ + +variable {V ι : Type} + +/-- Two vertices are joined by a walk that uses only the edges in `E`, for a graph with ends `a` and +`b`. -/ +def Reach (a b : ι → V) (E : Set ι) : V → V → Prop := + Relation.ReflTransGen fun x y => ∃ i ∈ E, (a i = x ∧ b i = y) ∨ (a i = y ∧ b i = x) + +theorem Reach.symm {a b : ι → V} {E : Set ι} {x y : V} (h : Reach a b E x y) : Reach a b E y x := by + induction h with + | refl => exact .refl + | tail _ hs ih => + obtain ⟨i, hi, h1⟩ := hs + exact Relation.ReflTransGen.head ⟨i, hi, h1.symm⟩ ih + +theorem Reach.mono {a b : ι → V} {E E' : Set ι} (hE : E ⊆ E') {x y : V} + (h : Reach a b E x y) : Reach a b E' x y := by + induction h with + | refl => exact .refl + | tail _ hs ih => + obtain ⟨i, hi, h1⟩ := hs + exact ih.tail ⟨i, hE hi, h1⟩ + +/-- **Discs around a forest.** Let closed discs `c₀ v`, pairwise disjoint, be joined by pairwise +disjoint lines `L i` from +the disc of `a i` to the disc of `b i`, along a graph without cycles. Then the discs and lines of +each component +of the graph lie in one closed disc, and these discs are pairwise disjoint. They add no point of +`Z`, and they +keep the points of `Z` on the boundaries of the `c₀ v`, and only those. -/ +theorem exists_forest_discs [Finite V] [Finite ι] (hS : IsClosedSurface S) {c₀ : V → Set S} {L : ι + → Set S} {p q : ι → S} {a b : ι → V} + {Z : Set S} (hd : ∀ v, IsClosedDisc (c₀ v)) (hdj : ∀ u v, u ≠ v → Disjoint (c₀ u) (c₀ v)) + (hL : ∀ i, IsLineWithEnds (L i) (p i) (q i)) (hp : ∀ i, p i ∈ discBd (c₀ (a i))) + (hq : ∀ i, q i ∈ discBd (c₀ (b i))) + (hLc : ∀ i v, L i ∩ c₀ v ⊆ {p i, q i}) (hLL : ∀ i j, i ≠ j → Disjoint (L i) (L j)) + (hZ : IsClosed Z) + (hLZ : ∀ i, Disjoint (L i) Z) (hfor : ∀ (E : Set ι) (i : ι), i ∉ E → ¬ Reach a b E (a i) + (b i)) : + ∃ c : V → Set S, (∀ v, IsClosedDisc (c v)) ∧ (∀ u v, c u = c v → Reach a b univ u v) ∧ + (∀ u v, c u ≠ c v → Disjoint (c u) (c v)) ∧ (∀ i, L i ⊆ discInt (c (a i)) ∧ c (a i) = c + (b i)) ∧ + (∀ v, c₀ v ⊆ c v ∧ discInt (c₀ v) ⊆ discInt (c v)) ∧ (∀ v, c v ∩ Z ⊆ ⋃ w, c₀ w) ∧ + (∀ v, discBd (c₀ v) ∩ Z ⊆ discBd (c v)) ∧ ∀ v, discBd (c v) ∩ Z ⊆ ⋃ w, discBd (c₀ w) := by + classical + have ht2 : T2Space S := hS.2.1 + have := Fintype.ofFinite ι + have hne : ∀ v, (c₀ v).Nonempty := fun v => by + obtain ⟨e⟩ := hd v + exact ⟨_, (e ⟨0, by simp [ClosedUnitDisc]⟩).2⟩ + suffices H : ∀ E : Finset ι, ∃ c : V → Set S, (∀ v, IsClosedDisc (c v)) ∧ (∀ u v, c u = c v + → Reach a b (E : Set ι) u v) ∧ + (∀ u v, c u ≠ c v → Disjoint (c u) (c v)) ∧ (∀ i, i ∉ E → p i ∈ discBd (c (a i)) + ∧ q i ∈ discBd (c (b i))) ∧ + (∀ i, i ∉ E → ∀ v, L i ∩ c v ⊆ {p i, q i}) ∧ (∀ i ∈ E, L i ⊆ discInt (c (a i)) ∧ c (a i) = c + (b i)) ∧ + (∀ v, c₀ v ⊆ c v ∧ discInt (c₀ v) ⊆ discInt (c v)) ∧ (∀ v, c v ∩ Z ⊆ ⋃ w, c₀ w) ∧ + (∀ v, discBd (c₀ v) ∩ Z ⊆ discBd (c v)) ∧ ∀ v, discBd (c v) ∩ Z ⊆ ⋃ w, discBd (c₀ w) by + obtain ⟨c, h1, h2, h3, -, -, h6, h7, h8, h9, h10⟩ := H Finset.univ + exact ⟨c, h1, fun u v h => (h2 u v h).mono (by simp), h3, fun i => h6 i (Finset.mem_univ i), + h7, h8, h9, h10⟩ + intro E + induction E using Finset.induction_on with + | empty => + refine ⟨c₀, hd, fun u v h => ?_, fun u v h => hdj u v fun e => h (congrArg c₀ e), + fun i _ => ⟨hp i, hq i⟩, fun i _ => hLc i, + by simp, fun v => ⟨subset_rfl, subset_rfl⟩, fun v => ?_, fun v => inter_subset_left, fun v + => ?_⟩ + · by_cases e : u = v + · rw [e] + exact Relation.ReflTransGen.refl + · obtain ⟨x, hx⟩ := hne u + exact (disjoint_left.mp (hdj u v e) hx (h ▸ hx)).elim + · exact fun x hx => mem_iUnion.mpr ⟨v, hx.1⟩ + · exact fun x hx => mem_iUnion.mpr ⟨v, hx.1⟩ + | insert i E hiE ih => + obtain ⟨c, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ := ih + set D₁ := c (a i) with hD₁ + set D₂ := c (b i) with hD₂ + have hne12 : D₁ ≠ D₂ := fun e => hfor (E : Set ι) i (by simpa using hiE) (h2 _ _ e) + let Merged : V → Prop := fun v => c v = D₁ ∨ c v = D₂ + let Z' : Set S := Z ∪ (⋃ j ∈ {j : ι | j ∉ E ∧ j ≠ i}, L j) ∪ ⋃ w ∈ {w : V | ¬ Merged w}, c w + have hZ' : IsClosed Z' := (hZ.union ((Set.toFinite _).isClosed_biUnion fun j _ => + (hL j).isCompact.isClosed)).union + ((Set.toFinite _).isClosed_biUnion fun w _ => (h1 w).isClosed) + have hsubL : ∀ j, j ∉ E → j ≠ i → L j ⊆ Z' := fun j h h' x hx => .inl (.inr + (mem_iUnion₂.mpr ⟨j, ⟨h, h'⟩, hx⟩)) + have hsubc : ∀ w, ¬ Merged w → c w ⊆ Z' := fun w h x hx => .inr (mem_iUnion₂.mpr ⟨w, h, hx⟩) + have hsubZ : Z ⊆ Z' := fun x hx => .inl (.inl hx) + have hdisj : ∀ w, ¬ Merged w → Disjoint (c w) D₁ ∧ Disjoint (c w) D₂ := fun w h => + ⟨h3 _ _ fun e => h (.inl e), h3 _ _ fun e => h (.inr e)⟩ + have hLZ' : Disjoint (L i) Z' := by + refine disjoint_left.mpr fun x hx hxZ => ?_ + rcases hxZ with (h | h) | h + · exact disjoint_left.mp (hLZ i) hx h + · obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.mp h + exact disjoint_left.mp (hLL i j hj.2.symm) hx hxj + · obtain ⟨w, hw, hxw⟩ := mem_iUnion₂.mp h + rcases h5 i hiE w ⟨hx, hxw⟩ with e | e + · exact disjoint_left.mp (hdisj w hw).1 hxw (e ▸ GM11.discBd_subset _ (h4 i hiE).1) + · exact disjoint_left.mp (hdisj w hw).2 hxw (e ▸ GM11.discBd_subset _ (h4 i hiE).2) + have hLD : L i ∩ (D₁ ∪ D₂) ⊆ {p i, q i} := by + rintro x ⟨hx, h | h⟩ + · exact h5 i hiE _ ⟨hx, h⟩ + · exact h5 i hiE _ ⟨hx, h⟩ + obtain ⟨D, d, hsub, hsup, hLi, hint₁, hint₂, hbdin, hbdout⟩ := exists_merge hS (h1 (a i)) (h1 + (b i)) (h3 _ _ hne12) (hL i) + (h4 i hiE).1 (h4 i hiE).2 hLD hZ' hLZ' + have hmsub : ∀ v, Merged v → c v ⊆ D := by + rintro v (e | e) + · rw [e] + exact subset_union_left.trans hsub + · rw [e] + exact subset_union_right.trans hsub + have hmint : ∀ v, Merged v → discInt (c v) ⊆ discInt D := by + rintro v (e | e) + · rwa [e] + · rwa [e] + have hZoff : ∀ x ∈ D, x ∈ Z' → ∃ v, Merged v ∧ x ∈ c v := fun x hx hxZ => by + rcases hsup hx with (h | h) | h + · exact ⟨a i, .inl rfl, h⟩ + · exact ⟨b i, .inr rfl, h⟩ + · exact (h hxZ).elim + have hbin : ∀ v, Merged v → discBd (c v) ∩ Z' ⊆ discBd D := by + rintro v (e | e) x hx + · exact hbdin ⟨.inl (by rw [← hD₁, ← e]; exact hx.1), hx.2⟩ + · exact hbdin ⟨.inr (by rw [← hD₂, ← e]; exact hx.1), hx.2⟩ + let c' : V → Set S := fun v => if Merged v then D else c v + have hc1 : ∀ {v}, Merged v → c' v = D := fun h => ite_eq_left h + have hc2 : ∀ {v}, ¬ Merged v → c' v = c v := fun h => ite_eq_right h + have hmem : ∀ {v}, Merged v ∨ ¬ Merged v := em _ + have hRE : (E : Set ι) ⊆ ((insert i E : Finset ι) : Set ι) := by simp + have hconn : ∀ w, Merged w → Reach a b ((insert i E : Finset ι) : Set ι) w (a i) := by + rintro w (e | e) + · exact (h2 w (a i) e).mono hRE + · refine ((h2 w (b i) e).mono hRE).tail ?_ + exact ⟨i, by simp, .inr ⟨rfl, rfl⟩⟩ + have hDne : (D₁).Nonempty := by + obtain ⟨x, hx⟩ := hne (a i) + exact ⟨x, (h7 (a i)).1 hx⟩ + have hoffD : ∀ w, ¬ Merged w → D ≠ c w := fun w hw e => by + obtain ⟨x, hx⟩ := hDne + exact disjoint_left.mp (hdisj w hw).1 (e ▸ (subset_union_left.trans hsub hx)) hx + have hdisjD : ∀ w, ¬ Merged w → Disjoint D (c w) := fun w hw => disjoint_left.mpr fun x hx hxw + => by + obtain ⟨v, hv, hxv⟩ := hZoff x hx (hsubc w hw hxw) + rcases hv with e | e + · exact disjoint_left.mp (hdisj w hw).1 hxw (e ▸ hxv) + · exact disjoint_left.mp (hdisj w hw).2 hxw (e ▸ hxv) + refine ⟨c', ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro v + by_cases h : Merged v + · rw [hc1 h] + exact d + · rw [hc2 h] + exact h1 v + · intro u v e + by_cases hu : Merged u <;> by_cases hv : Merged v + · exact (hconn u hu).trans (hconn v hv).symm + · rw [hc1 hu, hc2 hv] at e + exact (hoffD v hv e).elim + · rw [hc2 hu, hc1 hv] at e + exact (hoffD u hu e.symm).elim + · rw [hc2 hu, hc2 hv] at e + exact (h2 u v e).mono hRE + · intro u v e + by_cases hu : Merged u <;> by_cases hv : Merged v + · exact (e (by rw [hc1 hu, hc1 hv])).elim + · rw [hc1 hu, hc2 hv] + exact hdisjD v hv + · rw [hc2 hu, hc1 hv] + exact (hdisjD u hu).symm + · rw [hc2 hu, hc2 hv] at e ⊢ + exact h3 u v e + · intro j hj + have hj' : j ∉ E := fun h => hj (Finset.mem_insert_of_mem h) + have hji : j ≠ i := fun h => hj (h ▸ Finset.mem_insert_self _ _) + obtain ⟨g1, g2⟩ := h4 j hj' + constructor + · by_cases hv : Merged (a j) + · rw [hc1 hv] + exact hbin _ hv ⟨g1, hsubL j hj' hji (hL j).left_mem⟩ + · rw [hc2 hv] + exact g1 + · by_cases hv : Merged (b j) + · rw [hc1 hv] + exact hbin _ hv ⟨g2, hsubL j hj' hji (hL j).right_mem⟩ + · rw [hc2 hv] + exact g2 + · intro j hj v x hx + have hj' : j ∉ E := fun h => hj (Finset.mem_insert_of_mem h) + have hji : j ≠ i := fun h => hj (h ▸ Finset.mem_insert_self _ _) + by_cases hv : Merged v + · have hx2 : x ∈ D := (hc1 hv) ▸ hx.2 + obtain ⟨w, -, hxw⟩ := hZoff x hx2 (hsubL j hj' hji hx.1) + exact h5 j hj' w ⟨hx.1, hxw⟩ + · exact h5 j hj' v ⟨hx.1, (hc2 hv) ▸ hx.2⟩ + · intro j hj + rcases Finset.mem_insert.mp hj with rfl | hjE + · rw [hc1 (show Merged (a j) from .inl rfl), hc1 (show Merged (b j) from .inr rfl)] + exact ⟨hLi, rfl⟩ + · obtain ⟨g1, g2⟩ := h6 j hjE + by_cases hv : Merged (a j) + · have hv' : Merged (b j) := by + change c (b j) = _ ∨ c (b j) = _ + rw [← g2] + exact hv + rw [hc1 hv, hc1 hv'] + exact ⟨g1.trans (hmint _ hv), rfl⟩ + · have hv' : ¬ Merged (b j) := by + change ¬ (c (b j) = _ ∨ c (b j) = _) + rw [← g2] + exact hv + rw [hc2 hv, hc2 hv'] + exact ⟨g1, g2⟩ + · intro v + by_cases hv : Merged v + · rw [hc1 hv] + exact ⟨(h7 v).1.trans (hmsub v hv), (h7 v).2.trans (hmint v hv)⟩ + · rw [hc2 hv] + exact h7 v + · intro v x hx + by_cases hv : Merged v + · have hx2 : x ∈ D := (hc1 hv) ▸ hx.1 + obtain ⟨w, -, hxw⟩ := hZoff x hx2 (hsubZ hx.2) + exact h8 w ⟨hxw, hx.2⟩ + · exact h8 v ⟨(hc2 hv) ▸ hx.1, hx.2⟩ + · intro v x hx + have hxv := h9 v hx + by_cases hv : Merged v + · rw [hc1 hv] + exact hbin v hv ⟨hxv, hsubZ hx.2⟩ + · rw [hc2 hv] + exact hxv + · intro v x hx + by_cases hv : Merged v + · have hx2 : x ∈ discBd D := (hc1 hv) ▸ hx.1 + rcases hbdout hx2 with (h | h) | h + · exact h10 _ ⟨h, hx.2⟩ + · exact h10 _ ⟨h, hx.2⟩ + · exact (h (hsubZ hx.2)).elim + · exact h10 v ⟨(hc2 hv) ▸ hx.1, hx.2⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/LoopLift.lean b/LeanPool/GraphMinor/GM07/LoopLift.lean new file mode 100644 index 0000000000..8504037d12 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/LoopLift.lean @@ -0,0 +1,326 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Whisker +public import LeanPool.GraphMinor.GM07.Taper +public import LeanPool.GraphMinor.Surface.CutLoop +import LeanPool.GraphMinor.Surface.CutArc + +/-! +# The two lifts of a loop + +Cut a surface along an `O`-arc `F`, with a chosen point `v` of `F`. Going around `F` once from `v` +has two lifts to the cut surface +(`exists_loop_lifts`). The paper uses them in the proof of (7.3), for the two sides of a loop. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +local notation "𝕀" => unitInterval + +/-- A map of `𝕀 × 𝕀` that agrees at the two ends of the first factor comes from a map of `Circle × +𝕀`. -/ +theorem exists_circle_descent {W : Type*} [TopologicalSpace W] {H : 𝕀 × 𝕀 → W} (hH : Continuous H) + (he : ∀ p, H (0, p) = H (1, p)) : + ∃ K : Circle × 𝕀 → W, Continuous K ∧ ∀ t p, K (ee t.1, p) = H (t, p) := by + classical + let q : 𝕀 × 𝕀 → Circle × 𝕀 := fun x => (ee x.1.1, x.2) + have hqc : Continuous q := (continuous_ee.comp (continuous_subtype_val.comp + continuous_fst)).prodMk continuous_snd + have hqs : Surjective q := by + rintro ⟨z, p⟩ + obtain ⟨x, rfl⟩ := ee_surjective z + refine ⟨(⟨Int.fract x, Int.fract_nonneg x, (Int.fract_lt_one x).le⟩, p), ?_⟩ + have h1 : ee (Int.fract x) = ee x := ee_eq_iff.mpr ⟨-⌊x⌋, by + rw [Int.fract] + push_cast + ring⟩ + simp [q, h1] + have hqq : IsQuotientMap q := (hqc.isClosedMap).isQuotientMap hqc hqs + have hfib : ∀ x y, q x = q y → H x = H y := by + rintro ⟨t, p⟩ ⟨t', p'⟩ h + obtain ⟨h1, h2⟩ := Prod.mk.inj h + obtain rfl : p = p' := h2 + obtain ⟨m, hm⟩ := ee_eq_iff.mp h1 + change (t : ℝ) = t' + m at hm + have ht := t.2 + have ht' := t'.2 + have hm1 : (m : ℝ) ≤ 1 := by linarith [ht.2, ht'.1] + have hm2 : (-1 : ℝ) ≤ m := by linarith [ht.1, ht'.2] + have hm3 : m ≤ 1 := by exact_mod_cast hm1 + have hm4 : -1 ≤ m := by exact_mod_cast hm2 + obtain rfl | rfl | rfl : m = -1 ∨ m = 0 ∨ m = 1 := by omega + · have h0 : t = 0 := Subtype.ext (by + change (t : ℝ) = 0 + push_cast at hm + linarith [ht.1, ht'.2]) + have h1' : t' = 1 := Subtype.ext (by + change (t' : ℝ) = 1 + push_cast at hm + linarith [ht.1, ht'.2]) + rw [h0, h1', he] + · have : t = t' := Subtype.ext (by simpa using hm) + rw [this] + · have h0 : t' = 0 := Subtype.ext (by + change (t' : ℝ) = 0 + push_cast at hm + linarith [ht.2, ht'.1]) + have h1' : t = 1 := Subtype.ext (by + change (t : ℝ) = 1 + push_cast at hm + linarith [ht.2, ht'.1]) + rw [h0, h1', he] + have hK : Continuous (fun z => H (surjInv hqs z)) := by + refine hqq.continuous_iff.mpr ?_ + have : (fun z => H (surjInv hqs z)) ∘ q = H := funext fun x => hfib _ _ (surjInv_eq hqs _) + rw [this] + exact hH + exact ⟨_, hK, fun t p => hfib _ _ (surjInv_eq hqs _)⟩ + +/-- The shift of `[0, 1)` that starts at `s`. -/ +noncomputable def rotShift (s t : ℝ) : ℝ := if t < 1 - s then s + t else s + t - 1 + +theorem rotShift_mem {s t : ℝ} (hs : s ∈ Ico (0 : ℝ) 1) (ht : t ∈ Ico + (0 : ℝ) 1) : rotShift s t ∈ Ico (0 : ℝ) 1 := by + unfold rotShift + split_ifs with h + · exact ⟨by linarith [hs.1, ht.1], by linarith⟩ + · exact ⟨by linarith, by linarith [hs.2, ht.2]⟩ + +theorem rotShift_inj {s : ℝ} : InjOn (rotShift s) (Ico 0 1) := by + intro t ht t' ht' he + unfold rotShift at he + split_ifs at he <;> linarith [ht.1, ht.2, ht'.1, ht'.2] + +theorem rotShift_surj {s u : ℝ} (hs : s ∈ Ico (0 : ℝ) 1) (hu : u ∈ Ico (0 : ℝ) 1) : ∃ t ∈ Ico + (0 : ℝ) 1, rotShift s t = u := by + by_cases h : s ≤ u + · refine ⟨u - s, ⟨by linarith, by linarith [hu.2, hs.1]⟩, ?_⟩ + unfold rotShift + rw [ite_eq_left (by linarith [hu.2])] + ring + · push Not at h + refine ⟨u - s + 1, ⟨by linarith [hu.1, hs.2], by linarith⟩, ?_⟩ + unfold rotShift + rw [ite_eq_right (by linarith [hu.1])] + ring + +/-- Two paths with `g 1 = g' 0`, cut at `s` and joined up. -/ +noncomputable def rotPath {W : Type*} (s : ℝ) (g g' : ℝ → W) (t : ℝ) : W := + if t < 1 - s then g (s + t) else g' (s + t - 1) + +theorem continuousOn_rotPath {W : Type*} [TopologicalSpace W] {s : ℝ} (hs : s ∈ Ico + (0 : ℝ) 1) {g g' : ℝ → W} + (hg : ContinuousOn g (Icc 0 1)) (hg' : ContinuousOn g' (Icc 0 1)) (he : g 1 = g' 0) : + ContinuousOn (rotPath s g g') (Icc 0 1) := by + have hcov : Icc (0 : ℝ) 1 = Icc 0 (1 - s) ∪ Icc (1 - s) 1 := + (Icc_union_Icc_eq_Icc (by linarith [hs.2]) (by linarith [hs.1])).symm + rw [hcov] + refine ContinuousOn.union_of_isClosed ?_ ?_ isClosed_Icc isClosed_Icc + · refine (hg.comp (by fun_prop) (fun t ht => ?_) : ContinuousOn (fun t => g + (s + t)) _).congr fun t ht => ?_ + · exact ⟨by linarith [hs.1, ht.1], by linarith [ht.2]⟩ + · unfold rotPath + split_ifs with h + · rfl + · have : t = 1 - s := le_antisymm ht.2 (not_lt.mp h) + subst this + simp [he] + · refine (hg'.comp (by fun_prop) (fun t ht => ?_) : ContinuousOn (fun t => g' + (s + t - 1)) _).congr fun t ht => ?_ + · exact ⟨by linarith [ht.1], by linarith [ht.2, hs.2]⟩ + · unfold rotPath + rw [ite_eq_right (not_lt.mpr ht.1)] + rfl + +section + +variable {Y S : Type u} [TopologicalSpace Y] [T2Space Y] [TopologicalSpace S] [T2Space S] {ψ : Y + → S} + +omit [T2Space Y] in +/-- Going around an `O`-arc once from a given point has two lifts to the cut surface. -/ +theorem exists_loop_lifts {F Z₁ Z₂ : Set S} {u c v : S} {X₁ Y₁ X₂ Y₂ : Set Y} + (hcut : IsCutting ψ F) (h : LiftPair ψ Z₁ u c X₁ Y₁) + (h' : LiftPair ψ Z₂ c u X₂ Y₂) (hi : Z₁ ∩ Z₂ = {u, c}) (hun : Z₁ ∪ Z₂ = F) (huc : u ≠ c) (hu : + (ψ ⁻¹' {u}).encard ≤ 2) + (hc : (ψ ⁻¹' {c}).encard ≤ 2) (hv : v ∈ F) : + ∃ (a : 𝕀 → S) (ξ η : 𝕀 → Y), Continuous ξ ∧ Continuous η ∧ (∀ t, ψ (ξ t) = a t) ∧ (∀ t, ψ (η t) + = a t) ∧ a 0 = v ∧ a 1 = v ∧ + range a = F ∧ InjOn a (Ioo 0 1) ∧ (∀ t ∈ Ioo (0 : 𝕀) 1, a t ≠ v) ∧ (∀ t, ξ t ≠ η t) ∧ + (∀ y, ψ y ∈ F → ∃ t, y = ξ t ∨ y = η t) := by + classical + have hψ := hcut.1 + obtain ⟨a, ξ, η, c1, c2, h1, h2, h3, h4, h5, h6, h7⟩ := h.paths h' hi huc hu hc hψ + rw [hun] at h3 h4 + have m0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have m1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have ha1 : a 1 = a 0 := by + rcases h7 with ⟨h8, -⟩ | ⟨h8, -⟩ + · rw [← h1 1 m1, h8, h1 0 m0] + · rw [← h1 1 m1, h8, h2 0 m0] + -- A start in `[0, 1)`. + obtain ⟨s, hs, hsv⟩ : ∃ s ∈ Ico (0 : ℝ) 1, a s = v := by + obtain ⟨s, hs, he⟩ := (h3 ▸ hv : v ∈ a '' Icc 0 1) + rcases eq_or_lt_of_le hs.2 with rfl | h9 + · exact ⟨0, by simp, by rw [← ha1]; exact he⟩ + · exact ⟨s, ⟨hs.1, h9⟩, he⟩ + obtain ⟨ξ', η', hξ', hη', hpair⟩ : ∃ ξ' η' : ℝ → Y, ContinuousOn ξ' (Icc 0 1) ∧ ContinuousOn η' + (Icc 0 1) ∧ + ∀ t, (ξ' t = rotPath s ξ ξ t ∧ η' t = rotPath s η η t) ∨ (ξ' t = rotPath s ξ η t ∧ η' t + = rotPath s η ξ t) := by + rcases h7 with ⟨h8, h9⟩ | ⟨h8, h9⟩ + · exact ⟨_, _, continuousOn_rotPath hs c1 c1 h8, continuousOn_rotPath hs c2 c2 h9, + fun t => .inl ⟨rfl, rfl⟩⟩ + · exact ⟨_, _, continuousOn_rotPath hs c1 c2 h8, continuousOn_rotPath hs c2 c1 h9, + fun t => .inr ⟨rfl, rfl⟩⟩ + have hshift : ∀ t ∈ Icc (0 : ℝ) 1, rotShift s t ∈ Icc (0 : ℝ) 1 := fun t ht => by + unfold rotShift + split_ifs with h9 + · exact ⟨by linarith [hs.1, ht.1], by linarith⟩ + · exact ⟨by linarith, by linarith [hs.2, ht.2]⟩ + have hform : ∀ {g g' : ℝ → Y} (t : ℝ), rotPath s g g' t = g (rotShift s t) ∨ rotPath s g g' t + = g' (rotShift s t) := by + intro g g' t + unfold rotPath rotShift + split_ifs + · exact .inl rfl + · exact .inr rfl + let a' : ℝ → S := fun t => a (rotShift s t) + have hvals : ∀ {g g' : ℝ → Y}, (∀ t ∈ Icc (0 : ℝ) 1, ψ (g t) = a t) → (∀ t ∈ Icc (0 : ℝ) 1, ψ + (g' t) = a t) → + ∀ t ∈ Icc (0 : ℝ) 1, ψ (rotPath s g g' t) = a' t := by + intro g g' hg hg' t ht + rcases hform (g := g) (g' := g') t with h9 | h9 + · rw [h9]; exact hg _ (hshift t ht) + · rw [h9]; exact hg' _ (hshift t ht) + have hξa : ∀ t ∈ Icc (0 : ℝ) 1, ψ (ξ' t) = a' t := fun t ht => by + rcases hpair t with ⟨h9, -⟩ | ⟨h9, -⟩ + · rw [h9]; exact hvals h1 h1 t ht + · rw [h9]; exact hvals h1 h2 t ht + have hηa : ∀ t ∈ Icc (0 : ℝ) 1, ψ (η' t) = a' t := fun t ht => by + rcases hpair t with ⟨-, h9⟩ | ⟨-, h9⟩ + · rw [h9]; exact hvals h2 h2 t ht + · rw [h9]; exact hvals h2 h1 t ht + have ha'0 : a' 0 = v := by + have : rotShift s 0 = s := by + unfold rotShift + rw [ite_eq_left (by linarith [hs.2])] + ring + simp only [a', this, hsv] + have ha'1 : a' 1 = v := by + have : rotShift s 1 = s := by + unfold rotShift + rw [ite_eq_right (by linarith [hs.1])] + ring + simp only [a', this, hsv] + have hinj : InjOn a' (Ico 0 1) := fun t ht t' ht' he => + rotShift_inj ht ht' (h5 (rotShift_mem hs ht) (rotShift_mem hs ht') he) + have hIcc : ∀ t : 𝕀, (t : ℝ) ∈ Icc (0 : ℝ) 1 := fun t => t.2 + have hIco : ∀ t ∈ Ioo (0 : 𝕀) 1, (t : ℝ) ∈ Ico (0 : ℝ) 1 := fun t ht => ⟨t.2.1, ht.2⟩ + refine ⟨fun t => a' t, fun t => ξ' t, fun t => η' t, ?_, ?_, fun t => hξa t (hIcc t), + fun t => hηa t (hIcc t), ha'0, ha'1, ?_, ?_, ?_, ?_, ?_⟩ + · exact hξ'.comp_continuous continuous_subtype_val hIcc + · exact hη'.comp_continuous continuous_subtype_val hIcc + · apply subset_antisymm + · rintro _ ⟨t, rfl⟩ + rw [← h3] + exact mem_image_of_mem a (hshift t (hIcc t)) + · intro x hx + rw [← h3] at hx + obtain ⟨w, hw, rfl⟩ := hx + obtain ⟨w', hw', he⟩ : ∃ w' ∈ Ico (0 : ℝ) 1, a w' = a w := by + rcases eq_or_lt_of_le hw.2 with rfl | h9 + · exact ⟨0, by simp, ha1.symm⟩ + · exact ⟨w, ⟨hw.1, h9⟩, rfl⟩ + obtain ⟨t, ht, he'⟩ := rotShift_surj hs hw' + exact ⟨⟨t, ht.1, ht.2.le⟩, by + change a (rotShift s t) = _ + rw [he', he]⟩ + · exact fun t ht t' ht' he => Subtype.ext (hinj (hIco t ht) (hIco t' ht') he) + · intro t ht he + have h9 : a' t = a' 0 := by rw [ha'0]; exact he + have := hinj (hIco t ht) (by simp) h9 + exact (ne_of_gt ht.1) (Subtype.ext this) + · intro t he + change ξ' t = η' t at he + have hne := h6 (rotShift s t) (hshift t (hIcc t)) + have hsame : ∀ {g₁ g₂ g₃ g₄ : ℝ → Y}, rotPath s g₁ g₂ t.1 = rotPath s g₃ g₄ t.1 → (t.1 < 1 - s + → g₁ (s + t.1) = g₃ (s + t.1)) ∧ (¬ t.1 < 1 - s → g₂ (s + t.1 - 1) = g₄ (s + t.1 - 1)) := by + intro g₁ g₂ g₃ g₄ h9 + unfold rotPath at h9 + refine ⟨fun h10 => ?_, fun h10 => ?_⟩ + · rwa [ite_eq_left h10, ite_eq_left h10] at h9 + · rwa [ite_eq_right h10, ite_eq_right h10] at h9 + by_cases h10 : t.1 < 1 - s + · have h11 : rotShift s t = s + t.1 := by unfold rotShift; rw [ite_eq_left h10] + rw [h11] at hne + rcases hpair t with ⟨h8, h9⟩ | ⟨h8, h9⟩ <;> · rw [h8, h9] at he; exact hne ((hsame he).1 h10) + · have h11 : rotShift s t = s + t.1 - 1 := by unfold rotShift; rw [ite_eq_right h10] + rw [h11] at hne + rcases hpair t with ⟨h8, h9⟩ | ⟨h8, h9⟩ + · rw [h8, h9] at he; exact hne ((hsame he).2 h10) + · rw [h8, h9] at he; exact hne ((hsame he).2 h10).symm + · intro y hy + obtain ⟨y', hy', hne⟩ : ∃ y', ψ y' = ψ y ∧ y ≠ y' := by + have h9 := hcut.2.2.2.1 _ hy + obtain ⟨p, q, hpq, he⟩ := ncard_eq_two.mp h9 + have hp : p ∈ ψ ⁻¹' {ψ y} := by rw [he]; simp + have hq : q ∈ ψ ⁻¹' {ψ y} := by rw [he]; simp + by_cases hyp : y = p + · exact ⟨q, hq, by rw [hyp]; exact hpq⟩ + · exact ⟨p, hp, hyp⟩ + obtain ⟨u', hu', hcase⟩ := h4 y y' hy'.symm hne hy + have hy1 : ∃ u'' ∈ Ico (0 : ℝ) 1, y = ξ u'' ∨ y = η u'' := by + have hyu : y = ξ u' ∨ y = η u' := by + rcases hcase with h9 | h9 + · exact .inl h9.1 + · exact .inr h9.2 + rcases eq_or_lt_of_le hu'.2 with rfl | h10 + · refine ⟨0, by simp, ?_⟩ + rcases h7 with ⟨h8, h9⟩ | ⟨h8, h9⟩ + · rcases hyu with h11 | h11 + · exact .inl (h11.trans h8) + · exact .inr (h11.trans h9) + · rcases hyu with h11 | h11 + · exact .inr (h11.trans h8) + · exact .inl (h11.trans h9) + · exact ⟨u', ⟨hu'.1, h10⟩, hyu⟩ + obtain ⟨u'', hu'', hyu⟩ := hy1 + obtain ⟨t, ht, he⟩ := rotShift_surj hs hu'' + refine ⟨⟨t, ht.1, ht.2.le⟩, ?_⟩ + have hval : ∀ {g g' : ℝ → Y}, (t < 1 - s → rotPath s g g' t = g u'') ∧ (¬ t < 1 - s + → rotPath s g g' t = g' u'') := by + intro g g' + unfold rotPath + unfold rotShift at he + refine ⟨fun h10 => ?_, fun h10 => ?_⟩ + · rw [ite_eq_left h10] at he ⊢ + rw [he] + · rw [ite_eq_right h10] at he ⊢ + rw [he] + change y = ξ' t ∨ y = η' t + by_cases h10 : t < 1 - s + · rcases hpair t with ⟨h8, h9⟩ | ⟨h8, h9⟩ + · rw [h8, h9, hval.1 h10, hval.1 h10]; exact hyu + · rw [h8, h9, hval.1 h10, hval.1 h10]; exact hyu + · rcases hpair t with ⟨h8, h9⟩ | ⟨h8, h9⟩ + · rw [h8, h9, hval.2 h10, hval.2 h10]; exact hyu + · rw [h8, h9, hval.2 h10, hval.2 h10]; exact hyu.symm + +end + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/LoopSides.lean b/LeanPool/GraphMinor/GM07/LoopSides.lean new file mode 100644 index 0000000000..e1a9e9dc29 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/LoopSides.lean @@ -0,0 +1,706 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.LoopLift +public import LeanPool.GraphMinor.GM07.CutBuild +public import LeanPool.GraphMinor.GM07.CutBounds +import LeanPool.GraphMinor.GM06.DiscRegions + +/-! +# The two sides of a loop + +Let `f` be a loop of `G` at `v`, off the boundary. In the proof of (7.3) the paper says: "From this +and the fact that $\alpha(G) \ge 9$ it +follows that for every loop $e$ of $G$, $\bar{e}$ surrounds some cuff", and later speaks of "both +regions incident with `e`". We prove what +these sentences use. Push `ē` to each of its two sides, in the surface cut along `ē`, and keep `v` +fixed. This gives two `G`-normal +`O`-arcs that meet only in `v` and are homotopic to `ē`. Their union `K` meets each region incident +with `f` (`exists_loop_sides`). +If no `G`-normal null-homotopic `O`-arc with at most one vertex has an edge inside, then `ē` is not +null-homotopic +(`closure_loop_not_null`), so `K` is not planar. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +local notation "𝕀" => unitInterval + +/-- An `O`-arc in the boundary is a cuff. -/ +theorem isCuff_of_isOArc_subset_bd {Y : Type u} [TopologicalSpace Y] (hY : IsSurface Y) {X : Set Y} + (hO : IsOArc X) + (hs : X ⊆ bd Y) : IsCuff X := by + have : T2Space Y := hY.2.1 + obtain ⟨x, hx⟩ := (isConnected_of_isOArc hO).1 + have hc : connectedComponentIn (bd Y) x ∈ cuffs Y := ⟨x, hs hx, rfl⟩ + obtain ⟨φ⟩ := (cuff_statement.{u} Y hY).2.2 _ hc + have hsub : X ⊆ connectedComponentIn (bd Y) x := + (isConnected_of_isOArc hO).isPreconnected.subset_connectedComponentIn hx hs + have := oarc_eq φ hO hsub + rw [this] + exact hc + +section + +variable {Y S : Type u} [TopologicalSpace Y] [TopologicalSpace S] + +/-- Push a surface off a cuff `C` that lies over an `O`-arc `F`, away from a closed set `W` of the +target which meets `C` only over +the point `v`. -/ +theorem exists_side_push (hY : IsSurface Y) {ψ : Y → S} (hψ : Continuous ψ) {F W : Set S} {C C' : + Set Y} {v : S} (hCO : IsOArc C) + (hCb : C ⊆ bd Y) (hC'c : IsClosed C') (hdis : Disjoint C C') (hsub : ψ ⁻¹' F ⊆ C ∪ C') + (hWc : IsClosed W) + (hvW : ∀ y ∈ C, ψ y ∈ W → ψ y = v) (hvW' : v ∈ W) : + ∃ H : 𝕀 × Y → Y, Continuous H ∧ (∀ y, H (0, y) = y) ∧ Injective (fun y => H (1, y)) ∧ + (∀ p, ∀ y ∈ C, ψ y = v → H (p, y) = y) ∧ + (∀ y ∈ C, ψ y ≠ v → ψ (H (1, y)) ∉ F ∧ ψ (H (1, y)) ∉ W) ∧ + ∀ y ∈ C, ψ y ≠ v → ∃ N ∈ 𝓝 y, ∀ y' ∈ N, y' ∉ C → ∃ y'' ∈ C, ψ y'' ≠ v ∧ JoinedIn (F ∪ W)ᶜ + (ψ y') (ψ (H (1, y''))) := by + obtain ⟨φ⟩ := id hCO + let Z : Set Y := ψ ⁻¹' W ∪ C' + have hZ : IsClosed Z := (hWc.preimage hψ).union hC'c + obtain ⟨H, h1, h2, h3, h4, h5, h6, h7, h8⟩ := exists_taper_sides hY + (isCuff_of_isOArc_subset_bd hY hCO hCb) φ hZ + have hoff : ∀ y ∈ C, ψ y ≠ v → y ∉ Z := fun y hy hv hz => + hz.elim (fun h => hv (hvW y hy h)) fun h => disjoint_left.mp hdis hy h + have hin : ∀ z, z ∈ Z → z ∈ ψ ⁻¹' W ∪ C' := fun _ h => h + have hout : ∀ z, z ∉ Z → z ∉ C → ψ z ∉ F ∧ ψ z ∉ W := fun z hz hzC => by + refine ⟨fun hF => ?_, fun hW => hz (.inl hW)⟩ + exact (hsub hF).elim hzC fun h => hz (.inr h) + refine ⟨H, h1, h2, h3, fun p y hy hv => h7 p y (.inl ?_), fun y hy hv => ?_, fun y hy hv => ?_⟩ + · change ψ y ∈ W + rw [hv] + exact hvW' + · have hn : H (1, y) ∉ Z := fun h => hoff y hy hv (h5 y h) + exact hout _ hn fun h => hn (h6 y h) + · obtain ⟨N, hN, hcap⟩ := h8 y hy (hoff y hy hv) + refine ⟨N, hN, fun y' hy' hyC => ?_⟩ + obtain ⟨y'', hy''C, γ, hγ⟩ := hcap y' hy' hyC + have hend : H (1, y'') ∈ Zᶜ ∩ Cᶜ := by simpa using hγ 1 + refine ⟨y'', hy''C, fun hv' => ?_, γ.map hψ, fun t => ?_⟩ + · have hzy : y'' ∈ Z := .inl (by + change ψ y'' ∈ W + rw [hv'] + exact hvW') + apply hend.2 + rw [h7 1 y'' hzy] + exact hy''C + · have := hout _ (hγ t).1 (hγ t).2 + simpa [not_or] using this + +variable [T2Space S] + +/-- The pushed loop is an `O`-arc. -/ +theorem isOArc_pushed_loop {ψ : Y → S} (hψ : Continuous ψ) {F W : Set S} {C : Set Y} {v : S} {H : 𝕀 + × Y → Y} (hH : Continuous H) + (hi : Injective (fun y => H (1, y))) (hfix : ∀ p, ∀ y ∈ C, ψ y = v → H (p, y) = y) + (hpush : ∀ y ∈ C, ψ y ≠ v → ψ (H (1, y)) ∉ F ∧ ψ (H (1, y)) ∉ W) (hinj : InjOn ψ (ψ ⁻¹' F)ᶜ) + (hvW : v ∈ W) + {ξ : 𝕀 → Y} (hξ : Continuous ξ) (hξC : ∀ t, ξ t ∈ C) {a : 𝕀 → S} (hξa : ∀ t, ψ (ξ t) = a t) + (ha0 : a 0 = v) (ha1 : a 1 = v) + (hinja : InjOn a (Ioo 0 1)) (hne : ∀ t ∈ Ioo (0 : 𝕀) 1, a t ≠ v) : + IsOArc (range fun t => ψ (H (1, ξ t))) := by + have hzero : ψ (H (1, ξ 0)) = v := by + rw [hfix 1 _ (hξC 0) (by rw [hξa, ha0]), hξa, ha0] + have hone : ψ (H (1, ξ 1)) = v := by + rw [hfix 1 _ (hξC 1) (by rw [hξa, ha1]), hξa, ha1] + have hval : ∀ t ∈ Ioo (0 : 𝕀) 1, ψ (H (1, ξ t)) ∉ F ∧ ψ (H (1, ξ t)) ∉ W := fun t ht => + hpush _ (hξC t) (by rw [hξa]; exact hne t ht) + refine isOArc_of_loop (m := fun t => ψ (H (1, ξ t))) (hψ.comp (hH.comp (by fun_prop))) + (hzero.trans hone.symm) ?_ ?_ + · intro t ht t' ht' he + have h1 := hinj (hval t ht).1 (hval t' ht').1 he + have h2 := hi h1 + apply hinja ht ht' + rw [← hξa, ← hξa, h2] + · intro t ht he + apply (hval t ht).2 + change ψ (H (1, ξ t)) = ψ (H (1, ξ 0)) at he + rw [he, hzero] + exact hvW + +end + +/-- A loop that is homotopic, through loops, to a curve in a closed disc inside `Z` is +null-homotopic in `Z`. -/ +theorem null_of_loop_homotopy {W : Type u} [TopologicalSpace W] [T2Space W] {A : 𝕀 × 𝕀 → W} + (hA : Continuous A) + (he : ∀ p, A (0, p) = A (1, p)) (hinj : InjOn (fun t => A (t, 0)) (Ioo 0 1)) (hne : ∀ t ∈ Ioo + (0 : 𝕀) 1, A (t, 0) ≠ A (0, 0)) + {Z Δ : Set W} (hz : ∀ q, A q ∈ Z) (hΔ : IsClosedDisc Δ) (hΔZ : Δ ⊆ Z) (h1 : ∀ t, A (t, 1) ∈ Δ) : + IsNullHomotopicOArcIn Z (range fun t => A (t, 0)) := by + obtain ⟨K, hK, hKe⟩ := exists_circle_descent hA he + let c : Circle → W := fun w => K (w, 0) + have hc : Continuous c := hK.comp (continuous_id.prodMk continuous_const) + have hval : ∀ t : 𝕀, c (ee t.1) = A (t, 0) := fun t => hKe t 0 + have hrep : ∀ w : Circle, ∃ t : 𝕀, (t = 0 ∨ t ∈ Ioo (0 : 𝕀) 1) ∧ ee t.1 = w := by + intro w + obtain ⟨x, rfl⟩ := ee_surjective w + have h2 : ee (Int.fract x) = ee x := ee_eq_iff.mpr ⟨-⌊x⌋, by + rw [Int.fract] + push_cast + ring⟩ + refine ⟨⟨Int.fract x, Int.fract_nonneg x, (Int.fract_lt_one x).le⟩, ?_, h2⟩ + by_cases h3 : Int.fract x = 0 + · exact .inl (Subtype.ext h3) + · exact .inr ⟨Subtype.mk_lt_mk.mpr (lt_of_le_of_ne (Int.fract_nonneg x) (Ne.symm h3)), + Subtype.mk_lt_mk.mpr (Int.fract_lt_one x)⟩ + have hci : Injective c := by + intro w w' hw + obtain ⟨t, ht, rfl⟩ := hrep w + obtain ⟨t', ht', rfl⟩ := hrep w' + rw [hval, hval] at hw + rcases ht with rfl | ht <;> rcases ht' with rfl | ht' + · rfl + · exact absurd hw.symm (hne t' ht') + · exact absurd hw (hne t ht) + · rw [hinj ht ht' hw] + have hrange : range c = range fun t => A (t, 0) := by + ext x + constructor + · rintro ⟨w, rfl⟩ + obtain ⟨t, -, rfl⟩ := hrep w + exact ⟨t, (hval t).symm⟩ + · rintro ⟨t, rfl⟩ + exact ⟨ee t.1, hval t⟩ + rw [← hrange] + have hemb : IsEmbedding c := (hc.isClosedEmbedding hci).isEmbedding + refine ⟨hemb.toHomeomorph, ?_⟩ + let d : C(Circle, W) := ⟨fun w => K (w, 1), hK.comp (continuous_id.prodMk continuous_const)⟩ + have hd : ClosedCurveIsNullHomotopicIn Δ d := hΔ.isSimplyConnectedSet.2 d (by + rintro _ ⟨w, rfl⟩ + obtain ⟨t, -, rfl⟩ := hrep w + change K (ee t.1, 1) ∈ Δ + rw [hKe] + exact h1 t) + refine null_of_homotopic hΔZ ⟨⟨K, hK⟩, fun q => ?_, fun w => rfl, fun w => rfl⟩ hd + obtain ⟨w, s⟩ := q + obtain ⟨t, -, rfl⟩ := hrep w + change K (ee t.1, s) ∈ Z + rw [hKe] + exact hz _ + +/-- No `G`-normal null-homotopic `O`-arc with at most one vertex has an edge of `G` inside. -/ +def NoEdgeInSmallDisc {S : Type u} [TopologicalSpace S] (G : Drawing S) : Prop := + ¬ ∃ F e : Set S, G.IsNormal F ∧ IsNullHomotopicOArc F ∧ (G.V ∩ F).ncard ≤ 1 ∧ e ∈ G.E + ∧ IsInsideOArc e F + +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +omit [T1Space S] in +/-- The facts on a loop that the pushes use. -/ +theorem loop_facts (hS : IsSurface S) {G : Drawing S} {f : Set S} {v : S} (hf : f ∈ G.E) + (hcap : closure f ∩ G.V = {v}) : + ∀ x ∈ closure f, x ∈ G.U \ f → x = v := by + have : T2Space S := hS.2.1 + rintro x hx ⟨-, hxf⟩ + by_contra hne + apply hxf + rw [← G.closure_diff_V hf] + refine ⟨hx, fun hV => hne ?_⟩ + have : x ∈ closure f ∩ G.V := ⟨hx, hV⟩ + rw [hcap] at this + exact this + +omit [T1Space S] in +/-- A parametrisation of a loop from `v`. -/ +theorem exists_loop_param (hS : IsSurface S) {G : Drawing S} {f : Set S} {v : S} (hf : f ∈ G.E) + (hcap : closure f ∩ G.V = {v}) : + ∃ a : 𝕀 → S, Continuous a ∧ a 0 = v ∧ a 1 = v ∧ range a = closure f ∧ InjOn a (Ioo 0 1) + ∧ ∀ t ∈ Ioo (0 : 𝕀) 1, a t ≠ v := by + have : T2Space S := hS.2.1 + obtain ⟨a, hc, h0, h1, hi, hrange, hcl, -⟩ := GraphMinor.GM06.exists_edge_param_isLink G hf + have h0' : a 0 ∈ closure f ∩ G.V := ⟨hcl ▸ mem_range_self 0, h0⟩ + have h1' : a 1 ∈ closure f ∩ G.V := ⟨hcl ▸ mem_range_self 1, h1⟩ + rw [hcap] at h0' h1' + refine ⟨a, hc, h0', h1', hcl.symm, hi, fun t ht he => ?_⟩ + have h2 : a t ∈ f := hrange ▸ mem_image_of_mem a ht + have h3 : a t ∈ closure f \ G.V := by + rw [G.closure_diff_V hf] + exact h2 + exact h3.2 (he ▸ (show v ∈ G.V from by + have : v ∈ closure f ∩ G.V := by rw [hcap]; rfl + exact this.2)) + +omit [T1Space S] in +/-- A loop off the boundary is not null-homotopic, if no small disc holds an edge. -/ +theorem closure_loop_not_null (hS : IsSurface S) [ConnectedSpace S] {a₀ b₀ c₀ : ℕ} (hm : Nonempty + (S ≃ₜ SurfaceModel a₀ b₀ c₀)) + (hns : ¬ IsSphere S) {G : Drawing S} {f : Set S} {v : S} (hf : f ∈ G.E) (hcap : closure f ∩ G.V + = {v}) + (hO : IsOArc (closure f)) (hoff : Disjoint (closure f) (bd S)) (hred : NoEdgeInSmallDisc G) : + ¬ IsNullHomotopicOArc (closure f) := by + classical + intro hnull + have ht2 : T2Space S := hS.2.1 + have hcpt : CompactSpace S := hS.1 + have hman := hS.2.2 + obtain ⟨e⟩ := hm + set F := closure f with hFdef + obtain ⟨Δ, hΔ, hbd⟩ := nullHomotopicOArc_bounds_disc hS hO hnull + have hint : ∀ x ∈ discBd Δ, IsInteriorPoint x := fun x hx => by + by_contra hn + exact disjoint_left.mp hoff (hbd ▸ hx) hn + obtain ⟨hcl, hY, hbdY⟩ := remove_disc_homeo hS e hΔ hint + let Y := ↥(discInt Δ)ᶜ + let ψ : Y → S := Subtype.val + have hψe : IsEmbedding ψ := IsEmbedding.subtypeVal + have hψc : Continuous ψ := continuous_subtype_val + have hFsub : F ⊆ range ψ := by + rw [Subtype.range_val_subtype] + exact fun x hx hi => hi.2 (hbd ▸ hx) + have hCO : IsOArc (ψ ⁻¹' F) := IsOArc.pull_of_embedding hψe hO hFsub + have hCb : ψ ⁻¹' F ⊆ bd Y := fun y hy => by + rw [hbdY] + exact .inr (hbd ▸ hy) + obtain ⟨a, hac, ha0, ha1, har, hai, hane⟩ := exists_loop_param hS hf hcap + have haF : ∀ t, a t ∈ F := fun t => by + rw [hFdef, ← har] + exact mem_range_self t + let ξ : 𝕀 → Y := fun t => ⟨a t, by + obtain ⟨y, hy⟩ := hFsub (haF t) + rw [← hy] + exact y.2⟩ + have hξ : Continuous ξ := hac.subtype_mk _ + have hW : IsClosed (G.U \ f) := isClosed_U_sdiff_edge G hf + have hv : v ∈ closure f ∩ G.V := by rw [hcap]; rfl + have hvW : v ∈ G.U \ f := ⟨G.V_subset_U hv.2, fun h => (hf.2.1 h).2 hv.2⟩ + obtain ⟨H, h1, h2, h3, h4, h5, -⟩ := exists_side_push hY hψc (F := F) (W := G.U \ f) (C' := ∅) (v + := v) hCO hCb + isClosed_empty (disjoint_empty _) (subset_union_left) hW (fun y hy hyW + => loop_facts hS hf hcap _ hy hyW) hvW + let σ : 𝕀 → S := fun t => ψ (H (1, ξ t)) + have hσc : Continuous σ := hψc.comp (h1.comp (by fun_prop)) + have hσO : IsOArc (range σ) := isOArc_pushed_loop hψc h1 h3 h4 h5 hψe.injective.injOn hvW hξ + (fun t => haF t) + (fun t => rfl) ha0 ha1 hai hane + have hσ0 : σ 0 = v := by + have := h4 1 (ξ 0) (haF 0) ha0 + change ψ (H (1, ξ 0)) = v + rw [this] + exact ha0 + have hσ1 : σ 1 = v := by + have := h4 1 (ξ 1) (haF 1) ha1 + change ψ (H (1, ξ 1)) = v + rw [this] + exact ha1 + have hσoff : ∀ t ∈ Ioo (0 : 𝕀) 1, σ t ∉ F ∧ σ t ∉ G.U \ f := fun t ht => h5 _ (haF t) (hane t ht) + have hend : ∀ t : 𝕀, t ∉ Ioo (0 : 𝕀) 1 → σ t = v := fun t ht => by + have h6 : t = 0 ∨ t = 1 := by + by_contra hc + push Not at hc + exact ht ⟨unitInterval.pos_iff_ne_zero.mpr hc.1, unitInterval.lt_one_iff_ne_one.mpr hc.2⟩ + rcases h6 with rfl | rfl + · exact hσ0 + · exact hσ1 + have hUoff : ∀ x ∈ range σ, x ∈ G.U → x = v := by + rintro _ ⟨t, rfl⟩ hU + by_cases ht : t ∈ Ioo (0 : 𝕀) 1 + · obtain ⟨h6, h7⟩ := hσoff t ht + exact absurd ⟨hU, fun hf' => h6 (subset_closure hf')⟩ h7 + · exact hend t ht + have hnorm : G.IsNormal (range σ) := by + rintro x ⟨hx, hU⟩ + rw [hUoff x hx hU] + exact hv.2 + have hcount : (G.V ∩ range σ).ncard ≤ 1 := by + have : G.V ∩ range σ ⊆ {v} := fun x hx => hUoff x hx.2 (G.V_subset_U hx.1) + simpa using ncard_le_ncard this + -- `σ` is null-homotopic, by the homotopy back to `a`. + let A : 𝕀 × 𝕀 → Y := fun q => H (q.2, ξ q.1) + have hAc : Continuous A := h1.comp (by fun_prop) + have hA0 : ∀ p, A (0, p) = A (1, p) := fun p => by + have h6 : ξ 0 = ξ 1 := Subtype.ext (ha0.trans ha1.symm) + simp only [A, h6] + let B : 𝕀 × 𝕀 → S := fun q => ψ (A (q.1, unitInterval.symm q.2)) + have hBc : Continuous B := hψc.comp (hAc.comp (by fun_prop)) + have hnullσ : IsNullHomotopicOArc (range σ) := by + have hB0 : (fun t => B (t, 0)) = σ := by + funext t + simp [B, A, σ] + have hinjB : InjOn (fun t => B (t, 0)) (Ioo 0 1) := by + rw [hB0] + intro t ht t' ht' he + have h6 : H (1, ξ t) = H (1, ξ t') := hψe.injective he + have h7 := h3 h6 + exact Subtype.ext (hai ht ht' (congrArg ψ h7) ▸ rfl) + have hneB : ∀ t ∈ Ioo (0 : 𝕀) 1, B (t, 0) ≠ B (0, 0) := fun t ht he => by + have h6 : B (t, 0) = σ t := congrFun hB0 t + have h7 : B (0, 0) = σ 0 := congrFun hB0 0 + rw [h6, h7, hσ0] at he + exact (hσoff t ht).2 (he ▸ hvW) + have := null_of_loop_homotopy hBc (fun p => congrArg ψ (hA0 _)) hinjB hneB (Z := univ) (Δ := Δ) + (fun _ => mem_univ _) hΔ (subset_univ _) (fun t => by + have : B (t, 1) = a t := by + simp only [B, A, unitInterval.symm_one, h2] + rfl + rw [this] + have : a t ∈ discBd Δ := hbd ▸ haF t + exact Surface.discBd_subset _ this) + rwa [hB0] at this + obtain ⟨Δ₃, hΔ₃, hbd₃⟩ := nullHomotopicOArc_bounds_disc hS hσO hnullσ + have hfoff : Disjoint f (discBd Δ₃) := by + rw [hbd₃, disjoint_left] + intro x hx hxr + have hv' := hUoff x hxr (G.closure_subset_U hf (subset_closure hx)) + exact (hf.2.1 hx).2 (hv' ▸ hv.2) + have hfne : f.Nonempty := hf.2.2.1.nonempty + have hfpre : IsPreconnected f := hf.2.2.1.isConnected.isPreconnected + rcases hΔ₃.side hman hfpre hfoff with hin | hdj + · refine hred ⟨range σ, f, hnorm, hnullσ, hcount, hf, fun x hx => .inl ⟨hnullσ, Δ₃, hΔ₃, hbd₃, + (hin hx).1, ?_⟩⟩ + exact fun hc => disjoint_left.mp hfoff hx (hbd₃ ▸ hc) + · have hIoff : Disjoint (discInt Δ) (discBd Δ₃) := by + rw [hbd₃, disjoint_left] + rintro x hx ⟨t, rfl⟩ + exact (H (1, ξ t)).2 hx + rcases hΔ₃.side hman hΔ.isPreconnected_discInt hIoff with hin | hdj' + · obtain ⟨x, hx⟩ := hfne + have h6 : x ∈ Δ := by + have : x ∈ discBd Δ := hbd ▸ subset_closure hx + exact Surface.discBd_subset _ this + have h7 := closure_minimal (hin.trans (discInt_subset Δ₃)) hΔ₃.isCompact.isClosed + (hΔ.subset_closure_discInt h6) + exact disjoint_left.mp hdj hx h7 + · -- The disc `Δ₃` lies in the surface `Y`, so the cuff of `Y` over `F` bounds a disc of `Y`. + have hY2 : T2Space Y := hY.2.1 + have hYc : CompactSpace Y := hY.1 + have hrangeΔ : Δ₃ ⊆ range ψ := by + rw [Subtype.range_val_subtype] + exact fun x hx hi => disjoint_left.mp hdj' hi hx + have hdiscY : IsClosedDisc (ψ ⁻¹' Δ₃) := + isClosedDisc_preimage_of_subset_range hψc hψe.injective hΔ₃ hrangeΔ + have hnullY : IsNullHomotopicOArc (ψ ⁻¹' F) := by + have hA00 : (fun t => A (t, 0)) = ξ := by + funext t + simp [A, h2] + have hrξ : range ξ = ψ ⁻¹' F := by + ext y + constructor + · rintro ⟨t, rfl⟩ + exact haF t + · intro hy + have hy' : y.1 ∈ range a := by + rw [har] + exact hy + obtain ⟨t, ht⟩ := hy' + exact ⟨t, Subtype.ext ht⟩ + have := null_of_loop_homotopy hAc hA0 (fun t ht t' ht' he => hai ht ht' (by + have h6 := congrArg ψ he + simp only [A, h2] at h6 + exact h6)) + (fun t ht he => hane t ht (by + have h6 := congrArg ψ he + have h7 : ψ (A (t, 0)) = a t := by + simp only [A, h2] + rfl + have h8 : ψ (A (0, 0)) = a 0 := by + simp only [A, h2] + rfl + rw [h7, h8, ha0] at h6 + exact h6)) (Z := univ) (fun _ => mem_univ _) hdiscY (subset_univ _) (fun t => by + change σ t ∈ Δ₃ + have : σ t ∈ discBd Δ₃ := by + rw [hbd₃] + exact mem_range_self t + exact Surface.discBd_subset _ this) + rwa [hA00, hrξ] at this + obtain ⟨Δ_Y, hΔY, hbdY'⟩ := nullHomotopicOArc_bounds_disc hY hCO hnullY + obtain ⟨hΔi, hbi⟩ := isClosedDisc_image_of_injOn hΔY hψc hψe.injective.injOn + have hbi' : discBd (ψ '' Δ_Y) = discBd Δ := by + rw [hbi, hbdY', image_preimage_eq_of_subset hFsub, hbd] + have hEq := eq_of_discBd_eq hS hns hΔi hΔ hbi' + obtain ⟨p, hp⟩ : (discInt Δ).Nonempty := by + obtain ⟨hh, g, cc⟩ := hΔ.exists_isChart + refine ⟨g 0, cc.gm (by simp), fun hb => ?_⟩ + have h2' : hh (g 0) ∈ Metric.sphere (0 : ℂ) 1 := cc.bd ▸ mem_image_of_mem hh hb + rw [cc.hg (by simp)] at h2' + simp at h2' + have hpi : p ∈ ψ '' Δ_Y := hEq ▸ hp.1 + obtain ⟨y, -, rfl⟩ := hpi + exact y.2 hp + +/-- The facts on a push off a cuff `C`, from `exists_side_push`. -/ +def IsSidePush {Y S : Type u} [TopologicalSpace Y] [TopologicalSpace S] (ψ : Y → S) (F W : Set S) + (v : S) (C : Set Y) + (H : 𝕀 × Y → Y) : Prop := + Continuous H ∧ (∀ y, H (0, y) = y) ∧ Injective (fun y => H (1, y)) ∧ (∀ p, ∀ y ∈ C, ψ y = v → H + (p, y) = y) ∧ + (∀ y ∈ C, ψ y ≠ v → ψ (H (1, y)) ∉ F ∧ ψ (H (1, y)) ∉ W) ∧ + ∀ y ∈ C, ψ y ≠ v → ∃ N ∈ 𝓝 y, ∀ y' ∈ N, y' ∉ C → ∃ y'' ∈ C, ψ y'' ≠ v ∧ JoinedIn (F ∪ W)ᶜ + (ψ y') (ψ (H (1, y''))) + +omit [T1Space S] in +/-- The union of the two pushes of a loop. -/ +theorem sides_of_pushes (hS : IsSurface S) [ConnectedSpace S] {a₀ b₀ c₀ : ℕ} (hm : Nonempty + (S ≃ₜ SurfaceModel a₀ b₀ c₀)) + (hns : ¬ IsSphere S) {G : Drawing S} {f : Set S} {v : S} (hf : f ∈ G.E) (hcap : closure f ∩ G.V + = {v}) + (hO : IsOArc (closure f)) (hoff : Disjoint (closure f) (bd S)) (hred : NoEdgeInSmallDisc G) + {Y : Type u} [TopologicalSpace Y] [CompactSpace Y] {ψ : Y → S} (hψ : Continuous ψ) + (hsurj : Surjective ψ) + (hinj : InjOn ψ (ψ ⁻¹' closure f)ᶜ) {a : 𝕀 → S} {ξ η : 𝕀 → Y} (hξ : Continuous ξ) + (hη : Continuous η) + (hξa : ∀ t, ψ (ξ t) = a t) (hηa : ∀ t, ψ (η t) = a t) (ha0 : a 0 = v) (ha1 : a 1 = v) + (har : range a = closure f) + (hai : InjOn a (Ioo 0 1)) (hane : ∀ t ∈ Ioo (0 : 𝕀) 1, a t ≠ v) (hcov : ∀ y, ψ y ∈ closure f + → ∃ t, y = ξ t ∨ y = η t) + {C₁ C₂ : Set Y} {H₁ H₂ : 𝕀 × Y → Y} (hp₁ : IsSidePush ψ (closure f) (G.U \ f) v C₁ H₁) + (hp₂ : IsSidePush ψ (closure f) (G.U \ f) v C₂ H₂) + (hξC : ∀ t, ξ t ∈ C₁) (hηC : ∀ t, η t ∈ C₂) (hC₁ : C₁ ⊆ ψ ⁻¹' closure f) + (hC₂ : C₂ ⊆ ψ ⁻¹' closure f) + (hK₁ : ∀ y ∈ C₁, ψ y ≠ v → ψ (H₁ (1, y)) ∈ (range fun t => ψ (H₁ (1, ξ t))) ∪ range fun t => ψ + (H₂ (1, η t))) + (hK₂ : ∀ y ∈ C₂, ψ y ≠ v → ψ (H₂ (1, y)) ∈ (range fun t => ψ (H₁ (1, ξ t))) ∪ range fun t => ψ + (H₂ (1, η t))) : + ∃ K : Set S, IsSolid K ∧ IsConnected K ∧ G.IsNormal K ∧ G.V ∩ K ⊆ {v} ∧ ¬ IsPlanar K ∧ + ∀ x ∈ f, ∀ ρ ∈ G.R, x ∈ closure ρ → (ρ ∩ K).Nonempty := by + classical + have ht2 : T2Space S := hS.2.1 + have hv : v ∈ closure f ∩ G.V := by rw [hcap]; rfl + have hvW : v ∈ G.U \ f := ⟨G.V_subset_U hv.2, fun h => (hf.2.1 h).2 hv.2⟩ + obtain ⟨h1c, h10, h1i, h1f, h1p, h1t⟩ := hp₁ + obtain ⟨h2c, h20, h2i, h2f, h2p, h2t⟩ := hp₂ + have hO₁ : IsOArc (range fun t => ψ (H₁ (1, ξ t))) := + isOArc_pushed_loop hψ h1c h1i h1f h1p hinj hvW hξ hξC hξa ha0 ha1 hai hane + have hO₂ : IsOArc (range fun t => ψ (H₂ (1, η t))) := + isOArc_pushed_loop hψ h2c h2i h2f h2p hinj hvW hη hηC hηa ha0 ha1 hai hane + have hend : ∀ {C : Set Y} {H : 𝕀 × Y → Y} {ζ : 𝕀 → Y}, (∀ p, ∀ y ∈ C, ψ y = v → H (p, y) = y) → + (∀ t, ζ t ∈ C) → + (∀ t, ψ (ζ t) = a t) → (∀ t : 𝕀, t ∉ Ioo (0 : 𝕀) 1 → ∀ p, ψ (H (p, ζ t)) = v) := by + intro C H ζ hfx hζ hζa t ht p + have h6 : t = 0 ∨ t = 1 := by + by_contra hc + push Not at hc + exact ht ⟨unitInterval.pos_iff_ne_zero.mpr hc.1, unitInterval.lt_one_iff_ne_one.mpr hc.2⟩ + have h7 : ψ (ζ t) = v := by + rcases h6 with rfl | rfl + · rw [hζa, ha0] + · rw [hζa, ha1] + rw [hfx p _ (hζ t) h7, h7] + have hUoff : ∀ {C : Set Y} {H : 𝕀 × Y → Y} {ζ : 𝕀 → Y}, (∀ p, ∀ y ∈ C, ψ y = v → H (p, y) = y) → + (∀ y ∈ C, ψ y ≠ v → ψ (H (1, y)) ∉ closure f ∧ ψ (H (1, y)) ∉ G.U \ f) → (∀ t, ζ t ∈ C) → + (∀ t, ψ (ζ t) = a t) → ∀ x ∈ (range fun t => ψ (H (1, ζ t))), x ∈ G.U → x = v := by + rintro C H ζ hfx hps hζ hζa _ ⟨t, rfl⟩ hU + by_cases ht : t ∈ Ioo (0 : 𝕀) 1 + · obtain ⟨h6, h7⟩ := hps _ (hζ t) (by rw [hζa]; exact hane t ht) + exact absurd ⟨hU, fun hf' => h6 (subset_closure hf')⟩ h7 + · exact hend hfx hζ hζa t ht 1 + have hU₁ := hUoff h1f h1p hξC hξa + have hU₂ := hUoff h2f h2p hηC hηa + have hv₁ : v ∈ range fun t => ψ (H₁ (1, ξ t)) := ⟨0, hend h1f hξC hξa 0 (fun h => h.1.false) 1⟩ + have hv₂ : v ∈ range fun t => ψ (H₂ (1, η t)) := ⟨0, hend h2f hηC hηa 0 (fun h => h.1.false) 1⟩ + have hUK : ∀ x ∈ (range fun t => ψ (H₁ (1, ξ t))) ∪ range fun t => ψ (H₂ (1, η t)), x ∈ G.U → x + = v := by + rintro x (hx | hx) hU + · exact hU₁ x hx hU + · exact hU₂ x hx hU + refine ⟨_, theorem_11_6_proof hS (isSolid_of_isOArc hS hO₁) (isSolid_of_isOArc hS hO₂), ⟨⟨v, + .inl hv₁⟩, + (isConnected_of_isOArc hO₁).isPreconnected.union v hv₁ hv₂ (isConnected_of_isOArc + hO₂).isPreconnected⟩, ?_, ?_, ?_, ?_⟩ + · rintro x ⟨hx, hU⟩ + rw [hUK x hx hU] + exact hv.2 + · rintro x ⟨hxV, hx⟩ + exact hUK x hx (G.V_subset_U hxV) + · intro hpl + obtain ⟨Δ, hΔ, hsub⟩ := IsPlanar.mono hpl (subset_union_left (s := range fun t => ψ (H₁ + (1, ξ t))) (t := range fun t => ψ (H₂ (1, η t)))) + let A : 𝕀 × 𝕀 → S := fun q => ψ (H₁ (q.2, ξ q.1)) + have hAc : Continuous A := hψ.comp (h1c.comp (by fun_prop)) + have hA0 : (fun t => A (t, 0)) = a := by + funext t + simp only [A, h10, hξa] + have hn := null_of_loop_homotopy hAc (fun p => by + rw [show A (0, p) = v from hend h1f hξC hξa 0 (fun h => h.1.false) p, + show A (1, p) = v from hend h1f hξC hξa 1 (fun h => h.2.false) p]) + (by rw [hA0]; exact hai) (fun t ht => by + have h6 : A (t, 0) = a t := congrFun hA0 t + have h7 : A (0, 0) = a 0 := congrFun hA0 0 + rw [h6, h7, ha0] + exact hane t ht) (Z := univ) (fun _ => mem_univ _) hΔ (subset_univ _) (fun t => hsub ⟨t, + rfl⟩) + rw [hA0, har] at hn + exact closure_loop_not_null hS hm hns hf hcap hO hoff hred hn + · intro x hxf ρ hρ hxρ + have hxF : x ∈ closure f := subset_closure hxf + have hxv : x ≠ v := fun h => (hf.2.1 hxf).2 (h ▸ hv.2) + obtain ⟨t, rfl⟩ : x ∈ range a := by rw [har]; exact hxF + have htI : t ∈ Ioo (0 : 𝕀) 1 := by + refine ⟨unitInterval.pos_iff_ne_zero.mpr fun h => hxv (by rw [h, ha0]), + unitInterval.lt_one_iff_ne_one.mpr fun h => hxv (by rw [h, ha1])⟩ + obtain ⟨N₁, hN₁, hc₁⟩ := h1t (ξ t) (hξC t) (by rw [hξa]; exact hxv) + obtain ⟨N₂, hN₂, hc₂⟩ := h2t (η t) (hηC t) (by rw [hηa]; exact hxv) + let O := interior N₁ ∪ interior N₂ + have hOo : IsOpen O := isOpen_interior.union isOpen_interior + let T := ψ '' Oᶜ + have hT : IsClosed T := (hOo.isClosed_compl.isCompact.image hψ).isClosed + have hxT : a t ∉ T := by + rintro ⟨y, hy, he⟩ + apply hy + obtain ⟨s, hs⟩ := hcov y (by rw [he]; exact hxF) + have hsI : ∀ {ζ : 𝕀 → Y}, (∀ s, ψ (ζ s) = a s) → y = ζ s → s = t := by + intro ζ hζ hys + have h6 : a s = a t := by rw [← hζ, ← hys, he] + have hsI : s ∈ Ioo (0 : 𝕀) 1 := by + refine ⟨unitInterval.pos_iff_ne_zero.mpr fun h => hxv (by rw [← h6, h, ha0]), + unitInterval.lt_one_iff_ne_one.mpr fun h => hxv (by rw [← h6, h, ha1])⟩ + exact hai hsI htI h6 + rcases hs with hs | hs + · have := hsI hξa hs + rw [hs, this] + exact .inl (mem_interior_iff_mem_nhds.mpr hN₁) + · have := hsI hηa hs + rw [hs, this] + exact .inr (mem_interior_iff_mem_nhds.mpr hN₂) + obtain ⟨w, hwT, hwρ⟩ := mem_closure_iff.mp hxρ _ hT.isOpen_compl hxT + obtain ⟨y', rfl⟩ := hsurj w + have hy'O : y' ∈ O := by + by_contra hn + exact hwT ⟨y', hn, rfl⟩ + obtain ⟨z₀, -, hz₀⟩ := hρ + have hwU : ψ y' ∈ univ \ G.U := by + have := connectedComponentIn_subset _ _ (hz₀ ▸ hwρ) + exact this + have hoffF : ψ y' ∉ closure f := fun h => hwU.2 (G.closure_subset_U hf h) + have hjoin : ∀ z, JoinedIn (closure f ∪ (G.U \ f))ᶜ (ψ y') z → z ∈ ρ := by + intro z hj + have hsubU : (closure f ∪ (G.U \ f))ᶜ ⊆ univ \ G.U := fun q hq => ⟨mem_univ _, fun hU => by + by_cases hqf : q ∈ f + · exact hq (.inl (subset_closure hqf)) + · exact hq (.inr ⟨hU, hqf⟩)⟩ + obtain ⟨γ, hγ⟩ := hj + have hr : IsPreconnected (range γ) := isPreconnected_range γ.continuous + have hrs : range γ ⊆ univ \ G.U := by + rintro _ ⟨s, rfl⟩ + exact hsubU (hγ s) + have hsub := hr.subset_connectedComponentIn (x := ψ y') ⟨0, by simp⟩ hrs + rw [← connectedComponentIn_eq (hz₀ ▸ hwρ : ψ y' ∈ connectedComponentIn _ z₀), hz₀] at hsub + exact hsub ⟨1, by simp⟩ + rcases hy'O with hy | hy + · have hy1 : y' ∉ C₁ := fun h => hoffF (hC₁ h) + obtain ⟨y'', hy''C, hy''v, hj⟩ := hc₁ y' (interior_subset hy) hy1 + exact ⟨_, hjoin _ hj, hK₁ y'' hy''C hy''v⟩ + · have hy1 : y' ∉ C₂ := fun h => hoffF (hC₂ h) + obtain ⟨y'', hy''C, hy''v, hj⟩ := hc₂ y' (interior_subset hy) hy1 + exact ⟨_, hjoin _ hj, hK₂ y'' hy''C hy''v⟩ + +omit [T1Space S] in +/-- **The two sides of a loop.** See the module docstring. -/ +theorem exists_loop_sides (hS : IsSurface S) [ConnectedSpace S] {a₀ b₀ c₀ : ℕ} (hm : Nonempty + (S ≃ₜ SurfaceModel a₀ b₀ c₀)) + (hns : ¬ IsSphere S) {G : Drawing S} {f : Set S} {v : S} (hf : f ∈ G.E) (hcap : closure f ∩ G.V + = {v}) + (hO : IsOArc (closure f)) (hoff : Disjoint (closure f) (bd S)) (hred : NoEdgeInSmallDisc G) : + ∃ K : Set S, IsSolid K ∧ IsConnected K ∧ G.IsNormal K ∧ G.V ∩ K ⊆ {v} ∧ ¬ IsPlanar K ∧ + ∀ x ∈ f, ∀ ρ ∈ G.R, x ∈ closure ρ → (ρ ∩ K).Nonempty := by + classical + have ht2 : T2Space S := hS.2.1 + have hv : v ∈ closure f ∩ G.V := by rw [hcap]; rfl + have hvW : v ∈ G.U \ f := ⟨G.V_subset_U hv.2, fun h => (hf.2.1 h).2 hv.2⟩ + have hvF : v ∈ closure f := hv.1 + obtain ⟨Y, tY, t2Y, ψ, hY, hcut, hcase, Z₁, Z₂, u, c, X₁, Y₁, X₂, Y₂, h7, h8, hi, hun, huc, hfu, + hfc⟩ := exists_cut_loop hS hO hoff + have : CompactSpace Y := hY.1 + obtain ⟨a, ξ, η, hξ, hη, hξa, hηa, ha0, ha1, har, hai, hane, hne, hcov⟩ + := exists_loop_lifts hcut h7 h8 hi hun huc hfu hfc hvF + have hψ := hcut.1 + have hsurj := hcut.2.1 + have hinj : InjOn ψ (ψ ⁻¹' closure f)ᶜ := hcut.2.2.1 + have hbdF : ψ ⁻¹' closure f ⊆ bd Y := hcut.2.2.2.2 + have hW : IsClosed (G.U \ f) := isClosed_U_sdiff_edge G hf + have hvfact : ∀ {C : Set Y}, C ⊆ ψ ⁻¹' closure f → ∀ y ∈ C, ψ y ∈ G.U \ f → ψ y = v := + fun hC y hy hyW => loop_facts hS hf hcap _ (hC hy) hyW + have hpush : ∀ {C C' : Set Y}, IsOArc C → C ⊆ ψ ⁻¹' closure f → IsClosed C' → Disjoint C C' + → ψ ⁻¹' closure f ⊆ C ∪ C' → + ∃ H, IsSidePush ψ (closure f) (G.U \ f) v C H := fun {C C'} h1 h2 h3 h4 h5 => + exists_side_push hY hψ h1 (h2.trans hbdF) h3 h4 h5 hW (hvfact h2) hvW + rcases hcase with ⟨X, X', hdis, hXu, hXO, hXO', hXb, hXb'⟩ | hC + · -- Two lifts of the loop: each one lies on its own `O`-arc. + have main : ∀ {X X' : Set Y}, Disjoint X X' → X ∪ X' = ψ ⁻¹' closure f → IsOArc X → IsOArc X' + → BijOn ψ X (closure f) → + BijOn ψ X' (closure f) → (∀ t, ξ t ∈ X) → (∀ t, η t ∈ X') → + ∃ K : Set S, IsSolid K ∧ IsConnected K ∧ G.IsNormal K ∧ G.V ∩ K ⊆ {v} ∧ ¬ IsPlanar K ∧ + ∀ x ∈ f, ∀ ρ ∈ G.R, x ∈ closure ρ → (ρ ∩ K).Nonempty := by + intro X X' hdis hXu hXO hXO' hXb hXb' hξX hηX + have hsub : X ⊆ ψ ⁻¹' closure f := hXu ▸ subset_union_left + have hsub' : X' ⊆ ψ ⁻¹' closure f := hXu ▸ subset_union_right + obtain ⟨H₁, hp₁⟩ := hpush hXO hsub (isCompact_of_isOArc hXO').isClosed hdis hXu.ge + obtain ⟨H₂, hp₂⟩ := hpush hXO' hsub' (isCompact_of_isOArc hXO).isClosed hdis.symm + (by + rw [union_comm] + exact hXu.ge) + have hin : ∀ y ∈ X, ψ y ≠ v → y ∈ range ξ := fun y hy _ => by + obtain ⟨t, rfl | rfl⟩ := hcov y (hsub hy) + · exact mem_range_self t + · exact absurd (hηX t) (disjoint_left.mp hdis hy) + have hin' : ∀ y ∈ X', ψ y ≠ v → y ∈ range η := fun y hy _ => by + obtain ⟨t, rfl | rfl⟩ := hcov y (hsub' hy) + · exact absurd (hξX t) (disjoint_left.mp hdis.symm hy) + · exact mem_range_self t + refine sides_of_pushes hS hm hns hf hcap hO hoff hred hψ hsurj hinj hξ hη hξa hηa ha0 ha1 har + hai hane hcov hp₁ hp₂ hξX hηX + hsub hsub' (fun y hy hv' => ?_) fun y hy hv' => ?_ + · obtain ⟨t, rfl⟩ := hin y hy hv' + exact .inl ⟨t, rfl⟩ + · obtain ⟨t, rfl⟩ := hin' y hy hv' + exact .inr ⟨t, rfl⟩ + have hcX : IsClosed X := (isCompact_of_isOArc hXO).isClosed + have hcX' : IsClosed X' := (isCompact_of_isOArc hXO').isClosed + have hpre : IsPreconnected (range ξ) := isPreconnected_range hξ + have hrs : range ξ ⊆ X ∪ X' := by + rw [hXu] + rintro _ ⟨t, rfl⟩ + change ψ (ξ t) ∈ closure f + rw [hξa, ← har] + exact mem_range_self t + have hηin : ∀ t, η t ∈ X ∪ X' := fun t => by + rw [hXu] + change ψ (η t) ∈ closure f + rw [hηa, ← har] + exact mem_range_self t + rcases subset_or_subset_of_closed hpre hcX hcX' hrs (fun x _ hx hx' + => disjoint_left.mp hdis hx hx') with hsub | hsub + · refine main hdis hXu hXO hXO' hXb hXb' (fun t => hsub ⟨t, rfl⟩) fun t => + (hηin t).resolve_left fun hc => hne t ?_ + exact hXb.injOn (hsub ⟨t, rfl⟩) hc (by rw [hξa, hηa]) + · refine main hdis.symm (by rwa [union_comm]) hXO' hXO hXb' hXb + (fun t => hsub ⟨t, rfl⟩) fun t => + (hηin t).resolve_right fun hc => hne t ?_ + exact hXb'.injOn (hsub ⟨t, rfl⟩) hc (by rw [hξa, hηa]) + · -- One lift: the cuff goes twice around the loop. + obtain ⟨H, hp⟩ := hpush hC subset_rfl isClosed_empty (disjoint_empty _) subset_union_left + have hin : ∀ t, ξ t ∈ ψ ⁻¹' closure f := fun t => by + change ψ (ξ t) ∈ closure f + rw [hξa, ← har] + exact mem_range_self t + have hin' : ∀ t, η t ∈ ψ ⁻¹' closure f := fun t => by + change ψ (η t) ∈ closure f + rw [hηa, ← har] + exact mem_range_self t + have hK : ∀ y ∈ ψ ⁻¹' closure f, ψ y ≠ v → ψ (H (1, y)) ∈ (range fun t => ψ (H + (1, ξ t))) ∪ range fun t => ψ (H (1, η t)) := by + intro y hy _ + obtain ⟨t, rfl | rfl⟩ := hcov y hy + · exact .inl ⟨t, rfl⟩ + · exact .inr ⟨t, rfl⟩ + exact sides_of_pushes hS hm hns hf hcap hO hoff hred hψ hsurj hinj hξ hη hξa hηa ha0 ha1 har + hai hane hcov hp hp hin hin' + subset_rfl subset_rfl hK hK + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/MatchDiscs.lean b/LeanPool/GraphMinor/GM07/MatchDiscs.lean new file mode 100644 index 0000000000..84f01ef1ab --- /dev/null +++ b/LeanPool/GraphMinor/GM07/MatchDiscs.lean @@ -0,0 +1,842 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.ThickForest +public import LeanPool.GraphMinor.GM07.Section3 +public import LeanPool.GraphMinor.GM12.Section4FiniteLineDrawing +public import LeanPool.GraphMinor.Surface.Lunes +public import LeanPool.GraphMinor.Surface.DiscPolygon +public import LeanPool.GraphMinor.Surface.TriPath +public import LeanPool.GraphMinor.Surface.EdgeLoop +public import LeanPool.GraphMinor.Surface.CutLift + +/-! +# Cutting the boundaries of discs into a matching + +Graph Minors VII, (3.4), claim (1) (page 220), takes the boundary of a thin disc around a component +of a forest `H`, and cuts it at +the small pieces where the disc meets `bd(Σ)`. What is left is a set of lines, which form a +matching. This file does the cutting, on +a line (`exists_cut_line`) and on an `O`-arc (`exists_cut_oArc`). It also shows that a disc minus +some points of its boundary is +simply connected (`isSimplyConnected_disc_sdiff`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] + +/-- A closed disc minus some points of its boundary is simply connected and connected. -/ +theorem isSimplyConnected_disc_sdiff [T2Space S] {D B : Set S} (hD : IsClosedDisc D) + (hB : B ⊆ discBd D) : + IsSimplyConnectedSubset (D \ B) ∧ IsPreconnected (D \ B) := by + have hint : discInt D ⊆ D \ B := fun x hx => ⟨hx.1, fun h => hx.2 (hB h)⟩ + refine ⟨⟨fun a ha b hb hab => ?_, fun F hF hFZ => ?_⟩, ?_⟩ + · obtain ⟨h, g, c⟩ := hD.exists_isChart + have ha' := c.hm ha.1 + have hb' := c.hm hb.1 + have hne : h a ≠ h b := fun e => hab (c.gh.injOn ha.1 hb.1 e) + have hl := isLineWithEnds_segment hne + have hsub : segment ℝ (h a) (h b) ⊆ closedBall 0 1 := (convex_closedBall + (0 : ℂ) 1).segment_subset ha' hb' + have hline := hl.image_injOn (c.gc.mono hsub) (c.injOn.mono hsub) + rw [c.gh ha.1, c.gh hb.1] at hline + refine ⟨_, ?_, hline⟩ + rintro _ ⟨w, hw, rfl⟩ + refine ⟨c.gm (hsub hw), fun hwB => ?_⟩ + by_cases h1 : w = h a + · rw [h1, c.gh ha.1] at hwB + exact ha.2 hwB + by_cases h2 : w = h b + · rw [h2, c.gh hb.1] at hwB + exact hb.2 hwB + have hop : w ∈ openSegment ℝ (h a) (h b) := by + rw [← insert_endpoints_openSegment] at hw + rcases hw with e | e | e + · exact (h1 e).elim + · exact (h2 e).elim + · exact e + have hin : w ∈ interior (closedBall (0 : ℂ) 1) := + (strictConvex_closedBall ℝ (0 : ℂ) 1).openSegment_subset ha' hb' hne hop + rw [interior_closedBall _ one_ne_zero] at hin + have hs : h (g w) ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem _ (hB hwB) + rw [c.hg (hsub hw)] at hs + exact (ne_of_lt (mem_ball_zero_iff.mp hin)) (mem_sphere_zero_iff_norm.mp hs) + · obtain ⟨Δ, ⟨h1, h2, h3, -, h5, -⟩, -⟩ := disc_oArc D F hD (fun x hx => (hFZ hx).1) hF + refine ⟨Δ, h2, h3, fun x hx => ⟨h1 hx, fun hxB => ?_⟩⟩ + by_cases hxF : x ∈ F + · exact (hFZ hxF).2 hxB + · exact disjoint_left.mp h5 ⟨hx, hxF⟩ (hB hxB) + · exact hD.isPreconnected_discInt.subset_closure hint fun x hx => hD.subset_closure_discInt hx.1 + +/-- A connected set in the union of two closed sets, which misses their common part, lies in one of +them. -/ +theorem preconnected_side {J A B : Set S} (hJ : IsPreconnected J) (hA : IsClosed A) + (hB : IsClosed B) (hs : J ⊆ A ∪ B) + (hd : Disjoint J (A ∩ B)) : J ⊆ A ∨ J ⊆ B := by + by_contra hn + push Not at hn + obtain ⟨⟨x, hx, hxA⟩, ⟨y, hy, hyB⟩⟩ := (by simpa only [not_subset] using hn : + (∃ x ∈ J, x ∉ A) ∧ ∃ y ∈ J, y ∉ B) + have h1 := isPreconnected_closed_iff.mp hJ A B hA hB hs ⟨y, hy, (hs hy).resolve_right hyB⟩ ⟨x, + hx, (hs hx).resolve_left hxA⟩ + obtain ⟨z, hz, h2⟩ := h1 + exact disjoint_left.mp hd hz h2 + +variable [T2Space S] + +omit [T2Space S] in +/-- A line with distinct ends is the closure of the set of its inner points. -/ +theorem line_subset_of_inner {ℓ A : Set S} {s t : S} (hl : IsLineWithEnds ℓ s t) (hA : IsClosed A) + (h : ℓ \ {s, t} ⊆ A) : + ℓ ⊆ A := by + exact hl.subset_closure_diff.trans (closure_minimal h hA) + +/-- The ordered case of `exists_line_gap`. -/ +theorem exists_line_gap_aux {L ℓ L' L'' : Set S} {u v s t : S} (hℓ : IsLineWithEnds ℓ s t) + (hst : s ≠ t) (hv : v ∉ ℓ) + (h₁ : IsLineWithEnds L' u s) (h₂ : IsLineWithEnds L'' s v) (hU : L' ∪ L'' = L) (hI : L' ∩ L'' + = {s}) (ht : t ∈ L'') + (hsub : ℓ ⊆ L) : ∃ L₂, IsLineWithEnds L₂ t v ∧ L' ∪ ℓ ∪ L₂ = L ∧ L' ∩ ℓ = {s} ∧ L₂ ∩ ℓ = {t} + ∧ Disjoint L' L₂ := by + obtain ⟨M, L₂, hM, hL₂, hU', hI'⟩ := h₂.split ht hst.symm (fun e => hv (e ▸ hℓ.right_mem)) + have hinner : IsPreconnected (ℓ \ {s, t}) := hℓ.isPreconnected_diff + have hd : Disjoint (ℓ \ {s, t}) (L' ∩ L'') := by + rw [hI] + exact disjoint_left.mpr fun x hx h => hx.2 (.inl h) + have hs₂ : s ∉ L₂ := fun h => hst (by + have : s ∈ M ∩ L₂ := ⟨hM.left_mem, h⟩ + rwa [hI'] at this) + have hnot : ¬ ℓ \ {s, t} ⊆ L' := fun h => by + have h3 := line_subset_of_inner hℓ h₁.isCompact.isClosed h + have : t ∈ L' ∩ L'' := ⟨h3 hℓ.right_mem, ht⟩ + rw [hI] at this + exact hst this.symm + have h1 := (preconnected_side hinner h₁.isCompact.isClosed h₂.isCompact.isClosed (fun x hx + => hU ▸ hsub hx.1) hd).resolve_left hnot + rw [← hU'] at h1 + have hd' : Disjoint (ℓ \ {s, t}) (M ∩ L₂) := by + rw [hI'] + exact disjoint_left.mpr fun x hx h => hx.2 (.inr h) + have hMeq : ℓ = M := by + rcases preconnected_side hinner hM.isCompact.isClosed hL₂.isCompact.isClosed h1 hd' with h2 | h2 + · exact hM.eq_of_subset hℓ.isPreconnected_self (line_subset_of_inner hℓ hM.isCompact.isClosed + h2) hℓ.left_mem hℓ.right_mem + · exact (hs₂ (line_subset_of_inner hℓ hL₂.isCompact.isClosed h2 hℓ.left_mem)).elim + subst hMeq + have hdis : Disjoint L' L₂ := disjoint_left.mpr fun x h1 h2 => by + have : x ∈ L' ∩ L'' := ⟨h1, hU' ▸ .inr h2⟩ + rw [hI] at this + exact hs₂ (mem_singleton_iff.mp this ▸ h2) + refine ⟨L₂, hL₂, ?_, ?_, ?_, hdis⟩ + · rw [union_assoc, hU', hU] + · ext x + constructor + · rintro ⟨h3, h4⟩ + have : x ∈ L' ∩ L'' := ⟨h3, hU' ▸ .inl h4⟩ + rwa [hI] at this + · rintro rfl + exact ⟨h₁.right_mem, hℓ.left_mem⟩ + · rw [inter_comm, hI'] + +/-- A sub-line `ℓ` of a line `L` cuts `L` into two disjoint lines, one at each end of `L`, when it +misses the ends of `L`. -/ +theorem exists_line_gap {L ℓ : Set S} {u v s t : S} (hL : IsLineWithEnds L u v) + (hℓ : IsLineWithEnds ℓ s t) (hst : s ≠ t) (hsub : ℓ ⊆ L) + (hu : u ∉ ℓ) (hv : v ∉ ℓ) : + ∃ x y L₁ L₂, ((x = s ∧ y = t) ∨ (x = t ∧ y = s)) ∧ IsLineWithEnds L₁ u x + ∧ IsLineWithEnds L₂ y v ∧ L₁ ∪ ℓ ∪ L₂ = L ∧ + L₁ ∩ ℓ = {x} ∧ L₂ ∩ ℓ = {y} ∧ Disjoint L₁ L₂ := by + obtain ⟨L', L'', h₁, h₂, hU, hI⟩ := hL.split (hsub hℓ.left_mem) (fun e => hu (e ▸ hℓ.left_mem)) + (fun e => hv (e ▸ hℓ.left_mem)) + have ht : t ∈ L' ∪ L'' := hU ▸ hsub hℓ.right_mem + rcases ht with ht | ht + · have hU2 : L'' ∪ L' = L := by rw [union_comm, hU] + have hI2 : L'' ∩ L' = {s} := by rw [inter_comm, hI] + obtain ⟨L₂, h3, h4, h5, h6, h7⟩ := exists_line_gap_aux hℓ hst hu h₂.symm h₁.symm hU2 hI2 ht hsub + refine ⟨t, s, L₂, L'', .inr ⟨rfl, rfl⟩, h3.symm, h₂, ?_, h6, ?_, h7.symm⟩ + · rw [← h4] + ext x + simp only [mem_union] + tauto + · exact h5 + · obtain ⟨L₂, h3, h4, h5, h6, h7⟩ := exists_line_gap_aux hℓ hst hv h₁ h₂ hU hI ht hsub + exact ⟨s, t, L', L₂, .inl ⟨rfl, rfl⟩, h₁, h3, h4, h5, h6, h7⟩ + +/-- The result of cutting: lines `𝓐` in `L` with ends in `B`, pairwise disjoint, that cover `L` +apart from the inner points of the lines +`ℓ i` with `i ∈ I`, and that meet each `ℓ i` only at its ends. -/ +structure IsCut {ι : Type*} (ℓ : ι → Set S) (s t : ι → S) (I : Finset ι) (L B : Set S) (𝓐 : Set + (Set S)) : Prop where + finite : 𝓐.Finite + line : ∀ A ∈ 𝓐, ∃ a c, IsLineWithEnds A a c ∧ a ≠ c ∧ A ⊆ L ∧ A ∩ B = {a, c} + disj : ∀ A ∈ 𝓐, ∀ A' ∈ 𝓐, A ≠ A' → Disjoint A A' + cover : ∀ x ∈ L, (∃ A ∈ 𝓐, x ∈ A) ∨ ∃ i ∈ I, x ∈ ℓ i ∧ x ≠ s i ∧ x ≠ t i + meet : ∀ A ∈ 𝓐, ∀ i ∈ I, ∀ x ∈ A, x ∈ ℓ i → x = s i ∨ x = t i + +/-- The ends of the lines `ℓ i` with `i ∈ I`. -/ +def cutEnds {ι : Type*} (s t : ι → S) (I : Finset ι) : Set S := ⋃ i ∈ I, {s i, t i} + +/-- **Cutting a line.** A line `L` with sub-lines `ℓ i`, which are disjoint and miss the ends of +`L`, is cut into lines. -/ +theorem exists_cut_line {ι : Type*} {ℓ : ι → Set S} {s t : ι → S} + (hℓ : ∀ i, IsLineWithEnds (ℓ i) (s i) (t i)) + (hst : ∀ i, s i ≠ t i) (hdis : ∀ i j, i ≠ j → Disjoint (ℓ i) (ℓ j)) (n : ℕ) : + ∀ (I : Finset ι), I.card = n → ∀ (L : Set S) (u v : S), IsLineWithEnds L u v → u ≠ v → + (∀ i ∈ I, ℓ i ⊆ L ∧ u ∉ ℓ i ∧ v ∉ ℓ i) → + ∃ 𝓐, IsCut ℓ s t I L ({u, v} ∪ cutEnds s t I) 𝓐 := by + classical + induction n using Nat.strong_induction_on with + | _ n ih => + intro I hI L u v hL huv hsub + rcases I.eq_empty_or_nonempty with rfl | ⟨i₀, hi₀⟩ + · refine ⟨{L}, ⟨finite_singleton _, ?_, ?_, ?_, ?_⟩⟩ + · rintro A rfl + refine ⟨u, v, hL, huv, subset_rfl, ?_⟩ + ext x + simp only [cutEnds, Finset.notMem_empty, iUnion_of_empty, iUnion_empty, union_empty, + mem_inter_iff, mem_insert_iff, mem_singleton_iff] + constructor + · exact fun h => h.2 + · rintro (rfl | rfl) + · exact ⟨hL.left_mem, .inl rfl⟩ + · exact ⟨hL.right_mem, .inr rfl⟩ + · rintro A rfl A' rfl h + exact (h rfl).elim + · exact fun x hx => .inl ⟨L, rfl, hx⟩ + · exact fun _ _ i hi => by simp at hi + obtain ⟨hsub₀, hu₀, hv₀⟩ := hsub i₀ hi₀ + obtain ⟨x, y, L₁, L₂, hxy, h₁, h₂, hU, hI₁, hI₂, hD⟩ := exists_line_gap hL (hℓ i₀) + (hst i₀) hsub₀ hu₀ hv₀ + have hxm : x ∈ ℓ i₀ := by + have : x ∈ L₁ ∩ ℓ i₀ := hI₁ ▸ rfl + exact this.2 + have hym : y ∈ ℓ i₀ := by + have : y ∈ L₂ ∩ ℓ i₀ := hI₂ ▸ rfl + exact this.2 + have hLin₁ : L₁ ⊆ L := fun z hz => hU ▸ .inl (.inl hz) + have hLin₂ : L₂ ⊆ L := fun z hz => hU ▸ .inr hz + let I₁ := (I.erase i₀).filter fun i => ℓ i ⊆ L₁ + let I₂ := (I.erase i₀).filter fun i => ¬ ℓ i ⊆ L₁ + have hmem : ∀ {i}, i ∈ I → i ≠ i₀ → ℓ i ⊆ L₁ ∨ ℓ i ⊆ L₂ := fun {i} hi hne => by + have h0 : ℓ i ⊆ L₁ ∪ L₂ := fun z hz => by + have h3 : z ∈ L₁ ∪ ℓ i₀ ∪ L₂ := hU ▸ (hsub i hi).1 hz + rcases h3 with (h3 | h3) | h3 + · exact .inl h3 + · exact (disjoint_left.mp (hdis i i₀ hne) hz h3).elim + · exact .inr h3 + exact preconnected_side (hℓ i).isPreconnected_self h₁.isCompact.isClosed h₂.isCompact.isClosed + h0 + (by rw [disjoint_iff_inter_eq_empty.mp hD]; exact disjoint_empty _) + have hc₁ : I₁.card < n := by + have h3 : I₁.card ≤ (I.erase i₀).card := Finset.card_filter_le _ _ + rw [Finset.card_erase_of_mem hi₀] at h3 + have := Finset.card_pos.mpr ⟨i₀, hi₀⟩ + omega + have hc₂ : I₂.card < n := by + have h3 : I₂.card ≤ (I.erase i₀).card := Finset.card_filter_le _ _ + rw [Finset.card_erase_of_mem hi₀] at h3 + have := Finset.card_pos.mpr ⟨i₀, hi₀⟩ + omega + have hmem₁ : ∀ {i}, i ∈ I₁ → i ∈ I ∧ i ≠ i₀ ∧ ℓ i ⊆ L₁ := fun {i} hi => by + have := Finset.mem_filter.mp hi + exact ⟨(Finset.mem_erase.mp this.1).2, (Finset.mem_erase.mp this.1).1, this.2⟩ + have hmem₂ : ∀ {i}, i ∈ I₂ → i ∈ I ∧ i ≠ i₀ ∧ ℓ i ⊆ L₂ := fun {i} hi => by + have := Finset.mem_filter.mp hi + have h3 := (Finset.mem_erase.mp this.1) + exact ⟨h3.2, h3.1, (hmem h3.2 h3.1).resolve_left this.2⟩ + have hoff : ∀ {i z}, i ≠ i₀ → z ∈ ℓ i₀ → z ∉ ℓ i := fun {i z} hne h1 h2 => disjoint_left.mp + (hdis i i₀ hne) h2 h1 + obtain ⟨𝓐₁, c₁⟩ := ih _ hc₁ I₁ rfl L₁ u x h₁ (fun e => hu₀ (e ▸ hxm)) fun i hi => by + obtain ⟨a1, a2, a3⟩ := hmem₁ hi + exact ⟨a3, (hsub i a1).2.1, hoff a2 hxm⟩ + obtain ⟨𝓐₂, c₂⟩ := ih _ hc₂ I₂ rfl L₂ y v h₂ (fun e => hv₀ (e ▸ hym)) fun i hi => by + obtain ⟨a1, a2, a3⟩ := hmem₂ hi + exact ⟨a3, hoff a2 hym, (hsub i a1).2.2⟩ + have hxy' : ∀ z, z = s i₀ ∨ z = t i₀ → z ∈ L₁ → z = x := fun z hz h1 => by + have : z ∈ ℓ i₀ := by + rcases hz with rfl | rfl + · exact (hℓ i₀).left_mem + · exact (hℓ i₀).right_mem + have h2 : z ∈ L₁ ∩ ℓ i₀ := ⟨h1, this⟩ + rwa [hI₁] at h2 + have hyy' : ∀ z, z = s i₀ ∨ z = t i₀ → z ∈ L₂ → z = y := fun z hz h1 => by + have : z ∈ ℓ i₀ := by + rcases hz with rfl | rfl + · exact (hℓ i₀).left_mem + · exact (hℓ i₀).right_mem + have h2 : z ∈ L₂ ∩ ℓ i₀ := ⟨h1, this⟩ + rwa [hI₂] at h2 + have hsplit : ∀ i ∈ I, i = i₀ ∨ i ∈ I₁ ∨ i ∈ I₂ := fun i hi => by + by_cases h : i = i₀ + · exact .inl h + · refine .inr ?_ + by_cases h2 : ℓ i ⊆ L₁ + · exact .inl (Finset.mem_filter.mpr ⟨Finset.mem_erase.mpr ⟨h, hi⟩, h2⟩) + · exact .inr (Finset.mem_filter.mpr ⟨Finset.mem_erase.mpr ⟨h, hi⟩, h2⟩) + have hends : ∀ {i z}, z ∈ ({s i, t i} : Set S) → z ∈ ℓ i := fun {i z} hz => by + rcases hz with rfl | rfl + · exact (hℓ i).left_mem + · exact (hℓ i).right_mem + have hxB : x = s i₀ ∨ x = t i₀ := by tauto + have hyB : y = s i₀ ∨ y = t i₀ := by tauto + have hend₁ : ∀ i ∈ I₁, ∀ z ∈ ({s i, t i} : Set S), z ∈ cutEnds s t I := fun i hi z hz => + mem_iUnion₂.mpr ⟨i, (hmem₁ hi).1, hz⟩ + have hend₂ : ∀ i ∈ I₂, ∀ z ∈ ({s i, t i} : Set S), z ∈ cutEnds s t I := fun i hi z hz => + mem_iUnion₂.mpr ⟨i, (hmem₂ hi).1, hz⟩ + have hex : x ∈ cutEnds s t I := mem_iUnion₂.mpr ⟨i₀, hi₀, hxB⟩ + have hey : y ∈ cutEnds s t I := mem_iUnion₂.mpr ⟨i₀, hi₀, hyB⟩ + refine ⟨𝓐₁ ∪ 𝓐₂, ⟨c₁.finite.union c₂.finite, ?_, ?_, ?_, ?_⟩⟩ + · rintro A (hA | hA) + · obtain ⟨a, c, h3, h4, h5, h6⟩ := c₁.line A hA + refine ⟨a, c, h3, h4, h5.trans hLin₁, ?_⟩ + rw [← h6] + ext z + constructor + · rintro ⟨hz, h7⟩ + refine ⟨hz, ?_⟩ + rcases h7 with (rfl | rfl) | h7 + · exact .inl (.inl rfl) + · exact (disjoint_left.mp hD (h5 hz) h₂.right_mem).elim + · obtain ⟨i, hi, hzi⟩ := mem_iUnion₂.mp h7 + rcases hsplit i hi with rfl | h8 | h8 + · exact .inl (.inr (hxy' z hzi (h5 hz))) + · exact .inr (mem_iUnion₂.mpr ⟨i, h8, hzi⟩) + · exact (disjoint_left.mp hD (h5 hz) ((hmem₂ h8).2.2 (hends hzi))).elim + · rintro ⟨hz, h7⟩ + refine ⟨hz, ?_⟩ + rcases h7 with (rfl | rfl) | h7 + · exact .inl (.inl rfl) + · exact .inr hex + · obtain ⟨i, hi, hzi⟩ := mem_iUnion₂.mp h7 + exact .inr (hend₁ i hi z hzi) + · obtain ⟨a, c, h3, h4, h5, h6⟩ := c₂.line A hA + refine ⟨a, c, h3, h4, h5.trans hLin₂, ?_⟩ + rw [← h6] + ext z + constructor + · rintro ⟨hz, h7⟩ + refine ⟨hz, ?_⟩ + rcases h7 with (rfl | rfl) | h7 + · exact (disjoint_left.mp hD h₁.left_mem (h5 hz)).elim + · exact .inl (.inr rfl) + · obtain ⟨i, hi, hzi⟩ := mem_iUnion₂.mp h7 + rcases hsplit i hi with rfl | h8 | h8 + · exact .inl (.inl (hyy' z hzi (h5 hz))) + · exact (disjoint_left.mp hD ((hmem₁ h8).2.2 (hends hzi)) (h5 hz)).elim + · exact .inr (mem_iUnion₂.mpr ⟨i, h8, hzi⟩) + · rintro ⟨hz, h7⟩ + refine ⟨hz, ?_⟩ + rcases h7 with (rfl | rfl) | h7 + · exact .inr hey + · exact .inl (.inr rfl) + · obtain ⟨i, hi, hzi⟩ := mem_iUnion₂.mp h7 + exact .inr (hend₂ i hi z hzi) + · have hsubA : ∀ A ∈ 𝓐₁, A ⊆ L₁ := fun A hA => by + obtain ⟨a, c, -, -, h5, -⟩ := c₁.line A hA + exact h5 + have hsubB : ∀ A ∈ 𝓐₂, A ⊆ L₂ := fun A hA => by + obtain ⟨a, c, -, -, h5, -⟩ := c₂.line A hA + exact h5 + rintro A (hA | hA) A' (hA' | hA') hne + · exact c₁.disj A hA A' hA' hne + · exact hD.mono (hsubA A hA) (hsubB A' hA') + · exact (hD.mono (hsubA A' hA') (hsubB A hA)).symm + · exact c₂.disj A hA A' hA' hne + · intro z hz + have h3 : z ∈ L₁ ∪ ℓ i₀ ∪ L₂ := hU ▸ hz + have lhs : z ∈ L₁ → (∃ A ∈ 𝓐₁ ∪ 𝓐₂, z ∈ A) ∨ ∃ i ∈ I, z ∈ ℓ i ∧ z ≠ s i ∧ z ≠ t i := fun h4 + => by + rcases c₁.cover z h4 with ⟨A, hA, h5⟩ | ⟨i, hi, h5⟩ + · exact .inl ⟨A, .inl hA, h5⟩ + · exact .inr ⟨i, (hmem₁ hi).1, h5⟩ + have rhs : z ∈ L₂ → (∃ A ∈ 𝓐₁ ∪ 𝓐₂, z ∈ A) ∨ ∃ i ∈ I, z ∈ ℓ i ∧ z ≠ s i ∧ z ≠ t i := fun h4 + => by + rcases c₂.cover z h4 with ⟨A, hA, h5⟩ | ⟨i, hi, h5⟩ + · exact .inl ⟨A, .inr hA, h5⟩ + · exact .inr ⟨i, (hmem₂ hi).1, h5⟩ + rcases h3 with (h3 | h3) | h3 + · exact lhs h3 + · by_cases h4 : z = x + · exact lhs (h4 ▸ h₁.right_mem) + by_cases h5 : z = y + · exact rhs (h5 ▸ h₂.left_mem) + refine .inr ⟨i₀, hi₀, h3, fun e => ?_, fun e => ?_⟩ + · rcases hxy with ⟨h6, h7⟩ | ⟨h6, h7⟩ + · exact h4 (e.trans h6.symm) + · exact h5 (e.trans h7.symm) + · rcases hxy with ⟨h6, h7⟩ | ⟨h6, h7⟩ + · exact h5 (e.trans h7.symm) + · exact h4 (e.trans h6.symm) + · exact rhs h3 + · rintro A (hA | hA) i hi z hz hzi + · obtain ⟨a, c, -, -, h5, -⟩ := c₁.line A hA + rcases hsplit i hi with rfl | h8 | h8 + · have : z ∈ L₁ ∩ ℓ i := ⟨h5 hz, hzi⟩ + rw [hI₁] at this + exact (mem_singleton_iff.mp this).symm ▸ hxB + · exact c₁.meet A hA i h8 z hz hzi + · exact (disjoint_left.mp hD (h5 hz) ((hmem₂ h8).2.2 hzi)).elim + · obtain ⟨a, c, -, -, h5, -⟩ := c₂.line A hA + rcases hsplit i hi with rfl | h8 | h8 + · have : z ∈ L₂ ∩ ℓ i := ⟨h5 hz, hzi⟩ + rw [hI₂] at this + exact (mem_singleton_iff.mp this).symm ▸ hyB + · exact (disjoint_left.mp hD ((hmem₁ h8).2.2 hzi) (h5 hz)).elim + · exact c₂.meet A hA i h8 z hz hzi + +/-- **Cutting an `O`-arc.** An `O`-arc with disjoint sub-lines `ℓ i` for `i ∈ I`, where `I` is not +empty, is cut into lines. -/ +theorem exists_cut_oArc {ι : Type*} {ℓ : ι → Set S} {s t : ι → S} + (hℓ : ∀ i, IsLineWithEnds (ℓ i) (s i) (t i)) + (hst : ∀ i, s i ≠ t i) (hdis : ∀ i j, i ≠ j → Disjoint (ℓ i) (ℓ j)) {F : Set S} + (hF : IsOArc F) {I : Finset ι} (hne : I.Nonempty) + (hsub : ∀ i ∈ I, ℓ i ⊆ F) : ∃ 𝓐, IsCut ℓ s t I F (cutEnds s t I) 𝓐 := by + classical + obtain ⟨i₀, hi₀⟩ := hne + have hm : s i₀ ∈ F := hsub i₀ hi₀ (hℓ i₀).left_mem + have hm' : t i₀ ∈ F := hsub i₀ hi₀ (hℓ i₀).right_mem + obtain ⟨A, B, hA, hB, hU, hI⟩ := hF.lines hm hm' (hst i₀) + have hd : Disjoint (ℓ i₀ \ {s i₀, t i₀}) (A ∩ B) := by + rw [hI] + exact disjoint_left.mpr fun x hx h => hx.2 h + have key : ∃ L, IsLineWithEnds L (s i₀) (t i₀) ∧ L ∪ ℓ i₀ = F ∧ L ∩ ℓ i₀ = {s i₀, t i₀} := by + rcases preconnected_side (hℓ i₀).isPreconnected_diff hA.isCompact.isClosed hB.isCompact.isClosed + (fun x hx => hU ▸ hsub i₀ hi₀ hx.1) hd with h | h + · have e := hA.eq_of_subset (hℓ i₀).isPreconnected_self (line_subset_of_inner + (hℓ i₀) hA.isCompact.isClosed h) + (hℓ i₀).left_mem (hℓ i₀).right_mem + rw [e] + exact ⟨B, hB, by rw [union_comm, hU], by rw [inter_comm, hI]⟩ + · have e := hB.eq_of_subset (hℓ i₀).isPreconnected_self (line_subset_of_inner + (hℓ i₀) hB.isCompact.isClosed h) + (hℓ i₀).left_mem (hℓ i₀).right_mem + rw [e] + exact ⟨A, hA, hU, hI⟩ + obtain ⟨L, hL, hLU, hLI⟩ := key + have hoff : ∀ {i z}, i ≠ i₀ → z ∈ ℓ i₀ → z ∉ ℓ i := fun {i z} hne h1 h2 => disjoint_left.mp + (hdis i i₀ hne) h2 h1 + obtain ⟨𝓐, c⟩ := exists_cut_line hℓ hst hdis _ (I.erase i₀) rfl L _ _ hL (hst i₀) fun i hi => by + obtain ⟨h1, h2⟩ := Finset.mem_erase.mp hi + refine ⟨fun z hz => ?_, hoff h1 (hℓ i₀).left_mem, hoff h1 (hℓ i₀).right_mem⟩ + have : z ∈ L ∪ ℓ i₀ := hLU ▸ hsub i h2 hz + exact this.resolve_right (hoff h1 · hz) + refine ⟨𝓐, ⟨c.finite, fun A hA => ?_, c.disj, fun x hx => ?_, fun A hA i hi x hx hxi => ?_⟩⟩ + · obtain ⟨a, b, h1, h2, h3, h4⟩ := c.line A hA + refine ⟨a, b, h1, h2, h3.trans (hLU ▸ subset_union_left), ?_⟩ + rw [← h4] + ext z + constructor + · rintro ⟨hz, h5⟩ + refine ⟨hz, ?_⟩ + obtain ⟨i, hi, hzi⟩ := mem_iUnion₂.mp h5 + by_cases h : i = i₀ + · subst h + exact .inl hzi + · exact .inr (mem_iUnion₂.mpr ⟨i, Finset.mem_erase.mpr ⟨h, hi⟩, hzi⟩) + · rintro ⟨hz, h5⟩ + refine ⟨hz, ?_⟩ + rcases h5 with h5 | h5 + · exact mem_iUnion₂.mpr ⟨i₀, hi₀, h5⟩ + · obtain ⟨i, hi, hzi⟩ := mem_iUnion₂.mp h5 + exact mem_iUnion₂.mpr ⟨i, (Finset.mem_erase.mp hi).2, hzi⟩ + · have h1 : x ∈ L ∪ ℓ i₀ := hLU ▸ hx + by_cases hx₀ : x ∈ L + · rcases c.cover x hx₀ with h | ⟨i, hi, h⟩ + · exact .inl h + · exact .inr ⟨i, (Finset.mem_erase.mp hi).2, h⟩ + · have h2 := h1.resolve_left hx₀ + refine .inr ⟨i₀, hi₀, h2, fun e => hx₀ (e ▸ hL.left_mem), fun e => hx₀ (e ▸ hL.right_mem)⟩ + · by_cases h : i = i₀ + · obtain ⟨a, b, -, -, h3, -⟩ := c.line A hA + have : x ∈ L ∩ ℓ i₀ := ⟨h3 hx, h ▸ hxi⟩ + rw [hLI] at this + rw [h] + exact this + · exact c.meet A hA i (Finset.mem_erase.mpr ⟨h, hi⟩) x hx hxi + +private theorem matching_drawing_has_valency_one + {S : Type} + [TopologicalSpace S] + (𝓑 : Set (Set S)) (V : Set S) + (hAdisj : ∀ A ∈ 𝓑, ∀ A' ∈ 𝓑, A ≠ A' → Disjoint A A') + (ea : Set S → S) + (eb : Set S → S) + (G : Drawing S) + (hGV : G.V = V) + (hGE : G.E = (fun i => id i \ {ea i, eb i}) '' 𝓑) + (hAclo : ∀ A ∈ 𝓑, closure (A \ {ea A, eb A}) = A) + (htilde : ∀ A ∈ 𝓑, (tilde (A \ {ea A, eb A})).ncard = 2) + (hexA : ∀ v ∈ V, ∃ A ∈ 𝓑, v ∈ A) : + ∀ v ∈ V, vertexValency G v = 1 := by + intro v hv + obtain ⟨A, hA, hvA⟩ := hexA v hv + have h1 : {e ∈ G.E | G.VertexIncident v e ∧ (tilde e).ncard = 2} = {A \ {ea A, eb A}} := by + ext e + simp only [mem_ofPred_eq, mem_singleton_iff] + constructor + · rintro ⟨h2, ⟨-, -, h3⟩, -⟩ + rw [hGE] at h2 + obtain ⟨A', hA', rfl⟩ := h2 + simp only [id] at h3 ⊢ + rw [hAclo A' hA'] at h3 + by_cases h : A = A' + · rw [h] + · exact (disjoint_left.mp (hAdisj A hA A' hA' h) hvA h3).elim + · rintro rfl + have hmem : A \ {ea A, eb A} ∈ G.E := hGE ▸ ⟨A, hA, rfl⟩ + refine ⟨hmem, ⟨hGV ▸ hv, .inl hmem, ?_⟩, htilde A hA⟩ + rw [hAclo A hA] + exact hvA + have h2 : {e ∈ G.E | G.VertexIncident v e ∧ (tilde e).ncard = 1} = ∅ := by + ext e + simp only [mem_ofPred_eq, mem_empty_iff_false, iff_false, not_and] + rintro h3 - h4 + rw [hGE] at h3 + obtain ⟨A', hA', rfl⟩ := h3 + have := htilde A' hA' + simp only [id] at h4 + omega + unfold vertexValency + rw [h1, h2, ncard_singleton, ncard_empty] + +private theorem matching_disc_complement_is_simply_connected_region + {S : Type} + [TopologicalSpace S] + [T2Space S] + {Y : Set S} + {c : S → Set S} + {ℓ : S → Set S} + {s : S → S} + {t : S → S} + (hd : ∀ y ∈ Y, IsClosedDisc (c y)) + (hop : ∀ y ∈ Y, IsOpen (discInt (c y))) + (hℓ : ∀ y ∈ Y, IsLineWithEnds (ℓ y) (s y) (t y) ∧ s y ≠ t y ∧ ℓ y ⊆ discBd (c y) ∧ ℓ y ⊆ bd S + ∧ y ∈ ℓ y ∧ y ≠ s y ∧ y ≠ t y ∧ ∃ O, IsOpen O ∧ ℓ y \ {s y, t y} ⊆ O ∧ O ⊆ c y) + (hsame : ∀ {u v z : S}, u ∈ Y → v ∈ Y → z ∈ c u → z ∈ c v → c u = c v) + (I : Set S → Finset Y) (hI : ∀ D i, i ∈ I D → c i.1 = D) + (𝓐 : ↑(range fun i : Y => c i.1) → Set (Set S)) + (hC : ∀ (D : ↑(range fun i : Y => c i.1)), + IsCut (fun i : Y => ℓ i.1) (fun i : Y => s i.1) (fun i : Y => t i.1) (I ↑D) (discBd ↑D) + (cutEnds (fun i : Y => s i.1) (fun i : Y => t i.1) (I ↑D)) (𝓐 D)) + (V : Set S) + (G : Drawing S) + (hGU : G.U = V ∪ ⋃ i ∈ (⋃ D, 𝓐 D), id i) + (hUbd : ∀ z ∈ G.U, ∃ i : Y, z ∈ discBd (c i.1)) + (hyn : ∀ (i : ↑Y), ↑i ∉ G.U) : + ∀ (y : ↑Y), c ↑y \ G.U ∈ G.R ∧ IsSimplyConnectedSubset (c ↑y \ G.U) := by + let ℓ' := fun i : Y => ℓ i.1 + let s' := fun i : Y => s i.1 + let t' := fun i : Y => t i.1 + let 𝒟 := range fun i : Y => c i.1 + intro y + have hDy := hd _ y.2 + have hyc := (hℓ y y.2).2.2.1 |>.trans (GM11.discBd_subset _) (hℓ y y.2).2.2.2.2.1 + have hin : c y.1 ∩ G.U ⊆ discBd (c y.1) := fun z hz => by + obtain ⟨i, hi⟩ := hUbd z hz.2 + have h1 := hsame y.2 i.2 hz.1 (GM11.discBd_subset _ hi) + exact h1 ▸ hi + have hrw : c y.1 \ G.U = c y.1 \ (c y.1 ∩ G.U) := by simp + have h1 := isSimplyConnected_disc_sdiff hDy hin + rw [← hrw] at h1 + refine ⟨?_, h1.1⟩ + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem (hyn y) + have hrU : Disjoint r G.U := disjoint_left.mpr fun z h2 h3 => by + obtain ⟨z', -, rfl⟩ := (mem_R_iff G).mp hr + exact (connectedComponentIn_subset _ _ h2).2 h3 + have hsub : c y.1 \ G.U ⊆ r := subset_region hr h1.2 (disjoint_left.mpr fun z h2 h3 + => h2.2 h3) ⟨hyc, hyn y⟩ hyr + obtain ⟨-, -, -, -, -, -, -, hO⟩ := hℓ y y.2 + let D : 𝒟 := ⟨c y.1, y, rfl⟩ + have hOi : ∀ i : Y, ∃ O, IsOpen O ∧ ℓ' i \ {s' i, t' i} ⊆ O ∧ O ⊆ c i.1 := fun i => + (hℓ i i.2).2.2.2.2.2.2.2 + choose Ω hΩo hΩs hΩc using hOi + let W : Set S := discInt (c y.1) ∪ ⋃ i ∈ I D.1, Ω i + have hWo : IsOpen W := (hop _ y.2).union (isOpen_biUnion fun i _ => hΩo i) + have hWc : W ⊆ c y.1 := by + rintro z (hz | hz) + · exact hz.1 + · obtain ⟨i, hi, h2⟩ := mem_iUnion₂.mp hz + have := hΩc i h2 + rwa [hI _ _ hi] at this + have hcovW : c y.1 \ G.U ⊆ W := fun z hz => by + by_cases h2 : z ∈ discBd (c y.1) + · refine .inr ?_ + rcases (hC D).cover z h2 with ⟨A, hA, h3⟩ | ⟨i, hi, h3, h4, h5⟩ + · exact (hz.2 (hGU ▸ .inr (mem_iUnion₂.mpr ⟨A, mem_iUnion.mpr ⟨D, hA⟩, h3⟩))).elim + · refine mem_iUnion₂.mpr ⟨i, hi, hΩs i ⟨h3, ?_⟩⟩ + rintro (h6 | h6) + · exact h4 h6 + · exact h5 h6 + · exact .inl ⟨hz.1, h2⟩ + have hrc : r ⊆ c y.1 := by + have hconn : IsPreconnected r := by + obtain ⟨z', -, rfl⟩ := (mem_R_iff G).mp hr + exact isPreconnected_connectedComponentIn + have hs : r ⊆ c y.1 ∪ Wᶜ := fun z hz => by + by_cases h2 : z ∈ W + · exact .inl (hWc h2) + · exact .inr h2 + have hd2 : Disjoint r (c y.1 ∩ Wᶜ) := disjoint_left.mpr fun z h2 h3 => + h3.2 (hcovW ⟨h3.1, disjoint_left.mp hrU h2⟩) + refine (preconnected_side hconn hDy.isClosed hWo.isClosed_compl hs hd2).resolve_right fun h2 + => h2 hyr (hcovW ⟨hyc, hyn y⟩) + have : r = c y.1 \ G.U := subset_antisymm (fun z hz => ⟨hrc hz, disjoint_left.mp hrU hz⟩) hsub + exact this ▸ hr + +private theorem connected_drawing_subset_of_closed_edge_condition + {S : Type} [TopologicalSpace S] (H' : Drawing S) {D : Set S} {y : S} + (hyV : y ∈ H'.V) (hyc : y ∈ D) (hconn : H'.IsConnected) + (hcl : ∀ e ∈ H'.E, ∀ u ∈ H'.V, u ∈ closure e → u ∈ D → closure e ⊆ D) : + H'.U ⊆ D := by + have hlink : ∀ {a b}, ∀ _ : GraphWalk H'.toGraph a b, a ∈ H'.V → a ∈ D → b ∈ D := by + intro a b W + induction W with + | nil _ => exact fun _ h => h + | @cons x w z e₀ h _ ih => + intro hx hxc + obtain ⟨he, hx', hw', hcap⟩ := h + have hxw : x ∈ ({x, w} : Set S) ∧ w ∈ ({x, w} : Set S) := ⟨.inl rfl, .inr rfl⟩ + rw [← hcap] at hxw + exact ih hw' (hcl _ he x hx' hxw.1.1 hxc hxw.2.1) + have hcy : ∀ v ∈ H'.V, v ∈ D := fun v hv => by + obtain ⟨W⟩ := hconn.2 y hyV v hv + exact hlink W hyV hyc + intro z hz + by_cases hzV : z ∈ H'.V + · exact hcy z hzV + · obtain ⟨e, he, hze⟩ := H'.exists_edge_of_mem hz hzV + obtain ⟨u, huc, huV⟩ : ∃ u ∈ closure e, u ∈ H'.V := by + rcases H'.edge_cond e he with ⟨u, v, -, hcap, -⟩ | ⟨u, hcap, -⟩ + · exact ⟨u, (hcap ▸ (Or.inl rfl) : u ∈ closure e ∩ H'.V)⟩ + · exact ⟨u, (hcap ▸ rfl : u ∈ closure e ∩ H'.V)⟩ + exact hcl e he u huV huc (hcy u huV) (subset_closure hze) + +/-- **The matching around discs.** Given discs `c y` for `y ∈ Y`, and pieces `ℓ y` of their +boundaries, the lines left when we cut the +boundaries at the `ℓ y` form a matching `G`. It strictly surrounds every drawing `H` with `V(H) ∩ +bd(Σ) = Y` that respects the discs: +points of `Y` in one disc are joined in `H`, an edge of `H` that has an end in a disc lies in this +disc, and `H` meets the boundaries of +the discs only in `Y`. -/ +theorem exists_matching_of_discs {Y : Set S} (hYf : Y.Finite) {c ℓ : S → Set S} {s t : S → S} + (hd : ∀ y ∈ Y, IsClosedDisc (c y)) (hop : ∀ y ∈ Y, IsOpen (discInt (c y))) + (hdis : ∀ u ∈ Y, ∀ v ∈ Y, c u ≠ c v → Disjoint (c u) (c v)) + (hℓ : ∀ y ∈ Y, IsLineWithEnds (ℓ y) (s y) (t y) ∧ s y ≠ t y ∧ ℓ y ⊆ discBd (c y) ∧ ℓ y ⊆ bd S + ∧ y ∈ ℓ y ∧ y ≠ s y ∧ y ≠ t y ∧ + ∃ O, IsOpen O ∧ ℓ y \ {s y, t y} ⊆ O ∧ O ⊆ c y) + (hℓd : ∀ y ∈ Y, ∀ y' ∈ Y, y ≠ y' → Disjoint (ℓ y) (ℓ y')) (hbd : ∀ y ∈ Y, c y ∩ bd S ⊆ ⋃ y' ∈ + Y, ℓ y') : + ∃ G : Drawing S, IsMatching G ∧ G.V = (⋃ y ∈ Y, {s y, t y}) ∧ G.U ⊆ ⋃ y ∈ Y, discBd (c y) + ∧ ∀ H : Drawing S, H.V ∩ bd S = Y → + (∀ u ∈ Y, ∀ v ∈ Y, c u = c v → Nonempty (GraphWalk H.toGraph u v)) → + (∀ e ∈ H.E, ∀ u ∈ H.V, ∀ y ∈ Y, u ∈ closure e → u ∈ c y → closure e ⊆ c y) → + (∀ y ∈ Y, ∀ z ∈ H.U, z ∈ discBd (c y) → z ∈ Y) → MatchingStrictlySurroundsForest G H := by + classical + rcases isEmpty_or_nonempty S with hE | hN + · refine ⟨GM07.emptyDrawing S, ⟨fun x => (hE.false x).elim, fun x => (hE.false x).elim, + fun x => (hE.false x).elim⟩, ?_, ?_, fun H _ _ _ _ => ⟨⟨?_, ?_⟩, ?_⟩⟩ + · ext x + exact (hE.false x).elim + · intro x + exact (hE.false x).elim + · ext x + exact (hE.false x).elim + · rintro H' - - ⟨x, -⟩ + exact (hE.false x).elim + · intro x + exact (hE.false x).elim + have : Inhabited S := ⟨hN.some⟩ + have hYfin : Y.Finite := hYf + have : Finite Y := hYfin.to_subtype + have : Fintype Y := Fintype.ofFinite _ + let ℓ' : Y → Set S := fun i => ℓ i.1 + let s' : Y → S := fun i => s i.1 + let t' : Y → S := fun i => t i.1 + have hℓ' : ∀ i : Y, IsLineWithEnds (ℓ' i) (s' i) (t' i) := fun i => (hℓ i i.2).1 + have hst' : ∀ i : Y, s' i ≠ t' i := fun i => (hℓ i i.2).2.1 + have hdis' : ∀ i j : Y, i ≠ j → Disjoint (ℓ' i) (ℓ' j) := fun i j h => + hℓd _ i.2 _ j.2 fun e => h (Subtype.ext e) + have hsame : ∀ {u v z}, u ∈ Y → v ∈ Y → z ∈ c u → z ∈ c v → c u = c v := fun {u v z} hu hv h1 h2 + => by + by_contra hn + exact disjoint_left.mp (hdis u hu v hv hn) h1 h2 + have hℓc : ∀ i : Y, ∀ z ∈ ℓ' i, z ∈ discBd (c i.1) := fun i z hz => (hℓ i i.2).2.2.1 hz + let 𝒟 : Set (Set S) := range fun i : Y => c i.1 + have h𝒟fin : 𝒟.Finite := finite_range _ + have : Finite 𝒟 := h𝒟fin.to_subtype + let I : Set S → Finset Y := fun D => Finset.univ.filter fun i => c i.1 = D + have hcut : ∀ D : 𝒟, ∃ 𝓐, IsCut ℓ' s' t' (I D.1) (discBd D.1) (cutEnds s' t' (I D.1)) 𝓐 := by + rintro ⟨_, y, rfl⟩ + refine exists_cut_oArc hℓ' hst' hdis' (hd _ y.2).isOArc_discBd ⟨y, + by simp [I]⟩ fun i hi z hz => ?_ + have := hℓc i z hz + rwa [(Finset.mem_filter.mp hi).2] at this + choose 𝓐 hC using hcut + let 𝓑 : Set (Set S) := ⋃ D, 𝓐 D + have h𝓑fin : 𝓑.Finite := finite_iUnion fun D => (hC D).finite + let V : Set S := ⋃ y ∈ Y, {s y, t y} + have hVfin : V.Finite := hYfin.biUnion fun y _ => by simp + have hDc : ∀ D : 𝒟, ∃ y : Y, c y.1 = D.1 := fun D => D.2 + have hAsub : ∀ {D A}, A ∈ 𝓐 D → A ⊆ discBd D.1 := fun {D A} hA => by + obtain ⟨a, b, -, -, h3, -⟩ := (hC D).line A hA + exact h3 + have hclass : ∀ (D : 𝒟) (i : Y) z, z ∈ discBd D.1 → z ∈ ℓ' i → i ∈ I D.1 := fun D i z h1 h2 => by + obtain ⟨y, hy⟩ := hDc D + have h3 : z ∈ c y.1 := hy ▸ GM11.discBd_subset _ h1 + have h4 := hsame i.2 y.2 (GM11.discBd_subset _ (hℓc i z h2)) h3 + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, h4.trans hy⟩ + have hVend : ∀ {z}, z ∈ V → ∃ i : Y, (z = s' i ∨ z = t' i) ∧ z ∈ ℓ' i := fun {z} hz => by + obtain ⟨y, hy, h1⟩ := mem_iUnion₂.mp hz + refine ⟨⟨y, hy⟩, h1, ?_⟩ + rcases h1 with rfl | rfl + · exact (hℓ' ⟨y, hy⟩).left_mem + · exact (hℓ' ⟨y, hy⟩).right_mem + have hAV : ∀ D, ∀ A ∈ 𝓐 D, A ∩ V = A ∩ cutEnds s' t' (I D.1) := fun D A hA => by + ext z + constructor + · rintro ⟨h1, h2⟩ + obtain ⟨i, h3, h4⟩ := hVend h2 + exact ⟨h1, mem_iUnion₂.mpr ⟨i, hclass D i z (hAsub hA h1) h4, h3⟩⟩ + · rintro ⟨h1, h2⟩ + obtain ⟨i, -, h3⟩ := mem_iUnion₂.mp h2 + exact ⟨h1, mem_iUnion₂.mpr ⟨i.1, i.2, h3⟩⟩ + have hline : ∀ A ∈ 𝓑, ∃ a b, IsLineWithEnds A a b ∧ a ≠ b ∧ A ∩ V = {a, b} := fun A hA => by + obtain ⟨D, hA⟩ := mem_iUnion.mp hA + obtain ⟨a, b, h1, h2, -, h4⟩ := (hC D).line A hA + exact ⟨a, b, h1, h2, by rw [hAV D A hA, h4]⟩ + have hAdisj : ∀ A ∈ 𝓑, ∀ A' ∈ 𝓑, A ≠ A' → Disjoint A A' := fun A hA A' hA' hne => by + obtain ⟨D, hA⟩ := mem_iUnion.mp hA + obtain ⟨D', hA'⟩ := mem_iUnion.mp hA' + by_cases h : D = D' + · subst h + exact (hC D).disj A hA A' hA' hne + · obtain ⟨y, hy⟩ := hDc D + obtain ⟨y', hy'⟩ := hDc D' + refine (hdis _ y.2 _ y'.2 fun e => h (Subtype.ext (hy.symm.trans (e.trans hy')))).mono ?_ ?_ + · exact fun z hz => hy ▸ GM11.discBd_subset _ (hAsub hA hz) + · exact fun z hz => hy' ▸ GM11.discBd_subset _ (hAsub hA' hz) + choose! ea eb hla hne hVA using hline + obtain ⟨G, hGU, hGV, hGE⟩ := GM12.exists_drawing_of_finite_lines hVfin h𝓑fin id ea eb hla hne hVA + fun A hA A' hA' h => by + change A ∩ A' ⊆ V + rw [disjoint_iff_inter_eq_empty.mp (hAdisj A hA A' hA' h)] + exact empty_subset _ + -- Points of `G`. + have hUVsub : V ⊆ ⋃ i : Y, discBd (c i.1) := fun z hz => by + obtain ⟨i, -, h⟩ := hVend hz + exact mem_iUnion.mpr ⟨i, hℓc i z h⟩ + have hUbd : ∀ z ∈ G.U, ∃ i : Y, z ∈ discBd (c i.1) := fun z hz => by + rw [hGU] at hz + rcases hz with hz | hz + · exact mem_iUnion.mp (hUVsub hz) + · obtain ⟨A, hA, hzA⟩ := mem_iUnion₂.mp hz + obtain ⟨D, hA⟩ := mem_iUnion.mp hA + obtain ⟨y, hy⟩ := hDc D + exact ⟨y, hy ▸ hAsub hA hzA⟩ + have hUℓ : ∀ z ∈ G.U, ∀ i : Y, z ∈ ℓ' i → z = s' i ∨ z = t' i := fun z hz i hzi => by + rw [hGU] at hz + rcases hz with hz | hz + · obtain ⟨k, h1, h2⟩ := hVend hz + by_cases h : k = i + · exact h ▸ h1 + · exact (disjoint_left.mp (hdis' k i h) h2 hzi).elim + · obtain ⟨A, hA, hzA⟩ := mem_iUnion₂.mp hz + obtain ⟨D, hA⟩ := mem_iUnion.mp hA + exact (hC D).meet A hA i (hclass D i z (hAsub hA hzA) hzi) z hzA hzi + have hyn : ∀ i : Y, i.1 ∉ G.U := fun i h => by + obtain ⟨-, -, -, -, h5, h6, h7, -⟩ := hℓ i i.2 + rcases hUℓ i.1 h i h5 with e | e + · exact h6 e + · exact h7 e + have hUV : ∀ z ∈ G.U, z ∈ bd S → z ∈ V := fun z hz hzb => by + obtain ⟨i, hi⟩ := hUbd z hz + obtain ⟨y, hy, hzy⟩ := mem_iUnion₂.mp (hbd _ i.2 ⟨GM11.discBd_subset _ hi, hzb⟩) + exact mem_iUnion₂.mpr ⟨y, hy, hUℓ z hz ⟨y, hy⟩ hzy⟩ + have hVb : ∀ z ∈ V, z ∈ bd S := fun z hz => by + obtain ⟨i, -, h⟩ := hVend hz + exact (hℓ i i.2).2.2.2.1 h + -- The edges of `G`. + have hAclo : ∀ A ∈ 𝓑, closure (A \ {ea A, eb A}) = A := fun A hA => + subset_antisymm (closure_minimal sdiff_subset (hla A hA).isCompact.isClosed) + (hla A hA).subset_closure_diff + have htilde : ∀ A ∈ 𝓑, (tilde (A \ {ea A, eb A})).ncard = 2 := fun A hA => by + have h1 : tilde (A \ {ea A, eb A}) = {ea A, eb A} := by + unfold tilde + rw [hAclo A hA] + ext z + simp only [mem_sdiff, mem_insert_iff, mem_singleton_iff, not_and, not_not] + constructor + · rintro ⟨h2, h3⟩ + exact h3 h2 + · rintro (rfl | rfl) + · exact ⟨(hla A hA).left_mem, fun _ => .inl rfl⟩ + · exact ⟨(hla A hA).right_mem, fun _ => .inr rfl⟩ + rw [h1, ncard_pair (hne A hA)] + have hexA : ∀ v ∈ V, ∃ A ∈ 𝓑, v ∈ A := fun v hv => by + obtain ⟨i, h1, h2⟩ := hVend hv + let D : 𝒟 := ⟨c i.1, i, rfl⟩ + rcases (hC D).cover v (hℓc i v h2) with ⟨A, hA, h3⟩ | ⟨k, -, h3, h4, h5⟩ + · exact ⟨A, mem_iUnion.mpr ⟨D, hA⟩, h3⟩ + · have hk : k = i := by + by_contra h + exact disjoint_left.mp (hdis' k i h) h3 h2 + rw [hk] at h4 h5 + rcases h1 with h1 | h1 + · exact (h4 h1).elim + · exact (h5 h1).elim + have hval : ∀ v ∈ V, vertexValency G v = 1 := by + exact matching_drawing_has_valency_one (S := S) 𝓑 V hAdisj ea eb G hGV hGE hAclo htilde hexA + have hmatch : IsMatching G := by + refine ⟨fun z hz => ?_, ?_, fun v hv => hval v (hGV ▸ hv)⟩ + · rw [hGV] + exact hUV z hz.2 hz.1 + · rw [hGV] + exact hVb + -- The regions of `G`. + have hreg : ∀ y : Y, c y.1 \ G.U ∈ G.R ∧ IsSimplyConnectedSubset (c y.1 \ G.U) := by + exact matching_disc_complement_is_simply_connected_region (S := S) (Y := Y) (c := c) (ℓ := ℓ) + (s := s) (t := t) hd hop hℓ hsame I (fun _ _ hi => (Finset.mem_filter.mp hi).2) + 𝓐 hC V G hGU hUbd hyn + have hGUsub : G.U ⊆ ⋃ y ∈ Y, discBd (c y) := fun z hz => by + obtain ⟨i, hi⟩ := hUbd z hz + exact mem_iUnion₂.mpr ⟨i.1, i.2, hi⟩ + refine ⟨G, hmatch, hGV, hGUsub, fun H hHY hw hcl hbdU => ?_⟩ + have hYm : ∀ z, z ∈ H.V → z ∈ bd S → z ∈ Y := fun z h1 h2 => hHY ▸ (⟨h1, h2⟩ : z ∈ H.V ∩ bd S) + have hdisj : Disjoint G.U H.U := disjoint_left.mpr fun z h1 h2 => by + obtain ⟨i, hi⟩ := hUbd z h1 + exact hyn ⟨z, hbdU _ i.2 z h2 hi⟩ h1 + have hyc : ∀ y ∈ Y, y ∈ c y := fun y hy => GM11.discBd_subset _ ((hℓ y hy).2.2.1 + (hℓ y hy).2.2.2.2.1) + refine ⟨⟨disjoint_iff_inter_eq_empty.mp hdisj, fun H' hsub hconn ⟨y, hyV, hyb⟩ => ?_⟩, ?_⟩ + · have hyY : y ∈ Y := hYm y (hsub.1 hyV) hyb + let y' : Y := ⟨y, hyY⟩ + obtain ⟨hr, hrs⟩ := hreg y' + refine ⟨_, hr, hrs, ?_⟩ + intro z hz + refine ⟨connected_drawing_subset_of_closed_edge_condition H' hyV (hyc y hyY) hconn ?_ hz, + fun h => disjoint_left.mp hdisj h (hsub.U_subset hz)⟩ + exact fun e he u hu => hcl e (hsub.2 he) u (hsub.1 hu) y hyY + · rintro a ⟨haV, hab⟩ b ⟨hbV, hbb⟩ - r hr har hbr + have haY := hYm a haV hab + have hbY := hYm b hbV hbb + let a' : Y := ⟨a, haY⟩ + have h1 := (hreg a').1 + have h2 : r = c a \ G.U := region_eq_of_mem hr h1 har ⟨hyc a haY, hyn a'⟩ + have h3 : b ∈ c a := (h2 ▸ hbr : b ∈ c a \ G.U).1 + obtain ⟨W⟩ := hw a haY b hbY (hsame haY hbY h3 (hyc b hbY)) + obtain ⟨W', hs, -, -⟩ := GraphWalk.exists_isSimple W + exact ⟨W', hs⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Matched.lean b/LeanPool/GraphMinor/GM07/Matched.lean new file mode 100644 index 0000000000..c031ab6920 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Matched.lean @@ -0,0 +1,417 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section3 + +/-! +# Drawings that match under a map + +For (7.5), page 241, we pass forests between `Σ` and the surface `Σ_e` cut along `ē`. We keep the +forests off the cut. Then `φ_e` is one to +one on them, so it carries walks, the curves tracing them, and homotopies from one surface to the +other. In `Σ_e` the forest has two more +vertices `a'` and `b'`, which are isolated. + +`IsCarry` says that a map takes the part of a drawing on a set `P` of vertices to another drawing. +`IsMatched` says that a map is onto a drawing +apart from a set `B` of isolated vertices. A matching gives a carry in each direction. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface + +universe u v + +section Carry + +variable {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] + +/-- `f` takes the part of `Γ` on `P` into `Γ'`. -/ +structure IsCarry (Γ : Drawing X) (Γ' : Drawing Y) (f : X → Y) (P : Set X) : Prop where + cont : ContinuousOn f Γ.U + inj : InjOn f Γ.U + mem : ∀ x ∈ P, x ∈ Γ.V ∧ f x ∈ Γ'.V + step : ∀ e ∈ Γ.E, ∀ x y, closure e ∩ Γ.V = {x, y} → x ∈ P → + y ∈ P ∧ f '' e ∈ Γ'.E ∧ closure (f '' e) ∩ Γ'.V = {f x, f y} ∧ f '' closure e ⊆ closure (f '' e) + +theorem CurveTracesWalk.range_subset {Γ : Drawing X} {u v : X} + (W : GraphWalk Γ.toGraph u v) : + ∀ φ : Curve X, CurveTracesWalk Γ φ W → range φ ⊆ Γ.U := by + induction W with + | nil hv => + intro φ h + cases h with + | nil _ _ hconst => + rintro _ ⟨x, rfl⟩ + rw [hconst] + exact Γ.V_subset_U hv + | cons hlink rest ih => + intro φ h + cases h with + | cons _ φ₁ φ₂ _ _ hφ₂ hconcat => + obtain ⟨t₀, -, -, -, -, -, h1, h2⟩ := hconcat + rintro _ ⟨x, rfl⟩ + rcases le_total x.1 t₀.1 with hx | hx + · exact Γ.closure_subset_U hlink.1 (h1 x hx) + · exact ih φ₂ hφ₂ (h2 x hx) + +theorem IsCarry.walk {Γ : Drawing X} {Γ' : Drawing Y} {f : X → Y} {P : Set X} + (h : IsCarry Γ Γ' f P) {u v : X} + (W : GraphWalk Γ.toGraph u v) : u ∈ P → ∀ u' v', f u = u' → f v = v' + → ∃ W' : GraphWalk Γ'.toGraph u' v', + W'.support = W.support.map f ∧ W'.edges = W.edges.map (image f) ∧ (∀ x ∈ W.support, x ∈ P) ∧ + ∀ φ : Curve X, CurveTracesWalk Γ φ W → ∃ φ' : Curve Y, CurveTracesWalk Γ' φ' W' ∧ ∀ t, φ' t + = f (φ t) := by + induction W with + | nil hv => + intro hu u' v' h1 h2 + subst h1 + subst h2 + refine ⟨.nil (h.mem _ hu).2, by simp [GraphWalk.support], by simp [GraphWalk.edges], + by simpa [GraphWalk.support] using hu, fun φ hφ => ?_⟩ + cases hφ with + | nil _ _ hconst => + refine ⟨ContinuousMap.const _ (f _), .nil _ _ fun _ => rfl, fun t => ?_⟩ + simp [hconst] + | @cons a b c e hlink rest ih => + intro hu u' v' h1 h2 + subst h1 + subst h2 + obtain ⟨hb, he, hcap, hcl⟩ := h.step e hlink.1 _ _ hlink.2.2.2 hu + obtain ⟨W', h1, h2, h3, h4⟩ := ih hb _ _ rfl rfl + have hlink' : Γ'.toGraph.IsLink (f '' e) (f a) (f b) := ⟨he, (h.mem _ hu).2, + (h.mem _ hb).2, hcap⟩ + refine ⟨.cons hlink' W', by simp [GraphWalk.support, h1], by simp [GraphWalk.edges, h2], ?_, + fun φ hφ => ?_⟩ + · intro x hx + rcases List.mem_cons.mp hx with rfl | hx + · exact hu + · exact h3 x hx + · have hr := CurveTracesWalk.range_subset _ φ hφ + let φ' : Curve Y := ⟨fun t => f (φ t), h.cont.comp_continuous φ.continuous fun t + => hr ⟨t, rfl⟩⟩ + refine ⟨φ', ?_, fun t => rfl⟩ + cases hφ with + | cons _ φ₁ φ₂ _ hφ₁ hφ₂ hconcat => + obtain ⟨φ₂', hφ₂', hval⟩ := h4 φ₂ hφ₂ + have hr₁ : range φ₁ ⊆ Γ.U := hφ₁.2.2.trans (Γ.closure_subset_U hlink.1) + let φ₁' : Curve Y := ⟨fun t => f (φ₁ t), h.cont.comp_continuous φ₁.continuous fun t + => hr₁ ⟨t, rfl⟩⟩ + obtain ⟨t₀, h5, h6, h7, h8, h9, h10, h11⟩ := hconcat + refine .cons hlink' φ₁' φ₂' φ' ⟨congrArg f hφ₁.1, congrArg f hφ₁.2.1, ?_⟩ hφ₂' ⟨t₀, h5, + h6, congrArg f h7, congrArg f h8, congrArg f h9, ?_, ?_⟩ + · rintro _ ⟨t, rfl⟩ + exact hcl ⟨_, hφ₁.2.2 ⟨t, rfl⟩, rfl⟩ + · exact fun x hx => hcl ⟨_, h10 x hx, rfl⟩ + · intro x hx + obtain ⟨y, hy⟩ := h11 x hx + exact ⟨y, by rw [hval, hy]; rfl⟩ + +theorem GraphWalk.edges_mem_toGraph {Γ : Drawing X} {u v : X} (W : GraphWalk Γ.toGraph u v) : ∀ e ∈ + W.edges, e ∈ Γ.E := by + induction W with + | nil => simp [GraphWalk.edges] + | cons hlink rest ih => + intro e he + rcases List.mem_cons.mp he with rfl | he + · exact hlink.1 + · exact ih e he + +/-- A carry that holds every edge of `Γ` takes forests back. -/ +theorem IsCarry.isGraphForest {Γ : Drawing X} {Γ' : Drawing Y} {f : X → Y} {P : Set X} + (h : IsCarry Γ Γ' f P) + (hends : ∀ e ∈ Γ.E, ∀ x y, closure e ∩ Γ.V = {x, y} → x ∈ P) (hF : IsGraphForest Γ'.toGraph) : + IsGraphForest Γ.toGraph := by + intro u W hW + cases W with + | nil hv => rfl + | @cons _ b _ e hlink rest => + have hu := hends e hlink.1 _ _ hlink.2.2.2 + obtain ⟨W', h1, h2, h3, -⟩ := h.walk (.cons hlink rest) hu _ _ rfl rfl + have hsimple : W'.IsSimpleClosed := by + constructor + · rw [h1, ← List.map_tail] + refine hW.1.map_on fun x hx y hy he => ?_ + exact h.inj (Γ.V_subset_U (h.mem _ (h3 x (List.mem_of_mem_tail hx))).1) + (Γ.V_subset_U (h.mem _ (h3 y (List.mem_of_mem_tail hy))).1) he + · rw [h2] + refine hW.2.map_on fun x hx y hy he => ?_ + have hxE := GraphWalk.edges_mem_toGraph _ x hx + have hyE := GraphWalk.edges_mem_toGraph _ y hy + have hxU : x ⊆ Γ.U := subset_closure.trans (Γ.closure_subset_U hxE) + have hyU : y ⊆ Γ.U := subset_closure.trans (Γ.closure_subset_U hyE) + exact (h.inj.image_eq_image_iff hxU hyU).mp he + have h0 := hF _ W' hsimple + rw [GraphWalk.length, h2, List.length_map] at h0 + exact h0 + +end Carry + +section Matched + +variable {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] + +/-- `f` is one to one on `Γ` and takes it onto `Γ'`, apart from a set `B` of isolated vertices of +`Γ`. -/ +structure IsMatched (Γ : Drawing X) (Γ' : Drawing Y) (f : X → Y) (B : Set X) : Prop where + cont : Continuous f + inj : InjOn f Γ.U + sub : B ⊆ Γ.V + off : ∀ e ∈ Γ.E, Disjoint (closure e) B + image_U : f '' (Γ.U \ B) = Γ'.U + image_V : f '' (Γ.V \ B) = Γ'.V + image_E : Γ'.E = image f '' Γ.E + +variable [CompactSpace X] [T2Space X] [T2Space Y] {Γ : Drawing X} {Γ' : Drawing Y} {f : X + → Y} {B : Set X} + +omit [T2Space X] in +theorem IsMatched.closure_image (h : IsMatched Γ Γ' f B) (e : Set X) : closure (f '' e) + = f '' closure e := + (image_closure_subset_closure_image h.cont).antisymm' (closure_minimal (image_mono subset_closure) + (isClosed_closure.isCompact.image h.cont).isClosed) + +omit [T2Space X] in +theorem IsMatched.cap (h : IsMatched Γ Γ' f B) {e : Set X} (he : e ∈ Γ.E) : closure (f '' e) ∩ Γ'.V + = f '' (closure e ∩ Γ.V) := by + have hU := Γ.closure_subset_U he + rw [h.closure_image] + ext z + constructor + · rintro ⟨⟨w, hw, rfl⟩, hz⟩ + rw [← h.image_V] at hz + obtain ⟨w', hw', he'⟩ := hz + rw [← h.inj (Γ.V_subset_U hw'.1) (hU hw) he'] + exact ⟨w', ⟨h.inj (Γ.V_subset_U hw'.1) (hU hw) he' ▸ hw, hw'.1⟩, rfl⟩ + · rintro ⟨w, ⟨hw, hwV⟩, rfl⟩ + refine ⟨⟨w, hw, rfl⟩, ?_⟩ + rw [← h.image_V] + exact ⟨w, ⟨hwV, disjoint_left.mp (h.off e he) hw⟩, rfl⟩ + +omit [T2Space X] in +theorem IsMatched.carry (h : IsMatched Γ Γ' f B) : IsCarry Γ Γ' f (Γ.V \ B) where + cont := h.cont.continuousOn + inj := h.inj + mem x hx := ⟨hx.1, by rw [← h.image_V]; exact ⟨x, hx, rfl⟩⟩ + step e he x y hcap hx := by + have hy : y ∈ closure e ∩ Γ.V := by rw [hcap]; simp + refine ⟨⟨hy.2, disjoint_left.mp (h.off e he) hy.1⟩, ?_, ?_, ?_⟩ + · rw [h.image_E] + exact ⟨e, he, rfl⟩ + · rw [h.cap he, hcap, image_pair] + · rw [h.closure_image] + +omit [CompactSpace X] [T2Space X] [T2Space Y] in +theorem IsMatched.ends (h : IsMatched Γ Γ' f B) : ∀ e ∈ Γ.E, ∀ x y, closure e ∩ Γ.V = {x, y} + → x ∈ Γ.V \ B := fun e he x y hcap => by + have hx : x ∈ closure e ∩ Γ.V := by rw [hcap]; simp + exact ⟨hx.2, disjoint_left.mp (h.off e he) hx.1⟩ + +omit [T2Space X] in +/-- The map back from `Γ'` to `Γ`. -/ +theorem IsMatched.exists_inverse [Nonempty X] (h : IsMatched Γ Γ' f B) : + ∃ ψ : Y → X, (∀ x ∈ Γ.U, ψ (f x) = x) ∧ (∀ y ∈ Γ'.U, f (ψ y) = y) ∧ IsCarry Γ' Γ ψ Γ'.V := by + classical + obtain ⟨ψ, hc, hl⟩ := Surface.exists_inv_of_compactOn Γ.isClosed_U.isCompact h.cont.continuousOn + h.inj + have hsub : Γ'.U ⊆ f '' Γ.U := by + rw [← h.image_U] + exact image_mono sdiff_subset + have hfψ : ∀ y ∈ Γ'.U, f (ψ y) = y := fun y hy => by + obtain ⟨x, hx, rfl⟩ := hsub hy + rw [hl hx] + have hVsub : ∀ y ∈ Γ'.V, ∃ x ∈ Γ.V \ B, f x = y := fun y hy => by + rw [← h.image_V] at hy + exact hy + refine ⟨ψ, fun x hx => hl hx, hfψ, ?_⟩ + refine ⟨hc.mono hsub, fun y hy y' hy' he => by rw [← hfψ y hy, ← hfψ y' hy', he], + fun y hy => ?_, fun e' he' x y hcap _ => ?_⟩ + · obtain ⟨x, hx, rfl⟩ := hVsub y hy + exact ⟨hy, by rw [hl (Γ.V_subset_U hx.1)]; exact hx.1⟩ + · rw [h.image_E] at he' + obtain ⟨e, he, rfl⟩ := he' + have hU := Γ.closure_subset_U he + have hee : ψ '' (f '' e) = e := by + rw [image_image] + exact (image_congr fun z hz => hl (hU (subset_closure hz))).trans (image_id' e) + have hcl : ψ '' (f '' closure e) = closure e := by + rw [image_image] + exact (image_congr fun z hz => hl (hU hz)).trans (image_id' _) + have hcapA : ψ '' (f '' (closure e ∩ Γ.V)) = closure e ∩ Γ.V := by + rw [image_image] + exact (image_congr fun z (hz : z ∈ closure e ∩ Γ.V) => hl (hU hz.1)).trans + (image_id' _) + have hy : y ∈ closure (f '' e) ∩ Γ'.V := by rw [hcap]; simp + refine ⟨hy.2, by rw [hee]; exact he, ?_, ?_⟩ + · rw [hee, ← hcapA, ← h.cap he, hcap, image_pair] + · rw [hee, h.closure_image, hcl] + +omit [T2Space X] in +theorem IsMatched.isGraphForest_iff [Nonempty X] (h : IsMatched Γ Γ' f B) : IsGraphForest Γ.toGraph + ↔ IsGraphForest Γ'.toGraph := by + obtain ⟨ψ, -, -, hc⟩ := + h.exists_inverse + refine ⟨hc.isGraphForest ?_, h.carry.isGraphForest h.ends⟩ + intro e he x y hcap + have hx : x ∈ closure e ∩ Γ'.V := by rw [hcap]; simp + exact hx.2 + +omit [CompactSpace X] [T2Space X] [T2Space Y] in +theorem IsMatched.map (h : IsMatched Γ Γ' f B) (α : X ≃ₜ X) (α₂ : Y ≃ₜ Y) (hcomm : ∀ x, f (α x) + = α₂ (f x)) : + IsMatched (mapDrawingHomeo α Γ) (mapDrawingHomeo α₂ Γ') f (α '' B) where + cont := h.cont + inj := by + rintro _ ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩ he + rw [hcomm, hcomm] at he + rw [h.inj hx hy (α₂.injective he)] + sub := image_mono h.sub + off e he := by + rw [mapDrawingHomeo_E] at he + obtain ⟨e₀, he₀, rfl⟩ := he + rw [← α.image_closure] + exact (disjoint_image_iff α.injective).mpr (h.off e₀ he₀) + image_U := by + change f '' (α '' Γ.U \ α '' B) = α₂ '' Γ'.U + rw [← image_sdiff α.injective, ← h.image_U, image_image, image_image] + exact image_congr fun x _ => hcomm x + image_V := by + change f '' (α '' Γ.V \ α '' B) = α₂ '' Γ'.V + rw [← image_sdiff α.injective, ← h.image_V, image_image, image_image] + exact image_congr fun x _ => hcomm x + image_E := by + rw [mapDrawingHomeo_E, mapDrawingHomeo_E, h.image_E, image_image, image_image] + refine image_congr fun e _ => ?_ + rw [image_image, image_image] + exact image_congr fun x _ => (hcomm x).symm + +omit [T2Space X] in +/-- Homotopic forests stay homotopic under a matching. -/ +theorem IsMatched.forestsHomotopic [Nonempty X] {Γ₁ Γ₂ : Drawing X} {Γ₁' Γ₂' : Drawing Y} {B₁ B₂ : + Set X} (m₁ : IsMatched Γ₁ Γ₁' f B₁) + (m₂ : IsMatched Γ₂ Γ₂' f B₂) (h : ForestsHomotopic Γ₁ Γ₂) (hp₁ : Γ₁'.IsProper) + (hp₂ : Γ₂'.IsProper) + (hV : Γ₁'.V ∩ bd Y = Γ₂'.V ∩ bd Y) + (hlift : ∀ s ∈ Γ₁'.V ∩ bd Y, ∃ x, f x = s ∧ x ∈ Γ₁.V \ B₁ ∧ x ∈ bd X + ∧ x ∈ Γ₂.V \ B₂) : ForestsHomotopic Γ₁' Γ₂' := by + obtain ⟨-, -, f₁, f₂, -, hpaths⟩ := h + obtain ⟨ψ₁, hl₁, hr₁, hc₁⟩ := m₁.exists_inverse + obtain ⟨ψ₂, hl₂, hr₂, hc₂⟩ := m₂.exists_inverse + refine ⟨hp₁, hp₂, m₁.isGraphForest_iff.mp f₁, m₂.isGraphForest_iff.mp f₂, hV, + fun s hs t ht hne => ?_⟩ + obtain ⟨x, hxs, hx₁, hxb, hx₂⟩ := hlift s hs + obtain ⟨y, hyt, hy₁, hyb, hy₂⟩ := hlift t ht + subst hxs + subst hyt + have hxy : x ≠ y := fun he => hne (by rw [he]) + have hs₂ : f x ∈ Γ₂'.V := (hV ▸ hs : f x ∈ Γ₂'.V ∩ bd Y).1 + have ht₂ : f y ∈ Γ₂'.V := (hV ▸ ht : f y ∈ Γ₂'.V ∩ bd Y).1 + obtain ⟨hiff, hhom⟩ := hpaths x ⟨hx₁.1, hxb⟩ y ⟨hy₁.1, hyb⟩ hxy + have hψ₁x := hl₁ x (Γ₁.V_subset_U hx₁.1) + have hψ₁y := hl₁ y (Γ₁.V_subset_U hy₁.1) + have hψ₂x := hl₂ x (Γ₂.V_subset_U hx₂.1) + have hψ₂y := hl₂ y (Γ₂.V_subset_U hy₂.1) + have hnodup : ∀ {Γ₀ : Drawing Y} {Γ₃ : Drawing X} {g : Y → X} {P : Set Y}, IsCarry Γ₀ Γ₃ g P + → ∀ {l : List Y}, l.Nodup → (∀ z ∈ l, z ∈ P) → + (l.map g).Nodup := fun {Γ₀ Γ₃ g P} hc l hn hl => + hn.map_on fun z hz w hw he => hc.inj (Γ₀.V_subset_U (hc.mem z (hl z hz)).1) (Γ₀.V_subset_U + (hc.mem w (hl w hw)).1) he + have hnodup' : ∀ {Γ₀ : Drawing X} {Γ₃ : Drawing Y} {g : X → Y} {P : Set X}, IsCarry Γ₀ Γ₃ g P + → ∀ {l : List X}, l.Nodup → (∀ z ∈ l, z ∈ P) → + (l.map g).Nodup := fun {Γ₀ Γ₃ g P} hc l hn hl => + hn.map_on fun z hz w hw he => hc.inj (Γ₀.V_subset_U (hc.mem z (hl z hz)).1) (Γ₀.V_subset_U + (hc.mem w (hl w hw)).1) he + refine ⟨⟨?_, ?_⟩, fun P₁ P₂ φ₁ φ₂ hs₁ hs₂' hφ₁ hφ₂ => ?_⟩ + · rintro ⟨P, hP⟩ + obtain ⟨Q, h1, -, h3, -⟩ := hc₁.walk P hs.1 x y hψ₁x hψ₁y + obtain ⟨R, hR⟩ := hiff.mp ⟨Q, by rw [GraphWalk.IsSimple, h1]; exact hnodup hc₁ hP h3⟩ + obtain ⟨W, h4, -, h6, -⟩ := m₂.carry.walk R hx₂ _ _ rfl rfl + exact ⟨W, by rw [GraphWalk.IsSimple, h4]; exact hnodup' m₂.carry hR h6⟩ + · rintro ⟨P, hP⟩ + obtain ⟨Q, h1, -, h3, -⟩ := hc₂.walk P hs₂ x y hψ₂x hψ₂y + obtain ⟨R, hR⟩ := hiff.mpr ⟨Q, by rw [GraphWalk.IsSimple, h1]; exact hnodup hc₂ hP h3⟩ + obtain ⟨W, h4, -, h6, -⟩ := m₁.carry.walk R hx₁ _ _ rfl rfl + exact ⟨W, by rw [GraphWalk.IsSimple, h4]; exact hnodup' m₁.carry hR h6⟩ + · obtain ⟨Q₁, h1, -, h3, h4⟩ := hc₁.walk P₁ hs.1 x y hψ₁x hψ₁y + obtain ⟨Q₂, h1', -, h3', h4'⟩ := hc₂.walk P₂ hs₂ x y hψ₂x hψ₂y + obtain ⟨c₁, hc₁t, hc₁v⟩ := h4 φ₁ hφ₁ + obtain ⟨c₂, hc₂t, hc₂v⟩ := h4' φ₂ + hφ₂ + have hQ₁ : Q₁.IsSimple := by + rw [GraphWalk.IsSimple, h1] + exact hnodup hc₁ hs₁ h3 + have hQ₂ : Q₂.IsSimple := by + rw [GraphWalk.IsSimple, h1'] + exact hnodup hc₂ hs₂' h3' + obtain ⟨H, -, h5, h6, h7, h8, h9, h10⟩ := hhom Q₁ Q₂ c₁ c₂ hQ₁ hQ₂ hc₁t hc₂t + have hval₁ : ∀ t, f (c₁ t) = φ₁ t := fun t => by + rw [hc₁v, hr₁ _ (CurveTracesWalk.range_subset _ φ₁ hφ₁ ⟨t, rfl⟩)] + have hval₂ : ∀ t, f (c₂ t) = φ₂ t := fun t => by + rw [hc₂v, hr₂ _ (CurveTracesWalk.range_subset _ φ₂ hφ₂ ⟨t, rfl⟩)] + refine ⟨⟨fun p => f (H p), m₁.cont.comp H.continuous⟩, fun _ => mem_univ _, fun t => ?_, + fun t => ?_, fun t => ?_, fun t => ?_, fun t => ?_, fun t => ?_⟩ + · change f (H (t, 0)) = _ + rw [h5, hval₁] + · change f (H (t, 1)) = _ + rw [h6, hval₂] + · change f (H (0, t)) = _ + rw [h7, hval₁] + · change f (H (0, t)) = _ + rw [h8, hval₂] + · change f (H (1, t)) = _ + rw [h9, hval₁] + · change f (H (1, t)) = _ + rw [h10, hval₂] + +end Matched + +/-- `Γ` with some isolated vertices added. -/ +@[expose] def addIsolated {S : Type u} [TopologicalSpace S] [T1Space S] (Γ : Drawing S) (B : Set S) + (hf : B.Finite) (hB : Disjoint B Γ.U) : Drawing S where + U := Γ.U ∪ B + V := Γ.V ∪ B + V_subset_U := union_subset_union_left _ Γ.V_subset_U + isClosed_U := Γ.isClosed_U.union hf.isClosed + finite_V := Γ.finite_V.union hf + finite_edges := by + have h : (Γ.U ∪ B) \ (Γ.V ∪ B) = Γ.U \ Γ.V := by + ext x + simp only [mem_sdiff, mem_union, not_or] + constructor + · rintro ⟨h1 | h1, h2, h3⟩ + · exact ⟨h1, h2⟩ + · exact absurd h1 h3 + · rintro ⟨h1, h2⟩ + exact ⟨.inl h1, h2, fun h3 => disjoint_left.mp hB h3 h1⟩ + rw [h] + exact Γ.finite_edges + edge_cond := by + have h : (Γ.U ∪ B) \ (Γ.V ∪ B) = Γ.U \ Γ.V := by + ext x + simp only [mem_sdiff, mem_union, not_or] + constructor + · rintro ⟨h1 | h1, h2, h3⟩ + · exact ⟨h1, h2⟩ + · exact absurd h1 h3 + · rintro ⟨h1, h2⟩ + exact ⟨.inl h1, h2, fun h3 => disjoint_left.mp hB h3 h1⟩ + rw [h] + intro e he + have hcap : closure e ∩ (Γ.V ∪ B) = closure e ∩ Γ.V := by + rw [inter_union_distrib_left, (disjoint_iff_inter_eq_empty.mp (hB.symm.mono_left + (Γ.closure_subset_U he))), union_empty] + rw [hcap] + exact Γ.edge_cond e he + + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/MinimalNet.lean b/LeanPool/GraphMinor/GM07/MinimalNet.lean new file mode 100644 index 0000000000..f485b32b9f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/MinimalNet.lean @@ -0,0 +1,167 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs + +/-! +# From a normal net to a minimal net + +A minimal net (Graph Minors VII, Section 2, page 216) minimizes first a natural number and then +another, over all `G`-normal nets. So a `G`-normal net gives a minimal net +(`Net.exists_isMinimalFor`). Fibers of a net are finite (`Net.finite_fiber`), so the first of these +numbers counts what it should. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- If there is a `G`-normal net, then there is a minimal net with respect to `G`. -/ +theorem Net.exists_isMinimalFor {G : Drawing S} {N₀ : Net S} (h : N₀.IsNormalFor G) : ∃ N : Net S, + N.IsMinimalFor G := by + classical + have h1 : ∃ n, ∃ N : Net S, N.IsNormalFor G ∧ N.bdVertexPreimageCard G = n := ⟨_, N₀, h, rfl⟩ + obtain ⟨N₁, hN₁, hc⟩ := Nat.find_spec h1 + have h2 : ∃ m, ∃ N : Net S, N.IsNormalFor G ∧ N.bdVertexPreimageCard G = Nat.find h1 ∧ N.r = m + := ⟨_, N₁, hN₁, hc, rfl⟩ + obtain ⟨N, hN, hc', hr⟩ := Nat.find_spec h2 + refine ⟨N, hN, fun N' hN' => ?_, fun N' hN' hle => ?_⟩ + · rw [hc'] + exact Nat.find_min' h1 ⟨N', hN', rfl⟩ + · have hge : Nat.find h1 ≤ N'.bdVertexPreimageCard G := Nat.find_min' h1 ⟨N', hN', rfl⟩ + rw [hr] + exact Nat.find_min' h2 ⟨N', hN', le_antisymm (hc' ▸ hle) hge, rfl⟩ + +theorem Net.mem_Ioo_of_ne {t : unitInterval} (h0 : t ≠ 0) (h1 : t ≠ 1) : t ∈ Ioo + (0 : unitInterval) 1 := + ⟨unitInterval.pos_iff_ne_zero.mpr h0, unitInterval.lt_one_iff_ne_one.mpr h1⟩ + +/-- The ends of the arcs of a net. -/ +def Net.ends (N : Net S) : Set N.D := + {z | ∃ i, z = N.f i 0 ∨ z = N.f i 1 ∨ z = N.g i 0 ∨ z = N.g i 1} + +theorem Net.finite_ends (N : Net S) : N.ends.Finite := by + have : N.ends = ⋃ i, {N.f i 0, N.f i 1, N.g i 0, N.g i 1} := by + ext z + simp [Net.ends] + rw [this] + exact finite_iUnion fun i => by simp + +theorem Net.f_eq_iff (N : Net S) {i j : Fin N.r} {t t' : unitInterval} (ht : t ∈ Ioo + (0 : unitInterval) 1) (h : N.f i t = N.f j t') : i = j ∧ t = t' := by + by_cases hij : i = j + · subst hij + exact ⟨rfl, N.injective_f i h⟩ + · exact (N.internally_disjoint_ff i j hij t ht ⟨t', h.symm⟩).elim + +theorem Net.g_eq_iff (N : Net S) {i j : Fin N.r} {t t' : unitInterval} (ht : t ∈ Ioo + (0 : unitInterval) 1) (h : N.g i t = N.g j t') : i = j ∧ t = t' := by + by_cases hij : i = j + · subst hij + exact ⟨rfl, N.injective_g i h⟩ + · exact (N.internally_disjoint_gg i j hij t ht ⟨t', h.symm⟩).elim + +/-- A point inside an arc is not an end of any arc. -/ +theorem Net.f_notMem_ends (N : Net S) {i : Fin N.r} {t : unitInterval} (ht : t ∈ Ioo + (0 : unitInterval) 1) : N.f i t ∉ N.ends := by + rintro ⟨j, h | h | h | h⟩ + · exact ht.1.ne' (N.f_eq_iff ht h).2 + · exact ht.2.ne (N.f_eq_iff ht h).2 + · exact N.internally_disjoint_fg i j t ht ⟨0, h.symm⟩ + · exact N.internally_disjoint_fg i j t ht ⟨1, h.symm⟩ + +theorem Net.g_notMem_ends (N : Net S) {i : Fin N.r} {t : unitInterval} (ht : t ∈ Ioo + (0 : unitInterval) 1) : N.g i t ∉ N.ends := by + rintro ⟨j, h | h | h | h⟩ + · exact N.internally_disjoint_gf i j t ht ⟨0, h.symm⟩ + · exact N.internally_disjoint_gf i j t ht ⟨1, h.symm⟩ + · exact ht.1.ne' (N.g_eq_iff ht h).2 + · exact ht.2.ne (N.g_eq_iff ht h).2 + +/-- A set closed under one pasting step in both directions is closed under `φ`-equality. -/ +theorem Net.mem_of_eq (N : Net S) {C : Set N.D} (hC : ∀ i t, N.f i t ∈ C ↔ N.g i t ∈ C) {x y : N.D} + (hxy : N.φ x = N.φ y) (hx : x ∈ C) : y ∈ C := by + have h := (N.bd_eq_iff x y).mp hxy + have key : ∀ a b, Relation.EqvGen (fun a b : N.D => ∃ (i : Fin N.r) (t : unitInterval), a + = N.f i t ∧ b = N.g i t) a b → (a ∈ C ↔ b ∈ C) := by + intro a b hab + induction hab with + | rel a b h => + obtain ⟨i, t, rfl, rfl⟩ := h + exact hC i t + | refl a => exact Iff.rfl + | symm a b _ ih => exact ih.symm + | trans a b c _ _ h1 h2 => exact h1.trans h2 + exact (key x y h).mp hx + +/-- **Fibers of a net are finite.** Interior points have singleton fibers, a point inside an arc has +the class `{f i t, g i t}`, the ends form a finite set closed under pasting, and a point on no arc +is alone. +So `bdVertexPreimageCard` counts what it should. -/ +theorem Net.finite_fiber (N : Net S) (z : S) : (N.φ ⁻¹' {z}).Finite := by + classical + by_cases hne : (N.φ ⁻¹' {z}).Nonempty + swap + · rw [not_nonempty_iff_eq_empty.mp hne] + exact finite_empty + obtain ⟨x, hx⟩ := hne + have hsub : ∀ C : Set N.D, C.Finite → (∀ i t, N.f i t ∈ C ↔ N.g i t ∈ C) → x ∈ C → + (N.φ ⁻¹' {z}).Finite := fun C hf hC hxC => + hf.subset fun y hy => N.mem_of_eq hC (hx.trans hy.symm) hxC + by_cases hE : x ∈ N.ends + · refine hsub N.ends N.finite_ends (fun i t => ?_) hE + by_cases h0 : t = 0 + · subst h0 + exact ⟨fun _ => ⟨i, .inr (.inr (.inl rfl))⟩, fun _ => ⟨i, .inl rfl⟩⟩ + by_cases h1 : t = 1 + · subst h1 + exact ⟨fun _ => ⟨i, .inr (.inr (.inr rfl))⟩, fun _ => ⟨i, .inr (.inl rfl)⟩⟩ + have ht := Net.mem_Ioo_of_ne h0 h1 + exact ⟨fun h => (N.f_notMem_ends ht h).elim, fun h => (N.g_notMem_ends ht h).elim⟩ + by_cases hA : ∃ i, ∃ t ∈ Ioo (0 : unitInterval) 1, x = N.f i t ∨ x = N.g i t + · obtain ⟨i, t, ht, hxt⟩ := hA + refine hsub {N.f i t, N.g i t} (by simp) (fun j t' => ?_) (by rcases hxt with h | h + <;> simp [h]) + have hfg : ∀ a : unitInterval, N.f i t ≠ N.g j a := fun a h => N.internally_disjoint_fg i j t + ht ⟨a, h.symm⟩ + have hgf : ∀ a : unitInterval, N.g i t ≠ N.f j a := fun a h => N.internally_disjoint_gf i j t + ht ⟨a, h.symm⟩ + simp only [mem_insert_iff, mem_singleton_iff] + constructor + · rintro (h | h) + · obtain ⟨rfl, rfl⟩ := N.f_eq_iff ht h.symm + exact .inr rfl + · exact (hgf _ h.symm).elim + · rintro (h | h) + · exact (hfg _ h.symm).elim + · obtain ⟨rfl, rfl⟩ := N.g_eq_iff ht h.symm + exact .inl rfl + · refine hsub {x} (finite_singleton x) (fun i t => ?_) rfl + have hf : N.f i t ≠ x := fun h => by + by_cases h0 : t = 0 + · exact hE ⟨i, .inl (by rw [← h, h0])⟩ + by_cases h1 : t = 1 + · exact hE ⟨i, .inr (.inl (by rw [← h, h1]))⟩ + exact hA ⟨i, t, Net.mem_Ioo_of_ne h0 h1, .inl h.symm⟩ + have hg : N.g i t ≠ x := fun h => by + by_cases h0 : t = 0 + · exact hE ⟨i, .inr (.inr (.inl (by rw [← h, h0])))⟩ + by_cases h1 : t = 1 + · exact hE ⟨i, .inr (.inr (.inr (by rw [← h, h1])))⟩ + exact hA ⟨i, t, Net.mem_Ioo_of_ne h0 h1, .inr h.symm⟩ + simp [hf, hg] + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/MoveHomotopy.lean b/LeanPool/GraphMinor/GM07/MoveHomotopy.lean new file mode 100644 index 0000000000..49c60f2003 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/MoveHomotopy.lean @@ -0,0 +1,431 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.PushForest +public import LeanPool.GraphMinor.GM07.StarDisc + +/-! +# Homeomorphisms homotopic to the identity + +(4.4) of Graph Minors VII (page 223) asks for a forest homotopic to a given one, not only +homoplastic. So the forest may be moved only by homeomorphisms that keep curves in their homotopy +classes. `IsMove α` says this for curves with ends on the boundary. A homeomorphism that lives in a +convex chart is a move, by a straight line homotopy in the chart (`isMove_of_chart`), and the image +of a forest under a move is homotopic to it (`forestsHomotopic_of_move`). The main example shrinks +an arc off the boundary towards one of its ends (`exists_line_slide`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Complex GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] + +/-- `α` fixes `bd(Σ)`, and it moves each path with ends on `bd(Σ)` to a homotopic path. -/ +def IsMove (α : S ≃ₜ S) : Prop := + (∀ x ∈ bd S, α x = x) ∧ ∀ a ∈ bd S, ∀ b ∈ bd S, ∀ p q : Path a b, (∀ u, q u = α (p u)) + → p.Homotopic q + +theorem IsMove.refl : IsMove (Homeomorph.refl S) := + ⟨fun _ _ => rfl, fun a _ b _ p q h => by + have : p = q := by + ext u + exact (h u).symm + rw [this]⟩ + +theorem IsMove.trans {α β : S ≃ₜ S} (hα : IsMove α) (hβ : IsMove β) : IsMove (α.trans β) := by + refine ⟨fun x hx => by simp [hα.1 x hx, hβ.1 x hx], fun a ha b hb p q h => ?_⟩ + have h0 : α (p 0) = a := by rw [p.source, hα.1 a ha] + have h1 : α (p 1) = b := by rw [p.target, hα.1 b hb] + let r : Path a b := ⟨⟨fun u => α (p u), by fun_prop⟩, h0, h1⟩ + exact (hα.2 a ha b hb p r fun _ => rfl).trans (hβ.2 a ha b hb r q fun u => by simpa [r] using h u) + +theorem IsMove.symm {α : S ≃ₜ S} (hα : IsMove α) : IsMove α.symm := by + have hfix : ∀ x ∈ bd S, α.symm x = x := fun x hx => by + rw [Homeomorph.symm_apply_eq, hα.1 x hx] + refine ⟨hfix, fun a ha b hb p q h => ?_⟩ + refine (hα.2 a ha b hb q p fun u => ?_).symm + rw [h u, Homeomorph.apply_symm_apply] + +/-- **A homeomorphism in a convex chart is a move.** The straight line homotopy in the chart stays +fixed on the frontier of the chart, because `α` is the identity outside it. -/ +theorem isHomotopic_of_chart [T2Space S] {K : ℂ → S} {Z : Set ℂ} (hZ : IsCompact Z) + (hconv : Convex ℝ Z) (hc : ContinuousOn K Z) (hi : InjOn K Z) {α : S ≃ₜ S} + (hout : ∀ x ∉ K '' Z, α x = x) (hin : ∀ x ∈ K '' Z, α x ∈ K '' Z) + {a b : S} (p q : Path a b) (hq : ∀ u, q u = α (p u)) : p.Homotopic q := by + classical + have hcom : CompactSpace Z := isCompact_iff_compactSpace.mp hZ + let e0 : Z → K '' Z := fun z => ⟨K z.1, mem_image_of_mem K z.2⟩ + have he0c : Continuous e0 := (hc.domRestrict).subtype_mk _ + have he0b : Function.Bijective e0 := ⟨fun x y h => Subtype.ext (hi x.2 y.2 + (congrArg Subtype.val h)), fun ⟨w, z, hz, hw⟩ => ⟨⟨z, hz⟩, Subtype.ext hw⟩⟩ + let e : Z ≃ₜ K '' Z := (Equiv.ofBijective e0 he0b).toHomeomorphOfIsInducing + (he0c.isClosedEmbedding he0b.1).isInducing + let ρ : S → ℂ := fun x => if h : x ∈ K '' Z then (e.symm ⟨x, h⟩).1 else 0 + have hρc : ContinuousOn ρ (K '' Z) := by + rw [continuousOn_iff_continuous_domRestrict] + have : (K '' Z).domRestrict ρ = fun x => (e.symm x).1 := by + ext z + change ρ z.1 = (e.symm z).1 + exact dite_eq_left z.2 + rw [this] + fun_prop + have hρZ : ∀ x ∈ K '' Z, ρ x ∈ Z := fun x hx => by + simp only [ρ, dite_eq_left hx] + exact (e.symm ⟨x, hx⟩).2 + have hKρ : ∀ x ∈ K '' Z, K (ρ x) = x := fun x hx => by + simp only [ρ, dite_eq_left hx] + exact congrArg Subtype.val (e.apply_symm_apply ⟨x, hx⟩) + have hZc : IsClosed (K '' Z) := (hZ.image_of_continuousOn hc).isClosed + let line : unitInterval → ℂ → ℂ → ℂ := fun t z w => (1 - t.1 : ℝ) • z + (t.1 : ℝ) • w + have hline : ∀ t, ∀ z ∈ Z, ∀ w ∈ Z, line t z w ∈ Z := fun t z hz w hw => + hconv hz hw (by linarith [t.2.2]) t.2.1 (by ring) + let F : unitInterval × unitInterval → S := fun w => if p w.2 ∈ K '' Z then K (line w.1 (ρ + (p w.2)) (ρ (α (p w.2)))) else p w.2 + let A : Set unitInterval := p ⁻¹' (K '' Z) + have hAc : IsClosed A := hZc.preimage p.continuous + have hfix : ∀ u ∈ closure Aᶜ, α (p u) = p u := fun u hu => by + have hcl : IsClosed {u | α (p u) = p u} := isClosed_eq (by fun_prop) (by fun_prop) + exact hcl.closure_subset_iff.mpr (fun v hv => hout _ hv) hu + have hF1 : ContinuousOn F (univ ×ˢ A) := by + have h1 : ContinuousOn (fun w : unitInterval × unitInterval => ρ (p w.2)) (univ ×ˢ A) := + hρc.comp (p.continuous.comp continuous_snd).continuousOn fun w hw => hw.2 + have h2 : ContinuousOn (fun w : unitInterval × unitInterval => ρ (α (p w.2))) (univ ×ˢ A) := + hρc.comp (by fun_prop) fun w hw => hin _ hw.2 + have h3 : ContinuousOn (fun w : unitInterval × unitInterval => line w.1 (ρ (p w.2)) (ρ (α + (p w.2)))) (univ ×ˢ A) := by + simp only [line] + exact (((by fun_prop : Continuous fun w : unitInterval × unitInterval => + (1 - w.1.1 : ℝ)).continuousOn).smul h1).add ((by fun_prop : Continuous fun w : unitInterval + × unitInterval => (w.1.1 : ℝ)).continuousOn.smul h2) + refine (hc.comp h3 fun w hw => hline _ _ (hρZ _ hw.2) _ (hρZ _ (hin _ hw.2))).congr fun w hw + => ?_ + exact ite_eq_left hw.2 + have hF2 : ContinuousOn F (univ ×ˢ closure Aᶜ) := by + refine (p.continuous.comp continuous_snd).continuousOn.congr fun w hw => ?_ + change F w = p w.2 + simp only [F] + split_ifs with h + · rw [hfix _ hw.2] + have : line w.1 (ρ (p w.2)) (ρ (p w.2)) = ρ (p w.2) := by + simp only [line, ← add_smul] + simp + rw [this, hKρ _ h] + · rfl + have hcov : (univ ×ˢ A) ∪ (univ ×ˢ closure Aᶜ) = (univ : Set (unitInterval × unitInterval)) := by + ext w + simp only [mem_union, mem_prod, mem_univ, true_and, iff_true] + by_cases h : w.2 ∈ A + · exact .inl h + · exact .inr (subset_closure h) + have hF : Continuous F := by + rw [← continuousOn_univ, ← hcov] + exact hF1.union_of_isClosed hF2 (isClosed_univ.prod hAc) (isClosed_univ.prod isClosed_closure) + have hF0 : ∀ u, F (0, u) = p u := fun u => by + simp only [F] + split_ifs with h + · simp [line, hKρ _ h] + · rfl + have hF3 : ∀ u, F (1, u) = q u := fun u => by + simp only [F, hq] + split_ifs with h + · simp [line, hKρ _ (hin _ h)] + · exact (hout _ h).symm + have hend : ∀ u, q u = p u → ∀ t, F (t, u) = p u := fun u h t => by + have h' : α (p u) = p u := by rw [← hq, h] + simp only [F] + split_ifs with hm + · rw [h'] + have : line t (ρ (p u)) (ρ (p u)) = ρ (p u) := by + simp only [line, ← add_smul] + simp + rw [this, hKρ _ hm] + · rfl + refine ⟨⟨⟨⟨F, hF⟩, hF0, hF3⟩, fun t x hx => ?_⟩⟩ + rcases hx with rfl | hx + · exact hend 0 (by simp) t + · obtain rfl : x = 1 := hx + exact hend 1 (by simp) t + +theorem isMove_of_chart [T2Space S] {K : ℂ → S} {Z : Set ℂ} (hZ : IsCompact Z) (hconv : Convex ℝ Z) + (hc : ContinuousOn K Z) (hi : InjOn K Z) {α : S ≃ₜ S} (hout : ∀ x ∉ K '' Z, α x = x) + (hin : ∀ x ∈ K '' Z, α x ∈ K '' Z) + (hbd : ∀ x ∈ bd S, x ∉ K '' Z) : IsMove α := + ⟨fun x hx => hout x (hbd x hx), fun _ _ _ _ p q h => isHomotopic_of_chart hZ hconv hc hi hout hin + p q h⟩ + +/-- **The image of a forest under a move is homotopic to it.** -/ +theorem forestsHomotopic_of_move [T2Space S] {α : S ≃ₜ S} (hα : IsMove α) {H : Drawing S} + (hH : IsSurfaceForest H) : ForestsHomotopic (mapDrawingHomeo α H) H := by + have hF := hH.map_homeo α + have hfix : ∀ x ∈ bd S, α.symm x = x := (hα.symm).1 + have hbd : (mapDrawingHomeo α H).V ∩ bd S = H.V ∩ bd S := by + ext z + constructor + · rintro ⟨⟨v, hv, rfl⟩, hz⟩ + have : v = α v := by + conv_lhs => rw [← α.symm_apply_apply v] + exact hfix _ hz + exact ⟨this ▸ hv, hz⟩ + · rintro ⟨hz, hb⟩ + exact ⟨⟨z, hz, hα.1 z hb⟩, hb⟩ + refine ⟨hF.1, hH.1, hF.2, hH.2, hbd, fun s hs t ht _ => ?_⟩ + have hsb := hs.2 + have htb := ht.2 + have hps : α.symm s = s := hfix s hsb + have hpt : α.symm t = t := hfix t htb + refine ⟨⟨fun ⟨P, hP⟩ => pullback_simple_walk_aux α hps hpt P hP, fun ⟨P, hP⟩ => ?_⟩, + fun P₁ P₂ φ₁ φ₂ _ _ h₁ h₂ => ?_⟩ + · have key : ∀ {x y : S}, x = s → y = t → ∀ Q : GraphWalk (mapDrawingHomeo α H).toGraph x y, + Q.IsSimple → ∃ Q' : GraphWalk (mapDrawingHomeo α H).toGraph s t, Q'.IsSimple := by + rintro _ _ rfl rfl Q hQ + exact ⟨Q, hQ⟩ + exact key (hα.1 s hsb) (hα.1 t htb) (mapWalkHomeo α P) (isSimple_mapWalkHomeo α hP) + · obtain ⟨g0, g1⟩ := h₁.endpoints + obtain ⟨c0, c1⟩ := h₂.endpoints + have hbs : α s = s := hα.1 s hsb + have hbt : α t = t := hα.1 t htb + let p₁ : Path s t := ⟨φ₁, g0, g1⟩ + let p₂ : Path s t := ⟨φ₂, c0, c1⟩ + let p₃ : Path s t := ⟨⟨fun u => α (φ₂ u), by fun_prop⟩, by simp [c0, hbs], by simp [c1, hbt]⟩ + have h13 : p₁.Homotopic p₃ := IsFlat.flat (isFlat_forest hF.2) p₁ p₃ (fun u + => h₁.range_subset_U ⟨u, rfl⟩) fun u => mem_image_of_mem α (h₂.range_subset_U ⟨u, rfl⟩) + have h23 : p₂.Homotopic p₃ := hα.2 s hsb t htb p₂ p₃ fun _ => rfl + exact curves_of_homotopic (h13.trans h23.symm) + +/-- A point of a thin rectangle round a real interval is close to the interval. -/ +theorem mem_cthickening_seg {s t ε : ℝ} (hst : s ≤ t) {w : ℂ} (h1 : s ≤ w.re) (h2 : w.re ≤ t + ε) + (h3 : |w.im| ≤ ε) : w ∈ cthickening (2 * ε) ((fun u : ℝ => (u : ℂ)) '' Icc s t) := by + refine mem_cthickening_of_dist_le w (((min w.re t : ℝ) : ℂ)) _ _ ⟨_, ⟨le_min h1 hst, + min_le_right _ _⟩, rfl⟩ ?_ + have h4 : |w.re - min w.re t| ≤ ε := by + have hε : 0 ≤ ε := (abs_nonneg _).trans h3 + rw [abs_le] + constructor + · have : min w.re t ≤ w.re := min_le_left _ _ + linarith + · rcases le_total w.re t with h | h + · rw [min_eq_left h] + linarith + · rw [min_eq_right h] + linarith + have h5 : dist w ((min w.re t : ℝ) : ℂ) ≤ |w.re - min w.re t| + |w.im| := by + rw [dist_eq_norm] + refine (Complex.norm_le_abs_re_add_abs_im _).trans_eq ?_ + simp + linarith + +/-- **Shrinking an arc towards an end.** Let `A` be an arc off `bd(Σ)` that misses a closed set `Z`, +except perhaps at `A 0`, and let `N` be an open set around `A 0`. Then a move carries `A` into `N`, +and each point of `Z` stays where it is or moves inside `N`. The move is the slide `exists_slide` in +a thin rectangle round `A`, which moves points only to the left, towards `A 0`. -/ +theorem exists_line_slide (hS : IsSurface S) {A : unitInterval → S} (hA : IsArcMap A) + (hoff : ∀ t, A t ∉ bd S) {Z : Set S} (hZ : IsClosed Z) (hZA : ∀ t, t ≠ 0 → A t ∉ Z) {N : Set S} + (hN : IsOpen N) (h0 : A 0 ∈ N) : + ∃ α : S ≃ₜ S, IsMove α ∧ (∀ z ∈ Z, α z = z ∨ (z ∈ N ∧ α z ∈ N)) ∧ ∀ t, α (A t) ∈ N := by + classical + have ht2S : T2Space S := hS.2.1 + have hcS : CompactSpace S := hS.1 + obtain ⟨T, tT, j, Kc, hT, hj, hKc, hu, hi', -⟩ := exists_capAll S hS + have ht2 : T2Space T := hT.2.1 + have hcT : CompactSpace T := hT.1 + have hA' : IsArcMap (j ∘ A) := ⟨hj.continuous.comp hA.1, hj.injective.comp hA.2⟩ + obtain ⟨O, K, θ, hK, hθc, hθm, hθ⟩ := exists_stripChart_of_arc hT hA' + have ham : θ 0 < θ 1 := hθm zero_lt_one + set a := θ 0 with ha + set m := θ 1 with hm + have hseg : ∀ u ∈ Icc a m, ∃ t, θ t = u := fun u hu => by + obtain ⟨t, -, ht⟩ := intermediate_value_Icc (zero_le_one' unitInterval) hθc.continuousOn hu + exact ⟨t, ht⟩ + have hKA : ∀ t, K (θ t) = j (A t) := fun t => (hθ t).2 + have hoffC : ∀ t, j (A t) ∉ Kc := fun t h => by + obtain ⟨y, hy, hyj⟩ : j (A t) ∈ j '' bd S := by + rw [← hi'] + exact ⟨mem_range_self _, h⟩ + exact hoff t (hj.injective hyj ▸ hy) + -- Three open sets in the chart. + let C : Set T := Kc ∪ j '' Z + have hCc : IsClosed C := hKc.union (hj.isClosedMap _ hZ) + obtain ⟨N', hN', hNe⟩ := hj.isInducing.isOpen_iff.mp hN + let W₀ : Set ℂ := O ∩ K ⁻¹' Kcᶜ + let W₂ : Set ℂ := O ∩ K ⁻¹' Cᶜ + let W₃ : Set ℂ := O ∩ K ⁻¹' N' + have hW₀ : IsOpen W₀ := hK.hc.isOpen_inter_preimage hK.isOpen hKc.isOpen_compl + have hW₂ : IsOpen W₂ := hK.hc.isOpen_inter_preimage hK.isOpen hCc.isOpen_compl + have hW₃ : IsOpen W₃ := hK.hc.isOpen_inter_preimage hK.isOpen hN' + have ha₃ : (a : ℂ) ∈ W₃ := by + refine ⟨(hθ 0).1, ?_⟩ + change K (θ 0) ∈ N' + rw [hKA] + exact (hNe ▸ h0 : A 0 ∈ j ⁻¹' N') + obtain ⟨r, hr, hball⟩ := Metric.isOpen_iff.mp hW₃ _ ha₃ + let x₁ := min (a + r / 2) ((a + m) / 2) + have hx₁a : a < x₁ := lt_min (by linarith) (by linarith) + have hx₁m : x₁ < m := lt_of_le_of_lt (min_le_right _ _) (by linarith) + have hx₁r : x₁ ≤ a + r / 2 := min_le_left _ _ + have hsc : ∀ s, IsCompact ((fun u : ℝ => (u : ℂ)) '' Icc s m) := fun s => isCompact_Icc.image + (by fun_prop) + have hs₀ : ((fun u : ℝ => (u : ℂ)) '' Icc a m) ⊆ W₀ := by + rintro _ ⟨u, hu, rfl⟩ + obtain ⟨t, rfl⟩ := hseg u hu + refine ⟨(hθ t).1, ?_⟩ + change K (θ t) ∉ Kc + rw [hKA] + exact hoffC t + have hs₂ : ((fun u : ℝ => (u : ℂ)) '' Icc x₁ m) ⊆ W₂ := by + rintro _ ⟨u, hu, rfl⟩ + obtain ⟨t, rfl⟩ := hseg u ⟨hx₁a.le.trans hu.1, hu.2⟩ + have ht0 : t ≠ 0 := fun h => by + have : θ t = a := by rw [h] + linarith [hu.1] + refine ⟨(hθ t).1, ?_⟩ + change K (θ t) ∉ C + rw [hKA] + rintro (h | ⟨z, hz, he⟩) + · exact hoffC t h + · exact hZA t ht0 (hj.injective he ▸ hz) + obtain ⟨δ₀, hδ₀, hsub₀⟩ := (hsc a).exists_cthickening_subset_open hW₀ hs₀ + obtain ⟨δ₂, hδ₂, hsub₂⟩ := (hsc x₁).exists_cthickening_subset_open hW₂ hs₂ + set ε := min (min δ₀ δ₂) r / 4 with hε + have hεp : 0 < ε := by + have : 0 < min (min δ₀ δ₂) r := lt_min (lt_min hδ₀ hδ₂) hr + positivity + have hε1 : 2 * ε ≤ δ₀ := by + have : min (min δ₀ δ₂) r ≤ δ₀ := (min_le_left _ _).trans (min_le_left _ _) + have h0 : 0 < min (min δ₀ δ₂) r := lt_min (lt_min hδ₀ hδ₂) hr + rw [hε] + linarith + have hε2 : 2 * ε ≤ δ₂ := by + have : min (min δ₀ δ₂) r ≤ δ₂ := (min_le_left _ _).trans (min_le_right _ _) + have h0 : 0 < min (min δ₀ δ₂) r := lt_min (lt_min hδ₀ hδ₂) hr + rw [hε] + linarith + have hε3 : 4 * ε ≤ r := by + have : min (min δ₀ δ₂) r ≤ r := min_le_right _ _ + rw [hε] + linarith + set b := m + ε with hb + have hmb : m < b := by linarith + have hab : a < b := by linarith + let R : Set ℂ := Icc a b ×ℂ Icc (-ε) ε + have hRW : R ⊆ W₀ := fun w hw => hsub₀ (cthickening_mono hε1 _ (mem_cthickening_seg ham.le hw.1.1 + hw.1.2 (abs_le.mpr hw.2))) + have hRW₂ : ∀ w ∈ R, x₁ ≤ w.re → w ∈ W₂ := fun w hw h => hsub₂ (cthickening_mono hε2 _ + (mem_cthickening_seg hx₁m.le h hw.1.2 (abs_le.mpr hw.2))) + have hRN : ∀ w ∈ R, w.re ≤ x₁ → K w ∈ N' := fun w hw h => by + refine (hball ?_).2 + rw [Metric.mem_ball, dist_eq_norm] + have h1 := Complex.norm_le_abs_re_add_abs_im (w - a) + have h2 : |(w - (a : ℂ)).re| ≤ r / 2 := by + have := hw.1.1 + simp only [Complex.sub_re, Complex.ofReal_re] + rw [abs_of_nonneg (by linarith)] + linarith + have h3 : |(w - (a : ℂ)).im| ≤ ε := by + simpa using abs_le.mpr hw.2 + linarith + have hRO : R ⊆ O := fun w hw => (hRW hw).1 + let x := (a + x₁) / 2 + have hxa : a < x := by simp only [x]; linarith + have hxx₁ : x < x₁ := by simp only [x]; linarith + obtain ⟨ψ, hψc, hψm, hψa, hψb, hψx, hψle⟩ := exists_slide_fun hxa (hxx₁.trans hx₁m) hmb + obtain ⟨e, he1, he2, he3⟩ := exists_slide hK hab hεp hRO hψc hψm hψa hψb hψle + have hRr : ∀ w ∈ R, K w ∈ range j := fun w hw => by + have h1 : K w ∉ Kc := (hRW hw).2 + rcases hu.symm ▸ mem_univ (K w) with h | h + · exact h + · exact (h1 h).elim + have hinv : ∀ z, z ∈ range j ↔ e z ∈ range j := fun z => by + by_cases hz : z ∈ K '' R + · obtain ⟨w, hw, rfl⟩ := hz + obtain ⟨w', hw', -, -, he⟩ := he3 w hw + rw [he] + exact ⟨fun _ => hRr w' hw', fun _ => hRr w hw⟩ + · rw [he1 z hz] + let hjh := hj.isEmbedding.toHomeomorph + let α : S ≃ₜ S := hjh.trans ((e.subtype hinv).trans hjh.symm) + have hα : ∀ s, j (α s) = e (j s) := fun s => by + have h1 : hjh (α s) = (e.subtype hinv) (hjh s) := by + simp only [α, Homeomorph.trans_apply, Homeomorph.apply_symm_apply] + exact congrArg Subtype.val h1 + have hne : Nonempty S := ⟨A 0⟩ + let κ : T → S := Function.invFun j + have hκ : ∀ s, κ (j s) = s := Function.leftInverse_invFun hj.injective + have hjκ : ∀ w ∈ R, j (κ (K w)) = K w := fun w hw => by + obtain ⟨s, hs⟩ := hRr w hw + rw [← hs, hκ] + let K' : ℂ → S := fun w => κ (K w) + have hRc : IsCompact R := isCompact_Icc.reProdIm isCompact_Icc + have hRconv : Convex ℝ R := ((convex_Icc a b).linear_preimage Complex.reLm).inter ((convex_Icc + (-ε) ε).linear_preimage Complex.imLm) + have hK'c : ContinuousOn K' R := by + rw [hj.isInducing.continuousOn_iff] + exact (hK.hc.mono hRO).congr fun w hw => hjκ w hw + have hK'i : InjOn K' R := fun w hw w' hw' h => hK.hi (hRO hw) (hRO hw') + (by + rw [← hjκ w hw, ← hjκ w' hw'] + exact congrArg j h) + have hmemR : ∀ s, s ∈ K' '' R ↔ j s ∈ K '' R := fun s => by + constructor + · rintro ⟨w, hw, rfl⟩ + exact ⟨w, hw, (hjκ w hw).symm⟩ + · rintro ⟨w, hw, h⟩ + exact ⟨w, hw, by simp only [K', h, hκ]⟩ + have hout : ∀ s ∉ K' '' R, α s = s := fun s hs => hj.injective (by + rw [hα, he1 _ fun h => hs ((hmemR s).mpr h)]) + have hin : ∀ s ∈ K' '' R, α s ∈ K' '' R := fun s hs => by + rw [hmemR] at hs ⊢ + obtain ⟨w, hw, h⟩ := hs + obtain ⟨w', hw', -, -, he⟩ := he3 w hw + rw [hα, ← h, he] + exact mem_image_of_mem K hw' + have hbd : ∀ s ∈ bd S, s ∉ K' '' R := fun s hs h => by + obtain ⟨w, hw, hj'⟩ := (hmemR s).mp h + have hk : j s ∈ Kc := by + have : j s ∈ range j ∩ Kc := by rw [hi']; exact mem_image_of_mem j hs + exact this.2 + exact (hRW hw).2 (hj' ▸ hk) + have hNj : ∀ s, j s ∈ N' ↔ s ∈ N := fun s => by + rw [← hNe] + rfl + refine ⟨α, isMove_of_chart hRc hRconv hK'c hK'i hout hin hbd, fun z hz => ?_, fun t => ?_⟩ + · by_cases hzR : z ∈ K' '' R + · obtain ⟨w, hw, hj'⟩ := (hmemR z).mp hzR + have hre : w.re ≤ x₁ := by + by_contra hc + exact (hRW₂ w hw (not_le.mp hc).le).2 (.inr ⟨z, hz, hj'.symm⟩) + obtain ⟨w', hw', hle, -, he⟩ := he3 w hw + refine .inr ⟨(hNj z).mp (hj' ▸ hRN w hw hre), (hNj _).mp ?_⟩ + rw [hα, ← hj', he] + exact hRN w' hw' (hle.trans hre) + · exact .inl (hout z hzR) + · have h1 : θ t ∈ Icc a b := ⟨hθm.monotone (show (0 : unitInterval) ≤ t from t.2.1), + (hθm.monotone (show t ≤ 1 from t.2.2)).trans hmb.le⟩ + have h2 : j (α (A t)) = K ((ψ (θ t) : ℝ) : ℂ) := by + rw [hα, ← hKA, he2 _ h1] + have h3 : ψ (θ t) ∈ Icc a x := by + constructor + · rw [← hψa] + exact hψm.monotone h1.1 + · rw [← hψx] + exact hψm.monotone (hθm.monotone (show t ≤ 1 from t.2.2)) + refine (hNj _).mp ?_ + rw [h2] + refine hRN _ ⟨⟨?_, ?_⟩, ?_⟩ ?_ + · simpa using h3.1 + · simp only [Complex.ofReal_re] + linarith [h3.2, hxx₁, hx₁m] + · simp [hεp.le] + · simp only [Complex.ofReal_re] + linarith [h3.2] + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/MoveOff.lean b/LeanPool/GraphMinor/GM07/MoveOff.lean new file mode 100644 index 0000000000..41deef8192 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/MoveOff.lean @@ -0,0 +1,177 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Slit +public import LeanPool.GraphMinor.GM07.GoodEdge +import LeanPool.GraphMinor.GM12.Section4DiscMatch + +/-! +# Moving a forest off a line + +For (7.5), page 241: "We may assume that `U(H) ∩ ē = ∅`." The line `ē` lies in a disc off the +boundary. We shrink this disc to a small +disc that misses the forest. The homeomorphism is the identity near the boundary, so the forest is +the same up to homoplasty. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +/-- A line off the boundary lies inside a disc off the boundary. -/ +theorem exists_disc_of_line_aux {M : Type} [TopologicalSpace M] (hM : IsSurface M) {L : Set M} {u v + : M} + (hL : IsLineWithEnds L u v) (hd : L ∩ bd M = ∅) : ∃ B, IsClosedDisc B ∧ L ⊆ discInt B + ∧ B ∩ bd M = ∅ := by + classical + have ht2M : T2Space M := hM.2.1 + obtain ⟨K₀, s, _, hs1, hK₀c, hK₀i, _, hK₀bd, _, _, hLine⟩ := + exists_line_chart_aux hM hL hd isOpen_univ (subset_univ L) + let B : Set ℂ := closedBall 0 1 + have hBc : IsCompact B := isCompact_closedBall _ _ + obtain ⟨hD, hDb⟩ := closedBall_disc (zero_lt_one' ℝ) + obtain ⟨K', hK'c, hK'l⟩ := exists_inv_of_compactOn hBc hK₀c hK₀i + obtain ⟨hE, hEb⟩ := hD.image hK₀c hK'c hK'l + rw [hDb] at hEb + have hzof : ∀ x ∈ L, ∃ z ∈ B, ‖z‖ < 1 ∧ K₀ z = x := fun x hx => by + obtain ⟨z, hz, him, hre, rfl⟩ := (hLine x).mp hx + refine ⟨z, hz, ?_, rfl⟩ + have : z = (z.re : ℂ) := Complex.ext (by simp) (by simp [him]) + rw [this, Complex.norm_real, Real.norm_eq_abs] + simpa using hre.trans_lt hs1 + refine ⟨K₀ '' B, hE, fun x hx => ?_, ?_⟩ + · obtain ⟨z, hz, hnorm, rfl⟩ := hzof x hx + refine ⟨⟨z, hz, rfl⟩, fun hb => ?_⟩ + rw [hEb] at hb + obtain ⟨w, hw, he⟩ := hb + have hwB : w ∈ B := sphere_subset_closedBall hw + rw [hK₀i hwB hz he, mem_sphere_zero_iff_norm] at hw + exact hnorm.ne hw + · rw [eq_empty_iff_forall_notMem] + rintro x ⟨⟨z, hz, rfl⟩, hb⟩ + exact hK₀bd z hz hb + +/-- A line off the boundary lies inside a disc off the boundary. -/ +theorem exists_disc_of_line {S : Type u} [TopologicalSpace S] {M : Type} [TopologicalSpace M] + (hM : IsSurface M) (h : S ≃ₜ M) + {L : Set S} {u v : S} (hL : IsLineWithEnds L u v) (hd : L ∩ bd S = ∅) : ∃ B, IsClosedDisc B + ∧ L ⊆ discInt B ∧ B ∩ bd S = ∅ := by + have ht2 : T2Space M := hM.2.1 + have hbd : h '' bd S = bd M := image_bd_homeomorph h + have hS2 : T2Space S := h.isEmbedding.t2Space + have hL' : IsLineWithEnds (h '' L) (h u) (h v) := by + obtain ⟨f, h0, h1⟩ := hL + refine ⟨f.trans (h.image L), ?_, ?_⟩ + · change h (f 0).1 = h u + rw [h0] + · change h (f 1).1 = h v + rw [h1] + obtain ⟨B, hB, hLB, hoff⟩ := exists_disc_of_line_aux hM hL' (by + rw [← hbd, ← image_inter h.injective, hd, image_empty]) + have hB' := isClosedDisc_image_of_injOn hB h.symm.continuous h.symm.injective.injOn + have hinv : ∀ x, h.symm (h x) = x := h.symm_apply_apply + refine ⟨h.symm '' B, hB'.1, fun x hx => ?_, ?_⟩ + · have h1 := hLB (mem_image_of_mem h hx) + refine ⟨⟨h x, h1.1, hinv x⟩, fun hb => ?_⟩ + rw [hB'.2] at hb + obtain ⟨y, hy, he⟩ := hb + have : y = h x := by rw [← he, h.apply_symm_apply] + exact h1.2 (this ▸ hy) + · rw [eq_empty_iff_forall_notMem] + rintro x ⟨⟨y, hy, rfl⟩, hb⟩ + have h2 : y ∈ B ∩ bd M := ⟨hy, by + rw [← hbd] + exact ⟨h.symm y, hb, h.apply_symm_apply y⟩⟩ + rw [hoff] at h2 + exact h2 + +/-- A forest has no loops. -/ +theorem IsSurfaceForest.closure_edge_line {S : Type u} [TopologicalSpace S] {H : Drawing S} + (hH : IsSurfaceForest H) {f : Set S} (hf : f ∈ H.E) : + ∃ u v, IsLineWithEnds (closure f) u v := by + classical + rcases H.edge_cond f hf with ⟨u, v, -, -, hl⟩ | ⟨v, hcap, -⟩ + · exact ⟨u, v, hl⟩ + · exfalso + have hv : v ∈ H.V := by + have : v ∈ closure f ∩ H.V := by rw [hcap]; rfl + exact this.2 + have hlink : H.toGraph.IsLink f v v := ⟨hf, hv, hv, by rw [hcap]; simp⟩ + have := hH.2 v (.cons hlink (.nil hv)) (by simp [GraphWalk.IsSimpleClosed, GraphWalk.support, + GraphWalk.edges]) + simp [GraphWalk.length, GraphWalk.edges] at this + +/-- "We may assume that `U(H) ∩ ē = ∅`." -/ +theorem exists_move_off_line {S : Type u} [TopologicalSpace S] (hS : IsSurface S) [ConnectedSpace + S] {M : Type} [TopologicalSpace M] (hM : IsSurface M) + (h : S ≃ₜ M) {H : Drawing S} (hH : IsSurfaceForest H) {L : Set S} {u v : S} + (hL : IsLineWithEnds L u v) (hd : L ∩ bd S = ∅) : + ∃ β : S ≃ₜ S, (∀ x ∈ bd S, β x = x) ∧ Disjoint (β '' H.U) L := by + classical + have ht2 : T2Space S := hS.2.1 + have hman := hS.2.2 + obtain ⟨B, hB, hLB, hoff⟩ := exists_disc_of_line hM h hL hd + have hBint : ∀ x ∈ B, IsInteriorPoint x := fun x hx => by + by_contra hn + have h1 : x ∈ B ∩ bd S := ⟨hx, hn⟩ + rw [hoff] at h1 + exact h1 + -- A larger disc, off the boundary. + obtain ⟨E, hE, hBE, hEs⟩ := exists_disc_around hman hB (fun x hx => hBint x + (Surface.discBd_subset _ hx)) (isClosed_bd S).isOpen_compl + (fun x hx hb => by + have h1 : x ∈ B ∩ bd S := ⟨Surface.discBd_subset _ hx, hb⟩ + rw [hoff] at h1 + exact h1) + have hEoff : ∀ x ∈ bd S, x ∉ E := fun x hx hxE => by + rcases hEs hxE with h1 | h1 + · have h2 : x ∈ B ∩ bd S := ⟨h1, hx⟩ + rw [hoff] at h2 + exact h2 + · exact h1 hx + -- A point of the inside of `B` off the forest, in a small disc off the forest. + have hfin : (closure '' H.E).Finite := H.finite_edges.image _ + obtain ⟨p, hp, hpoff⟩ := exists_mem_discInt_off hS hB hfin (by + rintro _ ⟨f, hf, rfl⟩ + exact hH.closure_edge_line hf) + have hUclosed : IsClosed (⋃₀ (closure '' H.E)) := hfin.isClosed_sUnion (by + rintro _ ⟨f, -, rfl⟩ + exact isClosed_closure) + have hOpen := (hB.isOpen_discInt hman).inter hUclosed.isOpen_compl + obtain ⟨D₀, hD₀, hpD₀, hD₀s⟩ := exists_disc_in_open (hBint p hp.1) hOpen ⟨hp, hpoff⟩ + obtain ⟨q, hq, hqV⟩ : ∃ q ∈ discBd D₀, q ∉ H.V := by + by_contra hn + push Not at hn + exact (infinite_of_isOArc hD₀.isOArc_discBd) (H.finite_V.subset hn) + have hqO := hD₀s (Surface.discBd_subset _ hq) + have hqU : q ∉ H.U := fun hU => by + rw [H.U_eq] at hU + rcases hU with hV | hU + · exact hqV hV + · obtain ⟨f, hf, hx⟩ := mem_iUnion₂.mp hU + exact hqO.2 ⟨closure f, ⟨f, hf, rfl⟩, hx⟩ + obtain ⟨A, hA, hqA, hAs⟩ := exists_disc_in_open (hBint q hqO.1.1) ((hB.isOpen_discInt hman).inter + H.isClosed_U.isOpen_compl) ⟨hqO.1, hqU⟩ + obtain ⟨e, he, hfix⟩ := GraphMinor.GM12.exists_disc_onto_nested hman hA hB hE (fun x hx => + (hAs hx).1) hBE + refine ⟨e, fun x hx => hfix x (hEoff x hx), ?_⟩ + rw [disjoint_left] + rintro _ ⟨x, hxU, rfl⟩ hxL + have h1 : e x ∈ B := (hLB hxL).1 + rw [← he] at h1 + obtain ⟨y, hy, hyx⟩ := h1 + rw [e.injective hyx] at hy + exact (hAs hy).2 hxU + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/MultiCut.lean b/LeanPool/GraphMinor/GM07/MultiCut.lean new file mode 100644 index 0000000000..5b10bfdef7 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/MultiCut.lean @@ -0,0 +1,280 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM19.Section6a + +/-! +# Cutting along several edges + +For step 2 of (9.1), page 243: "By $r = |E(H)|$ applications of (7.4), we can find distinct edges +$e_1, \dots, e_r$ of $G$ which are not loops +such that...". `IsMultiCut` records the surface `Σ_r` got by cutting `Σ` along all of these edges, +and `exists_multiCut` builds it, one cut at a time. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +/-- `θ : S_r → S` cuts `S` along the closures of the edges in `𝓔`, and `G_r` is the preimage of `G` +minus these edges. -/ +structure IsMultiCut {S S_r : Type u} [TopologicalSpace S] [TopologicalSpace S_r] (G : Drawing S) + (𝓔 : Set (Set S)) (θ : S_r → S) (G_r : Drawing S_r) : Prop where + finite : 𝓔.Finite + sub : 𝓔 ⊆ G.E + off_bd : ∀ e ∈ 𝓔, Disjoint (closure e) (bd S) + not_loop : ∀ e ∈ 𝓔, (tilde e).ncard = 2 + disj : ∀ e ∈ 𝓔, ∀ e' ∈ 𝓔, e ≠ e' → Disjoint (closure e) (closure e') + quot : IsQuotientMap θ + preV : G_r.V = θ ⁻¹' G.V + preU : G_r.U = θ ⁻¹' (G.U \ ⋃₀ 𝓔) + inj : ∀ x y, θ x = θ y → x = y ∨ θ x ∈ ⋃₀ 𝓔 + bd_eq : bd S_r = θ ⁻¹' (bd S ∪ ⋃ e ∈ 𝓔, closure e) + edges : ∀ f ∈ G_r.E, θ '' f ∈ G.E ∧ Disjoint (θ '' f) (⋃₀ 𝓔) ∧ f = θ ⁻¹' (θ '' f) + +variable {S S_r Y : Type u} [TopologicalSpace S] [TopologicalSpace S_r] [TopologicalSpace Y] + +theorem isMultiCut_refl (G : Drawing S) : IsMultiCut G ∅ (id : S → S) G where + finite := finite_empty + sub := empty_subset _ + off_bd := by simp + not_loop := by simp + disj := by simp + quot := IsQuotientMap.id + preV := rfl + preU := by simp + inj := by simp + bd_eq := by simp + edges f hf := by simpa using hf + +theorem IsCutAlongEdge.ncard_bd_le {G : Drawing S} {e : Set S} {a b c : ℕ} {φ : Y + → S} {G_e : Drawing Y} + (hCut : IsCutAlongEdge G e a b c Y φ G_e) : (G_e.V ∩ bd Y).ncard ≤ (G.V ∩ bd S).ncard + 2 := by + classical + have he := hCut.mem_E + have hl := hCut.not_loop + have hs := hCut.quotientMap.surjective + obtain ⟨u, v, -, hcap, -⟩ : ∃ u v : S, u ≠ v ∧ closure e ∩ G.V = {u, v} ∧ IsLineWithEnds + (closure e) u v := by + rcases G.edge_cond e he with h1 | ⟨u, hcap, -⟩ + · exact h1 + · rw [GraphMinor.GM19.tilde_eq_inter_V G he, hcap] at hl + simp at hl + have heV : ∀ x ∈ e, x ∉ G.V := fun x hx => (he.2.1 hx).2 + obtain ⟨u', hu⟩ := hs u + obtain ⟨v', hv⟩ := hs v + have hucap : u ∈ closure e ∩ G.V := by rw [hcap]; simp + have hvcap : v ∈ closure e ∩ G.V := by rw [hcap]; simp + have huniq : ∀ x, φ x = u ∨ φ x = v → x = u' ∨ x = v' := by + rintro x (h | h) + · exact .inl ((hCut.inj x u' (h.trans hu.symm)).resolve_right fun h1 => heV _ h1 (h ▸ hucap.2)) + · exact .inr ((hCut.inj x v' (h.trans hv.symm)).resolve_right fun h1 => heV _ h1 (h ▸ hvcap.2)) + have hGV : ∀ x, x ∈ G_e.V ↔ φ x ∈ G.V := fun x => by rw [hCut.preimage_V]; rfl + have hbde : ∀ x, x ∈ bd Y ↔ φ x ∈ bd S ∨ φ x ∈ closure e := fun x => by rw [hCut.bd_eq]; rfl + have hfinG : (G.V ∩ bd S).Finite := G.finite_V.subset inter_subset_left + have hsub : G_e.V ∩ bd Y ⊆ ((G_e.V ∩ bd Y) \ {u', v'}) ∪ {u', v'} := fun x hx => by + by_cases h : x ∈ ({u', v'} : Set Y) + · exact .inr h + · exact .inl ⟨hx, h⟩ + have hmaps : MapsTo φ ((G_e.V ∩ bd Y) \ {u', v'}) (G.V ∩ bd S) := fun x hx => by + have h1 := (hGV x).mp hx.1.1 + refine ⟨h1, ?_⟩ + rcases (hbde x).mp hx.1.2 with h2 | h2 + · exact h2 + · have h3 : φ x ∈ closure e ∩ G.V := ⟨h2, h1⟩ + rw [hcap] at h3 + exact absurd (huniq x (by simpa using h3)) hx.2 + have hinj : InjOn φ ((G_e.V ∩ bd Y) \ {u', v'}) := fun x hx y hy hxy => + (hCut.inj x y hxy).resolve_right fun h1 => heV _ h1 (hmaps hx).1 + have hfin : ((G_e.V ∩ bd Y) \ {u', v'}).Finite := Set.Finite.of_injOn hmaps hinj hfinG + calc (G_e.V ∩ bd Y).ncard ≤ (((G_e.V ∩ bd Y) \ {u', v'}) ∪ {u', v'}).ncard := + ncard_le_ncard hsub (hfin.union (by simp)) + _ ≤ ((G_e.V ∩ bd Y) \ {u', v'}).ncard + ({u', v'} : Set Y).ncard := ncard_union_le _ _ + _ ≤ (G.V ∩ bd S).ncard + 2 := Nat.add_le_add (ncard_le_ncard_of_injOn φ hmaps hinj hfinG) + ((ncard_insert_le _ _).trans (by simp)) + +theorem IsMultiCut.step [T2Space S] [CompactSpace S_r] [T2Space S_r] [CompactSpace Y] + {G : Drawing S} {𝓔 : Set (Set S)} {θ : S_r → S} {G_r : Drawing S_r} + (hm : IsMultiCut G 𝓔 θ G_r) {e' : Set S_r} {a b c : ℕ} {φ : Y → S_r} {G' : Drawing Y} + (hCut : IsCutAlongEdge G_r e' a b c Y φ G') : + θ '' e' ∉ 𝓔 ∧ IsMultiCut G (insert (θ '' e') 𝓔) (θ ∘ φ) G' := by + classical + have hc := hm.quot.continuous + have hs := hm.quot.surjective + have he' := hCut.mem_E + obtain ⟨heG, heoff, hepre⟩ := hm.edges e' he' + set e := θ '' e' with hedef + have hcl : closure e = θ '' closure e' := + (image_closure_subset_closure_image hc).antisymm' (closure_minimal (image_mono subset_closure) + (isClosed_closure.isCompact.image hc).isClosed) + have hbdθ : ∀ x, x ∈ bd S_r ↔ θ x ∈ bd S ∪ ⋃ f ∈ 𝓔, closure f := fun x => by rw [hm.bd_eq]; rfl + have hoff : ∀ x ∈ closure e', θ x ∉ bd S ∪ ⋃ f ∈ 𝓔, closure f := fun x hx hn => by + have h1 : x ∈ closure e' ∩ bd S_r := ⟨hx, (hbdθ x).mpr hn⟩ + rw [hCut.disjoint_bd] at h1 + exact h1 + have hcloff : ∀ f ∈ 𝓔, Disjoint (closure e) (closure f) := fun f hf => by + rw [hcl, disjoint_left] + rintro _ ⟨x, hx, rfl⟩ h2 + exact hoff x hx (.inr (mem_iUnion₂.mpr ⟨f, hf, h2⟩)) + have hebd : Disjoint (closure e) (bd S) := by + rw [hcl, disjoint_left] + rintro _ ⟨x, hx, rfl⟩ h2 + exact hoff x hx (.inl h2) + have hne : e.Nonempty := by + obtain ⟨x, hx⟩ := he'.2.2.1.nonempty + exact ⟨θ x, x, hx, rfl⟩ + have hnot : e ∉ 𝓔 := fun h => by + obtain ⟨x, hx⟩ := hne + exact disjoint_left.mp (hcloff e h) (subset_closure hx) (subset_closure hx) + have hoffU : ∀ x, x ∈ G_r.U → θ x ∉ ⋃₀ 𝓔 := fun x hx => by + rw [hm.preU] at hx + exact hx.2 + have hpre : θ ⁻¹' closure e = closure e' := by + apply Subset.antisymm + · intro y hy + change θ y ∈ closure e at hy + rw [hcl] at hy + obtain ⟨y', hy', he⟩ := hy + rcases hm.inj y' y he with rfl | h + · exact hy' + · exact absurd h (hoffU y' (G_r.closure_subset_U he' hy')) + · intro y hy + change θ y ∈ closure e + rw [hcl] + exact ⟨y, hy, rfl⟩ + refine ⟨hnot, ?_⟩ + refine ⟨hm.finite.insert _, insert_subset heG hm.sub, ?_, ?_, ?_, + hm.quot.comp hCut.quotientMap, ?_, ?_, ?_, ?_, ?_⟩ + · rintro f (rfl | hf) + · exact hebd + · exact hm.off_bd f hf + · rintro f (rfl | hf) + · rw [GraphMinor.GM19.tilde_eq_inter_V G heG] + have h1 : closure e ∩ G.V = θ '' (closure e' ∩ G_r.V) := by + rw [hcl] + ext z + constructor + · rintro ⟨⟨x, hx, rfl⟩, hz⟩ + exact ⟨x, ⟨hx, by rw [hm.preV]; exact hz⟩, rfl⟩ + · rintro ⟨x, ⟨hx, hxV⟩, rfl⟩ + rw [hm.preV] at hxV + exact ⟨⟨x, hx, rfl⟩, hxV⟩ + have hinj : InjOn θ (closure e' ∩ G_r.V) := fun x hx y hy hxy => + (hm.inj x y hxy).resolve_right (hoffU x (G_r.V_subset_U hx.2)) + rw [h1, hinj.ncard_image, ← GraphMinor.GM19.tilde_eq_inter_V G_r he'] + exact hCut.not_loop + · exact hm.not_loop f hf + · rintro f (rfl | hf) f' (rfl | hf') hne + · exact absurd rfl hne + · exact hcloff f' hf' + · exact (hcloff f hf).symm + · exact hm.disj f hf f' hf' hne + · rw [hCut.preimage_V, hm.preV] + rfl + · rw [hCut.preimage_U, hm.preU, sUnion_insert] + ext x + simp only [mem_preimage, mem_sdiff, mem_union, not_or, Function.comp, hepre] + tauto + · intro x y hxy + rcases hm.inj _ _ hxy with h | h + · rcases hCut.inj x y h with h1 | h1 + · exact .inl h1 + · exact Or.inr (by rw [sUnion_insert]; exact Or.inl ⟨φ x, h1, rfl⟩) + · exact .inr (by rw [sUnion_insert]; exact .inr h) + · have h1 : ⋃ f ∈ insert e 𝓔, closure f = closure e ∪ ⋃ f ∈ 𝓔, closure f := by + rw [biUnion_insert] + rw [hCut.bd_eq, hm.bd_eq, h1, ← hpre] + ext x + simp only [mem_preimage, mem_union, Function.comp] + tauto + · intro f hf + obtain ⟨h1, h2, h3⟩ := hCut.exists_edge hf + obtain ⟨h4, h5, h6⟩ := hm.edges _ h1 + have him : (θ ∘ φ) '' f = θ '' (φ '' f) := image_comp θ φ f + rw [him] + refine ⟨h4, ?_, ?_⟩ + · rw [sUnion_insert, disjoint_union_right] + refine ⟨?_, h5⟩ + rw [disjoint_left] + rintro _ ⟨y, hy, rfl⟩ ⟨y₂, hy₂, he⟩ + rcases hm.inj y₂ y he with rfl | h7 + · exact disjoint_left.mp h2 hy hy₂ + · exact disjoint_left.mp h5 ⟨y, hy, rfl⟩ (he ▸ h7) + · rw [preimage_comp, ← h6] + exact h3 + +/-- `r` applications of (7.4). -/ +theorem exists_multiCut {S : Type u} [TopologicalSpace S] [T1Space S] + (hS : IsSurface S) {a b c : ℕ} (h3 : 3 ≤ 3 * a + 3 * b + c) (hm : Nonempty + (S ≃ₜ SurfaceModel a b c)) + (G : Drawing S) (hBL : IsBoundaryLinked G) {k v r : ℕ} (hk : 1 ≤ k) (hv : 1 ≤ v) (hcount : + (G.V ∩ bd S).ncard + 2 * r ≤ 2 * k) + (hα : 42 * k * 5 ^ r * v ≤ alpha G) : ∀ i, i ≤ r → ∃ (S_i : Type u) (_ : TopologicalSpace S_i) + (_ : T1Space S_i) (θ : S_i → S) (G_i : Drawing S_i) (𝓔 : Set (Set S)), + IsMultiCut G 𝓔 θ G_i ∧ 𝓔.ncard = i ∧ IsSurface S_i ∧ Nonempty (S_i ≃ₜ SurfaceModel a b + (c + i)) ∧ IsBoundaryLinked G_i ∧ + 42 * k * 5 ^ (r - i) * v ≤ alpha G_i ∧ (G_i.V ∩ bd S_i).ncard ≤ (G.V ∩ bd S).ncard + 2 * i + := by + have ht2 : T2Space S := hS.2.1 + intro i + induction i with + | zero => + intro _ + exact ⟨S, inferInstance, inferInstance, id, G, ∅, isMultiCut_refl G, by simp, hS, hm, hBL, + by simpa using hα, by simp⟩ + | succ i ih => + intro hi + obtain ⟨S_i, tS, t1S, θ, G_i, 𝓔, hmc, hcard, hSi, hmi, hBLi, hαi, hbdi⟩ := ih (by omega) + have ht2i : T2Space S_i := hSi.2.1 + have hci : CompactSpace S_i := hSi.1 + set s := 42 * k * 5 ^ (r - (i + 1)) * v with hs + have h5 : 5 ^ (r - i) = 5 * 5 ^ (r - (i + 1)) := by + rw [show r - i = r - (i + 1) + 1 by omega, pow_succ] + ring + have hαs : 5 * s ≤ alpha G_i := by + rw [h5] at hαi + calc 5 * s = 42 * k * (5 * 5 ^ (r - (i + 1))) * v := by rw [hs]; ring + _ ≤ _ := hαi + have hslow : 42 ≤ s := by + have h1 : 1 ≤ 5 ^ (r - (i + 1)) := Nat.one_le_pow _ _ (by norm_num) + have h2 : 1 * 1 * 1 ≤ k * 5 ^ (r - (i + 1)) * v := Nat.mul_le_mul (Nat.mul_le_mul hk h1) hv + rw [hs] + nlinarith + have hslow2 : 2 * k + 1 ≤ s := by + have h1 : 1 ≤ 5 ^ (r - (i + 1)) := Nat.one_le_pow _ _ (by norm_num) + have h2 : 1 * 1 ≤ 5 ^ (r - (i + 1)) * v := Nat.mul_le_mul h1 hv + have h3' : k * (1 * 1) ≤ k * (5 ^ (r - (i + 1)) * v) := Nat.mul_le_mul_left k h2 + rw [hs] + nlinarith + have hcuff : ∀ C ∈ cuffs S_i, (G_i.V ∩ C).ncard ≤ s - 1 := by + intro C hC + have hsub : C ⊆ bd S_i := by + rw [← sUnion_cuffs] + exact subset_sUnion_of_mem hC + have := ncard_le_ncard (inter_subset_inter_right G_i.V hsub) (G_i.finite_V.subset + inter_subset_left) + omega + obtain ⟨e', Y, tY, t1Y, φ, G', hCut, hBL', hα'⟩ := theorem_7_4_proof hSi + (by omega) hmi G_i s hBLi (by omega) (by omega) hcuff + have hY := hCut.isSurface + have ht2Y : T2Space Y := hY.2.1 + have hcY : CompactSpace Y := hY.1 + obtain ⟨hnew, hmc'⟩ := hmc.step hCut + refine ⟨Y, tY, t1Y, θ ∘ φ, G', _, hmc', ?_, hY, hCut.homeo_model, hBL', hα', ?_⟩ + · rw [ncard_insert_of_notMem hnew hmc.finite, hcard] + · have := hCut.ncard_bd_le + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetExists.lean b/LeanPool/GraphMinor/GM07/NetExists.lean new file mode 100644 index 0000000000..f4fbd20a84 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetExists.lean @@ -0,0 +1,109 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.NetExistsLines +public import LeanPool.GraphMinor.GM07.NetExistsWord +public import LeanPool.GraphMinor.GM07.MinimalNet +public import LeanPool.GraphMinor.GM11.EdgeSides + +/-! +# A minimal net exists + +Graph Minors VII, page 216: "It is easy to see that if $\Sigma$ is connected and $G$ is a proper +graph in $\Sigma$, there is a $G$-normal net." +We follow the three steps of the sketch there. Cut along the graph and write each component as a +polygon: its added edges avoid the graph +(`GM07/NetExistsHole.lean`). Cut the polygons so that each one has at most one side on an edge of +`G`, and paste along the edges of `G`, +which gives the discs of the sketch (`GM07/NetExistsGlue.lean`). Paste these discs into one polygon +(`exists_one_word_off`). Its boundary +meets `G` only in `V(G)`, so the polygon is a `G`-normal net (`exists_net_of_word`), and +`Net.exists_isMinimalFor` gives a minimal one. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +theorem arcComponentsIn_eq_of_mem {S : Type u} [TopologicalSpace S] {F C D : Set S} + (hC : C ∈ arcComponentsIn F) (hD : D ∈ arcComponentsIn F) {x : S} + (hxC : x ∈ C) (hxD : x ∈ D) : C = D := by + have h1 : IsPathConnected (C ∪ D) := hC.2.2.1.union hD.2.2.1 ⟨x, hxC, hxD⟩ + have h2 := hC.2.2.2 (C ∪ D) (union_subset hC.2.1 hD.2.1) h1 subset_union_left + have h3 := hD.2.2.2 (C ∪ D) (union_subset hC.2.1 hD.2.1) h1 subset_union_right + exact h2.symm.trans h3 + +/-- **A minimal net exists.** Graph Minors VII, page 216: a connected surface with at least two +cuffs has, for each proper graph `G`, a +minimal net. -/ +theorem exists_minimal_net : ∀ (S : Type u) [TopologicalSpace S], IsSurface S + → ConnectedSpace S → 2 ≤ (cuffs S).ncard → + ∀ G : Drawing S, G.IsProper → ∃ N : Net S, N.IsMinimalFor G := by + intro S _ hS _ hc G hG + have : T2Space S := hS.2.1 + have hfin : Finite G.E := G.finite_edges.to_subtype + have hp := fun e : G.E => GM11.exists_edge_param G e.2 + choose γ c1 c2 c3 c4 c5 using hp + set c : G.E → ℝ → S := fun e => extI (γ e) with hc' + have hIoo : ∀ {u : ℝ}, u ∈ Ioo (0 : ℝ) 1 → u ∈ Icc (0 : ℝ) 1 := fun hu => ⟨hu.1.le, hu.2.le⟩ + have hval : ∀ e, ∀ u (hu : u ∈ Ioo (0 : ℝ) 1), c e u = γ e ⟨u, hIoo hu⟩ := fun e u hu + => extI_of_mem _ (hIoo hu) + have hI : ∀ {u : ℝ} (hu : u ∈ Ioo (0 : ℝ) 1), (⟨u, hIoo hu⟩ : unitInterval) ∈ Ioo + (0 : unitInterval) 1 := fun hu => ⟨hu.1, hu.2⟩ + have hmem : ∀ e, ∀ u ∈ Ioo (0 : ℝ) 1, c e u ∈ e.1 := fun e u hu => by + rw [hval e u hu, ← c5 e] + exact mem_image_of_mem _ (hI hu) + have hsub : ∀ e : G.E, e.1 ⊆ G.U \ G.V := fun e => e.2.2.1 + have hoff : ∀ e, ∀ u ∈ Ioo (0 : ℝ) 1, c e u ∉ G.V := fun e u hu => (hsub e (hmem e u hu)).2 + have h0 : ∀ e, c e 0 ∈ G.V := fun e => by + rw [hc'] + simp only + rw [extI_of_mem _ (by simp)] + exact c2 e + have h1 : ∀ e, c e 1 ∈ G.V := fun e => by + rw [hc'] + simp only + rw [extI_of_mem _ (by simp)] + exact c3 e + have hinj : ∀ e, InjOn (c e) (Ioo 0 1) := fun e u hu v hv he => by + rw [hval e u hu, hval e v hv] at he + exact congrArg Subtype.val (c4 e (hI hu) (hI hv) he) + have hdis : ∀ e e', e ≠ e' → ∀ u ∈ Ioo (0 : ℝ) 1, ∀ v ∈ Ioo (0 : ℝ) 1, c e u ≠ c e' v + := fun e e' hne u hu v hv he => + hne (Subtype.ext (arcComponentsIn_eq_of_mem e.2 e'.2 (hmem e u hu) (he ▸ hmem e' v hv))) + have hbd : ∀ e, ∀ u ∈ Ioo (0 : ℝ) 1, c e u ∉ bd S := fun e u hu hb => + hoff e u hu (hG ⟨hb, (hsub e (hmem e u hu)).1⟩) + obtain ⟨Y, t1, t2, κ, f, a, inner, ψ, ξ, η, hY, hC, hk⟩ := exists_edges_cut hS (fun e + => continuous_extI (c1 e)) hinj h0 h1 hoff hdis hbd + have hB : ∀ x ∈ G.U \ G.V, ∃ k, inner k ∧ ∃ u ∈ Ioo (0 : ℝ) 1, x = a k u := fun x hx => by + have hxe : pathComponentIn (G.U \ G.V) x ∈ G.E := pathComponentIn_mem_arcComponentsIn hx + have hx' : x ∈ (⟨_, hxe⟩ : G.E).1 := mem_pathComponentIn_self hx + rw [← c5 ⟨_, hxe⟩] at hx' + obtain ⟨⟨u, hu⟩, hu', he⟩ := hx' + have hu2 : u ∈ Ioo (0 : ℝ) 1 := ⟨hu'.1, hu'.2⟩ + obtain ⟨k, h2, h3⟩ := hk ⟨_, hxe⟩ + refine ⟨k, h2, u, hu2, ?_⟩ + rw [h3 u hu2] + exact he.symm.trans (hval _ u hu2).symm + obtain ⟨w, g, h2, h3, h4, h5⟩ := exists_off_word_of_cut hC hY hB + obtain ⟨N, hr, hseam⟩ := exists_net_of_word hS hc h2 h3 h4 + obtain ⟨J, hJ⟩ := Net.exists_isSeamGraphFor hS N hr + refine Net.exists_isMinimalFor ⟨J, hJ, ?_⟩ + rintro x ⟨hx, hxU⟩ + rw [hJ.2.1] at hx + obtain ⟨z, hz, rfl⟩ := hseam hx + by_contra hn + exact h5 z hz ⟨hxU, hn⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetExistsCut.lean b/LeanPool/GraphMinor/GM07/NetExistsCut.lean new file mode 100644 index 0000000000..c33a8c14af --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetExistsCut.lean @@ -0,0 +1,797 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.NetExistsGlue +public import LeanPool.GraphMinor.GM07.NetExistsHole +public import LeanPool.GraphMinor.GM07.NetExistsFamily + +/-! +# From a cut surface to one polygon + +`IsNetCut` is the surface `Y` got by cutting `S` along finitely many paths. Each component of `Y` +has a polygon whose free sides are the +lifts of the paths (`exists_comp_word`). Give the two lifts of a path one label. These polygons +present `S`, and each point of the +open paths is on an open side with such a label. Then `exists_off_word` pastes them into one polygon +whose sides avoid a given set of +points of the open paths (`exists_off_word_of_cut`). These are steps 1 to 3 of the sketch in Graph +Minors VII, page 216. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface + +universe u + +/-- `ψ : Y → S` cuts `S` along the paths `a κ`, and `ξ κ`, `η κ` are the two lifts of the path `a +κ`. A path that is not inner has one lift. +The paths may be closed. A point inside a path is on no other path, and it is not an end of its own +path. -/ +structure IsNetCut {S Y κ : Type*} [TopologicalSpace S] [TopologicalSpace Y] (a : κ → ℝ → S) + (inner : κ → Prop) (ψ : Y → S) (ξ η : κ → ℝ → Y) : Prop where + cont : Continuous ψ + surj : Function.Surjective ψ + cξ : ∀ k, ContinuousOn (ξ k) (Icc 0 1) + cη : ∀ k, ContinuousOn (η k) (Icc 0 1) + hξ : ∀ k, ∀ u ∈ Icc (0 : ℝ) 1, ψ (ξ k u) = a k u + hη : ∀ k, ∀ u ∈ Icc (0 : ℝ) 1, ψ (η k u) = a k u + bdξ : ∀ k, ∀ u ∈ Icc (0 : ℝ) 1, ξ k u ∈ bd Y + bdη : ∀ k, ∀ u ∈ Icc (0 : ℝ) 1, η k u ∈ bd Y + ne : ∀ k, inner k → ∀ u ∈ Ioo (0 : ℝ) 1, ξ k u ≠ η k u + eqb : ∀ k, ¬ inner k → ∀ u ∈ Icc (0 : ℝ) 1, η k u = ξ k u + cover : ∀ y ∈ bd Y, ∃ k, ∃ u ∈ Icc (0 : ℝ) 1, y = ξ k u ∨ y = η k u + fib : ∀ y y', ψ y = ψ y' → Relation.EqvGen (fun p q ↦ ∃ k, ∃ u ∈ Icc (0 : ℝ) 1, p = ξ k u ∧ q + = η k u) y y' + inj : ∀ k, InjOn (a k) (Ioo 0 1) + meet : ∀ k k', k ≠ k' → ∀ u ∈ Ioo (0 : ℝ) 1, ∀ v ∈ Icc (0 : ℝ) 1, a k u ≠ a k' v + self : ∀ k, ∀ u ∈ Ioo (0 : ℝ) 1, a k u ≠ a k 0 ∧ a k u ≠ a k 1 + +/-- The lifts of the paths, with one lift for a path that is not inner. -/ +abbrev NetArc {κ : Type*} (inner : κ → Prop) := {x : κ × Bool // x.2 = true ∨ inner x.1} + +/-- The lift with index `x`. -/ +def netL {κ Y : Type*} {inner : κ → Prop} (ξ η : κ → ℝ → Y) (x : NetArc inner) (u : ℝ) : Y + := if x.1.2 then ξ x.1.1 u else η x.1.1 u + +section cut + +variable {S Y κ : Type*} [TopologicalSpace S] [TopologicalSpace Y] {a : κ → ℝ → S} {inner : κ + → Prop} {ψ : Y → S} {ξ η : κ → ℝ → Y} + +theorem IsNetCut.ψ_netL (h : IsNetCut a inner ψ ξ η) (x : NetArc inner) {u : ℝ} (hu : u ∈ Icc + (0 : ℝ) 1) : ψ (netL ξ η x u) = a x.1.1 u := by + obtain ⟨⟨k, _ | _⟩, hx⟩ := x + · exact h.hη k u hu + · exact h.hξ k u hu + +theorem IsNetCut.isArcFamily (h : IsNetCut a inner ψ ξ η) : IsArcFamily (netL ξ η (inner := inner)) + := by + have h0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have h1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ + · rintro ⟨⟨k, _ | _⟩, hx⟩ + · exact h.cη k + · exact h.cξ k + · intro x u hu v hv he + refine h.inj x.1.1 hu hv ?_ + rw [← h.ψ_netL x ⟨hu.1.le, hu.2.le⟩, ← h.ψ_netL x ⟨hv.1.le, hv.2.le⟩, he] + · rintro ⟨⟨k, _ | _⟩, hx⟩ u hu + · exact h.bdη k u hu + · exact h.bdξ k u hu + · intro x y hne u hu v hv he + have h2 : a x.1.1 u = a y.1.1 v := by + rw [← h.ψ_netL x ⟨hu.1.le, hu.2.le⟩, ← h.ψ_netL y ⟨hv.1.le, hv.2.le⟩, he] + obtain ⟨⟨k, b⟩, hx⟩ := x + obtain ⟨⟨k', b'⟩, hy⟩ := y + simp only at h2 + obtain rfl : k = k' := by + by_contra hk + exact h.meet k k' hk u hu v ⟨hv.1.le, hv.2.le⟩ h2 + obtain rfl := h.inj k hu hv h2 + cases b <;> cases b' + · exact hne rfl + · exact h.ne k (hx.resolve_left (by simp)) u hu he.symm + · exact h.ne k (hy.resolve_left (by simp)) u hu he + · exact hne rfl + · intro x y u hu + have key : ∀ v ∈ ({0, 1} : Set ℝ), netL ξ η x u ≠ netL ξ η y v := by + intro v hv he + have hv' : v ∈ Icc (0 : ℝ) 1 := by + rcases hv with rfl | rfl + · exact h0 + · exact h1 + have h2 : a x.1.1 u = a y.1.1 v := by + rw [← h.ψ_netL x ⟨hu.1.le, hu.2.le⟩, ← h.ψ_netL y hv', he] + by_cases hk : x.1.1 = y.1.1 + · rw [← hk] at h2 + rcases hv with rfl | rfl + · exact (h.self _ u hu).1 h2 + · exact (h.self _ u hu).2 h2 + · exact h.meet _ _ hk u hu v hv' h2 + exact ⟨key 0 (by simp), key 1 (by simp)⟩ + · intro y hy + obtain ⟨k, u, hu, rfl | rfl⟩ := h.cover y hy + · exact ⟨⟨(k, true), .inl rfl⟩, u, hu, rfl⟩ + · by_cases hi : inner k + · exact ⟨⟨(k, false), .inr hi⟩, u, hu, rfl⟩ + · exact ⟨⟨(k, true), .inl rfl⟩, u, hu, h.eqb k hi u hu⟩ + +/-- Over a point inside a path there are only the two lifts. -/ +theorem IsNetCut.over_interior (h : IsNetCut a inner ψ ξ η) {k : κ} {u : ℝ} (hu : u ∈ Ioo + (0 : ℝ) 1) {y : Y} (hy : ψ y = a k u) : + y = ξ k u ∨ y = η k u := by + have hu' : u ∈ Icc (0 : ℝ) 1 := ⟨hu.1.le, hu.2.le⟩ + have hsame : ∀ k' (u' : ℝ), u' ∈ Icc (0 : ℝ) 1 → a k' u' = a k u → k' = k ∧ u' = u := by + intro k' u' h1 h2 + obtain rfl : k' = k := by + by_contra hne + exact h.meet k k' (Ne.symm hne) u hu u' h1 h2.symm + refine ⟨rfl, ?_⟩ + rcases eq_or_lt_of_le h1.1 with rfl | h3 + · exact absurd h2.symm (h.self k' u hu).1 + rcases eq_or_lt_of_le h1.2 with rfl | h4 + · exact absurd h2.symm (h.self k' u hu).2 + exact h.inj k' ⟨h3, h4⟩ hu h2 + have key : ∀ p q, Relation.EqvGen (fun p q ↦ ∃ k, ∃ u ∈ Icc (0 : ℝ) 1, p = ξ k u ∧ q = η k u) p q + → + ((p = ξ k u ∨ p = η k u) ↔ (q = ξ k u ∨ q = η k u)) := by + intro p q hr + induction hr with + | rel p q hs => + obtain ⟨k', u', h1, rfl, rfl⟩ := hs + constructor + · intro hp + have h2 : a k' u' = a k u := by + rw [← h.hξ k' u' h1] + rcases hp with hp | hp + · rw [hp, h.hξ k u hu'] + · rw [hp, h.hη k u hu'] + obtain ⟨rfl, rfl⟩ := hsame k' u' h1 h2 + exact .inr rfl + · intro hp + have h2 : a k' u' = a k u := by + rw [← h.hη k' u' h1] + rcases hp with hp | hp + · rw [hp, h.hξ k u hu'] + · rw [hp, h.hη k u hu'] + obtain ⟨rfl, rfl⟩ := hsame k' u' h1 h2 + exact .inl rfl + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + exact (key _ _ (h.fib (ξ k u) y (by rw [h.hξ k u hu', hy]))).mp (.inl rfl) + +end cut + +theorem exists_comp_reps {Y : Type u} [TopologicalSpace Y] (hY : IsSurface Y) (y₀ : Y) : ∃ (r : ℕ) + (rep : ℕ → Y), 0 < r ∧ + (∀ i j, i < r → j < r → i ≠ j → Disjoint (connectedComponent (rep i)) (connectedComponent + (rep j))) ∧ + ∀ y, ∃ j < r, y ∈ connectedComponent (rep j) := by + classical + have : LocallyConnectedSpace Y := hY.locallyConnected + have : CompactSpace Y := hY.1 + have hfin : Finite (ConnectedComponents Y) := by + obtain ⟨T, hT⟩ := isCompact_univ.elim_finite_subcover (fun x : Y ↦ connectedComponent x) + (fun x ↦ isOpen_connectedComponent) (fun x _ ↦ mem_iUnion.mpr ⟨x, mem_connectedComponent⟩) + refine Finite.of_surjective (fun t : T ↦ (ConnectedComponents.mk t.1 : ConnectedComponents Y)) + fun c ↦ ?_ + obtain ⟨z, rfl⟩ := ConnectedComponents.surjective_coe c + obtain ⟨t, ht, hzt⟩ := mem_iUnion₂.mp (hT (mem_univ z)) + exact ⟨⟨t, ht⟩, ConnectedComponents.coe_eq_coe'.2 hzt |>.symm⟩ + obtain ⟨r, ⟨e⟩⟩ := Finite.exists_equiv_fin (ConnectedComponents Y) + have hsurj := ConnectedComponents.surjective_coe (α := Y) + set rep : ℕ → Y := fun j => if h : j < r then Function.surjInv hsurj + (e.symm ⟨j, h⟩) else y₀ with hrep + have hmk : ∀ j (h : j < r), ConnectedComponents.mk (rep j) = e.symm ⟨j, h⟩ := fun j h => by + simp only [hrep, dite_eq_left h] + exact Function.surjInv_eq hsurj _ + refine ⟨r, rep, (e (ConnectedComponents.mk y₀)).2.pos, fun i j hi hj hij => ?_, fun y => ?_⟩ + · refine connectedComponent_disjoint fun he => hij ?_ + have h1 := ConnectedComponents.coe_eq_coe.mpr he + rw [hmk i hi, hmk j hj] at h1 + simpa using e.symm.injective h1 + · have hj := (e (ConnectedComponents.mk y)).2 + refine ⟨_, hj, ?_⟩ + have h1 := hmk _ hj + rw [Equiv.symm_apply_apply] at h1 + rw [ConnectedComponents.coe_eq_coe.mp h1] + exact mem_connectedComponent + +theorem relab_sW (r : ℕ → ℕ) (w : List Letter) : relab r (sW w) = sW (w.map fun l => (r l.1, l.2)) + := by + funext i + by_cases hi : i = 0 + · subst hi + simp [relab, sW_zero] + · simp [relab, sW, hi, nW] + +theorem cnt_map_inj {r : ℕ → ℕ} (hr : Function.Injective r) (w : List Letter) (k : ℕ) : cnt + (w.map fun l => (r l.1, l.2)) (r k) = cnt w k := by + induction w with + | nil => rfl + | cons x w ih => + rw [List.map_cons, cnt_cons, cnt_cons, ih] + simp only [hr.eq_iff] + +section comp + +variable {Y : Type u} [TopologicalSpace Y] [T2Space Y] {ι : Type*} [Finite ι] {ℓ : ι → ℝ → Y} + +/-- The polygon of a component of a surface. Its labels are coded with the number `M`, so that +polygons of different components have no +label in common. -/ +theorem exists_comp_word (hY : IsSurface Y) (hfam : IsArcFamily ℓ) {C : Set Y} (hC : IsClopen C) + (hconn : IsConnected C) (M : ℕ) : + ∃ (w : List Letter) (g : ℕ × ℂ → Y), 2 ≤ w.length ∧ Good w ∧ (∀ l ∈ w, (Nat.unpair l.1).1 = M) + ∧ ContinuousOn g (Dsk (sW w)) ∧ + g '' Dsk (sW w) = C ∧ (∀ a ∈ Dsk (sW w), ∀ b ∈ Dsk (sW w), g a = g b ↔ PRel (sW w) a b) ∧ + ∀ α, ℓ α 0 ∈ C → ∃ k σ, cnt w k = 1 ∧ SideVal (sW w) g k (fun u => ℓ α (ofs σ u)) := by + classical + have hsub : ∀ α : {α // ℓ α 0 ∈ C}, ∀ u ∈ Icc (0 : ℝ) 1, ℓ α.1 u ∈ C := fun α u hu => by + have h1 : IsPreconnected (ℓ α.1 '' Icc 0 1) := isPreconnected_Icc.image _ (hfam.cont α.1) + exact h1.subset_isClopen hC ⟨_, ⟨0, by simp, rfl⟩, α.2⟩ ⟨u, hu, rfl⟩ + set ℓ' : {α // ℓ α 0 ∈ C} → ℝ → C := fun α u => if h : ℓ α.1 u ∈ C then ⟨_, h⟩ else ⟨_, α.2⟩ with + hℓ' + have hval : ∀ α, ∀ u ∈ Icc (0 : ℝ) 1, (ℓ' α u).1 = ℓ α.1 u := fun α u hu => by + simp only [hℓ', dite_eq_left (hsub α u hu)] + have h0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have h1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hIoo : ∀ {u : ℝ}, u ∈ Ioo (0 : ℝ) 1 → u ∈ Icc (0 : ℝ) 1 := fun hu => ⟨hu.1.le, hu.2.le⟩ + have hfam' : IsArcFamily ℓ' := by + refine ⟨fun α => ?_, fun α u hu v hv he => ?_, fun α u hu => ?_, fun α β hne u hu v hv he + => ?_, fun α β u hu => ⟨fun he => ?_, fun he => ?_⟩, fun x hx => ?_⟩ + · rw [IsEmbedding.subtypeVal.isInducing.continuousOn_iff] + exact (hfam.cont α.1).congr fun u hu => hval α u hu + · refine hfam.inj α.1 hu hv ?_ + rw [← hval α u (hIoo hu), ← hval α v (hIoo hv), he] + · rw [mem_bd_sub hC.isOpen, hval α u hu] + exact hfam.mem _ _ hu + · refine hfam.disj α.1 β.1 (fun h => hne (Subtype.ext h)) u hu v hv ?_ + rw [← hval α u (hIoo hu), ← hval β v (hIoo hv), he] + · refine (hfam.off α.1 β.1 u hu).1 ?_ + rw [← hval α u (hIoo hu), ← hval β 0 h0, he] + · refine (hfam.off α.1 β.1 u hu).2 ?_ + rw [← hval α u (hIoo hu), ← hval β 1 h1, he] + · obtain ⟨α, u, hu, he⟩ := hfam.cover x.1 ((mem_bd_sub hC.isOpen).mp hx) + have hm : ℓ α 0 ∈ C := by + have h2 : IsPreconnected (ℓ α '' Icc 0 1) := isPreconnected_Icc.image _ (hfam.cont α) + exact h2.subset_isClopen hC ⟨x.1, ⟨u, hu, he.symm⟩, x.2⟩ ⟨0, h0, rfl⟩ + exact ⟨⟨α, hm⟩, u, hu, Subtype.ext (by rw [hval ⟨α, hm⟩ u hu, he])⟩ + have : ConnectedSpace C := isConnected_iff_connectedSpace.mp hconn + obtain ⟨w', g', h2, h3, h4, h5⟩ := exists_hole_word (isSurface_sub hY hC) hfam' + have hr : Function.Injective (Nat.pair M) := fun x y h => (Nat.pair_eq_pair.mp h).2 + set w := w'.map fun l => (Nat.pair M l.1, l.2) with hw + have h4' : Presents (sW w) g' := by + rw [hw, ← relab_sW] + exact (presents_relab (fun _ _ _ _ _ _ h => hr h) g').mp h4 + have hget : ∀ {p k : ℕ} {e : Bool}, w'[p]? = some (k, e) → w[p]? = some (Nat.pair M k, e) + := fun {p k e} h => by + rw [hw, List.getElem?_map, h] + rfl + have hlen : w.length = w'.length := by simp [hw] + refine ⟨w, Subtype.val ∘ g', by omega, fun c => ?_, fun l hl => ?_, + continuous_subtype_val.comp_continuousOn h4'.1, ?_, fun a ha b hb => ?_, fun α hα => ?_⟩ + · by_cases hc : ∃ k, Nat.pair M k = c + · obtain ⟨k, rfl⟩ := hc + rw [hw, cnt_map_inj hr] + exact h3 k + · have : cnt w c = 0 := noLab_iff_cnt.mp fun l hl he => by + obtain ⟨l', -, rfl⟩ := List.mem_map.mp hl + exact hc ⟨_, he⟩ + omega + · obtain ⟨l', -, rfl⟩ := List.mem_map.mp hl + simp + · rw [image_comp, h4'.2.1, image_univ, Subtype.range_coe] + · rw [← h4'.2.2 a ha b hb] + exact Subtype.val_injective.eq_iff + · obtain ⟨k, σ, h6, i, p, h7, h8⟩ := h5 ⟨α, hα⟩ + obtain ⟨rfl, h9⟩ := sW_get h7 + rw [sW_zero] at h8 + have hcount : cnt w (Nat.pair M k) = 1 := by + rw [hw, cnt_map_inj hr] + exact h6 + have hget' : (sW w 0)[p]? = some (Nat.pair M k, true) := by + rw [sW_zero] + exact hget h9 + refine ⟨Nat.pair M k, σ, hcount, 0, p, hget', fun u hu => ?_⟩ + rw [sW_zero, hlen, Function.comp, h8 u hu] + exact hval _ _ (ofs_mem hu) + +end comp + +theorem cnt_netW {R : ℕ → ℕ × Bool} {c : ℕ} {P : Finset ℕ} (hP : ∀ k, (R k).1 = c ↔ k ∈ P) (W : ℕ + → List Letter) (i : ℕ) : + cnt (netW R W i) c = ∑ k ∈ P, cnt (W i) k := by + classical + simp only [netW] + induction W i with + | nil => simp [cnt] + | cons x l ih => + rw [List.map_cons, cnt_cons, ih] + simp only [cnt_cons, Finset.sum_add_distrib, Finset.sum_ite_eq] + by_cases hx : x.1 ∈ P + · rw [ite_eq_left ((hP _).mpr hx), ite_eq_left hx] + · rw [ite_eq_right (fun h => hx ((hP _).mp h)), ite_eq_right hx] + +theorem netFl_true (s : Bool) : netFl s true = s := by + cases s <;> rfl + +private theorem matching_word_side_labels + {S : Type u} + {Y : Type u} + {κ : Type*} + [TopologicalSpace S] + [TopologicalSpace Y] + {a : κ → ℝ → S} + {inner : κ → Prop} + {ψ : Y → S} + {ξ : κ → ℝ → Y} + {η : κ → ℝ → Y} + (h : IsNetCut a inner ψ ξ η) + (W : ℕ → List Letter) + (G : ℕ × ℂ → Y) + (s : NetArc inner → ℕ) + (lb : NetArc inner → ℕ) + (σ : NetArc inner → Bool) + (pos : NetArc inner → ℕ) + (hloc : ∀ (i p k : ℕ) (e : Bool), (W i)[p]? = some (k, e) → ∀ (α : NetArc inner), k = lb α → i + = s α ∧ p = pos α ∧ e = true) + (idx : κ → ℕ) + (idxinj : ∀ (k k' : κ), idx k = idx k' → k = k') + (K : NetArc inner → ℕ) + (hK : K = fun α => 2 * idx α.1.1) + (R : ℕ → ℕ × Bool) + (hRlb : ∀ (α : NetArc inner), R (lb α) = (K α, σ α)) + (hRo : ∀ (k : ℕ), (∀ (α : NetArc inner), lb α ≠ k) → R k = (2 * k + 1, true)) + (hGval : ∀ (α : NetArc inner), ∀ u ∈ Icc 0 1, G (s α, sdPt (W (s α)).length (pos α) (σ α) u) = + netL ξ η α u) + (hcase : ∀ (k : ℕ), (∃ α, lb α = k) ∨ ∀ (α : NetArc inner), lb α ≠ k) : + ∀ (i j p q k k' : ℕ) (e e' : Bool) (t : ℝ), (W i)[p]? = some (k, e) → (W j)[q]? = some (k', + e') → k ≠ k' → (R k).1 = (R k').1 → t ∈ Icc 0 1 → ψ (G (i, sdPt (W i).length p (netFl (R + k).2 e) t)) = ψ (G (j, sdPt (W j).length q (netFl (R k').2 e') t)) := by + intro i j p q k k' e e' t h1 h2 h3 h4 ht + rcases hcase k with ⟨α, rfl⟩ | h5 <;> rcases hcase k' with ⟨β, rfl⟩ | h6 + · obtain ⟨rfl, rfl, rfl⟩ := hloc _ _ _ _ h1 α rfl + obtain ⟨rfl, rfl, rfl⟩ := hloc _ _ _ _ h2 β rfl + rw [hRlb, hRlb] at h4 ⊢ + simp only [netFl_true] + rw [hGval α t ht, hGval β t ht, h.ψ_netL α ht, h.ψ_netL β ht] + have h7 : α.1.1 = β.1.1 := idxinj _ _ (by simpa [hK] using h4) + rw [h7] + · rw [hRlb, hRo _ h6] at h4 + simp only [hK] at h4 + omega + · rw [hRlb, hRo _ h5] at h4 + simp only [hK] at h4 + omega + · rw [hRo _ h5, hRo _ h6] at h4 + simp only at h4 + omega + +private theorem cut_lift_fiber_equivalence + {S : Type u} + {Y : Type u} + {κ : Type*} + [TopologicalSpace S] + [TopologicalSpace Y] + {a : κ → ℝ → S} + {inner : κ → Prop} + {ψ : Y → S} + {ξ : κ → ℝ → Y} + {η : κ → ℝ → Y} + (h : IsNetCut a inner ψ ξ η) + (W : ℕ → List Letter) + (G : ℕ × ℂ → Y) + (s : NetArc inner → ℕ) + (lb : NetArc inner → ℕ) + (σ : NetArc inner → Bool) + (pos : NetArc inner → ℕ) + (hWs : ∀ (α : NetArc inner), (W (s α))[pos α]? = some (lb α, true)) + (lbinj : ∀ (α β : NetArc inner), lb α = lb β → α = β) + (idx : κ → ℕ) + (R : ℕ → ℕ × Bool) + (hnet : ∀ (α : NetArc inner), (netW R W (s α))[pos α]? = some (2 * idx α.1.1, σ α)) + (hGval : ∀ (α : NetArc inner), ∀ u ∈ Icc 0 1, G (s α, sdPt (W (s α)).length (pos α) (σ α) u) = + netL ξ η α u) : + ∀ (y y' : Y), ψ y = ψ y' → Relation.EqvGen (fun u v => u = v ∨ ∃ a b, G a = u ∧ G b = v ∧ Stp + (netW R W) a b) y y' := by + intro y y' he + suffices hmono : ∀ p q, (∃ k, ∃ u ∈ Icc (0 : ℝ) 1, p = ξ k u ∧ q = η k u) → (p = q ∨ ∃ a b, G a + = p ∧ G b = q ∧ Stp (netW R W) a b) by + have hr := h.fib y y' he + clear he + induction hr with + | rel p q hs => exact .rel _ _ (hmono p q hs) + | refl _ => exact .refl _ + | symm _ _ _ ih => exact .symm _ _ ih + | trans _ _ _ _ _ h1 h2 => exact .trans _ _ _ h1 h2 + rintro _ _ ⟨k, u, hu, rfl, rfl⟩ + by_cases hi : inner k + · refine .inr ⟨(s ⟨(k, true), .inl rfl⟩, _), (s ⟨(k, false), .inr hi⟩, _), hGval ⟨(k, true), + .inl rfl⟩ u hu, hGval ⟨(k, false), .inr hi⟩ u hu, + s ⟨(k, true), .inl rfl⟩, s ⟨(k, false), .inr hi⟩, pos ⟨(k, true), .inl rfl⟩, pos ⟨(k, + false), .inr hi⟩, 2 * idx k, _, _, u, hnet ⟨(k, true), .inl rfl⟩, + hnet ⟨(k, false), .inr hi⟩, ?_, hu, + by rw [netW_length], by rw [netW_length]⟩ + intro he' + obtain ⟨h1, h2⟩ := Prod.mk.inj he' + have h3 := hWs ⟨(k, true), .inl rfl⟩ + have h4 := hWs ⟨(k, false), .inr hi⟩ + rw [← h1, ← h2] at h4 + have h5 := h3.symm.trans h4 + simp only [Option.some.injEq, Prod.mk.injEq, and_true] at h5 + have := lbinj _ _ h5 + simp at this + · exact .inl (h.eqb k hi u hu).symm + +private theorem relabeled_word_count_bound + {κ : Type*} + {inner : κ → Prop} + (r : ℕ) + (lb : NetArc inner → ℕ) + (idx : κ → ℕ) + (idxinj : ∀ (k k' : κ), idx k = idx k' → k = k') + (K : NetArc inner → ℕ) + (hK : K = fun α => 2 * idx α.1.1) + (R : ℕ → ℕ × Bool) + (W₁ : ℕ → List Letter) + (L : ℕ → ℕ) + (hL2 : ∀ (k : ℕ), L k ≤ 2) + (hL1 : ∀ (α : NetArc inner), L (lb α) = 1) + (hT : ∀ (P : Finset ℕ) (c : ℕ), (∀ (k : ℕ), (R k).1 = c ↔ k ∈ P) → ∑ i ∈ Finset.range r, cnt + (W₁ i) c = ∑ k ∈ P, L k) + (hRiff : ∀ (k c : ℕ), (R k).1 = c ↔ (∃ α, lb α = k ∧ K α = c) ∨ (∀ (α : NetArc inner), lb α ≠ + k) ∧ 2 * k + 1 = c) + (hTi : ∀ (k : κ), inner k → ∑ i ∈ Finset.range r, cnt (W₁ i) (2 * idx k) = 2) : + ∀ (c : ℕ), ∑ i ∈ Finset.range r, cnt (W₁ i) c ≤ 2 := by + intro c + by_cases h1 : ∃ α, K α = c + · obtain ⟨⟨⟨k, b⟩, hb⟩, rfl⟩ := h1 + by_cases hi : inner k + · simpa only [hK] using (hTi k hi).le + · have hP' : ∀ x, (R x).1 = 2 * idx k ↔ x ∈ ({lb ⟨(k, true), .inl rfl⟩} : Finset ℕ) := by + intro x + rw [hRiff] + simp only [Finset.mem_singleton] + constructor + · rintro (⟨⟨⟨k', b'⟩, h2⟩, rfl, h3⟩ | ⟨-, h3⟩) + · obtain rfl : k' = k := idxinj _ _ (by simpa [hK] using h3) + cases b' + · exact absurd (h2.resolve_left (by simp)) hi + · rfl + · omega + · rintro rfl + exact .inl ⟨_, rfl, by simp only [hK]⟩ + rw [hK] + simp only + rw [hT _ _ hP', Finset.sum_singleton, hL1] + omega + · push Not at h1 + by_cases h2 : ∃ x, 2 * x + 1 = c ∧ ∀ α, lb α ≠ x + · obtain ⟨x, rfl, h3⟩ := h2 + have hP' : ∀ y, (R y).1 = 2 * x + 1 ↔ y ∈ ({x} : Finset ℕ) := by + intro y + rw [hRiff] + simp only [Finset.mem_singleton] + constructor + · rintro (⟨α, -, h4⟩ | ⟨-, h4⟩) + · exact absurd h4 (h1 α) + · omega + · rintro rfl + exact .inr ⟨h3, rfl⟩ + rw [hT _ _ hP', Finset.sum_singleton] + exact hL2 x + · push Not at h2 + have hP' : ∀ y, (R y).1 = c ↔ y ∈ (∅ : Finset ℕ) := by + intro y + rw [hRiff] + simp only [Finset.notMem_empty, iff_false] + rintro (⟨α, -, h4⟩ | ⟨h4, h5⟩) + · exact h1 α h4 + · obtain ⟨α, h6⟩ := h2 y h5 + exact h4 α h6 + rw [hT _ _ hP', Finset.sum_empty] + omega + +private theorem relabeled_word_boundary_arcs + {S : Type u} + {Y : Type u} + {κ : Type*} + [TopologicalSpace S] + [TopologicalSpace Y] + {a : κ → ℝ → S} + {inner : κ → Prop} + {ψ : Y → S} + {ξ : κ → ℝ → Y} + {η : κ → ℝ → Y} + (h : IsNetCut a inner ψ ξ η) + {B : Set S} + (hB : ∀ x ∈ B, ∃ k, inner k ∧ ∃ u ∈ Ioo 0 1, x = a k u) + (W : ℕ → List Letter) + (G : ℕ × ℂ → Y) + (hP : Presents W G) + (s : NetArc inner → ℕ) + (lb : NetArc inner → ℕ) + (σ : NetArc inner → Bool) + (pos : NetArc inner → ℕ) + (hloc : ∀ (i p k : ℕ) (e : Bool), (W i)[p]? = some (k, e) → ∀ (α : NetArc inner), k = lb α → i + = s α ∧ p = pos α ∧ e = true) + (hWs : ∀ (α : NetArc inner), (W (s α))[pos α]? = some (lb α, true)) + (idx : κ → ℕ) + (K : NetArc inner → ℕ) + (hK : K = fun α => 2 * idx α.1.1) + (R : ℕ → ℕ × Bool) + (W₁ : ℕ → List Letter) + (hW₁ : W₁ = netW R W) + (hnet : ∀ (α : NetArc inner), (W₁ (s α))[pos α]? = some (K α, σ α)) + (hGval : ∀ (α : NetArc inner), ∀ u ∈ Icc 0 1, G (s α, sdPt (W (s α)).length (pos α) (σ α) u) = + netL ξ η α u) + (hpair : IsPaired W) + : OnBad ((fun k => 2 * idx k) '' {k | inner k}) B W₁ (ψ ∘ G) := by + intro b hb hbB + rw [hW₁, dsk_netW] at hb + obtain ⟨k, hi, u, hu, he⟩ := hB _ hbB + obtain ⟨α, h1, h2⟩ : ∃ α : NetArc inner, α.1.1 = k ∧ G b = netL ξ η α u := by + rcases h.over_interior hu (y := G b) he with h3 | h3 + · exact ⟨⟨(k, true), .inl rfl⟩, rfl, h3⟩ + · exact ⟨⟨(k, false), .inr hi⟩, rfl, h3⟩ + have hu' : u ∈ Icc (0 : ℝ) 1 := ⟨hu.1.le, hu.2.le⟩ + set v := ofs (σ α) u with hv + have hvI : v ∈ Ioo (0 : ℝ) 1 := ofs_mem_Ioo _ hu + have hspt : spt W (s α) (pos α) v = (s α, sdPt (W (s α)).length (pos α) (σ α) u) := by + rw [spt, hv] + cases σ α <;> simp [sdPt, ofs] + have hmem : spt W (s α) (pos α) v ∈ Dsk W := spt_mem (List.getElem?_eq_some_iff.mp (hWs α)).1 v + have h3 : PRel W (spt W (s α) (pos α) v) b := (hP.2.2 _ hmem _ hb).mp + (by rw [hspt, hGval α u hu', h2]) + have h4 : b = spt W (s α) (pos α) v := by + rcases PRel.eq_or_stp hpair (hWs α) hvI h3 with h5 | h5 + · exact h5 + · obtain ⟨j, q, e', h6, h7, -⟩ := stp_of_side hpair (hWs α) hvI h5 + obtain ⟨rfl, rfl, -⟩ := hloc _ _ _ _ h6 α rfl + exact absurd rfl h7 + refine ⟨s α, pos α, K α, σ α, v, hnet α, ⟨k, hi, by simp only [hK, h1]⟩, hvI, ?_⟩ + rw [h4] + simp [spt, hW₁, netW_length] + +private theorem occurring_label_determines_word + (r : ℕ) + (w : ℕ → List Letter) + (W : ℕ → List Letter) + (hWi : ∀ {i : ℕ}, i < r → W i = w i) + (hWn : ∀ {i : ℕ}, W i ≠ [] → i < r) + (hl : ∀ (i j : ℕ), i ≠ j → ∀ l ∈ w i, ∀ l' ∈ w j, l.1 ≠ l'.1) : + ∀ (k i j : ℕ), cnt (W i) k ≠ 0 → cnt (W j) k ≠ 0 → i = j := by + intro k i j h1 h2 + obtain ⟨l, h3, h4⟩ := List.countP_pos_iff.mp (Nat.pos_of_ne_zero h1) + obtain ⟨l', h5, h6⟩ := List.countP_pos_iff.mp (Nat.pos_of_ne_zero h2) + have hi : i < r := hWn fun he => by simp [he] at h3 + have hj : j < r := hWn fun he => by simp [he] at h5 + rw [hWi hi] at h3 + rw [hWi hj] at h5 + by_contra hne' + exact hl i j hne' l h3 l' h5 (by simp only [beq_iff_eq] at h4 h6; rw [h4, h6]) + +/-- **The polygons of a cut.** Let `Y` be a surface that cuts the connected space `S` along finitely +many paths, and let each point of `B` +lie inside an inner path. Then `S` has one polygon with no point of `B` on its boundary. This is the +end of the three steps of the +sketch on page 216: each component of `Y` is a polygon, the polygons are cut into sectors and pasted +along the paths. -/ +theorem exists_off_word_of_cut {S Y : Type u} {κ : Type*} [TopologicalSpace S] [T2Space S] + [ConnectedSpace S] [TopologicalSpace Y] [T2Space Y] [Finite κ] + {a : κ → ℝ → S} {inner : κ → Prop} {ψ : Y → S} {ξ η : κ → ℝ → Y} (h : IsNetCut a inner ψ ξ η) + (hY : IsSurface Y) {B : Set S} + (hB : ∀ x ∈ B, ∃ k, inner k ∧ ∃ u ∈ Ioo (0 : ℝ) 1, x = a k u) : + ∃ (w : List Letter) (g : ℕ × ℂ → S), 2 ≤ w.length ∧ Good w ∧ Presents (sW w) g ∧ ∀ z ∈ sphere + (0 : ℂ) 1, g (0, z) ∉ B := by + classical + have hfam := h.isArcFamily + set ℓ := netL ξ η (inner := inner) with hℓ + obtain ⟨y₀, -⟩ := h.surj (Classical.arbitrary S) + have : LocallyConnectedSpace Y := hY.locallyConnected + obtain ⟨r, rep, hr, hdisj, hcov⟩ := exists_comp_reps hY y₀ + have hcomp := fun j => exists_comp_word hY hfam (isClopen_connectedComponent (x + := rep j)) isConnected_connectedComponent j + choose w g c1 c2 c3 c4 c5 c6 c7 using hcomp + set W : ℕ → List Letter := fun i => if i < r then w i else [] with hW + set G : ℕ × ℂ → Y := fun a => g a.1 (0, a.2) with hG + have hWi : ∀ {i}, i < r → W i = w i := fun h => ite_eq_left h + have hWn : ∀ {i}, W i ≠ [] → i < r := fun {i} h => by + by_contra hi + exact h (ite_eq_right hi) + have hne : ∀ j, w j ≠ [] := fun j he => by + have := c1 j + simp [he] at this + have hl : ∀ i j, i ≠ j → ∀ l ∈ w i, ∀ l' ∈ w j, l.1 ≠ l'.1 := fun i j hij l hl' l' hl'' he => + hij (by rw [← c3 i l hl', ← c3 j l' hl'', he]) + have hP : Presents W G := presents_family (Z := fun j => connectedComponent (rep j)) hdisj hcov + (fun j _ => hne j) + (fun i j _ _ hij => hl i j hij) (fun j _ => c4 j) (fun j _ => c5 j) (fun j _ => c6 j) + have hA : ∀ α : NetArc inner, ∃ j, j < r ∧ ∃ k σ, cnt (w j) k = 1 ∧ SideVal (sW (w j)) (g j) k + (fun u => ℓ α (ofs σ u)) := fun α => by + obtain ⟨j, hj, hy⟩ := hcov (ℓ α 0) + exact ⟨j, hj, c7 j α hy⟩ + choose s hs lb σ hcnt hside using hA + have hp : ∀ α, ∃ p, (w (s α))[p]? = some (lb α, true) ∧ ∀ u ∈ Icc (0 : ℝ) 1, g (s α) (0, sdPt (w + (s α)).length p true u) = ℓ α (ofs (σ α) u) := fun α => by + obtain ⟨i, p, h1, h2⟩ := hside α + obtain ⟨rfl, h3⟩ := sW_get h1 + rw [sW_zero] at h2 + exact ⟨p, h3, h2⟩ + choose pos hpos hval using hp + have hloc : ∀ i p k e, (W i)[p]? = some (k, e) → ∀ α, k = lb α → i = s α ∧ p = pos α ∧ e = true + := by + intro i p k e h1 α hk + have hi : i < r := hWn fun he => by simp [he] at h1 + rw [hWi hi] at h1 + obtain rfl : i = s α := by + by_contra hne' + exact hl i _ hne' _ (List.mem_of_getElem? h1) _ (List.mem_of_getElem? (hpos α)) hk + subst hk + obtain rfl := unique_of_cnt (hcnt α) h1 (hpos α) + have := h1.symm.trans (hpos α) + simp only [Option.some.injEq, Prod.mk.injEq, true_and] at this + exact ⟨rfl, rfl, this⟩ + have hhalf : (1 / 2 : ℝ) ∈ Ioo (0 : ℝ) 1 := by norm_num + have hhalf' : (1 / 2 : ℝ) ∈ Icc (0 : ℝ) 1 := by norm_num + have hWs : ∀ α, (W (s α))[pos α]? = some (lb α, true) := fun α => by + rw [hWi (hs α)] + exact hpos α + have lbinj : ∀ α β, lb α = lb β → α = β := by + intro α β he + obtain ⟨h1, h2, -⟩ := hloc _ _ _ _ (hWs β) α he.symm + by_contra hne' + have h3 := hval α _ hhalf' + have h4 := hval β _ hhalf' + rw [h1, h2] at h4 + exact hfam.disj α β hne' _ (ofs_mem_Ioo _ hhalf) _ (ofs_mem_Ioo _ hhalf) (h3.symm.trans h4) + obtain ⟨n, ⟨e⟩⟩ := Finite.exists_equiv_fin κ + set idx : κ → ℕ := fun k => (e k).1 with hidx + have idxinj : ∀ k k', idx k = idx k' → k = k' := fun k k' he => e.injective (Fin.ext he) + set K : NetArc inner → ℕ := fun α => 2 * idx α.1.1 with hK + set R : ℕ → ℕ × Bool := fun k => if h : ∃ α, lb α = k then (K h.choose, σ h.choose) else + (2 * k + 1, true) with hR + have hRlb : ∀ α, R (lb α) = (K α, σ α) := fun α => by + have h1 : ∃ β, lb β = lb α := ⟨α, rfl⟩ + have h2 := lbinj _ _ h1.choose_spec + simp only [hR, dite_eq_left h1, h2] + have hRo : ∀ k, (∀ α, lb α ≠ k) → R k = (2 * k + 1, true) := fun k hk => by + simp only [hR] + rw [dite_eq_right (by push Not; exact hk)] + set W₁ := netW R W with hW₁ + have hnet : ∀ α, (W₁ (s α))[pos α]? = some (K α, σ α) := fun α => by + rw [hW₁, netW_get (hWs α), hRlb, netFl_true] + have hGval : ∀ α, ∀ u ∈ Icc (0 : ℝ) 1, G (s α, sdPt (W (s α)).length (pos α) (σ α) u) = ℓ α u + := fun α u hu => by + have h1 := hval α _ (ofs_mem (e := σ α) hu) + rw [ofs_ofs, ← sdPt_netFl, netFl_true] at h1 + simp only [hG, hWi (hs α)] + exact h1 + have hcase : ∀ k, (∃ α, lb α = k) ∨ ∀ α, lb α ≠ k := fun k => by + by_cases h1 : ∃ α, lb α = k + · exact .inl h1 + · exact .inr (by push Not at h1; exact h1) + have hmatch : ∀ i j p q k k' e e' (t : ℝ), (W i)[p]? = some (k, e) → (W j)[q]? = some (k', e') + → k ≠ k' → (R k).1 = (R k').1 → t ∈ Icc (0 : ℝ) 1 → + ψ (G (i, sdPt (W i).length p (netFl (R k).2 e) t)) = ψ (G (j, sdPt (W j).length q (netFl + (R k').2 e') t)) := by + exact matching_word_side_labels (S := S) (Y := Y) (κ := κ) (a := a) (inner := inner) (ψ := ψ) + (ξ := ξ) (η := η) h W G s lb σ pos hloc idx idxinj K hK R hRlb hRo hGval hcase + have hfib : ∀ y y', ψ y = ψ y' → Relation.EqvGen (fun u v => u = v ∨ ∃ a b, G a = u ∧ G b = v + ∧ Stp (netW R W) a b) y y' := by + exact cut_lift_fiber_equivalence (S := S) (Y := Y) (κ := κ) (a := a) (inner := inner) (ψ := ψ) + (ξ := ξ) (η := η) h W G s lb σ pos hWs lbinj idx R (by simpa only [hW₁, hK] using hnet) hGval + have hP₁ : Presents W₁ (ψ ∘ G) := presents_paste hP h.cont h.surj hmatch hfib + have hS₀ : ∀ i, i ∉ Finset.range r → W i = [] := fun i hi => by + simp only [hW, ite_eq_right_iff] + exact fun h1 => absurd (Finset.mem_range.mpr h1) hi + have hS₁ : ∀ i, i ∉ Finset.range r → W₁ i = [] := fun i hi => by + simp [hW₁, netW, hS₀ i hi] + have hslot : ∀ k i j, cnt (W i) k ≠ 0 → cnt (W j) k ≠ 0 → i = j := by + exact occurring_label_determines_word r w W hWi hWn hl + set L : ℕ → ℕ := fun k => ∑ i ∈ Finset.range r, cnt (W i) k with hL + have hL2 : ∀ k, L k ≤ 2 := fun k => by + by_cases h1 : ∃ i ∈ Finset.range r, cnt (W i) k ≠ 0 + · obtain ⟨i, hi, h2⟩ := h1 + have h3 : L k = cnt (W i) k := Finset.sum_eq_single_of_mem i hi fun j _ hj => by + by_contra h4 + exact hj (hslot k j i h4 h2) + rw [h3, hWi (Finset.mem_range.mp hi)] + exact c2 i k + · push Not at h1 + simp only [hL] + rw [Finset.sum_eq_zero h1] + omega + have hL1 : ∀ α, L (lb α) = 1 := fun α => by + have h1 : cnt (W (s α)) (lb α) = 1 := by rw [hWi (hs α)]; exact hcnt α + have h3 : L (lb α) = cnt (W (s α)) (lb α) := Finset.sum_eq_single_of_mem _ + (Finset.mem_range.mpr (hs α)) fun j _ hj => by + by_contra h4 + exact hj (hslot _ j _ h4 (by omega)) + rw [h3, h1] + have hT : ∀ (P : Finset ℕ) (c : ℕ), (∀ k, (R k).1 = c ↔ k ∈ P) → ∑ i ∈ Finset.range r, cnt + (W₁ i) c = ∑ k ∈ P, L k := fun P c h1 => by + simp only [hW₁, cnt_netW h1, hL] + exact Finset.sum_comm + have hRiff : ∀ k c, (R k).1 = c ↔ (∃ α, lb α = k ∧ K α = c) ∨ ((∀ α, lb α ≠ k) ∧ 2 * k + 1 = c) + := fun k c => by + rcases hcase k with ⟨α, rfl⟩ | h1 + · rw [hRlb] + constructor + · rintro rfl + exact .inl ⟨α, rfl, rfl⟩ + · rintro (⟨β, h2, rfl⟩ | ⟨h2, -⟩) + · rw [lbinj _ _ h2] + · exact absurd rfl (h2 α) + · rw [hRo k h1] + constructor + · rintro rfl + exact .inr ⟨h1, rfl⟩ + · rintro (⟨β, h2, -⟩ | ⟨-, rfl⟩) + · exact absurd h2 (h1 β) + · rfl + have hinnerP : ∀ k (hi : inner k), ∀ x, (R x).1 = 2 * idx k ↔ x ∈ + ({lb ⟨(k, true), .inl rfl⟩, lb ⟨(k, false), .inr hi⟩} : Finset ℕ) := by + intro k hi x + rw [hRiff] + simp only [Finset.mem_insert, Finset.mem_singleton] + constructor + · rintro (⟨⟨⟨k', b⟩, h1⟩, rfl, h2⟩ | ⟨-, h2⟩) + · obtain rfl : k' = k := idxinj _ _ (by simpa [hK] using h2) + cases b + · exact .inr rfl + · exact .inl rfl + · omega + · rintro (rfl | rfl) + · exact .inl ⟨_, rfl, rfl⟩ + · exact .inl ⟨_, rfl, rfl⟩ + have hTi : ∀ k, inner k → ∑ i ∈ Finset.range r, cnt (W₁ i) (2 * idx k) = 2 := fun k hi => by + have hne' : lb ⟨(k, true), .inl rfl⟩ ≠ lb ⟨(k, false), .inr hi⟩ := fun he => by + have := lbinj _ _ he + simp at this + rw [hT _ _ (hinnerP k hi), Finset.sum_pair hne', hL1, hL1] + have hsum : ∀ c, ∑ i ∈ Finset.range r, cnt (W₁ i) c ≤ 2 := by + exact relabeled_word_count_bound (κ := κ) (inner := inner) r lb idx idxinj K hK R W₁ L hL2 + hL1 hT hRiff hTi + have hsumW : ∀ c, ∑ i ∈ Finset.range r, cnt (W i) c ≤ 2 := hL2 + have hpair : IsPaired W := isPaired_of_sum hS₀ hsumW + set Bad : Set ℕ := (fun k => 2 * idx k) '' {k | inner k} with hBad + have hBadfin : Bad.Finite := (Set.toFinite _).image _ + have hon : OnBad Bad B W₁ (ψ ∘ G) := by + exact relabeled_word_boundary_arcs (S := S) (Y := Y) (κ := κ) (a := a) (inner := inner) (ψ := + ψ) (ξ := ξ) (η := η) h (B := B) hB W G hP s lb σ pos hloc hWs idx K hK R W₁ hW₁ hnet hGval + hpair + refine exists_off_word hBadfin (Finset.range r) ?_ ?_ hP₁ hon ?_ hS₁ hsum ?_ + · refine (Finset.finite_toSet (Finset.range r)).subset fun i hi => ?_ + by_contra h1 + exact hi (hS₁ i h1) + · intro he + have h1 := netW_length R W 0 + rw [← hW₁, he, hWi hr] at h1 + have := c1 0 + simp only [List.length_nil] at h1 + omega + · intro i hi + have h1 : i < r := by + by_contra h2 + exact hi (hS₁ i (by simpa using h2)) + rw [hW₁, netW_length, hWi h1] + exact c1 i + · rintro _ ⟨k, hi, rfl⟩ + simp only + rw [hTi k hi] + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetExistsCycle.lean b/LeanPool/GraphMinor/GM07/NetExistsCycle.lean new file mode 100644 index 0000000000..167ff02ec6 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetExistsCycle.lean @@ -0,0 +1,460 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutConn + +/-! +# Arcs around a circle + +Let finitely many arcs cover a circle, so that a point inside an arc is on no other arc and is not +an end of an arc. Then the +arcs go around the circle one after the other (`exists_cycle`). We lift the arcs to the real line, +turn them to run forward, +move them to one interval of length one, and sort them by their first ends (`exists_sorted`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +/-- Intervals in `[t, T]`, each one starting outside the others, that cover `[t, T)` follow one +another. -/ +theorem exists_sorted {ι : Type*} (a b : ι → ℝ) {t : ℝ} (n : ℕ) : ∀ (F : Finset ι) (T : ℝ), F.card + = n → F.Nonempty → + (∀ α ∈ F, a α < b α ∧ t ≤ a α ∧ b α ≤ T) → (∀ α ∈ F, ∀ β ∈ F, a α = a β → α = β) → + (∀ α ∈ F, ∀ β ∈ F, a β ∉ Ioo (a α) (b α)) → (∀ u ∈ Ico t T, ∃ α ∈ F, u ∈ Icc (a α) (b α)) → + ∃ L : List ι, L.Nodup ∧ (∀ α, α ∈ L ↔ α ∈ F) ∧ L.IsChain (fun α β => b α = a β) ∧ + (∃ α ∈ L.head?, a α = t) ∧ ∃ α ∈ L.getLast?, b α = T := by + classical + induction n with + | zero => + intro F T hc hne + simp [Finset.card_eq_zero.mp hc] at hne + | succ n ih => + intro F T hc hne hF hinj hnest hcov + obtain ⟨α, hα, hmax⟩ := F.exists_max_image a hne + have hb : b α = T := by + by_contra hne' + have hlt : b α < T := lt_of_le_of_ne (hF α hα).2.2 hne' + obtain ⟨β, hβ, h1, h2⟩ := hcov ((b α + T) / 2) ⟨by linarith [(hF α hα).1, + (hF α hα).2.1], by linarith⟩ + have h3 := hmax β hβ + have hne2 : β ≠ α := by + rintro rfl + linarith + have h4 : a β < a α := lt_of_le_of_ne h3 fun h => hne2 (hinj β hβ α hα h) + exact hnest β hβ α hα ⟨h4, by linarith [(hF α hα).1]⟩ + by_cases hemp : F.erase α = ∅ + · have hF1 : F = {α} := by + have := Finset.insert_erase hα + rw [hemp] at this + simpa using this.symm + subst hF1 + obtain ⟨β, hβ, h1, -⟩ := hcov t ⟨le_rfl, by linarith [(hF α hα).1, (hF α hα).2.1]⟩ + obtain rfl := Finset.mem_singleton.mp hβ + refine ⟨[β], by simp, by simp, by simp, ⟨β, by simp, le_antisymm h1 (hF β hα).2.1⟩, β, + by simp, hb⟩ + · have hne' : (F.erase α).Nonempty := Finset.nonempty_iff_ne_empty.mpr hemp + have hlt : ∀ β ∈ F.erase α, a β < a α := fun β hβ => + lt_of_le_of_ne (hmax β (Finset.mem_of_mem_erase hβ)) fun h => (Finset.mem_erase.mp hβ).1 + (hinj β (Finset.mem_of_mem_erase hβ) α hα h) + have hcard : (F.erase α).card = n := by + rw [Finset.card_erase_of_mem hα, hc] + rfl + obtain ⟨L, h1, h2, h3, h4, γ, h5, h6⟩ := ih (F.erase α) (a α) hcard hne' + (fun β hβ => ⟨(hF β (Finset.mem_of_mem_erase hβ)).1, (hF β (Finset.mem_of_mem_erase + hβ)).2.1, by + by_contra hcon + exact hnest β (Finset.mem_of_mem_erase hβ) α hα ⟨hlt β hβ, not_le.mp hcon⟩⟩) + (fun β hβ β' hβ' he => hinj β (Finset.mem_of_mem_erase hβ) β' + (Finset.mem_of_mem_erase hβ') he) + (fun β hβ β' hβ' => hnest β (Finset.mem_of_mem_erase hβ) β' (Finset.mem_of_mem_erase hβ')) + (fun u hu => by + obtain ⟨β, hβ, h1, h2⟩ := hcov u ⟨hu.1, hu.2.trans_le (by linarith [(hF α hα).1])⟩ + refine ⟨β, Finset.mem_erase.mpr ⟨?_, hβ⟩, h1, h2⟩ + rintro rfl + linarith [hu.2]) + have hαL : α ∉ L := fun h => (Finset.mem_erase.mp ((h2 α).mp h)).1 rfl + have hLne : L ≠ [] := by + rintro rfl + simp at h5 + refine ⟨L ++ [α], ?_, fun β => ?_, ?_, ?_, α, by simp, hb⟩ + · exact List.Nodup.append h1 (by simp) (by simpa using hαL) + · simp only [List.mem_append, List.mem_singleton, h2, Finset.mem_erase] + constructor + · rintro (h | rfl) + · exact h.2 + · exact hα + · intro h + by_cases he : β = α + · exact .inr he + · exact .inl ⟨he, h⟩ + · rw [List.isChain_append] + refine ⟨h3, by simp, fun x hx y hy => ?_⟩ + have hy' : α = y := by simpa using hy + rw [← hy', Option.mem_unique hx h5, h6] + · obtain ⟨β, hβ, he⟩ := h4 + exact ⟨β, by rw [List.head?_append_of_ne_nil _ hLne]; exact hβ, he⟩ + +/-- A finite family of arcs that covers the boundary. The arcs are paths with `ℓ α 0` and `ℓ α 1` as +ends, which may agree. A point +inside an arc is on no other arc, and it is not an end of any arc. -/ +structure IsArcFamily {Z ι : Type*} [TopologicalSpace Z] (ℓ : ι → ℝ → Z) : Prop where + cont : ∀ α, ContinuousOn (ℓ α) (Icc 0 1) + inj : ∀ α, InjOn (ℓ α) (Ioo 0 1) + mem : ∀ α, ∀ u ∈ Icc (0 : ℝ) 1, ℓ α u ∈ bd Z + disj : ∀ α β, α ≠ β → ∀ u ∈ Ioo (0 : ℝ) 1, ∀ v ∈ Ioo (0 : ℝ) 1, ℓ α u ≠ ℓ β v + off : ∀ α β, ∀ u ∈ Ioo (0 : ℝ) 1, ℓ α u ≠ ℓ β 0 ∧ ℓ α u ≠ ℓ β 1 + cover : ∀ x ∈ bd Z, ∃ α, ∃ u ∈ Icc (0 : ℝ) 1, x = ℓ α u + +theorem ofs_mem_Ioo (σ : Bool) {u : ℝ} (hu : u ∈ Ioo (0 : ℝ) 1) : ofs σ u ∈ Ioo (0 : ℝ) 1 := by + cases σ + · rw [ofs_false] + exact ⟨by linarith [hu.2], by linarith [hu.1]⟩ + · rwa [ofs_true] + +section + +variable {Z ι : Type*} [TopologicalSpace Z] {ℓ : ι → ℝ → Z} + +theorem IsArcFamily.off_ofs (hf : IsArcFamily ℓ) (α β : ι) {u : ℝ} (hu : u ∈ Ioo (0 : ℝ) 1) + (σ : Bool) : + ℓ α u ≠ ℓ β (ofs σ 0) ∧ ℓ α u ≠ ℓ β (ofs σ 1) := by + have h := hf.off α β u hu + cases σ <;> simp [ofs_false, ofs_true, h.1, h.2] + +theorem IsArcFamily.injOn_Ico (hf : IsArcFamily ℓ) (α : ι) : InjOn (ℓ α) (Ico 0 1) := by + intro x hx y hy he + rcases eq_or_lt_of_le hx.1 with rfl | h1 + · rcases eq_or_lt_of_le hy.1 with rfl | h2 + · rfl + · exact absurd he.symm (hf.off α α y ⟨h2, hy.2⟩).1 + · rcases eq_or_lt_of_le hy.1 with rfl | h2 + · exact absurd he (hf.off α α x ⟨h1, hx.2⟩).1 + · exact hf.inj α ⟨h1, hx.2⟩ ⟨h2, hy.2⟩ he + +variable {C : Set Z} + +/-- An arc on a circle lifts to a forward path on the real line, of length at most one. -/ +theorem exists_dir_lift (hf : IsArcFamily ℓ) (φ : Circle ≃ₜ C) (α : ι) (hC : ∀ u ∈ Icc + (0 : ℝ) 1, ℓ α u ∈ C) : + ∃ (σ : Bool) (n : ℝ → ℝ), ContinuousOn n (Icc 0 1) ∧ StrictMonoOn n (Icc 0 1) ∧ (∀ u ∈ Icc + (0 : ℝ) 1, (φ (ee (n u))).1 = ℓ α (ofs σ u)) ∧ + n 1 ≤ n 0 + 1 := by + obtain ⟨m, h1, h2⟩ := exists_lift φ (hf.cont α) hC + have hinj : InjOn (fun u => ee (m u)) (Ico 0 1) := fun x hx y hy he => hf.injOn_Ico α hx hy (by + rw [← h2 x ⟨hx.1, hx.2.le⟩, ← h2 y ⟨hy.1, hy.2.le⟩] + simp only at he + rw [he]) + have h3 : ∃ (σ : Bool) (n : ℝ → ℝ), ContinuousOn n (Icc 0 1) ∧ StrictMonoOn n (Icc 0 1) + ∧ ∀ u ∈ Icc (0 : ℝ) 1, (φ (ee (n u))).1 = ℓ α (ofs σ u) := by + rcases lift_mono_loop h1 hinj with h | h + · exact ⟨true, m, h1, h, fun u hu => by rw [ofs_true]; exact h2 u hu⟩ + · refine ⟨false, fun u => m (1 - u), h1.comp (by fun_prop) fun u hu => rev_mem hu, + fun x hx y hy hxy => h (rev_mem hy) (rev_mem hx) (by linarith), + fun u hu => by rw [ofs_false]; exact h2 _ (rev_mem hu)⟩ + obtain ⟨σ, n, c, s, v⟩ := h3 + refine ⟨σ, n, c, s, v, ?_⟩ + by_contra hcon + obtain ⟨u, hu, hu'⟩ := intermediate_value_Ioo zero_le_one c (show n 0 + 1 ∈ Ioo (n 0) + (n 1) from ⟨by linarith, not_le.mp hcon⟩) + have h4 : ℓ α (ofs σ u) = ℓ α (ofs σ 0) := by + rw [← v u ⟨hu.1.le, hu.2.le⟩, ← v 0 (by simp), hu', ee_add_one] + exact (hf.off_ofs α α (ofs_mem_Ioo σ hu) σ).1 h4 + +/-- **The arcs go around the circle.** The arcs of `A` lie on the circle `C` and cover it. Then they +can be listed so that each one, run +forward, starts where the one before it ends, and the last one ends where the first one starts, one +turn later. -/ +theorem exists_cuff_order (hf : IsArcFamily ℓ) (φ : Circle ≃ₜ C) (A : Finset ι) + (hsub : ∀ α ∈ A, ∀ u ∈ Icc (0 : ℝ) 1, ℓ α u ∈ C) + (hcov : ∀ x ∈ C, ∃ α ∈ A, ∃ u ∈ Icc (0 : ℝ) 1, x = ℓ α u) : + ∃ (L : List ι) (σ : ι → Bool) (n : ι → ℝ → ℝ), L.Nodup ∧ (∀ α, α ∈ L ↔ α ∈ A) ∧ + (∀ α ∈ A, ContinuousOn (n α) (Icc 0 1) ∧ StrictMonoOn (n α) (Icc 0 1) ∧ ∀ u ∈ Icc (0 : ℝ) 1, + (φ (ee (n α u))).1 = ℓ α (ofs (σ α) u)) ∧ + L.IsChain (fun α β => n α 1 = n β 0) ∧ (∃ α ∈ L.head?, ∃ ω ∈ L.getLast?, n ω 1 = n α 0 + 1) ∧ + (∀ α ∈ A, ∀ β ∈ A, n α 0 = n β 0 → α = β) ∧ (∀ α ∈ A, ∀ β ∈ A, n α 1 = n β 1 → α = β) + ∧ ∃ t, ∀ α ∈ A, t ≤ n α 0 ∧ n α 1 ≤ t + 1 := by + classical + obtain ⟨α₀, hα₀, -⟩ := hcov (φ 1).1 (φ 1).2 + have hch : ∀ α, ∃ (σ : Bool) (n : ℝ → ℝ), α ∈ A → ContinuousOn n (Icc 0 1) ∧ StrictMonoOn n + (Icc 0 1) ∧ + (∀ u ∈ Icc (0 : ℝ) 1, (φ (ee (n u))).1 = ℓ α (ofs σ u)) ∧ n 1 ≤ n 0 + 1 := fun α => by + by_cases h : α ∈ A + · obtain ⟨σ, n, h1⟩ := exists_dir_lift hf φ α (hsub α h) + exact ⟨σ, n, fun _ => h1⟩ + · exact ⟨true, id, fun h' => absurd h' h⟩ + choose σ n₀ hn₀ using hch + set t := n₀ α₀ 0 with ht + set n : ι → ℝ → ℝ := fun α u => n₀ α u + ((-⌊n₀ α 0 - t⌋ : ℤ) : ℝ) with hn + have hc : ∀ α ∈ A, ContinuousOn (n α) (Icc 0 1) := fun α h => (hn₀ α h).1.add continuousOn_const + have hs : ∀ α ∈ A, StrictMonoOn (n α) (Icc 0 1) := fun α h x hx y hy hxy => by + simp only [hn] + linarith [(hn₀ α h).2.1 hx hy hxy] + have hv : ∀ α ∈ A, ∀ u ∈ Icc (0 : ℝ) 1, (φ (ee (n α u))).1 = ℓ α (ofs (σ α) u) := fun α h u hu + => by + simp only [hn] + rw [ee_add_int] + exact (hn₀ α h).2.2.1 u hu + have h0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have h1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hat : n α₀ 0 = t := by simp [hn, ← ht] + have ha : ∀ α, t ≤ n α 0 ∧ n α 0 < t + 1 := fun α => by + have h2 := Int.floor_le (n₀ α 0 - t) + have h3 := Int.lt_floor_add_one (n₀ α 0 - t) + simp only [hn, Int.cast_neg] + constructor <;> linarith + have hlt : ∀ α ∈ A, n α 0 < n α 1 := fun α h => hs α h h0 h1 zero_lt_one + have hiv : ∀ α ∈ A, ∀ w ∈ Ioo (n α 0) (n α 1), ∃ u ∈ Ioo (0 : ℝ) 1, (φ (ee w)).1 = ℓ α u + := fun α h w hw => by + obtain ⟨u, hu, rfl⟩ := intermediate_value_Ioo zero_le_one (hc α h) hw + exact ⟨_, ofs_mem_Ioo (σ α) hu, hv α h u ⟨hu.1.le, hu.2.le⟩⟩ + have hend : ∀ α ∈ A, ∀ β ∈ A, n β 0 ∉ Ioo (n α 0) (n α 1) := fun α h β hβ hw => by + obtain ⟨u, hu, he⟩ := hiv α h _ hw + exact (hf.off_ofs α β hu (σ β)).1 (by rw [← he, hv β hβ 0 h0]) + have hb : ∀ α ∈ A, n α 1 ≤ t + 1 := fun α h => by + by_contra hcon + obtain ⟨u, hu, he⟩ := hiv α h (t + 1) ⟨(ha α).2, not_le.mp hcon⟩ + refine (hf.off_ofs α α₀ hu (σ α₀)).1 ?_ + rw [← he, ee_add_one, ← hv α₀ hα₀ 0 h0, hat] + have hdisj : ∀ α ∈ A, ∀ β ∈ A, n α 0 = n β 0 → α = β := fun α h β hβ he => by + by_contra hne + have h2 := hlt α h + have h3 := hlt β hβ + set w := (n α 0 + min (n α 1) (n β 1)) / 2 with hw + have h4 : n α 0 < min (n α 1) (n β 1) := lt_min h2 (he ▸ h3) + have h5 := min_le_left (n α 1) (n β 1) + have h6 := min_le_right (n α 1) (n β 1) + obtain ⟨u, hu, e1⟩ := hiv α h w ⟨by linarith, by linarith⟩ + obtain ⟨v, hv', e2⟩ := hiv β hβ w ⟨by linarith, by linarith⟩ + exact hf.disj α β hne u hu v hv' (e1.symm.trans e2) + obtain ⟨L, h2, h3, h4, ⟨α, hα, h5⟩, ω, hω, h6⟩ := exists_sorted (fun α => n α 0) (fun α => n α 1) + (t := t) _ A (t + 1) rfl ⟨α₀, hα₀⟩ + (fun α h => ⟨hlt α h, (ha α).1, hb α h⟩) hdisj (fun α h β hβ => hend α h β hβ) (fun u hu => by + obtain ⟨α, h, v, hv', he⟩ := hcov (φ (ee u)).1 (φ (ee u)).2 + have hv1 := ofs_mem (e := σ α) hv' + have h7 : (φ (ee u)).1 = (φ (ee (n α (ofs (σ α) v)))).1 := by rw [hv α h _ hv1, ofs_ofs, he] + obtain ⟨k, hk⟩ := ee_eq_iff.mp (φ.injective (Subtype.ext h7)) + have h8 := (hs α h).monotoneOn h0 hv1 hv1.1 + have h9 := (hs α h).monotoneOn hv1 h1 hv1.2 + have h10 := hb α h + have h11 := (ha α).1 + have hk1 : (k : ℝ) < 1 := by linarith [hu.2] + have hk2 : (-2 : ℝ) < k := by linarith [hu.1] + have hk3 : k < 1 := by exact_mod_cast hk1 + have hk4 : -2 < k := by exact_mod_cast hk2 + obtain rfl | rfl : k = 0 ∨ k = -1 := by omega + · refine ⟨α, h, ?_, ?_⟩ <;> simp only [Int.cast_zero, add_zero] at hk <;> rw [hk] + <;> assumption + · have hu' : u = t := by + simp only [Int.reduceNeg, Int.cast_neg, Int.cast_one] at hk + linarith [hu.1] + exact ⟨α₀, hα₀, by simp only [hat, hu']; exact le_rfl, by rw [hu']; rw [← hat]; exact + (hlt α₀ hα₀).le⟩) + have hdisj' : ∀ α ∈ A, ∀ β ∈ A, n α 1 = n β 1 → α = β := fun α h β hβ he => by + by_contra hne + have h7 := hlt α h + have h8 := hlt β hβ + set w := (max (n α 0) (n β 0) + n α 1) / 2 with hw + have h9 : max (n α 0) (n β 0) < n α 1 := max_lt h7 (he ▸ h8) + have h10 := le_max_left (n α 0) (n β 0) + have h11 := le_max_right (n α 0) (n β 0) + obtain ⟨u, hu, e1⟩ := hiv α h w ⟨by linarith, by linarith⟩ + obtain ⟨v, hv', e2⟩ := hiv β hβ w ⟨by linarith, by linarith⟩ + exact hf.disj α β hne u hu v hv' (e1.symm.trans e2) + exact ⟨L, σ, n, h2, h3, fun α h => ⟨hc α h, hs α h, hv α h⟩, h4, ⟨α, hα, ω, hω, by rw [h6, + h5]⟩, hdisj, hdisj', t, fun α h => ⟨(ha α).1, hb α h⟩⟩ + +end + +theorem chain_next {ι : Type*} {R : ι → ι → Prop} {L : List ι} (h : L.IsChain R) : ∀ α ∈ L, α ∈ + L.getLast? ∨ ∃ β ∈ L, R α β := by + induction L with + | nil => simp + | cons x L ih => + cases L with + | nil => simp + | cons y L => + rw [List.isChain_cons_cons] at h + intro α hα + rcases List.mem_cons.mp hα with rfl | h1 + · exact .inr ⟨y, by simp, h.1⟩ + · rcases ih h.2 α h1 with h2 | ⟨β, h3, h4⟩ + · exact .inl (by rw [List.getLast?_cons_cons]; exact h2) + · exact .inr ⟨β, List.mem_cons_of_mem _ h3, h4⟩ + +theorem chain_prev {ι : Type*} {R : ι → ι → Prop} {L : List ι} (h : L.IsChain R) : ∀ α ∈ L, α ∈ + L.head? ∨ ∃ β ∈ L, R β α := by + induction L with + | nil => simp + | cons x L ih => + cases L with + | nil => simp + | cons y L => + rw [List.isChain_cons_cons] at h + intro α hα + rcases List.mem_cons.mp hα with rfl | h1 + · exact .inl (by simp) + · rcases ih h.2 α h1 with h2 | ⟨β, h3, h4⟩ + · refine .inr ⟨x, by simp, ?_⟩ + have : α = y := by simpa using h2.symm + rw [this] + exact h.1 + · exact .inr ⟨β, List.mem_cons_of_mem _ h3, h4⟩ + +section + +variable {Z : Type u} [TopologicalSpace Z] {ι : Type*} {ℓ : ι → ℝ → Z} + +/-- An arc that meets a cuff lies on it. -/ +theorem arc_sub_cuff (hf : IsArcFamily ℓ) {C : Set Z} (hC : C ∈ cuffs Z) {α : ι} {v : ℝ} + (hv : v ∈ Icc (0 : ℝ) 1) (hv' : ℓ α v ∈ C) : + ∀ u ∈ Icc (0 : ℝ) 1, ℓ α u ∈ C := by + obtain ⟨y, -, rfl⟩ := hC + intro u hu + have h1 : IsPreconnected (ℓ α '' Icc 0 1) := isPreconnected_Icc.image _ (hf.cont α) + have hsub : ℓ α '' Icc 0 1 ⊆ bd Z := by + rintro _ ⟨w, hw, rfl⟩ + exact hf.mem α w hw + have h2 := h1.subset_connectedComponentIn (mem_image_of_mem _ hv) hsub + rw [← connectedComponentIn_eq hv'] at h2 + exact h2 (mem_image_of_mem _ hu) + +/-- The arcs on a cuff. -/ +theorem exists_arcs_on [Finite ι] (hf : IsArcFamily ℓ) {C : Set Z} (hC : C ∈ cuffs Z) : + ∃ A : Finset ι, (∀ α ∈ A, ∀ u ∈ Icc (0 : ℝ) 1, ℓ α u ∈ C) ∧ (∀ α, ∀ u ∈ Icc + (0 : ℝ) 1, ℓ α u ∈ C → α ∈ A) ∧ + ∀ x ∈ C, ∃ α ∈ A, ∃ u ∈ Icc (0 : ℝ) 1, x = ℓ α u := by + classical + refine ⟨(Set.toFinite {α | ∃ u ∈ Icc (0 : ℝ) 1, ℓ α u ∈ C}).toFinset, ?_, ?_, ?_⟩ + · intro α hα + obtain ⟨v, hv, hv'⟩ := (Set.Finite.mem_toFinset _).mp hα + exact arc_sub_cuff hf hC hv hv' + · intro α u hu h + exact (Set.Finite.mem_toFinset _).mpr ⟨u, hu, h⟩ + · intro x hx + obtain ⟨y, -, rfl⟩ := id hC + obtain ⟨α, u, hu, rfl⟩ := hf.cover x (connectedComponentIn_subset _ _ hx) + exact ⟨α, (Set.Finite.mem_toFinset _).mpr ⟨u, hu, hx⟩, u, hu, rfl⟩ + +/-- **Two ends at a point.** The ends of the arcs meet in pairs: each end shares its point with +another end, and no three ends share +a point. This is how a circle covered by arcs looks. -/ +theorem exists_ends [Finite ι] (hS : IsSurface Z) (hf : IsArcFamily ℓ) (α : ι) (s : Bool) : + (∃ β s', (β, s') ≠ (α, s) ∧ ℓ β (ofs s' 1) = ℓ α (ofs s 1)) ∧ + ∀ β γ s' s'', ℓ β (ofs s' 1) = ℓ α (ofs s 1) → ℓ γ (ofs s'' 1) = ℓ α (ofs s 1) → + (β, s') = (α, s) ∨ (γ, s'') = (α, s) ∨ (β, s') = (γ, s'') := by + classical + have h01 : ∀ e : Bool, ofs e 1 ∈ Icc (0 : ℝ) 1 := fun e => by cases e + <;> simp [ofs_true, ofs_false] + have hyb := hf.mem α _ (h01 s) + have hC : connectedComponentIn (bd Z) (ℓ α (ofs s 1)) ∈ cuffs Z := ⟨_, hyb, rfl⟩ + have hy := mem_connectedComponentIn hyb + obtain ⟨φ⟩ := (cuff_statement Z hS).2.2 _ hC + obtain ⟨A, hsub, hA, hcov⟩ := exists_arcs_on hf hC + obtain ⟨L, σ, n, h1, h2, h3, h4, ⟨a₀, ha₀, ω, hω, h5⟩, h6, h7, t, h8⟩ + := exists_cuff_order hf φ A hsub hcov + have h0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have h1' : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hhead : ∀ β ∈ A, (φ (ee (n β 1))).1 = ℓ β (ofs (σ β) 1) := fun β h => (h3 β h).2.2 1 h1' + have htail : ∀ β ∈ A, (φ (ee (n β 0))).1 = ℓ β (ofs (!σ β) 1) := fun β h => by + rw [(h3 β h).2.2 0 h0] + cases σ β <;> simp [ofs_true, ofs_false] + have hlt : ∀ β ∈ A, n β 0 < n β 1 := fun β h => (h3 β h).2.1 h0 h1' zero_lt_one + have hmemL : ∀ β, β ∈ L → β ∈ A := fun β h => (h2 β).mp h + have ha₀L : a₀ ∈ L := List.mem_of_mem_head? ha₀ + have hωL : ω ∈ L := List.mem_of_getLast? hω + have hH : ∀ β ∈ A, ∃ γ ∈ A, ℓ γ (ofs (!σ γ) 1) = ℓ β (ofs (σ β) 1) := fun β hβ => by + rcases chain_next h4 β ((h2 β).mpr hβ) with h | ⟨γ, h9, h10⟩ + · obtain rfl := Option.mem_unique h hω + refine ⟨a₀, hmemL _ ha₀L, ?_⟩ + rw [← htail a₀ (hmemL _ ha₀L), ← hhead β hβ, h5, ee_add_one] + · refine ⟨γ, hmemL _ h9, ?_⟩ + rw [← htail γ (hmemL _ h9), ← hhead β hβ, h10] + have hT : ∀ β ∈ A, ∃ γ ∈ A, ℓ γ (ofs (σ γ) 1) = ℓ β (ofs (!σ β) 1) := fun β hβ => by + rcases chain_prev h4 β ((h2 β).mpr hβ) with h | ⟨γ, h9, h10⟩ + · obtain rfl := Option.mem_unique h ha₀ + refine ⟨ω, hmemL _ hωL, ?_⟩ + rw [← htail β hβ, ← hhead ω (hmemL _ hωL), h5, ee_add_one] + · refine ⟨γ, hmemL _ h9, ?_⟩ + rw [← htail β hβ, ← hhead γ (hmemL _ h9), h10] + have hαA : α ∈ A := hA α _ (h01 s) hy + have hmemA : ∀ β s', ℓ β (ofs s' 1) = ℓ α (ofs s 1) → β ∈ A := fun β s' he => hA β _ (h01 s') + (by rw [he]; exact hy) + have uT : ∀ β ∈ A, ∀ γ ∈ A, ℓ β (ofs (!σ β) 1) = ℓ γ (ofs (!σ γ) 1) → β = γ := fun β hβ γ hγ he + => by + rw [← htail β hβ, ← htail γ hγ] at he + obtain ⟨k, hk⟩ := ee_eq_iff.mp (φ.injective (Subtype.ext he)) + have b1 := h8 β hβ + have b2 := h8 γ hγ + have b3 := hlt β hβ + have b4 := hlt γ hγ + have k1 : (k : ℝ) < 1 := by linarith [b1.1, b2.2] + have k2 : (-1 : ℝ) < k := by linarith [b1.2, b2.1] + have k3 : k < 1 := by exact_mod_cast k1 + have k4 : -1 < k := by exact_mod_cast k2 + obtain rfl : k = 0 := by omega + exact h6 β hβ γ hγ (by simpa using hk) + have uH : ∀ β ∈ A, ∀ γ ∈ A, ℓ β (ofs (σ β) 1) = ℓ γ (ofs (σ γ) 1) → β = γ := fun β hβ γ hγ he + => by + rw [← hhead β hβ, ← hhead γ hγ] at he + obtain ⟨k, hk⟩ := ee_eq_iff.mp (φ.injective (Subtype.ext he)) + have b1 := h8 β hβ + have b2 := h8 γ hγ + have b3 := hlt β hβ + have b4 := hlt γ hγ + have k1 : (k : ℝ) < 1 := by linarith [b1.2, b2.1] + have k2 : (-1 : ℝ) < k := by linarith [b1.1, b2.2] + have k3 : k < 1 := by exact_mod_cast k1 + have k4 : -1 < k := by exact_mod_cast k2 + obtain rfl : k = 0 := by omega + exact h7 β hβ γ hγ (by simpa using hk) + have hb : ∀ (e : Bool) (β : ι), e = σ β ∨ e = !σ β := fun e β => by cases e <;> cases σ β <;> simp + constructor + · rcases hb s α with rfl | rfl + · obtain ⟨γ, -, h9⟩ := hH α hαA + refine ⟨γ, !σ γ, ?_, h9⟩ + intro he + obtain ⟨rfl, h10⟩ := Prod.mk.inj he + simp at h10 + · obtain ⟨γ, -, h9⟩ := hT α hαA + refine ⟨γ, σ γ, ?_, h9⟩ + intro he + obtain ⟨rfl, h10⟩ := Prod.mk.inj he + simp at h10 + · intro β γ s' s'' he he' + have hβ := hmemA β s' he + have hγ := hmemA γ s'' he' + rcases hb s α with rfl | rfl <;> rcases hb s' β with rfl | rfl <;> rcases hb s'' γ with rfl | + rfl + · obtain rfl := uH β hβ α hαA he + exact .inl rfl + · obtain rfl := uH β hβ α hαA he + exact .inl rfl + · obtain rfl := uH γ hγ α hαA he' + exact .inr (.inl rfl) + · obtain rfl := uT β hβ γ hγ (he.trans he'.symm) + exact .inr (.inr rfl) + · obtain rfl := uH β hβ γ hγ (he.trans he'.symm) + exact .inr (.inr rfl) + · obtain rfl := uT γ hγ α hαA he' + exact .inr (.inl rfl) + · obtain rfl := uT β hβ α hαA he + exact .inl rfl + · obtain rfl := uT β hβ α hαA he + exact .inl rfl + +end + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetExistsFamily.lean b/LeanPool/GraphMinor/GM07/NetExistsFamily.lean new file mode 100644 index 0000000000..a4c9580f4f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetExistsFamily.lean @@ -0,0 +1,241 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CellFamily +public import LeanPool.GraphMinor.Surface.WordFold +public import LeanPool.GraphMinor.Surface.CutTwo + +/-! +# Polygons of a cut surface + +Two facts on families of polygons. A space with disjoint parts, each with a polygon, is presented by +the family of these polygons +(`presents_family`). And a family which presents `Y` also presents a quotient `S` of `Y`, when the +labels of free sides are renamed +so that sides pasted in `S` have the same label (`presents_paste`). In `GM07/NetExists.lean`, `Y` is +`S` cut along a drawing. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface + +section family + +variable {Y : Type*} [TopologicalSpace Y] [T2Space Y] {r : ℕ} {Z : ℕ → Set Y} {w : ℕ + → List Letter} {g : ℕ → ℕ × ℂ → Y} + +omit [T2Space Y] in +/-- **Disjoint parts.** If `Y` is the disjoint union of `Z j`, and the word `w j` presents `Z j` by +`g j`, with no label in two +words, then the family of the words presents `Y`. -/ +theorem presents_family (hdisj : ∀ i j, i < r → j < r → i ≠ j → Disjoint (Z i) (Z j)) + (hcov : ∀ y, ∃ j < r, y ∈ Z j) + (hne : ∀ j < r, w j ≠ []) (hl : ∀ i j, i < r → j < r → i ≠ j → ∀ l ∈ w i, ∀ l' ∈ w j, l.1 ≠ + l'.1) + (hc : ∀ j < r, ContinuousOn (g j) (Dsk (sW (w j)))) (hs : ∀ j < r, g j '' Dsk (sW (w j)) = Z j) + (he : ∀ j < r, ∀ a ∈ Dsk (sW (w j)), ∀ b ∈ Dsk (sW (w j)), g j a = g j b ↔ PRel (sW + (w j)) a b) : + Presents (fun i => if i < r then w i else []) (fun a => g a.1 (0, a.2)) := by + set W : ℕ → List Letter := fun i => if i < r then w i else [] with hW + have hWi : ∀ {i}, i < r → W i = w i := fun h => ite_eq_left h + have hWn : ∀ {i}, W i ≠ [] → i < r := fun {i} h => by + by_contra hi + exact h (ite_eq_right hi) + have hmem : ∀ {j z}, j < r → ‖z‖ ≤ 1 → ((0, z) : ℕ × ℂ) ∈ Dsk (sW (w j)) := fun {j z} hj hz => + ⟨by rw [sW_zero]; exact hne j hj, hz⟩ + have hmemZ : ∀ {j z}, j < r → ‖z‖ ≤ 1 → g j (0, z) ∈ Z j := fun hj hz + => hs _ hj ▸ mem_image_of_mem _ (hmem hj hz) + have up : ∀ {j a b}, j < r → Stp (sW (w j)) a b → Stp W (j, a.2) (j, b.2) := by + rintro j _ _ hj ⟨i, i', p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ + obtain ⟨rfl, h4⟩ := sW_get h1 + obtain ⟨rfl, h5⟩ := sW_get h2 + refine ⟨j, j, p, q, k, ε, ε', t, by rw [hWi hj]; exact h4, by rw [hWi hj]; exact h5, ?_, ht, + ?_, ?_⟩ + · intro h + exact h3 (by rw [(Prod.mk.inj h).2]) + · simp only [sW_zero, hWi hj] + · simp only [sW_zero, hWi hj] + have upR : ∀ {j a b}, j < r → PRel (sW (w j)) a b → PRel W (j, a.2) (j, b.2) := by + intro j a b hj h + induction h with + | rel _ _ h => exact .rel _ _ (up hj h) + | refl _ => exact .refl _ + | symm _ _ _ ih => exact .symm _ _ ih + | trans _ _ _ _ _ h1 h2 => exact .trans _ _ _ h1 h2 + have down : ∀ {a b}, Stp W a b → g a.1 (0, a.2) = g b.1 (0, b.2) := by + rintro _ _ ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ + have hi : i < r := hWn fun h => by simp [h] at h1 + have hj : j < r := hWn fun h => by simp [h] at h2 + rw [hWi hi] at h1 + rw [hWi hj] at h2 + obtain rfl : i = j := by + by_contra hij + exact hl i j hi hj hij _ (List.mem_of_getElem? h1) _ (List.mem_of_getElem? h2) rfl + have h4 : Stp (sW (w i)) (0, sdPt (w i).length p ε t) (0, sdPt (w i).length q ε' t) := + ⟨0, 0, p, q, k, ε, ε', t, by rw [sW_zero]; exact h1, by rw [sW_zero]; exact h2, fun h => h3 + (by rw [(Prod.mk.inj h).2]), ht, + by simp only [sW_zero], by simp only [sW_zero]⟩ + simp only [hWi hi] + exact (he i hi _ h4.mem_Dsk.1 _ h4.mem_Dsk.2).mpr (.rel _ _ h4) + have downR : ∀ {a b}, PRel W a b → g a.1 (0, a.2) = g b.1 (0, b.2) := by + intro a b h + induction h with + | rel _ _ h => exact down h + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + refine ⟨continuousOn_slots fun i hi => ?_, ?_, fun a ha b hb => ⟨fun hab => ?_, downR⟩⟩ + · have hi' := hWn hi + refine (hc i hi').comp (f := fun z : ℂ => ((0 : ℕ), z)) (by fun_prop) fun z hz => hmem hi' + (by simpa using hz) + · refine eq_univ_of_forall fun y => ?_ + obtain ⟨j, hj, hy⟩ := hcov y + rw [← hs j hj] at hy + obtain ⟨a, ha, rfl⟩ := hy + obtain ⟨h1, -, h3⟩ := mem_Dsk_sW ha + refine ⟨(j, a.2), ⟨by simp only [hWi hj]; exact hne j hj, h3⟩, ?_⟩ + have : a = (0, a.2) := Prod.ext h1 rfl + simp only + rw [← this] + · obtain ⟨i, z⟩ := a + obtain ⟨i', z'⟩ := b + have hi := hWn ha.1 + have hi' := hWn hb.1 + have h1 := hmemZ hi ha.2 + have h2 := hmemZ hi' hb.2 + simp only at hab + obtain rfl : i = i' := by + by_contra hne' + exact Set.disjoint_left.mp (hdisj i i' hi hi' hne') h1 (hab ▸ h2) + exact upR (a := (0, z)) (b := (0, z')) hi ((he i hi _ (hmem hi ha.2) _ (hmem hi hb.2)).mp hab) + +end family + +/-- A letter under a change of sign `s`. -/ +def netFl (s ε : Bool) : Bool := if s then ε else !ε + +theorem sdPt_netFl (n p : ℕ) (s ε : Bool) (t : ℝ) : sdPt n p (netFl s ε) t = sdPt n p ε (ofs s t) + := by + cases s <;> cases ε <;> simp [netFl, sdPt, ofs] + +/-- Rename each label `k` to `(R k).1` and change its sign by `(R k).2`. -/ +def netW (R : ℕ → ℕ × Bool) (W : ℕ → List Letter) : ℕ → List Letter := + fun i => (W i).map fun l => ((R l.1).1, netFl (R l.1).2 l.2) + +theorem netW_length (R : ℕ → ℕ × Bool) (W : ℕ → List Letter) (i : ℕ) : (netW R W i).length = + (W i).length := by + simp [netW] + +theorem dsk_netW (R : ℕ → ℕ × Bool) (W : ℕ → List Letter) : Dsk (netW R W) = Dsk W := by + ext a + simp [Dsk, netW] + +theorem netW_get {R : ℕ → ℕ × Bool} {W : ℕ → List Letter} {i p k : ℕ} {e : Bool} (h : (W i)[p]? + = some (k, e)) : + (netW R W i)[p]? = some ((R k).1, netFl (R k).2 e) := by + simp [netW, h] + +theorem netW_get' {R : ℕ → ℕ × Bool} {W : ℕ → List Letter} {i p K : ℕ} {ε : Bool} (h : + (netW R W i)[p]? = some (K, ε)) : + ∃ k e, (W i)[p]? = some (k, e) ∧ (R k).1 = K ∧ netFl (R k).2 e = ε := by + simp only [netW, List.getElem?_map, Option.map_eq_some_iff, Prod.mk.injEq, Prod.exists] at h + obtain ⟨k, e, h1, h2, h3⟩ := h + exact ⟨k, e, h1, h2, h3⟩ + +section paste + +variable {Y S : Type*} [TopologicalSpace Y] [TopologicalSpace S] {W : ℕ → List Letter} {g : ℕ × ℂ + → Y} {ψ : Y → S} {R : ℕ → ℕ × Bool} + +/-- **Pasting free sides.** Let `W` present `Y`, and let `ψ` be a quotient map onto `S`. Rename +labels so that two different labels get +one new label only if their sides agree in `S`, and suppose that the new steps and the points of `Y` +generate all fibres of `ψ`. Then the +new family presents `S`. -/ +theorem presents_paste (hg : Presents W g) (hψ : Continuous ψ) (hsurj : Function.Surjective ψ) + (hmatch : ∀ i j p q k k' e e' (t : ℝ), (W i)[p]? = some (k, e) → (W j)[q]? = some (k', e') + → k ≠ k' → (R k).1 = (R k').1 → t ∈ Icc (0 : ℝ) 1 → + ψ (g (i, sdPt (W i).length p (netFl (R k).2 e) t)) = ψ (g (j, sdPt (W j).length q (netFl + (R k').2 e') t))) + (hfib : ∀ y y', ψ y = ψ y' → Relation.EqvGen (fun u v => u = v ∨ ∃ a b, g a = u ∧ g b = v ∧ Stp + (netW R W) a b) y y') : + Presents (netW R W) (ψ ∘ g) := by + have hDs := dsk_netW R W + have hSt : ∀ a b, Stp W a b → Stp (netW R W) a b := by + rintro _ _ ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ + have ht' : ofs (R k).2 t ∈ Icc (0 : ℝ) 1 := ofs_mem ht + refine ⟨i, j, p, q, _, _, _, ofs (R k).2 t, netW_get h1, netW_get h2, h3, ht', ?_, ?_⟩ + · rw [netW_length, sdPt_netFl, ofs_ofs] + · rw [netW_length, sdPt_netFl, ofs_ofs] + have hPR : ∀ a b, PRel W a b → PRel (netW R W) a b := by + intro a b h + induction h with + | rel _ _ h => exact .rel _ _ (hSt _ _ h) + | refl _ => exact .refl _ + | symm _ _ _ ih => exact .symm _ _ ih + | trans _ _ _ _ _ h1 h2 => exact .trans _ _ _ h1 h2 + have hSt' : ∀ a b, Stp (netW R W) a b → ψ (g a) = ψ (g b) := by + rintro _ _ ⟨i, j, p, q, K, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ + obtain ⟨k, e, h4, h5, rfl⟩ := netW_get' h1 + obtain ⟨k', e', h6, h7, rfl⟩ := netW_get' h2 + rw [netW_length, netW_length] + by_cases hk : k = k' + · subst hk + have h8 : Stp W (i, sdPt (W i).length p e (ofs (R k).2 t)) (j, sdPt (W j).length q e' (ofs + (R k).2 t)) := + ⟨i, j, p, q, k, e, e', _, h4, h6, h3, ofs_mem ht, rfl, rfl⟩ + rw [sdPt_netFl, sdPt_netFl] + exact congrArg ψ ((hg.2.2 _ h8.mem_Dsk.1 _ h8.mem_Dsk.2).mpr (.rel _ _ h8)) + · exact hmatch i j p q k k' e e' t h4 h6 hk (h5.trans h7.symm) ht + have hdown : ∀ a b, PRel (netW R W) a b → ψ (g a) = ψ (g b) := by + intro a b h + induction h with + | rel _ _ h => exact hSt' _ _ h + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + have key : ∀ y y', Relation.EqvGen (fun u v => u = v ∨ ∃ a b, g a = u ∧ g b = v ∧ Stp + (netW R W) a b) y y' → + ∀ a ∈ Dsk W, ∀ b ∈ Dsk W, g a = y → g b = y' → PRel (netW R W) a b := by + intro y y' h + induction h with + | rel y y' h => + intro a ha b hb hay hby + rcases h with rfl | ⟨a', b', h1, h2, h3⟩ + · exact hPR _ _ ((hg.2.2 a ha b hb).mp (hay.trans hby.symm)) + · have h4 := h3.mem_Dsk + rw [hDs] at h4 + exact .trans _ _ _ (hPR _ _ ((hg.2.2 a ha a' h4.1).mp (hay.trans h1.symm))) + (.trans _ _ _ (.rel _ _ h3) (hPR _ _ ((hg.2.2 b' h4.2 b hb).mp (h2.trans hby.symm)))) + | refl y => + intro a ha b hb hay hby + exact hPR _ _ ((hg.2.2 a ha b hb).mp (hay.trans hby.symm)) + | symm y y' _ ih => + intro a ha b hb hay hby + exact .symm _ _ (ih b hb a ha hby hay) + | trans y y' y'' _ _ h1 h2 => + intro a ha b hb hay hby + obtain ⟨c, hc, rfl⟩ : y' ∈ g '' Dsk W := by + rw [hg.2.1] + exact mem_univ _ + exact .trans _ _ _ (h1 a ha c hc hay rfl) (h2 c hc b hb rfl hby) + refine ⟨?_, ?_, fun a ha b hb => ?_⟩ + · rw [hDs] + exact hψ.comp_continuousOn hg.1 + · rw [hDs, image_comp, hg.2.1, image_univ, hsurj.range_eq] + · rw [hDs] at ha hb + exact ⟨fun h => key _ _ (hfib _ _ h) a ha b hb rfl rfl, hdown a b⟩ + +end paste + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetExistsGlue.lean b/LeanPool/GraphMinor/GM07/NetExistsGlue.lean new file mode 100644 index 0000000000..5344967343 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetExistsGlue.lean @@ -0,0 +1,757 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.OneWord +public import LeanPool.GraphMinor.Surface.WordTrack +public import LeanPool.GraphMinor.Surface.CutNull + +/-! +# Pasting polygons and keeping a set off the seam + +`exists_one_word` pastes a family of polygons into one, but it does not say which sides stay. For +the sketch on page 216 +of Graph Minors VII we need more: all sides of the last word must avoid the open edges of the graph. +So we keep a record +along the way. `OffSides Bad B W f` says that sides of `W` with a label outside `Bad` avoid `B`. +Pasting two polygons along a +label keeps this record (`exists_net_merge`), and so does pasting all polygons into one +(`exists_one_word_off`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Function GraphMinor.Surface + +universe u + +variable {T : Type u} [TopologicalSpace T] [T2Space T] + +/-- The sides of `W` with a label outside `Bad` avoid `B`. -/ +def OffSides (Bad : Set ℕ) (B : Set T) (W : ℕ → List Letter) (f : ℕ × ℂ → T) : Prop := + ∀ i p k ε, (W i)[p]? = some (k, ε) → k ∉ Bad → ∀ t ∈ Icc (0 : ℝ) 1, f (i, sdPt + (W i).length p ε t) ∉ B + +omit [T2Space T] in +theorem eq_of_stp {W : ℕ → List Letter} {f : ℕ × ℂ → T} (hf : Presents W f) {a b : ℕ × ℂ} + (h : Stp W a b) : f a = f b := + (hf.2.2 _ h.mem_Dsk.1 _ h.mem_Dsk.2).mpr (.rel _ _ h) + +variable {Bad : Set ℕ} {B : Set T} {W W' : ℕ → List Letter} {f : ℕ × ℂ → T} + +theorem OffSides.of_trk {K : Set ℕ} (h : Trk.{u} K W W') (hf : Presents W f) + (hok : OffSides Bad B W f) + (hsub : ∀ (i p c : ℕ) (ε : Bool), (W' i)[p]? = some (c, ε) → c ∉ Bad → c ∈ K ∧ ∃ (i₀ p₀ : ℕ) + (ε₀ : Bool), (W i₀)[p₀]? = some (c, ε₀)) : + ∃ f', Presents W' f' ∧ OffSides Bad B W' f' := by + obtain ⟨f', hf', hv⟩ := h T f hf + refine ⟨f', hf', fun i p c ε h1 hc t ht he => ?_⟩ + obtain ⟨hK, i₀, p₀, ε₀, h0⟩ := hsub i p c ε h1 hc + obtain ⟨i', p', h2, h3⟩ := hv c hK i₀ p₀ ε₀ h0 + have h4 := hok i₀ p₀ c ε₀ h0 hc t ht + rw [← h3 t ht] at h4 + by_cases hs : (i, p) = (i', p') + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj hs + rw [h1] at h2 + obtain ⟨-, rfl⟩ := Prod.mk.inj (Option.some.inj h2) + exact h4 he + · have h5 := eq_of_stp hf' (a := (i, sdPt (W' i).length p ε t)) (b := (i', sdPt + (W' i').length p' ε₀ t)) + ⟨i, i', p, p', c, ε, ε₀, t, h1, h2, hs, ht, rfl, rfl⟩ + exact h4 (h5 ▸ he) + +omit [T2Space T] in +theorem OffSides.rev {i : ℕ} {w : List Letter} (hf : Presents (update W i w) f) + (hok : OffSides Bad B (update W i w) f) : + ∃ f', Presents (update W i (winv w)) f' ∧ OffSides Bad B (update W i (winv w)) f' := by + refine ⟨_, hf.of_map isPolyMap_rev, fun s p c ε h1 hc t ht => ?_⟩ + by_cases hs : s = i + · subst hs + rw [update_self] at h1 ⊢ + have hp : p < (winv w).length := (List.getElem?_eq_some_iff.mp h1).1 + have hlen : (winv w).length = w.length := by simp [winv] + rw [hlen] at hp + have hget : w[w.length - 1 - p]? = some (c, !ε) := by + rw [winv, List.getElem?_map, List.getElem?_reverse hp] at h1 + obtain ⟨l, hl, hl'⟩ := Option.map_eq_some_iff.mp h1 + rw [hl] + have e1 : l = linv (c, ε) := by rw [← hl', linv_linv] + rw [e1] + rfl + have h2 := hok s (w.length - 1 - p) c (!ε) (by rw [update_self]; exact hget) hc t ht + rw [update_self] at h2 + simp only [comp_apply, ite_true, hlen, conj_sdPt hp] + exact h2 + · rw [update_of_ne hs] at h1 ⊢ + have h2 := hok s p c ε (by rw [update_of_ne hs]; exact h1) hc t ht + rw [update_of_ne hs] at h2 + simp only [comp_apply, hs, ite_false] + exact h2 + +theorem exists_getElem_of_mem {w : List Letter} {l : Letter} (h : l ∈ w) : ∃ p : ℕ, w[p]? = some l + := by + obtain ⟨p, hp, rfl⟩ := List.mem_iff_getElem.mp h + exact ⟨p, by simp [hp]⟩ + +/-- Pasting along a label with opposite signs. -/ +theorem exists_merge_opp (hW : FinW W) (hf : Presents W f) (hok : OffSides Bad B W f) {i j k : ℕ} + {e : Bool} (hij : j ≠ i) + (h0 : (k, e) ∈ W i) (h1 : (k, !e) ∈ W j) (c0 : cnt (W i) k = 1) (c1 : cnt (W j) k = 1) + (hoth : ∀ s, s ≠ i → s ≠ j → cnt (W s) k = 0) (l0 : 2 ≤ (W i).length) (l1 : 2 ≤ (W j).length) : + ∃ w f', Presents (update (update W j []) i w) f' ∧ OffSides Bad B (update + (update W j []) i w) f' ∧ 2 ≤ w.length ∧ + cnt w k = 0 ∧ ∀ c, cnt w c ≤ cnt (W i) c + cnt (W j) c := by + obtain ⟨a, b, ha⟩ := List.append_of_mem h0 + obtain ⟨c, d, hc⟩ := List.append_of_mem h1 + have hc0 : cnt (b ++ a) k = 0 := by + have h2 : cnt a k + (1 + cnt b k) = 1 := by simpa [ha, cnt_append, cnt_cons] using c0 + rw [cnt_append] + omega + have hc1 : cnt (d ++ c) k = 0 := by + have h2 : cnt c k + (1 + cnt d k) = 1 := by simpa [hc, cnt_append, cnt_cons] using c1 + rw [cnt_append] + omega + have hl0 : 1 ≤ (b ++ a).length := by + rw [ha] at l0 + simp at l0 ⊢ + omega + have hl1 : 1 ≤ (d ++ c).length := by + rw [hc] at l1 + simp at l1 ⊢ + omega + have hu : b ++ a ≠ [] := fun h => by simp [h] at hl0 + have hv : d ++ c ≠ [] := fun h => by simp [h] at hl1 + have s1 : Trk.{u} univ W (update W i ((k, e) :: (b ++ a))) := by + have := trk_rot.{u} (W := W) (i := i) a ((k, e) :: b) + rw [← ha, update_eq_self] at this + simpa using this + have s2 : Trk.{u} univ (update W i ((k, e) :: (b ++ a))) + (update (update W i ((k, e) :: (b ++ a))) j ((k, !e) :: (d ++ c))) := by + have hj1 : update W i ((k, e) :: (b ++ a)) j = c ++ (k, !e) :: d := by rw [update_of_ne hij, hc] + have := trk_rot.{u} (W := update W i ((k, e) :: (b ++ a))) (i := j) c ((k, !e) :: d) + rw [← hj1, update_eq_self] at this + simpa using this + have e2 : update (update W i ((k, e) :: (b ++ a))) j ((k, !e) :: (d ++ c)) = + update (update (update W j []) i ((k, e) :: (b ++ a))) j ((k, !e) :: (d ++ c)) := by + funext s + by_cases hs : s = j + · subst hs + simp + · by_cases hs' : s = i + · subst hs' + simp [update_of_ne hs] + · simp [update_of_ne hs, update_of_ne hs'] + have hy : FreshIn (update (update W j []) i (d ++ c ++ (b ++ a))) k := by + intro s l hl + by_cases hs : s = i + · subst hs + rw [update_self] at hl + exact (noLab_append.mpr ⟨noLab_of_cnt hc1, noLab_of_cnt hc0⟩) l hl + · rw [update_of_ne hs] at hl + by_cases hs' : s = j + · subst hs' + simp at hl + · rw [update_of_ne hs'] at hl + exact noLab_of_cnt (hoth s hs hs') l hl + have s3 := trk_glue.{u} (W := update W j []) (i := i) (j := j) (y := k) (u := b ++ a) (v + := d ++ c) (hW.update _ _) e hij + (by simp) hu hv hy + rw [← e2] at s3 + have hT : Trk.{u} {k}ᶜ W (update (update W j []) i (d ++ c ++ (b ++ a))) := + (s1.restrict fun _ _ => .inl (mem_univ _)).trans ((s2.restrict fun _ _ => .inl + (mem_univ _)).trans s3) + obtain ⟨f', hf', hok'⟩ := hok.of_trk hT hf (by + intro s p x ε h2 _ + have hmem : (x, ε) ∈ update (update W j []) i (d ++ c ++ (b ++ a)) s := List.mem_of_getElem? h2 + refine ⟨fun hx => hy s (x, ε) hmem hx, ?_⟩ + by_cases hs : s = i + · subst hs + rw [update_self] at hmem + simp only [List.mem_append] at hmem + have h3 : (x, ε) ∈ W s ∨ (x, ε) ∈ W j := by + rw [ha, hc] + simp only [List.mem_append, List.mem_cons] + tauto + rcases h3 with h3 | h3 + · obtain ⟨q, hq⟩ := exists_getElem_of_mem h3 + exact ⟨s, q, ε, hq⟩ + · obtain ⟨q, hq⟩ := exists_getElem_of_mem h3 + exact ⟨j, q, ε, hq⟩ + · rw [update_of_ne hs] at h2 + by_cases hs' : s = j + · subst hs' + simp at h2 + · rw [update_of_ne hs'] at h2 + exact ⟨s, p, ε, h2⟩) + refine ⟨_, f', hf', hok', ?_, ?_, fun x => ?_⟩ + · simp only [List.length_append] at hl0 hl1 ⊢ + omega + · rw [cnt_append, hc1, hc0] + · rw [ha, hc] + simp only [cnt_append, cnt_cons] + split_ifs <;> omega + +/-- Pasting two polygons along a label. -/ +theorem exists_net_merge (hW : FinW W) (hf : Presents W f) (hok : OffSides Bad B W f) {i j k : ℕ} + {e e' : Bool} (hij : j ≠ i) + (h0 : (k, e) ∈ W i) (h1 : (k, e') ∈ W j) (c0 : cnt (W i) k = 1) (c1 : cnt (W j) k = 1) + (hoth : ∀ s, s ≠ i → s ≠ j → cnt (W s) k = 0) (l0 : 2 ≤ (W i).length) (l1 : 2 ≤ (W j).length) : + ∃ w f', Presents (update (update W j []) i w) f' ∧ OffSides Bad B (update + (update W j []) i w) f' ∧ 2 ≤ w.length ∧ + cnt w k = 0 ∧ ∀ c, cnt w c ≤ cnt (W i) c + cnt (W j) c := by + by_cases he : e' = !e + · subst he + exact exists_merge_opp hW hf hok hij h0 h1 c0 c1 hoth l0 l1 + · have he' : e' = e := by + cases e <;> cases e' <;> simp_all + subst he' + have hup : update W j (W j) = W := update_eq_self _ _ + obtain ⟨f₁, hf₁, hok₁⟩ := OffSides.rev (W := W) (i := j) (w := W j) (by rwa [hup]) + (by rwa [hup]) + have hmem : (k, !e') ∈ winv (W j) := by + have : linv (k, e') ∈ winv (W j) := by + simp only [winv, List.mem_reverse, List.mem_map] + exact ⟨_, h1, rfl⟩ + simpa [linv] using this + obtain ⟨w, f', h2, h3, h4, h5, h6⟩ := exists_merge_opp (hW.update _ _) hf₁ hok₁ hij + (by rwa [update_of_ne hij.symm]) (by simpa using hmem) (by rwa [update_of_ne hij.symm]) + (by simpa [cnt_winv] using c1) (fun s h h' => by rw [update_of_ne h']; exact hoth s h h') + (by rwa [update_of_ne hij.symm]) (by simpa [winv] using l1) + refine ⟨w, f', by simpa using h2, by simpa using h3, h4, h5, fun c => ?_⟩ + have := h6 c + simpa [update_of_ne hij.symm, cnt_winv] using this + +/-- `exists_one_word`, with a record that the sides stay off a set. -/ +theorem exists_one_word_off {X : Type u} [TopologicalSpace X] [T2Space X] [ConnectedSpace X] {B : + Set X} (n : ℕ) : + ∀ (S : Finset ℕ) (W : ℕ → List Letter) (f : ℕ × ℂ → X), S.card = n → FinW W → W 0 ≠ [] + → Presents W f → + OffSides ∅ B W f → (∀ i, W i ≠ [] → 2 ≤ (W i).length) → (∀ i, i ∉ S → W i = []) → + (∀ c, ∑ i ∈ S, cnt (W i) c ≤ 2) → ∃ (w : List Letter) (g : ℕ × ℂ → X), 2 ≤ w.length ∧ Good w + ∧ Presents (sW w) g ∧ + OffSides ∅ B (sW w) g := by + apply exists_one_word_preserving (OffSides ∅ B) _ n + intro W f hW hf hok j k e e' hj hm0 hm1 c0 c1 hrest hlen0 hlen1 + obtain ⟨w, g, hg, hokg, hwl, -, hwc⟩ := + exists_net_merge hW hf hok hj hm0 hm1 c0 c1 hrest hlen0 hlen1 + exact ⟨w, g, hg, hokg, hwl, hwc⟩ + +/-- The number of letters of `w` with a label in `Bad`. -/ +noncomputable def bc (Bad : Set ℕ) (w : List Letter) : ℕ := open Classical in w.countP fun l + => l.1 ∈ Bad + +theorem bc_append (a b : List Letter) : bc Bad (a ++ b) = bc Bad a + bc Bad b := by + classical + simp [bc, List.countP_append] + +theorem bc_cons (l : Letter) (a : List Letter) : bc Bad (l :: a) = (open Classical in if l.1 ∈ Bad + then 1 else 0) + bc Bad a := by + classical + simp only [bc, List.countP_cons, decide_eq_true_eq] + split_ifs <;> omega + +theorem bc_nil : bc Bad [] = 0 := rfl + +theorem bc_pos {w : List Letter} {l : Letter} (h : l ∈ w) (hl : l.1 ∈ Bad) : 0 < bc Bad w := by + classical + exact List.countP_pos_iff.mpr ⟨l, h, by simpa using hl⟩ + +theorem exists_split_two {w : List Letter} (h : 2 ≤ bc Bad w) : ∃ v u, w = v ++ u ∧ 1 ≤ bc Bad v + ∧ 1 ≤ bc Bad u := by + classical + induction w with + | nil => simp [bc_nil] at h + | cons l w ih => + rw [bc_cons] at h + by_cases hl : l.1 ∈ Bad + · simp only [hl, ite_true] at h + refine ⟨[l], w, rfl, ?_, by omega⟩ + rw [bc_cons, bc_nil] + simp [hl] + · simp only [hl, ite_false] at h + obtain ⟨v, u, rfl, h1, h2⟩ := ih (by omega) + refine ⟨l :: v, u, rfl, ?_, h2⟩ + rw [bc_cons] + omega + +/-- Two different labels of `Bad` use up two letters. -/ +theorem cnt_add_cnt_le_bc {w : List Letter} {c k : ℕ} (hc : c ∈ Bad) (hk : k ∈ Bad) + (hne : c ≠ k) : cnt w c + cnt w k ≤ bc Bad w := by + classical + induction w with + | nil => simp [cnt_nil, bc_nil] + | cons l w ih => + rw [bc_cons, cnt_cons, cnt_cons] + by_cases h1 : l.1 = c + · have h2 : l.1 ≠ k := fun h => hne (h1.symm.trans h) + simp only [h1, ite_true, hc] + simp only [h1] at h2 + simp only [h2, ite_false] + omega + · by_cases h2 : l.1 = k + · simp only [h2, ite_true, hk] + simp only [h2] at h1 + simp only [h1, ite_false] + omega + · simp only [h1, h2, ite_false] + split_ifs <;> omega + +theorem cnt_le_bc {w : List Letter} {c : ℕ} (hc : c ∈ Bad) : cnt w c ≤ bc Bad w := by + classical + induction w with + | nil => simp [cnt_nil, bc_nil] + | cons l w ih => + rw [bc_cons, cnt_cons] + by_cases h1 : l.1 = c + · simp only [h1, ite_true, hc] + omega + · simp only [h1, ite_false] + split_ifs <;> omega + +/-- The points of the discs over `B` are on open sides with a label in `Bad`. -/ +def OnBad (Bad : Set ℕ) (B : Set T) (W : ℕ → List Letter) (f : ℕ × ℂ → T) : Prop := + ∀ a ∈ Dsk W, f a ∈ B → ∃ (i p k : ℕ) (ε : Bool) (u : ℝ), (W i)[p]? = some (k, ε) ∧ k ∈ Bad + ∧ u ∈ Ioo (0 : ℝ) 1 ∧ a = spt W i p u + +omit [TopologicalSpace T] [T2Space T] in +theorem OnBad.offSides (h : OnBad Bad B W f) : OffSides Bad B W f := by + intro i p k ε h1 hk t ht hb + have hmem : (i, sdPt (W i).length p ε t) ∈ Dsk W := by + refine ⟨fun he => ?_, (norm_per _ _).le⟩ + simp [he] at h1 + obtain ⟨i', p', k', ε', u, h2, hk', hu, he⟩ := h _ hmem hb + rw [spt, Prod.mk.injEq] at he + obtain ⟨rfl, he⟩ := he + rw [sdPt_eq] at he + obtain ⟨rfl, -⟩ := side_unique (lt_length h2) (lt_length h1) hu (ofs_mem ht) he.symm + rw [h1] at h2 + obtain ⟨rfl, -⟩ := Prod.mk.inj (Option.some.inj h2) + exact hk hk' + +theorem isPaired_of_sum {S : Finset ℕ} (hS : ∀ i, i ∉ S → W i = []) (hsum : ∀ c, ∑ i ∈ S, cnt + (W i) c ≤ 2) : IsPaired W := by + classical + intro k + have key : ∀ S : Finset ℕ, {s : ℕ × ℕ | s.1 ∈ S ∧ ∃ e, (W s.1)[s.2]? = some (k, e)}.encard ≤ + ((∑ i ∈ S, cnt (W i) k : ℕ) : ℕ∞) := by + intro S + induction S using Finset.induction_on with + | empty => simp + | insert a S ha ih => + rw [Finset.sum_insert ha] + have hs : {s : ℕ × ℕ | s.1 ∈ insert a S ∧ ∃ e, (W s.1)[s.2]? = some (k, e)} ⊆ + (fun p => (a, p)) '' {p : ℕ | ∃ e, (W a)[p]? = some (k, e)} ∪ {s : ℕ × ℕ | s.1 ∈ S ∧ ∃ e, + (W s.1)[s.2]? = some (k, e)} := by + rintro ⟨i, p⟩ ⟨h1, h2⟩ + rcases Finset.mem_insert.mp h1 with h3 | h3 + · simp only at h3 + subst h3 + exact .inl ⟨p, h2, rfl⟩ + · exact .inr ⟨h3, h2⟩ + refine (encard_le_encard hs).trans ((encard_union_le _ _).trans ?_) + rw [Nat.cast_add] + exact add_le_add ((encard_image_le _ _).trans (idx_encard_le _ _)) ih + have hs : {s : ℕ × ℕ | ∃ e, (W s.1)[s.2]? = some (k, e)} ⊆ {s : ℕ × ℕ | s.1 ∈ S ∧ ∃ e, + (W s.1)[s.2]? = some (k, e)} := by + rintro s ⟨e, he⟩ + refine ⟨?_, e, he⟩ + by_contra h + simp [hS _ h] at he + refine (encard_le_encard hs).trans ((key S).trans ?_) + exact_mod_cast hsum k + +theorem sum_update_two {F : List Letter → ℕ} {S : Finset ℕ} {i j : ℕ} (hi : i ∈ S) (hj : j ∉ S) + (x y : List Letter) : + ∑ s ∈ insert j S, F (update (update W i x) j y s) = F y + (F x + ∑ s ∈ S.erase i, F (W s)) := by + classical + have hij : j ≠ i := fun h => hj (h ▸ hi) + rw [Finset.sum_insert hj, ← Finset.add_sum_erase S _ hi] + simp only [update_self, update_of_ne hij.symm] + congr 2 + refine Finset.sum_congr rfl fun s hs => ?_ + have h1 : s ≠ i := (Finset.mem_erase.mp hs).1 + have h2 : s ≠ j := fun h => hj (h ▸ (Finset.mem_erase.mp hs).2) + rw [update_of_ne h2, update_of_ne h1] + +omit [T2Space T] in +/-- Cutting a polygon along a chord keeps all points over `B` on open sides with a label in `Bad`. +-/ +theorem OnBad.cut (hon : OnBad Bad B W f) (hf : Presents W f) {i j y : ℕ} {u v : List Letter} + (hw : W i = v ++ u) (hij : j ≠ i) + (hWj : W j = []) (hu : u ≠ []) (hv : v ≠ []) (hy : FreshIn W y) + (hP : IsPaired (update (update W i ((y, true) :: u)) j ((y, false) :: v))) : + ∃ f', Presents (update (update W i ((y, true) :: u)) j ((y, false) :: v)) f' ∧ + OnBad Bad B (update (update W i ((y, true) :: u)) j ((y, false) :: v)) f' := by + have e0 : update W i (v ++ u) = W := by rw [← hw, update_eq_self] + obtain ⟨θ, hθ, -, hup⟩ := exists_isPolyMap_cut (W := W) (u := u) (v := v) (y := y) (e + := true) hij hWj hu hv (by rwa [e0]) + rw [e0] at hθ hup + refine ⟨_, hf.of_map hθ, fun a ha hb => ?_⟩ + obtain ⟨i', p', k, ε, w, h1, hk, hw', he⟩ := hon _ (hθ.maps ha) hb + obtain ⟨s, q, h2, h3⟩ := hup i' p' k ε h1 + have hwm : ofs ε w ∈ Icc (0 : ℝ) 1 := ofs_mem ⟨hw'.1.le, hw'.2.le⟩ + have h4 := h3 _ hwm + have hspt : spt W i' p' w = (i', sdPt (W i').length p' ε (ofs ε w)) := by + rw [spt, sdPt_eq, ofs_ofs] + have hmem : (s, sdPt ((update (update W i ((y, true) :: u)) j ((y, false) :: v)) s).length q ε + (ofs ε w)) ∈ + Dsk (update (update W i ((y, true) :: u)) j ((y, false) :: v)) := by + refine ⟨fun he => ?_, (norm_per _ _).le⟩ + simp [he] at h2 + have hrel := hθ.fib _ hmem a ha (h4.trans (by rw [← hspt, he])) + have hw2 : ofs ε (ofs ε w) ∈ Ioo (0 : ℝ) 1 := by rwa [ofs_ofs] + have hsp : (s, sdPt ((update (update W i ((y, true) :: u)) j ((y, false) :: v)) s).length q ε + (ofs ε w)) = + spt (update (update W i ((y, true) :: u)) j ((y, false) :: v)) s q (ofs ε (ofs ε w)) := by + rw [spt, sdPt_eq] + rw [hsp] at hrel + rcases hrel.eq_or_stp hP h2 hw2 with h5 | h5 + · exact ⟨s, q, k, ε, _, h2, hk, hw2, h5⟩ + · obtain ⟨j', q', e', h6, -, h7⟩ := stp_of_side hP h2 hw2 h5 + exact ⟨j', q', k, e', _, h6, hk, flp_mem' hw2, h7⟩ + +theorem exists_fresh_label (hW : FinW W) (hBad : Bad.Finite) : ∃ y, FreshIn W y ∧ y ∉ Bad := by + classical + have h1 : (⋃ i ∈ {i | W i ≠ []}, (↑((W i).map Prod.fst).toFinset : Set ℕ)).Finite := + hW.biUnion fun _ _ => Finset.finite_toSet _ + obtain ⟨y, hy⟩ := (h1.union hBad).exists_notMem + refine ⟨y, fun i l hl he => hy (.inl ?_), fun h => hy (.inr h)⟩ + have hne : W i ≠ [] := fun h => by simp [h] at hl + simp only [mem_iUnion] + refine ⟨i, hne, ?_⟩ + simp only [Finset.mem_coe, List.mem_toFinset, List.mem_map] + exact ⟨l, hl, he⟩ + +theorem cnt_fresh {y s : ℕ} (hy : FreshIn W y) : cnt (W s) y = 0 := by + rw [cnt, List.countP_eq_zero] + intro l hl + simpa using hy s l hl + +omit [T2Space T] in +/-- Cut the polygons along chords until each has at most one letter with a label in `Bad`. This is +the cut of the sketch at each +corner: a polygon with one such letter is a sector. -/ +theorem exists_sectors (hBad : Bad.Finite) (m : ℕ) : ∀ (S : Finset ℕ) (W : ℕ → List Letter) + (f : ℕ × ℂ → T), + ∑ i ∈ S, (bc Bad (W i) - 1) = m → FinW W → W 0 ≠ [] → Presents W f → OnBad Bad B W f → + (∀ i, W i ≠ [] → 2 ≤ (W i).length) → + (∀ i, i ∉ S → W i = []) → (∀ c, ∑ i ∈ S, cnt (W i) c ≤ 2) → ∃ (S' : Finset ℕ) (W' : ℕ + → List Letter) (f' : ℕ × ℂ → T), + FinW W' ∧ W' 0 ≠ [] ∧ Presents W' f' ∧ OnBad Bad B W' f' ∧ (∀ i, W' i ≠ [] → 2 ≤ + (W' i).length) ∧ (∀ i, i ∉ S' → W' i = []) ∧ + (∀ c, ∑ i ∈ S', cnt (W' i) c ≤ 2) ∧ (∀ i, bc Bad (W' i) ≤ 1) ∧ ∀ c ∈ Bad, ∑ i ∈ S', cnt + (W' i) c = ∑ i ∈ S, cnt (W i) c := by + classical + induction m using Nat.strong_induction_on with + | _ m ih => + intro S W f hm hW h0 hf hon hlen hS hsum + by_cases hall : ∀ i, bc Bad (W i) ≤ 1 + · exact ⟨S, W, f, hW, h0, hf, hon, hlen, hS, hsum, hall, fun _ _ => rfl⟩ + push Not at hall + obtain ⟨i, hi⟩ := hall + obtain ⟨v, u, hw, hv1, hu1⟩ := exists_split_two (Bad := Bad) (w := W i) (by omega) + have hiS : i ∈ S := by + by_contra h + rw [hS i h] at hi + simp [bc_nil] at hi + have hu : u ≠ [] := fun h => by simp [h, bc_nil] at hu1 + have hv : v ≠ [] := fun h => by simp [h, bc_nil] at hv1 + obtain ⟨y, hy, hyB⟩ := exists_fresh_label hW hBad + obtain ⟨j, hj⟩ := (hW.union S.finite_toSet).exists_notMem + have hjS : j ∉ S := fun h => hj (.inr h) + have hWj : W j = [] := by + by_contra h + exact hj (.inl h) + have hij : j ≠ i := fun h => hjS (h ▸ hiS) + have hj0 : j ≠ 0 := by + rintro rfl + exact h0 hWj + set W' := update (update W i ((y, true) :: u)) j ((y, false) :: v) with hW' + have hsumF : ∀ F : List Letter → ℕ, ∑ s ∈ insert j S, F (W' s) = F ((y, false) :: v) + (F + ((y, true) :: u) + ∑ s ∈ S.erase i, F (W s)) := + fun F => sum_update_two hiS hjS _ _ + have hrest : ∀ F : List Letter → ℕ, ∑ s ∈ S, F (W s) = F (W i) + ∑ s ∈ S.erase i, F (W s) := + fun F => (Finset.add_sum_erase S _ hiS).symm + have hcy : ∀ s, cnt (W s) y = 0 := fun s => cnt_fresh hy + have hcount : ∀ c, c ≠ y → ∑ s ∈ insert j S, cnt (W' s) c = ∑ s ∈ S, cnt (W s) c := by + intro c hc + rw [hsumF (fun w => cnt w c), hrest (fun w => cnt w c), hw, cnt_append, cnt_cons, cnt_cons] + simp only [Ne.symm hc, ite_false] + omega + have hcounty : ∑ s ∈ insert j S, cnt (W' s) y = 2 := by + rw [hsumF (fun w => cnt w y), cnt_cons, cnt_cons] + have h1 : cnt v y = 0 := by + have := hcy i + rw [hw, cnt_append] at this + omega + have h2 : cnt u y = 0 := by + have := hcy i + rw [hw, cnt_append] at this + omega + have h3 : ∑ s ∈ S.erase i, cnt (W s) y = 0 := Finset.sum_eq_zero fun s _ => hcy s + simp [h1, h2, h3] + have hsum' : ∀ c, ∑ s ∈ insert j S, cnt (W' s) c ≤ 2 := fun c => by + by_cases hc : c = y + · subst hc + exact hcounty.le + · rw [hcount c hc] + exact hsum c + have hS' : ∀ s, s ∉ insert j S → W' s = [] := fun s hs => by + have h1 : s ≠ j := fun h => hs (Finset.mem_insert.mpr (.inl h)) + have h2 : s ∉ S := fun h => hs (Finset.mem_insert_of_mem h) + have h3 : s ≠ i := fun h => h2 (h ▸ hiS) + rw [hW', update_of_ne h1, update_of_ne h3] + exact hS s h2 + have hP' : IsPaired W' := isPaired_of_sum hS' hsum' + obtain ⟨f', hf', hon'⟩ := hon.cut hf hw hij hWj hu hv hy hP' + have hbcy : ∀ (e : Bool) (x : List Letter), bc Bad ((y, e) :: x) = bc Bad x := fun e x => by + rw [bc_cons] + simp [hyB] + have hm' : ∑ s ∈ insert j S, (bc Bad (W' s) - 1) < m := by + rw [hsumF (fun w => bc Bad w - 1), ← hm, hrest (fun w => bc Bad w - 1), hbcy, hbcy, hw, + bc_append] + omega + obtain ⟨S₂, W₂, f₂, h1, h2, h3, h4, h5, h6, h7, h8, h9⟩ := ih _ hm' (insert j S) W' f' rfl + ((hW.update _ _).update _ _) (by + rw [hW', update_of_ne hj0.symm] + by_cases hi0 : i = 0 + · subst hi0 + simp + · rwa [update_of_ne (Ne.symm hi0)]) + hf' hon' (fun s hs => by + by_cases hs1 : s = j + · subst hs1 + rw [hW', update_self] + have : v.length ≠ 0 := by simpa using hv + simp only [List.length_cons] + omega + · by_cases hs2 : s = i + · subst hs2 + rw [hW', update_of_ne hs1, update_self] + have : u.length ≠ 0 := by simpa using hu + simp only [List.length_cons] + omega + · rw [hW', update_of_ne hs1, update_of_ne hs2] at hs ⊢ + exact hlen s hs) hS' hsum' + refine ⟨S₂, W₂, f₂, h1, h2, h3, h4, h5, h6, h7, h8, fun c hc => ?_⟩ + rw [h9 c hc] + exact hcount c fun he => hyB (he ▸ hc) + +/-- Paste along each letter with a label in `Bad`. Each polygon has at most one such letter, so its +two sides are in two +polygons. These are the discs of the sketch around the edges of the graph. -/ +theorem exists_diamonds (m : ℕ) : ∀ (S : Finset ℕ) (W : ℕ → List Letter) (f : ℕ × ℂ → T), + ∑ i ∈ S, bc Bad (W i) = m → FinW W → W 0 ≠ [] → Presents W f → OffSides Bad B W f → + (∀ i, W i ≠ [] → 2 ≤ (W i).length) → + (∀ i, i ∉ S → W i = []) → (∀ c, ∑ i ∈ S, cnt (W i) c ≤ 2) → (∀ i, bc Bad (W i) ≤ 1) → + (∀ c ∈ Bad, ∑ i ∈ S, cnt (W i) c ≠ 1) → + ∃ (S' : Finset ℕ) (W' : ℕ → List Letter) (f' : ℕ × ℂ → T), + FinW W' ∧ W' 0 ≠ [] ∧ Presents W' f' ∧ OffSides ∅ B W' f' ∧ (∀ i, W' i ≠ [] → 2 ≤ + (W' i).length) ∧ (∀ i, i ∉ S' → W' i = []) ∧ + ∀ c, ∑ i ∈ S', cnt (W' i) c ≤ 2 := by + classical + induction m using Nat.strong_induction_on with + | _ m ih => + intro S W f hm hW h0 hf hok hlen hS hsum hone hodd + by_cases hall : ∀ i, bc Bad (W i) = 0 + · refine ⟨S, W, f, hW, h0, hf, fun i p k ε h1 _ => hok i p k ε h1 fun hk => ?_, hlen, hS, hsum⟩ + have := bc_pos (Bad := Bad) (l := (k, ε)) (List.mem_of_getElem? h1) hk + have h2 := hall i + omega + push Not at hall + obtain ⟨i₀, hi₀⟩ := hall + obtain ⟨l, hl, hlB⟩ : ∃ l ∈ W i₀, l.1 ∈ Bad := by + obtain ⟨l, hl, hd⟩ := List.countP_pos_iff.mp (Nat.pos_of_ne_zero hi₀) + exact ⟨l, hl, by simpa using hd⟩ + obtain ⟨k, e⟩ := l + have hkB : k ∈ Bad := hlB + have hi₀S : i₀ ∈ S := by + by_contra h + simp [hS i₀ h] at hl + have hci : cnt (W i₀) k = 1 := by + have h1 := cnt_le_bc (Bad := Bad) (w := W i₀) hkB + have h2 := hone i₀ + have h3 : 0 < cnt (W i₀) k := cnt_pos (w := W i₀) (l := (k, e)) hl + omega + have hsplit : cnt (W i₀) k + ∑ i ∈ S.erase i₀, cnt (W i) k = ∑ i ∈ S, cnt (W i) k + := Finset.add_sum_erase S (fun i => cnt (W i) k) hi₀S + obtain ⟨j₀, hj₀, hcj⟩ : ∃ j ∈ S.erase i₀, 0 < cnt (W j) k := by + by_contra hcon + push Not at hcon + have h1 : ∑ i ∈ S.erase i₀, cnt (W i) k = 0 := Finset.sum_eq_zero fun i hi => by + have := hcon i hi + omega + exact hodd k hkB (by omega) + have hij₀ : j₀ ≠ i₀ := (Finset.mem_erase.mp hj₀).1 + have hj₀S : j₀ ∈ S := (Finset.mem_erase.mp hj₀).2 + have key : ∀ i j, i ∈ S → j ∈ S → j ≠ i → j ≠ 0 → 0 < cnt (W i) k → 0 < cnt (W j) k → ∃ + (S' : Finset ℕ) (W' : ℕ → List Letter) (f' : ℕ × ℂ → T), + FinW W' ∧ W' 0 ≠ [] ∧ Presents W' f' ∧ OffSides ∅ B W' f' ∧ (∀ i, W' i ≠ [] → 2 ≤ + (W' i).length) ∧ (∀ i, i ∉ S' → W' i = []) ∧ + ∀ c, ∑ i ∈ S', cnt (W' i) c ≤ 2 := by + intro i j hiS hjS hij hj0 hci' hcj' + obtain ⟨l₁, h1, h1'⟩ := List.countP_pos_iff.mp hci' + obtain ⟨l₂, h2, h2'⟩ := List.countP_pos_iff.mp hcj' + obtain ⟨k₁, e₁⟩ := l₁ + obtain ⟨k₂, e₂⟩ := l₂ + obtain rfl : k₁ = k := by simpa using h1' + obtain rfl : k₂ = k₁ := by simpa using h2' + have hspl : ∀ c, cnt (W j) c + (cnt (W i) c + ∑ s ∈ (S.erase j).erase i, cnt (W s) c) + = ∑ s ∈ S, cnt (W s) c := fun c => by + have h3 : cnt (W j) c + ∑ s ∈ S.erase j, cnt (W s) c = ∑ s ∈ S, cnt (W s) c + := Finset.add_sum_erase S (fun s => cnt (W s) c) hjS + have h4 : cnt (W i) c + ∑ s ∈ (S.erase j).erase i, cnt (W s) c = ∑ s ∈ S.erase j, cnt (W s) c + := + Finset.add_sum_erase (S.erase j) (fun s => cnt (W s) c) (Finset.mem_erase.mpr ⟨hij.symm, + hiS⟩) + omega + have hk2 := hspl k₂ + have hk3 := hsum k₂ + have hrest : ∀ s, s ≠ i → s ≠ j → cnt (W s) k₂ = 0 := by + intro s hs1 hs2 + by_cases hsS : s ∈ S + · have h5 : s ∈ (S.erase j).erase i := Finset.mem_erase.mpr ⟨hs1, Finset.mem_erase.mpr ⟨hs2, + hsS⟩⟩ + have h6 : cnt (W s) k₂ ≤ ∑ s ∈ (S.erase j).erase i, cnt (W s) k₂ := + Finset.single_le_sum (f := fun s => cnt (W s) k₂) (fun _ _ => Nat.zero_le _) h5 + omega + · rw [hS s hsS] + rfl + have hc1 : cnt (W i) k₂ = 1 := by omega + have hc2 : cnt (W j) k₂ = 1 := by omega + have hne1 : W i ≠ [] := fun h => by simp [h] at h1 + have hne2 : W j ≠ [] := fun h => by simp [h] at h2 + obtain ⟨w, f', h3, h4, h5, h6, h7⟩ := exists_net_merge hW hf hok hij h1 h2 hc1 hc2 hrest + (hlen i hne1) (hlen j hne2) + have hoth0 : ∀ c ∈ Bad, c ≠ k₂ → cnt (W i) c = 0 ∧ cnt (W j) c = 0 := fun c hc hne => by + have h8 := cnt_add_cnt_le_bc (w := W i) hc hkB hne + have h9 := cnt_add_cnt_le_bc (w := W j) hc hkB hne + have h10 := hone i + have h11 := hone j + omega + have hbw : bc Bad w = 0 := by + by_contra hne + obtain ⟨l, hl1, hl2⟩ := List.countP_pos_iff.mp (Nat.pos_of_ne_zero hne) + have hlB : l.1 ∈ Bad := by simpa using hl2 + have h12 : 0 < cnt w l.1 := cnt_pos hl1 + by_cases hle : l.1 = k₂ + · rw [hle, h6] at h12 + exact lt_irrefl _ h12 + · have h13 := hoth0 l.1 hlB hle + have h14 := h7 l.1 + omega + have hne0 : w ≠ [] := fun he => by simp [he] at h5 + set W' := update (update W j []) i w with hW' + have hval : ∀ F : List Letter → ℕ, ∑ s ∈ S.erase j, F (W' s) = F w + ∑ s ∈ + (S.erase j).erase i, F (W s) := by + intro F + rw [← Finset.add_sum_erase (S.erase j) _ (Finset.mem_erase.mpr ⟨hij.symm, hiS⟩), hW', + update_self] + congr 1 + refine Finset.sum_congr rfl fun s hs => ?_ + have hs1 := (Finset.mem_erase.mp hs).1 + have hs2 := (Finset.mem_erase.mp (Finset.mem_erase.mp hs).2).1 + rw [update_of_ne hs1, update_of_ne hs2] + have hm' : ∑ s ∈ S.erase j, bc Bad (W' s) < m := by + rw [hval (bc Bad), hbw, zero_add, ← hm, ← Finset.add_sum_erase S _ hjS, + ← Finset.add_sum_erase (S.erase j) _ (Finset.mem_erase.mpr ⟨hij.symm, hiS⟩)] + have h15 : 0 < bc Bad (W j) := lt_of_lt_of_le hcj' (cnt_le_bc hkB) + omega + refine ih _ hm' (S.erase j) W' f' rfl ((hW.update _ _).update _ _) ?_ h3 h4 ?_ ?_ ?_ ?_ ?_ + · rw [hW'] + by_cases hi0 : i = 0 + · subst hi0 + simpa using hne0 + · rw [update_of_ne (Ne.symm hi0), update_of_ne hj0.symm] + exact h0 + · intro s hs + by_cases hs1 : s = i + · subst hs1 + rw [hW', update_self] + exact h5 + · rw [hW', update_of_ne hs1] at hs ⊢ + by_cases hs2 : s = j + · subst hs2 + simp at hs + · rw [update_of_ne hs2] at hs ⊢ + exact hlen s hs + · intro s hs + have hs1 : s ≠ i := fun h => hs (Finset.mem_erase.mpr ⟨h ▸ hij.symm, h ▸ hiS⟩) + rw [hW', update_of_ne hs1] + by_cases hs2 : s = j + · subst hs2 + simp + · rw [update_of_ne hs2] + exact hS s fun h => hs (Finset.mem_erase.mpr ⟨hs2, h⟩) + · intro c + rw [hval (fun w => cnt w c)] + have h16 := h7 c + have h17 := hspl c + have h18 := hsum c + omega + · intro s + by_cases hs1 : s = i + · subst hs1 + rw [hW', update_self, hbw] + omega + · rw [hW', update_of_ne hs1] + by_cases hs2 : s = j + · subst hs2 + simp [bc_nil] + · rw [update_of_ne hs2] + exact hone s + · intro c hc + rw [hval (fun w => cnt w c)] + by_cases hck : c = k₂ + · subst hck + have h19 : ∑ s ∈ (S.erase j).erase i, cnt (W s) c = 0 := Finset.sum_eq_zero fun s hs => + hrest s (Finset.mem_erase.mp hs).1 (Finset.mem_erase.mp (Finset.mem_erase.mp hs).2).1 + rw [h6, h19] + norm_num + · have h20 := hoth0 c hc hck + have h21 := h7 c + have h22 := hspl c + have h23 := hodd c hc + omega + by_cases hj0 : j₀ = 0 + · exact key j₀ i₀ hj₀S hi₀S hij₀.symm (fun h => hij₀ (hj0.trans h.symm)) hcj (by omega) + · exact key i₀ j₀ hi₀S hj₀S hij₀ hj0 (by omega) hcj + +/-- **Pasting.** Let a family of polygons present a connected space, so that every point over `B` is +on an open side with a label +in `Bad`, and each label in `Bad` is on two sides or none. Then the family can be pasted into one +polygon whose boundary avoids `B`. -/ +theorem exists_off_word {X : Type u} [TopologicalSpace X] [T2Space X] [ConnectedSpace X] {Bad : Set + ℕ} {B : Set X} (hBad : Bad.Finite) + (S : Finset ℕ) {W : ℕ → List Letter} {f : ℕ × ℂ → X} (hW : FinW W) (h0 : W 0 ≠ []) + (hf : Presents W f) (hon : OnBad Bad B W f) + (hlen : ∀ i, W i ≠ [] → 2 ≤ (W i).length) (hS : ∀ i, i ∉ S → W i = []) + (hsum : ∀ c, ∑ i ∈ S, cnt (W i) c ≤ 2) + (hodd : ∀ c ∈ Bad, ∑ i ∈ S, cnt (W i) c ≠ 1) : + ∃ (w : List Letter) (g : ℕ × ℂ → X), 2 ≤ w.length ∧ Good w ∧ Presents (sW w) g ∧ ∀ z ∈ sphere + (0 : ℂ) 1, g (0, z) ∉ B := by + obtain ⟨S₁, W₁, f₁, h1, h2, h3, h4, h5, h6, h7, h8, h9⟩ := exists_sectors hBad _ S W f rfl hW h0 + hf hon hlen hS hsum + obtain ⟨S₂, W₂, f₂, h10, h11, h12, h13, h14, h15, h16⟩ := exists_diamonds _ S₁ W₁ f₁ rfl h1 h2 h3 + h4.offSides h5 h6 h7 h8 + (fun c hc => by rw [h9 c hc]; exact hodd c hc) + obtain ⟨w, g, h17, h18, h19, h20⟩ := exists_one_word_off _ S₂ W₂ f₂ rfl h10 h11 h12 h13 h14 h15 + h16 + refine ⟨w, g, h17, h18, h19, fun z hz => ?_⟩ + have hn0 : 0 < w.length := by omega + obtain ⟨p, hp, t, ht, rfl⟩ := exists_side_of_sphere hn0 (fun q => (w[q]?.getD (0, true)).2) (z + := z) (by simpa using hz) + have hget : w[p]? = some (w[p]'hp) := by simp [hp] + have hsgn : (w[p]?.getD (0, true)).2 = (w[p]'hp).2 := by rw [hget]; rfl + have h21 := h20 0 p (w[p]'hp).1 (w[p]'hp).2 (by rw [sW_zero]; exact hget) (notMem_empty _) t ht + rwa [sW_zero, ← hsgn] at h21 + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetExistsHole.lean b/LeanPool/GraphMinor/GM07/NetExistsHole.lean new file mode 100644 index 0000000000..b455f409fb --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetExistsHole.lean @@ -0,0 +1,359 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.NetExistsCycle +public import LeanPool.GraphMinor.Surface.CohCount +public import LeanPool.GraphMinor.Surface.CutNull +public import LeanPool.GraphMinor.Surface.Classification + +/-! +# A polygon whose free sides are given arcs + +This is the step "augment" of Graph Minors VII, page 216, for one component of the surface cut along +the drawing. A connected surface +is a model surface, so it is a polygon with one free side around each cuff (`presents_ew`). The +other sides are the added edges. We +move each free side along its cuff and split it, so that its parts are the arcs on this cuff +(`exists_hole_word`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +/-- Maps of `[0, 1]`, one after the other, as a list. -/ +noncomputable def concF {κ : Type*} (m : κ → ℝ → ℝ) : List κ → ℝ → ℝ + | [] => id + | [x] => m x + | x :: y :: L => conc2 (m x) (concF m (y :: L)) + +theorem concF_zero {κ : Type*} (m : κ → ℝ → ℝ) (L : List κ) (x : κ) : concF m (x :: L) 0 = m x 0 + := by + cases L with + | nil => rfl + | cons y L => exact conc2_zero + +theorem concF_props {κ : Type*} {m : κ → ℝ → ℝ} (L : List κ) : ∀ x, (x :: L).IsChain (fun α β + => m α 1 = m β 0) → + (∀ y ∈ x :: L, ContinuousOn (m y) (Icc 0 1) ∧ StrictMonoOn (m y) (Icc 0 1)) → + ContinuousOn (concF m (x :: L)) (Icc 0 1) ∧ StrictMonoOn (concF m (x :: L)) (Icc 0 1) ∧ ∃ ω ∈ + (x :: L).getLast?, concF m (x :: L) 1 = m ω 1 := by + induction L with + | nil => + intro x _ h + exact ⟨(h x (by simp)).1, (h x (by simp)).2, x, by simp, rfl⟩ + | cons y L ih => + intro x hc h + rw [List.isChain_cons_cons] at hc + obtain ⟨h1, h2, ω, h3, h4⟩ := ih y hc.2 fun z hz => h z (List.mem_cons_of_mem _ hz) + have h5 : m x 1 = concF m (y :: L) 0 := by rw [concF_zero]; exact hc.1 + refine ⟨continuousOn_conc2 (h x (by simp)).1 h1 h5, strictMonoOn_conc2 (h x + (by simp)).2 h2 h5, ω, ?_, ?_⟩ + · rw [List.getLast?_cons_cons] + exact h3 + · rw [concF] + rw [conc2_one h5, h4] + +theorem exists_fresh_cnt (w : List Letter) : ∃ q, cnt w q = 0 := by + obtain ⟨q, hq⟩ := Infinite.exists_notMem_finset (w.map Prod.fst).toFinset + refine ⟨q, noLab_iff_cnt.mp fun l hl => ?_⟩ + intro he + exact hq (List.mem_toFinset.mpr (List.mem_map.mpr ⟨l, hl, he⟩)) + +section + +variable {T : Type u} [TopologicalSpace T] [T2Space T] + +/-- `exists_split`, stated with counts of labels. -/ +theorem exists_split_cnt {w : List Letter} {p q : ℕ} {f : ℕ × ℂ → T} (hf : Presents + (sW w) f) {ρ : ℝ → T} (hρ : SideVal (sW w) f p ρ) + (hp : cnt w p = 1) (hq : cnt w q = 0) : + ∃ w' f', Presents (sW w') f' ∧ SideVal (sW w') f' p (fun u => ρ (u / 2)) ∧ SideVal (sW w') f' q + (fun u => ρ ((1 + u) / 2)) ∧ + w'.length = w.length + 1 ∧ (∀ k, k ≠ q → cnt w' k = cnt w k) ∧ cnt w' q = 1 ∧ + ∀ k, k ≠ p → k ≠ q → ∀ ρ', SideVal (sW w) f k ρ' → SideVal (sW w') f' k ρ' := by + have hpq : p ≠ q := by + rintro rfl + omega + obtain ⟨i, r, h1, -⟩ := id hρ + obtain ⟨-, h2⟩ := sW_get h1 + obtain ⟨hr, h3⟩ := List.getElem?_eq_some_iff.mp h2 + have hw : w = w.take r ++ (p, true) :: w.drop (r + 1) := by + conv_lhs => rw [← List.take_append_drop r w, List.drop_eq_getElem_cons hr, h3] + set A := w.take r with hA + set B := w.drop (r + 1) with hB + have hc : ∀ k, cnt w k = cnt (B ++ A) k + if p = k then 1 else 0 := fun k => by + rw [hw, cnt_append, cnt_cons, cnt_append] + simp only + omega + have hn1 : NoLab (B ++ A) p := noLab_iff_cnt.mpr (by + have := hc p + simp only [ite_true] at this + omega) + have hn2 : NoLab (B ++ A) q := noLab_iff_cnt.mpr (by have := hc q; omega) + rw [hw] at hf hρ + obtain ⟨f', h4, h5, h6, h7⟩ := exists_split hpq hn1 hn2 hf hρ + have hc' : ∀ k, cnt (A ++ (p, true) :: (q, true) :: B) k = cnt w k + if q = k then 1 else 0 + := fun k => by + rw [hw, cnt_append, cnt_cons, cnt_cons, cnt_append, cnt_cons] + simp only + omega + refine ⟨_, f', h4, h5, h6, ?_, fun k hk => ?_, ?_, fun k h8 h9 ρ' h10 => h7 k h8 h9 ρ' (hw ▸ h10)⟩ + · have hlen : w.length = A.length + (B.length + 1) := by + have := congrArg List.length hw + rwa [List.length_append, List.length_cons] at this + rw [hlen] + simp only [List.length_append, List.length_cons] + omega + · rw [hc' k, ite_eq_right (Ne.symm hk), add_zero] + · rw [hc' q, hq] + simp + +/-- A free side which runs through a list of paths is split into one side for each path. -/ +theorem exists_split_list {κ : Type*} (F : ℝ → T) (m : κ → ℝ → ℝ) (L : List κ) : ∀ (x : κ) (p : ℕ) + (w : List Letter) (f : ℕ × ℂ → T), + (x :: L).IsChain (fun α β => m α 1 = m β 0) → Presents (sW w) f → cnt w p = 1 → Good w + → SideVal (sW w) f p (fun u => F (concF m (x :: L) u)) → + ∃ w' f', Presents (sW w') f' ∧ Good w' ∧ w.length ≤ w'.length ∧ + (∀ y ∈ x :: L, ∃ k, (k = p ∨ cnt w k = 0) ∧ cnt w' k = 1 ∧ SideVal (sW w') f' k (fun u => F + (m y u))) ∧ + ∀ k, cnt w k ≠ 0 → k ≠ p → cnt w' k = cnt w k ∧ ∀ ρ', SideVal (sW w) f k ρ' → SideVal + (sW w') f' k ρ' := by + induction L with + | nil => + intro x p w f _ hf hp hG hs + refine ⟨w, f, hf, hG, le_rfl, fun y hy => ?_, fun k _ _ => ⟨rfl, fun _ h => h⟩⟩ + obtain rfl : y = x := by simpa using hy + exact ⟨p, .inl rfl, hp, hs⟩ + | cons y L ih => + intro x p w f hc hf hp hG hs + rw [List.isChain_cons_cons] at hc + obtain ⟨q, hq⟩ := exists_fresh_cnt w + have hpq : p ≠ q := by + rintro rfl + omega + have hrw : concF m (x :: y :: L) = conc2 (m x) (concF m (y :: L)) := rfl + have h5 : m x 1 = concF m (y :: L) 0 := by rw [concF_zero]; exact hc.1 + obtain ⟨w₁, f₁, h1, h2, h3, h4, h6, h7, h8⟩ := exists_split_cnt hf hs hp hq + have s1 : SideVal (sW w₁) f₁ p (fun u => F (m x u)) := h2.congr fun u hu + => by rw [hrw, conc2_left hu] + have s2 : SideVal (sW w₁) f₁ q (fun u => F (concF m (y :: L) u)) := h3.congr fun u hu + => by rw [hrw, conc2_right h5 hu] + have hG1 : Good w₁ := fun k => by + by_cases hk : k = q + · subst hk + omega + · rw [h6 k hk] + exact hG k + obtain ⟨w', f', a1, a2, a3, a4, a5⟩ := ih y q w₁ f₁ hc.2 h1 h7 hG1 s2 + have hp1 : cnt w₁ p = 1 := by rw [h6 p hpq, hp] + refine ⟨w', f', a1, a2, by omega, fun z hz => ?_, fun k hk1 hk2 => ?_⟩ + · rcases List.mem_cons.mp hz with rfl | hz + · have := a5 p (by omega) hpq + exact ⟨p, .inl rfl, by rw [this.1, hp1], this.2 _ s1⟩ + · obtain ⟨k, b1, b2, b3⟩ := a4 z hz + refine ⟨k, .inr ?_, b2, b3⟩ + rcases b1 with rfl | b1 + · exact hq + · have hkq : k ≠ q := by + rintro rfl + omega + rw [← h6 k hkq] + exact b1 + · have hkq : k ≠ q := by + rintro rfl + exact hk1 hq + have h9 := a5 k (by rw [h6 k hkq]; exact hk1) hkq + exact ⟨by rw [h9.1, h6 k hkq], fun ρ' h10 => h9.2 _ (h8 k hk2 hkq ρ' h10)⟩ + +end + +section + +variable {Z : Type u} [TopologicalSpace Z] [T2Space Z] {ι : Type*} [Finite ι] {ℓ : ι → ℝ → Z} + +/-- Move the free sides around the cuffs one at a time, and split them into the arcs on these cuffs. +-/ +theorem exists_holes (hS : IsSurface Z) (hfam : IsArcFamily ℓ) {c : ℕ} {p : ℕ + → ℕ} {ρ : ℕ → ℝ → Z} (hp : ∀ i j, i < c → j < c → p i = p j → i = j) + (hρ : ∀ i < c, ContinuousOn (ρ i) (Icc 0 1) ∧ InjOn (ρ i) (Ico 0 1) ∧ ρ i 0 = ρ i 1) + (hcuff : ∀ i < c, ρ i '' Icc 0 1 ∈ cuffs Z) + (hne : ∀ i j, i < c → j < c → i ≠ j → ρ i '' Icc 0 1 ≠ ρ j '' Icc 0 1) {w₀ : List Letter} {g₀ : + ℕ × ℂ → Z} (hw : Presents (sW w₀) g₀) (hG : Good w₀) + (hside : ∀ i < c, cnt w₀ (p i) = 1 ∧ SideVal (sW w₀) g₀ (p i) (ρ i)) (e : ℕ) : e ≤ c + → ∃ w g, Presents (sW w) g ∧ Good w ∧ w₀.length ≤ w.length ∧ + (∀ i, e ≤ i → i < c → cnt w (p i) = 1 ∧ SideVal (sW w) g (p i) (ρ i)) ∧ + ∀ i < e, ∀ α, ℓ α 0 ∈ ρ i '' Icc 0 1 → ∃ k σ, cnt w k = 1 ∧ (∀ j, e ≤ j → j < c → k ≠ p j) + ∧ SideVal (sW w) g k (fun u => ℓ α (ofs σ u)) := by + classical + induction e with + | zero => + intro _ + exact ⟨w₀, g₀, hw, hG, le_rfl, fun i _ hi => hside i hi, fun i hi => absurd hi (by omega)⟩ + | succ e ih => + intro he + obtain ⟨w, g, h1, h2, h3, h4, h5⟩ := ih (by omega) + have hec : e < c := he + obtain ⟨hc, hi, hl⟩ := hρ e hec + have hC := hcuff e hec + have hcl : ∀ j < c, IsClosed (ρ j '' Icc 0 1) := fun j hj => + (isCompact_Icc.image_of_continuousOn (hρ j hj).1).isClosed + set C := ρ e '' Icc 0 1 with hCdef + obtain ⟨φ, hφ⟩ : ∃ φ : Circle ≃ₜ C, ∀ u ∈ Icc (0 : ℝ) 1, (φ (ee u)).1 = ρ e u + := exists_circle_param hc hi hl + set U : Set Z := (⋃ j ∈ {j | j < c ∧ j ≠ e}, ρ j '' Icc 0 1)ᶜ with hU + have hfinite : {j | j < c ∧ j ≠ e}.Finite := + (Set.finite_lt_nat c).subset fun _ hj => hj.1 + have hUo : IsOpen U := + (hfinite.isClosed_biUnion fun j hj => hcl j hj.1).isOpen_compl + have hCU : C ⊆ U := by + intro x hx hmem + obtain ⟨j, ⟨hj, hj'⟩, hxj⟩ := mem_iUnion₂.mp hmem + exact Set.disjoint_left.mp (cuffs_disjoint hC (hcuff j hj) (hne e j hec hj hj'.symm)) hx hxj + have hoff : ∀ j < c, j ≠ e → ∀ x ∈ ρ j '' Icc 0 1, x ∉ U := fun j hj hj' x hx h => + h (mem_iUnion₂.mpr ⟨j, ⟨hj, hj'⟩, hx⟩) + obtain ⟨A, a1, a2, a3⟩ := exists_arcs_on hfam hC + obtain ⟨L, σ, n, b1, b2, b3, b4, ⟨a₀, ha₀, ω, hω, b5⟩, -, -, -⟩ := exists_cuff_order hfam φ A + a1 a3 + obtain ⟨L', rfl⟩ : ∃ L', L = a₀ :: L' := by + cases L with + | nil => simp at ha₀ + | cons x L' => + obtain rfl : x = a₀ := by simpa using ha₀ + exact ⟨L', rfl⟩ + obtain ⟨c1, c2, ω', hω', c3⟩ := concF_props (m := n) L' a₀ b4 fun y hy => ⟨(b3 y + ((b2 y).mp hy)).1, (b3 y ((b2 y).mp hy)).2.1⟩ + obtain rfl := Option.mem_unique hω' hω + have s0 : SideVal (sW w) g (p e) (fun u => (φ (ee u)).1) := (h4 e le_rfl hec).2.congr fun u hu + => (hφ u hu).symm + obtain ⟨g₁, d1, d2, d3⟩ := exists_pieces1 hS hC hUo hCU φ h1 s0 c1 c2 + (by rw [c3, concF_zero, b5]) + have hcnt := (h4 e le_rfl hec).1 + obtain ⟨w₂, g₂, f1, f2, f3, f4, f5⟩ := exists_split_list (fun x => (φ (ee x)).1) n L' a₀ + (p e) w g₁ b4 d1 hcnt h2 d2 + refine ⟨w₂, g₂, f1, f2, h3.trans f3, fun i hi1 hi2 => ?_, fun i hi α hα => ?_⟩ + · have q1 := h4 i (by omega) hi2 + have hne' : p i ≠ p e := fun h => by + have := hp i e hi2 hec h + omega + have q2 := f5 (p i) (by omega) hne' + refine ⟨by rw [q2.1, q1.1], q2.2 _ (d3 _ _ q1.2 fun u hu => hoff i hi2 (by omega) _ ⟨u, hu, + rfl⟩)⟩ + · obtain ⟨⟨u₀, hu₀, hα'⟩⟩ : Nonempty (∃ u₀ ∈ Icc (0 : ℝ) 1, ρ i u₀ = ℓ α 0) := by + obtain ⟨u₀, h6, h7⟩ := hα + exact ⟨⟨u₀, h6, h7⟩⟩ + have hic : i < c := by omega + by_cases hie : i = e + · subst hie + have hαA : α ∈ A := a2 α 0 (by simp) hα + obtain ⟨k, g1, g2, g3⟩ := f4 α ((b2 α).mpr hαA) + refine ⟨k, σ α, g2, fun j hj1 hj2 => ?_, g3.congr fun u hu => (b3 α hαA).2.2 u hu⟩ + have q1 := h4 j (by omega) hj2 + rcases g1 with rfl | g1 + · intro he' + have := hp i j hec hj2 he' + omega + · rintro rfl + omega + · have hi' : i < e := by omega + obtain ⟨k, σ', g1, g2, g3⟩ := h5 i hi' α hα + have hke : k ≠ p e := g2 e le_rfl hec + have q2 := f5 k (by omega) hke + refine ⟨k, σ', by rw [q2.1, g1], fun j hj1 hj2 => g2 j (by omega) hj2, + q2.2 _ (d3 _ _ g3 fun u hu => ?_)⟩ + exact hoff i hic hie _ (arc_sub_cuff hfam (hcuff i hic) (by simp) hα _ (ofs_mem hu)) + +theorem cnt_eq_one_of_free {w : List Letter} {r k : ℕ} {e : Bool} (h : w[r]? = some (k, e)) + (hf : FreeSide (sW w) 0 r) : cnt w k = 1 := by + obtain ⟨hr, h3⟩ := List.getElem?_eq_some_iff.mp h + have hw : w = w.take r ++ (k, e) :: w.drop (r + 1) := by + conv_lhs => rw [← List.take_append_drop r w, List.drop_eq_getElem_cons hr, h3] + have h1 : cnt (w.take r) k = 0 := noLab_iff_cnt.mp fun l hl he => by + obtain ⟨q, hq⟩ := List.getElem?_of_mem hl + obtain ⟨l₁, l₂⟩ := l + obtain rfl : l₁ = k := he + have hlt : q < r := by + have := (List.getElem?_eq_some_iff.mp hq).1 + simp at this + omega + rw [List.getElem?_take_of_lt hlt] at hq + have := hf 0 q _ e l₂ (by rw [sW_zero]; exact h) (by rw [sW_zero]; exact hq) + simp at this + omega + have h2 : cnt (w.drop (r + 1)) k = 0 := noLab_iff_cnt.mp fun l hl he => by + obtain ⟨q, hq⟩ := List.getElem?_of_mem hl + obtain ⟨l₁, l₂⟩ := l + obtain rfl : l₁ = k := he + rw [List.getElem?_drop] at hq + have := hf 0 (r + 1 + q) _ e l₂ (by rw [sW_zero]; exact h) (by rw [sW_zero]; exact hq) + simp at this + omega + rw [hw, cnt_append, cnt_cons, h1, h2] + simp + +/-- **A polygon for a connected surface.** A connected surface with a family of arcs on its boundary +has a polygon in which each arc +is one free side, up to reversal. The other sides are the edges that the sketch of page 216 adds. -/ +theorem exists_hole_word [ConnectedSpace Z] (hS : IsSurface Z) (hfam : IsArcFamily ℓ) : + ∃ (w : List Letter) (g : ℕ × ℂ → Z), 2 ≤ w.length ∧ Good w ∧ Presents (sW w) g ∧ + ∀ α, ∃ k σ, cnt w k = 1 ∧ SideVal (sW w) g k (fun u => ℓ α (ofs σ u)) := by + classical + obtain ⟨a, b, c, ⟨e⟩⟩ := classification Z hS inferInstance + obtain ⟨-, f₀, hf₀⟩ := presents_ew a b c + have hf := presents_comp hf₀ e.symm + set f := e.symm ∘ f₀ with hfdef + have hne : ∀ i j, i < c → j < c → i ≠ j → holeC a b c f i ≠ holeC a b c f j + := fun i j hi hj hij he => by + have h1 : Set.InjOn (holeC a b c f) {i | i < c} := by + have h2 := ncard_cuffs hf + rw [cuffs_eq_holeC hf] at h2 + have h3 : Set.ncard {i | i < c} = c := by + have : {i | i < c} = ((Finset.range c : Finset ℕ) : Set ℕ) := by + ext i + simp + rw [this, ncard_coe_finset, Finset.card_range] + exact (Set.ncard_image_iff (by exact Set.finite_lt_nat c)).mp (h2.trans h3.symm) + exact hij (h1 hi hj he) + have hcuff : ∀ i < c, holeC a b c f i ∈ cuffs Z := fun i hi => by + rw [cuffs_eq_holeC hf] + exact ⟨i, hi, rfl⟩ + have hw0 : (ew a b c).length ≠ 0 := by simp [ew] + have hgood : Good (ew a b c) := by + rw [ew_eq_rW] + exact good_rW (List.nodup_range' ..) fun m hm => by + have := (List.mem_range'_1.mp hm).2 + omega + have hside : ∀ i < c, cnt (ew a b c) (rL a b i).1 = 1 ∧ SideVal (sW (ew a b c)) f (rL a b i).1 + (holeP a b c f i) := fun i hi => by + have h1 := sideVal_hole hf hi + rw [← ew_eq_rW] at h1 + refine ⟨?_, h1⟩ + refine cnt_eq_one_of_free (r := 4 * a + 2 * b + 3 * i + 1) (e := true) ?_ (freeSide_hole hi) + rw [ew_get a b c (by omega), lab_t (δ := 1) hi (by norm_num), sgn_t (δ := 1) hi (by norm_num)] + simp [rL] + obtain ⟨w, g, h1, h2, h3, -, h5⟩ := exists_holes hS hfam (p := fun i => (rL a b i).1) (ρ + := holeP a b c f) (c := c) (fun i j _ _ h => by simpa [rL] using h) + (fun i hi => hole_loop hf hi) (fun i hi => hcuff i hi) hne hf hgood hside c le_rfl + refine ⟨w, g, ?_, h2, h1, fun α => ?_⟩ + · have : (ew a b c).length = (nfW a b c).length + 2 := by simp [ew] + omega + · have hmem := hfam.mem α 0 (by simp) + rw [← sUnion_cuffs, cuffs_eq_holeC hf] at hmem + obtain ⟨_, ⟨i, hi, rfl⟩, h6⟩ := hmem + obtain ⟨k, σ, h7, -, h8⟩ := h5 i hi α h6 + exact ⟨k, σ, h7, h8⟩ + +end + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetExistsLines.lean b/LeanPool/GraphMinor/GM07/NetExistsLines.lean new file mode 100644 index 0000000000..addaac037f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetExistsLines.lean @@ -0,0 +1,760 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.NetExistsMerge +public import LeanPool.GraphMinor.GM19.CutDrawing2 +public import LeanPool.GraphMinor.GM19.FeatureDissect +public import LeanPool.GraphMinor.GM19.FeatureCut + +/-! +# Cutting a surface along the edges of a drawing + +We cut a connected surface along finitely many paths with disjoint insides, which may be closed +(`exists_edges_cut`). Since the cut of +`GM19.exists_abstractCut` takes lines, each path is split at its middle point. The lines are put in +a dissection only to build the cut +surface, so a vertex that the dissection adds on a path plays no part afterwards. The lifts of the +two halves are then joined by +`exists_merged_cut`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +local notation "𝕀" => unitInterval + +universe u + +/-- The parameter of a half of a path. -/ +noncomputable def halfW (b : Bool) (x : ℝ) : ℝ := if b then x / 2 else (1 + x) / 2 + +theorem halfW_mem (b : Bool) {x : ℝ} (hx : x ∈ Icc (0 : ℝ) 1) : halfW b x ∈ Icc (0 : ℝ) 1 := by + cases b <;> simp only [halfW, Bool.false_eq_true, ↓reduceIte] + <;> constructor <;> linarith [hx.1, hx.2] + +theorem halfW_Ioo (b : Bool) {x : ℝ} (hx : x ∈ Ioo (0 : ℝ) 1) : halfW b x ∈ Ioo (0 : ℝ) 1 ∧ + halfW b x ≠ 1 / 2 := by + cases b <;> simp only [halfW, Bool.false_eq_true, ↓reduceIte] <;> refine ⟨⟨?_, ?_⟩, ?_⟩ + <;> linarith [hx.1, hx.2] + +theorem halfW_inj {b b' : Bool} {x y : ℝ} (hx : x ∈ Ioo (0 : ℝ) 1) (hy : y ∈ Ioo (0 : ℝ) 1) + (h : halfW b x = halfW b' y) : b = b' ∧ x = y := by + have h1 := hx.1 + have h2 := hx.2 + have h3 := hy.1 + have h4 := hy.2 + cases b <;> cases b' <;> simp only [halfW, Bool.false_eq_true, ↓reduceIte] at h + · exact ⟨rfl, by linarith⟩ + · linarith + · linarith + · exact ⟨rfl, by linarith⟩ + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] {E : Type u} [Finite E] + {P : Set S} {c : E → ℝ → S} + +private noncomputable abbrev halfPath {S E : Type u} (c : E → ℝ → S) : E × Bool → 𝕀 → S := + fun i x => c i.1 (halfW i.2 x) + +private theorem half_arc_ends_are_marked + {S : Type u} + {E : Type u} + {c : E → ℝ → S} + (w0t : halfW true 0 = 0) + (w1t : halfW true 1 = 1 / 2) + (w0f : halfW false 0 = 1 / 2) + (w1f : halfW false 1 = 1) + (A : E × Bool → 𝕀 → S) + (hA : A = halfPath c) + (N : Set S) + (hmemN : ∀ (e : E), c e 0 ∈ N ∧ c e 1 ∈ N ∧ c e (1 / 2) ∈ N) + (hend : ∀ (x : 𝕀), ↑x ∉ Ioo 0 1 → x = 0 ∨ x = 1) : + ∀ (i : E × Bool) (x : 𝕀), ↑x ∉ Ioo 0 1 → A i x ∈ N := by + rintro ⟨e, b⟩ x hx + rcases hend x hx with rfl | rfl <;> cases b <;> + simp only [hA, halfPath, Icc.coe_zero, Icc.coe_one, w0t, w1t, w0f, w1f] + · exact (hmemN e).2.2 + · exact (hmemN e).1 + · exact (hmemN e).2.1 + · exact (hmemN e).2.2 + +private theorem half_arc_interiors_unmarked + {S : Type u} + {E : Type u} + {P : Set S} + {c : E → ℝ → S} + (hinj : ∀ (e : E), InjOn (c e) (Ioo 0 1)) + (h0 : ∀ (e : E), c e 0 ∈ P) + (h1 : ∀ (e : E), c e 1 ∈ P) + (hoff : ∀ (e : E), ∀ u ∈ Ioo 0 1, c e u ∉ P) + (hdis : ∀ (e e' : E), e ≠ e' → ∀ u ∈ Ioo 0 1, ∀ v ∈ Ioo 0 1, c e u ≠ c e' v) + (hh : (1 / 2 : ℝ) ∈ Ioo 0 1) + (A : E × Bool → 𝕀 → S) + (hA : A = halfPath c) : + ∀ (i : E × Bool) (x : 𝕀), ↑x ∈ Ioo 0 1 → A i x ∉ (⋃ e, {c e 0, c e 1, c e (1 / 2)}) := by + let N := ⋃ e, {c e 0, c e 1, c e (1 / 2)} + rintro ⟨e, b⟩ x hx hmem + obtain ⟨h2, h3⟩ := halfW_Ioo b hx + obtain ⟨e', he⟩ := mem_iUnion.mp hmem + simp only [mem_insert_iff, mem_singleton_iff, hA, halfPath] at he + rcases he with he | he | he + · exact hoff e _ h2 (he ▸ h0 e') + · exact hoff e _ h2 (he ▸ h1 e') + · by_cases hee : e = e' + · subst hee + exact h3 (hinj e h2 hh he) + · exact hdis e e' hee _ h2 _ hh he + +private theorem half_arc_injective + {S : Type u} + {E : Type u} + {c : E → ℝ → S} + (hinj : ∀ (e : E), InjOn (c e) (Ioo 0 1)) + (N : Set S) + (hend : ∀ (x : 𝕀), ↑x ∉ Ioo 0 1 → x = 0 ∨ x = 1) + (hN1 : ∀ (i : E × Bool) (x : 𝕀), ↑x ∉ Ioo 0 1 → (halfPath c) i x ∈ N) + (hN2 : ∀ (i : E × Bool) (x : 𝕀), ↑x ∈ Ioo 0 1 → (halfPath c) i x ∉ N) + (hAends : ∀ (i : E × Bool), (halfPath c) i 0 ≠ (halfPath c) i 1) : + ∀ (i : E × Bool), Function.Injective ((halfPath c) i) := by + rintro ⟨e, b⟩ x y he + by_cases hx : (x : ℝ) ∈ Ioo (0 : ℝ) 1 <;> by_cases hy : (y : ℝ) ∈ Ioo (0 : ℝ) 1 + · exact Subtype.ext (halfW_inj hx hy (hinj e (halfW_Ioo b hx).1 (halfW_Ioo b hy).1 he)).2 + · exact absurd (he ▸ hN1 (e, b) y hy) (hN2 (e, b) x hx) + · exact absurd (he.symm ▸ hN1 (e, b) x hx) (hN2 (e, b) y hy) + · rcases hend x hx with rfl | rfl <;> rcases hend y hy with rfl | rfl + · rfl + · exact absurd he (hAends _) + · exact absurd he.symm (hAends _) + · rfl + +private theorem half_arc_intersection_identifies_index + {S : Type u} + {E : Type u} + {c : E → ℝ → S} + (hinj : ∀ (e : E), InjOn (c e) (Ioo 0 1)) + (hdis : ∀ (e e' : E), e ≠ e' → ∀ u ∈ Ioo 0 1, ∀ v ∈ Ioo 0 1, c e u ≠ c e' v) : + ∀ (i j : E × Bool) (x y : 𝕀), halfPath c i x = halfPath c j y → + ↑x ∈ Ioo 0 1 → ↑y ∈ Ioo 0 1 → i = j := by + rintro ⟨e, b⟩ ⟨e', b'⟩ x y he hx hy + obtain rfl : e = e' := by + by_contra hee + exact hdis e e' hee _ (halfW_Ioo b hx).1 _ (halfW_Ioo b' hy).1 he + obtain ⟨rfl, -⟩ := halfW_inj hx hy (hinj e (halfW_Ioo b hx).1 (halfW_Ioo b' hy).1 he) + rfl + +private theorem half_arc_has_two_marked_ends + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {E : Type u} + (A : E × Bool → 𝕀 → S) + (N : Set S) + (hend : ∀ (x : 𝕀), ↑x ∉ Ioo 0 1 → x = 0 ∨ x = 1) + (hN1 : ∀ (i : E × Bool) (x : 𝕀), ↑x ∉ Ioo 0 1 → A i x ∈ N) + (hN2 : ∀ (i : E × Bool) (x : 𝕀), ↑x ∈ Ioo 0 1 → A i x ∉ N) + (hAends : ∀ (i : E × Bool), A i 0 ≠ A i 1) + (hAarc : ∀ (i : E × Bool), IsArcMap (A i)) : + ∀ L ∈ (range fun i => range (A i)), ∃ u v, u ≠ v ∧ IsLineWithEnds L u v ∧ L ∩ N = {u, v} := by + let 𝓔 := range fun i => range (A i) + rintro _ ⟨i, rfl⟩ + refine ⟨_, _, hAends i, (hAarc i).isLineWithEnds, ?_⟩ + ext y + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨⟨x, rfl⟩, hy⟩ + by_cases hx : (x : ℝ) ∈ Ioo (0 : ℝ) 1 + · exact absurd hy (hN2 i x hx) + · rcases hend x hx with rfl | rfl + · exact .inl rfl + · exact .inr rfl + · rintro (rfl | rfl) + · exact ⟨mem_range_self _, hN1 i 0 (by simp)⟩ + · exact ⟨mem_range_self _, hN1 i 1 (by simp)⟩ + +private theorem half_arcs_meet_only_at_marked_points + {S : Type u} + {E : Type u} + (A : E × Bool → 𝕀 → S) + (N : Set S) + (hN1 : ∀ (i : E × Bool) (x : 𝕀), ↑x ∉ Ioo 0 1 → A i x ∈ N) + (hnearr : ∀ (i j : E × Bool) (x y : 𝕀), A i x = A j y → ↑x ∈ Ioo 0 1 → ↑y ∈ Ioo 0 1 → i = j) : + ∀ L ∈ (range fun i => range (A i)), ∀ L' ∈ (range fun i => range (A i)), + L ≠ L' → L ∩ L' ⊆ N := by + let 𝓔 := range fun i => range (A i) + rintro _ ⟨i, rfl⟩ _ ⟨j, rfl⟩ hne y ⟨⟨x, rfl⟩, ⟨x', hx'⟩⟩ + by_contra hy + have hx : (x : ℝ) ∈ Ioo (0 : ℝ) 1 := by + by_contra h2 + exact hy (hN1 i x h2) + have hx2 : (x' : ℝ) ∈ Ioo (0 : ℝ) 1 := by + by_contra h2 + exact hy (hx' ▸ hN1 j x' h2) + exact hne (by rw [hnearr i j x x' hx'.symm hx hx2]) + +private theorem extended_arcs_meet_vertices_at_ends + {S : Type u} + [TopologicalSpace S] + {E : Type u} + (A : E × Bool → 𝕀 → S) + (N : Set S) + (hN1 : ∀ (i : E × Bool) (x : 𝕀), ↑x ∉ Ioo 0 1 → A i x ∈ N) + (hAends : ∀ (i : E × Bool), A i 0 ≠ A i 1) + (V : Set S) + (E' : Set (Set S)) + (hNV : N ⊆ V) + (hg : IsGraph V E') + (B : ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) }) → 𝕀 → S) + (hBr : ∀ (r : ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) })), range (B r) = ↑r) + (hBc : ∀ (r : ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) })), ↑r ∩ V = {B r 0, B r 1}) + (hbE : ∀ (k : E × Bool ⊕ ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) })), range + ((Sum.elim A B) k) ∈ E') : + ∀ (k : E × Bool ⊕ ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) })), ∀ y ∈ range + ((Sum.elim A B) k) ∩ V, y = (Sum.elim A B) k 0 ∨ y = (Sum.elim A B) k 1 := by + let 𝓔 := range fun i => range (A i) + let R := { L // L ∈ E' ∧ L ∉ 𝓔 } + let b := Sum.elim A B + rintro (i | r) y hy + · obtain ⟨u, v, -, -, hcap⟩ := hg.edge _ (hbE (.inl i)) + have h3 : A i 0 ∈ ({u, v} : Set S) := hcap ▸ ⟨mem_range_self _, hNV (hN1 i 0 (by simp))⟩ + have h4 : A i 1 ∈ ({u, v} : Set S) := hcap ▸ ⟨mem_range_self _, hNV (hN1 i 1 (by simp))⟩ + have h5 : y ∈ ({u, v} : Set S) := hcap ▸ hy + simp only [mem_insert_iff, mem_singleton_iff] at h3 h4 h5 + change y = A i 0 ∨ y = A i 1 + rcases h3 with h3 | h3 <;> rcases h4 with h4 | h4 <;> rcases h5 with h5 | h5 <;> + first + | exact .inl (h5.trans h3.symm) + | exact .inr (h5.trans h4.symm) + | exact absurd (h3.trans h4.symm) (hAends i) + · have h3 : y ∈ r.1 ∩ V := by + have h4 : y ∈ range (B r) ∩ V := hy + rwa [hBr r] at h4 + rw [hBc r] at h3 + exact h3 + +private theorem extended_arc_ranges_injective + {S : Type u} + {E : Type u} + (A : E × Bool → 𝕀 → S) + (hrinj : ∀ (i j : E × Bool), range (A i) = range (A j) → i = j) + (E' : Set (Set S)) + (B : ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) }) → 𝕀 → S) + (hBr : ∀ (r : ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) })), range (B r) = ↑r) : + ∀ (k k' : E × Bool ⊕ ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) })), range ((Sum.elim A + B) k) = range ((Sum.elim A B) k') → k = k' := by + let 𝓔 := range fun i => range (A i) + let R := { L // L ∈ E' ∧ L ∉ 𝓔 } + let b := Sum.elim A B + rintro (i | r) (j | r') he + · rw [hrinj i j he] + · have h2 : range (A i) = r'.1 := (show range (A i) = range (B r') from he).trans (hBr r') + exact absurd ⟨i, h2⟩ r'.2.2 + · have h2 : range (A j) = r.1 := (show range (A j) = range (B r) from he.symm).trans (hBr r) + exact absurd ⟨j, h2⟩ r.2.2 + · have h2 : r.1 = r'.1 := (hBr r).symm.trans ((show range (B r) = range (B r') from he).trans + (hBr r')) + rw [Subtype.ext h2] + +private theorem reindexed_arcs_form_line_family + {S : Type u} + [TopologicalSpace S] + {E : Type u} + (A : E × Bool → 𝕀 → S) + (hAbd : ∀ (i : E × Bool) (x : 𝕀), ↑x ∈ Ioo 0 1 → A i x ∉ bd S) + (E' : Set (Set S)) + (hU : ⋃₀ E' = bd S ∪ ⋃₀ range fun i => range (A i)) + (B : ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) }) → 𝕀 → S) + (hBr : ∀ (r : ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) })), range (B r) = ↑r) + (hbarc : ∀ (k : E × Bool ⊕ ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) })), IsArcMap + ((Sum.elim A B) k)) + (hmeet₀ : ∀ (k k' : E × Bool ⊕ ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) })) (x y : + 𝕀), (Sum.elim A B) k x = (Sum.elim A B) k' y → k = k' ∧ x = y ∨ (x = 0 ∨ x = 1) ∧ (y = 0 ∨ y + = 1)) + (hon : ∀ (r : ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) })), ∀ u ∈ Icc 0 1, extI (B r) + u ∈ bd S) + (n : ℕ) + (φ : E × Bool ⊕ ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) }) ≃ Fin n) + (hsym : ∀ (k : E × Bool ⊕ ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) })), φ.symm (φ k) + = k) + (hbext : ∀ (k : E × Bool ⊕ ({ L // L ∈ E' ∧ L ∉ (range fun i => range (A i)) })) (u : ℝ) (hu : + u ∈ Icc 0 1), extI ((Sum.elim A B) k) u = (Sum.elim A B) k ⟨u, hu⟩) + (hIoo : ∀ {u : ℝ}, u ∈ Ioo 0 1 → u ∈ Icc 0 1) : + GM19.IsLineFamily (fun j => (Sum.elim A B) (φ.symm j)) fun j => (Sum.elim (fun _ => True) fun + _ => False) (φ.symm j) := by + let 𝓔 := range fun i => range (A i) + let R := { L // L ∈ E' ∧ L ∉ 𝓔 } + let b := Sum.elim A B + refine ⟨fun j => hbarc _, fun i j u v hu hv he => ?_, fun j hj u hu => ?_, + fun j hj u hu => ?_, fun x hx => ?_⟩ + · rw [hbext _ u hu, hbext _ v hv] at he + rcases hmeet₀ _ _ _ _ he with ⟨h2, h3⟩ | ⟨h2, h3⟩ + · exact .inl ⟨φ.symm.injective h2, congrArg Subtype.val h3⟩ + · exact .inr ⟨h2.imp (congrArg Subtype.val) (congrArg Subtype.val), + h3.imp (congrArg Subtype.val) (congrArg Subtype.val)⟩ + · generalize φ.symm j = k at hj + rcases k with i | r + · change extI (A i) u ∉ bd S + rw [extI_of_mem _ (hIoo hu)] + exact hAbd i ⟨u, hIoo hu⟩ hu + · exact absurd hj (by simp) + · generalize φ.symm j = k at hj + rcases k with i | r + · exact absurd (by simp) hj + · exact hon r u hu + · have h2 : x ∈ ⋃₀ E' := by + rw [hU] + exact .inl hx + obtain ⟨L, hL, hxL⟩ := h2 + by_cases h3 : L ∈ 𝓔 + · obtain ⟨i, rfl⟩ := h3 + obtain ⟨y, rfl⟩ := hxL + exact ⟨φ (.inl i), by rw [hsym]; exact ⟨y, rfl⟩⟩ + · have hr : L ∈ E' ∧ L ∉ 𝓔 := ⟨hL, h3⟩ + refine ⟨φ (.inr ⟨L, hr⟩), ?_⟩ + rw [hsym] + change x ∈ range (B ⟨L, hr⟩) + rw [hBr] + exact hxL + +private theorem extended_arcs_meet_only_at_ends + {S : Type u} + [TopologicalSpace S] + {E : Type u} + (V : Set S) + (E' : Set (Set S)) + (hg : IsGraph V E') + (R : Type u) + (b : E × Bool ⊕ R → 𝕀 → S) + (hbarc : ∀ (k : E × Bool ⊕ R), IsArcMap (b k)) + (hbE : ∀ (k : E × Bool ⊕ R), range (b k) ∈ E') + (hbcap : ∀ (k : E × Bool ⊕ R), ∀ y ∈ range (b k) ∩ V, y = b k 0 ∨ y = b k 1) + (hbinj : ∀ (k k' : E × Bool ⊕ R), range (b k) = range (b k') → k = k') : + ∀ (k k' : E × Bool ⊕ R) (x y : 𝕀), b k x = b k' y → k = k' ∧ x = y ∨ (x = 0 ∨ x = 1) ∧ (y = 0 + ∨ y = 1) := by + intro k k' x y he + by_cases hk : k = k' + · subst hk + exact .inl ⟨rfl, (hbarc k).2 he⟩ + · have h2 : b k x ∈ V := hg.disj _ (hbE k) _ (hbE k') (fun h3 => hk + (hbinj _ _ h3)) ⟨mem_range_self _, ⟨y, he.symm⟩⟩ + have h3 : b k' y ∈ V := he ▸ h2 + refine .inr ⟨(hbcap k _ ⟨mem_range_self _, h2⟩).imp (fun h4 => (hbarc k).2 h4) (fun h4 => + (hbarc k).2 h4), + (hbcap k' _ ⟨mem_range_self _, h3⟩).imp (fun h4 => (hbarc k').2 h4) (fun h4 => + (hbarc k').2 h4)⟩ + +private theorem reindex_abstract_cut + {S : Type u} + [TopologicalSpace S] + {E : Type u} + (R : Type u) + (b : E × Bool ⊕ R → 𝕀 → S) + (hbarc : ∀ (k : E × Bool ⊕ R), IsArcMap (b k)) + (hmeet₀ : ∀ (k k' : E × Bool ⊕ R) (x y : 𝕀), b k x = b k' y → k = k' ∧ x = y ∨ (x = 0 ∨ x = 1) + ∧ (y = 0 ∨ y = 1)) + (n : ℕ) + (φ : E × Bool ⊕ R ≃ Fin n) + (hsym : ∀ (k : E × Bool ⊕ R), φ.symm (φ k) = k) + (hbext : ∀ (k : E × Bool ⊕ R) (u : ℝ) (hu : u ∈ Icc 0 1), extI (b k) u = b k ⟨u, hu⟩) + (hIoo : ∀ {u : ℝ}, u ∈ Ioo 0 1 → u ∈ Icc 0 1) + (Y : Type u) + [TopologicalSpace Y] + (ψ : Y → S) + (ξ' : Fin n → ℝ → Y) + (η' : Fin n → ℝ → Y) + (hC : GM19.AbstractCut (fun j => b (φ.symm j)) (fun j => (Sum.elim (fun _ => True) fun _ => + False) (φ.symm j)) ψ ξ' η') + : + IsNetCut (fun k => extI (b k)) (Sum.elim (fun _ => True) fun _ => False) ψ (fun k => ξ' (φ k)) + (fun k => η' (φ k)) := by + let a₀ := fun k => extI (b k) + let ξ := fun k => ξ' (φ k) + let η := fun k => η' (φ k) + refine ⟨hC.cont, hC.surj, fun k => hC.cξ _, fun k => hC.cη _, fun k u hu => ?_, + fun k u hu => ?_, fun k u hu => hC.bdξ _ u hu, fun k u hu => hC.bdη _ u hu, + fun k hk u hu => hC.ne (φ k) (by simpa [hsym] using hk) u hu, fun k hk u hu => hC.eqb (φ k) + (by simpa [hsym] using hk) u hu, fun y hy => ?_, fun y y' he => ?_, + fun k => (extI_injOn (hbarc k).2).mono Ioo_subset_Icc_self, fun k k' hne u hu v hv he + => ?_, fun k u hu => ⟨fun he => ?_, fun he => ?_⟩⟩ + · have := hC.hξ (φ k) u hu + simpa only [hsym] using this + · have := hC.hη (φ k) u hu + simpa only [hsym] using this + · obtain ⟨j, u, hu, h2⟩ := hC.cover y hy + exact ⟨φ.symm j, u, hu, by simpa only [Equiv.apply_symm_apply] using h2⟩ + · have hr := hC.fib y y' he + clear he + induction hr with + | rel p q hs => + obtain ⟨j, u, hu, rfl, rfl⟩ := hs + exact .rel _ _ ⟨φ.symm j, u, hu, by simp, by simp⟩ + | refl _ => exact .refl _ + | symm _ _ _ ih => exact .symm _ _ ih + | trans _ _ _ _ _ h1 h2 => exact .trans _ _ _ h1 h2 + · rw [hbext k u (hIoo hu), hbext k' v hv] at he + rcases hmeet₀ _ _ _ _ he with ⟨h2, -⟩ | ⟨h2, -⟩ + · exact hne h2 + · rcases h2 with h2 | h2 + · exact hu.1.ne' (congrArg Subtype.val h2) + · exact hu.2.ne (congrArg Subtype.val h2) + · have := extI_injOn (hbarc k).2 (hIoo hu) (by simp) he + exact hu.1.ne' this + · have := extI_injOn (hbarc k).2 (hIoo hu) (by simp) he + exact hu.2.ne this + +private theorem net_cut_assembled_on_extended_arcs + {S : Type u} + [TopologicalSpace S] + {E : Type u} + [Finite E] + {P : Set S} + {c : E → ℝ → S} + (hinj : ∀ (e : E), InjOn (c e) (Ioo 0 1)) + (h0 : ∀ (e : E), c e 0 ∈ P) + (h1 : ∀ (e : E), c e 1 ∈ P) + (hoff : ∀ (e : E), ∀ u ∈ Ioo 0 1, c e u ∉ P) + (hdis : ∀ (e e' : E), e ≠ e' → ∀ u ∈ Ioo 0 1, ∀ v ∈ Ioo 0 1, c e u ≠ c e' v) + (hbd : ∀ (e : E), ∀ u ∈ Ioo 0 1, c e u ∉ bd S) + (hh : (1 / 2 : ℝ) ∈ Ioo 0 1) + (w0t : halfW true 0 = 0) + (w1t : halfW true 1 = 1 / 2) + (w0f : halfW false 0 = 1 / 2) + (w1f : halfW false 1 = 1) + (N : Set S) + (hmemN : ∀ (e : E), c e 0 ∈ N ∧ c e 1 ∈ N ∧ c e (1 / 2) ∈ N) + (hmid : ∀ (e : E), c e (1 / 2) ∉ P) + (V : Set S) + (hNV : N ⊆ V) + (R : Type u) + (this : Finite R) + (B : R → 𝕀 → S) + (hBa : ∀ (r : R), IsArcMap (B r)) + (hinter : ∀ (k : E × Bool ⊕ R) (x : 𝕀), ↑x ∈ Ioo 0 1 → (Sum.elim (halfPath c) B) k x ∉ V) + (hmeet₀ : ∀ (k k' : E × Bool ⊕ R) (x y : 𝕀), (Sum.elim (halfPath c) B) k + x = (Sum.elim (halfPath c) B) k' y → k = k' ∧ x = y ∨ (x = 0 ∨ x = 1) ∧ + (y = 0 ∨ y = 1)) + (hon : ∀ (r : R), ∀ u ∈ Icc 0 1, extI (B r) u ∈ bd S) + (hIoo : ∀ {u : ℝ}, u ∈ Ioo 0 1 → u ∈ Icc 0 1) + (Y : Type u) + [TopologicalSpace Y] + (ψ : Y → S) + (hY : IsSurface Y) + (ξ : E × Bool ⊕ R → ℝ → Y) + (η : E × Bool ⊕ R → ℝ → Y) + (h₀ : IsNetCut (fun k => extI ((Sum.elim (halfPath c) B) k)) (Sum.elim + (fun _ => True) fun _ => False) ψ ξ η) : + ∃ ξ' η', IsNetCut (Sum.elim c fun r => extI (B r)) (Sum.elim (fun _ => True) fun _ => False) ψ + ξ' η' := by + let A := halfPath c + let b := Sum.elim A B + let a₀ := fun k => extI (b k) + refine exists_merged_cut h₀ hY ?_ ?_ ?_ ?_ ?_ ?_ ?_ + · intro e u hu + exact (extI_of_mem _ hu).trans (by change c e (halfW true u) = c e (u / 2); simp [halfW]) + · intro e u hu + exact (extI_of_mem _ hu).trans (by change c e (halfW false u) = c e ((1 + u) / 2); simp [halfW]) + · intro r u hu + rfl + · intro e k v hv + constructor + · intro he + rcases k with ⟨e', b'⟩ | r + · have h2 : c e' (halfW b' v) = c e (1 / 2) := by + have h3 := extI_of_mem (A (e', b')) hv + exact h3.symm.trans he + by_cases hvI : v ∈ Ioo (0 : ℝ) 1 + · obtain ⟨h3, h4⟩ := halfW_Ioo b' hvI + by_cases hee : e' = e + · subst hee + exact absurd (hinj e' h3 hh h2) h4 + · exact absurd h2 (hdis e' e hee _ h3 _ hh) + · obtain rfl | rfl : v = 0 ∨ v = 1 := by + by_contra hcon + push Not at hcon + exact hvI ⟨lt_of_le_of_ne hv.1 (Ne.symm hcon.1), lt_of_le_of_ne hv.2 hcon.2⟩ + · cases b' + · rw [w0f] at h2 + obtain rfl : e' = e := by + by_contra hee + exact hdis e' e hee _ hh _ hh h2 + exact .inr ⟨rfl, rfl⟩ + · rw [w0t] at h2 + exact absurd (h2 ▸ h0 e') (hmid e) + · cases b' + · rw [w1f] at h2 + exact absurd (h2 ▸ h1 e') (hmid e) + · rw [w1t] at h2 + obtain rfl : e' = e := by + by_contra hee + exact hdis e' e hee _ hh _ hh h2 + exact .inl ⟨rfl, rfl⟩ + · have he' : extI (B r) v = c e (1 / 2) := he + exact absurd (he' ▸ hon r v hv) (hbd e _ hh) + · rintro (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) + · exact (extI_of_mem _ hv).trans (by change c e (halfW true 1) = _; rw [w1t]; rfl) + · exact (extI_of_mem _ hv).trans (by change c e (halfW false 0) = _; rw [w0f]; rfl) + · rintro (e | r) + · exact hinj e + · exact (extI_injOn (hBa r).2).mono Ioo_subset_Icc_self + · rintro (e | r) (e' | r') hne u hu v hv he + · simp only [Sum.elim_inl] at he + have hee : e ≠ e' := fun h2 => hne (by rw [h2]) + by_cases hvI : v ∈ Ioo (0 : ℝ) 1 + · exact hdis e e' hee u hu v hvI he + · obtain rfl | rfl : v = 0 ∨ v = 1 := by + by_contra hcon + push Not at hcon + exact hvI ⟨lt_of_le_of_ne hv.1 (Ne.symm hcon.1), lt_of_le_of_ne hv.2 hcon.2⟩ + · exact hoff e u hu (he ▸ h0 e') + · exact hoff e u hu (he ▸ h1 e') + · have he' : c e u = extI (B r') v := he + exact hbd e u hu (he' ▸ hon r' v hv) + · have he' : extI (B r) u = c e' v := he + by_cases hvI : v ∈ Ioo (0 : ℝ) 1 + · exact hbd e' v hvI (he' ▸ hon r u (hIoo hu)) + · obtain rfl | rfl : v = 0 ∨ v = 1 := by + by_contra hcon + push Not at hcon + exact hvI ⟨lt_of_le_of_ne hv.1 (Ne.symm hcon.1), lt_of_le_of_ne hv.2 hcon.2⟩ + · refine hinter (.inr r) ⟨u, hIoo hu⟩ hu ?_ + have h2 : B r ⟨u, hIoo hu⟩ = c e' 0 := (extI_of_mem _ (hIoo hu)).symm.trans he' + change B r ⟨u, hIoo hu⟩ ∈ V + rw [h2] + exact hNV (hmemN e').1 + · refine hinter (.inr r) ⟨u, hIoo hu⟩ hu ?_ + have h2 : B r ⟨u, hIoo hu⟩ = c e' 1 := (extI_of_mem _ (hIoo hu)).symm.trans he' + change B r ⟨u, hIoo hu⟩ ∈ V + rw [h2] + exact hNV (hmemN e').2.1 + · have he' : b (.inr r) ⟨u, hIoo hu⟩ = b (.inr r') ⟨v, hv⟩ := + (extI_of_mem _ (hIoo hu)).symm.trans (he.trans (extI_of_mem _ hv)) + rcases hmeet₀ _ _ _ _ he' with ⟨h2, -⟩ | ⟨h2, -⟩ + · exact hne (by simpa using h2) + · rcases h2 with h2 | h2 + · exact hu.1.ne' (congrArg Subtype.val h2) + · exact hu.2.ne (congrArg Subtype.val h2) + · rintro (e | r) u hu + · refine ⟨fun he => ?_, fun he => ?_⟩ + · have he' : c e u = c e 0 := he + exact hoff e u hu (he' ▸ h0 e) + · have he' : c e u = c e 1 := he + exact hoff e u hu (he' ▸ h1 e) + · exact ⟨fun he => hu.1.ne' (extI_injOn (hBa r).2 (hIoo hu) (by simp) he), + fun he => hu.2.ne (extI_injOn (hBa r).2 (hIoo hu) (by simp) he)⟩ + +/-- **The cut along a family of paths, with the boundary pieces.** Let `c e` be paths with ends in +`P`, with insides off `P`, off the +boundary and disjoint. Then the surface can be cut along them and along finitely many paths `b r` of +its boundary, which cover the +boundary. The paths `c e` are the inner paths of the cut, and the paths `b r` are not. -/ +theorem exists_edges_cut_sum (hS : IsSurface S) (cc : ∀ e, Continuous (c e)) (hinj : ∀ e, InjOn + (c e) (Ioo 0 1)) (h0 : ∀ e, c e 0 ∈ P) (h1 : ∀ e, c e 1 ∈ P) + (hoff : ∀ e, ∀ u ∈ Ioo (0 : ℝ) 1, c e u ∉ P) (hdis : ∀ e e', e ≠ e' → ∀ u ∈ Ioo + (0 : ℝ) 1, ∀ v ∈ Ioo (0 : ℝ) 1, c e u ≠ c e' v) + (hbd : ∀ e, ∀ u ∈ Ioo (0 : ℝ) 1, c e u ∉ bd S) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (_ : T2Space Y) (R : Type u) (_ : Finite R) (b : R → ℝ + → S) (ψ : Y → S) (ξ η : E ⊕ R → ℝ → Y), + IsSurface Y ∧ IsNetCut (Sum.elim c b) (Sum.elim (fun _ => True) fun _ => False) ψ ξ η ∧ + (∀ r, ∀ u ∈ Icc (0 : ℝ) 1, b r u ∈ bd S) ∧ ∀ x ∈ bd S, ∃ k, ∃ u ∈ Icc + (0 : ℝ) 1, Sum.elim c b k u = x := by + classical + have hh : (1 / 2 : ℝ) ∈ Ioo (0 : ℝ) 1 := by norm_num + have w0t : halfW true 0 = 0 := by simp [halfW] + have w1t : halfW true 1 = 1 / 2 := by simp [halfW] + have w0f : halfW false 0 = 1 / 2 := by simp [halfW] + have w1f : halfW false 1 = 1 := by simp [halfW] + set A : E × Bool → 𝕀 → S := fun i x => c i.1 (halfW i.2 x) with hA + have hAc : ∀ i, Continuous (A i) := fun i => by + obtain ⟨e, b⟩ := i + cases b <;> simp only [hA, halfW, Bool.false_eq_true, ↓reduceIte] + · exact (cc e).comp (by fun_prop) + · exact (cc e).comp (by fun_prop) + set N : Set S := ⋃ e, {c e 0, c e 1, c e (1 / 2)} with hN + have hNfin : N.Finite := finite_iUnion fun e => by simp + have hmemN : ∀ e, c e 0 ∈ N ∧ c e 1 ∈ N ∧ c e (1 / 2) ∈ N := fun e => by + refine ⟨mem_iUnion.mpr ⟨e, by simp⟩, mem_iUnion.mpr ⟨e, by simp⟩, mem_iUnion.mpr ⟨e, by simp⟩⟩ + have hend : ∀ (x : 𝕀), (x : ℝ) ∉ Ioo (0 : ℝ) 1 → x = 0 ∨ x = 1 := fun x hx => by + by_cases h2 : (x : ℝ) = 0 + · exact .inl (Subtype.ext h2) + · right + refine Subtype.ext ?_ + by_contra h3 + exact hx ⟨lt_of_le_of_ne x.2.1 (Ne.symm h2), lt_of_le_of_ne x.2.2 h3⟩ + have hN1 : ∀ i (x : 𝕀), (x : ℝ) ∉ Ioo (0 : ℝ) 1 → A i x ∈ N := by + exact half_arc_ends_are_marked (S := S) (E := E) (c := c) w0t w1t w0f w1f A hA N hmemN hend + have hN2 : ∀ i (x : 𝕀), (x : ℝ) ∈ Ioo (0 : ℝ) 1 → A i x ∉ N := by + exact half_arc_interiors_unmarked (S := S) (E := E) (P := P) (c := c) hinj h0 h1 hoff hdis hh + A hA + have hmid : ∀ e, c e (1 / 2) ∉ P := fun e => hoff e _ hh + have hAends : ∀ i, A i 0 ≠ A i 1 := by + rintro ⟨e, b⟩ he + cases b <;> simp only [hA, Icc.coe_zero, Icc.coe_one, w0t, w1t, w0f, w1f] at he + · exact hmid e (he ▸ h1 e) + · exact hmid e (he.symm ▸ h0 e) + have hAinj : ∀ i, Function.Injective (A i) := by + exact half_arc_injective (S := S) (E := E) (c := c) hinj N hend hN1 hN2 hAends + have hAarc : ∀ i, IsArcMap (A i) := fun i => ⟨hAc i, hAinj i⟩ + have hnearr : ∀ i j (x y : 𝕀), A i x = A j y → (x : ℝ) ∈ Ioo (0 : ℝ) 1 → (y : ℝ) ∈ Ioo (0 : ℝ) 1 + → i = j := by + exact half_arc_intersection_identifies_index (S := S) (E := E) (c := c) hinj hdis + set hp : 𝕀 := ⟨1 / 2, by norm_num, by norm_num⟩ with hhp + have hrinj : ∀ i j, range (A i) = range (A j) → i = j := fun i j he => by + obtain ⟨y, hy⟩ : A i hp ∈ range (A j) := he ▸ mem_range_self _ + by_cases hy' : (y : ℝ) ∈ Ioo (0 : ℝ) 1 + · exact hnearr i j hp y hy.symm hh hy' + · exact absurd (hy ▸ hN1 j y hy') (hN2 i hp hh) + set 𝓔 : Set (Set S) := range fun i => range (A i) with h𝓔 + have hline : ∀ L ∈ 𝓔, ∃ u v, u ≠ v ∧ IsLineWithEnds L u v ∧ L ∩ N = {u, v} := by + exact half_arc_has_two_marked_ends (S := S) (E := E) A N hend hN1 hN2 hAends hAarc + have hdisj : ∀ L ∈ 𝓔, ∀ L' ∈ 𝓔, L ≠ L' → L ∩ L' ⊆ N := by + exact half_arcs_meet_only_at_marked_points (S := S) (E := E) A N hN1 hnearr + have hAbd : ∀ i (x : 𝕀), (x : ℝ) ∈ Ioo (0 : ℝ) 1 → A i x ∉ bd S := fun i x hx => hbd i.1 _ + (halfW_Ioo i.2 hx).1 + have hbd' : ∀ L ∈ 𝓔, L ∩ bd S ⊆ N := by + rintro _ ⟨i, rfl⟩ y ⟨⟨x, rfl⟩, hy⟩ + by_contra hn + refine hAbd i x ?_ hy + by_contra h2 + exact hn (hN1 i x h2) + have hNs : N ⊆ bd S ∪ ⋃₀ 𝓔 := by + intro y hy + obtain ⟨e, he⟩ := mem_iUnion.mp hy + simp only [mem_insert_iff, mem_singleton_iff] at he + refine .inr ?_ + rcases he with rfl | rfl | rfl + · refine ⟨_, ⟨(e, true), rfl⟩, 0, ?_⟩ + simp [hA, w0t] + · refine ⟨_, ⟨(e, false), rfl⟩, 1, ?_⟩ + simp [hA, w1f] + · refine ⟨_, ⟨(e, true), rfl⟩, 1, ?_⟩ + simp [hA, w1t] + obtain ⟨V, E', hNV, hg, hVE, hU, hsub⟩ := GM19.exists_graph_of_lines hS hNfin + (Set.finite_range _) hline hdisj hbd' hNs + have hHsub : bd S ⊆ ⋃₀ E' := by rw [hU]; exact subset_union_left + obtain ⟨V₂, E₂, 𝓕, hd, hV₂, hgr⟩ := GM19.exists_dissection_graph hS hg hVE hHsub + set R := {L : Set S // L ∈ E' ∧ L ∉ 𝓔} with hR + have hfinite : {L ∈ E' | L ∉ 𝓔}.Finite := hg.fine.subset fun _ hL => hL.1 + have : Finite R := hfinite.to_subtype + have hrep : ∀ r : R, ∃ a : 𝕀 → S, IsArcMap a ∧ range a = r.1 ∧ r.1 ∩ V = {a 0, a 1} := fun r => by + obtain ⟨u, v, -, hl, hcap⟩ := hg.edge r.1 r.2.1 + obtain ⟨a, ha, h2, rfl, rfl⟩ := hl.exists_arc + exact ⟨a, ha, h2, hcap⟩ + choose B hBa hBr hBc using hrep + set b : (E × Bool) ⊕ R → 𝕀 → S := Sum.elim A B with hb + have hbarc : ∀ k, IsArcMap (b k) := by + rintro (i | r) + · exact hAarc i + · exact hBa r + have hbE : ∀ k, range (b k) ∈ E' := by + rintro (i | r) + · exact hsub ⟨i, rfl⟩ + · change range (B r) ∈ E' + rw [hBr r] + exact r.2.1 + have hbcap : ∀ k, ∀ y ∈ range (b k) ∩ V, y = b k 0 ∨ y = b k 1 := by + exact extended_arcs_meet_vertices_at_ends (S := S) (E := E) A N hN1 hAends V E' hNV hg B hBr + hBc hbE + have hbinj : ∀ k k', range (b k) = range (b k') → k = k' := by + exact extended_arc_ranges_injective (S := S) (E := E) A hrinj E' B hBr + have hbV : ∀ k, b k 0 ∈ V ∧ b k 1 ∈ V := by + rintro (i | r) + · exact ⟨hNV (hN1 i 0 (by simp)), hNV (hN1 i 1 (by simp))⟩ + · have h2 := hBc r + have h3 : B r 0 ∈ r.1 ∩ V := by rw [h2]; simp + have h4 : B r 1 ∈ r.1 ∩ V := by rw [h2]; simp + exact ⟨h3.2, h4.2⟩ + have hinter : ∀ k (x : 𝕀), (x : ℝ) ∈ Ioo (0 : ℝ) 1 → b k x ∉ V := by + intro k x hx hV + rcases hbcap k _ ⟨mem_range_self _, hV⟩ with h2 | h2 + · have h3 := (hbarc k).2 h2 + rw [h3] at hx + simp at hx + · have h3 := (hbarc k).2 h2 + rw [h3] at hx + simp at hx + have hmeet₀ : ∀ k k' (x y : 𝕀), b k x = b k' y → (k = k' ∧ x = y) ∨ ((x = 0 ∨ x = 1) ∧ (y = 0 ∨ y + = 1)) := by + exact extended_arcs_meet_only_at_ends (S := S) (E := E) V E' hg R b hbarc hbE hbcap hbinj + have hon : ∀ r : R, ∀ u ∈ Icc (0 : ℝ) 1, extI (B r) u ∈ bd S := by + intro r + refine GM19.mem_of_Ioo (isClosed_bd S) (continuous_extI (hBa r).1).continuousOn fun u hu => ?_ + have hu' : u ∈ Icc (0 : ℝ) 1 := ⟨hu.1.le, hu.2.le⟩ + have h2 : B r ⟨u, hu'⟩ ∈ ⋃₀ E' := ⟨r.1, r.2.1, hBr r ▸ mem_range_self _⟩ + rw [hU] at h2 + rcases h2 with h2 | ⟨_, ⟨i, rfl⟩, ⟨x, hx⟩⟩ + · rw [extI_of_mem _ hu'] + exact h2 + · rcases hmeet₀ (.inr r) (.inl i) ⟨u, hu'⟩ x hx.symm with ⟨h3, -⟩ | ⟨h3, -⟩ + · exact absurd h3 (by simp) + · rcases h3 with h3 | h3 + · have := congrArg Subtype.val h3 + simp only [Icc.coe_zero] at this + exact absurd this hu.1.ne' + · have := congrArg Subtype.val h3 + simp only [Icc.coe_one] at this + exact absurd this hu.2.ne + obtain ⟨n, ⟨φ⟩⟩ := Finite.exists_equiv_fin ((E × Bool) ⊕ R) + set inner₀ : (E × Bool) ⊕ R → Prop := Sum.elim (fun _ => True) (fun _ => False) with hinner₀ + have hsym : ∀ k, φ.symm (φ k) = k := φ.symm_apply_apply + have hbext : ∀ k, ∀ u (hu : u ∈ Icc (0 : ℝ) 1), extI (b k) u = b k ⟨u, hu⟩ := fun k u hu + => extI_of_mem _ hu + have hIoo : ∀ {u : ℝ}, u ∈ Ioo (0 : ℝ) 1 → u ∈ Icc (0 : ℝ) 1 := fun hu => ⟨hu.1.le, hu.2.le⟩ + have hL : GM19.IsLineFamily (fun j : Fin n => b (φ.symm j)) (fun j => inner₀ (φ.symm j)) := by + exact reindexed_arcs_form_line_family (S := S) (E := E) A hAbd E' hU B hBr hbarc hmeet₀ hon n + φ hsym hbext hIoo + obtain ⟨Y, t1, t2, ψ, ξ', η', hY, hC⟩ := GM19.exists_abstractCut hS hL hd (fun j => ⟨hV₂ + (hbV _).1, hV₂ (hbV _).2⟩) + fun j => (subset_sUnion_of_mem (hbE _)).trans hgr + set a₀ : (E × Bool) ⊕ R → ℝ → S := fun k => extI (b k) with ha₀ + set ξ : (E × Bool) ⊕ R → ℝ → Y := fun k => ξ' (φ k) with hξ + set η : (E × Bool) ⊕ R → ℝ → Y := fun k => η' (φ k) with hη + have h₀ : IsNetCut a₀ (Sum.elim (fun _ => True) fun _ => False) ψ ξ η := by + exact reindex_abstract_cut (S := S) (E := E) R b hbarc hmeet₀ n φ hsym hbext hIoo Y ψ ξ' η' hC + have hex : ∃ ξ' η' : E ⊕ R → ℝ → Y, IsNetCut (Sum.elim c fun r => extI (B r)) (Sum.elim (fun _ + => True) fun _ => False) ψ ξ' η' := by + exact net_cut_assembled_on_extended_arcs (S := S) (E := E) (P := P) (c := c) hinj h0 h1 hoff + hdis hbd hh w0t w1t w0f w1f N hmemN hmid V hNV R this B hBa hinter hmeet₀ hon hIoo Y ψ hY ξ + η h₀ + obtain ⟨ξ₁, η₁, hcut⟩ := hex + refine ⟨Y, t1, t2, R, inferInstance, _, ψ, ξ₁, η₁, hY, hcut, hon, fun x hx => ?_⟩ + have h2 : x ∈ ⋃₀ E' := by + rw [hU] + exact .inl hx + obtain ⟨L, hL, hxL⟩ := h2 + by_cases h3 : L ∈ 𝓔 + · obtain ⟨⟨e, b'⟩, rfl⟩ := h3 + obtain ⟨y, rfl⟩ := hxL + exact ⟨.inl e, halfW b' y, halfW_mem b' y.2, rfl⟩ + · have hr : L ∈ E' ∧ L ∉ 𝓔 := ⟨hL, h3⟩ + have h4 : x ∈ range (B ⟨L, hr⟩) := by + rw [hBr] + exact hxL + obtain ⟨y, rfl⟩ := h4 + exact ⟨.inr ⟨L, hr⟩, y, y.2, extI_of_mem _ y.2⟩ + +/-- **The cut along a family of paths.** Let `c e` be paths with ends in `P`, with insides off `P`, +off the boundary and disjoint. Then the +surface can be cut along them and along its boundary. The paths are inner paths of the cut. -/ +theorem exists_edges_cut (hS : IsSurface S) (cc : ∀ e, Continuous (c e)) (hinj : ∀ e, InjOn (c e) + (Ioo 0 1)) (h0 : ∀ e, c e 0 ∈ P) (h1 : ∀ e, c e 1 ∈ P) + (hoff : ∀ e, ∀ u ∈ Ioo (0 : ℝ) 1, c e u ∉ P) (hdis : ∀ e e', e ≠ e' → ∀ u ∈ Ioo + (0 : ℝ) 1, ∀ v ∈ Ioo (0 : ℝ) 1, c e u ≠ c e' v) + (hbd : ∀ e, ∀ u ∈ Ioo (0 : ℝ) 1, c e u ∉ bd S) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (_ : T2Space Y) (κ : Type u) (_ : Finite κ) (a : κ → ℝ + → S) (inner : κ → Prop) (ψ : Y → S) (ξ η : κ → ℝ → Y), + IsSurface Y ∧ IsNetCut a inner ψ ξ η ∧ ∀ e, ∃ k, inner k ∧ ∀ u ∈ Ioo (0 : ℝ) 1, a k u = c e u + := by + obtain ⟨Y, t1, t2, R, _, b, ψ, ξ, η, hY, hcut, -, -⟩ := exists_edges_cut_sum hS cc hinj h0 h1 + hoff hdis hbd + exact ⟨Y, t1, t2, E ⊕ R, inferInstance, _, _, ψ, ξ, η, hY, hcut, fun e => ⟨.inl e, trivial, + fun u _ => rfl⟩⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetExistsMerge.lean b/LeanPool/GraphMinor/GM07/NetExistsMerge.lean new file mode 100644 index 0000000000..e9ea4c3f14 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetExistsMerge.lean @@ -0,0 +1,344 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.NetExistsCut + +/-! +# Joining the two halves of an edge + +We cut a surface along lines, so an edge of a drawing, which may be a loop, is first split at a +middle point into two lines. The middle +point is not a point where a seam may end. So the lifts of the two halves must be joined into two +lifts of the whole edge. At a point of +a cuff exactly two ends of arcs meet (`exists_ends`), and over the middle point there are four ends. +This pairs them up (`exists_halves_join`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +section + +variable {S : Type*} {Y : Type u} [TopologicalSpace S] [TopologicalSpace Y] {E R : Type*} [Finite + E] [Finite R] + {a₀ : (E × Bool) ⊕ R → ℝ → S} {innerR : R → Prop} {ψ : Y → S} {ξ η : (E × Bool) ⊕ R → ℝ → Y} + +/-- The four ends of the two halves of an edge over the middle point `m` pair up, each end of the +first half with an end of the second. -/ +theorem exists_halves_join (h : IsNetCut a₀ (Sum.elim (fun _ => True) innerR) ψ ξ η) + (hY : IsSurface Y) (e : E) {m : S} + (hm : ∀ k, ∀ v ∈ Icc (0 : ℝ) 1, a₀ k v = m ↔ (k = .inl (e, true) ∧ v = 1) ∨ (k = .inl + (e, false) ∧ v = 0)) : + ∃ ξ₂ η₂ : ℝ → Y, ((ξ₂ = ξ (.inl (e, false)) ∧ η₂ = η (.inl (e, false))) ∨ (ξ₂ = η (.inl + (e, false)) ∧ η₂ = ξ (.inl (e, false)))) ∧ + ξ (.inl (e, true)) 1 = ξ₂ 0 ∧ η (.inl (e, true)) 1 = η₂ 0 ∧ ξ (.inl (e, true)) 1 ≠ η (.inl + (e, true)) 1 := by + classical + have : Finite (NetArc (Sum.elim (fun _ => True) innerR : (E × Bool) ⊕ R → Prop)) := inferInstance + have hfam := h.isArcFamily + set i₁ : (E × Bool) ⊕ R := .inl (e, true) with hi₁ + set i₂ : (E × Bool) ⊕ R := .inl (e, false) with hi₂ + set p₁ := ξ i₁ 1 with hp₁ + set p₂ := η i₁ 1 with hp₂ + set p₃ := ξ i₂ 0 with hp₃ + set p₄ := η i₂ 0 with hp₄ + have h0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have h1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + set A₁ : NetArc (Sum.elim (fun _ => True) innerR : (E × Bool) ⊕ R → Prop) + := ⟨(i₁, true), .inl rfl⟩ + set A₂ : NetArc (Sum.elim (fun _ => True) innerR : (E × Bool) ⊕ R → Prop) + := ⟨(i₁, false), .inr trivial⟩ + set A₃ : NetArc (Sum.elim (fun _ => True) innerR : (E × Bool) ⊕ R → Prop) + := ⟨(i₂, true), .inl rfl⟩ + set A₄ : NetArc (Sum.elim (fun _ => True) innerR : (E × Bool) ⊕ R → Prop) + := ⟨(i₂, false), .inr trivial⟩ + set ℓ := netL ξ η (inner := (Sum.elim (fun _ => True) innerR : (E × Bool) ⊕ R → Prop)) with hℓ + have o1 : ofs true (1 : ℝ) = 1 := by simp [ofs] + have o0 : ofs false (1 : ℝ) = 0 := by simp [ofs] + have v₁ : ℓ A₁ (ofs true 1) = p₁ := by rw [o1]; rfl + have v₂ : ℓ A₂ (ofs true 1) = p₂ := by rw [o1]; rfl + have v₃ : ℓ A₃ (ofs false 1) = p₃ := by rw [o0]; rfl + have v₄ : ℓ A₄ (ofs false 1) = p₄ := by rw [o0]; rfl + have hcases : ∀ (β : NetArc (Sum.elim (fun _ => True) innerR : (E × Bool) ⊕ R → Prop)) + (s : Bool), ψ (ℓ β (ofs s 1)) = m → (β, s) = (A₁, true) ∨ (β, s) = (A₂, true) ∨ + (β, s) = (A₃, false) ∨ (β, s) = (A₄, false) := by + rintro ⟨⟨k, b⟩, hb⟩ s he + have hs : ofs s (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by cases s <;> simp [ofs] + rw [h.ψ_netL _ hs] at he + rcases (hm k _ hs).mp he with ⟨rfl, h2⟩ | ⟨rfl, h2⟩ + · obtain rfl : s = true := by + cases s + · simp [ofs] at h2 + · rfl + cases b + · exact .inr (.inl rfl) + · exact .inl rfl + · obtain rfl : s = false := by + cases s + · rfl + · simp [ofs] at h2 + cases b + · exact .inr (.inr (.inr rfl)) + · exact .inr (.inr (.inl rfl)) + have ψ₁ : ψ p₁ = m := by rw [hp₁, h.hξ _ _ h1]; exact (hm _ _ h1).mpr (.inl ⟨rfl, rfl⟩) + have ψ₂ : ψ p₂ = m := by rw [hp₂, h.hη _ _ h1]; exact (hm _ _ h1).mpr (.inl ⟨rfl, rfl⟩) + have ψ₃ : ψ p₃ = m := by rw [hp₃, h.hξ _ _ h0]; exact (hm _ _ h0).mpr (.inr ⟨rfl, rfl⟩) + have ψ₄ : ψ p₄ = m := by rw [hp₄, h.hη _ _ h0]; exact (hm _ _ h0).mpr (.inr ⟨rfl, rfl⟩) + have hA12 : A₁ ≠ A₂ := fun he => by simpa [A₁, A₂] using congrArg (fun x => x.1.2) he + have hA34 : A₃ ≠ A₄ := fun he => by simpa [A₃, A₄] using congrArg (fun x => x.1.2) he + have hpart : ∀ (A : NetArc (Sum.elim (fun _ => True) innerR : (E × Bool) ⊕ R → Prop)) + (s : Bool), ψ (ℓ A (ofs s 1)) = m → (A, s) = (A₁, true) ∨ (A, s) = (A₂, true) ∨ + (A, s) = (A₃, false) ∨ (A, s) = (A₄, false) → ((A, s) ≠ (A₁, true) ∧ p₁ = ℓ A (ofs s 1)) ∨ + ((A, s) ≠ (A₂, true) ∧ p₂ = ℓ A (ofs s 1)) ∨ + ((A, s) ≠ (A₃, false) ∧ p₃ = ℓ A (ofs s 1)) ∨ ((A, s) ≠ (A₄, false) ∧ p₄ = ℓ A (ofs s 1)) + := by + intro A s hψ _ + obtain ⟨⟨β, s', hne, he⟩, -⟩ := exists_ends hY hfam A s + have hc := hcases β s' (by rw [he]; exact hψ) + rcases hc with hc | hc | hc | hc <;> obtain ⟨rfl, rfl⟩ := Prod.mk.inj hc + · exact .inl ⟨hne.symm, by rw [← he, v₁]⟩ + · exact .inr (.inl ⟨hne.symm, by rw [← he, v₂]⟩) + · exact .inr (.inr (.inl ⟨hne.symm, by rw [← he, v₃]⟩)) + · exact .inr (.inr (.inr ⟨hne.symm, by rw [← he, v₄]⟩)) + have t12 : ¬ (p₂ = p₁ ∧ p₃ = p₁) := fun ⟨h2, h3⟩ => by + have := (exists_ends hY hfam A₁ true).2 A₂ A₃ true false (by rw [v₂, v₁, h2]) + (by rw [v₃, v₁, h3]) + simp [hA12.symm, Prod.ext_iff] at this + have t13 : ¬ (p₂ = p₁ ∧ p₄ = p₁) := fun ⟨h2, h3⟩ => by + have := (exists_ends hY hfam A₁ true).2 A₂ A₄ true false (by rw [v₂, v₁, h2]) + (by rw [v₄, v₁, h3]) + simp [hA12.symm, Prod.ext_iff] at this + have t23 : ¬ (p₃ = p₁ ∧ p₄ = p₁) := fun ⟨h2, h3⟩ => by + have := (exists_ends hY hfam A₁ true).2 A₃ A₄ false false (by rw [v₃, v₁, h2]) + (by rw [v₄, v₁, h3]) + simp [hA34, Prod.ext_iff] at this + have q₁ := hpart A₁ true (by rw [v₁]; exact ψ₁) (.inl rfl) + have q₂ := hpart A₂ true (by rw [v₂]; exact ψ₂) (.inr (.inl rfl)) + have q₃ := hpart A₃ false (by rw [v₃]; exact ψ₃) (.inr (.inr (.inl rfl))) + rw [v₁] at q₁ + rw [v₂] at q₂ + rw [v₃] at q₃ + have q₁' : p₂ = p₁ ∨ p₃ = p₁ ∨ p₄ = p₁ := by + rcases q₁ with ⟨h2, -⟩ | ⟨-, h2⟩ | ⟨-, h2⟩ | ⟨-, h2⟩ + · exact absurd rfl h2 + · exact .inl h2 + · exact .inr (.inl h2) + · exact .inr (.inr h2) + have q₂' : p₁ = p₂ ∨ p₃ = p₂ ∨ p₄ = p₂ := by + rcases q₂ with ⟨-, h2⟩ | ⟨h2, -⟩ | ⟨-, h2⟩ | ⟨-, h2⟩ + · exact .inl h2 + · exact absurd rfl h2 + · exact .inr (.inl h2) + · exact .inr (.inr h2) + have q₃' : p₁ = p₃ ∨ p₂ = p₃ ∨ p₄ = p₃ := by + rcases q₃ with ⟨-, h2⟩ | ⟨-, h2⟩ | ⟨h2, -⟩ | ⟨-, h2⟩ + · exact .inl h2 + · exact .inr (.inl h2) + · exact absurd rfl h2 + · exact .inr (.inr h2) + have hnot : p₂ ≠ p₁ := by + intro h2 + have h3 : p₃ ≠ p₁ := fun h4 => t12 ⟨h2, h4⟩ + have h4 : p₄ ≠ p₁ := fun h5 => t13 ⟨h2, h5⟩ + have h5 : p₄ = p₃ := by + rcases q₃' with h6 | h6 | h6 + · exact absurd h6.symm h3 + · exact absurd (h6.symm.trans h2) h3 + · exact h6 + have key : ∀ p q, Relation.EqvGen (fun p q ↦ ∃ k, ∃ u ∈ Icc (0 : ℝ) 1, p = ξ k u ∧ q + = η k u) p q → (p = p₁ ↔ q = p₁) := by + intro p q hr + induction hr with + | rel p q hs => + obtain ⟨k, u, hu, rfl, rfl⟩ := hs + constructor + · intro h6 + have h7 : a₀ k u = m := by rw [← h.hξ k u hu, h6, ψ₁] + rcases (hm k u hu).mp h7 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact h2 + · exact absurd h6 h3 + · intro h6 + have h7 : a₀ k u = m := by rw [← h.hη k u hu, h6, ψ₁] + rcases (hm k u hu).mp h7 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · exact absurd h6 h4 + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + exact h3 ((key _ _ (h.fib p₁ p₃ (ψ₁.trans ψ₃.symm))).mp rfl) + rcases q₁' with h2 | h2 | h2 + · exact absurd h2 hnot + · refine ⟨ξ i₂, η i₂, .inl ⟨rfl, rfl⟩, h2.symm, ?_, fun h3 => hnot h3.symm⟩ + rcases q₂' with h3 | h3 | h3 + · exact absurd h3.symm hnot + · exact absurd (h3.symm.trans h2) hnot + · exact h3.symm + · refine ⟨η i₂, ξ i₂, .inr ⟨rfl, rfl⟩, h2.symm, ?_, fun h3 => hnot h3.symm⟩ + rcases q₂' with h3 | h3 | h3 + · exact absurd h3.symm hnot + · exact h3.symm + · exact absurd (h3.symm.trans h2) hnot + +omit [TopologicalSpace S] [TopologicalSpace Y] in +theorem psi_conc2 {ψ : Y → S} {x x' : ℝ → Y} {c : ℝ → S} (h1 : ∀ u ∈ Icc (0 : ℝ) 1, ψ (x u) = c + (u / 2)) (h2 : ∀ u ∈ Icc (0 : ℝ) 1, ψ (x' u) = c ((1 + u) / 2)) + {u : ℝ} (hu : u ∈ Icc (0 : ℝ) 1) : ψ (conc2 x x' u) = c u := by + unfold conc2 + split_ifs with h + · rw [h1 _ ⟨by linarith [hu.1], by linarith⟩] + congr 1 + ring + · push Not at h + rw [h2 _ ⟨by linarith, by linarith [hu.2]⟩] + congr 1 + ring + +omit [TopologicalSpace Y] in +theorem conc2_mem {x x' : ℝ → Y} {P : Set Y} (h1 : ∀ u ∈ Icc (0 : ℝ) 1, x u ∈ P) (h2 : ∀ u ∈ Icc + (0 : ℝ) 1, x' u ∈ P) {u : ℝ} (hu : u ∈ Icc (0 : ℝ) 1) : + conc2 x x' u ∈ P := by + unfold conc2 + split_ifs with h + · exact h1 _ ⟨by linarith [hu.1], by linarith⟩ + · push Not at h + exact h2 _ ⟨by linarith, by linarith [hu.2]⟩ + +variable {a : E ⊕ R → ℝ → S} + +/-- **Joining halves.** Cuts along the two halves of each edge give a cut along the whole edges. -/ +theorem exists_merged_cut (h : IsNetCut a₀ (Sum.elim (fun _ => True) innerR) ψ ξ η) + (hY : IsSurface Y) + (a1 : ∀ e, ∀ u ∈ Icc (0 : ℝ) 1, a₀ (.inl (e, true)) u = a (.inl e) (u / 2)) + (a2 : ∀ e, ∀ u ∈ Icc (0 : ℝ) 1, a₀ (.inl (e, false)) u = a (.inl e) ((1 + u) / 2)) + (a3 : ∀ r, ∀ u ∈ Icc (0 : ℝ) 1, a₀ (.inr r) u = a (.inr r) u) + (hm : ∀ e k, ∀ v ∈ Icc (0 : ℝ) 1, a₀ k v = a (.inl e) (1 / 2) ↔ (k = .inl (e, true) ∧ v = 1) ∨ + (k = .inl (e, false) ∧ v = 0)) + (inj : ∀ k, InjOn (a k) (Ioo 0 1)) (meet : ∀ k k', k ≠ k' → ∀ u ∈ Ioo (0 : ℝ) 1, ∀ v ∈ Icc + (0 : ℝ) 1, a k u ≠ a k' v) + (self : ∀ k, ∀ u ∈ Ioo (0 : ℝ) 1, a k u ≠ a k 0 ∧ a k u ≠ a k 1) : + ∃ ξ' η' : E ⊕ R → ℝ → Y, IsNetCut a (Sum.elim (fun _ => True) innerR) ψ ξ' η' := by + have hj := fun e => exists_halves_join h hY e (hm e) + choose ξ₂ η₂ c1 c2 c3 c4 using hj + have cξ₂ : ∀ e, ContinuousOn (ξ₂ e) (Icc 0 1) := fun e => by + rcases c1 e with ⟨h1, -⟩ | ⟨h1, -⟩ <;> rw [h1] + · exact h.cξ _ + · exact h.cη _ + have cη₂ : ∀ e, ContinuousOn (η₂ e) (Icc 0 1) := fun e => by + rcases c1 e with ⟨-, h1⟩ | ⟨-, h1⟩ <;> rw [h1] + · exact h.cη _ + · exact h.cξ _ + have ψξ₂ : ∀ e, ∀ u ∈ Icc (0 : ℝ) 1, ψ (ξ₂ e u) = a (.inl e) ((1 + u) / 2) := fun e u hu => by + rw [← a2 e u hu] + rcases c1 e with ⟨h1, -⟩ | ⟨h1, -⟩ <;> rw [h1] + · exact h.hξ _ u hu + · exact h.hη _ u hu + have ψη₂ : ∀ e, ∀ u ∈ Icc (0 : ℝ) 1, ψ (η₂ e u) = a (.inl e) ((1 + u) / 2) := fun e u hu => by + rw [← a2 e u hu] + rcases c1 e with ⟨-, h1⟩ | ⟨-, h1⟩ <;> rw [h1] + · exact h.hη _ u hu + · exact h.hξ _ u hu + have bξ₂ : ∀ e, ∀ u ∈ Icc (0 : ℝ) 1, ξ₂ e u ∈ bd Y := fun e u hu => by + rcases c1 e with ⟨h1, -⟩ | ⟨h1, -⟩ <;> rw [h1] + · exact h.bdξ _ u hu + · exact h.bdη _ u hu + have bη₂ : ∀ e, ∀ u ∈ Icc (0 : ℝ) 1, η₂ e u ∈ bd Y := fun e u hu => by + rcases c1 e with ⟨-, h1⟩ | ⟨-, h1⟩ <;> rw [h1] + · exact h.bdη _ u hu + · exact h.bdξ _ u hu + have ne₂ : ∀ e, ∀ u ∈ Ioo (0 : ℝ) 1, ξ₂ e u ≠ η₂ e u := fun e u hu => by + rcases c1 e with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> rw [h1, h2] + · exact h.ne (.inl (e, false)) trivial u hu + · exact (h.ne (.inl (e, false)) trivial u hu).symm + refine ⟨Sum.elim (fun e => conc2 (ξ (.inl (e, true))) (ξ₂ e)) fun r => ξ (.inr r), + Sum.elim (fun e => conc2 (η (.inl (e, true))) (η₂ e)) fun r => η (.inr r), ⟨h.cont, h.surj, ?_, + ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, inj, meet, self⟩⟩ + · rintro (e | r) + · exact continuousOn_conc2 (h.cξ _) (cξ₂ e) (c2 e) + · exact h.cξ _ + · rintro (e | r) + · exact continuousOn_conc2 (h.cη _) (cη₂ e) (c3 e) + · exact h.cη _ + · rintro (e | r) u hu + · exact psi_conc2 (fun u hu => by rw [h.hξ _ u hu]; exact a1 e u hu) (ψξ₂ e) hu + · rw [Sum.elim_inr, h.hξ _ u hu] + exact a3 r u hu + · rintro (e | r) u hu + · exact psi_conc2 (fun u hu => by rw [h.hη _ u hu]; exact a1 e u hu) (ψη₂ e) hu + · rw [Sum.elim_inr, h.hη _ u hu] + exact a3 r u hu + · rintro (e | r) u hu + · exact conc2_mem (h.bdξ _) (bξ₂ e) hu + · exact h.bdξ _ u hu + · rintro (e | r) u hu + · exact conc2_mem (h.bdη _) (bη₂ e) hu + · exact h.bdη _ u hu + · rintro (e | r) hi u hu + · simp only [Sum.elim_inl] + unfold conc2 + rcases lt_trichotomy u (1 / 2) with hlt | rfl | hgt + · rw [ite_eq_left hlt.le, ite_eq_left hlt.le] + exact h.ne (.inl (e, true)) trivial _ ⟨by linarith [hu.1], by linarith⟩ + · rw [ite_eq_left le_rfl, ite_eq_left le_rfl] + simpa using c4 e + · rw [ite_eq_right (not_le.mpr hgt), ite_eq_right (not_le.mpr hgt)] + exact ne₂ e _ ⟨by linarith, by linarith [hu.2]⟩ + · exact h.ne (.inr r) hi u hu + · rintro (e | r) hi u hu + · exact absurd trivial hi + · exact h.eqb (.inr r) hi u hu + · intro y hy + obtain ⟨k, u, hu, he⟩ := h.cover y hy + rcases k with ⟨e, _ | _⟩ | r + · have hv : (1 + u) / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [hu.1], by linarith [hu.2]⟩ + have e1 : Sum.elim (fun e => conc2 (ξ (.inl (e, true))) (ξ₂ e)) (fun r => ξ (.inr r)) + (.inl e) ((1 + u) / 2) = ξ₂ e u := conc2_right (c2 e) hu + have e2 : Sum.elim (fun e => conc2 (η (.inl (e, true))) (η₂ e)) (fun r => η (.inr r)) + (.inl e) ((1 + u) / 2) = η₂ e u := conc2_right (c3 e) hu + refine ⟨.inl e, _, hv, ?_⟩ + rw [e1, e2] + rcases c1 e with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> rw [h1, h2] + · exact he + · exact he.symm + · have hv : u / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [hu.1], by linarith [hu.2]⟩ + refine ⟨.inl e, _, hv, ?_⟩ + simp only [Sum.elim_inl, conc2_left hu] + exact he + · exact ⟨.inr r, u, hu, he⟩ + · intro y y' he + have hr := h.fib y y' he + clear he + induction hr with + | rel p q hs => + obtain ⟨k, u, hu, rfl, rfl⟩ := hs + rcases k with ⟨e, _ | _⟩ | r + · have hv : (1 + u) / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [hu.1], by linarith [hu.2]⟩ + have e1 : Sum.elim (fun e => conc2 (ξ (.inl (e, true))) (ξ₂ e)) (fun r => ξ (.inr r)) + (.inl e) ((1 + u) / 2) = ξ₂ e u := conc2_right (c2 e) hu + have e2 : Sum.elim (fun e => conc2 (η (.inl (e, true))) (η₂ e)) (fun r => η (.inr r)) + (.inl e) ((1 + u) / 2) = η₂ e u := conc2_right (c3 e) hu + rcases c1 e with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · exact .rel _ _ ⟨.inl e, _, hv, by rw [e1, h1], by rw [e2, h2]⟩ + · exact .symm _ _ (.rel _ _ ⟨.inl e, _, hv, by rw [e1, h1], by rw [e2, h2]⟩) + · have hv : u / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [hu.1], by linarith [hu.2]⟩ + exact .rel _ _ ⟨.inl e, _, hv, by simp only [Sum.elim_inl, conc2_left hu], + by simp only [Sum.elim_inl, conc2_left hu]⟩ + · exact .rel _ _ ⟨.inr r, u, hu, rfl, rfl⟩ + | refl _ => exact .refl _ + | symm _ _ _ ih => exact .symm _ _ ih + | trans _ _ _ _ _ h1 h2 => exact .trans _ _ _ h1 h2 + +end + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetExistsWord.lean b/LeanPool/GraphMinor/GM07/NetExistsWord.lean new file mode 100644 index 0000000000..b5f9986a50 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetExistsWord.lean @@ -0,0 +1,544 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section2MinVal +public import LeanPool.GraphMinor.GM07.MinimalNet +public import LeanPool.GraphMinor.Surface.CutNull +public import LeanPool.GraphMinor.Surface.WordSurface +public import LeanPool.GraphMinor.Surface.CellFamily + +/-! +# From one word to a net + +A word in which each label is on at most two sides, and which presents a surface `S` with at least +two cuffs, is a net +for `S` (`exists_net_of_word`). The closed disc of the net is the unit disc of the plane, the pairs +of the net are the +pairs of sides with one label, and the seam is the image of the unit circle. This is the end of the +sketch on page 216 +of Graph Minors VII. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface + +universe u + +local notation "𝕀" => unitInterval + +/-- The closed unit disc of the plane, in the universe `u`. -/ +abbrev UDisc : Type u := ULift.{u} (closedBall (0 : ℂ) 1) + +/-- The point of `UDisc` at `z`, if `z` is in the disc. -/ +noncomputable def toU (z : ℂ) : UDisc.{u} := + open Classical in if h : z ∈ closedBall (0 : ℂ) 1 then ⟨⟨z, h⟩⟩ else ⟨⟨0, by simp⟩⟩ + +theorem toU_val {z : ℂ} (h : z ∈ closedBall (0 : ℂ) 1) : (toU.{u} z).down.1 = z := by + simp [toU, h] + +theorem toU_down (x : UDisc.{u}) : toU.{u} x.down.1 = x := by + have h := x.down.2 + simp only [toU, h, dite_true] + +theorem continuousOn_toU : ContinuousOn toU.{u} (closedBall (0 : ℂ) 1) := by + rw [continuousOn_iff_continuous_domRestrict] + have h : (closedBall (0 : ℂ) 1).domRestrict toU.{u} = ULift.up := by + funext x + have hx := x.2 + simp only [domRestrict_apply, toU, hx, dite_true] + rw [h] + exact continuous_uliftUp + +theorem continuous_val : Continuous fun x : UDisc.{u} => x.down.1 := + continuous_subtype_val.comp continuous_uliftDown + +/-- The homeomorphism from the closed disc of the paper to `UDisc`. -/ +noncomputable def discHomeo : ClosedUnitDisc ≃ₜ UDisc.{u} := + ((complexPlane.toHomeomorph.symm.subtype (p := fun x => x ∈ ClosedUnitDisc) + (q := fun z => z ∈ closedBall (0 : ℂ) 1) (fun x => by + simp [ClosedUnitDisc]))).trans Homeomorph.ulift.symm + +/-- The word with `n` different letters. -/ +def freeW (n : ℕ) : List Letter := (List.range n).map fun k => (k, true) + +theorem freeW_length (n : ℕ) : (freeW n).length = n := by simp [freeW] + +theorem stp_empty_of_unique {w : List Letter} (h : ∀ (p q k : ℕ) (e e' : Bool), w[p]? = some (k, e) + → w[q]? = some (k, e') → p = q) + (a b : ℕ × ℂ) : ¬ Stp (sW w) a b := by + rintro ⟨i, j, p, q, k, e, e', t, h1, h2, h3, -⟩ + obtain ⟨rfl, h1'⟩ := sW_get h1 + obtain ⟨rfl, h2'⟩ := sW_get h2 + exact h3 (by rw [h _ _ _ _ _ h1' h2']) + +theorem prel_eq_of_no_stp {W : ℕ → List Letter} (h : ∀ a b, ¬ Stp W a b) {a b : ℕ × ℂ} + (hr : PRel W a b) : a = b := by + induction hr with + | rel _ _ hs => exact absurd hs (h _ _) + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + +theorem mem_dsk_sW {w : List Letter} {a : ℕ × ℂ} (ha : a ∈ Dsk (sW w)) : a.1 = 0 ∧ a.2 ∈ closedBall + (0 : ℂ) 1 := by + obtain ⟨h1, h2⟩ := ha + refine ⟨?_, by simpa using h2⟩ + by_contra h + exact h1 (by simp [sW, h, nW]) + +theorem dsk_sW_mk {w : List Letter} (hw : w ≠ []) {z : ℂ} (hz : z ∈ closedBall (0 : ℂ) 1) : + ((0 : ℕ), z) ∈ Dsk (sW w) := + ⟨by simpa [sW_zero] using hw, by simpa using hz⟩ + +theorem presents_freeW {n : ℕ} (hn : 0 < n) : Presents (sW (freeW n)) (fun a => toU.{u} a.2) := by + have hne : freeW n ≠ [] := by + intro h + have := freeW_length n + simp [h] at this + omega + refine ⟨continuousOn_toU.comp continuous_snd.continuousOn fun a ha => (mem_dsk_sW ha).2, ?_, + fun a ha b hb => ?_⟩ + · refine eq_univ_of_forall fun x => ⟨(0, x.down.1), dsk_sW_mk hne x.down.2, toU_down x⟩ + · obtain ⟨h1, h2⟩ := mem_dsk_sW ha + obtain ⟨h3, h4⟩ := mem_dsk_sW hb + constructor + · intro he + have : a.2 = b.2 := by + have h5 := congrArg (fun x : UDisc.{u} => x.down.1) he + simpa only [toU_val h2, toU_val h4] using h5 + rw [show a = b from Prod.ext (h1.trans h3.symm) this] + exact .refl _ + · intro hr + have huniq : ∀ (p q k : ℕ) (e e' : Bool), (freeW n)[p]? = some (k, e) → (freeW n)[q]? = some + (k, e') → p = q := by + intro p q k e e' h5 h6 + simp only [freeW, List.getElem?_map, Option.map_eq_some_iff] at h5 h6 + obtain ⟨x, hx, hx'⟩ := h5 + obtain ⟨y, hy, hy'⟩ := h6 + have hxp := (List.getElem?_eq_some_iff.mp hx).choose_spec + have hyq := (List.getElem?_eq_some_iff.mp hy).choose_spec + simp only [List.getElem_range] at hxp hyq + have e1 : x = k := congrArg Prod.fst hx' + have e2 : y = k := congrArg Prod.fst hy' + omega + rw [prel_eq_of_no_stp (stp_empty_of_unique huniq) hr] + +theorem isSurface_uDisc : IsSurface UDisc.{u} := + (surface_of_presents (finW_sW _) (isPaired_sW (w := freeW 2) (fun c => by + have : (freeW 2) = [(0, true), (1, true)] := rfl + rw [this] + simp only [cnt, List.countP_cons, List.countP_nil, beq_iff_eq] + split_ifs <;> omega)) (presents_freeW (by norm_num))).1 + +theorem good_freeW2 : Good (freeW 2) := fun c => by + have : (freeW 2) = [(0, true), (1, true)] := rfl + rw [this] + simp only [cnt, List.countP_cons, List.countP_nil, beq_iff_eq] + split_ifs <;> omega + +theorem unique_freeW2 (p q k : ℕ) (e e' : Bool) (h5 : (freeW 2)[p]? = some (k, e)) (h6 : + (freeW 2)[q]? = some (k, e')) : + p = q := by + have hp := (List.getElem?_eq_some_iff.mp h5).1 + have hq := (List.getElem?_eq_some_iff.mp h6).1 + rw [freeW_length] at hp hq + have : (freeW 2) = [(0, true), (1, true)] := rfl + rw [this] at h5 h6 + interval_cases p <;> interval_cases q + · rfl + · simp at h5 h6 + omega + · simp at h5 h6 + omega + · rfl + +theorem bd_uDisc : bd UDisc.{u} = {x | ‖x.down.1‖ = 1} := by + have hf := presents_freeW.{u} (n := 2) (by norm_num) + rw [(surface_of_presents (finW_sW _) (isPaired_sW good_freeW2) hf).2] + ext x + constructor + · rintro ⟨a, ⟨i, p, u, -, -, -, rfl⟩, rfl⟩ + have hz : per (sW (freeW 2) i).length (p + u) ∈ closedBall (0 : ℂ) 1 := by simp [norm_per] + change ‖(toU.{u} (per (sW (freeW 2) i).length (p + u))).down.1‖ = 1 + rw [toU_val hz, norm_per] + · intro hx + have hx' : ‖x.down.1‖ = 1 := hx + obtain ⟨p, hp, t, ht, he⟩ := exists_side_of_sphere (n := 2) (by norm_num) (fun _ => true) hx' + refine ⟨spt (sW (freeW 2)) 0 p t, ⟨0, p, t, by simpa [sW_zero, freeW_length] using hp, + fun j q k e e' h1 h2 => ?_, ht, rfl⟩, ?_⟩ + · obtain ⟨-, h1'⟩ := sW_get h1 + obtain ⟨hj, h2'⟩ := sW_get h2 + rw [unique_freeW2 _ _ _ _ _ h1' h2', hj] + · have e1 : spt (sW (freeW 2)) 0 p t = (0, x.down.1) := by + rw [← he] + simp [spt, sW_zero, freeW_length, sdPt] + rw [e1] + exact toU_down x + +theorem sdPt_inj {n p : ℕ} (hn : 2 ≤ n) (hp : p < n) (ε : Bool) {s t : ℝ} (hs : s ∈ Icc (0 : ℝ) 1) + (ht : t ∈ Icc (0 : ℝ) 1) + (he : sdPt n p ε s = sdPt n p ε t) : s = t := by + have hmain : ∀ {u v : ℝ}, u ∈ Icc (0 : ℝ) 1 → v ∈ Icc (0 : ℝ) 1 → per n (p + u) = per n (p + v) + → u = v := by + intro u v hu hv huv + by_cases hu' : u ∈ Ioo (0 : ℝ) 1 + · exact (side_unique hp hp hu' hv huv).2 + by_cases hv' : v ∈ Ioo (0 : ℝ) 1 + · exact (side_unique hp hp hv' hu huv.symm).2.symm + have hu2 : u = 0 ∨ u = 1 := by + by_contra hc + push Not at hc + exact hu' ⟨lt_of_le_of_ne hu.1 (Ne.symm hc.1), lt_of_le_of_ne hu.2 hc.2⟩ + have hv2 : v = 0 ∨ v = 1 := by + by_contra hc + push Not at hc + exact hv' ⟨lt_of_le_of_ne hv.1 (Ne.symm hc.1), lt_of_le_of_ne hv.2 hc.2⟩ + have hn0 : 0 < n := by omega + have key : per n (p : ℝ) ≠ per n (p + 1) := by + intro h + by_cases hp1 : p + 1 < n + · have h1 : (p : ℝ) ∈ Ico (0 : ℝ) n := ⟨Nat.cast_nonneg p, by exact_mod_cast hp⟩ + have h2 : (p : ℝ) + 1 ∈ Ico (0 : ℝ) n := ⟨by positivity, by exact_mod_cast hp1⟩ + have := per_injOn hn0 h1 h2 h + linarith + · have hp2 : (p : ℝ) + 1 = n := by + have : p + 1 = n := by omega + exact_mod_cast this + have h3 : per n (n : ℝ) = per n 0 := by simpa using per_add_self (m := n) hn0.ne' 0 + rw [hp2, h3] at h + have h1 : (p : ℝ) ∈ Ico (0 : ℝ) n := ⟨Nat.cast_nonneg p, by exact_mod_cast hp⟩ + have h2 : (0 : ℝ) ∈ Ico (0 : ℝ) n := ⟨le_rfl, by exact_mod_cast hn0⟩ + have := per_injOn hn0 h1 h2 h + have hp0 : p = 0 := by exact_mod_cast this + have : n = 1 := by + have : p + 1 = n := by omega + omega + omega + rcases hu2 with rfl | rfl <;> rcases hv2 with rfl | rfl + · rfl + · exact absurd (by simpa using huv) key + · exact absurd (by simpa using huv.symm) key + · rfl + rw [sdPt_eq, sdPt_eq] at he + have := hmain (ofs_mem hs) (ofs_mem ht) he + have h2 := congrArg (ofs ε) this + rwa [ofs_ofs, ofs_ofs] at h2 + +/-- The side at `p` as a curve in the disc. -/ +noncomputable def sideC (n p : ℕ) (ε : Bool) : Curve UDisc.{u} := + ⟨fun t => toU.{u} (sdPt n p ε t), by + refine continuousOn_univ.mp (continuousOn_toU.comp ?_ fun t _ => ?_) + · refine Continuous.continuousOn ?_ + simp only [sdPt_eq] + apply (continuous_per n).comp + cases ε <;> simp only [ofs, Bool.false_eq_true, ↓reduceIte] <;> fun_prop + · simp [sdPt, norm_per]⟩ + +theorem sideC_val (n p : ℕ) (ε : Bool) (t : 𝕀) : (sideC.{u} n p ε t).down.1 = sdPt n p ε t := + toU_val (by simp [sdPt, norm_per]) + +private theorem side_pairs_generate_surface_identifications + {w : List Letter} + (n : ℕ) + (hsl : (sW w 0).length = n) + (hP : IsPaired (sW w)) + (Ps : Set ℕ) + (hPs : Ps = {c | ∃ (p q : ℕ) (ε ε' : Bool), + p < q ∧ w[p]? = some (c, ε) ∧ w[q]? = some (c, ε')}) + (e : ↑Ps ≃ Fin (Nat.card ↑Ps)) + (x : ↑Ps → ℕ × ℕ × Bool × Bool) + (hx1 : ∀ (c : ↑Ps), (x c).1 < (x c).2.1) + (hx2 : ∀ (c : ↑Ps), w[(x c).1]? = some (↑c, (x c).2.2.1)) + (hx3 : ∀ (c : ↑Ps), w[(x c).2.1]? = some (↑c, (x c).2.2.2)) + (f : Fin (Nat.card ↑Ps) → Curve UDisc) + (h : Fin (Nat.card ↑Ps) → Curve UDisc) + (hf : ∀ i, f i = sideC n (x (e.symm i)).1 (x (e.symm i)).2.2.1) + (hh : ∀ i, h i = sideC n (x (e.symm i)).2.1 (x (e.symm i)).2.2.2) + (hsw : ∀ {p : ℕ} {l : Letter}, w[p]? = some l → (sW w 0)[p]? = some l) : + ∀ (a b : ℕ × ℂ), PRel (sW w) a b → a ∈ Dsk (sW w) → Relation.EqvGen (fun a b => ∃ i t, a = (f + i) t ∧ b = (h i) t) (toU a.2) (toU b.2) := by + intro a b hab + induction hab with + | rel a b hs => + intro _ + obtain ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ := hs + obtain ⟨rfl, h1'⟩ := sW_get h1 + obtain ⟨rfl, h2'⟩ := sW_get h2 + have hpq : p ≠ q := fun he => h3 (by rw [he]) + have hk : k ∈ Ps := by + rw [hPs] + rcases lt_or_gt_of_ne hpq with hl | hl + · exact ⟨p, q, ε, ε', hl, h1', h2'⟩ + · exact ⟨q, p, ε', ε, hl, h2', h1'⟩ + set c : Ps := ⟨k, hk⟩ with hc + have h4 := hP.third (hsw (hx2 c)) (hsw (hx3 c)) h1 (fun he => (hx1 c).ne + (congrArg Prod.snd he)) + have h5 := hP.third (hsw (hx2 c)) (hsw (hx3 c)) h2 (fun he => (hx1 c).ne + (congrArg Prod.snd he)) + have he1 : (x c).1 = p ∨ (x c).2.1 = p := by + rcases h4 with h4 | h4 + · exact .inl (congrArg Prod.snd h4).symm + · exact .inr (congrArg Prod.snd h4).symm + have he2 : (x c).1 = q ∨ (x c).2.1 = q := by + rcases h5 with h5 | h5 + · exact .inl (congrArg Prod.snd h5).symm + · exact .inr (congrArg Prod.snd h5).symm + let i' := e c + have hi' : e.symm i' = c := e.symm_apply_apply c + let t' : 𝕀 := ⟨t, ht⟩ + have hfv : f i' t' = toU (sdPt n (x c).1 (x c).2.2.1 t) := by + simp only [hf, hi'] + rfl + have hhv : h i' t' = toU (sdPt n (x c).2.1 (x c).2.2.2 t) := by + simp only [hh, hi'] + rfl + have hsgn : ∀ {r : ℕ} {s s' : Bool}, w[r]? = some (k, s) → w[r]? = some (k, s') → s = s' := by + intro r s s' h6 h7 + rw [h6] at h7 + exact congrArg Prod.snd (Option.some.inj h7) + rw [hsl] + rcases he1 with rfl | rfl + · have hq' : (x c).2.1 = q := he2.resolve_left hpq + subst hq' + have s1 := hsgn h1' (hx2 c) + have s2 := hsgn h2' (hx3 c) + subst s1 s2 + exact .rel _ _ ⟨i', t', hfv.symm, hhv.symm⟩ + · have hq' : (x c).1 = q := he2.resolve_right hpq + subst hq' + have s1 := hsgn h1' (hx3 c) + have s2 := hsgn h2' (hx2 c) + subst s1 s2 + exact .symm _ _ (.rel _ _ ⟨i', t', hfv.symm, hhv.symm⟩) + | refl a => exact fun _ => .refl _ + | symm a b hr ih => exact fun ha => .symm _ _ (ih ((prel_mem_iff hr).mpr ha)) + | trans a b c h1 h2 i1 i2 => exact fun ha => .trans _ _ _ (i1 ha) (i2 ((prel_mem_iff h1).mp ha)) + +private theorem side_path_identifications_have_same_image + {S : Type u} + (φ : UDisc → S) + (Ps : Set ℕ) + (f : Fin (Nat.card ↑Ps) → Curve UDisc) + (h : Fin (Nat.card ↑Ps) → Curve UDisc) + (hpast : ∀ (i : Fin (Nat.card ↑Ps)) (t : 𝕀), φ ((f i) t) = φ ((h i) t)) : + ∀ (a b : UDisc), Relation.EqvGen (fun a b => ∃ i t, a = (f i) t ∧ b = (h i) t) a b → + φ a = φ b := by + intro a b hab + induction hab with + | rel a b hs => + obtain ⟨i, t, rfl, rfl⟩ := hs + exact hpast i t + | refl a => rfl + | symm a b _ ih => exact ih.symm + | trans a b c _ _ i1 i2 => exact i1.trans i2 + +/-- **From one word to a net.** A word of length at least two with each label on at most two sides, +which presents a +surface with at least two cuffs, is a net for this surface. Its seam is the image of the unit +circle. -/ +theorem exists_net_of_word {S : Type u} [TopologicalSpace S] (hS : IsSurface S) (hc : 2 ≤ + (cuffs S).ncard) {w : List Letter} + (hlen : 2 ≤ w.length) (hG : Good w) {g : ℕ × ℂ → S} (hg : Presents (sW w) g) : + ∃ N : Net S, 0 < N.r ∧ N.seamU ⊆ (fun z => g (0, z)) '' sphere 0 1 := by + classical + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have hne : w ≠ [] := fun h => by simp [h] at hlen + set n := w.length with hn + have hsl : (sW w 0).length = n := by rw [sW_zero] + have hP := isPaired_sW hG + have hm : ∀ x : UDisc.{u}, ((0 : ℕ), x.down.1) ∈ Dsk (sW w) := fun x => dsk_sW_mk hne x.down.2 + let φ : UDisc.{u} → S := fun x => g (0, x.down.1) + have hφc : Continuous φ := by + refine continuousOn_univ.mp (hg.1.comp (t := Dsk (sW w)) ?_ fun x _ => hm x) + exact (continuous_const.prodMk continuous_val).continuousOn + have hφs : Function.Surjective φ := fun y => by + obtain ⟨a, ha, rfl⟩ : y ∈ g '' Dsk (sW w) := hg.2.1 ▸ mem_univ y + obtain ⟨h1, h2⟩ := mem_dsk_sW ha + refine ⟨⟨⟨a.2, h2⟩⟩, ?_⟩ + exact congrArg g (Prod.ext h1.symm rfl) + let Ps : Set ℕ := {c | ∃ (p q : ℕ) (ε ε' : Bool), p < q ∧ w[p]? = some (c, ε) ∧ w[q]? = some + (c, ε')} + have hPf : Ps.Finite := by + refine (w.map Prod.fst).toFinset.finite_toSet.subset ?_ + rintro c ⟨p, -, ε, -, -, h1, -⟩ + simp only [Finset.mem_coe, List.mem_toFinset, List.mem_map] + exact ⟨(c, ε), List.mem_of_getElem? h1, rfl⟩ + have := hPf.to_subtype + let e := Finite.equivFin Ps + have hsel : ∀ c : Ps, ∃ x : ℕ × ℕ × Bool × Bool, x.1 < x.2.1 ∧ w[x.1]? = some (c.1, x.2.2.1) + ∧ w[x.2.1]? = some (c.1, x.2.2.2) := by + rintro ⟨c, p, q, ε, ε', h1, h2, h3⟩ + exact ⟨(p, q, ε, ε'), h1, h2, h3⟩ + choose x hx1 hx2 hx3 using hsel + have hlab : ∀ {a : ℕ} {c c' : ℕ} {ε ε' : Bool}, w[a]? = some (c, ε) → w[a]? = some (c', ε') → c + = c' := by + intro a c c' ε ε' h1 h2 + rw [h1] at h2 + exact congrArg Prod.fst (Option.some.inj h2) + have hltp : ∀ c, (x c).1 < n := fun c => lt_length (W := sW w) (i := 0) + (by simpa [sW_zero] using hx2 c) |> fun h => by simpa [sW_zero] using h + have hltq : ∀ c, (x c).2.1 < n := fun c => lt_length (W := sW w) (i := 0) + (by simpa [sW_zero] using hx3 c) |> fun h => by simpa [sW_zero] using h + let f : Fin (Nat.card Ps) → Curve UDisc.{u} := fun i => sideC n (x (e.symm i)).1 (x + (e.symm i)).2.2.1 + let h : Fin (Nat.card Ps) → Curve UDisc.{u} := fun i => sideC n (x (e.symm i)).2.1 (x + (e.symm i)).2.2.2 + have hinj : ∀ {p : ℕ} (ε : Bool), p < n → Function.Injective (sideC.{u} n p ε) := by + intro p ε hp s t hst + have h1 : sdPt n p ε s = sdPt n p ε t := by + rw [← sideC_val.{u}, ← sideC_val.{u}, hst] + exact Subtype.ext (sdPt_inj hlen hp ε s.2 t.2 h1) + have hbd : ∀ (p : ℕ) (ε : Bool) (t : 𝕀), sideC.{u} n p ε t ∈ bd UDisc.{u} := by + intro p ε t + rw [bd_uDisc] + change ‖(sideC.{u} n p ε t).down.1‖ = 1 + rw [sideC_val, sdPt_eq, norm_per] + have hdis : ∀ {p p' : ℕ} (ε ε' : Bool), p < n → p' < n → ∀ t ∈ Ioo (0 : 𝕀) 1, sideC.{u} n p ε t ∈ + range (sideC.{u} n p' ε') → p = p' := by + rintro p p' ε ε' hp hp' t ⟨h0, h1⟩ ⟨t', ht'⟩ + have h2 : sdPt n p' ε' t' = sdPt n p ε t := by + rw [← sideC_val.{u}, ← sideC_val.{u}, ht'] + rw [sdPt_eq, sdPt_eq] at h2 + have ht : (t : ℝ) ∈ Ioo (0 : ℝ) 1 := ⟨h0, h1⟩ + exact (side_unique hp hp' (ofs_Ioo ε ht) (ofs_mem t'.2) h2.symm).1 + have hsw : ∀ {p : ℕ} {l : Letter}, w[p]? = some l → (sW w 0)[p]? = some l := fun {p l} hp + => by rwa [sW_zero] + have hstep : ∀ (c : Ps) (t : ℝ), t ∈ Icc (0 : ℝ) 1 → Stp (sW w) (0, sdPt n (x c).1 (x c).2.2.1 t) + (0, sdPt n (x c).2.1 (x c).2.2.2 t) := by + intro c t ht + refine ⟨0, 0, _, _, c.1, _, _, t, hsw (hx2 c), hsw (hx3 c), fun he => ?_, ht, by rw [hsl], + by rw [hsl]⟩ + have := congrArg Prod.snd he + exact (hx1 c).ne this + have hpast : ∀ (i : Fin (Nat.card Ps)) (t : 𝕀), φ (f i t) = φ (h i t) := by + intro i t + have h1 := (hg.2.2 _ (hm (f i t)) _ (hm (h i t))).mpr (by + change PRel (sW w) (0, (sideC.{u} n _ _ t).down.1) (0, (sideC.{u} n _ _ t).down.1) + rw [sideC_val, sideC_val] + exact .rel _ _ (hstep (e.symm i) t t.2)) + exact h1 + have hforth : ∀ a b, PRel (sW w) a b → a ∈ Dsk (sW w) → Relation.EqvGen (fun a b : UDisc.{u} => ∃ + (i : Fin (Nat.card Ps)) (t : 𝕀), a = f i t ∧ b = h i t) (toU a.2) (toU b.2) := by + exact side_pairs_generate_surface_identifications (w := w) n hsl hP Ps rfl e x hx1 hx2 hx3 f h + (fun _ => rfl) (fun _ => rfl) hsw + have hback : ∀ a b : UDisc.{u}, Relation.EqvGen (fun a b : UDisc.{u} => ∃ (i : Fin (Nat.card Ps)) + (t : 𝕀), a = f i t ∧ b = h i t) a b → φ a = φ b := by + exact side_path_identifications_have_same_image (S := S) φ Ps f h hpast + have hunit : ∀ x : UDisc.{u}, x ∉ bd UDisc.{u} → ‖x.down.1‖ < 1 := by + intro x hx + rw [bd_uDisc] at hx + exact lt_of_le_of_ne (mem_closedBall_zero_iff.mp x.down.2) hx + have hr : 0 < Nat.card Ps := by + by_contra hr0 + have hemp : IsEmpty Ps := by + have h0 : Nat.card Ps = 0 := by omega + exact (Nat.card_eq_zero.mp h0).resolve_right (not_infinite_iff_finite.mpr inferInstance) + have huniq : ∀ (p q k : ℕ) (ε ε' : Bool), w[p]? = some (k, ε) → w[q]? = some (k, ε') → p = q + := by + intro p q k ε ε' h1 h2 + by_contra hpq + rcases lt_or_gt_of_ne hpq with hl | hl + · exact hemp.false ⟨k, p, q, ε, ε', hl, h1, h2⟩ + · exact hemp.false ⟨k, q, p, ε', ε, hl, h2, h1⟩ + have hbdS : bd S = (fun z => g (0, z)) '' sphere 0 1 := by + rw [(surface_of_presents (finW_sW _) hP hg).2] + ext y + constructor + · rintro ⟨_, ⟨i, p, u, hp, -, hu, rfl⟩, rfl⟩ + have hi : i = 0 := by + by_contra hi + simp [sW, hi, nW] at hp + subst hi + exact ⟨_, by simp [norm_per], rfl⟩ + · rintro ⟨z, hz, rfl⟩ + have hn0 : 0 < n := by omega + obtain ⟨p, hp, t, ht, he⟩ := exists_side_of_sphere hn0 (fun _ => true) (z := z) + (by simpa using hz) + refine ⟨spt (sW w) 0 p t, ⟨0, p, t, by rwa [hsl], fun j q k e' e'' h1 h2 => ?_, ht, rfl⟩, + ?_⟩ + · obtain ⟨-, h1'⟩ := sW_get h1 + obtain ⟨hj, h2'⟩ := sW_get h2 + rw [huniq _ _ _ _ _ h1' h2', hj] + · have e1 : spt (sW w) 0 p t = (0, z) := by + rw [← he, spt, hsl] + simp [sdPt] + simp only [e1] + have hconn : IsPreconnected (bd S) := by + rw [hbdS] + have hcz : ContinuousOn (fun z : ℂ => g (0, z)) (sphere 0 1) := + hg.1.comp (by fun_prop) fun z hz => dsk_sW_mk hne (sphere_subset_closedBall hz) + have hsph : IsPreconnected (sphere (0 : ℂ) 1) := by + rw [← per_image (n := n) (by omega)] + exact isPreconnected_Icc.image _ (continuous_per n).continuousOn + exact hsph.image _ hcz + have hsub : (cuffs S).Subsingleton := by + rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ + exact hconn.connectedComponentIn ha |>.trans (hconn.connectedComponentIn hb).symm + rcases hsub.eq_empty_or_singleton with h0 | ⟨C, h0⟩ + · rw [h0, Set.ncard_empty] at hc + omega + · rw [h0, Set.ncard_singleton] at hc + omega + refine ⟨{ D := UDisc.{u} + isSurface_D := isSurface_uDisc + isClosedDisc_D := ⟨discHomeo.trans (Homeomorph.Set.univ _).symm⟩ + r := Nat.card Ps + f := f + g := h + φ := φ + injective_f := fun i => hinj _ (hltp _) + range_f_subset_bd := fun i => range_subset_iff.mpr (hbd _ _) + injective_g := fun i => hinj _ (hltq _) + range_g_subset_bd := fun i => range_subset_iff.mpr (hbd _ _) + internally_disjoint_ff := fun i j hij t ht hmem => by + have h1 := hdis _ _ (hltp _) (hltp _) t ht hmem + have h2 := hx2 (e.symm i) + rw [h1] at h2 + exact hij (e.symm.injective (Subtype.ext (hlab h2 (hx2 (e.symm j))))) + internally_disjoint_gg := fun i j hij t ht hmem => by + have h1 := hdis _ _ (hltq _) (hltq _) t ht hmem + have h2 := hx3 (e.symm i) + rw [h1] at h2 + exact hij (e.symm.injective (Subtype.ext (hlab h2 (hx3 (e.symm j))))) + internally_disjoint_fg := fun i j t ht hmem => by + have h1 := hdis _ _ (hltp _) (hltq _) t ht hmem + have h2 := hx2 (e.symm i) + rw [h1] at h2 + have h3 : e.symm i = e.symm j := Subtype.ext (hlab h2 (hx3 (e.symm j))) + have h4 := hx1 (e.symm i) + rw [h1, h3] at h4 + exact lt_irrefl _ h4 + internally_disjoint_gf := fun i j t ht hmem => by + have h1 := hdis _ _ (hltq _) (hltp _) t ht hmem + have h2 := hx3 (e.symm i) + rw [h1] at h2 + have h3 : e.symm i = e.symm j := Subtype.ext (hlab h2 (hx2 (e.symm j))) + have h4 := hx1 (e.symm i) + rw [h1, h3] at h4 + exact lt_irrefl _ h4 + quotientMap_φ := hφc.isClosedMap.isQuotientMap hφc hφs + pasting_eq := hpast + interior_inj := fun a ha b hab => by + have h1 := (hg.2.2 _ (hm a) _ (hm b)).mp hab + have h2 := h1.eq_of_lt (hunit a ha) + have h3 : b.down.1 = a.down.1 := congrArg Prod.snd h2 + exact (ULift.ext (Subtype.ext h3)).symm + bd_eq_iff := fun a b => ⟨fun hab => by + have h1 := hforth _ _ ((hg.2.2 _ (hm a) _ (hm b)).mp hab) (hm a) + simpa only [toU_down] using h1, hback a b⟩ }, hr, ?_⟩ + rintro _ ⟨a, ha, rfl⟩ + have ha' : ‖(a : UDisc.{u}).down.1‖ = 1 := (Set.ext_iff.mp bd_uDisc.{u} a).mp ha + exact ⟨(a : UDisc.{u}).down.1, by simpa using ha', rfl⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetRefine.lean b/LeanPool/GraphMinor/GM07/NetRefine.lean new file mode 100644 index 0000000000..a68a8c3294 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetRefine.lean @@ -0,0 +1,230 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.GM07.NetSwapArcs +import LeanPool.GraphMinor.GM07.NetRefineArcs +import LeanPool.GraphMinor.GM07.Section2MinVal + +/-! +# Subdividing a paired side of a net + +The refined seam graph in VII (2.5) and (2.6), pages 217–218, +adds the images of the cutting endpoints as vertices. On the source +disc this subdivides both members of a paired side at the same +parameter. The two smaller paired arcs generate exactly the same +identifications as the original pair. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface + +/-- Subdividing both members of a paired side leaves the associated +surjection's fibers unchanged. This justifies the paired subarc +identifications for the refined seam graph in VII (2.6), page 218. -/ +theorem Net.eqvGen_split_pair + {S : Type*} [TopologicalSpace S] (N : Net S) (i : Fin N.r) (w : unitInterval) + (x y : N.D) : N.φ x = N.φ y ↔ Relation.EqvGen + (fun a b : N.D => + (∃ (j : Fin N.r), j ≠ i ∧ ∃ t, a = N.f j t ∧ b = N.g j t) ∨ + (∃ t, a = pieceA (N.f i) 0 w.val t ∧ b = pieceA (N.g i) 0 w.val t) ∨ + (∃ t, a = pieceA (N.f i) w.val 1 t ∧ b = pieceA (N.g i) w.val 1 t)) x y := by + constructor + · intro hxy + have h := (N.bd_eq_iff x y).mp hxy + clear hxy + induction h with + | rel a b hab => + obtain ⟨j, t, rfl, rfl⟩ := hab + apply Relation.EqvGen.rel + by_cases hji : j = i + · subst j + rcases le_total t w with htw | hwt + · obtain ⟨r, hfr, hgr⟩ := exists_pieceA_common_parameter (N.f i) (N.g i) + 0 w t ⟨unitInterval.nonneg t, htw⟩ + exact Or.inr (Or.inl ⟨r, hfr.symm, hgr.symm⟩) + · obtain ⟨r, hfr, hgr⟩ := exists_pieceA_common_parameter (N.f i) (N.g i) + w 1 t ⟨hwt, unitInterval.le_one t⟩ + exact Or.inr (Or.inr ⟨r, hfr.symm, hgr.symm⟩) + · exact Or.inl ⟨j, hji, t, rfl, rfl⟩ + | refl a => exact .refl _ + | symm a b _ ih => exact .symm _ _ ih + | trans a b c _ _ ih1 ih2 => exact .trans _ _ _ ih1 ih2 + · intro h + induction h with + | rel a b hab => + rcases hab with ⟨j, _, t, rfl, rfl⟩ | ⟨t, rfl, rfl⟩ | ⟨t, rfl, rfl⟩ + · exact N.pasting_eq j t + · obtain ⟨s, _, hfs, hgs⟩ := pieceA_common_parameter (N.f i) (N.g i) 0 w + (unitInterval.nonneg w) t + exact (congrArg N.φ hfs).trans ((N.pasting_eq i s).trans (congrArg N.φ hgs).symm) + · obtain ⟨s, _, hfs, hgs⟩ := pieceA_common_parameter (N.f i) (N.g i) w 1 + (unitInterval.le_one w) t + exact (congrArg N.φ hfs).trans ((N.pasting_eq i s).trans (congrArg N.φ hgs).symm) + | refl a => rfl + | symm a b _ ih => exact ih.symm + | trans a b c _ _ ih1 ih2 => exact ih1.trans ih2 + +/-- A point above a seam vertex cannot lie in an open paired side. +This verifies the cutting endpoint condition after subdividing at +its image in the refined seam graph of VII (2.6), page 218. -/ +theorem Net.paired_interiors_ne_of_image_mem_seamV + {S : Type*} [TopologicalSpace S] (N : Net S) {x : N.D} + (hx : N.φ x ∈ N.seamV) : + ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ x ∧ N.g j r ≠ x := by + intro j r hr + constructor + · intro hfx + exact N.notMem_seamV_of_mem_Ioo j hr ((congrArg N.φ hfx).symm ▸ hx) + · intro hgx + have hfx : N.φ (N.f j r) = N.φ x := (N.pasting_eq j r).trans (congrArg N.φ hgx) + exact N.notMem_seamV_of_mem_Ioo j hr (hfx.symm ▸ hx) + +/-- Subdividing a paired side gives a genuine net with the same source +disc and associated surjection. Its first minimized quantity is +unchanged. This is the source-disc refinement corresponding to adding +a seam vertex in VII (2.6), page 218. -/ +theorem Net.exists_refine_pair + {S : Type*} [TopologicalSpace S] (N : Net S) (i : Fin N.r) + (w : unitInterval) (hw0 : 0 < w) (hw1 : w < 1) : + ∃ M : Net S, ∃ e : N.D ≃ₜ M.D, + M.r = N.r + 1 ∧ M.φ ∘ e = N.φ ∧ M.seamU = N.seamU ∧ + M.seamV = N.seamV ∪ {N.φ (N.f i w)} ∧ + (∀ G : Drawing S, M.bdVertexPreimageCard G = N.bdVertexPreimageCard G) ∧ + ∀ x : N.D, (∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ x ∧ N.g j r ≠ x) → + ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → M.f j r ≠ e x ∧ M.g j r ≠ e x := by + classical + let f := splitCurveFamily N.f i w + let g := splitCurveFamily N.g i w + have hpair : ∀ j t, N.φ (f j t) = N.φ (g j t) := by + intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · intro t + simpa only [f, g, splitCurveFamily, Fin.lastCases_last, sidePiece, ContinuousMap.coe_mk, + Function.comp_apply] using + N.pasting_eq i (Icc.convexComb w 1 t) + · by_cases hj : j = i + · subst j + simp only [f, g, splitCurveFamily, Fin.lastCases_castSucc, ite_true, sidePiece, + ContinuousMap.coe_mk, Function.comp_apply] + exact fun t => N.pasting_eq i (Icc.convexComb 0 w t) + · simpa only [f, g, splitCurveFamily, Fin.lastCases_castSucc, + ite_eq_right hj] using N.pasting_eq j + have hGen : ∀ j t, Relation.EqvGen + (fun a b : N.D => ∃ (k : Fin (N.r + 1)) (r : unitInterval), a = f k r ∧ b = g k r) + (N.f j t) (N.g j t) := by + intro j t + apply Relation.EqvGen.rel + by_cases hj : j = i + · subst j + rcases le_total t w with htw | hwt + · obtain ⟨r, hfr, hgr⟩ := exists_pieceA_common_parameter (N.f i) (N.g i) + 0 w t ⟨unitInterval.nonneg t, htw⟩ + refine ⟨i.castSucc, r, ?_, ?_⟩ + · simpa only [f, splitCurveFamily, Fin.lastCases_castSucc, ite_true, + sidePiece_eq_pieceA] using hfr.symm + · simpa only [g, splitCurveFamily, Fin.lastCases_castSucc, ite_true, + sidePiece_eq_pieceA] using hgr.symm + · obtain ⟨r, hfr, hgr⟩ := exists_pieceA_common_parameter (N.f i) (N.g i) + w 1 t ⟨hwt, unitInterval.le_one t⟩ + refine ⟨Fin.last N.r, r, ?_, ?_⟩ + · simpa only [f, splitCurveFamily, Fin.lastCases_last, sidePiece_eq_pieceA] using hfr.symm + · simpa only [g, splitCurveFamily, Fin.lastCases_last, sidePiece_eq_pieceA] using hgr.symm + · refine ⟨j.castSucc, t, ?_, ?_⟩ + · simp only [f, splitCurveFamily, Fin.lastCases_castSucc, ite_eq_right hj] + · simp only [g, splitCurveFamily, Fin.lastCases_castSucc, ite_eq_right hj] + have hEquiv : ∀ x y, N.φ x = N.φ y ↔ Relation.EqvGen + (fun a b : N.D => ∃ (k : Fin (N.r + 1)) (r : unitInterval), a = f k r ∧ b = g k r) x y := by + intro x y + constructor + · intro hxy + have h := (N.bd_eq_iff x y).mp hxy + clear hxy + induction h with + | rel a b hab => + obtain ⟨j, t, rfl, rfl⟩ := hab + exact hGen j t + | refl a => exact .refl _ + | symm a b _ ih => exact .symm _ _ ih + | trans a b c _ _ ih1 ih2 => exact .trans _ _ _ ih1 ih2 + · intro h + induction h with + | rel a b hab => + obtain ⟨j, t, rfl, rfl⟩ := hab + exact hpair j t + | refl a => rfl + | symm a b _ ih => exact ih.symm + | trans a b c _ _ ih1 ih2 => exact ih1.trans ih2 + have hfbd : ∀ j, range (f j) ⊆ bd N.D := by + intro j + obtain ⟨k, hk, _⟩ := splitCurveFamily_range_subset N.f i hw0 hw1 j + exact hk.trans (N.range_f_subset_bd k) + have hgbd : ∀ j, range (g j) ⊆ bd N.D := by + intro j + obtain ⟨k, hk, _⟩ := splitCurveFamily_range_subset N.g i hw0 hw1 j + exact hk.trans (N.range_g_subset_bd k) + let M : Net S := + { D := N.D + topD := N.topD + isSurface_D := N.isSurface_D + isClosedDisc_D := N.isClosedDisc_D + r := N.r + 1 + f := f + g := g + φ := N.φ + injective_f := splitCurveFamily_injective N.f N.injective_f i hw0 hw1 + injective_g := splitCurveFamily_injective N.g N.injective_g i hw0 hw1 + range_f_subset_bd := hfbd + range_g_subset_bd := hgbd + internally_disjoint_ff := splitCurveFamily_internally_disjoint N.f N.injective_f + N.internally_disjoint_ff i hw0 hw1 + internally_disjoint_gg := splitCurveFamily_internally_disjoint N.g N.injective_g + N.internally_disjoint_gg i hw0 hw1 + internally_disjoint_fg := splitCurveFamilies_internally_disjoint N.f N.g + N.internally_disjoint_fg i hw0 hw1 + internally_disjoint_gf := splitCurveFamilies_internally_disjoint N.g N.f + N.internally_disjoint_gf i hw0 hw1 + quotientMap_φ := N.quotientMap_φ + pasting_eq := hpair + interior_inj := N.interior_inj + bd_eq_iff := hEquiv } + refine ⟨M, Homeomorph.refl N.D, rfl, rfl, rfl, + splitCurveFamily_endpoint_images N.f i w N.φ, fun _ => rfl, ?_⟩ + intro x hx j r hr + constructor + · intro hfx + obtain ⟨j₀, _, hj₀⟩ := splitCurveFamily_range_subset N.f i hw0 hw1 j + obtain ⟨v, hv, hvj⟩ := hj₀ ⟨r, hr, rfl⟩ + exact (hx j₀ v hv).1 (hvj.trans hfx) + · intro hgx + obtain ⟨j₀, _, hj₀⟩ := splitCurveFamily_range_subset N.g i hw0 hw1 j + obtain ⟨v, hv, hvj⟩ := hj₀ ⟨r, hr, rfl⟩ + exact (hx j₀ v hv).2 (hvj.trans hgx) + +/-- Adding a seam vertex by paired subdivision preserves normality +and the boundary contact count. It adds one pair and exactly the new +vertex image, as required for the refined seam graph in VII (2.6), +page 218. -/ +theorem Net.exists_refine_pair_normal + {S : Type*} [TopologicalSpace S] (hS : IsSurface S) (N : Net S) + (i : Fin N.r) (w : unitInterval) (hw0 : 0 < w) (hw1 : w < 1) + {G : Drawing S} (hN : N.IsNormalFor G) : + ∃ M : Net S, M.IsNormalFor G ∧ M.r = N.r + 1 ∧ M.seamU = N.seamU ∧ + M.seamV = N.seamV ∪ {N.φ (N.f i w)} ∧ + M.bdVertexPreimageCard G = N.bdVertexPreimageCard G := by + obtain ⟨M, _, hr, _, hU, hV, hCount, _⟩ := N.exists_refine_pair i w hw0 hw1 + have hNorm := ((N.isNormalFor_iff hS G).mp hN).2 + have hM : M.IsNormalFor G := (M.isNormalFor_iff hS G).mpr + ⟨by rw [hr]; exact Nat.zero_lt_succ _, hU.symm ▸ hNorm⟩ + exact ⟨M, hM, hr, hU, hV, hCount G⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetRefineArcs.lean b/LeanPool/GraphMinor/GM07/NetRefineArcs.lean new file mode 100644 index 0000000000..3629572ff0 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetRefineArcs.lean @@ -0,0 +1,273 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.GM07.NetSwapArcs + +/-! +# The smaller arcs in a subdivided paired side + +Subdivide a paired side at the parameter of a new seam vertex, +as in VII (2.6), page 218. The smaller arcs inherit internal +disjointness from the old sides. The two pieces of one side +have disjoint open parts and meet only at the subdivision point. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface + +/-- The closed subarc with its increasing affine parameter, used +when subdividing the paired sides of the refined seam graph in +VII (2.6), page 218. -/ +@[expose] def sidePiece {X : Type*} [TopologicalSpace X] + (a : Curve X) (u v : unitInterval) : Curve X := + ⟨a ∘ Icc.convexComb u v, a.continuous.comp (Icc.continuous_convexComb u v)⟩ + +/-- The first point of a side piece is its first old parameter. -/ +@[simp] theorem sidePiece_zero {X : Type*} [TopologicalSpace X] + (a : Curve X) (u v : unitInterval) : sidePiece a u v 0 = a u := + congrArg a (Icc.convexComb_zero u v) + +/-- The last point of a side piece is its last old parameter. -/ +@[simp] theorem sidePiece_one {X : Type*} [TopologicalSpace X] + (a : Curve X) (u v : unitInterval) : sidePiece a u v 1 = a v := + congrArg a (Icc.convexComb_one u v) + +/-- The continuous side piece has the same parameter as `pieceA`. -/ +theorem sidePiece_eq_pieceA {X : Type*} [TopologicalSpace X] + (a : Curve X) (u v : unitInterval) : + (sidePiece a u v : unitInterval → X) = pieceA a u.val v.val := by + let ap : Path (a 0) (a 1) := { toContinuousMap := a, source' := rfl, target' := rfl } + exact (pieceA_eq_subpath ap u v).symm + +/-- Taking the whole interval leaves the curve unchanged. -/ +theorem sidePiece_zero_one {X : Type*} [TopologicalSpace X] (a : Curve X) : + sidePiece a 0 1 = a := by + ext t + exact congrArg a (Icc.convexComb_zero_one t) + +/-- A nondegenerate subarc of an injective side is injective. -/ +theorem sidePiece_injective {X : Type*} [TopologicalSpace X] + (a : Curve X) (ha : Function.Injective a) {u v : unitInterval} (huv : u < v) : + Function.Injective (sidePiece a u v) := by + rw [sidePiece_eq_pieceA] + exact (isArcMap_pieceA ⟨a.continuous, ha⟩ u.property.1 huv v.property.2).2 + +/-- The range of a subarc is contained in the range of its old side. -/ +theorem range_sidePiece_subset {X : Type*} [TopologicalSpace X] + (a : Curve X) (u v : unitInterval) : range (sidePiece a u v) ⊆ range a := by + rintro x ⟨t, rfl⟩ + exact mem_range_self (Icc.convexComb u v t) + +/-- Open subarc points are open points of the old side. -/ +theorem image_sidePiece_Ioo_subset {X : Type*} [TopologicalSpace X] + (a : Curve X) {u v : unitInterval} (huv : u < v) : + sidePiece a u v '' Ioo (0 : unitInterval) 1 ⊆ a '' Ioo (0 : unitInterval) 1 := by + rw [sidePiece_eq_pieceA, image_pieceA_Ioo_unitInterval a u v huv] + rintro x ⟨t, ht, rfl⟩ + exact ⟨t, ⟨(unitInterval.nonneg u).trans_lt ht.1, + ht.2.trans_le (unitInterval.le_one v)⟩, rfl⟩ + +/-- Smaller arcs from internally disjoint old sides remain internally +disjoint, including when an endpoint of one piece lies inside its old side. -/ +theorem sidePieces_internally_disjoint + {X : Type*} [TopologicalSpace X] (a b : Curve X) + (hab : ∀ t ∈ Ioo (0 : unitInterval) 1, a t ∉ range b) + {u v : unitInterval} (huv : u < v) (m n : unitInterval) : + ∀ t ∈ Ioo (0 : unitInterval) 1, sidePiece a u v t ∉ range (sidePiece b m n) := by + intro t ht hbt + obtain ⟨r, hr, hrt⟩ := image_sidePiece_Ioo_subset a huv ⟨t, ht, rfl⟩ + exact hab r hr (hrt.symm ▸ range_sidePiece_subset b m n hbt) + +/-- The open first piece of one side misses its entire second piece. -/ +theorem sidePiece_left_disjoint_right + {X : Type*} [TopologicalSpace X] (a : Curve X) (ha : Function.Injective a) + {w : unitInterval} (hw : 0 < w) : + ∀ t ∈ Ioo (0 : unitInterval) 1, sidePiece a 0 w t ∉ range (sidePiece a w 1) := by + intro t ht hRight + have hLeft : sidePiece a 0 w t ∈ a '' Ioo 0 w := by + rw [← image_pieceA_Ioo_unitInterval a 0 w hw, ← sidePiece_eq_pieceA] + exact ⟨t, ht, rfl⟩ + obtain ⟨r, hr, hrt⟩ := hLeft + have hRight' : sidePiece a 0 w t ∈ a '' Icc w 1 := by + rw [sidePiece_eq_pieceA, range_pieceA_unitInterval a w 1 (unitInterval.le_one w)] at hRight + exact hRight + obtain ⟨s, hs, hst⟩ := hRight' + have hsr : s = r := ha (hst.trans hrt.symm) + exact (not_le_of_gt hr.2) (hsr ▸ hs.1) + +/-- The open second piece of one side misses its entire first piece. -/ +theorem sidePiece_right_disjoint_left + {X : Type*} [TopologicalSpace X] (a : Curve X) (ha : Function.Injective a) + {w : unitInterval} (hw : w < 1) : + ∀ t ∈ Ioo (0 : unitInterval) 1, sidePiece a w 1 t ∉ range (sidePiece a 0 w) := by + intro t ht hLeft + have hRight : sidePiece a w 1 t ∈ a '' Ioo w 1 := by + rw [← image_pieceA_Ioo_unitInterval a w 1 hw, ← sidePiece_eq_pieceA] + exact ⟨t, ht, rfl⟩ + obtain ⟨r, hr, hrt⟩ := hRight + have hLeft' : sidePiece a w 1 t ∈ a '' Icc 0 w := by + rw [sidePiece_eq_pieceA, range_pieceA_unitInterval a 0 w (unitInterval.nonneg w)] at hLeft + exact hLeft + obtain ⟨s, hs, hst⟩ := hLeft' + have hsr : s = r := ha (hst.trans hrt.symm) + exact (not_le_of_gt hr.1) (hsr ▸ hs.2) + +/-- Subdivide the selected side into its first piece and an additional +last piece. All other sides keep their original index and map. This +indexes the refined paired arcs of VII (2.6), page 218. -/ +@[expose] def splitCurveFamily {X : Type*} [TopologicalSpace X] {r : ℕ} + (a : Fin r → Curve X) (i : Fin r) (w : unitInterval) : Fin (r + 1) → Curve X := + Fin.lastCases (sidePiece (a i) w 1) (fun j => if j = i then sidePiece (a i) 0 w else a j) + +/-- Every smaller side inherits its old side's range and open part. -/ +theorem splitCurveFamily_range_subset + {X : Type*} [TopologicalSpace X] {r : ℕ} (a : Fin r → Curve X) + (i : Fin r) {w : unitInterval} (hw0 : 0 < w) (hw1 : w < 1) : + ∀ j, ∃ k, range (splitCurveFamily a i w j) ⊆ range (a k) ∧ + splitCurveFamily a i w j '' Ioo (0 : unitInterval) 1 ⊆ a k '' Ioo (0 : unitInterval) 1 := by + intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · refine ⟨i, ?_⟩ + simpa only [splitCurveFamily, Fin.lastCases_last] using + And.intro (range_sidePiece_subset (a i) w 1) (image_sidePiece_Ioo_subset (a i) hw1) + · by_cases hj : j = i + · subst j + refine ⟨i, ?_⟩ + simpa only [splitCurveFamily, Fin.lastCases_castSucc, ite_true] using + And.intro (range_sidePiece_subset (a i) 0 w) (image_sidePiece_Ioo_subset (a i) hw0) + · refine ⟨j, ?_⟩ + simp only [splitCurveFamily, Fin.lastCases_castSucc, ite_eq_right hj] + exact ⟨Subset.rfl, Subset.rfl⟩ + +/-- All subdivided sides stay injective. -/ +theorem splitCurveFamily_injective + {X : Type*} [TopologicalSpace X] {r : ℕ} (a : Fin r → Curve X) + (ha : ∀ j, Function.Injective (a j)) (i : Fin r) + {w : unitInterval} (hw0 : 0 < w) (hw1 : w < 1) : + ∀ j, Function.Injective (splitCurveFamily a i w j) := by + intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · simpa only [splitCurveFamily, Fin.lastCases_last] using sidePiece_injective (a i) (ha i) hw1 + · by_cases hj : j = i + · subst j + simpa [splitCurveFamily] using + sidePiece_injective (a i) (ha i) hw0 + · simpa only [splitCurveFamily, Fin.lastCases_castSucc, ite_eq_right hj] using ha j + +/-- Subdividing two families preserves disjointness between the families. -/ +theorem splitCurveFamilies_internally_disjoint + {X : Type*} [TopologicalSpace X] {r : ℕ} (a b : Fin r → Curve X) + (hab : ∀ j k, ∀ t ∈ Ioo (0 : unitInterval) 1, a j t ∉ range (b k)) + (i : Fin r) {w : unitInterval} (hw0 : 0 < w) (hw1 : w < 1) : + ∀ j k, ∀ t ∈ Ioo (0 : unitInterval) 1, + splitCurveFamily a i w j t ∉ range (splitCurveFamily b i w k) := by + intro j k t ht hkt + obtain ⟨j₀, _, hj₀⟩ := splitCurveFamily_range_subset a i hw0 hw1 j + obtain ⟨k₀, hk₀, _⟩ := splitCurveFamily_range_subset b i hw0 hw1 k + obtain ⟨s, hs, hst⟩ := hj₀ ⟨t, ht, rfl⟩ + exact hab j₀ k₀ s hs (hst.symm ▸ hk₀ hkt) + +/-- The two pieces of the selected side remain internally disjoint +from each other and from every unselected side. -/ +theorem splitCurveFamily_internally_disjoint + {X : Type*} [TopologicalSpace X] {r : ℕ} (a : Fin r → Curve X) + (ha : ∀ j, Function.Injective (a j)) + (hab : ∀ j k, j ≠ k → ∀ t ∈ Ioo (0 : unitInterval) 1, a j t ∉ range (a k)) + (i : Fin r) {w : unitInterval} (hw0 : 0 < w) (hw1 : w < 1) : + ∀ j k, j ≠ k → ∀ t ∈ Ioo (0 : unitInterval) 1, + splitCurveFamily a i w j t ∉ range (splitCurveFamily a i w k) := by + intro j + refine Fin.lastCases ?_ (fun j => ?_) j + · intro k + refine Fin.lastCases ?_ (fun k => ?_) k + · intro h; exact (h rfl).elim + · intro _ + simp only [splitCurveFamily, Fin.lastCases_last, Fin.lastCases_castSucc] + by_cases hk : k = i + · subst k + rw [ite_eq_left rfl] + exact sidePiece_right_disjoint_left _ (ha i) hw1 + · rw [ite_eq_right hk] + simpa only [sidePiece_zero_one] using + sidePieces_internally_disjoint (a i) (a k) (hab i k (fun h => hk h.symm)) hw1 0 1 + · intro k + refine Fin.lastCases ?_ (fun k => ?_) k + · intro _ + simp only [splitCurveFamily, Fin.lastCases_last, Fin.lastCases_castSucc] + by_cases hj : j = i + · subst j + rw [ite_eq_left rfl] + exact sidePiece_left_disjoint_right _ (ha i) hw0 + · rw [ite_eq_right hj] + simpa only [sidePiece_zero_one] using + sidePieces_internally_disjoint (a j) (a i) (hab j i hj) + (show (0 : unitInterval) < 1 from zero_lt_one) w 1 + · intro hjk + have hjk' : j ≠ k := fun h => hjk (congrArg Fin.castSucc h) + simp only [splitCurveFamily, Fin.lastCases_castSucc] + by_cases hj : j = i + · subst j + have hk : k ≠ i := hjk'.symm + rw [ite_eq_left rfl, ite_eq_right hk] + simpa only [sidePiece_zero_one] using + sidePieces_internally_disjoint (a i) (a k) (hab i k hjk') hw0 0 1 + · rw [ite_eq_right hj] + by_cases hk : k = i + · subst k + rw [ite_eq_left rfl] + simpa only [sidePiece_zero_one] using + sidePieces_internally_disjoint (a j) (a i) (hab j i hj) + (show (0 : unitInterval) < 1 from zero_lt_one) 0 w + · rw [ite_eq_right hk] + exact hab j k hjk' + +/-- Subdividing a family adds exactly the image of the subdivision +point to its endpoint images. This is the new vertex of the refined +seam graph in VII (2.6), page 218. -/ +theorem splitCurveFamily_endpoint_images + {X Y : Type*} [TopologicalSpace X] {r : ℕ} (a : Fin r → Curve X) + (i : Fin r) (w : unitInterval) (φ : X → Y) : + {z | ∃ j, φ (splitCurveFamily a i w j 0) = z ∨ φ (splitCurveFamily a i w j 1) = z} = + {z | ∃ j, φ (a j 0) = z ∨ φ (a j 1) = z} ∪ {φ (a i w)} := by + ext z + constructor + · rintro ⟨j, hj⟩ + revert hj + refine Fin.lastCases ?_ (fun j => ?_) j + · simp only [splitCurveFamily, Fin.lastCases_last, sidePiece_zero, sidePiece_one] + rintro (hw | h1) + · exact Or.inr hw.symm + · exact Or.inl ⟨i, Or.inr h1⟩ + · by_cases hji : j = i + · subst j + simp only [splitCurveFamily, Fin.lastCases_castSucc, ite_true, sidePiece_zero, + sidePiece_one] + rintro (h0 | hw) + · exact Or.inl ⟨i, Or.inl h0⟩ + · exact Or.inr hw.symm + · simp only [splitCurveFamily, Fin.lastCases_castSucc, ite_eq_right hji] + exact fun hj => Or.inl ⟨j, hj⟩ + · rintro (⟨j, hj⟩ | hw) + · by_cases hji : j = i + · subst j + rcases hj with h0 | h1 + · refine ⟨i.castSucc, Or.inl ?_⟩ + simpa only [splitCurveFamily, Fin.lastCases_castSucc, ite_true, sidePiece_zero] using h0 + · refine ⟨Fin.last r, Or.inr ?_⟩ + simpa only [splitCurveFamily, Fin.lastCases_last, sidePiece_one] using h1 + · refine ⟨j.castSucc, ?_⟩ + simpa only [splitCurveFamily, Fin.lastCases_castSucc, ite_eq_right hji] using hj + · refine ⟨Fin.last r, Or.inl ?_⟩ + simpa only [splitCurveFamily, Fin.lastCases_last, sidePiece_zero] using + (mem_singleton_iff.mp hw).symm + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSeparate.lean b/LeanPool/GraphMinor/GM07/NetSeparate.lean new file mode 100644 index 0000000000..c66cbfd1cc --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSeparate.lean @@ -0,0 +1,218 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.Surface.Disc +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Locating refined sides in the two cut pieces + +After subdividing at the cutting endpoint images in VII (2.6), +page 218, neither cutting endpoint lies in the open part of a +paired side. Each open side therefore misses the cutting line. +Connectedness puts it in one cut piece. Closedness puts its +endpoints in that same piece. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface + +/-- An interval map whose open part misses the overlap of two closed +covering pieces lies wholly in one piece. This locates the refined +paired sides after the cut in VII (2.6), page 218. -/ +theorem curve_range_subset_one_piece + {X : Type*} [TopologicalSpace X] (a : Curve X) {A B : Set X} + (hA : IsClosed A) (hB : IsClosed B) (hAB : A ∪ B = univ) + (hAvoid : ∀ t ∈ Ioo (0 : unitInterval) 1, a t ∉ A ∩ B) : + range a ⊆ A ∨ range a ⊆ B := by + have hConn : IsPreconnected (a '' Ioo (0 : unitInterval) 1) := + isPreconnected_Ioo.image a a.continuous.continuousOn + have hCover : a '' Ioo (0 : unitInterval) 1 ⊆ A ∪ B := + fun x _ => hAB.symm ▸ mem_univ x + have hDisj : ∀ x ∈ a '' Ioo (0 : unitInterval) 1, x ∈ A → x ∉ B := by + rintro x ⟨t, ht, rfl⟩ hxA hxB + exact hAvoid t ht ⟨hxA, hxB⟩ + have hClosure : closure (Ioo (0 : unitInterval) 1) = univ := by + rw [closure_Ioo zero_ne_one] + apply eq_univ_of_forall + exact fun t => ⟨unitInterval.nonneg t, unitInterval.le_one t⟩ + have hRange : range a ⊆ closure (a '' Ioo (0 : unitInterval) 1) := by + rintro x ⟨t, rfl⟩ + exact image_closure_subset_closure_image a.continuous + ⟨t, hClosure.symm ▸ mem_univ t, rfl⟩ + rcases GM11.subset_or_subset_of_closed hConn hA hB hCover hDisj with h | h + · exact Or.inl (hRange.trans (hA.closure_subset_iff.mpr h)) + · exact Or.inr (hRange.trans (hB.closure_subset_iff.mpr h)) + +/-- Once the cutting endpoints miss all open paired sides, every paired side +lies on one side of the cut. Their open parts miss the two cutting endpoints, +so they miss the cutting line. This is the side-location step for the +refined net in VII (2.6), page 218. -/ +theorem Net.sides_subset_one_cut_piece + {S : Type*} [TopologicalSpace S] (N : Net S) + {A B F : Set N.D} {s t : N.D} (hA : IsClosedDisc A) (hB : IsClosedDisc B) + (hAB : A ∪ B = univ) (hI : A ∩ B = F) + (hFbd : F ∩ bd N.D = {s, t}) (hs : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ s + ∧ N.g j r ≠ s) + (ht : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ t ∧ N.g j r ≠ t) : + (∀ j, range (N.f j) ⊆ A ∨ range (N.f j) ⊆ B) ∧ + (∀ j, range (N.g j) ⊆ A ∨ range (N.g j) ⊆ B) := by + let : T2Space N.D := N.isSurface_D.2.1 + constructor + · intro j + apply curve_range_subset_one_piece (N.f j) hA.isCompact.isClosed hB.isCompact.isClosed hAB + intro r hr hx + have hxF : N.f j r ∈ F := hI ▸ hx + have hxe := hFbd.subset ⟨hxF, N.range_f_subset_bd j (mem_range_self r)⟩ + rcases hxe with hxs | hxt + · exact (hs j r hr).1 hxs + · exact (ht j r hr).1 (mem_singleton_iff.mp hxt) + · intro j + apply curve_range_subset_one_piece (N.g j) hA.isCompact.isClosed hB.isCompact.isClosed hAB + intro r hr hx + have hxF : N.g j r ∈ F := hI ▸ hx + have hxe := hFbd.subset ⟨hxF, N.range_g_subset_bd j (mem_range_self r)⟩ + rcases hxe with hxs | hxt + · exact (hs j r hr).2 hxs + · exact (ht j r hr).2 (mem_singleton_iff.mp hxt) + +/-- Parameterize the cutting line. Its open part misses every old +side, and every old open side misses the whole cutting line once +the cutting endpoints miss all open paired sides. These are the intersections +needed for the inserted pair in VII (2.6), page 218. -/ +theorem Net.exists_separating_cut_curve + {S : Type*} [TopologicalSpace S] (N : Net S) + {F : Set N.D} {s t : N.D} (hF : IsLineWithEnds F s t) + (hFbd : F ∩ bd N.D = {s, t}) (hs : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ s + ∧ N.g j r ≠ s) + (ht : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ t ∧ N.g j r ≠ t) : + ∃ k : Curve N.D, Function.Injective k ∧ range k = F ∧ k 0 = s ∧ k 1 = t ∧ + (∀ r ∈ Ioo (0 : unitInterval) 1, k r ∉ bd N.D) ∧ + (∀ j, (∀ r ∈ Ioo (0 : unitInterval) 1, k r ∉ range (N.f j)) ∧ + (∀ r ∈ Ioo (0 : unitInterval) 1, N.f j r ∉ range k)) ∧ + (∀ j, (∀ r ∈ Ioo (0 : unitInterval) 1, k r ∉ range (N.g j)) ∧ + (∀ r ∈ Ioo (0 : unitInterval) 1, N.g j r ∉ range k)) := by + obtain ⟨a, ha, haF, ha0, ha1⟩ := hF.exists_arc + let k : Curve N.D := ⟨a, ha.1⟩ + have hInterior : ∀ r ∈ Ioo (0 : unitInterval) 1, k r ∉ bd N.D := by + intro r hr hbd + have he := hFbd.subset ⟨haF ▸ mem_range_self r, hbd⟩ + rcases he with hrs | hrt + · exact hr.1.ne' (ha.2 (hrs.trans ha0.symm)) + · exact hr.2.ne (ha.2 ((mem_singleton_iff.mp hrt).trans ha1.symm)) + refine ⟨k, ha.2, haF, ha0, ha1, hInterior, ?_, ?_⟩ + · intro j + constructor + · intro r hr hrf + exact hInterior r hr (N.range_f_subset_bd j hrf) + · intro r hr hrk + have hrF : N.f j r ∈ F := haF ▸ hrk + rcases hFbd.subset ⟨hrF, N.range_f_subset_bd j (mem_range_self r)⟩ with hrs | hrt + · exact (hs j r hr).1 hrs + · exact (ht j r hr).1 (mem_singleton_iff.mp hrt) + · intro j + constructor + · intro r hr hrg + exact hInterior r hr (N.range_g_subset_bd j hrg) + · intro r hr hrk + have hrF : N.g j r ∈ F := haF ▸ hrk + rcases hFbd.subset ⟨hrF, N.range_g_subset_bd j (mem_range_self r)⟩ with hrs | hrt + · exact (hs j r hr).2 hrs + · exact (ht j r hr).2 (mem_singleton_iff.mp hrt) + +/-- A side lying in one cut piece has a continuous lift to the +pasted disc, with its old parameter unchanged. -/ +theorem exists_curve_lift + {X T : Type*} [TopologicalSpace X] [TopologicalSpace T] + {A B : Set X} (α : A → T) (β : B → T) (hcα : Continuous α) (hcβ : Continuous β) + (a : Curve X) (ha : range a ⊆ A ∨ range a ⊆ B) : + ∃ p : Curve T, + (∃ h : ∀ t, a t ∈ A, ∀ t, p t = α ⟨a t, h t⟩) ∨ + (∃ h : ∀ t, a t ∈ B, ∀ t, p t = β ⟨a t, h t⟩) := by + rcases ha with haA | haB + · let h : ∀ t, a t ∈ A := fun t => haA (mem_range_self t) + exact ⟨⟨fun t => α ⟨a t, h t⟩, hcα.comp (a.continuous.subtype_mk h)⟩, + Or.inl ⟨h, fun _ => rfl⟩⟩ + · let h : ∀ t, a t ∈ B := fun t => haB (mem_range_self t) + exact ⟨⟨fun t => β ⟨a t, h t⟩, hcβ.comp (a.continuous.subtype_mk h)⟩, + Or.inr ⟨h, fun _ => rfl⟩⟩ + +/-- A lift of an injective old side into its cut piece stays injective. -/ +theorem curve_lift_injective + {X T : Type*} [TopologicalSpace X] [TopologicalSpace T] + {A B : Set X} (α : A → T) (β : B → T) + (hiα : Function.Injective α) (hiβ : Function.Injective β) + (a : Curve X) (p : Curve T) (ha : Function.Injective a) + (hp : (∃ h : ∀ t, a t ∈ A, ∀ t, p t = α ⟨a t, h t⟩) ∨ + (∃ h : ∀ t, a t ∈ B, ∀ t, p t = β ⟨a t, h t⟩)) : + Function.Injective p := by + intro s t hst + rcases hp with ⟨hA, hpA⟩ | ⟨hB, hpB⟩ + · rw [hpA s, hpA t] at hst + exact ha (congrArg Subtype.val (hiα hst)) + · rw [hpB s, hpB t] at hst + exact ha (congrArg Subtype.val (hiβ hst)) + +/-- The associated map of a lifted side agrees with the old map +at every parameter, independently of which cut piece contains it. -/ +theorem curve_lift_map + {X T S : Type*} [TopologicalSpace X] [TopologicalSpace T] + {A B : Set X} (α : A → T) (β : B → T) (φ : T → S) (φ₀ : X → S) + (hφA : ∀ x : A, φ (α x) = φ₀ x.val) (hφB : ∀ y : B, φ (β y) = φ₀ y.val) + (a : Curve X) (p : Curve T) + (hp : (∃ h : ∀ t, a t ∈ A, ∀ t, p t = α ⟨a t, h t⟩) ∨ + (∃ h : ∀ t, a t ∈ B, ∀ t, p t = β ⟨a t, h t⟩)) : + ∀ t, φ (p t) = φ₀ (a t) := by + intro t + rcases hp with ⟨hA, hpA⟩ | ⟨hB, hpB⟩ + · rw [hpA t] + exact hφA _ + · rw [hpB t] + exact hφB _ + +/-- Two old internally disjoint arcs remain internally disjoint +when lifted from their respective cut pieces. A cross-piece meeting +would lie on a pasted side, which the first arc's open part avoids. +This verifies the retained arcs in the new net of VII (2.6), page 218. -/ +theorem lifted_curves_internally_disjoint + {X T : Type*} [TopologicalSpace X] [TopologicalSpace T] + {A B : Set X} (α : A → T) (β : B → T) + (hiα : Function.Injective α) (hiβ : Function.Injective β) + (f g : unitInterval → X) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ ∃ r, x.val = f r ∧ y.val = g r) + (a b : Curve X) (p q : Curve T) + (hpa : (∃ h : ∀ t, a t ∈ A, ∀ t, p t = α ⟨a t, h t⟩) ∨ + (∃ h : ∀ t, a t ∈ B, ∀ t, p t = β ⟨a t, h t⟩)) + (hqb : (∃ h : ∀ t, b t ∈ A, ∀ t, q t = α ⟨b t, h t⟩) ∨ + (∃ h : ∀ t, b t ∈ B, ∀ t, q t = β ⟨b t, h t⟩)) + (hab : ∀ t ∈ Ioo (0 : unitInterval) 1, a t ∉ range b) + (haf : ∀ t ∈ Ioo (0 : unitInterval) 1, a t ∉ range f) + (hag : ∀ t ∈ Ioo (0 : unitInterval) 1, a t ∉ range g) : + ∀ t ∈ Ioo (0 : unitInterval) 1, p t ∉ range q := by + intro t ht + rintro ⟨s, hst⟩ + rcases hpa with ⟨haA, hpA⟩ | ⟨haB, hpB⟩ + · rcases hqb with ⟨hbA, hqA⟩ | ⟨hbB, hqB⟩ + · rw [hpA t, hqA s] at hst + exact hab t ht ⟨s, congrArg Subtype.val (hiα hst)⟩ + · rw [hpA t, hqB s] at hst + obtain ⟨r, hfr, _⟩ := (hcross ⟨a t, haA t⟩ ⟨b s, hbB s⟩).mp hst.symm + exact haf t ht ⟨r, hfr.symm⟩ + · rcases hqb with ⟨hbA, hqA⟩ | ⟨hbB, hqB⟩ + · rw [hpB t, hqA s] at hst + obtain ⟨r, _, hgr⟩ := (hcross ⟨b s, hbA s⟩ ⟨a t, haB t⟩).mp hst + exact hag t ht ⟨r, hgr.symm⟩ + · rw [hpB t, hqB s] at hst + exact hab t ht ⟨s, congrArg Subtype.val (hiβ hst)⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSeparateAssembly.lean b/LeanPool/GraphMinor/GM07/NetSeparateAssembly.lean new file mode 100644 index 0000000000..392420a0fe --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSeparateAssembly.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.NetSeparateFamily +import LeanPool.GraphMinor.GM07.NetSeparateFibers +import LeanPool.GraphMinor.GM07.NetSeparateEquivalence +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# The net of a separating-pair exchange + +For the general type-(ii) exchange in VII (2.6), page 218, +paste the selected pair across the two cut pieces and use the +two cutting-line lifts as its replacement. The side family +and fiber calculations verify every net field. The number +of pairs is unchanged, and the seam is contained in the old +seam together with the cutting-line image. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface +universe u + +/-- Package the actual separating-pair exchange as a net for the +same surface, proving every net condition from the cut maps. This +is the general new-net construction in VII (2.6), page 218. -/ +theorem Net.exists_separating_net_of_maps + {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] + (N : Net S) (hSurface : IsSurface T) + (hDisc : IsClosedDisc (univ : Set T)) (i : Fin N.r) {F A B : Set N.D} {s t : N.D} + (hF : IsLineWithEnds F s t) (hFbd : F ∩ bd N.D = {s, t}) + (hs : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ s ∧ N.g j r ≠ s) + (ht : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ t ∧ N.g j r ≠ t) + (hA : IsClosedDisc A) (hB : IsClosedDisc B) (hAB : A ∪ B = univ) (hI : A ∩ B = F) + (hAd : discBd A = (A ∩ bd N.D) ∪ F) (hBd : discBd B = (B ∩ bd N.D) ∪ F) + (hfA : range (N.f i) ⊆ discBd A) (hgB : range (N.g i) ⊆ discBd B) + (α : A → T) (β : B → T) (hcα : Continuous α) (hcβ : Continuous β) + (hiα : Function.Injective α) (hiβ : Function.Injective β) + (hT : range α ∪ range β = univ) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ ∃ r, x.val = N.f i r ∧ y.val = N.g i r) + (hαbd : ∀ x : A, α x ∈ bd T ↔ x.val ∈ discBd A ∧ + x.val ∉ N.f i '' Ioo (0 : unitInterval) 1) + (hβbd : ∀ y : B, β y ∈ bd T ↔ y.val ∈ discBd B ∧ + y.val ∉ N.g i '' Ioo (0 : unitInterval) 1) + (φ : T → S) (hφ : Topology.IsQuotientMap φ) (hφA : ∀ x : A, φ (α x) = N.φ x.val) + (hφB : ∀ y : B, φ (β y) = N.φ y.val) : + ∃ M : Net S, ∃ e : T ≃ₜ M.D, + M.r = N.r ∧ M.φ ∘ e = φ ∧ M.seamU ⊆ N.seamU ∪ N.φ '' F := by + obtain ⟨k, f, g, _, hkF, _, _, hfi, hgi, hfbd, hgbd, hff, hgg, hfg, hgf, + hpair, hkf, hkg, hotherf, hotherg⟩ := + N.exists_separating_side_family i hF hFbd hs ht hA hB hAB hI hAd hBd + α β hcα hcβ hiα hiβ hcross hαbd hβbd φ hφA hφB + have hInterior := N.separating_map_interior_inj i hFbd hs ht hI hAd hBd hfA hgB + α β hT hcross hαbd hβbd φ hφA hφB + have hEquiv := N.separating_map_eqvGen i hAB hI + (hfA.trans (discBd_subset A)) (hgB.trans (discBd_subset B)) + α β hT hcross φ hφA hφB k hkF f g hpair hkf hkg hotherf hotherg + let M : Net S := + { D := T + topD := inferInstance + isSurface_D := hSurface + isClosedDisc_D := hDisc + r := N.r + f := f + g := g + φ := φ + injective_f := hfi + range_f_subset_bd := hfbd + injective_g := hgi + range_g_subset_bd := hgbd + internally_disjoint_ff := hff + internally_disjoint_gg := hgg + internally_disjoint_fg := hfg + internally_disjoint_gf := hgf + quotientMap_φ := hφ + pasting_eq := hpair + interior_inj := hInterior + bd_eq_iff := hEquiv } + refine ⟨M, Homeomorph.refl T, rfl, rfl, ?_⟩ + rintro z ⟨w, hw, rfl⟩ + rcases hT.symm ▸ mem_univ w with ⟨x, rfl⟩ | ⟨y, rfl⟩ + · change φ (α x) ∈ N.seamU ∪ N.φ '' F + rw [hφA] + have hx := ((hαbd x).mp hw).1 + rcases hAd ▸ hx with hxOld | hxF + · exact Or.inl ⟨x.val, hxOld.2, rfl⟩ + · exact Or.inr ⟨x.val, hxF, rfl⟩ + · change φ (β y) ∈ N.seamU ∪ N.φ '' F + rw [hφB] + have hy := ((hβbd y).mp hw).1 + rcases hBd ▸ hy with hyOld | hyF + · exact Or.inl ⟨y.val, hyOld.2, rfl⟩ + · exact Or.inr ⟨y.val, hyF, rfl⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSeparateCount.lean b/LeanPool/GraphMinor/GM07/NetSeparateCount.lean new file mode 100644 index 0000000000..e4eca46b6d --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSeparateCount.lean @@ -0,0 +1,426 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.NetSwapBasic +import LeanPool.GraphMinor.GM07.NetSwapCounts +import LeanPool.GraphMinor.GM07.MinimalNet +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# The exact count of a separating exchange + +Paste the pair `f = g` across the two pieces of a cut along `F`, as in VII (2.6), page 218. The open +sides leave the boundary, which removes two preimages of each vertex on `e`. Each inner vertex of +`F` +gains two preimages. Each end of `F` splits into two boundary points, and each end of the pair is +merged. So the count is `Net.separating_contact_balance`. The printed proof leaves out the last two +effects. See the correction to the proof of (2.6) in `corrections/GM07.md`. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface + +variable {S : Type*} [TopologicalSpace S] + +/-- The map `φ` is one to one on an open second side. -/ +theorem Net.injOn_image_open_side_g (N : Net S) (i : Fin N.r) : + InjOn N.φ (N.g i '' Ioo (0 : unitInterval) 1) := by + rintro _ ⟨r, hr, rfl⟩ _ ⟨q, hq, rfl⟩ heq + have hfib := N.fiber_eq_pair_of_mem_Ioo i hr + have hmem : N.g i q ∈ N.φ ⁻¹' {N.φ (N.f i r)} := by + change N.φ (N.g i q) = N.φ (N.f i r) + rw [← heq, N.pasting_eq] + rw [hfib] at hmem + rcases hmem with h | h + · exact absurd ⟨r, h.symm⟩ (N.internally_disjoint_gf i i q hq) + · exact h.symm + +private theorem Net.separated_boundary_contacts + (N M : Net S) (i : Fin N.r) {A B F : Set N.D} {s t : N.D} + (hsbd : s ∈ bd N.D) (htbd : t ∈ bd N.D) + (hAd : discBd A = (A ∩ bd N.D) ∪ F) (hBd : discBd B = (B ∩ bd N.D) ∪ F) + (α : A → M.D) (β : B → M.D) (hT : range α ∪ range β = univ) + (hαbd : ∀ x : A, α x ∈ bd M.D ↔ x.val ∈ discBd A ∧ + x.val ∉ N.f i '' Ioo (0 : unitInterval) 1) + (hβbd : ∀ y : B, β y ∈ bd M.D ↔ y.val ∈ discBd B ∧ + y.val ∉ N.g i '' Ioo (0 : unitInterval) 1) + (hφA : ∀ x : A, M.φ (α x) = N.φ x.val) (hφB : ∀ y : B, M.φ (β y) = N.φ y.val) + (V : Set S) : + let X := bd N.D ∩ N.φ ⁻¹' V + let fO := N.f i '' Ioo (0 : unitInterval) 1 + let gO := N.g i '' Ioo (0 : unitInterval) 1 + let Y := (F \ {s, t}) ∩ N.φ ⁻¹' V + let P₀ := (A ∩ X) \ fO + let Q₀ := (B ∩ X) \ gO + let P := P₀ ∪ Y + let Q := Q₀ ∪ Y + let val₁ : A → N.D := Subtype.val + let val₂ : B → N.D := Subtype.val + (∀ x ∈ Y, x ∉ bd N.D) → + bd M.D ∩ M.φ ⁻¹' V = α '' (val₁ ⁻¹' P) ∪ β '' (val₂ ⁻¹' Q) := by + classical + intro X fO gO Y P₀ Q₀ P Q val₁ val₂ hYbd + have hfObd : ∀ x ∈ fO, x ∈ bd N.D := fun x ⟨r, _, h⟩ => h ▸ N.range_f_subset_bd i ⟨r, rfl⟩ + have hgObd : ∀ x ∈ gO, x ∈ bd N.D := fun x ⟨r, _, h⟩ => h ▸ N.range_g_subset_bd i ⟨r, rfl⟩ + ext w + constructor + · rintro ⟨hw, hwV⟩ + rcases hT.symm ▸ mem_univ w with ⟨x, rfl⟩ | ⟨y, rfl⟩ + · refine Or.inl ⟨x, ?_, rfl⟩ + obtain ⟨hx, hxf⟩ := (hαbd x).mp hw + have hxV : N.φ x.val ∈ V := hφA x ▸ hwV + rw [hAd] at hx + rcases hx with hx | hx + · exact Or.inl ⟨⟨x.2, hx.2, hxV⟩, hxf⟩ + · by_cases he : x.val ∈ ({s, t} : Set N.D) + · have hb : x.val ∈ bd N.D := by + rcases he with h | h + · exact h ▸ hsbd + · exact (mem_singleton_iff.mp h) ▸ htbd + exact Or.inl ⟨⟨x.2, hb, hxV⟩, hxf⟩ + · exact Or.inr ⟨⟨hx, he⟩, hxV⟩ + · refine Or.inr ⟨y, ?_, rfl⟩ + obtain ⟨hy, hyg⟩ := (hβbd y).mp hw + have hyV : N.φ y.val ∈ V := hφB y ▸ hwV + rw [hBd] at hy + rcases hy with hy | hy + · exact Or.inl ⟨⟨y.2, hy.2, hyV⟩, hyg⟩ + · by_cases he : y.val ∈ ({s, t} : Set N.D) + · have hb : y.val ∈ bd N.D := by + rcases he with h | h + · exact h ▸ hsbd + · exact (mem_singleton_iff.mp h) ▸ htbd + exact Or.inl ⟨⟨y.2, hb, hyV⟩, hyg⟩ + · exact Or.inr ⟨⟨hy, he⟩, hyV⟩ + · rintro (⟨x, hx, rfl⟩ | ⟨y, hy, rfl⟩) + · rcases hx with hx | hx + · refine ⟨(hαbd x).mpr ⟨hAd ▸ Or.inl ⟨x.2, hx.1.2.1⟩, hx.2⟩, ?_⟩ + change M.φ (α x) ∈ V + rw [hφA] + exact hx.1.2.2 + · refine ⟨(hαbd x).mpr ⟨hAd ▸ Or.inr hx.1.1, fun h => hYbd _ hx (hfObd _ h)⟩, ?_⟩ + change M.φ (α x) ∈ V + rw [hφA] + exact hx.2 + · rcases hy with hy | hy + · refine ⟨(hβbd y).mpr ⟨hBd ▸ Or.inl ⟨y.2, hy.1.2.1⟩, hy.2⟩, ?_⟩ + change M.φ (β y) ∈ V + rw [hφB] + exact hy.1.2.2 + · refine ⟨(hβbd y).mpr ⟨hBd ▸ Or.inr hy.1.1, fun h => hYbd _ hy (hgObd _ h)⟩, ?_⟩ + change M.φ (β y) ∈ V + rw [hφB] + exact hy.2 + +private theorem Net.separated_boundary_overlap + (N M : Net S) (i : Fin N.r) {A B F : Set N.D} {s t : N.D} + (hfA : range (N.f i) ⊆ discBd A) (hgB : range (N.g i) ⊆ discBd B) + (α : A → M.D) (β : B → M.D) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ ∃ r, x.val = N.f i r ∧ y.val = N.g i r) + (V : Set S) : + let X := bd N.D ∩ N.φ ⁻¹' V + let fO := N.f i '' Ioo (0 : unitInterval) 1 + let gO := N.g i '' Ioo (0 : unitInterval) 1 + let Y := (F \ {s, t}) ∩ N.φ ⁻¹' V + let P₀ := (A ∩ X) \ fO + let Q₀ := (B ∩ X) \ gO + let P := P₀ ∪ Y + let Q := Q₀ ∪ Y + let val₁ : A → N.D := Subtype.val + let val₂ : B → N.D := Subtype.val + (∀ x ∈ Y, x ∉ bd N.D) → + let O := ({N.f i 0, N.f i 1} : Set N.D) ∩ N.φ ⁻¹' V + α '' (val₁ ⁻¹' P) ∩ β '' (val₂ ⁻¹' Q) = α '' (val₁ ⁻¹' O) := by + classical + intro X fO gO Y P₀ Q₀ P Q val₁ val₂ hYbd O + have hsub : ∀ x ∈ discBd A, x ∈ A := fun _ hx => discBd_subset A hx + have hsubB : ∀ x ∈ discBd B, x ∈ B := fun _ hx => discBd_subset B hx + have hfinj := N.injective_f i + have hginj := N.injective_g i + have hnotO : ∀ r : unitInterval, (r = 0 ∨ r = 1) → N.f i r ∉ fO ∧ N.g i r ∉ gO := by + intro r hr + constructor + · rintro ⟨q, hq, h⟩ + obtain rfl := hfinj h + rcases hr with rfl | rfl + · exact lt_irrefl _ hq.1 + · exact lt_irrefl _ hq.2 + · rintro ⟨q, hq, h⟩ + obtain rfl := hginj h + rcases hr with rfl | rfl + · exact lt_irrefl _ hq.1 + · exact lt_irrefl _ hq.2 + have hend : ∀ r : unitInterval, (r = 0 ∨ r = 1) → N.φ (N.f i r) ∈ V → + N.f i r ∈ P₀ ∧ N.g i r ∈ Q₀ := by + intro r hr hrV + refine ⟨⟨⟨hsub _ (hfA ⟨r, rfl⟩), N.range_f_subset_bd i ⟨r, rfl⟩, hrV⟩, (hnotO r hr).1⟩, + ⟨⟨hsubB _ (hgB ⟨r, rfl⟩), N.range_g_subset_bd i ⟨r, rfl⟩, ?_⟩, (hnotO r hr).2⟩⟩ + change N.φ (N.g i r) ∈ V + rw [← N.pasting_eq] + exact hrV + ext w + constructor + · rintro ⟨⟨x, hx, rfl⟩, ⟨y, hy, hxy⟩⟩ + obtain ⟨r, hr₁, hr₂⟩ := (hcross x y).mp hxy.symm + refine ⟨x, ?_, rfl⟩ + have hxV : N.φ x.val ∈ V := by + rcases hx with hx | hx + · exact hx.1.2.2 + · exact hx.2 + have hxr : r = 0 ∨ r = 1 := by + by_contra hn + push Not at hn + have hro : r ∈ Ioo (0 : unitInterval) 1 := Net.mem_Ioo_of_ne hn.1 hn.2 + rcases hx with hx | hx + · exact hx.2 ⟨r, hro, hr₁.symm⟩ + · refine hYbd _ hx ?_ + change x.val ∈ bd N.D + rw [hr₁] + exact N.range_f_subset_bd i ⟨r, rfl⟩ + refine ⟨?_, hxV⟩ + rcases hxr with rfl | rfl + · exact Or.inl hr₁ + · exact Or.inr hr₁ + · rintro ⟨x, hx, rfl⟩ + obtain ⟨hxe, hxV⟩ := hx + have key : ∃ r : unitInterval, (r = 0 ∨ r = 1) ∧ x.val = N.f i r := by + rcases hxe with h | h + · exact ⟨0, Or.inl rfl, h⟩ + · exact ⟨1, Or.inr rfl, h⟩ + obtain ⟨r, hr, hxr⟩ := key + have hrV : N.φ (N.f i r) ∈ V := hxr ▸ hxV + obtain ⟨h₁, h₂⟩ := hend r hr hrV + refine ⟨⟨x, Or.inl (hxr ▸ h₁ : x.val ∈ P₀), rfl⟩, + ⟨⟨N.g i r, hsubB _ (hgB ⟨r, rfl⟩)⟩, Or.inl h₂, ?_⟩⟩ + exact ((hcross x ⟨N.g i r, _⟩).mpr ⟨r, hxr, rfl⟩).symm + +/-- See the module docstring. The sets `A` and `B` are the cut pieces, and `α`, `β` the maps from +them to the new disc. Terms such as `({N.φ s} ∩ V).ncard` are 1 when the point is in `V`. -/ +theorem Net.separating_contact_balance + (N M : Net S) (i : Fin N.r) {A B F : Set N.D} {s t : N.D} (hst : s ≠ t) + (hFbd : F ∩ bd N.D = {s, t}) + (hs : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ s ∧ N.g j r ≠ s) + (ht : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ t ∧ N.g j r ≠ t) + (hAB : A ∪ B = univ) (hI : A ∩ B = F) + (hAd : discBd A = (A ∩ bd N.D) ∪ F) (hBd : discBd B = (B ∩ bd N.D) ∪ F) + (hfA : range (N.f i) ⊆ discBd A) (hgB : range (N.g i) ⊆ discBd B) + (α : A → M.D) (β : B → M.D) (hiα : Function.Injective α) (hiβ : Function.Injective β) + (hT : range α ∪ range β = univ) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ ∃ r, x.val = N.f i r ∧ y.val = N.g i r) + (hαbd : ∀ x : A, α x ∈ bd M.D ↔ x.val ∈ discBd A ∧ + x.val ∉ N.f i '' Ioo (0 : unitInterval) 1) + (hβbd : ∀ y : B, β y ∈ bd M.D ↔ y.val ∈ discBd B ∧ + y.val ∉ N.g i '' Ioo (0 : unitInterval) 1) + (hφA : ∀ x : A, M.φ (α x) = N.φ x.val) (hφB : ∀ y : B, M.φ (β y) = N.φ y.val) + (V : Set S) (hV : V.Finite) : + (bd M.D ∩ M.φ ⁻¹' V).ncard + 2 * (N.φ '' (N.f i '' Ioo (0 : unitInterval) 1) ∩ V).ncard + + ({N.φ (N.f i 0)} ∩ V).ncard + ({N.φ (N.f i 1)} ∩ V).ncard = + (bd N.D ∩ N.φ ⁻¹' V).ncard + 2 * (N.φ '' (F \ {s, t}) ∩ V).ncard + + ({N.φ s} ∩ V).ncard + ({N.φ t} ∩ V).ncard := by + classical + have hsub : ∀ x ∈ discBd A, x ∈ A := fun x hx => discBd_subset A hx + have hsubB : ∀ x ∈ discBd B, x ∈ B := fun x hx => discBd_subset B hx + set X := bd N.D ∩ N.φ ⁻¹' V with hX + set fO := N.f i '' Ioo (0 : unitInterval) 1 with hfO + set gO := N.g i '' Ioo (0 : unitInterval) 1 with hgO + set Y := (F \ {s, t}) ∩ N.φ ⁻¹' V with hY + have hXfin : X.Finite := (N.finite_preimage_of_finite hV).subset inter_subset_right + have hYfin : Y.Finite := (N.finite_preimage_of_finite hV).subset inter_subset_right + have hFA : F ⊆ A := fun x hx => (hI.symm ▸ hx : x ∈ A ∩ B).1 + have hFB : F ⊆ B := fun x hx => (hI.symm ▸ hx : x ∈ A ∩ B).2 + have hsF : s ∈ F := (hFbd.symm.subset (Or.inl rfl)).1 + have htF : t ∈ F := (hFbd.symm.subset (Or.inr rfl)).1 + have hsbd : s ∈ bd N.D := (hFbd.symm.subset (Or.inl rfl)).2 + have htbd : t ∈ bd N.D := (hFbd.symm.subset (Or.inr rfl)).2 + have hYbd : ∀ x ∈ Y, x ∉ bd N.D := fun x hx h => hx.1.2 (hFbd.subset ⟨hx.1.1, h⟩) + have hfObd : ∀ x ∈ fO, x ∈ bd N.D := fun x ⟨r, _, h⟩ => h ▸ N.range_f_subset_bd i ⟨r, rfl⟩ + have hgObd : ∀ x ∈ gO, x ∈ bd N.D := fun x ⟨r, _, h⟩ => h ▸ N.range_g_subset_bd i ⟨r, rfl⟩ + have hfOF : ∀ x ∈ fO, x ∉ F := by + rintro _ ⟨r, hr, rfl⟩ h + rcases hFbd.subset ⟨h, hfObd _ ⟨r, hr, rfl⟩⟩ with h' | h' + · exact (hs i r hr).1 h' + · exact (ht i r hr).1 h' + have hgOF : ∀ x ∈ gO, x ∉ F := by + rintro _ ⟨r, hr, rfl⟩ h + rcases hFbd.subset ⟨h, hgObd _ ⟨r, hr, rfl⟩⟩ with h' | h' + · exact (hs i r hr).2 h' + · exact (ht i r hr).2 h' + have hfOA : ∀ x ∈ fO, x ∈ A := fun x ⟨r, _, h⟩ => hsub _ (hfA ⟨r, h⟩) + have hgOB : ∀ x ∈ gO, x ∈ B := fun x ⟨r, _, h⟩ => hsubB _ (hgB ⟨r, h⟩) + set P₀ := (A ∩ X) \ fO with hP₀ + set Q₀ := (B ∩ X) \ gO with hQ₀ + set P := P₀ ∪ Y with hP + set Q := Q₀ ∪ Y with hQ + have hPA : P ⊆ A := by + rintro x (hx | hx) + · exact hx.1.1 + · exact hFA hx.1.1 + have hQB : Q ⊆ B := by + rintro x (hx | hx) + · exact hx.1.1 + · exact hFB hx.1.1 + have hP₀fin : P₀.Finite := hXfin.subset fun x hx => hx.1.2 + have hQ₀fin : Q₀.Finite := hXfin.subset fun x hx => hx.1.2 + let val₁ : A → N.D := Subtype.val + let val₂ : B → N.D := Subtype.val + have hPimg : val₁ '' (val₁ ⁻¹' P) = P := by + rw [image_preimage_eq_inter_range, Subtype.range_coe, inter_eq_left.mpr hPA] + have hQimg : val₂ '' (val₂ ⁻¹' Q) = Q := by + rw [image_preimage_eq_inter_range, Subtype.range_coe, inter_eq_left.mpr hQB] + have hPcard : (α '' (val₁ ⁻¹' P)).ncard = P.ncard := by + rw [ncard_image_of_injective _ hiα, ← hPimg, + ncard_image_of_injective _ Subtype.val_injective] + rw [hPimg] + have hQcard : (β '' (val₂ ⁻¹' Q)).ncard = Q.ncard := by + rw [ncard_image_of_injective _ hiβ, ← hQimg, + ncard_image_of_injective _ Subtype.val_injective] + rw [hQimg] + have hX' : bd M.D ∩ M.φ ⁻¹' V = α '' (val₁ ⁻¹' P) ∪ β '' (val₂ ⁻¹' Q) := + N.separated_boundary_contacts M i hsbd htbd hAd hBd α β hT hαbd hβbd hφA hφB V hYbd + -- The two parts of the new boundary meet at the ends of the pair in `V`. + set O := ({N.f i 0, N.f i 1} : Set N.D) ∩ N.φ ⁻¹' V with hO + have hOA : O ⊆ A := by + rintro _ ⟨rfl | h, -⟩ + · exact hsub _ (hfA ⟨0, rfl⟩) + · exact (mem_singleton_iff.mp h) ▸ hsub _ (hfA ⟨1, rfl⟩) + have hcap : α '' (val₁ ⁻¹' P) ∩ β '' (val₂ ⁻¹' Q) = α '' (val₁ ⁻¹' O) := + N.separated_boundary_overlap M i hfA hgB α β hcross V hYbd + have hOimg : val₁ '' (val₁ ⁻¹' O) = O := by + rw [image_preimage_eq_inter_range, Subtype.range_coe, inter_eq_left.mpr hOA] + have hOcard : (α '' (val₁ ⁻¹' O)).ncard = O.ncard := by + rw [ncard_image_of_injective _ hiα, ← hOimg, + ncard_image_of_injective _ Subtype.val_injective] + rw [hOimg] + have hOfin : O.Finite := (N.finite_preimage_of_finite hV).subset inter_subset_right + -- A singleton term for a point of `N.D`. + have hind : ∀ z : N.D, ({z} ∩ N.φ ⁻¹' V).ncard = ({N.φ z} ∩ V).ncard := by + intro z + by_cases hz : N.φ z ∈ V + · rw [inter_eq_left.mpr (singleton_subset_iff.mpr hz), + inter_eq_left.mpr (singleton_subset_iff.mpr (show z ∈ N.φ ⁻¹' V from hz)), + ncard_singleton, ncard_singleton] + · have h₁ : ({N.φ z} ∩ V) = ∅ := by + ext w + simp only [mem_inter_iff, mem_singleton_iff, mem_empty_iff_false, iff_false, not_and] + rintro rfl + exact hz + have h₂ : ({z} ∩ N.φ ⁻¹' V) = ∅ := by + ext w + simp only [mem_inter_iff, mem_singleton_iff, mem_empty_iff_false, iff_false, not_and] + rintro rfl + exact hz + rw [h₁, h₂, ncard_empty, ncard_empty] + have hpair : ∀ a b : N.D, a ≠ b → (({a, b} : Set N.D) ∩ N.φ ⁻¹' V).ncard = + ({N.φ a} ∩ V).ncard + ({N.φ b} ∩ V).ncard := by + intro a b hab + rw [← hind, ← hind, show ({a, b} : Set N.D) = {a} ∪ {b} from rfl, union_inter_distrib_right] + refine ncard_union_eq ?_ ((finite_singleton _).inter_of_left _) + ((finite_singleton _).inter_of_left _) + refine disjoint_left.mpr ?_ + rintro x ⟨h₁, -⟩ ⟨h₂, -⟩ + exact hab ((mem_singleton_iff.mp h₁).symm.trans (mem_singleton_iff.mp h₂)) + have hne01 : (0 : unitInterval) ≠ 1 := zero_ne_one + have hOsum : O.ncard = ({N.φ (N.f i 0)} ∩ V).ncard + ({N.φ (N.f i 1)} ∩ V).ncard := + hpair _ _ (fun h => hne01 (N.injective_f i h)) + have hEsum := hpair s t hst + -- The old boundary count. + have hP₀Y : Disjoint P₀ Y := disjoint_left.mpr fun x hx hy => hYbd x hy hx.1.2.1 + have hQ₀Y : Disjoint Q₀ Y := disjoint_left.mpr fun x hx hy => hYbd x hy hx.1.2.1 + have hPc : P.ncard = P₀.ncard + Y.ncard := ncard_union_eq hP₀Y hP₀fin hYfin + have hQc : Q.ncard = Q₀.ncard + Y.ncard := ncard_union_eq hQ₀Y hQ₀fin hYfin + have hunion : P₀ ∪ Q₀ = X \ (fO ∪ gO) := by + ext x + constructor + · rintro (hx | hx) + · refine ⟨hx.1.2, ?_⟩ + rintro (h | h) + · exact hx.2 h + · refine hgOF x h (hI ▸ ⟨hx.1.1, hgOB x h⟩) + · refine ⟨hx.1.2, ?_⟩ + rintro (h | h) + · exact hfOF x h (hI ▸ ⟨hfOA x h, hx.1.1⟩) + · exact hx.2 h + · rintro ⟨hx, hn⟩ + rcases hAB.symm ▸ mem_univ x with h | h + · exact Or.inl ⟨⟨h, hx⟩, fun h' => hn (Or.inl h')⟩ + · exact Or.inr ⟨⟨h, hx⟩, fun h' => hn (Or.inr h')⟩ + have hinter : P₀ ∩ Q₀ = ({s, t} : Set N.D) ∩ N.φ ⁻¹' V := by + ext x + constructor + · rintro ⟨hx, hy⟩ + have : x ∈ F := hI ▸ ⟨hx.1.1, hy.1.1⟩ + exact ⟨hFbd.subset ⟨this, hx.1.2.1⟩, hx.1.2.2⟩ + · rintro ⟨hxe, hxV⟩ + have hxF : x ∈ F := by + rcases hxe with h | h + · exact h ▸ hsF + · exact (mem_singleton_iff.mp h) ▸ htF + have hxb : x ∈ bd N.D := by + rcases hxe with h | h + · exact h ▸ hsbd + · exact (mem_singleton_iff.mp h) ▸ htbd + exact ⟨⟨⟨hFA hxF, hxb, hxV⟩, fun h => hfOF x h hxF⟩, + ⟨⟨hFB hxF, hxb, hxV⟩, fun h => hgOF x h hxF⟩⟩ + have hcount₁ := ncard_union_add_ncard_inter P₀ Q₀ hP₀fin hQ₀fin + rw [hunion, hinter] at hcount₁ + -- The contacts on the two open sides. + have hfgO : Disjoint fO gO := by + refine disjoint_left.mpr ?_ + rintro _ ⟨r, hr, rfl⟩ ⟨q, -, h⟩ + exact N.internally_disjoint_fg i i r hr ⟨q, h⟩ + have himg : N.φ '' gO = N.φ '' fO := by + ext z + constructor + · rintro ⟨_, ⟨r, hr, rfl⟩, rfl⟩ + exact ⟨_, ⟨r, hr, rfl⟩, N.pasting_eq i r⟩ + · rintro ⟨_, ⟨r, hr, rfl⟩, rfl⟩ + exact ⟨_, ⟨r, hr, rfl⟩, (N.pasting_eq i r).symm⟩ + have hside : ∀ W : Set N.D, W ⊆ bd N.D → InjOn N.φ W → + (X ∩ W).ncard = (N.φ '' W ∩ V).ncard := by + intro W hW hinj + have : N.φ '' W ∩ V = N.φ '' (X ∩ W) := by + ext z + constructor + · rintro ⟨⟨x, hx, rfl⟩, hz⟩ + exact ⟨x, ⟨⟨hW hx, hz⟩, hx⟩, rfl⟩ + · rintro ⟨x, ⟨hx, hxW⟩, rfl⟩ + exact ⟨⟨x, hxW, rfl⟩, hx.2⟩ + rw [this, (hinj.mono inter_subset_right).ncard_image] + have hcf := hside fO hfObd (N.injOn_image_open_side i) + have hcg := hside gO hgObd (N.injOn_image_open_side_g i) + rw [himg] at hcg + have hsplit : (X ∩ fO).ncard + (X ∩ gO).ncard + (X \ (fO ∪ gO)).ncard = X.ncard := by + have h₁ : X ∩ (fO ∪ gO) = (X ∩ fO) ∪ (X ∩ gO) := inter_union_distrib_left _ _ _ + have h₂ := ncard_inter_add_ncard_sdiff_eq_ncard X (fO ∪ gO) hXfin + rw [h₁, ncard_union_eq (hfgO.mono inter_subset_right inter_subset_right) + (hXfin.subset inter_subset_left) (hXfin.subset inter_subset_left)] at h₂ + exact h₂ + have hYc : Y.ncard = (N.φ '' (F \ {s, t}) ∩ V).ncard := by + have : N.φ '' (F \ {s, t}) ∩ V = N.φ '' Y := by + ext z + constructor + · rintro ⟨⟨x, hx, rfl⟩, hz⟩ + exact ⟨x, ⟨hx, hz⟩, rfl⟩ + · rintro ⟨x, ⟨hx, hz⟩, rfl⟩ + exact ⟨⟨x, hx, rfl⟩, hz⟩ + rw [this, ((N.injOn_line_interior hFbd).mono inter_subset_left).ncard_image] + have hPf : (α '' (val₁ ⁻¹' P)).Finite := + ((hP₀fin.union hYfin).preimage Subtype.val_injective.injOn).image α + have hQf : (β '' (val₂ ⁻¹' Q)).Finite := + ((hQ₀fin.union hYfin).preimage Subtype.val_injective.injOn).image β + have hX'c := ncard_union_add_ncard_inter (α '' (val₁ ⁻¹' P)) (β '' (val₂ ⁻¹' Q)) hPf hQf + rw [← hX', hcap, hOcard, hPcard, hQcard] at hX'c + change _ + 2 * (N.φ '' fO ∩ V).ncard + _ + _ = X.ncard + 2 * _ + _ + _ + rw [← hYc] + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSeparateEquivalence.lean b/LeanPool/GraphMinor/GM07/NetSeparateEquivalence.lean new file mode 100644 index 0000000000..d03448a660 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSeparateEquivalence.lean @@ -0,0 +1,180 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs + +/-! +# Fibers generated by the separating exchange + +For VII (2.6), page 218, lift every old identification through +the cut pieces. The selected pair is pasted to equality, all +retained pairs still identify matching old parameters, and the +two copies of each cutting-line point are identified by the new +pair. These identifications generate exactly the map's fibers. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface + +/-- If equal lifts and the old side pairs are identified, the new side pairs generate the fibers +of the map on the pasted surface. -/ +theorem Net.map_eqvGen_of_cut_lifts + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] (N : Net S) + {A B : Set N.D} (hAB : A ∪ B = univ) + (α : A → T) (β : B → T) (hT : range α ∪ range β = univ) + (φ : T → S) (hφA : ∀ x : A, φ (α x) = N.φ x.val) + (hφB : ∀ y : B, φ (β y) = N.φ y.val) + (f g : Fin N.r → Curve T) (hpair : ∀ j t, φ (f j t) = φ (g j t)) + (hCut : ∀ (x : A) (y : B), x.val = y.val → Relation.EqvGen + (fun a b : T => ∃ (j : Fin N.r) (t : unitInterval), a = f j t ∧ b = g j t) (α x) (β y)) + (hOldPair : + let σ : A ⊕ B → N.D := Sum.elim Subtype.val Subtype.val + let μ : A ⊕ B → T := Sum.elim α β + ∀ j t, ∃ a b, σ a = N.f j t ∧ σ b = N.g j t ∧ Relation.EqvGen + (fun x y : T => ∃ (i : Fin N.r) (r : unitInterval), x = f i r ∧ y = g i r) (μ a) (μ b)) : + ∀ z w, φ z = φ w ↔ Relation.EqvGen + (fun a b : T => ∃ (j : Fin N.r) (r : unitInterval), a = f j r ∧ b = g j r) z w := by + classical + let R : T → T → Prop := Relation.EqvGen + (fun a b : T => ∃ (j : Fin N.r) (r : unitInterval), a = f j r ∧ b = g j r) + have hRsymm {x y : T} : R x y → R y x := Relation.EqvGen.symm x y + have hRtrans {x y z : T} : R x y → R y z → R x z := Relation.EqvGen.trans x y z + let σ : A ⊕ B → N.D := Sum.elim Subtype.val Subtype.val + let μ : A ⊕ B → T := Sum.elim α β + have hSame : ∀ a b, σ a = σ b → R (μ a) (μ b) := by + intro a b hab + cases a with + | inl x => + cases b with + | inl y => + have hxy : x = y := Subtype.ext hab + subst y + exact .refl _ + | inr y => exact hCut x y hab + | inr x => + cases b with + | inl y => exact hRsymm (hCut y x hab.symm) + | inr y => + have hxy : x = y := Subtype.ext hab + subst y + exact .refl _ + let δ : N.D → A ⊕ B := fun x => if hx : x ∈ A then Sum.inl ⟨x, hx⟩ else + Sum.inr ⟨x, (hAB.symm ▸ mem_univ x).resolve_left hx⟩ + have hδ : ∀ x, σ (δ x) = x := by + intro x + dsimp [δ] + split <;> rfl + have hδpair : ∀ j r, R (μ (δ (N.f j r))) (μ (δ (N.g j r))) := by + intro j r + obtain ⟨a, b, ha, hb, hab⟩ := hOldPair j r + exact hRtrans (hSame _ a ((hδ _).trans ha.symm)) + (hRtrans hab (hSame b _ (hb.trans (hδ _).symm))) + have hLift : ∀ x y, N.φ x = N.φ y → R (μ (δ x)) (μ (δ y)) := by + intro x y hxy + have h := (N.bd_eq_iff x y).mp hxy + clear hxy + induction h with + | rel a b hab => + obtain ⟨j, r, rfl, rfl⟩ := hab + exact hδpair j r + | refl a => exact .refl _ + | symm a b _ ih => exact hRsymm ih + | trans a b c _ _ ih1 ih2 => exact hRtrans ih1 ih2 + have hμ : ∀ a, φ (μ a) = N.φ (σ a) := by + intro a + cases a with + | inl x => exact hφA x + | inr y => exact hφB y + have hμSurj : Function.Surjective μ := by + intro z + rcases hT.symm ▸ mem_univ z with ⟨x, hx⟩ | ⟨y, hy⟩ + · exact ⟨Sum.inl x, hx⟩ + · exact ⟨Sum.inr y, hy⟩ + intro z w + constructor + · intro hzw + obtain ⟨a, rfl⟩ := hμSurj z + obtain ⟨b, rfl⟩ := hμSurj w + have hab : N.φ (σ a) = N.φ (σ b) := (hμ a).symm.trans (hzw.trans (hμ b)) + exact hRtrans (hSame a _ (hδ _).symm) (hRtrans (hLift _ _ hab) (hSame _ b (hδ _))) + · intro h + induction h with + | rel a b hab => + obtain ⟨j, r, rfl, rfl⟩ := hab + exact hpair j r + | refl a => rfl + | symm a b _ ih => exact ih.symm + | trans a b c _ _ ih1 ih2 => exact ih1.trans ih2 + +/-- The new side family for the separating-pair exchange generates +exactly the associated map's fibers. This verifies the equivalence +condition of the new net in VII (2.6), page 218. -/ +theorem Net.separating_map_eqvGen + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (N : Net S) (i : Fin N.r) {A B F : Set N.D} + (hAB : A ∪ B = univ) (hI : A ∩ B = F) + (hfA : range (N.f i) ⊆ A) (hgB : range (N.g i) ⊆ B) + (α : A → T) (β : B → T) (hT : range α ∪ range β = univ) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ ∃ r, x.val = N.f i r ∧ y.val = N.g i r) + (φ : T → S) (hφA : ∀ x : A, φ (α x) = N.φ x.val) + (hφB : ∀ y : B, φ (β y) = N.φ y.val) + (k : Curve N.D) (hkF : range k = F) (f g : Fin N.r → Curve T) + (hpair : ∀ j r, φ (f j r) = φ (g j r)) + (hkf : ∀ r (x : A), x.val = k r → f i r = α x) + (hkg : ∀ r (y : B), y.val = k r → g i r = β y) + (hotherf : ∀ j, j ≠ i → + (∃ h : ∀ r, N.f j r ∈ A, ∀ r, f j r = α ⟨N.f j r, h r⟩) ∨ + (∃ h : ∀ r, N.f j r ∈ B, ∀ r, f j r = β ⟨N.f j r, h r⟩)) + (hotherg : ∀ j, j ≠ i → + (∃ h : ∀ r, N.g j r ∈ A, ∀ r, g j r = α ⟨N.g j r, h r⟩) ∨ + (∃ h : ∀ r, N.g j r ∈ B, ∀ r, g j r = β ⟨N.g j r, h r⟩)) : + ∀ z w, φ z = φ w ↔ Relation.EqvGen + (fun a b : T => ∃ (j : Fin N.r) (r : unitInterval), a = f j r ∧ b = g j r) z w := by + classical + let R : T → T → Prop := Relation.EqvGen + (fun a b : T => ∃ (j : Fin N.r) (r : unitInterval), a = f j r ∧ b = g j r) + have hRpair : ∀ j r, R (f j r) (g j r) := fun j r => .rel _ _ ⟨j, r, rfl, rfl⟩ + let σ : A ⊕ B → N.D := Sum.elim Subtype.val Subtype.val + let μ : A ⊕ B → T := Sum.elim α β + have hCut : ∀ (x : A) (y : B), x.val = y.val → R (α x) (β y) := by + intro x y hxy + have hxF : x.val ∈ F := hI ▸ ⟨x.property, hxy.symm ▸ y.property⟩ + obtain ⟨r, hkr⟩ := hkF.symm ▸ hxF + have h := hRpair i r + rw [hkf r x hkr.symm, hkg r y (hxy.symm.trans hkr.symm)] at h + exact h + have hLiftPoint : ∀ (a : Curve N.D) (p : Curve T), + ((∃ h : ∀ r, a r ∈ A, ∀ r, p r = α ⟨a r, h r⟩) ∨ + (∃ h : ∀ r, a r ∈ B, ∀ r, p r = β ⟨a r, h r⟩)) → + ∀ r, ∃ z, σ z = a r ∧ μ z = p r := by + intro a p hp r + rcases hp with ⟨hA, hpA⟩ | ⟨hB, hpB⟩ + · exact ⟨Sum.inl ⟨a r, hA r⟩, rfl, (hpA r).symm⟩ + · exact ⟨Sum.inr ⟨a r, hB r⟩, rfl, (hpB r).symm⟩ + have hOldPair : ∀ j r, ∃ a b, σ a = N.f j r ∧ σ b = N.g j r ∧ R (μ a) (μ b) := by + intro j r + by_cases hji : j = i + · subst j + let x : A := ⟨N.f i r, hfA (mem_range_self r)⟩ + let y : B := ⟨N.g i r, hgB (mem_range_self r)⟩ + have hxy : α x = β y := (hcross x y).mpr ⟨r, rfl, rfl⟩ + refine ⟨Sum.inl x, Sum.inr y, rfl, rfl, ?_⟩ + change R (α x) (β y) + rw [hxy] + exact .refl _ + · obtain ⟨a, ha, haμ⟩ := hLiftPoint (N.f j) (f j) (hotherf j hji) r + obtain ⟨b, hb, hbμ⟩ := hLiftPoint (N.g j) (g j) (hotherg j hji) r + refine ⟨a, b, ha, hb, ?_⟩ + rw [haμ, hbμ] + exact hRpair j r + exact N.map_eqvGen_of_cut_lifts hAB α β hT φ hφA hφB f g hpair hCut hOldPair + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSeparateExchange.lean b/LeanPool/GraphMinor/GM07/NetSeparateExchange.lean new file mode 100644 index 0000000000..0ae82faa99 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSeparateExchange.lean @@ -0,0 +1,103 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.NetSeparateAssembly +import LeanPool.GraphMinor.GM07.NetSeparateCount +import LeanPool.GraphMinor.GM07.NetSwapCut +import LeanPool.GraphMinor.GM07.NetSwapNormal +import LeanPool.GraphMinor.Surface.InvarianceOfDomain + +/-! +# The separating exchange of VII (2.6) + +This is the new net of VII (2.6), page 218: paste `f = g` and cut along `F`, for a pair with one +side +in each piece of the cut. The new net is normal, and `Net.exists_separating_exchange` gives its +exact +count. `Net.pair_contacts_le_of_separating` is the inequality that replaces the printed one. +-/ + +public section +namespace GraphMinor.GM07 +open Set Topology Metric Surface +universe u + +/-- See the module docstring. -/ +theorem Net.exists_separating_exchange {S : Type u} [TopologicalSpace S] (hS : IsSurface S) + (N : Net S) (i : Fin N.r) {G : Drawing S} (hN : N.IsNormalFor G) + {F A B : Set N.D} {s t : N.D} (hF : IsLineWithEnds F s t) (hst : s ≠ t) + (hFbd : F ∩ bd N.D = {s, t}) + (hs : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ s ∧ N.g j r ≠ s) + (ht : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ t ∧ N.g j r ≠ t) + (hA : IsClosedDisc A) (hB : IsClosedDisc B) (hAB : A ∪ B = univ) (hI : A ∩ B = F) + (hAd : discBd A = (A ∩ bd N.D) ∪ F) (hBd : discBd B = (B ∩ bd N.D) ∪ F) + (hfA : range (N.f i) ⊆ discBd A) (hgB : range (N.g i) ⊆ discBd B) + (hNormal : G.IsNormal (N.φ '' F)) : + ∃ M : Net S, M.IsNormalFor G ∧ + M.bdVertexPreimageCard G + 2 * (N.φ '' (N.f i '' Ioo (0 : unitInterval) 1) ∩ G.V).ncard + + ({N.φ (N.f i 0)} ∩ G.V).ncard + ({N.φ (N.f i 1)} ∩ G.V).ncard = + N.bdVertexPreimageCard G + 2 * (N.φ '' (F \ {s, t}) ∩ G.V).ncard + + ({N.φ s} ∩ G.V).ncard + ({N.φ t} ∩ G.V).ncard := by + let : T2Space S := hS.2.1 + obtain ⟨ψ₀, φ₀, hψ₀, hφ₀, hφA, hφB, hiA, hiB, hcross, hαbd, hβbd⟩ := + N.exists_separating_pair_disc i hA hB hAB hfA hgB + obtain ⟨e, hcα, hcβ, hiα, hiβ, hT, hcross', hαbd', hβbd', hφ, hφA', hφB'⟩ := + N.exists_transported_cut_maps hψ₀ hφ₀ hφA hφB hiA hiB hcross hαbd hβbd + let α : A → N.D := e ∘ ψ₀ ∘ Sum.inl + let β : B → N.D := e ∘ ψ₀ ∘ Sum.inr + let φ : N.D → S := φ₀ ∘ e.symm + obtain ⟨M, eM, hr, hMap, hU⟩ := N.exists_separating_net_of_maps N.isSurface_D N.isClosedDisc_D + i hF hFbd hs ht hA hB hAB hI hAd hBd hfA hgB α β hcα hcβ + hiα hiβ hT hcross' hαbd' hβbd' + φ hφ hφA' hφB' + have hmap : ∀ z, M.φ (eM z) = φ z := fun z => congrFun hMap z + have hT' : range (eM ∘ α) ∪ range (eM ∘ β) = univ := by + apply eq_univ_of_forall + intro z + rcases hT.symm ▸ mem_univ (eM.symm z) with ⟨x, hx⟩ | ⟨y, hy⟩ + · exact Or.inl ⟨x, (congrArg eM hx).trans (eM.apply_symm_apply z)⟩ + · exact Or.inr ⟨y, (congrArg eM hy).trans (eM.apply_symm_apply z)⟩ + have hCount := N.separating_contact_balance M i hst hFbd hs ht hAB hI hAd hBd hfA hgB + (eM ∘ α) (eM ∘ β) (eM.injective.comp hiα) + (eM.injective.comp hiβ) hT' + (fun x y => eM.injective.eq_iff.trans (hcross' x y)) + (fun x => (mem_bd_homeomorph_iff eM _).trans (hαbd' x)) + (fun y => (mem_bd_homeomorph_iff eM _).trans (hβbd' y)) + (fun x => (hmap _).trans (hφA' x)) (fun y => (hmap _).trans (hφB' y)) G.V G.finite_V + refine ⟨M, N.isNormalFor_of_swap_seam_subset hS M hN hr hU hNormal, ?_⟩ + change (M.φ ⁻¹' G.V ∩ bd M.D).ncard + _ + _ + _ = (N.φ ⁻¹' G.V ∩ bd N.D).ncard + _ + _ + _ + rw [inter_comm (M.φ ⁻¹' G.V) (bd M.D), inter_comm (N.φ ⁻¹' G.V) (bd N.D)] + exact hCount + +/-- The inequality from the exact count. It replaces the inequality printed in the proof of VII +(2.6), +page 218 (see the correction to the proof of (2.6) in `corrections/GM07.md`). The hypothesis `hmin` +is condition (ii) of a minimal net. -/ +theorem Net.pair_contacts_le_of_separating {S : Type u} [TopologicalSpace S] (hS : IsSurface S) + (N : Net S) (i : Fin N.r) {G : Drawing S} (hN : N.IsNormalFor G) + (hmin : ∀ M : Net S, M.IsNormalFor G → N.bdVertexPreimageCard G ≤ M.bdVertexPreimageCard G) + {F A B : Set N.D} {s t : N.D} (hF : IsLineWithEnds F s t) (hst : s ≠ t) + (hFbd : F ∩ bd N.D = {s, t}) + (hs : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ s ∧ N.g j r ≠ s) + (ht : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ t ∧ N.g j r ≠ t) + (hA : IsClosedDisc A) (hB : IsClosedDisc B) (hAB : A ∪ B = univ) (hI : A ∩ B = F) + (hAd : discBd A = (A ∩ bd N.D) ∪ F) (hBd : discBd B = (B ∩ bd N.D) ∪ F) + (hfA : range (N.f i) ⊆ discBd A) (hgB : range (N.g i) ⊆ discBd B) + (hNormal : G.IsNormal (N.φ '' F)) : + 2 * (N.φ '' (N.f i '' Ioo (0 : unitInterval) 1) ∩ G.V).ncard + + ({N.φ (N.f i 0)} ∩ G.V).ncard + ({N.φ (N.f i 1)} ∩ G.V).ncard ≤ + 2 * (N.φ '' (F \ {s, t}) ∩ G.V).ncard + ({N.φ s} ∩ G.V).ncard + ({N.φ t} ∩ G.V).ncard := by + obtain ⟨M, hM, hCount⟩ := N.exists_separating_exchange hS i hN hF hst hFbd hs ht hA hB hAB hI + hAd hBd hfA hgB hNormal + have := hmin M hM + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSeparateFamily.lean b/LeanPool/GraphMinor/GM07/NetSeparateFamily.lean new file mode 100644 index 0000000000..9816d7c0f4 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSeparateFamily.lean @@ -0,0 +1,249 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.NetSeparate +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Paired sides for the general separating exchange + +For the type-(ii) exchange in VII (2.6), page 218, remove the +selected paired sides after pasting them. Replace that pair by +the two lifts of the cutting line. Every other refined side +lies wholly in one cut piece and keeps its old parameter. +The resulting family has the same number of pairs. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface + +/-- Construct all paired boundary arcs for the general type-(ii) +exchange of VII (2.6), page 218. The selected pair is replaced by +the two cutting-line lifts, and every other side is retained. -/ +theorem Net.exists_separating_side_family + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (N : Net S) (i : Fin N.r) {F A B : Set N.D} {s t : N.D} + (hF : IsLineWithEnds F s t) (hFbd : F ∩ bd N.D = {s, t}) + (hs : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ s ∧ N.g j r ≠ s) + (ht : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ t ∧ N.g j r ≠ t) + (hA : IsClosedDisc A) (hB : IsClosedDisc B) (hAB : A ∪ B = univ) (hI : A ∩ B = F) + (hAd : discBd A = (A ∩ bd N.D) ∪ F) (hBd : discBd B = (B ∩ bd N.D) ∪ F) + (α : A → T) (β : B → T) (hcα : Continuous α) (hcβ : Continuous β) + (hiα : Function.Injective α) (hiβ : Function.Injective β) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ ∃ r, x.val = N.f i r ∧ y.val = N.g i r) + (hαbd : ∀ x : A, α x ∈ bd T ↔ x.val ∈ discBd A ∧ + x.val ∉ N.f i '' Ioo (0 : unitInterval) 1) + (hβbd : ∀ y : B, β y ∈ bd T ↔ y.val ∈ discBd B ∧ + y.val ∉ N.g i '' Ioo (0 : unitInterval) 1) + (φ : T → S) (hφA : ∀ x : A, φ (α x) = N.φ x.val) + (hφB : ∀ y : B, φ (β y) = N.φ y.val) : + ∃ (k : Curve N.D) (f g : Fin N.r → Curve T), + Function.Injective k ∧ range k = F ∧ k 0 = s ∧ k 1 = t ∧ + (∀ j, Function.Injective (f j)) ∧ (∀ j, Function.Injective (g j)) ∧ + (∀ j, range (f j) ⊆ bd T) ∧ (∀ j, range (g j) ⊆ bd T) ∧ + (∀ j l, j ≠ l → ∀ r ∈ Ioo (0 : unitInterval) 1, f j r ∉ range (f l)) ∧ + (∀ j l, j ≠ l → ∀ r ∈ Ioo (0 : unitInterval) 1, g j r ∉ range (g l)) ∧ + (∀ j l, ∀ r ∈ Ioo (0 : unitInterval) 1, f j r ∉ range (g l)) ∧ + (∀ j l, ∀ r ∈ Ioo (0 : unitInterval) 1, g j r ∉ range (f l)) ∧ + (∀ j r, φ (f j r) = φ (g j r)) ∧ + (∀ r (x : A), x.val = k r → f i r = α x) ∧ + (∀ r (y : B), y.val = k r → g i r = β y) ∧ + (∀ j, j ≠ i → + (∃ h : ∀ r, N.f j r ∈ A, ∀ r, f j r = α ⟨N.f j r, h r⟩) ∨ + (∃ h : ∀ r, N.f j r ∈ B, ∀ r, f j r = β ⟨N.f j r, h r⟩)) ∧ + (∀ j, j ≠ i → + (∃ h : ∀ r, N.g j r ∈ A, ∀ r, g j r = α ⟨N.g j r, h r⟩) ∨ + (∃ h : ∀ r, N.g j r ∈ B, ∀ r, g j r = β ⟨N.g j r, h r⟩)) := by + classical + obtain ⟨k, hki, hkF, hk0, hk1, hkInt, hkf, hkg⟩ := + N.exists_separating_cut_curve hF hFbd hs ht + have hkA : ∀ r, k r ∈ A := fun r => (hI.symm ▸ (hkF ▸ mem_range_self r)).1 + have hkB : ∀ r, k r ∈ B := fun r => (hI.symm ▸ (hkF ▸ mem_range_self r)).2 + let p : Curve T := ⟨fun r => α ⟨k r, hkA r⟩, hcα.comp (k.continuous.subtype_mk hkA)⟩ + let q : Curve T := ⟨fun r => β ⟨k r, hkB r⟩, hcβ.comp (k.continuous.subtype_mk hkB)⟩ + have hpRep : (∃ h : ∀ r, k r ∈ A, ∀ r, p r = α ⟨k r, h r⟩) ∨ + (∃ h : ∀ r, k r ∈ B, ∀ r, p r = β ⟨k r, h r⟩) := Or.inl ⟨hkA, fun _ => rfl⟩ + have hqRep : (∃ h : ∀ r, k r ∈ A, ∀ r, q r = α ⟨k r, h r⟩) ∨ + (∃ h : ∀ r, k r ∈ B, ∀ r, q r = β ⟨k r, h r⟩) := Or.inr ⟨hkB, fun _ => rfl⟩ + obtain ⟨hfSide, hgSide⟩ := N.sides_subset_one_cut_piece hA hB hAB hI hFbd hs ht + choose Lf hLf using fun j => exists_curve_lift α β hcα hcβ (N.f j) (hfSide j) + choose Lg hLg using fun j => exists_curve_lift α β hcα hcβ (N.g j) (hgSide j) + let f : Fin N.r → Curve T := fun j => if j = i then p else Lf j + let g : Fin N.r → Curve T := fun j => if j = i then q else Lg j + have hfi : f i = p := ite_eq_left rfl + have hgi : g i = q := ite_eq_left rfl + have hfj : ∀ j, j ≠ i → f j = Lf j := fun j hj => ite_eq_right hj + have hgj : ∀ j, j ≠ i → g j = Lg j := fun j hj => ite_eq_right hj + have hpi := curve_lift_injective α β hiα hiβ k p hki hpRep + have hqi := curve_lift_injective α β hiα hiβ k q hki hqRep + have hpbd : range p ⊆ bd T := by + rintro z ⟨r, rfl⟩ + apply (hαbd ⟨k r, hkA r⟩).mpr + refine ⟨hAd ▸ Or.inr (hkF ▸ mem_range_self r), ?_⟩ + rintro ⟨v, hv, hvr⟩ + exact (hkf i).2 v hv ⟨r, hvr.symm⟩ + have hqbd : range q ⊆ bd T := by + rintro z ⟨r, rfl⟩ + apply (hβbd ⟨k r, hkB r⟩).mpr + refine ⟨hBd ▸ Or.inr (hkF ▸ mem_range_self r), ?_⟩ + rintro ⟨v, hv, hvr⟩ + exact (hkg i).2 v hv ⟨r, hvr.symm⟩ + have hOldBd : ∀ (a : Curve N.D) (c : Curve T), + range a ⊆ bd N.D → + (∀ r ∈ Ioo (0 : unitInterval) 1, N.f i r ∉ range a) → + (∀ r ∈ Ioo (0 : unitInterval) 1, N.g i r ∉ range a) → + ((∃ h : ∀ r, a r ∈ A, ∀ r, c r = α ⟨a r, h r⟩) ∨ + (∃ h : ∀ r, a r ∈ B, ∀ r, c r = β ⟨a r, h r⟩)) → range c ⊆ bd T := by + intro a c ha haf hag hc z hz + obtain ⟨r, rfl⟩ := hz + rcases hc with ⟨haA, hcA⟩ | ⟨haB, hcB⟩ + · rw [hcA r] + apply (hαbd _).mpr + refine ⟨hAd ▸ Or.inl ⟨haA r, ha (mem_range_self r)⟩, ?_⟩ + rintro ⟨v, hv, hvr⟩ + exact haf v hv ⟨r, hvr.symm⟩ + · rw [hcB r] + apply (hβbd _).mpr + refine ⟨hBd ▸ Or.inl ⟨haB r, ha (mem_range_self r)⟩, ?_⟩ + rintro ⟨v, hv, hvr⟩ + exact hag v hv ⟨r, hvr.symm⟩ + have hLFbd : ∀ j, j ≠ i → range (Lf j) ⊆ bd T := by + intro j hj + exact hOldBd (N.f j) (Lf j) (N.range_f_subset_bd j) + (N.internally_disjoint_ff i j hj.symm) (N.internally_disjoint_gf i j) (hLf j) + have hLGbd : ∀ j, j ≠ i → range (Lg j) ⊆ bd T := by + intro j hj + exact hOldBd (N.g j) (Lg j) (N.range_g_subset_bd j) + (N.internally_disjoint_fg i j) (N.internally_disjoint_gg i j hj.symm) (hLg j) + have hDisj := lifted_curves_internally_disjoint α β hiα hiβ (N.f i) (N.g i) hcross + have hpq : ∀ r ∈ Ioo (0 : unitInterval) 1, p r ∉ range q := by + intro r hr + rintro ⟨v, hvr⟩ + obtain ⟨u, hru, _⟩ := (hcross ⟨k r, hkA r⟩ ⟨k v, hkB v⟩).mp hvr.symm + exact hkInt r hr (N.range_f_subset_bd i ⟨u, hru.symm⟩) + have hqp : ∀ r ∈ Ioo (0 : unitInterval) 1, q r ∉ range p := by + intro r hr + rintro ⟨v, hvr⟩ + obtain ⟨u, _, hru⟩ := (hcross ⟨k v, hkA v⟩ ⟨k r, hkB r⟩).mp hvr + exact hkInt r hr (N.range_g_subset_bd i ⟨u, hru.symm⟩) + have hPF : ∀ j, j ≠ i → + (∀ r ∈ Ioo (0 : unitInterval) 1, p r ∉ range (Lf j)) ∧ + (∀ r ∈ Ioo (0 : unitInterval) 1, Lf j r ∉ range p) := by + intro j hj + exact ⟨hDisj k (N.f j) p (Lf j) hpRep (hLf j) (hkf j).1 (hkf i).1 (hkg i).1, + hDisj (N.f j) k (Lf j) p (hLf j) hpRep (hkf j).2 + (N.internally_disjoint_ff j i hj) (N.internally_disjoint_fg j i)⟩ + have hPG : ∀ j, j ≠ i → + (∀ r ∈ Ioo (0 : unitInterval) 1, p r ∉ range (Lg j)) ∧ + (∀ r ∈ Ioo (0 : unitInterval) 1, Lg j r ∉ range p) := by + intro j hj + exact ⟨hDisj k (N.g j) p (Lg j) hpRep (hLg j) (hkg j).1 (hkf i).1 (hkg i).1, + hDisj (N.g j) k (Lg j) p (hLg j) hpRep (hkg j).2 + (N.internally_disjoint_gf j i) (N.internally_disjoint_gg j i hj)⟩ + have hQF : ∀ j, j ≠ i → + (∀ r ∈ Ioo (0 : unitInterval) 1, q r ∉ range (Lf j)) ∧ + (∀ r ∈ Ioo (0 : unitInterval) 1, Lf j r ∉ range q) := by + intro j hj + exact ⟨hDisj k (N.f j) q (Lf j) hqRep (hLf j) (hkf j).1 (hkf i).1 (hkg i).1, + hDisj (N.f j) k (Lf j) q (hLf j) hqRep (hkf j).2 + (N.internally_disjoint_ff j i hj) (N.internally_disjoint_fg j i)⟩ + have hQG : ∀ j, j ≠ i → + (∀ r ∈ Ioo (0 : unitInterval) 1, q r ∉ range (Lg j)) ∧ + (∀ r ∈ Ioo (0 : unitInterval) 1, Lg j r ∉ range q) := by + intro j hj + exact ⟨hDisj k (N.g j) q (Lg j) hqRep (hLg j) (hkg j).1 (hkf i).1 (hkg i).1, + hDisj (N.g j) k (Lg j) q (hLg j) hqRep (hkg j).2 + (N.internally_disjoint_gf j i) (N.internally_disjoint_gg j i hj)⟩ + refine ⟨k, f, g, hki, hkF, hk0, hk1, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro j + by_cases hj : j = i + · subst j; rw [hfi]; exact hpi + · rw [hfj j hj]; exact curve_lift_injective α β hiα hiβ (N.f j) (Lf j) (N.injective_f j) (hLf j) + · intro j + by_cases hj : j = i + · subst j; rw [hgi]; exact hqi + · rw [hgj j hj]; exact curve_lift_injective α β hiα hiβ (N.g j) (Lg j) (N.injective_g j) (hLg j) + · intro j + by_cases hj : j = i + · subst j; rw [hfi]; exact hpbd + · rw [hfj j hj]; exact hLFbd j hj + · intro j + by_cases hj : j = i + · subst j; rw [hgi]; exact hqbd + · rw [hgj j hj]; exact hLGbd j hj + · intro j l hjl + by_cases hj : j = i + · subst j + rw [hfi, hfj l hjl.symm] + exact (hPF l hjl.symm).1 + · by_cases hl : l = i + · subst l; rw [hfj j hj, hfi]; exact (hPF j hj).2 + · rw [hfj j hj, hfj l hl] + exact hDisj (N.f j) (N.f l) (Lf j) (Lf l) (hLf j) (hLf l) + (N.internally_disjoint_ff j l hjl) (N.internally_disjoint_ff j i hj) + (N.internally_disjoint_fg j i) + · intro j l hjl + by_cases hj : j = i + · subst j + rw [hgi, hgj l hjl.symm] + exact (hQG l hjl.symm).1 + · by_cases hl : l = i + · subst l; rw [hgj j hj, hgi]; exact (hQG j hj).2 + · rw [hgj j hj, hgj l hl] + exact hDisj (N.g j) (N.g l) (Lg j) (Lg l) (hLg j) (hLg l) + (N.internally_disjoint_gg j l hjl) (N.internally_disjoint_gf j i) + (N.internally_disjoint_gg j i hj) + · intro j l + by_cases hj : j = i + · subst j + by_cases hl : l = i + · subst l; rw [hfi, hgi]; exact hpq + · rw [hfi, hgj l hl]; exact (hPG l hl).1 + · by_cases hl : l = i + · subst l; rw [hfj j hj, hgi]; exact (hQF j hj).2 + · rw [hfj j hj, hgj l hl] + exact hDisj (N.f j) (N.g l) (Lf j) (Lg l) (hLf j) (hLg l) + (N.internally_disjoint_fg j l) (N.internally_disjoint_ff j i hj) + (N.internally_disjoint_fg j i) + · intro j l + by_cases hj : j = i + · subst j + by_cases hl : l = i + · subst l; rw [hgi, hfi]; exact hqp + · rw [hgi, hfj l hl]; exact (hQF l hl).1 + · by_cases hl : l = i + · subst l; rw [hgj j hj, hfi]; exact (hPG j hj).2 + · rw [hgj j hj, hfj l hl] + exact hDisj (N.g j) (N.f l) (Lg j) (Lf l) (hLg j) (hLf l) + (N.internally_disjoint_gf j l) (N.internally_disjoint_gf j i) + (N.internally_disjoint_gg j i hj) + · intro j r + by_cases hj : j = i + · subst j; rw [hfi, hgi] + exact (hφA ⟨k r, hkA r⟩).trans (hφB ⟨k r, hkB r⟩).symm + · rw [hfj j hj, hgj j hj] + exact (curve_lift_map α β φ N.φ hφA hφB (N.f j) (Lf j) (hLf j) r).trans + ((N.pasting_eq j r).trans (curve_lift_map α β φ N.φ hφA hφB (N.g j) (Lg j) (hLg j) r).symm) + · intro r x hx + rw [hfi] + exact congrArg α (Subtype.ext hx.symm) + · intro r y hy + rw [hgi] + exact congrArg β (Subtype.ext hy.symm) + · intro j hj + rw [hfj j hj] + exact hLf j + · intro j hj + rw [hgj j hj] + exact hLg j + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSeparateFibers.lean b/LeanPool/GraphMinor/GM07/NetSeparateFibers.lean new file mode 100644 index 0000000000..5b1b986218 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSeparateFibers.lean @@ -0,0 +1,126 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.NetSwapBasic +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Interior fibers for a separating paired side + +In the general type-(ii) exchange of VII (2.6), page 218, a +whole refined pair lies across the two cut pieces. Its open +arc fibers are merged by pasting. The two cutting endpoints +are outside the open paired sides, so both lifts of the cut remain boundary +points. All remaining interior fibers come from old interior +points and stay singletons. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface + +/-- The associated map of a separating-pair exchange is injective +at every interior point of its new disc. This is the interior-fiber +condition for the general new net in VII (2.6), page 218. -/ +theorem Net.separating_map_interior_inj + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (N : Net S) (i : Fin N.r) {A B F : Set N.D} {s t : N.D} + (hFbd : F ∩ bd N.D = {s, t}) (hs : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ s + ∧ N.g j r ≠ s) + (ht : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ t ∧ N.g j r ≠ t) + (hI : A ∩ B = F) + (hAd : discBd A = (A ∩ bd N.D) ∪ F) + (hBd : discBd B = (B ∩ bd N.D) ∪ F) + (hfA : range (N.f i) ⊆ discBd A) (hgB : range (N.g i) ⊆ discBd B) + (α : A → T) (β : B → T) (hT : range α ∪ range β = univ) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ + ∃ r, x.val = N.f i r ∧ y.val = N.g i r) + (hαbd : ∀ x : A, α x ∈ bd T ↔ x.val ∈ discBd A ∧ + x.val ∉ N.f i '' Ioo (0 : unitInterval) 1) + (hβbd : ∀ y : B, β y ∈ bd T ↔ y.val ∈ discBd B ∧ + y.val ∉ N.g i '' Ioo (0 : unitInterval) 1) + (φ : T → S) (hφA : ∀ x : A, φ (α x) = N.φ x.val) + (hφB : ∀ y : B, φ (β y) = N.φ y.val) : + ∀ z ∈ (bd T)ᶜ, ∀ w, φ z = φ w → z = w := by + have hfAvoid : Disjoint F (N.f i '' Ioo (0 : unitInterval) 1) := by + apply disjoint_left.mpr + rintro x hxF ⟨r, hr, rfl⟩ + rcases hFbd.subset ⟨hxF, N.range_f_subset_bd i (mem_range_self r)⟩ with hxs | hxt + · exact (hs i r hr).1 hxs + · exact (ht i r hr).1 (mem_singleton_iff.mp hxt) + have hgAvoid : Disjoint F (N.g i '' Ioo (0 : unitInterval) 1) := by + apply disjoint_left.mpr + rintro x hxF ⟨r, hr, rfl⟩ + rcases hFbd.subset ⟨hxF, N.range_g_subset_bd i (mem_range_self r)⟩ with hxs | hxt + · exact (hs i r hr).2 hxs + · exact (ht i r hr).2 (mem_singleton_iff.mp hxt) + have hcutA : ∀ x : A, x.val ∈ F → α x ∈ bd T := by + intro x hx + exact (hαbd x).mpr ⟨hAd ▸ Or.inr hx, fun h => disjoint_left.mp hfAvoid hx h⟩ + have hcutB : ∀ y : B, y.val ∈ F → β y ∈ bd T := by + intro y hy + exact (hβbd y).mpr ⟨hBd ▸ Or.inr hy, fun h => disjoint_left.mp hgAvoid hy h⟩ + have hpasted : ∀ x : A, x.val ∈ N.f i '' Ioo (0 : unitInterval) 1 → + ∀ z, φ (α x) = φ z → α x = z := by + intro x hx z heq + obtain ⟨r, hr, hrx⟩ := hx + have hgB' : N.g i r ∈ B := discBd_subset B (hgB (mem_range_self r)) + have hxy : α x = β ⟨N.g i r, hgB'⟩ := + (hcross x ⟨N.g i r, hgB'⟩).mpr ⟨r, hrx.symm, rfl⟩ + have hmem : ∀ y, N.φ x.val = N.φ y → y ∈ ({N.f i r, N.g i r} : Set N.D) := by + intro y hy + rw [← N.fiber_eq_pair_of_mem_Ioo i hr] + exact hy.symm.trans (congrArg N.φ hrx.symm) + rcases hT.symm ▸ mem_univ z with ⟨y, rfl⟩ | ⟨y, rfl⟩ + · rcases hmem y.val ((hφA x).symm.trans (heq.trans (hφA y))) with hyf | hyg + · exact congrArg α (Subtype.ext (hrx.symm.trans hyf.symm)) + · have hyg' := mem_singleton_iff.mp hyg + have hyF : y.val ∈ F := hI ▸ ⟨y.property, hyg'.symm ▸ hgB'⟩ + exact (disjoint_left.mp hgAvoid hyF ⟨r, hr, hyg'.symm⟩).elim + · rcases hmem y.val ((hφA x).symm.trans (heq.trans (hφB y))) with hyf | hyg + · have hyF : y.val ∈ F := hI ▸ ⟨(hyf.trans hrx).symm ▸ x.property, y.property⟩ + exact (disjoint_left.mp hfAvoid hyF ⟨r, hr, hyf.symm⟩).elim + · exact hxy.trans (congrArg β (Subtype.ext (mem_singleton_iff.mp hyg).symm)) + have hleft : ∀ x : A, α x ∉ bd T → ∀ z, φ (α x) = φ z → α x = z := by + intro x hx z heq + by_cases hxbd : x.val ∈ bd N.D + · have hxp : x.val ∈ N.f i '' Ioo (0 : unitInterval) 1 := by + by_contra h + exact hx ((hαbd x).mpr ⟨hAd ▸ Or.inl ⟨x.property, hxbd⟩, h⟩) + exact hpasted x hxp z heq + · rcases hT.symm ▸ mem_univ z with ⟨y, rfl⟩ | ⟨y, rfl⟩ + · have hxy := N.interior_inj x.val hxbd y.val + ((hφA x).symm.trans (heq.trans (hφA y))) + exact congrArg α (Subtype.ext hxy) + · have hxy := N.interior_inj x.val hxbd y.val + ((hφA x).symm.trans (heq.trans (hφB y))) + exact (hx (hcutA x (hI ▸ ⟨x.property, hxy.symm ▸ y.property⟩))).elim + intro z hz w heq + rcases hT.symm ▸ mem_univ z with ⟨x, rfl⟩ | ⟨y, rfl⟩ + · exact hleft x hz w heq + · by_cases hybd : y.val ∈ bd N.D + · have hyp : y.val ∈ N.g i '' Ioo (0 : unitInterval) 1 := by + by_contra h + exact hz ((hβbd y).mpr ⟨hBd ▸ Or.inl ⟨y.property, hybd⟩, h⟩) + obtain ⟨r, hr, hry⟩ := hyp + have hfA' : N.f i r ∈ A := discBd_subset A (hfA (mem_range_self r)) + let x : A := ⟨N.f i r, hfA'⟩ + have hxy : α x = β y := (hcross x y).mpr ⟨r, rfl, hry.symm⟩ + exact hxy.symm.trans (hleft x (hxy.symm ▸ hz) w ((congrArg φ hxy).trans heq)) + · rcases hT.symm ▸ mem_univ w with ⟨x, rfl⟩ | ⟨x, rfl⟩ + · have hyx := N.interior_inj y.val hybd x.val + ((hφB y).symm.trans (heq.trans (hφA x))) + exact (hz (hcutB y (hI ▸ ⟨hyx.symm ▸ x.property, y.property⟩))).elim + · have hyx := N.interior_inj y.val hybd x.val + ((hφB y).symm.trans (heq.trans (hφB x))) + exact congrArg β (Subtype.ext hyx) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwap.lean b/LeanPool/GraphMinor/GM07/NetSwap.lean new file mode 100644 index 0000000000..27fdce3258 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwap.lean @@ -0,0 +1,181 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.NetSwapBasic +public import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.GM07.NetSwapCut +import LeanPool.GraphMinor.GM07.NetSwapAssembly +import LeanPool.GraphMinor.GM07.NetSwapNormal +import LeanPool.GraphMinor.GM07.NetSwapContactBalance +import LeanPool.GraphMinor.Surface.Disc +import LeanPool.GraphMinor.Surface.InvarianceOfDomain + +/-! +# Exchanging a paired boundary subarc of a net + +The exchange used in VII (2.6), page 218, pastes a subarc +of one paired side to its mate and cuts along a proper line. +Construct the cut pieces, their pasted disc, and all new paired +sides. Relabel the pasted disc by the original disc to keep its +universe, then package the result as a net for the same surface. +-/ + +public section +namespace GraphMinor.GM07 +open Set Topology Metric Surface + +/-- The actual net obtained by cutting along a proper line and +pasting the subarc between its endpoints to its mate. The number +of pairs and the seam vertices are unchanged. The returned maps +record every fiber and boundary identification, including the +cutting endpoints, for the count in VII (2.6), page 218. -/ +theorem Net.exists_swap_subarc_model + {S : Type*} [TopologicalSpace S] [T2Space S] (N : Net S) (i : Fin N.r) + (u v : unitInterval) (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F : Set N.D} (hF : IsLineWithEnds F (N.f i u) (N.f i v)) + (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) : + ∃ (M : Net S) (C A B : Set N.D) (ψ : A ⊕ B → M.D), + M.r = N.r ∧ M.seamV = N.seamV ∧ + IsClosedDisc A ∧ IsClosedDisc B ∧ A ∪ B = univ ∧ A ∩ B = F ∧ + discBd A = range (pieceA (N.f i) u.val v.val) ∪ F ∧ + discBd B = C ∪ F ∧ range (pieceA (N.f i) u.val v.val) ∪ C = bd N.D ∧ + IsQuotientMap ψ ∧ + (∀ x : A, M.φ (ψ (Sum.inl x)) = N.φ x.val) ∧ + (∀ y : B, M.φ (ψ (Sum.inr y)) = N.φ y.val) ∧ + Function.Injective (ψ ∘ Sum.inl) ∧ Function.Injective (ψ ∘ Sum.inr) ∧ + (∀ (x : A) (y : B), ψ (Sum.inl x) = ψ (Sum.inr y) ↔ + ∃ t, x.val = pieceA (N.f i) u.val v.val t ∧ + y.val = pieceA (N.g i) u.val v.val t) ∧ + (∀ x : A, ψ (Sum.inl x) ∈ bd M.D ↔ + x.val ∈ discBd A ∧ x.val ∉ pieceA (N.f i) u.val v.val '' Ioo (0 : unitInterval) 1) ∧ + (∀ y : B, ψ (Sum.inr y) ∈ bd M.D ↔ + y.val ∈ discBd B ∧ y.val ∉ pieceA (N.g i) u.val v.val '' Ioo (0 : unitInterval) 1) := by + obtain ⟨C, A, B, ψ₀, φ₀, hA, hB, hAB, hI, hAd, hBd, hcover, + hψ₀, hφ₀, hφA, hφB, hiA, hiB, hcross, hαbd, hβbd⟩ := + N.exists_swap_disc i u v hu huv hv hF hFbd + obtain ⟨e, hcα, hcβ, hiα, hiβ, hT, hcross', hαbd', hβbd', hφ, hφA', hφB'⟩ := + N.exists_transported_cut_maps hψ₀ hφ₀ hφA hφB hiA hiB hcross hαbd hβbd + let α : A → N.D := e ∘ ψ₀ ∘ Sum.inl + let β : B → N.D := e ∘ ψ₀ ∘ Sum.inr + let φ : N.D → S := φ₀ ∘ e.symm + obtain ⟨M, eM, hr, hMap, hV⟩ := N.exists_swap_net_of_maps N.isSurface_D N.isClosedDisc_D + i u v hu huv hv hF hFbd hAB hI hAd hcover hBd α β hcα hcβ + hiα hiβ hT hcross' hαbd' hβbd' + φ hφ hφA' hφB' + let E := e.trans eM + let ψ := E ∘ ψ₀ + have hEMap : ∀ z, M.φ (E z) = φ₀ z := by + intro z + have h := congrFun hMap (e z) + change M.φ (E z) = φ₀ (e.symm (e z)) at h + exact h.trans (congrArg φ₀ (e.symm_apply_apply z)) + refine ⟨M, C, A, B, ψ, hr, hV, hA, hB, hAB, hI, hAd, hBd, hcover, + E.isQuotientMap.comp hψ₀, ?_, ?_, E.injective.comp hiA, E.injective.comp hiB, ?_, ?_, ?_⟩ + · intro x + exact (hEMap _).trans (hφA x) + · intro y + exact (hEMap _).trans (hφB y) + · intro x y + exact E.injective.eq_iff.trans (hcross x y) + · intro x + exact (mem_bd_homeomorph_iff E _).trans (hαbd x) + · intro y + exact (mem_bd_homeomorph_iff E _).trans (hβbd y) + +/-- Cutting and pasting the selected subarc produces a normal net +when the original net and the proper cutting line are normal. The +number of pairs and the seam vertices stay unchanged. This proves +the normality assertion in VII (2.6), page 218. -/ +theorem Net.exists_swap_subarc_normal + {S : Type*} [TopologicalSpace S] (hS : IsSurface S) + (N : Net S) (i : Fin N.r) (u v : unitInterval) + (hu : 0 < u) (huv : u < v) (hv : v < 1) + {G : Drawing S} (hN : N.IsNormalFor G) + {F : Set N.D} (hF : IsLineWithEnds F (N.f i u) (N.f i v)) + (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) + {G_D : Drawing N.D} (hPull : IsPullbackDrawing N.φ G G_D) + (hNormal : G_D.IsNormal F) : + ∃ M : Net S, M.IsNormalFor G ∧ M.r = N.r ∧ M.seamV = N.seamV ∧ + M.seamU ⊆ N.seamU ∪ N.φ '' F := by + let : T2Space S := hS.2.1 + obtain ⟨M, C, A, B, ψ, hr, hV, _, _, _, _, hAd, hBd, hcover, + hψ, hφA, hφB, _, _, _, hαbd, hβbd⟩ := + N.exists_swap_subarc_model i u v hu huv hv hF hFbd + have hU := N.seamU_subset_of_swap_maps M i u v huv.le hAd hBd hcover ψ hψ.surjective + hφA hφB (fun x hx => ((hαbd x).mp hx).1) (fun y hy => ((hβbd y).mp hy).1) + exact ⟨M, N.isNormalFor_of_swap_seam_subset hS M hN hr hU + (N.normal_image_of_pullback hPull hNormal), hr, hV, hU⟩ + +/-- The new normal net from a proper line between interior points of +one paired side. Its number of pairs is unchanged. Its exact boundary +contact balance removes twice the contacts on the open pasted subarc +and adds twice the contacts on the inner cutting line, with no endpoint +term. This is the subarc form of the new-net construction in VII (2.6), +page 218, also used in VII (4.6), page 230. -/ +theorem Net.exists_swap_subarc + {S : Type*} [TopologicalSpace S] (hS : IsSurface S) + (N : Net S) (i : Fin N.r) (u v : unitInterval) + (hu : 0 < u) (huv : u < v) (hv : v < 1) + {G : Drawing S} (hN : N.IsNormalFor G) + {F : Set N.D} (hF : IsLineWithEnds F (N.f i u) (N.f i v)) + (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) + {G_D : Drawing N.D} (hPull : IsPullbackDrawing N.φ G G_D) + (hNormal : G_D.IsNormal F) : + ∃ M : Net S, M.IsNormalFor G ∧ M.r = N.r ∧ M.seamV = N.seamV ∧ + M.bdVertexPreimageCard G + + 2 * (N.φ '' ((N.f i '' Icc u v) \ {N.f i u, N.f i v}) ∩ G.V).ncard = + N.bdVertexPreimageCard G + + 2 * (N.φ '' (F \ {N.f i u, N.f i v}) ∩ G.V).ncard := by + let : T2Space S := hS.2.1 + obtain ⟨M, C, A, B, ψ, hr, hV, _, _, _, hI, hAd, hBd, hcover, + hψ, hφA, hφB, hiA, hiB, hcross, hαbd, hβbd⟩ := + N.exists_swap_subarc_model i u v hu huv hv hF hFbd + have hU := N.seamU_subset_of_swap_maps M i u v huv.le hAd hBd hcover ψ hψ.surjective + hφA hφB (fun x hx => ((hαbd x).mp hx).1) (fun y hy => ((hβbd y).mp hy).1) + have hM := N.isNormalFor_of_swap_seam_subset hS M hN hr hU + (N.normal_image_of_pullback hPull hNormal) + have hT : range (ψ ∘ Sum.inl) ∪ range (ψ ∘ Sum.inr) = univ := by + apply eq_univ_of_forall + intro z + obtain ⟨w, rfl⟩ := hψ.surjective z + cases w with + | inl x => exact Or.inl (mem_range_self x) + | inr y => exact Or.inr (mem_range_self y) + have hCount := N.swap_contact_balance M i u v hu huv hv hF hFbd hI hAd hBd hcover + (ψ ∘ Sum.inl) (ψ ∘ Sum.inr) hiA hiB hT hcross hφA hφB hαbd hβbd G.V G.finite_V + have hOpen : (N.f i '' Icc u v) \ {N.f i u, N.f i v} = N.f i '' Ioo u v := by + rw [← image_pair, ← image_sdiff (N.injective_f i), Icc_sdiff_both] + refine ⟨M, hM, hr, hV, ?_⟩ + rw [hOpen] + change (M.φ ⁻¹' G.V ∩ bd M.D).ncard + _ = (N.φ ⁻¹' G.V ∩ bd N.D).ncard + _ + rw [inter_comm (M.φ ⁻¹' G.V) (bd M.D), inter_comm (N.φ ⁻¹' G.V) (bd N.D)] + exact hCount + +/-- Minimality bounds contacts on the open selected subarc by contacts +on the inner cutting line. This is the minimality comparison in the +proof of VII (2.6), page 218, in the subarc configuration also used +on page 230 in VII (4.6). -/ +theorem Net.subarc_contacts_le_cutting_contacts + {S : Type*} [TopologicalSpace S] (hS : IsSurface S) + (N : Net S) (i : Fin N.r) (u v : unitInterval) + (hu : 0 < u) (huv : u < v) (hv : v < 1) + {G : Drawing S} (hMin : N.IsMinimalFor G) + {F : Set N.D} (hF : IsLineWithEnds F (N.f i u) (N.f i v)) + (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) + {G_D : Drawing N.D} (hPull : IsPullbackDrawing N.φ G G_D) + (hNormal : G_D.IsNormal F) : + (N.φ '' ((N.f i '' Icc u v) \ {N.f i u, N.f i v}) ∩ G.V).ncard ≤ + (N.φ '' (F \ {N.f i u, N.f i v}) ∩ G.V).ncard := by + obtain ⟨M, hM, _, _, hBalance⟩ := + N.exists_swap_subarc hS i u v hu huv hv hMin.1 hF hFbd hPull hNormal + have hle := hMin.2.1 M hM + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapArcs.lean b/LeanPool/GraphMinor/GM07/NetSwapArcs.lean new file mode 100644 index 0000000000..933c076063 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapArcs.lean @@ -0,0 +1,314 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CrossCut +public import LeanPool.GraphMinor.Surface.ArcTools +public import Mathlib.Topology.Path +public import Mathlib.Topology.Subpath + +/-! +# Joining the replacement sides of the net + +For VII (2.6), page 218, the new paired sides join the two +outer parts of each old side to a lift of the cutting line. +Two injective paths joined at their only common point still +form an injective path. The common point has parameter one +on the first path and zero on the second, so the two global +parameters agree there as well. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Surface + +/-- Joining two arc paths at their only common end gives an +arc path. This is used for the replacement sides in the net +exchange of VII (2.6), page 218. -/ +theorem isArcMap_path_trans + {X : Type*} [TopologicalSpace X] {x y z : X} + (a : Path x y) (b : Path y z) (ha : IsArcMap a) (hb : IsArcMap b) + (hmeet : ∀ s t, a s = b t → s = 1 ∧ t = 0) : IsArcMap (a.trans b) := by + refine ⟨(a.trans b).continuous, ?_⟩ + intro s t heq + rw [Path.trans_apply, Path.trans_apply] at heq + split_ifs at heq with hs ht + · have h := congrArg Subtype.val (ha.2 heq) + exact Subtype.ext (by dsimp at h; linarith) + · obtain ⟨h1, h0⟩ := hmeet _ _ heq + have h1' := congrArg Subtype.val h1 + have h0' := congrArg Subtype.val h0 + exact Subtype.ext (by dsimp at h1' h0'; linarith) + · obtain ⟨h1, h0⟩ := hmeet _ _ heq.symm + have h1' := congrArg Subtype.val h1 + have h0' := congrArg Subtype.val h0 + exact Subtype.ext (by dsimp at h1' h0'; linarith) + · have h := congrArg Subtype.val (hb.2 heq) + exact Subtype.ext (by dsimp at h; linarith) + +/-- An increasing restriction of an arc path remains an arc. +This parametrizes the outer pieces of a side in VII (2.6). -/ +theorem isArcMap_subpath_of_lt + {X : Type*} [TopologicalSpace X] {x y : X} (a : Path x y) (ha : IsArcMap a) + {u v : unitInterval} (huv : u < v) : IsArcMap (a.subpath u v) := by + refine ⟨(a.subpath u v).continuous, ?_⟩ + intro s t heq + have h := congrArg Subtype.val (ha.2 heq) + change ((1 - s.val) * u.val + s.val * v.val) = + ((1 - t.val) * u.val + t.val * v.val) at h + have hmul : (v.val - u.val) * s.val = (v.val - u.val) * t.val := by + nlinarith only [h] + have huvR : u.val < v.val := huv + exact Subtype.ext (mul_left_cancel₀ (sub_pos.mpr huvR).ne' hmul) + +/-- The range-intersection form of injective path concatenation, +used when the side pieces have only their common end in common. -/ +theorem isArcMap_path_trans_of_range_inter + {X : Type*} [TopologicalSpace X] {x y z : X} + (a : Path x y) (b : Path y z) (ha : IsArcMap a) (hb : IsArcMap b) + (hmeet : Set.range a ∩ Set.range b = {y}) : IsArcMap (a.trans b) := by + apply isArcMap_path_trans a b ha hb + intro s t heq + have hsy : a s = y := Set.mem_singleton_iff.mp + (hmeet.subset ⟨Set.mem_range_self s, ⟨t, heq.symm⟩⟩) + have hty : b t = y := heq.symm.trans hsy + exact ⟨ha.2 (hsy.trans a.target.symm), hb.2 (hty.trans b.source.symm)⟩ + +/-- Replace an interior subarc by a new arc meeting the old arc +only at the two cut points. The two outer pieces and the new +arc form the replacement side used in VII (2.6), page 218. -/ +theorem isArcMap_spliced_path + {X : Type*} [TopologicalSpace X] {x y : X} (a : Path x y) (ha : IsArcMap a) + {u v : unitInterval} (hu : 0 < u) (huv : u < v) (hv : v < 1) + (c : Path (a u) (a v)) (hc : IsArcMap c) + (hcut : Set.range c ∩ Set.range a = {a u, a v}) : + IsArcMap (((a.subpath 0 u).trans c).trans (a.subpath v 1)) := by + have hl := isArcMap_subpath_of_lt a ha hu + have hr := isArcMap_subpath_of_lt a ha hv + have hleft : Set.range (a.subpath 0 u) = a '' Set.Icc 0 u := + Path.range_subpath_of_le a 0 u (unitInterval.nonneg u) + have hright : Set.range (a.subpath v 1) = a '' Set.Icc v 1 := + Path.range_subpath_of_le a v 1 (unitInterval.le_one v) + have hLC : Set.range (a.subpath 0 u) ∩ Set.range c = {a u} := by + apply Set.Subset.antisymm + · rintro z ⟨hzL, hzC⟩ + obtain ⟨s, hs, rfl⟩ := hleft.subset hzL + have hsC := hcut.subset ⟨hzC, Set.mem_range_self s⟩ + rcases hsC with heq | heq + · exact heq + · have hsv : s = v := ha.2 (Set.mem_singleton_iff.mp heq) + exact False.elim ((not_le_of_gt huv) (hsv ▸ hs.2)) + · rintro z rfl + exact ⟨⟨1, (a.subpath 0 u).target⟩, ⟨0, c.source⟩⟩ + have hlc : IsArcMap ((a.subpath 0 u).trans c) := + isArcMap_path_trans_of_range_inter _ _ hl hc hLC + have hLCR : Set.range ((a.subpath 0 u).trans c) ∩ Set.range (a.subpath v 1) = {a v} := by + apply Set.Subset.antisymm + · rintro z ⟨hzLC, hzR⟩ + obtain ⟨t, ht, rfl⟩ := hright.subset hzR + rw [Path.trans_range] at hzLC + rcases hzLC with hzL | hzC + · obtain ⟨s, hs, hst⟩ := hleft.subset hzL + have heq : s = t := ha.2 hst + exact False.elim ((not_le_of_gt huv) (ht.1.trans (heq ▸ hs.2))) + · have htC := hcut.subset ⟨hzC, Set.mem_range_self t⟩ + rcases htC with heq | heq + · have htu : t = u := ha.2 heq + exact False.elim ((not_le_of_gt huv) (htu ▸ ht.1)) + · exact heq + · rintro z rfl + exact ⟨⟨1, ((a.subpath 0 u).trans c).target⟩, ⟨0, (a.subpath v 1).source⟩⟩ + exact isArcMap_path_trans_of_range_inter _ _ hlc hr hLCR + +/-- Three side pieces give an arc when adjacent pieces meet only +at the joining ends and the two outer pieces are disjoint. -/ +theorem isArcMap_three_paths + {X : Type*} [TopologicalSpace X] {w x y z : X} + (a : Path w x) (b : Path x y) (c : Path y z) + (ha : IsArcMap a) (hb : IsArcMap b) (hc : IsArcMap c) + (hab : Set.range a ∩ Set.range b = {x}) + (hbc : Set.range b ∩ Set.range c = {y}) + (hac : Disjoint (Set.range a) (Set.range c)) : IsArcMap ((a.trans b).trans c) := by + have habc : Set.range (a.trans b) ∩ Set.range c = {y} := by + rw [Path.trans_range, Set.union_inter_distrib_right, hac.inter_eq, Set.empty_union, hbc] + exact isArcMap_path_trans_of_range_inter _ _ + (isArcMap_path_trans_of_range_inter _ _ ha hb hab) hc habc + +/-- Pointwise agreement of the images of two pairs of paths is +preserved by their concatenation. The paired replacement sides +therefore retain the old net's pasting equations. -/ +theorem image_path_trans_eq + {X Y : Type*} [TopologicalSpace X] (φ : X → Y) + {x₁ y₁ z₁ x₂ y₂ z₂ : X} + (a₁ : Path x₁ y₁) (b₁ : Path y₁ z₁) (a₂ : Path x₂ y₂) (b₂ : Path y₂ z₂) + (ha : ∀ t, φ (a₁ t) = φ (a₂ t)) (hb : ∀ t, φ (b₁ t) = φ (b₂ t)) : + ∀ t, φ ((a₁.trans b₁) t) = φ ((a₂.trans b₂) t) := by + intro t + rw [Path.trans_apply, Path.trans_apply] + split_ifs + · exact ha _ + · exact hb _ + +/-- The affine parametrization of a side piece has exactly the +closed parameter interval as its image. -/ +theorem range_pieceA_unitInterval + {X : Type*} (a : unitInterval → X) + (u v : unitInterval) (huv : u ≤ v) : + Set.range (pieceA a u.val v.val) = a '' Set.Icc u v := by + rw [range_pieceA a u.property.1 huv v.property.2] + apply Set.Subset.antisymm + · rintro x ⟨r, hr, rfl⟩ + have hr0 : 0 ≤ r := u.property.1.trans hr.1 + have hr1 : r ≤ 1 := hr.2.trans v.property.2 + exact ⟨⟨r, hr0, hr1⟩, hr, (extI_of_mem a ⟨hr0, hr1⟩).symm⟩ + · rintro x ⟨t, ht, rfl⟩ + exact ⟨t.val, ht, extI_coe a t⟩ + +/-- Regard a path contained in a cut piece as a path in that +piece, with the induced topology. -/ +@[expose] def pathWithinSet + {X : Type*} [TopologicalSpace X] {x y : X} (a : Path x y) + {A : Set X} (hA : ∀ t, a t ∈ A) : + Path (⟨x, a.source ▸ hA 0⟩ : A) ⟨y, a.target ▸ hA 1⟩ where + toFun t := ⟨a t, hA t⟩ + continuous_toFun := a.continuous.subtype_mk _ + source' := Subtype.ext a.source + target' := Subtype.ext a.target + +/-- Passing to the topology of a cut piece preserves an arc's +injectivity and continuity. -/ +theorem isArcMap_pathWithinSet + {X : Type*} [TopologicalSpace X] {x y : X} (a : Path x y) (ha : IsArcMap a) + {A : Set X} (hA : ∀ t, a t ∈ A) : IsArcMap (pathWithinSet a hA) := by + exact ⟨(pathWithinSet a hA).continuous, fun s t h => ha.2 (congrArg Subtype.val h)⟩ + +/-- The side-piece parametrization and the subpath operation +use the same increasing affine parameter. -/ +theorem pieceA_eq_subpath + {X : Type*} [TopologicalSpace X] {x y : X} (a : Path x y) + (u v : unitInterval) : pieceA a u.val v.val = (a.subpath u v : unitInterval → X) := by + funext t + change extI a (u.val + t.val * (v.val - u.val)) = a (Icc.convexComb u v t) + have harg : u.val + t.val * (v.val - u.val) = (Icc.convexComb u v t).val := by + rw [Icc.coe_convexComb] + ring + rw [harg, extI_coe] + +/-- Two side pieces use the same parameter in the old interval. +The common parameter lies between the subarc endpoints. -/ +theorem pieceA_common_parameter + {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + (a : Curve X) (b : Curve Y) (u v : unitInterval) (huv : u ≤ v) (t : unitInterval) : + ∃ w ∈ Icc u v, pieceA a u.val v.val t = a w ∧ pieceA b u.val v.val t = b w := by + let ap : Path (a 0) (a 1) := { toContinuousMap := a, source' := rfl, target' := rfl } + let bp : Path (b 0) (b 1) := { toContinuousMap := b, source' := rfl, target' := rfl } + refine ⟨Icc.convexComb u v t, ⟨Icc.le_convexComb huv t, Icc.convexComb_le huv t⟩, ?_, ?_⟩ + · change pieceA ap u.val v.val t = _ + rw [pieceA_eq_subpath] + rfl + · change pieceA bp u.val v.val t = _ + rw [pieceA_eq_subpath] + rfl + +/-- Every old parameter between the subarc endpoints occurs at +a common parameter of both side pieces. -/ +theorem exists_pieceA_common_parameter + {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + (a : Curve X) (b : Curve Y) (u v t : unitInterval) (ht : t ∈ Icc u v) : + ∃ r, pieceA a u.val v.val r = a t ∧ pieceA b u.val v.val r = b t := by + obtain ⟨r, hr⟩ : ∃ r, t = Icc.convexComb u v r := + ⟨_, Icc.eq_convexComb ht.1 ht.2⟩ + let ap : Path (a 0) (a 1) := { toContinuousMap := a, source' := rfl, target' := rfl } + let bp : Path (b 0) (b 1) := { toContinuousMap := b, source' := rfl, target' := rfl } + refine ⟨r, ?_, ?_⟩ + · change pieceA ap u.val v.val r = _ + rw [pieceA_eq_subpath, hr] + rfl + · change pieceA bp u.val v.val r = _ + rw [pieceA_eq_subpath, hr] + rfl + +/-- The image of a map into a cut piece is the image of its +range in that piece. This records the ranges of the spliced +side maps without changing their parameters. -/ +theorem range_map_into_set + {I X Y : Type*} (a : I → X) {A : Set X} (ha : ∀ t, a t ∈ A) (f : A → Y) : + range (fun t => f ⟨a t, ha t⟩) = f '' {x : A | x.val ∈ range a} := by + apply Subset.antisymm + · rintro y ⟨t, rfl⟩ + exact ⟨⟨a t, ha t⟩, mem_range_self t, rfl⟩ + · rintro y ⟨x, ⟨t, ht⟩, rfl⟩ + exact ⟨t, congrArg f (Subtype.ext ht)⟩ + +/-- The open part of a side piece corresponds exactly to the +open parameter interval. Its endpoints are excluded on both +sides of this equation. -/ +theorem image_pieceA_Ioo_unitInterval + {X : Type*} (a : unitInterval → X) + (u v : unitInterval) (huv : u < v) : + pieceA a u.val v.val '' Ioo (0 : unitInterval) 1 = a '' Ioo u v := by + have huvR : u.val < v.val := huv + have hd : 0 < v.val - u.val := sub_pos.mpr huvR + apply Subset.antisymm + · rintro x ⟨r, hr, rfl⟩ + have hr0 : 0 < r.val := hr.1 + have hr1 : r.val < 1 := hr.2 + have hm0 := mul_pos hr0 hd + have hm1 := mul_lt_mul_of_pos_right hr1 hd + let w : unitInterval := ⟨u.val + r.val * (v.val - u.val), + by linarith [u.property.1], by linarith [v.property.2]⟩ + refine ⟨w, ⟨?_, ?_⟩, ?_⟩ + · change u.val < u.val + r.val * (v.val - u.val) + linarith + · change u.val + r.val * (v.val - u.val) < v.val + linarith + · exact (extI_of_mem a w.property).symm + · rintro x ⟨t, ht, rfl⟩ + have hut : u.val < t.val := ht.1 + have htv : t.val < v.val := ht.2 + let r : unitInterval := ⟨(t.val - u.val) / (v.val - u.val), + (div_pos (sub_pos.mpr hut) hd).le, + (div_lt_one hd).mpr (by linarith) |>.le⟩ + have hr0 : 0 < r := div_pos (sub_pos.mpr hut) hd + have hr1 : r < 1 := (div_lt_one hd).mpr (by linarith) + refine ⟨r, ⟨hr0, hr1⟩, ?_⟩ + change extI a (u.val + r.val * (v.val - u.val)) = a t + have harg : u.val + r.val * (v.val - u.val) = t.val := by + dsimp [r] + rw [div_mul_cancel₀ _ hd.ne'] + ring + rw [harg, extI_coe] + +/-- If an arc's open part misses another set, their intersection +consists only of its two endpoints. -/ +theorem range_inter_subset_endpoints + {X : Type*} (a : unitInterval → X) {K : Set X} + (h : ∀ t ∈ Ioo (0 : unitInterval) 1, a t ∉ K) : + range a ∩ K ⊆ {a 0, a 1} := by + rintro x ⟨⟨t, rfl⟩, hx⟩ + by_cases ht0 : 0 < t + · by_cases ht1 : t < 1 + · exact (h t ⟨ht0, ht1⟩ hx).elim + · have ht : t = 1 := le_antisymm (unitInterval.le_one t) (le_of_not_gt ht1) + exact Or.inr (ht ▸ rfl) + · have ht : t = 0 := le_antisymm (le_of_not_gt ht0) (unitInterval.nonneg t) + exact Or.inl (ht ▸ rfl) + +/-- An injective interval map has no endpoint in its open part. -/ +theorem not_mem_endpoints_of_injective + {X : Type*} {a : unitInterval → X} (ha : Function.Injective a) + {t : unitInterval} (ht : t ∈ Ioo (0 : unitInterval) 1) : + a t ∉ ({a 0, a 1} : Set X) := by + rintro (h0 | h1) + · exact (ne_of_gt ht.1) (ha h0) + · exact (ne_of_lt ht.2) (ha (mem_singleton_iff.mp h1)) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapAssembly.lean b/LeanPool/GraphMinor/GM07/NetSwapAssembly.lean new file mode 100644 index 0000000000..cbd3971a23 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapAssembly.lean @@ -0,0 +1,101 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.GM07.NetSwapFamily +import LeanPool.GraphMinor.GM07.NetSwapFibers +import LeanPool.GraphMinor.GM07.NetSwapEquivalence + +/-! +# Packaging the exchanged disc as a net + +The cut-and-paste maps of VII (2.6), page 218, give a genuine +net: the replacement side family supplies the boundary arcs, +and the fiber calculations verify both identification conditions. +The number of paired sides and the seam vertices stay unchanged. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface +universe u + +/-- Package the actual cut-and-paste maps as a net for the same +surface, with the same number of pairs and the same seam vertices. +All net fields are proved from the cut configuration, as required +by the new-net construction in VII (2.6), page 218. -/ +theorem Net.exists_swap_net_of_maps + {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] + (N : Net S) (hSurface : IsSurface T) + (hDisc : IsClosedDisc (univ : Set T)) (i : Fin N.r) (u v : unitInterval) + (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F C A B : Set N.D} (hF : IsLineWithEnds F (N.f i u) (N.f i v)) + (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) + (hAB : A ∪ B = univ) (hI : A ∩ B = F) + (hAd : discBd A = range (pieceA (N.f i) u.val v.val) ∪ F) + (hcover : range (pieceA (N.f i) u.val v.val) ∪ C = bd N.D) + (hBd : discBd B = C ∪ F) + (α : A → T) (β : B → T) (hcα : Continuous α) (hcβ : Continuous β) + (hiα : Function.Injective α) (hiβ : Function.Injective β) + (hT : range α ∪ range β = univ) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ + ∃ t, x.val = pieceA (N.f i) u.val v.val t ∧ y.val = pieceA (N.g i) u.val v.val t) + (hαbd : ∀ x : A, α x ∈ bd T ↔ x.val ∈ discBd A ∧ + x.val ∉ pieceA (N.f i) u.val v.val '' Ioo (0 : unitInterval) 1) + (hβbd : ∀ y : B, β y ∈ bd T ↔ y.val ∈ discBd B ∧ + y.val ∉ pieceA (N.g i) u.val v.val '' Ioo (0 : unitInterval) 1) + (φ : T → S) (hφ : Topology.IsQuotientMap φ) (hφA : ∀ x : A, φ (α x) = N.φ x.val) + (hφB : ∀ y : B, φ (β y) = N.φ y.val) : + ∃ M : Net S, ∃ e : T ≃ₜ M.D, + M.r = N.r ∧ M.φ ∘ e = φ ∧ M.seamV = N.seamV := by + obtain ⟨f, g, hfi, hgi, hfbd, hgbd, hff, hgg, hfg, hgf, hpair, hends, + hotherf, hotherg, hfr, hgr⟩ := + N.exists_replacement_side_family i u v hu huv hv hF hFbd hI hAd hcover hBd + α β hcα hcβ hiα hiβ hcross hαbd hβbd φ hφA hφB + have hInterior := N.swap_map_interior_inj i u v hu huv hv hFbd hI hAd hBd hcover + α β hT hcross hαbd hβbd φ hφA hφB + have hEquiv := N.swap_map_eqvGen i u v hu huv hv hF hFbd hAB hI hAd hBd hcover + α β hT hcross φ hφA hφB f g hpair hends hotherf hotherg hfr hgr + let M : Net S := + { D := T + topD := inferInstance + isSurface_D := hSurface + isClosedDisc_D := hDisc + r := N.r + f := f + g := g + φ := φ + injective_f := hfi + range_f_subset_bd := hfbd + injective_g := hgi + range_g_subset_bd := hgbd + internally_disjoint_ff := hff + internally_disjoint_gg := hgg + internally_disjoint_fg := hfg + internally_disjoint_gf := hgf + quotientMap_φ := hφ + pasting_eq := hpair + interior_inj := hInterior + bd_eq_iff := hEquiv } + have h0 : ∀ j, φ (f j 0) = N.φ (N.f j 0) := by + intro j + obtain ⟨x, hx, hxf⟩ := (hends j).1 + exact (congrArg φ hxf).symm.trans ((hφB x).trans (congrArg N.φ hx)) + have h1 : ∀ j, φ (f j 1) = N.φ (N.f j 1) := by + intro j + obtain ⟨x, hx, hxf⟩ := (hends j).2.1 + exact (congrArg φ hxf).symm.trans ((hφB x).trans (congrArg N.φ hx)) + refine ⟨M, Homeomorph.refl T, rfl, rfl, ?_⟩ + change {z | ∃ j, φ (f j 0) = z ∨ φ (f j 1) = z} = N.seamV + simp_rw [h0, h1] + rfl + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapBasic.lean b/LeanPool/GraphMinor/GM07/NetSwapBasic.lean new file mode 100644 index 0000000000..c44da51a58 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapBasic.lean @@ -0,0 +1,141 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.MinimalNet +import Mathlib.Data.Set.Card + +/-! +# Fibers and contacts for exchanging a net side + +In VII (2.6), page 218, pasting a paired boundary subarc and +cutting along a proper line replaces part of the seam. The +open interval of a paired side has exactly two preimages at +each image point. This applies at the ends of the subarc too +when they are inside the original side. These fiber equations +supply the contact counts without an extra endpoint allowance. +Normality of the new seam follows from normality of the old +seam and of the image of the cutting line. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- Every point in the open interval of a paired net side has +exactly its two paired points as preimages. This includes an +endpoint of a smaller subarc used in VII (2.6), page 218. -/ +theorem Net.fiber_eq_pair_of_mem_Ioo (N : Net S) (i : Fin N.r) + {t : unitInterval} (ht : t ∈ Ioo (0 : unitInterval) 1) : + N.φ ⁻¹' {N.φ (N.f i t)} = {N.f i t, N.g i t} := by + have hclosed : ∀ j s, N.f j s ∈ ({N.f i t, N.g i t} : Set N.D) ↔ + N.g j s ∈ ({N.f i t, N.g i t} : Set N.D) := by + intro j s + simp only [mem_insert_iff, mem_singleton_iff] + constructor + · rintro (h | h) + · obtain ⟨rfl, rfl⟩ := N.f_eq_iff ht h.symm + exact .inr rfl + · exact False.elim (N.internally_disjoint_gf i j t ht ⟨s, h⟩) + · rintro (h | h) + · exact False.elim (N.internally_disjoint_fg i j t ht ⟨s, h⟩) + · obtain ⟨rfl, rfl⟩ := N.g_eq_iff ht h.symm + exact .inl rfl + ext x + constructor + · intro hx + exact N.mem_of_eq hclosed (mem_singleton_iff.mp hx).symm (Or.inl rfl) + · rintro (rfl | rfl) + · exact mem_singleton _ + · exact (N.pasting_eq i t).symm + +/-- The two preimages at an interior point of a paired side +remain distinct, including at subarc endpoints. -/ +theorem Net.fiber_ncard_two_of_mem_Ioo (N : Net S) (i : Fin N.r) + {t : unitInterval} (ht : t ∈ Ioo (0 : unitInterval) 1) : + (N.φ ⁻¹' {N.φ (N.f i t)}).ncard = 2 := by + rw [N.fiber_eq_pair_of_mem_Ioo i ht] + exact ncard_pair (fun h => N.internally_disjoint_fg i i t ht ⟨t, h.symm⟩) + +/-- The associated surjection is injective on one open paired +side, so its graph-contact count counts distinct image points. -/ +theorem Net.injOn_image_open_side (N : Net S) (i : Fin N.r) : + InjOn N.φ (N.f i '' Ioo (0 : unitInterval) 1) := by + rintro x ⟨t, ht, rfl⟩ y ⟨s, hs, rfl⟩ heq + have hy : N.f i s ∈ ({N.f i t, N.g i t} : Set N.D) := by + rw [← N.fiber_eq_pair_of_mem_Ioo i ht] + exact heq.symm + rcases hy with h | h + · exact h.symm + · exact False.elim (N.internally_disjoint_gf i i t ht ⟨s, mem_singleton_iff.mp h⟩) + +/-- At a point of the cutting line, the old fiber is a singleton +except at its two ends, where the other point is on the selected mate. +This describes all fibers used to compare the two replacement sides +in VII (2.6), page 218. -/ +theorem Net.fiber_of_cutting_line_point (N : Net S) (i : Fin N.r) + {u v : unitInterval} (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F : Set N.D} (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) + {x y : N.D} (hx : x ∈ F) (hxy : N.φ x = N.φ y) : + y = x ∨ (x = N.f i u ∧ y = N.g i u) ∨ (x = N.f i v ∧ y = N.g i v) := by + by_cases hxbd : x ∈ bd N.D + · rcases hFbd.subset ⟨hx, hxbd⟩ with hxu | hxv + · have hy : y ∈ ({N.f i u, N.g i u} : Set N.D) := by + rw [← N.fiber_eq_pair_of_mem_Ioo i ⟨hu, huv.trans hv⟩] + exact hxy.symm.trans (congrArg N.φ hxu) + rcases hy with hy | hy + · exact Or.inl (hy.trans hxu.symm) + · exact Or.inr (Or.inl ⟨hxu, mem_singleton_iff.mp hy⟩) + · have hxv' := mem_singleton_iff.mp hxv + have hy : y ∈ ({N.f i v, N.g i v} : Set N.D) := by + rw [← N.fiber_eq_pair_of_mem_Ioo i ⟨hu.trans huv, hv⟩] + exact hxy.symm.trans (congrArg N.φ hxv') + rcases hy with hy | hy + · exact Or.inl (hy.trans hxv'.symm) + · exact Or.inr (Or.inr ⟨hxv', mem_singleton_iff.mp hy⟩) + · exact Or.inl (N.interior_inj x hxbd y hxy).symm + +/-- The old associated map is injective on the whole cutting line +between two distinct interior points of a side, including its ends. +Thus its image is a line, not a loop, in this subarc exchange. -/ +theorem Net.injOn_cutting_line (N : Net S) (i : Fin N.r) + {u v : unitInterval} (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F : Set N.D} (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) : InjOn N.φ F := by + have hFg : ∀ t ∈ Ioo (0 : unitInterval) 1, N.g i t ∉ F := by + intro t ht htF + have htbd := N.range_g_subset_bd i (mem_range_self t) + rcases hFbd.subset ⟨htF, htbd⟩ with htu | htv + · exact N.internally_disjoint_gf i i t ht ⟨u, htu.symm⟩ + · exact N.internally_disjoint_gf i i t ht ⟨v, (mem_singleton_iff.mp htv).symm⟩ + intro x hx y hy hxy + rcases N.fiber_of_cutting_line_point i hu huv hv hFbd hx hxy with h | ⟨_, h⟩ | ⟨_, h⟩ + · exact h.symm + · exact (hFg u ⟨hu, huv.trans hv⟩ (h ▸ hy)).elim + · exact (hFg v ⟨hu.trans huv, hv⟩ (h ▸ hy)).elim + +/-- Pullback normality of a cutting line gives normality of its +image in the original surface, as required in VII (2.6). -/ +theorem Net.normal_image_of_pullback {N : Net S} {G : Drawing S} + {G_D : Drawing N.D} (hPull : IsPullbackDrawing N.φ G G_D) + {F : Set N.D} (hF : G_D.IsNormal F) : G.IsNormal (N.φ '' F) := by + rintro x ⟨⟨y, hy, rfl⟩, hxU⟩ + have hyU : y ∈ G_D.U := hPull.1.symm ▸ hxU + have hyV := hF ⟨hy, hyU⟩ + change y ∈ N.φ ⁻¹' G.V + rw [← hPull.2] + exact hyV + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapBoundary.lean b/LeanPool/GraphMinor/GM07/NetSwapBoundary.lean new file mode 100644 index 0000000000..250a9a2d4b --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapBoundary.lean @@ -0,0 +1,137 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.Surface.DiscUnion +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.GM14.WhitneyFaces + +/-! +# Cutting the source disc with a specified boundary arc + +The net exchange of VII (2.6), page 218, cuts along a proper +line. One of its two pieces has as boundary that line and the +selected subarc of the paired side. Extend the selected subarc +to the two boundary arcs of the disc, then cut using those arcs. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Surface + +/-- Complete a parametrized boundary arc of a closed disc to its +other boundary arc, keeping both ends. This fixes the side of +the cut used in VII (2.6), page 218. -/ +theorem exists_complementary_disc_boundary_arc + {S : Type*} [TopologicalSpace S] {D : Set S} (hD : IsClosedDisc D) + (f : unitInterval → S) (hf : IsArcMap f) (hfbd : range f ⊆ discBd D) : + ∃ g : unitInterval → S, IsArcMap g ∧ g 0 = f 0 ∧ g 1 = f 1 ∧ + range f ∪ range g = discBd D ∧ + ∀ s t, f s = g t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + obtain ⟨h, k, c⟩ := hD.exists_isChart + have hfD : ∀ t, f t ∈ D := fun t => discBd_subset D (hfbd ⟨t, rfl⟩) + let f₀ : unitInterval → ℂ := h ∘ f + have hf₀ : IsArcMap f₀ := + ⟨c.hc.comp_continuous hf.1 hfD, + fun s t heq => hf.2 (c.gh.injOn (hfD s) (hfD t) heq)⟩ + have hf₀bd : range f₀ ⊆ sphere (0 : ℂ) 1 := by + rintro _ ⟨t, rfl⟩ + rw [← c.bd] + exact mem_image_of_mem h (hfbd ⟨t, rfl⟩) + obtain ⟨φ⟩ := oArc_sphere + obtain ⟨g₀, hg₀, hg0, hg1, hcover, hmeet⟩ := exists_other_arc φ hf₀ hf₀bd + have hg₀bd : ∀ t, g₀ t ∈ sphere (0 : ℂ) 1 := + fun t => hcover ▸ Or.inr (mem_range_self t) + have hg₀D : ∀ t, g₀ t ∈ closedBall (0 : ℂ) 1 := + fun t => sphere_subset_closedBall (hg₀bd t) + let g : unitInterval → S := k ∘ g₀ + have hg : IsArcMap g := + ⟨c.gc.comp_continuous hg₀.1 hg₀D, + fun s t heq => hg₀.2 (c.hg.injOn (hg₀D s) (hg₀D t) heq)⟩ + have hg_bd : ∀ t, g t ∈ discBd D := by + intro t + rw [← c.g_sphere] + exact mem_image_of_mem k (hg₀bd t) + refine ⟨g, hg, ?_, ?_, ?_, ?_⟩ + · change k (g₀ 0) = f 0 + rw [hg0] + exact c.gh (hfD 0) + · change k (g₀ 1) = f 1 + rw [hg1] + exact c.gh (hfD 1) + · apply Subset.antisymm + · rintro x (⟨t, rfl⟩ | ⟨t, rfl⟩) + · exact hfbd ⟨t, rfl⟩ + · exact hg_bd t + · intro x hx + have hhx : h x ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem h hx + rcases hcover.symm ▸ hhx with ⟨t, ht⟩ | ⟨t, ht⟩ + · exact Or.inl ⟨t, c.gh.injOn (hfD t) (discBd_subset D hx) ht⟩ + · refine Or.inr ⟨t, ?_⟩ + change k (g₀ t) = x + rw [ht] + exact c.gh (discBd_subset D hx) + · intro s t heq + apply hmeet s t + change h (f s) = g₀ t + rw [heq] + exact c.hg (hg₀D t) + +/-- Cut a disc along a proper line while specifying which +boundary arc belongs to its first piece. This is the cutting +step of VII (2.6), page 218. -/ +theorem exists_disc_cut_with_boundary_arc + {S : Type*} [TopologicalSpace S] [T2Space S] {D F : Set S} + (hD : IsClosedDisc D) (f : unitInterval → S) (hf : IsArcMap f) + (hfbd : range f ⊆ discBd D) (hF : IsLineWithEnds F (f 0) (f 1)) + (hFD : F ⊆ D) (hFbd : F ∩ discBd D = {f 0, f 1}) : + ∃ C A B : Set S, IsLineWithEnds C (f 0) (f 1) ∧ + range f ∪ C = discBd D ∧ IsClosedDisc A ∧ IsClosedDisc B ∧ + A ∪ B = D ∧ A ∩ B = F ∧ + discBd A = range f ∪ F ∧ discBd B = C ∪ F ∧ + discBd D \ range f ⊆ B := by + obtain ⟨g, hg, hg0, hg1, hcover, hmeet⟩ := + exists_complementary_disc_boundary_arc hD f hf hfbd + have hfg : range f ∩ range g = {f 0, f 1} := by + apply Subset.antisymm + · rintro x ⟨⟨s, rfl⟩, ⟨t, ht⟩⟩ + rcases hmeet s t ht.symm with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl rfl + · exact Or.inr rfl + · rintro x (rfl | rfl) + · exact ⟨mem_range_self 0, ⟨0, hg0⟩⟩ + · exact ⟨mem_range_self 1, ⟨1, hg1⟩⟩ + have hLf : F ∩ range f = {f 0, f 1} := by + apply Subset.antisymm + · exact fun x hx => hFbd.subset ⟨hx.1, hfbd hx.2⟩ + · rintro x (rfl | rfl) + · exact ⟨hF.left_mem, mem_range_self 0⟩ + · exact ⟨hF.right_mem, mem_range_self 1⟩ + have hLg : F ∩ range g = {f 0, f 1} := by + apply Subset.antisymm + · exact fun x hx => hFbd.subset ⟨hx.1, hcover ▸ Or.inr hx.2⟩ + · rintro x (rfl | rfl) + · exact ⟨hF.left_mem, ⟨0, hg0⟩⟩ + · exact ⟨hF.right_mem, ⟨1, hg1⟩⟩ + have hgL : IsLineWithEnds (range g) (f 0) (f 1) := by + simpa only [hg0, hg1] using hg.isLineWithEnds + have hne : f 0 ≠ f 1 := fun h => zero_ne_one (hf.2 h) + obtain ⟨A, B, hA, hB, hAB, hI, hbA, hbB⟩ := GM14.Whitney.disc_split hD hF + hf.isLineWithEnds hgL hfg hLf hLg hcover.symm hFD hne + refine ⟨range g, A, B, hgL, hcover, hA, hB, hAB, hI, hbA, hbB, ?_⟩ + intro x hx + have hxg : x ∈ range g := (hcover.symm ▸ hx.1).resolve_left hx.2 + exact discBd_subset B (hbB ▸ Or.inl hxg) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapContactBalance.lean b/LeanPool/GraphMinor/GM07/NetSwapContactBalance.lean new file mode 100644 index 0000000000..b88d006e31 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapContactBalance.lean @@ -0,0 +1,185 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.GM07.MinimalNet +import LeanPool.GraphMinor.GM07.NetSwapBasic +import LeanPool.GraphMinor.GM07.NetSwapArcs +import LeanPool.GraphMinor.GM07.NetSwapSides +import LeanPool.GraphMinor.GM07.NetSwapCounts +import LeanPool.GraphMinor.GM07.NetSwapPastingCounts +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Exact boundary-contact balance for the exchanged net + +Apply the finite cutting and pasting identities to the actual +pieces in VII (2.6), page 218. The endpoint contact sets agree +in the two identities and cancel. The remaining change is twice +the inner cutting-line contacts minus twice the open pasted-arc +contacts, with no allowance for endpoints. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface + +/-- The exact contact balance for the new net of VII (2.6), page 218. +The cutting endpoints contribute equally before cutting and after +pasting, including when their images belong to the finite set `V`. -/ +theorem Net.swap_contact_balance + {S : Type*} [TopologicalSpace S] (N M : Net S) (i : Fin N.r) + (u v : unitInterval) (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F C A B : Set N.D} (hF : IsLineWithEnds F (N.f i u) (N.f i v)) + (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) (hI : A ∩ B = F) + (hAd : discBd A = range (pieceA (N.f i) u.val v.val) ∪ F) + (hBd : discBd B = C ∪ F) + (hcover : range (pieceA (N.f i) u.val v.val) ∪ C = bd N.D) + (α : A → M.D) (β : B → M.D) + (hiα : Function.Injective α) (hiβ : Function.Injective β) + (hT : range α ∪ range β = univ) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ + ∃ t, x.val = pieceA (N.f i) u.val v.val t ∧ + y.val = pieceA (N.g i) u.val v.val t) + (hφA : ∀ x : A, M.φ (α x) = N.φ x.val) + (hφB : ∀ y : B, M.φ (β y) = N.φ y.val) + (hαbd : ∀ x : A, α x ∈ bd M.D ↔ x.val ∈ discBd A ∧ + x.val ∉ pieceA (N.f i) u.val v.val '' Ioo (0 : unitInterval) 1) + (hβbd : ∀ y : B, β y ∈ bd M.D ↔ y.val ∈ discBd B ∧ + y.val ∉ pieceA (N.g i) u.val v.val '' Ioo (0 : unitInterval) 1) + (V : Set S) (hV : V.Finite) : + (bd M.D ∩ M.φ ⁻¹' V).ncard + 2 * (N.φ '' (N.f i '' Ioo u v) ∩ V).ncard = + (bd N.D ∩ N.φ ⁻¹' V).ncard + + 2 * (N.φ '' (F \ {N.f i u, N.f i v}) ∩ V).ncard := by + let a₀ := pieceA (N.f i) u.val v.val + let b₀ := pieceA (N.g i) u.val v.val + have ha₀ : IsArcMap a₀ := isArcMap_pieceA + ⟨(N.f i).continuous, N.injective_f i⟩ u.property.1 huv v.property.2 + have haA : ∀ t, a₀ t ∈ A := + fun t => discBd_subset A (hAd ▸ Or.inl (mem_range_self t)) + obtain ⟨_, hmates, _, _⟩ := N.sides_on_retained_piece i u v hu huv hv hF hcover hBd + have hbBd : ∀ t, b₀ t ∈ discBd B := by + intro t + obtain ⟨w, _, _, hgw⟩ := pieceA_common_parameter (N.f i) (N.g i) u v huv.le t + exact hmates i ⟨w, hgw.symm⟩ + have hbB : ∀ t, b₀ t ∈ B := fun t => discBd_subset B (hbBd t) + let a : unitInterval → A := fun t => ⟨a₀ t, haA t⟩ + let b : unitInterval → B := fun t => ⟨b₀ t, hbB t⟩ + let KA : Set A := {x | x.val ∈ discBd A} + let KB : Set B := {x | x.val ∈ discBd B} + have hai : Function.Injective a := fun s t h => ha₀.2 (congrArg Subtype.val h) + have hcross' : ∀ x y, α x = β y ↔ ∃ t, x = a t ∧ y = b t := by + intro x y + rw [hcross] + constructor + · rintro ⟨t, hxt, hyt⟩ + exact ⟨t, Subtype.ext hxt, Subtype.ext hyt⟩ + · rintro ⟨t, rfl, rfl⟩ + exact ⟨t, rfl, rfl⟩ + have hAO : ∀ x : A, x ∈ a '' Ioo (0 : unitInterval) 1 ↔ + x.val ∈ a₀ '' Ioo (0 : unitInterval) 1 := by + intro x + constructor + · rintro ⟨t, ht, htx⟩ + exact ⟨t, ht, congrArg Subtype.val htx⟩ + · rintro ⟨t, ht, htx⟩ + exact ⟨t, ht, Subtype.ext htx⟩ + have hBO : ∀ y : B, y ∈ b '' Ioo (0 : unitInterval) 1 ↔ + y.val ∈ b₀ '' Ioo (0 : unitInterval) 1 := by + intro y + constructor + · rintro ⟨t, ht, hty⟩ + exact ⟨t, ht, congrArg Subtype.val hty⟩ + · rintro ⟨t, ht, hty⟩ + exact ⟨t, ht, Subtype.ext hty⟩ + have hBoundary : bd M.D = (α '' KA ∪ β '' KB) \ ((α ∘ a) '' Ioo (0 : unitInterval) 1) := by + apply pasted_boundary_eq a b α β hiα hai hcross' hT KA KB _ _ + · intro x + exact (hαbd x).trans (and_congr_right (fun _ => not_congr (hAO x).symm)) + · intro y + exact (hβbd y).trans (and_congr_right (fun _ => not_congr (hBO y).symm)) + have hPAeq : KA ∩ (M.φ ∘ α) ⁻¹' V = + {x : A | x.val ∈ discBd A ∩ N.φ ⁻¹' V} := by + ext x + change (x.val ∈ discBd A ∧ M.φ (α x) ∈ V) ↔ _ + rw [hφA] + rfl + have hPBeq : KB ∩ (M.φ ∘ β) ⁻¹' V = + {x : B | x.val ∈ discBd B ∩ N.φ ⁻¹' V} := by + ext x + change (x.val ∈ discBd B ∧ M.φ (β x) ∈ V) ↔ _ + rw [hφB] + rfl + have hPre := N.finite_preimage_of_finite hV + have hPA : (KA ∩ (M.φ ∘ α) ⁻¹' V).Finite := by + rw [hPAeq] + exact (Set.Finite.preimage Subtype.val_injective.injOn hPre).subset (fun _ h => h.2) + have hPB : (KB ∩ (M.φ ∘ β) ⁻¹' V).Finite := by + rw [hPBeq] + exact (Set.Finite.preimage Subtype.val_injective.injOn hPre).subset (fun _ h => h.2) + have hPACard : (KA ∩ (M.φ ∘ α) ⁻¹' V).ncard = (discBd A ∩ N.φ ⁻¹' V).ncard := by + rw [hPAeq, ncard_subtype] + congr 1 + exact inter_eq_left.mpr (fun _ h => discBd_subset A h.1) + have hPBCard : (KB ∩ (M.φ ∘ β) ⁻¹' V).ncard = (discBd B ∩ N.φ ⁻¹' V).ncard := by + rw [hPBeq, ncard_subtype] + congr 1 + exact inter_eq_left.mpr (fun _ h => discBd_subset B h.1) + have hOE : Disjoint (Ioo (0 : unitInterval) 1) ({0, 1} : Set unitInterval) := by + apply disjoint_left.mpr + rintro t ht (rfl | h1) + · exact lt_irrefl _ ht.1 + · exact ht.2.ne (mem_singleton_iff.mp h1) + have hCover : Ioo (0 : unitInterval) 1 ∪ ({0, 1} : Set unitInterval) = univ := by + apply eq_univ_of_forall + intro t + by_cases ht0 : t = 0 + · exact Or.inr (Or.inl ht0) + by_cases ht1 : t = 1 + · exact Or.inr (Or.inr ht1) + exact Or.inl (Net.mem_Ioo_of_ne ht0 ht1) + have hKA : range a ⊆ KA := by + rintro x ⟨t, rfl⟩ + exact (show a₀ t ∈ discBd A from hAd ▸ Or.inl (mem_range_self t)) + have hKB : range b ⊆ KB := by + rintro y ⟨t, rfl⟩ + exact hbBd t + have hCount := ncard_pasting_contacts a b α β hiα hiβ hai hcross' KA KB hKA hKB + (Ioo (0 : unitInterval) 1) {0, 1} hOE hCover M.φ V hPA hPB + rw [← hBoundary, hPACard, hPBCard] at hCount + have hMap : M.φ ∘ α ∘ a = N.φ ∘ a₀ := funext (fun t => hφA (a t)) + rw [hMap] at hCount + have hτi : Function.Injective (N.φ ∘ a₀) := by + intro s t hst + have hSource : ∀ r, a₀ r ∈ N.f i '' Ioo (0 : unitInterval) 1 := by + intro r + obtain ⟨w, hw, hfw, _⟩ := pieceA_common_parameter (N.f i) (N.g i) u v huv.le r + exact ⟨w, ⟨hu.trans_le hw.1, hw.2.trans_lt hv⟩, hfw.symm⟩ + exact ha₀.2 (N.injOn_image_open_side i (hSource s) (hSource t) hst) + have hOpenCard : (Ioo (0 : unitInterval) 1 ∩ (N.φ ∘ a₀) ⁻¹' V).ncard = + (N.φ '' (N.f i '' Ioo u v) ∩ V).ncard := by + rw [← hτi.injOn.ncard_image, image_inter_preimage] + rw [image_comp, image_pieceA_Ioo_unitInterval (N.f i) u v huv] + have hEndCard : (({0, 1} : Set unitInterval) ∩ (N.φ ∘ a₀) ⁻¹' V).ncard = + ({N.f i u, N.f i v} ∩ N.φ ⁻¹' V).ncard := by + rw [← ha₀.2.injOn.ncard_image] + change (a₀ '' (({0, 1} : Set unitInterval) ∩ a₀ ⁻¹' (N.φ ⁻¹' V))).ncard = _ + rw [image_inter_preimage] + have hEnds : a₀ '' ({0, 1} : Set unitInterval) = {N.f i u, N.f i v} := by + rw [image_pair] + change {pieceA (N.f i) u.val v.val 0, pieceA (N.f i) u.val v.val 1} = _ + rw [pieceA_zero, pieceA_one, extI_coe, extI_coe] + rw [hEnds] + rw [hOpenCard, hEndCard] at hCount + have hCut := N.ncard_cut_piece_contacts i u v hI hAd hBd hcover hFbd V hV + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapCounts.lean b/LeanPool/GraphMinor/GM07/NetSwapCounts.lean new file mode 100644 index 0000000000..a4f922c920 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapCounts.lean @@ -0,0 +1,176 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.GM07.MinimalNet +import Mathlib.Data.Set.Card + +/-! +# Contact counts in the interior of a net disc + +The count in VII (2.6), page 218, uses distinct image points +of the proper cutting line with its ends removed. A net makes +no identifications at these points. Its finite fibers also +make the full preimage of a finite graph vertex set finite. +Thus the boundary and interior contact counts use finite sets. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Surface + +/-- A finite vertex set has finite preimage under the associated +surjection of a net. This justifies the counts in VII (2.6). -/ +theorem Net.finite_preimage_of_finite + {S : Type*} [TopologicalSpace S] (N : Net S) {V : Set S} (hV : V.Finite) : + (N.φ ⁻¹' V).Finite := by + have heq : N.φ ⁻¹' V = ⋃ v ∈ V, N.φ ⁻¹' {v} := by + ext x + simp only [mem_preimage, mem_iUnion, mem_singleton_iff] + exact ⟨fun h => ⟨N.φ x, h, rfl⟩, fun ⟨v, hv, hxv⟩ => hxv.symm ▸ hv⟩ + rw [heq] + exact hV.biUnion (fun v hv => N.finite_fiber v) + +/-- The interior of a proper cutting line has singleton fibers +in the old disc of the net. This is the unpasted term of the +exchange count in VII (2.6), page 218. -/ +theorem Net.preimage_image_line_interior + {S : Type*} [TopologicalSpace S] (N : Net S) + {F : Set N.D} {s t : N.D} (hbd : F ∩ bd N.D = {s, t}) : + N.φ ⁻¹' (N.φ '' (F \ {s, t})) = F \ {s, t} := by + apply Subset.antisymm + · rintro x ⟨y, hy, hyx⟩ + have hybd : y ∉ bd N.D := fun h => hy.2 (hbd.subset ⟨hy.1, h⟩) + exact (N.interior_inj y hybd x hyx) ▸ hy + · exact subset_preimage_image _ _ + +/-- Distinct points of the cutting line away from its ends have +distinct images under the old associated surjection. -/ +theorem Net.injOn_line_interior + {S : Type*} [TopologicalSpace S] (N : Net S) + {F : Set N.D} {s t : N.D} (hbd : F ∩ bd N.D = {s, t}) : + InjOn N.φ (F \ {s, t}) := by + intro x hx y hy heq + have hxbd : x ∉ bd N.D := fun h => hx.2 (hbd.subset ⟨hx.1, h⟩) + exact N.interior_inj x hxbd y heq + +/-- The old disc's interior contact count equals the image count +printed in VII (2.6), page 218. -/ +theorem Net.ncard_line_interior_contacts + {S : Type*} [TopologicalSpace S] (N : Net S) + {F : Set N.D} {s t : N.D} (hbd : F ∩ bd N.D = {s, t}) (V : Set S) : + ((F \ {s, t}) ∩ N.φ ⁻¹' V).ncard = (N.φ '' (F \ {s, t}) ∩ V).ncard := by + have hi := (N.injOn_line_interior hbd).mono (inter_subset_left : + (F \ {s, t}) ∩ N.φ ⁻¹' V ⊆ F \ {s, t}) + rw [← hi.ncard_image, image_inter_preimage] + +/-- When two boundary contact sets are pasted, their common +open arc disappears and their common ends stay once. The +formula isolates the endpoint contribution, which cancels +between cutting and pasting in VII (2.6), page 218. -/ +theorem ncard_boundary_after_pasting + {X : Type*} (P Q E : Set X) (hP : P.Finite) (hQ : Q.Finite) : + ((P ∪ Q) \ ((P ∩ Q) \ E)).ncard + + 2 * ((P ∩ Q) \ E).ncard + ((P ∩ Q) ∩ E).ncard = P.ncard + Q.ncard := by + have hK : (P ∩ Q) \ E ⊆ P ∪ Q := fun x hx => Or.inl hx.1.1 + have hu := ncard_sdiff_add_ncard_of_subset hK (hP.union hQ) + have hi : ((P ∩ Q) \ ((P ∩ Q) ∩ E)).ncard + ((P ∩ Q) ∩ E).ncard = (P ∩ Q).ncard := + ncard_sdiff_add_ncard_of_subset inter_subset_left (hP.subset inter_subset_left) + have heq : (P ∩ Q) \ ((P ∩ Q) ∩ E) = (P ∩ Q) \ E := by + ext x + constructor + · rintro ⟨hx, hn⟩ + exact ⟨hx, fun he => hn ⟨hx, he⟩⟩ + · rintro ⟨hx, hn⟩ + exact ⟨hx, fun he => hn he.2⟩ + rw [heq] at hi + have hsum := ncard_union_add_ncard_inter P Q hP hQ + omega + +/-- Splitting a boundary along a line counts an inner contact twice +and an endpoint contact once in addition to the old boundary count. +This finite-set identity keeps the endpoint contribution exact. -/ +theorem ncard_cut_contacts + {X : Type*} (K A B F E W : Set X) (hW : W.Finite) + (hUnion : A ∪ B = K ∪ F) (hInter : A ∩ B = F) (hEnds : K ∩ F = E) : + (A ∩ W).ncard + (B ∩ W).ncard = + (K ∩ W).ncard + 2 * ((F \ E) ∩ W).ncard + (E ∩ W).ncard := by + have hP : (A ∩ W).Finite := hW.subset inter_subset_right + have hQ : (B ∩ W).Finite := hW.subset inter_subset_right + have hI : (A ∩ W) ∩ (B ∩ W) = F ∩ W := by + rw [← hInter] + ext x + simp only [mem_inter_iff] + tauto + have hU : (A ∩ W) ∪ (B ∩ W) = (K ∪ F) ∩ W := by + rw [← hUnion] + ext x + simp only [mem_inter_iff, mem_union] + tauto + have hEsub : E ⊆ F := hEnds ▸ inter_subset_right + have hRem : ((A ∩ W) ∪ (B ∩ W)) \ (((A ∩ W) ∩ (B ∩ W)) \ E) = K ∩ W := by + rw [hI, hU] + ext x + have he : x ∈ E ↔ x ∈ K ∧ x ∈ F := by rw [← hEnds]; rfl + simp only [mem_sdiff, mem_inter_iff, mem_union] + tauto + have hInner : ((A ∩ W) ∩ (B ∩ W)) \ E = (F \ E) ∩ W := by + rw [hI] + ext x + simp only [mem_sdiff, mem_inter_iff] + tauto + have hEnd : ((A ∩ W) ∩ (B ∩ W)) ∩ E = E ∩ W := by + rw [hI] + ext x + constructor + · exact fun h => ⟨h.2, h.1.2⟩ + · exact fun h => ⟨⟨hEsub h.1, h.2⟩, h.1⟩ + have h := ncard_boundary_after_pasting (A ∩ W) (B ∩ W) E hP hQ + rw [hRem, hInner, hEnd] at h + exact h.symm + +/-- The two cut pieces contain exactly the old boundary contacts, +two copies of each inner cutting-line contact, and one extra copy +of each cutting endpoint. The latter term cancels on pasting, even +when a cutting endpoint is a graph vertex. This is the cutting half +of the count in VII (2.6), page 218. -/ +theorem Net.ncard_cut_piece_contacts + {S : Type*} [TopologicalSpace S] (N : Net S) (i : Fin N.r) + (u v : unitInterval) {F C A B : Set N.D} + (hI : A ∩ B = F) + (hAd : discBd A = range (pieceA (N.f i) u.val v.val) ∪ F) + (hBd : discBd B = C ∪ F) + (hcover : range (pieceA (N.f i) u.val v.val) ∪ C = bd N.D) + (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) + (V : Set S) (hV : V.Finite) : + (discBd A ∩ N.φ ⁻¹' V).ncard + (discBd B ∩ N.φ ⁻¹' V).ncard = + (bd N.D ∩ N.φ ⁻¹' V).ncard + + 2 * (N.φ '' (F \ {N.f i u, N.f i v}) ∩ V).ncard + + ({N.f i u, N.f i v} ∩ N.φ ⁻¹' V).ncard := by + have hUnion : discBd A ∪ discBd B = bd N.D ∪ F := by + rw [hAd, hBd, ← hcover] + ext x + simp only [mem_union] + tauto + have hInter : discBd A ∩ discBd B = F := by + apply Subset.antisymm + · exact fun x hx => hI ▸ ⟨discBd_subset A hx.1, discBd_subset B hx.2⟩ + · intro x hx + exact ⟨hAd ▸ Or.inr hx, hBd ▸ Or.inr hx⟩ + have hEnds : bd N.D ∩ F = {N.f i u, N.f i v} := by rw [inter_comm, hFbd] + have h := ncard_cut_contacts (bd N.D) (discBd A) (discBd B) F + {N.f i u, N.f i v} (N.φ ⁻¹' V) (N.finite_preimage_of_finite hV) hUnion hInter hEnds + rw [N.ncard_line_interior_contacts hFbd V] at h + exact h + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapCut.lean b/LeanPool/GraphMinor/GM07/NetSwapCut.lean new file mode 100644 index 0000000000..ee42e1266f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapCut.lean @@ -0,0 +1,221 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.GM07.NetSwapBoundary +import LeanPool.GraphMinor.GM07.NetSwapPasting +import LeanPool.GraphMinor.Surface.InvarianceOfDomain + +/-! +# The disc and surjection after exchanging a boundary subarc + +For VII (2.6), page 218, cut along the proper line with both +ends inside one paired side. The piece cut off meets the old +boundary in that subarc. Its mate lies on the other piece. +Paste these two arcs by their original parameters and descend +the old associated surjection to the resulting closed disc. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Surface + +/-- Cut maps into the closed unit disc transfer to the net's disc with their fibers and boundary +conditions unchanged. -/ +theorem Net.exists_transported_cut_maps {S : Type*} [TopologicalSpace S] (N : Net S) + {A B : Set N.D} {ψ₀ : A ⊕ B → closedBall (0 : ℂ) 1} {φ₀ : closedBall (0 : ℂ) 1 → S} + {R : A → B → Prop} {P : A → Prop} {Q : B → Prop} + (hψ₀ : IsQuotientMap ψ₀) (hφ₀ : IsQuotientMap φ₀) + (hφA : ∀ x : A, φ₀ (ψ₀ (Sum.inl x)) = N.φ x.val) + (hφB : ∀ y : B, φ₀ (ψ₀ (Sum.inr y)) = N.φ y.val) + (hiA : Function.Injective (ψ₀ ∘ Sum.inl)) (hiB : Function.Injective (ψ₀ ∘ Sum.inr)) + (hcross : ∀ x y, ψ₀ (Sum.inl x) = ψ₀ (Sum.inr y) ↔ R x y) + (hαbd : ∀ x, ψ₀ (Sum.inl x) ∈ bd (closedBall (0 : ℂ) 1) ↔ P x) + (hβbd : ∀ y, ψ₀ (Sum.inr y) ∈ bd (closedBall (0 : ℂ) 1) ↔ Q y) : + ∃ e : closedBall (0 : ℂ) 1 ≃ₜ N.D, + let α : A → N.D := e ∘ ψ₀ ∘ Sum.inl + let β : B → N.D := e ∘ ψ₀ ∘ Sum.inr + let φ : N.D → S := φ₀ ∘ e.symm + Continuous α ∧ Continuous β ∧ Function.Injective α ∧ Function.Injective β ∧ + range α ∪ range β = univ ∧ + (∀ x y, α x = β y ↔ R x y) ∧ + (∀ x, α x ∈ bd N.D ↔ P x) ∧ (∀ y, β y ∈ bd N.D ↔ Q y) ∧ + IsQuotientMap φ ∧ (∀ x, φ (α x) = N.φ x.val) ∧ (∀ y, φ (β y) = N.φ y.val) := by + obtain ⟨e₀⟩ := isClosedDisc_closedBall.1 + obtain ⟨eN⟩ := N.isClosedDisc_D + let e : closedBall (0 : ℂ) 1 ≃ₜ N.D := + e₀.symm.trans (eN.trans (Homeomorph.Set.univ N.D)) + let α : A → N.D := e ∘ ψ₀ ∘ Sum.inl + let β : B → N.D := e ∘ ψ₀ ∘ Sum.inr + let φ : N.D → S := φ₀ ∘ e.symm + have hT : range α ∪ range β = univ := by + apply eq_univ_of_forall + intro z + obtain ⟨w, hw⟩ := hψ₀.surjective (e.symm z) + cases w with + | inl x => exact Or.inl ⟨x, (congrArg e hw).trans (e.apply_symm_apply z)⟩ + | inr y => exact Or.inr ⟨y, (congrArg e hw).trans (e.apply_symm_apply z)⟩ + refine ⟨e, e.continuous.comp (hψ₀.continuous.comp continuous_inl), + e.continuous.comp (hψ₀.continuous.comp continuous_inr), + e.injective.comp hiA, e.injective.comp hiB, hT, + fun x y => e.injective.eq_iff.trans (hcross x y), + fun x => (mem_bd_homeomorph_iff e _).trans (hαbd x), + fun y => (mem_bd_homeomorph_iff e _).trans (hβbd y), + hφ₀.comp e.symm.isQuotientMap, ?_, ?_⟩ + · intro x + change φ₀ (e.symm (e (ψ₀ (Sum.inl x)))) = _ + rw [e.symm_apply_apply] + exact hφA x + · intro y + change φ₀ (e.symm (e (ψ₀ (Sum.inr y)))) = _ + rw [e.symm_apply_apply] + exact hφB y + +/-- Cutting along a proper line between two interior parameters +of one paired side, then pasting that boundary subarc to its +mate, produces a disc with an associated quotient surjection +to the original surface. This is the geometric operation used +in VII (2.6), page 218. -/ +theorem Net.exists_swap_disc + {S : Type*} [TopologicalSpace S] [T2Space S] (N : Net S) (i : Fin N.r) + (u v : unitInterval) (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F : Set N.D} (hF : IsLineWithEnds F (N.f i u) (N.f i v)) + (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) : + ∃ (C A B : Set N.D) (ψ : A ⊕ B → closedBall (0 : ℂ) 1) + (φ : closedBall (0 : ℂ) 1 → S), + IsClosedDisc A ∧ IsClosedDisc B ∧ A ∪ B = univ ∧ A ∩ B = F ∧ + discBd A = range (pieceA (N.f i) u.val v.val) ∪ F ∧ + discBd B = C ∪ F ∧ range (pieceA (N.f i) u.val v.val) ∪ C = bd N.D ∧ + IsQuotientMap ψ ∧ IsQuotientMap φ ∧ + (∀ x : A, φ (ψ (Sum.inl x)) = N.φ x.val) ∧ + (∀ y : B, φ (ψ (Sum.inr y)) = N.φ y.val) ∧ + Function.Injective (ψ ∘ Sum.inl) ∧ Function.Injective (ψ ∘ Sum.inr) ∧ + (∀ (x : A) (y : B), ψ (Sum.inl x) = ψ (Sum.inr y) ↔ + ∃ t, x.val = pieceA (N.f i) u.val v.val t ∧ + y.val = pieceA (N.g i) u.val v.val t) ∧ + (∀ x : A, ψ (Sum.inl x) ∈ bd (closedBall (0 : ℂ) 1) ↔ + x.val ∈ discBd A ∧ x.val ∉ pieceA (N.f i) u.val v.val '' Ioo (0 : unitInterval) 1) ∧ + (∀ y : B, ψ (Sum.inr y) ∈ bd (closedBall (0 : ℂ) 1) ↔ + y.val ∈ discBd B ∧ y.val ∉ pieceA (N.g i) u.val v.val '' Ioo (0 : unitInterval) 1) := by + let : T2Space N.D := N.isSurface_D.2.1 + let f := pieceA (N.f i) u.val v.val + let g := pieceA (N.g i) u.val v.val + have huv' : u.val < v.val := huv + have hf : IsArcMap f := isArcMap_pieceA + ⟨(N.f i).continuous, N.injective_f i⟩ u.property.1 huv' v.property.2 + have hg : IsArcMap g := isArcMap_pieceA + ⟨(N.g i).continuous, N.injective_g i⟩ u.property.1 huv' v.property.2 + have hparam : ∀ t, ∃ w ∈ Ioo (0 : unitInterval) 1, + f t = N.f i w ∧ g t = N.g i w := by + intro t + let z : ℝ := u.val + t.val * (v.val - u.val) + have hmul0 : 0 ≤ t.val * (v.val - u.val) := mul_nonneg t.property.1 (sub_pos.mpr huv').le + have hmul1 : t.val * (v.val - u.val) ≤ v.val - u.val := by + simpa only [one_mul] using mul_le_mul_of_nonneg_right t.property.2 (sub_pos.mpr huv').le + have hz0 : 0 < z := lt_of_lt_of_le hu (le_add_of_nonneg_right hmul0) + have hz1 : z < 1 := lt_of_le_of_lt (by dsimp [z]; linarith) hv + let w : unitInterval := ⟨z, hz0.le, hz1.le⟩ + refine ⟨w, ⟨hz0, hz1⟩, ?_, ?_⟩ + · exact extI_of_mem (N.f i) ⟨hz0.le, hz1.le⟩ + · exact extI_of_mem (N.g i) ⟨hz0.le, hz1.le⟩ + have hbd : discBd (univ : Set N.D) = bd N.D := + image_bd_homeomorph (Homeomorph.Set.univ N.D) + have hfbd : range f ⊆ discBd (univ : Set N.D) := by + rintro _ ⟨t, rfl⟩ + obtain ⟨w, hw, hfw, hgw⟩ := hparam t + rw [hfw, hbd] + exact N.range_f_subset_bd i ⟨w, rfl⟩ + have hgOld : range g ⊆ discBd (univ : Set N.D) := by + rintro _ ⟨t, rfl⟩ + obtain ⟨w, hw, hfw, hgw⟩ := hparam t + rw [hgw, hbd] + exact N.range_g_subset_bd i ⟨w, rfl⟩ + have hfg : Disjoint (range f) (range g) := by + apply disjoint_left.mpr + rintro _ ⟨s, rfl⟩ ⟨t, hts⟩ + obtain ⟨w, hw, hfw, hgw⟩ := hparam s + obtain ⟨z, hz, hfz, hgz⟩ := hparam t + have heq : N.f i w = N.g i z := hfw.symm.trans (hts.symm.trans hgz) + exact N.internally_disjoint_fg i i w hw ⟨z, heq.symm⟩ + have hf0 : f 0 = N.f i u := by + change pieceA (N.f i) u.val v.val 0 = _ + rw [pieceA_zero, extI_coe] + have hf1 : f 1 = N.f i v := by + change pieceA (N.f i) u.val v.val 1 = _ + rw [pieceA_one, extI_coe] + have hFl : IsLineWithEnds F (f 0) (f 1) := by rwa [hf0, hf1] + have hFb : F ∩ discBd (univ : Set N.D) = {f 0, f 1} := by rwa [hbd, hf0, hf1] + obtain ⟨C, A, B, hC, hcover, hA, hB, hAB, hI, hbA, hbB, hrest⟩ := + exists_disc_cut_with_boundary_arc N.isClosedDisc_D f hf hfbd hFl (subset_univ F) hFb + have hgB : range g ⊆ discBd B := by + intro x hx + have hxf : x ∉ range f := fun h => disjoint_left.mp hfg h hx + have hxC : x ∈ C := (hcover.symm ▸ hgOld hx).resolve_left hxf + exact hbB ▸ Or.inl hxC + have hαβ : ∀ t, N.φ (f t) = N.φ (g t) := by + intro t + obtain ⟨w, hw, hfw, hgw⟩ := hparam t + rw [hfw, hgw] + exact N.pasting_eq i w + obtain ⟨ψ, φ, hψ, hcφ, hφA, hφB, hinl, hinr, hcross, hbψA, hbψB⟩ := + exists_map_on_pasted_disc hA hB f g hf hg (by intro x hx; exact hbA ▸ Or.inl hx) + hgB N.φ N.φ N.quotientMap_φ.continuous.continuousOn + N.quotientMap_φ.continuous.continuousOn hαβ + have hsφ : Function.Surjective φ := by + intro z + obtain ⟨x, hx⟩ := N.quotientMap_φ.surjective z + have hxAB : x ∈ A ∪ B := hAB.symm ▸ mem_univ x + rcases hxAB with hxA | hxB + · exact ⟨ψ (Sum.inl ⟨x, hxA⟩), (hφA ⟨x, hxA⟩).trans hx⟩ + · exact ⟨ψ (Sum.inr ⟨x, hxB⟩), (hφB ⟨x, hxB⟩).trans hx⟩ + have hcover' : range f ∪ C = bd N.D := hbd ▸ hcover + exact ⟨C, A, B, ψ, φ, hA, hB, hAB, hI, hbA, hbB, hcover', hψ, + IsQuotientMap.of_surjective_continuous hsφ hcφ, hφA, hφB, hinl, hinr, hcross, hbψA, hbψB⟩ + +/-- When the two members of a paired side lie on the boundaries of +the two cut pieces, pasting them produces a disc with an associated +quotient surjection to the same surface. This is the separating-pair +configuration of VII (2.6), page 218, after subdividing at the cutting +endpoint images. -/ +theorem Net.exists_separating_pair_disc + {S : Type*} [TopologicalSpace S] [T2Space S] (N : Net S) (i : Fin N.r) + {A B : Set N.D} (hA : IsClosedDisc A) (hB : IsClosedDisc B) + (hAB : A ∪ B = univ) (hfA : range (N.f i) ⊆ discBd A) + (hgB : range (N.g i) ⊆ discBd B) : + ∃ (ψ : A ⊕ B → closedBall (0 : ℂ) 1) (φ : closedBall (0 : ℂ) 1 → S), + IsQuotientMap ψ ∧ IsQuotientMap φ ∧ + (∀ x : A, φ (ψ (Sum.inl x)) = N.φ x.val) ∧ + (∀ y : B, φ (ψ (Sum.inr y)) = N.φ y.val) ∧ + Function.Injective (ψ ∘ Sum.inl) ∧ Function.Injective (ψ ∘ Sum.inr) ∧ + (∀ (x : A) (y : B), ψ (Sum.inl x) = ψ (Sum.inr y) ↔ + ∃ t, x.val = N.f i t ∧ y.val = N.g i t) ∧ + (∀ x : A, ψ (Sum.inl x) ∈ bd (closedBall (0 : ℂ) 1) ↔ + x.val ∈ discBd A ∧ x.val ∉ N.f i '' Ioo (0 : unitInterval) 1) ∧ + (∀ y : B, ψ (Sum.inr y) ∈ bd (closedBall (0 : ℂ) 1) ↔ + y.val ∈ discBd B ∧ y.val ∉ N.g i '' Ioo (0 : unitInterval) 1) := by + let : T2Space N.D := N.isSurface_D.2.1 + obtain ⟨ψ, φ, hψ, hcφ, hφA, hφB, hinl, hinr, hcross, hbA, hbB⟩ := + exists_map_on_pasted_disc hA hB (N.f i) (N.g i) + ⟨(N.f i).continuous, N.injective_f i⟩ ⟨(N.g i).continuous, N.injective_g i⟩ + hfA hgB N.φ N.φ N.quotientMap_φ.continuous.continuousOn + N.quotientMap_φ.continuous.continuousOn (N.pasting_eq i) + have hsφ : Function.Surjective φ := by + intro z + obtain ⟨x, hx⟩ := N.quotientMap_φ.surjective z + rcases hAB.symm ▸ mem_univ x with hxA | hxB + · exact ⟨ψ (Sum.inl ⟨x, hxA⟩), (hφA ⟨x, hxA⟩).trans hx⟩ + · exact ⟨ψ (Sum.inr ⟨x, hxB⟩), (hφB ⟨x, hxB⟩).trans hx⟩ + exact ⟨ψ, φ, hψ, IsQuotientMap.of_surjective_continuous hsφ hcφ, + hφA, hφB, hinl, hinr, hcross, hbA, hbB⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapDisc.lean b/LeanPool/GraphMinor/GM07/NetSwapDisc.lean new file mode 100644 index 0000000000..b2a0e714c7 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapDisc.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.Surface.DiscUnion +import LeanPool.GraphMinor.Surface.DiscUnion + +/-! +# A model for pasting two closed discs along boundary arcs + +In the net exchange of VII (2.6), page 218, cutting along the +proper line gives two discs. Pasting the selected side to its +mate joins those discs along a boundary arc. Map each disc to +one half of the unit disc, sending the pasted arc to the same +diameter. This gives an explicit disc model, with exactly the +prescribed identifications between the two pieces. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Surface + +local notation "𝕀" => unitInterval + +universe u v + +variable {S : Type u} [TopologicalSpace S] + +/-- The disc model for the pasting step in VII (2.6), page 218. +The images of the pieces cover the closed unit disc, and a +point of one piece equals a point of the other precisely at +the paired boundary parameters. -/ +theorem exists_disc_pasting_model + {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] + {A : Set X} {B : Set Y} (hA : IsClosedDisc A) (hB : IsClosedDisc B) + (f : 𝕀 → X) (g : 𝕀 → Y) (hf : IsArcMap f) (hg : IsArcMap g) + (hfbd : range f ⊆ discBd A) (hgbd : range g ⊆ discBd B) : + ∃ (p : X → ℂ) (q : Y → ℂ), + ContinuousOn p A ∧ ContinuousOn q B ∧ InjOn p A ∧ InjOn q B ∧ + p '' A ∪ q '' B = closedBall 0 1 ∧ + (∀ x ∈ A, ∀ y ∈ B, p x = q y ↔ ∃ t, x = f t ∧ y = g t) ∧ + ∀ t, p (f t) = q (g t) := by + obtain ⟨a, b, cut⟩ := exists_cut_diameter + obtain ⟨p, p', hpc, hp'c, hpm, hp'm, hpi, hp'i, hpf, hpbd⟩ := + exists_pasting_half_coordinates hA hf.1 hf.2 hfbd cut.arc_a cut.arc_e + cut.a_zero cut.a_one cut.a_eq_e + obtain ⟨q, q', hqc, hq'c, hqm, hq'm, hqi, hq'i, hqg, hqbd⟩ := + exists_pasting_half_coordinates hB hg.1 hg.2 hgbd cut.arc_b cut.arc_e + cut.b_zero cut.b_one cut.symm.a_eq_e + obtain ⟨φ⟩ := oArc_sphere + obtain ⟨hunion, -, -, hmeet, -, -⟩ := cut.closedInner_facts (isJordanParts φ) + rw [closedInner_sphere] at hunion + have hpimage : p '' A = closedInner (side a unitDiscDiameter) := + Subset.antisymm hpm.image_subset (fun z hz => ⟨p' z, hp'm hz, hp'i hz⟩) + have hqimage : q '' B = closedInner (side b unitDiscDiameter) := + Subset.antisymm hqm.image_subset (fun z hz => ⟨q' z, hq'm hz, hq'i hz⟩) + have hfA : ∀ t, f t ∈ A := fun t => discBd_subset A (hfbd ⟨t, rfl⟩) + have hgB : ∀ t, g t ∈ B := fun t => discBd_subset B (hgbd ⟨t, rfl⟩) + refine ⟨p, q, hpc, hqc, hpi.injOn, hqi.injOn, ?_, ?_, ?_⟩ + · rw [hpimage, hqimage] + exact hunion + · intro x hx y hy + constructor + · intro hxy + have hm : p x ∈ closedInner (side a unitDiscDiameter) ∩ + closedInner (side b unitDiscDiameter) := + ⟨hpm hx, hxy.symm ▸ hqm hy⟩ + obtain ⟨t, ht⟩ := hmeet hm + refine ⟨t, hpi.injOn hx (hfA t) ?_, hqi.injOn hy (hgB t) ?_⟩ + · exact ht.symm.trans (hpf t).symm + · exact hxy.symm.trans (ht.symm.trans (hqg t).symm) + · rintro ⟨t, rfl, rfl⟩ + exact (hpf t).trans (hqg t).symm + · intro t + exact (hpf t).trans (hqg t).symm + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapEquivalence.lean b/LeanPool/GraphMinor/GM07/NetSwapEquivalence.lean new file mode 100644 index 0000000000..7edb501503 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapEquivalence.lean @@ -0,0 +1,155 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.GM07.NetSeparateEquivalence +import LeanPool.GraphMinor.GM07.NetSwapFibers +import LeanPool.GraphMinor.GM07.NetSwapArcs +import LeanPool.GraphMinor.GM07.NetSwapSides +import LeanPool.GraphMinor.GM07.MinimalNet +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# The equivalence relation of the exchanged net + +In VII (2.6), page 218, the new paired sides must generate exactly +the fibers of the associated surjection. Lift each old identification +through the two cut pieces. Pasted subarc points become equal, retained +paired points stay paired, and the two lifts of each cutting point +are paired by the inserted portions of the new sides. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface + +/-- The replacement side family generates exactly the fibers of the +associated map after the subarc exchange in VII (2.6), page 218. -/ +theorem Net.swap_map_eqvGen + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (N : Net S) (i : Fin N.r) (u v : unitInterval) + (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F C A B : Set N.D} (hF : IsLineWithEnds F (N.f i u) (N.f i v)) + (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) + (hAB : A ∪ B = univ) (hI : A ∩ B = F) + (hAd : discBd A = range (pieceA (N.f i) u.val v.val) ∪ F) + (hBd : discBd B = C ∪ F) + (hcover : range (pieceA (N.f i) u.val v.val) ∪ C = bd N.D) + (α : A → T) (β : B → T) (hT : range α ∪ range β = univ) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ + ∃ t, x.val = pieceA (N.f i) u.val v.val t ∧ + y.val = pieceA (N.g i) u.val v.val t) + (φ : T → S) (hφA : ∀ x : A, φ (α x) = N.φ x.val) + (hφB : ∀ y : B, φ (β y) = N.φ y.val) + (f g : Fin N.r → Curve T) (hpair : ∀ j t, φ (f j t) = φ (g j t)) + (hends : ∀ j, f j 0 ∈ β '' {x : B | x.val = N.f j 0} ∧ + f j 1 ∈ β '' {x : B | x.val = N.f j 1} ∧ + g j 0 ∈ β '' {x : B | x.val = N.g j 0} ∧ + g j 1 ∈ β '' {x : B | x.val = N.g j 1}) + (hotherf : ∀ j, j ≠ i → ∀ t, ∃ x : B, x.val = N.f j t ∧ f j t = β x) + (hotherg : ∀ j, j ≠ i → ∀ t, ∃ x : B, x.val = N.g j t ∧ g j t = β x) + (hfr : range (f i) = (β '' {x : B | x.val ∈ N.f i '' Icc 0 u} ∪ + β '' {x : B | x.val ∈ F}) ∪ β '' {x : B | x.val ∈ N.f i '' Icc v 1}) + (hgr : range (g i) = (β '' {x : B | x.val ∈ N.g i '' Icc 0 u} ∪ + α '' {x : A | x.val ∈ F}) ∪ β '' {x : B | x.val ∈ N.g i '' Icc v 1}) : + ∀ z w, φ z = φ w ↔ Relation.EqvGen + (fun a b : T => ∃ (j : Fin N.r) (t : unitInterval), a = f j t ∧ b = g j t) z w := by + classical + let R : T → T → Prop := Relation.EqvGen + (fun a b : T => ∃ (j : Fin N.r) (t : unitInterval), a = f j t ∧ b = g j t) + have hRsymm {x y : T} : R x y → R y x := Relation.EqvGen.symm x y + have hRpair : ∀ j t, R (f j t) (g j t) := fun j t => .rel _ _ ⟨j, t, rfl, rfl⟩ + have hqCoarse : range (g i) ⊆ β '' {x : B | x.val ∈ range (N.g i)} ∪ + α '' {x : A | x.val ∈ F} := by + rw [hgr] + rintro z ((⟨x, hx, rfl⟩ | hz) | ⟨x, hx, rfl⟩) + · exact Or.inl ⟨x, image_subset_range _ _ hx, rfl⟩ + · exact Or.inr hz + · exact Or.inl ⟨x, image_subset_range _ _ hx, rfl⟩ + have hpCut : β '' {x : B | x.val ∈ F} ⊆ range (f i) := by + rw [hfr] + exact fun _ h => Or.inl (Or.inr h) + have hCut : ∀ (x : A) (y : B), x.val = y.val → R (α x) (β y) := by + intro x y hxy + have hxF : x.val ∈ F := hI ▸ ⟨x.property, hxy.symm ▸ y.property⟩ + obtain ⟨t, hpt, hqt⟩ := N.swap_cutting_lifts_match i u v hu huv hv hFbd + α β hcross φ hφA hφB (f i) (g i) (hpair i) hpCut hqCoarse x y hxy hxF + have h := hRpair i t + rw [hpt, hqt] at h + exact hRsymm h + let σ : A ⊕ B → N.D := Sum.elim Subtype.val Subtype.val + let μ : A ⊕ B → T := Sum.elim α β + obtain ⟨_, hmates, hleft, hright⟩ := N.sides_on_retained_piece i u v hu huv hv hF hcover hBd + have hgB : ∀ t, N.g i t ∈ B := + fun t => discBd_subset B (hmates i (mem_range_self t)) + have hOldPair : ∀ j t, ∃ a b, σ a = N.f j t ∧ σ b = N.g j t ∧ R (μ a) (μ b) := by + intro j t + by_cases hji : j = i + · subst j + by_cases ht0 : t = 0 + · subst t + obtain ⟨x, hx, hxf⟩ := (hends i).1 + obtain ⟨y, hy, hyg⟩ := (hends i).2.2.1 + refine ⟨Sum.inr x, Sum.inr y, hx, hy, ?_⟩ + change R (β x) (β y) + rw [hxf, hyg] + exact hRpair i 0 + by_cases ht1 : t = 1 + · subst t + obtain ⟨x, hx, hxf⟩ := (hends i).2.1 + obtain ⟨y, hy, hyg⟩ := (hends i).2.2.2 + refine ⟨Sum.inr x, Sum.inr y, hx, hy, ?_⟩ + change R (β x) (β y) + rw [hxf, hyg] + exact hRpair i 1 + by_cases ht : t ∈ Icc u v + · obtain ⟨r, hrf, hrg⟩ := exists_pieceA_common_parameter (N.f i) (N.g i) u v t ht + have hfA : N.f i t ∈ A := + discBd_subset A (hAd ▸ Or.inl ⟨r, hrf⟩) + let x : A := ⟨N.f i t, hfA⟩ + let y : B := ⟨N.g i t, hgB t⟩ + have hxy : α x = β y := (hcross x y).mpr ⟨r, hrf.symm, hrg.symm⟩ + refine ⟨Sum.inl x, Sum.inr y, rfl, rfl, ?_⟩ + change R (α x) (β y) + rw [hxy] + exact .refl _ + · have hout : t ≤ u ∨ v ≤ t := by + rcases le_total t u with htu | hut + · exact Or.inl htu + · exact Or.inr (le_of_lt (lt_of_not_ge (fun htv => ht ⟨hut, htv⟩))) + have hfB : N.f i t ∈ B := by + apply discBd_subset B + rcases hout with htu | hvt + · exact hleft ⟨t, ⟨unitInterval.nonneg t, htu⟩, rfl⟩ + · exact hright ⟨t, ⟨hvt, unitInterval.le_one t⟩, rfl⟩ + let x : B := ⟨N.f i t, hfB⟩ + let y : B := ⟨N.g i t, hgB t⟩ + have hxp : β x ∈ range (f i) := by + rw [hfr] + rcases hout with htu | hvt + · exact Or.inl (Or.inl ⟨x, ⟨t, ⟨unitInterval.nonneg t, htu⟩, rfl⟩, rfl⟩) + · exact Or.inr ⟨x, ⟨t, ⟨hvt, unitInterval.le_one t⟩, rfl⟩, rfl⟩ + obtain ⟨s, hfs, hgs⟩ := N.swap_retained_lifts_match i u v hu huv hv hFbd + α β hcross φ hφA hφB (f i) (g i) (hpair i) hqCoarse + (Net.mem_Ioo_of_ne ht0 ht1) x y rfl rfl hxp + refine ⟨Sum.inr x, Sum.inr y, rfl, rfl, ?_⟩ + have h := hRpair i s + rw [hfs, hgs] at h + exact h + · obtain ⟨x, hx, hxf⟩ := hotherf j hji t + obtain ⟨y, hy, hyg⟩ := hotherg j hji t + refine ⟨Sum.inr x, Sum.inr y, hx, hy, ?_⟩ + have h := hRpair j t + rw [hxf, hyg] at h + exact h + exact N.map_eqvGen_of_cut_lifts hAB α β hT φ hφA hφB f g hpair hCut hOldPair + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapFamily.lean b/LeanPool/GraphMinor/GM07/NetSwapFamily.lean new file mode 100644 index 0000000000..cb08c1a57e --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapFamily.lean @@ -0,0 +1,249 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.GM07.NetSwapPair +import LeanPool.GraphMinor.GM07.NetSwapSides +import LeanPool.GraphMinor.GM07.NetSwapReplacement +import LeanPool.GraphMinor.GM07.NetSwapArcs +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# All paired sides after the net exchange + +For the cut and paste in VII (2.6), page 218, retain every +unselected pair on the second piece and insert the two replacement +sides. The fiber equation and the old net's internal disjointness +show that all these sides are pairwise internally disjoint. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface + +/-- Construct the full family of paired boundary arcs for the net +exchange in VII (2.6), page 218. The index set is unchanged. -/ +theorem Net.exists_replacement_side_family + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (N : Net S) (i : Fin N.r) (u v : unitInterval) + (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F C A B : Set N.D} (hF : IsLineWithEnds F (N.f i u) (N.f i v)) + (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) (hI : A ∩ B = F) + (hAd : discBd A = range (pieceA (N.f i) u.val v.val) ∪ F) + (hcover : range (pieceA (N.f i) u.val v.val) ∪ C = bd N.D) + (hBd : discBd B = C ∪ F) + (α : A → T) (β : B → T) (hcα : Continuous α) (hcβ : Continuous β) + (hiα : Function.Injective α) (hiβ : Function.Injective β) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ + ∃ t, x.val = pieceA (N.f i) u.val v.val t ∧ y.val = pieceA (N.g i) u.val v.val t) + (hαbd : ∀ x : A, α x ∈ bd T ↔ x.val ∈ discBd A ∧ + x.val ∉ pieceA (N.f i) u.val v.val '' Ioo (0 : unitInterval) 1) + (hβbd : ∀ y : B, β y ∈ bd T ↔ y.val ∈ discBd B ∧ + y.val ∉ pieceA (N.g i) u.val v.val '' Ioo (0 : unitInterval) 1) + (φ : T → S) (hφA : ∀ x : A, φ (α x) = N.φ x.val) + (hφB : ∀ y : B, φ (β y) = N.φ y.val) : + ∃ f g : Fin N.r → Curve T, + (∀ j, Function.Injective (f j)) ∧ (∀ j, Function.Injective (g j)) ∧ + (∀ j, range (f j) ⊆ bd T) ∧ (∀ j, range (g j) ⊆ bd T) ∧ + (∀ j k, j ≠ k → ∀ t ∈ Ioo (0 : unitInterval) 1, f j t ∉ range (f k)) ∧ + (∀ j k, j ≠ k → ∀ t ∈ Ioo (0 : unitInterval) 1, g j t ∉ range (g k)) ∧ + (∀ j k, ∀ t ∈ Ioo (0 : unitInterval) 1, f j t ∉ range (g k)) ∧ + (∀ j k, ∀ t ∈ Ioo (0 : unitInterval) 1, g j t ∉ range (f k)) ∧ + (∀ j t, φ (f j t) = φ (g j t)) ∧ + (∀ j, f j 0 ∈ β '' {x : B | x.val = N.f j 0} ∧ + f j 1 ∈ β '' {x : B | x.val = N.f j 1} ∧ + g j 0 ∈ β '' {x : B | x.val = N.g j 0} ∧ + g j 1 ∈ β '' {x : B | x.val = N.g j 1}) ∧ + (∀ j, j ≠ i → ∀ t, ∃ x : B, x.val = N.f j t ∧ f j t = β x) ∧ + (∀ j, j ≠ i → ∀ t, ∃ x : B, x.val = N.g j t ∧ g j t = β x) ∧ + range (f i) = (β '' {x : B | x.val ∈ N.f i '' Icc 0 u} ∪ + β '' {x : B | x.val ∈ F}) ∪ β '' {x : B | x.val ∈ N.f i '' Icc v 1} ∧ + range (g i) = (β '' {x : B | x.val ∈ N.g i '' Icc 0 u} ∪ + α '' {x : A | x.val ∈ F}) ∪ β '' {x : B | x.val ∈ N.g i '' Icc v 1} := by + classical + obtain ⟨p, q, hpi, hqi, hpq, _, _, _, _, hpr, hqr, hpbd, hqbd, + hp0, hp1, hq0, hq1, hpqd, hqpd⟩ := + N.exists_replacement_pair i u v hu huv hv hF hFbd hI hAd hcover hBd + α β hcα hcβ hiα hiβ hcross hαbd hβbd φ hφA hφB + obtain ⟨hother, hmates, _, _⟩ := N.sides_on_retained_piece i u v hu huv hv hF hcover hBd + have hfB : ∀ j, j ≠ i → ∀ t, N.f j t ∈ B := + fun j hj t => discBd_subset B (hother j hj (mem_range_self t)) + have hgB : ∀ j t, N.g j t ∈ B := + fun j t => discBd_subset B (hmates j (mem_range_self t)) + let lift (a : Curve N.D) (ha : ∀ t, a t ∈ B) : Curve T := + ⟨fun t => β ⟨a t, ha t⟩, hcβ.comp (a.continuous.subtype_mk ha)⟩ + let f : Fin N.r → Curve T := fun j => if hj : j = i then p else lift (N.f j) (hfB j hj) + let g : Fin N.r → Curve T := fun j => if j = i then q else lift (N.g j) (hgB j) + have hfi : f i = p := dite_eq_left rfl + have hgi : g i = q := ite_eq_left rfl + have hfj : ∀ j (hj : j ≠ i), f j = lift (N.f j) (hfB j hj) := fun j hj => dite_eq_right hj + have hgj : ∀ j, j ≠ i → g j = lift (N.g j) (hgB j) := fun j hj => ite_eq_right hj + have hliftInj : ∀ (a : Curve N.D) (ha : ∀ t, a t ∈ B), + Function.Injective a → Function.Injective (lift a ha) := by + intro a ha hai s t heq + exact hai (congrArg Subtype.val (hiβ heq)) + have hliftDisj : ∀ (a b : Curve N.D) (ha : ∀ t, a t ∈ B) (hb : ∀ t, b t ∈ B), + (∀ t ∈ Ioo (0 : unitInterval) 1, a t ∉ range b) → + ∀ t ∈ Ioo (0 : unitInterval) 1, lift a ha t ∉ range (lift b hb) := by + intro a b ha hb hab t ht + rintro ⟨s, hs⟩ + exact hab t ht ⟨s, congrArg Subtype.val (hiβ hs)⟩ + have hpCoarse : range p ⊆ β '' {x : B | x.val ∈ range (N.f i)} ∪ + β '' {x : B | x.val ∈ F} := by + rw [hpr] + rintro z ((⟨x, hx, rfl⟩ | hz) | ⟨x, hx, rfl⟩) + · exact Or.inl ⟨x, image_subset_range _ _ hx, rfl⟩ + · exact Or.inr hz + · exact Or.inl ⟨x, image_subset_range _ _ hx, rfl⟩ + have hqCoarse : range q ⊆ β '' {x : B | x.val ∈ range (N.g i)} ∪ + α '' {x : A | x.val ∈ F} := by + rw [hqr] + rintro z ((⟨x, hx, rfl⟩ | hz) | ⟨x, hx, rfl⟩) + · exact Or.inl ⟨x, image_subset_range _ _ hx, rfl⟩ + · exact Or.inr hz + · exact Or.inl ⟨x, image_subset_range _ _ hx, rfl⟩ + obtain ⟨hFf, hFg⟩ := N.cutting_line_disjoint_other_sides i hu huv hv hFbd + have hβdisj : ∀ K : Set N.D, Disjoint F K → + Disjoint (β '' {x : B | x.val ∈ F}) (β '' {x : B | x.val ∈ K}) := by + intro K hK + apply disjoint_left.mpr + rintro z ⟨x, hx, rfl⟩ ⟨y, hy, heq⟩ + exact disjoint_left.mp hK hx ((hiβ heq) ▸ hy) + obtain ⟨hαf, hαg⟩ := N.attached_piece_disjoint_other_sides i hu huv hv α β hcross + have hαdisj : ∀ K : Set N.D, Disjoint (range α) (β '' {x : B | x.val ∈ K}) → + Disjoint (α '' {x : A | x.val ∈ F}) (β '' {x : B | x.val ∈ K}) := + fun K hK => hK.mono_left (image_subset_range _ _) + have hpf : ∀ j (hj : j ≠ i), + (∀ t ∈ Ioo (0 : unitInterval) 1, p t ∉ range (lift (N.f j) (hfB j hj))) ∧ + (∀ t ∈ Ioo (0 : unitInterval) 1, lift (N.f j) (hfB j hj) t ∉ range p) := by + intro j hj + exact internally_disjoint_replacement_retained_side (N.f i) (N.f j) β hiβ + (N.injective_f j) (N.internally_disjoint_ff i j hj.symm) + (N.internally_disjoint_ff j i hj) p (lift (N.f j) (hfB j hj)) hpi hpCoarse + (hβdisj _ (hFf j hj)) hp0 hp1 (hfB j hj) (fun _ => rfl) + have hpg : ∀ j, + (∀ t ∈ Ioo (0 : unitInterval) 1, p t ∉ range (lift (N.g j) (hgB j))) ∧ + (∀ t ∈ Ioo (0 : unitInterval) 1, lift (N.g j) (hgB j) t ∉ range p) := by + intro j + exact internally_disjoint_replacement_retained_side (N.f i) (N.g j) β hiβ + (N.injective_g j) (N.internally_disjoint_fg i j) (N.internally_disjoint_gf j i) + p (lift (N.g j) (hgB j)) hpi hpCoarse + (hβdisj _ (hFg j)) hp0 hp1 (hgB j) (fun _ => rfl) + have hqf : ∀ j, + ∀ hj : j ≠ i, + (∀ t ∈ Ioo (0 : unitInterval) 1, q t ∉ range (lift (N.f j) (hfB j hj))) ∧ + (∀ t ∈ Ioo (0 : unitInterval) 1, lift (N.f j) (hfB j hj) t ∉ range q) := by + intro j hj + exact internally_disjoint_replacement_retained_side (N.g i) (N.f j) β hiβ + (N.injective_f j) (N.internally_disjoint_gf i j) (N.internally_disjoint_fg j i) + q (lift (N.f j) (hfB j hj)) hqi hqCoarse + (hαdisj _ (hαf j)) hq0 hq1 (hfB j hj) (fun _ => rfl) + have hqg : ∀ j (hj : j ≠ i), + (∀ t ∈ Ioo (0 : unitInterval) 1, q t ∉ range (lift (N.g j) (hgB j))) ∧ + (∀ t ∈ Ioo (0 : unitInterval) 1, lift (N.g j) (hgB j) t ∉ range q) := by + intro j hj + exact internally_disjoint_replacement_retained_side (N.g i) (N.g j) β hiβ + (N.injective_g j) (N.internally_disjoint_gg i j hj.symm) + (N.internally_disjoint_gg j i hj) q (lift (N.g j) (hgB j)) hqi hqCoarse + (hαdisj _ (hαg j hj)) hq0 hq1 (hgB j) (fun _ => rfl) + have hbound : ∀ (a : Curve N.D), range a ⊆ discBd B → + Disjoint (range a) (pieceA (N.g i) u.val v.val '' Ioo (0 : unitInterval) 1) → + ∀ ha : ∀ t, a t ∈ B, range (lift a ha) ⊆ bd T := by + intro a had hdis ha z hz + obtain ⟨t, rfl⟩ := hz + apply (hβbd _).mpr + exact ⟨had (mem_range_self t), fun h => disjoint_left.mp hdis (mem_range_self t) h⟩ + have hfdis : ∀ j, Disjoint (range (N.f j)) + (pieceA (N.g i) u.val v.val '' Ioo (0 : unitInterval) 1) := by + intro j + rw [image_pieceA_Ioo_unitInterval (N.g i) u v huv] + apply disjoint_left.mpr + rintro x hx ⟨t, ht, rfl⟩ + exact N.internally_disjoint_gf i j t ⟨hu.trans ht.1, ht.2.trans hv⟩ hx + have hgdis : ∀ j, j ≠ i → Disjoint (range (N.g j)) + (pieceA (N.g i) u.val v.val '' Ioo (0 : unitInterval) 1) := by + intro j hj + rw [image_pieceA_Ioo_unitInterval (N.g i) u v huv] + apply disjoint_left.mpr + rintro x hx ⟨t, ht, rfl⟩ + exact N.internally_disjoint_gg i j hj.symm t ⟨hu.trans ht.1, ht.2.trans hv⟩ hx + refine ⟨f, g, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro j + by_cases hj : j = i + · subst j; exact hfi ▸ hpi + · rw [hfj j hj]; exact hliftInj _ _ (N.injective_f j) + · intro j + by_cases hj : j = i + · subst j; exact hgi ▸ hqi + · rw [hgj j hj]; exact hliftInj _ _ (N.injective_g j) + · intro j + by_cases hj : j = i + · subst j; exact hfi ▸ hpbd + · rw [hfj j hj]; exact hbound _ (hother j hj) (hfdis j) _ + · intro j + by_cases hj : j = i + · subst j; exact hgi ▸ hqbd + · rw [hgj j hj]; exact hbound _ (hmates j) (hgdis j hj) _ + · intro j k hjk + by_cases hj : j = i + · subst j; rw [hfi, hfj k hjk.symm]; exact (hpf k hjk.symm).1 + · by_cases hk : k = i + · subst k; rw [hfj j hj, hfi]; exact (hpf j hj).2 + · rw [hfj j hj, hfj k hk] + exact hliftDisj _ _ _ _ (N.internally_disjoint_ff j k hjk) + · intro j k hjk + by_cases hj : j = i + · subst j; rw [hgi, hgj k hjk.symm]; exact (hqg k hjk.symm).1 + · by_cases hk : k = i + · subst k; rw [hgj j hj, hgi]; exact (hqg j hj).2 + · rw [hgj j hj, hgj k hk] + exact hliftDisj _ _ _ _ (N.internally_disjoint_gg j k hjk) + · intro j k + by_cases hj : j = i + · subst j + by_cases hk : k = i + · subst k; rw [hfi, hgi]; exact hpqd + · rw [hfi, hgj k hk]; exact (hpg k).1 + · by_cases hk : k = i + · subst k; rw [hfj j hj, hgi]; exact (hqf j hj).2 + · rw [hfj j hj, hgj k hk] + exact hliftDisj _ _ _ _ (N.internally_disjoint_fg j k) + · intro j k + by_cases hj : j = i + · subst j + by_cases hk : k = i + · subst k; rw [hgi, hfi]; exact hqpd + · rw [hgi, hfj k hk]; exact (hqf k hk).1 + · by_cases hk : k = i + · subst k; rw [hgj j hj, hfi]; exact (hpg j).2 + · rw [hgj j hj, hfj k hk] + exact hliftDisj _ _ _ _ (N.internally_disjoint_gf j k) + · intro j t + by_cases hj : j = i + · subst j; rw [hfi, hgi]; exact hpq t + · rw [hfj j hj, hgj j hj] + exact (hφB ⟨N.f j t, hfB j hj t⟩).trans + ((N.pasting_eq j t).trans (hφB ⟨N.g j t, hgB j t⟩).symm) + · intro j + by_cases hj : j = i + · subst j; rw [hfi, hgi]; exact ⟨hp0, hp1, hq0, hq1⟩ + · rw [hfj j hj, hgj j hj] + exact ⟨⟨_, rfl, rfl⟩, ⟨_, rfl, rfl⟩, ⟨_, rfl, rfl⟩, ⟨_, rfl, rfl⟩⟩ + · intro j hj t + rw [hfj j hj] + exact ⟨_, rfl, rfl⟩ + · intro j hj t + rw [hgj j hj] + exact ⟨_, rfl, rfl⟩ + · rw [hfi]; exact hpr + · rw [hgi]; exact hqr + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapFibers.lean b/LeanPool/GraphMinor/GM07/NetSwapFibers.lean new file mode 100644 index 0000000000..4d66a5ed0c --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapFibers.lean @@ -0,0 +1,300 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.GM07.NetSwapBasic +import LeanPool.GraphMinor.GM07.NetSwapArcs +import LeanPool.GraphMinor.GM07.NetSwapSides +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Interior fibers after exchanging a net subarc + +For VII (2.6), page 218, the open pasted subarc becomes interior +to the new disc. Its old two-point fibers are merged by the pasting. +Every other interior point comes from an old interior point. The +two lifts of the cutting line remain on the boundary, so they do +not create an interior identification. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface + +/-- The associated map of the exchanged disc makes no identification +at an interior point. The old two-point fibers on the pasted subarc +become single points, while both lifts of the cut remain boundary +points. This verifies the interior-fiber condition in the new net +of VII (2.6), page 218. -/ +theorem Net.swap_map_interior_inj + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (N : Net S) (i : Fin N.r) (u v : unitInterval) + (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F C A B : Set N.D} (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) + (hI : A ∩ B = F) + (hAd : discBd A = range (pieceA (N.f i) u.val v.val) ∪ F) + (hBd : discBd B = C ∪ F) + (hcover : range (pieceA (N.f i) u.val v.val) ∪ C = bd N.D) + (α : A → T) (β : B → T) (hT : range α ∪ range β = univ) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ + ∃ t, x.val = pieceA (N.f i) u.val v.val t ∧ + y.val = pieceA (N.g i) u.val v.val t) + (hαbd : ∀ x : A, α x ∈ bd T ↔ x.val ∈ discBd A ∧ + x.val ∉ pieceA (N.f i) u.val v.val '' Ioo (0 : unitInterval) 1) + (hβbd : ∀ y : B, β y ∈ bd T ↔ y.val ∈ discBd B ∧ + y.val ∉ pieceA (N.g i) u.val v.val '' Ioo (0 : unitInterval) 1) + (φ : T → S) (hφA : ∀ x : A, φ (α x) = N.φ x.val) + (hφB : ∀ y : B, φ (β y) = N.φ y.val) : + ∀ z ∈ (bd T)ᶜ, ∀ w : T, φ z = φ w → z = w := by + have hfopen : Disjoint F (N.f i '' Ioo u v) := by + apply disjoint_left.mpr + rintro x hxF ⟨t, ht, rfl⟩ + rcases hFbd.subset ⟨hxF, N.range_f_subset_bd i (mem_range_self t)⟩ with h | h + · exact ht.1.ne' (N.injective_f i h) + · exact ht.2.ne (N.injective_f i (mem_singleton_iff.mp h)) + have hFg : Disjoint F (range (N.g i)) := by + apply disjoint_left.mpr + intro x hxF hxg + rcases hFbd.subset ⟨hxF, N.range_g_subset_bd i hxg⟩ with h | h + · exact N.internally_disjoint_fg i i u ⟨hu, huv.trans hv⟩ (h ▸ hxg) + · exact N.internally_disjoint_fg i i v ⟨hu.trans huv, hv⟩ + ((mem_singleton_iff.mp h) ▸ hxg) + have hcutA : ∀ x : A, x.val ∈ F → α x ∈ bd T := by + intro x hx + apply (hαbd x).mpr + refine ⟨hAd ▸ Or.inr hx, ?_⟩ + rw [image_pieceA_Ioo_unitInterval (N.f i) u v huv] + exact fun h => disjoint_left.mp hfopen hx h + have hcutB : ∀ y : B, y.val ∈ F → β y ∈ bd T := by + intro y hy + apply (hβbd y).mpr + refine ⟨hBd ▸ Or.inr hy, ?_⟩ + intro h + exact disjoint_left.mp hFg hy (image_subset_range _ _ + ((range_pieceA_unitInterval (N.g i) u v huv.le).subset (image_subset_range _ _ h))) + have hOldA : ∀ x : A, x.val ∈ bd N.D → x.val ∈ discBd A := by + intro x hx + rcases hcover.symm ▸ hx with hf | hC + · exact hAd ▸ Or.inl hf + · have hxB : x.val ∈ B := discBd_subset B (hBd ▸ Or.inl hC) + exact hAd ▸ Or.inr (hI ▸ ⟨x.property, hxB⟩) + have hOldB : ∀ y : B, y.val ∈ bd N.D → y.val ∈ discBd B := by + intro y hy + rcases hcover.symm ▸ hy with hf | hC + · have hyA : y.val ∈ A := discBd_subset A (hAd ▸ Or.inl hf) + exact hBd ▸ Or.inr (hI ▸ ⟨hyA, y.property⟩) + · exact hBd ▸ Or.inl hC + have hpasted : ∀ x : A, + x.val ∈ pieceA (N.f i) u.val v.val '' Ioo (0 : unitInterval) 1 → + ∀ z, φ (α x) = φ z → α x = z := by + intro x hx z heq + obtain ⟨r, hr, hrx⟩ := hx + obtain ⟨t, ht, hft, hgt⟩ := pieceA_common_parameter (N.f i) (N.g i) u v huv.le r + have hxt : x.val = N.f i t := hrx.symm.trans hft + have ht' : t ∈ Ioo u v := by + obtain ⟨s, hs, hsx⟩ := (image_pieceA_Ioo_unitInterval (N.f i) u v huv).subset + ⟨r, hr, hrx⟩ + have hst : s = t := N.injective_f i (hsx.trans hxt) + exact hst ▸ hs + have hfA : N.f i t ∈ A := hxt ▸ x.property + have hgB : N.g i t ∈ B := by + have hgbd : N.g i t ∈ bd N.D := N.range_g_subset_bd i (mem_range_self t) + have hgnot : N.g i t ∉ range (pieceA (N.f i) u.val v.val) := by + intro h + obtain ⟨s, hs, hsx⟩ := (range_pieceA_unitInterval (N.f i) u v huv.le).subset h + exact N.internally_disjoint_fg i i s ⟨hu.trans_le hs.1, hs.2.trans_lt hv⟩ ⟨t, hsx.symm⟩ + have hgC : N.g i t ∈ C := (hcover.symm ▸ hgbd).resolve_left hgnot + exact discBd_subset B (hBd ▸ Or.inl hgC) + have hxy : α x = β ⟨N.g i t, hgB⟩ := + (hcross x ⟨N.g i t, hgB⟩).mpr ⟨r, hrx.symm, hgt.symm⟩ + have hmem : ∀ y, N.φ x.val = N.φ y → y ∈ ({N.f i t, N.g i t} : Set N.D) := by + intro y hy + rw [← N.fiber_eq_pair_of_mem_Ioo i ⟨hu.trans ht'.1, ht'.2.trans hv⟩] + exact hy.symm.trans (congrArg N.φ hxt) + rcases hT.symm ▸ mem_univ z with ⟨y, rfl⟩ | ⟨y, rfl⟩ + · have hy := hmem y.val ((hφA x).symm.trans (heq.trans (hφA y))) + rcases hy with hy | hy + · exact congrArg α (Subtype.ext (hxt.trans hy.symm)) + · have hyF : y.val ∈ F := hI ▸ ⟨y.property, (mem_singleton_iff.mp hy).symm ▸ hgB⟩ + exact (disjoint_left.mp hFg hyF ⟨t, (mem_singleton_iff.mp hy).symm⟩).elim + · have hy := hmem y.val ((hφA x).symm.trans (heq.trans (hφB y))) + rcases hy with hy | hy + · have hyF : y.val ∈ F := hI ▸ ⟨hy.symm ▸ hfA, y.property⟩ + exact (disjoint_left.mp hfopen hyF ⟨t, ht', hy.symm⟩).elim + · exact hxy.trans (congrArg β (Subtype.ext (mem_singleton_iff.mp hy).symm)) + have hleft : ∀ x : A, α x ∉ bd T → ∀ z, φ (α x) = φ z → α x = z := by + intro x hx z heq + by_cases hxbd : x.val ∈ bd N.D + · have hxp : x.val ∈ pieceA (N.f i) u.val v.val '' Ioo (0 : unitInterval) 1 := by + by_contra h + exact hx ((hαbd x).mpr ⟨hOldA x hxbd, h⟩) + exact hpasted x hxp z heq + · rcases hT.symm ▸ mem_univ z with ⟨y, rfl⟩ | ⟨y, rfl⟩ + · have hxy := N.interior_inj x.val hxbd y.val + ((hφA x).symm.trans (heq.trans (hφA y))) + exact congrArg α (Subtype.ext hxy) + · have hxy := N.interior_inj x.val hxbd y.val + ((hφA x).symm.trans (heq.trans (hφB y))) + have hxF : x.val ∈ F := hI ▸ ⟨x.property, hxy.symm ▸ y.property⟩ + exact (hx (hcutA x hxF)).elim + intro z hz w heq + rcases hT.symm ▸ mem_univ z with ⟨x, rfl⟩ | ⟨y, rfl⟩ + · exact hleft x hz w heq + · by_cases hybd : y.val ∈ bd N.D + · have hyp : y.val ∈ pieceA (N.g i) u.val v.val '' Ioo (0 : unitInterval) 1 := by + by_contra h + exact hz ((hβbd y).mpr ⟨hOldB y hybd, h⟩) + obtain ⟨r, hr, hry⟩ := hyp + have hfA : pieceA (N.f i) u.val v.val r ∈ A := + discBd_subset A (hAd ▸ Or.inl (mem_range_self r)) + let x : A := ⟨pieceA (N.f i) u.val v.val r, hfA⟩ + have hxy : α x = β y := (hcross x y).mpr ⟨r, rfl, hry.symm⟩ + exact hxy.symm.trans (hleft x (hxy.symm ▸ hz) w ((congrArg φ hxy).trans heq)) + · rcases hT.symm ▸ mem_univ w with ⟨x, rfl⟩ | ⟨x, rfl⟩ + · have hyx := N.interior_inj y.val hybd x.val + ((hφB y).symm.trans (heq.trans (hφA x))) + have hyF : y.val ∈ F := hI ▸ ⟨hyx.symm ▸ x.property, y.property⟩ + exact (hz (hcutB y hyF)).elim + · have hyx := N.interior_inj y.val hybd x.val + ((hφB y).symm.trans (heq.trans (hφB x))) + exact congrArg β (Subtype.ext hyx) + +/-- The two lifts of each cutting-line point occur at the same +parameter of the replacement pair. This includes cutting endpoints +which are vertices of the original graph. It supplies the new +identifications along the cut in VII (2.6), page 218. -/ +theorem Net.swap_cutting_lifts_match + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (N : Net S) (i : Fin N.r) (u v : unitInterval) + (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F A B : Set N.D} (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) + (α : A → T) (β : B → T) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ + ∃ t, x.val = pieceA (N.f i) u.val v.val t ∧ + y.val = pieceA (N.g i) u.val v.val t) + (φ : T → S) (hφA : ∀ x : A, φ (α x) = N.φ x.val) + (hφB : ∀ y : B, φ (β y) = N.φ y.val) + (p q : Curve T) (hpq : ∀ t, φ (p t) = φ (q t)) + (hpRange : β '' {y : B | y.val ∈ F} ⊆ range p) + (hqRange : range q ⊆ β '' {y : B | y.val ∈ range (N.g i)} ∪ + α '' {x : A | x.val ∈ F}) : + ∀ (x : A) (y : B), x.val = y.val → x.val ∈ F → + ∃ t, p t = β y ∧ q t = α x := by + have hFg := (N.cutting_line_disjoint_other_sides i hu huv hv hFbd).2 i + have hfu0 : pieceA (N.f i) u.val v.val 0 = N.f i u := by + rw [pieceA_zero, extI_coe] + have hfu1 : pieceA (N.f i) u.val v.val 1 = N.f i v := by + rw [pieceA_one, extI_coe] + have hgu0 : pieceA (N.g i) u.val v.val 0 = N.g i u := by + rw [pieceA_zero, extI_coe] + have hgu1 : pieceA (N.g i) u.val v.val 1 = N.g i v := by + rw [pieceA_one, extI_coe] + intro x y hxy hxF + obtain ⟨t, hpt⟩ := hpRange ⟨y, (show y.val ∈ F from hxy ▸ hxF), rfl⟩ + refine ⟨t, hpt, ?_⟩ + have heq : N.φ x.val = φ (q t) := + (congrArg N.φ hxy).trans ((hφB y).symm.trans + ((congrArg φ hpt).symm.trans (hpq t))) + rcases hqRange (mem_range_self t) with ⟨z, hz, hzt⟩ | ⟨z, hz, hzt⟩ + · have hxz : N.φ x.val = N.φ z.val := + heq.trans ((congrArg φ hzt).symm.trans (hφB z)) + rcases N.fiber_of_cutting_line_point i hu huv hv hFbd hxF hxz with h | ⟨hxu, hzu⟩ | ⟨hxv, hzv⟩ + · exact (disjoint_left.mp hFg hxF (h ▸ hz)).elim + · have hαβ : α x = β z := (hcross x z).mpr + ⟨0, hxu.trans hfu0.symm, hzu.trans hgu0.symm⟩ + exact hzt.symm.trans hαβ.symm + · have hαβ : α x = β z := (hcross x z).mpr + ⟨1, hxv.trans hfu1.symm, hzv.trans hgu1.symm⟩ + exact hzt.symm.trans hαβ.symm + · have hxz : N.φ x.val = N.φ z.val := + heq.trans ((congrArg φ hzt).symm.trans (hφA z)) + have hxz' := N.injOn_cutting_line i hu huv hv hFbd hxF hz hxz + exact hzt.symm.trans (congrArg α (Subtype.ext hxz'.symm)) + +/-- On the replacement mate side, an old interior mate point has +only its retained image above its image in the surface. At either +cutting endpoint the attached lift has already been pasted to this +retained image. This is the boundary-fiber calculation for VII (2.6), +page 218. -/ +theorem Net.swap_mate_fiber_unique + {S T : Type*} [TopologicalSpace S] + (N : Net S) (i : Fin N.r) (u v : unitInterval) + (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F A B : Set N.D} (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) + (α : A → T) (β : B → T) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ + ∃ t, x.val = pieceA (N.f i) u.val v.val t ∧ + y.val = pieceA (N.g i) u.val v.val t) + (φ : T → S) (hφA : ∀ x : A, φ (α x) = N.φ x.val) + (hφB : ∀ y : B, φ (β y) = N.φ y.val) + {t : unitInterval} (ht : t ∈ Ioo (0 : unitInterval) 1) + (y : B) (hy : y.val = N.g i t) {z : T} + (hz : z ∈ β '' {w : B | w.val ∈ range (N.g i)} ∪ α '' {w : A | w.val ∈ F}) + (heq : φ z = N.φ (N.f i t)) : z = β y := by + have hFg := (N.cutting_line_disjoint_other_sides i hu huv hv hFbd).2 i + have hmem : ∀ x, N.φ x = N.φ (N.f i t) → + x ∈ ({N.f i t, N.g i t} : Set N.D) := by + intro x hx + rw [← N.fiber_eq_pair_of_mem_Ioo i ht] + exact hx + rcases hz with ⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩ + · rcases hmem x.val ((hφB x).symm.trans heq) with hxf | hxg + · exact (N.internally_disjoint_fg i i t ht (hxf ▸ hx)).elim + · exact congrArg β (Subtype.ext ((mem_singleton_iff.mp hxg).trans hy.symm)) + · rcases hmem x.val ((hφA x).symm.trans heq) with hxf | hxg + · have hxtF : N.f i t ∈ F := hxf ▸ hx + have htend := hFbd.subset ⟨hxtF, N.range_f_subset_bd i (mem_range_self t)⟩ + rcases htend with htu | htv + · have htu' : t = u := N.injective_f i htu + apply (hcross x y).mpr + refine ⟨0, ?_, ?_⟩ + · rw [pieceA_zero, extI_coe] + exact hxf.trans htu + · rw [pieceA_zero, extI_coe] + exact hy.trans (congrArg (N.g i) htu') + · have htv' : t = v := N.injective_f i (mem_singleton_iff.mp htv) + apply (hcross x y).mpr + refine ⟨1, ?_, ?_⟩ + · rw [pieceA_one, extI_coe] + exact hxf.trans (mem_singleton_iff.mp htv) + · rw [pieceA_one, extI_coe] + exact hy.trans (congrArg (N.g i) htv') + · exact (disjoint_left.mp hFg hx ⟨t, (mem_singleton_iff.mp hxg).symm⟩).elim + +/-- Every retained old pair point with interior parameter is still +paired at some common parameter of the new side maps. The two outer +side pieces can be reparametrized, but their paired points remain +paired. This is used to lift the old net's equivalence relation in +VII (2.6), page 218. -/ +theorem Net.swap_retained_lifts_match + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (N : Net S) (i : Fin N.r) (u v : unitInterval) + (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F A B : Set N.D} (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) + (α : A → T) (β : B → T) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ + ∃ t, x.val = pieceA (N.f i) u.val v.val t ∧ + y.val = pieceA (N.g i) u.val v.val t) + (φ : T → S) (hφA : ∀ x : A, φ (α x) = N.φ x.val) + (hφB : ∀ y : B, φ (β y) = N.φ y.val) + (p q : Curve T) (hpq : ∀ s, φ (p s) = φ (q s)) + (hqRange : range q ⊆ β '' {y : B | y.val ∈ range (N.g i)} ∪ + α '' {x : A | x.val ∈ F}) + {t : unitInterval} (ht : t ∈ Ioo (0 : unitInterval) 1) + (x y : B) (hx : x.val = N.f i t) (hy : y.val = N.g i t) + (hxp : β x ∈ range p) : ∃ s, p s = β x ∧ q s = β y := by + obtain ⟨s, hps⟩ := hxp + refine ⟨s, hps, ?_⟩ + apply N.swap_mate_fiber_unique i u v hu huv hv hFbd α β hcross φ hφA hφB ht y hy + (hqRange (mem_range_self s)) + exact (hpq s).symm.trans ((congrArg φ hps).trans ((hφB x).trans (congrArg N.φ hx))) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapFrontier.lean b/LeanPool/GraphMinor/GM07/NetSwapFrontier.lean new file mode 100644 index 0000000000..236defd74c --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapFrontier.lean @@ -0,0 +1,124 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.Surface.DiscUnion +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.Wedge +import LeanPool.GraphMinor.Surface.Disc + +/-! +# The boundary after pasting the net pieces + +VII (2.6), page 218, pastes the selected boundary subarc to +its mate. The interior of the pasted arc leaves the boundary +of the new disc, and its two ends remain. Apply the union-of- +discs boundary formula to the two images in the disc model. +This makes the endpoint terms explicit for the net count. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Surface + +/-- The boundary of a two-piece pasting model consists of the +two old boundaries minus the open pasted arc. This is the +boundary calculation for VII (2.6), page 218. -/ +theorem boundary_of_disc_pasting_model + {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + {A : Set X} {B : Set Y} (hA : IsClosedDisc A) (hB : IsClosedDisc B) + (f : unitInterval → X) (g : unitInterval → Y) (hf : IsArcMap f) (_hg : IsArcMap g) + (hfbd : range f ⊆ discBd A) (hgbd : range g ⊆ discBd B) + (p : X → ℂ) (q : Y → ℂ) (hpc : ContinuousOn p A) (hqc : ContinuousOn q B) + (hpi : InjOn p A) (hqi : InjOn q B) + (hcover : p '' A ∪ q '' B = closedBall (0 : ℂ) 1) + (hmatch : ∀ x ∈ A, ∀ y ∈ B, p x = q y ↔ ∃ t, x = f t ∧ y = g t) + (hpair : ∀ t, p (f t) = q (g t)) : + sphere (0 : ℂ) 1 = (p '' discBd A ∪ q '' discBd B) \ + (p '' range f \ {p (f 0), p (f 1)}) := by + let : Nonempty X := ⟨hA.isPathConnected.nonempty.some⟩ + let : Nonempty Y := ⟨hB.isPathConnected.nonempty.some⟩ + obtain ⟨hPA, hbPA⟩ := isClosedDisc_image_injOn hA hA.isCompact hpc hpi + obtain ⟨hQB, hbQB⟩ := isClosedDisc_image_injOn hB hB.isCompact hqc hqi + have hfA : ∀ t, f t ∈ A := fun t => discBd_subset A (hfbd ⟨t, rfl⟩) + have hgB : ∀ t, g t ∈ B := fun t => discBd_subset B (hgbd ⟨t, rfl⟩) + have hI : p '' A ∩ q '' B = p '' range f := by + apply Subset.antisymm + · rintro z ⟨⟨x, hx, rfl⟩, ⟨y, hy, hyx⟩⟩ + obtain ⟨t, rfl, hyt⟩ := (hmatch x hx y hy).mp hyx.symm + exact mem_image_of_mem p (mem_range_self t) + · rintro z ⟨x, ⟨t, rfl⟩, rfl⟩ + exact ⟨mem_image_of_mem p (hfA t), ⟨g t, hgB t, (hpair t).symm⟩⟩ + have hpf : IsArcMap (p ∘ f) := + ⟨hpc.comp_continuous hf.1 hfA, fun s t heq => hf.2 (hpi (hfA s) (hfA t) heq)⟩ + have hline : IsLineWithEnds (p '' range f) (p (f 0)) (p (f 1)) := by + simpa only [range_comp, Function.comp_apply] using hpf.isLineWithEnds + have hbdA : p '' range f ⊆ discBd (p '' A) := by + rw [hbPA] + exact image_mono hfbd + have hbdB : p '' range f ⊆ discBd (q '' B) := by + rw [hbQB] + rintro z ⟨x, ⟨t, rfl⟩, rfl⟩ + exact ⟨g t, hgbd ⟨t, rfl⟩, (hpair t).symm⟩ + have hh := (disc_union (p '' A) (q '' B) (p '' range f) (p (f 0)) (p (f 1)) + hPA hQB hline hI hbdA hbdB).2 + rw [hcover, isClosedDisc_closedBall.2, hbPA, hbQB] at hh + exact hh + +/-- A point of the first piece remains on the pasted boundary +exactly when it was on that piece's boundary and outside the +open pasted arc. In particular the two arc ends remain. -/ +theorem mem_boundary_of_disc_pasting_model + {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + {A : Set X} {B : Set Y} (hA : IsClosedDisc A) (hB : IsClosedDisc B) + (f : unitInterval → X) (g : unitInterval → Y) (hf : IsArcMap f) (hg : IsArcMap g) + (hfbd : range f ⊆ discBd A) (hgbd : range g ⊆ discBd B) + (p : X → ℂ) (q : Y → ℂ) (hpc : ContinuousOn p A) (hqc : ContinuousOn q B) + (hpi : InjOn p A) (hqi : InjOn q B) + (hcover : p '' A ∪ q '' B = closedBall (0 : ℂ) 1) + (hmatch : ∀ x ∈ A, ∀ y ∈ B, p x = q y ↔ ∃ t, x = f t ∧ y = g t) + (hpair : ∀ t, p (f t) = q (g t)) {x : X} (hx : x ∈ A) : + p x ∈ sphere (0 : ℂ) 1 ↔ x ∈ discBd A ∧ x ∉ f '' Ioo (0 : unitInterval) 1 := by + have hfA : ∀ t, f t ∈ A := fun t => discBd_subset A (hfbd ⟨t, rfl⟩) + have hU : p x ∈ p '' discBd A ∪ q '' discBd B ↔ x ∈ discBd A := by + constructor + · rintro (⟨z, hz, hzx⟩ | ⟨y, hy, hyx⟩) + · exact hpi (discBd_subset A hz) hx hzx ▸ hz + · obtain ⟨t, rfl, hyt⟩ := (hmatch x hx y (discBd_subset B hy)).mp hyx.symm + exact hfbd ⟨t, rfl⟩ + · exact fun h => Or.inl (mem_image_of_mem p h) + have hK : p x ∈ p '' range f \ {p (f 0), p (f 1)} ↔ + x ∈ f '' Ioo (0 : unitInterval) 1 := by + constructor + · rintro ⟨⟨z, ⟨t, rfl⟩, htx⟩, hnot⟩ + have hfx : f t = x := hpi (hfA t) hx htx + have ht0 : t ≠ 0 := by + intro ht + exact hnot (Or.inl (htx.symm.trans (by rw [ht]))) + have ht1 : t ≠ 1 := by + intro ht + exact hnot (Or.inr (htx.symm.trans (by rw [ht]))) + exact ⟨t, ⟨unitInterval.pos_iff_ne_zero.mpr ht0, + unitInterval.lt_one_iff_ne_one.mpr ht1⟩, hfx⟩ + · rintro ⟨t, ht, rfl⟩ + refine ⟨mem_image_of_mem p (mem_range_self t), ?_⟩ + rintro (h0 | h1) + · have heq := hf.2 (hpi (hfA t) (hfA 0) h0) + exact ht.1.ne' heq + · have heq := hf.2 (hpi (hfA t) (hfA 1) (mem_singleton_iff.mp h1)) + exact ht.2.ne heq + rw [boundary_of_disc_pasting_model hA hB f g hf hg hfbd hgbd p q hpc hqc hpi hqi + hcover hmatch hpair] + exact and_congr hU (not_congr hK) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapNormal.lean b/LeanPool/GraphMinor/GM07/NetSwapNormal.lean new file mode 100644 index 0000000000..86817f4619 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapNormal.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.GM07.NetSwapArcs +import LeanPool.GraphMinor.GM07.Section2MinVal + +/-! +# Normality after exchanging a net subarc + +In VII (2.6), page 218, the new seam is contained in the old +seam together with the image of the cutting line. Both sets +are normal. The seam graph of the new net therefore makes +it a normal net as well. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface + +/-- Every point on the exchanged seam comes from the old boundary +or from the cutting line. This is the normality containment used +in the new-net construction of VII (2.6), page 218. -/ +theorem Net.seamU_subset_of_swap_maps + {S : Type*} [TopologicalSpace S] (N M : Net S) (i : Fin N.r) + (u v : unitInterval) (huv : u ≤ v) + {F C A B : Set N.D} + (hAd : discBd A = range (pieceA (N.f i) u.val v.val) ∪ F) + (hBd : discBd B = C ∪ F) + (hcover : range (pieceA (N.f i) u.val v.val) ∪ C = bd N.D) + (ψ : A ⊕ B → M.D) (hψ : Function.Surjective ψ) + (hφA : ∀ x : A, M.φ (ψ (Sum.inl x)) = N.φ x.val) + (hφB : ∀ y : B, M.φ (ψ (Sum.inr y)) = N.φ y.val) + (hαbd : ∀ x : A, ψ (Sum.inl x) ∈ bd M.D → x.val ∈ discBd A) + (hβbd : ∀ y : B, ψ (Sum.inr y) ∈ bd M.D → y.val ∈ discBd B) : + M.seamU ⊆ N.seamU ∪ N.φ '' F := by + rintro z ⟨w, hw, rfl⟩ + obtain ⟨a, ha⟩ := hψ w + cases a with + | inl x => + rw [← ha, hφA] + have hx := hαbd x (ha.symm ▸ hw) + rcases hAd ▸ hx with hxf | hxF + · have hxold : x.val ∈ bd N.D := by + obtain ⟨t, _, htx⟩ := (range_pieceA_unitInterval (N.f i) u v huv).subset hxf + exact N.range_f_subset_bd i ⟨t, htx⟩ + exact Or.inl ⟨x.val, hxold, rfl⟩ + · exact Or.inr ⟨x.val, hxF, rfl⟩ + | inr y => + rw [← ha, hφB] + have hy := hβbd y (ha.symm ▸ hw) + rcases hBd ▸ hy with hyC | hyF + · exact Or.inl ⟨y.val, hcover ▸ Or.inr hyC, rfl⟩ + · exact Or.inr ⟨y.val, hyF, rfl⟩ + +/-- A net with the same positive number of pairs and a seam contained +in the union of two normal sets is normal. The existence of its seam +graph follows from the proved seam-graph construction for every net. +This supplies normality for the exchange in VII (2.6), page 218. -/ +theorem Net.isNormalFor_of_swap_seam_subset + {S : Type*} [TopologicalSpace S] (hS : IsSurface S) (N M : Net S) + {G : Drawing S} {F : Set N.D} (hN : N.IsNormalFor G) (hr : M.r = N.r) + (hU : M.seamU ⊆ N.seamU ∪ N.φ '' F) (hF : G.IsNormal (N.φ '' F)) : + M.IsNormalFor G := by + obtain ⟨J, hJN, hGJ⟩ := hN + obtain ⟨K, hKM⟩ := M.exists_isSeamGraphFor hS (hr.symm ▸ hJN.1) + refine ⟨K, hKM, ?_⟩ + intro z hz + have hzM : z ∈ M.seamU := hKM.2.1 ▸ hz.1 + rcases hU hzM with hzN | hzF + · exact hGJ ⟨hJN.2.1.symm ▸ hzN, hz.2⟩ + · exact hF ⟨hzF, hz.2⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapPair.lean b/LeanPool/GraphMinor/GM07/NetSwapPair.lean new file mode 100644 index 0000000000..352fa7d55c --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapPair.lean @@ -0,0 +1,343 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.GM07.NetSwapSides +import LeanPool.GraphMinor.GM07.NetSwapReplacement +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# The replacement pair of side maps + +In VII (2.6), page 218, the two new paired sides keep the +outer parts of the selected old pair and insert the two lifts +of the cutting line. Construct both maps using the same path +parameters. The retained lift gives one injective side. The +pasting-fiber calculation gives injectivity of its mate. Their +images under the associated surjection agree at every parameter. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Surface + +private theorem replacement_ranges_subset_boundary + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (N : Net S) (i : Fin N.r) {u v : unitInterval} + (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F C A B : Set N.D} + (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) + (hAd : discBd A = range (pieceA (N.f i) u.val v.val) ∪ F) + (hBd : discBd B = C ∪ F) + (α : A → T) (β : B → T) + (hαbd : ∀ x : A, α x ∈ bd T ↔ x.val ∈ discBd A ∧ + x.val ∉ pieceA (N.f i) u.val v.val '' Ioo (0 : unitInterval) 1) + (hβbd : ∀ y : B, β y ∈ bd T ↔ y.val ∈ discBd B ∧ + y.val ∉ pieceA (N.g i) u.val v.val '' Ioo (0 : unitInterval) 1) + (hmates : range (N.g i) ⊆ discBd B) + (hleft : N.f i '' Icc 0 u ⊆ discBd B) + (hright : N.f i '' Icc v 1 ⊆ discBd B) : + ((β '' {x : B | x.val ∈ N.f i '' Icc 0 u} ∪ β '' {x : B | x.val ∈ F}) ∪ + β '' {x : B | x.val ∈ N.f i '' Icc v 1} ⊆ bd T) ∧ + ((β '' {x : B | x.val ∈ N.g i '' Icc 0 u} ∪ α '' {x : A | x.val ∈ F}) ∪ + β '' {x : B | x.val ∈ N.g i '' Icc v 1} ⊆ bd T) := by + have hfgOpen : Disjoint (range (N.f i)) + (pieceA (N.g i) u.val v.val '' Ioo (0 : unitInterval) 1) := by + rw [image_pieceA_Ioo_unitInterval (N.g i) u v huv] + apply disjoint_left.mpr + rintro x hx ⟨w, hw, rfl⟩ + exact N.internally_disjoint_gf i i w ⟨hu.trans hw.1, hw.2.trans hv⟩ hx + have hFgoff : Disjoint F (pieceA (N.g i) u.val v.val '' Ioo (0 : unitInterval) 1) := by + apply disjoint_left.mpr + intro x hxF hxg + have hxg' : x ∈ N.g i '' Ioo u v := + image_pieceA_Ioo_unitInterval (N.g i) u v huv ▸ hxg + obtain ⟨w, hw, hwx⟩ := hxg' + have hxbd : x ∈ bd N.D := N.range_g_subset_bd i ⟨w, hwx⟩ + have hxfi : x ∈ range (N.f i) := by + rcases hFbd.subset ⟨hxF, hxbd⟩ with he | he + · exact ⟨u, he.symm⟩ + · exact ⟨v, (mem_singleton_iff.mp he).symm⟩ + exact disjoint_left.mp hfgOpen hxfi hxg + have hFfoff : Disjoint F (pieceA (N.f i) u.val v.val '' Ioo (0 : unitInterval) 1) := by + rw [image_pieceA_Ioo_unitInterval (N.f i) u v huv] + apply disjoint_left.mpr + rintro x hxF ⟨w, hw, rfl⟩ + have hend := hFbd.subset ⟨hxF, N.range_f_subset_bd i (mem_range_self w)⟩ + rcases hend with he | he + · exact hw.1.ne' (N.injective_f i he) + · exact hw.2.ne (N.injective_f i (mem_singleton_iff.mp he)) + have hgoff : ∀ t : unitInterval, t ≤ u ∨ v ≤ t → + N.g i t ∉ pieceA (N.g i) u.val v.val '' Ioo (0 : unitInterval) 1 := by + intro t ht + rw [image_pieceA_Ioo_unitInterval (N.g i) u v huv] + rintro ⟨w, hw, hwt⟩ + have hwt' : w = t := N.injective_g i hwt + rcases ht with ht | ht + · exact (not_le_of_gt hw.1) (hwt'.symm ▸ ht) + · exact (not_le_of_gt hw.2) (hwt'.symm ▸ ht) + have hβfL : ∀ x : B, x.val ∈ N.f i '' Icc 0 u → β x ∈ bd T := by + intro x hx + exact (hβbd x).mpr ⟨hleft hx, + fun h => disjoint_left.mp hfgOpen (image_subset_range _ _ hx) h⟩ + have hβfR : ∀ x : B, x.val ∈ N.f i '' Icc v 1 → β x ∈ bd T := by + intro x hx + exact (hβbd x).mpr ⟨hright hx, + fun h => disjoint_left.mp hfgOpen (image_subset_range _ _ hx) h⟩ + have hβF : ∀ x : B, x.val ∈ F → β x ∈ bd T := by + intro x hx + exact (hβbd x).mpr ⟨hBd ▸ Or.inr hx, fun h => disjoint_left.mp hFgoff hx h⟩ + have hαF : ∀ x : A, x.val ∈ F → α x ∈ bd T := by + intro x hx + exact (hαbd x).mpr ⟨hAd ▸ Or.inr hx, fun h => disjoint_left.mp hFfoff hx h⟩ + have hβgL : ∀ x : B, x.val ∈ N.g i '' Icc 0 u → β x ∈ bd T := by + rintro x ⟨t, ht, htx⟩ + apply (hβbd x).mpr + refine ⟨hmates ⟨t, htx⟩, ?_⟩ + rw [← htx] + exact hgoff t (Or.inl ht.2) + have hβgR : ∀ x : B, x.val ∈ N.g i '' Icc v 1 → β x ∈ bd T := by + rintro x ⟨t, ht, htx⟩ + apply (hβbd x).mpr + refine ⟨hmates ⟨t, htx⟩, ?_⟩ + rw [← htx] + exact hgoff t (Or.inr ht.1) + constructor + · rintro z ((⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩) | ⟨x, hx, rfl⟩) + · exact hβfL x hx + · exact hβF x hx + · exact hβfR x hx + · rintro z ((⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩) | ⟨x, hx, rfl⟩) + · exact hβgL x hx + · exact hαF x hx + · exact hβgR x hx + +/-- Construct the two replacement side maps in the cut-and-paste +configuration of VII (2.6), page 218. They remain injective and +paired under the associated map, with the old endpoint images. -/ +theorem Net.exists_replacement_pair + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (N : Net S) (i : Fin N.r) (u v : unitInterval) + (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F C A B : Set N.D} (hF : IsLineWithEnds F (N.f i u) (N.f i v)) + (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) (hI : A ∩ B = F) + (hAd : discBd A = range (pieceA (N.f i) u.val v.val) ∪ F) + (hcover : range (pieceA (N.f i) u.val v.val) ∪ C = bd N.D) + (hBd : discBd B = C ∪ F) + (α : A → T) (β : B → T) (hcα : Continuous α) (hcβ : Continuous β) + (hiα : Function.Injective α) (hiβ : Function.Injective β) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ + ∃ t, x.val = pieceA (N.f i) u.val v.val t ∧ y.val = pieceA (N.g i) u.val v.val t) + (hαbd : ∀ x : A, α x ∈ bd T ↔ x.val ∈ discBd A ∧ + x.val ∉ pieceA (N.f i) u.val v.val '' Ioo (0 : unitInterval) 1) + (hβbd : ∀ y : B, β y ∈ bd T ↔ y.val ∈ discBd B ∧ + y.val ∉ pieceA (N.g i) u.val v.val '' Ioo (0 : unitInterval) 1) + (φ : T → S) (hφA : ∀ x : A, φ (α x) = N.φ x.val) + (hφB : ∀ y : B, φ (β y) = N.φ y.val) : + ∃ p q : Curve T, Function.Injective p ∧ Function.Injective q ∧ + (∀ t, φ (p t) = φ (q t)) ∧ + φ (p 0) = N.φ (N.f i 0) ∧ φ (p 1) = N.φ (N.f i 1) ∧ + φ (q 0) = N.φ (N.g i 0) ∧ φ (q 1) = N.φ (N.g i 1) ∧ + range p = (β '' {x : B | x.val ∈ N.f i '' Icc 0 u} ∪ + β '' {x : B | x.val ∈ F}) ∪ β '' {x : B | x.val ∈ N.f i '' Icc v 1} ∧ + range q = (β '' {x : B | x.val ∈ N.g i '' Icc 0 u} ∪ + α '' {x : A | x.val ∈ F}) ∪ β '' {x : B | x.val ∈ N.g i '' Icc v 1} ∧ + range p ⊆ bd T ∧ range q ⊆ bd T ∧ + p 0 ∈ β '' {x : B | x.val = N.f i 0} ∧ p 1 ∈ β '' {x : B | x.val = N.f i 1} ∧ + q 0 ∈ β '' {x : B | x.val = N.g i 0} ∧ q 1 ∈ β '' {x : B | x.val = N.g i 1} ∧ + (∀ t ∈ Ioo (0 : unitInterval) 1, p t ∉ range q) ∧ + (∀ t ∈ Ioo (0 : unitInterval) 1, q t ∉ range p) := by + let a : Path (N.f i 0) (N.f i 1) := + { toContinuousMap := N.f i, source' := rfl, target' := rfl } + let b : Path (N.g i 0) (N.g i 1) := + { toContinuousMap := N.g i, source' := rfl, target' := rfl } + have ha : IsArcMap a := ⟨a.continuous, N.injective_f i⟩ + have hb : IsArcMap b := ⟨b.continuous, N.injective_g i⟩ + obtain ⟨k, hk, hkF, hk0, hk1⟩ := hF.exists_arc + let c : Path (a u) (a v) := + { toFun := k, continuous_toFun := hk.1, source' := hk0, target' := hk1 } + have hc : IsArcMap c := hk + have hcF : range c = F := hkF + have hca : range c ∩ range a = {a u, a v} := by + rw [hcF] + apply Subset.antisymm + · exact fun x hx => hFbd.subset ⟨hx.1, N.range_f_subset_bd i hx.2⟩ + · rintro x (rfl | rfl) + · exact ⟨hF.left_mem, mem_range_self u⟩ + · exact ⟨hF.right_mem, mem_range_self v⟩ + have hFA : F ⊆ A := fun x hx => (hI.symm ▸ hx).1 + have hFB : F ⊆ B := fun x hx => (hI.symm ▸ hx).2 + have hcA : ∀ t, c t ∈ A := fun t => hFA (hcF ▸ mem_range_self t) + have hcB : ∀ t, c t ∈ B := fun t => hFB (hcF ▸ mem_range_self t) + obtain ⟨hother, hmates, hleft, hright⟩ := N.sides_on_retained_piece i u v hu huv hv hF hcover hBd + have hbB : ∀ t, b t ∈ B := fun t => discBd_subset B (hmates i (mem_range_self t)) + have hlB : ∀ t, (a.subpath 0 u) t ∈ B := by + intro t + have hx := (Path.range_subpath_of_le a 0 u (unitInterval.nonneg u)).subset (mem_range_self t) + exact discBd_subset B (hleft hx) + have hrB : ∀ t, (a.subpath v 1) t ∈ B := by + intro t + have hx := (Path.range_subpath_of_le a v 1 (unitInterval.le_one v)).subset (mem_range_self t) + exact discBd_subset B (hright hx) + let left := (pathWithinSet (a.subpath 0 u) hlB).map hcβ + let middle := (pathWithinSet c hcB).map hcβ + let right := (pathWithinSet (a.subpath v 1) hrB).map hcβ + let p := (left.trans middle).trans right + let old := (a.subpath 0 u).trans c |>.trans (a.subpath v 1) + have hOldArc : IsArcMap old := isArcMap_spliced_path a ha hu huv hv c hc hca + have hOldB : ∀ t, old t ∈ B := by + intro t + have ht : old t ∈ range old := mem_range_self t + rw [Path.trans_range, Path.trans_range] at ht + rcases ht with (⟨s, hs⟩ | ⟨s, hs⟩) | ⟨s, hs⟩ + · exact hs ▸ hlB s + · exact hs ▸ hcB s + · exact hs ▸ hrB s + have hp : ∀ t, p t = β ⟨old t, hOldB t⟩ := by + intro t + change (((left.trans middle).trans right) t) = β ⟨(((a.subpath 0 u).trans c).trans + (a.subpath v 1)) t, _⟩ + simp only [Path.trans_apply] + split_ifs <;> rfl + have hpArc : IsArcMap p := by + refine ⟨p.continuous, ?_⟩ + intro s t heq + rw [hp s, hp t] at heq + exact hOldArc.2 (congrArg Subtype.val (hiβ heq)) + let base := (pathWithinSet b hbB).map hcβ + let attached := (pathWithinSet c hcA).map hcα + have hcross' : ∀ (x : A) (y : B), α x = β y ↔ + ∃ t, x.val = (a.subpath u v) t ∧ y.val = (b.subpath u v) t := by + intro x y + have h := hcross x y + change α x = β y ↔ ∃ t, x.val = pieceA a u.val v.val t ∧ + y.val = pieceA b u.val v.val t at h + simpa only [pieceA_eq_subpath] using h + have h0 : attached 0 = base u := by + change α ⟨c 0, hcA 0⟩ = β ⟨b u, hbB u⟩ + exact (hcross' _ _).mpr ⟨0, c.source.trans (a.subpath u v).source.symm, + (b.subpath u v).source.symm⟩ + have h1 : attached 1 = base v := by + change α ⟨c 1, hcA 1⟩ = β ⟨b v, hbB v⟩ + exact (hcross' _ _).mpr ⟨1, c.target.trans (a.subpath u v).target.symm, + (b.subpath u v).target.symm⟩ + let mid := attached.cast (h0.symm.trans attached.source) (h1.symm.trans attached.target) + let q := ((base.subpath 0 u).trans mid).trans (base.subpath v 1) + have hqArc : IsArcMap q := isArcMap_spliced_mate_path a b ha hb hu huv hv c hc hca hcA hbB + α β hiα hiβ hcross' base mid (fun t => rfl) (fun t => rfl) + have hlφ : ∀ t, φ (left t) = φ ((base.subpath 0 u) t) := by + intro t + change φ (β ⟨(a.subpath 0 u) t, hlB t⟩) = + φ (β ⟨b (Icc.convexComb 0 u t), hbB (Icc.convexComb 0 u t)⟩) + rw [hφB, hφB] + exact N.pasting_eq i (Icc.convexComb 0 u t) + have hmφ : ∀ t, φ (middle t) = φ (mid t) := by + intro t + change φ (β ⟨c t, hcB t⟩) = φ (α ⟨c t, hcA t⟩) + rw [hφB, hφA] + have hrφ : ∀ t, φ (right t) = φ ((base.subpath v 1) t) := by + intro t + change φ (β ⟨(a.subpath v 1) t, hrB t⟩) = + φ (β ⟨b (Icc.convexComb v 1 t), hbB (Icc.convexComb v 1 t)⟩) + rw [hφB, hφB] + exact N.pasting_eq i (Icc.convexComb v 1 t) + have hpq : ∀ t, φ (p t) = φ (q t) := + image_path_trans_eq φ _ _ _ _ (image_path_trans_eq φ _ _ _ _ hlφ hmφ) hrφ + have hleftRange : range left = β '' {x : B | x.val ∈ N.f i '' Icc 0 u} := by + change range (fun t => β ⟨(a.subpath 0 u) t, hlB t⟩) = _ + rw [range_map_into_set, Path.range_subpath_of_le a 0 u (unitInterval.nonneg u)] + rfl + have hrightRange : range right = β '' {x : B | x.val ∈ N.f i '' Icc v 1} := by + change range (fun t => β ⟨(a.subpath v 1) t, hrB t⟩) = _ + rw [range_map_into_set, Path.range_subpath_of_le a v 1 (unitInterval.le_one v)] + rfl + have hmiddleRange : range middle = β '' {x : B | x.val ∈ F} := by + change range (fun t => β ⟨c t, hcB t⟩) = _ + rw [range_map_into_set, hcF] + have hbaseLeft : range (base.subpath 0 u) = β '' {x : B | x.val ∈ N.g i '' Icc 0 u} := by + change range (fun t => β ⟨(b.subpath 0 u) t, hbB (Icc.convexComb 0 u t)⟩) = _ + have hh := range_map_into_set (fun t => (b.subpath 0 u) t) + (fun t => hbB (Icc.convexComb 0 u t)) β + rw [Path.range_subpath_of_le b 0 u (unitInterval.nonneg u)] at hh + exact hh + have hbaseRight : range (base.subpath v 1) = β '' {x : B | x.val ∈ N.g i '' Icc v 1} := by + change range (fun t => β ⟨(b.subpath v 1) t, hbB (Icc.convexComb v 1 t)⟩) = _ + have hh := range_map_into_set (fun t => (b.subpath v 1) t) + (fun t => hbB (Icc.convexComb v 1 t)) β + rw [Path.range_subpath_of_le b v 1 (unitInterval.le_one v)] at hh + exact hh + have hmidRange : range mid = α '' {x : A | x.val ∈ F} := by + change range (fun t => α ⟨c t, hcA t⟩) = _ + rw [range_map_into_set, hcF] + have hpRange : range p = (β '' {x : B | x.val ∈ N.f i '' Icc 0 u} ∪ + β '' {x : B | x.val ∈ F}) ∪ β '' {x : B | x.val ∈ N.f i '' Icc v 1} := by + change range ((left.trans middle).trans right) = _ + rw [Path.trans_range, Path.trans_range, hleftRange, hmiddleRange, hrightRange] + have hqRange : range q = (β '' {x : B | x.val ∈ N.g i '' Icc 0 u} ∪ + α '' {x : A | x.val ∈ F}) ∪ β '' {x : B | x.val ∈ N.g i '' Icc v 1} := by + change range (((base.subpath 0 u).trans mid).trans (base.subpath v 1)) = _ + rw [Path.trans_range, Path.trans_range, hbaseLeft, hmidRange, hbaseRight] + obtain ⟨hpbd, hqbd⟩ := + replacement_ranges_subset_boundary N i hu huv hv hFbd hAd hBd α β hαbd hβbd + (hmates i) hleft hright + have hFg := (N.cutting_line_disjoint_other_sides i hu huv hv hFbd).2 i + have hP : Disjoint (β '' {x : B | x.val ∈ F}) + (β '' {x : B | x.val ∈ range (N.g i)}) := by + apply disjoint_left.mpr + rintro z ⟨x, hx, rfl⟩ ⟨y, hy, heq⟩ + have hxy : y = x := hiβ heq + exact disjoint_left.mp hFg hx (hxy ▸ hy) + have hQ : Disjoint (α '' {x : A | x.val ∈ F}) + (β '' {x : B | x.val ∈ range (N.f i)}) := by + exact ((N.attached_piece_disjoint_other_sides i hu huv hv α β hcross).1 i).mono_left + (image_subset_range _ _) + have hPQ : Disjoint (β '' {x : B | x.val ∈ F}) (α '' {x : A | x.val ∈ F}) := by + apply disjoint_left.mpr + rintro z ⟨x, hx, rfl⟩ ⟨y, _, heq⟩ + obtain ⟨t, _, hxt⟩ := (hcross y x).mp heq + have hxg : x.val ∈ range (N.g i) := by + have hseg := range_pieceA_unitInterval (N.g i) u v huv.le + exact image_subset_range _ _ (hseg.subset ⟨t, hxt.symm⟩) + exact disjoint_left.mp hFg hx hxg + have hpCoarse : range p ⊆ β '' {x : B | x.val ∈ range (N.f i)} ∪ + β '' {x : B | x.val ∈ F} := by + rw [hpRange] + rintro z ((⟨x, hx, rfl⟩ | hz) | ⟨x, hx, rfl⟩) + · exact Or.inl ⟨x, image_subset_range _ _ hx, rfl⟩ + · exact Or.inr hz + · exact Or.inl ⟨x, image_subset_range _ _ hx, rfl⟩ + have hqCoarse : range q ⊆ β '' {x : B | x.val ∈ range (N.g i)} ∪ + α '' {x : A | x.val ∈ F} := by + rw [hqRange] + rintro z ((⟨x, hx, rfl⟩ | hz) | ⟨x, hx, rfl⟩) + · exact Or.inl ⟨x, image_subset_range _ _ hx, rfl⟩ + · exact Or.inr hz + · exact Or.inl ⟨x, image_subset_range _ _ hx, rfl⟩ + have hpqDisj := internally_disjoint_replacement_sides (N.f i) (N.g i) β hiβ + (N.internally_disjoint_fg i i) (N.internally_disjoint_gf i i) p q hpArc.2 hqArc.2 + hpCoarse hqCoarse hP hQ hPQ + ⟨_, rfl, p.source.symm⟩ ⟨_, rfl, p.target.symm⟩ + ⟨_, rfl, q.source.symm⟩ ⟨_, rfl, q.target.symm⟩ + refine ⟨p.toContinuousMap, q.toContinuousMap, hpArc.2, hqArc.2, hpq, ?_, ?_, ?_, ?_, + hpRange, hqRange, hpRange ▸ hpbd, hqRange ▸ hqbd, ?_, ?_, ?_, ?_, hpqDisj.1, hpqDisj.2⟩ + · exact (congrArg φ p.source).trans (hφB _) + · exact (congrArg φ p.target).trans (hφB _) + · exact (congrArg φ q.source).trans (hφB _) + · exact (congrArg φ q.target).trans (hφB _) + · exact ⟨_, rfl, p.source.symm⟩ + · exact ⟨_, rfl, p.target.symm⟩ + · exact ⟨_, rfl, q.source.symm⟩ + · exact ⟨_, rfl, q.target.symm⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapPasting.lean b/LeanPool/GraphMinor/GM07/NetSwapPasting.lean new file mode 100644 index 0000000000..340d7c4f34 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapPasting.lean @@ -0,0 +1,165 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.GM07.NetSwapDisc +import LeanPool.GraphMinor.GM07.NetSwapFrontier +import LeanPool.GraphMinor.Surface.DiscUnion + +/-! +# The quotient map for pasting the net pieces + +VII (2.6), page 218, pastes a paired subarc after cutting the +source disc along a proper line. The two-piece disc model gives +a continuous surjection onto a closed disc. Compactness makes +it a quotient map. Its fibers identify exactly the prescribed +boundary points, so a map constant on the pasted pairs can be +carried to the new disc. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Surface + +universe u v + +/-- The quotient map pasting two closed discs along the given +boundary parametrizations, for the net exchange in VII (2.6), +page 218. No other identifications are made. -/ +theorem exists_disc_pasting_quotient + {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] + {A : Set X} {B : Set Y} (hA : IsClosedDisc A) (hB : IsClosedDisc B) + (f : unitInterval → X) (g : unitInterval → Y) (hf : IsArcMap f) (hg : IsArcMap g) + (hfbd : range f ⊆ discBd A) (hgbd : range g ⊆ discBd B) : + ∃ ψ : A ⊕ B → closedBall (0 : ℂ) 1, + IsQuotientMap ψ ∧ Function.Injective (ψ ∘ Sum.inl) ∧ + Function.Injective (ψ ∘ Sum.inr) ∧ + (∀ (x : A) (y : B), ψ (Sum.inl x) = ψ (Sum.inr y) ↔ + ∃ t, x.val = f t ∧ y.val = g t) ∧ + (∀ x : A, ψ (Sum.inl x) ∈ bd (closedBall (0 : ℂ) 1) ↔ + x.val ∈ discBd A ∧ x.val ∉ f '' Ioo (0 : unitInterval) 1) ∧ + (∀ y : B, ψ (Sum.inr y) ∈ bd (closedBall (0 : ℂ) 1) ↔ + y.val ∈ discBd B ∧ y.val ∉ g '' Ioo (0 : unitInterval) 1) := by + obtain ⟨p, q, hpc, hqc, hpi, hqi, hcover, hmatch, hpair⟩ := + exists_disc_pasting_model hA hB f g hf hg hfbd hgbd + have hpball : ∀ x ∈ A, p x ∈ closedBall (0 : ℂ) 1 := + fun x hx => hcover ▸ Or.inl (mem_image_of_mem p hx) + have hqball : ∀ y ∈ B, q y ∈ closedBall (0 : ℂ) 1 := + fun y hy => hcover ▸ Or.inr (mem_image_of_mem q hy) + let p' : A → closedBall (0 : ℂ) 1 := fun x => ⟨p x.val, hpball x.val x.property⟩ + let q' : B → closedBall (0 : ℂ) 1 := fun y => ⟨q y.val, hqball y.val y.property⟩ + let ψ : A ⊕ B → closedBall (0 : ℂ) 1 := Sum.elim p' q' + have hpc' : Continuous p' := hpc.domRestrict.subtype_mk _ + have hqc' : Continuous q' := hqc.domRestrict.subtype_mk _ + have hψc : Continuous ψ := hpc'.sumElim hqc' + have hψs : Function.Surjective ψ := by + intro z + have hz : z.val ∈ p '' A ∪ q '' B := hcover.symm ▸ z.property + rcases hz with ⟨x, hx, hxz⟩ | ⟨y, hy, hyz⟩ + · exact ⟨Sum.inl ⟨x, hx⟩, Subtype.ext hxz⟩ + · exact ⟨Sum.inr ⟨y, hy⟩, Subtype.ext hyz⟩ + let : CompactSpace A := isCompact_iff_compactSpace.mp hA.isCompact + let : CompactSpace B := isCompact_iff_compactSpace.mp hB.isCompact + have hunit : ∀ z : closedBall (0 : ℂ) 1, + z ∈ bd (closedBall (0 : ℂ) 1) ↔ z.val ∈ sphere (0 : ℂ) 1 := by + intro z + rw [← isClosedDisc_closedBall.2] + change z ∈ bd (closedBall (0 : ℂ) 1) ↔ z.val ∈ Subtype.val '' bd (closedBall (0 : ℂ) 1) + constructor + · exact fun hz => ⟨z, hz, rfl⟩ + · rintro ⟨w, hw, hwz⟩ + exact Subtype.val_injective hwz ▸ hw + refine ⟨ψ, IsQuotientMap.of_surjective_continuous hψs hψc, ?_, ?_, ?_, ?_, ?_⟩ + · intro x y heq + exact Subtype.ext (hpi x.property y.property (congrArg Subtype.val heq)) + · intro x y heq + exact Subtype.ext (hqi x.property y.property (congrArg Subtype.val heq)) + · intro x y + exact (Subtype.ext_iff).trans (hmatch x.val x.property y.val y.property) + · intro x + exact (hunit (ψ (Sum.inl x))).trans + (mem_boundary_of_disc_pasting_model hA hB f g hf hg hfbd hgbd p q hpc hqc hpi hqi + hcover hmatch hpair x.property) + · intro y + have hmatch' : ∀ y ∈ B, ∀ x ∈ A, q y = p x ↔ ∃ t, y = g t ∧ x = f t := by + intro y hy x hx + constructor + · intro heq + obtain ⟨t, ht, ht'⟩ := (hmatch x hx y hy).mp heq.symm + exact ⟨t, ht', ht⟩ + · rintro ⟨t, rfl, rfl⟩ + exact (hpair t).symm + have hcover' : q '' B ∪ p '' A = closedBall (0 : ℂ) 1 := by + rw [union_comm] + exact hcover + exact (hunit (ψ (Sum.inr y))).trans + (mem_boundary_of_disc_pasting_model hB hA g f hg hf hgbd hfbd q p hqc hpc hqi hpi + hcover' hmatch' (fun t => (hpair t).symm) y.property) + +/-- A continuous map on each piece, agreeing on the pasted +parameters, descends continuously to the new closed disc. +This carries the original net surjection through the pasting +step of VII (2.6), page 218. -/ +theorem exists_map_on_pasted_disc + {X : Type u} {Y : Type v} {S : Type*} + [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace S] + {A : Set X} {B : Set Y} (hA : IsClosedDisc A) (hB : IsClosedDisc B) + (f : unitInterval → X) (g : unitInterval → Y) (hf : IsArcMap f) (hg : IsArcMap g) + (hfbd : range f ⊆ discBd A) (hgbd : range g ⊆ discBd B) + (α : X → S) (β : Y → S) (hα : ContinuousOn α A) (hβ : ContinuousOn β B) + (hαβ : ∀ t, α (f t) = β (g t)) : + ∃ (ψ : A ⊕ B → closedBall (0 : ℂ) 1) (φ : closedBall (0 : ℂ) 1 → S), + IsQuotientMap ψ ∧ Continuous φ ∧ + (∀ x : A, φ (ψ (Sum.inl x)) = α x.val) ∧ + (∀ y : B, φ (ψ (Sum.inr y)) = β y.val) ∧ + Function.Injective (ψ ∘ Sum.inl) ∧ Function.Injective (ψ ∘ Sum.inr) ∧ + (∀ (x : A) (y : B), ψ (Sum.inl x) = ψ (Sum.inr y) ↔ + ∃ t, x.val = f t ∧ y.val = g t) ∧ + (∀ x : A, ψ (Sum.inl x) ∈ bd (closedBall (0 : ℂ) 1) ↔ + x.val ∈ discBd A ∧ x.val ∉ f '' Ioo (0 : unitInterval) 1) ∧ + (∀ y : B, ψ (Sum.inr y) ∈ bd (closedBall (0 : ℂ) 1) ↔ + y.val ∈ discBd B ∧ y.val ∉ g '' Ioo (0 : unitInterval) 1) := by + classical + obtain ⟨ψ, hψ, hinl, hinr, hcross, hbA, hbB⟩ := exists_disc_pasting_quotient hA hB f g hf hg hfbd + hgbd + let h : A ⊕ B → S := Sum.elim (fun x => α x.val) (fun y => β y.val) + have hcongr : ∀ x y, ψ x = ψ y → h x = h y := by + intro x y heq + cases x with + | inl x => + cases y with + | inl y => exact congrArg (fun x : A => α x.val) (hinl heq) + | inr y => + obtain ⟨t, hx, hy⟩ := (hcross x y).mp heq + change α x.val = β y.val + rw [hx, hy] + exact hαβ t + | inr x => + cases y with + | inl y => + obtain ⟨t, hy, hx⟩ := (hcross y x).mp heq.symm + change β x.val = α y.val + rw [hx, hy] + exact (hαβ t).symm + | inr y => exact congrArg (fun y : B => β y.val) (hinr heq) + let φ : closedBall (0 : ℂ) 1 → S := h ∘ Function.surjInv hψ.surjective + have hφψ : ∀ x, φ (ψ x) = h x := fun x => + hcongr _ x (Function.surjInv_eq hψ.surjective (ψ x)) + have hc : Continuous φ := by + apply hψ.continuous_iff.mpr + rw [show φ ∘ ψ = h from funext hφψ] + exact hα.domRestrict.sumElim hβ.domRestrict + exact ⟨ψ, φ, hψ, hc, fun x => hφψ (Sum.inl x), fun y => hφψ (Sum.inr y), + hinl, hinr, hcross, hbA, hbB⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapPastingCounts.lean b/LeanPool/GraphMinor/GM07/NetSwapPastingCounts.lean new file mode 100644 index 0000000000..4af077321b --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapPastingCounts.lean @@ -0,0 +1,143 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Data.Set.Card +import LeanPool.GraphMinor.GM07.NetSwapCounts + +/-! +# The finite contact count for pasting two pieces + +When two boundary arcs are pasted, their common open part leaves +the boundary. Their common ends remain once. Count contacts on the +two pieces before identifying the common arc, keeping its open +part and ends separate. This is the pasting half of the exact +count in VII (2.6), page 218. +-/ + +public section +namespace GraphMinor.GM07 +open Set + +/-- A two-piece boundary whose pasted open arc is removed is the +union of the piece boundaries minus the image of that open arc. -/ +theorem pasted_boundary_eq + {I A B T : Type*} (a : I → A) (b : I → B) (α : A → T) (β : B → T) + (hα : Function.Injective α) (ha : Function.Injective a) + (hcross : ∀ x y, α x = β y ↔ ∃ t, x = a t ∧ y = b t) + (hT : range α ∪ range β = univ) (KA : Set A) (KB : Set B) (O : Set I) (L : Set T) + (hLA : ∀ x, α x ∈ L ↔ x ∈ KA ∧ x ∉ a '' O) + (hLB : ∀ y, β y ∈ L ↔ y ∈ KB ∧ y ∉ b '' O) : + L = (α '' KA ∪ β '' KB) \ ((α ∘ a) '' O) := by + have hPair : ∀ t, α (a t) = β (b t) := fun t => (hcross _ _).mpr ⟨t, rfl, rfl⟩ + apply Subset.antisymm + · intro z hz + rcases hT.symm ▸ mem_univ z with ⟨x, rfl⟩ | ⟨y, rfl⟩ + · obtain ⟨hxK, hxO⟩ := (hLA x).mp hz + refine ⟨Or.inl ⟨x, hxK, rfl⟩, ?_⟩ + rintro ⟨t, ht, htx⟩ + exact hxO ⟨t, ht, hα htx⟩ + · obtain ⟨hyK, hyO⟩ := (hLB y).mp hz + refine ⟨Or.inr ⟨y, hyK, rfl⟩, ?_⟩ + rintro ⟨t, ht, hty⟩ + obtain ⟨s, has, hys⟩ := (hcross (a t) y).mp hty + exact hyO ⟨t, ht, (congrArg b (ha has)).trans hys.symm⟩ + · rintro z ⟨(⟨x, hx, rfl⟩ | ⟨y, hy, rfl⟩), hn⟩ + · apply (hLA x).mpr + refine ⟨hx, ?_⟩ + rintro ⟨t, ht, htx⟩ + exact hn ⟨t, ht, congrArg α htx⟩ + · apply (hLB y).mpr + refine ⟨hy, ?_⟩ + rintro ⟨t, ht, hty⟩ + exact hn ⟨t, ht, (hPair t).trans (congrArg β hty)⟩ + +/-- Pasting removes two copies of each open-arc contact and one copy +of each common endpoint contact from the sum over the two pieces. +The parameter sets `O` and `E` partition the pasted arc into its +open part and its ends. -/ +theorem ncard_pasting_contacts + {I A B T S : Type*} (a : I → A) (b : I → B) (α : A → T) (β : B → T) + (hα : Function.Injective α) (hβ : Function.Injective β) (ha : Function.Injective a) + (hcross : ∀ x y, α x = β y ↔ ∃ t, x = a t ∧ y = b t) + (KA : Set A) (KB : Set B) (hKA : range a ⊆ KA) (hKB : range b ⊆ KB) + (O E : Set I) (hOE : Disjoint O E) (hCover : O ∪ E = univ) + (φ : T → S) (V : Set S) + (hPA : (KA ∩ (φ ∘ α) ⁻¹' V).Finite) + (hPB : (KB ∩ (φ ∘ β) ⁻¹' V).Finite) : + (((α '' KA ∪ β '' KB) \ ((α ∘ a) '' O)) ∩ φ ⁻¹' V).ncard + + 2 * (O ∩ (φ ∘ α ∘ a) ⁻¹' V).ncard + + (E ∩ (φ ∘ α ∘ a) ⁻¹' V).ncard = + (KA ∩ (φ ∘ α) ⁻¹' V).ncard + (KB ∩ (φ ∘ β) ⁻¹' V).ncard := by + let P := α '' (KA ∩ (φ ∘ α) ⁻¹' V) + let Q := β '' (KB ∩ (φ ∘ β) ⁻¹' V) + let k := α ∘ a + let W := (φ ∘ k) ⁻¹' V + have hk : Function.Injective k := hα.comp ha + have hPair : ∀ t, α (a t) = β (b t) := fun t => (hcross _ _).mpr ⟨t, rfl, rfl⟩ + have hInter : P ∩ Q = k '' W := by + apply Subset.antisymm + · rintro z ⟨⟨x, hx, hxz⟩, ⟨y, hy, hyz⟩⟩ + obtain ⟨t, rfl, rfl⟩ := (hcross x y).mp (hxz.trans hyz.symm) + exact ⟨t, hx.2, hxz⟩ + · rintro z ⟨t, ht, rfl⟩ + exact ⟨⟨a t, ⟨hKA (mem_range_self t), ht⟩, rfl⟩, + ⟨b t, ⟨hKB (mem_range_self t), (show φ (β (b t)) ∈ V from (congrArg φ (hPair t)) ▸ ht)⟩, + (hPair t).symm⟩⟩ + have hParts : ∀ t, t ∈ O ↔ t ∉ E := by + intro t + constructor + · exact fun ht he => disjoint_left.mp hOE ht he + · intro ht + exact (hCover.symm ▸ mem_univ t).resolve_right ht + have hOpen : (P ∩ Q) \ (k '' E) = k '' (O ∩ W) := by + rw [hInter] + apply Subset.antisymm + · rintro z ⟨⟨t, ht, rfl⟩, hn⟩ + exact ⟨t, ⟨(hParts t).mpr (fun he => hn ⟨t, he, rfl⟩), ht⟩, rfl⟩ + · rintro z ⟨t, ⟨htO, htW⟩, rfl⟩ + refine ⟨⟨t, htW, rfl⟩, ?_⟩ + rintro ⟨s, hs, hst⟩ + exact (hParts t).mp htO (hk hst ▸ hs) + have hEnd : (P ∩ Q) ∩ (k '' E) = k '' (E ∩ W) := by + rw [hInter] + apply Subset.antisymm + · rintro z ⟨⟨t, ht, rfl⟩, ⟨s, hs, hst⟩⟩ + exact ⟨t, ⟨hk hst ▸ hs, ht⟩, rfl⟩ + · rintro z ⟨t, ⟨htE, htW⟩, rfl⟩ + exact ⟨⟨t, htW, rfl⟩, ⟨t, htE, rfl⟩⟩ + have hUnion : P ∪ Q = (α '' KA ∪ β '' KB) ∩ φ ⁻¹' V := by + ext z + constructor + · rintro (⟨x, hx, rfl⟩ | ⟨y, hy, rfl⟩) + · exact ⟨Or.inl ⟨x, hx.1, rfl⟩, hx.2⟩ + · exact ⟨Or.inr ⟨y, hy.1, rfl⟩, hy.2⟩ + · rintro ⟨(⟨x, hx, rfl⟩ | ⟨y, hy, rfl⟩), hz⟩ + · exact Or.inl ⟨x, ⟨hx, hz⟩, rfl⟩ + · exact Or.inr ⟨y, ⟨hy, hz⟩, rfl⟩ + have hRem : (P ∪ Q) \ ((P ∩ Q) \ (k '' E)) = + ((α '' KA ∪ β '' KB) \ (k '' O)) ∩ φ ⁻¹' V := by + rw [hOpen, hUnion] + apply Subset.antisymm + · rintro z ⟨⟨hz, hzV⟩, hn⟩ + refine ⟨⟨hz, ?_⟩, hzV⟩ + rintro ⟨t, ht, htz⟩ + exact hn ⟨t, ⟨ht, (show φ (k t) ∈ V from (congrArg φ htz).symm ▸ hzV)⟩, htz⟩ + · rintro z ⟨⟨hz, hn⟩, hzV⟩ + refine ⟨⟨hz, hzV⟩, ?_⟩ + rintro ⟨t, ht, htz⟩ + exact hn ⟨t, ht.1, htz⟩ + have hCount := ncard_boundary_after_pasting P Q (k '' E) (hPA.image α) (hPB.image β) + rw [hRem, hOpen, hEnd, hk.injOn.ncard_image, hk.injOn.ncard_image] at hCount + have hPCount : P.ncard = (KA ∩ (φ ∘ α) ⁻¹' V).ncard := hα.injOn.ncard_image + have hQCount : Q.ncard = (KB ∩ (φ ∘ β) ⁻¹' V).ncard := hβ.injOn.ncard_image + rw [hPCount, hQCount] at hCount + exact hCount + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapReplacement.lean b/LeanPool/GraphMinor/GM07/NetSwapReplacement.lean new file mode 100644 index 0000000000..a07a4fef90 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapReplacement.lean @@ -0,0 +1,189 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.NetSwapArcs + +/-! +# The lifted cutting line and the mate of a side + +In VII (2.6), page 218, pasting identifies the chosen boundary +subarc with its mate. The cutting line meets the chosen side +only at its two ends. Its lift from the attached piece can +therefore meet the old mate only at the two matching endpoints. +This supplies the intersection needed to splice the new side. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Surface + +/-- In the pasted disc, the lift of the cutting line meets the +old mate precisely at the two matching endpoint parameters. +This is the intersection calculation for the replacement side +in VII (2.6), page 218. -/ +theorem cutting_lift_meets_mate_only_at_ends + {X T : Type*} [TopologicalSpace X] + {x₀ x₁ y₀ y₁ : X} (a : Path x₀ x₁) (b : Path y₀ y₁) + (ha : IsArcMap a) (hb : IsArcMap b) {u v : unitInterval} (huv : u < v) + (c : Path (a u) (a v)) (hc : IsArcMap c) + (hca : range c ∩ range a = {a u, a v}) + {A B : Set X} (hcA : ∀ s, c s ∈ A) (hbB : ∀ t, b t ∈ B) + (α : A → T) (β : B → T) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ + ∃ r, x.val = (a.subpath u v) r ∧ y.val = (b.subpath u v) r) : + ∀ s t, α ⟨c s, hcA s⟩ = β ⟨b t, hbB t⟩ → + (s = 0 ∧ t = u) ∨ (s = 1 ∧ t = v) := by + intro s t heq + obtain ⟨r, hcr, hbr⟩ := (hcross ⟨c s, hcA s⟩ ⟨b t, hbB t⟩).mp heq + have hca' : c s ∈ {a u, a v} := hca.subset + ⟨mem_range_self s, ⟨Icc.convexComb u v r, hcr.symm⟩⟩ + have har := isArcMap_subpath_of_lt a ha huv + rcases hca' with hcu | hcv + · have hs : s = 0 := hc.2 (hcu.trans c.source.symm) + have hr : r = 0 := har.2 (hcr.symm.trans (hcu.trans (a.subpath u v).source.symm)) + have ht : t = u := hb.2 (hbr.trans (hr ▸ (b.subpath u v).source)) + exact Or.inl ⟨hs, ht⟩ + · have hcv' : c s = a v := mem_singleton_iff.mp hcv + have hs : s = 1 := hc.2 (hcv'.trans c.target.symm) + have hr : r = 1 := har.2 (hcr.symm.trans (hcv'.trans (a.subpath u v).target.symm)) + have ht : t = v := hb.2 (hbr.trans (hr ▸ (b.subpath u v).target)) + exact Or.inr ⟨hs, ht⟩ + +/-- Splice the attached lift into the mate side. The pasting +fiber equation proves that the inserted path meets the old +mate only at its two ends, so the result is an arc. -/ +theorem isArcMap_spliced_mate_path + {X T : Type*} [TopologicalSpace X] [TopologicalSpace T] + {x₀ x₁ y₀ y₁ : X} (a : Path x₀ x₁) (b : Path y₀ y₁) + (ha : IsArcMap a) (hb : IsArcMap b) + {u v : unitInterval} (hu : 0 < u) (huv : u < v) (hv : v < 1) + (c : Path (a u) (a v)) (hc : IsArcMap c) + (hca : range c ∩ range a = {a u, a v}) + {A B : Set X} (hcA : ∀ s, c s ∈ A) (hbB : ∀ t, b t ∈ B) + (α : A → T) (β : B → T) (hα : Function.Injective α) (hβ : Function.Injective β) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ + ∃ r, x.val = (a.subpath u v) r ∧ y.val = (b.subpath u v) r) + {z₀ z₁ : T} (base : Path z₀ z₁) (mid : Path (base u) (base v)) + (hbase : ∀ t, base t = β ⟨b t, hbB t⟩) + (hmid : ∀ s, mid s = α ⟨c s, hcA s⟩) : + IsArcMap (((base.subpath 0 u).trans mid).trans (base.subpath v 1)) := by + have hbaseArc : IsArcMap base := by + refine ⟨base.continuous, ?_⟩ + intro s t heq + rw [hbase s, hbase t] at heq + exact hb.2 (congrArg Subtype.val (hβ heq)) + have hmidArc : IsArcMap mid := by + refine ⟨mid.continuous, ?_⟩ + intro s t heq + rw [hmid s, hmid t] at heq + exact hc.2 (congrArg Subtype.val (hα heq)) + have hmeet : range mid ∩ range base = {base u, base v} := by + apply Subset.antisymm + · rintro z ⟨⟨s, hsz⟩, ⟨t, htz⟩⟩ + have heq : α ⟨c s, hcA s⟩ = β ⟨b t, hbB t⟩ := by + rw [← hmid s, ← hbase t] + exact hsz.trans htz.symm + rcases cutting_lift_meets_mate_only_at_ends a b ha hb huv c hc hca hcA hbB + α β hcross s t heq with ⟨hs, rfl⟩ | ⟨hs, rfl⟩ + · exact Or.inl htz.symm + · exact Or.inr htz.symm + · rintro z (rfl | rfl) + · exact ⟨⟨0, mid.source⟩, mem_range_self u⟩ + · exact ⟨⟨1, mid.target⟩, mem_range_self v⟩ + exact isArcMap_spliced_path base hbaseArc hu huv hv mid hmidArc hmeet + +/-- Replacing the middle portions of two internally disjoint sides +preserves internal disjointness when the inserted portions miss the +other side and each other. The retained portions are compared through +an injective map of the retained piece. In VII (2.6), page 218, the +inserted portions are the two lifts of the cutting line. -/ +theorem internally_disjoint_replacement_sides + {X T : Type*} (a b : unitInterval → X) {B : Set X} (β : B → T) + (hβ : Function.Injective β) + (hab : ∀ t ∈ Ioo (0 : unitInterval) 1, a t ∉ range b) + (hba : ∀ t ∈ Ioo (0 : unitInterval) 1, b t ∉ range a) + (p q : unitInterval → T) (hp : Function.Injective p) (hq : Function.Injective q) + {P Q : Set T} + (hpr : range p ⊆ β '' {x : B | x.val ∈ range a} ∪ P) + (hqr : range q ⊆ β '' {x : B | x.val ∈ range b} ∪ Q) + (hP : Disjoint P (β '' {x : B | x.val ∈ range b})) + (hQ : Disjoint Q (β '' {x : B | x.val ∈ range a})) + (hPQ : Disjoint P Q) + (hp0 : p 0 ∈ β '' {x : B | x.val = a 0}) + (hp1 : p 1 ∈ β '' {x : B | x.val = a 1}) + (hq0 : q 0 ∈ β '' {x : B | x.val = b 0}) + (hq1 : q 1 ∈ β '' {x : B | x.val = b 1}) : + (∀ t ∈ Ioo (0 : unitInterval) 1, p t ∉ range q) ∧ + (∀ t ∈ Ioo (0 : unitInterval) 1, q t ∉ range p) := by + have hends : ∀ (d : unitInterval → X) (k : unitInterval → T), + k 0 ∈ β '' {x : B | x.val = d 0} → + k 1 ∈ β '' {x : B | x.val = d 1} → + ∀ x : B, x.val ∈ ({d 0, d 1} : Set X) → β x ∈ ({k 0, k 1} : Set T) := by + intro d k hk0 hk1 x hx + obtain ⟨x₀, hx₀, hx₀k⟩ := hk0 + obtain ⟨x₁, hx₁, hx₁k⟩ := hk1 + rcases hx with hx | hx + · exact Or.inl ((congrArg β (Subtype.ext (hx.trans hx₀.symm))).trans hx₀k) + · exact Or.inr ((congrArg β (Subtype.ext + ((mem_singleton_iff.mp hx).trans hx₁.symm))).trans hx₁k) + have hmeet : ∀ z ∈ range p ∩ range q, + z ∈ ({p 0, p 1} : Set T) ∧ z ∈ ({q 0, q 1} : Set T) := by + intro z hz + rcases hpr hz.1 with ⟨x, ⟨s, hsx⟩, hxz⟩ | hzP + · rcases hqr hz.2 with ⟨y, ⟨t, hty⟩, hyz⟩ | hzQ + · have hxy : x = y := hβ (hxz.trans hyz.symm) + have heq : a s = b t := hsx.trans ((congrArg Subtype.val hxy).trans hty.symm) + have hs := range_inter_subset_endpoints a hab + ⟨mem_range_self s, ⟨t, heq.symm⟩⟩ + have ht := range_inter_subset_endpoints b hba + ⟨mem_range_self t, ⟨s, heq⟩⟩ + constructor + · exact hxz ▸ hends a p hp0 hp1 x (hsx ▸ hs) + · exact hyz ▸ hends b q hq0 hq1 y (hty ▸ ht) + · exact (disjoint_left.mp hQ hzQ ⟨x, ⟨s, hsx⟩, hxz⟩).elim + · rcases hqr hz.2 with hzB | hzQ + · exact (disjoint_left.mp hP hzP hzB).elim + · exact (disjoint_left.mp hPQ hzP hzQ).elim + constructor + · intro t ht hqt + exact not_mem_endpoints_of_injective hp ht (hmeet _ ⟨mem_range_self t, hqt⟩).1 + · intro t ht hpt + exact not_mem_endpoints_of_injective hq ht (hmeet _ ⟨hpt, mem_range_self t⟩).2 + +/-- Compare a replacement side with an unchanged side on the retained +piece. Only the replacement's inserted portion needs a new intersection +check. All retained contacts follow from the old two sides. -/ +theorem internally_disjoint_replacement_retained_side + {X T : Type*} (a b : unitInterval → X) {B : Set X} (β : B → T) + (hβ : Function.Injective β) (hb : Function.Injective b) + (hab : ∀ t ∈ Ioo (0 : unitInterval) 1, a t ∉ range b) + (hba : ∀ t ∈ Ioo (0 : unitInterval) 1, b t ∉ range a) + (p q : unitInterval → T) (hp : Function.Injective p) + {P : Set T} (hpr : range p ⊆ β '' {x : B | x.val ∈ range a} ∪ P) + (hP : Disjoint P (β '' {x : B | x.val ∈ range b})) + (hp0 : p 0 ∈ β '' {x : B | x.val = a 0}) + (hp1 : p 1 ∈ β '' {x : B | x.val = a 1}) + (hbB : ∀ t, b t ∈ B) (hq : ∀ t, q t = β ⟨b t, hbB t⟩) : + (∀ t ∈ Ioo (0 : unitInterval) 1, p t ∉ range q) ∧ + (∀ t ∈ Ioo (0 : unitInterval) 1, q t ∉ range p) := by + have hqi : Function.Injective q := by + intro s t heq + rw [hq s, hq t] at heq + exact hb (congrArg Subtype.val (hβ heq)) + have hqr : range q ⊆ β '' {x : B | x.val ∈ range b} ∪ (∅ : Set T) := by + rintro z ⟨t, rfl⟩ + exact Or.inl ⟨⟨b t, hbB t⟩, mem_range_self t, (hq t).symm⟩ + exact internally_disjoint_replacement_sides a b β hβ hab hba p q hp hqi hpr hqr + hP (empty_disjoint _) (disjoint_empty _) hp0 hp1 + ⟨⟨b 0, hbB 0⟩, rfl, (hq 0).symm⟩ ⟨⟨b 1, hbB 1⟩, rfl, (hq 1).symm⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/NetSwapSides.lean b/LeanPool/GraphMinor/GM07/NetSwapSides.lean new file mode 100644 index 0000000000..d30b2f6b8d --- /dev/null +++ b/LeanPool/GraphMinor/GM07/NetSwapSides.lean @@ -0,0 +1,140 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.GM07.NetSwapArcs +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# The old sides on the retained piece of the cut disc + +In VII (2.6), page 218, only the selected subarc is pasted to +its mate. Every other paired side stays on the retained disc, +as do the two outer portions of the selected side. Internal +disjointness of the old sides and the two cut endpoints prove +these boundary containments. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Surface + +/-- Locate all unchanged side maps and the two surviving parts +of the selected side on the boundary of the retained cut piece +in the net exchange of VII (2.6), page 218. -/ +theorem Net.sides_on_retained_piece + {S : Type*} [TopologicalSpace S] (N : Net S) (i : Fin N.r) + (u v : unitInterval) (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F C B : Set N.D} (hF : IsLineWithEnds F (N.f i u) (N.f i v)) + (hcover : range (pieceA (N.f i) u.val v.val) ∪ C = bd N.D) + (hB : discBd B = C ∪ F) : + (∀ j, j ≠ i → range (N.f j) ⊆ discBd B) ∧ + (∀ j, range (N.g j) ⊆ discBd B) ∧ + N.f i '' Icc 0 u ⊆ discBd B ∧ N.f i '' Icc v 1 ⊆ discBd B := by + have hcut : range (pieceA (N.f i) u.val v.val) = N.f i '' Icc u v := + range_pieceA_unitInterval (N.f i) u v huv.le + have hout : ∀ x ∈ bd N.D, x ∉ range (pieceA (N.f i) u.val v.val) → x ∈ discBd B := by + intro x hxbd hxcut + have hxC : x ∈ C := (hcover.symm ▸ hxbd).resolve_left hxcut + exact hB ▸ Or.inl hxC + have hinner : ∀ w ∈ Icc u v, w ∈ Ioo (0 : unitInterval) 1 := + fun w hw => ⟨hu.trans_le hw.1, hw.2.trans_lt hv⟩ + refine ⟨?_, ?_, ?_, ?_⟩ + · intro j hji x hxj + apply hout x (N.range_f_subset_bd j hxj) + rw [hcut] + rintro ⟨w, hw, hwx⟩ + exact N.internally_disjoint_ff i j hji.symm w (hinner w hw) (hwx.symm ▸ hxj) + · intro j x hxj + apply hout x (N.range_g_subset_bd j hxj) + rw [hcut] + rintro ⟨w, hw, hwx⟩ + exact N.internally_disjoint_fg i j w (hinner w hw) (hwx.symm ▸ hxj) + · rintro x ⟨t, ht, rfl⟩ + rcases eq_or_lt_of_le ht.2 with htu | htu + · exact hB ▸ Or.inr (htu.symm ▸ hF.left_mem) + · apply hout _ (N.range_f_subset_bd i (mem_range_self t)) + rw [hcut] + rintro ⟨w, hw, hwt⟩ + have hwt' : w = t := N.injective_f i hwt + exact (not_le_of_gt htu) (hwt' ▸ hw.1) + · rintro x ⟨t, ht, rfl⟩ + rcases eq_or_lt_of_le ht.1 with hvt | hvt + · exact hB ▸ Or.inr (hvt ▸ hF.right_mem) + · apply hout _ (N.range_f_subset_bd i (mem_range_self t)) + rw [hcut] + rintro ⟨w, hw, hwt⟩ + have hwt' : w = t := N.injective_f i hwt + exact (not_le_of_gt hvt) (hwt' ▸ hw.2) + +/-- The cutting line misses every unchanged side. Its only old boundary +contacts are strictly inside the selected side, so they cannot lie on +any other side. This is the disjointness needed for the net exchange +in VII (2.6), page 218. -/ +theorem Net.cutting_line_disjoint_other_sides + {S : Type*} [TopologicalSpace S] (N : Net S) (i : Fin N.r) + {u v : unitInterval} (hu : 0 < u) (huv : u < v) (hv : v < 1) + {F : Set N.D} (hFbd : F ∩ bd N.D = {N.f i u, N.f i v}) : + (∀ j, j ≠ i → Disjoint F (range (N.f j))) ∧ + (∀ j, Disjoint F (range (N.g j))) := by + have hu' : u ∈ Ioo (0 : unitInterval) 1 := ⟨hu, huv.trans hv⟩ + have hv' : v ∈ Ioo (0 : unitInterval) 1 := ⟨hu.trans huv, hv⟩ + constructor + · intro j hji + apply disjoint_left.mpr + intro x hxF hxj + rcases hFbd.subset ⟨hxF, N.range_f_subset_bd j hxj⟩ with hxu | hxv + · exact N.internally_disjoint_ff i j hji.symm u hu' (hxu ▸ hxj) + · exact N.internally_disjoint_ff i j hji.symm v hv' + ((mem_singleton_iff.mp hxv) ▸ hxj) + · intro j + apply disjoint_left.mpr + intro x hxF hxj + rcases hFbd.subset ⟨hxF, N.range_g_subset_bd j hxj⟩ with hxu | hxv + · exact N.internally_disjoint_fg i j u hu' (hxu ▸ hxj) + · exact N.internally_disjoint_fg i j v hv' + ((mem_singleton_iff.mp hxv) ▸ hxj) + +/-- In the pasted disc, the attached piece cannot meet any retained +side except the selected mate. The cross-piece fiber equation puts +any such meeting strictly inside that mate, which the old net's +internal disjointness excludes. This is part of the new-net +construction in VII (2.6), page 218. -/ +theorem Net.attached_piece_disjoint_other_sides + {S T : Type*} [TopologicalSpace S] (N : Net S) (i : Fin N.r) + {u v : unitInterval} (hu : 0 < u) (huv : u < v) (hv : v < 1) + {A B : Set N.D} (α : A → T) (β : B → T) + (hcross : ∀ (x : A) (y : B), α x = β y ↔ + ∃ t, x.val = pieceA (N.f i) u.val v.val t ∧ + y.val = pieceA (N.g i) u.val v.val t) : + (∀ j, Disjoint (range α) (β '' {y : B | y.val ∈ range (N.f j)})) ∧ + (∀ j, j ≠ i → + Disjoint (range α) (β '' {y : B | y.val ∈ range (N.g j)})) := by + have hinner : ∀ w ∈ Icc u v, w ∈ Ioo (0 : unitInterval) 1 := + fun w hw => ⟨hu.trans_le hw.1, hw.2.trans_lt hv⟩ + have hseg := range_pieceA_unitInterval (N.g i) u v huv.le + constructor + · intro j + apply disjoint_left.mpr + rintro z ⟨x, rfl⟩ ⟨y, hy, heq⟩ + obtain ⟨t, _, hyt⟩ := (hcross x y).mp heq.symm + obtain ⟨w, hw, hwy⟩ := hseg.subset ⟨t, hyt.symm⟩ + exact N.internally_disjoint_gf i j w (hinner w hw) (hwy.symm ▸ hy) + · intro j hji + apply disjoint_left.mpr + rintro z ⟨x, rfl⟩ ⟨y, hy, heq⟩ + obtain ⟨t, _, hyt⟩ := (hcross x y).mp heq.symm + obtain ⟨w, hw, hwy⟩ := hseg.subset ⟨t, hyt.symm⟩ + exact N.internally_disjoint_gg i j hji.symm w (hinner w hw) (hwy.symm ▸ hy) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Open.lean b/LeanPool/GraphMinor/GM07/Open.lean new file mode 100644 index 0000000000..c399c4bc64 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Open.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.GM06.Defs + +/-! +# Open Statements for Graph Minors VII + +This file holds explicit named `Prop` statements (`...Statement`) for surface-topology facts used in +Graph Minors VII. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## Open surface-topology statements for Section 4 -/ + +/-- A surface `S'` with associated quotient surjection `φ : S' → S` is obtained from `S` by +*cutting along `U(J)`*, where `J` is a proper graph in `S` with no isolated vertices +(Graph Minors VII, Section 2, page 215, and Section 4, page 223). -/ +structure IsCutAlongGraph (J : Drawing S) (S' : Type u) [TopologicalSpace S'] + (φ : S' → S) : Prop where + isProper : J.IsProper + noIsolated : HasNoIsolatedVertices J + isSurface : IsSurface S' + quotientMap : Topology.IsQuotientMap φ + preimage_bd_union_U : φ ⁻¹' (bd S ∪ J.U) = bd S' + interior_inj : ∀ x ∈ (bd S')ᶜ, ∀ y : S', φ x = φ y → x = y + /-- Cutting never collapses an arc of `bd(S')` to a point. -/ + finite_fiber : ∀ x, (φ ⁻¹' {x}).Finite + +/-! ## Open surface-topology statements for Sections 5, 6, and 7 -/ + +/-- A surface `S_e` with associated surjection `φ_e : S_e → S` and cut graph +`G_e = φ_e⁻¹(G \ e)` is obtained from `(S, G)` by deleting a non-loop edge `e ∈ G.E` with +`closure e ∩ bd S = ∅` and cutting `S` along `closure e` +(Graph Minors VII, Section 7, page 238: "If $e$ is an edge of $G$, let $G \setminus e$ be the graph +obtained from $G$ by deleting $e$. Let $\Sigma_e$ be the surface obtained from $\Sigma$ by cutting +along $\bar{e}$. Let $\phi_e$ be the associated surjection. Then $\phi_e^{-1}(G \setminus e)$ is a +proper graph in $\Sigma_e$; and provided $\bar{e} \cap bd(\Sigma) = \emptyset$ and $e$ is not a +loop, we have $\Sigma_e \cong \Sigma(a, b, c + 1)$."). + +The last four fields say what cutting means. Off `e` the map is one to one, so each end of `e` has +one point over it. The +preimage of `closure e` is a new cuff. Pasting a disc on the new cuff gives `S` back, +and the inclusion is homotopic to `φ_e`. Without these fields `φ_e` could collapse a small cuff to a +point of `S`, far from `e`, +and (7.1) and (7.2) would fail. -/ +structure IsCutAlongEdge (G : Drawing S) (e : Set S) (a b c : ℕ) + (S_e : Type u) [TopologicalSpace S_e] (φ_e : S_e → S) (G_e : Drawing S_e) : Prop where + mem_E : e ∈ G.E + not_loop : (tilde e).ncard = 2 + disjoint_bd : closure e ∩ bd S = ∅ + isSurface : IsSurface S_e + homeo_model : Nonempty (S_e ≃ₜ SurfaceModel a b (c + 1)) + quotientMap : Topology.IsQuotientMap φ_e + isProper : G_e.IsProper + preimage_U : G_e.U = φ_e ⁻¹' (G.U \ e) + preimage_V : G_e.V = φ_e ⁻¹' G.V + inj : ∀ x y, φ_e x = φ_e y → x = y ∨ φ_e x ∈ e + newCuff : φ_e ⁻¹' closure e ∈ cuffs S_e + bd_eq : bd S_e = φ_e ⁻¹' (bd S ∪ closure e) + uncut : ∃ (ι : S_e → S) (E : Set S) (H : unitInterval × S_e → S), IsCappedCuff + (φ_e ⁻¹' closure e) S ι E ∧ + Continuous H ∧ (∀ y, H (0, y) = ι y) ∧ ∀ y, H (1, y) = φ_e y + /-- Cutting never collapses an arc to a point, as in `IsCutAlongGraph`. -/ + finite_fiber : ∀ x, (φ_e ⁻¹' {x}).Finite + /-- Each point has at most two points over it. -/ + fiber_two : ∀ x, (φ_e ⁻¹' {x}).ncard ≤ 2 + /-- Each point of `e` has at least two points over it. -/ + two_le : ∀ x ∈ e, 2 ≤ (φ_e ⁻¹' {x}).ncard + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/PullForest.lean b/LeanPool/GraphMinor/GM07/PullForest.lean new file mode 100644 index 0000000000..bbad15b79a --- /dev/null +++ b/LeanPool/GraphMinor/GM07/PullForest.lean @@ -0,0 +1,423 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.ForestPeel + +/-! +# Moving forests across a cut + +This file holds the first steps of (4.5) of Graph Minors VII (pages 223 and 224). A homeomorphism of +the cut surface that fixes its boundary comes down to a homeomorphism `β` of the surface +(`exists_descend`). This is the map `β` of the paper. +The preimage of a graph `H` for which `U(J)` is `H`-normal is again a graph (`exists_pullback`), and +its edges are the lifts of the edges of `H`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S S' : Type u} [TopologicalSpace S] [TopologicalSpace S'] + +theorem IsCutAlongGraph.toSet {J : Drawing S} {φ : S' → S} (h : IsCutAlongGraph J S' φ) : + IsCutAlongSet J.U φ := + ⟨h.isSurface, h.quotientMap, h.preimage_bd_union_U, h.interior_inj, h.finite_fiber⟩ + +/-- **The map `β` of (4.5)** (pages 223 and 224). A homeomorphism of the cut surface that fixes the +boundary comes down to the surface, because two points in one fiber are equal or on the boundary, +and the boundary is fixed. -/ +theorem exists_descend {J : Drawing S} {φ : S' → S} (h : IsCutAlongGraph J S' φ) (α : S' ≃ₜ S') + (hα : ∀ x ∈ bd S', α x = x) : + ∃ β : S ≃ₜ S, (∀ x ∈ bd S, β x = x) ∧ ∀ y, β (φ y) = φ (α y) := by + classical + have hq := h.quotientMap + have hfix : ∀ (γ : S' ≃ₜ S'), (∀ x ∈ bd S', γ x = x) → ∀ a b, φ a = φ b → φ (γ a) = φ (γ b) + := fun γ hγ a b he => by + by_cases ha : a ∈ bd S' + · have hb : b ∈ bd S' := by + rw [← h.preimage_bd_union_U] at ha ⊢ + rw [mem_preimage] at ha ⊢ + rwa [← he] + rw [hγ a ha, hγ b hb, he] + · rw [h.interior_inj a ha b he] + have hαs : ∀ x ∈ bd S', α.symm x = x := fun x hx => by + rw [Homeomorph.symm_apply_eq] + exact (hα x hx).symm + let f : S → S := fun x => φ (α (Function.surjInv hq.surjective x)) + let g : S → S := fun x => φ (α.symm (Function.surjInv hq.surjective x)) + have hf : ∀ y, f (φ y) = φ (α y) := fun y => hfix α hα _ _ (Function.surjInv_eq hq.surjective + (φ y)) + have hg : ∀ y, g (φ y) = φ (α.symm y) := fun y => hfix α.symm hαs _ _ + (Function.surjInv_eq hq.surjective (φ y)) + have hfc : Continuous f := hq.continuous_iff.mpr (by + have : f ∘ φ = φ ∘ α := funext hf + rw [this] + exact hq.continuous.comp α.continuous) + have hgc : Continuous g := hq.continuous_iff.mpr (by + have : g ∘ φ = φ ∘ α.symm := funext hg + rw [this] + exact hq.continuous.comp α.symm.continuous) + let β : S ≃ₜ S := + { toFun := f + invFun := g + left_inv := fun x => by + obtain ⟨y, rfl⟩ := hq.surjective x + rw [hf, hg, Homeomorph.symm_apply_apply] + right_inv := fun x => by + obtain ⟨y, rfl⟩ := hq.surjective x + rw [hg, hf, Homeomorph.apply_symm_apply] + continuous_toFun := hfc + continuous_invFun := hgc } + refine ⟨β, fun x hx => ?_, hf⟩ + obtain ⟨y, rfl⟩ := hq.surjective x + have hy : y ∈ bd S' := by + rw [← h.preimage_bd_union_U] + exact .inl hx + change f (φ y) = φ y + rw [hf, hα y hy] + +/-- Every point of `U(G)` off `V(G)` lies on an edge. -/ +theorem exists_edge_of_mem {G : Drawing S} {z : S} (hz : z ∈ G.U) (hzV : z ∉ G.V) : ∃ e ∈ G.E, z ∈ + e := by + have hzc : z ∈ G.U \ G.V := ⟨hz, hzV⟩ + refine ⟨pathComponentIn (G.U \ G.V) z, ⟨⟨z, mem_pathComponentIn_self hzc⟩, + pathComponentIn_subset, isPathConnected_pathComponentIn hzc, fun D hD hc hsub + => ?_⟩, mem_pathComponentIn_self hzc⟩ + exact Subset.antisymm (hc.subset_pathComponentIn (hsub (mem_pathComponentIn_self hzc)) hD) hsub + +/-- An edge of a forest has a line as its closure, since a loop is a circuit. -/ +theorem IsSurfaceForest.edge_line {H : Drawing S} (hH : IsSurfaceForest H) {e : Set S} + (he : e ∈ H.E) : ∃ u v, u ≠ v ∧ closure e ∩ H.V = {u, v} ∧ IsLineWithEnds (closure e) u v := by + rcases H.edge_cond e he with h1 | ⟨u, hcap, -⟩ + · exact h1 + · exfalso + have huV : u ∈ H.V := (show u ∈ closure e ∩ H.V by rw [hcap]; rfl).2 + have hl : H.toGraph.IsLink e u u := ⟨he, huV, huV, by rw [hcap, pair_eq_singleton]⟩ + have h0 := hH.2 u (.cons hl (.nil huV)) (by simp [GraphWalk.IsSimpleClosed, GraphWalk.support, + GraphWalk.edges]) + simp [GraphWalk.length, GraphWalk.edges] at h0 + +/-- The lift of a closed edge whose ends may both lie on the set `B` that is cut. -/ +theorem exists_lift_closed_edge [CompactSpace S'] [T2Space S'] [T2Space S] {B : Set S} {φ : S' → S} + (hφ : GM19.IsCutMap φ B) (hB : IsClosed B) {A : Set S} {u v : S} + (hA : IsLineWithEnds A u v) (hAB : A ∩ B ⊆ {u, v}) : + ∃ (L : Set S') (u' v' : S'), IsLineWithEnds L u' v' ∧ φ u' = u ∧ φ v' = v ∧ φ '' L = A + ∧ InjOn φ L ∧ ∀ z, φ z ∈ A \ {u, v} → z ∈ L := by + classical + obtain ⟨α, hα, hr, h0, h1⟩ := hA.exists_arc + obtain ⟨t, ht0, ht1⟩ := exists_between (show (0 : unitInterval) < 1 from zero_lt_one) + have hmA : α t ∈ A := hr ▸ mem_range_self t + have hmu : α t ≠ u := fun h => ht0.ne' (hα.2 (h.trans h0.symm)) + have hmv : α t ≠ v := fun h => ht1.ne (hα.2 (h.trans h1.symm)) + obtain ⟨A₁, A₂, hA₁, hA₂, hun, hin⟩ := hA.split hmA hmu hmv + have hA₁A : A₁ ⊆ A := hun ▸ subset_union_left + have hA₂A : A₂ ⊆ A := hun ▸ subset_union_right + have hmB : α t ∉ B := fun h => by + rcases hAB ⟨hmA, h⟩ with h' | h' + · exact hmu h' + · exact hmv h' + have huA₂ : u ∉ A₂ := fun h => by + have : u ∈ A₁ ∩ A₂ := ⟨hA₁.left_mem, h⟩ + rw [hin] at this + exact hmu this.symm + have hvA₁ : v ∉ A₁ := fun h => by + have : v ∈ A₁ ∩ A₂ := ⟨h, hA₂.right_mem⟩ + rw [hin] at this + exact hmv this.symm + obtain ⟨L₁, u', m₁, hL₁, hu', hm₁, him₁, hinj₁, -⟩ := exists_lift_line hφ hB hA₁ (fun z hz => by + rcases hAB ⟨hA₁A hz.1, hz.2⟩ with h | h + · exact h + · exact (hvA₁ (mem_singleton_iff.mp h ▸ hz.1)).elim) + obtain ⟨L₂, v', m₂, hL₂, hv', hm₂, him₂, hinj₂, -⟩ := exists_lift_line hφ hB hA₂.symm (fun z hz + => by + rcases hAB ⟨hA₂A hz.1, hz.2⟩ with h | h + · exact (huA₂ (h ▸ hz.1)).elim + · exact h) + have hoff : ∀ {x y : S'}, φ x = α t → φ y = α t → x = y := fun {x y} hx hy => + hφ.2.2.1 (show φ x ∈ Bᶜ by rwa [hx]) + (show φ y ∈ Bᶜ by rwa [hy]) (hx.trans hy.symm) + obtain rfl : m₁ = m₂ := hoff hm₁ hm₂ + have hint : L₁ ∩ L₂ = {m₁} := by + ext z + constructor + · rintro ⟨h1, h2⟩ + have : φ z ∈ A₁ ∩ A₂ := ⟨him₁ ▸ mem_image_of_mem φ h1, him₂ ▸ mem_image_of_mem φ h2⟩ + rw [hin] at this + exact hoff this hm₁ + · rintro rfl + exact ⟨hL₁.right_mem, hL₂.right_mem⟩ + have him : φ '' (L₁ ∪ L₂) = A := by rw [image_union, him₁, him₂, hun] + have hinj : InjOn φ (L₁ ∪ L₂) := by + have cross : ∀ {x y}, x ∈ L₁ → y ∈ L₂ → φ x = φ y → x = y := fun {x y} hx hy he => by + have hm : φ x ∈ A₁ ∩ A₂ := ⟨him₁ ▸ mem_image_of_mem φ hx, he ▸ him₂ ▸ mem_image_of_mem φ hy⟩ + rw [hin] at hm + exact (hoff hm hm₁).trans (hoff (he ▸ hm) hm₁).symm + rintro x (hx | hx) y (hy | hy) he + · exact hinj₁ hx hy he + · exact cross hx hy he + · exact (cross hy hx he.symm).symm + · exact hinj₂ hx hy he + refine ⟨L₁ ∪ L₂, u', v', hL₁.union hL₂.symm hint, hu', hv', him, hinj, fun z hz => ?_⟩ + obtain ⟨w, hw, hwz⟩ : φ z ∈ φ '' (L₁ ∪ L₂) := him ▸ hz.1 + have hzB : φ z ∉ B := fun h => hz.2 (hAB ⟨hz.1, h⟩) + have : w = z := hφ.2.2.1 (show φ w ∈ Bᶜ by rw [hwz]; exact hzB) hzB hwz + exact this ▸ hw + +/-- **The pullback of a forest** (first sentence of the proof of (4.5), page 223). When `U(J)` is +`H`-normal, `φ⁻¹(H)` is a proper graph. Each of its edges is the full preimage of an edge of `H`, +and `φ` is one to one on its closure. -/ +theorem exists_pullback {J H : Drawing S} {φ : S' → S} (hS : IsSurface S) + (hJ : IsCutAlongGraph J S' φ) (hH : IsSurfaceForest H) (hN : H.IsNormal J.U) : + ∃ H' : Drawing S', IsPullbackDrawing φ H H' ∧ H'.IsProper ∧ ∀ e' ∈ H'.E, ∃ e ∈ H.E, e' + = φ ⁻¹' e ∧ φ '' closure e' = closure e ∧ InjOn φ (closure e') := by + classical + have ht2 : T2Space S := hS.2.1 + have hY := hJ.isSurface + have : CompactSpace S' := hY.1 + have : T2Space S' := hY.2.1 + have hcut := hJ.toSet + have hφ := hcut.isCutMap + have hB : IsClosed (bd S ∪ J.U) := (isClosed_bd S).union J.isClosed_U + have hH' : IsSurfaceForest H := hH + have hUB : ∀ z ∈ H.U, z ∈ bd S ∪ J.U → z ∈ H.V := fun z hz hb => by + rcases hb with h | h + · exact hH.1 ⟨h, hz⟩ + · exact hN ⟨h, hz⟩ + have hedge : ∀ e ∈ H.E, ∃ (L : Set S') (u v : S) (u' v' : S'), u ≠ v ∧ closure e ∩ H.V = {u, v} + ∧ IsLineWithEnds L u' v' ∧ φ u' = u ∧ φ v' = v ∧ φ '' L = closure e ∧ InjOn φ L ∧ ∀ z, φ z ∈ e + → z ∈ L := fun e he => by + obtain ⟨u, v, hne, hcap, hl⟩ := hH.edge_line he + obtain ⟨L, u', v', hL, hu, hv, him, hinj, hmem⟩ := exists_lift_closed_edge hφ hB hl + (fun z hz => by + have : z ∈ closure e ∩ H.V := ⟨hz.1, hUB z (H.closure_subset_U he hz.1) hz.2⟩ + rwa [hcap] at this) + refine ⟨L, u, v, u', v', hne, hcap, hL, hu, hv, him, hinj, fun z hz + => hmem z ⟨subset_closure hz, fun hc => ?_⟩⟩ + have hV : φ z ∈ closure e ∩ H.V := by + rw [hcap] + exact hc + exact (he.2.1 hz).2 hV.2 + choose L u v u' v' hne hcap hL hu hv him hinj hmem using fun e : H.E => hedge e.1 e.2 + have hVf : (φ ⁻¹' H.V).Finite := by + have : φ ⁻¹' H.V = ⋃ x ∈ H.V, φ ⁻¹' {x} := by + ext z + simp + rw [this] + exact H.finite_V.biUnion fun x _ => hcut.finite_fiber x + have hends : ∀ e : H.E, L e ∩ φ ⁻¹' H.V = {u' e, v' e} := fun e => by + ext z + constructor + · rintro ⟨hz, hzV⟩ + have h1 : φ z ∈ closure e.1 ∩ H.V := ⟨him e ▸ mem_image_of_mem φ hz, hzV⟩ + rw [hcap e] at h1 + rcases h1 with h1 | h1 + · exact .inl (hinj e hz (hL e).left_mem (h1.trans (hu e).symm)) + · exact .inr (hinj e hz (hL e).right_mem ((mem_singleton_iff.mp h1).trans (hv e).symm)) + · have hc : ∀ {w}, w ∈ ({u e, v e} : Set S) → w ∈ H.V := fun {w} hw => + (show w ∈ closure e.1 ∩ H.V by rwa [hcap e]).2 + rintro (rfl | h) + · exact ⟨(hL e).left_mem, show φ _ ∈ H.V by rw [hu e]; exact hc (.inl rfl)⟩ + · obtain rfl : z = v' e := h + exact ⟨(hL e).right_mem, show φ _ ∈ H.V by rw [hv e]; exact hc (.inr rfl)⟩ + have hdiff : ∀ e ∈ H.E, ∀ z ∈ closure e, z ∉ H.V → z ∈ e := fun e he z hz hzV => by + rw [← H.closure_diff_V he] + exact ⟨hz, hzV⟩ + have : Finite H.E := H.finite_edges.to_subtype + obtain ⟨H', hU', hV', hE'⟩ := GM12.exists_drawing_of_finite_lines hVf (E := + (univ : Set H.E)) finite_univ L u' v' (fun e _ => hL e) (fun e _ h => hne e + (by rw [← hu e, h, hv e])) (fun e _ => hends e) (fun e _ f _ hef z hz => by + by_contra hzV + have h1 : φ z ∈ closure e.1 := him e ▸ mem_image_of_mem φ hz.1 + have h2 : φ z ∈ closure f.1 := him f ▸ mem_image_of_mem φ hz.2 + exact hef (Subtype.ext (GM11.arcComponent_eq e.2 f.2 (hdiff e.1 e.2 _ h1 hzV) + (hdiff f.1 f.2 _ h2 hzV)))) + have hUeq : H'.U = φ ⁻¹' H.U := by + rw [hU'] + ext z + constructor + · rintro (h | h) + · exact H.V_subset_U h + · obtain ⟨e, -, hz⟩ := mem_iUnion₂.mp h + exact H.closure_subset_U e.2 (him e ▸ mem_image_of_mem φ hz) + · intro hz + by_cases hzV : φ z ∈ H.V + · exact .inl hzV + · obtain ⟨e, he, hze⟩ := exists_edge_of_mem hz hzV + exact .inr (mem_iUnion₂.mpr ⟨⟨e, he⟩, mem_univ _, hmem ⟨e, he⟩ z hze⟩) + refine ⟨H', ⟨hUeq, hV'⟩, ?_, ?_⟩ + · rintro z ⟨hzb, hzU⟩ + rw [hV'] + rw [hUeq] at hzU + rw [← hJ.preimage_bd_union_U] at hzb + exact hUB _ hzU hzb + · intro e' he' + rw [hE'] at he' + obtain ⟨e, -, rfl⟩ := he' + have hcl : closure (L e \ {u' e, v' e}) = L e := + Subset.antisymm (closure_minimal sdiff_subset (hL e).isCompact.isClosed) + (hL e).subset_closure_diff + refine ⟨e.1, e.2, ?_, by rw [hcl]; exact him e, by rw [hcl]; exact hinj e⟩ + ext z + constructor + · rintro ⟨hz, hzn⟩ + have h1 : φ z ∈ closure e.1 := him e ▸ mem_image_of_mem φ hz + refine hdiff e.1 e.2 _ h1 fun hzV => hzn ?_ + have : z ∈ L e ∩ φ ⁻¹' H.V := ⟨hz, hzV⟩ + rwa [hends e] at this + · intro hz + refine ⟨hmem e z hz, fun hzn => ?_⟩ + have : z ∈ L e ∩ φ ⁻¹' H.V := by + rw [hends e] + exact hzn + exact (e.2.2.1 hz).2 this.2 + +/-- A prefix of a walk up to a vertex on it. -/ +theorem GraphWalk.exists_prefix_sublist {α β : Type*} {G : Graph α β} {u v x : α} + (W : GraphWalk G u v) (hx : x ∈ W.support) : ∃ W' : GraphWalk G u x, W'.edges.Sublist W.edges + := by + classical + induction W with + | @nil a hv => + obtain rfl : x = a := by simpa [GraphWalk.support] using hx + exact ⟨.nil hv, List.Sublist.refl _⟩ + | @cons a y b e hl r ih => + by_cases hxa : x = a + · subst hxa + exact ⟨.nil hl.left_mem, List.nil_sublist _⟩ + · obtain ⟨W', hW'⟩ := ih ((List.mem_cons.mp hx).resolve_left hxa) + exact ⟨.cons hl W', hW'.cons_cons _⟩ + +/-- A walk with a repeated vertex holds a closed walk of positive length. -/ +theorem GraphWalk.exists_closed_of_not_nodup {α β : Type*} {G : Graph α β} {u v : α} + (W : GraphWalk G u v) (h : ¬ W.support.Nodup) : ∃ (x : α) (C : GraphWalk G x x), 0 < C.length + ∧ C.edges.Sublist W.edges := by + classical + induction W with + | nil _ => simp [GraphWalk.support] at h + | @cons a y b e hl r ih => + by_cases ha : a ∈ r.support + · obtain ⟨P, hP⟩ := GraphWalk.exists_prefix_sublist r ha + exact ⟨a, .cons hl P, by simp [GraphWalk.length, GraphWalk.edges], hP.cons_cons _⟩ + · have h' : ¬ r.support.Nodup := fun hn => h (List.nodup_cons.mpr ⟨ha, hn⟩) + obtain ⟨x, C, hC, hs⟩ := ih h' + exact ⟨x, C, hC, hs.cons _⟩ + +/-- **A forest has no closed trail.** A closed walk of a forest with distinct edges has length zero. +-/ +theorem length_eq_zero_of_trail {α β : Type*} {G : Graph α β} (hG : IsGraphForest G) (n : ℕ) : ∀ + (u : α) (W : GraphWalk G u u), W.length = n → W.edges.Nodup → W.length = 0 := by + classical + induction n using Nat.strong_induction_on with + | _ n ih => + intro u W hn hE + cases W with + | nil _ => rfl + | @cons _ y _ e hl r => + by_cases hr : r.support.Nodup + · exact hG u (.cons hl r) ⟨hr, hE⟩ + · obtain ⟨x, C, hC, hs⟩ := GraphWalk.exists_closed_of_not_nodup r hr + have hlt : C.length < n := by + have h1 : C.length ≤ r.length := hs.length_le + have h2 : (GraphWalk.cons hl r).length = r.length + 1 := rfl + omega + have hnd : C.edges.Nodup := hs.nodup (List.nodup_cons.mp hE).2 + have h0 := ih C.length hlt x C rfl hnd + omega + +/-- An edge of `φ⁻¹(H)` maps to an edge of `H` with the images of its ends. -/ +theorem pull_link {H : Drawing S} {H' : Drawing S'} {φ : S' → S} (hs : Function.Surjective φ) + (hV : H'.V = φ ⁻¹' H.V) + (hE : ∀ e' ∈ H'.E, ∃ e ∈ H.E, e' = φ ⁻¹' e ∧ φ '' closure e' = closure e ∧ InjOn φ + (closure e')) {e' : Set S'} {x y : S'} (hl : H'.toGraph.IsLink e' x y) : H.toGraph.IsLink + (φ '' e') (φ x) (φ y) := by + have hVm : ∀ {z : S'}, z ∈ H'.V → φ z ∈ H.V := fun {z} h => by + rw [hV] at h + exact h + obtain ⟨he', hx, hy, hcap⟩ := hl + obtain ⟨e, he, rfl, him, -⟩ := hE e' he' + rw [image_preimage_eq _ hs] + refine ⟨he, hVm hx, hVm hy, ?_⟩ + ext z + constructor + · rintro ⟨hz, hzV⟩ + obtain ⟨w, hw, rfl⟩ : z ∈ φ '' closure (φ ⁻¹' e) := him ▸ hz + have : w ∈ closure (φ ⁻¹' e) ∩ H'.V := ⟨hw, by rw [hV]; exact hzV⟩ + rw [hcap] at this + rcases this with rfl | h + · exact .inl rfl + · exact .inr (congrArg φ (mem_singleton_iff.mp h)) + · have hxc : x ∈ closure (φ ⁻¹' e) ∩ H'.V := by rw [hcap]; exact .inl rfl + have hyc : y ∈ closure (φ ⁻¹' e) ∩ H'.V := by rw [hcap]; exact .inr rfl + rintro (rfl | h) + · exact ⟨him ▸ mem_image_of_mem φ hxc.1, hVm hxc.2⟩ + · obtain rfl : z = φ y := h + exact ⟨him ▸ mem_image_of_mem φ hyc.1, hVm hyc.2⟩ + +/-- A walk of `φ⁻¹(H)` maps to a walk of `H`, and distinct edges stay distinct. -/ +theorem pull_walk {H : Drawing S} {H' : Drawing S'} {φ : S' → S} (hs : Function.Surjective φ) + (hV : H'.V = φ ⁻¹' H.V) + (hE : ∀ e' ∈ H'.E, ∃ e ∈ H.E, e' = φ ⁻¹' e ∧ φ '' closure e' = closure e ∧ InjOn φ + (closure e')) {a b : S'} (W : GraphWalk H'.toGraph a b) : + ∃ W₀ : GraphWalk H.toGraph (φ a) (φ b), W₀.edges = W.edges.map (φ '' ·) ∧ (W.edges.Nodup + → W₀.edges.Nodup) := by + have hmap : ∀ {a b : S'} (W : GraphWalk H'.toGraph a b), ∃ W₀ : GraphWalk H.toGraph (φ a) + (φ b), W₀.edges = W.edges.map (φ '' ·) := by + intro a b W + induction W with + | @nil v h => + have h' : v ∈ H'.V := h + rw [hV] at h' + exact ⟨.nil h', rfl⟩ + | cons hl r ih => + obtain ⟨W₀, hW₀⟩ := ih + exact ⟨.cons (pull_link hs hV hE hl) W₀, by simp [GraphWalk.edges, hW₀]⟩ + have hedge : ∀ {a b : S'} (W : GraphWalk H'.toGraph a b), ∀ e ∈ W.edges, e ∈ H'.E := by + intro a b W e he + induction W with + | nil _ => simp [GraphWalk.edges] at he + | cons hl r ih => + rcases List.mem_cons.mp he with rfl | h + · exact hl.1 + · exact ih h + obtain ⟨W₀, hW₀⟩ := hmap W + refine ⟨W₀, hW₀, fun hnd => ?_⟩ + rw [hW₀] + refine List.Nodup.map_on (fun a ha b hb he => ?_) hnd + obtain ⟨e, -, rfl, -, -⟩ := hE a (hedge W a ha) + obtain ⟨f, -, rfl, -, -⟩ := hE b (hedge W b hb) + rw [image_preimage_eq _ hs, image_preimage_eq _ hs] at he + rw [he] + +/-- `φ⁻¹(H)` is a forest (first sentence of the proof of (4.5), page 223): a circuit of it would map +to a closed walk of `H` with distinct edges. -/ +theorem isGraphForest_pullback {H : Drawing S} {H' : Drawing S'} {φ : S' → S} + (hs : Function.Surjective φ) (hH : IsGraphForest H.toGraph) (hV : H'.V = φ ⁻¹' H.V) + (hE : ∀ e' ∈ H'.E, ∃ e ∈ H.E, e' = φ ⁻¹' e ∧ φ '' closure e' = closure e ∧ InjOn φ + (closure e')) : IsGraphForest H'.toGraph := by + intro u W hW + obtain ⟨W₀, hW₀, hnd⟩ := pull_walk hs hV hE W + have h0 := length_eq_zero_of_trail hH _ _ W₀ rfl (hnd hW.2) + have hlen : W₀.length = W.length := by + change W₀.edges.length = W.edges.length + rw [hW₀, List.length_map] + omega + +/-- **The first statement of (4.5)** (page 223): `φ⁻¹(H)` is a forest. -/ +theorem exists_pull_forest {J H : Drawing S} {φ : S' → S} (hS : IsSurface S) + (hJ : IsCutAlongGraph J S' φ) (hH : IsSurfaceForest H) (hN : H.IsNormal J.U) : + ∃ H' : Drawing S', IsPullbackDrawing φ H H' ∧ IsSurfaceForest H' := by + obtain ⟨H', hp, hprop, hE⟩ := exists_pullback hS hJ hH hN + exact ⟨H', hp, hprop, isGraphForest_pullback hJ.quotientMap.surjective hH.2 hp.2 hE⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/PushForest.lean b/LeanPool/GraphMinor/GM07/PushForest.lean new file mode 100644 index 0000000000..31c25fc0a2 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/PushForest.lean @@ -0,0 +1,683 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.ForestQuotient +public import LeanPool.GraphMinor.GM07.ForestFlat +public import LeanPool.GraphMinor.GM07.Section3 +public import LeanPool.GraphMinor.GM12.Section4FiniteLineDrawing +public import LeanPool.GraphMinor.GM07.DiscPlace + +/-! +# The image of a forest across a cut + +This file proves the second part of (4.5) of Graph Minors VII (page 223). Let `Γ` be the preimage of +a forest `H`, and let `G` be a forest homotopic to `Γ`, both in the surface obtained by cutting. We +show that the image of `G` is a forest homotopic to `H` (`exists_image_forest`). + +`G` and `Γ` have the same vertices on the boundary, and join the same pairs of them. If two ends of +an edge of `G` had the same image, then the path of `Γ` between them would map to a closed walk of +`H` (`push_ne`). So the image of `G` is a drawing. It is a forest by `quotient_forest`. + +For the homotopy, the steps are between boundary vertices of `G`. A walk of the image of `G`, or of +`H`, breaks at the vertices with more than one preimage, and these all lie on the boundary of the +cut surface (`chain_of_walk`). Each piece joins two boundary vertices of `G`, and `G` and `Γ` give +homotopic curves across it. Since both forests are flat by `isFlat_forest`, any curves in them with +the right ends can be used. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S S' : Type} [TopologicalSpace S] [TopologicalSpace S'] + +/-- The points of `X` joined to `v` by a walk of `G`. -/ +def classOf (G : Drawing S') (X : Set S') (v : S') : Set S' := {y | y ∈ X ∧ Nonempty + (GraphWalk G.toGraph v y)} + +theorem classOf_eq_of_walk {G : Drawing S'} {X : Set S'} {v w : S'} (W : GraphWalk G.toGraph v w) : + classOf G X v = classOf G X w := by + ext y + constructor + · rintro ⟨hy, ⟨W'⟩⟩ + exact ⟨hy, ⟨W.reverse.append W'⟩⟩ + · rintro ⟨hy, ⟨W'⟩⟩ + exact ⟨hy, ⟨W.append W'⟩⟩ + +/-- Homotopic forests have the same classes on their common boundary vertices. -/ +theorem classOf_eq_of_homotopic {G G' : Drawing S'} (h : ForestsHomotopic G G') {x : S'} + (hx : x ∈ G.V ∩ bd S') : classOf G (G.V ∩ bd S') x = classOf G' (G.V ∩ bd S') x := by + classical + have hx' : x ∈ G'.V := (show x ∈ G'.V ∩ bd S' by rw [← h.2.2.2.2.1]; exact hx).1 + ext y + constructor + · rintro ⟨hy, ⟨W⟩⟩ + by_cases hxy : x = y + · subst hxy + exact ⟨hy, ⟨.nil hx'⟩⟩ + · obtain ⟨W', hs, -⟩ := GraphWalk.exists_isSimple W + obtain ⟨P, -⟩ := ((h.2.2.2.2.2 x hx y hy hxy).1.mp ⟨W', hs⟩) + exact ⟨hy, ⟨P⟩⟩ + · rintro ⟨hy, ⟨W⟩⟩ + by_cases hxy : x = y + · subst hxy + exact ⟨hy, ⟨.nil hx.1⟩⟩ + · obtain ⟨W', hs, -⟩ := GraphWalk.exists_isSimple W + obtain ⟨P, -⟩ := ((h.2.2.2.2.2 x hx y hy hxy).1.mpr ⟨W', hs⟩) + exact ⟨hy, ⟨P⟩⟩ + +/-- Two points with the same image both lie on the boundary of the cut surface. -/ +theorem IsCutAlongGraph.bd_of_eq {J : Drawing S} {φ : S' → S} (hJ : IsCutAlongGraph J S' φ) {p q : + S'} (h : φ p = φ q) (hne : p ≠ q) : p ∈ bd S' ∧ q ∈ bd S' := by + constructor + · by_contra hp + exact hne (hJ.interior_inj p hp q h) + · by_contra hq + exact hne (hJ.interior_inj q hq p h.symm).symm + +theorem IsCutAlongGraph.bd_of_bd {J : Drawing S} {φ : S' → S} (hJ : IsCutAlongGraph J S' φ) {p : + S'} (h : φ p ∈ bd S) : p ∈ bd S' := by + rw [← hJ.preimage_bd_union_U] + exact .inl h + +/-- The two ends of an edge of a forest. -/ +theorem exists_link_of_forest {G : Drawing S'} (hF : IsGraphForest G.toGraph) {e : Set S'} + (he : e ∈ G.E) : ∃ p q, G.toGraph.IsLink e p q ∧ p ≠ q ∧ IsLineWithEnds (closure e) p q := by + obtain ⟨u, v, huv, hcap, hl⟩ := edge_line_of_forest hF he + have hu : u ∈ closure e ∩ G.V := by rw [hcap]; exact .inl rfl + have hv : v ∈ closure e ∩ G.V := by rw [hcap]; exact .inr rfl + exact ⟨u, v, ⟨he, hu.2, hv.2, hcap⟩, huv, hl⟩ + +theorem trail_length_of_eq {α β : Type*} {G : Graph α β} (hG : IsGraphForest G) {a b : α} (hab : a + = b) (W : GraphWalk G a b) (hW : W.edges.Nodup) : W.length = 0 := by + subst hab + exact length_eq_zero_of_trail hG _ _ W rfl hW + +theorem length_pos_of_ne {α β : Type*} {G : Graph α β} {a b : α} (hab : a ≠ b) + (W : GraphWalk G a b) : 0 < W.length := by + cases W with + | nil _ => exact (hab rfl).elim + | cons _ _ => exact List.length_pos_iff.mpr (by simp [GraphWalk.edges]) + +/-- **The ends of an edge have different images** (first part of the proof of (4.5), page 223, for a +sequence with `k = 1`). -/ +theorem push_ne {J H : Drawing S} {G Γ : Drawing S'} {φ : S' → S} (hJ : IsCutAlongGraph J S' φ) + (hH : IsGraphForest H.toGraph) (hV : Γ.V = φ ⁻¹' H.V) + (hE : ∀ e' ∈ Γ.E, ∃ e ∈ H.E, e' = φ ⁻¹' e ∧ φ '' closure e' = closure e ∧ InjOn φ (closure e')) + (hG : ForestsHomotopic G Γ) {e : Set S'} {p q : S'} (hl : G.toGraph.IsLink e p q) + (hpq : p ≠ q) : φ p ≠ φ q := by + intro h + obtain ⟨hp, hq⟩ := hJ.bd_of_eq h hpq + have hs : (GraphWalk.cons hl (.nil hl.2.2.1)).IsSimple := by + simpa [GraphWalk.IsSimple, GraphWalk.support] using hpq + obtain ⟨Q, hQ⟩ := (hG.2.2.2.2.2 p ⟨hl.2.1, hp⟩ q ⟨hl.2.2.1, hq⟩ hpq).1.mp ⟨_, hs⟩ + obtain ⟨W₀, hW₀, hnd⟩ := pull_walk hJ.quotientMap.surjective hV hE Q + have h0 := trail_length_of_eq hH h W₀ (hnd (nodup_edges_of_simple Q hQ)) + have h1 : W₀.length = Q.length := by + change W₀.edges.length = Q.edges.length + rw [hW₀, List.length_map] + have h2 := length_pos_of_ne hpq Q + omega + +section Image + +variable [CompactSpace S'] [T2Space S'] [T2Space S] + +omit [T2Space S'] in +theorem IsCutAlongGraph.closure_image {J : Drawing S} {φ : S' → S} (hJ : IsCutAlongGraph J S' φ) + (A : Set S') : closure (φ '' A) = φ '' closure A := + hJ.quotientMap.continuous.isClosedMap.closure_image_eq_of_continuous hJ.quotientMap.continuous A + +omit [CompactSpace S'] [T2Space S'] [T2Space S] in +/-- A point of the closure of an edge of a proper drawing, off the boundary, has only itself over +its image. So `φ` keeps vertices apart from the rest of the edge. -/ +theorem push_injOn {J : Drawing S} {G : Drawing S'} {φ : S' → S} (hJ : IsCutAlongGraph J S' φ) + (hprop : G.IsProper) {e : Set S'} {p q : S'} (hl : G.toGraph.IsLink e p q) + (hne : φ p ≠ φ q) : InjOn φ (closure e) := by + intro a ha b hb hab + by_contra hd + obtain ⟨h1, h2⟩ := hJ.bd_of_eq hab hd + have ha' : a ∈ closure e ∩ G.V := ⟨ha, hprop ⟨h1, G.closure_subset_U hl.1 ha⟩⟩ + have hb' : b ∈ closure e ∩ G.V := ⟨hb, hprop ⟨h2, G.closure_subset_U hl.1 hb⟩⟩ + rw [hl.2.2.2] at ha' hb' + rcases ha' with rfl | rfl <;> rcases hb' with rfl | rfl + · exact hd rfl + · exact hne hab + · exact hne hab.symm + · exact hd rfl + +omit [CompactSpace S'] [T2Space S'] [T2Space S] in +theorem push_ends {J : Drawing S} {G : Drawing S'} {φ : S' → S} (hJ : IsCutAlongGraph J S' φ) + (hprop : G.IsProper) {e : Set S'} {p q : S'} (hl : G.toGraph.IsLink e p q) : φ '' closure e ∩ φ + '' G.V = {φ p, φ q} := by + ext z + constructor + · rintro ⟨⟨a, ha, rfl⟩, b, hb, hab⟩ + have ha' : a ∈ closure e ∩ G.V := by + refine ⟨ha, ?_⟩ + by_cases hd : b = a + · exact hd ▸ hb + · exact hprop ⟨(hJ.bd_of_eq hab hd).2, G.closure_subset_U hl.1 ha⟩ + rw [hl.2.2.2] at ha' + rcases ha' with rfl | h + · exact .inl rfl + · exact .inr (congrArg φ (mem_singleton_iff.mp h)) + · have hp : p ∈ closure e ∩ G.V := by rw [hl.2.2.2]; exact .inl rfl + have hq : q ∈ closure e ∩ G.V := by rw [hl.2.2.2]; exact .inr rfl + rintro (rfl | h) + · exact ⟨mem_image_of_mem φ hp.1, mem_image_of_mem φ hp.2⟩ + · obtain rfl : z = φ q := h + exact ⟨mem_image_of_mem φ hq.1, mem_image_of_mem φ hq.2⟩ + +omit [CompactSpace S'] [T2Space S'] [T2Space S] in +/-- The closures of two edges of a proper drawing meet in vertices over a cut. -/ +theorem push_meet {J : Drawing S} {G : Drawing S'} {φ : S' → S} (hJ : IsCutAlongGraph J S' φ) + (hprop : G.IsProper) {e f : Set S'} (he : e ∈ G.E) (hf : f ∈ G.E) (hef : e ≠ f) : φ '' closure e + ∩ φ '' closure f ⊆ φ '' G.V := by + rintro _ ⟨⟨a, ha, rfl⟩, b, hb, hab⟩ + by_cases hd : a = b + · subst hd + by_contra hz + have haV : a ∉ G.V := fun h => hz (mem_image_of_mem φ h) + have h1 : a ∈ e := by rw [← G.closure_diff_V he]; exact ⟨ha, haV⟩ + have h2 : a ∈ f := by rw [← G.closure_diff_V hf]; exact ⟨hb, haV⟩ + exact hef (arcComponent_eq he hf h1 h2) + · exact mem_image_of_mem φ (hprop ⟨(hJ.bd_of_eq hab.symm hd).1, G.closure_subset_U he ha⟩) + +omit [CompactSpace S'] [T2Space S'] in +/-- **The image of a forest is a drawing**, when the ends of each edge have different images. -/ +theorem exists_image_drawing {J : Drawing S} {G : Drawing S'} {φ : S' → S} + (hJ : IsCutAlongGraph J S' φ) (hprop : G.IsProper) (hF : IsGraphForest G.toGraph) + (hne : ∀ e p q, G.toGraph.IsLink e p q → φ p ≠ φ q) : + ∃ P : Drawing S, P.U = φ '' G.U ∧ P.V = φ '' G.V ∧ P.E = (φ '' ·) '' G.E := by + classical + have hc := hJ.quotientMap.continuous + have hch : ∀ e : G.E, ∃ p q, G.toGraph.IsLink e.1 p q ∧ p ≠ q ∧ IsLineWithEnds (closure e.1) p q + := fun e => exists_link_of_forest hF e.2 + choose p q hl hpq hline using hch + have hfin : (univ : Set G.E).Finite := by + have : Finite G.E := (show G.E.Finite from G.finite_edges).to_subtype + exact toFinite _ + have hL : ∀ i : G.E, IsLineWithEnds (φ '' closure i.1) (φ (p i)) (φ (q i)) := fun i => by + obtain ⟨f, h0, h1⟩ := hline i + have hinj := push_injOn hJ hprop (hl i) (hne _ _ _ (hl i)) + have ha : IsArcMap fun t => φ (f t).1 := ⟨by fun_prop, fun x y hxy => f.injective (Subtype.ext + (hinj (f x).2 (f y).2 hxy))⟩ + have hr := isLineWithEnds_range_of_arc ha + have hrange : range (fun t => φ (f t).1) = φ '' closure i.1 := by + ext z + constructor + · rintro ⟨t, rfl⟩ + exact mem_image_of_mem φ (f t).2 + · rintro ⟨a, ha, rfl⟩ + exact ⟨f.symm ⟨a, ha⟩, by simp⟩ + rw [hrange] at hr + simpa [h0, h1] using hr + obtain ⟨P, hU, hV, hE⟩ := GM12.exists_drawing_of_finite_lines (G.finite_V.image φ) hfin + (fun i : G.E => φ '' closure i.1) (fun i => φ (p i)) (fun i => φ (q i)) (fun i _ => hL i) + (fun i _ => hne _ _ _ (hl i)) + (fun i _ => push_ends hJ hprop (hl i)) (fun i _ j _ hij => push_meet hJ hprop i.2 j.2 fun h + => hij (Subtype.ext h)) + refine ⟨P, ?_, hV, ?_⟩ + · rw [hU, G.U_eq, image_union, image_iUnion₂] + congr 1 + ext z + simp + · have key : ∀ i : G.E, φ '' closure i.1 \ {φ (p i), φ (q i)} = φ '' i.1 := fun i => by + ext w + constructor + · rintro ⟨⟨a, ha, rfl⟩, hw⟩ + refine ⟨a, ?_, rfl⟩ + rw [← G.closure_diff_V i.2] + refine ⟨ha, fun haV => hw ?_⟩ + have : φ a ∈ φ '' closure i.1 ∩ φ '' G.V := ⟨mem_image_of_mem φ ha, mem_image_of_mem φ haV⟩ + rwa [push_ends hJ hprop (hl i)] at this + · rintro ⟨a, ha, rfl⟩ + have ha' : a ∈ closure i.1 \ G.V := by rw [G.closure_diff_V i.2]; exact ha + have hinj := push_injOn hJ hprop (hl i) (hne _ _ _ (hl i)) + have hp : p i ∈ closure i.1 ∩ G.V := by rw [(hl i).2.2.2]; exact .inl rfl + have hq : q i ∈ closure i.1 ∩ G.V := by rw [(hl i).2.2.2]; exact .inr rfl + refine ⟨mem_image_of_mem φ ha'.1, ?_⟩ + rintro (h | h) + · exact ha'.2 (hinj ha'.1 hp.1 h ▸ hp.2) + · exact ha'.2 (hinj ha'.1 hq.1 h ▸ hq.2) + rw [hE] + ext z + constructor + · rintro ⟨i, -, rfl⟩ + exact ⟨i.1, i.2, (key i).symm⟩ + · rintro ⟨e, he, rfl⟩ + exact ⟨⟨e, he⟩, mem_univ _, key ⟨e, he⟩⟩ + +omit [T2Space S'] in +/-- An edge of `G` maps to an edge of the image, with the images of its ends. -/ +theorem push_link {J : Drawing S} {G : Drawing S'} {P : Drawing S} {φ : S' → S} + (hJ : IsCutAlongGraph J S' φ) (hprop : G.IsProper) (hV : P.V = φ '' G.V) (hE : P.E = + (φ '' ·) '' G.E) {e : Set S'} {p q : S'} (hl : G.toGraph.IsLink e p q) : + P.toGraph.IsLink (φ '' e) (φ p) (φ q) := by + refine ⟨hE ▸ mem_image_of_mem _ hl.1, ?_, ?_, ?_⟩ + · exact hV ▸ mem_image_of_mem φ hl.2.1 + · exact hV ▸ mem_image_of_mem φ hl.2.2.1 + · rw [hJ.closure_image, hV] + exact push_ends hJ hprop hl + +omit [T2Space S'] in +/-- A walk of `G` maps to a walk of the image. -/ +theorem push_walk {J : Drawing S} {G : Drawing S'} {P : Drawing S} {φ : S' → S} + (hJ : IsCutAlongGraph J S' φ) (hprop : G.IsProper) (hV : P.V = φ '' G.V) (hE : P.E = + (φ '' ·) '' G.E) {a b : S'} (W : GraphWalk G.toGraph a b) : + Nonempty (GraphWalk P.toGraph (φ a) (φ b)) := by + induction W with + | @nil v h => + have h' : φ v ∈ P.V := hV ▸ mem_image_of_mem φ h + exact ⟨.nil h'⟩ + | cons hl r ih => + obtain ⟨W⟩ := ih + exact ⟨.cons (push_link hJ hprop hV hE hl) W⟩ + +omit [T2Space S'] in +/-- An edge of the image comes from an edge of `G`. -/ +theorem push_lift {J : Drawing S} {G : Drawing S'} {P : Drawing S} {φ : S' → S} + (hJ : IsCutAlongGraph J S' φ) (hprop : G.IsProper) (hF : IsGraphForest G.toGraph) (hV : P.V + = φ '' G.V) (hE : P.E = (φ '' ·) '' G.E) {e : Set S} {a b : S} + (hl : P.toGraph.IsLink e a b) : ∃ e' p q, G.toGraph.IsLink e' p q ∧ φ p = a ∧ φ q = b ∧ φ '' e' + = e := by + obtain ⟨e', he', rfl⟩ : e ∈ (φ '' ·) '' G.E := hE ▸ hl.1 + obtain ⟨p, q, hlink, -, -⟩ := exists_link_of_forest hF he' + have h2 := hl.2.2.2 + rw [(push_link hJ hprop hV hE hlink).2.2.2] at h2 + rcases pair_eq_pair_iff.mp h2 with ⟨h, h'⟩ | ⟨h, h'⟩ + · exact ⟨e', p, q, hlink, h, h', rfl⟩ + · exact ⟨e', q, p, ⟨hlink.1, hlink.2.2.1, hlink.2.1, by rw [hlink.2.2.2, pair_comm]⟩, h', h, rfl⟩ + +/-- The class of points of `X` reached from an end of the edge over `e`. -/ +def edgeClass (Γ : Drawing S') (X : Set S') (φ : S' → S) (e : Set S) : Set S' := + {y | y ∈ X ∧ ∃ z ∈ Γ.V, z ∈ closure (φ ⁻¹' e) ∧ Nonempty (GraphWalk Γ.toGraph z y)} + +omit [TopologicalSpace S] [CompactSpace S'] [T2Space S'] [T2Space S] in +theorem edgeClass_eq {Γ : Drawing S'} {X : Set S'} {φ : S' → S} (hF : IsGraphForest Γ.toGraph) {e' + : Set S'} (he' : e' ∈ Γ.E) (hpre : φ ⁻¹' (φ '' e') = e') {z : S'} (hz : z ∈ closure e') + (hzV : z ∈ Γ.V) : + edgeClass Γ X φ (φ '' e') = classOf Γ X z := by + ext y + constructor + · rintro ⟨hy, z', hz'V, hz'c, ⟨W⟩⟩ + rw [hpre] at hz'c + obtain ⟨p, q, hl, -, -⟩ := exists_link_of_forest hF he' + have h1 : z ∈ closure e' ∩ Γ.V := ⟨hz, hzV⟩ + have h2 : z' ∈ closure e' ∩ Γ.V := ⟨hz'c, hz'V⟩ + have hpq : Nonempty (GraphWalk Γ.toGraph p q) := ⟨.cons hl (.nil hl.2.2.1)⟩ + obtain ⟨Wpq⟩ := hpq + rw [hl.2.2.2] at h1 h2 + refine ⟨hy, ?_⟩ + rcases h1 with rfl | rfl <;> rcases h2 with rfl | rfl + · exact ⟨W⟩ + · exact ⟨Wpq.append W⟩ + · exact ⟨Wpq.reverse.append W⟩ + · exact ⟨W⟩ + · rintro ⟨hy, ⟨W⟩⟩ + exact ⟨hy, z, hzV, hpre.symm ▸ hz, ⟨W⟩⟩ + +omit [T2Space S'] in +/-- **The image is a forest** (second paragraph of the proof of (4.5), page 223). The paper's +sequence `P'₁, ..., P'ₖ` with `k` minimum becomes a circuit of the quotient graph, handled by +`quotient_forest`. -/ +theorem push_forest {J H P : Drawing S} {G Γ : Drawing S'} {φ : S' → S} + (hJ : IsCutAlongGraph J S' φ) (hH : IsGraphForest H.toGraph) (hV : Γ.V = φ ⁻¹' H.V) + (hE : ∀ e' ∈ Γ.E, ∃ e ∈ H.E, e' = φ ⁻¹' e ∧ φ '' closure e' = closure e ∧ InjOn φ (closure e')) + (hG : ForestsHomotopic G Γ) (hPV : P.V = φ '' G.V) (hPE : P.E = + (φ '' ·) '' G.E) : IsGraphForest P.toGraph := by + classical + have hsurj := hJ.quotientMap.surjective + have hΓ : IsGraphForest Γ.toGraph := hG.2.2.2.1 + have hbd := hG.2.2.2.2.1 + refine quotient_forest (f := φ) (c := classOf G (G.V ∩ bd S')) (X := G.V ∩ bd S') (ι := + (φ '' ·)) hG.2.2.1 ?_ (fun e p q hl => classOf_eq_of_walk (.cons hl (.nil hl.2.2.1))) + (fun e a b hl => push_lift hJ hG.1 hG.2.2.1 hPV hPE hl) + (fun p hp q hq h hne => ⟨⟨hp, (hJ.bd_of_eq h hne).1⟩, ⟨hq, (hJ.bd_of_eq h hne).2⟩⟩) + refine classGraph_forest (t := edgeClass Γ (G.V ∩ bd S') φ) hH (fun x hx + => ?_) fun x hx y hy hc hxy => ?_ + · have h1 : x ∈ Γ.V ∩ bd S' := hbd ▸ hx + have h2 : x ∈ Γ.V := h1.1 + rw [hV] at h2 + exact h2 + · have hyc : y ∈ classOf G (G.V ∩ bd S') y := ⟨hy, ⟨.nil hy.1⟩⟩ + rw [← hc] at hyc + obtain ⟨-, ⟨W⟩⟩ := hyc + obtain ⟨W', hs, -⟩ := GraphWalk.exists_isSimple W + obtain ⟨Q, hQ⟩ := (hG.2.2.2.2.2 x hx y hy hxy).1.mp ⟨W', hs⟩ + obtain ⟨W₀, hW₀, hnd⟩ := pull_walk hsurj hV hE Q + refine ⟨W₀, ?_, hnd (nodup_edges_of_simple Q hQ), fun e he => ?_⟩ + · have h1 : W₀.length = Q.length := by + change W₀.edges.length = Q.edges.length + rw [hW₀, List.length_map] + have h2 := length_pos_of_ne hxy Q + omega + · rw [hW₀] at he + obtain ⟨e', he', rfl⟩ := List.mem_map.mp he + have he'E := mem_E_of_mem_edges Q he' + obtain ⟨p, q, hl, -, -⟩ := exists_link_of_forest hΓ he'E + have hpc : p ∈ closure e' ∩ Γ.V := by rw [hl.2.2.2]; exact .inl rfl + obtain ⟨Q', -, -⟩ := GraphWalk.exists_prefix Q hQ (mem_support_of_mem_closure Q he' hpc.1 + hpc.2) + have hpre : φ ⁻¹' (φ '' e') = e' := by + obtain ⟨e₀, -, rfl, -, -⟩ := hE e' he'E + rw [image_preimage_eq _ hsurj] + rw [edgeClass_eq hΓ he'E hpre hpc.1 hpc.2, ← classOf_eq_of_walk Q', + classOf_eq_of_homotopic hG hx] + +omit [CompactSpace S'] [T2Space S'] [T2Space S] in +/-- An edge of `H` comes from an edge of `φ⁻¹(H)`. -/ +theorem pull_lift {H : Drawing S} {Γ : Drawing S'} {φ : S' → S} (hs : Function.Surjective φ) + (hF : IsGraphForest Γ.toGraph) (hU : Γ.U = φ ⁻¹' H.U) (hV : Γ.V = φ ⁻¹' H.V) + (hE : ∀ e' ∈ Γ.E, ∃ e ∈ H.E, e' = φ ⁻¹' e ∧ φ '' closure e' = closure e ∧ InjOn φ + (closure e')) {e : Set S} {a b : S} (hl : H.toGraph.IsLink e a b) : + ∃ e' p q, Γ.toGraph.IsLink e' p q ∧ φ p = a ∧ φ q = b := by + have he := hl.1 + obtain ⟨z, hz⟩ := he.1 + have hzU := he.2.1 hz + obtain ⟨z', rfl⟩ := hs z + obtain ⟨e', he', hz'⟩ := exists_edge_of_mem (G := Γ) (z := z') + (by rw [hU]; exact hzU.1) (by rw [hV]; exact hzU.2) + obtain ⟨e₀, he₀, rfl, -, -⟩ := hE e' he' + obtain rfl : e₀ = e := arcComponent_eq he₀ he hz' hz + obtain ⟨p, q, hlink, -, -⟩ := exists_link_of_forest hF he' + have h2 := hl.2.2.2 + have h3 := (pull_link hs hV hE hlink).2.2.2 + rw [image_preimage_eq _ hs, h2] at h3 + rcases pair_eq_pair_iff.mp h3 with ⟨h, h'⟩ | ⟨h, h'⟩ + · exact ⟨_, p, q, hlink, h.symm, h'.symm⟩ + · exact ⟨_, q, p, ⟨hlink.1, hlink.2.2.1, hlink.2.1, by rw [hlink.2.2.2, pair_comm]⟩, h.symm, + h'.symm⟩ + +end Image + +/-- **A walk breaks at the vertices with more than one preimage.** Let every edge of `Q` come from +an edge of `D`, and let two vertices of `D` with the same image both lie in `X`. Then a walk of `Q` +from the image of a vertex `a'` of `D` to the image of a point of `X` first follows `D` to a point +`x` of `X`, and from `x` it goes on by steps of `R`. -/ +theorem chain_of_walk {D : Drawing S'} {Q : Drawing S} {X : Set S'} {φ : S' → S} {R : S → S → Prop} + (hsub : X ⊆ D.V) (hlift : ∀ e a b, Q.toGraph.IsLink e a b → ∃ e' p q, D.toGraph.IsLink e' p q + ∧ φ p = a ∧ φ q = b) + (hjump : ∀ p ∈ D.V, ∀ q ∈ D.V, φ p = φ q → p ≠ q → p ∈ X ∧ q ∈ X) + (hbase : ∀ x ∈ X, ∀ y ∈ X, Nonempty (GraphWalk D.toGraph x y) → R (φ x) (φ y)) {a b : S} + (W : GraphWalk Q.toGraph a b) (hb : b ∈ φ '' X) : + ∀ a' ∈ D.V, φ a' = a → ∃ x ∈ X, Nonempty (GraphWalk D.toGraph a' x) ∧ Relation.ReflTransGen R + (φ x) b := by + induction W with + | nil _ => + intro a' ha' h + obtain ⟨b', hb', rfl⟩ := hb + by_cases hd : a' = b' + · subst hd + exact ⟨a', hb', ⟨.nil ha'⟩, by rw [h]⟩ + · exact ⟨a', (hjump a' ha' b' (hsub hb') h hd).1, ⟨.nil ha'⟩, by rw [h]⟩ + | cons hl r ih => + intro a' ha' h + obtain ⟨e', p, q, hlink, rfl, rfl⟩ := hlift _ _ _ hl + obtain ⟨x, hx, ⟨W'⟩, hR⟩ := ih hb q hlink.2.2.1 rfl + by_cases hd : a' = p + · subst hd + exact ⟨x, hx, ⟨.cons hlink W'⟩, hR⟩ + · obtain ⟨h1, h2⟩ := hjump a' ha' p hlink.2.1 h hd + refine ⟨a', h1, ⟨.nil ha'⟩, ?_⟩ + rw [h] + exact Relation.ReflTransGen.head (hbase p h2 x hx ⟨.cons hlink W'⟩) hR + +/-- One step between images of boundary vertices of `G` that `G` joins. -/ +def PushStep (G : Drawing S') (φ : S' → S) (c d : S) : Prop := + ∃ x ∈ G.V ∩ bd S', ∃ y ∈ G.V ∩ bd S', φ x = c ∧ φ y = d ∧ Nonempty (GraphWalk G.toGraph x y) + +theorem steps_of_walk {D : Drawing S'} {Q : Drawing S} {X : Set S'} {φ : S' → S} {R : S → S → Prop} + (hsub : X ⊆ D.V) (hlift : ∀ e a b, Q.toGraph.IsLink e a b → ∃ e' p q, D.toGraph.IsLink e' p q + ∧ φ p = a ∧ φ q = b) + (hjump : ∀ p ∈ D.V, ∀ q ∈ D.V, φ p = φ q → p ≠ q → p ∈ X ∧ q ∈ X) + (hbase : ∀ x ∈ X, ∀ y ∈ X, Nonempty (GraphWalk D.toGraph x y) → R (φ x) (φ y)) {s : S'} + (hs : s ∈ X) {b : S} (W : GraphWalk Q.toGraph (φ s) b) (hb : b ∈ φ '' X) : + Relation.ReflTransGen R (φ s) b := by + obtain ⟨x, hx, hW, hR⟩ := chain_of_walk hsub hlift hjump hbase W hb s (hsub hs) rfl + exact Relation.ReflTransGen.head (hbase s hs x hx hW) hR + +theorem homotopic_of_curves {T : Type} [TopologicalSpace T] {a b : T} {p q : Path a b} + (h : CurvesHomotopic p.toContinuousMap q.toContinuousMap) : p.Homotopic q := by + obtain ⟨ψ, -, h0, h1, h2, -, h3, -⟩ := h + refine ⟨⟨⟨⟨fun w => ψ (w.2, w.1), by fun_prop⟩, fun x => ?_, fun x => ?_⟩, fun t x hx => ?_⟩⟩ + · exact h0 x + · exact h1 x + · rcases hx with rfl | hx + · exact h2 t + · obtain rfl : x = 1 := hx + exact h3 t + +theorem curves_of_homotopic {T : Type} [TopologicalSpace T] {a b : T} {p q : Path a b} + (h : p.Homotopic q) : CurvesHomotopic p.toContinuousMap q.toContinuousMap := by + obtain ⟨F⟩ := h + refine ⟨⟨fun w => F (w.2, w.1), by fun_prop⟩, fun _ => mem_univ _, fun x => ?_, fun x => ?_, + fun y => ?_, fun y => ?_, fun y => ?_, fun y => ?_⟩ + · simp + · simp + · simp + · simp + · simp + · simp + +/-- What holds between two points joined by steps: both forests join them, and they have homotopic +curves. -/ +def PushJoined (P H : Drawing S) (a b : S) : Prop := + Nonempty (GraphWalk P.toGraph a b) ∧ Nonempty (GraphWalk H.toGraph a b) ∧ ∃ κ l : Path a b, + (∀ u, κ u ∈ P.U) ∧ (∀ u, l u ∈ H.U) ∧ κ.Homotopic l + +theorem PushJoined.refl {P H : Drawing S} {a : S} (h1 : a ∈ P.V) (h2 : a ∈ H.V) : PushJoined P H a + a := + ⟨⟨.nil h1⟩, ⟨.nil h2⟩, Path.refl a, Path.refl a, fun _ => P.V_subset_U h1, fun _ + => H.V_subset_U h2, Path.Homotopic.refl _⟩ + +theorem mem_trans {T : Type} [TopologicalSpace T] {a b c : T} {A : Set T} {p : Path a b} {q : Path + b c} (hp : ∀ u, p u ∈ A) (hq : ∀ u, q u ∈ A) (u : unitInterval) : p.trans q u ∈ A := by + have h : p.trans q u ∈ range (p.trans q) := ⟨u, rfl⟩ + rw [Path.trans_range] at h + rcases h with ⟨v, hv⟩ | ⟨v, hv⟩ + · exact hv ▸ hp v + · exact hv ▸ hq v + +theorem PushJoined.trans {P H : Drawing S} {a b c : S} (h : PushJoined P H a b) + (h' : PushJoined P H b c) : PushJoined P H a c := by + obtain ⟨⟨W₁⟩, ⟨W₂⟩, κ, l, h1, h2, h3⟩ := h + obtain ⟨⟨W₁'⟩, ⟨W₂'⟩, κ', l', h1', h2', h3'⟩ := h' + exact ⟨⟨W₁.append W₁'⟩, ⟨W₂.append W₂'⟩, κ.trans κ', l.trans l', mem_trans h1 h1', + mem_trans h2 h2', h3.hcomp h3'⟩ + +theorem link_ne {G : Drawing S'} (hF : IsGraphForest G.toGraph) {e : Set S'} {p q : S'} + (hl : G.toGraph.IsLink e p q) : p ≠ q := by + obtain ⟨u, v, huv, hcap, -⟩ := edge_line_of_forest hF hl.1 + have h := hl.2.2.2 + rw [hcap] at h + rintro rfl + rcases pair_eq_pair_iff.mp h with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> exact huv (by rw [h1, h2]) + +/-- **The core of the second part of (4.5)** (page 223). Let `Γ` be the preimage of a forest `H`, +and let `G` be a forest homotopic to `Γ`. Then the image of `G` is a forest homotopic to `H`. -/ +theorem exists_image_forest [CompactSpace S'] [T2Space S] {J H : Drawing S} {G Γ : + Drawing S'} {φ : S' → S} (hJ : IsCutAlongGraph J S' φ) (hH : IsSurfaceForest H) (hU : Γ.U + = φ ⁻¹' H.U) (hV : Γ.V = φ ⁻¹' H.V) + (hE : ∀ e' ∈ Γ.E, ∃ e ∈ H.E, e' = φ ⁻¹' e ∧ φ '' closure e' = closure e ∧ InjOn φ (closure e')) + (hG : ForestsHomotopic G Γ) : + ∃ P : Drawing S, IsImageDrawing φ G P ∧ IsSurfaceForest P ∧ ForestsHomotopic P H := by + classical + have hsurj := hJ.quotientMap.surjective + have hcont := hJ.quotientMap.continuous + have hGp := hG.1 + have hGf : IsGraphForest G.toGraph := hG.2.2.1 + have hΓf : IsGraphForest Γ.toGraph := hG.2.2.2.1 + have hXΓ : G.V ∩ bd S' = Γ.V ∩ bd S' := hG.2.2.2.2.1 + obtain ⟨P, hPU, hPV, hPE⟩ := exists_image_drawing hJ hGp hGf fun e p q hl + => push_ne hJ hH.2 hV hE hG hl (link_ne hGf hl) + have hPf := push_forest hJ hH.2 hV hE hG hPV hPE + have hPp : P.IsProper := by + rintro z ⟨hzb, hzU⟩ + rw [hPU] at hzU + obtain ⟨a, ha, rfl⟩ := hzU + rw [hPV] + exact mem_image_of_mem φ (hGp ⟨hJ.bd_of_bd hzb, ha⟩) + have hXP : ∀ x ∈ G.V ∩ bd S', φ x ∈ P.V := fun x hx => by + rw [hPV] + exact mem_image_of_mem φ hx.1 + have hXH : ∀ x ∈ G.V ∩ bd S', φ x ∈ H.V := fun x hx => by + have h1 : x ∈ Γ.V ∩ bd S' := hXΓ ▸ hx + have h2 : x ∈ Γ.V := h1.1 + rw [hV] at h2 + exact h2 + have hPim : ∀ z ∈ P.V ∩ bd S, z ∈ φ '' (G.V ∩ bd S') := by + rintro z ⟨hz, hzb⟩ + rw [hPV] at hz + obtain ⟨a, ha, rfl⟩ := hz + exact ⟨a, ⟨ha, hJ.bd_of_bd hzb⟩, rfl⟩ + have hHim : ∀ z ∈ H.V ∩ bd S, z ∈ φ '' (G.V ∩ bd S') := by + rintro z ⟨hz, hzb⟩ + obtain ⟨a, rfl⟩ := hsurj z + have ha : a ∈ Γ.V ∩ bd S' := ⟨by rw [hV]; exact hz, hJ.bd_of_bd hzb⟩ + exact ⟨a, hXΓ ▸ ha, rfl⟩ + have hbd : P.V ∩ bd S = H.V ∩ bd S := by + refine Subset.antisymm (fun z hz => ?_) fun z hz => ?_ + · obtain ⟨a, ha, rfl⟩ := hPim z hz + exact ⟨hXH a ha, hz.2⟩ + · obtain ⟨a, ha, rfl⟩ := hHim z hz + exact ⟨hXP a ha, hz.2⟩ + have hone : ∀ c d, PushStep G φ c d → PushJoined P H c d := by + rintro _ _ ⟨x, hx, y, hy, rfl, rfl, ⟨W⟩⟩ + by_cases hxy : x = y + · subst hxy + exact PushJoined.refl (hXP x hx) (hXH x hx) + obtain ⟨W', hs, -⟩ := GraphWalk.exists_isSimple W + obtain ⟨Q, hQ⟩ := (hG.2.2.2.2.2 x hx y hy hxy).1.mp ⟨W', hs⟩ + obtain ⟨g, hg⟩ := exists_curveTracesWalk W' + obtain ⟨c, hc⟩ := exists_curveTracesWalk Q + have hh := (hG.2.2.2.2.2 x hx y hy hxy).2 W' Q g c hs hQ hg hc + obtain ⟨g0, g1⟩ := hg.endpoints + obtain ⟨c0, c1⟩ := hc.endpoints + let pg : Path x y := ⟨g, g0, g1⟩ + let pc : Path x y := ⟨c, c0, c1⟩ + have hpp : pg.Homotopic pc := homotopic_of_curves hh + obtain ⟨W₀, -, -⟩ := pull_walk hsurj hV hE Q + refine ⟨push_walk hJ hGp hPV hPE W, ⟨W₀⟩, pg.map hcont, pc.map hcont, fun u => ?_, + fun u => ?_, hpp.map ⟨φ, hcont⟩⟩ + · rw [hPU] + exact mem_image_of_mem φ (hg.range_subset_U ⟨u, rfl⟩) + · have : pc u ∈ Γ.U := hc.range_subset_U ⟨u, rfl⟩ + rw [hU] at this + exact this + have hjoined : ∀ a b, Relation.ReflTransGen (PushStep G φ) a b → a ∈ φ '' (G.V ∩ bd S') + → PushJoined P H a b := by + intro a b h ha + induction h with + | refl => + obtain ⟨x, hx, rfl⟩ := ha + exact PushJoined.refl (hXP x hx) (hXH x hx) + | tail _ h2 ih => exact ih.trans (hone _ _ h2) + have hfromP : ∀ {s t : S'}, s ∈ G.V ∩ bd S' → t ∈ G.V ∩ bd S' → GraphWalk P.toGraph (φ s) (φ t) + → PushJoined P H (φ s) (φ t) := fun {s t} hs ht W => + hjoined _ _ (steps_of_walk (D := G) (X := G.V ∩ bd S') inter_subset_left (fun e a b hl => by + obtain ⟨e', p, q, h1, h2, h3, -⟩ := push_lift hJ hGp hGf hPV hPE hl + exact ⟨e', p, q, h1, h2, h3⟩) + (fun p hp q hq h hne => ⟨⟨hp, (hJ.bd_of_eq h hne).1⟩, ⟨hq, (hJ.bd_of_eq h hne).2⟩⟩) + (fun x hx y hy h => ⟨x, hx, y, hy, rfl, rfl, h⟩) hs W ⟨t, ht, rfl⟩) ⟨s, hs, rfl⟩ + have hfromH : ∀ {s t : S'}, s ∈ G.V ∩ bd S' → t ∈ G.V ∩ bd S' → GraphWalk H.toGraph (φ s) (φ t) + → PushJoined P H (φ s) (φ t) := fun {s t} hs ht W => + hjoined _ _ (steps_of_walk (D := Γ) (X := G.V ∩ bd S') (fun x hx => + (hXΓ ▸ hx : x ∈ Γ.V ∩ bd S').1) (fun e a b hl => pull_lift hsurj hΓf hU hV hE hl) + (fun p hp q hq h hne => by + rw [hXΓ] + exact ⟨⟨hp, (hJ.bd_of_eq h hne).1⟩, ⟨hq, (hJ.bd_of_eq h hne).2⟩⟩) (fun x hx y hy h => by + obtain ⟨W₀⟩ := h + have hyc : y ∈ classOf Γ (G.V ∩ bd S') x := ⟨hy, ⟨W₀⟩⟩ + rw [← classOf_eq_of_homotopic hG hx] at hyc + exact ⟨x, hx, y, hy, rfl, rfl, hyc.2⟩) hs W ⟨t, ht, rfl⟩) ⟨s, hs, rfl⟩ + refine ⟨P, ⟨hPU, hPV⟩, ⟨hPp, hPf⟩, hPp, hH.1, hPf, hH.2, hbd, fun s hs t ht hst => ?_⟩ + obtain ⟨s', hs', rfl⟩ := hPim s hs + obtain ⟨t', ht', rfl⟩ := hPim t ht + refine ⟨⟨fun ⟨W, _⟩ => ?_, fun ⟨W, _⟩ => ?_⟩, fun W₁ W₂ g c _ _ hg hc => ?_⟩ + · obtain ⟨-, ⟨W'⟩, -⟩ := hfromP hs' ht' W + obtain ⟨W'', h, -⟩ := GraphWalk.exists_isSimple W' + exact ⟨W'', h⟩ + · obtain ⟨⟨W'⟩, -, -⟩ := hfromH hs' ht' W + obtain ⟨W'', h, -⟩ := GraphWalk.exists_isSimple W' + exact ⟨W'', h⟩ + · obtain ⟨-, -, κ, l, h1, h2, h3⟩ := hfromP hs' ht' W₁ + obtain ⟨g0, g1⟩ := hg.endpoints + obtain ⟨c0, c1⟩ := hc.endpoints + let pg : Path (φ s') (φ t') := ⟨g, g0, g1⟩ + let pc : Path (φ s') (φ t') := ⟨c, c0, c1⟩ + have hpg : pg.Homotopic κ := IsFlat.flat (isFlat_forest hPf) pg κ (fun u + => hg.range_subset_U ⟨u, rfl⟩) h1 + have hpc : l.Homotopic pc := IsFlat.flat (isFlat_forest hH.2) l pc h2 fun u + => hc.range_subset_U ⟨u, rfl⟩ + exact curves_of_homotopic (hpg.trans (h3.trans hpc)) + +theorem drawing_eq {T : Type} [TopologicalSpace T] {Γ₁ Γ₂ : Drawing T} (hU : Γ₁.U = Γ₂.U) + (hV : Γ₁.V = Γ₂.V) : Γ₁ = Γ₂ := by + cases Γ₁ + cases Γ₂ + simp only [Drawing.mk.injEq] + exact ⟨hU, hV⟩ + +/-- Graph Minors VII, (4.5) (page 223): +"(4.5) *Let $J$ be a proper graph in $\Sigma$ with no isolated vertices. Let $\Sigma'$ be the +surface obtained from $\Sigma$ by cutting along $U(J)$ and let $\phi \colon \Sigma' \to \Sigma$ be +the associated surjection. Let $H$ be a forest in $\Sigma$ such that $U(J)$ is $H$-normal. Then +$\phi^{-1}(H)$ is a forest in $\Sigma'$. Moreover, if $H'$ is a forest in $\Sigma'$ homoplastic to +$\phi^{-1}(H)$, then $\phi(H')$ is a forest in $\Sigma$ homoplastic to $H$.*" -/ +theorem theorem_4_5_proof (hS : IsSurface S) (J H : Drawing S) (φ : S' → S) + (hCut : IsCutAlongGraph J S' φ) (hH : IsSurfaceForest H) (hNorm : H.IsNormal J.U) : + ∃ H_pull : Drawing S', + IsPullbackDrawing φ H H_pull ∧ IsSurfaceForest H_pull ∧ + ∀ H' : Drawing S', IsSurfaceForest H' → ForestsHomoplastic H' H_pull → + ∃ H_push : Drawing S, + IsImageDrawing φ H' H_push ∧ IsSurfaceForest H_push ∧ + ForestsHomoplastic H_push H := by + have hT2 : T2Space S := hS.2.1 + have hY := hCut.isSurface + have : CompactSpace S' := hY.1 + have : T2Space S' := hY.2.1 + obtain ⟨Γ, hp, hprop, hE⟩ := exists_pullback hS hCut hH hNorm + refine ⟨Γ, hp, ⟨hprop, isGraphForest_pullback hCut.quotientMap.surjective hH.2 hp.2 hE⟩, + fun H' hH' ⟨α, hα, hh⟩ => ?_⟩ + obtain ⟨P, hPi, hPf, hPh⟩ := exists_image_forest hCut hH hp.1 hp.2 hE hh + obtain ⟨β, hβ, hβφ⟩ := exists_descend hCut α hα + have himg : ∀ A : Set S', β '' (φ '' A) = φ '' (α '' A) := fun A => by + rw [image_image, image_image] + exact image_congr fun y _ => hβφ y + have hβU : β '' (φ '' H'.U) = P.U := by + rw [himg] + exact hPi.1.symm + have hβV : β '' (φ '' H'.V) = P.V := by + rw [himg] + exact hPi.2.symm + have hsymm : ∀ A : Set S, β.symm '' (β '' A) = A := fun A => by + rw [image_image] + simp + refine ⟨mapDrawingHomeo β.symm P, ⟨?_, ?_⟩, hPf.map_homeo β.symm, β, hβ, ?_⟩ + · change β.symm '' P.U = φ '' H'.U + rw [← hβU, hsymm] + · change β.symm '' P.V = φ '' H'.V + rw [← hβV, hsymm] + · have : mapDrawingHomeo β (mapDrawingHomeo β.symm P) = P := by + refine drawing_eq ?_ ?_ + · change β '' (β.symm '' P.U) = P.U + rw [image_image] + simp + · change β '' (β.symm '' P.V) = P.V + rw [image_image] + simp + rw [this] + exact hPh + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/RegionNest.lean b/LeanPool/GraphMinor/GM07/RegionNest.lean new file mode 100644 index 0000000000..553c14269c --- /dev/null +++ b/LeanPool/GraphMinor/GM07/RegionNest.lean @@ -0,0 +1,373 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.SideDisc +public import LeanPool.GraphMinor.GM07.Section5b +public import LeanPool.GraphMinor.GM14.RigidNoose +public import LeanPool.GraphMinor.GM11.Separate +public import LeanPool.GraphMinor.GM11.OArcCircuit +public import LeanPool.GraphMinor.GM11.Section5b + +/-! +# Nested circuits from layers of regions + +Let `Γ` be a drawing in a sphere and `r₀` a region. Layer `t` is the set of regions that a chain of +regions from `r₀`, with `t` common vertices, reaches. If another region +`r₂` is not in layer `t`, then the boundary of the layer holds an `O`-arc that separates `r₀` from +`r₂`, and these `O`-arcs are vertex-disjoint and nested for different `t`. +This fills in how Graph Minors VII gets the nest in (5.8) from condition (ii), and it is the circuit +`C_j` of the proof of (5.9). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +local notation "I" => unitInterval + +variable {T : Type} [TopologicalSpace T] + +/-- Layer `t` of regions around `r₀`. -/ +def regLayer (Γ : Drawing T) (r₀ : Set T) : ℕ → Set (Set T) + | 0 => {r₀} + | t + 1 => regLayer Γ r₀ t ∪ {r ∈ Γ.R | ∃ r' ∈ regLayer Γ r₀ t, ∃ v ∈ Γ.V, v ∈ closure r + ∧ v ∈ closure r'} + +theorem regLayer_subset {Γ : Drawing T} {r₀ : Set T} (h₀ : r₀ ∈ Γ.R) (t : ℕ) : regLayer Γ r₀ t ⊆ + Γ.R := by + induction t with + | zero => + rintro r rfl + exact h₀ + | succ t ih => + rintro r (h | h) + · exact ih h + · exact h.1 + +theorem regLayer_mono {Γ : Drawing T} {r₀ : Set T} {t t' : ℕ} (h : t ≤ t') : regLayer Γ r₀ t ⊆ + regLayer Γ r₀ t' := by + induction h with + | refl => exact Subset.rfl + | step _ ih => exact ih.trans subset_union_left + +/-- If a vertex is on a region of layer `t` and on a region outside layer `t + 1`, we have a +contradiction. -/ +theorem not_incident_far {Γ : Drawing T} {r₀ r r'' : Set T} {t : ℕ} (hr : r ∈ regLayer Γ r₀ t) + (hr'' : r'' ∈ Γ.R) (hn : r'' ∉ regLayer Γ r₀ (t + 1)) {v : T} (hv : v ∈ Γ.V) + (h1 : v ∈ closure r) (h2 : v ∈ closure r'') : False := + hn (.inr ⟨hr'', r, hr, v, hv, h2, h1⟩) + +variable [T2Space T] + +omit [T2Space T] in +/-- A region that holds a point of an atom is that atom. -/ +theorem region_eq_of_mem_atom {Γ : Drawing T} {r a : Set T} (hr : r ∈ Γ.R) (ha : a ∈ Γ.A) {y : T} + (hy : y ∈ r) (hya : y ∈ a) : a = r := by + have hrU : ∀ {r : Set T}, r ∈ Γ.R → ∀ {y}, y ∈ r → y ∉ Γ.U := fun {r} hr {y} hy h => by + obtain ⟨x, -, rfl⟩ := (mem_R_iff Γ).mp hr + exact (connectedComponentIn_subset _ _ hy).2 h + rcases ha with (⟨v, hv, rfl⟩ | he) | hr' + · obtain rfl := hya + exact absurd (Γ.V_subset_U hv) (hrU hr hy) + · exact absurd (he.2.1 hya).1 (hrU hr hy) + · obtain ⟨x, -, rfl⟩ := (mem_R_iff Γ).mp hr + obtain ⟨x', -, rfl⟩ := (mem_R_iff Γ).mp hr' + exact (connectedComponentIn_eq hya).trans (connectedComponentIn_eq hy).symm + +omit [T2Space T] in +/-- A vertex on the closure of a region can be reached from the region. -/ +theorem isPathConnected_insert_region_surface (hS : IsClosedSurface T) {Γ : Drawing T} {r : Set T} + {v : T} (hr : r ∈ Γ.R) (hv : v ∈ Γ.V) (hvr : v ∈ closure r) : IsPathConnected (insert v r) := by + obtain ⟨Φ, hΦ⟩ := exists_isPolar_of_vertex hS Γ hv + obtain ⟨y, hy1, hy2⟩ := mem_closure_iff.mp hvr _ isOpen_interior hΦ.nhd + obtain ⟨x, rfl⟩ := interior_subset hy1 + have hx : x ≠ polarCentre := fun e => by + obtain ⟨z, -, rfl⟩ := (mem_R_iff Γ).mp hr + have : Φ x ∈ Γ.V := by rw [e, hΦ.centre]; exact hv + exact (connectedComponentIn_subset _ _ hy2).2 (Γ.V_subset_U this) + have hray : ∀ c : I, 0 < c → Φ (discScale c x) ∈ r := fun c hc => by + obtain ⟨a, ha, h1, h2⟩ := hΦ.ray x hx c hc + rw [region_eq_of_mem_atom hr ha hy2 h1] at h2 + exact h2 + have hp : JoinedIn (insert v r) v (Φ x) := by + refine ⟨⟨⟨fun c : I => Φ (discScale c x), Φ.continuous.comp (continuous_discScale.comp + (Continuous.prodMk continuous_id continuous_const))⟩, ?_, ?_⟩, fun c => ?_⟩ + · simp [discScale_zero, hΦ.centre] + · simp [discScale_one] + · by_cases hc : c = 0 + · subst hc + left + simp + · exact .inr (hray c (unitInterval.pos_iff_ne_zero.mpr hc)) + have hlc : LocallyConnectedSpace T := IsClosedSurface.locallyConnectedSpace hS + have hrp : IsPathConnected r := isPathConnected_of_isOpen hS (region_isOpen hr) + (region_isPreconnected hr) ⟨_, hy2⟩ + refine ⟨v, mem_insert v r, fun z hz => ?_⟩ + rcases hz with rfl | hz + · exact JoinedIn.refl (mem_insert _ r) + · exact hp.trans ((hrp.joinedIn _ hy2 _ hz).mono (subset_insert v r)) + +omit [T2Space T] in +/-- A chain of regions gives a connected set that meets the drawing in few vertices. -/ +theorem exists_chain_set (hS : IsClosedSurface T) {Γ : Drawing T} {r₀ : Set T} (h₀ : r₀ ∈ Γ.R) + (t : ℕ) : ∀ r ∈ regLayer Γ r₀ t, ∃ A : Set T, IsPathConnected A ∧ r₀ ⊆ A ∧ r ⊆ A + ∧ ∃ X : Finset T, X.card ≤ t ∧ + (X : Set T) ⊆ Γ.V ∧ A ⊆ (X : Set T) ∪ Γ.Uᶜ := by + classical + have hlc : LocallyConnectedSpace T := IsClosedSurface.locallyConnectedSpace hS + have hoff : ∀ {r : Set T}, r ∈ Γ.R → r ⊆ Γ.Uᶜ := fun {r} hr y hy h => by + obtain ⟨x, -, rfl⟩ := (mem_R_iff Γ).mp hr + exact (connectedComponentIn_subset _ _ hy).2 h + induction t with + | zero => + rintro r rfl + have hrp : IsPathConnected r := isPathConnected_of_isOpen hS (region_isOpen h₀) + (region_isPreconnected h₀) (region_nonempty h₀) + exact ⟨r, hrp, Subset.rfl, Subset.rfl, ∅, by simp, by simp, fun x hx => .inr (hoff h₀ hx)⟩ + | succ t ih => + rintro r (h | ⟨hr, r', hr', v, hv, h1, h2⟩) + · obtain ⟨A, a1, a2, a3, X, b1, b2, b3⟩ := ih r h + exact ⟨A, a1, a2, a3, X, by omega, b2, b3⟩ + · obtain ⟨A, a1, a2, a3, X, b1, b2, b3⟩ := ih r' hr' + have hr'R := regLayer_subset h₀ t hr' + have c1 := isPathConnected_insert_region_surface hS hr hv h1 + have c2 := isPathConnected_insert_region_surface hS hr'R hv h2 + obtain ⟨y, hy⟩ := region_nonempty hr'R + have c3 := a1.union c2 ⟨y, a3 hy, mem_insert_of_mem _ hy⟩ + have c4 := c3.union c1 ⟨v, .inr (mem_insert _ _), mem_insert _ _⟩ + refine ⟨_, c4, a2.trans (subset_union_left.trans subset_union_left), + fun x hx => .inr (mem_insert_of_mem _ hx), insert v X, ?_, ?_, ?_⟩ + · exact (Finset.card_insert_le _ _).trans (by omega) + · rw [Finset.coe_insert] + exact insert_subset hv b2 + · rw [Finset.coe_insert] + have hins : ∀ x, x ∈ X → x ∈ insert v X := fun x hx => Finset.mem_insert_of_mem hx + rintro x ((h3 | h3) | h3) + · rcases b3 h3 with h4 | h4 + · exact .inl (.inr h4) + · exact .inr h4 + · rcases h3 with rfl | h3 + · exact .inl (.inl rfl) + · exact .inr (hoff hr'R h3) + · rcases h3 with rfl | h3 + · exact .inl (.inl rfl) + · exact .inr (hoff hr h3) + +variable [ConnectedSpace T] + +omit [T2Space T] in +omit [ConnectedSpace T] in +/-- An edge that meets the closure of a region lies in it. -/ +theorem closure_edge_subset (hS : IsClosedSurface T) {Γ : Drawing T} {e r : Set T} (he : e ∈ Γ.E) + (hr : r ∈ Γ.R) (h : (e ∩ closure r).Nonempty) : closure e ⊆ closure r := by + obtain ⟨y, hye, hyr⟩ := h + obtain ⟨𝒜, h𝒜, hc⟩ := isGammaNice_closure_sUnion_regions hS Γ (ℛ := {r}) + (singleton_subset_iff.mpr hr) + rw [sUnion_singleton] at hc + rw [hc] at hyr + obtain ⟨a, ha, hya⟩ := hyr + have hyU := (he.2.1 hye) + have hae : a = e := by + rcases h𝒜 ha with (⟨v, hv, rfl⟩ | h1) | h1 + · obtain rfl := hya + exact absurd hv hyU.2 + · by_contra hn + exact disjoint_left.mp (GM06.disjoint_edges_of_ne Γ h1 he hn) hya hye + · obtain ⟨x, -, rfl⟩ := (mem_R_iff Γ).mp h1 + exact absurd hyU.1 (connectedComponentIn_subset _ _ hya).2 + refine closure_minimal (fun x hx => ?_) isClosed_closure + rw [hc] + exact ⟨a, ha, hae ▸ hx⟩ + +omit [T2Space T] [ConnectedSpace T] in +theorem isPreconnected_layer {Γ : Drawing T} {r₀ : Set T} (h₀ : r₀ ∈ Γ.R) + (t : ℕ) : IsPreconnected (⋃ r ∈ regLayer Γ r₀ t, closure r) := by + obtain ⟨p, hp⟩ := region_nonempty h₀ + have hp0 : ∀ t, p ∈ ⋃ r ∈ regLayer Γ r₀ t, closure r := fun t => + mem_iUnion₂.mpr ⟨r₀, regLayer_mono (Nat.zero_le t) rfl, subset_closure hp⟩ + have key : ∀ t, ∀ x ∈ ⋃ r ∈ regLayer Γ r₀ t, closure r, ∃ C, IsPreconnected C ∧ p ∈ C ∧ x ∈ C + ∧ C ⊆ ⋃ r ∈ regLayer Γ r₀ t, closure r := by + intro t + induction t with + | zero => + intro x hx + refine ⟨closure r₀, (region_isPreconnected h₀).closure, subset_closure hp, ?_, ?_⟩ + · obtain ⟨r, rfl, h⟩ := mem_iUnion₂.mp hx + exact h + · exact fun y hy => mem_iUnion₂.mpr ⟨r₀, rfl, hy⟩ + | succ t ih => + intro x hx + have hmono : ∀ y ∈ ⋃ r ∈ regLayer Γ r₀ t, closure r, y ∈ ⋃ r ∈ regLayer Γ r₀ + (t + 1), closure r := fun y hy => by + obtain ⟨r, h1, h2⟩ := mem_iUnion₂.mp hy + exact mem_iUnion₂.mpr ⟨r, .inl h1, h2⟩ + obtain ⟨r, h1, h2⟩ := mem_iUnion₂.mp hx + rcases h1 with h1 | ⟨hr, r', hr', v, hvV, hv1, hv2⟩ + · obtain ⟨C, c1, c2, c3, c4⟩ := ih x (mem_iUnion₂.mpr ⟨r, h1, h2⟩) + exact ⟨C, c1, c2, c3, c4.trans hmono⟩ + · obtain ⟨C, c1, c2, c3, c4⟩ := ih v (mem_iUnion₂.mpr ⟨r', hr', hv2⟩) + refine ⟨C ∪ closure r, c1.union v c3 hv1 (region_isPreconnected hr).closure, .inl c2, .inr + h2, union_subset (c4.trans hmono) fun y hy => mem_iUnion₂.mpr ⟨r, .inr ⟨hr, r', hr', v, + hvV, hv1, hv2⟩, hy⟩⟩ + refine isPreconnected_of_forall p fun x hx => ?_ + obtain ⟨C, c1, c2, c3, c4⟩ := key t x hx + exact ⟨C, c4, c2, c3, c1⟩ + +/-- The `O`-arc in the boundary of a layer. -/ +theorem exists_layer_circuit (hS : IsClosedSurface T) (hsph : IsSphere T) {Γ : Drawing T} {r₀ r₂ : + Set T} (h₀ : r₀ ∈ Γ.R) (h₂ : r₂ ∈ Γ.R) {p a : T} (hp : p ∈ r₀) (ha : a ∈ r₂) {t : ℕ} + (hfar : r₂ ∉ regLayer Γ r₀ t) : ∃ (C : Drawing T) (D : Set T), C.IsCircuit ∧ C.IsSubdrawing + (boundaryDrawing Γ (regLayer Γ r₀ t)) ∧ IsClosedDisc D ∧ discBd D = C.U ∧ p ∈ D ∧ a ∉ D := by + classical + have hlc : LocallyConnectedSpace T := IsClosedSurface.locallyConnectedSpace hS + have hZ := regLayer_subset h₀ t + have hr₀ : r₀ ∈ regLayer Γ r₀ t := regLayer_mono (Nat.zero_le t) rfl + set N := boundaryDrawing Γ (regLayer Γ r₀ t) with hN + have hNs : N.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hUoff : ∀ {r : Set T}, r ∈ Γ.R → ∀ y ∈ r, y ∉ Γ.U := fun {r} hr y hy h => by + obtain ⟨x, -, rfl⟩ := (mem_R_iff Γ).mp hr + exact (connectedComponentIn_subset _ _ hy).2 h + have hpU := hUoff h₀ p hp + have haU := hUoff h₂ a ha + have hUQ : N.U ⊆ ({p, a} : Set T)ᶜ := fun x hx h => by + rcases h with rfl | rfl + · exact hpU (hNs.U_subset hx) + · exact haU (hNs.U_subset hx) + have hdj : ∀ r ∈ regLayer Γ r₀ t, a ∉ closure r := fun r hr h => by + obtain ⟨y, hy1, hy2⟩ := mem_closure_iff.mp h _ (region_isOpen h₂) ha + have hne : r = r₂ := by + have := region_eq_of_mem_atom h₂ (.inr (hZ hr)) hy1 hy2 + exact this + exact hfar (hne ▸ hr) + have hnot : ¬ ∀ F, IsOArc F → F ⊆ N.U → ∃ Δ, IsClosedDisc Δ ∧ Δ ⊆ ({p, a} : Set T)ᶜ ∧ discBd Δ + = F := fun h => by + obtain ⟨r, hr, har, hpr⟩ := same_region_of_discs (Q := ({p, a} : Set T)ᶜ) (a := a) (b + := p) hS hsph (by simp) (by simp) _ N rfl hUQ h + refine GM14.Whitney.not_same_side hS hZ hr₀ hp (fun hmem => ?_) ⟨r, hr, har, hpr⟩ + obtain ⟨r', h1, h2⟩ := mem_iUnion₂.mp hmem + exact hdj r' h1 h2 + push Not at hnot + obtain ⟨F, hF, hFU, hno⟩ := hnot + obtain ⟨C, hC, hCs, hCU⟩ := exists_circuit_of_oArc hF hFU + obtain ⟨Δ₁, Δ₂, -, hΔ₁, hΔ₂, hb₁, hb₂, hcup, hcap, -, -⟩ := sphere_disc T hsph F hF + have hpF : p ∉ F := fun h => hUQ (hFU h) (.inl rfl) + have haF : a ∉ F := fun h => hUQ (hFU h) (.inr rfl) + have hhit : ∀ Δ, IsClosedDisc Δ → discBd Δ = F → p ∈ Δ ∨ a ∈ Δ := fun Δ h1 h2 => by + by_contra hn + push Not at hn + refine hno Δ h1 (fun x hx h3 => ?_) h2 + rcases h3 with rfl | rfl + · exact hn.1 hx + · exact hn.2 hx + have hcovp : p ∈ Δ₁ ∪ Δ₂ := hcup ▸ mem_univ p + have hcova : a ∈ Δ₁ ∪ Δ₂ := hcup ▸ mem_univ a + by_cases h1 : p ∈ Δ₁ + · refine ⟨C, Δ₁, hC, hCs, hΔ₁, hb₁.trans hCU.symm, h1, fun h2 => ?_⟩ + rcases hhit Δ₂ hΔ₂ hb₂ with h3 | h3 + · exact hpF (hcap ▸ ⟨h1, h3⟩) + · exact haF (hcap ▸ ⟨h2, h3⟩) + · have h2 : p ∈ Δ₂ := hcovp.resolve_left h1 + have h3 : a ∈ Δ₁ := (hhit Δ₁ hΔ₁ hb₁).resolve_left h1 + exact ⟨C, Δ₂, hC, hCs, hΔ₂, hb₂.trans hCU.symm, h2, fun h4 => haF (hcap ▸ ⟨h3, h4⟩)⟩ + +omit [ConnectedSpace T] in +/-- A point of the boundary of a far layer is off a near layer. -/ +theorem boundary_off_layer (hS : IsClosedSurface T) {Γ : Drawing T} {r₀ : Set T} + (h₀ : r₀ ∈ Γ.R) {t t' : ℕ} (htt : t < t') {x : T} (hx : x ∈ (boundaryDrawing Γ + (regLayer Γ r₀ t')).U) + (hxt : x ∈ ⋃ r ∈ regLayer Γ r₀ t, closure r) : False := by + obtain ⟨r, hr, hxr⟩ := mem_iUnion₂.mp hxt + have hsub : regLayer Γ r₀ (t + 1) ⊆ regLayer Γ r₀ t' := regLayer_mono htt + by_cases hv : x ∈ (boundaryDrawing Γ (regLayer Γ r₀ t')).V + · obtain ⟨-, r'', hr'', h1⟩ := (mem_boundaryDrawing_V hS).mp hv + exact not_incident_far hr hr''.1 (fun h => hr''.2 (hsub h)) h1.1 hxr h1.2.2 + · obtain ⟨e, he, hxe⟩ := (boundaryDrawing Γ (regLayer Γ r₀ t')).exists_edge_of_mem hx hv + obtain ⟨-, r'', hr'', h1⟩ := mem_boundaryDrawing_E.mp he + have hheE := h1.1 + obtain ⟨c, h2, h3, h4, h5, h6⟩ := exists_edge_param _ hheE + have hc : EdgeParam Γ e c := ⟨h2, h3, h4, h5, h6⟩ + have hvc : c 0 ∈ closure e := by + rw [hc.closure_eq] + exact mem_range_self 0 + have hA := closure_edge_subset hS hheE (regLayer_subset h₀ t hr) ⟨x, hxe, hxr⟩ hvc + have hB := closure_edge_subset hS hheE hr''.1 h1.2.2 hvc + exact not_incident_far hr hr''.1 (fun h => hr''.2 (hsub h)) h3 hA hB + +omit [ConnectedSpace T] in +theorem boundary_subset_layer (hS : IsClosedSurface T) {Γ : Drawing T} {r₀ : Set T} {t : ℕ} {x : T} + (hx : x ∈ (boundaryDrawing Γ (regLayer Γ r₀ t)).U) : + x ∈ ⋃ r ∈ regLayer Γ r₀ t, closure r := by + by_cases hv : x ∈ (boundaryDrawing Γ (regLayer Γ r₀ t)).V + · obtain ⟨⟨r, hr, h1⟩, -⟩ := (mem_boundaryDrawing_V hS).mp hv + exact mem_iUnion₂.mpr ⟨r, hr, h1.2.2⟩ + · obtain ⟨e, he, hxe⟩ := (boundaryDrawing Γ (regLayer Γ r₀ t)).exists_edge_of_mem hx hv + obtain ⟨⟨r, hr, h1⟩, -⟩ := mem_boundaryDrawing_E.mp he + exact mem_iUnion₂.mpr ⟨r, hr, closure_edge_subset hS h1.1 h1.2.1 h1.2.2 (subset_closure hxe)⟩ + +/-- **The nest of the layers.** If `r₂` is not in the first `s` layers, they give `s` disjoint +nested circuits. -/ +theorem exists_region_nest (hS : IsClosedSurface T) (hsph : IsSphere T) {Γ : Drawing T} {r₀ r₂ : + Set T} (h₀ : r₀ ∈ Γ.R) (h₂ : r₂ ∈ Γ.R) {p a : T} (hp : p ∈ r₀) (ha : a ∈ r₂) {s : ℕ} + (hfar : ∀ t < s, r₂ ∉ regLayer Γ r₀ t) : + ∃ (C : Fin s → Drawing T) (D : Fin s → Set T), (∀ t, (C t).IsCircuit ∧ (C t).IsSubdrawing Γ + ∧ IsClosedDisc (D t) ∧ discBd (D t) = (C t).U ∧ p ∈ D t ∧ a ∉ D t) ∧ + ∀ t t', t < t' → Disjoint (C t).V (C t').V ∧ D t ⊆ D t' := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hex : ∀ t : Fin s, ∃ (C : Drawing T) (D : Set T), C.IsCircuit ∧ C.IsSubdrawing + (boundaryDrawing Γ (regLayer Γ r₀ t)) ∧ IsClosedDisc D ∧ discBd D = C.U ∧ p ∈ D ∧ a ∉ D + := fun t => + exists_layer_circuit hS hsph h₀ h₂ hp ha (hfar t t.2) + choose C D hC hCs hD hb hpD haD using hex + refine ⟨C, D, fun t => ⟨hC t, (hCs t).trans (Drawing.span_isSubdrawing Γ _ _), hD t, hb t, + hpD t, haD t⟩, fun t t' htt => ?_⟩ + have hin : ∀ {x}, x ∈ (C t).U → x ∈ ⋃ r ∈ regLayer Γ r₀ t, closure r := fun {x} hx + => boundary_subset_layer hS ((hCs t).U_subset hx) + have hfr' : frontier (D t') = (C t').U := by + rw [IsClosedDisc.frontier_eq_discBd hS (hD t'), hb t'] + have hfr : frontier (D t) = (C t).U := by rw [IsClosedDisc.frontier_eq_discBd hS (hD t), hb t] + have hoff : ∀ {x}, x ∈ (C t').U → x ∈ ⋃ r ∈ regLayer Γ r₀ t, closure r → False := fun {x} hx h + => boundary_off_layer hS h₀ (Fin.lt_def.mp htt) ((hCs t').U_subset hx) h + refine ⟨disjoint_left.mpr fun x h1 h2 => hoff ((C t').V_subset_U h2) (hin + ((C t).V_subset_U h1)), ?_⟩ + have hL := isPreconnected_layer h₀ t + have hpL : p ∈ ⋃ r ∈ regLayer Γ r₀ t, closure r := mem_iUnion₂.mpr ⟨r₀, regLayer_mono + (Nat.zero_le _) rfl, subset_closure hp⟩ + have hdis : Disjoint (⋃ r ∈ regLayer Γ r₀ t, closure r) (frontier (D t')) := by + rw [hfr'] + exact disjoint_left.mpr fun x h1 h2 => hoff h2 h1 + have hint : (⋃ r ∈ regLayer Γ r₀ t, closure r) ⊆ interior (D t') := by + rcases inside_or_outside hL (hD t').isClosed hdis with h | h + · exact h + · exact absurd (hpD t') (h hpL) + obtain ⟨hE, hbE⟩ := GM12.isClosedDisc_closure_compl_of_sphere hS hsph (hD t') + have hcompl : discInt (closure (univ \ D t')) = (D t')ᶜ := by + ext x + have hfx : x ∈ discBd (D t') ↔ x ∈ closure (D t') ∩ closure (D t')ᶜ := by + rw [← IsClosedDisc.frontier_eq_discBd hS (hD t'), frontier_eq_closure_inter_closure] + rw [discInt, hbE, mem_sdiff, hfx, (hD t').isClosed.closure_eq, ← compl_eq_univ_sdiff] + constructor + · rintro ⟨h1, h2⟩ h3 + exact h2 ⟨h3, h1⟩ + · intro h + exact ⟨subset_closure h, fun h3 => h h3.1⟩ + have hX : IsPreconnected (D t')ᶜ := hcompl ▸ hE.isPreconnected_discInt + have hdis2 : Disjoint (D t')ᶜ (frontier (D t)) := by + rw [hfr] + exact disjoint_left.mpr fun x h1 h2 => h1 (interior_subset (hint (hin h2))) + rcases inside_or_outside hX (hD t).isClosed hdis2 with h | h + · exact absurd (interior_subset (h (haD t'))) (haD t) + · exact fun x hx => by + by_contra hn + exact h hn hx + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Reroute.lean b/LeanPool/GraphMinor/GM07/Reroute.lean new file mode 100644 index 0000000000..c3371553f4 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Reroute.lean @@ -0,0 +1,244 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.PushForest + +/-! +# Changing the edges of a forest one line at a time + +Here a forest `H` gets new edges. Each edge is replaced by a line with the same ends, and the new +line is homotopic to the old edge. We show that the result is a forest homotopic to `H` +(`exists_reroute`). + +Forests are flat, so it is enough to compare one pair of curves between two boundary vertices +(`forestsHomotopic_of_walks`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] + +/-- Two forests are homotopic if every walk of either one, between vertices that lie on `bd(Σ)`, is +joined to a walk of the other by homotopic curves. -/ +theorem forestsHomotopic_of_walks [T2Space S] {P H : Drawing S} (hP : IsSurfaceForest P) + (hH : IsSurfaceForest H) (hbd : P.V ∩ bd S = H.V ∩ bd S) + (hfromP : ∀ {a b : S}, GraphWalk P.toGraph a b → PushJoined P H a b) + (hfromH : ∀ {a b : S}, GraphWalk H.toGraph a b → PushJoined P H a b) : ForestsHomotopic P H + := by + classical + refine ⟨hP.1, hH.1, hP.2, hH.2, hbd, fun s _ t _ _ => ⟨⟨fun ⟨W, _⟩ => ?_, fun ⟨W, _⟩ => ?_⟩, + fun W₁ W₂ g c _ _ hg hc => ?_⟩⟩ + · obtain ⟨-, ⟨W'⟩, -⟩ := hfromP W + obtain ⟨W'', h, -⟩ := GraphWalk.exists_isSimple W' + exact ⟨W'', h⟩ + · obtain ⟨⟨W'⟩, -, -⟩ := hfromH W + obtain ⟨W'', h, -⟩ := GraphWalk.exists_isSimple W' + exact ⟨W'', h⟩ + · obtain ⟨-, -, κ, l, h1, h2, h3⟩ := hfromP W₁ + obtain ⟨g0, g1⟩ := hg.endpoints + obtain ⟨c0, c1⟩ := hc.endpoints + let pg : Path s t := ⟨g, g0, g1⟩ + let pc : Path s t := ⟨c, c0, c1⟩ + have hpg : pg.Homotopic κ := IsFlat.flat (isFlat_forest hP.2) pg κ (fun u + => hg.range_subset_U ⟨u, rfl⟩) h1 + have hpc : l.Homotopic pc := IsFlat.flat (isFlat_forest hH.2) l pc h2 fun u + => hc.range_subset_U ⟨u, rfl⟩ + exact curves_of_homotopic (hpg.trans (h3.trans hpc)) + +/-- A line is the closure of the line without its ends. -/ +theorem IsLineWithEnds.closure_sdiff [T2Space S] {L : Set S} {u v : S} + (h : IsLineWithEnds L u v) : closure (L \ {u, v}) = L := by + obtain ⟨f, rfl, rfl⟩ := id h + refine Subset.antisymm (closure_minimal sdiff_subset h.isCompact.isClosed) fun z hz => ?_ + have hd : closure (Ioo (0 : unitInterval) 1) = Icc 0 1 := closure_Ioo (by simp) + let g : unitInterval → S := fun t => (f t).1 + have hg : Continuous g := by fun_prop + have h1 : g (f.symm ⟨z, hz⟩) ∈ g '' closure (Ioo 0 1) := mem_image_of_mem g (by + rw [hd] + exact ⟨unitInterval.nonneg _, unitInterval.le_one _⟩) + have h2 := image_closure_subset_closure_image hg h1 + have h3 : g (f.symm ⟨z, hz⟩) = z := by simp [g] + rw [h3] at h2 + refine closure_mono ?_ h2 + rintro _ ⟨t, ht, rfl⟩ + refine ⟨(f t).2, ?_⟩ + rintro (he | he) + · exact ht.1.ne' (f.injective (Subtype.ext he)) + · exact ht.2.ne (f.injective (Subtype.ext (mem_singleton_iff.mp he))) + +theorem mem_left_of_line {L : Set S} {u v : S} (h : IsLineWithEnds L u v) : u ∈ L := by + obtain ⟨f, rfl, -⟩ := h + exact (f 0).2 + +theorem mem_right_of_line {L : Set S} {u v : S} (h : IsLineWithEnds L u v) : v ∈ L := by + obtain ⟨f, -, rfl⟩ := h + exact (f 1).2 + +/-- **Replacing the edges of a forest.** Let `M e` be a line with the same ends as the edge `e`, +homotopic to `e`. If these lines meet only at vertices, and meet `V(H)` and `bd(Σ)` only at the ends +of `e`, then they form a forest homotopic to `H`. -/ +theorem exists_reroute [T2Space S] {H : Drawing S} (hH : IsSurfaceForest H) (M : Set S → Set S) + (hline : ∀ e a b, H.toGraph.IsLink e a b → IsLineWithEnds (M e) a b) + (hV : ∀ e ∈ H.E, M e ∩ H.V ⊆ closure e) (hmeet : ∀ e ∈ H.E, ∀ f ∈ H.E, e ≠ f → M e ∩ M f ⊆ H.V) + (hbd : ∀ e ∈ H.E, M e ∩ bd S ⊆ H.V) + (hhom : ∀ e a b, H.toGraph.IsLink e a b → ∃ κ l : Path a b, (∀ u, κ u ∈ M e) ∧ + (∀ u, l u ∈ closure e) ∧ κ.Homotopic l) : + ∃ P : Drawing S, P.V = H.V ∧ P.U = H.V ∪ ⋃ e ∈ H.E, M e ∧ IsSurfaceForest P + ∧ ForestsHomotopic P H ∧ (∀ e' ∈ P.E, ∃ e ∈ H.E, closure e' = M e) + ∧ ∀ e ∈ H.E, ∃ e' ∈ P.E, closure e' = M e := by + classical + have hF := hH.2 + have hends : ∀ e : H.E, ∃ u v, u ≠ v ∧ closure e.1 ∩ H.V = {u, v} := fun e => by + obtain ⟨u, v, h1, h2, -⟩ := edge_line_of_forest hF e.2 + exact ⟨u, v, h1, h2⟩ + choose u v hne hcap using hends + have huV : ∀ e, u e ∈ closure e.1 ∩ H.V := fun e => by rw [hcap]; exact .inl rfl + have hvV : ∀ e, v e ∈ closure e.1 ∩ H.V := fun e => by rw [hcap]; exact .inr rfl + have hlink : ∀ e : H.E, H.toGraph.IsLink e.1 (u e) (v e) := fun e => ⟨e.2, (huV e).2, + (hvV e).2, hcap e⟩ + have hlines : ∀ e : H.E, IsLineWithEnds (M e.1) (u e) (v e) := fun e => hline _ _ _ (hlink e) + have : Finite H.E := H.finite_edges.to_subtype + obtain ⟨P, hPU, hPV, hPE⟩ := GM12.exists_drawing_of_finite_lines (ι := H.E) H.finite_V (E + := univ) (toFinite univ) (fun e => M e.1) u v (fun e _ => hlines e) (fun e _ => hne e) + (fun e _ => by + ext z + constructor + · rintro ⟨h1, h2⟩ + have : z ∈ closure e.1 ∩ H.V := ⟨hV e.1 e.2 ⟨h1, h2⟩, h2⟩ + rwa [hcap] at this + · rintro (rfl | h) + · exact ⟨mem_left_of_line (hlines e), (huV e).2⟩ + · obtain rfl : z = v e := h + exact ⟨mem_right_of_line (hlines e), (hvV e).2⟩) + fun e _ f _ hef => hmeet e.1 e.2 f.1 f.2 fun h => hef (Subtype.ext h) + have hPeq : ∀ e : H.E, closure (M e.1 \ {u e, v e}) = M e.1 := fun e + => IsLineWithEnds.closure_sdiff (hlines e) + have hPlink : ∀ e : H.E, P.toGraph.IsLink (M e.1 \ {u e, v e}) (u e) (v e) := fun e => by + refine ⟨by rw [hPE]; exact ⟨e, mem_univ _, rfl⟩, + by rw [hPV]; exact (huV e).2, by rw [hPV]; exact (hvV e).2, ?_⟩ + rw [hPeq, hPV] + ext z + constructor + · rintro ⟨h1, h2⟩ + have : z ∈ closure e.1 ∩ H.V := ⟨hV e.1 e.2 ⟨h1, h2⟩, h2⟩ + rwa [hcap] at this + · rintro (rfl | h) + · exact ⟨mem_left_of_line (hlines e), (huV e).2⟩ + · obtain rfl : z = v e := h + exact ⟨mem_right_of_line (hlines e), (hvV e).2⟩ + have hends' : ∀ {e : H.E} {x y : S}, closure e.1 ∩ H.V = {x, y} → (x = u e ∧ y = v e) ∨ (x = v e + ∧ y = u e) := fun {e x y} h => by + rw [hcap] at h + rcases pair_eq_pair_iff.mp h with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · exact .inl ⟨h1.symm, h2.symm⟩ + · exact .inr ⟨h2.symm, h1.symm⟩ + have hPtoH : ∀ {e' : Set S} {x y : S}, P.toGraph.IsLink e' x y → ∃ e : H.E, e' = M e.1 \ + (closure e.1 ∩ H.V) ∧ H.toGraph.IsLink e.1 x y := by + rintro e' x y ⟨he', hx, hy, hc⟩ + rw [hPE] at he' + obtain ⟨e, -, rfl⟩ := he' + refine ⟨e, by rw [hcap], ?_⟩ + have hc' := hc + simp only [] at hc' + rw [hPeq, hPV] at hc' + have h1 : M e.1 ∩ H.V = closure e.1 ∩ H.V := by + ext z + constructor + · exact fun h => ⟨hV e.1 e.2 h, h.2⟩ + · intro h + have h2 : z ∈ ({u e, v e} : Set S) := by rw [← hcap]; exact h + rcases h2 with rfl | h3 + · exact ⟨mem_left_of_line (hlines e), h.2⟩ + · obtain rfl : z = v e := h3 + exact ⟨mem_right_of_line (hlines e), h.2⟩ + refine ⟨e.2, ?_, ?_, ?_⟩ + · rw [hPV] at hx + exact hx + · rw [hPV] at hy + exact hy + · rw [← h1] + exact hc' + have hHtoP : ∀ {e : Set S} {x y : S}, H.toGraph.IsLink e x y → ∃ e' : Set S, P.toGraph.IsLink e' + x y ∧ closure e' = M e := by + rintro e x y hl + let i : H.E := ⟨e, hl.1⟩ + refine ⟨M e \ {u i, v i}, ?_, hPeq i⟩ + rcases hends' (e := i) hl.2.2.2 with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [h1, h2] + exact hPlink i + · rw [h1, h2] + exact (hPlink i).symm + have hPf : IsGraphForest P.toGraph := by + have hmap : ∀ {a b : S} (W : GraphWalk P.toGraph a b), ∃ W₀ : GraphWalk H.toGraph a b, W.edges + = W₀.edges.map fun e => M e \ (closure e ∩ H.V) := by + intro a b W + induction W with + | @nil w h => exact ⟨.nil (show w ∈ H.V from hPV ▸ h), rfl⟩ + | cons hl r ih => + obtain ⟨W₀, hW₀⟩ := ih + obtain ⟨e, rfl, h2⟩ := hPtoH hl + exact ⟨.cons h2 W₀, by simp [GraphWalk.edges, hW₀]⟩ + intro w W hW + obtain ⟨W₀, hW₀⟩ := hmap W + have hnd : W₀.edges.Nodup := by + have h1 := hW.2 + rw [hW₀] at h1 + exact List.Nodup.of_map _ h1 + have h0 := length_eq_zero_of_trail hF _ _ W₀ rfl hnd + have hlen : W₀.length = W.length := by + change W₀.edges.length = W.edges.length + rw [hW₀, List.length_map] + omega + have hPp : P.IsProper := by + rintro z ⟨hzb, hzU⟩ + rw [hPV] + rw [hPU] at hzU + rcases hzU with h | h + · exact h + · obtain ⟨e, -, h⟩ := mem_iUnion₂.mp h + exact hbd e.1 e.2 ⟨h, hzb⟩ + have hbdV : P.V ∩ bd S = H.V ∩ bd S := by rw [hPV] + have hPm : ∀ {x : S}, x ∈ H.V → x ∈ P.V := fun h => hPV ▸ h + have hstep : ∀ {e : Set S} {x y : S}, H.toGraph.IsLink e x y → PushJoined P H x y + := fun {e x y} hl => by + obtain ⟨e', hl', hc⟩ := hHtoP hl + obtain ⟨κ, l, h1, h2, h3⟩ := hhom e x y hl + refine ⟨⟨.cons hl' (.nil (hPm hl.2.2.1))⟩, ⟨.cons hl (.nil hl.2.2.1)⟩, κ, l, fun t => ?_, + fun t => H.closure_subset_U hl.1 (h2 t), h3⟩ + rw [hPU] + exact .inr (mem_iUnion₂.mpr ⟨⟨e, hl.1⟩, mem_univ _, h1 t⟩) + refine ⟨P, hPV, ?_, ⟨hPp, hPf⟩, forestsHomotopic_of_walks ⟨hPp, hPf⟩ hH hbdV ?_ ?_, ?_, ?_⟩ + · rw [hPU] + congr 1 + ext z + simp only [mem_iUnion, mem_univ, exists_prop, true_and, Subtype.exists] + · intro a b W + induction W with + | @nil w h => exact PushJoined.refl h (hPV ▸ h) + | cons hl r ih => + obtain ⟨e, -, h2⟩ := hPtoH hl + exact (hstep h2).trans ih + · intro a b W + induction W with + | @nil w h => exact PushJoined.refl (hPm h) h + | cons hl r ih => exact (hstep hl).trans ih + · intro e' he' + rw [hPE] at he' + obtain ⟨e, -, rfl⟩ := he' + exact ⟨e.1, e.2, hPeq e⟩ + · intro e he + let i : H.E := ⟨e, he⟩ + exact ⟨_, (hPlink i).1, hPeq i⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/RootedCut.lean b/LeanPool/GraphMinor/GM07/RootedCut.lean new file mode 100644 index 0000000000..54d746e589 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/RootedCut.lean @@ -0,0 +1,321 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.MultiCut +public import LeanPool.GraphMinor.GM07.CutFeasible +public import LeanPool.GraphMinor.GM07.SplitForest + +/-! +# From a forest to a minor + +The last line of step 2 of (9.1), page 243: "By (7.5), $\theta_r^{-1}(H')$ is +$\theta_r^{-1}(G_r)$-feasible. But that implies the conclusion of the theorem". Each component +of the forest in `G_r` is the image of a star of `H'` with centre at a vertex `v` of `H`, and its +image in `G` is the connected subgraph `φ(v)`. The edges +`e_i` give `φ(f_i)`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 + +universe u + +section Walks + +variable {α : Type*} {β : Type*} {G : Graph α β} + +theorem GraphWalk.exists_simple_suffix {u v x : α} (W : GraphWalk G u v) (hW : W.IsSimple) + (hx : x ∈ W.support) : ∃ W' : GraphWalk G x v, W'.IsSimple := by + induction W with + | nil _ => + simp only [GraphWalk.support, List.mem_singleton] at hx + subst hx + exact ⟨_, hW⟩ + | cons hl rest ih => + rcases List.mem_cons.mp hx with rfl | hx + · exact ⟨_, hW⟩ + · exact ih hW.of_cons hx + +theorem GraphWalk.exists_simple {u v : α} (W : GraphWalk G u v) : ∃ W' : GraphWalk G u v, + W'.IsSimple := by + induction W with + | nil hv => exact ⟨.nil hv, by simp [GraphWalk.IsSimple, GraphWalk.support]⟩ + | @cons a b c e hl rest ih => + obtain ⟨W', hW'⟩ := ih + by_cases ha : a ∈ W'.support + · exact GraphWalk.exists_simple_suffix W' hW' ha + · refine ⟨.cons hl W', ?_⟩ + simp only [GraphWalk.IsSimple, GraphWalk.support, List.nodup_cons] + exact ⟨ha, hW'⟩ + +end Walks + +section Component + +variable {X : Type*} [TopologicalSpace X] [T1Space X] + +/-- The component of a vertex. -/ +theorem exists_component (Γ : Drawing X) {r : X} (hr : r ∈ Γ.V) : + ∃ D : Drawing X, D.IsSubdrawing Γ ∧ D.IsConnected ∧ ∀ x, x ∈ D.V ↔ Nonempty + (GraphWalk Γ.toGraph r x) := by + classical + set R : Set X := {x | Nonempty (GraphWalk Γ.toGraph r x)} with hR + have hRV : R ⊆ Γ.V := by + rintro x ⟨W⟩ + have key : ∀ {a b : X}, GraphWalk Γ.toGraph a b → a ∈ Γ.V → b ∈ Γ.V := fun W => by + induction W with + | nil h => exact fun _ => h + | cons hl _ ih => exact fun _ => ih hl.2.2.1 + exact key W hr + have hstep : ∀ {a c : X} {e : Set X}, a ∈ R → Γ.toGraph.IsLink e a c → c ∈ R := fun ⟨W⟩ hl => + ⟨W.append (.cons hl (.nil hl.2.2.1))⟩ + set 𝓕 : Set (Set X) := {e | closure e ∩ Γ.V ⊆ R} with h𝓕 + set D := Γ.span R 𝓕 with hD + have hDV : D.V = R := by + change Γ.spanV R 𝓕 = R + rw [Drawing.spanV, inter_eq_left.mpr hRV] + exact union_eq_left.mpr (iUnion₂_subset fun e he => he.1) + have hDE : D.E = 𝓕 ∩ Γ.E := Γ.span_E _ _ + have hlift : ∀ {a b : X} (W : GraphWalk Γ.toGraph a b), a ∈ R → Nonempty + (GraphWalk D.toGraph a b) := fun W => by + induction W with + | nil h => + intro ha + exact ⟨.nil (show _ ∈ D.V by rw [hDV]; exact ha)⟩ + | @cons a c b e hl rest ih => + intro ha + have hc : c ∈ R := hstep ha hl + obtain ⟨W'⟩ := ih hc + have hsub : closure e ∩ Γ.V ⊆ R := by + rw [hl.2.2.2] + rintro x (rfl | rfl) + · exact ha + · exact hc + have hcap : closure e ∩ D.V = {a, c} := by + rw [hDV, ← hl.2.2.2] + apply Subset.antisymm + · exact fun x hx => ⟨hx.1, hRV hx.2⟩ + · exact fun x hx => ⟨hx.1, hsub hx⟩ + have heD : e ∈ D.E := by + rw [hDE] + exact ⟨hsub, hl.1⟩ + have haD : a ∈ D.V := by + rwa [hDV] + have hcD : c ∈ D.V := by + rwa [hDV] + exact ⟨.cons ⟨heD, haD, hcD, hcap⟩ W'⟩ + have hrR : r ∈ R := ⟨.nil hr⟩ + have hrD : r ∈ D.V := by rwa [hDV] + refine ⟨D, Γ.span_isSubdrawing _ _, ⟨⟨r, hrD⟩, fun u hu v hv => ?_⟩, fun x => by + rw [hDV] + rfl⟩ + rw [hDV] at hu hv + obtain ⟨Wu⟩ := hu + obtain ⟨Wv⟩ := hv + obtain ⟨Wu'⟩ := hlift Wu hrR + obtain ⟨Wv'⟩ := hlift Wv hrR + exact ⟨Wu'.reverse.append Wv'⟩ + +end Component + +section Matched + +variable {X Y : Type u} [TopologicalSpace X] [TopologicalSpace Y] [CompactSpace X] [T2Space X] + [T2Space Y] + +omit [T2Space X] in +/-- A pulled back drawing matches the drawing. -/ +theorem matched_pullDrawing (Γ : Drawing Y) {f : X → Y} (hf : Continuous f) (hs : Surjective f) + (hi : InjOn f (f ⁻¹' Γ.U)) : + IsMatched (pullDrawing Γ hf hs hi) Γ f ∅ := by + refine ⟨hf, hi, empty_subset _, fun _ _ => disjoint_empty _, ?_, ?_, ?_⟩ + · rw [sdiff_empty] + exact image_preimage_eq _ hs + · rw [sdiff_empty] + exact image_preimage_eq _ hs + · have h : (pullDrawing Γ hf hs hi).E = preimage f '' Γ.E := by + change arcComponentsIn (f ⁻¹' Γ.U \ f ⁻¹' Γ.V) = _ + rw [← preimage_sdiff] + exact arcComponentsIn_preimage hf hs Γ.isClosed_U hi sdiff_subset + rw [h, image_image] + have : (fun C => f '' (f ⁻¹' C)) = id := funext fun C => image_preimage_eq C hs + change Γ.E = (fun C => f '' (f ⁻¹' C)) '' Γ.E + rw [this, image_id] + +omit [CompactSpace X] [T2Space X] [T2Space Y] in +/-- A homeomorphism of the drawing above. -/ +theorem IsMatched.pre {Γ : Drawing X} {Γ' : Drawing Y} {f : X → Y} (m : IsMatched Γ Γ' f ∅) + (α : X ≃ₜ X) : + IsMatched (mapDrawingHomeo α Γ) Γ' (f ∘ α.symm) ∅ := by + have hU : (f ∘ α.symm) '' (mapDrawingHomeo α Γ).U = f '' Γ.U := by + change (f ∘ α.symm) '' (α '' Γ.U) = _ + rw [image_comp, ← image_comp α.symm, Homeomorph.symm_comp_self, image_id] + have hV : (f ∘ α.symm) '' (mapDrawingHomeo α Γ).V = f '' Γ.V := by + change (f ∘ α.symm) '' (α '' Γ.V) = _ + rw [image_comp, ← image_comp α.symm, Homeomorph.symm_comp_self, image_id] + refine ⟨m.cont.comp α.symm.continuous, ?_, empty_subset _, fun _ _ => disjoint_empty _, ?_, ?_, + ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩ he + simp only [comp_apply, Homeomorph.symm_apply_apply] at he + rw [m.inj hx hy he] + · rw [sdiff_empty, hU] + simpa using m.image_U + · rw [sdiff_empty, hV] + simpa using m.image_V + · rw [mapDrawingHomeo_E, m.image_E, image_image] + refine image_congr fun e _ => ?_ + rw [image_comp, ← image_comp α.symm, Homeomorph.symm_comp_self, image_id] + +omit [CompactSpace X] [T2Space X] [T2Space Y] in +/-- A homeomorphism of the drawing below. -/ +theorem IsMatched.post {Γ : Drawing X} {Γ' : Drawing Y} {f : X → Y} (m : IsMatched Γ Γ' f ∅) + (e : Y ≃ₜ Y) : + IsMatched Γ (mapDrawingHomeo e Γ') (e ∘ f) ∅ := by + refine ⟨e.continuous.comp m.cont, fun x hx y hy he => m.inj hx hy (e.injective he), + empty_subset _, fun _ _ => disjoint_empty _, ?_, ?_, ?_⟩ + · change _ = e '' Γ'.U + rw [← m.image_U, image_comp] + · change _ = e '' Γ'.V + rw [← m.image_V, image_comp] + · rw [mapDrawingHomeo_E, m.image_E, image_image] + exact image_congr fun z _ => (image_comp e f z).symm + +end Matched + +variable {S S_r : Type u} [TopologicalSpace S] [TopologicalSpace S_r] [T2Space S] [CompactSpace + S_r] [T2Space S_r] + +/-- The forest in `G_r` gives the minor. -/ +theorem isBoundaryRootedMinor_of_forest {Gd Hd : SurfaceDigraph S} (hVbd : Hd.G.V ∩ bd S + = Gd.G.V ∩ bd S) {𝓔 : Set (Set S)} {θ : S_r → S} {G_r : Drawing S_r} + (hmc : IsMultiCut Gd.G 𝓔 θ G_r) {H₃ : Drawing S} {O : S → S} {Mid H'' : Drawing S_r} {w : S_r + → S} (M : IsMatched Mid H₃ w ∅) + (hsub : H''.IsSubdrawing G_r) (hhom : ForestsHomotopic Mid H'') + (hwalkO : ∀ {x y : S}, GraphWalk H₃.toGraph x y → O x = O y) + (hsimple : ∀ x ∈ H₃.V, ∀ y ∈ H₃.V, O x = O y → x ≠ y → ∃ W : GraphWalk H₃.toGraph x y, + W.IsSimple) + {ρ : S → S_r} (hρ : ∀ v ∈ Hd.G.V, ρ v ∈ Mid.V ∩ bd S_r ∧ O (w (ρ v)) = v) + (hρb : ∀ v ∈ Hd.G.V ∩ bd S, θ (ρ v) = v) + {ε : Set S → Set S} (hε : ∀ f ∈ Hd.G.E, ε f ∈ 𝓔) (hεi : ∀ f ∈ Hd.G.E, ∀ f' ∈ Hd.G.E, f ≠ f' + → ε f ≠ ε f') + {zp zm : Set S → S_r} (hzp : ∀ f ∈ Hd.G.E, zp f ∈ Mid.V ∩ bd S_r ∧ θ (zp f) = Gd.plus (ε f) ∧ O + (w (zp f)) = Hd.plus f) + (hzm : ∀ f ∈ Hd.G.E, zm f ∈ Mid.V ∩ bd S_r ∧ θ (zm f) = Gd.minus (ε f) ∧ O (w (zm f)) + = Hd.minus f) [Nonempty S_r] : + IsBoundaryRootedMinor Hd Gd := by + classical + obtain ⟨ψ, hl, hr, hc⟩ := M.exists_inverse + obtain ⟨-, -, -, -, hbdeq, hpaths⟩ := hhom + have hH''V : ∀ s ∈ Mid.V ∩ bd S_r, s ∈ H''.V := fun s hs => (hbdeq ▸ hs : s ∈ H''.V ∩ bd S_r).1 + have hMid : Mid.V ⊆ Mid.V \ ∅ := fun x hx => ⟨hx, not_false⟩ + have hH₃ : ∀ s ∈ Mid.V, w s ∈ H₃.V := fun s hs => (M.carry.mem s (hMid hs)).2 + have key : ∀ s ∈ Mid.V ∩ bd S_r, ∀ t ∈ Mid.V ∩ bd S_r, (Nonempty (GraphWalk H''.toGraph s t) ↔ O + (w s) = O (w t)) := by + intro s hs t ht + by_cases hst : s = t + · subst hst + exact ⟨fun _ => rfl, fun _ => ⟨.nil (hH''V s hs)⟩⟩ + obtain ⟨hiff, -⟩ := hpaths s hs t ht hst + constructor + · rintro ⟨W⟩ + obtain ⟨R, hR⟩ := GraphWalk.exists_simple W + obtain ⟨P, -⟩ := hiff.mpr ⟨R, hR⟩ + obtain ⟨Q, -⟩ := M.carry.walk P (hMid hs.1) _ _ rfl rfl + exact hwalkO Q + · intro hO + have hne : w s ≠ w t := fun he => hst (M.inj (Mid.V_subset_U hs.1) (Mid.V_subset_U ht.1) he) + obtain ⟨W, hW⟩ := hsimple _ (hH₃ s hs.1) _ (hH₃ t ht.1) hO hne + obtain ⟨P, h1, -, h3, -⟩ := hc.walk W (M.carry.mem s (hMid hs.1)).2 s t (hl s + (Mid.V_subset_U hs.1)) (hl t (Mid.V_subset_U ht.1)) + have hP : P.IsSimple := by + rw [GraphWalk.IsSimple, h1] + exact hW.map_on fun z hz z' hz' he => + hc.inj (H₃.V_subset_U (hc.mem _ (h3 z hz)).1) (H₃.V_subset_U (hc.mem _ (h3 z' hz')).1) he + obtain ⟨R, -⟩ := hiff.mp ⟨P, hP⟩ + exact ⟨R⟩ + have hne : Nonempty (Drawing S_r) := ⟨G_r⟩ + have hcomp : ∀ v, v ∈ Hd.G.V → ∃ D : Drawing S_r, D.IsSubdrawing H'' ∧ D.IsConnected + ∧ ∀ x, x ∈ D.V ↔ Nonempty (GraphWalk H''.toGraph (ρ v) x) := fun v hv => + exists_component H'' (hH''V _ (hρ v hv).1) + choose! D hD1 hD2 hD3 using hcomp + have hVinj : ∀ a ∈ G_r.V, ∀ b ∈ G_r.V, θ a = θ b → a = b := fun a ha b _ he => by + refine (hmc.inj a b he).resolve_right ?_ + rintro ⟨e, he', hae⟩ + rw [hmc.preV] at ha + exact (hmc.sub he').2.1 hae |>.2 ha + have hUinj : InjOn θ G_r.U := fun a ha b _ he => by + refine (hmc.inj a b he).resolve_right ?_ + rw [hmc.preU] at ha + exact ha.2 + have hsubG : ∀ v ∈ Hd.G.V, (D v).IsSubdrawing G_r := fun v hv => ⟨(hD1 v hv).1.trans hsub.1, + (hD1 v hv).2.trans hsub.2⟩ + have hm : ∀ v ∈ Hd.G.V, IsMatched (D v) (cutImage Gd.G θ (D v)) θ ∅ := fun v hv => + matched_cutImage_of hmc.quot.continuous hUinj hmc.preV (fun f₁ hf₁ => (hmc.edges f₁ hf₁).1) + (hsubG v hv) + have hrep : ∀ v (hv : v ∈ Hd.G.V), ρ v ∈ (D v).V := fun v hv => (hD3 v hv _).mpr ⟨.nil (hH''V _ + (hρ v hv).1)⟩ + have hmemD : ∀ v (hv : v ∈ Hd.G.V) z, z ∈ Mid.V ∩ bd S_r → O (w z) = v → z ∈ (D v).V + := fun v hv z hz hO => + (hD3 v hv z).mpr ((key _ (hρ v hv).1 z hz).mpr (by rw [(hρ v hv).2, hO])) + refine ⟨hVbd, fun v => cutImage Gd.G θ (D v), ε, fun v hv => ⟨Gd.G.span_isSubdrawing _ _, ?_, + ?_⟩, fun f hf => hmc.sub (hε f hf), ?_, hεi, ?_, ?_, ?_⟩ + · rw [← (hm v hv).image_V, sdiff_empty] + exact ⟨θ (ρ v), ρ v, hrep v hv, rfl⟩ + · refine ⟨?_, ?_⟩ + · rw [← (hm v hv).image_V, sdiff_empty] + exact ⟨θ (ρ v), ρ v, hrep v hv, rfl⟩ + · intro a ha b hb + rw [← (hm v hv).image_V, sdiff_empty] at ha hb + obtain ⟨a', ha', rfl⟩ := ha + obtain ⟨b', hb', rfl⟩ := hb + obtain ⟨W⟩ := (hD2 v hv).2 a' ha' b' hb' + obtain ⟨W', -⟩ := (hm v hv).carry.walk W ⟨ha', not_false⟩ _ _ rfl rfl + exact ⟨W'⟩ + · intro v hv v' hv' hne' + rw [disjoint_left] + intro x hx hx' + rw [← (hm v hv).image_V, sdiff_empty] at hx + rw [← (hm v' hv').image_V, sdiff_empty] at hx' + obtain ⟨a, ha, rfl⟩ := hx + obtain ⟨b, hb, he⟩ := hx' + have hab : b = a := hVinj b (hsubG v' hv' |>.1 hb) a (hsubG v hv |>.1 ha) he + subst hab + obtain ⟨W₁⟩ := (hD3 v hv _).mp ha + obtain ⟨W₂⟩ := (hD3 v' hv' _).mp hb + have h1 := (key _ (hρ v hv).1 _ (hρ v' hv').1).mp ⟨W₁.append W₂.reverse⟩ + rw [(hρ v hv).2, (hρ v' hv').2] at h1 + exact hne' h1 + · intro v hv f hf hmem + have hmem' : ε f ∈ image θ '' (D v).E := by + have := (hm v hv).image_E + rw [← this] + exact hmem + obtain ⟨g, hg, hge⟩ := hmem' + have hgr := (hsubG v hv).2 hg + obtain ⟨-, h2, -⟩ := hmc.edges g hgr + have hef := hε f hf + obtain ⟨x, hx⟩ := (hmc.sub hef).2.2.1.nonempty + exact disjoint_left.mp h2 (hge.symm ▸ hx) ⟨_, hef, hx⟩ + · intro f hf + have hp := Hd.plus_mem f hf + have hmi := Hd.minus_mem f hf + constructor + · rw [← (hm _ hp).image_V, sdiff_empty, ← (hzp f hf).2.1] + exact ⟨_, hmemD _ hp _ (hzp f hf).1 (hzp f hf).2.2, rfl⟩ + · rw [← (hm _ hmi).image_V, sdiff_empty, ← (hzm f hf).2.1] + exact ⟨_, hmemD _ hmi _ (hzm f hf).1 (hzm f hf).2.2, rfl⟩ + · intro v hv + rw [← (hm v hv.1).image_V, sdiff_empty] + exact ⟨ρ v, hrep v hv.1, hρb v hv⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section11.lean b/LeanPool/GraphMinor/GM07/Section11.lean new file mode 100644 index 0000000000..7db4943d4f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section11.lean @@ -0,0 +1,837 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section11a +public import LeanPool.GraphMinor.GM07.Section11b +import LeanPool.GraphMinor.GM07.Section11c +public import LeanPool.GraphMinor.GM07.Section11d +import LeanPool.GraphMinor.GM07.Section11e +import LeanPool.GraphMinor.GM07.Section11g +import LeanPool.GraphMinor.Surface.ArcInPath +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.DiscsInSurface +import LeanPool.GraphMinor.Surface.Epstein +import LeanPool.GraphMinor.Surface.OpenDisc +import LeanPool.GraphMinor.Surface.SphereDisc +import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# Graph Minors VII, Section 11: Topological Appendix + +This file formalizes the topological results of Section 11 (Appendix, pages 249–254) of +N. Robertson and P. D. Seymour, *Graph Minors. VII. Disjoint paths on a surface*, +J. Combin. Theory Ser. B 45 (1988) 212–254: +- Relating `subBd Δ` and `discBd Δ` for a closed disc `Δ` in a surface `S` + (`subBd_subset_discBd`, `subBd_eq_discBd_of_disjoint_bd`, `subBd_eq_discBd_of_bd_eq_empty`). +- `theorem_11_1`: (11.1), every continuous path in a surface with distinct ends contains a + `[0, 1]`-arc with the same ends, deduced from `Surface.exists_arc_of_path`. +- Equivalence between arc-connectedness (`IsArcConnected`) and path-connectedness (`JoinedIn`, + `IsPathConnected`) in any Hausdorff space (`joinedIn_iff_eq_or_exists_isLineWithEnds`, + `isArcConnected_iff_joinedIn`). +- `theorem_11_2`: (11.2), every non-null-homotopic closed curve in a surface contains a + non-null-homotopic `O`-arc, together with its contrapositive + `isFlat_of_forall_isNullHomotopicOArc` + and the corollary `IsSimplyConnectedSubset.isFlat`. +- `theorem_11_3`: (11.3), pushing a closed curve out of `Δ \ bd(Δ)` into `Y` when `Y ∩ bd(Δ)` is + arc-connected, and deducing unconditionally from the first part via + `ClosedCurvesHomotopicIn.trans` + that if `Y` is flat then `Y ∪ (Δ \ bd(Δ))` is flat. +- `theorem_11_4`: (11.4), every connected and locally arc-connected subset of a surface is + arc-connected. +- `theorem_11_5`: (11.5), every flat locally arc-connected subset `Z ⊆ Σ` is contained in an open, + flat, locally arc-connected subset `Y ⊆ Σ` (arc-connected if `Z` is). +- `theorem_11_6`: (11.6), the union of two solid subsets of a surface is solid. +- `theorem_11_7`: (11.7), every solid flat subset `Z` of a connected surface is contained in a + solid, flat, arc-connected subset `Y` (including unconditional proof that a solid subset has + finitely many arc-components, `arcComponentsIn_finite_of_isSolid`). +- `theorem_11_8` and `theorem_11_8_closed`: (11.8), every open, flat, arc-connected subset `Z ⊆ Σ` + is contained in an open simply connected subset `Y ⊆ Σ`, proved via Zorn's lemma + (`exists_maximal_open_flat_arcConnected`), disc bounding (`EpsteinStatement`), and (11.3). +- `theorem_11_9` and `theorem_11_9_closed`: (11.9), deduced from (11.7), (11.5), and (11.8). +- `theorem_11_10_closed` and `theorem_11_10`: (11.10), deduced from (11.9), (4.2) + (`OpenDiscStatement`), and unconditional proofs that any closed subset of an open disc is planar + (`isPlanar_of_isClosed_subset_isOpenDisc`) and any proper closed subset of a sphere is planar + (`isPlanar_of_isSphere_ne_univ`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Function Topology Metric unitInterval OnePoint +open GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## Boundary of a Closed Disc: `subBd Δ` versus `discBd Δ` -/ + +/-- A surface with empty boundary is a closed surface (`IsClosedSurface`). -/ +theorem isClosedSurface_of_bd_eq_empty (hS : IsSurface S) (hbd : bd S = ∅) : + IsClosedSurface S := + ⟨hS.1, hS.2.1, fun x => not_not.mp (eq_empty_iff_forall_notMem.mp hbd x)⟩ + +/-- For any closed disc `Δ` in a surface `S`, the topological frontier `subBd Δ` is contained in the +manifold boundary `discBd Δ`. -/ +theorem subBd_subset_discBd (hS : IsSurface S) {Δ : Set S} (hΔ : IsClosedDisc Δ) : + subBd Δ ⊆ discBd Δ := by + have : T2Space S := hS.2.1 + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + obtain ⟨hunion, _⟩ := c.union_ball + have hopen : IsOpen (g '' ball 0 1) := c.isOpen_image_ball hS.2.2 + have hcl : closure Δ = Δ := hΔ.isCompact.isClosed.closure_eq + rintro x ⟨hxcl, hxcompl⟩ + rw [hcl, ← hunion] at hxcl + rcases hxcl with hxball | hxbd + · exfalso + obtain ⟨y, hyball, hycompl⟩ := mem_closure_iff.mp hxcompl (g '' ball 0 1) hopen hxball + have hyΔ : y ∈ Δ := by + rw [← hunion] + exact Or.inl hyball + exact hycompl.2 hyΔ + · exact hxbd + +/-- In a surface `S`, if a closed disc `Δ` has `discBd Δ` disjoint from `bd S`, then its topological +frontier `subBd Δ` equals `discBd Δ`. -/ +theorem subBd_eq_discBd_of_disjoint_bd (hS : IsSurface S) {Δ : Set S} (hΔ : IsClosedDisc Δ) + (hdisj : Disjoint (discBd Δ) (bd S)) : + subBd Δ = discBd Δ := by + refine Subset.antisymm (subBd_subset_discBd hS hΔ) ?_ + rintro x hxbd + have hxΔ : x ∈ Δ := discBd_subset Δ hxbd + refine ⟨subset_closure hxΔ, ?_⟩ + by_contra hxnot + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + have hx_sph : h x ∈ sphere (0 : ℂ) 1 := by + rw [← c.bd] + exact mem_image_of_mem h hxbd + have hx_norm : ‖h x‖ = 1 := mem_sphere_zero_iff_norm.mp hx_sph + have hx_intS : IsInteriorPoint x := not_not.mp (hdisj.notMem_of_mem_left hxbd) + obtain ⟨W, hW, hxW, ⟨f⟩⟩ := hx_intS + have : Nonempty S := ⟨x⟩ + obtain ⟨b⟩ := exists_homeomorph_ball (0 : ℂ) one_pos + obtain ⟨a, a', h1, h2, h3, h4, h5, h6⟩ := exists_functions_of_homeomorph (b.trans f.symm) + let V : Set S := (closure (univ \ Δ))ᶜ + have hVopen : IsOpen V := isClosed_closure.isOpen_compl + have hxV : x ∈ V := hxnot + have hVsub : V ⊆ Δ := fun y hy => by + by_contra hyΔ + exact hy (subset_closure ⟨mem_univ y, hyΔ⟩) + let M : Set ℂ := ball (0 : ℂ) 1 ∩ a ⁻¹' (W ∩ V) + have hM : IsOpen M := h1.isOpen_inter_preimage isOpen_ball (hW.inter hVopen) + have hG : ContinuousOn (h ∘ a) M := + c.hc.comp (h1.mono inter_subset_left) fun z hz => hVsub hz.2.2 + have hGi : InjOn (h ∘ a) M := fun z hz w hw he => + h5.injOn hz.1 hw.1 (c.gh.injOn (hVsub hz.2.2) (hVsub hw.2.2) he) + have hopen : IsOpen ((h ∘ a) '' M) := isOpen_image_of_injOn hM hG hGi + have hmem : h x ∈ (h ∘ a) '' M := by + refine ⟨a' x, ⟨h4 hxW, ?_⟩, ?_⟩ + · change a (a' x) ∈ W ∩ V + rw [h6 hxW] + exact ⟨hxW, hxV⟩ + · change h (a (a' x)) = h x + rw [h6 hxW] + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hopen (h x) hmem + let z : ℂ := ((1 + ε / 2 : ℝ) : ℂ) * h x + have hz_ball : z ∈ ball (h x) ε := by + rw [mem_ball, dist_eq_norm] + have hsub : z - h x = ((ε / 2 : ℝ) : ℂ) * h x := by + simp only [z] + push_cast + ring + rw [hsub, norm_mul, hx_norm, mul_one, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (half_pos hε)] + exact half_lt_self hε + obtain ⟨v, hvM, hvz⟩ := hball hz_ball + have hz_cb : z ∈ closedBall (0 : ℂ) 1 := by + rw [← hvz] + exact c.hm (hVsub hvM.2.2) + have hz_le : ‖z‖ ≤ 1 := mem_closedBall_zero_iff.mp hz_cb + have hz_norm : ‖z‖ = 1 + ε / 2 := by + simp only [z, norm_mul, hx_norm, mul_one, Complex.norm_real, Real.norm_eq_abs] + exact abs_of_pos (by linarith) + linarith + +/-- In a surface `S` with `bd S = ∅`, `subBd Δ = discBd Δ` for every closed disc `Δ`. -/ +theorem subBd_eq_discBd_of_bd_eq_empty (hS : IsSurface S) (hbd : bd S = ∅) + {Δ : Set S} (hΔ : IsClosedDisc Δ) : + subBd Δ = discBd Δ := by + refine subBd_eq_discBd_of_disjoint_bd hS hΔ ?_ + rw [hbd] + exact disjoint_empty _ + +/-! ## (11.1): Arcs in Paths and Equivalence of Arc-Connectedness with Path-Connectedness -/ + +/-- Graph Minors VII, (11.1) (page 249): +"If $\Sigma$ is a surface and $\phi \colon [0, 1] \to \Sigma$ is continuous with $\phi(0) \ne +\phi(1)$, there is a $[0, 1]$-arc included in $|\phi|$ with ends $\phi(0), \phi(1)$." -/ +theorem theorem_11_1_proof (hS : IsSurface S) (φ : C(unitInterval, S)) (hne : φ 0 ≠ φ 1) : + ∃ L : Set S, L ⊆ range φ ∧ IsLineWithEnds L (φ 0) (φ 1) := by + have : T2Space S := hS.2.1 + obtain ⟨e, he_cont, he_inj, he0, he1, he_sub⟩ := exists_arc_of_path φ.continuous hne + have he_emb : IsEmbedding e := (he_cont.isClosedEmbedding he_inj).isEmbedding + exact ⟨range e, he_sub, he_emb.toHomeomorph, he0, he1⟩ + +/-- In a Hausdorff space, a nonempty subset is arc-connected if and only if it is path-connected. -/ +theorem isArcConnected_iff_isPathConnected [T2Space S] {Z : Set S} (hne : Z.Nonempty) : + IsArcConnected Z ↔ IsPathConnected Z := by + refine ⟨fun h => ?_, IsPathConnected.isArcConnected⟩ + obtain ⟨x₀, hx₀⟩ := hne + exact ⟨x₀, hx₀, fun {y} hy => isArcConnected_iff_joinedIn.mp h x₀ hx₀ y hy⟩ + +/-- In a Hausdorff space, every arc-connected subset is preconnected. -/ +theorem IsArcConnected.isPreconnected [T2Space S] {Z : Set S} (hZ : IsArcConnected Z) : + IsPreconnected Z := by + rcases Z.eq_empty_or_nonempty with rfl | hne + · exact isPreconnected_empty + · exact ((isArcConnected_iff_isPathConnected hne).mp hZ).isConnected.isPreconnected + +/-- In a Hausdorff space, `pathComponentIn Z a` is arc-connected for every `a`. -/ +theorem isArcConnected_pathComponentIn [T2Space S] (Z : Set S) (a : S) : + IsArcConnected (pathComponentIn Z a) := by + by_cases ha : a ∈ Z + · exact IsPathConnected.isArcConnected (isPathConnected_pathComponentIn ha) + · intro x hx + exact absurd (pathComponentIn_subset hx) fun _ => ha (by + obtain ⟨p, hp⟩ := hx + rw [← p.source] + exact hp 0) + +/-- In a Hausdorff space, every `O`-arc is arc-connected. -/ +theorem IsOArc.isArcConnected [T2Space S] {F : Set S} (hF : IsOArc F) : + IsArcConnected F := by + obtain ⟨φ⟩ := hF + have hIcc : IsPathConnected (Icc (0 : ℝ) (2 * Real.pi)) := + (convex_Icc (0 : ℝ) (2 * Real.pi)).isPathConnected ⟨0, left_mem_Icc.mpr (by positivity)⟩ + let g : ℝ → S := fun t => (φ (Circle.exp t)).1 + have hg : Continuous g := + continuous_subtype_val.comp (φ.continuous.comp Circle.exp.continuous) + have himg : g '' Icc 0 (2 * Real.pi) = F := by + ext x + constructor + · rintro ⟨t, _, rfl⟩ + exact (φ _).2 + · intro hxF + have h2pi : (0 : ℝ) < 2 * Real.pi := mul_pos two_pos Real.pi_pos + let z : Circle := φ.symm ⟨x, hxF⟩ + let t : ℝ := toIcoMod h2pi 0 (Complex.arg z) + have ht_mem : t ∈ Icc 0 (2 * Real.pi) := + ⟨(toIcoMod_mem_Ico h2pi 0 (Complex.arg z)).1, + by linarith [(toIcoMod_mem_Ico h2pi 0 (Complex.arg z)).2]⟩ + have hexp : Circle.exp t = z := by + have h1 : t = Complex.arg z - toIcoDiv h2pi 0 (Complex.arg z) • (2 * Real.pi) := rfl + have h2 : Circle.exp t = Circle.exp (Complex.arg z) := by + rw [h1, zsmul_eq_mul] + exact Circle.exp_eq_exp.mpr ⟨-toIcoDiv h2pi 0 (Complex.arg z), by push_cast; ring⟩ + exact h2.trans (Circle.exp_arg z) + refine ⟨t, ht_mem, ?_⟩ + change (φ (Circle.exp t)).1 = x + rw [hexp, φ.apply_symm_apply] + have hF_pc : IsPathConnected F := himg ▸ hIcc.image hg + exact IsPathConnected.isArcConnected hF_pc + +/-! ## (11.2) and (11.3): Non-Null-Homotopic `O`-Arcs and Disc-Interior Pushout -/ + +/-- Graph Minors VII, (11.2) (page 249): +"If $\Sigma$ is a surface, and $\phi \colon S^1 \to \Sigma$ is continuous and non-null-homotopic, +there is a non-null-homotopic $O$-arc included in $|\phi|$." -/ +theorem theorem_11_2_proof + (hS : IsSurface S) (φ : C(Circle, S)) + (hφ : ¬ ClosedCurveIsNullHomotopicIn univ φ) : + ∃ F : Set S, IsOArc F ∧ F ⊆ range φ ∧ ¬ IsNullHomotopicOArc F := + nonNullHomotopicOArc_in_curve hS φ hφ + +/-- "By (11.2), a simply connected set is flat." (Graph Minors VII, Section 11, page 253). -/ +theorem IsSimplyConnectedSubset.isFlat + (hS : IsSurface S) {Z : Set S} (hZ : IsSimplyConnectedSubset Z) : + IsFlat Z := by + refine isFlat_of_forall_isNullHomotopicOArc hS fun F hFZ hF => ?_ + obtain ⟨Δ, hΔ, hΔ_bd, _⟩ := hZ.2 F hF hFZ + have hFΔ : F ⊆ Δ := hΔ_bd ▸ discBd_subset Δ + exact isNullHomotopicOArcIn_of_subset_disc hF (subset_univ Δ) hΔ hFΔ + +/-- Transitivity of `ClosedCurvesHomotopicIn Z` for closed curves `φ₀, φ₁, φ₂ : C(Circle, S)`. -/ +theorem ClosedCurvesHomotopicIn.trans {Z : Set S} {φ₀ φ₁ φ₂ : C(Circle, S)} + (h₁ : ClosedCurvesHomotopicIn Z φ₀ φ₁) (h₂ : ClosedCurvesHomotopicIn Z φ₁ φ₂) : + ClosedCurvesHomotopicIn Z φ₀ φ₂ := + Surface.ClosedCurvesHomotopicIn.trans h₁ h₂ + +/-- Graph Minors VII, (11.3) (page 249): +"Let $\Sigma$ be a connected surface, let $\Delta \subseteq \Sigma$ be a closed disc, and let $Y +\subseteq \Sigma$ be such that $Y \cap bd(\Delta)$ is arc-connected. Then any continuous map $\phi +\colon S^1 \to Y \cup (\Delta - bd(\Delta))$ is homotopic to a map $\psi \colon S^1 \to Y$ with +$|\psi| \subseteq |\phi| \cup bd(\Delta)$. In particular, if $Y$ is flat then so is $Y \cup (\Delta +- bd(\Delta))$." -/ +theorem theorem_11_3_proof + (hS : IsSurface S) {Δ Y : Set S} (hΔ : IsClosedDisc Δ) + (hY_arc : IsArcConnected (Y ∩ discBd Δ)) : + (∀ φ : C(Circle, S), range φ ⊆ Y ∪ (Δ \ discBd Δ) → + ((∃ z : Circle, φ z ∉ Δ \ discBd Δ) ∨ (Y ∩ discBd Δ).Nonempty) → + ∃ ψ : C(Circle, S), range ψ ⊆ Y ∧ range ψ ⊆ range φ ∪ discBd Δ ∧ + ClosedCurvesHomotopicIn univ φ ψ) ∧ + (IsFlat Y → IsFlat (Y ∪ (Δ \ discBd Δ))) := + ⟨fun φ hφ hne => disc_interior_curve_homotopy hS hΔ hY_arc φ hφ hne, + fun hY_flat => isFlat_union_disc_diff_discBd hS hΔ hY_arc hY_flat⟩ + +/-! ## (11.4): Connected and Locally Arc-Connected Implies Arc-Connected -/ + +/-- Graph Minors VII, (11.4) (page 251): +"If $Z$ is connected and l.a.c. then $Z$ is arc-connected." -/ +theorem theorem_11_4_proof (hS : IsSurface S) {Z : Set S} + (hconn : IsConnected Z) (hlac : IsLocallyArcConnected Z) : + IsArcConnected Z := by + have : T2Space S := hS.2.1 + obtain ⟨z₀, hz₀⟩ := hconn.1 + set A : Set S := pathComponentIn Z z₀ + set B : Set S := Z \ A + have hA_sub : A ⊆ Z := pathComponentIn_subset + have hAB_union : Z ⊆ A ∪ B := fun x hx => by + by_cases hxA : x ∈ A + · exact Or.inl hxA + · exact Or.inr ⟨hx, hxA⟩ + have hz₀A : z₀ ∈ A := mem_pathComponentIn_self hz₀ + have hA_open_in_Z : ∀ x ∈ A, ∃ C : Set S, IsOpen C ∧ x ∈ C ∧ Z ∩ C ⊆ A := by + intro x hxA + obtain ⟨C, _, hxC, hC_open, hZC_arc⟩ := hlac x (hA_sub hxA) univ isOpen_univ (mem_univ x) + refine ⟨C, hC_open, hxC, fun y hy => ?_⟩ + have hj : JoinedIn (Z ∩ C) x y := + isArcConnected_iff_joinedIn.mp hZC_arc x ⟨hA_sub hxA, hxC⟩ y hy + exact JoinedIn.trans hxA (hj.mono inter_subset_left) + have hB_open_in_Z : ∀ x ∈ B, ∃ C : Set S, IsOpen C ∧ x ∈ C ∧ Z ∩ C ⊆ B := by + intro x hxB + obtain ⟨C, _, hxC, hC_open, hZC_arc⟩ := hlac x hxB.1 univ isOpen_univ (mem_univ x) + refine ⟨C, hC_open, hxC, fun y hy => ⟨hy.1, fun hyA => hxB.2 ?_⟩⟩ + have hj : JoinedIn (Z ∩ C) y x := + isArcConnected_iff_joinedIn.mp hZC_arc y hy x ⟨hxB.1, hxC⟩ + exact JoinedIn.trans hyA (hj.mono inter_subset_left) + set U_A : Set S := ⋃ (x : S) (hx : x ∈ A), (hA_open_in_Z x hx).choose + set U_B : Set S := ⋃ (x : S) (hx : x ∈ B), (hB_open_in_Z x hx).choose + have hUA_open : IsOpen U_A := + isOpen_iUnion fun x => isOpen_iUnion fun hx => (hA_open_in_Z x hx).choose_spec.1 + have hUB_open : IsOpen U_B := + isOpen_iUnion fun x => isOpen_iUnion fun hx => (hB_open_in_Z x hx).choose_spec.1 + have hA_sub_UA : A ⊆ U_A := fun x hx => + mem_iUnion₂.mpr ⟨x, hx, (hA_open_in_Z x hx).choose_spec.2.1⟩ + have hB_sub_UB : B ⊆ U_B := fun x hx => + mem_iUnion₂.mpr ⟨x, hx, (hB_open_in_Z x hx).choose_spec.2.1⟩ + have hZ_sub : Z ⊆ U_A ∪ U_B := fun x hx => + (hAB_union hx).imp (fun hxA => hA_sub_UA hxA) (fun hxB => hB_sub_UB hxB) + have hZ_UA_sub_A : Z ∩ U_A ⊆ A := by + rintro y ⟨hyZ, hyUA⟩ + obtain ⟨x, hx, hyC⟩ := mem_iUnion₂.mp hyUA + exact (hA_open_in_Z x hx).choose_spec.2.2 ⟨hyZ, hyC⟩ + have hZ_UB_sub_B : Z ∩ U_B ⊆ B := by + rintro y ⟨hyZ, hyUB⟩ + obtain ⟨x, hx, hyC⟩ := mem_iUnion₂.mp hyUB + exact (hB_open_in_Z x hx).choose_spec.2.2 ⟨hyZ, hyC⟩ + have hB_empty : B = ∅ := by + by_contra hB_ne + obtain ⟨b, hbB⟩ := nonempty_iff_ne_empty.mpr hB_ne + obtain ⟨w, hwZ, hwUA, hwUB⟩ := hconn.2 U_A U_B hUA_open hUB_open hZ_sub + ⟨z₀, hz₀, hA_sub_UA hz₀A⟩ ⟨b, hbB.1, hB_sub_UB hbB⟩ + exact (hZ_UB_sub_B ⟨hwZ, hwUB⟩).2 (hZ_UA_sub_A ⟨hwZ, hwUA⟩) + have hZA : Z = A := Subset.antisymm (fun x hx => (hAB_union hx).resolve_right + (by simp [hB_empty])) hA_sub + rw [hZA] + exact isArcConnected_pathComponentIn Z z₀ + +/-! ## (11.5): Open Flat Locally Arc-Connected Superset -/ + +/-- Graph Minors VII, (11.5) (page 251): +"If $Z \subseteq \Sigma$ is flat and l.a.c., there is an open, flat, l.a.c. set $Y \subseteq \Sigma$ +with $Z \subseteq Y$, which may be chosen arc-connected if $Z$ is arc-connected." -/ +theorem theorem_11_5_proof + (hS : IsSurface S) {Z : Set S} (hZ_flat : IsFlat Z) (hZ_lac : IsLocallyArcConnected Z) : + ∃ Y : Set S, Z ⊆ Y ∧ IsOpen Y ∧ IsFlat Y ∧ IsLocallyArcConnected Y ∧ + (IsArcConnected Z → IsArcConnected Y) := + flat_locallyArcConnected_open_superset hS hZ_flat hZ_lac + +/-! ## (11.6): Union of Solid Sets is Solid -/ + +/-- Graph Minors VII, (11.6) (page 252): +"If $Z_1, Z_2 \subseteq \Sigma$ are solid, so is $Z_1 \cup Z_2$." -/ +theorem theorem_11_6_proof (hS : IsSurface S) {Z₁ Z₂ : Set S} + (h₁ : IsSolid Z₁) (h₂ : IsSolid Z₂) : + IsSolid (Z₁ ∪ Z₂) := by + have : T2Space S := hS.2.1 + refine ⟨?_, h₁.2.union h₂.2⟩ + intro z hz A hA_open hzA + set X : Set S := pathComponentIn ((Z₁ ∪ Z₂) ∩ A) z + have hzX : z ∈ X := mem_pathComponentIn_self ⟨hz, hzA⟩ + have hX_sub : X ⊆ (Z₁ ∪ Z₂) ∩ A := pathComponentIn_subset + have hex₁ : ∀ x ∈ X, ∃ A₁ : Set S, A₁ ⊆ A ∧ x ∈ A₁ ∧ IsOpen A₁ ∧ Z₁ ∩ A₁ ⊆ X := by + intro x hxX + by_cases hx₁ : x ∈ Z₁ + · obtain ⟨A₁, hA₁_sub, hxA₁, hA₁_open, hZ₁A₁_arc⟩ := + h₁.1 x hx₁ A hA_open (hX_sub hxX).2 + refine ⟨A₁, hA₁_sub, hxA₁, hA₁_open, fun y hy => ?_⟩ + have hj : JoinedIn (Z₁ ∩ A₁) x y := + isArcConnected_iff_joinedIn.mp hZ₁A₁_arc x ⟨hx₁, hxA₁⟩ y hy + refine JoinedIn.trans hxX (hj.mono fun w hw => ⟨Or.inl hw.1, hA₁_sub hw.2⟩) + · refine ⟨A \ Z₁, sdiff_subset, ⟨(hX_sub hxX).2, hx₁⟩, hA_open.sdiff h₁.2, ?_⟩ + rintro y ⟨hy₁, _, hynot₁⟩ + exact absurd hy₁ hynot₁ + have hex₂ : ∀ x ∈ X, ∃ A₂ : Set S, A₂ ⊆ A ∧ x ∈ A₂ ∧ IsOpen A₂ ∧ Z₂ ∩ A₂ ⊆ X := by + intro x hxX + by_cases hx₂ : x ∈ Z₂ + · obtain ⟨A₂, hA₂_sub, hxA₂, hA₂_open, hZ₂A₂_arc⟩ := + h₂.1 x hx₂ A hA_open (hX_sub hxX).2 + refine ⟨A₂, hA₂_sub, hxA₂, hA₂_open, fun y hy => ?_⟩ + have hj : JoinedIn (Z₂ ∩ A₂) x y := + isArcConnected_iff_joinedIn.mp hZ₂A₂_arc x ⟨hx₂, hxA₂⟩ y hy + refine JoinedIn.trans hxX (hj.mono fun w hw => ⟨Or.inr hw.1, hA₂_sub hw.2⟩) + · refine ⟨A \ Z₂, sdiff_subset, ⟨(hX_sub hxX).2, hx₂⟩, hA_open.sdiff h₂.2, ?_⟩ + rintro y ⟨hy₂, _, hynot₂⟩ + exact absurd hy₂ hynot₂ + set A' : Set S := ⋃ (x : S) (hx : x ∈ X), (hex₁ x hx).choose ∩ (hex₂ x hx).choose + have hA'_sub : A' ⊆ A := + iUnion₂_subset fun x hx => inter_subset_left.trans (hex₁ x hx).choose_spec.1 + have hzA' : z ∈ A' := + mem_iUnion₂.mpr ⟨z, hzX, (hex₁ z hzX).choose_spec.2.1, (hex₂ z hzX).choose_spec.2.1⟩ + have hA'_open : IsOpen A' := + isOpen_iUnion fun x => isOpen_iUnion fun hx => + (hex₁ x hx).choose_spec.2.2.1.inter (hex₂ x hx).choose_spec.2.2.1 + have h_inter_eq : (Z₁ ∪ Z₂) ∩ A' = X := by + refine Subset.antisymm ?_ (fun x hx => ⟨(hX_sub hx).1, + mem_iUnion₂.mpr ⟨x, hx, (hex₁ x hx).choose_spec.2.1, (hex₂ x hx).choose_spec.2.1⟩⟩) + rintro y ⟨hyZ, hyA'⟩ + obtain ⟨x, hx, hy₁, hy₂⟩ := mem_iUnion₂.mp hyA' + rcases hyZ with hyZ₁ | hyZ₂ + · exact (hex₁ x hx).choose_spec.2.2.2 ⟨hyZ₁, hy₁⟩ + · exact (hex₂ x hx).choose_spec.2.2.2 ⟨hyZ₂, hy₂⟩ + refine ⟨A', hA'_sub, hzA', hA'_open, ?_⟩ + rw [h_inter_eq] + exact isArcConnected_pathComponentIn ((Z₁ ∪ Z₂) ∩ A) z + +/-! ## (11.7): Finiteness of Arc-Components of Solid Sets and Solid Flat Arc-Connected Superset -/ + +/-- If `arcComponentsIn Z` is finite and has `ncard ≤ 1`, then `Z` is arc-connected. -/ +theorem isArcConnected_of_arcComponentsIn_ncard_le_one [T2Space S] {Z : Set S} + (hfin : (arcComponentsIn Z).Finite) (hle : (arcComponentsIn Z).ncard ≤ 1) : + IsArcConnected Z := by + rw [isArcConnected_iff_joinedIn] + intro a ha b hb + have haC : pathComponentIn Z a ∈ arcComponentsIn Z := pathComponentIn_mem_arcComponentsIn ha + have hbC : pathComponentIn Z b ∈ arcComponentsIn Z := pathComponentIn_mem_arcComponentsIn hb + have heq : pathComponentIn Z a = pathComponentIn Z b := + (Set.ncard_le_one_iff hfin).mp hle haC hbC + have hb_mem : b ∈ pathComponentIn Z a := heq ▸ mem_pathComponentIn_self hb + exact hb_mem + +/-- Every singleton in a Hausdorff space is solid. -/ +theorem isSolid_singleton [T2Space S] (x : S) : IsSolid ({x} : Set S) := by + refine ⟨fun z hz A hA_open hzA => ⟨A, Subset.rfl, hzA, hA_open, ?_⟩, isClosed_singleton⟩ + intro a ha b hb hne + rw [mem_singleton_iff.mp ha.1, mem_singleton_iff.mp hb.1] at hne + exact absurd rfl hne + +/-- Every singleton is flat. -/ +theorem isFlat_singleton (x : S) : IsFlat ({x} : Set S) := by + intro φ hφ + refine ⟨x, mem_univ x, ⟨ContinuousMap.const (Circle × unitInterval) x, fun _ => mem_univ x, ?_, + ?_⟩⟩ + · intro z + exact (mem_singleton_iff.mp (hφ (mem_range_self z))).symm + · intro _ + rfl + +/-- Every singleton is arc-connected. -/ +theorem isArcConnected_singleton (x : S) : IsArcConnected ({x} : Set S) := by + intro a ha b hb hne + rw [mem_singleton_iff.mp ha, mem_singleton_iff.mp hb] at hne + exact absurd rfl hne + +/-- Graph Minors VII, (11.7) (page 253): +"If $Z \subseteq \Sigma$ is solid and flat, and $\Sigma$ is connected, there exists $Y \subseteq +\Sigma$ with $Z \subseteq Y$ such that $Y$ is solid, flat, and arc-connected." -/ +theorem theorem_11_7_proof + (hS : IsSurface S) [ConnectedSpace S] {Z : Set S} + (hZ_solid : IsSolid Z) (hZ_flat : IsFlat Z) : + ∃ Y : Set S, Z ⊆ Y ∧ IsSolid Y ∧ IsFlat Y ∧ IsArcConnected Y := by + have : T2Space S := hS.2.1 + suffices h_ind : ∀ n : ℕ, ∀ W : Set S, IsSolid W → IsFlat W → (arcComponentsIn W).ncard = n → + ∃ Y : Set S, W ⊆ Y ∧ IsSolid Y ∧ IsFlat Y ∧ IsArcConnected Y by + exact h_ind (arcComponentsIn Z).ncard Z hZ_solid hZ_flat rfl + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro W hW_solid hW_flat hn + by_cases hle : n ≤ 1 + · refine ⟨W, Subset.rfl, hW_solid, hW_flat, ?_⟩ + exact isArcConnected_of_arcComponentsIn_ncard_le_one + (arcComponentsIn_finite_of_isSolid hS hW_solid) (hn ▸ hle) + · have h2 : 2 ≤ (arcComponentsIn W).ncard := by omega + obtain ⟨T, a, b, _, _, hT_solid, hWT_flat, hWT_lt⟩ := + solid_bridge_arc hS hW_solid hW_flat h2 + have hWT_solid : IsSolid (W ∪ T) := theorem_11_6_proof hS hW_solid hT_solid + rw [hn] at hWT_lt + obtain ⟨Y, hWTY, hY_solid, hY_flat, hY_arc⟩ := + ih (arcComponentsIn (W ∪ T)).ncard hWT_lt (W ∪ T) hWT_solid hWT_flat rfl + exact ⟨Y, subset_union_left.trans hWTY, hY_solid, hY_flat, hY_arc⟩ + +/-! ## (11.8): Maximal Open Flat Arc-Connected Sets and Simply Connected Superset -/ + +/-- By Zorn's lemma and the compactness of `S¹`, every open, flat, arc-connected subset `Z ⊆ S` is +contained in a maximal open, flat, arc-connected subset `Y ⊆ S`. This formalizes the first half of +the proof of Graph Minors VII, (11.8) (page 253). -/ +theorem exists_maximal_open_flat_arcConnected {Z : Set S} + (hZ_open : IsOpen Z) (hZ_flat : IsFlat Z) (hZ_arc : IsArcConnected Z) : + ∃ Y : Set S, Maximal (fun W : Set S => Z ⊆ W ∧ IsOpen W ∧ IsFlat W ∧ IsArcConnected W) Y := by + let P : Set (Set S) := {W : Set S | Z ⊆ W ∧ IsOpen W ∧ IsFlat W ∧ IsArcConnected W} + have hZ_mem : Z ∈ P := ⟨Subset.rfl, hZ_open, hZ_flat, hZ_arc⟩ + obtain ⟨Y, _, hY_max⟩ := zorn_subset_nonempty P (fun c hcP hc_chain hc_ne => by + obtain ⟨W₀, hW₀⟩ := hc_ne + refine ⟨⋃₀ c, ⟨?_, ?_, ?_, ?_⟩, fun W hW => subset_sUnion_of_mem hW⟩ + · exact (hcP hW₀).1.trans (subset_sUnion_of_mem hW₀) + · exact isOpen_sUnion fun W hW => (hcP hW).2.1 + · intro φ hφ + have : Nonempty c := ⟨⟨W₀, hW₀⟩⟩ + have hdU : Directed (· ⊆ ·) (fun i : c => i.1) := by + intro i j + rcases hc_chain.total i.2 j.2 with hij | hji + · exact ⟨j, hij, Subset.rfl⟩ + · exact ⟨i, Subset.rfl, hji⟩ + have hcov : range φ ⊆ ⋃ i : c, i.1 := by + rwa [← sUnion_eq_iUnion] + obtain ⟨⟨W, hW⟩, hφW⟩ := (isCompact_range φ.continuous).elim_directed_cover + (fun i : c => i.1) (fun i => (hcP i.2).2.1) hcov hdU + exact (hcP hW).2.2.1 φ hφW + · intro a ha b hb hne + obtain ⟨W₁, hW₁, ha₁⟩ := mem_sUnion.mp ha + obtain ⟨W₂, hW₂, hb₂⟩ := mem_sUnion.mp hb + rcases hc_chain.total hW₁ hW₂ with h12 | h21 + · obtain ⟨L, hLW₂, hL⟩ := (hcP hW₂).2.2.2 a (h12 ha₁) b hb₂ hne + exact ⟨L, hLW₂.trans (subset_sUnion_of_mem hW₂), hL⟩ + · obtain ⟨L, hLW₁, hL⟩ := (hcP hW₁).2.2.2 a ha₁ b (h21 hb₂) hne + exact ⟨L, hLW₁.trans (subset_sUnion_of_mem hW₁), hL⟩) Z hZ_mem + exact ⟨Y, hY_max⟩ + +/-- If `Y ⊆ S` is open in a surface `S` and `Δ` is a closed disc with `discBd Δ ⊆ Y`, then `Y ∪ Δ` +is open in `S`. -/ +theorem isOpen_union_disc_of_discBd_subset (hS : IsSurface S) {Y Δ : Set S} + (hY : IsOpen Y) (hΔ : IsClosedDisc Δ) (hbd : discBd Δ ⊆ Y) : + IsOpen (Y ∪ Δ) := by + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + obtain ⟨hunion, _⟩ := c.union_ball + have hopen_ball : IsOpen (g '' ball 0 1) := c.isOpen_image_ball hS.2.2 + have heq : Y ∪ Δ = Y ∪ g '' ball 0 1 := by + ext x + rw [← hunion] + constructor + · rintro (hxY | hxball | hxbd) + · exact Or.inl hxY + · exact Or.inr hxball + · exact Or.inl (hbd hxbd) + · rintro (hxY | hxball) + · exact Or.inl hxY + · exact Or.inr (Or.inl hxball) + rw [heq] + exact hY.union hopen_ball + +/-- If `Y ⊆ S` is arc-connected in a surface `S` and `Δ` is a closed disc with `discBd Δ ⊆ Y`, then +`Y ∪ Δ` is arc-connected. -/ +theorem isArcConnected_union_closedDisc (hS : IsSurface S) {Y Δ : Set S} + (hY : IsArcConnected Y) (hΔ : IsClosedDisc Δ) (hbd : discBd Δ ⊆ Y) : + IsArcConnected (Y ∪ Δ) := by + have : T2Space S := hS.2.1 + obtain ⟨φ⟩ := hΔ.isOArc_discBd + let x₀ : S := (φ 1).1 + have hx₀_bd : x₀ ∈ discBd Δ := (φ 1).2 + have hx₀_Y : x₀ ∈ Y := hbd hx₀_bd + have hx₀_Δ : x₀ ∈ Δ := discBd_subset Δ hx₀_bd + have hY_pc : IsPathConnected Y := (isArcConnected_iff_isPathConnected ⟨x₀, hx₀_Y⟩).mp hY + have hΔ_pc : IsPathConnected Δ := hΔ.isPathConnected + exact IsPathConnected.isArcConnected (hY_pc.union hΔ_pc ⟨x₀, hx₀_Y, hx₀_Δ⟩) + +/-- Graph Minors VII, (11.8) (page 253): +"If $Z \subseteq \Sigma$ is open, flat, and arc-connected, there is an open, simply connected set $Y +\subseteq \Sigma$ with $Z \subseteq Y$." -/ +theorem theorem_11_8_proof + (hS : IsSurface S) {Z : Set S} + (hZ_open : IsOpen Z) (hZ_flat : IsFlat Z) (hZ_arc : IsArcConnected Z) : + ∃ Y : Set S, Z ⊆ Y ∧ IsOpen Y ∧ IsSimplyConnectedSubset Y := by + have : T2Space S := hS.2.1 + obtain ⟨Y, ⟨hZY, hY_open, hY_flat, hY_arc⟩, hY_max⟩ := + exists_maximal_open_flat_arcConnected hZ_open hZ_flat hZ_arc + refine ⟨Y, hZY, hY_open, hY_arc, fun F hF hFY => ?_⟩ + have hF_null_S : IsNullHomotopicOArc F := isNullHomotopicOArc_of_isFlat hY_flat hFY hF + obtain ⟨Δ, hΔ, hΔ_bd⟩ := nullHomotopicOArc_bounds_disc hS hF hF_null_S + have hbd_sub : discBd Δ ⊆ Y := hΔ_bd.symm ▸ hFY + have hY_inter_bd : Y ∩ discBd Δ = F := by + rw [inter_eq_self_of_subset_right hbd_sub, hΔ_bd] + have hY_bd_arc : IsArcConnected (Y ∩ discBd Δ) := by + rw [hY_inter_bd] + exact IsOArc.isArcConnected hF + have hYU_open : IsOpen (Y ∪ Δ) := isOpen_union_disc_of_discBd_subset hS hY_open hΔ hbd_sub + have hYU_arc : IsArcConnected (Y ∪ Δ) := isArcConnected_union_closedDisc hS hY_arc hΔ hbd_sub + have hYU_eq : Y ∪ (Δ \ discBd Δ) = Y ∪ Δ := by + ext x + constructor + · exact Or.imp_right fun h => h.1 + · rintro (hx | hx) + · exact Or.inl hx + · by_cases hxb : x ∈ discBd Δ + · exact Or.inl (hbd_sub hxb) + · exact Or.inr ⟨hx, hxb⟩ + have hYU_flat : IsFlat (Y ∪ Δ) := by + rw [← hYU_eq] + exact (theorem_11_3_proof hS hΔ hY_bd_arc).2 hY_flat + have hΔ_sub : Δ ⊆ Y := + subset_union_right.trans + (hY_max ⟨hZY.trans subset_union_left, hYU_open, hYU_flat, hYU_arc⟩ subset_union_left) + exact ⟨Δ, hΔ, hΔ_bd, hΔ_sub⟩ + +/-- Graph Minors VII, (11.8) specialized to closed surfaces. -/ +theorem theorem_11_8_closed + (hS : IsSurface S) (_hbd : bd S = ∅) {Z : Set S} + (hZ_open : IsOpen Z) (hZ_flat : IsFlat Z) (hZ_arc : IsArcConnected Z) : + ∃ Y : Set S, Z ⊆ Y ∧ IsOpen Y ∧ IsSimplyConnectedSubset Y := + theorem_11_8_proof hS hZ_open hZ_flat hZ_arc + +/-! ## (11.9): Open Simply Connected Superset -/ + +/-- Graph Minors VII, (11.9) (page 253): +"If $\Sigma$ is connected and $Z \subseteq \Sigma$ is flat and l.a.c., and either $Z$ is closed or +$Z$ is arc-connected, then there is an open simply connected subset $Y \subseteq \Sigma$ with $Z +\subseteq Y$." -/ +theorem theorem_11_9_proof + (hS : IsSurface S) [ConnectedSpace S] {Z : Set S} + (hZ_flat : IsFlat Z) (hZ_lac : IsLocallyArcConnected Z) + (hZ_cl_or_arc : IsClosed Z ∨ IsArcConnected Z) : + ∃ Y : Set S, Z ⊆ Y ∧ IsOpen Y ∧ IsSimplyConnectedSubset Y ∧ Y.Nonempty := by + have : T2Space S := hS.2.1 + have h1 : ∃ Z₁ : Set S, Z ⊆ Z₁ ∧ IsFlat Z₁ ∧ IsLocallyArcConnected Z₁ ∧ + IsArcConnected Z₁ ∧ Z₁.Nonempty := by + rcases Z.eq_empty_or_nonempty with rfl | hZ_ne + · obtain ⟨x₀⟩ := ( inferInstance : Nonempty S ) + exact ⟨{x₀}, empty_subset _, isFlat_singleton x₀, + (isSolid_singleton x₀).1, isArcConnected_singleton x₀, singleton_nonempty x₀⟩ + · rcases hZ_cl_or_arc with hZ_cl | hZ_arc + · obtain ⟨Z₁, hZZ₁, hZ₁_solid, hZ₁_flat, hZ₁_arc⟩ := + theorem_11_7_proof hS ⟨hZ_lac, hZ_cl⟩ hZ_flat + exact ⟨Z₁, hZZ₁, hZ₁_flat, hZ₁_solid.1, hZ₁_arc, hZ_ne.mono hZZ₁⟩ + · exact ⟨Z, Subset.rfl, hZ_flat, hZ_lac, hZ_arc, hZ_ne⟩ + obtain ⟨Z₁, hZZ₁, hZ₁_flat, hZ₁_lac, hZ₁_arc, hZ₁_ne⟩ := h1 + obtain ⟨Z₂, hZ₁Z₂, hZ₂_open, hZ₂_flat, _, hZ₂_arc_imp⟩ := + theorem_11_5_proof hS hZ₁_flat hZ₁_lac + have hZ₂_arc : IsArcConnected Z₂ := hZ₂_arc_imp hZ₁_arc + obtain ⟨Y, hZ₂Y, hY_open, hY_sc⟩ := + theorem_11_8_proof hS hZ₂_open hZ₂_flat hZ₂_arc + exact ⟨Y, hZZ₁.trans (hZ₁Z₂.trans hZ₂Y), hY_open, hY_sc, hZ₁_ne.mono (hZ₁Z₂.trans hZ₂Y)⟩ + +/-- In a surface `S` with `bd S = ∅`, `IsSimplyConnectedSubset Y` is equivalent to +`GM14.IsArcSimplyConnected Y`. -/ +theorem isArcSimplyConnected_iff_isSimplyConnectedSubset_of_bd_eq_empty + (hS : IsSurface S) (hbd : bd S = ∅) (Y : Set S) : + IsArcSimplyConnected Y ↔ IsSimplyConnectedSubset Y := by + refine and_congr_right fun _ => forall₂_congr fun F _ => forall_congr' fun _ => ?_ + refine exists_congr fun Δ => ?_ + constructor + · rintro ⟨hΔ, hsub, hΔY⟩ + rw [subBd_eq_discBd_of_bd_eq_empty hS hbd hΔ] at hsub + exact ⟨hΔ, hsub, hΔY⟩ + · rintro ⟨hΔ, hdisc, hΔY⟩ + rw [← subBd_eq_discBd_of_bd_eq_empty hS hbd hΔ] at hdisc + exact ⟨hΔ, hdisc, hΔY⟩ + +/-- Graph Minors VII, (11.9) for closed surfaces (`bd S = ∅`), stated with +`GM14.IsArcSimplyConnected`. -/ +theorem theorem_11_9_closed + (hS : IsSurface S) (hbd : bd S = ∅) [ConnectedSpace S] {Z : Set S} + (hZ_flat : IsFlat Z) (hZ_lac : IsLocallyArcConnected Z) + (hZ_cl_or_arc : IsClosed Z ∨ IsArcConnected Z) : + ∃ Y : Set S, Z ⊆ Y ∧ IsOpen Y ∧ IsArcSimplyConnected Y ∧ Y.Nonempty := by + obtain ⟨Y, hZY, hY_open, hY_sc, hY_ne⟩ := theorem_11_9_proof hS hZ_flat hZ_lac hZ_cl_or_arc + exact ⟨Y, hZY, hY_open, + (isArcSimplyConnected_iff_isSimplyConnectedSubset_of_bd_eq_empty hS hbd Y).mpr hY_sc, hY_ne⟩ + +/-! ## (11.10): Solid Flat Sets are Equal to `Σ` or Planar -/ + +/-- Every closed subset of an open disc in a surface is included in a closed disc (`IsPlanar`). This +formalizes the step "since any closed subset of an open disc is included in a closed disc" in the +proof of Graph Minors VII, (11.10) (page 253). -/ +theorem isPlanar_of_isClosed_subset_isOpenDisc (hS : IsSurface S) {Z Y : Set S} + (hZ : IsClosed Z) (hY : IsOpenDisc Y) (hZY : Z ⊆ Y) : + IsPlanar Z := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + obtain ⟨_, ⟨e⟩⟩ := hY + have hZ_compact : IsCompact Z := hZ.isCompact + let inc : Z → Y := fun z => ⟨z.1, hZY z.2⟩ + have hinc_cont : Continuous inc := Continuous.subtype_mk continuous_subtype_val _ + let g : Z → EuclideanPlane := fun z => (e.symm (inc z)).1 + have hg_cont : Continuous g := continuous_subtype_val.comp (e.symm.continuous.comp hinc_cont) + have hg_lt : ∀ z : Z, ‖g z‖ < 1 := fun z => + mem_ball_zero_iff.mp (e.symm (inc z)).2 + have hr_exists : ∃ r : ℝ, 0 < r ∧ r < 1 ∧ ∀ z : Z, ‖g z‖ ≤ r := by + rcases Z.eq_empty_or_nonempty with rfl | hZ_ne + · exact ⟨1 / 2, by norm_num, by norm_num, fun z => False.elim z.2⟩ + · have : Nonempty Z := hZ_ne.to_subtype + have : CompactSpace Z := isCompact_iff_compactSpace.mp hZ_compact + obtain ⟨z₀, _, hz₀_max⟩ := + isCompact_univ.exists_isMaxOn univ_nonempty (continuous_norm.comp hg_cont).continuousOn + have hlt : ‖g z₀‖ < 1 := hg_lt z₀ + have hnn : 0 ≤ ‖g z₀‖ := norm_nonneg _ + refine ⟨(‖g z₀‖ + 1) / 2, by linarith, by linarith, fun z => ?_⟩ + have hle : ‖g z‖ ≤ ‖g z₀‖ := hz₀_max (mem_univ z) + linarith + obtain ⟨r, hr0, hr1, hr_bound⟩ := hr_exists + have hmem_open : ∀ x : ClosedUnitDisc, r • x.1 ∈ OpenUnitDisc := fun x => by + rw [OpenUnitDisc, mem_ball_zero_iff, norm_smul, Real.norm_eq_abs, abs_of_pos hr0] + exact (mul_le_of_le_one_right hr0.le (mem_closedBall_zero_iff.mp x.2)).trans_lt hr1 + let scale : ClosedUnitDisc → OpenUnitDisc := fun x => ⟨r • x.1, hmem_open x⟩ + have hscale_cont : Continuous scale := by fun_prop + let φ : ClosedUnitDisc → S := fun x => (e (scale x)).1 + have hφ_cont : Continuous φ := + continuous_subtype_val.comp (e.continuous.comp hscale_cont) + have hφ_inj : Injective φ := by + intro x₁ x₂ h + have h1 := e.injective (Subtype.ext h) + have h2 : r • x₁.1 = r • x₂.1 := congrArg Subtype.val h1 + exact Subtype.ext (smul_right_injective EuclideanPlane hr0.ne' h2) + have : CompactSpace ClosedUnitDisc := isCompact_iff_compactSpace.mp (isCompact_closedBall 0 1) + have hφ_emb : IsEmbedding φ := (hφ_cont.isClosedEmbedding hφ_inj).isEmbedding + refine ⟨range φ, ⟨hφ_emb.toHomeomorph⟩, fun z hz => ?_⟩ + let u : EuclideanPlane := (1 / r) • g ⟨z, hz⟩ + have hu_mem : u ∈ ClosedUnitDisc := by + rw [ClosedUnitDisc, mem_closedBall_zero_iff, norm_smul, Real.norm_eq_abs, + abs_of_pos (one_div_pos.mpr hr0), one_div_mul_eq_div, div_le_one hr0] + exact hr_bound ⟨z, hz⟩ + refine ⟨⟨u, hu_mem⟩, ?_⟩ + change (e ⟨r • ((1 / r) • g ⟨z, hz⟩), _⟩).1 = z + have hsmul : r • ((1 / r) • g ⟨z, hz⟩) = g ⟨z, hz⟩ := by + rw [smul_smul, mul_one_div_cancel hr0.ne', one_smul] + have heq : (⟨r • ((1 / r) • g ⟨z, hz⟩), hmem_open ⟨u, hu_mem⟩⟩ : OpenUnitDisc) = + e.symm (inc ⟨z, hz⟩) := Subtype.ext hsmul + rw [heq, e.apply_symm_apply] + +/-- Every proper closed subset `Z ≠ univ` of a 2-sphere `S` is planar (`IsPlanar Z`). This +formalizes the step "then $\Sigma$ is a sphere, and the result follows" in the proof of +Graph Minors VII, (11.10) (page 253). -/ +theorem isPlanar_of_isSphere_ne_univ (hS_surf : IsSurface S) (hS : IsSphere S) + {Z : Set S} (hZ : IsClosed Z) (hne : Z ≠ univ) : + IsPlanar Z := by + have : T2Space S := hS_surf.2.1 + obtain ⟨p, hpZ⟩ : ∃ p : S, p ∉ Z := not_forall.mp fun h => hne (eq_univ_of_forall h) + obtain ⟨e⟩ := hS + obtain ⟨H, hH⟩ := exists_homeomorph_onePoint (e p) + let E : S ≃ₜ OnePoint EuclideanPlane := e.trans H + have hp_inf : E p = ∞ := hH + have hinf_notMem : (∞ : OnePoint EuclideanPlane) ∉ E '' Z := by + rintro ⟨q, hqZ, hqE⟩ + have : q = p := E.injective (hqE.trans hp_inf.symm) + exact hpZ (this ▸ hqZ) + have hEZ_closed : IsClosed (E '' Z) := E.isClosedMap Z hZ + have h0_mem : (0 : ℂ) ∈ rsph ⁻¹' (E '' Z)ᶜ := by + change rsph 0 ∉ E '' Z + rw [rsph_zero] + exact hinf_notMem + have hopen_pre : IsOpen (rsph ⁻¹' (E '' Z)ᶜ) := + hEZ_closed.isOpen_compl.preimage continuous_rsph + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hopen_pre 0 h0_mem + let R : ℝ := 1 / ε + have hR : 0 < R := one_div_pos.mpr hε + let φ : ClosedUnitDisc → S := + fun x => E.symm (sph ((R : ℂ) * complexPlane.symm x.1)) + have hφ_cont : Continuous φ := + E.symm.continuous.comp (isOpenEmbedding_sph.continuous.comp + (continuous_const.mul (complexPlane.symm.continuous.comp continuous_subtype_val))) + have hφ_inj : Injective φ := by + intro x₁ x₂ h + have h1 := isOpenEmbedding_sph.injective (E.symm.injective h) + have hR0 : (R : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hR.ne' + have h2 := mul_left_cancel₀ hR0 h1 + exact Subtype.ext (complexPlane.symm.injective h2) + have : CompactSpace ClosedUnitDisc := isCompact_iff_compactSpace.mp (isCompact_closedBall 0 1) + have hφ_emb : IsEmbedding φ := (hφ_cont.isClosedEmbedding hφ_inj).isEmbedding + refine ⟨range φ, ⟨hφ_emb.toHomeomorph⟩, fun z hz => ?_⟩ + rcases eq_infty_or_sph (E z) with hinf | ⟨w, hw⟩ + · exact absurd (hinf ▸ mem_image_of_mem E hz) hinf_notMem + · have hw_le : ‖w‖ ≤ R := by + by_contra hw_gt + have hw_gt' : R < ‖w‖ := not_le.mp hw_gt + have hw0 : w ≠ 0 := norm_pos_iff.mp (hR.trans hw_gt') + have hwinv_ball : w⁻¹ ∈ ball (0 : ℂ) ε := by + rw [mem_ball_zero_iff, norm_inv] + exact inv_lt_of_inv_lt₀ hε (by simpa [R] using hw_gt') + have hnot : rsph w⁻¹ ∈ (E '' Z)ᶜ := hball hwinv_ball + rw [rsph_of_ne (inv_ne_zero hw0), inv_inv, ← hw] at hnot + exact hnot (mem_image_of_mem E hz) + let u : EuclideanPlane := complexPlane (w / (R : ℂ)) + have hu_mem : u ∈ ClosedUnitDisc := by + rw [ClosedUnitDisc, mem_closedBall_zero_iff, LinearIsometryEquiv.norm_map, norm_div, + Complex.norm_real, Real.norm_eq_abs, abs_of_pos hR, div_le_one hR] + exact hw_le + refine ⟨⟨u, hu_mem⟩, ?_⟩ + change E.symm (sph ((R : ℂ) * complexPlane.symm (complexPlane (w / (R : ℂ))))) = z + have hR0 : (R : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hR.ne' + rw [complexPlane.symm_apply_apply, mul_div_cancel₀ _ hR0, ← hw, E.symm_apply_apply] + +/-- Graph Minors VII, (11.10) for closed surfaces (`bd S = ∅`), deduced from (11.9) and (4.2) +(`Surface.open_disc`) with no additional hypotheses. -/ +theorem theorem_11_10_closed + (hS : IsSurface S) (hbd : bd S = ∅) [ConnectedSpace S] {Z : Set S} + (hZ_solid : IsSolid Z) (hZ_flat : IsFlat Z) : + Z = univ ∨ IsPlanar Z := by + by_cases hZ_univ : Z = univ + · exact Or.inl hZ_univ + · right + obtain ⟨Y, hZY, hY_open, hY_asc, hY_ne⟩ := + theorem_11_9_closed + hS hbd hZ_flat hZ_solid.1 (Or.inl hZ_solid.2) + have hY_sc : IsSimplyConnectedSubset Y := + (isArcSimplyConnected_iff_isSimplyConnectedSubset_of_bd_eq_empty hS hbd Y).mp hY_asc + have : T2Space S := hS.2.1 + have hY_conn : IsConnected Y := ⟨hY_ne, IsArcConnected.isPreconnected hY_sc.1⟩ + have hS_closed : IsClosedSurface S := isClosedSurface_of_bd_eq_empty hS hbd + rcases Surface.open_disc S Y hS_closed ‹ConnectedSpace S› hY_conn hY_open + (fun F hFY hF => by + obtain ⟨Δ, hΔ, hΔ_bd, hΔY⟩ := hY_sc.2 F hF hFY + exact ⟨Δ, hΔY, hΔ, hΔ_bd⟩) with ⟨hS_sph, _⟩ | hY_odisc + · exact isPlanar_of_isSphere_ne_univ hS hS_sph hZ_solid.2 hZ_univ + · exact isPlanar_of_isClosed_subset_isOpenDisc hS hZ_solid.2 hY_odisc hZY + +/-- Graph Minors VII, (11.10) (page 253): +"If $\Sigma$ is connected and $Z \subseteq \Sigma$ is solid and flat, then either $Z = \Sigma$ or +$Z$ is planar." -/ +theorem theorem_11_10_proof + (hS : IsSurface S) [ConnectedSpace S] {Z : Set S} + (hZ_solid : IsSolid Z) (hZ_flat : IsFlat Z) : + Z = univ ∨ IsPlanar Z := by + by_cases hbd : bd S = ∅ + · exact theorem_11_10_closed + hS hbd hZ_solid hZ_flat + · obtain ⟨Y, hZY, hY_open, hY_sc, _⟩ := + theorem_11_9_proof + hS hZ_flat hZ_solid.1 (Or.inl hZ_solid.2) + have : T2Space S := hS.2.1 + refine Or.inr (solidFlat_boundarySurface_planar_core hS hbd hZ_solid.2 hZY hY_open + (IsArcConnected.isPreconnected hY_sc.1) fun F hFY hF => ?_) + obtain ⟨Δ, hΔ, hΔ_bd, hΔY⟩ := hY_sc.2 F hF hFY + exact ⟨Δ, hΔY, hΔ, hΔ_bd⟩ + +/-- Graph Minors VII, (5.1) (page 230): +"If $\Sigma$ is connected and $X \subseteq \Sigma$ is solid and $X \ne \Sigma$, then $X$ is planar +if and only if every $O$-arc included in $X$ is null-homotopic." -/ +theorem theorem_5_1_proof + (hS : IsSurface S) [ConnectedSpace S] {X : Set S} + (hX_solid : IsSolid X) (hX_ne : X ≠ univ) : + IsPlanar X ↔ ∀ F : Set S, IsOArc F → F ⊆ X → IsNullHomotopicOArc F := by + constructor + · rintro ⟨Δ, hΔ, hXΔ⟩ F hF hFX + exact isNullHomotopicOArcIn_of_subset_disc hF (subset_univ Δ) hΔ (hFX.trans hXΔ) + · intro h + have hX_flat : IsFlat X := + isFlat_of_forall_isNullHomotopicOArc hS (fun F hFX hF => h F hF hFX) + exact (theorem_11_10_proof hS hX_solid hX_flat).resolve_left hX_ne + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section11a.lean b/LeanPool/GraphMinor/GM07/Section11a.lean new file mode 100644 index 0000000000..21947a0950 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section11a.lean @@ -0,0 +1,288 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM11.GlueDiscs +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.Surface.Epstein +import LeanPool.GraphMinor.Surface.PushOff + +/-! +# Disc bounding by capping cuffs for Graph Minors VII, Section 11 + +An `O`-arc in `Z` that is null-homotopic in `Z` bounds a closed disc in `Z`. The relative +lemma extends Robertson and Seymour's Graph Minors XI (7.2), page 93, to surfaces with +boundary. The case `Z = univ` gives the ambient disc-bounding result that Graph Minors VII, +Section 2, page 214, cites to H. I. Levine. + +The proof reduces to `Surface.EpsteinStatement` (which applies to `O`-arcs disjoint from the +surface boundary in a connected surface) by capping all cuffs of `S` via `Surface.exists_capAll` +to obtain a closed surface `T` (`bd T = ∅`), restricting to the clopen connected component of `T` +containing the image of `F`, applying `EpsteinStatement` there, and pulling the resulting closed +disc back along the closed embedding `j : S → T`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Function Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A clopen subset of a closed surface is a closed surface in the subspace topology. -/ +private theorem isClosedSurface_subtype_of_isClopen {T : Type u} [TopologicalSpace T] + (hT : IsClosedSurface T) {C : Set T} (hC : IsClopen C) : + IsClosedSurface C := by + have : CompactSpace T := hT.1 + have : T2Space T := hT.2.1 + refine ⟨isCompact_iff_compactSpace.mp hC.1.isCompact, inferInstance, fun x => ?_⟩ + obtain ⟨U, hU, hxU, ⟨e⟩⟩ := hT.2.2 x.1 + let W : Set OpenUnitDisc := (e.symm ⁻¹' {u : U | u.1 ∈ C}) + have hW_open : IsOpen W := + (hC.2.preimage continuous_subtype_val).preimage e.symm.continuous + let hxW : e ⟨x.1, hxU⟩ ∈ W := by + change (e.symm (e ⟨x.1, hxU⟩)).1 ∈ C + rw [e.symm_apply_apply] + exact x.2 + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp + (Metric.isOpen_ball.isOpenEmbedding_subtypeVal.isOpenMap _ hW_open) + (e ⟨x.1, hxU⟩).1 ⟨e ⟨x.1, hxU⟩, hxW, rfl⟩ + let c : ℂ := complexPlane.symm (e ⟨x.1, hxU⟩).1 + have hball_sub : Metric.ball c ε ⊆ complexPlane.symm '' (Subtype.val '' W) := by + intro z hz + have hz' : complexPlane z ∈ Metric.ball (e ⟨x.1, hxU⟩).1 ε := by + rw [Metric.mem_ball, dist_eq_norm] at hz ⊢ + have : complexPlane z - (e ⟨x.1, hxU⟩).1 = complexPlane (z - c) := by + simp [c, map_sub] + rw [this, LinearIsometryEquiv.norm_map] + exact hz + have h1 := mem_image_of_mem complexPlane.symm (hball hz') + rw [LinearIsometryEquiv.symm_apply_apply] at h1 + exact h1 + obtain ⟨b⟩ := exists_homeomorph_ball c hε + let B_disc : Set OpenUnitDisc := + {u : OpenUnitDisc | complexPlane.symm u.1 ∈ Metric.ball c ε} + have hB_sub_W : B_disc ⊆ W := by + intro u hu + obtain ⟨_, ⟨w, hwW, rfl⟩, hweq⟩ := hball_sub hu + have : u = w := Subtype.ext (complexPlane.symm.injective hweq.symm) + exact this ▸ hwW + let U' : Set C := {y : C | ∃ hy : y.1 ∈ U, e ⟨y.1, hy⟩ ∈ B_disc} + have hU'_eq : U' = Subtype.val ⁻¹' (Subtype.val '' (e ⁻¹' B_disc)) := by + ext y + constructor + · rintro ⟨hy, hB⟩ + exact ⟨⟨y.1, hy⟩, hB, rfl⟩ + · rintro ⟨⟨z, hzU⟩, hB, hzy⟩ + cases hzy + exact ⟨hzU, hB⟩ + have hB_open : IsOpen B_disc := + Metric.isOpen_ball.preimage (complexPlane.symm.continuous.comp continuous_subtype_val) + have hU'_open : IsOpen U' := by + rw [hU'_eq] + exact (hU.isOpenEmbedding_subtypeVal.isOpenMap _ (hB_open.preimage e.continuous)).preimage + continuous_subtype_val + have hxU' : x ∈ U' := ⟨hxU, by simp [B_disc, c, hε]⟩ + let toBall : U' → Metric.ball c ε := fun y => + ⟨complexPlane.symm (e ⟨y.1.1, y.2.choose⟩).1, y.2.choose_spec⟩ + let fromBall : Metric.ball c ε → U' := fun z => + have hz_in : complexPlane z.1 ∈ OpenUnitDisc := by + obtain ⟨_, ⟨w, _, rfl⟩, hweq⟩ := hball_sub z.2 + have : complexPlane z.1 = w.1 := by + rw [← hweq, complexPlane.apply_symm_apply] + exact this ▸ w.2 + let u : OpenUnitDisc := ⟨complexPlane z.1, hz_in⟩ + have huB : u ∈ B_disc := by + change complexPlane.symm (complexPlane z.1) ∈ Metric.ball c ε + rw [complexPlane.symm_apply_apply] + exact z.2 + have huW : u ∈ W := hB_sub_W huB + ⟨⟨(e.symm u).1, huW⟩, (e.symm u).2, by + change e (e.symm u) ∈ B_disc + rw [e.apply_symm_apply] + exact huB⟩ + have h_left : LeftInverse fromBall toBall := by + intro y + ext1 + ext1 + change (e.symm ⟨complexPlane (complexPlane.symm (e ⟨y.1.1, y.2.choose⟩).1), _⟩).1 = y.1.1 + simp only [complexPlane.apply_symm_apply, Subtype.coe_eta, e.symm_apply_apply] + have h_right : RightInverse fromBall toBall := by + intro z + ext1 + change complexPlane.symm (e (e.symm ⟨complexPlane z.1, _⟩)).1 = z.1 + simp only [e.apply_symm_apply, complexPlane.symm_apply_apply] + have h_to_cont : Continuous toBall := by + refine Continuous.subtype_mk ?_ _ + refine complexPlane.symm.continuous.comp (continuous_subtype_val.comp (e.continuous.comp ?_)) + exact Continuous.subtype_mk (continuous_subtype_val.comp continuous_subtype_val) _ + have h_from_cont : Continuous fromBall := by + refine Continuous.subtype_mk (Continuous.subtype_mk ?_ _) _ + refine continuous_subtype_val.comp (e.symm.continuous.comp ?_) + exact Continuous.subtype_mk (complexPlane.continuous.comp continuous_subtype_val) _ + let e' : U' ≃ₜ Metric.ball c ε := + { toFun := toBall + invFun := fromBall + left_inv := h_left + right_inv := h_right + continuous_toFun := h_to_cont + continuous_invFun := h_from_cont } + exact ⟨U', hU'_open, hxU', ⟨e'.trans b⟩⟩ + +/-- Every closed surface is a surface with empty boundary. -/ +private theorem isSurface_and_bd_empty_of_isClosedSurface {T : Type u} [TopologicalSpace T] + (hT : IsClosedSurface T) : IsSurface T ∧ bd T = ∅ := by + refine ⟨⟨hT.1, hT.2.1, fun x => (hT.2.2 x).isManifoldPoint⟩, ?_⟩ + rw [eq_empty_iff_forall_notMem] + intro x hx + exact hx (hT.2.2 x) + +/-- Relative disc bounding for an `O`-arc null-homotopic in `Z`. This extends Robertson and +Seymour's Graph Minors XI (7.2), page 93, to surfaces with boundary. The proof caps the cuffs of +`S` and applies the relative clause of `Surface.epstein`. -/ +theorem nullHomotopicOArcIn_bounds_disc + (hS : IsSurface S) {Z F : Set S} (_hF : IsOArc F) (hFZ : F ⊆ Z) + (hnull : IsNullHomotopicOArcIn Z F) : + ∃ Δ : Set S, Δ ⊆ Z ∧ IsClosedDisc Δ ∧ discBd Δ = F := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + obtain ⟨T, _, j, K, hT_closed, hj, _, _, _⟩ := exists_capAll S hS + have : T2Space T := hT_closed.2.1 + have : LocallyConnectedSpace T := IsClosedSurface.locallyConnectedSpace hT_closed + obtain ⟨φ, c, hcZ, ψ, hψZ, hψ0, hψ1⟩ := hnull + let x₀ : S := (φ 1).1 + let C : Set T := connectedComponent (j x₀) + have hC_clopen : IsClopen C := isClopen_connectedComponent + have hC_closedSurf : IsClosedSurface C := isClosedSurface_subtype_of_isClopen hT_closed hC_clopen + obtain ⟨hC_surf, hC_bd⟩ := isSurface_and_bd_empty_of_isClosedSurface hC_closedSurf + have hC_conn : ConnectedSpace C := + isConnected_iff_connectedSpace.mp ⟨⟨j x₀, mem_connectedComponent⟩, + isPreconnected_connectedComponent⟩ + have hψ_conn : IsPreconnected (range (j ∘ ψ)) := by + have : PreconnectedSpace (Circle × unitInterval) := inferInstance + exact isPreconnected_range (hj.continuous.comp ψ.continuous) + have hψ0_eq : ∀ w : Circle, ψ (w, 0) = (φ w).1 := hψ0 + have hψ1_eq : ∀ w : Circle, ψ (w, 1) = c := hψ1 + have hψ_sub_C : range (j ∘ ψ) ⊆ C := by + refine hψ_conn.subset_connectedComponent ⟨(1, 0), ?_⟩ + change j (ψ (1, 0)) = j x₀ + rw [hψ0_eq 1] + have hF_sub_C : j '' F ⊆ C := by + rintro _ ⟨y, hyF, rfl⟩ + obtain ⟨w, hw⟩ := φ.surjective ⟨y, hyF⟩ + have hw' : (φ w).1 = y := congrArg Subtype.val hw + rw [← hw', ← hψ0_eq w] + exact hψ_sub_C ⟨(w, 0), rfl⟩ + have hc_mem_C : j c ∈ C := by + rw [← hψ1_eq 1] + exact hψ_sub_C ⟨(1, 1), rfl⟩ + let Z_C : Set C := Subtype.val ⁻¹' (j '' Z) + let F_C : Set C := Subtype.val ⁻¹' (j '' F) + have hFC_sub_ZC : F_C ⊆ Z_C := preimage_mono (image_mono hFZ) + let toFC : F → F_C := fun y => ⟨⟨j y.1, hF_sub_C (mem_image_of_mem j y.2)⟩, mem_image_of_mem j + y.2⟩ + have htoFC_bij : Bijective toFC := by + constructor + · intro y₁ y₂ h + exact Subtype.ext (hj.injective (congrArg (fun u : F_C => u.1.1) h)) + · intro u + obtain ⟨y, hyF, hyu⟩ := u.2 + refine ⟨⟨y, hyF⟩, ?_⟩ + ext1 + ext1 + exact hyu + have htoFC_cont : Continuous toFC := + Continuous.subtype_mk (Continuous.subtype_mk (hj.continuous.comp continuous_subtype_val) _) _ + have : CompactSpace F := φ.compactSpace + let eFC : F ≃ₜ F_C := htoFC_cont.homeoOfEquivCompactToT2 (f := Equiv.ofBijective toFC htoFC_bij) + let φ_C : Circle ≃ₜ F_C := φ.trans eFC + have hFC_oarc : IsOArc F_C := ⟨φ_C⟩ + have hFC_null : IsNullHomotopicOArcIn Z_C F_C := by + refine ⟨φ_C, ⟨j c, hc_mem_C⟩, mem_image_of_mem j hcZ, + ⟨fun p => ⟨j (ψ p), hψ_sub_C ⟨p, rfl⟩⟩, + Continuous.subtype_mk (hj.continuous.comp ψ.continuous) _⟩, + fun p => mem_image_of_mem j (hψZ p), fun x => ?_, fun x => ?_⟩ + · apply Subtype.ext + change j (ψ (x, 0)) = j (φ x).1 + rw [hψ0_eq x] + · apply Subtype.ext + change j (ψ (x, 1)) = j c + rw [hψ1_eq x] + have hFC_disj : Disjoint F_C (bd C) := by + rw [hC_bd] + exact disjoint_empty F_C + obtain ⟨Δ_C, hΔC_sub, hΔC_disc, hΔC_bd⟩ := + (Surface.epstein C Z_C F_C hC_surf hC_conn hFC_oarc hFC_sub_ZC hFC_disj).1 hFC_null + have hΔC_in_range : Subtype.val '' Δ_C ⊆ j '' Z := + image_subset_iff.mpr hΔC_sub + let Δ : Set S := j ⁻¹' (Subtype.val '' Δ_C) + have hΔ_sub_Z : Δ ⊆ Z := by + intro x hx + obtain ⟨y, hyZ, hyx⟩ := hΔC_in_range hx + exact hj.injective hyx ▸ hyZ + have : Nonempty S := ⟨x₀⟩ + obtain ⟨j_inv, hj_inv_cont, hj_inv_left⟩ := + exists_inv_of_compactOn isCompact_univ hj.continuous.continuousOn hj.injective.injOn + rw [image_univ] at hj_inv_cont + have hsub_cont : ContinuousOn (j_inv ∘ (Subtype.val : C → T)) Δ_C := by + refine (hj_inv_cont.mono ?_).comp continuous_subtype_val.continuousOn (mapsTo_image _ _) + exact hΔC_in_range.trans (image_subset_range _ _) + have hsub_inj : InjOn (j_inv ∘ (Subtype.val : C → T)) Δ_C := by + intro u₁ hu₁ u₂ hu₂ heq + obtain ⟨x₁, _, hx₁⟩ := hΔC_in_range (mem_image_of_mem Subtype.val hu₁) + obtain ⟨x₂, _, hx₂⟩ := hΔC_in_range (mem_image_of_mem Subtype.val hu₂) + have h1 : j_inv u₁.1 = x₁ := by rw [← hx₁, hj_inv_left (mem_univ x₁)] + have h2 : j_inv u₂.1 = x₂ := by rw [← hx₂, hj_inv_left (mem_univ x₂)] + have h12 : x₁ = x₂ := h1.symm.trans (heq.trans h2) + exact Subtype.ext (hx₁.symm.trans (by rw [h12, hx₂])) + obtain ⟨hΔ_disc', hΔ_bd'⟩ := isClosedDisc_image hΔC_disc hsub_cont hsub_inj + have himg_eq : (j_inv ∘ (Subtype.val : C → T)) '' Δ_C = Δ := by + ext x + constructor + · rintro ⟨u, hu, rfl⟩ + obtain ⟨y, _, hy⟩ := hΔC_in_range (mem_image_of_mem Subtype.val hu) + have h1 : j_inv u.1 = y := by rw [← hy, hj_inv_left (mem_univ y)] + change j (j_inv u.1) ∈ Subtype.val '' Δ_C + rw [h1, hy] + exact ⟨u, hu, rfl⟩ + · intro hx + obtain ⟨u, hu, hux⟩ := hx + refine ⟨u, hu, ?_⟩ + change j_inv u.1 = x + rw [hux, hj_inv_left (mem_univ x)] + rw [himg_eq] at hΔ_disc' hΔ_bd' + refine ⟨Δ, hΔ_sub_Z, hΔ_disc', ?_⟩ + rw [hΔ_bd', hΔC_bd] + ext x + constructor + · rintro ⟨u, hu, rfl⟩ + obtain ⟨y, hyF, hyu⟩ := hu + have h1 : j_inv u.1 = y := by rw [← hyu, hj_inv_left (mem_univ y)] + change j_inv u.1 ∈ F + rw [h1] + exact hyF + · intro hxF + refine ⟨⟨j x, hF_sub_C (mem_image_of_mem j hxF)⟩, mem_image_of_mem j hxF, ?_⟩ + change j_inv (j x) = x + exact hj_inv_left (mem_univ x) + +/-- The ambient disc-bounding result cited to H. I. Levine in Graph Minors VII, Section 2, +page 214. This is the case `Z = univ` of `nullHomotopicOArcIn_bounds_disc`. -/ +theorem nullHomotopicOArc_bounds_disc + (hS : IsSurface S) {F : Set S} (hF : IsOArc F) (hnull : IsNullHomotopicOArc F) : + ∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F := by + obtain ⟨Δ, _, hΔ, hbd⟩ := + nullHomotopicOArcIn_bounds_disc hS hF (subset_univ F) hnull + exact ⟨Δ, hΔ, hbd⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section11b.lean b/LeanPool/GraphMinor/GM07/Section11b.lean new file mode 100644 index 0000000000..706e494290 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section11b.lean @@ -0,0 +1,1077 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.Surface.ArcInPath +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.DiscMerge +import Mathlib.Topology.Metrizable.Urysohn + +/-! +# Graph Minors VII, Section 11: Local Flatness, Concatenated Loops, and Proof of (11.5) + +This file proves: +1. Local flatness and contractibility of chart balls in a surface (`exists_chart_ball_subset`): + for every `x : S` and open `A ⊆ S` with `x ∈ A`, there is an open, arc-connected, flat + neighbourhood `W ⊆ A` of `x` in which any two paths with the same endpoints are homotopic in `W` + relative to their endpoints. +2. Periodic loop concatenation `concatLoop` (`Fin n → C(unitInterval, S) → C(Circle, S)`) and + homotopy of concatenated loops (`concatLoop_homotopic`). +3. Graph Minors VII, (11.5) (`flat_locallyArcConnected_open_superset`), following the metric `δ` and + `ε(z) / 3` open-cover proof on pages 251–252 of the paper. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Function Topology Metric unitInterval +open GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## Local Chart Balls in a Surface -/ + +/-- The closed right half-plane `halfPlane = {z : ℂ | 0 ≤ z.re}` is convex over `ℝ`. -/ +private theorem convex_halfPlane : Convex ℝ halfPlane := by + intro x hx y hy a b ha hb _ + change 0 ≤ (a • x + b • y).re + simp only [Complex.add_re, Complex.real_smul, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero] + have hx' : 0 ≤ x.re := hx + have hy' : 0 ≤ y.re := hy + positivity + +/-- In a Hausdorff space, two points `a, b ∈ Z` are joined by a path in `Z` (`JoinedIn Z a b`) if +and only if `a = b` or there is a `[0, 1]`-arc in `Z` with ends `a, b`. -/ +theorem joinedIn_iff_eq_or_exists_isLineWithEnds [T2Space S] {Z : Set S} {a b : S} + (ha : a ∈ Z) (hb : b ∈ Z) : + JoinedIn Z a b ↔ a = b ∨ ∃ L : Set S, L ⊆ Z ∧ IsLineWithEnds L a b := by + constructor + · intro h + rcases eq_or_ne a b with rfl | hne + · exact Or.inl rfl + · obtain ⟨γ, hγ⟩ := h + obtain ⟨e, he_cont, he_inj, he0, he1, he_sub⟩ := + exists_arc_of_path γ.continuous (by simpa [γ.source, γ.target] using hne) + have he_emb : IsEmbedding e := (he_cont.isClosedEmbedding he_inj).isEmbedding + refine Or.inr ⟨range e, ?_, he_emb.toHomeomorph, ?_, ?_⟩ + · intro x hx + obtain ⟨t, rfl⟩ := he_sub hx + exact hγ t + · exact he0.trans γ.source + · exact he1.trans γ.target + · rintro (rfl | ⟨L, hLZ, f, hf0, hf1⟩) + · exact JoinedIn.refl ha + · let p : Path a b := + { toContinuousMap := ⟨fun t => (f t).1, continuous_subtype_val.comp f.continuous⟩ + source' := hf0 + target' := hf1 } + exact ⟨p, fun t => hLZ (f t).2⟩ + +/-- In a Hausdorff space, `IsArcConnected Z` is equivalent to `∀ a ∈ Z, ∀ b ∈ Z, JoinedIn Z a b`. -/ +theorem isArcConnected_iff_joinedIn [T2Space S] {Z : Set S} : + IsArcConnected Z ↔ ∀ a ∈ Z, ∀ b ∈ Z, JoinedIn Z a b := by + constructor + · intro h a ha b hb + rw [joinedIn_iff_eq_or_exists_isLineWithEnds ha hb] + rcases eq_or_ne a b with rfl | hne + · exact Or.inl rfl + · exact Or.inr (h a ha b hb hne) + · intro h a ha b hb hne + have hj := (joinedIn_iff_eq_or_exists_isLineWithEnds ha hb).mp (h a ha b hb) + exact hj.resolve_left hne + +/-- In a Hausdorff space, a path-connected subset is arc-connected. -/ +theorem IsPathConnected.isArcConnected [T2Space S] {Z : Set S} (hZ : IsPathConnected Z) : + IsArcConnected Z := + isArcConnected_iff_joinedIn.mpr fun _ ha _ hb => hZ.joinedIn _ ha _ hb + +/-- In a Hausdorff space, if `Z` is arc-connected and `a, b ∈ Z`, there is a continuous path +`γ : C(unitInterval, S)` in `Z` from `a` to `b`. -/ +theorem exists_path_of_isArcConnected {Z : Set S} (hZ : IsArcConnected Z) + {a b : S} (ha : a ∈ Z) (hb : b ∈ Z) : + ∃ γ : C(unitInterval, S), range γ ⊆ Z ∧ γ 0 = a ∧ γ 1 = b := by + rcases eq_or_ne a b with rfl | hne + · refine ⟨ContinuousMap.const unitInterval a, ?_, rfl, rfl⟩ + rintro _ ⟨_, rfl⟩ + exact ha + · obtain ⟨L, hLZ, f, hf0, hf1⟩ := hZ a ha b hb hne + refine ⟨⟨fun t => (f t).1, continuous_subtype_val.comp f.continuous⟩, ?_, hf0, hf1⟩ + rintro _ ⟨t, rfl⟩ + exact hLZ (f t).2 + +/-- Two paths `γ₀, γ₁ : C(unitInterval, S)` are homotopic in `W` relative to `{0, 1}`. -/ +def PathsHomotopicRelIn (W : Set S) (γ₀ γ₁ : C(unitInterval, S)) : Prop := + ∃ H : C(unitInterval × unitInterval, S), + (∀ p, H p ∈ W) ∧ + (∀ t, H (t, 0) = γ₀ t) ∧ + (∀ t, H (t, 1) = γ₁ t) ∧ + (∀ s, H (0, s) = γ₀ 0) ∧ + (∀ s, H (1, s) = γ₀ 1) + +theorem PathsHomotopicRelIn.refl {W : Set S} {γ : C(unitInterval, S)} (hγ : range γ ⊆ W) : + PathsHomotopicRelIn W γ γ := + ⟨⟨fun p => γ p.1, γ.continuous.comp continuous_fst⟩, + fun p => hγ (mem_range_self p.1), fun _ => rfl, fun _ => rfl, fun _ => rfl, fun _ => rfl⟩ + +theorem PathsHomotopicRelIn.mono {W₁ W₂ : Set S} {γ₀ γ₁ : C(unitInterval, S)} + (hsub : W₁ ⊆ W₂) (h : PathsHomotopicRelIn W₁ γ₀ γ₁) : + PathsHomotopicRelIn W₂ γ₀ γ₁ := by + obtain ⟨H, hH, h0, h1, hs0, hs1⟩ := h + exact ⟨H, fun p => hsub (hH p), h0, h1, hs0, hs1⟩ + +/-- Every point `x` in an open subset `A` of a surface `S` has an open, arc-connected, flat +chart-ball neighbourhood `W ⊆ A` equipped with a pointwise path-interpolation operator +`pt : S → S → unitInterval → S`. -/ +theorem exists_chart_ball_interp (hS : IsSurface S) (x : S) {A : Set S} + (hA : IsOpen A) (hxA : x ∈ A) : + ∃ (W : Set S) (pt : S → S → unitInterval → S), + W ⊆ A ∧ x ∈ W ∧ IsOpen W ∧ IsArcConnected W ∧ IsFlat W ∧ + (∀ y₁ ∈ W, ∀ y₂ ∈ W, ∀ s, pt y₁ y₂ s ∈ W) ∧ + (∀ y₁ ∈ W, ∀ y₂ ∈ W, pt y₁ y₂ 0 = y₁) ∧ + (∀ y₁ ∈ W, ∀ y₂ ∈ W, pt y₁ y₂ 1 = y₂) ∧ + (∀ y ∈ W, ∀ s, pt y y s = y) ∧ + (∀ γ₀ γ₁ : C(unitInterval, S), range γ₀ ⊆ W → range γ₁ ⊆ W → + Continuous (fun p : unitInterval × unitInterval => pt (γ₀ p.1) (γ₁ p.1) p.2)) := by + have : T2Space S := hS.2.1 + obtain ⟨U, O, j, k, hU, hO, hxU, hj, hk, hjU, _, hkj, hjk⟩ := (hS.2.2 x).exists_chart + have hUA_open : IsOpen (U ∩ A) := hU.inter hA + obtain ⟨O₁, hO₁_open, hO₁_eq⟩ := continuousOn_iff'.mp hk (U ∩ A) hUA_open + have hjx_mem : j x ∈ O ∩ O₁ := by + refine ⟨(hjU hxU).1, ?_⟩ + have hmem : j x ∈ k ⁻¹' (U ∩ A) ∩ (O ∩ halfPlane) := by + refine ⟨?_, hjU hxU⟩ + change k (j x) ∈ U ∩ A + rw [hkj hxU] + exact ⟨hxU, hxA⟩ + rw [hO₁_eq] at hmem + exact hmem.1 + obtain ⟨r, hr, hball⟩ := Metric.isOpen_iff.mp (hO.inter hO₁_open) (j x) hjx_mem + let B : Set ℂ := ball (j x) r ∩ halfPlane + let W : Set S := (U ∩ A) ∩ j ⁻¹' ball (j x) r + have hB_sub : B ⊆ O ∩ halfPlane := fun z hz => ⟨(hball hz.1).1, hz.2⟩ + have hW_open : IsOpen W := + (hj.mono inter_subset_left).isOpen_inter_preimage hUA_open isOpen_ball + have hxW : x ∈ W := ⟨⟨hxU, hxA⟩, mem_ball_self hr⟩ + have hWA : W ⊆ A := fun _ hy => hy.1.2 + have hjW : MapsTo j W B := fun y hy => ⟨hy.2, (hjU hy.1.1).2⟩ + have hkB : MapsTo k B W := fun z hz => by + have hz_pre : z ∈ k ⁻¹' (U ∩ A) ∩ (O ∩ halfPlane) := by + rw [hO₁_eq] + exact ⟨(hball hz.1).2, (hball hz.1).1, hz.2⟩ + refine ⟨hz_pre.1, ?_⟩ + change j (k z) ∈ ball (j x) r + rw [hjk (hB_sub hz)] + exact hz.1 + have hkjW : LeftInvOn k j W := hkj.mono fun _ hy => hy.1.1 + have hB_conv : Convex ℝ B := (convex_ball (j x) r).inter convex_halfPlane + have hB_pc : IsPathConnected B := hB_conv.isPathConnected ⟨j x, hjW hxW⟩ + have hkB_cont : ContinuousOn k B := hk.mono hB_sub + have hjW_cont : ContinuousOn j W := hj.mono fun _ hy => hy.1.1 + have hW_eq : k '' B = W := by + ext y + constructor + · rintro ⟨z, hz, rfl⟩ + exact hkB hz + · intro hy + exact ⟨j y, hjW hy, hkjW hy⟩ + have hW_arc : IsArcConnected W := by + rw [← hW_eq] + exact IsPathConnected.isArcConnected (hB_pc.image' hkB_cont) + have hW_flat : IsFlat W := by + intro φ hφW + let L : Circle × unitInterval → ℂ := + fun p => (1 - (p.2 : ℝ)) • j (φ p.1) + (p.2 : ℝ) • j x + have hL_cont : Continuous L := by + have hjφ : Continuous (j ∘ φ) := + hjW_cont.comp_continuous φ.continuous fun z => hφW (mem_range_self z) + refine Continuous.add ?_ ?_ + · exact (continuous_const.sub (continuous_subtype_val.comp continuous_snd)).smul + (hjφ.comp continuous_fst) + · exact (continuous_subtype_val.comp continuous_snd).smul continuous_const + have hL_mem : ∀ p, L p ∈ B := fun p => + hB_conv (hjW (hφW (mem_range_self p.1))) (hjW hxW) + (sub_nonneg.mpr p.2.2.2) p.2.2.1 (sub_add_cancel 1 (p.2 : ℝ)) + have hΨ_cont : Continuous (k ∘ L) := hkB_cont.comp_continuous hL_cont hL_mem + refine ⟨x, mem_univ x, ⟨k ∘ L, hΨ_cont⟩, fun _ => mem_univ _, fun z => ?_, fun z => ?_⟩ + · change k ((1 - (0 : ℝ)) • j (φ z) + (0 : ℝ) • j x) = φ z + rw [sub_zero, one_smul, zero_smul, add_zero] + exact hkjW (hφW (mem_range_self z)) + · change k ((1 - (1 : ℝ)) • j (φ z) + (1 : ℝ) • j x) = x + rw [sub_self, zero_smul, one_smul, zero_add] + exact hkjW hxW + let pt : S → S → unitInterval → S := + fun y₁ y₂ s => k ((1 - (s : ℝ)) • j y₁ + (s : ℝ) • j y₂) + refine ⟨W, pt, hWA, hxW, hW_open, hW_arc, hW_flat, ?_, ?_, ?_, ?_, ?_⟩ + · intro y₁ hy₁ y₂ hy₂ s + exact hkB (hB_conv (hjW hy₁) (hjW hy₂) (sub_nonneg.mpr s.2.2) s.2.1 (sub_add_cancel 1 (s : ℝ))) + · intro y₁ hy₁ _ _ + change k ((1 - (0 : ℝ)) • j y₁ + (0 : ℝ) • j _) = y₁ + rw [sub_zero, one_smul, zero_smul, add_zero] + exact hkjW hy₁ + · intro _ _ y₂ hy₂ + change k ((1 - (1 : ℝ)) • j _ + (1 : ℝ) • j y₂) = y₂ + rw [sub_self, zero_smul, one_smul, zero_add] + exact hkjW hy₂ + · intro y hy s + change k ((1 - (s : ℝ)) • j y + (s : ℝ) • j y) = y + rw [← add_smul, sub_add_cancel, one_smul] + exact hkjW hy + · intro γ₀ γ₁ hγ₀ hγ₁ + let L : unitInterval × unitInterval → ℂ := + fun p => (1 - (p.2 : ℝ)) • j (γ₀ p.1) + (p.2 : ℝ) • j (γ₁ p.1) + have hjγ₀ : Continuous (j ∘ γ₀) := + hjW_cont.comp_continuous γ₀.continuous fun t => hγ₀ (mem_range_self t) + have hjγ₁ : Continuous (j ∘ γ₁) := + hjW_cont.comp_continuous γ₁.continuous fun t => hγ₁ (mem_range_self t) + have hL_cont : Continuous L := by + refine Continuous.add ?_ ?_ + · exact (continuous_const.sub (continuous_subtype_val.comp continuous_snd)).smul + (hjγ₀.comp continuous_fst) + · exact (continuous_subtype_val.comp continuous_snd).smul (hjγ₁.comp continuous_fst) + have hL_mem : ∀ p, L p ∈ B := fun p => + hB_conv (hjW (hγ₀ (mem_range_self p.1))) (hjW (hγ₁ (mem_range_self p.1))) + (sub_nonneg.mpr p.2.2.2) p.2.2.1 (sub_add_cancel 1 (p.2 : ℝ)) + exact hkB_cont.comp_continuous hL_cont hL_mem + +/-- Every point `x` in an open subset `A` of a surface `S` has an open, arc-connected, flat +chart-ball neighbourhood `W ⊆ A` in which any two paths with the same endpoints are homotopic rel +endpoints (`PathsHomotopicRelIn W`). -/ +theorem exists_chart_ball_subset (hS : IsSurface S) (x : S) {A : Set S} + (hA : IsOpen A) (hxA : x ∈ A) : + ∃ W : Set S, W ⊆ A ∧ x ∈ W ∧ IsOpen W ∧ IsArcConnected W ∧ IsFlat W ∧ + (∀ γ₀ γ₁ : C(unitInterval, S), range γ₀ ⊆ W → range γ₁ ⊆ W → + γ₀ 0 = γ₁ 0 → γ₀ 1 = γ₁ 1 → PathsHomotopicRelIn W γ₀ γ₁) := by + obtain ⟨W, pt, hWA, hxW, hWopen, hWarc, hWflat, hmem, hzero, hone, hconst, hcontinuous⟩ := + exists_chart_ball_interp hS x hA hxA + refine ⟨W, hWA, hxW, hWopen, hWarc, hWflat, ?_⟩ + intro γ₀ γ₁ hγ₀ hγ₁ h0 h1 + have hmem₀ (t : unitInterval) : γ₀ t ∈ W := hγ₀ (mem_range_self t) + have hmem₁ (t : unitInterval) : γ₁ t ∈ W := hγ₁ (mem_range_self t) + refine ⟨⟨_, hcontinuous γ₀ γ₁ hγ₀ hγ₁⟩, + fun p => hmem _ (hmem₀ p.1) _ (hmem₁ p.1) p.2, + fun t => hzero _ (hmem₀ t) _ (hmem₁ t), fun t => hone _ (hmem₀ t) _ (hmem₁ t), + ?_, ?_⟩ + · intro t + change pt (γ₀ 0) (γ₁ 0) t = γ₀ 0 + rw [← h0] + exact hconst _ (hmem₀ 0) t + · intro t + change pt (γ₀ 1) (γ₁ 1) t = γ₀ 1 + rw [← h1] + exact hconst _ (hmem₀ 1) t + +/-! ## Periodic Functions on `ℝ` and Concatenated Loops on `Circle` -/ + +/-- Cyclic successor on `Fin n` for `0 < n`. -/ +def finNext {n : ℕ} (hn : 0 < n) (i : Fin n) : Fin n := + ⟨(i.1 + 1) % n, Nat.mod_lt _ hn⟩ + +/-- Cyclic predecessor on `Fin n` for `0 < n`. -/ +def finPrev {n : ℕ} (hn : 0 < n) (i : Fin n) : Fin n := + ⟨(i.1 + (n - 1)) % n, Nat.mod_lt _ hn⟩ + +theorem finNext_finPrev {n : ℕ} (hn : 0 < n) (i : Fin n) : + finNext hn (finPrev hn i) = i := by + ext + simp only [finNext, finPrev] + rw [Nat.mod_add_mod, show i.1 + (n - 1) + 1 = i.1 + n by omega, + Nat.add_mod_right, Nat.mod_eq_of_lt i.2] + +theorem finPrev_finNext {n : ℕ} (hn : 0 < n) (i : Fin n) : + finPrev hn (finNext hn i) = i := by + ext + simp only [finNext, finPrev] + rw [Nat.mod_add_mod, show i.1 + 1 + (n - 1) = i.1 + n by omega, + Nat.add_mod_right, Nat.mod_eq_of_lt i.2] + +/-- Reduction of an integer `k : ℤ` modulo `n` (`0 < n`) as an element of `Fin n`. -/ +def intModFin {n : ℕ} (hn : 0 < n) (k : ℤ) : Fin n := + ⟨(k % (n : ℤ)).toNat, by + have hnZ : (0 : ℤ) < n := by exact_mod_cast hn + have hnn : 0 ≤ k % (n : ℤ) := Int.emod_nonneg k hnZ.ne' + have hlt : k % (n : ℤ) < n := Int.emod_lt_of_pos k hnZ + omega⟩ + +theorem intModFin_nat {n : ℕ} (hn : 0 < n) (i : Fin n) : + intModFin hn (i.1 : ℤ) = i := by + ext + simp only [intModFin] + have hi : (i.1 : ℤ) % (n : ℤ) = i.1 := Int.emod_eq_of_lt (by positivity) (by exact_mod_cast i.2) + rw [hi, Int.toNat_natCast] + +theorem intModFin_add_nat {n : ℕ} (hn : 0 < n) (k : ℤ) : + intModFin hn (k + (n : ℤ)) = intModFin hn k := by + ext + simp only [intModFin, Int.add_emod_right] + +theorem intModFin_add_one {n : ℕ} (hn : 0 < n) (k : ℤ) : + intModFin hn (k + 1) = finNext hn (intModFin hn k) := by + ext + simp only [intModFin, finNext] + have hnZ : (0 : ℤ) < n := by exact_mod_cast hn + have hnn : 0 ≤ k % (n : ℤ) := Int.emod_nonneg k hnZ.ne' + have hlt : k % (n : ℤ) < n := Int.emod_lt_of_pos k hnZ + have h1 : (k + 1) % (n : ℤ) = (k % (n : ℤ) + 1) % (n : ℤ) := by + rw [Int.add_emod (k % (n : ℤ)) 1, Int.emod_emod, ← Int.add_emod] + rw [h1] + by_cases hlast : k % (n : ℤ) + 1 = (n : ℤ) + · rw [hlast, Int.emod_self] + have h2 : (k % (n : ℤ)).toNat + 1 = n := by omega + rw [h2, Nat.mod_self] + rfl + · have hlt' : k % (n : ℤ) + 1 < (n : ℤ) := by omega + rw [Int.emod_eq_of_lt (by omega) hlt'] + have h2 : ((k % (n : ℤ)).toNat + 1) % n = (k % (n : ℤ)).toNat + 1 := + Nat.mod_eq_of_lt (by omega) + rw [h2] + omega + +/-- Fractional part of `x : ℝ` as an element of `unitInterval`. -/ +noncomputable def unitFract (x : ℝ) : unitInterval := + ⟨Int.fract x, Int.fract_nonneg x, (Int.fract_lt_one x).le⟩ + +theorem unitFract_intCast (k : ℤ) : unitFract (k : ℝ) = 0 := by + ext + exact Int.fract_intCast k + +/-- Given a family of parameterized paths `γ : Fin n → C(unitInterval × P, S)` with matching +endpoints, `chainFun hn γ : ℝ × P → S` chains them periodically along `ℝ`. -/ +noncomputable def chainFun {P : Type*} [TopologicalSpace P] {n : ℕ} (hn : 0 < n) + (γ : Fin n → C(unitInterval × P, S)) (p : ℝ × P) : S := + γ (intModFin hn ⌊p.1⌋) (unitFract p.1, p.2) + +theorem chainFun_add_nat {P : Type*} [TopologicalSpace P] {n : ℕ} (hn : 0 < n) + (γ : Fin n → C(unitInterval × P, S)) (x : ℝ) (p : P) : + chainFun hn γ (x + (n : ℝ), p) = chainFun hn γ (x, p) := by + dsimp [chainFun] + have hfl : ⌊x + (n : ℤ)⌋ = ⌊x⌋ + (n : ℤ) := Int.floor_add_intCast x n + have hfr : Int.fract (x + (n : ℤ)) = Int.fract x := Int.fract_add_intCast x n + have hcast : (x + (n : ℝ)) = x + ((n : ℤ) : ℝ) := by push_cast; rfl + rw [hcast, hfl, intModFin_add_nat] + congr 2 + ext + exact hfr + +theorem chainFun_int_add {P : Type*} [TopologicalSpace P] {n : ℕ} (hn : 0 < n) + (γ : Fin n → C(unitInterval × P, S)) + (hmatch : ∀ (i : Fin n) (p : P), γ i (1, p) = γ (finNext hn i) (0, p)) + (k : ℤ) (t : unitInterval) (p : P) : + chainFun hn γ ((k : ℝ) + (t : ℝ), p) = γ (intModFin hn k) (t, p) := by + by_cases ht1 : (t : ℝ) = 1 + · have ht_eq : t = 1 := Subtype.ext ht1 + have hsum : (k : ℝ) + (t : ℝ) = ((k + 1 : ℤ) : ℝ) := by + rw [ht1] + push_cast + ring + dsimp [chainFun] + rw [hsum, Int.floor_intCast, unitFract_intCast, intModFin_add_one hn k, ht_eq, hmatch] + · have ht_lt : (t : ℝ) < 1 := lt_of_le_of_ne t.2.2 ht1 + dsimp [chainFun] + have hfl : ⌊(k : ℝ) + (t : ℝ)⌋ = k := by + rw [add_comm, Int.floor_add_intCast, Int.floor_eq_zero_iff.mpr ⟨t.2.1, ht_lt⟩, zero_add] + have hfr : unitFract ((k : ℝ) + (t : ℝ)) = t := by + ext + change Int.fract ((k : ℝ) + (t : ℝ)) = (t : ℝ) + rw [Int.fract, hfl, add_sub_cancel_left] + rw [hfl, hfr] + +theorem continuous_chainFun {P : Type*} [TopologicalSpace P] {n : ℕ} (hn : 0 < n) + (γ : Fin n → C(unitInterval × P, S)) + (hmatch : ∀ (i : Fin n) (p : P), γ i (1, p) = γ (finNext hn i) (0, p)) : + Continuous (chainFun hn γ) := by + rw [continuous_iff_continuousAt] + rintro ⟨x₀, p₀⟩ + let k : ℤ := ⌊x₀⌋ + let f₁ : ℝ × P → S := fun q => + γ (intModFin hn (k - 1)) (projIcc 0 1 zero_le_one (q.1 - ((k : ℝ) - 1)), q.2) + let f₂ : ℝ × P → S := fun q => + γ (intModFin hn k) (projIcc 0 1 zero_le_one (q.1 - (k : ℝ)), q.2) + have hf₁ : Continuous f₁ := + (γ _).continuous.comp + ((continuous_projIcc.comp (continuous_fst.sub continuous_const)).prodMk continuous_snd) + have hf₂ : Continuous f₂ := + (γ _).continuous.comp + ((continuous_projIcc.comp (continuous_fst.sub continuous_const)).prodMk continuous_snd) + let g : ℝ × P → S := fun q => if q.1 ≤ (k : ℝ) then f₁ q else f₂ q + have hg : Continuous g := by + refine Continuous.if_le hf₁ hf₂ continuous_fst continuous_const ?_ + intro q hq + have h1 : projIcc 0 1 zero_le_one (q.1 - ((k : ℝ) - 1)) = 1 := by + rw [hq, sub_sub_cancel] + ext + simp + have h0 : projIcc 0 1 zero_le_one (q.1 - (k : ℝ)) = 0 := by + rw [hq, sub_self] + ext + simp + change γ (intModFin hn (k - 1)) (projIcc 0 1 zero_le_one (q.1 - ((k : ℝ) - 1)), q.2) = + γ (intModFin hn k) (projIcc 0 1 zero_le_one (q.1 - (k : ℝ)), q.2) + rw [h1, h0, hmatch, ← intModFin_add_one, sub_add_cancel] + refine hg.continuousAt.congr_of_eventuallyEq ?_ + have hmem : (x₀, p₀) ∈ Ioo ((k : ℝ) - 1) ((k : ℝ) + 1) ×ˢ (univ : Set P) := by + refine ⟨⟨?_, Int.lt_floor_add_one x₀⟩, mem_univ p₀⟩ + linarith [Int.floor_le x₀] + filter_upwards [(isOpen_Ioo.prod isOpen_univ).mem_nhds hmem] with q hq + rcases hq with ⟨⟨hq1, hq2⟩, _⟩ + dsimp [g] + split_ifs with hle + · let t : unitInterval := ⟨q.1 - ((k : ℝ) - 1), by linarith, by linarith⟩ + have hq_eq : q.1 = ((k - 1 : ℤ) : ℝ) + (t : ℝ) := by + simp only [t] + push_cast + ring + have hp_eq : projIcc 0 1 zero_le_one (q.1 - ((k : ℝ) - 1)) = t := + projIcc_of_mem zero_le_one t.2 + have hc := chainFun_int_add hn γ hmatch (k - 1) t q.2 + rw [← hq_eq] at hc + exact hc.trans (by dsimp [f₁]; rw [hp_eq]) + · have hlt : (k : ℝ) < q.1 := not_le.mp hle + let t : unitInterval := ⟨q.1 - (k : ℝ), by linarith, by linarith⟩ + have hq_eq : q.1 = (k : ℝ) + (t : ℝ) := by + simp only [t] + ring + have hp_eq : projIcc 0 1 zero_le_one (q.1 - (k : ℝ)) = t := + projIcc_of_mem zero_le_one t.2 + have hc := chainFun_int_add hn γ hmatch k t q.2 + rw [← hq_eq] at hc + exact hc.trans (by dsimp [f₂]; rw [hp_eq]) + +/-- Parameterized loop concatenation `C(Circle × P, S)` obtained from a cyclic chain of paths +`γ : Fin n → C(unitInterval × P, S)`. -/ +noncomputable def concatLoopParam {P : Type*} [TopologicalSpace P] {n : ℕ} (hn : 0 < n) + (γ : Fin n → C(unitInterval × P, S)) + (hmatch : ∀ (i : Fin n) (p : P), γ i (1, p) = γ (finNext hn i) (0, p)) : + C(Circle × P, S) := by + let F : ℝ × P → S := fun q => chainFun hn γ (q.1 * (n : ℝ) / (2 * Real.pi), q.2) + have hF_cont : Continuous F := + (continuous_chainFun hn γ hmatch).comp + (((continuous_fst.mul continuous_const).div_const (2 * Real.pi)).prodMk continuous_snd) + have hsurj : Function.Surjective Circle.exp := fun w => ⟨Complex.arg w, Circle.exp_arg w⟩ + let G : Circle × P → S := fun q => F (Function.surjInv hsurj q.1, q.2) + have hG_exp : ∀ (x : ℝ) (p : P), G (Circle.exp x, p) = F (x, p) := by + intro x p + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp (Function.surjInv_eq hsurj (Circle.exp x)) + dsimp [G, F] + have h1 : Function.surjInv hsurj (Circle.exp x) * (n : ℝ) / (2 * Real.pi) = + x * (n : ℝ) / (2 * Real.pi) + (m : ℝ) * (n : ℝ) := by + rw [hm] + have hpi : (2 * Real.pi : ℝ) ≠ 0 := by positivity + field_simp + rw [h1] + have hper : Function.Periodic (fun y => chainFun hn γ (y, p)) (n : ℝ) := + fun y => chainFun_add_nat hn γ y p + exact hper.int_mul m (x * (n : ℝ) / (2 * Real.pi)) + have hq : IsQuotientMap (Prod.map Circle.exp (@id P)) := + (isLocalHomeomorph_circleExp.isOpenMap.prodMap IsOpenMap.id).isQuotientMap + (Circle.exp.continuous.prodMap continuous_id) (hsurj.prodMap surjective_id) + have hG_cont : Continuous G := by + rw [hq.continuous_iff] + have : G ∘ Prod.map Circle.exp (@id P) = F := by + ext ⟨x, p⟩ + exact hG_exp x p + rw [this] + exact hF_cont + exact ⟨G, hG_cont⟩ + +theorem concatLoopParam_exp {P : Type*} [TopologicalSpace P] {n : ℕ} (hn : 0 < n) + (γ : Fin n → C(unitInterval × P, S)) + (hmatch : ∀ (i : Fin n) (p : P), γ i (1, p) = γ (finNext hn i) (0, p)) + (x : ℝ) (p : P) : + concatLoopParam hn γ hmatch (Circle.exp (2 * Real.pi * x / (n : ℝ)), p) = + chainFun hn γ (x, p) := by + have hsurj : Function.Surjective Circle.exp := fun w => ⟨Complex.arg w, Circle.exp_arg w⟩ + let t : ℝ := 2 * Real.pi * x / (n : ℝ) + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp (Function.surjInv_eq hsurj (Circle.exp t)) + change chainFun hn γ (Function.surjInv hsurj (Circle.exp t) * (n : ℝ) / (2 * Real.pi), p) = + chainFun hn γ (x, p) + have hpi : (2 * Real.pi : ℝ) ≠ 0 := by positivity + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' + have h1 : Function.surjInv hsurj (Circle.exp t) * (n : ℝ) / (2 * Real.pi) = + x + (m : ℝ) * (n : ℝ) := by + rw [hm] + dsimp [t] + field_simp + rw [h1] + have hper : Function.Periodic (fun y => chainFun hn γ (y, p)) (n : ℝ) := + fun y => chainFun_add_nat hn γ y p + exact hper.int_mul m x + +/-- Concatenated loop `concatLoop hn γ hmatch : C(Circle, S)` of `n` paths `γ : Fin n → +C(unitInterval, S)` +with cyclically matching endpoints `γ i 1 = γ (finNext hn i) 0`. -/ +noncomputable def concatLoop {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) : C(Circle, S) := + (concatLoopParam (P := Unit) hn (fun i => (γ i).comp ⟨Prod.fst, continuous_fst⟩) + (fun i _ => hmatch i)).comp ⟨fun z => (z, ()), continuous_id.prodMk continuous_const⟩ + +theorem concatLoop_exp_piece {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) (i : Fin n) (t : unitInterval) : + concatLoop hn γ hmatch (Circle.exp (2 * Real.pi * ((i.1 : ℝ) + (t : ℝ)) / (n : ℝ))) = + γ i t := by + dsimp [concatLoop] + have h := concatLoopParam_exp (P := Unit) hn (fun j => (γ j).comp ⟨Prod.fst, continuous_fst⟩) + (fun j _ => hmatch j) ((i.1 : ℝ) + (t : ℝ)) () + rw [h] + have h2 := chainFun_int_add (P := Unit) hn (fun j => (γ j).comp ⟨Prod.fst, continuous_fst⟩) + (fun j _ => hmatch j) (i.1 : ℤ) t () + simp only [Int.cast_natCast, intModFin_nat hn i] at h2 + exact h2 + +theorem range_concatLoop {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) : + range (concatLoop hn γ hmatch) = ⋃ i : Fin n, range (γ i) := by + ext y + constructor + · rintro ⟨w, rfl⟩ + have hn' : (0 : ℝ) < n := by exact_mod_cast hn + have h2pi : (0 : ℝ) < 2 * Real.pi := by positivity + let x : ℝ := toIcoMod h2pi 0 (Complex.arg w) * (n : ℝ) / (2 * Real.pi) + have hexp : Circle.exp (2 * Real.pi * x / (n : ℝ)) = w := by + have h1 : 2 * Real.pi * x / (n : ℝ) = toIcoMod h2pi 0 (Complex.arg w) := by + dsimp [x] + field_simp + rw [h1] + have h2 : toIcoMod h2pi 0 (Complex.arg w) = + Complex.arg w - toIcoDiv h2pi 0 (Complex.arg w) • (2 * Real.pi) := rfl + have h3 : Circle.exp (toIcoMod h2pi 0 (Complex.arg w)) = Circle.exp (Complex.arg w) := by + rw [h2, zsmul_eq_mul] + exact Circle.exp_eq_exp.mpr ⟨-toIcoDiv h2pi 0 (Complex.arg w), by push_cast; ring⟩ + exact h3.trans (Circle.exp_arg w) + rw [← hexp] + dsimp [concatLoop] + rw [concatLoopParam_exp] + dsimp [chainFun] + exact mem_iUnion.mpr ⟨intModFin hn ⌊x⌋, unitFract x, rfl⟩ + · rintro ⟨_, ⟨i, rfl⟩, t, rfl⟩ + exact ⟨Circle.exp (2 * Real.pi * ((i.1 : ℝ) + (t : ℝ)) / (n : ℝ)), + concatLoop_exp_piece hn γ hmatch i t⟩ + +/-- If two cyclic chains of paths `γ₀, γ₁ : Fin n → C(unitInterval, S)` are connected by a family +of homotopies `H : Fin n → C(unitInterval × unitInterval, S)` whose endpoints match at each time +`s : unitInterval`, then `concatLoop hn γ₀` and `concatLoop hn γ₁` are homotopic. -/ +theorem concatLoop_homotopic {Z : Set S} {n : ℕ} (hn : 0 < n) + (γ₀ γ₁ : Fin n → C(unitInterval, S)) + (hmatch₀ : ∀ i : Fin n, γ₀ i 1 = γ₀ (finNext hn i) 0) + (hmatch₁ : ∀ i : Fin n, γ₁ i 1 = γ₁ (finNext hn i) 0) + (H : Fin n → C(unitInterval × unitInterval, S)) + (hHZ : ∀ i p, H i p ∈ Z) + (hH0 : ∀ i t, H i (t, 0) = γ₀ i t) + (hH1 : ∀ i t, H i (t, 1) = γ₁ i t) + (hHmatch : ∀ i s, H i (1, s) = H (finNext hn i) (0, s)) : + ClosedCurvesHomotopicIn Z (concatLoop hn γ₀ hmatch₀) (concatLoop hn γ₁ hmatch₁) := by + let Ψ := concatLoopParam hn H hHmatch + refine ⟨Ψ, ?_, fun w => ?_, fun w => ?_⟩ + · rintro ⟨w, s⟩ + have h2pi : (0 : ℝ) < 2 * Real.pi := by positivity + let x : ℝ := Complex.arg w * (n : ℝ) / (2 * Real.pi) + have hexp : Circle.exp (2 * Real.pi * x / (n : ℝ)) = w := by + have h1 : 2 * Real.pi * x / (n : ℝ) = Complex.arg w := by + dsimp [x] + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' + field_simp + rw [h1, Circle.exp_arg] + change Ψ (w, s) ∈ Z + rw [← hexp, concatLoopParam_exp] + exact hHZ _ _ + · let x : ℝ := Complex.arg w * (n : ℝ) / (2 * Real.pi) + have hexp : Circle.exp (2 * Real.pi * x / (n : ℝ)) = w := by + have h1 : 2 * Real.pi * x / (n : ℝ) = Complex.arg w := by + dsimp [x] + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' + field_simp + rw [h1, Circle.exp_arg] + change Ψ (w, 0) = concatLoop hn γ₀ hmatch₀ w + rw [← hexp] + dsimp [Ψ, concatLoop] + rw [concatLoopParam_exp, concatLoopParam_exp] + dsimp [chainFun] + exact hH0 _ _ + · let x : ℝ := Complex.arg w * (n : ℝ) / (2 * Real.pi) + have hexp : Circle.exp (2 * Real.pi * x / (n : ℝ)) = w := by + have h1 : 2 * Real.pi * x / (n : ℝ) = Complex.arg w := by + dsimp [x] + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' + field_simp + rw [h1, Circle.exp_arg] + change Ψ (w, 1) = concatLoop hn γ₁ hmatch₁ w + rw [← hexp] + dsimp [Ψ, concatLoop] + rw [concatLoopParam_exp, concatLoopParam_exp] + dsimp [chainFun] + exact hH1 _ _ + +/-- Any closed curve `φ : C(Circle, S)` equals the `n`-piece concatenation `concatLoop` of its +restrictions to the `n` equal arcs of `Circle`. -/ +noncomputable def curvePiece {n : ℕ} (_hn : 0 < n) (φ : C(Circle, S)) (i : Fin n) : + C(unitInterval, S) := + ⟨fun t => φ (Circle.exp (2 * Real.pi * ((i.1 : ℝ) + (t : ℝ)) / (n : ℝ))), by fun_prop⟩ + +theorem curvePiece_match {n : ℕ} (hn : 0 < n) (φ : C(Circle, S)) (i : Fin n) : + curvePiece hn φ i 1 = curvePiece hn φ (finNext hn i) 0 := by + dsimp [curvePiece, finNext] + by_cases hlast : i.1 + 1 = n + · have hmod : (i.1 + 1) % n = 0 := by rw [hlast, Nat.mod_self] + rw [hmod] + simp only [add_zero, Nat.cast_zero, mul_zero, zero_div, Circle.exp_zero] + have h1 : (i.1 : ℝ) + 1 = (n : ℝ) := by exact_mod_cast hlast + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' + rw [h1, mul_div_cancel_right₀ _ hn', Circle.exp_two_pi] + · have hlt : i.1 + 1 < n := lt_of_le_of_ne (Nat.succ_le_of_lt i.2) hlast + rw [Nat.mod_eq_of_lt hlt] + simp only [add_zero, Nat.cast_add, Nat.cast_one] + +theorem concatLoop_curvePiece {n : ℕ} (hn : 0 < n) (φ : C(Circle, S)) : + concatLoop hn (curvePiece hn φ) (curvePiece_match hn φ) = φ := by + ext w + let x : ℝ := Complex.arg w * (n : ℝ) / (2 * Real.pi) + have hexp : Circle.exp (2 * Real.pi * x / (n : ℝ)) = w := by + have h1 : 2 * Real.pi * x / (n : ℝ) = Complex.arg w := by + dsimp [x] + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' + field_simp + rw [h1, Circle.exp_arg] + rw [← hexp] + dsimp [concatLoop] + rw [concatLoopParam_exp] + dsimp [chainFun, curvePiece, unitFract] + congr 1 + have hk : ((intModFin hn ⌊x⌋).1 : ℝ) = ((⌊x⌋ % (n : ℤ) : ℤ) : ℝ) := by + dsimp [intModFin] + have hnZ : (0 : ℤ) < n := by exact_mod_cast hn + have hnn : 0 ≤ ⌊x⌋ % (n : ℤ) := Int.emod_nonneg ⌊x⌋ hnZ.ne' + exact_mod_cast Int.toNat_of_nonneg hnn + rw [hk] + have hdiv : (⌊x⌋ : ℝ) = (n : ℝ) * ((⌊x⌋ / (n : ℤ) : ℤ) : ℝ) + ((⌊x⌋ % (n : ℤ) : ℤ) : ℝ) := by + have := (Int.mul_ediv_add_emod ⌊x⌋ (n : ℤ)).symm + exact_mod_cast this + have hx_eq : ((⌊x⌋ % (n : ℤ) : ℤ) : ℝ) + Int.fract x = + x - (n : ℝ) * ((⌊x⌋ / (n : ℤ) : ℤ) : ℝ) := by + have hfr := Int.self_sub_floor x + linarith [hdiv, hfr] + rw [hx_eq] + apply Circle.exp_eq_exp.mpr + refine ⟨-(⌊x⌋ / (n : ℤ)), ?_⟩ + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' + push_cast + field_simp + ring + +/-! ## Subdivision Lemma for Compact Intervals / Circles -/ + +/-- Given a continuous curve `φ : C(Circle, S)` with `range φ ⊆ ⋃ i ∈ J, U i` where each `U i` is +open, there exists `n ≥ 1` such that each of the `n` pieces `curvePiece hn φ k` has its range +contained in `U (z k)` for some `z k ∈ J`. -/ +theorem exists_subdivision_in_open_cover {ι : Type*} {J : Set ι} {U : ι → Set S} + (hU_open : ∀ i ∈ J, IsOpen (U i)) (φ : C(Circle, S)) + (hcov : range φ ⊆ ⋃ i ∈ J, U i) : + ∃ (n : ℕ) (hn : 0 < n) (z : Fin n → ι), + (∀ k : Fin n, z k ∈ J) ∧ ∀ k : Fin n, range (curvePiece hn φ k) ⊆ U (z k) := by + let g : ℝ → S := fun θ => φ (Circle.exp θ) + have hg : Continuous g := φ.continuous.comp Circle.exp.continuous + let V : J → Set ℝ := fun j => g ⁻¹' U j.1 + have hV_open : ∀ j : J, IsOpen (V j) := fun j => (hU_open j.1 j.2).preimage hg + have hIcc_cov : Icc (0 : ℝ) (2 * Real.pi) ⊆ ⋃ j : J, V j := fun θ _ => by + obtain ⟨i, hi, hmem⟩ := mem_iUnion₂.mp (hcov (mem_range_self (Circle.exp θ))) + exact mem_iUnion.mpr ⟨⟨i, hi⟩, hmem⟩ + obtain ⟨δ, hδ, hleb⟩ := lebesgue_number_lemma_of_metric isCompact_Icc hV_open hIcc_cov + obtain ⟨n, hn_gt⟩ := exists_nat_gt (2 * Real.pi / δ) + have h2pi : (0 : ℝ) < 2 * Real.pi := by positivity + have hn_pos : (0 : ℝ) < n := lt_trans (div_pos h2pi hδ) hn_gt + have hn : 0 < n := by exact_mod_cast hn_pos + have hstep : 2 * Real.pi / (n : ℝ) < δ := + (div_lt_iff₀ hn_pos).mpr (by linarith [(div_lt_iff₀ hδ).mp hn_gt]) + have hex : ∀ k : Fin n, ∃ i ∈ J, range (curvePiece hn φ k) ⊆ U i := by + intro k + let a : ℝ := 2 * Real.pi * (k.1 : ℝ) / (n : ℝ) + have ha_mem : a ∈ Icc (0 : ℝ) (2 * Real.pi) := by + refine ⟨by positivity, ?_⟩ + rw [div_le_iff₀ hn_pos] + have : (k.1 : ℝ) ≤ (n : ℝ) := by exact_mod_cast k.2.le + nlinarith + obtain ⟨j, hball⟩ := hleb a ha_mem + refine ⟨j.1, j.2, ?_⟩ + rintro _ ⟨t, rfl⟩ + let θ : ℝ := 2 * Real.pi * ((k.1 : ℝ) + (t : ℝ)) / (n : ℝ) + have hθ_ball : θ ∈ ball a δ := by + rw [mem_ball, Real.dist_eq] + have hdiff : θ - a = (2 * Real.pi / (n : ℝ)) * (t : ℝ) := by + dsimp [θ, a] + ring + have ht_nn : 0 ≤ (t : ℝ) := t.2.1 + rw [hdiff, abs_of_nonneg (by positivity)] + have ht_le : (t : ℝ) ≤ 1 := t.2.2 + have hle : (2 * Real.pi / (n : ℝ)) * (t : ℝ) ≤ 2 * Real.pi / (n : ℝ) := + mul_le_of_le_one_right (by positivity) ht_le + exact lt_of_le_of_lt hle hstep + exact hball hθ_ball + choose z hzJ hzU using hex + exact ⟨n, hn, z, hzJ, hzU⟩ + +/-! ## Proof of (11.5): Open, Flat, Locally Arc-Connected Superset -/ + +/-- Transitivity of `ClosedCurvesHomotopicIn Z` for closed curves `φ₀, φ₁, φ₂ : C(Circle, S)`. -/ +private theorem closedCurvesHomotopicIn_trans {Z : Set S} {φ₀ φ₁ φ₂ : C(Circle, S)} + (h₁ : ClosedCurvesHomotopicIn Z φ₀ φ₁) (h₂ : ClosedCurvesHomotopicIn Z φ₁ φ₂) : + ClosedCurvesHomotopicIn Z φ₀ φ₂ := + Surface.ClosedCurvesHomotopicIn.trans h₁ h₂ + +/-- Given paths `γ, α₀, α₁ : C(unitInterval, S)` with `α₀ 1 = γ 0` and `α₁ 1 = γ 1`, the +time-dependent 3-piece concatenation `whiskerHomotopy α₀ γ α₁ : C(unitInterval × unitInterval, S)` +interpolates from a reparameterization of `γ` at `s = 0` to `α₀ * γ * α₁⁻¹` at `s = 1`, with +endpoints `α₀ (1 - s)` and `α₁ (1 - s)` at time `s`. -/ +noncomputable def whiskerHomotopy (α₀ γ α₁ : C(unitInterval, S)) + (h0 : α₀ 1 = γ 0) (h1 : α₁ 1 = γ 1) : C(unitInterval × unitInterval, S) := by + let f₁ : unitInterval × unitInterval → S := fun p => + α₀ (projIcc 0 1 zero_le_one (1 - (p.2 : ℝ) + (p.2 : ℝ) * (3 * (p.1 : ℝ)))) + let f₂ : unitInterval × unitInterval → S := fun p => + γ (projIcc 0 1 zero_le_one (3 * (p.1 : ℝ) - 1)) + let f₃ : unitInterval × unitInterval → S := fun p => + α₁ (projIcc 0 1 zero_le_one (1 - (p.2 : ℝ) * (3 * (p.1 : ℝ) - 2))) + have hf₁ : Continuous f₁ := by fun_prop + have hf₂ : Continuous f₂ := by fun_prop + have hf₃ : Continuous f₃ := by fun_prop + let f₁₂ : unitInterval × unitInterval → S := + fun p => if (p.1 : ℝ) ≤ 1 / 3 then f₁ p else f₂ p + have hf₁₂ : Continuous f₁₂ := by + refine Continuous.if_le hf₁ hf₂ (continuous_subtype_val.comp continuous_fst) continuous_const ?_ + intro p hp + have hp1 : projIcc 0 1 zero_le_one (1 - (p.2 : ℝ) + (p.2 : ℝ) * (3 * (p.1 : ℝ))) = 1 := by + rw [hp]; ext; change max (0 : ℝ) (min 1 (1 - (p.2 : ℝ) + (p.2 : ℝ) * (3 * (1 / 3)))) = 1 + have : 1 - (p.2 : ℝ) + (p.2 : ℝ) * (3 * (1 / 3)) = 1 := by ring + rw [this]; norm_num + have hp0 : projIcc 0 1 zero_le_one (3 * (p.1 : ℝ) - 1) = 0 := by + rw [hp]; ext; simp + change α₀ _ = γ _ + rw [hp1, hp0, h0] + let F : unitInterval × unitInterval → S := + fun p => if (p.1 : ℝ) ≤ 2 / 3 then f₁₂ p else f₃ p + have hF : Continuous F := by + refine Continuous.if_le hf₁₂ hf₃ (continuous_subtype_val.comp continuous_fst) continuous_const + ?_ + intro p hp + have hnot : ¬ ((p.1 : ℝ) ≤ 1 / 3) := by linarith + have hp1 : projIcc 0 1 zero_le_one (3 * (p.1 : ℝ) - 1) = 1 := by + rw [hp]; ext; change max (0 : ℝ) (min 1 (3 * (2 / 3) - 1)) = 1; norm_num + have hp1' : projIcc 0 1 zero_le_one (1 - (p.2 : ℝ) * (3 * (p.1 : ℝ) - 2)) = 1 := by + rw [hp]; ext; change max (0 : ℝ) (min 1 (1 - (p.2 : ℝ) * (3 * (2 / 3) - 2))) = 1 + have : 1 - (p.2 : ℝ) * (3 * (2 / 3) - 2) = 1 := by ring + rw [this]; norm_num + dsimp [f₁₂] + simp only [hnot, ↓reduceIte] + change γ _ = α₁ _ + rw [hp1, hp1', h1] + exact ⟨F, hF⟩ + +theorem whiskerHomotopy_mem {U₀ U₁ : Set S} (α₀ γ α₁ : C(unitInterval, S)) + (h0 : α₀ 1 = γ 0) (h1 : α₁ 1 = γ 1) + (hα₀ : range α₀ ⊆ U₀) (hγ : range γ ⊆ U₁) (hα₁ : range α₁ ⊆ U₁) + (p : unitInterval × unitInterval) : + whiskerHomotopy α₀ γ α₁ h0 h1 p ∈ U₀ ∪ U₁ := by + dsimp [whiskerHomotopy] + split_ifs + · exact Or.inl (hα₀ (mem_range_self _)) + · exact Or.inr (hγ (mem_range_self _)) + · exact Or.inr (hα₁ (mem_range_self _)) + +theorem whiskerHomotopy_left (α₀ γ α₁ : C(unitInterval, S)) + (h0 : α₀ 1 = γ 0) (h1 : α₁ 1 = γ 1) (s : unitInterval) : + whiskerHomotopy α₀ γ α₁ h0 h1 (0, s) = α₀ (symm s) := by + dsimp [whiskerHomotopy] + split_ifs with h1 h2 + · congr 1 + have h_eq : 1 - (s : ℝ) + (s : ℝ) * (3 * (0 : ℝ)) = 1 - (s : ℝ) := by ring + rw [h_eq] + exact projIcc_of_mem zero_le_one (symm s).2 + · norm_num at h2 + · norm_num at h1 + +theorem whiskerHomotopy_right (α₀ γ α₁ : C(unitInterval, S)) + (h0 : α₀ 1 = γ 0) (h1 : α₁ 1 = γ 1) (s : unitInterval) : + whiskerHomotopy α₀ γ α₁ h0 h1 (1, s) = α₁ (symm s) := by + dsimp [whiskerHomotopy] + split_ifs with h1 h2 + · norm_num at h1 + · norm_num at h1 + · congr 1 + have h_eq : 1 - (s : ℝ) * (3 * (1 : ℝ) - 2) = 1 - (s : ℝ) := by ring + rw [h_eq] + exact projIcc_of_mem zero_le_one (symm s).2 + +/-- Linear reparameterization homotopy from `γ` to `whiskerHomotopy α₀ γ α₁ h0 h1 (·, 0)`. -/ +noncomputable def reparamHomotopy (α₀ γ α₁ : C(unitInterval, S)) + (_h0 : α₀ 1 = γ 0) (_h1 : α₁ 1 = γ 1) : C(unitInterval × unitInterval, S) := by + let τ : unitInterval × unitInterval → unitInterval := fun p => + projIcc 0 1 zero_le_one ((1 - (p.2 : ℝ)) * (p.1 : ℝ) + (p.2 : ℝ) * (3 * (p.1 : ℝ) - 1)) + exact ⟨fun p => γ (τ p), by fun_prop⟩ + +theorem reparamHomotopy_mem {U : Set S} (α₀ γ α₁ : C(unitInterval, S)) + (h0 : α₀ 1 = γ 0) (h1 : α₁ 1 = γ 1) (hγ : range γ ⊆ U) + (p : unitInterval × unitInterval) : + reparamHomotopy α₀ γ α₁ h0 h1 p ∈ U := + hγ (mem_range_self _) + +theorem reparamHomotopy_zero (α₀ γ α₁ : C(unitInterval, S)) + (h0 : α₀ 1 = γ 0) (h1 : α₁ 1 = γ 1) (t : unitInterval) : + reparamHomotopy α₀ γ α₁ h0 h1 (t, 0) = γ t := by + dsimp [reparamHomotopy] + congr 1 + have h_eq : (1 - (0 : ℝ)) * (t : ℝ) + (0 : ℝ) * (3 * (t : ℝ) - 1) = (t : ℝ) := by ring + rw [h_eq] + exact projIcc_of_mem zero_le_one t.2 + +theorem reparamHomotopy_one (α₀ γ α₁ : C(unitInterval, S)) + (h0 : α₀ 1 = γ 0) (h1 : α₁ 1 = γ 1) (t : unitInterval) : + reparamHomotopy α₀ γ α₁ h0 h1 (t, 1) = whiskerHomotopy α₀ γ α₁ h0 h1 (t, 0) := by + dsimp [reparamHomotopy, whiskerHomotopy] + have h_lhs : (1 - (1 : ℝ)) * (t : ℝ) + (1 : ℝ) * (3 * (t : ℝ) - 1) = 3 * (t : ℝ) - 1 := by ring + rw [h_lhs] + split_ifs with h23 h13 + · have h_rhs : 1 - (0 : ℝ) + (0 : ℝ) * (3 * (t : ℝ)) = 1 := by ring + rw [h_rhs] + have hp1 : projIcc 0 1 zero_le_one (1 : ℝ) = 1 := + projIcc_of_mem zero_le_one (right_mem_Icc.mpr zero_le_one) + have hp0 : projIcc 0 1 zero_le_one (3 * (t : ℝ) - 1) = 0 := + projIcc_of_le_left zero_le_one (by linarith) + rw [hp1, hp0, h0] + · rfl + · have hgt : 2 / 3 < (t : ℝ) := not_le.mp h23 + have h_rhs : 1 - (0 : ℝ) * (3 * (t : ℝ) - 2) = 1 := by ring + rw [h_rhs] + have hp1 : projIcc 0 1 zero_le_one (1 : ℝ) = 1 := + projIcc_of_mem zero_le_one (right_mem_Icc.mpr zero_le_one) + have hp1' : projIcc 0 1 zero_le_one (3 * (t : ℝ) - 1) = 1 := + projIcc_of_right_le zero_le_one (by linarith) + rw [hp1, hp1', h1] + +theorem reparamHomotopy_left (α₀ γ α₁ : C(unitInterval, S)) + (h0 : α₀ 1 = γ 0) (h1 : α₁ 1 = γ 1) (s : unitInterval) : + reparamHomotopy α₀ γ α₁ h0 h1 (0, s) = γ 0 := by + dsimp [reparamHomotopy] + congr 1 + have hle : (1 - (s : ℝ)) * (0 : ℝ) + (s : ℝ) * (3 * (0 : ℝ) - 1) ≤ 0 := by + linarith [s.2.1] + exact projIcc_of_le_left zero_le_one hle + +theorem reparamHomotopy_right (α₀ γ α₁ : C(unitInterval, S)) + (h0 : α₀ 1 = γ 0) (h1 : α₁ 1 = γ 1) (s : unitInterval) : + reparamHomotopy α₀ γ α₁ h0 h1 (1, s) = γ 1 := by + dsimp [reparamHomotopy] + congr 1 + have hge : 1 ≤ (1 - (s : ℝ)) * (1 : ℝ) + (s : ℝ) * (3 * (1 : ℝ) - 1) := by + linarith [s.2.1] + exact projIcc_of_right_le zero_le_one hge + +/-- Graph Minors VII, (11.5) (pages 251–252): +"If $Z \subseteq \Sigma$ is flat and l.a.c., there is an open, flat, l.a.c. set $Y \subseteq \Sigma$ +with $Z \subseteq Y$, which may be chosen arc-connected if $Z$ is arc-connected." -/ +theorem flat_locallyArcConnected_open_superset (hS : IsSurface S) {Z : Set S} + (hZ_flat : IsFlat Z) (hZ_lac : IsLocallyArcConnected Z) : + ∃ Y : Set S, Z ⊆ Y ∧ IsOpen Y ∧ IsFlat Y ∧ IsLocallyArcConnected Y ∧ + (IsArcConnected Z → IsArcConnected Y) := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have : SecondCountableTopology S := secondCountable_of_manifold hS.2.2 + let : MetricSpace S := TopologicalSpace.metrizableSpaceMetric S + -- Step 1: For each `z ∈ Z`, choose `W z` (open chart ball) and `Δ z ⊆ W z` with `Z ∩ Δ z` + -- arc-connected. + have hW_ex : ∀ z : S, ∃ W : Set S, z ∈ W ∧ IsOpen W ∧ IsArcConnected W ∧ IsFlat W ∧ + (∀ γ₀ γ₁ : C(unitInterval, S), range γ₀ ⊆ W → range γ₁ ⊆ W → + γ₀ 0 = γ₁ 0 → γ₀ 1 = γ₁ 1 → PathsHomotopicRelIn W γ₀ γ₁) := by + intro z + obtain ⟨W, _, hzW, hW_open, hW_arc, hW_flat, hW_hom⟩ := + exists_chart_ball_subset hS z isOpen_univ (mem_univ z) + exact ⟨W, hzW, hW_open, hW_arc, hW_flat, hW_hom⟩ + choose W hzW hW_open hW_arc hW_flat hW_hom using hW_ex + have hΔ_ex : ∀ z : S, ∃ Δ : Set S, Δ ⊆ W z ∧ z ∈ Δ ∧ IsOpen Δ ∧ + (z ∈ Z → IsArcConnected (Z ∩ Δ)) := by + intro z + by_cases hz : z ∈ Z + · obtain ⟨Δ, hΔW, hzΔ, hΔ_open, hZΔ_arc⟩ := hZ_lac z hz (W z) (hW_open z) (hzW z) + exact ⟨Δ, hΔW, hzΔ, hΔ_open, fun _ => hZΔ_arc⟩ + · exact ⟨W z, Subset.rfl, hzW z, hW_open z, fun hz' => absurd hz' hz⟩ + choose Δ hΔW hzΔ hΔ_open hZΔ_arc using hΔ_ex + -- Step 2: For each `z`, choose `ε z > 0` such that `closedBall z (ε z) ⊆ Δ z`. + have hε_ex : ∀ z : S, ∃ ε : ℝ, 0 < ε ∧ closedBall z ε ⊆ Δ z := by + intro z + obtain ⟨r, hr, hball⟩ := Metric.isOpen_iff.mp (hΔ_open z) z (hzΔ z) + refine ⟨r / 2, half_pos hr, fun y hy => hball ?_⟩ + exact lt_of_le_of_lt (mem_closedBall.mp hy) (half_lt_self hr) + choose ε hε_pos hε_ball using hε_ex + -- Step 3: For each `z`, choose `U z ⊆ ball z (ε z / 3)` open and arc-connected with `z ∈ U z`. + have hU_ex : ∀ z : S, ∃ U : Set S, U ⊆ ball z (ε z / 3) ∧ z ∈ U ∧ IsOpen U ∧ IsArcConnected U + := by + intro z + have hpos : 0 < ε z / 3 := by linarith [hε_pos z] + obtain ⟨U, hU_sub, hzU, hU_open, hU_arc, _, _⟩ := + exists_chart_ball_subset hS z isOpen_ball (mem_ball_self hpos) + exact ⟨U, hU_sub, hzU, hU_open, hU_arc⟩ + choose U hU_ball hzU hU_open hU_arc using hU_ex + -- Key triangle-inequality property (page 252, lines 1029-1033): + have hU_pair : ∀ z₁ z₂ : S, (U z₁ ∩ U z₂).Nonempty → + ∃ z ∈ ({z₁, z₂} : Set S), U z₁ ∪ U z₂ ⊆ Δ z := by + intro z₁ z₂ ⟨u, hu₁, hu₂⟩ + have hu₁' : dist u z₁ < ε z₁ / 3 := mem_ball.mp (hU_ball z₁ hu₁) + have hu₂' : dist u z₂ < ε z₂ / 3 := mem_ball.mp (hU_ball z₂ hu₂) + by_cases hle : ε z₁ ≤ ε z₂ + · refine ⟨z₂, Or.inr (mem_singleton z₂), fun y hy => hε_ball z₂ (mem_closedBall.mpr ?_)⟩ + rcases hy with hy₁ | hy₂ + · have hy₁' : dist y z₁ < ε z₁ / 3 := mem_ball.mp (hU_ball z₁ hy₁) + have htri : dist y z₂ ≤ dist y z₁ + dist z₁ u + dist u z₂ := dist_triangle4 y z₁ u z₂ + rw [dist_comm z₁ u] at htri + linarith + · have hy₂' : dist y z₂ < ε z₂ / 3 := mem_ball.mp (hU_ball z₂ hy₂) + linarith [hε_pos z₂] + · have hgt : ε z₂ < ε z₁ := not_le.mp hle + refine ⟨z₁, Or.inl rfl, fun y hy => hε_ball z₁ (mem_closedBall.mpr ?_)⟩ + rcases hy with hy₁ | hy₂ + · have hy₁' : dist y z₁ < ε z₁ / 3 := mem_ball.mp (hU_ball z₁ hy₁) + linarith [hε_pos z₁] + · have hy₂' : dist y z₂ < ε z₂ / 3 := mem_ball.mp (hU_ball z₂ hy₂) + have htri : dist y z₁ ≤ dist y z₂ + dist z₂ u + dist u z₁ := dist_triangle4 y z₂ u z₁ + rw [dist_comm z₂ u] at htri + linarith + -- Step 4: Define `Y = ⋃ z ∈ Z, U z` and check `Z ⊆ Y`, `IsOpen Y`, `IsLocallyArcConnected Y`, and + -- `IsArcConnected Z → IsArcConnected Y`. + let Y : Set S := ⋃ z ∈ Z, U z + have hZY : Z ⊆ Y := fun z hz => mem_iUnion₂.mpr ⟨z, hz, hzU z⟩ + have hY_open : IsOpen Y := isOpen_biUnion fun z _ => hU_open z + have hY_lac : IsLocallyArcConnected Y := by + intro y hy A hA_open hyA + obtain ⟨A', hA'_sub, hyA', hA'_open, hA'_arc, _, _⟩ := + exists_chart_ball_subset hS y (hY_open.inter hA_open) ⟨hy, hyA⟩ + refine ⟨A', fun w hw => (hA'_sub hw).2, hyA', hA'_open, ?_⟩ + have hYA' : Y ∩ A' = A' := inter_eq_self_of_subset_right fun w hw => (hA'_sub hw).1 + rw [hYA'] + exact hA'_arc + have hY_arc_imp : IsArcConnected Z → IsArcConnected Y := by + intro hZ_arc a ha b hb hne + obtain ⟨z₁, hz₁Z, ha₁⟩ := mem_iUnion₂.mp ha + obtain ⟨z₂, hz₂Z, hb₂⟩ := mem_iUnion₂.mp hb + obtain ⟨γ₁, hγ₁, hγ₁0, hγ₁1⟩ := exists_path_of_isArcConnected (hU_arc z₁) ha₁ (hzU z₁) + obtain ⟨γ₂, hγ₂, hγ₂0, hγ₂1⟩ := exists_path_of_isArcConnected hZ_arc hz₁Z hz₂Z + obtain ⟨γ₃, hγ₃, hγ₃0, hγ₃1⟩ := exists_path_of_isArcConnected (hU_arc z₂) (hzU z₂) hb₂ + let p₁ : Path a z₁ := ⟨γ₁, hγ₁0, hγ₁1⟩ + let p₂ : Path z₁ z₂ := ⟨γ₂, hγ₂0, hγ₂1⟩ + let p₃ : Path z₂ b := ⟨γ₃, hγ₃0, hγ₃1⟩ + have hj₁ : JoinedIn Y a z₁ := ⟨p₁, fun t => mem_iUnion₂.mpr ⟨z₁, hz₁Z, hγ₁ (mem_range_self t)⟩⟩ + have hj₂ : JoinedIn Y z₁ z₂ := ⟨p₂, fun t => hZY (hγ₂ (mem_range_self t))⟩ + have hj₃ : JoinedIn Y z₂ b := ⟨p₃, fun t => mem_iUnion₂.mpr ⟨z₂, hz₂Z, hγ₃ (mem_range_self t)⟩⟩ + exact ((joinedIn_iff_eq_or_exists_isLineWithEnds ha hb).mp + (hj₁.trans (hj₂.trans hj₃))).resolve_left hne + -- Step 5: Check `IsFlat Y`. + refine ⟨Y, hZY, hY_open, ?_, hY_lac, hY_arc_imp⟩ + intro φ hφY + obtain ⟨n, hn, z, hzZ, hpiece⟩ := + exists_subdivision_in_open_cover (fun z _ => hU_open z) φ hφY + let γ₀ : Fin n → C(unitInterval, S) := curvePiece hn φ + have hmatch₀ : ∀ i : Fin n, γ₀ i 1 = γ₀ (finNext hn i) 0 := curvePiece_match hn φ + -- For each `i : Fin n`, `γ₀ i 1 ∈ U (z i)` and `z i ∈ U (z i)`, so choose a path `α i` in `U (z + -- i)` from `z i` to `γ₀ i 1`. + have hα_ex : ∀ i : Fin n, ∃ α : C(unitInterval, S), + range α ⊆ U (z i) ∧ α 0 = z i ∧ α 1 = γ₀ i 1 := + fun i => exists_path_of_isArcConnected (hU_arc (z i)) (hzU (z i)) + (hpiece i (mem_range_self 1)) + choose α hα_sub hα0 hα1 using hα_ex + have hα_prev1 : ∀ i : Fin n, α (finPrev hn i) 1 = γ₀ i 0 := by + intro i + rw [hα1 (finPrev hn i), hmatch₀ (finPrev hn i), finNext_finPrev hn i] + -- Define `γ₁ i = whiskerHomotopy (α (finPrev hn i)) (γ₀ i) (α i) (·, 0)` and `ψ i = + -- whiskerHomotopy ... (·, 1)`. + let H_reparam : Fin n → C(unitInterval × unitInterval, S) := + fun i => reparamHomotopy (α (finPrev hn i)) (γ₀ i) (α i) (hα_prev1 i) (hα1 i) + let H_whisker : Fin n → C(unitInterval × unitInterval, S) := + fun i => whiskerHomotopy (α (finPrev hn i)) (γ₀ i) (α i) (hα_prev1 i) (hα1 i) + let γ₁ : Fin n → C(unitInterval, S) := + fun i => (H_whisker i).comp ⟨fun t => (t, 0), continuous_id.prodMk continuous_const⟩ + let ψ : Fin n → C(unitInterval, S) := + fun i => (H_whisker i).comp ⟨fun t => (t, 1), continuous_id.prodMk continuous_const⟩ + have hmatch₁ : ∀ i : Fin n, γ₁ i 1 = γ₁ (finNext hn i) 0 := by + intro i + change H_whisker i (1, 0) = H_whisker (finNext hn i) (0, 0) + rw [whiskerHomotopy_right, whiskerHomotopy_left, finPrev_finNext] + have hmatch_ψ : ∀ i : Fin n, ψ i 1 = ψ (finNext hn i) 0 := by + intro i + change H_whisker i (1, 1) = H_whisker (finNext hn i) (0, 1) + rw [whiskerHomotopy_right, whiskerHomotopy_left, finPrev_finNext] + have hhom₁ : ClosedCurvesHomotopicIn univ φ (concatLoop hn γ₁ hmatch₁) := by + rw [← concatLoop_curvePiece hn φ] + refine concatLoop_homotopic hn γ₀ γ₁ hmatch₀ hmatch₁ H_reparam (fun _ _ => mem_univ _) + (fun i t => reparamHomotopy_zero _ _ _ _ _ t) + (fun i t => reparamHomotopy_one _ _ _ _ _ t) (fun i s => ?_) + show H_reparam i (1, s) = H_reparam (finNext hn i) (0, s) + rw [reparamHomotopy_right, reparamHomotopy_left] + exact hmatch₀ i + have hhom₂ : ClosedCurvesHomotopicIn univ (concatLoop hn γ₁ hmatch₁) (concatLoop hn ψ hmatch_ψ) + := by + refine concatLoop_homotopic hn γ₁ ψ hmatch₁ hmatch_ψ H_whisker (fun _ _ => mem_univ _) + (fun _ _ => rfl) (fun _ _ => rfl) (fun i s => ?_) + show H_whisker i (1, s) = H_whisker (finNext hn i) (0, s) + rw [whiskerHomotopy_right, whiskerHomotopy_left, finPrev_finNext] + -- Now for each `i : Fin n`, `γ₀ i 0 ∈ U (z (finPrev hn i)) ∩ U (z i)`, so `U (z (finPrev hn i)) ∪ + -- U (z i) ⊆ Δ (w i)` for some `w i ∈ Z`. + have hψ_ends : ∀ i : Fin n, ψ i 0 = z (finPrev hn i) ∧ ψ i 1 = z i := by + intro i + have hsymm1 : symm (1 : unitInterval) = 0 := by ext; simp + refine ⟨?_, ?_⟩ + · change H_whisker i (0, 1) = z (finPrev hn i) + rw [whiskerHomotopy_left, hsymm1, hα0] + · change H_whisker i (1, 1) = z i + rw [whiskerHomotopy_right, hsymm1, hα0] + have hθ_ex : ∀ i : Fin n, ∃ (θ : C(unitInterval, S)) (H : C(unitInterval × unitInterval, S)), + range θ ⊆ Z ∧ θ 0 = z (finPrev hn i) ∧ θ 1 = z i ∧ + (∀ t, H (t, 0) = ψ i t) ∧ (∀ t, H (t, 1) = θ t) ∧ + (∀ s, H (0, s) = z (finPrev hn i)) ∧ (∀ s, H (1, s) = z i) := by + intro i + have hnonempty : (U (z (finPrev hn i)) ∩ U (z i)).Nonempty := + ⟨γ₀ i 0, by rw [← hα_prev1 i]; exact hα_sub (finPrev hn i) (mem_range_self 1), + hpiece i (mem_range_self 0)⟩ + obtain ⟨w, hw_pair, hU_sub_Δ⟩ := hU_pair (z (finPrev hn i)) (z i) hnonempty + have hwZ : w ∈ Z := by + rcases hw_pair with rfl | h_eq + · exact hzZ (finPrev hn i) + · rw [mem_singleton_iff.mp h_eq] + exact hzZ i + have hz_prev_Δ : z (finPrev hn i) ∈ Z ∩ Δ w := + ⟨hzZ (finPrev hn i), hU_sub_Δ (Or.inl (hzU (z (finPrev hn i))))⟩ + have hz_curr_Δ : z i ∈ Z ∩ Δ w := + ⟨hzZ i, hU_sub_Δ (Or.inr (hzU (z i)))⟩ + obtain ⟨θ, hθ_sub, hθ0, hθ1⟩ := + exists_path_of_isArcConnected (hZΔ_arc w hwZ) hz_prev_Δ hz_curr_Δ + have hψ_W : range (ψ i) ⊆ W w := by + rintro _ ⟨t, rfl⟩ + exact hΔW w (hU_sub_Δ (whiskerHomotopy_mem (α (finPrev hn i)) (γ₀ i) (α i) + (hα_prev1 i) (hα1 i) (hα_sub (finPrev hn i)) (hpiece i) (hα_sub i) (t, 1))) + have hθ_W : range θ ⊆ W w := fun x hx => hΔW w (hθ_sub hx).2 + obtain ⟨H, _, hH0, hH1, hHs0, hHs1⟩ := + hW_hom w (ψ i) θ hψ_W hθ_W ((hψ_ends i).1.trans hθ0.symm) ((hψ_ends i).2.trans hθ1.symm) + refine ⟨θ, H, fun x hx => (hθ_sub hx).1, hθ0, hθ1, hH0, hH1, ?_, ?_⟩ + · intro s; rw [hHs0 s, (hψ_ends i).1] + · intro s; rw [hHs1 s, (hψ_ends i).2] + choose θ H_θ hθ_Z hθ0 hθ1 hHθ0 hHθ1 hHθ_left hHθ_right using hθ_ex + have hmatch_θ : ∀ i : Fin n, θ i 1 = θ (finNext hn i) 0 := by + intro i + rw [hθ1 i, hθ0 (finNext hn i), finPrev_finNext] + have hhom₃ : ClosedCurvesHomotopicIn univ (concatLoop hn ψ hmatch_ψ) (concatLoop hn θ hmatch_θ) + := by + refine concatLoop_homotopic hn ψ θ hmatch_ψ hmatch_θ H_θ (fun _ _ => mem_univ _) + hHθ0 hHθ1 (fun i s => ?_) + rw [hHθ_right i s, hHθ_left (finNext hn i) s, finPrev_finNext] + have hθ_range : range (concatLoop hn θ hmatch_θ) ⊆ Z := by + rw [range_concatLoop] + exact iUnion_subset hθ_Z + obtain ⟨c, hc_univ, hθ_null⟩ := hZ_flat (concatLoop hn θ hmatch_θ) hθ_range + exact ⟨c, hc_univ, closedCurvesHomotopicIn_trans hhom₁ + (closedCurvesHomotopicIn_trans hhom₂ (closedCurvesHomotopicIn_trans hhom₃ hθ_null))⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section11c.lean b/LeanPool/GraphMinor/GM07/Section11c.lean new file mode 100644 index 0000000000..42d2d89c3f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section11c.lean @@ -0,0 +1,1770 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.GM07.Section11b +import LeanPool.GraphMinor.Surface.ArcInPath +import LeanPool.GraphMinor.Surface.DiscMerge +import Mathlib.Topology.Metrizable.Urysohn + +/-! +# Graph Minors VII, Section 11: Proof of (11.2) + +This file proves Graph Minors VII, (11.2) (`nonNullHomotopicOArc_in_curve`, pages 249–250): +if `S` is a surface and `φ : C(Circle, S)` is non-null-homotopic in `S`, then `range φ` contains +a non-null-homotopic `O`-arc `F`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Function Topology Metric unitInterval +open GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## Subpaths and Unit-Square Homotopy Criterion for `Circle` -/ + +/-- Every `w : Circle` is of the form `Circle.exp (2 * Real.pi * u.1)` for some `u : unitInterval`. +-/ +theorem exists_unitInterval_exp (w : Circle) : + ∃ u : unitInterval, Circle.exp (2 * Real.pi * (u : ℝ)) = w := by + have h2pi : (0 : ℝ) < 2 * Real.pi := by positivity + let θ : ℝ := toIcoMod h2pi 0 (Complex.arg w) + have hθ0 : 0 ≤ θ := (toIcoMod_mem_Ico h2pi 0 (Complex.arg w)).1 + have hθ1 : θ ≤ 2 * Real.pi := by linarith [(toIcoMod_mem_Ico h2pi 0 (Complex.arg w)).2] + let u : unitInterval := ⟨θ / (2 * Real.pi), div_nonneg hθ0 h2pi.le, (div_le_one h2pi).mpr hθ1⟩ + refine ⟨u, ?_⟩ + have hmul : 2 * Real.pi * (u : ℝ) = θ := mul_div_cancel₀ θ h2pi.ne' + rw [hmul] + have h1 : θ = Complex.arg w - toIcoDiv h2pi 0 (Complex.arg w) • (2 * Real.pi) := rfl + have h2 : Circle.exp θ = Circle.exp (Complex.arg w) := by + rw [h1, zsmul_eq_mul] + exact Circle.exp_eq_exp.mpr ⟨-toIcoDiv h2pi 0 (Complex.arg w), by push_cast; ring⟩ + exact h2.trans (Circle.exp_arg w) + +/-- Criterion for `ClosedCurvesHomotopicIn Z φ₀ φ₁` via a homotopy `H : C(unitInterval × +unitInterval, S)` +satisfying `H (1, s) = H (0, s)`. -/ +theorem closedCurvesHomotopicIn_of_unitInterval {Z : Set S} {φ₀ φ₁ : C(Circle, S)} + (H : C(unitInterval × unitInterval, S)) + (hHZ : ∀ p, H p ∈ Z) + (hper : ∀ s : unitInterval, H (1, s) = H (0, s)) + (h0 : ∀ u : unitInterval, H (u, 0) = φ₀ (Circle.exp (2 * Real.pi * (u : ℝ)))) + (h1 : ∀ u : unitInterval, H (u, 1) = φ₁ (Circle.exp (2 * Real.pi * (u : ℝ)))) : + ClosedCurvesHomotopicIn Z φ₀ φ₁ := by + let Ψ := concatLoopParam one_pos (fun _ : Fin 1 => H) (fun _ s => hper s) + have hΨ_exp : ∀ (u : unitInterval) (s : unitInterval), + Ψ (Circle.exp (2 * Real.pi * (u : ℝ)), s) = H (u, s) := by + intro u s + have h := concatLoopParam_exp one_pos (fun _ : Fin 1 => H) (fun _ r => hper r) (u : ℝ) s + simp only [Nat.cast_one, div_one] at h + rw [h] + have h2 := chainFun_int_add one_pos (fun _ : Fin 1 => H) (fun _ r => hper r) 0 u s + simp only [Int.cast_zero, zero_add] at h2 + exact h2 + refine ⟨Ψ, ?_, fun w => ?_, fun w => ?_⟩ + · rintro ⟨w, s⟩ + obtain ⟨u, rfl⟩ := exists_unitInterval_exp w + rw [hΨ_exp] + exact hHZ (u, s) + · obtain ⟨u, rfl⟩ := exists_unitInterval_exp w + rw [hΨ_exp, h0] + · obtain ⟨u, rfl⟩ := exists_unitInterval_exp w + rw [hΨ_exp, h1] + +/-- Transitivity of `ClosedCurvesHomotopicIn Z`. -/ +theorem closedCurvesHomotopicIn_trans' {Z : Set S} {φ₀ φ₁ φ₂ : C(Circle, S)} + (h₁ : ClosedCurvesHomotopicIn Z φ₀ φ₁) (h₂ : ClosedCurvesHomotopicIn Z φ₁ φ₂) : + ClosedCurvesHomotopicIn Z φ₀ φ₂ := + Surface.ClosedCurvesHomotopicIn.trans h₁ h₂ + +/-- Symmetry of `ClosedCurvesHomotopicIn Z`. -/ +theorem ClosedCurvesHomotopicIn.symm {Z : Set S} {φ₀ φ₁ : C(Circle, S)} + (h : ClosedCurvesHomotopicIn Z φ₀ φ₁) : ClosedCurvesHomotopicIn Z φ₁ φ₀ := by + obtain ⟨Ψ, hΨZ, hΨ0, hΨ1⟩ := h + refine ⟨Ψ.comp ⟨fun p => (p.1, unitInterval.symm p.2), + continuous_fst.prodMk (continuous_symm.comp continuous_snd)⟩, + fun p => hΨZ _, fun x => ?_, fun x => ?_⟩ + · change Ψ (x, unitInterval.symm 0) = φ₁ x + have h0 : unitInterval.symm 0 = 1 := by ext; simp + rw [h0, hΨ1] + · change Ψ (x, unitInterval.symm 1) = φ₀ x + have h1 : unitInterval.symm 1 = 0 := by ext; simp + rw [h1, hΨ0] + +/-- If `ClosedCurvesHomotopicIn Z φ₀ φ₁` and `ClosedCurveIsNullHomotopicIn Z φ₁`, then +`ClosedCurveIsNullHomotopicIn Z φ₀`. -/ +theorem closedCurveIsNullHomotopicIn_of_homotopic {Z : Set S} {φ₀ φ₁ : C(Circle, S)} + (hhom : ClosedCurvesHomotopicIn Z φ₀ φ₁) (hnull : ClosedCurveIsNullHomotopicIn Z φ₁) : + ClosedCurveIsNullHomotopicIn Z φ₀ := by + obtain ⟨c, hc, hc_hom⟩ := hnull + exact ⟨c, hc, closedCurvesHomotopicIn_trans' hhom hc_hom⟩ + +/-- The linear subpath of `γ : C(unitInterval, S)` from `s` to `t` (`u ↦ γ ((1 - u) * s + u * t)`). +-/ +noncomputable def subPathSeg (γ : C(unitInterval, S)) (s t : unitInterval) : C(unitInterval, S) := + ⟨fun u => γ ⟨(1 - (u : ℝ)) * (s : ℝ) + (u : ℝ) * (t : ℝ), + by nlinarith [u.2.1, u.2.2, s.2.1, t.2.1], + by nlinarith [u.2.1, u.2.2, s.2.2, t.2.2]⟩, by fun_prop⟩ + +@[simp] +theorem subPathSeg_zero (γ : C(unitInterval, S)) (s t : unitInterval) : + subPathSeg γ s t 0 = γ s := by + dsimp [subPathSeg] + congr 1 + ext + change (1 - (0 : ℝ)) * (s : ℝ) + (0 : ℝ) * (t : ℝ) = (s : ℝ) + ring + +@[simp] +theorem subPathSeg_one (γ : C(unitInterval, S)) (s t : unitInterval) : + subPathSeg γ s t 1 = γ t := by + dsimp [subPathSeg] + congr 1 + ext + change (1 - (1 : ℝ)) * (s : ℝ) + (1 : ℝ) * (t : ℝ) = (t : ℝ) + ring + +theorem subPathSeg_self (γ : C(unitInterval, S)) (a u : unitInterval) : + subPathSeg γ a a u = γ a := by + dsimp [subPathSeg] + congr 1 + ext + change (1 - (u : ℝ)) * (a : ℝ) + (u : ℝ) * (a : ℝ) = (a : ℝ) + ring + +theorem range_subPathSeg_subset (γ : C(unitInterval, S)) (s t : unitInterval) : + range (subPathSeg γ s t) ⊆ range γ := by + rintro _ ⟨u, rfl⟩ + exact mem_range_self _ + +theorem injective_subPathSeg {γ : C(unitInterval, S)} (hγ : Injective γ) + {s t : unitInterval} (hst : (s : ℝ) < (t : ℝ)) : + Injective (subPathSeg γ s t) := by + intro u₁ u₂ heq + have h1 := Subtype.ext_iff.mp (hγ heq) + dsimp at h1 + ext + nlinarith + +/-! ## Periodic Chain Function `chainReal` and Operations on `concatLoop` -/ + +/-- The `n`-periodic continuous function `ℝ → S` associated to `γ : Fin n → C(unitInterval, S)`. -/ +noncomputable def chainReal {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) (x : ℝ) : S := + chainFun (P := Unit) hn (fun i => (γ i).comp ⟨Prod.fst, continuous_fst⟩) (x, ()) + +theorem continuous_chainReal {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) : + Continuous (chainReal hn γ) := + (continuous_chainFun (P := Unit) hn (fun i => (γ i).comp ⟨Prod.fst, continuous_fst⟩) + (fun i _ => hmatch i)).comp (continuous_id.prodMk continuous_const) + +theorem chainReal_add_nat {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) (x : ℝ) : + chainReal hn γ (x + (n : ℝ)) = chainReal hn γ x := + chainFun_add_nat (P := Unit) hn (fun i => (γ i).comp ⟨Prod.fst, continuous_fst⟩) x () + +theorem chainReal_int_add {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) (k : ℤ) (t : unitInterval) : + chainReal hn γ ((k : ℝ) + (t : ℝ)) = γ (intModFin hn k) t := + chainFun_int_add (P := Unit) hn (fun i => (γ i).comp ⟨Prod.fst, continuous_fst⟩) + (fun i _ => hmatch i) k t () + +theorem chainReal_nat_add {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) (i : Fin n) (t : unitInterval) : + chainReal hn γ ((i.1 : ℝ) + (t : ℝ)) = γ i t := by + have h := chainReal_int_add hn γ hmatch (i.1 : ℤ) t + simp only [Int.cast_natCast] at h + rw [intModFin_nat hn i] at h + exact h + +theorem concatLoop_exp_mul {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) (x : ℝ) : + concatLoop hn γ hmatch (Circle.exp (2 * Real.pi * x)) = chainReal hn γ (x * (n : ℝ)) := by + have hn' : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' + have h1 : 2 * Real.pi * x = 2 * Real.pi * (x * (n : ℝ)) / (n : ℝ) := by field_simp + rw [h1] + exact concatLoopParam_exp (P := Unit) hn (fun i => (γ i).comp ⟨Prod.fst, continuous_fst⟩) + (fun i _ => hmatch i) (x * (n : ℝ)) () + +/-- Cyclic rotation of a chain `γ : Fin n → C(unitInterval, S)` by `k : ℕ` steps. -/ +def rotateChain {n : ℕ} (hn : 0 < n) (k : ℕ) (γ : Fin n → C(unitInterval, S)) (i : Fin n) : + C(unitInterval, S) := + γ ⟨(i.1 + k) % n, Nat.mod_lt _ hn⟩ + +theorem rotateChain_match {n : ℕ} (hn : 0 < n) (k : ℕ) (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) (i : Fin n) : + rotateChain hn k γ i 1 = rotateChain hn k γ (finNext hn i) 0 := by + dsimp [rotateChain] + rw [hmatch] + have hfin : finNext hn ⟨(i.1 + k) % n, Nat.mod_lt _ hn⟩ = + ⟨((finNext hn i).1 + k) % n, Nat.mod_lt _ hn⟩ := by + ext + dsimp [finNext] + rw [Nat.mod_add_mod, Nat.mod_add_mod, show i.1 + k + 1 = i.1 + 1 + k by omega] + rw [hfin] + +theorem chainReal_rotateChain {n : ℕ} (hn : 0 < n) (k : ℕ) (γ : Fin n → C(unitInterval, S)) + (x : ℝ) : + chainReal hn (rotateChain hn k γ) x = chainReal hn γ (x + (k : ℝ)) := by + dsimp [chainReal, chainFun, rotateChain] + have hfl : ⌊x + (k : ℤ)⌋ = ⌊x⌋ + (k : ℤ) := Int.floor_add_intCast x k + have hfr : unitFract (x + (k : ℤ)) = unitFract x := Subtype.ext (Int.fract_add_intCast x k) + have hcast : x + (k : ℝ) = x + ((k : ℤ) : ℝ) := by push_cast; rfl + rw [hcast, hfl, hfr] + have hmod : (⟨((intModFin hn ⌊x⌋).1 + k) % n, Nat.mod_lt _ hn⟩ : Fin n) = + intModFin hn (⌊x⌋ + (k : ℤ)) := by + ext + dsimp [intModFin] + have hnZ : (0 : ℤ) < n := by exact_mod_cast hn + have hnn1 : 0 ≤ ⌊x⌋ % (n : ℤ) := Int.emod_nonneg ⌊x⌋ hnZ.ne' + have h1 : (⌊x⌋ + (k : ℤ)) % (n : ℤ) = (⌊x⌋ % (n : ℤ) + (k : ℤ)) % (n : ℤ) := by + rw [Int.add_emod (⌊x⌋ % (n : ℤ)) (k : ℤ), Int.emod_emod, ← Int.add_emod] + have h2 : ⌊x⌋ % (n : ℤ) + (k : ℤ) = (((⌊x⌋ % (n : ℤ)).toNat + k : ℕ) : ℤ) := by omega + rw [h1, h2, ← Int.natCast_emod, Int.toNat_natCast] + rw [hmod] + +/-- Rotating a chain `γ` by `k` steps produces a homotopic `concatLoop`. -/ +theorem concatLoop_rotateChain_homotopic {n : ℕ} (hn : 0 < n) (k : ℕ) + (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) : + ClosedCurvesHomotopicIn univ (concatLoop hn γ hmatch) + (concatLoop hn (rotateChain hn k γ) (rotateChain_match hn k γ hmatch)) := by + let H : C(unitInterval × unitInterval, S) := + ⟨fun p => chainReal hn γ ((p.1 : ℝ) * (n : ℝ) + (p.2 : ℝ) * (k : ℝ)), + (continuous_chainReal hn γ hmatch).comp (by fun_prop)⟩ + refine closedCurvesHomotopicIn_of_unitInterval H (fun _ => mem_univ _) + (fun s => ?_) (fun u => ?_) (fun u => ?_) + · change chainReal hn γ (1 * (n : ℝ) + (s : ℝ) * (k : ℝ)) = + chainReal hn γ (0 * (n : ℝ) + (s : ℝ) * (k : ℝ)) + rw [one_mul, zero_mul, zero_add, add_comm (n : ℝ), chainReal_add_nat] + · change chainReal hn γ ((u : ℝ) * (n : ℝ) + 0 * (k : ℝ)) = _ + rw [zero_mul, add_zero, concatLoop_exp_mul] + · change chainReal hn γ ((u : ℝ) * (n : ℝ) + 1 * (k : ℝ)) = _ + rw [one_mul, concatLoop_exp_mul, chainReal_rotateChain] + +/-- The first `n - 1` pieces of a chain `γ : Fin n → C(unitInterval, S)`. -/ +def dropLastChain {n : ℕ} (γ : Fin n → C(unitInterval, S)) (i : Fin (n - 1)) : + C(unitInterval, S) := + γ ⟨i.1, by omega⟩ + +theorem dropLastChain_match {n : ℕ} (hn2 : 2 ≤ n) + (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext (by omega) i) 0) + (hconst : ∀ t : unitInterval, γ ⟨n - 1, by omega⟩ t = γ ⟨0, by omega⟩ 0) + (i : Fin (n - 1)) : + dropLastChain γ i 1 = dropLastChain γ (finNext (by omega : 0 < n - 1) i) 0 := by + dsimp [dropLastChain, finNext] + by_cases hlast : i.1 + 1 = n - 1 + · simp only [hlast, Nat.mod_self] + have hi := hmatch ⟨i.1, by omega⟩ + dsimp [finNext] at hi + have hmod : (i.1 + 1) % n = n - 1 := by + rw [hlast] + exact Nat.mod_eq_of_lt (by omega) + have hi' : γ ⟨i.1, by omega⟩ 1 = γ ⟨n - 1, by omega⟩ 0 := by + simpa [hmod] using hi + exact hi'.trans (hconst 0) + · have hlt : i.1 + 1 < n - 1 := by omega + have hmod1 : (i.1 + 1) % (n - 1) = i.1 + 1 := Nat.mod_eq_of_lt hlt + have hmod2 : (i.1 + 1) % n = i.1 + 1 := Nat.mod_eq_of_lt (by omega) + have hi := hmatch ⟨i.1, by omega⟩ + dsimp [finNext] at hi + simpa [hmod1, hmod2] using hi + +/-- Dropping the last piece of a chain when it is constant gives a homotopic `concatLoop` of `n - 1` +pieces. -/ +theorem concatLoop_drop_last_const {n : ℕ} (hn2 : 2 ≤ n) + (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext (by omega) i) 0) + (hconst : ∀ t : unitInterval, γ ⟨n - 1, by omega⟩ t = γ ⟨0, by omega⟩ 0) : + ClosedCurvesHomotopicIn univ (concatLoop (by omega) γ hmatch) + (concatLoop (by omega : 0 < n - 1) (dropLastChain γ) + (dropLastChain_match hn2 γ hmatch hconst)) := by + have hn : 0 < n := by omega + have hn' : 0 < n - 1 := by omega + let γ' := dropLastChain γ + let hmatch' := dropLastChain_match hn2 γ hmatch hconst + let H : C(unitInterval × unitInterval, S) := + ⟨fun p => chainReal hn γ ((p.1 : ℝ) * ((1 - (p.2 : ℝ)) * (n : ℝ) + (p.2 : ℝ) * + ((n - 1 : ℕ) : ℝ))), + (continuous_chainReal hn γ hmatch).comp (by fun_prop)⟩ + refine closedCurvesHomotopicIn_of_unitInterval H (fun _ => mem_univ _) + (fun s => ?_) (fun u => ?_) (fun u => ?_) + · change chainReal hn γ (1 * ((1 - (s : ℝ)) * (n : ℝ) + (s : ℝ) * ((n - 1 : ℕ) : ℝ))) = + chainReal hn γ (0 * ((1 - (s : ℝ)) * (n : ℝ) + (s : ℝ) * ((n - 1 : ℕ) : ℝ))) + rw [one_mul, zero_mul] + let t : unitInterval := unitInterval.symm s + have ht : (t : ℝ) = 1 - (s : ℝ) := rfl + have h_eq : (1 - (s : ℝ)) * (n : ℝ) + (s : ℝ) * ((n - 1 : ℕ) : ℝ) = + ((n - 1 : ℕ) : ℝ) + (t : ℝ) := by + have hn_eq : (n : ℝ) = ((n - 1 : ℕ) : ℝ) + 1 := by + exact_mod_cast (Nat.sub_add_cancel (by omega : 1 ≤ n)).symm + rw [hn_eq, ht] + ring + have h0 : chainReal hn γ 0 = γ ⟨0, hn⟩ 0 := by + have := chainReal_nat_add hn γ hmatch ⟨0, hn⟩ 0 + simpa using this + rw [h_eq, chainReal_nat_add hn γ hmatch ⟨n - 1, by omega⟩ t, h0] + exact hconst t + · change chainReal hn γ ((u : ℝ) * ((1 - 0) * (n : ℝ) + 0 * ((n - 1 : ℕ) : ℝ))) = _ + rw [sub_zero, one_mul, zero_mul, add_zero, concatLoop_exp_mul] + · change chainReal hn γ ((u : ℝ) * ((1 - 1) * (n : ℝ) + 1 * ((n - 1 : ℕ) : ℝ))) = _ + rw [sub_self, zero_mul, one_mul, zero_add, concatLoop_exp_mul] + by_cases hu1 : (u : ℝ) = 1 + · rw [hu1, one_mul] + have h1 : chainReal hn γ (((n - 1 : ℕ) : ℝ) + ((0 : unitInterval) : ℝ)) = + γ ⟨n - 1, by omega⟩ 0 := chainReal_nat_add hn γ hmatch ⟨n - 1, by omega⟩ 0 + simp only [Set.Icc.coe_zero, add_zero] at h1 + have h2 : chainReal hn' γ' ((0 : ℝ) + ((n - 1 : ℕ) : ℝ)) = chainReal hn' γ' 0 := + chainReal_add_nat hn' γ' 0 + have h3 : chainReal hn' γ' ((((⟨0, hn'⟩ : Fin (n - 1)).1 : ℝ)) + ((0 : unitInterval) : ℝ)) = + γ' ⟨0, hn'⟩ 0 := + chainReal_nat_add hn' γ' hmatch' ⟨0, hn'⟩ 0 + simp only [Nat.cast_zero, Set.Icc.coe_zero, add_zero, zero_add] at h2 h3 + rw [h1, hconst 0, h2, h3] + rfl + · have hu_lt : (u : ℝ) < 1 := lt_of_le_of_ne u.2.2 hu1 + let y : ℝ := (u : ℝ) * ((n - 1 : ℕ) : ℝ) + have hy0 : 0 ≤ y := mul_nonneg u.2.1 (by positivity) + have hnm_pos : (0 : ℝ) < ((n - 1 : ℕ) : ℝ) := by exact_mod_cast hn' + have hy_lt : y < ((n - 1 : ℕ) : ℝ) := by + simpa [y] using mul_lt_of_lt_one_left hnm_pos hu_lt + have hfl_nn : 0 ≤ ⌊y⌋ := Int.floor_nonneg.mpr hy0 + have hfl_lt : ⌊y⌋ < ((n - 1 : ℕ) : ℤ) := by + rw [Int.floor_lt] + exact_mod_cast hy_lt + let k : ℕ := ⌊y⌋.toNat + have hk_lt : k < n - 1 := by omega + have hk_eq : (k : ℝ) + (unitFract y : ℝ) = y := by + have hfl_eq : (k : ℤ) = ⌊y⌋ := Int.toNat_of_nonneg hfl_nn + change ((k : ℤ) : ℝ) + Int.fract y = y + rw [hfl_eq, Int.floor_add_fract] + change chainReal hn γ y = chainReal hn' γ' y + rw [← hk_eq, chainReal_nat_add hn γ hmatch ⟨k, by omega⟩ (unitFract y), + chainReal_nat_add hn' γ' hmatch' ⟨k, hk_lt⟩ (unitFract y)] + rfl + +/-! ## Contracting a Null-Homotopic Loop to a Constant Path Rel Endpoints -/ + +/-- Any closed curve `L : C(Circle, S)` turned into a path `unitInterval → S` (`t ↦ L (Circle.exp (2 +* Real.pi * t))`). -/ +noncomputable def loopToPath (L : C(Circle, S)) : C(unitInterval, S) := + curvePiece one_pos L ⟨0, one_pos⟩ + +@[simp] +theorem loopToPath_zero (L : C(Circle, S)) : loopToPath L 0 = L 1 := by + dsimp [loopToPath, curvePiece] + simp + +@[simp] +theorem loopToPath_one (L : C(Circle, S)) : loopToPath L 1 = L 1 := by + dsimp [loopToPath, curvePiece] + simp [Circle.exp_two_pi] + +theorem loopToPath_apply (L : C(Circle, S)) (t : unitInterval) : + loopToPath L t = L (Circle.exp (2 * Real.pi * (t : ℝ))) := by + dsimp [loopToPath, curvePiece] + simp + +/-- If `L : C(Circle, S)` is null-homotopic in `univ`, then `loopToPath L` is path-homotopic in +`univ` relative to `{0, 1}` to the constant path `ContinuousMap.const unitInterval (L 1)`. -/ +theorem pathsHomotopicRelIn_const_of_nullHomotopic {L : C(Circle, S)} + (hnull : ClosedCurveIsNullHomotopicIn univ L) : + PathsHomotopicRelIn univ (loopToPath L) (ContinuousMap.const unitInterval (L 1)) := by + obtain ⟨c, _, Ψ, _, hΨ0, hΨ1⟩ := hnull + let β : C(unitInterval, S) := ⟨fun s => Ψ (1, s), Ψ.continuous.comp + (continuous_const.prodMk continuous_id)⟩ + have hβ0 : β 0 = L 1 := hΨ0 1 + have hβ1 : β 1 = c := hΨ1 1 + -- Homotopy 1: reparameterize `loopToPath L` to stay at `L 1` on `[0, 1/3]` and `[2/3, 1]`. + have hL0 : (ContinuousMap.const unitInterval (L 1)) 1 = loopToPath L 0 := + (loopToPath_zero L).symm + have hL1 : (ContinuousMap.const unitInterval (L 1)) 1 = loopToPath L 1 := + (loopToPath_one L).symm + let H₁ : C(unitInterval × unitInterval, S) := + reparamHomotopy (ContinuousMap.const unitInterval (L 1)) (loopToPath L) + (ContinuousMap.const unitInterval (L 1)) hL0 hL1 + -- Homotopy 2: deform the middle `[1/3, 2/3]` via `Ψ` while whiskering on `[0, 1/3]` and `[2/3, + -- 1]` by `β`. + let g₁ : unitInterval × unitInterval → S := fun p => + β (projIcc 0 1 zero_le_one ((p.2 : ℝ) * (3 * (p.1 : ℝ)))) + let g₂ : unitInterval × unitInterval → S := fun p => + Ψ (Circle.exp (2 * Real.pi * (projIcc 0 1 zero_le_one (3 * (p.1 : ℝ) - 1) : ℝ)), p.2) + let g₃ : unitInterval × unitInterval → S := fun p => + β (projIcc 0 1 zero_le_one ((p.2 : ℝ) * (3 * (1 - (p.1 : ℝ))))) + have hg₁ : Continuous g₁ := by fun_prop + have hg₂ : Continuous g₂ := by fun_prop + have hg₃ : Continuous g₃ := by fun_prop + let g₁₂ : unitInterval × unitInterval → S := + fun p => if (p.1 : ℝ) ≤ 1 / 3 then g₁ p else g₂ p + have hg₁₂ : Continuous g₁₂ := by + refine Continuous.if_le hg₁ hg₂ (continuous_subtype_val.comp continuous_fst) continuous_const ?_ + intro p hp + have hp_s : projIcc 0 1 zero_le_one ((p.2 : ℝ) * (3 * (p.1 : ℝ))) = p.2 := by + rw [hp, show (p.2 : ℝ) * (3 * (1 / 3 : ℝ)) = (p.2 : ℝ) by ring] + exact projIcc_of_mem zero_le_one p.2.2 + have hp0 : projIcc 0 1 zero_le_one (3 * (p.1 : ℝ) - 1) = 0 := by + rw [hp]; ext; simp + change β _ = Ψ _ + rw [hp_s, hp0] + simp [β] + let g_all : unitInterval × unitInterval → S := + fun p => if (p.1 : ℝ) ≤ 2 / 3 then g₁₂ p else g₃ p + have hg_all : Continuous g_all := by + refine Continuous.if_le hg₁₂ hg₃ (continuous_subtype_val.comp continuous_fst) continuous_const + ?_ + intro p hp + have hnot : ¬ ((p.1 : ℝ) ≤ 1 / 3) := by linarith + have hp1 : projIcc 0 1 zero_le_one (3 * (p.1 : ℝ) - 1) = 1 := by + rw [hp]; ext; change max (0 : ℝ) (min 1 (3 * (2 / 3) - 1)) = 1; norm_num + have hp_s : projIcc 0 1 zero_le_one ((p.2 : ℝ) * (3 * (1 - (p.1 : ℝ)))) = p.2 := by + rw [hp, show (p.2 : ℝ) * (3 * (1 - (2 / 3 : ℝ))) = (p.2 : ℝ) by ring] + exact projIcc_of_mem zero_le_one p.2.2 + dsimp [g₁₂] + simp only [hnot, ↓reduceIte] + change Ψ _ = β _ + rw [hp1, hp_s] + simp [β, Circle.exp_two_pi] + let H₂ : C(unitInterval × unitInterval, S) := ⟨g_all, hg_all⟩ + -- Homotopy 3: contract the `β`-loop back to `β 0 = L 1`. + let H₃ : C(unitInterval × unitInterval, S) := + ⟨fun p => β (projIcc 0 1 zero_le_one + ((1 - (p.2 : ℝ)) * min (3 * (p.1 : ℝ)) (3 * (1 - (p.1 : ℝ))))), by fun_prop⟩ + have h12 : ∀ t : unitInterval, H₁ (t, 1) = H₂ (t, 0) := by + intro t + dsimp [H₁] + rw [reparamHomotopy_one] + simp only [whiskerHomotopy, H₂, g_all, g₁₂, g₁, g₂, g₃, + ContinuousMap.coe_mk, ContinuousMap.const_apply] + split_ifs with h23 h13 + · have h0 : projIcc 0 1 zero_le_one (((0 : unitInterval) : ℝ) * (3 * (t : ℝ))) = 0 := by + rw [Icc.coe_zero, zero_mul] + exact projIcc_of_mem zero_le_one (left_mem_Icc.mpr zero_le_one) + rw [h0, hβ0] + · rw [hΨ0, loopToPath_apply] + · have h0 : projIcc 0 1 zero_le_one (((0 : unitInterval) : ℝ) * (3 * (1 - (t : ℝ)))) = 0 := by + rw [Icc.coe_zero, zero_mul] + exact projIcc_of_mem zero_le_one (left_mem_Icc.mpr zero_le_one) + rw [h0, hβ0] + have h23_match : ∀ t : unitInterval, H₂ (t, 1) = H₃ (t, 0) := by + intro t + dsimp [H₂, H₃, g_all, g₁₂, g₁, g₂, g₃] + simp only [sub_zero, one_mul] + split_ifs with h23 h13 + · have hmin : min (3 * (t : ℝ)) (3 * (1 - (t : ℝ))) = 3 * (t : ℝ) := + min_eq_left (by linarith) + rw [hmin] + · have hge1 : 1 ≤ min (3 * (t : ℝ)) (3 * (1 - (t : ℝ))) := + le_min (by linarith) (by linarith) + rw [projIcc_of_right_le zero_le_one hge1, hΨ1] + exact hβ1.symm + · have hmin : min (3 * (t : ℝ)) (3 * (1 - (t : ℝ))) = 3 * (1 - (t : ℝ)) := + min_eq_right (by linarith) + rw [hmin] + let s₁ : unitInterval × unitInterval → unitInterval × unitInterval := + fun p => (p.1, projIcc 0 1 zero_le_one (3 * (p.2 : ℝ))) + let s₂ : unitInterval × unitInterval → unitInterval × unitInterval := + fun p => (p.1, projIcc 0 1 zero_le_one (3 * (p.2 : ℝ) - 1)) + let s₃ : unitInterval × unitInterval → unitInterval × unitInterval := + fun p => (p.1, projIcc 0 1 zero_le_one (3 * (p.2 : ℝ) - 2)) + let F₁₂ : unitInterval × unitInterval → S := + fun p => if (p.2 : ℝ) ≤ 1 / 3 then H₁ (s₁ p) else H₂ (s₂ p) + have hF₁₂ : Continuous F₁₂ := by + refine Continuous.if_le (by fun_prop) (by fun_prop) + (continuous_subtype_val.comp continuous_snd) continuous_const ?_ + intro p hp + have hp1 : projIcc 0 1 zero_le_one (3 * (p.2 : ℝ)) = 1 := by + rw [hp]; ext; change max (0 : ℝ) (min 1 (3 * (1 / 3))) = 1; norm_num + have hp0 : projIcc 0 1 zero_le_one (3 * (p.2 : ℝ) - 1) = 0 := by + rw [hp]; ext; simp + change H₁ (p.1, _) = H₂ (p.1, _) + rw [hp1, hp0, h12] + let F_all : unitInterval × unitInterval → S := + fun p => if (p.2 : ℝ) ≤ 2 / 3 then F₁₂ p else H₃ (s₃ p) + have hF_all : Continuous F_all := by + refine Continuous.if_le hF₁₂ (by fun_prop) + (continuous_subtype_val.comp continuous_snd) continuous_const ?_ + intro p hp + have hnot : ¬ ((p.2 : ℝ) ≤ 1 / 3) := by linarith + have hp1 : projIcc 0 1 zero_le_one (3 * (p.2 : ℝ) - 1) = 1 := by + rw [hp]; ext; change max (0 : ℝ) (min 1 (3 * (2 / 3) - 1)) = 1; norm_num + have hp0 : projIcc 0 1 zero_le_one (3 * (p.2 : ℝ) - 2) = 0 := by + rw [hp]; ext; change max (0 : ℝ) (min 1 (3 * (2 / 3) - 2)) = 0; norm_num + dsimp [F₁₂] + simp only [hnot, ↓reduceIte] + change H₂ (p.1, _) = H₃ (p.1, _) + rw [hp1, hp0, h23_match] + refine ⟨⟨F_all, hF_all⟩, fun _ => mem_univ _, fun t => ?_, fun t => ?_, fun s => ?_, fun s => ?_⟩ + · dsimp [F_all, F₁₂, s₁, H₁] + split_ifs with h1 h2 + · have hp0 : projIcc 0 1 zero_le_one (3 * (0 : ℝ)) = 0 := by + rw [mul_zero]; exact projIcc_of_mem zero_le_one (left_mem_Icc.mpr zero_le_one) + rw [hp0] + exact reparamHomotopy_zero _ _ _ _ _ t + · norm_num at h2 + · norm_num at h1 + · dsimp [F_all, s₃] + split_ifs with h1 + · norm_num at h1 + · have hp1 : projIcc 0 1 zero_le_one (3 * (1 : ℝ) - 2) = 1 := by + ext; change max (0 : ℝ) (min 1 (3 * 1 - 2)) = 1; norm_num + rw [hp1] + dsimp [H₃] + simp only [sub_self, zero_mul] + have h0 : projIcc 0 1 zero_le_one (0 : ℝ) = 0 := + projIcc_of_mem zero_le_one (left_mem_Icc.mpr zero_le_one) + rw [h0, hβ0] + · dsimp [F_all, F₁₂, s₁, s₂, s₃, H₁] + split_ifs with h1 h2 + · exact reparamHomotopy_left _ _ _ _ _ _ + · dsimp [H₂, g_all, g₁₂, g₁] + split_ifs with h3 h4 + · simp only [mul_zero] + have h0 : projIcc 0 1 zero_le_one (0 : ℝ) = 0 := + projIcc_of_mem zero_le_one (left_mem_Icc.mpr zero_le_one) + rw [h0, hβ0, loopToPath_zero] + · norm_num at h4 + · norm_num at h3 + · dsimp [H₃] + have harg : (1 - (projIcc 0 1 zero_le_one (3 * (s : ℝ) - 2) : ℝ)) * + min (3 * 0) (3 * (1 - 0)) = 0 := by norm_num + have h0 : projIcc 0 1 zero_le_one (0 : ℝ) = 0 := + projIcc_of_mem zero_le_one (left_mem_Icc.mpr zero_le_one) + rw [harg, h0, hβ0, loopToPath_zero] + · dsimp [F_all, F₁₂, s₁, s₂, s₃, H₁] + split_ifs with h1 h2 + · exact reparamHomotopy_right _ _ _ _ _ _ + · dsimp [H₂, g_all, g₃] + split_ifs with h3 + · norm_num at h3 + · simp only [sub_self, mul_zero] + have h0 : projIcc 0 1 zero_le_one (0 : ℝ) = 0 := + projIcc_of_mem zero_le_one (left_mem_Icc.mpr zero_le_one) + rw [h0, hβ0, loopToPath_one] + · dsimp [H₃] + have harg : (1 - (projIcc 0 1 zero_le_one (3 * (s : ℝ) - 2) : ℝ)) * + min (3 * 1) (3 * (1 - 1)) = 0 := by norm_num + have h0 : projIcc 0 1 zero_le_one (0 : ℝ) = 0 := + projIcc_of_mem zero_le_one (left_mem_Icc.mpr zero_le_one) + rw [harg, h0, hβ0, loopToPath_one] + +/-! ## Splitting a Loop at a Non-Adjacent Self-Intersection -/ + +/-- First sub-chain when splitting `γ` at `γ ⟨0, hn⟩ s = γ j t`. -/ +noncomputable def splitChain₁ {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) + (j : Fin n) (s t : unitInterval) (k : Fin (j.1 + 1)) : C(unitInterval, S) := + if k.1 = 0 then subPathSeg (γ ⟨0, hn⟩) s 1 + else if hkj : k.1 < j.1 then γ ⟨k.1, Nat.lt_trans hkj j.2⟩ + else subPathSeg (γ j) 0 t + +/-- Second sub-chain when splitting `γ` at `γ ⟨0, hn⟩ s = γ j t`. -/ +noncomputable def splitChain₂ {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) + (j : Fin n) (s t : unitInterval) (k : Fin (n - j.1 + 1)) : C(unitInterval, S) := + if k.1 = 0 then subPathSeg (γ j) t 1 + else if hkn : k.1 < n - j.1 then γ ⟨j.1 + k.1, by omega⟩ + else subPathSeg (γ ⟨0, hn⟩) 0 s + +theorem splitChain₁_match {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) + (j : Fin n) (hj1 : 2 ≤ j.1) (s t : unitInterval) (heq : γ ⟨0, hn⟩ s = γ j t) + (k : Fin (j.1 + 1)) : + splitChain₁ hn γ j s t k 1 = + splitChain₁ hn γ j s t (finNext (by omega : 0 < j.1 + 1) k) 0 := by + have ha : 0 < j.1 + 1 := by omega + by_cases hk0 : k.1 = 0 + · have hfn : finNext ha k = ⟨1, by omega⟩ := by + ext; dsimp [finNext]; rw [hk0]; exact Nat.mod_eq_of_lt (by omega) + rw [hfn] + dsimp [splitChain₁] + simp only [hk0, ↓reduceIte, ↓reduceDIte, show 1 < j.1 by omega, subPathSeg_one] + have h0 := hmatch ⟨0, hn⟩ + have hfn0 : finNext hn ⟨0, hn⟩ = ⟨1, by omega⟩ := by + ext; dsimp [finNext]; exact Nat.mod_eq_of_lt (by omega) + rwa [hfn0] at h0 + · by_cases hkj : k.1 < j.1 + · by_cases hk_last : k.1 + 1 = j.1 + · have hfn : finNext ha k = ⟨j.1, by omega⟩ := by + ext; dsimp [finNext]; rw [hk_last]; exact Nat.mod_eq_of_lt (by omega) + rw [hfn] + dsimp [splitChain₁] + simp only [hk0, hkj, ↓reduceIte, ↓reduceDIte, show j.1 ≠ 0 by omega, lt_irrefl, + subPathSeg_zero] + have hk_m := hmatch ⟨k.1, by omega⟩ + have hfn_n : finNext hn ⟨k.1, by omega⟩ = j := by + ext; dsimp [finNext]; rw [hk_last]; exact Nat.mod_eq_of_lt j.2 + rwa [hfn_n] at hk_m + · have hlt' : k.1 + 1 < j.1 := by omega + have hfn : finNext ha k = ⟨k.1 + 1, by omega⟩ := by + ext; dsimp [finNext]; exact Nat.mod_eq_of_lt (by omega) + rw [hfn] + dsimp [splitChain₁] + simp only [hk0, hkj, ↓reduceIte, ↓reduceDIte, hlt'] + have hk_m := hmatch ⟨k.1, by omega⟩ + have hfn_n : finNext hn ⟨k.1, by omega⟩ = ⟨k.1 + 1, by omega⟩ := by + ext; dsimp [finNext]; exact Nat.mod_eq_of_lt (by omega) + rwa [hfn_n] at hk_m + · have hk_eq : k.1 = j.1 := by omega + have hfn : finNext ha k = ⟨0, ha⟩ := by + ext; dsimp [finNext]; rw [hk_eq, Nat.mod_self] + rw [hfn] + dsimp [splitChain₁] + simp only [hk0, hkj, ↓reduceIte, ↓reduceDIte, subPathSeg_one, subPathSeg_zero] + exact heq.symm + +theorem splitChain₂_match {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) + (j : Fin n) (hj2 : j.1 + 2 ≤ n) (s t : unitInterval) (heq : γ ⟨0, hn⟩ s = γ j t) + (k : Fin (n - j.1 + 1)) : + splitChain₂ hn γ j s t k 1 = + splitChain₂ hn γ j s t (finNext (by omega : 0 < n - j.1 + 1) k) 0 := by + have hb : 0 < n - j.1 + 1 := by omega + by_cases hk0 : k.1 = 0 + · have hfn : finNext hb k = ⟨1, by omega⟩ := by + ext; dsimp [finNext]; rw [hk0]; exact Nat.mod_eq_of_lt (by omega) + rw [hfn] + dsimp [splitChain₂] + simp only [hk0, ↓reduceIte, ↓reduceDIte, show 1 < n - j.1 by omega, subPathSeg_one] + have hj_m := hmatch j + have hfn_n : finNext hn j = ⟨j.1 + 1, by omega⟩ := by + ext; dsimp [finNext]; exact Nat.mod_eq_of_lt (by omega) + rwa [hfn_n] at hj_m + · by_cases hkn : k.1 < n - j.1 + · by_cases hk_last : k.1 + 1 = n - j.1 + · have hfn : finNext hb k = ⟨n - j.1, by omega⟩ := by + ext; dsimp [finNext]; rw [hk_last]; exact Nat.mod_eq_of_lt (by omega) + rw [hfn] + dsimp [splitChain₂] + simp only [hk0, hkn, ↓reduceIte, ↓reduceDIte, show n - j.1 ≠ 0 by omega, lt_irrefl, + subPathSeg_zero] + have hk_m := hmatch ⟨j.1 + k.1, by omega⟩ + have hfn_n : finNext hn ⟨j.1 + k.1, by omega⟩ = ⟨0, hn⟩ := by + ext; dsimp [finNext]; rw [show j.1 + k.1 + 1 = n by omega, Nat.mod_self] + rwa [hfn_n] at hk_m + · have hlt' : k.1 + 1 < n - j.1 := by omega + have hfn : finNext hb k = ⟨k.1 + 1, by omega⟩ := by + ext; dsimp [finNext]; exact Nat.mod_eq_of_lt (by omega) + rw [hfn] + dsimp [splitChain₂] + simp only [hk0, hkn, ↓reduceIte, ↓reduceDIte, hlt'] + have hk_m := hmatch ⟨j.1 + k.1, by omega⟩ + have hfn_n : finNext hn ⟨j.1 + k.1, by omega⟩ = ⟨j.1 + (k.1 + 1), by omega⟩ := by + ext; dsimp [finNext] + rw [show j.1 + k.1 + 1 = j.1 + (k.1 + 1) by omega] + exact Nat.mod_eq_of_lt (by omega) + rwa [hfn_n] at hk_m + · have hk_eq : k.1 = n - j.1 := by omega + have hfn : finNext hb k = ⟨0, hb⟩ := by + ext; dsimp [finNext]; rw [hk_eq, Nat.mod_self] + rw [hfn] + dsimp [splitChain₂] + simp only [hk0, hkn, ↓reduceIte, ↓reduceDIte, subPathSeg_one, subPathSeg_zero] + exact heq + +private theorem agrees_with_loop_path_of_piece_agreement + {m : ℕ} (hm : 0 < m) (δ : Fin m → C(unitInterval, S)) + (hmatch : ∀ k : Fin m, δ k 1 = δ (finNext hm k) 0) + (F : ℝ → S) (hpiece : ∀ (k : Fin m) (r : unitInterval), + F ((k.1 : ℝ) + (r : ℝ)) = δ k r) (τ : unitInterval) : + F ((τ : ℝ) * (m : ℝ)) = loopToPath (concatLoop hm δ hmatch) τ := by + rw [loopToPath_apply, concatLoop_exp_mul] + by_cases hτ1 : (τ : ℝ) = 1 + · rw [hτ1, one_mul] + have hlast : m - 1 < m := Nat.sub_lt hm zero_lt_one + have hcast : (m : ℝ) = ((m - 1 : ℕ) : ℝ) + ((1 : unitInterval) : ℝ) := by + rw [Set.Icc.coe_one] + exact_mod_cast (Nat.sub_add_cancel hm).symm + have hperiod : chainReal hm δ (m : ℝ) = chainReal hm δ 0 := by + simpa only [zero_add] using chainReal_add_nat hm δ 0 + have hstart : chainReal hm δ 0 = δ ⟨0, hm⟩ 0 := by + simpa only [Nat.cast_zero, Set.Icc.coe_zero, add_zero] using + chainReal_nat_add hm δ hmatch ⟨0, hm⟩ 0 + have hnext : finNext hm ⟨m - 1, hlast⟩ = ⟨0, hm⟩ := by + ext + dsimp [finNext] + rw [Nat.sub_add_cancel hm, Nat.mod_self] + calc + F (m : ℝ) = δ ⟨m - 1, hlast⟩ 1 := hcast.symm ▸ hpiece ⟨m - 1, hlast⟩ 1 + _ = δ ⟨0, hm⟩ 0 := by rw [hmatch, hnext] + _ = chainReal hm δ (m : ℝ) := (hperiod.trans hstart).symm + · have hτ_lt : (τ : ℝ) < 1 := lt_of_le_of_ne τ.2.2 hτ1 + let y : ℝ := (τ : ℝ) * (m : ℝ) + have hy0 : 0 ≤ y := mul_nonneg τ.2.1 (by positivity) + have hm_pos : (0 : ℝ) < (m : ℝ) := by exact_mod_cast hm + have hy_lt : y < (m : ℝ) := mul_lt_of_lt_one_left hm_pos hτ_lt + have hfl_nn : 0 ≤ ⌊y⌋ := Int.floor_nonneg.mpr hy0 + have hfl_lt : ⌊y⌋ < (m : ℤ) := by rw [Int.floor_lt]; exact_mod_cast hy_lt + let k : ℕ := ⌊y⌋.toNat + have hk_lt : k < m := by omega + have hk_eq : (k : ℝ) + (unitFract y : ℝ) = y := by + have hfl_eq : (k : ℤ) = ⌊y⌋ := Int.toNat_of_nonneg hfl_nn + change ((k : ℤ) : ℝ) + Int.fract y = y + rw [hfl_eq, Int.floor_add_fract] + change F y = chainReal hm δ y + rw [← hk_eq, hpiece ⟨k, hk_lt⟩ (unitFract y), + chainReal_nat_add hm δ hmatch ⟨k, hk_lt⟩ (unitFract y)] + +private theorem chainReal_split_first + {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) + (j : Fin n) (s t : unitInterval) + {u₁ : ℝ → ℝ} + (hu₁_left : ∀ y : ℝ, y ≤ 1 → u₁ y = (1 - y) * (s : ℝ) + y) + (hu₁_mid : ∀ y : ℝ, 1 ≤ y → y ≤ (j.1 : ℝ) → u₁ y = y) + (hu₁_right : ∀ y : ℝ, (j.1 : ℝ) ≤ y → + u₁ y = (j.1 : ℝ) + (y - (j.1 : ℝ)) * (t : ℝ)) + (k : Fin (j.1 + 1)) (r : unitInterval) : + chainReal hn γ (u₁ ((k.1 : ℝ) + (r : ℝ))) = splitChain₁ hn γ j s t k r := by + dsimp [splitChain₁] + by_cases hk0 : k.1 = 0 + · simp only [hk0, ↓reduceIte, Nat.cast_zero, zero_add] + rw [hu₁_left (r : ℝ) r.2.2] + let v : unitInterval := ⟨(1 - (r : ℝ)) * (s : ℝ) + (r : ℝ) * 1, + by nlinarith [r.2.1, r.2.2, s.2.1], by nlinarith [r.2.1, r.2.2, s.2.2]⟩ + have hv : (1 - (r : ℝ)) * (s : ℝ) + (r : ℝ) = ((0 : ℕ) : ℝ) + (v : ℝ) := by + dsimp [v]; ring + rw [hv, chainReal_nat_add hn γ hmatch ⟨0, hn⟩ v] + rfl + · by_cases hkj : k.1 < j.1 + · simp only [hk0, hkj, ↓reduceIte, ↓reduceDIte] + have hk1 : (1 : ℝ) ≤ (k.1 : ℝ) := by exact_mod_cast (by omega : 1 ≤ k.1) + have hkj' : (k.1 : ℝ) + 1 ≤ (j.1 : ℝ) := by exact_mod_cast (by omega : k.1 + 1 ≤ j.1) + rw [hu₁_mid ((k.1 : ℝ) + (r : ℝ)) (by linarith [r.2.1]) (by linarith [r.2.2]), + chainReal_nat_add hn γ hmatch ⟨k.1, by omega⟩ r] + · have hk_eq : k.1 = j.1 := by omega + simp only [hk0, hkj, ↓reduceIte, ↓reduceDIte] + rw [hk_eq, hu₁_right ((j.1 : ℝ) + (r : ℝ)) (by linarith [r.2.1])] + let v : unitInterval := ⟨(1 - (r : ℝ)) * 0 + (r : ℝ) * (t : ℝ), + by nlinarith [r.2.1, r.2.2, t.2.1], by nlinarith [r.2.1, r.2.2, t.2.2]⟩ + have hv : (j.1 : ℝ) + ((j.1 : ℝ) + (r : ℝ) - (j.1 : ℝ)) * (t : ℝ) = + (j.1 : ℝ) + (v : ℝ) := by dsimp [v]; ring + rw [hv, chainReal_nat_add hn γ hmatch j v] + rfl + +private theorem chainReal_split_second + {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) + (j : Fin n) (s t : unitInterval) + {u₂ : ℝ → ℝ} + (hu₂_left : ∀ y : ℝ, y ≤ 1 → u₂ y = (j.1 : ℝ) + (1 - y) * (t : ℝ) + y) + (hu₂_mid : ∀ y : ℝ, 1 ≤ y → y ≤ ((n - j.1 : ℕ) : ℝ) → u₂ y = (j.1 : ℝ) + y) + (hu₂_right : ∀ y : ℝ, ((n - j.1 : ℕ) : ℝ) ≤ y → + u₂ y = (n : ℝ) + (y - ((n - j.1 : ℕ) : ℝ)) * (s : ℝ)) + (k : Fin (n - j.1 + 1)) (r : unitInterval) : + chainReal hn γ (u₂ ((k.1 : ℝ) + (r : ℝ))) = splitChain₂ hn γ j s t k r := by + dsimp [splitChain₂] + by_cases hk0 : k.1 = 0 + · simp only [hk0, ↓reduceIte, Nat.cast_zero, zero_add] + rw [hu₂_left (r : ℝ) r.2.2] + let v : unitInterval := ⟨(1 - (r : ℝ)) * (t : ℝ) + (r : ℝ) * 1, + by nlinarith [r.2.1, r.2.2, t.2.1], by nlinarith [r.2.1, r.2.2, t.2.2]⟩ + have hv : (j.1 : ℝ) + (1 - (r : ℝ)) * (t : ℝ) + (r : ℝ) = (j.1 : ℝ) + (v : ℝ) := by + dsimp [v]; ring + rw [hv, chainReal_nat_add hn γ hmatch j v] + rfl + · by_cases hkn : k.1 < n - j.1 + · simp only [hk0, hkn, ↓reduceIte, ↓reduceDIte] + have hk1 : (1 : ℝ) ≤ (k.1 : ℝ) := by exact_mod_cast (by omega : 1 ≤ k.1) + have hkn' : (k.1 : ℝ) + 1 ≤ ((n - j.1 : ℕ) : ℝ) := by + exact_mod_cast (by omega : k.1 + 1 ≤ n - j.1) + rw [hu₂_mid ((k.1 : ℝ) + (r : ℝ)) (by linarith [r.2.1]) (by linarith [r.2.2])] + have hsum : (j.1 : ℝ) + ((k.1 : ℝ) + (r : ℝ)) = (((j.1 + k.1 : ℕ) : ℝ) + (r : ℝ)) := by + push_cast; ring + rw [hsum, chainReal_nat_add hn γ hmatch ⟨j.1 + k.1, by omega⟩ r] + · have hk_eq : k.1 = n - j.1 := by omega + simp only [hk0, hkn, ↓reduceIte, ↓reduceDIte] + rw [hk_eq, hu₂_right (((n - j.1 : ℕ) : ℝ) + (r : ℝ)) (by linarith [r.2.1])] + let v : unitInterval := ⟨(1 - (r : ℝ)) * 0 + (r : ℝ) * (s : ℝ), + by nlinarith [r.2.1, r.2.2, s.2.1], by nlinarith [r.2.1, r.2.2, s.2.2]⟩ + have hv : (n : ℝ) + (((n - j.1 : ℕ) : ℝ) + (r : ℝ) - ((n - j.1 : ℕ) : ℝ)) * (s : ℝ) = + (((0 : ℕ) : ℝ) + (v : ℝ)) + (n : ℝ) := by dsimp [v]; ring + rw [hv, chainReal_add_nat, chainReal_nat_add hn γ hmatch ⟨0, hn⟩ v] + rfl + +private theorem homotopic_of_two_piece_reparam + {n : ℕ} (hn : 0 < n) (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) + (j : Fin n) (s t : unitInterval) + {u₁ u₂ : ℝ → ℝ} (hu₁_cont : Continuous u₁) (hu₂_cont : Continuous u₂) + (hu₁_left : ∀ y : ℝ, y ≤ 1 → u₁ y = (1 - y) * (s : ℝ) + y) + (hu₁_right : ∀ y : ℝ, (j.1 : ℝ) ≤ y → + u₁ y = (j.1 : ℝ) + (y - (j.1 : ℝ)) * (t : ℝ)) + (hu₂_left : ∀ y : ℝ, y ≤ 1 → u₂ y = (j.1 : ℝ) + (1 - y) * (t : ℝ) + y) + (hu₂_right : ∀ y : ℝ, ((n - j.1 : ℕ) : ℝ) ≤ y → + u₂ y = (n : ℝ) + (y - ((n - j.1 : ℕ) : ℝ)) * (s : ℝ)) + (htwo : 0 < 2) (δ : Fin 2 → C(unitInterval, S)) + (hmatch_δ : ∀ i : Fin 2, δ i 1 = δ (finNext htwo i) 0) + (hf_u₁_all : ∀ τ : unitInterval, + chainReal hn γ (u₁ ((τ : ℝ) * ((j.1 + 1 : ℕ) : ℝ))) = δ ⟨0, htwo⟩ τ) + (hf_u₂_all : ∀ τ : unitInterval, + chainReal hn γ (u₂ ((τ : ℝ) * ((n - j.1 + 1 : ℕ) : ℝ))) = δ ⟨1, by omega⟩ τ) : + ClosedCurvesHomotopicIn univ (concatLoop hn γ hmatch) (concatLoop htwo δ hmatch_δ) := by + let β_map : ℝ → ℝ := fun x => + if x ≤ 1 / 2 then u₁ (2 * x * ((j.1 + 1 : ℕ) : ℝ)) + else u₂ ((2 * x - 1) * ((n - j.1 + 1 : ℕ) : ℝ)) + have hβ_cont : Continuous β_map := by + refine Continuous.if_le (hu₁_cont.comp (by fun_prop)) (hu₂_cont.comp (by fun_prop)) + continuous_id continuous_const ?_ + intro x hx + rw [hx] + have h1 : (2 : ℝ) * (1 / 2) * ((j.1 + 1 : ℕ) : ℝ) = (j.1 : ℝ) + 1 := by push_cast; ring + have h2 : ((2 : ℝ) * (1 / 2) - 1) * ((n - j.1 + 1 : ℕ) : ℝ) = 0 := by ring + rw [h1, h2, hu₁_right ((j.1 : ℝ) + 1) (by linarith), hu₂_left 0 zero_le_one] + ring + let H_reparam : C(unitInterval × unitInterval, S) := + ⟨fun p => chainReal hn γ ((1 - (p.2 : ℝ)) * ((p.1 : ℝ) * (n : ℝ)) + (p.2 : ℝ) * β_map + (p.1 : ℝ)), + (continuous_chainReal hn γ hmatch).comp (by fun_prop)⟩ + refine closedCurvesHomotopicIn_of_unitInterval H_reparam (fun _ => mem_univ _) + (fun r => ?_) (fun u => ?_) (fun u => ?_) + · change chainReal hn γ ((1 - (r : ℝ)) * (1 * (n : ℝ)) + (r : ℝ) * β_map 1) = + chainReal hn γ ((1 - (r : ℝ)) * (0 * (n : ℝ)) + (r : ℝ) * β_map 0) + have hβ0 : β_map 0 = (s : ℝ) := by + dsimp [β_map] + have h0_le : (0 : ℝ) ≤ 1 / 2 := by norm_num + simp only [h0_le, ↓reduceIte, mul_zero, zero_mul] + rw [hu₁_left 0 zero_le_one] + ring + have hβ1 : β_map 1 = (n : ℝ) + (s : ℝ) := by + dsimp [β_map] + have hnot : ¬ ((1 : ℝ) ≤ 1 / 2) := by norm_num + simp only [hnot, ↓reduceIte] + have h1 : (2 * (1 : ℝ) - 1) * ((n - j.1 + 1 : ℕ) : ℝ) = ((n - j.1 : ℕ) : ℝ) + 1 := by + push_cast; ring + rw [h1, hu₂_right (((n - j.1 : ℕ) : ℝ) + 1) (by linarith)] + ring + rw [hβ0, hβ1, + show (1 - (r : ℝ)) * (1 * (n : ℝ)) + (r : ℝ) * ((n : ℝ) + (s : ℝ)) = + ((1 - (r : ℝ)) * (0 * (n : ℝ)) + (r : ℝ) * (s : ℝ)) + (n : ℝ) by ring, + chainReal_add_nat] + · change chainReal hn γ ((1 - 0) * ((u : ℝ) * (n : ℝ)) + 0 * β_map (u : ℝ)) = _ + rw [sub_zero, one_mul, zero_mul, add_zero, concatLoop_exp_mul] + · change chainReal hn γ ((1 - 1) * ((u : ℝ) * (n : ℝ)) + 1 * β_map (u : ℝ)) = _ + rw [sub_self, zero_mul, one_mul, zero_add, concatLoop_exp_mul] + dsimp [β_map] + split_ifs with hu + · let τ : unitInterval := ⟨2 * (u : ℝ), by linarith [u.2.1], by linarith⟩ + have h1 : 2 * (u : ℝ) * ((j.1 + 1 : ℕ) : ℝ) = (τ : ℝ) * ((j.1 + 1 : ℕ) : ℝ) := rfl + have h2 : (u : ℝ) * (2 : ℝ) = ((0 : ℕ) : ℝ) + (τ : ℝ) := by dsimp [τ]; ring + rw [h1, hf_u₁_all τ, h2, chainReal_nat_add htwo δ hmatch_δ ⟨0, htwo⟩ τ] + · have hgt : 1 / 2 < (u : ℝ) := not_le.mp hu + let τ : unitInterval := ⟨2 * (u : ℝ) - 1, by linarith, by linarith [u.2.2]⟩ + have h1 : (2 * (u : ℝ) - 1) * ((n - j.1 + 1 : ℕ) : ℝ) = + (τ : ℝ) * ((n - j.1 + 1 : ℕ) : ℝ) := rfl + have h2 : (u : ℝ) * (2 : ℝ) = ((1 : ℕ) : ℝ) + (τ : ℝ) := by dsimp [τ]; ring + rw [h1, hf_u₂_all τ, h2, chainReal_nat_add htwo δ hmatch_δ ⟨1, by omega⟩ τ] + +/-- If `γ : Fin n → C(unitInterval, S)` has `γ ⟨0, hn⟩ s = γ j t` with `2 ≤ j.1` and `j.1 + 2 ≤ n`, +and both resulting sub-loops of `< n` pieces are null-homotopic in `univ`, then `concatLoop hn γ` +is null-homotopic in `univ`. -/ +theorem nullHomotopic_of_split_nonadjacent {n : ℕ} (hn : 0 < n) + (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) + (j : Fin n) (hj1 : 2 ≤ j.1) (hj2 : j.1 + 2 ≤ n) + (s t : unitInterval) (heq : γ ⟨0, hn⟩ s = γ j t) + (hnull₁ : ClosedCurveIsNullHomotopicIn univ + (concatLoop (by omega : 0 < j.1 + 1) (splitChain₁ hn γ j s t) + (splitChain₁_match hn γ hmatch j hj1 s t heq))) + (hnull₂ : ClosedCurveIsNullHomotopicIn univ + (concatLoop (by omega : 0 < n - j.1 + 1) (splitChain₂ hn γ j s t) + (splitChain₂_match hn γ hmatch j hj2 s t heq))) : + ClosedCurveIsNullHomotopicIn univ (concatLoop hn γ hmatch) := by + have ha : 0 < j.1 + 1 := by omega + have hb : 0 < n - j.1 + 1 := by omega + let γ₁ := splitChain₁ hn γ j s t + let γ₂ := splitChain₂ hn γ j s t + let hmatch₁ := splitChain₁_match hn γ hmatch j hj1 s t heq + let hmatch₂ := splitChain₂_match hn γ hmatch j hj2 s t heq + let L₁ := concatLoop ha γ₁ hmatch₁ + let L₂ := concatLoop hb γ₂ hmatch₂ + let p₀ : S := γ ⟨0, hn⟩ s + have hL₁_1 : L₁ 1 = p₀ := by + have h := concatLoop_exp_piece ha γ₁ hmatch₁ ⟨0, ha⟩ 0 + simp only [Nat.cast_zero, Set.Icc.coe_zero, add_zero, mul_zero, zero_div, Circle.exp_zero] at h + rw [h] + dsimp [γ₁, splitChain₁] + simp [p₀] + have hL₂_1 : L₂ 1 = p₀ := by + have h := concatLoop_exp_piece hb γ₂ hmatch₂ ⟨0, hb⟩ 0 + simp only [Nat.cast_zero, Set.Icc.coe_zero, add_zero, mul_zero, zero_div, Circle.exp_zero] at h + rw [h] + dsimp [γ₂, splitChain₂] + simp [p₀, heq] + have htwo : 0 < 2 := by omega + let δ : Fin 2 → C(unitInterval, S) := fun i => if i.1 = 0 then loopToPath L₁ else loopToPath L₂ + have hmatch_δ : ∀ i : Fin 2, δ i 1 = δ (finNext htwo i) 0 := by + intro i + dsimp [δ, finNext] + split_ifs <;> simp [hL₁_1, hL₂_1] + obtain ⟨H₁, _, hH₁0, hH₁1, hH₁s0, hH₁s1⟩ := pathsHomotopicRelIn_const_of_nullHomotopic hnull₁ + obtain ⟨H₂, _, hH₂0, hH₂1, hH₂s0, hH₂s1⟩ := pathsHomotopicRelIn_const_of_nullHomotopic hnull₂ + let δ_const : Fin 2 → C(unitInterval, S) := fun _ => ContinuousMap.const unitInterval p₀ + have hmatch_const : ∀ i : Fin 2, δ_const i 1 = δ_const (finNext htwo i) 0 := fun _ => rfl + let H_δ : Fin 2 → C(unitInterval × unitInterval, S) := fun i => if i.1 = 0 then H₁ else H₂ + have hhom_const : ClosedCurvesHomotopicIn univ + (concatLoop htwo δ hmatch_δ) (concatLoop htwo δ_const hmatch_const) := by + refine concatLoop_homotopic htwo δ δ_const hmatch_δ hmatch_const H_δ + (fun _ _ => mem_univ _) (fun i r => ?_) (fun i r => ?_) (fun i r => ?_) + · dsimp [H_δ, δ]; split_ifs + · exact hH₁0 r + · exact hH₂0 r + · dsimp [H_δ, δ_const]; split_ifs + · rw [hH₁1 r] + exact hL₁_1 + · rw [hH₂1 r] + exact hL₂_1 + · by_cases hi0 : i.1 = 0 + · have hfn : finNext htwo i = ⟨1, by omega⟩ := by + ext; dsimp [finNext]; rw [hi0] + rw [hfn] + dsimp [H_δ] + simp only [hi0, ↓reduceIte] + rw [hH₁s1 r, hH₂s0 r, loopToPath_one, loopToPath_zero, hL₁_1, hL₂_1] + · have hi1 : i.1 = 1 := by omega + have hfn : finNext htwo i = ⟨0, htwo⟩ := by + ext; dsimp [finNext]; rw [hi1] + rw [hfn] + dsimp [H_δ] + simp only [hi0, ↓reduceIte] + rw [hH₂s1 r, hH₁s0 r, loopToPath_one, loopToPath_zero, hL₂_1, hL₁_1] + have hδ_const_eq : concatLoop htwo δ_const hmatch_const = ContinuousMap.const Circle p₀ := by + ext w + obtain ⟨u, rfl⟩ := exists_unitInterval_exp w + rw [concatLoop_exp_mul] + dsimp [chainReal, chainFun, δ_const] + have hδ_null : ClosedCurveIsNullHomotopicIn univ (concatLoop htwo δ hmatch_δ) := by + refine ⟨p₀, mem_univ p₀, ?_⟩ + rwa [← hδ_const_eq] + -- Now show `concatLoop hn γ hmatch` is homotopic to `concatLoop htwo δ hmatch_δ`. + let u₁ : ℝ → ℝ := fun y => + if y ≤ 1 then (1 - y) * (s : ℝ) + y + else if y ≤ (j.1 : ℝ) then y + else (j.1 : ℝ) + (y - (j.1 : ℝ)) * (t : ℝ) + let u₂ : ℝ → ℝ := fun y => + if y ≤ 1 then (j.1 : ℝ) + (1 - y) * (t : ℝ) + y + else if y ≤ ((n - j.1 : ℕ) : ℝ) then (j.1 : ℝ) + y + else (n : ℝ) + (y - ((n - j.1 : ℕ) : ℝ)) * (s : ℝ) + have hu₁_cont : Continuous u₁ := by + refine Continuous.if_le (by fun_prop) ?_ continuous_id continuous_const ?_ + · refine Continuous.if_le continuous_id (by fun_prop) continuous_id continuous_const + (fun y hy => by rw [hy]; ring) + · intro y hy + rw [hy] + have h1j : (1 : ℝ) ≤ (j.1 : ℝ) := by + have : (2 : ℝ) ≤ (j.1 : ℝ) := by exact_mod_cast hj1 + linarith + simp only [h1j, ↓reduceIte] + ring + have hu₂_cont : Continuous u₂ := by + refine Continuous.if_le (by fun_prop) ?_ continuous_id continuous_const ?_ + · refine Continuous.if_le (by fun_prop) (by fun_prop) continuous_id continuous_const (fun y hy + => by + rw [hy] + have : (j.1 : ℝ) + ((n - j.1 : ℕ) : ℝ) = (n : ℝ) := by + exact_mod_cast Nat.add_sub_of_le (by omega : j.1 ≤ n) + nlinarith) + · intro y hy + rw [hy] + have h1n : (1 : ℝ) ≤ ((n - j.1 : ℕ) : ℝ) := by + have : (2 : ℝ) ≤ ((n - j.1 : ℕ) : ℝ) := by exact_mod_cast (by omega : 2 ≤ n - j.1) + linarith + simp only [h1n, ↓reduceIte] + ring + have hu₁_left : ∀ y : ℝ, y ≤ 1 → u₁ y = (1 - y) * (s : ℝ) + y := by + intro y hy; dsimp [u₁]; split_ifs; rfl + have hu₁_mid : ∀ y : ℝ, 1 ≤ y → y ≤ (j.1 : ℝ) → u₁ y = y := by + intro y hy1 hyj; dsimp [u₁]; split_ifs with h1 + · have : y = 1 := le_antisymm h1 hy1 + rw [this]; ring + · rfl + have hu₁_right : ∀ y : ℝ, (j.1 : ℝ) ≤ y → u₁ y = (j.1 : ℝ) + (y - (j.1 : ℝ)) * (t : ℝ) := by + intro y hy + have hj2_real : (2 : ℝ) ≤ (j.1 : ℝ) := by exact_mod_cast hj1 + have hnot1 : ¬ (y ≤ 1) := by linarith + dsimp [u₁] + simp only [hnot1, ↓reduceIte] + split_ifs with h2 + · have : y = (j.1 : ℝ) := le_antisymm h2 hy + rw [this]; ring + · rfl + have hu₂_left : ∀ y : ℝ, y ≤ 1 → u₂ y = (j.1 : ℝ) + (1 - y) * (t : ℝ) + y := by + intro y hy; dsimp [u₂]; split_ifs; rfl + have hu₂_mid : ∀ y : ℝ, 1 ≤ y → y ≤ ((n - j.1 : ℕ) : ℝ) → u₂ y = (j.1 : ℝ) + y := by + intro y hy1 hyn; dsimp [u₂]; split_ifs with h1 + · have : y = 1 := le_antisymm h1 hy1 + rw [this]; ring + · rfl + have hu₂_right : ∀ y : ℝ, ((n - j.1 : ℕ) : ℝ) ≤ y → + u₂ y = (n : ℝ) + (y - ((n - j.1 : ℕ) : ℝ)) * (s : ℝ) := by + intro y hy + have h2 : (2 : ℝ) ≤ ((n - j.1 : ℕ) : ℝ) := by exact_mod_cast (by omega : 2 ≤ n - j.1) + have hnot1 : ¬ (y ≤ 1) := by linarith + have hsum : (j.1 : ℝ) + ((n - j.1 : ℕ) : ℝ) = (n : ℝ) := by + exact_mod_cast Nat.add_sub_of_le (by omega : j.1 ≤ n) + dsimp [u₂] + simp only [hnot1, ↓reduceIte] + split_ifs with h_le + · have : y = ((n - j.1 : ℕ) : ℝ) := le_antisymm h_le hy + rw [this]; linarith + · rfl + have hf_u₁ := chainReal_split_first hn γ hmatch j s t hu₁_left hu₁_mid hu₁_right + have hf_u₂ := chainReal_split_second hn γ hmatch j s t hu₂_left hu₂_mid hu₂_right + have hf_u₁_all := + agrees_with_loop_path_of_piece_agreement ha γ₁ hmatch₁ (chainReal hn γ ∘ u₁) hf_u₁ + have hf_u₂_all := + agrees_with_loop_path_of_piece_agreement hb γ₂ hmatch₂ (chainReal hn γ ∘ u₂) hf_u₂ + have hhom_reparam := homotopic_of_two_piece_reparam hn γ hmatch j s t + hu₁_cont hu₂_cont hu₁_left hu₁_right hu₂_left hu₂_right htwo δ hmatch_δ hf_u₁_all hf_u₂_all + exact closedCurveIsNullHomotopicIn_of_homotopic hhom_reparam hδ_null + +/-! ## Proof of (11.2): Non-Null-Homotopic `O`-Arc in a Non-Null-Homotopic Closed Curve -/ + +private structure CurveChartCover (S : Type u) [TopologicalSpace S] where + small : S → Set S + chart : S → Set S + interpolate : S → S → S → unitInterval → S + mem_small : ∀ z, z ∈ small z + isOpen_small : ∀ z, IsOpen (small z) + small_subset_chart : ∀ z, small z ⊆ chart z + pair_subset_chart : ∀ z₁ z₂, (small z₁ ∩ small z₂).Nonempty → + ∃ w ∈ ({z₁, z₂} : Set S), small z₁ ∪ small z₂ ⊆ chart w + flat_pair : ∀ z₁ z₂, IsFlat (small z₁ ∪ small z₂) + interpolate_zero : ∀ z, ∀ x ∈ chart z, ∀ y ∈ chart z, interpolate z x y 0 = x + interpolate_one : ∀ z, ∀ x ∈ chart z, ∀ y ∈ chart z, interpolate z x y 1 = y + interpolate_diag : ∀ z, ∀ x ∈ chart z, ∀ t, interpolate z x x t = x + interpolate_continuous : ∀ z, ∀ γ₀ γ₁ : C(unitInterval, S), + range γ₀ ⊆ chart z → range γ₁ ⊆ chart z → + Continuous (fun p : unitInterval × unitInterval => interpolate z (γ₀ p.1) (γ₁ p.1) p.2) + +private theorem exists_curve_chart_cover (hS : IsSurface S) : Nonempty (CurveChartCover S) := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have : SecondCountableTopology S := secondCountable_of_manifold hS.2.2 + let : MetricSpace S := TopologicalSpace.metrizableSpaceMetric S + -- Step 1: Open cover `U z ⊆ ball z (ε z / 3)` and chart balls `W z` with interpolation `pt z`. + have hW_ex : ∀ z : S, ∃ (W : Set S) (pt : S → S → unitInterval → S), + z ∈ W ∧ IsOpen W ∧ IsFlat W ∧ + (∀ y₁ ∈ W, ∀ y₂ ∈ W, ∀ s, pt y₁ y₂ s ∈ W) ∧ + (∀ y₁ ∈ W, ∀ y₂ ∈ W, pt y₁ y₂ 0 = y₁) ∧ + (∀ y₁ ∈ W, ∀ y₂ ∈ W, pt y₁ y₂ 1 = y₂) ∧ + (∀ y ∈ W, ∀ s, pt y y s = y) ∧ + (∀ γ₀ γ₁ : C(unitInterval, S), range γ₀ ⊆ W → range γ₁ ⊆ W → + Continuous (fun p : unitInterval × unitInterval => pt (γ₀ p.1) (γ₁ p.1) p.2)) := by + intro z + obtain ⟨W, pt, _, hzW, hW_open, _, hW_flat, hpt_mem, hpt0, hpt1, hpt_diag, hpt_cont⟩ := + exists_chart_ball_interp hS z isOpen_univ (mem_univ z) + exact ⟨W, pt, hzW, hW_open, hW_flat, hpt_mem, hpt0, hpt1, hpt_diag, hpt_cont⟩ + choose W pt hzW hW_open hW_flat _hpt_mem hpt0 hpt1 hpt_diag hpt_cont using hW_ex + have hε_ex : ∀ z : S, ∃ ε : ℝ, 0 < ε ∧ closedBall z ε ⊆ W z := by + intro z + obtain ⟨r, hr, hball⟩ := Metric.isOpen_iff.mp (hW_open z) z (hzW z) + exact ⟨r / 2, half_pos hr, fun y hy => hball (lt_of_le_of_lt (mem_closedBall.mp hy) + (half_lt_self hr))⟩ + choose ε hε_pos hε_ball using hε_ex + have hU_ex : ∀ z : S, ∃ U : Set S, U ⊆ ball z (ε z / 3) ∧ z ∈ U ∧ IsOpen U := by + intro z + have hpos : 0 < ε z / 3 := by linarith [hε_pos z] + exact ⟨ball z (ε z / 3), Subset.rfl, mem_ball_self hpos, isOpen_ball⟩ + choose U hU_ball hzU hU_open using hU_ex + have hU_sub_W : ∀ z : S, U z ⊆ W z := fun z y hy => + hε_ball z (mem_closedBall.mpr (by linarith [mem_ball.mp (hU_ball z hy), hε_pos z])) + have hU_pair : ∀ z₁ z₂ : S, (U z₁ ∩ U z₂).Nonempty → + ∃ w ∈ ({z₁, z₂} : Set S), U z₁ ∪ U z₂ ⊆ W w := by + intro z₁ z₂ ⟨u, hu₁, hu₂⟩ + have hu₁' : dist u z₁ < ε z₁ / 3 := mem_ball.mp (hU_ball z₁ hu₁) + have hu₂' : dist u z₂ < ε z₂ / 3 := mem_ball.mp (hU_ball z₂ hu₂) + by_cases hle : ε z₁ ≤ ε z₂ + · refine ⟨z₂, Or.inr (mem_singleton z₂), fun y hy => hε_ball z₂ (mem_closedBall.mpr ?_)⟩ + rcases hy with hy₁ | hy₂ + · have hy₁' : dist y z₁ < ε z₁ / 3 := mem_ball.mp (hU_ball z₁ hy₁) + have htri : dist y z₂ ≤ dist y z₁ + dist z₁ u + dist u z₂ := dist_triangle4 y z₁ u z₂ + rw [dist_comm z₁ u] at htri; linarith + · have hy₂' : dist y z₂ < ε z₂ / 3 := mem_ball.mp (hU_ball z₂ hy₂) + linarith [hε_pos z₂] + · have hgt : ε z₂ < ε z₁ := not_le.mp hle + refine ⟨z₁, Or.inl rfl, fun y hy => hε_ball z₁ (mem_closedBall.mpr ?_)⟩ + rcases hy with hy₁ | hy₂ + · have hy₁' : dist y z₁ < ε z₁ / 3 := mem_ball.mp (hU_ball z₁ hy₁) + linarith [hε_pos z₁] + · have hy₂' : dist y z₂ < ε z₂ / 3 := mem_ball.mp (hU_ball z₂ hy₂) + have htri : dist y z₁ ≤ dist y z₂ + dist z₂ u + dist u z₁ := dist_triangle4 y z₂ u z₁ + rw [dist_comm z₂ u] at htri; linarith + have hU_flat_union : ∀ z₁ z₂ : S, IsFlat (U z₁ ∪ U z₂) := by + intro z₁ z₂ ψ hψ + by_cases hne : (U z₁ ∩ U z₂).Nonempty + · obtain ⟨w, _, hsub⟩ := hU_pair z₁ z₂ hne + exact hW_flat w ψ (hψ.trans hsub) + · have hdisj : U z₁ ∩ U z₂ = ∅ := not_nonempty_iff_eq_empty.mp hne + have hconn : IsPreconnected (range ψ) := isPreconnected_range ψ.continuous + rcases isPreconnected_iff_subset_of_disjoint.mp hconn (U z₁) (U z₂) + (hU_open z₁) (hU_open z₂) hψ (by rw [hdisj, inter_empty]) with h₁ | h₂ + · exact hW_flat z₁ ψ (h₁.trans (hU_sub_W z₁)) + · exact hW_flat z₂ ψ (h₂.trans (hU_sub_W z₂)) + exact ⟨⟨U, W, pt, hzU, hU_open, hU_sub_W, hU_pair, hU_flat_union, + hpt0, hpt1, hpt_diag, hpt_cont⟩⟩ + +private def GoodChain (φ : C(Circle, S)) (U : S → Set S) + (m : ℕ) (hm : 0 < m) (γ : Fin m → C(unitInterval, S)) + (hmatch : ∀ i, γ i 1 = γ (finNext hm i) 0) (z : Fin m → S) : Prop := + (∀ i, range (γ i) ⊆ range φ) ∧ (∀ i, range (γ i) ⊆ U (z i)) ∧ + ¬ ClosedCurveIsNullHomotopicIn univ (concatLoop hm γ hmatch) + +private def HasGoodChain (φ : C(Circle, S)) (U : S → Set S) (m : ℕ) : Prop := + ∃ (hm : 0 < m) (γ : Fin m → C(unitInterval, S)) + (hmatch : ∀ i, γ i 1 = γ (finNext hm i) 0) (z : Fin m → S), + GoodChain φ U m hm γ hmatch z + +private theorem good_chain_rotate + {φ : C(Circle, S)} {U : S → Set S} {n : ℕ} (hn : 0 < n) : + ∀ (k : ℕ) {γ hmatch z}, GoodChain φ U n hn γ hmatch z → + GoodChain φ U n hn (rotateChain hn k γ) (rotateChain_match hn k γ hmatch) + (fun i => z ⟨(i.1 + k) % n, Nat.mod_lt _ hn⟩) := by + intro k γ hmatch z ⟨hφ_sub, hU_sub, hnot_null⟩ + refine ⟨fun i => hφ_sub _, fun i => hU_sub _, fun hnull => hnot_null ?_⟩ + exact closedCurveIsNullHomotopicIn_of_homotopic + (concatLoop_rotateChain_homotopic hn k γ hmatch) hnull + +private theorem minimal_good_chain_not_constant + {φ : C(Circle, S)} {U : S → Set S} {n : ℕ} (hn : 0 < n) + (hn3 : 3 ≤ n) (hn_min : ∀ m < n, ¬ HasGoodChain φ U m) : + ∀ {γ hmatch z}, GoodChain φ U n hn γ hmatch z → + ∀ i : Fin n, ¬ (∀ t : unitInterval, γ i t = γ i 0) := by + intro γ hmatch z hgood i hconst + have hrot := good_chain_rotate hn (i.1 + 1) hgood + let γ_r := rotateChain hn (i.1 + 1) γ + let hmatch_r := rotateChain_match hn (i.1 + 1) γ hmatch + let z_r : Fin n → S := fun j => z ⟨(j.1 + (i.1 + 1)) % n, Nat.mod_lt _ hn⟩ + have hlast_eq : (⟨(n - 1 + (i.1 + 1)) % n, Nat.mod_lt _ hn⟩ : Fin n) = i := by + ext + simp only [show n - 1 + (i.1 + 1) = i.1 + n by omega, Nat.add_mod_right, Nat.mod_eq_of_lt i.2] + have hconst_r : ∀ t : unitInterval, γ_r ⟨n - 1, by omega⟩ t = γ_r ⟨0, hn⟩ 0 := by + intro t + have h1 : γ_r ⟨n - 1, by omega⟩ t = γ i t := by + dsimp [γ_r, rotateChain]; rw [hlast_eq] + have h1' : γ_r ⟨n - 1, by omega⟩ 1 = γ i 1 := by + dsimp [γ_r, rotateChain]; rw [hlast_eq] + have h3 : γ_r ⟨n - 1, by omega⟩ 1 = γ_r ⟨0, hn⟩ 0 := by + have hm := hmatch_r ⟨n - 1, by omega⟩ + dsimp [finNext] at hm + have hmod : (n - 1 + 1) % n = 0 := by rw [show n - 1 + 1 = n by omega, Nat.mod_self] + simpa [hmod] using hm + rw [h1, hconst t, ← hconst 1, ← h1', h3] + have hhom_drop := concatLoop_drop_last_const (by omega : 2 ≤ n) γ_r hmatch_r hconst_r + have hn' : 0 < n - 1 := by omega + refine hn_min (n - 1) (by omega) ⟨hn', dropLastChain γ_r, + dropLastChain_match (by omega) γ_r hmatch_r hconst_r, fun j => z_r ⟨j.1, by omega⟩, + fun j => hrot.1 ⟨j.1, by omega⟩, fun j => hrot.2.1 ⟨j.1, by omega⟩, fun hnull => hrot.2.2 ?_⟩ + exact closedCurveIsNullHomotopicIn_of_homotopic hhom_drop hnull + +private theorem good_chain_endpoints_ne {φ : C(Circle, S)} + (cover : CurveChartCover S) {n : ℕ} (hn : 0 < n) (hn3 : 3 ≤ n) + (hGood_nonconst : ∀ {γ hmatch z}, GoodChain φ cover.small n hn γ hmatch z → + ∀ i : Fin n, ¬ (∀ t : unitInterval, γ i t = γ i 0)) : + ∀ {γ hmatch z}, GoodChain φ cover.small n hn γ hmatch z → + ∀ i : Fin n, γ i 0 ≠ γ i 1 := by + let W := cover.chart + have hU_sub_W := cover.small_subset_chart + have hpt0 := cover.interpolate_zero + have hpt1 := cover.interpolate_one + have hpt_diag := cover.interpolate_diag + have hpt_cont := cover.interpolate_continuous + intro γ hmatch z hgood i heq + let c_i : C(unitInterval, S) := ContinuousMap.const unitInterval (γ i 0) + have hc_i_W : range c_i ⊆ W (z i) := by + rintro _ ⟨_, rfl⟩; exact hU_sub_W (z i) (hgood.2.1 i (mem_range_self 0)) + let γ' : Fin n → C(unitInterval, S) := fun m => if m = i then c_i else γ m + have hmatch' : ∀ m : Fin n, γ' m 1 = γ' (finNext hn m) 0 := by + intro m + dsimp [γ', c_i] + by_cases hm : m = i + · subst hm + by_cases hnext : finNext hn m = m + · simp only [↓reduceIte, hnext]; rfl + · simp only [↓reduceIte, hnext, ContinuousMap.const_apply] + exact heq.trans (hmatch m) + · by_cases hnext : finNext hn m = i + · simp only [hm, hnext, ↓reduceIte, ContinuousMap.const_apply] + rw [← hnext, ← hmatch m] + · simp only [hm, hnext, ↓reduceIte, hmatch m] + let H_i : C(unitInterval × unitInterval, S) := + ⟨fun p => cover.interpolate (z i) (γ i p.1) (c_i p.1) p.2, + hpt_cont (z i) (γ i) c_i ((hgood.2.1 i).trans (hU_sub_W (z i))) hc_i_W⟩ + let H : Fin n → C(unitInterval × unitInterval, S) := fun m => + if m = i then H_i else ⟨fun p => γ m p.1, (γ m).continuous.comp continuous_fst⟩ + have hhom : ClosedCurvesHomotopicIn univ (concatLoop hn γ hmatch) (concatLoop hn γ' hmatch') := by + refine concatLoop_homotopic hn γ γ' hmatch hmatch' H (fun _ _ => mem_univ _) + (fun m t => ?_) (fun m t => ?_) (fun m s => ?_) + · dsimp [H] + by_cases hm : m = i + · subst hm + simp only [↓reduceIte, H_i] + exact hpt0 (z m) _ (hU_sub_W (z m) (hgood.2.1 m (mem_range_self t))) _ + (hc_i_W (mem_range_self t)) + · simp only [hm, ↓reduceIte]; rfl + · dsimp [H, γ'] + by_cases hm : m = i + · subst hm + simp only [↓reduceIte, H_i] + exact hpt1 (z m) _ (hU_sub_W (z m) (hgood.2.1 m (mem_range_self t))) _ + (hc_i_W (mem_range_self t)) + · simp only [hm, ↓reduceIte]; rfl + · dsimp [H] + have hne_next : finNext hn i ≠ i := by + intro hnext + have := congrArg Fin.val hnext + dsimp [finNext] at this + by_cases hlast : i.1 + 1 = n + · rw [hlast, Nat.mod_self] at this; omega + · rw [Nat.mod_eq_of_lt (by omega)] at this; omega + by_cases hm : m = i + · subst hm + simp only [↓reduceIte, hne_next, H_i, c_i] + change cover.interpolate (z m) (γ m 1) (γ m 0) s = γ (finNext hn m) 0 + rw [← heq, hpt_diag (z m) _ (hU_sub_W (z m) (hgood.2.1 m (mem_range_self 0))) s, + heq, hmatch m] + · by_cases hnext : finNext hn m = i + · simp only [hm, hnext, ↓reduceIte, H_i, c_i] + change γ m 1 = cover.interpolate (z i) (γ i 0) (γ i 0) s + rw [hpt_diag (z i) _ (hU_sub_W (z i) (hgood.2.1 i (mem_range_self 0))) s, + ← hnext, hmatch m] + · simp only [hm, hnext, ↓reduceIte]; exact hmatch m + have hgood' : GoodChain φ cover.small n hn γ' hmatch' z := by + refine ⟨fun m => ?_, fun m => ?_, fun hnull => hgood.2.2 + (closedCurveIsNullHomotopicIn_of_homotopic hhom hnull)⟩ + · dsimp [γ']; split_ifs with hm + · rintro _ ⟨_, rfl⟩; exact hgood.1 i (mem_range_self 0) + · exact hgood.1 m + · dsimp [γ']; split_ifs with hm + · subst hm; rintro _ ⟨_, rfl⟩; exact hgood.2.1 m (mem_range_self 0) + · exact hgood.2.1 m + refine hGood_nonconst hgood' i (fun t => ?_) + dsimp [γ']; simp only [↓reduceIte, c_i, ContinuousMap.const_apply] + +private theorem minimal_good_chain_nonadjacent_disjoint + {φ : C(Circle, S)} {U : S → Set S} {n : ℕ} (hn : 0 < n) + (hn_min : ∀ m < n, ¬ HasGoodChain φ U m) : + ∀ {γ hmatch z}, GoodChain φ U n hn γ hmatch z → + ∀ (i j : Fin n), j ≠ i → j ≠ finNext hn i → i ≠ finNext hn j → + ∀ s t : unitInterval, γ i s ≠ γ j t := by + intro γ hmatch z hgood i j hji hj_next hi_next s t heq + have hrot := good_chain_rotate hn i.1 hgood + let γ_r := rotateChain hn i.1 γ + let hmatch_r := rotateChain_match hn i.1 γ hmatch + let z_r : Fin n → S := fun k => z ⟨(k.1 + i.1) % n, Nat.mod_lt _ hn⟩ + let d : ℕ := (j.1 + n - i.1) % n + have hd_lt : d < n := Nat.mod_lt _ hn + let j' : Fin n := ⟨d, hd_lt⟩ + have hj'_val : (d + i.1) % n = j.1 := by + dsimp [d] + rw [Nat.mod_add_mod, show j.1 + n - i.1 + i.1 = j.1 + n by omega, + Nat.add_mod_right, Nat.mod_eq_of_lt j.2] + have hd_ge2 : 2 ≤ d := by + by_contra hlt2 + have h01 : d = 0 ∨ d = 1 := by omega + rcases h01 with hd0 | hd1 + · rw [hd0, zero_add, Nat.mod_eq_of_lt i.2] at hj'_val + exact hji (Fin.ext hj'_val.symm) + · rw [hd1, add_comm 1 i.1] at hj'_val + exact hj_next (Fin.ext hj'_val.symm) + have hd_le : d + 2 ≤ n := by + by_contra hgt + have hd_n1 : d = n - 1 := by omega + have h1 : (j.1 + 1) % n = i.1 := by + have h2 : (d + 1 + i.1) % n = (j.1 + 1) % n := by + rw [show d + 1 + i.1 = d + i.1 + 1 by omega, ← Nat.mod_add_mod, hj'_val] + rw [hd_n1, show n - 1 + 1 + i.1 = i.1 + n by omega, Nat.add_mod_right, + Nat.mod_eq_of_lt i.2] at h2 + exact h2.symm + exact hi_next (Fin.ext h1.symm) + have heq_r : γ_r ⟨0, hn⟩ s = γ_r j' t := by + dsimp [γ_r, rotateChain, j'] + simp only [zero_add, Nat.mod_eq_of_lt i.2, hj'_val] + exact heq + -- Both sub-loops have `< n` pieces and satisfy `GoodChain` except for null-homotopy, so by + -- `hn_min` they are null-homotopic! + have hnull₁ : ClosedCurveIsNullHomotopicIn univ + (concatLoop (by omega : 0 < d + 1) (splitChain₁ hn γ_r j' s t) + (splitChain₁_match hn γ_r hmatch_r j' hd_ge2 s t heq_r)) := by + by_contra hnot₁ + refine hn_min (d + 1) (by omega) ⟨by omega, splitChain₁ hn γ_r j' s t, + splitChain₁_match hn γ_r hmatch_r j' hd_ge2 s t heq_r, + fun k => if k.1 = 0 then z_r ⟨0, hn⟩ else if hkj : k.1 < d then z_r ⟨k.1, by omega⟩ else z_r + j', + fun k => ?_, fun k => ?_, hnot₁⟩ + · dsimp [splitChain₁]; split_ifs with hk0 hkj + · exact (range_subPathSeg_subset _ _ _).trans (hrot.1 ⟨0, hn⟩) + · exact hrot.1 ⟨k.1, by omega⟩ + · exact (range_subPathSeg_subset _ _ _).trans (hrot.1 j') + · dsimp [splitChain₁]; split_ifs with hk0 hkj + · exact (range_subPathSeg_subset _ _ _).trans (hrot.2.1 ⟨0, hn⟩) + · exact hrot.2.1 ⟨k.1, by omega⟩ + · exact (range_subPathSeg_subset _ _ _).trans (hrot.2.1 j') + have hnull₂ : ClosedCurveIsNullHomotopicIn univ + (concatLoop (by omega : 0 < n - d + 1) (splitChain₂ hn γ_r j' s t) + (splitChain₂_match hn γ_r hmatch_r j' hd_le s t heq_r)) := by + by_contra hnot₂ + refine hn_min (n - d + 1) (by omega) ⟨by omega, splitChain₂ hn γ_r j' s t, + splitChain₂_match hn γ_r hmatch_r j' hd_le s t heq_r, + fun k => if k.1 = 0 then z_r j' else if hkn : k.1 < n - d then z_r ⟨d + k.1, by omega⟩ else + z_r ⟨0, hn⟩, + fun k => ?_, fun k => ?_, hnot₂⟩ + · dsimp [splitChain₂, j']; split_ifs with hk0 hkn + · exact (range_subPathSeg_subset _ _ _).trans (hrot.1 j') + · exact hrot.1 ⟨d + k.1, by omega⟩ + · exact (range_subPathSeg_subset _ _ _).trans (hrot.1 ⟨0, hn⟩) + · dsimp [splitChain₂, j']; split_ifs with hk0 hkn + · exact (range_subPathSeg_subset _ _ _).trans (hrot.2.1 j') + · exact hrot.2.1 ⟨d + k.1, by omega⟩ + · exact (range_subPathSeg_subset _ _ _).trans (hrot.2.1 ⟨0, hn⟩) + exact hrot.2.2 + (nullHomotopic_of_split_nonadjacent hn γ_r hmatch_r j' hd_ge2 hd_le s t heq_r hnull₁ hnull₂) + +private theorem exists_good_chain_with_injective_pieces [T2Space S] + {φ : C(Circle, S)} (cover : CurveChartCover S) {n : ℕ} (hn : 0 < n) + {γ₀ : Fin n → C(unitInterval, S)} + {hmatch₀ : ∀ i, γ₀ i 1 = γ₀ (finNext hn i) 0} {z₀ : Fin n → S} + (hγ₀_good : GoodChain φ cover.small n hn γ₀ hmatch₀ z₀) + (hends : ∀ i, γ₀ i 0 ≠ γ₀ i 1) : + ∃ (γ : Fin n → C(unitInterval, S)) (hmatch : ∀ i, γ i 1 = γ (finNext hn i) 0), + GoodChain φ cover.small n hn γ hmatch z₀ ∧ (∀ i, Injective (γ i)) := by + let W := cover.chart + have hU_sub_W := cover.small_subset_chart + have hpt0 := cover.interpolate_zero + have hpt1 := cover.interpolate_one + have hpt_diag := cover.interpolate_diag + have hpt_cont := cover.interpolate_continuous + -- Step 3: Replace each `γ₀ i` by an injective path `γ₁ i` with the same ends via (11.1) + -- (`exists_arc_of_path`). + have hinj_ex : ∀ i : Fin n, ∃ e : C(unitInterval, S), + Injective e ∧ e 0 = γ₀ i 0 ∧ e 1 = γ₀ i 1 ∧ range e ⊆ range (γ₀ i) := by + intro i + obtain ⟨e, he_cont, he_inj, he0, he1, he_sub⟩ := + exists_arc_of_path (γ₀ i).continuous (hends i) + exact ⟨⟨e, he_cont⟩, he_inj, he0, he1, he_sub⟩ + choose γ₁ hγ₁_inj hγ₁_0 hγ₁_1 hγ₁_sub using hinj_ex + have hmatch₁ : ∀ i : Fin n, γ₁ i 1 = γ₁ (finNext hn i) 0 := by + intro i; rw [hγ₁_1, hγ₁_0, hmatch₀] + have hγ₁_good : GoodChain φ cover.small n hn γ₁ hmatch₁ z₀ := by + refine ⟨fun i => (hγ₁_sub i).trans (hγ₀_good.1 i), + fun i => (hγ₁_sub i).trans (hγ₀_good.2.1 i), fun hnull => hγ₀_good.2.2 ?_⟩ + let H : Fin n → C(unitInterval × unitInterval, S) := fun i => + ⟨fun p => cover.interpolate (z₀ i) (γ₀ i p.1) (γ₁ i p.1) p.2, + hpt_cont (z₀ i) (γ₀ i) (γ₁ i) ((hγ₀_good.2.1 i).trans (hU_sub_W (z₀ i))) + ((hγ₁_sub i).trans ((hγ₀_good.2.1 i).trans (hU_sub_W (z₀ i))))⟩ + refine closedCurveIsNullHomotopicIn_of_homotopic + (concatLoop_homotopic hn γ₀ γ₁ hmatch₀ hmatch₁ H (fun _ _ => mem_univ _) + (fun i t => hpt0 (z₀ i) _ (hU_sub_W (z₀ i) (hγ₀_good.2.1 i (mem_range_self t))) _ + (hU_sub_W (z₀ i) (hγ₀_good.2.1 i (hγ₁_sub i (mem_range_self t))))) + (fun i t => hpt1 (z₀ i) _ (hU_sub_W (z₀ i) (hγ₀_good.2.1 i (mem_range_self t))) _ + (hU_sub_W (z₀ i) (hγ₀_good.2.1 i (hγ₁_sub i (mem_range_self t))))) + (fun i s => ?_)) hnull + change cover.interpolate (z₀ i) (γ₀ i 1) (γ₁ i 1) s = cover.interpolate (z₀ (finNext hn i)) (γ₀ + (finNext hn i) 0) (γ₁ (finNext hn i) 0) s + rw [hγ₁_1, hpt_diag (z₀ i) _ (hU_sub_W (z₀ i) (hγ₀_good.2.1 i (mem_range_self 1))) s, + hγ₁_0, hpt_diag (z₀ (finNext hn i)) _ (hU_sub_W _ (hγ₀_good.2.1 _ + (mem_range_self 0))) s, hmatch₀] + exact ⟨γ₁, hmatch₁, hγ₁_good, hγ₁_inj⟩ + +private theorem homotopic_after_trimming_adjacent_pieces + (cover : CurveChartCover S) {n : ℕ} (hn : 0 < n) + (γ : Fin n → C(unitInterval, S)) (hmatch : ∀ i, γ i 1 = γ (finNext hn i) 0) + (i : Fin n) (s₀ t₀ : unitInterval) {w : S} : + let i' := finNext hn i + let γ_i := subPathSeg (γ i) 0 s₀ + let γ_i' := subPathSeg (γ i') t₀ 1 + let γ' : Fin n → C(unitInterval, S) := fun k => + if k = i then γ_i else if k = i' then γ_i' else γ k + (hii' : i' ≠ i) → (hi'_next : finNext hn i' ≠ i) → + (hnext_ne_i' : finNext hn i' ≠ i') → (ht₀ : γ i' t₀ = γ i s₀) → + (range (γ i) ⊆ cover.chart w) → (range (γ i') ⊆ cover.chart w) → + (hmatch' : ∀ k, γ' k 1 = γ' (finNext hn k) 0) → + ClosedCurvesHomotopicIn univ (concatLoop hn γ hmatch) (concatLoop hn γ' hmatch') := by + intro i' γ_i γ_i' γ' hii' hi'_next hnext_ne_i' ht₀ hγi_W hγi'_W hmatch' + have hpt0 := cover.interpolate_zero + have hpt1 := cover.interpolate_one + have hpt_diag := cover.interpolate_diag + have hpt_cont := cover.interpolate_continuous + have hγ_i_W := (range_subPathSeg_subset (γ i) 0 s₀).trans hγi_W + have hγ_i'_W := (range_subPathSeg_subset (γ i') t₀ 1).trans hγi'_W + let H_i : C(unitInterval × unitInterval, S) := + ⟨fun p => cover.interpolate w (γ i p.1) (γ_i p.1) p.2, hpt_cont w (γ i) γ_i hγi_W hγ_i_W⟩ + let H_i' : C(unitInterval × unitInterval, S) := + ⟨fun p => cover.interpolate w (γ i' p.1) (γ_i' p.1) p.2, hpt_cont w (γ i') γ_i' hγi'_W hγ_i'_W⟩ + let H : Fin n → C(unitInterval × unitInterval, S) := fun k => + if k = i then H_i + else if k = i' then H_i' + else ⟨fun p => γ k p.1, (γ k).continuous.comp continuous_fst⟩ + refine concatLoop_homotopic hn γ γ' hmatch hmatch' H (fun _ _ => mem_univ _) + (fun k t => ?_) (fun k t => ?_) (fun k s => ?_) + · dsimp [H] + by_cases hk_i : k = i + · subst k; simp only [↓reduceIte, H_i] + exact hpt0 w _ (hγi_W (mem_range_self t)) _ (hγ_i_W (mem_range_self t)) + · by_cases hk_i' : k = i' + · subst k; simp only [hk_i, ↓reduceIte, H_i'] + exact hpt0 w _ (hγi'_W (mem_range_self t)) _ (hγ_i'_W (mem_range_self t)) + · simp only [hk_i, hk_i', ↓reduceIte]; rfl + · dsimp [H, γ'] + by_cases hk_i : k = i + · subst k; simp only [↓reduceIte, H_i] + exact hpt1 w _ (hγi_W (mem_range_self t)) _ (hγ_i_W (mem_range_self t)) + · by_cases hk_i' : k = i' + · subst k; simp only [hk_i, ↓reduceIte, H_i'] + exact hpt1 w _ (hγi'_W (mem_range_self t)) _ (hγ_i'_W (mem_range_self t)) + · simp only [hk_i, hk_i', ↓reduceIte]; rfl + · dsimp [H] + by_cases hk_i : k = i + · subst k + change (if i = i then H_i else if i = i' then H_i' else _) (1, s) = + (if i' = i then H_i else if i' = i' then H_i' else _) (0, s) + simp only [↓reduceIte, hii', H_i, H_i'] + change cover.interpolate w (γ i 1) (γ_i 1) s = cover.interpolate w (γ i' 0) (γ_i' 0) s + rw [hmatch i] + dsimp [γ_i, γ_i'] + rw [subPathSeg_one, subPathSeg_zero, ht₀] + · by_cases hk_i' : k = i' + · subst k + simp only [hk_i, ↓reduceIte, hi'_next, hnext_ne_i', H_i', γ_i'] + change cover.interpolate w (γ i' 1) (subPathSeg (γ i') t₀ 1 1) s = γ (finNext hn i') 0 + rw [subPathSeg_one, hpt_diag w _ (hγi'_W (mem_range_self 1)) s, hmatch i'] + · simp only [hk_i, hk_i', ↓reduceIte] + by_cases hnext_i : finNext hn k = i + · simp only [hnext_i, ↓reduceIte, H_i, γ_i] + change γ k 1 = cover.interpolate w (γ i 0) (subPathSeg (γ i) 0 s₀ 0) s + rw [subPathSeg_zero, hpt_diag w _ (hγi_W (mem_range_self 0)) s, ← hnext_i, hmatch k] + · have hnext_k_ne_i' : finNext hn k ≠ i' := fun h => + hk_i ((finPrev_finNext hn k).symm.trans (by rw [h]; exact finPrev_finNext hn i)) + simp only [hnext_i, hnext_k_ne_i', ↓reduceIte] + exact hmatch k + +private theorem exists_good_chain_with_disjoint_adjacent_pieces [T2Space S] + {φ : C(Circle, S)} (cover : CurveChartCover S) + {n : ℕ} (hn : 0 < n) (hn3 : 3 ≤ n) + {z₀ : Fin n → S} {γ₁ : Fin n → C(unitInterval, S)} + {hmatch₁ : ∀ i, γ₁ i 1 = γ₁ (finNext hn i) 0} + (hγ₁_good : GoodChain φ cover.small n hn γ₁ hmatch₁ z₀) + (hγ₁_inj : ∀ i, Injective (γ₁ i)) + (hGood_nonconst : ∀ {γ hmatch z}, GoodChain φ cover.small n hn γ hmatch z → + ∀ i : Fin n, ¬ (∀ t : unitInterval, γ i t = γ i 0)) : + ∀ m : ℕ, m ≤ n → + ∃ (γ : Fin n → C(unitInterval, S)) (hmatch : ∀ i, γ i 1 = γ (finNext hn i) 0), + GoodChain φ cover.small n hn γ hmatch z₀ ∧ + (∀ i : Fin n, Injective (γ i)) ∧ + (∀ k : Fin n, k.1 < m → ∀ s t : unitInterval, γ k s = γ (finNext hn k) t → s = 1 ∧ t = 0) + := by + let W := cover.chart + have hU_pair := cover.pair_subset_chart + let U := cover.small + intro m + induction m with + | zero => + intro _ + exact ⟨γ₁, hmatch₁, hγ₁_good, hγ₁_inj, fun k hk => absurd hk (Nat.not_lt_zero k.1)⟩ + | succ m ih => + intro hm_le + obtain ⟨γ, hmatch, hgood, hinj, hadj⟩ := ih (by omega) + let i : Fin n := ⟨m, hm_le⟩ + let i' : Fin n := finNext hn i + have hii' : i' ≠ i := by + intro heq + have := congrArg Fin.val heq + dsimp [i, i', finNext] at this + by_cases hlast : m + 1 = n + · rw [hlast, Nat.mod_self] at this; omega + · rw [Nat.mod_eq_of_lt (by omega)] at this; omega + let Pre : Set unitInterval := (γ i) ⁻¹' range (γ i') + have hPre_closed : IsClosed Pre := + (isCompact_range (γ i').continuous).isClosed.preimage (γ i).continuous + have h1_mem : (1 : unitInterval) ∈ Pre := ⟨0, (hmatch i).symm⟩ + let s₀ : unitInterval := sInf Pre + have hs₀_mem : s₀ ∈ Pre := hPre_closed.csInf_mem ⟨1, h1_mem⟩ (OrderBot.bddBelow Pre) + have hs₀_le : ∀ s ∈ Pre, s₀ ≤ s := fun s hs => csInf_le (OrderBot.bddBelow Pre) hs + obtain ⟨t₀, ht₀⟩ : ∃ t₀ : unitInterval, γ i' t₀ = γ i s₀ := hs₀_mem + let γ_i : C(unitInterval, S) := subPathSeg (γ i) 0 s₀ + let γ_i' : C(unitInterval, S) := subPathSeg (γ i') t₀ 1 + let γ' : Fin n → C(unitInterval, S) := fun k => + if k = i then γ_i + else if k = i' then γ_i' + else γ k + have hi'_next : finNext hn i' ≠ i := by + intro heq + have := congrArg Fin.val heq + dsimp [i, i', finNext] at this + rw [Nat.mod_add_mod] at this + by_cases h1 : m + 1 + 1 < n + · rw [Nat.mod_eq_of_lt h1] at this; omega + · have hsub : m + 1 + 1 = m + 2 - n + n := by omega + have h2 : (m + 1 + 1) % n = m + 2 - n := by + conv_lhs => rw [hsub, Nat.add_mod_right] + exact Nat.mod_eq_of_lt (by omega : m + 2 - n < n) + rw [h2] at this; omega + have hnext_ne_i' : finNext hn i' ≠ i' := by + intro heq + have := congrArg Fin.val heq + dsimp [finNext] at this + by_cases hlast : i'.1 + 1 = n + · rw [hlast, Nat.mod_self] at this; omega + · rw [Nat.mod_eq_of_lt (by omega)] at this; omega + have hmatch' : ∀ k : Fin n, γ' k 1 = γ' (finNext hn k) 0 := by + intro k + dsimp [γ', γ_i, γ_i'] + by_cases hk_i : k = i + · subst hk_i + change (if i = i then subPathSeg (γ i) 0 s₀ else if i = i' then subPathSeg + (γ i') t₀ 1 else γ i) 1 = + (if i' = i then subPathSeg (γ i) 0 s₀ else if i' = i' then subPathSeg + (γ i') t₀ 1 else γ i') 0 + simp only [↓reduceIte, hii', subPathSeg_one, subPathSeg_zero, ht₀] + · by_cases hk_i' : k = i' + · subst hk_i' + simp only [hk_i, ↓reduceIte, hi'_next, hnext_ne_i', subPathSeg_one, hmatch i'] + · simp only [hk_i, hk_i', ↓reduceIte] + by_cases hnext_i : finNext hn k = i + · rw [hnext_i] + simp only [↓reduceIte, subPathSeg_zero, ← hnext_i, hmatch k] + · have hnext_k_ne_i' : finNext hn k ≠ i' := fun h => + hk_i ((finPrev_finNext hn k).symm.trans (by rw [h]; exact finPrev_finNext hn i)) + simp only [hnext_i, hnext_k_ne_i', ↓reduceIte, hmatch k] + -- Homotopy from `γ` to `γ'` inside `W w` where `U (z₀ i) ∪ U (z₀ i') ⊆ W w`. + have hU_nonempty : (U (z₀ i) ∩ U (z₀ i')).Nonempty := + ⟨γ i 1, hgood.2.1 i (mem_range_self 1), by + rw [hmatch i] + exact hgood.2.1 i' (mem_range_self 0)⟩ + obtain ⟨w, _, hUU_W⟩ := hU_pair (z₀ i) (z₀ i') hU_nonempty + have hγi_W : range (γ i) ⊆ W w := (hgood.2.1 i).trans (subset_union_left.trans hUU_W) + have hγi'_W : range (γ i') ⊆ W w := (hgood.2.1 i').trans (subset_union_right.trans hUU_W) + have hγ'_sub : ∀ k : Fin n, range (γ' k) ⊆ range (γ k) := by + intro k; dsimp [γ', γ_i, γ_i']; split_ifs with h1 h2 + · subst h1; exact range_subPathSeg_subset _ _ _ + · subst h2; exact range_subPathSeg_subset _ _ _ + · exact Subset.rfl + have hhom := + homotopic_after_trimming_adjacent_pieces cover hn γ hmatch i s₀ t₀ + hii' hi'_next hnext_ne_i' ht₀ hγi_W hγi'_W hmatch' + have hgood' : GoodChain φ cover.small n hn γ' hmatch' z₀ := + ⟨fun k => (hγ'_sub k).trans (hgood.1 k), + fun k => (hγ'_sub k).trans (hgood.2.1 k), + fun hnull => hgood.2.2 (closedCurveIsNullHomotopicIn_of_homotopic hhom hnull)⟩ + have hs₀_pos : (0 : ℝ) < (s₀ : ℝ) := by + refine lt_of_le_of_ne s₀.2.1 fun h0 => ?_ + have hs₀_eq : s₀ = 0 := Subtype.ext h0.symm + refine hGood_nonconst hgood' i (fun u => ?_) + dsimp [γ', γ_i]; simp only [↓reduceIte, hs₀_eq, subPathSeg_self] + have ht₀_lt1 : (t₀ : ℝ) < 1 := by + refine lt_of_le_of_ne t₀.2.2 fun h1 => ?_ + have ht₀_eq : t₀ = 1 := Subtype.ext h1 + refine hGood_nonconst hgood' i' (fun u => ?_) + dsimp [γ', γ_i']; simp only [hii', ↓reduceIte, ht₀_eq, subPathSeg_self] + have hinj' : ∀ k : Fin n, Injective (γ' k) := by + intro k; dsimp [γ', γ_i, γ_i']; split_ifs with h1 h2 + · subst h1; exact injective_subPathSeg (hinj i) hs₀_pos + · subst h2; exact injective_subPathSeg (hinj i') ht₀_lt1 + · exact hinj k + refine ⟨γ', hmatch', hgood', hinj', fun k hk u v huv => ?_⟩ + by_cases hk_eq_m : k.1 = m + · have hki : k = i := Fin.ext hk_eq_m + subst hki + have huv_orig : γ' i u = γ' i' v := huv + have hγ'i_u : γ' i u = γ i ⟨(1 - (u : ℝ)) * 0 + (u : ℝ) * (s₀ : ℝ), + by nlinarith [u.2.1, u.2.2, s₀.2.1], by nlinarith [u.2.1, u.2.2, s₀.2.2]⟩ := by + dsimp [γ', γ_i]; simp only [↓reduceIte]; rfl + have hγ'i'_v : γ' i' v = γ i' ⟨(1 - (v : ℝ)) * (t₀ : ℝ) + (v : ℝ) * 1, + by nlinarith [v.2.1, v.2.2, t₀.2.1], by nlinarith [v.2.1, v.2.2, t₀.2.2]⟩ := by + dsimp [γ', γ_i']; simp only [hii', ↓reduceIte]; rfl + rw [hγ'i_u, hγ'i'_v] at huv + have hmem_Pre : (⟨(1 - (u : ℝ)) * 0 + (u : ℝ) * (s₀ : ℝ), + by nlinarith [u.2.1, u.2.2, s₀.2.1], by nlinarith [u.2.1, u.2.2, s₀.2.2]⟩ : unitInterval) + ∈ Pre := + ⟨_, huv.symm⟩ + have hle_s₀ : (s₀ : ℝ) ≤ (1 - (u : ℝ)) * 0 + (u : ℝ) * (s₀ : ℝ) := hs₀_le _ hmem_Pre + have hu1 : u = 1 := by + ext; change (u : ℝ) = 1 + nlinarith [u.2.2] + rw [hu1, hmatch' i] at huv_orig + exact ⟨hu1, hinj' i' huv_orig.symm⟩ + · have hk_lt_m : k.1 < m := by omega + have hki : k ≠ i := fun h => hk_eq_m (congrArg Fin.val h) + have hnext_ne_i' : finNext hn k ≠ i' := fun h => + hki ((finPrev_finNext hn k).symm.trans (by rw [h]; exact finPrev_finNext hn i)) + let paramMap : Fin n → unitInterval → unitInterval := fun q u => + if q = i then + ⟨(1 - (u : ℝ)) * 0 + (u : ℝ) * (s₀ : ℝ), + by nlinarith [u.2.1, u.2.2, s₀.2.1], by nlinarith [u.2.1, u.2.2, s₀.2.2]⟩ + else if q = i' then + ⟨(1 - (u : ℝ)) * (t₀ : ℝ) + (u : ℝ) * 1, + by nlinarith [u.2.1, u.2.2, t₀.2.1], by nlinarith [u.2.1, u.2.2, t₀.2.2]⟩ + else u + have hγ'_param : ∀ (q : Fin n) (u : unitInterval), γ' q u = γ q (paramMap q u) := by + intro q u; dsimp [γ', γ_i, γ_i', paramMap]; split_ifs with h1 h2 + · subst h1; rfl + · subst h2; rfl + · rfl + rw [hγ'_param k u, hγ'_param (finNext hn k) v] at huv + obtain ⟨hu_p, hv_p⟩ := hadj k hk_lt_m (paramMap k u) (paramMap (finNext hn k) v) huv + refine ⟨?_, ?_⟩ + · dsimp [paramMap] at hu_p + by_cases hki' : k = i' + · simp only [hki', hii', ↓reduceIte] at hu_p + have hval := congrArg Subtype.val hu_p + dsimp at hval + ext; change (u : ℝ) = 1 + nlinarith [ht₀_lt1] + · simp only [hki, hki', ↓reduceIte] at hu_p + exact hu_p + · dsimp [paramMap] at hv_p + by_cases hni : finNext hn k = i + · simp only [hni, ↓reduceIte] at hv_p + have hval := congrArg Subtype.val hv_p + dsimp at hval + ext; change (v : ℝ) = 0 + nlinarith [hs₀_pos] + · simp only [hni, hnext_ne_i', ↓reduceIte] at hv_p + exact hv_p + +private theorem oArc_of_good_chain [T2Space S] + {φ : C(Circle, S)} {U : S → Set S} {n : ℕ} (hn : 0 < n) + {γ : Fin n → C(unitInterval, S)} {z₀ : Fin n → S} + {hmatch : ∀ i, γ i 1 = γ (finNext hn i) 0} + (hgood : GoodChain φ U n hn γ hmatch z₀) + (hinj : ∀ i, Injective (γ i)) + (hadj : ∀ k : Fin n, k.1 < n → ∀ s t : unitInterval, + γ k s = γ (finNext hn k) t → s = 1 ∧ t = 0) + (hnonadj : ∀ (i j : Fin n), j ≠ i → j ≠ finNext hn i → i ≠ finNext hn j → + ∀ s t : unitInterval, γ i s ≠ γ j t) : + ∃ F : Set S, IsOArc F ∧ F ⊆ range φ ∧ ¬ IsNullHomotopicOArc F := by + let ψ : C(Circle, S) := concatLoop hn γ hmatch + have hψ_rep : ∀ z : Circle, ∃ (i : Fin n) (t : unitInterval), + (t : ℝ) < 1 ∧ z = Circle.exp (2 * Real.pi * ((i.1 : ℝ) + (t : ℝ)) / (n : ℝ)) ∧ + ψ z = γ i t := by + intro z + obtain ⟨u₀, rfl⟩ := exists_unitInterval_exp z + let u : unitInterval := if (u₀ : ℝ) = 1 then 0 else u₀ + have hu_lt1 : (u : ℝ) < 1 := by + dsimp [u]; split_ifs with h1 + · exact zero_lt_one + · exact lt_of_le_of_ne u₀.2.2 h1 + have hu_exp : Circle.exp (2 * Real.pi * (u₀ : ℝ)) = Circle.exp (2 * Real.pi * (u : ℝ)) := by + dsimp [u]; split_ifs with h1 + · rw [h1, mul_one, Set.Icc.coe_zero, mul_zero, Circle.exp_two_pi, Circle.exp_zero] + · rfl + let y : ℝ := (u : ℝ) * (n : ℝ) + have hy0 : 0 ≤ y := mul_nonneg u.2.1 (by positivity) + have hn_pos : (0 : ℝ) < (n : ℝ) := by exact_mod_cast hn + have hy_lt : y < (n : ℝ) := by simpa [y] using mul_lt_of_lt_one_left hn_pos hu_lt1 + have hfl_nn : 0 ≤ ⌊y⌋ := Int.floor_nonneg.mpr hy0 + have hfl_lt : ⌊y⌋ < (n : ℤ) := by rw [Int.floor_lt]; exact_mod_cast hy_lt + let i : Fin n := ⟨⌊y⌋.toNat, by omega⟩ + let t : unitInterval := unitFract y + have ht_lt1 : (t : ℝ) < 1 := Int.fract_lt_one y + have hi_eq : (i.1 : ℝ) + (t : ℝ) = y := by + have hfl_eq : (i.1 : ℤ) = ⌊y⌋ := Int.toNat_of_nonneg hfl_nn + change ((i.1 : ℤ) : ℝ) + Int.fract y = y + rw [hfl_eq, Int.floor_add_fract] + have hz_eq : Circle.exp (2 * Real.pi * (u₀ : ℝ)) = + Circle.exp (2 * Real.pi * ((i.1 : ℝ) + (t : ℝ)) / (n : ℝ)) := by + have hdiv : 2 * Real.pi * y / (n : ℝ) = 2 * Real.pi * (u : ℝ) := by + dsimp [y] + rw [← mul_assoc, mul_div_cancel_right₀ _ (ne_of_gt hn_pos)] + rw [hu_exp, hi_eq, hdiv] + refine ⟨i, t, ht_lt1, hz_eq, ?_⟩ + rw [hz_eq] + exact concatLoop_exp_piece hn γ hmatch i t + have hψ_inj : Injective ψ := by + intro z₁ z₂ heq + obtain ⟨i₁, t₁, ht₁_lt, rfl, hψ₁⟩ := hψ_rep z₁ + obtain ⟨i₂, t₂, ht₂_lt, rfl, hψ₂⟩ := hψ_rep z₂ + rw [hψ₁, hψ₂] at heq + by_cases hi12 : i₂ = i₁ + · subst hi12 + rw [hinj _ heq] + · by_cases hnext1 : i₂ = finNext hn i₁ + · subst hnext1 + obtain ⟨ht₁_1, _⟩ := hadj i₁ i₁.2 t₁ t₂ heq + exact absurd (congrArg Subtype.val ht₁_1) (ne_of_lt ht₁_lt) + · by_cases hnext2 : i₁ = finNext hn i₂ + · subst hnext2 + obtain ⟨ht₂_1, _⟩ := hadj i₂ i₂.2 t₂ t₁ heq.symm + exact absurd (congrArg Subtype.val ht₂_1) (ne_of_lt ht₂_lt) + · exact absurd heq (hnonadj i₁ i₂ hi12 hnext1 hnext2 t₁ t₂) + have hψ_emb : IsEmbedding ψ := (ψ.continuous.isClosedEmbedding hψ_inj).isEmbedding + let e_ψ : Circle ≃ₜ range ψ := hψ_emb.toHomeomorph + refine ⟨range ψ, ⟨e_ψ⟩, ?_, ?_⟩ + · rw [range_concatLoop] + exact iUnion_subset fun i => hgood.1 i + · rintro ⟨φ_F, c, hc, H, hH_mem, hH0, hH1⟩ + let α : Circle ≃ₜ Circle := e_ψ.trans φ_F.symm + let H' : C(Circle × unitInterval, S) := + H.comp ⟨fun p => (α p.1, p.2), (α.continuous.comp continuous_fst).prodMk continuous_snd⟩ + refine hgood.2.2 ⟨c, hc, H', fun p => hH_mem _, fun z => ?_, fun z => hH1 (α z)⟩ + change H (α z, 0) = ψ z + rw [hH0 (α z)] + have hα : φ_F (α z) = e_ψ z := φ_F.apply_symm_apply (e_ψ z) + exact congrArg Subtype.val hα + +/-- Graph Minors VII, (11.2) (pages 249–250): +"If $\Sigma$ is a surface, and $\phi \colon S^1 \to \Sigma$ is continuous and non-null-homotopic, +there is a non-null-homotopic $O$-arc included in $|\phi|$." -/ +theorem nonNullHomotopicOArc_in_curve (hS : IsSurface S) (φ : C(Circle, S)) + (hφ : ¬ ClosedCurveIsNullHomotopicIn univ φ) : + ∃ F : Set S, IsOArc F ∧ F ⊆ range φ ∧ ¬ IsNullHomotopicOArc F := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + obtain ⟨cover⟩ := exists_curve_chart_cover hS + let U := cover.small + have hzU := cover.mem_small + have hU_open := cover.isOpen_small + have hex_good : ∃ m : ℕ, HasGoodChain φ U m := by + have hcov : range φ ⊆ ⋃ z ∈ (univ : Set S), U z := + fun y _ => mem_iUnion₂.mpr ⟨y, mem_univ y, hzU y⟩ + obtain ⟨m, hm, z, _, hpiece⟩ := + exists_subdivision_in_open_cover (fun z _ => hU_open z) φ hcov + refine ⟨m, hm, curvePiece hm φ, curvePiece_match hm φ, z, ?_, hpiece, ?_⟩ + · intro i + rintro _ ⟨t, rfl⟩ + exact mem_range_self _ + · rw [concatLoop_curvePiece hm φ] + exact hφ + let decidableGoodChain : DecidablePred (HasGoodChain φ U) := Classical.decPred _ + let n : ℕ := Nat.find hex_good + have hn_good : HasGoodChain φ U n := Nat.find_spec hex_good + have hn_min : ∀ m < n, ¬ HasGoodChain φ U m := fun m hm => Nat.find_min hex_good hm + obtain ⟨hn, γ₀, hmatch₀, z₀, hγ₀_good⟩ := hn_good + -- Claim (1): `3 ≤ n`. + have hn3 : 3 ≤ n := by + by_contra hlt3 + have hle2 : n ≤ 2 := by omega + have hsub : range (concatLoop hn γ₀ hmatch₀) ⊆ + U (z₀ ⟨0, hn⟩) ∪ U (z₀ ⟨n - 1, Nat.sub_lt hn zero_lt_one⟩) := by + rw [range_concatLoop] + refine iUnion_subset fun i y hy => ?_ + have hi : i.1 = 0 ∨ i.1 = n - 1 := by omega + rcases hi with h0 | hn1 + · left + have heq : i = ⟨0, hn⟩ := Fin.ext h0 + exact heq ▸ hγ₀_good.2.1 i hy + · right + have heq : i = ⟨n - 1, Nat.sub_lt hn zero_lt_one⟩ := Fin.ext hn1 + exact heq ▸ hγ₀_good.2.1 i hy + exact hγ₀_good.2.2 (cover.flat_pair _ _ (concatLoop hn γ₀ hmatch₀) hsub) + have hnonconst : ∀ {γ hmatch z}, GoodChain φ U n hn γ hmatch z → + ∀ i : Fin n, ¬ (∀ t : unitInterval, γ i t = γ i 0) := + fun hgood => minimal_good_chain_not_constant hn hn3 hn_min hgood + obtain ⟨γ₁, hmatch₁, hγ₁_good, hγ₁_inj⟩ := + exists_good_chain_with_injective_pieces cover hn hγ₀_good + (good_chain_endpoints_ne cover hn hn3 hnonconst hγ₀_good) + obtain ⟨γ, hmatch, hgood, hinj, hadj⟩ := + exists_good_chain_with_disjoint_adjacent_pieces cover hn hn3 hγ₁_good hγ₁_inj hnonconst n le_rfl + exact oArc_of_good_chain hn hgood hinj hadj + (minimal_good_chain_nonadjacent_disjoint hn hn_min hgood) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section11d.lean b/LeanPool/GraphMinor/GM07/Section11d.lean new file mode 100644 index 0000000000..e6924db6e3 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section11d.lean @@ -0,0 +1,627 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section11b +import LeanPool.GraphMinor.GM07.Section11c +import LeanPool.GraphMinor.Surface.ArcInPath +import LeanPool.GraphMinor.Surface.Circle +import Mathlib.Data.Set.Card + +/-! +# Graph Minors VII, Section 11: Proof of (11.7) (Bridge Arc Between Arc-Components) + +This file proves the bridge-arc step of Graph Minors VII, (11.7) (page 253): +in a connected surface `S`, if a solid flat subset `Z ⊆ S` has at least two arc-components +(`2 ≤ (arcComponentsIn Z).ncard`), then there is a `[0, 1]`-arc `T ⊆ S` with ends `a, b` in +distinct arc-components of `Z` and `T ∩ Z = {a, b}` such that `T` is solid, `Z ∪ T` is flat, and +`(arcComponentsIn (Z ∪ T)).ncard < (arcComponentsIn Z).ncard`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Function Topology Metric unitInterval +open GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## Basic Helper Lemmas on Solid Sets and Arc-Components -/ + +/-- Contrapositive of (11.2): a subset `Z ⊆ S` is flat if every `O`-arc `F ⊆ Z` is null-homotopic +in `S`. -/ +theorem isFlat_of_forall_isNullHomotopicOArc (hS : IsSurface S) {Z : Set S} + (h : ∀ F : Set S, F ⊆ Z → IsOArc F → IsNullHomotopicOArc F) : + IsFlat Z := by + intro φ hφZ + by_contra hnot + obtain ⟨F, hF_oarc, hF_range, hF_not_null⟩ := nonNullHomotopicOArc_in_curve hS φ hnot + exact hF_not_null (h F (hF_range.trans hφZ) hF_oarc) + +/-- Every `O`-arc `F` contained in a flat subset `Y ⊆ S` is null-homotopic in `S`. -/ +theorem isNullHomotopicOArc_of_isFlat {Y F : Set S} (hY : IsFlat Y) (hFY : F ⊆ Y) + (hF : IsOArc F) : IsNullHomotopicOArc F := by + obtain ⟨φ⟩ := hF + refine ⟨φ, hY ⟨fun x => (φ x).1, continuous_subtype_val.comp φ.continuous⟩ ?_⟩ + rintro _ ⟨x, rfl⟩ + exact hFY (φ x).2 + +/-- `arcComponentsIn Z` is the image of `Z` under `pathComponentIn Z`. -/ +theorem arcComponentsIn_eq_image_pathComponentIn (Z : Set S) : + arcComponentsIn Z = (pathComponentIn Z) '' Z := by + ext C + constructor + · rintro ⟨⟨x, hxC⟩, hCZ, hC_pc, hC_max⟩ + have hxZ : x ∈ Z := hCZ hxC + refine ⟨x, hxZ, ?_⟩ + exact hC_max (pathComponentIn Z x) pathComponentIn_subset (isPathConnected_pathComponentIn hxZ) + (hC_pc.subset_pathComponentIn hxC hCZ) + · rintro ⟨x, hxZ, rfl⟩ + exact pathComponentIn_mem_arcComponentsIn hxZ + +/-- Every solid subset of a surface has only finitely many arc-components. -/ +theorem arcComponentsIn_finite_of_isSolid (hS : IsSurface S) {Z : Set S} (hZ : IsSolid Z) : + (arcComponentsIn Z).Finite := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hZ_compact : IsCompact Z := hZ.2.isCompact + have hex : ∀ z : S, ∃ A : Set S, IsOpen A ∧ z ∈ A ∧ (z ∈ Z → IsArcConnected (Z ∩ A)) := by + intro z + by_cases hz : z ∈ Z + · obtain ⟨A, _, hzA, hA_open, hZA_arc⟩ := hZ.1 z hz univ isOpen_univ (mem_univ z) + exact ⟨A, hA_open, hzA, fun _ => hZA_arc⟩ + · exact ⟨univ, isOpen_univ, mem_univ z, fun hz' => absurd hz' hz⟩ + choose A hA_open hzA hZA_arc using hex + have hcov : Z ⊆ ⋃ z ∈ Z, A z := fun z hz => mem_iUnion₂.mpr ⟨z, hz, hzA z⟩ + obtain ⟨t, htZ, ht_fin, ht_cov⟩ := + hZ_compact.elim_finite_subcover_image (fun z _ => hA_open z) hcov + rw [arcComponentsIn_eq_image_pathComponentIn] + refine (ht_fin.image (pathComponentIn Z)).subset ?_ + rintro _ ⟨y, hyZ, rfl⟩ + obtain ⟨z, hzt, hyAz⟩ := mem_iUnion₂.mp (ht_cov hyZ) + have hzZ : z ∈ Z := htZ hzt + have hj : JoinedIn (Z ∩ A z) z y := + isArcConnected_iff_joinedIn.mp (hZA_arc z hzZ) z ⟨hzZ, hzA z⟩ y ⟨hyZ, hyAz⟩ + have hjZ : JoinedIn Z z y := hj.mono inter_subset_left + exact ⟨z, hzt, (pathComponentIn_congr hjZ).symm⟩ + +/-- In a surface `S`, if `Z` is solid and `z₀ ∈ Z`, then both `A := pathComponentIn Z z₀` and +`B := Z \ A` are closed in `S`. -/ +theorem isClosed_pathComponentIn_and_sdiff_of_isSolid (hS : IsSurface S) {Z : Set S} + (hZ : IsSolid Z) {z₀ : S} : + IsClosed (pathComponentIn Z z₀) ∧ IsClosed (Z \ pathComponentIn Z z₀) := by + have : T2Space S := hS.2.1 + set A : Set S := pathComponentIn Z z₀ + set B : Set S := Z \ A + have hA_sub : A ⊆ Z := pathComponentIn_subset + have hA_open_in_Z : ∀ x ∈ A, ∃ C : Set S, IsOpen C ∧ x ∈ C ∧ Z ∩ C ⊆ A := by + intro x hxA + obtain ⟨C, _, hxC, hC_open, hZC_arc⟩ := hZ.1 x (hA_sub hxA) univ isOpen_univ (mem_univ x) + refine ⟨C, hC_open, hxC, fun y hy => ?_⟩ + have hj : JoinedIn (Z ∩ C) x y := + isArcConnected_iff_joinedIn.mp hZC_arc x ⟨hA_sub hxA, hxC⟩ y hy + exact JoinedIn.trans hxA (hj.mono inter_subset_left) + have hB_open_in_Z : ∀ x ∈ B, ∃ C : Set S, IsOpen C ∧ x ∈ C ∧ Z ∩ C ⊆ B := by + intro x hxB + obtain ⟨C, _, hxC, hC_open, hZC_arc⟩ := hZ.1 x hxB.1 univ isOpen_univ (mem_univ x) + refine ⟨C, hC_open, hxC, fun y hy => ⟨hy.1, fun hyA => hxB.2 ?_⟩⟩ + have hj : JoinedIn (Z ∩ C) y x := + isArcConnected_iff_joinedIn.mp hZC_arc y hy x ⟨hxB.1, hxC⟩ + exact JoinedIn.trans hyA (hj.mono inter_subset_left) + set U_A : Set S := ⋃ (x : S) (hx : x ∈ A), (hA_open_in_Z x hx).choose + set U_B : Set S := ⋃ (x : S) (hx : x ∈ B), (hB_open_in_Z x hx).choose + have hUA_open : IsOpen U_A := + isOpen_iUnion fun x => isOpen_iUnion fun hx => (hA_open_in_Z x hx).choose_spec.1 + have hUB_open : IsOpen U_B := + isOpen_iUnion fun x => isOpen_iUnion fun hx => (hB_open_in_Z x hx).choose_spec.1 + have hA_eq : A = Z \ U_B := by + ext y + constructor + · intro hyA + refine ⟨hA_sub hyA, ?_⟩ + rintro hyUB + obtain ⟨x, hx, hyC⟩ := mem_iUnion₂.mp hyUB + exact ((hB_open_in_Z x hx).choose_spec.2.2 ⟨hA_sub hyA, hyC⟩).2 hyA + · rintro ⟨hyZ, hynotUB⟩ + by_contra hynotA + have hyB : y ∈ B := ⟨hyZ, hynotA⟩ + exact hynotUB (mem_iUnion₂.mpr ⟨y, hyB, (hB_open_in_Z y hyB).choose_spec.2.1⟩) + have hB_eq : B = Z \ U_A := by + ext y + constructor + · rintro ⟨hyZ, hynotA⟩ + refine ⟨hyZ, ?_⟩ + rintro hyUA + obtain ⟨x, hx, hyC⟩ := mem_iUnion₂.mp hyUA + exact hynotA ((hA_open_in_Z x hx).choose_spec.2.2 ⟨hyZ, hyC⟩) + · rintro ⟨hyZ, hynotUA⟩ + refine ⟨hyZ, fun hyA => ?_⟩ + exact hynotUA (mem_iUnion₂.mpr ⟨y, hyA, (hA_open_in_Z y hyA).choose_spec.2.1⟩) + exact ⟨hA_eq ▸ hZ.2.sdiff hUB_open, hB_eq ▸ hZ.2.sdiff hUA_open⟩ + +/-- A connected surface `S` is arc-connected (`IsArcConnected (univ : Set S)`). -/ +theorem isArcConnected_univ_of_isSurface (hS : IsSurface S) [ConnectedSpace S] : + IsArcConnected (univ : Set S) := by + have : T2Space S := hS.2.1 + have hlac : IsLocallyArcConnected (univ : Set S) := by + intro x _ A hA hxA + obtain ⟨W, hWA, hxW, hW_open, hW_arc, _⟩ := exists_chart_ball_subset hS x hA hxA + exact ⟨W, hWA, hxW, hW_open, by rwa [univ_inter]⟩ + obtain ⟨z₀⟩ := (inferInstance : Nonempty S) + obtain ⟨hA_closed, hB_closed⟩ := + isClosed_pathComponentIn_and_sdiff_of_isSolid hS ⟨hlac, isClosed_univ⟩ (z₀ := z₀) + set A : Set S := pathComponentIn univ z₀ + set B : Set S := univ \ A + have hz₀A : z₀ ∈ A := mem_pathComponentIn_self (mem_univ z₀) + have hA_open : IsOpen A := by + have : A = Bᶜ := by ext x; simp [B] + rw [this] + exact hB_closed.isOpen_compl + have hA_clopen : IsClopen A := ⟨hA_closed, hA_open⟩ + have hA_univ : A = univ := hA_clopen.eq_univ ⟨z₀, hz₀A⟩ + rw [← hA_univ] + exact IsPathConnected.isArcConnected (isPathConnected_pathComponentIn (mem_univ z₀)) + +/-- Every `[0, 1]`-arc `T` in a surface `S` is solid (`IsSolid T`). -/ +theorem isSolid_of_isLineWithEnds (hS : IsSurface S) {T : Set S} {a b : S} + (hT : IsLineWithEnds T a b) : IsSolid T := by + have : T2Space S := hS.2.1 + obtain ⟨f, _, _⟩ := hT + let e : unitInterval → S := fun t => (f t).1 + have he_cont : Continuous e := continuous_subtype_val.comp f.continuous + have hT_range : T = range e := by + ext x + exact ⟨fun hx => ⟨f.symm ⟨x, hx⟩, by simp [e]⟩, by rintro ⟨t, rfl⟩; exact (f t).2⟩ + have hT_closed : IsClosed T := hT_range ▸ (isCompact_range he_cont).isClosed + refine ⟨?_, hT_closed⟩ + intro z hz A hA_open hzA + let t₀ : unitInterval := f.symm ⟨z, hz⟩ + have ht₀_mem : t₀ ∈ e ⁻¹' A := by + change (f (f.symm ⟨z, hz⟩)).1 ∈ A + simpa using hzA + obtain ⟨r, hr_pos, hr_sub⟩ := Metric.isOpen_iff.mp (hA_open.preimage he_cont) t₀ ht₀_mem + have hball_open_T : IsOpen (f '' Metric.ball t₀ r) := + f.isOpenMap _ Metric.isOpen_ball + obtain ⟨W₀, hW₀_open, hW₀_eq⟩ := isOpen_induced_iff.mp hball_open_T + let A' : Set S := W₀ ∩ A + have hT_inter : T ∩ A' = e '' Metric.ball t₀ r := by + ext x + constructor + · rintro ⟨hxT, hxW₀, _⟩ + have hx_mem : (⟨x, hxT⟩ : T) ∈ Subtype.val ⁻¹' W₀ := hxW₀ + rw [hW₀_eq] at hx_mem + obtain ⟨t, ht, hft⟩ := hx_mem + exact ⟨t, ht, congrArg Subtype.val hft⟩ + · rintro ⟨t, ht, rfl⟩ + have hft_mem : f t ∈ f '' Metric.ball t₀ r := mem_image_of_mem f ht + rw [← hW₀_eq] at hft_mem + exact ⟨(f t).2, hft_mem, hr_sub ht⟩ + have hzA' : z ∈ A' := by + have : z ∈ T ∩ A' := by + rw [hT_inter] + refine ⟨t₀, Metric.mem_ball_self hr_pos, ?_⟩ + change (f (f.symm ⟨z, hz⟩)).1 = z + simp + exact this.2 + have hball_pc : IsPathConnected (Metric.ball t₀ r) := by + have hconv : Convex ℝ (Subtype.val '' Metric.ball t₀ r) := by + have heq : Subtype.val '' Metric.ball t₀ r = Icc (0 : ℝ) 1 ∩ Metric.ball (t₀ : ℝ) r := by + ext x + simp only [mem_image, Metric.mem_ball, Subtype.exists, Subtype.dist_eq, mem_inter_iff] + exact ⟨fun ⟨u, huI, hur, hux⟩ => hux ▸ ⟨huI, hur⟩, + fun ⟨hxI, hxr⟩ => ⟨x, hxI, hxr, rfl⟩⟩ + rw [heq] + exact (convex_Icc 0 1).inter (convex_ball (t₀ : ℝ) r) + rw [IsInducing.subtypeVal.isPathConnected_iff] + exact hconv.isPathConnected ⟨(t₀ : ℝ), mem_image_of_mem Subtype.val + (Metric.mem_ball_self hr_pos)⟩ + have hTA'_arc : IsArcConnected (T ∩ A') := by + rw [hT_inter] + exact IsPathConnected.isArcConnected (hball_pc.image he_cont) + exact ⟨A', inter_subset_right, hzA', hW₀_open.inter hA_open, hTA'_arc⟩ + +/-- Every nonempty open subset `W` of `Circle` contains at least two distinct points. -/ +private theorem exists_ne_of_isOpen_circle {W : Set Circle} (hW : IsOpen W) {z₁ : Circle} + (hz₁ : z₁ ∈ W) : ∃ z₂ ∈ W, z₂ ≠ z₁ := by + by_contra! h + have hW_eq : W = {z₁} := Subset.antisymm h (singleton_subset_iff.mpr hz₁) + have hW_clopen : IsClopen W := ⟨hW_eq ▸ isClosed_singleton, hW⟩ + have hW_univ : W = univ := hW_clopen.eq_univ ⟨z₁, hz₁⟩ + have hneg : -z₁ ∈ ({z₁} : Set Circle) := by rw [← hW_eq, hW_univ]; exact mem_univ _ + exact Circle.neg_ne_self z₁ (mem_singleton_iff.mp hneg) + +/-- Any `O`-arc `F` contained in a `[0, 1]`-arc `T` is null-homotopic in `S`. -/ +private theorem isNullHomotopicOArc_of_subset_line {T F : Set S} {a b : S} + (hT : IsLineWithEnds T a b) (hFT : F ⊆ T) (hF : IsOArc F) : + IsNullHomotopicOArc F := by + obtain ⟨f, _, _⟩ := hT + obtain ⟨φ⟩ := hF + let lift : Circle → unitInterval := fun z => f.symm ⟨(φ z).1, hFT (φ z).2⟩ + have hlift_cont : Continuous lift := by + dsimp [lift] + fun_prop + let H : Circle × unitInterval → unitInterval := fun p => + ⟨(1 - (p.2 : ℝ)) * (lift p.1 : ℝ), + mul_nonneg (sub_nonneg.mpr p.2.2.2) (lift p.1).2.1, + by nlinarith [p.2.2.1, p.2.2.2, (lift p.1).2.1, (lift p.1).2.2]⟩ + have hH_cont : Continuous H := by + refine Continuous.subtype_mk ?_ _ + exact (continuous_const.sub (continuous_subtype_val.comp continuous_snd)).mul + (continuous_subtype_val.comp (hlift_cont.comp continuous_fst)) + refine ⟨φ, (f 0).1, mem_univ _, ⟨⟨fun p => (f (H p)).1, + continuous_subtype_val.comp (f.continuous.comp hH_cont)⟩, fun _ => mem_univ _, ?_, ?_⟩⟩ + · intro z + have h0 : H (z, 0) = lift z := by ext; simp [H] + change (f (H (z, 0))).1 = (φ z).1 + rw [h0] + change (f (f.symm ⟨(φ z).1, hFT (φ z).2⟩)).1 = (φ z).1 + simp + · intro z + have h1 : H (z, 1) = 0 := by ext; simp [H] + change (f (H (z, 1))).1 = (f 0).1 + rw [h1] + +/-! ## Proof of (11.7): Bridge Arc (`solid_bridge_arc`) -/ + +private theorem flat_union_of_bridge_arc (hS : IsSurface S) {Z A : Set S} + (hZ_closed : IsClosed Z) (hZ_flat : IsFlat Z) (hA_sub : A ⊆ Z) + (hA_closed : IsClosed A) (hB_closed : IsClosed (Z \ A)) + {e : unitInterval → S} (he_cont : Continuous e) (he_inj : Injective e) + {a b : S} (he0 : e 0 = a) (he1 : e 1 = b) + (ha_A : a ∈ A) (hb_B : b ∈ Z \ A) + (he_mem_A : ∀ t : unitInterval, e t ∈ A ↔ t = 0) + (he_mem_B : ∀ t : unitInterval, e t ∈ Z \ A ↔ t = 1) + (hT_line : IsLineWithEnds (range e) a b) : IsFlat (Z ∪ range e) := by + have : T2Space S := hS.2.1 + let B := Z \ A + let T := range e + refine isFlat_of_forall_isNullHomotopicOArc hS fun F hF_sub hF_oarc => ?_ + -- For any interior point `t ∈ Ioo 0 1` with `e t ∈ F`, `F` is contained in + -- `K₁ t := A ∪ e '' Iic t` or `K₂ t := B ∪ e '' Ici t`. + let K₁ : unitInterval → Set S := fun t => A ∪ e '' Iic t + let K₂ : unitInterval → Set S := fun t => B ∪ e '' Ici t + have hK₁_closed : ∀ t, IsClosed (K₁ t) := fun t => + hA_closed.union (isClosed_Iic.isCompact.image he_cont).isClosed + have hK₂_closed : ∀ t, IsClosed (K₂ t) := fun t => + hB_closed.union (isClosed_Ici.isCompact.image he_cont).isClosed + have hK_union : ∀ t, Z ∪ T ⊆ K₁ t ∪ K₂ t := by + intro t x hx + rcases hx with hxZ | ⟨s, rfl⟩ + · by_cases hxA : x ∈ A + · exact Or.inl (Or.inl hxA) + · exact Or.inr (Or.inl ⟨hxZ, hxA⟩) + · rcases le_total s t with hst | hts + · exact Or.inl (Or.inr ⟨s, hst, rfl⟩) + · exact Or.inr (Or.inr ⟨s, hts, rfl⟩) + have hK_inter : ∀ t ∈ Ioo (0 : unitInterval) 1, K₁ t ∩ K₂ t = {e t} := by + intro t ⟨ht0, ht1⟩ + ext x + constructor + · rintro (⟨hxA | ⟨s₁, hs₁, rfl⟩, hxB | ⟨s₂, hs₂, heq⟩⟩) + · exact False.elim (hxB.2 hxA) + · exfalso + have hs₂0 : s₂ = 0 := (he_mem_A s₂).mp (heq ▸ hxA) + exact ht0.not_ge (hs₂0 ▸ hs₂) + · exfalso + have hs₁1 : s₁ = 1 := (he_mem_B s₁).mp hxB + exact ht1.not_ge (hs₁1 ▸ hs₁) + · have hs_eq : s₁ = s₂ := he_inj heq.symm + have hst : s₁ = t := le_antisymm hs₁ (hs_eq ▸ hs₂) + exact mem_singleton_iff.mpr (hst ▸ rfl) + · rintro rfl + exact ⟨Or.inr ⟨t, le_refl t, rfl⟩, Or.inr ⟨t, le_refl t, rfl⟩⟩ + have hF_dichotomy : ∀ t ∈ Ioo (0 : unitInterval) 1, e t ∈ F → F ⊆ K₁ t ∨ F ⊆ K₂ t := by + intro t ht hetF + obtain ⟨φ⟩ := hF_oarc + let z_t : Circle := φ.symm ⟨e t, hetF⟩ + have hcompl_pc : IsPathConnected ({z_t}ᶜ : Set Circle) := + Circle.isPathConnected_compl_singleton z_t + have hF_minus_eq : F \ {e t} = (Subtype.val ∘ φ) '' ({z_t}ᶜ : Set Circle) := by + ext x + constructor + · rintro ⟨hxF, hxne⟩ + refine ⟨φ.symm ⟨x, hxF⟩, ?_, by simp⟩ + intro hzeq + have h1 : (φ (φ.symm ⟨x, hxF⟩)).1 = (φ z_t).1 := congrArg (fun z => (φ z).1) hzeq + simp only [z_t, Homeomorph.apply_symm_apply] at h1 + exact hxne h1 + · rintro ⟨z, hzne, rfl⟩ + refine ⟨(φ z).2, ?_⟩ + intro hxeq + apply hzne + change z = φ.symm ⟨e t, hetF⟩ + have : φ z = ⟨e t, hetF⟩ := Subtype.ext hxeq + rw [← this, φ.symm_apply_apply] + have hF_minus_pre : IsPreconnected (F \ {e t}) := by + rw [hF_minus_eq] + exact (hcompl_pc.image (continuous_subtype_val.comp φ.continuous)).isConnected.isPreconnected + let V₁ : Set S := (K₂ t)ᶜ + let V₂ : Set S := (K₁ t)ᶜ + have hsub_V : F \ {e t} ⊆ V₁ ∪ V₂ := by + rintro x ⟨_, hxne⟩ + by_cases hx1 : x ∈ K₁ t + · by_cases hx2 : x ∈ K₂ t + · exfalso + have hx_inter : x ∈ K₁ t ∩ K₂ t := ⟨hx1, hx2⟩ + rw [hK_inter t ht] at hx_inter + exact hxne hx_inter + · exact Or.inl hx2 + · exact Or.inr hx1 + have hdisj_V : (F \ {e t}) ∩ (V₁ ∩ V₂) = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro x ⟨⟨hxF, _⟩, hxV₁, hxV₂⟩ + rcases hK_union t (hF_sub hxF) with hx1 | hx2 + · exact hxV₂ hx1 + · exact hxV₁ hx2 + rcases isPreconnected_iff_subset_of_disjoint.mp hF_minus_pre V₁ V₂ + (hK₂_closed t).isOpen_compl (hK₁_closed t).isOpen_compl hsub_V hdisj_V with h₁ | h₂ + · left + intro x hxF + by_cases hxt : x = e t + · rw [hxt]; exact Or.inr ⟨t, le_refl t, rfl⟩ + · have hxV₁ : x ∉ K₂ t := h₁ ⟨hxF, hxt⟩ + exact (hK_union t (hF_sub hxF)).resolve_right hxV₁ + · right + intro x hxF + by_cases hxt : x = e t + · rw [hxt]; exact Or.inr ⟨t, le_refl t, rfl⟩ + · have hxV₂ : x ∉ K₁ t := h₂ ⟨hxF, hxt⟩ + exact (hK_union t (hF_sub hxF)).resolve_left hxV₂ + by_cases hFZ : F ⊆ Z + · exact isNullHomotopicOArc_of_isFlat hZ_flat hFZ hF_oarc + · obtain ⟨x₁, hx₁F, hx₁Z⟩ := not_subset.mp hFZ + obtain ⟨φ⟩ := id hF_oarc + let W : Set Circle := {z : Circle | (φ z).1 ∉ Z} + have hW_open : IsOpen W := + hZ_closed.isOpen_compl.preimage (continuous_subtype_val.comp φ.continuous) + let z₁ : Circle := φ.symm ⟨x₁, hx₁F⟩ + have hz₁W : z₁ ∈ W := by change (φ (φ.symm ⟨x₁, hx₁F⟩)).1 ∉ Z; simpa using hx₁Z + obtain ⟨z₂, hz₂W, hz_ne⟩ := exists_ne_of_isOpen_circle hW_open hz₁W + let x₂ : S := (φ z₂).1 + have hx₂F : x₂ ∈ F := (φ z₂).2 + have hx₂Z : x₂ ∉ Z := hz₂W + have hx_ne : x₁ ≠ x₂ := by + intro heq + apply hz_ne + have : φ z₂ = ⟨x₁, hx₁F⟩ := Subtype.ext heq.symm + dsimp [z₁] + rw [← this, φ.symm_apply_apply] + have hx₁T : x₁ ∈ T := (hF_sub hx₁F).resolve_left hx₁Z + have hx₂T : x₂ ∈ T := (hF_sub hx₂F).resolve_left hx₂Z + obtain ⟨t₁', ht₁'⟩ := hx₁T + obtain ⟨t₂', ht₂'⟩ := hx₂T + have ht₁'_Ioo : t₁' ∈ Ioo (0 : unitInterval) 1 := by + refine ⟨lt_of_le_of_ne t₁'.2.1 ?_, lt_of_le_of_ne t₁'.2.2 ?_⟩ + · intro h0; exact hx₁Z (ht₁' ▸ h0 ▸ he0 ▸ hA_sub ha_A) + · intro h1; exact hx₁Z (ht₁' ▸ h1 ▸ he1 ▸ hb_B.1) + have ht₂'_Ioo : t₂' ∈ Ioo (0 : unitInterval) 1 := by + refine ⟨lt_of_le_of_ne t₂'.2.1 ?_, lt_of_le_of_ne t₂'.2.2 ?_⟩ + · intro h0; exact hx₂Z (ht₂' ▸ h0 ▸ he0 ▸ hA_sub ha_A) + · intro h1; exact hx₂Z (ht₂' ▸ h1 ▸ he1 ▸ hb_B.1) + have ht'_ne : t₁' ≠ t₂' := fun h => hx_ne (ht₁' ▸ ht₂' ▸ congrArg e h) + have hFT : F ⊆ T := by + have h_ord : ∀ u₁ u₂ : unitInterval, u₁ ∈ Ioo 0 1 → u₂ ∈ Ioo 0 1 → + u₁ < u₂ → e u₁ ∈ F → e u₂ ∈ F → F ⊆ T := by + intro u₁ u₂ hu₁ hu₂ hlt heu₁ heu₂ + have h1 : F ⊆ K₁ u₂ := by + refine (hF_dichotomy u₂ hu₂ heu₂).resolve_right fun hsub2 => ?_ + rcases hsub2 heu₁ with hB1 | ⟨s, hs, heq⟩ + · exact (lt_irrefl (1 : unitInterval)) ((he_mem_B u₁).mp hB1 ▸ hu₁.2) + · have : u₁ = s := he_inj heq.symm + exact hlt.not_ge (this ▸ hs) + have h2 : F ⊆ K₂ u₁ := by + refine (hF_dichotomy u₁ hu₁ heu₁).resolve_left fun hsub1 => ?_ + rcases hsub1 heu₂ with hA2 | ⟨s, hs, heq⟩ + · exact (lt_irrefl (0 : unitInterval)) ((he_mem_A u₂).mp hA2 ▸ hu₂.1) + · have : u₂ = s := he_inj heq.symm + exact hlt.not_ge (this ▸ hs) + intro x hxF + rcases h1 hxF with hxA | ⟨s, _, rfl⟩ + · rcases h2 hxF with hxB | ⟨s, hs, heq⟩ + · exact False.elim (hxB.2 hxA) + · exact ⟨s, heq⟩ + · exact mem_range_self s + rcases lt_or_gt_of_ne ht'_ne with hlt | hgt + · exact h_ord t₁' t₂' ht₁'_Ioo ht₂'_Ioo hlt (ht₁' ▸ hx₁F) (ht₂' ▸ hx₂F) + · exact h_ord t₂' t₁' ht₂'_Ioo ht₁'_Ioo hgt (ht₂' ▸ hx₂F) (ht₁' ▸ hx₁F) + exact isNullHomotopicOArc_of_subset_line hT_line hFT hF_oarc + +/-- The bridge-arc step in the proof of Graph Minors VII, (11.7) (page 253): +in a connected surface `S`, if a solid flat subset `Z ⊆ S` has at least two arc-components, there +is a `[0, 1]`-arc `T ⊆ S` meeting `Z` only at its two ends in distinct arc-components of `Z`, such +that `T` is solid, `Z ∪ T` is flat, and `Z ∪ T` has strictly fewer arc-components than `Z`. -/ +theorem solid_bridge_arc (hS : IsSurface S) [ConnectedSpace S] {Z : Set S} + (hZ_solid : IsSolid Z) (hZ_flat : IsFlat Z) (h2 : 2 ≤ (arcComponentsIn Z).ncard) : + ∃ (T : Set S) (a b : S), IsLineWithEnds T a b ∧ T ∩ Z = {a, b} ∧ + IsSolid T ∧ IsFlat (Z ∪ T) ∧ (arcComponentsIn (Z ∪ T)).ncard < (arcComponentsIn Z).ncard := by + have : T2Space S := hS.2.1 + -- Step 1: Pick two distinct arc-components `A = pathComponentIn Z z₀` and `C₂ = pathComponentIn Z + -- z₁`. + have hfin : (arcComponentsIn Z).Finite := arcComponentsIn_finite_of_isSolid hS hZ_solid + obtain ⟨C₁, C₂, hC₁, hC₂, hC_ne⟩ := + (Set.one_lt_ncard_iff hfin).mp (by omega : 1 < (arcComponentsIn Z).ncard) + rw [arcComponentsIn_eq_image_pathComponentIn] at hC₁ hC₂ + obtain ⟨z₀, hz₀Z, rfl⟩ := hC₁ + obtain ⟨z₁, hz₁Z, rfl⟩ := hC₂ + set A : Set S := pathComponentIn Z z₀ + set B : Set S := Z \ A + have hA_sub : A ⊆ Z := pathComponentIn_subset + have hz₀A : z₀ ∈ A := mem_pathComponentIn_self hz₀Z + have hz₁B : z₁ ∈ B := by + refine ⟨hz₁Z, fun hz₁A => hC_ne ?_⟩ + exact (pathComponentIn_congr hz₁A).symm + obtain ⟨hA_closed, hB_closed⟩ := + isClosed_pathComponentIn_and_sdiff_of_isSolid hS hZ_solid (z₀ := z₀) + -- Step 2: Connect `z₀ ∈ A` to `z₁ ∈ B` in `S`, trim to first hit of `B` and last hit of `A`, + -- and extract an injective `[0, 1]`-arc `T` via (11.1). + obtain ⟨γ₀, _, hγ₀_0, hγ₀_1⟩ := + exists_path_of_isArcConnected (isArcConnected_univ_of_isSurface hS) (mem_univ z₀) (mem_univ z₁) + let PreB : Set unitInterval := γ₀ ⁻¹' B + have hPreB_closed : IsClosed PreB := hB_closed.preimage γ₀.continuous + have h1_PreB : (1 : unitInterval) ∈ PreB := by change γ₀ 1 ∈ B; rw [hγ₀_1]; exact hz₁B + let t₁ : unitInterval := sInf PreB + have ht₁_mem : γ₀ t₁ ∈ B := hPreB_closed.csInf_mem ⟨1, h1_PreB⟩ (OrderBot.bddBelow PreB) + have ht₁_le : ∀ t ∈ PreB, t₁ ≤ t := fun t ht => csInf_le (OrderBot.bddBelow PreB) ht + have ht₁_pos : 0 < (t₁ : ℝ) := by + refine lt_of_le_of_ne t₁.2.1 ?_ + intro heq + have ht₁0 : t₁ = 0 := Subtype.ext heq.symm + rw [ht₁0, hγ₀_0] at ht₁_mem + exact ht₁_mem.2 hz₀A + let γ₁ : C(unitInterval, S) := subPathSeg γ₀ 0 t₁ + have hγ₁_0 : γ₁ 0 = z₀ := by rw [subPathSeg_zero, hγ₀_0] + have hγ₁_1 : γ₁ 1 = γ₀ t₁ := subPathSeg_one γ₀ 0 t₁ + have hγ₁_B : ∀ t : unitInterval, γ₁ t ∈ B → t = 1 := by + intro t htB + have hmem : (⟨(1 - (t : ℝ)) * (0 : ℝ) + (t : ℝ) * (t₁ : ℝ), by + rw [mul_zero, zero_add] + exact ⟨mul_nonneg t.2.1 t₁.2.1, + (mul_le_of_le_one_left t₁.2.1 t.2.2).trans t₁.2.2⟩⟩ : unitInterval) ∈ PreB := htB + have hle := ht₁_le _ hmem + change (t₁ : ℝ) ≤ (1 - (t : ℝ)) * 0 + (t : ℝ) * (t₁ : ℝ) at hle + ext + change (t : ℝ) = 1 + nlinarith [t.2.2, ht₁_pos] + let PreA : Set unitInterval := γ₁ ⁻¹' A + have hPreA_closed : IsClosed PreA := hA_closed.preimage γ₁.continuous + have h0_PreA : (0 : unitInterval) ∈ PreA := by change γ₁ 0 ∈ A; rw [hγ₁_0]; exact hz₀A + let s₀ : unitInterval := sSup PreA + have hs₀_mem : γ₁ s₀ ∈ A := hPreA_closed.csSup_mem ⟨0, h0_PreA⟩ (OrderTop.bddAbove PreA) + have hs₀_ge : ∀ s ∈ PreA, s ≤ s₀ := fun s hs => le_csSup (OrderTop.bddAbove PreA) hs + have hs₀_lt1 : (s₀ : ℝ) < 1 := by + refine lt_of_le_of_ne s₀.2.2 ?_ + intro heq + have hs₀1 : s₀ = 1 := Subtype.ext heq + rw [hs₀1, hγ₁_1] at hs₀_mem + exact ht₁_mem.2 hs₀_mem + let γ₂ : C(unitInterval, S) := subPathSeg γ₁ s₀ 1 + set a : S := γ₂ 0 + set b : S := γ₂ 1 + have ha_A : a ∈ A := by change γ₂ 0 ∈ A; rw [subPathSeg_zero]; exact hs₀_mem + have hb_B : b ∈ B := by change γ₂ 1 ∈ B; rw [subPathSeg_one, hγ₁_1]; exact ht₁_mem + have hab_ne : a ≠ b := fun h => hb_B.2 (h ▸ ha_A) + have hγ₂_A : ∀ t : unitInterval, γ₂ t ∈ A → t = 0 := by + intro t htA + let u : unitInterval := ⟨(1 - (t : ℝ)) * (s₀ : ℝ) + (t : ℝ) * 1, + by nlinarith [t.2.1, t.2.2, s₀.2.1], by nlinarith [t.2.1, t.2.2, s₀.2.2]⟩ + have hle : (u : ℝ) ≤ (s₀ : ℝ) := hs₀_ge u htA + change (1 - (t : ℝ)) * (s₀ : ℝ) + (t : ℝ) * 1 ≤ (s₀ : ℝ) at hle + ext + change (t : ℝ) = 0 + nlinarith [t.2.1, hs₀_lt1] + have hγ₂_B : ∀ t : unitInterval, γ₂ t ∈ B → t = 1 := by + intro t htB + let u : unitInterval := ⟨(1 - (t : ℝ)) * (s₀ : ℝ) + (t : ℝ) * 1, + by nlinarith [t.2.1, t.2.2, s₀.2.1], by nlinarith [t.2.1, t.2.2, s₀.2.2]⟩ + have hu1 : u = 1 := hγ₁_B u htB + have hu1' : (1 - (t : ℝ)) * (s₀ : ℝ) + (t : ℝ) * 1 = 1 := congrArg Subtype.val hu1 + ext + change (t : ℝ) = 1 + nlinarith [t.2.2, hs₀_lt1] + obtain ⟨e, he_cont, he_inj, he0, he1, he_sub⟩ := exists_arc_of_path γ₂.continuous hab_ne + let T : Set S := range e + have he_emb : IsEmbedding e := (he_cont.isClosedEmbedding he_inj).isEmbedding + have hT_line : IsLineWithEnds T a b := ⟨he_emb.toHomeomorph, he0, he1⟩ + have he_mem_A : ∀ t : unitInterval, e t ∈ A ↔ t = 0 := by + intro t + refine ⟨fun h => ?_, fun h => h ▸ he0 ▸ ha_A⟩ + obtain ⟨u, hu⟩ := he_sub (mem_range_self t) + have hu0 : u = 0 := hγ₂_A u (hu ▸ h) + have het : e t = e 0 := by rw [← hu, hu0, ← he0] + exact he_inj het + have he_mem_B : ∀ t : unitInterval, e t ∈ B ↔ t = 1 := by + intro t + refine ⟨fun h => ?_, fun h => h ▸ he1 ▸ hb_B⟩ + obtain ⟨u, hu⟩ := he_sub (mem_range_self t) + have hu1 : u = 1 := hγ₂_B u (hu ▸ h) + have het : e t = e 1 := by rw [← hu, hu1, ← he1] + exact he_inj het + have hTZ_eq : T ∩ Z = {a, b} := by + ext x + constructor + · rintro ⟨⟨t, rfl⟩, hxZ⟩ + by_cases hxA : e t ∈ A + · rw [(he_mem_A t).mp hxA, he0]; exact Or.inl rfl + · have hxB : e t ∈ B := ⟨hxZ, hxA⟩ + rw [(he_mem_B t).mp hxB, he1]; exact Or.inr rfl + · rintro (rfl | rfl) + · exact ⟨⟨0, he0⟩, hA_sub ha_A⟩ + · exact ⟨⟨1, he1⟩, hb_B.1⟩ + -- Step 3: Prove `IsSolid T`. + have hT_solid : IsSolid T := isSolid_of_isLineWithEnds hS hT_line + have hZT_flat : IsFlat (Z ∪ T) := + flat_union_of_bridge_arc hS hZ_solid.2 hZ_flat hA_sub hA_closed hB_closed + he_cont he_inj he0 he1 ha_A hb_B he_mem_A he_mem_B hT_line + -- Step 5: Prove `(arcComponentsIn (Z ∪ T)).ncard < (arcComponentsIn Z).ncard`. + have hncard_lt : (arcComponentsIn (Z ∪ T)).ncard < (arcComponentsIn Z).ncard := by + let g : Set S → Set S := fun C => ⋃ x ∈ C, pathComponentIn (Z ∪ T) x + have hg_eq : ∀ z ∈ Z, g (pathComponentIn Z z) = pathComponentIn (Z ∪ T) z := by + intro z hz + ext y + simp only [g, mem_iUnion₂] + constructor + · rintro ⟨x, hx, hy⟩ + exact JoinedIn.trans (hx.mono subset_union_left) hy + · intro hy + exact ⟨z, mem_pathComponentIn_self hz, hy⟩ + have haZ : a ∈ Z := hA_sub ha_A + have hbZ : b ∈ Z := hb_B.1 + let C_a : Set S := pathComponentIn Z a + let C_b : Set S := pathComponentIn Z b + have hCa_mem : C_a ∈ arcComponentsIn Z := pathComponentIn_mem_arcComponentsIn haZ + have hCb_mem : C_b ∈ arcComponentsIn Z := pathComponentIn_mem_arcComponentsIn hbZ + have hCa_ne_Cb : C_a ≠ C_b := by + intro heq + have hCa_eq_A : C_a = A := pathComponentIn_congr ha_A + have hb_in_A : b ∈ A := by + rw [← hCa_eq_A, heq] + exact mem_pathComponentIn_self hbZ + exact hb_B.2 hb_in_A + have hI_pc : IsPathConnected (univ : Set unitInterval) := by + rw [IsInducing.subtypeVal.isPathConnected_iff, image_univ, Subtype.range_coe] + exact (convex_Icc (0 : ℝ) 1).isPathConnected ⟨0, left_mem_Icc.mpr zero_le_one⟩ + have hT_pc : IsPathConnected T := by + dsimp [T] + rw [← image_univ] + exact hI_pc.image he_cont + have hj_ab : JoinedIn (Z ∪ T) a b := + (hT_pc.joinedIn a ⟨0, he0⟩ b ⟨1, he1⟩).mono subset_union_right + have hg_ab : g C_a = g C_b := by + rw [hg_eq a haZ, hg_eq b hbZ] + exact (pathComponentIn_congr hj_ab).symm + have hsub_img : arcComponentsIn (Z ∪ T) ⊆ g '' (arcComponentsIn Z \ {C_b}) := by + rw [arcComponentsIn_eq_image_pathComponentIn] + rintro _ ⟨y, hyZT, rfl⟩ + have hex_z : ∃ z ∈ Z, pathComponentIn (Z ∪ T) y = pathComponentIn (Z ∪ T) z := by + rcases hyZT with hyZ | hyT + · exact ⟨y, hyZ, rfl⟩ + · have hj_ay : JoinedIn (Z ∪ T) a y := + (hT_pc.joinedIn a ⟨0, he0⟩ y hyT).mono subset_union_right + exact ⟨a, haZ, pathComponentIn_congr hj_ay⟩ + obtain ⟨z, hzZ, hzy⟩ := hex_z + rw [hzy, ← hg_eq z hzZ] + by_cases hzb : pathComponentIn Z z = C_b + · rw [hzb, ← hg_ab] + exact ⟨C_a, ⟨hCa_mem, hCa_ne_Cb⟩, rfl⟩ + · exact ⟨pathComponentIn Z z, ⟨pathComponentIn_mem_arcComponentsIn hzZ, hzb⟩, rfl⟩ + have hfin_diff : (arcComponentsIn Z \ {C_b}).Finite := hfin.sdiff + have h1 : (arcComponentsIn (Z ∪ T)).ncard ≤ (g '' (arcComponentsIn Z \ {C_b})).ncard := + Set.ncard_le_ncard hsub_img (hfin_diff.image g) + have h2 : (g '' (arcComponentsIn Z \ {C_b})).ncard ≤ (arcComponentsIn Z \ {C_b}).ncard := + Set.ncard_image_le hfin_diff + have h3 : (arcComponentsIn Z \ {C_b}).ncard < (arcComponentsIn Z).ncard := + Set.ncard_lt_ncard ⟨sdiff_subset, fun h => (h hCb_mem).2 rfl⟩ hfin + omega + exact ⟨T, a, b, hT_line, hTZ_eq, hT_solid, hZT_flat, hncard_lt⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section11e.lean b/LeanPool/GraphMinor/GM07/Section11e.lean new file mode 100644 index 0000000000..c0818e7e0e --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section11e.lean @@ -0,0 +1,1044 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.Surface.Collar +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.DiscsInSurface + +/-! +# Graph Minors VII, (11.3): Pushing a Closed Curve Out of the Interior of a Closed Disc + +This file proves (11.3) of Robertson and Seymour, *Graph Minors VII. Disjoint paths on a surface* +(pages 249–251): + +- `disc_interior_curve_homotopy` / `theorem_11_3`: Let `S` be a surface, `Δ ⊆ S` be a closed disc, + and `Y ⊆ S` be such that `Y ∩ discBd Δ` is arc-connected. Any continuous map + `φ : C(Circle, S)` with `range φ ⊆ Y ∪ (Δ \ discBd Δ)` (with `(Y ∩ discBd Δ).Nonempty` in the + degenerate case `range φ ⊆ Δ \ discBd Δ`) is homotopic in `S` to a map `ψ : C(Circle, S)` with + `range ψ ⊆ Y` and `range ψ ⊆ range φ ∪ discBd Δ`. In particular, if `Y` is flat then so is + `Y ∪ (Δ \ discBd Δ)` (`isFlat_union_disc_diff_discBd`). +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Function Topology Metric Filter GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Homotopy in a Closed Disc to a Constant Curve -/ + +private lemma isPreconnected_of_isArcConnected {Z : Set S} (hZ : IsArcConnected Z) : + IsPreconnected Z := by + rcases Z.eq_empty_or_nonempty with rfl | ⟨x₀, hx₀⟩ + · exact isPreconnected_empty + · have hpc : IsPathConnected Z := by + refine ⟨x₀, hx₀, fun {y} hy => ?_⟩ + rcases eq_or_ne x₀ y with rfl | hne + · exact JoinedIn.refl hx₀ + · obtain ⟨L, hLZ, f, hf0, hf1⟩ := hZ x₀ hx₀ y hy hne + let p : Path x₀ y := + { toContinuousMap := ⟨fun t => (f t).1, continuous_subtype_val.comp f.continuous⟩ + source' := hf0 + target' := hf1 } + exact ⟨p, fun t => hLZ (f t).2⟩ + exact hpc.isConnected.isPreconnected + +/-- Any closed curve `φ : C(Circle, S)` whose range is contained in a closed disc `Δ ⊆ S` is +homotopic in `Δ` (and hence in `univ`) to the constant curve at any point `y₀ ∈ Δ`. -/ +private lemma closedCurvesHomotopicIn_const_of_range_subset_disc + {Δ : Set S} (hΔ : IsClosedDisc Δ) {y₀ : S} (hy₀ : y₀ ∈ Δ) + (φ : C(Circle, S)) (hφ : range φ ⊆ Δ) : + ClosedCurvesHomotopicIn univ φ (ContinuousMap.const Circle y₀) := by + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + have hφΔ : ∀ z : Circle, φ z ∈ Δ := fun z => hφ (mem_range_self z) + have hcomb_mem : ∀ p : Circle × unitInterval, + (1 - (p.2 : ℝ)) • h (φ p.1) + (p.2 : ℝ) • h y₀ ∈ closedBall (0 : ℂ) 1 := by + intro p + exact convex_closedBall (0 : ℂ) 1 (c.hm (hφΔ p.1)) (c.hm hy₀) + (sub_nonneg.mpr p.2.2.2) p.2.2.1 (sub_add_cancel 1 (p.2 : ℝ)) + let L : Circle × unitInterval → ℂ := + fun p => (1 - (p.2 : ℝ)) • h (φ p.1) + (p.2 : ℝ) • h y₀ + have hL_cont : Continuous L := by + have hhφ : Continuous (fun z : Circle => h (φ z)) := + c.hc.comp_continuous φ.continuous hφΔ + have ht : Continuous (fun p : Circle × unitInterval => (p.2 : ℝ)) := + continuous_subtype_val.comp continuous_snd + exact ((continuous_const.sub ht).smul (hhφ.comp continuous_fst)).add + (ht.smul continuous_const) + have hΘ_cont : Continuous (fun p : Circle × unitInterval => g (L p)) := + c.gc.comp_continuous hL_cont hcomb_mem + refine ⟨⟨fun p => g (L p), hΘ_cont⟩, fun _ => mem_univ _, fun z => ?_, fun z => ?_⟩ + · change g ((1 - (0 : ℝ)) • h (φ z) + (0 : ℝ) • h y₀) = φ z + simp [c.gh (hφΔ z)] + · change g ((1 - (1 : ℝ)) • h (φ z) + (1 : ℝ) • h y₀) = y₀ + simp [c.gh hy₀] + +/-! ## 2. Boundary Arc Family on `Circle` in a Suitable Chart of `Δ` -/ + +/-- For a closed disc `Δ ⊆ S` and `Y ⊆ S` such that `Y ∩ discBd Δ` is arc-connected, there exist a +chart `IsChart Δ h g` and a family of arcs `arcBetween : Circle → Circle → unitInterval → Circle` +such that: +1. For all `w₁, w₂ : Circle`, `arcBetween w₁ w₂` is continuous from `w₁` to `w₂`. +2. Whenever `g w₁, g w₂ ∈ Y ∩ discBd Δ`, the entire arc `arcBetween w₁ w₂` maps under `g` into + `Y ∩ discBd Δ`. +3. For every `w₀` with `g w₀ ∈ Y ∩ discBd Δ` and every neighborhood `V ∈ 𝓝 w₀`, there is a + neighborhood `W ∈ 𝓝 w₀` such that `arcBetween w₁ w₂ τ ∈ V` for all `w₁, w₂ ∈ W` and all + `τ : unitInterval`. -/ +private lemma exists_chart_and_arcBetween + (hS : IsSurface S) {Δ Y : Set S} (hΔ : IsClosedDisc Δ) + (hY_arc : IsArcConnected (Y ∩ discBd Δ)) : + ∃ (h : S → ℂ) (g : ℂ → S) (_c : IsChart Δ h g) + (arcBetween : Circle → Circle → unitInterval → Circle), + (∀ w₁ w₂ : Circle, Continuous (arcBetween w₁ w₂)) ∧ + (∀ w₁ w₂ : Circle, arcBetween w₁ w₂ 0 = w₁ ∧ arcBetween w₁ w₂ 1 = w₂) ∧ + (∀ w₁ w₂ : Circle, g (w₁ : ℂ) ∈ Y ∩ discBd Δ → g (w₂ : ℂ) ∈ Y ∩ discBd Δ → + ∀ τ : unitInterval, g ((arcBetween w₁ w₂ τ : Circle) : ℂ) ∈ Y ∩ discBd Δ) ∧ + (∀ w₀ : Circle, g (w₀ : ℂ) ∈ Y ∩ discBd Δ → ∀ V ∈ 𝓝 w₀, + ∃ W ∈ 𝓝 w₀, ∀ w₁ ∈ W, ∀ w₂ ∈ W, ∀ τ : unitInterval, arcBetween w₁ w₂ τ ∈ V) := by + have : T2Space S := hS.2.1 + by_cases hbd_sub : discBd Δ ⊆ Y + · obtain ⟨h, g, c⟩ := hΔ.exists_isChart + let arcBetween : Circle → Circle → unitInterval → Circle := + fun w₁ w₂ τ => w₁ * Circle.exp ((τ : ℝ) * Complex.arg ((w₂ * w₁⁻¹ : Circle) : ℂ)) + refine ⟨h, g, c, arcBetween, ?_, ?_, ?_, ?_⟩ + · intro w₁ w₂ + dsimp [arcBetween] + fun_prop + · intro w₁ w₂ + constructor + · change w₁ * Circle.exp ((0 : ℝ) * Complex.arg ((w₂ * w₁⁻¹ : Circle) : ℂ)) = w₁ + simp + · change w₁ * Circle.exp ((1 : ℝ) * Complex.arg ((w₂ * w₁⁻¹ : Circle) : ℂ)) = w₂ + rw [one_mul, Circle.exp_arg, mul_comm w₁, inv_mul_cancel_right] + · intro w₁ w₂ _ _ τ + have hbd_mem : g ((arcBetween w₁ w₂ τ : Circle) : ℂ) ∈ discBd Δ := by + rw [← c.g_sphere] + exact mem_image_of_mem g (arcBetween w₁ w₂ τ).2 + exact ⟨hbd_sub hbd_mem, hbd_mem⟩ + · intro w₀ _ V hV + have hmul_cont : ContinuousAt (fun p : Circle × Circle => p.1 * p.2) (w₀, 1) := + continuous_mul.continuousAt + have hmul_eq : w₀ * (1 : Circle) = w₀ := mul_one w₀ + obtain ⟨U₁, hU₁, U₂, hU₂, hU_sub⟩ := + mem_nhds_prod_iff.mp (hmul_cont (hmul_eq.symm ▸ hV)) + have hexp_cont : ContinuousAt Circle.exp (0 : ℝ) := Circle.exp.continuous.continuousAt + have hexp_zero : Circle.exp 0 = 1 := Circle.exp_zero + obtain ⟨δ, hδ_pos, hδ_sub⟩ := + Metric.mem_nhds_iff.mp (hexp_cont (hexp_zero.symm ▸ hU₂)) + have h1_slit : ((1 : Circle) : ℂ) ∈ Complex.slitPlane := by + simp [Complex.one_mem_slitPlane] + have harg_cont : ContinuousAt (fun u : Circle => Complex.arg (u : ℂ)) 1 := + (Complex.continuousAt_arg h1_slit).comp continuous_subtype_val.continuousAt + have harg_one : Complex.arg ((1 : Circle) : ℂ) = 0 := by simp + have hdiv_cont : ContinuousAt (fun p : Circle × Circle => p.2 * p.1⁻¹) (w₀, w₀) := + (continuous_snd.mul (continuous_fst.inv)).continuousAt + have hdiv_eq : w₀ * w₀⁻¹ = 1 := mul_inv_cancel w₀ + have harg_cont' : ContinuousAt (fun u : Circle => Complex.arg (u : ℂ)) (w₀ * w₀⁻¹) := by + rw [hdiv_eq] + exact harg_cont + have hcomp_cont : ContinuousAt + ((fun u : Circle => Complex.arg (u : ℂ)) ∘ (fun p : Circle × Circle => p.2 * p.1⁻¹)) + (w₀, w₀) := + ContinuousAt.comp harg_cont' hdiv_cont + have hball_nhds : Metric.ball (0 : ℝ) δ ∈ 𝓝 (Complex.arg ((w₀ * w₀⁻¹ : Circle) : ℂ)) := by + rw [hdiv_eq, harg_one] + exact Metric.ball_mem_nhds 0 hδ_pos + obtain ⟨W₁, hW₁, W₂, hW₂, hW_sub⟩ := + mem_nhds_prod_iff.mp (hcomp_cont hball_nhds) + refine ⟨U₁ ∩ W₁ ∩ W₂, Filter.inter_mem (Filter.inter_mem hU₁ hW₁) hW₂, + fun w₁ hw₁ w₂ hw₂ τ => ?_⟩ + have hw₁U₁ : w₁ ∈ U₁ := hw₁.1.1 + have hw₁W₁ : w₁ ∈ W₁ := hw₁.1.2 + have hw₂W₂ : w₂ ∈ W₂ := hw₂.2 + have hmem_W : (w₁, w₂) ∈ W₁ ×ˢ W₂ := ⟨hw₁W₁, hw₂W₂⟩ + have harg_lt : |Complex.arg ((w₂ * w₁⁻¹ : Circle) : ℂ)| < δ := by + simpa [Real.dist_eq] using hW_sub hmem_W + have hτ_lt : |(τ : ℝ) * Complex.arg ((w₂ * w₁⁻¹ : Circle) : ℂ)| < δ := by + rw [abs_mul, abs_of_nonneg τ.2.1] + exact (mul_le_of_le_one_left (abs_nonneg _) τ.2.2).trans_lt harg_lt + have hexp_mem : Circle.exp ((τ : ℝ) * Complex.arg ((w₂ * w₁⁻¹ : Circle) : ℂ)) ∈ U₂ := by + apply hδ_sub + simpa [Real.dist_eq] using hτ_lt + have hmem_U : (w₁, Circle.exp ((τ : ℝ) * Complex.arg ((w₂ * w₁⁻¹ : Circle) : ℂ))) ∈ + U₁ ×ˢ U₂ := ⟨hw₁U₁, hexp_mem⟩ + exact hU_sub hmem_U + · obtain ⟨hw, hw_bd, hwY⟩ : ∃ w ∈ discBd Δ, w ∉ Y := not_subset.mp hbd_sub + obtain ⟨h₀, g₀, c₀⟩ := hΔ.exists_isChart + have hmemS : ∀ {h : S → ℂ} {g : ℂ → S}, IsChart Δ h g → ∀ {x}, x ∈ discBd Δ → ‖h x‖ = 1 := + fun c x hx => mem_sphere_zero_iff_norm.mp (c.bd ▸ mem_image_of_mem _ hx) + have hcis : ∀ {z : ℂ}, ‖z‖ = 1 → cis' (Complex.arg z) = z := fun {z} hz => by + have := Complex.norm_mul_exp_arg_mul_I z + rw [hz] at this + simpa [cis'] using this + have hvn : ‖h₀ hw‖ = 1 := hmemS c₀ hw_bd + let ρ : ℝ := Complex.arg (h₀ hw) + Real.pi + have c₁ : IsChart Δ (fun x => cis' (-ρ) * h₀ x) (fun z => g₀ (cis' ρ * z)) := c₀.rotate ρ + let h₁ : S → ℂ := fun x => cis' (-ρ) * h₀ x + let g₁ : ℂ → S := fun z => g₀ (cis' ρ * z) + have hw1 : h₁ hw = -1 := by + change cis' (-ρ) * h₀ hw = -1 + conv_lhs => rw [← hcis hvn] + rw [cis'_mul] + have : -ρ + Complex.arg (h₀ hw) = -Real.pi := by ring + rw [this, cis'] + simp [Complex.exp_neg] + have hg₁_neg1 : g₁ (-1 : ℂ) = hw := by + rw [← hw1] + exact c₁.gh (discBd_subset Δ hw_bd) + let A_Y : Set Circle := {w : Circle | g₁ (w : ℂ) ∈ Y ∩ discBd Δ} + have hneg1_notMem : (-1 : Circle) ∉ A_Y := by + intro hmem + change g₁ ((-1 : Circle) : ℂ) ∈ Y ∩ discBd Δ at hmem + simp only [Circle.coe_neg, Circle.coe_one, hg₁_neg1] at hmem + exact hwY hmem.1 + have hslit : ∀ w ∈ A_Y, (w : ℂ) ∈ Complex.slitPlane := by + intro w hwA + rw [Complex.mem_slitPlane_iff_arg] + refine ⟨fun he => hneg1_notMem ?_, Circle.coe_ne_zero w⟩ + have h1 : Circle.exp (Complex.arg (w : ℂ)) = w := Circle.exp_arg w + have hpi : Circle.exp Real.pi = -1 := + Circle.ext (by simp [Circle.coe_exp, Complex.exp_pi_mul_I]) + rw [he, hpi] at h1 + exact h1 ▸ hwA + have hA_Y_pre : IsPreconnected A_Y := by + have hpre : IsPreconnected (Y ∩ discBd Δ) := isPreconnected_of_isArcConnected hY_arc + have hh₁_cont : ContinuousOn h₁ (Y ∩ discBd Δ) := + c₁.hc.mono (inter_subset_right.trans (discBd_subset Δ)) + have hh₁_pre : IsPreconnected (h₁ '' (Y ∩ discBd Δ)) := hpre.image h₁ hh₁_cont + have hcoe_eq : Subtype.val '' A_Y = h₁ '' (Y ∩ discBd Δ) := by + ext z + constructor + · rintro ⟨w, hwA, rfl⟩ + exact ⟨g₁ (w : ℂ), hwA, c₁.hg (sphere_subset_closedBall w.2)⟩ + · rintro ⟨x, hxY, rfl⟩ + have hz_sph : h₁ x ∈ sphere (0 : ℂ) 1 := by + rw [← c₁.bd] + exact mem_image_of_mem h₁ hxY.2 + let w : Circle := ⟨h₁ x, hz_sph⟩ + refine ⟨w, ?_, rfl⟩ + change g₁ (h₁ x) ∈ Y ∩ discBd Δ + have hgh : g₁ (h₁ x) = x := c₁.gh (discBd_subset Δ hxY.2) + rw [hgh] + exact hxY + exact (IsInducing.subtypeVal.isPreconnected_image).mp (hcoe_eq ▸ hh₁_pre) + have harg_contOn : ContinuousOn (fun w : Circle => Complex.arg (w : ℂ)) A_Y := by + intro w hwA + exact ((Complex.continuousAt_arg (hslit w hwA)).comp + continuous_subtype_val.continuousAt).continuousWithinAt + have hJ_ord : OrdConnected ((fun w : Circle => Complex.arg (w : ℂ)) '' A_Y) := + (hA_Y_pre.image _ harg_contOn).ordConnected + let arcBetween : Circle → Circle → unitInterval → Circle := + fun w₁ w₂ τ => Circle.exp ((1 - (τ : ℝ)) * Complex.arg (w₁ : ℂ) + (τ : ℝ) * Complex.arg + (w₂ : ℂ)) + refine ⟨h₁, g₁, c₁, arcBetween, ?_, ?_, ?_, ?_⟩ + · intro w₁ w₂ + dsimp [arcBetween] + fun_prop + · intro w₁ w₂ + constructor + · change Circle.exp ((1 - (0 : ℝ)) * Complex.arg (w₁ : ℂ) + (0 : ℝ) * Complex.arg (w₂ : ℂ)) + = w₁ + simp [Circle.exp_arg] + · change Circle.exp ((1 - (1 : ℝ)) * Complex.arg (w₁ : ℂ) + (1 : ℝ) * Complex.arg (w₂ : ℂ)) + = w₂ + simp [Circle.exp_arg] + · intro w₁ w₂ hw₁ hw₂ τ + have hw₁A : w₁ ∈ A_Y := hw₁ + have hw₂A : w₂ ∈ A_Y := hw₂ + have hmem_seg : (1 - (τ : ℝ)) * Complex.arg (w₁ : ℂ) + (τ : ℝ) * Complex.arg (w₂ : ℂ) ∈ + uIcc (Complex.arg (w₁ : ℂ)) (Complex.arg (w₂ : ℂ)) := + segment_subset_uIcc (x := Complex.arg (w₁ : ℂ)) (y := Complex.arg (w₂ : ℂ)) + ⟨1 - (τ : ℝ), (τ : ℝ), sub_nonneg.mpr τ.2.2, τ.2.1, sub_add_cancel 1 (τ : ℝ), rfl⟩ + have hmem_J : (1 - (τ : ℝ)) * Complex.arg (w₁ : ℂ) + (τ : ℝ) * Complex.arg (w₂ : ℂ) ∈ + (fun w : Circle => Complex.arg (w : ℂ)) '' A_Y := + hJ_ord.uIcc_subset (mem_image_of_mem _ hw₁A) (mem_image_of_mem _ hw₂A) hmem_seg + obtain ⟨w, hwA, hw_eq⟩ := hmem_J + have hexp_eq : arcBetween w₁ w₂ τ = w := by + change Circle.exp ((1 - (τ : ℝ)) * Complex.arg (w₁ : ℂ) + (τ : ℝ) * Complex.arg (w₂ : ℂ)) + = w + rw [← hw_eq, Circle.exp_arg] + rw [hexp_eq] + exact hwA + · intro w₀ hw₀ V hV + have hexp_cont : ContinuousAt Circle.exp (Complex.arg (w₀ : ℂ)) := + Circle.exp.continuous.continuousAt + have hexp_w₀ : Circle.exp (Complex.arg (w₀ : ℂ)) = w₀ := Circle.exp_arg w₀ + obtain ⟨δ, hδ_pos, hδ_sub⟩ := + Metric.mem_nhds_iff.mp (hexp_cont (hexp_w₀.symm ▸ hV)) + have hw₀_slit : (w₀ : ℂ) ∈ Complex.slitPlane := hslit w₀ hw₀ + have harg_cont : ContinuousAt (fun w : Circle => Complex.arg (w : ℂ)) w₀ := + (Complex.continuousAt_arg hw₀_slit).comp continuous_subtype_val.continuousAt + have hball_nhds : Metric.ball (Complex.arg (w₀ : ℂ)) δ ∈ 𝓝 (Complex.arg (w₀ : ℂ)) := + Metric.ball_mem_nhds _ hδ_pos + refine ⟨(fun w : Circle => Complex.arg (w : ℂ)) ⁻¹' Metric.ball (Complex.arg (w₀ : ℂ)) δ, + harg_cont hball_nhds, fun w₁ hw₁ w₂ hw₂ τ => ?_⟩ + apply hδ_sub + have hconv : Convex ℝ (Metric.ball (Complex.arg (w₀ : ℂ)) δ) := + convex_ball (Complex.arg (w₀ : ℂ)) δ + exact hconv hw₁ hw₂ (sub_nonneg.mpr τ.2.2) τ.2.1 (sub_add_cancel 1 (τ : ℝ)) + +/-! ## 3. Component Endpoints of an Open Subset of `(0, 1)` -/ + +/-- The left endpoint of the connected component of `U ⊆ (0, 1)` containing `t`. -/ +private noncomputable def leftEnd (U : Set ℝ) (t : ℝ) : ℝ := + sSup (Iic t \ U) + +/-- The right endpoint of the connected component of `U ⊆ (0, 1)` containing `t`. -/ +private noncomputable def rightEnd (U : Set ℝ) (t : ℝ) : ℝ := + sInf (Ici t \ U) + +private lemma leftEnd_props {U : Set ℝ} (hU_open : IsOpen U) (hU_sub : U ⊆ Ioo 0 1) + {t : ℝ} (ht : t ∈ U) : + leftEnd U t ∈ Icc 0 1 ∧ leftEnd U t ∉ U ∧ leftEnd U t < t ∧ Ioo (leftEnd U t) t ⊆ U := by + have ht01 : t ∈ Ioo 0 1 := hU_sub ht + have h0_notMem : (0 : ℝ) ∉ U := fun h => (hU_sub h).1.ne rfl + have h0_mem : (0 : ℝ) ∈ Iic t \ U := ⟨ht01.1.le, h0_notMem⟩ + have hne : (Iic t \ U).Nonempty := ⟨0, h0_mem⟩ + have hbdd : BddAbove (Iic t \ U) := ⟨t, fun _ hx => hx.1⟩ + have hcl : IsClosed (Iic t \ U) := isClosed_Iic.sdiff hU_open + have hmem : leftEnd U t ∈ Iic t \ U := hcl.csSup_mem hne hbdd + have h0_le : 0 ≤ leftEnd U t := le_csSup hbdd h0_mem + have hle_t : leftEnd U t ≤ t := hmem.1 + have hnot_U : leftEnd U t ∉ U := hmem.2 + have hlt_t : leftEnd U t < t := lt_of_le_of_ne hle_t fun he => hnot_U (he.symm ▸ ht) + refine ⟨⟨h0_le, hle_t.trans ht01.2.le⟩, hnot_U, hlt_t, fun s hs => ?_⟩ + by_contra hsU + have hs_mem : s ∈ Iic t \ U := ⟨hs.2.le, hsU⟩ + exact not_le_of_gt hs.1 (le_csSup hbdd hs_mem) + +private lemma rightEnd_props {U : Set ℝ} (hU_open : IsOpen U) (hU_sub : U ⊆ Ioo 0 1) + {t : ℝ} (ht : t ∈ U) : + rightEnd U t ∈ Icc 0 1 ∧ rightEnd U t ∉ U ∧ t < rightEnd U t ∧ Ioo t (rightEnd U t) ⊆ U := by + have ht01 : t ∈ Ioo 0 1 := hU_sub ht + have h1_notMem : (1 : ℝ) ∉ U := fun h => (hU_sub h).2.ne rfl + have h1_mem : (1 : ℝ) ∈ Ici t \ U := ⟨ht01.2.le, h1_notMem⟩ + have hne : (Ici t \ U).Nonempty := ⟨1, h1_mem⟩ + have hbdd : BddBelow (Ici t \ U) := ⟨t, fun _ hx => hx.1⟩ + have hcl : IsClosed (Ici t \ U) := isClosed_Ici.sdiff hU_open + have hmem : rightEnd U t ∈ Ici t \ U := hcl.csInf_mem hne hbdd + have hle_1 : rightEnd U t ≤ 1 := csInf_le hbdd h1_mem + have ht_le : t ≤ rightEnd U t := hmem.1 + have hnot_U : rightEnd U t ∉ U := hmem.2 + have ht_lt : t < rightEnd U t := lt_of_le_of_ne ht_le fun he => hnot_U (he ▸ ht) + refine ⟨⟨ht01.1.le.trans ht_le, hle_1⟩, hnot_U, ht_lt, fun s hs => ?_⟩ + by_contra hsU + have hs_mem : s ∈ Ici t \ U := ⟨hs.1.le, hsU⟩ + exact not_le_of_gt hs.2 (csInf_le hbdd hs_mem) + +private lemma Ioo_leftEnd_rightEnd_subset {U : Set ℝ} (hU_open : IsOpen U) (hU_sub : U ⊆ Ioo 0 1) + {t : ℝ} (ht : t ∈ U) : + Ioo (leftEnd U t) (rightEnd U t) ⊆ U := by + obtain ⟨_, _, _, hleft⟩ := leftEnd_props hU_open hU_sub ht + obtain ⟨_, _, _, hright⟩ := rightEnd_props hU_open hU_sub ht + intro s hs + rcases lt_trichotomy s t with hlt | rfl | hgt + · exact hleft ⟨hs.1, hlt⟩ + · exact ht + · exact hright ⟨hgt, hs.2⟩ + +private lemma le_leftEnd_of_notMem {U : Set ℝ} + {t s₀ : ℝ} (hs₀_le : s₀ ≤ t) (hs₀_not : s₀ ∉ U) : + s₀ ≤ leftEnd U t := by + have hbdd : BddAbove (Iic t \ U) := ⟨t, fun _ hx => hx.1⟩ + exact le_csSup hbdd ⟨hs₀_le, hs₀_not⟩ + +private lemma rightEnd_le_of_notMem {U : Set ℝ} + {t s₁ : ℝ} (hs₁_ge : t ≤ s₁) (hs₁_not : s₁ ∉ U) : + rightEnd U t ≤ s₁ := by + have hbdd : BddBelow (Ici t \ U) := ⟨t, fun _ hx => hx.1⟩ + exact csInf_le hbdd ⟨hs₁_ge, hs₁_not⟩ + +private lemma leftEnd_eq_of_mem_Ioo {U : Set ℝ} (hU_open : IsOpen U) (hU_sub : U ⊆ Ioo 0 1) + {t s : ℝ} (ht : t ∈ U) (hs : s ∈ Ioo (leftEnd U t) (rightEnd U t)) : + leftEnd U s = leftEnd U t := by + have hsU : s ∈ U := Ioo_leftEnd_rightEnd_subset hU_open hU_sub ht hs + obtain ⟨_, hnot_t, _, _⟩ := leftEnd_props hU_open hU_sub ht + obtain ⟨_, hnot_s, _, _⟩ := leftEnd_props hU_open hU_sub hsU + refine le_antisymm ?_ (le_leftEnd_of_notMem hs.1.le hnot_t) + by_contra hgt + have hlt : leftEnd U t < leftEnd U s := not_le.mp hgt + obtain ⟨_, _, hls_lt, _⟩ := leftEnd_props hU_open hU_sub hsU + have hmem_Ioo : leftEnd U s ∈ Ioo (leftEnd U t) (rightEnd U t) := + ⟨hlt, hls_lt.trans hs.2⟩ + exact hnot_s (Ioo_leftEnd_rightEnd_subset hU_open hU_sub ht hmem_Ioo) + +private lemma rightEnd_eq_of_mem_Ioo {U : Set ℝ} (hU_open : IsOpen U) (hU_sub : U ⊆ Ioo 0 1) + {t s : ℝ} (ht : t ∈ U) (hs : s ∈ Ioo (leftEnd U t) (rightEnd U t)) : + rightEnd U s = rightEnd U t := by + have hsU : s ∈ U := Ioo_leftEnd_rightEnd_subset hU_open hU_sub ht hs + obtain ⟨_, hnot_t, _, _⟩ := rightEnd_props hU_open hU_sub ht + obtain ⟨_, hnot_s, _, _⟩ := rightEnd_props hU_open hU_sub hsU + refine le_antisymm (rightEnd_le_of_notMem hs.2.le hnot_t) ?_ + by_contra hlt + have hgt : rightEnd U s < rightEnd U t := not_le.mp hlt + obtain ⟨_, _, hrs_gt, _⟩ := rightEnd_props hU_open hU_sub hsU + have hmem_Ioo : rightEnd U s ∈ Ioo (leftEnd U t) (rightEnd U t) := + ⟨hs.1.trans hrs_gt, hgt⟩ + exact hnot_s (Ioo_leftEnd_rightEnd_subset hU_open hU_sub ht hmem_Ioo) + +private lemma leftEnd_mem_closure {U : Set ℝ} (hU_open : IsOpen U) (hU_sub : U ⊆ Ioo 0 1) + {t : ℝ} (ht : t ∈ U) : + leftEnd U t ∈ closure U := by + obtain ⟨_, _, hlt, hsub⟩ := leftEnd_props hU_open hU_sub ht + have hmem : leftEnd U t ∈ Icc (leftEnd U t) t := left_mem_Icc.mpr hlt.le + rw [← closure_Ioo hlt.ne] at hmem + exact closure_mono hsub hmem + +private lemma rightEnd_mem_closure {U : Set ℝ} (hU_open : IsOpen U) (hU_sub : U ⊆ Ioo 0 1) + {t : ℝ} (ht : t ∈ U) : + rightEnd U t ∈ closure U := by + obtain ⟨_, _, hlt, hsub⟩ := rightEnd_props hU_open hU_sub ht + have hmem : rightEnd U t ∈ Icc t (rightEnd U t) := right_mem_Icc.mpr hlt.le + rw [← closure_Ioo hlt.ne] at hmem + exact closure_mono hsub hmem + +/-! ## 4. Pushing a Curve on `ℝ` Out of an Open Set `U ⊆ (0, 1)` -/ + +private noncomputable def toCircleOfChart {Δ : Set S} {h : S → ℂ} {g : ℂ → S} + (c : IsChart Δ h g) (x : S) : Circle := by + classical + exact if hx : x ∈ discBd Δ then + (⟨h x, by + change h x ∈ sphere (0 : ℂ) 1 + rw [← c.bd] + exact mem_image_of_mem h hx⟩ : Circle) + else (1 : Circle) + +private lemma coe_toCircleOfChart {Δ : Set S} {h : S → ℂ} {g : ℂ → S} + (c : IsChart Δ h g) {x : S} (hx : x ∈ discBd Δ) : + ((toCircleOfChart c x : Circle) : ℂ) = h x := by + dsimp [toCircleOfChart] + simp [hx] + +private lemma g_toCircleOfChart {Δ : Set S} {h : S → ℂ} {g : ℂ → S} + (c : IsChart Δ h g) {x : S} (hx : x ∈ discBd Δ) : + g ((toCircleOfChart c x : Circle) : ℂ) = x := by + rw [coe_toCircleOfChart c hx] + exact c.gh (discBd_subset Δ hx) + +private lemma nearby_boundary_arcs + {Δ Y : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart Δ h g) + (arcBetween : Circle → Circle → unitInterval → Circle) + (harc_nhds : ∀ w₀ : Circle, g (w₀ : ℂ) ∈ Y ∩ discBd Δ → ∀ V ∈ 𝓝 w₀, + ∃ W ∈ 𝓝 w₀, ∀ w₁ ∈ W, ∀ w₂ ∈ W, ∀ τ : unitInterval, arcBetween w₁ w₂ τ ∈ V) + {P : ℝ → S} (hP_cont : Continuous P) {U : Set ℝ} + (hP_bd : ∀ t ∈ closure U \ U, P t ∈ Y ∩ discBd Δ) + {t₀ : ℝ} (ht₀_bd : P t₀ ∈ Y ∩ discBd Δ) {N : Set S} (hN : N ∈ 𝓝 (P t₀)) : + ∃ δ > 0, + (∀ s : ℝ, |s - t₀| < δ → P s ∈ N) ∧ + (∀ a b : ℝ, a ∈ closure U \ U → b ∈ closure U \ U → + |a - t₀| < δ → |b - t₀| < δ → ∀ τ : unitInterval, + g ((arcBetween (toCircleOfChart c (P a)) (toCircleOfChart c (P b)) τ : Circle) : ℂ) ∈ N) + := by + let w₀ : Circle := toCircleOfChart c (P t₀) + have hgw₀ : g (w₀ : ℂ) = P t₀ := g_toCircleOfChart c ht₀_bd.2 + have hg_circle_cont : Continuous (fun w : Circle => g (w : ℂ)) := + c.gc.comp_continuous continuous_subtype_val (fun w => sphere_subset_closedBall w.2) + have hV : (fun w : Circle => g (w : ℂ)) ⁻¹' N ∈ 𝓝 w₀ := + hg_circle_cont.continuousAt (hgw₀.symm ▸ hN) + obtain ⟨W, hW_nhds, hW_sub⟩ := + harc_nhds w₀ (hgw₀.symm ▸ ht₀_bd) _ hV + obtain ⟨ε, hε_pos, hε_sub⟩ := Metric.mem_nhds_iff.mp hW_nhds + have hcw₀ : (w₀ : ℂ) = h (P t₀) := coe_toCircleOfChart c ht₀_bd.2 + have hh_at : ContinuousWithinAt h Δ (P t₀) := + c.hc (P t₀) (discBd_subset Δ ht₀_bd.2) + have hball_nhds : Metric.ball (h (P t₀)) ε ∈ 𝓝 (h (P t₀)) := + Metric.ball_mem_nhds _ hε_pos + obtain ⟨M, hM_nhds, hM_sub⟩ := + mem_nhdsWithin_iff_exists_mem_nhds_inter.mp (hh_at hball_nhds) + have hP_pre : P ⁻¹' (N ∩ M) ∈ 𝓝 t₀ := + hP_cont.continuousAt (Filter.inter_mem hN hM_nhds) + obtain ⟨δ, hδ_pos, hδ_sub⟩ := Metric.mem_nhds_iff.mp hP_pre + refine ⟨δ, hδ_pos, fun s hs => (hδ_sub (by simpa [Real.dist_eq] using hs)).1, + fun a b ha hb ha_lt hb_lt τ => ?_⟩ + have ha_bd : P a ∈ Y ∩ discBd Δ := hP_bd a ha + have hb_bd : P b ∈ Y ∩ discBd Δ := hP_bd b hb + have ha_M : P a ∈ M := (hδ_sub (by simpa [Real.dist_eq] using ha_lt)).2 + have hb_M : P b ∈ M := (hδ_sub (by simpa [Real.dist_eq] using hb_lt)).2 + have ha_ball : h (P a) ∈ Metric.ball (h (P t₀)) ε := hM_sub ⟨ha_M, discBd_subset Δ ha_bd.2⟩ + have hb_ball : h (P b) ∈ Metric.ball (h (P t₀)) ε := hM_sub ⟨hb_M, discBd_subset Δ hb_bd.2⟩ + have ha_W : toCircleOfChart c (P a) ∈ W := by + apply hε_sub + rw [Metric.mem_ball] + change dist ((toCircleOfChart c (P a) : Circle) : ℂ) (w₀ : ℂ) < ε + rw [coe_toCircleOfChart c ha_bd.2, hcw₀] + exact Metric.mem_ball.mp ha_ball + have hb_W : toCircleOfChart c (P b) ∈ W := by + apply hε_sub + rw [Metric.mem_ball] + change dist ((toCircleOfChart c (P b) : Circle) : ℂ) (w₀ : ℂ) < ε + rw [coe_toCircleOfChart c hb_bd.2, hcw₀] + exact Metric.mem_ball.mp hb_ball + exact hW_sub _ ha_W _ hb_W τ + +private lemma exists_pushed_real_curve + {Δ Y : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart Δ h g) + (arcBetween : Circle → Circle → unitInterval → Circle) + (harc_cont : ∀ w₁ w₂ : Circle, Continuous (arcBetween w₁ w₂)) + (harc_ends : ∀ w₁ w₂ : Circle, arcBetween w₁ w₂ 0 = w₁ ∧ arcBetween w₁ w₂ 1 = w₂) + (harc_mem : ∀ w₁ w₂ : Circle, g (w₁ : ℂ) ∈ Y ∩ discBd Δ → g (w₂ : ℂ) ∈ Y ∩ discBd Δ → + ∀ τ : unitInterval, g ((arcBetween w₁ w₂ τ : Circle) : ℂ) ∈ Y ∩ discBd Δ) + (harc_nhds : ∀ w₀ : Circle, g (w₀ : ℂ) ∈ Y ∩ discBd Δ → ∀ V ∈ 𝓝 w₀, + ∃ W ∈ 𝓝 w₀, ∀ w₁ ∈ W, ∀ w₂ ∈ W, ∀ τ : unitInterval, arcBetween w₁ w₂ τ ∈ V) + {P : ℝ → S} (hP_cont : Continuous P) + {U : Set ℝ} (hU_open : IsOpen U) (hU_sub : U ⊆ Ioo 0 1) + (hP_bd : ∀ t ∈ closure U \ U, P t ∈ Y ∩ discBd Δ) : + ∃ Ψ : ℝ → S, Continuous Ψ ∧ + (∀ t ∉ U, Ψ t = P t) ∧ + (∀ t ∈ U, Ψ t ∈ Y ∩ discBd Δ) := by + classical + let segMap (a b t : ℝ) : S := + g ((arcBetween (toCircleOfChart c (P a)) (toCircleOfChart c (P b)) + (projIcc 0 1 zero_le_one ((t - a) / (b - a))) : Circle) : ℂ) + have hseg_cont : ∀ a b : ℝ, Continuous (segMap a b) := by + intro a b + have hτ_cont : Continuous (fun t : ℝ => projIcc 0 1 zero_le_one ((t - a) / (b - a))) := + continuous_projIcc.comp ((continuous_id.sub continuous_const).div_const _) + have harc_t : Continuous (fun t : ℝ => + ((arcBetween (toCircleOfChart c (P a)) (toCircleOfChart c (P b)) + (projIcc 0 1 zero_le_one ((t - a) / (b - a))) : Circle) : ℂ)) := + continuous_subtype_val.comp ((harc_cont _ _).comp hτ_cont) + exact c.gc.comp_continuous harc_t fun t => sphere_subset_closedBall (arcBetween _ _ _).2 + let Ψ : ℝ → S := fun t => if t ∈ U then segMap (leftEnd U t) (rightEnd U t) t else P t + have hΨ_notMem : ∀ t ∉ U, Ψ t = P t := fun t ht => by simp [Ψ, ht] + have hΨ_mem : ∀ t ∈ U, Ψ t ∈ Y ∩ discBd Δ := by + intro t ht + simp only [Ψ, ht, ↓reduceIte] + have ha_cl : leftEnd U t ∈ closure U \ U := + ⟨leftEnd_mem_closure hU_open hU_sub ht, (leftEnd_props hU_open hU_sub ht).2.1⟩ + have hb_cl : rightEnd U t ∈ closure U \ U := + ⟨rightEnd_mem_closure hU_open hU_sub ht, (rightEnd_props hU_open hU_sub ht).2.1⟩ + have ha_Y : P (leftEnd U t) ∈ Y ∩ discBd Δ := hP_bd _ ha_cl + have hb_Y : P (rightEnd U t) ∈ Y ∩ discBd Δ := hP_bd _ hb_cl + exact harc_mem _ _ ((g_toCircleOfChart c ha_Y.2).symm ▸ ha_Y) + ((g_toCircleOfChart c hb_Y.2).symm ▸ hb_Y) _ + refine ⟨Ψ, continuous_iff_continuousAt.mpr fun t₀ => ?_, hΨ_notMem, hΨ_mem⟩ + by_cases ht₀U : t₀ ∈ U + · obtain ⟨_, _, ha_lt, _⟩ := leftEnd_props hU_open hU_sub ht₀U + obtain ⟨_, _, hb_gt, _⟩ := rightEnd_props hU_open hU_sub ht₀U + have hIoo_nhds : Ioo (leftEnd U t₀) (rightEnd U t₀) ∈ 𝓝 t₀ := + Ioo_mem_nhds ha_lt hb_gt + have heq : Ψ =ᶠ[𝓝 t₀] segMap (leftEnd U t₀) (rightEnd U t₀) := by + filter_upwards [hIoo_nhds] with t ht + have htU : t ∈ U := Ioo_leftEnd_rightEnd_subset hU_open hU_sub ht₀U ht + simp only [Ψ, htU, ↓reduceIte, leftEnd_eq_of_mem_Ioo hU_open hU_sub ht₀U ht, + rightEnd_eq_of_mem_Ioo hU_open hU_sub ht₀U ht] + exact (hseg_cont _ _).continuousAt.congr heq.symm + · by_cases ht₀_cl : t₀ ∈ closure U + · have ht₀_bd : P t₀ ∈ Y ∩ discBd Δ := hP_bd t₀ ⟨ht₀_cl, ht₀U⟩ + let w₀ : Circle := toCircleOfChart c (P t₀) + have hgw₀ : g (w₀ : ℂ) = P t₀ := g_toCircleOfChart c ht₀_bd.2 + have hΨ_t₀ : Ψ t₀ = P t₀ := by simp [Ψ, ht₀U] + rw [continuousAt_iff_continuous_left_right] + constructor + · -- Left continuity at `t₀` + by_cases hleft_in : ∃ s₀ < t₀, Ioo s₀ t₀ ⊆ U + · obtain ⟨s₀, hs₀_lt, hs₀_sub⟩ := hleft_in + let t_mid : ℝ := (s₀ + t₀) / 2 + have ht_mid_mem : t_mid ∈ Ioo s₀ t₀ := by + change (s₀ + t₀) / 2 ∈ Ioo s₀ t₀ + exact ⟨by linarith, by linarith⟩ + have ht_mid_U : t_mid ∈ U := hs₀_sub ht_mid_mem + have hr_eq : rightEnd U t_mid = t₀ := by + obtain ⟨_, hr_not, htm_lt_r, _⟩ := rightEnd_props hU_open hU_sub ht_mid_U + refine le_antisymm (rightEnd_le_of_notMem ht_mid_mem.2.le ht₀U) ?_ + by_contra hlt + have hlt' : rightEnd U t_mid < t₀ := not_le.mp hlt + exact hr_not (hs₀_sub ⟨ht_mid_mem.1.trans htm_lt_r, hlt'⟩) + let a₀ : ℝ := leftEnd U t_mid + obtain ⟨_, _, ha₀_lt_tm, _⟩ := leftEnd_props hU_open hU_sub ht_mid_U + have ha₀_lt_t₀ : a₀ < t₀ := ha₀_lt_tm.trans ht_mid_mem.2 + have hIoc_nhds : Ioc a₀ t₀ ∈ 𝓝[≤] t₀ := Ioc_mem_nhdsLE ha₀_lt_t₀ + have heq : Ψ =ᶠ[𝓝[≤] t₀] segMap a₀ t₀ := by + filter_upwards [hIoc_nhds] with t ht + rcases eq_or_lt_of_le ht.2 with ht_eq | ht_lt + · rw [ht_eq] + dsimp [segMap] + have hdiv : (t₀ - a₀) / (t₀ - a₀) = 1 := div_self (sub_ne_zero.mpr ha₀_lt_t₀.ne') + have hproj : projIcc 0 1 zero_le_one ((t₀ - a₀) / (t₀ - a₀)) = 1 := by + ext + simp [hdiv] + rw [hΨ_t₀, hproj, (harc_ends _ _).2, hgw₀] + · have ht_Ioo : t ∈ Ioo (leftEnd U t_mid) (rightEnd U t_mid) := by + rw [hr_eq] + exact ⟨ht.1, ht_lt⟩ + have htU : t ∈ U := Ioo_leftEnd_rightEnd_subset hU_open hU_sub ht_mid_U ht_Ioo + simp only [Ψ, htU, ↓reduceIte, leftEnd_eq_of_mem_Ioo hU_open hU_sub ht_mid_U ht_Ioo, + rightEnd_eq_of_mem_Ioo hU_open hU_sub ht_mid_U ht_Ioo, hr_eq] + rfl + exact ((hseg_cont a₀ t₀).continuousAt.continuousWithinAt).congr_of_eventuallyEq + heq (by + dsimp [segMap] + have hdiv : (t₀ - a₀) / (t₀ - a₀) = 1 := div_self (sub_ne_zero.mpr ha₀_lt_t₀.ne') + have hproj : projIcc 0 1 zero_le_one ((t₀ - a₀) / (t₀ - a₀)) = 1 := by + ext; simp [hdiv] + rw [hΨ_t₀, hproj, (harc_ends _ _).2, hgw₀]) + · rw [ContinuousWithinAt, Filter.tendsto_def] + intro N hN + rw [hΨ_t₀] at hN + obtain ⟨δ, hδ_pos, hδ_P, hδ_seg⟩ := + nearby_boundary_arcs c arcBetween harc_nhds hP_cont hP_bd ht₀_bd hN + have hnot_sub : ¬ (Ioo (t₀ - δ) t₀ ⊆ U) := fun h => hleft_in ⟨t₀ - δ, by linarith, h⟩ + obtain ⟨s₀, hs₀_Ioo, hs₀_notU⟩ := not_subset.mp hnot_sub + have hs₀_nhds : Ioc s₀ t₀ ∈ 𝓝[≤] t₀ := Ioc_mem_nhdsLE hs₀_Ioo.2 + filter_upwards [hs₀_nhds] with t ht + change Ψ t ∈ N + by_cases htU : t ∈ U + · simp only [Ψ, htU, ↓reduceIte] + have ha_cl : leftEnd U t ∈ closure U \ U := + ⟨leftEnd_mem_closure hU_open hU_sub htU, (leftEnd_props hU_open hU_sub htU).2.1⟩ + have hb_cl : rightEnd U t ∈ closure U \ U := + ⟨rightEnd_mem_closure hU_open hU_sub htU, (rightEnd_props hU_open hU_sub htU).2.1⟩ + have hs₀_le_a : s₀ ≤ leftEnd U t := le_leftEnd_of_notMem ht.1.le hs₀_notU + have ha_lt_t : leftEnd U t < t := (leftEnd_props hU_open hU_sub htU).2.2.1 + have ht_lt_b : t < rightEnd U t := (rightEnd_props hU_open hU_sub htU).2.2.1 + have hb_le_t₀ : rightEnd U t ≤ t₀ := rightEnd_le_of_notMem ht.2 ht₀U + have ha_dist : |leftEnd U t - t₀| < δ := by + rw [abs_lt] + exact ⟨by linarith [hs₀_Ioo.1], by linarith⟩ + have hb_dist : |rightEnd U t - t₀| < δ := by + rw [abs_lt] + exact ⟨by linarith [hs₀_Ioo.1], by linarith⟩ + exact hδ_seg _ _ ha_cl hb_cl ha_dist hb_dist _ + · simp only [Ψ, htU, ↓reduceIte] + apply hδ_P + rw [abs_lt] + exact ⟨by linarith [hs₀_Ioo.1, ht.1], by linarith [ht.2]⟩ + · -- Right continuity at `t₀` + by_cases hright_in : ∃ s₁ > t₀, Ioo t₀ s₁ ⊆ U + · obtain ⟨s₁, hs₁_gt, hs₁_sub⟩ := hright_in + let t_mid : ℝ := (t₀ + s₁) / 2 + have ht_mid_mem : t_mid ∈ Ioo t₀ s₁ := by + change (t₀ + s₁) / 2 ∈ Ioo t₀ s₁ + exact ⟨by linarith, by linarith⟩ + have ht_mid_U : t_mid ∈ U := hs₁_sub ht_mid_mem + have hl_eq : leftEnd U t_mid = t₀ := by + obtain ⟨_, hl_not, hl_lt_tm, _⟩ := leftEnd_props hU_open hU_sub ht_mid_U + refine le_antisymm ?_ (le_leftEnd_of_notMem ht_mid_mem.1.le ht₀U) + by_contra hgt + have hgt' : t₀ < leftEnd U t_mid := not_le.mp hgt + exact hl_not (hs₁_sub ⟨hgt', hl_lt_tm.trans ht_mid_mem.2⟩) + let b₀ : ℝ := rightEnd U t_mid + obtain ⟨_, _, htm_lt_b₀, _⟩ := rightEnd_props hU_open hU_sub ht_mid_U + have ht₀_lt_b₀ : t₀ < b₀ := ht_mid_mem.1.trans htm_lt_b₀ + have hIco_nhds : Ico t₀ b₀ ∈ 𝓝[≥] t₀ := Ico_mem_nhdsGE ht₀_lt_b₀ + have heq : Ψ =ᶠ[𝓝[≥] t₀] segMap t₀ b₀ := by + filter_upwards [hIco_nhds] with t ht + rcases eq_or_lt_of_le ht.1 with rfl | ht_gt + · dsimp [segMap] + have hproj : projIcc 0 1 zero_le_one ((t₀ - t₀) / (b₀ - t₀)) = 0 := by + ext + simp + rw [hΨ_t₀, hproj, (harc_ends _ _).1, hgw₀] + · have ht_Ioo : t ∈ Ioo (leftEnd U t_mid) (rightEnd U t_mid) := by + rw [hl_eq] + exact ⟨ht_gt, ht.2⟩ + have htU : t ∈ U := Ioo_leftEnd_rightEnd_subset hU_open hU_sub ht_mid_U ht_Ioo + simp only [Ψ, htU, ↓reduceIte, leftEnd_eq_of_mem_Ioo hU_open hU_sub ht_mid_U ht_Ioo, + rightEnd_eq_of_mem_Ioo hU_open hU_sub ht_mid_U ht_Ioo, hl_eq] + rfl + exact ((hseg_cont t₀ b₀).continuousAt.continuousWithinAt).congr_of_eventuallyEq + heq (by + dsimp [segMap] + have hproj : projIcc 0 1 zero_le_one ((t₀ - t₀) / (b₀ - t₀)) = 0 := by + ext; simp + rw [hΨ_t₀, hproj, (harc_ends _ _).1, hgw₀]) + · rw [ContinuousWithinAt, Filter.tendsto_def] + intro N hN + rw [hΨ_t₀] at hN + obtain ⟨δ, hδ_pos, hδ_P, hδ_seg⟩ := + nearby_boundary_arcs c arcBetween harc_nhds hP_cont hP_bd ht₀_bd hN + have hnot_sub : ¬ (Ioo t₀ (t₀ + δ) ⊆ U) := fun h => hright_in ⟨t₀ + δ, by linarith, h⟩ + obtain ⟨s₁, hs₁_Ioo, hs₁_notU⟩ := not_subset.mp hnot_sub + have hs₁_nhds : Ico t₀ s₁ ∈ 𝓝[≥] t₀ := Ico_mem_nhdsGE hs₁_Ioo.1 + filter_upwards [hs₁_nhds] with t ht + change Ψ t ∈ N + by_cases htU : t ∈ U + · simp only [Ψ, htU, ↓reduceIte] + have ha_cl : leftEnd U t ∈ closure U \ U := + ⟨leftEnd_mem_closure hU_open hU_sub htU, (leftEnd_props hU_open hU_sub htU).2.1⟩ + have hb_cl : rightEnd U t ∈ closure U \ U := + ⟨rightEnd_mem_closure hU_open hU_sub htU, (rightEnd_props hU_open hU_sub htU).2.1⟩ + have ht₀_le_a : t₀ ≤ leftEnd U t := le_leftEnd_of_notMem ht.1 ht₀U + have ha_lt_t : leftEnd U t < t := (leftEnd_props hU_open hU_sub htU).2.2.1 + have ht_lt_b : t < rightEnd U t := (rightEnd_props hU_open hU_sub htU).2.2.1 + have hb_le_s₁ : rightEnd U t ≤ s₁ := rightEnd_le_of_notMem ht.2.le hs₁_notU + have ha_dist : |leftEnd U t - t₀| < δ := by + rw [abs_lt] + exact ⟨by linarith, by linarith [hs₁_Ioo.2]⟩ + have hb_dist : |rightEnd U t - t₀| < δ := by + rw [abs_lt] + exact ⟨by linarith, by linarith [hs₁_Ioo.2]⟩ + exact hδ_seg _ _ ha_cl hb_cl ha_dist hb_dist _ + · simp only [Ψ, htU, ↓reduceIte] + apply hδ_P + rw [abs_lt] + exact ⟨by linarith [ht.1], by linarith [hs₁_Ioo.2, ht.2]⟩ + · have hcompl_open : IsOpen (closure U)ᶜ := isClosed_closure.isOpen_compl + have hcompl_nhds : (closure U)ᶜ ∈ 𝓝 t₀ := hcompl_open.mem_nhds ht₀_cl + have heq : Ψ =ᶠ[𝓝 t₀] P := by + filter_upwards [hcompl_nhds] with t ht + have ht_notU : t ∉ U := fun htU => ht (subset_closure htU) + simp [Ψ, ht_notU] + exact hP_cont.continuousAt.congr heq.symm + +/-! ## 5. Proof of Graph Minors VII, (11.3) -/ + +private lemma homotopic_of_coincide_off_chart + {Δ : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart Δ h g) + (hΔ_closed : IsClosed Δ) {Z : Set Circle} (hZ_open : IsOpen Z) + (φ ψ : C(Circle, S)) (hφ_mem : ∀ z ∈ Z, φ z ∈ Δ) + (hψ_mem : ∀ z ∈ Z, ψ z ∈ Δ) (hψ_outside : ∀ z ∉ Z, ψ z = φ z) : + ClosedCurvesHomotopicIn univ φ ψ := by + have hφ_clZ : ∀ z ∈ closure Z, φ z ∈ Δ := by + have hcl_Δ : IsClosed (φ ⁻¹' Δ) := hΔ_closed.preimage φ.continuous + exact fun z hz => hcl_Δ.closure_subset_iff.mpr hφ_mem hz + have hψ_clZ : ∀ z ∈ closure Z, ψ z ∈ Δ := by + intro z hz + by_cases hzZ : z ∈ Z + · exact hψ_mem z hzZ + · rw [hψ_outside z hzZ] + exact hφ_clZ z hz + let Θ_fun : Circle × unitInterval → S := by + classical + exact fun p => + if p.1 ∈ closure Z then + g ((1 - (p.2 : ℝ)) • h (φ p.1) + (p.2 : ℝ) • h (ψ p.1)) + else φ p.1 + have hΘ_eq_outside : ∀ p : Circle × unitInterval, p.1 ∉ Z → Θ_fun p = φ p.1 := by + intro p hp + dsimp [Θ_fun] + split_ifs with hp_cl + · change g ((1 - (p.2 : ℝ)) • h (φ p.1) + (p.2 : ℝ) • h (ψ p.1)) = φ p.1 + have h1 : (1 - (p.2 : ℝ)) • h (φ p.1) + (p.2 : ℝ) • h (ψ p.1) = h (φ p.1) := by + rw [hψ_outside p.1 hp, ← add_smul, sub_add_cancel, one_smul] + rw [h1, c.gh (hφ_clZ p.1 hp_cl)] + · rfl + have hΘ_cont : Continuous Θ_fun := by + have hcl1 : IsClosed (closure Z ×ˢ (univ : Set unitInterval)) := + isClosed_closure.prod isClosed_univ + have hcl2 : IsClosed (Zᶜ ×ˢ (univ : Set unitInterval)) := + hZ_open.isClosed_compl.prod isClosed_univ + have hunion : (closure Z ×ˢ (univ : Set unitInterval)) ∪ + (Zᶜ ×ˢ (univ : Set unitInterval)) = univ := by + ext p + simp only [mem_union, mem_prod, mem_univ, and_true, mem_compl_iff, iff_true] + by_cases hp : p.1 ∈ Z + · exact Or.inl (subset_closure hp) + · exact Or.inr hp + have hcont1 : ContinuousOn Θ_fun (closure Z ×ˢ (univ : Set unitInterval)) := by + have hcont_g : ContinuousOn + (fun p : Circle × unitInterval => + g ((1 - (p.2 : ℝ)) • h (φ p.1) + (p.2 : ℝ) • h (ψ p.1))) + (closure Z ×ˢ (univ : Set unitInterval)) := by + have hhφ : ContinuousOn (fun p : Circle × unitInterval => h (φ p.1)) + (closure Z ×ˢ (univ : Set unitInterval)) := + c.hc.comp (φ.continuous.comp continuous_fst).continuousOn + (fun p hp => hφ_clZ p.1 hp.1) + have hhψ : ContinuousOn (fun p : Circle × unitInterval => h (ψ p.1)) + (closure Z ×ˢ (univ : Set unitInterval)) := + c.hc.comp (ψ.continuous.comp continuous_fst).continuousOn + (fun p hp => hψ_clZ p.1 hp.1) + have ht : ContinuousOn (fun p : Circle × unitInterval => (p.2 : ℝ)) + (closure Z ×ˢ (univ : Set unitInterval)) := + (continuous_subtype_val.comp continuous_snd).continuousOn + have hL : ContinuousOn + (fun p : Circle × unitInterval => + (1 - (p.2 : ℝ)) • h (φ p.1) + (p.2 : ℝ) • h (ψ p.1)) + (closure Z ×ˢ (univ : Set unitInterval)) := + ((continuousOn_const.sub ht).smul hhφ).add (ht.smul hhψ) + refine c.gc.comp hL fun p hp => ?_ + exact convex_closedBall (0 : ℂ) 1 + (c.hm (hφ_clZ p.1 hp.1)) (c.hm (hψ_clZ p.1 hp.1)) + (sub_nonneg.mpr p.2.2.2) p.2.2.1 (sub_add_cancel 1 (p.2 : ℝ)) + refine hcont_g.congr fun p hp => ?_ + have hp_cl : p.1 ∈ closure Z := hp.1 + simp [Θ_fun, hp_cl] + have hcont2 : ContinuousOn Θ_fun (Zᶜ ×ˢ (univ : Set unitInterval)) := by + refine (φ.continuous.comp continuous_fst).continuousOn.congr fun p hp => ?_ + exact hΘ_eq_outside p hp.1 + rw [← continuousOn_univ, ← hunion] + exact hcont1.union_of_isClosed hcont2 hcl1 hcl2 + refine ⟨⟨Θ_fun, hΘ_cont⟩, fun _ => mem_univ _, fun z => ?_, fun z => ?_⟩ + · dsimp [Θ_fun] + split_ifs with hz_cl + · change g ((1 - (0 : ℝ)) • h (φ z) + (0 : ℝ) • h (ψ z)) = φ z + simp [c.gh (hφ_clZ z hz_cl)] + · rfl + · by_cases hz : z ∈ Z + · have hz_cl : z ∈ closure Z := subset_closure hz + change Θ_fun (z, 1) = ψ z + simp only [Θ_fun, hz_cl, ↓reduceIte] + change g ((1 - (1 : ℝ)) • h (φ z) + (1 : ℝ) • h (ψ z)) = ψ z + simp [c.gh (hψ_clZ z hz_cl)] + · change Θ_fun (z, 1) = ψ z + rw [hΘ_eq_outside (z, 1) hz, hψ_outside z hz] + +/-- When `Z = {z : Circle | φ z ∈ Δ \ discBd Δ}` is a proper subset of `Circle` (`Z ≠ univ`), any +continuous map `φ : C(Circle, S)` with `range φ ⊆ Y ∪ (Δ \ discBd Δ)` is homotopic in `univ` to a +map `ψ : C(Circle, S)` with `range ψ ⊆ Y` and `range ψ ⊆ range φ ∪ discBd Δ`. -/ +private lemma disc_interior_curve_homotopy_of_exists_notMem + (hS : IsSurface S) {Δ Y : Set S} (hΔ : IsClosedDisc Δ) + (hY_arc : IsArcConnected (Y ∩ discBd Δ)) + (φ : C(Circle, S)) (hφ : range φ ⊆ Y ∪ (Δ \ discBd Δ)) + {z_base : Circle} (hz_base : φ z_base ∉ Δ \ discBd Δ) : + ∃ ψ : C(Circle, S), range ψ ⊆ Y ∧ range ψ ⊆ range φ ∪ discBd Δ ∧ + ClosedCurvesHomotopicIn univ φ ψ := by + have : T2Space S := hS.2.1 + obtain ⟨h, g, c, arcBetween, harc_cont, harc_ends, harc_mem, harc_nhds⟩ := + exists_chart_and_arcBetween hS hΔ hY_arc + have hΔ_compact : IsCompact Δ := by + rw [← c.g_closedBall] + exact (isCompact_closedBall 0 1).image_of_continuousOn c.gc + have hΔ_closed : IsClosed Δ := hΔ_compact.isClosed + have hint_eq : Δ \ discBd Δ = g '' ball 0 1 := by + have h1 := c.g_closedBall + have h2 := c.g_sphere + rw [← h2, ← h1, ← c.g_sdiff Subset.rfl sphere_subset_closedBall] + congr 1 + ext w + simp only [Set.mem_sdiff, mem_closedBall_zero_iff, mem_sphere_zero_iff_norm, mem_ball_zero_iff] + exact ⟨fun ⟨h1, h2⟩ => lt_of_le_of_ne h1 h2, fun h1 => ⟨h1.le, h1.ne⟩⟩ + have hint_open : IsOpen (Δ \ discBd Δ) := by + rw [hint_eq] + exact c.isOpen_image_ball hS.2.2 + let Z : Set Circle := {z : Circle | φ z ∈ Δ \ discBd Δ} + have hZ_open : IsOpen Z := hint_open.preimage φ.continuous + have hz_base_notZ : z_base ∉ Z := hz_base + let E : ℝ → Circle := fun t => z_base * Circle.exp (2 * Real.pi * t) + have hE_cont : Continuous E := by + dsimp [E] + fun_prop + have hE0 : E 0 = z_base := by simp [E] + have hE1 : E 1 = z_base := by simp [E, Circle.exp_two_pi] + let E_Icc : C(unitInterval, Circle) := ⟨fun t => E t.1, hE_cont.comp continuous_subtype_val⟩ + have hE_Icc_surj : Surjective E_Icc := by + intro z + have h2pi : 0 < 2 * Real.pi := Real.two_pi_pos + let w : Circle := z_base⁻¹ * z + let θ : ℝ := toIcoMod h2pi 0 (Complex.arg (w : ℂ)) + have hθ_mem : θ ∈ Ico 0 (2 * Real.pi) := by + simpa using toIcoMod_mem_Ico h2pi 0 (Complex.arg (w : ℂ)) + have hexp_θ : Circle.exp θ = w := by + have h1 : θ = Complex.arg (w : ℂ) - toIcoDiv h2pi 0 (Complex.arg (w : ℂ)) • (2 * Real.pi) + := rfl + have h2 : Circle.exp θ = Circle.exp (Complex.arg (w : ℂ)) := by + rw [h1, zsmul_eq_mul] + exact Circle.exp_eq_exp.mpr ⟨-toIcoDiv h2pi 0 (Complex.arg (w : ℂ)), by push_cast; ring⟩ + exact h2.trans (Circle.exp_arg w) + let t : ℝ := θ / (2 * Real.pi) + have ht_mem : t ∈ Icc (0 : ℝ) 1 := by + refine ⟨div_nonneg hθ_mem.1 h2pi.le, (div_le_one h2pi).mpr hθ_mem.2.le⟩ + refine ⟨⟨t, ht_mem⟩, ?_⟩ + change z_base * Circle.exp (2 * Real.pi * (θ / (2 * Real.pi))) = z + rw [mul_div_cancel₀ θ h2pi.ne', hexp_θ, mul_inv_cancel_left] + have hE_quot : Topology.IsQuotientMap E_Icc := + Topology.IsQuotientMap.of_surjective_continuous hE_Icc_surj E_Icc.continuous + let P : ℝ → S := φ ∘ E + have hP_cont : Continuous P := φ.continuous.comp hE_cont + let U : Set ℝ := Ioo 0 1 ∩ E ⁻¹' Z + have hU_open : IsOpen U := isOpen_Ioo.inter (hZ_open.preimage hE_cont) + have hU_sub : U ⊆ Ioo 0 1 := inter_subset_left + have hU_iff_on_Icc : ∀ t ∈ Icc (0 : ℝ) 1, t ∈ U ↔ E t ∈ Z := by + intro t ht + constructor + · exact fun h => h.2 + · intro hEZ + refine ⟨⟨lt_of_le_of_ne ht.1 ?_, lt_of_le_of_ne ht.2 ?_⟩, hEZ⟩ + · rintro rfl + exact hz_base_notZ (hE0 ▸ hEZ) + · rintro rfl + exact hz_base_notZ (hE1 ▸ hEZ) + have hP_bd : ∀ t ∈ closure U \ U, P t ∈ Y ∩ discBd Δ := by + intro t ⟨ht_cl, ht_notU⟩ + have ht_Icc : t ∈ Icc (0 : ℝ) 1 := by + rw [← closure_Ioo (zero_ne_one' ℝ)] + exact closure_mono hU_sub ht_cl + have hEt_notZ : E t ∉ Z := fun hEZ => ht_notU ((hU_iff_on_Icc t ht_Icc).mpr hEZ) + have hPt_Y : P t ∈ Y := (hφ (mem_range_self (E t))).resolve_right hEt_notZ + have hU_in_Δ : U ⊆ P ⁻¹' Δ := fun s hs => hs.2.1 + have hPt_Δ : P t ∈ Δ := by + have hcl_Δ : IsClosed (P ⁻¹' Δ) := hΔ_closed.preimage hP_cont + exact hcl_Δ.closure_subset_iff.mpr hU_in_Δ ht_cl + have hPt_bd : P t ∈ discBd Δ := by + by_contra hnot_bd + exact hEt_notZ ⟨hPt_Δ, hnot_bd⟩ + exact ⟨hPt_Y, hPt_bd⟩ + obtain ⟨Ψ, hΨ_cont, hΨ_notMem, hΨ_mem⟩ := + exists_pushed_real_curve c arcBetween harc_cont harc_ends harc_mem harc_nhds + hP_cont hU_open hU_sub hP_bd + let Ψ_Icc : C(unitInterval, S) := ⟨fun t => Ψ t.1, hΨ_cont.comp continuous_subtype_val⟩ + have hΨ_factors : Function.FactorsThrough Ψ_Icc E_Icc := by + intro s t hst + have hexp_eq : Circle.exp (2 * Real.pi * (s : ℝ)) = Circle.exp (2 * Real.pi * (t : ℝ)) := + mul_left_cancel (show z_base * Circle.exp (2 * Real.pi * (s : ℝ)) = + z_base * Circle.exp (2 * Real.pi * (t : ℝ)) from hst) + have hinj : InjOn (fun x : ℝ => Circle.exp (2 * Real.pi * x)) (Ico 0 1) := by + intro x hx y hy hxy + have hx' : 2 * Real.pi * x ∈ Ico 0 (2 * Real.pi) := + ⟨mul_nonneg Real.two_pi_pos.le hx.1, by nlinarith [hx.2, Real.pi_pos]⟩ + have hy' : 2 * Real.pi * y ∈ Ico 0 (2 * Real.pi) := + ⟨mul_nonneg Real.two_pi_pos.le hy.1, by nlinarith [hy.2, Real.pi_pos]⟩ + have hmul := Circle.exp_injOn_Ico (a := 0) (b := 2 * Real.pi) (by linarith) hx' hy' hxy + exact mul_left_cancel₀ Real.two_pi_pos.ne' hmul + have h0_notU : (0 : ℝ) ∉ U := fun h => (hU_sub h).1.ne rfl + have h1_notU : (1 : ℝ) ∉ U := fun h => (hU_sub h).2.ne rfl + have hΨ01 : Ψ 0 = Ψ 1 := by + rw [hΨ_notMem 0 h0_notU, hΨ_notMem 1 h1_notU] + change φ (E 0) = φ (E 1) + rw [hE0, hE1] + rcases eq_or_lt_of_le s.2.2 with hs1 | hs_lt + · rcases eq_or_lt_of_le t.2.2 with ht1 | ht_lt + · have : s = t := Subtype.ext (hs1.trans ht1.symm) + rw [this] + · have ht0 : (t : ℝ) = 0 := by + apply hinj ⟨t.2.1, ht_lt⟩ ⟨le_rfl, zero_lt_one⟩ + change Circle.exp (2 * Real.pi * (t : ℝ)) = Circle.exp (2 * Real.pi * 0) + rw [mul_zero, Circle.exp_zero, ← hexp_eq, hs1, mul_one, Circle.exp_two_pi] + change Ψ s.1 = Ψ t.1 + rw [hs1, ht0, hΨ01] + · rcases eq_or_lt_of_le t.2.2 with ht1 | ht_lt + · have hs0 : (s : ℝ) = 0 := by + apply hinj ⟨s.2.1, hs_lt⟩ ⟨le_rfl, zero_lt_one⟩ + change Circle.exp (2 * Real.pi * (s : ℝ)) = Circle.exp (2 * Real.pi * 0) + rw [mul_zero, Circle.exp_zero, hexp_eq, ht1, mul_one, Circle.exp_two_pi] + change Ψ s.1 = Ψ t.1 + rw [hs0, ht1, hΨ01] + · have hst_eq : (s : ℝ) = (t : ℝ) := hinj ⟨s.2.1, hs_lt⟩ ⟨t.2.1, ht_lt⟩ hexp_eq + change Ψ s.1 = Ψ t.1 + rw [hst_eq] + let ψ : C(Circle, S) := hE_quot.lift Ψ_Icc hΨ_factors + have hψ_comp : ∀ t : unitInterval, ψ (E_Icc t) = Ψ t.1 := by + intro t + exact ContinuousMap.congr_fun (hE_quot.lift_comp Ψ_Icc hΨ_factors) t + have hψ_outside : ∀ z : Circle, z ∉ Z → ψ z = φ z := by + intro z hz + obtain ⟨t, rfl⟩ := hE_Icc_surj z + rw [hψ_comp t] + have ht_notU : t.1 ∉ U := fun htU => hz ((hU_iff_on_Icc t.1 t.2).mp htU) + exact hΨ_notMem t.1 ht_notU + have hψ_inside : ∀ z : Circle, z ∈ Z → ψ z ∈ Y ∩ discBd Δ := by + intro z hz + obtain ⟨t, rfl⟩ := hE_Icc_surj z + rw [hψ_comp t] + have htU : t.1 ∈ U := (hU_iff_on_Icc t.1 t.2).mpr hz + exact hΨ_mem t.1 htU + refine ⟨ψ, ?_, ?_, ?_⟩ + · rintro _ ⟨z, rfl⟩ + by_cases hz : z ∈ Z + · exact (hψ_inside z hz).1 + · rw [hψ_outside z hz] + exact (hφ (mem_range_self z)).resolve_right hz + · rintro _ ⟨z, rfl⟩ + by_cases hz : z ∈ Z + · exact Or.inr (hψ_inside z hz).2 + · rw [hψ_outside z hz] + exact Or.inl (mem_range_self z) + · exact homotopic_of_coincide_off_chart c hΔ_closed hZ_open φ ψ + (fun z hz => hz.1) (fun z hz => discBd_subset Δ (hψ_inside z hz).2) hψ_outside + +/-- Graph Minors VII, (11.3), first statement (page 249): +"Let $\Sigma$ be a connected surface, let $\Delta \subseteq \Sigma$ be a closed disc, and let +$Y \subseteq \Sigma$ be such that $Y \cap bd(\Delta)$ is arc-connected. Then any continuous map +$\phi \colon S^1 \to Y \cup (\Delta - bd(\Delta))$ is homotopic to a map $\psi \colon S^1 \to Y$ +with $|\psi| \subseteq |\phi| \cup bd(\Delta)$." +Note: in the degenerate case `range φ ⊆ Δ \ discBd Δ` (`Z = S¹` on page 250, line 982), the +existence of `ψ : Circle → Y` with `range ψ ⊆ range φ ∪ discBd Δ` requires `Y ∩ (range φ ∪ discBd +Δ)` +(for instance `Y ∩ discBd Δ`) to be nonempty. -/ +theorem disc_interior_curve_homotopy + (hS : IsSurface S) {Δ Y : Set S} (hΔ : IsClosedDisc Δ) + (hY_arc : IsArcConnected (Y ∩ discBd Δ)) + (φ : C(Circle, S)) (hφ : range φ ⊆ Y ∪ (Δ \ discBd Δ)) + (hne : (∃ z : Circle, φ z ∉ Δ \ discBd Δ) ∨ (Y ∩ discBd Δ).Nonempty) : + ∃ ψ : C(Circle, S), range ψ ⊆ Y ∧ range ψ ⊆ range φ ∪ discBd Δ ∧ + ClosedCurvesHomotopicIn univ φ ψ := by + by_cases hex : ∃ z : Circle, φ z ∉ Δ \ discBd Δ + · obtain ⟨z_base, hz_base⟩ := hex + exact disc_interior_curve_homotopy_of_exists_notMem hS hΔ hY_arc φ hφ hz_base + · obtain ⟨y₀, hy₀Y, hy₀_bd⟩ := hne.resolve_left hex + push Not at hex + have hφ_Δ : range φ ⊆ Δ := by + rintro _ ⟨z, rfl⟩ + exact (hex z).1 + refine ⟨ContinuousMap.const Circle y₀, ?_, ?_, + closedCurvesHomotopicIn_const_of_range_subset_disc hΔ (discBd_subset Δ hy₀_bd) φ hφ_Δ⟩ + · rintro _ ⟨_, rfl⟩ + exact hy₀Y + · rintro _ ⟨_, rfl⟩ + exact Or.inr hy₀_bd + +/-- Graph Minors VII, (11.3), second statement (page 249): +"In particular, if $Y$ is flat then so is $Y \cup (\Delta - bd(\Delta))$." -/ +theorem isFlat_union_disc_diff_discBd + (hS : IsSurface S) {Δ Y : Set S} (hΔ : IsClosedDisc Δ) + (hY_arc : IsArcConnected (Y ∩ discBd Δ)) (hY_flat : IsFlat Y) : + IsFlat (Y ∪ (Δ \ discBd Δ)) := by + intro φ hφ + by_cases hex : ∃ z : Circle, φ z ∉ Δ \ discBd Δ + · obtain ⟨ψ, hψY, _, ⟨Θ₁, _, hΘ₁0, hΘ₁1⟩⟩ := + disc_interior_curve_homotopy hS hΔ hY_arc φ hφ (Or.inl hex) + obtain ⟨c₀, _, ⟨Θ₂, _, hΘ₂0, hΘ₂1⟩⟩ := hY_flat ψ hψY + let t₁ : Circle × unitInterval → Circle × unitInterval := + fun p => (p.1, projIcc 0 1 zero_le_one (2 * (p.2 : ℝ))) + let t₂ : Circle × unitInterval → Circle × unitInterval := + fun p => (p.1, projIcc 0 1 zero_le_one (2 * (p.2 : ℝ) - 1)) + have ht₁_cont : Continuous t₁ := + continuous_fst.prodMk (continuous_projIcc.comp (continuous_const.mul + (continuous_subtype_val.comp continuous_snd))) + have ht₂_cont : Continuous t₂ := + continuous_fst.prodMk (continuous_projIcc.comp + ((continuous_const.mul (continuous_subtype_val.comp continuous_snd)).sub continuous_const)) + let f₁ : Circle × unitInterval → S := Θ₁ ∘ t₁ + let f₂ : Circle × unitInterval → S := Θ₂ ∘ t₂ + have hf₁_cont : Continuous f₁ := Θ₁.continuous.comp ht₁_cont + have hf₂_cont : Continuous f₂ := Θ₂.continuous.comp ht₂_cont + let Ψ_fun : Circle × unitInterval → S := + fun p => if (p.2 : ℝ) ≤ 1 / 2 then f₁ p else f₂ p + have hΨ_cont : Continuous Ψ_fun := by + refine Continuous.if_le hf₁_cont hf₂_cont + (continuous_subtype_val.comp continuous_snd) continuous_const ?_ + intro p hp + have hp1 : projIcc 0 1 zero_le_one (2 * (p.2 : ℝ)) = 1 := by + rw [hp]; ext; simp + have hp0 : projIcc 0 1 zero_le_one (2 * (p.2 : ℝ) - 1) = 0 := by + rw [hp]; ext; simp + change Θ₁ (p.1, projIcc 0 1 zero_le_one (2 * (p.2 : ℝ))) = + Θ₂ (p.1, projIcc 0 1 zero_le_one (2 * (p.2 : ℝ) - 1)) + rw [hp1, hp0, hΘ₁1 p.1, hΘ₂0 p.1] + refine ⟨c₀, mem_univ c₀, ⟨Ψ_fun, hΨ_cont⟩, fun _ => mem_univ _, fun z => ?_, fun z => ?_⟩ + · have hle : ((0 : unitInterval) : ℝ) ≤ 1 / 2 := by norm_num + have hp0 : projIcc 0 1 zero_le_one (2 * ((0 : unitInterval) : ℝ)) = 0 := by + ext; change max (0 : ℝ) (min 1 (2 * 0)) = 0; norm_num + change (if ((0 : unitInterval) : ℝ) ≤ 1 / 2 then f₁ (z, 0) else f₂ (z, 0)) = φ z + simp only [hle, ↓reduceIte] + change Θ₁ (z, projIcc 0 1 zero_le_one (2 * ((0 : unitInterval) : ℝ))) = φ z + rw [hp0, hΘ₁0 z] + · have hnot : ¬ (((1 : unitInterval) : ℝ) ≤ 1 / 2) := by norm_num + have hp1 : projIcc 0 1 zero_le_one (2 * ((1 : unitInterval) : ℝ) - 1) = 1 := by + ext; change max (0 : ℝ) (min 1 (2 * 1 - 1)) = 1; norm_num + change (if ((1 : unitInterval) : ℝ) ≤ 1 / 2 then f₁ (z, 1) else f₂ (z, 1)) = c₀ + simp only [hnot, ↓reduceIte] + change Θ₂ (z, projIcc 0 1 zero_le_one (2 * ((1 : unitInterval) : ℝ) - 1)) = c₀ + rw [hp1, hΘ₂1 z] + rfl + · push Not at hex + have hφ_Δ : range φ ⊆ Δ := by + rintro _ ⟨z, rfl⟩ + exact (hex z).1 + have hy₀ : φ 1 ∈ Δ := (hex 1).1 + exact ⟨φ 1, mem_univ _, closedCurvesHomotopicIn_const_of_range_subset_disc hΔ hy₀ φ hφ_Δ⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section11f.lean b/LeanPool/GraphMinor/GM07/Section11f.lean new file mode 100644 index 0000000000..269fd07dff --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section11f.lean @@ -0,0 +1,1122 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.Surface.DiscGrow +public import LeanPool.GraphMinor.Surface.DiscMerge +import LeanPool.GraphMinor.GM07.Section11b +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.MoveCuff +import LeanPool.GraphMinor.Surface.OpenDisc + +/-! +# Graph Minors VII, (11.10) Boundary-Surface Case (`bd S ≠ ∅`): Interior Merging and Collar Charts + +This file develops the first half of the boundary-surface case of Graph Minors VII, (11.10) +(page 253, "If $\operatorname{bd}(\Sigma) \ne \emptyset$, similar slightly more complicated +arguments yield the result, and we omit the details"): +1. In a connected surface `S` with `bd S ≠ ∅`, `¬ IsSphere S`, and for any open arc-connected + `Y ⊆ S` in which every `O`-arc bounds a closed disc, `Y \ bd S` is open, nonempty, and + preconnected, every `O`-arc `F ⊆ Y \ bd S` bounds a closed disc `Δ ⊆ Y \ bd S`, and any compact + `K ⊆ Y \ bd S` is contained in `discInt D` for a closed disc `D ⊆ Y \ bd S` + (`exists_disc_compact_interior`). +2. If some cuff `C ∈ cuffs S` satisfies `C ⊆ Y`, then `C` bounds a closed disc `Δ = univ`, so + `IsPlanar Z` (`isPlanar_of_cuff_subset`). +3. Interval merging (`mergeOne`, `mergeList`) and the explicit homeomorphisms `stretchTo` and + `psiShift` (`Ψ(z) = ⟨z.re - capH52 z.im, z.im⟩`) for boundary collar charts when no cuff of `S` + is contained in `Y`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Function Topology Metric Filter OnePoint GraphMinor.Surface GraphMinor.GM11 + +local notation "𝕀" => unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Basic Boundary and Collar Facts -/ + +/-- A surface `S` with `bd S ≠ ∅` is not a 2-sphere. -/ +theorem not_isSphere_of_bd_ne_empty (hbd : bd S ≠ ∅) : ¬ IsSphere S := by + rintro ⟨e⟩ + refine hbd (eq_empty_iff_forall_notMem.mpr fun x hx => hx ?_) + obtain ⟨q, hq⟩ : ∃ q : OnePoint EuclideanPlane, q ≠ e x := by + by_cases hp : e x = ∞ + · exact ⟨sph 0, hp ▸ sph_ne_infty 0⟩ + · exact ⟨∞, Ne.symm hp⟩ + obtain ⟨H, hH⟩ := exists_homeomorph_onePoint q + rcases eq_infty_or_sph (H (e x)) with h | ⟨z, hz⟩ + · exact absurd (H.injective (h.trans hH.symm)) (Ne.symm hq) + · have hemb : IsOpenEmbedding (fun w : ℂ => e.symm (H.symm (sph w))) := + e.symm.isOpenEmbedding.comp (H.symm.isOpenEmbedding.comp isOpenEmbedding_sph) + have hxz : e.symm (H.symm (sph z)) = x := by + rw [← hz, H.symm_apply_apply, e.symm_apply_apply] + rw [← hxz] + exact isInteriorPoint_of_isOpenEmbedding hemb + ⟨ball z 1, isOpen_ball, mem_ball_self one_pos, exists_homeomorph_ball z one_pos⟩ + +/-- Every cuff `C ∈ cuffs S` is closed in `S`, and `bd S \ C` is closed in `S`. -/ +theorem isClosed_bd_diff_cuff (hS : IsSurface S) {C : Set S} (hC : IsCuff C) : + IsClosed (bd S \ C) := by + have hfin := (cuff_statement.{u} S hS).2.1 + have hcov : bd S \ C = ⋃ C' ∈ {C' ∈ cuffs S | C' ≠ C}, C' := by + ext x + simp only [Set.mem_sdiff, mem_iUnion, exists_prop, mem_ofPred_eq] + constructor + · rintro ⟨hx, hxC⟩ + refine ⟨connectedComponentIn (bd S) x, ⟨⟨x, hx, rfl⟩, fun h => hxC ?_⟩, + mem_connectedComponentIn hx⟩ + rw [← h] + exact mem_connectedComponentIn hx + · rintro ⟨C', ⟨⟨y, hy, rfl⟩, hne⟩, hxC'⟩ + refine ⟨connectedComponentIn_subset (bd S) y hxC', fun hxC => hne ?_⟩ + obtain ⟨z, hz, rfl⟩ := hC + have h1 := connectedComponentIn_eq hxC' + have h2 := connectedComponentIn_eq hxC + exact h1.trans h2.symm + rw [hcov] + have hfin' : {C' ∈ cuffs S | C' ≠ C}.Finite := hfin.subset fun _ hC' => hC'.1 + refine hfin'.isClosed_biUnion fun C' hC' => ?_ + have : T2Space S := hS.2.1 + exact ((cuff_statement.{u} S hS).2.2 C' hC'.1).isCompact.isClosed + +/-- For a cuff `C`, there is a collar `b : Circle × 𝕀 → S` inside `U` that misses all other cuffs, +so `b (w, t) ∈ bd S ↔ t = 0`. -/ +theorem exists_isolated_collar (hS : IsSurface S) {C U : Set S} (hC : IsCuff C) + (φ : Circle ≃ₜ C) (hU : IsOpen U) (hCU : C ⊆ U) : + ∃ b : Circle × 𝕀 → S, Continuous b ∧ Function.Injective b ∧ range b ⊆ U ∧ + (∀ w, b (w, 0) = (φ w).1) ∧ IsOpen (range b \ b '' {x | x.2 = 1}) ∧ + (∀ w t, b (w, t) ∈ bd S ↔ t = 0) := by + have : T2Space S := hS.2.1 + have hU' : IsOpen (U \ (bd S \ C)) := hU.sdiff (isClosed_bd_diff_cuff hS hC) + have hCU' : C ⊆ U \ (bd S \ C) := fun x hx => ⟨hCU hx, fun h => h.2 hx⟩ + obtain ⟨b, hbc, hbi, hbU', hb0, hopen⟩ := exists_collar hS hC φ hU' hCU' + have hCb : C ⊆ bd S := by + obtain ⟨x, hx, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + refine ⟨b, hbc, hbi, hbU'.trans sdiff_subset, hb0, hopen, fun w t => ?_⟩ + constructor + · intro hbd + have hmemU' : b (w, t) ∈ U \ (bd S \ C) := hbU' (mem_range_self _) + have hmemC : b (w, t) ∈ C := by + by_contra hnotC + exact hmemU'.2 ⟨hbd, hnotC⟩ + let w' : Circle := φ.symm ⟨b (w, t), hmemC⟩ + have heq : b (w, t) = b (w', 0) := by + rw [hb0 w'] + exact (congrArg Subtype.val (φ.apply_symm_apply ⟨b (w, t), hmemC⟩)).symm + exact (Prod.ext_iff.mp (hbi heq)).2 + · rintro rfl + rw [hb0] + exact hCb (φ w).2 + +/-- The open collar `b '' {x : Circle × 𝕀 | x.2 < 1}` is open in `S`, and `b` maps open subsets of +`{x : Circle × 𝕀 | x.2 < 1}` to open subsets of `S`. -/ +theorem isOpen_image_of_collar [T2Space S] {b : Circle × 𝕀 → S} + (hbc : Continuous b) (hbi : Function.Injective b) + (hopen : IsOpen (range b \ b '' {x | x.2 = 1})) + {V : Set (Circle × 𝕀)} (hV : IsOpen V) (hV1 : ∀ x ∈ V, x.2 < 1) : + IsOpen (b '' V) := by + have hemb : IsClosedEmbedding b := hbc.isClosedEmbedding hbi + have hsub : b '' V ⊆ range b \ b '' {x | x.2 = 1} := by + rintro _ ⟨x, hx, rfl⟩ + refine ⟨mem_range_self x, ?_⟩ + rintro ⟨y, hy, he⟩ + have hxy := hbi he + subst hxy + exact (hV1 y hx).ne hy + obtain ⟨U, hU, hUeq⟩ := hemb.isInducing.isOpen_iff.mp hV + have h1 : b '' V = (range b \ b '' {x | x.2 = 1}) ∩ U := by + ext y + constructor + · intro hy + obtain ⟨x, hx, rfl⟩ := hy + have hxU : x ∈ b ⁻¹' U := by rwa [hUeq] + exact ⟨hsub ⟨x, hx, rfl⟩, hxU⟩ + · rintro ⟨⟨⟨x, rfl⟩, _⟩, hxU⟩ + have hxV : x ∈ V := by rwa [← hUeq] + exact ⟨x, hxV, rfl⟩ + rw [h1] + exact hopen.inter hU + +/-! ## 2. Case 1: A Cuff Contained in `Y` -/ + +/-- If some cuff `C ∈ cuffs S` is contained in `Y`, then `Y = univ` is a closed disc and `IsPlanar +Z`. -/ +theorem isPlanar_of_cuff_subset (hS : IsSurface S) [ConnectedSpace S] {Z Y : Set S} + (_hZY : Z ⊆ Y) + (H : ∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) + {C : Set S} (hC : IsCuff C) (hCY : C ⊆ Y) : + IsPlanar Z := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hCO : IsOArc C := (cuff_statement.{u} S hS).2.2 C hC + obtain ⟨Δ, hΔY, hΔ, hΔb⟩ := H C hCY hCO + obtain ⟨φ⟩ := id hCO + obtain ⟨b, hbc, hbi, _, hb0, hopen, hbd_iff⟩ := + exists_isolated_collar hS hC φ isOpen_univ (subset_univ _) + let W : Set S := range b \ b '' {x | x.2 = 1} + have hWC_eq : W \ C = b '' (univ ×ˢ Ioo (0 : 𝕀) 1) := by + ext y + constructor + · rintro ⟨⟨⟨⟨w, t⟩, rfl⟩, hy1⟩, hyC⟩ + have ht1 : t ≠ 1 := fun h => hy1 ⟨(w, t), h, rfl⟩ + have ht0 : t ≠ 0 := by + intro h + apply hyC + rw [h, hb0] + exact (φ w).2 + refine ⟨(w, t), ⟨trivial, lt_of_le_of_ne t.2.1 ht0.symm, lt_of_le_of_ne t.2.2 ht1⟩, rfl⟩ + · rintro ⟨⟨w, t⟩, ⟨_, ht0, ht1⟩, rfl⟩ + refine ⟨⟨⟨(w, t), rfl⟩, ?_⟩, ?_⟩ + · rintro ⟨⟨w', t'⟩, ht'1, he⟩ + have h := (Prod.ext_iff.mp (hbi he)).2 + exact ht1.ne (h.symm.trans ht'1) + · intro hyC + have hCb : C ⊆ bd S := by + obtain ⟨x, hx, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + have ht0' := (hbd_iff w t).mp (hCb hyC) + exact ht0.ne' ht0' + have hWC_pre : IsPreconnected (W \ C) := by + rw [hWC_eq] + have h1 : IsPreconnected (univ : Set Circle) := isPreconnected_univ + have h2 : IsPreconnected (Ioo (0 : 𝕀) 1) := ordConnected_Ioo.isPreconnected + exact (h1.prod h2).image b hbc.continuousOn + have hWC_disj : Disjoint (W \ C) (discBd Δ) := by + rw [hΔb] + exact disjoint_sdiff_left + have hb10_W : b (1, 0) ∈ W := by + refine ⟨⟨(1, 0), rfl⟩, ?_⟩ + rintro ⟨⟨w, t⟩, ht1, he⟩ + have h := (Prod.ext_iff.mp (hbi he)).2 + exact zero_ne_one (h.symm.trans ht1) + have hb10_cl : b (1, 0) ∈ closure (discInt Δ) := by + refine hΔ.subset_closure_discInt (discBd_subset Δ ?_) + rw [hΔb, hb0] + exact (φ 1).2 + obtain ⟨z, hzW, hzInt⟩ := mem_closure_iff.mp hb10_cl W hopen hb10_W + have hz_notC : z ∉ C := by + rw [← hΔb] + exact hzInt.2 + have hWC_sub : W \ C ⊆ discInt Δ := by + rcases hΔ.side hS.2.2 hWC_pre hWC_disj with hsub | hdisj + · exact hsub + · exact False.elim (Set.disjoint_left.mp hdisj ⟨hzW, hz_notC⟩ hzInt.1) + have hW_sub : W ⊆ Δ := by + intro x hx + by_cases hxC : x ∈ C + · exact discBd_subset Δ (hΔb ▸ hxC) + · exact discInt_subset Δ (hWC_sub ⟨hx, hxC⟩) + have hΔ_eq : Δ = discInt Δ ∪ W := by + apply Subset.antisymm + · intro x hx + by_cases hxb : x ∈ discBd Δ + · right + rw [hΔb] at hxb + let w : Circle := φ.symm ⟨x, hxb⟩ + have hbw : b (w, 0) = x := by + rw [hb0] + exact congrArg Subtype.val (φ.apply_symm_apply ⟨x, hxb⟩) + rw [← hbw] + refine ⟨⟨(w, 0), rfl⟩, ?_⟩ + rintro ⟨⟨w', t'⟩, ht'1, he⟩ + have h := (Prod.ext_iff.mp (hbi he)).2 + exact zero_ne_one (h.symm.trans ht'1) + · exact Or.inl ⟨hx, hxb⟩ + · exact union_subset (discInt_subset Δ) hW_sub + have hΔ_open : IsOpen Δ := by + rw [hΔ_eq] + exact (hΔ.isOpen_discInt hS.2.2).union hopen + have hΔ_univ : Δ = univ := IsClopen.eq_univ ⟨hΔ.isClosed, hΔ_open⟩ ⟨b (1, 0), hW_sub hb10_W⟩ + exact ⟨Δ, hΔ, hΔ_univ.symm ▸ subset_univ Z⟩ + +/-! ## 3. Compact Subsets of `Y \ bd S` lie in Closed Discs in `Y \ bd S` -/ + +/-- Every `O`-arc `F ⊆ Y \ bd S` bounds a closed disc `Δ ⊆ Y \ bd S`. -/ +theorem disc_subset_diff_bd_of_oArc (hS : IsSurface S) {Y : Set S} + (H : ∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) + {F : Set S} (hF : F ⊆ Y \ bd S) (hFO : IsOArc F) : + ∃ Δ : Set S, Δ ⊆ Y \ bd S ∧ IsClosedDisc Δ ∧ discBd Δ = F := by + have : T2Space S := hS.2.1 + obtain ⟨Δ, hΔY, hΔ, hΔb⟩ := H F (hF.trans sdiff_subset) hFO + refine ⟨Δ, fun x hx => ⟨hΔY hx, ?_⟩, hΔ, hΔb⟩ + by_cases hxb : x ∈ discBd Δ + · rw [hΔb] at hxb + exact (hF hxb).2 + · exact fun hbd => hbd (isInteriorPoint_of_mem_discInt hS.2.2 hΔ ⟨hx, hxb⟩) + +/-- If `Y ⊆ S` is open and preconnected, then `Y \ bd S` is preconnected. -/ +theorem isPreconnected_diff_bd (hS : IsSurface S) {Y : Set S} (hYo : IsOpen Y) + (hYc : IsPreconnected Y) : IsPreconnected (Y \ bd S) := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + intro U V hU hV hcov hU_ne hV_ne + have hbd_cl : IsClosed (bd S) := (cuff_statement.{u} S hS).1 + have hY'o : IsOpen (Y \ bd S) := hYo.sdiff hbd_cl + let U₀ : Set S := (Y \ bd S) ∩ U + let V₀ : Set S := (Y \ bd S) ∩ V + have hU₀ : IsOpen U₀ := hY'o.inter hU + have hV₀ : IsOpen V₀ := hY'o.inter hV + by_contra hdisj_UV + have hdisj : Disjoint U₀ V₀ := by + rw [Set.disjoint_left] + intro x hxU hxV + exact hdisj_UV ⟨x, hxU.1, hxU.2, hxV.2⟩ + -- Every open neighborhood `W ⊆ Y` of `y ∈ Y` contains an open neighborhood `N ⊆ W` of `y` such + -- that `N \ bd S` is nonempty and preconnected, hence contained in `U₀` or `V₀`. + have hloc : ∀ y ∈ Y, ∀ W : Set S, IsOpen W → y ∈ W → W ⊆ Y → + ∃ N : Set S, IsOpen N ∧ y ∈ N ∧ N ⊆ W ∧ + (N \ bd S).Nonempty ∧ IsPreconnected (N \ bd S) := by + intro y _ W hWo hyW hWY + by_cases hyb : y ∈ bd S + · let C := connectedComponentIn (bd S) y + have hC : IsCuff C := ⟨y, hyb, rfl⟩ + have hCO : IsOArc C := (cuff_statement.{u} S hS).2.2 C hC + obtain ⟨φ⟩ := id hCO + obtain ⟨b, hbc, hbi, _, hb0, hopen, hbd_iff⟩ := + exists_isolated_collar hS hC φ isOpen_univ (subset_univ _) + have hyC : y ∈ C := mem_connectedComponentIn hyb + let w₀ : Circle := φ.symm ⟨y, hyC⟩ + have hbw₀ : b (w₀, 0) = y := by + rw [hb0] + exact congrArg Subtype.val (φ.apply_symm_apply ⟨y, hyC⟩) + obtain ⟨θ₀, _, hθ₀⟩ := exists_circle_angle 1 w₀ + rw [one_mul] at hθ₀ + have hpre_open : IsOpen (b ⁻¹' W) := hWo.preimage hbc + have hw₀_mem : (w₀, (0 : 𝕀)) ∈ b ⁻¹' W := by + change b (w₀, 0) ∈ W + rw [hbw₀] + exact hyW + obtain ⟨A, B, hAo, hBo, hw₀A, h0B, hAB_sub⟩ := + isOpen_prod_iff.mp hpre_open w₀ 0 hw₀_mem + have hθ₀_pre : θ₀ ∈ Circle.exp ⁻¹' A := by + change Circle.exp θ₀ ∈ A + rwa [← hθ₀] + obtain ⟨δ, hδ, hδ_sub⟩ := + Metric.isOpen_iff.mp (hAo.preimage Circle.exp.continuous) θ₀ hθ₀_pre + obtain ⟨ε₀, hε₀, hε₀_sub⟩ := Metric.isOpen_iff.mp hBo 0 h0B + let ε : 𝕀 := ⟨min (ε₀ / 2) (1 / 2), le_min (by positivity) (by norm_num), + (min_le_right _ _).trans (by norm_num)⟩ + have hε_pos : (0 : 𝕀) < ε := by + change (0 : ℝ) < min (ε₀ / 2) (1 / 2) + exact lt_min (by positivity) (by norm_num) + have hε_lt1 : ε < (1 : 𝕀) := by + change min (ε₀ / 2) (1 / 2) < 1 + exact (min_le_right _ _).trans_lt (by norm_num) + let Vw : Set Circle := Circle.exp '' Ioo (θ₀ - δ) (θ₀ + δ) + have hVw_open : IsOpen Vw := isLocalHomeomorph_circleExp.isOpenMap _ isOpen_Ioo + have hw₀_Vw : w₀ ∈ Vw := ⟨θ₀, ⟨by linarith, by linarith⟩, hθ₀.symm⟩ + have hVw_sub : Vw ⊆ A := by + rintro _ ⟨θ, hθ, rfl⟩ + refine hδ_sub ?_ + rw [Metric.mem_ball, Real.dist_eq, abs_lt] + exact ⟨by linarith [hθ.1], by linarith [hθ.2]⟩ + let Vt : Set 𝕀 := Iio ε + have hVt_open : IsOpen Vt := isOpen_Iio + have hVt_sub : Vt ⊆ B := by + intro t ht + refine hε₀_sub ?_ + rw [Metric.mem_ball, Subtype.dist_eq, Icc.coe_zero, Real.dist_eq, sub_zero, + abs_of_nonneg t.2.1] + have ht' : t.1 < min (ε₀ / 2) (1 / 2) := ht + linarith [min_le_left (ε₀ / 2) (1 / 2)] + let R : Set (Circle × 𝕀) := Vw ×ˢ Vt + have hR_open : IsOpen R := hVw_open.prod hVt_open + have hR_lt1 : ∀ x ∈ R, x.2 < 1 := fun x hx => hx.2.trans hε_lt1 + have hN_open : IsOpen (b '' R) := isOpen_image_of_collar hbc hbi hopen hR_open hR_lt1 + have hy_N : y ∈ b '' R := ⟨(w₀, 0), ⟨hw₀_Vw, hε_pos⟩, hbw₀⟩ + have hN_sub : b '' R ⊆ W := by + rintro _ ⟨x, hx, rfl⟩ + exact hAB_sub ⟨hVw_sub hx.1, hVt_sub hx.2⟩ + have hN_diff : (b '' R) \ bd S = b '' (Vw ×ˢ Ioo (0 : 𝕀) ε) := by + ext z + constructor + · rintro ⟨⟨⟨w, t⟩, ⟨hw, ht⟩, rfl⟩, hzb⟩ + have ht0 : t ≠ 0 := fun h => hzb ((hbd_iff w t).mpr h) + exact ⟨(w, t), ⟨hw, lt_of_le_of_ne t.2.1 ht0.symm, ht⟩, rfl⟩ + · rintro ⟨⟨w, t⟩, ⟨hw, ht0, htε⟩, rfl⟩ + exact ⟨⟨(w, t), ⟨hw, htε⟩, rfl⟩, fun hzb => ht0.ne' ((hbd_iff w t).mp hzb)⟩ + let t_mid : 𝕀 := ⟨ε.1 / 2, by positivity, by linarith [ε.2.2]⟩ + have ht_mid : t_mid ∈ Ioo (0 : 𝕀) ε := by + change (0 : ℝ) < ε.1 / 2 ∧ ε.1 / 2 < ε.1 + have hpos : (0 : ℝ) < ε.1 := hε_pos + exact ⟨by positivity, by linarith⟩ + refine ⟨b '' R, hN_open, hy_N, hN_sub, ?_, ?_⟩ + · rw [hN_diff] + exact ⟨b (w₀, t_mid), (w₀, t_mid), ⟨hw₀_Vw, ht_mid⟩, rfl⟩ + · rw [hN_diff] + have hVw_pre : IsPreconnected Vw := + isPreconnected_Ioo.image Circle.exp Circle.exp.continuous.continuousOn + have hIoo_pre : IsPreconnected (Ioo (0 : 𝕀) ε) := ordConnected_Ioo.isPreconnected + exact (hVw_pre.prod hIoo_pre).image b hbc.continuousOn + · have hy' : IsInteriorPoint y := by + by_contra hni + exact hyb hni + have hW'o : IsOpen (W \ bd S) := hWo.sdiff hbd_cl + obtain ⟨U_c, h_c, g_c, c, hUW, hg0⟩ := + hy'.exists_ballChart hW'o ⟨hyW, hyb⟩ (R := 3) (by norm_num) + have hb : ball (0 : ℂ) 1 ⊆ ball 0 3 := ball_subset_ball (by norm_num) + let N := g_c '' ball 0 1 + have hN_open : IsOpen N := c.isOpen_image isOpen_ball hb + have hy_N : y ∈ N := ⟨0, by simp, hg0⟩ + have hN_sub : N ⊆ W \ bd S := + (image_subset_iff.mpr fun z hz => c.gm (hb hz)).trans hUW + have hN_diff : N \ bd S = N := + sdiff_eq_left.mpr (Set.disjoint_left.mpr fun z hz => (hN_sub hz).2) + refine ⟨N, hN_open, hy_N, hN_sub.trans sdiff_subset, ?_, ?_⟩ + · rw [hN_diff] + exact ⟨y, hy_N⟩ + · rw [hN_diff] + exact (convex_ball (0 : ℂ) 1).isPreconnected.image g_c (c.gc.mono hb) + let U₁ : Set S := ⋃₀ {N : Set S | IsOpen N ∧ N ⊆ Y ∧ N \ bd S ⊆ U₀} + let V₁ : Set S := ⋃₀ {N : Set S | IsOpen N ∧ N ⊆ Y ∧ N \ bd S ⊆ V₀} + have hU₁ : IsOpen U₁ := isOpen_sUnion fun _ h => h.1 + have hV₁ : IsOpen V₁ := isOpen_sUnion fun _ h => h.1 + have hY_cov : Y ⊆ U₁ ∪ V₁ := by + intro y hy + obtain ⟨N, hNo, hyN, hNY, _, hN_pre⟩ := hloc y hy Y hYo hy Subset.rfl + have hz_cov : N \ bd S ⊆ U₀ ∪ V₀ := by + intro x hx + rcases hcov ⟨hNY hx.1, hx.2⟩ with hxU | hxV + · exact Or.inl ⟨⟨hNY hx.1, hx.2⟩, hxU⟩ + · exact Or.inr ⟨⟨hNY hx.1, hx.2⟩, hxV⟩ + rcases hN_pre.subset_or_subset hU₀ hV₀ hdisj hz_cov with hsubU | hsubV + · exact Or.inl (mem_sUnion.mpr ⟨N, ⟨hNo, hNY, hsubU⟩, hyN⟩) + · exact Or.inr (mem_sUnion.mpr ⟨N, ⟨hNo, hNY, hsubV⟩, hyN⟩) + obtain ⟨u₀, hu₀Y, hu₀U⟩ := hU_ne + obtain ⟨v₀, hv₀Y, hv₀V⟩ := hV_ne + have hu₀_U₁ : u₀ ∈ Y ∩ U₁ := by + refine ⟨hu₀Y.1, mem_sUnion.mpr ⟨U₀, ⟨hU₀, inter_subset_left.trans sdiff_subset, ?_⟩, + ⟨hu₀Y, hu₀U⟩⟩⟩ + exact sdiff_subset + have hv₀_V₁ : v₀ ∈ Y ∩ V₁ := by + refine ⟨hv₀Y.1, mem_sUnion.mpr ⟨V₀, ⟨hV₀, inter_subset_left.trans sdiff_subset, ?_⟩, + ⟨hv₀Y, hv₀V⟩⟩⟩ + exact sdiff_subset + obtain ⟨w, hwY, ⟨N₁, hN₁, hwN₁⟩, ⟨N₂, hN₂, hwN₂⟩⟩ := + hYc U₁ V₁ hU₁ hV₁ hY_cov ⟨u₀, hu₀_U₁⟩ ⟨v₀, hv₀_V₁⟩ + obtain ⟨N_w, _, _, hNw_sub, ⟨x₀, hx₀N, hx₀b⟩, _⟩ := + hloc w hwY (N₁ ∩ N₂) (hN₁.1.inter hN₂.1) ⟨hwN₁, hwN₂⟩ (inter_subset_left.trans hN₁.2.1) + have hx₀12 := hNw_sub hx₀N + exact Set.disjoint_left.mp hdisj (hN₁.2.2 ⟨hx₀12.1, hx₀b⟩) (hN₂.2.2 ⟨hx₀12.2, hx₀b⟩) + +/-- Auxiliary disc-chart merging lemma in an open interior subset `Y' ⊆ S \ bd S` when `¬ IsSphere +S`. -/ +theorem exists_disc_merge_interior_aux (hS : IsSurface S) [ConnectedSpace S] + (hns : ¬ IsSphere S) {Y' : Set S} + (H' : ∀ F : Set S, F ⊆ Y' → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y' ∧ IsClosedDisc Δ ∧ discBd Δ = F) + {D : Set S} (hDY : D ⊆ Y') (hD : IsClosedDisc D) + {U : Set S} {h : S → ℂ} {g : ℂ → S} (c : BallChart 3 U h g) (hUY : U ⊆ Y') + (hz : (discInt D ∩ g '' ball 0 1).Nonempty) {r ρ : ℝ} (hr2 : 2 < r) (hr3 : r < 3) (hρ : 0 < ρ) + (hfree : ∀ z ∈ ball (r : ℂ) ρ, g z ∉ discBd D) : + ∃ D' : Set S, D' ⊆ Y' ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ g '' closedBall 0 2 ⊆ D' := by + exact exists_disc_merge_in_chart_aux hS H' (fun h => hns h.1) + hDY hD c hUY hz hr2 hr3 hρ hfree + +/-- Merging a closed disc `D ⊆ Y'` with an overlapping `BallChart 3 U h g` in `Y'`. -/ +theorem exists_disc_merge_interior (hS : IsSurface S) [ConnectedSpace S] + (hns : ¬ IsSphere S) {Y' : Set S} + (H' : ∀ F : Set S, F ⊆ Y' → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y' ∧ IsClosedDisc Δ ∧ discBd Δ = F) + {D : Set S} (hDY : D ⊆ Y') (hD : IsClosedDisc D) + {U : Set S} {h : S → ℂ} {g : ℂ → S} (c : BallChart 3 U h g) (hUY : U ⊆ Y') + (hz : (discInt D ∩ g '' ball 0 1).Nonempty) : + ∃ D' : Set S, D' ⊆ Y' ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ g '' closedBall 0 2 ⊆ D' := by + exact exists_disc_merge_in_chart hS H' (fun h => hns h.1) hDY hD c hUY hz + +/-- If a closed disc in `Y'` overlaps the unit ball of a chart in `Y'`, a larger closed disc in `Y'` +contains that unit ball in its inside. -/ +theorem exists_disc_of_overlap_interior (hS : IsSurface S) [ConnectedSpace S] + (hns : ¬ IsSphere S) {Y' : Set S} (hint : ∀ x ∈ Y', IsInteriorPoint x) + (H' : ∀ F : Set S, F ⊆ Y' → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y' ∧ IsClosedDisc Δ ∧ discBd Δ = F) + {D : Set S} (hDY : D ⊆ Y') (hD : IsClosedDisc D) + {U : Set S} {h : S → ℂ} {g : ℂ → S} (c : BallChart 3 U h g) (hUY : U ⊆ Y') + (hz : (discInt D ∩ g '' ball 0 1).Nonempty) : + ∃ D' : Set S, D' ⊆ Y' ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ g '' ball 0 1 ⊆ discInt D' := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + obtain ⟨D', h1, h2, h3, h4⟩ := exists_disc_merge_interior hS hns H' hDY hD c hUY hz + have hb : ball (0 : ℂ) 1 ⊆ ball 0 3 := ball_subset_ball (by norm_num) + have hsub2 : g '' ball 0 1 ⊆ D' := + (image_mono (ball_subset_closedBall.trans (closedBall_subset_closedBall + (by norm_num)))).trans h4 + refine ⟨D', h1, h2, h3, + subset_discInt_of_isOpen (fun x hx => hint x (h1 (hsub2 hx))) + (c.isOpen_image isOpen_ball hb) hsub2⟩ + +/-- Every point of `Y'` lies in the inside of a closed disc of `Y'` that contains a given closed +disc of `Y'`. -/ +theorem exists_disc_mem_interior (hS : IsSurface S) [ConnectedSpace S] + (hns : ¬ IsSphere S) {Y' : Set S} (hint : ∀ x ∈ Y', IsInteriorPoint x) + (hYo : IsOpen Y') (hYc : IsPreconnected Y') + (H' : ∀ F : Set S, F ⊆ Y' → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y' ∧ IsClosedDisc Δ ∧ discBd Δ = F) + {D : Set S} (hDY : D ⊆ Y') (hD : IsClosedDisc D) {y : S} (hy : y ∈ Y') : + ∃ D' : Set S, D' ⊆ Y' ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ y ∈ discInt D' := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hman : ∀ x : S, IsManifoldPoint x := hS.2.2 + let A : Set S := {y | ∃ D' : Set S, D' ⊆ Y' ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ y ∈ discInt D'} + have hAo : IsOpen A := by + refine isOpen_iff_mem_nhds.mpr ?_ + rintro x ⟨D', h1, h2, h3, h4⟩ + filter_upwards [(h2.isOpen_discInt hman).mem_nhds h4] with z hz + exact ⟨D', h1, h2, h3, hz⟩ + have hBo : IsOpen (Y' \ A) := by + refine isOpen_iff_mem_nhds.mpr ?_ + rintro x ⟨hxY, hxA⟩ + obtain ⟨U, h, g, c, hUY, hg0⟩ := (hint x hxY).exists_ballChart hYo hxY (R := 3) (by norm_num) + have hb : ball (0 : ℂ) 1 ⊆ ball 0 3 := ball_subset_ball (by norm_num) + have hV := c.isOpen_image isOpen_ball hb + have hx : x ∈ g '' ball 0 1 := ⟨0, by simp, hg0⟩ + filter_upwards [hV.mem_nhds hx] with z hz + obtain ⟨w, hw, rfl⟩ := id hz + refine ⟨hUY (c.gm (hb hw)), ?_⟩ + rintro ⟨D', h1, h2, h3, h4⟩ + obtain ⟨E, h5, h6, h7, h8⟩ := + exists_disc_of_overlap_interior hS hns hint H' h1 h2 c hUY ⟨_, h4, hz⟩ + exact hxA ⟨E, h5, h6, h3.trans h7, h8 hx⟩ + by_contra hcon + obtain ⟨z, hz⟩ := hD.nonempty_discInt + obtain ⟨w, -, hw1, hw2⟩ := hYc A (Y' \ A) hAo hBo + (fun x hx => by + by_cases hxA : x ∈ A + · exact .inl hxA + · exact .inr ⟨hx, hxA⟩) + ⟨z, hDY (discInt_subset D hz), D, hDY, hD, Subset.rfl, hz⟩ ⟨y, hy, hy, hcon⟩ + exact hw2.2 hw1 + +/-- Around every point of `Y'` there is a neighbourhood that the inside of a closed disc swallows, +starting from any closed disc of `Y'`. -/ +theorem exists_disc_nhds_interior (hS : IsSurface S) [ConnectedSpace S] + (hns : ¬ IsSphere S) {Y' : Set S} (hint : ∀ x ∈ Y', IsInteriorPoint x) + (hYo : IsOpen Y') (hYc : IsPreconnected Y') + (H' : ∀ F : Set S, F ⊆ Y' → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y' ∧ IsClosedDisc Δ ∧ discBd Δ = F) + {y : S} (hy : y ∈ Y') : ∃ V ∈ 𝓝 y, ∀ D : Set S, D ⊆ Y' → IsClosedDisc D → + ∃ D' : Set S, D' ⊆ Y' ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ V ⊆ discInt D' := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + obtain ⟨U, h, g, c, hUY, hg0⟩ := (hint y hy).exists_ballChart hYo hy (R := 3) (by norm_num) + have hb : ball (0 : ℂ) 1 ⊆ ball 0 3 := ball_subset_ball (by norm_num) + have hy' : y ∈ g '' ball 0 1 := ⟨0, by simp, hg0⟩ + refine ⟨g '' ball 0 1, (c.isOpen_image isOpen_ball hb).mem_nhds hy', fun D hDY hD => ?_⟩ + obtain ⟨D₁, h1, h2, h3, h4⟩ := exists_disc_mem_interior hS hns hint hYo hYc H' hDY hD hy + obtain ⟨D₂, h5, h6, h7, h8⟩ := + exists_disc_of_overlap_interior hS hns hint H' h1 h2 c hUY ⟨y, h4, hy'⟩ + exact ⟨D₂, h5, h6, h3.trans h7, h8⟩ + +/-- The inside of a closed disc of `Y'` swallows any compact subset of `Y'` and any given closed +disc of `Y'`. -/ +theorem exists_disc_compact_interior (hS : IsSurface S) [ConnectedSpace S] + (hns : ¬ IsSphere S) {Y' : Set S} (hint : ∀ x ∈ Y', IsInteriorPoint x) + (hYo : IsOpen Y') (hYc : IsPreconnected Y') + (H' : ∀ F : Set S, F ⊆ Y' → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y' ∧ IsClosedDisc Δ ∧ discBd Δ = F) + {K : Set S} (hK : IsCompact K) (hKY : K ⊆ Y') {D : Set S} (hDY : D ⊆ Y') + (hD : IsClosedDisc D) : + ∃ D' : Set S, D' ⊆ Y' ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ K ⊆ discInt D' := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hman : ∀ x : S, IsManifoldPoint x := hS.2.2 + refine hK.induction_on (p := fun K => ∀ D : Set S, D ⊆ Y' → IsClosedDisc D → + ∃ D' : Set S, D' ⊆ Y' ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ K ⊆ discInt D') ?_ ?_ ?_ ?_ D hDY hD + · exact fun D hDY hD => ⟨D, hDY, hD, Subset.rfl, empty_subset _⟩ + · intro s t hst hp D hDY hD + obtain ⟨D', h1, h2, h3, h4⟩ := hp D hDY hD + exact ⟨D', h1, h2, h3, hst.trans h4⟩ + · intro s t hs ht D hDY hD + obtain ⟨D₁, h1, h2, h3, h4⟩ := hs D hDY hD + obtain ⟨D₂, h5, h6, h7, h8⟩ := ht D₁ h1 h2 + exact ⟨D₂, h5, h6, h3.trans h7, + union_subset (h4.trans (discInt_mono hman h2 h7)) h8⟩ + · intro x hx + obtain ⟨V, hV, hp⟩ := exists_disc_nhds_interior hS hns hint hYo hYc H' (hKY hx) + exact ⟨V, mem_nhdsWithin_of_mem_nhds hV, hp⟩ + +/-- Every nonempty open `Y ⊆ S` has a closed disc `D₀ ⊆ Y \ bd S`. -/ +theorem exists_initial_disc_interior (hS : IsSurface S) {Y : Set S} (hYo : IsOpen Y) + (hYne : Y.Nonempty) : + ∃ D₀ : Set S, D₀ ⊆ Y \ bd S ∧ IsClosedDisc D₀ := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hbd_cl : IsClosed (bd S) := (cuff_statement.{u} S hS).1 + have hY'o : IsOpen (Y \ bd S) := hYo.sdiff hbd_cl + -- First find a point `x₀ ∈ Y \ bd S`. + have hY'_ne : (Y \ bd S).Nonempty := by + obtain ⟨y, hy⟩ := hYne + by_cases hyb : y ∈ bd S + · let C := connectedComponentIn (bd S) y + have hC : IsCuff C := ⟨y, hyb, rfl⟩ + have hCO : IsOArc C := (cuff_statement.{u} S hS).2.2 C hC + obtain ⟨φ⟩ := id hCO + obtain ⟨b, hbc, _, _, hb0, _, hbd_iff⟩ := + exists_isolated_collar hS hC φ isOpen_univ (subset_univ _) + have hyC : y ∈ C := mem_connectedComponentIn hyb + let w₀ : Circle := φ.symm ⟨y, hyC⟩ + have hbw₀ : b (w₀, 0) = y := by + rw [hb0] + exact congrArg Subtype.val (φ.apply_symm_apply ⟨y, hyC⟩) + have hw₀_mem : (w₀, (0 : 𝕀)) ∈ b ⁻¹' Y := by + change b (w₀, 0) ∈ Y + rw [hbw₀] + exact hy + obtain ⟨A, B, _, hBo, hw₀A, h0B, hAB_sub⟩ := + isOpen_prod_iff.mp (hYo.preimage hbc) w₀ 0 hw₀_mem + obtain ⟨ε₀, hε₀, hε₀_sub⟩ := Metric.isOpen_iff.mp hBo 0 h0B + let t₀ : 𝕀 := ⟨min (ε₀ / 2) (1 / 2), le_min (by positivity) (by norm_num), + (min_le_right _ _).trans (by norm_num)⟩ + have ht₀_pos : (0 : ℝ) < t₀.1 := lt_min (by positivity) (by norm_num) + have ht₀_B : t₀ ∈ B := by + refine hε₀_sub ?_ + rw [Metric.mem_ball, Subtype.dist_eq, Icc.coe_zero, Real.dist_eq, sub_zero, + abs_of_nonneg t₀.2.1] + linarith [min_le_left (ε₀ / 2) (1 / 2)] + refine ⟨b (w₀, t₀), hAB_sub ⟨hw₀A, ht₀_B⟩, fun hzb => ?_⟩ + have ht0 := (hbd_iff w₀ t₀).mp hzb + exact ht₀_pos.ne' (congrArg Subtype.val ht0) + · exact ⟨y, hy, hyb⟩ + obtain ⟨x₀, hx₀Y, hx₀b⟩ := hY'_ne + have hx₀' : IsInteriorPoint x₀ := by + by_contra hni + exact hx₀b hni + obtain ⟨U, h, g, c, hUY, _⟩ := hx₀'.exists_ballChart hY'o ⟨hx₀Y, hx₀b⟩ (R := 3) (by norm_num) + have hb13 : closedBall (0 : ℂ) 1 ⊆ ball 0 3 := closedBall_subset_ball (by norm_num) + refine ⟨g '' closedBall 0 1, ?_, ?_⟩ + · exact (image_subset_iff.mpr fun z hz => c.gm (hb13 hz)).trans hUY + · exact (c.image_disc isClosedDisc_closedBall.1 hb13).1 + +/-! ## 4. Interval Merging and Explicit Boundary Chart Homeomorphisms -/ + +/-- Insert an interval `(a, b)` into a list of pairwise disjoint intervals, merging any that +overlap `[a, b]`. -/ +noncomputable def mergeOne (a b : ℝ) : List (ℝ × ℝ) → (ℝ × ℝ) × List (ℝ × ℝ) + | [] => ((a, b), []) + | p :: rest => + let q := mergeOne a b rest + if q.1.2 < p.1 ∨ p.2 < q.1.1 then (q.1, p :: q.2) + else ((min q.1.1 p.1, max q.1.2 p.2), q.2) + +/-- Merge a list of intervals into a list of pairwise disjoint closed intervals. -/ +noncomputable def mergeList : List (ℝ × ℝ) → List (ℝ × ℝ) + | [] => [] + | p :: rest => + let q := mergeOne p.1 p.2 (mergeList rest) + q.1 :: q.2 + +/-- The union of the open intervals `(p.1, p.2)` in a list `L`. -/ +def unionIoo : List (ℝ × ℝ) → Set ℝ + | [] => ∅ + | p :: rest => Ioo p.1 p.2 ∪ unionIoo rest + +/-- The union of the closed intervals `[p.1, p.2]` in a list `L`. -/ +def unionIcc : List (ℝ × ℝ) → Set ℝ + | [] => ∅ + | p :: rest => Icc p.1 p.2 ∪ unionIcc rest + +theorem mem_unionIoo {x : ℝ} {L : List (ℝ × ℝ)} : + x ∈ unionIoo L ↔ ∃ p ∈ L, x ∈ Ioo p.1 p.2 := by + induction L with + | nil => simp [unionIoo] + | cons p rest ih => simp [unionIoo, ih] + +theorem mem_unionIcc {x : ℝ} {L : List (ℝ × ℝ)} : + x ∈ unionIcc L ↔ ∃ p ∈ L, x ∈ Icc p.1 p.2 := by + induction L with + | nil => simp [unionIcc] + | cons p rest ih => simp [unionIcc, ih] + +theorem mergeOne_properties (a b : ℝ) (L : List (ℝ × ℝ)) + (hab : a < b) (hL : ∀ p ∈ L, p.1 < p.2) + (hpw : L.Pairwise (fun p q => p.2 < q.1 ∨ q.2 < p.1)) : + let q := mergeOne a b L + q.1.1 ≤ a ∧ b ≤ q.1.2 ∧ q.1.1 < q.1.2 ∧ + (∀ p ∈ q.2, p ∈ L ∧ p.1 < p.2 ∧ (q.1.2 < p.1 ∨ p.2 < q.1.1)) ∧ + q.2.Pairwise (fun p1 p2 => p1.2 < p2.1 ∨ p2.2 < p1.1) ∧ + (Ioo a b ∪ unionIoo L ⊆ Ioo q.1.1 q.1.2 ∪ unionIoo q.2) ∧ + (Icc q.1.1 q.1.2 ∪ unionIcc q.2 ⊆ Icc a b ∪ unionIcc L) ∧ + (∀ c d : ℝ, c ≤ a → b ≤ d → (∀ p ∈ L, c ≤ p.1 ∧ p.2 ≤ d) → + c ≤ q.1.1 ∧ q.1.2 ≤ d ∧ ∀ p ∈ q.2, c ≤ p.1 ∧ p.2 ≤ d) := by + induction L with + | nil => + dsimp [mergeOne, unionIoo, unionIcc] + refine ⟨le_rfl, le_rfl, hab, by simp, List.Pairwise.nil, Subset.rfl, Subset.rfl, ?_⟩ + intro c d hca hbd _ + exact ⟨hca, hbd, by simp⟩ + | cons p rest ih => + have hrest : ∀ r ∈ rest, r.1 < r.2 := fun r hr => hL r (List.mem_cons_of_mem p hr) + have hp_lt : p.1 < p.2 := hL p List.mem_cons_self + obtain ⟨hp_rest, hpw_rest⟩ := List.pairwise_cons.mp hpw + obtain ⟨ih1, ih2, ih3, ih4, ih5, ih6, ih7, ih8⟩ := ih hrest hpw_rest + set q := mergeOne a b rest + dsimp only [mergeOne] + change (if q.1.2 < p.1 ∨ p.2 < q.1.1 then (q.1, p :: q.2) + else ((min q.1.1 p.1, max q.1.2 p.2), q.2)).1.1 ≤ a ∧ _ + split_ifs with hsep + · refine ⟨ih1, ih2, ih3, ?_, ?_, ?_, ?_, ?_⟩ + · intro r hr + rcases List.mem_cons.mp hr with rfl | hr' + · exact ⟨List.mem_cons_self, hp_lt, hsep⟩ + · obtain ⟨h1, h2, h3⟩ := ih4 r hr' + exact ⟨List.mem_cons_of_mem p h1, h2, h3⟩ + · refine List.pairwise_cons.mpr ⟨fun r hr => ?_, ih5⟩ + exact hp_rest r (ih4 r hr).1 + · intro x hx + dsimp only [unionIoo] at hx ⊢ + rcases hx with hxab | hxp | hxrest + · rcases ih6 (Or.inl hxab) with hq1 | hq2 + · exact Or.inl hq1 + · exact Or.inr (Or.inr hq2) + · exact Or.inr (Or.inl hxp) + · rcases ih6 (Or.inr hxrest) with hq1 | hq2 + · exact Or.inl hq1 + · exact Or.inr (Or.inr hq2) + · intro x hx + dsimp only [unionIcc] at hx ⊢ + rcases hx with hq1 | hxp | hq2 + · rcases ih7 (Or.inl hq1) with hxab | hxrest + · exact Or.inl hxab + · exact Or.inr (Or.inr hxrest) + · exact Or.inr (Or.inl hxp) + · rcases ih7 (Or.inr hq2) with hxab | hxrest + · exact Or.inl hxab + · exact Or.inr (Or.inr hxrest) + · intro c d hca hbd hcd + have hcd_p := hcd p List.mem_cons_self + obtain ⟨hc1, hd1, hcd_q2⟩ := ih8 c d hca hbd fun r hr => + hcd r (List.mem_cons_of_mem p hr) + refine ⟨hc1, hd1, fun r hr => ?_⟩ + rcases List.mem_cons.mp hr with rfl | hr' + · exact hcd_p + · exact hcd_q2 r hr' + · push Not at hsep + refine ⟨(min_le_left _ _).trans ih1, ih2.trans (le_max_left _ _), + (min_le_left _ _).trans_lt (ih3.trans_le (le_max_left _ _)), ?_, ih5, ?_, ?_, ?_⟩ + · intro r hr + obtain ⟨h1, h2, h3⟩ := ih4 r hr + refine ⟨List.mem_cons_of_mem p h1, h2, ?_⟩ + rcases hp_rest r h1 with hpr | hrp <;> rcases h3 with hqr | hrq + · exact Or.inl (max_lt hqr hpr) + · linarith [h2] + · linarith [h2] + · exact Or.inr (lt_min hrq hrp) + · intro x hx + dsimp only [unionIoo] at hx ⊢ + have hsub_q1 : Ioo q.1.1 q.1.2 ⊆ Ioo (min q.1.1 p.1) (max q.1.2 p.2) := + Ioo_subset_Ioo (min_le_left _ _) (le_max_left _ _) + have hsub_p : Ioo p.1 p.2 ⊆ Ioo (min q.1.1 p.1) (max q.1.2 p.2) := + Ioo_subset_Ioo (min_le_right _ _) (le_max_right _ _) + rcases hx with hxab | hxp | hxrest + · rcases ih6 (Or.inl hxab) with hq1 | hq2 + · exact Or.inl (hsub_q1 hq1) + · exact Or.inr hq2 + · exact Or.inl (hsub_p hxp) + · rcases ih6 (Or.inr hxrest) with hq1 | hq2 + · exact Or.inl (hsub_q1 hq1) + · exact Or.inr hq2 + · intro x hx + dsimp only [unionIcc] at hx ⊢ + have hcov : Icc (min q.1.1 p.1) (max q.1.2 p.2) ⊆ Icc q.1.1 q.1.2 ∪ Icc p.1 p.2 := by + intro y hy + by_cases hyq : y ∈ Icc q.1.1 q.1.2 + · exact Or.inl hyq + · right + rcases le_or_gt q.1.1 y with h1 | h1 + · have hy_gt : q.1.2 < y := not_le.mp fun h2 => hyq ⟨h1, h2⟩ + rcases max_cases q.1.2 p.2 with ⟨hmax, _⟩ | ⟨hmax, _⟩ + · linarith [hy.2] + · exact ⟨by linarith [hsep.1], by linarith [hy.2]⟩ + · rcases min_cases q.1.1 p.1 with ⟨hmin, _⟩ | ⟨hmin, _⟩ + · linarith [hy.1] + · exact ⟨by linarith [hy.1], by linarith [hsep.2]⟩ + rcases hx with hqp | hq2 + · rcases hcov hqp with hq1 | hxp + · rcases ih7 (Or.inl hq1) with hxab | hxrest + · exact Or.inl hxab + · exact Or.inr (Or.inr hxrest) + · exact Or.inr (Or.inl hxp) + · rcases ih7 (Or.inr hq2) with hxab | hxrest + · exact Or.inl hxab + · exact Or.inr (Or.inr hxrest) + · intro c d hca hbd hcd + have hcd_p := hcd p List.mem_cons_self + obtain ⟨hc1, hd1, hcd_q2⟩ := ih8 c d hca hbd fun r hr => + hcd r (List.mem_cons_of_mem p hr) + exact ⟨le_min hc1 hcd_p.1, max_le hd1 hcd_p.2, hcd_q2⟩ + +theorem mergeList_properties (L : List (ℝ × ℝ)) (hL : ∀ p ∈ L, p.1 < p.2) + (c d : ℝ) (hcd : ∀ p ∈ L, c ≤ p.1 ∧ p.2 ≤ d) : + (∀ p ∈ mergeList L, p.1 < p.2 ∧ c ≤ p.1 ∧ p.2 ≤ d) ∧ + (mergeList L).Pairwise (fun p q => p.2 < q.1 ∨ q.2 < p.1) ∧ + (unionIoo L ⊆ unionIoo (mergeList L)) ∧ + (unionIcc (mergeList L) ⊆ unionIcc L) := by + induction L with + | nil => + simp [mergeList, unionIoo, unionIcc] + | cons p rest ih => + have hrest : ∀ r ∈ rest, r.1 < r.2 := fun r hr => hL r (List.mem_cons_of_mem p hr) + have hcd_rest : ∀ r ∈ rest, c ≤ r.1 ∧ r.2 ≤ d := fun r hr => hcd r (List.mem_cons_of_mem p hr) + obtain ⟨ih1, ih2, ih3, ih4⟩ := ih hrest hcd_rest + have hp_lt : p.1 < p.2 := hL p List.mem_cons_self + have hp_cd : c ≤ p.1 ∧ p.2 ≤ d := hcd p List.mem_cons_self + have hprops := mergeOne_properties p.1 p.2 (mergeList rest) hp_lt + (fun r hr => (ih1 r hr).1) ih2 + set q := mergeOne p.1 p.2 (mergeList rest) + obtain ⟨_, _, hq_lt, hq2, hq_pw, hq_Ioo, hq_Icc, hq_cd⟩ := hprops + obtain ⟨hc_q1, hd_q1, hcd_q2⟩ := hq_cd c d hp_cd.1 hp_cd.2 fun r hr => + ⟨(ih1 r hr).2.1, (ih1 r hr).2.2⟩ + dsimp [mergeList, unionIoo, unionIcc] + refine ⟨?_, ?_, ?_, ?_⟩ + · intro r hr + rcases List.mem_cons.mp hr with rfl | hr' + · exact ⟨hq_lt, hc_q1, hd_q1⟩ + · exact ⟨(hq2 r hr').2.1, (hcd_q2 r hr').1, (hcd_q2 r hr').2⟩ + · refine List.pairwise_cons.mpr ⟨fun r hr => (hq2 r hr).2.2, hq_pw⟩ + · intro x hx + rcases hx with hxp | hxrest + · exact hq_Ioo (Or.inl hxp) + · exact hq_Ioo (Or.inr (ih3 hxrest)) + · intro x hx + rcases hq_Icc hx with hxp | hxrest + · exact Or.inl hxp + · exact Or.inr (ih4 hxrest) + +theorem exists_head_gap (p : ℝ × ℝ) (L : List (ℝ × ℝ)) {δ₀ : ℝ} (hδ₀ : 0 < δ₀) + (hsep : ∀ q ∈ L, p.2 < q.1 ∨ q.2 < p.1) : + ∃ δ : ℝ, 0 < δ ∧ δ ≤ δ₀ ∧ + ∀ q ∈ L, p.2 + 2 * δ < q.1 - 2 * δ ∨ q.2 + 2 * δ < p.1 - 2 * δ := by + induction L with + | nil => exact ⟨δ₀, hδ₀, le_rfl, by simp⟩ + | cons q rest ih => + obtain ⟨δ₁, hδ₁_pos, hδ₁_le, hδ₁_rest⟩ := + ih fun r hr => hsep r (List.mem_cons_of_mem q hr) + rcases hsep q List.mem_cons_self with hpq | hqp + · let δ₂ := min δ₁ ((q.1 - p.2) / 5) + have hδ₂_pos : 0 < δ₂ := lt_min hδ₁_pos (by linarith) + refine ⟨δ₂, hδ₂_pos, (min_le_left _ _).trans hδ₁_le, fun r hr => ?_⟩ + rcases List.mem_cons.mp hr with rfl | hr' + · left + have : δ₂ ≤ (r.1 - p.2) / 5 := min_le_right _ _ + linarith + · have : δ₂ ≤ δ₁ := min_le_left _ _ + rcases hδ₁_rest r hr' with h1 | h1 + · exact Or.inl (by linarith) + · exact Or.inr (by linarith) + · let δ₂ := min δ₁ ((p.1 - q.2) / 5) + have hδ₂_pos : 0 < δ₂ := lt_min hδ₁_pos (by linarith) + refine ⟨δ₂, hδ₂_pos, (min_le_left _ _).trans hδ₁_le, fun r hr => ?_⟩ + rcases List.mem_cons.mp hr with rfl | hr' + · right + have : δ₂ ≤ (p.1 - r.2) / 5 := min_le_right _ _ + linarith + · have : δ₂ ≤ δ₁ := min_le_left _ _ + rcases hδ₁_rest r hr' with h1 | h1 + · exact Or.inl (by linarith) + · exact Or.inr (by linarith) + +theorem exists_min_gap (L : List (ℝ × ℝ)) {δ₀ : ℝ} (hδ₀ : 0 < δ₀) + (hpw : L.Pairwise (fun p q => p.2 < q.1 ∨ q.2 < p.1)) : + ∃ δ : ℝ, 0 < δ ∧ 2 * δ < δ₀ ∧ + L.Pairwise (fun p q => p.2 + 2 * δ < q.1 - 2 * δ ∨ q.2 + 2 * δ < p.1 - 2 * δ) := by + induction L with + | nil => + exact ⟨δ₀ / 3, by positivity, by linarith, List.Pairwise.nil⟩ + | cons p rest ih => + obtain ⟨hp_rest, hpw_rest⟩ := List.pairwise_cons.mp hpw + obtain ⟨δ₁, hδ₁_pos, hδ₁_lt, hδ₁_pw⟩ := ih hpw_rest + obtain ⟨δ₂, hδ₂_pos, hδ₂_le, hδ₂_head⟩ := exists_head_gap p rest hδ₁_pos hp_rest + refine ⟨δ₂, hδ₂_pos, by linarith, List.pairwise_cons.mpr ⟨hδ₂_head, ?_⟩⟩ + refine hδ₁_pw.imp ?_ + intro q1 q2 hq + rcases hq with h1 | h1 + · exact Or.inl (by linarith) + · exact Or.inr (by linarith) + +/-- Piecewise-linear homeomorphism of `ℝ` mapping `[-1, 1]` onto `[a, d]` and `[-3, 3]` onto +`[a - 2δ, d + 2δ]`. -/ +noncomputable def stretchTo (a d δ x : ℝ) : ℝ := + (a + d) / 2 + ((d - a) / 2) * max (-1) (min 1 x) + δ * (min 0 (x + 1) + max 0 (x - 1)) + +/-- Explicit inverse of `stretchTo a d δ`. -/ +noncomputable def unstretchFrom (a d δ y : ℝ) : ℝ := + (max a (min d y) - (a + d) / 2) / ((d - a) / 2) + (min 0 (y - a) + max 0 (y - d)) / δ + +theorem stretchTo_of_lt_neg_one {a d δ x : ℝ} (hx : x ≤ -1) : + stretchTo a d δ x = a + δ * (x + 1) := by + have h1 : min 1 x = x := min_eq_right (by linarith) + have h2 : max (-1) x = -1 := max_eq_left hx + have h3 : min 0 (x + 1) = x + 1 := min_eq_right (by linarith) + have h4 : max 0 (x - 1) = 0 := max_eq_left (by linarith) + simp only [stretchTo, h1, h2, h3, h4] + ring + +theorem stretchTo_of_mem_Icc {a d δ x : ℝ} (hx : x ∈ Icc (-1 : ℝ) 1) : + stretchTo a d δ x = (a + d) / 2 + ((d - a) / 2) * x := by + have h1 : min 1 x = x := min_eq_right hx.2 + have h2 : max (-1) x = x := max_eq_right hx.1 + have h3 : min 0 (x + 1) = 0 := min_eq_left (by linarith [hx.1]) + have h4 : max 0 (x - 1) = 0 := max_eq_left (by linarith [hx.2]) + simp only [stretchTo, h1, h2, h3, h4] + ring + +theorem stretchTo_of_one_le {a d δ x : ℝ} (hx : 1 ≤ x) : + stretchTo a d δ x = d + δ * (x - 1) := by + have h1 : min 1 x = 1 := min_eq_left hx + have h2 : max (-1 : ℝ) 1 = 1 := max_eq_right (by norm_num) + have h3 : min 0 (x + 1) = 0 := min_eq_left (by linarith) + have h4 : max 0 (x - 1) = x - 1 := max_eq_right (by linarith) + simp only [stretchTo, h1, h2, h3, h4] + ring + +theorem unstretchFrom_of_le {a d δ y : ℝ} (had : a < d) (hy : y ≤ a) : + unstretchFrom a d δ y = -1 + (y - a) / δ := by + have h1 : min d y = y := min_eq_right (by linarith) + have h2 : max a y = a := max_eq_left hy + have h3 : min 0 (y - a) = y - a := min_eq_right (by linarith) + have h4 : max 0 (y - d) = 0 := max_eq_left (by linarith) + have hne : (d - a) / 2 ≠ 0 := by linarith + simp only [unstretchFrom, h1, h2, h3, h4, add_zero] + have h5 : (a - (a + d) / 2) / ((d - a) / 2) = -1 := by + rw [div_eq_iff hne] + ring + rw [h5] + +theorem unstretchFrom_of_mem_Icc {a d δ y : ℝ} (hy : y ∈ Icc a d) : + unstretchFrom a d δ y = (y - (a + d) / 2) / ((d - a) / 2) := by + have h1 : min d y = y := min_eq_right hy.2 + have h2 : max a y = y := max_eq_right hy.1 + have h3 : min 0 (y - a) = 0 := min_eq_left (by linarith [hy.1]) + have h4 : max 0 (y - d) = 0 := max_eq_left (by linarith [hy.2]) + simp [unstretchFrom, h1, h2, h3, h4] + +theorem unstretchFrom_of_ge {a d δ y : ℝ} (had : a < d) (hy : d ≤ y) : + unstretchFrom a d δ y = 1 + (y - d) / δ := by + have h1 : min d y = d := min_eq_left hy + have h2 : max a d = d := max_eq_right had.le + have h3 : min 0 (y - a) = 0 := min_eq_left (by linarith) + have h4 : max 0 (y - d) = y - d := max_eq_right (by linarith) + have hne : (d - a) / 2 ≠ 0 := by linarith + simp only [unstretchFrom, h1, h2, h3, h4, zero_add] + have h5 : (d - (a + d) / 2) / ((d - a) / 2) = 1 := by + rw [div_eq_iff hne] + ring + rw [h5] + +theorem unstretchFrom_stretchTo {a d δ : ℝ} (had : a < d) (hδ : 0 < δ) (x : ℝ) : + unstretchFrom a d δ (stretchTo a d δ x) = x := by + have hne : (d - a) / 2 ≠ 0 := by linarith + have hδne : δ ≠ 0 := hδ.ne' + rcases le_total x (-1) with hx1 | hx1 + · rw [stretchTo_of_lt_neg_one hx1] + have hle : a + δ * (x + 1) ≤ a := by nlinarith + rw [unstretchFrom_of_le had hle] + field_simp + ring + · rcases le_total x 1 with hx2 | hx2 + · rw [stretchTo_of_mem_Icc ⟨hx1, hx2⟩] + have hmem : (a + d) / 2 + (d - a) / 2 * x ∈ Icc a d := ⟨by nlinarith, by nlinarith⟩ + rw [unstretchFrom_of_mem_Icc hmem, add_sub_cancel_left, mul_div_cancel_left₀ _ hne] + · rw [stretchTo_of_one_le hx2] + have hge : d ≤ d + δ * (x - 1) := by nlinarith + rw [unstretchFrom_of_ge had hge] + field_simp + ring + +theorem stretchTo_unstretchFrom {a d δ : ℝ} (had : a < d) (hδ : 0 < δ) (y : ℝ) : + stretchTo a d δ (unstretchFrom a d δ y) = y := by + have hne : (d - a) / 2 ≠ 0 := by linarith + have hδne : δ ≠ 0 := hδ.ne' + rcases le_total y a with hy1 | hy1 + · rw [unstretchFrom_of_le had hy1] + have hle : -1 + (y - a) / δ ≤ -1 := by + have : (y - a) / δ ≤ 0 := div_nonpos_of_nonpos_of_nonneg (by linarith) hδ.le + linarith + rw [stretchTo_of_lt_neg_one hle] + field_simp + ring + · rcases le_total y d with hy2 | hy2 + · rw [unstretchFrom_of_mem_Icc ⟨hy1, hy2⟩] + have hmem : (y - (a + d) / 2) / ((d - a) / 2) ∈ Icc (-1 : ℝ) 1 := by + rw [mem_Icc, le_div_iff₀ (by linarith), div_le_iff₀ (by linarith)] + exact ⟨by linarith, by linarith⟩ + rw [stretchTo_of_mem_Icc hmem, mul_div_cancel₀ _ hne] + ring + · rw [unstretchFrom_of_ge had hy2] + have hge : 1 ≤ 1 + (y - d) / δ := by + have : 0 ≤ (y - d) / δ := div_nonneg (by linarith) hδ.le + linarith + rw [stretchTo_of_one_le hge] + field_simp + ring + +/-- Homeomorphism of `ℝ` stretching `[-1, 1]` to `[a, d]` and `[-3, 3]` to `[a - 2δ, d + 2δ]`. -/ +noncomputable def stretchHomeomorph {a d δ : ℝ} (had : a < d) (hδ : 0 < δ) : ℝ ≃ₜ ℝ where + toFun := stretchTo a d δ + invFun := unstretchFrom a d δ + left_inv := unstretchFrom_stretchTo had hδ + right_inv := stretchTo_unstretchFrom had hδ + continuous_toFun := by unfold stretchTo; fun_prop + continuous_invFun := by unfold unstretchFrom; fun_prop + +theorem stretchTo_strictMono {a d δ : ℝ} (had : a < d) (hδ : 0 < δ) : + StrictMono (stretchTo a d δ) := by + intro x₁ x₂ hlt + rcases le_total x₂ (-1) with hx₂1 | hx₂1 + · rw [stretchTo_of_lt_neg_one (hlt.le.trans hx₂1), stretchTo_of_lt_neg_one hx₂1] + nlinarith + · rcases le_total x₁ (-1) with hx₁1 | hx₁1 + · have ha1 : stretchTo a d δ x₁ ≤ a := by + rw [stretchTo_of_lt_neg_one hx₁1]; nlinarith + rcases le_total x₂ 1 with hx₂2 | hx₂2 + · have ha2 : a ≤ stretchTo a d δ x₂ := by + rw [stretchTo_of_mem_Icc ⟨hx₂1, hx₂2⟩]; nlinarith + rcases eq_or_lt_of_le hx₁1 with rfl | hlt1 + · rw [stretchTo_of_lt_neg_one le_rfl, stretchTo_of_mem_Icc ⟨hx₂1, hx₂2⟩] + nlinarith + · have : stretchTo a d δ x₁ < a := by rw [stretchTo_of_lt_neg_one hx₁1]; nlinarith + linarith + · have hd2 : d ≤ stretchTo a d δ x₂ := by + rw [stretchTo_of_one_le hx₂2]; nlinarith + linarith + · rcases le_total x₂ 1 with hx₂2 | hx₂2 + · rw [stretchTo_of_mem_Icc ⟨hx₁1, hlt.le.trans hx₂2⟩, stretchTo_of_mem_Icc ⟨hx₂1, hx₂2⟩] + nlinarith + · rcases le_total x₁ 1 with hx₁2 | hx₁2 + · have hd1 : stretchTo a d δ x₁ ≤ d := by + rw [stretchTo_of_mem_Icc ⟨hx₁1, hx₁2⟩]; nlinarith + rcases eq_or_lt_of_le hx₂2 with rfl | hlt2 + · rw [stretchTo_of_mem_Icc ⟨hx₁1, hx₁2⟩, stretchTo_of_one_le le_rfl] + nlinarith + · have : d < stretchTo a d δ x₂ := by rw [stretchTo_of_one_le hx₂2]; nlinarith + linarith + · rw [stretchTo_of_one_le hx₁2, stretchTo_of_one_le hx₂2] + nlinarith + +theorem stretchTo_eval_pts (a d δ : ℝ) : + stretchTo a d δ (-3) = a - 2 * δ ∧ + stretchTo a d δ (-5 / 2) = a - (3 / 2) * δ ∧ + stretchTo a d δ (-1) = a ∧ + stretchTo a d δ 1 = d ∧ + stretchTo a d δ (5 / 2) = d + (3 / 2) * δ ∧ + stretchTo a d δ 3 = d + 2 * δ := by + refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [stretchTo_of_lt_neg_one (by norm_num)]; ring + · rw [stretchTo_of_lt_neg_one (by norm_num)]; ring + · rw [stretchTo_of_lt_neg_one (by norm_num)]; ring + · rw [stretchTo_of_one_le (by norm_num)]; ring + · rw [stretchTo_of_one_le (by norm_num)]; ring + · rw [stretchTo_of_one_le (by norm_num)]; ring + +/-- The upper semicircle profile `√(max 0 ((5/2)² - y²))` at radius `5 / 2`. -/ +noncomputable def capH52 (y : ℝ) : ℝ := + Real.sqrt (max 0 ((5 / 2) ^ 2 - y ^ 2)) + +theorem continuous_capH52 : Continuous capH52 := by + unfold capH52 + fun_prop + +theorem capH52_nonneg (y : ℝ) : 0 ≤ capH52 y := Real.sqrt_nonneg _ + +theorem capH52_le (y : ℝ) : capH52 y ≤ 5 / 2 := by + unfold capH52 + have h1 : max 0 ((5 / 2) ^ 2 - y ^ 2) ≤ (5 / 2) ^ 2 := + max_le (by norm_num) (by nlinarith [sq_nonneg y]) + exact (Real.sqrt_le_sqrt h1).trans (by rw [Real.sqrt_sq (by norm_num)]) + +theorem sq_capH52 {y : ℝ} (hy : y ∈ Icc (-5 / 2 : ℝ) (5 / 2)) : + (capH52 y) ^ 2 = (5 / 2) ^ 2 - y ^ 2 := by + unfold capH52 + have hnonneg : 0 ≤ (5 / 2) ^ 2 - y ^ 2 := by nlinarith [hy.1, hy.2] + rw [max_eq_right hnonneg, Real.sq_sqrt hnonneg] + +theorem two_le_capH52 {y : ℝ} (hy : y ∈ Icc (-3 / 2 : ℝ) (3 / 2)) : + 2 ≤ capH52 y := by + unfold capH52 + have h1 : (2 : ℝ) ^ 2 ≤ max 0 ((5 / 2) ^ 2 - y ^ 2) := + le_trans (by nlinarith [hy.1, hy.2]) (le_max_right 0 _) + exact (by rw [Real.sqrt_sq (by norm_num)] : (2 : ℝ) = Real.sqrt (2 ^ 2)).trans_le + (Real.sqrt_le_sqrt h1) + +/-- The horizontal shear homeomorphism `Ψ(z) = ⟨z.re - capH52 z.im, z.im⟩` of `ℂ`, which maps the +right semicircle `{z ∈ sphere 0 (5/2) | 0 ≤ z.re}` to `{0} ×ℂ [-5/2, 5/2]` and `{z ∈ ball 0 3 | z.re +≤ capH52 z.im}` into `[-6, 0] ×ℂ (-3, 3)`. -/ +noncomputable def psiShift : ℂ ≃ₜ ℂ where + toFun z := ⟨z.re - capH52 z.im, z.im⟩ + invFun w := ⟨w.re + capH52 w.im, w.im⟩ + left_inv z := Complex.ext (by simp) (by simp) + right_inv w := Complex.ext (by simp) (by simp) + continuous_toFun := by + refine Continuous.comp Complex.equivRealProdCLM.symm.continuous (Continuous.prodMk ?_ ?_) + · exact Complex.continuous_re.sub (continuous_capH52.comp Complex.continuous_im) + · exact Complex.continuous_im + continuous_invFun := by + refine Continuous.comp Complex.equivRealProdCLM.symm.continuous (Continuous.prodMk ?_ ?_) + · exact Complex.continuous_re.add (continuous_capH52.comp Complex.continuous_im) + · exact Complex.continuous_im + +@[simp] theorem psiShift_re (z : ℂ) : (psiShift z).re = z.re - capH52 z.im := rfl +@[simp] theorem psiShift_im (z : ℂ) : (psiShift z).im = z.im := rfl +@[simp] theorem psiShift_symm_re (w : ℂ) : (psiShift.symm w).re = w.re + capH52 w.im := rfl +@[simp] theorem psiShift_symm_im (w : ℂ) : (psiShift.symm w).im = w.im := rfl + +theorem psiShift_right_semicircle {z : ℂ} (hz : ‖z‖ = 5 / 2) (hre : 0 ≤ z.re) : + (psiShift z).re = 0 ∧ (psiShift z).im ∈ Icc (-5 / 2 : ℝ) (5 / 2) := by + have hsq : z.re ^ 2 + z.im ^ 2 = (5 / 2) ^ 2 := by + have h1 : Complex.normSq z = (5 / 2) ^ 2 := by + rw [← Complex.sq_norm, hz] + rw [Complex.normSq_apply] at h1 + nlinarith + have him : z.im ∈ Icc (-5 / 2 : ℝ) (5 / 2) := by + have h2 : z.im ^ 2 ≤ (5 / 2) ^ 2 := by nlinarith [sq_nonneg z.re] + have h3 : |z.im| ≤ 5 / 2 := by + rw [← sq_le_sq₀ (abs_nonneg _) (by norm_num), sq_abs] + exact h2 + exact ⟨by linarith [ neg_le_of_abs_le h3 ], le_of_abs_le h3⟩ + have hcap : capH52 z.im = z.re := by + unfold capH52 + have h1 : (5 / 2) ^ 2 - z.im ^ 2 = z.re ^ 2 := by linarith + rw [h1, max_eq_right (sq_nonneg _), Real.sqrt_sq hre] + exact ⟨by rw [psiShift_re, hcap, sub_self], him⟩ + +theorem psiShift_symm_mem_closedBall {w : ℂ} (hre : w.re ∈ Icc (-2 : ℝ) 0) + (him : w.im ∈ Icc (-3 / 2 : ℝ) (3 / 2)) : + ‖psiShift.symm w‖ ≤ 5 / 2 ∧ 0 ≤ (psiShift.symm w).re := by + have hcap2 : 2 ≤ capH52 w.im := two_le_capH52 him + have him52 : w.im ∈ Icc (-5 / 2 : ℝ) (5 / 2) := ⟨by linarith [him.1], by linarith [him.2]⟩ + have hre_pos : 0 ≤ (psiShift.symm w).re := by + simp only [psiShift_symm_re] + linarith [hre.1] + have hre_le : (psiShift.symm w).re ≤ capH52 w.im := by + simp only [psiShift_symm_re] + linarith [hre.2] + refine ⟨?_, hre_pos⟩ + rw [← sq_le_sq₀ (norm_nonneg _) (by norm_num), Complex.sq_norm, Complex.normSq_apply] + have hsq := sq_capH52 him52 + have hsq_re : (psiShift.symm w).re * (psiShift.symm w).re ≤ (capH52 w.im) ^ 2 := by + nlinarith [hre_pos, hre_le] + rw [psiShift_symm_im] + linarith + +theorem psiShift_ball3_bounds {z : ℂ} (hz : z ∈ ball (0 : ℂ) 3) (hle : z.re ≤ capH52 z.im) : + (psiShift z).re ∈ Icc (-6 : ℝ) 0 ∧ (psiShift z).im ∈ Ioo (-3 : ℝ) 3 := by + have hnorm : ‖z‖ < 3 := mem_ball_zero_iff.mp hz + have hre_gt : -3 < z.re := by + have := Complex.abs_re_le_norm z + linarith [(abs_lt.mp (this.trans_lt hnorm)).1] + have him_mem : z.im ∈ Ioo (-3 : ℝ) 3 := by + have := Complex.abs_im_le_norm z + exact abs_lt.mp (this.trans_lt hnorm) + have hcap : capH52 z.im ≤ 5 / 2 := capH52_le z.im + rw [psiShift_re, psiShift_im] + exact ⟨⟨by linarith, by linarith⟩, him_mem⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section11g.lean b/LeanPool/GraphMinor/GM07/Section11g.lean new file mode 100644 index 0000000000..e63610b4f0 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section11g.lean @@ -0,0 +1,1304 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section11f + +/-! +# Graph Minors VII, (11.10) Boundary-Surface Case (`bd S ≠ ∅`): Boundary Chart Merging + +This file completes the proof of `SolidFlatBoundarySurfacePlanarStatement` +(`GraphMinor/GM07/Open.lean`), +formalizing the boundary-surface case ($\operatorname{bd}(\Sigma) \ne \emptyset$) of Graph Minors +VII, +(11.10) (page 253). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Function Topology Metric Filter OnePoint GraphMinor.Surface GraphMinor.GM11 + +local notation "𝕀" => unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Plane Domain Lemmas for `B_half` and `psiShift` -/ + +/-- The half-ball domain `B_half := {z ∈ ball 0 3 | z.re ≤ capH52 z.im}` in `ℂ`. -/ +def bHalf : Set ℂ := {z : ℂ | z ∈ ball 0 3 ∧ z.re ≤ capH52 z.im} + +/-- The open interior part `B_int := {z ∈ ball 0 3 | z.re < capH52 z.im}` of `bHalf`. -/ +def bInt : Set ℂ := {z : ℂ | z ∈ ball 0 3 ∧ z.re < capH52 z.im} + +theorem isOpen_bInt : IsOpen bInt := + isOpen_ball.inter (isOpen_lt Complex.continuous_re (continuous_capH52.comp Complex.continuous_im)) + +theorem bInt_subset_bHalf : bInt ⊆ bHalf := fun _ hz => ⟨hz.1, hz.2.le⟩ + +/-- Every point on `sphere (0 : ℂ) (5 / 2)` satisfies `capH52 z.im = |z.re|` and lies in `bHalf`. -/ +theorem capH52_of_mem_sphere {z : ℂ} (hz : z ∈ sphere (0 : ℂ) (5 / 2)) : + capH52 z.im = |z.re| ∧ z ∈ bHalf := by + have hnorm : ‖z‖ = 5 / 2 := mem_sphere_zero_iff_norm.mp hz + have hsq : z.re ^ 2 + z.im ^ 2 = (5 / 2) ^ 2 := by + have h1 : Complex.normSq z = (5 / 2) ^ 2 := by rw [← Complex.sq_norm, hnorm] + rw [Complex.normSq_apply] at h1 + nlinarith + have hcap : capH52 z.im = |z.re| := by + unfold capH52 + have h1 : (5 / 2) ^ 2 - z.im ^ 2 = z.re ^ 2 := by linarith + rw [h1, max_eq_right (sq_nonneg _), Real.sqrt_sq_eq_abs] + refine ⟨hcap, mem_ball_zero_iff.mpr (by linarith), ?_⟩ + rw [hcap] + exact le_abs_self z.re + +/-- On `sphere (0 : ℂ) (5 / 2)`, `z.re = capH52 z.im ↔ 0 ≤ z.re`. -/ +theorem re_eq_capH52_iff_nonneg {z : ℂ} (hz : z ∈ sphere (0 : ℂ) (5 / 2)) : + z.re = capH52 z.im ↔ 0 ≤ z.re := by + rw [(capH52_of_mem_sphere hz).1] + exact ⟨fun h => h ▸ abs_nonneg z.re, fun h => (abs_of_nonneg h).symm⟩ + +/-- Every point of `{z : ℂ | ‖z‖ = 5 / 2 ∧ 0 ≤ z.re}` is `(5 / 2 : ℂ) * (Circle.exp (-τ) * +Circle.exp (s * (2 * τ)))` +for some `s ∈ 𝕀`, whenever `Real.pi / 2 ≤ τ`. -/ +theorem right_semicircle_subset_arc {τ : ℝ} (hτ : Real.pi / 2 ≤ τ) (hτ_pos : 0 < τ) + {z : ℂ} (hz : ‖z‖ = 5 / 2) (hre : 0 ≤ z.re) : + ∃ s : 𝕀, (5 / 2 : ℂ) * ↑(Circle.exp (-τ) * Circle.exp (s.1 * (2 * τ))) = z := by + obtain ⟨harg_ge, harg_le⟩ := abs_le.mp (Complex.abs_arg_le_pi_div_two_iff.mpr hre) + let s_val : ℝ := (Complex.arg z + τ) / (2 * τ) + have hs0 : 0 ≤ s_val := div_nonneg (by linarith) (by positivity) + have hs1 : s_val ≤ 1 := (div_le_one (by positivity)).mpr (by linarith) + refine ⟨⟨s_val, hs0, hs1⟩, ?_⟩ + rw [← Circle.exp_add] + have hangle : -τ + s_val * (2 * τ) = Complex.arg z := by + dsimp [s_val] + field_simp + ring + rw [hangle, Circle.coe_exp] + have hmul := Complex.norm_mul_exp_arg_mul_I z + rw [hz] at hmul + simpa [mul_comm] using hmul + +/-- If an `O`-arc `Q ⊆ bHalf` in `ℂ` satisfies `closedInner Q ⊆ ball 0 3`, then +`closedInner Q ⊆ bHalf`. -/ +theorem closedInner_subset_bHalf {Q : Set ℂ} (hQ : IsOArc Q) (hQb : Q ⊆ bHalf) + (hsub3 : closedInner Q ⊆ ball 0 3) : + closedInner Q ⊆ bHalf := by + obtain ⟨φ⟩ := id hQ + have J := isJordanParts φ + intro z₀ hz₀ + refine ⟨hsub3 hz₀, ?_⟩ + rcases hz₀ with hz₀_in | hz₀_Q + · by_contra hgt + push Not at hgt + let γ : ℝ → ℂ := fun s => z₀ + (s : ℂ) + have hγc : Continuous γ := by fun_prop + have hγ_conn : IsPreconnected (γ '' Icc 0 6) := + isPreconnected_Icc.image γ hγc.continuousOn + have hγ_disj : Disjoint (γ '' Icc 0 6) Q := by + rw [Set.disjoint_left] + rintro _ ⟨s, hs, rfl⟩ hmemQ + have hle := (hQb hmemQ).2 + have hre : (γ s).re = z₀.re + s := by simp [γ] + have him : (γ s).im = z₀.im := by simp [γ] + rw [hre, him] at hle + linarith [hs.1] + have hcov : γ '' Icc 0 6 ⊆ Surface.inner Q ∪ (closedInner Q)ᶜ := by + intro w hw + by_cases hw_in : w ∈ Surface.inner Q + · exact Or.inl hw_in + · exact Or.inr fun hcl => hcl.elim hw_in (Set.disjoint_left.mp hγ_disj hw) + have hdisj_open : Disjoint (Surface.inner Q) (closedInner Q)ᶜ := + Set.disjoint_left.mpr fun w hw hnot => hnot (Or.inl hw) + rcases hγ_conn.subset_or_subset J.isOpen_inner J.isCompact_closure_inner.isClosed.isOpen_compl + hdisj_open hcov with hsub_in | hsub_out + · have h6_in : γ 6 ∈ ball (0 : ℂ) 3 := + hsub3 (Or.inl (hsub_in ⟨6, ⟨by norm_num, by norm_num⟩, rfl⟩)) + have hz₀_in3 : ‖z₀‖ < 3 := mem_ball_zero_iff.mp (hsub3 (Or.inl hz₀_in)) + have h6_norm : ‖γ 6‖ < 3 := mem_ball_zero_iff.mp h6_in + have htri := norm_sub_norm_le (6 : ℂ) (-z₀) + have h6_eq : (6 : ℂ) - (-z₀) = γ 6 := by simp [γ]; ring + rw [h6_eq, norm_neg] at htri + have hnorm6 : ‖(6 : ℂ)‖ = 6 := by norm_num + linarith + · have h0_out := hsub_out ⟨0, ⟨by norm_num, by norm_num⟩, rfl⟩ + have hγ0 : γ 0 = z₀ := by simp [γ] + rw [hγ0] at h0_out + exact h0_out (Or.inl hz₀_in) + · exact (hQb hz₀_Q).2 + +/-- If `Q = A ∪ B` is an `O`-arc in `ℂ` with `closedBall 0 2 ⊆ Surface.inner Q`, +`{z : ℂ | ‖z‖ = 5 / 2 ∧ 0 ≤ z.re} ⊆ A ⊆ sphere 0 (5 / 2)`, and `B ⊆ {z : ℂ | z.re < 0}`, then +`{z : ℂ | ‖z‖ ≤ 5 / 2 ∧ 0 ≤ z.re} ⊆ closedInner Q`. -/ +theorem right_halfDisc_subset_closedInner {Q A B : Set ℂ} (hQ : IsOArc Q) (hQ_eq : Q = A ∪ B) + (hin2 : closedBall (0 : ℂ) 2 ⊆ Surface.inner Q) + (hA_semi : {z : ℂ | ‖z‖ = 5 / 2 ∧ 0 ≤ z.re} ⊆ A) + (hA_sph : A ⊆ sphere 0 (5 / 2)) + (hB_neg : ∀ z ∈ B, z.re < 0) : + {z : ℂ | ‖z‖ ≤ 5 / 2 ∧ 0 ≤ z.re} ⊆ closedInner Q := by + obtain ⟨φ⟩ := id hQ + have J := isJordanParts φ + rintro z₀ ⟨hz₀_norm, hz₀_re⟩ + rcases eq_or_lt_of_le hz₀_norm with heq | hlt + · exact Or.inr (hQ_eq ▸ Or.inl (hA_semi ⟨heq, hz₀_re⟩)) + · let γ : ℝ → ℂ := fun s => (s : ℂ) * z₀ + have hγc : Continuous γ := by fun_prop + have hγ_conn : IsPreconnected (γ '' Icc 0 1) := + isPreconnected_Icc.image γ hγc.continuousOn + have hγ_disj : Disjoint (γ '' Icc 0 1) Q := by + rw [Set.disjoint_left] + rintro _ ⟨s, hs, rfl⟩ hmemQ + rw [hQ_eq] at hmemQ + rcases hmemQ with hmemA | hmemB + · have hnorm_s : ‖γ s‖ = 5 / 2 := mem_sphere_zero_iff_norm.mp (hA_sph hmemA) + have hnorm_le : ‖γ s‖ < 5 / 2 := by + simp only [γ, norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg hs.1] + nlinarith [hs.1, hs.2, norm_nonneg z₀] + exact hnorm_le.ne hnorm_s + · have hneg := hB_neg (γ s) hmemB + have hnonneg : 0 ≤ (γ s).re := by + simp only [γ, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero] + exact mul_nonneg hs.1 hz₀_re + linarith + have hcov : γ '' Icc 0 1 ⊆ Surface.inner Q ∪ (closedInner Q)ᶜ := by + intro w hw + by_cases hw_in : w ∈ Surface.inner Q + · exact Or.inl hw_in + · exact Or.inr fun hcl => hcl.elim hw_in (Set.disjoint_left.mp hγ_disj hw) + have hdisj_open : Disjoint (Surface.inner Q) (closedInner Q)ᶜ := + Set.disjoint_left.mpr fun w hw hnot => hnot (Or.inl hw) + rcases hγ_conn.subset_or_subset J.isOpen_inner J.isCompact_closure_inner.isClosed.isOpen_compl + hdisj_open hcov with hsub_in | hsub_out + · have h1_in := hsub_in ⟨1, ⟨by norm_num, by norm_num⟩, rfl⟩ + have hγ1 : γ 1 = z₀ := by simp [γ] + rw [hγ1] at h1_in + exact Or.inl h1_in + · exfalso + have h0_out := hsub_out ⟨0, ⟨by norm_num, by norm_num⟩, rfl⟩ + have hγ0 : γ 0 = 0 := by simp [γ] + rw [hγ0] at h0_out + exact h0_out (Or.inl (hin2 (mem_closedBall_zero_iff.mpr (by norm_num)))) + +/-! ## 2. Taming One Arc When the Other Arc Misses `G` -/ + +/-- If `a` and `b` form two arcs of an `O`-arc and `range a` is disjoint from `G₀ = ⋃ g ∈ G, range +g`, +we can tame `b` alone within `thickening ε (range b)` while keeping `a` fixed. -/ +theorem exists_tame_single_arc {Y : Type u} [MetricSpace Y] (G : List (𝕀 → Y)) + (hG : ∀ g ∈ G, IsArcMap g) {a b : 𝕀 → Y} (ha : IsArcMap a) (hb : IsArcMap b) + (h0 : b 0 = a 0) (h1 : b 1 = a 1) + (hm : ∀ s t, a s = b t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) + (hdisj_a : Disjoint (range a) (⋃ g ∈ G, range g)) {ε : ℝ} (hε : 0 < ε) : + ∃ b' : 𝕀 → Y, IsArcMap b' ∧ b' 0 = a 0 ∧ b' 1 = a 1 ∧ + (∀ s t, a s = b' t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) ∧ + range b' ⊆ thickening ε (range b) ∧ + FinConn ((range a ∪ range b') \ ⋃ g ∈ G, range g) := by + classical + set G₀ : Set Y := ⋃ g ∈ G, range g with hG₀ + have hp : ∀ g ∈ G, a 0 ∉ range g := fun g hg hmem => + Set.disjoint_left.mp hdisj_a ⟨0, rfl⟩ (mem_iUnion₂.mpr ⟨g, hg, hmem⟩) + have hq : ∀ g ∈ G, a 1 ∉ range g := fun g hg hmem => + Set.disjoint_left.mp hdisj_a ⟨1, rfl⟩ (mem_iUnion₂.mpr ⟨g, hg, hmem⟩) + obtain ⟨L, hL1, hcover, hL3⟩ := exists_small_arc_cover G hG hε + have hL2 : (⋃ g ∈ L, range g) = G₀ := hcover + have hLG : ∀ g ∈ L, range g ⊆ G₀ := fun g hg => by + rw [← hL2] + exact subset_biUnion_of_mem (s := {g | g ∈ L}) (u := fun g : 𝕀 → Y => range g) hg + let Lb := L.filter fun g => (range g ∩ range b).Nonempty + have hLb : ∀ g ∈ Lb, g ∈ L ∧ (range g ∩ range b).Nonempty := fun g hg => by + simpa [Lb] using hg + have hmissG : ∀ g ∈ L, a 0 ∉ range g ∧ a 1 ∉ range g := fun g hg => by + constructor + · intro hx + obtain ⟨g', h5, h6⟩ := mem_iUnion₂.mp (hLG g hg hx) + exact hp g' h5 h6 + · intro hx + obtain ⟨g', h5, h6⟩ := mem_iUnion₂.mp (hLG g hg hx) + exact hq g' h5 h6 + obtain ⟨b', hb', hb0, hb1, hb2, hb3⟩ := exists_erase Lb (fun g hg => hL1 g (hLb g hg).1) hb + (fun g hg => h0 ▸ (hmissG g (hLb g hg).1).1) (fun g hg => h1 ▸ (hmissG g (hLb g hg).1).2) + refine ⟨b', hb', hb0.trans h0, hb1.trans h1, ?_, ?_, ?_⟩ + · intro s t he + have hmem : b' t ∈ range b ∪ ⋃ g ∈ Lb, range g := hb2 ⟨t, rfl⟩ + rcases hmem with ⟨t', ht'⟩ | hmemL + · rcases hm s t' (he.trans ht'.symm) with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl ⟨rfl, hb'.2 (by rw [← he, hb0, h0])⟩ + · exact Or.inr ⟨rfl, hb'.2 (by rw [← he, hb1, h1])⟩ + · exfalso + obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp hmemL + exact Set.disjoint_left.mp hdisj_a ⟨s, he⟩ (hLG g (hLb g hg).1 hxg) + · intro x hx + rcases hb2 hx with hxb | hxL + · exact self_subset_thickening hε _ hxb + · obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp hxL + obtain ⟨y, hyg, hyb⟩ := (hLb g hg).2 + exact mem_thickening_iff.mpr ⟨y, hyb, hL3 g (hLb g hg).1 x hxg y hyg⟩ + · have ha_sdiff : range a \ G₀ = range a := sdiff_eq_left.mpr hdisj_a + have hb_sdiff : range b' \ G₀ = range b' \ ⋃ g ∈ Lb, range g := by + ext x + constructor + · rintro ⟨h4, h5⟩ + refine ⟨h4, fun h6 => h5 ?_⟩ + obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h6 + exact hLG g (hLb g hg).1 hxg + · rintro ⟨h4, h5⟩ + refine ⟨h4, fun h6 => ?_⟩ + rw [← hL2] at h6 + obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h6 + rcases hb2 h4 with h7 | h7 + · have hne : (range g ∩ range b).Nonempty := ⟨x, hxg, h7⟩ + exact h5 (mem_iUnion₂.mpr ⟨g, by simp [Lb, hg, hne], hxg⟩) + · exact h5 h7 + rw [union_sdiff_distrib, ha_sdiff, hb_sdiff] + exact (finConn_of_isPreconnected (isPreconnected_range ha.1)).union hb3 + +/-! ## 3. Boundary Half-Charts and Boundary Disc Merging -/ + +/-- Coordinates on a boundary collar neighborhood `U ⊆ S`, mapping `bHalf = {z ∈ ball 0 3 | z.re ≤ +capH52 z.im}` +homeomorphically onto `U`, with `g z ∈ bd S ↔ z.re = capH52 z.im`. -/ +structure BoundaryHalfChart (U : Set S) (h : S → ℂ) (g : ℂ → S) : Prop where + hc : ContinuousOn h U + gc : Continuous g + hm : MapsTo h U bHalf + gm : MapsTo g bHalf U + gh : LeftInvOn g h U + hg : LeftInvOn h g bHalf + bd_iff : ∀ z ∈ bHalf, g z ∈ bd S ↔ z.re = capH52 z.im + +namespace BoundaryHalfChart + +variable {U : Set S} {h : S → ℂ} {g : ℂ → S} + +theorem isOpen_image_bInt (c : BoundaryHalfChart U h g) (hS : IsSurface S) {V : Set ℂ} + (hV : IsOpen V) (hsub : V ⊆ bInt) : IsOpen (g '' V) := + isOpen_image_of_manifold hV c.gc.continuousOn (c.hg.injOn.mono (hsub.trans bInt_subset_bHalf)) + fun _ _ => hS.2.2 _ + +theorem image_disc (c : BoundaryHalfChart U h g) {Z : Set ℂ} (hZ : IsClosedDisc Z) + (hsub : Z ⊆ bHalf) : + IsClosedDisc (g '' Z) ∧ discBd (g '' Z) = g '' discBd Z := + hZ.image (c.gc.continuousOn.mono hsub) + (c.hc.mono (image_subset_iff.mpr fun _ hz => c.gm (hsub hz))) (c.hg.mono hsub) + +end BoundaryHalfChart + +/-- Cosine is negative on `(π/2, 3π/2)`. -/ +theorem cos_neg_of_mem_Ioo_pi_div_two_three_pi_div_two {θ : ℝ} + (h1 : Real.pi / 2 < θ) (h2 : θ < 3 * Real.pi / 2) : Real.cos θ < 0 := by + have hpi := Real.pi_pos + rcases le_or_gt θ Real.pi with hle | hgt + · exact Real.cos_neg_of_pi_div_two_lt_of_lt h1 (by linarith) + · have hsym : Real.cos (2 * Real.pi - θ) = Real.cos θ := by + have : 2 * Real.pi - θ = -θ + 2 * Real.pi := by ring + rw [this, Real.cos_add_two_pi, Real.cos_neg] + rw [← hsym] + exact Real.cos_neg_of_pi_div_two_lt_of_lt (by linarith) (by linarith) + +private theorem scaled_collar_arcs + {τ r : ℝ} (hτ_gt : Real.pi / 2 < τ) (hτ_lt2 : τ < 2) (hrpos : 0 < r) + (a₀ b₀ : 𝕀 → Circle) + (ha₀ : ∀ s, a₀ s = Circle.exp (-τ) * Circle.exp (s.1 * (2 * τ))) + (hb₀ : ∀ s, b₀ s = Circle.exp (-τ) * + Circle.exp (2 * Real.pi - s.1 * (2 * Real.pi - 2 * τ))) : + let κ : Circle → ℂ := fun w => (r : ℂ) * w + (∀ w : Circle, (w : ℂ) ≠ -1 → κ w ∈ Complex.slitPlane) ∧ + (∀ s, (a₀ s : ℂ) ≠ -1) ∧ (∀ s, (κ (b₀ s)).re < 0) := by + intro κ + have hpi_gt3 : 3 < Real.pi := Real.pi_gt_three + have hslit : ∀ w : Circle, (w : ℂ) ≠ -1 → κ w ∈ Complex.slitPlane := fun w hw => by + have h1 := circle_mem_slitPlane hw + rw [Complex.mem_slitPlane_iff] at h1 ⊢ + simp only [κ, Complex.mul_re, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, zero_mul, + sub_zero, add_zero] + rcases h1 with h1 | h1 + · exact .inl (mul_pos hrpos h1) + · exact .inr (mul_ne_zero hrpos.ne' h1) + have ha₀ne : ∀ s, (a₀ s : ℂ) ≠ -1 := fun s he => by + have h1 : a₀ s = Circle.exp Real.pi := Circle.ext (by simpa using he) + rw [ha₀, ← Circle.exp_add] at h1 + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h1 + have hs0 := s.2.1 + have hs1 := s.2.2 + have h2 : -τ ≤ -τ + s.1 * (2 * τ) := by nlinarith + have h3 : -τ + s.1 * (2 * τ) ≤ τ := by nlinarith + rcases le_or_gt 0 m with h | h + · have h4 : (0 : ℝ) ≤ m := by exact_mod_cast h + nlinarith + · have h4 : (m : ℝ) ≤ -1 := by exact_mod_cast (by omega : m ≤ -1) + nlinarith + have hb₀_neg : ∀ s, (κ (b₀ s)).re < 0 := fun s => by + rw [hb₀, ← Circle.exp_add] + set θ := -τ + (2 * Real.pi - s.1 * (2 * Real.pi - 2 * τ)) + have hs0 := s.2.1 + have hs1 := s.2.2 + have hθ1 : Real.pi / 2 < θ := by + have : τ ≤ θ := by nlinarith + linarith + have hθ2 : θ < 3 * Real.pi / 2 := by + have : θ ≤ 2 * Real.pi - τ := by nlinarith + linarith + simp only [κ, Circle.coe_exp, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, + Complex.exp_ofReal_mul_I_re, zero_mul, sub_zero] + exact mul_neg_of_pos_of_neg hrpos (cos_neg_of_mem_Ioo_pi_div_two_three_pi_div_two hθ1 hθ2) + exact ⟨hslit, ha₀ne, hb₀_neg⟩ + +/-- In a `BoundaryHalfChart`, given a closed set `D` disjoint from `g '' {z ∈ bHalf | z.re = capH52 +z.im}` +and a finite list of arcs `G` in `D`, we can perturb the left semicircle of radius `5 / 2` inside +`g '' bInt` while keeping the right semicircle fixed, obtaining an `O`-arc `P` tame with respect to +`G` that bounds a closed disc `E ⊆ U` containing `g '' closedBall 0 2` and +`g '' {z : ℂ | ‖z‖ ≤ 5 / 2 ∧ 0 ≤ z.re}`. -/ +theorem exists_boundary_tame_curve (hS : IsSurface S) + {U : Set S} {h : S → ℂ} {g : ℂ → S} (c : BoundaryHalfChart U h g) + {D : Set S} (hDcl : IsClosed D) + (hD_disj : Disjoint D (g '' {z ∈ bHalf | z.re = capH52 z.im})) + (G : List (𝕀 → S)) (hG : ∀ γ ∈ G, IsArcMap γ) (hGD : (⋃ γ ∈ G, range γ) ⊆ D) : + ∃ P E : Set S, IsOArc P ∧ FinConn (P \ ⋃ γ ∈ G, range γ) ∧ + IsClosedDisc E ∧ discBd E = P ∧ + g '' (closedBall 0 2 ∩ bHalf) ⊆ E ∧ + g '' {z : ℂ | ‖z‖ ≤ 5 / 2 ∧ 0 ≤ z.re} ⊆ E ∧ + E ⊆ g '' bHalf ∧ + P ⊆ g '' bInt ∪ g '' {z : ℂ | ‖z‖ = 5 / 2 ∧ 0 ≤ z.re} := by + classical + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hsc := secondCountable_of_manifold hS.2.2 + let _ : MetricSpace S := TopologicalSpace.metrizableSpaceMetric S + have hpi := Real.pi_pos + have hpi_gt3 : 3 < Real.pi := Real.pi_gt_three + have hpi_lt : Real.pi < 3.15 := Real.pi_lt_d2 + let r : ℝ := 5 / 2 + have hrpos : 0 < r := by norm_num + have hr2 : 2 < r := by norm_num + have hr3 : r < 3 := by norm_num + have hrc : (r : ℂ) ≠ 0 := by norm_num + let κ : Circle → ℂ := fun w => (r : ℂ) * w + have hκc : Continuous κ := by fun_prop + have hκi : Function.Injective κ := fun w w' he => Circle.ext (mul_left_cancel₀ hrc he) + have hκn : ∀ w, ‖κ w‖ = 5 / 2 := fun w => by simp [κ, r] + have hκ_sph : ∀ w, κ w ∈ sphere (0 : ℂ) (5 / 2) := fun w => mem_sphere_zero_iff_norm.mpr (hκn w) + have hκ_bHalf : ∀ w, κ w ∈ bHalf := fun w => (capH52_of_mem_sphere (hκ_sph w)).2 + -- Find `δ_τ > 0` so `θ ↦ g (κ (Circle.exp θ))` misses `D` on `[-π/2 - δ_τ, π/2 + δ_τ]`. + let f_arc : ℝ → S := fun θ => g (κ (Circle.exp θ)) + have hf_arc : Continuous f_arc := c.gc.comp (hκc.comp Circle.exp.continuous) + have hIcc_miss : Icc (-(Real.pi / 2)) (Real.pi / 2) ⊆ f_arc ⁻¹' Dᶜ := by + intro θ hθ hxD + have hre : 0 ≤ (κ (Circle.exp θ)).re := by + simp only [κ, Circle.coe_exp, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, + Complex.exp_ofReal_mul_I_re, zero_mul, sub_zero] + exact mul_nonneg hrpos.le (Real.cos_nonneg_of_mem_Icc hθ) + have hbd_eq := (re_eq_capH52_iff_nonneg (hκ_sph (Circle.exp θ))).mpr hre + exact Set.disjoint_left.mp hD_disj hxD ⟨κ (Circle.exp θ), ⟨hκ_bHalf _, hbd_eq⟩, rfl⟩ + obtain ⟨δ₁, hδ₁, hth_δ₁⟩ := isCompact_Icc.exists_thickening_subset_open + (hDcl.isOpen_compl.preimage hf_arc) hIcc_miss + set δ_τ : ℝ := min (δ₁ / 2) (1 / 4) with hδ_τ_def + have hδ_τ_pos : 0 < δ_τ := lt_min (by positivity) (by norm_num) + have hδ_τ_le1 : δ_τ ≤ δ₁ / 2 := min_le_left _ _ + have hδ_τ_le2 : δ_τ ≤ 1 / 4 := min_le_right _ _ + set τ : ℝ := Real.pi / 2 + δ_τ with hτ_def + have hτ_gt : Real.pi / 2 < τ := by linarith + have hτ_lt2 : τ < 2 := by linarith + have hτ_pos : 0 < τ := by linarith + obtain ⟨a₀, b₀, hab, ha₀, hb₀, _⟩ := circle_two_arcs' (Circle.exp (-τ)) (θ := 2 * τ) + ⟨by positivity, by linarith⟩ + let Ω₀ : Set ℂ := {z | 2 < ‖z‖ ∧ ‖z‖ < 3} + have hΩ₀ : IsOpen Ω₀ := (isOpen_lt continuous_const continuous_norm).inter + (isOpen_lt continuous_norm continuous_const) + have hκΩ : ∀ w, κ w ∈ Ω₀ := fun w => ⟨by rw [hκn]; norm_num, by rw [hκn]; norm_num⟩ + obtain ⟨hslit, ha₀ne, hb₀_neg⟩ := scaled_collar_arcs hτ_gt hτ_lt2 hrpos a₀ b₀ ha₀ hb₀ + let a : 𝕀 → S := fun s => g (κ (a₀ s)) + let b : 𝕀 → S := fun s => g (κ (b₀ s)) + have hgκc : Continuous fun w => g (κ w) := c.gc.comp hκc + have hgκi : Function.Injective fun w => g (κ w) := fun w w' he => + hκi (c.hg.injOn.eq_iff (hκ_bHalf w) (hκ_bHalf w') |>.mp he) + have ha : IsArcMap a := ⟨hgκc.comp hab.1.1, hgκi.comp hab.1.2⟩ + have hb : IsArcMap b := ⟨hgκc.comp hab.2.1, hgκi.comp hab.2.2⟩ + have ha_disj_D : Disjoint (range a) D := by + rw [Set.disjoint_left] + rintro _ ⟨s, rfl⟩ hxD + have hθ_mem : -τ + s.1 * (2 * τ) ∈ thickening δ₁ (Icc (-(Real.pi / 2)) (Real.pi / 2)) := by + rw [mem_thickening_iff] + have hs0 := s.2.1 + have hs1 := s.2.2 + have h1 : -τ ≤ -τ + s.1 * (2 * τ) := by nlinarith + have h2 : -τ + s.1 * (2 * τ) ≤ τ := by nlinarith + rcases lt_or_ge (-τ + s.1 * (2 * τ)) (-(Real.pi / 2)) with hlt | hge + · refine ⟨-(Real.pi / 2), ⟨le_rfl, by linarith⟩, ?_⟩ + rw [Real.dist_eq, abs_of_neg (by linarith)] + linarith + · rcases le_or_gt (-τ + s.1 * (2 * τ)) (Real.pi / 2) with hle | hgt + · refine ⟨-τ + s.1 * (2 * τ), ⟨hge, hle⟩, ?_⟩ + rw [dist_self] + exact hδ₁ + · refine ⟨Real.pi / 2, ⟨by linarith, le_rfl⟩, ?_⟩ + rw [Real.dist_eq, abs_of_pos (by linarith)] + linarith + have hnotD : f_arc (-τ + s.1 * (2 * τ)) ∈ Dᶜ := hth_δ₁ hθ_mem + have heq : a s = f_arc (-τ + s.1 * (2 * τ)) := by + dsimp [a, f_arc] + rw [ha₀, ← Circle.exp_add] + exact hnotD (heq ▸ hxD) + let Nb : Set ℂ := Ω₀ ∩ {z : ℂ | z.re < 0} + have hNb_open : IsOpen Nb := hΩ₀.inter (isOpen_lt Complex.continuous_re continuous_const) + have hNb_bInt : Nb ⊆ bInt := fun z hz => + ⟨mem_ball_zero_iff.mpr hz.1.2, hz.2.trans_le (capH52_nonneg z.im)⟩ + have hNbS : IsOpen (g '' Nb) := c.isOpen_image_bInt hS hNb_open hNb_bInt + have hbN : range b ⊆ g '' Nb := by + rintro _ ⟨s, rfl⟩ + exact ⟨κ (b₀ s), ⟨hκΩ _, hb₀_neg s⟩, rfl⟩ + obtain ⟨ε₂, hε₂, hth₂⟩ := (isCompact_range hb.1).exists_thickening_subset_open hNbS hbN + obtain ⟨b', hb', hb'0, hb'1, hm', hrb, htame⟩ := + exists_tame_single_arc G hG ha hb (congrArg (fun w => g (κ w)) hab.3) + (congrArg (fun w => g (κ w)) hab.4) (fun s t he => hab.5 s t (hgκi he)) + (ha_disj_D.mono_right hGD) hε₂ + have hrb' : range b' ⊆ g '' Nb := hrb.trans hth₂ + set P : Set S := range a ∪ range b' with hPdef + have hPO : IsOArc P := oArc_of_two_arcs ha hb' hb'0.symm hb'1.symm hm' + have ha_bHalf : range a ⊆ g '' (Ω₀ ∩ bHalf) := by + rintro _ ⟨s, rfl⟩ + exact ⟨κ (a₀ s), ⟨hκΩ _, hκ_bHalf _⟩, rfl⟩ + have hb'_bHalf : range b' ⊆ g '' (Ω₀ ∩ bHalf) := + hrb'.trans (image_mono fun z hz => ⟨hz.1, bInt_subset_bHalf (hNb_bInt hz)⟩) + have hP_bHalf : P ⊆ g '' (Ω₀ ∩ bHalf) := union_subset ha_bHalf hb'_bHalf + have hPU : P ⊆ U := hP_bHalf.trans (image_subset_iff.mpr fun z hz => c.gm hz.2) + have hhP : ∀ x ∈ P, h x ∈ Ω₀ ∧ h x ∈ bHalf := fun x hx => by + obtain ⟨z, hz, rfl⟩ := hP_bHalf hx + rwa [c.hg hz.2] + have hQ : IsOArc (h '' P) := + hPO.image (c.hc.mono hPU) (c.gc.continuousOn.mono fun z hz => by + obtain ⟨x, hx, rfl⟩ := hz + exact (hhP x hx).2) (c.gh.mono hPU) + have hp0 : κ (a₀ 0) = (r : ℂ) * Complex.exp (-τ * Complex.I) := by + simp only [κ, ha₀, Set.Icc.coe_zero, zero_mul, ← Circle.exp_add, Circle.coe_exp] + congr 2; push_cast; ring + have hq0 : κ (a₀ 1) = (r : ℂ) * Complex.exp (τ * Complex.I) := by + simp only [κ, ha₀, Set.Icc.coe_one, one_mul, ← Circle.exp_add, Circle.coe_exp] + congr 2; push_cast; ring + have hlog : ¬ HasLogOn (h '' P) fun z => z := by + have hAc : IsPreconnected (h '' range a) := (isPreconnected_range ha.1).image _ + (c.hc.mono (subset_union_left.trans hPU)) + have hBc : IsPreconnected (h '' range b') := (isPreconnected_range hb'.1).image _ + (c.hc.mono (subset_union_right.trans hPU)) + have hp' : h (a 0) = (r : ℂ) * Complex.exp (-τ * Complex.I) := by + change h (g (κ (a₀ 0))) = _ + rw [c.hg (hκ_bHalf _), hp0] + have hq' : h (a 1) = (r : ℂ) * Complex.exp (τ * Complex.I) := by + change h (g (κ (a₀ 1))) = _ + rw [c.hg (hκ_bHalf _), hq0] + have := not_hasLogOn_of_two_sides hAc hBc (ρ := r) (τ := τ) ?_ ?_ hrpos ⟨hτ_pos, by linarith⟩ + hp' hq' ⟨_, ⟨0, rfl⟩, rfl⟩ ⟨_, ⟨1, rfl⟩, rfl⟩ ⟨_, ⟨0, rfl⟩, ?_⟩ ⟨_, ⟨1, rfl⟩, ?_⟩ + · rwa [hPdef, image_union] + · rintro _ ⟨_, ⟨s, rfl⟩, rfl⟩ + rw [c.hg (hκ_bHalf _)] + exact hslit _ (ha₀ne s) + · rintro _ ⟨x, hx, rfl⟩ + obtain ⟨z, hz, rfl⟩ := hrb' hx + rw [c.hg (bInt_subset_bHalf (hNb_bInt hz))] + exact Or.inl (neg_pos.mpr hz.2) + · rw [hb'0] + · rw [hb'1] + obtain ⟨hin, hsub3⟩ := closedBall_subset_inner hQ (Set.disjoint_left.mpr fun z hz hz' => by + obtain ⟨x, hx, rfl⟩ := hz + have h1 := (hhP x hx).1.1 + have h2 : ‖h x‖ ≤ 2 := mem_closedBall_zero_iff.mp hz' + linarith) (fun z hz => by + obtain ⟨x, hx, rfl⟩ := hz + exact mem_ball_zero_iff.mpr (hhP x hx).1.2) hlog + have hQ_bHalf : h '' P ⊆ bHalf := by + rintro _ ⟨x, hx, rfl⟩ + exact (hhP x hx).2 + have hcl_bHalf : closedInner (h '' P) ⊆ bHalf := closedInner_subset_bHalf hQ hQ_bHalf hsub3 + have hhalf_sub : {z : ℂ | ‖z‖ ≤ 5 / 2 ∧ 0 ≤ z.re} ⊆ closedInner (h '' P) := by + refine right_halfDisc_subset_closedInner hQ (A := h '' range a) (B := h '' range b') + (by rw [hPdef, image_union]) hin ?_ ?_ ?_ + · rintro z ⟨hz_norm, hz_re⟩ + obtain ⟨s, hs⟩ := right_semicircle_subset_arc hτ_gt.le hτ_pos hz_norm hz_re + refine ⟨a s, ⟨s, rfl⟩, ?_⟩ + change h (g (κ (a₀ s))) = z + rw [c.hg (hκ_bHalf _)] + simpa [κ, r, ha₀] using hs + · rintro _ ⟨_, ⟨s, rfl⟩, rfl⟩ + change h (g (κ (a₀ s))) ∈ sphere 0 (5 / 2) + rw [c.hg (hκ_bHalf _)] + exact hκ_sph _ + · rintro _ ⟨x, hx, rfl⟩ + obtain ⟨z, hz, rfl⟩ := hrb' hx + rw [c.hg (bInt_subset_bHalf (hNb_bInt hz))] + exact hz.2 + obtain ⟨hdQ, hdQb⟩ := isClosedDisc_closedInner hQ + obtain ⟨hE, hEb⟩ := c.image_disc hdQ hcl_bHalf + have hgP : g '' (h '' P) = P := by + rw [image_image] + exact (image_congr fun x hx => c.gh (hPU hx)).trans (image_id _) + rw [hdQb, hgP] at hEb + set E := g '' closedInner (h '' P) + refine ⟨P, E, hPO, htame, hE, hEb, ?_, image_mono hhalf_sub, image_mono hcl_bHalf, ?_⟩ + · refine image_mono fun z hz => Or.inl (hin hz.1) + · rintro x (⟨s, rfl⟩ | hxb') + · by_cases hre : 0 ≤ (κ (a₀ s)).re + · exact Or.inr ⟨κ (a₀ s), ⟨hκn _, hre⟩, rfl⟩ + · push Not at hre + exact Or.inl ⟨κ (a₀ s), ⟨(hκ_bHalf _).1, hre.trans_le (capH52_nonneg _)⟩, rfl⟩ + · exact Or.inl (hrb'.trans (image_mono hNb_bInt) hxb') + +/-- **Merging a closed disc `D` with a `BoundaryHalfChart`.** +Given a closed disc `D ⊆ Y` and a `BoundaryHalfChart U h g` with `g '' bHalf ⊆ Y`, +`g 0 ∈ discInt D`, and `Disjoint D (g '' {z ∈ bHalf | z.re = capH52 z.im})`, there is a closed +disc `D' ⊆ (Y \ bd S) ∪ D ∪ g '' {z : ℂ | ‖z‖ = 5 / 2 ∧ 0 ≤ z.re}` containing both `D` and +`g '' {z : ℂ | ‖z‖ ≤ 5 / 2 ∧ 0 ≤ z.re}`. -/ +theorem exists_boundary_disc_merge (hS : IsSurface S) [ConnectedSpace S] + (hns : ¬ IsSphere S) {Y : Set S} + (H : ∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) + {D : Set S} (hDY : D ⊆ Y) (hD : IsClosedDisc D) + {U : Set S} {h : S → ℂ} {g : ℂ → S} (c : BoundaryHalfChart U h g) + (hgY : g '' bHalf ⊆ Y) + (hg0 : g 0 ∈ discInt D) + (hD_disj : Disjoint D (g '' {z ∈ bHalf | z.re = capH52 z.im})) : + ∃ D' : Set S, D' ⊆ (Y \ bd S) ∪ D ∪ g '' {z : ℂ | ‖z‖ = 5 / 2 ∧ 0 ≤ z.re} ∧ + IsClosedDisc D' ∧ D ⊆ D' ∧ g '' {z : ℂ | ‖z‖ ≤ 5 / 2 ∧ 0 ≤ z.re} ⊆ D' := by + classical + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hman : ∀ x : S, IsManifoldPoint x := hS.2.2 + let Y_step : Set S := (Y \ bd S) ∪ D ∪ g '' {z : ℂ | ‖z‖ = 5 / 2 ∧ 0 ≤ z.re} + have hsemi_bHalf : {z : ℂ | ‖z‖ = 5 / 2 ∧ 0 ≤ z.re} ⊆ bHalf := fun z hz => + (capH52_of_mem_sphere (mem_sphere_zero_iff_norm.mpr hz.1)).2 + have hY_step_sub : Y_step ⊆ Y := + union_subset (union_subset sdiff_subset hDY) ((image_mono hsemi_bHalf).trans hgY) + have hH_step : ∀ F : Set S, F ⊆ Y_step → IsOArc F → + ∃ Δ : Set S, Δ ⊆ Y_step ∧ IsClosedDisc Δ ∧ discBd Δ = F := by + intro F hF hFO + obtain ⟨Δ, hΔY, hΔ, hΔb⟩ := H F (hF.trans hY_step_sub) hFO + refine ⟨Δ, fun x hx => ?_, hΔ, hΔb⟩ + by_cases hxb : x ∈ discBd Δ + · exact hF (hΔb ▸ hxb) + · exact Or.inl (Or.inl ⟨hΔY hx, fun hbd => hbd (isInteriorPoint_of_mem_discInt hman hΔ ⟨hx, + hxb⟩)⟩) + have hG := hD.isOArc_discBd + obtain ⟨φG⟩ := id hG + have hne : (φG 1).1 ≠ (φG (Circle.exp Real.pi)).1 := fun he => by + have h1 := φG.injective (Subtype.ext he) + have h2 := congrArg (fun w : Circle => (w : ℂ)) h1 + simp at h2 + norm_num at h2 + obtain ⟨α, β, hαβ, -, -, hr⟩ := hG.exists_arcs (φG 1).2 (φG _).2 hne + have hU2 : (⋃ g' ∈ [α, β], range g') = discBd D := by rw [← hr]; simp + obtain ⟨P, E, hPO, htame, hE, hEb, hclosedin, hhalf_E, hE_bHalf, hP_sub⟩ := + exists_boundary_tame_curve hS c hD.isClosed hD_disj [α, β] + (by simpa using ⟨hαβ.1, hαβ.2⟩) (hU2.trans_subset (discBd_subset D)) + have hbInt_Y : g '' bInt ⊆ Y \ bd S := by + rintro _ ⟨z, hz, rfl⟩ + refine ⟨hgY ⟨z, bInt_subset_bHalf hz, rfl⟩, fun hbd => ?_⟩ + exact hz.2.ne ((c.bd_iff z (bInt_subset_bHalf hz)).mp hbd) + have hPY_step : P ⊆ Y_step := by + rintro x hx + rcases hP_sub hx with hx1 | hx2 + · exact Or.inl (Or.inl (hbInt_Y hx1)) + · exact Or.inr hx2 + have hEY_step : E ⊆ Y_step := by + intro x hx + by_cases hxb : x ∈ discBd E + · exact hPY_step (hEb ▸ hxb) + · exact Or.inl (Or.inl ⟨hgY (hE_bHalf hx), + fun hbd => hbd (isInteriorPoint_of_mem_discInt hman hE ⟨hx, hxb⟩)⟩) + rw [hU2] at htame + have h0_in : (0 : ℂ) ∈ closedBall 0 2 ∩ bHalf := + ⟨mem_closedBall_zero_iff.mpr (by norm_num), mem_ball_zero_iff.mpr (by norm_num), + capH52_nonneg 0⟩ + have hzE : (discInt D ∩ E).Nonempty := ⟨g 0, hg0, hclosedin ⟨0, h0_in, rfl⟩⟩ + obtain ⟨D', hD'Y, hD', hDD', hED'⟩ := + exists_disc_cover_union hS hH_step (fun h => hns h.1) (fun _ hx => Or.inl (Or.inr hx)) + hD hEY_step hE hEb hPO htame hzE + exact ⟨D', hD'Y, hD', hDD', hhalf_E.trans hED'⟩ + +/-! ## 4. Collar Chart Data and Induction Over Boundary Charts -/ + +/-- Data of a single boundary collar chart. -/ +structure CollarChartData (S : Type u) [TopologicalSpace S] where + /-- The domain of the boundary chart. -/ + U : Set S + /-- Coordinate map to the complex plane. -/ + h : S → ℂ + /-- Inverse coordinate map on the chart image. -/ + g : ℂ → S + /-- The open neighborhood selected within the chart domain. -/ + W : Set S + /-- The boundary arc covered by the neighborhood. -/ + bdArc : Set S + +/-- Validity predicate for a `CollarChartData S` relative to `Y ⊆ S`. -/ +structure IsValidCollarChart (Y : Set S) (d : CollarChartData S) : Prop where + chart : BoundaryHalfChart d.U d.h d.g + g_sub_Y : d.g '' bHalf ⊆ Y + isOpen_W : IsOpen d.W + W_sub_half : d.W ⊆ d.g '' {z : ℂ | ‖z‖ ≤ 5 / 2 ∧ 0 ≤ z.re} + bd_sub_arc : d.g '' {z ∈ bHalf | z.re = capH52 z.im} ⊆ d.bdArc + arc_sub_bd : d.bdArc ⊆ bd S + +theorem closedBall_half_subset_bInt : closedBall (0 : ℂ) (1 / 2) ⊆ bInt := by + intro z hz + have hnorm : ‖z‖ ≤ 1 / 2 := mem_closedBall_zero_iff.mp hz + have hre : z.re ≤ 1 / 2 := (le_abs_self _).trans ((Complex.abs_re_le_norm z).trans hnorm) + have him : z.im ∈ Icc (-3 / 2 : ℝ) (3 / 2) := by + have h1 := (Complex.abs_im_le_norm z).trans hnorm + exact ⟨by linarith [(abs_le.mp h1).1], by linarith [(abs_le.mp h1).2]⟩ + have hcap : 2 ≤ capH52 z.im := two_le_capH52 him + exact ⟨mem_ball_zero_iff.mpr (by linarith), by linarith⟩ + +/-- Given a list `L` of valid collar charts with pairwise disjoint `bdArc`s and a closed disc +`D₀ ⊆ Y \ bd S` containing `d.g '' closedBall 0 (1 / 2)` for every `d ∈ L`, we can merge `D₀` +with all charts in `L` to obtain a closed disc `D' ⊆ Y` containing `D₀` and `d.W` for all `d ∈ L`. +-/ +theorem exists_disc_merging_collar_charts (hS : IsSurface S) [ConnectedSpace S] + (hns : ¬ IsSphere S) {Y : Set S} + (H : ∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) + (L : List (CollarChartData S)) + (hvalid : ∀ d ∈ L, IsValidCollarChart Y d) + (hpw : L.Pairwise (fun d1 d2 => Disjoint d1.bdArc d2.bdArc)) + {D₀ : Set S} (hD₀Y : D₀ ⊆ Y \ bd S) (hD₀ : IsClosedDisc D₀) + (hballs : ∀ d ∈ L, d.g '' closedBall 0 (1 / 2) ⊆ D₀) : + ∃ D' : Set S, D' ⊆ (Y \ bd S) ∪ ⋃ d ∈ L, d.bdArc ∧ D' ⊆ Y ∧ + IsClosedDisc D' ∧ D₀ ⊆ D' ∧ ∀ d ∈ L, d.W ⊆ D' := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + induction L with + | nil => + refine ⟨D₀, ?_, hD₀Y.trans sdiff_subset, hD₀, Subset.rfl, by simp⟩ + simp only [List.not_mem_nil, iUnion_of_empty, iUnion_empty, union_empty] + exact hD₀Y + | cons d rest ih => + obtain ⟨hd_rest, hpw_rest⟩ := List.pairwise_cons.mp hpw + have hd_val : IsValidCollarChart Y d := hvalid d List.mem_cons_self + obtain ⟨D₁, hD₁_bd, hD₁Y, hD₁, hD₀D₁, hrest_W⟩ := + ih (fun d' hd' => hvalid d' (List.mem_cons_of_mem d hd')) hpw_rest + (fun d' hd' => hballs d' (List.mem_cons_of_mem d hd')) + -- Show `d.g 0 ∈ discInt D₁`. + have hb_open : IsOpen (d.g '' ball 0 (1 / 2)) := + hd_val.chart.isOpen_image_bInt hS isOpen_ball + (ball_subset_closedBall.trans closedBall_half_subset_bInt) + have hb_int : ∀ x ∈ d.g '' ball 0 (1 / 2), IsInteriorPoint x := by + rintro _ ⟨z, hz, rfl⟩ + have hz_int := closedBall_half_subset_bInt (ball_subset_closedBall hz) + by_contra hnot + exact hz_int.2.ne ((hd_val.chart.bd_iff z (bInt_subset_bHalf hz_int)).mp hnot) + have hb_sub_D₁ : d.g '' ball 0 (1 / 2) ⊆ D₁ := + (image_mono ball_subset_closedBall).trans + ((hballs d List.mem_cons_self).trans hD₀D₁) + have hb_discInt : d.g '' ball 0 (1 / 2) ⊆ discInt D₁ := + subset_discInt_of_isOpen hb_int hb_open hb_sub_D₁ + have hg0_in : d.g 0 ∈ discInt D₁ := + hb_discInt ⟨0, mem_ball_zero_iff.mpr (by norm_num), rfl⟩ + -- Show `Disjoint D₁ (d.g '' {z ∈ bHalf | z.re = capH52 z.im})`. + have hD₁_disj : Disjoint D₁ (d.g '' {z ∈ bHalf | z.re = capH52 z.im}) := by + refine Disjoint.mono_right hd_val.bd_sub_arc (Set.disjoint_left.mpr fun x hxD₁ hxd => ?_) + rcases hD₁_bd hxD₁ with hx_int | hx_rest + · exact hx_int.2 (hd_val.arc_sub_bd hxd) + · obtain ⟨d', hd', hxd'⟩ := mem_iUnion₂.mp hx_rest + exact Set.disjoint_left.mp (hd_rest d' hd') hxd hxd' + obtain ⟨D', hD'_step, hD', hD₁D', hhalf_D'⟩ := + exists_boundary_disc_merge hS hns H hD₁Y hD₁ hd_val.chart hd_val.g_sub_Y hg0_in hD₁_disj + have hsemi_sub_arc : d.g '' {z : ℂ | ‖z‖ = 5 / 2 ∧ 0 ≤ z.re} ⊆ d.bdArc := by + refine (image_mono ?_).trans hd_val.bd_sub_arc + rintro z ⟨hz_norm, hz_re⟩ + have hsph : z ∈ sphere (0 : ℂ) (5 / 2) := mem_sphere_zero_iff_norm.mpr hz_norm + exact ⟨(capH52_of_mem_sphere hsph).2, (re_eq_capH52_iff_nonneg hsph).mpr hz_re⟩ + have hsemi_sub_Y : d.g '' {z : ℂ | ‖z‖ = 5 / 2 ∧ 0 ≤ z.re} ⊆ Y := by + refine (image_mono ?_).trans hd_val.g_sub_Y + rintro z ⟨hz_norm, _⟩ + exact (capH52_of_mem_sphere (mem_sphere_zero_iff_norm.mpr hz_norm)).2 + refine ⟨D', ?_, ?_, hD', hD₀D₁.trans hD₁D', ?_⟩ + · intro x hx + simp only [List.mem_cons, iUnion_iUnion_eq_or_left] + rcases hD'_step hx with (hx_int | hxD₁) | hx_semi + · exact Or.inl hx_int + · rcases hD₁_bd hxD₁ with hx_int | hx_rest + · exact Or.inl hx_int + · exact Or.inr (Or.inr hx_rest) + · exact Or.inr (Or.inl (hsemi_sub_arc hx_semi)) + · intro x hx + rcases hD'_step hx with (hx_int | hxD₁) | hx_semi + · exact hx_int.1 + · exact hD₁Y hxD₁ + · exact hsemi_sub_Y hx_semi + · intro d' hd' + rcases List.mem_cons.mp hd' with rfl | hd'_rest + · exact hd_val.W_sub_half.trans hhalf_D' + · exact (hrest_W d' hd'_rest).trans hD₁D' + +/-! ## 5. Constructing Collar Charts and Concluding `SolidFlatBoundarySurfacePlanarStatement` -/ + +/-- Clamped collar depth `max 0 (min 1 (-ε * x)) ∈ 𝕀`. -/ +noncomputable def tClamped (ε x : ℝ) : 𝕀 := + ⟨max 0 (min 1 (-ε * x)), le_max_left _ _, max_le zero_le_one (min_le_left _ _)⟩ + +@[simp] theorem coe_tClamped (ε x : ℝ) : (tClamped ε x : ℝ) = max 0 (min 1 (-ε * x)) := rfl + +theorem continuous_tClamped (ε : ℝ) : Continuous (tClamped ε) := by + unfold tClamped + refine Continuous.subtype_mk ?_ _ + fun_prop + +theorem tClamped_of_mem_Icc {ε x : ℝ} (hε : 0 < ε) (h6ε : 6 * ε < 1) (hx : x ∈ Icc (-6 : ℝ) 0) : + (tClamped ε x : ℝ) = -ε * x ∧ (tClamped ε x : ℝ) ∈ Icc 0 (6 * ε) := by + have h1 : 0 ≤ -ε * x := by nlinarith [hx.2] + have h2 : -ε * x ≤ 6 * ε := by nlinarith [hx.1] + have h3 : min 1 (-ε * x) = -ε * x := min_eq_right (by linarith) + have h4 : max 0 (-ε * x) = -ε * x := max_eq_right h1 + have heq : (tClamped ε x : ℝ) = -ε * x := by rw [coe_tClamped, h3, h4] + exact ⟨heq, heq ▸ h1, heq ▸ h2⟩ + +/-- Explicit collar chart map `g : ℂ → S` for an interval `[a, d]` along a collar `b`. -/ +noncomputable def collarG (b : Circle × 𝕀 → S) (a d δ ε : ℝ) (z : ℂ) : S := + b (Circle.exp (stretchTo a d δ (psiShift z).im), tClamped ε (psiShift z).re) + +theorem continuous_collarG {b : Circle × 𝕀 → S} (hbc : Continuous b) (a d δ ε : ℝ) : + Continuous (collarG b a d δ ε) := by + unfold collarG + refine hbc.comp (Continuous.prodMk ?_ ?_) + · refine Circle.exp.continuous.comp ?_ + have hc_stretch : Continuous (stretchTo a d δ) := by unfold stretchTo; fun_prop + exact hc_stretch.comp (Complex.continuous_im.comp psiShift.continuous) + · exact (continuous_tClamped ε).comp (Complex.continuous_re.comp psiShift.continuous) + +theorem stretchTo_mem_Icc_of_mem_Icc {a d δ x : ℝ} (had : a < d) (hδ : 0 < δ) + (hx : x ∈ Icc (-3 : ℝ) 3) : + stretchTo a d δ x ∈ Icc (a - 2 * δ) (d + 2 * δ) := by + have hmono := (stretchTo_strictMono had hδ).monotone + have hpts := stretchTo_eval_pts a d δ + exact ⟨hpts.1 ▸ hmono hx.1, hpts.2.2.2.2.2 ▸ hmono hx.2⟩ + +/-- The collar chart map has a continuous inverse on the larger closed rectangle. -/ +theorem exists_collar_chart_inverse [T2Space S] + {b : Circle × 𝕀 → S} (hbc : Continuous b) (hbi : Function.Injective b) + {a d δ₀ δ ε : ℝ} (ha : δ₀ ≤ a) (had : a < d) (hd : d ≤ 2 * Real.pi - δ₀) + (hδ : 0 < δ) (h2δ : 2 * δ < δ₀) (hε : 0 < ε) (h6ε : 6 * ε < 1) : + let K := psiShift.symm '' (Icc (-6 : ℝ) 0 ×ℂ Icc (-3 : ℝ) 3) + ∃ h : S → ℂ, ContinuousOn h (collarG b a d δ ε '' K) ∧ + LeftInvOn h (collarG b a d δ ε) K := by + let g := collarG b a d δ ε + let K_big : Set ℂ := psiShift.symm '' (Icc (-6 : ℝ) 0 ×ℂ Icc (-3 : ℝ) 3) + have hK_big : IsCompact K_big := + (isCompact_Icc.reProdIm isCompact_Icc).image psiShift.symm.continuous + have hinj : InjOn g K_big := by + rintro z₁ ⟨w₁, hw₁, rfl⟩ z₂ ⟨w₂, hw₂, rfl⟩ heq + have hprod := Prod.ext_iff.mp (hbi heq) + have h1 := hprod.1 + have h2 := congrArg Subtype.val hprod.2 + simp only [psiShift.apply_symm_apply] at h1 h2 + rw [(tClamped_of_mem_Icc hε h6ε hw₁.1).1, (tClamped_of_mem_Icc hε h6ε hw₂.1).1] at h2 + have hre : w₁.re = w₂.re := by nlinarith + have hm1 := stretchTo_mem_Icc_of_mem_Icc had hδ hw₁.2 + have hm2 := stretchTo_mem_Icc_of_mem_Icc had hδ hw₂.2 + have hIoc1 : stretchTo a d δ w₁.im ∈ Ioc 0 (2 * Real.pi) := + ⟨by linarith [hm1.1], by linarith [hm1.2]⟩ + have hIoc2 : stretchTo a d δ w₂.im ∈ Ioc 0 (2 * Real.pi) := + ⟨by linarith [hm2.1], by linarith [hm2.2]⟩ + have hst_eq : stretchTo a d δ w₁.im = stretchTo a d δ w₂.im := + Circle.exp_injOn_Ioc (a := 0) (b := 2 * Real.pi) (by linarith) hIoc1 hIoc2 h1 + have him : w₁.im = w₂.im := by + have := congrArg (unstretchFrom a d δ) hst_eq + rwa [unstretchFrom_stretchTo had hδ, unstretchFrom_stretchTo had hδ] at this + rw [Complex.ext hre him] + exact exists_inv_of_compact hK_big (continuous_collarG hbc a d δ ε) hinj + +/-- Construct a `CollarChartData S` from an isolated collar `b : Circle × 𝕀 → S` and interval +parameters `(a, d, δ₀, δ, ε)`. -/ +noncomputable def mkCollarChart [T2Space S] + {b : Circle × 𝕀 → S} (hbc : Continuous b) (hbi : Function.Injective b) + {a d δ₀ δ ε : ℝ} (_hδ₀ : 0 < δ₀) (ha : δ₀ ≤ a) (had : a < d) (hd : d ≤ 2 * Real.pi - δ₀) + (hδ : 0 < δ) (h2δ : 2 * δ < δ₀) (hε : 0 < ε) (h6ε : 6 * ε < 1) : + CollarChartData S := + let g := collarG b a d δ ε + let h := Classical.choose (exists_collar_chart_inverse hbc hbi ha had hd hδ h2δ hε h6ε) + { U := g '' bHalf + h := h + g := g + W := b '' ((Circle.exp '' Ioo a d) ×ˢ {t : 𝕀 | t.1 < ε}) + bdArc := b '' ((Circle.exp '' Icc (a - 2 * δ) (d + 2 * δ)) ×ˢ {0}) } + +theorem mkCollarChart_valid (hS : IsSurface S) {Y C : Set S} (hC_sub_bd : C ⊆ bd S) + {b : Circle × 𝕀 → S} (hbc : Continuous b) (hbi : Function.Injective b) + (hopen : IsOpen (range b \ b '' {x | x.2 = 1})) + (hbd_iff : ∀ w t, b (w, t) ∈ bd S ↔ t = 0) + (hbC : ∀ w, b (w, 0) ∈ C) + {a d δ₀ δ ε : ℝ} (hδ₀ : 0 < δ₀) (ha : δ₀ ≤ a) (had : a < d) (hd : d ≤ 2 * Real.pi - δ₀) + (hδ : 0 < δ) (h2δ : 2 * δ < δ₀) (hε : 0 < ε) (h6ε : 6 * ε < 1) + (hbY : ∀ θ ∈ Icc (a - 2 * δ) (d + 2 * δ), ∀ t : 𝕀, t.1 ≤ 6 * ε → b (Circle.exp θ, t) ∈ Y) : + let ch := @mkCollarChart S _ hS.2.1 b hbc hbi a d δ₀ δ ε hδ₀ ha had hd hδ h2δ hε h6ε + IsValidCollarChart Y ch ∧ + ch.bdArc = b '' ((Circle.exp '' Icc (a - 2 * δ) (d + 2 * δ)) ×ˢ {0}) ∧ + ch.bdArc ⊆ C ∧ + (∀ θ ∈ Ioo a d, b (Circle.exp θ, 0) ∈ ch.W) := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + set ch := @mkCollarChart S _ hS.2.1 b hbc hbi a d δ₀ δ ε hδ₀ ha had hd hδ h2δ hε h6ε + let g := collarG b a d δ ε + let K_big : Set ℂ := psiShift.symm '' (Icc (-6 : ℝ) 0 ×ℂ Icc (-3 : ℝ) 3) + have hspec := Classical.choose_spec + (exists_collar_chart_inverse hbc hbi ha had hd hδ h2δ hε h6ε) + have hbHalf_K : bHalf ⊆ K_big := by + intro z hz + obtain ⟨hre, him⟩ := psiShift_ball3_bounds hz.1 hz.2 + exact ⟨psiShift z, ⟨hre, ⟨him.1.le, him.2.le⟩⟩, psiShift.symm_apply_apply z⟩ + have hch_h : ch.h = Classical.choose + (exists_collar_chart_inverse hbc hbi ha had hd hδ h2δ hε h6ε) := rfl + have hch_g : ch.g = g := rfl + have hchart : BoundaryHalfChart ch.U ch.h ch.g := by + refine ⟨hspec.1.mono (image_mono hbHalf_K), continuous_collarG hbc a d δ ε, + ?_, mapsTo_image g bHalf, ?_, hspec.2.mono hbHalf_K, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + rw [hch_h, hspec.2 (hbHalf_K hz)] + exact hz + · rintro _ ⟨z, hz, rfl⟩ + rw [hch_h, hch_g, hspec.2 (hbHalf_K hz)] + · intro z hz + obtain ⟨hre, _⟩ := psiShift_ball3_bounds hz.1 hz.2 + rw [show ch.g z = collarG b a d δ ε z from rfl, collarG, hbd_iff, Subtype.ext_iff, + (tClamped_of_mem_Icc hε h6ε hre).1, Icc.coe_zero] + constructor + · intro h0 + have : (psiShift z).re = 0 := by nlinarith + rw [psiShift_re] at this + linarith + · intro h0 + have : (psiShift z).re = 0 := by rw [psiShift_re]; linarith + rw [this, mul_zero] + have hgY : ch.g '' bHalf ⊆ Y := by + rintro _ ⟨z, hz, rfl⟩ + obtain ⟨hre, him⟩ := psiShift_ball3_bounds hz.1 hz.2 + exact hbY _ (stretchTo_mem_Icc_of_mem_Icc had hδ ⟨him.1.le, him.2.le⟩) + _ (tClamped_of_mem_Icc hε h6ε hre).2.2 + have hW_open : IsOpen ch.W := by + refine isOpen_image_of_collar hbc hbi hopen ?_ ?_ + · exact (isLocalHomeomorph_circleExp.isOpenMap _ isOpen_Ioo).prod + (isOpen_lt continuous_subtype_val continuous_const) + · rintro ⟨_, t⟩ ⟨_, ht⟩ + exact Subtype.mk_lt_mk.mpr (ht.trans (by linarith)) + have hW_half : ch.W ⊆ ch.g '' {z : ℂ | ‖z‖ ≤ 5 / 2 ∧ 0 ≤ z.re} := by + rintro _ ⟨⟨_, t⟩, ⟨⟨θ, hθ, rfl⟩, ht : t.1 < ε⟩, rfl⟩ + let w : ℂ := ⟨-(t.1 / ε), unstretchFrom a d δ θ⟩ + let z : ℂ := psiShift.symm w + have hw_re : w.re ∈ Icc (-2 : ℝ) 0 := by + have h1 : t.1 / ε ≤ 1 := (div_le_one hε).mpr ht.le + have h2 : 0 ≤ t.1 / ε := div_nonneg t.2.1 hε.le + exact ⟨by dsimp [w]; linarith, by dsimp [w]; linarith⟩ + have hw_im : w.im ∈ Icc (-3 / 2 : ℝ) (3 / 2) := by + dsimp [w] + rw [unstretchFrom_of_mem_Icc ⟨hθ.1.le, hθ.2.le⟩] + have hpos : 0 < (d - a) / 2 := by linarith + have h1 : -1 ≤ (θ - (a + d) / 2) / ((d - a) / 2) := by + rw [le_div_iff₀ hpos]; linarith [hθ.1] + have h2 : (θ - (a + d) / 2) / ((d - a) / 2) ≤ 1 := by + rw [div_le_iff₀ hpos]; linarith [hθ.2] + exact ⟨by linarith, by linarith⟩ + refine ⟨z, psiShift_symm_mem_closedBall hw_re hw_im, ?_⟩ + change b (Circle.exp (stretchTo a d δ (psiShift z).im), tClamped ε (psiShift z).re) = + b (Circle.exp θ, t) + rw [psiShift.apply_symm_apply] + have hst : stretchTo a d δ w.im = θ := stretchTo_unstretchFrom had hδ θ + have htc : tClamped ε w.re = t := by + ext + dsimp [w] + have hmul : -ε * -(t.1 / ε) = t.1 := by field_simp + rw [hmul, min_eq_right t.2.2, max_eq_right t.2.1] + rw [hst, htc] + have hbd_arc : ch.g '' {z ∈ bHalf | z.re = capH52 z.im} ⊆ ch.bdArc := by + rintro _ ⟨z, ⟨hz, hre_eq⟩, rfl⟩ + obtain ⟨_, him⟩ := psiShift_ball3_bounds hz.1 hz.2 + have hre0 : (psiShift z).re = 0 := by rw [psiShift_re, hre_eq, sub_self] + have htc0 : tClamped ε (psiShift z).re = 0 := by + rw [hre0] + ext + simp [tClamped] + refine ⟨(Circle.exp (stretchTo a d δ (psiShift z).im), 0), ⟨⟨_, ?_, rfl⟩, rfl⟩, ?_⟩ + · exact stretchTo_mem_Icc_of_mem_Icc had hδ ⟨him.1.le, him.2.le⟩ + · change b (Circle.exp (stretchTo a d δ (psiShift z).im), 0) = + b (Circle.exp (stretchTo a d δ (psiShift z).im), tClamped ε (psiShift z).re) + rw [htc0] + have harc_C : ch.bdArc ⊆ C := by + rintro _ ⟨⟨w, t⟩, ⟨_, ht : t = 0⟩, rfl⟩ + rw [ht] + exact hbC w + refine ⟨⟨hchart, hgY, hW_open, hW_half, hbd_arc, harc_C.trans hC_sub_bd⟩, rfl, harc_C, ?_⟩ + intro θ hθ + exact ⟨(Circle.exp θ, 0), ⟨⟨θ, hθ, rfl⟩, hε⟩, rfl⟩ + +theorem isCompact_unionIcc (L : List (ℝ × ℝ)) : IsCompact (unionIcc L) := by + induction L with + | nil => exact isCompact_empty + | cons p rest ih => exact isCompact_Icc.union ih + +private theorem exists_finite_angular_neighborhoods + {K_θ target : Set ℝ} (hK_θ : IsCompact K_θ) {δ₀ η r₁ : ℝ} + (hK_sub : K_θ ⊆ Icc (2 * δ₀) (2 * Real.pi - 2 * δ₀)) + (hη_pos : 0 < η) (hη_δ₀ : η ≤ δ₀ / 2) (hη_r₁ : η < r₁) + (hr₁_sub : Metric.thickening r₁ K_θ ⊆ target) : + ∃ L_raw : List (ℝ × ℝ), (∀ p ∈ L_raw, p.1 < p.2) ∧ + (∀ p ∈ L_raw, δ₀ ≤ p.1 ∧ p.2 ≤ 2 * Real.pi - δ₀) ∧ + K_θ ⊆ unionIoo L_raw ∧ unionIcc L_raw ⊆ target := by + obtain ⟨s, hs_cov⟩ := hK_θ.elim_finite_subcover + (fun θ : K_θ => Ioo (θ.1 - η) (θ.1 + η)) (fun _ => isOpen_Ioo) + (fun θ hθ => mem_iUnion.mpr ⟨⟨θ, hθ⟩, by linarith, by linarith⟩) + let L_raw : List (ℝ × ℝ) := s.toList.map (fun θ : K_θ => (θ.1 - η, θ.1 + η)) + have hL_lt : ∀ p ∈ L_raw, p.1 < p.2 := by + rintro p hp + obtain ⟨θ, _, rfl⟩ := List.mem_map.mp hp + linarith + have hL_cd : ∀ p ∈ L_raw, δ₀ ≤ p.1 ∧ p.2 ≤ 2 * Real.pi - δ₀ := by + rintro p hp + obtain ⟨θ, _, rfl⟩ := List.mem_map.mp hp + exact ⟨by linarith [(hK_sub θ.2).1], by linarith [(hK_sub θ.2).2]⟩ + have hK_cov : K_θ ⊆ unionIoo L_raw := by + intro x hx + obtain ⟨θ, hθs, hx_Ioo⟩ := mem_iUnion₂.mp (hs_cov hx) + refine mem_unionIoo.mpr ⟨(θ.1 - η, θ.1 + η), ?_, hx_Ioo⟩ + exact List.mem_map.mpr ⟨θ, Finset.mem_toList.mpr hθs, rfl⟩ + have hL_Y : unionIcc L_raw ⊆ target := by + intro x hx + obtain ⟨p, hp, hxp⟩ := mem_unionIcc.mp hx + obtain ⟨θ, _, rfl⟩ := List.mem_map.mp hp + refine hr₁_sub (Metric.mem_thickening_iff.mpr ⟨θ.1, θ.2, ?_⟩) + rw [Real.dist_eq] + have hx_ge : θ.1 - η ≤ x := hxp.1 + have hx_le : x ≤ θ.1 + η := hxp.2 + exact (abs_le.mpr ⟨by linarith, by linarith⟩).trans_lt hη_r₁ + exact ⟨L_raw, hL_lt, hL_cd, hK_cov, hL_Y⟩ + +/-- For a single cuff `C ∈ cuffs S` with `¬ C ⊆ Y`, construct a finite list `L` of valid collar +charts along `C` with pairwise disjoint `bdArc ⊆ C` whose open sets `d.W` cover `Z ∩ C`. -/ +theorem exists_collar_charts_for_cuff (hS : IsSurface S) {Z Y C : Set S} + (hZ : IsCompact Z) (hYo : IsOpen Y) (hZY : Z ⊆ Y) (hC : IsCuff C) (hnotCY : ¬ C ⊆ Y) : + ∃ L : List (CollarChartData S), + (∀ d ∈ L, IsValidCollarChart Y d ∧ d.bdArc ⊆ C) ∧ + L.Pairwise (fun d1 d2 => Disjoint d1.bdArc d2.bdArc) ∧ + Z ∩ C ⊆ ⋃ d ∈ L, d.W := by + classical + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + obtain ⟨y_miss, hy_miss, hy_notY⟩ := Set.not_subset.mp hnotCY + have hy_notZ : y_miss ∉ Z := fun h => hy_notY (hZY h) + have hCO : IsOArc C := (cuff_statement.{u} S hS).2.2 C hC + obtain ⟨φ₀⟩ := id hCO + let u_miss : Circle := φ₀.symm ⟨y_miss, hy_miss⟩ + let φ : Circle ≃ₜ C := (Homeomorph.mulRight u_miss).trans φ₀ + have hφ1 : (φ 1).1 = y_miss := by + change (φ₀ (1 * u_miss)).1 = y_miss + rw [one_mul, Homeomorph.apply_symm_apply] + obtain ⟨b, hbc, hbi, _, hb0, hopen, hbd_iff⟩ := + exists_isolated_collar hS hC φ isOpen_univ (subset_univ _) + have hbC : ∀ w, b (w, 0) ∈ C := fun w => by rw [hb0]; exact (φ w).2 + have hC_sub_bd : C ⊆ bd S := by + obtain ⟨x, hx, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + let f₀ : ℝ → S := fun θ => b (Circle.exp θ, 0) + have hf₀c : Continuous f₀ := hbc.comp (Circle.exp.continuous.prodMk continuous_const) + have hf₀_0 : f₀ 0 ∉ Z := by + change b (Circle.exp 0, 0) ∉ Z + rw [Circle.exp_zero, hb0, hφ1] + exact hy_notZ + have hf₀_2pi : f₀ (2 * Real.pi) ∉ Z := by + change b (Circle.exp (2 * Real.pi), 0) ∉ Z + rw [Circle.exp_two_pi, hb0, hφ1] + exact hy_notZ + have hnotZ_open : IsOpen (f₀ ⁻¹' Zᶜ) := hZ.isClosed.isOpen_compl.preimage hf₀c + obtain ⟨r₀, hr₀_pos, hr₀_sub⟩ := Metric.isOpen_iff.mp hnotZ_open 0 hf₀_0 + obtain ⟨r₂, hr₂_pos, hr₂_sub⟩ := Metric.isOpen_iff.mp hnotZ_open (2 * Real.pi) hf₀_2pi + let δ₀ : ℝ := min (1 / 2) (min (r₀ / 3) (r₂ / 3)) + have hδ₀_pos : 0 < δ₀ := lt_min (by norm_num) (lt_min (by positivity) (by positivity)) + have hδ₀_r₀ : 2 * δ₀ < r₀ := by + have : δ₀ ≤ r₀ / 3 := (min_le_right _ _).trans (min_le_left _ _) + linarith + have hδ₀_r₂ : 2 * δ₀ < r₂ := by + have : δ₀ ≤ r₂ / 3 := (min_le_right _ _).trans (min_le_right _ _) + linarith + let K_θ : Set ℝ := Icc (2 * δ₀) (2 * Real.pi - 2 * δ₀) ∩ f₀ ⁻¹' Z + have hK_θ : IsCompact K_θ := isCompact_Icc.inter_right (hZ.isClosed.preimage hf₀c) + have hU_θ : IsOpen (f₀ ⁻¹' Y) := hYo.preimage hf₀c + have hKU : K_θ ⊆ f₀ ⁻¹' Y := fun θ hθ => hZY hθ.2 + obtain ⟨r₁, hr₁_pos, hr₁_sub⟩ := hK_θ.exists_thickening_subset_open hU_θ hKU + let η : ℝ := min (δ₀ / 2) (r₁ / 2) + have hη_pos : 0 < η := lt_min (by positivity) (by positivity) + have hη_δ₀ : η ≤ δ₀ / 2 := min_le_left _ _ + have hη_r₁ : η < r₁ := (min_le_right _ _).trans_lt (half_lt_self hr₁_pos) + obtain ⟨L_raw, hL_lt, hL_cd, hK_cov, hL_Y⟩ := + exists_finite_angular_neighborhoods hK_θ inter_subset_left hη_pos hη_δ₀ hη_r₁ hr₁_sub + let L_merged : List (ℝ × ℝ) := mergeList L_raw + obtain ⟨hm_bounds, hm_pw, hm_Ioo, hm_Icc⟩ := + mergeList_properties L_raw hL_lt δ₀ (2 * Real.pi - δ₀) hL_cd + obtain ⟨δ₁, hδ₁_pos, h2δ₁_lt, hm_gap⟩ := exists_min_gap L_merged hδ₀_pos hm_pw + let F_collar : ℝ × 𝕀 → S := fun x => b (Circle.exp x.1, x.2) + have hF_cont : Continuous F_collar := + hbc.comp ((Circle.exp.continuous.comp continuous_fst).prodMk continuous_snd) + have hK_box : IsCompact (unionIcc L_merged ×ˢ {(0 : 𝕀)}) := + (isCompact_unionIcc L_merged).prod isCompact_singleton + have hK_box_sub : unionIcc L_merged ×ˢ {(0 : 𝕀)} ⊆ F_collar ⁻¹' Y := by + rintro ⟨θ, t⟩ ⟨hθ, ht : t = 0⟩ + rw [ht] + exact hL_Y (hm_Icc hθ) + obtain ⟨r_box, hr_box_pos, hr_box_sub⟩ := + hK_box.exists_thickening_subset_open (hYo.preimage hF_cont) hK_box_sub + let δ : ℝ := min δ₁ (r_box / 3) + have hδ_pos : 0 < δ := lt_min hδ₁_pos (by positivity) + have hδ_le_δ₁ : δ ≤ δ₁ := min_le_left _ _ + have h2δ_lt_δ₀ : 2 * δ < δ₀ := by linarith + have h2δ_lt_r : 2 * δ < r_box := by + have : δ ≤ r_box / 3 := min_le_right _ _ + linarith + let ε : ℝ := min (1 / 7) (r_box / 7) + have hε_pos : 0 < ε := lt_min (by norm_num) (by positivity) + have h6ε_lt_1 : 6 * ε < 1 := by + have : ε ≤ 1 / 7 := min_le_left _ _ + linarith + have h6ε_lt_r : 6 * ε < r_box := by + have : ε ≤ r_box / 7 := min_le_right _ _ + linarith + have hbY_all : ∀ p ∈ L_merged, ∀ θ ∈ Icc (p.1 - 2 * δ) (p.2 + 2 * δ), + ∀ t : 𝕀, t.1 ≤ 6 * ε → b (Circle.exp θ, t) ∈ Y := by + intro p hp θ hθ t ht + have hp_lt := (hm_bounds p hp).1 + let θ₀ : ℝ := max p.1 (min p.2 θ) + have hθ₀_Icc : θ₀ ∈ Icc p.1 p.2 := + ⟨le_max_left _ _, max_le hp_lt.le (min_le_left _ _)⟩ + have hθ₀_mem : (θ₀, (0 : 𝕀)) ∈ unionIcc L_merged ×ˢ {(0 : 𝕀)} := + ⟨mem_unionIcc.mpr ⟨p, hp, hθ₀_Icc⟩, rfl⟩ + have hmem_pre : (θ, t) ∈ F_collar ⁻¹' Y := by + refine hr_box_sub (Metric.mem_thickening_iff.mpr ⟨(θ₀, 0), hθ₀_mem, ?_⟩) + rw [Prod.dist_eq, max_lt_iff] + refine ⟨?_, ?_⟩ + · rw [Real.dist_eq] + refine (abs_le.mpr ?_).trans_lt h2δ_lt_r + constructor + · rcases le_total θ p.2 with h1 | h1 + · simp only [θ₀, min_eq_right h1] + rcases le_total p.1 θ with h2 | h2 + · simp [max_eq_right h2]; linarith + · simp [max_eq_left h2]; linarith [hθ.1] + · simp only [θ₀, min_eq_left h1, max_eq_right hp_lt.le] + linarith [hθ.1, hp_lt] + · rcases le_total θ p.2 with h1 | h1 + · simp only [θ₀, min_eq_right h1] + rcases le_total p.1 θ with h2 | h2 + · simp [max_eq_right h2]; linarith + · simp [max_eq_left h2]; linarith [hθ.1] + · simp only [θ₀, min_eq_left h1, max_eq_right hp_lt.le] + linarith [hθ.2] + · rw [Subtype.dist_eq, Icc.coe_zero, Real.dist_eq, sub_zero, abs_of_nonneg t.2.1] + exact ht.trans_lt h6ε_lt_r + exact hmem_pre + let mkP : {p : ℝ × ℝ // p ∈ L_merged} → CollarChartData S := fun ⟨p, hp⟩ => + @mkCollarChart S _ hS.2.1 b hbc hbi p.1 p.2 δ₀ δ ε + hδ₀_pos (hm_bounds p hp).2.1 (hm_bounds p hp).1 (hm_bounds p hp).2.2 + hδ_pos h2δ_lt_δ₀ hε_pos h6ε_lt_1 + let L : List (CollarChartData S) := L_merged.attach.map mkP + refine ⟨L, ?_, ?_, ?_⟩ + · intro d hd + obtain ⟨⟨p, hp⟩, _, rfl⟩ := List.mem_map.mp hd + have hval := mkCollarChart_valid hS hC_sub_bd hbc hbi hopen hbd_iff hbC + hδ₀_pos (hm_bounds p hp).2.1 (hm_bounds p hp).1 (hm_bounds p hp).2.2 + hδ_pos h2δ_lt_δ₀ hε_pos h6ε_lt_1 (hbY_all p hp) + exact ⟨hval.1, hval.2.2.1⟩ + · rw [List.pairwise_map] + rw [List.pairwise_iff_getElem] at hm_gap ⊢ + intro i j hi hj hij + simp only [List.length_attach] at hi hj + simp only [List.getElem_attach] + set p := L_merged[i] + set q := L_merged[j] + have hp : p ∈ L_merged := List.getElem_mem hi + have hq : q ∈ L_merged := List.getElem_mem hj + have hgap := hm_gap i j hi hj hij + have hval_p := mkCollarChart_valid hS hC_sub_bd hbc hbi hopen hbd_iff hbC + hδ₀_pos (hm_bounds p hp).2.1 (hm_bounds p hp).1 (hm_bounds p hp).2.2 + hδ_pos h2δ_lt_δ₀ hε_pos h6ε_lt_1 (hbY_all p hp) + have hval_q := mkCollarChart_valid hS hC_sub_bd hbc hbi hopen hbd_iff hbC + hδ₀_pos (hm_bounds q hq).2.1 (hm_bounds q hq).1 (hm_bounds q hq).2.2 + hδ_pos h2δ_lt_δ₀ hε_pos h6ε_lt_1 (hbY_all q hq) + rw [Set.disjoint_left] + intro x hxp hxq + rw [hval_p.2.1] at hxp + rw [hval_q.2.1] at hxq + obtain ⟨⟨_, t₁⟩, ⟨⟨θ₁, hθ₁, rfl⟩, ht₁ : t₁ = 0⟩, rfl⟩ := hxp + obtain ⟨⟨_, t₂⟩, ⟨⟨θ₂, hθ₂, rfl⟩, ht₂ : t₂ = 0⟩, heq⟩ := hxq + have hexp : Circle.exp θ₁ = Circle.exp θ₂ := (Prod.ext_iff.mp (hbi heq)).1.symm + have hbp := hm_bounds p hp + have hbq := hm_bounds q hq + have hIoc1 : θ₁ ∈ Ioc 0 (2 * Real.pi) := + ⟨by linarith [hθ₁.1, hbp.2.1], by linarith [hθ₁.2, hbp.2.2]⟩ + have hIoc2 : θ₂ ∈ Ioc 0 (2 * Real.pi) := + ⟨by linarith [hθ₂.1, hbq.2.1], by linarith [hθ₂.2, hbq.2.2]⟩ + have hθ_eq : θ₁ = θ₂ := + Circle.exp_injOn_Ioc (a := 0) (b := 2 * Real.pi) (by linarith) hIoc1 hIoc2 hexp + rcases hgap with hlt | hlt <;> linarith [hθ₁.1, hθ₁.2, hθ₂.1, hθ₂.2] + · rintro x ⟨hxZ, hxC⟩ + let w : Circle := φ.symm ⟨x, hxC⟩ + have hbw : b (w, 0) = x := by + rw [hb0] + exact congrArg Subtype.val (φ.apply_symm_apply ⟨x, hxC⟩) + obtain ⟨θ, hθ_Ioc, hθ_exp⟩ := exists_circle_angle 1 w + rw [one_mul] at hθ_exp + have hf₀_θ : f₀ θ = x := by + change b (Circle.exp θ, 0) = x + rw [← hθ_exp, hbw] + have hθ_ge : 2 * δ₀ ≤ θ := by + by_contra hlt + have hmem : θ ∈ Metric.ball 0 r₀ := by + rw [Metric.mem_ball, Real.dist_eq, sub_zero, abs_of_nonneg hθ_Ioc.1] + linarith + exact hr₀_sub hmem (by show f₀ θ ∈ Z; rwa [hf₀_θ]) + have hθ_le : θ ≤ 2 * Real.pi - 2 * δ₀ := by + by_contra hgt + have hmem : θ ∈ Metric.ball (2 * Real.pi) r₂ := by + rw [Metric.mem_ball, Real.dist_eq, abs_sub_lt_iff] + exact ⟨by linarith [hθ_Ioc.2], by linarith⟩ + exact hr₂_sub hmem (by show f₀ θ ∈ Z; rwa [hf₀_θ]) + have hθ_K : θ ∈ K_θ := ⟨⟨hθ_ge, hθ_le⟩, by change f₀ θ ∈ Z; rwa [hf₀_θ]⟩ + obtain ⟨p, hp, hθ_p⟩ := mem_unionIoo.mp (hm_Ioo (hK_cov hθ_K)) + have hval_p := mkCollarChart_valid hS hC_sub_bd hbc hbi hopen hbd_iff hbC + hδ₀_pos (hm_bounds p hp).2.1 (hm_bounds p hp).1 (hm_bounds p hp).2.2 + hδ_pos h2δ_lt_δ₀ hε_pos h6ε_lt_1 (hbY_all p hp) + refine mem_iUnion₂.mpr ⟨mkP ⟨p, hp⟩, List.mem_map.mpr ⟨⟨p, hp⟩, List.mem_attach _ _, rfl⟩, ?_⟩ + rw [← hf₀_θ] + exact hval_p.2.2.2 θ hθ_p + +/-- Combine collar chart lists over a nodup list of cuffs `cs`. -/ +theorem exists_combined_collar_charts (hS : IsSurface S) {Z Y : Set S} + (hZ : IsCompact Z) (hYo : IsOpen Y) (hZY : Z ⊆ Y) + (cs : List {C : Set S // C ∈ cuffs S}) (hnodup : cs.Nodup) + (hnotCY : ∀ c ∈ cs, ¬ c.1 ⊆ Y) : + ∃ L_all : List (CollarChartData S), + (∀ d ∈ L_all, IsValidCollarChart Y d ∧ ∃ c ∈ cs, d.bdArc ⊆ c.1) ∧ + L_all.Pairwise (fun d1 d2 => Disjoint d1.bdArc d2.bdArc) ∧ + ∀ c ∈ cs, Z ∩ c.1 ⊆ ⋃ d ∈ L_all, d.W := by + induction cs with + | nil => + exact ⟨[], by simp, List.Pairwise.nil, by simp⟩ + | cons c rest ih => + obtain ⟨hc_notMem, hnodup_rest⟩ := List.nodup_cons.mp hnodup + obtain ⟨L_rest, hrest_val, hrest_pw, hrest_cov⟩ := + ih hnodup_rest (fun c' hc' => hnotCY c' (List.mem_cons_of_mem c hc')) + obtain ⟨L_c, hc_val, hc_pw, hc_cov⟩ := + exists_collar_charts_for_cuff hS hZ hYo hZY c.2 (hnotCY c List.mem_cons_self) + refine ⟨L_c ++ L_rest, ?_, ?_, ?_⟩ + · intro d hd + rcases List.mem_append.mp hd with hdc | hdr + · obtain ⟨h1, h2⟩ := hc_val d hdc + exact ⟨h1, c, List.mem_cons_self, h2⟩ + · obtain ⟨h1, c', hc', h2⟩ := hrest_val d hdr + exact ⟨h1, c', List.mem_cons_of_mem c hc', h2⟩ + · refine List.pairwise_append.mpr ⟨hc_pw, hrest_pw, ?_⟩ + intro d₁ hd₁ d₂ hd₂ + have hd₁_sub : d₁.bdArc ⊆ c.1 := (hc_val d₁ hd₁).2 + obtain ⟨_, c', hc', hd₂_sub⟩ := hrest_val d₂ hd₂ + refine Disjoint.mono hd₁_sub hd₂_sub (Set.disjoint_left.mpr fun x hxc hxc' => ?_) + obtain ⟨y₁, _, hEq₁⟩ := c.2 + obtain ⟨y₂, _, hEq₂⟩ := c'.2 + have hx₁ : x ∈ connectedComponentIn (bd S) y₁ := by rwa [hEq₁] + have hx₂ : x ∈ connectedComponentIn (bd S) y₂ := by rwa [hEq₂] + have h1 : connectedComponentIn (bd S) x = c.1 := + (connectedComponentIn_eq hx₁).symm.trans hEq₁ + have h2 : connectedComponentIn (bd S) x = c'.1 := + (connectedComponentIn_eq hx₂).symm.trans hEq₂ + exact hc_notMem (Subtype.ext (h1.symm.trans h2) ▸ hc') + · intro c' hc' + rcases List.mem_cons.mp hc' with rfl | hc'_rest + · refine hc_cov.trans (iUnion₂_mono' fun d hd => ⟨d, List.mem_append_left _ hd, Subset.rfl⟩) + · refine (hrest_cov c' hc'_rest).trans + (iUnion₂_mono' fun d hd => ⟨d, List.mem_append_right _ hd, Subset.rfl⟩) + +/-- **Core theorem for `SolidFlatBoundarySurfacePlanarStatement`:** +In a connected surface `S` with `bd S ≠ ∅`, if `Z ⊆ Y ⊆ S` with `Z` closed, `Y` open and +preconnected, and every `O`-arc `F ⊆ Y` bounding a closed disc `Δ ⊆ Y`, then `IsPlanar Z`. -/ +theorem solidFlat_boundarySurface_planar_core (hS : IsSurface S) [ConnectedSpace S] + (hbd : bd S ≠ ∅) {Z Y : Set S} (hZc : IsClosed Z) (hZY : Z ⊆ Y) + (hYo : IsOpen Y) (hYp : IsPreconnected Y) + (H : ∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) : + IsPlanar Z := by + classical + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + rcases Y.eq_empty_or_nonempty with rfl | hYne + · have hZ_empty : Z = ∅ := eq_empty_of_subset hZY rfl + obtain ⟨x₀⟩ := ‹ConnectedSpace S›.toNonempty + obtain ⟨D₀, _, hD₀⟩ := exists_initial_disc_interior hS isOpen_univ ⟨x₀, mem_univ x₀⟩ + exact ⟨D₀, hD₀, hZ_empty ▸ empty_subset _⟩ + · by_cases hcuff : ∃ C ∈ cuffs S, C ⊆ Y + · obtain ⟨C, hC, hCY⟩ := hcuff + exact isPlanar_of_cuff_subset hS hZY H hC hCY + · push Not at hcuff + have hns : ¬ IsSphere S := not_isSphere_of_bd_ne_empty hbd + have hfin : (cuffs S).Finite := (cuff_statement.{u} S hS).2.1 + let cs : List {C : Set S // C ∈ cuffs S} := + hfin.toFinset.attach.toList.map (fun ⟨C, hC⟩ => ⟨C, hfin.mem_toFinset.mp hC⟩) + have hcs_nodup : cs.Nodup := by + refine (Finset.nodup_toList _).map ?_ + rintro ⟨C₁, _⟩ ⟨C₂, _⟩ heq + exact Subtype.ext (Subtype.mk.inj heq) + have hcs_mem : ∀ C (hC : C ∈ cuffs S), (⟨C, hC⟩ : {C : Set S // C ∈ cuffs S}) ∈ cs := by + intro C hC + refine List.mem_map.mpr ⟨⟨C, hfin.mem_toFinset.mpr hC⟩, ?_, rfl⟩ + exact Finset.mem_toList.mpr (Finset.mem_attach _ _) + obtain ⟨L_all, hL_val, hL_pw, hL_cov⟩ := + exists_combined_collar_charts hS hZc.isCompact hYo hZY cs hcs_nodup + (fun c _ => hcuff c.1 c.2) + have hvalid : ∀ d ∈ L_all, IsValidCollarChart Y d := fun d hd => (hL_val d hd).1 + let W_union : Set S := ⋃ d ∈ L_all, d.W + have hW_open : IsOpen W_union := + isOpen_biUnion (s := {d | d ∈ L_all}) fun d hd => (hvalid d hd).isOpen_W + have hZ_bd_cov : Z ∩ bd S ⊆ W_union := by + rintro x ⟨hxZ, hxb⟩ + let C := connectedComponentIn (bd S) x + have hC : C ∈ cuffs S := ⟨x, hxb, rfl⟩ + have hxC : x ∈ C := mem_connectedComponentIn hxb + exact hL_cov ⟨C, hC⟩ (hcs_mem C hC) ⟨hxZ, hxC⟩ + let K₁ : Set S := Z \ W_union + have hK₁ : IsCompact K₁ := (hZc.sdiff hW_open).isCompact + have hK₁_sub : K₁ ⊆ Y \ bd S := by + rintro x ⟨hxZ, hxW⟩ + exact ⟨hZY hxZ, fun hxb => hxW (hZ_bd_cov ⟨hxZ, hxb⟩)⟩ + let K₂ : Set S := ⋃ d ∈ L_all, d.g '' closedBall 0 (1 / 2) + have hK₂ : IsCompact K₂ := by + refine L_all.finite_toSet.isCompact_biUnion fun d hd => ?_ + exact (isCompact_closedBall 0 (1 / 2)).image (hvalid d hd).chart.gc + have hK₂_sub : K₂ ⊆ Y \ bd S := by + refine iUnion₂_subset fun d hd => ?_ + rintro _ ⟨z, hz, rfl⟩ + have hz_int := closedBall_half_subset_bInt hz + refine ⟨(hvalid d hd).g_sub_Y ⟨z, bInt_subset_bHalf hz_int, rfl⟩, fun hbd_g => ?_⟩ + exact hz_int.2.ne (((hvalid d hd).chart.bd_iff z (bInt_subset_bHalf hz_int)).mp hbd_g) + let K₀ : Set S := K₁ ∪ K₂ + have hK₀ : IsCompact K₀ := hK₁.union hK₂ + have hK₀_sub : K₀ ⊆ Y \ bd S := union_subset hK₁_sub hK₂_sub + obtain ⟨D_init, hD_init_sub, hD_init⟩ := exists_initial_disc_interior hS hYo hYne + have hint : ∀ x ∈ Y \ bd S, IsInteriorPoint x := fun x hx => + Decidable.byContradiction fun hni => hx.2 hni + have hY'o : IsOpen (Y \ bd S) := hYo.sdiff (cuff_statement.{u} S hS).1 + have hY'c : IsPreconnected (Y \ bd S) := isPreconnected_diff_bd hS hYo hYp + have hH' : ∀ F : Set S, F ⊆ Y \ bd S → IsOArc F → + ∃ Δ : Set S, Δ ⊆ Y \ bd S ∧ IsClosedDisc Δ ∧ discBd Δ = F := + fun F hF hFO => disc_subset_diff_bd_of_oArc hS H hF hFO + obtain ⟨D₀, hD₀Y, hD₀, _, hK₀_D₀⟩ := + exists_disc_compact_interior hS hns hint hY'o hY'c hH' hK₀ hK₀_sub hD_init_sub hD_init + have hballs : ∀ d ∈ L_all, d.g '' closedBall 0 (1 / 2) ⊆ D₀ := by + intro d hd x hx + have hxK₂ : x ∈ K₂ := mem_iUnion₂.mpr ⟨d, hd, hx⟩ + exact discInt_subset D₀ (hK₀_D₀ (Or.inr hxK₂)) + obtain ⟨D', _, _, hD', hD₀D', hW_D'⟩ := + exists_disc_merging_collar_charts hS hns H L_all hvalid hL_pw hD₀Y hD₀ hballs + refine ⟨D', hD', fun x hxZ => ?_⟩ + by_cases hxW : x ∈ W_union + · obtain ⟨d, hd, hxd⟩ := mem_iUnion₂.mp hxW + exact hW_D' d hd hxd + · have hxK₁ : x ∈ K₁ := ⟨hxZ, hxW⟩ + exact hD₀D' (discInt_subset D₀ (hK₀_D₀ (Or.inl hxK₁))) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section2.lean b/LeanPool/GraphMinor/GM07/Section2.lean new file mode 100644 index 0000000000..6de25b4c8d --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section2.lean @@ -0,0 +1,147 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section2Base +public import LeanPool.GraphMinor.GM07.Section2Euler +public import LeanPool.GraphMinor.GM07.Section2MinVal +public import LeanPool.GraphMinor.GM07.Section26 +public import LeanPool.GraphMinor.GM07.Section2Seam + +/-! +# Graph Minors VII, Section 2: Main Theorems (2.1)–(2.6) + +This file states and proves the numbered results `(2.1)`–`(2.6)` of Section 2 (pages 213–218) of +N. Robertson and P. D. Seymour, *Graph Minors. VII. Disjoint paths on a surface*, +J. Combin. Theory Ser. B 45 (1988) 212–254: +- `(2.1)` (`theorem_2_1_forward`): the forward direction of the characterization of seam graphs, as + printed. The printed converse fails (`not_theorem_2_1_proof` in + `GraphMinor/GM07/Section2Seam.lean`); + the converse for `U(J)` connected and the equivalence `theorem_2_1_proof` are in + `GraphMinor/GM07/Section2Converse.lean`; +- `(2.2)` (`theorem_2_2`): vertex and edge bounds for seam graphs of minimum valency at least `3`, + proved from `seamGraph_euler_formula` (`GraphMinor/GM07/Section2Euler.lean`) and the handshaking + lemma (`three_mul_ncard_V_le_two_mul_ncard_E`); +- `(2.3)` (`theorem_2_3`): every vertex of the seam graph of a minimal net has valency at least `3`; +- `(2.4)` (`theorem_2_4`): vertex and edge bounds for the seam graph of a minimal net, deduced from + `(2.2)`, `(2.3)`, and `Surface.modelCriterion`; +- `(2.5)` (`theorem_2_5`): existence of a path in `J'` between `φ(s)` and `φ(t)` with no edges of + type (iii) or (iv); +- `(2.6)` (`theorem_2_6`): shortcutting a `φ⁻¹(G)`-normal proper `I`-arc `F` in `Δ` by a `G`-normal + `O`-arc `A` in `Σ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- Graph Minors VII, (2.1) (pages 215–216), forward direction as printed: +"Let $J$ be a graph in $\Sigma$. Then $J$ is a seam graph for some net if and only if +(i) $bd(\Sigma) \subseteq U(J)$, and for every edge $e$ of $J$, either $e \subseteq bd(\Sigma)$ or +$e \cap bd(\Sigma) = \emptyset$, (ii) $J - bd(\Sigma)$ has no isolated vertices, (iii) $J$ has a +unique region, and (iv) every $O$-arc included in that region is null-homotopic." +Here `deleteBd J` is the paper's `J - bd(Σ)` (page 214). The printed converse is false +(`not_theorem_2_1_proof`, `GraphMinor/GM07/Section2Seam.lean`). See the correction to (2.1) in +`corrections/GM07.md`. -/ +theorem theorem_2_1_forward [T1Space S] (hS : IsSurface S) (J : Drawing S) (hJ : IsSeamGraph J) : + (bd S ⊆ J.U ∧ ∀ e ∈ J.E, e ⊆ bd S ∨ e ∩ bd S = ∅) ∧ + HasNoIsolatedVertices (deleteBd J) ∧ + J.R.ncard = 1 ∧ + (∀ r ∈ J.R, ∀ F : Set S, F ⊆ r → IsOArc F → IsNullHomotopicOArc F) := by + have : T2Space S := hS.2.1 + obtain ⟨N, hNJ⟩ := hJ + exact ⟨N.bd_subset_and_edges_seamGraph hS hNJ, N.hasNoIsolatedVertices_deleteBd_seamGraph hS hNJ, + (N.seamGraph_unique_region hNJ).2, N.seamGraph_region_nullHomotopic hS hNJ⟩ + +/-- Graph Minors VII, (2.2) (page 216): +"(2.2) *Let $\Sigma \cong \Sigma(a, b, c)$ and let $J$ be a seam graph in $\Sigma$ for some net. +Suppose that every vertex of $J$ has valency at least $3$. Then $|V(J)| \le 2(2a + b + c - 1)$, and +$|E(J)| \le 3(2a + b + c - 1)$.*" -/ +theorem theorem_2_2_proof (hS : IsSurface S) {a b c : ℕ} + (he : Nonempty (S ≃ₜ SurfaceModel a b c)) (J : Drawing S) + (hSeam : IsSeamGraph J) (hval : ∀ v ∈ J.V, 3 ≤ vertexValency J v) : + J.V.ncard ≤ 2 * (2 * a + b + c - 1) ∧ J.E.ncard ≤ 3 * (2 * a + b + c - 1) := by + have heuler : J.E.ncard + 1 = J.V.ncard + 2 * a + b + c := + seamGraph_euler_formula S hS a b c he J hSeam + have hdeg : 3 * J.V.ncard ≤ 2 * J.E.ncard := + three_mul_ncard_V_le_two_mul_ncard_E J hval + omega + +/-- Graph Minors VII, (2.3) (pages 216–217): +"(2.3) *Let $\Sigma$ be a connected surface with $\Sigma \not\cong \Sigma(0, 0, 0)$, $\Sigma(0, 0, +1)$, +... $\Sigma(0, 1, 0)$. Let $J$ be the seam graph for some minimal net with respect to some proper +graph +$G$ in $\Sigma$. Then no vertex of $J$ has valency $\le 2$.*" -/ +theorem theorem_2_3_proof (hS : IsSurface S) [hConn : ConnectedSpace S] + (h000 : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 0)) + (h001 : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 1)) + (h010 : ¬ Nonempty (S ≃ₜ SurfaceModel 0 1 0)) + {G J : Drawing S} {N : Net S} + (hG : G.IsProper) (hMin : N.IsMinimalFor G) (hSeam : N.IsSeamGraphFor J) : + ∀ v ∈ J.V, 3 ≤ vertexValency J v := + minimalNet_minValency S hS hConn h000 h001 h010 G J N hG hMin hSeam + +/-- Graph Minors VII, (2.4) (page 217): +"(2.4) *If $\Sigma \cong \Sigma(a, b, c)$ where $2a + b + c > 1$, and $J$ is the seam graph for +some minimal net for $\Sigma$ (with respect to some $G$), then $|V(J)| \le 2(2a + b + c - 1)$ and +$|E(J)| \le 3(2a + b + c - 1)$.*" -/ +theorem theorem_2_4_proof (hS : IsSurface S) {a b c : ℕ} (habc : 2 * a + b + c > 1) + (he : Nonempty (S ≃ₜ SurfaceModel a b c)) + {G J : Drawing S} {N : Net S} + (hG : G.IsProper) (hMin : N.IsMinimalFor G) (hSeam : N.IsSeamGraphFor J) : + J.V.ncard ≤ 2 * (2 * a + b + c - 1) ∧ J.E.ncard ≤ 3 * (2 * a + b + c - 1) := by + obtain ⟨hconn, h000, h001, h010⟩ := not_homeo_small_models_of_gt_one habc he + have : ConnectedSpace S := hconn + have hval : ∀ v ∈ J.V, 3 ≤ vertexValency J v := + theorem_2_3_proof hS h000 h001 h010 hG hMin hSeam + exact theorem_2_2_proof hS he J ⟨N, hSeam⟩ hval + +/-- Graph Minors VII, (2.5) (page 217): +"(2.5) *There is a path of $J'$ between $\phi(s)$ and $\phi(t)$ with no edges of type (iii) or +(iv).*" -/ +theorem theorem_2_5_proof [T1Space S] (hS : IsSurface S) (N : Net S) (J J' : Drawing S) + (hSeam : N.IsSeamGraphFor J) {s t : N.D} (hs : s ∈ bd N.D) (ht : t ∈ bd N.D) (hst : s ≠ t) + {C₁ C₂ : Set N.D} (hcomp : componentsIn (bd N.D \ {s, t}) = {C₁, C₂}) (hC12 : C₁ ≠ C₂) + (hJ'U : J'.U = J.U) (hJ'V : J'.V = J.V ∪ {N.φ s, N.φ t}) : + ∃ P : Drawing S, P.IsSubdrawing J' ∧ P.IsPathBetween (N.φ s) (N.φ t) ∧ + ∀ e ∈ P.E, ¬ IsNetEdgeType3 N C₁ e ∧ ¬ IsNetEdgeType4 N C₂ e := + exists_path_no_type3_type4 hS N J J' hSeam hs ht hst hcomp hC12 hJ'U hJ'V + +/-- Graph Minors VII, (2.6) (page 218): +"(2.6) *Let $(\Delta, \Pi)$ be a minimal net with respect to a proper graph $G$ in $\Sigma$, where +$\Sigma \cong \Sigma(a, b, c)$ and $2a + b + c > 1$. Let $J$ be the associated seam graph and let +$\phi$ be the associated surjection. Let $F$ be a $\phi^{-1}(G)$-normal proper $I$-arc in $\Delta$ +with ends $s, t$, and let $F^* = F - \{s, t\}$. Then there is a $G$-normal $O$-arc $A$ in $\Sigma$ +with* +$$|A \cap V(G)| \le 2(2a + b + c)(|\phi(F^*) \cap V(G)| + 1) + |bd(\Sigma) \cap V(G)|$$ +*and with $\phi(F) \subseteq A \subseteq \phi(F) \cup U(J)$.*" -/ +theorem theorem_2_6_proof [T1Space S] (hS : IsSurface S) {a b c : ℕ} (habc : 2 * a + b + c > 1) + (he : Nonempty (S ≃ₜ SurfaceModel a b c)) + {G J : Drawing S} {N : Net S} + (hG : G.IsProper) (hMin : N.IsMinimalFor G) (hSeam : N.IsSeamGraphFor J) + {G_D : Drawing N.D} (hPull : IsPullbackDrawing N.φ G G_D) + {F : Set N.D} {s t : N.D} + (hNorm : G_D.IsNormal F) (hProperF : IsProperIArc F) (hEnds : IsLineWithEnds F s t) : + ∃ A : Set S, G.IsNormal A ∧ IsOArc A ∧ + (A ∩ G.V).ncard ≤ + 2 * (2 * a + b + c) * ((N.φ '' (F \ {s, t}) ∩ G.V).ncard + 1) + + (bd S ∩ G.V).ncard ∧ + N.φ '' F ⊆ A ∧ A ⊆ N.φ '' F ∪ J.U := by + obtain ⟨hV, hE⟩ := theorem_2_4_proof hS habc he hG hMin hSeam + exact minimalNetShortcutOArc S hS a b c habc he G J N hG hMin hSeam hV hE G_D hPull F s t hNorm + hProperF hEnds + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section26.lean b/LeanPool/GraphMinor/GM07/Section26.lean new file mode 100644 index 0000000000..60e790e137 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section26.lean @@ -0,0 +1,402 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.NetSwapBasic +import LeanPool.GraphMinor.GM07.Section26Edges +import LeanPool.GraphMinor.GM07.Section26Path +import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.GM07.Section2MinVal +import LeanPool.GraphMinor.GM07.Section46JPlus +import LeanPool.GraphMinor.GM07.MinimalNet +import LeanPool.GraphMinor.GM11.GlueDiscs +import LeanPool.GraphMinor.GM11.DrawingOps +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Graph Minors VII, the shortcut O-arc + +For (2.6), page 218, first handle coincident endpoint images. +The cutting line already maps to an O-arc in that case: its +inner points have singleton fibers and only its ends are +identified. Its contact count includes at most one endpoint. +For distinct endpoint images, their line image meets the seam +only at its ends. Joining it to a seam path gives the required +normal O-arc, and only the inner line contacts are added. + +The main result is `minimalNetShortcutOArc`, which is (2.6). It follows the proof in the text, with +one +change. The inequality the text prints for an edge of type (ii) is false, so we use the one from the +exact count (`Net.edge_contacts_le`), and sum it along the path of (2.5) (`walk_contacts_le`). See +the correction to the proof of (2.6) in `corrections/GM07.md`. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface + +/-- The coincident-endpoint case of VII (2.6), page 218. The image +of the proper cutting line is already a normal O-arc, with at most +one graph contact in addition to its inner contacts. -/ +theorem lemma_2_6_of_equal_endpoint_images + {S : Type*} [TopologicalSpace S] [T2Space S] (N : Net S) + {G : Drawing S} {G_D : Drawing N.D} (hPull : IsPullbackDrawing N.φ G G_D) + {F : Set N.D} {s t : N.D} (hF : IsLineWithEnds F s t) + (hFbd : F ∩ bd N.D = {s, t}) (hNormal : G_D.IsNormal F) + (hst : N.φ s = N.φ t) : + G.IsNormal (N.φ '' F) ∧ IsOArc (N.φ '' F) ∧ + (N.φ '' F ∩ G.V).ncard ≤ (N.φ '' (F \ {s, t}) ∩ G.V).ncard + 1 := by + obtain ⟨k, hk, hkF, hk0, hk1⟩ := hF.exists_arc + have hinner : ∀ r ∈ Ioo (0 : unitInterval) 1, k r ∉ bd N.D := by + intro r hr hbd + have hends := hFbd.subset ⟨hkF ▸ mem_range_self r, hbd⟩ + rcases hends with hrs | hrt + · exact hr.1.ne' (hk.2 (hrs.trans hk0.symm)) + · exact hr.2.ne (hk.2 ((mem_singleton_iff.mp hrt).trans hk1.symm)) + have hRange : range (N.φ ∘ k) = N.φ '' F := by rw [range_comp, hkF] + have hArc : IsOArc (range (N.φ ∘ k)) := by + apply GM11.isOArc_of_loop (N.quotientMap_φ.continuous.comp hk.1) + · exact (congrArg N.φ hk0).trans (hst.trans (congrArg N.φ hk1).symm) + · intro r hr q hq heq + exact hk.2 (N.interior_inj (k r) (hinner r hr) (k q) heq) + · intro r hr heq + have hkr := N.interior_inj (k r) (hinner r hr) (k 0) heq + exact hr.1.ne' (hk.2 hkr) + have hImage : N.φ '' F = N.φ '' (F \ {s, t}) ∪ {N.φ s} := by + apply Subset.antisymm + · rintro z ⟨x, hx, rfl⟩ + by_cases hxe : x ∈ ({s, t} : Set N.D) + · rcases hxe with hxs | hxt + · exact Or.inr (congrArg N.φ hxs) + · exact Or.inr ((congrArg N.φ (mem_singleton_iff.mp hxt)).trans hst.symm) + · exact Or.inl ⟨x, ⟨hx, hxe⟩, rfl⟩ + · rintro z (⟨x, hx, rfl⟩ | hzs) + · exact ⟨x, hx.1, rfl⟩ + · exact ⟨s, hF.left_mem, (mem_singleton_iff.mp hzs).symm⟩ + refine ⟨N.normal_image_of_pullback hPull hNormal, hRange ▸ hArc, ?_⟩ + rw [hImage, union_inter_distrib_right] + have h := ncard_union_le (N.φ '' (F \ {s, t}) ∩ G.V) ({N.φ s} ∩ G.V) + have hEnd : ({N.φ s} ∩ G.V).ncard ≤ 1 := by + exact (ncard_inter_le_ncard_left _ _ (finite_singleton _)).trans_eq (ncard_singleton _) + exact h.trans (Nat.add_le_add_left hEnd _) + +/-- With distinct endpoint images, the image of the proper cutting +line is a line between them. Interior injectivity excludes every +identification involving an inner point. This is the line used in +the last step of VII (2.6), page 218. -/ +theorem lemma_2_6_image_line + {S : Type*} [TopologicalSpace S] [T2Space S] (N : Net S) + {F : Set N.D} {s t : N.D} (hF : IsLineWithEnds F s t) + (hFbd : F ∩ bd N.D = {s, t}) (hst : N.φ s ≠ N.φ t) : + IsLineWithEnds (N.φ '' F) (N.φ s) (N.φ t) := by + have hi : InjOn N.φ F := by + intro x hx y hy hxy + by_cases hxbd : x ∈ bd N.D + · by_cases hybd : y ∈ bd N.D + · have hxe : x = s ∨ x = t := hFbd.subset ⟨hx, hxbd⟩ + have hye : y = s ∨ y = t := hFbd.subset ⟨hy, hybd⟩ + rcases hxe with rfl | rfl <;> rcases hye with rfl | rfl + · rfl + · exact (hst hxy).elim + · exact (hst hxy.symm).elim + · rfl + · exact (N.interior_inj y hybd x hxy.symm).symm + · exact N.interior_inj x hxbd y hxy + obtain ⟨k, hk, hkF, hk0, hk1⟩ := hF.exists_arc + have hki : Function.Injective (N.φ ∘ k) := by + intro r q heq + exact hk.2 (hi (hkF ▸ mem_range_self r) (hkF ▸ mem_range_self q) heq) + have h := GM11.isLine_range (N.quotientMap_φ.continuous.comp hk.1) hki + have hRange : range (N.φ ∘ k) = N.φ '' F := by rw [range_comp, hkF] + simpa only [hRange, Function.comp_apply, hk0, hk1] using h + +/-- The image of the proper cutting line meets the seam precisely +at its endpoint images. In particular its open image misses every +path in the refined seam graph. This is used in VII (2.6), page 218. -/ +theorem lemma_2_6_image_inter_seam + {S : Type*} [TopologicalSpace S] (N : Net S) + {F : Set N.D} {s t : N.D} (hF : IsLineWithEnds F s t) + (hFbd : F ∩ bd N.D = {s, t}) : + N.φ '' F ∩ N.seamU = {N.φ s, N.φ t} := by + apply Subset.antisymm + · rintro z ⟨⟨x, hx, rfl⟩, ⟨y, hy, hyx⟩⟩ + have hxbd : x ∈ bd N.D := by + by_contra h + exact h ((N.interior_inj x h y hyx.symm).symm ▸ hy) + rcases hFbd.subset ⟨hx, hxbd⟩ with hxs | hxt + · exact Or.inl (congrArg N.φ hxs) + · exact Or.inr (congrArg N.φ (mem_singleton_iff.mp hxt)) + · rintro z (rfl | hzt) + · have hsbd : s ∈ bd N.D := (hFbd.symm.subset (show s ∈ ({s, t} : Set N.D) from Or.inl rfl)).2 + exact ⟨⟨s, hF.left_mem, rfl⟩, ⟨s, hsbd, rfl⟩⟩ + · have htbd : t ∈ bd N.D := (hFbd.symm.subset (show t ∈ ({s, t} : Set N.D) from Or.inr rfl)).2 + rw [mem_singleton_iff] at hzt + subst z + exact ⟨⟨t, hF.right_mem, rfl⟩, ⟨t, htbd, rfl⟩⟩ + +/-- Combining the seam path with the cutting-line image gives the +normal O-arc in the last step of VII (2.6), page 218. The endpoints +are already on the path, so only inner cutting-line contacts need +be added to the path's contacts. -/ +theorem lemma_2_6_union_path + {S : Type*} [TopologicalSpace S] [T2Space S] (N : Net S) + {G J P : Drawing S} {F : Set N.D} {s t : N.D} + (hN : N.IsNormalFor G) (hJ : N.IsSeamGraphFor J) + (hP : P.IsPathBetween (N.φ s) (N.φ t)) (hPJ : P.U ⊆ J.U) + (hF : IsLineWithEnds F s t) + (hFbd : F ∩ bd N.D = {s, t}) (hst : N.φ s ≠ N.φ t) + {G_D : Drawing N.D} (hPull : IsPullbackDrawing N.φ G G_D) + (hNormal : G_D.IsNormal F) : + G.IsNormal (N.φ '' F ∪ P.U) ∧ IsOArc (N.φ '' F ∪ P.U) ∧ + ((N.φ '' F ∪ P.U) ∩ G.V).ncard ≤ + (N.φ '' (F \ {s, t}) ∩ G.V).ncard + (P.U ∩ G.V).ncard ∧ + N.φ '' F ⊆ N.φ '' F ∪ P.U ∧ N.φ '' F ∪ P.U ⊆ N.φ '' F ∪ J.U := by + have hPline := GM11.isLine_of_isPathBetween hP hst + have hLine := lemma_2_6_image_line N hF hFbd hst + have hPU : P.U ⊆ N.seamU := hPJ.trans hJ.2.1.subset + have hMeet : N.φ '' F ∩ P.U ⊆ {N.φ s, N.φ t} := + fun z hz => (lemma_2_6_image_inter_seam N hF hFbd).subset ⟨hz.1, hPU hz.2⟩ + have hArc := GM11.isOArc_union hLine hPline hMeet + obtain ⟨K, hK, hNormK⟩ := hN + have hNormP : G.IsNormal P.U := by + intro z hz + exact hNormK ⟨hK.2.1.symm ▸ hPU hz.1, hz.2⟩ + have hNormF := N.normal_image_of_pullback hPull hNormal + have hNorm : G.IsNormal (N.φ '' F ∪ P.U) := by + rintro z ⟨(hzF | hzP), hzG⟩ + · exact hNormF ⟨hzF, hzG⟩ + · exact hNormP ⟨hzP, hzG⟩ + have hUnion : N.φ '' F ∪ P.U = N.φ '' (F \ {s, t}) ∪ P.U := by + apply Subset.antisymm + · rintro z (⟨x, hx, rfl⟩ | hzP) + · by_cases hxe : x ∈ ({s, t} : Set N.D) + · rcases hxe with hxs | hxt + · exact Or.inr ((congrArg N.φ hxs).symm ▸ hPline.left_mem) + · exact Or.inr ((congrArg N.φ (mem_singleton_iff.mp hxt)).symm ▸ hPline.right_mem) + · exact Or.inl ⟨x, ⟨hx, hxe⟩, rfl⟩ + · exact Or.inr hzP + · rintro z (⟨x, hx, rfl⟩ | hzP) + · exact Or.inl ⟨x, hx.1, rfl⟩ + · exact Or.inr hzP + refine ⟨hNorm, hArc, ?_, subset_union_left, union_subset_union_right _ hPJ⟩ + rw [hUnion, union_inter_distrib_right] + exact ncard_union_le _ _ + +universe u + +/-- The bound for `P`. Let `k = |φ(F*) ∩ V(G)|` and `m = |E(P)|`. Then `|U(P) ∩ V(G)| ≤ mk + m + 1 + +|bd(Σ) ∩ V(G)|`. With `m + 1 = |V(P)|` this is the display in the proof of VII (2.6), page 218. -/ +theorem path_contacts_le {S : Type u} [TopologicalSpace S] {G P : Drawing S} {x y : S} + (W : GraphWalk P.toGraph x y) (hW : W.IsSimple) (hPV : P.V = {z | z ∈ W.support}) + (hPE : P.E = {e | e ∈ W.edges}) (k : ℕ) + (hedge : ∀ e a b, e ∈ W.edges → P.toGraph.IsLink e a b → a ≠ b → + (e ∩ G.V ⊆ bd S ∧ a ∉ G.V \ bd S ∧ b ∉ G.V \ bd S) ∨ + 2 * (e ∩ G.V).ncard + ({a} ∩ G.V).ncard + ({b} ∩ G.V).ncard ≤ + 2 * k + ({x} ∩ G.V).ncard + ({y} ∩ G.V).ncard) : + (P.U ∩ G.V).ncard ≤ W.edges.length * k + W.edges.length + 1 + (bd S ∩ G.V).ncard := by + have hle : ∀ z : S, ({z} ∩ G.V).ncard ≤ 1 := fun z => + (ncard_inter_le_ncard_left _ _ (finite_singleton _)).trans_eq (ncard_singleton _) + have hle₀ : ∀ z : S, ({z} ∩ (G.V \ bd S)).ncard ≤ ({z} ∩ G.V).ncard := fun z => + ncard_le_ncard (fun w hw => ⟨hw.1, hw.2.1⟩) (G.finite_V.subset inter_subset_right) + have hsum := walk_contacts_le G.finite_V _ W hW hedge + have hsub : P.U ∩ G.V ⊆ (walkPoints W ∩ (G.V \ bd S)) ∪ (bd S ∩ G.V) := by + rintro z ⟨hz, hzV⟩ + by_cases hb : z ∈ bd S + · exact Or.inr ⟨hb, hzV⟩ + · refine Or.inl ⟨?_, hzV, hb⟩ + by_cases hzP : z ∈ P.V + · exact Or.inl (hPV ▸ hzP : z ∈ {z | z ∈ W.support}) + · obtain ⟨e, he, hze⟩ := P.exists_edge_of_mem hz hzP + exact Or.inr (mem_biUnion (hPE ▸ he : e ∈ {e | e ∈ W.edges}) hze) + have hfin : (walkPoints W ∩ (G.V \ bd S)).Finite := G.finite_V.subset fun z hz => hz.2.1 + have hc := (ncard_le_ncard hsub (hfin.union (G.finite_V.subset inter_subset_right))).trans + (ncard_union_le _ _) + have h₁ := hle x + have h₂ := hle y + have h₃ := hle₀ x + have h₄ := hle₀ y + have hm : W.edges.length * (2 * k + ({x} ∩ G.V).ncard + ({y} ∩ G.V).ncard) ≤ + 2 * (W.edges.length * k) + 2 * W.edges.length := by + calc W.edges.length * (2 * k + ({x} ∩ G.V).ncard + ({y} ∩ G.V).ncard) + ≤ W.edges.length * (2 * k + 2) := Nat.mul_le_mul_left _ (by omega) + _ = 2 * (W.edges.length * k) + 2 * W.edges.length := by ring + omega + +/-- Graph Minors VII, (2.6), page 218, with the bounds of (2.4) as hypotheses. See the module +docstring. -/ +theorem minimalNetShortcutOArc : ∀ (S : Type u) [TopologicalSpace S] [T1Space S], IsSurface S → + ∀ a b c : ℕ, 2 * a + b + c > 1 → Nonempty (S ≃ₜ SurfaceModel a b c) → + ∀ (G J : Drawing S) (N : Net S), + G.IsProper → N.IsMinimalFor G → N.IsSeamGraphFor J → + J.V.ncard ≤ 2 * (2 * a + b + c - 1) → + J.E.ncard ≤ 3 * (2 * a + b + c - 1) → + ∀ (G_D : Drawing N.D), IsPullbackDrawing N.φ G G_D → + ∀ (F : Set N.D) (s t : N.D), + G_D.IsNormal F → IsProperIArc F → IsLineWithEnds F s t → + ∃ A : Set S, G.IsNormal A ∧ IsOArc A ∧ + (A ∩ G.V).ncard ≤ + 2 * (2 * a + b + c) * ((N.φ '' (F \ {s, t}) ∩ G.V).ncard + 1) + + (bd S ∩ G.V).ncard ∧ + N.φ '' F ⊆ A ∧ A ⊆ N.φ '' F ∪ J.U := by + intro S _ _ hS a b c habc _ G J N _ hMin hSeam hV _ G_D hPull F s t hNorm hProper hEnds + have : T2Space S := hS.2.1 + have : T2Space N.D := N.isSurface_D.2.1 + obtain ⟨u, v, huv, hbdF, hFuv⟩ := hProper + have hst : s ≠ t := by + rcases seam_line_end_mem hEnds hFuv with rfl | rfl <;> rcases seam_line_end_mem hEnds.symm hFuv + with h | h + · obtain ⟨g, g0, g1⟩ := hEnds + rintro rfl + exact zero_ne_one (g.injective (Subtype.ext (g0.trans g1.symm))) + · exact h ▸ huv + · exact fun h' => huv (h.symm.trans h'.symm) + · obtain ⟨g, g0, g1⟩ := hEnds + rintro rfl + exact zero_ne_one (g.injective (Subtype.ext (g0.trans g1.symm))) + have hFbd : F ∩ bd N.D = {s, t} := by + rw [hbdF] + rcases seam_line_end_mem hEnds hFuv with h | h <;> + rcases seam_line_end_mem hEnds.symm hFuv with h' | h' + · exact absurd (h.trans h'.symm) hst + · rw [h, h'] + · rw [h, h', pair_comm] + · exact absurd (h.trans h'.symm) hst + set k := (N.φ '' (F \ {s, t}) ∩ G.V).ncard with hk + have hn : 2 ≤ 2 * a + b + c := habc + by_cases heq : N.φ s = N.φ t + · obtain ⟨h₁, h₂, h₃⟩ := lemma_2_6_of_equal_endpoint_images N hPull hEnds hFbd hNorm heq + refine ⟨N.φ '' F, h₁, h₂, ?_, Subset.rfl, subset_union_left⟩ + have : 1 * (k + 1) ≤ 2 * (2 * a + b + c) * (k + 1) := Nat.mul_le_mul_right _ (by omega) + omega + obtain ⟨M, e, hr, hmap, hU, hV₁, hV₂, hcount, hs, ht⟩ := N.exists_refine_ends s t + have hφ : ∀ z, M.φ (e z) = N.φ z := fun z => congrFun hmap z + have hrpos : 0 < M.r := lt_of_lt_of_le hSeam.1 hr + have hNnorm : G.IsNormal N.seamU := ((N.isNormalFor_iff hS G).mp hMin.1).2 + have hMnorm : M.IsNormalFor G := (M.isNormalFor_iff hS G).mpr ⟨hrpos, hU.symm ▸ hNnorm⟩ + have hmin : ∀ M' : Net S, M'.IsNormalFor G → + M.bdVertexPreimageCard G ≤ M'.bdVertexPreimageCard G := fun M' h' => by + rw [hcount] + exact hMin.2.1 M' h' + have : T2Space M.D := M.isSurface_D.2.1 + have hebd : e '' bd N.D = bd M.D := image_bd_homeomorph e + have hsbd : s ∈ bd N.D := (hFbd.symm.subset (Or.inl rfl)).2 + have htbd : t ∈ bd N.D := (hFbd.symm.subset (Or.inr rfl)).2 + have hsbd' : e s ∈ bd M.D := hebd ▸ mem_image_of_mem e hsbd + have htbd' : e t ∈ bd M.D := hebd ▸ mem_image_of_mem e htbd + have hst' : e s ≠ e t := e.injective.ne hst + have hF' : IsLineWithEnds (e '' F) (e s) (e t) := by + obtain ⟨g, hg, hgr, hg0, hg1⟩ := hEnds.exists_arc + have harc : IsArcMap (e ∘ g) := ⟨e.continuous.comp hg.1, e.injective.comp hg.2⟩ + have := harc.isLineWithEnds + rwa [range_comp, hgr, Function.comp_apply, Function.comp_apply, hg0, hg1] at this + have hFbd' : e '' F ∩ bd M.D = {e s, e t} := by + rw [← hebd, ← image_inter e.injective, hFbd, image_pair] + have himF : M.φ '' (e '' F) = N.φ '' F := by + rw [← image_comp, hmap] + have hNormal : G.IsNormal (M.φ '' (e '' F)) := by + rw [himF] + exact N.normal_image_of_pullback hPull hNorm + have himF' : M.φ '' ((e '' F) \ {e s, e t}) = N.φ '' (F \ {s, t}) := by + rw [← image_pair, ← image_sdiff e.injective, ← image_comp, hmap] + obtain ⟨A, B, C₁, C₂, hA, hB, hAB, hI, hAd, hBd, hcomp, hC12, hAC, hBC⟩ := + M.exists_cut_pieces hF' hst' hFbd' + obtain ⟨JM, hJM⟩ := M.exists_isSeamGraphFor hS hrpos + have hJU : JM.U = N.seamU := hJM.2.1.trans hU + have hJV : JM.V = M.seamV := hJM.2.2 + have hAfin : (JM.V ∪ {N.φ s, N.φ t}).Finite := JM.finite_V.union (by simp) + have hAU : JM.V ∪ {N.φ s, N.φ t} ⊆ JM.U := by + refine union_subset JM.V_subset_U ?_ + rintro z (rfl | hz) + · exact hJU ▸ ⟨s, hsbd, rfl⟩ + · obtain rfl : z = N.φ t := hz + exact hJU ▸ ⟨t, htbd, rfl⟩ + obtain ⟨J', hJ'U, hJ'V⟩ := exists_drawing_with_more_vertices JM hAfin subset_union_left hAU + have hsV : M.φ (e s) = N.φ s := hφ s + have htV : M.φ (e t) = N.φ t := hφ t + obtain ⟨P, hPJ, hPath, hPtype⟩ := exists_path_no_type3_type4 hS M JM J' hJM hsbd' htbd' hst' + hcomp hC12 hJ'U (by rw [hJ'V, hsV, htV]) + rw [hsV, htV] at hPath + have hU' : J'.U = M.seamU := hJ'U.trans hJM.2.1 + have hV' : M.seamV ⊆ J'.V := by + rw [hJ'V, hJV] + exact subset_union_left + have hPUJ : P.U ⊆ J.U := by + refine hPJ.U_subset.trans ?_ + rw [hJ'U, hJU, hSeam.2.1] + have havoid : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → M.φ (M.f j r) ∉ J'.V := by + intro j r hr' + rw [hJ'V, hJV] + rintro (h | h | h) + · exact M.notMem_seamV_of_mem_Ioo j hr' h + · have hmem : e s ∈ M.φ ⁻¹' {M.φ (M.f j r)} := by + change M.φ (e s) = _ + rw [hsV, h] + rw [M.fiber_eq_pair_of_mem_Ioo j hr'] at hmem + rcases hmem with h' | h' + · exact (hs j r hr').1 h'.symm + · exact (hs j r hr').2 (mem_singleton_iff.mp h').symm + · have hmem : e t ∈ M.φ ⁻¹' {M.φ (M.f j r)} := by + change M.φ (e t) = _ + rw [htV, mem_singleton_iff.mp h] + rw [M.fiber_eq_pair_of_mem_Ioo j hr'] at hmem + rcases hmem with h' | h' + · exact (ht j r hr').1 h'.symm + · exact (ht j r hr').2 (mem_singleton_iff.mp h').symm + obtain ⟨W, hWs, hWV, hWE⟩ := hPath + have hedge : ∀ g a b, g ∈ W.edges → P.toGraph.IsLink g a b → a ≠ b → + (g ∩ G.V ⊆ bd S ∧ a ∉ G.V \ bd S ∧ b ∉ G.V \ bd S) ∨ + 2 * (g ∩ G.V).ncard + ({a} ∩ G.V).ncard + ({b} ∩ G.V).ncard ≤ + 2 * k + ({N.φ s} ∩ G.V).ncard + ({N.φ t} ∩ G.V).ncard := by + intro g a b hg hlink hab + have hgP : g ∈ P.E := hWE ▸ hg + have hlink' : J'.toGraph.IsLink g a b := (hPJ.isLink_iff hgP).mp hlink + rcases M.edge_cases hU' hV' havoid (hPJ.2 hgP) with hb | ⟨i, hi⟩ + · refine Or.inl ⟨fun z hz => hb hz.1, ?_, ?_⟩ + · have ha : a ∈ closure g ∩ J'.V := by rw [hlink'.2.2.2]; simp + exact fun h' => h'.2 ((isClosed_bd S).closure_subset_iff.mpr hb ha.1) + · have ha : b ∈ closure g ∩ J'.V := by rw [hlink'.2.2.2]; simp + exact fun h' => h'.2 ((isClosed_bd S).closure_subset_iff.mpr hb ha.1) + · refine Or.inr ?_ + have := M.edge_contacts_le hS hMnorm hmin hF' hst' hFbd' hs ht hA hB hAB hI hAd hBd hAC hBC + hNormal hU' hV' havoid hab hlink' i hi (hPtype g hgP).1 (hPtype g hgP).2 + rwa [himF', hsV, htV] at this + have hcontacts := path_contacts_le W hWs hWV hWE k hedge + obtain ⟨hA₁, hA₂, hA₃, hA₄, hA₅⟩ := lemma_2_6_union_path N hMin.1 hSeam ⟨W, hWs, hWV, hWE⟩ hPUJ + hEnds + hFbd heq hPull hNorm + refine ⟨_, hA₁, hA₂, ?_, hA₄, hA₅⟩ + -- The count of vertices of `P`. + have hlen : W.edges.length + 1 ≤ 2 * (2 * a + b + c) := by + classical + have h₁ : P.V.ncard = W.support.length := by + have : P.V = ↑W.support.toFinset := by + rw [hWV] + ext z + simp + rw [this, ncard_coe_finset, List.toFinset_card_of_nodup hWs] + have h₂ : W.support.length = W.edges.length + 1 := GM11.length_support W + have h₃ : P.V ⊆ J.V ∪ {N.φ s, N.φ t} := by + refine hPJ.1.trans ?_ + rw [hJ'V, hJV, hSeam.2.2] + exact union_subset (hV₂.trans Subset.rfl) subset_union_right + have h₄ := ncard_le_ncard h₃ (J.finite_V.union (by simp)) + have h₅ := ncard_union_le J.V ({N.φ s, N.φ t} : Set S) + have h₆ : ({N.φ s, N.φ t} : Set S).ncard ≤ 2 := ncard_insert_le _ _ |>.trans (by simp) + omega + have hprod : (W.edges.length + 1) * (k + 1) ≤ 2 * (2 * a + b + c) * (k + 1) := + Nat.mul_le_mul_right _ hlen + have hexpand : (W.edges.length + 1) * (k + 1) = + W.edges.length * k + W.edges.length + k + 1 := by ring + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section26Edges.lean b/LeanPool/GraphMinor/GM07/Section26Edges.lean new file mode 100644 index 0000000000..cc7fd619ad --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section26Edges.lean @@ -0,0 +1,382 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.NetRefine +import LeanPool.GraphMinor.GM07.NetSeparate +import LeanPool.GraphMinor.GM07.NetSeparateExchange +import LeanPool.GraphMinor.GM07.NetSwap +import LeanPool.GraphMinor.GM07.NetSwapBoundary +import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.GM07.Section2MinVal +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.Fan +import LeanPool.GraphMinor.Surface.InvarianceOfDomain + +/-! +# The edges of `J'` in VII (2.6) + +The text works with `J'`, whose vertices include `φ(s)` and `φ(t)`, and speaks of a pair `{f, g}` +for each +edge of type (ii). So first subdivide the pairs at `s` and `t` (`Net.exists_refine_ends`). Then each +edge of +`J'` lies in `bd(Σ)`, or it is the open image of one pair (`Net.edge_cases`). The two sides of such +a pair +are each in one piece of the cut along `F` (`Net.exists_cut_pieces`), so an edge that is not of type +(iii) +or (iv) has one side in each piece, and the exchange applies (`Net.edge_contacts_le`). +-/ + +public section +namespace GraphMinor.GM07 +open Set Topology Surface +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The point `x` is on no open paired side. -/ +abbrev Net.MissesOpenSides (N : Net S) (x : N.D) : Prop := + ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.f j r ≠ x ∧ N.g j r ≠ x + +/-- The two boundary arcs of `bd(Δ) - {s, t}`, and the pieces of the cut along `F`. -/ +theorem Net.exists_cut_pieces (N : Net S) {F : Set N.D} {s t : N.D} + (hF : IsLineWithEnds F s t) (hst : s ≠ t) (hFbd : F ∩ bd N.D = {s, t}) : + ∃ A B C₁ C₂ : Set N.D, IsClosedDisc A ∧ IsClosedDisc B ∧ A ∪ B = univ ∧ A ∩ B = F ∧ + discBd A = (A ∩ bd N.D) ∪ F ∧ discBd B = (B ∩ bd N.D) ∪ F ∧ + componentsIn (bd N.D \ {s, t}) = {C₁, C₂} ∧ C₁ ≠ C₂ ∧ + (A ∩ bd N.D) \ {s, t} ⊆ C₁ ∧ (B ∩ bd N.D) \ {s, t} ⊆ C₂ := by + have : T2Space N.D := N.isSurface_D.2.1 + have hsbd : s ∈ bd N.D := (hFbd.symm.subset (Or.inl rfl)).2 + have htbd : t ∈ bd N.D := (hFbd.symm.subset (Or.inr rfl)).2 + obtain ⟨B₁, B₂, hcomp, hdis, hunion, hline, -⟩ := + Net.oArc_components_diff_pair N.isOArc_bd_D hsbd htbd hst + obtain ⟨k, hk, hkr, hk0, hk1⟩ := hline.exists_arc + have hbd : discBd (univ : Set N.D) = bd N.D := + image_bd_homeomorph (Homeomorph.Set.univ N.D) + have hrange : range k ⊆ discBd (univ : Set N.D) := by + rw [hkr, hbd] + rintro x (hx | hx) + · exact (hunion.symm ▸ Or.inl hx : x ∈ bd N.D \ {s, t}).1 + · rcases hx with rfl | hx + · exact hsbd + · exact (mem_singleton_iff.mp hx) ▸ htbd + obtain ⟨C, A, B, -, hcover, hA, hB, hAB, hI, hbA, hbB, -⟩ := + exists_disc_cut_with_boundary_arc N.isClosedDisc_D k hk hrange (by rwa [hk0, hk1]) + (subset_univ F) (by rw [hk0, hk1, hbd]; exact hFbd) + rw [hbd] at hcover + have hrA : range k ⊆ A := fun x hx => discBd_subset A (hbA ▸ Or.inl hx) + have hCB : C ⊆ B := fun x hx => discBd_subset B (hbB ▸ Or.inl hx) + refine ⟨A, B, B₁, B₂, hA, hB, hAB, hI, ?_, ?_, hcomp, ?_, ?_, ?_⟩ + · rw [hbA] + ext x + constructor + · rintro (hx | hx) + · exact Or.inl ⟨hrA hx, hcover ▸ Or.inl hx⟩ + · exact Or.inr hx + · rintro (⟨hx, hb⟩ | hx) + · rcases hcover.symm ▸ hb with h | h + · exact Or.inl h + · exact Or.inr (hI ▸ ⟨hx, hCB h⟩) + · exact Or.inr hx + · rw [hbB] + ext x + constructor + · rintro (hx | hx) + · exact Or.inl ⟨hCB hx, hcover ▸ Or.inr hx⟩ + · exact Or.inr hx + · rintro (⟨hx, hb⟩ | hx) + · rcases hcover.symm ▸ hb with h | h + · exact Or.inr (hI ▸ ⟨hrA h, hx⟩) + · exact Or.inl h + · exact Or.inr hx + · rintro rfl + obtain ⟨x, hx⟩ : B₁.Nonempty := by + by_contra hn + have hempty : B₁ = ∅ := not_nonempty_iff_eq_empty.mp hn + have hc := hcomp + rw [hempty] at hc hunion + have : (bd N.D \ {s, t}) = ∅ := by rw [hunion]; simp + rw [this] at hc + have hm : (∅ : Set N.D) ∈ componentsIn (∅ : Set N.D) := hc.symm ▸ Or.inl rfl + obtain ⟨y, hy, -⟩ := hm + exact hy + exact disjoint_left.mp hdis hx hx + · rintro x ⟨⟨hxA, hxb⟩, hxe⟩ + have hx : x ∈ B₁ ∪ B₂ := hunion ▸ ⟨hxb, hxe⟩ + rcases hx with hx | hx + · exact hx + · exfalso + have hxr : x ∉ range k := by + rw [hkr] + rintro (h | h) + · exact disjoint_left.mp hdis h hx + · exact hxe h + have hxC : x ∈ C := (hcover.symm ▸ hxb : x ∈ range k ∪ C).resolve_left hxr + have hxF : x ∈ F := hI ▸ ⟨hxA, hCB hxC⟩ + exact hxe (hFbd.subset ⟨hxF, hxb⟩) + · rintro x ⟨⟨hxB, hxb⟩, hxe⟩ + have hx : x ∈ B₁ ∪ B₂ := hunion ▸ ⟨hxb, hxe⟩ + rcases hx with hx | hx + · exfalso + have hxr : x ∈ range k := hkr ▸ Or.inl hx + have hxF : x ∈ F := hI ▸ ⟨hrA hxr, hxB⟩ + exact hxe (hFbd.subset ⟨hxF, hxb⟩) + · exact hx + +/-- Two boundary points of the disc of a net are joined by a line through its interior. We pull the +chord back from the unit disc, since `exists_chord` is stated for spaces in the lowest universe. -/ +theorem Net.exists_chord (N : Net S) {a b : N.D} (ha : a ∈ bd N.D) (hb : b ∈ bd N.D) (hab : a ≠ b) : + ∃ F : Set N.D, IsLineWithEnds F a b ∧ F ∩ bd N.D = {a, b} := by + obtain ⟨eN⟩ := N.isClosedDisc_D + have : T2Space N.D := N.isSurface_D.2.1 + let B : Set ℂ := Metric.closedBall (0 : ℂ) 1 + obtain ⟨e₀⟩ := (isClosedDisc_closedBall.1 : IsClosedDisc B) + let e : B ≃ₜ N.D := e₀.symm.trans (eN.trans (Homeomorph.Set.univ N.D)) + have hbdB : discBd B = Subtype.val '' bd B := rfl + have he : ∀ z, e z ∈ bd N.D ↔ z ∈ bd B := by + intro z + have h := image_bd_homeomorph e + constructor + · intro hz + obtain ⟨w, hw, hwz⟩ := h.symm ▸ hz + exact e.injective hwz ▸ hw + · intro hz + exact h ▸ mem_image_of_mem e hz + have hmem : ∀ {c : N.D}, c ∈ bd N.D → (e.symm c).1 ∈ discBd B := fun {c} hc => + hbdB ▸ ⟨e.symm c, (he _).mp (by rwa [e.apply_symm_apply]), rfl⟩ + have hne : (e.symm a).1 ≠ (e.symm b).1 := fun h => hab (e.symm.injective (Subtype.ext h)) + obtain ⟨F₀, hF₀, hsub, hcap⟩ := Surface.exists_chord (Δ := B) isClosedDisc_closedBall.1 (hmem ha) + (hmem hb) hne + obtain ⟨k, hk, hkr, hk0, hk1⟩ := hF₀.exists_arc + have hkB : ∀ t, k t ∈ B := fun t => hsub (hkr ▸ mem_range_self t) + let k' : unitInterval → N.D := fun t => e ⟨k t, hkB t⟩ + have hk' : IsArcMap k' := ⟨e.continuous.comp (hk.1.subtype_mk hkB), fun x y h => + hk.2 (congrArg Subtype.val (e.injective h))⟩ + have h0 : k' 0 = a := by + change e ⟨k 0, _⟩ = a + rw [show (⟨k 0, hkB 0⟩ : B) = e.symm a from Subtype.ext hk0, e.apply_symm_apply] + have h1 : k' 1 = b := by + change e ⟨k 1, _⟩ = b + rw [show (⟨k 1, hkB 1⟩ : B) = e.symm b from Subtype.ext hk1, e.apply_symm_apply] + refine ⟨range k', by simpa only [h0, h1] using hk'.isLineWithEnds, ?_⟩ + ext x + constructor + · rintro ⟨⟨t, rfl⟩, hx⟩ + have hb' : (⟨k t, hkB t⟩ : B) ∈ bd B := (he _).mp hx + have : k t ∈ F₀ ∩ discBd B := ⟨hkr ▸ mem_range_self t, hbdB ▸ ⟨_, hb', rfl⟩⟩ + rw [hcap] at this + rcases this with h | h + · refine Or.inl ?_ + change e ⟨k t, hkB t⟩ = a + rw [show (⟨k t, hkB t⟩ : B) = e.symm a from Subtype.ext h, e.apply_symm_apply] + · refine Or.inr ?_ + change e ⟨k t, hkB t⟩ = b + rw [show (⟨k t, hkB t⟩ : B) = e.symm b from Subtype.ext h, e.apply_symm_apply] + · rintro (rfl | hx) + · exact ⟨⟨0, h0⟩, ha⟩ + · obtain rfl : x = b := hx + exact ⟨⟨1, h1⟩, hb⟩ + +/-- An inner point of a paired side has its image off `bd(Σ)`. Paste the part of the pair around it, +by +the exchange along a chord. Then the point is the image of an inner point of the new disc. -/ +theorem Net.φ_f_notMem_bd (hS : IsSurface S) (N : Net S) (i : Fin N.r) {r : unitInterval} + (hr : r ∈ Ioo (0 : unitInterval) 1) : N.φ (N.f i r) ∉ bd S := by + have : T2Space S := hS.2.1 + have : T2Space N.D := N.isSurface_D.2.1 + have hr₀ : (0 : ℝ) < r.val := hr.1 + have hr₁ : r.val < 1 := hr.2 + let u : unitInterval := ⟨r.val / 2, by linarith, by linarith⟩ + let v : unitInterval := ⟨(1 + r.val) / 2, by linarith, by linarith⟩ + have hu : 0 < u := show (0 : ℝ) < r.val / 2 by linarith + have huv : u < v := show r.val / 2 < (1 + r.val) / 2 by linarith + have hv : v < 1 := show (1 + r.val) / 2 < 1 by linarith + have hne : N.f i u ≠ N.f i v := fun h => huv.ne (N.injective_f i h) + obtain ⟨F, hF, hFb⟩ := N.exists_chord (N.range_f_subset_bd i ⟨u, rfl⟩) + (N.range_f_subset_bd i ⟨v, rfl⟩) hne + obtain ⟨M, -, A, B, ψ, -, -, -, -, -, -, hAd, -, -, -, hφA, -, -, -, -, hαbd, -⟩ := + N.exists_swap_subarc_model i u v hu huv hv hF hFb + have hpiece : pieceA (N.f i) u.val v.val r = N.f i r := by + have heq : u.val + r.val * (v.val - u.val) = r.val := by + change r.val / 2 + r.val * ((1 + r.val) / 2 - r.val / 2) = r.val + ring + change extI (N.f i) (u.val + r.val * (v.val - u.val)) = _ + rw [heq, extI_coe] + have hfA : N.f i r ∈ A := by + refine discBd_subset A ?_ + rw [hAd] + exact Or.inl ⟨r, hpiece⟩ + have hint : ψ (Sum.inl ⟨_, hfA⟩) ∉ bd M.D := fun h => + ((hαbd ⟨_, hfA⟩).mp h).2 ⟨r, hr, hpiece⟩ + intro hb + have hmem : M.φ (ψ (Sum.inl ⟨_, hfA⟩)) ∈ M.φ '' (bd M.D)ᶜ := ⟨_, hint, rfl⟩ + rw [M.image_compl_bd, hφA] at hmem + exact hmem.2 (M.bd_subset_seamU hb) + +/-- Subdivide a pair at `x`, if `x` is on an open side, so that `x` misses all open sides. -/ +theorem Net.exists_refine_point (N : Net S) (x : N.D) : + ∃ (M : Net S) (e : N.D ≃ₜ M.D), N.r ≤ M.r ∧ M.φ ∘ e = N.φ ∧ M.seamU = N.seamU ∧ + N.seamV ⊆ M.seamV ∧ M.seamV ⊆ N.seamV ∪ {N.φ x} ∧ + (∀ G : Drawing S, M.bdVertexPreimageCard G = N.bdVertexPreimageCard G) ∧ + M.MissesOpenSides (e x) ∧ ∀ y, N.MissesOpenSides y → M.MissesOpenSides (e y) := by + by_cases hx : N.MissesOpenSides x + · exact ⟨N, Homeomorph.refl _, le_rfl, rfl, rfl, Subset.rfl, subset_union_left, fun _ => rfl, hx, + fun _ hy => hy⟩ + · obtain ⟨j, r, hr, hne⟩ : ∃ j r, r ∈ Ioo (0 : unitInterval) 1 ∧ (N.f j r = x ∨ N.g j r = x) := by + unfold Net.MissesOpenSides at hx + push Not at hx + obtain ⟨j, r, hr, h⟩ := hx + by_cases h' : N.f j r = x + · exact ⟨j, r, hr, Or.inl h'⟩ + · exact ⟨j, r, hr, Or.inr (h h')⟩ + have him : N.φ (N.f j r) = N.φ x := by + rcases hne with h | h + · rw [h] + · rw [N.pasting_eq, h] + obtain ⟨M, e, hM, hmap, hU, hV, hcount, hmiss⟩ := N.exists_refine_pair j r hr.1 hr.2 + have hme : M.φ (e x) = N.φ x := congrFun hmap x + refine ⟨M, e, by omega, hmap, hU, ?_, ?_, hcount, ?_, hmiss⟩ + · rw [hV] + exact subset_union_left + · rw [hV, him] + · refine M.paired_interiors_ne_of_image_mem_seamV ?_ + rw [hme, hV, him] + exact Or.inr rfl + +/-- `Net.exists_refine_point` at both `s` and `t`. -/ +theorem Net.exists_refine_ends (N : Net S) (s t : N.D) : + ∃ (M : Net S) (e : N.D ≃ₜ M.D), N.r ≤ M.r ∧ M.φ ∘ e = N.φ ∧ M.seamU = N.seamU ∧ + N.seamV ⊆ M.seamV ∧ M.seamV ⊆ N.seamV ∪ {N.φ s, N.φ t} ∧ + (∀ G : Drawing S, M.bdVertexPreimageCard G = N.bdVertexPreimageCard G) ∧ + M.MissesOpenSides (e s) ∧ M.MissesOpenSides (e t) := by + obtain ⟨M₁, e₁, hr₁, hm₁, hU₁, hV₁, hV₁', hc₁, hs₁, -⟩ := N.exists_refine_point s + obtain ⟨M₂, e₂, hr₂, hm₂, hU₂, hV₂, hV₂', hc₂, ht₂, hy₂⟩ := M₁.exists_refine_point (e₁ t) + have hφt : M₁.φ (e₁ t) = N.φ t := congrFun hm₁ t + refine ⟨M₂, e₁.trans e₂, hr₁.trans hr₂, ?_, hU₂.trans hU₁, hV₁.trans hV₂, ?_, ?_, hy₂ _ hs₁, ht₂⟩ + · funext z + exact (congrFun hm₂ (e₁ z)).trans (congrFun hm₁ z) + · refine hV₂'.trans (union_subset (hV₁'.trans ?_) ?_) + · refine union_subset subset_union_left ?_ + rintro z rfl + exact Or.inr (Or.inl rfl) + · rw [hφt] + rintro z rfl + exact Or.inr (Or.inr rfl) + · exact fun G => (hc₂ G).trans (hc₁ G) + +/-- The open image of a pair is an edge, with ends the images of the ends of the pair. -/ +theorem Net.pair_is_edge [T2Space S] (N : Net S) {J' : Drawing S} (hU : J'.U = N.seamU) + (hV : N.seamV ⊆ J'.V) (havoid : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.φ (N.f j r) ∉ J'.V) + (i : Fin N.r) : N.φ '' (N.f i '' Ioo (0 : unitInterval) 1) ∈ J'.E ∧ + J'.toGraph.IsLink (N.φ '' (N.f i '' Ioo (0 : unitInterval) 1)) (N.φ (N.f i 0)) + (N.φ (N.f i 1)) := by + let c : C(unitInterval, S) := ⟨N.φ ∘ N.f i, N.quotientMap_φ.continuous.comp (N.f i).continuous⟩ + have h := Drawing.eq_edge_of_injOn_Ioo J' c (hV ⟨i, Or.inl rfl⟩) (hV ⟨i, Or.inr rfl⟩) + (fun t ht => ⟨hU ▸ ⟨N.f i t, N.range_f_subset_bd i ⟨t, rfl⟩, rfl⟩, havoid i t ht⟩) + (fun x hx y hy hxy => (N.injective_f i) + (N.injOn_image_open_side i ⟨x, hx, rfl⟩ ⟨y, hy, rfl⟩ hxy)) + have himg : c '' Ioo (0 : unitInterval) 1 = N.φ '' (N.f i '' Ioo (0 : unitInterval) 1) := + image_comp N.φ (N.f i) _ + rwa [himg] at h + +/-- Each edge of `J'` lies in `bd(Σ)`, or it is the open image of a pair. -/ +theorem Net.edge_cases [T2Space S] (N : Net S) {J' : Drawing S} (hU : J'.U = N.seamU) + (hV : N.seamV ⊆ J'.V) (havoid : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.φ (N.f j r) ∉ J'.V) + {e : Set S} (he : e ∈ J'.E) : + e ⊆ bd S ∨ ∃ i, e = N.φ '' (N.f i '' Ioo (0 : unitInterval) 1) := by + by_cases hb : e ⊆ bd S + · exact Or.inl hb + obtain ⟨z, hz, hzb⟩ := not_subset.mp hb + have hzU : z ∈ J'.U := J'.closure_subset_U he (subset_closure hz) + rw [hU] at hzU + obtain ⟨x, hx, rfl⟩ := hzU + have hzV : N.φ x ∉ N.seamV := fun h => (he.2.1 hz).2 (hV h) + obtain ⟨i, w, hw, hφw, -, -⟩ := + N.exists_mem_Ioo_of_mem_bd_of_notMem_bd_of_notMem_seamV hx hzb hzV + refine Or.inr ⟨i, J'.edge_eq_of_mem he (N.pair_is_edge hU hV havoid i).1 hz ?_⟩ + exact ⟨N.f i w, ⟨w, hw, rfl⟩, hφw⟩ + +/-- The inequality for an edge `e` of `J'` that is not of type (iii) or (iv) and not in `bd(Σ)`, +with +ends `a, b`. It comes from `Net.pair_contacts_le_of_separating`, which needs one side of the pair in +each piece. -/ +theorem Net.edge_contacts_le (hS : IsSurface S) (N : Net S) {G J' : Drawing S} + (hN : N.IsNormalFor G) + (hmin : ∀ M : Net S, M.IsNormalFor G → N.bdVertexPreimageCard G ≤ M.bdVertexPreimageCard G) + {F A B C₁ C₂ : Set N.D} {s t : N.D} (hF : IsLineWithEnds F s t) (hst : s ≠ t) + (hFbd : F ∩ bd N.D = {s, t}) (hs : N.MissesOpenSides s) (ht : N.MissesOpenSides t) + (hA : IsClosedDisc A) (hB : IsClosedDisc B) (hAB : A ∪ B = univ) (hI : A ∩ B = F) + (hAd : discBd A = (A ∩ bd N.D) ∪ F) (hBd : discBd B = (B ∩ bd N.D) ∪ F) + (hC₁ : (A ∩ bd N.D) \ {s, t} ⊆ C₁) (hC₂ : (B ∩ bd N.D) \ {s, t} ⊆ C₂) + (hNormal : G.IsNormal (N.φ '' F)) (hU : J'.U = N.seamU) (hV : N.seamV ⊆ J'.V) + (havoid : ∀ j r, r ∈ Ioo (0 : unitInterval) 1 → N.φ (N.f j r) ∉ J'.V) + {e : Set S} {a b : S} (hab : a ≠ b) (hlink : J'.toGraph.IsLink e a b) + (i : Fin N.r) (hei : e = N.φ '' (N.f i '' Ioo (0 : unitInterval) 1)) + (h3 : ¬ IsNetEdgeType3 N C₁ e) (h4 : ¬ IsNetEdgeType4 N C₂ e) : + 2 * (e ∩ G.V).ncard + ({a} ∩ G.V).ncard + ({b} ∩ G.V).ncard ≤ + 2 * (N.φ '' (F \ {s, t}) ∩ G.V).ncard + ({N.φ s} ∩ G.V).ncard + ({N.φ t} ∩ G.V).ncard := by + have hT2 : T2Space S := hS.2.1 + have : T2Space N.D := N.isSurface_D.2.1 + have hfbd : ∀ r, N.f i r ∈ bd N.D := fun r => N.range_f_subset_bd i ⟨r, rfl⟩ + have hgbd : ∀ r, N.g i r ∈ bd N.D := fun r => N.range_g_subset_bd i ⟨r, rfl⟩ + obtain ⟨hfp, hgp⟩ := N.sides_subset_one_cut_piece hA hB hAB hI hFbd hs ht + have hsplit : ∀ {P Q : Set N.D}, IsClosedDisc P → IsClosedDisc Q → P ∪ Q = univ → P ∩ Q = F → + discBd P = (P ∩ bd N.D) ∪ F → discBd Q = (Q ∩ bd N.D) ∪ F → + range (N.f i) ⊆ P → range (N.g i) ⊆ Q → + 2 * (e ∩ G.V).ncard + ({N.φ (N.f i 0)} ∩ G.V).ncard + ({N.φ (N.f i 1)} ∩ G.V).ncard ≤ + 2 * (N.φ '' (F \ {s, t}) ∩ G.V).ncard + ({N.φ s} ∩ G.V).ncard + + ({N.φ t} ∩ G.V).ncard := by + intro P Q hP hQ hPQ hPI hPd hQd hfP hgQ + rw [hei] + refine N.pair_contacts_le_of_separating hS i hN hmin hF hst hFbd hs ht hP hQ hPQ hPI hPd hQd + ?_ ?_ hNormal + · rintro _ ⟨r, rfl⟩ + exact hPd ▸ Or.inl ⟨hfP ⟨r, rfl⟩, hfbd r⟩ + · rintro _ ⟨r, rfl⟩ + exact hQd ▸ Or.inl ⟨hgQ ⟨r, rfl⟩, hgbd r⟩ + have hoff : e ∩ bd S = ∅ := by + refine eq_empty_of_forall_notMem ?_ + rintro z ⟨hz, hzb⟩ + rw [hei] at hz + obtain ⟨_, ⟨r, hr, rfl⟩, rfl⟩ := hz + exact N.φ_f_notMem_bd hS i hr hzb + have hends : 2 * (e ∩ G.V).ncard + ({N.φ (N.f i 0)} ∩ G.V).ncard + + ({N.φ (N.f i 1)} ∩ G.V).ncard ≤ + 2 * (N.φ '' (F \ {s, t}) ∩ G.V).ncard + ({N.φ s} ∩ G.V).ncard + + ({N.φ t} ∩ G.V).ncard := by + have hfib : ∀ {C : Set N.D} {P : Set N.D}, (P ∩ bd N.D) \ {s, t} ⊆ C → range (N.f i) ⊆ P → + range (N.g i) ⊆ P → ∀ z ∈ e, N.φ ⁻¹' {z} ⊆ C := by + intro C P hC hf hg z hz + rw [hei] at hz + obtain ⟨_, ⟨r, hr, rfl⟩, rfl⟩ := hz + rw [N.fiber_eq_pair_of_mem_Ioo i hr] + rintro x (rfl | hx) + · refine hC ⟨⟨hf ⟨r, rfl⟩, hfbd r⟩, ?_⟩ + rintro (h | h) + · exact (hs i r hr).1 h + · exact (ht i r hr).1 h + · obtain rfl : x = N.g i r := hx + refine hC ⟨⟨hg ⟨r, rfl⟩, hgbd r⟩, ?_⟩ + rintro (h | h) + · exact (hs i r hr).2 h + · exact (ht i r hr).2 h + rcases hfp i with hf | hf <;> rcases hgp i with hg | hg + · exact absurd ⟨hoff, hfib hC₁ hf hg⟩ h3 + · exact hsplit hA hB hAB hI hAd hBd hf hg + · exact hsplit hB hA (by rwa [union_comm]) (by rwa [inter_comm]) hBd hAd hf hg + · exact absurd ⟨hoff, hfib hC₂ hf hg⟩ h4 + have hlink' := (N.pair_is_edge hU hV havoid i).2 + rw [← hei] at hlink' + rcases hlink.eq_and_eq_or_eq_and_eq hlink' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hends + · omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section26Path.lean b/LeanPool/GraphMinor/GM07/Section26Path.lean new file mode 100644 index 0000000000..d9c8920c4a --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section26Path.lean @@ -0,0 +1,130 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM11.Walks + +/-! +# The sum along the path in VII (2.6) + +The text bounds `|U(P) ∩ V(G)|` by adding a bound for each edge. A vertex of `P` off `bd(Σ)` lies +only on +edges with the inequality of `Net.edge_contacts_le`. An inner one is on two such edges and an end of +`P` +on one, and `walk_contacts_le` counts this along the walk. +-/ + +public section +namespace GraphMinor.GM07 +open Set Surface +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The ends of a line are determined by the line. -/ +theorem seam_line_end_mem {F : Set S} {s t u v : S} (h₁ : IsLineWithEnds F s t) + (h₂ : IsLineWithEnds F u v) : s = u ∨ s = v := by + obtain ⟨g, g0, g1⟩ := h₁ + obtain ⟨f, f0, f1⟩ := h₂ + by_contra hn + push Not at hn + let c : unitInterval → unitInterval := fun q => f.symm (g q) + have hc : Continuous c := f.symm.continuous.comp g.continuous + have hA : IsPreconnected (c '' Ioc 0 1) := isPreconnected_Ioc.image c hc.continuousOn + have hord := hA.ordConnected + have hin : ∀ r : unitInterval, (f r).1 ≠ s → r ∈ c '' Ioc 0 1 := by + intro r hr + refine ⟨g.symm (f r), ?_, by simp [c]⟩ + refine ⟨lt_of_le_of_ne unitInterval.nonneg' fun h => hr ?_, unitInterval.le_one'⟩ + have : g (g.symm (f r)) = g 0 := by rw [← h] + rw [g.apply_symm_apply] at this + rw [this, g0] + have h0 : (0 : unitInterval) ∈ c '' Ioc 0 1 := hin 0 (by rw [f0]; exact hn.1.symm) + have h1 : (1 : unitInterval) ∈ c '' Ioc 0 1 := hin 1 (by rw [f1]; exact hn.2.symm) + obtain ⟨q, hq, hqc⟩ := hord.out h0 h1 (⟨unitInterval.nonneg', unitInterval.le_one'⟩ : + c 0 ∈ Icc (0 : unitInterval) 1) + have : g q = g 0 := f.symm.injective hqc + exact hq.1.ne' (g.injective this) + +/-- The vertices of a walk, with its edges. -/ +@[expose] def walkPoints {Γ : Drawing S} {x y : S} (W : GraphWalk Γ.toGraph x y) : Set S := + {z | z ∈ W.support} ∪ ⋃ e ∈ {e | e ∈ W.edges}, e + +/-- See the module docstring. An edge either has no contacts off `Bd`, or it satisfies the +inequality +with total `c`. -/ +theorem walk_contacts_le {Γ : Drawing S} {V Bd : Set S} (hV : V.Finite) (c : ℕ) {x y : S} + (W : GraphWalk Γ.toGraph x y) (hW : W.IsSimple) + (hedge : ∀ e a b, e ∈ W.edges → Γ.toGraph.IsLink e a b → a ≠ b → + (e ∩ V ⊆ Bd ∧ a ∉ V \ Bd ∧ b ∉ V \ Bd) ∨ + 2 * (e ∩ V).ncard + ({a} ∩ V).ncard + ({b} ∩ V).ncard ≤ c) : + 2 * (walkPoints W ∩ (V \ Bd)).ncard ≤ + W.edges.length * c + ({x} ∩ (V \ Bd)).ncard + ({y} ∩ (V \ Bd)).ncard := by + have hle : ∀ z : S, ({z} ∩ (V \ Bd)).ncard ≤ ({z} ∩ V).ncard := fun z => + ncard_le_ncard (fun w hw => ⟨hw.1, hw.2.1⟩) (hV.subset inter_subset_right) + have hzero : ∀ z : S, z ∉ V \ Bd → ({z} ∩ (V \ Bd)).ncard = 0 := by + intro z hz + rw [show {z} ∩ (V \ Bd) = ∅ from eq_empty_of_forall_notMem fun w hw => + hz ((mem_singleton_iff.mp hw.1) ▸ hw.2), ncard_empty] + have hfin : (V \ Bd).Finite := hV.subset sdiff_subset + induction W with + | @nil z hv => + have : walkPoints (GraphWalk.nil hv : GraphWalk Γ.toGraph z z) ∩ (V \ Bd) = + {z} ∩ (V \ Bd) := by + ext w + simp [walkPoints] + rw [this] + simp only [GraphWalk.edges, List.length_nil, zero_mul] + omega + | @cons u v w e hlink rest ih => + have hnd : (u :: rest.support).Nodup := hW + have huv : u ≠ v := by + have hmem : v ∈ rest.support := by cases rest <;> simp [GraphWalk.support] + rintro rfl + exact (List.nodup_cons.mp hnd).1 hmem + have ih' := ih (List.nodup_cons.mp hnd).2 (fun e' a b he' => hedge e' a b (by + simp only [GraphWalk.edges] + exact List.mem_cons_of_mem _ he')) + have hsub : walkPoints (GraphWalk.cons hlink rest) ∩ (V \ Bd) ⊆ + (({u} ∩ (V \ Bd)) ∪ (e ∩ (V \ Bd))) ∪ (walkPoints rest ∩ (V \ Bd)) := by + rintro z ⟨hz | hz, hzV⟩ + · have : z = u ∨ z ∈ rest.support := by simpa [GraphWalk.support] using hz + rcases this with rfl | h + · exact Or.inl (Or.inl ⟨rfl, hzV⟩) + · exact Or.inr ⟨Or.inl h, hzV⟩ + · obtain ⟨g, hg, hzg⟩ := mem_iUnion₂.mp hz + have : g = e ∨ g ∈ rest.edges := by simpa [GraphWalk.edges] using hg + rcases this with rfl | h + · exact Or.inl (Or.inr ⟨hzg, hzV⟩) + · exact Or.inr ⟨Or.inr (mem_biUnion h hzg), hzV⟩ + have hle₁ : (walkPoints (GraphWalk.cons hlink rest) ∩ (V \ Bd)).ncard ≤ + ({u} ∩ (V \ Bd)).ncard + (e ∩ (V \ Bd)).ncard + (walkPoints rest ∩ (V \ Bd)).ncard := by + have h₁ := ncard_le_ncard hsub (((hfin.subset inter_subset_right).union + (hfin.subset inter_subset_right)).union (hfin.subset inter_subset_right)) + have h₂ := ncard_union_le (({u} ∩ (V \ Bd)) ∪ (e ∩ (V \ Bd))) (walkPoints rest ∩ (V \ Bd)) + have h₃ := ncard_union_le ({u} ∩ (V \ Bd)) (e ∩ (V \ Bd)) + omega + have hlen : (GraphWalk.cons hlink rest).edges.length * c = rest.edges.length * c + c := by + simp only [GraphWalk.edges, List.length_cons, Nat.succ_mul] + rw [hlen] + rcases hedge e u v (by simp [GraphWalk.edges]) hlink huv with ⟨h₁, h₂, h₃⟩ | h₁ + · have he0 : (e ∩ (V \ Bd)).ncard = 0 := by + rw [show e ∩ (V \ Bd) = ∅ from eq_empty_of_forall_notMem fun z hz => + hz.2.2 (h₁ ⟨hz.1, hz.2.1⟩), ncard_empty] + have := hzero u h₂ + have := hzero v h₃ + omega + · have he : (e ∩ (V \ Bd)).ncard ≤ (e ∩ V).ncard := + ncard_le_ncard (fun z hz => ⟨hz.1, hz.2.1⟩) (hV.subset inter_subset_right) + have := hle u + have := hle v + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section2Base.lean b/LeanPool/GraphMinor/GM07/Section2Base.lean new file mode 100644 index 0000000000..a1eb14a7d7 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section2Base.lean @@ -0,0 +1,1951 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Open +import LeanPool.GraphMinor.GM07.MinimalNet +import LeanPool.GraphMinor.GM07.Section11 +import LeanPool.GraphMinor.GM11.EdgeSides +import LeanPool.GraphMinor.GM11.Section4b +import LeanPool.GraphMinor.Surface.Circle +import LeanPool.GraphMinor.Surface.EdgeLoop +import LeanPool.GraphMinor.Surface.Gluing +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.Surface.ModelCriterion + +/-! +# Graph Minors VII, Section 2: Surfaces and Nets + +This file formalizes Section 2 (pages 213–218) of N. Robertson and P. D. Seymour, +*Graph Minors. VII. Disjoint paths on a surface*, J. Combin. Theory Ser. B 45 (1988) 212–254: +- Unconditional properties of nets and seam graphs (`Net.preimage_seamU`, `Net.image_compl_bd`, + `Net.homeomorph_compl_seamU`, `Net.isOpenDisc_compl_seamU`, `Net.bd_subset_seamU`, + `Net.seamGraph_unique_region`, `Net.seamGraph_region_nullHomotopic`); +- `(2.1)` (`theorem_2_1_forward`, `theorem_2_1_proof`): characterization of seam graphs for nets; +- Unconditional edge-end and handshaking lemmas for drawings (`tilde_eq_closure_inter_V`, + `ncard_tilde_of_mem_E`, `sum_vertexValency_eq_two_mul_ncard_E`, + `three_mul_ncard_V_le_two_mul_ncard_E`); +- `(2.2)` (`theorem_2_2`): vertex and edge bounds for seam graphs of minimum valency at least `3`; +- `(2.3)` (`theorem_2_3`): every vertex of the seam graph of a minimal net has valency at least `3`; +- `(2.4)` (`theorem_2_4`): vertex and edge bounds for the seam graph of a minimal net, deduced from + `(2.2)`, `(2.3)`, and `Surface.modelCriterion`; +- `(2.5)` (`theorem_2_5`): existence of a path in `J'` between `φ(s)` and `φ(t)` with no edges of + type (iii) or (iv); +- `(2.6)` (`theorem_2_6`): shortcutting a `φ⁻¹(G)`-normal proper `I`-arc `F` in `Δ` by a `G`-normal + `O`-arc `A` in `Σ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Unconditional topology of nets and seam graphs -/ + +namespace Net + +/-- The preimage under `N.φ` of the seam set `N.seamU = N.φ '' bd N.D` is `bd N.D`, because `N.φ` +makes no identifications on `(bd N.D)ᶜ`. -/ +theorem preimage_seamU (N : Net S) : N.φ ⁻¹' N.seamU = bd N.D := by + ext x + simp only [seamU, mem_preimage, mem_image] + constructor + · rintro ⟨y, hy, hxy⟩ + by_contra hx + have hxeq : x = y := N.interior_inj x hx y hxy.symm + exact hx (hxeq ▸ hy) + · intro hx + exact ⟨x, hx, rfl⟩ + +/-- The image under `N.φ` of the interior `(bd N.D)ᶜ` of the disc `N.D` is `univ \ N.seamU`. -/ +theorem image_compl_bd (N : Net S) : N.φ '' (bd N.D)ᶜ = univ \ N.seamU := by + ext z + simp only [mem_image, mem_compl_iff, mem_sdiff, mem_univ, true_and] + constructor + · rintro ⟨x, hx, rfl⟩ hz + have hx' : x ∈ N.φ ⁻¹' N.seamU := hz + rw [N.preimage_seamU] at hx' + exact hx hx' + · intro hz + obtain ⟨x, rfl⟩ := N.quotientMap_φ.surjective z + refine ⟨x, ?_, rfl⟩ + intro hx + exact hz ⟨x, hx, rfl⟩ + +/-- The restriction of `N.φ` to `(bd N.D)ᶜ` is a homeomorphism onto `univ \ N.seamU`. +Graph Minors VII, Section 2, proof of (2.1) (page 215): +"Then the restriction of $\phi$ to $\Delta - bd(\Delta)$ is injective, and hence provides a +homeomorphism from $\Delta - bd(\Delta)$ to $\Sigma - U(J)$." -/ +theorem homeomorph_compl_seamU [T2Space S] (N : Net S) : + Nonempty (((bd N.D)ᶜ : Set N.D) ≃ₜ (univ \ N.seamU : Set S)) := by + have : CompactSpace N.D := N.isSurface_D.1 + have hclosed_φ : IsClosedMap N.φ := N.quotientMap_φ.continuous.isClosedMap + have hbd_closed : IsClosed (bd N.D) := isClosed_bd N.D + have hopen_compl : IsOpen ((bd N.D)ᶜ : Set N.D) := hbd_closed.isOpen_compl + let toFun : ((bd N.D)ᶜ : Set N.D) → (univ \ N.seamU : Set S) := fun x => + ⟨N.φ x.1, by + rw [← N.image_compl_bd] + exact ⟨x.1, x.2, rfl⟩⟩ + have hcont : Continuous toFun := + (N.quotientMap_φ.continuous.comp continuous_subtype_val).subtype_mk _ + have hinj : Function.Injective toFun := by + intro x y hxy + ext + exact N.interior_inj x.1 x.2 y.1 (congr_arg Subtype.val hxy) + have hsurj : Function.Surjective toFun := by + rintro ⟨z, hz⟩ + rw [← N.image_compl_bd] at hz + rcases hz with ⟨x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + have hopenMap : IsOpenMap toFun := by + intro U hU + have hU_open_D : IsOpen (Subtype.val '' U : Set N.D) := + hopen_compl.isOpenMap_subtype_val U hU + have hK_closed : IsClosed ((Subtype.val '' U : Set N.D)ᶜ) := hU_open_D.isClosed_compl + have hφK_closed : IsClosed (N.φ '' (Subtype.val '' U : Set N.D)ᶜ) := + hclosed_φ _ hK_closed + have himg_eq : toFun '' U = + Subtype.val ⁻¹' ((N.φ '' (Subtype.val '' U : Set N.D)ᶜ)ᶜ) := by + ext ⟨z, hz⟩ + simp only [mem_image, mem_preimage, mem_compl_iff] + constructor + · rintro ⟨⟨x, hxbd⟩, hxU, hzx⟩ ⟨y, hynot, hyz⟩ + have hzx' : N.φ x = z := congr_arg Subtype.val hzx + have hxy : x = y := N.interior_inj x hxbd y (hzx'.trans hyz.symm) + subst hxy + exact hynot ⟨⟨x, hxbd⟩, hxU, rfl⟩ + · intro hnot + have hz' : z ∈ N.φ '' (bd N.D)ᶜ := by + rw [N.image_compl_bd] + exact hz + rcases hz' with ⟨x, hxbd, rfl⟩ + have hx_in : x ∈ (Subtype.val '' U : Set N.D) := by + by_contra hxnot + exact hnot ⟨x, hxnot, rfl⟩ + rcases hx_in with ⟨⟨x', hx'bd⟩, hx'U, rfl⟩ + exact ⟨⟨x', hx'bd⟩, hx'U, rfl⟩ + rw [himg_eq] + exact hφK_closed.isOpen_compl.preimage continuous_subtype_val + exact ⟨(Equiv.ofBijective toFun ⟨hinj, hsurj⟩).toHomeomorphOfContinuousOpen hcont hopenMap⟩ + +/-- The interior `(bd N.D)ᶜ` of `N.D` is homeomorphic to `OpenUnitDisc`, so `univ \ N.seamU` is an +open disc in `S`. -/ +theorem isOpenDisc_compl_seamU [T2Space S] (N : Net S) : IsOpenDisc (univ \ N.seamU) := by + have : CompactSpace N.D := N.isSurface_D.1 + have hclosed_seamU : IsClosed N.seamU := + N.quotientMap_φ.continuous.isClosedMap _ (isClosed_bd N.D) + have hopen : IsOpen (univ \ N.seamU) := by + rw [← compl_eq_univ_sdiff] + exact hclosed_seamU.isOpen_compl + obtain ⟨hD₀⟩ := N.isClosedDisc_D + let hD : ClosedUnitDisc ≃ₜ N.D := hD₀.trans (Homeomorph.Set.univ N.D) + have hbd_img : hD '' bd ClosedUnitDisc = bd N.D := image_bd_homeomorph hD + have hcompl_img : hD '' (bd ClosedUnitDisc)ᶜ = (bd N.D)ᶜ := by + rw [← hbd_img, image_compl_eq hD.bijective] + have hbd_unit : ((bd ClosedUnitDisc)ᶜ : Set ClosedUnitDisc) = Subtype.val ⁻¹' OpenUnitDisc := by + rw [bd_closedUnitDisc] + ext x + simp only [mem_compl_iff, mem_ofPred_eq, UnitCircle, mem_sphere_zero_iff_norm, + mem_preimage, OpenUnitDisc, mem_ball_zero_iff] + have hle : ‖x.1‖ ≤ 1 := mem_closedBall_zero_iff.mp x.2 + exact ⟨fun hne => lt_of_le_of_ne hle hne, fun hlt heq => ne_of_lt hlt heq⟩ + let e₁ : OpenUnitDisc ≃ₜ ((bd ClosedUnitDisc)ᶜ : Set ClosedUnitDisc) := + openPartHomeomorph.symm.trans (Homeomorph.setCongr hbd_unit.symm) + let e₂ : ((bd ClosedUnitDisc)ᶜ : Set ClosedUnitDisc) ≃ₜ ((bd N.D)ᶜ : Set N.D) := + (hD.image (bd ClosedUnitDisc)ᶜ).trans (Homeomorph.setCongr hcompl_img) + obtain ⟨e₃⟩ := N.homeomorph_compl_seamU + exact ⟨hopen, ⟨(e₁.trans e₂).trans e₃⟩⟩ + +/-- For any net `N : Net S`, `bd S ⊆ N.seamU`, because `univ \ N.seamU` is an open subset of `S` +homeomorphic to `OpenUnitDisc` and hence consists entirely of interior points of `S`. -/ +theorem bd_subset_seamU [T2Space S] (N : Net S) : bd S ⊆ N.seamU := by + obtain ⟨hopen, ⟨f⟩⟩ := N.isOpenDisc_compl_seamU + intro x hxbd + by_contra hxnot + have hxmem : x ∈ univ \ N.seamU := ⟨trivial, hxnot⟩ + exact hxbd ⟨univ \ N.seamU, hopen, hxmem, ⟨f.symm⟩⟩ + +/-- Graph Minors VII, (2.1)(iii) (page 215): +Every seam graph `J` for a net `N` has a unique region `univ \ J.U`. -/ +theorem seamGraph_unique_region [T2Space S] (N : Net S) {J : Drawing S} + (hJ : N.IsSeamGraphFor J) : + J.R = {univ \ J.U} ∧ J.R.ncard = 1 := by + have hOpenDisc : IsOpenDisc (univ \ J.U) := by + rw [hJ.2.1] + exact N.isOpenDisc_compl_seamU + have hpc : IsPathConnected (univ \ J.U) := hOpenDisc.isPathConnected + have hconn : IsConnected (univ \ J.U) := hpc.isConnected + rcases hconn.nonempty with ⟨x₀, hx₀⟩ + have hR_eq : J.R = {univ \ J.U} := by + ext r + simp only [Drawing.R, componentsIn, mem_image, mem_singleton_iff] + constructor + · rintro ⟨x, hx, rfl⟩ + apply Subset.antisymm (connectedComponentIn_subset _ _) + exact hconn.isPreconnected.subset_connectedComponentIn hx Subset.rfl + · rintro rfl + refine ⟨x₀, hx₀, ?_⟩ + apply Subset.antisymm (connectedComponentIn_subset _ _) + exact hconn.isPreconnected.subset_connectedComponentIn hx₀ Subset.rfl + exact ⟨hR_eq, by rw [hR_eq, ncard_singleton]⟩ + +/-- Graph Minors VII, (2.1)(iv) (page 215): +For any seam graph `J` of a net `N`, every `O`-arc included in the unique region of `J` is +null-homotopic in `S`. -/ +theorem seamGraph_region_nullHomotopic (hS : IsSurface S) (N : Net S) {J : Drawing S} + (hJ : N.IsSeamGraphFor J) : + ∀ r ∈ J.R, ∀ F : Set S, F ⊆ r → IsOArc F → IsNullHomotopicOArc F := by + have : T2Space S := hS.2.1 + have hOpenDisc : IsOpenDisc (univ \ J.U) := by + rw [hJ.2.1] + exact N.isOpenDisc_compl_seamU + have hR := (N.seamGraph_unique_region hJ).1 + intro r hr F hFr hFO + rw [hR, mem_singleton_iff] at hr + subst hr + have hF_closed : IsClosed F := by + rcases hFO with ⟨f⟩ + have hcomp : IsCompact (range (Subtype.val ∘ f)) := isCompact_range (by fun_prop) + have hrange : range (Subtype.val ∘ f) = F := by + ext x + simp only [Function.comp_apply, mem_range] + exact ⟨by rintro ⟨t, rfl⟩; exact (f t).2, fun hx => ⟨f.symm ⟨x, hx⟩, by simp⟩⟩ + rw [← hrange] + exact hcomp.isClosed + obtain ⟨Δ, hΔ_disc, hF_Δ⟩ := + isPlanar_of_isClosed_subset_isOpenDisc hS hF_closed hOpenDisc hFr + exact isNullHomotopicOArcIn_of_subset_disc hFO (subset_univ Δ) hΔ_disc hF_Δ + +/-- For any `i : Fin N.r` and `t ∈ Ioo (0 : unitInterval) 1`, the fiber of `N.φ` over +`N.φ (N.f i t) = N.φ (N.g i t)` is `{N.f i t, N.g i t}`. -/ +theorem eq_f_or_g_of_φ_eq_of_mem_Ioo (N : Net S) (i : Fin N.r) {t : unitInterval} + (ht : t ∈ Ioo (0 : unitInterval) 1) {y : N.D} (hy : N.φ (N.f i t) = N.φ y) : + y = N.f i t ∨ y = N.g i t := by + let R : N.D → N.D → Prop := fun a b => + ∃ (j : Fin N.r) (s : unitInterval), a = N.f j s ∧ b = N.g j s + have hrel : Relation.EqvGen R (N.f i t) y := (N.bd_eq_iff (N.f i t) y).mp hy + let P : Set N.D := {N.f i t, N.g i t} + have hstep : ∀ a b : N.D, R a b → (a ∈ P ↔ b ∈ P) := by + rintro a b ⟨j, s, rfl, rfl⟩ + simp only [P, mem_insert_iff, mem_singleton_iff] + constructor + · rintro (hff | hfg) + · by_cases hij : i = j + · subst hij + have hst : s = t := N.injective_f i hff + subst hst + exact Or.inr rfl + · exfalso + exact N.internally_disjoint_ff i j hij t ht ⟨s, hff⟩ + · exfalso + exact N.internally_disjoint_gf i j t ht ⟨s, hfg⟩ + · rintro (hgf | hgg) + · exfalso + exact N.internally_disjoint_fg i j t ht ⟨s, hgf⟩ + · by_cases hij : i = j + · subst hij + have hst : s = t := N.injective_g i hgg + subst hst + exact Or.inl rfl + · exfalso + exact N.internally_disjoint_gg i j hij t ht ⟨s, hgg⟩ + have heqv : ∀ a b : N.D, Relation.EqvGen R a b → (a ∈ P ↔ b ∈ P) := by + intro a b hab + induction hab with + | rel x z hxz => exact hstep x z hxz + | refl x => exact Iff.rfl + | symm x z _ ih => exact ih.symm + | trans x w z _ _ ih1 ih2 => exact ih1.trans ih2 + exact (heqv (N.f i t) y hrel).mp (Or.inl rfl) + +/-- For any `i : Fin N.r` and `t ∈ Ioo (0 : unitInterval) 1`, `N.φ (N.f i t) ∉ N.seamV`. -/ +theorem notMem_seamV_of_mem_Ioo (N : Net S) (i : Fin N.r) {t : unitInterval} + (ht : t ∈ Ioo (0 : unitInterval) 1) : + N.φ (N.f i t) ∉ N.seamV := by + rintro ⟨j, hj0 | hj1⟩ + · rcases N.eq_f_or_g_of_φ_eq_of_mem_Ioo i ht hj0.symm with hff | hfg + · by_cases hij : i = j + · subst hij + have h0t : (0 : unitInterval) = t := N.injective_f i hff + exact ht.1.ne h0t + · exact N.internally_disjoint_ff i j hij t ht ⟨0, hff⟩ + · exact N.internally_disjoint_gf i j t ht ⟨0, hfg⟩ + · rcases N.eq_f_or_g_of_φ_eq_of_mem_Ioo i ht hj1.symm with hff | hfg + · by_cases hij : i = j + · subst hij + have h1t : (1 : unitInterval) = t := N.injective_f i hff + exact ht.2.ne h1t.symm + · exact N.internally_disjoint_ff i j hij t ht ⟨1, hff⟩ + · exact N.internally_disjoint_gf i j t ht ⟨1, hfg⟩ + +/-- For any `i : Fin N.r` and `t : unitInterval`, `N.φ (N.f i t) = N.φ (N.g i t)`. -/ +theorem φ_f_eq_φ_g (N : Net S) (i : Fin N.r) (t : unitInterval) : + N.φ (N.f i t) = N.φ (N.g i t) := + (N.bd_eq_iff (N.f i t) (N.g i t)).mpr (.rel _ _ ⟨i, t, rfl, rfl⟩) + +/-- Every `t : unitInterval` is `0`, `1`, or in `Ioo (0 : unitInterval) 1`. -/ +theorem unitInterval_eq_zero_or_one_or_mem_Ioo (t : unitInterval) : + t = 0 ∨ t = 1 ∨ t ∈ Ioo (0 : unitInterval) 1 := by + have h0_le : (0 : unitInterval) ≤ t := Subtype.coe_le_coe.mp t.2.1 + have hle_1 : t ≤ (1 : unitInterval) := Subtype.coe_le_coe.mp t.2.2 + rcases eq_or_lt_of_le h0_le with h0 | h0 + · exact Or.inl h0.symm + · rcases eq_or_lt_of_le hle_1 with h1 | h1 + · exact Or.inr (Or.inl h1) + · exact Or.inr (Or.inr ⟨h0, h1⟩) + +/-- The preimage `N.φ ⁻¹' N.seamV` is contained in the finite set of endpoints of `N.f i` and +`N.g i` (`i : Fin N.r`). -/ +theorem preimage_seamV_subset_endpoints (N : Net S) : + N.φ ⁻¹' N.seamV ⊆ ⋃ i : Fin N.r, ({N.f i 0, N.f i 1, N.g i 0, N.g i 1} : Set N.D) := by + let Ends : Set N.D := ⋃ i : Fin N.r, ({N.f i 0, N.f i 1, N.g i 0, N.g i 1} : Set N.D) + have hEnds_seamV : ∀ x ∈ Ends, N.φ x ∈ N.seamV := by + intro x hx + simp only [Ends, mem_iUnion, mem_insert_iff, mem_singleton_iff] at hx + rcases hx with ⟨i, rfl | rfl | rfl | rfl⟩ + · exact ⟨i, Or.inl rfl⟩ + · exact ⟨i, Or.inr rfl⟩ + · exact ⟨i, Or.inl (N.φ_f_eq_φ_g i 0)⟩ + · exact ⟨i, Or.inr (N.φ_f_eq_φ_g i 1)⟩ + let R : N.D → N.D → Prop := fun a b => + ∃ (j : Fin N.r) (s : unitInterval), a = N.f j s ∧ b = N.g j s + have hstep : ∀ a b : N.D, R a b → (a ∈ Ends ↔ b ∈ Ends) := by + rintro a b ⟨j, s, rfl, rfl⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs + · constructor <;> intro _ <;> refine mem_iUnion.mpr ⟨j, ?_⟩ + · exact Or.inr (Or.inr (Or.inl rfl)) + · exact Or.inl rfl + · constructor <;> intro _ <;> refine mem_iUnion.mpr ⟨j, ?_⟩ + · exact Or.inr (Or.inr (Or.inr rfl)) + · exact Or.inr (Or.inl rfl) + · constructor <;> intro hmem + · exfalso + exact N.notMem_seamV_of_mem_Ioo j hs (hEnds_seamV _ hmem) + · exfalso + have hmem' : N.φ (N.f j s) ∈ N.seamV := by + rw [N.φ_f_eq_φ_g j s] + exact hEnds_seamV _ hmem + exact N.notMem_seamV_of_mem_Ioo j hs hmem' + have heqv : ∀ a b : N.D, Relation.EqvGen R a b → (a ∈ Ends ↔ b ∈ Ends) := by + intro a b hab + induction hab with + | rel x z hxz => exact hstep x z hxz + | refl x => exact Iff.rfl + | symm x z _ ih => exact ih.symm + | trans x w z _ _ ih1 ih2 => exact ih1.trans ih2 + rintro x ⟨i, hi | hi⟩ + · have hrel : Relation.EqvGen R (N.f i 0) x := (N.bd_eq_iff (N.f i 0) x).mp hi + exact (heqv (N.f i 0) x hrel).mp (mem_iUnion.mpr ⟨i, Or.inl rfl⟩) + · have hrel : Relation.EqvGen R (N.f i 1) x := (N.bd_eq_iff (N.f i 1) x).mp hi + exact (heqv (N.f i 1) x hrel).mp (mem_iUnion.mpr ⟨i, Or.inr (Or.inl rfl)⟩) + +/-- The preimage `N.φ ⁻¹' N.seamV` is finite. -/ +theorem finite_preimage_seamV (N : Net S) : (N.φ ⁻¹' N.seamV).Finite := by + refine (finite_iUnion fun i : Fin N.r => ?_).subset N.preimage_seamV_subset_endpoints + exact ((finite_singleton _).insert _).insert _ |>.insert _ + +/-- Every fiber `N.φ ⁻¹' {z}` of a net surjection `N.φ` is finite. -/ +theorem finite_preimage_singleton (N : Net S) (z : S) : (N.φ ⁻¹' {z}).Finite := + N.finite_fiber z + +/-- The preimage under `N.φ` of any finite subset of `S` is finite. -/ +theorem finite_preimage (N : Net S) {A : Set S} (hA : A.Finite) : (N.φ ⁻¹' A).Finite := by + have heq : N.φ ⁻¹' A = ⋃ z ∈ A, N.φ ⁻¹' {z} := by + ext x + simp + rw [heq] + exact hA.biUnion fun z _ => N.finite_preimage_singleton z + +/-- Any point `x ∈ bd N.D` whose image `N.φ x` lies outside `bd S ∪ N.seamV` belongs to the +interior of one of the pasted boundary arcs `N.f i` or `N.g i`, so its fiber `N.φ ⁻¹' {N.φ x}` is +a two-point set `{N.f i w, N.g i w}` with `w ∈ Ioo (0 : unitInterval) 1`. -/ +theorem exists_mem_Ioo_of_mem_bd_of_notMem_bd_of_notMem_seamV [T2Space S] (N : Net S) + {x : N.D} (hx_bd : x ∈ bd N.D) (hx_not_bdS : N.φ x ∉ bd S) (hx_not_V : N.φ x ∉ N.seamV) : + ∃ (i : Fin N.r) (w : unitInterval), + w ∈ Ioo (0 : unitInterval) 1 ∧ + N.φ (N.f i w) = N.φ x ∧ + N.φ ⁻¹' {N.φ x} = {N.f i w, N.g i w} ∧ + N.f i w ≠ N.g i w := by + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + let M_D : Set N.D := ⋃ i : Fin N.r, (range (N.f i) ∪ range (N.g i)) + have hMD_closed : IsClosed M_D := by + refine isClosed_iUnion_of_finite fun i => ?_ + exact (isCompact_range (N.f i).continuous).isClosed.union + (isCompact_range (N.g i).continuous).isClosed + have hφ_closed : IsClosedMap N.φ := N.quotientMap_φ.continuous.isClosedMap + let M : Set S := N.φ '' M_D + have hM_closed : IsClosed M := hφ_closed M_D hMD_closed + have h_inj_compl : ∀ y ∈ M_Dᶜ, ∀ z : N.D, N.φ y = N.φ z → y = z := by + intro y hy z hyz + let R : N.D → N.D → Prop := fun a b => + ∃ (j : Fin N.r) (s : unitInterval), a = N.f j s ∧ b = N.g j s + have hrel : Relation.EqvGen R y z := (N.bd_eq_iff y z).mp hyz + have hno_step : ∀ a b : N.D, R a b → a ∈ M_D ∧ b ∈ M_D := by + rintro a b ⟨j, s, rfl, rfl⟩ + exact ⟨mem_iUnion.mpr ⟨j, Or.inl ⟨s, rfl⟩⟩, mem_iUnion.mpr ⟨j, Or.inr ⟨s, rfl⟩⟩⟩ + have heq_of_rel : ∀ a b : N.D, Relation.EqvGen R a b → + (a ∈ M_Dᶜ ↔ b ∈ M_Dᶜ) ∧ (a ∈ M_Dᶜ → a = b) := by + intro a b hab + induction hab with + | rel u v huv => + refine ⟨⟨fun hu => False.elim (hu (hno_step u v huv).1), + fun hv => False.elim (hv (hno_step u v huv).2)⟩, + fun hu => False.elim (hu (hno_step u v huv).1)⟩ + | refl _ => + exact ⟨Iff.rfl, fun _ => rfl⟩ + | symm _ _ _ ih => + exact ⟨ih.1.symm, fun hv => (ih.2 (ih.1.mpr hv)).symm⟩ + | trans _ _ _ _ _ ih1 ih2 => + exact ⟨ih1.1.trans ih2.1, fun hu => (ih1.2 hu).trans (ih2.2 (ih1.1.mp hu))⟩ + exact (heq_of_rel y z hrel).2 hy + have hx_in_MD : x ∈ M_D := by + by_contra hx_not_MD + have hx_compl : x ∈ M_Dᶜ := hx_not_MD + let toFun : (M_Dᶜ : Set N.D) → (Mᶜ : Set S) := fun y => + ⟨N.φ y.1, fun ⟨z, hz, hzy⟩ => y.2 (h_inj_compl y.1 y.2 z hzy.symm ▸ hz)⟩ + have hcont : Continuous toFun := + (N.quotientMap_φ.continuous.comp continuous_subtype_val).subtype_mk _ + have hinj : Function.Injective toFun := by + intro y₁ y₂ h12 + ext + exact h_inj_compl y₁.1 y₁.2 y₂.1 (congr_arg Subtype.val h12) + have hsurj : Function.Surjective toFun := by + rintro ⟨z, hz⟩ + obtain ⟨y, rfl⟩ := N.quotientMap_φ.surjective z + have hy : y ∈ M_Dᶜ := fun hyM => hz ⟨y, hyM, rfl⟩ + exact ⟨⟨y, hy⟩, rfl⟩ + have hclosed_map : IsClosedMap toFun := by + intro F hF + rw [isClosed_induced_iff] at hF + rcases hF with ⟨K, hK, rfl⟩ + have hφK_closed : IsClosed (N.φ '' K) := hφ_closed K hK + have himg_eq : toFun '' (Subtype.val ⁻¹' K) = Subtype.val ⁻¹' (N.φ '' K) := by + ext ⟨z, hz⟩ + simp only [mem_image, mem_preimage] + constructor + · rintro ⟨⟨y, hy⟩, hyK, hyz⟩ + exact ⟨y, hyK, congr_arg Subtype.val hyz⟩ + · rintro ⟨w, hwK, rfl⟩ + have hw_compl : w ∈ M_Dᶜ := fun hwM => hz ⟨w, hwM, rfl⟩ + exact ⟨⟨w, hw_compl⟩, hwK, rfl⟩ + rw [himg_eq] + exact hφK_closed.preimage continuous_subtype_val + let e_homeo : (M_Dᶜ : Set N.D) ≃ₜ (Mᶜ : Set S) := + (Equiv.ofBijective toFun ⟨hinj, hsurj⟩).toHomeomorphOfContinuousClosed hcont hclosed_map + have hemb_S : IsOpenEmbedding (Subtype.val ∘ e_homeo) := + hM_closed.isOpen_compl.isOpenEmbedding_subtypeVal.comp e_homeo.isOpenEmbedding + have hemb_D : IsOpenEmbedding (Subtype.val : (M_Dᶜ : Set N.D) → N.D) := + hMD_closed.isOpen_compl.isOpenEmbedding_subtypeVal + have hint_φx : IsInteriorPoint (N.φ x) := not_not.mp hx_not_bdS + have hint_sub : IsInteriorPoint (⟨x, hx_compl⟩ : (M_Dᶜ : Set N.D)) := + (isInteriorPoint_iff_of_isOpenEmbedding hemb_S).mp hint_φx + have hint_x : IsInteriorPoint x := + isInteriorPoint_of_isOpenEmbedding hemb_D hint_sub + exact hx_bd hint_x + simp only [M_D, mem_iUnion, mem_union, mem_range] at hx_in_MD + obtain ⟨i, w, hφw⟩ : ∃ (i : Fin N.r) (w : unitInterval), N.φ (N.f i w) = N.φ x := by + rcases hx_in_MD with ⟨i, ⟨w, rfl⟩ | ⟨w, rfl⟩⟩ + · exact ⟨i, w, rfl⟩ + · exact ⟨i, w, N.φ_f_eq_φ_g i w⟩ + have hw_Ioo : w ∈ Ioo (0 : unitInterval) 1 := by + rcases unitInterval_eq_zero_or_one_or_mem_Ioo w with rfl | rfl | hw + · exact False.elim (hx_not_V ⟨i, Or.inl hφw⟩) + · exact False.elim (hx_not_V ⟨i, Or.inr hφw⟩) + · exact hw + refine ⟨i, w, hw_Ioo, hφw, ?_, ?_⟩ + · ext y + simp only [mem_preimage, mem_singleton_iff, mem_insert_iff] + constructor + · intro hy + exact N.eq_f_or_g_of_φ_eq_of_mem_Ioo i hw_Ioo (hφw.trans hy.symm) + · rintro (rfl | rfl) + · exact hφw + · exact (N.φ_f_eq_φ_g i w).symm.trans hφw + · intro hfg + exact N.internally_disjoint_fg i i w hw_Ioo ⟨w, hfg.symm⟩ + +/-- Removing two distinct points `x, y` from an `O`-arc `F₀` in a `T2Space` leaves two disjoint +connected components `B₁, B₂`, each of whose closures `Bᵢ ∪ {x, y}` is a line with ends `x, y`. -/ +theorem oArc_components_diff_pair {X : Type*} [TopologicalSpace X] [T2Space X] + {F₀ : Set X} (hF₀ : IsOArc F₀) {x y : X} (hx : x ∈ F₀) (hy : y ∈ F₀) (hxy : x ≠ y) : + ∃ B₁ B₂ : Set X, + componentsIn (F₀ \ {x, y}) = {B₁, B₂} ∧ + Disjoint B₁ B₂ ∧ + F₀ \ {x, y} = B₁ ∪ B₂ ∧ + IsLineWithEnds (B₁ ∪ {x, y}) x y ∧ + IsLineWithEnds (B₂ ∪ {x, y}) x y := by + obtain ⟨φ⟩ := id hF₀ + let a : Circle := φ.symm ⟨x, hx⟩ + let b : Circle := φ.symm ⟨y, hy⟩ + have hab : a ≠ b := by + intro h + have h' : (⟨x, hx⟩ : F₀) = ⟨y, hy⟩ := by simpa [a, b] using congrArg φ h + exact hxy (congrArg Subtype.val h') + let ι : Circle → X := fun w => (φ w).1 + have hι : Continuous ι := continuous_subtype_val.comp φ.continuous + have hιinj : Function.Injective ι := fun u w h => φ.injective (Subtype.ext h) + have hιa : ι a = x := by simp [ι, a] + have hιb : ι b = y := by simp [ι, b] + have h_arc_props : ∀ c d : Circle, c ≠ d → (c = a ∧ d = b ∨ c = b ∧ d = a) → + (∃ w₀ ∈ circleOpenArc c d, + ι '' circleOpenArc c d = connectedComponentIn (F₀ \ {x, y}) (ι w₀) ∧ + ι w₀ ∈ F₀ \ {x, y}) ∧ + IsLineWithEnds (ι '' circleOpenArc c d ∪ {x, y}) x y := by + intro c d hcd hor + have hsub_diff : ι '' circleOpenArc c d ⊆ F₀ \ {x, y} := by + rintro _ ⟨w, hw, rfl⟩ + refine ⟨(φ w).2, ?_⟩ + have h₁ : w ∈ ({a, b}ᶜ : Set Circle) := by + rw [compl_pair_eq_union_circleOpenArc hab] + rcases hor with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl hw + · exact Or.inr hw + rintro (h | h) + · exact h₁ (Or.inl (hιinj (h.trans hιa.symm))) + · exact h₁ (Or.inr (mem_singleton_iff.mpr (hιinj ((mem_singleton_iff.mp h).trans hιb.symm)))) + have hsub_rev : ι '' circleOpenArc d c ⊆ F₀ \ {x, y} := by + rintro _ ⟨w, hw, rfl⟩ + refine ⟨(φ w).2, ?_⟩ + have h₁ : w ∈ ({a, b}ᶜ : Set Circle) := by + rw [compl_pair_eq_union_circleOpenArc hab] + rcases hor with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inr hw + · exact Or.inl hw + rintro (h | h) + · exact h₁ (Or.inl (hιinj (h.trans hιa.symm))) + · exact h₁ (Or.inr (mem_singleton_iff.mpr (hιinj ((mem_singleton_iff.mp h).trans hιb.symm)))) + let m : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have hm_ioo : m ∈ Ioo (0 : unitInterval) 1 := + ⟨by change (0 : ℝ) < 1 / 2; norm_num, by change (1 / 2 : ℝ) < 1; norm_num⟩ + let w₀ : Circle := Circle.path c d m + have hw₀ : w₀ ∈ circleOpenArc c d := ⟨m, hm_ioo, rfl⟩ + have hconn : IsPreconnected (ι '' circleOpenArc c d) := + (isPathConnected_circleOpenArc c d).isConnected.isPreconnected.image _ hι.continuousOn + have h_sub_cc : ι '' circleOpenArc c d ⊆ connectedComponentIn (F₀ \ {x, y}) (ι w₀) := + hconn.subset_connectedComponentIn ⟨w₀, hw₀, rfl⟩ hsub_diff + let K₁ : Set X := range (ι ∘ Circle.path c d) + let K₂ : Set X := range (ι ∘ Circle.path d c) + have hK₁_closed : IsClosed K₁ := (isCompact_range (hι.comp (Circle.path c + d).continuous)).isClosed + have hK₂_closed : IsClosed K₂ := (isCompact_range (hι.comp (Circle.path d + c).continuous)).isClosed + have h_open_in_K₂c : ι '' circleOpenArc c d ⊆ K₂ᶜ := by + rintro _ ⟨w, hw, rfl⟩ ⟨t, ht⟩ + have hwt : Circle.path d c t = w := hιinj ht + rw [← compl_range_circlePath hcd.symm] at hw + exact hw ⟨t, hwt⟩ + have h_rev_in_K₁c : ι '' circleOpenArc d c ⊆ K₁ᶜ := by + rintro _ ⟨w, hw, rfl⟩ ⟨t, ht⟩ + have hwt : Circle.path c d t = w := hιinj ht + rw [← compl_range_circlePath hcd] at hw + exact hw ⟨t, hwt⟩ + have h_diff_union : F₀ \ {x, y} = (ι '' circleOpenArc c d) ∪ (ι '' circleOpenArc d c) := by + ext p + constructor + · rintro ⟨hpF₀, hp_xy⟩ + let w : Circle := φ.symm ⟨p, hpF₀⟩ + have hιw : ι w = p := by simp [ι, w] + have hw_ab : w ∈ ({a, b}ᶜ : Set Circle) := by + rintro (h | h) + · exact hp_xy (Or.inl (by rw [← hιw, h, hιa])) + · exact hp_xy (Or.inr (mem_singleton_iff.mpr (by rw [← hιw, mem_singleton_iff.mp h, + hιb]))) + rw [compl_pair_eq_union_circleOpenArc hab] at hw_ab + rcases hor with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rcases hw_ab with h | h + · exact Or.inl ⟨w, h, hιw⟩ + · exact Or.inr ⟨w, h, hιw⟩ + · rcases hw_ab with h | h + · exact Or.inr ⟨w, h, hιw⟩ + · exact Or.inl ⟨w, h, hιw⟩ + · rintro (h | h) + · exact hsub_diff h + · exact hsub_rev h + have h_cc_sub : connectedComponentIn (F₀ \ {x, y}) (ι w₀) ⊆ ι '' circleOpenArc c d := by + intro z hz + have hz_diff : z ∈ F₀ \ {x, y} := connectedComponentIn_subset _ _ hz + by_contra hz_not + have hz_rev : z ∈ ι '' circleOpenArc d c := + (h_diff_union ▸ hz_diff).resolve_left hz_not + have hcov : connectedComponentIn (F₀ \ {x, y}) (ι w₀) ⊆ K₂ᶜ ∪ K₁ᶜ := fun p hp => by + rcases h_diff_union ▸ connectedComponentIn_subset _ _ hp with h | h + · exact Or.inl (h_open_in_K₂c h) + · exact Or.inr (h_rev_in_K₁c h) + obtain ⟨q, hq_cc, hqK₂, hqK₁⟩ := + isPreconnected_connectedComponentIn K₂ᶜ K₁ᶜ hK₂_closed.isOpen_compl hK₁_closed.isOpen_compl + hcov ⟨ι w₀, mem_connectedComponentIn (hsub_diff ⟨w₀, hw₀, rfl⟩), h_open_in_K₂c ⟨w₀, hw₀, + rfl⟩⟩ + ⟨z, hz, h_rev_in_K₁c hz_rev⟩ + rcases h_diff_union ▸ connectedComponentIn_subset _ _ hq_cc with ⟨w, ⟨t, _, rfl⟩, rfl⟩ | ⟨w, + ⟨t, _, rfl⟩, rfl⟩ + · exact hqK₁ ⟨t, rfl⟩ + · exact hqK₂ ⟨t, rfl⟩ + have h_eq_cc : ι '' circleOpenArc c d = connectedComponentIn (F₀ \ {x, y}) (ι w₀) := + Subset.antisymm h_sub_cc h_cc_sub + have h_line_cd : IsLineWithEnds (ι '' circleOpenArc c d ∪ {ι c, ι d}) (ι c) (ι d) := by + have heq_range : ι '' circleOpenArc c d ∪ {ι c, ι d} = range (ι ∘ Circle.path c d) := by + ext p + constructor + · rintro (⟨w, ⟨t, ht, rfl⟩, rfl⟩ | (rfl | hp)) + · exact ⟨t, rfl⟩ + · exact ⟨0, by simp⟩ + · rw [mem_singleton_iff.mp hp] + exact ⟨1, by simp⟩ + · rintro ⟨t, rfl⟩ + by_cases ht0 : t = 0 + · subst ht0; exact Or.inr (Or.inl (by simp)) + · by_cases ht1 : t = 1 + · subst ht1; exact Or.inr (Or.inr (by simp)) + · exact Or.inl ⟨Circle.path c d t, ⟨t, ⟨unitInterval.pos_iff_ne_zero.mpr ht0, + unitInterval.lt_one_iff_ne_one.mpr ht1⟩, rfl⟩, rfl⟩ + rw [heq_range] + have h_inj : Function.Injective (ι ∘ Circle.path c d) := + hιinj.comp (Circle.path_injective_of_ne hcd) + have hemb : IsEmbedding (ι ∘ Circle.path c d) := + ((hι.comp (Circle.path c d).continuous).isClosedEmbedding h_inj).isEmbedding + exact ⟨hemb.toHomeomorph, by simp, by simp⟩ + refine ⟨⟨w₀, hw₀, h_eq_cc, hsub_diff ⟨w₀, hw₀, rfl⟩⟩, ?_⟩ + rcases hor with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rwa [hιa, hιb] at h_line_cd + · rw [hιa, hιb, pair_comm y x] at h_line_cd + exact h_line_cd.symm + obtain ⟨⟨w₁, hw₁, hB₁_cc, hw₁_diff⟩, hB₁_line⟩ := h_arc_props a b hab (Or.inl ⟨rfl, rfl⟩) + obtain ⟨⟨w₂, hw₂, hB₂_cc, hw₂_diff⟩, hB₂_line⟩ := h_arc_props b a hab.symm (Or.inr ⟨rfl, rfl⟩) + let B₁ := ι '' circleOpenArc a b + let B₂ := ι '' circleOpenArc b a + have h_disj : Disjoint B₁ B₂ := + (disjoint_circleOpenArc hab).image hιinj.injOn (subset_univ _) (subset_univ _) + have h_diff_union : F₀ \ {x, y} = B₁ ∪ B₂ := by + ext p + constructor + · rintro ⟨hpF₀, hp_xy⟩ + let w : Circle := φ.symm ⟨p, hpF₀⟩ + have hιw : ι w = p := by simp [ι, w] + have hw_ab : w ∈ ({a, b}ᶜ : Set Circle) := by + rintro (h | h) + · exact hp_xy (Or.inl (by rw [← hιw, h, hιa])) + · exact hp_xy (Or.inr (mem_singleton_iff.mpr (by rw [← hιw, mem_singleton_iff.mp h, hιb]))) + rw [compl_pair_eq_union_circleOpenArc hab] at hw_ab + rcases hw_ab with h | h + · exact Or.inl ⟨w, h, hιw⟩ + · exact Or.inr ⟨w, h, hιw⟩ + · rintro (h | h) + · dsimp only [B₁] at h + rw [hB₁_cc] at h + exact connectedComponentIn_subset _ _ h + · dsimp only [B₂] at h + rw [hB₂_cc] at h + exact connectedComponentIn_subset _ _ h + refine ⟨B₁, B₂, ?_, h_disj, h_diff_union, hB₁_line, hB₂_line⟩ + ext C + simp only [componentsIn, mem_image, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨z, hz, rfl⟩ + rcases h_diff_union ▸ hz with hz₁ | hz₂ + · left + dsimp only [B₁] + rw [hB₁_cc] + exact (connectedComponentIn_eq (hB₁_cc ▸ hz₁)).symm + · right + dsimp only [B₂] + rw [hB₂_cc] + exact (connectedComponentIn_eq (hB₂_cc ▸ hz₂)).symm + · rintro (rfl | rfl) + · exact ⟨ι w₁, hw₁_diff, hB₁_cc.symm⟩ + · exact ⟨ι w₂, hw₂_diff, hB₂_cc.symm⟩ + +/-- The boundary `bd N.D` of the disc of a net `N` is an `O`-arc. -/ +theorem isOArc_bd_D (N : Net S) : IsOArc (bd N.D) := by + have heq : discBd (univ : Set N.D) = bd N.D := image_bd_homeomorph (Homeomorph.Set.univ N.D) + exact heq ▸ N.isClosedDisc_D.isOArc_discBd + +/-- The open part of the unit interval is path connected. -/ +theorem unitInterval_interior_isPathConnected : + IsPathConnected (Ioo (0 : unitInterval) 1) := by + have heq : projIcc (0 : ℝ) 1 zero_le_one '' Ioo (0 : ℝ) 1 = Ioo (0 : unitInterval) 1 := by + ext x + simp only [mem_image, mem_Ioo] + constructor + · rintro ⟨r, ⟨hr0, hr1⟩, rfl⟩ + have hval : (projIcc (0 : ℝ) 1 zero_le_one r : ℝ) = r := + congr_arg Subtype.val (projIcc_of_mem zero_le_one ⟨hr0.le, hr1.le⟩) + exact ⟨Subtype.coe_lt_coe.mp (by simpa [hval] using hr0), + Subtype.coe_lt_coe.mp (by simpa [hval] using hr1)⟩ + · rintro ⟨hx0, hx1⟩ + refine ⟨x.1, ⟨Subtype.coe_lt_coe.mpr hx0, Subtype.coe_lt_coe.mpr hx1⟩, ?_⟩ + exact projIcc_val zero_le_one x + rw [← heq] + exact ((convex_Ioo (0 : ℝ) 1).isPathConnected ⟨1 / 2, by norm_num, by norm_num⟩).image + continuous_projIcc + +/-- The open unit interval is dense in the closed unit interval. -/ +theorem unitInterval_interior_closure : closure (Ioo (0 : unitInterval) 1) = univ := by + rw [closure_Ioo zero_ne_one] + exact eq_univ_of_forall fun t => ⟨unitInterval.nonneg t, unitInterval.le_one t⟩ + +/-- For any net `N`, `i : Fin N.r`, and preconnected subset `U ⊆ bd N.D` avoiding `N.f i 0` and +`N.f i 1`, if `U` contains `N.f i t` for some `t ∈ Ioo (0 : unitInterval) 1`, then +`U ⊆ N.f i '' Ioo (0 : unitInterval) 1` (and hence `N.g i t ∉ U`). -/ +theorem subset_image_Ioo_f_of_isPreconnected (N : Net S) (i : Fin N.r) {U : Set N.D} + (hU_conn : IsPreconnected U) (hU_bd : U ⊆ bd N.D) + (hf0 : N.f i 0 ∉ U) (hf1 : N.f i 1 ∉ U) + {t : unitInterval} (ht : t ∈ Ioo (0 : unitInterval) 1) (htU : N.f i t ∈ U) : + U ⊆ N.f i '' Ioo (0 : unitInterval) 1 ∧ N.g i t ∉ U := by + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + have hOArc : IsOArc (bd N.D) := N.isOArc_bd_D + have hf0_bd : N.f i 0 ∈ bd N.D := N.range_f_subset_bd i ⟨0, rfl⟩ + have hf1_bd : N.f i 1 ∈ bd N.D := N.range_f_subset_bd i ⟨1, rfl⟩ + have hf01_ne : N.f i 0 ≠ N.f i 1 := fun h => zero_ne_one (N.injective_f i h) + obtain ⟨B₁, B₂, hcomp, hdisj, hunion, hline₁, hline₂⟩ := + oArc_components_diff_pair hOArc hf0_bd hf1_bd hf01_ne + have hIoo_pc : IsPathConnected (Ioo (0 : unitInterval) 1) := by + exact unitInterval_interior_isPathConnected + have hfIoo_conn : IsPreconnected (N.f i '' Ioo (0 : unitInterval) 1) := + (hIoo_pc.image (N.f i).continuous).isConnected.isPreconnected + have hfIoo_sub : N.f i '' Ioo (0 : unitInterval) 1 ⊆ bd N.D \ {N.f i 0, N.f i 1} := by + rintro _ ⟨s, hs, rfl⟩ + refine ⟨N.range_f_subset_bd i ⟨s, rfl⟩, ?_⟩ + rintro (h0 | h1) + · exact hs.1.ne (N.injective_f i h0).symm + · exact hs.2.ne (N.injective_f i (mem_singleton_iff.mp h1)) + let B := connectedComponentIn (bd N.D \ {N.f i 0, N.f i 1}) (N.f i t) + have hB_mem : B ∈ componentsIn (bd N.D \ {N.f i 0, N.f i 1}) := + ⟨N.f i t, hfIoo_sub ⟨t, ht, rfl⟩, rfl⟩ + rw [hcomp] at hB_mem + have hB_line : IsLineWithEnds (B ∪ {N.f i 0, N.f i 1}) (N.f i 0) (N.f i 1) := by + rcases hB_mem with rfl | rfl + · exact hline₁ + · exact hline₂ + have hfIoo_sub_B : N.f i '' Ioo (0 : unitInterval) 1 ⊆ B := + hfIoo_conn.subset_connectedComponentIn ⟨t, ht, rfl⟩ hfIoo_sub + have hrange_sub : range (N.f i) ⊆ B ∪ {N.f i 0, N.f i 1} := by + rintro _ ⟨s, rfl⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs + · exact Or.inr (Or.inl rfl) + · exact Or.inr (Or.inr rfl) + · exact Or.inl (hfIoo_sub_B ⟨s, hs, rfl⟩) + have hrange_eq : range (N.f i) = B ∪ {N.f i 0, N.f i 1} := + hB_line.eq_of_subset (isPreconnected_range (N.f i).continuous) hrange_sub ⟨0, rfl⟩ ⟨1, rfl⟩ + have hB_sub_fIoo : B ⊆ N.f i '' Ioo (0 : unitInterval) 1 := by + intro y hy + have hy_diff : y ∈ bd N.D \ {N.f i 0, N.f i 1} := connectedComponentIn_subset _ _ hy + have hy_range : y ∈ range (N.f i) := hrange_eq ▸ Or.inl hy + rcases hy_range with ⟨s, rfl⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs + · exact False.elim (hy_diff.2 (Or.inl rfl)) + · exact False.elim (hy_diff.2 (Or.inr rfl)) + · exact ⟨s, hs, rfl⟩ + have hU_sub_diff : U ⊆ bd N.D \ {N.f i 0, N.f i 1} := by + intro y hy + refine ⟨hU_bd hy, ?_⟩ + rintro (rfl | h1) + · exact hf0 hy + · exact hf1 (mem_singleton_iff.mp h1 ▸ hy) + have hU_sub_B : U ⊆ B := hU_conn.subset_connectedComponentIn htU hU_sub_diff + have hU_sub_fIoo : U ⊆ N.f i '' Ioo (0 : unitInterval) 1 := hU_sub_B.trans hB_sub_fIoo + refine ⟨hU_sub_fIoo, fun hgU => ?_⟩ + rcases hU_sub_fIoo hgU with ⟨s, hs, hsg⟩ + exact N.internally_disjoint_fg i i s hs ⟨t, hsg.symm⟩ + +/-- On any preconnected subset `U ⊆ bd N.D` disjoint from `N.φ ⁻¹' N.seamV`, `N.φ` is injective. -/ +theorem injOn_φ_of_isPreconnected (N : Net S) {U : Set N.D} + (hU_conn : IsPreconnected U) (hU_bd : U ⊆ bd N.D) (hU_V : Disjoint U (N.φ ⁻¹' N.seamV)) : + InjOn N.φ U := by + intro x hx y hy hxy + by_contra hne + let R : N.D → N.D → Prop := fun a b => + ∃ (j : Fin N.r) (s : unitInterval), a = N.f j s ∧ b = N.g j s + have hrel : Relation.EqvGen R x y := (N.bd_eq_iff x y).mp hxy + have hex_step : ∃ (i : Fin N.r) (t : unitInterval), N.φ (N.f i t) = N.φ x := by + by_contra! hno + have heq_of_rel : ∀ a b : N.D, Relation.EqvGen R a b → (N.φ a = N.φ x → a = b) := by + intro a b hab + induction hab with + | rel u v huv => + intro hu + rcases huv with ⟨i, t, rfl, rfl⟩ + exact False.elim (hno i t hu) + | refl _ => + intro _ + rfl + | symm u v huv ih => + intro hv + have huv_φ : N.φ u = N.φ v := (N.bd_eq_iff u v).mpr huv + exact (ih (huv_φ.trans hv)).symm + | trans u w v huw _ ih1 ih2 => + intro hu + have huw_φ : N.φ u = N.φ w := (N.bd_eq_iff u w).mpr huw + exact (ih1 hu).trans (ih2 (huw_φ.symm.trans hu)) + exact hne (heq_of_rel x y hrel rfl) + rcases hex_step with ⟨i, t, hφt⟩ + have hx_not_V : N.φ x ∉ N.seamV := Disjoint.notMem_of_mem_left hU_V hx + have ht : t ∈ Ioo (0 : unitInterval) 1 := by + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact False.elim (hx_not_V ⟨i, Or.inl hφt⟩) + · exact False.elim (hx_not_V ⟨i, Or.inr hφt⟩) + · exact ht + have hx_fg := N.eq_f_or_g_of_φ_eq_of_mem_Ioo i ht hφt + have hy_fg := N.eq_f_or_g_of_φ_eq_of_mem_Ioo i ht (hφt.trans hxy) + have hf_in_U : N.f i t ∈ U := by + rcases hx_fg with rfl | rfl + · exact hx + · rcases hy_fg with rfl | rfl + · exact hy + · exact False.elim (hne rfl) + have hg_in_U : N.g i t ∈ U := by + rcases hx_fg with rfl | rfl + · rcases hy_fg with rfl | rfl + · exact False.elim (hne rfl) + · exact hy + · exact hx + have hf0_not_U : N.f i 0 ∉ U := fun h => + Disjoint.notMem_of_mem_left hU_V h ⟨i, Or.inl rfl⟩ + have hf1_not_U : N.f i 1 ∉ U := fun h => + Disjoint.notMem_of_mem_left hU_V h ⟨i, Or.inr rfl⟩ + exact (N.subset_image_Ioo_f_of_isPreconnected i hU_conn hU_bd hf0_not_U hf1_not_U ht hf_in_U).2 + hg_in_U + +/-- Every seam graph `J` for a net `N` has no isolated vertices. +Graph Minors VII, Section 2, proof of (2.1) and (2.3) (pages 215–217): +"Certainly $J$ has no isolated vertices." -/ +theorem hasNoIsolatedVertices_seamGraph (N : Net S) {J : Drawing S} + (hJ : N.IsSeamGraphFor J) : HasNoIsolatedVertices J := by + intro v hv + rw [hJ.2.2] at hv + rcases hv with ⟨i, hi⟩ + let t₀ : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht₀ : t₀ ∈ Ioo (0 : unitInterval) 1 := by + constructor <;> rw [← Subtype.coe_lt_coe] <;> norm_num [t₀] + have hsub : (N.φ ∘ N.f i) '' Ioo (0 : unitInterval) 1 ⊆ J.U \ J.V := by + rintro z ⟨t, ht, rfl⟩ + rw [hJ.2.1, hJ.2.2] + exact ⟨⟨N.f i t, N.range_f_subset_bd i ⟨t, rfl⟩, rfl⟩, N.notMem_seamV_of_mem_Ioo i ht⟩ + have hz₀ : N.φ (N.f i t₀) ∈ J.U \ J.V := hsub ⟨t₀, ht₀, rfl⟩ + let e := pathComponentIn (J.U \ J.V) (N.φ (N.f i t₀)) + have heE : e ∈ J.E := pathComponentIn_mem_arcComponentsIn hz₀ + have hIoo_pc := Net.unitInterval_interior_isPathConnected + have himg_pc : IsPathConnected ((N.φ ∘ N.f i) '' Ioo (0 : unitInterval) 1) := + hIoo_pc.image (N.quotientMap_φ.continuous.comp (N.f i).continuous) + have himg_sub_e : (N.φ ∘ N.f i) '' Ioo (0 : unitInterval) 1 ⊆ e := + himg_pc.subset_pathComponentIn ⟨t₀, ht₀, rfl⟩ hsub + have hrange_sub_cl : range (N.φ ∘ N.f i) ⊆ closure e := by + rw [← image_univ, ← Net.unitInterval_interior_closure] + exact (image_closure_subset_closure_image + (N.quotientMap_φ.continuous.comp (N.f i).continuous)).trans (closure_mono himg_sub_e) + refine ⟨e, heE, ?_⟩ + rw [Drawing.VertexIncident] + refine ⟨?_, Or.inl heE, ?_⟩ + · rw [hJ.2.2] + exact ⟨i, hi⟩ + · rcases hi with rfl | rfl + · exact hrange_sub_cl ⟨0, rfl⟩ + · exact hrange_sub_cl ⟨1, rfl⟩ + +end Net + +/-- The empty drawing `emptyDrawing S` (`U = ∅`, `V = ∅`) is never a seam graph for any net, +because every net `N` with `0 < N.r` has `N.seamV.Nonempty`. In particular, on the sphere +`S = SurfaceModel 0 0 0`, `emptyDrawing S` satisfies conditions (i)–(iv) of (2.1) (page 215) +without being a seam graph. -/ +theorem not_isSeamGraph_emptyDrawing : ¬ IsSeamGraph (emptyDrawing S) := by + rintro ⟨N, hpos, _, hV⟩ + have h0 : N.φ (N.f ⟨0, hpos⟩ 0) ∈ (emptyDrawing S).V := by + rw [hV] + exact ⟨⟨0, hpos⟩, Or.inl rfl⟩ + exact h0 + +/-! ## 2. Handshaking lemma and model bounds -/ + +/-- For every edge `e ∈ J.E` of a drawing `J`, `tilde e = closure e ∩ J.V`. -/ +theorem tilde_eq_closure_inter_V (J : Drawing S) {e : Set S} (he : e ∈ J.E) : + tilde e = closure e ∩ J.V := by + have hdiff : closure e \ J.V = e := J.closure_diff_V he + ext x + simp only [tilde, mem_sdiff, mem_inter_iff] + constructor + · rintro ⟨hxcl, hxe⟩ + refine ⟨hxcl, ?_⟩ + by_contra hxV + exact hxe (hdiff ▸ ⟨hxcl, hxV⟩) + · rintro ⟨hxcl, hxV⟩ + refine ⟨hxcl, ?_⟩ + intro hxe + rw [← hdiff] at hxe + exact hxe.2 hxV + +/-- Every edge `e ∈ J.E` of a drawing `J` in a `T1Space` has `(tilde e).ncard = 2` (a non-loop edge) +or `(tilde e).ncard = 1` (a loop edge). -/ +theorem ncard_tilde_of_mem_E (J : Drawing S) {e : Set S} (he : e ∈ J.E) : + (tilde e).ncard = 2 ∨ (tilde e).ncard = 1 := by + rw [tilde_eq_closure_inter_V J he] + rcases J.edge_cond e he with ⟨u, v, huv, hcap, -⟩ | ⟨u, hcap, -⟩ + · left + rw [hcap, ncard_pair huv] + · right + rw [hcap, ncard_singleton] + +/-- For `v ∈ J.V` and `e ∈ J.E`, `J.VertexIncident v e` holds if and only if `v ∈ tilde e`. -/ +theorem vertexIncident_iff_mem_tilde (J : Drawing S) {v : S} (hv : v ∈ J.V) + {e : Set S} (he : e ∈ J.E) : + J.VertexIncident v e ↔ v ∈ tilde e := by + rw [tilde_eq_closure_inter_V J he] + simp [Drawing.VertexIncident, hv, he] + +/-- The handshaking lemma for drawings: the sum of `vertexValency J v` over all `v ∈ J.V` equals +`2 * J.E.ncard`. -/ +theorem sum_vertexValency_eq_two_mul_ncard_E (J : Drawing S) : + ∑ v ∈ J.finite_V.toFinset, vertexValency J v = 2 * J.E.ncard := by + classical + let V_fin := J.finite_V.toFinset + let E_fin := J.finite_edges.toFinset + let E₂ := E_fin.filter (fun e => (tilde e).ncard = 2) + let E₁ := E_fin.filter (fun e => (tilde e).ncard = 1) + have hV_mem : ∀ v, v ∈ V_fin ↔ v ∈ J.V := fun v => Finite.mem_toFinset _ + have hE_mem : ∀ e, e ∈ E_fin ↔ e ∈ J.E := fun e => Finite.mem_toFinset _ + have hval_eq : ∀ v ∈ V_fin, + vertexValency J v = + (E₂.filter (fun e => v ∈ tilde e)).card + 2 * (E₁.filter (fun e => v ∈ tilde e)).card := by + intro v hv + have hvV : v ∈ J.V := (hV_mem v).mp hv + have hset2 : {e ∈ J.E | J.VertexIncident v e ∧ (tilde e).ncard = 2} = + ↑(E₂.filter (fun e => v ∈ tilde e)) := by + ext e + simp only [mem_ofPred_eq, Finset.mem_coe, Finset.mem_filter, E₂, hE_mem] + constructor + · rintro ⟨he, hinc, hcard⟩ + exact ⟨⟨he, hcard⟩, (vertexIncident_iff_mem_tilde J hvV he).mp hinc⟩ + · rintro ⟨⟨he, hcard⟩, hvtilde⟩ + exact ⟨he, (vertexIncident_iff_mem_tilde J hvV he).mpr hvtilde, hcard⟩ + have hset1 : {e ∈ J.E | J.VertexIncident v e ∧ (tilde e).ncard = 1} = + ↑(E₁.filter (fun e => v ∈ tilde e)) := by + ext e + simp only [mem_ofPred_eq, Finset.mem_coe, Finset.mem_filter, E₁, hE_mem] + constructor + · rintro ⟨he, hinc, hcard⟩ + exact ⟨⟨he, hcard⟩, (vertexIncident_iff_mem_tilde J hvV he).mp hinc⟩ + · rintro ⟨⟨he, hcard⟩, hvtilde⟩ + exact ⟨he, (vertexIncident_iff_mem_tilde J hvV he).mpr hvtilde, hcard⟩ + unfold vertexValency + rw [hset2, hset1, ncard_coe_finset, ncard_coe_finset] + have htilde_eq : ∀ e ∈ E_fin, + (V_fin.filter (fun v => v ∈ tilde e)).card = (tilde e).ncard := by + intro e he + have heE : e ∈ J.E := (hE_mem e).mp he + have hsub : tilde e = ↑(V_fin.filter (fun v => v ∈ tilde e)) := by + ext v + simp only [Finset.mem_coe, Finset.mem_filter, hV_mem] + constructor + · intro hv + have hv' := hv + rw [tilde_eq_closure_inter_V J heE] at hv' + exact ⟨hv'.2, hv⟩ + · exact And.right + conv_rhs => rw [hsub, ncard_coe_finset] + have hsum2 : ∑ v ∈ V_fin, (E₂.filter (fun e => v ∈ tilde e)).card = 2 * E₂.card := by + calc + ∑ v ∈ V_fin, (E₂.filter (fun e => v ∈ tilde e)).card + = ∑ v ∈ V_fin, ∑ e ∈ E₂, if v ∈ tilde e then 1 else 0 := by + refine Finset.sum_congr rfl fun v _ => ?_ + rw [Finset.card_filter] + _ = ∑ e ∈ E₂, ∑ v ∈ V_fin, if v ∈ tilde e then 1 else 0 := Finset.sum_comm + _ = ∑ e ∈ E₂, (V_fin.filter (fun v => v ∈ tilde e)).card := by + refine Finset.sum_congr rfl fun e _ => ?_ + rw [Finset.card_filter] + _ = ∑ e ∈ E₂, 2 := by + refine Finset.sum_congr rfl fun e he => ?_ + have heFin : e ∈ E_fin := (Finset.mem_filter.mp he).1 + have he2 : (tilde e).ncard = 2 := (Finset.mem_filter.mp he).2 + rw [htilde_eq e heFin, he2] + _ = 2 * E₂.card := by + rw [Finset.sum_const, smul_eq_mul, mul_comm] + have hsum1 : ∑ v ∈ V_fin, (E₁.filter (fun e => v ∈ tilde e)).card = E₁.card := by + calc + ∑ v ∈ V_fin, (E₁.filter (fun e => v ∈ tilde e)).card + = ∑ v ∈ V_fin, ∑ e ∈ E₁, if v ∈ tilde e then 1 else 0 := by + refine Finset.sum_congr rfl fun v _ => ?_ + rw [Finset.card_filter] + _ = ∑ e ∈ E₁, ∑ v ∈ V_fin, if v ∈ tilde e then 1 else 0 := Finset.sum_comm + _ = ∑ e ∈ E₁, (V_fin.filter (fun v => v ∈ tilde e)).card := by + refine Finset.sum_congr rfl fun e _ => ?_ + rw [Finset.card_filter] + _ = ∑ e ∈ E₁, 1 := by + refine Finset.sum_congr rfl fun e he => ?_ + have heFin : e ∈ E_fin := (Finset.mem_filter.mp he).1 + have he1 : (tilde e).ncard = 1 := (Finset.mem_filter.mp he).2 + rw [htilde_eq e heFin, he1] + _ = E₁.card := by + rw [Finset.sum_const, smul_eq_mul, mul_one] + have hpart : E₂.card + E₁.card = J.E.ncard := by + have hdisj : Disjoint E₂ E₁ := by + rw [Finset.disjoint_filter] + intro e _ h2 h1 + omega + have hunion : E₂ ∪ E₁ = E_fin := by + ext e + simp only [Finset.mem_union, Finset.mem_filter, E₂, E₁] + constructor + · rintro (⟨he, -⟩ | ⟨he, -⟩) <;> exact he + · intro he + rcases ncard_tilde_of_mem_E J ((hE_mem e).mp he) with h2 | h1 + · exact Or.inl ⟨he, h2⟩ + · exact Or.inr ⟨he, h1⟩ + have hcard_E : E_fin.card = J.E.ncard := by + have : (J.E : Set (Set S)) = ↑E_fin := by + ext e; simp [hE_mem] + rw [this, ncard_coe_finset] + rw [← Finset.card_union_of_disjoint hdisj, hunion, hcard_E] + calc + ∑ v ∈ V_fin, vertexValency J v + = ∑ v ∈ V_fin, + ((E₂.filter (fun e => v ∈ tilde e)).card + + 2 * (E₁.filter (fun e => v ∈ tilde e)).card) := + Finset.sum_congr rfl hval_eq + _ = (∑ v ∈ V_fin, (E₂.filter (fun e => v ∈ tilde e)).card) + + 2 * ∑ v ∈ V_fin, (E₁.filter (fun e => v ∈ tilde e)).card := by + rw [Finset.sum_add_distrib, ← Finset.mul_sum] + _ = 2 * E₂.card + 2 * E₁.card := by rw [hsum2, hsum1] + _ = 2 * (E₂.card + E₁.card) := by ring + _ = 2 * J.E.ncard := by rw [hpart] + +/-- In any drawing `J` where every vertex has valency at least `3`, `3 * J.V.ncard ≤ 2 * J.E.ncard`. +Graph Minors VII, proof of (2.2) (page 216): +"But every vertex of $J$ in $\Sigma'$ has valency $\ge 3$, and so $|V(J)| \le \frac{2}{3} |E(J)|$." +-/ +theorem three_mul_ncard_V_le_two_mul_ncard_E (J : Drawing S) + (hval : ∀ v ∈ J.V, 3 ≤ vertexValency J v) : + 3 * J.V.ncard ≤ 2 * J.E.ncard := by + let V_fin := J.finite_V.toFinset + have hcard_V : V_fin.card = J.V.ncard := by + have : J.V = ↑V_fin := by ext v; simp [V_fin] + rw [this, ncard_coe_finset] + calc + 3 * J.V.ncard = V_fin.card * 3 := by rw [hcard_V, mul_comm] + _ = ∑ _v ∈ V_fin, 3 := by rw [Finset.sum_const, smul_eq_mul] + _ ≤ ∑ v ∈ V_fin, vertexValency J v := by + refine Finset.sum_le_sum fun v hv => hval v ((Finite.mem_toFinset _).mp hv) + _ = 2 * J.E.ncard := sum_vertexValency_eq_two_mul_ncard_E J + +/-- If `S ≃ₜ SurfaceModel a b c` with `2 * a + b + c > 1`, then `S` is connected and not +homeomorphic to `SurfaceModel 0 0 0`, `SurfaceModel 0 0 1`, or `SurfaceModel 0 1 0`. -/ +theorem not_homeo_small_models_of_gt_one {a b c : ℕ} (habc : 2 * a + b + c > 1) + (he : Nonempty (S ≃ₜ SurfaceModel a b c)) : + ConnectedSpace S ∧ + ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 0) ∧ + ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 1) ∧ + ¬ Nonempty (S ≃ₜ SurfaceModel 0 1 0) := by + rcases he with ⟨e⟩ + have : ConnectedSpace (SurfaceModel a b c) := (modelCriterion.1 a b c).2 + have hconn : ConnectedSpace S := e.symm.surjective.connectedSpace e.symm.continuous + refine ⟨hconn, ?_, ?_, ?_⟩ + · rintro ⟨e0⟩ + have hcrit := (modelCriterion.2 a b c 0 0 0).mp ⟨e.symm.trans e0⟩ + omega + · rintro ⟨e1⟩ + have hcrit := (modelCriterion.2 a b c 0 0 1).mp ⟨e.symm.trans e1⟩ + omega + · rintro ⟨e2⟩ + have hcrit := (modelCriterion.2 a b c 0 1 0).mp ⟨e.symm.trans e2⟩ + omega + +/-! ## 3. Augmented seam paths ((2.5)) -/ + +/-- Filtering out all occurrences of `x` from a list `L` reduces `L.countP p` by +`if p x then L.count x else 0`. -/ +private theorem countP_filter_ne_add {β : Type*} [DecidableEq β] (L : List β) (p : β → Bool) + (x : β) : + (L.filter (· != x)).countP p + (if p x then L.count x else 0) = L.countP p := by + induction L with + | nil => simp + | cons a as ih => + by_cases hax : a = x + · subst hax + simp only [List.filter_cons, bne_self_eq_false, Bool.false_eq_true, ↓reduceIte, + List.count_cons_self, List.countP_cons, ← ih] + split_ifs with hpa <;> omega + · have hne : (a != x) = true := bne_iff_ne.mpr hax + simp only [List.filter_cons, hne, ↓reduceIte, List.count_cons_of_ne hax, + List.countP_cons, ← ih] + split_ifs with hpa <;> omega + +/-- Filtering out all occurrences of `x` from a list `L` leaves `count y` unchanged for `y ≠ x` +and `0` for `y = x`. -/ +private theorem count_filter_ne {β : Type*} [DecidableEq β] (L : List β) (x y : β) : + (L.filter (· != x)).count y = if y = x then 0 else L.count y := by + induction L with + | nil => simp + | cons a as ih => + by_cases hax : a = x + · subst hax + simp only [List.filter_cons, bne_self_eq_false, Bool.false_eq_true, ↓reduceIte, ih] + split_ifs with hyx + · rfl + · rw [List.count_cons_of_ne (Ne.symm hyx)] + · have hne : (a != x) = true := bne_iff_ne.mpr hax + simp only [List.filter_cons, hne, ↓reduceIte] + by_cases hya : y = a + · subst hya + simp [hax, List.count_cons_self, ih] + · rw [List.count_cons_of_ne (Ne.symm hya), List.count_cons_of_ne (Ne.symm hya), ih] + +/-- If every element `e` of `L` satisfying `p e = true` occurs an even number of times in `L`, then +`L.countP p` is even. -/ +private theorem even_countP_of_forall_even_count {β : Type*} [DecidableEq β] : + ∀ (n : ℕ) (L : List β) (p : β → Bool), L.length ≤ n → + (∀ e, p e = true → Even (L.count e)) → Even (L.countP p) + | 0, L, p, hlen, _ => by + have hnil : L = [] := List.eq_nil_of_length_eq_zero (Nat.le_zero.mp hlen) + subst hnil + simp + | n + 1, [], p, _, _ => by simp + | n + 1, a :: as, p, hlen, heven => by + let L := a :: as + let L' := L.filter (· != a) + have hlen' : L'.length ≤ n := by + have hsub : L' = as.filter (· != a) := by + simp [L', L] + rw [hsub] + exact (List.length_filter_le _ as).trans (by simpa [L] using hlen) + have heven' : ∀ e, p e = true → Even (L'.count e) := by + intro e hpe + rw [count_filter_ne L a e] + split_ifs with hea + · exact Even.zero + · exact heven e hpe + have ih := even_countP_of_forall_even_count n L' p hlen' heven' + have hsum := countP_filter_ne_add L p a + rw [← hsum] + refine ih.add ?_ + split_ifs with hpa + · exact heven a hpa + · exact Even.zero + +/-- In any multigraph `G`, if there is a walk `W₀` from `a` to `b`, then there is a walk `P` from +`a` to `b` every edge of which occurs an odd number of times in `W₀.edges`. -/ +theorem GraphWalk.exists_odd_count_walk {α : Type u} {β : Type*} [DecidableEq β] + {G : Graph α β} {a b : α} (W₀ : GraphWalk G a b) : + ∃ P : GraphWalk G a b, ∀ e ∈ P.edges, Odd (W₀.edges.count e) := by + classical + let ReachOdd (x : α) : Prop := + ∃ P : GraphWalk G a x, ∀ e ∈ P.edges, Odd (W₀.edges.count e) + let Cross (e : β) : Prop := + ∃ u v : α, G.IsLink e u v ∧ ReachOdd u ∧ ¬ ReachOdd v + have hReach_step : ∀ {e u v}, G.IsLink e u v → Odd (W₀.edges.count e) → + ReachOdd u → ReachOdd v := by + rintro e u v huv hodd ⟨P, hP⟩ + refine ⟨P.append (.cons huv (.nil huv.right_mem)), ?_⟩ + intro e' he' + rw [GraphWalk.edges_append, GraphWalk.edges_cons, GraphWalk.edges_nil, + List.mem_append, List.mem_singleton] at he' + rcases he' with he' | rfl + · exact hP e' he' + · exact hodd + have hCross_even : ∀ e, decide (Cross e) = true → Even (W₀.edges.count e) := by + intro e he + rw [decide_eq_true_iff] at he + rcases he with ⟨u, v, huv, hu, hnv⟩ + rw [← Nat.not_odd_iff_even] + intro hodd + exact hnv (hReach_step huv hodd hu) + have hCross_iff : ∀ {e u v}, G.IsLink e u v → (Cross e ↔ ¬ (ReachOdd u ↔ ReachOdd v)) := by + intro e u v huv + constructor + · rintro ⟨u', v', hu'v', hu', hnv'⟩ hiff + rcases huv.eq_and_eq_or_eq_and_eq hu'v' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hnv' (hiff.mp hu') + · exact hnv' (hiff.mpr hu') + · intro hnot + by_cases hu : ReachOdd u + · have hnv : ¬ ReachOdd v := fun hv => hnot ⟨fun _ => hv, fun _ => hu⟩ + exact ⟨u, v, huv, hu, hnv⟩ + · have hv : ReachOdd v := by + by_contra hnv + exact hnot ⟨fun h => False.elim (hu h), fun h => False.elim (hnv h)⟩ + exact ⟨v, u, huv.symm, hv, hu⟩ + have hprop_odd : ∀ (P Q R : Prop) (n : ℕ), + ¬ (P ↔ Q) → ((Q ↔ R) ↔ Even n) → ((P ↔ R) ↔ Even (n + 1)) := by + intro P Q R n hPQ hQR + rw [Nat.even_add_one, ← hQR] + tauto + have hprop_even : ∀ (P Q R : Prop) (n : ℕ), + (P ↔ Q) → ((Q ↔ R) ↔ Even n) → ((P ↔ R) ↔ Even n) := by + intro P Q R n hPQ hQR + rw [← hQR] + tauto + have hwalk_parity : ∀ {u v : α} (W : GraphWalk G u v), + (ReachOdd u ↔ ReachOdd v) ↔ Even (W.edges.countP (fun e => decide (Cross e))) := by + intro u v W + induction W with + | nil _ => simp + | @cons x y z e hxy r ih => + rw [GraphWalk.edges_cons, List.countP_cons] + have hce := hCross_iff hxy + by_cases hc : Cross e + · have hdec : decide (Cross e) = true := decide_eq_true hc + rw [hdec, ite_eq_left rfl] + exact hprop_odd (ReachOdd x) (ReachOdd y) (ReachOdd z) _ (hce.mp hc) ih + · have hdec : decide (Cross e) = false := decide_eq_false hc + have hxy_iff : ReachOdd x ↔ ReachOdd y := Decidable.of_not_not (mt hce.mpr hc) + rw [hdec, ite_eq_right Bool.false_ne_true, add_zero] + exact hprop_even (ReachOdd x) (ReachOdd y) (ReachOdd z) _ hxy_iff ih + have heven_W₀ : Even (W₀.edges.countP (fun e => decide (Cross e))) := + even_countP_of_forall_even_count W₀.edges.length W₀.edges _ le_rfl hCross_even + have ha_mem : a ∈ G.vertexSet := by + cases W₀ with + | nil h => exact h + | cons h _ => exact h.left_mem + have ha : ReachOdd a := ⟨.nil ha_mem, by simp⟩ + exact ((hwalk_parity W₀).mpr heven_W₀).mp ha + +/-- A continuous injective map on `Ioo (0 : ℝ) 1` into `ℝ` has open image in `ℝ`. -/ +private theorem isOpen_image_Ioo_of_continuousOn_injOn {ψ : ℝ → ℝ} + (hcont : ContinuousOn ψ (Ioo (0 : ℝ) 1)) (hinj : InjOn ψ (Ioo (0 : ℝ) 1)) : + IsOpen (ψ '' Ioo (0 : ℝ) 1) := by + rw [ isOpen_iff_mem_nhds ] + rintro _ ⟨t₁, ht₁, rfl⟩ + let a : ℝ := t₁ / 2 + let b : ℝ := (t₁ + 1) / 2 + have ha_mem : a ∈ Ioo (0 : ℝ) 1 := ⟨by dsimp [a]; linarith [ht₁.1], by dsimp [a]; linarith + [ht₁.2]⟩ + have hb_mem : b ∈ Ioo (0 : ℝ) 1 := ⟨by dsimp [b]; linarith [ht₁.1], by dsimp [b]; linarith + [ht₁.2]⟩ + have hat₁ : a < t₁ := by dsimp [a]; linarith [ht₁.1] + have ht₁b : t₁ < b := by dsimp [b]; linarith [ht₁.2] + have hsub_ab : Icc a b ⊆ Ioo (0 : ℝ) 1 := fun x hx => ⟨lt_of_lt_of_le ha_mem.1 hx.1, + lt_of_le_of_lt hx.2 hb_mem.2⟩ + have hsub_at₁ : Icc a t₁ ⊆ Ioo (0 : ℝ) 1 := fun x hx => hsub_ab ⟨hx.1, hx.2.trans ht₁b.le⟩ + have hsub_t₁b : Icc t₁ b ⊆ Ioo (0 : ℝ) 1 := fun x hx => hsub_ab ⟨hat₁.le.trans hx.1, hx.2⟩ + have hconn_at₁ : IsPreconnected (ψ '' Icc a t₁) := + isPreconnected_Icc.image ψ (hcont.mono hsub_at₁) + have hconn_t₁b : IsPreconnected (ψ '' Icc t₁ b) := + isPreconnected_Icc.image ψ (hcont.mono hsub_t₁b) + have hconn_ab : IsPreconnected (ψ '' Icc a b) := + isPreconnected_Icc.image ψ (hcont.mono hsub_ab) + have hne_at₁ : ψ a ≠ ψ t₁ := fun h => hat₁.ne (hinj ha_mem ht₁ h) + have hne_t₁b : ψ t₁ ≠ ψ b := fun h => ht₁b.ne (hinj ht₁ hb_mem h) + have hmin_lt : min (ψ a) (ψ b) < ψ t₁ := by + by_contra! hle + have hlt : ψ t₁ < min (ψ a) (ψ b) := by + rcases lt_or_gt_of_ne hne_at₁ with h1 | h1 + · linarith [min_le_left (ψ a) (ψ b)] + · rcases lt_or_gt_of_ne hne_t₁b with h2 | h2 + · exact lt_min h1 h2 + · linarith [min_le_right (ψ a) (ψ b)] + have hm1 : min (ψ a) (ψ b) ∈ ψ '' Icc a t₁ := + hconn_at₁.Icc_subset ⟨t₁, ⟨hat₁.le, le_rfl⟩, rfl⟩ ⟨a, ⟨le_rfl, hat₁.le⟩, rfl⟩ + ⟨hlt.le, min_le_left _ _⟩ + have hm2 : min (ψ a) (ψ b) ∈ ψ '' Icc t₁ b := + hconn_t₁b.Icc_subset ⟨t₁, ⟨le_rfl, ht₁b.le⟩, rfl⟩ ⟨b, ⟨ht₁b.le, le_rfl⟩, rfl⟩ + ⟨hlt.le, min_le_right _ _⟩ + rcases hm1 with ⟨x₁, hx₁, hx₁_eq⟩ + rcases hm2 with ⟨x₂, hx₂, hx₂_eq⟩ + have hx12 : x₁ = x₂ := hinj (hsub_at₁ hx₁) (hsub_t₁b hx₂) (hx₁_eq.trans hx₂_eq.symm) + have hxt₁ : x₁ = t₁ := le_antisymm hx₁.2 (hx12 ▸ hx₂.1) + subst hxt₁ + exact hlt.ne hx₁_eq + have hlt_max : ψ t₁ < max (ψ a) (ψ b) := by + by_contra! hge + have hgt : max (ψ a) (ψ b) < ψ t₁ := by + rcases lt_or_gt_of_ne hne_at₁ with h1 | h1 + · rcases lt_or_gt_of_ne hne_t₁b with h2 | h2 + · linarith [le_max_right (ψ a) (ψ b)] + · exact max_lt h1 h2 + · linarith [le_max_left (ψ a) (ψ b)] + have hm1 : max (ψ a) (ψ b) ∈ ψ '' Icc a t₁ := + hconn_at₁.Icc_subset ⟨a, ⟨le_rfl, hat₁.le⟩, rfl⟩ ⟨t₁, ⟨hat₁.le, le_rfl⟩, rfl⟩ + ⟨le_max_left _ _, hgt.le⟩ + have hm2 : max (ψ a) (ψ b) ∈ ψ '' Icc t₁ b := + hconn_t₁b.Icc_subset ⟨b, ⟨ht₁b.le, le_rfl⟩, rfl⟩ ⟨t₁, ⟨le_rfl, ht₁b.le⟩, rfl⟩ + ⟨le_max_right _ _, hgt.le⟩ + rcases hm1 with ⟨x₁, hx₁, hx₁_eq⟩ + rcases hm2 with ⟨x₂, hx₂, hx₂_eq⟩ + have hx12 : x₁ = x₂ := hinj (hsub_at₁ hx₁) (hsub_t₁b hx₂) (hx₁_eq.trans hx₂_eq.symm) + have hxt₁ : x₁ = t₁ := le_antisymm hx₁.2 (hx12 ▸ hx₂.1) + subst hxt₁ + exact hgt.ne hx₁_eq.symm + have hIoo_sub : Ioo (min (ψ a) (ψ b)) (max (ψ a) (ψ b)) ⊆ ψ '' Ioo (0 : ℝ) 1 := by + intro y hy + have hy_img : y ∈ ψ '' Icc a b := by + rcases le_total (ψ a) (ψ b) with hab | hba + · exact hconn_ab.Icc_subset ⟨a, ⟨le_rfl, (hat₁.trans ht₁b).le⟩, rfl⟩ + ⟨b, ⟨(hat₁.trans ht₁b).le, le_rfl⟩, rfl⟩ + ⟨(min_eq_left hab) ▸ hy.1.le, (max_eq_right hab) ▸ hy.2.le⟩ + · exact hconn_ab.Icc_subset ⟨b, ⟨(hat₁.trans ht₁b).le, le_rfl⟩, rfl⟩ + ⟨a, ⟨le_rfl, (hat₁.trans ht₁b).le⟩, rfl⟩ + ⟨(min_eq_right hba) ▸ hy.1.le, (max_eq_left hba) ▸ hy.2.le⟩ + exact image_mono hsub_ab hy_img + exact Filter.mem_of_superset (isOpen_Ioo.mem_nhds ⟨hmin_lt, hlt_max⟩) hIoo_sub + +/-- If `c : C(unitInterval, S)` has `c 0, c 1 ∈ Γ.V`, maps `Ioo (0 : unitInterval) 1` injectively +into `Γ.U \ Γ.V`, then `e = c '' Ioo (0 : unitInterval) 1` is an edge in `Γ.E` linking `c 0` and +`c 1` in `Γ.toGraph`. -/ +theorem Drawing.eq_edge_of_injOn_Ioo [T2Space S] (Γ : Drawing S) (c : C(unitInterval, S)) + (hc0 : c 0 ∈ Γ.V) (hc1 : c 1 ∈ Γ.V) + (hIoo : ∀ t ∈ Ioo (0 : unitInterval) 1, c t ∈ Γ.U \ Γ.V) + (hinj : InjOn c (Ioo (0 : unitInterval) 1)) : + c '' Ioo (0 : unitInterval) 1 ∈ Γ.E ∧ + Γ.toGraph.IsLink (c '' Ioo (0 : unitInterval) 1) (c 0) (c 1) := by + let e := c '' Ioo (0 : unitInterval) 1 + let t₀ : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht₀ : t₀ ∈ Ioo (0 : unitInterval) 1 := by + constructor <;> rw [← Subtype.coe_lt_coe] <;> norm_num [t₀] + have hz₀ : c t₀ ∈ Γ.U \ Γ.V := hIoo t₀ ht₀ + let e₀ := pathComponentIn (Γ.U \ Γ.V) (c t₀) + have he₀E : e₀ ∈ Γ.E := pathComponentIn_mem_arcComponentsIn hz₀ + have hIoo_pc := Net.unitInterval_interior_isPathConnected + have he_pc : IsPathConnected e := hIoo_pc.image c.continuous + have he_sub_UV : e ⊆ Γ.U \ Γ.V := by + rintro _ ⟨t, ht, rfl⟩ + exact hIoo t ht + have he_sub_e₀ : e ⊆ e₀ := he_pc.subset_pathComponentIn ⟨t₀, ht₀, rfl⟩ he_sub_UV + have hcl_e : closure e = e ∪ {c 0, c 1} := by + have hcl1 : closure e = range c := by + apply Subset.antisymm + · exact (isCompact_range c.continuous).isClosed.closure_subset_iff.mpr + (image_subset_range _ _) + · rw [← image_univ, ← Net.unitInterval_interior_closure] + exact image_closure_subset_closure_image c.continuous + rw [hcl1] + ext z + simp only [e, mem_range, mem_union, mem_image, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨t, rfl⟩ + rcases Net.unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact Or.inr (Or.inl rfl) + · exact Or.inr (Or.inr rfl) + · exact Or.inl ⟨t, ht, rfl⟩ + · rintro (⟨t, ht, rfl⟩ | rfl | rfl) + · exact ⟨t, rfl⟩ + · exact ⟨0, rfl⟩ + · exact ⟨1, rfl⟩ + have he₀_sub : e₀ ⊆ Γ.U \ Γ.V := pathComponentIn_subset + obtain ⟨γ₀, hγ₀_cont, hγ₀0, hγ₀1, hγ₀_inj, hγ₀_img⟩ := GM11.exists_edge_param Γ he₀E + let g₀ : Ioo (0 : unitInterval) 1 → e₀ := fun t => + ⟨γ₀ t.1, hγ₀_img ▸ ⟨t.1, t.2, rfl⟩⟩ + have hg₀_cont : Continuous g₀ := by fun_prop + have hg₀_inj : Function.Injective g₀ := by + intro t₁ t₂ h12 + ext + exact congr_arg Subtype.val (hγ₀_inj t₁.2 t₂.2 (congr_arg Subtype.val h12)) + have hg₀_surj : Function.Surjective g₀ := by + rintro ⟨z, hz⟩ + rw [← hγ₀_img] at hz + rcases hz with ⟨t, ht, rfl⟩ + exact ⟨⟨t, ht⟩, rfl⟩ + have hg₀_closed : IsClosedMap g₀ := by + intro F hF + rw [isClosed_induced_iff] at hF + rcases hF with ⟨K, hK, rfl⟩ + have hγK_closed : IsClosed (γ₀ '' K) := hγ₀_cont.isClosedMap K hK + have himg_eq : g₀ '' (Subtype.val ⁻¹' K) = Subtype.val ⁻¹' (γ₀ '' K) := by + ext ⟨z, hz⟩ + simp only [mem_image, mem_preimage] + constructor + · rintro ⟨⟨t, ht⟩, htK, htz⟩ + exact ⟨t, htK, congr_arg Subtype.val htz⟩ + · rintro ⟨s, hsK, rfl⟩ + rcases Net.unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs + · exact False.elim ((he₀_sub hz).2 hγ₀0) + · exact False.elim ((he₀_sub hz).2 hγ₀1) + · exact ⟨⟨s, hs⟩, hsK, rfl⟩ + rw [himg_eq] + exact hγK_closed.preimage continuous_subtype_val + let φ : e₀ ≃ₜ Ioo (0 : unitInterval) 1 := + ((Equiv.ofBijective g₀ ⟨hg₀_inj, hg₀_surj⟩).toHomeomorphOfContinuousClosed hg₀_cont + hg₀_closed).symm + let S_e : Set e₀ := Subtype.val ⁻¹' e + have hS_closed : IsClosed S_e := by + have heq : S_e = Subtype.val ⁻¹' closure e := by + ext ⟨z, hz⟩ + simp only [S_e, mem_preimage, hcl_e, mem_union, mem_insert_iff, mem_singleton_iff] + constructor + · exact Or.inl + · rintro (hze | rfl | rfl) + · exact hze + · exact False.elim ((he₀_sub hz).2 hc0) + · exact False.elim ((he₀_sub hz).2 hc1) + rw [heq] + exact isClosed_closure.preimage continuous_subtype_val + have hS_open : IsOpen S_e := by + let g_sub : Ioo (0 : ℝ) 1 → ℝ := fun r => + ((φ ⟨c ⟨r.1, r.2.1.le, r.2.2.le⟩, + he_sub_e₀ ⟨⟨r.1, r.2.1.le, r.2.2.le⟩, + ⟨Subtype.coe_lt_coe.mp r.2.1, Subtype.coe_lt_coe.mp r.2.2⟩, rfl⟩⟩).1 : ℝ) + have hg_cont : Continuous g_sub := by fun_prop + let ψ : ℝ → ℝ := fun r => + if hr : r ∈ Ioo (0 : ℝ) 1 then g_sub ⟨r, hr⟩ else 0 + have hψ_eq : (Ioo (0 : ℝ) 1).domRestrict ψ = g_sub := by + ext r + change (if hr : r.1 ∈ Ioo (0 : ℝ) 1 then g_sub ⟨r.1, hr⟩ else 0) = g_sub r + exact dite_eq_left r.2 + have hψ_cont : ContinuousOn ψ (Ioo (0 : ℝ) 1) := by + rw [continuousOn_iff_continuous_domRestrict, hψ_eq] + exact hg_cont + have hψ_inj : InjOn ψ (Ioo (0 : ℝ) 1) := by + intro r₁ hr₁ r₂ hr₂ h12 + have h12' : g_sub ⟨r₁, hr₁⟩ = g_sub ⟨r₂, hr₂⟩ := by + simpa only [ψ, dite_eq_left hr₁, dite_eq_left hr₂] using h12 + have hφ_eq : φ ⟨c ⟨r₁, hr₁.1.le, hr₁.2.le⟩, _⟩ = φ ⟨c ⟨r₂, hr₂.1.le, hr₂.2.le⟩, _⟩ := + Subtype.ext (Subtype.ext h12') + have hc_eq : c ⟨r₁, hr₁.1.le, hr₁.2.le⟩ = c ⟨r₂, hr₂.1.le, hr₂.2.le⟩ := + congr_arg Subtype.val (φ.injective hφ_eq) + have ht_eq : (⟨r₁, hr₁.1.le, hr₁.2.le⟩ : unitInterval) = ⟨r₂, hr₂.1.le, hr₂.2.le⟩ := + hinj ⟨Subtype.coe_lt_coe.mp hr₁.1, Subtype.coe_lt_coe.mp hr₁.2⟩ + ⟨Subtype.coe_lt_coe.mp hr₂.1, Subtype.coe_lt_coe.mp hr₂.2⟩ hc_eq + exact congr_arg Subtype.val ht_eq + have hopen_img : IsOpen (ψ '' Ioo (0 : ℝ) 1) := + isOpen_image_Ioo_of_continuousOn_injOn hψ_cont hψ_inj + have hSe_eq : S_e = (fun x : e₀ => ((φ x).1 : ℝ)) ⁻¹' (ψ '' Ioo (0 : ℝ) 1) := by + ext ⟨z, hz⟩ + simp only [S_e, mem_preimage, mem_image] + constructor + · rintro ⟨t, ht, rfl⟩ + have ht_real : (t : ℝ) ∈ Ioo (0 : ℝ) 1 := + ⟨Subtype.coe_lt_coe.mpr ht.1, Subtype.coe_lt_coe.mpr ht.2⟩ + refine ⟨(t : ℝ), ht_real, ?_⟩ + change (if hr : (t : ℝ) ∈ Ioo (0 : ℝ) 1 then g_sub ⟨t, hr⟩ else 0) = ((φ ⟨c t, hz⟩).1 : ℝ) + exact dite_eq_left ht_real + · rintro ⟨r, hr, hrz⟩ + have hrz' : g_sub ⟨r, hr⟩ = ((φ ⟨z, hz⟩).1 : ℝ) := by + simpa only [ψ, dite_eq_left hr] using hrz + have hφ_eq : φ ⟨c ⟨r, hr.1.le, hr.2.le⟩, _⟩ = φ ⟨z, hz⟩ := + Subtype.ext (Subtype.ext hrz') + have hc_eq : c ⟨r, hr.1.le, hr.2.le⟩ = z := congr_arg Subtype.val (φ.injective hφ_eq) + exact ⟨⟨r, hr.1.le, hr.2.le⟩, + ⟨Subtype.coe_lt_coe.mp hr.1, Subtype.coe_lt_coe.mp hr.2⟩, hc_eq⟩ + rw [hSe_eq] + exact hopen_img.preimage (by fun_prop) + have hconn_e₀ : ConnectedSpace e₀ := + Subtype.connectedSpace ((isPathConnected_pathComponentIn hz₀).isConnected) + have hSe_nonempty : S_e.Nonempty := + ⟨⟨c t₀, mem_pathComponentIn_self hz₀⟩, ⟨t₀, ht₀, rfl⟩⟩ + have hSe_univ : S_e = univ := IsClopen.eq_univ ⟨hS_closed, hS_open⟩ hSe_nonempty + have he_eq_e₀ : e = e₀ := by + apply Subset.antisymm he_sub_e₀ + intro z hz + have hmem : (⟨z, hz⟩ : e₀) ∈ S_e := by rw [hSe_univ]; trivial + exact hmem + have heE : e ∈ Γ.E := he_eq_e₀.symm ▸ he₀E + refine ⟨heE, heE, hc0, hc1, ?_⟩ + rw [hcl_e] + ext z + simp only [mem_inter_iff, mem_union, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨hze | rfl | rfl, hzV⟩ + · exact False.elim ((he_sub_UV hze).2 hzV) + · exact Or.inl rfl + · exact Or.inr rfl + · rintro (rfl | rfl) + · exact ⟨Or.inr (Or.inl rfl), hc0⟩ + · exact ⟨Or.inr (Or.inr rfl), hc1⟩ + +/-- Assembling a sequence of `n` consecutive links `(v i.castSucc, e i, v i.succ)` into a walk +`W : GraphWalk G (v 0) (v (Fin.last n))` with `W.edges = List.ofFn e`. -/ +theorem GraphWalk.exists_ofFn_edges {α : Type u} {β : Type*} {G : Graph α β} : + ∀ (n : ℕ) (v : Fin (n + 1) → α) (e : Fin n → β), + v 0 ∈ G.vertexSet → + (∀ i : Fin n, G.IsLink (e i) (v i.castSucc) (v i.succ)) → + ∃ W : GraphWalk G (v 0) (v (Fin.last n)), W.edges = List.ofFn e + | 0, v, e, hv0, _ => ⟨.nil hv0, rfl⟩ + | n + 1, v, e, _, hlink => by + obtain ⟨W', hW'⟩ := GraphWalk.exists_ofFn_edges n (fun i => v i.succ) (fun i => e i.succ) + (hlink 0).right_mem (fun i => hlink i.succ) + have h0 : G.IsLink (e 0) (v 0) (v (Fin.succ 0)) := by simpa using hlink 0 + exact ⟨.cons h0 W', by rw [GraphWalk.edges_cons, hW', List.ofFn_succ]⟩ + +/-- If `f : α → β` takes the value `e` on `L : List α` only at `p₁` and `p₂` (`p₁ ≠ p₂`), then +`(L.map f).count e = L.count p₁ + L.count p₂`. -/ +private theorem count_map_eq_add_of_iff_pair {α β : Type*} [DecidableEq α] [DecidableEq β] + (L : List α) (f : α → β) (e : β) {p₁ p₂ : α} (hp12 : p₁ ≠ p₂) + (hiff : ∀ p : α, f p = e ↔ p = p₁ ∨ p = p₂) : + (L.map f).count e = L.count p₁ + L.count p₂ := by + induction L with + | nil => simp + | cons a as ih => + by_cases ha1 : a = p₁ + · subst ha1 + have hfa : f a = e := (hiff a).mpr (Or.inl rfl) + rw [List.map_cons, hfa, List.count_cons_self, List.count_cons_self, + List.count_cons_of_ne hp12, ih] + omega + · by_cases ha2 : a = p₂ + · subst ha2 + have hfa : f a = e := (hiff a).mpr (Or.inr rfl) + rw [List.map_cons, hfa, List.count_cons_self, List.count_cons_of_ne (Ne.symm hp12), + List.count_cons_self, ih] + omega + · have hfa : f a ≠ e := fun h => by + rcases (hiff a).mp h with rfl | rfl + · exact ha1 rfl + · exact ha2 rfl + rw [List.map_cons, List.count_cons_of_ne hfa, List.count_cons_of_ne ha1, + List.count_cons_of_ne ha2, ih] + +/-- If `f : Fin m → β` equals `e` at exactly two distinct indices `p₁ ≠ p₂`, then +`(List.ofFn f).count e = 2`. -/ +private theorem count_ofFn_eq_two {m : ℕ} {β : Type*} [DecidableEq β] + (f : Fin m → β) (e : β) {p₁ p₂ : Fin m} (hp12 : p₁ ≠ p₂) + (hiff : ∀ p : Fin m, f p = e ↔ p = p₁ ∨ p = p₂) : + (List.ofFn f).count e = 2 := by + rw [List.ofFn_eq_map, count_map_eq_add_of_iff_pair (List.finRange m) f e hp12 hiff, + List.count_eq_one_of_mem (List.nodup_finRange m) (List.mem_finRange p₁), + List.count_eq_one_of_mem (List.nodup_finRange m) (List.mem_finRange p₂)] + +/-- Given `τ : ℕ → ℝ` with `τ 0 = 0`, `τ m = 1`, and `∀ p < m, τ p < τ (p + 1)`, every +`x ∈ Ioo (0 : ℝ) 1` with `∀ p ≤ m, x ≠ τ p` belongs to `Ioo (τ p.1) (τ (p.1 + 1))` for a unique +`p : Fin m`. -/ +private theorem exists_unique_interval_of_sorted {m : ℕ} {τ : ℕ → ℝ} + (hτ0 : τ 0 = 0) (hτm : τ m = 1) (hτ_lt : ∀ p < m, τ p < τ (p + 1)) : + (∀ {a b : ℕ}, a < b → b ≤ m → τ a < τ b) ∧ + (∀ {x : ℝ}, x ∈ Ioo (0 : ℝ) 1 → (∀ p ≤ m, x ≠ τ p) → + ∃ p : Fin m, x ∈ Ioo (τ p.1) (τ (p.1 + 1)) ∧ + ∀ q : Fin m, x ∈ Ioo (τ q.1) (τ (q.1 + 1)) → q = p) := by + have hmono : ∀ {a b : ℕ}, a < b → b ≤ m → τ a < τ b := by + intro a b hab hbm + induction b with + | zero => omega + | succ k ih => + rcases Nat.eq_or_lt_of_le (Nat.le_of_lt_succ hab) with rfl | hlt + · exact hτ_lt a (Nat.lt_of_succ_le hbm) + · exact (ih hlt (Nat.le_of_succ_le hbm)).trans (hτ_lt k (Nat.lt_of_succ_le hbm)) + refine ⟨hmono, ?_⟩ + intro x hx hx_ne + have hex : ∀ k ≤ m, τ 0 < x → x < τ k → ∃ p < k, x ∈ Ioo (τ p) (τ (p + 1)) := by + intro k hk h0x hxk + induction k with + | zero => exact False.elim ((h0x.trans hxk).ne rfl) + | succ n ih => + rcases lt_or_gt_of_ne (hx_ne n (Nat.le_of_succ_le hk)) with hlt | hgt + · obtain ⟨p, hp, hpx⟩ := ih (Nat.le_of_succ_le hk) hlt + exact ⟨p, Nat.lt_succ_of_lt hp, hpx⟩ + · exact ⟨n, Nat.lt_succ_self n, ⟨hgt, hxk⟩⟩ + obtain ⟨p, hpm, hpx⟩ := hex m le_rfl (hτ0 ▸ hx.1) (hτm ▸ hx.2) + refine ⟨⟨p, hpm⟩, hpx, ?_⟩ + intro q hqx + ext + by_contra hne + rcases lt_or_gt_of_ne hne with hlt | hgt + · have hle : τ (q.1 + 1) ≤ τ p := by + rcases eq_or_lt_of_le (Nat.succ_le_of_lt hlt) with heq | hlt' + · exact (congr_arg τ heq).le + · exact (hmono hlt' hpm.le).le + linarith [hqx.2, hpx.1] + · have hle : τ (p + 1) ≤ τ q.1 := by + rcases eq_or_lt_of_le (Nat.succ_le_of_lt hgt) with heq | hlt' + · exact (congr_arg τ heq).le + · exact (hmono hlt' q.2.le).le + linarith [hpx.2, hqx.1] + +private theorem boundary_arc_interior_image + {S : Type u} + [TopologicalSpace S] + (N : Net S) + {s : N.D} + {t : N.D} + {C₁ : Set N.D} + (hC₁_sub : C₁ ⊆ bd N.D \ {s, t}) + (f_C₁ : ↑unitInterval ≃ₜ ↑(C₁ ∪ {s, t})) + (hγ0 : (f_C₁ 0).1 = s) + (hγ1 : (f_C₁ 1).1 = t) + (hγ_inj : Function.Injective (Subtype.val ∘ f_C₁)) : + (Subtype.val ∘ f_C₁) '' Ioo (0 : unitInterval) 1 = C₁ := by + let γ : unitInterval → N.D := Subtype.val ∘ f_C₁ + change γ '' Ioo 0 1 = C₁ + ext x + simp only [mem_image] + constructor + · rintro ⟨u, hu, rfl⟩ + change (f_C₁ u).1 ∈ C₁ + rcases (f_C₁ u).2 with huC₁ | h0 | h1 + · exact huC₁ + · exact False.elim (hu.1.ne (hγ_inj (h0.trans hγ0.symm)).symm) + · exact False.elim (hu.2.ne (hγ_inj ((mem_singleton_iff.mp h1).trans hγ1.symm))) + · intro hx + let u := f_C₁.symm ⟨x, Or.inl hx⟩ + have hγu : γ u = x := by simp [γ, u] + have hu_Ioo : u ∈ Ioo (0 : unitInterval) 1 := by + rcases Net.unitInterval_eq_zero_or_one_or_mem_Ioo u with hu0 | hu1 | hu + · exfalso + exact (hC₁_sub hx).2 (Or.inl (hγu.symm.trans (hu0 ▸ hγ0))) + · exfalso + exact (hC₁_sub hx).2 (Or.inr (mem_singleton_iff.mpr (hγu.symm.trans (hu1 ▸ hγ1)))) + · exact hu + exact ⟨u, hu_Ioo, hγu⟩ + +private theorem affine_subinterval_interior_image + (m : ℕ) + (τ : ℕ → ℝ) + (hτ_lt : ∀ p < m, τ p < τ (p + 1)) + (α_fn : Fin m → C(unitInterval, unitInterval)) + (hα : ∀ (p : Fin m) (u : unitInterval), + (α_fn p u : ℝ) = (1 - u.1) * τ p.1 + u.1 * τ (p.1 + 1)) : + ∀ (p : Fin m), α_fn p '' Ioo (0 : unitInterval) 1 = + {q : unitInterval | q.1 ∈ Ioo (τ p.1) (τ (p.1 + 1))} := by + intro p + have hlt : τ p.1 < τ (p.1 + 1) := hτ_lt p.1 p.2 + ext q + simp only [mem_image, mem_Ioo, mem_ofPred] + constructor + · rintro ⟨u, ⟨hu0, hu1⟩, rfl⟩ + have hu0' : (0 : ℝ) < u.1 := Subtype.coe_lt_coe.mpr hu0 + have hu1' : u.1 < 1 := Subtype.coe_lt_coe.mpr hu1 + rw [hα] + exact ⟨by nlinarith, by nlinarith⟩ + · rintro ⟨hq0, hq1⟩ + have hpos : 0 < τ (p.1 + 1) - τ p.1 := sub_pos.mpr hlt + have hu0 : 0 < (q.1 - τ p.1) / (τ (p.1 + 1) - τ p.1) := + div_pos (sub_pos.mpr hq0) hpos + have hu1 : (q.1 - τ p.1) / (τ (p.1 + 1) - τ p.1) < 1 := + (div_lt_one hpos).mpr (by linarith) + let u : unitInterval := ⟨(q.1 - τ p.1) / (τ (p.1 + 1) - τ p.1), ⟨hu0.le, hu1.le⟩⟩ + refine ⟨u, ⟨Subtype.coe_lt_coe.mp hu0, Subtype.coe_lt_coe.mp hu1⟩, ?_⟩ + ext + rw [hα] + dsimp [u] + have hne : τ (p.1 + 1) - τ p.1 ≠ 0 := hpos.ne' + field_simp + ring + +private theorem boundary_segment_maps_to_edge + {S : Type u} + [TopologicalSpace S] + (N : Net S) + (J : Drawing S) + (J' : Drawing S) + (hSeam : N.IsSeamGraphFor J) + (hJ'U : J'.U = J.U) + [T2Space S] + (γ : C(↑unitInterval, N.D)) + (hγ_inj : Function.Injective ⇑γ) + (α : C(unitInterval, unitInterval)) + (hα_inj : Function.Injective α) + (hU_disj_V : Disjoint ((γ ∘ α) '' Ioo (0 : unitInterval) 1) (N.φ ⁻¹' J'.V)) + (hU_bd : (γ ∘ α) '' Ioo (0 : unitInterval) 1 ⊆ bd N.D) + (hU_injOn : InjOn N.φ ((γ ∘ α) '' Ioo (0 : unitInterval) 1)) + (h0 : N.φ (γ (α 0)) ∈ J'.V) (h1 : N.φ (γ (α 1)) ∈ J'.V) : + let c : C(unitInterval, S) := ⟨N.φ ∘ γ ∘ α, + N.quotientMap_φ.continuous.comp (γ.continuous.comp α.continuous)⟩ + c '' Ioo (0 : unitInterval) 1 ∈ J'.E ∧ + J'.toGraph.IsLink (c '' Ioo (0 : unitInterval) 1) (c 0) (c 1) := by + intro c + let U := (γ ∘ α) '' Ioo (0 : unitInterval) 1 + have hc_Ioo : ∀ u ∈ Ioo (0 : unitInterval) 1, c u ∈ J'.U \ J'.V := by + intro u hu + have hxU : γ (α u) ∈ U := ⟨u, hu, rfl⟩ + refine ⟨?_, Disjoint.notMem_of_mem_left hU_disj_V hxU⟩ + rw [hJ'U, hSeam.2.1] + exact ⟨γ (α u), hU_bd hxU, rfl⟩ + have hc_inj : InjOn c (Ioo (0 : unitInterval) 1) := by + intro u₁ hu₁ u₂ hu₂ h12 + have hx_eq : γ (α u₁) = γ (α u₂) := + hU_injOn ⟨u₁, hu₁, rfl⟩ ⟨u₂, hu₂, rfl⟩ h12 + exact hα_inj (hγ_inj hx_eq) + exact Drawing.eq_edge_of_injOn_Ioo J' c h0 h1 hc_Ioo hc_inj + +private theorem unique_arc_segment_away_from_vertices + {S : Type u} + [TopologicalSpace S] + (N : Net S) + (J' : Drawing S) + {C₁ : Set N.D} + (γ : C(↑unitInterval, N.D)) + (hγ_inj : Function.Injective ⇑γ) + (hγ_Ioo : ⇑γ '' Ioo 0 1 = C₁) + (m : ℕ) + (τ : ℕ → ℝ) + (hτ_unique : ∀ {x : ℝ}, x ∈ Ioo 0 1 → (∀ p ≤ m, x ≠ τ p) → + ∃ p : Fin m, x ∈ Ioo (τ p.1) (τ (p.1 + 1)) ∧ + ∀ q : Fin m, x ∈ Ioo (τ q.1) (τ (q.1 + 1)) → q = p) + (τ_I : (p : ℕ) → p ≤ m → unitInterval) + (hτ_I : ∀ (p : ℕ) (hp : p ≤ m), (τ_I p hp : ℝ) = τ p) + (hτ_V : ∀ (p : ℕ) (hp : p ≤ m), N.φ (γ (τ_I p hp)) ∈ J'.V) + (U_fn : Fin m → Set N.D) + (hU_eq : ∀ (p : Fin m), U_fn p = ⇑γ '' {q | ↑q ∈ Ioo (τ ↑p) (τ (↑p + 1))}) : + ∀ y ∈ C₁, N.φ y ∉ J'.V → ∃ p, ∀ (q : Fin m), y ∈ U_fn q ↔ q = p := by + intro y hyC₁ hyV + rw [← hγ_Ioo] at hyC₁ + rcases hyC₁ with ⟨q₀, hq₀, rfl⟩ + have hq₀_real : (q₀ : ℝ) ∈ Ioo (0 : ℝ) 1 := + ⟨Subtype.coe_lt_coe.mpr hq₀.1, Subtype.coe_lt_coe.mpr hq₀.2⟩ + have hq₀_ne : ∀ p ≤ m, (q₀ : ℝ) ≠ τ p := by + intro p hp h_eq + have hq_τ : q₀ = τ_I p hp := Subtype.ext (h_eq.trans (hτ_I p hp).symm) + exact hyV (hq_τ ▸ hτ_V p hp) + obtain ⟨p, hp_mem, hp_uniq⟩ := hτ_unique hq₀_real hq₀_ne + refine ⟨p, fun q => ?_⟩ + rw [hU_eq q] + constructor + · rintro ⟨q', hq', hγ_eq⟩ + have hqq' : q' = q₀ := hγ_inj hγ_eq + subst hqq' + exact hp_uniq q hq' + · rintro rfl + exact ⟨q₀, hp_mem, rfl⟩ + +private theorem edge_subdivision_indices_of_fiber + {S : Type u} + [TopologicalSpace S] + (N : Net S) + (J' : Drawing S) + (m : ℕ) + (U_fn : Fin m → Set N.D) + (e_fn : Fin m → Set S) + (he_eq_φU : ∀ (p : Fin m), e_fn p = N.φ '' U_fn p) + (he_edge : ∀ p : Fin m, e_fn p ∈ J'.E) + (p₀ : Fin m) + (z₀ : S) + (hz₀_e : z₀ ∈ e_fn p₀) + (i : Fin N.r) + (w : ↑unitInterval) + (hφw : N.φ ((N.f i) w) = z₀) + (hfiber : N.φ ⁻¹' {z₀} = {(N.f i) w, (N.g i) w}) + (p₁ : Fin m) + (hp₁ : ∀ (q : Fin m), (N.f i) w ∈ U_fn q ↔ q = p₁) + (p₂ : Fin m) + (hp₂ : ∀ (q : Fin m), (N.g i) w ∈ U_fn q ↔ q = p₂) + : + ∀ (p : Fin m), e_fn p = e_fn p₀ ↔ p = p₁ ∨ p = p₂ := by + intro p + have hz₀_iff : e_fn p = e_fn p₀ ↔ z₀ ∈ e_fn p := by + constructor + · intro h; exact h.symm ▸ hz₀_e + · intro hz_p + exact J'.edge_eq_of_mem (he_edge p) (he_edge p₀) hz_p hz₀_e + rw [hz₀_iff, he_eq_φU p] + constructor + · rintro ⟨y, hyU, hyz⟩ + have hy_fg : y ∈ ({N.f i w, N.g i w} : Set N.D) := hfiber ▸ hyz + rcases hy_fg with rfl | rfl + · exact Or.inl ((hp₁ p).mp hyU) + · exact Or.inr ((hp₂ p).mp hyU) + · rintro (rfl | rfl) + · exact ⟨N.f i w, (hp₁ p).mpr rfl, hφw⟩ + · exact ⟨N.g i w, (hp₂ p).mpr rfl, (N.φ_f_eq_φ_g i w).symm.trans hφw⟩ + +/-- Graph Minors VII, (2.5) (page 217): +"(2.5) *There is a path of $J'$ between $\phi(s)$ and $\phi(t)$ with no edges of type (iii) or +(iv).*" -/ +theorem exists_path_no_type3_type4 [T1Space S] (hS : IsSurface S) (N : Net S) (J J' : Drawing S) + (hSeam : N.IsSeamGraphFor J) {s t : N.D} (hs : s ∈ bd N.D) (ht : t ∈ bd N.D) (hst : s ≠ t) + {C₁ C₂ : Set N.D} (hcomp : componentsIn (bd N.D \ {s, t}) = {C₁, C₂}) (hC12 : C₁ ≠ C₂) + (hJ'U : J'.U = J.U) (hJ'V : J'.V = J.V ∪ {N.φ s, N.φ t}) : + ∃ P : Drawing S, P.IsSubdrawing J' ∧ P.IsPathBetween (N.φ s) (N.φ t) ∧ + ∀ e ∈ P.E, ¬ IsNetEdgeType3 N C₁ e ∧ ¬ IsNetEdgeType4 N C₂ e := by + have : T2Space S := hS.2.1 + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + -- Step 1: Parametrize `C₁ ∪ {s, t}` by `γ : C(unitInterval, N.D)` with ends `s, t`. + obtain ⟨B₁, B₂, hcomp_B, hdisj_B, hunion_B, hline_B₁, hline_B₂⟩ := + Net.oArc_components_diff_pair N.isOArc_bd_D hs ht hst + have hpair_eq : ({C₁, C₂} : Set (Set N.D)) = {B₁, B₂} := hcomp.symm.trans hcomp_B + have hC₁_mem : C₁ ∈ ({B₁, B₂} : Set (Set N.D)) := hpair_eq ▸ Or.inl rfl + have hC₂_mem : C₂ ∈ ({B₁, B₂} : Set (Set N.D)) := hpair_eq ▸ Or.inr rfl + have hC₁_props : Disjoint C₁ C₂ ∧ C₁ ⊆ bd N.D \ {s, t} ∧ IsLineWithEnds (C₁ ∪ {s, t}) s t := by + rcases hC₁_mem with rfl | rfl <;> rcases hC₂_mem with rfl | rfl + · exact False.elim (hC12 rfl) + · exact ⟨hdisj_B, fun x hx => hunion_B ▸ Or.inl hx, hline_B₁⟩ + · exact ⟨hdisj_B.symm, fun x hx => hunion_B ▸ Or.inr hx, hline_B₂⟩ + · exact False.elim (hC12 rfl) + rcases hC₁_props with ⟨hdisj_C12, hC₁_sub, f_C₁, hf0, hf1⟩ + let γ : C(unitInterval, N.D) := ⟨Subtype.val ∘ f_C₁, continuous_subtype_val.comp f_C₁.continuous⟩ + have hγ0 : γ 0 = s := hf0 + have hγ1 : γ 1 = t := hf1 + have hγ_inj : Function.Injective γ := fun u v h => f_C₁.injective (Subtype.ext h) + have hγ_bd : range γ ⊆ bd N.D := by + rintro _ ⟨u, rfl⟩ + change (f_C₁ u).1 ∈ bd N.D + rcases (f_C₁ u).2 with hu | hus | hut + · exact (hC₁_sub hu).1 + · rw [hus]; exact hs + · rw [mem_singleton_iff.mp hut]; exact ht + have hγ_Ioo : γ '' Ioo (0 : unitInterval) 1 = C₁ := by + exact boundary_arc_interior_image (S := S) N (s := s) (t := t) (C₁ := C₁) hC₁_sub f_C₁ hγ0 + hγ1 hγ_inj + -- Step 2: Subdivide `[0, 1]` at the finite set `T` of preimages of `J'.V` under `N.φ ∘ γ`. + let T_I : Set unitInterval := γ ⁻¹' (N.φ ⁻¹' J'.V) + have hTI_fin : T_I.Finite := (N.finite_preimage J'.finite_V).preimage hγ_inj.injOn + let T : Set ℝ := Subtype.val '' T_I + have hT_fin : T.Finite := hTI_fin.image _ + have hT_sub : T ⊆ Icc (0 : ℝ) 1 := by + rintro _ ⟨u, _, rfl⟩ + exact u.2 + have hφs_V : N.φ s ∈ J'.V := by rw [hJ'V]; exact Or.inr (Or.inl rfl) + have hφt_V : N.φ t ∈ J'.V := by rw [hJ'V]; exact Or.inr (Or.inr rfl) + have h0_T : (0 : ℝ) ∈ T := ⟨0, by simpa [T_I, hγ0] using hφs_V, rfl⟩ + have h1_T : (1 : ℝ) ∈ T := ⟨1, by simpa [T_I, hγ1] using hφt_V, rfl⟩ + obtain ⟨m, τ, _, hτ0, hτm, hτ_lt, hτ_mem, hτ_no, hτ_all⟩ := + exists_sorted hT_fin hT_sub h0_T h1_T + obtain ⟨hτ_mono, hτ_unique⟩ := exists_unique_interval_of_sorted hτ0 hτm hτ_lt + have hτ_Icc : ∀ p ≤ m, τ p ∈ Icc (0 : ℝ) 1 := fun p hp => hT_sub (hτ_mem p hp) + let τ_I : (p : ℕ) → p ≤ m → unitInterval := fun p hp => ⟨τ p, hτ_Icc p hp⟩ + have hτ_V : ∀ p (hp : p ≤ m), N.φ (γ (τ_I p hp)) ∈ J'.V := by + intro p hp + rcases hτ_mem p hp with ⟨u, hu, hu_eq⟩ + have hu' : u = τ_I p hp := Subtype.ext hu_eq + exact hu' ▸ hu + -- Step 3: On each open subinterval `(τ p, τ (p + 1))`, `N.φ ∘ γ` traces an edge `e_fn p ∈ J'.E`. + let α_fn (p : Fin m) : C(unitInterval, unitInterval) := + ⟨fun u => ⟨(1 - u.1) * τ p.1 + u.1 * τ (p.1 + 1), by + have hp0 := (hτ_Icc p.1 p.2.le).1 + have hp1 := (hτ_Icc (p.1 + 1) p.2).2 + have hlt := (hτ_lt p.1 p.2).le + have hu0 := u.2.1 + have hu1 := u.2.2 + exact ⟨by nlinarith, by nlinarith⟩⟩, by fun_prop⟩ + have hα0 : ∀ p : Fin m, α_fn p 0 = τ_I p.1 p.2.le := by + intro p; ext; simp [α_fn, τ_I] + have hα1 : ∀ p : Fin m, α_fn p 1 = τ_I (p.1 + 1) p.2 := by + intro p; ext; simp [α_fn, τ_I] + have hα_inj : ∀ p : Fin m, Function.Injective (α_fn p) := by + intro p u₁ u₂ h12 + have hval : (1 - u₁.1) * τ p.1 + u₁.1 * τ (p.1 + 1) = + (1 - u₂.1) * τ p.1 + u₂.1 * τ (p.1 + 1) := congr_arg Subtype.val h12 + have hlt : τ p.1 < τ (p.1 + 1) := hτ_lt p.1 p.2 + ext + nlinarith + have hα_Ioo : ∀ p : Fin m, + α_fn p '' Ioo (0 : unitInterval) 1 = + {q : unitInterval | q.1 ∈ Ioo (τ p.1) (τ (p.1 + 1))} := by + exact affine_subinterval_interior_image m τ hτ_lt α_fn (fun _ _ => rfl) + let U_fn (p : Fin m) : Set N.D := (γ ∘ α_fn p) '' Ioo (0 : unitInterval) 1 + have hU_eq : ∀ p : Fin m, + U_fn p = γ '' {q : unitInterval | q.1 ∈ Ioo (τ p.1) (τ (p.1 + 1))} := by + intro p + dsimp only [U_fn] + rw [image_comp, hα_Ioo p] + have hU_sub_C₁ : ∀ p : Fin m, U_fn p ⊆ C₁ := by + intro p + rw [hU_eq p, ← hγ_Ioo] + refine image_mono fun q hq => ?_ + have hp0 := (hτ_Icc p.1 p.2.le).1 + have hp1 := (hτ_Icc (p.1 + 1) p.2).2 + exact ⟨Subtype.coe_lt_coe.mp (lt_of_le_of_lt hp0 hq.1), + Subtype.coe_lt_coe.mp (lt_of_lt_of_le hq.2 hp1)⟩ + have hU_disj_V : ∀ p : Fin m, Disjoint (U_fn p) (N.φ ⁻¹' J'.V) := by + intro p + rw [disjoint_left] + rintro _ ⟨u, hu, rfl⟩ hφV + have hmem_T : (α_fn p u).1 ∈ T := ⟨α_fn p u, hφV, rfl⟩ + have hmem_Ioo : (α_fn p u).1 ∈ Ioo (τ p.1) (τ (p.1 + 1)) := by + have : α_fn p u ∈ {q : unitInterval | q.1 ∈ Ioo (τ p.1) (τ (p.1 + 1))} := + hα_Ioo p ▸ ⟨u, hu, rfl⟩ + exact this + exact hτ_no p.1 p.2 (α_fn p u).1 hmem_T hmem_Ioo + have hU_conn : ∀ p : Fin m, IsPreconnected (U_fn p) := fun p => + (Net.unitInterval_interior_isPathConnected.image + (γ.continuous.comp (α_fn p).continuous)).isConnected.isPreconnected + have hU_bd : ∀ p : Fin m, U_fn p ⊆ bd N.D := fun p => + (hU_sub_C₁ p).trans (hC₁_sub.trans sdiff_subset) + have hU_disj_seamV : ∀ p : Fin m, Disjoint (U_fn p) (N.φ ⁻¹' N.seamV) := by + intro p + refine (hU_disj_V p).mono_right (preimage_mono ?_) + rw [hJ'V, hSeam.2.2] + exact subset_union_left + have hU_injOn : ∀ p : Fin m, InjOn N.φ (U_fn p) := fun p => + N.injOn_φ_of_isPreconnected (hU_conn p) (hU_bd p) (hU_disj_seamV p) + let c_fn (p : Fin m) : C(unitInterval, S) := + ⟨N.φ ∘ γ ∘ α_fn p, N.quotientMap_φ.continuous.comp (γ.continuous.comp (α_fn p).continuous)⟩ + let v_fn (k : Fin (m + 1)) : S := N.φ (γ (τ_I k.1 (Nat.le_of_lt_succ k.2))) + let e_fn (p : Fin m) : Set S := c_fn p '' Ioo (0 : unitInterval) 1 + have he_eq_φU : ∀ p : Fin m, e_fn p = N.φ '' U_fn p := fun p => by + dsimp only [e_fn, U_fn, c_fn] + rw [← image_comp] + rfl + have he_edge : ∀ p : Fin m, + e_fn p ∈ J'.E ∧ J'.toGraph.IsLink (e_fn p) (v_fn p.castSucc) (v_fn p.succ) := by + intro p + have h0 : N.φ (γ (α_fn p 0)) = v_fn p.castSucc := by rw [hα0]; rfl + have h1 : N.φ (γ (α_fn p 1)) = v_fn p.succ := by rw [hα1]; rfl + have he := boundary_segment_maps_to_edge N J J' hSeam hJ'U γ hγ_inj (α_fn p) + (hα_inj p) (hU_disj_V p) (hU_bd p) (hU_injOn p) + (h0.symm ▸ hτ_V p.1 p.2.le) (h1.symm ▸ hτ_V (p.1 + 1) p.2) + change e_fn p ∈ J'.E ∧ J'.toGraph.IsLink (e_fn p) + (N.φ (γ (α_fn p 0))) (N.φ (γ (α_fn p 1))) at he + rwa [h0, h1] at he + -- Step 4: Extract an odd-count walk and then a simple walk in `J'`. + have hv0_eq : v_fn 0 = N.φ s := by + have h0 : τ_I 0 (Nat.zero_le m) = 0 := Subtype.ext hτ0 + simp [v_fn, h0, hγ0] + have hvm_eq : v_fn (Fin.last m) = N.φ t := by + have hm : τ_I m le_rfl = 1 := Subtype.ext hτm + simp [v_fn, hm, hγ1] + obtain ⟨W₀', hW₀'_edges⟩ := GraphWalk.exists_ofFn_edges m v_fn e_fn + (hτ_V 0 (Nat.zero_le m)) (fun p => (he_edge p).2) + obtain ⟨W₀, hW₀_edges⟩ : + ∃ W₀ : GraphWalk J'.toGraph (N.φ s) (N.φ t), W₀.edges = List.ofFn e_fn := by + rw [← hv0_eq, ← hvm_eq] + exact ⟨W₀', hW₀'_edges⟩ + obtain ⟨W₁, hW₁_odd⟩ := GraphWalk.exists_odd_count_walk W₀ + obtain ⟨W₂, hW₂_simple, _, hW₂_sub_W₁⟩ := GM11.GraphWalk.exists_isSimple W₁ + let P : Drawing S := GM11.walkDrawing J' W₂ + refine ⟨P, GM11.walkDrawing_isSubdrawing J' W₂, GM11.walkDrawing_isPathBetween J' hW₂_simple, ?_⟩ + -- Step 5: Every edge `e ∈ P.E` has odd count in `List.ofFn e_fn`, hence is neither type (iii) + -- nor type (iv). + intro e heP + rw [GM11.walkDrawing_E] at heP + have hodd : Odd ((List.ofFn e_fn).count e) := hW₀_edges ▸ hW₁_odd e (hW₂_sub_W₁ e heP) + have hcount_pos : 0 < (List.ofFn e_fn).count e := by + rcases hodd with ⟨k, hk⟩ + omega + have he_mem_ofFn : e ∈ List.ofFn e_fn := List.count_pos_iff.mp hcount_pos + rw [List.mem_ofFn] at he_mem_ofFn + rcases he_mem_ofFn with ⟨p₀, rfl⟩ + let u₀ : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have hu₀ : u₀ ∈ Ioo (0 : unitInterval) 1 := by + constructor <;> rw [← Subtype.coe_lt_coe] <;> norm_num [u₀] + let x₀ : N.D := γ (α_fn p₀ u₀) + have hx₀_U : x₀ ∈ U_fn p₀ := ⟨u₀, hu₀, rfl⟩ + have hx₀_C₁ : x₀ ∈ C₁ := hU_sub_C₁ p₀ hx₀_U + let z₀ : S := N.φ x₀ + have hz₀_e : z₀ ∈ e_fn p₀ := ⟨u₀, hu₀, rfl⟩ + constructor + · -- `e_fn p₀` is not of type (iii) + rintro ⟨he_bdS, he_sub_C₁⟩ + have hz₀_not_bdS : z₀ ∉ bd S := fun h => Set.eq_empty_iff_forall_notMem.mp he_bdS z₀ ⟨hz₀_e, h⟩ + have hz₀_not_seamV : z₀ ∉ N.seamV := + Disjoint.notMem_of_mem_left (hU_disj_seamV p₀) hx₀_U + obtain ⟨i, w, hw_Ioo, hφw, hfiber, hfg_ne⟩ := + N.exists_mem_Ioo_of_mem_bd_of_notMem_bd_of_notMem_seamV + (hU_bd p₀ hx₀_U) hz₀_not_bdS hz₀_not_seamV + have hfw_C₁ : N.f i w ∈ C₁ := he_sub_C₁ z₀ hz₀_e (hfiber ▸ Or.inl rfl) + have hgw_C₁ : N.g i w ∈ C₁ := he_sub_C₁ z₀ hz₀_e (hfiber ▸ Or.inr rfl) + have hz₀_not_V : z₀ ∉ J'.V := + Disjoint.notMem_of_mem_left (hU_disj_V p₀) hx₀_U + have hex_unique_U : ∀ y ∈ C₁, N.φ y ∉ J'.V → + ∃ p : Fin m, ∀ q : Fin m, y ∈ U_fn q ↔ q = p := by + exact unique_arc_segment_away_from_vertices (S := S) N J' (C₁ := C₁) γ hγ_inj hγ_Ioo m τ + hτ_unique τ_I (fun _ _ => rfl) hτ_V U_fn hU_eq + obtain ⟨p₁, hp₁⟩ := hex_unique_U (N.f i w) hfw_C₁ (hφw.symm ▸ hz₀_not_V) + obtain ⟨p₂, hp₂⟩ := hex_unique_U (N.g i w) hgw_C₁ + (((N.φ_f_eq_φ_g i w).symm.trans hφw).symm ▸ hz₀_not_V) + have hp12 : p₁ ≠ p₂ := by + rintro rfl + have hf_U : N.f i w ∈ U_fn p₁ := (hp₁ p₁).mpr rfl + have hg_U : N.g i w ∈ U_fn p₁ := (hp₂ p₁).mpr rfl + exact hfg_ne (hU_injOn p₁ hf_U hg_U (N.φ_f_eq_φ_g i w)) + have hiff : ∀ p : Fin m, e_fn p = e_fn p₀ ↔ p = p₁ ∨ p = p₂ := by + exact edge_subdivision_indices_of_fiber (S := S) N J' m U_fn e_fn he_eq_φU + (fun p => (he_edge p).1) p₀ z₀ hz₀_e i w hφw hfiber p₁ hp₁ p₂ hp₂ + have hcount2 : (List.ofFn e_fn).count (e_fn p₀) = 2 := + count_ofFn_eq_two e_fn (e_fn p₀) hp12 hiff + rw [hcount2] at hodd + rcases hodd with ⟨k, hk⟩ + omega + · -- `e_fn p₀` is not of type (iv) + rintro ⟨_, he_sub_C₂⟩ + have hx₀_C₂ : x₀ ∈ C₂ := he_sub_C₂ z₀ hz₀_e rfl + exact Disjoint.notMem_of_mem_left hdisj_C12 hx₀_C₁ hx₀_C₂ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section2Euler.lean b/LeanPool/GraphMinor/GM07/Section2Euler.lean new file mode 100644 index 0000000000..78b7738e74 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section2Euler.lean @@ -0,0 +1,2377 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.GM11.DrawingOps +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.Surface.CapCoh +import LeanPool.GraphMinor.Surface.Classification +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.SideCut +import LeanPool.GraphMinor.Surface.SurfacePull + +/-! +# Graph Minors VII, Section 2: Euler's Formula for Seam Graphs ((2.2)) + +This file proves the Euler formula for the seam graph `J` of a net `N` on a surface `S ≃ₜ Σ(a, b, +c)` +used in the proof of `(2.2)` (page 216): +`|E(J)| + 1 = |V(J)| + 2a + b + c`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Filter GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +namespace Net + +/-! ## 1. Openness of seam interiors on `bd N.D` and disjointness from `bd S` -/ + +/-- Reversing the roles of `N.f` and `N.g` in a net `N : Net S` gives a net with the same `D`, `r`, +and `φ`. -/ +def swapFG (N : Net S) : Net S where + D := N.D + isSurface_D := N.isSurface_D + isClosedDisc_D := N.isClosedDisc_D + r := N.r + f := N.g + g := N.f + φ := N.φ + injective_f := N.injective_g + range_f_subset_bd := N.range_g_subset_bd + injective_g := N.injective_f + range_g_subset_bd := N.range_f_subset_bd + internally_disjoint_ff := N.internally_disjoint_gg + internally_disjoint_gg := N.internally_disjoint_ff + internally_disjoint_fg := N.internally_disjoint_gf + internally_disjoint_gf := N.internally_disjoint_fg + quotientMap_φ := N.quotientMap_φ + pasting_eq i x := (N.pasting_eq i x).symm + interior_inj := N.interior_inj + bd_eq_iff x y := by + rw [N.bd_eq_iff x y] + constructor <;> intro h <;> induction h with + | rel a b hab => + rcases hab with ⟨i, t, rfl, rfl⟩ + exact .symm _ _ (.rel _ _ ⟨i, t, rfl, rfl⟩) + | refl a => exact .refl a + | symm a b _ ih => exact .symm _ _ ih + | trans a b c _ _ ih1 ih2 => exact .trans _ _ _ ih1 ih2 + +/-- For any net `N`, `i : Fin N.r`, and open interval `(a, b) ⊆ (0, 1)`, `N.f i '' Ioo a b` is open +in `bd N.D`: there is an open set `U ⊆ N.D` such that `U ∩ bd N.D = N.f i '' Ioo a b`. -/ +theorem exists_isOpen_inter_bd_eq_image_Ioo_f (N : Net S) (i : Fin N.r) + (a b : unitInterval) : + ∃ U : Set N.D, IsOpen U ∧ U ∩ bd N.D = N.f i '' Ioo a b := by + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + have hOArc : IsOArc (bd N.D) := N.isOArc_bd_D + have hf0_bd : N.f i 0 ∈ bd N.D := N.range_f_subset_bd i ⟨0, rfl⟩ + have hf1_bd : N.f i 1 ∈ bd N.D := N.range_f_subset_bd i ⟨1, rfl⟩ + have hf01_ne : N.f i 0 ≠ N.f i 1 := fun h => zero_ne_one (N.injective_f i h) + obtain ⟨B₁, B₂, hcomp, hdisj, hunion, ⟨h₁, _, _⟩, ⟨h₂, _, _⟩⟩ := + oArc_components_diff_pair hOArc hf0_bd hf1_bd hf01_ne + let t₀ : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht₀ : t₀ ∈ Ioo (0 : unitInterval) 1 := by + constructor <;> rw [← Subtype.coe_lt_coe] <;> norm_num [t₀] + have hIoo_pc := Net.unitInterval_interior_isPathConnected + have hfIoo_conn : IsPreconnected (N.f i '' Ioo (0 : unitInterval) 1) := + (hIoo_pc.image (N.f i).continuous).isConnected.isPreconnected + have hf0_not : N.f i 0 ∉ N.f i '' Ioo (0 : unitInterval) 1 := by + rintro ⟨s, hs, hs0⟩ + exact hs.1.ne (N.injective_f i hs0).symm + have hf1_not : N.f i 1 ∉ N.f i '' Ioo (0 : unitInterval) 1 := by + rintro ⟨s, hs, hs1⟩ + exact hs.2.ne (N.injective_f i hs1) + have hfIoo_sub : N.f i '' Ioo (0 : unitInterval) 1 ⊆ bd N.D \ {N.f i 0, N.f i 1} := by + rintro _ ⟨s, hs, rfl⟩ + refine ⟨N.range_f_subset_bd i ⟨s, rfl⟩, ?_⟩ + rintro (h0 | h1) + · exact hf0_not ⟨s, hs, h0⟩ + · exact hf1_not ⟨s, hs, mem_singleton_iff.mp h1⟩ + let B := connectedComponentIn (bd N.D \ {N.f i 0, N.f i 1}) (N.f i t₀) + have hB_mem : B ∈ componentsIn (bd N.D \ {N.f i 0, N.f i 1}) := + ⟨N.f i t₀, hfIoo_sub ⟨t₀, ht₀, rfl⟩, rfl⟩ + rw [hcomp] at hB_mem + have hB_sub_fIoo : B ⊆ N.f i '' Ioo (0 : unitInterval) 1 := + (N.subset_image_Ioo_f_of_isPreconnected i isPreconnected_connectedComponentIn + ((connectedComponentIn_subset _ _).trans sdiff_subset) + (fun h => (connectedComponentIn_subset _ _ h).2 (Or.inl rfl)) + (fun h => (connectedComponentIn_subset _ _ h).2 (Or.inr rfl)) + ht₀ (mem_connectedComponentIn (hfIoo_sub ⟨t₀, ht₀, rfl⟩))).1 + have hB_eq : B = N.f i '' Ioo (0 : unitInterval) 1 := + Subset.antisymm hB_sub_fIoo + (hfIoo_conn.subset_connectedComponentIn ⟨t₀, ht₀, rfl⟩ hfIoo_sub) + have hK₁_closed : IsClosed (B₁ ∪ {N.f i 0, N.f i 1}) := by + have hcomp₁ : IsCompact (range (Subtype.val ∘ h₁)) := isCompact_range (by fun_prop) + have hrange₁ : range (Subtype.val ∘ h₁) = B₁ ∪ {N.f i 0, N.f i 1} := by + ext x + simp only [Function.comp_apply, mem_range] + exact ⟨by rintro ⟨t, rfl⟩; exact (h₁ t).2, fun hx => ⟨h₁.symm ⟨x, hx⟩, by simp⟩⟩ + rw [← hrange₁] + exact hcomp₁.isClosed + have hK₂_closed : IsClosed (B₂ ∪ {N.f i 0, N.f i 1}) := by + have hcomp₂ : IsCompact (range (Subtype.val ∘ h₂)) := isCompact_range (by fun_prop) + have hrange₂ : range (Subtype.val ∘ h₂) = B₂ ∪ {N.f i 0, N.f i 1} := by + ext x + simp only [Function.comp_apply, mem_range] + exact ⟨by rintro ⟨t, rfl⟩; exact (h₂ t).2, fun hx => ⟨h₂.symm ⟨x, hx⟩, by simp⟩⟩ + rw [← hrange₂] + exact hcomp₂.isClosed + have hex_U₀ : ∃ U₀ : Set N.D, IsOpen U₀ ∧ U₀ ∩ bd N.D = N.f i '' Ioo (0 : unitInterval) 1 := by + rcases hB_mem with hB₁ | hB₂ + · refine ⟨(B₂ ∪ {N.f i 0, N.f i 1})ᶜ, hK₂_closed.isOpen_compl, ?_⟩ + rw [← hB_eq, hB₁] + ext x + simp only [mem_inter_iff, mem_compl_iff, mem_union, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨hxnot, hxbd⟩ + have hxdiff : x ∈ bd N.D \ {N.f i 0, N.f i 1} := + ⟨hxbd, fun h => hxnot (Or.inr h)⟩ + exact (hunion ▸ hxdiff).resolve_right fun h => hxnot (Or.inl h) + · intro hxB₁ + have hxdiff : x ∈ bd N.D \ {N.f i 0, N.f i 1} := hunion ▸ Or.inl hxB₁ + refine ⟨?_, hxdiff.1⟩ + rintro (hxB₂ | hxends) + · exact Disjoint.notMem_of_mem_left hdisj hxB₁ hxB₂ + · exact hxdiff.2 hxends + · refine ⟨(B₁ ∪ {N.f i 0, N.f i 1})ᶜ, hK₁_closed.isOpen_compl, ?_⟩ + rw [← hB_eq, hB₂] + ext x + simp only [mem_inter_iff, mem_compl_iff, mem_union, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨hxnot, hxbd⟩ + have hxdiff : x ∈ bd N.D \ {N.f i 0, N.f i 1} := + ⟨hxbd, fun h => hxnot (Or.inr h)⟩ + exact (hunion ▸ hxdiff).resolve_left fun h => hxnot (Or.inl h) + · intro hxB₂ + have hxdiff : x ∈ bd N.D \ {N.f i 0, N.f i 1} := hunion ▸ Or.inr hxB₂ + refine ⟨?_, hxdiff.1⟩ + rintro (hxB₁ | hxends) + · exact Disjoint.notMem_of_mem_right hdisj hxB₂ hxB₁ + · exact hxdiff.2 hxends + rcases hex_U₀ with ⟨U₀, hU₀_open, hU₀_eq⟩ + let K_left : Set N.D := N.f i '' Iic a + let K_right : Set N.D := N.f i '' Ici b + have hK_left : IsClosed K_left := + (isClosed_Iic.isCompact.image (N.f i).continuous).isClosed + have hK_right : IsClosed K_right := + (isClosed_Ici.isCompact.image (N.f i).continuous).isClosed + refine ⟨U₀ ∩ K_leftᶜ ∩ K_rightᶜ, (hU₀_open.inter hK_left.isOpen_compl).inter + hK_right.isOpen_compl, ?_⟩ + ext x + simp only [mem_inter_iff, mem_compl_iff, K_left, K_right, mem_image, mem_Iic, mem_Ici, mem_Ioo] + constructor + · rintro ⟨⟨⟨hxU₀, hxl⟩, hxr⟩, hxbd⟩ + have hx_fIoo : x ∈ N.f i '' Ioo (0 : unitInterval) 1 := hU₀_eq ▸ ⟨hxU₀, hxbd⟩ + rcases hx_fIoo with ⟨s, _, rfl⟩ + refine ⟨s, ⟨?_, ?_⟩, rfl⟩ + · by_contra! hsa + exact hxl ⟨s, hsa, rfl⟩ + · by_contra! hbs + exact hxr ⟨s, hbs, rfl⟩ + · rintro ⟨s, ⟨has, hsb⟩, rfl⟩ + have hs0 : (0 : unitInterval) < s := lt_of_le_of_lt (Subtype.coe_le_coe.mp a.2.1) has + have hs1 : s < (1 : unitInterval) := lt_of_lt_of_le hsb (Subtype.coe_le_coe.mp b.2.2) + have hmem : N.f i s ∈ U₀ ∩ bd N.D := hU₀_eq.symm ▸ ⟨s, ⟨hs0, hs1⟩, rfl⟩ + refine ⟨⟨⟨hmem.1, ?_⟩, ?_⟩, hmem.2⟩ + · rintro ⟨t, hta, htf⟩ + have hst : t = s := N.injective_f i htf + exact (not_le_of_gt has) (hst ▸ hta) + · rintro ⟨t, hbt, htf⟩ + have hst : t = s := N.injective_f i htf + exact (not_le_of_gt hsb) (hst ▸ hbt) + +/-- For any net `N`, `i : Fin N.r`, and open interval `(a, b) ⊆ (0, 1)`, `N.g i '' Ioo a b` is open +in `bd N.D`: there is an open set `U ⊆ N.D` such that `U ∩ bd N.D = N.g i '' Ioo a b`. -/ +theorem exists_isOpen_inter_bd_eq_image_Ioo_g (N : Net S) (i : Fin N.r) + (a b : unitInterval) : + ∃ U : Set N.D, IsOpen U ∧ U ∩ bd N.D = N.g i '' Ioo a b := + N.swapFG.exists_isOpen_inter_bd_eq_image_Ioo_f i a b + +private theorem seam_image_near_arc_interior + {S : Type u} + [TopologicalSpace S] + (N : Net S) + (i : Fin N.r) + (V₁ : Set N.D) + (V₂ : Set N.D) + (Uf₀ : Set N.D) + (hUf₀_bd : Uf₀ ∩ bd N.D = ⇑(N.f i) '' Ioo 0 1) + (Ug₀ : Set N.D) + (hUg₀_bd : Ug₀ ∩ bd N.D = ⇑(N.g i) '' Ioo 0 1) : + let U₁ := V₁ ∩ Uf₀ + let U₂ := V₂ ∩ Ug₀ + (N.φ '' (U₁ ∪ U₂)ᶜ)ᶜ ∩ N.seamU ⊆ (N.φ ∘ N.f i) '' Ioo (0 : unitInterval) 1 := by + intro U₁ U₂ + let W₀ := (N.φ '' (U₁ ∪ U₂)ᶜ)ᶜ + rintro z ⟨hzW₀, x, hxbd, rfl⟩ + have hxU : x ∈ U₁ ∪ U₂ := by + by_contra hxnot + exact hzW₀ ⟨x, hxnot, rfl⟩ + rcases hxU with hxU₁ | hxU₂ + · have hxf : x ∈ N.f i '' Ioo (0 : unitInterval) 1 := hUf₀_bd ▸ ⟨hxU₁.2, hxbd⟩ + rcases hxf with ⟨s, hs, rfl⟩ + exact ⟨s, hs, rfl⟩ + · have hxg : x ∈ N.g i '' Ioo (0 : unitInterval) 1 := hUg₀_bd ▸ ⟨hxU₂.2, hxbd⟩ + rcases hxg with ⟨s, hs, rfl⟩ + exact ⟨s, hs, N.φ_f_eq_φ_g i s⟩ + +private theorem net_interior_image_open + {S : Type u} + [TopologicalSpace S] + (N : Net S) + (hφ_closed : IsClosedMap N.φ) : + ∀ (U : Set N.D), IsOpen U → IsOpen (N.φ '' (U \ bd N.D)) := by + intro U hU + have hclosed_compl : IsClosed ((U \ bd N.D)ᶜ) := (hU.sdiff (isClosed_bd N.D)).isClosed_compl + have heq : N.φ '' (U \ bd N.D) = (N.φ '' (U \ bd N.D)ᶜ)ᶜ := by + ext z + constructor + · rintro ⟨x, ⟨hxU, hxbd⟩, rfl⟩ ⟨y, hy, hφy⟩ + have hxy : x = y := N.interior_inj x hxbd y hφy.symm + subst hxy + exact hy ⟨hxU, hxbd⟩ + · intro hz + obtain ⟨x, rfl⟩ := N.quotientMap_φ.surjective z + by_cases hx : x ∈ U \ bd N.D + · exact ⟨x, hx, rfl⟩ + · exact False.elim (hz ⟨x, hx, rfl⟩) + rw [heq] + exact (hφ_closed _ hclosed_compl).isOpen_compl + +private theorem net_neighborhood_covered_off_boundary + {S : Type u} + [TopologicalSpace S] + (N : Net S) + (i : Fin N.r) + (U₁ : Set N.D) + (U₂ : Set N.D) + (a_ivl : ↑unitInterval) + (b_ivl : ↑unitInterval) + (hIoo_ab_sub_bd : (N.φ ∘ N.f i) '' Ioo a_ivl b_ivl ⊆ bd S) + (Uf₁ : Set N.D) + (hUf₁_bd : Uf₁ ∩ bd N.D = ⇑(N.f i) '' Ioo a_ivl b_ivl) + (Ug₁ : Set N.D) + (hUg₁_bd : Ug₁ ∩ bd N.D = ⇑(N.g i) '' Ioo a_ivl b_ivl) + : + let U₁' := U₁ ∩ Uf₁ + let U₂' := U₂ ∩ Ug₁ + ((N.φ '' (U₁' ∪ U₂')ᶜ)ᶜ) \ bd S ⊆ (N.φ '' (U₁' \ bd N.D)) ∪ (N.φ '' (U₂' \ bd N.D)) := by + intro U₁' U₂' + let O₁ := N.φ '' (U₁' \ bd N.D) + let O₂ := N.φ '' (U₂' \ bd N.D) + let W' := (N.φ '' (U₁' ∪ U₂')ᶜ)ᶜ + rintro z ⟨hzW', hzbd⟩ + obtain ⟨y, rfl⟩ := N.quotientMap_φ.surjective z + have hyU : y ∈ U₁' ∪ U₂' := by + by_contra hny + exact hzW' ⟨y, hny, rfl⟩ + by_cases hybd : y ∈ bd N.D + · exfalso + rcases hyU with hy₁ | hy₂ + · have hy_mem : y ∈ Uf₁ ∩ bd N.D := ⟨hy₁.2, hybd⟩ + rw [hUf₁_bd] at hy_mem + rcases hy_mem with ⟨u, hu, rfl⟩ + exact hzbd (hIoo_ab_sub_bd ⟨u, hu, rfl⟩) + · have hy_mem : y ∈ Ug₁ ∩ bd N.D := ⟨hy₂.2, hybd⟩ + rw [hUg₁_bd] at hy_mem + rcases hy_mem with ⟨u, hu, rfl⟩ + have hgu : N.φ (N.g i u) = (N.φ ∘ N.f i) u := (N.φ_f_eq_φ_g i u).symm + exact hzbd (hIoo_ab_sub_bd ⟨u, hu, hgu.symm⟩) + · rcases hyU with hy₁ | hy₂ + · exact Or.inl ⟨y, ⟨hy₁, hybd⟩, rfl⟩ + · exact Or.inr ⟨y, ⟨hy₂, hybd⟩, rfl⟩ + +private theorem net_arc_map_injective_interior + {S : Type u} + [TopologicalSpace S] + (N : Net S) + (i : Fin N.r) + (hIoo_pc : IsPathConnected (Ioo (0 : unitInterval) 1)) : + InjOn (N.φ ∘ ⇑(N.f i)) (Ioo 0 1) := by + let c := N.φ ∘ ⇑(N.f i) + intro u₁ hu₁ u₂ hu₂ h12 + have hU_conn : IsPreconnected (N.f i '' Ioo (0 : unitInterval) 1) := + (hIoo_pc.image (N.f i).continuous).isConnected.isPreconnected + have hU_bd : N.f i '' Ioo (0 : unitInterval) 1 ⊆ bd N.D := by + rintro _ ⟨u, _, rfl⟩; exact N.range_f_subset_bd i ⟨u, rfl⟩ + have hU_disj : Disjoint (N.f i '' Ioo (0 : unitInterval) 1) (N.φ ⁻¹' N.seamV) := by + rw [disjoint_left] + rintro _ ⟨u, hu, rfl⟩ + exact N.notMem_seamV_of_mem_Ioo i hu + exact N.injective_f i + (N.injOn_φ_of_isPreconnected hU_conn hU_bd hU_disj ⟨u₁, hu₁, rfl⟩ ⟨u₂, hu₂, rfl⟩ h12) + +private theorem chart_parameter_injective {S : Type u} (ψ : ℝ → S) (c : unitInterval → S) + (c_inv : S → unitInterval) {J : Set ℝ} + (hψ : InjOn ψ J) (himage : ψ '' J ⊆ c '' (c ⁻¹' (ψ '' J))) + (hleft : LeftInvOn c_inv c (c ⁻¹' (ψ '' J))) : + InjOn (fun s => (c_inv (ψ s) : ℝ)) J := by + have hright : ∀ s ∈ J, c (c_inv (ψ s)) = ψ s := by + intro s hs + obtain ⟨u, hu, hcu⟩ := himage ⟨s, hs, rfl⟩ + rw [← hcu, hleft hu] + intro s hs t ht hst + apply hψ hs ht + rw [← hright s hs, ← hright t ht, Subtype.ext hst] + +private theorem net_subarc_maps_into_boundary + {S : Type u} + [TopologicalSpace S] + {t : unitInterval} + (c : unitInterval → S) + (W₀ : Set S) + (ψ : ℝ → S) + (s₀ : ℝ) + (δ : ℝ) + (hψJ_sub_W₀ : ψ '' (Icc (s₀ - δ) (s₀ + δ)) ⊆ W₀ ∩ bd S) + (hc_Tψ_eq : c '' (c ⁻¹' (ψ '' (Icc (s₀ - δ) (s₀ + δ)))) = (ψ '' + (Icc (s₀ - δ) (s₀ + δ)))) + (c_inv : S → unitInterval) + (hc_inv_left : LeftInvOn c_inv c (c ⁻¹' (ψ '' (Icc (s₀ - δ) (s₀ + + δ))))) + (hτ_cont : ContinuousOn (fun s => (c_inv (ψ s) : ℝ)) (Icc (s₀ - δ) (s₀ + δ))) + (hs_left_mem : s₀ - δ ∈ (Icc (s₀ - δ) (s₀ + δ))) + (hs_right_mem : s₀ + δ ∈ (Icc (s₀ - δ) (s₀ + δ))) : + c '' Ioo (c_inv (ψ (if (fun s => (c_inv (ψ s) : ℝ)) (s₀ - δ) < ↑t then s₀ - δ else + s₀ + δ))) + (c_inv (ψ (if (c_inv (ψ (s₀ - δ)) : ℝ) < t.1 then s₀ + δ else s₀ - δ))) ⊆ bd S := by + let J_ivl := Icc (s₀ - δ) (s₀ + δ) + let K_ψ := ψ '' J_ivl + let T_ψ := c ⁻¹' K_ψ + let τ := fun s => (c_inv (ψ s) : ℝ) + let a_ivl := c_inv (ψ (if τ (s₀ - δ) < ↑t then s₀ - δ else s₀ + δ)) + let b_ivl := c_inv (ψ (if τ (s₀ - δ) < ↑t then s₀ + δ else s₀ - δ)) + rintro _ ⟨u, hu, rfl⟩ + have hu_range : u.1 ∈ τ '' J_ivl := by + refine (isPreconnected_Icc.image τ hτ_cont).Icc_subset ?_ ?_ + ⟨Subtype.coe_le_coe.mpr hu.1.le, Subtype.coe_le_coe.mpr hu.2.le⟩ + · dsimp [a_ivl, τ] + split_ifs + · exact ⟨s₀ - δ, hs_left_mem, rfl⟩ + · exact ⟨s₀ + δ, hs_right_mem, rfl⟩ + · dsimp [b_ivl, τ] + split_ifs + · exact ⟨s₀ + δ, hs_right_mem, rfl⟩ + · exact ⟨s₀ - δ, hs_left_mem, rfl⟩ + rcases hu_range with ⟨s, hs, hτs⟩ + have hu_eq : u = c_inv (ψ s) := Subtype.ext hτs.symm + obtain ⟨w, hw, hcw⟩ : ψ s ∈ c '' T_ψ := hc_Tψ_eq.symm ▸ ⟨s, hs, rfl⟩ + have hcu : c u = ψ s := by rw [hu_eq, ← hcw, hc_inv_left hw] + rw [hcu] + exact (hψJ_sub_W₀ ⟨s, hs, rfl⟩).2 + +private theorem net_interior_accumulates {S : Type u} [TopologicalSpace S] (N : Net S) + {x : N.D} {U : Set N.D} (hU : IsOpen U) (hx : x ∈ U) : + N.φ x ∈ closure (N.φ '' (U \ bd N.D)) := by + have hcl : x ∈ closure (U \ bd N.D) := by + rw [_root_.mem_closure_iff] + intro V hV hxV + exact _root_.mem_closure_iff.mp (mem_closure_compl_bd (N.isSurface_D.2.2 x)) + (V ∩ U) (hV.inter hU) ⟨hxV, hx⟩ + |>.imp fun z ⟨⟨hzV, hzU⟩, hzbd⟩ => ⟨hzV, hzU, hzbd⟩ + exact image_closure_subset_closure_image N.quotientMap_φ.continuous ⟨x, hcl, rfl⟩ + +/-- No interior point of any seam `N.f i '' Ioo 0 1` maps into `bd S`: for every `i : Fin N.r` and +`t ∈ Ioo (0 : unitInterval) 1`, `N.φ (N.f i t) ∉ bd S`. -/ +theorem notMem_bd_of_mem_Ioo (hS : IsSurface S) (N : Net S) (i : Fin N.r) + {t : unitInterval} (ht : t ∈ Ioo (0 : unitInterval) 1) : + N.φ (N.f i t) ∉ bd S := by + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + have : T2Space S := hS.2.1 + intro hp_bd + let p : S := N.φ (N.f i t) + let x₁ : N.D := N.f i t + let x₂ : N.D := N.g i t + have hx12_ne : x₁ ≠ x₂ := fun h => N.internally_disjoint_fg i i t ht ⟨t, h.symm⟩ + obtain ⟨V₁, V₂, hV₁_open, hV₂_open, hx₁V₁, hx₂V₂, hV_disj⟩ := t2_separation hx12_ne + obtain ⟨Uf₀, hUf₀_open, hUf₀_bd⟩ := N.exists_isOpen_inter_bd_eq_image_Ioo_f i 0 1 + obtain ⟨Ug₀, hUg₀_open, hUg₀_bd⟩ := N.exists_isOpen_inter_bd_eq_image_Ioo_g i 0 1 + let U₁ : Set N.D := V₁ ∩ Uf₀ + let U₂ : Set N.D := V₂ ∩ Ug₀ + have hU₁_open : IsOpen U₁ := hV₁_open.inter hUf₀_open + have hU₂_open : IsOpen U₂ := hV₂_open.inter hUg₀_open + have hx₁U₁ : x₁ ∈ U₁ := by + have hx₁Uf₀ : x₁ ∈ Uf₀ ∩ bd N.D := by + rw [hUf₀_bd] + exact ⟨t, ht, rfl⟩ + exact ⟨hx₁V₁, hx₁Uf₀.1⟩ + have hx₂U₂ : x₂ ∈ U₂ := by + have hx₂Ug₀ : x₂ ∈ Ug₀ ∩ bd N.D := by + rw [hUg₀_bd] + exact ⟨t, ht, rfl⟩ + exact ⟨hx₂V₂, hx₂Ug₀.1⟩ + have hU_disj : Disjoint U₁ U₂ := hV_disj.mono inter_subset_left inter_subset_left + have hφ_closed : IsClosedMap N.φ := N.quotientMap_φ.continuous.isClosedMap + let W₀ : Set S := (N.φ '' (U₁ ∪ U₂)ᶜ)ᶜ + have hW₀_open : IsOpen W₀ := (hφ_closed _ (hU₁_open.union hU₂_open).isClosed_compl).isOpen_compl + have hpW₀ : p ∈ W₀ := by + rintro ⟨y, hy, hyp⟩ + rcases N.eq_f_or_g_of_φ_eq_of_mem_Ioo i ht hyp.symm with rfl | rfl + · exact hy (Or.inl hx₁U₁) + · exact hy (Or.inr hx₂U₂) + have hW₀_seam : W₀ ∩ N.seamU ⊆ (N.φ ∘ N.f i) '' Ioo (0 : unitInterval) 1 := by + exact seam_image_near_arc_interior (S := S) N i V₁ V₂ Uf₀ hUf₀_bd Ug₀ hUg₀_bd + -- Use a boundary chart around `p ∈ bd S` to find an open subinterval `(a, b)` around `t` + -- mapped into `bd S`. + obtain ⟨ψ, W₁, hψ_cont, hψ_inj, hW₁_open, hpW₁, hψ_Ioo, hψ_bd⟩ := + exists_boundary_chart (hS.2.2 p) hp_bd + obtain ⟨s₀, hs₀_Ioo, hψs₀⟩ : p ∈ ψ '' Ioo (-1) 1 := hψ_Ioo.symm ▸ ⟨hpW₁, hp_bd⟩ + have hψ_nhds : ψ ⁻¹' W₀ ∈ 𝓝[Icc (-1 : ℝ) 1] s₀ := + (hψ_cont s₀ (Ioo_subset_Icc_self hs₀_Ioo)).preimage_mem_nhdsWithin (hW₀_open.mem_nhds + (hψs₀ ▸ hpW₀)) + obtain ⟨δ₀, hδ₀, hball_ψ⟩ := Metric.mem_nhdsWithin_iff.mp hψ_nhds + let δ : ℝ := min (δ₀ / 2) (min ((s₀ - (-1)) / 2) ((1 - s₀) / 2)) + have hδ_pos : 0 < δ := + lt_min (half_pos hδ₀) (lt_min (half_pos (sub_pos.mpr hs₀_Ioo.1)) (half_pos + (sub_pos.mpr hs₀_Ioo.2))) + have hδ_le1 : δ ≤ δ₀ / 2 := min_le_left _ _ + have hδ_le2 : δ ≤ (s₀ - (-1)) / 2 := (min_le_right _ _).trans (min_le_left _ _) + have hδ_le3 : δ ≤ (1 - s₀) / 2 := (min_le_right _ _).trans (min_le_right _ _) + let J_ivl : Set ℝ := Icc (s₀ - δ) (s₀ + δ) + have hJ_sub_Ioo : J_ivl ⊆ Ioo (-1 : ℝ) 1 := fun s hs => + ⟨by linarith [hs.1], by linarith [hs.2]⟩ + have hJ_sub_Icc : J_ivl ⊆ Icc (-1 : ℝ) 1 := hJ_sub_Ioo.trans Ioo_subset_Icc_self + have hψJ_sub_W₀ : ψ '' J_ivl ⊆ W₀ ∩ bd S := by + rintro _ ⟨s, hs, rfl⟩ + have hs_ball : s ∈ ball s₀ δ₀ := by + rw [mem_ball, Real.dist_eq, abs_lt] + exact ⟨by linarith [hs.1, hs.2, hδ_le1], by linarith [hs.1, hs.2, hδ_le1]⟩ + exact ⟨hball_ψ ⟨hs_ball, hJ_sub_Icc hs⟩, hψ_bd ⟨s, hJ_sub_Icc hs, rfl⟩⟩ + let c : unitInterval → S := N.φ ∘ N.f i + have hc_cont : Continuous c := N.quotientMap_φ.continuous.comp (N.f i).continuous + have hc_inj_Ioo : InjOn c (Ioo (0 : unitInterval) 1) := by + exact net_arc_map_injective_interior N i Net.unitInterval_interior_isPathConnected + let K_ψ : Set S := ψ '' J_ivl + have hKψ_compact : IsCompact K_ψ := isCompact_Icc.image_of_continuousOn (hψ_cont.mono hJ_sub_Icc) + have hKψ_sub_cIoo : K_ψ ⊆ c '' Ioo (0 : unitInterval) 1 := fun z hz => by + have hz' := hψJ_sub_W₀ hz + exact hW₀_seam ⟨hz'.1, N.bd_subset_seamU hz'.2⟩ + let T_ψ : Set unitInterval := c ⁻¹' K_ψ + have hTψ_closed : IsClosed T_ψ := hKψ_compact.isClosed.preimage hc_cont + have hTψ_compact : IsCompact T_ψ := hTψ_closed.isCompact + have hTψ_sub_Ioo : T_ψ ⊆ Ioo (0 : unitInterval) 1 := by + intro u hu + rcases unitInterval_eq_zero_or_one_or_mem_Ioo u with rfl | rfl | hu_Ioo + · rcases hKψ_sub_cIoo hu with ⟨w, hw, hcw⟩ + exact False.elim (N.notMem_seamV_of_mem_Ioo i hw ⟨i, Or.inl hcw.symm⟩) + · rcases hKψ_sub_cIoo hu with ⟨w, hw, hcw⟩ + exact False.elim (N.notMem_seamV_of_mem_Ioo i hw ⟨i, Or.inr hcw.symm⟩) + · exact hu_Ioo + have hc_Tψ_eq : c '' T_ψ = K_ψ := by + apply Subset.antisymm (image_preimage_subset c K_ψ) + intro z hz + rcases hKψ_sub_cIoo hz with ⟨u, _, rfl⟩ + exact ⟨u, hz, rfl⟩ + obtain ⟨c_inv, hc_inv_cont, hc_inv_left⟩ := + exists_inv_of_compactOn hTψ_compact hc_cont.continuousOn (hc_inj_Ioo.mono hTψ_sub_Ioo) + let τ : ℝ → ℝ := fun s => (c_inv (ψ s)).1 + have hτ_cont : ContinuousOn τ J_ivl := by + refine continuous_subtype_val.comp_continuousOn (hc_inv_cont.comp (hψ_cont.mono hJ_sub_Icc) ?_) + intro s hs + rw [hc_Tψ_eq] + exact ⟨s, hs, rfl⟩ + have hτ_inj : InjOn τ J_ivl := by + exact chart_parameter_injective ψ c c_inv (hψ_inj.mono hJ_sub_Icc) + (hc_Tψ_eq ▸ subset_rfl) hc_inv_left + have ht_Tψ : t ∈ T_ψ := by + change c t ∈ K_ψ + have hct : c t = ψ s₀ := hψs₀.symm + rw [hct] + exact ⟨s₀, ⟨by linarith, by linarith⟩, rfl⟩ + have hτ_s₀ : τ s₀ = t.1 := by + change (c_inv (ψ s₀)).1 = t.1 + have hct : ψ s₀ = c t := hψs₀ + rw [hct] + exact congr_arg Subtype.val (hc_inv_left ht_Tψ) + have hs_left_mem : s₀ - δ ∈ J_ivl := ⟨le_rfl, by linarith⟩ + have hs_right_mem : s₀ + δ ∈ J_ivl := ⟨by linarith, le_rfl⟩ + have hs₀_mem : s₀ ∈ J_ivl := ⟨by linarith, by linarith⟩ + have h_between : (τ (s₀ - δ) < t.1 ∧ t.1 < τ (s₀ + δ)) ∨ + (τ (s₀ + δ) < t.1 ∧ t.1 < τ (s₀ - δ)) := by + rw [← hτ_s₀] + rcases ContinuousOn.strictMonoOn_of_injOn_Icc' (by linarith : s₀ - δ ≤ s₀ + δ) + hτ_cont hτ_inj with hmono | hanti + · exact .inl ⟨hmono hs_left_mem hs₀_mem (by linarith), + hmono hs₀_mem hs_right_mem (by linarith)⟩ + · exact .inr ⟨hanti hs₀_mem hs_right_mem (by linarith), + hanti hs_left_mem hs₀_mem (by linarith)⟩ + let a_ivl : unitInterval := c_inv (ψ (if τ (s₀ - δ) < t.1 then s₀ - δ else s₀ + δ)) + let b_ivl : unitInterval := c_inv (ψ (if τ (s₀ - δ) < t.1 then s₀ + δ else s₀ - δ)) + have hat : a_ivl < t := by + rw [← Subtype.coe_lt_coe] + dsimp [a_ivl] + split_ifs with hlt + · exact hlt + · exact (h_between.resolve_left fun h => hlt h.1).1 + have htb : t < b_ivl := by + rw [← Subtype.coe_lt_coe] + dsimp [b_ivl] + split_ifs with hlt + · exact (h_between.resolve_right fun h => not_lt_of_gt h.2 hlt).2 + · exact (h_between.resolve_left fun h => hlt h.1).2 + have hab_ivl : a_ivl < b_ivl := hat.trans htb + have hIoo_ab_sub_bd : c '' Ioo a_ivl b_ivl ⊆ bd S := by + exact net_subarc_maps_into_boundary (t := t) c W₀ ψ s₀ δ hψJ_sub_W₀ hc_Tψ_eq c_inv + hc_inv_left hτ_cont hs_left_mem hs_right_mem + -- Shrink `U₁, U₂` so that `W' ∩ N.seamU ⊆ c '' Ioo a_ivl b_ivl ⊆ bd S`. + obtain ⟨Uf₁, hUf₁_open, hUf₁_bd⟩ := N.exists_isOpen_inter_bd_eq_image_Ioo_f i a_ivl b_ivl + obtain ⟨Ug₁, hUg₁_open, hUg₁_bd⟩ := N.exists_isOpen_inter_bd_eq_image_Ioo_g i a_ivl b_ivl + let U₁' : Set N.D := U₁ ∩ Uf₁ + let U₂' : Set N.D := U₂ ∩ Ug₁ + have hU₁'_open : IsOpen U₁' := hU₁_open.inter hUf₁_open + have hU₂'_open : IsOpen U₂' := hU₂_open.inter hUg₁_open + have hx₁U₁' : x₁ ∈ U₁' := by + have hx₁Uf₁ : x₁ ∈ Uf₁ ∩ bd N.D := by + rw [hUf₁_bd] + exact ⟨t, ⟨hat, htb⟩, rfl⟩ + exact ⟨hx₁U₁, hx₁Uf₁.1⟩ + have hx₂U₂' : x₂ ∈ U₂' := by + have hx₂Ug₁ : x₂ ∈ Ug₁ ∩ bd N.D := by + rw [hUg₁_bd] + exact ⟨t, ⟨hat, htb⟩, rfl⟩ + exact ⟨hx₂U₂, hx₂Ug₁.1⟩ + have hU'_disj : Disjoint U₁' U₂' := hU_disj.mono inter_subset_left inter_subset_left + let O₁ : Set S := N.φ '' (U₁' \ bd N.D) + let O₂ : Set S := N.φ '' (U₂' \ bd N.D) + have hopen_map_compl : ∀ U : Set N.D, IsOpen U → IsOpen (N.φ '' (U \ bd N.D)) := by + exact net_interior_image_open (S := S) N hφ_closed + have hO₁_open : IsOpen O₁ := hopen_map_compl U₁' hU₁'_open + have hO₂_open : IsOpen O₂ := hopen_map_compl U₂' hU₂'_open + have hO_disj : Disjoint O₁ O₂ := by + rw [disjoint_iff_forall_ne] + rintro _ ⟨y₁, ⟨hy₁U, hy₁bd⟩, rfl⟩ _ ⟨y₂, ⟨hy₂U, _⟩, rfl⟩ heq + have hy12 : y₁ = y₂ := N.interior_inj y₁ hy₁bd y₂ heq + subst hy12 + exact hU'_disj.le_bot ⟨hy₁U, hy₂U⟩ + have hp_cl_O₁ : p ∈ closure O₁ := by + exact net_interior_accumulates N hU₁'_open hx₁U₁' + have hp_cl_O₂ : p ∈ closure O₂ := by + change N.φ (N.f i t) ∈ closure O₂ + rw [N.φ_f_eq_φ_g i t] + exact net_interior_accumulates N hU₂'_open hx₂U₂' + let W' : Set S := (N.φ '' (U₁' ∪ U₂')ᶜ)ᶜ + have hW'_open : IsOpen W' := + (hφ_closed _ (hU₁'_open.union hU₂'_open).isClosed_compl).isOpen_compl + have hpW' : p ∈ W' := by + rintro ⟨y, hy, hφy⟩ + rcases N.eq_f_or_g_of_φ_eq_of_mem_Ioo i ht hφy.symm with rfl | rfl + · exact hy (Or.inl hx₁U₁') + · exact hy (Or.inr hx₂U₂') + have hW'_sdiff_bd : W' \ bd S ⊆ O₁ ∪ O₂ := by + exact net_neighborhood_covered_off_boundary (S := S) N i U₁ U₂ a_ivl b_ivl + hIoo_ab_sub_bd Uf₁ hUf₁_bd Ug₁ hUg₁_bd + obtain ⟨V, P, hV_open, hpV, hVW', hPV, hP_pre, hP_int, hV_clP⟩ := + (hS.2.2 p).exists_half hW'_open hpW' + have hP_union : P ⊆ O₁ ∪ O₂ := fun z hz => hW'_sdiff_bd ⟨hVW' (hPV hz), fun hbd => hbd + (hP_int z hz)⟩ + rcases hP_pre.subset_or_subset hO₁_open hO₂_open hO_disj hP_union with hPO₁ | hPO₂ + · have hclP_disj : Disjoint (closure P) O₂ := + (Disjoint.mono_left hPO₁ hO_disj).closure_left hO₂_open + have hV_disj : Disjoint V O₂ := hclP_disj.mono_left hV_clP + obtain ⟨z, hzV, hzO₂⟩ := _root_.mem_closure_iff.mp hp_cl_O₂ V hV_open hpV + exact hV_disj.le_bot ⟨hzV, hzO₂⟩ + · have hclP_disj : Disjoint (closure P) O₁ := + (Disjoint.mono_left hPO₂ hO_disj.symm).closure_left hO₁_open + have hV_disj : Disjoint V O₁ := hclP_disj.mono_left hV_clP + obtain ⟨z, hzV, hzO₁⟩ := _root_.mem_closure_iff.mp hp_cl_O₁ V hV_open hpV + exact hV_disj.le_bot ⟨hzV, hzO₁⟩ + +/-! ## 2. Boundary cuffs and edge counting (`|E(J)| = r + |bd(S) ∩ V(J)|`) -/ + +/-- Every cuff `C ∈ cuffs S` of a surface `S` is closed in `S`. -/ +theorem isClosed_of_mem_cuffs (hS : IsSurface S) {C : Set S} (hC : C ∈ cuffs S) : + IsClosed C := by + have : T2Space S := hS.2.1 + obtain ⟨e⟩ := (cuff_statement S hS).2.2 C hC + have hcomp : IsCompact (range (Subtype.val ∘ e)) := isCompact_range (by fun_prop) + have hrange : range (Subtype.val ∘ e) = C := by + ext x + simp only [Function.comp_apply, mem_range] + exact ⟨by rintro ⟨t, rfl⟩; exact (e t).2, fun hx => ⟨e.symm ⟨x, hx⟩, by simp⟩⟩ + rw [← hrange] + exact hcomp.isClosed + +/-- For every cuff `C ∈ cuffs S`, `bd S \ C` is closed in `S`. -/ +theorem isClosed_bd_sdiff_cuff (hS : IsSurface S) {C : Set S} (hC : C ∈ cuffs S) : + IsClosed (bd S \ C) := by + have hfin : (cuffs S \ {C}).Finite := (cuff_statement S hS).2.1.sdiff + have heq : bd S \ C = ⋃₀ (cuffs S \ {C}) := by + ext x + simp only [Set.mem_sdiff, mem_sUnion, mem_singleton_iff] + constructor + · rintro ⟨hxbd, hxC⟩ + rw [← sUnion_cuffs (S := S)] at hxbd + rcases hxbd with ⟨C', hC', hxC'⟩ + refine ⟨C', ⟨hC', ?_⟩, hxC'⟩ + rintro rfl + exact hxC hxC' + · rintro ⟨C', ⟨hC', hne⟩, hxC'⟩ + have hxbd : x ∈ bd S := sUnion_cuffs (S := S) ▸ ⟨C', hC', hxC'⟩ + refine ⟨hxbd, fun hxC => ?_⟩ + exact Set.disjoint_left.mp (cuffs_disjoint hC' hC hne) hxC' hxC + rw [heq] + exact hfin.isClosed_sUnion fun C' hC' => isClosed_of_mem_cuffs hS hC'.1 + +/-- Every cuff `C ∈ cuffs S` of a surface `S` contains at least one vertex of `N.seamV` whenever +`0 < N.r`. -/ +theorem cuff_inter_seamV_nonempty (hS : IsSurface S) (N : Net S) (hpos : 0 < N.r) + {C : Set S} (hC : C ∈ cuffs S) : + (C ∩ N.seamV).Nonempty := by + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + have : T2Space S := hS.2.1 + by_contra hemp + rw [Set.not_nonempty_iff_eq_empty] at hemp + let A₁ : Set N.D := bd N.D ∩ N.φ ⁻¹' C + let A₂ : Set N.D := bd N.D \ N.φ ⁻¹' C + have hA₁_closed : IsClosed A₁ := + (isClosed_bd N.D).inter ((isClosed_of_mem_cuffs hS hC).preimage N.quotientMap_φ.continuous) + have hA₂_eq : A₂ = + (⋃ i : Fin N.r, (range (N.f i) ∪ range (N.g i))) ∪ + (bd N.D ∩ N.φ ⁻¹' (bd S \ C)) := by + ext x + simp only [A₂, Set.mem_sdiff, mem_preimage, mem_union, mem_iUnion, mem_range, mem_inter_iff] + constructor + · rintro ⟨hxbd, hxC⟩ + by_cases hxbdS : N.φ x ∈ bd S + · exact Or.inr ⟨hxbd, hxbdS, hxC⟩ + · by_cases hxV : N.φ x ∈ N.seamV + · obtain ⟨i, hi⟩ := mem_iUnion.mp (N.preimage_seamV_subset_endpoints hxV) + simp only [mem_insert_iff, mem_singleton_iff] at hi + rcases hi with rfl | rfl | rfl | rfl + · exact Or.inl ⟨i, Or.inl ⟨0, rfl⟩⟩ + · exact Or.inl ⟨i, Or.inl ⟨1, rfl⟩⟩ + · exact Or.inl ⟨i, Or.inr ⟨0, rfl⟩⟩ + · exact Or.inl ⟨i, Or.inr ⟨1, rfl⟩⟩ + · obtain ⟨i, w, hw, -, hfib, -⟩ := + N.exists_mem_Ioo_of_mem_bd_of_notMem_bd_of_notMem_seamV hxbd hxbdS hxV + have hx_mem : x ∈ N.φ ⁻¹' {N.φ x} := rfl + rw [hfib, mem_insert_iff, mem_singleton_iff] at hx_mem + rcases hx_mem with rfl | rfl + · exact Or.inl ⟨i, Or.inl ⟨w, rfl⟩⟩ + · exact Or.inl ⟨i, Or.inr ⟨w, rfl⟩⟩ + · rintro (⟨i, ⟨t, rfl⟩ | ⟨t, rfl⟩⟩ | ⟨hxbd, hxbdS, hxC⟩) + · refine ⟨N.range_f_subset_bd i ⟨t, rfl⟩, fun hφC => ?_⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact hemp.subset ⟨hφC, i, Or.inl rfl⟩ + · exact hemp.subset ⟨hφC, i, Or.inr rfl⟩ + · exact N.notMem_bd_of_mem_Ioo hS i ht (sUnion_cuffs (S := S) ▸ ⟨C, hC, hφC⟩) + · refine ⟨N.range_g_subset_bd i ⟨t, rfl⟩, fun hφC => ?_⟩ + have hφf : N.φ (N.f i t) ∈ C := (N.φ_f_eq_φ_g i t).symm ▸ hφC + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact hemp.subset ⟨hφf, i, Or.inl rfl⟩ + · exact hemp.subset ⟨hφf, i, Or.inr rfl⟩ + · exact N.notMem_bd_of_mem_Ioo hS i ht (sUnion_cuffs (S := S) ▸ ⟨C, hC, hφf⟩) + · exact ⟨hxbd, hxC⟩ + have hA₂_closed : IsClosed A₂ := by + rw [hA₂_eq] + refine (isClosed_iUnion_of_finite fun i => ?_).union + ((isClosed_bd N.D).inter ((isClosed_bd_sdiff_cuff hS hC).preimage N.quotientMap_φ.continuous)) + exact (isCompact_range (N.f i).continuous).isClosed.union + (isCompact_range (N.g i).continuous).isClosed + have hA₁_ne : A₁.Nonempty := by + obtain ⟨y, hybd, rfl⟩ := hC + obtain ⟨x, rfl⟩ := N.quotientMap_φ.surjective y + have hxbd : x ∈ bd N.D := by + rw [← N.preimage_seamU] + exact N.bd_subset_seamU hybd + exact ⟨x, hxbd, mem_connectedComponentIn hybd⟩ + have hA₂_ne : A₂.Nonempty := by + refine ⟨N.f ⟨0, hpos⟩ 0, ?_⟩ + rw [hA₂_eq] + exact Or.inl (mem_iUnion.mpr ⟨⟨0, hpos⟩, Or.inl ⟨0, rfl⟩⟩) + have hcov : bd N.D ⊆ A₁ ∪ A₂ := fun x hx => by + by_cases hxC : N.φ x ∈ C + · exact Or.inl ⟨hx, hxC⟩ + · exact Or.inr ⟨hx, hxC⟩ + obtain ⟨z, _, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp + N.isOArc_bd_D.isPreconnected A₁ A₂ hA₁_closed hA₂_closed hcov + ⟨hA₁_ne.some, hA₁_ne.some_mem.1, hA₁_ne.some_mem⟩ + ⟨hA₂_ne.some, hA₂_ne.some_mem.1, hA₂_ne.some_mem⟩ + exact hz₂.2 hz₁.2 + +/-- Whenever `N.IsSeamGraphFor J`, we have `0 < N.r` because `J.V = N.seamV` is nonempty. -/ +theorem r_pos_of_isSeamGraphFor (N : Net S) {J : Drawing S} (hJ : N.IsSeamGraphFor J) : + 0 < N.r := + hJ.1 + +/-- For any finite nonempty subset `V ⊆ Circle`, the arc-wise connected components of `Vᶜ` are +precisely `nextSegment V v` for `v ∈ V`, and there are `V.ncard` of them. -/ +theorem arcComponentsIn_compl_circle {V : Set Circle} (hV : V.Finite) (hne : V.Nonempty) : + arcComponentsIn (Vᶜ) = (nextSegment V) '' V ∧ + (arcComponentsIn (Vᶜ)).ncard = V.ncard := by + have hseg_pc : ∀ v ∈ V, IsPathConnected (nextSegment V v) := by + intro v hv + obtain ⟨e⟩ := nonempty_homeomorph_Ioo_nextSegment hV hv + have : PathConnectedSpace (Ioo (0 : ℝ) 1) := + isPathConnected_iff_pathConnectedSpace.mp + ((convex_Ioo (0 : ℝ) 1).isPathConnected ⟨1 / 2, by norm_num, by norm_num⟩) + have heq : range (Subtype.val ∘ e) = nextSegment V v := by + ext z + simp only [Function.comp_apply, mem_range] + exact ⟨by rintro ⟨t, rfl⟩; exact (e t).2, fun hz => ⟨e.symm ⟨z, hz⟩, by simp⟩⟩ + rw [← heq] + exact isPathConnected_range (continuous_subtype_val.comp e.continuous) + have hseg_mem : ∀ v ∈ V, nextSegment V v ∈ arcComponentsIn (Vᶜ) := by + intro v hv + obtain ⟨z, hz⟩ := nextSegment_nonempty hV hv + refine ⟨⟨z, hz⟩, nextSegment_subset_compl, hseg_pc v hv, ?_⟩ + intro D hDV hDpc hsub + apply Subset.antisymm _ hsub + rw [← connectedComponentIn_compl_eq_nextSegment hV hv hz] + exact hDpc.isConnected.isPreconnected.subset_connectedComponentIn (hsub hz) hDV + have heq : arcComponentsIn (Vᶜ) = (nextSegment V) '' V := by + ext E + simp only [mem_image] + constructor + · intro hE + obtain ⟨z, hzE⟩ := hE.1 + have hzV : z ∈ Vᶜ := hE.2.1 hzE + obtain ⟨v, ⟨hv, hzv⟩, -⟩ := exists_unique_nextSegment_of_mem_compl hV hne hzV + refine ⟨v, hv, ?_⟩ + have hsub : E ⊆ nextSegment V v := by + rw [← connectedComponentIn_compl_eq_nextSegment hV hv hzv] + exact hE.2.2.1.isConnected.isPreconnected.subset_connectedComponentIn hzE hE.2.1 + exact hE.2.2.2 (nextSegment V v) nextSegment_subset_compl (hseg_pc v hv) hsub + · rintro ⟨v, hv, rfl⟩ + exact hseg_mem v hv + have hinj : InjOn (nextSegment V) V := by + intro v₁ hv₁ v₂ hv₂ h12 + obtain ⟨z, hz₁⟩ := nextSegment_nonempty hV hv₁ + have hz₂ : z ∈ nextSegment V v₂ := h12 ▸ hz₁ + have hzV : z ∈ Vᶜ := nextSegment_subset_compl hz₁ + obtain ⟨v, _, huniq⟩ := exists_unique_nextSegment_of_mem_compl hV hne hzV + exact (huniq v₁ ⟨hv₁, hz₁⟩).trans (huniq v₂ ⟨hv₂, hz₂⟩).symm + exact ⟨heq, by rw [heq, Set.InjOn.ncard_image hinj]⟩ + +/-- For each cuff `C ∈ cuffs S` and seam graph `J` of a net `N`, the number of arc-wise connected +components of `C \ J.V` equals `(C ∩ J.V).ncard` (and is finite). -/ +theorem ncard_arcComponentsIn_cuff_sdiff (hS : IsSurface S) (N : Net S) {J : Drawing S} + (hJ : N.IsSeamGraphFor J) {C : Set S} (hC : C ∈ cuffs S) : + (arcComponentsIn (C \ J.V)).Finite ∧ + (arcComponentsIn (C \ J.V)).ncard = (C ∩ J.V).ncard := by + have : T2Space S := hS.2.1 + obtain ⟨φ_C⟩ := (cuff_statement S hS).2.2 C hC + let ι : Circle → S := Subtype.val ∘ φ_C + have hι_cont : Continuous ι := continuous_subtype_val.comp φ_C.continuous + have hι_inj : Function.Injective ι := Subtype.val_injective.comp φ_C.injective + let V_C : Set Circle := ι ⁻¹' J.V + have hVC_fin : V_C.Finite := J.finite_V.preimage hι_inj.injOn + have hVC_ne : V_C.Nonempty := by + obtain ⟨x, hxC, hxV⟩ := N.cuff_inter_seamV_nonempty hS hJ.1 hC + refine ⟨φ_C.symm ⟨x, hxC⟩, ?_⟩ + rw [mem_preimage, hJ.2.2] + simpa [ι] using hxV + have hι_VC : ι '' V_C = C ∩ J.V := by + ext x + simp only [V_C, ι, Function.comp_apply, mem_image, mem_preimage, mem_inter_iff] + exact ⟨by rintro ⟨z, hz, rfl⟩; exact ⟨(φ_C z).2, hz⟩, + fun ⟨hxC, hxV⟩ => ⟨φ_C.symm ⟨x, hxC⟩, by simpa using hxV, by simp⟩⟩ + have hι_compl : ι '' (V_Cᶜ) = C \ J.V := by + ext x + simp only [V_C, ι, Function.comp_apply, mem_image, mem_compl_iff, mem_preimage, Set.mem_sdiff] + exact ⟨by rintro ⟨z, hz, rfl⟩; exact ⟨(φ_C z).2, hz⟩, + fun ⟨hxC, hxV⟩ => ⟨φ_C.symm ⟨x, hxC⟩, by simpa using hxV, by simp⟩⟩ + obtain ⟨g, hg_cont, hgi⟩ := + exists_inv_of_compactOn (isCompact_univ (X := Circle)) hι_cont.continuousOn hι_inj.injOn + have harc_img : arcComponentsIn (C \ J.V) = image ι '' arcComponentsIn (V_Cᶜ) := by + rw [← hι_compl] + exact GM11.arcComponentsIn_image hι_cont.continuousOn + (hg_cont.mono (image_mono (subset_univ _))) (fun z _ => hgi (mem_univ z)) + obtain ⟨harc_eq, hncard_VC⟩ := arcComponentsIn_compl_circle hVC_fin hVC_ne + have harc_fin : (arcComponentsIn (V_Cᶜ)).Finite := by + rw [harc_eq] + exact hVC_fin.image _ + refine ⟨harc_img ▸ harc_fin.image _, ?_⟩ + rw [harc_img, ncard_image_of_injective _ (Set.image_injective.mpr hι_inj), hncard_VC, + ← hι_VC, ncard_image_of_injective _ hι_inj] + +/-- The number of arc-wise connected components of `bd S \ J.V` equals `(bd S ∩ J.V).ncard`. -/ +theorem ncard_arcComponentsIn_bd_sdiff (hS : IsSurface S) (N : Net S) {J : Drawing S} + (hJ : N.IsSeamGraphFor J) : + (arcComponentsIn (bd S \ J.V)).Finite ∧ + (arcComponentsIn (bd S \ J.V)).ncard = (bd S ∩ J.V).ncard := by + have : T2Space S := hS.2.1 + have hkey : ∀ 𝓐 : Set (Set S), 𝓐.Finite → 𝓐 ⊆ cuffs S → + (arcComponentsIn ((⋃₀ 𝓐) \ J.V)).Finite ∧ + (arcComponentsIn ((⋃₀ 𝓐) \ J.V)).ncard = ((⋃₀ 𝓐) ∩ J.V).ncard := by + intro 𝓐 h𝓐 + induction 𝓐, h𝓐 using Set.Finite.induction_on with + | empty => + intro _ + have hemp : arcComponentsIn ((⋃₀ (∅ : Set (Set S))) \ J.V) = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro E ⟨⟨x, hx⟩, hsub, _⟩ + exact absurd (hsub hx) (by simp) + rw [hemp] + simp + | @insert C 𝓐 hC_not_mem h𝓐_fin ih => + intro hsub + have hC_cuff : C ∈ cuffs S := hsub (mem_insert _ _) + have h𝓐_sub : 𝓐 ⊆ cuffs S := (subset_insert _ _).trans hsub + obtain ⟨hfin_𝓐, hncard_𝓐⟩ := ih h𝓐_sub + obtain ⟨hfin_C, hncard_C⟩ := N.ncard_arcComponentsIn_cuff_sdiff hS hJ hC_cuff + have hC_closed : IsClosed C := isClosed_of_mem_cuffs hS hC_cuff + have h𝓐_closed : IsClosed (⋃₀ 𝓐) := + h𝓐_fin.isClosed_sUnion fun C' hC' => isClosed_of_mem_cuffs hS (h𝓐_sub hC') + have hdisj_C_𝓐 : Disjoint C (⋃₀ 𝓐) := by + rw [Set.disjoint_left] + rintro x hxC ⟨C', hC', hxC'⟩ + have hne : C ≠ C' := fun h => hC_not_mem (h ▸ hC') + exact Set.disjoint_left.mp (cuffs_disjoint hC_cuff (h𝓐_sub hC') hne) hxC hxC' + have hsdiff_eq : (⋃₀ insert C 𝓐) \ J.V = (C \ J.V) ∪ ((⋃₀ 𝓐) \ J.V) := by + rw [sUnion_insert, union_sdiff_distrib] + have harc_union : + arcComponentsIn ((⋃₀ insert C 𝓐) \ J.V) = + arcComponentsIn (C \ J.V) ∪ arcComponentsIn ((⋃₀ 𝓐) \ J.V) := by + rw [hsdiff_eq] + exact GM11.arcComponentsIn_union hC_closed h𝓐_closed sdiff_subset sdiff_subset + fun x _ hxC hx𝓐 => Set.disjoint_left.mp hdisj_C_𝓐 hxC hx𝓐 + have hdisj_arc : Disjoint (arcComponentsIn (C \ J.V)) (arcComponentsIn ((⋃₀ 𝓐) \ J.V)) := by + rw [Set.disjoint_left] + intro E hEC hE𝓐 + obtain ⟨x, hx⟩ := hEC.1 + exact Set.disjoint_left.mp hdisj_C_𝓐 (hEC.2.1 hx).1 (hE𝓐.2.1 hx).1 + have hinter_eq : (⋃₀ insert C 𝓐) ∩ J.V = (C ∩ J.V) ∪ ((⋃₀ 𝓐) ∩ J.V) := by + rw [sUnion_insert, union_inter_distrib_right] + have hdisj_V : Disjoint (C ∩ J.V) ((⋃₀ 𝓐) ∩ J.V) := + hdisj_C_𝓐.mono inter_subset_left inter_subset_left + refine ⟨harc_union ▸ hfin_C.union hfin_𝓐, ?_⟩ + rw [harc_union, ncard_union_eq hdisj_arc hfin_C hfin_𝓐, hncard_C, hncard_𝓐, + hinter_eq, ncard_union_eq hdisj_V (J.finite_V.subset inter_subset_right) + (J.finite_V.subset inter_subset_right)] + simpa [sUnion_cuffs] using hkey (cuffs S) (cuff_statement S hS).2.1 Subset.rfl + +/-! ### Explicit edge decomposition of a seam graph -/ + +/-- The `i`-th interior seam curve `N.φ ∘ N.f i : C(unitInterval, S)`. -/ +def interiorSeamCurve (N : Net S) (i : Fin N.r) : C(unitInterval, S) := + ⟨N.φ ∘ N.f i, N.quotientMap_φ.continuous.comp (N.f i).continuous⟩ + +/-- The `i`-th interior seam edge `(N.φ ∘ N.f i) '' Ioo 0 1`. -/ +def interiorSeamEdge (N : Net S) (i : Fin N.r) : Set S := + N.interiorSeamCurve i '' Ioo (0 : unitInterval) 1 + +theorem e_int_isLink [T2Space S] (N : Net S) {J : Drawing S} (hJ : N.IsSeamGraphFor J) + (i : Fin N.r) : + J.toGraph.IsLink (N.interiorSeamEdge i) (N.φ (N.f i 0)) (N.φ (N.f i 1)) := by + refine (Drawing.eq_edge_of_injOn_Ioo J (N.interiorSeamCurve i) ?_ ?_ ?_ ?_).2 + · rw [hJ.2.2] + exact ⟨i, Or.inl rfl⟩ + · rw [hJ.2.2] + exact ⟨i, Or.inr rfl⟩ + · intro t ht + rw [hJ.2.1, hJ.2.2] + exact ⟨⟨N.f i t, N.range_f_subset_bd i ⟨t, rfl⟩, rfl⟩, N.notMem_seamV_of_mem_Ioo i ht⟩ + · intro t₁ ht₁ t₂ _ h12 + rcases N.eq_f_or_g_of_φ_eq_of_mem_Ioo i ht₁ h12 with hff | hfg + · exact (N.injective_f i hff).symm + · exact False.elim (N.internally_disjoint_gf i i t₁ ht₁ ⟨t₂, hfg⟩) + +theorem e_int_mem_E [T2Space S] (N : Net S) {J : Drawing S} (hJ : N.IsSeamGraphFor J) + (i : Fin N.r) : N.interiorSeamEdge i ∈ J.E := + (N.e_int_isLink hJ i).edge_mem + +theorem tilde_e_int [T2Space S] (N : Net S) {J : Drawing S} (hJ : N.IsSeamGraphFor J) + (i : Fin N.r) : + tilde (N.interiorSeamEdge i) = {N.φ (N.f i 0), N.φ (N.f i 1)} := by + rw [tilde_eq_closure_inter_V J (N.e_int_mem_E hJ i)] + have hlink := N.e_int_isLink hJ i + unfold Drawing.toGraph at hlink + exact hlink.2.2.2 + +theorem e_int_injective (N : Net S) : Function.Injective N.interiorSeamEdge := by + intro i j hij + let t₀ : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht₀ : t₀ ∈ Ioo (0 : unitInterval) 1 := by + constructor <;> rw [← Subtype.coe_lt_coe] <;> norm_num [t₀] + have hmem : N.interiorSeamCurve i t₀ ∈ N.interiorSeamEdge j := hij ▸ ⟨t₀, ht₀, rfl⟩ + rcases hmem with ⟨s, _, hs_eq⟩ + by_contra hne + rcases N.eq_f_or_g_of_φ_eq_of_mem_Ioo i ht₀ hs_eq.symm with hff | hfg + · exact N.internally_disjoint_ff i j hne t₀ ht₀ ⟨s, hff⟩ + · exact N.internally_disjoint_gf i j t₀ ht₀ ⟨s, hfg⟩ + +theorem disjoint_e_int_bd (hS : IsSurface S) (N : Net S) (i : Fin N.r) : + Disjoint (N.interiorSeamEdge i) (bd S) := by + rw [Set.disjoint_left] + rintro _ ⟨t, ht, rfl⟩ hbd + exact N.notMem_bd_of_mem_Ioo hS i ht hbd + +theorem seamGraph_edges_eq (hS : IsSurface S) (N : Net S) {J : Drawing S} + (hJ : N.IsSeamGraphFor J) : + J.E = range N.interiorSeamEdge ∪ arcComponentsIn (bd S \ J.V) ∧ + Disjoint (range N.interiorSeamEdge) (arcComponentsIn (bd S \ J.V)) := by + have : T2Space S := hS.2.1 + let A : Set S := (J.U \ J.V) \ bd S + let B : Set S := bd S \ J.V + have hA_eq : A = ⋃ i : Fin N.r, N.interiorSeamEdge i := by + ext p + simp only [A, interiorSeamEdge, interiorSeamCurve, ContinuousMap.coe_mk, Function.comp_apply, + Set.mem_sdiff, + mem_iUnion, mem_image] + constructor + · rintro ⟨⟨hpU, hpV⟩, hpbd⟩ + rw [hJ.2.1] at hpU + rw [hJ.2.2] at hpV + obtain ⟨x, hxbd, rfl⟩ := hpU + obtain ⟨i, w, hw, hφw, -, -⟩ := + N.exists_mem_Ioo_of_mem_bd_of_notMem_bd_of_notMem_seamV hxbd hpbd hpV + exact ⟨i, w, hw, hφw⟩ + · rintro ⟨i, t, ht, rfl⟩ + rw [hJ.2.1, hJ.2.2] + exact ⟨⟨⟨N.f i t, N.range_f_subset_bd i ⟨t, rfl⟩, rfl⟩, + N.notMem_seamV_of_mem_Ioo i ht⟩, N.notMem_bd_of_mem_Ioo hS i ht⟩ + let U₁ : Set S := ⋃ i : Fin N.r, range (N.interiorSeamCurve i) + have hU₁_closed : IsClosed U₁ := + isClosed_iUnion_of_finite fun i => (isCompact_range (N.interiorSeamCurve i).continuous).isClosed + have hA_sub_U₁ : A ⊆ U₁ := by + rw [hA_eq] + exact iUnion_mono fun i => image_subset_range _ _ + have hUV_eq : J.U \ J.V = A ∪ B := by + ext p + simp only [A, B, Set.mem_sdiff, mem_union] + have hbd_sub : bd S ⊆ J.U := hJ.2.1 ▸ N.bd_subset_seamU + by_cases hpbd : p ∈ bd S + · exact ⟨fun ⟨_, hpV⟩ => Or.inr ⟨hpbd, hpV⟩, + by rintro (⟨⟨_, hpV⟩, _⟩ | ⟨_, hpV⟩) <;> exact ⟨hbd_sub hpbd, hpV⟩⟩ + · constructor + · intro hp + exact Or.inl ⟨hp, hpbd⟩ + · rintro (⟨hp, _⟩ | ⟨hpbd', _⟩) + · exact hp + · exact False.elim (hpbd hpbd') + have hAB_disj : ∀ x ∈ A ∪ B, x ∈ U₁ → x ∉ bd S := by + intro x hx hu₁ hxbd + rw [mem_iUnion] at hu₁ + rcases hu₁ with ⟨i, t, rfl⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · rw [← hUV_eq] at hx + exact hx.2 (hJ.2.2 ▸ ⟨i, Or.inl rfl⟩) + · rw [← hUV_eq] at hx + exact hx.2 (hJ.2.2 ▸ ⟨i, Or.inr rfl⟩) + · exact N.notMem_bd_of_mem_Ioo hS i ht hxbd + have harc_union : J.E = arcComponentsIn A ∪ arcComponentsIn B := by + change arcComponentsIn (J.U \ J.V) = _ + rw [hUV_eq] + exact GM11.arcComponentsIn_union hU₁_closed (isClosed_bd S) hA_sub_U₁ sdiff_subset hAB_disj + have harc_A : arcComponentsIn A = range N.interiorSeamEdge := by + ext E + simp only [mem_range] + constructor + · intro hE + have hEJ : E ∈ J.E := harc_union ▸ Or.inl hE + obtain ⟨p, hpE⟩ := hE.1 + have hpA : p ∈ A := hE.2.1 hpE + rw [hA_eq, mem_iUnion] at hpA + obtain ⟨i, hpi⟩ := hpA + exact ⟨i, J.edge_eq_of_mem (N.e_int_mem_E hJ i) hEJ hpi hpE⟩ + · rintro ⟨i, rfl⟩ + rcases harc_union ▸ N.e_int_mem_E hJ i with hEA | hEB + · exact hEA + · obtain ⟨p, hp⟩ := hEB.1 + have hpA : p ∈ A := by + rw [hA_eq, mem_iUnion] + exact ⟨i, hp⟩ + exact False.elim (hpA.2 (hEB.2.1 hp).1) + have hdisj_arc : Disjoint (range N.interiorSeamEdge) (arcComponentsIn B) := by + rw [← harc_A, Set.disjoint_left] + intro E hEA hEB + obtain ⟨p, hp⟩ := hEA.1 + exact (hEA.2.1 hp).2 (hEB.2.1 hp).1 + exact ⟨harc_A ▸ harc_union, hdisj_arc⟩ + +/-- For any seam graph `J` of a net `N` on a surface `S`, +`J.E.ncard = N.r + (bd S ∩ J.V).ncard`. -/ +theorem ncard_E_seamGraph (hS : IsSurface S) (N : Net S) {J : Drawing S} + (hJ : N.IsSeamGraphFor J) : + J.E.ncard = N.r + (bd S ∩ J.V).ncard := by + obtain ⟨hedges, hdisjoint⟩ := N.seamGraph_edges_eq hS hJ + obtain ⟨hfin, hcount⟩ := N.ncard_arcComponentsIn_bd_sdiff hS hJ + rw [hedges, ncard_union_eq hdisjoint (finite_range _) hfin, hcount, + ncard_range_of_injective N.e_int_injective, Nat.card_eq_fintype_card, Fintype.card_fin] + +/-! ## 3. Cohomology of a net and Euler's formula ((2.2)) -/ + +local notation "K" => ZMod 2 + +/-- The vertex set `N.seamV` of a net `N` is finite. -/ +theorem finite_seamV (N : Net S) : N.seamV.Finite := by + refine (finite_iUnion fun i : Fin N.r => + (finite_singleton (N.φ (N.f i 1))).insert (N.φ (N.f i 0))).subset fun v hv => ?_ + rcases hv with ⟨i, h0 | h1⟩ + · exact mem_iUnion.mpr ⟨i, Or.inl h0.symm⟩ + · exact mem_iUnion.mpr ⟨i, Or.inr (mem_singleton_iff.mpr h1.symm)⟩ + +/-- Submodule of `N.seamV → K` consisting of functions that are constant on `C ∩ N.seamV` for each +cuff `C ∈ cuffs S`. -/ +private def W_bd (N : Net S) : Submodule K (N.seamV → K) where + carrier := {w : N.seamV → K | + ∀ C ∈ cuffs S, ∀ x : N.seamV, x.1 ∈ C → ∀ y : N.seamV, y.1 ∈ C → w x = w y} + add_mem' {w₁ w₂} hw₁ hw₂ C hC x hx y hy := by + simp [hw₁ C hC x hx y hy, hw₂ C hC x hx y hy] + zero_mem' _ _ _ _ _ _ := rfl + smul_mem' c {w} hw C hC x hx y hy := by + simp [hw C hC x hx y hy] + +/-- The coboundary linear map `δ : N.W_bd →ₗ[K] (Fin N.r → K)` sending `w` to +`i ↦ w(φ(f_i(0))) + w(φ(f_i(1)))`. -/ +private def δ (N : Net S) : N.W_bd →ₗ[K] (Fin N.r → K) where + toFun w i := + w.1 ⟨N.φ (N.f i 0), i, Or.inl rfl⟩ + w.1 ⟨N.φ (N.f i 1), i, Or.inr rfl⟩ + map_add' w₁ w₂ := by + ext i + change (w₁.1 _ + w₂.1 _) + (w₁.1 _ + w₂.1 _) = (w₁.1 _ + w₁.1 _) + (w₂.1 _ + w₂.1 _) + ring + map_smul' c w := by + ext i + change c * w.1 _ + c * w.1 _ = c * (w.1 _ + w.1 _) + ring + +/-- Helper constructing the cuff containing a boundary point `x ∈ bd S`. -/ +private noncomputable def cuffOf {x : S} (hx : x ∈ bd S) : cuffs S := + ⟨connectedComponentIn (bd S) x, x, hx, rfl⟩ + +private theorem cuffOf_eq {C : cuffs S} {x : S} (hx : x ∈ C.1) (hxbd : x ∈ bd S) : + cuffOf hxbd = C := by + apply Subtype.ext + obtain ⟨z, _, hC⟩ := C.2 + change connectedComponentIn (bd S) x = C.1 + rw [← hC] at hx ⊢ + exact (connectedComponentIn_eq hx).symm + +/-- The dimension of `N.W_bd` satisfies +`Module.finrank K N.W_bd + (bd S ∩ N.seamV).ncard = N.seamV.ncard + (cuffs S).ncard`. -/ +private theorem finrank_W_bd (hS : IsSurface S) (N : Net S) (hpos : 0 < N.r) : + Module.finrank K N.W_bd + (bd S ∩ N.seamV).ncard = + N.seamV.ncard + (cuffs S).ncard := by + classical + have : T2Space S := hS.2.1 + have hfin_V : N.seamV.Finite := N.finite_seamV + have hfin_cuffs : (cuffs S).Finite := (cuff_statement S hS).2.1 + have hfin_int : (N.seamV \ bd S).Finite := hfin_V.sdiff + have hfin_bd : (bd S ∩ N.seamV).Finite := hfin_V.subset inter_subset_right + let _ : Fintype N.seamV := hfin_V.fintype + let _ : Fintype ↑(N.seamV \ bd S) := hfin_int.fintype + let _ : Fintype ↑(cuffs S) := hfin_cuffs.fintype + have hne_cuff : ∀ C : cuffs S, ∃ v : N.seamV, v.1 ∈ C.1 := by + intro C + obtain ⟨x, hxC, hxV⟩ := N.cuff_inter_seamV_nonempty hS hpos C.2 + exact ⟨⟨x, hxV⟩, hxC⟩ + choose v_C hv_C using hne_cuff + let toFun : N.W_bd → (↑(N.seamV \ bd S) → K) × (↑(cuffs S) → K) := fun w => + (fun x => w.1 ⟨x.1, x.2.1⟩, fun C => w.1 (v_C C)) + let invFun : (↑(N.seamV \ bd S) → K) × (↑(cuffs S) → K) → N.W_bd := fun p => + ⟨fun x => + if hx : x.1 ∈ bd S then + p.2 (cuffOf hx) + else + p.1 ⟨x.1, x.2, hx⟩, + by + intro C hC x hxC y hyC + have hxbd : x.1 ∈ bd S := sUnion_cuffs (S := S) ▸ ⟨C, hC, hxC⟩ + have hybd : y.1 ∈ bd S := sUnion_cuffs (S := S) ▸ ⟨C, hC, hyC⟩ + simp only [hxbd, hybd, ↓reduceDIte] + rw [cuffOf_eq (C := ⟨C, hC⟩) hxC hxbd, cuffOf_eq (C := ⟨C, hC⟩) hyC hybd]⟩ + let e : N.W_bd ≃ₗ[K] ((↑(N.seamV \ bd S) → K) × (↑(cuffs S) → K)) := + { toFun := toFun + invFun := invFun + map_add' := fun w₁ w₂ => by + ext x <;> rfl + map_smul' := fun c w => by + ext x <;> rfl + left_inv := fun w => by + ext x + dsimp only [toFun, invFun] + split_ifs with hxbd + · have hxC : x.1 ∈ (cuffOf hxbd).1 := mem_connectedComponentIn hxbd + exact w.2 (cuffOf hxbd).1 (cuffOf hxbd).2 (v_C (cuffOf hxbd)) (hv_C (cuffOf hxbd)) x hxC + · rfl + right_inv := fun p => by + ext x + · dsimp only [toFun, invFun] + have hnot : ¬ (x.1 : S) ∈ bd S := x.2.2 + simp only [hnot, ↓reduceDIte] + · dsimp only [toFun, invFun] + have hbd : (v_C x).1 ∈ bd S := sUnion_cuffs (S := S) ▸ ⟨x.1, x.2, hv_C x⟩ + simp only [hbd, ↓reduceDIte] + rw [cuffOf_eq (hv_C x) hbd] } + have hfinrank : Module.finrank K N.W_bd = + (N.seamV \ bd S).ncard + (cuffs S).ncard := by + rw [LinearEquiv.finrank_eq e, Module.finrank_prod, + Module.finrank_fintype_fun_eq_card, Module.finrank_fintype_fun_eq_card, + ← Nat.card_eq_fintype_card, ← Nat.card_eq_fintype_card, + Nat.card_coe_set_eq, Nat.card_coe_set_eq] + have hpart : (N.seamV \ bd S).ncard + (bd S ∩ N.seamV).ncard = N.seamV.ncard := by + have hunion : (N.seamV \ bd S) ∪ (bd S ∩ N.seamV) = N.seamV := by + ext x + simp only [Set.mem_sdiff, mem_union, mem_inter_iff] + tauto + have hdisj : Disjoint (N.seamV \ bd S) (bd S ∩ N.seamV) := by + rw [Set.disjoint_left] + exact fun _ hx hy => hx.2 hy.1 + rw [← ncard_union_eq hdisj hfin_int hfin_bd, hunion] + omega + +/-- Key connectedness lemma on `bd N.D`: if `d : N.D → K` and `w ∈ N.W_bd` satisfy: +1. `d (N.f i 0) + d (N.f i 1) = N.δ w i` and `d (N.g i 0) + d (N.g i 1) = N.δ w i` for all `i`, +2. `d` is locally constant on `bd N.D ∩ N.φ ⁻¹' (bd S)`, +then `x ↦ d x + w.1 ⟨N.φ x, hx⟩` is constant on `N.φ ⁻¹' N.seamV`. -/ +private theorem bd_D_const_of_cuff_and_seam (hS : IsSurface S) (N : Net S) (hpos : 0 < N.r) + (d : N.D → K) (w : N.W_bd) + (hdf : ∀ i : Fin N.r, d (N.f i 0) + d (N.f i 1) = N.δ w i) + (hdg : ∀ i : Fin N.r, d (N.g i 0) + d (N.g i 1) = N.δ w i) + (hloc : ∀ p ∈ bd N.D ∩ N.φ ⁻¹' (bd S), + ∃ W ∈ 𝓝 p, ∀ x ∈ W ∩ (bd N.D ∩ N.φ ⁻¹' (bd S)), d x = d p) + {x z : N.D} (hx : N.φ x ∈ N.seamV) (hz : N.φ z ∈ N.seamV) : + d x + w.1 ⟨N.φ x, hx⟩ = d z + w.1 ⟨N.φ z, hz⟩ := by + classical + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + have : T2Space S := hS.2.1 + have hne_cuff : ∀ C : cuffs S, ∃ v : N.seamV, v.1 ∈ C.1 := by + intro C + obtain ⟨y, hyC, hyV⟩ := N.cuff_inter_seamV_nonempty hS hpos C.2 + exact ⟨⟨y, hyV⟩, hyC⟩ + choose v_C hv_C using hne_cuff + let val_f (i : Fin N.r) : K := d (N.f i 0) + w.1 ⟨N.φ (N.f i 0), i, Or.inl rfl⟩ + let val_g (i : Fin N.r) : K := d (N.g i 0) + w.1 ⟨N.φ (N.g i 0), i, Or.inl (N.φ_f_eq_φ_g i 0)⟩ + have hval_f1 : ∀ i : Fin N.r, + d (N.f i 1) + w.1 ⟨N.φ (N.f i 1), i, Or.inr rfl⟩ = val_f i := by + intro i + have h1 := hdf i + change d (N.f i 0) + d (N.f i 1) = + w.1 ⟨N.φ (N.f i 0), i, Or.inl rfl⟩ + w.1 ⟨N.φ (N.f i 1), i, Or.inr rfl⟩ at h1 + have h2 : (d (N.f i 1) + w.1 ⟨N.φ (N.f i 1), i, Or.inr rfl⟩) + val_f i = + (d (N.f i 0) + d (N.f i 1)) + + (w.1 ⟨N.φ (N.f i 0), i, Or.inl rfl⟩ + w.1 ⟨N.φ (N.f i 1), i, Or.inr rfl⟩) := by + dsimp [val_f]; ring + refine CharTwo.add_eq_zero.mp ?_ + rw [h2, h1, CharTwo.add_self_eq_zero] + have hval_g1 : ∀ i : Fin N.r, + d (N.g i 1) + w.1 ⟨N.φ (N.g i 1), i, Or.inr (N.φ_f_eq_φ_g i 1)⟩ = val_g i := by + intro i + have h1 := hdg i + change d (N.g i 0) + d (N.g i 1) = + w.1 ⟨N.φ (N.f i 0), i, Or.inl rfl⟩ + w.1 ⟨N.φ (N.f i 1), i, Or.inr rfl⟩ at h1 + have hw0 : (⟨N.φ (N.g i 0), i, Or.inl (N.φ_f_eq_φ_g i 0)⟩ : N.seamV) = + ⟨N.φ (N.f i 0), i, Or.inl rfl⟩ := Subtype.ext (N.φ_f_eq_φ_g i 0).symm + have hw1 : (⟨N.φ (N.g i 1), i, Or.inr (N.φ_f_eq_φ_g i 1)⟩ : N.seamV) = + ⟨N.φ (N.f i 1), i, Or.inr rfl⟩ := Subtype.ext (N.φ_f_eq_φ_g i 1).symm + rw [hw1] + have h2 : (d (N.g i 1) + w.1 ⟨N.φ (N.f i 1), i, Or.inr rfl⟩) + val_g i = + (d (N.g i 0) + d (N.g i 1)) + + (w.1 ⟨N.φ (N.f i 0), i, Or.inl rfl⟩ + w.1 ⟨N.φ (N.f i 1), i, Or.inr rfl⟩) := by + dsimp [val_g]; rw [hw0]; ring + refine CharTwo.add_eq_zero.mp ?_ + rw [h2, h1, CharTwo.add_self_eq_zero] + let u : N.D → K := fun y => + if hyV : N.φ y ∈ N.seamV then + d y + w.1 ⟨N.φ y, hyV⟩ + else if hyf : ∃ i : Fin N.r, y ∈ range (N.f i) then + val_f hyf.choose + else if hyg : ∃ i : Fin N.r, y ∈ range (N.g i) then + val_g hyg.choose + else if hybd : N.φ y ∈ bd S then + d y + w.1 (v_C (cuffOf hybd)) + else 0 + have hu_f : ∀ (i : Fin N.r) (t : unitInterval), u (N.f i t) = val_f i := by + intro i t + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · have hV : N.φ (N.f i 0) ∈ N.seamV := ⟨i, Or.inl rfl⟩ + simp only [u, hV, ↓reduceDIte, val_f] + · have hV : N.φ (N.f i 1) ∈ N.seamV := ⟨i, Or.inr rfl⟩ + simp only [u, hV, ↓reduceDIte] + exact hval_f1 i + · have hnV : N.φ (N.f i t) ∉ N.seamV := N.notMem_seamV_of_mem_Ioo i ht + have hrf : ∃ j : Fin N.r, N.f i t ∈ range (N.f j) := ⟨i, t, rfl⟩ + simp only [u, hnV, hrf, ↓reduceDIte] + obtain ⟨s, hs⟩ := hrf.choose_spec + by_contra hne + have hij : i ≠ hrf.choose := fun h => hne (h ▸ rfl) + exact N.internally_disjoint_ff i hrf.choose hij t ht ⟨s, hs⟩ + have hu_g : ∀ (i : Fin N.r) (t : unitInterval), u (N.g i t) = val_g i := by + intro i t + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · have hV : N.φ (N.g i 0) ∈ N.seamV := ⟨i, Or.inl (N.φ_f_eq_φ_g i 0)⟩ + simp only [u, hV, ↓reduceDIte, val_g] + · have hV : N.φ (N.g i 1) ∈ N.seamV := ⟨i, Or.inr (N.φ_f_eq_φ_g i 1)⟩ + simp only [u, hV, ↓reduceDIte] + exact hval_g1 i + · have hnV : N.φ (N.g i t) ∉ N.seamV := by + rw [← N.φ_f_eq_φ_g i t] + exact N.notMem_seamV_of_mem_Ioo i ht + have hnf : ¬ ∃ j : Fin N.r, N.g i t ∈ range (N.f j) := by + rintro ⟨j, s, hs⟩ + exact N.internally_disjoint_gf i j t ht ⟨s, hs⟩ + have hrg : ∃ j : Fin N.r, N.g i t ∈ range (N.g j) := ⟨i, t, rfl⟩ + simp only [u, hnV, hnf, hrg, ↓reduceDIte] + obtain ⟨s, hs⟩ := hrg.choose_spec + by_contra hne + have hij : i ≠ hrg.choose := fun h => hne (h ▸ rfl) + exact N.internally_disjoint_gg i hrg.choose hij t ht ⟨s, hs⟩ + have hu_cuff : ∀ (C : cuffs S) (y : N.D), y ∈ bd N.D ∩ N.φ ⁻¹' C.1 → + u y = d y + w.1 (v_C C) := by + intro C y ⟨hybd_D, hyC⟩ + have hybdS : N.φ y ∈ bd S := sUnion_cuffs (S := S) ▸ ⟨C.1, C.2, hyC⟩ + by_cases hyV : N.φ y ∈ N.seamV + · simp only [u, hyV, ↓reduceDIte] + rw [w.2 C.1 C.2 ⟨N.φ y, hyV⟩ hyC (v_C C) (hv_C C)] + · have hnf : ¬ ∃ i : Fin N.r, y ∈ range (N.f i) := by + rintro ⟨i, t, rfl⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact hyV ⟨i, Or.inl rfl⟩ + · exact hyV ⟨i, Or.inr rfl⟩ + · exact N.notMem_bd_of_mem_Ioo hS i ht hybdS + have hng : ¬ ∃ i : Fin N.r, y ∈ range (N.g i) := by + rintro ⟨i, t, rfl⟩ + have hyV' : N.φ (N.f i t) ∉ N.seamV := by rwa [N.φ_f_eq_φ_g i t] + have hybdS' : N.φ (N.f i t) ∈ bd S := by rwa [N.φ_f_eq_φ_g i t] + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact hyV' ⟨i, Or.inl rfl⟩ + · exact hyV' ⟨i, Or.inr rfl⟩ + · exact N.notMem_bd_of_mem_Ioo hS i ht hybdS' + simp only [u, hyV, hnf, hng, hybdS, ↓reduceDIte] + rw [cuffOf_eq hyC hybdS] + have hu_loc : ∀ p ∈ bd N.D, ∃ W ∈ 𝓝 p, ∀ y ∈ W ∩ bd N.D, u y = u p := by + intro p hp + let F_f : Set N.D := ⋃ (i : Fin N.r) (_ : p ∉ range (N.f i)), range (N.f i) + let F_g : Set N.D := ⋃ (i : Fin N.r) (_ : p ∉ range (N.g i)), range (N.g i) + let F_c : Set N.D := + ⋃ (C ∈ cuffs S) (_ : p ∉ bd N.D ∩ N.φ ⁻¹' C), (bd N.D ∩ N.φ ⁻¹' C) + have hFf_cl : IsClosed F_f := + isClosed_iUnion_of_finite fun i => isClosed_iUnion_of_finite fun _ => + (isCompact_range (N.f i).continuous).isClosed + have hFg_cl : IsClosed F_g := + isClosed_iUnion_of_finite fun i => isClosed_iUnion_of_finite fun _ => + (isCompact_range (N.g i).continuous).isClosed + have hFc_cl : IsClosed F_c := by + refine (cuff_statement S hS).2.1.isClosed_biUnion fun C hC => + isClosed_iUnion_of_finite fun _ => (isClosed_bd N.D).inter ?_ + exact (isClosed_of_mem_cuffs hS hC).preimage N.quotientMap_φ.continuous + have hp_not_F : p ∈ (F_f ∪ F_g ∪ F_c)ᶜ := by + rintro ((h | h) | h) + · obtain ⟨i, hni, hi⟩ := mem_iUnion₂.mp h + exact hni hi + · obtain ⟨i, hni, hi⟩ := mem_iUnion₂.mp h + exact hni hi + · obtain ⟨C, _, h⟩ := mem_iUnion₂.mp h + obtain ⟨hni, hi⟩ := mem_iUnion.mp h + exact hni hi + have hW₁_mem : (F_f ∪ F_g ∪ F_c)ᶜ ∈ 𝓝 p := + ((hFf_cl.union hFg_cl).union hFc_cl).isOpen_compl.mem_nhds hp_not_F + have hW₂_mem : ∃ W₂ ∈ 𝓝 p, p ∈ bd N.D ∩ N.φ ⁻¹' (bd S) → + ∀ y ∈ W₂ ∩ (bd N.D ∩ N.φ ⁻¹' (bd S)), d y = d p := by + by_cases hp_bd : p ∈ bd N.D ∩ N.φ ⁻¹' (bd S) + · obtain ⟨W₂, hW₂, h2⟩ := hloc p hp_bd + exact ⟨W₂, hW₂, fun _ => h2⟩ + · exact ⟨univ, univ_mem, fun h => False.elim (hp_bd h)⟩ + obtain ⟨W₂, hW₂, hW₂_eq⟩ := hW₂_mem + refine ⟨(F_f ∪ F_g ∪ F_c)ᶜ ∩ W₂, Filter.inter_mem hW₁_mem hW₂, fun y ⟨⟨hyF, hyW₂⟩, hybd⟩ => ?_⟩ + by_cases hybdS : N.φ y ∈ bd S + · obtain ⟨C, hC, hyC⟩ := sUnion_cuffs (S := S) ▸ hybdS + have hpC : p ∈ bd N.D ∩ N.φ ⁻¹' C := by + by_contra hnp + exact hyF (Or.inr (mem_iUnion₂.mpr ⟨C, hC, mem_iUnion.mpr ⟨hnp, hybd, hyC⟩⟩)) + have hpbdS : N.φ p ∈ bd S := sUnion_cuffs (S := S) ▸ ⟨C, hC, hpC.2⟩ + rw [hu_cuff ⟨C, hC⟩ y ⟨hybd, hyC⟩, hu_cuff ⟨C, hC⟩ p hpC, + hW₂_eq ⟨hp, hpbdS⟩ y ⟨hyW₂, hybd, hybdS⟩] + · have hy_fg : ∃ i : Fin N.r, y ∈ range (N.f i) ∨ y ∈ range (N.g i) := by + by_cases hyV : N.φ y ∈ N.seamV + · obtain ⟨i, hi⟩ := mem_iUnion.mp (N.preimage_seamV_subset_endpoints hyV) + simp only [mem_insert_iff, mem_singleton_iff] at hi + rcases hi with rfl | rfl | rfl | rfl + · exact ⟨i, Or.inl ⟨0, rfl⟩⟩ + · exact ⟨i, Or.inl ⟨1, rfl⟩⟩ + · exact ⟨i, Or.inr ⟨0, rfl⟩⟩ + · exact ⟨i, Or.inr ⟨1, rfl⟩⟩ + · obtain ⟨i, w', _, _, hfib, -⟩ := + N.exists_mem_Ioo_of_mem_bd_of_notMem_bd_of_notMem_seamV hybd hybdS hyV + have hy_mem : y ∈ N.φ ⁻¹' {N.φ y} := rfl + rw [hfib, mem_insert_iff, mem_singleton_iff] at hy_mem + rcases hy_mem with rfl | rfl + · exact ⟨i, Or.inl ⟨w', rfl⟩⟩ + · exact ⟨i, Or.inr ⟨w', rfl⟩⟩ + rcases hy_fg with ⟨i, ⟨t, rfl⟩ | ⟨t, rfl⟩⟩ + · have hpf : p ∈ range (N.f i) := by + by_contra hnp + exact hyF (Or.inl (Or.inl (mem_iUnion₂.mpr ⟨i, hnp, t, rfl⟩))) + rcases hpf with ⟨s, rfl⟩ + rw [hu_f i t, hu_f i s] + · have hpg : p ∈ range (N.g i) := by + by_contra hnp + exact hyF (Or.inl (Or.inr (mem_iUnion₂.mpr ⟨i, hnp, t, rfl⟩))) + rcases hpg with ⟨s, rfl⟩ + rw [hu_g i t, hu_g i s] + have hxbd : x ∈ bd N.D := by + rw [← N.preimage_seamU] + rcases hx with ⟨i, h0 | h1⟩ + · exact ⟨N.f i 0, N.range_f_subset_bd i ⟨0, rfl⟩, h0⟩ + · exact ⟨N.f i 1, N.range_f_subset_bd i ⟨1, rfl⟩, h1⟩ + have hzbd : z ∈ bd N.D := by + rw [← N.preimage_seamU] + rcases hz with ⟨i, h0 | h1⟩ + · exact ⟨N.f i 0, N.range_f_subset_bd i ⟨0, rfl⟩, h0⟩ + · exact ⟨N.f i 1, N.range_f_subset_bd i ⟨1, rfl⟩, h1⟩ + have heq := const_of_locally N.isOArc_bd_D.isPreconnected hu_loc hxbd hzbd + simpa only [u, hx, hz, ↓reduceDIte] using heq + +/-- The rank of `N.δ` satisfies `Module.finrank K (LinearMap.range N.δ) + 1 = Module.finrank K +N.W_bd`. -/ +private theorem finrank_range_δ (hS : IsSurface S) (N : Net S) (hpos : 0 < N.r) : + Module.finrank K (LinearMap.range N.δ) + 1 = Module.finrank K N.W_bd := by + have : T2Space S := hS.2.1 + have hfin_V : N.seamV.Finite := N.finite_seamV + let _ : Fintype N.seamV := hfin_V.fintype + let _ : FiniteDimensional K N.W_bd := inferInstance + have h1 := LinearMap.finrank_range_add_finrank_ker N.δ + rw [← h1] + congr 1 + let one_W : N.W_bd := ⟨fun _ => 1, fun _ _ _ _ _ _ => rfl⟩ + have hone_ker : one_W ∈ LinearMap.ker N.δ := by + rw [LinearMap.mem_ker] + ext i + exact CharTwo.add_self_eq_zero 1 + have hker_eq : LinearMap.ker N.δ = Submodule.span K {one_W} := by + refine le_antisymm (fun w hw => ?_) ((Submodule.span_singleton_le_iff_mem _ _).mpr hone_ker) + rw [LinearMap.mem_ker] at hw + let v₀ : N.seamV := ⟨N.φ (N.f ⟨0, hpos⟩ 0), ⟨0, hpos⟩, Or.inl rfl⟩ + refine Submodule.mem_span_singleton.mpr ⟨w.1 v₀, ?_⟩ + ext v + change w.1 v₀ * 1 = w.1 v + rw [mul_one] + obtain ⟨x, hx⟩ := N.quotientMap_φ.surjective v.1 + have hxV : N.φ x ∈ N.seamV := hx.symm ▸ v.2 + have hconst := N.bd_D_const_of_cuff_and_seam hS hpos 0 w + (fun i => by simp [congr_fun hw i]) + (fun i => by simp [congr_fun hw i]) + (fun p _ => ⟨univ, univ_mem, fun _ _ => rfl⟩) + (⟨⟨0, hpos⟩, Or.inl rfl⟩ : N.φ (N.f ⟨0, hpos⟩ 0) ∈ N.seamV) hxV + simp only [Pi.zero_apply, zero_add] at hconst + have hv_eq : (⟨N.φ x, hxV⟩ : N.seamV) = v := Subtype.ext hx + rwa [hv_eq] at hconst + rw [hker_eq] + refine (finrank_span_singleton ?_).symm + intro h0 + let v₀ : N.seamV := ⟨N.φ (N.f ⟨0, hpos⟩ 0), ⟨0, hpos⟩, Or.inl rfl⟩ + have : (1 : K) = 0 := congr_fun (congr_arg Subtype.val h0) v₀ + exact one_ne_zero this + +/-- If a local cocycle `ψ : S → S → K` has a primitive `d : N.D → K` of `pbk N.φ ψ` on `univ : Set +N.D` +that satisfies `d (N.f i t) = d (N.g i t)` for all `i, t`, then `CohRel ψ 0`. -/ +private theorem cohRel_of_prim_fib [T2Space S] (N : Net S) {ψ : S → S → K} (hψ : IsCoc ψ) + {d : N.D → K} (hd : Prim (pbk N.φ ψ) univ d) + (hfg : ∀ (i : Fin N.r) (t : unitInterval), d (N.f i t) = d (N.g i t)) : + CohRel ψ 0 := by + have : CompactSpace N.D := N.isSurface_D.1 + let R : N.D → N.D → Prop := fun a b => + ∃ (j : Fin N.r) (s : unitInterval), a = N.f j s ∧ b = N.g j s + have hrel_eq : ∀ x y : N.D, Relation.EqvGen R x y → d x = d y := by + intro x y hrel + induction hrel with + | rel a b hab => + rcases hab with ⟨i, t, rfl, rfl⟩ + exact hfg i t + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ ih1 ih2 => exact ih1.trans ih2 + have hfib : ∀ x y : N.D, N.φ x = N.φ y → d x = d y := + fun x y hxy => hrel_eq x y ((N.bd_eq_iff x y).mp hxy) + choose r hr using N.quotientMap_φ.surjective + let h : S → K := fun p => d (r p) + have hφ : ∀ x : N.D, h (N.φ x) = d x := fun x => hfib (r (N.φ x)) x (hr (N.φ x)) + have hex_W : ∀ z : N.D, ∃ W : Set N.D, IsOpen W ∧ z ∈ W ∧ + ∀ a ∈ W, ∀ b ∈ W, ψ (N.φ a) (N.φ b) = d a + d b := by + intro z + obtain ⟨W₀, hW₀, h1⟩ := hd z (mem_univ z) + obtain ⟨W, hW_sub, hW_open, hzW⟩ := mem_nhds_iff.mp hW₀ + exact ⟨W, hW_open, hzW, fun a ha b hb => h1 a ⟨hW_sub ha, trivial⟩ b ⟨hW_sub hb, trivial⟩⟩ + choose W hW_open hzW hW_eq using hex_W + obtain ⟨N_coc, hN_coc, hcoc⟩ := hψ + have hφ_closed : IsClosedMap N.φ := N.quotientMap_φ.continuous.isClosedMap + have hex_V : ∀ p : S, ∃ V : Set S, IsOpen V ∧ p ∈ V ∧ + ∀ x ∈ V, ∀ y ∈ V, ψ x y = h y - h x := by + intro p + let U_p : Set N.D := ⋃ z ∈ N.φ ⁻¹' {p}, W z + have hUp_open : IsOpen U_p := isOpen_biUnion fun z _ => hW_open z + let V₁ : Set S := (N.φ '' U_pᶜ)ᶜ + have hV₁_open : IsOpen V₁ := (hφ_closed _ hUp_open.isClosed_compl).isOpen_compl + have hpV₁ : p ∈ V₁ := by + rintro ⟨z, hz, rfl⟩ + exact hz (mem_iUnion₂.mpr ⟨z, rfl, hzW z⟩) + obtain ⟨u₁, hu₁, u₂, hu₂, hu_sub⟩ := mem_nhds_prod_iff.mp (hN_coc p) + obtain ⟨V₂, hV₂_sub, hV₂_open, hpV₂⟩ := mem_nhds_iff.mp (Filter.inter_mem hu₁ hu₂) + refine ⟨V₁ ∩ V₂, hV₁_open.inter hV₂_open, ⟨hpV₁, hpV₂⟩, fun x ⟨hx₁, hx₂⟩ y ⟨hy₁, hy₂⟩ => ?_⟩ + have hxp : ψ x p = h x + h p := by + obtain ⟨a, rfl⟩ := N.quotientMap_φ.surjective x + have haU : a ∈ U_p := by + by_contra hna + exact hx₁ ⟨a, hna, rfl⟩ + obtain ⟨z, hz, haW⟩ := mem_iUnion₂.mp haU + have hpz : N.φ z = p := hz + rw [← hpz, hW_eq z a haW z (hzW z), hφ a, hφ z] + have hpy : ψ p y = h p + h y := by + obtain ⟨b, rfl⟩ := N.quotientMap_φ.surjective y + have hbU : b ∈ U_p := by + by_contra hnb + exact hy₁ ⟨b, hnb, rfl⟩ + obtain ⟨z, hz, hbW⟩ := mem_iUnion₂.mp hbU + have hpz : N.φ z = p := hz + rw [← hpz, hW_eq z z (hzW z) b hbW, hφ z, hφ b] + have hxy_coc := hcoc x p y + (hu_sub ⟨(hV₂_sub hx₂).1, (hV₂_sub hpV₂).2⟩) + (hu_sub ⟨(hV₂_sub hpV₂).1, (hV₂_sub hy₂).2⟩) + (hu_sub ⟨(hV₂_sub hx₂).1, (hV₂_sub hy₂).2⟩) + rw [← hxy_coc, hxp, hpy, CharTwo.sub_eq_add] + have hring : (h x + h p) + (h p + h y) = (h p + h p) + (h y + h x) := by ring + rw [hring, CharTwo.add_self_eq_zero, zero_add] + choose V hV_open hpV hV_eq using hex_V + refine ⟨h, ⋃ p : S, V p ×ˢ V p, ?_, ?_⟩ + · intro p + exact Filter.mem_of_superset ((hV_open p).prod (hV_open p) |>.mem_nhds ⟨hpV p, hpV p⟩) + (subset_iUnion (fun q => V q ×ˢ V q) p) + · rintro x y hxy + obtain ⟨p, hxV, hyV⟩ := mem_iUnion.mp hxy + simpa using hV_eq p x hxV y hyV + +/-- Along any seam `i : Fin N.r`, a primitive `g` of `pbk N.φ ψ` on `univ : Set N.D` has constant +jump `g (N.f i t) + g (N.g i t) = g (N.f i 0) + g (N.g i 0)` for all `t : unitInterval`, and in +particular `g (N.f i 0) + g (N.f i 1) = g (N.g i 0) + g (N.g i 1)`. -/ +private theorem prim_seam_jump_const (N : Net S) {ψ : S → S → K} {g : N.D → K} + (hg : Prim (pbk N.φ ψ) univ g) (i : Fin N.r) : + (∀ t : unitInterval, g (N.f i t) + g (N.g i t) = g (N.f i 0) + g (N.g i 0)) ∧ + g (N.f i 0) + g (N.f i 1) = g (N.g i 0) + g (N.g i 1) := by + have hpf : Prim (pbk (N.φ ∘ N.f i) ψ) univ (g ∘ N.f i) := by + intro t _ + obtain ⟨W, hW, h1⟩ := hg (N.f i t) (mem_univ _) + refine ⟨N.f i ⁻¹' W, (N.f i).continuous.continuousAt.preimage_mem_nhds hW, + fun s hs s' hs' => h1 (N.f i s) ⟨hs.1, trivial⟩ (N.f i s') ⟨hs'.1, trivial⟩⟩ + have hpg : Prim (pbk (N.φ ∘ N.f i) ψ) univ (g ∘ N.g i) := by + intro t _ + obtain ⟨W, hW, h1⟩ := hg (N.g i t) (mem_univ _) + refine ⟨N.g i ⁻¹' W, (N.g i).continuous.continuousAt.preimage_mem_nhds hW, + fun s hs s' hs' => ?_⟩ + change ψ (N.φ (N.f i s)) (N.φ (N.f i s')) = g (N.g i s) + g (N.g i s') + rw [N.φ_f_eq_φ_g i s, N.φ_f_eq_φ_g i s'] + exact h1 (N.g i s) ⟨hs.1, trivial⟩ (N.g i s') ⟨hs'.1, trivial⟩ + have hconst : ∀ t : unitInterval, g (N.f i t) + g (N.g i t) = g (N.f i 0) + g (N.g i 0) := + fun t => hpf.const hpg isPreconnected_univ Subset.rfl Subset.rfl trivial trivial + refine ⟨hconst, ?_⟩ + have h1 := hconst 1 + have h2 : (g (N.f i 0) + g (N.f i 1)) + (g (N.g i 0) + g (N.g i 1)) = + (g (N.f i 0) + g (N.g i 0)) + (g (N.f i 1) + g (N.g i 1)) := by ring + refine CharTwo.add_eq_zero.mp ?_ + rw [h2, h1, CharTwo.add_self_eq_zero] + +/-- Two local cocycles `φ, φ'` that vanish near the diagonal of `bd S` with primitives `g, g'` on +`univ : Set N.D` satisfy `CohRel φ φ'` if and only if their seam voltage difference +`i ↦ (g (N.f i 0) + g (N.f i 1)) + (g' (N.f i 0) + g' (N.f i 1))` lies in `LinearMap.range N.δ`. -/ +private theorem cohRel_iff_mem_range_δ (hS : IsSurface S) (N : Net S) (hpos : 0 < N.r) + {φ φ' : S → S → K} (hφ : IsCoc φ) (hφ' : IsCoc φ') + {N_bd N'_bd : Set (S × S)} (hN_bd : NearDiag N_bd) (hN'_bd : NearDiag N'_bd) + (hbd : ∀ x ∈ bd S, ∀ y ∈ bd S, (x, y) ∈ N_bd → φ x y = 0) + (hbd' : ∀ x ∈ bd S, ∀ y ∈ bd S, (x, y) ∈ N'_bd → φ' x y = 0) + {g g' : N.D → K} (hg : Prim (pbk N.φ φ) univ g) (hg' : Prim (pbk N.φ φ') univ g') : + CohRel φ φ' ↔ + (fun i : Fin N.r => (g (N.f i 0) + g (N.f i 1)) + (g' (N.f i 0) + g' (N.f i 1))) ∈ + LinearMap.range N.δ := by + have : T2Space S := hS.2.1 + constructor + · rintro ⟨k, N_rel, hN_rel, hrel⟩ + have hk_cuff : ∀ C ∈ cuffs S, ∀ x : N.seamV, x.1 ∈ C → ∀ y : N.seamV, y.1 ∈ C → + k x.1 = k y.1 := by + intro C hC x hxC y hyC + have hC_sub : C ⊆ bd S := by + obtain ⟨z, hz, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + refine const_of_locally ((cuff_statement S hS).2.2 C hC).isPreconnected + (u := k) (fun p hp => ?_) hxC hyC + have hM : NearDiag (N_rel ∩ N_bd ∩ N'_bd) := (hN_rel.inter hN_bd).inter hN'_bd + have hMp : (fun q => (p, q)) ⁻¹' (N_rel ∩ N_bd ∩ N'_bd) ∈ 𝓝 p := + (Continuous.prodMk_right p).continuousAt.preimage_mem_nhds (hM p) + refine ⟨_, hMp, fun q ⟨⟨⟨hq_rel, hq_bd⟩, hq_bd'⟩, hqC⟩ => ?_⟩ + have hp_bd : p ∈ bd S := hC_sub hp + have hq_bdS : q ∈ bd S := hC_sub hqC + have hr := hrel p q hq_rel + rw [hbd p hp_bd q hq_bdS hq_bd, hbd' p hp_bd q hq_bdS hq_bd', sub_zero, + CharTwo.sub_eq_add] at hr + exact CharTwo.add_eq_zero.mp hr.symm + let w : N.W_bd := ⟨fun v => k v.1, hk_cuff⟩ + refine ⟨w, ?_⟩ + ext i + have hc := const_of_locally (isPreconnected_range (N.f i).continuous) + (u := fun x => g x + g' x + k (N.φ x)) (fun p _ => by + obtain ⟨W, hW, h1⟩ := hg p trivial + obtain ⟨W', hW', h2⟩ := hg' p trivial + have hNp : (fun x => (N.φ p, N.φ x)) ⁻¹' N_rel ∈ 𝓝 p := + (Continuous.prodMk_right (N.φ p) |>.comp + N.quotientMap_φ.continuous).continuousAt.preimage_mem_nhds + (hN_rel (N.φ p)) + refine ⟨W ∩ W' ∩ _, Filter.inter_mem (Filter.inter_mem hW hW') hNp, fun x hx => ?_⟩ + have h3 := h1 p ⟨mem_of_mem_nhds hW, trivial⟩ x ⟨hx.1.1.1, trivial⟩ + have h4 := h2 p ⟨mem_of_mem_nhds hW', trivial⟩ x ⟨hx.1.1.2, trivial⟩ + have h5 := hrel (N.φ p) (N.φ x) hx.1.2 + change φ (N.φ p) (N.φ x) = g p + g x at h3 + change φ' (N.φ p) (N.φ x) = g' p + g' x at h4 + rw [CharTwo.sub_eq_add, CharTwo.sub_eq_add, h3, h4] at h5 + have h6 : (g x + g' x + k (N.φ x)) + (g p + g' p + k (N.φ p)) = + (g p + g x + (g' p + g' x)) + (k (N.φ x) + k (N.φ p)) := by ring + refine CharTwo.add_eq_zero.mp ?_ + rw [h6, h5, CharTwo.add_self_eq_zero]) ⟨0, rfl⟩ ⟨1, rfl⟩ + change k (N.φ (N.f i 0)) + k (N.φ (N.f i 1)) = + (g (N.f i 0) + g (N.f i 1)) + (g' (N.f i 0) + g' (N.f i 1)) + have h7 : ((g (N.f i 0) + g (N.f i 1)) + (g' (N.f i 0) + g' (N.f i 1))) + + (k (N.φ (N.f i 0)) + k (N.φ (N.f i 1))) = + (g (N.f i 0) + g' (N.f i 0) + k (N.φ (N.f i 0))) + + (g (N.f i 1) + g' (N.f i 1) + k (N.φ (N.f i 1))) := by ring + refine (CharTwo.add_eq_zero.mp ?_).symm + rw [h7, hc, CharTwo.add_self_eq_zero] + · rintro ⟨w, hw⟩ + let ψ : S → S → K := fun x y => φ x y + φ' x y + let d : N.D → K := fun x => g x + g' x + have hψ_coc : IsCoc ψ := by + obtain ⟨N₁, hN₁, hc₁⟩ := hφ + obtain ⟨N₂, hN₂, hc₂⟩ := hφ' + refine ⟨N₁ ∩ N₂, hN₁.inter hN₂, fun x y z hxy hyz hxz => ?_⟩ + change (φ x y + φ' x y) + (φ y z + φ' y z) = φ x z + φ' x z + rw [← hc₁ x y z hxy.1 hyz.1 hxz.1, ← hc₂ x y z hxy.2 hyz.2 hxz.2] + ring + have hd_prim : Prim (pbk N.φ ψ) univ d := by + intro p _ + obtain ⟨W, hW, h1⟩ := hg p trivial + obtain ⟨W', hW', h2⟩ := hg' p trivial + refine ⟨W ∩ W', Filter.inter_mem hW hW', fun a ha b hb => ?_⟩ + change pbk N.φ φ a b + pbk N.φ φ' a b = (g a + g' a) + (g b + g' b) + rw [h1 a ⟨ha.1.1, trivial⟩ b ⟨hb.1.1, trivial⟩, + h2 a ⟨ha.1.2, trivial⟩ b ⟨hb.1.2, trivial⟩] + ring + have hdf : ∀ i : Fin N.r, d (N.f i 0) + d (N.f i 1) = N.δ w i := by + intro i + have hi := (congr_fun hw i).symm + change d (N.f i 0) + d (N.f i 1) = N.δ w i + calc + d (N.f i 0) + d (N.f i 1) + = (g (N.f i 0) + g (N.f i 1)) + (g' (N.f i 0) + g' (N.f i 1)) := by + dsimp [d]; ring + _ = N.δ w i := hi + have hdg : ∀ i : Fin N.r, d (N.g i 0) + d (N.g i 1) = N.δ w i := by + intro i + have h1 := (N.prim_seam_jump_const hg i).2 + have h2 := (N.prim_seam_jump_const hg' i).2 + calc + d (N.g i 0) + d (N.g i 1) + = (g (N.g i 0) + g (N.g i 1)) + (g' (N.g i 0) + g' (N.g i 1)) := by + dsimp [d]; ring + _ = (g (N.f i 0) + g (N.f i 1)) + (g' (N.f i 0) + g' (N.f i 1)) := by + rw [h1, h2] + _ = d (N.f i 0) + d (N.f i 1) := by dsimp [d]; ring + _ = N.δ w i := hdf i + have hloc : ∀ p ∈ bd N.D ∩ N.φ ⁻¹' (bd S), + ∃ W ∈ 𝓝 p, ∀ x ∈ W ∩ (bd N.D ∩ N.φ ⁻¹' (bd S)), d x = d p := by + intro p ⟨hpbd_D, hpbd_S⟩ + obtain ⟨W, hW, h1⟩ := hd_prim p trivial + have hM : NearDiag (N_bd ∩ N'_bd) := hN_bd.inter hN'_bd + have hMp : (fun x => (N.φ p, N.φ x)) ⁻¹' (N_bd ∩ N'_bd) ∈ 𝓝 p := + (Continuous.prodMk_right (N.φ p) |>.comp + N.quotientMap_φ.continuous).continuousAt.preimage_mem_nhds + (hM (N.φ p)) + refine ⟨W ∩ _, Filter.inter_mem hW hMp, fun x ⟨⟨hxW, hxN⟩, _, hxbd_S⟩ => ?_⟩ + have hpx := h1 p ⟨mem_of_mem_nhds hW, trivial⟩ x ⟨hxW, trivial⟩ + change φ (N.φ p) (N.φ x) + φ' (N.φ p) (N.φ x) = d p + d x at hpx + rw [hbd (N.φ p) hpbd_S (N.φ x) hxbd_S hxN.1, + hbd' (N.φ p) hpbd_S (N.φ x) hxbd_S hxN.2, zero_add, add_comm (d p)] at hpx + exact CharTwo.add_eq_zero.mp hpx.symm + have hfg : ∀ (i : Fin N.r) (t : unitInterval), d (N.f i t) = d (N.g i t) := by + intro i t + have hjump := (N.prim_seam_jump_const hd_prim i).1 t + have hf0_V : N.φ (N.f i 0) ∈ N.seamV := ⟨i, Or.inl rfl⟩ + have hg0_V : N.φ (N.g i 0) ∈ N.seamV := ⟨i, Or.inl (N.φ_f_eq_φ_g i 0)⟩ + have h0 := N.bd_D_const_of_cuff_and_seam hS hpos d w hdf hdg hloc hf0_V hg0_V + have hw_eq : (⟨N.φ (N.g i 0), hg0_V⟩ : N.seamV) = ⟨N.φ (N.f i 0), hf0_V⟩ := + Subtype.ext (N.φ_f_eq_φ_g i 0).symm + rw [hw_eq] at h0 + rw [add_right_cancel h0, CharTwo.add_self_eq_zero] at hjump + exact CharTwo.add_eq_zero.mp hjump + obtain ⟨h_rel, N_rel, hN_rel, hrel⟩ := N.cohRel_of_prim_fib hψ_coc hd_prim hfg + refine ⟨h_rel, N_rel, hN_rel, fun x y hxy => ?_⟩ + have hr := hrel x y hxy + simp only [ψ, Pi.zero_apply, add_zero, CharTwo.sub_eq_add] at hr ⊢ + exact hr + +/-- Helper for `exists_step_func_on_bd_D`: the two halves `Ico 0 t_mid` and `Ioc t_mid 1` of `N.f i` +lie in opposite components of `bd N.D \ {N.f i t_mid, N.g i t_mid}`. -/ +private theorem half_arc_in_opposite_components (N : Net S) (i : Fin N.r) + {t_mid : unitInterval} (ht_mid : t_mid ∈ Ioo (0 : unitInterval) 1) + {B₁ B₂ : Set N.D} + (hcomp : componentsIn (bd N.D \ {N.f i t_mid, N.g i t_mid}) = {B₁, B₂}) + (hdisj : Disjoint B₁ B₂) + (hunion : bd N.D \ {N.f i t_mid, N.g i t_mid} = B₁ ∪ B₂) + (hm_cl₁ : N.f i t_mid ∈ closure B₁) (hm_cl₂ : N.f i t_mid ∈ closure B₂) : + (N.f i '' Ico 0 t_mid ⊆ B₁ ∧ N.f i '' Ioc t_mid 1 ⊆ B₂) ∨ + (N.f i '' Ico 0 t_mid ⊆ B₂ ∧ N.f i '' Ioc t_mid 1 ⊆ B₁) := by + let M : Set N.D := {N.f i t_mid, N.g i t_mid} + have hsub_cc : ∀ {A : Set N.D} {a : N.D}, IsPreconnected A → a ∈ A → A ⊆ bd N.D \ M → + A ⊆ B₁ ∨ A ⊆ B₂ := by + intro A a hconn ha hsub + have h1 : A ⊆ connectedComponentIn (bd N.D \ M) a := hconn.subset_connectedComponentIn ha hsub + have h2 : connectedComponentIn (bd N.D \ M) a ∈ ({B₁, B₂} : Set (Set N.D)) := + hcomp ▸ ⟨a, hsub ha, rfl⟩ + rcases h2 with hB1 | hB2 + · exact Or.inl (hB1 ▸ h1) + · exact Or.inr ((mem_singleton_iff.mp hB2) ▸ h1) + have hIco_sub : N.f i '' Ico 0 t_mid ⊆ bd N.D \ M := by + rintro _ ⟨u, hu, rfl⟩ + refine ⟨N.range_f_subset_bd i ⟨u, rfl⟩, ?_⟩ + rintro (h1 | h2) + · exact hu.2.ne (N.injective_f i h1) + · exact N.internally_disjoint_gf i i t_mid ht_mid ⟨u, mem_singleton_iff.mp h2⟩ + have hIoc_sub : N.f i '' Ioc t_mid 1 ⊆ bd N.D \ M := by + rintro _ ⟨u, hu, rfl⟩ + refine ⟨N.range_f_subset_bd i ⟨u, rfl⟩, ?_⟩ + rintro (h1 | h2) + · exact hu.1.ne' (N.injective_f i h1) + · exact N.internally_disjoint_gf i i t_mid ht_mid ⟨u, mem_singleton_iff.mp h2⟩ + have h0_Ico : N.f i 0 ∈ N.f i '' Ico 0 t_mid := ⟨0, ⟨le_rfl, ht_mid.1⟩, rfl⟩ + have h1_Ioc : N.f i 1 ∈ N.f i '' Ioc t_mid 1 := ⟨1, ⟨ht_mid.2, le_rfl⟩, rfl⟩ + have hIco_B := hsub_cc (isPreconnected_Ico.image _ (N.f i).continuous.continuousOn) h0_Ico + hIco_sub + have hIoc_B := hsub_cc (isPreconnected_Ioc.image _ (N.f i).continuous.continuousOn) h1_Ioc + hIoc_sub + obtain ⟨U, hU, hU_eq⟩ := N.exists_isOpen_inter_bd_eq_image_Ioo_f i 0 1 + have hmU : N.f i t_mid ∈ U := by + have h : N.f i t_mid ∈ U ∩ bd N.D := by + rw [hU_eq] + exact ⟨t_mid, ht_mid, rfl⟩ + exact h.1 + have hnot_both : ∀ {B B' : Set N.D}, Disjoint B B' → B' ⊆ bd N.D \ M → + N.f i t_mid ∈ closure B' → + ¬ (N.f i '' Ico 0 t_mid ⊆ B ∧ N.f i '' Ioc t_mid 1 ⊆ B) := by + intro B B' hd hB'_sub hm_cl ⟨h1, h2⟩ + obtain ⟨x, hxU, hxB'⟩ := _root_.mem_closure_iff.mp hm_cl U hU hmU + have hx_Ioo : x ∈ N.f i '' Ioo (0 : unitInterval) 1 := by + rw [← hU_eq] + exact ⟨hxU, (hB'_sub hxB').1⟩ + obtain ⟨u, hu, rfl⟩ := hx_Ioo + rcases lt_trichotomy u t_mid with hlt | rfl | hgt + · exact hd.le_bot ⟨h1 ⟨u, ⟨hu.1.le, hlt⟩, rfl⟩, hxB'⟩ + · exact (hB'_sub hxB').2 (Or.inl rfl) + · exact hd.le_bot ⟨h2 ⟨u, ⟨hgt, hu.2.le⟩, rfl⟩, hxB'⟩ + have hB1_sub : B₁ ⊆ bd N.D \ M := fun x hx => hunion ▸ Or.inl hx + have hB2_sub : B₂ ⊆ bd N.D \ M := fun x hx => hunion ▸ Or.inr hx + rcases hIco_B with h1 | h1 <;> rcases hIoc_B with h2 | h2 + · exact False.elim (hnot_both hdisj hB2_sub hm_cl₂ ⟨h1, h2⟩) + · exact Or.inl ⟨h1, h2⟩ + · exact Or.inr ⟨h1, h2⟩ + · exact False.elim (hnot_both hdisj.symm hB1_sub hm_cl₁ ⟨h1, h2⟩) + +/-- For each seam index `i : Fin N.r`, there is a step function `g_i : N.D → K` jumping only at the +midpoints `N.f i (1/2)` and `N.g i (1/2)` on `bd N.D`, with endpoint jump `δ_{i,j}` on `N.f j` and +constant sum `g_i (N.f j u) + g_i (N.g j u)` along each seam `j`. -/ +private theorem exists_step_func_on_bd_D (N : Net S) (i : Fin N.r) : + let t_mid : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + ∃ g_i : N.D → K, + (∀ j : Fin N.r, g_i (N.f j 0) + g_i (N.f j 1) = if j = i then 1 else 0) ∧ + (∀ (j : Fin N.r) (u : unitInterval), + g_i (N.f j u) + g_i (N.g j u) = g_i (N.f j 0) + g_i (N.g j 0)) ∧ + (∀ p ∈ bd N.D \ {N.f i t_mid, N.g i t_mid}, + ∃ W ∈ 𝓝 p, ∀ x ∈ W ∩ bd N.D, g_i x = g_i p) := by + classical + have : T2Space N.D := N.isSurface_D.2.1 + let t_mid : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht_mid : t_mid ∈ Ioo (0 : unitInterval) 1 := by + constructor <;> rw [← Subtype.coe_lt_coe] <;> norm_num [t_mid] + let m₁ : N.D := N.f i t_mid + let m₂ : N.D := N.g i t_mid + have hm₁_bd : m₁ ∈ bd N.D := N.range_f_subset_bd i ⟨t_mid, rfl⟩ + have hm₂_bd : m₂ ∈ bd N.D := N.range_g_subset_bd i ⟨t_mid, rfl⟩ + have hm12 : m₁ ≠ m₂ := fun h => N.internally_disjoint_fg i i t_mid ht_mid ⟨t_mid, h.symm⟩ + obtain ⟨B₁, B₂, hcomp, hdisj, hunion, hline₁, hline₂⟩ := + oArc_components_diff_pair N.isOArc_bd_D hm₁_bd hm₂_bd hm12 + obtain ⟨hcl₁, hm₁_cl₁, hm₂_cl₁⟩ := hline₁.isClosed_union_and_endpoints_mem_closure + obtain ⟨hcl₂, hm₁_cl₂, hm₂_cl₂⟩ := hline₂.isClosed_union_and_endpoints_mem_closure + have hB1_sub : B₁ ⊆ bd N.D \ {m₁, m₂} := fun x hx => hunion ▸ Or.inl hx + have hB2_sub : B₂ ⊆ bd N.D \ {m₁, m₂} := fun x hx => hunion ▸ Or.inr hx + have hf_half := N.half_arc_in_opposite_components i ht_mid hcomp hdisj hunion hm₁_cl₁ hm₁_cl₂ + have hpair_symm : ({m₂, m₁} : Set N.D) = {m₁, m₂} := pair_comm m₂ m₁ + have hg_half : + (N.g i '' Ico 0 t_mid ⊆ B₁ ∧ N.g i '' Ioc t_mid 1 ⊆ B₂) ∨ + (N.g i '' Ico 0 t_mid ⊆ B₂ ∧ N.g i '' Ioc t_mid 1 ⊆ B₁) := by + have hcomp' : componentsIn (bd N.swapFG.D \ {N.swapFG.f i t_mid, N.swapFG.g i t_mid}) = + {B₁, B₂} := by + change componentsIn (bd N.D \ {m₂, m₁}) = {B₁, B₂} + rwa [hpair_symm] + have hunion' : bd N.swapFG.D \ {N.swapFG.f i t_mid, N.swapFG.g i t_mid} = + B₁ ∪ B₂ := by + change bd N.D \ {m₂, m₁} = B₁ ∪ B₂ + rwa [hpair_symm] + have h := N.swapFG.half_arc_in_opposite_components i ht_mid hcomp' hdisj hunion' hm₂_cl₁ hm₂_cl₂ + exact h + let valB (x : N.D) : K := if x ∈ B₁ then 1 else 0 + let g_i : N.D → K := fun x => + if x = m₁ then valB (N.f i 1) + else if x = m₂ then valB (N.g i 1) + else valB x + have hg_i_not_m : ∀ {x : N.D}, x ∉ ({m₁, m₂} : Set N.D) → g_i x = valB x := by + intro x hx + have hx1 : x ≠ m₁ := fun h => hx (Or.inl h) + have hx2 : x ≠ m₂ := fun h => hx (Or.inr (mem_singleton_iff.mpr h)) + simp [g_i, hx1, hx2] + have hvalB_B1 : ∀ {x : N.D}, x ∈ B₁ → valB x = 1 := by + intro x hx + simp [valB, hx] + have hvalB_B2 : ∀ {x : N.D}, x ∈ B₂ → valB x = 0 := by + intro x hx + have hx1 : x ∉ B₁ := fun hx1 => hdisj.le_bot ⟨hx1, hx⟩ + simp [valB, hx1] + have hf_not_m : ∀ {j : Fin N.r} {u : unitInterval}, (j ≠ i ∨ u ≠ t_mid) → + N.f j u ∉ ({m₁, m₂} : Set N.D) := by + rintro j u hju (h1 | h2) + · rcases hju with hij | hu + · exact N.internally_disjoint_ff i j (Ne.symm hij) t_mid ht_mid ⟨u, h1⟩ + · by_cases hij : j = i + · subst hij + exact hu (N.injective_f j h1) + · exact N.internally_disjoint_ff i j (Ne.symm hij) t_mid ht_mid ⟨u, h1⟩ + · exact N.internally_disjoint_gf i j t_mid ht_mid ⟨u, mem_singleton_iff.mp h2⟩ + have hg_not_m : ∀ {j : Fin N.r} {u : unitInterval}, (j ≠ i ∨ u ≠ t_mid) → + N.g j u ∉ ({m₁, m₂} : Set N.D) := by + rintro j u hju (h1 | h2) + · exact N.internally_disjoint_fg i j t_mid ht_mid ⟨u, h1⟩ + · rcases hju with hij | hu + · exact N.internally_disjoint_gg i j (Ne.symm hij) t_mid ht_mid ⟨u, mem_singleton_iff.mp h2⟩ + · by_cases hij : j = i + · subst hij + exact hu (N.injective_g j (mem_singleton_iff.mp h2)) + · exact N.internally_disjoint_gg i j (Ne.symm hij) t_mid ht_mid ⟨u, mem_singleton_iff.mp h2⟩ + have h0_ne_mid : (0 : unitInterval) ≠ t_mid := ht_mid.1.ne + have h1_ne_mid : (1 : unitInterval) ≠ t_mid := ht_mid.2.ne' + have hf_i_Ico : ∀ u ∈ Ico 0 t_mid, g_i (N.f i u) = g_i (N.f i 0) := by + intro u hu + rw [hg_i_not_m (hf_not_m (Or.inr hu.2.ne)), hg_i_not_m (hf_not_m (Or.inr h0_ne_mid))] + rcases hf_half with ⟨h1, _⟩ | ⟨h1, _⟩ + · rw [hvalB_B1 (h1 ⟨u, hu, rfl⟩), hvalB_B1 (h1 ⟨0, ⟨le_rfl, ht_mid.1⟩, rfl⟩)] + · rw [hvalB_B2 (h1 ⟨u, hu, rfl⟩), hvalB_B2 (h1 ⟨0, ⟨le_rfl, ht_mid.1⟩, rfl⟩)] + have hf_i_Ioc : ∀ u ∈ Ioc t_mid 1, g_i (N.f i u) = g_i (N.f i 1) := by + intro u hu + rw [hg_i_not_m (hf_not_m (Or.inr hu.1.ne')), hg_i_not_m (hf_not_m (Or.inr h1_ne_mid))] + rcases hf_half with ⟨_, h2⟩ | ⟨_, h2⟩ + · rw [hvalB_B2 (h2 ⟨u, hu, rfl⟩), hvalB_B2 (h2 ⟨1, ⟨ht_mid.2, le_rfl⟩, rfl⟩)] + · rw [hvalB_B1 (h2 ⟨u, hu, rfl⟩), hvalB_B1 (h2 ⟨1, ⟨ht_mid.2, le_rfl⟩, rfl⟩)] + have hg_i_Ico : ∀ u ∈ Ico 0 t_mid, g_i (N.g i u) = g_i (N.g i 0) := by + intro u hu + rw [hg_i_not_m (hg_not_m (Or.inr hu.2.ne)), hg_i_not_m (hg_not_m (Or.inr h0_ne_mid))] + rcases hg_half with ⟨h1, _⟩ | ⟨h1, _⟩ + · rw [hvalB_B1 (h1 ⟨u, hu, rfl⟩), hvalB_B1 (h1 ⟨0, ⟨le_rfl, ht_mid.1⟩, rfl⟩)] + · rw [hvalB_B2 (h1 ⟨u, hu, rfl⟩), hvalB_B2 (h1 ⟨0, ⟨le_rfl, ht_mid.1⟩, rfl⟩)] + have hg_i_Ioc : ∀ u ∈ Ioc t_mid 1, g_i (N.g i u) = g_i (N.g i 1) := by + intro u hu + rw [hg_i_not_m (hg_not_m (Or.inr hu.1.ne')), hg_i_not_m (hg_not_m (Or.inr h1_ne_mid))] + rcases hg_half with ⟨_, h2⟩ | ⟨_, h2⟩ + · rw [hvalB_B2 (h2 ⟨u, hu, rfl⟩), hvalB_B2 (h2 ⟨1, ⟨ht_mid.2, le_rfl⟩, rfl⟩)] + · rw [hvalB_B1 (h2 ⟨u, hu, rfl⟩), hvalB_B1 (h2 ⟨1, ⟨ht_mid.2, le_rfl⟩, rfl⟩)] + have hf_i_01 : g_i (N.f i 0) + g_i (N.f i 1) = 1 := by + rw [hg_i_not_m (hf_not_m (Or.inr h0_ne_mid)), hg_i_not_m (hf_not_m (Or.inr h1_ne_mid))] + rcases hf_half with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [hvalB_B1 (h1 ⟨0, ⟨le_rfl, ht_mid.1⟩, rfl⟩), hvalB_B2 (h2 ⟨1, ⟨ht_mid.2, le_rfl⟩, rfl⟩)] + rfl + · rw [hvalB_B2 (h1 ⟨0, ⟨le_rfl, ht_mid.1⟩, rfl⟩), hvalB_B1 (h2 ⟨1, ⟨ht_mid.2, le_rfl⟩, rfl⟩)] + rfl + have hg_i_01 : g_i (N.g i 0) + g_i (N.g i 1) = 1 := by + rw [hg_i_not_m (hg_not_m (Or.inr h0_ne_mid)), hg_i_not_m (hg_not_m (Or.inr h1_ne_mid))] + rcases hg_half with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rw [hvalB_B1 (h1 ⟨0, ⟨le_rfl, ht_mid.1⟩, rfl⟩), hvalB_B2 (h2 ⟨1, ⟨ht_mid.2, le_rfl⟩, rfl⟩)] + rfl + · rw [hvalB_B2 (h1 ⟨0, ⟨le_rfl, ht_mid.1⟩, rfl⟩), hvalB_B1 (h2 ⟨1, ⟨ht_mid.2, le_rfl⟩, rfl⟩)] + rfl + have hf_ne_const : ∀ {j : Fin N.r}, j ≠ i → ∀ u : unitInterval, g_i (N.f j u) = g_i (N.f j 0) + := by + intro j hij u + rw [hg_i_not_m (hf_not_m (Or.inl hij)), hg_i_not_m (hf_not_m (Or.inl hij))] + have hconn : IsPreconnected (range (N.f j)) := (isConnected_range + (N.f j).continuous).isPreconnected + have hsub : range (N.f j) ⊆ bd N.D \ {m₁, m₂} := by + rintro _ ⟨s, rfl⟩ + exact ⟨N.range_f_subset_bd j ⟨s, rfl⟩, hf_not_m (Or.inl hij)⟩ + have hcc := hconn.subset_connectedComponentIn ⟨0, rfl⟩ hsub + have hmem : connectedComponentIn (bd N.D \ {m₁, m₂}) (N.f j 0) ∈ ({B₁, B₂} : Set (Set N.D)) := + hcomp ▸ ⟨N.f j 0, hsub ⟨0, rfl⟩, rfl⟩ + rcases hmem with hB1 | hB2 + · rw [hvalB_B1 (hB1 ▸ hcc ⟨u, rfl⟩), hvalB_B1 (hB1 ▸ hcc ⟨0, rfl⟩)] + · have hB2' := mem_singleton_iff.mp hB2 + rw [hvalB_B2 (hB2' ▸ hcc ⟨u, rfl⟩), hvalB_B2 (hB2' ▸ hcc ⟨0, rfl⟩)] + have hg_ne_const : ∀ {j : Fin N.r}, j ≠ i → ∀ u : unitInterval, g_i (N.g j u) = g_i (N.g j 0) + := by + intro j hij u + rw [hg_i_not_m (hg_not_m (Or.inl hij)), hg_i_not_m (hg_not_m (Or.inl hij))] + have hconn : IsPreconnected (range (N.g j)) := (isConnected_range + (N.g j).continuous).isPreconnected + have hsub : range (N.g j) ⊆ bd N.D \ {m₁, m₂} := by + rintro _ ⟨s, rfl⟩ + exact ⟨N.range_g_subset_bd j ⟨s, rfl⟩, hg_not_m (Or.inl hij)⟩ + have hcc := hconn.subset_connectedComponentIn ⟨0, rfl⟩ hsub + have hmem : connectedComponentIn (bd N.D \ {m₁, m₂}) (N.g j 0) ∈ ({B₁, B₂} : Set (Set N.D)) := + hcomp ▸ ⟨N.g j 0, hsub ⟨0, rfl⟩, rfl⟩ + rcases hmem with hB1 | hB2 + · rw [hvalB_B1 (hB1 ▸ hcc ⟨u, rfl⟩), hvalB_B1 (hB1 ▸ hcc ⟨0, rfl⟩)] + · have hB2' := mem_singleton_iff.mp hB2 + rw [hvalB_B2 (hB2' ▸ hcc ⟨u, rfl⟩), hvalB_B2 (hB2' ▸ hcc ⟨0, rfl⟩)] + refine ⟨g_i, ?_, ?_, ?_⟩ + · intro j + by_cases hij : j = i + · subst hij + simp only [↓reduceIte, hf_i_01] + · simp only [hij, ↓reduceIte, hf_ne_const hij 1, CharTwo.add_self_eq_zero] + · intro j u + by_cases hij : j = i + · subst hij + have hsum1 : g_i (N.f j 1) + g_i (N.g j 1) = g_i (N.f j 0) + g_i (N.g j 0) := by + have hring : (g_i (N.f j 1) + g_i (N.g j 1)) + (g_i (N.f j 0) + g_i (N.g j 0)) = + (g_i (N.f j 0) + g_i (N.f j 1)) + (g_i (N.g j 0) + g_i (N.g j 1)) := by ring + refine CharTwo.add_eq_zero.mp ?_ + rw [hring, hf_i_01, hg_i_01, CharTwo.add_self_eq_zero] + rcases lt_trichotomy u t_mid with hlt | rfl | hgt + · rw [hf_i_Ico u ⟨ u.2.1, hlt ⟩, hg_i_Ico u ⟨ u.2.1, hlt ⟩] + · have hfm : g_i (N.f j t_mid) = g_i (N.f j 1) := by + rw [hg_i_not_m (hf_not_m (Or.inr h1_ne_mid))] + simp [g_i, m₁] + have hgm : g_i (N.g j t_mid) = g_i (N.g j 1) := by + rw [hg_i_not_m (hg_not_m (Or.inr h1_ne_mid))] + simp [g_i, m₂, hm12.symm] + rw [hfm, hgm, hsum1] + · rw [hf_i_Ioc u ⟨ hgt, u.2.2 ⟩, hg_i_Ioc u ⟨ hgt, u.2.2 ⟩, hsum1] + · rw [hf_ne_const hij u, hg_ne_const hij u] + · intro p hp + have hp_B : p ∈ B₁ ∪ B₂ := hunion ▸ hp + rcases hp_B with hp1 | hp2 + · have hp_not2 : p ∉ B₂ ∪ {m₁, m₂} := by + rintro (h2 | hm) + · exact hdisj.le_bot ⟨hp1, h2⟩ + · exact hp.2 hm + refine ⟨(B₂ ∪ {m₁, m₂})ᶜ, hcl₂.isOpen_compl.mem_nhds hp_not2, fun x ⟨hxW, hxbd⟩ => ?_⟩ + have hx_not_m : x ∉ ({m₁, m₂} : Set N.D) := fun hm => hxW (Or.inr hm) + have hx_diff : x ∈ B₁ ∪ B₂ := + hunion ▸ (show x ∈ bd N.D \ {m₁, m₂} from ⟨hxbd, hx_not_m⟩) + have hx_B1 : x ∈ B₁ := hx_diff.resolve_right fun h2 => hxW (Or.inl h2) + rw [hg_i_not_m hx_not_m, hg_i_not_m hp.2, hvalB_B1 hx_B1, hvalB_B1 hp1] + · have hp_not1 : p ∉ B₁ ∪ {m₁, m₂} := by + rintro (h1 | hm) + · exact hdisj.le_bot ⟨h1, hp2⟩ + · exact hp.2 hm + refine ⟨(B₁ ∪ {m₁, m₂})ᶜ, hcl₁.isOpen_compl.mem_nhds hp_not1, fun x ⟨hxW, hxbd⟩ => ?_⟩ + have hx_not_m : x ∉ ({m₁, m₂} : Set N.D) := fun hm => hxW (Or.inr hm) + have hx_diff : x ∈ B₁ ∪ B₂ := + hunion ▸ (show x ∈ bd N.D \ {m₁, m₂} from ⟨hxbd, hx_not_m⟩) + have hx_B2 : x ∈ B₂ := hx_diff.resolve_left fun h1 => hxW (Or.inl h1) + rw [hg_i_not_m hx_not_m, hg_i_not_m hp.2, hvalB_B2 hx_B2, hvalB_B2 hp2] + +private theorem net_voltage_relation_isClosed + {S : Type u} + [TopologicalSpace S] + (N : Net S) + [T2Space N.D] + (g : N.D → K) + (hg_sum : ∀ (j : Fin N.r) (u : ↑unitInterval), g ((N.f j) u) + g ((N.g j) u) = g ((N.f j) 0) + + g ((N.g j) 0)) + : letI : TopologicalSpace K := ⊥ + IsClosed {p : (N.D × K) × (N.D × K) | + N.φ p.1.1 = N.φ p.2.1 ∧ g p.1.1 + p.1.2 = g p.2.1 + p.2.2} := by + let _ : TopologicalSpace K := ⊥ + have : DiscreteTopology K := ⟨rfl⟩ + let covRel (x y : N.D × K) := + N.φ x.1 = N.φ y.1 ∧ g x.1 + x.2 = g y.1 + y.2 + change IsClosed {p : (N.D × K) × (N.D × K) | covRel p.1 p.2} + let R₁ : Set ((N.D × K) × (N.D × K)) := {p | p.1 = p.2} + let R₂ (i : Fin N.r) : Set ((N.D × K) × (N.D × K)) := + {p | (p.1.1, p.2.1) ∈ range (fun u => (N.f i u, N.g i u)) ∪ + range (fun u => (N.g i u, N.f i u)) ∧ + p.1.2 + p.2.2 = g (N.f i 0) + g (N.g i 0)} + let R₃ : Set ((N.D × K) × (N.D × K)) := + {p | p.1.1 ∈ N.φ ⁻¹' N.seamV ∧ p.2.1 ∈ N.φ ⁻¹' N.seamV ∧ covRel p.1 p.2} + have hcov_eq : {p : (N.D × K) × (N.D × K) | covRel p.1 p.2} = + (R₁ ∪ ⋃ i : Fin N.r, R₂ i) ∪ R₃ := by + ext ⟨⟨x, s⟩, ⟨y, t⟩⟩ + simp only [mem_ofPred_eq, mem_union, mem_iUnion] + constructor + · rintro ⟨hφ, hg_eq⟩ + by_cases hxy : x = y + · subst hxy + exact Or.inl (Or.inl (Prod.ext rfl (add_left_cancel hg_eq))) + · by_cases hxV : N.φ x ∈ N.seamV + · have hyV : N.φ y ∈ N.seamV := hφ ▸ hxV + exact Or.inr ⟨hxV, hyV, hφ, hg_eq⟩ + · have hIoo : ∃ (i : Fin N.r) (u : unitInterval), + u ∈ Ioo (0 : unitInterval) 1 ∧ N.φ (N.f i u) = N.φ x := by + by_contra hnot + let R_step : N.D → N.D → Prop := fun a b => + ∃ (j : Fin N.r) (u : unitInterval), a = N.f j u ∧ b = N.g j u + have hrel : Relation.EqvGen R_step x y := (N.bd_eq_iff x y).mp hφ + have hno_step : ∀ a b : N.D, R_step a b → N.φ a ≠ N.φ x := by + rintro a b ⟨j, u, rfl, rfl⟩ hφ_a + rcases unitInterval_eq_zero_or_one_or_mem_Ioo u with rfl | rfl | hu + · exact hxV ⟨j, Or.inl hφ_a⟩ + · exact hxV ⟨j, Or.inr hφ_a⟩ + · exact hnot ⟨j, u, hu, hφ_a⟩ + have heq_of_rel : ∀ a b : N.D, Relation.EqvGen R_step a b → + (N.φ a = N.φ x → a = b) := by + intro a b hab + induction hab with + | rel u v huv => + exact fun hu => False.elim (hno_step u v huv hu) + | refl u => + exact fun _ => rfl + | symm u v huv ih => + intro hv + have huv_φ : N.φ u = N.φ v := (N.bd_eq_iff u v).mpr huv + exact (ih (huv_φ.trans hv)).symm + | trans u w v huw _ ih1 ih2 => + intro hu + have huw_φ : N.φ u = N.φ w := (N.bd_eq_iff u w).mpr huw + exact (ih1 hu).trans (ih2 (huw_φ.symm.trans hu)) + exact hxy (heq_of_rel x y hrel rfl) + obtain ⟨i, u, hu, hφ_u⟩ := hIoo + have hx_fg := N.eq_f_or_g_of_φ_eq_of_mem_Ioo i hu hφ_u + have hy_fg := N.eq_f_or_g_of_φ_eq_of_mem_Ioo i hu (hφ_u.trans hφ) + rcases hx_fg with rfl | rfl <;> rcases hy_fg with rfl | rfl + · exact False.elim (hxy rfl) + · refine Or.inl (Or.inr ⟨i, Or.inl ⟨u, rfl⟩, ?_⟩) + rw [← hg_sum i u] + have h1 : (s + t) + (g (N.f i u) + g (N.g i u)) = + (g (N.f i u) + s) + (g (N.g i u) + t) := by ring + refine CharTwo.add_eq_zero.mp ?_ + rw [h1, hg_eq, CharTwo.add_self_eq_zero] + · refine Or.inl (Or.inr ⟨i, Or.inr ⟨u, rfl⟩, ?_⟩) + rw [← hg_sum i u] + have h1 : (s + t) + (g (N.f i u) + g (N.g i u)) = + (g (N.g i u) + s) + (g (N.f i u) + t) := by ring + refine CharTwo.add_eq_zero.mp ?_ + rw [h1, hg_eq, CharTwo.add_self_eq_zero] + · exact False.elim (hxy rfl) + · rintro ((h1 | ⟨i, ⟨⟨u, hu⟩ | ⟨u, hu⟩, hst⟩⟩) | ⟨_, _, hcov⟩) + · obtain ⟨rfl, rfl⟩ := Prod.ext_iff.mp (show (x, s) = (y, t) from h1) + exact ⟨rfl, rfl⟩ + · obtain ⟨rfl, rfl⟩ := Prod.ext_iff.mp hu.symm + refine ⟨N.φ_f_eq_φ_g i u, ?_⟩ + have hst' : s + t = g (N.f i u) + g (N.g i u) := hst.trans (hg_sum i u).symm + have h1 : (g (N.f i u) + s) + (g (N.g i u) + t) = + (s + t) + (g (N.f i u) + g (N.g i u)) := by ring + exact CharTwo.add_eq_zero.mp (by rw [h1, hst', CharTwo.add_self_eq_zero]) + · obtain ⟨rfl, rfl⟩ := Prod.ext_iff.mp hu.symm + refine ⟨(N.φ_f_eq_φ_g i u).symm, ?_⟩ + have hst' : s + t = g (N.f i u) + g (N.g i u) := hst.trans (hg_sum i u).symm + have h1 : (g (N.g i u) + s) + (g (N.f i u) + t) = + (s + t) + (g (N.f i u) + g (N.g i u)) := by ring + exact CharTwo.add_eq_zero.mp (by rw [h1, hst', CharTwo.add_self_eq_zero]) + · exact hcov + rw [hcov_eq] + refine ((isClosed_diagonal.union (isClosed_iUnion_of_finite fun i => ?_)).union ?_) + · have hcl_fg : IsClosed (range (fun u => (N.f i u, N.g i u)) ∪ + range (fun u => (N.g i u, N.f i u))) := + ((isCompact_range ((N.f i).continuous.prodMk (N.g i).continuous)).isClosed).union + ((isCompact_range ((N.g i).continuous.prodMk (N.f i).continuous)).isClosed) + have hc1 : Continuous fun p : (N.D × K) × (N.D × K) => (p.1.1, p.2.1) := + (continuous_fst.comp continuous_fst).prodMk (continuous_fst.comp continuous_snd) + have hc2 : Continuous fun p : (N.D × K) × (N.D × K) => p.1.2 + p.2.2 := + (continuous_of_discreteTopology (f := fun q : K × K => q.1 + q.2)).comp + ((continuous_snd.comp continuous_fst).prodMk (continuous_snd.comp continuous_snd)) + exact (hcl_fg.preimage hc1).inter (isClosed_singleton.preimage hc2) + · have hfin_pre : (N.φ ⁻¹' N.seamV).Finite := N.finite_preimage N.finite_seamV + have hfin_R3 : R₃.Finite := by + refine (((hfin_pre.prod finite_univ).prod (hfin_pre.prod finite_univ)).subset ?_) + rintro ⟨⟨x, s⟩, ⟨y, t⟩⟩ ⟨hx, hy, _⟩ + exact ⟨⟨hx, trivial⟩, ⟨hy, trivial⟩⟩ + exact hfin_R3.isClosed + +private theorem net_cover_action_free + {S : Type u} + [TopologicalSpace S] + (N : Net S) + (g : N.D → K) + (covSetoid : Setoid (N.D × K)) + (hexact : ∀ {x y : N.D × K}, Quotient.mk covSetoid x = Quotient.mk covSetoid y → + N.φ x.1 = N.φ y.1 ∧ g x.1 + x.2 = g y.1 + y.2) + (τ : K → (Quotient covSetoid) → (Quotient covSetoid)) + (hτmk : ∀ (s : K) (x : N.D × K), + τ s (Quotient.mk covSetoid x) = Quotient.mk covSetoid (x.1, x.2 + s)) : + ∀ (s : K) (z : (Quotient covSetoid)), τ s z = z → s = 0 := by + let Z := Quotient covSetoid + intro s z he + obtain ⟨x, rfl⟩ := Quotient.exists_rep z + rw [hτmk] at he + exact add_eq_left.mp (add_left_cancel (hexact he).2) + +private theorem voltage_primitive_of_cover + {S : Type u} + [TopologicalSpace S] + (N : Net S) + {Z : Type u} + [TopologicalSpace Z] + (g : N.D → K) + (mk : N.D × K → Z) + (hmk : let _ : TopologicalSpace K := ⊥; Continuous mk) + (τ : K → Z → Z) + (hτmk : ∀ (s : K) (x : N.D × K), τ s (mk x) = mk (x.1, x.2 + s)) + (σ : S → Z) + (hσf : ∀ (a : N.D), σ (N.φ a) = mk (a, g a)) + (φ : S → S → K) + (V_cov : Set (Z × Z)) + (hV_cov : NearDiag V_cov) + (hφs : ∀ (x y : S) (s : K), (τ s (σ x), σ y) ∈ V_cov → φ x y = s) + (hinv : ∀ (t : K) (z z' : Z), (z, z') ∈ V_cov → (τ t z, τ t z') ∈ V_cov) : + Prim (pbk N.φ φ) univ g := by + let _ : TopologicalSpace K := ⊥ + let P : N.D → Z := fun z => mk (z, 0) + have hPc : Continuous P := hmk.comp (continuous_id.prodMk continuous_const) + intro p _ + have hVp : (fun a : N.D × N.D => (P a.1, P a.2)) ⁻¹' V_cov ∈ 𝓝 (p, p) := + ((hPc.comp continuous_fst).prodMk (hPc.comp continuous_snd)).continuousAt.preimage_mem_nhds + (hV_cov (P p)) + rw [mem_nhds_prod_iff] at hVp + obtain ⟨W₁, hW₁, W₂, hW₂, hsub⟩ := hVp + refine ⟨W₁ ∩ W₂, Filter.inter_mem hW₁ hW₂, fun a ha b hb => ?_⟩ + have hab : (P a, P b) ∈ V_cov := hsub (mk_mem_prod ha.1.1 hb.1.2) + have h2 := hinv (g b) _ _ hab + change (τ (g b) (mk (a, 0)), τ (g b) (mk (b, 0))) ∈ V_cov at h2 + rw [hτmk, hτmk, zero_add] at h2 + have hab' : mk (a, g b) = τ (g a + g b) (σ (N.φ a)) := by + rw [hσf a, hτmk] + congr 2 + have hring : g a + (g a + g b) = (g a + g a) + g b := by ring + rw [hring, CharTwo.add_self_eq_zero, zero_add] + rw [hab', ← hσf b] at h2 + exact hφs (N.φ a) (N.φ b) (g a + g b) h2 + +/-- Every seam voltage assignment `v : Fin N.r → K` arises from a local cocycle `φ : S → S → K` +that vanishes near the diagonal of `bd S` and has a primitive `g` on `N.D` with endpoint jumps `v`. +-/ +private theorem exists_cocycle_of_net_volt (hS : IsSurface S) (N : Net S) (v : Fin N.r → K) : + ∃ (φ : S → S → K) (g : N.D → K), + IsCoc φ ∧ + (∃ N_bd : Set (S × S), NearDiag N_bd ∧ ∀ x ∈ bd S, ∀ y ∈ bd S, (x, y) ∈ N_bd → φ x y = 0) ∧ + Prim (pbk N.φ φ) univ g ∧ + ∀ i : Fin N.r, g (N.f i 0) + g (N.f i 1) = v i := by + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + have : T2Space S := hS.2.1 + let _ : TopologicalSpace K := ⊥ + have : DiscreteTopology K := ⟨rfl⟩ + let t_mid : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht_mid : t_mid ∈ Ioo (0 : unitInterval) 1 := by + constructor <;> rw [← Subtype.coe_lt_coe] <;> norm_num [t_mid] + choose g_step hg_step01 hg_step_sum hg_step_loc using N.exists_step_func_on_bd_D + let g : N.D → K := fun x => ∑ i : Fin N.r, v i * g_step i x + have hg_01 : ∀ j : Fin N.r, g (N.f j 0) + g (N.f j 1) = v j := by + intro j + calc + g (N.f j 0) + g (N.f j 1) + = ∑ i : Fin N.r, v i * (g_step i (N.f j 0) + g_step i (N.f j 1)) := by + dsimp [g] + rw [← Finset.sum_add_distrib] + exact Finset.sum_congr rfl fun i _ => (mul_add (v i) _ _).symm + _ = ∑ i : Fin N.r, v i * (if j = i then 1 else 0) := by + refine Finset.sum_congr rfl fun i _ => ?_ + rw [hg_step01 i j] + _ = v j := by simp + have hg_sum : ∀ (j : Fin N.r) (u : unitInterval), + g (N.f j u) + g (N.g j u) = g (N.f j 0) + g (N.g j 0) := by + intro j u + calc + g (N.f j u) + g (N.g j u) + = ∑ i : Fin N.r, v i * (g_step i (N.f j u) + g_step i (N.g j u)) := by + dsimp [g] + rw [← Finset.sum_add_distrib] + exact Finset.sum_congr rfl fun i _ => (mul_add (v i) _ _).symm + _ = ∑ i : Fin N.r, v i * (g_step i (N.f j 0) + g_step i (N.g j 0)) := by + refine Finset.sum_congr rfl fun i _ => ?_ + rw [hg_step_sum i j u] + _ = g (N.f j 0) + g (N.g j 0) := by + dsimp [g] + rw [← Finset.sum_add_distrib] + exact Finset.sum_congr rfl fun i _ => mul_add (v i) _ _ + have hg_loc : ∀ p ∈ bd N.D ∩ N.φ ⁻¹' (bd S), ∃ W ∈ 𝓝 p, ∀ x ∈ W ∩ bd N.D, g x = g p := by + intro p ⟨hpbd_D, hpbd_S⟩ + have hp_not_m : ∀ i : Fin N.r, p ∈ bd N.D \ {N.f i t_mid, N.g i t_mid} := by + intro i + refine ⟨hpbd_D, ?_⟩ + rintro (rfl | h2) + · exact N.notMem_bd_of_mem_Ioo hS i ht_mid hpbd_S + · rw [mem_singleton_iff.mp h2] at hpbd_S + change N.φ (N.g i t_mid) ∈ bd S at hpbd_S + rw [← N.φ_f_eq_φ_g i t_mid] at hpbd_S + exact N.notMem_bd_of_mem_Ioo hS i ht_mid hpbd_S + choose W_i hW_i hW_i_eq using fun i => hg_step_loc i p (hp_not_m i) + refine ⟨⋂ i : Fin N.r, W_i i, Filter.iInter_mem.mpr hW_i, fun x ⟨hxW, hxbd⟩ => ?_⟩ + dsimp [g] + refine Finset.sum_congr rfl fun i _ => ?_ + rw [hW_i_eq i x ⟨mem_iInter.mp hxW i, hxbd⟩] + let covRel (x y : N.D × K) : Prop := N.φ x.1 = N.φ y.1 ∧ g x.1 + x.2 = g y.1 + y.2 + let covSetoid : Setoid (N.D × K) := + { r := covRel + iseqv := + { refl := fun x => ⟨rfl, rfl⟩ + symm := fun ⟨h1, h2⟩ => ⟨h1.symm, h2.symm⟩ + trans := fun ⟨h1, h2⟩ ⟨h3, h4⟩ => ⟨h1.trans h3, h2.trans h4⟩ } } + have hcl_cov : IsClosed {p : (N.D × K) × (N.D × K) | covSetoid.r p.1 p.2} := by + exact net_voltage_relation_isClosed (S := S) N g hg_sum + have htZ : T2Space (Quotient covSetoid) := + t2Space_quotient_of_isClosed covSetoid hcl_cov + let Z := Quotient covSetoid + let mk : N.D × K → Z := Quotient.mk covSetoid + have hmk : Continuous mk := continuous_quotient_mk' + have hsound : ∀ {x y : N.D × K}, N.φ x.1 = N.φ y.1 → g x.1 + x.2 = g y.1 + y.2 → mk x = mk y := + fun h1 h2 => Quotient.sound ⟨h1, h2⟩ + have hexact : ∀ {x y : N.D × K}, mk x = mk y → N.φ x.1 = N.φ y.1 ∧ g x.1 + x.2 = g y.1 + y.2 := + fun h => Quotient.exact h + let τ : K → Z → Z := fun s => + Quotient.lift (fun x => mk (x.1, x.2 + s)) fun x y h => + hsound h.1 (by + have h2 : g x.1 + x.2 = g y.1 + y.2 := h.2 + simp only + rw [← add_assoc, h2, add_assoc]) + have hτmk : ∀ s x, τ s (mk x) = mk (x.1, x.2 + s) := fun _ _ => rfl + have hτc : ∀ s, Continuous (τ s) := fun s => + Continuous.quotient_lift (hmk.comp (continuous_fst.prodMk (continuous_snd.add + continuous_const))) _ + have hτ0 : ∀ z, τ 0 z = z := by + intro z + obtain ⟨x, rfl⟩ := Quotient.exists_rep z + rw [hτmk, add_zero] + have hτa : ∀ s t z, τ s (τ t z) = τ (t + s) z := by + intro s t z + obtain ⟨x, rfl⟩ := Quotient.exists_rep z + rw [hτmk, hτmk, hτmk, add_assoc] + have hfree : ∀ s z, τ s z = z → s = 0 := by + exact net_cover_action_free (S := S) N g covSetoid hexact τ hτmk + let q : Z → S := Quotient.lift (fun x => N.φ x.1) fun _ _ h => h.1 + have hq : Continuous q := + Continuous.quotient_lift (N.quotientMap_φ.continuous.comp continuous_fst) _ + have hs : Function.Surjective q := fun y => by + obtain ⟨a, rfl⟩ := N.quotientMap_φ.surjective y + exact ⟨mk (a, 0), rfl⟩ + have hfib : ∀ z z', q z = q z' → ∃ s, z' = τ s z := by + intro z z' he + obtain ⟨x, rfl⟩ := Quotient.exists_rep z + obtain ⟨y, rfl⟩ := Quotient.exists_rep z' + have h1 : N.φ x.1 = N.φ y.1 := he + refine ⟨x.2 + g x.1 + g y.1 + y.2, ?_⟩ + rw [hτmk] + refine hsound h1.symm ?_ + have hring : g x.1 + (x.2 + (x.2 + g x.1 + g y.1 + y.2)) = + (g x.1 + g x.1) + (x.2 + x.2) + (g y.1 + y.2) := by ring + rw [hring, CharTwo.add_self_eq_zero, CharTwo.add_self_eq_zero, add_zero, zero_add] + have hfib' : ∀ s z, q (τ s z) = q z := by + intro s z + obtain ⟨x, rfl⟩ := Quotient.exists_rep z + rfl + choose l hl using N.quotientMap_φ.surjective + let σ : S → Z := fun y => mk (l y, g (l y)) + have hσ : ∀ y, q (σ y) = y := fun y => hl y + have hσf : ∀ a : N.D, σ (N.φ a) = mk (a, g a) := fun a => + hsound (hl (N.φ a)) (by rw [CharTwo.add_self_eq_zero, CharTwo.add_self_eq_zero]) + obtain ⟨φ, V_cov, hV_cov, hφ_coc, hφs, hinv⟩ := + cocycle_of_cover τ hτc hτ0 hτa hfree q hq hs hfib hfib' σ hσ + have hprim : Prim (pbk N.φ φ) univ g := by + exact voltage_primitive_of_cover N g mk hmk τ hτmk σ hσf φ V_cov hV_cov hφs + hinv + have hbd_zero : ∃ N_bd : Set (S × S), NearDiag N_bd ∧ + ∀ x ∈ bd S, ∀ y ∈ bd S, (x, y) ∈ N_bd → φ x y = 0 := by + obtain ⟨N_coc, hN_coc, hcoc⟩ := hφ_coc + have hloc_S : ∀ p ∈ bd S, ∃ Ω : Set S, IsOpen Ω ∧ p ∈ Ω ∧ Ω ×ˢ Ω ⊆ N_coc ∧ + ∀ x ∈ Ω ∩ bd S, φ x p = 0 ∧ φ p x = 0 := by + intro p hp + have hloc_z : ∀ z : N.D, ∃ U : Set N.D, IsOpen U ∧ z ∈ U ∧ + (N.φ z = p → ∀ a ∈ U ∩ bd N.D, φ (N.φ a) p = 0 ∧ φ p (N.φ a) = 0) := by + intro z + by_cases hzp : N.φ z = p + · have hzp_bd : N.φ z ∈ bd S := hzp.symm ▸ hp + have hz_bd : z ∈ bd N.D := N.preimage_seamU ▸ N.bd_subset_seamU hzp_bd + obtain ⟨W₁, hW₁, h1⟩ := hg_loc z ⟨hz_bd, hzp_bd⟩ + obtain ⟨W₂, hW₂, h2⟩ := hprim z trivial + obtain ⟨U, hU_sub, hU_open, hzU⟩ := mem_nhds_iff.mp (Filter.inter_mem hW₁ hW₂) + refine ⟨U, hU_open, hzU, fun _ a ⟨haU, habd⟩ => ?_⟩ + have hga : g a = g z := h1 a ⟨(hU_sub haU).1, habd⟩ + have hφ1 := h2 a ⟨(hU_sub haU).2, trivial⟩ z ⟨(hU_sub hzU).2, trivial⟩ + have hφ2 := h2 z ⟨(hU_sub hzU).2, trivial⟩ a ⟨(hU_sub haU).2, trivial⟩ + change φ (N.φ a) (N.φ z) = g a + g z at hφ1 + change φ (N.φ z) (N.φ a) = g z + g a at hφ2 + rw [hzp, hga, CharTwo.add_self_eq_zero] at hφ1 hφ2 + exact ⟨hφ1, hφ2⟩ + · exact ⟨univ, isOpen_univ, trivial, fun h => absurd h hzp⟩ + choose U_z hU_z_open hz_U hU_z_zero using hloc_z + let U_p : Set N.D := ⋃ z ∈ N.φ ⁻¹' {p}, U_z z + have hUp_open : IsOpen U_p := isOpen_biUnion fun z _ => hU_z_open z + let Ω₀ : Set S := (N.φ '' U_pᶜ)ᶜ + have hΩ₀_open : IsOpen Ω₀ := + (N.quotientMap_φ.continuous.isClosedMap U_pᶜ hUp_open.isClosed_compl).isOpen_compl + have hp_Ω₀ : p ∈ Ω₀ := by + rintro ⟨z, hz_not, hzp⟩ + exact hz_not (mem_biUnion (mem_singleton_iff.mpr hzp) (hz_U z)) + have hNcoc_p : N_coc ∈ 𝓝 (p, p) := hN_coc p + rw [mem_nhds_prod_iff] at hNcoc_p + obtain ⟨V₁, hV₁, V₂, hV₂, hV_sub⟩ := hNcoc_p + obtain ⟨Ω, hΩ_sub, hΩ_open, hpΩ⟩ := + mem_nhds_iff.mp (Filter.inter_mem (hΩ₀_open.mem_nhds hp_Ω₀) (Filter.inter_mem hV₁ hV₂)) + refine ⟨Ω, hΩ_open, hpΩ, ?_, fun x ⟨hxΩ, hxbd⟩ => ?_⟩ + · rintro ⟨a, b⟩ ⟨ha, hb⟩ + exact hV_sub ⟨(hΩ_sub ha).2.1, (hΩ_sub hb).2.2⟩ + · obtain ⟨a, rfl⟩ := N.quotientMap_φ.surjective x + have habd : a ∈ bd N.D := N.preimage_seamU ▸ N.bd_subset_seamU hxbd + have ha_Up : a ∈ U_p := by + by_contra hnot + exact (hΩ_sub hxΩ).1 ⟨a, hnot, rfl⟩ + obtain ⟨z, hzp, ha_Uz⟩ := mem_iUnion₂.mp ha_Up + exact hU_z_zero z hzp a ⟨ha_Uz, habd⟩ + have hloc_all : ∀ p : S, ∃ Ω : Set S, IsOpen Ω ∧ p ∈ Ω ∧ + (p ∈ bd S → Ω ×ˢ Ω ⊆ N_coc ∧ ∀ x ∈ Ω ∩ bd S, φ x p = 0 ∧ φ p x = 0) ∧ + (p ∉ bd S → Ω ⊆ (bd S)ᶜ) := by + intro p + by_cases hp : p ∈ bd S + · obtain ⟨Ω, hΩ_open, hpΩ, hsub, hzero⟩ := hloc_S p hp + exact ⟨Ω, hΩ_open, hpΩ, fun _ => ⟨hsub, hzero⟩, fun h => absurd hp h⟩ + · exact ⟨(bd S)ᶜ, (isClosed_bd S).isOpen_compl, hp, fun h => absurd h hp, fun _ => Subset.rfl⟩ + choose Ω hΩ_open hpΩ hΩ_bd hΩ_not using hloc_all + let N_bd : Set (S × S) := ⋃ p : S, Ω p ×ˢ Ω p + have hN_bd_open : IsOpen N_bd := isOpen_iUnion fun p => (hΩ_open p).prod (hΩ_open p) + have hNear : NearDiag N_bd := fun p => + hN_bd_open.mem_nhds (mem_iUnion.mpr ⟨p, hpΩ p, hpΩ p⟩) + refine ⟨N_bd, hNear, fun x hx y hy hxy => ?_⟩ + obtain ⟨p, hxp, hyp⟩ := mem_iUnion.mp hxy + have hp_bd : p ∈ bd S := by + by_contra hnot + exact hΩ_not p hnot hxp hx + obtain ⟨hsub_coc, hzero⟩ := hΩ_bd p hp_bd + have h1 := (hzero x ⟨hxp, hx⟩).1 + have h2 := (hzero y ⟨hyp, hy⟩).2 + have h3 := hcoc x p y (hsub_coc ⟨hxp, hpΩ p⟩) (hsub_coc ⟨hpΩ p, hyp⟩) (hsub_coc ⟨hxp, hyp⟩) + rw [← h3, h1, h2, add_zero] + exact ⟨φ, g, hφ_coc, hbd_zero, hprim, hg_01⟩ + +end Net + +local notation "K" => ZMod 2 + +/-- **(2.2)** (Euler's formula for seam graphs, page 216): if `N` is a net in a surface +`S ≃ₜ Σ(a, b, c)` and `J` is its seam graph, then `|E(J)| + 1 = |V(J)| + 2a + b + c`. -/ +theorem seamGraph_euler_formula (S : Type u) [TopologicalSpace S] + (hS : IsSurface S) (a b c : ℕ) (he : Nonempty (S ≃ₜ SurfaceModel a b c)) + (J : Drawing S) (hSeam : IsSeamGraph J) : + J.E.ncard + 1 = J.V.ncard + 2 * a + b + c := by + rcases he with ⟨e_surf⟩ + rcases hSeam with ⟨N, hJ⟩ + have : T2Space S := hS.2.1 + have hpos : 0 < N.r := N.r_pos_of_isSeamGraphFor hJ + have hfin_V : N.seamV.Finite := N.finite_seamV + have hfin_bdV : (bd S ∩ N.seamV).Finite := hfin_V.subset inter_subset_right + obtain ⟨ht_model, f_ew, hf_ew⟩ := presents_ew a b c + have hcuffs_eq : (cuffs S).ncard = c := by + rw [ncard_cuffs_congr e_surf, ncard_cuffs hf_ew] + have hkCl_eq : Nat.card (KCl S K) = 2 ^ (2 * a + b) := by + rw [card_kCl_congr e_surf, GraphMinor.Surface.card_kCl (A := K) hf_ew, card_lam_two] + choose φ_v g_v hφ_v_coc hφ_v_bd hg_v_prim hg_v_01 using N.exists_cocycle_of_net_volt hS + choose N_bd_v hN_bd_v hbd_v using hφ_v_bd + have hφ_v_mem : ∀ v : Fin N.r → K, φ_v v ∈ KSet S K := by + intro v + refine ⟨hφ_v_coc v, 0, N_bd_v v, hN_bd_v v, fun x hx y hy hxy => ?_⟩ + simp [hbd_v v x hx y hy hxy] + let toKCl : (Fin N.r → K) → KCl S K := fun v => + Quotient.mk (kSetoid S K) ⟨φ_v v, hφ_v_mem v⟩ + have hrel_iff : ∀ v w : Fin N.r → K, + CohRel (φ_v v) (φ_v w) ↔ (Submodule.quotientRel (LinearMap.range N.δ)).r v w := by + intro v w + rw [N.cohRel_iff_mem_range_δ hS hpos (hφ_v_coc v) (hφ_v_coc w) + (hN_bd_v v) (hN_bd_v w) (hbd_v v) (hbd_v w) (hg_v_prim v) (hg_v_prim w)] + rw [Submodule.quotientRel_def] + have hfun : (fun i => g_v v (N.f i 0) + g_v v (N.f i 1) + + (g_v w (N.f i 0) + g_v w (N.f i 1))) = v - w := by + ext i + rw [hg_v_01 v i, hg_v_01 w i] + exact (CharTwo.sub_eq_add (v i) (w i)).symm + rw [hfun] + let Φ : ((Fin N.r → K) ⧸ LinearMap.range N.δ) → KCl S K := + Quotient.lift toKCl fun v w hvw => Quotient.sound ((hrel_iff v w).mpr hvw) + have hΦ_bij : Function.Bijective Φ := by + constructor + · refine Quotient.ind₂ fun v w h => Quotient.sound ?_ + exact (hrel_iff v w).mp (Quotient.exact h) + · intro q + obtain ⟨⟨φ, hφ_coc, h_bd, N_bd, hN_bd, hbd⟩, rfl⟩ := Quotient.exists_rep q + let φ' : S → S → K := fun x y => φ x y + h_bd x + h_bd y + have hφ'_coc : IsCoc φ' := by + obtain ⟨N_c, hN_c, hc⟩ := hφ_coc + refine ⟨N_c, hN_c, fun x y z hxy hyz hxz => ?_⟩ + dsimp [φ'] + rw [← hc x y z hxy hyz hxz] + have hring : (φ x y + h_bd x + h_bd y) + (φ y z + h_bd y + h_bd z) = + (φ x y + φ y z + h_bd x + h_bd z) + (h_bd y + h_bd y) := by ring + rw [hring, CharTwo.add_self_eq_zero, add_zero] + have hφ'_bd : ∀ x ∈ bd S, ∀ y ∈ bd S, (x, y) ∈ N_bd → φ' x y = 0 := by + intro x hx y hy hxy + dsimp [φ'] + rw [hbd x hx y hy hxy, CharTwo.neg_eq] + have hring : h_bd x + h_bd y + h_bd x + h_bd y = + (h_bd x + h_bd x) + (h_bd y + h_bd y) := by ring + rw [hring, CharTwo.add_self_eq_zero, CharTwo.add_self_eq_zero, add_zero] + have hrel_φ : CohRel φ' φ := by + refine ⟨h_bd, univ, fun _ => univ_mem, fun x y _ => ?_⟩ + dsimp [φ'] + rw [CharTwo.sub_eq_add, CharTwo.sub_eq_add] + have hring : (φ x y + h_bd x + h_bd y) + φ x y = + (φ x y + φ x y) + (h_bd y + h_bd x) := by ring + rw [hring, CharTwo.add_self_eq_zero, zero_add] + have hpbk_coc : IsCoc (pbk N.φ φ') := by + obtain ⟨N_c, hN_c, hc⟩ := hφ'_coc + refine ⟨(fun p : N.D × N.D => (N.φ p.1, N.φ p.2)) ⁻¹' N_c, fun z => ?_, + fun a b c hab hbc hac => hc _ _ _ hab hbc hac⟩ + exact ((N.quotientMap_φ.continuous.comp continuous_fst).prodMk + (N.quotientMap_φ.continuous.comp continuous_snd)).continuousAt.preimage_mem_nhds + (hN_c (N.φ z)) + obtain ⟨g', hg'_prim⟩ := Surface.exists_prim_disc hpbk_coc N.isClosedDisc_D + let v : Fin N.r → K := fun i => g' (N.f i 0) + g' (N.f i 1) + have hrel_v : CohRel (φ_v v) φ' := by + rw [N.cohRel_iff_mem_range_δ hS hpos (hφ_v_coc v) hφ'_coc + (hN_bd_v v) hN_bd (hbd_v v) hφ'_bd (hg_v_prim v) hg'_prim] + have hzero : (fun i => g_v v (N.f i 0) + g_v v (N.f i 1) + + (g' (N.f i 0) + g' (N.f i 1))) = 0 := by + ext i + rw [hg_v_01 v i] + exact CharTwo.add_self_eq_zero (v i) + rw [hzero] + exact Submodule.zero_mem _ + refine ⟨Submodule.Quotient.mk v, Quotient.sound (hrel_v.trans hrel_φ)⟩ + have hcard_quot : Nat.card ((Fin N.r → K) ⧸ LinearMap.range N.δ) = + 2 ^ Module.finrank K ((Fin N.r → K) ⧸ LinearMap.range N.δ) := by + have h : Nat.card ((Fin N.r → K) ⧸ LinearMap.range N.δ) = + Nat.card K ^ Module.finrank K ((Fin N.r → K) ⧸ LinearMap.range N.δ) := + Module.natCard_eq_pow_finrank + rwa [Nat.card_zmod] at h + have hfinrank_quot : Module.finrank K ((Fin N.r → K) ⧸ LinearMap.range N.δ) = 2 * a + b := by + have h1 : 2 ^ Module.finrank K ((Fin N.r → K) ⧸ LinearMap.range N.δ) = 2 ^ (2 * a + b) := by + rw [← hcard_quot, ← hkCl_eq, Nat.card_congr (Equiv.ofBijective Φ hΦ_bij)] + exact Nat.pow_right_injective (le_refl 2) h1 + have hquot_add := Submodule.finrank_quotient_add_finrank (LinearMap.range N.δ) + rw [Module.finrank_fin_fun, hfinrank_quot] at hquot_add + have hrange_δ := N.finrank_range_δ hS hpos + have hW_bd := N.finrank_W_bd hS hpos + have hE := N.ncard_E_seamGraph hS hJ + have hV : J.V = N.seamV := hJ.2.2 + rw [hV] at hE ⊢ + rw [hcuffs_eq] at hW_bd + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section2MinVal.lean b/LeanPool/GraphMinor/GM07/Section2MinVal.lean new file mode 100644 index 0000000000..9987cfa1b2 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section2MinVal.lean @@ -0,0 +1,3057 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section2Base +public import LeanPool.GraphMinor.GM07.Section2Euler +import LeanPool.GraphMinor.GM07.CuffIncidences +import LeanPool.GraphMinor.GM11.DrawingOps +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.GM11.Section4b +import LeanPool.GraphMinor.Surface.Circle +import LeanPool.GraphMinor.Surface.Classification +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.Gluing +import LeanPool.GraphMinor.Surface.ModelCriterion +import LeanPool.GraphMinor.Surface.SideCut +import LeanPool.GraphMinor.Surface.SurfacePull +import LeanPool.GraphMinor.Surface.WordFold + +/-! +# Graph Minors VII, (2.3): Minimum Valency of the Seam Graph of a Minimal Net + +This file proves `(2.3)` (`minimalNet_minValency`, pages 216–217) of N. Robertson and P. D. Seymour, +*Graph Minors. VII. Disjoint paths on a surface*, J. Combin. Theory Ser. B 45 (1988) 212–254: +if `S` is a connected surface not homeomorphic to `Σ(0, 0, 0)`, `Σ(0, 0, 1)`, or `Σ(0, 1, 0)`, and +`J` is the seam graph for a minimal net `N` with respect to a proper graph `G` in `S`, then every +vertex `v ∈ J.V` has `3 ≤ vertexValency J v`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +namespace Net + +/-! ## 1. Reversing and swapping pasted pairs in a net -/ + +/-- Reverse a curve `c : Curve D` by precomposing with `unitInterval.symm`. -/ +def revCurve {D : Type u} [TopologicalSpace D] (c : Curve D) : Curve D := + c.comp ⟨unitInterval.symm, unitInterval.continuous_symm⟩ + +@[simp] +theorem revCurve_apply {D : Type u} [TopologicalSpace D] (c : Curve D) (t : unitInterval) : + revCurve c t = c (unitInterval.symm t) := + rfl + +theorem revCurve_zero {D : Type u} [TopologicalSpace D] (c : Curve D) : + revCurve c 0 = c 1 := by + simp [revCurve] + +theorem revCurve_one {D : Type u} [TopologicalSpace D] (c : Curve D) : + revCurve c 1 = c 0 := by + simp [revCurve] + +theorem injective_revCurve {D : Type u} [TopologicalSpace D] {c : Curve D} + (hc : Function.Injective c) : Function.Injective (revCurve c) := + hc.comp unitInterval.symm_bijective.injective + +@[simp] +theorem range_revCurve {D : Type u} [TopologicalSpace D] (c : Curve D) : + range (revCurve c) = range c := + unitInterval.symm_bijective.surjective.range_comp c + +theorem mem_Ioo_symm_iff {t : unitInterval} : + unitInterval.symm t ∈ Ioo (0 : unitInterval) 1 ↔ t ∈ Ioo (0 : unitInterval) 1 := by + simp only [mem_Ioo, ← Subtype.coe_lt_coe, unitInterval.coe_symm_eq, Icc.coe_zero, Icc.coe_one] + constructor <;> intro ⟨h1, h2⟩ <;> exact ⟨by linarith, by linarith⟩ + +@[simp] +theorem image_Ioo_revCurve {D : Type u} [TopologicalSpace D] (c : Curve D) : + revCurve c '' Ioo (0 : unitInterval) 1 = c '' Ioo (0 : unitInterval) 1 := by + ext x + simp only [mem_image, revCurve_apply] + constructor + · rintro ⟨t, ht, rfl⟩ + exact ⟨unitInterval.symm t, mem_Ioo_symm_iff.mpr ht, rfl⟩ + · rintro ⟨t, ht, rfl⟩ + exact ⟨unitInterval.symm t, mem_Ioo_symm_iff.mpr ht, by simp⟩ + +/-- Reverse the orientation of the `i₀`-th pair `(f i₀, g i₀)` in a net `N`. -/ +def revPair (N : Net S) (i₀ : Fin N.r) : Net S where + D := N.D + topD := N.topD + isSurface_D := N.isSurface_D + isClosedDisc_D := N.isClosedDisc_D + r := N.r + f := fun i => if i = i₀ then revCurve (N.f i) else N.f i + g := fun i => if i = i₀ then revCurve (N.g i) else N.g i + φ := N.φ + injective_f := fun i => by + split_ifs + · exact injective_revCurve (N.injective_f i) + · exact N.injective_f i + range_f_subset_bd := fun i => by + split_ifs + · rw [range_revCurve]; exact N.range_f_subset_bd i + · exact N.range_f_subset_bd i + injective_g := fun i => by + split_ifs + · exact injective_revCurve (N.injective_g i) + · exact N.injective_g i + range_g_subset_bd := fun i => by + split_ifs + · rw [range_revCurve]; exact N.range_g_subset_bd i + · exact N.range_g_subset_bd i + internally_disjoint_ff := fun i j hij x hx => by + split_ifs with hj hi hi + · rw [range_revCurve] + exact N.internally_disjoint_ff i j hij (unitInterval.symm x) (mem_Ioo_symm_iff.mpr hx) + · rw [range_revCurve] + exact N.internally_disjoint_ff i j hij x hx + · exact N.internally_disjoint_ff i j hij (unitInterval.symm x) (mem_Ioo_symm_iff.mpr hx) + · exact N.internally_disjoint_ff i j hij x hx + internally_disjoint_gg := fun i j hij x hx => by + split_ifs with hj hi hi + · rw [range_revCurve] + exact N.internally_disjoint_gg i j hij (unitInterval.symm x) (mem_Ioo_symm_iff.mpr hx) + · rw [range_revCurve] + exact N.internally_disjoint_gg i j hij x hx + · exact N.internally_disjoint_gg i j hij (unitInterval.symm x) (mem_Ioo_symm_iff.mpr hx) + · exact N.internally_disjoint_gg i j hij x hx + internally_disjoint_fg := fun i j x hx => by + split_ifs with hj hi hi + · rw [range_revCurve] + exact N.internally_disjoint_fg i j (unitInterval.symm x) (mem_Ioo_symm_iff.mpr hx) + · rw [range_revCurve] + exact N.internally_disjoint_fg i j x hx + · exact N.internally_disjoint_fg i j (unitInterval.symm x) (mem_Ioo_symm_iff.mpr hx) + · exact N.internally_disjoint_fg i j x hx + internally_disjoint_gf := fun i j x hx => by + split_ifs with hj hi hi + · rw [range_revCurve] + exact N.internally_disjoint_gf i j (unitInterval.symm x) (mem_Ioo_symm_iff.mpr hx) + · rw [range_revCurve] + exact N.internally_disjoint_gf i j x hx + · exact N.internally_disjoint_gf i j (unitInterval.symm x) (mem_Ioo_symm_iff.mpr hx) + · exact N.internally_disjoint_gf i j x hx + quotientMap_φ := N.quotientMap_φ + pasting_eq := fun i x => by + split_ifs + · exact N.pasting_eq i (unitInterval.symm x) + · exact N.pasting_eq i x + interior_inj := N.interior_inj + bd_eq_iff := fun x y => by + rw [N.bd_eq_iff] + have hrel : (fun a b : N.D => ∃ (i : Fin N.r) (t : unitInterval), + a = N.f i t ∧ b = N.g i t) = + (fun a b : N.D => ∃ (i : Fin N.r) (t : unitInterval), + a = (if i = i₀ then revCurve (N.f i) else N.f i) t ∧ + b = (if i = i₀ then revCurve (N.g i) else N.g i) t) := by + ext a b + constructor + · rintro ⟨i, t, rfl, rfl⟩ + by_cases hi : i = i₀ + · refine ⟨i, unitInterval.symm t, ?_, ?_⟩ <;> simp [hi] + · refine ⟨i, t, ?_, ?_⟩ <;> simp [hi] + · rintro ⟨i, t, ha, hb⟩ + by_cases hi : i = i₀ + · subst hi + simp only [↓reduceIte, revCurve_apply] at ha hb + exact ⟨i, unitInterval.symm t, ha, hb⟩ + · simp only [hi, ↓reduceIte] at ha hb + exact ⟨i, t, ha, hb⟩ + rw [hrel] + +@[simp] +theorem r_revPair (N : Net S) (i₀ : Fin N.r) : + (N.revPair i₀).r = N.r := + rfl + +@[simp] +theorem φ_revPair (N : Net S) (i₀ : Fin N.r) : + (N.revPair i₀).φ = N.φ := + rfl + +@[simp] +theorem f_revPair (N : Net S) (i₀ i : Fin N.r) : + (N.revPair i₀).f i = if i = i₀ then revCurve (N.f i) else N.f i := + rfl + +@[simp] +theorem g_revPair (N : Net S) (i₀ i : Fin N.r) : + (N.revPair i₀).g i = if i = i₀ then revCurve (N.g i) else N.g i := + rfl + +@[simp] +theorem seamU_revPair (N : Net S) (i₀ : Fin N.r) : + (N.revPair i₀).seamU = N.seamU := + rfl + +@[simp] +theorem seamV_revPair (N : Net S) (i₀ : Fin N.r) : + (N.revPair i₀).seamV = N.seamV := by + ext z + change (∃ i : Fin N.r, N.φ (((if i = i₀ then revCurve (N.f i) else N.f i) : Curve N.D) 0) = z ∨ + N.φ (((if i = i₀ then revCurve (N.f i) else N.f i) : Curve N.D) 1) = z) ↔ + (∃ i : Fin N.r, N.φ (N.f i 0) = z ∨ N.φ (N.f i 1) = z) + refine exists_congr fun i => ?_ + split_ifs with hi + · simp [or_comm] + · rfl + +@[simp] +theorem isSeamGraphFor_revPair (N : Net S) (i₀ : Fin N.r) (J : Drawing S) : + (N.revPair i₀).IsSeamGraphFor J ↔ N.IsSeamGraphFor J := by + simp [IsSeamGraphFor] + +@[simp] +theorem isNormalFor_revPair (N : Net S) (i₀ : Fin N.r) (G : Drawing S) : + (N.revPair i₀).IsNormalFor G ↔ N.IsNormalFor G := by + simp [IsNormalFor] + +@[simp] +theorem bdVertexPreimageCard_revPair (N : Net S) (i₀ : Fin N.r) (G : Drawing S) : + (N.revPair i₀).bdVertexPreimageCard G = N.bdVertexPreimageCard G := + rfl + +@[simp] +theorem isMinimalFor_revPair (N : Net S) (i₀ : Fin N.r) (G : Drawing S) : + (N.revPair i₀).IsMinimalFor G ↔ N.IsMinimalFor G := by + simp only [IsMinimalFor, isNormalFor_revPair, bdVertexPreimageCard_revPair, r_revPair] + +/-- Swap `f i₀` and `g i₀` at the `i₀`-th pair in a net `N`. -/ +def swapPair (N : Net S) (i₀ : Fin N.r) : Net S where + D := N.D + topD := N.topD + isSurface_D := N.isSurface_D + isClosedDisc_D := N.isClosedDisc_D + r := N.r + f := fun i => if i = i₀ then N.g i else N.f i + g := fun i => if i = i₀ then N.f i else N.g i + φ := N.φ + injective_f := fun i => by + split_ifs + · exact N.injective_g i + · exact N.injective_f i + range_f_subset_bd := fun i => by + split_ifs + · exact N.range_g_subset_bd i + · exact N.range_f_subset_bd i + injective_g := fun i => by + split_ifs + · exact N.injective_f i + · exact N.injective_g i + range_g_subset_bd := fun i => by + split_ifs + · exact N.range_f_subset_bd i + · exact N.range_g_subset_bd i + internally_disjoint_ff := fun i j hij x hx => by + split_ifs with hj hi hi + · exact N.internally_disjoint_gg i j hij x hx + · exact N.internally_disjoint_fg i j x hx + · exact N.internally_disjoint_gf i j x hx + · exact N.internally_disjoint_ff i j hij x hx + internally_disjoint_gg := fun i j hij x hx => by + split_ifs with hj hi hi + · exact N.internally_disjoint_ff i j hij x hx + · exact N.internally_disjoint_gf i j x hx + · exact N.internally_disjoint_fg i j x hx + · exact N.internally_disjoint_gg i j hij x hx + internally_disjoint_fg := fun i j x hx => by + split_ifs with hj hi hi + · exact N.internally_disjoint_gf i j x hx + · have hij : i ≠ j := by rintro rfl; exact hi hj + exact N.internally_disjoint_ff i j hij x hx + · have hij : i ≠ j := by rintro rfl; exact hj hi + exact N.internally_disjoint_gg i j hij x hx + · exact N.internally_disjoint_fg i j x hx + internally_disjoint_gf := fun i j x hx => by + split_ifs with hj hi hi + · exact N.internally_disjoint_fg i j x hx + · have hij : i ≠ j := by rintro rfl; exact hi hj + exact N.internally_disjoint_gg i j hij x hx + · have hij : i ≠ j := by rintro rfl; exact hj hi + exact N.internally_disjoint_ff i j hij x hx + · exact N.internally_disjoint_gf i j x hx + quotientMap_φ := N.quotientMap_φ + pasting_eq := fun i x => by + split_ifs + · exact (N.pasting_eq i x).symm + · exact N.pasting_eq i x + interior_inj := N.interior_inj + bd_eq_iff := fun x y => by + rw [N.bd_eq_iff] + constructor <;> intro h <;> induction h with + | rel a b hab => + rcases hab with ⟨i, t, rfl, rfl⟩ + by_cases hi : i = i₀ + · refine Relation.EqvGen.symm _ _ (Relation.EqvGen.rel _ _ ⟨i, t, ?_, ?_⟩) <;> simp [hi] + · refine Relation.EqvGen.rel _ _ ⟨i, t, ?_, ?_⟩ <;> simp [hi] + | refl _ => exact Relation.EqvGen.refl _ + | symm _ _ _ ih => exact Relation.EqvGen.symm _ _ ih + | trans _ _ _ _ _ ih1 ih2 => exact Relation.EqvGen.trans _ _ _ ih1 ih2 + +@[simp] +theorem r_swapPair (N : Net S) (i₀ : Fin N.r) : + (N.swapPair i₀).r = N.r := + rfl + +@[simp] +theorem φ_swapPair (N : Net S) (i₀ : Fin N.r) : + (N.swapPair i₀).φ = N.φ := + rfl + +@[simp] +theorem f_swapPair (N : Net S) (i₀ i : Fin N.r) : + (N.swapPair i₀).f i = if i = i₀ then N.g i else N.f i := + rfl + +@[simp] +theorem g_swapPair (N : Net S) (i₀ i : Fin N.r) : + (N.swapPair i₀).g i = if i = i₀ then N.f i else N.g i := + rfl + +@[simp] +theorem seamU_swapPair (N : Net S) (i₀ : Fin N.r) : + (N.swapPair i₀).seamU = N.seamU := + rfl + +@[simp] +theorem seamV_swapPair (N : Net S) (i₀ : Fin N.r) : + (N.swapPair i₀).seamV = N.seamV := by + ext z + change (∃ i : Fin N.r, N.φ (((if i = i₀ then N.g i else N.f i) : Curve N.D) 0) = z ∨ + N.φ (((if i = i₀ then N.g i else N.f i) : Curve N.D) 1) = z) ↔ + (∃ i : Fin N.r, N.φ (N.f i 0) = z ∨ N.φ (N.f i 1) = z) + refine exists_congr fun i => ?_ + split_ifs with hi + · rw [← N.pasting_eq i 0, ← N.pasting_eq i 1] + · rfl + +@[simp] +theorem isSeamGraphFor_swapPair (N : Net S) (i₀ : Fin N.r) (J : Drawing S) : + (N.swapPair i₀).IsSeamGraphFor J ↔ N.IsSeamGraphFor J := by + simp [IsSeamGraphFor] + +@[simp] +theorem isNormalFor_swapPair (N : Net S) (i₀ : Fin N.r) (G : Drawing S) : + (N.swapPair i₀).IsNormalFor G ↔ N.IsNormalFor G := by + simp [IsNormalFor] + +@[simp] +theorem bdVertexPreimageCard_swapPair (N : Net S) (i₀ : Fin N.r) (G : Drawing S) : + (N.swapPair i₀).bdVertexPreimageCard G = N.bdVertexPreimageCard G := + rfl + +@[simp] +theorem isMinimalFor_swapPair (N : Net S) (i₀ : Fin N.r) (G : Drawing S) : + (N.swapPair i₀).IsMinimalFor G ↔ N.IsMinimalFor G := by + simp only [IsMinimalFor, isNormalFor_swapPair, bdVertexPreimageCard_swapPair, r_swapPair] + +/-! ## 3. Boundary vertices of a seam graph have valency at least 3 -/ + +/-- Every boundary vertex `v ∈ J.V ∩ bd S` of a seam graph `J` for any net `N` has +`3 ≤ vertexValency J v`. -/ +theorem three_le_vertexValency_of_mem_bd (hS : IsSurface S) (N : Net S) {J : Drawing S} + (hJ : N.IsSeamGraphFor J) {v : S} (hvV : v ∈ J.V) (hv_bd : v ∈ bd S) : + 3 ≤ vertexValency J v := by + have : T2Space S := hS.2.1 + obtain ⟨i₀, hi₀⟩ : ∃ i₀ : Fin N.r, N.φ (N.f i₀ 0) = v ∨ N.φ (N.f i₀ 1) = v := by + have hv_seamV : v ∈ N.seamV := hJ.2.2 ▸ hvV + exact hv_seamV + let e₀ := N.interiorSeamEdge i₀ + have he₀_E : e₀ ∈ J.E := N.e_int_mem_E hJ i₀ + have hv_tilde_e₀ : v ∈ tilde e₀ := by + rw [N.tilde_e_int hJ i₀] + rcases hi₀ with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + have hv_inc_e₀ : J.VertexIncident v e₀ := + (vertexIncident_iff_mem_tilde J hvV he₀_E).mpr hv_tilde_e₀ + have he₀_ne_boundary : ∀ {e}, e ⊆ bd S → e₀ ≠ e := by + intro e he_bd heq + obtain ⟨x, hxe₀⟩ := he₀_E.1 + exact Set.disjoint_left.mp (N.disjoint_e_int_bd hS i₀) hxe₀ (he_bd (heq ▸ hxe₀)) + have hcuffs : arcComponentsIn (bd S \ J.V) ⊆ J.E := by + rw [(N.seamGraph_edges_eq hS hJ).1] + exact subset_union_right + rcases exists_cuff_incident_edges_of_edge_cover hS hcuffs hvV hv_bd with + ⟨e₁, he₁_E, he₁_bd, hv_inc_e₁, hncard_e₁⟩ | + ⟨e₁, he₁_E, e₂, he₂_E, he₁_ne_e₂, he₁_bd, he₂_bd, hv_inc_e₁, hv_inc_e₂⟩ + · have h1_ge : 1 ≤ {e ∈ J.E | J.VertexIncident v e ∧ (tilde e).ncard = 1}.ncard := by + have hsub1 : ({e₁} : Set (Set S)) ⊆ + {e ∈ J.E | J.VertexIncident v e ∧ (tilde e).ncard = 1} := + singleton_subset_iff.mpr ⟨he₁_E, hv_inc_e₁, hncard_e₁⟩ + have hle := ncard_le_ncard hsub1 (J.finite_edges.subset fun e he => he.1) + rwa [ncard_singleton] at hle + rcases ncard_tilde_of_mem_E J he₀_E with h2_e₀ | h1_e₀ + · have h2_ge : 1 ≤ {e ∈ J.E | J.VertexIncident v e ∧ (tilde e).ncard = 2}.ncard := by + have hsub2 : ({e₀} : Set (Set S)) ⊆ + {e ∈ J.E | J.VertexIncident v e ∧ (tilde e).ncard = 2} := + singleton_subset_iff.mpr ⟨he₀_E, hv_inc_e₀, h2_e₀⟩ + have hle := ncard_le_ncard hsub2 (J.finite_edges.subset fun e he => he.1) + rwa [ncard_singleton] at hle + unfold vertexValency + omega + · have h1_ge2 : 2 ≤ {e ∈ J.E | J.VertexIncident v e ∧ (tilde e).ncard = 1}.ncard := by + have hsub_pair : ({e₀, e₁} : Set (Set S)) ⊆ + {e ∈ J.E | J.VertexIncident v e ∧ (tilde e).ncard = 1} := by + rintro e (rfl | rfl) + · exact ⟨he₀_E, hv_inc_e₀, h1_e₀⟩ + · exact ⟨he₁_E, hv_inc_e₁, hncard_e₁⟩ + have hle := ncard_le_ncard hsub_pair (J.finite_edges.subset fun e he => he.1) + rwa [ncard_pair (he₀_ne_boundary he₁_bd)] at hle + unfold vertexValency + omega + · have he₀_ne_e₁ : e₀ ≠ e₁ := he₀_ne_boundary he₁_bd + have he₀_ne_e₂ : e₀ ≠ e₂ := he₀_ne_boundary he₂_bd + let S₂ := {e ∈ J.E | J.VertexIncident v e ∧ (tilde e).ncard = 2} + let S₁ := {e ∈ J.E | J.VertexIncident v e ∧ (tilde e).ncard = 1} + have hS₂_fin : S₂.Finite := J.finite_edges.subset fun e he => he.1 + have hS₁_fin : S₁.Finite := J.finite_edges.subset fun e he => he.1 + have hdisj_S : Disjoint S₂ S₁ := by + rw [Set.disjoint_left] + intro e he₂ he₁ + exact absurd (he₂.2.2.symm.trans he₁.2.2) (by decide) + have hsub_three : ({e₀, e₁, e₂} : Set (Set S)) ⊆ S₂ ∪ S₁ := by + rintro e (rfl | rfl | rfl) + · rcases ncard_tilde_of_mem_E J he₀_E with h2 | h1 + · exact Or.inl ⟨he₀_E, hv_inc_e₀, h2⟩ + · exact Or.inr ⟨he₀_E, hv_inc_e₀, h1⟩ + · rcases ncard_tilde_of_mem_E J he₁_E with h2 | h1 + · exact Or.inl ⟨he₁_E, hv_inc_e₁, h2⟩ + · exact Or.inr ⟨he₁_E, hv_inc_e₁, h1⟩ + · rcases ncard_tilde_of_mem_E J he₂_E with h2 | h1 + · exact Or.inl ⟨he₂_E, hv_inc_e₂, h2⟩ + · exact Or.inr ⟨he₂_E, hv_inc_e₂, h1⟩ + have h3_le : 3 ≤ (S₂ ∪ S₁).ncard := by + have hcard3 : ({e₀, e₁, e₂} : Set (Set S)).ncard = 3 := by + rw [ncard_insert_of_notMem, ncard_pair he₁_ne_e₂] + simp [he₀_ne_e₁, he₀_ne_e₂] + rw [← hcard3] + exact ncard_le_ncard hsub_three (hS₂_fin.union hS₁_fin) + rw [ncard_union_eq hdisj_S hS₂_fin hS₁_fin] at h3_le + unfold vertexValency + change S₂.ncard + 2 * S₁.ncard ≥ 3 + omega + +/-! ## 4. Interior vertex valency lower bound and boundary O-arc structure -/ + +/-- Any point `x ∈ bd N.D` with `N.φ x ∉ bd S` lies on `range (N.f i) ∪ range (N.g i)` for some +`i : Fin N.r`. -/ +theorem mem_pasted_of_mem_bd_of_notMem_bd [T2Space S] (N : Net S) + {x : N.D} (hx_bd : x ∈ bd N.D) (hx_not_bdS : N.φ x ∉ bd S) : + x ∈ ⋃ i : Fin N.r, (range (N.f i) ∪ range (N.g i)) := by + by_cases hxV : N.φ x ∈ N.seamV + · have h := N.preimage_seamV_subset_endpoints hxV + simp only [mem_iUnion, mem_insert_iff, mem_singleton_iff] at h + rcases h with ⟨i, rfl | rfl | rfl | rfl⟩ + · exact mem_iUnion.mpr ⟨i, Or.inl ⟨0, rfl⟩⟩ + · exact mem_iUnion.mpr ⟨i, Or.inl ⟨1, rfl⟩⟩ + · exact mem_iUnion.mpr ⟨i, Or.inr ⟨0, rfl⟩⟩ + · exact mem_iUnion.mpr ⟨i, Or.inr ⟨1, rfl⟩⟩ + · obtain ⟨i, w, _, _, hfib, _⟩ := + N.exists_mem_Ioo_of_mem_bd_of_notMem_bd_of_notMem_seamV hx_bd hx_not_bdS hxV + have hx_pair : x ∈ ({N.f i w, N.g i w} : Set N.D) := hfib ▸ rfl + rcases hx_pair with rfl | rfl + · exact mem_iUnion.mpr ⟨i, Or.inl ⟨w, rfl⟩⟩ + · exact mem_iUnion.mpr ⟨i, Or.inr ⟨w, rfl⟩⟩ + +/-- Every point of `bd N.D` lies either on one of the pasted boundary arcs `range (N.f i)`, +`range (N.g i)` (`i : Fin N.r`) or in `bd N.D ∩ N.φ ⁻¹' (bd S)`. -/ +theorem bd_subset_pasted_union_preimage_bd [T2Space S] (N : Net S) : + bd N.D ⊆ (⋃ i : Fin N.r, (range (N.f i) ∪ range (N.g i))) ∪ (bd N.D ∩ N.φ ⁻¹' (bd S)) := by + intro x hx + by_cases hx_bdS : N.φ x ∈ bd S + · exact Or.inr ⟨hx, hx_bdS⟩ + · exact Or.inl (N.mem_pasted_of_mem_bd_of_notMem_bd hx hx_bdS) + +/-- For an injective curve `c : Curve N.D` in `bd N.D`, its open interior `c '' Ioo 0 1` is one of +the two connected components `B₁, B₂` of `bd N.D \ {c 0, c 1}`, and `range c` is the closure +`Bᵢ ∪ {c 0, c 1}` of that component. -/ +theorem curve_image_Ioo_eq_component (N : Net S) {c : Curve N.D} + (hc_inj : Function.Injective c) (hc_bd : range c ⊆ bd N.D) + {B₁ B₂ : Set N.D} + (hcomp : componentsIn (bd N.D \ {c 0, c 1}) = {B₁, B₂}) : + (c '' Ioo (0 : unitInterval) 1 = B₁ ∧ range c = B₁ ∪ {c 0, c 1}) ∨ + (c '' Ioo (0 : unitInterval) 1 = B₂ ∧ range c = B₂ ∪ {c 0, c 1}) := by + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + have hc0_bd : c 0 ∈ bd N.D := hc_bd ⟨0, rfl⟩ + have hc1_bd : c 1 ∈ bd N.D := hc_bd ⟨1, rfl⟩ + have hc01_ne : c 0 ≠ c 1 := fun h => zero_ne_one (hc_inj h) + obtain ⟨B₁', B₂', hcomp', _, _, hline₁', hline₂'⟩ := + oArc_components_diff_pair N.isOArc_bd_D hc0_bd hc1_bd hc01_ne + let t₀ : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht₀ : t₀ ∈ Ioo (0 : unitInterval) 1 := by + constructor <;> rw [← Subtype.coe_lt_coe] <;> norm_num [t₀] + have hIoo_conn : IsPreconnected (c '' Ioo (0 : unitInterval) 1) := + isPreconnected_Ioo.image c c.continuous.continuousOn + have hIoo_sub : c '' Ioo (0 : unitInterval) 1 ⊆ bd N.D \ {c 0, c 1} := by + rintro _ ⟨s, hs, rfl⟩ + refine ⟨hc_bd ⟨s, rfl⟩, ?_⟩ + rintro (h0 | h1) + · exact hs.1.ne (hc_inj h0).symm + · exact hs.2.ne (hc_inj (mem_singleton_iff.mp h1)) + let B := connectedComponentIn (bd N.D \ {c 0, c 1}) (c t₀) + have hB_mem : B ∈ componentsIn (bd N.D \ {c 0, c 1}) := + ⟨c t₀, hIoo_sub ⟨t₀, ht₀, rfl⟩, rfl⟩ + have hB_line : IsLineWithEnds (B ∪ {c 0, c 1}) (c 0) (c 1) := by + have hB_mem' : B ∈ ({B₁', B₂'} : Set (Set N.D)) := hcomp' ▸ hB_mem + rcases hB_mem' with rfl | rfl + · exact hline₁' + · exact hline₂' + have hIoo_sub_B : c '' Ioo (0 : unitInterval) 1 ⊆ B := + hIoo_conn.subset_connectedComponentIn ⟨t₀, ht₀, rfl⟩ hIoo_sub + have hrange_sub : range c ⊆ B ∪ {c 0, c 1} := by + rintro _ ⟨s, rfl⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs + · exact Or.inr (Or.inl rfl) + · exact Or.inr (Or.inr rfl) + · exact Or.inl (hIoo_sub_B ⟨s, hs, rfl⟩) + have hrange_eq : range c = B ∪ {c 0, c 1} := + hB_line.eq_of_subset (isPreconnected_range c.continuous) hrange_sub ⟨0, rfl⟩ ⟨1, rfl⟩ + have hB_sub_Ioo : B ⊆ c '' Ioo (0 : unitInterval) 1 := by + intro y hy + have hy_diff : y ∈ bd N.D \ {c 0, c 1} := connectedComponentIn_subset _ _ hy + have hy_range : y ∈ range c := hrange_eq ▸ Or.inl hy + rcases hy_range with ⟨s, rfl⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs + · exact False.elim (hy_diff.2 (Or.inl rfl)) + · exact False.elim (hy_diff.2 (Or.inr rfl)) + · exact ⟨s, hs, rfl⟩ + have hIoo_eq : c '' Ioo (0 : unitInterval) 1 = B := + Subset.antisymm hIoo_sub_B hB_sub_Ioo + rw [hcomp] at hB_mem + rcases hB_mem with rfl | rfl + · exact Or.inl ⟨hIoo_eq, hrange_eq⟩ + · exact Or.inr ⟨hIoo_eq, hrange_eq⟩ + +/-- If `IsLineWithEnds (B ∪ {s, t}) s t` in a `T2Space`, then `B ∪ {s, t}` is closed and both `s` +and `t` lie in `closure B`. -/ +theorem mem_closure_of_isLineWithEnds {X : Type*} [TopologicalSpace X] [T2Space X] + {B : Set X} {s t : X} (hline : IsLineWithEnds (B ∪ {s, t}) s t) : + IsClosed (B ∪ {s, t}) ∧ s ∈ closure B ∧ t ∈ closure B := + hline.isClosed_union_and_endpoints_mem_closure + +/-- A single injective curve `c₀ : Curve N.D` in `bd N.D` and a closed set `K` missing an endpoint +`x ∈ {c₀ 0, c₀ 1}` cannot together cover `bd N.D`. -/ +theorem not_bd_subset_range_union_closed (N : Net S) {c₀ : Curve N.D} + (hc₀_inj : Function.Injective c₀) (hc₀_bd : range c₀ ⊆ bd N.D) + {K : Set N.D} (hK : IsClosed K) {x : N.D} (hx : x = c₀ 0 ∨ x = c₀ 1) (hxK : x ∉ K) : + ¬ (bd N.D ⊆ range c₀ ∪ K) := by + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + have hc0_bd : c₀ 0 ∈ bd N.D := hc₀_bd ⟨0, rfl⟩ + have hc1_bd : c₀ 1 ∈ bd N.D := hc₀_bd ⟨1, rfl⟩ + have hc01_ne : c₀ 0 ≠ c₀ 1 := fun h => zero_ne_one (hc₀_inj h) + obtain ⟨B₁, B₂, hcomp, hdisj, hunion, hline₁, hline₂⟩ := + oArc_components_diff_pair N.isOArc_bd_D hc0_bd hc1_bd hc01_ne + obtain ⟨_, hc0_cl₁, hc1_cl₁⟩ := mem_closure_of_isLineWithEnds hline₁ + obtain ⟨_, hc0_cl₂, hc1_cl₂⟩ := mem_closure_of_isLineWithEnds hline₂ + intro hcov + rcases N.curve_image_Ioo_eq_component hc₀_inj hc₀_bd hcomp with ⟨_, hr₁⟩ | ⟨_, hr₂⟩ + · have hB₂_sub_K : B₂ ⊆ K := by + intro y hy + have hy_diff : y ∈ bd N.D \ {c₀ 0, c₀ 1} := hunion ▸ Or.inr hy + rcases hcov hy_diff.1 with hy_c | hy_K + · rw [hr₁] at hy_c + rcases hy_c with hy_B₁ | hy_end + · exact False.elim (hdisj.le_bot ⟨hy_B₁, hy⟩) + · exact False.elim (hy_diff.2 hy_end) + · exact hy_K + have hcl_sub : closure B₂ ⊆ K := hK.closure_subset_iff.mpr hB₂_sub_K + rcases hx with rfl | rfl + · exact hxK (hcl_sub hc0_cl₂) + · exact hxK (hcl_sub hc1_cl₂) + · have hB₁_sub_K : B₁ ⊆ K := by + intro y hy + have hy_diff : y ∈ bd N.D \ {c₀ 0, c₀ 1} := hunion ▸ Or.inl hy + rcases hcov hy_diff.1 with hy_c | hy_K + · rw [hr₂] at hy_c + rcases hy_c with hy_B₂ | hy_end + · exact False.elim (hdisj.le_bot ⟨hy, hy_B₂⟩) + · exact False.elim (hy_diff.2 hy_end) + · exact hy_K + have hcl_sub : closure B₁ ⊆ K := hK.closure_subset_iff.mpr hB₁_sub_K + rcases hx with rfl | rfl + · exact hxK (hcl_sub hc0_cl₁) + · exact hxK (hcl_sub hc1_cl₁) + +/-- Two internally disjoint injective curves `c₁, c₂ : Curve N.D` in `bd N.D` with the same +endpoints `c₁ 0 = c₂ 0` and `c₁ 1 = c₂ 1` cover all of `bd N.D`. -/ +theorem range_union_eq_bd_of_same_ends (N : Net S) {c₁ c₂ : Curve N.D} + (hc₁_inj : Function.Injective c₁) (hc₁_bd : range c₁ ⊆ bd N.D) + (hc₂_inj : Function.Injective c₂) (hc₂_bd : range c₂ ⊆ bd N.D) + (h0 : c₁ 0 = c₂ 0) (h1 : c₁ 1 = c₂ 1) + (hdisj_Ioo : Disjoint (c₁ '' Ioo (0 : unitInterval) 1) (c₂ '' Ioo (0 : unitInterval) 1)) : + range c₁ ∪ range c₂ = bd N.D := by + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + have hc0_bd : c₁ 0 ∈ bd N.D := hc₁_bd ⟨0, rfl⟩ + have hc1_bd : c₁ 1 ∈ bd N.D := hc₁_bd ⟨1, rfl⟩ + have hc01_ne : c₁ 0 ≠ c₁ 1 := fun h => zero_ne_one (hc₁_inj h) + obtain ⟨B₁, B₂, hcomp, hdisj, hunion, _, _⟩ := + oArc_components_diff_pair N.isOArc_bd_D hc0_bd hc1_bd hc01_ne + have hcomp₂ : componentsIn (bd N.D \ {c₂ 0, c₂ 1}) = {B₁, B₂} := by + rwa [← h0, ← h1] + let t₀ : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht₀ : t₀ ∈ Ioo (0 : unitInterval) 1 := by + constructor <;> rw [← Subtype.coe_lt_coe] <;> norm_num [t₀] + have h_nonempty : (c₁ '' Ioo (0 : unitInterval) 1).Nonempty := ⟨c₁ t₀, t₀, ht₀, rfl⟩ + rcases N.curve_image_Ioo_eq_component hc₁_inj hc₁_bd hcomp with ⟨hI₁, hr₁⟩ | ⟨hI₁, hr₁⟩ <;> + rcases N.curve_image_Ioo_eq_component hc₂_inj hc₂_bd hcomp₂ with ⟨hI₂, hr₂⟩ | ⟨hI₂, hr₂⟩ + · exfalso + rw [hI₁, hI₂, disjoint_self, bot_eq_empty] at hdisj_Ioo + exact h_nonempty.ne_empty (hI₁.trans hdisj_Ioo) + · apply Subset.antisymm (union_subset hc₁_bd hc₂_bd) + intro x hx + by_cases hx_end : x ∈ ({c₁ 0, c₁ 1} : Set N.D) + · exact Or.inl (hr₁ ▸ Or.inr hx_end) + · rcases hunion ▸ (show x ∈ bd N.D \ {c₁ 0, c₁ 1} from ⟨hx, hx_end⟩) with hx₁ | hx₂ + · exact Or.inl (hr₁ ▸ Or.inl hx₁) + · exact Or.inr (hr₂ ▸ Or.inl hx₂) + · apply Subset.antisymm (union_subset hc₁_bd hc₂_bd) + intro x hx + by_cases hx_end : x ∈ ({c₁ 0, c₁ 1} : Set N.D) + · exact Or.inl (hr₁ ▸ Or.inr hx_end) + · rcases hunion ▸ (show x ∈ bd N.D \ {c₁ 0, c₁ 1} from ⟨hx, hx_end⟩) with hx₁ | hx₂ + · exact Or.inr (hr₂ ▸ Or.inl hx₁) + · exact Or.inl (hr₁ ▸ Or.inl hx₂) + · exfalso + rw [hI₁, hI₂, disjoint_self, bot_eq_empty] at hdisj_Ioo + exact h_nonempty.ne_empty (hI₁.trans hdisj_Ioo) + +/-- If two internally disjoint injective curves `c₁, c₂ : Curve N.D` in `bd N.D` share their start +endpoint `c₁ 0 = c₂ 0 = x` and have distinct end endpoints `c₁ 1 ≠ c₂ 1` (with `c₁ 1 ∉ range c₂` +and `c₂ 1 ∉ range c₁`), then `bd N.D \ {c₁ 1, c₂ 1}` splits into two components `B, B'` where +`B = (c₁ '' Ico 0 1) ∪ (c₂ '' Ico 0 1)` is open in `bd N.D` around `x`, and `B' ∪ {c₁ 1, c₂ 1}` is +a closed `I`-arc in `bd N.D` with ends `c₁ 1, c₂ 1`. -/ +theorem two_curves_common_end_component (N : Net S) {c₁ c₂ : Curve N.D} + (hc₁_inj : Function.Injective c₁) (hc₁_bd : range c₁ ⊆ bd N.D) + (hc₂_inj : Function.Injective c₂) (hc₂_bd : range c₂ ⊆ bd N.D) + (h0 : c₁ 0 = c₂ 0) (h1_ne : c₁ 1 ≠ c₂ 1) + (hc₁1_not : c₁ 1 ∉ range c₂) (hc₂1_not : c₂ 1 ∉ range c₁) : + ∃ B B' : Set N.D, + Disjoint B B' ∧ + bd N.D \ {c₁ 1, c₂ 1} = B ∪ B' ∧ + B = (c₁ '' Ico (0 : unitInterval) 1) ∪ (c₂ '' Ico (0 : unitInterval) 1) ∧ + range c₁ ∪ range c₂ = B ∪ {c₁ 1, c₂ 1} ∧ + bd N.D \ ((c₁ '' Ico (0 : unitInterval) 1) ∪ (c₂ '' Ico (0 : unitInterval) 1)) = + B' ∪ {c₁ 1, c₂ 1} ∧ + IsClosed (B' ∪ {c₁ 1, c₂ 1}) ∧ + IsLineWithEnds (B' ∪ {c₁ 1, c₂ 1}) (c₁ 1) (c₂ 1) := by + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + have hc₁1_bd : c₁ 1 ∈ bd N.D := hc₁_bd ⟨1, rfl⟩ + have hc₂1_bd : c₂ 1 ∈ bd N.D := hc₂_bd ⟨1, rfl⟩ + obtain ⟨B₁, B₂, hcomp, hdisj, hunion, hline₁, hline₂⟩ := + oArc_components_diff_pair N.isOArc_bd_D hc₁1_bd hc₂1_bd h1_ne + have hIco₁_sub : c₁ '' Ico (0 : unitInterval) 1 ⊆ bd N.D \ {c₁ 1, c₂ 1} := by + rintro _ ⟨s, hs, rfl⟩ + refine ⟨hc₁_bd ⟨s, rfl⟩, ?_⟩ + rintro (h1 | h2) + · exact hs.2.ne (hc₁_inj h1) + · exact hc₂1_not ⟨s, mem_singleton_iff.mp h2⟩ + have hIco₂_sub : c₂ '' Ico (0 : unitInterval) 1 ⊆ bd N.D \ {c₁ 1, c₂ 1} := by + rintro _ ⟨s, hs, rfl⟩ + refine ⟨hc₂_bd ⟨s, rfl⟩, ?_⟩ + rintro (h1 | h2) + · exact hc₁1_not ⟨s, h1⟩ + · exact hs.2.ne (hc₂_inj (mem_singleton_iff.mp h2)) + have h0_Ico : (0 : unitInterval) ∈ Ico (0 : unitInterval) 1 := + ⟨le_rfl, Subtype.coe_lt_coe.mp zero_lt_one⟩ + have hx_diff : c₁ 0 ∈ bd N.D \ {c₁ 1, c₂ 1} := hIco₁_sub ⟨0, h0_Ico, rfl⟩ + let B := connectedComponentIn (bd N.D \ {c₁ 1, c₂ 1}) (c₁ 0) + have hB_mem : B ∈ ({B₁, B₂} : Set (Set N.D)) := hcomp ▸ ⟨c₁ 0, hx_diff, rfl⟩ + have hIco₁_B : c₁ '' Ico (0 : unitInterval) 1 ⊆ B := + (isPreconnected_Ico.image c₁ c₁.continuous.continuousOn).subset_connectedComponentIn + ⟨0, h0_Ico, rfl⟩ hIco₁_sub + have hIco₂_B : c₂ '' Ico (0 : unitInterval) 1 ⊆ B := + (isPreconnected_Ico.image c₂ c₂.continuous.continuousOn).subset_connectedComponentIn + (h0 ▸ ⟨0, h0_Ico, rfl⟩) hIco₂_sub + have hrange_conn : IsPreconnected (range c₁ ∪ range c₂) := + (isPreconnected_range c₁.continuous).union' ⟨c₁ 0, ⟨0, rfl⟩, h0 ▸ ⟨0, rfl⟩⟩ + (isPreconnected_range c₂.continuous) + have hrange_sub : range c₁ ∪ range c₂ ⊆ B ∪ {c₁ 1, c₂ 1} := by + rintro y (⟨s, rfl⟩ | ⟨s, rfl⟩) + · rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs + · exact Or.inl (hIco₁_B ⟨0, h0_Ico, rfl⟩) + · exact Or.inr (Or.inl rfl) + · exact Or.inl (hIco₁_B ⟨s, ⟨hs.1.le, hs.2⟩, rfl⟩) + · rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs + · exact Or.inl (hIco₂_B ⟨0, h0_Ico, rfl⟩) + · exact Or.inr (Or.inr rfl) + · exact Or.inl (hIco₂_B ⟨s, ⟨hs.1.le, hs.2⟩, rfl⟩) + have hhelper : ∀ {Ba Bb : Set N.D}, + Disjoint Ba Bb → bd N.D \ {c₁ 1, c₂ 1} = Ba ∪ Bb → B = Ba → + IsLineWithEnds (Ba ∪ {c₁ 1, c₂ 1}) (c₁ 1) (c₂ 1) → + IsLineWithEnds (Bb ∪ {c₁ 1, c₂ 1}) (c₁ 1) (c₂ 1) → + Disjoint Ba Bb ∧ + bd N.D \ {c₁ 1, c₂ 1} = Ba ∪ Bb ∧ + Ba = (c₁ '' Ico (0 : unitInterval) 1) ∪ (c₂ '' Ico (0 : unitInterval) 1) ∧ + range c₁ ∪ range c₂ = Ba ∪ {c₁ 1, c₂ 1} ∧ + bd N.D \ ((c₁ '' Ico (0 : unitInterval) 1) ∪ (c₂ '' Ico (0 : unitInterval) 1)) = + Bb ∪ {c₁ 1, c₂ 1} ∧ + IsClosed (Bb ∪ {c₁ 1, c₂ 1}) ∧ + IsLineWithEnds (Bb ∪ {c₁ 1, c₂ 1}) (c₁ 1) (c₂ 1) := by + intro Ba Bb hd hu hBa hline_a hline_b + subst hBa + have hrange_eq : range c₁ ∪ range c₂ = B ∪ {c₁ 1, c₂ 1} := + hline_a.eq_of_subset hrange_conn hrange_sub (Or.inl ⟨1, rfl⟩) (Or.inr ⟨1, rfl⟩) + have hB_eq : B = (c₁ '' Ico (0 : unitInterval) 1) ∪ (c₂ '' Ico (0 : unitInterval) 1) := by + apply Subset.antisymm + · intro y hyB + have hy_diff : y ∈ bd N.D \ {c₁ 1, c₂ 1} := connectedComponentIn_subset _ _ hyB + have hy_r : y ∈ range c₁ ∪ range c₂ := hrange_eq ▸ Or.inl hyB + rcases hy_r with ⟨s, rfl⟩ | ⟨s, rfl⟩ + · rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs + · exact Or.inl ⟨0, h0_Ico, rfl⟩ + · exact False.elim (hy_diff.2 (Or.inl rfl)) + · exact Or.inl ⟨s, ⟨hs.1.le, hs.2⟩, rfl⟩ + · rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs + · exact Or.inr ⟨0, h0_Ico, rfl⟩ + · exact False.elim (hy_diff.2 (Or.inr rfl)) + · exact Or.inr ⟨s, ⟨hs.1.le, hs.2⟩, rfl⟩ + · exact union_subset hIco₁_B hIco₂_B + have hdiff_eq : bd N.D \ ((c₁ '' Ico (0 : unitInterval) 1) ∪ (c₂ '' Ico (0 : unitInterval) 1)) = + Bb ∪ {c₁ 1, c₂ 1} := by + rw [← hB_eq] + ext y + constructor + · rintro ⟨hy_bd, hy_not_B⟩ + by_cases hy_end : y ∈ ({c₁ 1, c₂ 1} : Set N.D) + · exact Or.inr hy_end + · have hy_u : y ∈ B ∪ Bb := hu ▸ ⟨hy_bd, hy_end⟩ + exact Or.inl (hy_u.resolve_left hy_not_B) + · rintro (hy_Bb | hy_end) + · have hy_diff : y ∈ bd N.D \ {c₁ 1, c₂ 1} := hu ▸ Or.inr hy_Bb + exact ⟨hy_diff.1, fun hyB => hd.le_bot ⟨hyB, hy_Bb⟩⟩ + · refine ⟨?_, fun hyB => (connectedComponentIn_subset _ _ hyB).2 hy_end⟩ + rcases hy_end with rfl | h2 + · exact hc₁1_bd + · exact (mem_singleton_iff.mp h2) ▸ hc₂1_bd + exact ⟨hd, hu, hB_eq, hrange_eq, hdiff_eq, (mem_closure_of_isLineWithEnds hline_b).1, hline_b⟩ + rcases hB_mem with hB1 | hB2 + · exact ⟨B₁, B₂, hhelper hdisj hunion hB1 hline₁ hline₂⟩ + · have hB2' : B = B₂ := mem_singleton_iff.mp hB2 + exact ⟨B₂, B₁, hhelper hdisj.symm (union_comm B₁ B₂ ▸ hunion) hB2' hline₂ hline₁⟩ + +/-- Three pairwise internally disjoint injective curves `c₁, c₂, c₃ : Curve N.D` in `bd N.D` cannot +share a common start endpoint `c₁ 0 = c₂ 0 = c₃ 0`. -/ +theorem not_three_curves_common_end (N : Net S) {c₁ c₂ c₃ : Curve N.D} + (hc₁_inj : Function.Injective c₁) (hc₁_bd : range c₁ ⊆ bd N.D) + (hc₂_inj : Function.Injective c₂) (hc₂_bd : range c₂ ⊆ bd N.D) + (hc₃_bd : range c₃ ⊆ bd N.D) + (h0_12 : c₁ 0 = c₂ 0) (h0_13 : c₁ 0 = c₃ 0) + (hdisj_12 : ∀ t ∈ Ioo (0 : unitInterval) 1, c₁ t ∉ range c₂) + (hdisj_21 : ∀ t ∈ Ioo (0 : unitInterval) 1, c₂ t ∉ range c₁) + (hdisj_31 : ∀ t ∈ Ioo (0 : unitInterval) 1, c₃ t ∉ range c₁) + (hdisj_32 : ∀ t ∈ Ioo (0 : unitInterval) 1, c₃ t ∉ range c₂) : + False := by + let t₀ : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht₀ : t₀ ∈ Ioo (0 : unitInterval) 1 := by + constructor <;> rw [← Subtype.coe_lt_coe] <;> norm_num [t₀] + have hd_Ioo_12 : Disjoint (c₁ '' Ioo (0 : unitInterval) 1) (c₂ '' Ioo (0 : unitInterval) 1) := by + rw [disjoint_left] + rintro _ ⟨t, ht, rfl⟩ ⟨s, _, hs⟩ + exact hdisj_12 t ht ⟨s, hs⟩ + by_cases h1 : c₁ 1 = c₂ 1 + · have hcov := N.range_union_eq_bd_of_same_ends hc₁_inj hc₁_bd hc₂_inj hc₂_bd h0_12 h1 hd_Ioo_12 + have hc₃_bd_t₀ : c₃ t₀ ∈ range c₁ ∪ range c₂ := hcov ▸ hc₃_bd ⟨t₀, rfl⟩ + rcases hc₃_bd_t₀ with h1_mem | h2_mem + · exact hdisj_31 t₀ ht₀ h1_mem + · exact hdisj_32 t₀ ht₀ h2_mem + · have hc₁1_not : c₁ 1 ∉ range c₂ := by + rintro ⟨s, hs⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs_Ioo + · exact zero_ne_one (hc₁_inj (h0_12.trans hs)) + · exact h1 hs.symm + · exact hdisj_21 s hs_Ioo ⟨1, hs.symm⟩ + have hc₂1_not : c₂ 1 ∉ range c₁ := by + rintro ⟨s, hs⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs_Ioo + · exact zero_ne_one (hc₂_inj (h0_12.symm.trans hs)) + · exact h1 hs + · exact hdisj_12 s hs_Ioo ⟨1, hs.symm⟩ + obtain ⟨B, B', hdisj, _, hB_eq, _, hdiff_eq, hcl_B', _⟩ := + N.two_curves_common_end_component hc₁_inj hc₁_bd hc₂_inj hc₂_bd h0_12 h1 hc₁1_not hc₂1_not + have hIoo₃_sub : c₃ '' Ioo (0 : unitInterval) 1 ⊆ B' ∪ {c₁ 1, c₂ 1} := by + rw [← hdiff_eq] + rintro _ ⟨t, ht, rfl⟩ + refine ⟨hc₃_bd ⟨t, rfl⟩, ?_⟩ + rintro (⟨s, _, hs⟩ | ⟨s, _, hs⟩) + · exact hdisj_31 t ht ⟨s, hs⟩ + · exact hdisj_32 t ht ⟨s, hs⟩ + have hcl_Ioo : (0 : unitInterval) ∈ closure (Ioo (0 : unitInterval) 1) := by + rw [closure_Ioo zero_ne_one] + exact left_mem_Icc.mpr (Subtype.coe_le_coe.mp zero_le_one) + have hc₃0_cl : c₃ 0 ∈ closure (c₃ '' Ioo (0 : unitInterval) 1) := + image_closure_subset_closure_image c₃.continuous ⟨0, hcl_Ioo, rfl⟩ + have hc₃0_B' : c₁ 0 ∈ B' ∪ {c₁ 1, c₂ 1} := + h0_13.symm ▸ hcl_B'.closure_subset_iff.mpr hIoo₃_sub hc₃0_cl + have hc₁0_B : c₁ 0 ∈ B := by + rw [hB_eq] + exact Or.inl ⟨0, ⟨le_rfl, Subtype.coe_lt_coe.mp zero_lt_one⟩, rfl⟩ + rcases hc₃0_B' with hB' | (h1_eq | h2_eq) + · exact hdisj.le_bot ⟨hc₁0_B, hB'⟩ + · exact zero_ne_one (hc₁_inj h1_eq) + · exact hc₂1_not ⟨0, mem_singleton_iff.mp h2_eq⟩ + +/-- The set of indices `i : Fin N.r` such that `N.interiorSeamEdge i` has `v` as one of two distinct +endpoints +(`(N.φ (N.f i 0) = v ∧ N.φ (N.f i 1) ≠ v) ∨ (N.φ (N.f i 0) ≠ v ∧ N.φ (N.f i 1) = v)`). -/ +noncomputable def F₁ (N : Net S) (v : S) : Finset (Fin N.r) := by + classical + exact Finset.univ.filter fun i => + (N.φ (N.f i 0) = v ∧ N.φ (N.f i 1) ≠ v) ∨ (N.φ (N.f i 0) ≠ v ∧ N.φ (N.f i 1) = v) + +/-- The set of indices `i : Fin N.r` such that `N.interiorSeamEdge i` is a loop at `v` +(`N.φ (N.f i 0) = v ∧ N.φ (N.f i 1) = v`). -/ +noncomputable def F₂ (N : Net S) (v : S) : Finset (Fin N.r) := by + classical + exact Finset.univ.filter fun i => N.φ (N.f i 0) = v ∧ N.φ (N.f i 1) = v + +theorem mem_F₁_iff (N : Net S) (v : S) (i : Fin N.r) : + i ∈ N.F₁ v ↔ + (N.φ (N.f i 0) = v ∧ N.φ (N.f i 1) ≠ v) ∨ (N.φ (N.f i 0) ≠ v ∧ N.φ (N.f i 1) = v) := by + classical + simp [F₁] + +theorem mem_F₂_iff (N : Net S) (v : S) (i : Fin N.r) : + i ∈ N.F₂ v ↔ N.φ (N.f i 0) = v ∧ N.φ (N.f i 1) = v := by + classical + simp [F₂] + +theorem notMem_F₁_and_notMem_F₂_iff (N : Net S) (v : S) (i : Fin N.r) : + (i ∉ N.F₁ v ∧ i ∉ N.F₂ v) ↔ N.φ (N.f i 0) ≠ v ∧ N.φ (N.f i 1) ≠ v := by + rw [mem_F₁_iff, mem_F₂_iff] + by_cases h0 : N.φ (N.f i 0) = v <;> by_cases h1 : N.φ (N.f i 1) = v <;> simp [h0, h1] + +/-- For every vertex `v ∈ J.V` of a seam graph `J` for `N`, the interior seam edges alone contribute +at least `(N.F₁ v).card + 2 * (N.F₂ v).card` to `vertexValency J v`. -/ +theorem card_F₁_add_two_mul_card_F₂_le_vertexValency [T2Space S] (N : Net S) {J : Drawing S} + (hJ : N.IsSeamGraphFor J) (v : S) : + (N.F₁ v).card + 2 * (N.F₂ v).card ≤ vertexValency J v := by + let S₂ := {e ∈ J.E | J.VertexIncident v e ∧ (tilde e).ncard = 2} + let S₁ := {e ∈ J.E | J.VertexIncident v e ∧ (tilde e).ncard = 1} + have hS₂_fin : S₂.Finite := J.finite_edges.subset fun e he => he.1 + have hS₁_fin : S₁.Finite := J.finite_edges.subset fun e he => he.1 + have h1 : (N.F₁ v).card ≤ S₂.ncard := by + have hsub : N.interiorSeamEdge '' (N.F₁ v : Set (Fin N.r)) ⊆ S₂ := by + rintro _ ⟨i, hi, rfl⟩ + rw [ Finset.mem_coe, mem_F₁_iff ] at hi + have heE : N.interiorSeamEdge i ∈ J.E := N.e_int_mem_E hJ i + have htilde : tilde (N.interiorSeamEdge i) = {N.φ (N.f i 0), N.φ (N.f i 1)} + := N.tilde_e_int hJ i + rcases hi with ⟨h0, hne⟩ | ⟨hne, h1⟩ + · have hvV : v ∈ J.V := hJ.2.2 ▸ ⟨i, Or.inl h0⟩ + have hv_tilde : v ∈ tilde (N.interiorSeamEdge i) := htilde ▸ Or.inl h0.symm + refine ⟨heE, (vertexIncident_iff_mem_tilde J hvV heE).mpr hv_tilde, ?_⟩ + rw [htilde, h0, ncard_pair hne.symm] + · have hvV : v ∈ J.V := hJ.2.2 ▸ ⟨i, Or.inr h1⟩ + have hv_tilde : v ∈ tilde (N.interiorSeamEdge i) := htilde ▸ Or.inr h1.symm + refine ⟨heE, (vertexIncident_iff_mem_tilde J hvV heE).mpr hv_tilde, ?_⟩ + rw [htilde, h1, ncard_pair hne] + have hle := ncard_le_ncard hsub hS₂_fin + rwa [ncard_image_of_injective _ N.e_int_injective, ncard_coe_finset] at hle + have h2 : (N.F₂ v).card ≤ S₁.ncard := by + have hsub : N.interiorSeamEdge '' (N.F₂ v : Set (Fin N.r)) ⊆ S₁ := by + rintro _ ⟨i, hi, rfl⟩ + rw [ Finset.mem_coe, mem_F₂_iff ] at hi + rcases hi with ⟨h0, h1⟩ + have heE : N.interiorSeamEdge i ∈ J.E := N.e_int_mem_E hJ i + have htilde : tilde (N.interiorSeamEdge i) = {v} := by + rw [N.tilde_e_int hJ i, h0, h1, pair_eq_singleton] + have hvV : v ∈ J.V := hJ.2.2 ▸ ⟨i, Or.inl h0⟩ + have hv_tilde : v ∈ tilde (N.interiorSeamEdge i) := htilde ▸ rfl + refine ⟨heE, (vertexIncident_iff_mem_tilde J hvV heE).mpr hv_tilde, ?_⟩ + rw [htilde, ncard_singleton] + have hle := ncard_le_ncard hsub hS₁_fin + rwa [ncard_image_of_injective _ N.e_int_injective, ncard_coe_finset] at hle + unfold vertexValency + change (N.F₁ v).card + 2 * (N.F₂ v).card ≤ S₂.ncard + 2 * S₁.ncard + omega + +/-- On a surface `S` not homeomorphic to `Σ(0, 0, 0)`, `Σ(0, 1, 0)`, or `Σ(0, 0, 1)`, no seam pair +`i₀ : Fin N.r` can have both endpoint images outside `bd S` and `range (N.f i₀) ∪ range (N.g i₀)` +disjoint from `range (N.f j) ∪ range (N.g j)` for all `j ≠ i₀` (otherwise connectedness of `bd N.D` +forces `N.r = 1` and `bd S = ∅`, contradicting Euler's formula (2.2)). -/ +theorem not_isolated_pair_of_not_sphere_proj_disc (hS : IsSurface S) + (h000 : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 0)) + (h010 : ¬ Nonempty (S ≃ₜ SurfaceModel 0 1 0)) + (h001 : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 1)) + (N : Net S) {J : Drawing S} (hJ : N.IsSeamGraphFor J) (i₀ : Fin N.r) + (hf0_not_bd : N.φ (N.f i₀ 0) ∉ bd S) + (hf1_not_bd : N.φ (N.f i₀ 1) ∉ bd S) + (hdisj_other : ∀ j : Fin N.r, j ≠ i₀ → + Disjoint (range (N.f i₀) ∪ range (N.g i₀)) (range (N.f j) ∪ range (N.g j))) : + False := by + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + let K₀ : Set N.D := range (N.f i₀) ∪ range (N.g i₀) + let K₁ : Set N.D := + (⋃ j ∈ ({i₀}ᶜ : Set (Fin N.r)), (range (N.f j) ∪ range (N.g j))) ∪ (bd N.D ∩ N.φ ⁻¹' (bd S)) + have hK₀_not_bdS : ∀ x ∈ K₀, N.φ x ∉ bd S := by + rintro x (⟨t, rfl⟩ | ⟨t, rfl⟩) + · rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact hf0_not_bd + · exact hf1_not_bd + · intro hbd + have hmem_e : N.φ (N.f i₀ t) ∈ N.interiorSeamEdge i₀ := ⟨t, ht, rfl⟩ + exact (N.disjoint_e_int_bd hS i₀).le_bot ⟨hmem_e, hbd⟩ + · rw [← N.pasting_eq i₀ t] + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact hf0_not_bd + · exact hf1_not_bd + · intro hbd + have hmem_e : N.φ (N.f i₀ t) ∈ N.interiorSeamEdge i₀ := ⟨t, ht, rfl⟩ + exact (N.disjoint_e_int_bd hS i₀).le_bot ⟨hmem_e, hbd⟩ + have hK₀_closed : IsClosed K₀ := + (isCompact_range (N.f i₀).continuous).isClosed.union + (isCompact_range (N.g i₀).continuous).isClosed + have hK₁_closed : IsClosed K₁ := by + refine ((toFinite ({i₀}ᶜ : Set (Fin N.r))).isClosed_biUnion fun j _ => ?_).union ?_ + · exact (isCompact_range (N.f j).continuous).isClosed.union + (isCompact_range (N.g j).continuous).isClosed + · exact (isClosed_bd N.D).inter ((isClosed_bd S).preimage N.quotientMap_φ.continuous) + have hcov : bd N.D ⊆ K₀ ∪ K₁ := by + intro x hx + rcases N.bd_subset_pasted_union_preimage_bd hx with hx_pasted | hx_bdS + · rw [mem_iUnion] at hx_pasted + rcases hx_pasted with ⟨j, hj⟩ + by_cases hij : j = i₀ + · subst hij + exact Or.inl hj + · exact Or.inr (Or.inl (mem_biUnion hij hj)) + · exact Or.inr (Or.inr hx_bdS) + have hdisj_K : Disjoint K₀ K₁ := by + rw [disjoint_left] + intro x hx₀ hx₁ + rcases hx₁ with hx_other | hx_bdS + · rw [mem_iUnion₂] at hx_other + rcases hx_other with ⟨j, hj, hx_j⟩ + exact (hdisj_other j hj).le_bot ⟨hx₀, hx_j⟩ + · exact hK₀_not_bdS x hx₀ hx_bdS.2 + have hK₁_empty : bd N.D ∩ K₁ = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro y ⟨hy_bd, hy₁⟩ + obtain ⟨z, _, hz₀, hz₁⟩ := isPreconnected_closed_iff.mp + N.isOArc_bd_D.isPreconnected K₀ K₁ hK₀_closed hK₁_closed hcov + ⟨N.f i₀ 0, N.range_f_subset_bd i₀ ⟨0, rfl⟩, Or.inl ⟨0, rfl⟩⟩ + ⟨y, hy_bd, hy₁⟩ + exact hdisj_K.le_bot ⟨hz₀, hz₁⟩ + have hall_eq_i₀ : ∀ j : Fin N.r, j = i₀ := by + intro j + by_contra hij + have hmem : N.f j 0 ∈ bd N.D ∩ K₁ := + ⟨N.range_f_subset_bd j ⟨0, rfl⟩, Or.inl (mem_biUnion hij (Or.inl ⟨0, rfl⟩))⟩ + rw [hK₁_empty] at hmem + exact hmem + have hbdS_empty : bd S = ∅ := by + rw [eq_empty_iff_forall_notMem] + intro z hz + obtain ⟨x, hx_bd, rfl⟩ := N.bd_subset_seamU hz + have hmem : x ∈ bd N.D ∩ K₁ := ⟨hx_bd, Or.inr ⟨hx_bd, hz⟩⟩ + rw [hK₁_empty] at hmem + exact hmem + have hE_eq : J.E = {N.interiorSeamEdge i₀} := by + rw [(N.seamGraph_edges_eq hS hJ).1] + ext e + simp only [mem_union, mem_range, mem_singleton_iff] + constructor + · rintro (⟨j, rfl⟩ | he_bd) + · rw [hall_eq_i₀ j] + · exfalso + obtain ⟨⟨z, hze⟩, hsub, _⟩ := he_bd + have hz_bdS : z ∈ bd S := (hsub hze).1 + rw [hbdS_empty] at hz_bdS + exact hz_bdS + · rintro rfl + exact Or.inl ⟨i₀, rfl⟩ + have hE_ncard : J.E.ncard = 1 := by + rw [hE_eq, ncard_singleton] + have hV_eq : J.V = {N.φ (N.f i₀ 0), N.φ (N.f i₀ 1)} := by + rw [hJ.2.2] + ext z + simp only [seamV, mem_ofPred_eq, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨j, hj⟩ + rw [hall_eq_i₀ j] at hj + exact hj.imp Eq.symm Eq.symm + · rintro (rfl | rfl) + · exact ⟨i₀, Or.inl rfl⟩ + · exact ⟨i₀, Or.inr rfl⟩ + have hV_pos : 1 ≤ J.V.ncard := by + rw [hV_eq] + by_cases heq : N.φ (N.f i₀ 0) = N.φ (N.f i₀ 1) + · rw [heq, pair_eq_singleton, ncard_singleton] + · rw [ncard_pair heq]; omega + have hconn_univ_D : ConnectedSpace (univ : Set N.D) := + Subtype.connectedSpace N.isClosedDisc_D.isPathConnected.isConnected + have hconn_D : ConnectedSpace N.D := + (Homeomorph.Set.univ N.D).surjective.connectedSpace (Homeomorph.Set.univ N.D).continuous + have hconn_S : ConnectedSpace S := + N.quotientMap_φ.surjective.connectedSpace N.quotientMap_φ.continuous + obtain ⟨a, b, c, he⟩ := classification S hS hconn_S + have heuler := seamGraph_euler_formula S hS a b c he J ⟨N, hJ⟩ + rw [hE_ncard] at heuler + have habc_le : 2 * a + b + c ≤ 1 := by omega + rcases ( by omega : (a = 0 ∧ b = 0 ∧ c = 0) ∨ (a = 0 ∧ b = 1 ∧ c = 0) ∨ (a = 0 ∧ b = 0 ∧ c + = 1) ) with + ⟨rfl, rfl, rfl⟩ | ⟨rfl, rfl, rfl⟩ | ⟨rfl, rfl, rfl⟩ + · exact h000 he + · exact h010 he + · exact h001 he + +/-! ## 5. Excluding Case 1 (`F₂.card = 1, F₁.card = 0`) and Case 3 (`F₂.card = 0, F₁.card = 2`) -/ + +/-- If `v ∈ N.seamV` and `N.φ (N.f j 0) ≠ v` and `N.φ (N.f j 1) ≠ v`, then no point of +`range (N.f j) ∪ range (N.g j)` maps to `v` under `N.φ`. -/ +theorem not_φ_eq_of_mem_range_fg (N : Net S) {v : S} (hv : v ∈ N.seamV) {j : Fin N.r} + (hf0 : N.φ (N.f j 0) ≠ v) (hf1 : N.φ (N.f j 1) ≠ v) + {x : N.D} (hx : x ∈ range (N.f j) ∪ range (N.g j)) : + N.φ x ≠ v := by + intro hφ + have hφ_f : ∃ t : unitInterval, N.φ (N.f j t) = v := by + rcases hx with ⟨t, rfl⟩ | ⟨t, rfl⟩ + · exact ⟨t, hφ⟩ + · exact ⟨t, (N.pasting_eq j t).trans hφ⟩ + rcases hφ_f with ⟨t, ht_eq⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact hf0 ht_eq + · exact hf1 ht_eq + · exact N.notMem_seamV_of_mem_Ioo j ht (ht_eq.symm ▸ hv) + +/-- Excluding Subcase B2a (`(N.F₂ v).card = 1` and `(N.F₁ v).card = 0`): a single loop seam edge at +an interior vertex `v ∉ bd S` with no other seam edges incident with `v` is impossible on a surface +not homeomorphic to `Σ(0, 0, 0)`, `Σ(0, 1, 0)`, or `Σ(0, 0, 1)`. -/ +theorem not_loop_only_at_interior_vertex (hS : IsSurface S) + (h000 : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 0)) + (h010 : ¬ Nonempty (S ≃ₜ SurfaceModel 0 1 0)) + (h001 : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 1)) + (N : Net S) {J : Drawing S} (hJ : N.IsSeamGraphFor J) + {v : S} (hv_not_bd : v ∉ bd S) (i₀ : Fin N.r) + (hi₀_0 : N.φ (N.f i₀ 0) = v) (hi₀_1 : N.φ (N.f i₀ 1) = v) + (hother : ∀ j : Fin N.r, j ≠ i₀ → N.φ (N.f j 0) ≠ v ∧ N.φ (N.f j 1) ≠ v) : + False := by + have hv_seamV : v ∈ N.seamV := ⟨i₀, Or.inl hi₀_0⟩ + refine N.not_isolated_pair_of_not_sphere_proj_disc hS h000 h010 h001 hJ i₀ + (hi₀_0.symm ▸ hv_not_bd) (hi₀_1.symm ▸ hv_not_bd) fun j hj => ?_ + rw [disjoint_left] + intro x hx₀ hxj + have hnot_v : N.φ x ≠ v := + N.not_φ_eq_of_mem_range_fg hv_seamV (hother j hj).1 (hother j hj).2 hxj + rcases hx₀ with ⟨t, rfl⟩ | ⟨t, rfl⟩ + · rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact hnot_v hi₀_0 + · exact hnot_v hi₀_1 + · rcases hxj with hf_j | hg_j + · exact N.internally_disjoint_ff i₀ j hj.symm t ht hf_j + · exact N.internally_disjoint_fg i₀ j t ht hg_j + · rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact hnot_v ((N.pasting_eq i₀ 0).symm.trans hi₀_0) + · exact hnot_v ((N.pasting_eq i₀ 1).symm.trans hi₀_1) + · rcases hxj with hf_j | hg_j + · exact N.internally_disjoint_gf i₀ j t ht hf_j + · exact N.internally_disjoint_gg i₀ j hj.symm t ht hg_j + +/-- Concatenate two curves `c₁, c₂ : Curve D` with `c₁ 1 = c₂ 0` via `Path.trans`. -/ +noncomputable def concatCurve {D : Type u} [TopologicalSpace D] (c₁ c₂ : Curve D) (h12 : c₁ 1 + = c₂ 0) : + Curve D := + ((⟨c₁, rfl, rfl⟩ : Path (c₁ 0) (c₁ 1)).trans ⟨c₂, h12.symm, rfl⟩).toContinuousMap + +@[simp] +theorem concatCurve_zero {D : Type u} [TopologicalSpace D] (c₁ c₂ : Curve D) (h12 : c₁ 1 = c₂ 0) : + concatCurve c₁ c₂ h12 0 = c₁ 0 := + ((⟨c₁, rfl, rfl⟩ : Path (c₁ 0) (c₁ 1)).trans ⟨c₂, h12.symm, rfl⟩).source + +@[simp] +theorem concatCurve_one {D : Type u} [TopologicalSpace D] (c₁ c₂ : Curve D) (h12 : c₁ 1 = c₂ 0) : + concatCurve c₁ c₂ h12 1 = c₂ 1 := + ((⟨c₁, rfl, rfl⟩ : Path (c₁ 0) (c₁ 1)).trans ⟨c₂, h12.symm, rfl⟩).target + +@[simp] +theorem range_concatCurve {D : Type u} [TopologicalSpace D] (c₁ c₂ : Curve D) (h12 : c₁ 1 = c₂ 0) : + range (concatCurve c₁ c₂ h12) = range c₁ ∪ range c₂ := + Path.trans_range (⟨c₁, rfl, rfl⟩ : Path (c₁ 0) (c₁ 1)) ⟨c₂, h12.symm, rfl⟩ + +theorem concatCurve_apply {D : Type u} [TopologicalSpace D] (c₁ c₂ : Curve D) (h12 : c₁ 1 = c₂ 0) + (t : unitInterval) : + concatCurve c₁ c₂ h12 t = + if h : (t : ℝ) ≤ 1 / 2 then + c₁ ⟨2 * (t : ℝ), ⟨by linarith [t.2.1], by linarith⟩⟩ + else + c₂ ⟨2 * (t : ℝ) - 1, ⟨by linarith, by linarith [t.2.2]⟩⟩ := + Path.trans_apply (⟨c₁, rfl, rfl⟩ : Path (c₁ 0) (c₁ 1)) ⟨c₂, h12.symm, rfl⟩ t + +theorem injective_concatCurve {D : Type u} [TopologicalSpace D] {c₁ c₂ : Curve D} + (h12 : c₁ 1 = c₂ 0) (hc₁ : Function.Injective c₁) (hc₂ : Function.Injective c₂) + (h01_ne : c₁ 0 ≠ c₂ 1) + (hdisj₁₂ : ∀ t ∈ Ioo (0 : unitInterval) 1, c₁ t ∉ range c₂) + (hdisj₂₁ : ∀ t ∈ Ioo (0 : unitInterval) 1, c₂ t ∉ range c₁) : + Function.Injective (concatCurve c₁ c₂ h12) := by + have hcross : ∀ (t₁ t₂ : unitInterval) (ht₁ : (t₁ : ℝ) ≤ 1 / 2) (ht₂ : ¬ (t₂ : ℝ) ≤ 1 / 2), + c₁ ⟨2 * (t₁ : ℝ), ⟨by linarith [t₁.2.1], by linarith⟩⟩ = + c₂ ⟨2 * (t₂ : ℝ) - 1, ⟨by linarith, by linarith [t₂.2.2]⟩⟩ → + t₁ = t₂ := by + intro t₁ t₂ ht₁ ht₂ heq + let u₁ : unitInterval := ⟨2 * (t₁ : ℝ), ⟨by linarith [t₁.2.1], by linarith⟩⟩ + let u₂ : unitInterval := ⟨2 * (t₂ : ℝ) - 1, ⟨by linarith, by linarith [t₂.2.2]⟩⟩ + change c₁ u₁ = c₂ u₂ at heq + have hu₂_pos : (0 : unitInterval) < u₂ := by + rw [← Subtype.coe_lt_coe] + change (0 : ℝ) < 2 * (t₂ : ℝ) - 1 + linarith + rcases unitInterval_eq_zero_or_one_or_mem_Ioo u₂ with hu₂0 | hu₂1 | hu₂_Ioo + · exact False.elim (hu₂_pos.ne' hu₂0) + · rcases unitInterval_eq_zero_or_one_or_mem_Ioo u₁ with hu₁0 | hu₁1 | hu₁_Ioo + · exfalso + have h : c₁ 0 = c₂ 1 := by simpa [hu₁0, hu₂1] using heq + exact h01_ne h + · exfalso + have h : c₂ 0 = c₂ 1 := by + rw [← h12] + simpa [hu₁1, hu₂1] using heq + exact zero_ne_one (hc₂ h) + · exact False.elim (hdisj₁₂ u₁ hu₁_Ioo ⟨u₂, heq.symm⟩) + · exact False.elim (hdisj₂₁ u₂ hu₂_Ioo ⟨u₁, heq⟩) + intro t₁ t₂ h + rw [concatCurve_apply, concatCurve_apply] at h + split_ifs at h with ht₁ ht₂ ht₂ + · have hu := hc₁ h + have hreal : 2 * (t₁ : ℝ) = 2 * (t₂ : ℝ) := congr_arg Subtype.val hu + exact Subtype.ext (by linarith) + · exact hcross t₁ t₂ ht₁ ht₂ h + · exact (hcross t₂ t₁ ht₂ ht₁ h.symm).symm + · have hu := hc₂ h + have hreal : 2 * (t₁ : ℝ) - 1 = 2 * (t₂ : ℝ) - 1 := congr_arg Subtype.val hu + exact Subtype.ext (by linarith) + +theorem mem_Ioo_concatCurve {D : Type u} [TopologicalSpace D] {c₁ c₂ : Curve D} + (h12 : c₁ 1 = c₂ 0) {t : unitInterval} (ht : t ∈ Ioo (0 : unitInterval) 1) : + concatCurve c₁ c₂ h12 t ∈ + (c₁ '' Ioo (0 : unitInterval) 1) ∪ {c₁ 1} ∪ (c₂ '' Ioo (0 : unitInterval) 1) := by + have ht0 : (0 : ℝ) < t := Subtype.coe_lt_coe.mpr ht.1 + have ht1 : (t : ℝ) < 1 := Subtype.coe_lt_coe.mpr ht.2 + rw [concatCurve_apply] + split_ifs with hle + · rcases eq_or_lt_of_le hle with heq | hlt + · left; right + rw [mem_singleton_iff] + congr 1 + ext + change 2 * (t : ℝ) = 1 + linarith + · left; left + refine ⟨⟨2 * (t : ℝ), ⟨by linarith, by linarith⟩⟩, ?_, rfl⟩ + constructor <;> rw [← Subtype.coe_lt_coe] + · change (0 : ℝ) < 2 * (t : ℝ); linarith + · change 2 * (t : ℝ) < 1; linarith + · right + refine ⟨⟨2 * (t : ℝ) - 1, ⟨by linarith, by linarith⟩⟩, ?_, rfl⟩ + constructor <;> rw [← Subtype.coe_lt_coe] + · change (0 : ℝ) < 2 * (t : ℝ) - 1; linarith + · change 2 * (t : ℝ) - 1 < 1; linarith + +/-- Every seam curve `N.interiorSeamCurve i` carries a drawing with underlying set `range +(N.interiorSeamCurve i)` and +vertex set `{N.φ (N.f i 0), N.φ (N.f i 1)}`. -/ +theorem exists_drawing_range_c_int [T2Space S] (N : Net S) (i : Fin N.r) : + ∃ D : Drawing S, D.U = range (N.interiorSeamCurve i) ∧ D.V = {N.φ (N.f i 0), N.φ (N.f i 1)} + := by + let γ : unitInterval → S := N.interiorSeamCurve i + have hγ : Continuous γ := (N.interiorSeamCurve i).continuous + have hinj_Ioo : ∀ {s t : unitInterval}, s ∈ Ioo (0 : unitInterval) 1 → + γ s = γ t → s = t := by + intro s t hs hst + rcases N.eq_f_or_g_of_φ_eq_of_mem_Ioo i hs hst with hff | hfg + · exact (N.injective_f i hff).symm + · exact False.elim (N.internally_disjoint_gf i i s hs ⟨t, hfg⟩) + by_cases h01 : N.φ (N.f i 0) = N.φ (N.f i 1) + · have hpair_eq : ({N.φ (N.f i 0), N.φ (N.f i 1)} : Set S) = {N.φ (N.f i 0)} := by + rw [h01, pair_eq_singleton] + rw [hpair_eq] + have hinj : ∀ s t : unitInterval, γ s = γ t → s = t ∨ (s = 0 ∧ t = 1) ∨ (s = 1 ∧ t = 0) := by + intro s t h + rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs + · rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact Or.inl rfl + · exact Or.inr (Or.inl ⟨rfl, rfl⟩) + · exact False.elim (ht.1.ne' (hinj_Ioo ht h.symm)) + · rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact Or.inr (Or.inr ⟨rfl, rfl⟩) + · exact Or.inl rfl + · exact False.elim (ht.2.ne (hinj_Ioo ht h.symm)) + · exact Or.inl (hinj_Ioo hs h) + let q : unitInterval → Circle := GM11.arcParam 1 + have hq : Continuous q := (GM11.arcParam 1).continuous + have hqs : Function.Surjective q := GM11.arcParam_surjective 1 + have hqq : Topology.IsQuotientMap q := hq.isClosedMap.isQuotientMap hq hqs + let G : Circle → S := fun z => γ (Function.surjInv hqs z) + have hGq : G ∘ q = γ := by + funext t + have hsi : q (Function.surjInv hqs (q t)) = q t := Function.surjInv_eq hqs _ + change γ (Function.surjInv hqs (q t)) = γ t + rcases GM11.arcParam_eq_iff 1 hsi with h | ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · rw [h] + · rw [h₁, h₂]; exact h01 + · rw [h₁, h₂]; exact h01.symm + have hG : Continuous G := hqq.continuous_iff.mpr (hGq ▸ hγ) + have hGi : Function.Injective G := by + intro z w h + rw [← Function.surjInv_eq hqs z, ← Function.surjInv_eq hqs w] + rcases hinj _ _ h with h' | ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · rw [h'] + · rw [h₁, h₂]; change GM11.arcParam 1 0 = GM11.arcParam 1 1; simp + · rw [h₁, h₂]; change GM11.arcParam 1 1 = GM11.arcParam 1 0; simp + have hrange : range G = range γ := by + rw [← hGq, range_comp, hqs.range_eq, image_univ] + have hO : IsOArc (range γ) := by + rw [← hrange] + exact ⟨(hG.isClosedEmbedding hGi).isEmbedding.toHomeomorph⟩ + exact GM11.exists_loop_drawing hO ⟨0, rfl⟩ + · have hinj : Function.Injective γ := by + intro s t h + rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs + · rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · rfl + · exact False.elim (h01 h) + · exact (hinj_Ioo ht h.symm).symm + · rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact False.elim (h01 h.symm) + · rfl + · exact (hinj_Ioo ht h.symm).symm + · exact hinj_Ioo hs h + have hL : IsLineWithEnds (range γ) (N.φ (N.f i 0)) (N.φ (N.f i 1)) := + GM11.isLine_range hγ hinj + exact ⟨GM11.lineDrawing hL h01, rfl, rfl⟩ + +/-- Every net `N` with `0 < N.r` on a surface `S` has a seam graph `J : Drawing S`. -/ +theorem exists_isSeamGraphFor (hS : IsSurface S) (N : Net S) (hr : 0 < N.r) : + ∃ J : Drawing S, N.IsSeamGraphFor J := by + classical + have : T2Space S := hS.2.1 + have hbd_step : ∀ 𝓐 : Set (Set S), 𝓐.Finite → 𝓐 ⊆ cuffs S → + ∃ D : Drawing S, D.U = N.seamV ∪ ⋃₀ 𝓐 ∧ D.V = N.seamV := by + intro 𝓐 h𝓐 + induction 𝓐, h𝓐 using Set.Finite.induction_on with + | empty => + intro _ + exact ⟨GM11.pointsDrawing N.finite_seamV, by simp [GM11.pointsDrawing], rfl⟩ + | @insert C 𝓐 hC_not_mem h𝓐_fin ih => + intro hsub + have hC : C ∈ cuffs S := hsub (mem_insert _ _) + have h𝓐_sub : 𝓐 ⊆ cuffs S := (subset_insert _ _).trans hsub + obtain ⟨D₁, hU₁, hV₁⟩ := ih h𝓐_sub + have hO : IsOArc C := (cuff_statement S hS).2.2 C hC + have hCV_fin : (C ∩ N.seamV).Finite := N.finite_seamV.inter_of_right C + have hCV_ne : (C ∩ N.seamV).Nonempty := N.cuff_inter_seamV_nonempty hS hr hC + obtain ⟨D₂, hU₂, hV₂⟩ := GM11.exists_drawing_on_oArc hO hCV_fin hCV_ne inter_subset_left + have hmeet : D₁.U ∩ D₂.U ⊆ D₁.V ∩ D₂.V := by + rw [hU₁, hV₁, hU₂, hV₂] + rintro x ⟨hxV | ⟨C', hC', hxC'⟩, hxC⟩ + · exact ⟨hxV, hxC, hxV⟩ + · have hne : C ≠ C' := fun h => hC_not_mem (h ▸ hC') + exact False.elim (Set.disjoint_left.mp (cuffs_disjoint hC (h𝓐_sub hC') hne) hxC hxC') + refine ⟨D₁.glue D₂ hmeet, ?_, ?_⟩ + · change D₁.U ∪ D₂.U = _ + rw [hU₁, hU₂, sUnion_insert] + ext x; simp only [mem_union]; tauto + · change D₁.V ∪ D₂.V = _ + rw [hV₁, hV₂, union_eq_left.mpr inter_subset_right] + obtain ⟨D_bd, hU_bd, hV_bd⟩ := hbd_step (cuffs S) (cuff_statement S hS).2.1 Subset.rfl + rw [sUnion_cuffs] at hU_bd + have hint_step : ∀ T : Finset (Fin N.r), + ∃ D : Drawing S, D.U = N.seamV ∪ bd S ∪ (⋃ i ∈ T, range (N.interiorSeamCurve i)) ∧ D.V + = N.seamV := by + intro T + induction T using Finset.induction_on with + | empty => + exact ⟨D_bd, by simp [hU_bd], hV_bd⟩ + | insert i T hi_not_mem ih => + obtain ⟨D₁, hU₁, hV₁⟩ := ih + obtain ⟨D₂, hU₂, hV₂⟩ := N.exists_drawing_range_c_int i + have hV₂_sub : D₂.V ⊆ N.seamV := by + rw [hV₂] + rintro x (rfl | rfl) + · exact ⟨i, Or.inl rfl⟩ + · exact ⟨i, Or.inr rfl⟩ + have hmeet : D₁.U ∩ D₂.U ⊆ D₁.V ∩ D₂.V := by + rw [hU₁, hV₁, hU₂, hV₂] + rintro x ⟨hx₁, t, rfl⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact ⟨⟨i, Or.inl rfl⟩, Or.inl rfl⟩ + · exact ⟨⟨i, Or.inr rfl⟩, Or.inr rfl⟩ + · exfalso + rcases hx₁ with (hxV | hxbd) | hxi + · exact N.notMem_seamV_of_mem_Ioo i ht hxV + · exact N.notMem_bd_of_mem_Ioo hS i ht hxbd + · rw [mem_iUnion₂] at hxi + rcases hxi with ⟨j, hjT, s, hs_eq⟩ + have hij : i ≠ j := fun h => hi_not_mem (h ▸ hjT) + rcases N.eq_f_or_g_of_φ_eq_of_mem_Ioo i ht hs_eq.symm with hff | hfg + · exact N.internally_disjoint_ff i j hij t ht ⟨s, hff⟩ + · exact N.internally_disjoint_gf i j t ht ⟨s, hfg⟩ + refine ⟨D₁.glue D₂ hmeet, ?_, ?_⟩ + · change D₁.U ∪ D₂.U = _ + rw [hU₁, hU₂, Finset.set_biUnion_insert, union_assoc] + congr 1 + exact union_comm _ _ + · change D₁.V ∪ D₂.V = _ + rw [hV₁, union_eq_left.mpr hV₂_sub] + obtain ⟨J, hUJ, hVJ⟩ := hint_step Finset.univ + refine ⟨J, hr, ?_, hVJ⟩ + rw [hUJ] + apply Subset.antisymm + · rintro x ((hxV | hxbd) | hxi) + · rcases hxV with ⟨i, rfl | rfl⟩ + · exact ⟨N.f i 0, N.range_f_subset_bd i ⟨0, rfl⟩, rfl⟩ + · exact ⟨N.f i 1, N.range_f_subset_bd i ⟨1, rfl⟩, rfl⟩ + · exact N.bd_subset_seamU hxbd + · rw [mem_iUnion₂] at hxi + rcases hxi with ⟨i, _, t, rfl⟩ + exact ⟨N.f i t, N.range_f_subset_bd i ⟨t, rfl⟩, rfl⟩ + · rintro p ⟨x, hxbd, rfl⟩ + by_cases hpbd : N.φ x ∈ bd S + · exact Or.inl (Or.inr hpbd) + · by_cases hpV : N.φ x ∈ N.seamV + · exact Or.inl (Or.inl hpV) + · obtain ⟨i, t, _, hφt, -, -⟩ := + N.exists_mem_Ioo_of_mem_bd_of_notMem_bd_of_notMem_seamV hxbd hpbd hpV + exact Or.inr (mem_iUnion₂.mpr ⟨i, Finset.mem_univ i, t, hφt⟩) + +/-- A net `N` on a surface `S` is `G`-normal if and only if `0 < N.r` and `G.IsNormal N.seamU`. -/ +theorem isNormalFor_iff (hS : IsSurface S) (N : Net S) (G : Drawing S) : + N.IsNormalFor G ↔ 0 < N.r ∧ G.IsNormal N.seamU := by + constructor + · rintro ⟨J, ⟨hr, hU, _⟩, hnorm⟩ + exact ⟨hr, hU ▸ hnorm⟩ + · rintro ⟨hr, hnorm⟩ + obtain ⟨J, hJ⟩ := N.exists_isSeamGraphFor hS hr + exact ⟨J, hJ, hJ.2.1.symm ▸ hnorm⟩ + +open Classical in +private noncomputable abbrev join_adjacent_net_pairs + {S : Type u} + [TopologicalSpace S] + (N : Net S) + {v : S} + {i₁ : Fin N.r} + {i₂ : Fin N.r} + (hi₁_1 : N.φ ((N.f i₁) 1) = v) + (hother : ∀ (j : Fin N.r), j ≠ i₁ → j ≠ i₂ → N.φ ((N.f j) 0) ≠ v ∧ N.φ ((N.f j) 1) ≠ v) + (hf12 : (N.f i₁) 1 = (N.f i₂) 0) + (hg12 : (N.g i₁) 1 = (N.g i₂) 0) + (hv_seamV : v ∈ N.seamV) + (hinj_f_cat : Function.Injective ⇑(concatCurve (N.f i₁) (N.f i₂) hf12)) + (hinj_g_cat : Function.Injective ⇑(concatCurve (N.g i₁) (N.g i₂) hg12)) + (hf1_notMem_g1 : (N.f i₁) 1 ∉ range ⇑(N.g i₁)) + (hf1_notMem_g2 : (N.f i₁) 1 ∉ range ⇑(N.g i₂)) + (hg1_notMem_f1 : (N.g i₁) 1 ∉ range ⇑(N.f i₁)) + (hg1_notMem_f2 : (N.g i₁) 1 ∉ range ⇑(N.f i₂)) + (k₀ : Fin (N.r - 1)) + (idx : Fin (N.r - 1) → Fin N.r) + (hidx_inj : Function.Injective idx) + (hidx_ne_i₂ : ∀ (k : Fin (N.r - 1)), idx k ≠ i₂) + (hidx_ne_i₁ : ∀ (k : Fin (N.r - 1)), k ≠ k₀ → idx k ≠ i₁) + (hsurj_other : ∀ (j : Fin N.r), j ≠ i₁ → j ≠ i₂ → ∃ k, k ≠ k₀ ∧ idx k = j) : Net S := + let f_cat := concatCurve (N.f i₁) (N.f i₂) hf12 + let g_cat := concatCurve (N.g i₁) (N.g i₂) hg12 + { + D := N.D + isSurface_D := N.isSurface_D + isClosedDisc_D := N.isClosedDisc_D + φ := N.φ + quotientMap_φ := N.quotientMap_φ + r := N.r - 1 + f := fun k => if k = k₀ then f_cat else N.f (idx k) + g := fun k => if k = k₀ then g_cat else N.g (idx k) + injective_f := by + intro k + split_ifs with hk + · exact hinj_f_cat + · exact N.injective_f (idx k) + injective_g := by + intro k + split_ifs with hk + · exact hinj_g_cat + · exact N.injective_g (idx k) + range_f_subset_bd := by + intro k + split_ifs with hk + · rw [show f_cat = concatCurve (N.f i₁) (N.f i₂) hf12 from rfl, range_concatCurve] + exact union_subset (N.range_f_subset_bd i₁) (N.range_f_subset_bd i₂) + · exact N.range_f_subset_bd (idx k) + range_g_subset_bd := by + intro k + split_ifs with hk + · rw [show g_cat = concatCurve (N.g i₁) (N.g i₂) hg12 from rfl, range_concatCurve] + exact union_subset (N.range_g_subset_bd i₁) (N.range_g_subset_bd i₂) + · exact N.range_g_subset_bd (idx k) + internally_disjoint_ff := by + intro k₁ k₂ hk12 t ht + by_cases h1 : k₁ = k₀ <;> by_cases h2 : k₂ = k₀ <;> + simp only [h1, h2, ite_true, ite_false] + · exact False.elim (hk12 (h1.trans h2.symm)) + · have hj₁ := hidx_ne_i₁ k₂ h2 + have hj₂ := hidx_ne_i₂ k₂ + change concatCurve (N.f i₁) (N.f i₂) hf12 t ∉ range (N.f (idx k₂)) + rcases mem_Ioo_concatCurve hf12 ht with (⟨u, hu, hfu⟩ | hfu) | ⟨u, hu, hfu⟩ + · rw [← hfu]; exact N.internally_disjoint_ff i₁ (idx k₂) hj₁.symm u hu + · rw [mem_singleton_iff.mp hfu] + intro hmem + exact N.not_φ_eq_of_mem_range_fg hv_seamV (hother (idx k₂) hj₁ hj₂).1 + (hother (idx k₂) hj₁ hj₂).2 (Or.inl hmem) hi₁_1 + · rw [← hfu]; exact N.internally_disjoint_ff i₂ (idx k₂) hj₂.symm u hu + · have hj₁ := hidx_ne_i₁ k₁ h1 + have hj₂ := hidx_ne_i₂ k₁ + rw [show f_cat = concatCurve (N.f i₁) (N.f i₂) hf12 from rfl, range_concatCurve] + rintro (hf₁ | hf₂) + · exact N.internally_disjoint_ff (idx k₁) i₁ hj₁ t ht hf₁ + · exact N.internally_disjoint_ff (idx k₁) i₂ hj₂ t ht hf₂ + · exact N.internally_disjoint_ff (idx k₁) (idx k₂) (fun h => hk12 (hidx_inj h)) t ht + internally_disjoint_gg := by + intro k₁ k₂ hk12 t ht + by_cases h1 : k₁ = k₀ <;> by_cases h2 : k₂ = k₀ <;> + simp only [h1, h2, ite_true, ite_false] + · exact False.elim (hk12 (h1.trans h2.symm)) + · have hj₁ := hidx_ne_i₁ k₂ h2 + have hj₂ := hidx_ne_i₂ k₂ + change concatCurve (N.g i₁) (N.g i₂) hg12 t ∉ range (N.g (idx k₂)) + rcases mem_Ioo_concatCurve hg12 ht with (⟨u, hu, hgu⟩ | hgu) | ⟨u, hu, hgu⟩ + · rw [← hgu]; exact N.internally_disjoint_gg i₁ (idx k₂) hj₁.symm u hu + · rw [mem_singleton_iff.mp hgu] + intro hmem + exact N.not_φ_eq_of_mem_range_fg hv_seamV (hother (idx k₂) hj₁ hj₂).1 + (hother (idx k₂) hj₁ hj₂).2 (Or.inr hmem) ((N.pasting_eq i₁ 1).symm.trans hi₁_1) + · rw [← hgu]; exact N.internally_disjoint_gg i₂ (idx k₂) hj₂.symm u hu + · have hj₁ := hidx_ne_i₁ k₁ h1 + have hj₂ := hidx_ne_i₂ k₁ + rw [show g_cat = concatCurve (N.g i₁) (N.g i₂) hg12 from rfl, range_concatCurve] + rintro (hg₁ | hg₂) + · exact N.internally_disjoint_gg (idx k₁) i₁ hj₁ t ht hg₁ + · exact N.internally_disjoint_gg (idx k₁) i₂ hj₂ t ht hg₂ + · exact N.internally_disjoint_gg (idx k₁) (idx k₂) (fun h => hk12 (hidx_inj h)) t ht + internally_disjoint_fg := by + intro k₁ k₂ t ht + by_cases h1 : k₁ = k₀ <;> by_cases h2 : k₂ = k₀ <;> + simp only [h1, h2, ite_true, ite_false] + · rw [show g_cat = concatCurve (N.g i₁) (N.g i₂) hg12 from rfl, range_concatCurve] + change concatCurve (N.f i₁) (N.f i₂) hf12 t ∉ range (N.g i₁) ∪ range (N.g i₂) + rcases mem_Ioo_concatCurve hf12 ht with (⟨u, hu, hfu⟩ | hfu) | ⟨u, hu, hfu⟩ + · rw [← hfu] + rintro (hg₁ | hg₂) + · exact N.internally_disjoint_fg i₁ i₁ u hu hg₁ + · exact N.internally_disjoint_fg i₁ i₂ u hu hg₂ + · rw [mem_singleton_iff.mp hfu] + exact fun h => h.elim hf1_notMem_g1 hf1_notMem_g2 + · rw [← hfu] + rintro (hg₁ | hg₂) + · exact N.internally_disjoint_fg i₂ i₁ u hu hg₁ + · exact N.internally_disjoint_fg i₂ i₂ u hu hg₂ + · have hj₁ := hidx_ne_i₁ k₂ h2 + have hj₂ := hidx_ne_i₂ k₂ + change concatCurve (N.f i₁) (N.f i₂) hf12 t ∉ range (N.g (idx k₂)) + rcases mem_Ioo_concatCurve hf12 ht with (⟨u, hu, hfu⟩ | hfu) | ⟨u, hu, hfu⟩ + · rw [← hfu]; exact N.internally_disjoint_fg i₁ (idx k₂) u hu + · rw [mem_singleton_iff.mp hfu] + intro hmem + exact N.not_φ_eq_of_mem_range_fg hv_seamV (hother (idx k₂) hj₁ hj₂).1 + (hother (idx k₂) hj₁ hj₂).2 (Or.inr hmem) hi₁_1 + · rw [← hfu]; exact N.internally_disjoint_fg i₂ (idx k₂) u hu + · rw [show g_cat = concatCurve (N.g i₁) (N.g i₂) hg12 from rfl, range_concatCurve] + rintro (hg₁ | hg₂) + · exact N.internally_disjoint_fg (idx k₁) i₁ t ht hg₁ + · exact N.internally_disjoint_fg (idx k₁) i₂ t ht hg₂ + · exact N.internally_disjoint_fg (idx k₁) (idx k₂) t ht + internally_disjoint_gf := by + intro k₁ k₂ t ht + by_cases h1 : k₁ = k₀ <;> by_cases h2 : k₂ = k₀ <;> + simp only [h1, h2, ite_true, ite_false] + · rw [show f_cat = concatCurve (N.f i₁) (N.f i₂) hf12 from rfl, range_concatCurve] + change concatCurve (N.g i₁) (N.g i₂) hg12 t ∉ range (N.f i₁) ∪ range (N.f i₂) + rcases mem_Ioo_concatCurve hg12 ht with (⟨u, hu, hgu⟩ | hgu) | ⟨u, hu, hgu⟩ + · rw [← hgu] + rintro (hf₁ | hf₂) + · exact N.internally_disjoint_gf i₁ i₁ u hu hf₁ + · exact N.internally_disjoint_gf i₁ i₂ u hu hf₂ + · rw [mem_singleton_iff.mp hgu] + exact fun h => h.elim hg1_notMem_f1 hg1_notMem_f2 + · rw [← hgu] + rintro (hf₁ | hf₂) + · exact N.internally_disjoint_gf i₂ i₁ u hu hf₁ + · exact N.internally_disjoint_gf i₂ i₂ u hu hf₂ + · have hj₁ := hidx_ne_i₁ k₂ h2 + have hj₂ := hidx_ne_i₂ k₂ + change concatCurve (N.g i₁) (N.g i₂) hg12 t ∉ range (N.f (idx k₂)) + rcases mem_Ioo_concatCurve hg12 ht with (⟨u, hu, hgu⟩ | hgu) | ⟨u, hu, hgu⟩ + · rw [← hgu]; exact N.internally_disjoint_gf i₁ (idx k₂) u hu + · rw [mem_singleton_iff.mp hgu] + intro hmem + exact N.not_φ_eq_of_mem_range_fg hv_seamV (hother (idx k₂) hj₁ hj₂).1 + (hother (idx k₂) hj₁ hj₂).2 (Or.inl hmem) ((N.pasting_eq i₁ 1).symm.trans hi₁_1) + · rw [← hgu]; exact N.internally_disjoint_gf i₂ (idx k₂) u hu + · rw [show f_cat = concatCurve (N.f i₁) (N.f i₂) hf12 from rfl, range_concatCurve] + rintro (hf₁ | hf₂) + · exact N.internally_disjoint_gf (idx k₁) i₁ t ht hf₁ + · exact N.internally_disjoint_gf (idx k₁) i₂ t ht hf₂ + · exact N.internally_disjoint_gf (idx k₁) (idx k₂) t ht + pasting_eq := by + intro k t + split_ifs with hk + · change N.φ (concatCurve (N.f i₁) (N.f i₂) hf12 t) = + N.φ (concatCurve (N.g i₁) (N.g i₂) hg12 t) + rw [concatCurve_apply, concatCurve_apply] + split_ifs + · exact N.pasting_eq i₁ _ + · exact N.pasting_eq i₂ _ + · exact N.pasting_eq (idx k) t + interior_inj := N.interior_inj + bd_eq_iff := by + intro x y + rw [N.bd_eq_iff x y] + suffices hrel_eq : + (fun a b : N.D => ∃ (k : Fin (N.r - 1)) (u : unitInterval), + a = (if k = k₀ then f_cat else N.f (idx k)) u ∧ + b = (if k = k₀ then g_cat else N.g (idx k)) u) = + (fun a b : N.D => ∃ (j : Fin N.r) (t : unitInterval), + a = N.f j t ∧ b = N.g j t) by + rw [hrel_eq] + ext a b + constructor + · rintro ⟨k, u, hxy⟩ + split_ifs at hxy with hk + · change a = concatCurve (N.f i₁) (N.f i₂) hf12 u ∧ + b = concatCurve (N.g i₁) (N.g i₂) hg12 u at hxy + rw [concatCurve_apply, concatCurve_apply] at hxy + split_ifs at hxy with hu_le + · exact ⟨i₁, _, hxy⟩ + · exact ⟨i₂, _, hxy⟩ + · exact ⟨idx k, u, hxy⟩ + · rintro ⟨j, t, hxy⟩ + by_cases hj₁ : j = i₁ + · cases hj₁ + let u : unitInterval := ⟨(t : ℝ) / 2, ⟨by linarith [t.2.1], by linarith [t.2.2]⟩⟩ + have hu_le : (u : ℝ) ≤ 1 / 2 := by + change (t : ℝ) / 2 ≤ 1 / 2; linarith [t.2.2] + have h2u : (⟨2 * (u : ℝ), ⟨by linarith [u.2.1], by linarith⟩⟩ : unitInterval) = t := by + ext; change 2 * ((t : ℝ) / 2) = t; ring + have hf_u : f_cat u = N.f i₁ t := by + change concatCurve (N.f i₁) (N.f i₂) hf12 u = N.f i₁ t + rw [concatCurve_apply, dite_eq_left hu_le, h2u] + have hg_u : g_cat u = N.g i₁ t := by + change concatCurve (N.g i₁) (N.g i₂) hg12 u = N.g i₁ t + rw [concatCurve_apply, dite_eq_left hu_le, h2u] + refine ⟨k₀, u, ?_⟩ + simpa [hf_u, hg_u] using hxy + · by_cases hj₂ : j = i₂ + · cases hj₂ + rcases eq_or_lt_of_le t.2.1 with ht0 | ht_pos + · have ht_eq0 : t = 0 := Subtype.ext ht0.symm + subst ht_eq0 + let u : unitInterval := ⟨1 / 2, ⟨by norm_num, by norm_num⟩⟩ + have hu_le : (u : ℝ) ≤ 1 / 2 := le_rfl + have h2u : (⟨2 * (u : ℝ), ⟨by change 0 ≤ (2 : ℝ) * (1 / 2); norm_num, + by change (2 : ℝ) * (1 / 2) ≤ 1; norm_num⟩⟩ : unitInterval) = 1 := by + ext; change (2 : ℝ) * (1 / 2) = 1; norm_num + have hf_u : f_cat u = N.f i₂ 0 := by + change concatCurve (N.f i₁) (N.f i₂) hf12 u = N.f i₂ 0 + rw [concatCurve_apply, dite_eq_left hu_le, h2u, hf12] + have hg_u : g_cat u = N.g i₂ 0 := by + change concatCurve (N.g i₁) (N.g i₂) hg12 u = N.g i₂ 0 + rw [concatCurve_apply, dite_eq_left hu_le, h2u, hg12] + refine ⟨k₀, u, ?_⟩ + simpa [hf_u, hg_u] using hxy + · let u : unitInterval := ⟨((t : ℝ) + 1) / 2, ⟨by linarith [t.2.1], by linarith + [t.2.2]⟩⟩ + have hu_gt : ¬ (u : ℝ) ≤ 1 / 2 := by + change ¬ ((t : ℝ) + 1) / 2 ≤ 1 / 2; linarith + have h2u : (⟨2 * (u : ℝ) - 1, ⟨by linarith, by linarith [u.2.2]⟩⟩ : unitInterval) = t + := by + ext; change 2 * (((t : ℝ) + 1) / 2) - 1 = t; ring + have hf_u : f_cat u = N.f i₂ t := by + change concatCurve (N.f i₁) (N.f i₂) hf12 u = N.f i₂ t + rw [concatCurve_apply, dite_eq_right hu_gt, h2u] + have hg_u : g_cat u = N.g i₂ t := by + change concatCurve (N.g i₁) (N.g i₂) hg12 u = N.g i₂ t + rw [concatCurve_apply, dite_eq_right hu_gt, h2u] + refine ⟨k₀, u, ?_⟩ + simpa [hf_u, hg_u] using hxy + · obtain ⟨k, hk_ne, rfl⟩ := hsurj_other j hj₁ hj₂ + refine ⟨k, t, ?_⟩ + simpa [hk_ne] using hxy + } + +/-- Excluding two aligned pasted pairs meeting at an interior vertex `v ∉ bd S` +(`N.f i₁ 1 = N.f i₂ 0`, `N.g i₁ 1 = N.g i₂ 0`, `N.f i₁ 1 ≠ N.g i₁ 1`) with no other pasted pairs +incident with `v`: concatenating `(N.f i₁, N.f i₂)` and `(N.g i₁, N.g i₂)` yields a `G`-normal net +`N'` with `N'.r = N.r - 1 < N.r`, contradicting `N.IsMinimalFor G`. -/ +theorem not_two_pairs_aligned_at_interior_vertex (hS : IsSurface S) + {G : Drawing S} (N : Net S) (hmin : N.IsMinimalFor G) + {v : S} (_hv_not_bd : v ∉ bd S) {i₁ i₂ : Fin N.r} (h12_ne : i₁ ≠ i₂) + (hi₁_0 : N.φ (N.f i₁ 0) ≠ v) (hi₁_1 : N.φ (N.f i₁ 1) = v) + (_hi₂_0 : N.φ (N.f i₂ 0) = v) (hi₂_1 : N.φ (N.f i₂ 1) ≠ v) + (hother : ∀ j : Fin N.r, j ≠ i₁ → j ≠ i₂ → N.φ (N.f j 0) ≠ v ∧ N.φ (N.f j 1) ≠ v) + (hf12 : N.f i₁ 1 = N.f i₂ 0) (hg12 : N.g i₁ 1 = N.g i₂ 0) + (hfg_ne : N.f i₁ 1 ≠ N.g i₁ 1) : + False := by + classical + have : T2Space S := hS.2.1 + have hv_seamV : v ∈ N.seamV := ⟨i₁, Or.inr hi₁_1⟩ + let t_half : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht_half : t_half ∈ Ioo (0 : unitInterval) 1 := by + constructor <;> rw [← Subtype.coe_lt_coe] <;> norm_num [t_half] + have hf_ends_ne : N.f i₁ 0 ≠ N.f i₂ 1 := by + intro heq + have hbd_eq : range (N.f i₁) ∪ range (revCurve (N.f i₂)) = bd N.D := + N.range_union_eq_bd_of_same_ends (c₁ := N.f i₁) (c₂ := revCurve (N.f i₂)) + (N.injective_f i₁) (N.range_f_subset_bd i₁) + (injective_revCurve (N.injective_f i₂)) + (by rw [range_revCurve]; exact N.range_f_subset_bd i₂) + (by simpa [revCurve] using heq) + (by simpa [revCurve] using hf12) + (by + rw [disjoint_left] + rintro _ ⟨t, ht, rfl⟩ ⟨s, _, hs⟩ + rw [revCurve_apply] at hs + exact N.internally_disjoint_ff i₁ i₂ h12_ne t ht ⟨unitInterval.symm s, hs⟩) + rw [range_revCurve] at hbd_eq + have hmem : N.g i₁ t_half ∈ range (N.f i₁) ∪ range (N.f i₂) := + hbd_eq.symm ▸ N.range_g_subset_bd i₁ ⟨t_half, rfl⟩ + rcases hmem with hf₁ | hf₂ + · exact N.internally_disjoint_gf i₁ i₁ t_half ht_half hf₁ + · exact N.internally_disjoint_gf i₁ i₂ t_half ht_half hf₂ + have hg_ends_ne : N.g i₁ 0 ≠ N.g i₂ 1 := by + intro heq + have hbd_eq : range (N.g i₁) ∪ range (revCurve (N.g i₂)) = bd N.D := + N.range_union_eq_bd_of_same_ends (c₁ := N.g i₁) (c₂ := revCurve (N.g i₂)) + (N.injective_g i₁) (N.range_g_subset_bd i₁) + (injective_revCurve (N.injective_g i₂)) + (by rw [range_revCurve]; exact N.range_g_subset_bd i₂) + (by simpa [revCurve] using heq) + (by simpa [revCurve] using hg12) + (by + rw [disjoint_left] + rintro _ ⟨t, ht, rfl⟩ ⟨s, _, hs⟩ + rw [revCurve_apply] at hs + exact N.internally_disjoint_gg i₁ i₂ h12_ne t ht ⟨unitInterval.symm s, hs⟩) + rw [range_revCurve] at hbd_eq + have hmem : N.f i₁ t_half ∈ range (N.g i₁) ∪ range (N.g i₂) := + hbd_eq.symm ▸ N.range_f_subset_bd i₁ ⟨t_half, rfl⟩ + rcases hmem with hg₁ | hg₂ + · exact N.internally_disjoint_fg i₁ i₁ t_half ht_half hg₁ + · exact N.internally_disjoint_fg i₁ i₂ t_half ht_half hg₂ + let f_cat : Curve N.D := concatCurve (N.f i₁) (N.f i₂) hf12 + let g_cat : Curve N.D := concatCurve (N.g i₁) (N.g i₂) hg12 + have hinj_f_cat : Function.Injective f_cat := + injective_concatCurve hf12 (N.injective_f i₁) (N.injective_f i₂) hf_ends_ne + (N.internally_disjoint_ff i₁ i₂ h12_ne) (N.internally_disjoint_ff i₂ i₁ h12_ne.symm) + have hinj_g_cat : Function.Injective g_cat := + injective_concatCurve hg12 (N.injective_g i₁) (N.injective_g i₂) hg_ends_ne + (N.internally_disjoint_gg i₁ i₂ h12_ne) (N.internally_disjoint_gg i₂ i₁ h12_ne.symm) + have hf1_notMem_g1 : N.f i₁ 1 ∉ range (N.g i₁) := by + rintro ⟨s, hs⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs_Ioo + · exact hi₁_0 ((N.pasting_eq i₁ 0).trans ((congr_arg N.φ hs).trans hi₁_1)) + · exact hfg_ne hs.symm + · exact N.internally_disjoint_gf i₁ i₁ s hs_Ioo ⟨1, hs.symm⟩ + have hf1_notMem_g2 : N.f i₁ 1 ∉ range (N.g i₂) := by + rintro ⟨s, hs⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs_Ioo + · exact hfg_ne (hs.symm.trans hg12.symm) + · exact hi₂_1 ((N.pasting_eq i₂ 1).trans ((congr_arg N.φ hs).trans hi₁_1)) + · exact N.internally_disjoint_gf i₂ i₁ s hs_Ioo ⟨1, hs.symm⟩ + have hg1_notMem_f1 : N.g i₁ 1 ∉ range (N.f i₁) := by + rintro ⟨s, hs⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs_Ioo + · exact hi₁_0 ((congr_arg N.φ hs).trans ((N.pasting_eq i₁ 1).symm.trans hi₁_1)) + · exact hfg_ne hs + · exact N.internally_disjoint_fg i₁ i₁ s hs_Ioo ⟨1, hs.symm⟩ + have hg1_notMem_f2 : N.g i₁ 1 ∉ range (N.f i₂) := by + rintro ⟨s, hs⟩ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs_Ioo + · exact hfg_ne (hf12.trans hs) + · exact hi₂_1 ((congr_arg N.φ hs).trans ((N.pasting_eq i₁ 1).symm.trans hi₁_1)) + · exact N.internally_disjoint_fg i₂ i₁ s hs_Ioo ⟨1, hs.symm⟩ + have hr2 : 2 ≤ N.r := by + have : i₁.1 ≠ i₂.1 := Fin.val_ne_of_ne h12_ne + omega + let e : Fin (N.r - 1 + 1) ≃ Fin N.r := finCongr (by omega) + let i₁' : Fin (N.r - 1 + 1) := e.symm i₁ + let i₂' : Fin (N.r - 1 + 1) := e.symm i₂ + have h12'_ne : i₁' ≠ i₂' := fun h => h12_ne (e.symm.injective h) + obtain ⟨k₀, hk₀⟩ := Fin.exists_succAbove_eq h12'_ne + let idx (k : Fin (N.r - 1)) : Fin N.r := e (i₂'.succAbove k) + have hidx_inj : Function.Injective idx := e.injective.comp (Fin.succAbove_right_injective) + have hidx_k₀ : idx k₀ = i₁ := by simp [idx, hk₀, i₁'] + have hidx_ne_i₂ : ∀ k : Fin (N.r - 1), idx k ≠ i₂ := by + intro k h + have : i₂'.succAbove k = i₂' := e.injective (by simpa [idx, i₂'] using h) + exact Fin.succAbove_ne i₂' k this + have hidx_ne_i₁ : ∀ k : Fin (N.r - 1), k ≠ k₀ → idx k ≠ i₁ := by + intro k hk h + exact hk (hidx_inj (h.trans hidx_k₀.symm)) + have hsurj_other : ∀ j : Fin N.r, j ≠ i₁ → j ≠ i₂ → ∃ k : Fin (N.r - 1), k ≠ k₀ ∧ idx k = j := by + intro j hj₁ hj₂ + have hj'_ne : e.symm j ≠ i₂' := fun h => hj₂ (e.symm.injective h) + obtain ⟨k, hk⟩ := Fin.exists_succAbove_eq hj'_ne + have hidx_k : idx k = j := by simp [idx, hk] + exact ⟨k, fun hkk₀ => hj₁ (hidx_k ▸ hkk₀ ▸ hidx_k₀), hidx_k⟩ + let N' : Net S := + join_adjacent_net_pairs (S := S) N (v := v) (i₁ := i₁) (i₂ := i₂) hi₁_1 hother hf12 hg12 + hv_seamV hinj_f_cat hinj_g_cat hf1_notMem_g1 hf1_notMem_g2 hg1_notMem_f1 hg1_notMem_f2 k₀ + idx hidx_inj hidx_ne_i₂ hidx_ne_i₁ hsurj_other + have hN'_norm : N'.IsNormalFor G := by + rw [N'.isNormalFor_iff hS] + exact ⟨by change 0 < N.r - 1; omega, ((N.isNormalFor_iff hS G).mp hmin.1).2⟩ + have hle : N.r ≤ N'.r := hmin.2.2 N' hN'_norm le_rfl + change N.r ≤ N.r - 1 at hle + omega + +/-- If `v ∉ bd S` and `x ∈ {N.f i₀ 0, N.f i₀ 1}` has `N.φ x = v`, then `x` belongs to the range +of some other curve among `{N.f j | j ≠ i₀} ∪ {N.g j | j}`. -/ +lemma mem_other_range_of_φ_f_eq (hS : IsSurface S) (N : Net S) + {v : S} (hv_not_bd : v ∉ bd S) {i₀ : Fin N.r} {x : N.D} + (hx_end : x = N.f i₀ 0 ∨ x = N.f i₀ 1) (hφ : N.φ x = v) : + (∃ j : Fin N.r, j ≠ i₀ ∧ x ∈ range (N.f j)) ∨ + ∃ j : Fin N.r, x ∈ range (N.g j) := by + have : T2Space N.D := N.isSurface_D.2.1 + have : T2Space S := hS.2.1 + let K : Set N.D := + (⋃ j ∈ (Finset.univ.filter (· ≠ i₀) : Finset (Fin N.r)), range (N.f j)) ∪ + (⋃ j : Fin N.r, range (N.g j)) ∪ N.φ ⁻¹' bd S + have hK_closed : IsClosed K := by + refine ((IsClosed.union ?_ ?_).union ((isClosed_bd S).preimage N.quotientMap_φ.continuous)) + · exact isClosed_biUnion_finset (fun j _ => (isCompact_range (N.f j).continuous).isClosed) + · exact isClosed_iUnion_of_finite (fun j => (isCompact_range (N.g j).continuous).isClosed) + have hsub : bd N.D ⊆ range (N.f i₀) ∪ K := by + intro y hy + rcases N.bd_subset_pasted_union_preimage_bd hy with hpasted | hbdS + · simp only [mem_iUnion, mem_union] at hpasted + rcases hpasted with ⟨j, hfj | hgj⟩ + · by_cases hj : j = i₀ + · subst hj; exact Or.inl hfj + · refine Or.inr (Or.inl (Or.inl (mem_iUnion₂.mpr ⟨j, ?_, hfj⟩))) + exact Finset.mem_filter.mpr ⟨Finset.mem_univ j, hj⟩ + · exact Or.inr (Or.inl (Or.inr (mem_iUnion.mpr ⟨j, hgj⟩))) + · exact Or.inr (Or.inr hbdS.2) + have hmemK : x ∈ K := by + by_contra hnotK + exact N.not_bd_subset_range_union_closed (N.injective_f i₀) (N.range_f_subset_bd i₀) + hK_closed hx_end hnotK hsub + rcases hmemK with (hf | hg) | hbdS + · simp only [mem_iUnion, Finset.mem_filter, Finset.mem_univ, true_and] at hf + rcases hf with ⟨j, hj, hfj⟩ + exact Or.inl ⟨j, hj, hfj⟩ + · simp only [mem_iUnion] at hg + exact Or.inr hg + · exact False.elim (hv_not_bd (hφ ▸ hbdS)) + +/-- If `v ∉ bd S` and `x ∈ {N.g i₀ 0, N.g i₀ 1}` has `N.φ x = v`, then `x` belongs to the range +of some other curve among `{N.f j | j} ∪ {N.g j | j ≠ i₀}`. -/ +lemma mem_other_range_of_φ_g_eq (hS : IsSurface S) (N : Net S) + {v : S} (hv_not_bd : v ∉ bd S) {i₀ : Fin N.r} {x : N.D} + (hx_end : x = N.g i₀ 0 ∨ x = N.g i₀ 1) (hφ : N.φ x = v) : + (∃ j : Fin N.r, x ∈ range (N.f j)) ∨ + ∃ j : Fin N.r, j ≠ i₀ ∧ x ∈ range (N.g j) := by + have : T2Space N.D := N.isSurface_D.2.1 + have : T2Space S := hS.2.1 + let K : Set N.D := + (⋃ j : Fin N.r, range (N.f j)) ∪ + (⋃ j ∈ (Finset.univ.filter (· ≠ i₀) : Finset (Fin N.r)), range (N.g j)) ∪ N.φ ⁻¹' bd S + have hK_closed : IsClosed K := by + refine ((IsClosed.union ?_ ?_).union ((isClosed_bd S).preimage N.quotientMap_φ.continuous)) + · exact isClosed_iUnion_of_finite (fun j => (isCompact_range (N.f j).continuous).isClosed) + · exact isClosed_biUnion_finset (fun j _ => (isCompact_range (N.g j).continuous).isClosed) + have hsub : bd N.D ⊆ range (N.g i₀) ∪ K := by + intro y hy + rcases N.bd_subset_pasted_union_preimage_bd hy with hpasted | hbdS + · simp only [mem_iUnion, mem_union] at hpasted + rcases hpasted with ⟨j, hfj | hgj⟩ + · exact Or.inr (Or.inl (Or.inl (mem_iUnion.mpr ⟨j, hfj⟩))) + · by_cases hj : j = i₀ + · subst hj; exact Or.inl hgj + · refine Or.inr (Or.inl (Or.inr (mem_iUnion₂.mpr ⟨j, ?_, hgj⟩))) + exact Finset.mem_filter.mpr ⟨Finset.mem_univ j, hj⟩ + · exact Or.inr (Or.inr hbdS.2) + have hmemK : x ∈ K := by + by_contra hnotK + exact N.not_bd_subset_range_union_closed (N.injective_g i₀) (N.range_g_subset_bd i₀) + hK_closed hx_end hnotK hsub + rcases hmemK with (hf | hg) | hbdS + · simp only [mem_iUnion] at hf + exact Or.inl hf + · simp only [mem_iUnion, Finset.mem_filter, Finset.mem_univ, true_and] at hg + rcases hg with ⟨j, hj, hgj⟩ + exact Or.inr ⟨j, hj, hgj⟩ + · exact False.elim (hv_not_bd (hφ ▸ hbdS)) + +/-- Excluding Case 3 / Subcase B2b (`(N.F₂ v).card = 0` and `(N.F₁ v).card = 2`): two distinct +non-loop seam pairs incident with an interior vertex `v ∉ bd S` and no other seam pairs incident +with `v` cannot occur in a minimal net `N` on a surface `S`. -/ +theorem not_two_pairs_at_interior_vertex (hS : IsSurface S) + {G : Drawing S} (N : Net S) (hmin : N.IsMinimalFor G) + {v : S} (hv_not_bd : v ∉ bd S) {i₁ i₂ : Fin N.r} (h12_ne : i₁ ≠ i₂) + (hi₁_0 : N.φ (N.f i₁ 0) ≠ v) (hi₁_1 : N.φ (N.f i₁ 1) = v) + (hi₂_0 : N.φ (N.f i₂ 0) = v) (hi₂_1 : N.φ (N.f i₂ 1) ≠ v) + (hother : ∀ j : Fin N.r, j ≠ i₁ → j ≠ i₂ → N.φ (N.f j 0) ≠ v ∧ N.φ (N.f j 1) ≠ v) : + False := by + have hv_seamV : v ∈ N.seamV := ⟨i₁, Or.inr hi₁_1⟩ + have hsymm_Ioo : ∀ {t : unitInterval}, t ∈ Ioo (0 : unitInterval) 1 → + unitInterval.symm t ∈ Ioo (0 : unitInterval) 1 := by + intro t ht + have ht0 : (0 : ℝ) < t := Subtype.coe_lt_coe.mpr ht.1 + have ht1 : (t : ℝ) < 1 := Subtype.coe_lt_coe.mpr ht.2 + constructor <;> rw [← Subtype.coe_lt_coe] + · change (0 : ℝ) < 1 - (t : ℝ); linarith + · change 1 - (t : ℝ) < 1; linarith + have hφ_g₁ : N.φ (N.g i₁ 1) = v := (N.pasting_eq i₁ 1).symm.trans hi₁_1 + have hφ_g₂ : N.φ (N.g i₂ 0) = v := (N.pasting_eq i₂ 0).symm.trans hi₂_0 + have hstep_v : ∀ {j : Fin N.r} {t : unitInterval}, N.φ (N.f j t) = v → + (j = i₁ ∧ t = 1) ∨ (j = i₂ ∧ t = 0) := by + intro j t hφft + by_cases hj₁ : j = i₁ + · cases hj₁ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact False.elim (hi₁_0 hφft) + · exact Or.inl ⟨rfl, rfl⟩ + · exact False.elim (N.notMem_seamV_of_mem_Ioo i₁ ht (hφft.symm ▸ hv_seamV)) + · by_cases hj₂ : j = i₂ + · cases hj₂ + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact Or.inr ⟨rfl, rfl⟩ + · exact False.elim (hi₂_1 hφft) + · exact False.elim (N.notMem_seamV_of_mem_Ioo i₂ ht (hφft.symm ▸ hv_seamV)) + · exact False.elim (N.not_φ_eq_of_mem_range_fg hv_seamV (hother j hj₁ hj₂).1 + (hother j hj₁ hj₂).2 (Or.inl ⟨t, rfl⟩) hφft) + have hfg₁_ne : N.f i₁ 1 ≠ N.g i₁ 1 := by + intro heq + have h3_f₂ : N.f i₁ 1 ≠ N.f i₂ 0 := by + intro h2 + refine N.not_three_curves_common_end + (c₁ := revCurve (N.f i₁)) (c₂ := revCurve (N.g i₁)) (c₃ := N.f i₂) + (injective_revCurve (N.injective_f i₁)) + (by rw [range_revCurve]; exact N.range_f_subset_bd i₁) + (injective_revCurve (N.injective_g i₁)) + (by rw [range_revCurve]; exact N.range_g_subset_bd i₁) + (N.range_f_subset_bd i₂) + (by simpa using heq) + (by simpa using h2) + (by intro t ht; rw [range_revCurve]; exact N.internally_disjoint_fg i₁ i₁ _ (hsymm_Ioo ht)) + (by intro t ht; rw [range_revCurve]; exact N.internally_disjoint_gf i₁ i₁ _ (hsymm_Ioo ht)) + (by intro t ht; rw [range_revCurve]; exact N.internally_disjoint_ff i₂ i₁ h12_ne.symm t ht) + (by intro t ht; rw [range_revCurve]; exact N.internally_disjoint_fg i₂ i₁ t ht) + have h3_g₂ : N.f i₁ 1 ≠ N.g i₂ 0 := by + intro h2 + refine N.not_three_curves_common_end + (c₁ := revCurve (N.f i₁)) (c₂ := revCurve (N.g i₁)) (c₃ := N.g i₂) + (injective_revCurve (N.injective_f i₁)) + (by rw [range_revCurve]; exact N.range_f_subset_bd i₁) + (injective_revCurve (N.injective_g i₁)) + (by rw [range_revCurve]; exact N.range_g_subset_bd i₁) + (N.range_g_subset_bd i₂) + (by simpa using heq) + (by simpa using h2) + (by intro t ht; rw [range_revCurve]; exact N.internally_disjoint_fg i₁ i₁ _ (hsymm_Ioo ht)) + (by intro t ht; rw [range_revCurve]; exact N.internally_disjoint_gf i₁ i₁ _ (hsymm_Ioo ht)) + (by intro t ht; rw [range_revCurve]; exact N.internally_disjoint_gf i₂ i₁ t ht) + (by intro t ht; rw [range_revCurve]; exact N.internally_disjoint_gg i₂ i₁ h12_ne.symm t ht) + have heqv := (N.bd_eq_iff (N.f i₁ 1) (N.f i₂ 0)).mp (hi₁_1.trans hi₂_0.symm) + have hinv : ∀ a b : N.D, + Relation.EqvGen (fun a b => ∃ j t, a = N.f j t ∧ b = N.g j t) a b → + (a = N.f i₁ 1 ↔ b = N.f i₁ 1) := by + intro a b hrel + induction hrel with + | rel x y hxy => + rcases hxy with ⟨j, t, rfl, rfl⟩ + constructor + · intro hx + rcases hstep_v (hx.symm ▸ hi₁_1) with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact heq.symm + · exact False.elim (h3_f₂ hx.symm) + · intro hy + have hφft : N.φ (N.f j t) = v := (N.pasting_eq j t).trans (hy.symm ▸ hi₁_1) + rcases hstep_v hφft with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · exact False.elim (h3_g₂ hy.symm) + | refl _ => exact Iff.rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ ih1 ih2 => exact ih1.trans ih2 + exact h3_f₂ ((hinv (N.f i₁ 1) (N.f i₂ 0) heqv).mp rfl).symm + have hfg₂_ne : N.f i₂ 0 ≠ N.g i₂ 0 := by + intro heq + have h3_f₁ : N.f i₂ 0 ≠ N.f i₁ 1 := by + intro h1 + refine N.not_three_curves_common_end + (c₁ := N.f i₂) (c₂ := N.g i₂) (c₃ := revCurve (N.f i₁)) + (N.injective_f i₂) (N.range_f_subset_bd i₂) + (N.injective_g i₂) (N.range_g_subset_bd i₂) + (by rw [range_revCurve]; exact N.range_f_subset_bd i₁) + heq + (by simpa using h1) + (N.internally_disjoint_fg i₂ i₂) + (N.internally_disjoint_gf i₂ i₂) + (by intro t ht; exact N.internally_disjoint_ff i₁ i₂ h12_ne _ (hsymm_Ioo ht)) + (by intro t ht; exact N.internally_disjoint_fg i₁ i₂ _ (hsymm_Ioo ht)) + have h3_g₁ : N.f i₂ 0 ≠ N.g i₁ 1 := by + intro h1 + refine N.not_three_curves_common_end + (c₁ := N.f i₂) (c₂ := N.g i₂) (c₃ := revCurve (N.g i₁)) + (N.injective_f i₂) (N.range_f_subset_bd i₂) + (N.injective_g i₂) (N.range_g_subset_bd i₂) + (by rw [range_revCurve]; exact N.range_g_subset_bd i₁) + heq + (by simpa using h1) + (N.internally_disjoint_fg i₂ i₂) + (N.internally_disjoint_gf i₂ i₂) + (by intro t ht; exact N.internally_disjoint_gf i₁ i₂ _ (hsymm_Ioo ht)) + (by intro t ht; exact N.internally_disjoint_gg i₁ i₂ h12_ne _ (hsymm_Ioo ht)) + have heqv := (N.bd_eq_iff (N.f i₂ 0) (N.f i₁ 1)).mp (hi₂_0.trans hi₁_1.symm) + have hinv : ∀ a b : N.D, + Relation.EqvGen (fun a b => ∃ j t, a = N.f j t ∧ b = N.g j t) a b → + (a = N.f i₂ 0 ↔ b = N.f i₂ 0) := by + intro a b hrel + induction hrel with + | rel x y hxy => + rcases hxy with ⟨j, t, rfl, rfl⟩ + constructor + · intro hx + rcases hstep_v (hx.symm ▸ hi₂_0) with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact False.elim (h3_f₁ hx.symm) + · exact heq.symm + · intro hy + have hφft : N.φ (N.f j t) = v := (N.pasting_eq j t).trans (hy.symm ▸ hi₂_0) + rcases hstep_v hφft with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact False.elim (h3_g₁ hy.symm) + · rfl + | refl _ => exact Iff.rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ ih1 ih2 => exact ih1.trans ih2 + exact h3_f₁ ((hinv (N.f i₂ 0) (N.f i₁ 1) heqv).mp rfl).symm + have hf₁_cases : N.f i₁ 1 = N.f i₂ 0 ∨ N.f i₁ 1 = N.g i₂ 0 := by + rcases N.mem_other_range_of_φ_f_eq hS hv_not_bd (Or.inr rfl) hi₁_1 with + ⟨j, hj, t, ht⟩ | ⟨j, t, ht⟩ + · rcases hstep_v ((congr_arg N.φ ht).trans hi₁_1) with ⟨rfl, _⟩ | ⟨rfl, rfl⟩ + · exact False.elim (hj rfl) + · exact Or.inl ht.symm + · rcases hstep_v ((N.pasting_eq j t).trans ((congr_arg N.φ ht).trans hi₁_1)) with + ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact False.elim (hfg₁_ne ht.symm) + · exact Or.inr ht.symm + have hg₁_cases : N.g i₁ 1 = N.f i₂ 0 ∨ N.g i₁ 1 = N.g i₂ 0 := by + rcases N.mem_other_range_of_φ_g_eq hS hv_not_bd (Or.inr rfl) hφ_g₁ with + ⟨j, t, ht⟩ | ⟨j, hj, t, ht⟩ + · rcases hstep_v ((congr_arg N.φ ht).trans hφ_g₁) with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact False.elim (hfg₁_ne ht) + · exact Or.inl ht.symm + · rcases hstep_v ((N.pasting_eq j t).trans ((congr_arg N.φ ht).trans hφ_g₁)) with + ⟨rfl, _⟩ | ⟨rfl, rfl⟩ + · exact False.elim (hj rfl) + · exact Or.inr ht.symm + rcases hf₁_cases with hf12 | hf1_g2 + · have hg12 : N.g i₁ 1 = N.g i₂ 0 := by + rcases hg₁_cases with hg1_f2 | hg12 + · exact False.elim (hfg₁_ne (hf12.trans hg1_f2.symm)) + · exact hg12 + exact N.not_two_pairs_aligned_at_interior_vertex hS hmin hv_not_bd h12_ne + hi₁_0 hi₁_1 hi₂_0 hi₂_1 hother hf12 hg12 hfg₁_ne + · have hg1_f2 : N.g i₁ 1 = N.f i₂ 0 := by + rcases hg₁_cases with hg1_f2 | hg12 + · exact hg1_f2 + · exact False.elim (hfg₁_ne (hf1_g2.trans hg12.symm)) + refine (N.swapPair i₂).not_two_pairs_aligned_at_interior_vertex hS + ((N.isMinimalFor_swapPair i₂ G).mpr hmin) hv_not_bd h12_ne + (by change N.φ ((if i₁ = i₂ then N.g i₁ else N.f i₁) 0) ≠ v; rw [ite_eq_right h12_ne]; exact + hi₁_0) + (by change N.φ ((if i₁ = i₂ then N.g i₁ else N.f i₁) 1) = v; rw [ite_eq_right h12_ne]; exact + hi₁_1) + (by change N.φ ((if i₂ = i₂ then N.g i₂ else N.f i₂) 0) = v; rw [ite_eq_left rfl]; exact + hφ_g₂) + (by change N.φ ((if i₂ = i₂ then N.g i₂ else N.f i₂) 1) ≠ v + rw [ite_eq_left rfl, ← N.pasting_eq i₂ 1]; exact hi₂_1) + (by change ∀ j : Fin N.r, j ≠ i₁ → j ≠ i₂ → + N.φ ((if j = i₂ then N.g j else N.f j) 0) ≠ v ∧ + N.φ ((if j = i₂ then N.g j else N.f j) 1) ≠ v + intro j hj₁ hj₂ + rw [ite_eq_right hj₂]; exact hother j hj₁ hj₂) + (by change (if i₁ = i₂ then N.g i₁ else N.f i₁) 1 = (if i₂ = i₂ then N.g i₂ else N.f i₂) 0 + rw [ite_eq_right h12_ne, ite_eq_left rfl]; exact hf1_g2) + (by change (if i₁ = i₂ then N.f i₁ else N.g i₁) 1 = (if i₂ = i₂ then N.f i₂ else N.g i₂) 0 + rw [ite_eq_right h12_ne, ite_eq_left rfl]; exact hg1_f2) + (by change (if i₁ = i₂ then N.g i₁ else N.f i₁) 1 ≠ (if i₁ = i₂ then N.f i₁ else N.g i₁) 1 + rw [ite_eq_right h12_ne, ite_eq_right h12_ne]; exact hfg₁_ne) + +/-! ## 6. Excluding Case 2 (`F₂.card = 0, F₁.card = 1`) and proving (2.3) -/ + +/-- The diameter `u ↦ 2u - 1` of the upper half disc `halfD 1`. -/ +private noncomputable def e_half (u : unitInterval) : ℂ := ((2 * (u : ℝ) - 1 : ℝ) : ℂ) + +/-- The upper semicircle `u ↦ exp(i π (1 - u))` of the upper half disc `halfD 1`. -/ +private noncomputable def a_half (u : unitInterval) : ℂ := cis' (Real.pi * (1 - (u : ℝ))) + +private theorem isArcMap_e_half : IsArcMap e_half := by + refine ⟨Complex.continuous_ofReal.comp (by fun_prop), fun u v h => ?_⟩ + have h1 : 2 * (u : ℝ) - 1 = 2 * (v : ℝ) - 1 := Complex.ofReal_injective h + exact Subtype.ext (by linarith) + +private theorem isArcMap_a_half : IsArcMap a_half := by + have hpi := Real.pi_pos + refine ⟨continuous_cis'.comp (by fun_prop), fun u v h => ?_⟩ + have hu : Real.pi * (1 - (u : ℝ)) ∈ Ioc (-Real.pi) Real.pi := + ⟨by nlinarith [u.2.2], by nlinarith [u.2.1]⟩ + have hv : Real.pi * (1 - (v : ℝ)) ∈ Ioc (-Real.pi) Real.pi := + ⟨by nlinarith [v.2.2], by nlinarith [v.2.1]⟩ + have h1 := cis'_injOn' hu hv h + exact Subtype.ext (by nlinarith) + +private theorem a_half_zero : a_half 0 = -1 := by + change cis' (Real.pi * (1 - 0)) = -1 + rw [sub_zero, mul_one, cis'_pi] + +private theorem a_half_one : a_half 1 = 1 := by + change cis' (Real.pi * (1 - 1)) = 1 + rw [sub_self, mul_zero, cis'_zero] + +private theorem e_half_zero : e_half 0 = -1 := by + change ((2 * (0 : ℝ) - 1 : ℝ) : ℂ) = -1 + norm_num + +private theorem e_half_one : e_half 1 = 1 := by + change ((2 * (1 : ℝ) - 1 : ℝ) : ℂ) = 1 + norm_num + +private theorem a_half_eq_e_half (s t : unitInterval) (h : a_half s = e_half t) : + (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · rw [e_half_zero, ← a_half_zero] at h + exact Or.inl ⟨isArcMap_a_half.2 h, rfl⟩ + · rw [e_half_one, ← a_half_one] at h + exact Or.inr ⟨isArcMap_a_half.2 h, rfl⟩ + · exfalso + have ht0 : (0 : ℝ) < t := Subtype.coe_lt_coe.mpr ht.1 + have ht1 : (t : ℝ) < 1 := Subtype.coe_lt_coe.mpr ht.2 + have hnorm1 : ‖a_half s‖ = 1 := norm_cis' _ + have hnorm2 : ‖e_half t‖ < 1 := by + change ‖((2 * (t : ℝ) - 1 : ℝ) : ℂ)‖ < 1 + rw [Complex.norm_real, Real.norm_eq_abs, abs_lt] + constructor <;> linarith + rw [h] at hnorm1 + linarith + +private theorem side_a_half_e_half : side a_half e_half = discBd (halfD 1) := by + have hpi := Real.pi_pos + rw [(isClosedDisc_halfD one_ne_zero).2] + ext z + simp only [side, mem_union, mem_range, mem_ofPred_eq, one_mul] + constructor + · rintro (⟨s, rfl⟩ | ⟨t, rfl⟩) + · left + refine ⟨norm_cis' _, ?_⟩ + change 0 ≤ (cis' (Real.pi * (1 - (s : ℝ)))).im + rw [cis'_im] + exact Real.sin_nonneg_of_nonneg_of_le_pi + (by nlinarith [s.2.2]) (by nlinarith [s.2.1]) + · right + change ‖((2 * (t : ℝ) - 1 : ℝ) : ℂ)‖ ≤ 1 ∧ ((2 * (t : ℝ) - 1 : ℝ) : ℂ).im = 0 + rw [Complex.norm_real, Real.norm_eq_abs, abs_le] + exact ⟨⟨by linarith [t.2.1], by linarith [t.2.2]⟩, Complex.ofReal_im _⟩ + · rintro (⟨hz1, hz2⟩ | ⟨hz1, hz2⟩) + · left + have harg0 : 0 ≤ Complex.arg z := Complex.arg_nonneg_iff.mpr hz2 + have harg1 : Complex.arg z ≤ Real.pi := Complex.arg_le_pi z + have hdiv0 : 0 ≤ Complex.arg z / Real.pi := div_nonneg harg0 hpi.le + have hdiv1 : Complex.arg z / Real.pi ≤ 1 := (div_le_one hpi).mpr harg1 + refine ⟨⟨1 - Complex.arg z / Real.pi, ⟨by linarith, by linarith⟩⟩, ?_⟩ + change cis' (Real.pi * (1 - (1 - Complex.arg z / Real.pi))) = z + rw [show Real.pi * (1 - (1 - Complex.arg z / Real.pi)) = Complex.arg z by + field_simp; ring] + exact cis'_arg hz1 + · right + have hz_re : z = (z.re : ℂ) := Complex.ext rfl (by simp [hz2]) + have habs : |z.re| ≤ 1 := (Complex.abs_re_le_norm z).trans hz1 + obtain ⟨hre0, hre1⟩ := abs_le.mp habs + refine ⟨⟨(z.re + 1) / 2, ⟨by linarith, by linarith⟩⟩, ?_⟩ + change ((2 * ((z.re + 1) / 2) - 1 : ℝ) : ℂ) = z + nth_rw 2 [hz_re] + congr 1 + ring + +/-- Map `N.D` homeomorphically onto `halfD 1` sending a boundary arc `ℓ` to `e_half`. -/ +private lemma exists_half_disc_map (N : Net S) {ℓ : Curve N.D} (hinj : Function.Injective ℓ) + (hr : range ℓ ⊆ bd N.D) : + ∃ (p : N.D → ℂ) (q : ℂ → N.D), Continuous p ∧ ContinuousOn q (halfD 1) ∧ + (∀ x : N.D, p x ∈ halfD 1) ∧ (∀ x : N.D, q (p x) = x) ∧ + (∀ z ∈ halfD 1, p (q z) = z) ∧ (∀ u : unitInterval, p (ℓ u) = e_half u) ∧ + bd N.D = q '' (range a_half ∪ range e_half) := by + obtain ⟨h, g, c⟩ := N.isClosedDisc_D.exists_isChart + have hbd_univ : discBd (univ : Set N.D) = bd N.D := + image_bd_homeomorph (Homeomorph.Set.univ N.D) + have hr' : range ℓ ⊆ discBd (univ : Set N.D) := hbd_univ.symm ▸ hr + have hrΔ : ∀ u : unitInterval, ℓ u ∈ (univ : Set N.D) := fun _ => trivial + let c₀ : unitInterval → ℂ := fun u => h (ℓ u) + have hc₀ : IsArcMap c₀ := ⟨c.hc.comp_continuous ℓ.continuous hrΔ, fun u v huv => + hinj (c.gh.injOn (hrΔ u) (hrΔ v) huv)⟩ + have hsub : range c₀ ⊆ Metric.sphere (0 : ℂ) 1 := by + rintro _ ⟨u, rfl⟩ + rw [← c.bd] + exact mem_image_of_mem h (hr' ⟨u, rfl⟩) + obtain ⟨φ₀⟩ := oArc_sphere + obtain ⟨d, hd, d0, d1, hu, hmd⟩ := exists_other_arc φ₀ hc₀ hsub + obtain ⟨h₀, k₀, m, -, v2⟩ := exists_bdMatch_of_arcs hd hc₀ isArcMap_a_half isArcMap_e_half + d0.symm d1.symm (e_half_zero.trans a_half_zero.symm) (e_half_one.trans a_half_one.symm) + (fun s t hst => (hmd t s hst.symm).imp And.symm And.symm) a_half_eq_e_half + rw [union_comm (range d), hu] at m + have hO : Nonempty (Circle ≃ₜ side a_half e_half) := + oArc_of_two_arcs isArcMap_a_half isArcMap_e_half + (a_half_zero.trans e_half_zero.symm) (a_half_one.trans e_half_one.symm) a_half_eq_e_half + obtain ⟨ψ, χ, m', hψ⟩ := exists_bdMatch_closedInner ⟨φ₀⟩ hO m + have hcl_eq : closedInner (side a_half e_half) = halfD 1 := + (eq_closedInner_of_discBd (side_a_half_e_half ▸ hO) (isClosedDisc_halfD one_ne_zero).1 + side_a_half_e_half.symm).symm + rw [closedInner_sphere, hcl_eq] at m' + obtain ⟨n1, n2, n3, n4, n5, n6⟩ := id m' + refine ⟨ψ ∘ h, g ∘ χ, + continuousOn_univ.mp (n5.comp c.hc c.hm), + c.gc.comp n6 n2, + fun x => n1 (c.hm (mem_univ x)), + fun x => by + change g (χ (ψ (h x))) = x + rw [n3 (c.hm (mem_univ x))] + exact c.gh (mem_univ x), + fun z hz => by + change ψ (h (g (χ z))) = z + rw [c.hg (n2 hz)] + exact n4 hz, + fun u => by + change ψ (c₀ u) = e_half u + rw [hψ (hsub ⟨u, rfl⟩), v2], + ?_⟩ + rw [← hbd_univ] + change discBd (univ : Set N.D) = (g ∘ χ) '' side a_half e_half + rw [← show h₀ '' Metric.sphere (0 : ℂ) 1 = side a_half e_half from m.image_eq, + ← hψ.image_eq, image_image, ← c.g_sphere] + refine image_congr fun z hz => ?_ + change g z = g (χ (ψ z)) + rw [n3 (Metric.sphere_subset_closedBall hz)] + +/-- Folding `(N.f i₀, N.g i₀)` when `N.f i₀ 0 = N.g i₀ 0` and `N.f i₀ 1 ≠ N.g i₀ 1`: there is a +quotient map `π : N.D → N.D` whose only non-trivial fibers are `{N.f i₀ t, N.g i₀ t}` for +`t : unitInterval` and which maps `bd N.D \ (N.f i₀ '' Ico 0 1 ∪ N.g i₀ '' Ico 0 1)` onto `bd N.D`. +-/ +lemma exists_fold_quotient (N : Net S) {i₀ : Fin N.r} + (hfg0 : N.f i₀ 0 = N.g i₀ 0) (hfg1_ne : N.f i₀ 1 ≠ N.g i₀ 1) : + ∃ π : N.D → N.D, + Topology.IsQuotientMap π ∧ + (∀ x y : N.D, π x = π y ↔ + x = y ∨ ∃ t : unitInterval, + (x = N.f i₀ t ∧ y = N.g i₀ t) ∨ (x = N.g i₀ t ∧ y = N.f i₀ t)) ∧ + (∀ x : N.D, π x ∈ bd N.D ↔ + x ∈ bd N.D ∧ x ∉ N.f i₀ '' Ico (0 : unitInterval) 1 ∪ N.g i₀ '' Ico (0 : unitInterval) 1) + := by + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + have hsymm_Ioo : ∀ {t : unitInterval}, t ∈ Ioo (0 : unitInterval) 1 → + unitInterval.symm t ∈ Ioo (0 : unitInterval) 1 := by + intro t ht + have ht0 : (0 : ℝ) < t := Subtype.coe_lt_coe.mpr ht.1 + have ht1 : (t : ℝ) < 1 := Subtype.coe_lt_coe.mpr ht.2 + constructor <;> rw [← Subtype.coe_lt_coe] + · change (0 : ℝ) < 1 - (t : ℝ); linarith + · change 1 - (t : ℝ) < 1; linarith + have hrev_f1 : (revCurve (N.f i₀)) 1 = N.g i₀ 0 := by simpa using hfg0 + let c_fold : Curve N.D := concatCurve (revCurve (N.f i₀)) (N.g i₀) hrev_f1 + have hinj_c_fold : Function.Injective c_fold := + injective_concatCurve hrev_f1 (injective_revCurve (N.injective_f i₀)) (N.injective_g i₀) + (by simpa using hfg1_ne) + (fun t ht => N.internally_disjoint_fg i₀ i₀ _ (hsymm_Ioo ht)) + (fun t ht => by rw [range_revCurve]; exact N.internally_disjoint_gf i₀ i₀ t ht) + have hrange_c_fold : range c_fold = range (N.f i₀) ∪ range (N.g i₀) := by + change range (concatCurve (revCurve (N.f i₀)) (N.g i₀) hrev_f1) = _ + rw [range_concatCurve, range_revCurve] + have hr_c_fold : range c_fold ⊆ bd N.D := + hrange_c_fold ▸ union_subset (N.range_f_subset_bd i₀) (N.range_g_subset_bd i₀) + obtain ⟨p, q, hp_cont, _, hp_mem, hqp, hpq, hp_c_fold, hbd_eq⟩ := + N.exists_half_disc_map hinj_c_fold hr_c_fold + have hp_f : ∀ t : unitInterval, p (N.f i₀ t) = - ((t : ℝ) : ℂ) := by + intro t + let u : unitInterval := ⟨(1 - (t : ℝ)) / 2, ⟨by linarith [t.2.2], by linarith [t.2.1]⟩⟩ + have hu_le : (u : ℝ) ≤ 1 / 2 := by + change (1 - (t : ℝ)) / 2 ≤ 1 / 2; linarith [t.2.1] + have h2u : unitInterval.symm ⟨2 * (u : ℝ), ⟨by linarith [u.2.1], by linarith⟩⟩ = t := by + ext; change 1 - 2 * ((1 - (t : ℝ)) / 2) = t; ring + have hc_u : c_fold u = N.f i₀ t := by + change concatCurve (revCurve (N.f i₀)) (N.g i₀) hrev_f1 u = N.f i₀ t + rw [concatCurve_apply, dite_eq_left hu_le, revCurve_apply, h2u] + rw [← hc_u, hp_c_fold u] + change ((2 * ((1 - (t : ℝ)) / 2) - 1 : ℝ) : ℂ) = - ((t : ℝ) : ℂ) + push_cast + ring + have hp_g : ∀ t : unitInterval, p (N.g i₀ t) = ((t : ℝ) : ℂ) := by + intro t + rcases eq_or_lt_of_le t.2.1 with ht0 | ht_pos + · have ht_eq0 : t = 0 := Subtype.ext ht0.symm + subst ht_eq0 + rw [← hfg0, hp_f 0] + simp + · let u : unitInterval := ⟨((t : ℝ) + 1) / 2, ⟨by linarith [t.2.1], by linarith [t.2.2]⟩⟩ + have hu_gt : ¬ (u : ℝ) ≤ 1 / 2 := by + change ¬ ((t : ℝ) + 1) / 2 ≤ 1 / 2; linarith + have h2u : (⟨2 * (u : ℝ) - 1, ⟨by linarith, by linarith [u.2.2]⟩⟩ : unitInterval) = t := by + ext; change 2 * (((t : ℝ) + 1) / 2) - 1 = t; ring + have hc_u : c_fold u = N.g i₀ t := by + change concatCurve (revCurve (N.f i₀)) (N.g i₀) hrev_f1 u = N.g i₀ t + rw [concatCurve_apply, dite_eq_right hu_gt, h2u] + rw [← hc_u, hp_c_fold u] + change ((2 * (((t : ℝ) + 1) / 2) - 1 : ℝ) : ℂ) = ((t : ℝ) : ℂ) + push_cast + ring + obtain ⟨h_D, g_D, c_D⟩ := N.isClosedDisc_D.exists_isChart + have hbd_univ : discBd (univ : Set N.D) = bd N.D := + image_bd_homeomorph (Homeomorph.Set.univ N.D) + let π : N.D → N.D := fun x => g_D ((p x) ^ 2) + have hsq_mem : ∀ x : N.D, (p x) ^ 2 ∈ Metric.closedBall (0 : ℂ) 1 := fun x => by + rw [Metric.mem_closedBall, dist_zero_right, norm_pow] + exact pow_le_one₀ (norm_nonneg _) (hp_mem x).1 + have hπ_cont : Continuous π := c_D.gc.comp_continuous (hp_cont.pow 2) hsq_mem + have hπ_surj : Function.Surjective π := by + intro y + have hy_ball : ‖h_D y‖ ≤ 1 := by + simpa [Metric.mem_closedBall, dist_zero_right] using c_D.hm (mem_univ y) + obtain ⟨w, hw_mem, hw_sq⟩ := exists_sqrt_half hy_ball + refine ⟨q w, ?_⟩ + change g_D ((p (q w)) ^ 2) = y + rw [hpq w hw_mem, hw_sq] + exact c_D.gh (mem_univ y) + have hπ_quot : Topology.IsQuotientMap π := + (hπ_cont.isClosedMap).isQuotientMap hπ_cont hπ_surj + have hπ_eq_iff : ∀ x y : N.D, π x = π y ↔ + x = y ∨ ∃ t : unitInterval, + (x = N.f i₀ t ∧ y = N.g i₀ t) ∨ (x = N.g i₀ t ∧ y = N.f i₀ t) := by + intro x y + constructor + · intro heq + have hsq_eq : (p x) ^ 2 = (p y) ^ 2 := c_D.injOn (hsq_mem x) (hsq_mem y) heq + rcases sq_eq_sq_iff_eq_or_eq_neg.mp hsq_eq with hp_eq | hp_neg + · exact Or.inl (by rw [← hqp x, ← hqp y, hp_eq]) + · right + have hx_im : 0 ≤ (p x).im := by simpa using (hp_mem x).2 + have hy_im : 0 ≤ (p y).im := by simpa using (hp_mem y).2 + have hy_im0 : (p y).im = 0 := by + rw [hp_neg, Complex.neg_im] at hx_im + linarith + have hpy_re : p y = (((p y).re : ℝ) : ℂ) := Complex.ext rfl (by simp [hy_im0]) + have habs : |(p y).re| ≤ 1 := (Complex.abs_re_le_norm (p y)).trans (hp_mem y).1 + obtain ⟨hre0, hre1⟩ := abs_le.mp habs + rcases le_total 0 (p y).re with hnonneg | hnonpos + · let t : unitInterval := ⟨(p y).re, ⟨hnonneg, hre1⟩⟩ + refine ⟨t, Or.inl ⟨?_, ?_⟩⟩ + · rw [← hqp x, hp_neg, hpy_re, ← hp_f t, hqp] + · rw [← hqp y, hpy_re, ← hp_g t, hqp] + · let t : unitInterval := ⟨- (p y).re, ⟨by linarith, by linarith⟩⟩ + refine ⟨t, Or.inr ⟨?_, ?_⟩⟩ + · rw [← hqp x, hp_neg, hpy_re, show - (((p y).re : ℝ) : ℂ) = ((t : ℝ) : ℂ) by + change - (((p y).re : ℝ) : ℂ) = ((- (p y).re : ℝ) : ℂ); push_cast; ring, ← hp_g t, + hqp] + · rw [← hqp y, hpy_re, show (((p y).re : ℝ) : ℂ) = - ((t : ℝ) : ℂ) by + change (((p y).re : ℝ) : ℂ) = - ((- (p y).re : ℝ) : ℂ); push_cast; ring, ← hp_f t, + hqp] + · rintro (rfl | ⟨t, ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩⟩) + · rfl + · change g_D ((p (N.f i₀ t)) ^ 2) = g_D ((p (N.g i₀ t)) ^ 2) + rw [hp_f t, hp_g t, neg_sq] + · change g_D ((p (N.g i₀ t)) ^ 2) = g_D ((p (N.f i₀ t)) ^ 2) + rw [hp_f t, hp_g t, neg_sq] + have hπ_bd_iff : ∀ x : N.D, π x ∈ bd N.D ↔ ‖p x‖ = 1 := by + intro x + rw [← hbd_univ, ← c_D.g_sphere] + constructor + · rintro ⟨w, hw, heq⟩ + have hw_eq : w = (p x) ^ 2 := c_D.injOn (Metric.sphere_subset_closedBall hw) (hsq_mem x) heq + have hnorm_sq : ‖p x‖ ^ 2 = 1 := by + rw [← norm_pow, ← hw_eq] + simpa [Metric.mem_sphere, dist_zero_right] using hw + nlinarith [norm_nonneg (p x)] + · intro hnorm + refine ⟨(p x) ^ 2, ?_, rfl⟩ + simp [norm_pow, hnorm] + have hq_e_half : q '' range e_half = range (N.f i₀) ∪ range (N.g i₀) := by + rw [← hrange_c_fold] + ext x + simp only [mem_image, mem_range] + constructor + · rintro ⟨_, ⟨u, rfl⟩, rfl⟩ + exact ⟨u, by rw [← hp_c_fold u, hqp]⟩ + · rintro ⟨u, rfl⟩ + exact ⟨e_half u, ⟨u, rfl⟩, by rw [← hp_c_fold u, hqp]⟩ + refine ⟨π, hπ_quot, hπ_eq_iff, fun x => ⟨?_, ?_⟩⟩ + · intro hπ_bd + have hnorm : ‖p x‖ = 1 := (hπ_bd_iff x).mp hπ_bd + refine ⟨?_, ?_⟩ + · rw [hbd_eq] + refine ⟨p x, ?_, hqp x⟩ + change p x ∈ side a_half e_half + rw [side_a_half_e_half, (isClosedDisc_halfD one_ne_zero).2] + exact Or.inl ⟨by simpa using hnorm, (hp_mem x).2⟩ + · rintro (⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩) + · rw [hp_f t, norm_neg, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg t.2.1] at hnorm + exact (Subtype.coe_lt_coe.mpr ht.2).ne hnorm + · rw [hp_g t, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg t.2.1] at hnorm + exact (Subtype.coe_lt_coe.mpr ht.2).ne hnorm + · rintro ⟨hx_bd, hx_notMem⟩ + rw [hπ_bd_iff] + rw [hbd_eq, image_union, hq_e_half] at hx_bd + rcases hx_bd with ⟨z, ⟨s, rfl⟩, rfl⟩ | (⟨t, rfl⟩ | ⟨t, rfl⟩) + · have ha_mem : a_half s ∈ halfD 1 := + discBd_subset (halfD 1) (side_a_half_e_half ▸ Or.inl ⟨s, rfl⟩) + rw [hpq _ ha_mem] + exact norm_cis' _ + · rcases eq_or_lt_of_le t.2.2 with ht1 | ht_lt + · have ht_eq1 : t = 1 := Subtype.ext ht1 + subst ht_eq1; rw [hp_f 1]; simp + · exact False.elim (hx_notMem (Or.inl ⟨t, ⟨t.2.1, ht_lt⟩, rfl⟩)) + · rcases eq_or_lt_of_le t.2.2 with ht1 | ht_lt + · have ht_eq1 : t = 1 := Subtype.ext ht1 + subst ht_eq1; rw [hp_g 1]; simp + · exact False.elim (hx_notMem (Or.inr ⟨t, ⟨t.2.1, ht_lt⟩, rfl⟩)) + +open Classical in +private noncomputable abbrev collapse_single_net_pair + {S : Type u} + [TopologicalSpace S] + (N : Net S) + {v : S} + (hv_not_bd : v ∉ bd S) + {i₀ : Fin N.r} + (hi₀_0 : N.φ ((N.f i₀) 0) = v) + (hi₀_1 : N.φ ((N.f i₀) 1) ≠ v) + (hother : ∀ (j : Fin N.r), j ≠ i₀ → N.φ ((N.f j) 0) ≠ v ∧ N.φ ((N.f j) 1) ≠ v) + [T2Space S] + (t_half : unitInterval) + (ht_half : t_half ∈ Ioo 0 1) + (hstep_v : ∀ {j : Fin N.r} {t : unitInterval}, N.φ ((N.f j) t) = v → j = i₀ ∧ t = 0) + (hfg0 : (N.f i₀) 0 = (N.g i₀) 0) + (hfg1_ne : (N.f i₀) 1 ≠ (N.g i₀) 1) + (π : N.D → N.D) + (hπ_eq_iff : ∀ (x y : N.D), π x = π y ↔ x = y ∨ ∃ t, x = (N.f i₀) t ∧ y = (N.g i₀) t ∨ x = + (N.g i₀) t ∧ y = (N.f i₀) t) + (hπ_bd : ∀ (x : N.D), π x ∈ bd N.D ↔ x ∈ bd N.D ∧ x ∉ ⇑(N.f i₀) '' Ico 0 1 ∪ ⇑(N.g i₀) '' Ico + 0 1) + (hπ_cont : Continuous π) + (hπ_surj : Function.Surjective π) + (φ' : N.D → S) + (hφ'_π : ∀ (x : N.D), φ' (π x) = N.φ x) + (hφ'_quot : IsQuotientMap φ') + (hrev_f1 : (revCurve (N.f i₀)) 1 = (N.g i₀) 0) + (hinj_c_fold : Function.Injective ⇑(concatCurve (revCurve (N.f i₀)) (N.g i₀) hrev_f1)) + (hrange_c_fold : range ⇑(concatCurve (revCurve (N.f i₀)) (N.g i₀) hrev_f1) = range ⇑(N.f i₀) ∪ + range ⇑(N.g i₀)) + (hr_c_fold : range ⇑(concatCurve (revCurve (N.f i₀)) (N.g i₀) hrev_f1) ⊆ bd N.D) + (hc_fold_0 : (concatCurve (revCurve (N.f i₀)) (N.g i₀) hrev_f1) 0 = (N.f i₀) 1) + (hc_fold_1 : (concatCurve (revCurve (N.f i₀)) (N.g i₀) hrev_f1) 1 = (N.g i₀) 1) + (hnot_Ico_of_ne : ∀ {j : Fin N.r}, j ≠ i₀ → ∀ {x : N.D}, x ∈ range ⇑(N.f j) ∪ range ⇑(N.g j) → + x ∉ ⇑(N.f i₀) '' Ico 0 1 ∪ ⇑(N.g i₀) '' Ico 0 1) + (hnot_ends_of_disj : ∀ {c c' : Curve N.D}, Function.Injective ⇑c → range ⇑c ⊆ bd N.D → range + ⇑c' ⊆ bd N.D → (∀ t ∈ Ioo 0 1, c t ∉ range ⇑(N.f i₀) ∧ c t ∉ range ⇑(N.g i₀)) → c' t_half ∉ + range ⇑c ∧ c' t_half ∉ range ⇑(N.f i₀) ∧ c' t_half ∉ range ⇑(N.g i₀) → ¬(c 0 = (N.f i₀) 1 ∧ + c 1 = (N.g i₀) 1)) + (hinj_π_curve : ∀ {c c' : Curve N.D}, Function.Injective ⇑c → range ⇑c ⊆ bd N.D → range ⇑c' ⊆ + bd N.D → (∀ (t : unitInterval), c t ∉ ⇑(N.f i₀) '' Ico 0 1 ∪ ⇑(N.g i₀) '' Ico 0 1) → (∀ t ∈ + Ioo 0 1, c t ∉ range ⇑(N.f i₀) ∧ c t ∉ range ⇑(N.g i₀)) → c' t_half ∉ range ⇑c ∧ c' t_half ∉ + range ⇑(N.f i₀) ∧ c' t_half ∉ range ⇑(N.g i₀) → Function.Injective (π ∘ ⇑c)) + (idx : Fin (N.r - 1) → Fin N.r) + (hidx_inj : Function.Injective idx) + (hidx_ne : ∀ (k : Fin (N.r - 1)), idx k ≠ i₀) + (hsurj_other : ∀ (j : Fin N.r), j ≠ i₀ → ∃ k, idx k = j) + (hπ_single_of_notMem : ∀ {x y : N.D}, x ∉ range ⇑(N.f i₀) ∧ x ∉ range ⇑(N.g i₀) → (π x = π y ↔ + x = y)) : Net S := + let c_fold := concatCurve (revCurve (N.f i₀)) (N.g i₀) hrev_f1 + { + D := N.D + isSurface_D := N.isSurface_D + isClosedDisc_D := N.isClosedDisc_D + φ := φ' + quotientMap_φ := hφ'_quot + r := N.r - 1 + f := fun k => ⟨π ∘ N.f (idx k), hπ_cont.comp (N.f (idx k)).continuous⟩ + g := fun k => ⟨π ∘ N.g (idx k), hπ_cont.comp (N.g (idx k)).continuous⟩ + injective_f := fun k => + hinj_π_curve (c := N.f (idx k)) (c' := N.g (idx k)) + (N.injective_f (idx k)) (N.range_f_subset_bd (idx k)) (N.range_g_subset_bd (idx k)) + (fun t => hnot_Ico_of_ne (hidx_ne k) (Or.inl ⟨t, rfl⟩)) + (fun t ht => ⟨N.internally_disjoint_ff (idx k) i₀ (hidx_ne k) t ht, + N.internally_disjoint_fg (idx k) i₀ t ht⟩) + ⟨N.internally_disjoint_gf (idx k) (idx k) t_half ht_half, + N.internally_disjoint_gf (idx k) i₀ t_half ht_half, + N.internally_disjoint_gg (idx k) i₀ (hidx_ne k) t_half ht_half⟩ + injective_g := fun k => + hinj_π_curve (c := N.g (idx k)) (c' := N.f (idx k)) + (N.injective_g (idx k)) (N.range_g_subset_bd (idx k)) (N.range_f_subset_bd (idx k)) + (fun t => hnot_Ico_of_ne (hidx_ne k) (Or.inr ⟨t, rfl⟩)) + (fun t ht => ⟨N.internally_disjoint_gf (idx k) i₀ t ht, + N.internally_disjoint_gg (idx k) i₀ (hidx_ne k) t ht⟩) + ⟨N.internally_disjoint_fg (idx k) (idx k) t_half ht_half, + N.internally_disjoint_ff (idx k) i₀ (hidx_ne k) t_half ht_half, + N.internally_disjoint_fg (idx k) i₀ t_half ht_half⟩ + range_f_subset_bd := by + rintro k _ ⟨t, rfl⟩ + exact (hπ_bd _).mpr ⟨N.range_f_subset_bd (idx k) ⟨t, rfl⟩, + hnot_Ico_of_ne (hidx_ne k) (Or.inl ⟨t, rfl⟩)⟩ + range_g_subset_bd := by + rintro k _ ⟨t, rfl⟩ + exact (hπ_bd _).mpr ⟨N.range_g_subset_bd (idx k) ⟨t, rfl⟩, + hnot_Ico_of_ne (hidx_ne k) (Or.inr ⟨t, rfl⟩)⟩ + internally_disjoint_ff := by + rintro k₁ k₂ hk12 t ht ⟨s, hs⟩ + change π (N.f (idx k₂) s) = π (N.f (idx k₁) t) at hs + have h_eq : N.f (idx k₁) t = N.f (idx k₂) s := + (hπ_single_of_notMem ⟨N.internally_disjoint_ff (idx k₁) i₀ (hidx_ne k₁) t ht, + N.internally_disjoint_fg (idx k₁) i₀ t ht⟩).mp hs.symm + exact N.internally_disjoint_ff (idx k₁) (idx k₂) (fun h => hk12 (hidx_inj h)) t ht ⟨s, + h_eq.symm⟩ + internally_disjoint_gg := by + rintro k₁ k₂ hk12 t ht ⟨s, hs⟩ + change π (N.g (idx k₂) s) = π (N.g (idx k₁) t) at hs + have h_eq : N.g (idx k₁) t = N.g (idx k₂) s := + (hπ_single_of_notMem ⟨N.internally_disjoint_gf (idx k₁) i₀ t ht, + N.internally_disjoint_gg (idx k₁) i₀ (hidx_ne k₁) t ht⟩).mp hs.symm + exact N.internally_disjoint_gg (idx k₁) (idx k₂) (fun h => hk12 (hidx_inj h)) t ht ⟨s, + h_eq.symm⟩ + internally_disjoint_fg := by + rintro k₁ k₂ t ht ⟨s, hs⟩ + change π (N.g (idx k₂) s) = π (N.f (idx k₁) t) at hs + have h_eq : N.f (idx k₁) t = N.g (idx k₂) s := + (hπ_single_of_notMem ⟨N.internally_disjoint_ff (idx k₁) i₀ (hidx_ne k₁) t ht, + N.internally_disjoint_fg (idx k₁) i₀ t ht⟩).mp hs.symm + exact N.internally_disjoint_fg (idx k₁) (idx k₂) t ht ⟨s, h_eq.symm⟩ + internally_disjoint_gf := by + rintro k₁ k₂ t ht ⟨s, hs⟩ + change π (N.f (idx k₂) s) = π (N.g (idx k₁) t) at hs + have h_eq : N.g (idx k₁) t = N.f (idx k₂) s := + (hπ_single_of_notMem ⟨N.internally_disjoint_gf (idx k₁) i₀ t ht, + N.internally_disjoint_gg (idx k₁) i₀ (hidx_ne k₁) t ht⟩).mp hs.symm + exact N.internally_disjoint_gf (idx k₁) (idx k₂) t ht ⟨s, h_eq.symm⟩ + pasting_eq := by + intro k t + change φ' (π (N.f (idx k) t)) = φ' (π (N.g (idx k) t)) + rw [hφ'_π, hφ'_π] + exact N.pasting_eq (idx k) t + interior_inj := by + intro z₁ hz₁ z₂ hφ'_eq + obtain ⟨x₁, rfl⟩ := hπ_surj z₁ + obtain ⟨x₂, rfl⟩ := hπ_surj z₂ + rw [hφ'_π, hφ'_π] at hφ'_eq + by_cases hx₁_bd : x₁ ∈ bd N.D + · have hx₁_Ico : x₁ ∈ N.f i₀ '' Ico (0 : unitInterval) 1 ∪ N.g i₀ '' Ico + (0 : unitInterval) 1 := by + by_contra hx₁_notMem + exact hz₁ ((hπ_bd x₁).mpr ⟨hx₁_bd, hx₁_notMem⟩) + have hIco_eq : + ∃ t ∈ Ico (0 : unitInterval) 1, π x₁ = π (N.f i₀ t) ∧ N.φ x₁ = N.φ (N.f i₀ t) := by + rcases hx₁_Ico with ⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩ + · exact ⟨t, ht, rfl, rfl⟩ + · exact ⟨t, ht, (hπ_eq_iff _ _).mpr (Or.inr ⟨t, Or.inr ⟨rfl, rfl⟩⟩), + (N.pasting_eq i₀ t).symm⟩ + obtain ⟨t₁, ht₁, hπ₁, hφ₁⟩ := hIco_eq + rw [hπ₁] + have hφ_x₂ : N.φ x₂ = N.φ (N.f i₀ t₁) := hφ'_eq.symm.trans hφ₁ + rcases eq_or_lt_of_le ht₁.1 with ht₁0 | ht₁_pos + · have ht₁_eq0 : t₁ = 0 := ht₁0.symm + subst ht₁_eq0 + have hφ_x₂_v : N.φ x₂ = v := hφ_x₂.trans hi₀_0 + have hx₂_bd : x₂ ∈ bd N.D := by + rw [← N.preimage_seamU, mem_preimage, hφ_x₂_v, ← hi₀_0] + exact ⟨N.f i₀ 0, N.range_f_subset_bd i₀ ⟨0, rfl⟩, rfl⟩ + have hx₂_pasted := N.mem_pasted_of_mem_bd_of_notMem_bd hx₂_bd + (hφ_x₂_v.symm ▸ hv_not_bd) + rw [mem_iUnion] at hx₂_pasted + rcases hx₂_pasted with ⟨j, ⟨t₂, rfl⟩ | ⟨t₂, rfl⟩⟩ + · rcases hstep_v hφ_x₂_v with ⟨rfl, rfl⟩ + rfl + · rcases hstep_v ((N.pasting_eq j t₂).trans hφ_x₂_v) with ⟨rfl, rfl⟩ + exact (hπ_eq_iff _ _).mpr (Or.inr ⟨0, Or.inl ⟨rfl, rfl⟩⟩) + · have ht₁_Ioo : t₁ ∈ Ioo (0 : unitInterval) 1 := ⟨ht₁_pos, ht₁.2⟩ + rcases N.eq_f_or_g_of_φ_eq_of_mem_Ioo i₀ ht₁_Ioo hφ_x₂.symm with rfl | rfl + · rfl + · exact (hπ_eq_iff _ _).mpr (Or.inr ⟨t₁, Or.inl ⟨rfl, rfl⟩⟩) + · rw [N.interior_inj x₁ hx₁_bd x₂ hφ'_eq] + bd_eq_iff := by + intro z₁ z₂ + obtain ⟨x₁, rfl⟩ := hπ_surj z₁ + obtain ⟨x₂, rfl⟩ := hπ_surj z₂ + rw [hφ'_π, hφ'_π, N.bd_eq_iff x₁ x₂] + let R_N (a b : N.D) : Prop := ∃ (j : Fin N.r) (t : unitInterval), a = N.f j t ∧ b = N.g j t + let R_N' (u v : N.D) : Prop := + ∃ (k : Fin (N.r - 1)) (t : unitInterval), u = π (N.f (idx k) t) ∧ v = π (N.g (idx k) t) + change Relation.EqvGen R_N x₁ x₂ ↔ Relation.EqvGen R_N' (π x₁) (π x₂) + have hπ_rel : ∀ a b : N.D, π a = π b → Relation.EqvGen R_N a b := by + intro a b heq + rcases (hπ_eq_iff a b).mp heq with rfl | ⟨t, ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩⟩ + · exact Relation.EqvGen.refl _ + · exact Relation.EqvGen.rel _ _ ⟨i₀, t, rfl, rfl⟩ + · exact Relation.EqvGen.symm _ _ (Relation.EqvGen.rel _ _ ⟨i₀, t, rfl, rfl⟩) + constructor + · intro hrel + induction hrel with + | rel a b hab => + rcases hab with ⟨j, t, rfl, rfl⟩ + by_cases hj : j = i₀ + · cases hj + have hπ_fg : π (N.f i₀ t) = π (N.g i₀ t) := + (hπ_eq_iff _ _).mpr (Or.inr ⟨t, Or.inl ⟨rfl, rfl⟩⟩) + rw [hπ_fg] + exact Relation.EqvGen.refl _ + · obtain ⟨k, rfl⟩ := hsurj_other j hj + exact Relation.EqvGen.rel _ _ ⟨k, t, rfl, rfl⟩ + | refl _ => exact Relation.EqvGen.refl _ + | symm _ _ _ ih => exact Relation.EqvGen.symm _ _ ih + | trans _ _ _ _ _ ih1 ih2 => exact Relation.EqvGen.trans _ _ _ ih1 ih2 + · intro hrel' + have hlift : ∀ u v : N.D, Relation.EqvGen R_N' u v → + ∀ a b : N.D, π a = u → π b = v → Relation.EqvGen R_N a b := by + intro u v huv + induction huv with + | rel u v huv => + rcases huv with ⟨k, t, rfl, rfl⟩ + intro a b ha hb + exact Relation.EqvGen.trans _ _ _ (hπ_rel a _ ha) + (Relation.EqvGen.trans _ _ _ (Relation.EqvGen.rel _ _ ⟨idx k, t, rfl, rfl⟩) + (hπ_rel _ b hb.symm)) + | refl u => + intro a b ha hb + exact hπ_rel a b (ha.trans hb.symm) + | symm u v _ ih => + intro a b ha hb + exact Relation.EqvGen.symm _ _ (ih b a hb ha) + | trans u w v _ _ ih1 ih2 => + intro a b ha hb + obtain ⟨c, rfl⟩ := hπ_surj w + exact Relation.EqvGen.trans _ _ _ (ih1 a c ha rfl) (ih2 c b rfl hb) + exact hlift (π x₁) (π x₂) hrel' x₁ x₂ rfl rfl + } + +private theorem single_pair_has_distinct_final_ends + {S : Type u} + [TopologicalSpace S] + (hS : IsSurface S) + (h000 : ¬Nonempty (S ≃ₜ SurfaceModel 0 0 0)) + (h010 : ¬Nonempty (S ≃ₜ SurfaceModel 0 1 0)) + (h001 : ¬Nonempty (S ≃ₜ SurfaceModel 0 0 1)) + {G : Drawing S} + (N : Net S) + (hmin : N.IsMinimalFor G) + {v : S} + (hv_not_bd : v ∉ bd S) + {i₀ : Fin N.r} + (hi₀_0 : N.φ ((N.f i₀) 0) = v) + [T2Space S] + (t_half : ↑unitInterval) + (ht_half : t_half ∈ Ioo 0 1) + (hfg0 : (N.f i₀) 0 = (N.g i₀) 0) : + (N.f i₀) 1 ≠ (N.g i₀) 1 := by + intro heq + have hbd_eq : range (N.f i₀) ∪ range (N.g i₀) = bd N.D := + N.range_union_eq_bd_of_same_ends (N.injective_f i₀) (N.range_f_subset_bd i₀) + (N.injective_g i₀) (N.range_g_subset_bd i₀) hfg0 heq (by + rw [disjoint_left] + rintro _ ⟨t, ht, rfl⟩ ⟨s, _, hs⟩ + exact N.internally_disjoint_fg i₀ i₀ t ht ⟨s, hs⟩) + have hno_j : ∀ j : Fin N.r, j ≠ i₀ → False := by + intro j hj + have hmem : N.f j t_half ∈ range (N.f i₀) ∪ range (N.g i₀) := + hbd_eq.symm ▸ N.range_f_subset_bd j ⟨t_half, rfl⟩ + rcases hmem with hf | hg + · exact N.internally_disjoint_ff j i₀ hj t_half ht_half hf + · exact N.internally_disjoint_fg j i₀ t_half ht_half hg + have hf1_not_bd : N.φ (N.f i₀ 1) ∉ bd S := by + intro hp_bd + let C : Set S := connectedComponentIn (bd S) (N.φ (N.f i₀ 1)) + have hC_mem : C ∈ cuffs S := ⟨N.φ (N.f i₀ 1), hp_bd, rfl⟩ + have hC_sub : C ⊆ bd S := connectedComponentIn_subset _ _ + obtain ⟨e_cuff⟩ := (cuff_statement S hS).2.2 C hC_mem + have h1_ne_neg1 : (1 : Circle) ≠ (-1 : Circle) := by + intro h + have h' : (1 : ℂ) = (-1 : ℂ) := congr_arg Subtype.val h + norm_num at h' + have hex_ne : ∃ z ∈ C, z ≠ N.φ (N.f i₀ 1) := by + by_cases h1 : (e_cuff 1).1 = N.φ (N.f i₀ 1) + · refine ⟨(e_cuff (-1)).1, (e_cuff (-1)).2, ?_⟩ + intro h2 + exact h1_ne_neg1 (e_cuff.injective (Subtype.ext (h1.trans h2.symm))) + · exact ⟨(e_cuff 1).1, (e_cuff 1).2, h1⟩ + obtain ⟨z, hzC, hz_ne⟩ := hex_ne + have hz_bdS : z ∈ bd S := hC_sub hzC + obtain ⟨x, hx_bd, rfl⟩ := N.bd_subset_seamU hz_bdS + rw [← hbd_eq] at hx_bd + have hex_t : ∃ t : unitInterval, N.φ x = N.φ (N.f i₀ t) := by + rcases hx_bd with ⟨t, rfl⟩ | ⟨t, rfl⟩ + · exact ⟨t, rfl⟩ + · exact ⟨t, (N.pasting_eq i₀ t).symm⟩ + obtain ⟨t, ht_eq⟩ := hex_t + rw [ht_eq] at hz_bdS hz_ne + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht_Ioo + · exact hv_not_bd (hi₀_0 ▸ hz_bdS) + · exact hz_ne rfl + · exact N.notMem_bd_of_mem_Ioo hS i₀ ht_Ioo hz_bdS + obtain ⟨J, hJ, _⟩ := hmin.1 + exact N.not_isolated_pair_of_not_sphere_proj_disc hS h000 h010 h001 hJ i₀ + (hi₀_0.symm ▸ hv_not_bd) hf1_not_bd (fun j hj => False.elim (hno_j j hj)) + +private theorem other_pairs_avoid_fold_endpoints + {S : Type u} + [TopologicalSpace S] + (N : Net S) + {v : S} + {i₀ : Fin N.r} + (hi₀_0 : N.φ ((N.f i₀) 0) = v) + (hother : ∀ (j : Fin N.r), j ≠ i₀ → N.φ ((N.f j) 0) ≠ v ∧ N.φ ((N.f j) 1) ≠ v) + (hv_seamV : v ∈ N.seamV) : + ∀ {j : Fin N.r}, j ≠ i₀ → ∀ {x : N.D}, x ∈ range ⇑(N.f j) ∪ range ⇑(N.g j) → x ∉ ⇑(N.f i₀) '' + Ico 0 1 ∪ ⇑(N.g i₀) '' Ico 0 1 := by + intro j hj x hx_mem hIco + rcases hIco with ⟨s, hs, rfl⟩ | ⟨s, hs, rfl⟩ + · rcases eq_or_lt_of_le hs.1 with hs0 | hs_pos + · have hs_eq0 : s = 0 := hs0.symm + subst hs_eq0 + exact N.not_φ_eq_of_mem_range_fg hv_seamV (hother j hj).1 (hother j hj).2 hx_mem hi₀_0 + · have hs_Ioo : s ∈ Ioo (0 : unitInterval) 1 := ⟨hs_pos, hs.2⟩ + rcases hx_mem with hfj | hgj + · exact N.internally_disjoint_ff i₀ j hj.symm s hs_Ioo hfj + · exact N.internally_disjoint_fg i₀ j s hs_Ioo hgj + · rcases eq_or_lt_of_le hs.1 with hs0 | hs_pos + · have hs_eq0 : s = 0 := hs0.symm + subst hs_eq0 + exact N.not_φ_eq_of_mem_range_fg hv_seamV (hother j hj).1 (hother j hj).2 hx_mem + ((N.pasting_eq i₀ 0).symm.trans hi₀_0) + · have hs_Ioo : s ∈ Ioo (0 : unitInterval) 1 := ⟨hs_pos, hs.2⟩ + rcases hx_mem with hfj | hgj + · exact N.internally_disjoint_gf i₀ j s hs_Ioo hfj + · exact N.internally_disjoint_gg i₀ j hj.symm s hs_Ioo hgj + +private theorem another_curve_excludes_fold_end_pair + {S : Type u} + [TopologicalSpace S] + (N : Net S) + {i₀ : Fin N.r} + (t_half : ↑unitInterval) + (c_fold : Curve N.D) + (hinj_c_fold : Function.Injective ⇑c_fold) + (hrange_c_fold : range ⇑c_fold = range ⇑(N.f i₀) ∪ range ⇑(N.g i₀)) + (hr_c_fold : range ⇑c_fold ⊆ bd N.D) + (hc_fold_0 : c_fold 0 = (N.f i₀) 1) + (hc_fold_1 : c_fold 1 = (N.g i₀) 1) : + ∀ {c c' : Curve N.D}, Function.Injective ⇑c → range ⇑c ⊆ bd N.D → range ⇑c' ⊆ bd N.D → (∀ t ∈ + Ioo 0 1, c t ∉ range ⇑(N.f i₀) ∧ c t ∉ range ⇑(N.g i₀)) → c' t_half ∉ range ⇑c ∧ c' t_half ∉ + range ⇑(N.f i₀) ∧ c' t_half ∉ range ⇑(N.g i₀) → ¬(c 0 = (N.f i₀) 1 ∧ c 1 = (N.g i₀) 1) := by + intro c c' hc_inj hc_bd hc'_bd hc_disj hc'_half ⟨hc0, hc1⟩ + have hbd_eq : range c ∪ range c_fold = bd N.D := + N.range_union_eq_bd_of_same_ends hc_inj hc_bd hinj_c_fold hr_c_fold + (hc0.trans hc_fold_0.symm) (hc1.trans hc_fold_1.symm) (by + rw [disjoint_left] + rintro _ ⟨t, ht, rfl⟩ hmem + have hmem' : c t ∈ range c_fold := image_subset_range _ _ hmem + rw [hrange_c_fold] at hmem' + rcases hmem' with hf | hg + · exact (hc_disj t ht).1 hf + · exact (hc_disj t ht).2 hg) + rw [hrange_c_fold] at hbd_eq + have hmem : c' t_half ∈ range c ∪ (range (N.f i₀) ∪ range (N.g i₀)) := + hbd_eq.symm ▸ hc'_bd ⟨t_half, rfl⟩ + rcases hmem with hc_mem | (hf_mem | hg_mem) + · exact hc'_half.1 hc_mem + · exact hc'_half.2.1 hf_mem + · exact hc'_half.2.2 hg_mem + +private theorem fold_injective_on_remaining_curve + {S : Type u} + [TopologicalSpace S] + (N : Net S) + {i₀ : Fin N.r} + (hsymm_Ioo : ∀ {t : ↑unitInterval}, t ∈ Ioo 0 1 → unitInterval.symm t ∈ Ioo 0 1) + (t_half : ↑unitInterval) + (hfg1_ne : (N.f i₀) 1 ≠ (N.g i₀) 1) + (π : N.D → N.D) + (hπ_eq_iff : ∀ (x y : N.D), π x = π y ↔ x = y ∨ ∃ t, x = (N.f i₀) t ∧ y = (N.g i₀) t ∨ x = + (N.g i₀) t ∧ y = (N.f i₀) t) + (hnot_ends_of_disj : ∀ {c c' : Curve N.D}, Function.Injective ⇑c → range ⇑c ⊆ bd N.D → range + ⇑c' ⊆ bd N.D → (∀ t ∈ Ioo 0 1, c t ∉ range ⇑(N.f i₀) ∧ c t ∉ range ⇑(N.g i₀)) → c' t_half ∉ + range ⇑c ∧ c' t_half ∉ range ⇑(N.f i₀) ∧ c' t_half ∉ range ⇑(N.g i₀) → ¬(c 0 = (N.f i₀) 1 ∧ + c 1 = (N.g i₀) 1)) : + ∀ {c c' : Curve N.D}, Function.Injective ⇑c → range ⇑c ⊆ bd N.D → range ⇑c' ⊆ bd N.D → (∀ (t : + ↑unitInterval), c t ∉ ⇑(N.f i₀) '' Ico 0 1 ∪ ⇑(N.g i₀) '' Ico 0 1) → (∀ t ∈ Ioo 0 1, c t ∉ + range ⇑(N.f i₀) ∧ c t ∉ range ⇑(N.g i₀)) → c' t_half ∉ range ⇑c ∧ c' t_half ∉ range ⇑(N.f + i₀) ∧ c' t_half ∉ range ⇑(N.g i₀) → Function.Injective (π ∘ ⇑c) := by + intro c c' hc_inj hc_bd hc'_bd hc_not_Ico hc_disj hc'_half t₁ t₂ heq + rcases (hπ_eq_iff (c t₁) (c t₂)).mp heq with hct | ⟨s, hcs⟩ + · exact hc_inj hct + · exfalso + have hs1 : s = 1 := by + rcases eq_or_lt_of_le s.2.2 with hs1 | hs_lt + · exact Subtype.ext hs1 + · exfalso + rcases hcs with ⟨h1, _⟩ | ⟨h1, _⟩ + · exact hc_not_Ico t₁ (Or.inl ⟨s, ⟨s.2.1, hs_lt⟩, h1.symm⟩) + · exact hc_not_Ico t₁ (Or.inr ⟨s, ⟨s.2.1, hs_lt⟩, h1.symm⟩) + subst hs1 + have ht₁_not_Ioo : t₁ ∉ Ioo (0 : unitInterval) 1 := by + intro ht₁ + rcases hcs with ⟨h1, _⟩ | ⟨h1, _⟩ + · exact (hc_disj t₁ ht₁).1 ⟨1, h1.symm⟩ + · exact (hc_disj t₁ ht₁).2 ⟨1, h1.symm⟩ + have ht₂_not_Ioo : t₂ ∉ Ioo (0 : unitInterval) 1 := by + intro ht₂ + rcases hcs with ⟨_, h2⟩ | ⟨_, h2⟩ + · exact (hc_disj t₂ ht₂).2 ⟨1, h2.symm⟩ + · exact (hc_disj t₂ ht₂).1 ⟨1, h2.symm⟩ + have ht12_ne : t₁ ≠ t₂ := by + rintro rfl + rcases hcs with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · exact hfg1_ne (h1.symm.trans h2) + · exact hfg1_ne (h2.symm.trans h1) + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t₁ with rfl | rfl | ht₁_Ioo <;> + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t₂ with rfl | rfl | ht₂_Ioo + · exact ht12_ne rfl + · rcases hcs with h01 | h01 + · exact hnot_ends_of_disj hc_inj hc_bd hc'_bd hc_disj hc'_half h01 + · exact hnot_ends_of_disj (c := revCurve c) (c' := c') + (injective_revCurve hc_inj) (by rw [range_revCurve]; exact hc_bd) hc'_bd + (fun t ht => hc_disj _ (hsymm_Ioo ht)) + (by rw [range_revCurve]; exact hc'_half) + ⟨by simpa using h01.2, by simpa using h01.1⟩ + · exact ht₂_not_Ioo ht₂_Ioo + · rcases hcs with h10 | h10 + · exact hnot_ends_of_disj (c := revCurve c) (c' := c') + (injective_revCurve hc_inj) (by rw [range_revCurve]; exact hc_bd) hc'_bd + (fun t ht => hc_disj _ (hsymm_Ioo ht)) + (by rw [range_revCurve]; exact hc'_half) + ⟨by simpa using h10.1, by simpa using h10.2⟩ + · exact hnot_ends_of_disj hc_inj hc_bd hc'_bd hc_disj hc'_half ⟨h10.2, h10.1⟩ + · exact ht12_ne rfl + · exact ht₂_not_Ioo ht₂_Ioo + · exact ht₁_not_Ioo ht₁_Ioo + · exact ht₁_not_Ioo ht₁_Ioo + · exact ht₁_not_Ioo ht₁_Ioo + +/-- Excluding Case 2 / Subcase B2c (`(N.F₂ v).card = 0` and `(N.F₁ v).card = 1`): a single +non-loop seam pair incident with an interior vertex `v ∉ bd S` and no other seam pairs incident +with `v` cannot occur in a minimal net `N` on a surface `S` not homeomorphic to `Σ(0, 0, 0)`, +`Σ(0, 1, 0)`, or `Σ(0, 0, 1)`. -/ +theorem not_one_pair_at_interior_vertex (hS : IsSurface S) + (h000 : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 0)) + (h010 : ¬ Nonempty (S ≃ₜ SurfaceModel 0 1 0)) + (h001 : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 1)) + {G : Drawing S} (N : Net S) (hmin : N.IsMinimalFor G) + {v : S} (hv_not_bd : v ∉ bd S) {i₀ : Fin N.r} + (hi₀_0 : N.φ (N.f i₀ 0) = v) (hi₀_1 : N.φ (N.f i₀ 1) ≠ v) + (hother : ∀ j : Fin N.r, j ≠ i₀ → N.φ (N.f j 0) ≠ v ∧ N.φ (N.f j 1) ≠ v) : + False := by + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hv_seamV : v ∈ N.seamV := ⟨i₀, Or.inl hi₀_0⟩ + have hsymm_Ioo : ∀ {t : unitInterval}, t ∈ Ioo (0 : unitInterval) 1 → + unitInterval.symm t ∈ Ioo (0 : unitInterval) 1 := by + intro t ht + have ht0 : (0 : ℝ) < t := Subtype.coe_lt_coe.mpr ht.1 + have ht1 : (t : ℝ) < 1 := Subtype.coe_lt_coe.mpr ht.2 + constructor <;> rw [← Subtype.coe_lt_coe] + · change (0 : ℝ) < 1 - (t : ℝ); linarith + · change 1 - (t : ℝ) < 1; linarith + let t_half : unitInterval := ⟨1 / 2, ⟨by norm_num, by norm_num⟩⟩ + have ht_half : t_half ∈ Ioo (0 : unitInterval) 1 := by + constructor <;> rw [← Subtype.coe_lt_coe] + · change (0 : ℝ) < 1 / 2; norm_num + · change (1 / 2 : ℝ) < 1; norm_num + have hstep_v : ∀ {j : Fin N.r} {t : unitInterval}, N.φ (N.f j t) = v → j = i₀ ∧ t = 0 := by + intro j t hφft + by_cases hj : j = i₀ + · cases hj + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact ⟨rfl, rfl⟩ + · exact False.elim (hi₀_1 hφft) + · exact False.elim (N.notMem_seamV_of_mem_Ioo i₀ ht (hφft.symm ▸ hv_seamV)) + · exact False.elim (N.not_φ_eq_of_mem_range_fg hv_seamV (hother j hj).1 + (hother j hj).2 (Or.inl ⟨t, rfl⟩) hφft) + have hfg0 : N.f i₀ 0 = N.g i₀ 0 := by + rcases N.mem_other_range_of_φ_f_eq hS hv_not_bd (Or.inl rfl) hi₀_0 with + ⟨j, hj, t, ht⟩ | ⟨j, t, ht⟩ + · exact False.elim (hj (hstep_v ((congr_arg N.φ ht).trans hi₀_0)).1) + · rcases hstep_v ((N.pasting_eq j t).trans ((congr_arg N.φ ht).trans hi₀_0)) with ⟨rfl, rfl⟩ + exact ht.symm + have hfg1_ne : N.f i₀ 1 ≠ N.g i₀ 1 := by + exact single_pair_has_distinct_final_ends (S := S) hS h000 h010 h001 (G := G) N hmin (v := v) + hv_not_bd (i₀ := i₀) hi₀_0 t_half ht_half hfg0 + obtain ⟨π, hπ_quot, hπ_eq_iff, hπ_bd⟩ := + N.exists_fold_quotient hfg0 hfg1_ne + have hπ_cont : Continuous π := hπ_quot.continuous + have hπ_surj : Function.Surjective π := hπ_quot.surjective + let φ' : N.D → S := fun z => N.φ (Function.surjInv hπ_surj z) + have hφ'_π : ∀ x : N.D, φ' (π x) = N.φ x := by + intro x + change N.φ (Function.surjInv hπ_surj (π x)) = N.φ x + have hπ_inv : π (Function.surjInv hπ_surj (π x)) = π x := + Function.surjInv_eq hπ_surj (π x) + rcases (hπ_eq_iff _ _).mp hπ_inv with heq | ⟨t, ⟨h1, h2⟩ | ⟨h1, h2⟩⟩ + · rw [heq] + · rw [h1, h2, N.pasting_eq i₀ t] + · rw [h1, h2, ← N.pasting_eq i₀ t] + have hφ'_cont : Continuous φ' := by + rw [hπ_quot.continuous_iff] + have : φ' ∘ π = N.φ := funext hφ'_π + rw [this] + exact N.quotientMap_φ.continuous + have hφ'_surj : Function.Surjective φ' := by + intro y + obtain ⟨x, rfl⟩ := N.quotientMap_φ.surjective y + exact ⟨π x, hφ'_π x⟩ + have hφ'_quot : Topology.IsQuotientMap φ' := + (hφ'_cont.isClosedMap).isQuotientMap hφ'_cont hφ'_surj + by_cases hr2 : 2 ≤ N.r + · have hrev_f1 : (revCurve (N.f i₀)) 1 = N.g i₀ 0 := by simpa using hfg0 + let c_fold : Curve N.D := concatCurve (revCurve (N.f i₀)) (N.g i₀) hrev_f1 + have hinj_c_fold : Function.Injective c_fold := + injective_concatCurve hrev_f1 (injective_revCurve (N.injective_f i₀)) (N.injective_g i₀) + (by simpa using hfg1_ne) + (fun t ht => N.internally_disjoint_fg i₀ i₀ _ (hsymm_Ioo ht)) + (fun t ht => by rw [range_revCurve]; exact N.internally_disjoint_gf i₀ i₀ t ht) + have hrange_c_fold : range c_fold = range (N.f i₀) ∪ range (N.g i₀) := by + change range (concatCurve (revCurve (N.f i₀)) (N.g i₀) hrev_f1) = _ + rw [range_concatCurve, range_revCurve] + have hr_c_fold : range c_fold ⊆ bd N.D := + hrange_c_fold ▸ union_subset (N.range_f_subset_bd i₀) (N.range_g_subset_bd i₀) + have hc_fold_0 : c_fold 0 = N.f i₀ 1 := by + change concatCurve (revCurve (N.f i₀)) (N.g i₀) hrev_f1 0 = N.f i₀ 1 + rw [concatCurve_zero, revCurve_zero] + have hc_fold_1 : c_fold 1 = N.g i₀ 1 := by + change concatCurve (revCurve (N.f i₀)) (N.g i₀) hrev_f1 1 = N.g i₀ 1 + rw [concatCurve_one] + have hnot_Ico_of_ne : ∀ {j : Fin N.r} (hj : j ≠ i₀) {x : N.D}, + x ∈ range (N.f j) ∪ range (N.g j) → + x ∉ N.f i₀ '' Ico (0 : unitInterval) 1 ∪ N.g i₀ '' Ico (0 : unitInterval) 1 := by + exact other_pairs_avoid_fold_endpoints (S := S) N (v := v) (i₀ := i₀) hi₀_0 hother hv_seamV + have hnot_ends_of_disj : ∀ {c c' : Curve N.D}, + Function.Injective c → range c ⊆ bd N.D → range c' ⊆ bd N.D → + (∀ t ∈ Ioo (0 : unitInterval) 1, c t ∉ range (N.f i₀) ∧ c t ∉ range (N.g i₀)) → + (c' t_half ∉ range c ∧ c' t_half ∉ range (N.f i₀) ∧ c' t_half ∉ range (N.g i₀)) → + ¬ (c 0 = N.f i₀ 1 ∧ c 1 = N.g i₀ 1) := by + exact another_curve_excludes_fold_end_pair (S := S) N (i₀ := i₀) t_half c_fold hinj_c_fold + hrange_c_fold hr_c_fold hc_fold_0 hc_fold_1 + have hinj_π_curve : ∀ {c c' : Curve N.D}, + Function.Injective c → range c ⊆ bd N.D → range c' ⊆ bd N.D → + (∀ t : unitInterval, c t ∉ N.f i₀ '' Ico (0 : unitInterval) 1 ∪ N.g i₀ '' Ico + (0 : unitInterval) 1) → + (∀ t ∈ Ioo (0 : unitInterval) 1, c t ∉ range (N.f i₀) ∧ c t ∉ range (N.g i₀)) → + (c' t_half ∉ range c ∧ c' t_half ∉ range (N.f i₀) ∧ c' t_half ∉ range (N.g i₀)) → + Function.Injective (π ∘ c) := by + exact fold_injective_on_remaining_curve (S := S) N (i₀ := i₀) hsymm_Ioo t_half hfg1_ne π + hπ_eq_iff hnot_ends_of_disj + let e : Fin (N.r - 1 + 1) ≃ Fin N.r := finCongr (by omega) + let i₀' : Fin (N.r - 1 + 1) := e.symm i₀ + let idx (k : Fin (N.r - 1)) : Fin N.r := e (i₀'.succAbove k) + have hidx_inj : Function.Injective idx := e.injective.comp Fin.succAbove_right_injective + have hidx_ne : ∀ k : Fin (N.r - 1), idx k ≠ i₀ := by + intro k h + have : i₀'.succAbove k = i₀' := e.injective (by simpa [idx, i₀'] using h) + exact Fin.succAbove_ne i₀' k this + have hsurj_other : ∀ j : Fin N.r, j ≠ i₀ → ∃ k : Fin (N.r - 1), idx k = j := by + intro j hj + have hj'_ne : e.symm j ≠ i₀' := fun h => hj (e.symm.injective h) + obtain ⟨k, hk⟩ := Fin.exists_succAbove_eq hj'_ne + exact ⟨k, by simp [idx, hk]⟩ + have hπ_single_of_notMem : ∀ {x y : N.D}, + x ∉ range (N.f i₀) ∧ x ∉ range (N.g i₀) → (π x = π y ↔ x = y) := by + intro x y ⟨hxf, hxg⟩ + rw [hπ_eq_iff] + constructor + · rintro (rfl | ⟨s, ⟨rfl, _⟩ | ⟨rfl, _⟩⟩) + · rfl + · exact False.elim (hxf ⟨s, rfl⟩) + · exact False.elim (hxg ⟨s, rfl⟩) + · exact Or.inl + let N' : Net S := + collapse_single_net_pair (S := S) N (v := v) hv_not_bd (i₀ := i₀) hi₀_0 hi₀_1 hother t_half + ht_half hstep_v hfg0 hfg1_ne π hπ_eq_iff hπ_bd hπ_cont hπ_surj φ' hφ'_π hφ'_quot hrev_f1 + hinj_c_fold hrange_c_fold hr_c_fold hc_fold_0 hc_fold_1 hnot_Ico_of_ne hnot_ends_of_disj + hinj_π_curve idx hidx_inj hidx_ne hsurj_other hπ_single_of_notMem + have hseamU_sub : N'.seamU ⊆ N.seamU := by + rintro _ ⟨z, hz_bd, rfl⟩ + obtain ⟨x, rfl⟩ := hπ_surj z + change φ' (π x) ∈ N.seamU + rw [hφ'_π] + exact ⟨x, ((hπ_bd x).mp hz_bd).1, rfl⟩ + have hN_norm := (N.isNormalFor_iff hS G).mp hmin.1 + have hN'_norm : N'.IsNormalFor G := by + rw [N'.isNormalFor_iff hS G] + exact ⟨by change 0 < N.r - 1; omega, + (inter_subset_inter_left G.U hseamU_sub).trans hN_norm.2⟩ + have hcard_le : N'.bdVertexPreimageCard G ≤ N.bdVertexPreimageCard G := by + refine Set.ncard_le_ncard_of_injOn (Function.surjInv hπ_surj) + (fun z hz => ⟨?_, ?_⟩) + (fun _ _ _ _ h => Function.injective_surjInv hπ_surj h) + ((N.finite_preimage G.finite_V).subset inter_subset_left) + · change N.φ (Function.surjInv hπ_surj z) ∈ G.V + exact hz.1 + ·exact ((hπ_bd _).mp (by rw [Function.surjInv_eq hπ_surj]; exact hz.2)).1 + have hle : N.r ≤ N'.r := hmin.2.2 N' hN'_norm hcard_le + change N.r ≤ N.r - 1 at hle + omega + · have hr1 : N.r = 1 := by + have := i₀.2 + omega + have hall_i₀ : ∀ j : Fin N.r, j = i₀ := by + intro j + ext + omega + have hφ'_inj : Function.Injective φ' := by + intro z₁ z₂ heq + obtain ⟨x₁, rfl⟩ := hπ_surj z₁ + obtain ⟨x₂, rfl⟩ := hπ_surj z₂ + rw [hφ'_π, hφ'_π, N.bd_eq_iff x₁ x₂] at heq + induction heq with + | rel a b hab => + rcases hab with ⟨j, t, rfl, rfl⟩ + rw [hall_i₀ j] + exact (hπ_eq_iff _ _).mpr (Or.inr ⟨t, Or.inl ⟨rfl, rfl⟩⟩) + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ ih1 ih2 => exact ih1.trans ih2 + let e_φ' : N.D ≃ₜ S := + hφ'_cont.homeoOfEquivCompactToT2 (f := Equiv.ofBijective φ' ⟨hφ'_inj, hφ'_surj⟩) + obtain ⟨e_D⟩ := N.isClosedDisc_D + obtain ⟨e_001⟩ := nonempty_disc_homeo + exact h001 ⟨e_φ'.symm.trans ((Homeomorph.Set.univ N.D).symm.trans (e_D.symm.trans e_001.symm))⟩ + +end Net + +/-- Graph Minors VII, (2.3) (pages 216–217): +"(2.3) *Let $\Sigma$ be a connected surface with $\Sigma \not\cong \Sigma(0, 0, 0)$, $\Sigma(0, 0, +1)$, +... $\Sigma(0, 1, 0)$. Let $J$ be the seam graph for some minimal net with respect to some proper +graph +$G$ in $\Sigma$. Then no vertex of $J$ has valency $\le 2$.*" -/ +theorem minimalNet_minValency (S : Type u) [TopologicalSpace S] + (hS : IsSurface S) (_hconn : ConnectedSpace S) + (h000 : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 0)) + (h001 : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 1)) + (h010 : ¬ Nonempty (S ≃ₜ SurfaceModel 0 1 0)) + (G J : Drawing S) (N : Net S) + (_hG : G.IsProper) (hmin : N.IsMinimalFor G) (hJ : N.IsSeamGraphFor J) + (v : S) (hv : v ∈ J.V) : + 3 ≤ vertexValency J v := by + open Net in + have : T2Space S := hS.2.1 + by_cases hv_bd : v ∈ bd S + · exact N.three_le_vertexValency_of_mem_bd hS hJ hv hv_bd + · have hle := N.card_F₁_add_two_mul_card_F₂_le_vertexValency hJ v + have hv_seamV : v ∈ N.seamV := hJ.2.2 ▸ hv + rcases hv_seamV with ⟨i₀, hi₀⟩ + have hpos : 1 ≤ (N.F₁ v).card + 2 * (N.F₂ v).card := by + by_cases h1 : i₀ ∈ N.F₁ v + · have : 1 ≤ (N.F₁ v).card := Finset.card_pos.mpr ⟨i₀, h1⟩ + omega + · have h2 : i₀ ∈ N.F₂ v := by + by_contra h2 + rcases (N.notMem_F₁_and_notMem_F₂_iff v i₀).mp ⟨h1, h2⟩ with ⟨hne0, hne1⟩ + exact hi₀.elim hne0 hne1 + have : 1 ≤ (N.F₂ v).card := Finset.card_pos.mpr ⟨i₀, h2⟩ + omega + by_contra! hlt + have hcases : + ((N.F₂ v).card = 1 ∧ (N.F₁ v).card = 0) ∨ + ((N.F₂ v).card = 0 ∧ (N.F₁ v).card = 1) ∨ + ((N.F₂ v).card = 0 ∧ (N.F₁ v).card = 2) := by + omega + rcases hcases with ⟨hF₂_1, hF₁_0⟩ | ⟨hF₂_0, hF₁_1⟩ | ⟨hF₂_0, hF₁_2⟩ + · obtain ⟨i, hi_eq⟩ := Finset.card_eq_one.mp hF₂_1 + have hi_F₂ : i ∈ N.F₂ v := hi_eq ▸ Finset.mem_singleton_self i + obtain ⟨hi_0, hi_1⟩ := (N.mem_F₂_iff v i).mp hi_F₂ + have hother : ∀ j : Fin N.r, j ≠ i → N.φ (N.f j 0) ≠ v ∧ N.φ (N.f j 1) ≠ v := by + intro j hj + refine (N.notMem_F₁_and_notMem_F₂_iff v j).mp ⟨?_, ?_⟩ + · rw [Finset.card_eq_zero.mp hF₁_0]; exact Finset.notMem_empty j + · rw [hi_eq, Finset.mem_singleton]; exact hj + exact N.not_loop_only_at_interior_vertex hS h000 h010 h001 hJ hv_bd i hi_0 hi_1 hother + · obtain ⟨i, hi_eq⟩ := Finset.card_eq_one.mp hF₁_1 + have hi_F₁ : i ∈ N.F₁ v := hi_eq ▸ Finset.mem_singleton_self i + have hother : ∀ j : Fin N.r, j ≠ i → N.φ (N.f j 0) ≠ v ∧ N.φ (N.f j 1) ≠ v := by + intro j hj + refine (N.notMem_F₁_and_notMem_F₂_iff v j).mp ⟨?_, ?_⟩ + · rw [hi_eq, Finset.mem_singleton]; exact hj + · rw [Finset.card_eq_zero.mp hF₂_0]; exact Finset.notMem_empty j + rcases (N.mem_F₁_iff v i).mp hi_F₁ with ⟨hi_0, hi_1⟩ | ⟨hi_0, hi_1⟩ + · exact N.not_one_pair_at_interior_vertex hS h000 h010 h001 hmin hv_bd hi_0 hi_1 hother + · refine (N.revPair i).not_one_pair_at_interior_vertex hS h000 h010 h001 + ((N.isMinimalFor_revPair i G).mpr hmin) hv_bd (i₀ := i) + (by change N.φ ((if i = i then revCurve (N.f i) else N.f i) 0) = v; simpa using hi_1) + (by change N.φ ((if i = i then revCurve (N.f i) else N.f i) 1) ≠ v; simpa using hi_0) + (by change ∀ j : Fin N.r, j ≠ i → + N.φ ((if j = i then revCurve (N.f j) else N.f j) 0) ≠ v ∧ + N.φ ((if j = i then revCurve (N.f j) else N.f j) 1) ≠ v + intro j hj; rw [ite_eq_right hj]; exact hother j hj) + · obtain ⟨i₁, i₂, h12_ne, hF₁_eq⟩ := Finset.card_eq_two.mp hF₁_2 + have hi₁_F₁ : i₁ ∈ N.F₁ v := hF₁_eq ▸ Finset.mem_insert_self i₁ {i₂} + have hi₂_F₁ : i₂ ∈ N.F₁ v := + hF₁_eq ▸ Finset.mem_insert_of_mem (Finset.mem_singleton_self i₂) + have hother : ∀ j : Fin N.r, j ≠ i₁ → j ≠ i₂ → N.φ (N.f j 0) ≠ v ∧ N.φ (N.f j 1) ≠ v := by + intro j hj₁ hj₂ + refine (N.notMem_F₁_and_notMem_F₂_iff v j).mp ⟨?_, ?_⟩ + · rw [hF₁_eq, Finset.mem_insert, Finset.mem_singleton] + exact not_or.mpr ⟨hj₁, hj₂⟩ + · rw [Finset.card_eq_zero.mp hF₂_0]; exact Finset.notMem_empty j + have haux₁ : ∀ (M : Net S) (hM_min : M.IsMinimalFor G) {k₁ k₂ : Fin M.r} (hk12 : k₁ ≠ k₂), + M.φ (M.f k₁ 0) ≠ v → M.φ (M.f k₁ 1) = v → + ((M.φ (M.f k₂ 0) = v ∧ M.φ (M.f k₂ 1) ≠ v) ∨ + (M.φ (M.f k₂ 0) ≠ v ∧ M.φ (M.f k₂ 1) = v)) → + (∀ j : Fin M.r, j ≠ k₁ → j ≠ k₂ → M.φ (M.f j 0) ≠ v ∧ M.φ (M.f j 1) ≠ v) → + False := by + intro M hM_min k₁ k₂ hk12 hk₁_0 hk₁_1 hk₂ hM_other + rcases hk₂ with ⟨hk₂_0, hk₂_1⟩ | ⟨hk₂_0, hk₂_1⟩ + · exact M.not_two_pairs_at_interior_vertex hS hM_min hv_bd hk12 + hk₁_0 hk₁_1 hk₂_0 hk₂_1 hM_other + · refine (M.revPair k₂).not_two_pairs_at_interior_vertex hS + ((M.isMinimalFor_revPair k₂ G).mpr hM_min) hv_bd hk12 + (by change M.φ ((if k₁ = k₂ then revCurve (M.f k₁) else M.f k₁) 0) ≠ v + rw [ite_eq_right hk12]; exact hk₁_0) + (by change M.φ ((if k₁ = k₂ then revCurve (M.f k₁) else M.f k₁) 1) = v + rw [ite_eq_right hk12]; exact hk₁_1) + (by change M.φ ((if k₂ = k₂ then revCurve (M.f k₂) else M.f k₂) 0) = v + simpa using hk₂_1) + (by change M.φ ((if k₂ = k₂ then revCurve (M.f k₂) else M.f k₂) 1) ≠ v + simpa using hk₂_0) + (by change ∀ j : Fin M.r, j ≠ k₁ → j ≠ k₂ → + M.φ ((if j = k₂ then revCurve (M.f j) else M.f j) 0) ≠ v ∧ + M.φ ((if j = k₂ then revCurve (M.f j) else M.f j) 1) ≠ v + intro j hj₁ hj₂; rw [ite_eq_right hj₂]; exact hM_other j hj₁ hj₂) + rcases (N.mem_F₁_iff v i₁).mp hi₁_F₁ with ⟨hi₁_0, hi₁_1⟩ | ⟨hi₁_0, hi₁_1⟩ + · refine haux₁ (N.revPair i₁) ((N.isMinimalFor_revPair i₁ G).mpr hmin) h12_ne + (by change N.φ ((if i₁ = i₁ then revCurve (N.f i₁) else N.f i₁) 0) ≠ v; simpa using hi₁_1) + (by change N.φ ((if i₁ = i₁ then revCurve (N.f i₁) else N.f i₁) 1) = v; simpa using hi₁_0) + (by change (N.φ ((if i₂ = i₁ then revCurve (N.f i₂) else N.f i₂) 0) = v ∧ + N.φ ((if i₂ = i₁ then revCurve (N.f i₂) else N.f i₂) 1) ≠ v) ∨ + (N.φ ((if i₂ = i₁ then revCurve (N.f i₂) else N.f i₂) 0) ≠ v ∧ + N.φ ((if i₂ = i₁ then revCurve (N.f i₂) else N.f i₂) 1) = v) + rw [ite_eq_right h12_ne.symm]; exact (N.mem_F₁_iff v i₂).mp hi₂_F₁) + (by change ∀ j : Fin N.r, j ≠ i₁ → j ≠ i₂ → + N.φ ((if j = i₁ then revCurve (N.f j) else N.f j) 0) ≠ v ∧ + N.φ ((if j = i₁ then revCurve (N.f j) else N.f j) 1) ≠ v + intro j hj₁ hj₂; rw [ite_eq_right hj₁]; exact hother j hj₁ hj₂) + · exact haux₁ N hmin h12_ne hi₁_0 hi₁_1 ((N.mem_F₁_iff v i₂).mp hi₂_F₁) hother + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section2Seam.lean b/LeanPool/GraphMinor/GM07/Section2Seam.lean new file mode 100644 index 0000000000..db1fd38a66 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section2Seam.lean @@ -0,0 +1,187 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section2Base +public import LeanPool.GraphMinor.GM07.Section2MinVal +import LeanPool.GraphMinor.GM11.PerimeterPull +import LeanPool.GraphMinor.Surface.DiscsInSurface +import LeanPool.GraphMinor.Surface.SphereDisc + +/-! +# Graph Minors VII, (2.1): seam graphs as printed + +Graph Minors VII, (2.1) (page 215), says that a graph `J` in `Σ` is a seam graph for some net if +and only if + +* (i) `bd(Σ) ⊆ U(J)`, and every edge of `J` is either included in `bd(Σ)` or disjoint from it; +* (ii) `J - bd(Σ)` has no isolated vertices; +* (iii) `J` has a unique region; and +* (iv) every `O`-arc included in that region is null-homotopic. + +This file proves conditions (i) and (ii) for seam graphs; `theorem_2_1_forward` +(`GraphMinor/GM07/Section2.lean`) then gives the forward direction with all four conditions as +printed. Condition (ii) uses `deleteBd`, the paper's `J - bd(Σ)` from page 214, +which keeps every vertex of `J` and the edges of `J` that miss `bd(Σ)`. The two new facts are that +the open image of each pasted side is an edge of `J` that misses `bd(Σ)` (`Net.e_int_mem_E`, +`Net.disjoint_e_int_bd`), and that every other edge of `J` lies in `bd(Σ)` +(`Net.seamGraph_edges_eq`). + +The printed converse is false. A seam graph needs a pair, since the paper defines it only "provided +that $\Pi \ne \emptyset$". The empty graph in the sphere satisfies (i)–(iv), and it has no vertex, +so +it is not a seam graph (`not_theorem_2_1_proof`). A graph whose point set is not connected, such as +two +disjoint edges in the sphere, is another counterexample, since the point set of a seam graph is the +image of a circle. The converse for `U(J)` connected is in `GraphMinor/GM07/Section2Converse.lean`. +If `U(J)` is not empty, then (i) and (ii) give an edge of `J` that misses `bd(Σ)` +(`exists_edge_disjoint_bd_of_nonempty`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +namespace Net + +/-- Condition (i) of Graph Minors VII, (2.1) (page 215), for a seam graph. The pasted sides give +edges that miss `bd(Σ)`, and every other edge is a piece of `bd(Σ)` (`seamGraph_edges_eq`). This is +the paper's "the sets $\{f_i(x) \colon 0 < x < 1\}$ $(1 \le i \le r)$ are all edges of $J$, and each +is disjoint from $bd(\Sigma)$; and any other edge of $J$ is included in $bd(\Sigma)$" (page 216). -/ +theorem bd_subset_and_edges_seamGraph (hS : IsSurface S) (N : Net S) {J : Drawing S} + (hJ : N.IsSeamGraphFor J) : + bd S ⊆ J.U ∧ ∀ e ∈ J.E, e ⊆ bd S ∨ e ∩ bd S = ∅ := by + have : T2Space S := hS.2.1 + refine ⟨hJ.2.1 ▸ N.bd_subset_seamU, fun e he => ?_⟩ + rw [(N.seamGraph_edges_eq hS hJ).1] at he + rcases he with ⟨i, rfl⟩ | he + · exact Or.inr (disjoint_iff_inter_eq_empty.mp (N.disjoint_e_int_bd hS i)) + · exact Or.inl (he.2.1.trans sdiff_subset) + +/-- Condition (ii) of Graph Minors VII, (2.1) (page 215), for a seam graph: `J - bd(Σ)` has no +isolated vertices. Each vertex of `J` is an end `φ(f_i(0))` or `φ(f_i(1))` of some pair, and the +open image of `f_i` is an edge of `J` that misses `bd(Σ)` and has this vertex in its closure. -/ +theorem hasNoIsolatedVertices_deleteBd_seamGraph [T1Space S] (hS : IsSurface S) (N : Net S) + {J : Drawing S} (hJ : N.IsSeamGraphFor J) : HasNoIsolatedVertices (deleteBd J) := by + have : T2Space S := hS.2.1 + intro v hv + have hvJ : v ∈ J.V := J.spanV_subset _ _ hv + have hv' : v ∈ N.seamV := hJ.2.2 ▸ hvJ + obtain ⟨i, hi⟩ := hv' + have heE : N.interiorSeamEdge i ∈ J.E := N.e_int_mem_E hJ i + have hdisj : N.interiorSeamEdge i ∩ bd S = ∅ := + disjoint_iff_inter_eq_empty.mp (N.disjoint_e_int_bd hS i) + have hcl : v ∈ closure (N.interiorSeamEdge i) := by + have h := N.tilde_e_int hJ i + rw [tilde_eq_closure_inter_V J heE] at h + have hmem : v ∈ closure (N.interiorSeamEdge i) ∩ J.V := by + rw [h] + rcases hi with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + exact hmem.1 + have hE : N.interiorSeamEdge i ∈ (deleteBd J).E := by + rw [deleteBd, Drawing.span_E] + exact ⟨⟨heE, hdisj⟩, heE⟩ + exact ⟨N.interiorSeamEdge i, hE, hv, Or.inl hE, hcl⟩ + +end Net + +/-! ## The printed converse fails -/ + +theorem emptyDrawing_E : (emptyDrawing S).E = ∅ := by + ext e + refine ⟨fun he => ?_, fun he => he.elim⟩ + exact he.1.ne_empty (subset_empty_iff.mp (he.2.1.trans sdiff_subset)) + +/-- In a sphere, the empty graph satisfies conditions (i)–(iv) of Graph Minors VII, (2.1) +(page 215). The sphere has no boundary, so (i) and (ii) hold trivially. Its only region is the +whole sphere, and every `O`-arc of the sphere bounds a closed disc (`sphere_disc`), so it is +null-homotopic. -/ +theorem emptyDrawing_conditions_of_isSphere [T1Space S] (hS : IsSphere S) : + (bd S ⊆ (emptyDrawing S).U ∧ ∀ e ∈ (emptyDrawing S).E, e ⊆ bd S ∨ e ∩ bd S = ∅) ∧ + HasNoIsolatedVertices (deleteBd (emptyDrawing S)) ∧ + (emptyDrawing S).R.ncard = 1 ∧ + (∀ r ∈ (emptyDrawing S).R, ∀ F : Set S, F ⊆ r → IsOArc F → IsNullHomotopicOArc F) := by + obtain ⟨hcl, hconn⟩ := GM11.IsSphere.isClosedSurface hS + have hbd : bd S = ∅ := eq_empty_iff_forall_notMem.mpr fun x hx => hx (hcl.2.2 x) + have hR : (emptyDrawing S).R = {univ} := by + ext r + simp only [Drawing.R, componentsIn, mem_image, mem_singleton_iff] + have hU : (emptyDrawing S).U = ∅ := rfl + rw [hU, sdiff_empty] + constructor + · rintro ⟨x, -, rfl⟩ + rw [connectedComponentIn_univ, PreconnectedSpace.connectedComponent_eq_univ] + · rintro rfl + obtain ⟨x⟩ := hconn.toNonempty + exact ⟨x, mem_univ x, by rw [connectedComponentIn_univ, + PreconnectedSpace.connectedComponent_eq_univ]⟩ + refine ⟨⟨hbd ▸ empty_subset _, fun e he => by rw [emptyDrawing_E] at he; exact he.elim⟩, + fun v hv => ((emptyDrawing S).spanV_subset _ _ hv).elim, by rw [hR, ncard_singleton], + fun _ _ F _ hF => ?_⟩ + obtain ⟨Δ, -, -, hΔ, -, hΔF, -⟩ := sphere_disc S hS F hF + exact isNullHomotopicOArcIn_of_subset_disc hF (subset_univ Δ) hΔ (hΔF ▸ discBd_subset Δ) + +/-- **Graph Minors VII, (2.1)**: the printed converse is false. In the sphere, the empty graph +satisfies (i)–(iv) (`emptyDrawing_conditions_of_isSphere`), but it is not a seam graph, because a +seam graph is defined only "provided that $\Pi \ne \emptyset$" (page 215), and then it has a vertex +(`not_isSeamGraph_emptyDrawing`). -/ +theorem not_theorem_2_1_proof : + ¬ ∀ (S : Type) [TopologicalSpace S] [T1Space S], IsSurface S → ConnectedSpace S → + ∀ J : Drawing S, + (bd S ⊆ J.U ∧ ∀ e ∈ J.E, e ⊆ bd S ∨ e ∩ bd S = ∅) → + HasNoIsolatedVertices (deleteBd J) → + J.R.ncard = 1 → + (∀ r ∈ J.R, ∀ F : Set S, F ⊆ r → IsOArc F → IsNullHomotopicOArc F) → + IsSeamGraph J := by + intro h + have hS : IsSphere (OnePoint EuclideanPlane) := ⟨Homeomorph.refl _⟩ + obtain ⟨hcl, hconn⟩ := GM11.IsSphere.isClosedSurface hS + have : T2Space (OnePoint EuclideanPlane) := hcl.2.1 + obtain ⟨h1, h2, h3, h4⟩ := emptyDrawing_conditions_of_isSphere hS + exact not_isSeamGraph_emptyDrawing + (h (OnePoint EuclideanPlane) hcl.isSurface hconn _ h1 h2 h3 h4) + +/-- If `J` satisfies conditions (i) and (ii) of Graph Minors VII, (2.1) (page 215), and `U(J)` is +not empty, then some edge of `J` misses `bd(Σ)`. The proof: `J` has a vertex, since a point of +`U(J)` +is either a vertex or lies on an edge, and every edge has an end. By (ii) this vertex is the end of +an +edge of `J - bd(Σ)`, which is an edge of `J` that misses `bd(Σ)`. -/ +theorem exists_edge_disjoint_bd_of_nonempty [T1Space S] {J : Drawing S} + (h2 : HasNoIsolatedVertices (deleteBd J)) (hU : J.U.Nonempty) : + ∃ e ∈ J.E, e ∩ bd S = ∅ := by + obtain ⟨v, hv⟩ : J.V.Nonempty := by + obtain ⟨x, hx⟩ := hU + by_cases hxV : x ∈ J.V + · exact ⟨x, hxV⟩ + · have hxe : x ∈ J.U \ J.V := ⟨hx, hxV⟩ + have he : pathComponentIn (J.U \ J.V) x ∈ J.E := pathComponentIn_mem_arcComponentsIn hxe + rcases J.edge_cond _ he with ⟨u, w, -, huw, -⟩ | ⟨u, hu, -⟩ + · have hu : u ∈ closure (pathComponentIn (J.U \ J.V) x) ∩ J.V := by + rw [huw] + exact Or.inl rfl + exact ⟨u, hu.2⟩ + · have hu' : u ∈ closure (pathComponentIn (J.U \ J.V) x) ∩ J.V := by + rw [hu] + exact rfl + exact ⟨u, hu'.2⟩ + have hvD : v ∈ (deleteBd J).V := Or.inl ⟨hv, hv⟩ + obtain ⟨e, he, -⟩ := h2 v hvD + rw [deleteBd, Drawing.span_E] at he + exact ⟨e, he.1.1, he.1.2⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section3.lean b/LeanPool/GraphMinor/GM07/Section3.lean new file mode 100644 index 0000000000..48a890a085 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section3.lean @@ -0,0 +1,2881 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.GM07.Open +public import LeanPool.GraphMinor.GM07.Section11 +import LeanPool.GraphMinor.GM07.Section11b +import LeanPool.GraphMinor.GM07.Section11f +public import LeanPool.GraphMinor.Surface.CutParallel + +/-! +# Graph Minors VII, Section 3: Matchings and Forests + +This file formalizes Section 3 (pages 218–221) of N. Robertson and P. D. Seymour, +*Graph Minors. VII. Disjoint paths on a surface*, J. Combin. Theory Ser. B 45 (1988) 212–254: +- `(3.1)` (`theorem_3_1`): For any fixed surface `Σ` there are only finitely many similarity + classes of proper `I`-arcs. +- `(3.2)` (`theorem_3_2_claim_1`, `theorem_3_2`): For any fixed surface `Σ` and `s, t ∈ bd(Σ)`, + there are only finitely many parallel classes of `I`-arcs with ends `s, t`. +- `(3.3)` (`theorem_3_3`): For any surface `Σ` and finite `X ⊆ bd(Σ)`, there are only finitely many + congruence classes of `X`-matchings. +- `(3.4)` (`theorem_3_4`): For any surface `Σ` and finite `Y ⊆ bd(Σ)`, there are only finitely many + homoplasty classes of `Y`-forests. +- `(3.5)` (`theorem_3_5`): For every matching `G` in `Σ` and every homoplasty class `ℬ` there + exists `H ∈ ℬ` with `U(G) ∩ U(H)` finite. +- `(3.6)` (`theorem_3_6`): Existence of the bound `w(Σ, k, n)` (`wSurface S k n`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Function Topology GraphMinor.Surface GraphMinor.GM11 + +universe u v w + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Equivalence properties of similarity and parallelism, and Theorem (3.1) -/ + +theorem AreSimilarIArcs.refl (F : Set S) : AreSimilarIArcs F F := + ⟨Homeomorph.refl S, image_id F⟩ + +theorem AreSimilarIArcs.symm {F F' : Set S} (h : AreSimilarIArcs F F') : + AreSimilarIArcs F' F := by + rcases h with ⟨α, rfl⟩ + exact ⟨α.symm, α.symm_image_image F⟩ + +theorem AreSimilarIArcs.trans {F₁ F₂ F₃ : Set S} + (h₁₂ : AreSimilarIArcs F₁ F₂) (h₂₃ : AreSimilarIArcs F₂ F₃) : + AreSimilarIArcs F₁ F₃ := by + rcases h₁₂ with ⟨α, rfl⟩ + rcases h₂₃ with ⟨β, rfl⟩ + refine ⟨α.trans β, ?_⟩ + ext y + simp [Homeomorph.trans_apply] + +theorem AreParallelIArcs.refl (F : Set S) : AreParallelIArcs F F := + ⟨Homeomorph.refl S, image_id F, fun _ _ => rfl⟩ + +theorem AreParallelIArcs.symm {F F' : Set S} (h : AreParallelIArcs F F') : + AreParallelIArcs F' F := by + rcases h with ⟨α, rfl, hbd⟩ + refine ⟨α.symm, α.symm_image_image F, fun x hx => ?_⟩ + exact (α.symm_apply_eq).mpr (hbd x hx).symm + +theorem AreParallelIArcs.trans {F₁ F₂ F₃ : Set S} + (h₁₂ : AreParallelIArcs F₁ F₂) (h₂₃ : AreParallelIArcs F₂ F₃) : + AreParallelIArcs F₁ F₃ := by + rcases h₁₂ with ⟨α, rfl, hα⟩ + rcases h₂₃ with ⟨β, rfl, hβ⟩ + refine ⟨α.trans β, ?_, fun x hx => ?_⟩ + · ext y + simp [Homeomorph.trans_apply] + · simp [Homeomorph.trans_apply, hα x hx, hβ x hx] + +theorem AreParallelIArcs.areSimilarIArcs {F F' : Set S} (h : AreParallelIArcs F F') : + AreSimilarIArcs F F' := by + rcases h with ⟨α, hF, -⟩ + exact ⟨α, hF⟩ + +/-- Graph Minors VII, (3.1) (page 218): +"(3.1) *For any fixed $\Sigma$ there are only finitely many similarity classes.*" -/ +theorem theorem_3_1_proof (hS : IsSurface S) : + ∃ 𝓕 : Set (Set S), 𝓕.Finite ∧ ∀ F : Set S, IsProperIArc F → + ∃ F₀ ∈ 𝓕, AreSimilarIArcs F₀ F := + similarArcsFinite S hS + +/-! ## 2. Circle orientation, cuff signatures, and Theorem (3.2) -/ + +/-- Graph Minors VII, (3.2), Claim (1) (page 219), with the hypothesis of `ParallelArcsStatement` +that `α` fixes `s` and `t` (see the correction to the proof of (3.2) in `corrections/GM07.md`): +"(1) *Let $F, F' \in \mathcal{F}$. If there is a homeomorphism $\alpha \colon \Sigma \to \Sigma$ +with $\alpha(F) = F'$ and with null signature, then $F$ is parallel to $F'$.*" -/ +theorem theorem_3_2_claim_1 {F F' : Set S} {s t : S} (α : S ≃ₜ S) (hS : IsSurface S) + (hne : s ≠ t) (hb : F ∩ bd S = {s, t}) (hb' : F' ∩ bd S = {s, t}) + (hl : IsLineWithEnds F s t) (hl' : IsLineWithEnds F' s t) + (hαF : α '' F = F') (hs : α s = s) (ht : α t = t) (hα : HasNullSignature α) : + AreParallelIArcs F F' := + parallelArcs S F F' s t α hS hne hb hb' hl hl' hαF hs ht hα + +/-- Orientation-preserving circle homeomorphisms are closed under composition. -/ +theorem PreservesCircleOrientation.trans {h₁ h₂ : Circle ≃ₜ Circle} + (H₁ : PreservesCircleOrientation h₁) (H₂ : PreservesCircleOrientation h₂) : + PreservesCircleOrientation (h₁.trans h₂) := by + rcases H₁ with ⟨l₁, hc₁, hm₁, hl₁⟩ + rcases H₂ with ⟨l₂, hc₂, hm₂, hl₂⟩ + refine ⟨l₂ ∘ l₁, hc₂.comp hc₁, hm₂.comp hm₁, fun t => ?_⟩ + simp [Homeomorph.trans_apply, hl₁ t, hl₂ (l₁ t)] + +/-- Orientation-preserving circle homeomorphisms are closed under inversion. -/ +theorem PreservesCircleOrientation.symm {h : Circle ≃ₜ Circle} + (H : PreservesCircleOrientation h) : + PreservesCircleOrientation h.symm := by + rcases H with ⟨l, hc, hm, hl⟩ + have hpi := Real.pi_pos + have hper : ∃ k : ℤ, 1 ≤ k ∧ ∀ t : ℝ, l (t + 2 * Real.pi) = l t + k * (2 * Real.pi) := by + have h0 : Circle.exp (l (0 + 2 * Real.pi)) = Circle.exp (l 0) := by + rw [← hl, ← hl, zero_add, Circle.exp_two_pi, Circle.exp_zero] + obtain ⟨k, hk⟩ := Circle.exp_eq_exp.mp h0 + have hk_pos : (0 : ℝ) < k * (2 * Real.pi) := by + have : l 0 < l (0 + 2 * Real.pi) := hm (by positivity) + linarith + have hk1 : 1 ≤ k := by + have : (0 : ℝ) < k := pos_of_mul_pos_left hk_pos (by positivity) + exact_mod_cast this + refine ⟨k, hk1, fun t => ?_⟩ + set g : ℝ → ℝ := fun x => (l (x + 2 * Real.pi) - l x) / (2 * Real.pi) + have hg_cont : Continuous g := + ((hc.comp (continuous_id.add continuous_const)).sub hc).div_const _ + have hg_int : ∀ x : ℝ, ∃ m : ℤ, g x = m := by + intro x + have hx_eq : Circle.exp (l (x + 2 * Real.pi)) = Circle.exp (l x) := by + rw [← hl, ← hl, Circle.periodic_exp] + obtain ⟨m, hm_eq⟩ := Circle.exp_eq_exp.mp hx_eq + refine ⟨m, ?_⟩ + change (l (x + 2 * Real.pi) - l x) / (2 * Real.pi) = m + have : l (x + 2 * Real.pi) - l x = m * (2 * Real.pi) := by linarith + rw [this, mul_div_cancel_right₀ _ (by positivity)] + obtain ⟨m_t, hmt⟩ := hg_int t + have hk0 : g 0 = k := by + change (l (0 + 2 * Real.pi) - l 0) / (2 * Real.pi) = k + have : l (0 + 2 * Real.pi) - l 0 = k * (2 * Real.pi) := by linarith + rw [this, mul_div_cancel_right₀ _ (by positivity)] + have hmt_eq : (m_t : ℝ) = (k : ℝ) := by + by_contra hne + have hmid_mem : ((m_t : ℝ) + (k : ℝ)) / 2 < (k : ℝ) ∧ (m_t : ℝ) < ((m_t : ℝ) + (k : ℝ)) / 2 ∨ + (k : ℝ) < ((m_t : ℝ) + (k : ℝ)) / 2 ∧ ((m_t : ℝ) + (k : ℝ)) / 2 < (m_t : ℝ) := by + rcases lt_or_gt_of_ne hne with hlt | hgt + · left; constructor <;> linarith + · right; constructor <;> linarith + rcases lt_or_gt_of_ne hne with hlt | hgt + · have hlt' : m_t < k := by exact_mod_cast hlt + have hval : (m_t : ℝ) + 1 / 2 ∈ uIcc (g 0) (g t) := by + rw [hk0, hmt, uIcc_of_ge hlt.le] + have : (m_t : ℝ) + 1 ≤ k := by exact_mod_cast hlt' + constructor <;> linarith + obtain ⟨x, -, hx⟩ := intermediate_value_uIcc hg_cont.continuousOn hval + obtain ⟨m_x, hmx⟩ := hg_int x + have : (m_x : ℝ) = (m_t : ℝ) + 1 / 2 := hmx.symm.trans hx + have h2 : (2 * m_x : ℤ) = (2 * m_t + 1 : ℤ) := by + exact_mod_cast (show (2 * (m_x : ℝ)) = 2 * (m_t : ℝ) + 1 by linarith) + omega + · have hgt' : k < m_t := by exact_mod_cast hgt + have hval : (k : ℝ) + 1 / 2 ∈ uIcc (g 0) (g t) := by + rw [hk0, hmt, uIcc_of_le hgt.le] + have : (k : ℝ) + 1 ≤ m_t := by exact_mod_cast hgt' + constructor <;> linarith + obtain ⟨x, -, hx⟩ := intermediate_value_uIcc hg_cont.continuousOn hval + obtain ⟨m_x, hmx⟩ := hg_int x + have : (m_x : ℝ) = (k : ℝ) + 1 / 2 := hmx.symm.trans hx + have h2 : (2 * m_x : ℤ) = (2 * k + 1 : ℤ) := by + exact_mod_cast (show (2 * (m_x : ℝ)) = 2 * (k : ℝ) + 1 by linarith) + omega + have hdiv : (l (t + 2 * Real.pi) - l t) / (2 * Real.pi) = k := hmt.trans hmt_eq + have := (div_eq_iff (show (2 * Real.pi : ℝ) ≠ 0 by positivity)).mp hdiv + linarith + obtain ⟨k, hk1, hper⟩ := hper + have hn : ∀ n : ℤ, l (n * (2 * Real.pi)) = l 0 + n * (k * (2 * Real.pi)) := by + intro n + induction n using Int.induction_on with + | zero => simp + | succ m ih => + push_cast at ih ⊢ + have : ((m : ℝ) + 1) * (2 * Real.pi) = (m : ℝ) * (2 * Real.pi) + 2 * Real.pi := by ring + rw [this, hper, ih] + ring + | pred m ih => + push_cast at ih ⊢ + have : (-(m : ℝ) - 1) * (2 * Real.pi) + 2 * Real.pi = -(m : ℝ) * (2 * Real.pi) := by ring + have hp := hper ((-(m : ℝ) - 1) * (2 * Real.pi)) + rw [this, ih] at hp + linarith + have hsurj : Surjective l := by + intro y + have hpos : (0 : ℝ) < k * (2 * Real.pi) := by + have : (0 : ℝ) < k := by exact_mod_cast hk1 + positivity + set n : ℤ := ⌊(y - l 0) / (k * (2 * Real.pi))⌋ + have hn_le : l (n * (2 * Real.pi)) ≤ y := by + rw [hn n] + have := Int.floor_le ((y - l 0) / (k * (2 * Real.pi))) + have hmul := (le_div_iff₀ hpos).mp this + linarith + have hy_le : y ≤ l ((n + 1 : ℤ) * (2 * Real.pi)) := by + rw [hn (n + 1)] + have := (Int.lt_floor_add_one ((y - l 0) / (k * (2 * Real.pi)))).le + have hmul := (div_le_iff₀ hpos).mp this + push_cast + linarith + have hle_x : (n : ℝ) * (2 * Real.pi) ≤ ((n + 1 : ℤ) : ℝ) * (2 * Real.pi) := by + push_cast + nlinarith + obtain ⟨x, -, hx⟩ := intermediate_value_Icc hle_x hc.continuousOn ⟨hn_le, hy_le⟩ + exact ⟨x, hx⟩ + let e : ℝ ≃o ℝ := hm.orderIsoOfSurjective l hsurj + have he : ∀ x, e x = l x := fun _ => rfl + refine ⟨e.symm, e.symm.continuous, e.symm.strictMono, fun t => ?_⟩ + apply h.injective + rw [h.apply_symm_apply, hl (e.symm t), ← he, e.apply_symm_apply] + +/-- Conjugating an orientation-preserving circle homeomorphism by `Homeomorph.inv Circle` preserves +orientation. -/ +theorem PreservesCircleOrientation.conj_inv {h : Circle ≃ₜ Circle} + (H : PreservesCircleOrientation h) : + PreservesCircleOrientation ((Homeomorph.inv Circle).trans (h.trans (Homeomorph.inv Circle))) + := by + rcases H with ⟨l, hc, hm, hl⟩ + refine ⟨fun t => -l (-t), (hc.comp continuous_neg).neg, + fun x y hxy => neg_lt_neg (hm (neg_lt_neg hxy)), fun t => ?_⟩ + simp only [Homeomorph.trans_apply] + change (h ((Circle.exp t)⁻¹))⁻¹ = Circle.exp (-l (-t)) + rw [← Circle.exp_neg, hl (-t), ← Circle.exp_neg] + +/-- Every homeomorphism of `Circle` either preserves orientation or preserves orientation after +composing with `Homeomorph.inv Circle`. -/ +theorem preservesCircleOrientation_or_trans_inv (h : Circle ≃ₜ Circle) : + PreservesCircleOrientation h ∨ + PreservesCircleOrientation (h.trans (Homeomorph.inv Circle)) := by + have hpi := Real.pi_pos + let φ : Circle ≃ₜ (univ : Set Circle) := (Homeomorph.Set.univ Circle).symm + have hη : ContinuousOn (fun u : ℝ => (h (ee u) : Circle)) (Icc 0 1) := + (h.continuous.comp continuous_ee).continuousOn + obtain ⟨m, hmc, hm_eq⟩ := exists_lift φ hη (fun _ _ => trivial) + have hm_val : ∀ u ∈ Icc (0 : ℝ) 1, ee (m u) = h (ee u) := by + intro u hu + exact hm_eq u hu + have hinj_ee : InjOn (fun u => ee (m u)) (Ico 0 1) := by + intro x hx y hy hxy + change ee (m x) = ee (m y) at hxy + rw [hm_val x (Ico_subset_Icc_self hx), hm_val y (Ico_subset_Icc_self hy)] at hxy + have he := h.injective hxy + obtain ⟨k, hk⟩ := ee_eq_iff.mp he + have hk0 : k = 0 := by + have h1 : (-1 : ℝ) < k := by linarith [hx.1, hy.2] + have h2 : (k : ℝ) < 1 := by linarith [hx.2, hy.1] + have h3 : -1 < k := by exact_mod_cast h1 + have h4 : k < 1 := by exact_mod_cast h2 + omega + rw [hk, hk0] + simp + have h01 : ee (m 1) = ee (m 0) := by + rw [hm_val 1 (by simp), hm_val 0 (by simp)] + have he10 : ee 1 = ee 0 := by simpa using ee_add_one 0 + rw [he10] + obtain ⟨k, hk⟩ := ee_eq_iff.mp h01 + rcases lift_mono_loop hmc hinj_ee with hmono | hanti + · left + have hk_pos : (0 : ℝ) < k := by + have := hmono (show (0 : ℝ) ∈ Icc 0 1 by simp) (show (1 : ℝ) ∈ Icc 0 1 by simp) zero_lt_one + linarith + have hk1 : 1 ≤ k := by exact_mod_cast hk_pos + have hk_eq : k = 1 := by + by_contra hne + have hk2 : (2 : ℝ) ≤ k := by exact_mod_cast (show 2 ≤ k by omega) + obtain ⟨x, hx, hx_eq⟩ := intermediate_value_Ioo zero_le_one hmc + (show m 0 + 1 ∈ Ioo (m 0) (m 1) by rw [hk]; constructor <;> linarith) + have he : ee (m x) = ee (m 0) := by + rw [hx_eq] + exact ee_add_one (m 0) + have hx0 := hinj_ee ⟨hx.1.le, hx.2⟩ ⟨le_rfl, zero_lt_one⟩ he + linarith [hx.1] + have hm1 : m 1 = m 0 + 1 := by rw [hk, hk_eq]; push_cast; rfl + obtain ⟨h', hh'o, hh'⟩ := exists_circle_homeo hmc hmono hm1 + have h_eq : h' = h := by + apply Homeomorph.ext + intro z + obtain ⟨u, hu, rfl⟩ := exists_param z + rw [hh' u (Ico_subset_Icc_self hu), hm_val u (Ico_subset_Icc_self hu)] + rwa [← h_eq] + · right + have hmc' : ContinuousOn (fun u => -m u) (Icc 0 1) := hmc.neg + have hmono' : StrictMonoOn (fun u => -m u) (Icc 0 1) := + fun x hx y hy hxy => neg_lt_neg (hanti hx hy hxy) + have hk_neg : (k : ℝ) < 0 := by + have := hanti (show (0 : ℝ) ∈ Icc 0 1 by simp) (show (1 : ℝ) ∈ Icc 0 1 by simp) zero_lt_one + linarith + have hk1 : k ≤ -1 := by + have : k < 0 := by exact_mod_cast hk_neg + omega + have hk_eq : k = -1 := by + by_contra hne + have hk2 : (k : ℝ) ≤ -2 := by exact_mod_cast (show k ≤ -2 by omega) + obtain ⟨x, hx, hx_eq⟩ := intermediate_value_Ioo zero_le_one hmc' + (show -m 0 + 1 ∈ Ioo (-m 0) (-m 1) by rw [hk]; constructor <;> linarith) + have hmx : m x = m 0 + (-1 : ℤ) := by push_cast; linarith + have he : ee (m x) = ee (m 0) := by + rw [hmx] + exact ee_add_int (m 0) (-1) + have hx0 := hinj_ee ⟨hx.1.le, hx.2⟩ ⟨le_rfl, zero_lt_one⟩ he + linarith [hx.1] + have hm1 : -m 1 = -m 0 + 1 := by rw [hk, hk_eq]; push_cast; ring + obtain ⟨h', hh'o, hh'⟩ := exists_circle_homeo hmc' hmono' hm1 + have h_eq : h' = h.trans (Homeomorph.inv Circle) := by + apply Homeomorph.ext + intro z + obtain ⟨u, hu, rfl⟩ := exists_param z + have hu' := Ico_subset_Icc_self hu + rw [hh' u hu'] + change ee (-m u) = (h (ee u))⁻¹ + rw [← hm_val u hu'] + unfold ee + rw [← Circle.exp_neg] + ring_nf + rwa [← h_eq] + +/-- Conjugating an orientation-preserving circle homeomorphism by ANY circle homeomorphism `ψ` +preserves orientation. -/ +theorem PreservesCircleOrientation.conj {h : Circle ≃ₜ Circle} + (H : PreservesCircleOrientation h) (ψ : Circle ≃ₜ Circle) : + PreservesCircleOrientation (ψ.symm.trans (h.trans ψ)) := by + rcases preservesCircleOrientation_or_trans_inv ψ.symm with hψ | hψ + · exact PreservesCircleOrientation.trans hψ + (PreservesCircleOrientation.trans H (PreservesCircleOrientation.symm hψ)) + · have h_inv_symm : (Homeomorph.inv Circle).symm = Homeomorph.inv Circle := rfl + have h_eq : ψ.symm.trans (h.trans ψ) = + (ψ.symm.trans (Homeomorph.inv Circle)).trans + (((Homeomorph.inv Circle).trans (h.trans (Homeomorph.inv Circle))).trans + (ψ.symm.trans (Homeomorph.inv Circle)).symm) := by + apply Homeomorph.ext + intro z + simp only [Homeomorph.trans_apply, Homeomorph.symm_trans_apply, Homeomorph.symm_symm, + h_inv_symm] + change ψ (h (ψ.symm z)) = ψ ((h ((ψ.symm z)⁻¹)⁻¹)⁻¹)⁻¹ + rw [inv_inv, inv_inv] + rw [h_eq] + exact PreservesCircleOrientation.trans hψ + (PreservesCircleOrientation.trans (PreservesCircleOrientation.conj_inv H) + (PreservesCircleOrientation.symm hψ)) + +/-- If two circle homeomorphisms `h₁, h₂` have the same orientation parity, then `h₁.trans h₂.symm` +preserves orientation. -/ +theorem preservesCircleOrientation_trans_symm_of_iff {h₁ h₂ : Circle ≃ₜ Circle} + (hiff : PreservesCircleOrientation h₁ ↔ PreservesCircleOrientation h₂) : + PreservesCircleOrientation (h₁.trans h₂.symm) := by + by_cases h1 : PreservesCircleOrientation h₁ + · exact PreservesCircleOrientation.trans h1 (PreservesCircleOrientation.symm (hiff.mp h1)) + · have h2 : ¬ PreservesCircleOrientation h₂ := fun h => h1 (hiff.mpr h) + have h1' : PreservesCircleOrientation (h₁.trans (Homeomorph.inv Circle)) := + (preservesCircleOrientation_or_trans_inv h₁).resolve_left h1 + have h2' : PreservesCircleOrientation (h₂.trans (Homeomorph.inv Circle)) := + (preservesCircleOrientation_or_trans_inv h₂).resolve_left h2 + have hcomb := PreservesCircleOrientation.trans h1' (PreservesCircleOrientation.symm h2') + have h_inv_symm : (Homeomorph.inv Circle).symm = Homeomorph.inv Circle := rfl + have h_eq : (h₁.trans (Homeomorph.inv Circle)).trans + (h₂.trans (Homeomorph.inv Circle)).symm = h₁.trans h₂.symm := by + apply Homeomorph.ext + intro z + simp only [Homeomorph.trans_apply, Homeomorph.symm_trans_apply, h_inv_symm] + change h₂.symm ((h₁ z)⁻¹)⁻¹ = h₂.symm (h₁ z) + rw [inv_inv] + rwa [h_eq] at hcomb + +/-- A homeomorphism `α : S ≃ₜ S` maps every cuff of `S` to a cuff of `S`. -/ +theorem image_cuff_mem_cuffs (α : S ≃ₜ S) {C : Set S} (hC : C ∈ cuffs S) : + α '' C ∈ cuffs S := by + have h1 := image_componentsIn α (bd S) + rw [image_bd_homeomorph α] at h1 + unfold cuffs at hC ⊢ + rw [← h1] + exact ⟨C, hC, rfl⟩ + +/-- If `F₀, F` are lines with ends in `bd S` and `F₀ ∩ bd S = {s, t}` and `F ∩ bd S = {s, t}`, then +any homeomorphism `α : S ≃ₜ S` with `α '' F = F₀` satisfies `(α s = s ∧ α t = t) ∨ (α s = t ∧ α t = +s)`. -/ +theorem homeo_ends_cases {F₀ F : Set S} {s t : S} (hne : s ≠ t) + (hb₀ : F₀ ∩ bd S = {s, t}) (hb : F ∩ bd S = {s, t}) + (α : S ≃ₜ S) (hα : α '' F = F₀) : + (α s = s ∧ α t = t) ∨ (α s = t ∧ α t = s) := by + have hst : α '' ({s, t} : Set S) = {s, t} := by + calc + α '' ({s, t} : Set S) = α '' (F ∩ bd S) := by rw [hb] + _ = α '' F ∩ α '' bd S := image_inter α.injective + _ = F₀ ∩ bd S := by rw [hα, image_bd_homeomorph α] + _ = {s, t} := hb₀ + have hs_mem : α s ∈ ({s, t} : Set S) := hst ▸ mem_image_of_mem α (mem_insert s {t}) + have ht_mem : α t ∈ ({s, t} : Set S) := hst ▸ mem_image_of_mem α (mem_insert_of_mem s rfl) + rcases hs_mem with hs_eq | hs_eq + · left + refine ⟨hs_eq, ?_⟩ + rcases ht_mem with ht_eq | ht_eq + · exact absurd (α.injective (hs_eq.trans ht_eq.symm)) hne + · exact mem_singleton_iff.mp ht_eq + · right + have hs_eq' : α s = t := mem_singleton_iff.mp hs_eq + refine ⟨hs_eq', ?_⟩ + rcases ht_mem with ht_eq | ht_eq + · exact ht_eq + · have ht_eq' : α t = t := mem_singleton_iff.mp ht_eq + exact absurd (α.injective (hs_eq'.trans ht_eq'.symm)) hne + +/-- Within a single similarity class of proper `I`-arcs with ends `s, t`, there are only finitely +many parallel classes (Graph Minors VII, proof of (3.2), page 219). -/ +theorem finite_parallel_classes_in_similarity_class (hS : IsSurface S) {s t : S} (hne : s ≠ t) + (B : Set S) : + ∃ 𝓖₀ : Set (Set S), 𝓖₀.Finite ∧ + (∀ F₀ ∈ 𝓖₀, F₀ ∩ bd S = {s, t} ∧ IsLineWithEnds F₀ s t ∧ AreSimilarIArcs B F₀) ∧ + ∀ F : Set S, F ∩ bd S = {s, t} → IsLineWithEnds F s t → AreSimilarIArcs B F → + ∃ F₀ ∈ 𝓖₀, AreParallelIArcs F₀ F := by + classical + let 𝒮 : Set (Set S) := + {F : Set S | F ∩ bd S = {s, t} ∧ IsLineWithEnds F s t ∧ AreSimilarIArcs B F} + by_cases h𝒮 : 𝒮.Nonempty + · obtain ⟨F_star, hb_star, hl_star, hsim_star⟩ := h𝒮 + have hsim_to_star : ∀ F ∈ 𝒮, ∃ α : S ≃ₜ S, α '' F = F_star := by + intro F ⟨_, _, hsimF⟩ + exact hsimF.symm.trans hsim_star + choose! α_map hα_map using hsim_to_star + have hcuff := cuff_statement.{u} S hS + have : Fintype (cuffs S) := hcuff.2.1.fintype + have hφ_ex : ∀ C : cuffs S, ∃ φ : Circle ≃ₜ C.1, True := by + intro C + obtain ⟨φ⟩ := hcuff.2.2 C.1 C.2 + exact ⟨φ, trivial⟩ + choose φ_cuff _ using hφ_ex + let cuffImg (α : S ≃ₜ S) (C : cuffs S) : cuffs S := + ⟨α '' C.1, image_cuff_mem_cuffs α C.2⟩ + let circleAct (α : S ≃ₜ S) (C : cuffs S) : Circle ≃ₜ Circle := + ((φ_cuff C).trans (α.image C.1)).trans (φ_cuff (cuffImg α C)).symm + let SigType := (cuffs S → cuffs S × Bool) × Bool + let sig (F : Set S) : SigType := + (fun C => (cuffImg (α_map F) C, + decide (PreservesCircleOrientation (circleAct (α_map F) C))), + decide (α_map F s = s)) + have hSigFin : ( sig '' 𝒮 ).Finite := toFinite (sig '' 𝒮) + have h_rep : ∀ σ ∈ sig '' 𝒮, ∃ F₀ ∈ 𝒮, sig F₀ = σ := by + rintro σ ⟨F₀, hF₀, rfl⟩ + exact ⟨F₀, hF₀, rfl⟩ + choose! rep hrep_mem hrep_sig using h_rep + refine ⟨rep '' (sig '' 𝒮), hSigFin.image rep, ?_, ?_⟩ + · rintro _ ⟨σ, hσ, rfl⟩ + exact hrep_mem σ hσ + · intro F hb hl hsim + have hF : F ∈ 𝒮 := ⟨hb, hl, hsim⟩ + have hσ : sig F ∈ sig '' 𝒮 := mem_image_of_mem sig hF + set F₀ := rep (sig F) + have hF₀ : F₀ ∈ 𝒮 := hrep_mem (sig F) hσ + have hsig_eq : sig F₀ = sig F := hrep_sig (sig F) hσ + refine ⟨F₀, mem_image_of_mem rep hσ, ?_⟩ + set α₁ := α_map F₀ + set α₂ := α_map F + have hα₁F : α₁ '' F₀ = F_star := hα_map F₀ hF₀ + have hα₂F : α₂ '' F = F_star := hα_map F hF + let α : S ≃ₜ S := α₁.trans α₂.symm + have hα_img : α '' F₀ = F := by + calc + α '' F₀ = α₂.symm '' (α₁ '' F₀) := by ext y; simp [α, Homeomorph.trans_apply] + _ = α₂.symm '' (α₂ '' F) := by rw [hα₁F, ← hα₂F] + _ = F := α₂.symm_image_image F + have h_ends_iff : α₁ s = s ↔ α₂ s = s := + decide_eq_decide.mp (congrArg Prod.snd hsig_eq) + have h_ends : α s = s ∧ α t = t := by + rcases homeo_ends_cases hne hb_star hF₀.1 α₁ hα₁F with ⟨hs1, ht1⟩ | ⟨hs1, ht1⟩ <;> + rcases homeo_ends_cases hne hb_star hF.1 α₂ hα₂F with ⟨hs2, ht2⟩ | ⟨hs2, ht2⟩ + · refine ⟨?_, ?_⟩ + · simp [α, Homeomorph.trans_apply, hs1, (α₂.symm_apply_eq).mpr hs2.symm] + · simp [α, Homeomorph.trans_apply, ht1, (α₂.symm_apply_eq).mpr ht2.symm] + · exfalso + exact hne ((h_ends_iff.mp hs1).symm.trans hs2) + · exfalso + exact hne ((h_ends_iff.mpr hs2).symm.trans hs1) + · refine ⟨?_, ?_⟩ + · simp [α, Homeomorph.trans_apply, hs1, (α₂.symm_apply_eq).mpr hs2.symm] + · simp [α, Homeomorph.trans_apply, ht1, (α₂.symm_apply_eq).mpr ht2.symm] + have h_null : HasNullSignature α := by + intro C φ hC + let C' : cuffs S := ⟨C, hC⟩ + have hC_sig := congrFun (congrArg Prod.fst hsig_eq) C' + have hD_eq : cuffImg α₁ C' = cuffImg α₂ C' := congrArg Prod.fst hC_sig + have horient_eq : + decide (PreservesCircleOrientation (circleAct α₁ C')) = + decide (PreservesCircleOrientation (circleAct α₂ C')) := + congrArg Prod.snd hC_sig + have horient_iff : + PreservesCircleOrientation (circleAct α₁ C') ↔ + PreservesCircleOrientation (circleAct α₂ C') := + decide_eq_decide.mp horient_eq + have h₀_orient : + PreservesCircleOrientation ((circleAct α₁ C').trans (circleAct α₂ C').symm) := + preservesCircleOrientation_trans_symm_of_iff horient_iff + set h₀ := (circleAct α₁ C').trans (circleAct α₂ C').symm + have hh₀_val : ∀ z : Circle, (φ_cuff C' (h₀ z)).1 = α (φ_cuff C' z).1 := by + intro z + have h1 : (φ_cuff (cuffImg α₁ C') (circleAct α₁ C' z)).1 = α₁ (φ_cuff C' z).1 := by + simp [circleAct, Homeomorph.trans_apply] + have h2 : ∀ w : Circle, + (φ_cuff (cuffImg α₂ C') w).1 = α₂ (φ_cuff C' ((circleAct α₂ C').symm w)).1 := by + intro w + have hw := (φ_cuff (cuffImg α₂ C')).apply_symm_apply + ((α₂.image C'.1) (φ_cuff C' ((circleAct α₂ C').symm w))) + have hact : circleAct α₂ C' ((circleAct α₂ C').symm w) = w := + (circleAct α₂ C').apply_symm_apply w + have hact' : (φ_cuff (cuffImg α₂ C') (circleAct α₂ C' ((circleAct α₂ C').symm w))).1 = + α₂ (φ_cuff C' ((circleAct α₂ C').symm w)).1 := by + simp [circleAct, Homeomorph.trans_apply] + rw [hact] at hact' + exact hact' + have h_same_φ : ∀ w : Circle, + (φ_cuff (cuffImg α₂ C') w).1 = (φ_cuff (cuffImg α₁ C') w).1 := by + intro w + rw [hD_eq] + have h3 := h2 (circleAct α₁ C' z) + rw [h_same_φ, h1] at h3 + change (φ_cuff C' ((circleAct α₂ C').symm (circleAct α₁ C' z))).1 = + α₂.symm (α₁ (φ_cuff C' z).1) + exact ((α₂.symm_apply_eq).mpr h3).symm + let ψ : Circle ≃ₜ Circle := (φ_cuff C').trans φ.symm + let h_final : Circle ≃ₜ Circle := ψ.symm.trans (h₀.trans ψ) + refine ⟨h_final, PreservesCircleOrientation.conj h₀_orient ψ, fun x => ?_⟩ + have hx1 : (φ_cuff C' (ψ.symm x)).1 = (φ x).1 := by + simp [ψ] + have hx2 : (φ (h_final x)).1 = (φ_cuff C' (h₀ (ψ.symm x))).1 := by + simp [h_final, ψ, Homeomorph.trans_apply] + rw [hx2, hh₀_val, hx1] + exact theorem_3_2_claim_1 α hS hne hF₀.1 hb hF₀.2.1 hl hα_img h_ends.1 h_ends.2 h_null + · refine ⟨∅, finite_empty, by simp, fun F hb hl hsim => ?_⟩ + exact absurd ⟨F, hb, hl, hsim⟩ h𝒮 + +/-- Graph Minors VII, (3.2) (page 219): +"(3.2) *For any fixed $\Sigma$ and $s, t \in bd(\Sigma)$, there are only finitely many parallel +classes of $I$-arcs with ends $s, t$.*" -/ +theorem theorem_3_2_proof (hS : IsSurface S) (s t : S) : + ∃ 𝓖 : Set (Set S), 𝓖.Finite ∧ + (∀ F₀ ∈ 𝓖, F₀ ∩ bd S = {s, t} ∧ IsLineWithEnds F₀ s t) ∧ + ∀ F : Set S, F ∩ bd S = {s, t} → IsLineWithEnds F s t → + ∃ F₀ ∈ 𝓖, AreParallelIArcs F₀ F := by + by_cases hne : s = t + · subst hne + refine ⟨∅, finite_empty, by simp, fun F _ hl => ?_⟩ + obtain ⟨f, hf0, hf1⟩ := hl + have h01 : (0 : unitInterval) = 1 := + f.injective (Subtype.ext (hf0.trans hf1.symm)) + exact absurd (congrArg Subtype.val h01) zero_ne_one + · obtain ⟨𝓕, h𝓕_fin, h𝓕⟩ := theorem_3_1_proof hS + choose 𝓖_of h𝓖_fin h𝓖_mem h𝓖_cov using + fun B => finite_parallel_classes_in_similarity_class hS hne B + refine ⟨⋃ B ∈ 𝓕, 𝓖_of B, h𝓕_fin.biUnion fun B _ => h𝓖_fin B, ?_, ?_⟩ + · rintro F₀ hF₀ + obtain ⟨B, _, hF₀B⟩ := mem_iUnion₂.mp hF₀ + exact ⟨(h𝓖_mem B F₀ hF₀B).1, (h𝓖_mem B F₀ hF₀B).2.1⟩ + · intro F hb hl + have hprop : IsProperIArc F := ⟨s, t, hne, hb, hl⟩ + obtain ⟨B, hB, hsim⟩ := h𝓕 F hprop + obtain ⟨F₀, hF₀, hpar⟩ := h𝓖_cov B F hb hl hsim + exact ⟨F₀, mem_iUnion₂.mpr ⟨B, hB, hF₀⟩, hpar⟩ + +/-! ## 3. Cutting a general surface along a proper `I`-arc and Theorem (3.3) -/ + +/-- The disjoint union of two surfaces is a surface. -/ +theorem isSurface_sum {A B : Type u} [TopologicalSpace A] [TopologicalSpace B] + (hA : IsSurface A) (hB : IsSurface B) : IsSurface (A ⊕ B) := by + have : CompactSpace A := hA.1 + have : CompactSpace B := hB.1 + have : T2Space A := hA.2.1 + have : T2Space B := hB.2.1 + refine ⟨inferInstance, inferInstance, ?_⟩ + rintro (a | b) + · obtain ⟨U, V, hU, hV, ha, ⟨e⟩⟩ := hA.2.2 a + refine ⟨Sum.inl '' U, V, isOpenMap_inl U hU, hV, mem_image_of_mem Sum.inl ha, + ⟨(IsOpenEmbedding.inl.isEmbedding.homeomorphImage U).symm.trans e⟩⟩ + · obtain ⟨U, V, hU, hV, hb, ⟨e⟩⟩ := hB.2.2 b + refine ⟨Sum.inr '' U, V, isOpenMap_inr U hU, hV, mem_image_of_mem Sum.inr hb, + ⟨(IsOpenEmbedding.inr.isEmbedding.homeomorphImage U).symm.trans e⟩⟩ + +/-- Boundary points of `A` map to boundary points of `A ⊕ B` under `Sum.inl`. -/ +theorem mem_bd_inl {A B : Type u} [TopologicalSpace A] [TopologicalSpace B] + {a : A} (ha : a ∈ bd A) : (Sum.inl a : A ⊕ B) ∈ bd (A ⊕ B) := by + intro hint + apply ha + obtain ⟨U, hU, hmem, hsub, ⟨e⟩⟩ := + hint.exists_subset isOpen_range_inl (mem_range_self a) + have hpre : Sum.inl '' (Sum.inl ⁻¹' U) = U := + Subset.antisymm (image_preimage_subset Sum.inl U) (by + intro z hz + obtain ⟨x, rfl⟩ := hsub hz + exact ⟨x, hz, rfl⟩) + refine ⟨Sum.inl ⁻¹' U, hU.preimage continuous_inl, hmem, + ⟨((IsOpenEmbedding.inl.isEmbedding.homeomorphImage (Sum.inl ⁻¹' U)).trans + (Homeomorph.setCongr hpre)).trans e⟩⟩ + +/-- Cutting any (not necessarily connected) surface `S` along a proper `I`-arc `F` with ends +`s, t` gives a surface `Y` and a cutting map `ψ : Y → S`. -/ +theorem exists_cut_arc_surface (hS : IsSurface S) {F : Set S} {s t : S} + (hne : s ≠ t) (hb : F ∩ bd S = {s, t}) (hl : IsLineWithEnds F s t) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (ψ : Y → S), + IsSurface Y ∧ IsCutting ψ F := by + have : T2Space S := hS.2.1 + have := hS.locallyConnected + set W : Set S := connectedComponent s + have hW : IsClopen W := isClopen_connectedComponent + have hW_surf : IsSurface W := isSurface_sub hS hW + have : ConnectedSpace W := isConnected_iff_connectedSpace.mp isConnected_connectedComponent + have hsub : F ⊆ W := by + obtain ⟨a, ha, rfl, -, -⟩ := hl.exists_arc + exact (isPreconnected_range ha.1).subset_connectedComponent hl.left_mem + have hsW : s ∈ W := mem_connectedComponent + have htW : t ∈ W := hsub hl.right_mem + let sW : W := ⟨s, hsW⟩ + let tW : W := ⟨t, htW⟩ + let FW : Set W := Subtype.val ⁻¹' F + have hneW : sW ≠ tW := fun h => hne (congrArg Subtype.val h) + have hbW : FW ∩ bd W = {sW, tW} := by + ext y + have hy_bd : y ∈ bd W ↔ y.1 ∈ bd S := mem_bd_sub hW.2 + have hy_F := Set.ext_iff.mp hb y.1 + simp only [FW, mem_inter_iff, mem_insert_iff, mem_singleton_iff, mem_preimage, + hy_bd, Subtype.ext_iff, sW, tW] + simpa using hy_F + have hlW : IsLineWithEnds FW sW tW := by + obtain ⟨u', v', e1, e2, h5⟩ := + hl.pull (j := (Subtype.val : W → S)) IsEmbedding.subtypeVal (by rwa [Subtype.range_coe]) + have e3 : u' = sW := Subtype.ext e1 + have e4 : v' = tW := Subtype.ext e2 + rwa [e3, e4] at h5 + obtain ⟨YW, tYW, t2YW, ψW, hYW, hψW, -, -, -⟩ := exists_cut_arc hW_surf hneW hbW hlW + have hWc_surf : IsSurface ↥Wᶜ := isSurface_sub hS hW.compl + let Y : Type u := YW ⊕ ↥Wᶜ + let ψ : Y → S := Sum.elim (Subtype.val ∘ ψW) Subtype.val + refine ⟨Y, inferInstance, ψ, isSurface_sum hYW hWc_surf, ?_⟩ + refine ⟨continuous_sum_dom.mpr ⟨continuous_subtype_val.comp hψW.1, continuous_subtype_val⟩, + ?_, ?_, ?_, ?_⟩ + · intro x + by_cases hx : x ∈ W + · obtain ⟨y, hy⟩ := hψW.2.1 ⟨x, hx⟩ + exact ⟨Sum.inl y, congrArg Subtype.val hy⟩ + · exact ⟨Sum.inr ⟨x, hx⟩, rfl⟩ + · rintro (y₁ | y₁) hy₁ (y₂ | y₂) hy₂ heq + · congr 1 + exact hψW.2.2.1 hy₁ hy₂ (Subtype.ext heq) + · exfalso + change (ψW y₁).1 = y₂.1 at heq + exact y₂.2 (heq ▸ (ψW y₁).2) + · exfalso + change y₁.1 = (ψW y₂).1 at heq + exact y₁.2 (heq.symm ▸ (ψW y₂).2) + · congr 1 + exact Subtype.ext heq + · intro x hx + have hxW : x ∈ W := hsub hx + have hpre_eq : ψ ⁻¹' {x} = Sum.inl '' (ψW ⁻¹' {⟨x, hxW⟩}) := by + ext (y | z) + · simp only [ψ, Sum.elim_inl, comp_apply, mem_preimage, mem_singleton_iff, mem_image, + Subtype.ext_iff] + constructor + · intro h + exact ⟨y, h, rfl⟩ + · rintro ⟨y', hy', h_eq⟩ + cases h_eq + exact hy' + · simp only [ψ, Sum.elim_inr, mem_preimage, mem_singleton_iff, mem_image, reduceCtorEq, + and_false, exists_false, iff_false] + intro hzx + exact z.2 (hzx ▸ hxW) + rw [hpre_eq, ncard_image_of_injective _ Sum.inl_injective] + exact hψW.2.2.2.1 ⟨x, hxW⟩ hx + · rintro (y | z) hy + · exact mem_bd_inl (hψW.2.2.2.2 hy) + · exfalso + exact z.2 (hsub hy) + +/-- A compact line `L` disjoint from `F` lifts along a cutting `ψ : Y → S` to a line `ψ ⁻¹' L` +whose ends map to the ends of `L`. -/ +theorem IsLineWithEnds.preimage_cutting {Y : Type u} [TopologicalSpace Y] + [CompactSpace Y] [T2Space S] {ψ : Y → S} {F L : Set S} {u v : S} + (hψ : IsCutting ψ F) (hl : IsLineWithEnds L u v) (hdisj : Disjoint L F) : + ∃ u' v' : Y, ψ u' = u ∧ ψ v' = v ∧ ψ ⁻¹' {u} = {u'} ∧ ψ ⁻¹' {v} = {v'} ∧ + IsLineWithEnds (ψ ⁻¹' L) u' v' := by + have hLF : ∀ x ∈ L, x ∉ F := Set.disjoint_left.mp hdisj + have huL : u ∈ L := hl.left_mem + have hvL : v ∈ L := hl.right_mem + have hL_cl : IsClosed L := hl.isCompact.isClosed + have hK_cl : IsClosed (ψ ⁻¹' L) := hL_cl.preimage hψ.1 + have : CompactSpace (ψ ⁻¹' L) := isCompact_iff_compactSpace.mp hK_cl.isCompact + let g : (ψ ⁻¹' L) → L := fun y => ⟨ψ y.1, y.2⟩ + have hg_cont : Continuous g := (hψ.1.comp continuous_subtype_val).subtype_mk _ + have hg_inj : Injective g := by + intro a b hab + apply Subtype.ext + exact hψ.2.2.1 (hLF _ a.2) (hLF _ b.2) (congrArg Subtype.val hab) + have hg_surj : Surjective g := by + rintro ⟨x, hx⟩ + obtain ⟨y, rfl⟩ := hψ.2.1 x + exact ⟨⟨y, hx⟩, rfl⟩ + let eKL : (ψ ⁻¹' L) ≃ₜ L := + hg_cont.homeoOfEquivCompactToT2 (f := Equiv.ofBijective g ⟨hg_inj, hg_surj⟩) + have heKL : ∀ y : ψ ⁻¹' L, (eKL y).1 = ψ y.1 := fun _ => rfl + obtain ⟨f, hf0, hf1⟩ := hl + let f' : unitInterval ≃ₜ (ψ ⁻¹' L) := f.trans eKL.symm + let u' : Y := (f' 0).1 + let v' : Y := (f' 1).1 + have hu' : ψ u' = u := by + have := heKL (f' 0) + simp only [f', Homeomorph.trans_apply, Homeomorph.apply_symm_apply] at this + exact this.symm.trans hf0 + have hv' : ψ v' = v := by + have := heKL (f' 1) + simp only [f', Homeomorph.trans_apply, Homeomorph.apply_symm_apply] at this + exact this.symm.trans hf1 + have hpre_pt : ∀ {w : S} {w' : Y}, w ∈ L → ψ w' = w → ψ ⁻¹' {w} = {w'} := by + intro w w' hw hww' + ext y + simp only [mem_preimage, mem_singleton_iff] + constructor + · intro hyw + have hyF : ψ y ∉ F := by rw [hyw]; exact hLF w hw + have hw'F : ψ w' ∉ F := by rw [hww']; exact hLF w hw + exact hψ.2.2.1 hyF hw'F (hyw.trans hww'.symm) + · rintro rfl + exact hww' + exact ⟨u', v', hu', hv', hpre_pt huL hu', hpre_pt hvL hv', ⟨f', rfl, rfl⟩⟩ + +/-- An *`X`-arc matching* on `S` is a finite set `𝒜` of pairwise disjoint proper `I`-arcs whose +ends lie in `X` and cover `X`. -/ +def IsArcMatching (X : Set S) (𝒜 : Set (Set S)) : Prop := + 𝒜.Finite ∧ + (∀ F ∈ 𝒜, ∃ u v : S, u ≠ v ∧ F ∩ bd S = {u, v} ∧ u ∈ X ∧ v ∈ X ∧ IsLineWithEnds F u v) ∧ + (∀ F₁ ∈ 𝒜, ∀ F₂ ∈ 𝒜, F₁ ≠ F₂ → Disjoint F₁ F₂) ∧ + X ⊆ ⋃₀ 𝒜 + +theorem IsLineWithEnds.symm {L : Set S} {u v : S} (h : IsLineWithEnds L u v) : + IsLineWithEnds L v u := by + rcases h with ⟨f, hf0, hf1⟩ + let rev : unitInterval ≃ₜ unitInterval := + { toFun := unitInterval.symm + invFun := unitInterval.symm + left_inv := unitInterval.symm_symm + right_inv := unitInterval.symm_symm + continuous_toFun := unitInterval.continuous_symm + continuous_invFun := unitInterval.continuous_symm } + refine ⟨rev.trans f, ?_, ?_⟩ + · simp [rev, hf1] + · simp [rev, hf0] + +private theorem cut_arc_matching_of_complement + {S : Type u} + [TopologicalSpace S] + {X : Set S} + (hX : X ⊆ bd S) + [T2Space S] + (s : S) + (t : S) + (F₀ : Set S) + (Y : Type u) + [TopologicalSpace Y] + (ψ : Y → S) + (hψ : IsCutting ψ F₀) + [CompactSpace Y] + (hF₀_cl : IsClosed F₀) + (hXY_bd : (ψ ⁻¹' (X \ {s, t})) ⊆ bd Y) + (𝒜 : Set (Set S)) + (h𝒜 : IsArcMatching X 𝒜) + (F_s : Set S) + (hFs_mem : F_s ∈ 𝒜) + (hFs_bd : F_s ∩ bd S = {s, t}) + (hFs_line : IsLineWithEnds F_s s t) + (α₁ : S ≃ₜ S) + (h_disj_Fs : ∀ F ∈ (𝒜 \ {F_s}), Disjoint F F_s) + (hα₁_symm_bd : ∀ x ∈ bd S, α₁.symm x = x) + (h_disj_F₀ : ∀ F' ∈ ((fun F => ⇑α₁.symm '' F) '' (𝒜 \ {F_s})), Disjoint F' F₀) : + IsArcMatching (ψ ⁻¹' (X \ {s, t})) + ((fun F' => ψ ⁻¹' F') '' ((fun F => α₁.symm '' F) '' (𝒜 \ {F_s}))) := by + let X_Y := ψ ⁻¹' (X \ {s, t}) + let 𝒜_rem := 𝒜 \ {F_s} + let 𝒜' := (fun F => ⇑α₁.symm '' F) '' 𝒜_rem + let 𝒜_Y := (fun F' => ψ ⁻¹' F') '' 𝒜' + refine ⟨((h𝒜.1.sdiff).image _).image _, ?_, ?_, ?_⟩ + · rintro _ ⟨F', ⟨F, hF, rfl⟩, rfl⟩ + obtain ⟨u, v, huv, hF_bd, huX, hvX, hF_line⟩ := h𝒜.2.1 F hF.1 + have hu_bd : u ∈ bd S := hX huX + have hv_bd : v ∈ bd S := hX hvX + have hu_not_st : u ∉ ({s, t} : Set S) := by + intro h_in + have hu_Fs : u ∈ F_s := by + have : u ∈ F_s ∩ bd S := hFs_bd.symm ▸ h_in + exact this.1 + exact Set.disjoint_left.mp (h_disj_Fs F hF) hF_line.left_mem hu_Fs + have hv_not_st : v ∉ ({s, t} : Set S) := by + intro h_in + have hv_Fs : v ∈ F_s := by + have : v ∈ F_s ∩ bd S := hFs_bd.symm ▸ h_in + exact this.1 + exact Set.disjoint_left.mp (h_disj_Fs F hF) hF_line.right_mem hv_Fs + have hF'_bd : α₁.symm '' F ∩ bd S = {u, v} := by + calc + α₁.symm '' F ∩ bd S = α₁.symm '' F ∩ α₁.symm '' bd S := by + rw [image_bd_homeomorph α₁.symm] + _ = α₁.symm '' (F ∩ bd S) := (image_inter α₁.symm.injective).symm + _ = α₁.symm '' {u, v} := by rw [hF_bd] + _ = {u, v} := by + rw [image_pair, hα₁_symm_bd u hu_bd, hα₁_symm_bd v hv_bd] + have hF'_line : IsLineWithEnds (α₁.symm '' F) u v := by + have hl' := hF_line.map_of_embedding α₁.symm.isEmbedding + rwa [hα₁_symm_bd u hu_bd, hα₁_symm_bd v hv_bd] at hl' + have hF'_disj : Disjoint (α₁.symm '' F) F₀ := + h_disj_F₀ _ ⟨F, hF, rfl⟩ + obtain ⟨u', v', hu', hv', hpre_u, hpre_v, hl_Y⟩ := + IsLineWithEnds.preimage_cutting hψ hF'_line hF'_disj + refine ⟨u', v', fun h => huv (hu'.symm.trans ((congrArg ψ h).trans hv')), + ?_, ?_, ?_, hl_Y⟩ + · ext y + simp only [mem_inter_iff, mem_preimage, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨hyF', hy_bd⟩ + have hy_not_F₀ : ψ y ∉ F₀ := + Set.disjoint_left.mp hF'_disj hyF' + have hψy_bd : ψ y ∈ bd S := bd_of_bd hψ hF₀_cl hy_bd hy_not_F₀ + have hψy_uv : ψ y ∈ ({u, v} : Set S) := hF'_bd ▸ ⟨hyF', hψy_bd⟩ + rcases hψy_uv with h_eq | h_eq + · left + exact mem_singleton_iff.mp (hpre_u ▸ h_eq) + · right + exact mem_singleton_iff.mp (hpre_v ▸ mem_singleton_iff.mp h_eq) + · rintro (rfl | rfl) + · refine ⟨hF'_line.left_mem |> fun h => by rwa [← hu'] at h, ?_⟩ + exact hXY_bd (show y ∈ X_Y by + change ψ y ∈ X \ {s, t} + rw [hu'] + exact ⟨huX, hu_not_st⟩) + · refine ⟨hF'_line.right_mem |> fun h => by rwa [← hv'] at h, ?_⟩ + exact hXY_bd (show y ∈ X_Y by + change ψ y ∈ X \ {s, t} + rw [hv'] + exact ⟨hvX, hv_not_st⟩) + · change ψ u' ∈ X \ {s, t} + rw [hu'] + exact ⟨huX, hu_not_st⟩ + · change ψ v' ∈ X \ {s, t} + rw [hv'] + exact ⟨hvX, hv_not_st⟩ + · rintro _ ⟨F₁', ⟨F₁, hF₁, rfl⟩, rfl⟩ _ ⟨F₂', ⟨F₂, hF₂, rfl⟩, rfl⟩ hne_Y + have hne_F : F₁ ≠ F₂ := fun h => hne_Y (by rw [h]) + have hdisj_img : Disjoint (α₁.symm '' F₁) (α₁.symm '' F₂) := by + rw [Set.disjoint_left] + rintro _ ⟨x, hx, rfl⟩ ⟨y, hy, hyx⟩ + exact Set.disjoint_left.mp (h𝒜.2.2.1 F₁ hF₁.1 F₂ hF₂.1 hne_F) + hx (α₁.symm.injective hyx ▸ hy) + exact hdisj_img.preimage ψ + · intro y hy + have hψy_X' : ψ y ∈ X \ {s, t} := hy + obtain ⟨F, hF_mem, hψy_F⟩ := h𝒜.2.2.2 hψy_X'.1 + have hF_ne_Fs : F ≠ F_s := by + rintro rfl + have : ψ y ∈ ({s, t} : Set S) := hFs_bd ▸ ⟨hψy_F, hX hψy_X'.1⟩ + exact hψy_X'.2 this + refine ⟨ψ ⁻¹' (α₁.symm '' F), ⟨α₁.symm '' F, ⟨F, ⟨hF_mem, hF_ne_Fs⟩, rfl⟩, rfl⟩, ?_⟩ + change ψ y ∈ α₁.symm '' F + rw [← hα₁_symm_bd (ψ y) (hX hψy_X'.1)] + exact mem_image_of_mem α₁.symm hψy_F + +/-- By induction on `|X|`, for any surface `S` and finite `X ⊆ bd S`, there are only finitely many +carriers `⋃₀ 𝒜` of `X`-arc matchings up to homeomorphisms of `S` fixing `bd S` pointwise. -/ +theorem finite_arcMatching_classes : + ∀ (n : ℕ) {S : Type u} [TopologicalSpace S], IsSurface S → ∀ {X : Set S}, + X ⊆ bd S → X.Finite → X.ncard = n → + ∃ 𝓤 : Set (Set S), 𝓤.Finite ∧ + ∀ 𝒜 : Set (Set S), IsArcMatching X 𝒜 → + ∃ U₀ ∈ 𝓤, ∃ α : S ≃ₜ S, α '' U₀ = ⋃₀ 𝒜 ∧ ∀ x ∈ bd S, α x = x := by + intro n + induction n using Nat.strong_induction_on with + | _ n ih => + intro S _ hS X hX hXfin hn + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + by_cases hXne : X.Nonempty + · obtain ⟨s, hsX⟩ := hXne + have hs_bd : s ∈ bd S := hX hsX + have hX_diff_fin : (X \ {s}).Finite := hXfin.sdiff + choose 𝓖_of h𝓖_fin h𝓖_mem h𝓖_cov using fun t : S => theorem_3_2_proof hS s t + have h_pair_step : ∀ t ∈ X \ {s}, ∀ F₀ ∈ 𝓖_of t, + ∃ 𝓤_sub : Set (Set S), 𝓤_sub.Finite ∧ + ∀ 𝒜 : Set (Set S), IsArcMatching X 𝒜 → + (∃ F_s ∈ 𝒜, F_s ∩ bd S = {s, t} ∧ IsLineWithEnds F_s s t ∧ AreParallelIArcs F₀ F_s) → + ∃ U₀ ∈ 𝓤_sub, ∃ α : S ≃ₜ S, α '' U₀ = ⋃₀ 𝒜 ∧ ∀ x ∈ bd S, α x = x := by + intro t ht F₀ hF₀_mem + have hst : s ≠ t := fun h => ht.2 (mem_singleton_iff.mpr h.symm) + obtain ⟨hb₀, hl₀⟩ := h𝓖_mem t F₀ hF₀_mem + obtain ⟨Y, tY, ψ, hY, hψ⟩ := exists_cut_arc_surface hS hst hb₀ hl₀ + have : CompactSpace Y := hY.1 + have : T2Space Y := hY.2.1 + have hF₀_cl : IsClosed F₀ := hl₀.isCompact.isClosed + set X' : Set S := X \ {s, t} + have hX'_sub_bd : X' ⊆ bd S := sdiff_subset.trans hX + have hX'_disj_F₀ : Disjoint X' F₀ := by + rw [Set.disjoint_left] + intro x hx hxF₀ + have : x ∈ ({s, t} : Set S) := hb₀ ▸ ⟨hxF₀, hX'_sub_bd hx⟩ + exact hx.2 this + set X_Y : Set Y := ψ ⁻¹' X' + have hXY_bd : X_Y ⊆ bd Y := by + intro y hy + exact bd_lift hψ hF₀_cl (hX'_sub_bd hy) (Set.disjoint_left.mp hX'_disj_F₀ hy) + have hψ_inj_XY : InjOn ψ X_Y := by + intro y₁ hy₁ y₂ hy₂ h12 + exact hψ.2.2.1 (Set.disjoint_left.mp hX'_disj_F₀ hy₁) + (Set.disjoint_left.mp hX'_disj_F₀ hy₂) h12 + have hψ_img_XY : ψ '' X_Y = X' := image_preimage_eq X' hψ.2.1 + have hX'_fin : X'.Finite := hXfin.sdiff + have hXY_fin : X_Y.Finite := hX'_fin.preimage hψ_inj_XY + have hXY_card : X_Y.ncard < n := by + have h1 : X_Y.ncard = X'.ncard := by + rw [← hψ_img_XY, hψ_inj_XY.ncard_image] + have h2 : X'.ncard < X.ncard := + ncard_lt_ncard (ssubset_iff_subset_ne.mpr ⟨sdiff_subset, fun h_eq => by + have : s ∈ X' := h_eq ▸ hsX + exact this.2 (mem_insert s {t})⟩) hXfin + omega + obtain ⟨𝓤_Y, h𝓤Y_fin, h𝓤Y_cov⟩ := + ih X_Y.ncard hXY_card hY hXY_bd hXY_fin rfl + refine ⟨(fun U_Y => F₀ ∪ ψ '' U_Y) '' 𝓤_Y, h𝓤Y_fin.image _, ?_⟩ + intro 𝒜 h𝒜 ⟨F_s, hFs_mem, hFs_bd, hFs_line, α₁, hα₁_F, hα₁_bd⟩ + set 𝒜_rem : Set (Set S) := 𝒜 \ {F_s} + have h_disj_Fs : ∀ F ∈ 𝒜_rem, Disjoint F F_s := + fun F hF => h𝒜.2.2.1 F hF.1 F_s hFs_mem hF.2 + have h_union_𝒜 : ⋃₀ 𝒜 = F_s ∪ ⋃₀ 𝒜_rem := by + ext x + simp only [mem_sUnion, mem_union] + constructor + · rintro ⟨F, hF, hxF⟩ + by_cases hFF : F = F_s + · exact Or.inl (hFF ▸ hxF) + · exact Or.inr ⟨F, ⟨hF, hFF⟩, hxF⟩ + · rintro (hx | ⟨F, ⟨hF, _⟩, hxF⟩) + · exact ⟨F_s, hFs_mem, hx⟩ + · exact ⟨F, hF, hxF⟩ + set 𝒜' : Set (Set S) := (fun F => α₁.symm '' F) '' 𝒜_rem + have hα₁_symm_bd : ∀ x ∈ bd S, α₁.symm x = x := + fun x hx => (α₁.symm_apply_eq).mpr (hα₁_bd x hx).symm + have hα₁_symm_Fs : α₁.symm '' F_s = F₀ := by + rw [← hα₁_F] + exact α₁.symm_image_image F₀ + have h_disj_F₀ : ∀ F' ∈ 𝒜', Disjoint F' F₀ := by + rintro _ ⟨F, hF, rfl⟩ + rw [← hα₁_symm_Fs] + rw [Set.disjoint_left] + rintro _ ⟨x, hx, rfl⟩ ⟨y, hy, hyx⟩ + exact Set.disjoint_left.mp (h_disj_Fs F hF) hx (α₁.symm.injective hyx ▸ hy) + set 𝒜_Y : Set (Set Y) := (fun F' => ψ ⁻¹' F') '' 𝒜' + have h𝒜Y_match : IsArcMatching X_Y 𝒜_Y := by + exact cut_arc_matching_of_complement (S := S) (X := X) hX s t F₀ Y ψ hψ hF₀_cl hXY_bd 𝒜 + h𝒜 F_s hFs_mem hFs_bd hFs_line α₁ h_disj_Fs hα₁_symm_bd h_disj_F₀ + obtain ⟨U_Y, hUY_mem, H, hH_U, hH_bd⟩ := h𝓤Y_cov 𝒜_Y h𝒜Y_match + have hH_fix_F₀ : ∀ z : Y, ψ z ∈ F₀ → H z = z := + fun z hz => hH_bd z (hψ.2.2.2.2 hz) + obtain ⟨γ, hγ⟩ := exists_descend_cut hψ H hH_fix_F₀ + have hγ_bd : ∀ x ∈ bd S, γ x = x := by + intro x hx + obtain ⟨y, rfl⟩ := hψ.2.1 x + by_cases hyF₀ : ψ y ∈ F₀ + · rw [hγ y, hH_fix_F₀ y hyF₀] + · rw [hγ y, hH_bd y (bd_lift hψ hF₀_cl hx hyF₀)] + have hγ_F₀ : γ '' F₀ = F₀ := by + ext x + constructor + · rintro ⟨w, hw, rfl⟩ + obtain ⟨y, rfl⟩ := hψ.2.1 w + rw [hγ y, hH_fix_F₀ y hw] + exact hw + · intro hx + obtain ⟨y, rfl⟩ := hψ.2.1 x + exact ⟨ψ y, hx, by rw [hγ y, hH_fix_F₀ y hx]⟩ + have h_sUnion_AY : ψ '' (⋃₀ 𝒜_Y) = ⋃₀ 𝒜' := by + ext x + simp only [𝒜_Y, mem_image, mem_sUnion, exists_exists_and_eq_and] + constructor + · rintro ⟨y, ⟨F', hF', hy⟩, rfl⟩ + exact ⟨F', hF', hy⟩ + · rintro ⟨F', hF', hx⟩ + obtain ⟨y, rfl⟩ := hψ.2.1 x + exact ⟨y, ⟨F', hF', hx⟩, rfl⟩ + have hγ_UY : γ '' (ψ '' U_Y) = ⋃₀ 𝒜' := by + calc + γ '' (ψ '' U_Y) = ψ '' (H '' U_Y) := by + ext x + simp only [mem_image, exists_exists_and_eq_and] + constructor + · rintro ⟨y, hy, rfl⟩ + exact ⟨y, hy, (hγ y).symm⟩ + · rintro ⟨y, hy, rfl⟩ + exact ⟨y, hy, hγ y⟩ + _ = ψ '' (⋃₀ 𝒜_Y) := by rw [hH_U] + _ = ⋃₀ 𝒜' := h_sUnion_AY + have hα₁_A' : α₁ '' (⋃₀ 𝒜') = ⋃₀ 𝒜_rem := by + ext x + simp only [𝒜', mem_image, mem_sUnion, exists_exists_and_eq_and] + constructor + · rintro ⟨w, ⟨F, hF, ⟨z, hz, rfl⟩⟩, rfl⟩ + exact ⟨F, hF, by simpa using hz⟩ + · rintro ⟨F, hF, hx⟩ + exact ⟨α₁.symm x, ⟨F, hF, mem_image_of_mem α₁.symm hx⟩, α₁.apply_symm_apply x⟩ + let α : S ≃ₜ S := γ.trans α₁ + refine ⟨F₀ ∪ ψ '' U_Y, mem_image_of_mem _ hUY_mem, α, ?_, fun x hx => ?_⟩ + · calc + α '' (F₀ ∪ ψ '' U_Y) = α₁ '' (γ '' (F₀ ∪ ψ '' U_Y)) := by + ext x + simp [α, Homeomorph.trans_apply] + _ = α₁ '' (γ '' F₀ ∪ γ '' (ψ '' U_Y)) := by rw [image_union] + _ = α₁ '' (F₀ ∪ ⋃₀ 𝒜') := by rw [hγ_F₀, hγ_UY] + _ = α₁ '' F₀ ∪ α₁ '' (⋃₀ 𝒜') := image_union α₁ F₀ (⋃₀ 𝒜') + _ = F_s ∪ ⋃₀ 𝒜_rem := by rw [hα₁_F, hα₁_A'] + _ = ⋃₀ 𝒜 := h_union_𝒜.symm + · simp [α, Homeomorph.trans_apply, hγ_bd x hx, hα₁_bd x hx] + choose 𝓤_sub h𝓤_sub_fin h𝓤_sub_cov using h_pair_step + refine ⟨⋃ t ∈ X \ {s}, ⋃ (ht : t ∈ X \ {s}), ⋃ F₀ ∈ 𝓖_of t, ⋃ (hF₀ : F₀ ∈ 𝓖_of t), + 𝓤_sub t ht F₀ hF₀, ?_, ?_⟩ + · refine hX_diff_fin.biUnion fun t ht => finite_iUnion fun _ => ?_ + exact (h𝓖_fin t).biUnion fun F₀ hF₀ => finite_iUnion fun _ => h𝓤_sub_fin t ht F₀ hF₀ + · intro 𝒜 h𝒜 + obtain ⟨F_s, hFs_mem, hs_Fs⟩ := h𝒜.2.2.2 hsX + obtain ⟨u, v, huv, hFs_bd, huX, hvX, hFs_line⟩ := h𝒜.2.1 F_s hFs_mem + have hs_uv : s ∈ ({u, v} : Set S) := hFs_bd ▸ ⟨hs_Fs, hs_bd⟩ + have h_ex_t : ∃ t ∈ X \ {s}, F_s ∩ bd S = {s, t} ∧ IsLineWithEnds F_s s t := by + rcases hs_uv with rfl | hs_v + · exact ⟨v, ⟨hvX, fun h => huv (mem_singleton_iff.mp h).symm⟩, hFs_bd, hFs_line⟩ + · have hsv : s = v := mem_singleton_iff.mp hs_v + subst hsv + exact ⟨u, ⟨huX, fun h => huv (mem_singleton_iff.mp h)⟩, + by rw [pair_comm]; exact hFs_bd, hFs_line.symm⟩ + obtain ⟨t, ht, hFs_bd', hFs_line'⟩ := h_ex_t + obtain ⟨F₀, hF₀, hpar⟩ := h𝓖_cov t F_s hFs_bd' hFs_line' + obtain ⟨U₀, hU₀, α, hα_U, hα_bd⟩ := + h𝓤_sub_cov t ht F₀ hF₀ 𝒜 h𝒜 ⟨F_s, hFs_mem, hFs_bd', hFs_line', hpar⟩ + refine ⟨U₀, ?_, α, hα_U, hα_bd⟩ + exact mem_iUnion₂.mpr ⟨t, ht, mem_iUnion.mpr ⟨ht, + mem_iUnion₂.mpr ⟨F₀, hF₀, mem_iUnion.mpr ⟨hF₀, hU₀⟩⟩⟩⟩ + · have hX_emp : X = ∅ := not_nonempty_iff_eq_empty.mp hXne + subst hX_emp + refine ⟨{∅}, finite_singleton ∅, fun 𝒜 h𝒜 => ⟨∅, mem_singleton ∅, Homeomorph.refl S, ?_, + fun _ _ => rfl⟩⟩ + simp only [Homeomorph.refl_apply, image_id] + ext x + simp only [mem_empty_iff_false, mem_sUnion, false_iff, not_exists, not_and] + intro F hF _ + obtain ⟨u, _, _, _, hu, _, _⟩ := h𝒜.2.1 F hF + exact hu + +/-- Every `X`-matching `G` gives an `X`-arc matching `closure '' G.E` with carrier `G.U`. -/ +theorem isArcMatching_of_isXMatching {X : Set S} (hX : X ⊆ bd S) + {G : Drawing S} (hG : IsXMatching X G) : + IsArcMatching X (closure '' G.E) ∧ ⋃₀ (closure '' G.E) = G.U := by + rcases hG with ⟨⟨hprop, hV_bd, hval⟩, rfl⟩ + have htilde_eq : ∀ e ∈ G.E, tilde e = closure e ∩ G.V := by + intro e he + have hdiff := G.closure_diff_V he + ext x + simp only [tilde, mem_sdiff, mem_inter_iff] + constructor + · rintro ⟨hxe, hxne⟩ + refine ⟨hxe, ?_⟩ + by_contra hxV + apply hxne + rw [← hdiff] + exact ⟨hxe, hxV⟩ + · rintro ⟨hxe, hxV⟩ + refine ⟨hxe, fun h_in => ?_⟩ + rw [← hdiff] at h_in + exact h_in.2 hxV + have h_no_loop : ∀ e ∈ G.E, + ∃ u v : S, u ≠ v ∧ closure e ∩ G.V = {u, v} ∧ IsLineWithEnds (closure e) u v ∧ + (tilde e).ncard = 2 := by + intro e he + rcases G.edge_cond e he with ⟨u, v, huv, hcap, hL⟩ | ⟨u, hcap, _⟩ + · refine ⟨u, v, huv, hcap, hL, ?_⟩ + rw [htilde_eq e he, hcap, ncard_pair huv] + · exfalso + have hu_mem : u ∈ closure e ∩ G.V := hcap.symm ▸ mem_singleton u + have hinc : G.VertexIncident u e := ⟨hu_mem.2, Or.inl he, hu_mem.1⟩ + have htilde1 : (tilde e).ncard = 1 := by + rw [htilde_eq e he, hcap, ncard_singleton] + have h_sub : ({e} : Set (Set S)) ⊆ {f ∈ G.E | G.VertexIncident u f ∧ (tilde f).ncard = 1} + := by + rintro f rfl + exact ⟨he, hinc, htilde1⟩ + have h_le : 1 ≤ {f ∈ G.E | G.VertexIncident u f ∧ (tilde f).ncard = 1}.ncard := by + have := ncard_le_ncard h_sub (G.finite_edges.subset fun _ hf => hf.1) + simpa using this + have h_val_u := hval u hu_mem.2 + unfold vertexValency at h_val_u + omega + have h_disj_cl : ∀ e₁ ∈ G.E, ∀ e₂ ∈ G.E, e₁ ≠ e₂ → Disjoint (closure e₁) (closure e₂) := by + intro e₁ he₁ e₂ he₂ hne + rw [Set.disjoint_left] + intro x hx1 hx2 + by_cases hxV : x ∈ G.V + · obtain ⟨_, _, _, _, _, ht1⟩ := h_no_loop e₁ he₁ + obtain ⟨_, _, _, _, _, ht2⟩ := h_no_loop e₂ he₂ + have h_sub : ({e₁, e₂} : Set (Set S)) ⊆ + {f ∈ G.E | G.VertexIncident x f ∧ (tilde f).ncard = 2} := by + rintro f (rfl | rfl) + · exact ⟨he₁, ⟨hxV, Or.inl he₁, hx1⟩, ht1⟩ + · exact ⟨he₂, ⟨hxV, Or.inl he₂, hx2⟩, ht2⟩ + have h_le : 2 ≤ {f ∈ G.E | G.VertexIncident x f ∧ (tilde f).ncard = 2}.ncard := by + have := ncard_le_ncard h_sub (G.finite_edges.subset fun _ hf => hf.1) + rwa [ncard_pair hne] at this + have h_val_x := hval x hxV + unfold vertexValency at h_val_x + omega + · have hx_e₁ : x ∈ e₁ := by rw [← G.closure_diff_V he₁]; exact ⟨hx1, hxV⟩ + have hx_e₂ : x ∈ e₂ := by rw [← G.closure_diff_V he₂]; exact ⟨hx2, hxV⟩ + exact hne (G.edge_eq_of_mem he₁ he₂ hx_e₁ hx_e₂) + have hV_sub : G.V ⊆ ⋃₀ (closure '' G.E) := by + intro v hv + have h_val_v := hval v hv + unfold vertexValency at h_val_v + have h_pos : 0 < {f ∈ G.E | G.VertexIncident v f ∧ (tilde f).ncard = 2}.ncard := by + by_contra h0 + have h0' : {f ∈ G.E | G.VertexIncident v f ∧ (tilde f).ncard = 2}.ncard = 0 := by omega + omega + have hfinite : {f ∈ G.E | G.VertexIncident v f ∧ (tilde f).ncard = 2}.Finite := + G.finite_edges.subset fun _ hf => hf.1 + obtain ⟨e, he, hinc, -⟩ := (ncard_pos hfinite).mp h_pos + exact ⟨closure e, mem_image_of_mem closure he, hinc.2.2⟩ + refine ⟨⟨G.finite_edges.image closure, ?_, ?_, hV_sub⟩, ?_⟩ + · rintro _ ⟨e, he, rfl⟩ + obtain ⟨u, v, huv, hcap, hL, -⟩ := h_no_loop e he + have huV : u ∈ G.V := by + have : u ∈ closure e ∩ G.V := hcap ▸ mem_insert u {v} + exact this.2 + have hvV : v ∈ G.V := by + have : v ∈ closure e ∩ G.V := hcap ▸ mem_insert_of_mem u rfl + exact this.2 + refine ⟨u, v, huv, ?_, huV, hvV, hL⟩ + apply Subset.antisymm + · intro x ⟨hxe, hx_bd⟩ + have hxV : x ∈ G.V := hprop ⟨hx_bd, G.closure_subset_U he hxe⟩ + rw [← hcap] + exact ⟨hxe, hxV⟩ + · rintro x (rfl | rfl) + · exact ⟨hL.left_mem, hV_bd huV⟩ + · exact ⟨hL.right_mem, hV_bd hvV⟩ + · rintro _ ⟨e₁, he₁, rfl⟩ _ ⟨e₂, he₂, rfl⟩ hne + exact h_disj_cl e₁ he₁ e₂ he₂ fun h => hne (congrArg closure h) + · apply Subset.antisymm + · rintro x ⟨_, ⟨e, he, rfl⟩, hx⟩ + exact G.closure_subset_U he hx + · intro x hxU + by_cases hxV : x ∈ G.V + · exact hV_sub hxV + · have he : pathComponentIn (G.U \ G.V) x ∈ G.E := + pathComponentIn_mem_arcComponentsIn ⟨hxU, hxV⟩ + exact ⟨closure (pathComponentIn (G.U \ G.V) x), mem_image_of_mem closure he, + subset_closure (mem_pathComponentIn_self ⟨hxU, hxV⟩)⟩ + +instance : Inhabited (Drawing S) := ⟨emptyDrawing S⟩ + +/-- Graph Minors VII, (3.3) (page 219): +"(3.3) *For any surface $\Sigma$ and finite $X \subseteq bd(\Sigma)$, there are only finitely many +congruence classes of $X$-matchings.*" -/ +theorem theorem_3_3_proof (hS : IsSurface S) {X : Set S} (hX : X ⊆ bd S) (hXfin : X.Finite) : + ∃ 𝓜 : Set (Drawing S), 𝓜.Finite ∧ + (∀ G₀ ∈ 𝓜, IsXMatching X G₀) ∧ + ∀ G : Drawing S, IsXMatching X G → ∃ G₀ ∈ 𝓜, AreCongruentMatchings G₀ G := by + have : T2Space S := hS.2.1 + obtain ⟨𝓤, h𝓤_fin, h𝓤_cov⟩ := finite_arcMatching_classes X.ncard hS hX hXfin rfl + let good (U₀ : Set S) : Prop := + ∃ G₀ : Drawing S, IsXMatching X G₀ ∧ + ∃ α : S ≃ₜ S, α '' U₀ = G₀.U ∧ ∀ x ∈ bd S, α x = x + set 𝓤' : Set (Set S) := {U₀ ∈ 𝓤 | good U₀} + have h𝓤'_fin : 𝓤'.Finite := h𝓤_fin.subset (sep_subset 𝓤 good) + have h_rep : ∀ U₀ ∈ 𝓤', ∃ G₀ : Drawing S, IsXMatching X G₀ ∧ + ∃ α : S ≃ₜ S, α '' U₀ = G₀.U ∧ ∀ x ∈ bd S, α x = x := + fun _ h => h.2 + choose! rep hrep_match hrep_congr using h_rep + refine ⟨rep '' 𝓤', h𝓤'_fin.image rep, ?_, ?_⟩ + · rintro _ ⟨U₀, hU₀, rfl⟩ + exact hrep_match U₀ hU₀ + · intro G hG + obtain ⟨h𝒜, hU_eq⟩ := isArcMatching_of_isXMatching hX hG + obtain ⟨U₀, hU₀_mem, α, hα_U, hα_bd⟩ := h𝓤_cov (closure '' G.E) h𝒜 + rw [hU_eq] at hα_U + have hU₀_good : U₀ ∈ {U₀ ∈ 𝓤 | good U₀} := ⟨hU₀_mem, ⟨G, hG, α, hα_U, hα_bd⟩⟩ + obtain ⟨α₀, hα₀_U, hα₀_bd⟩ := hrep_congr U₀ hU₀_good + refine ⟨rep U₀, mem_image_of_mem rep hU₀_good, α₀.symm.trans α, ?_, fun x hx => ?_⟩ + · calc + (α₀.symm.trans α) '' (rep U₀).U = α '' (α₀.symm '' (α₀ '' U₀)) := by + rw [← hα₀_U] + ext y + simp [Homeomorph.trans_apply] + _ = α '' U₀ := by congr 1; exact α₀.symm_image_image U₀ + _ = G.U := hα_U + · have hx₀ : α₀.symm x = x := (α₀.symm_apply_eq).mpr (hα₀_bd x hx).symm + simp [Homeomorph.trans_apply, hx₀, hα_bd x hx] + +/-! ## 4. Properties of `CurveTracesWalk` -/ + +open unitInterval + +theorem _root_.GraphMinor.Surface.CurveTracesWalk.endpoints {Γ : Drawing S} {u v : S} {φ : Curve S} + {W : GraphWalk Γ.toGraph u v} (h : CurveTracesWalk Γ φ W) : + φ 0 = u ∧ φ 1 = v := by + induction h with + | nil _ _ hconst => exact ⟨hconst 0, hconst 1⟩ + | cons _ _ _ _ _ _ hconcat _ => + rcases hconcat with ⟨_, _, _, h0, _, h1, _, _⟩ + exact ⟨h0, h1⟩ + +theorem _root_.GraphMinor.Surface.CurveTracesWalk.range_subset_U {Γ : Drawing S} {u v : S} {φ : + Curve S} + {W : GraphWalk Γ.toGraph u v} (h : CurveTracesWalk Γ φ W) : + range φ ⊆ Γ.U := by + induction h with + | nil hv φ hconst => + rintro _ ⟨x, rfl⟩ + rw [hconst x] + exact Γ.V_subset_U hv + | cons hlink _ _ φ _ _ hconcat ih => + rcases hconcat with ⟨t₀, _, _, _, _, _, hle, hge⟩ + rintro _ ⟨x, rfl⟩ + rcases le_total x.1 t₀.1 with hx | hx + · exact Γ.closure_subset_U hlink.1 (hle x hx) + · exact ih (hge x hx) + +/-- Every edge closure `closure e` (`e ∈ Γ.E`) is path-connected between its ends. -/ +theorem isLink_joinedIn_closure {Γ : Drawing S} {e : Set S} {u v : S} + (hlink : Γ.toGraph.IsLink e u v) : JoinedIn (closure e) u v := by + have huv_mem : ({u, v} : Set S) ⊆ closure e := by + have hcap : closure e ∩ Γ.V = {u, v} := hlink.2.2.2 + rw [← hcap] + exact inter_subset_left + have hu : u ∈ closure e := huv_mem (mem_insert u {v}) + have hv : v ∈ closure e := huv_mem (mem_insert_of_mem u rfl) + rcases Γ.edge_cond e hlink.1 with ⟨a, b, _, _, f, _, _⟩ | ⟨a, _, ⟨f⟩⟩ + · let p0 : Path (f.symm ⟨u, hu⟩) (f.symm ⟨v, hv⟩) := + { toContinuousMap := + ⟨fun t => ⟨(1 - t.1) * (f.symm ⟨u, hu⟩).1 + t.1 * (f.symm ⟨v, hv⟩).1, + convex_Icc (0 : ℝ) 1 (f.symm ⟨u, hu⟩).2 (f.symm ⟨v, hv⟩).2 + (sub_nonneg.mpr t.2.2) t.2.1 (sub_add_cancel 1 t.1)⟩, by fun_prop⟩ + source' := by ext; simp + target' := by ext; simp } + let p : Path u v := + { toContinuousMap := + ⟨fun t => (f (p0 t)).1, continuous_subtype_val.comp (f.continuous.comp p0.continuous)⟩ + source' := by + change (f (p0 0)).1 = u + rw [p0.source, f.apply_symm_apply] + target' := by + change (f (p0 1)).1 = v + rw [p0.target, f.apply_symm_apply] } + exact ⟨p, fun t => (f (p0 t)).2⟩ + · have hpc : IsPathConnected (closure e) := by + have hIcc : IsPathConnected (Icc (0 : ℝ) 1) := + (convex_Icc (0 : ℝ) 1).isPathConnected ⟨0, left_mem_Icc.mpr zero_le_one⟩ + have himg : (fun t : ℝ => (f (ee t)).1) '' Icc 0 1 = closure e := by + ext x + constructor + · rintro ⟨t, _, rfl⟩ + exact (f _).2 + · intro hx + obtain ⟨t, ht, ht_eq⟩ := exists_param (f.symm ⟨x, hx⟩) + refine ⟨t, Ico_subset_Icc_self ht, ?_⟩ + change (f (ee t)).1 = x + rw [ht_eq, f.apply_symm_apply] + rw [← himg] + exact hIcc.image (continuous_subtype_val.comp (f.continuous.comp continuous_ee)) + exact hpc.joinedIn u hu v hv + +/-- Concatenation of two curves `φ₁, φ₂ : Curve S` with `φ₁ 1 = φ₂ 0` at `t₀ = 1/2`. -/ +noncomputable def concatCurves (φ₁ φ₂ : Curve S) (h : φ₁ 1 = φ₂ 0) : Curve S where + toFun x := + if x.1 ≤ 1 / 2 then φ₁ (projIcc 0 1 zero_le_one (2 * x.1)) + else φ₂ (projIcc 0 1 zero_le_one (2 * x.1 - 1)) + continuous_toFun := by + refine Continuous.if_le ?_ ?_ continuous_subtype_val continuous_const (fun x hx => ?_) + · exact φ₁.continuous.comp (continuous_projIcc.comp (by fun_prop)) + · exact φ₂.continuous.comp (continuous_projIcc.comp (by fun_prop)) + · have hp1 : projIcc 0 1 zero_le_one (2 * x.1) = 1 := by + ext; change max (0 : ℝ) (min 1 (2 * x.1)) = 1; rw [hx]; norm_num + have hp0 : projIcc 0 1 zero_le_one (2 * x.1 - 1) = 0 := by + ext; change max (0 : ℝ) (min 1 (2 * x.1 - 1)) = 0; rw [hx]; norm_num + rw [hp1, hp0, h] + +/-- Every walk `W : GraphWalk Γ.toGraph u v` is traced by some curve `φ : Curve S` in the sense of +`CurveTracesWalk`. -/ +theorem exists_curveTracesWalk {Γ : Drawing S} {u v : S} (W : GraphWalk Γ.toGraph u v) : + ∃ φ : Curve S, CurveTracesWalk Γ φ W := by + induction W with + | nil hv => + exact ⟨ContinuousMap.const unitInterval _, .nil hv _ (fun _ => rfl)⟩ + | @cons u v w e hlink rest ih => + obtain ⟨p₁, hp₁⟩ := isLink_joinedIn_closure hlink + obtain ⟨φ₂, hφ₂⟩ := ih + obtain ⟨hφ₂0, hφ₂1⟩ := hφ₂.endpoints + let φ₁ : Curve S := p₁.toContinuousMap + have h12 : φ₁ 1 = φ₂ 0 := p₁.target.trans hφ₂0.symm + let φ : Curve S := concatCurves φ₁ φ₂ h12 + refine ⟨φ, .cons hlink φ₁ φ₂ φ ⟨p₁.source, p₁.target, ?_⟩ hφ₂ ?_⟩ + · rintro _ ⟨x, rfl⟩ + exact hp₁ x + · let t₀ : unitInterval := ⟨1 / 2, by constructor <;> norm_num⟩ + refine ⟨t₀, by norm_num [t₀], by norm_num [t₀], ?_, ?_, ?_, ?_, ?_⟩ + · change (if ((0 : unitInterval) : ℝ) ≤ 1 / 2 then _ else _) = u + have hle : ((0 : unitInterval) : ℝ) ≤ 1 / 2 := by norm_num + simp only [hle, ↓reduceIte] + have hp : projIcc 0 1 zero_le_one (2 * ((0 : unitInterval) : ℝ)) = 0 := by + ext; change max (0 : ℝ) (min 1 (2 * 0)) = 0; norm_num + rw [hp] + exact p₁.source + · change (if (1 / 2 : ℝ) ≤ 1 / 2 then _ else _) = v + simp only [le_refl, ↓reduceIte] + have hp : projIcc 0 1 zero_le_one (2 * (1 / 2 : ℝ)) = 1 := by + ext; change max (0 : ℝ) (min 1 (2 * (1 / 2))) = 1; norm_num + rw [hp] + exact p₁.target + · change (if ((1 : unitInterval) : ℝ) ≤ 1 / 2 then _ else _) = w + have hnot : ¬ (((1 : unitInterval) : ℝ) ≤ 1 / 2) := by norm_num + simp only [hnot, ↓reduceIte] + have hp : projIcc 0 1 zero_le_one (2 * ((1 : unitInterval) : ℝ) - 1) = 1 := by + ext; change max (0 : ℝ) (min 1 (2 * 1 - 1)) = 1; norm_num + rw [hp] + exact hφ₂1 + · intro x hx + change (if x.1 ≤ 1 / 2 then _ else _) ∈ closure e + have hx' : x.1 ≤ 1 / 2 := hx + simp only [hx', ↓reduceIte] + exact hp₁ _ + · intro x hx + change (if x.1 ≤ 1 / 2 then _ else _) ∈ range φ₂ + by_cases hx' : x.1 ≤ 1 / 2 + · have h_eq : x.1 = 1 / 2 := le_antisymm hx' hx + simp only [hx', ↓reduceIte] + have hp : projIcc 0 1 zero_le_one (2 * x.1) = 1 := by + ext; change max (0 : ℝ) (min 1 (2 * x.1)) = 1; rw [h_eq]; norm_num + rw [hp, h12] + exact mem_range_self 0 + · simp only [hx', ↓reduceIte] + exact mem_range_self _ + +/-! ## 5. Homeomorphism Transport of Drawings, Walks, Curves, and Homotopy -/ + +theorem mapDrawingHomeo_E {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') (Γ : Drawing S) : + (mapDrawingHomeo α Γ).E = (image α) '' Γ.E := by + change arcComponentsIn (α '' Γ.U \ α '' Γ.V) = (image α) '' arcComponentsIn (Γ.U \ Γ.V) + rw [← image_sdiff α.injective, arcComponentsIn_image_homeo] + +theorem mapDrawingHomeo_isLink {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') {Γ : Drawing S} + {e : Set S} {u v : S} (h : Γ.toGraph.IsLink e u v) : + (mapDrawingHomeo α Γ).toGraph.IsLink (α '' e) (α u) (α v) := by + rcases h with ⟨he, hu, hv, hcap⟩ + refine ⟨?_, mem_image_of_mem α hu, mem_image_of_mem α hv, ?_⟩ + · rw [mapDrawingHomeo_E] + exact mem_image_of_mem (image α) he + · change closure (α '' e) ∩ α '' Γ.V = {α u, α v} + rw [← α.image_closure, ← image_inter α.injective, hcap, image_pair] + +/-- Transport of a walk `W` in `Γ.toGraph` along a homeomorphism `α : S ≃ₜ S'`. -/ +def mapWalkHomeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') {Γ : Drawing S} + {u v : S} : GraphWalk Γ.toGraph u v → GraphWalk (mapDrawingHomeo α Γ).toGraph (α u) (α v) + | .nil hv => .nil (mem_image_of_mem α hv) + | .cons hlink rest => .cons (mapDrawingHomeo_isLink α hlink) (mapWalkHomeo α rest) + +theorem support_mapWalkHomeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') + {Γ : Drawing S} {u v : S} (W : GraphWalk Γ.toGraph u v) : + (mapWalkHomeo α W).support = W.support.map α := by + induction W with + | nil _ => rfl + | cons _ _ ih => simp [mapWalkHomeo, GraphWalk.support, ih] + +theorem edges_mapWalkHomeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') + {Γ : Drawing S} {u v : S} (W : GraphWalk Γ.toGraph u v) : + (mapWalkHomeo α W).edges = W.edges.map (image α) := by + induction W with + | nil _ => rfl + | cons _ _ ih => simp [mapWalkHomeo, GraphWalk.edges, ih] + +theorem length_mapWalkHomeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') + {Γ : Drawing S} {u v : S} (W : GraphWalk Γ.toGraph u v) : + (mapWalkHomeo α W).length = W.length := by + simp [GraphWalk.length, edges_mapWalkHomeo] + +theorem isSimple_mapWalkHomeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') + {Γ : Drawing S} {u v : S} {W : GraphWalk Γ.toGraph u v} (hW : W.IsSimple) : + (mapWalkHomeo α W).IsSimple := by + unfold GraphWalk.IsSimple at hW ⊢ + rw [support_mapWalkHomeo] + exact hW.map α.injective + +theorem isSimpleClosed_mapWalkHomeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') + {Γ : Drawing S} {u : S} {W : GraphWalk Γ.toGraph u u} (hW : W.IsSimpleClosed) : + (mapWalkHomeo α W).IsSimpleClosed := by + rcases hW with ⟨hs, he⟩ + refine ⟨?_, ?_⟩ + · rw [support_mapWalkHomeo, ← List.map_tail] + exact hs.map α.injective + · rw [edges_mapWalkHomeo] + exact he.map (image_injective.mpr α.injective) + +theorem mapDrawingHomeo_symm_mapDrawingHomeo {S' : Type v} [TopologicalSpace S'] + (α : S ≃ₜ S') (Γ : Drawing S) : + mapDrawingHomeo α.symm (mapDrawingHomeo α Γ) = Γ := by + cases Γ + simp only [mapDrawingHomeo, Drawing.mk.injEq] + exact ⟨α.symm_image_image _, α.symm_image_image _⟩ + +theorem _root_.GraphMinor.Surface.CurveTracesWalk.map_homeo {S' : Type v} [TopologicalSpace S'] + (α : S ≃ₜ S') + {Γ : Drawing S} {u v : S} {φ : Curve S} {W : GraphWalk Γ.toGraph u v} + (h : CurveTracesWalk Γ φ W) : + CurveTracesWalk (mapDrawingHomeo α Γ) + (ContinuousMap.comp ⟨α, α.continuous⟩ φ) (mapWalkHomeo α W) := by + induction h with + | nil hv φ hconst => + have hv' : α _ ∈ (mapDrawingHomeo α Γ).V := mem_image_of_mem α hv + refine .nil hv' _ (fun x => ?_) + change α (φ x) = α _ + rw [hconst x] + | cons hlink φ₁ φ₂ φ hφ₁ hφ₂ hconcat ih => + rcases hconcat with ⟨t₀, ht0, ht1, h0, htv, h1, hle, hge⟩ + refine .cons (mapDrawingHomeo_isLink α hlink) + (ContinuousMap.comp ⟨α, α.continuous⟩ φ₁) + (ContinuousMap.comp ⟨α, α.continuous⟩ φ₂) + (ContinuousMap.comp ⟨α, α.continuous⟩ φ) + ⟨by change α (φ₁ 0) = _; rw [hφ₁.1], + by change α (φ₁ 1) = _; rw [hφ₁.2.1], ?_⟩ + ih + ⟨t₀, ht0, ht1, + by change α (φ 0) = _; rw [h0], + by change α (φ t₀) = _; rw [htv], + by change α (φ 1) = _; rw [h1], ?_, ?_⟩ + · rintro _ ⟨x, rfl⟩ + rw [← α.image_closure] + exact mem_image_of_mem α (hφ₁.2.2 (mem_range_self x)) + · intro x hx + rw [← α.image_closure] + exact mem_image_of_mem α (hle x hx) + · intro x hx + obtain ⟨y, hy⟩ := hge x hx + exact ⟨y, by change α (φ₂ y) = α (φ x); rw [hy]⟩ + +/-! ## 6. Equivalence of Curve Homotopy and `IsFlat.curvesHomotopic` -/ + +theorem CurvesHomotopicIn.refl {Z : Set S} {φ : Curve S} (hZ : range φ ⊆ Z) : + CurvesHomotopicIn Z φ φ := + ⟨φ.comp ⟨Prod.fst, continuous_fst⟩, + fun p => hZ (mem_range_self p.1), + fun _ => rfl, fun _ => rfl, fun _ => rfl, fun _ => rfl, fun _ => rfl, fun _ => rfl⟩ + +theorem CurvesHomotopicIn.symm {Z : Set S} {φ₀ φ₁ : Curve S} + (h : CurvesHomotopicIn Z φ₀ φ₁) : CurvesHomotopicIn Z φ₁ φ₀ := by + rcases h with ⟨ψ, hZ, h0, h1, hy0, hy0', hy1, hy1'⟩ + refine ⟨ψ.comp ⟨fun p => (p.1, unitInterval.symm p.2), by fun_prop⟩, + fun p => hZ _, fun x => by simpa using h1 x, fun x => by simpa using h0 x, + fun y => hy0' _, fun y => hy0 _, fun y => hy1' _, fun y => hy1 _⟩ + +theorem CurvesHomotopicIn.trans {Z : Set S} {φ₀ φ₁ φ₂ : Curve S} + (h₁ : CurvesHomotopicIn Z φ₀ φ₁) (h₂ : CurvesHomotopicIn Z φ₁ φ₂) : + CurvesHomotopicIn Z φ₀ φ₂ := by + rcases h₁ with ⟨ψ₁, hZ₁, h₁0, h₁1, h₁y0, h₁y0', h₁y1, h₁y1'⟩ + rcases h₂ with ⟨ψ₂, hZ₂, h₂0, h₂1, h₂y0, h₂y0', h₂y1, h₂y1'⟩ + let f₁ : C(unitInterval × unitInterval, S) := + ψ₁.comp ⟨fun p => (p.1, projIcc 0 1 zero_le_one (2 * p.2.1)), by fun_prop⟩ + let f₂ : C(unitInterval × unitInterval, S) := + ψ₂.comp ⟨fun p => (p.1, projIcc 0 1 zero_le_one (2 * p.2.1 - 1)), by fun_prop⟩ + have hcont : Continuous (fun p : unitInterval × unitInterval => + if p.2.1 ≤ 1 / 2 then f₁ p else f₂ p) := by + refine Continuous.if_le f₁.continuous f₂.continuous + (continuous_subtype_val.comp continuous_snd) continuous_const (fun p hp => ?_) + have hp1 : projIcc 0 1 zero_le_one (2 * p.2.1) = 1 := by + ext; change max (0 : ℝ) (min 1 (2 * p.2.1)) = 1; rw [hp]; norm_num + have hp0 : projIcc 0 1 zero_le_one (2 * p.2.1 - 1) = 0 := by + ext; change max (0 : ℝ) (min 1 (2 * p.2.1 - 1)) = 0; rw [hp]; norm_num + change ψ₁ (p.1, projIcc 0 1 zero_le_one (2 * p.2.1)) = + ψ₂ (p.1, projIcc 0 1 zero_le_one (2 * p.2.1 - 1)) + rw [hp1, hp0, h₁1 p.1, h₂0 p.1] + refine ⟨⟨fun p => if p.2.1 ≤ 1 / 2 then f₁ p else f₂ p, hcont⟩, + fun p => by + change (if p.2.1 ≤ 1 / 2 then f₁ p else f₂ p) ∈ Z + by_cases hp : p.2.1 ≤ 1 / 2 <;> simp only [hp, ↓reduceIte] + · exact hZ₁ _ + · exact hZ₂ _, + fun x => ?_, fun x => ?_, fun y => ?_, fun y => ?_, fun y => ?_, fun y => ?_⟩ + · change (if ((0 : unitInterval) : ℝ) ≤ 1 / 2 then f₁ (x, 0) else f₂ (x, 0)) = φ₀ x + have hle : ((0 : unitInterval) : ℝ) ≤ 1 / 2 := by norm_num + simp only [hle, ↓reduceIte, f₁] + have hp0 : projIcc 0 1 zero_le_one (2 * ((0 : unitInterval) : ℝ)) = 0 := by + ext; change max (0 : ℝ) (min 1 (2 * 0)) = 0; norm_num + change ψ₁ (x, projIcc 0 1 zero_le_one (2 * ((0 : unitInterval) : ℝ))) = φ₀ x + rw [hp0, h₁0 x] + · change (if ((1 : unitInterval) : ℝ) ≤ 1 / 2 then f₁ (x, 1) else f₂ (x, 1)) = φ₂ x + have hnot : ¬ (((1 : unitInterval) : ℝ) ≤ 1 / 2) := by norm_num + simp only [hnot, ↓reduceIte, f₂] + have hp1 : projIcc 0 1 zero_le_one (2 * ((1 : unitInterval) : ℝ) - 1) = 1 := by + ext; change max (0 : ℝ) (min 1 (2 * 1 - 1)) = 1; norm_num + change ψ₂ (x, projIcc 0 1 zero_le_one (2 * ((1 : unitInterval) : ℝ) - 1)) = φ₂ x + rw [hp1, h₂1 x] + · change (if y.1 ≤ 1 / 2 then f₁ (0, y) else f₂ (0, y)) = φ₀ 0 + by_cases hy : y.1 ≤ 1 / 2 <;> simp only [hy, ↓reduceIte] + · exact h₁y0 _ + · exact (h₂y0 _).trans ((h₁y0' 0).symm.trans (h₁y0 0)) + · change (if y.1 ≤ 1 / 2 then f₁ (0, y) else f₂ (0, y)) = φ₂ 0 + by_cases hy : y.1 ≤ 1 / 2 <;> simp only [hy, ↓reduceIte] + · exact (h₁y0' _).trans ((h₂y0 0).symm.trans (h₂y0' 0)) + · exact h₂y0' _ + · change (if y.1 ≤ 1 / 2 then f₁ (1, y) else f₂ (1, y)) = φ₀ 1 + by_cases hy : y.1 ≤ 1 / 2 <;> simp only [hy, ↓reduceIte] + · exact h₁y1 _ + · exact (h₂y1 _).trans ((h₁y1' 0).symm.trans (h₁y1 0)) + · change (if y.1 ≤ 1 / 2 then f₁ (1, y) else f₂ (1, y)) = φ₂ 1 + by_cases hy : y.1 ≤ 1 / 2 <;> simp only [hy, ↓reduceIte] + · exact (h₁y1' _).trans ((h₂y1 0).symm.trans (h₂y1' 0)) + · exact h₂y1' _ + +theorem CurvesHomotopic.refl (φ : Curve S) : CurvesHomotopic φ φ := + CurvesHomotopicIn.refl (subset_univ _) + +theorem CurvesHomotopic.symm {φ₀ φ₁ : Curve S} (h : CurvesHomotopic φ₀ φ₁) : + CurvesHomotopic φ₁ φ₀ := + CurvesHomotopicIn.symm h + +theorem CurvesHomotopic.trans {φ₀ φ₁ φ₂ : Curve S} + (h₁ : CurvesHomotopic φ₀ φ₁) (h₂ : CurvesHomotopic φ₁ φ₂) : + CurvesHomotopic φ₀ φ₂ := + CurvesHomotopicIn.trans h₁ h₂ + +theorem CurvesHomotopic.map_homeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') + {φ₀ φ₁ : Curve S} (h : CurvesHomotopic φ₀ φ₁) : + CurvesHomotopic (ContinuousMap.comp ⟨α, α.continuous⟩ φ₀) + (ContinuousMap.comp ⟨α, α.continuous⟩ φ₁) := by + rcases h with ⟨ψ, _, h0, h1, hy0, hy0', hy1, hy1'⟩ + refine ⟨ContinuousMap.comp ⟨α, α.continuous⟩ ψ, fun _ => mem_univ _, + fun x => congrArg α (h0 x), fun x => congrArg α (h1 x), + fun y => congrArg α (hy0 y), fun y => congrArg α (hy0' y), + fun y => congrArg α (hy1 y), fun y => congrArg α (hy1' y)⟩ + +/-- Any curve `φ : Curve S` is homotopic to its 3-interval reparameterization +`x ↦ φ (projIcc 0 1 zero_le_one (3 * x.1 - 1))`. -/ +theorem curvesHomotopic_reparam_three (φ : Curve S) : + CurvesHomotopic φ + ⟨fun x => φ (projIcc 0 1 zero_le_one (3 * x.1 - 1)), + φ.continuous.comp (continuous_projIcc.comp (by fun_prop))⟩ := by + let m : unitInterval → unitInterval := fun x => projIcc 0 1 zero_le_one (3 * x.1 - 1) + have hm_cont : Continuous m := continuous_projIcc.comp (by fun_prop) + have hm0 : m 0 = 0 := by ext; change max (0 : ℝ) (min 1 (3 * 0 - 1)) = 0; norm_num + have hm1 : m 1 = 1 := by ext; change max (0 : ℝ) (min 1 (3 * 1 - 1)) = 1; norm_num + let interp : unitInterval × unitInterval → unitInterval := + fun p => projIcc 0 1 zero_le_one ((1 - p.2.1) * p.1.1 + p.2.1 * (m p.1).1) + have hinterp_cont : Continuous interp := continuous_projIcc.comp (by fun_prop) + refine ⟨φ.comp ⟨interp, hinterp_cont⟩, fun _ => mem_univ _, + fun x => ?_, fun x => ?_, fun y => ?_, fun y => ?_, fun y => ?_, fun y => ?_⟩ + · change φ (projIcc 0 1 zero_le_one ((1 - 0) * x.1 + 0 * (m x).1)) = φ x + congr 1; ext; change max (0 : ℝ) (min 1 ((1 - 0) * x.1 + 0 * (m x).1)) = x.1 + simp [x.2.1, x.2.2] + · change φ (projIcc 0 1 zero_le_one ((1 - 1) * x.1 + 1 * (m x).1)) = φ (m x) + congr 1; ext; change max (0 : ℝ) (min 1 ((1 - 1) * x.1 + 1 * (m x).1)) = (m x).1 + simp [(m x).2.1, (m x).2.2] + · change φ (projIcc 0 1 zero_le_one ((1 - y.1) * 0 + y.1 * (m 0).1)) = φ 0 + rw [hm0]; congr 1; ext; change max (0 : ℝ) (min 1 ((1 - y.1) * 0 + y.1 * 0)) = 0; norm_num + · change φ (projIcc 0 1 zero_le_one ((1 - y.1) * 0 + y.1 * (m 0).1)) = φ (m 0) + rw [hm0]; congr 1; ext; change max (0 : ℝ) (min 1 ((1 - y.1) * 0 + y.1 * 0)) = 0; norm_num + · change φ (projIcc 0 1 zero_le_one ((1 - y.1) * 1 + y.1 * (m 1).1)) = φ 1 + rw [hm1]; congr 1; ext; change max (0 : ℝ) (min 1 ((1 - y.1) * 1 + y.1 * 1)) + = 1; ring_nf; norm_num + · change φ (projIcc 0 1 zero_le_one ((1 - y.1) * 1 + y.1 * (m 1).1)) = φ (m 1) + rw [hm1]; congr 1; ext; change max (0 : ℝ) (min 1 ((1 - y.1) * 1 + y.1 * 1)) + = 1; ring_nf; norm_num + +/-- In a flat subset `Z ⊆ S` (`IsFlat Z`), any two curves `φ₁, φ₂ : Curve S` with `range φ₁ ⊆ Z`, +`range φ₂ ⊆ Z`, `φ₁ 0 = φ₂ 0`, and `φ₁ 1 = φ₂ 1` are homotopic in `S` (`CurvesHomotopic φ₁ φ₂`). -/ +theorem IsFlat.curvesHomotopic {Z : Set S} (hZ : IsFlat Z) {φ₁ φ₂ : Curve S} + (hφ₁ : range φ₁ ⊆ Z) (hφ₂ : range φ₂ ⊆ Z) (h0 : φ₁ 0 = φ₂ 0) (h1 : φ₁ 1 = φ₂ 1) : + CurvesHomotopic φ₁ φ₂ := by + have htwo : 0 < 2 := by decide + let rev₂ : Curve S := φ₂.comp ⟨unitInterval.symm, unitInterval.continuous_symm⟩ + let γ : Fin 2 → Curve S := ![φ₁, rev₂] + have hmatch : ∀ i : Fin 2, γ i 1 = γ (finNext htwo i) 0 := by + intro i + fin_cases i + · change φ₁ 1 = φ₂ (unitInterval.symm 0) + simpa using h1 + · change φ₂ (unitInterval.symm 1) = φ₁ 0 + simpa using h0.symm + let L : C(Circle, S) := concatLoop htwo γ hmatch + have hL_range : range L ⊆ Z := by + dsimp [L] + rw [range_concatLoop] + refine iUnion_subset fun i => ?_ + fin_cases i + · exact hφ₁ + · rintro _ ⟨x, rfl⟩ + exact hφ₂ (mem_range_self _) + obtain ⟨c, _, H, _, hH0, hH1⟩ := hZ L hL_range + have hH_arc₁ : ∀ t : unitInterval, H (Circle.exp (Real.pi * t.1), 0) = φ₁ t := by + intro t + have hp := concatLoop_exp_piece htwo γ hmatch 0 t + have hexp : 2 * Real.pi * (((0 : Fin 2).1 : ℝ) + t.1) / (2 : ℕ) = Real.pi * t.1 := by + simp only [Fin.val_zero, Nat.cast_zero, zero_add, Nat.cast_ofNat] + ring + rw [hexp] at hp + exact (hH0 _).trans hp + have hH_arc₂ : ∀ t : unitInterval, H (Circle.exp (Real.pi * (2 - t.1)), 0) = φ₂ t := by + intro t + have hp := concatLoop_exp_piece htwo γ hmatch 1 (unitInterval.symm t) + have hexp : 2 * Real.pi * (((1 : Fin 2).1 : ℝ) + (unitInterval.symm t).1) / (2 : ℕ) = + Real.pi * (2 - t.1) := by + simp only [Fin.val_one, Nat.cast_one, coe_symm_eq, Nat.cast_ofNat] + ring + rw [hexp] at hp + have hγ1 : γ 1 (unitInterval.symm t) = φ₂ t := by + change φ₂ (unitInterval.symm (unitInterval.symm t)) = φ₂ t + rw [unitInterval.symm_symm] + rw [hγ1] at hp + exact (hH0 _).trans hp + let m : unitInterval → unitInterval := fun x => projIcc 0 1 zero_le_one (3 * x.1 - 1) + have hm_cont : Continuous m := continuous_projIcc.comp (by fun_prop) + have hm0 : m 0 = 0 := by ext; change max (0 : ℝ) (min 1 (3 * 0 - 1)) = 0; norm_num + have hm1 : m 1 = 1 := by ext; change max (0 : ℝ) (min 1 (3 * 1 - 1)) = 1; norm_num + let k : unitInterval → ℝ := fun x => min (3 * x.1) (min 1 (3 * (1 - x.1))) + have hk_cont : Continuous k := by fun_prop + have hk0 : k 0 = 0 := by change min (3 * (0 : ℝ)) (min 1 (3 * (1 - 0))) = 0; norm_num + have hk1 : k 1 = 0 := by change min (3 * (1 : ℝ)) (min 1 (3 * (1 - 1))) = 0; norm_num + let τ : unitInterval × unitInterval → unitInterval := + fun p => projIcc 0 1 zero_le_one (k p.1 * p.2.1) + have hτ_cont : Continuous τ := continuous_projIcc.comp (by fun_prop) + have hτ_y0 : ∀ x : unitInterval, τ (x, 0) = 0 := by + intro x; ext; change max (0 : ℝ) (min 1 (k x * 0)) = 0; norm_num + have hτ_0y : ∀ y : unitInterval, τ (0, y) = 0 := by + intro y; ext; change max (0 : ℝ) (min 1 (k 0 * y.1)) = 0; rw [hk0]; norm_num + have hτ_1y : ∀ y : unitInterval, τ (1, y) = 0 := by + intro y; ext; change max (0 : ℝ) (min 1 (k 1 * y.1)) = 0; rw [hk1]; norm_num + let φ₁' : Curve S := ⟨fun x => φ₁ (m x), φ₁.continuous.comp hm_cont⟩ + let φ₂' : Curve S := ⟨fun x => φ₂ (m x), φ₂.continuous.comp hm_cont⟩ + let midCurve : Curve S := + ⟨fun x => H (Circle.exp (Real.pi * (m x).1), τ (x, 1)), + H.continuous.comp (Continuous.prodMk (by fun_prop) (hτ_cont.comp (by fun_prop)))⟩ + have hmid_eq : ∀ x : unitInterval, + H (Circle.exp (Real.pi * (2 - (m x).1)), τ (x, 1)) = midCurve x := by + intro x + by_cases hx1 : x.1 ≤ 1 / 3 + · have hmx : (m x).1 = 0 := by + change max (0 : ℝ) (min 1 (3 * x.1 - 1)) = 0 + have : min 1 (3 * x.1 - 1) ≤ 0 := le_trans (min_le_right _ _) (by linarith) + exact max_eq_left this + change H (Circle.exp (Real.pi * (2 - (m x).1)), τ (x, 1)) = + H (Circle.exp (Real.pi * (m x).1), τ (x, 1)) + rw [hmx] + have hexp : Circle.exp (Real.pi * (2 - 0)) = Circle.exp (Real.pi * 0) := by + have h2pi : Real.pi * (2 - 0) = 2 * Real.pi := by ring + rw [h2pi, mul_zero, Circle.exp_two_pi, Circle.exp_zero] + rw [hexp] + · by_cases hx2 : 2 / 3 ≤ x.1 + · have hmx : (m x).1 = 1 := by + change max (0 : ℝ) (min 1 (3 * x.1 - 1)) = 1 + have hmin : min 1 (3 * x.1 - 1) = 1 := min_eq_left (by linarith) + rw [hmin] + exact max_eq_right zero_le_one + change H (Circle.exp (Real.pi * (2 - (m x).1)), τ (x, 1)) = + H (Circle.exp (Real.pi * (m x).1), τ (x, 1)) + rw [hmx] + ring_nf + · have hkx : k x = 1 := by + change min (3 * x.1) (min 1 (3 * (1 - x.1))) = 1 + have hmin1 : min 1 (3 * (1 - x.1)) = 1 := min_eq_left (by linarith) + rw [hmin1] + exact min_eq_right (by linarith) + have hτ1 : τ (x, 1) = 1 := by + ext; change max (0 : ℝ) (min 1 (k x * 1)) = 1 + rw [hkx]; norm_num + change H (Circle.exp (Real.pi * (2 - (m x).1)), τ (x, 1)) = + H (Circle.exp (Real.pi * (m x).1), τ (x, 1)) + rw [hτ1, hH1, hH1] + rfl + have hmid0 : midCurve 0 = φ₁ 0 := by + change H (Circle.exp (Real.pi * (m 0).1), τ (0, 1)) = φ₁ 0 + rw [hm0, hτ_0y 1] + exact hH_arc₁ 0 + have hmid1 : midCurve 1 = φ₁ 1 := by + change H (Circle.exp (Real.pi * (m 1).1), τ (1, 1)) = φ₁ 1 + rw [hm1, hτ_1y 1] + exact hH_arc₁ 1 + have hhom₁' : CurvesHomotopic φ₁' midCurve := by + refine ⟨⟨fun p => H (Circle.exp (Real.pi * (m p.1).1), τ p), + H.continuous.comp (Continuous.prodMk (by fun_prop) hτ_cont)⟩, + fun _ => mem_univ _, fun x => ?_, fun _ => rfl, + fun y => ?_, fun y => ?_, fun y => ?_, fun y => ?_⟩ + · change H (Circle.exp (Real.pi * (m x).1), τ (x, 0)) = φ₁ (m x) + rw [hτ_y0 x] + exact hH_arc₁ (m x) + · change H (Circle.exp (Real.pi * (m 0).1), τ (0, y)) = φ₁ (m 0) + rw [hm0, hτ_0y y] + exact hH_arc₁ 0 + · change H (Circle.exp (Real.pi * (m 0).1), τ (0, y)) = midCurve 0 + rw [hm0, hτ_0y y, hmid0] + exact hH_arc₁ 0 + · change H (Circle.exp (Real.pi * (m 1).1), τ (1, y)) = φ₁ (m 1) + rw [hm1, hτ_1y y] + exact hH_arc₁ 1 + · change H (Circle.exp (Real.pi * (m 1).1), τ (1, y)) = midCurve 1 + rw [hm1, hτ_1y y, hmid1] + exact hH_arc₁ 1 + have hhom₂' : CurvesHomotopic φ₂' midCurve := by + refine ⟨⟨fun p => H (Circle.exp (Real.pi * (2 - (m p.1).1)), τ p), + H.continuous.comp (Continuous.prodMk (by fun_prop) hτ_cont)⟩, + fun _ => mem_univ _, fun x => ?_, fun x => hmid_eq x, + fun y => ?_, fun y => ?_, fun y => ?_, fun y => ?_⟩ + · change H (Circle.exp (Real.pi * (2 - (m x).1)), τ (x, 0)) = φ₂ (m x) + rw [hτ_y0 x] + exact hH_arc₂ (m x) + · change H (Circle.exp (Real.pi * (2 - (m 0).1)), τ (0, y)) = φ₂ (m 0) + rw [hm0, hτ_0y y] + exact hH_arc₂ 0 + · change H (Circle.exp (Real.pi * (2 - (m 0).1)), τ (0, y)) = midCurve 0 + rw [hm0, hτ_0y y, hmid0, h0] + exact hH_arc₂ 0 + · change H (Circle.exp (Real.pi * (2 - (m 1).1)), τ (1, y)) = φ₂ (m 1) + rw [hm1, hτ_1y y] + exact hH_arc₂ 1 + · change H (Circle.exp (Real.pi * (2 - (m 1).1)), τ (1, y)) = midCurve 1 + rw [hm1, hτ_1y y, hmid1, h1] + exact hH_arc₂ 1 + exact CurvesHomotopic.trans (curvesHomotopic_reparam_three φ₁) + (CurvesHomotopic.trans hhom₁' + (CurvesHomotopic.trans (CurvesHomotopic.symm hhom₂') + (CurvesHomotopic.symm (curvesHomotopic_reparam_three φ₂)))) + +/-! ## 7. Equivalence of `ForestsHomotopic` and `ForestsHomoplastic`, and Theorems (3.4)–(3.5) -/ + +theorem pullback_isLink_homeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') {Γ : Drawing S} + {e' : Set S'} {u' v' : S'} (h : (mapDrawingHomeo α Γ).toGraph.IsLink e' u' v') : + Γ.toGraph.IsLink (α.symm '' e') (α.symm u') (α.symm v') := by + rcases h with ⟨he', hu', hv', hcap'⟩ + rw [mapDrawingHomeo_E] at he' + rcases he' with ⟨e, he, rfl⟩ + rcases hu' with ⟨u, hu, rfl⟩ + rcases hv' with ⟨v, hv, rfl⟩ + have h_e : α.symm '' (α '' e) = e := α.symm_image_image e + rw [h_e, α.symm_apply_apply, α.symm_apply_apply] + refine ⟨he, hu, hv, ?_⟩ + have h1 : α.symm '' (closure (α '' e) ∩ α '' Γ.V) = α.symm '' {α u, α v} := + congrArg (image α.symm) hcap' + have h2 : α.symm '' (closure (α '' e) ∩ α '' Γ.V) = closure e ∩ Γ.V := by + rw [← α.image_closure, ← image_inter α.injective] + exact α.symm_image_image _ + rw [h2, image_pair, α.symm_apply_apply, α.symm_apply_apply] at h1 + exact h1 + +/-- Pullback of a walk `W'` in `(mapDrawingHomeo α Γ).toGraph` to `Γ.toGraph`. -/ +def pullbackWalkHomeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') {Γ : Drawing S} + {u' v' : S'} : + GraphWalk (mapDrawingHomeo α Γ).toGraph u' v' → + GraphWalk Γ.toGraph (α.symm u') (α.symm v') + | .nil hv' => .nil (by + rcases hv' with ⟨v, hv, rfl⟩ + change α.symm (α v) ∈ Γ.V + rwa [α.symm_apply_apply]) + | .cons hlink rest => .cons (pullback_isLink_homeo α hlink) (pullbackWalkHomeo α rest) + +theorem support_pullbackWalkHomeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') + {Γ : Drawing S} {u' v' : S'} (W' : GraphWalk (mapDrawingHomeo α Γ).toGraph u' v') : + (pullbackWalkHomeo α W').support = W'.support.map α.symm := by + induction W' with + | nil _ => rfl + | cons _ _ ih => simp [pullbackWalkHomeo, GraphWalk.support, ih] + +theorem edges_pullbackWalkHomeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') + {Γ : Drawing S} {u' v' : S'} (W' : GraphWalk (mapDrawingHomeo α Γ).toGraph u' v') : + (pullbackWalkHomeo α W').edges = W'.edges.map (image α.symm) := by + induction W' with + | nil _ => rfl + | cons _ _ ih => simp [pullbackWalkHomeo, GraphWalk.edges, ih] + +theorem length_pullbackWalkHomeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') + {Γ : Drawing S} {u' v' : S'} (W' : GraphWalk (mapDrawingHomeo α Γ).toGraph u' v') : + (pullbackWalkHomeo α W').length = W'.length := by + simp [GraphWalk.length, edges_pullbackWalkHomeo] + +theorem isSimple_pullbackWalkHomeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') + {Γ : Drawing S} {u' v' : S'} {W' : GraphWalk (mapDrawingHomeo α Γ).toGraph u' v'} + (hW' : W'.IsSimple) : (pullbackWalkHomeo α W').IsSimple := by + unfold GraphWalk.IsSimple at hW' ⊢ + rw [support_pullbackWalkHomeo] + exact hW'.map α.symm.injective + +theorem isSimpleClosed_pullbackWalkHomeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') + {Γ : Drawing S} {u' : S'} {W' : GraphWalk (mapDrawingHomeo α Γ).toGraph u' u'} + (hW' : W'.IsSimpleClosed) : (pullbackWalkHomeo α W').IsSimpleClosed := by + rcases hW' with ⟨hs, he⟩ + refine ⟨?_, ?_⟩ + · rw [support_pullbackWalkHomeo, ← List.map_tail] + exact hs.map α.symm.injective + · rw [edges_pullbackWalkHomeo] + exact he.map (image_injective.mpr α.symm.injective) + +theorem _root_.GraphMinor.Surface.CurveTracesWalk.pullback_homeo {S' : Type v} [TopologicalSpace + S'] (α : S ≃ₜ S') + {Γ : Drawing S} {u' v' : S'} {φ' : Curve S'} + {W' : GraphWalk (mapDrawingHomeo α Γ).toGraph u' v'} + (h : CurveTracesWalk (mapDrawingHomeo α Γ) φ' W') : + CurveTracesWalk Γ + (ContinuousMap.comp ⟨α.symm, α.symm.continuous⟩ φ') (pullbackWalkHomeo α W') := by + induction h with + | @nil w' hv' φ' hconst => + have hv : α.symm w' ∈ Γ.V := by + rcases hv' with ⟨v, hv, rfl⟩ + rwa [α.symm_apply_apply] + refine .nil hv _ (fun x => ?_) + change α.symm (φ' x) = α.symm w' + rw [hconst x] + | cons hlink φ₁ φ₂ φ hφ₁ hφ₂ hconcat ih => + rcases hconcat with ⟨t₀, ht0, ht1, h0, htv, h1, hle, hge⟩ + refine .cons (pullback_isLink_homeo α hlink) + (ContinuousMap.comp ⟨α.symm, α.symm.continuous⟩ φ₁) + (ContinuousMap.comp ⟨α.symm, α.symm.continuous⟩ φ₂) + (ContinuousMap.comp ⟨α.symm, α.symm.continuous⟩ φ) + ⟨by change α.symm (φ₁ 0) = _; rw [hφ₁.1], + by change α.symm (φ₁ 1) = _; rw [hφ₁.2.1], ?_⟩ + ih + ⟨t₀, ht0, ht1, + by change α.symm (φ 0) = _; rw [h0], + by change α.symm (φ t₀) = _; rw [htv], + by change α.symm (φ 1) = _; rw [h1], ?_, ?_⟩ + · rintro _ ⟨x, rfl⟩ + rw [← α.symm.image_closure] + exact mem_image_of_mem α.symm (hφ₁.2.2 (mem_range_self x)) + · intro x hx + rw [← α.symm.image_closure] + exact mem_image_of_mem α.symm (hle x hx) + · intro x hx + obtain ⟨y, hy⟩ := hge x hx + exact ⟨y, by change α.symm (φ₂ y) = α.symm (φ x); rw [hy]⟩ + +theorem IsProper.map_homeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') {Γ : Drawing S} + (h : Γ.IsProper) : (mapDrawingHomeo α Γ).IsProper := by + rintro y ⟨hy_bd, x, hxU, rfl⟩ + have hx_bd : x ∈ bd S := by + have : α x ∈ α '' bd S := by rwa [image_bd_homeomorph α] + rcases this with ⟨z, hz, hzx⟩ + exact α.injective hzx ▸ hz + exact mem_image_of_mem α (h ⟨hx_bd, hxU⟩) + +theorem IsGraphForest.map_homeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') {Γ : Drawing S} + (h : IsGraphForest Γ.toGraph) : IsGraphForest (mapDrawingHomeo α Γ).toGraph := by + intro u' W' hW' + rw [← length_pullbackWalkHomeo α W'] + exact h (α.symm u') (pullbackWalkHomeo α W') (isSimpleClosed_pullbackWalkHomeo α hW') + +theorem IsSurfaceForest.map_homeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') {H : Drawing S} + (h : IsSurfaceForest H) : IsSurfaceForest (mapDrawingHomeo α H) := + ⟨IsProper.map_homeo α h.1, IsGraphForest.map_homeo α h.2⟩ + +theorem ForestsHomotopic.refl {H : Drawing S} (hH : IsSurfaceForest H) + (hpath : ∀ s ∈ H.V ∩ bd S, ∀ t ∈ H.V ∩ bd S, s ≠ t → + ∀ (P₁ P₂ : GraphWalk H.toGraph s t) (φ₁ φ₂ : Curve S), + P₁.IsSimple → P₂.IsSimple → + CurveTracesWalk H φ₁ P₁ → CurveTracesWalk H φ₂ P₂ → + CurvesHomotopic φ₁ φ₂) : + ForestsHomotopic H H := + ⟨hH.1, hH.1, hH.2, hH.2, rfl, fun s hs t ht hne => ⟨Iff.rfl, hpath s hs t ht hne⟩⟩ + +theorem ForestsHomotopic.symm {H₁ H₂ : Drawing S} + (h : ForestsHomotopic H₁ H₂) : ForestsHomotopic H₂ H₁ := by + rcases h with ⟨hp1, hp2, hf1, hf2, hbd, hpaths⟩ + refine ⟨hp2, hp1, hf2, hf1, hbd.symm, fun s hs t ht hne => ?_⟩ + have hs1 : s ∈ H₁.V ∩ bd S := hbd.symm ▸ hs + have ht1 : t ∈ H₁.V ∩ bd S := hbd.symm ▸ ht + obtain ⟨hiff, hhom⟩ := hpaths s hs1 t ht1 hne + refine ⟨hiff.symm, fun P₂ P₁ φ₂ φ₁ hP₂ hP₁ hφ₂ hφ₁ => ?_⟩ + exact CurvesHomotopic.symm (hhom P₁ P₂ φ₁ φ₂ hP₁ hP₂ hφ₁ hφ₂) + +theorem ForestsHomotopic.trans {H₁ H₂ H₃ : Drawing S} + (h₁₂ : ForestsHomotopic H₁ H₂) (h₂₃ : ForestsHomotopic H₂ H₃) : + ForestsHomotopic H₁ H₃ := by + rcases h₁₂ with ⟨hp1, _, hf1, _, hbd12, hpaths12⟩ + rcases h₂₃ with ⟨_, hp3, _, hf3, hbd23, hpaths23⟩ + refine ⟨hp1, hp3, hf1, hf3, hbd12.trans hbd23, fun s hs1 t ht1 hne => ?_⟩ + have hs2 : s ∈ H₂.V ∩ bd S := hbd12 ▸ hs1 + have ht2 : t ∈ H₂.V ∩ bd S := hbd12 ▸ ht1 + obtain ⟨hiff12, hhom12⟩ := hpaths12 s hs1 t ht1 hne + obtain ⟨hiff23, hhom23⟩ := hpaths23 s hs2 t ht2 hne + refine ⟨hiff12.trans hiff23, fun P₁ P₃ φ₁ φ₃ hP₁ hP₃ hφ₁ hφ₃ => ?_⟩ + obtain ⟨P₂, hP₂⟩ := hiff12.mp ⟨P₁, hP₁⟩ + obtain ⟨φ₂, hφ₂⟩ := exists_curveTracesWalk P₂ + exact CurvesHomotopic.trans + (hhom12 P₁ P₂ φ₁ φ₂ hP₁ hP₂ hφ₁ hφ₂) + (hhom23 P₂ P₃ φ₂ φ₃ hP₂ hP₃ hφ₂ hφ₃) + +theorem pullback_simple_walk_aux {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') + {Γ : Drawing S} {s t : S} {s' t' : S'} (hs : α.symm s' = s) (ht : α.symm t' = t) + (P' : GraphWalk (mapDrawingHomeo α Γ).toGraph s' t') (hP' : P'.IsSimple) : + ∃ P : GraphWalk Γ.toGraph s t, P.IsSimple := by + subst hs ht + exact ⟨pullbackWalkHomeo α P', isSimple_pullbackWalkHomeo α hP'⟩ + +theorem pullback_walk_and_trace_aux {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') + {Γ : Drawing S} {s t : S} {s' t' : S'} (hs : α.symm s' = s) (ht : α.symm t' = t) + (P' : GraphWalk (mapDrawingHomeo α Γ).toGraph s' t') (hP' : P'.IsSimple) + (φ' : Curve S') (hφ' : CurveTracesWalk (mapDrawingHomeo α Γ) φ' P') : + ∃ P : GraphWalk Γ.toGraph s t, P.IsSimple ∧ + CurveTracesWalk Γ (ContinuousMap.comp ⟨α.symm, α.symm.continuous⟩ φ') P := by + subst hs ht + exact ⟨pullbackWalkHomeo α P', isSimple_pullbackWalkHomeo α hP', + CurveTracesWalk.pullback_homeo α hφ'⟩ + +theorem ForestsHomotopic.map_homeo {S' : Type v} [TopologicalSpace S'] (α : S ≃ₜ S') + {H₁ H₂ : Drawing S} (h : ForestsHomotopic H₁ H₂) : + ForestsHomotopic (mapDrawingHomeo α H₁) (mapDrawingHomeo α H₂) := by + rcases h with ⟨hp1, hp2, hf1, hf2, hbd, hpaths⟩ + have hbd_img : ∀ H : Drawing S, (mapDrawingHomeo α H).V ∩ bd S' = α '' (H.V ∩ bd S) := by + intro H + change α '' H.V ∩ bd S' = α '' (H.V ∩ bd S) + rw [← image_bd_homeomorph α, ← image_inter α.injective] + refine ⟨IsProper.map_homeo α hp1, IsProper.map_homeo α hp2, + IsGraphForest.map_homeo α hf1, IsGraphForest.map_homeo α hf2, + by rw [hbd_img, hbd_img, hbd], fun s' hs' t' ht' hne' => ?_⟩ + rw [hbd_img] at hs' ht' + rcases hs' with ⟨s, hs, rfl⟩ + rcases ht' with ⟨t, ht, rfl⟩ + have hne : s ≠ t := fun h_eq => hne' (congrArg α h_eq) + obtain ⟨hiff, hhom⟩ := hpaths s hs t ht hne + refine ⟨?_, ?_⟩ + · constructor + · rintro ⟨P₁', hP₁'⟩ + obtain ⟨P₁, hP₁⟩ := pullback_simple_walk_aux α (α.symm_apply_apply s) + (α.symm_apply_apply t) P₁' hP₁' + obtain ⟨P₂, hP₂⟩ := hiff.mp ⟨P₁, hP₁⟩ + exact ⟨mapWalkHomeo α P₂, isSimple_mapWalkHomeo α hP₂⟩ + · rintro ⟨P₂', hP₂'⟩ + obtain ⟨P₂, hP₂⟩ := pullback_simple_walk_aux α (α.symm_apply_apply s) + (α.symm_apply_apply t) P₂' hP₂' + obtain ⟨P₁, hP₁⟩ := hiff.mpr ⟨P₂, hP₂⟩ + exact ⟨mapWalkHomeo α P₁, isSimple_mapWalkHomeo α hP₁⟩ + · intro P₁' P₂' φ₁' φ₂' hP₁' hP₂' hφ₁' hφ₂' + obtain ⟨P₁, hP₁, htr₁⟩ := + pullback_walk_and_trace_aux α (α.symm_apply_apply s) (α.symm_apply_apply t) P₁' hP₁' φ₁' hφ₁' + obtain ⟨P₂, hP₂, htr₂⟩ := + pullback_walk_and_trace_aux α (α.symm_apply_apply s) (α.symm_apply_apply t) P₂' hP₂' φ₂' hφ₂' + have hhom_pull := hhom P₁ P₂ _ _ hP₁ hP₂ htr₁ htr₂ + have hhom_push := CurvesHomotopic.map_homeo α hhom_pull + have h_comp₁ : ContinuousMap.comp ⟨α, α.continuous⟩ + (ContinuousMap.comp ⟨α.symm, α.symm.continuous⟩ φ₁') = φ₁' := by + ext x; simp + have h_comp₂ : ContinuousMap.comp ⟨α, α.continuous⟩ + (ContinuousMap.comp ⟨α.symm, α.symm.continuous⟩ φ₂') = φ₂' := by + ext x; simp + rwa [h_comp₁, h_comp₂] at hhom_push + +theorem mapDrawingHomeo_trans {S' : Type v} {S'' : Type w} [TopologicalSpace S'] [TopologicalSpace + S''] + (α : S ≃ₜ S') (β : S' ≃ₜ S'') (Γ : Drawing S) : + mapDrawingHomeo β (mapDrawingHomeo α Γ) = mapDrawingHomeo (α.trans β) Γ := by + cases Γ + simp only [mapDrawingHomeo, Drawing.mk.injEq] + constructor <;> ext z <;> simp [Homeomorph.trans_apply] + +theorem mapDrawingHomeo_refl (Γ : Drawing S) : + mapDrawingHomeo (Homeomorph.refl S) Γ = Γ := by + cases Γ + simp [mapDrawingHomeo] + +theorem ForestsHomoplastic.symm {H₁ H₂ : Drawing S} + (h : ForestsHomoplastic H₁ H₂) : ForestsHomoplastic H₂ H₁ := by + rcases h with ⟨α, hα_bd, hhom⟩ + refine ⟨α.symm, fun x hx => (α.symm_apply_eq).mpr (hα_bd x hx).symm, ?_⟩ + have hhom' := ForestsHomotopic.map_homeo α.symm (ForestsHomotopic.symm hhom) + rwa [mapDrawingHomeo_symm_mapDrawingHomeo] at hhom' + +theorem ForestsHomoplastic.trans {H₁ H₂ H₃ : Drawing S} + (h₁₂ : ForestsHomoplastic H₁ H₂) (h₂₃ : ForestsHomoplastic H₂ H₃) : + ForestsHomoplastic H₁ H₃ := by + rcases h₁₂ with ⟨α, hα_bd, hhom₁₂⟩ + rcases h₂₃ with ⟨β, hβ_bd, hhom₂₃⟩ + refine ⟨α.trans β, fun x hx => by simp [Homeomorph.trans_apply, hα_bd x hx, hβ_bd x hx], ?_⟩ + rw [← mapDrawingHomeo_trans] + exact ForestsHomotopic.trans (ForestsHomotopic.map_homeo β hhom₁₂) hhom₂₃ + +/-! ## 8. Proof of Theorem (3.4) and Theorem (3.5) -/ + +/-- For any vertex `s ∈ H.V`, `H.span {s} ∅` is a connected subdrawing of `H` with `V = {s}` and +`U = {s}`. -/ +theorem span_singleton_empty [T1Space S] {H : Drawing S} {s : S} (hs : s ∈ H.V) : + (H.span {s} ∅).V = {s} ∧ (H.span {s} ∅).U = {s} ∧ + (H.span {s} ∅).IsSubdrawing H ∧ (H.span {s} ∅).IsConnected := by + have hV : (H.span {s} ∅).V = {s} := by + change ({s} ∩ H.V) ∪ ⋃ e ∈ (∅ : Set (Set S)) ∩ H.E, closure e ∩ H.V = {s} + simp [inter_eq_self_of_subset_left (singleton_subset_iff.mpr hs)] + have hU : (H.span {s} ∅).U = {s} := by + change H.spanV {s} ∅ ∪ ⋃ e ∈ (∅ : Set (Set S)) ∩ H.E, closure e = {s} + rw [show H.spanV {s} ∅ = (H.span {s} ∅).V from rfl, hV] + simp + have hE : (H.span {s} ∅).E = ∅ := by + rw [H.span_E, empty_inter] + refine ⟨hV, hU, ⟨by rw [hV]; exact singleton_subset_iff.mpr hs, by rw [hE]; exact empty_subset _⟩, + ⟨⟨s, by rw [hV]; exact mem_singleton s⟩, ?_⟩⟩ + intro u hu v hv + have hu' : u = s := by rw [hV] at hu; exact mem_singleton_iff.mp hu + have hv' : v = s := by rw [hV] at hv; exact mem_singleton_iff.mp hv + rw [hu', hv'] + have hs' : s ∈ (H.span {s} ∅).toGraph.vertexSet := by + change s ∈ (H.span {s} ∅).V + rw [hV] + exact mem_singleton s + exact ⟨.nil hs'⟩ + +/-- Graph Minors VII, (3.4), Claim (2) (page 220): +"(2) *If $G$ is an $X$-matching surrounding $Y$-forests $H, H'$ then $H$ and $H'$ are homotopic.*" +-/ +theorem theorem_3_4_claim_2 (hS : IsSurface S) {Y : Set S} {G H₁ H₂ : Drawing S} + (hH₁ : IsYForest Y H₁) (hH₂ : IsYForest Y H₂) + (hG₁ : MatchingStrictlySurroundsForest G H₁) + (hG₂ : MatchingStrictlySurroundsForest G H₂) : + ForestsHomotopic H₁ H₂ := by + have : T2Space S := hS.2.1 + rcases hH₁ with ⟨⟨hp₁, hf₁⟩, hY₁⟩ + rcases hH₂ with ⟨⟨hp₂, hf₂⟩, hY₂⟩ + rcases hG₁ with ⟨⟨hdisj₁, hsurr₁⟩, hstrict₁⟩ + rcases hG₂ with ⟨⟨hdisj₂, hsurr₂⟩, hstrict₂⟩ + refine ⟨hp₁, hp₂, hf₁, hf₂, hY₁.trans hY₂.symm, fun s hs t ht hne => ?_⟩ + have hs₂ : s ∈ H₂.V ∩ bd S := hY₂.symm ▸ hY₁ ▸ hs + have ht₂ : t ∈ H₂.V ∩ bd S := hY₂.symm ▸ hY₁ ▸ ht + obtain ⟨hVs, hUs, hsub_s, hconn_s⟩ := span_singleton_empty hs.1 + have hne_s : ((H₁.span {s} ∅).V ∩ bd S).Nonempty := ⟨s, by rw [hVs]; exact ⟨rfl, hs.2⟩⟩ + obtain ⟨r, hr_mem, hr_sc, hUs_r⟩ := hsurr₁ (H₁.span {s} ∅) hsub_s hconn_s hne_s + have hs_r : s ∈ r := hUs_r (by rw [hUs]; exact mem_singleton s) + have hr_eq : r = connectedComponentIn (univ \ G.U) s := by + rcases hr_mem with ⟨z, _, rfl⟩ + exact connectedComponentIn_eq hs_r + have h_curve_in_r : ∀ {H : Drawing S} {P : GraphWalk H.toGraph s t} {φ : Curve S}, + G.U ∩ H.U = ∅ → CurveTracesWalk H φ P → range φ ⊆ r ∧ t ∈ r := by + intro H P φ hdisj hφ + have hφ_ends := hφ.endpoints + have hφ_U : range φ ⊆ univ \ G.U := by + intro x hx + refine ⟨mem_univ x, fun hxG => ?_⟩ + exact eq_empty_iff_forall_notMem.mp hdisj x ⟨hxG, hφ.range_subset_U hx⟩ + have hφ_sub_r : range φ ⊆ r := by + rw [hr_eq] + exact (isPreconnected_range φ.continuous).subset_connectedComponentIn + ⟨0, hφ_ends.1⟩ hφ_U + exact ⟨hφ_sub_r, hφ_sub_r ⟨1, hφ_ends.2⟩⟩ + refine ⟨⟨?_, ?_⟩, ?_⟩ + · rintro ⟨P₁, hP₁⟩ + obtain ⟨φ₁, hφ₁⟩ := exists_curveTracesWalk P₁ + have ht_r : t ∈ r := (h_curve_in_r hdisj₁ hφ₁).2 + exact hstrict₂ s hs₂ t ht₂ hne r hr_mem hs_r ht_r + · rintro ⟨P₂, hP₂⟩ + obtain ⟨φ₂, hφ₂⟩ := exists_curveTracesWalk P₂ + have ht_r : t ∈ r := (h_curve_in_r hdisj₂ hφ₂).2 + exact hstrict₁ s hs t ht hne r hr_mem hs_r ht_r + · intro P₁ P₂ φ₁ φ₂ _ _ hφ₁ hφ₂ + have hφ₁_r : range φ₁ ⊆ r := (h_curve_in_r hdisj₁ hφ₁).1 + have hφ₂_r : range φ₂ ⊆ r := (h_curve_in_r hdisj₂ hφ₂).1 + have hr_flat : IsFlat r := IsSimplyConnectedSubset.isFlat hS hr_sc + exact IsFlat.curvesHomotopic hr_flat hφ₁_r hφ₂_r + (hφ₁.endpoints.1.trans hφ₂.endpoints.1.symm) + (hφ₁.endpoints.2.trans hφ₂.endpoints.2.symm) + +/-- Transport of `MatchingStrictlySurroundsForest` along a homeomorphism `α : S ≃ₜ S'`. -/ +theorem MatchingStrictlySurroundsForest.map_homeo {S' : Type v} [TopologicalSpace S'] [T2Space S] + (α : S ≃ₜ S') {G : Drawing S} {G' : Drawing S'} {H : Drawing S} + (hU : α '' G.U = G'.U) (hsurr : MatchingStrictlySurroundsForest G H) : + MatchingStrictlySurroundsForest G' (mapDrawingHomeo α H) := by + have : T2Space S' := α.symm.isEmbedding.t2Space + rcases hsurr with ⟨⟨hdisj, hcomp⟩, hstrict⟩ + have hR_eq : ∀ r' ∈ G'.R, ∃ r ∈ G.R, r' = α '' r := by + rintro r' ⟨y', hy', rfl⟩ + let y := α.symm y' + have hy : y ∈ univ \ G.U := by + refine ⟨mem_univ y, fun hyG => hy'.2 ?_⟩ + rw [← hU] + exact ⟨y, hyG, α.apply_symm_apply y'⟩ + refine ⟨connectedComponentIn (univ \ G.U) y, ⟨y, hy, rfl⟩, ?_⟩ + apply Subset.antisymm + · have hpre : IsPreconnected (α.symm '' connectedComponentIn (univ \ G'.U) y') := + isPreconnected_connectedComponentIn.image α.symm α.symm.continuous.continuousOn + have hsub : α.symm '' connectedComponentIn (univ \ G'.U) y' ⊆ univ \ G.U := by + rintro _ ⟨z', hz', rfl⟩ + have hz'_compl : z' ∈ univ \ G'.U := connectedComponentIn_subset _ _ hz' + refine ⟨mem_univ _, fun hzG => hz'_compl.2 ?_⟩ + rw [← hU] + exact ⟨α.symm z', hzG, α.apply_symm_apply z'⟩ + have hmem : y ∈ α.symm '' connectedComponentIn (univ \ G'.U) y' := + mem_image_of_mem α.symm (mem_connectedComponentIn hy') + have h_in := hpre.subset_connectedComponentIn hmem hsub + intro z' hz' + exact ⟨α.symm z', h_in (mem_image_of_mem α.symm hz'), α.apply_symm_apply z'⟩ + · have hpre : IsPreconnected (α '' connectedComponentIn (univ \ G.U) y) := + isPreconnected_connectedComponentIn.image α α.continuous.continuousOn + have hsub : α '' connectedComponentIn (univ \ G.U) y ⊆ univ \ G'.U := by + rintro _ ⟨z, hz, rfl⟩ + have hz_compl : z ∈ univ \ G.U := connectedComponentIn_subset _ _ hz + refine ⟨mem_univ _, fun hzG' => hz_compl.2 ?_⟩ + rw [← hU] at hzG' + rcases hzG' with ⟨w, hw, hwz⟩ + exact α.injective hwz ▸ hw + have hmem : y' ∈ α '' connectedComponentIn (univ \ G.U) y := + ⟨y, mem_connectedComponentIn hy, α.apply_symm_apply y'⟩ + exact hpre.subset_connectedComponentIn hmem hsub + have hR_img : ∀ r ∈ G.R, α '' r ∈ G'.R := by + rintro r ⟨z, hz, rfl⟩ + have hαz : α z ∈ univ \ G'.U := by + refine ⟨mem_univ _, fun h_in => hz.2 ?_⟩ + rw [← hU] at h_in + rcases h_in with ⟨w, hw, hwz⟩ + exact α.injective hwz ▸ hw + refine ⟨α z, hαz, ?_⟩ + apply Subset.antisymm + · have hpre : IsPreconnected (α.symm '' connectedComponentIn (univ \ G'.U) (α z)) := + isPreconnected_connectedComponentIn.image α.symm α.symm.continuous.continuousOn + have hsub : α.symm '' connectedComponentIn (univ \ G'.U) (α z) ⊆ univ \ G.U := by + rintro _ ⟨w', hw', rfl⟩ + have hw'_c := connectedComponentIn_subset _ _ hw' + refine ⟨mem_univ _, fun hw => hw'_c.2 ?_⟩ + rw [← hU] + exact ⟨α.symm w', hw, α.apply_symm_apply w'⟩ + have hz_in : z ∈ α.symm '' connectedComponentIn (univ \ G'.U) (α z) := + ⟨α z, mem_connectedComponentIn hαz, α.symm_apply_apply z⟩ + intro y' hy' + exact ⟨α.symm y', hpre.subset_connectedComponentIn hz_in hsub (mem_image_of_mem α.symm hy'), + α.apply_symm_apply y'⟩ + · have hpre : IsPreconnected (α '' connectedComponentIn (univ \ G.U) z) := + isPreconnected_connectedComponentIn.image α α.continuous.continuousOn + have hsub : α '' connectedComponentIn (univ \ G.U) z ⊆ univ \ G'.U := by + rintro _ ⟨w, hw, rfl⟩ + have hw_c := connectedComponentIn_subset _ _ hw + refine ⟨mem_univ _, fun hαw => hw_c.2 ?_⟩ + rw [← hU] at hαw + rcases hαw with ⟨q, hq, hqw⟩ + exact α.injective hqw ▸ hq + exact hpre.subset_connectedComponentIn + (mem_image_of_mem α (mem_connectedComponentIn hz)) hsub + have hsc_map : ∀ {r : Set S}, IsSimplyConnectedSubset r → IsSimplyConnectedSubset (α '' r) := by + rintro r ⟨harc, hoarc⟩ + refine ⟨?_, ?_⟩ + · rintro a' ⟨a, ha, rfl⟩ b' ⟨b, hb, rfl⟩ hne' + obtain ⟨L, hLr, hL⟩ := harc a ha b hb (fun h => hne' (congrArg α h)) + refine ⟨α '' L, image_mono hLr, ?_⟩ + obtain ⟨γ, hγ, rfl, rfl, rfl⟩ := hL.exists_arc + have h1 : IsArcMap (α ∘ γ) := ⟨α.continuous.comp hγ.1, α.injective.comp hγ.2⟩ + simpa [range_comp] using h1.isLineWithEnds + · intro F' ⟨f'⟩ hF'r + have hF_sub : α.symm '' F' ⊆ r := by + rintro _ ⟨y', hy', rfl⟩ + rcases hF'r hy' with ⟨x, hx, rfl⟩ + simpa using hx + have hF_oarc : IsOArc (α.symm '' F') := ⟨f'.trans (α.symm.image F')⟩ + obtain ⟨Δ, ⟨eΔ⟩, hbdΔ, hΔr⟩ := hoarc (α.symm '' F') hF_oarc hF_sub + refine ⟨α '' Δ, ⟨eΔ.trans (α.image Δ)⟩, ?_, image_mono hΔr⟩ + calc + discBd (α '' Δ) = α '' discBd Δ := by + unfold discBd + have hbd_eq := image_bd_homeomorph (α.image Δ) + ext z + simp only [mem_image, Subtype.exists] + constructor + · rintro ⟨w, hw, hw_bd, rfl⟩ + have : ⟨w, hw⟩ ∈ (α.image Δ) '' bd Δ := hbd_eq ▸ hw_bd + rcases this with ⟨⟨x, hx⟩, hx_bd, hxw⟩ + refine ⟨x, ⟨x, hx, hx_bd, rfl⟩, ?_⟩ + exact congrArg Subtype.val hxw + · rintro ⟨_, ⟨x, hx, hx_bd, rfl⟩, rfl⟩ + refine ⟨α x, mem_image_of_mem α hx, ?_, rfl⟩ + rw [← hbd_eq] + exact ⟨⟨x, hx⟩, hx_bd, rfl⟩ + _ = α '' (α.symm '' F') := by rw [hbdΔ] + _ = F' := α.image_symm_image F' + refine ⟨⟨?_, ?_⟩, ?_⟩ + · rw [← hU] + change α '' G.U ∩ α '' H.U = ∅ + rw [← image_inter α.injective, hdisj, image_empty] + · intro H' hsub' hconn' ⟨s', hs'V, hs'bd⟩ + let H₀ := mapDrawingHomeo α.symm H' + have hH₀_sub : H₀.IsSubdrawing H := by + refine ⟨?_, ?_⟩ + · rintro _ ⟨y', hy'V, rfl⟩ + rcases hsub'.1 hy'V with ⟨x, hx, rfl⟩ + simpa using hx + · rw [mapDrawingHomeo_E] + rintro _ ⟨e', he'E, rfl⟩ + have he' := hsub'.2 he'E + rw [mapDrawingHomeo_E] at he' + rcases he' with ⟨e, he, rfl⟩ + have : α.symm '' (α '' e) = e := α.symm_image_image e + rwa [this] + have hH₀_conn : H₀.IsConnected := by + refine ⟨hconn'.1.image α.symm, ?_⟩ + rintro _ ⟨u', hu', rfl⟩ _ ⟨v', hv', rfl⟩ + obtain ⟨W'⟩ := hconn'.2 u' hu' v' hv' + exact ⟨mapWalkHomeo α.symm W'⟩ + have hH₀_bd : (H₀.V ∩ bd S).Nonempty := by + refine ⟨α.symm s', mem_image_of_mem α.symm hs'V, ?_⟩ + have : α.symm s' ∈ α.symm '' bd S' := mem_image_of_mem α.symm hs'bd + rwa [image_bd_homeomorph α.symm] at this + obtain ⟨r, hr_mem, hr_sc, hH₀_r⟩ := hcomp H₀ hH₀_sub hH₀_conn hH₀_bd + refine ⟨α '' r, hR_img r hr_mem, hsc_map hr_sc, ?_⟩ + calc + H'.U = α '' (α.symm '' H'.U) := (α.image_symm_image H'.U).symm + _ = α '' H₀.U := rfl + _ ⊆ α '' r := image_mono hH₀_r + · intro s' hs' t' ht' hne' r' hr' hs'r' ht'r' + obtain ⟨r, hr, rfl⟩ := hR_eq r' hr' + rcases hs' with ⟨⟨s, hsV, rfl⟩, hs'_bd⟩ + rcases ht' with ⟨⟨t, htV, rfl⟩, ht'_bd⟩ + have hs_bd : s ∈ bd S := by + have : α s ∈ α '' bd S := by rwa [image_bd_homeomorph α] + rcases this with ⟨z, hz, hzs⟩ + exact α.injective hzs ▸ hz + have ht_bd : t ∈ bd S := by + have : α t ∈ α '' bd S := by rwa [image_bd_homeomorph α] + rcases this with ⟨z, hz, hzt⟩ + exact α.injective hzt ▸ hz + rcases hs'r' with ⟨s₁, hs₁r, hs₁_eq⟩ + rcases ht'r' with ⟨t₁, ht₁r, ht₁_eq⟩ + have hs_r : s ∈ r := α.injective hs₁_eq ▸ hs₁r + have ht_r : t ∈ r := α.injective ht₁_eq ▸ ht₁r + obtain ⟨P, hP⟩ := hstrict s ⟨hsV, hs_bd⟩ t ⟨htV, ht_bd⟩ + (fun h => hne' (congrArg α h)) r hr hs_r ht_r + exact ⟨mapWalkHomeo α P, isSimple_mapWalkHomeo α hP⟩ + +/-- Graph Minors VII, (3.4), Claim (3) (page 220): +"(3) *If $H, H'$ are $Y$-forests surrounded by $X$-matchings $G, G'$, respectively, and $G$ and $G'$ +are congruent, then $H$ and $H'$ are homoplastic.*" -/ +theorem theorem_3_4_claim_3 (hS : IsSurface S) {Y : Set S} (hY : Y ⊆ bd S) + {G G' H H' : Drawing S} (hH : IsYForest Y H) (hH' : IsYForest Y H') + (hsurr : MatchingStrictlySurroundsForest G H) + (hsurr' : MatchingStrictlySurroundsForest G' H') + (hcongr : AreCongruentMatchings G G') : + ForestsHomoplastic H H' := by + have : T2Space S := hS.2.1 + rcases hcongr with ⟨α, hU, hα_bd⟩ + have hαH_Y : IsYForest Y (mapDrawingHomeo α H) := by + refine ⟨IsSurfaceForest.map_homeo α hH.1, ?_⟩ + calc + (mapDrawingHomeo α H).V ∩ bd S = α '' H.V ∩ α '' bd S := by + rw [image_bd_homeomorph α]; rfl + _ = α '' (H.V ∩ bd S) := (image_inter α.injective).symm + _ = α '' Y := by rw [hH.2] + _ = Y := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + rw [hα_bd x (hY hx)] + exact hx + · intro hy + exact ⟨y, hy, hα_bd y (hY hy)⟩ + have hsurr_α : MatchingStrictlySurroundsForest G' (mapDrawingHomeo α H) := + MatchingStrictlySurroundsForest.map_homeo α hU hsurr + exact ⟨α, hα_bd, theorem_3_4_claim_2 hS hαH_Y hH' hsurr_α hsurr'⟩ + +/-! ## 9. Canonical Boundary Subsets and Proof of Theorem (3.6) -/ + +/-- Finite hierarchy of canonical parameters in `Ico (0 : ℝ) 1` closed under taking midpoints with +`insert 1 (canonParams m)`. -/ +noncomputable def canonParams : ℕ → Set ℝ + | 0 => ∅ + | m + 1 => + insert 0 (canonParams m ∪ + (fun p : ℝ × ℝ => (p.1 + p.2) / 2) '' (canonParams m ×ˢ insert 1 (canonParams m))) + +theorem canonParams_finite (m : ℕ) : (canonParams m).Finite := by + induction m with + | zero => exact finite_empty + | succ m ih => + exact (ih.union ((ih.prod (ih.insert 1)).image _)).insert 0 + +theorem canonParams_subset_Ico (m : ℕ) : canonParams m ⊆ Ico (0 : ℝ) 1 := by + induction m with + | zero => exact empty_subset _ + | succ m ih => + rintro x (rfl | hx | ⟨⟨a, b⟩, ⟨ha, hb⟩, rfl⟩) + · exact ⟨le_rfl, zero_lt_one⟩ + · exact ih hx + · have ha' := ih ha + have hb' : b ∈ Icc (0 : ℝ) 1 := by + rcases hb with rfl | hb + · exact ⟨zero_le_one, le_rfl⟩ + · exact Ico_subset_Icc_self (ih hb) + exact ⟨by linarith [ha'.1, hb'.1], by linarith [ha'.2, hb'.2]⟩ + +theorem canonParams_mono {m n : ℕ} (h : m ≤ n) : canonParams m ⊆ canonParams n := by + induction h with + | refl => exact Subset.rfl + | @step k _ ih => + exact ih.trans (subset_union_left.trans (subset_insert 0 _)) + +/-- Piecewise linear homeomorphism of `ℝ` fixing `(-∞, a] ∪ [b, ∞)` and mapping `u₀ ∈ (a, b)` to +`(a + b) / 2`. -/ +noncomputable def bumpMid (a u₀ b u : ℝ) : ℝ := + if u ≤ a then u + else if u ≤ u₀ then a + (b - a) / 2 * ((u - a) / (u₀ - a)) + else if u ≤ b then (a + b) / 2 + (b - a) / 2 * ((u - u₀) / (b - u₀)) + else u + +theorem continuous_bumpMid {a u₀ b : ℝ} (ha : a < u₀) (hb : u₀ < b) : + Continuous (bumpMid a u₀ b) := by + have hau : u₀ - a ≠ 0 := by linarith + have hbu : b - u₀ ≠ 0 := by linarith + unfold bumpMid + refine Continuous.if_le continuous_id ?_ continuous_id continuous_const (fun x hx => ?_) + · refine Continuous.if_le (by fun_prop) ?_ continuous_id continuous_const (fun x hx => ?_) + · refine Continuous.if_le (by fun_prop) continuous_id continuous_id continuous_const + (fun x hx => ?_) + rw [hx, div_self hbu] + ring + · simp only [hx, hb.le, ↓reduceIte, div_self hau, sub_self, zero_div] + ring + · simp only [hx, ha.le, ↓reduceIte, sub_self, zero_div] + ring + +theorem strictMono_bumpMid {a u₀ b : ℝ} (ha : a < u₀) (hb : u₀ < b) : + StrictMono (bumpMid a u₀ b) := by + have hau : 0 < u₀ - a := by linarith + have hbu : 0 < b - u₀ := by linarith + have hba : 0 < (b - a) / 2 := by linarith + have h_val_a : bumpMid a u₀ b a = a := by simp [bumpMid] + have h_val_u₀ : bumpMid a u₀ b u₀ = (a + b) / 2 := by + unfold bumpMid + have h1 : ¬ (u₀ ≤ a) := by linarith + simp [h1, div_self hau.ne'] + ring + have h_val_b : bumpMid a u₀ b b = b := by + unfold bumpMid + have h1 : ¬ (b ≤ a) := by linarith + have h2 : ¬ (b ≤ u₀) := by linarith + simp [h1, h2, div_self hbu.ne'] + ring + have h_piece1 : ∀ {x y : ℝ}, x < y → y ≤ a → bumpMid a u₀ b x < bumpMid a u₀ b y := by + intro x y hxy hy + have hx : x ≤ a := hxy.le.trans hy + simp [bumpMid, hx, hy, hxy] + have h_piece2 : ∀ {x y : ℝ}, a ≤ x → x < y → y ≤ u₀ → bumpMid a u₀ b x < bumpMid a u₀ b y := by + intro x y hx hxy hy + rcases eq_or_lt_of_le hx with rfl | hx' + · rw [h_val_a] + have hy_not_a : ¬ (y ≤ a) := by linarith + unfold bumpMid + simp only [hy_not_a, hy, ↓reduceIte] + have hpos : 0 < (b - a) / 2 * ((y - a) / (u₀ - a)) := + mul_pos hba (div_pos (by linarith) hau) + linarith + · have hx_not_a : ¬ (x ≤ a) := by linarith + have hy_not_a : ¬ (y ≤ a) := by linarith + have hx_u₀ : x ≤ u₀ := hxy.le.trans hy + unfold bumpMid + simp only [hx_not_a, hy_not_a, hx_u₀, hy, ↓reduceIte] + have hdiv : (x - a) / (u₀ - a) < (y - a) / (u₀ - a) := + div_lt_div_of_pos_right (by linarith) hau + have hmul : (b - a) / 2 * ((x - a) / (u₀ - a)) < (b - a) / 2 * ((y - a) / (u₀ - a)) := + mul_lt_mul_of_pos_left hdiv hba + linarith + have h_piece3 : ∀ {x y : ℝ}, u₀ ≤ x → x < y → y ≤ b → bumpMid a u₀ b x < bumpMid a u₀ b y := by + intro x y hx hxy hy + rcases eq_or_lt_of_le hx with rfl | hx' + · rw [h_val_u₀] + have hy_not_a : ¬ (y ≤ a) := by linarith + have hy_not_u₀ : ¬ (y ≤ u₀) := by linarith + unfold bumpMid + simp only [hy_not_a, hy_not_u₀, hy, ↓reduceIte] + have hpos : 0 < (b - a) / 2 * ((y - u₀) / (b - u₀)) := + mul_pos hba (div_pos (by linarith) hbu) + linarith + · have hx_not_a : ¬ (x ≤ a) := by linarith + have hy_not_a : ¬ (y ≤ a) := by linarith + have hx_not_u₀ : ¬ (x ≤ u₀) := by linarith + have hy_not_u₀ : ¬ (y ≤ u₀) := by linarith + have hx_b : x ≤ b := hxy.le.trans hy + unfold bumpMid + simp only [hx_not_a, hy_not_a, hx_not_u₀, hy_not_u₀, hx_b, hy, ↓reduceIte] + have hdiv : (x - u₀) / (b - u₀) < (y - u₀) / (b - u₀) := + div_lt_div_of_pos_right (by linarith) hbu + have hmul : (b - a) / 2 * ((x - u₀) / (b - u₀)) < (b - a) / 2 * ((y - u₀) / (b - u₀)) := + mul_lt_mul_of_pos_left hdiv hba + linarith + have h_piece4 : ∀ {x y : ℝ}, b ≤ x → x < y → bumpMid a u₀ b x < bumpMid a u₀ b y := by + intro x y hx hxy + rcases eq_or_lt_of_le hx with rfl | hx' + · rw [h_val_b] + have hy_not_a : ¬ (y ≤ a) := by linarith + have hy_not_u₀ : ¬ (y ≤ u₀) := by linarith + have hy_not_b : ¬ (y ≤ b) := by linarith + unfold bumpMid + simp [hy_not_a, hy_not_u₀, hy_not_b, hxy] + · have hx_not_a : ¬ (x ≤ a) := by linarith + have hy_not_a : ¬ (y ≤ a) := by linarith + have hx_not_u₀ : ¬ (x ≤ u₀) := by linarith + have hy_not_u₀ : ¬ (y ≤ u₀) := by linarith + have hx_not_b : ¬ (x ≤ b) := by linarith + have hy_not_b : ¬ (y ≤ b) := by linarith + unfold bumpMid + simp [hx_not_a, hy_not_a, hx_not_u₀, hy_not_u₀, hx_not_b, hy_not_b, hxy] + intro x y hxy + by_cases hy_a : y ≤ a + · exact h_piece1 hxy hy_a + · by_cases hy_u₀ : y ≤ u₀ + · by_cases hx_a : x < a + · exact (h_piece1 hx_a le_rfl).trans (h_piece2 le_rfl (by linarith) hy_u₀) + · exact h_piece2 (not_lt.mp hx_a) hxy hy_u₀ + · by_cases hy_b : y ≤ b + · by_cases hx_u₀ : x < u₀ + · have h1 : bumpMid a u₀ b x < bumpMid a u₀ b u₀ := by + by_cases hx_a : x < a + · exact (h_piece1 hx_a le_rfl).trans (h_piece2 le_rfl ha le_rfl) + · exact h_piece2 (not_lt.mp hx_a) hx_u₀ le_rfl + exact h1.trans (h_piece3 le_rfl (by linarith) hy_b) + · exact h_piece3 (not_lt.mp hx_u₀) hxy hy_b + · by_cases hx_b : x < b + · have h1 : bumpMid a u₀ b x < bumpMid a u₀ b b := by + by_cases hx_u₀ : x < u₀ + · have h0 : bumpMid a u₀ b x < bumpMid a u₀ b u₀ := by + by_cases hx_a : x < a + · exact (h_piece1 hx_a le_rfl).trans (h_piece2 le_rfl ha le_rfl) + · exact h_piece2 (not_lt.mp hx_a) hx_u₀ le_rfl + exact h0.trans (h_piece3 le_rfl hb le_rfl) + · exact h_piece3 (not_lt.mp hx_u₀) hx_b le_rfl + exact h1.trans (h_piece4 le_rfl (by linarith)) + · exact h_piece4 (not_lt.mp hx_b) hxy + +theorem bumpMid_apply_u₀ {a u₀ b : ℝ} (ha : a < u₀) : + bumpMid a u₀ b u₀ = (a + b) / 2 := by + have hau : u₀ - a ≠ 0 := by linarith + have h1 : ¬ (u₀ ≤ a) := by linarith + unfold bumpMid + simp [h1, div_self hau] + ring + +theorem bumpMid_fix {a u₀ b z : ℝ} (ha : a < u₀) (hb : u₀ < b) (hz : z ≤ a ∨ b ≤ z) : + bumpMid a u₀ b z = z := by + rcases hz with hza | hbz + · simp [bumpMid, hza] + · rcases eq_or_lt_of_le hbz with rfl | hbz' + · have h1 : ¬ (b ≤ a) := by linarith + have h2 : ¬ (b ≤ u₀) := by linarith + have hbu : b - u₀ ≠ 0 := by linarith + unfold bumpMid + simp [h1, h2, div_self hbu] + ring + · have h1 : ¬ (z ≤ a) := by linarith + have h2 : ¬ (z ≤ u₀) := by linarith + have h3 : ¬ (z ≤ b) := by linarith + simp [bumpMid, h1, h2, h3] + +theorem exists_Ico_param_of_mem_cuff {C : Set S} (φ : Circle ≃ₜ C) {x : S} (hx : x ∈ C) : + ∃ u ∈ Ico (0 : ℝ) 1, (φ (ee u)).1 = x := by + obtain ⟨r, hr⟩ := ee_surjective (φ.symm ⟨x, hx⟩) + refine ⟨Int.fract r, ⟨Int.fract_nonneg r, Int.fract_lt_one r⟩, ?_⟩ + have h1 : ee (Int.fract r) = ee r := by + have h2 := (Int.fract_add_floor r).symm + have h3 := ee_add_int (Int.fract r) ⌊r⌋ + rw [← h2] at h3 + exact h3.symm + rw [h1, hr] + simp + +theorem move_one_point_on_cuff (hS : IsSurface S) {C U : Set S} (hC : IsCuff C) (hU : IsOpen U) + (hCU : C ⊆ U) (φ : Circle ≃ₜ C) (m : ℕ) {F : Set ℝ} + (hF : F ⊆ canonParams m) (hF0 : 0 < m → 0 ∈ F) {x₀ : S} (hx₀ : x₀ ∈ C) : + ∃ (α : S ≃ₜ S) (F' : Set ℝ), + F ⊆ F' ∧ F' ⊆ canonParams (m + 1) ∧ 0 ∈ F' ∧ + α x₀ ∈ (fun u => (φ (ee u)).1) '' F' ∧ + (∀ y ∈ (fun u => (φ (ee u)).1) '' F, α y = y) ∧ + (∀ x ∈ C, α x ∈ C) ∧ + (∀ x ∉ U, α x = x) := by + let ψ : ℝ → S := fun u => (φ (ee u)).1 + have hC_map : ∀ {τ : ℝ → ℝ} {α : S ≃ₜ S}, + (∀ u ∈ Icc (0 : ℝ) 1, α (ψ u) = ψ (τ u)) → ∀ x ∈ C, α x ∈ C := by + intro τ α hα x hx + obtain ⟨u, hu, rfl⟩ := exists_Ico_param_of_mem_cuff φ hx + rw [hα u (Ico_subset_Icc_self hu)] + exact (φ _).2 + rcases Nat.eq_zero_or_pos m with rfl | hm + · have hF_empty : F = ∅ := subset_empty_iff.mp hF + obtain ⟨u₀, hu₀, hψu₀⟩ := exists_Ico_param_of_mem_cuff φ hx₀ + let τ : ℝ → ℝ := fun u => u - u₀ + have hc : ContinuousOn τ (Icc 0 1) := by fun_prop + have hm_tau : StrictMonoOn τ (Icc 0 1) := fun a _ b _ hab => sub_lt_sub_right hab u₀ + have h1 : τ 1 = τ 0 + 1 := by dsimp [τ]; ring + obtain ⟨α, hα_cuff, hα_out⟩ := exists_move_loop hS hC hU hCU φ hc hm_tau h1 + refine ⟨α, {0}, by simp [hF_empty], ?_, mem_singleton 0, ?_, ?_, hC_map hα_cuff, hα_out⟩ + · intro z hz + rw [mem_singleton_iff.mp hz] + exact mem_insert 0 _ + · refine ⟨0, mem_singleton 0, ?_⟩ + have hαx₀ := hα_cuff u₀ (Ico_subset_Icc_self hu₀) + rw [hψu₀] at hαx₀ + dsimp [τ] at hαx₀ + rw [sub_self] at hαx₀ + exact hαx₀.symm + · simp [hF_empty] + · have h0F : (0 : ℝ) ∈ F := hF0 hm + by_cases hx₀_in : x₀ ∈ ψ '' F + · refine ⟨Homeomorph.refl S, F, Subset.rfl, hF.trans (canonParams_mono (Nat.le_succ m)), + h0F, hx₀_in, fun y _ => rfl, fun x hx => hx, fun x _ => rfl⟩ + · obtain ⟨u₀, hu₀, hψu₀⟩ := exists_Ico_param_of_mem_cuff φ hx₀ + have hu₀_not_F : u₀ ∉ F := fun huF => hx₀_in ⟨u₀, huF, hψu₀⟩ + have hu₀_pos : 0 < u₀ := lt_of_le_of_ne hu₀.1 (fun h => hu₀_not_F (h ▸ h0F)) + have hu₀_lt_one : u₀ < 1 := hu₀.2 + have hF_fin : F.Finite := (canonParams_finite m).subset hF + let F_left := {z ∈ F | z < u₀} + have hFl_fin : F_left.Finite := hF_fin.subset (fun z hz => hz.1) + have hFl_ne : F_left.Nonempty := ⟨0, h0F, hu₀_pos⟩ + let a := hFl_fin.toFinset.max' (hFl_fin.toFinset_nonempty.mpr hFl_ne) + have ha_mem : a ∈ F_left := hFl_fin.mem_toFinset.mp (Finset.max'_mem _ _) + have ha_F : a ∈ F := ha_mem.1 + have ha_lt : a < u₀ := ha_mem.2 + have ha_ge : ∀ z ∈ F, z < u₀ → z ≤ a := fun z hz hzu => + Finset.le_max' _ _ (hFl_fin.mem_toFinset.mpr ⟨hz, hzu⟩) + let F_right := insert (1 : ℝ) {z ∈ F | u₀ < z} + have hFr : {z ∈ F | u₀ < z}.Finite := hF_fin.subset fun _ hz => hz.1 + have hFr_fin : F_right.Finite := hFr.insert 1 + have hFr_ne : F_right.Nonempty := ⟨1, mem_insert 1 _⟩ + let b := hFr_fin.toFinset.min' (hFr_fin.toFinset_nonempty.mpr hFr_ne) + have hb_mem : b ∈ F_right := hFr_fin.mem_toFinset.mp (Finset.min'_mem _ _) + have hb_gt : u₀ < b := by + rcases hb_mem with hb1 | hb' + · exact hb1.symm ▸ hu₀_lt_one + · exact hb'.2 + have hb_le_one : b ≤ 1 := + Finset.min'_le _ _ (hFr_fin.mem_toFinset.mpr (mem_insert 1 _)) + have hb_le : ∀ z ∈ F, u₀ < z → b ≤ z := fun z hz huz => + Finset.min'_le _ _ (hFr_fin.mem_toFinset.mpr (Or.inr ⟨hz, huz⟩)) + have ha_nonneg : 0 ≤ a := (canonParams_subset_Ico m (hF ha_F)).1 + let τ := bumpMid a u₀ b + have hc : ContinuousOn τ (Icc 0 1) := (continuous_bumpMid ha_lt hb_gt).continuousOn + have hm_tau : StrictMonoOn τ (Icc 0 1) := (strictMono_bumpMid ha_lt hb_gt).strictMonoOn _ + have hτ0 : τ 0 = 0 := bumpMid_fix ha_lt hb_gt (Or.inl ha_nonneg) + have hτ1 : τ 1 = 1 := bumpMid_fix ha_lt hb_gt (Or.inr hb_le_one) + have h1 : τ 1 = τ 0 + 1 := by rw [hτ0, hτ1, zero_add] + obtain ⟨α, hα_cuff, hα_out⟩ := exists_move_loop hS hC hU hCU φ hc hm_tau h1 + let mid := (a + b) / 2 + have hmid_mem : mid ∈ canonParams (m + 1) := by + refine Or.inr (Or.inr ⟨(a, b), ⟨hF ha_F, ?_⟩, rfl⟩) + rcases hb_mem with hb1 | hb' + · exact Or.inl hb1 + · exact Or.inr (hF hb'.1) + refine ⟨α, insert mid F, subset_insert mid F, ?_, Or.inr h0F, ?_, ?_, hC_map hα_cuff, hα_out⟩ + · rintro z (rfl | hz) + · exact hmid_mem + · exact canonParams_mono (Nat.le_succ m) (hF hz) + · refine ⟨mid, mem_insert mid F, ?_⟩ + have hαx₀ := hα_cuff u₀ (Ico_subset_Icc_self hu₀) + rw [hψu₀] at hαx₀ + dsimp [τ] at hαx₀ + rw [bumpMid_apply_u₀ ha_lt] at hαx₀ + exact hαx₀.symm + · rintro _ ⟨z, hzF, rfl⟩ + have hz_Ico := canonParams_subset_Ico m (hF hzF) + have hαz := hα_cuff z (Ico_subset_Icc_self hz_Ico) + change α (ψ z) = ψ (τ z) at hαz + have hz_ne : z ≠ u₀ := fun h => hu₀_not_F (h ▸ hzF) + have hz_fix : τ z = z := by + rcases lt_or_gt_of_ne hz_ne with hlt | hgt + · exact bumpMid_fix ha_lt hb_gt (Or.inl (ha_ge z hzF hlt)) + · exact bumpMid_fix ha_lt hb_gt (Or.inr (hb_le z hzF hgt)) + rw [hαz, hz_fix] + +theorem move_finite_set_on_cuff (hS : IsSurface S) {C U : Set S} (hC : IsCuff C) (hU : IsOpen U) + (hCU : C ⊆ U) (φ : Circle ≃ₜ C) : + ∀ (k : ℕ) {Z : Set S}, Z ⊆ C → Z.Finite → Z.ncard ≤ k → + ∃ (α : S ≃ₜ S) (F : Set ℝ), + F ⊆ canonParams k ∧ (0 < k → 0 ∈ F) ∧ + α '' Z ⊆ (fun u => (φ (ee u)).1) '' F ∧ + (∀ x ∈ C, α x ∈ C) ∧ + (∀ x ∉ U, α x = x) := by + intro k + induction k with + | zero => + intro Z _ hZfin hZcard + have hZ_empty : Z = ∅ := (ncard_eq_zero hZfin).mp (Nat.le_zero.mp hZcard) + refine ⟨Homeomorph.refl S, ∅, Subset.rfl, fun h => (lt_irrefl 0 h).elim, ?_, + fun x hx => hx, fun x _ => rfl⟩ + simp [hZ_empty] + | succ k ih => + intro Z hZC hZfin hZcard + rcases Z.eq_empty_or_nonempty with rfl | ⟨x₀, hx₀⟩ + · refine ⟨Homeomorph.refl S, {0}, ?_, fun _ => mem_singleton 0, by simp, + fun x hx => hx, fun x _ => rfl⟩ + intro z hz + rw [mem_singleton_iff.mp hz] + exact mem_insert 0 _ + · let Z' := Z \ {x₀} + have hZ'C : Z' ⊆ C := sdiff_subset.trans hZC + have hZ'fin : Z'.Finite := hZfin.sdiff + have hZ'card : Z'.ncard ≤ k := by + have h1 : (insert x₀ Z').ncard ≤ k + 1 := by + rwa [insert_sdiff_singleton, insert_eq_of_mem hx₀] + have hx₀_not_Z' : x₀ ∉ Z' := fun h => h.2 rfl + rw [ncard_insert_of_notMem hx₀_not_Z' hZ'fin] at h1 + exact Nat.le_of_succ_le_succ h1 + obtain ⟨α₁, F₁, hF₁_sub, hF₁_0, hα₁_Z', hα₁_C, hα₁_out⟩ := ih hZ'C hZ'fin hZ'card + have hα₁x₀ : α₁ x₀ ∈ C := hα₁_C x₀ (hZC hx₀) + obtain ⟨α₂, F', hF₁_F', hF'_sub, hF'_0, hα₂_x₀, hα₂_fix, hα₂_C, hα₂_out⟩ := + move_one_point_on_cuff hS hC hU hCU φ k hF₁_sub hF₁_0 hα₁x₀ + refine ⟨α₁.trans α₂, F', hF'_sub, fun _ => hF'_0, ?_, + fun x hx => hα₂_C (α₁ x) (hα₁_C x hx), + fun x hx => by simp [Homeomorph.trans_apply, hα₁_out x hx, hα₂_out x hx]⟩ + rintro _ ⟨z, hz, rfl⟩ + simp only [Homeomorph.trans_apply] + by_cases hzx₀ : z = x₀ + · subst hzx₀ + exact hα₂_x₀ + · have hz' : z ∈ Z' := ⟨hz, hzx₀⟩ + have hα₁z : α₁ z ∈ (fun u => (φ (ee u)).1) '' F₁ := hα₁_Z' (mem_image_of_mem α₁ hz') + rw [hα₂_fix (α₁ z) hα₁z] + exact image_mono hF₁_F' hα₁z + +theorem isClosed_of_mem_cuffs (hS : IsSurface S) {C : Set S} (hC : C ∈ cuffs S) : + IsClosed C := by + have : T2Space S := hS.2.1 + have ⟨φ⟩ := (cuff_statement.{u} S hS).2.2 C hC + have h_eq : C = range (Subtype.val ∘ φ) := by + ext x + constructor + · intro hx + exact ⟨φ.symm ⟨x, hx⟩, by simp⟩ + · rintro ⟨z, rfl⟩ + exact (φ z).2 + rw [h_eq] + exact (isCompact_range (continuous_subtype_val.comp φ.continuous)).isClosed + +theorem disjoint_of_mem_cuffs {C₁ C₂ : Set S} (hC₁ : C₁ ∈ cuffs S) (hC₂ : C₂ ∈ cuffs S) + (hne : C₁ ≠ C₂) : Disjoint C₁ C₂ := by + rw [disjoint_iff_inter_eq_empty] + by_contra h + obtain ⟨z, hz₁, hz₂⟩ := nonempty_iff_ne_empty.mpr h + rcases hC₁ with ⟨x₁, _, rfl⟩ + rcases hC₂ with ⟨x₂, _, rfl⟩ + have e₁ := connectedComponentIn_eq hz₁ + have e₂ := connectedComponentIn_eq hz₂ + exact hne (e₁.trans e₂.symm) + +/-- For any surface `S` and bound `M : ℕ`, there exists a finite canonical subset +`Z_canon ⊆ bd S` such that any subset `Z ⊆ bd S` of cardinality at most `M` can be mapped into +`Z_canon` by a self-homeomorphism of `S`. -/ +theorem exists_canon_bd_homeo (hS : IsSurface S) (M : ℕ) : + ∃ Z_canon : Set S, Z_canon ⊆ bd S ∧ Z_canon.Finite ∧ + ∀ Z : Set S, Z ⊆ bd S → Z.Finite → Z.ncard ≤ M → + ∃ β : S ≃ₜ S, β '' Z ⊆ Z_canon := by + classical + have hcuffs := cuff_statement.{u} S hS + have hcuffs_fin := hcuffs.2.1 + have hcuffs_oarc := hcuffs.2.2 + let cuffCanon (C : Set S) : Set S := + if hC : C ∈ cuffs S then + (fun u => ((hcuffs_oarc C hC).some (ee u)).1) '' canonParams M + else ∅ + have hcuffCanon_sub : ∀ C ∈ cuffs S, cuffCanon C ⊆ C := by + intro C hC + dsimp [cuffCanon] + rw [dite_eq_left_of_eq_true (eq_true hC)] + rintro _ ⟨u, _, rfl⟩ + exact ((hcuffs_oarc C hC).some (ee u)).2 + have hcuffCanon_fin : ∀ C, (cuffCanon C).Finite := by + intro C + dsimp [cuffCanon] + split_ifs with hC + · exact (canonParams_finite M).image _ + · exact finite_empty + have hC_sub_bd : ∀ C ∈ cuffs S, C ⊆ bd S := by + rintro C ⟨x, _, rfl⟩ + exact connectedComponentIn_subset (bd S) x + let Z_canon := ⋃ C ∈ cuffs S, cuffCanon C + refine ⟨Z_canon, iUnion₂_subset (fun C hC => (hcuffCanon_sub C hC).trans (hC_sub_bd C hC)), + hcuffs_fin.biUnion (fun C _ => hcuffCanon_fin C), ?_⟩ + intro Z hZ_bd hZ_fin hZ_card + have h_ind : ∀ (𝒜 : Finset (Set S)), (∀ C ∈ 𝒜, C ∈ cuffs S) → + ∃ α : S ≃ₜ S, + α '' (Z ∩ ⋃ C ∈ 𝒜, C) ⊆ ⋃ C ∈ 𝒜, cuffCanon C ∧ + ∀ x ∈ bd S \ (⋃ C ∈ 𝒜, C), α x = x := by + intro 𝒜 + induction 𝒜 using Finset.induction_on with + | empty => + intro _ + refine ⟨Homeomorph.refl S, by simp, fun x _ => rfl⟩ + | @insert C₀ 𝒜 hC₀_not_mem ih => + intro h𝒜_cuffs + have hC₀ : C₀ ∈ cuffs S := h𝒜_cuffs C₀ (Finset.mem_insert_self C₀ 𝒜) + have h𝒜 : ∀ C ∈ 𝒜, C ∈ cuffs S := + fun C hC => h𝒜_cuffs C (Finset.mem_insert_of_mem hC) + obtain ⟨α₁, hα₁_img, hα₁_fix⟩ := ih h𝒜 + have hC₀_disj_𝒜 : Disjoint C₀ (⋃ C ∈ 𝒜, C) := by + rw [disjoint_iUnion₂_right] + intro C hC + exact disjoint_of_mem_cuffs hC₀ (h𝒜 C hC) (fun h => hC₀_not_mem (h ▸ hC)) + have hα₁_fix_C₀ : ∀ x ∈ C₀, α₁ x = x := by + intro x hx + exact hα₁_fix x ⟨hC_sub_bd C₀ hC₀ hx, + disjoint_left.mp hC₀_disj_𝒜 hx⟩ + let U := (bd S \ C₀)ᶜ + have hU_open : IsOpen U := (isClosed_bd_diff_cuff hS hC₀).isOpen_compl + have hC₀_U : C₀ ⊆ U := fun x hx h => h.2 hx + let φ₀ : Circle ≃ₜ C₀ := (hcuffs_oarc C₀ hC₀).some + have hZC₀_sub : Z ∩ C₀ ⊆ C₀ := inter_subset_right + have hZC₀_fin : (Z ∩ C₀).Finite := hZ_fin.subset inter_subset_left + have hZC₀_card : (Z ∩ C₀).ncard ≤ M := + (ncard_le_ncard inter_subset_left hZ_fin).trans hZ_card + obtain ⟨α₂, F₀, hF₀_sub, _, hα₂_Z, _, hα₂_out⟩ := + move_finite_set_on_cuff hS hC₀ hU_open hC₀_U φ₀ M hZC₀_sub hZC₀_fin hZC₀_card + have hα₂_fix_other : ∀ x ∈ bd S \ C₀, α₂ x = x := + fun x hx => hα₂_out x (not_not.mpr hx) + have hα₂_C₀ : α₂ '' (Z ∩ C₀) ⊆ cuffCanon C₀ := by + dsimp [cuffCanon] + rw [dite_eq_left_of_eq_true (eq_true hC₀)] + exact hα₂_Z.trans (image_mono hF₀_sub) + refine ⟨α₁.trans α₂, ?_, ?_⟩ + · rintro _ ⟨z, ⟨hzZ, hz_union⟩, rfl⟩ + simp only [Finset.mem_insert, iUnion_iUnion_eq_or_left, mem_union] at hz_union ⊢ + simp only [Homeomorph.trans_apply] + rcases hz_union with hz_C₀ | hz_𝒜 + · rw [hα₁_fix_C₀ z hz_C₀] + exact Or.inl (hα₂_C₀ (mem_image_of_mem α₂ ⟨hzZ, hz_C₀⟩)) + · have hα₁z : α₁ z ∈ ⋃ C ∈ 𝒜, cuffCanon C := + hα₁_img (mem_image_of_mem α₁ ⟨hzZ, hz_𝒜⟩) + have hα₁z_other : α₁ z ∈ bd S \ C₀ := by + have h_in_𝒜 : α₁ z ∈ ⋃ C ∈ 𝒜, C := + iUnion₂_mono (fun C hC => hcuffCanon_sub C (h𝒜 C hC)) hα₁z + refine ⟨iUnion₂_subset (fun C hC => hC_sub_bd C (h𝒜 C hC)) h_in_𝒜, ?_⟩ + exact disjoint_right.mp hC₀_disj_𝒜 h_in_𝒜 + rw [hα₂_fix_other (α₁ z) hα₁z_other] + exact Or.inr hα₁z + · intro x hx + simp only [Finset.mem_insert, iUnion_iUnion_eq_or_left, mem_sdiff, mem_union, not_or] at hx + have hx₁ : α₁ x = x := hα₁_fix x ⟨hx.1, hx.2.2⟩ + have hx₂ : α₂ x = x := hα₂_fix_other x ⟨hx.1, hx.2.1⟩ + simp [Homeomorph.trans_apply, hx₁, hx₂] + obtain ⟨β, hβ_img, _⟩ := h_ind hcuffs_fin.toFinset (fun C hC => hcuffs_fin.mem_toFinset.mp hC) + refine ⟨β, ?_⟩ + have hZ_eq : Z ∩ (⋃ C ∈ hcuffs_fin.toFinset, C) = Z := by + rw [inter_eq_left] + intro x hx + have hx_bd : x ∈ bd S := hZ_bd hx + refine mem_iUnion₂.mpr ⟨connectedComponentIn (bd S) x, ?_, mem_connectedComponentIn hx_bd⟩ + exact hcuffs_fin.mem_toFinset.mpr ⟨x, hx_bd, rfl⟩ + rw [hZ_eq] at hβ_img + refine hβ_img.trans (iUnion₂_mono' fun C hC => ⟨C, hcuffs_fin.mem_toFinset.mp hC, Subset.rfl⟩) + +theorem vertexValency_mapDrawingHomeo {S' : Type v} [TopologicalSpace S'] + (β : S ≃ₜ S') (G : Drawing S) (v : S) : + vertexValency (mapDrawingHomeo β G) (β v) = vertexValency G v := by + unfold vertexValency + have h_tilde : ∀ e : Set S, tilde (β '' e) = β '' tilde e := by + intro e + unfold tilde + rw [← β.image_closure, ← image_sdiff β.injective] + have h_inc : ∀ e ∈ G.E, + (mapDrawingHomeo β G).VertexIncident (β v) (β '' e) ↔ G.VertexIncident v e := by + intro e he + unfold Drawing.VertexIncident + have he' : β '' e ∈ (mapDrawingHomeo β G).E := by + rw [mapDrawingHomeo_E] + exact mem_image_of_mem (image β) he + have hV_iff : β v ∈ (mapDrawingHomeo β G).V ↔ v ∈ G.V := + β.injective.mem_set_image + have hcl_iff : β v ∈ closure (β '' e) ↔ v ∈ closure e := by + rw [← β.image_closure] + exact β.injective.mem_set_image + exact ⟨fun ⟨hV, _, hcl⟩ => ⟨hV_iff.mp hV, Or.inl he, hcl_iff.mp hcl⟩, + fun ⟨hV, _, hcl⟩ => ⟨hV_iff.mpr hV, Or.inl he', hcl_iff.mpr hcl⟩⟩ + have h_set : ∀ k : ℕ, + {e' ∈ (mapDrawingHomeo β G).E | + (mapDrawingHomeo β G).VertexIncident (β v) e' ∧ (tilde e').ncard = k} = + (image β) '' {e ∈ G.E | G.VertexIncident v e ∧ (tilde e).ncard = k} := by + intro k + ext e' + simp only [mem_sep_iff, mem_image] + constructor + · rintro ⟨he'E, hinc', hcard'⟩ + rw [mapDrawingHomeo_E] at he'E + rcases he'E with ⟨e, heE, rfl⟩ + rw [h_inc e heE] at hinc' + rw [h_tilde, ncard_image_of_injective _ β.injective] at hcard' + exact ⟨e, ⟨heE, hinc', hcard'⟩, rfl⟩ + · rintro ⟨e, ⟨heE, hinc, hcard⟩, rfl⟩ + rw [mapDrawingHomeo_E, h_inc e heE, h_tilde, ncard_image_of_injective _ β.injective] + exact ⟨mem_image_of_mem (image β) heE, hinc, hcard⟩ + rw [h_set 2, h_set 1, + ncard_image_of_injective _ (image_injective.mpr β.injective), + ncard_image_of_injective _ (image_injective.mpr β.injective)] + +theorem IsMatching.map_homeo {S' : Type v} [TopologicalSpace S'] (β : S ≃ₜ S') + {G : Drawing S} (hG : IsMatching G) : IsMatching (mapDrawingHomeo β G) := by + rcases hG with ⟨hprop, hV_bd, hval⟩ + refine ⟨IsProper.map_homeo β hprop, ?_, ?_⟩ + · rw [← image_bd_homeomorph β] + exact image_mono hV_bd + · rintro _ ⟨v, hv, rfl⟩ + rw [vertexValency_mapDrawingHomeo] + exact hval v hv + +theorem IsXMatching.map_homeo {S' : Type v} [TopologicalSpace S'] (β : S ≃ₜ S') + {X : Set S} {G : Drawing S} (hG : IsXMatching X G) : + IsXMatching (β '' X) (mapDrawingHomeo β G) := + ⟨hG.1.map_homeo β, congrArg (image β) hG.2⟩ + +theorem IsYForest.map_homeo {S' : Type v} [TopologicalSpace S'] (β : S ≃ₜ S') + {Y : Set S} {H : Drawing S} (hH : IsYForest Y H) : + IsYForest (β '' Y) (mapDrawingHomeo β H) := by + refine ⟨IsSurfaceForest.map_homeo β hH.1, ?_⟩ + calc + (mapDrawingHomeo β H).V ∩ bd S' = β '' H.V ∩ β '' bd S := by + rw [image_bd_homeomorph β]; rfl + _ = β '' (H.V ∩ bd S) := (image_inter β.injective).symm + _ = β '' Y := by rw [hH.2] + +theorem ForestsHomoplastic.map_right {H₀ H₁ : Drawing S} + (h : ForestsHomoplastic H₀ H₁) (α : S ≃ₜ S) (hα : ∀ x ∈ bd S, α x = x) : + ForestsHomoplastic H₀ (mapDrawingHomeo α H₁) := by + rcases h with ⟨β, hβ_bd, hhom⟩ + refine ⟨β.trans α, fun x hx => by simp [Homeomorph.trans_apply, hβ_bd x hx, hα x hx], ?_⟩ + rw [← mapDrawingHomeo_trans] + exact ForestsHomotopic.map_homeo α hhom + +theorem ForestsHomoplastic.conj_homeo {S' : Type v} [TopologicalSpace S'] (β : S ≃ₜ S') + {H : Drawing S} {H' : Drawing S'} + (h : ForestsHomoplastic (mapDrawingHomeo β H) H') : + ForestsHomoplastic H (mapDrawingHomeo β.symm H') := by + rcases h with ⟨α₀, hα₀_bd, hhom⟩ + refine ⟨(β.trans α₀).trans β.symm, fun x hx => ?_, ?_⟩ + · have hβx : β x ∈ bd S' := by + rw [← image_bd_homeomorph β] + exact mem_image_of_mem β hx + have hα₀ : α₀ (β x) = β x := hα₀_bd (β x) hβx + simp [Homeomorph.trans_apply, hα₀] + · have hhom' := ForestsHomotopic.map_homeo β.symm hhom + rwa [mapDrawingHomeo_trans, mapDrawingHomeo_trans] at hhom' + +/-- Transport of `IsSurface` along a homeomorphism. -/ +theorem isSurface_of_homeo {S' : Type v} [TopologicalSpace S'] (e : S ≃ₜ S') (h : IsSurface S) : + IsSurface S' := by + have : CompactSpace S := h.1 + have : T2Space S := h.2.1 + refine ⟨e.surjective.compactSpace e.continuous, e.symm.isEmbedding.t2Space, fun x => ?_⟩ + simpa using isManifoldPoint_of_isOpenEmbedding e.isOpenEmbedding (h.2.2 (e.symm x)) + +/-- Every surface `S : Type u` is homeomorphic to a topological space `S₀ : Type 0`. -/ +theorem exists_homeo_type_zero (hS : IsSurface S) : + ∃ (S₀ : Type 0) (_ : TopologicalSpace S₀), Nonempty (S ≃ₜ S₀) := by + classical + have : CompactSpace S := hS.1 + choose U V hU _ hx hφ using hS.2.2 + obtain ⟨t, ht⟩ := isCompact_univ.elim_nhds_subcover U (fun x _ => (hU x).mem_nhds (hx x)) + have hcov : ∀ s : S, ∃ i : ↥t, s ∈ U i.1 := fun s => by + obtain ⟨x, hxt, hsx⟩ := mem_iUnion₂.mp (ht.2 (mem_univ s)) + exact ⟨⟨x, hxt⟩, hsx⟩ + choose idx hidx using hcov + let g : S → Fin t.card × EuclideanHalfSpace 2 := fun s => + (t.equivFin (idx s), ((hφ (idx s).1).some ⟨s, hidx s⟩).1) + have hginj : Function.Injective g := by + intro s₁ s₂ h + have h2 : ∀ (i₁ i₂ : ↥t) (h₁ : s₁ ∈ U i₁.1) (h₂ : s₂ ∈ U i₂.1), + i₁ = i₂ → + ((hφ i₁.1).some ⟨s₁, h₁⟩).1 = ((hφ i₂.1).some ⟨s₂, h₂⟩).1 → s₁ = s₂ := by + rintro i₁ _ h₁ h₂ rfl heq + exact congrArg Subtype.val ((hφ i₁.1).some.injective (Subtype.ext heq)) + exact h2 (idx s₁) (idx s₂) (hidx s₁) (hidx s₂) + (t.equivFin.injective (Prod.ext_iff.mp h).1) (Prod.ext_iff.mp h).2 + let S₀ : Type 0 := Set.range g + let e₀ : S ≃ S₀ := Equiv.ofInjective g hginj + let τ₀ : TopologicalSpace S₀ := TopologicalSpace.induced e₀.symm inferInstance + let _ : TopologicalSpace S₀ := τ₀ + have hind : Topology.IsInducing e₀ := by + refine ⟨?_⟩ + change _ = TopologicalSpace.induced e₀ (TopologicalSpace.induced e₀.symm _) + rw [induced_compose] + have hcomp : e₀.symm ∘ e₀ = id := funext e₀.symm_apply_apply + rw [hcomp, induced_id] + exact ⟨S₀, τ₀, ⟨e₀.toHomeomorphOfIsInducing hind⟩⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section35.lean b/LeanPool/GraphMinor/GM07/Section35.lean new file mode 100644 index 0000000000..dd1b94cb2c --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section35.lean @@ -0,0 +1,780 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.GrowForest +public import LeanPool.GraphMinor.GM07.Section2 + +/-! +# Graph Minors VII, (3.5) + +(3.5) (page 221) says that each homoplasty class of forests holds a forest that meets a given +matching `G` in a finite set. The paper leaves +the proof to the reader. Our route: take the discs around the components of the forest `H₀`, and the +matching `G₁` in their boundaries. In each disc, +join the points of `bd(Σ)` by a tree that meets `G` in finitely many points. The new forest and `H₀` +are both surrounded by `G₁`, so by +(3.4), claim (2), they are homotopic. + +To join two points in a disc we leave each along a line that misses `G` (`exists_start`), and then +use `finReach_of_connected`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 + +variable {S T : Type} [TopologicalSpace S] [TopologicalSpace T] + +/-- A connected set that misses the frontier of a closed set and meets the set lies in it. -/ +theorem subset_of_preconnected_frontier {A B : Set T} (hA : IsPreconnected A) (hB : IsClosed B) + (hd : Disjoint A (frontier B)) + (hne : (A ∩ B).Nonempty) : A ⊆ B := by + by_contra hn + obtain ⟨z, hz, hzB⟩ := not_subset.mp hn + have hcov : A ⊆ B ∪ closure Bᶜ := fun w _ => by + by_cases h : w ∈ B + · exact .inl h + · exact .inr (subset_closure h) + obtain ⟨w, hw, h1⟩ := isPreconnected_closed_iff.mp hA _ _ hB isClosed_closure hcov hne ⟨z, hz, + subset_closure hzB⟩ + refine disjoint_left.mp hd hw ?_ + rw [frontier_eq_closure_inter_closure, hB.closure_eq] + exact h1 + +/-- A line from a point of `bd(Σ)` into a disc which misses a drawing `G`, when `G` also misses the +point. -/ +theorem exists_start_off {j : S → T} (hj : IsEmbedding j) {D Z : Set S} {y : S} + (hD : IsClosedDisc D) (hy : y ∈ discBd D) (hZ : IsClosed Z) + (hyZ : y ∉ Z) : ∃ w K₀, w ∈ discInt D ∧ w ∉ Z ∧ JoinedIn K₀ (j y) (j w) ∧ K₀ ⊆ {j y} ∪ j '' + (discInt D \ Z) := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hpS : h y ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem h hy + have hyD : y ∈ D := GM11.discBd_subset _ hy + set p := h y with hp + have hgp : g p = y := c.gh hyD + have hpn : ‖p‖ = 1 := mem_sphere_zero_iff_norm.mp hpS + obtain ⟨W₁, hW₁, hW₁eq⟩ := continuousOn_iff'.mp c.gc Zᶜ hZ.isOpen_compl + have hpW : p ∈ W₁ := by + have : p ∈ g ⁻¹' Zᶜ ∩ closedBall 0 1 := + ⟨by rw [mem_preimage, hgp]; exact hyZ, sphere_subset_closedBall hpS⟩ + rw [hW₁eq] at this + exact this.1 + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hW₁ p hpW + let δ : ℝ := min (ε / 2) (1 / 2) + have hδ : 0 < δ := lt_min (by linarith) (by norm_num) + have hδ1 : δ ≤ ε / 2 := min_le_left _ _ + have hδ2 : δ ≤ 1 / 2 := min_le_right _ _ + let w' : ℂ := ((1 - δ : ℝ) : ℂ) * p + let Q : Set ℂ := segment ℝ w' p + have hform : ∀ z ∈ Q, ∃ r : ℝ, 0 ≤ r ∧ r ≤ δ ∧ z = ((1 - r : ℝ) : ℂ) * p := fun z hz => by + obtain ⟨a, b, ha, hb, hab, rfl⟩ := hz + refine ⟨a * δ, mul_nonneg ha hδ.le, ?_, ?_⟩ + · have : a ≤ 1 := by linarith + nlinarith + · simp only [w', Complex.real_smul] + have hb' : b = 1 - a := by linarith + subst hb' + push_cast + ring + have hnorm : ∀ r : ℝ, 0 ≤ r → r ≤ δ → ‖((1 - r : ℝ) : ℂ) * p‖ = 1 - r := fun r h0 h1 => by + rw [norm_mul, hpn, mul_one, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (by linarith)] + have hQball : Q ⊆ closedBall 0 1 := fun z hz => by + obtain ⟨r, h0, h1, rfl⟩ := hform z hz + rw [mem_closedBall_zero_iff, hnorm r h0 h1] + linarith + have hQZ : ∀ z ∈ Q, g z ∉ Z := fun z hz => by + obtain ⟨r, h0, h1, e⟩ := hform z hz + have hd : dist z p < ε := by + rw [e, dist_eq_norm] + have h2 : ((1 - r : ℝ) : ℂ) * p - p = ((-r : ℝ) : ℂ) * p := by + push_cast + ring + rw [h2, norm_mul, hpn, mul_one, Complex.norm_real, Real.norm_eq_abs, abs_neg, + abs_of_nonneg h0] + linarith + have h3 : z ∈ W₁ ∩ closedBall 0 1 := ⟨hball hd, hQball hz⟩ + rw [← hW₁eq] at h3 + exact h3.1 + have hQint : ∀ z ∈ Q, z ≠ p → g z ∈ discInt D := fun z hz hne => by + obtain ⟨r, h0, h1, e⟩ := hform z hz + refine ⟨c.gm (hQball hz), fun hb => ?_⟩ + have h2 : h (g z) ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem h hb + rw [c.hg (hQball hz), mem_sphere_zero_iff_norm, e, hnorm r h0 h1] at h2 + have : r = 0 := by linarith + apply hne + rw [e, this] + simp + have hw'p : w' ≠ p := fun e => by + have h1 := congrArg norm e + rw [show w' = ((1 - δ : ℝ) : ℂ) * p from rfl, hnorm δ hδ.le le_rfl, hpn] at h1 + linarith + have hmem : w' ∈ Q := left_mem_segment ℝ w' p + have hjg : JoinedIn Q w' p := ((convex_segment w' p).isPathConnected ⟨w', hmem⟩).joinedIn _ hmem + _ (right_mem_segment ℝ w' p) + have hj2 : JoinedIn (j '' (g '' Q)) (j (g w')) (j (g p)) := + (hjg.map (c.gc.mono hQball)).map hj.continuous.continuousOn + rw [hgp] at hj2 + refine ⟨g w', _, hQint w' hmem hw'p, hQZ w' hmem, hj2.symm, ?_⟩ + rintro _ ⟨_, ⟨z, hz, rfl⟩, rfl⟩ + by_cases hzp : z = p + · rw [hzp, hgp] + exact .inl rfl + · exact .inr ⟨g z, ⟨hQint z hz hzp, hQZ z hz⟩, rfl⟩ + +/-- A line that runs next to the edge of a matching `G` at its end `y`, and otherwise misses `G` and +`bd(Σ)`, until it reaches the given open set `O`. -/ +theorem exists_start_on (hS : IsSurface S) {j : S → T} {K : Set T} (hT : IsClosedSurface T) + (hj : IsClosedEmbedding j) (hK : IsClosed K) (hu : range j ∪ K = univ) + (hi : range j ∩ K = j '' bd S) {G : Drawing S} (hG : IsMatching G) {y : S} (hyb : y ∈ bd S) + (hyG : y ∈ G.U) {D O : Set S} (hO : IsOpen O) (hyO : y ∈ O) + (hOD : O \ bd S ⊆ discInt D) : ∃ w K₀, w ∈ discInt D ∧ w ∉ G.U ∧ JoinedIn K₀ (j y) (j w) + ∧ K₀ ⊆ {j y} ∪ j '' (discInt D \ G.U) := by + classical + have ht2 : T2Space T := hT.2.1 + have ht2S : T2Space S := hS.2.1 + have hbc : IsClosed (bd S) := (cuff_statement.{0} S hS).1 + have hprop : ∀ x ∈ G.U, x ∈ bd S → x ∈ G.V := fun x h1 h2 => hG.1 ⟨h2, h1⟩ + have hyV : y ∈ G.V := hprop y hyG hyb + -- The edge at `y`. + have hval := hG.2.2 y hyV + obtain ⟨e, he, hye, hte⟩ : ∃ e ∈ G.E, y ∈ closure e ∧ (tilde e).ncard = 2 := by + unfold vertexValency at hval + have hpos : {e ∈ G.E | G.VertexIncident y e ∧ (tilde e).ncard = 2}.Nonempty := by + by_contra hn + rw [not_nonempty_iff_eq_empty.mp hn, ncard_empty] at hval + omega + obtain ⟨e, he, ⟨-, -, h3⟩, h4⟩ := hpos + exact ⟨e, he, h3, h4⟩ + have htilde := tilde_eq_closure_inter_V G he + obtain ⟨y', hne, hcap, hL⟩ : ∃ y', y ≠ y' ∧ closure e ∩ G.V = {y, y'} ∧ IsLineWithEnds + (closure e) y y' := by + rcases G.edge_cond e he with ⟨u, v, huv, hcap, hl⟩ | ⟨u, hcap, -⟩ + · have : y ∈ ({u, v} : Set S) := hcap ▸ ⟨hye, hyV⟩ + rcases this with rfl | h1 + · exact ⟨v, huv, hcap, hl⟩ + · rw [mem_singleton_iff.mp h1] at * + exact ⟨u, huv.symm, by rw [hcap, pair_comm], hl.symm⟩ + · rw [htilde, hcap] at hte + simp at hte + have hl' := hL.map_of_embedding hj.isEmbedding + have hne' : j y ≠ j y' := fun e' => hne (hj.injective e') + let Zl : Set T := j '' ((G.U \ e) ∪ bd S) + have hZl : IsClosed Zl := hj.isClosedMap _ ((isClosed_U_sdiff_edge G he).union hbc) + have heV : ∀ x ∈ e, x ∈ G.U ∧ x ∉ G.V := fun x hx => he.2.1 hx + have heb : ∀ x ∈ e, x ∉ bd S := fun x hx hb => (heV x hx).2 (hprop x (heV x hx).1 hb) + have hLZ : (j '' closure e) ∩ Zl ⊆ {j y, j y'} := by + rintro _ ⟨⟨x, hx, rfl⟩, ⟨x', hx', e'⟩⟩ + obtain rfl := hj.injective e' + by_cases hxe : x' ∈ e + · rcases hx' with h1 | h1 + · exact (h1.2 hxe).elim + · exact (heb _ hxe h1).elim + · have : x' ∈ tilde e := ⟨hx, hxe⟩ + rw [htilde, hcap] at this + rcases this with rfl | h1 + · exact .inl rfl + · exact .inr (congrArg j h1) + obtain ⟨Dl, A, B, -, hLD, hDZ, -, -, -, hDeq, hAc, -, hAne, -, hAL, -, hLA, -, ⟨pth, -, hpin⟩, -⟩ + := exists_edge_lens hT hl' hne' hZl hLZ + have hAD : A ⊆ Dl := fun z hz => hDeq ▸ .inl (.inl hz) + have hAZ : Disjoint A Zl := disjoint_left.mpr fun z h1 h2 => by + have h3 := hDZ ⟨hAD h1, h2⟩ + have h4 : z ∈ j '' closure e := by + rcases h3 with rfl | h3 + · exact hl'.left_mem + · exact (mem_singleton_iff.mp h3) ▸ hl'.right_mem + exact disjoint_left.mp hAL h1 h4 + have hfr : frontier (range j) = j '' bd S := cap_frontier hT hj hK hu hi + have hAr : A ⊆ range j := by + refine subset_of_preconnected_frontier hAc hj.isClosed_range ?_ ?_ + · rw [hfr] + exact hAZ.mono_right (image_mono subset_union_right) + · obtain ⟨x₀, hx₀⟩ : e.Nonempty := he.2.2.1.nonempty + have h1 : j x₀ ∈ interior (range j) := by + have h2 : j x₀ ∉ frontier (range j) := by + rw [hfr] + rintro ⟨x, hx, e'⟩ + rw [hj.injective e'] at hx + exact heb x₀ hx₀ hx + by_contra h3 + exact h2 ⟨subset_closure ⟨x₀, rfl⟩, h3⟩ + have h2 : j x₀ ∈ closure A := hLA ⟨x₀, subset_closure hx₀, rfl⟩ + obtain ⟨z, hz, hzA⟩ := mem_closure_iff.mp h2 _ isOpen_interior h1 + exact ⟨z, hzA, interior_subset hz⟩ + obtain ⟨W', hW', hWO⟩ := hj.isInducing.isOpen_iff.mp hO + have hp0 : pth 0 ∈ W' := by + rw [pth.source] + exact (hWO.symm ▸ hyO : y ∈ j ⁻¹' W') + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp (hW'.preimage pth.continuous) 0 hp0 + let τ : ℝ := min (ε / 2) (1 / 2) + have hτ : 0 < τ := lt_min (by linarith) (by norm_num) + have hτ1 : τ ≤ ε / 2 := min_le_left _ _ + have hτ2 : τ ≤ 1 / 2 := min_le_right _ _ + have hIcc : ∀ t ∈ Icc 0 τ, t ∈ Icc (0 : ℝ) 1 := fun t ht => ⟨ht.1, by linarith [ht.2]⟩ + have hgood : ∀ t (ht : t ∈ Icc 0 τ), 0 < t → ∃ x ∈ discInt D \ G.U, pth ⟨t, hIcc t ht⟩ = j x + := fun t ht h0 => by + have hA : pth ⟨t, hIcc t ht⟩ ∈ A := hpin _ h0 (show (t : ℝ) < 1 by linarith [ht.2]) + obtain ⟨x, hx⟩ := hAr hA + have hxO : x ∈ O := by + rw [← hWO, mem_preimage, hx] + refine hball ?_ + rw [mem_ball, Subtype.dist_eq] + simp only [Set.Icc.coe_zero, Real.dist_eq, sub_zero] + rw [abs_of_nonneg ht.1] + linarith [ht.2] + have hxb : x ∉ bd S := fun h => disjoint_left.mp hAZ hA ⟨x, .inr h, hx⟩ + have hxG : x ∉ G.U := fun h => by + by_cases hxe : x ∈ e + · exact disjoint_left.mp hAL hA ⟨x, subset_closure hxe, hx⟩ + · exact disjoint_left.mp hAZ hA ⟨x, .inl ⟨h, hxe⟩, hx⟩ + exact ⟨x, ⟨hOD ⟨hxO, hxb⟩, hxG⟩, hx.symm⟩ + have hτm : τ ∈ Icc 0 τ := ⟨hτ.le, le_rfl⟩ + obtain ⟨w, hw, hwe⟩ := hgood τ hτm hτ + have hmem0 : (0 : ℝ) ∈ Icc 0 τ := ⟨le_rfl, hτ.le⟩ + have hJ : JoinedIn (Icc 0 τ) (0 : ℝ) τ := ((convex_Icc 0 τ).isPathConnected ⟨0, hmem0⟩).joinedIn + _ hmem0 _ hτm + have hJ2 := hJ.map pth.continuous_extend.continuousOn + have hext : ∀ t (ht : t ∈ Icc 0 τ), pth.extend t = pth ⟨t, hIcc t ht⟩ := fun t ht + => pth.extend_apply (hIcc t ht) + rw [hext τ hτm, hwe, pth.extend_zero] at hJ2 + refine ⟨w, _, hw.1, hw.2, hJ2, ?_⟩ + rintro _ ⟨t, ht, rfl⟩ + rcases ht.1.eq_or_lt with h0 | h0 + · rw [← h0, pth.extend_zero] + exact .inl rfl + · obtain ⟨x, hx, e'⟩ := hgood t ht h0 + rw [hext t ht, e'] + exact .inr ⟨x, hx, rfl⟩ + +/-- A drawing is an arc near each of its points that are not vertices. -/ +theorem drawing_local_arc [T2Space S] {j : S → T} (hj : IsClosedEmbedding j) + (G : Drawing S) {x : S} (hxU : x ∈ G.U) (hxV : x ∉ G.V) : + ∃ (a : unitInterval → T) (W : Set T), IsArcMap a ∧ IsOpen W ∧ j x ∈ W ∧ j x ∈ a '' Ioo 0 1 + ∧ range a ⊆ j '' G.U ∧ j '' G.U ∩ W ⊆ range a := by + obtain ⟨e, he, hxe⟩ := G.exists_edge_of_mem hxU hxV + obtain ⟨γ, hγc, h0, h1, hinj, himg⟩ := exists_edge_param G he + obtain ⟨t, ht, rfl⟩ := (himg ▸ hxe : x ∈ γ '' Ioo 0 1) + have ht0 : (0 : ℝ) < t := ht.1 + have ht1 : (t : ℝ) < 1 := ht.2 + let φ : unitInterval → unitInterval := fun u => + ⟨(t.1 + u.1) / 2, by have := u.2.1; linarith, by have := u.2.2; linarith⟩ + have hφc : Continuous φ := by + refine Continuous.subtype_mk ?_ _ + fun_prop + have hφ0 : ∀ u, 0 < φ u := fun u => by + have h2 : 0 ≤ u.1 := u.2.1 + change (0 : ℝ) < (t.1 + u.1) / 2 + linarith + have hφ1 : ∀ u, φ u < 1 := fun u => by + have h2 : u.1 ≤ 1 := u.2.2 + change (t.1 + u.1) / 2 < (1 : ℝ) + linarith + have hφi : ∀ u, φ u ∈ Ioo (0 : unitInterval) 1 := fun u => ⟨hφ0 u, hφ1 u⟩ + have hφt : φ t = t := Subtype.ext (by simp only [φ]; ring) + let a : unitInterval → T := fun u => j (γ (φ u)) + have ha : IsArcMap a := ⟨hj.continuous.comp (hγc.comp hφc), fun u v h => by + have h2 := hinj (hφi u) (hφi v) (hj.injective h) + have h3 : (t.1 + u.1) / 2 = (t.1 + v.1) / 2 := congrArg Subtype.val h2 + exact Subtype.ext (by linarith)⟩ + have hγe : ∀ u ∈ Ioo (0 : unitInterval) 1, γ u ∈ e := fun u hu => himg ▸ mem_image_of_mem γ hu + let c₁ : unitInterval := ⟨t.1 / 2, by linarith, by linarith⟩ + let c₂ : unitInterval := ⟨(t.1 + 1) / 2, by linarith, by linarith⟩ + let Y₀ : Set S := (G.U \ e) ∪ γ '' Iic c₁ ∪ γ '' Ici c₂ + have hY₀ : IsClosed Y₀ := ((isClosed_U_sdiff_edge G he).union (isClosed_Iic.isCompact.image + hγc).isClosed).union (isClosed_Ici.isCompact.image hγc).isClosed + have hnot : ∀ r : unitInterval, γ r = γ t → r = t := fun r e' => by + by_cases h2 : r ∈ Ioo (0 : unitInterval) 1 + · exact hinj h2 ht e' + · exfalso + have h3 : r = 0 ∨ r = 1 := by + by_contra hn + push Not at hn + exact h2 ⟨unitInterval.pos_iff_ne_zero.mpr hn.1, unitInterval.lt_one_iff_ne_one.mpr hn.2⟩ + rcases h3 with rfl | rfl + · exact hxV (e' ▸ h0) + · exact hxV (e' ▸ h1) + have hxY : γ t ∉ Y₀ := by + rintro ((h2 | ⟨r, hr, e'⟩) | ⟨r, hr, e'⟩) + · exact h2.2 hxe + · rw [hnot r e'] at hr + have : t.1 ≤ t.1 / 2 := hr + linarith + · rw [hnot r e'] at hr + have : (t.1 + 1) / 2 ≤ t.1 := hr + linarith + refine ⟨a, (j '' Y₀)ᶜ, ha, (hj.isClosedMap _ hY₀).isOpen_compl, fun ⟨x', hx', + e'⟩ => hxY (hj.injective e' ▸ hx'), ⟨t, ht, by simp only [a, hφt]⟩, ?_, ?_⟩ + · rintro _ ⟨u, rfl⟩ + exact ⟨_, (he.2.1 (hγe _ (hφi u))).1, rfl⟩ + · rintro _ ⟨⟨x', hx', rfl⟩, hW⟩ + have hx'Y : x' ∉ Y₀ := fun h => hW ⟨x', h, rfl⟩ + have hx'e : x' ∈ e := by + by_contra h + exact hx'Y (.inl (.inl ⟨hx', h⟩)) + obtain ⟨r, hr, rfl⟩ := (himg ▸ hx'e : x' ∈ γ '' Ioo 0 1) + have h3 : c₁ < r := by + by_contra h + exact hx'Y (.inl (.inr ⟨r, not_lt.mp h, rfl⟩)) + have h4 : r < c₂ := by + by_contra h + exact hx'Y (.inr ⟨r, not_lt.mp h, rfl⟩) + have h3' : t.1 / 2 < r.1 := h3 + have h4' : r.1 < (t.1 + 1) / 2 := h4 + refine ⟨⟨2 * r.1 - t.1, by linarith, by linarith⟩, ?_⟩ + have : φ ⟨2 * r.1 - t.1, by linarith, by linarith⟩ = r := Subtype.ext (by simp only [φ]; ring) + simp only [a, this] + +/-- **Joining two points of a disc.** Two points of `bd(Σ)` in the boundary of a disc, whose inside +misses `bd(Σ)`, are joined by a line through the +inside of the disc that meets the matching `G` in a finite set. -/ +theorem exists_line_in_disc (hS : IsSurface S) {G : Drawing S} (hG : IsMatching G) {D : Set S} + (hD : IsClosedDisc D) (hDb : Disjoint (discInt D) (bd S)) {y y' : S} + (hne : y ≠ y') (hy : y ∈ bd S) (hy' : y' ∈ bd S) (hyD : y ∈ discBd D) (hyD' : y' ∈ discBd D) + (hO : ∃ O, IsOpen O ∧ y ∈ O ∧ O \ bd S ⊆ discInt D) + (hO' : ∃ O, IsOpen O ∧ y' ∈ O ∧ O \ bd S ⊆ discInt D) : + ∃ P, IsLineWithEnds P y y' ∧ P ⊆ D ∧ P \ {y, y'} ⊆ discInt D ∧ (P ∩ G.U).Finite := by + classical + have ht2 : T2Space S := hS.2.1 + have hN : Nonempty S := ⟨y⟩ + obtain ⟨T, tT, j, K, hT, hj, hK, hu, hi, -⟩ := exists_capAll S hS + have ht2T : T2Space T := hT.2.1 + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + have hstart : ∀ {x : S}, x ∈ bd S → x ∈ discBd D → (∃ O, IsOpen O ∧ x ∈ O ∧ O \ bd S ⊆ discInt D) + → + ∃ w K₀, w ∈ discInt D ∧ w ∉ G.U ∧ JoinedIn K₀ (j x) (j w) ∧ K₀ ⊆ {j x} ∪ j '' + (discInt D \ G.U) := fun {x} hx hxD ⟨O, h1, h2, h3⟩ => by + by_cases hxG : x ∈ G.U + · exact exists_start_on hS hT hj hK hu hi hG hx hxG h1 h2 h3 + · exact exists_start_off hj.isEmbedding hD hxD G.isClosed_U hxG + obtain ⟨w, K₁, hw, hwG, hJ₁, hK₁⟩ := hstart hy hyD hO + obtain ⟨w', K₂, hw', hwG', hJ₂, hK₂⟩ := hstart hy' hyD' hO' + let O' : Set T := j '' discInt D + let Z' : Set T := j '' G.U + have hdisc := hD.image_injOn hj.continuous.continuousOn hj.injective.injOn + have hO'eq : O' = discInt (j '' D) := by + change j '' (D \ discBd D) = j '' D \ discBd (j '' D) + rw [hdisc.2, image_sdiff hj.injective] + have hO'o : IsOpen O' := hO'eq ▸ hdisc.1.isOpen_discInt hman + have hO'c : IsPreconnected O' := hD.isPreconnected_discInt.image j hj.continuous.continuousOn + have hZ' : IsClosed Z' := hj.isClosedMap _ G.isClosed_U + have hmemO : ∀ {x}, x ∈ discInt D → x ∉ G.U → j x ∈ O' \ Z' := fun {x} h1 h2 => + ⟨⟨x, h1, rfl⟩, fun ⟨x', h3, e⟩ => h2 (hj.injective e ▸ h3)⟩ + have hreach : FinReach O' Z' (j w) (j w') := finReach_of_connected hT hO'o hO'c hZ' (fun z hz + => by + obtain ⟨⟨x, hx, rfl⟩, ⟨x', hx', e⟩⟩ := hz + obtain rfl := hj.injective e + have hxV : x' ∉ G.V := fun h => disjoint_left.mp hDb hx (hG.2.1 h) + exact drawing_local_arc hj G hx' hxV) (hmemO hw hwG) (hmemO hw' hwG') + obtain ⟨K₃, h3O, h3Z, hJ₃⟩ := hreach + have hJ : JoinedIn (K₁ ∪ K₃ ∪ K₂) (j y) (j y') := + ((hJ₁.mono (subset_union_left.trans subset_union_left)).trans (hJ₃.mono + (subset_union_right.trans subset_union_left))).trans + (hJ₂.symm.mono subset_union_right) + have hne' : j y ≠ j y' := fun e => hne (hj.injective e) + obtain ⟨L, hLs, hLl⟩ := ((joinedIn_iff_eq_or_exists_isLineWithEnds hJ.source_mem + hJ.target_mem).mp hJ).resolve_left hne' + have hKr : K₁ ∪ K₃ ∪ K₂ ⊆ range j := by + rintro z ((hz | hz) | hz) + · rcases hK₁ hz with rfl | ⟨x, -, rfl⟩ + · exact ⟨_, rfl⟩ + · exact ⟨_, rfl⟩ + · obtain ⟨x, -, rfl⟩ := h3O hz + exact ⟨_, rfl⟩ + · rcases hK₂ hz with rfl | ⟨x, -, rfl⟩ + · exact ⟨_, rfl⟩ + · exact ⟨_, rfl⟩ + obtain ⟨u', v', e1, e2, hl⟩ := hLl.pull hj.isEmbedding (hLs.trans hKr) + obtain rfl := hj.injective e1 + obtain rfl := hj.injective e2 + have hinner : ∀ x ∈ j ⁻¹' L, x ≠ u' → x ≠ v' → x ∈ discInt D := fun x hx h1 h2 => by + rcases hLs hx with (h3 | h3) | h3 + · rcases hK₁ h3 with h4 | ⟨x', h4, e⟩ + · exact (h1 (hj.injective h4)).elim + · exact hj.injective e ▸ h4.1 + · obtain ⟨x', h4, e⟩ := h3O h3 + exact hj.injective e ▸ h4 + · rcases hK₂ h3 with h4 | ⟨x', h4, e⟩ + · exact (h2 (hj.injective h4)).elim + · exact hj.injective e ▸ h4.1 + refine ⟨j ⁻¹' L, hl, fun x hx => ?_, fun x hx => hinner x hx.1 (fun e => hx.2 (.inl e)) (fun e + => hx.2 (.inr e)), ?_⟩ + · by_cases h1 : x = u' + · exact h1 ▸ GM11.discBd_subset _ hyD + by_cases h2 : x = v' + · exact h2 ▸ GM11.discBd_subset _ hyD' + exact (hinner x hx h1 h2).1 + · have hfin : (({j u', j v'} : Set T) ∪ (K₃ ∩ Z')).Finite := (by simp : + ({j u', j v'} : Set T).Finite).union h3Z + refine Finite.of_finite_image (hfin.subset ?_) hj.injective.injOn + rintro _ ⟨x, ⟨hx, hxG⟩, rfl⟩ + by_cases h1 : x = u' + · exact .inl (.inl (congrArg j h1)) + by_cases h2 : x = v' + · exact .inl (.inr (congrArg j h2)) + rcases hLs hx with (h3 | h3) | h3 + · rcases hK₁ h3 with h4 | ⟨x', h4, e⟩ + · exact (h1 (hj.injective h4)).elim + · exact (h4.2 (hj.injective e ▸ hxG)).elim + · exact .inr ⟨h3, x, hxG, rfl⟩ + · rcases hK₂ h3 with h4 | ⟨x', h4, e⟩ + · exact (h2 (hj.injective h4)).elim + · exact (h4.2 (hj.injective e ▸ hxG)).elim + +/-- **Graph Minors VII, (3.5) (page 221).** For a matching `G` and a forest `H₀`, some forest +homoplastic to `H₀` meets `G` in a finite set. The paper leaves the +proof to the reader. The route is in the module docstring. -/ +theorem exists_finite_forest (hS : IsSurface S) {G H₀ : Drawing S} (hG : IsMatching G) + (hH : IsSurfaceForest H₀) : + ∃ H : Drawing S, IsSurfaceForest H ∧ ForestsHomoplastic H₀ H ∧ (G.U ∩ H.U).Finite := by + classical + have ht2 : T2Space S := hS.2.1 + rcases isEmpty_or_nonempty S with hE | hN + · refine ⟨H₀, hH, ⟨Homeomorph.refl S, fun _ _ => rfl, ?_⟩, ?_⟩ + · rw [mapDrawingHomeo_refl] + exact ⟨hH.1, hH.1, hH.2, hH.2, rfl, fun s => (hE.false s).elim⟩ + · refine (finite_empty (α := S)).subset fun x _ => (hE.false x).elim + have : Inhabited S := ⟨hN.some⟩ + let Y : Set S := H₀.V ∩ bd S + have hYf : Y.Finite := H₀.finite_V.subset inter_subset_left + have hYb : Y ⊆ bd S := inter_subset_right + obtain ⟨f, ε, hm, hd⟩ := exists_marks hS hYb hYf + obtain ⟨c, -, -, G₁, -, -, -, hG₀, hdisc, hdj, hdb, hall⟩ := exists_thick_matching hS hH rfl hm hd + have hsame : ∀ {u v z}, u ∈ Y → v ∈ Y → z ∈ c u → z ∈ c v → c u = c v := fun {u v z} hu hv h1 h2 + => by + by_contra hn + exact disjoint_left.mp (hdj u hu v hv hn) h1 h2 + have hyc : ∀ y ∈ Y, y ∈ c y := fun y hy => GM11.discBd_subset _ (hdisc y hy).2.1 + let 𝒟 : Set (Set S) := c '' Y + have hrep : ∀ D ∈ 𝒟, ∃ r ∈ Y, c r = D := fun D ⟨r, hr, e⟩ => ⟨r, hr, e⟩ + choose! rep hrepY hrepc using hrep + let R : Set S := rep '' 𝒟 + have hRf : R.Finite := (hYf.image c).image rep + have hRY : R ⊆ Y := by + rintro _ ⟨D, hD, rfl⟩ + exact hrepY D hD + let Q : Set S := ⋃ y ∈ Y, discInt (c y) + have hYQ : Disjoint Y Q := disjoint_left.mpr fun z hz hzQ => by + obtain ⟨y, hy, h1⟩ := mem_iUnion₂.mp hzQ + exact disjoint_left.mp (hdb y hy) h1 hz.2 + obtain ⟨V, 𝓛, hgrow, hYV, hreach⟩ := exists_grown (Z := G.U) (Q := Q) (𝒟 := 𝒟) hRf hYf hRY hYQ + (fun y hy hyR => by + have hD : c y ∈ 𝒟 := ⟨y, hy, rfl⟩ + let r := rep (c y) + have hrY : r ∈ Y := hrepY _ hD + have hrc : c r = c y := hrepc _ hD + have hne : y ≠ r := fun e => hyR (e ▸ ⟨_, hD, rfl⟩) + have h1 := hdisc y hy + have h2 := hdisc r hrY + rw [hrc] at h2 + obtain ⟨P, hl, hPD, hPQ, hPZ⟩ := exists_line_in_disc hS hG h1.1 (hdb y hy) hne (hYb hy) + (hYb hrY) h1.2.1 h2.2.1 h1.2.2 h2.2.2 + exact ⟨r, ⟨_, hD, rfl⟩, P, c y, hD, hl, hPD, fun z hz => mem_iUnion₂.mpr ⟨y, hy, hPQ hz⟩, hPZ⟩) + have hline : ∀ A ∈ 𝓛, ∃ a b, IsLineWithEnds A a b ∧ a ≠ b ∧ A ∩ V = {a, b} := hgrow.line + choose! ea eb hla hne hVA using hline + obtain ⟨H, hHU, hHV, hHE⟩ := GM12.exists_drawing_of_finite_lines hgrow.finV hgrow.finL id ea eb + hla hne hVA + fun A hA A' hA' h => hgrow.meet A hA A' hA' h + have hUeq : H.U = grownU V 𝓛 := by + rw [hHU, grownU, sUnion_eq_biUnion] + rfl + have hUsub : H.U ⊆ Y ∪ Q := by + rw [hUeq] + rintro z (hz | ⟨A, hA, hz⟩) + · exact hgrow.subV hz + · exact hgrow.subL A hA hz + have hQb : ∀ z ∈ Q, z ∉ bd S := fun z hz hb => by + obtain ⟨y, hy, h1⟩ := mem_iUnion₂.mp hz + exact disjoint_left.mp (hdb y hy) h1 hb + have hHYeq : H.V ∩ bd S = Y := by + rw [hHV] + ext z + constructor + · rintro ⟨h1, h2⟩ + rcases hgrow.subV h1 with h3 | h3 + · exact h3 + · exact (hQb z h3 h2).elim + · exact fun h => ⟨hYV h, hYb h⟩ + have hHf : IsSurfaceForest H := by + refine ⟨fun z hz => ?_, isGraphForest_of_noOArc fun F hF hsub => hgrow.noO F hF (hUeq ▸ hsub)⟩ + rw [hHV] + rcases hUsub hz.2 with h1 | h1 + · exact hYV h1 + · exact (hQb z h1 hz.1).elim + have hAclo : ∀ A ∈ 𝓛, closure (A \ {ea A, eb A}) = A := fun A hA => + subset_antisymm (closure_minimal sdiff_subset (hla A hA).isCompact.isClosed) + (hla A hA).subset_closure_diff + -- Lines stay in one disc. + have hAdisc : ∀ A ∈ 𝓛, ∀ y ∈ Y, ∀ u ∈ A, u ∈ c y → A ⊆ c y := fun A hA y hy u hu huy => by + obtain ⟨_, ⟨y', hy', rfl⟩, hA'⟩ := hgrow.disc A hA + rw [hsame hy hy' huy (hA' hu)] + exact hA' + have hadjc : ∀ y ∈ Y, ∀ u v, GrownAdj V 𝓛 u v → u ∈ c y → v ∈ c y := fun y hy u v ⟨A, hA, hc⟩ hu + => by + have hu' : u ∈ A := (hc ▸ (Or.inl rfl) : u ∈ A ∩ V).1 + have hv' : v ∈ A := (hc ▸ (Or.inr rfl) : v ∈ A ∩ V).1 + exact hAdisc A hA y hy u hu' hu hv' + have hreachc : ∀ y ∈ Y, ∀ {u v}, Relation.ReflTransGen (GrownAdj V 𝓛) u v → u ∈ c y → v ∈ c y + := fun y hy {u v} h hu => by + induction h with + | refl => exact hu + | tail _ h2 ih => exact hadjc y hy _ _ h2 ih + have hadjW : ∀ u v, GrownAdj V 𝓛 u v → Nonempty (GraphWalk H.toGraph u v) := fun u v ⟨A, hA, hc⟩ + => by + have hu : u ∈ V := (hc ▸ (Or.inl rfl) : u ∈ A ∩ V).2 + have hv : v ∈ V := (hc ▸ (Or.inr rfl) : v ∈ A ∩ V).2 + have hu' : u ∈ H.V := hHV ▸ hu + have hv' : v ∈ H.V := hHV ▸ hv + have hE : A \ {ea A, eb A} ∈ H.E := hHE ▸ ⟨A, hA, rfl⟩ + have hlink : H.toGraph.IsLink (A \ {ea A, eb A}) u v := + ⟨hE, hu', hv', by rw [hAclo A hA, hHV]; exact hc⟩ + exact ⟨.cons hlink (.nil hv')⟩ + have hreachW : ∀ {u v}, Relation.ReflTransGen (GrownAdj V 𝓛) u v → u ∈ V → Nonempty + (GraphWalk H.toGraph u v) := fun {u v} h hu => by + induction h with + | refl => + have hu' : u ∈ H.V := hHV ▸ hu + exact ⟨.nil hu'⟩ + | tail _ h2 ih => + obtain ⟨W⟩ := ih + obtain ⟨W'⟩ := hadjW _ _ h2 + exact ⟨W.append W'⟩ + have hRuniq : ∀ r ∈ R, ∀ r' ∈ R, c r = c r' → r = r' := by + rintro _ ⟨D, hD, rfl⟩ _ ⟨D', hD', rfl⟩ e + rw [hrepc D hD, hrepc D' hD'] at e + rw [e] + have hRY' : ∀ r ∈ R, r ∈ Y := fun r hr => hRY hr + have hG₁H : MatchingStrictlySurroundsForest G₁ H := by + refine hall H hHYeq (fun u hu v hv huv => ?_) (fun e he u hu y hy huc huy => ?_) + (fun y hy z hz hzb => ?_) + · obtain ⟨r, hr, h1⟩ := hreach u (hYV hu) + obtain ⟨r', hr', h2⟩ := hreach v (hYV hv) + have h3 : r ∈ c u := hreachc u hu h1 (hyc u hu) + have h4 : r' ∈ c v := hreachc v hv h2 (hyc v hv) + have h5 : c r = c r' := (hsame (hRY' r hr) hu (hyc r (hRY' r hr)) h3).trans + (huv.trans (hsame (hRY' r' hr') hv (hyc r' (hRY' r' hr')) h4).symm) + have h6 := hRuniq r hr r' hr' h5 + rw [← h6] at h2 + obtain ⟨W₁⟩ := hreachW h1 (hYV hu) + obtain ⟨W₂⟩ := hreachW h2 (hYV hv) + exact ⟨W₁.append W₂.reverse⟩ + · rw [hHE] at he + obtain ⟨A, hA, rfl⟩ := he + simp only [id] at huc ⊢ + rw [hAclo A hA] at huc ⊢ + exact hAdisc A hA y hy u huc huy + · rcases hUsub hz with h1 | h1 + · exact h1 + · exfalso + obtain ⟨y', hy', h2⟩ := mem_iUnion₂.mp h1 + have h3 := hsame hy hy' (GM11.discBd_subset _ hzb) h2.1 + exact h2.2 (h3 ▸ hzb) + have hhom : ForestsHomotopic H₀ H := theorem_3_4_claim_2 hS ⟨hH, rfl⟩ ⟨hHf, hHYeq⟩ hG₀ hG₁H + refine ⟨H, hHf, ⟨Homeomorph.refl S, fun _ _ => rfl, by rw [mapDrawingHomeo_refl]; exact hhom⟩, ?_⟩ + rw [inter_comm, hUeq] + exact hgrow.finZ + +/-- Graph Minors VII, (3.5) (page 221), as the statement used in Sections 3, 7, and 9. -/ +theorem forestMatchingFiniteIntersection.{u} : ForestMatchingFiniteIntersectionStatement.{u} := by + intro S _ hS G H₀ hG hH + obtain ⟨S₀, tS₀, ⟨β⟩⟩ := exists_homeo_type_zero hS + have hS₀ : IsSurface S₀ := isSurface_of_homeo β hS + obtain ⟨H', hH'_forest, hH'_homo, hH'_fin⟩ := + exists_finite_forest hS₀ (hG.map_homeo β) (IsSurfaceForest.map_homeo β hH) + refine ⟨mapDrawingHomeo β.symm H', IsSurfaceForest.map_homeo β.symm hH'_forest, + hH'_homo.conj_homeo β, ?_⟩ + have hinter : G.U ∩ (mapDrawingHomeo β.symm H').U = + β.symm '' ((mapDrawingHomeo β G).U ∩ H'.U) := by + rw [image_inter β.symm.injective] + change G.U ∩ β.symm '' H'.U = β.symm '' (β '' G.U) ∩ β.symm '' H'.U + congr 1 + ext z + simp + rw [hinter] + exact hH'_fin.image β.symm + +section Section3Main + +universe u + +variable {S' : Type u} [TopologicalSpace S'] + +/-- Graph Minors VII, (3.4), Claim (1) (page 220): +"(1) *Every $Y$-forest is surrounded by some $X$-matching.*" -/ +theorem theorem_3_4_claim_1 + (hS : IsSurface S') {Y : Set S'} (hY : Y ⊆ bd S') (hYfin : Y.Finite) : + ∃ X : Set S', X ⊆ bd S' ∧ X.Finite ∧ X.ncard = 2 * Y.ncard ∧ + ∀ H : Drawing S', IsYForest Y H → + ∃ G : Drawing S', IsXMatching X G ∧ MatchingStrictlySurroundsForest G H := + forestSurroundingMatching S' hS hY hYfin + +/-- Graph Minors VII, (3.4) (page 220): +"(3.4) *For any surface $\Sigma$ and finite $Y \subseteq bd(\Sigma)$, there are only finitely many +homoplasty classes of $Y$-forests.*" -/ +theorem theorem_3_4_proof + (hS : IsSurface S') {Y : Set S'} (hY : Y ⊆ bd S') (hYfin : Y.Finite) : + ∃ 𝓗 : Set (Drawing S'), 𝓗.Finite ∧ + (∀ H₀ ∈ 𝓗, IsYForest Y H₀) ∧ + ∀ H : Drawing S', IsYForest Y H → ∃ H₀ ∈ 𝓗, ForestsHomoplastic H₀ H := by + obtain ⟨X, hX_bd, hX_fin, _, hX_surr⟩ := theorem_3_4_claim_1 hS hY hYfin + obtain ⟨𝓜, h𝓜_fin, h𝓜_match, h𝓜_cov⟩ := theorem_3_3_proof hS hX_bd hX_fin + let good (G₀ : Drawing S') : Prop := + ∃ H₀ : Drawing S', IsYForest Y H₀ ∧ + ∃ G : Drawing S', IsXMatching X G ∧ MatchingStrictlySurroundsForest G H₀ ∧ + AreCongruentMatchings G₀ G + set 𝓜' : Set (Drawing S') := {G₀ ∈ 𝓜 | good G₀} + have h𝓜'_fin : 𝓜'.Finite := h𝓜_fin.subset (sep_subset 𝓜 good) + have h_rep : ∀ G₀ ∈ 𝓜', ∃ H₀ : Drawing S', IsYForest Y H₀ ∧ + ∃ G : Drawing S', IsXMatching X G ∧ MatchingStrictlySurroundsForest G H₀ ∧ + AreCongruentMatchings G₀ G := fun _ h => h.2 + choose! rep hrep_Y hrep_G using h_rep + refine ⟨rep '' 𝓜', h𝓜'_fin.image rep, ?_, ?_⟩ + · rintro _ ⟨G₀, hG₀, rfl⟩ + exact hrep_Y G₀ hG₀ + · intro H hH + obtain ⟨G, hG_match, hG_surr⟩ := hX_surr H hH + obtain ⟨G₀, hG₀_mem, hG₀_congr⟩ := h𝓜_cov G hG_match + have hG₀_good : G₀ ∈ 𝓜' := ⟨hG₀_mem, ⟨H, hH, G, hG_match, hG_surr, hG₀_congr⟩⟩ + obtain ⟨G_rep, _, hG_rep_surr, ⟨α₁, hα₁_U, hα₁_bd⟩⟩ := hrep_G G₀ hG₀_good + rcases hG₀_congr with ⟨α₂, hα₂_U, hα₂_bd⟩ + have hcongr : AreCongruentMatchings G_rep G := by + refine ⟨α₁.symm.trans α₂, ?_, fun x hx => ?_⟩ + · calc + (α₁.symm.trans α₂) '' G_rep.U = α₂ '' (α₁.symm '' (α₁ '' G₀.U)) := by + rw [← hα₁_U]; ext y; simp [Homeomorph.trans_apply] + _ = α₂ '' G₀.U := by congr 1; exact α₁.symm_image_image G₀.U + _ = G.U := hα₂_U + · have hx1 : α₁.symm x = x := (α₁.symm_apply_eq).mpr (hα₁_bd x hx).symm + simp [Homeomorph.trans_apply, hx1, hα₂_bd x hx] + exact ⟨rep G₀, mem_image_of_mem rep hG₀_good, + theorem_3_4_claim_3 hS hY (hrep_Y G₀ hG₀_good) hH hG_rep_surr hG_surr hcongr⟩ + +/-- Graph Minors VII, (3.5) (page 221): +"(3.5) *For every matching $G$ in $\Sigma$ and every homoplasty class $\mathscr{B}$ there exists +$H \in \mathscr{B}$ with $U(G) \cap U(H)$ finite.*" -/ +theorem theorem_3_5_proof + (hS : IsSurface S') (G H₀ : Drawing S') (hG : IsMatching G) (hH₀ : IsSurfaceForest H₀) : + ∃ H : Drawing S', IsSurfaceForest H ∧ ForestsHomoplastic H₀ H ∧ (G.U ∩ H.U).Finite := + forestMatchingFiniteIntersection S' hS G H₀ hG hH₀ + +/-- Theorem (3.6) for a fixed pair of finite subsets `X, Y ⊆ bd S'`. -/ +theorem theorem_3_6_fixed_XY + (hS : IsSurface S') {X Y : Set S'} (hX : X ⊆ bd S') (hXfin : X.Finite) + (hY : Y ⊆ bd S') (hYfin : Y.Finite) : + ∃ w : ℕ, ∀ (G H : Drawing S'), IsXMatching X G → IsYForest Y H → + ∃ H' : Drawing S', IsSurfaceForest H' ∧ ForestsHomoplastic H H' ∧ + (G.U ∩ H'.U).Finite ∧ (G.U ∩ H'.U).ncard ≤ w := by + classical + obtain ⟨𝓜, h𝓜_fin, h𝓜_match, h𝓜_cov⟩ := theorem_3_3_proof hS hX hXfin + obtain ⟨𝓗, h𝓗_fin, h𝓗_forest, h𝓗_cov⟩ := theorem_3_4_proof hS hY hYfin + have h_pair : ∀ (G₀ : Drawing S'), G₀ ∈ 𝓜 → ∀ (H₀ : Drawing S'), H₀ ∈ 𝓗 → + ∃ H₁ : Drawing S', IsSurfaceForest H₁ ∧ ForestsHomoplastic H₀ H₁ ∧ + (G₀.U ∩ H₁.U).Finite := + fun G₀ hG₀ H₀ hH₀ => theorem_3_5_proof hS G₀ H₀ (h𝓜_match G₀ hG₀).1 (h𝓗_forest H₀ hH₀).1 + choose! repH hrep_forest hrep_homo hrep_fin using h_pair + let pairBound (p : Drawing S' × Drawing S') : ℕ := (p.1.U ∩ (repH p.1 p.2).U).ncard + let B : Set ℕ := pairBound '' (𝓜 ×ˢ 𝓗) + have hB_fin : B.Finite := (h𝓜_fin.prod h𝓗_fin).image pairBound + let w : ℕ := hB_fin.toFinset.sup id + refine ⟨w, fun G H hG hH => ?_⟩ + obtain ⟨G₀, hG₀_mem, ⟨α, hα_U, hα_bd⟩⟩ := h𝓜_cov G hG + obtain ⟨H₀, hH₀_mem, hH₀_homo⟩ := h𝓗_cov H hH + let H₁ := repH G₀ H₀ + have hH₁_forest : IsSurfaceForest H₁ := hrep_forest G₀ hG₀_mem H₀ hH₀_mem + have hH₁_homo : ForestsHomoplastic H₀ H₁ := hrep_homo G₀ hG₀_mem H₀ hH₀_mem + have hH₁_fin : (G₀.U ∩ H₁.U).Finite := hrep_fin G₀ hG₀_mem H₀ hH₀_mem + have hH₁_le : (G₀.U ∩ H₁.U).ncard ≤ w := by + have h_mem : pairBound (G₀, H₀) ∈ hB_fin.toFinset := + hB_fin.mem_toFinset.mpr ⟨(G₀, H₀), ⟨hG₀_mem, hH₀_mem⟩, rfl⟩ + exact Finset.le_sup (f := id) h_mem + let H' := mapDrawingHomeo α H₁ + have h_inter : G.U ∩ H'.U = α '' (G₀.U ∩ H₁.U) := by + rw [← hα_U] + exact (image_inter α.injective).symm + refine ⟨H', IsSurfaceForest.map_homeo α hH₁_forest, + hH₀_homo.symm.trans (hH₁_homo.map_right α hα_bd), + h_inter ▸ hH₁_fin.image α, ?_⟩ + rw [h_inter, ncard_image_of_injective _ α.injective] + exact hH₁_le + +/-- Existence of a bound `w` satisfying `IsW36Bound S' k n w`. -/ +theorem exists_isW36Bound + (hS : IsSurface S') (k n : ℕ) : + ∃ w : ℕ, IsW36Bound S' k n w := by + classical + obtain ⟨Z_canon, hZ_bd, hZ_fin, hZ_move⟩ := exists_canon_bd_homeo hS (2 * n + k) + let P := 𝒫 Z_canon ×ˢ 𝒫 Z_canon + have hP_fin : P.Finite := hZ_fin.powerset.prod hZ_fin.powerset + have h_sub : ∀ p ∈ P, ∃ w_p : ℕ, + ∀ (G H : Drawing S'), IsXMatching p.1 G → IsYForest p.2 H → + ∃ H' : Drawing S', IsSurfaceForest H' ∧ ForestsHomoplastic H H' ∧ + (G.U ∩ H'.U).Finite ∧ (G.U ∩ H'.U).ncard ≤ w_p := by + rintro ⟨X₀, Y₀⟩ ⟨hX₀, hY₀⟩ + exact theorem_3_6_fixed_XY hS + (hX₀.trans hZ_bd) (hZ_fin.subset hX₀) + (hY₀.trans hZ_bd) (hZ_fin.subset hY₀) + choose! w_sub hw_sub using h_sub + let B : Set ℕ := w_sub '' P + have hB_fin : B.Finite := hP_fin.image w_sub + let w : ℕ := hB_fin.toFinset.sup id + refine ⟨w, fun G H hG hGcard hH hHcard => ?_⟩ + let X := G.V + let Y := H.V ∩ bd S' + have hX : X ⊆ bd S' := hG.2.1 + have hY : Y ⊆ bd S' := inter_subset_right + have hX_fin : X.Finite := G.finite_V + have hY_fin : Y.Finite := H.finite_V.subset inter_subset_left + have hXY_bd : X ∪ Y ⊆ bd S' := union_subset hX hY + have hXY_fin : (X ∪ Y).Finite := hX_fin.union hY_fin + have hXY_card : (X ∪ Y).ncard ≤ 2 * n + k := + (ncard_union_le X Y).trans (add_le_add hGcard hHcard) + obtain ⟨β, hβ_XY⟩ := hZ_move (X ∪ Y) hXY_bd hXY_fin hXY_card + let X₀ := β '' X + let Y₀ := β '' Y + have hX₀_Z : X₀ ⊆ Z_canon := (image_mono subset_union_left).trans hβ_XY + have hY₀_Z : Y₀ ⊆ Z_canon := (image_mono subset_union_right).trans hβ_XY + have hp_mem : (X₀, Y₀) ∈ P := ⟨hX₀_Z, hY₀_Z⟩ + have hGX : IsXMatching X G := ⟨hG, rfl⟩ + have hHY : IsYForest Y H := ⟨hH, rfl⟩ + obtain ⟨H₁', hH₁'_forest, hH₁'_homo, hH₁'_fin, hH₁'_le⟩ := + hw_sub (X₀, Y₀) hp_mem (mapDrawingHomeo β G) (mapDrawingHomeo β H) + (hGX.map_homeo β) (hHY.map_homeo β) + let H' := mapDrawingHomeo β.symm H₁' + have h_inter : G.U ∩ H'.U = β.symm '' ((mapDrawingHomeo β G).U ∩ H₁'.U) := by + rw [image_inter β.symm.injective] + change G.U ∩ β.symm '' H₁'.U = β.symm '' (β '' G.U) ∩ β.symm '' H₁'.U + congr 1 + ext z + simp + have hw_le : w_sub (X₀, Y₀) ≤ w := by + have h_in : w_sub (X₀, Y₀) ∈ hB_fin.toFinset := + hB_fin.mem_toFinset.mpr ⟨(X₀, Y₀), hp_mem, rfl⟩ + exact Finset.le_sup (f := id) h_in + refine ⟨H', IsSurfaceForest.map_homeo β.symm hH₁'_forest, + hH₁'_homo.conj_homeo β, + h_inter ▸ hH₁'_fin.image β.symm, ?_⟩ + rw [h_inter, ncard_image_of_injective _ β.symm.injective] + exact hH₁'_le.trans hw_le + +/-- Graph Minors VII, (3.6) (page 221): +"(3.6) *For every surface $\Sigma$ and all integers $k, n \ge 0$ there is an integer +$w(\Sigma, k, n)$ such that for every matching $G$ in $\Sigma$ with $|V(G)| \le 2n$ and every +forest $H$ in $\Sigma$ with $|V(H) \cap bd(\Sigma)| \le k$, there is a forest $H'$ homoplastic to +$H$ with $|U(G) \cap U(H')| \le w(\Sigma, k, n)$.*" -/ +theorem theorem_3_6_proof + (hS : IsSurface S') (k n : ℕ) : + IsW36Bound S' k n (wSurface S' k n) := by + have hne : {w : ℕ | IsW36Bound S' k n w}.Nonempty := exists_isW36Bound hS k n + exact Nat.sInf_mem hne + +end Section3Main + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section4.lean b/LeanPool/GraphMinor/GM07/Section4.lean new file mode 100644 index 0000000000..a8ec97bc65 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section4.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section2 +public import LeanPool.GraphMinor.GM07.Section3 +public import LeanPool.GraphMinor.GM07.Section35 +public import LeanPool.GraphMinor.GM07.Section41 +public import LeanPool.GraphMinor.GM07.Bridge +import LeanPool.GraphMinor.GM06.DualExists +import LeanPool.GraphMinor.Surface.OpenDisc + +/-! +# Graph Minors VII, Section 4: The Main Result, First Version + +This file formalizes Section 4 (pages 221–230) of N. Robertson and P. D. Seymour, +*Graph Minors. VII. Disjoint paths on a surface*, J. Combin. Theory Ser. B 45 (1988) 212–254: +- `(4.1)` (`theorem_4_1`): characterization of `G`-feasibility of a forest `H` in a closed disc `Δ` + (Theorem (3.6) of Graph Minors VI, `GM06.Statement36`, stated in the language of `G`-normal + proper `I`-arcs); +- `(4.2)` (`theorem_4_2`): an open connected subset `Y` of a connected boundaryless surface `Σ` in + which every `O`-arc bounds a closed disc is either `Σ` (when `Σ` is a sphere) or an open disc + (proved unconditionally from `Surface.open_disc`); +- `(4.3)` (`theorem_4_3`, in `Section43.lean`): existence of `v + 1` internally vertex-disjoint + paths from a cuff `C` to + `bd(Σ) - C` when every short boundary-disjoint `G`-normal `O`-arc is null-homotopic; +- `(4.4)` (`theorem_4_4`, in `Section44.lean`): moving a forest `H₀` by a homotopy off a forest `L` + when + cutting along `U(L)`; +- `(4.5)` (`theorem_4_5`): pullback and pushforward of forests and homoplasties across the + surjection `φ : Σ' → Σ` obtained by cutting along `U(J)`; +- `vSurface_le_vModel`: unconditional bound `vSurface S k ≤ vModel a b c k` + when `Nonempty (S ≃ₜ SurfaceModel a b c)`; +- `(4.6)`: first version of the main feasibility theorem on a connected surface with at least two + cuffs. It is `theorem_4_6` in `GM07/Section46Final.lean`, because its proof needs much of this + file. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- Graph Minors VII, (4.1) (page 221; Theorem (3.6) of Graph Minors VI, `GM06.Statement36`): +"(4.1) *Let $G$ be a proper graph in a closed disc $\Delta$ and let $H$ be a forest in $\Delta$ +with $V(H) \cap bd(\Delta) = V(G) \cap bd(\Delta)$. Then $H$ is $G$-feasible if and only if for +every $G$-normal proper $I$-arc $F$ with ends $s, t$ say, $|V(G) \cap (F - \{s, t\})| \ge |\Lambda|$ +where $C_1, C_2$ are the two components of $bd(\Delta) - \{s, t\}$, and $\Lambda$ is the set of +vertex sets of the components of $H$ which intersect both $C_1$ and $C_2$, and contain neither $s$ +nor $t$.*" -/ +theorem theorem_4_1_proof + [T1Space S] (hS : IsSurface S) (hDisc : IsClosedDisc (univ : Set S)) + (G H : Drawing S) (hG : G.IsProper) (hH : IsSurfaceForest H) + (hbd : H.V ∩ bd S = G.V ∩ bd S) : + IsGFeasible G H ↔ + ∀ (F : Set S) (s t : S) (C₁ C₂ : Set S), + G.IsNormal F → IsProperIArc F → IsLineWithEnds F s t → + componentsIn (bd S \ {s, t}) = {C₁, C₂} → C₁ ≠ C₂ → + {V₀ : Set S | ∃ H' : Drawing S, + GM06.IsGraphComponent H'.toGraph H.toGraph ∧ V₀ = H'.V ∧ + (V₀ ∩ C₁).Nonempty ∧ (V₀ ∩ C₂).Nonempty ∧ s ∉ V₀ ∧ t ∉ V₀}.ncard ≤ + (G.V ∩ (F \ {s, t})).ncard := + discFeasibilityArcTranslation S hS hDisc G H hG hH hbd + +/-- Graph Minors VII, (4.2) (page 222): +"(4.2) *Let $\Sigma$ be a connected surface with $bd(\Sigma) = \emptyset$, and let +$Y \subseteq \Sigma$ be connected and open. Suppose that every $O$-arc included in $Y$ bounds a +disc included in $Y$. Then either $\Sigma$ is a sphere and $Y = \Sigma$, or $Y$ is an open disc.*" +Proved unconditionally from `Surface.open_disc` and `isClosedSurface_of_bd_eq_empty`. -/ +theorem theorem_4_2_proof (hS : IsSurface S) [hConn : ConnectedSpace S] (hbd : bd S = ∅) + (Y : Set S) (hY_conn : IsConnected Y) (hY_open : IsOpen Y) + (hY_oarc : ∀ F : Set S, IsOArc F → F ⊆ Y → + ∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F ∧ Δ ⊆ Y) : + (IsSphere S ∧ Y = univ) ∨ IsOpenDisc Y := by + have hS_closed : IsClosedSurface S := isClosedSurface_of_bd_eq_empty hS hbd + refine Surface.open_disc S Y hS_closed hConn hY_conn hY_open fun F hFY hF => ?_ + obtain ⟨Δ, hΔ, hbdΔ, hΔY⟩ := hY_oarc F hF hFY + exact ⟨Δ, hΔY, hΔ, hbdΔ⟩ + +/-- When `S ≃ₜ SurfaceModel a b c`, `vSurface S k ≤ vModel a b c k`. -/ +theorem vSurface_le_vModel {a b c : ℕ} + (he : Nonempty (S ≃ₜ SurfaceModel a b c)) (k : ℕ) : + vSurface S k ≤ vModel a b c k := + Nat.sInf_le ⟨a, b, c, he, rfl⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section41.lean b/LeanPool/GraphMinor/GM07/Section41.lean new file mode 100644 index 0000000000..743e172f3f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section41.lean @@ -0,0 +1,582 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.DiscChain +public import LeanPool.GraphMinor.GM07.Section3 +public import LeanPool.GraphMinor.GM12.Section3SubgraphDrawing +public import LeanPool.GraphMinor.GM19.Section13zc + +/-! +# Graph Minors VII, (4.1) + +(4.1) (page 221) is "Theorem (3.6) of [4], stated in different language". A division of the points +of `bd(Δ)` comes from the components of `H`. +We translate each side. + +Suppose first that `H` is feasible, and let `F` be a normal arc. Each component of `H` that `F` +separates gives a component of the forest in `G` +which crosses `F` (`disc_crossing`), and it does so at a vertex of `G`. Different components cross +at different vertices (`card_le_of_feasible`). + +Suppose next that all normal arcs satisfy the bound. A chain gives an arc (`exists_arc_of_chain`), +and the vertices of the chain pay for the +members of the division that meet the ends of the chain. So each chain has non-negative redundancy, +and (3.6) of VI gives a realization. It is a +forest in `G` with the same connections between points of `bd(Δ)` as `H`, and in a disc this is all +that homoplastic asks for (`isGFeasible_of_arcs`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM06 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +private theorem exists_isDualPointSet_u (C V : Set S) : ∃ U, IsDualPointSet C V U := by + classical + by_cases hV : V = ∅ + · exact ⟨∅, fun _ ↦ rfl, fun h ↦ absurd hV h.ne_empty⟩ + have hne : ∀ s ∈ segmentsOf C V, s.Nonempty := fun s hs ↦ by + obtain ⟨x, hx, rfl⟩ := hs.1 + exact ⟨x, mem_connectedComponentIn hx⟩ + have : Nonempty S := ⟨(nonempty_iff_ne_empty.mpr hV).some⟩ + choose! pt hpt using hne + have hsub : ∀ s ∈ segmentsOf C V, s ⊆ C \ V := fun s hs ↦ by + obtain ⟨x, hx, rfl⟩ := hs.1 + exact connectedComponentIn_subset _ _ + refine ⟨pt '' segmentsOf C V, fun h ↦ absurd h hV, fun _ ↦ ⟨?_, fun s hs ↦ ?_⟩⟩ + · rintro _ ⟨s, hs, rfl⟩ + exact hsub s hs (hpt s hs) + · have : pt '' segmentsOf C V ∩ s = {pt s} := by + ext z + constructor + · rintro ⟨⟨s', hs', rfl⟩, hz⟩ + obtain ⟨x, hx, rfl⟩ := hs.1 + obtain ⟨x', hx', rfl⟩ := hs'.1 + have e₁ := connectedComponentIn_eq hz + have e₂ := connectedComponentIn_eq (hpt _ hs') + rw [mem_singleton_iff, e₁.trans e₂.symm] + · rintro rfl + exact ⟨mem_image_of_mem _ hs, hpt s hs⟩ + rw [this, ncard_singleton] + +/-- Any two curves in a disc with the same ends are homotopic, along straight segments of the disc. +-/ +theorem curvesHomotopic_of_disc (hDS : IsClosedDiscSpace S) {φ₀ φ₁ : Curve S} (h0 : φ₀ 0 = φ₁ 0) + (h1 : φ₀ 1 = φ₁ 1) : CurvesHomotopic φ₀ φ₁ := by + obtain ⟨e⟩ := hDS + let a : unitInterval → EuclideanPlane := fun x => (e.symm (φ₀ x)).1 + let b : unitInterval → EuclideanPlane := fun x => (e.symm (φ₁ x)).1 + have ha : Continuous a := continuous_subtype_val.comp (e.symm.continuous.comp φ₀.continuous) + have hb : Continuous b := continuous_subtype_val.comp (e.symm.continuous.comp φ₁.continuous) + let f : unitInterval × unitInterval → EuclideanPlane := fun p => (1 - (p.2 : ℝ)) • a p.1 + + (p.2 : ℝ) • b p.1 + have hf : Continuous f := by + have h2 : Continuous fun p : unitInterval × unitInterval => (p.2 : ℝ) + := continuous_subtype_val.comp continuous_snd + exact ((continuous_const.sub h2).smul (ha.comp continuous_fst)).add (h2.smul + (hb.comp continuous_fst)) + have hmem : ∀ p, f p ∈ ClosedUnitDisc := fun p => + (convex_closedBall (0 : EuclideanPlane) 1) (e.symm (φ₀ p.1)).2 (e.symm (φ₁ p.1)).2 + (by linarith [p.2.2.2]) p.2.2.1 (by ring) + let g : unitInterval × unitInterval → ClosedUnitDisc := fun p => ⟨f p, hmem p⟩ + have hg : Continuous g := Continuous.subtype_mk hf _ + have hval : ∀ x (y : unitInterval), a x = b x → f (x, y) = a x := fun x y h => by + simp only [f, ← h] + rw [← add_smul] + simp + have hend : ∀ x (y : unitInterval), φ₀ x = φ₁ x → e (g (x, y)) = φ₀ x := fun x y h => by + have h2 : g (x, y) = e.symm (φ₀ x) := Subtype.ext (hval x y (by simp only [a, b, h])) + rw [h2, e.apply_symm_apply] + refine ⟨⟨fun p => e (g p), e.continuous.comp hg⟩, fun _ => mem_univ _, fun x => ?_, fun x + => ?_, fun y => hend 0 y h0, fun y => (hend 0 y h0).trans h0, fun y => hend 1 y h1, fun y => + (hend 1 y h1).trans h1⟩ + · have h2 : g (x, 0) = e.symm (φ₀ x) := Subtype.ext (by simp [g, f, a]) + change e (g (x, 0)) = _ + rw [h2, e.apply_symm_apply] + · have h2 : g (x, 1) = e.symm (φ₁ x) := Subtype.ext (by simp [g, f, b]) + change e (g (x, 1)) = _ + rw [h2, e.apply_symm_apply] + +theorem isConnected_line {F : Set S} {s t : S} (h : IsLineWithEnds F s t) : IsConnected F := by + obtain ⟨f, -, -⟩ := h + have hF : F = (fun x => (f x).1) '' univ := by + ext z + simp only [image_univ, mem_range] + exact ⟨fun hz => ⟨f.symm ⟨z, hz⟩, by simp⟩, fun ⟨x, hx⟩ => hx ▸ (f x).2⟩ + rw [hF] + exact isConnected_univ.image _ (continuous_subtype_val.comp f.continuous).continuousOn + +/-- The ends of a line do not depend on the choice of the parametrization, because only its ends +leave it connected. -/ +theorem line_end_mem {F : Set S} {s t u v : S} (h1 : IsLineWithEnds F s t) + (h2 : IsLineWithEnds F u v) : s ∈ ({u, v} : Set S) := by + by_contra hn + have hsu : s ≠ u := fun e => hn (.inl e) + have hsv : s ≠ v := fun e => hn (.inr e) + have hsF : s ∈ F := h1.left_mem + have hc := GM11.IsLineWithEnds.isPreconnected_sdiff h1 + obtain ⟨g, hg0, hg1⟩ := h2 + let B : Set F := {z | z.1 ≠ s} + have hBim : Subtype.val '' B = F \ {s} := by + ext z + simp only [mem_image, B, mem_ofPred_eq, Subtype.exists, exists_and_right, exists_eq_right, + mem_sdiff, mem_singleton_iff] + exact ⟨fun ⟨h3, h4⟩ => ⟨h3, h4⟩, fun ⟨h3, h4⟩ => ⟨h3, h4⟩⟩ + have hB : IsPreconnected B := IsInducing.subtypeVal.isPreconnected_image.mp (hBim ▸ hc) + have hA : IsPreconnected (g.symm '' B) := hB.image _ g.symm.continuous.continuousOn + have h0 : (0 : unitInterval) ∈ g.symm '' B := + ⟨g 0, by simpa only [B, mem_ofPred_eq, hg0] using hsu.symm, by simp⟩ + have h3 : (1 : unitInterval) ∈ g.symm '' B := + ⟨g 1, by simpa only [B, mem_ofPred_eq, hg1] using hsv.symm, by simp⟩ + have h4 : g.symm ⟨s, hsF⟩ ∈ Icc (0 : unitInterval) 1 := ⟨bot_le, le_top⟩ + obtain ⟨z, hz, e⟩ := hA.Icc_subset h0 h3 h4 + have : z = ⟨s, hsF⟩ := g.symm.injective e + exact hz (by rw [this]) + +omit [TopologicalSpace S] in +/-- A walk from a vertex of a component stays in the component. -/ +theorem IsGraphComponent.mem_of_walk {G C : Graph S (Set S)} (hC : IsGraphComponent C G) {u v : S} + (W : GraphWalk G u v) (hu : u ∈ V(C)) : v ∈ V(C) := by + induction W with + | nil _ => exact hu + | cons hl _ ih => exact ih ((hC.mem_iff_of_isLink hl).mp hu) + +theorem bd_inter_V_eq_of_homoplastic {H H' : Drawing S} (h : ForestsHomoplastic H H') : H.V ∩ bd S + = H'.V ∩ bd S := by + obtain ⟨α, hα, -, -, -, -, heqV, -⟩ := h + rw [← heqV] + ext z + constructor + · rintro ⟨h1, h2⟩ + exact ⟨⟨z, h1, hα z h2⟩, h2⟩ + · rintro ⟨⟨y, hy, rfl⟩, h2⟩ + have hb : α y ∈ bd S := h2 + have : y = α y := α.injective (hα _ hb).symm + rw [← this] + exact ⟨hy, this ▸ hb⟩ + +/-- Connections between points of `bd(Σ)` agree in homoplastic forests. -/ +theorem walk_iff_of_homoplastic {H H' : Drawing S} (h : ForestsHomoplastic H H') {p q : S} + (hp : p ∈ H.V) (hb : p ∈ bd S) (hq : q ∈ H.V) (hqb : q ∈ bd S) : + p ∈ H'.V ∧ (Nonempty (GraphWalk H.toGraph p q) ↔ Nonempty (GraphWalk H'.toGraph p q)) := by + classical + obtain ⟨α, hα, -, -, -, -, heqV, hrel⟩ := h + have hmem : ∀ z ∈ H.V, z ∈ bd S → z ∈ (mapDrawingHomeo α H).V ∩ bd S := fun z hz hzb + => ⟨⟨z, hz, hα z hzb⟩, hzb⟩ + have hp' := hmem p hp hb + have hq' := hmem q hq hqb + have hpH' : p ∈ H'.V := (heqV ▸ hp' : p ∈ H'.V ∩ bd S).1 + have hqH' : q ∈ H'.V := (heqV ▸ hq' : q ∈ H'.V ∩ bd S).1 + refine ⟨hpH', ?_⟩ + by_cases hne : p = q + · subst hne + exact ⟨fun _ => ⟨.nil hpH'⟩, fun _ => ⟨.nil hp⟩⟩ + have hsymm : ∀ {z}, z ∈ bd S → α.symm z = z := fun {z} hz => (α.symm_apply_eq).mpr (hα z hz).symm + constructor + · rintro ⟨W⟩ + have W₁ := mapWalkHomeo α W + rw [hα p hb, hα q hqb] at W₁ + obtain ⟨W₂, hs, -⟩ := GM11.GraphWalk.exists_isSimple W₁ + obtain ⟨P, -⟩ := ((hrel p hp' q hq' hne).1).mp ⟨W₂, hs⟩ + exact ⟨P⟩ + · rintro ⟨W⟩ + obtain ⟨W₂, hs, -⟩ := GM11.GraphWalk.exists_isSimple W + obtain ⟨P, -⟩ := ((hrel p hp' q hq' hne).1).mpr ⟨W₂, hs⟩ + have W₁ := mapWalkHomeo α.symm P + rw [mapDrawingHomeo_symm_mapDrawingHomeo, hsymm hb, hsymm hqb] at W₁ + exact ⟨W₁⟩ + +/-- The forward direction of (4.1): in a feasible forest, a component that `F` separates uses a +vertex of `F`, and different components use different +vertices. -/ +theorem card_le_of_feasible (hDS : IsClosedDiscSpace S) {G H : Drawing S} + (hF : IsGFeasible G H) {F : Set S} {s t : S} {C₁ C₂ : Set S} + (hN : G.IsNormal F) (hline : IsLineWithEnds F s t) (hsb : s ∈ bd S) (htb : t ∈ bd S) + (hst : s ≠ t) (hcomp : componentsIn (bd S \ {s, t}) = {C₁, C₂}) (hC : C₁ ≠ C₂) : + {V₀ : Set S | ∃ H' : Drawing S, IsGraphComponent H'.toGraph H.toGraph ∧ V₀ = H'.V ∧ + (V₀ ∩ C₁).Nonempty ∧ (V₀ ∩ C₂).Nonempty ∧ s ∉ V₀ ∧ t ∉ V₀}.ncard ≤ + (G.V ∩ (F \ {s, t})).ncard := by + classical + obtain ⟨H₂, hf2, hhom, hsub⟩ := hF + have hsplit : ∀ C ∈ componentsIn (bd S \ {s, t}), (∀ z ∈ C, z ∈ bd S ∧ z ≠ s ∧ z ≠ t + ∧ connectedComponentIn (bd S \ {s, t}) z = C) := by + rintro _ ⟨z₀, -, rfl⟩ z hz + have h1 := connectedComponentIn_subset _ _ hz + exact ⟨h1.1, fun e => h1.2 (.inl e), fun e => h1.2 (.inr e), (connectedComponentIn_eq hz).symm⟩ + have hC₁ : C₁ ∈ componentsIn (bd S \ {s, t}) := hcomp ▸ .inl rfl + have hC₂ : C₂ ∈ componentsIn (bd S \ {s, t}) := hcomp ▸ .inr rfl + have hpick : ∀ V₀ ∈ {V₀ : Set S | ∃ H' : Drawing S, IsGraphComponent H'.toGraph H.toGraph ∧ V₀ + = H'.V ∧ (V₀ ∩ C₁).Nonempty ∧ (V₀ ∩ C₂).Nonempty ∧ s ∉ V₀ ∧ t ∉ V₀}, + ∃ w ∈ G.V ∩ (F \ {s, t}), ∃ C : Graph S (Set S), IsGraphComponent C H₂.toGraph ∧ w ∈ V(C) + ∧ ∃ p ∈ V₀, p ∈ bd S ∧ p ∈ V(C) := by + rintro _ ⟨H₀, hH₀, rfl, ⟨p, hp, hpC⟩, ⟨q, hq, hqC⟩, hsV, htV⟩ + obtain ⟨hpb, hps, hpt, hpe⟩ := hsplit C₁ hC₁ p hpC + obtain ⟨hqb, hqs, hqt, hqe⟩ := hsplit C₂ hC₂ q hqC + have hpH : p ∈ H.V := hH₀.1.vertexSet_mono hp + have hqH : q ∈ H.V := hH₀.1.vertexSet_mono hq + obtain ⟨hpH₂, hiff⟩ := walk_iff_of_homoplastic hhom hpH hpb hqH hqb + obtain ⟨W₀⟩ := hH₀.2.1.2 p hp q hq + obtain ⟨W₂⟩ := hiff.mp ⟨W₀.mono hH₀.1⟩ + have hcc : IsGraphComponent (compOf H₂.toGraph p) H₂.toGraph := isGraphComponent_compOf hpH₂ + have hpc : p ∈ V(compOf H₂.toGraph p) := by + change p ∈ reachSet H₂.toGraph p + exact self_mem_reachSet hpH₂ + have hqc : q ∈ V(compOf H₂.toGraph p) := IsGraphComponent.mem_of_walk hcc W₂ hpc + obtain ⟨W₃⟩ := hcc.2.1.2 p hpc q hqc + obtain ⟨K, hKc, hKcon, hpK, hqK, hKsub, hKU, hKV⟩ := exists_compact_connected_of_walk H₂ hcc.1 + W₃ + have hcross : CrossesOn (bd S) s t p q := ⟨hsb, hpb, htb, hqb, hst, ?_, hps.symm, hqs.symm, + hpt.symm, hqt.symm, ?_⟩ + · obtain ⟨w, hwF, hwK⟩ := discCrossing_of_isClosedDiscSpace hDS hline.isCompact hKc + (isConnected_line hline) hKcon hline.left_mem hline.right_mem hpK hqK hcross + have hwU : w ∈ G.U := hsub.U_subset (hKU hwK) + have hwV : w ∈ G.V := hN ⟨hwF, hwU⟩ + have hwC : w ∈ V(compOf H₂.toGraph p) := by + rcases hKsub hwK with h | h + · exact h + · simp only [mem_iUnion, exists_prop] at h + obtain ⟨e, he, hwe⟩ := h + exact ((hsub.2 (hcc.1.edgeSet_mono he)).2.1 hwe).2 hwV |>.elim + have hnot : ∀ z ∈ bd S, z ∉ H₀.V → w = z → False := fun z hzb hzV e => by + subst e + have hzH : w ∈ H₂.V := hcc.1.vertexSet_mono hwC + have hzH₁ : w ∈ H.V := (bd_inter_V_eq_of_homoplastic hhom ▸ (⟨hzH, hzb⟩ : w ∈ H₂.V ∩ bd S) + : w ∈ H.V ∩ bd S).1 + obtain ⟨W₄⟩ := hcc.2.1.2 p hpc w hwC + obtain ⟨-, hiff'⟩ := walk_iff_of_homoplastic hhom hpH hpb hzH₁ hzb + obtain ⟨W₅⟩ := hiff'.mpr ⟨W₄.mono hcc.1⟩ + exact hzV (IsGraphComponent.mem_of_walk hH₀ W₅ hp) + refine ⟨w, ⟨hwV, hwF, ?_⟩, _, hcc, hwC, p, hp, hpb, hpc⟩ + rintro (e | e) + · exact hnot s hsb hsV e + · exact hnot t htb htV e + · exact fun e => hC (by rw [← hpe, ← hqe, e]) + · exact fun e => hC (by rw [← hpe, ← hqe, e]) + have hNS : Nonempty S := ⟨s⟩ + choose! f hfT C hCc hfC p hpV hpb hpC using hpick + refine ncard_le_ncard_of_injOn f hfT ?_ (G.finite_V.subset fun z hz => hz.1) + rintro V₀ hV₀ V₁ hV₁ e + have hsame : C V₀ = C V₁ := (hCc V₀ hV₀).eq_of_mem_mem (hCc V₁ hV₁) (hfC V₀ hV₀) (e ▸ hfC V₁ hV₁) + obtain ⟨H₀, hH₀, rfl, -⟩ := id hV₀ + obtain ⟨H₁, hH₁, rfl, -⟩ := id hV₁ + have hp0 := hpV _ hV₀ + have hp1 := hpV _ hV₁ + have hpH₀ : p H₀.V ∈ H.V := hH₀.1.vertexSet_mono hp0 + have hpH₁ : p H₁.V ∈ H.V := hH₁.1.vertexSet_mono hp1 + obtain ⟨W⟩ := (hCc _ hV₀).2.1.2 _ (hpC _ hV₀) _ (hsame ▸ hpC _ hV₁) + obtain ⟨-, hiff⟩ := walk_iff_of_homoplastic hhom hpH₀ (hpb _ hV₀) hpH₁ (hpb _ hV₁) + obtain ⟨W₂⟩ := hiff.mpr ⟨W.mono (hCc _ hV₀).1⟩ + have h1 : p H₁.V ∈ V(H₀.toGraph) := IsGraphComponent.mem_of_walk hH₀ W₂ hp0 + have h2 := hH₀.eq_of_mem_mem hH₁ h1 hp1 + exact congrArg (fun g : Graph S (Set S) => V(g)) h2 + +private theorem nonnegative_chain_redundancy_for_component_division + {S : Type u} + [TopologicalSpace S] + (hD : IsClosedDisc (univ : Set S)) + {G : Drawing S} + {H : Drawing S} + (hG : G.IsProper) + (hbd : H.V ∩ bd S = G.V ∩ bd S) + (harc : ∀ (F : Set S) (s t : S) (C₁ C₂ : Set S), G.IsNormal F → IsProperIArc F → + IsLineWithEnds F s t → componentsIn (bd S \ {s, t}) = {C₁, C₂} → C₁ ≠ C₂ + → {V₀ | ∃ H' : Drawing S, + IsGraphComponent H'.toGraph H.toGraph ∧ V₀ = H'.V ∧ (V₀ ∩ C₁).Nonempty ∧ (V₀ ∩ C₂).Nonempty + ∧ s ∉ V₀ ∧ t ∉ V₀}.ncard ≤ (G.V ∩ (F \ {s, t})).ncard) + [T2Space S] + (hDS : IsClosedDiscSpace S) : + let Y : Set S := H.V ∩ bd S + (Y.Finite) → + let C : S → Graph S (Set S) := compOf H.toGraph + (∀ y ∈ H.V, IsGraphComponent (C y) H.toGraph) → + (∀ y ∈ H.V, y ∈ V(C y)) → + (∀ (y z : S), z ∈ V(C y) → z ∈ H.V) → + let cls : S → Set S := fun y => V(C y) ∩ bd S + let Δ : Set (Set S) := cls '' Y + (∀ y ∈ H.V, ∀ z ∈ V(C y), C z = C y) → + (IsDivision Δ) → + ∀ (U : Set S), + (∀ z ∈ U ∪ divisionUnion Δ, z ∈ bd S) → + ∀ x ∈ U ∪ divisionUnion Δ, ∀ y ∈ U ∪ divisionUnion Δ, ∀ (A : List (ChainTerm S)), IsXYChain G + x y A → 0 ≤ chainRedundancy G Δ x y A := by + intro Y hYf C hCc hself hCV cls Δ hCeq hDiv U hbdpt x hx y hy A hA + have hNS : Nonempty S := ⟨x⟩ + have hxb := hbdpt x hx + have hyb := hbdpt y hy + -- The ends of the chain that are vertices are terms of the chain. + have hmem1 : ∀ z ∈ ({x, y} : Set S), z ∈ Y → Sum.inl z ∈ A := by + have hhead : ∀ z ∈ Y, ∀ t : ChainTerm S, t ∈ A → t.MatchesEnd z → Sum.inl z ∈ A + := fun z hz t ht hm => by + have hzV : z ∈ G.V := (hbd ▸ hz : z ∈ G.V ∩ bd S).1 + rcases t with v | r + · obtain rfl : v = z := hm + exact ht + · have hr : r ∈ G.R := hA.valid _ ht + rcases hr with ⟨z₀, -, rfl⟩ + exact ((connectedComponentIn_subset _ _ hm).2 (G.V_subset_U hzV)).elim + rintro z (rfl | h) hz + · exact hhead z hz _ (List.head_mem hA.ne_nil) hA.head_matches + · obtain rfl : z = y := h + exact hhead z hz _ (List.getLast_mem hA.ne_nil) hA.last_matches + let D₁ : Set (Set S) := {δ ∈ Δ | (δ ∩ {x, y}).Nonempty} + let D₂ : Set (Set S) := {δ ∈ Δ | ¬ (δ ∩ {x, y}).Nonempty ∧ ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn + (bd S) u v x y} + have hD₁ : D₁.ncard ≤ (({x, y} : Set S) ∩ Y).ncard := by + have hsub : D₁ ⊆ cls '' (({x, y} : Set S) ∩ Y) := by + rintro _ ⟨⟨y₀, hy₀, rfl⟩, z, hz, hzxy⟩ + have hzY : z ∈ Y := ⟨hCV _ _ hz.1, hz.2⟩ + refine ⟨z, ⟨hzxy, hzY⟩, ?_⟩ + simp only [cls, hCeq y₀ hy₀.1 z hz.1] + have hfin : (({x, y} : Set S) ∩ Y).Finite := hYf.subset inter_subset_right + exact (ncard_le_ncard hsub (hfin.image _)).trans (ncard_image_le hfin) + -- The arc from the chain pays for `D₂`. + obtain ⟨T, hTA, hTd, hTc⟩ : ∃ T : Set S, (∀ w ∈ T, Sum.inl w ∈ A) ∧ Disjoint T {x, y} + ∧ D₂.ncard ≤ T.ncard := by + by_cases hne : x = y + · subst hne + refine ⟨∅, by simp, by simp, ?_⟩ + have : D₂ = ∅ := eq_empty_of_forall_notMem fun δ ⟨_, _, u, _, v, _, h⟩ => h.2.2.2.2.2.1 rfl + rw [this] + simp + have hbdO : IsOArc (bd S) := hDS.isOArc_bd + obtain ⟨C₁, C₂, hcomp, hCne⟩ := exists_two_comps hbdO hxb hyb hne + obtain ⟨F, hF, hFb, hFn, hFA⟩ := exists_arc_of_chain hD hG hA hxb hyb hne + have hbound := harc F x y C₁ C₂ hFn ⟨x, y, hne, hFb, hF⟩ hF hcomp hCne + refine ⟨G.V ∩ (F \ {x, y}), fun w hw => hFA w hw.2.1 hw.1 (fun e => hw.2.2 (.inl e)) (fun e + => hw.2.2 (.inr e)), disjoint_left.mpr fun w hw h => hw.2.2 h, le_trans ?_ hbound⟩ + -- Each member of `D₂` gives a component that `F` separates. + have hpick : ∀ δ ∈ D₂, ∃ y₀ ∈ Y, cls y₀ = δ := fun δ hδ => hδ.1 + choose! rep hrY hrc using hpick + refine ncard_le_ncard_of_injOn (fun δ => V(C (rep δ))) ?_ ?_ ?_ + · rintro δ hδ + obtain ⟨hδΔ, hnm, u, hu, v, hv, hcr⟩ := id hδ + obtain ⟨Dd, hsubd, hdV, hdg⟩ := GM12.exists_subdrawing_of_subgraph H (C (rep δ)) (hCc _ + (hrY δ hδ).1).1 + have hu' : u ∈ cls (rep δ) := (hrc δ hδ).symm ▸ hu + have hv' : v ∈ cls (rep δ) := (hrc δ hδ).symm ▸ hv + have hcr' := hcr.comm hbdO + have hmemb : ∀ z, z ∈ bd S → z ≠ x → z ≠ y → connectedComponentIn (bd S \ {x, y}) z ∈ + ({C₁, C₂} : Set (Set S)) ∧ z ∈ connectedComponentIn (bd S \ {x, y}) z := fun z h1 h2 h3 + => by + have hzm : z ∈ bd S \ {x, y} := ⟨h1, by simp [h2, h3]⟩ + exact ⟨hcomp ▸ ⟨z, hzm, rfl⟩, mem_connectedComponentIn hzm⟩ + obtain ⟨h1, h2⟩ := hmemb u hcr'.2.1 hcr'.2.2.2.2.2.2.1.symm hcr'.2.2.2.2.2.2.2.2.1.symm + obtain ⟨h3, h4⟩ := hmemb v hcr'.2.2.2.1 hcr'.2.2.2.2.2.2.2.1.symm + hcr'.2.2.2.2.2.2.2.2.2.1.symm + have hdiff := hcr'.2.2.2.2.2.2.2.2.2.2 + have hboth : (V(C (rep δ)) ∩ C₁).Nonempty ∧ (V(C (rep δ)) ∩ C₂).Nonempty := by + rcases h1 with h1 | h1 <;> rcases h3 with h3 | h3 + · exact (hdiff (h1.trans h3.symm)).elim + · exact ⟨⟨u, hu'.1, h1 ▸ h2⟩, ⟨v, hv'.1, h3 ▸ h4⟩⟩ + · exact ⟨⟨v, hv'.1, h3 ▸ h4⟩, ⟨u, hu'.1, h1 ▸ h2⟩⟩ + · exact (hdiff (h1.trans h3.symm)).elim + have hout : ∀ z ∈ ({x, y} : Set S), z ∈ bd S → z ∉ V(C (rep δ)) := fun z hz hzb hzV + => hnm ⟨z, (hrc δ hδ) ▸ ⟨hzV, hzb⟩, hz⟩ + refine ⟨Dd, ?_, hdV.symm, hboth.1, hboth.2, hout x (.inl rfl) hxb, hout y (.inr rfl) hyb⟩ + rw [hdg] + exact hCc _ (hrY δ hδ).1 + · rintro δ hδ δ' hδ' e + have h1 : C (rep δ) = C (rep δ') := by + have h2 := hself _ (hrY δ hδ).1 + have e' : V(C (rep δ)) = V(C (rep δ')) := e + have h3 : rep δ ∈ V(C (rep δ')) := e' ▸ h2 + exact (hCeq _ (hrY δ' hδ').1 _ h3) + rw [← hrc δ hδ, ← hrc δ' hδ'] + simp only [cls, h1] + · refine (H.finite_V.finite_subsets).subset ?_ + rintro _ ⟨H₀, hH₀, rfl, -⟩ + exact hH₀.1.vertexSet_mono + unfold chainRedundancy divisionCount + have hcover : {δ ∈ Δ | (δ ∩ {x, y}).Nonempty ∨ ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn + (bd S) u v x y} ⊆ D₁ ∪ D₂ := by + rintro δ ⟨hδ, h | h⟩ + · exact .inl ⟨hδ, h⟩ + · by_cases h2 : (δ ∩ {x, y}).Nonempty + · exact .inl ⟨hδ, h2⟩ + · exact .inr ⟨hδ, h2, h⟩ + have hfinΔ : Δ.Finite := hDiv.1 + have hfin₁ : D₁.Finite := hfinΔ.subset fun _ h => h.1 + have hfin₂ : D₂.Finite := hfinΔ.subset fun _ h => h.1 + have h1 := ncard_le_ncard hcover (hfin₁.union hfin₂) + have h2 := ncard_union_le D₁ D₂ + have hfinA := finite_inl_mem A + have hT : T.Finite := hfinA.subset hTA + have h3 : (({x, y} : Set S) ∩ Y).ncard + T.ncard ≤ {w : S | Sum.inl w ∈ A}.ncard := by + rw [← ncard_union_eq ?_ ((by simp : ({x, y} : Set S).Finite).subset inter_subset_left) hT] + · refine ncard_le_ncard (union_subset (fun z hz => hmem1 z hz.1 hz.2) hTA) hfinA + · exact (hTd.symm.mono_left inter_subset_left) + have h4 := ncard_inl_mem_le_chainLength A + omega + +/-- The backward direction of (4.1). The bound for each normal arc gives non-negative redundancy for +each chain, so VI (3.6) gives a realization, and +this realization is a forest in `G` homoplastic to `H`. -/ +theorem isGFeasible_of_arcs (hS : IsSurface S) (hD : IsClosedDisc (univ : Set S)) {G H : Drawing S} + (hG : G.IsProper) (hH : IsSurfaceForest H) (hbd : H.V ∩ bd S = G.V ∩ bd S) + (harc : ∀ (F : Set S) (s t : S) (C₁ C₂ : Set S), G.IsNormal F → IsProperIArc F + → IsLineWithEnds F s t → componentsIn (bd S \ {s, t}) = {C₁, C₂} → C₁ ≠ C₂ → + {V₀ : Set S | ∃ H' : Drawing S, IsGraphComponent H'.toGraph H.toGraph ∧ V₀ = H'.V ∧ + (V₀ ∩ C₁).Nonempty ∧ (V₀ ∩ C₂).Nonempty ∧ s ∉ V₀ ∧ t ∉ V₀}.ncard ≤ + (G.V ∩ (F \ {s, t})).ncard) : IsGFeasible G H := by + classical + have ht2 : T2Space S := hS.2.1 + have hDS := isClosedDiscSpace_of_univ hD + let Y : Set S := H.V ∩ bd S + have hYf : Y.Finite := H.finite_V.subset inter_subset_left + let C : S → Graph S (Set S) := compOf H.toGraph + have hCc : ∀ y ∈ H.V, IsGraphComponent (C y) H.toGraph := fun y hy => isGraphComponent_compOf hy + have hself : ∀ y ∈ H.V, y ∈ V(C y) := fun y hy => self_mem_reachSet hy + have hCV : ∀ y z, z ∈ V(C y) → z ∈ H.V := fun y z h => reachSet_subset _ _ h + let cls : S → Set S := fun y => V(C y) ∩ bd S + let Δ : Set (Set S) := cls '' Y + have hCeq : ∀ y ∈ H.V, ∀ z, z ∈ V(C y) → C z = C y := fun y hy z hz => (hCc z + (hCV y z hz)).eq_of_mem_mem (hCc y hy) (hself z (hCV y z hz)) hz + have hdisj : ∀ y ∈ H.V, ∀ y' ∈ H.V, C y ≠ C y' → Disjoint V(C y) V(C y') := fun y hy y' hy' h => + (hCc y hy).disjoint_vertexSet_of_ne (hCc y' hy') h + have hDiv : IsDivision Δ := by + refine ⟨hYf.image _, ?_, ?_⟩ + · rintro _ ⟨y, hy, rfl⟩ + exact ⟨y, hself y hy.1, hy.2⟩ + · rintro _ ⟨y, hy, rfl⟩ _ ⟨y', hy', rfl⟩ hne + have h1 : C y ≠ C y' := fun e => hne (by simp only [cls, e]) + exact (hdisj y hy.1 y' hy'.1 h1).mono inter_subset_left inter_subset_left + have hUnion : divisionUnion Δ = G.V ∩ bd S := by + rw [← hbd] + apply subset_antisymm + · rintro z ⟨_, ⟨y, hy, rfl⟩, hz⟩ + exact ⟨hCV y z hz.1, hz.2⟩ + · intro z hz + exact ⟨cls z, ⟨z, hz, rfl⟩, hself z hz.1, hz.2⟩ + obtain ⟨U, hU⟩ := exists_isDualPointSet_u (bd S) (divisionUnion Δ) + have hbdpt : ∀ z ∈ U ∪ divisionUnion Δ, z ∈ bd S := by + rintro z (hz | hz) + · by_cases h : divisionUnion Δ = ∅ + · rw [hU.1 h] at hz + exact hz.elim + · exact (hU.2 (nonempty_iff_ne_empty.mpr h)).1 hz |>.1 + · exact (hUnion ▸ hz : z ∈ G.V ∩ bd S).2 + have hcross : IsCrossFree (bd S) Δ := by + rintro ⟨_, ⟨y, hy, rfl⟩, _, ⟨y', hy', rfl⟩, hne, a, ha, c, hc, b, hb, d, hd, hcr⟩ + have h1 : C y ≠ C y' := fun e => hne (by simp only [cls, e]) + obtain ⟨W₁⟩ := (hCc y hy.1).2.1.2 a ha.1 c hc.1 + obtain ⟨W₂⟩ := (hCc y' hy'.1).2.1.2 b hb.1 d hd.1 + obtain ⟨K₁, h1c, h1k, ha1, hc1, h1s, h1U, -⟩ := exists_compact_connected_of_walk H + (hCc y hy.1).1 W₁ + obtain ⟨K₂, h2c, h2k, hb2, hd2, h2s, h2U, -⟩ := exists_compact_connected_of_walk H + (hCc y' hy'.1).1 W₂ + obtain ⟨z, hz1, hz2⟩ := discCrossing_of_isClosedDiscSpace hDS h1c h2c h1k h2k ha1 hc1 hb2 hd2 + hcr + have hE : ∀ {D : Graph S (Set S)} {e}, D ≤ H.toGraph → e ∈ E(D) → e ∈ H.E := fun hle he + => hle.edgeSet_mono he + rcases h1s hz1 with h3 | h3 <;> rcases h2s hz2 with h4 | h4 + · exact disjoint_left.mp (hdisj y hy.1 y' hy'.1 h1) h3 h4 + · simp only [mem_iUnion, exists_prop] at h4 + obtain ⟨e, he, hze⟩ := h4 + exact ((hE (hCc y' hy'.1).1 he).2.1 hze).2 (hCV _ _ h3) + · simp only [mem_iUnion, exists_prop] at h3 + obtain ⟨e, he, hze⟩ := h3 + exact ((hE (hCc y hy.1).1 he).2.1 hze).2 (hCV _ _ h4) + · simp only [mem_iUnion, exists_prop] at h3 h4 + obtain ⟨e, he, hze⟩ := h3 + obtain ⟨e', he', hze'⟩ := h4 + have heq : e = e' := H.edge_eq_of_mem (hE (hCc y hy.1).1 he) (hE + (hCc y' hy'.1).1 he') hze hze' + subst heq + exact disjoint_left.mp ((hCc y hy.1).disjoint_edgeSet_of_ne (hCc y' hy'.1) h1) he he' + have hchains : ∀ x ∈ U ∪ divisionUnion Δ, ∀ y ∈ U ∪ divisionUnion Δ, ∀ A : List + (ChainTerm S), IsXYChain G x y A → 0 ≤ chainRedundancy G Δ x y A := by + exact nonnegative_chain_redundancy_for_component_division (S := S) hD (G := G) (H := H) hG hbd + harc hDS hYf hCc hself hCV hCeq hDiv U hbdpt + obtain ⟨Hg, hR⟩ := (GM06.theorem_3_6_proof G Δ U hDS hG hDiv hUnion hU).mpr ⟨hcross, hchains⟩ + obtain ⟨-, hsubV, hle, hforest, Hc, hinj, hcompHc, -⟩ := hR + obtain ⟨K, hKs, hKV, hKg⟩ := GM12.exists_subdrawing_of_subgraph G Hg hle + have hYK : ∀ z ∈ Y, z ∈ K.V := fun z hz => by + rw [hKV] + exact (hcompHc (cls z) ⟨z, hz, rfl⟩).1.1.vertexSet_mono ((hcompHc (cls z) ⟨z, hz, + rfl⟩).2 ⟨hself z hz.1, hz.2⟩) + have hGY : ∀ z, z ∈ G.V ∩ bd S → z ∈ Y := fun z h => by + change z ∈ H.V ∩ bd S + rw [hbd] + exact h + have hKf : IsSurfaceForest K := by + refine ⟨fun z hz => ?_, hKg ▸ hforest⟩ + exact hYK z (hGY z ⟨hG ⟨hz.1, hKs.U_subset hz.2⟩, hz.1⟩) + have hVeq : H.V ∩ bd S = K.V ∩ bd S := by + apply subset_antisymm + · exact fun z hz => ⟨hYK z hz, hz.2⟩ + · exact fun z hz => hGY z ⟨hKs.1 hz.1, hz.2⟩ + have hwalks : ∀ s ∈ Y, ∀ t ∈ Y, (Nonempty (GraphWalk H.toGraph s t) ↔ Nonempty + (GraphWalk K.toGraph s t)) := by + intro s hs t ht + have hδs : cls s ∈ Δ := ⟨s, hs, rfl⟩ + have hδt : cls t ∈ Δ := ⟨t, ht, rfl⟩ + have hss : s ∈ cls s := ⟨hself s hs.1, hs.2⟩ + have htt : t ∈ cls t := ⟨hself t ht.1, ht.2⟩ + constructor + · rintro ⟨W⟩ + have ht' : t ∈ cls s := ⟨IsGraphComponent.mem_of_walk (hCc s hs.1) W (hself s hs.1), ht.2⟩ + have h1 := hcompHc (cls s) hδs + obtain ⟨W₁⟩ := h1.1.2.1.2 s (h1.2 hss) t (h1.2 ht') + have W₂ := W₁.mono h1.1.1 + rw [← hKg] at W₂ + exact ⟨W₂⟩ + · rintro ⟨W⟩ + have W₂ : GraphWalk Hg s t := hKg ▸ W + have h1 := hcompHc (cls s) hδs + have h2 := hcompHc (cls t) hδt + have ht1 : t ∈ V(Hc (cls s)) := IsGraphComponent.mem_of_walk h1.1 W₂ (h1.2 hss) + have h3 := hinj hδs hδt (h1.1.eq_of_mem_mem h2.1 ht1 (h2.2 htt)) + have ht2' : t ∈ cls s := h3 ▸ htt + obtain ⟨W₃⟩ := (hCc s hs.1).2.1.2 s (hself s hs.1) t ht2'.1 + exact ⟨W₃.mono (hCc s hs.1).1⟩ + refine ⟨K, hKf, ⟨Homeomorph.refl S, fun _ _ => rfl, ?_⟩, hKs⟩ + rw [mapDrawingHomeo_refl] + refine ⟨hH.1, hKf.1, hH.2, hKf.2, hVeq, fun s hs t ht hne => ⟨?_, + fun P₁ P₂ φ₁ φ₂ _ _ h₁ h₂ => ?_⟩⟩ + · constructor + · rintro ⟨P, -⟩ + obtain ⟨W⟩ := (hwalks s hs t ht).mp ⟨P⟩ + obtain ⟨W', hW, -⟩ := GM11.GraphWalk.exists_isSimple W + exact ⟨W', hW⟩ + · rintro ⟨P, -⟩ + obtain ⟨W⟩ := (hwalks s hs t ht).mpr ⟨P⟩ + obtain ⟨W', hW, -⟩ := GM11.GraphWalk.exists_isSimple W + exact ⟨W', hW⟩ + · have e1 := h₁.endpoints + have e2 := h₂.endpoints + exact curvesHomotopic_of_disc hDS (e1.1.trans e2.1.symm) (e1.2.trans e2.2.symm) + +/-- **Graph Minors VII, (4.1) (page 221).** This is Theorem (3.6) of Graph Minors VI, in the +language of normal arcs. -/ +theorem discFeasibilityArcTranslation : DiscFeasibilityArcTranslationStatement.{u} := by + intro S _ _ hS hD G H hG hH hbd + have hDS := isClosedDiscSpace_of_univ hD + have ht2 : T2Space S := hS.2.1 + refine ⟨fun hF F s t C₁ C₂ hN hI hL hc hne => ?_, isGFeasible_of_arcs hS hD hG hH hbd⟩ + obtain ⟨u, v, -, hb, hL'⟩ := hI + have hub : u ∈ bd S := (hb ▸ (.inl rfl : u ∈ ({u, v} : Set S)) : u ∈ F ∩ bd S).2 + have hvb : v ∈ bd S := (hb ▸ (.inr rfl : v ∈ ({u, v} : Set S)) : v ∈ F ∩ bd S).2 + have hmem : ∀ z ∈ ({u, v} : Set S), z ∈ bd S := by + rintro z (rfl | h) + · exact hub + · exact (mem_singleton_iff.mp h) ▸ hvb + have hst : s ≠ t := fun e => by + obtain ⟨f, h0, h1⟩ := hL + have : f 0 = f 1 := Subtype.ext (h0.trans (e.trans h1.symm)) + exact zero_ne_one (f.injective this) + exact card_le_of_feasible hDS hF hN hL (hmem s (line_end_mem hL hL')) (hmem t + (line_end_mem hL.symm hL')) hst hc hne + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section43.lean b/LeanPool/GraphMinor/GM07/Section43.lean new file mode 100644 index 0000000000..a2bfe944a3 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section43.lean @@ -0,0 +1,515 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CuffWalk +public import LeanPool.GraphMinor.Menger.SimpleGraph + +/-! +# Graph Minors VII, (4.3) + +We prove the corrected form of Graph Minors VII (4.3) (pages 222–223). Let `G` be a proper graph +in a connected surface `Σ` with at least two cuffs. Suppose every `G`-normal `O`-arc off `bd(Σ)` +with at most `v` vertices of `G` is null-homotopic. +Then for each cuff `C` there are `v + 1` paths of `G` from `C` to the rest of `bd(Σ)`, disjoint +except for their ends. + +We follow the paper. Let `X` be a set of at most `v` vertices off `bd(Σ)`. The first step +(`exists_walk_avoiding`) is that `G - X` has a path from `C` to the rest of `bd(Σ)`. The set +`Z`, which is `Σ - (U(G) ∪ bd(Σ))` with `X` added, is flat by hypothesis. It stays flat when we add +the edges at `X` (`IsFlat.union_edge`). Now take a smallest subgraph `K` of `G - X` with `offSet K` +flat, and apply `exists_walk_between_cuffs`. + +The second step (`exists_paths_of_walks`) is the form of Menger's theorem that the paper cites. Let +`A` and `B` be the vertices on `C` and on the rest of `bd(Σ)`. If an edge joins `A` to `B`, then we +take this one-edge path `v + 1` times. The corrected conclusion allows the same path at different +indices when it has no internal vertex. Otherwise we use +Menger's theorem between the neighbours of `A` and of `B` in `G - (A ∪ B)`, and add one edge at each +end of each path. + +The file ends with the first step of the proof of (4.6) (`exists_paths_from_vertex`), which applies +(4.3) to the graph `G'` obtained +from `G` by deleting the vertices of a cuff `C` other than one vertex `z`, as the paper does on +pages 224 and 225. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] [T1Space S] + +omit [T1Space S] in +/-- A flat set off `U(G)` and `bd(Σ)`, with a set `X` of vertices added, stays flat when we add +every edge of `G` whose closure +meets `X` (`IsFlat.union_edge`, one edge at a time). This is a step of the proof of (4.3) of Graph +Minors VII (page 222). -/ +theorem isFlat_union_edges (hS : IsSurface S) {G : Drawing S} (hG : G.IsProper) {X : Set S} + (hXV : X ⊆ G.V) + (hZ : IsFlat (offSet G ∪ X)) : + IsFlat (offSet G ∪ X ∪ ⋃₀ {e | e ∈ G.E ∧ ¬ Disjoint (closure e) X}) := by + classical + let Z : Set S := offSet G ∪ X + let Es : Set (Set S) := {e | e ∈ G.E ∧ ¬ Disjoint (closure e) X} + have hEf : Es.Finite := G.finite_edges.subset fun e he => he.1 + have hF : ∀ T : Set (Set S), T.Finite → T ⊆ Es → IsFlat (Z ∪ ⋃₀ T) := by + intro T hT + induction T, hT using Set.Finite.induction_on with + | empty => + intro _ + simpa using hZ + | @insert e T _ _ ih => + intro hs + have h1 := ih (fun f hf => hs (.inr hf)) + obtain ⟨he, hd⟩ := hs (mem_insert e T) + obtain ⟨x, hxe, hxX⟩ := not_disjoint_iff.mp hd + have h2 := IsFlat.union_edge hS hG h1 (fun z h3 h4 => .inl (.inl + (mem_offSet.mpr ⟨h3, h4⟩))) he hxe (hXV hxX) (.inl (.inr hxX)) + refine IsFlat.mono h2 fun z hz => ?_ + rcases hz with h | ⟨f, hf, hzf⟩ + · exact .inl (.inl h) + · rcases hf with rfl | hf + · exact .inr hzf + · exact .inl (.inr ⟨f, hf, hzf⟩) + exact hF Es hEf subset_rfl + +/-- **From a flat set to a walk between cuffs.** Let `X` be a set of vertices of a proper graph `G`, +possibly on `bd(Σ)`. If the set off `U(G)` and `bd(Σ)`, with `X` added, is flat, then `G - X` has a +walk from the cuff `C` to the +rest of `bd(Σ)`. This is the core of the proof of (4.3) of Graph Minors VII (pages 222 and 223). -/ +theorem exists_walk_of_flat (hS : IsSurface S) [ConnectedSpace S] {G : Drawing S} + (hG : G.IsProper) {C C' : Set S} (hC : C ∈ cuffs S) (hC' : C' ∈ cuffs S) (hne : C ≠ C') + {X : Set S} (hXV : X ⊆ G.V) (hZ : IsFlat (offSet G ∪ X)) : + ∃ a ∈ G.V ∩ C, ∃ b ∈ G.V ∩ (bd S \ C), ∃ W : GraphWalk G.toGraph a b, ∀ z ∈ W.support, z ∉ X + := by + classical + have ht2 : T2Space S := hS.2.1 + let Es : Set (Set S) := {e | e ∈ G.E ∧ ¬ Disjoint (closure e) X} + obtain ⟨K₀, hK₀s, hK₀V, hK₀E⟩ := exists_sub (K := G) (V' := G.V \ X) (E' := {e | e ∈ G.E + ∧ Disjoint (closure e) X}) sdiff_subset (fun e he => he.1) fun e he z hz => ⟨hz.2, fun hzX + => disjoint_left.mp he.2 hz.1 hzX⟩ + have hK₀ : IsFlatSub G X K₀ := by + refine ⟨hK₀s, hK₀V ▸ disjoint_sdiff_left, IsFlat.mono (isFlat_union_edges hS hG hXV hZ) fun z + hz => ?_⟩ + have h := mem_offSet.mp hz + by_cases hzU : z ∈ G.U + · rw [G.U_eq] at hzU + rcases hzU with h1 | h1 + · refine .inl (.inr ?_) + by_contra hzX + exact h.1 (K₀.V_subset_U (hK₀V ▸ ⟨h1, hzX⟩)) + · obtain ⟨e, he, hze⟩ := mem_iUnion₂.mp h1 + by_cases hd : Disjoint (closure e) X + · exact (h.1 (K₀.closure_subset_U (hK₀E ▸ ⟨he, hd⟩) hze)).elim + · by_cases hzV : z ∈ G.V + · refine .inl (.inr ?_) + by_contra hzX + exact h.1 (K₀.V_subset_U (hK₀V ▸ ⟨hzV, hzX⟩)) + · refine .inr ⟨e, ⟨he, hd⟩, ?_⟩ + rw [← G.closure_diff_V he] + exact ⟨hze, hzV⟩ + · exact .inl (.inl (mem_offSet.mpr ⟨hzU, h.2⟩)) + obtain ⟨K, hK, hmin⟩ := exists_smallest_flatSub ⟨K₀, hK₀⟩ + have hKp : K.IsProper := fun z hz => by + have hzG : z ∈ G.V := hG ⟨hz.1, hK.1.U_subset hz.2⟩ + have h := hz.2 + rw [K.U_eq] at h + rcases h with h | h + · exact h + · obtain ⟨e, he, hze⟩ := mem_iUnion₂.mp h + by_contra hzK + have h1 : z ∈ e := by + rw [← K.closure_diff_V he] + exact ⟨hze, hzK⟩ + have h2 : z ∈ closure e \ G.V := by + rw [G.closure_diff_V (hK.1.2 he)] + exact h1 + exact h2.2 hzG + have hconn := isPreconnected_offSet hS hKp hK.2.2 fun e he => not_isFlat_union_edge hK hmin he + obtain ⟨a, ha, b, hb, ⟨W⟩⟩ := exists_walk_between_cuffs hS hC hC' hne hKp hconn + (offSet_nonempty hS hC hC' hne hKp) hK.2.2 fun Δ hΔ h => disc_subset_offSet hS hK hmin hΔ h + obtain ⟨W', hs, -⟩ := hK.1.exists_walk_up W + refine ⟨a, ⟨hK.1.1 ha.1, ha.2⟩, b, ⟨hK.1.1 hb.1, hb.2⟩, W', fun z hz hzX => ?_⟩ + rw [hs] at hz + exact disjoint_left.mp hK.2.1 (W.mem_vertexSet_of_mem_support hz) hzX + +/-- The first step of the proof of (4.3) (Graph Minors VII, pages 222 and 223). -/ +theorem exists_walk_avoiding (hS : IsSurface S) [ConnectedSpace S] {G : Drawing S} + (hG : G.IsProper) {v : ℕ} + (hnull : ∀ F : Set S, G.IsNormal F → IsOArc F → F ∩ bd S = ∅ → (G.V ∩ F).ncard ≤ v + → IsNullHomotopicOArc F) {C C' : Set S} (hC : C ∈ cuffs S) (hC' : C' ∈ cuffs S) (hne : C ≠ C') + {X : Set S} (hXV : X ⊆ G.V) (hXb : Disjoint X (bd S)) (hXc : X.ncard ≤ v) : + ∃ a ∈ G.V ∩ C, ∃ b ∈ G.V ∩ (bd S \ C), ∃ W : GraphWalk G.toGraph a b, ∀ z ∈ W.support, z ∉ X + := by + have hXf : X.Finite := G.finite_V.subset hXV + refine exists_walk_of_flat hS hG hC hC' hne hXV (isFlat_of_forall_isNullHomotopicOArc hS fun F hF + hO => hnull F ?_ hO ?_ ?_) + · rintro z ⟨hzF, hzU⟩ + rcases hF hzF with h | h + · exact ((mem_offSet.mp h).1 hzU).elim + · exact hXV h + · refine eq_empty_of_forall_notMem fun z hz => ?_ + rcases hF hz.1 with h | h + · exact (mem_offSet.mp h).2 hz.2 + · exact disjoint_left.mp hXb h hz.2 + · refine (ncard_le_ncard (fun z hz => ?_) hXf).trans hXc + rcases hF hz.2 with h | h + · exact ((mem_offSet.mp h).1 (G.V_subset_U hz.1)).elim + · exact h + +/-- The form of Menger's theorem in the proof of (4.3) of Graph Minors VII (page 222): paths from +`A` to `B` that are disjoint except for their ends. -/ +theorem exists_paths_of_walks (G : Drawing S) {A B : Set S} (hAB : Disjoint A B) {v : ℕ} + (h : ∀ X : Set S, X ⊆ G.V → Disjoint X (A ∪ B) → X.ncard ≤ v → ∃ a ∈ A, ∃ b ∈ B, ∃ W : + GraphWalk G.toGraph a b, ∀ z ∈ W.support, z ∉ X) : + ∃ (P : Fin (v + 1) → Drawing S) (s t : Fin (v + 1) → S), (∀ i, (P i).IsSubdrawing G ∧ s i ∈ A + ∧ t i ∈ B ∧ (P i).IsPathBetween (s i) (t i)) ∧ + ∀ i j, i ≠ j → Disjoint ((P i).V \ {s i, t i}) ((P j).V \ {s j, t j}) := by + classical + by_cases hdirect : ∃ a ∈ A, ∃ b ∈ B, ∃ e, G.toGraph.IsLink e a b + · obtain ⟨a, ha, b, hb, e, hl⟩ := hdirect + have hab : a ≠ b := fun h => disjoint_left.mp hAB ha (h ▸ hb) + let W : GraphWalk G.toGraph a b := .cons hl (.nil hl.2.2.1) + have hW : W.IsSimple := by + simp [GraphWalk.IsSimple, W, GraphWalk.support, hab] + refine ⟨fun _ => walkDrawing G W, fun _ => a, fun _ => b, fun _ => ⟨walkDrawing_isSubdrawing G + W, ha, hb, walkDrawing_isPathBetween G hW⟩, fun i j _ => ?_⟩ + have : (walkDrawing G W).V \ {a, b} = ∅ := by + rw [walkDrawing_V] + ext z + simp [W, GraphWalk.support] + tauto + simp only [this, empty_disjoint] + -- There is no edge from `A` to `B`. + let H : SimpleGraph G.V := + { Adj := fun x y => x ≠ y ∧ x.1 ∉ A ∪ B ∧ y.1 ∉ A ∪ B ∧ ∃ e, G.toGraph.IsLink e x.1 y.1 + symm := ⟨fun x y h => ⟨h.1.symm, h.2.2.1, h.2.1, h.2.2.2.imp fun _ hl => hl.symm⟩⟩ + loopless := ⟨fun x h => h.1 rfl⟩ } + let NA : Set G.V := {x | x.1 ∉ A ∪ B ∧ ∃ a ∈ A, ∃ e, G.toGraph.IsLink e a x.1} + let NB : Set G.V := {x | x.1 ∉ A ∪ B ∧ ∃ b ∈ B, ∃ e, G.toGraph.IsLink e x.1 b} + have hfin : Finite G.V := G.finite_V + have hoff : ∀ {p q : G.V} (w : H.Walk p q), p.1 ∉ A ∪ B → ∀ u ∈ w.support, u.1 ∉ A ∪ B := by + intro p q w + induction w with + | nil => + intro hp u hu + rw [SimpleGraph.Walk.support_nil, List.mem_singleton] at hu + exact hu ▸ hp + | cons h' _ ih => + intro hp u hu + rw [SimpleGraph.Walk.support_cons, List.mem_cons] at hu + rcases hu with rfl | hu + · exact hp + · exact ih h'.2.2.1 u hu + have key : ∀ {x y : S} (W : GraphWalk G.toGraph x y), y ∈ B → + (x ∉ A ∪ B → (∃ (hx : x ∈ G.V) (z : G.V), z ∈ NB ∧ ∃ w : H.Walk ⟨x, hx⟩ z, ∀ u ∈ w.support, + u.1 ∈ W.support) ∨ + ∃ x₁ ∈ NA, ∃ z ∈ NB, ∃ w : H.Walk x₁ z, ∀ u ∈ w.support, u.1 ∈ W.support) ∧ + (x ∈ A → ∃ x₁ ∈ NA, ∃ z ∈ NB, ∃ w : H.Walk x₁ z, ∀ u ∈ w.support, u.1 ∈ W.support) := by + intro x y W + induction W with + | nil hv => + intro hy + exact ⟨fun h1 => (h1 (.inr hy)).elim, fun h1 => (disjoint_left.mp hAB h1 hy).elim⟩ + | @cons p q r e hl rest ih => + intro hy + obtain ⟨ih1, ih2⟩ := ih hy + have hup : ∀ u : S, u ∈ rest.support → u ∈ (GraphWalk.cons hl rest).support := fun u hu => by + simp [GraphWalk.support, hu] + have hpV : p ∈ G.V := hl.2.1 + have hqV : q ∈ G.V := hl.2.2.1 + have hE : (∃ x₁ ∈ NA, ∃ z ∈ NB, ∃ w : H.Walk x₁ z, ∀ u ∈ w.support, u.1 ∈ rest.support) + → ∃ x₁ ∈ NA, ∃ z ∈ NB, ∃ w : H.Walk x₁ z, ∀ u ∈ w.support, u.1 ∈ + (GraphWalk.cons hl rest).support := by + rintro ⟨x₁, h1, z, h2, w, hw⟩ + exact ⟨x₁, h1, z, h2, w, fun u hu => hup _ (hw u hu)⟩ + by_cases hqB : q ∈ B + · refine ⟨fun hp => .inl ⟨hpV, ⟨p, hpV⟩, ⟨hp, q, hqB, e, hl⟩, .nil, fun u hu => ?_⟩, + fun hp => (hdirect ⟨p, hp, q, hqB, e, hl⟩).elim⟩ + rw [SimpleGraph.Walk.support_nil, List.mem_singleton] at hu + subst hu + simp [GraphWalk.support] + by_cases hqA : q ∈ A + · exact ⟨fun _ => .inr (hE (ih2 hqA)), fun _ => hE (ih2 hqA)⟩ + have hq : q ∉ A ∪ B := fun h => h.elim hqA hqB + constructor + · intro hp + rcases ih1 hq with ⟨hq', z, hz, w, hw⟩ | hE' + · left + by_cases hpq : p = q + · subst hpq + exact ⟨hpV, z, hz, w, fun u hu => hup _ (hw u hu)⟩ + · have hadj : H.Adj ⟨p, hpV⟩ ⟨q, hqV⟩ := ⟨fun h => hpq (congrArg Subtype.val h), hp, hq, + e, hl⟩ + refine ⟨hpV, z, hz, .cons hadj w, fun u hu => ?_⟩ + rw [SimpleGraph.Walk.support_cons, List.mem_cons] at hu + rcases hu with rfl | hu + · simp [GraphWalk.support] + · exact hup _ (hw u hu) + · exact .inr (hE hE') + · intro hp + rcases ih1 hq with ⟨hq', z, hz, w, hw⟩ | hE' + · exact ⟨⟨q, hqV⟩, ⟨hq, p, hp, e, hl⟩, z, hz, w, fun u hu => hup _ (hw u hu)⟩ + · exact hE hE' + have hMenger : HasDisjointPaths H NA NB (v + 1) := by + refine Menger.exists_disjointPaths H NA NB hfin (v + 1) fun T hT => ?_ + by_contra hlt + have hTc : T.ncard ≤ v := by omega + let T' : Set G.V := T ∩ {x | x.1 ∉ A ∪ B} + have hT'c : (Subtype.val '' T').ncard ≤ v := by + rw [ncard_image_of_injective _ Subtype.val_injective] + exact (ncard_le_ncard inter_subset_left (toFinite T)).trans hTc + obtain ⟨a, ha, b, hb, W, hW⟩ := h (Subtype.val '' T') + (by rintro _ ⟨x, -, rfl⟩; exact x.2) (disjoint_left.mpr fun z hz => by + obtain ⟨x, hx, rfl⟩ := hz + exact hx.2) hT'c + obtain ⟨x₁, hx₁, z, hz, w, hw⟩ := (key W hb).2 ha + obtain ⟨u, hu, huT⟩ := hT ⟨x₁, z, w.bypass, w.bypass_isPath, hx₁, hz⟩ + have hu' := w.support_bypass_subset_support hu + exact hW u.1 (hw u hu') ⟨u, ⟨huT, hoff w hx₁.1 u hu'⟩, rfl⟩ + have hlift : ∀ {p q : G.V} (w : H.Walk p q), ∃ W : GraphWalk G.toGraph p.1 q.1, W.support + = w.support.map Subtype.val := by + intro p q w + induction w with + | nil => exact ⟨.nil (Subtype.prop _), by simp [GraphWalk.support]⟩ + | cons h' _ ih => + obtain ⟨W, hW⟩ := ih + obtain ⟨e, he⟩ := h'.2.2.2 + exact ⟨.cons he W, by simp [GraphWalk.support, hW]⟩ + obtain ⟨Q, hQ⟩ := hMenger + have hbuild : ∀ i, ∃ (s t : S) (W : GraphWalk G.toGraph s t), s ∈ A ∧ t ∈ B ∧ W.IsSimple + ∧ ∀ z ∈ W.support, z = s ∨ z = t ∨ ∃ u ∈ (Q i).walk.support, u.1 = z := by + intro i + obtain ⟨hx₁, a, ha, e, he⟩ := (Q i).first_mem + obtain ⟨hz₁, b, hb, f, hf⟩ := (Q i).last_mem + obtain ⟨W, hW⟩ := hlift (Q i).walk + have hnd : W.support.Nodup := by + rw [hW] + exact (Q i).isPath.support_nodup.map Subtype.val_injective + have hmem : ∀ z ∈ W.support, ∃ u ∈ (Q i).walk.support, u.1 = z := fun z hz => by + rw [hW, List.mem_map] at hz + exact hz + have hnot : ∀ c, c ∈ A ∪ B → c ∉ W.support := fun c hc hc' => by + obtain ⟨u, hu, rfl⟩ := hmem c hc' + exact hoff (Q i).walk hx₁ u hu hc + have hab : a ≠ b := fun h => disjoint_left.mp hAB ha (h ▸ hb) + let W₁ : GraphWalk G.toGraph (Q i).last.1 b := .cons hf (.nil hf.2.2.1) + have hsup : (GraphWalk.cons he (W.append W₁)).support = a :: (W.support ++ [b]) := by + change a :: (W.append W₁).support = _ + rw [GraphWalk.support_append] + rfl + refine ⟨a, b, .cons he (W.append W₁), ha, hb, ?_, fun z hz => ?_⟩ + · rw [GraphWalk.IsSimple, hsup, List.nodup_cons, List.nodup_append] + refine ⟨fun h => ?_, hnd, by simp, fun x hx y hy e => ?_⟩ + · rcases List.mem_append.mp h with h | h + · exact hnot a (.inl ha) h + · exact hab (List.mem_singleton.mp h) + · rw [List.mem_singleton] at hy + exact hnot b (.inr hb) ((e.trans hy) ▸ hx) + · rw [hsup, List.mem_cons, List.mem_append, List.mem_singleton] at hz + rcases hz with h | h | h + · exact .inl h + · exact .inr (.inr (hmem z h)) + · exact .inr (.inl h) + choose s t W hs ht hW hWm using hbuild + refine ⟨fun i => walkDrawing G (W i), s, t, fun i => ⟨walkDrawing_isSubdrawing G _, hs i, ht i, + walkDrawing_isPathBetween G (hW i)⟩, fun i j hij => ?_⟩ + rw [disjoint_left] + rintro z ⟨h1, h2⟩ ⟨h3, h4⟩ + rw [walkDrawing_V] at h1 h3 + have hne1 : z ≠ s i ∧ z ≠ t i := ⟨fun h => h2 (.inl h), fun h => h2 (.inr h)⟩ + have hne2 : z ≠ s j ∧ z ≠ t j := ⟨fun h => h4 (.inl h), fun h => h4 (.inr h)⟩ + obtain ⟨u, hu, e⟩ := ((hWm i z h1).resolve_left hne1.1).resolve_left hne1.2 + obtain ⟨u', hu', e'⟩ := ((hWm j z h3).resolve_left hne2.1).resolve_left hne2.2 + obtain rfl : u = u' := Subtype.ext (e.trans e'.symm) + exact disjoint_left.mp (hQ hij) hu hu' + +/-- **Graph Minors VII, (4.3)** (pages 222 and 223). -/ +theorem cuffToRestDisjointPaths : CuffToRestDisjointPathsStatement.{0} := by + intro S _ _ hS hconn hcuff G v hG hnull C hC + have hfin : (cuffs S).Finite := (cuff_statement.{0} S hS).2.1 + obtain ⟨C', hC', hne⟩ : ∃ C' ∈ cuffs S, C' ≠ C := exists_ne_of_one_lt_ncard hcuff C + have hsubC : C ⊆ bd S := by + obtain ⟨x, -, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + have hdis : Disjoint (G.V ∩ C) (G.V ∩ (bd S \ C)) := disjoint_left.mpr fun z h1 h2 => h2.2.2 h1.2 + obtain ⟨P, s, t, h1, h2⟩ := exists_paths_of_walks G hdis (v := v) fun X hXV hX hXc => by + have hXb : Disjoint X (bd S) := disjoint_left.mpr fun z hz hb => by + by_cases hzC : z ∈ C + · exact disjoint_left.mp hX hz (.inl ⟨hXV hz, hzC⟩) + · exact disjoint_left.mp hX hz (.inr ⟨hXV hz, hb, hzC⟩) + exact exists_walk_avoiding hS hG hnull hC hC' hne.symm hXV hXb hXc + exact ⟨P, s, t, fun i => ⟨(h1 i).1, (h1 i).2.1.2, (h1 i).2.2.1.2, (h1 i).2.2.2⟩, h2⟩ + +/-- Corrected conclusion of Graph Minors VII, (4.3) (pages 222–223). The indexed paths may +repeat when a path has no internal vertex. The printed statement reads: +"(4.3) *Let $\Sigma$ be a connected surface with at least two cuffs, and let $G$ be a proper graph +in $\Sigma$. Let $v \ge 0$ be an integer, and suppose that every $G$-normal $O$-arc $F$ with +$F \cap bd(\Sigma) = \emptyset$ and $|V(G) \cap F| \le v$ is null-homotopic. Let $C$ be a cuff. +Then there are at least $v + 1$ paths of $G$, each with one end in $C$ and the other in +$bd(\Sigma) - C$, mutually vertex-disjoint except for their ends.*" -/ +theorem theorem_4_3_proof {S : Type} [TopologicalSpace S] [T1Space S] + (hS : IsSurface S) [hConn : ConnectedSpace S] + (hcuffs : 2 ≤ (cuffs S).ncard) (G : Drawing S) (v : ℕ) (hG : G.IsProper) + (hNull : ∀ F : Set S, G.IsNormal F → IsOArc F → F ∩ bd S = ∅ → (G.V ∩ F).ncard ≤ v → + IsNullHomotopicOArc F) + {C : Set S} (hC : C ∈ cuffs S) : + ∃ (P : Fin (v + 1) → Drawing S) (s t : Fin (v + 1) → S), + (∀ i : Fin (v + 1), (P i).IsSubdrawing G ∧ s i ∈ C ∧ t i ∈ bd S \ C ∧ + (P i).IsPathBetween (s i) (t i)) ∧ + (∀ i j : Fin (v + 1), i ≠ j → + Disjoint ((P i).V \ {s i, t i}) ((P j).V \ {s j, t j})) := + cuffToRestDisjointPaths S hS hConn hcuffs G v hG hNull C hC + +/-- The first step of the proof of (4.6) of Graph Minors VII (pages 224 and 225): for a vertex `z` +on a cuff `C` there are many +paths from `z` to the rest of `bd(Σ)`, disjoint except for their ends. As in the paper, let `G'` be +the graph obtained from `G` by +deleting every vertex of `G` in `C` except `z`, and apply (4.3) to `G'`. Its hypothesis holds for +`G'`: a `G'`-normal `O`-arc `F'` +off `bd(Σ)` that meets few vertices of `G'` is null-homotopic. The paper shows this by moving `F'` +to a `G`-normal `O`-arc `F` +with `V(G) ∩ F ⊆ (V(G') ∩ F') ∪ ((V(G) ∩ C) - {z})` and applying hypothesis (ii) of (4.6) to `F`; it +says the move "is easy to +see". We do not move `F'`. The set off `U(G)` and `bd(Σ)`, with these vertices added, is flat, since +each `O`-arc in it is such +an `F`, and the paper's last lines apply to it. It stays flat when the edges at these vertices are +added +(`isFlat_union_edges`), and that set contains `F'`. -/ +theorem exists_paths_from_vertex (hS : IsSurface S) [ConnectedSpace S] {G : Drawing S} + (hG : G.IsProper) {n : ℕ} + (hnull : ∀ B : Set S, G.IsNormal B → IsOArc B → (G.V ∩ B).ncard ≤ n → IsNullHomotopicOArc B + ∨ ∃ C ∈ cuffs S, IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) + (hthree : ∀ C ∈ cuffs S, (G.V ∩ C).Nonempty) {C C' : Set S} (hC : C ∈ cuffs S) + (hC' : C' ∈ cuffs S) (hne : C ≠ C') {z : S} (hzV : z ∈ G.V) (hzC : z ∈ C) {m : ℕ} (hm : m + + (G.V ∩ C).ncard ≤ n) : + ∃ (P : Fin (m + 1) → Drawing S) (s t : Fin (m + 1) → S), (∀ i, (P i).IsSubdrawing G ∧ s i = z + ∧ t i ∈ G.V ∩ (bd S \ C) ∧ (P i).IsPathBetween (s i) (t i)) ∧ + ∀ i j, i ≠ j → Disjoint ((P i).V \ {s i, t i}) ((P j).V \ {s j, t j}) := by + classical + have hsubC : C ⊆ bd S := by + obtain ⟨x, -, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + -- `G'`: delete every vertex of `G` in `C` except `z`. + let D : Set S := (G.V ∩ C) \ {z} + obtain ⟨G', hG's, hG'V, hG'E⟩ := exists_sub (K := G) (V' := G.V \ D) + (E' := {e | e ∈ G.E ∧ Disjoint (closure e) D}) sdiff_subset (fun e he => he.1) + fun e he y hy => ⟨hy.2, fun hyD => disjoint_left.mp he.2 hy.1 hyD⟩ + have hG'p : G'.IsProper := fun y hy => by + have hyG : y ∈ G.V := hG ⟨hy.1, hG's.U_subset hy.2⟩ + have h := hy.2 + rw [G'.U_eq] at h + rcases h with h | h + · exact h + · obtain ⟨e, he, hye⟩ := mem_iUnion₂.mp h + have he' : e ∈ G.E ∧ Disjoint (closure e) D := by + rw [hG'E] at he + exact he + rw [hG'V] + exact ⟨hyG, fun hyD => disjoint_left.mp he'.2 hye hyD⟩ + -- The hypothesis of (4.3) for `G'` with `m` in place of `v`. + have hnull' : ∀ F : Set S, G'.IsNormal F → IsOArc F → F ∩ bd S = ∅ → (G'.V ∩ F).ncard ≤ m → + IsNullHomotopicOArc F := by + intro F' hF'n hF'O hF'b hF'c + let X : Set S := G'.V ∩ F' + have hXG : X ⊆ G.V := fun y hy => by + have h := hy.1 + rw [hG'V] at h + exact h.1 + let X' : Set S := X ∪ D + have hX'V : X' ⊆ G.V := union_subset hXG fun y hy => hy.1.1 + have hX'f : X'.Finite := G.finite_V.subset hX'V + have hzX' : z ∉ X' := by + rintro (h | h) + · exact (eq_empty_iff_forall_notMem.mp hF'b) z ⟨h.2, hsubC hzC⟩ + · exact h.2 rfl + have hflat : IsFlat (offSet G ∪ X') := by + refine isFlat_of_forall_isNullHomotopicOArc hS fun F hF hO => ?_ + have hsub : G.V ∩ F ⊆ X' := fun y hy => by + rcases hF hy.2 with h | h + · exact ((mem_offSet.mp h).1 (G.V_subset_U hy.1)).elim + · exact h + have hnorm : G.IsNormal F := by + rintro y ⟨hyF, hyU⟩ + rcases hF hyF with h | h + · exact ((mem_offSet.mp h).1 hyU).elim + · exact hX'V h + have hcard : (G.V ∩ F).ncard ≤ n := by + refine (ncard_le_ncard hsub hX'f).trans ?_ + have h3 : X'.ncard ≤ X.ncard + D.ncard := ncard_union_le _ _ + have h4 : D.ncard ≤ (G.V ∩ C).ncard := ncard_le_ncard sdiff_subset + (G.finite_V.subset inter_subset_left) + have h5 : X.ncard ≤ m := hF'c + omega + -- The last lines of the paper's argument on page 225. + rcases hnull F hnorm hO hcard with h | ⟨C₁, hC₁, -, hsubF⟩ + · exact h + · exfalso + by_cases heq : C₁ = C + · subst heq + exact hzX' (hsub ⟨hzV, hsubF ⟨hzV, hzC⟩⟩) + · obtain ⟨y, hyV, hyC⟩ := hthree C₁ hC₁ + have hyb : y ∈ bd S \ C := by + refine ⟨?_, fun h => heq (GM17.cuffs_disjoint_eq hC₁ hC hyC h)⟩ + obtain ⟨x, -, rfl⟩ := hC₁ + exact connectedComponentIn_subset _ _ hyC + rcases hsub ⟨hyV, hsubF ⟨hyV, hyC⟩⟩ with h | h + · exact (eq_empty_iff_forall_notMem.mp hF'b) y ⟨h.2, hyb.1⟩ + · exact hyb.2 h.1.2 + have hflat2 := isFlat_union_edges hS hG hX'V hflat + obtain ⟨φ⟩ := hF'O + refine ⟨φ, hflat2 ⟨fun x => (φ x).1, continuous_subtype_val.comp φ.continuous⟩ ?_⟩ + rintro _ ⟨x, rfl⟩ + have hyF : (φ x).1 ∈ F' := (φ x).2 + set y := (φ x).1 + have hyb : y ∉ bd S := fun h => (eq_empty_iff_forall_notMem.mp hF'b) y ⟨hyF, h⟩ + by_cases hyU : y ∈ G.U + · rw [G.U_eq] at hyU + by_cases hyV : y ∈ G.V + · by_cases hyD : y ∈ D + · exact .inl (.inr (.inr hyD)) + · have hyG' : y ∈ G'.V := by + rw [hG'V] + exact ⟨hyV, hyD⟩ + exact .inl (.inr (.inl ⟨hyG', hyF⟩)) + · rcases hyU with h | h + · exact (hyV h).elim + obtain ⟨e, he, hye⟩ := mem_iUnion₂.mp h + have hye' : y ∈ e := by + rw [← G.closure_diff_V he] + exact ⟨hye, hyV⟩ + by_cases hd : Disjoint (closure e) D + · have heG' : e ∈ G'.E := by + rw [hG'E] + exact ⟨he, hd⟩ + have hyG'V := hF'n ⟨hyF, G'.closure_subset_U heG' hye⟩ + exact (hyV (hG's.1 hyG'V)).elim + · refine .inr ⟨e, ⟨he, fun hd' => hd (hd'.mono_right subset_union_right)⟩, hye'⟩ + · exact .inl (.inl (mem_offSet.mpr ⟨hyU, hyb⟩)) + -- (4.3) applied to `G'`. + have hcuffs : 2 ≤ (cuffs S).ncard := by + have hfin : (cuffs S).Finite := (cuff_statement.{0} S hS).2.1 + calc 2 = ({C, C'} : Set (Set S)).ncard := (ncard_pair hne).symm + _ ≤ (cuffs S).ncard := ncard_le_ncard (insert_subset hC (singleton_subset_iff.mpr hC')) hfin + obtain ⟨P, s, t, h1, h2⟩ := theorem_4_3_proof hS hcuffs G' m hG'p hnull' hC + refine ⟨P, s, t, fun i => ?_, h2⟩ + obtain ⟨hPs, hsC, htC, hpath⟩ := h1 i + obtain ⟨W, hWs, hWV, hWE⟩ := hpath + have hsP : s i ∈ (P i).V := hWV ▸ W.start_mem_support + have htP : t i ∈ (P i).V := hWV ▸ W.end_mem_support + have hsG' : s i ∈ G'.V := hPs.1 hsP + have htG' : t i ∈ G'.V := hPs.1 htP + rw [hG'V] at hsG' htG' + refine ⟨IsSubdrawing.trans' hPs hG's, ?_, ⟨htG'.1, htC⟩, ⟨W, hWs, hWV, hWE⟩⟩ + by_contra hsz + exact hsG'.2 ⟨⟨hsG'.1, hsC⟩, hsz⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section44.lean b/LeanPool/GraphMinor/GM07/Section44.lean new file mode 100644 index 0000000000..ff3fbefba2 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section44.lean @@ -0,0 +1,471 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.TreeStep +public import LeanPool.GraphMinor.GM07.ForestParts + +/-! +# Graph Minors VII, (4.4): a forest that avoids the cut + +Graph Minors VII states (4.4) on page 223 with no proof, and offers an induction on `|E(L)|` as an +example. Here we do the following instead. + +First a move takes the finitely many points that the parts of `L` shrink to away from `H₀` +(`exists_move_off`), except for the vertices of `H₀` on `bd(Σ)`. Then one move shrinks each part of +`L` near its point (`exists_gather`). In the end, a part of `L` meets the forest only if it has a +vertex `z` of `H₀` on `bd(Σ)`, and only near `z`. At each such `z` the edges are moved to one side +of the part by `exists_root_step` (`exists_root_steps`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S S' : Type} [TopologicalSpace S] [TopologicalSpace S'] + +/-- A flat set stays flat when pulled back by a homeomorphism. -/ +theorem Flat.preimage_homeo {A : Set S} (h : Flat A) (G : S ≃ₜ S) : Flat (G ⁻¹' A) + := fun a b p q hp hq => by + obtain ⟨F⟩ := h (p.map G.continuous) (q.map G.continuous) hp hq + refine ⟨⟨⟨⟨fun w => G.symm (F w), by fun_prop⟩, fun x => ?_, fun x => ?_⟩, fun t x hx => ?_⟩⟩ + · simp + · simp + · rcases hx with rfl | hx + · simp + · obtain rfl : x = 1 := hx + simp + +/-- The steps of (4.4) at all roots. They do not interfere, because each one takes place in its own +flat set. -/ +theorem exists_root_steps (hS : IsSurface S) {L : Drawing S} {φ : S' → S} + (hJ : IsCutAlongGraph L S' φ) (hNo : NoArcs L) {Z : Set S} (hZ : Z.Finite) (T F : S → Set S) + (l : S → S') + (hT : ∀ z ∈ Z, IsPreconnected (T z) ∧ IsClosed (T z) ∧ IsClosed (L.U \ T z) ∧ T z ⊆ L.U + ∧ z ∈ T z ∧ z ∈ bd S ∧ φ (l z) = z ∧ IsOpen (F z) ∧ Flat (F z) ∧ T z ⊆ F z) + (hd : ∀ z ∈ Z, ∀ z' ∈ Z, z ≠ z' → Disjoint (F z) (F z')) {H : Drawing S} + (hH : IsSurfaceForest H) (hV : ∀ z ∈ Z, ∀ v ∈ H.V, v ≠ z → v ∉ T z) + (hE : ∀ z ∈ Z, ∀ e ∈ H.E, SplitEdge (closure e) (F z) z (T z)) : + ∃ P : Drawing S, P.V = H.V ∧ IsSurfaceForest P ∧ ForestsHomotopic P H ∧ + (∀ z ∈ Z, P.U ∩ T z ⊆ {z}) ∧ P.U ⊆ H.U ∪ ⋃ z ∈ Z, F z ∧ ∀ z ∈ Z, ∀ z' ∈ φ ⁻¹' {z}, z' ≠ l z + → z' ∉ closure (φ ⁻¹' (P.U \ P.V)) := by + classical + have ht2 : T2Space S := hS.2.1 + have hφ := hJ.quotientMap.continuous + have key : ∀ J : Set S, J.Finite → J ⊆ Z → ∃ P : Drawing S, P.V = H.V ∧ IsSurfaceForest P + ∧ ForestsHomotopic P H ∧ (∀ z ∈ J, P.U ∩ T z ⊆ {z}) ∧ P.U ⊆ H.U ∪ ⋃ z ∈ J, F z ∧ + (∀ z ∈ J, ∀ z' ∈ φ ⁻¹' {z}, z' ≠ l z → z' ∉ closure (φ ⁻¹' (P.U \ P.V))) ∧ ∀ z ∈ Z, z ∉ J + → ∀ e ∈ P.E, SplitEdge (closure e) (F z) z (T z) := by + intro J hJ + induction J, hJ using Set.Finite.induction_on with + | empty => + refine fun _ => ⟨H, rfl, hH, ?_, by simp, ?_, by simp, fun z hz _ e he => hE z hz e he⟩ + · have h0 := forestsHomotopic_of_move (α := Homeomorph.refl S) IsMove.refl hH + rwa [mapDrawingHomeo_refl] at h0 + · simp + | @insert z₀ J hz₀ _ ih => + intro hsub + obtain ⟨P, hPV, hPf, hPh, h1, h2, h3, h4⟩ := ih fun x hx => hsub (mem_insert_of_mem _ hx) + have hz₀Z := hsub (mem_insert _ _) + obtain ⟨hp, hc, hr, hU, hmem, hb, hl, ho, hfl, hTF⟩ := hT z₀ hz₀Z + obtain ⟨Pn, Y, hYc, hYF, hnV, hnf, hnh, hnT, hnE, hnU, hnC⟩ := exists_root_step hS hJ hNo hp + hc hr hU hmem hb hl (H := P) hPf ho hfl hTF (fun v hv => hV z₀ hz₀Z v (hPV ▸ hv)) + (h4 z₀ hz₀Z hz₀) + have hdz : ∀ z ∈ J, Disjoint (F z) (F z₀) := fun z hz => hd z (hsub + (mem_insert_of_mem _ hz)) z₀ hz₀Z fun h => hz₀ (h ▸ hz) + have hYT : ∀ z ∈ J, Disjoint Y (T z) := fun z hz => ((hdz z hz).symm.mono_left + hYF).mono_right (hT z (hsub (mem_insert_of_mem _ hz))).2.2.2.2.2.2.2.2.2 + refine ⟨Pn, hnV.trans hPV, hnf, ForestsHomotopic.trans hnh hPh, fun z hz q hq => ?_, + fun q hq => ?_, fun z hz z' hz' hne hin => ?_, fun z hzZ hzn e he => ?_⟩ + · rcases hz with rfl | hz + · exact hnT hq + · rcases hnU hq.1 with h | h + · exact h1 z hz ⟨h, hq.2⟩ + · exact (disjoint_left.mp (hYT z hz) h hq.2).elim + · rcases hnU hq with h | h + · rcases h2 h with h' | h' + · exact .inl h' + · obtain ⟨z, hz, h'⟩ := mem_iUnion₂.mp h' + exact .inr (mem_iUnion₂.mpr ⟨z, mem_insert_of_mem _ hz, h'⟩) + · exact .inr (mem_iUnion₂.mpr ⟨z₀, mem_insert _ _, hYF h⟩) + · rcases hz with rfl | hz + · exact hnC z' hz' hne hin + · have hsub' : φ ⁻¹' (Pn.U \ Pn.V) ⊆ closure (φ ⁻¹' (P.U \ P.V)) ∪ φ ⁻¹' Y := by + rintro q ⟨hq1, hq2⟩ + rcases hnU hq1 with h | h + · exact .inl (subset_closure ⟨h, fun h' => hq2 (by rw [hnV]; exact h')⟩) + · exact .inr h + rcases closure_minimal hsub' (isClosed_closure.union (hYc.preimage hφ)) hin with h | h + · exact h3 z hz z' hz' hne h + · have h5 : φ z' = z := hz' + have h6 : z ∈ T z := (hT z (hsub (mem_insert_of_mem _ hz))).2.2.2.2.1 + exact disjoint_left.mp (hYT z hz) h (h5 ▸ h6) + · have hzJ : z ∉ J := fun h => hzn (mem_insert_of_mem _ h) + have hne : z ≠ z₀ := fun h => hzn (h ▸ mem_insert _ _) + obtain ⟨e₀, he₀, hs1, hs2⟩ := hnE e he + have hTz := (hT z hzZ).2.2.2.2.2.2.2.2.2 + exact (h4 z hzZ hzJ e₀ he₀).change isClosed_closure hYc (hd z hzZ z₀ hz₀Z hne) + ((hd z hzZ z₀ hz₀Z hne).symm.mono_left hYF |>.mono_right hTz) hs1 hs2 + obtain ⟨P, h1, h2, h3, h4, h5, h6, -⟩ := key Z hZ subset_rfl + exact ⟨P, h1, h2, h3, h4, h5, h6⟩ + +/-- A finite connected set has at most one point. -/ +theorem eq_of_finite_preconnected [T1Space S] {A : Set S} (hf : A.Finite) + (hp : IsPreconnected A) {a b : S} (ha : a ∈ A) (hb : b ∈ A) : a = b := by + classical + by_contra hne + rcases isPreconnected_iff_subset_of_disjoint_closed.mp hp {a} (A \ {a}) isClosed_singleton + (hf.subset sdiff_subset).isClosed (fun x hx => by + by_cases h : x = a + · exact .inl h + · exact .inr ⟨hx, h⟩) (by + ext x + simp only [mem_inter_iff, mem_singleton_iff, mem_sdiff, mem_empty_iff_false, iff_false] + tauto) with h | h + · exact hne (h hb).symm + · exact (h ha).2 rfl + +private theorem split_forest_edge_near_boundary_vertex + {S : Type} + [TopologicalSpace S] + (H₀ : Drawing S) + [T2Space S] + (H₁ : Drawing S) + (hH₁ : IsSurfaceForest H₁) + (hX : H₁.V ∩ bd S = H₀.V ∩ bd S) + (Z : Set S) + (base : S → Set S) + (F : S → Set S) + (hF : ∀ z ∈ Z, F z ⊆ base z ∧ z ∈ F z ∧ IsOpen (F z) ∧ IsFlat (F z)) + (z : S) + (hz : z ∈ Z) + (hzBd : z ∈ H₀.V ∩ bd S) + (e : Set S) + (he : e ∈ H₁.E) : + ∃ Q₂ Q₁ : Set S, IsClosed Q₂ ∧ closure e = Q₁ ∪ Q₂ ∧ Q₁ ⊆ F z ∧ IsPreconnected Q₁ ∧ + (Q₁.Nonempty → z ∈ Q₁) ∧ z ∉ Q₂ := by + by_cases hze : z ∈ closure e + · have hzV : z ∈ H₁.V := by + have : z ∈ H₁.V ∩ bd S := hX ▸ hzBd + exact this.1 + obtain ⟨u, v, -, hcap, hline⟩ := edge_line_of_forest hH₁.2 he + have hzc : z ∈ ({u, v} : Set S) := by rw [← hcap]; exact ⟨hze, hzV⟩ + obtain ⟨y, hline'⟩ : ∃ y, IsLineWithEnds (closure e) z y := by + rcases hzc with rfl | h + · exact ⟨v, hline⟩ + · obtain rfl : z = v := h + exact ⟨u, hline.symm⟩ + obtain ⟨f, hf0, -⟩ := hline' + let a : unitInterval → S := fun t => (f t).1 + have hac : Continuous a := by fun_prop + have hai : Function.Injective a := fun s t h => f.injective (Subtype.ext h) + have hr : range a = closure e := by + ext q + exact ⟨by rintro ⟨t, rfl⟩; exact (f t).2, fun hq => ⟨f.symm ⟨q, hq⟩, by simp [a]⟩⟩ + have ha0 : a 0 = z := hf0 + obtain ⟨t, ht0, -, htN⟩ := exists_initial hac (hF z hz).2.2.1 + (show a 0 ∈ F z by rw [ha0]; exact (hF z hz).2.1) + refine ⟨a '' Ici t, a '' Iic t, (isClosed_Ici.isCompact.image hac).isClosed, ?_, ?_, + isPreconnected_Iic.image a hac.continuousOn, fun _ => ⟨0, unitInterval.nonneg t, ha0⟩, ?_⟩ + · rw [← hr, ← image_univ, ← image_union, Iic_union_Ici] + · rintro _ ⟨s, hs, rfl⟩ + exact htN s hs + · rintro ⟨s, hs, he'⟩ + have h1 : s = 0 := hai (he'.trans ha0.symm) + rw [h1] at hs + exact absurd (show t.1 ≤ 0 from hs) (not_le.mpr ht0) + · exact ⟨closure e, ∅, isClosed_closure, by simp, empty_subset _, isPreconnected_empty, + by simp, hze⟩ + +private theorem boundary_vertex_avoids_far_edge_pieces + {S : Type} + [TopologicalSpace S] + (H₁ : Drawing S) : + ∀ (Z : Set S), + ∀ (F : S → Set S), + ∀ (Q₂ : S → Set S → Set S), + ∀ (Q₁ : S → Set S → Set S), + (∀ z ∈ Z, ∀ e ∈ H₁.E, IsClosed (Q₂ z e) ∧ closure e = Q₁ z e ∪ Q₂ z e ∧ Q₁ z e ⊆ F z ∧ + IsPreconnected (Q₁ z e) ∧ ((Q₁ z e).Nonempty → z ∈ Q₁ z e) ∧ z ∉ Q₂ z e) → + let Cz : S → Set S := fun z => (⋃ e ∈ H₁.E, Q₂ z e) ∪ H₁.V \ {z} + ∀ (z : S), + (z ∈ Z) → + z ∉ Cz z := by + intro Z F Q₂ Q₁ hQ Cz z hz + rintro (h | h) + · obtain ⟨e, he, h⟩ := mem_iUnion₂.mp h + exact (hQ z hz e he).2.2.2.2.2 h + · exact h.2 rfl + +private theorem move_boundary_components_into_local_neighbourhoods + {S : Type} + [TopologicalSpace S] + (L : Drawing S) + (H₀ : Drawing S) + (K : Set (Set S)) + (hparts : ∀ C ∈ K, IsPreconnected C ∧ IsClosed C ∧ IsClosed (L.U \ C) ∧ C ⊆ L.U) + (Rall : Set S) : + let Z : Set S := H₀.V ∩ bd S ∩ L.U + let Y₁ : Set S := Rall ∪ Z + ∀ (cmp : S → Set S), + (∀ y ∈ L.U, cmp y ∈ K) → + (∀ y ∈ L.U, y ∈ cmp y) → + ∀ (O : S → Set S), + (Y₁.PairwiseDisjoint O) → + let base : S → Set S := fun y => O y ∩ (L.U \ cmp y)ᶜ + ∀ (N : S → Set S), + (∀ y ∈ Y₁, IsOpen (N y)) → + (∀ y ∈ Y₁, y ∈ N y) → + (∀ y ∈ Y₁, N y ⊆ base y) → + let NP : Set S → Set S := fun C => ⋃ y ∈ Y₁ ∩ C, N y + ∀ (G : S ≃ₜ S), + (∀ C ∈ K, ∀ z ∈ C, G z ∈ NP C) → + (∀ z ∈ bd S, G z = z) → + ∀ (z : S), + (z ∈ Z) → + ∀ q ∈ cmp z, G q ∈ N z := by + intro Z Y₁ cmp hcmpK hcmpM O hOd base N hNo hyN hNb NP G hGN hGb z hz + have hzU : z ∈ L.U := hz.2 + have hC := hcmpK z hzU + have hzY : z ∈ Y₁ := .inr hz + have hconn : IsPreconnected (G '' cmp z) := (hparts _ hC).1.image G G.continuous.continuousOn + let v : Set S := ⋃ y ∈ (Y₁ ∩ cmp z) \ {z}, N y + have hsub : G '' cmp z ⊆ N z ∪ v := by + rintro _ ⟨q, hq, rfl⟩ + obtain ⟨y, hy, h1⟩ := mem_iUnion₂.mp (hGN _ hC q hq) + by_cases hyz : y = z + · exact .inl (hyz ▸ h1) + · exact .inr (mem_iUnion₂.mpr ⟨y, ⟨hy, hyz⟩, h1⟩) + have hd' : Disjoint (N z) v := by + rw [disjoint_left] + intro q h1 h2 + obtain ⟨y, hy, h3⟩ := mem_iUnion₂.mp h2 + exact disjoint_left.mp (hOd hzY hy.1.1 (Ne.symm hy.2)) (hNb z hzY h1).1 (hNb y hy.1.1 h3).1 + have hvOpen : IsOpen v := isOpen_biUnion fun y hy => hNo y hy.1.1 + have hmain := hconn.subset_left_of_subset_union (hNo z hzY) hvOpen hd' hsub + ⟨z, ⟨z, hcmpM z hzU, hGb z hz.1.2⟩, hyN z hzY⟩ + exact fun q hq => hmain (mem_image_of_mem G hq) + +/-- **(4.4) of Graph Minors VII** (page 223). Let `L` be a proper graph with no isolated vertices in +`Σ`, such that no subset of `U(L)` is an `O`-arc or an `I`-arc, and let `φ` be the map of the cut +along `U(L)`. Let `H₀` be a forest in `Σ`, and for each vertex `z` of `H₀` on `bd(Σ)` let `l z` be a +point of `φ⁻¹(z)`. Then there is a forest `H` homotopic to `H₀` with `U(H) ∩ U(L) ⊆ bd(Σ)`, such +that every point of `φ⁻¹(z)` other than `l z` is an isolated vertex of `φ⁻¹(H)`. -/ +theorem theorem_4_4_proof (hS : IsSurface S) (L : Drawing S) (φ : S' → S) + (hJ : IsCutAlongGraph L S' φ) (hNoArc : ∀ F : Set S, F ⊆ L.U → ¬ IsOArc F ∧ ¬ IsIArc F) + (H₀ : Drawing S) (l : S → S') (hH₀ : IsSurfaceForest H₀) (hl : ∀ z ∈ H₀.V ∩ bd S, φ (l z) = z) : + ∃ (H : Drawing S) (H' : Drawing S'), IsSurfaceForest H ∧ ForestsHomotopic H H₀ + ∧ H.U ∩ L.U ⊆ bd S ∧ IsPullbackDrawing φ H H' ∧ ∀ z ∈ H₀.V ∩ bd S, ∀ z' ∈ φ ⁻¹' {z} \ {l z}, + IsIsolatedVertex H' z' := by + classical + have ht2 : T2Space S := hS.2.1 + have hNoA : NoArcs L := ⟨fun F hF => (hNoArc F hF).1, fun F hF => (hNoArc F hF).2⟩ + have hY := hJ.isSurface + have : T2Space S' := hY.2.1 + have hφ := hJ.quotientMap.continuous + have hP := hJ.isProper + have hn := hJ.noIsolated + obtain ⟨K, hK, hparts, hcover, hdis, hdich⟩ := exists_parts hn + obtain ⟨R, hR, hgather⟩ := exists_gather hS hP hn hNoA hK hparts hcover hdis hdich + -- The roots off the boundary leave `H₀`. + let Rall : Set S := ⋃ C ∈ K, R C + have hRf : Rall.Finite := hK.biUnion fun C hC => (hR C hC).1 + have hRU : Rall ⊆ L.U := fun r hr => by + obtain ⟨C, hC, h⟩ := mem_iUnion₂.mp hr + exact (hparts C hC).2.2.2 ((hR C hC).2 h) + obtain ⟨M, hM, hMoff⟩ := exists_move_off hS hH₀.2 (hRf.subset (sdiff_subset (t + := bd S))) fun a ha => ha.2 + let H₁ : Drawing S := mapDrawingHomeo M.symm H₀ + have hH₁h : ForestsHomotopic H₁ H₀ := forestsHomotopic_of_move hM.symm hH₀ + have hH₁ : IsSurfaceForest H₁ := ⟨hH₁h.1, hH₁h.2.2.1⟩ + have hX : H₁.V ∩ bd S = H₀.V ∩ bd S := hH₁h.2.2.2.2.1 + have hoff1 : ∀ r ∈ Rall, r ∉ bd S → r ∉ H₁.U := fun r hr hb hU => by + obtain ⟨q, hq, he⟩ := hU + refine hMoff r ⟨hr, hb⟩ ?_ + have : M r = q := by rw [← he]; simp + rw [this] + exact hq + -- The points, and disjoint open sets around them. + let Z : Set S := (H₀.V ∩ bd S) ∩ L.U + have hZf : Z.Finite := (H₀.finite_V.subset inter_subset_left).subset inter_subset_left + let Y₁ : Set S := Rall ∪ Z + have hY₁f : Y₁.Finite := hRf.union hZf + have hY₁U : Y₁ ⊆ L.U := union_subset hRU inter_subset_right + have hcmp : ∀ y, y ∈ L.U → ∃ C ∈ K, y ∈ C := hcover + choose! cmp hcmpK hcmpM using hcmp + have hcmpU : ∀ C ∈ K, ∀ y ∈ C, cmp y = C := fun C hC y hy => by + have hyU := (hparts C hC).2.2.2 hy + by_contra hne + exact disjoint_left.mp (hdis _ (hcmpK y hyU) C hC hne) (hcmpM y hyU) hy + obtain ⟨O, hO, hOd⟩ := hY₁f.t2_separation + let base : S → Set S := fun y => O y ∩ (L.U \ cmp y)ᶜ + have hbaseo : ∀ y ∈ Y₁, IsOpen (base y) := fun y hy => (hO y).2.inter (hparts _ (hcmpK y + (hY₁U hy))).2.2.1.isOpen_compl + have hybase : ∀ y ∈ Y₁, y ∈ base y := fun y hy => ⟨(hO y).1, fun h => h.2 (hcmpM y (hY₁U hy))⟩ + have hflat : ∀ z, z ∈ Z → ∃ W : Set S, W ⊆ base z ∧ z ∈ W ∧ IsOpen W ∧ IsFlat W := fun z hz => by + obtain ⟨W, h1, h2, h3, -, h4, -⟩ := exists_chart_ball_subset hS z (hbaseo z (.inr hz)) + (hybase z (.inr hz)) + exact ⟨W, h1, h2, h3, h4⟩ + choose! F hF using hflat + -- Each edge at a root splits near the root. + have hsplit : ∀ z, z ∈ Z → ∀ e, e ∈ H₁.E → ∃ Q₂ Q₁ : Set S, IsClosed Q₂ ∧ closure e = Q₁ ∪ Q₂ + ∧ Q₁ ⊆ F z ∧ IsPreconnected Q₁ ∧ (Q₁.Nonempty → z ∈ Q₁) ∧ z ∉ Q₂ := fun z hz e he => by + exact split_forest_edge_near_boundary_vertex (S := S) H₀ H₁ hH₁ hX Z base F hF z hz hz.1 e he + choose! Q₂ Q₁ hQ using hsplit + let Cz : S → Set S := fun z => (⋃ e ∈ H₁.E, Q₂ z e) ∪ (H₁.V \ {z}) + have hEfin : H₁.E.Finite := H₁.finite_edges + have hCzc : ∀ z ∈ Z, IsClosed (Cz z) := fun z hz => (hEfin.isClosed_biUnion fun e he => + (hQ z hz e he).1).union (H₁.finite_V.subset sdiff_subset).isClosed + have hzCz : ∀ z ∈ Z, z ∉ Cz z := fun z hz => by + exact boundary_vertex_avoids_far_edge_pieces (S := S) H₁ Z F Q₂ Q₁ hQ z hz + let N : S → Set S := fun y => if y ∈ Z then F y ∩ (Cz y)ᶜ else base y ∩ H₁.Uᶜ + have hNZ : ∀ y ∈ Z, N y = F y ∩ (Cz y)ᶜ := fun y hy => ite_eq_left hy + have hNn : ∀ y, y ∉ Z → N y = base y ∩ H₁.Uᶜ := fun y hy => ite_eq_right hy + have hNo : ∀ y ∈ Y₁, IsOpen (N y) := fun y hy => by + by_cases hyZ : y ∈ Z + · rw [hNZ y hyZ] + exact (hF y hyZ).2.2.1.inter (hCzc y hyZ).isOpen_compl + · rw [hNn y hyZ] + exact (hbaseo y hy).inter H₁.isClosed_U.isOpen_compl + have hyN : ∀ y ∈ Y₁, y ∈ N y := fun y hy => by + by_cases hyZ : y ∈ Z + · rw [hNZ y hyZ] + exact ⟨(hF y hyZ).2.1, hzCz y hyZ⟩ + · rw [hNn y hyZ] + refine ⟨hybase y hy, fun hU => ?_⟩ + have hyR : y ∈ Rall := by + rcases hy with h | h + · exact h + · exact (hyZ h).elim + by_cases hb : y ∈ bd S + · have h1 : y ∈ H₁.V ∩ bd S := ⟨hH₁.1 ⟨hb, hU⟩, hb⟩ + exact hyZ ⟨hX ▸ h1, hRU hyR⟩ + · exact hoff1 y hyR hb hU + have hNb : ∀ y, y ∈ Y₁ → N y ⊆ base y := fun y hy q hq => by + by_cases hyZ : y ∈ Z + · rw [hNZ y hyZ] at hq + exact (hF y hyZ).1 hq.1 + · rw [hNn y hyZ] at hq + exact hq.1 + let NP : Set S → Set S := fun C => ⋃ y ∈ Y₁ ∩ C, N y + obtain ⟨G, hG, hGN⟩ := hgather NP (fun C hC => ⟨isOpen_biUnion fun y hy => hNo y hy.1, fun r hr + => mem_iUnion₂.mpr ⟨r, ⟨.inl (mem_iUnion₂.mpr ⟨C, hC, hr⟩), (hR C hC).2 hr⟩, hyN r (.inl + (mem_iUnion₂.mpr ⟨C, hC, hr⟩))⟩⟩) (fun C hC D hD hne => by + constructor + · rw [disjoint_left] + intro q hq hq' + obtain ⟨y, hy, h1⟩ := mem_iUnion₂.mp hq + obtain ⟨y', hy', h2⟩ := mem_iUnion₂.mp hq' + have hyy : y ≠ y' := fun h => disjoint_left.mp (hdis C hC D hD hne) hy.2 (h ▸ hy'.2) + exact disjoint_left.mp (hOd hy.1 hy'.1 hyy) (hNb y hy.1 h1).1 (hNb y' hy'.1 h2).1 + · rw [disjoint_left] + intro q hq hqD + obtain ⟨y, hy, h1⟩ := mem_iUnion₂.mp hq + refine (hNb y hy.1 h1).2 ⟨(hparts D hD).2.2.2 hqD, ?_⟩ + rw [hcmpU C hC y hy.2] + exact disjoint_right.mp (hdis C hC D hD hne) hqD) + let H₂ : Drawing S := mapDrawingHomeo G.symm H₁ + have hH₂h : ForestsHomotopic H₂ H₁ := forestsHomotopic_of_move hG.symm hH₁ + have hH₂ : IsSurfaceForest H₂ := ⟨hH₂h.1, hH₂h.2.2.1⟩ + have hGb : ∀ z ∈ bd S, G z = z := hG.1 + have hGs : ∀ z ∈ bd S, G.symm z = z := fun z hz => by rw [Homeomorph.symm_apply_eq, hGb z hz] + -- A part with a root stays near the root. + have hNz : ∀ z ∈ Z, ∀ q ∈ cmp z, G q ∈ N z := fun z hz => by + exact move_boundary_components_into_local_neighbourhoods (S := S) L H₀ K hparts Rall cmp + hcmpK hcmpM O hOd N hNo hyN hNb G hGN hGb z hz + have hNF : ∀ z ∈ Z, N z ⊆ F z := fun z hz q hq => by + rw [hNZ z hz] at hq + exact hq.1 + obtain ⟨P, hPV, hPf, hPh, hPT, hPU, hPC⟩ := exists_root_steps hS hJ hNoA hZf cmp (fun z + => G ⁻¹' F z) l (fun z hz => by + have hzU : z ∈ L.U := hz.2 + obtain ⟨h1, h2, h3, h4⟩ := hparts _ (hcmpK z hzU) + exact ⟨h1, h2, h3, h4, hcmpM z hzU, hz.1.2, hl z hz.1, (hF z hz).2.2.1.preimage G.continuous, + Flat.preimage_homeo (IsFlat.flat (hF z hz).2.2.2) G, fun q hq => hNF z hz (hNz z hz q hq)⟩) + (fun z hz z' hz' hne => by + rw [disjoint_left] + intro q h1 h2 + exact disjoint_left.mp (hOd (.inr hz) (.inr hz') hne) ((hF z hz).1 h1).1 + ((hF z' hz').1 h2).1) hH₂ (fun z hz v hv hne hvT => by + obtain ⟨v₁, hv₁, rfl⟩ := hv + have h1 := hNz z hz _ hvT + rw [Homeomorph.apply_symm_apply, hNZ z hz] at h1 + have hv₁z : v₁ = z := by + by_contra hn + exact h1.2 (.inr ⟨hv₁, hn⟩) + rw [hv₁z] at hne + exact hne (hGs z hz.1.2)) (fun z hz e he => by + have he' : e ∈ (image G.symm) '' H₁.E := by + rw [← mapDrawingHomeo_E] + exact he + obtain ⟨e₁, he₁, rfl⟩ := he' + obtain ⟨hc₂, hc, hsub, hp, h0, hzq⟩ := hQ z hz e₁ he₁ + refine ⟨G.symm '' Q₁ z e₁, G.symm '' Q₂ z e₁, (G.symm.isClosed_image).mpr hc₂, ?_, ?_, + hp.image _ G.symm.continuous.continuousOn, ?_, ?_⟩ + · rw [← G.symm.image_closure, hc, image_union] + · rintro _ ⟨q, hq, rfl⟩ + change G (G.symm q) ∈ F z + rw [Homeomorph.apply_symm_apply] + exact hsub hq + · rintro ⟨_, q, hq, rfl⟩ + exact ⟨z, h0 ⟨q, hq⟩, hGs z hz.1.2⟩ + · rw [disjoint_left] + rintro _ ⟨q, hq, rfl⟩ hT + have h1 := hNz z hz _ hT + rw [Homeomorph.apply_symm_apply, hNZ z hz] at h1 + exact h1.2 (.inl (mem_iUnion₂.mpr ⟨e₁, he₁, hq⟩))) + have hhom : ForestsHomotopic P H₀ := ForestsHomotopic.trans hPh (ForestsHomotopic.trans hH₂h hH₁h) + -- The forest meets `U(L)` only at roots. + have hcross : ∀ q ∈ P.U ∩ L.U, q ∈ Z := by + rintro q ⟨hqP, hqL⟩ + have hC := hcmpK q hqL + by_cases hroot : ∃ z ∈ Z, cmp z = cmp q + · obtain ⟨z, hz, he⟩ := hroot + have h1 := hPT z hz ⟨hqP, he ▸ hcmpM q hqL⟩ + rw [mem_singleton_iff.mp h1] + exact hz + · exfalso + obtain ⟨y, hy, h1⟩ := mem_iUnion₂.mp (hGN _ hC q (hcmpM q hqL)) + have hyZ : y ∉ Z := fun h => hroot ⟨y, h, hcmpU _ hC y hy.2⟩ + rw [hNn y hyZ] at h1 + rcases hPU hqP with h | h + · obtain ⟨q₁, hq₁, rfl⟩ := h + rw [Homeomorph.apply_symm_apply] at h1 + exact h1.2 hq₁ + · obtain ⟨z, hz, h⟩ := mem_iUnion₂.mp h + have hne : y ≠ z := fun h' => hyZ (h' ▸ hz) + exact disjoint_left.mp (hOd hy.1 (.inr hz) hne) h1.1.1 ((hF z hz).1 h).1 + have hPVbd : ∀ z ∈ Z, z ∈ P.V := fun z hz => by + have h1 : z ∈ H₁.V ∩ bd S := hX ▸ hz.1 + rw [hPV] + exact ⟨z, h1.1, hGs z hz.1.2⟩ + have hPn : P.IsNormal L.U := fun q hq => hPVbd q (hcross q ⟨hq.2, hq.1⟩) + obtain ⟨H', hp, -, -⟩ := exists_pullback hS hJ hPf hPn + refine ⟨P, H', hPf, hhom, fun q hq => (hcross q hq).1.2, hp, fun z hz z' hz' => ?_⟩ + have hφz : φ z' = z := hz'.1 + have hzPV : z ∈ P.V := by + have h1 : z ∈ P.V ∩ bd S := by rw [hhom.2.2.2.2.1]; exact hz + exact h1.1 + refine ⟨by rw [hp.2]; change φ z' ∈ P.V; rw [hφz]; exact hzPV, fun e' he' hinc => ?_⟩ + have hin : z' ∈ closure e' := hinc.2.2 + by_cases hzL : z ∈ L.U + · refine hPC z ⟨hz, hzL⟩ z' hz'.1 (fun h => hz'.2 h) (closure_mono (fun q hq => ?_) hin) + have h1 := he'.2.1 hq + rw [hp.1, hp.2] at h1 + exact h1 + · have hconn := isPreconnected_preimage_tree hS hJ hNoA isPreconnected_singleton + isClosed_singleton (T := {z}) (by + have : L.U \ {z} = L.U := sdiff_singleton_eq_self hzL + rw [this] + exact L.isClosed_U) + exact hz'.2 (eq_of_finite_preconnected (hJ.finite_fiber z) hconn hz'.1 (hl z hz)) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46BoundaryComponents.lean b/LeanPool/GraphMinor/GM07/Section46BoundaryComponents.lean new file mode 100644 index 0000000000..24cc665810 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46BoundaryComponents.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section46ClosedComponents +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.Classification +import LeanPool.GraphMinor.Surface.AddCrosscap + +/-! +# Components of the retained graph together with the cuffs + +For the cuff count in VII (4.6), page 226, the components of +`U(L) ∪ bd(Σ)` form a finite closed family. Cover this set by the +vertices and closed edges of `L`, and the finitely many original cuffs. +Each covering set is connected. Finite component families also have +closed remainders, which is needed to lift each part through the cut. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +/-- Finiteness and closedness of the components used for the cuff count +in VII (4.6), page 226. -/ +theorem boundary_components_finite_closed {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (L : Drawing S) : + (componentsIn (L.U ∪ bd S)).Finite ∧ + ∀ C ∈ componentsIn (L.U ∪ bd S), IsClosed C ∧ IsClosed ((L.U ∪ bd S) \ C) := by + have : T2Space S := hS.2.1 + let 𝒜 : Set (Set S) := ((fun x : S => ({x} : Set S)) '' L.V ∪ closure '' L.E) ∪ cuffs S + have hfin : 𝒜.Finite := + ((L.finite_V.image _).union (L.finite_edges.image _)).union (cuff_statement S hS).2.1 + have hne : ∀ A ∈ 𝒜, A.Nonempty := by + intro A hA + rcases hA with (⟨x, _, rfl⟩ | ⟨e, he, rfl⟩) | hC + · exact singleton_nonempty _ + · exact he.1.mono subset_closure + · exact ((cuff_statement S hS).2.2 A hC).isConnected'.nonempty + have hconn : ∀ A ∈ 𝒜, IsPreconnected A := by + intro A hA + rcases hA with (⟨x, _, rfl⟩ | ⟨e, he, rfl⟩) | hC + · exact isPreconnected_singleton + · exact he.2.2.1.isConnected.isPreconnected.closure + · exact ((cuff_statement S hS).2.2 A hC).isConnected'.isPreconnected + have hcover : L.U ∪ bd S = ⋃₀ 𝒜 := by + ext x + constructor + · rintro (hx | hx) + · rw [L.U_eq] at hx + rcases hx with hxV | hxE + · exact ⟨{x}, .inl (.inl ⟨x, hxV, rfl⟩), mem_singleton x⟩ + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hxE + exact ⟨closure e, .inl (.inr ⟨e, he, rfl⟩), hxe⟩ + · obtain ⟨C, hC, hxC⟩ := (congrArg (fun A => x ∈ A) (sUnion_cuffs (S := S))).mpr hx + exact ⟨C, .inr hC, hxC⟩ + · rintro ⟨A, hA, hxA⟩ + rcases hA with (⟨y, hy, rfl⟩ | ⟨e, he, rfl⟩) | hC + · exact .inl (L.V_subset_U (hxA ▸ hy)) + · exact .inl (L.closure_subset_U he hxA) + · exact .inr (sUnion_cuffs (S := S) ▸ ⟨A, hC, hxA⟩) + have hB : IsClosed (L.U ∪ bd S) := L.isClosed_U.union (isClosed_bd S) + have hf := finite_componentsIn_of_finite_preconnected_cover hfin hne hconn hcover + exact ⟨hf, fun C hC => ⟨isClosed_of_mem_componentsIn hB hC, + isClosed_sdiff_of_mem_finite_componentsIn hB hf hC⟩⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46BoundaryEdges.lean b/LeanPool/GraphMinor/GM07/Section46BoundaryEdges.lean new file mode 100644 index 0000000000..4b6993b71f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46BoundaryEdges.lean @@ -0,0 +1,65 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46SeamPartsDefs +import LeanPool.GraphMinor.GM07.Section2MinVal +import LeanPool.GraphMinor.GM07.Section46RefinedEdges +import LeanPool.GraphMinor.GM07.PullForest + +/-! +# Cuff edges and properness of `L` + +The seam graph has only cuff edges and edges off the cuffs. Adding +vertices preserves this dichotomy. Thus deleting the cuff edges from +`J⁺` gives a proper drawing `L`, as required on page 226 of VII (4.6). +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +/-- Every edge of the seam graph is either contained in the boundary or +disjoint from it, as used in VII (4.6), pages 225–226. -/ +theorem Net.seam_edge_boundary_dichotomy {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {J : Drawing S} (hJ : N.IsSeamGraphFor J) + {e : Set S} (he : e ∈ J.E) : e ⊆ bd S ∨ Disjoint e (bd S) := by + have : T2Space S := hS.2.1 + rw [(N.seamGraph_edges_eq hS hJ).1] at he + rcases he with ⟨i, rfl⟩ | hb + · exact .inr (N.disjoint_e_int_bd hS i) + · exact .inl (hb.2.1.trans sdiff_subset) + +/-- Refining the seam by adding vertices preserves the cuff-edge +dichotomy in VII (4.6), page 226. -/ +theorem Net.refined_edge_boundary_dichotomy {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {J J' : Drawing S} + (hJ : N.IsSeamGraphFor J) {W : Set S} (hU : J'.U = J.U) (hV : J'.V = J.V ∪ W) + {f : Set S} (hf : f ∈ J'.E) : f ⊆ bd S ∨ Disjoint f (bd S) := by + obtain ⟨e, he, hfe⟩ := refined_edge_subset_old_edge hU hV hf + rcases N.seam_edge_boundary_dichotomy hS hJ he with hbd | hoff + · exact .inl (hfe.trans hbd) + · exact .inr (hoff.mono_left hfe) + +/-- The graph `L` obtained by deleting central and cuff edges is proper, +in VII (4.6), page 226. -/ +theorem isProper_L {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {J J' L : Drawing S} + (hJ : N.IsSeamGraphFor J) {W : Set S} (hU : J'.U = J.U) (hV : J'.V = J.V ∪ W) + {central : Set (Set S)} (hLE : L.E = forestSeamEdges J' central) : L.IsProper := by + intro x hx + by_contra hxV + obtain ⟨e, he, hxe⟩ := exists_edge_of_mem hx.2 hxV + rw [hLE] at he + have hoff := (N.refined_edge_boundary_dichotomy hS hJ hU hV he.1).resolve_left he.2.2 + exact disjoint_left.mp hoff hxe hx.1 + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46BoundaryPaths.lean b/LeanPool/GraphMinor/GM07/Section46BoundaryPaths.lean new file mode 100644 index 0000000000..87e2a57c15 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46BoundaryPaths.lean @@ -0,0 +1,94 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section43 +import LeanPool.GraphMinor.GM07.Section46ChooseLift +import LeanPool.GraphMinor.GM07.Section46Constants +import LeanPool.GraphMinor.Surface.Classification + +/-! +# The paths and the choice of `l(z)` in VII (4.6) + +We use the first path step already proved in `Section43`, with `v - 2k` +paths, then apply the boundary fibre count to their lifted first edges. +The resulting family retains its disjoint interiors for claim (3). +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +/-- The first two paragraphs of the proof of VII (4.6), pages 224–225: +the paths from `z` to the other cuffs, and a common lifted first incidence +`l(z)` for at least `μ` of them. -/ +theorem Net.exists_boundary_paths_and_lift_4_6 {S : Type} [TopologicalSpace S] + [T1Space S] [ConnectedSpace S] (hS : IsSurface S) (N : Net S) + {a b c k : ℕ} (hc : 2 ≤ c) (hmodel : Nonempty (S ≃ₜ SurfaceModel a b c)) + (hv : vSurface S k = vModel a b c k) {G J : Drawing S} + (hG : G.IsProper) (hmin : N.IsMinimalFor G) + (hJ : N.IsSeamGraphFor J) (hnorm : G.IsNormal J.U) + (hbd : (G.V ∩ bd S).ncard ≤ 2 * k) + (hii : ∀ B : Set S, G.IsNormal B → IsOArc B → (G.V ∩ B).ncard ≤ vSurface S k → + IsNullHomotopicOArc B ∨ + ∃ C ∈ cuffs S, IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) + {C C' : Set S} (hC : C ∈ cuffs S) (hC' : C' ∈ cuffs S) (hne : C ≠ C') + {z : S} (hzV : z ∈ G.V) (hzC : z ∈ C) : + ∃ (P : Fin (vModel a b c k - 2 * k) → Drawing S) + (t : Fin (vModel a b c k - 2 * k) → S) (l : N.D), + N.φ l = z ∧ + (∀ i, (P i).IsSubdrawing G ∧ t i ∈ G.V ∩ (bd S \ C) ∧ + (P i).IsPathBetween z (t i)) ∧ + (∀ i j, i ≠ j → Disjoint ((P i).V \ {z, t i}) ((P j).V \ {z, t j})) ∧ + ∃ I : Finset (Fin (vModel a b c k - 2 * k)), muModel a b c k ≤ I.card ∧ + ∀ i ∈ I, ∃ e ∈ (P i).E, l ∈ closure (N.φ ⁻¹' e) ∧ + ∀ x ∈ closure (N.φ ⁻¹' e), N.φ x = z → x = l := by + have hzbd : z ∈ bd S := sUnion_cuffs (S := S) ▸ ⟨C, hC, hzC⟩ + let n := vModel a b c k - 2 * k + have hn : 0 < n := by + dsimp [n] + unfold vModel + rw [Nat.add_sub_cancel] + exact Nat.mul_pos (by omega) (by omega) + have hCV : (G.V ∩ C).ncard ≤ 2 * k := by + have hsub : G.V ∩ C ⊆ G.V ∩ bd S := fun x hx => + ⟨hx.1, sUnion_cuffs (S := S) ▸ ⟨C, hC, hx.2⟩⟩ + exact (Set.ncard_le_ncard hsub + (G.finite_V.subset inter_subset_left)).trans hbd + have hm : n - 1 + (G.V ∩ C).ncard ≤ vSurface S k := by + have h2k : 2 * k ≤ vModel a b c k := by + unfold vModel + exact Nat.le_add_left _ _ + dsimp [n] + rw [hv] + omega + have hthree : ∀ C ∈ cuffs S, (G.V ∩ C).Nonempty := by + intro D hD + exact Set.nonempty_of_ncard_ne_zero (by have h := hiii D hD; omega) + have hpaths := exists_paths_from_vertex hS hG hii hthree hC hC' hne hzV hzC hm + have hn' : n - 1 + 1 = n := by omega + rw [hn'] at hpaths + obtain ⟨P, s, t, hP, hd⟩ := hpaths + have hP' : ∀ i, (P i).IsSubdrawing G ∧ t i ∈ G.V ∩ (bd S \ C) ∧ + (P i).IsPathBetween z (t i) := by + intro i + have hs := (hP i).2.1 + exact ⟨(hP i).1, (hP i).2.2.1, hs ▸ (hP i).2.2.2⟩ + obtain ⟨l, hl, I, hI, hIe⟩ := N.exists_common_lifted_first_edge hS hc hmodel + hG hmin hJ hnorm hzbd P t (fun i => + ⟨(hP' i).1, (fun he => (hP' i).2.1.2.2 (he ▸ hzC)), (hP' i).2.2⟩) + refine ⟨P, t, l, hl, hP', ?_, I, hI, hIe⟩ + intro i j hij + simpa only [(hP i).2.1, (hP j).2.1] using hd i j hij + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46CappedCircle.lean b/LeanPool/GraphMinor/GM07/Section46CappedCircle.lean new file mode 100644 index 0000000000..52c58b6bd7 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46CappedCircle.lean @@ -0,0 +1,106 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.CutBounds +import LeanPool.GraphMinor.GM07.Section11a +import LeanPool.GraphMinor.GM07.Section46SeamComplement +import LeanPool.GraphMinor.GM07.Section46DiscSides +import LeanPool.GraphMinor.GM11.OArcCircuit +import LeanPool.GraphMinor.Surface.DiscMerge +import LeanPool.GraphMinor.Surface.AddCrosscap +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.Classification + +/-! +# The capped circle in the unique seam region + +In VII (4.6), page 226, a circle in the seam that is null-homotopic after +capping a cuff `C` must equal `C`. Use the disc it bounds in the capped +surface and the dense connected complement of the seam. The disc cannot +contain the original surface: another cuff would then lie in its boundary, +forcing the circle to equal that other cuff, contrary to its containing +the prescribed graph vertices of `C`. The disc therefore meets the +original surface only in its boundary and lies in the added cap. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +/-- The capped-cuff case of the circle argument in VII (4.6), page 226. -/ +theorem Net.capped_circle_eq_cuff {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) (hcuffs : 2 ≤ (cuffs S).ncard) + {G : Drawing S} {F C : Set S} (hF : IsOArc F) (hFU : F ⊆ N.seamU) + (hC : C ∈ cuffs S) (hnull : IsNullHomotopicOArcInCappedCuff C F) + (hVC : (G.V ∩ C).Nonempty) (hVCF : G.V ∩ C ⊆ F) : F = C := by + have : T2Space S := hS.2.1 + obtain ⟨T, _, j, D, hcap, hbdT⟩ := exists_cappedCuff hS hC + have : T2Space T := hcap.isSurface.2.1 + have hOjF : IsOArc (j '' F) := isOArc_image hcap.isEmbedding hF + have hn : IsNullHomotopicOArc (j '' F) := hnull.2.2 T j D hcap + obtain ⟨R, hR, hRbd⟩ := nullHomotopicOArc_bounds_disc hcap.isSurface hOjF hn + let Q := j '' N.seamUᶜ + have hQ : IsPreconnected Q := N.isPreconnected_compl_seamU.image j + hcap.isEmbedding.continuous.continuousOn + have hdense : range j ⊆ closure Q := by + rintro x ⟨y, rfl⟩ + exact image_closure_subset_closure_image hcap.isEmbedding.continuous + ⟨y, N.dense_compl_seamU y, rfl⟩ + have hdis : Disjoint Q (discBd R) := by + rw [hRbd] + apply disjoint_left.mpr + rintro x ⟨y, hy, rfl⟩ ⟨z, hz, hzj⟩ + have hzy := hcap.isEmbedding.injective hzj + exact hy (hFU (hzy ▸ hz)) + have hside := disc_side_of_dense_connected_set hcap.isSurface.2.2 hR hQ hdense hdis + have hnotcover : ¬range j ⊆ R := by + intro hcover + obtain ⟨C', hC', hne⟩ := Set.exists_ne_of_one_lt_ncard (by omega : 1 < (cuffs S).ncard) C + have hCO : IsOArc C' := (cuff_statement S hS).2.2 C' hC' + have hOjC : IsOArc (j '' C') := isOArc_image hcap.isEmbedding hCO + have hC'F : j '' C' ⊆ j '' F := by + rintro x ⟨y, hy, rfl⟩ + have hybd : y ∈ bd S := sUnion_cuffs (S := S) ▸ ⟨C', hC', hy⟩ + have hyC : y ∉ C := fun h => disjoint_left.mp (cuffs_disjoint hC' hC hne) hy h + have hyT : j y ∈ bd T := hbdT ▸ ⟨y, ⟨hybd, hyC⟩, rfl⟩ + have hyR : j y ∈ R := hcover (mem_range_self y) + have hyRbd : j y ∈ discBd R := by + by_contra hnb + exact hyT (isInteriorPoint_of_mem_discInt hcap.isSurface.2.2 hR ⟨hyR, hnb⟩) + exact hRbd ▸ hyRbd + have heq := eq_of_oArc_subset hOjC hOjF hC'F + obtain ⟨p, hpV, hpC⟩ := hVC + have hpF := hVCF ⟨hpV, hpC⟩ + have hpj : j p ∈ j '' C' := heq.symm ▸ mem_image_of_mem j hpF + obtain ⟨q, hq, hqp⟩ := hpj + have hqp' := hcap.isEmbedding.injective hqp + exact disjoint_left.mp (cuffs_disjoint hC' hC hne) (hqp' ▸ hq) hpC + have hboundary : R ∩ range j ⊆ discBd R := hside.resolve_left hnotcover + have hIntCap : discInt R ⊆ D := by + intro x hx + have hxall : x ∈ range j ∪ D := hcap.union_eq ▸ mem_univ x + rcases hxall with hj | hD + · exact (hx.2 (hboundary ⟨hx.1, hj⟩)).elim + · exact hD + have hRCap : R ⊆ D := hR.subset_closure_discInt.trans (closure_minimal hIntCap + hcap.isClosedDisc.isClosed) + have hFsub : F ⊆ C := by + intro x hx + have hjF : j x ∈ discBd R := hRbd.symm ▸ mem_image_of_mem j hx + have hjR : j x ∈ R := Surface.discBd_subset R hjF + have hjC : j x ∈ j '' C := hcap.inter_eq ▸ ⟨mem_range_self x, hRCap hjR⟩ + obtain ⟨y, hy, hyx⟩ := hjC + exact (hcap.isEmbedding.injective hyx) ▸ hy + exact eq_of_oArc_subset hF ((cuff_statement S hS).2.2 C hC) hFsub + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46CentralEnds.lean b/LeanPool/GraphMinor/GM07/Section46CentralEnds.lean new file mode 100644 index 0000000000..a1b4c4fe3d --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46CentralEnds.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46LongEdges +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46EdgeSegments +import LeanPool.GraphMinor.GM07.Section46WIntersections + +/-! +# The ends of central edges + +For `K` in VII (4.6), pages 225–226, the central edge on a long old +edge has exactly the two ends `W(e)`. Its closed parameter interval +lies inside that old edge, so it contains no old seam vertex and no +cut point belonging to another old edge. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +/-- The two ends of a central edge in `J⁺` are precisely `W(e)`, +in VII (4.6), pages 225–226. -/ +theorem central_edge_ends {S : Type*} [TopologicalSpace S] [T2Space S] + {G J J' : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (W : longSeamEdges G J μ w → Set S) (hW : ∀ f, W f ⊆ f.1) + (hV : J'.V = J.V ∪ ⋃ f, W f) (e : longSeamEdges G J μ w) + {s t : unitInterval} (hs : s ∈ Ioo 0 1) (ht : t ∈ Ioo 0 1) (hst : s < t) + (hWe : W e = {γ e.1 s, γ e.1 t}) : + closure (γ e.1 '' Ioo s t) ∩ J'.V = W e := by + rw [closure_image_Ioo_eq_Icc hγ e.2.1 hst (.inl hs.1), hV] + apply Subset.antisymm + · rintro x ⟨⟨u, hu, rfl⟩, hxV⟩ + have hu' : u ∈ Ioo (0 : unitInterval) 1 := ⟨hs.1.trans_le hu.1, hu.2.trans_lt ht.2⟩ + have hxE : γ e.1 u ∈ e.1 := + (congrArg (fun A => γ e.1 u ∈ A) (hγ.image e.1 e.2.1)).mp ⟨u, hu', rfl⟩ + rcases hxV with hxold | hxW + · exact ((e.2.1.2.1 hxE).2 hxold).elim + · have hx : γ e.1 u ∈ (⋃ f, W f) ∩ closure e.1 := ⟨hxW, subset_closure hxE⟩ + exact (W_inter_closed_long_edge W hW e) ▸ hx + · intro x hx + have hxW : x ∈ ⋃ f, W f := mem_iUnion.mpr ⟨e, hx⟩ + refine ⟨?_, .inr hxW⟩ + rw [hWe] at hx + rcases hx with rfl | rfl + · exact ⟨s, ⟨le_rfl, hst.le⟩, rfl⟩ + · exact ⟨t, ⟨hst.le, le_rfl⟩, rfl⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46CentralLift.lean b/LeanPool/GraphMinor/GM07/Section46CentralLift.lean new file mode 100644 index 0000000000..588684db68 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46CentralLift.lean @@ -0,0 +1,230 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46Matching +public import LeanPool.GraphMinor.GM07.Section46SeamPartsDefs +public import LeanPool.GraphMinor.GM07.Section46LongEdges +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46CentralEnds +import LeanPool.GraphMinor.GM07.Section46EdgeSegments +import LeanPool.GraphMinor.GM07.Section46OldVertices +import LeanPool.GraphMinor.GM07.Section46RetainedLinking +import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.GM07.NetExists +import LeanPool.GraphMinor.GM07.NetSwapBasic + +/-! +# The central edges in `Σ′` + +Over the open central edge the map `θ` has one point, because the edge +misses `U(L)` and `bd(Σ)`. So `ψ` agrees on the two sides of `Δ` over this +open edge, and by continuity over its ends as well. Hence `θ` is one-to-one +over `U(K)`, which is what the matching claim of VII (4.6), page 226, needs. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S S' : Type u} [TopologicalSpace S] [TopologicalSpace S'] + +theorem mem_U_iff_edge (Γ : Drawing S) {x : S} : x ∈ Γ.U ↔ x ∈ Γ.V ∨ ∃ e ∈ Γ.E, x ∈ e := by + constructor + · intro hx + by_cases hV : x ∈ Γ.V + · exact .inl hV + · have h : x ∈ Γ.U \ Γ.V := ⟨hx, hV⟩ + exact .inr ⟨_, pathComponentIn_mem_arcComponentsIn h, mem_pathComponentIn_self h⟩ + · rintro (h | ⟨e, he, hx⟩) + · exact Γ.V_subset_U h + · exact (he.2.1 hx).1 + +/-- The two sides of `Δ` agree under `ψ` over a closed central segment, in VII (4.6), page 226. -/ +theorem Net.psi_sides_eq (N : Net S) {L : Drawing S} {θ : S' → S} {ψ : N.D → S'} + (hθ : IsCutAlongGraph L S' θ) (hψc : Continuous ψ) (hψ : ∀ x, θ (ψ x) = N.φ x) + (i : Fin N.r) {s t : unitInterval} (hst : s < t) + (hoff : ∀ r ∈ Ioo s t, N.φ (N.f i r) ∉ bd S ∪ L.U) : + ∀ r ∈ Icc s t, ψ (N.f i r) = ψ (N.g i r) := by + have hS' := hθ.isSurface + have : T2Space S' := hS'.2.1 + have hcl : IsClosed {r : unitInterval | ψ (N.f i r) = ψ (N.g i r)} := + isClosed_eq (hψc.comp (N.f i).continuous) (hψc.comp (N.g i).continuous) + have hsub : Ioo s t ⊆ {r : unitInterval | ψ (N.f i r) = ψ (N.g i r)} := by + intro r hr + apply hθ.interior_inj + · intro hb + rw [← hθ.preimage_bd_union_U] at hb + apply hoff r hr + have h := hψ (N.f i r) + rw [mem_preimage, h] at hb + exact hb + · rw [hψ, hψ, N.pasting_eq] + have hc : closure (Ioo s t) = Icc s t := closure_Ioo hst.ne + rw [← hc] + exact closure_minimal hsub hcl + +section Central + +variable {G J J' K L : Drawing S} {γ : Set S → unitInterval → S} {μ w : ℕ} + {s t : longSeamEdges G J μ w → unitInterval} {W : longSeamEdges G J μ w → Set S} + +/-- All the local properties of `K` in `Σ` on page 226 of VII (4.6). -/ +theorem central_K_facts [T2Space S] (hS : IsSurface S) (N : Net S) + (hJ : N.IsSeamGraphFor J) (hγ : EdgePar J γ) + (hcuts : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)} ∧ (W e).ncard = 2) + (hsmall : (G.V ∩ bd S).ncard < 2 * μ + w + 2) + (hlong : ∀ e : longSeamEdges G J μ w, Disjoint e.1 (bd S)) + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ ⋃ e, W e) + (hKsub : K.IsSubdrawing J') (hKV : K.V = ⋃ e, W e) + (hKE : K.E = centralEdges G J μ w γ s t) + (hLsub : L.IsSubdrawing J') (hLV : L.V = J'.V) + (hLE : L.E = forestSeamEdges J' (centralEdges G J μ w γ s t)) : + IsPairing K ∧ K.IsProper ∧ K.V ⊆ L.U ∧ K.IsNormal L.U ∧ K.U ⊆ ⋃ e, γ e.1 '' Icc (s e) (t e) ∧ + bd S ∪ L.U ∪ K.U = N.seamU ∧ + ∀ e : longSeamEdges G J μ w, ∀ r ∈ Ioo (s e) (t e), γ e.1 r ∉ bd S ∪ L.U := by + have hcuts' : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)} := fun e => + ⟨(hcuts e).1, (hcuts e).2.1, (hcuts e).2.2.1, (hcuts e).2.2.2.1⟩ + have hclC : ∀ e : longSeamEdges G J μ w, closure (γ e.1 '' Ioo (s e) (t e)) = + γ e.1 '' Icc (s e) (t e) := fun e => + closure_image_Ioo_eq_Icc hγ e.2.1 (hcuts e).2.2.1 (.inl (hcuts e).1.1) + have hCe : ∀ e : longSeamEdges G J μ w, γ e.1 '' Icc (s e) (t e) ⊆ e.1 := fun e => by + rw [← hclC e] + exact central_closure_subset_old_edge hγ e.2.1 (hcuts e).1 (hcuts e).2.1 (hcuts e).2.2.1 + have hWC : ∀ e : longSeamEdges G J μ w, W e ⊆ γ e.1 '' Icc (s e) (t e) := by + intro e x hx + rw [(hcuts e).2.2.2.1] at hx + have hle := (hcuts e).2.2.1.le + rcases hx with rfl | rfl + · exact ⟨s e, ⟨le_rfl, hle⟩, rfl⟩ + · exact ⟨t e, ⟨hle, le_rfl⟩, rfl⟩ + have hWe : ∀ e : longSeamEdges G J μ w, W e ⊆ e.1 := fun e => (hWC e).trans (hCe e) + have hKUsub : K.U ⊆ ⋃ e, γ e.1 '' Icc (s e) (t e) := by + intro x hx + rcases (mem_U_iff_edge K).mp hx with h | ⟨f, hf, hxf⟩ + · rw [hKV] at h + obtain ⟨e, he⟩ := mem_iUnion.mp h + exact mem_iUnion.mpr ⟨e, hWC e he⟩ + · rw [hKE] at hf + obtain ⟨e, rfl⟩ := hf + exact mem_iUnion.mpr ⟨e, hclC e ▸ subset_closure hxf⟩ + have hclK : ∀ f ∈ K.E, closure f ∩ K.V ⊆ closure f ∩ J'.V := fun f _ x hx => + ⟨hx.1, hKsub.1 hx.2⟩ + have hCE : ∀ e : longSeamEdges G J μ w, γ e.1 '' Ioo (s e) (t e) ∈ K.E := fun e => by + rw [hKE] + exact ⟨e, rfl⟩ + have hends : ∀ e, closure (γ e.1 '' Ioo (s e) (t e)) ∩ K.V = W e := by + intro e + apply Subset.antisymm + · rw [← central_edge_ends hγ W hWe hV e (hcuts e).1 (hcuts e).2.1 (hcuts e).2.2.1 + (hcuts e).2.2.2.1] + exact hclK _ (hCE e) + · intro x hx + refine ⟨hclC e ▸ hWC e hx, ?_⟩ + rw [hKV] + exact mem_iUnion.mpr ⟨e, hx⟩ + have hpair : IsPairing K := by + intro v hv + rw [hKV] at hv + obtain ⟨e, he⟩ := mem_iUnion.mp hv + refine ⟨_, hCE e, hclC e ▸ hWC e he, ?_, ?_⟩ + · rw [tilde_eq_closure_inter_V K (hCE e), hends e] + exact (hcuts e).2.2.2.2 + · intro f hf hvf + have hf' := hf + rw [hKE] at hf' + obtain ⟨e', rfl⟩ := hf' + have h1 : v ∈ e'.1 := hCe e' (hclC e' ▸ hvf) + have h2 : v ∈ e.1 := hWe e he + have hee : e' = e := Subtype.ext (arcComponentsIn_eq_of_mem e'.2.1 e.2.1 h1 h2) + rw [hee] + have hprop : K.IsProper := by + intro x hx + obtain ⟨e, he⟩ := mem_iUnion.mp (hKUsub hx.2) + exact (disjoint_left.mp (hlong e) (hCe e he) hx.1).elim + have hVL : K.V ⊆ L.U := by + intro x hx + rw [hKV] at hx + obtain ⟨e, he⟩ := mem_iUnion.mp hx + have hx' := he + rw [(hcuts e).2.2.2.1] at hx' + have hs := hcuts e + have hL1 : γ e.1 '' Ioo 0 (s e) ∈ L.E := by + rw [hLE] + exact linking_edge_mem_forestSeamEdges hS N hJ hγ s t W hcuts' hsmall hU hV (.inl ⟨e, rfl⟩) + have hL2 : γ e.1 '' Ioo (t e) 1 ∈ L.E := by + rw [hLE] + exact linking_edge_mem_forestSeamEdges hS N hJ hγ s t W hcuts' hsmall hU hV (.inr ⟨e, rfl⟩) + rcases hx' with rfl | rfl + · apply L.closure_subset_U hL1 + rw [closure_image_Ioo_eq_Icc hγ e.2.1 hs.1.1 (.inr hs.1.2)] + exact ⟨s e, ⟨bot_le, le_rfl⟩, rfl⟩ + · apply L.closure_subset_U hL2 + rw [closure_image_Ioo_eq_Icc hγ e.2.1 hs.2.1.2 (.inl hs.2.1.1)] + exact ⟨t e, ⟨le_rfl, le_top⟩, rfl⟩ + have hoffL : ∀ e, ∀ x ∈ γ e.1 '' Ioo (s e) (t e), x ∉ L.U := by + intro e x hx hxL + have hC : γ e.1 '' Ioo (s e) (t e) ∈ J'.E := hKsub.2 (hCE e) + have hxU := hC.2.1 hx + rcases (mem_U_iff_edge L).mp hxL with h | ⟨f, hf, hxf⟩ + · rw [hLV] at h + exact hxU.2 h + · have hfE : f ∈ forestSeamEdges J' (centralEdges G J μ w γ s t) := hLE ▸ hf + have heq := arcComponentsIn_eq_of_mem hfE.1 hC hxf hx + exact hfE.2.1 (heq ▸ ⟨e, rfl⟩) + have hnormal : K.IsNormal L.U := by + rintro x ⟨hxL, hxK⟩ + rcases (mem_U_iff_edge K).mp hxK with h | ⟨f, hf, hxf⟩ + · exact h + · have hf' := hf + rw [hKE] at hf' + obtain ⟨e, rfl⟩ := hf' + exact (hoffL e x hxf hxL).elim + have hcover : bd S ∪ L.U ∪ K.U = N.seamU := by + apply Subset.antisymm + · have hJ'U : ∀ x, x ∈ J'.U → x ∈ N.seamU := fun x hx => by + rw [hU, hJ.2.1] at hx + exact hx + have hsubU : ∀ {P : Drawing S}, P.IsSubdrawing J' → ∀ x ∈ P.U, x ∈ N.seamU := by + intro P hP x hx + apply hJ'U + rcases (mem_U_iff_edge P).mp hx with h | ⟨f, hf, hxf⟩ + · exact J'.V_subset_U (hP.1 h) + · exact ((hP.2 hf).2.1 hxf).1 + rintro x ((h | h) | h) + · exact N.bd_subset_seamU h + · exact hsubU hLsub x h + · exact hsubU hKsub x h + · intro x hx + have hx' : x ∈ J'.U := by + rw [hU, hJ.2.1] + exact hx + rcases (mem_U_iff_edge J').mp hx' with h | ⟨f, hf, hxf⟩ + · exact .inl (.inr (L.V_subset_U (hLV ▸ h))) + · by_cases hc : f ∈ centralEdges G J μ w γ s t + · have hfK : f ∈ K.E := hKE ▸ hc + exact .inr (hfK.2.1 hxf).1 + · by_cases hb : f ⊆ bd S + · exact .inl (.inl (hb hxf)) + · have hfL : f ∈ L.E := hLE ▸ ⟨hf, hc, hb⟩ + exact .inl (.inr (hfL.2.1 hxf).1) + refine ⟨hpair, hprop, hVL, hnormal, hKUsub, hcover, ?_⟩ + rintro e r hr (hb | hb) + · exact disjoint_left.mp (hlong e) (hCe e (image_mono Ioo_subset_Icc_self ⟨r, hr, rfl⟩)) hb + · exact hoffL e _ ⟨r, hr, rfl⟩ hb + +end Central + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46ChooseLift.lean b/LeanPool/GraphMinor/GM07/Section46ChooseLift.lean new file mode 100644 index 0000000000..f708992016 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46ChooseLift.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.MinimalNet +import LeanPool.GraphMinor.GM07.Section46Constants +import LeanPool.GraphMinor.GM07.Section46FibreValency +import LeanPool.GraphMinor.GM07.Section46FirstEdge +import Mathlib.Combinatorics.Pigeonhole + +/-! +# Choosing the lift `l(z)` in VII (4.6) + +On page 225, assign each indexed path to the unique lifted incidence of +its first edge. The fibre bound and the definition of `v` ensure that at +least `μ` paths have the same incidence. The count uses indexed paths, +so it also applies when a one-edge path occurs more than once. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +universe u + +/-- The choice of `l(z)` in VII (4.6), page 225, for the paths obtained +in the first step of the proof. At least `μ` lifted first edges are incident +with the chosen point over `z`. -/ +theorem Net.exists_common_lifted_first_edge {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {a b c k : ℕ} + (hc : 2 ≤ c) (hmodel : Nonempty (S ≃ₜ SurfaceModel a b c)) + {G J : Drawing S} (hG : G.IsProper) (hmin : N.IsMinimalFor G) + (hJ : N.IsSeamGraphFor J) (hnorm : G.IsNormal J.U) + {z : S} (hzbd : z ∈ bd S) + (P : Fin (vModel a b c k - 2 * k) → Drawing S) + (t : Fin (vModel a b c k - 2 * k) → S) + (hP : ∀ i, (P i).IsSubdrawing G ∧ z ≠ t i ∧ (P i).IsPathBetween z (t i)) : + ∃ l : N.D, N.φ l = z ∧ + ∃ I : Finset (Fin (vModel a b c k - 2 * k)), muModel a b c k ≤ I.card ∧ + ∀ i ∈ I, ∃ e ∈ (P i).E, l ∈ closure (N.φ ⁻¹' e) ∧ + ∀ x ∈ closure (N.φ ⁻¹' e), N.φ x = z → x = l := by + classical + have hfirst := fun i => + N.exists_lifted_first_edge hS hJ hnorm (hP i).1 (hP i).2.1 (hP i).2.2 + choose e he l hl hle hu using hfirst + let X := N.φ ⁻¹' {z} + have : Finite X := (N.finite_fiber z).to_subtype + let : Fintype X := Fintype.ofFinite X + have : Nonempty X := by + obtain ⟨x, hx⟩ := N.quotientMap_φ.surjective z + exact ⟨⟨x, hx⟩⟩ + let f : Fin (vModel a b c k - 2 * k) → X := fun i => ⟨l i, hl i⟩ + have hbound := N.boundary_fibre_ncard_bound_4_6 hS (by omega) hmodel hG hmin hJ hzbd + have hmul : Fintype.card X * muModel a b c k ≤ + Fintype.card (Fin (vModel a b c k - 2 * k)) := by + rw [← Nat.card_eq_fintype_card, Nat.card_coe_set_eq, Fintype.card_fin] + exact (Nat.mul_le_mul_right _ hbound).trans (constants_bounds_4_6 hc).2.2 + obtain ⟨l₀, hcount⟩ := Fintype.exists_le_card_fiber_of_mul_le_card f hmul + refine ⟨l₀, l₀.2, Finset.univ.filter (fun i => f i = l₀), hcount, ?_⟩ + intro i hi + have hi' : f i = l₀ := (Finset.mem_filter.mp hi).2 + have hil : l i = l₀.1 := congrArg Subtype.val hi' + refine ⟨e i, he i, hil ▸ hle i, ?_⟩ + intro x hx hxz + exact (hu i x hx hxz).trans hil + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46CircleCuff.lean b/LeanPool/GraphMinor/GM07/Section46CircleCuff.lean new file mode 100644 index 0000000000..43bdd27f53 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46CircleCuff.lean @@ -0,0 +1,48 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section46NullCircle +import LeanPool.GraphMinor.GM07.Section46CappedCircle + +/-! +# Small seam circles are cuffs + +The circle claim on page 226 of VII (4.6) uses hypothesis (ii). +A null circle in the original surface is excluded by the unique dense +seam region. In the capped-cuff alternative, the bounded disc meets +the original surface only along its boundary, forcing the circle to +be that cuff. No part of this disc argument is an extra hypothesis. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +/-- The topological circle claim of VII (4.6), page 226, applied to +any small `G`-normal circle contained in the seam. -/ +theorem Net.small_normal_circle_in_seam_is_cuff {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) (hcuffs : 2 ≤ (cuffs S).ncard) + {G : Drawing S} {v : ℕ} + (hii : ∀ B : Set S, G.IsNormal B → IsOArc B → (G.V ∩ B).ncard ≤ v → + IsNullHomotopicOArc B ∨ + ∃ C ∈ cuffs S, IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) + {F : Set S} (hF : IsOArc F) (hnorm : G.IsNormal F) + (hsmall : (G.V ∩ F).ncard ≤ v) (hFU : F ⊆ N.seamU) : F ∈ cuffs S := by + rcases hii F hnorm hF hsmall with hnull | ⟨C, hC, hcap, hVCF⟩ + · exact (N.not_nullHomotopic_circle_in_seam hS hcuffs hF hFU hnull).elim + · have hVC : (G.V ∩ C).Nonempty := Set.nonempty_of_ncard_ne_zero (by have h := hiii C hC; omega) + have heq := N.capped_circle_eq_cuff hS hcuffs hF hFU hC hcap hVC hVCF + exact heq.symm ▸ hC + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46ClaimOne.lean b/LeanPool/GraphMinor/GM07/Section46ClaimOne.lean new file mode 100644 index 0000000000..fb20484831 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46ClaimOne.lean @@ -0,0 +1,435 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section44 +public import LeanPool.GraphMinor.GM07.PushForest +public import LeanPool.GraphMinor.GM07.Section46Matching +import LeanPool.GraphMinor.GM07.Section3 +import LeanPool.GraphMinor.GM07.Section41 +import LeanPool.GraphMinor.GM07.Section46MatchedId +import LeanPool.GraphMinor.GM07.Section46Refine +import LeanPool.GraphMinor.GM07.CuffForest +import LeanPool.GraphMinor.GM07.CuffStep +import LeanPool.GraphMinor.GM07.ForestFlat +import LeanPool.GraphMinor.GM19.Section6Delete + +/-! +# Claim (1) of VII (4.6) + +Page 227: (4.4) gives `H₁` off `U(L)`, with the set `M₂` isolated in its +pullback. We delete `M₂`, and (3.6) gives `H₃` with few crossings of the +matching. A slide puts the crossings at vertices. We add `M₂` back to get +`H₄`, apply (4.5) to get `H₅ = θ(H₄)`, and add `V(G)` to get `H₆`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S S' : Type} [TopologicalSpace S] [TopologicalSpace S'] + +/-- The forest `H₂` from which the isolated vertices `M₂` are deleted. -/ +private theorem exists_delete_isolated [T2Space S'] {H' : Drawing + S'} + (hH' : IsSurfaceForest H') {M : Set S'} (hM : ∀ z ∈ M, IsIsolatedVertex H' z) : + ∃ H₂ : Drawing S', H₂.U = H'.U \ M ∧ H₂.V = H'.V \ M ∧ H₂.E = H'.E ∧ IsSurfaceForest H₂ := by + have hoff : ∀ e ∈ H'.E, Disjoint (tilde e) M := by + intro e he + rw [disjoint_left] + intro z hz hzM + exact (hM z hzM).2 e he (((GraphMinor.GM07.vertexIncident_iff_mem_tilde H' + (hM z hzM).1 he)).mpr hz) + have hoff' : ∀ e ∈ H'.E, Disjoint (closure e) M := by + intro e he + rw [disjoint_left] + intro z hz hzM + exact (hM z hzM).2 e he ⟨(hM z hzM).1, .inl he, hz⟩ + let H₂ := GM19.delete H' M + have hE : H₂.E = H'.E := by + rw [GM19.delete_E] + ext e + exact ⟨fun h => h.1, fun h => ⟨h, hoff e h⟩⟩ + have hV : H₂.V = H'.V \ M := GM19.delete_V H' M + have hU : H₂.U = H'.U \ M := by + apply Subset.antisymm + · rw [GM19.delete_U] + rintro x (hx | hx) + · exact ⟨H'.V_subset_U hx.1, hx.2⟩ + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact ⟨H'.closure_subset_U he.1 hxe, fun h => disjoint_left.mp (hoff' e he.1) hxe h⟩ + · rintro x ⟨hxU, hxM⟩ + rcases (mem_U_iff_edge H').mp hxU with h | ⟨e, he, hxe⟩ + · exact H₂.V_subset_U (hV ▸ ⟨h, hxM⟩) + · have : e ∈ H₂.E := hE ▸ he + exact (this.2.1 hxe).1 + refine ⟨H₂, hU, hV, hE, ?_, IsGraphForest.of_subdrawing hH'.2 (GM19.delete_subdrawing H' M)⟩ + rintro x ⟨hb, hx⟩ + rw [hU] at hx + rw [hV] + exact ⟨hH'.1 ⟨hb, hx.1⟩, hx.2⟩ + +private theorem mapDrawing_E {X : Type} [TopologicalSpace X] (α : X ≃ₜ X) (H : Drawing X) : + (mapDrawingHomeo α H).E = image α '' H.E := by + change arcComponentsIn (α '' H.U \ α '' H.V) = _ + rw [← image_sdiff α.injective] + exact arcComponentsIn_image_homeo α _ + +private theorem homotopic_refl {X : Type} [TopologicalSpace X] (hX : IsSurface X) {H : Drawing X} + (hH : IsSurfaceForest H) : ForestsHomotopic H H := by + have : T2Space X := hX.2.1 + have : CompactSpace X := hX.1 + refine ForestsHomotopic.refl hH fun s _ t _ _ P₁ P₂ φ₁ φ₂ _ _ h₁ h₂ => ?_ + have e₁ := h₁.endpoints + have e₂ := h₂.endpoints + exact IsFlat.curvesHomotopic (isFlat_forest hH.2) h₁.range_subset_U h₂.range_subset_U + (e₁.1.trans e₂.1.symm) (e₁.2.trans e₂.2.symm) + +private theorem homoplastic_of_homotopic {X : Type} [TopologicalSpace X] {H₁ H₂ : Drawing X} + (h : ForestsHomotopic H₁ H₂) : ForestsHomoplastic H₁ H₂ := by + refine ⟨Homeomorph.refl X, fun _ _ => rfl, ?_⟩ + have : mapDrawingHomeo (Homeomorph.refl X) H₁ = H₁ := drawing_eq (image_id _) (image_id _) + rw [this] + exact h + +private theorem map_matches_after_isolated_deletion + {S' : Type} + [TopologicalSpace S'] + (Hp : Drawing S') : + ∀ (P : Set S'), + ∀ (M₁ : Set S'), + let M₂ : Set S' := P \ M₁ + (P ⊆ bd S') → + (∀ z ∈ M₂, IsIsolatedVertex Hp z) → + ∀ (H₂ : Drawing S'), + (H₂.U = Hp.U \ M₂) → + (H₂.V = Hp.V \ M₂) → + (H₂.E = Hp.E) → + ∀ (α : S' ≃ₜ S'), + (∀ x ∈ bd S', α x = x) → + (⇑α '' M₂ = M₂) → + (∀ e ∈ Hp.E, Disjoint (closure e) M₂) → + IsMatched (mapDrawingHomeo α Hp) (mapDrawingHomeo α H₂) id M₂ := by + intro P M₁ M₂ hPbd hM₂iso H₂ h2U h2V h2E α hα hαM hoffp + refine isMatched_id ?_ ?_ ?_ ?_ ?_ + · intro x hx + exact ⟨x, (hM₂iso x hx).1, hα x (hPbd hx.1)⟩ + · intro e he + rw [mapDrawing_E] at he + obtain ⟨e₀, he₀, rfl⟩ := he + rw [← α.image_closure, disjoint_left] + rintro _ ⟨y, hy, rfl⟩ hz + have hyM : y ∈ M₂ := by + have := hα (α y) (hPbd hz.1) + have heq : α y = y := α.injective this + rwa [heq] at hz + exact disjoint_left.mp (hoffp e₀ he₀) hy hyM + · change α '' Hp.U \ M₂ = α '' H₂.U + nth_rewrite 1 [← hαM] + rw [← image_sdiff α.injective, h2U] + · change α '' Hp.V \ M₂ = α '' H₂.V + nth_rewrite 1 [← hαM] + rw [← image_sdiff α.injective, h2V] + · rw [mapDrawing_E, mapDrawing_E, h2E] + +private theorem pushforward_forest_is_saturated + {S : Type} + {S' : Type} + [TopologicalSpace S] + [TopologicalSpace S'] + {L : Drawing S} + {G : Drawing S} + {θ : S' → S} + (hθ : IsCutAlongGraph L S' θ) + (P : Set S') (hP : P = θ ⁻¹' (G.V ∩ bd S)) + (H₄ : Drawing S') + (hp₄ : H₄.IsProper) + (h4bd : H₄.V ∩ bd S' = P) + (H₅ : Drawing S) + (himg : IsImageDrawing θ H₄ H₅) : + θ ⁻¹' H₅.U = H₄.U := by + apply Subset.antisymm + · intro y hy + have hy' : θ y ∈ θ '' H₄.U := himg.1 ▸ hy + obtain ⟨x, hx, hxy⟩ := hy' + by_cases hxb : x ∈ bd S' + · have hxP : x ∈ P := h4bd ▸ ⟨hp₄ ⟨hxb, hx⟩, hxb⟩ + have hyP : y ∈ P := by + rw [hP] at hxP ⊢ + change θ y ∈ G.V ∩ bd S + rw [← hxy] + exact hxP + exact H₄.V_subset_U (h4bd.symm.subset hyP).1 + · rw [← hθ.interior_inj x hxb y hxy] + exact hx + · intro y hy + change θ y ∈ H₅.U + rw [himg.1] + exact mem_image_of_mem θ hy + +private theorem refined_forest_meets_cut_only_at_graph_vertices + {S : Type} + {S' : Type} + [TopologicalSpace S] + [TopologicalSpace S'] + {L : Drawing S} + {K : Drawing S} + {G : Drawing S} + {K' : Drawing S'} + {θ : S' → S} + (hK'p : IsPullbackDrawing θ K K') + (M₂ : Set S') + (H₃₀ : Drawing S') + (β : S' ≃ₜ S') + (hβG : ∀ x ∈ K'.U ∩ H₃₀.U, β x ∈ θ ⁻¹' G.V) + (H₃ : Drawing S') + (hKH : H₃.U ∩ K'.U ⊆ ⇑β '' (K'.U ∩ H₃₀.U)) + (H₄ : Drawing S') (h4U : H₄.U = H₃.U ∪ M₂) (hM₂ : M₂ ⊆ θ ⁻¹' G.V) + (H₅ : Drawing S) + (himg : IsImageDrawing θ H₄ H₅) + (H₆ : Drawing S) + (h6U : H₆.U = H₅.U ∪ G.V) + (hG₄ : ∀ y ∈ H₄.U, θ y ∈ bd S ∪ L.U → θ y ∈ G.V ∩ bd S) : + H₆.U ∩ (bd S ∪ L.U ∪ K.U) ⊆ G.V := by + rintro x ⟨hx, hxJ⟩ + rw [h6U] at hx + rcases hx with hx | hx + · rw [himg.1] at hx + obtain ⟨y, hy, rfl⟩ := hx + rcases hxJ with hxJ | hxK + · exact (hG₄ y hy hxJ).1 + · have hyK : y ∈ K'.U := hK'p.1 ▸ hxK + rw [h4U] at hy + rcases hy with hy | hy + · obtain ⟨z, ⟨hz₁, hz₂⟩, hz⟩ := hKH ⟨hy, hyK⟩ + have := hβG z ⟨hz₁, hz₂⟩ + rw [hz] at this + exact this + · exact hM₂ hy + · exact hx + +/-- Claim (1) of VII (4.6), page 227, with the set `T = U(H₃)`, which contains the closure of each +edge of `θ⁻¹(H₆)`. -/ +theorem exists_claim_one [T1Space S] [ConnectedSpace S] (hS : IsSurface S) + {L K G H : Drawing S} {K' : Drawing S'} {θ : S' → S} (hθ : IsCutAlongGraph L S' θ) + (hNo : NoArcs L) (hH : IsSurfaceForest H) (hbd : G.V ∩ bd S = H.V ∩ bd S) {k n w : ℕ} + (hcard : (G.V ∩ bd S).ncard ≤ 2 * k) (l' : S → S') + (hl : ∀ z ∈ G.V ∩ bd S, θ (l' z) = z) (hK'p : IsPullbackDrawing θ K K') + (hK'm : IsMatching K') (hK'c : K'.V.ncard ≤ 2 * n) (hw : IsW36Bound S' (2 * k) n w) + (hslide : ∀ X : Set S', X.Finite → X ⊆ K'.U → X.ncard ≤ w → + ∃ β : S' ≃ₜ S', (∀ x ∈ bd S', β x = x) ∧ K'.U ⊆ β '' K'.U ∧ ∀ x ∈ X, β x ∈ θ ⁻¹' G.V) : + ∃ (H₆ : Drawing S) (H₆' : Drawing S') (T : Set S'), IsSurfaceForest H₆ ∧ + ForestsHomoplastic H H₆ ∧ IsPullbackDrawing θ H₆ H₆' ∧ IsSurfaceForest H₆' ∧ + (∀ e' ∈ H₆'.E, ∃ e ∈ H₆.E, e' = θ ⁻¹' e ∧ θ '' closure e' = closure e ∧ InjOn θ (closure e')) + ∧ + H₆.U ∩ (bd S ∪ L.U ∪ K.U) ⊆ G.V ∧ G.V ⊆ H₆.V ∧ IsClosed T ∧ (∀ e' ∈ H₆'.E, closure e' ⊆ T) ∧ + (T ∩ K'.U).Finite ∧ (T ∩ K'.U).ncard ≤ w ∧ ∀ z ∈ T ∩ bd S', z ∈ l' '' (G.V ∩ bd S) := by + classical + have : T2Space S := hS.2.1 + have hS' := hθ.isSurface + have : T2Space S' := hS'.2.1 + have : CompactSpace S' := hS'.1 + have hs := hθ.quotientMap.surjective + have : Nonempty S' := by + obtain ⟨x⟩ : Nonempty S := inferInstance + exact ⟨(hs x).choose⟩ + obtain ⟨H₁, H', hH₁, hhom₁, hH₁L, hpull, hiso⟩ := theorem_4_4_proof hS L θ hθ + (fun F hF => ⟨hNo.1 F hF, hNo.2 F hF⟩) H l' hH (fun z hz => hl z (hbd ▸ hz)) + have hnorm₁ : H₁.IsNormal L.U := fun x hx => hH₁.1 ⟨hH₁L ⟨hx.2, hx.1⟩, hx.2⟩ + obtain ⟨Hp, hpp, hHpf, hpush⟩ := theorem_4_5_proof hS L H₁ θ hθ hH₁ hnorm₁ + have hHeq : Hp = H' := drawing_eq (hpp.1.trans hpull.1.symm) (hpp.2.trans hpull.2.symm) + subst hHeq + have hbdsub : ∀ x, θ x ∈ bd S → x ∈ bd S' := fun x hx => by + rw [← hθ.preimage_bd_union_U] + exact .inl hx + have hbdL : ∀ x, x ∈ bd S' → θ x ∈ bd S ∨ θ x ∈ L.U := fun x hx => by + rw [← hθ.preimage_bd_union_U] at hx + exact hx + let P : Set S' := θ ⁻¹' (G.V ∩ bd S) + let M₁ : Set S' := l' '' (G.V ∩ bd S) + let M₂ : Set S' := P \ M₁ + have hG₁ : H₁.V ∩ bd S = G.V ∩ bd S := hhom₁.2.2.2.2.1.trans hbd.symm + have hPV : Hp.V ∩ bd S' = P := by + ext x + constructor + · rintro ⟨hxV, hxb⟩ + rw [hpull.2] at hxV + have hxb' : θ x ∈ bd S := by + rcases hbdL x hxb with h | h + · exact h + · exact hH₁L ⟨H₁.V_subset_U hxV, h⟩ + change θ x ∈ G.V ∩ bd S + rw [← hG₁] + exact ⟨hxV, hxb'⟩ + · intro hx + have hx' : θ x ∈ H₁.V ∩ bd S := hG₁ ▸ hx + exact ⟨by rw [hpull.2]; exact hx'.1, hbdsub x hx'.2⟩ + have hM₁P : M₁ ⊆ P := by + rintro _ ⟨z, hz, rfl⟩ + change θ (l' z) ∈ G.V ∩ bd S + rw [hl z hz] + exact hz + have hPbd : P ⊆ bd S' := fun x hx => hbdsub x hx.2 + have hPf : P.Finite := Set.Finite.preimage' (G.finite_V.subset inter_subset_left) + fun b _ => hθ.finite_fiber b + have hMf : M₂.Finite := hPf.subset sdiff_subset + have hM₂iso : ∀ z ∈ M₂, IsIsolatedVertex Hp z := by + rintro z ⟨hzP, hzM⟩ + have hmem : θ z ∈ H.V ∩ bd S := hbd ▸ hzP + exact hiso (θ z) hmem z ⟨rfl, fun h => hzM ⟨θ z, hzP, (show z = l' (θ z) from h).symm⟩⟩ + obtain ⟨H₂, h2U, h2V, h2E, hF₂⟩ := exists_delete_isolated hHpf hM₂iso + have h2bd : H₂.V ∩ bd S' = M₁ := by + rw [h2V] + ext x + constructor + · rintro ⟨⟨hxV, hxM⟩, hxb⟩ + have hxP : x ∈ P := hPV ▸ ⟨hxV, hxb⟩ + by_contra hn + exact hxM ⟨hxP, hn⟩ + · intro hx + have hxP := hM₁P hx + have h' : x ∈ Hp.V ∩ bd S' := hPV ▸ hxP + exact ⟨⟨h'.1, fun h => h.2 hx⟩, h'.2⟩ + have hM₁f : (G.V ∩ bd S).Finite := G.finite_V.subset inter_subset_left + have hM₁c : M₁.ncard ≤ 2 * k := (ncard_image_le hM₁f).trans hcard + obtain ⟨H₃₀, hF₃₀, hH₃₀, hfin, hle⟩ := hw K' H₂ hK'm hK'c hF₂ (by rw [h2bd]; exact hM₁c) + obtain ⟨β, hβbd, hβK, hβG⟩ := hslide _ hfin inter_subset_left hle + let H₃ := mapDrawingHomeo β H₃₀ + have hmap := ForestsHomotopic.map_homeo β (homotopic_refl hS' hF₃₀) + have hF₃ : IsSurfaceForest H₃ := ⟨hmap.1, hmap.2.2.1⟩ + have hhom₂₃ : ForestsHomoplastic H₂ H₃ := hH₃₀.trans ⟨β, hβbd, hmap⟩ + have hKH : H₃.U ∩ K'.U ⊆ β '' (K'.U ∩ H₃₀.U) := by + rintro y ⟨⟨z, hz, rfl⟩, hyK⟩ + obtain ⟨z', hz', hzz⟩ := hβK hyK + have heq : z' = z := β.injective hzz + exact ⟨z, ⟨heq ▸ hz', hz⟩, rfl⟩ + have h3bd : H₃.V ∩ bd S' = M₁ := (bd_inter_V_eq_of_homoplastic hhom₂₃).symm.trans h2bd + have hdis : Disjoint M₂ H₃.U := by + rw [disjoint_left] + intro x hx hxU + have hxb := hPbd hx.1 + have : x ∈ M₁ := h3bd ▸ ⟨hF₃.1 ⟨hxb, hxU⟩, hxb⟩ + exact hx.2 this + let H₄ := addIsolated H₃ M₂ hMf hdis + have hsdiffU : (H₃.U ∪ M₂) \ M₂ = H₃.U := by + rw [union_sdiff_right, sdiff_eq_left.mpr hdis.symm] + have hsdiffV : (H₃.V ∪ M₂) \ M₂ = H₃.V := by + rw [union_sdiff_right, sdiff_eq_left.mpr (hdis.symm.mono_left H₃.V_subset_U)] + have h4E : H₄.E = H₃.E := by + change arcComponentsIn _ = arcComponentsIn _ + congr 1 + ext x + simp only [H₄, addIsolated, mem_sdiff, mem_union, not_or] + constructor + · rintro ⟨h1 | h1, h2, h3⟩ + · exact ⟨h1, h2⟩ + · exact absurd h1 h3 + · rintro ⟨h1, h2⟩ + exact ⟨.inl h1, h2, fun h3 => disjoint_left.mp hdis h3 h1⟩ + have m₂ : IsMatched H₄ H₃ id M₂ := isMatched_id (fun x hx => Or.inr hx) + (fun e he => (hdis.symm.mono_left (H₃.closure_subset_U (h4E ▸ he)))) hsdiffU hsdiffV h4E.symm + have hp₄ : H₄.IsProper := by + rintro x ⟨hb, hx | hx⟩ + · exact .inl (hF₃.1 ⟨hb, hx⟩) + · exact .inr hx + have hF₄ : IsSurfaceForest H₄ := ⟨hp₄, m₂.isGraphForest_iff.mpr hF₃.2⟩ + have h4bd : H₄.V ∩ bd S' = P := by + ext x + constructor + · rintro ⟨hx | hx, hb⟩ + · have : x ∈ M₁ := h3bd ▸ ⟨hx, hb⟩ + exact hM₁P this + · exact hx.1 + · intro hx + refine ⟨?_, hPbd hx⟩ + by_cases hm : x ∈ M₁ + · exact .inl (h3bd.symm.subset hm).1 + · exact .inr ⟨hx, hm⟩ + obtain ⟨α, hα, hhomα⟩ := hhom₂₃ + have hαM : α '' M₂ = M₂ := by + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + rw [hα y (hPbd hy.1)] + exact hy + · intro hx + exact ⟨x, hx, hα x (hPbd hx.1)⟩ + have hoffp : ∀ e ∈ Hp.E, Disjoint (closure e) M₂ := by + intro e he + rw [disjoint_left] + intro z hz hzM + exact (hM₂iso z hzM).2 e he ⟨(hM₂iso z hzM).1, .inl he, hz⟩ + have m₁ : IsMatched (mapDrawingHomeo α Hp) (mapDrawingHomeo α H₂) id M₂ := by + exact map_matches_after_isolated_deletion (S' := S') Hp P M₁ hPbd hM₂iso H₂ h2U h2V h2E α + hα hαM hoffp + have hmap' := ForestsHomotopic.map_homeo α (homotopic_refl hS' hHpf) + have hbdα : (mapDrawingHomeo α Hp).V ∩ bd S' = H₄.V ∩ bd S' := by + rw [h4bd] + ext x + constructor + · rintro ⟨⟨y, hy, rfl⟩, hb⟩ + have hy' : y ∈ bd S' := by + rw [← image_bd_homeomorph α] at hb + obtain ⟨y', hy', hyy⟩ := hb + rwa [← α.injective hyy] + rw [hα y hy'] + exact hPV ▸ ⟨hy, hy'⟩ + · intro hx + have h' : x ∈ Hp.V ∩ bd S' := hPV ▸ hx + exact ⟨⟨x, h'.1, hα x h'.2⟩, h'.2⟩ + have hhom₄ : ForestsHomoplastic Hp H₄ := + ⟨α, hα, ForestsHomotopic.of_matched_id m₁ m₂ hhomα hmap'.1 hp₄ hbdα⟩ + obtain ⟨H₅, himg, hF₅, hhom₅⟩ := hpush H₄ hF₄ hhom₄.symm + have hH₅H : ForestsHomoplastic H H₅ := + (hhom₅.trans (homoplastic_of_homotopic hhom₁)).symm + have h5bd : H₅.V ∩ bd S = G.V ∩ bd S := (bd_inter_V_eq_of_homoplastic hH₅H).symm.trans hbd.symm + obtain ⟨H₆, h6U, h6V, hF₆, hhom₆, -⟩ := exists_refined_forest hS hF₅ G.finite_V + (fun x hx => (h5bd.symm.subset hx).1) + have hsat : θ ⁻¹' H₅.U = H₄.U := by + exact pushforward_forest_is_saturated (S := S) (S' := S') (L := L) (G := G) (θ := θ) hθ P rfl H₄ + hp₄ h4bd H₅ himg + have hG₄ : ∀ y ∈ H₄.U, θ y ∈ bd S ∪ L.U → θ y ∈ G.V ∩ bd S := by + intro y hy hb + have hyb : y ∈ bd S' := by + rw [← hθ.preimage_bd_union_U] + exact hb + exact (h4bd.subset ⟨hp₄ ⟨hyb, hy⟩, hyb⟩ : y ∈ P) + have hmain : H₆.U ∩ (bd S ∪ L.U ∪ K.U) ⊆ G.V := by + exact refined_forest_meets_cut_only_at_graph_vertices (S := S) (S' := S') (L := L) (K := K) (G + := G) (K' := K') (θ := θ) hK'p M₂ H₃₀ β hβG H₃ hKH H₄ rfl + (fun _ hx => hx.1.1) H₅ himg H₆ h6U hG₄ + have hGV : G.V ⊆ H₆.V := h6V ▸ subset_union_right + have hnorm₆ : H₆.IsNormal L.U := fun x hx => hGV (hmain ⟨hx.2, .inl (.inr hx.1)⟩) + obtain ⟨H₆', hp₆, hprop₆, hE₆⟩ := exists_pullback hS hθ hF₆ hnorm₆ + refine ⟨H₆, H₆', H₃.U, hF₆, hH₅H.trans (homoplastic_of_homotopic hhom₆), hp₆, + ⟨hprop₆, isGraphForest_pullback hs hF₆.2 hp₆.2 hE₆⟩, + hE₆, hmain, hGV, H₃.isClosed_U, ?_, ?_, ?_, ?_⟩ + · intro e' he' + apply closure_minimal _ H₃.isClosed_U + intro y hy + have hy' := he'.2.1 hy + rw [hp₆.1, hp₆.2] at hy' + have hyU : θ y ∈ H₅.U ∨ θ y ∈ G.V := by + have := hy'.1 + rw [mem_preimage, h6U] at this + exact this + have hnG : θ y ∉ G.V := fun h => hy'.2 (hGV h) + rcases (hsat ▸ hyU.resolve_right hnG : y ∈ H₄.U) with h | h + · exact h + · exact (hnG h.1.1).elim + · exact (hfin.image β).subset hKH + · calc (H₃.U ∩ K'.U).ncard ≤ (β '' (K'.U ∩ H₃₀.U)).ncard := ncard_le_ncard hKH (hfin.image β) + _ ≤ _ := ncard_image_le hfin + _ ≤ w := hle + · rintro z ⟨hz, hzb⟩ + exact h3bd.subset ⟨hF₃.1 ⟨hzb, hz⟩, hzb⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46ClaimTwo.lean b/LeanPool/GraphMinor/GM07/Section46ClaimTwo.lean new file mode 100644 index 0000000000..068fdf4b04 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46ClaimTwo.lean @@ -0,0 +1,238 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.DiscMerge +import LeanPool.GraphMinor.Surface.DiscsInSurface +import LeanPool.GraphMinor.GM07.Section46DiscApproach + +/-! +# Claim (2) of VII (4.6) + +Page 229: "Since $U(J) \cap S = \emptyset$, it follows that $\phi$ maps $R_1$ and its boundary $C_1 +\cup F$ homeomorphically onto +$S$, $A$, respectively." Here `R₁` is a closed disc in `Δ`, and `S` is the inside of a closed disc +`Z` of `Σ` with boundary `A`. What we +know at this point is that `φ` is one to one on the inside of `R₁` (the net identifies no inner +point of `Δ`), that it maps the inside of +`R₁` into the inside of `Z`, and that it maps the boundary of `R₁` into the boundary of `Z`. + +We prove the claim for any continuous map `φ` with finite fibres between surfaces with these three +properties +(`injOn_of_disc_to_disc`). +1. The image of the inside of `R₁` is open, by invariance of domain, and closed in the inside of + `Z`, since the boundary goes to the + boundary. The inside of `Z` is connected, so the image is all of it. +2. Two points `x ≠ y` of the boundary of `R₁` with the same image `p` are impossible. Near `p`, the + inside of `Z` meets a small open set + `W` in a connected set. Small disjoint neighbourhoods of the finitely many points over `p` split + the part of the inside of `R₁` over + `W` in two nonempty open parts, one near `x`, the other near the other points, and their images + split the connected set. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface + +universe u v + +variable {D : Type u} {S : Type v} [TopologicalSpace D] [TopologicalSpace S] + +/-- The image of an open part of the inside of a closed disc, under a map that is continuous and one +to one there, is open. -/ +theorem isOpen_image_of_subset_discInt (hman : ∀ x : S, IsManifoldPoint x) {R : Set D} + (hR : IsClosedDisc R) {φ : D → S} + (hφ : Continuous φ) (hinj : InjOn φ (discInt R)) {V : Set D} (hV : IsOpen V) + (hVR : V ⊆ discInt R) : IsOpen (φ '' V) := by + obtain ⟨h, g, c⟩ := hR.exists_isChart + have hint : discInt R = g '' ball 0 1 := c.discInt_eq + set M : Set ℂ := ball 0 1 ∩ g ⁻¹' V with hM + have hgc : ContinuousOn g (ball (0 : ℂ) 1) := c.gc.mono ball_subset_closedBall + have hMo : IsOpen M := hgc.isOpen_inter_preimage isOpen_ball hV + have hgM : g '' M = V := by + apply Subset.antisymm + · rintro _ ⟨z, hz, rfl⟩ + exact hz.2 + · intro x hx + have hx' := hVR hx + rw [hint] at hx' + obtain ⟨z, hz, rfl⟩ := hx' + exact ⟨z, ⟨hz, hx⟩, rfl⟩ + have hginj : InjOn g (ball (0 : ℂ) 1) := c.injOn.mono ball_subset_closedBall + rw [← hgM, image_image] + refine isOpen_image_of_manifold hMo (hφ.comp_continuousOn (hgc.mono inter_subset_left)) ?_ fun _ + _ => hman _ + intro z hz w hw he + have hz' : g z ∈ discInt R := hint ▸ mem_image_of_mem g hz.1 + have hw' : g w ∈ discInt R := hint ▸ mem_image_of_mem g hw.1 + exact hginj hz.1 hw.1 (hinj hz' hw' he) + +/-- Near a point of a closed disc, inside any open set, there is an open set that meets the inside +of the disc in a connected set. -/ +theorem exists_nhds_discInt_preconnected {Z : Set S} (hZ : IsClosedDisc Z) {p : S} + (hp : p ∈ Z) {O : Set S} (hO : IsOpen O) + (hpO : p ∈ O) : ∃ W : Set S, IsOpen W ∧ p ∈ W ∧ W ⊆ O ∧ IsPreconnected (W ∩ discInt Z) := by + obtain ⟨e⟩ := hZ + obtain ⟨Ws, hWs, hpWs, hWsO, hconn⟩ := closed_disc_connected_approach e ⟨p, hp⟩ + (Subtype.val ⁻¹' O) (hO.preimage continuous_subtype_val) hpO + obtain ⟨O', hO', hWs'⟩ := isOpen_induced_iff.mp hWs + refine ⟨O' ∩ O, hO'.inter hO, ⟨?_, hpO⟩, inter_subset_right, ?_⟩ + · have : (⟨p, hp⟩ : Z) ∈ Subtype.val ⁻¹' O' := hWs' ▸ hpWs + exact this + have heq : (O' ∩ O) ∩ discInt Z = Subtype.val '' (Ws ∩ (bd Z)ᶜ) := by + apply Subset.antisymm + · rintro z ⟨⟨hz1, -⟩, hzZ, hzb⟩ + refine ⟨⟨z, hzZ⟩, ⟨?_, fun hb => hzb ⟨_, hb, rfl⟩⟩, rfl⟩ + rw [← hWs'] + exact hz1 + · rintro _ ⟨w, ⟨hw, hwb⟩, rfl⟩ + refine ⟨⟨?_, hWsO hw⟩, w.2, ?_⟩ + · have : w ∈ Subtype.val ⁻¹' O' := hWs' ▸ hw + exact this + · rintro ⟨w', hw', he⟩ + exact hwb (Subtype.ext he ▸ hw') + rw [heq] + exact hconn.image _ continuous_subtype_val.continuousOn + +/-- **Claim (2) of VII (4.6)**, page 229, in general form. A continuous map with finite fibres +between surfaces that is one to one on the +inside of a closed disc `R`, maps it into the inside of a closed disc `Z`, and maps the boundary of +`R` into the boundary of `Z`, maps `R` +one to one onto `Z`, and the boundary of `R` onto the boundary of `Z`. -/ +theorem injOn_of_disc_to_disc [T2Space D] [T2Space S] (hmanD : ∀ x : D, IsManifoldPoint x) + (hman : ∀ x : S, IsManifoldPoint x) + {φ : D → S} (hφ : Continuous φ) (hfin : ∀ p : S, (φ ⁻¹' {p}).Finite) {R : Set D} {Z : Set S} + (hR : IsClosedDisc R) + (hZ : IsClosedDisc Z) (hinj : InjOn φ (discInt R)) (hint : φ '' discInt R ⊆ discInt Z) + (hbd : φ '' discBd R ⊆ discBd Z) : + InjOn φ R ∧ φ '' R = Z ∧ φ '' discBd R = discBd Z := by + have hRi : IsOpen (discInt R) := hR.isOpen_discInt hmanD + have hZi : IsOpen (discInt Z) := hZ.isOpen_discInt hman + have hRc : IsCompact R := hR.isCompact + have hsplit : ∀ x ∈ R, x ∈ discInt R ∨ x ∈ discBd R := fun x hx => by + by_cases hb : x ∈ discBd R + · exact .inr hb + · exact .inl ⟨hx, hb⟩ + have hZsub : discInt Z ⊆ Z := discInt_subset Z + have himgR : φ '' R ⊆ Z := by + rintro _ ⟨x, hx, rfl⟩ + rcases hsplit x hx with h | h + · exact hZsub (hint (mem_image_of_mem φ h)) + · exact discBd_subset Z (hbd (mem_image_of_mem φ h)) + -- Step 1: the inside of `R` goes onto the inside of `Z`. + have hopen : IsOpen (φ '' discInt R) := isOpen_image_of_subset_discInt hman hR hφ hinj hRi + subset_rfl + have hRne : (discInt R).Nonempty := by + obtain ⟨h, g, c⟩ := hR.exists_isChart + rw [c.discInt_eq] + exact ⟨g 0, 0, by simp, rfl⟩ + have hconnZ : IsPreconnected (discInt Z) := by + obtain ⟨h, g, c⟩ := hZ.exists_isChart + rw [c.discInt_eq] + exact ((convex_ball (0 : ℂ) 1).isPreconnected).image _ (c.gc.mono ball_subset_closedBall) + have hsurj : discInt Z ⊆ φ '' discInt R := by + refine hconnZ.subset_of_closure_inter_subset hopen ?_ ?_ + · obtain ⟨x, hx⟩ := hRne + exact ⟨φ x, hint (mem_image_of_mem φ hx), mem_image_of_mem φ hx⟩ + · rintro z ⟨hzc, hzZ⟩ + have hcl : closure (φ '' discInt R) ⊆ φ '' R := + closure_minimal (image_mono (discInt_subset R)) (hRc.image hφ).isClosed + obtain ⟨x, hx, rfl⟩ := hcl hzc + rcases hsplit x hx with h | h + · exact mem_image_of_mem φ h + · exact absurd (hbd (mem_image_of_mem φ h)) hzZ.2 + -- Step 2: no two points of the boundary of `R` have the same image. + have hbdinj : ∀ x ∈ discBd R, ∀ y ∈ discBd R, φ x = φ y → x = y := by + intro x hx y hy hxy + by_contra hne + classical + set p := φ x with hp + set P := φ ⁻¹' {p} with hP + obtain ⟨O, hO, hOd⟩ := (hfin p).t2_separation + set K : Set D := R \ ⋃ q ∈ P, O q with hK + have hKc : IsCompact K := hRc.diff (isOpen_biUnion fun q _ => (hO q).2) + have hpK : p ∉ φ '' K := by + rintro ⟨k, hk, hkp⟩ + exact hk.2 (mem_biUnion (x := k) hkp (hO k).1) + have hpZ : p ∈ Z := discBd_subset Z (hbd (mem_image_of_mem φ hx)) + obtain ⟨W, hW, hpW, hWK, hWc⟩ := exists_nhds_discInt_preconnected hZ hpZ + (hKc.image hφ).isClosed.isOpen_compl hpK + set Y := discInt R ∩ φ ⁻¹' W with hY + have hYo : IsOpen Y := hRi.inter (hW.preimage hφ) + have hYP : ∀ a ∈ Y, ∃ q ∈ P, a ∈ O q := fun a ha => by + by_contra hn + push Not at hn + have haK : a ∈ K := ⟨discInt_subset R ha.1, fun h => by + obtain ⟨q, hq, haq⟩ := mem_iUnion₂.mp h + exact hn q hq haq⟩ + exact hWK ha.2 (mem_image_of_mem φ haK) + have hxP : x ∈ P := rfl + have hyP : y ∈ P := hxy.symm + set Y₁ := Y ∩ O x with hY₁ + set Y₂ := Y ∩ ⋃ q ∈ P \ {x}, O q with hY₂ + have hY₁o : IsOpen Y₁ := hYo.inter (hO x).2 + have hY₂o : IsOpen Y₂ := hYo.inter (isOpen_biUnion fun q _ => (hO q).2) + have ho₁ := isOpen_image_of_subset_discInt hman hR hφ hinj hY₁o (inter_subset_left.trans + inter_subset_left) + have ho₂ := isOpen_image_of_subset_discInt hman hR hφ hinj hY₂o (inter_subset_left.trans + inter_subset_left) + -- Points of the inside of `R` near `x`, and near `y`, that go into `W`. + have hnear : ∀ q, q ∈ P → q ∈ discBd R → ∃ a ∈ Y, a ∈ O q := fun q hq hqb => by + have hqcl : q ∈ closure (discInt R) := hR.subset_closure_discInt (discBd_subset R hqb) + have hqW : φ q ∈ W := by + have : φ q = p := hq + rw [this] + exact hpW + obtain ⟨a, ⟨haO, haW⟩, haR⟩ := mem_closure_iff.mp hqcl _ ((hO q).2.inter + (hW.preimage hφ)) ⟨(hO q).1, hqW⟩ + exact ⟨a, ⟨haR, haW⟩, haO⟩ + obtain ⟨a₁, ha₁Y, ha₁O⟩ := hnear x hxP hx + obtain ⟨a₂, ha₂Y, ha₂O⟩ := hnear y hyP hy + have hcov : W ∩ discInt Z ⊆ φ '' Y₁ ∪ φ '' Y₂ := by + rintro z ⟨hzW, hzZ⟩ + obtain ⟨a, ha, rfl⟩ := hsurj hzZ + have haY : a ∈ Y := ⟨ha, hzW⟩ + obtain ⟨q, hq, haq⟩ := hYP a haY + by_cases hqx : q = x + · subst hqx + exact .inl (mem_image_of_mem φ ⟨haY, haq⟩) + · exact .inr (mem_image_of_mem φ ⟨haY, mem_biUnion (x := q) ⟨hq, hqx⟩ haq⟩) + have hmem : ∀ a ∈ Y, φ a ∈ W ∩ discInt Z := fun a ha => ⟨ha.2, hint (mem_image_of_mem φ ha.1)⟩ + obtain ⟨z, hzWZ, ⟨b₁, hb₁, hz₁⟩, ⟨b₂, hb₂, hz₂⟩⟩ := hWc _ _ ho₁ ho₂ hcov ⟨φ a₁, hmem a₁ ha₁Y, + mem_image_of_mem φ ⟨ha₁Y, ha₁O⟩⟩ + ⟨φ a₂, hmem a₂ ha₂Y, mem_image_of_mem φ ⟨ha₂Y, mem_biUnion (x := y) ⟨hyP, hne ∘ Eq.symm⟩ + ha₂O⟩⟩ + have hb : b₁ = b₂ := hinj hb₁.1.1 hb₂.1.1 (hz₁.trans hz₂.symm) + obtain ⟨q, hq, hbq⟩ := mem_iUnion₂.mp hb₂.2 + exact disjoint_left.mp (hOd hxP hq.1 (Ne.symm hq.2)) hb₁.2 (hb ▸ hbq) + have hinjR : InjOn φ R := by + intro x hx y hy hxy + rcases hsplit x hx with h₁ | h₁ <;> rcases hsplit y hy with h₂ | h₂ + · exact hinj h₁ h₂ hxy + · exact absurd (hxy ▸ hint (mem_image_of_mem φ h₁)) fun h => h.2 (hbd (mem_image_of_mem φ h₂)) + · exact absurd (hxy.symm ▸ hint (mem_image_of_mem φ h₂)) fun h => h.2 (hbd + (mem_image_of_mem φ h₁)) + · exact hbdinj x h₁ y h₂ hxy + have himg : φ '' R = Z := by + refine Subset.antisymm himgR ?_ + have h1 : Z ⊆ closure (discInt Z) := hZ.subset_closure_discInt + have h2 : closure (discInt Z) ⊆ φ '' R := + closure_minimal (hsurj.trans (image_mono (discInt_subset R))) (hRc.image hφ).isClosed + exact h1.trans h2 + refine ⟨hinjR, himg, Subset.antisymm hbd fun z hz => ?_⟩ + obtain ⟨x, hx, rfl⟩ := himg.symm ▸ discBd_subset Z hz + rcases hsplit x hx with h | h + · exact absurd hz (hint (mem_image_of_mem φ h)).2 + · exact mem_image_of_mem φ h + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46ClosedComponents.lean b/LeanPool/GraphMinor/GM07/Section46ClosedComponents.lean new file mode 100644 index 0000000000..e1460b6d8c --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46ClosedComponents.lean @@ -0,0 +1,85 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs + +/-! +# Finite closed component families + +The cuff count on page 226 of VII (4.6) uses the components of +`U(L) ∪ bd(Σ)`. A finite connected cover makes their number finite. +For a closed set, each component is closed, and a finite component +family makes the complement of each component closed as well. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +/-- A finite cover by nonempty preconnected sets gives finitely many +components, as used for the cuff count in VII (4.6), page 226. -/ +theorem finite_componentsIn_of_finite_preconnected_cover {S : Type*} [TopologicalSpace S] + {B : Set S} {𝒜 : Set (Set S)} (hfin : 𝒜.Finite) + (hne : ∀ A ∈ 𝒜, A.Nonempty) (hconn : ∀ A ∈ 𝒜, IsPreconnected A) + (hcover : B = ⋃₀ 𝒜) : (componentsIn B).Finite := by + classical + have : Finite 𝒜 := hfin.to_subtype + choose p hp using fun A : 𝒜 => hne A.1 A.2 + apply (finite_range (fun A : 𝒜 => connectedComponentIn B (p A))).subset + rintro C ⟨x, hx, rfl⟩ + obtain ⟨A, hA, hxA⟩ := (congrArg (fun Z => x ∈ Z) hcover).mp hx + let A' : 𝒜 := ⟨A, hA⟩ + have hAB : A ⊆ B := hcover ▸ subset_sUnion_of_mem hA + have hxComp : x ∈ connectedComponentIn B (p A') := + (hconn A hA).subset_connectedComponentIn (hp A') hAB hxA + exact ⟨A', connectedComponentIn_eq hxComp⟩ + +/-- Components of a closed set are closed in the ambient space. -/ +theorem isClosed_of_mem_componentsIn {S : Type*} [TopologicalSpace S] + {B C : Set S} (hB : IsClosed B) (hC : C ∈ componentsIn B) : IsClosed C := by + obtain ⟨x, hx, rfl⟩ := hC + apply isClosed_of_closure_subset + exact isPreconnected_connectedComponentIn.closure.subset_connectedComponentIn + (subset_closure (mem_connectedComponentIn hx)) + (closure_minimal (connectedComponentIn_subset _ _) hB) + +/-- Distinct components are disjoint. -/ +theorem disjoint_of_mem_componentsIn_ne {S : Type*} [TopologicalSpace S] + {B C D : Set S} (hC : C ∈ componentsIn B) (hD : D ∈ componentsIn B) (hne : C ≠ D) : + Disjoint C D := by + obtain ⟨x, _, rfl⟩ := hC + obtain ⟨y, _, rfl⟩ := hD + apply disjoint_left.mpr + intro z hzC hzD + exact hne ((connectedComponentIn_eq hzC).trans (connectedComponentIn_eq hzD).symm) + +/-- In a finite closed component family, deleting one component leaves +a closed set, as needed for lifting the components in VII (4.6), page 226. -/ +theorem isClosed_sdiff_of_mem_finite_componentsIn {S : Type*} [TopologicalSpace S] + {B C : Set S} (hB : IsClosed B) (hfin : (componentsIn B).Finite) + (hC : C ∈ componentsIn B) : IsClosed (B \ C) := by + have heq : B \ C = ⋃₀ (componentsIn B \ {C}) := by + apply Subset.antisymm + · rintro x ⟨hxB, hxC⟩ + let D := connectedComponentIn B x + have hD : D ∈ componentsIn B := ⟨x, hxB, rfl⟩ + have hxD : x ∈ D := mem_connectedComponentIn hxB + have hDC : D ≠ C := fun h => hxC (h ▸ hxD) + exact ⟨D, ⟨hD, hDC⟩, hxD⟩ + · rintro x ⟨D, ⟨hD, hDC⟩, hxD⟩ + have hDB : D ⊆ B := by obtain ⟨y, _, rfl⟩ := hD; exact connectedComponentIn_subset _ _ + exact ⟨hDB hxD, fun hxC => disjoint_left.mp + (disjoint_of_mem_componentsIn_ne hD hC hDC) hxD hxC⟩ + rw [heq] + exact hfin.sdiff.isClosed_sUnion fun D hD => isClosed_of_mem_componentsIn hB hD.1 + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46ComponentsMeetVertices.lean b/LeanPool/GraphMinor/GM07/Section46ComponentsMeetVertices.lean new file mode 100644 index 0000000000..12457fb436 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46ComponentsMeetVertices.lean @@ -0,0 +1,91 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46SeamPartsDefs +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section2Euler +import LeanPool.GraphMinor.GM07.Section46SeamEdgeCounts +import LeanPool.GraphMinor.GM07.Section46OldVertices +import LeanPool.GraphMinor.GM07.Section46DrawingContactCount +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.Classification +import LeanPool.GraphMinor.Surface.AddCrosscap + +/-! +# Each boundary component before cutting contains an old seam vertex + +The cuff bound in VII (4.6), page 226, counts components of `U(L) ∪ bd(Σ)` +using vertices of `J`. Every closed retained edge contains an old seam +vertex, since it is short or linking. Each original cuff also contains +a seam vertex. Connectedness puts such a vertex in the component of +any chosen point, so every component is counted by `V(J)`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +private theorem preconnected_subset_component_of_meets {S : Type*} [TopologicalSpace S] + {A B C : Set S} (hA : IsPreconnected A) (hAB : A ⊆ B) (hC : C ∈ componentsIn B) + (hmeet : (A ∩ C).Nonempty) : A ⊆ C := by + obtain ⟨y, _, rfl⟩ := hC + obtain ⟨x, hxA, hxC⟩ := hmeet + rw [connectedComponentIn_eq hxC] + exact hA.subset_connectedComponentIn hxA hAB + +/-- Every component of `U(L) ∪ bd(Σ)` contains a vertex of `J`, +as used for the cuff bound in VII (4.6), page 226. -/ +theorem boundary_components_meet_old_vertices {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {G J J' L : Drawing S} + (hJ : N.IsSeamGraphFor J) {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (s t : longSeamEdges G J μ w → unitInterval) + (W : longSeamEdges G J μ w → Set S) + (hcuts : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)}) + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ ⋃ e, W e) + (hLE : L.E = forestSeamEdges J' (centralEdges G J μ w γ s t)) + (hLn : HasNoIsolatedVertices L) : + ∀ C ∈ componentsIn (L.U ∪ bd S), (C ∩ J.V).Nonempty := by + have : T2Space S := hS.2.1 + have hsubE := L_edges_subset_short_union_linking hγ s t W hcuts hU hV hLE + have hcpos : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e := + fun e => ⟨(hcuts e).1, (hcuts e).2.1, (hcuts e).2.2.1⟩ + have hclV : ∀ f ∈ L.E, (closure f ∩ J.V).Nonempty := by + intro f hf + rcases hsubE hf with hshort | hlink + · rcases J.edge_cond f hshort.1 with ⟨a, b, _, hcap, _⟩ | ⟨a, hcap, _⟩ + · exact ⟨a, hcap ▸ mem_insert a {b}⟩ + · exact ⟨a, hcap ▸ mem_singleton a⟩ + · exact linking_closure_meets_old_vertices hγ s t hcpos hlink + intro C hC + obtain ⟨x, hxB, hCx⟩ := hC + have hxC : x ∈ C := hCx ▸ mem_connectedComponentIn hxB + have hCmem : C ∈ componentsIn (L.U ∪ bd S) := ⟨x, hxB, hCx⟩ + rcases hxB with hxL | hxbd + · have hxCover : x ∈ ⋃ f ∈ L.E, closure f := by + rw [← U_eq_closed_edges_of_no_isolated L hLn] + exact hxL + obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hxCover + have hconn : IsPreconnected (closure f) := hf.2.2.1.isConnected.isPreconnected.closure + have hclSub : closure f ⊆ L.U ∪ bd S := (L.closure_subset_U hf).trans subset_union_left + have hclC := preconnected_subset_component_of_meets hconn hclSub hCmem ⟨x, hxf, hxC⟩ + obtain ⟨v, hvcl, hvV⟩ := hclV f hf + exact ⟨v, hclC hvcl, hvV⟩ + · obtain ⟨D, hD, hxD⟩ := (congrArg (fun A => x ∈ A) (sUnion_cuffs (S := S))).mpr hxbd + have hDconn := ((cuff_statement S hS).2.2 D hD).isConnected'.isPreconnected + have hDsub : D ⊆ L.U ∪ bd S := fun y hy => + .inr (sUnion_cuffs (S := S) ▸ ⟨D, hD, hy⟩) + have hDC := preconnected_subset_component_of_meets hDconn hDsub hCmem ⟨x, hxD, hxC⟩ + obtain ⟨v, hvD, hvV⟩ := N.cuff_inter_seamV_nonempty hS hJ.1 hD + exact ⟨v, hDC hvD, hJ.2.2 ▸ hvV⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46Constants.lean b/LeanPool/GraphMinor/GM07/Section46Constants.lean new file mode 100644 index 0000000000..3cb66aadb5 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46Constants.lean @@ -0,0 +1,116 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.Surface.Classification +import LeanPool.GraphMinor.Surface.ModelCriterion + +/-! +# Constants in the proof of Graph Minors VII (4.6) + +The proof on page 224 chooses a surface model and uses its constants throughout. +We choose a model attaining the natural-number infimum defining `vSurface`. +This makes the bound in the hypotheses equal to the bound used by the proof. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +universe u + +/-- The model and constants chosen at the start of VII (4.6), page 224. +The infimum defining `vSurface` is attained by an actual surface model. -/ +theorem exists_model_vSurface {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) [ConnectedSpace S] (k : ℕ) : + ∃ a b c : ℕ, Nonempty (S ≃ₜ SurfaceModel a b c) ∧ + vSurface S k = vModel a b c k := by + obtain ⟨a, b, c, hmodel⟩ := classification S hS ‹ConnectedSpace S› + have hne : {v : ℕ | ∃ a b c : ℕ, + Nonempty (S ≃ₜ SurfaceModel a b c) ∧ v = vModel a b c k}.Nonempty := + ⟨vModel a b c k, a, b, c, hmodel, rfl⟩ + exact Nat.sInf_mem hne + +/-- The model's third parameter is the number of cuffs, including for +the model chosen to attain `vSurface` in VII (4.6), page 224. -/ +theorem ncard_cuffs_eq_of_surface_model {S : Type u} [TopologicalSpace S] + {a b c : ℕ} (e : S ≃ₜ SurfaceModel a b c) : (cuffs S).ncard = c := by + obtain ⟨ht, f, hf⟩ := presents_ew a b c + have := ht + rw [ncard_cuffs_congr e] + exact ncard_cuffs hf + +/-- The start of VII (4.6) can choose an attaining model with at least +two cuffs, so its factor `2a+b+c-1` is positive. -/ +theorem exists_model_vSurface_two_cuffs {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) [ConnectedSpace S] (hcuffs : 2 ≤ (cuffs S).ncard) (k : ℕ) : + ∃ a b c : ℕ, 2 ≤ c ∧ Nonempty (S ≃ₜ SurfaceModel a b c) ∧ + vSurface S k = vModel a b c k := by + obtain ⟨a, b, c, ⟨e⟩, hv⟩ := exists_model_vSurface hS k + have hc := ncard_cuffs_eq_of_surface_model e + exact ⟨a, b, c, hc ▸ hcuffs, ⟨e⟩, hv⟩ + +/-- The maximum defining `w` includes every model with the cuff bound used +on page 226 of the proof of VII (4.6). -/ +theorem wSurface_model_le_wMaxModel {a b c c' k : ℕ} + (hc' : c' ≤ 2 * (2 * a + b + c - 1)) : + wSurface (SurfaceModel a b c') (2 * k) (3 * (2 * a + b + c - 1)) ≤ + wMaxModel a b c k := by + unfold wMaxModel + exact Finset.le_sup (f := fun c' => + wSurface (SurfaceModel a b c') (2 * k) (3 * (2 * a + b + c - 1))) + (Finset.mem_range.mpr (Nat.lt_succ_of_le hc')) + +/-- Numerical bounds used on pages 225 and 228 of VII (4.6). In particular, +a seam edge on a cuff cannot be long, and the shortcut bound is at most `v`. -/ +theorem constants_bounds_4_6 {a b c k : ℕ} (hc : 2 ≤ c) : + 2 * k < 2 * muModel a b c k + wMaxModel a b c k + 2 ∧ + muModel a b c k ≤ vModel a b c k ∧ + 6 * (2 * a + b + c - 1) * muModel a b c k ≤ vModel a b c k - 2 * k := by + have hn : 0 < 6 * (2 * a + b + c - 1) := by omega + have hk : 2 * k ≤ muModel a b c k := by + unfold muModel + exact Nat.le_add_left _ _ + have hm : muModel a b c k ≤ + wMaxModel a b c k + 2 * muModel a b c k + 1 := by omega + have hv : muModel a b c k ≤ + 6 * (2 * a + b + c - 1) * + (wMaxModel a b c k + 2 * muModel a b c k + 1) := + hm.trans (Nat.le_mul_of_pos_left _ hn) + refine ⟨by omega, ?_, ?_⟩ + · exact hv.trans (Nat.le_add_right _ _) + · unfold vModel + rw [Nat.add_sub_cancel] + exact Nat.mul_le_mul_left _ hm + +/-- The boundary hypotheses of VII (4.6) force `k ≥ 2`: two distinct +cuffs each contain two vertices, and their vertex sets are disjoint. -/ +theorem two_le_k_of_boundary_4_6 {S : Type u} [TopologicalSpace S] + {G : Drawing S} {k : ℕ} (hcuffs : 2 ≤ (cuffs S).ncard) + (hbd : (G.V ∩ bd S).ncard ≤ 2 * k) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) : 2 ≤ k := by + obtain ⟨C, hC, C', hC', hne⟩ := + (Set.one_lt_ncard (Set.finite_of_ncard_pos (by omega))).mp (by omega : 1 < (cuffs S).ncard) + have hdis : Disjoint (G.V ∩ C) (G.V ∩ C') := + (cuffs_disjoint hC hC' hne).mono inter_subset_right inter_subset_right + have hsub : (G.V ∩ C) ∪ (G.V ∩ C') ⊆ G.V ∩ bd S := by + rintro x (hx | hx) + · exact ⟨hx.1, sUnion_cuffs (S := S) ▸ ⟨C, hC, hx.2⟩⟩ + · exact ⟨hx.1, sUnion_cuffs (S := S) ▸ ⟨C', hC', hx.2⟩⟩ + have hcard := Set.ncard_le_ncard hsub (G.finite_V.subset inter_subset_left) + rw [Set.ncard_union_eq hdis (G.finite_V.subset inter_subset_left) + (G.finite_V.subset inter_subset_left)] at hcard + have hC2 := hiii C hC + have hC'2 := hiii C' hC' + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46ConstructAndCount.lean b/LeanPool/GraphMinor/GM07/Section46ConstructAndCount.lean new file mode 100644 index 0000000000..165269aea1 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46ConstructAndCount.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46SeamPartsDefs +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section2 +import LeanPool.GraphMinor.GM07.Section46Constants +import LeanPool.GraphMinor.GM07.Section46SeamRefinement +import LeanPool.GraphMinor.GM07.Section46SeamParts +import LeanPool.GraphMinor.GM07.Section46BoundaryEdges +import LeanPool.GraphMinor.GM07.Section46LCoverage +import LeanPool.GraphMinor.GM07.Section46SeamEdgeCounts +import LeanPool.GraphMinor.GM07.Section46LContactBounds +import LeanPool.GraphMinor.GM07.Section46DrawingContactCount + +/-! +# Constructing and counting the seam parts + +This assembles `W(e)`, `J⁺`, `K`, and `L` of VII (4.6), pages 225–226. +The closed retained edges cover `U(L)`. Each has at most `w + 2μ + 1` +contacts with `V(G)`, and there are at most `6(2a+b+c-1)` such edges +by (2.4). Their sum is exactly the bound `v - 2k` used on page 226. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +/-- The construction and vertex-contact bound for `L` in VII (4.6), +pages 225–226, with actual seam-part drawings. -/ +theorem exists_seam_parts_with_L_bound {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {G J : Drawing S} (hG : G.IsProper) + (hmin : N.IsMinimalFor G) (hJ : N.IsSeamGraphFor J) + {a b c k : ℕ} (hc : 2 ≤ c) (hmodel : Nonempty (S ≃ₜ SurfaceModel a b c)) + (hcuffs : 2 ≤ (cuffs S).ncard) (hbd : (G.V ∩ bd S).ncard ≤ 2 * k) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) + {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) : + ∃ (s t : longSeamEdges G J (muModel a b c k) (wMaxModel a b c k) → unitInterval) + (W : longSeamEdges G J (muModel a b c k) (wMaxModel a b c k) → Set S) + (J' K L : Drawing S), + (∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)} ∧ (W e).ncard = 2 ∧ W e ⊆ e.1 ∩ G.V ∧ + (γ e.1 '' Iic (s e) ∩ G.V).ncard = muModel a b c k + 1 ∧ + (γ e.1 '' Ici (t e) ∩ G.V).ncard = muModel a b c k + 1 ∧ + wMaxModel a b c k ≤ (γ e.1 '' Ioo (s e) (t e) ∩ G.V).ncard) ∧ + J'.U = J.U ∧ J'.V = J.V ∪ ⋃ e, W e ∧ + K.IsSubdrawing J' ∧ K.V = ⋃ e, W e ∧ + K.E = centralEdges G J (muModel a b c k) (wMaxModel a b c k) γ s t ∧ + L.IsSubdrawing J' ∧ L.V = J'.V ∧ + L.E = forestSeamEdges J' (centralEdges G J (muModel a b c k) (wMaxModel a b c k) γ s t) ∧ + L.IsProper ∧ HasNoIsolatedVertices L ∧ (G.V ∩ L.U).ncard ≤ vModel a b c k - 2 * k := by + have : T2Space S := hS.2.1 + have hk := two_le_k_of_boundary_4_6 hcuffs hbd hiii + have hkμ : 2 * k ≤ muModel a b c k := by + unfold muModel + exact Nat.le_add_left _ _ + have hμ : 0 < muModel a b c k := by omega + have hsmall : (G.V ∩ bd S).ncard < 2 * muModel a b c k + wMaxModel a b c k + 2 := by omega + obtain ⟨s, t, W, J', hfull, _, _, hU, hV, _⟩ := exists_J_plus_with_split_edges G J hγ hμ + have hcuts : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)} := by + intro e + exact ⟨(hfull e).1, (hfull e).2.1, (hfull e).2.2.1, (hfull e).2.2.2.1⟩ + obtain ⟨K, L, hK, hKV, hKE, hL, hLV, hLE⟩ := exists_K_and_L hγ s t W hcuts hU hV + have hp := isProper_L hS N hJ hU hV hLE + have hn := hasNoIsolatedVertices_L hS N hJ hγ s t W hcuts hsmall hU hV hLV hLE + have hleft : ∀ e, (γ e.1 '' Iic (s e) ∩ G.V).ncard = muModel a b c k + 1 := by + intro e + obtain ⟨_, _, _, _, _, _, hl, _, _⟩ := hfull e + exact hl + have hright : ∀ e, (γ e.1 '' Ici (t e) ∩ G.V).ncard = muModel a b c k + 1 := by + intro e + obtain ⟨_, _, _, _, _, _, _, hr, _⟩ := hfull e + exact hr + have hper := L_edge_contact_bound hγ s t W hcuts hleft hright hU hV hLE + have hcontacts := ncard_vertex_contacts_U_le_edges_mul G L hn hper + have hLEcard := L_edge_ncard_le_two_mul_old_edges hγ s t W hcuts hU hV hLE + have hJEcard := (theorem_2_4_proof hS (by omega) hmodel hG hmin hJ).2 + have hLsize : L.E.ncard ≤ 6 * (2 * a + b + c - 1) := by omega + have hbound : (G.V ∩ L.U).ncard ≤ vModel a b c k - 2 * k := by + unfold vModel + rw [Nat.add_sub_cancel] + exact hcontacts.trans (Nat.mul_le_mul_right _ hLsize) + exact ⟨s, t, W, J', K, L, hfull, hU, hV, hK, hKV, hKE, hL, hLV, hLE, hp, hn, hbound⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46CuffBound.lean b/LeanPool/GraphMinor/GM07/Section46CuffBound.lean new file mode 100644 index 0000000000..e99f0304ae --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46CuffBound.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46SeamPartsDefs +public import LeanPool.GraphMinor.GM11.Rotation +public import LeanPool.GraphMinor.GM07.ForestPeel +import LeanPool.GraphMinor.GM07.Section46ClosedComponents +import LeanPool.GraphMinor.GM07.Section46CuffComponents +import LeanPool.GraphMinor.GM07.Section46ComponentsMeetVertices +import LeanPool.GraphMinor.GM07.Section46Constants +import LeanPool.GraphMinor.GM07.Section2 + +/-! +# The upper cuff bound in VII (4.6) + +On page 226, each component of `U(L) ∪ bd(Σ)` contains an old seam +vertex. Distinct components are disjoint, so their number is at most +`|V(J)|`. The cut-cuff correspondence and (2.4) then give +`c′ ≤ 2(2a+b+c-1)`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +private theorem ncard_components_le_meeting_set {S : Type*} [TopologicalSpace S] + {B V : Set S} (hV : V.Finite) + (hmeet : ∀ C ∈ componentsIn B, (C ∩ V).Nonempty) : + (componentsIn B).ncard ≤ V.ncard := by + classical + have : Finite V := hV.to_subtype + choose p hp using fun C : componentsIn B => hmeet C.1 C.2 + let f : componentsIn B → V := fun C => ⟨p C, (hp C).2⟩ + have hi : Function.Injective f := by + intro C D heq + apply Subtype.ext + by_contra hne + have hdis := disjoint_of_mem_componentsIn_ne C.2 D.2 hne + have hpEq : p C = p D := congrArg Subtype.val heq + have hpD : p C ∈ D.1 := by rw [hpEq]; exact (hp D).1 + exact disjoint_left.mp hdis (hp C).1 hpD + exact Nat.card_le_card_of_injective f hi + +/-- The cuffs of `Σ′` are counted by old seam vertices, in VII (4.6), +page 226. -/ +theorem cut_cuffs_le_old_vertices {S S' : Type} [TopologicalSpace S] [TopologicalSpace S'] + (hS : IsSurface S) (N : Net S) {G J J' L : Drawing S} + (hJ : N.IsSeamGraphFor J) {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (s t : longSeamEdges G J μ w → unitInterval) + (W : longSeamEdges G J μ w → Set S) + (hcuts : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)}) + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ ⋃ e, W e) + (hLE : L.E = forestSeamEdges J' (centralEdges G J μ w γ s t)) + (hLn : HasNoIsolatedVertices L) {θ : S' → S} + (hcut : IsCutAlongGraph L S' θ) (hNo : NoArcs L) : + (cuffs S').ncard ≤ J.V.ncard := by + rw [ncard_cuffs_cut_eq_components hS hcut hNo] + exact ncard_components_le_meeting_set J.finite_V + (boundary_components_meet_old_vertices hS N hJ hγ s t W hcuts hU hV hLE hLn) + +/-- The numerical upper cuff bound `c′ ≤ 2(2a+b+c-1)` in VII (4.6), +page 226. -/ +theorem cut_model_cuff_bound_4_6 {S S' : Type} [TopologicalSpace S] [TopologicalSpace S'] + (hS : IsSurface S) (N : Net S) {G J J' L : Drawing S} + (hG : G.IsProper) (hmin : N.IsMinimalFor G) (hJ : N.IsSeamGraphFor J) + {a b c c' μ w : ℕ} (hc : 2 ≤ c) (hmodel : Nonempty (S ≃ₜ SurfaceModel a b c)) + (hmodel' : Nonempty (S' ≃ₜ SurfaceModel a b c')) + {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + (s t : longSeamEdges G J μ w → unitInterval) (W : longSeamEdges G J μ w → Set S) + (hcuts : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)}) + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ ⋃ e, W e) + (hLE : L.E = forestSeamEdges J' (centralEdges G J μ w γ s t)) + (hLn : HasNoIsolatedVertices L) {θ : S' → S} + (hcut : IsCutAlongGraph L S' θ) (hNo : NoArcs L) : + c' ≤ 2 * (2 * a + b + c - 1) := by + have hbound := cut_cuffs_le_old_vertices hS N hJ hγ s t W hcuts hU hV hLE hLn hcut hNo + have hv := (theorem_2_4_proof hS (by omega) hmodel hG hmin hJ).1 + rw [ncard_cuffs_eq_of_surface_model hmodel'.some] at hbound + exact hbound.trans hv + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46CuffComponents.lean b/LeanPool/GraphMinor/GM07/Section46CuffComponents.lean new file mode 100644 index 0000000000..f2cbfe6a23 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46CuffComponents.lean @@ -0,0 +1,111 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.ForestPeel +import LeanPool.GraphMinor.GM07.CutConnected +import LeanPool.GraphMinor.GM07.Section46BoundaryComponents + +/-! +# Cuffs after cutting correspond to components before cutting + +In VII (4.6), page 226, the cuffs of `Σ′` correspond to the components +of `U(L) ∪ bd(Σ)`. The inverse image of each such component is connected: +this is the non-separation property of a forest. Connectedness in both +directions then identifies each boundary component with that inverse +image. This gives the correspondence and its cardinal equality. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +variable {S S' : Type} [TopologicalSpace S] [TopologicalSpace S'] + +/-- A boundary component after cutting is the inverse image of the +corresponding component of `U(L) ∪ bd(Σ)`, in VII (4.6), page 226. -/ +theorem cut_boundary_component_preimage (hS : IsSurface S) {L : Drawing S} + {θ : S' → S} (hcut : IsCutAlongGraph L S' θ) (hNo : NoArcs L) + {x : S'} (hx : x ∈ bd S') : + connectedComponentIn (bd S') x = θ ⁻¹' connectedComponentIn (L.U ∪ bd S) (θ x) := by + have : T2Space S := hS.2.1 + have : T2Space S' := hcut.isSurface.2.1 + let B := L.U ∪ bd S + have hBd : θ ⁻¹' B = bd S' := by + calc + θ ⁻¹' B = θ ⁻¹' (bd S ∪ L.U) := congrArg (fun A => θ ⁻¹' A) (union_comm L.U (bd S)) + _ = bd S' := hcut.preimage_bd_union_U + have hxB : θ x ∈ B := by change x ∈ θ ⁻¹' B; rw [hBd]; exact hx + let C := connectedComponentIn B (θ x) + have hCmem : C ∈ componentsIn B := ⟨θ x, hxB, rfl⟩ + have hCsub : C ⊆ B := connectedComponentIn_subset _ _ + obtain ⟨_, hclosed⟩ := boundary_components_finite_closed hS L + have hCc := (hclosed C hCmem).1 + have hCrest := (hclosed C hCmem).2 + have hrest : IsClosed (L.U \ C) := by + have heq : L.U \ C = L.U ∩ (B \ C) := by + ext y + constructor + · rintro ⟨hy, hyC⟩; exact ⟨hy, .inl hy, hyC⟩ + · rintro ⟨hy, _, hyC⟩; exact ⟨hy, hyC⟩ + rw [heq] + exact L.isClosed_U.inter hCrest + have hpre : IsPreconnected (θ ⁻¹' C) := + isPreconnected_preimage_tree hS hcut hNo isPreconnected_connectedComponentIn hCc hrest + have hprebd : θ ⁻¹' C ⊆ bd S' := by rw [← hBd]; exact preimage_mono hCsub + have hxC : x ∈ θ ⁻¹' C := mem_connectedComponentIn hxB + apply Subset.antisymm + · have himage : IsPreconnected (θ '' connectedComponentIn (bd S') x) := + isPreconnected_connectedComponentIn.image θ hcut.quotientMap.continuous.continuousOn + have hsub : θ '' connectedComponentIn (bd S') x ⊆ B := by + rintro y ⟨z, hz, rfl⟩ + change z ∈ θ ⁻¹' B + rw [hBd] + exact connectedComponentIn_subset _ _ hz + have htoC := himage.subset_connectedComponentIn + (mem_image_of_mem θ (mem_connectedComponentIn hx)) hsub + intro y hy + exact htoC (mem_image_of_mem θ hy) + · exact hpre.subset_connectedComponentIn hxC hprebd + +/-- The cuff/component correspondence of VII (4.6), page 226, expressed +by inverse images under the associated cut map. -/ +theorem cuffs_eq_preimages_boundary_components (hS : IsSurface S) {L : Drawing S} + {θ : S' → S} (hcut : IsCutAlongGraph L S' θ) (hNo : NoArcs L) : + cuffs S' = (fun C => θ ⁻¹' C) '' componentsIn (L.U ∪ bd S) := by + apply Subset.antisymm + · rintro C ⟨x, hx, rfl⟩ + have hxB : θ x ∈ L.U ∪ bd S := by + have hx' : θ x ∈ bd S ∪ L.U := by + change x ∈ θ ⁻¹' (bd S ∪ L.U) + rwa [hcut.preimage_bd_union_U] + exact hx'.symm + refine ⟨connectedComponentIn (L.U ∪ bd S) (θ x), ⟨θ x, hxB, rfl⟩, ?_⟩ + exact (cut_boundary_component_preimage hS hcut hNo hx).symm + · rintro C ⟨D, ⟨x, hx, rfl⟩, rfl⟩ + obtain ⟨y, hy⟩ := hcut.quotientMap.surjective x + have hybd : y ∈ bd S' := by + rw [← hcut.preimage_bd_union_U] + change θ y ∈ bd S ∪ L.U + rw [hy] + exact hx.symm + refine ⟨y, hybd, ?_⟩ + rw [cut_boundary_component_preimage hS hcut hNo hybd, hy] + +/-- The cardinal equality from the cuff/component correspondence in +VII (4.6), page 226. -/ +theorem ncard_cuffs_cut_eq_components (hS : IsSurface S) {L : Drawing S} + {θ : S' → S} (hcut : IsCutAlongGraph L S' θ) (hNo : NoArcs L) : + (cuffs S').ncard = (componentsIn (L.U ∪ bd S)).ncard := by + rw [cuffs_eq_preimages_boundary_components hS hcut hNo] + exact ncard_image_of_injective _ (Set.preimage_injective.mpr hcut.quotientMap.surjective) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46CuffIncidences.lean b/LeanPool/GraphMinor/GM07/Section46CuffIncidences.lean new file mode 100644 index 0000000000..fd3ac87450 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46CuffIncidences.lean @@ -0,0 +1,50 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section2MinVal +import LeanPool.GraphMinor.GM07.CuffIncidences +import LeanPool.GraphMinor.GM11.DrawingOps +import LeanPool.GraphMinor.Surface.Circle +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.Classification + +/-! +# The two cuff incidences at a seam vertex + +The local count in VII (4.6), page 225, includes two incidences from the cuff. +The cuff through a seam vertex either has no other seam vertex, giving a loop, +or has two distinct neighbouring edges. We construct these edges from the +cyclic order on the cuff. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The two cuff incidences used in VII (4.6), page 225: either one +boundary loop or two distinct incident boundary edges. -/ +theorem Net.exists_cuff_incident_edges (hS : IsSurface S) (N : Net S) + {J : Drawing S} (hJ : N.IsSeamGraphFor J) {v : S} + (hvV : v ∈ J.V) (hv_bd : v ∈ bd S) : + (∃ e ∈ J.E, e ⊆ bd S ∧ J.VertexIncident v e ∧ (tilde e).ncard = 1) ∨ + (∃ e₁ ∈ J.E, ∃ e₂ ∈ J.E, e₁ ≠ e₂ ∧ + e₁ ⊆ bd S ∧ e₂ ⊆ bd S ∧ J.VertexIncident v e₁ ∧ J.VertexIncident v e₂) := by + apply exists_cuff_incident_edges_of_edge_cover hS ?_ hvV hv_bd + rw [(N.seamGraph_edges_eq hS hJ).1] + exact subset_union_right + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46Deficient.lean b/LeanPool/GraphMinor/GM07/Section46Deficient.lean new file mode 100644 index 0000000000..9ad35ef5a7 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46Deficient.lean @@ -0,0 +1,291 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section2 +public import LeanPool.GraphMinor.GM07.Section46SeamPartsDefs +public import LeanPool.GraphMinor.GM07.Section46Constants +public import LeanPool.GraphMinor.GM07.Section46DeficientDisc +public import LeanPool.GraphMinor.GM07.Section46DeficientSide +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46EdgeContacts +import LeanPool.GraphMinor.GM07.Section46LongEdges +import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.GM07.Section46JPlus +import LeanPool.GraphMinor.GM07.Section46ClaimTwo +import LeanPool.GraphMinor.Surface.DiscMerge + +/-! +# Steps 7 to 10 of VII (4.6): the deficient test arc + +Pages 228-230. We have a test arc `F` in `Δ` and a set `Λ` of at most `w + k` disjoint +vertex sets, each meeting both sides of `F`. We must show that `F` carries at least `|Λ|` vertices +of `φ⁻¹(G)`. If not, (2.6) and (ii) give a closed disc with a short boundary `A` through `φ(F)`. The +open disc misses `U(J)`, and one side `C` of `F` maps into `A ∩ U(J)`. By claim (2), `φ` maps the +closed half `R` of `Δ` with boundary `C ∪ F` one to one onto the disc, so `φ(C) = A - φ(F)` and `φ` +is one to one on `C`. By claim (3), a point of a +member of `Λ` on `C` lies over `U(K)`. The two buffers of length `μ` then put `C` inside one long +edge, and minimality of the net bounds the vertices on `C` by those on `F`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The deficient test arc of VII (4.6), pages 228-230. Here `(N, J)` is the minimal net, `K` is +the graph of central edges, `l z` is the point `l(z)` with its paths, and `F` is a test arc with +sides `C₁`, `C₂`. The set `Λ` is a family of at most `w + k` disjoint sets, each meeting both +sides, and each of their points on a side is a vertex of `φ⁻¹(G)` lying over `U(K)` or equal to some +`l(z)`. -/ +theorem Net.deficient_test_arc [T1Space S] (hS : IsSurface S) [ConnectedSpace S] (N : Net S) + (hcuffs : 2 ≤ (cuffs S).ncard) {a b c k : ℕ} (hc : 2 ≤ c) + (hmodel : Nonempty (S ≃ₜ SurfaceModel a b c)) (hv : vSurface S k = vModel a b c k) + {G J K : Drawing S} {G_D : Drawing N.D} (hG : G.IsProper) (hmin : N.IsMinimalFor G) + (hJ : N.IsSeamGraphFor J) (hPull : IsPullbackDrawing N.φ G G_D) + (hbd : (G.V ∩ bd S).ncard ≤ 2 * k) + (hi : ∀ B : Set S, G.IsNormal B → IsIArc B → (G.V ∩ B).ncard ≤ vSurface S k → + ∃ C ∈ cuffs S, lineEnds B ⊆ C) + (hii : ∀ B : Set S, G.IsNormal B → IsOArc B → (G.V ∩ B).ncard ≤ vSurface S k → + IsNullHomotopicOArc B ∨ + ∃ C ∈ cuffs S, IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) + {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + (sK tK : longSeamEdges G J (muModel a b c k) (wMaxModel a b c k) → unitInterval) + (hcut : ∀ e, sK e ∈ Ioo 0 1 ∧ tK e ∈ Ioo 0 1 ∧ sK e < tK e ∧ + (γ e.1 '' Iic (sK e) ∩ G.V).ncard = muModel a b c k + 1 ∧ + (γ e.1 '' Ici (tK e) ∩ G.V).ncard = muModel a b c k + 1) + (hKU : K.U ⊆ ⋃ e, γ e.1 '' Icc (sK e) (tK e)) + (l : S → N.D) + (hl : ∀ z ∈ G.V ∩ bd S, N.φ (l z) = z ∧ ∃ C ∈ cuffs S, z ∈ C ∧ + ∃ (n : ℕ) (P : Fin n → Drawing S) (e : Fin n → S), + (∀ i, (P i).IsSubdrawing G ∧ e i ∈ G.V ∩ (bd S \ C) ∧ (P i).IsPathBetween z (e i)) ∧ + (∀ i j, i ≠ j → Disjoint ((P i).V \ {z, e i}) ((P j).V \ {z, e j})) ∧ + ∃ I : Finset (Fin n), muModel a b c k ≤ I.card ∧ + ∀ i ∈ I, ∃ f ∈ (P i).E, l z ∈ closure (N.φ ⁻¹' f) ∧ + ∀ x ∈ closure (N.φ ⁻¹' f), N.φ x = z → x = l z) + {F : Set N.D} {s t : N.D} {C₁ C₂ : Set N.D} (hFn : G_D.IsNormal F) (hF : IsProperIArc F) + (hEnds : IsLineWithEnds F s t) (hC : componentsIn (bd N.D \ {s, t}) = {C₁, C₂}) + (hne : C₁ ≠ C₂) {Λ : Set (Set N.D)} (hΛc : Λ.ncard ≤ wMaxModel a b c k + k) + (hΛd : Λ.PairwiseDisjoint id) + (hΛm : ∀ lam ∈ Λ, (lam ∩ C₁).Nonempty ∧ (lam ∩ C₂).Nonempty) + (hΛv : ∀ lam ∈ Λ, ∀ d ∈ lam ∩ (C₁ ∪ C₂), d ∈ G_D.V ∧ + (N.φ d ∈ K.U ∨ ∃ z ∈ G.V ∩ bd S, d = l z)) : + Λ.ncard ≤ (G_D.V ∩ (F \ {s, t})).ncard := by + by_contra hlt + have : T2Space S := hS.2.1 + have : T2Space N.D := N.isSurface_D.2.1 + have hFbd : F ∩ bd N.D = {s, t} := proper_arc_inter_bd hF hEnds + obtain ⟨Z, hZ, hZn, hZc, hFZ, hZF⟩ := N.exists_short_disc hS hc hmodel hv hG hmin hJ hPull hbd + hii hiii hFn hF hEnds hFbd (by omega) + have hμv : muModel a b c k ≤ vSurface S k := hv ▸ (constants_bounds_4_6 hc).2.1 + have hmodelc : ∀ {a' b' c' : ℕ}, c' < 2 → ¬Nonempty (S ≃ₜ SurfaceModel a' b' c') := by + rintro a' b' c' hlt' ⟨e⟩ + have := ncard_cuffs_eq_of_surface_model e + omega + have hval := theorem_2_3_proof hS (hmodelc (by omega)) (hmodelc (by omega)) (hmodelc + (by omega)) hG + hmin hJ + have hmiss := N.disc_misses_seam hS hcuffs hJ hval hPull hFn hEnds hFbd hZ hFZ hZF + have hsbd : s ∈ F ∩ bd N.D := hFbd.symm ▸ Or.inl rfl + have htbd : t ∈ F ∩ bd N.D := hFbd.symm ▸ Or.inr rfl + have hsU : N.φ s ∈ J.U := hJ.2.1 ▸ mem_image_of_mem N.φ hsbd.2 + have htU : N.φ t ∈ J.U := hJ.2.1 ▸ mem_image_of_mem N.φ htbd.2 + have hsubV : J.V ∪ {N.φ s, N.φ t} ⊆ J.U := by + refine union_subset J.V_subset_U ?_ + rintro x (rfl | h) + · exact hsU + · exact (mem_singleton_iff.mp h) ▸ htU + obtain ⟨J', hU', hV'⟩ := exists_drawing_with_more_vertices J (J.finite_V.union (by simp)) + subset_union_left hsubV + obtain ⟨X, hXc, hXU, hXA, hAX, hsX, htX, -, -⟩ := N.exists_seam_arc hJ hPull hFn hEnds hFbd + hZ.isOArc_discBd hFZ hZF hU' (hV' ▸ Or.inr (Or.inl rfl)) (hV' ▸ Or.inr (Or.inr rfl)) + obtain ⟨R, R', C, hCe, hR, hR'c, hRu, hCbd, hCR, hCR', hbR, hRZ, hCA, hYline, hCst⟩ := + N.exists_disc_side hS hJ hEnds hFbd hC hZ hmiss hFZ hZF + -- Claim (2): `φ` maps `R` and its boundary `C ∪ F` one to one onto `Z` and `A`, so `φ(C) = A - + -- φ(F)`. + have hmanD := N.isSurface_D.2.2 + have hRint : InjOn N.φ (discInt R) := fun x hx y _ he => + N.interior_inj x (fun hb => hb (isInteriorPoint_of_mem_discInt hmanD hR hx)) y he + have hRbd : N.φ '' discBd R ⊆ discBd Z := by + rintro _ ⟨x, hx, rfl⟩ + rw [hbR] at hx + rcases hx with hx | hx + · exact hCA x hx + · exact hFZ (mem_image_of_mem _ hx) + obtain ⟨hinjR, -, hbdR⟩ := injOn_of_disc_to_disc hmanD hS.2.2 N.quotientMap_φ.continuous + (finite_preimage_singleton N) hR hZ + hRint hRZ hRbd + have hCF : Disjoint C F := by + rw [disjoint_left] + intro x hxC hxF + have hx : x ∈ F ∩ bd N.D := ⟨hxF, hCbd hxC⟩ + rw [hFbd] at hx + exact (eq_empty_iff_forall_notMem.mp hCst) x ⟨hxC, hx⟩ + have hclaim2 : N.φ '' C = discBd Z \ N.φ '' F := by + rw [← hbdR, hbR] + apply Subset.antisymm + · rintro _ ⟨x, hx, rfl⟩ + refine ⟨mem_image_of_mem _ (.inl hx), ?_⟩ + rintro ⟨y, hy, he⟩ + have hyR : y ∈ discBd R := hbR ▸ .inr hy + have hxR : x ∈ discBd R := hbR ▸ .inl hx + have := hinjR (Surface.discBd_subset R hyR) (Surface.discBd_subset R hxR) he + exact disjoint_left.mp hCF hx (this ▸ hy) + · rintro _ ⟨⟨x, hx | hx, rfl⟩, hn⟩ + · exact mem_image_of_mem _ hx + · exact absurd (mem_image_of_mem _ hx) hn + have hCX : ∀ x ∈ C, N.φ x ∈ X := by + intro x hx + have hxA : N.φ x ∈ discBd Z \ N.φ '' F := hclaim2 ▸ mem_image_of_mem N.φ hx + exact (hAX hxA.1).resolve_left fun h => hxA.2 (image_mono sdiff_subset h) + have hnorm : G.IsNormal J.U := by + rw [hJ.2.1] + exact ((N.isNormalFor_iff hS G).mp hmin.1).2 + have hbdJ : bd S ⊆ J.U := hJ.2.1 ▸ N.bd_subset_seamU + have hmemC : ∀ lam ∈ Λ, (lam ∩ C).Nonempty := by + intro lam hlam + rcases hCe with rfl | rfl + · exact (hΛm lam hlam).1 + · exact (hΛm lam hlam).2 + have hsideC : ∀ {d : N.D}, d ∈ C → d ∈ C₁ ∪ C₂ := by + intro d hd + rcases hCe with rfl | rfl + · exact .inl hd + · exact .inr hd + -- Claim (3). + have hclaim : ∀ lam ∈ Λ, ∀ d ∈ lam ∩ C, N.φ d ∈ K.U := by + intro lam hlam d hd + obtain ⟨-, h | ⟨z, hz, rfl⟩⟩ := hΛv lam hlam d ⟨hd.1, hsideC hd.2⟩ + · exact h + exfalso + obtain ⟨hφ, C', hC', hzC', n, P, e, hP, hdis, I, hI, hfirst⟩ := hl z hz + have hzA : z ∈ discBd Z := hφ ▸ hCA _ hd.2 + refine no_lift_on_side hS.2.2 hZ hmiss hbdJ hZn hZc hμv hi hz.1 hzA hC' hzC' hP hdis hI ?_ + intro i hiI + obtain ⟨f, hf, hlc, -⟩ := hfirst i hiI + have hfG : f ∈ G.E := (hP i).1.2 hf + have hfoff := hfG.2.1 + refine ⟨f, hf, ?_, ?_⟩ + · have h₁ := image_closure_subset_closure_image (s := N.φ ⁻¹' f) + N.quotientMap_φ.continuous (mem_image_of_mem _ hlc) + rw [hφ] at h₁ + exact closure_mono (image_preimage_subset _ _) h₁ + · have hdisA : Disjoint f (discBd Z) := by + rw [disjoint_left] + intro x hxf hxA + exact (hfoff hxf).2 (hZn ⟨hxA, (hfoff hxf).1⟩) + obtain ⟨y, hyR', hyf⟩ := mem_closure_iff.mp hlc _ hR'c.isOpen_compl + (fun h => disjoint_left.mp hCR' hd.2 h) + have hyf' : N.φ y ∈ f := hyf + have hyb : y ∉ bd N.D := fun h => + (hfoff hyf').2 (hnorm ⟨hJ.2.1 ▸ mem_image_of_mem N.φ h, (hfoff hyf').1⟩) + have hyF : y ∉ F := by + intro h + have hyU : y ∈ G_D.U := by + rw [hPull.1] + exact (hfoff hyf').1 + have hyV : y ∈ G_D.V := hFn ⟨h, hyU⟩ + rw [hPull.2] at hyV + exact (hfoff hyf').2 hyV + have hyR : y ∈ R := (hRu ▸ mem_univ y : y ∈ R ∪ R').resolve_right hyR' + have hyint : y ∈ discInt R := ⟨hyR, fun h => by + rw [hbR] at h + rcases h with h | h + · exact hyb (hCbd h) + · exact hyF h⟩ + have hyZ : N.φ y ∈ discInt Z := hRZ (mem_image_of_mem _ hyint) + rcases hZ.side hS.2.2 hfG.2.2.1.isConnected.isPreconnected hdisA with h | h + · exact h + · exact (disjoint_left.mp h hyf' hyZ.1).elim + -- A long edge through `φ(d)`, and the two buffers. + have hΛne : Λ.Nonempty := by + by_contra hemp + rw [not_nonempty_iff_eq_empty] at hemp + rw [hemp, ncard_empty] at hlt + omega + obtain ⟨lam₀, hlam₀⟩ := hΛne + obtain ⟨d₀, hd₀⟩ := hmemC lam₀ hlam₀ + obtain ⟨e, u, hu, hud⟩ := mem_iUnion.mp (hKU (hclaim lam₀ hlam₀ d₀ hd₀)) + have hXfin : (X ∩ G.V).Finite := G.finite_V.subset inter_subset_right + have hXsub : X ∩ G.V ⊆ discBd Z ∩ G.V := fun _ hx => ⟨hXA hx.1, hx.2⟩ + have hXc' : (X ∩ G.V).ncard ≤ muModel a b c k := + (Set.ncard_le_ncard hXsub (G.finite_V.subset inter_subset_right)).trans hZc + have hbuf : ∀ T : Set unitInterval, + (γ e.1 '' T ∩ G.V).ncard = muModel a b c k + 1 → ∃ r ∈ T, γ e.1 r ∉ X := by + intro T hT + by_contra hno + push Not at hno + have hsub : γ e.1 '' T ∩ G.V ⊆ X ∩ G.V := by + rintro _ ⟨⟨r, hr, rfl⟩, hxV⟩ + exact ⟨hno r hr, hxV⟩ + have := Set.ncard_le_ncard hsub hXfin + omega + obtain ⟨hs0, ht0, hlt', hleft, hright⟩ := hcut e + obtain ⟨p, hp, hpX⟩ := hbuf _ hleft + obtain ⟨q, hq, hqX⟩ := hbuf _ hright + have hd₀X := hCX d₀ hd₀.2 + rw [← hud] at hd₀X + have hup : p < u := lt_of_le_of_ne ((show p ≤ sK e from hp).trans hu.1) + fun h => hpX (h ▸ hd₀X) + have huq : u < q := lt_of_le_of_ne (hu.2.trans (show tK e ≤ q from hq)) + fun h => hqX (h ▸ hd₀X) + have hXpiece := subset_edge_piece hγ e.2.1 hXc hXU hpX hqX hd₀X ⟨u, ⟨hup, huq⟩, rfl⟩ + have hXe : X ⊆ e.1 := by + intro x hx + obtain ⟨r, hr, rfl⟩ := hXpiece hx + refine (hγ.image e.1 e.2.1).subset ⟨r, ?_, rfl⟩ + exact ⟨lt_of_le_of_lt unitInterval.nonneg' hr.1, lt_of_lt_of_le hr.2 unitInterval.le_one'⟩ + -- The side `C` lies in one side of a pair, and the exchange gives the last inequality. + have hYX : ∀ y ∈ C ∪ {s, t}, N.φ y ∈ X := by + rintro y (h | rfl | h) + · exact hCX y h + · exact hsX + · exact (mem_singleton_iff.mp h) ▸ htX + have hoffbd : ∀ y ∈ C ∪ {s, t}, N.φ y ∉ bd S := fun y hy h => + disjoint_left.mp (longSeamEdge_disjoint_bd hS N hJ hbd e.2) (hXe (hYX y hy)) h + have hoffV : ∀ y ∈ C ∪ {s, t}, N.φ y ∉ N.seamV := fun y hy h => + (e.2.1.2.1 (hXe (hYX y hy))).2 (hJ.2.2 ▸ h) + have hYbd : C ∪ {s, t} ⊆ bd N.D := by + rintro y (h | rfl | h) + · exact hCbd h + · exact hsbd.2 + · exact (mem_singleton_iff.mp h) ▸ htbd.2 + obtain ⟨i, hside⟩ := N.exists_side_of_connected (line_preconnected hYline) + ⟨s, .inr (.inl rfl)⟩ hYbd hoffbd hoffV + obtain ⟨hle, -⟩ := N.contacts_le_of_side hS i hmin hEnds hFbd hPull hFn hYline hside hoffV + have hYC : (C ∪ {s, t}) \ {s, t} = C := by + rw [union_sdiff_right] + exact sdiff_eq_left.mpr (disjoint_iff_inter_eq_empty.mpr hCst) + rw [hYC, N.ncard_image_inter_of_injOn hPull (hinjR.mono hCR), + N.ncard_image_inner_inter hPull hFbd] at hle + have hchoose : ∀ lam : Λ, ∃ d, d ∈ lam.1 ∩ C := fun lam => hmemC lam.1 lam.2 + choose dd hdd using hchoose + have hcount : Λ.ncard ≤ (G_D.V ∩ C).ncard := by + have hfinV : (G_D.V ∩ C).Finite := G_D.finite_V.subset inter_subset_left + have hinjd : Function.Injective fun lam : (Λ : Set (Set N.D)) => dd lam := by + intro lam lam' heq + by_contra hne + have hdis := hΛd lam.2 lam'.2 (fun h => hne (Subtype.ext h)) + have heq' : dd lam = dd lam' := heq + exact disjoint_left.mp hdis (hdd lam).1 (heq'.symm ▸ (hdd lam').1) + have hmaps : ∀ lam : Λ, dd lam ∈ G_D.V ∩ C := fun lam => + ⟨(hΛv lam.1 lam.2 _ ⟨(hdd lam).1, hsideC (hdd lam).2⟩).1, (hdd lam).2⟩ + have : Finite ↥(G_D.V ∩ C) := hfinV.to_subtype + have hle' := Nat.card_le_card_of_injective (fun lam : Λ => (⟨dd lam, hmaps lam⟩ : + ↥(G_D.V ∩ C))) (fun x y h => hinjd (congrArg Subtype.val h)) + simpa only [Nat.card_coe_set_eq] using hle' + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46DeficientCap.lean b/LeanPool/GraphMinor/GM07/Section46DeficientCap.lean new file mode 100644 index 0000000000..4ecba33d43 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46DeficientCap.lean @@ -0,0 +1,349 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.NetSwapBoundary +public import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.CutLift +import LeanPool.GraphMinor.Surface.Fan +import LeanPool.GraphMinor.Surface.PlaneDisc +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# A disc beside a cap + +Page 228 of VII (4.6). A circle `A` bounds a disc `R` that contains a cap `E`, and `B` is an arc of +`A` that meets `E` only in its ends. Then `B` and one arc of `bd(E)` bound a disc that misses the +inside of `E`. To see this, we cut `R` and `E` along one chord of `E` between the ends of `B`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {T : Type u} [TopologicalSpace T] + +/-- Two points of the boundary of a closed disc are joined by a chord. We pull the chord back from +the unit disc, since `Surface.exists_chord` is stated for spaces in the lowest universe. -/ +theorem exists_disc_chord [T2Space T] {E : Set T} (hE : IsClosedDisc E) {a b : T} + (ha : a ∈ discBd E) (hb : b ∈ discBd E) (hab : a ≠ b) : + ∃ c, IsLineWithEnds c a b ∧ c ⊆ E ∧ c ∩ discBd E = {a, b} := by + obtain ⟨eE⟩ := hE + let B : Set ℂ := Metric.closedBall (0 : ℂ) 1 + obtain ⟨e₀⟩ := (isClosedDisc_closedBall.1 : IsClosedDisc B) + let e : B ≃ₜ E := e₀.symm.trans eE + have hb₀ : ∀ z : B, (e z).1 ∈ discBd E ↔ z.1 ∈ discBd B := by + intro z + have h := image_bd_homeomorph e + constructor + · rintro ⟨w, hw, hwz⟩ + have hw' : w ∈ e '' bd B := h ▸ hw + obtain ⟨y, hy, rfl⟩ := hw' + exact ⟨y, hy, by rw [e.injective (Subtype.ext hwz)]⟩ + · rintro ⟨w, hw, hwz⟩ + have hzw : z = w := Subtype.ext hwz.symm + exact ⟨e z, h ▸ mem_image_of_mem e (hzw ▸ hw), rfl⟩ + have hbE : ∀ {p : T}, p ∈ discBd E → ∃ z : B, z.1 ∈ discBd B ∧ (e z).1 = p := by + intro p hp + obtain ⟨q, _, rfl⟩ := hp + have hq : ∃ q' : E, q'.1 = q.1 := ⟨q, rfl⟩ + refine ⟨e.symm q, ?_, by simp⟩ + rw [← hb₀, e.apply_symm_apply] + exact ⟨q, by assumption, rfl⟩ + obtain ⟨za, hza, hea⟩ := hbE ha + obtain ⟨zb, hzb, heb⟩ := hbE hb + have hne : za.1 ≠ zb.1 := fun h => hab (by rw [← hea, ← heb, Subtype.ext h]) + obtain ⟨F₀, hF₀, hsub, hcap⟩ := Surface.exists_chord (Δ := B) isClosedDisc_closedBall.1 hza hzb + hne + obtain ⟨k, hk, hkr, hk0, hk1⟩ := hF₀.exists_arc + have hkB : ∀ t, k t ∈ B := fun t => hsub (hkr ▸ mem_range_self t) + let k' : unitInterval → T := fun t => (e ⟨k t, hkB t⟩).1 + have hk' : IsArcMap k' := ⟨continuous_subtype_val.comp (e.continuous.comp + (hk.1.subtype_mk hkB)), fun x y h => hk.2 (congrArg Subtype.val (e.injective (Subtype.ext h)))⟩ + have h0 : k' 0 = a := by + change (e ⟨k 0, _⟩).1 = a + rw [show (⟨k 0, hkB 0⟩ : B) = za from Subtype.ext hk0, hea] + have h1 : k' 1 = b := by + change (e ⟨k 1, _⟩).1 = b + rw [show (⟨k 1, hkB 1⟩ : B) = zb from Subtype.ext hk1, heb] + refine ⟨range k', by simpa only [h0, h1] using hk'.isLineWithEnds, ?_, ?_⟩ + · rintro _ ⟨t, rfl⟩ + exact (e ⟨k t, hkB t⟩).2 + ext x + constructor + · rintro ⟨⟨t, rfl⟩, hx⟩ + have hb' : k t ∈ F₀ ∩ discBd B := ⟨hkr ▸ mem_range_self t, (hb₀ ⟨k t, hkB t⟩).mp hx⟩ + rw [hcap] at hb' + rcases hb' with h | h + · refine Or.inl ?_ + change (e ⟨k t, hkB t⟩).1 = a + rw [show (⟨k t, hkB t⟩ : B) = za from Subtype.ext h, hea] + · refine Or.inr ?_ + change (e ⟨k t, hkB t⟩).1 = b + rw [show (⟨k t, hkB t⟩ : B) = zb from Subtype.ext h, heb] + · rintro (rfl | hx) + · exact ⟨h0 ▸ mem_range_self 0, ha⟩ + · rw [mem_singleton_iff.mp hx] + exact ⟨h1 ▸ mem_range_self 1, hb⟩ + +/-- A line has a point other than its two ends. -/ +theorem exists_mem_line_ne {a b : T} {c : Set T} (hc : IsLineWithEnds c a b) (_hab : a ≠ b) : + ∃ p ∈ c, p ≠ a ∧ p ≠ b := by + obtain ⟨f, f0, f1⟩ := hc + let m : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + refine ⟨(f m).1, (f m).2, ?_, ?_⟩ + · intro h + have : f m = f 0 := Subtype.ext (h.trans f0.symm) + have h2 := congrArg Subtype.val (f.injective this) + norm_num [m] at h2 + · intro h + have : f m = f 1 := Subtype.ext (h.trans f1.symm) + have h2 := congrArg Subtype.val (f.injective this) + norm_num [m] at h2 + +private theorem beside_cap_aux [T2Space T] (hman : ∀ x : T, IsManifoldPoint x) + {R E B c Δ₁ Q D₁ D₂ L L' : Set T} {a b : T} (hab : a ≠ b) + (hB : IsLineWithEnds B a b) (hBE : B ∩ E ⊆ {a, b}) + (hc : IsLineWithEnds c a b) (hcE : c ⊆ E) (hcbd : c ∩ discBd E = {a, b}) + (hΔ₁ : IsClosedDisc Δ₁) (hbΔ₁ : discBd Δ₁ = B ∪ c) + (hQΔ : Q ∩ Δ₁ ⊆ c) (hbdR : discBd R = B ∪ Q) + (hD₂ : IsClosedDisc D₂) (hDu : D₁ ∪ D₂ = E) + (hb₁ : discBd D₁ = L' ∪ c) (hb₂ : discBd D₂ = L ∪ c) + (hL : IsLineWithEnds L a b) (hLE : L ⊆ discBd E) (hL'E : L' ⊆ discBd E) + (hint₂ : discInt D₂ ⊆ discInt E) + (hin : discInt D₂ ⊆ discInt Δ₁) (hout : Disjoint (discInt D₁) Δ₁) : + ∃ Z, IsClosedDisc Z ∧ discBd Z = L ∪ B ∧ Disjoint Z (discInt E) ∧ + Disjoint (L \ {a, b}) (discBd R) := by + obtain ⟨k, hk, hkr, hk0, hk1⟩ := hB.exists_arc + subst hkr + subst hk0 hk1 + have hcl : IsClosed Δ₁ := hΔ₁.isClosed + have hD₂Δ : D₂ ⊆ Δ₁ := hD₂.subset_closure_discInt.trans + (closure_minimal (hin.trans (discInt_subset _)) hcl) + have hLD₂ : L ⊆ D₂ := fun x hx => discBd_subset _ (hb₂ ▸ .inl hx) + have hLΔ : L ⊆ Δ₁ := hLD₂.trans hD₂Δ + have hends : ({k 0, k 1} : Set T) ⊆ L ∧ ({k 0, k 1} : Set T) ⊆ discBd Δ₁ := by + constructor + · rintro x (rfl | hx) + · exact hL.left_mem + · exact (mem_singleton_iff.mp hx) ▸ hL.right_mem + · rintro x (rfl | hx) + · exact hbΔ₁ ▸ .inr hc.left_mem + · exact hbΔ₁ ▸ .inr ((mem_singleton_iff.mp hx) ▸ hc.right_mem) + have hLbd : L ∩ discBd Δ₁ = {k 0, k 1} := by + apply Subset.antisymm + · rintro x ⟨hxL, hxb⟩ + rw [hbΔ₁] at hxb + rcases hxb with h | h + · exact hBE ⟨h, discBd_subset _ (hLE hxL)⟩ + · exact hcbd ▸ ⟨h, hLE hxL⟩ + · exact fun x hx => ⟨hends.1 hx, hends.2 hx⟩ + obtain ⟨C', Z, Y, hC', hcov, hZ, hY, hZY, hZYi, hbZ, hbY, hrest⟩ := + exists_disc_cut_with_boundary_arc hΔ₁ k hk (hbΔ₁ ▸ subset_union_left) hL hLΔ hLbd + have hinner : ∀ x ∈ c, x ≠ k 0 → x ≠ k 1 → x ∉ discBd E := fun x hx h0 h1 hxb => by + have : x ∈ c ∩ discBd E := ⟨hx, hxb⟩ + rw [hcbd] at this + rcases this with h | h + · exact h0 h + · exact h1 h + have hcZ : ∀ x ∈ c, x ≠ k 0 → x ≠ k 1 → x ∉ Z := by + intro x hx h0 h1 hxZ + have hxY : x ∈ Y := by + apply hrest + refine ⟨hbΔ₁ ▸ .inr hx, ?_⟩ + intro hxr + rcases hBE ⟨hxr, hcE hx⟩ with h | h + · exact h0 h + · exact h1 h + have hxL : x ∈ L := hZYi ▸ ⟨hxZ, hxY⟩ + exact hinner x hx h0 h1 (hLE hxL) + have hBint : ∀ x ∈ discInt E, x ∉ range k := by + intro x hx hxB + rcases hBE ⟨hxB, hx.1⟩ with h | h + · exact hx.2 (hcbd.symm.subset (.inl h)).2 + · exact hx.2 (hcbd.symm.subset (.inr h)).2 + have hZD₂ : Disjoint (discInt D₂) Z := by + have hdis : Disjoint (discInt D₂) (discBd Z) := by + rw [disjoint_left, hbZ] + rintro x hx (h | h) + · exact hBint x (hint₂ hx) h + · exact hx.2 (hb₂ ▸ .inl h) + rcases hZ.side hman hD₂.isPreconnected_discInt hdis with hsub | h + · exfalso + obtain ⟨p, hp, hp0, hp1⟩ := exists_mem_line_ne hc hab + have hpD : p ∈ D₂ := discBd_subset _ (hb₂ ▸ .inr hp) + have : D₂ ⊆ Z := hD₂.subset_closure_discInt.trans + (closure_minimal (hsub.trans (discInt_subset _)) hZ.isClosed) + exact hcZ p hp hp0 hp1 (this hpD) + · exact h + have hZΔ : Z ⊆ Δ₁ := hZY ▸ subset_union_left + refine ⟨Z, hZ, ?_, ?_, ?_⟩ + · rw [hbZ, union_comm] + · rw [disjoint_right] + intro x hx hxZ + have hxE : x ∈ D₁ ∪ D₂ := hDu ▸ hx.1 + have hnc : x ∈ c → False := fun hxc => by + refine hcZ x hxc ?_ ?_ hxZ + · rintro rfl + exact hx.2 (hcbd.symm.subset (.inl rfl)).2 + · rintro rfl + exact hx.2 (hcbd.symm.subset (.inr rfl)).2 + rcases hxE with h | h + · by_cases hb : x ∈ discBd D₁ + · rcases hb₁ ▸ hb with h' | h' + · exact hx.2 (hL'E h') + · exact hnc h' + · exact disjoint_left.mp hout ⟨h, hb⟩ (hZΔ hxZ) + · by_cases hb : x ∈ discBd D₂ + · rcases hb₂ ▸ hb with h' | h' + · exact hx.2 (hLE h') + · exact hnc h' + · exact disjoint_left.mp hZD₂ ⟨h, hb⟩ hxZ + · rw [disjoint_left] + rintro x ⟨hxL, hxe⟩ hxb + rw [hbdR] at hxb + rcases hxb with h | h + · exact hxe (hBE ⟨h, discBd_subset _ (hLE hxL)⟩) + · have hxc : x ∈ c := hQΔ ⟨h, hLΔ hxL⟩ + exact hxe (hcbd ▸ ⟨hxc, hLE hxL⟩) + +/-- The disc beside a cap, on page 228 of VII (4.6). The disc `R` contains the disc `E`, and `B` is +an arc of `bd(R)` that meets `E` only in its ends. Then one arc `C` of `bd(E)` with the same ends +as `B` bounds, with `B`, a disc that misses the inside of `E`, and the inside of `C` misses +`bd(R)`. -/ +theorem exists_disc_beside_cap [T2Space T] (hman : ∀ x : T, IsManifoldPoint x) + {R E B : Set T} {a b : T} (hab : a ≠ b) (hR : IsClosedDisc R) (hE : IsClosedDisc E) + (hER : E ⊆ R) (hEB : Disjoint (discInt E) (discBd R)) (hB : IsLineWithEnds B a b) + (hBR : B ⊆ discBd R) (hBE : B ∩ E ⊆ {a, b}) (ha : a ∈ discBd E) (hb : b ∈ discBd E) : + ∃ Z C, IsLineWithEnds C a b ∧ C ⊆ discBd E ∧ IsClosedDisc Z ∧ discBd Z = C ∪ B ∧ + Disjoint Z (discInt E) ∧ Disjoint (C \ {a, b}) (discBd R) := by + obtain ⟨c, hc, hcE, hcbd⟩ := exists_disc_chord hE ha hb hab + have hbdc : ∀ x ∈ c, x ≠ a → x ≠ b → x ∈ discInt E := fun x hx h0 h1 => + ⟨hcE hx, fun hxb => by + have : x ∈ c ∩ discBd E := ⟨hx, hxb⟩ + rw [hcbd] at this + rcases this with h | h + · exact h0 h + · exact h1 h⟩ + have hBa : a ∈ discBd R := hBR hB.left_mem + have hBb : b ∈ discBd R := hBR hB.right_mem + have hcR : c ∩ discBd R = {a, b} := by + apply Subset.antisymm + · rintro x ⟨hxc, hxb⟩ + by_contra hn + have h0 : x ≠ a := fun h => hn (.inl h) + have h1 : x ≠ b := fun h => hn (.inr h) + exact disjoint_left.mp hEB (hbdc x hxc h0 h1) hxb + · rintro x (rfl | hx) + · exact ⟨hc.left_mem, hBa⟩ + · rw [mem_singleton_iff.mp hx] + exact ⟨hc.right_mem, hBb⟩ + obtain ⟨k, hk, hkr, hk0, hk1⟩ := hB.exists_arc + obtain ⟨Q, Δ₁, Δ₂, hQ, hcov, hd₁, hd₂, hu, hi, hb₁, hb₂, hrest⟩ := + exists_disc_cut_with_boundary_arc hR k hk (hkr ▸ hBR) (hk0 ▸ hk1 ▸ hc) + (hcE.trans hER) (hk0 ▸ hk1 ▸ hcR) + rw [hkr] at hcov hb₁ + rw [hk0, hk1] at hQ + obtain ⟨P, P', hP, hP', hPu, hPi⟩ := IsOArc.lines hE.isOArc_discBd ha hb hab + obtain ⟨k', hk', hkr', hk0', hk1'⟩ := hP.exists_arc + obtain ⟨P₂, D₁, D₂, hP₂, hcovE, hD₁, hD₂, huE, hiE, hbD₁, hbD₂, -⟩ := + exists_disc_cut_with_boundary_arc hE k' hk' (hkr' ▸ hPu ▸ subset_union_left) + (hk0' ▸ hk1' ▸ hc) hcE (hk0' ▸ hk1' ▸ hcbd) + rw [hkr'] at hcovE hbD₁ + rw [hk0', hk1'] at hP₂ + have hP₁E : P ⊆ discBd E := hcovE ▸ subset_union_left + have hP₂E : P₂ ⊆ discBd E := hcovE ▸ subset_union_right + have hint₁ : discInt D₁ ⊆ discInt E := by + intro x hx + refine ⟨huE ▸ .inl hx.1, ?_⟩ + intro hxb + rcases hcovE ▸ hxb with h | h + · exact hx.2 (hbD₁ ▸ .inl h) + · have hx2 : x ∈ D₂ := discBd_subset _ (hbD₂ ▸ .inl h) + exact hx.2 (hbD₁ ▸ .inr (hiE ▸ ⟨hx.1, hx2⟩)) + have hint₂ : discInt D₂ ⊆ discInt E := by + intro x hx + refine ⟨huE ▸ .inr hx.1, ?_⟩ + intro hxb + rcases hcovE ▸ hxb with h | h + · have hx1 : x ∈ D₁ := discBd_subset _ (hbD₁ ▸ .inl h) + exact hx.2 (hbD₂ ▸ .inr (hiE ▸ ⟨hx1, hx.1⟩)) + · exact hx.2 (hbD₂ ▸ .inl h) + have hBint : ∀ x ∈ discInt E, x ∉ B := by + intro x hx hxB + rcases hBE ⟨hxB, hx.1⟩ with h | h + · exact hx.2 (h ▸ ha) + · exact hx.2 ((mem_singleton_iff.mp h) ▸ hb) + have hside : ∀ {X L₀ : Set T}, IsClosedDisc X → discInt X ⊆ discInt E → + discBd X = L₀ ∪ c → discInt X ⊆ discInt Δ₁ ∨ Disjoint (discInt X) Δ₁ := by + intro X L₀ hX hXi hXb + refine hd₁.side hman hX.isPreconnected_discInt ?_ + rw [disjoint_left, hb₁] + rintro x hx (h | h) + · exact hBint x (hXi hx) h + · exact hx.2 (hXb ▸ .inr h) + obtain ⟨p, hp, hp0, hp1⟩ := exists_mem_line_ne hc hab + have hpE : p ∈ discInt E := hbdc p hp hp0 hp1 + have hopen : IsOpen (discInt E) := hE.isOpen_discInt hman + have hpick : ∀ {W : Set T} (hW : IsClosedDisc W), p ∈ W → + ∃ y ∈ discInt W, y ∈ discInt E := by + intro W hW hpW + have := hW.subset_closure_discInt hpW + obtain ⟨y, hy, hyW⟩ := mem_closure_iff.mp this _ hopen hpE + exact ⟨y, hyW, hy⟩ + have hsplit : ∀ {W L₀ : Set T}, IsClosedDisc W → c ⊆ discBd W → ∀ y ∈ discInt W, + y ∈ discInt E → y ∈ discInt D₁ ∨ y ∈ discInt D₂ := by + intro W L₀ hW hcW y hyW hyE + have hyc : y ∉ c := fun h => hyW.2 (hcW h) + rcases (huE ▸ hyE.1 : y ∈ D₁ ∪ D₂) with h | h + · refine .inl ⟨h, fun hb' => ?_⟩ + rcases hbD₁ ▸ hb' with h' | h' + · exact hyE.2 (hP₁E h') + · exact hyc h' + · refine .inr ⟨h, fun hb' => ?_⟩ + rcases hbD₂ ▸ hb' with h' | h' + · exact hyE.2 (hP₂E h') + · exact hyc h' + have hc₁ : c ⊆ discBd Δ₁ := hb₁ ▸ subset_union_right + have hc₂ : c ⊆ discBd Δ₂ := hb₂ ▸ subset_union_right + obtain ⟨y₁, hy₁, hy₁E⟩ := hpick hd₁ (discBd_subset _ (hc₁ hp)) + obtain ⟨y₂, hy₂, hy₂E⟩ := hpick hd₂ (discBd_subset _ (hc₂ hp)) + have hoff : ∀ y ∈ discInt Δ₂, y ∉ Δ₁ := fun y hy hy' => hy.2 (hc₂ (hi ▸ ⟨hy', hy.1⟩)) + have hy₁s := hsplit (L₀ := B) hd₁ hc₁ y₁ hy₁ hy₁E + have hy₂s := hsplit (L₀ := B) hd₂ hc₂ y₂ hy₂ hy₂E + have hQΔ : Q ∩ Δ₁ ⊆ c := fun x hx => hi ▸ ⟨hx.2, discBd_subset _ (hb₂ ▸ .inl hx.1)⟩ + have hbdR : discBd R = B ∪ Q := hcov.symm + have hs₁ := hside hD₁ hint₁ hbD₁ + have hs₂ := hside hD₂ hint₂ hbD₂ + have hcase : (discInt D₂ ⊆ discInt Δ₁ ∧ Disjoint (discInt D₁) Δ₁) ∨ + (discInt D₁ ⊆ discInt Δ₁ ∧ Disjoint (discInt D₂) Δ₁) := by + rcases hs₁ with h₁ | h₁ <;> rcases hs₂ with h₂ | h₂ + · exfalso + rcases hy₂s with h | h + · exact hoff y₂ hy₂ (discInt_subset _ (h₁ h)) + · exact hoff y₂ hy₂ (discInt_subset _ (h₂ h)) + · exact .inr ⟨h₁, h₂⟩ + · exact .inl ⟨h₂, h₁⟩ + · exfalso + rcases hy₁s with h | h + · exact disjoint_left.mp h₁ h hy₁.1 + · exact disjoint_left.mp h₂ h hy₁.1 + rcases hcase with ⟨hin, hout⟩ | ⟨hin, hout⟩ + · obtain ⟨Z, hZ, hbZ, hZE, hoffR⟩ := beside_cap_aux hman hab hB hBE hc hcE hcbd hd₁ hb₁ + hQΔ hbdR hD₂ huE hbD₁ hbD₂ hP₂ hP₂E hP₁E hint₂ hin hout + exact ⟨Z, P₂, hP₂, hP₂E, hZ, hbZ, hZE, hoffR⟩ + · obtain ⟨Z, hZ, hbZ, hZE, hoffR⟩ := beside_cap_aux hman hab hB hBE hc hcE hcbd hd₁ hb₁ + hQΔ hbdR hD₁ (by rwa [union_comm]) hbD₂ hbD₁ hP hP₁E hP₂E hint₁ hin hout + exact ⟨Z, P, hP, hP₁E, hZ, hbZ, hZE, hoffR⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46DeficientDisc.lean b/LeanPool/GraphMinor/GM07/Section46DeficientDisc.lean new file mode 100644 index 0000000000..04e2fd2f92 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46DeficientDisc.lean @@ -0,0 +1,354 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section2 +public import LeanPool.GraphMinor.GM07.Section46Constants +public import LeanPool.GraphMinor.GM07.Section26Path +public import LeanPool.GraphMinor.GM07.Section46DeficientCap +import LeanPool.GraphMinor.GM07.Section3 +import LeanPool.GraphMinor.GM07.Section5b +import LeanPool.GraphMinor.GM07.Section46NullCircle +import LeanPool.GraphMinor.GM07.CutBounds +import LeanPool.GraphMinor.Surface.ChartCells +import LeanPool.GraphMinor.Surface.CutLift +import LeanPool.GraphMinor.Surface.SurfacePull +import LeanPool.GraphMinor.Surface.DiscFan +import LeanPool.GraphMinor.GM11.PerimeterExists +import LeanPool.GraphMinor.GM07.Section11a + +/-! +# Step 7 of VII (4.6): a short circle that bounds a disc + +Page 228. If `F` carries few vertices, (2.6) gives a short `O`-arc `A` through `φ(F)`. By (ii), `A` +is null-homotopic in `Σ` or in `Σ + CHat`. In the second case we replace `A` by an arc of `A` and an +arc of `C`. Either way we get a closed disc in `Σ` whose boundary has the properties of `A`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The count on a set in `Δ` is the count on its image, if `φ` is injective on the set. -/ +theorem Net.ncard_image_inter_of_injOn {N : Net S} {G : Drawing S} {G_D : Drawing N.D} + (hPull : IsPullbackDrawing N.φ G G_D) {T : Set N.D} (hinj : InjOn N.φ T) : + (N.φ '' T ∩ G.V).ncard = (G_D.V ∩ T).ncard := by + have himage : N.φ '' T ∩ G.V = N.φ '' (G_D.V ∩ T) := by + ext x + constructor + · rintro ⟨⟨y, hy, rfl⟩, hx⟩ + exact ⟨y, ⟨hPull.2 ▸ hx, hy⟩, rfl⟩ + · rintro ⟨y, ⟨hyV, hy⟩, rfl⟩ + exact ⟨⟨y, hy, rfl⟩, by rw [hPull.2] at hyV; exact hyV⟩ + rw [himage, InjOn.ncard_image (hinj.mono inter_subset_right)] + +/-- The count on `F` in `Δ` is the count on `φ(F)` in `Σ`, because a proper `I`-arc has +its inner points off `bd(Δ)`, and `φ` is injective there. -/ +theorem Net.ncard_image_inner_inter {N : Net S} {G : Drawing S} {G_D : Drawing N.D} + (hPull : IsPullbackDrawing N.φ G G_D) {F : Set N.D} {s t : N.D} + (hF : F ∩ bd N.D = {s, t}) : + (N.φ '' (F \ {s, t}) ∩ G.V).ncard = (G_D.V ∩ (F \ {s, t})).ncard := by + refine N.ncard_image_inter_of_injOn hPull ?_ + intro x hx y _ hxy + refine N.interior_inj x (fun hb => hx.2 ?_) y hxy + rw [← hF] + exact ⟨hx.1, hb⟩ + +/-- The two ends of a proper `I`-arc are its points on the boundary. -/ +theorem proper_arc_inter_bd {T : Type*} [TopologicalSpace T] {F : Set T} {s t : T} + (hF : IsProperIArc F) (hEnds : IsLineWithEnds F s t) : F ∩ bd T = {s, t} := by + obtain ⟨u, v, -, huv, hl⟩ := hF + rw [huv] + apply Subset.antisymm + · rintro x (rfl | rfl) + · exact seam_line_end_mem hl hEnds + · exact seam_line_end_mem (GM07.IsLineWithEnds.symm hl) hEnds + · rintro x (rfl | rfl) + · exact seam_line_end_mem hEnds hl + · exact seam_line_end_mem (GM07.IsLineWithEnds.symm hEnds) hl + +/-- The opening of the deficient case of VII (4.6), page 228: if `F` carries fewer than +`w + k` vertices, (2.6) gives a `G`-normal `O`-arc `A` through `φ(F)`, inside `φ(F) ∪ U(J)`, +with at most `μ` vertices. -/ +theorem Net.exists_short_circle [T1Space S] (hS : IsSurface S) (N : Net S) + {a b c k : ℕ} (hc : 2 ≤ c) (hmodel : Nonempty (S ≃ₜ SurfaceModel a b c)) + {G J : Drawing S} {G_D : Drawing N.D} (hG : G.IsProper) (hmin : N.IsMinimalFor G) + (hJ : N.IsSeamGraphFor J) (hPull : IsPullbackDrawing N.φ G G_D) + (hbd : (G.V ∩ bd S).ncard ≤ 2 * k) + {F : Set N.D} {s t : N.D} (hFn : G_D.IsNormal F) (hF : IsProperIArc F) + (hEnds : IsLineWithEnds F s t) (hFbd : F ∩ bd N.D = {s, t}) + (hsmall : (G_D.V ∩ (F \ {s, t})).ncard + 1 ≤ wMaxModel a b c k + k) : + ∃ A : Set S, G.IsNormal A ∧ IsOArc A ∧ (A ∩ G.V).ncard ≤ muModel a b c k ∧ + N.φ '' F ⊆ A ∧ A ⊆ N.φ '' F ∪ J.U := by + obtain ⟨A, hAn, hAo, hAc, hFA, hAF⟩ := + theorem_2_6_proof hS (by omega) hmodel hG hmin hJ hPull hFn hF hEnds + refine ⟨A, hAn, hAo, hAc.trans ?_, hFA, hAF⟩ + rw [N.ncard_image_inner_inter hPull hFbd, inter_comm (bd S) G.V] + unfold muModel + rw [add_comm (wMaxModel a b c k) k] at hsmall + exact Nat.add_le_add (Nat.mul_le_mul_left _ hsmall) hbd + +/-- A connected part `W` of a line off a closed set `Y`, which contains the ends of the line, lies +in +a subarc that has its ends in `Y` and no other point in `Y`. -/ +theorem exists_gap_of_line {X : Type*} [TopologicalSpace X] [T2Space X] {L Y W : Set X} + {y₁ y₂ : X} (hL : IsLineWithEnds L y₁ y₂) (hY : IsClosed Y) (hy₁ : y₁ ∈ Y) (hy₂ : y₂ ∈ Y) + (hW : IsPreconnected W) (hWne : W.Nonempty) (hWA : W ⊆ L \ Y) : + ∃ (B : Set X) (a b : X), a ≠ b ∧ IsLineWithEnds B a b ∧ B ⊆ L ∧ a ∈ Y ∧ b ∈ Y ∧ W ⊆ B ∧ + ∀ x ∈ B, x ∈ Y → x = a ∨ x = b := by + have hWL : W ⊆ L := fun x hx => (hWA hx).1 + obtain ⟨k, hk, hkr, hk0, hk1⟩ := hL.exists_arc + obtain ⟨w₀, hw₀⟩ := hWne + obtain ⟨u₀, hu₀⟩ : w₀ ∈ range k := hkr ▸ hWL hw₀ + subst hu₀ + have hYk : IsClosed (k ⁻¹' Y) := hY.preimage hk.1 + let P : Set unitInterval := k ⁻¹' Y ∩ Iic u₀ + let Q : Set unitInterval := k ⁻¹' Y ∩ Ici u₀ + have hPc : IsClosed P := hYk.inter isClosed_Iic + have hQc : IsClosed Q := hYk.inter isClosed_Ici + have hPne : P.Nonempty := ⟨0, by simpa only [mem_preimage, hk0] using hy₁, unitInterval.nonneg'⟩ + have hQne : Q.Nonempty := ⟨1, by simpa only [mem_preimage, hk1] using hy₂, unitInterval.le_one'⟩ + have ha := hPc.csSup_mem hPne (OrderTop.bddAbove _) + have hb := hQc.csInf_mem hQne (OrderBot.bddBelow _) + set a := sSup P + set b := sInf Q + have hne₀ : ∀ {x}, x ∈ k ⁻¹' Y → x ≠ u₀ := fun {x} hx h => (hWA hw₀).2 (h ▸ hx) + have hau : a < u₀ := lt_of_le_of_ne ha.2 (hne₀ ha.1) + have hub : u₀ < b := lt_of_le_of_ne hb.2 (hne₀ hb.1).symm + have hab : a < b := hau.trans hub + have hkinj : Function.Injective k := hk.2 + refine ⟨k '' Icc a b, k a, k b, fun h => hab.ne (hkinj h), + isLineWithEnds_image_Icc_of_injOn hk.1 hab hkinj.injOn, ?_, ha.1, hb.1, ?_, ?_⟩ + · rintro _ ⟨t, -, rfl⟩ + exact hkr ▸ mem_range_self t + · intro x hx + obtain ⟨t, rfl⟩ : x ∈ range k := hkr ▸ hWL hx + have hpre : IsPreconnected (k ⁻¹' W) := by + have hemb : IsEmbedding k := hk.1.isClosedEmbedding hk.2 |>.isEmbedding + refine hemb.isInducing.isPreconnected_image.mp ?_ + rw [image_preimage_eq_of_subset (hkr ▸ hWL)] + exact hW + have hord := hpre.ordConnected + have hnot : ∀ c ∈ k ⁻¹' Y, c ∉ k ⁻¹' W := fun c hc hcw => (hWA hcw).2 hc + refine ⟨t, ⟨?_, ?_⟩, rfl⟩ + · by_contra hlt + have hta : t < a := not_le.mp hlt + exact hnot a ha.1 (hord.out hx hw₀ ⟨hta.le, hau.le⟩) + · by_contra hlt + have hbt : b < t := not_le.mp hlt + exact hnot b hb.1 (hord.out hw₀ hx ⟨hub.le, hbt.le⟩) + · rintro _ ⟨t, ⟨h₁, h₂⟩, rfl⟩ hx + rcases lt_trichotomy t u₀ with h | h | h + · have hle : t ≤ a := le_csSup (OrderTop.bddAbove _) ⟨hx, h.le⟩ + exact .inl (congrArg k (le_antisymm hle h₁)) + · exact absurd h (hne₀ hx) + · have hle : b ≤ t := csInf_le (OrderBot.bddBelow _) ⟨hx, h.le⟩ + exact .inr (congrArg k (le_antisymm h₂ hle)) + +/-- A connected set in the union of two lines that meet only in their ends, and that misses the +ends, lies in one of the two lines. -/ +theorem subset_one_line {X : Type*} [TopologicalSpace X] [T2Space X] {L₁ L₂ W : Set X} {y₁ y₂ : X} + (hL₁ : IsLineWithEnds L₁ y₁ y₂) (hL₂ : IsLineWithEnds L₂ y₁ y₂) (hi : L₁ ∩ L₂ = {y₁, y₂}) + (hW : IsPreconnected W) (hcov : W ⊆ L₁ ∪ L₂) (h₁ : y₁ ∉ W) (h₂ : y₂ ∉ W) : + W ⊆ L₁ ∨ W ⊆ L₂ := by + by_cases h : W ⊆ L₁ + · exact .inl h + by_cases h' : W ⊆ L₂ + · exact .inr h' + exfalso + obtain ⟨x, hx, hxn⟩ := not_subset.mp h + obtain ⟨y, hy, hyn⟩ := not_subset.mp h' + obtain ⟨z, hz, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp hW L₁ L₂ hL₁.isCompact.isClosed + hL₂.isCompact.isClosed hcov ⟨y, hy, (hcov hy).resolve_right hyn⟩ + ⟨x, hx, (hcov hx).resolve_left hxn⟩ + have hzp : z ∈ ({y₁, y₂} : Set X) := hi ▸ ⟨hz₁, hz₂⟩ + rcases hzp with rfl | h + · exact h₁ hz + · rw [mem_singleton_iff.mp h] at hz + exact h₂ hz + +/-- A connected part `W` of a circle `A` off a closed set `Y` with two points on `A` lies in an arc +of `A` that has its ends in `Y` and no other point in `Y`. -/ +theorem exists_gap_of_circle {X : Type*} [TopologicalSpace X] [T2Space X] {A Y W : Set X} + (hA : IsOArc A) (hY : IsClosed Y) {y₁ y₂ : X} (hy₁ : y₁ ∈ A ∩ Y) (hy₂ : y₂ ∈ A ∩ Y) + (hne : y₁ ≠ y₂) (hW : IsPreconnected W) (hWne : W.Nonempty) (hWA : W ⊆ A \ Y) : + ∃ (B : Set X) (a b : X), a ≠ b ∧ IsLineWithEnds B a b ∧ B ⊆ A ∧ a ∈ Y ∧ b ∈ Y ∧ W ⊆ B ∧ + ∀ x ∈ B, x ∈ Y → x = a ∨ x = b := by + obtain ⟨L₁, L₂, hL₁, hL₂, hu, hi⟩ := IsOArc.lines hA hy₁.1 hy₂.1 hne + have hoff : ∀ {y}, y ∈ Y → y ∉ W := fun hy hw => (hWA hw).2 hy + have hsub : ∃ L, IsLineWithEnds L y₁ y₂ ∧ L ⊆ A ∧ W ⊆ L := by + rcases subset_one_line hL₁ hL₂ hi hW (hu ▸ fun x hx => (hWA hx).1) (hoff hy₁.2) (hoff hy₂.2) + with h | h + · exact ⟨L₁, hL₁, hu ▸ subset_union_left, h⟩ + · exact ⟨L₂, hL₂, hu ▸ subset_union_right, h⟩ + obtain ⟨L, hL, hLA, hWL⟩ := hsub + obtain ⟨B, a, b, hab, hB, hBL, ha, hb, hWB, hBY⟩ := exists_gap_of_line hL hY hy₁.2 hy₂.2 hW hWne + fun x hx => ⟨hWL hx, (hWA hx).2⟩ + exact ⟨B, a, b, hab, hB, hBL.trans hLA, ha, hb, hWB, hBY⟩ + +/-- Step 7 of VII (4.6), page 228: the short circle through `φ(F)` can be chosen to bound a closed +disc of `Σ`. By (ii) the circle `A` from (2.6) bounds a disc in `Σ` or a disc `R` in `Σ + CHat`. If +`R` +misses the inside of the cap, `R` lies in `Σ`. If not, `R` contains the cap, and we take the arc of +`A` through `φ(F)` between two points of `C`, with the arc of `C` given by +`exists_disc_beside_cap`. -/ +theorem Net.exists_short_disc [T1Space S] (hS : IsSurface S) (N : Net S) + {a b c k : ℕ} (hc : 2 ≤ c) (hmodel : Nonempty (S ≃ₜ SurfaceModel a b c)) + (hv : vSurface S k = vModel a b c k) + {G J : Drawing S} {G_D : Drawing N.D} (hG : G.IsProper) (hmin : N.IsMinimalFor G) + (hJ : N.IsSeamGraphFor J) (hPull : IsPullbackDrawing N.φ G G_D) + (hbd : (G.V ∩ bd S).ncard ≤ 2 * k) + (hii : ∀ B : Set S, G.IsNormal B → IsOArc B → (G.V ∩ B).ncard ≤ vSurface S k → + IsNullHomotopicOArc B ∨ + ∃ C ∈ cuffs S, IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) + {F : Set N.D} {s t : N.D} (hFn : G_D.IsNormal F) (hF : IsProperIArc F) + (hEnds : IsLineWithEnds F s t) (hFbd : F ∩ bd N.D = {s, t}) + (hsmall : (G_D.V ∩ (F \ {s, t})).ncard + 1 ≤ wMaxModel a b c k + k) : + ∃ Z : Set S, IsClosedDisc Z ∧ G.IsNormal (discBd Z) ∧ + (discBd Z ∩ G.V).ncard ≤ muModel a b c k ∧ + N.φ '' F ⊆ discBd Z ∧ discBd Z ⊆ N.φ '' F ∪ J.U := by + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have : T2Space N.D := N.isSurface_D.2.1 + obtain ⟨A, hAn, hAo, hAc, hFA, hAF⟩ := N.exists_short_circle hS hc hmodel hG hmin hJ hPull hbd + hFn hF hEnds hFbd hsmall + have hμv : muModel a b c k ≤ vSurface S k := hv ▸ (constants_bounds_4_6 hc).2.1 + have hAv : (G.V ∩ A).ncard ≤ vSurface S k := by + rw [inter_comm] + exact hAc.trans hμv + rcases hii A hAn hAo hAv with hnull | ⟨C, hC, hcap, hVCA⟩ + · obtain ⟨Z, hZ, hbZ⟩ := nullHomotopicOArc_bounds_disc hS hAo hnull + exact ⟨Z, hZ, hbZ ▸ hAn, hbZ ▸ hAc, hbZ ▸ hFA, hbZ ▸ hAF⟩ + obtain ⟨T, _, j, E, hcp, hbdT⟩ := exists_cappedCuff hS hC + have : T2Space T := hcp.isSurface.2.1 + have hman : ∀ x : T, IsManifoldPoint x := hcp.isSurface.2.2 + have hn : IsNullHomotopicOArc (j '' A) := hcap.2.2 T j E hcp + have hOjA : IsOArc (j '' A) := isOArc_image hAo hcp.isEmbedding.continuous.continuousOn + hcp.isEmbedding.injective.injOn + obtain ⟨R, hR, hRbd⟩ := nullHomotopicOArc_bounds_disc hcp.isSurface hOjA hn + have hEd : IsClosedDisc E := hcp.isClosedDisc + have hjc : IsClosedEmbedding j := + hcp.isEmbedding.continuous.isClosedEmbedding hcp.isEmbedding.injective + have hne : Nonempty S := by + obtain ⟨x, -⟩ := isOArc_nonempty hAo + exact ⟨x⟩ + have hintoff : ∀ x ∈ discInt E, x ∉ range j := by + intro x hx hxj + have : x ∈ j '' C := hcp.inter_eq ▸ ⟨hxj, hx.1⟩ + exact hx.2 (hcp.discBd_eq ▸ this) + have hdisR : Disjoint (discInt E) (discBd R) := by + rw [disjoint_left, hRbd] + rintro x hx ⟨y, -, rfl⟩ + exact hintoff _ hx (mem_range_self y) + rcases hR.side hman hEd.isPreconnected_discInt hdisR with hin | hout + swap + · have hRj : R ⊆ range j := by + intro x hx + rcases (hcp.union_eq ▸ mem_univ x : x ∈ range j ∪ E) with h | h + · exact h + · by_cases hb : x ∈ discBd E + · have : x ∈ j '' C := hcp.discBd_eq ▸ hb + obtain ⟨y, -, rfl⟩ := this + exact mem_range_self y + · exact (disjoint_right.mp hout hx ⟨h, hb⟩).elim + obtain ⟨hZ, hbZ⟩ := isClosedDisc_preimage hjc hR hRj + have hbA : discBd (j ⁻¹' R) = A := by + rw [hbZ, hRbd, preimage_image_eq _ hcp.isEmbedding.injective] + exact ⟨_, hZ, hbA ▸ hAn, hbA ▸ hAc, hbA ▸ hFA, hbA ▸ hAF⟩ + have hER : E ⊆ R := hEd.subset_closure_discInt.trans + (closure_minimal (hin.trans (discInt_subset _)) hR.isClosed) + have hCO : IsOArc C := (cuff_statement S hS).2.2 C hC + have hCc : IsClosed C := hCO.isCompact.isClosed + have hCbd : C ⊆ bd S := fun x hx => sUnion_cuffs (S := S) ▸ ⟨C, hC, hx⟩ + have hCU : C ⊆ J.U := fun x hx => hJ.2.1 ▸ N.bd_subset_seamU (hCbd hx) + have hAcomp : IsCompact A := hAo.isCompact + have hne2 : s ≠ t := hEnds.ne' + obtain ⟨y₁, hy₁, y₂, hy₂, hy₁₂⟩ := (Set.one_lt_ncard + (G.finite_V.subset inter_subset_left)).mp (by have := hiii C hC; omega : + 1 < (G.V ∩ C).ncard) + have hW : IsPreconnected (N.φ '' (F \ {s, t})) := + hEnds.isPreconnected_diff.image _ N.quotientMap_φ.continuous.continuousOn + have hWne : (N.φ '' (F \ {s, t})).Nonempty := by + obtain ⟨p, hp, hp0, hp1⟩ := exists_mem_line_ne hEnds hne2 + exact ⟨_, p, ⟨hp, by rintro (h | h); exacts [hp0 h, hp1 h]⟩, rfl⟩ + have hWoff : ∀ x ∈ N.φ '' (F \ {s, t}), x ∉ J.U := by + rintro _ ⟨y, hy, rfl⟩ hxU + have hybd : y ∈ bd N.D := by + have : N.φ y ∈ N.seamU := hJ.2.1 ▸ hxU + rwa [← mem_preimage, N.preimage_seamU] at this + exact hy.2 (hFbd ▸ ⟨hy.1, hybd⟩) + have hWA : N.φ '' (F \ {s, t}) ⊆ A \ (A ∩ C) := by + intro x hx + exact ⟨hFA (image_mono sdiff_subset hx), fun h => hWoff x hx (hCU h.2)⟩ + obtain ⟨B, p, q, hpq, hB, hBA, hpY, hqY, hWB, hBY⟩ := exists_gap_of_circle hAo + (hAcomp.isClosed.inter hCc) (y₁ := y₁) (y₂ := y₂) + ⟨hVCA hy₁, hVCA hy₁, hy₁.2⟩ ⟨hVCA hy₂, hVCA hy₂, hy₂.2⟩ hy₁₂ hW hWne hWA + have hFB : N.φ '' F ⊆ B := by + have h1 := image_mono (f := N.φ) hEnds.subset_closure_diff + have h2 := image_closure_subset_closure_image (s := F \ {s, t}) + N.quotientMap_φ.continuous + exact (h1.trans h2).trans (closure_minimal hWB hB.isCompact.isClosed) + have hjB := IsLineWithEnds.map_of_embedding hcp.isEmbedding hB + have hbE : ∀ {x}, x ∈ C → j x ∈ discBd E := fun {x} hx => hcp.discBd_eq ▸ mem_image_of_mem j hx + have hBE : j '' B ∩ E ⊆ {j p, j q} := by + rintro _ ⟨⟨y, hy, rfl⟩, hyE⟩ + have hyC : j y ∈ j '' C := hcp.inter_eq ▸ ⟨mem_range_self y, hyE⟩ + obtain ⟨y', hy', hyy⟩ := hyC + have hyC' : y ∈ C := hcp.isEmbedding.injective hyy ▸ hy' + rcases hBY y hy ⟨hBA hy, hyC'⟩ with h | h + · exact .inl (congrArg j h) + · exact .inr (congrArg j h) + obtain ⟨Z', C', hC', hC'E, hZ', hbZ', hZoff, -⟩ := exists_disc_beside_cap hman + (fun h => hpq (hcp.isEmbedding.injective h)) hR hEd hER hdisR hjB + (hRbd ▸ image_mono hBA) hBE (hbE hpY.2) (hbE hqY.2) + have hZj : Z' ⊆ range j := by + intro x hx + rcases (hcp.union_eq ▸ mem_univ x : x ∈ range j ∪ E) with h | h + · exact h + · by_cases hb : x ∈ discBd E + · have : x ∈ j '' C := hcp.discBd_eq ▸ hb + obtain ⟨y, -, rfl⟩ := this + exact mem_range_self y + · exact (disjoint_left.mp hZoff hx ⟨h, hb⟩).elim + obtain ⟨hZ, hbZ⟩ := isClosedDisc_preimage hjc hZ' hZj + have hbsub : discBd (j ⁻¹' Z') ⊆ C ∪ B := by + rw [hbZ, hbZ'] + rintro x (h | h) + · have hx : j x ∈ j '' C := hcp.discBd_eq ▸ hC'E h + obtain ⟨y, hy, hyx⟩ := hx + exact .inl (hcp.isEmbedding.injective hyx ▸ hy) + · obtain ⟨y, hy, hyx⟩ := h + exact .inr (hcp.isEmbedding.injective hyx ▸ hy) + have hBsub : B ⊆ discBd (j ⁻¹' Z') := by + rw [hbZ, hbZ'] + exact fun x hx => .inr (mem_image_of_mem j hx) + refine ⟨_, hZ, ?_, ?_, hFB.trans hBsub, ?_⟩ + · rintro x ⟨hx, hxU⟩ + rcases hbsub hx with h | h + · exact hG ⟨hCbd h, hxU⟩ + · exact hAn ⟨hBA h, hxU⟩ + · refine le_trans (Set.ncard_le_ncard ?_ ((hAcomp.isClosed.inter hCc |> fun _ + => G.finite_V.subset inter_subset_right))) hAc + · rintro x ⟨hx, hxV⟩ + rcases hbsub hx with h | h + · exact ⟨hVCA ⟨hxV, h⟩, hxV⟩ + · exact ⟨hBA h, hxV⟩ + · intro x hx + rcases hbsub hx with h | h + · exact .inr (hCU h) + · exact hAF (hBA h) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46DeficientPath.lean b/LeanPool/GraphMinor/GM07/Section46DeficientPath.lean new file mode 100644 index 0000000000..d8dff82f56 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46DeficientPath.lean @@ -0,0 +1,146 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.Forest + +/-! +# The maximal path of VII (4.6), pages 228-229 + +This is the graph part of the argument. Take a forest with a set `B` of vertices, such that each +vertex outside `B` that has an edge has a second edge. A longest path must then have both +of its ends in `B`. A shortest path with distinct ends in `B` has no other vertex in `B`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.Surface.GraphWalk + +universe u v + +variable {α : Type u} {β : Type v} {G : Graph α β} + +/-- A simple walk has at most as many edges as the graph has vertices. -/ +theorem IsSimple.length_le {x y : α} {W : GraphWalk G x y} (hW : W.IsSimple) + (hV : G.vertexSet.Finite) : W.length ≤ G.vertexSet.ncard := by + classical + have hlen := GM11.length_support W + have hcard : W.support.toFinset.card = W.support.length := List.toFinset_card_of_nodup hW + have hsub : (↑W.support.toFinset : Set α) ⊆ G.vertexSet := by + intro z hz + exact W.mem_vertexSet_of_mem_support (List.mem_toFinset.mp hz) + have := Set.ncard_le_ncard hsub hV + rw [Set.ncard_coe_finset] at this + unfold GraphWalk.length at hlen ⊢ + omega + +/-- An end of a longest path has one edge, or else the path can be made longer or closed up. -/ +private theorem longest_start_mem {B : Set α} (hforest : Surface.IsGraphForest G) + (hdeg : ∀ u ∈ G.vertexSet, u ∉ B → ∀ e x, G.IsLink e u x → ∃ e' x', e' ≠ e ∧ G.IsLink e' u x') + {x y : α} {W : GraphWalk G x y} (hW : W.IsSimple) (hpos : 0 < W.length) + (hmax : ∀ (a b : α) (X : GraphWalk G a b), X.IsSimple → X.length ≤ W.length) : x ∈ B := by + by_contra hx + cases W with + | nil h => simp at hpos + | @cons _ m _ e hl r => + obtain ⟨e', x', hne, hl'⟩ := hdeg x hl.left_mem hx e m hl + by_cases hmem : x' ∈ (GraphWalk.cons hl r).support + · obtain ⟨W₁, W₂, heq⟩ := (GraphWalk.cons hl r).exists_append_of_mem hmem + have hs₁ : W₁.IsSimple := by + have h := hW + unfold GraphWalk.IsSimple at h ⊢ + rw [heq, support_append] at h + exact (List.nodup_append.mp h).1 + have hne' : e' ∉ W₁.edges := by + intro hin + have he : e' ∈ (GraphWalk.cons hl r).edges := by + rw [heq, edges_append] + exact List.mem_append_left _ hin + rcases List.mem_cons.mp he with h | h + · exact hne h + · exact (List.nodup_cons.mp hW).1 (r.left_mem_support_of_mem_edges h hl') + have hclosed : (GraphWalk.cons hl'.symm W₁).IsSimpleClosed := + ⟨by simpa using (show W₁.support.Nodup from hs₁), by simpa using ⟨hne', hs₁.edges_nodup⟩⟩ + have := hforest _ _ hclosed + simp at this + · have hs : (GraphWalk.cons hl'.symm (GraphWalk.cons hl r)).IsSimple := + List.nodup_cons.mpr ⟨hmem, hW⟩ + have := hmax _ _ _ hs + simp at this + +/-- A shortest walk between distinct points of `B` has no other point in `B`. -/ +private theorem exists_shortest_between {B : Set α} {x y : α} (W : GraphWalk G x y) + (hW : W.IsSimple) (hx : x ∈ B) (hy : y ∈ B) (hxy : x ≠ y) : + ∃ (a b : α) (X : GraphWalk G a b), a ∈ B ∧ b ∈ B ∧ a ≠ b ∧ X.IsSimple ∧ + ∀ z ∈ X.support, z ∈ B → z = a ∨ z = b := by + classical + have hex : ∃ n, ∃ (a b : α) (X : GraphWalk G a b), a ∈ B ∧ b ∈ B ∧ a ≠ b ∧ X.IsSimple ∧ + X.length = n := ⟨_, x, y, W, hx, hy, hxy, hW, rfl⟩ + obtain ⟨a, b, X, ha, hb, hab, hX, hn⟩ := Nat.find_spec hex + refine ⟨a, b, X, ha, hb, hab, hX, fun z hz hzB => ?_⟩ + by_contra hne + push Not at hne + obtain ⟨X₁, X₂, heq⟩ := X.exists_append_of_mem hz + have hs₁ : X₁.IsSimple := by + have h := hX + unfold GraphWalk.IsSimple at h ⊢ + rw [heq, support_append] at h + exact (List.nodup_append.mp h).1 + have hlen : X₁.length < X.length := by + rw [heq, length_append] + have : 0 < X₂.length := Nat.pos_of_ne_zero fun h => + hne.2 (eq_of_length_eq_zero h) + omega + exact Nat.find_min hex (hn ▸ hlen) ⟨a, z, X₁, ha, hzB, hne.1.symm, hs₁, rfl⟩ + +/-- The maximal path argument of VII (4.6), pages 228-229. A forest with an edge, in which each +vertex outside `B` that has an edge has a second edge, contains a path between two points of `B` +with no other vertex in `B`. -/ +theorem exists_path_between_of_forest {B : Set α} (hV : G.vertexSet.Finite) + (hforest : Surface.IsGraphForest G) + (hdeg : ∀ u ∈ G.vertexSet, u ∉ B → ∀ e x, G.IsLink e u x → ∃ e' x', e' ≠ e ∧ G.IsLink e' u x') + {e : β} {p q : α} (hl : G.IsLink e p q) : + ∃ (a b : α) (X : GraphWalk G a b), a ∈ B ∧ b ∈ B ∧ a ≠ b ∧ X.IsSimple ∧ + ∀ z ∈ X.support, z ∈ B → z = a ∨ z = b := by + classical + have hpq : p ≠ q := by + rintro rfl + have hclosed : (GraphWalk.cons hl (GraphWalk.nil hl.left_mem)).IsSimpleClosed := + ⟨by simp, by simp⟩ + have := hforest _ _ hclosed + simp at this + let P : ℕ → Prop := fun n => ∃ (a b : α) (X : GraphWalk G a b), X.IsSimple ∧ X.length = n + have hP : P 1 := ⟨p, q, GraphWalk.cons hl (GraphWalk.nil hl.right_mem), + List.nodup_cons.mpr ⟨by simpa using hpq, by simp⟩, by simp⟩ + have hbound : ∀ n, P n → n ≤ G.vertexSet.ncard := by + rintro n ⟨a, b, X, hX, rfl⟩ + exact IsSimple.length_le hX hV + have hne : 1 ≤ G.vertexSet.ncard := hbound 1 hP + have hgr := Nat.findGreatest_spec hne hP + obtain ⟨x, y, W, hW, hn⟩ := hgr + have hge : 1 ≤ W.length := by + rw [hn] + exact Nat.le_findGreatest hne hP + have hmax : ∀ (a b : α) (X : GraphWalk G a b), X.IsSimple → X.length ≤ W.length := by + intro a b X hX + rw [hn] + exact Nat.le_findGreatest (hbound _ ⟨a, b, X, hX, rfl⟩) ⟨a, b, X, hX, rfl⟩ + have hx : x ∈ B := longest_start_mem hforest hdeg hW hge hmax + have hy : y ∈ B := longest_start_mem hforest hdeg (W := W.reverse) hW.reverse + (by rwa [length_reverse]) (by rw [length_reverse]; exact hmax) + have hxy : x ≠ y := by + rintro rfl + have := hW.length_eq_zero + omega + exact exists_shortest_between W hW hx hy hxy + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46DeficientSeam.lean b/LeanPool/GraphMinor/GM07/Section46DeficientSeam.lean new file mode 100644 index 0000000000..a778f08559 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46DeficientSeam.lean @@ -0,0 +1,445 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46DeficientDisc +public import LeanPool.GraphMinor.GM07.Section46DeficientPath +public import LeanPool.GraphMinor.GM07.Section2 +import LeanPool.GraphMinor.GM07.Section46CentralLift +import LeanPool.GraphMinor.GM07.Section46JPlus +import LeanPool.GraphMinor.GM07.Section46NullCircle +import LeanPool.GraphMinor.GM07.PullForest +import LeanPool.GraphMinor.GM11.OArcCircuit +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM11.Section3 +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.Separate +import LeanPool.GraphMinor.Surface.ChartCells +import LeanPool.GraphMinor.Surface.CutLift +import LeanPool.GraphMinor.Surface.DiscFan +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.EdgeLoop + +/-! +# Step 8 of VII (4.6): the disc misses the seam + +Pages 228-229. Let `Z` be a closed disc in `Σ` whose boundary `A` passes through `φ(F)` and lies in +`φ(F) ∪ U(J)`. The seam has only one region, so `Z` contains no circle of `U(J)`. The part of `A` +in `U(J)` is the arc `U(Q)` (or the single point `φ(s) = φ(t)`), and each edge of +`J' = (U(J), V(J) ∪ {φ(s), φ(t)})` either lies in `U(Q)` or misses `A`. By (2.3), each vertex +of `J'` inside `Z` has two edges there. The maximal path argument then gives a path in `Z` between +two +points of `U(Q)`, and this path closes up to a circle in `U(J)`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A line is connected. -/ +theorem line_preconnected {L : Set S} {u v : S} (hL : IsLineWithEnds L u v) : IsPreconnected L := + GraphMinor.Surface.IsLineWithEnds.isPreconnected hL + +/-- No circle of the seam lies in a closed disc of `Σ`, because `Σ - U(J)` is connected and dense. +This is the use of "`J'` has only one region" on page 228. -/ +theorem Net.not_circle_in_disc (hS : IsSurface S) (N : Net S) (hcuffs : 2 ≤ (cuffs S).ncard) + {Z O : Set S} (hZ : IsClosedDisc Z) (hO : IsOArc O) (hOZ : O ⊆ Z) (hOU : O ⊆ N.seamU) : + False := by + refine N.not_nullHomotopic_circle_in_seam hS hcuffs hO hOU ?_ + obtain ⟨e⟩ := id hO + refine ⟨e, ?_⟩ + obtain ⟨c, hc, hom⟩ := hZ.isSimplyConnectedSet.2 + ⟨fun x => (e x).1, continuous_subtype_val.comp e.continuous⟩ + (by rintro _ ⟨x, rfl⟩; exact hOZ (e x).2) + exact ⟨c, mem_univ c, hom.mono (subset_univ _)⟩ + +/-- A path-connected set of `U - V` that meets an edge lies in that edge. -/ +theorem subset_edge_of_meets {Γ : Drawing S} {e D : Set S} (he : e ∈ Γ.E) (hD : IsPathConnected D) + (hsub : D ⊆ Γ.U \ Γ.V) (hmeet : (D ∩ e).Nonempty) : D ⊆ e := by + obtain ⟨x, hxD, hxe⟩ := hmeet + have := he.2.2.2 (e ∪ D) (union_subset he.2.1 hsub) (he.2.2.1.union hD ⟨x, hxe, hxD⟩) + subset_union_left + exact fun y hy => this ▸ Or.inr hy + +/-- A line of `U(Γ)` with its ends at vertices, and with no other vertices, that passes through an +edge is the closure of that edge. -/ +theorem closure_edge_eq_of_gap [T2Space S] {Γ : Drawing S} {B e : Set S} {a b x : S} (he : e ∈ Γ.E) + (hB : IsLineWithEnds B a b) (hab : a ≠ b) (ha : a ∈ Γ.V) (hb : b ∈ Γ.V) (hBU : B ⊆ Γ.U) + (hBV : ∀ y ∈ B, y ∈ Γ.V → y = a ∨ y = b) (hxB : x ∈ B) (hxe : x ∈ e) (hxV : x ∉ Γ.V) : + B = closure e := by + have hin : B \ {a, b} ⊆ Γ.U \ Γ.V := fun y hy => + ⟨hBU hy.1, fun hv => hy.2 (hBV y hy.1 hv)⟩ + have hxin : x ∈ B \ {a, b} := ⟨hxB, by + rintro (rfl | rfl) + · exact hxV ha + · exact hxV hb⟩ + have hsub : B \ {a, b} ⊆ e := + subset_edge_of_meets he (isPathConnected_sdiff_pair hB) hin ⟨x, hxin, hxe⟩ + have hBc : B ⊆ closure e := hB.subset_closure_diff.trans (closure_mono hsub) + have haC : a ∈ closure e ∩ Γ.V := ⟨hBc hB.left_mem, ha⟩ + have hbC : b ∈ closure e ∩ Γ.V := ⟨hBc hB.right_mem, hb⟩ + rcases Γ.edge_cond e he with ⟨u, v, -, hcap, hl⟩ | ⟨u, hcap, -⟩ + · rw [hcap] at haC hbC + have hbC' : b = u ∨ b = v := hbC + have haC' : a = u ∨ a = v := haC + have hu : u ∈ B := by + rcases haC' with h | h + · exact h ▸ hB.left_mem + · rcases hbC' with h' | h' + · exact h' ▸ hB.right_mem + · exact (hab (h.trans h'.symm)).elim + have hv : v ∈ B := by + rcases haC' with h | h + · rcases hbC' with h' | h' + · exact (hab (h.trans h'.symm)).elim + · exact h' ▸ hB.right_mem + · exact h ▸ hB.left_mem + exact hl.eq_of_subset (line_preconnected hB) hBc hu hv + · rw [hcap] at haC hbC + exact (hab ((mem_singleton_iff.mp haC).trans (mem_singleton_iff.mp hbC).symm)).elim + +/-- The inner points of a test arc map off the seam. -/ +theorem Net.image_inner_notMem_seam {N : Net S} {J : Drawing S} (hJ : N.IsSeamGraphFor J) + {F : Set N.D} {s t : N.D} (hFbd : F ∩ bd N.D = {s, t}) {x : S} + (hx : x ∈ N.φ '' (F \ {s, t})) : x ∉ J.U := by + obtain ⟨y, hy, rfl⟩ := hx + intro hxU + have hybd : y ∈ bd N.D := by + have : N.φ y ∈ N.seamU := hJ.2.1 ▸ hxU + rwa [← mem_preimage, N.preimage_seamU] at this + exact hy.2 (hFbd ▸ ⟨hy.1, hybd⟩) + +/-- The part of `A` in `U(J)`, page 228. We write `X` for this set: it is the arc `U(Q)`, or the +single point `φ(s)` if `φ(s) = φ(t)`. Each edge of `J'` that meets `A` lies in `X`. -/ +theorem Net.exists_seam_arc [T2Space S] (N : Net S) {G J J' : Drawing S} {G_D : Drawing N.D} + (hJ : N.IsSeamGraphFor J) (hPull : IsPullbackDrawing N.φ G G_D) + {F : Set N.D} {s t : N.D} {A : Set S} (hFn : G_D.IsNormal F) + (hEnds : IsLineWithEnds F s t) (hFbd : F ∩ bd N.D = {s, t}) (hAo : IsOArc A) + (hFA : N.φ '' F ⊆ A) (hAF : A ⊆ N.φ '' F ∪ J.U) (hU : J'.U = J.U) + (hs : N.φ s ∈ J'.V) (ht : N.φ t ∈ J'.V) : + ∃ X : Set S, IsPreconnected X ∧ X ⊆ J.U ∧ X ⊆ A ∧ A ⊆ N.φ '' (F \ {s, t}) ∪ X ∧ + N.φ s ∈ X ∧ N.φ t ∈ X ∧ (∀ e ∈ J'.E, (e ∩ A).Nonempty → e ⊆ X) ∧ + ∀ a ∈ X, ∀ b ∈ X, a ≠ b → ∃ L, IsLineWithEnds L a b ∧ L ⊆ X := by + have : T2Space N.D := N.isSurface_D.2.1 + have hsU : N.φ s ∈ J.U := hU ▸ J'.V_subset_U hs + have htU : N.φ t ∈ J.U := hU ▸ J'.V_subset_U ht + have hoff : ∀ {x}, x ∈ N.φ '' (F \ {s, t}) → x ∉ J.U := fun hx => N.image_inner_notMem_seam hJ + hFbd hx + have hsplit : ∀ {x}, x ∈ N.φ '' F → x = N.φ s ∨ x = N.φ t ∨ x ∈ N.φ '' (F \ {s, t}) := by + rintro _ ⟨y, hy, rfl⟩ + by_cases h₁ : y = s + · exact .inl (congrArg _ h₁) + by_cases h₂ : y = t + · exact .inr (.inl (congrArg _ h₂)) + exact .inr (.inr ⟨y, ⟨hy, by rintro (h | h); exacts [h₁ h, h₂ h]⟩, rfl⟩) + have hedge : ∀ e ∈ J'.E, e ⊆ J.U \ J'.V := fun e he => hU ▸ he.2.1 + by_cases heq : N.φ s = N.φ t + · have hO := (lemma_2_6_of_equal_endpoint_images N hPull hEnds hFbd hFn heq).2.1 + have hA : N.φ '' F = A := eq_of_oArc_subset hO hAo hFA + refine ⟨{N.φ s}, isPreconnected_singleton, singleton_subset_iff.mpr hsU, ?_, ?_, rfl, + heq.symm, ?_, ?_⟩ + · exact singleton_subset_iff.mpr (hFA (mem_image_of_mem _ hEnds.left_mem)) + · intro x hx + rcases hsplit (hA.symm ▸ hx) with h | h | h + · exact .inr h + · exact .inr (h.trans heq.symm) + · exact .inl h + · rintro e he ⟨x, hxe, hxA⟩ + rcases hsplit (hA.symm ▸ hxA) with h | h | h + · exact ((hedge e he hxe).2 (h ▸ hs)).elim + · exact ((hedge e he hxe).2 (h ▸ ht)).elim + · exact (hoff h (hedge e he hxe).1).elim + · rintro a rfl b rfl hab + exact (hab rfl).elim + have hL := lemma_2_6_image_line N hEnds hFbd heq + have hsA : N.φ s ∈ A := hFA (mem_image_of_mem _ hEnds.left_mem) + have htA : N.φ t ∈ A := hFA (mem_image_of_mem _ hEnds.right_mem) + obtain ⟨L₁, L₂, hL₁, hL₂, hu, hi⟩ := IsOArc.lines hAo hsA htA heq + have key : ∀ {L₁ L₂ : Set S}, IsLineWithEnds L₁ (N.φ s) (N.φ t) → + IsLineWithEnds L₂ (N.φ s) (N.φ t) → L₁ ∪ L₂ = A → L₁ ∩ L₂ = {N.φ s, N.φ t} → + N.φ '' (F \ {s, t}) ⊆ L₂ → ∃ X : Set S, IsPreconnected X ∧ X ⊆ J.U ∧ X ⊆ A ∧ + A ⊆ N.φ '' (F \ {s, t}) ∪ X ∧ N.φ s ∈ X ∧ N.φ t ∈ X ∧ + (∀ e ∈ J'.E, (e ∩ A).Nonempty → e ⊆ X) ∧ + ∀ a ∈ X, ∀ b ∈ X, a ≠ b → ∃ L, IsLineWithEnds L a b ∧ L ⊆ X := by + intro L₁ L₂ hL₁ hL₂ hu hi hWL + have hFL : N.φ '' F = L₂ := by + refine hL₂.eq_of_subset (line_preconnected hL) ?_ (mem_image_of_mem _ hEnds.left_mem) + (mem_image_of_mem _ hEnds.right_mem) + intro x hx + rcases hsplit hx with h | h | h + · exact h ▸ hL₂.left_mem + · exact h ▸ hL₂.right_mem + · exact hWL h + have hXU : L₁ ⊆ J.U := by + intro x hx + rcases hAF (by rw [← hu]; exact .inl hx) with h | h + · have : x ∈ L₁ ∩ L₂ := ⟨hx, hFL ▸ h⟩ + rw [hi] at this + rcases this with h | h + · exact h ▸ hsU + · exact (mem_singleton_iff.mp h) ▸ htU + · exact h + have hAW : A ⊆ N.φ '' (F \ {s, t}) ∪ L₁ := by + intro x hx + rcases (hu ▸ hx : x ∈ L₁ ∪ L₂) with h | h + · exact .inr h + · rcases hsplit (hFL ▸ h) with h | h | h + · exact .inr (h ▸ hL₁.left_mem) + · exact .inr (h ▸ hL₁.right_mem) + · exact .inl h + refine ⟨L₁, line_preconnected hL₁, hXU, hu ▸ subset_union_left, hAW, hL₁.left_mem, + hL₁.right_mem, ?_, ?_⟩ + · rintro e he ⟨x, hxe, hxA⟩ + have hxU := hedge e he hxe + have hxL : x ∈ L₁ := (hAW hxA).resolve_left fun h => hoff h hxU.1 + obtain ⟨B, a, b, hab, hB, hBL, ha, hb, hxB, hBV⟩ := exists_gap_of_line hL₁ + J'.finite_V.isClosed hs ht isPreconnected_singleton (singleton_nonempty x) + (singleton_subset_iff.mpr ⟨hxL, hxU.2⟩) + have heq' := closure_edge_eq_of_gap he hB hab ha hb (fun y hy => hU ▸ hXU (hBL hy)) hBV + (hxB rfl) hxe hxU.2 + exact fun y hy => hBL (heq' ▸ subset_closure hy) + · intro a ha b hb hab + obtain ⟨k, hk, hkr, hk0, hk1⟩ := hL₁.exists_arc + obtain ⟨u, rfl⟩ : a ∈ range k := hkr ▸ ha + obtain ⟨v, rfl⟩ : b ∈ range k := hkr ▸ hb + have huv : u ≠ v := fun h => hab (congrArg k h) + have hinj := hk.2.injOn (s := univ) + rcases lt_or_gt_of_ne huv with h | h + · exact ⟨k '' Icc u v, isLineWithEnds_image_Icc_of_injOn hk.1 h hk.2.injOn, + by rintro _ ⟨r, -, rfl⟩; exact hkr ▸ mem_range_self r⟩ + · exact ⟨k '' Icc v u, GM07.IsLineWithEnds.symm + (isLineWithEnds_image_Icc_of_injOn hk.1 h hk.2.injOn), + by rintro _ ⟨r, -, rfl⟩; exact hkr ▸ mem_range_self r⟩ + have hW : IsPreconnected (N.φ '' (F \ {s, t})) := + hEnds.isPreconnected_diff.image _ N.quotientMap_φ.continuous.continuousOn + rcases subset_one_line hL₁ hL₂ hi hW + (fun x hx => hu.symm ▸ hFA (image_mono sdiff_subset hx)) (fun h => hoff h hsU) + (fun h => hoff h htU) with h | h + · exact key hL₂ hL₁ (by rwa [union_comm]) (by rwa [inter_comm]) h + · exact key hL₁ hL₂ hu hi h + +/-- A vertex of `J` of valency at least three has two different edges of `J'`. Each of the two +edges of `J` that end there contains an edge of `J'` that ends there, since `J'` adds only finitely +many vertices. -/ +theorem exists_two_edges_at [T2Space S] {J J' : Drawing S} (hU : J'.U = J.U) (hV : J.V ⊆ J'.V) + {u : S} (hu : u ∈ J.V) (h3 : 3 ≤ vertexValency J u) : + ∃ e₁ ∈ J'.E, ∃ e₂ ∈ J'.E, e₁ ≠ e₂ ∧ u ∈ closure e₁ ∧ u ∈ closure e₂ := by + have htwo : ∃ g₁ ∈ J.E, ∃ g₂ ∈ J.E, g₁ ≠ g₂ ∧ u ∈ closure g₁ ∧ u ∈ closure g₂ := by + by_contra hno + push Not at hno + have hsub : ∀ a ∈ J.E, J.VertexIncident u a → ∀ b ∈ J.E, J.VertexIncident u b → a = b := by + intro a ha hia b hb hib + by_contra hne + exact hno a ha b hb hne hia.2.2 hib.2.2 + unfold vertexValency at h3 + set P₂ := {e ∈ J.E | J.VertexIncident u e ∧ (tilde e).ncard = 2} + set P₁ := {e ∈ J.E | J.VertexIncident u e ∧ (tilde e).ncard = 1} + have hs₂ : P₂.Subsingleton := fun a ha b hb => hsub a ha.1 ha.2.1 b hb.1 hb.2.1 + have hs₁ : P₁.Subsingleton := fun a ha b hb => hsub a ha.1 ha.2.1 b hb.1 hb.2.1 + have h₂ : P₂.ncard ≤ 1 := by + have := hs₂.finite.to_subtype + exact ncard_le_one_iff_subsingleton.mpr hs₂ + have h₁ : P₁.ncard ≤ 1 := by + have := hs₁.finite.to_subtype + exact ncard_le_one_iff_subsingleton.mpr hs₁ + rcases P₁.eq_empty_or_nonempty with hP | ⟨a, ha⟩ + · rw [hP, ncard_empty] at h3 + omega + · have hP₂ : P₂ = ∅ := eq_empty_of_forall_notMem fun b hb => by + have := hsub a ha.1 ha.2.1 b hb.1 hb.2.1 + have h1 := ha.2.2 + have h2 := hb.2.2 + rw [this, h2] at h1 + omega + rw [hP₂, ncard_empty] at h3 + omega + have hin : ∀ g ∈ J.E, u ∈ closure g → ∃ e ∈ J'.E, e ⊆ g ∧ u ∈ closure e := by + intro g hg hug + have hgoff : ∀ x ∈ g, x ∈ J.U \ J.V := fun x hx => hg.2.1 hx + have hsep : ∀ e ∈ J'.E, e ⊆ J.U \ J.V := fun e he x hx => by + have := he.2.1 hx + exact ⟨hU ▸ this.1, fun h => this.2 (hV h)⟩ + let E' : Set (Set S) := {e ∈ J'.E | e ⊆ g} + have hE' : E'.Finite := J'.finite_edges.subset fun e he => he.1 + have hcov : g \ J'.V ⊆ ⋃ e ∈ E', e := by + rintro x ⟨hx, hxV⟩ + obtain ⟨e, he, hxe⟩ := exists_edge_of_mem (G := J') (hU ▸ (hgoff x hx).1) hxV + refine mem_iUnion₂.mpr ⟨e, ⟨he, ?_⟩, hxe⟩ + exact subset_edge_of_meets hg he.2.2.1 (hsep e he) ⟨x, hxe, hx⟩ + have hclosed : IsClosed (J'.V ∩ g) := (J'.finite_V.subset inter_subset_left).isClosed + have hsplit : g ⊆ (g \ J'.V) ∪ (J'.V ∩ g) := fun x hx => by + by_cases h : x ∈ J'.V + · exact .inr ⟨h, hx⟩ + · exact .inl ⟨hx, h⟩ + have hc := closure_mono hsplit hug + rw [closure_union, hclosed.closure_eq] at hc + rcases hc with h | h + · have h' := closure_mono hcov h + rw [hE'.closure_biUnion] at h' + obtain ⟨e, he, hue⟩ := mem_iUnion₂.mp h' + exact ⟨e, he.1, he.2, hue⟩ + · exact ((hgoff u h.2).2 hu).elim + obtain ⟨g₁, hg₁, g₂, hg₂, hne, h₁, h₂⟩ := htwo + obtain ⟨e₁, he₁, hs₁, hu₁⟩ := hin g₁ hg₁ h₁ + obtain ⟨e₂, he₂, hs₂, hu₂⟩ := hin g₂ hg₂ h₂ + refine ⟨e₁, he₁, e₂, he₂, ?_, hu₁, hu₂⟩ + rintro rfl + obtain ⟨x, hx⟩ := he₁.1 + exact hne (J.edge_eq_of_mem hg₁ hg₂ (hs₁ hx) (hs₂ hx)) + +/-- Step 8 of VII (4.6), pages 228-229: the open disc `S` misses `U(J)`. -/ +theorem Net.disc_misses_seam (hS : IsSurface S) (N : Net S) (hcuffs : 2 ≤ (cuffs S).ncard) + {G J : Drawing S} {G_D : Drawing N.D} (hJ : N.IsSeamGraphFor J) + (hval : ∀ v ∈ J.V, 3 ≤ vertexValency J v) (hPull : IsPullbackDrawing N.φ G G_D) + {F : Set N.D} {s t : N.D} (hFn : G_D.IsNormal F) (hEnds : IsLineWithEnds F s t) + (hFbd : F ∩ bd N.D = {s, t}) {Z : Set S} (hZ : IsClosedDisc Z) (hFZ : N.φ '' F ⊆ discBd Z) + (hZF : discBd Z ⊆ N.φ '' F ∪ J.U) : Disjoint (discInt Z) J.U := by + have : T2Space S := hS.2.1 + have hman := hS.2.2 + have hbdZ : discBd Z ⊆ Z := Surface.discBd_subset Z + have hsbd : s ∈ F ∩ bd N.D := hFbd.symm ▸ Or.inl rfl + have htbd : t ∈ F ∩ bd N.D := hFbd.symm ▸ Or.inr rfl + have hsU : N.φ s ∈ J.U := hJ.2.1 ▸ mem_image_of_mem N.φ hsbd.2 + have htU : N.φ t ∈ J.U := hJ.2.1 ▸ mem_image_of_mem N.φ htbd.2 + have hsA : N.φ s ∈ discBd Z := hFZ (mem_image_of_mem _ hsbd.1) + have htA : N.φ t ∈ discBd Z := hFZ (mem_image_of_mem _ htbd.1) + have hfin : (J.V ∪ {N.φ s, N.φ t}).Finite := J.finite_V.union (by simp) + have hsub : J.V ∪ {N.φ s, N.φ t} ⊆ J.U := by + refine union_subset J.V_subset_U ?_ + rintro x (rfl | h) + · exact hsU + · exact (mem_singleton_iff.mp h) ▸ htU + obtain ⟨J', hU, hV⟩ := exists_drawing_with_more_vertices J hfin subset_union_left hsub + have hsV : N.φ s ∈ J'.V := hV ▸ Or.inr (Or.inl rfl) + have htV : N.φ t ∈ J'.V := hV ▸ Or.inr (Or.inr rfl) + obtain ⟨X, -, hXU, hXA, hAX, -, -, hXe, hXl⟩ := N.exists_seam_arc hJ hPull hFn hEnds hFbd + hZ.isOArc_discBd hFZ hZF hU hsV htV + rw [disjoint_iff_inter_eq_empty] + by_contra hne + obtain ⟨x₀, hx₀S, hx₀U⟩ := nonempty_iff_ne_empty.mpr hne + have hSo : IsOpen (discInt Z) := hZ.isOpen_discInt hman + have hE1 : ∀ e ∈ J'.E, (e ∩ discInt Z).Nonempty → e ⊆ discInt Z := by + rintro e he ⟨y, hye, hyS⟩ + have hdis : Disjoint e (discBd Z) := by + rw [disjoint_iff_inter_eq_empty] + by_contra hn + exact hyS.2 (hXA (hXe e he (nonempty_iff_ne_empty.mpr hn) hye)) + rcases hZ.side hman he.2.2.1.isConnected.isPreconnected hdis with h | h + · exact h + · exact (disjoint_left.mp h hye hyS.1).elim + have hmeet : ∀ e, ∀ u ∈ discInt Z, u ∈ closure e → (e ∩ discInt Z).Nonempty := by + intro e u huS hu + obtain ⟨y, hyS, hye⟩ := mem_closure_iff.mp hu _ hSo huS + exact ⟨y, hye, hyS⟩ + have hV'S : ∀ u ∈ J'.V, u ∈ discInt Z → u ∈ J.V := by + intro u hu huS + rcases (hV ▸ hu : u ∈ J.V ∪ {N.φ s, N.φ t}) with h | h | h + · exact h + · exact (huS.2 (h ▸ hsA)).elim + · exact (huS.2 ((mem_singleton_iff.mp h) ▸ htA)).elim + have htwo : ∀ u ∈ J'.V, u ∈ discInt Z → ∃ e₁ ∈ J'.E, ∃ e₂ ∈ J'.E, e₁ ≠ e₂ ∧ + e₁ ⊆ discInt Z ∧ e₂ ⊆ discInt Z ∧ u ∈ closure e₁ ∧ u ∈ closure e₂ := by + intro u hu huS + have huJ := hV'S u hu huS + obtain ⟨e₁, he₁, e₂, he₂, hne', h₁, h₂⟩ := exists_two_edges_at hU + (hV ▸ subset_union_left) huJ (hval u huJ) + exact ⟨e₁, he₁, e₂, he₂, hne', hE1 e₁ he₁ (hmeet e₁ u huS h₁), + hE1 e₂ he₂ (hmeet e₂ u huS h₂), h₁, h₂⟩ + let ES : Set (Set S) := {e ∈ J'.E | e ⊆ discInt Z} + have hcl : ∀ e ∈ ES, closure e ⊆ Z := fun e he => + closure_minimal (he.2.trans (discInt_subset Z)) hZ.isClosed + obtain ⟨T, hTs, hTV, hTE⟩ : ∃ T : Drawing S, T.IsSubdrawing J' ∧ T.V = J'.V ∩ Z ∧ T.E = ES := by + refine ⟨J'.span (J'.V ∩ Z) ES, J'.span_isSubdrawing _ _, ?_, ?_⟩ + · rw [J'.span_V] + unfold Drawing.spanV + refine Subset.antisymm (union_subset inter_subset_left (iUnion₂_subset fun e he x hx => + ⟨hx.2, hcl e he.1 hx.1⟩)) fun z hz => .inl ⟨hz, hz.1⟩ + · have hES : ES ⊆ J'.E := fun _ he => he.1 + rw [J'.span_E, inter_eq_left.mpr hES] + have hTZ : T.U ⊆ Z := by + rw [Drawing.U_eq] + rintro x (h | h) + · exact (hTV ▸ h : x ∈ J'.V ∩ Z).2 + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp h + exact hcl e (hTE ▸ he) hxe + have hTJ : T.U ⊆ N.seamU := fun x hx => hJ.2.1 ▸ hU ▸ hTs.U_subset hx + have hforest : Surface.IsGraphForest T.toGraph := by + intro u W hW + by_contra hpos + obtain ⟨W', hs, he⟩ := (walkDrawing_isSubdrawing T W).exists_walk_down W + (by rw [walkDrawing_V]; exact fun x hx => hx) (by rw [walkDrawing_E]; exact fun e he => he) + have hC : (walkDrawing T W).IsCircuit := by + refine ⟨u, W', ⟨by rw [hs]; exact hW.1, by rw [he]; exact hW.2⟩, ?_, ?_, ?_⟩ + · change 0 < W'.edges.length + rw [he] + exact Nat.pos_of_ne_zero hpos + · rw [walkDrawing_V, hs] + · rw [walkDrawing_E, he] + have hsubT := (walkDrawing_isSubdrawing T W).U_subset + exact N.not_circle_in_disc hS hcuffs hZ (IsCircuit.isOArc_U hC) (hsubT.trans hTZ) + (hsubT.trans hTJ) + have hTEmem : ∀ e, e ∈ J'.E → e ⊆ discInt Z → e ∈ T.E := fun e he hs => hTE ▸ ⟨he, hs⟩ + have hdeg : ∀ u ∈ T.toGraph.vertexSet, u ∉ discBd Z → ∀ e x, T.toGraph.IsLink e u x → + ∃ e' x', e' ≠ e ∧ T.toGraph.IsLink e' u x' := by + intro u hu huA e x _ + have huV : u ∈ J'.V ∩ Z := hTV ▸ hu + obtain ⟨e₁, he₁, e₂, he₂, hne', hs₁, hs₂, h₁, h₂⟩ := htwo u huV.1 ⟨huV.2, huA⟩ + have pick : ∀ e' ∈ J'.E, e' ⊆ discInt Z → u ∈ closure e' → e' ≠ e → + ∃ e' x', e' ≠ e ∧ T.toGraph.IsLink e' u x' := by + intro e' he' hs' hu' hn + obtain ⟨p, q, hpq⟩ := (T.toGraph.edge_mem_iff_exists_isLink e').mp (hTEmem e' he' hs') + have : u ∈ closure e' ∩ T.V := ⟨hu', hu⟩ + rw [hpq.2.2.2] at this + rcases this with rfl | h + · exact ⟨e', q, hn, hpq⟩ + · rw [mem_singleton_iff.mp h] + exact ⟨e', p, hn, hpq.symm⟩ + by_cases h : e₁ = e + · exact pick e₂ he₂ hs₂ h₂ (fun h' => hne' (h.trans h'.symm)) + · exact pick e₁ he₁ hs₁ h₁ h + obtain ⟨e₀, he₀⟩ : ∃ e₀, e₀ ∈ J'.E ∧ e₀ ⊆ discInt Z := by + by_cases hx : x₀ ∈ J'.V + · obtain ⟨e₁, he₁, -, -, -, hs₁, -⟩ := htwo x₀ hx hx₀S + exact ⟨e₁, he₁, hs₁⟩ + · obtain ⟨e, he, hxe⟩ := exists_edge_of_mem (G := J') (hU ▸ hx₀U) hx + exact ⟨e, he, hE1 e he ⟨x₀, hxe, hx₀S⟩⟩ + obtain ⟨p, q, hpq⟩ := (T.toGraph.edge_mem_iff_exists_isLink e₀).mp (hTEmem e₀ he₀.1 he₀.2) + obtain ⟨a, b, W, ha, hb, hab, hW, hin⟩ := exists_path_between_of_forest (B := discBd Z) + T.finite_V hforest hdeg hpq + have hP := walkDrawing_isPathBetween T hW + have hline := isLine_of_isPathBetween hP hab + have hsubP := (walkDrawing_isSubdrawing T W).U_subset + have hmemX : ∀ y ∈ W.support, y ∈ discBd Z → y ∈ X := by + intro y hy hyA + have hyU : y ∈ J.U := by + have hyV : y ∈ T.V := W.mem_vertexSet_of_mem_support hy + exact hU ▸ hTs.U_subset (T.V_subset_U hyV) + exact (hAX hyA).resolve_left fun h => N.image_inner_notMem_seam hJ hFbd h hyU + obtain ⟨L, hL, hLX⟩ := hXl a (hmemX a W.start_mem_support ha) b + (hmemX b W.end_mem_support hb) hab + have hcap : (walkDrawing T W).U ∩ L ⊆ {a, b} := by + rintro x ⟨hxP, hxL⟩ + have hxA : x ∈ discBd Z := hXA (hLX hxL) + rcases (mem_U_iff_edge _).mp hxP with h | ⟨e, he, hxe⟩ + · rw [walkDrawing_V] at h + exact hin x h hxA + · have heT : e ∈ T.E := (walkDrawing_isSubdrawing T W).2 he + exact (((hTE ▸ heT : e ∈ ES).2 hxe).2 hxA).elim + refine N.not_circle_in_disc hS hcuffs hZ (isOArc_union hline hL hcap) + (union_subset (hsubP.trans hTZ) (hLX.trans (hXA.trans hbdZ))) + (union_subset (hsubP.trans hTJ) fun x hx => hJ.2.1 ▸ hXU (hLX hx)) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46DeficientSide.lean b/LeanPool/GraphMinor/GM07/Section46DeficientSide.lean new file mode 100644 index 0000000000..22c6294407 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46DeficientSide.lean @@ -0,0 +1,529 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46DeficientSeam +public import LeanPool.GraphMinor.GM07.Section2MinVal +public import LeanPool.GraphMinor.GM07.NetSwap +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46EdgeContacts +import LeanPool.GraphMinor.GM07.Section46EdgeSegments +import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.GM07.Section3 +import LeanPool.GraphMinor.GM07.Section46CentralLift +import LeanPool.GraphMinor.Surface.DiscFan +import LeanPool.GraphMinor.Surface.CutLift +import LeanPool.GraphMinor.Surface.TopologyStatements +import LeanPool.GraphMinor.Surface.ChartCells +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.EdgeLoop + +/-! +# Steps 9 and 10 of VII (4.6): the side of the disc + +Pages 229-230. `F` cuts `Δ` into two discs. The disc of `Σ` is the image of one of them, so the +side `C` of that disc maps into `A ∩ U(J)`: this is claim (2). We prove here the parts of (3) and of +the last page that do not depend on the chosen numbers. If a point of `C` is `l(z)`, the paths at +`z` leave the disc through `A`. A connected part of `U(J)` that misses a vertex of `G` on each side +stays in one edge. A connected part of `bd(Δ)` over one edge lies in one side of a pair, and the +exchange lemma then gives the last inequality. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A connected part of `U(J)` that passes through the piece of an edge `e` between two parameters, +and misses the ends of that piece, stays in that piece. -/ +theorem subset_edge_piece [T2Space S] {J : Drawing S} {γ : Set S → unitInterval → S} + (hγ : EdgePar J γ) {e : Set S} (he : e ∈ J.E) {p q : unitInterval} {X : Set S} + (hX : IsPreconnected X) (hXU : X ⊆ J.U) (hp : γ e p ∉ X) (hq : γ e q ∉ X) {x : S} + (hxX : x ∈ X) (hx : x ∈ γ e '' Ioo p q) : X ⊆ γ e '' Ioo p q := by + by_contra hns + obtain ⟨y, hy, hyn⟩ := not_subset.mp hns + have hc := hγ.cont e he + let e₁ : Set S := γ e '' Icc p q + let E' : Set (Set S) := {g ∈ J.E | g ≠ e} + let T : Set S := (J.V ∪ ⋃ g ∈ E', closure g) ∪ (γ e '' Iic p ∪ γ e '' Ici q) + have hE' : E'.Finite := J.finite_edges.subset fun g hg => hg.1 + have hclosed₁ : IsClosed e₁ := (isCompact_Icc.image hc).isClosed + have hclosedT : IsClosed T := by + refine ((J.finite_V.isClosed).union (hE'.isClosed_biUnion fun _ _ => isClosed_closure)).union + (((isClosed_Iic.isCompact).image hc).isClosed.union + ((isClosed_Ici.isCompact).image hc).isClosed) + have hopen : ∀ {r}, r ∈ Icc p q → γ e r ∈ X → r ∈ Ioo p q := by + intro r hr hrX + refine ⟨lt_of_le_of_ne hr.1 fun h => hp (h ▸ hrX), lt_of_le_of_ne hr.2 fun h => hq (h ▸ hrX)⟩ + have hcov : X ⊆ e₁ ∪ T := by + intro z hz + rcases (mem_U_iff_edge J).mp (hXU hz) with h | ⟨g, hg, hzg⟩ + · exact .inr (.inl (.inl h)) + · by_cases hge : g = e + · subst hge + obtain ⟨r, hr, rfl⟩ : z ∈ γ g '' Ioo 0 1 := (hγ.image g hg).symm ▸ hzg + rcases le_total r p with h | h + · exact .inr (.inr (.inl ⟨r, h, rfl⟩)) + · rcases le_total q r with h' | h' + · exact .inr (.inr (.inr ⟨r, h', rfl⟩)) + · exact .inl ⟨r, ⟨h, h'⟩, rfl⟩ + · exact .inr (.inl (.inr (mem_iUnion₂.mpr ⟨g, ⟨hg, hge⟩, subset_closure hzg⟩))) + have hyT : y ∈ T := by + rcases hcov hy with h | h + · obtain ⟨r, hr, rfl⟩ := h + exact (hyn ⟨r, hopen hr hy, rfl⟩).elim + · exact h + have hx₁ : x ∈ e₁ := by + obtain ⟨r, hr, rfl⟩ := hx + exact ⟨r, ⟨hr.1.le, hr.2.le⟩, rfl⟩ + obtain ⟨z, hz, ⟨r, hr, rfl⟩, hzT⟩ := isPreconnected_closed_iff.mp hX e₁ T hclosed₁ hclosedT hcov + ⟨x, hxX, hx₁⟩ ⟨y, hy, hyT⟩ + have hro := hopen hr hz + have hr0 : 0 < r := lt_of_le_of_lt unitInterval.nonneg' hro.1 + have hr1 : r < 1 := lt_of_lt_of_le hro.2 unitInterval.le_one' + have hre : γ e r ∈ e := (hγ.image e he).subset ⟨r, ⟨hr0, hr1⟩, rfl⟩ + have hoffV := (he.2.1 hre).2 + have hne : ∀ {r'}, r' ≠ r → γ e r' ≠ γ e r := by + intro r' hn heq + rcases edge_parameter_eq_or_ends hγ he heq with h | ⟨-, h⟩ | ⟨-, h⟩ + · exact hn h + · exact hr1.ne h + · exact hr0.ne' h + rcases hzT with (h | h) | ⟨r', hr', hrz⟩ | ⟨r', hr', hrz⟩ + · exact hoffV h + · obtain ⟨g, hg, hzg⟩ := mem_iUnion₂.mp h + rw [← edge_parameter_range hγ hg.1] at hzg + obtain ⟨t, ht⟩ := hzg + have ht0 : t ≠ 0 := fun h => hoffV (ht ▸ h ▸ hγ.zero g hg.1) + have ht1 : t ≠ 1 := fun h => hoffV (ht ▸ h ▸ hγ.one g hg.1) + have hmem : γ g t ∈ g := (hγ.image g hg.1).subset + ⟨t, ⟨lt_of_le_of_ne unitInterval.nonneg' ht0.symm, + lt_of_le_of_ne unitInterval.le_one' ht1⟩, rfl⟩ + exact hg.2 (J.edge_eq_of_mem hg.1 he hmem (ht ▸ hre)) + · exact hne (ne_of_lt (lt_of_le_of_lt hr' hro.1)) hrz + · exact hne (ne_of_gt (lt_of_lt_of_le hro.2 hr')) hrz + +/-- A connected part of `bd(Δ)`, off the ends of the sides and off `bd(Σ)`, lies in one side of a +pair. The closed sides cover it, and two of them meet only at their ends. -/ +theorem Net.exists_side_of_connected [T2Space S] (N : Net S) {Y : Set N.D} (hY : IsPreconnected Y) + (hne : Y.Nonempty) (hbd : Y ⊆ bd N.D) (hoffbd : ∀ y ∈ Y, N.φ y ∉ bd S) + (hoffV : ∀ y ∈ Y, N.φ y ∉ N.seamV) : + ∃ i, Y ⊆ range (N.f i) ∨ Y ⊆ range (N.g i) := by + have : T2Space N.D := N.isSurface_D.2.1 + have : CompactSpace N.D := N.isSurface_D.1 + let T : Fin N.r ⊕ Fin N.r → Set N.D := Sum.elim (fun i => range (N.f i)) (fun i => range (N.g i)) + have hclosed : ∀ j, IsClosed (T j) := by + rintro (i | i) + · exact (isCompact_range (N.f i).continuous).isClosed + · exact (isCompact_range (N.g i).continuous).isClosed + have hcov : ∀ y ∈ Y, ∃ j, y ∈ T j := by + intro y hy + obtain ⟨i, w, -, -, hfib, -⟩ := + N.exists_mem_Ioo_of_mem_bd_of_notMem_bd_of_notMem_seamV (hbd hy) (hoffbd y hy) (hoffV y hy) + have : y ∈ N.φ ⁻¹' {N.φ y} := rfl + rw [hfib] at this + rcases this with h | h + · exact ⟨.inl i, w, h.symm⟩ + · exact ⟨.inr i, w, (mem_singleton_iff.mp h).symm⟩ + have hend : ∀ (i : Fin N.r) (x : unitInterval), x ∉ Ioo (0 : unitInterval) 1 → + N.φ (N.f i x) ∈ N.seamV := by + intro i x hx + have hx' : x = 0 ∨ x = 1 := by + by_contra hn + push Not at hn + exact hx ⟨lt_of_le_of_ne unitInterval.nonneg' hn.1.symm, + lt_of_le_of_ne unitInterval.le_one' hn.2⟩ + rcases hx' with rfl | rfl + · exact ⟨i, .inl rfl⟩ + · exact ⟨i, .inr rfl⟩ + have hsep : ∀ j k, j ≠ k → ∀ z ∈ Y, z ∈ T j → z ∉ T k := by + rintro (i | i) (i' | i') hjk z hz hzj hzk + · obtain ⟨x, rfl⟩ := hzj + have hii : i ≠ i' := fun h => hjk (congrArg _ h) + by_cases hx : x ∈ Ioo (0 : unitInterval) 1 + · exact N.internally_disjoint_ff i i' hii x hx hzk + · exact hoffV _ hz (hend i x hx) + · obtain ⟨x, rfl⟩ := hzj + by_cases hx : x ∈ Ioo (0 : unitInterval) 1 + · exact N.internally_disjoint_fg i i' x hx hzk + · exact hoffV _ hz (hend i x hx) + · obtain ⟨x, rfl⟩ := hzj + by_cases hx : x ∈ Ioo (0 : unitInterval) 1 + · exact N.internally_disjoint_gf i i' x hx hzk + · exact hoffV _ hz (N.pasting_eq i x ▸ hend i x hx) + · obtain ⟨x, rfl⟩ := hzj + have hii : i ≠ i' := fun h => hjk (congrArg _ h) + by_cases hx : x ∈ Ioo (0 : unitInterval) 1 + · exact N.internally_disjoint_gg i i' hii x hx hzk + · exact hoffV _ hz (N.pasting_eq i x ▸ hend i x hx) + obtain ⟨y₀, hy₀⟩ := hne + obtain ⟨j, hj⟩ := hcov y₀ hy₀ + have hsub : Y ⊆ T j := by + by_contra hns + obtain ⟨y₁, hy₁, hy₁n⟩ := not_subset.mp hns + let Q : Set N.D := ⋃ k ∈ {k | k ≠ j}, T k + have hQ : IsClosed Q := (toFinite _).isClosed_biUnion fun k _ => hclosed k + have hc : Y ⊆ T j ∪ Q := by + intro y hy + obtain ⟨k, hk⟩ := hcov y hy + by_cases hkj : k = j + · exact .inl (hkj ▸ hk) + · exact .inr (mem_iUnion₂.mpr ⟨k, hkj, hk⟩) + obtain ⟨k₁, hk₁⟩ := hcov y₁ hy₁ + have hk₁j : k₁ ≠ j := fun h => hy₁n (h ▸ hk₁) + obtain ⟨z, hz, hzj, hzQ⟩ := isPreconnected_closed_iff.mp hY _ _ (hclosed j) hQ hc + ⟨y₀, hy₀, hj⟩ ⟨y₁, hy₁, mem_iUnion₂.mpr ⟨k₁, hk₁j, hk₁⟩⟩ + obtain ⟨k, hk, hzk⟩ := mem_iUnion₂.mp hzQ + exact hsep j k (Ne.symm hk) z hz hzj hzk + rcases j with i | i + · exact ⟨i, .inl hsub⟩ + · exact ⟨i, .inr hsub⟩ + +/-- The exchange of page 230, for a line `Y` in the side `f i` with the ends of `F`: since the net +is minimal, the side carries at most as many vertices as `F`. -/ +theorem Net.subarc_le_of_subset_side (hS : IsSurface S) (N : Net S) (i : Fin N.r) {G : Drawing S} + (hmin : N.IsMinimalFor G) {F Y : Set N.D} {s t : N.D} (hEnds : IsLineWithEnds F s t) + (hFbd : F ∩ bd N.D = {s, t}) {G_D : Drawing N.D} (hPull : IsPullbackDrawing N.φ G G_D) + (hFn : G_D.IsNormal F) (hY : IsLineWithEnds Y s t) (hsub : Y ⊆ range (N.f i)) + (h0 : N.f i 0 ∉ Y) (h1 : N.f i 1 ∉ Y) : + (N.φ '' (Y \ {s, t}) ∩ G.V).ncard ≤ (N.φ '' (F \ {s, t}) ∩ G.V).ncard := by + have : T2Space N.D := N.isSurface_D.2.1 + have hα : IsArcMap (N.f i) := ⟨(N.f i).continuous, N.injective_f i⟩ + have hemb : IsEmbedding (N.f i) := + ((N.f i).continuous.isClosedEmbedding (N.injective_f i)).isEmbedding + have hP : IsPreconnected (N.f i ⁻¹' Y) := by + refine hemb.isInducing.isPreconnected_image.mp ?_ + rw [image_preimage_eq_of_subset hsub] + exact line_preconnected hY + have key : ∀ {u v : unitInterval} {s' t' : N.D}, u < v → N.f i u = s' → N.f i v = t' → + IsLineWithEnds F s' t' → F ∩ bd N.D = {s', t'} → IsLineWithEnds Y s' t' → + (N.φ '' (Y \ {s', t'}) ∩ G.V).ncard ≤ (N.φ '' (F \ {s', t'}) ∩ G.V).ncard := by + rintro u v _ _ huv rfl rfl hE hB hL + have hIcc : Icc u v ⊆ N.f i ⁻¹' Y := hP.ordConnected.out hL.left_mem hL.right_mem + have hYeq : N.f i '' Icc u v = Y := hL.eq_of_subset + (isPreconnected_Icc.image _ (N.f i).continuous.continuousOn) + (image_subset_iff.mpr hIcc) ⟨u, ⟨le_rfl, huv.le⟩, rfl⟩ ⟨v, ⟨huv.le, le_rfl⟩, rfl⟩ + have hu0 : 0 < u := lt_of_le_of_ne unitInterval.nonneg' fun h => h0 (h ▸ hL.left_mem) + have hv1 : v < 1 := lt_of_le_of_ne unitInterval.le_one' fun h => h1 (h ▸ hL.right_mem) + have := N.subarc_contacts_le_cutting_contacts hS i u v hu0 huv hv1 hmin hE hB hPull hFn + rwa [hYeq] at this + obtain ⟨u, hu⟩ : s ∈ range (N.f i) := hsub hY.left_mem + obtain ⟨v, hv⟩ : t ∈ range (N.f i) := hsub hY.right_mem + have hne : u ≠ v := fun h => hY.ne' (hu.symm.trans ((congrArg _ h).trans hv)) + rcases lt_or_gt_of_ne hne with h | h + · exact key h hu hv hEnds hFbd hY + · have := key h hv hu (GM07.IsLineWithEnds.symm hEnds) (by rw [pair_comm]; exact hFbd) + (GM07.IsLineWithEnds.symm hY) + rwa [pair_comm t s] at this + +/-- On a part of a side that misses its ends, `φ` is injective. -/ +theorem Net.injOn_of_subset_side (N : Net S) (i : Fin N.r) {Y : Set N.D} + (hsub : Y ⊆ range (N.f i)) (h0 : N.f i 0 ∉ Y) (h1 : N.f i 1 ∉ Y) : InjOn N.φ Y := by + intro x hx y hy hxy + obtain ⟨a, rfl⟩ := hsub hx + have ha : a ∈ Ioo (0 : unitInterval) 1 := + ⟨lt_of_le_of_ne unitInterval.nonneg' fun h => h0 (h ▸ hx), + lt_of_le_of_ne unitInterval.le_one' fun h => h1 (h ▸ hx)⟩ + rcases N.eq_f_or_g_of_φ_eq_of_mem_Ioo i ha hxy with h | h + · exact h.symm + · obtain ⟨b, rfl⟩ := hsub hy + exact (N.internally_disjoint_gf i i a ha ⟨b, h⟩).elim + +/-- The exchange of page 230 for a line `Y` in either side of a pair, off the ends of the sides. -/ +theorem Net.contacts_le_of_side (hS : IsSurface S) (N : Net S) (i : Fin N.r) {G : Drawing S} + (hmin : N.IsMinimalFor G) {F Y : Set N.D} {s t : N.D} (hEnds : IsLineWithEnds F s t) + (hFbd : F ∩ bd N.D = {s, t}) {G_D : Drawing N.D} (hPull : IsPullbackDrawing N.φ G G_D) + (hFn : G_D.IsNormal F) (hY : IsLineWithEnds Y s t) + (hside : Y ⊆ range (N.f i) ∨ Y ⊆ range (N.g i)) (hoff : ∀ y ∈ Y, N.φ y ∉ N.seamV) : + (N.φ '' (Y \ {s, t}) ∩ G.V).ncard ≤ (N.φ '' (F \ {s, t}) ∩ G.V).ncard ∧ InjOn N.φ Y := by + have : T2Space S := hS.2.1 + rcases hside with h | h + · have h0 : N.f i 0 ∉ Y := fun hy => hoff _ hy ⟨i, .inl rfl⟩ + have h1 : N.f i 1 ∉ Y := fun hy => hoff _ hy ⟨i, .inr rfl⟩ + exact ⟨N.subarc_le_of_subset_side hS i hmin hEnds hFbd hPull hFn hY h h0 h1, + N.injOn_of_subset_side i h h0 h1⟩ + · have h0 : N.g i 0 ∉ Y := fun hy => hoff _ hy ⟨i, .inl (N.pasting_eq i 0)⟩ + have h1 : N.g i 1 ∉ Y := fun hy => hoff _ hy ⟨i, .inr (N.pasting_eq i 1)⟩ + have hf : (N.swapPair i).f i = N.g i := (N.f_swapPair i i).trans (ite_eq_left rfl) + have hsub : Y ⊆ range ((N.swapPair i).f i) := by rw [hf]; exact h + have h0' : (N.swapPair i).f i 0 ∉ Y := by rw [hf]; exact h0 + have h1' : (N.swapPair i).f i 1 ∉ Y := by rw [hf]; exact h1 + exact ⟨(N.swapPair i).subarc_le_of_subset_side hS i + ((N.isMinimalFor_swapPair i G).mpr hmin) hEnds hFbd hPull hFn hY hsub h0' h1', + (N.swapPair i).injOn_of_subset_side i hsub h0' h1'⟩ + +/-- The side of the disc, page 229. `F` cuts `Δ` into two discs. One of them, `R`, maps its inside +into the disc `Z`, because the open disc misses `U(J)`. Its side `C` then maps into `A`. This is the +half of claim (2) that we use. -/ +theorem Net.exists_disc_side (hS : IsSurface S) (N : Net S) {J : Drawing S} + (hJ : N.IsSeamGraphFor J) {F : Set N.D} {s t : N.D} {C₁ C₂ : Set N.D} + (hEnds : IsLineWithEnds F s t) (hFbd : F ∩ bd N.D = {s, t}) + (hC : componentsIn (bd N.D \ {s, t}) = {C₁, C₂}) {Z : Set S} (hZ : IsClosedDisc Z) + (hmiss : Disjoint (discInt Z) J.U) (hFZ : N.φ '' F ⊆ discBd Z) + (hZF : discBd Z ⊆ N.φ '' F ∪ J.U) : + ∃ (R R' C : Set N.D), (C = C₁ ∨ C = C₂) ∧ IsClosedDisc R ∧ IsClosed R' ∧ R ∪ R' = univ ∧ + C ⊆ bd N.D ∧ C ⊆ R ∧ Disjoint C R' ∧ discBd R = C ∪ F ∧ + N.φ '' discInt R ⊆ discInt Z ∧ (∀ x ∈ C, N.φ x ∈ discBd Z) ∧ + IsLineWithEnds (C ∪ {s, t}) s t ∧ C ∩ {s, t} = ∅ := by + have : T2Space S := hS.2.1 + have : T2Space N.D := N.isSurface_D.2.1 + have hman := hS.2.2 + have hst : s ≠ t := hEnds.ne' + have hbdU : discBd (univ : Set N.D) = bd N.D := image_bd_homeomorph (Homeomorph.Set.univ N.D) + obtain ⟨A₁, A₂, Δ₁, Δ₂, hA, hc, d₁, d₂, hu, hi, b₁, b₂, -⟩ := disc_iArc univ F s t + N.isClosedDisc_D (subset_univ F) hst hEnds (by rw [hbdU]; exact hFbd) + rw [hbdU] at hc + have hsbd : s ∈ bd N.D := (hFbd.symm.subset (.inl rfl)).2 + have htbd : t ∈ bd N.D := (hFbd.symm.subset (.inr rfl)).2 + obtain ⟨B₁, B₂, hB, -, hBu, hL₁, hL₂⟩ := oArc_components_diff_pair N.isOArc_bd_D hsbd htbd hst + have hparts : A₁ ∪ A₂ = bd N.D \ {s, t} ∧ IsLineWithEnds (A₁ ∪ {s, t}) s t ∧ + IsLineWithEnds (A₂ ∪ {s, t}) s t := by + rcases pair_eq_pair_iff.mp (hc.symm.trans hB) with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨hBu.symm, hL₁, hL₂⟩ + · exact ⟨by rw [union_comm]; exact hBu.symm, hL₂, hL₁⟩ + obtain ⟨hcover, hline₁, hline₂⟩ := hparts + have hA₁s : A₁ ⊆ bd N.D \ {s, t} := hcover ▸ subset_union_left + have hA₂s : A₂ ⊆ bd N.D \ {s, t} := hcover ▸ subset_union_right + have hsF : ({s, t} : Set N.D) ⊆ F := fun x hx => (hFbd.symm.subset hx).1 + have hmem : ∀ {A}, (A = A₁ ∨ A = A₂) → (A = C₁ ∨ A = C₂) := by + intro A hAe + have : A ∈ ({C₁, C₂} : Set (Set N.D)) := by + rw [← hC, hc] + rcases hAe with h | h + · exact .inl h + · exact .inr h + exact this + have key : ∀ {A₁ A₂ Δ₁ Δ₂ : Set N.D}, IsClosedDisc Δ₁ → IsClosedDisc Δ₂ → Δ₁ ∪ Δ₂ = univ → + Δ₁ ∩ Δ₂ = F → discBd Δ₁ = A₁ ∪ F → discBd Δ₂ = A₂ ∪ F → A₁ ∪ A₂ = bd N.D \ {s, t} → + A₁ ⊆ bd N.D \ {s, t} → (A₁ = C₁ ∨ A₁ = C₂) → IsLineWithEnds (A₁ ∪ {s, t}) s t → + ∀ y₀ ∈ discInt Δ₁, N.φ y₀ ∈ discInt Z → + ∃ (R R' C : Set N.D), (C = C₁ ∨ C = C₂) ∧ IsClosedDisc R ∧ IsClosed R' ∧ R ∪ R' = univ ∧ + C ⊆ bd N.D ∧ C ⊆ R ∧ Disjoint C R' ∧ discBd R = C ∪ F ∧ + N.φ '' discInt R ⊆ discInt Z ∧ (∀ x ∈ C, N.φ x ∈ discBd Z) ∧ + IsLineWithEnds (C ∪ {s, t}) s t ∧ C ∩ {s, t} = ∅ := by + intro A₁ A₂ Δ₁ Δ₂ d₁ d₂ hu hi b₁ b₂ hcover hA₁s hAC hline y₀ hy₀ hy₀Z + have hint : ∀ w ∈ discInt Δ₁, w ∉ bd N.D ∧ w ∉ F := by + intro w hw + have hwF : w ∉ F := fun h => hw.2 (b₁ ▸ .inr h) + refine ⟨fun hb => ?_, hwF⟩ + have hws : w ∉ ({s, t} : Set N.D) := fun h => hwF (hsF h) + rcases (hcover ▸ (⟨hb, hws⟩ : w ∈ bd N.D \ {s, t}) : w ∈ A₁ ∪ A₂) with h | h + · exact hw.2 (b₁ ▸ .inl h) + · have hw₂ : w ∈ Δ₂ := Surface.discBd_subset _ (b₂ ▸ .inl h) + exact hwF (hi ▸ ⟨hw.1, hw₂⟩) + have hoff : ∀ w ∈ discInt Δ₁, N.φ w ∉ discBd Z := by + intro w hw hwA + obtain ⟨hwb, hwF⟩ := hint w hw + rcases hZF hwA with ⟨y, hy, hyw⟩ | h + · exact hwF ((N.interior_inj w hwb y hyw.symm) ▸ hy) + · exact hwb (N.preimage_seamU ▸ (hJ.2.1 ▸ h : N.φ w ∈ N.seamU)) + have hcon : IsPreconnected (N.φ '' discInt Δ₁) := + d₁.isPreconnected_discInt.image _ N.quotientMap_φ.continuous.continuousOn + have hdis : Disjoint (N.φ '' discInt Δ₁) (discBd Z) := by + rw [disjoint_left] + rintro _ ⟨w, hw, rfl⟩ + exact hoff w hw + have hsub : N.φ '' discInt Δ₁ ⊆ discInt Z := by + rcases hZ.side hman hcon hdis with h | h + · exact h + · exact (disjoint_left.mp h (mem_image_of_mem _ hy₀) hy₀Z.1).elim + have hΔ : N.φ '' Δ₁ ⊆ Z := by + have h₁ := image_mono (f := N.φ) d₁.subset_closure_discInt + have h₂ := image_closure_subset_closure_image (s := discInt Δ₁) + N.quotientMap_φ.continuous + exact (h₁.trans h₂).trans (closure_minimal (hsub.trans (discInt_subset Z)) hZ.isClosed) + have hA₁Δ : A₁ ⊆ Δ₁ := fun x hx => Surface.discBd_subset _ (b₁ ▸ .inl hx) + refine ⟨Δ₁, Δ₂, A₁, hAC, d₁, d₂.isClosed, hu, fun x hx => (hA₁s hx).1, hA₁Δ, ?_, b₁, hsub, ?_, + hline, ?_⟩ + · rw [disjoint_left] + intro x hx hx₂ + have hxF : x ∈ F := hi ▸ ⟨hA₁Δ hx, hx₂⟩ + exact (hA₁s hx).2 (hFbd ▸ ⟨hxF, (hA₁s hx).1⟩) + · intro x hx + have hxZ : N.φ x ∈ Z := hΔ (mem_image_of_mem _ (hA₁Δ hx)) + by_contra hn + have hxU : N.φ x ∈ J.U := hJ.2.1 ▸ mem_image_of_mem N.φ (hA₁s hx).1 + exact disjoint_left.mp hmiss ⟨hxZ, hn⟩ hxU + · exact eq_empty_of_forall_notMem fun x hx => (hA₁s hx.1).2 hx.2 + obtain ⟨x₀, hx₀⟩ := hZ.nonempty_discInt + have hx₀U : x₀ ∉ J.U := fun h => disjoint_left.mp hmiss hx₀ h + obtain ⟨y₀, rfl⟩ := N.quotientMap_φ.surjective x₀ + have hy₀b : y₀ ∉ bd N.D := fun h => hx₀U (hJ.2.1 ▸ mem_image_of_mem N.φ h) + have hy₀F : y₀ ∉ F := fun h => hx₀.2 (hFZ (mem_image_of_mem _ h)) + have hy₀u : y₀ ∈ Δ₁ ∪ Δ₂ := hu ▸ mem_univ y₀ + rcases hy₀u with h | h + · refine key d₁ d₂ hu hi b₁ b₂ hcover hA₁s (hmem (.inl rfl)) hline₁ y₀ ⟨h, ?_⟩ hx₀ + rintro hb + rw [b₁] at hb + rcases hb with h' | h' + · exact hy₀b (hA₁s h').1 + · exact hy₀F h' + · refine key d₂ d₁ (by rwa [union_comm]) (by rwa [inter_comm]) b₂ b₁ (by rwa [union_comm]) hA₂s + (hmem (.inr rfl)) hline₂ y₀ ⟨h, ?_⟩ hx₀ + rintro hb + rw [b₂] at hb + rcases hb with h' | h' + · exact hy₀b (hA₂s h').1 + · exact hy₀F h' + +/-- A walk in a graph with edges off `A`, from a point of the open disc to a point outside it, has a +vertex on `A`. -/ +private theorem exists_exit [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) {Γ : Drawing S} + {Z : Set S} (hZ : IsClosedDisc Z) (hnorm : ∀ e ∈ Γ.E, Disjoint e (discBd Z)) {u v : S} + (W : GraphWalk Γ.toGraph u v) (hu : u ∈ discInt Z) (hv : v ∉ discInt Z) : + ∃ y ∈ W.support, y ∈ discBd Z := by + induction W with + | nil h => exact (hv hu).elim + | @cons a m b e hl r ih => + by_cases hm : m ∈ discInt Z + · obtain ⟨y, hy, hyA⟩ := ih hm hv + exact ⟨y, by simp [hy], hyA⟩ + · have hopen := hZ.isOpen_discInt hman + have hau : a ∈ closure e := by + have : a ∈ closure e ∩ Γ.V := hl.2.2.2.symm ▸ mem_insert a {m} + exact this.1 + have hmc : m ∈ closure e := by + have : m ∈ closure e ∩ Γ.V := hl.2.2.2.symm ▸ mem_insert_of_mem a (mem_singleton m) + exact this.1 + obtain ⟨y, hyS, hye⟩ := mem_closure_iff.mp hau _ hopen hu + have hsub : e ⊆ discInt Z := by + rcases hZ.side hman hl.1.2.2.1.isConnected.isPreconnected (hnorm e hl.1) with h | h + · exact h + · exact (disjoint_left.mp h hye hyS.1).elim + have hmZ : m ∈ Z := closure_minimal (hsub.trans (discInt_subset Z)) hZ.isClosed hmc + have hmA : m ∈ discBd Z := by + by_contra hn + exact hm ⟨hmZ, hn⟩ + exact ⟨m, by simp [r.start_mem_support], hmA⟩ + +/-- Claim (3) of VII (4.6), page 229, its main step: the point `l(z)` is not on the side `C`. The +first edges of the `μ` paths at `z` lie in the open disc, and each path ends outside it. So each +path +meets `A` again. There are fewer than `μ` such vertices, so by (b) `A` meets another cuff, and this +contradicts (i). -/ +theorem no_lift_on_side [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) {G J : Drawing S} + {Z : Set S} {μ v : ℕ} (hZ : IsClosedDisc Z) (hmiss : Disjoint (discInt Z) J.U) + (hbdJ : bd S ⊆ J.U) (hAn : G.IsNormal (discBd Z)) (hAc : (discBd Z ∩ G.V).ncard ≤ μ) + (hμv : μ ≤ v) + (hi : ∀ B : Set S, G.IsNormal B → IsIArc B → (G.V ∩ B).ncard ≤ v → + ∃ C ∈ cuffs S, lineEnds B ⊆ C) + {z : S} (hzV : z ∈ G.V) (hzA : z ∈ discBd Z) {C : Set S} (hC : C ∈ cuffs S) (hzC : z ∈ C) + {n : ℕ} {P : Fin n → Drawing S} {e : Fin n → S} + (hP : ∀ i, (P i).IsSubdrawing G ∧ e i ∈ G.V ∩ (bd S \ C) ∧ (P i).IsPathBetween z (e i)) + (hd : ∀ i j, i ≠ j → Disjoint ((P i).V \ {z, e i}) ((P j).V \ {z, e j})) + {I : Finset (Fin n)} (hI : μ ≤ I.card) + (hfirst : ∀ i ∈ I, ∃ f ∈ (P i).E, z ∈ closure f ∧ f ⊆ discInt Z) : False := by + classical + have hbdC : C ⊆ bd S := fun x hx => sUnion_cuffs (S := S) ▸ ⟨C, hC, hx⟩ + have hzbd : z ∈ bd S := hbdC hzC + have hedgeoff : ∀ {Γ : Drawing S}, Γ.IsSubdrawing G → ∀ f ∈ Γ.E, Disjoint f (discBd Z) := by + intro Γ hΓ f hf + rw [disjoint_left] + intro x hxf hxA + have hfG := hΓ.2 hf + have hxU : x ∈ G.U := (hfG.2.1 hxf).1 + exact (hfG.2.1 hxf).2 (hAn ⟨hxA, hxU⟩) + have hexit : ∀ i ∈ I, ∃ y ∈ (P i).V, y ≠ z ∧ y ∈ discBd Z := by + intro i hiI + obtain ⟨f, hf, hzf, hfS⟩ := hfirst i hiI + obtain ⟨hPs, hei, W, hW, hV, hE⟩ := hP i + have heoff : e i ∉ discInt Z := fun h => + disjoint_left.mp hmiss h (hbdJ hei.2.1) + have hfW : f ∈ W.edges := by + have : f ∈ {e | e ∈ W.edges} := hE ▸ hf + exact this + cases W with + | nil h => simp at hfW + | @cons a m b f₀ hl r => + have hne : z ∉ r.support := (List.nodup_cons.mp hW).1 + have hf₀ : f₀ = f := by + rcases List.mem_cons.mp hfW with h | h + · exact h.symm + · exfalso + obtain ⟨p, q, hpq⟩ := ((P i).toGraph.edge_mem_iff_exists_isLink f).mp hf + have hzV' : z ∈ (P i).V := hl.left_mem + have hz' : z ∈ closure f ∩ (P i).V := ⟨hzf, hzV'⟩ + rw [hpq.2.2.2] at hz' + rcases hz' with rfl | h' + · exact hne (r.left_mem_support_of_mem_edges h hpq) + · have hzq : z = q := h' + rw [← hzq] at hpq + exact hne (r.left_mem_support_of_mem_edges h hpq.symm) + subst hf₀ + have hmc : m ∈ closure f₀ := by + have : m ∈ closure f₀ ∩ (P i).V := hl.2.2.2.symm ▸ mem_insert_of_mem z (mem_singleton m) + exact this.1 + have hmZ : m ∈ Z := closure_minimal (hfS.trans (discInt_subset Z)) hZ.isClosed hmc + by_cases hmA : m ∈ discBd Z + · refine ⟨m, ?_, fun h => hne (h ▸ r.start_mem_support), hmA⟩ + rw [hV] + simp [r.start_mem_support] + · obtain ⟨y, hy, hyA⟩ := exists_exit hman hZ (hedgeoff hPs) r ⟨hmZ, hmA⟩ heoff + refine ⟨y, ?_, fun h => hne (h ▸ hy), hyA⟩ + rw [hV] + simp [hy] + have hexit' : ∀ i, ∃ y, i ∈ I → y ∈ (P i).V ∧ y ≠ z ∧ y ∈ discBd Z := fun i => by + by_cases hiI : i ∈ I + · obtain ⟨y, h₁, h₂, h₃⟩ := hexit i hiI + exact ⟨y, fun _ => ⟨h₁, h₂, h₃⟩⟩ + · exact ⟨z, fun h => (hiI h).elim⟩ + choose y hy using hexit' + have hyV : ∀ i ∈ I, y i ∈ (P i).V := fun i h => (hy i h).1 + have hyz : ∀ i ∈ I, y i ≠ z := fun i h => (hy i h).2.1 + have hyA : ∀ i ∈ I, y i ∈ discBd Z := fun i h => (hy i h).2.2 + have hfin : (discBd Z ∩ G.V).Finite := G.finite_V.subset inter_subset_right + let Tg : Finset S := (hfin.toFinset).erase z + have hTg : Tg.card < μ := by + have hcard : hfin.toFinset.card = (discBd Z ∩ G.V).ncard := + (ncard_eq_toFinset_card _ hfin).symm + have hz : z ∈ hfin.toFinset := hfin.mem_toFinset.mpr ⟨hzA, hzV⟩ + have := Finset.card_erase_lt_of_mem hz + change (hfin.toFinset.erase z).card < μ + omega + have hmaps : ∀ i ∈ I, y i ∈ Tg := fun i hiI => Finset.mem_erase.mpr + ⟨hyz i hiI, hfin.mem_toFinset.mpr ⟨hyA i hiI, (hP i).1.1 (hyV i hiI)⟩⟩ + obtain ⟨i, hiI, j, hjI, hij, hyy⟩ := + Finset.exists_ne_map_eq_of_card_lt_of_maps_to (lt_of_lt_of_le hTg hI) hmaps + have hyend : y i = e i ∨ y i = e j := by + by_contra hn + push Not at hn + refine disjoint_left.mp (hd i j hij) ⟨hyV i hiI, ?_⟩ ⟨hyy ▸ hyV j hjI, ?_⟩ + · rintro (h | h) + · exact hyz i hiI h + · exact hn.1 h + · rintro (h | h) + · exact hyz i hiI h + · exact hn.2 h + have hyoff : y i ∈ bd S \ C := by + rcases hyend with h | h + · exact h ▸ ((hP i).2.1).2 + · exact h ▸ ((hP j).2.1).2 + obtain ⟨L₁, L₂, hL₁, -, hu, -⟩ := IsOArc.lines hZ.isOArc_discBd hzA (hyA i hiI) + (hyz i hiI).symm + have hsub : L₁ ⊆ discBd Z := fun x hx => hu ▸ Or.inl hx + have hle : (G.V ∩ L₁).ncard ≤ v := by + have h₁ : (G.V ∩ L₁).ncard ≤ (discBd Z ∩ G.V).ncard := + Set.ncard_le_ncard (fun x hx => ⟨hsub hx.2, hx.1⟩) hfin + omega + obtain ⟨C', hC', hends⟩ := hi L₁ (fun x hx => hAn ⟨hsub hx.1, hx.2⟩) + ⟨z, y i, hzbd, hyoff.1, hL₁⟩ hle + have hzC' : z ∈ C' := hends ⟨y i, hL₁⟩ + have hyC' : y i ∈ C' := hends ⟨z, GM07.IsLineWithEnds.symm hL₁⟩ + have hCC : C' = C := by + by_contra hne + exact disjoint_left.mp (cuffs_disjoint hC' hC hne) hzC' hzC + exact hyoff.2 (hCC ▸ hyC') + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46Descend.lean b/LeanPool/GraphMinor/GM07/Section46Descend.lean new file mode 100644 index 0000000000..6908505107 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46Descend.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.PushForest +import LeanPool.GraphMinor.GM07.PullForest +import LeanPool.GraphMinor.GM07.Section46CentralLift + +/-! +# Feasibility descends along the two cuts + +Page 227: "Thus, to show that $H$ is $G$-feasible it suffices to show that +$\phi^{-1}(H)$ is $\phi^{-1}(G)$-feasible." We apply (4.5) twice, first to `ψ` and then +to `θ`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +variable {S S' D : Type} [TopologicalSpace S] [TopologicalSpace S'] [TopologicalSpace D] + +/-- The image of a subgraph of `φ⁻¹(G)` is a subgraph of `G`. -/ +theorem isSubdrawing_of_image {G : Drawing S} {Gd Hd : Drawing D} {P : Drawing S} {φ : D → S} + (hPU : P.U = φ '' Hd.U) (hPV : P.V = φ '' Hd.V) (hV : Gd.V = φ ⁻¹' G.V) + (hsub : Hd.IsSubdrawing Gd) (hE : ∀ e' ∈ Gd.E, ∃ e ∈ G.E, φ '' e' = e) : + P.IsSubdrawing G := by + have hVG : P.V ⊆ G.V := by + rw [hPV] + rintro _ ⟨v, hv, rfl⟩ + have := hsub.1 hv + rw [hV] at this + exact this + refine ⟨hVG, fun e he => ?_⟩ + have hcover : ∀ {z : S}, z ∈ P.U \ P.V → ∃ g ∈ G.E, z ∈ g ∧ g ⊆ P.U \ P.V := by + rintro z ⟨hzU, hzV⟩ + rw [hPU] at hzU + obtain ⟨z', hz', rfl⟩ := hzU + have hz'V : z' ∉ Hd.V := fun h => hzV (hPV ▸ mem_image_of_mem φ h) + rcases (mem_U_iff_edge Hd).mp hz' with h | ⟨e', he', hze'⟩ + · exact (hz'V h).elim + · obtain ⟨g, hg, rfl⟩ := hE e' (hsub.2 he') + refine ⟨_, hg, mem_image_of_mem φ hze', ?_⟩ + rintro _ ⟨y, hy, rfl⟩ + refine ⟨hPU ▸ mem_image_of_mem φ (he'.2.1 hy).1, fun h => ?_⟩ + exact (hg.2.1 ⟨y, hy, rfl⟩).2 (hVG h) + obtain ⟨x, hx⟩ := he.1 + obtain ⟨g, hg, hxg, hgsub⟩ := hcover (he.2.1 hx) + have hesub : e ⊆ G.U \ G.V := by + intro z hz + obtain ⟨g', hg', hzg', -⟩ := hcover (he.2.1 hz) + exact hg'.2.1 hzg' + have hconn : IsPathConnected (e ∪ g) := he.2.2.1.union hg.2.2.1 ⟨x, hx, hxg⟩ + have h1 : e ∪ g = e := he.2.2.2 _ (union_subset he.2.1 hgsub) hconn subset_union_left + have h2 : e ∪ g = g := hg.2.2.2 _ (union_subset hesub hg.2.1) hconn subset_union_right + have : e = g := h1.symm.trans h2 + rwa [this] + +/-- Page 227: feasibility of the pullback to the disc gives feasibility of `H`. -/ +theorem isGFeasible_of_pullback (hS : IsSurface S) {L G H : Drawing S} + {K' G' H' : Drawing S'} {Gd Hd : Drawing D} + {θ : S' → S} {ψ : D → S'} (hθ : IsCutAlongGraph L S' θ) (hψ : IsCutAlongGraph K' D ψ) + (hH : IsSurfaceForest H) (hnL : H.IsNormal L.U) (hH' : IsSurfaceForest H') + (hnK : H'.IsNormal K'.U) (hp : IsPullbackDrawing θ H H') (hpd : IsPullbackDrawing ψ H' Hd) + (hG' : IsPullbackDrawing θ G G') (hGd : IsPullbackDrawing ψ G' Gd) + (hE : ∀ e' ∈ Gd.E, ∃ e ∈ G.E, (θ ∘ ψ) '' e' = e) (hfe : IsGFeasible Gd Hd) : + IsGFeasible G H := by + have hS' := hθ.isSurface + obtain ⟨Hd', hF, hhom, hsub⟩ := hfe + obtain ⟨Hq, hq, -, hpush⟩ := theorem_4_5_proof hS' K' H' ψ hψ hH' hnK + have hqeq : Hq = Hd := drawing_eq (hq.1.trans hpd.1.symm) (hq.2.trans hpd.2.symm) + subst hqeq + obtain ⟨P₁, hi₁, hF₁, hh₁⟩ := hpush Hd' hF hhom.symm + obtain ⟨Hr, hr, -, hpush₂⟩ := theorem_4_5_proof hS L H θ hθ hH hnL + have hreq : Hr = H' := drawing_eq (hr.1.trans hp.1.symm) (hr.2.trans hp.2.symm) + subst hreq + obtain ⟨P₂, hi₂, hF₂, hh₂⟩ := hpush₂ P₁ hF₁ hh₁ + refine ⟨P₂, hF₂, hh₂.symm, ?_⟩ + refine isSubdrawing_of_image + (by rw [hi₂.1, hi₁.1, image_comp]) (by rw [hi₂.2, hi₁.2, image_comp]) ?_ hsub hE + rw [hGd.2, hG'.2] + rfl + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46DiscApproach.lean b/LeanPool/GraphMinor/GM07/Section46DiscApproach.lean new file mode 100644 index 0000000000..73b4c52a74 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46DiscApproach.lean @@ -0,0 +1,68 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM07.Section46UniqueLiftLimit +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.GM07.Defs + +/-! +# Small connected approaches in a closed disc + +The lift of the open net disc in VII (4.6), page 226, is extended to +the boundary by a limit. In a closed disc each point has small open +neighbourhoods which meet the open disc in a convex set. So the part +of each such neighbourhood in the open disc is connected. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface + +theorem closed_disc_connected_approach {D : Type*} [TopologicalSpace D] + (e : ClosedUnitDisc ≃ₜ D) (x : D) (O : Set D) (hO : IsOpen O) (hx : x ∈ O) : + ∃ W : Set D, IsOpen W ∧ x ∈ W ∧ W ⊆ O ∧ IsPreconnected (W ∩ (bd D)ᶜ) := by + have hO' : IsOpen (e ⁻¹' O) := hO.preimage e.continuous + obtain ⟨r, hr, hball⟩ := Metric.isOpen_iff.mp hO' (e.symm x) (by simpa using hx) + have hbdD : bd D = e '' bd ClosedUnitDisc := (image_bd_homeomorph e).symm + have hWeq : e '' ball (e.symm x) r ∩ (bd D)ᶜ = + e '' (ball (e.symm x) r ∩ (bd ClosedUnitDisc)ᶜ) := by + rw [hbdD, image_inter e.injective, image_compl_eq e.bijective] + refine ⟨e '' ball (e.symm x) r, ?_, ⟨_, mem_ball_self hr, by simp⟩, ?_, ?_⟩ + · exact e.isOpenMap _ isOpen_ball + · rintro _ ⟨y, hy, rfl⟩ + exact hball hy + · rw [hWeq] + apply IsPreconnected.image _ e e.continuous.continuousOn + rw [Topology.IsInducing.subtypeVal.isPreconnected_image.symm] + apply Convex.isPreconnected + have hset : Subtype.val '' (ball (e.symm x) r ∩ (bd ClosedUnitDisc)ᶜ) = + ball (e.symm x).1 r ∩ ball 0 1 := by + ext z + constructor + · rintro ⟨y, ⟨hy, hyb⟩, rfl⟩ + refine ⟨hy, ?_⟩ + rw [bd_closedUnitDisc] at hyb + have h1 : ‖y.1‖ ≤ 1 := by simpa [ClosedUnitDisc] using y.2 + have h2 : ‖y.1‖ ≠ 1 := fun h => hyb (by simpa [UnitCircle] using h) + simpa using lt_of_le_of_ne h1 h2 + · rintro ⟨hz, hz1⟩ + have hzn : ‖z‖ < 1 := by simpa using hz1 + refine ⟨⟨z, by simpa [ClosedUnitDisc] using hzn.le⟩, ⟨hz, ?_⟩, rfl⟩ + rw [bd_closedUnitDisc] + intro h + have : ‖z‖ = 1 := by simpa [UnitCircle] using h + exact hzn.ne this + rw [hset] + exact (convex_ball _ _).inter (convex_ball _ _) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46DiscSides.lean b/LeanPool/GraphMinor/GM07/Section46DiscSides.lean new file mode 100644 index 0000000000..fed2cd15f9 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46DiscSides.lean @@ -0,0 +1,48 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# The disc-side argument for the unique seam region + +In VII (4.6), page 226, the complement of the seam is connected and +dense in the original surface. If a disc boundary misses that complement, +the complement lies on one side of the disc. Either the disc contains +the whole original surface, or it meets that surface only in its boundary. +This also applies when the disc lies in a capped surface. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +/-- The disc-side argument used for `R` in VII (4.6), page 226. The set +`C` is the complement of the seam, and `A` is the original surface +inside the ambient (possibly capped) surface. -/ +theorem disc_side_of_dense_connected_set {S : Type*} [TopologicalSpace S] [T2Space S] + (hman : ∀ x : S, IsManifoldPoint x) {A C D : Set S} + (hD : IsClosedDisc D) (hC : IsPreconnected C) (hAC : A ⊆ closure C) + (hbd : Disjoint C (discBd D)) : + A ⊆ D ∨ D ∩ A ⊆ discBd D := by + rcases hD.side hman hC hbd with hinside | houtside + · exact .inl (hAC.trans (closure_minimal (hinside.trans (discInt_subset D)) hD.isClosed)) + · apply Or.inr + intro x hx + by_contra hxbd + have hxInt : x ∈ discInt D := ⟨hx.1, hxbd⟩ + obtain ⟨y, hyInt, hyC⟩ := mem_closure_iff.mp (hAC hx.2) + (discInt D) (hD.isOpen_discInt hman) hxInt + exact disjoint_left.mp houtside hyC hyInt.1 + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46DiscSlide.lean b/LeanPool/GraphMinor/GM07/Section46DiscSlide.lean new file mode 100644 index 0000000000..44be8e9068 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46DiscSlide.lean @@ -0,0 +1,256 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.Surface.DiscPolygon +import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.GM07.Section2Euler +import LeanPool.GraphMinor.GM07.NetSwapBasic +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# Sliding along a side of the net + +The slide on page 227 of VII (4.6) moves points along a central edge. We +do it in `Δ`, where this edge is two sides: a homeomorphism of the +boundary circle which acts in the same way on both sides extends to the +closed disc. Since it respects the pasting along the edge, it comes down +to a homeomorphism of `Σ′`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +/-- A homeomorphism of the boundary of a closed disc extends to the disc. -/ +theorem exists_disc_homeo_of_bd {D : Type} [TopologicalSpace D] + (hD : IsClosedDisc (univ : Set D)) (B : bd D ≃ₜ bd D) : + ∃ b : D ≃ₜ D, ∀ x : bd D, b x.1 = (B x).1 := by + have hb : discBd (univ : Set D) = bd D := image_bd_homeomorph (Homeomorph.Set.univ D) + obtain ⟨φ₀⟩ := hD.isOArc_discBd + let C : discBd (univ : Set D) ≃ₜ bd D := Homeomorph.setCongr hb + let φ₁ : Circle ≃ₜ discBd (univ : Set D) := (φ₀.trans C).trans (B.trans C.symm) + obtain ⟨h₀, g₀, c₀, he₀⟩ := exists_chart_extending hD φ₀ + obtain ⟨h₁, g₁, c₁, he₁⟩ := exists_chart_extending hD φ₁ + have hm₀ : ∀ x : D, h₀ x ∈ Metric.closedBall (0 : ℂ) 1 := fun x => c₀.hm (mem_univ x) + have hm₁ : ∀ x : D, h₁ x ∈ Metric.closedBall (0 : ℂ) 1 := fun x => c₁.hm (mem_univ x) + have hc₀ : Continuous h₀ := continuousOn_univ.mp c₀.hc + have hc₁ : Continuous h₁ := continuousOn_univ.mp c₁.hc + let b : D ≃ₜ D := + { toFun := fun x => g₁ (h₀ x) + invFun := fun x => g₀ (h₁ x) + left_inv := fun x => by + change g₀ (h₁ (g₁ (h₀ x))) = x + rw [c₁.hg (hm₀ x), c₀.gh (mem_univ x)] + right_inv := fun x => by + change g₁ (h₀ (g₀ (h₁ x))) = x + rw [c₀.hg (hm₁ x), c₁.gh (mem_univ x)] + continuous_toFun := c₁.gc.comp_continuous hc₀ hm₀ + continuous_invFun := c₀.gc.comp_continuous hc₁ hm₁ } + refine ⟨b, fun x => ?_⟩ + obtain ⟨z, hz⟩ : ∃ z, (C (φ₀ z)) = x := ⟨(φ₀.trans C).symm x, by simp⟩ + have ht : Circle.exp (Complex.arg z) = z := Circle.exp_arg z + set t := Complex.arg z with htdef + have h1 : g₀ (eC t) = x.1 := by + rw [he₀, ht, ← hz] + rfl + have hball : eC t ∈ Metric.closedBall (0 : ℂ) 1 := by + simp [eC] + have h2 : h₀ x.1 = eC t := by + rw [← h1, c₀.hg hball] + change g₁ (h₀ x.1) = (B x).1 + rw [h2, he₁, ht, ← hz] + simp [φ₁] + rfl + +/-- The action of a slide of the side parameter on `Δ`. -/ +private noncomputable def bdSlide {S : Type} [TopologicalSpace S] (N : Net S) (i : Fin N.r) + (σ : unitInterval → unitInterval) (x : N.D) : N.D := + open Classical in + if x ∈ range (N.f i) then N.f i (σ (Function.invFun (N.f i) x)) + else if x ∈ range (N.g i) then N.g i (σ (Function.invFun (N.g i) x)) else x + +section + +variable {S : Type} [TopologicalSpace S] (N : Net S) (i : Fin N.r) + {σ : unitInterval → unitInterval} + +private theorem bdSlide_f (r : unitInterval) : bdSlide N i σ (N.f i r) = N.f i (σ r) := by + have h : N.f i r ∈ range (N.f i) := ⟨r, rfl⟩ + simp only [bdSlide, h, ite_true] + rw [Function.leftInverse_invFun (N.injective_f i) r] + +private theorem bdSlide_g (h0 : σ 0 = 0) (h1 : σ 1 = 1) (r : unitInterval) : + bdSlide N i σ (N.g i r) = N.g i (σ r) := by + by_cases h : N.g i r ∈ range (N.f i) + · obtain ⟨r', hr'⟩ := h + have hr'Ioo : r' ∉ Ioo (0 : unitInterval) 1 := fun hm => + N.internally_disjoint_fg i i r' hm ⟨r, hr'.symm⟩ + have hrIoo : r ∉ Ioo (0 : unitInterval) 1 := fun hm => + N.internally_disjoint_gf i i r hm ⟨r', hr'⟩ + have hσr : σ r = r := by + rcases Net.unitInterval_eq_zero_or_one_or_mem_Ioo r with rfl | rfl | hm + · exact h0 + · exact h1 + · exact (hrIoo hm).elim + have hσr' : σ r' = r' := by + rcases Net.unitInterval_eq_zero_or_one_or_mem_Ioo r' with rfl | rfl | hm + · exact h0 + · exact h1 + · exact (hr'Ioo hm).elim + rw [← hr', bdSlide_f, hσr', hσr, hr'] + · have hg : N.g i r ∈ range (N.g i) := ⟨r, rfl⟩ + simp only [bdSlide, h, hg, ite_true, ite_false] + rw [Function.leftInverse_invFun (N.injective_g i) r] + +private theorem bdSlide_off (h0 : σ 0 = 0) (h1 : σ 1 = 1) {x : N.D} + (hf : x ∉ N.f i '' Ioo (0 : unitInterval) 1) (hg : x ∉ N.g i '' Ioo (0 : unitInterval) 1) : + bdSlide N i σ x = x := by + by_cases h : x ∈ range (N.f i) + · obtain ⟨r, rfl⟩ := h + have hσr : σ r = r := by + rcases Net.unitInterval_eq_zero_or_one_or_mem_Ioo r with rfl | rfl | hm + · exact h0 + · exact h1 + · exact (hf ⟨r, hm, rfl⟩).elim + rw [bdSlide_f, hσr] + · by_cases h' : x ∈ range (N.g i) + · obtain ⟨r, rfl⟩ := h' + have hσr : σ r = r := by + rcases Net.unitInterval_eq_zero_or_one_or_mem_Ioo r with rfl | rfl | hm + · exact h0 + · exact h1 + · exact (hg ⟨r, hm, rfl⟩).elim + rw [bdSlide_g N i h0 h1, hσr] + · simp only [bdSlide, h, h', ite_false] + +end + +/-- A slide of the side parameter, used on both sides of a pair, extends to the disc. -/ +theorem Net.exists_disc_slide {S : Type} [TopologicalSpace S] (N : Net S) (i : Fin N.r) + (σ : unitInterval ≃ₜ unitInterval) (h0 : σ 0 = 0) (h1 : σ 1 = 1) : + ∃ b : N.D ≃ₜ N.D, (∀ r, b (N.f i r) = N.f i (σ r)) ∧ (∀ r, b (N.g i r) = N.g i (σ r)) ∧ + ∀ x ∈ bd N.D, x ∉ N.f i '' Ioo (0 : unitInterval) 1 → + x ∉ N.g i '' Ioo (0 : unitInterval) 1 → b x = x := by + classical + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + have hbc : IsClosed (bd N.D) := isClosed_bd N.D + have : CompactSpace (bd N.D) := isCompact_iff_compactSpace.mp hbc.isCompact + have h0' : σ.symm 0 = 0 := by rw [← h0, σ.symm_apply_apply, h0] + have h1' : σ.symm 1 = 1 := by rw [← h1, σ.symm_apply_apply, h1] + have hfbd : ∀ r, N.f i r ∈ bd N.D := fun r => N.range_f_subset_bd i ⟨r, rfl⟩ + have hgbd : ∀ r, N.g i r ∈ bd N.D := fun r => N.range_g_subset_bd i ⟨r, rfl⟩ + have hmaps : ∀ τ : unitInterval → unitInterval, τ 0 = 0 → τ 1 = 1 → ∀ x ∈ bd N.D, + bdSlide N i τ x ∈ bd N.D := by + intro τ h h' x hx + by_cases hf : x ∈ N.f i '' Ioo (0 : unitInterval) 1 + · obtain ⟨r, -, rfl⟩ := hf + rw [bdSlide_f] + exact hfbd _ + by_cases hg : x ∈ N.g i '' Ioo (0 : unitInterval) 1 + · obtain ⟨r, -, rfl⟩ := hg + rw [bdSlide_g N i h h'] + exact hgbd _ + rw [bdSlide_off N i h h' hf hg] + exact hx + have hinv : ∀ τ τ' : unitInterval → unitInterval, τ 0 = 0 → τ 1 = 1 → τ' 0 = 0 → τ' 1 = 1 → + (∀ r, τ' (τ r) = r) → ∀ x, bdSlide N i τ' (bdSlide N i τ x) = x := by + intro τ τ' h h' k k' hl x + by_cases hf : x ∈ range (N.f i) + · obtain ⟨r, rfl⟩ := hf + rw [bdSlide_f, bdSlide_f, hl] + by_cases hg : x ∈ range (N.g i) + · obtain ⟨r, rfl⟩ := hg + rw [bdSlide_g N i h h', bdSlide_g N i k k', hl] + have hf' : x ∉ N.f i '' Ioo (0 : unitInterval) 1 := fun ⟨r, _, hr⟩ => hf ⟨r, hr⟩ + have hg' : x ∉ N.g i '' Ioo (0 : unitInterval) 1 := fun ⟨r, _, hr⟩ => hg ⟨r, hr⟩ + rw [bdSlide_off N i h h' hf' hg', bdSlide_off N i k k' hf' hg'] + obtain ⟨U₁, hU₁, hU₁e⟩ := N.exists_isOpen_inter_bd_eq_image_Ioo_f i 0 1 + obtain ⟨U₂, hU₂, hU₂e⟩ := N.exists_isOpen_inter_bd_eq_image_Ioo_g i 0 1 + let P₃ : Set N.D := bd N.D ∩ U₁ᶜ ∩ U₂ᶜ + have hP₃ : IsClosed P₃ := (hbc.inter hU₁.isClosed_compl).inter hU₂.isClosed_compl + have hcont : ∀ A : Set N.D, IsClosed A → IsClosed (bd N.D ∩ bdSlide N i σ ⁻¹' A) := by + intro A hA + let c₁ : Set unitInterval := (fun r => N.f i (σ r)) ⁻¹' A + let c₂ : Set unitInterval := (fun r => N.g i (σ r)) ⁻¹' A + have hc₁ : IsClosed c₁ := hA.preimage ((N.f i).continuous.comp σ.continuous) + have hc₂ : IsClosed c₂ := hA.preimage ((N.g i).continuous.comp σ.continuous) + have heq : bd N.D ∩ bdSlide N i σ ⁻¹' A = N.f i '' c₁ ∪ N.g i '' c₂ ∪ (P₃ ∩ A) := by + ext x + constructor + · rintro ⟨hx, hxA⟩ + by_cases hf : x ∈ range (N.f i) + · obtain ⟨r, rfl⟩ := hf + refine .inl (.inl ⟨r, ?_, rfl⟩) + have : bdSlide N i σ (N.f i r) ∈ A := hxA + rwa [bdSlide_f] at this + by_cases hg : x ∈ range (N.g i) + · obtain ⟨r, rfl⟩ := hg + refine .inl (.inr ⟨r, ?_, rfl⟩) + have : bdSlide N i σ (N.g i r) ∈ A := hxA + rwa [bdSlide_g N i h0 h1] at this + have hf' : x ∉ N.f i '' Ioo (0 : unitInterval) 1 := fun ⟨r, _, hr⟩ => hf ⟨r, hr⟩ + have hg' : x ∉ N.g i '' Ioo (0 : unitInterval) 1 := fun ⟨r, _, hr⟩ => hg ⟨r, hr⟩ + refine .inr ⟨⟨⟨hx, fun h => hf' (hU₁e ▸ ⟨h, hx⟩)⟩, fun h => hg' (hU₂e ▸ ⟨h, hx⟩)⟩, ?_⟩ + have : bdSlide N i σ x ∈ A := hxA + rwa [bdSlide_off N i h0 h1 hf' hg'] at this + · rintro ((⟨r, hr, rfl⟩ | ⟨r, hr, rfl⟩) | ⟨⟨⟨hx, h₁⟩, h₂⟩, hxA⟩) + · refine ⟨hfbd r, ?_⟩ + change bdSlide N i σ (N.f i r) ∈ A + rw [bdSlide_f] + exact hr + · refine ⟨hgbd r, ?_⟩ + change bdSlide N i σ (N.g i r) ∈ A + rw [bdSlide_g N i h0 h1] + exact hr + · refine ⟨hx, ?_⟩ + change bdSlide N i σ x ∈ A + rw [bdSlide_off N i h0 h1 (fun h => h₁ (hU₁e.symm.subset h).1) + (fun h => h₂ (hU₂e.symm.subset h).1)] + exact hxA + rw [heq] + exact ((hc₁.isCompact.image (N.f i).continuous).isClosed.union + (hc₂.isCompact.image (N.g i).continuous).isClosed).union (hP₃.inter hA) + let E : bd N.D ≃ bd N.D := + { toFun := fun x => ⟨bdSlide N i σ x.1, hmaps _ h0 h1 _ x.2⟩ + invFun := fun x => ⟨bdSlide N i σ.symm x.1, hmaps _ h0' h1' _ x.2⟩ + left_inv := fun x => Subtype.ext (hinv _ _ h0 h1 h0' h1' (fun r => σ.symm_apply_apply r) x.1) + right_inv := fun x => Subtype.ext (hinv _ _ h0' h1' h0 h1 (fun r + => σ.apply_symm_apply r) x.1) } + have hEc : Continuous E := by + rw [continuous_iff_isClosed] + intro C hC + obtain ⟨A, hA, rfl⟩ := isClosed_induced_iff.mp hC + have hheq : E ⁻¹' (Subtype.val ⁻¹' A) = Subtype.val ⁻¹' (bd N.D ∩ bdSlide N i σ ⁻¹' A) := by + ext x + constructor + · intro hx + exact ⟨x.2, hx⟩ + · intro hx + exact hx.2 + rw [hheq] + exact (hcont A hA).preimage continuous_subtype_val + obtain ⟨b, hb⟩ := exists_disc_homeo_of_bd N.isClosedDisc_D (hEc.homeoOfEquivCompactToT2 (f := E)) + refine ⟨b, fun r => ?_, fun r => ?_, fun x hx hf hg => ?_⟩ + · have := hb ⟨N.f i r, hfbd r⟩ + rw [this] + exact bdSlide_f N i r + · have := hb ⟨N.g i r, hgbd r⟩ + rw [this] + exact bdSlide_g N i h0 h1 r + · have := hb ⟨x, hx⟩ + rw [this] + exact bdSlide_off N i h0 h1 hf hg + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46DrawingContactCount.lean b/LeanPool/GraphMinor/GM07/Section46DrawingContactCount.lean new file mode 100644 index 0000000000..e0c107c065 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46DrawingContactCount.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import Mathlib.Data.Set.Card.Arithmetic +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Counting graph contacts over closed edges + +The count on page 226 of VII (4.6) sums the vertex contacts on closed +edges of `L`. Every vertex of `L` is on an edge. Thus the closed edges +cover its point set, and summing their contact bounds gives the required +bound without dropping vertex contacts. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +/-- The closed edges cover a drawing with no isolated vertices. -/ +theorem U_eq_closed_edges_of_no_isolated {S : Type*} [TopologicalSpace S] + (L : Drawing S) (hno : HasNoIsolatedVertices L) : + L.U = ⋃ e ∈ L.E, closure e := by + apply Subset.antisymm + · intro x hx + rw [L.U_eq] at hx + rcases hx with hx | hx + · obtain ⟨e, he, hi⟩ := hno x hx + exact mem_iUnion₂.mpr ⟨e, he, hi.2.2⟩ + · exact hx + · intro x hx + obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact L.closure_subset_U he hxe + +/-- The closed-edge contact sum used for `L` in VII (4.6), page 226. -/ +theorem ncard_vertex_contacts_U_le_edges_mul {S : Type*} [TopologicalSpace S] + (G L : Drawing S) (hno : HasNoIsolatedVertices L) {B : ℕ} + (hbound : ∀ e ∈ L.E, (closure e ∩ G.V).ncard ≤ B) : + (G.V ∩ L.U).ncard ≤ L.E.ncard * B := by + classical + have hcover : G.V ∩ L.U = ⋃ e ∈ L.finite_edges.toFinset, closure e ∩ G.V := by + ext x + constructor + · rintro ⟨hxV, hxU⟩ + have hx := (congrArg (fun A => x ∈ A) (U_eq_closed_edges_of_no_isolated L hno)).mp hxU + obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact mem_iUnion₂.mpr ⟨e, L.finite_edges.mem_toFinset.mpr he, hxe, hxV⟩ + · intro hx + obtain ⟨e, he, hxe, hxV⟩ := mem_iUnion₂.mp hx + exact ⟨hxV, L.closure_subset_U (L.finite_edges.mem_toFinset.mp he) hxe⟩ + rw [hcover, ncard_eq_toFinset_card L.E L.finite_edges] + calc + _ ≤ ∑ e ∈ L.finite_edges.toFinset, (closure e ∩ G.V).ncard := + L.finite_edges.toFinset.set_ncard_biUnion_le _ + _ ≤ ∑ _e ∈ L.finite_edges.toFinset, B := + Finset.sum_le_sum fun e he => hbound e (L.finite_edges.mem_toFinset.mp he) + _ = L.finite_edges.toFinset.card * B := by simp + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46EdgeContacts.lean b/LeanPool/GraphMinor/GM07/Section46EdgeContacts.lean new file mode 100644 index 0000000000..84ea952ebb --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46EdgeContacts.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.GM07.Section2Base + +/-! +# Ordered vertex contacts of a parametrized seam edge + +The list of contacts used for `W(e)` in VII (4.6), page 225, is finite +in the edge parameter. Its size is at least the number of graph vertices +on the closed edge. The parameter count allows a loop's two ends to be +listed at both ends of the interval. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +universe u + +/-- The contacts with the finite vertex set of `G` form a finite parameter +set on each seam edge, as used in VII (4.6), page 225. -/ +theorem finite_edge_contact_parameters {S : Type u} [TopologicalSpace S] + {G J : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {e : Set S} (he : e ∈ J.E) : (γ e ⁻¹' G.V).Finite := by + let T := γ e ⁻¹' G.V + have hi : InjOn (γ e) (Ioo 0 1 ∩ T) := (hγ.inj e he).mono inter_subset_left + have him : ((γ e) '' (Ioo 0 1 ∩ T)).Finite := + G.finite_V.subset (by rintro _ ⟨t, ht, rfl⟩; exact ht.2) + have hfin := (finite_image_iff hi).mp him + apply (((finite_singleton (1 : unitInterval)).insert 0).union hfin).subset + intro t ht + by_cases h0 : t = 0 + · exact .inl (.inl h0) + by_cases h1 : t = 1 + · exact .inl (.inr h1) + exact .inr ⟨⟨unitInterval.pos_iff_ne_zero.mpr h0, + unitInterval.lt_one_iff_ne_one.mpr h1⟩, ht⟩ + +/-- The parameter list on a long edge contains all the contacts on its +closure. At a loop vertex the two parameter ends may repeat one contact, +as permitted by the ordered list in VII (4.6), page 225. -/ +theorem ncard_edge_contacts_le_parameters {S : Type u} [TopologicalSpace S] + [T2Space S] {G J : Drawing S} {γ : Set S → unitInterval → S} + (hγ : EdgePar J γ) {e : Set S} (he : e ∈ J.E) : + (closure e ∩ G.V).ncard ≤ (γ e ⁻¹' G.V).ncard := by + have hcl : closure e ⊆ γ e '' univ := by + apply closure_minimal _ ((isCompact_univ.image (hγ.cont e he)).isClosed) + intro x hx + obtain ⟨t, ht, rfl⟩ := (congrArg (fun A => x ∈ A) (hγ.image e he)).mpr hx + exact ⟨t, mem_univ _, rfl⟩ + have hsub : closure e ∩ G.V ⊆ γ e '' (γ e ⁻¹' G.V) := by + intro x hx + obtain ⟨t, _, ht⟩ := hcl hx.1 + refine ⟨t, ?_, ht⟩ + change γ e t ∈ G.V + rw [ht] + exact hx.2 + have hfin := finite_edge_contact_parameters (G := G) hγ he + exact (ncard_le_ncard hsub (hfin.image _)).trans (ncard_image_le hfin) + +/-- An edge parameter only identifies its two ends. This gives injectivity +on either linking interval used in VII (4.6), page 225. -/ +theorem edge_parameter_eq_or_ends {S : Type u} [TopologicalSpace S] + {J : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {e : Set S} (he : e ∈ J.E) {s t : unitInterval} (hst : γ e s = γ e t) : + s = t ∨ s = 0 ∧ t = 1 ∨ s = 1 ∧ t = 0 := by + have hmid : ∀ r ∈ Ioo (0 : unitInterval) 1, γ e r ∉ J.V := by + intro r hr + have hmem : γ e r ∈ e := + (congrArg (fun A => γ e r ∈ A) (hγ.image e he)).mp (mem_image_of_mem (γ e) hr) + exact (he.2.1 hmem).2 + rcases Net.unitInterval_eq_zero_or_one_or_mem_Ioo s with rfl | rfl | hs + · rcases Net.unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact .inl rfl + · exact .inr (.inl ⟨rfl, rfl⟩) + · exact (hmid t ht (hst ▸ hγ.zero e he)).elim + · rcases Net.unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact .inr (.inr ⟨rfl, rfl⟩) + · exact .inl rfl + · exact (hmid t ht (hst ▸ hγ.one e he)).elim + · rcases Net.unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact (hmid s hs (hst.symm ▸ hγ.zero e he)).elim + · exact (hmid s hs (hst.symm ▸ hγ.one e he)).elim + · exact .inl (hγ.inj e he hs ht hst) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46EdgeIncidence.lean b/LeanPool/GraphMinor/GM07/Section46EdgeIncidence.lean new file mode 100644 index 0000000000..4806ef2523 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46EdgeIncidence.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section46EdgeLift +import LeanPool.GraphMinor.Surface.ChartCells +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# A lifted edge has one incidence over each of its ends + +The first-edge count in VII (4.6), page 225, assigns each indexed path to +a point over its initial vertex. We identify the closure of the preimage +of its open first edge with the lifted closed line. Injectivity on that +line then gives a unique incidence over each end. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +universe u + +/-- The preimage of a non-loop edge has a unique incidence over each end, +as used in choosing `l(z)` in VII (4.6), page 225. -/ +theorem Net.exists_unique_lifted_edge_end {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {G J : Drawing S} + (hJ : N.IsSeamGraphFor J) (hnorm : G.IsNormal J.U) + {e : Set S} (he : e ∈ G.E) {a b : S} + (hends : closure e ∩ G.V = {a, b}) (hline : IsLineWithEnds (closure e) a b) : + ∃ a' : N.D, N.φ a' = a ∧ a' ∈ closure (N.φ ⁻¹' e) ∧ + ∀ x ∈ closure (N.φ ⁻¹' e), N.φ x = a → x = a' := by + have : T2Space S := hS.2.1 + have : T2Space N.D := N.isSurface_D.2.1 + obtain ⟨L, a', b', hL, ha, hb, him, hinj, hcover⟩ := + N.exists_lift_closed_normal_edge hS hJ hnorm he hends hline + have haV : a ∈ G.V := (hends ▸ (mem_insert a {b}) : a ∈ closure e ∩ G.V).2 + have hbV : b ∈ G.V := (hends ▸ (mem_insert_of_mem a (mem_singleton b)) : b ∈ closure e ∩ G.V).2 + have heq : N.φ ⁻¹' e = L \ {a', b'} := by + apply Subset.antisymm + · intro x hx + have hxcl : N.φ x ∈ closure e := subset_closure hx + have hxV : N.φ x ∉ G.V := by + have hx' : N.φ x ∈ closure e \ G.V := by + rw [G.closure_diff_V he] + exact hx + exact hx'.2 + have hxab : N.φ x ∉ ({a, b} : Set S) := by + rintro (h | h) + · exact hxV (h ▸ haV) + · exact hxV (h ▸ hbV) + refine ⟨hcover x ⟨hxcl, hxab⟩, ?_⟩ + rintro (rfl | rfl) + · exact hxV (ha ▸ haV) + · exact hxV (hb ▸ hbV) + · intro x hx + have hxcl : N.φ x ∈ closure e := him ▸ mem_image_of_mem N.φ hx.1 + have hxV : N.φ x ∉ G.V := by + intro hxV + have hxends : N.φ x ∈ ({a, b} : Set S) := hends ▸ ⟨hxcl, hxV⟩ + rcases hxends with hxend | hxend + · exact hx.2 (.inl (hinj hx.1 hL.left_mem (hxend.trans ha.symm))) + · exact hx.2 (.inr (hinj hx.1 hL.right_mem (hxend.trans hb.symm))) + exact G.closure_diff_V he ▸ ⟨hxcl, hxV⟩ + have hcl : closure (N.φ ⁻¹' e) = L := by + rw [heq] + exact Subset.antisymm (closure_minimal sdiff_subset hL.isCompact.isClosed) + hL.subset_closure_diff + refine ⟨a', ha, hcl ▸ hL.left_mem, ?_⟩ + intro x hx hxa + exact hinj (hcl ▸ hx) hL.left_mem (hxa.trans ha.symm) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46EdgeLift.lean b/LeanPool/GraphMinor/GM07/Section46EdgeLift.lean new file mode 100644 index 0000000000..8348d6518f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46EdgeLift.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.GM19.CutMap +import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.GM07.MinimalNet +import LeanPool.GraphMinor.GM07.PullForest + +/-! +# Lifting the first edges of paths to the net disc + +In VII (4.6), page 225, each path edge at a boundary vertex has a lift +incident with a single point of the fibre. The net surjection is a cutting +map along its seam, and an edge meets that seam only at its ends. We lift +the closed edge as a line, retaining its injectivity and its chosen ends. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +universe u + +/-- The surjection of a net is a cutting map along its seam. -/ +theorem Net.isCutMap_seam {S : Type u} [TopologicalSpace S] (N : Net S) : + GM19.IsCutMap N.φ N.seamU := by + refine ⟨N.quotientMap_φ.continuous, N.quotientMap_φ.surjective, + ?_, N.finite_fiber, ?_⟩ + · intro x hx y _ hxy + have hxbd : x ∉ bd N.D := by + rw [← N.preimage_seamU] + exact hx + exact N.interior_inj x hxbd y hxy + · rw [N.preimage_seamU] + +/-- The lift of a non-loop edge in the normal net, as used for the first +edges of the paths in VII (4.6), page 225. -/ +theorem Net.exists_lift_closed_normal_edge {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {G J : Drawing S} + (hJ : N.IsSeamGraphFor J) (hnorm : G.IsNormal J.U) + {e : Set S} (he : e ∈ G.E) {a b : S} + (hends : closure e ∩ G.V = {a, b}) (hline : IsLineWithEnds (closure e) a b) : + ∃ (L : Set N.D) (a' b' : N.D), IsLineWithEnds L a' b' ∧ + N.φ a' = a ∧ N.φ b' = b ∧ N.φ '' L = closure e ∧ + InjOn N.φ L ∧ ∀ x, N.φ x ∈ closure e \ {a, b} → x ∈ L := by + have : CompactSpace N.D := N.isSurface_D.1 + have : T2Space N.D := N.isSurface_D.2.1 + have : T2Space S := hS.2.1 + have hmeet : closure e ∩ J.U ⊆ {a, b} := by + intro x hx + rw [← hends] + exact ⟨hx.1, hnorm ⟨hx.2, G.closure_subset_U he hx.1⟩⟩ + have hcut : GM19.IsCutMap N.φ J.U := hJ.2.1 ▸ N.isCutMap_seam + exact exists_lift_closed_edge hcut J.isClosed_U hline hmeet + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46EdgeSegments.lean b/LeanPool/GraphMinor/GM07/Section46EdgeSegments.lean new file mode 100644 index 0000000000..83e458886c --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46EdgeSegments.lean @@ -0,0 +1,129 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46EdgeContacts +import LeanPool.GraphMinor.GM07.Section5b +import LeanPool.GraphMinor.Surface.ChartCells + +/-! +# The three closed segments of a long edge + +The split on page 225 of VII (4.6) uses two interior parameter values. +Each of the left, central and right closed segments is a line, even if +the old edge is a loop. Its open edge is the image of the open parameter +interval. These facts justify gluing the three line drawings. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +universe u + +/-- An interval that omits at least one end of an edge parameter is +injective, as required for the three pieces in VII (4.6), page 225. -/ +theorem edge_parameter_injOn_Icc {S : Type u} [TopologicalSpace S] + {J : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {e : Set S} (he : e ∈ J.E) {a b : unitInterval} (hab : 0 < a ∨ b < 1) : + InjOn (γ e) (Icc a b) := by + intro x hx y hy hxy + rcases edge_parameter_eq_or_ends hγ he hxy with h | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact h + · rcases hab with ha | hb + · exact (not_le_of_gt ha hx.1).elim + · exact (not_le_of_gt hb hy.2).elim + · rcases hab with ha | hb + · exact (not_le_of_gt ha hy.1).elim + · exact (not_le_of_gt hb hx.2).elim + +/-- The closed intervals used for linking and central pieces are lines, +in VII (4.6), page 225. -/ +theorem edge_parameter_line_Icc {S : Type u} [TopologicalSpace S] [T2Space S] + {J : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {e : Set S} (he : e ∈ J.E) {a b : unitInterval} (hlt : a < b) + (hab : 0 < a ∨ b < 1) : + IsLineWithEnds (γ e '' Icc a b) (γ e a) (γ e b) := + isLineWithEnds_image_Icc_of_injOn (hγ.cont e he) hlt (edge_parameter_injOn_Icc hγ he hab) + +/-- Removing the two ends of an injective closed parameter segment leaves +its open parameter image, the edge of the corresponding line drawing. -/ +theorem image_Icc_diff_endpoints {S : Type u} + {g : unitInterval → S} {a b : unitInterval} (hab : a < b) + (hinj : InjOn g (Icc a b)) : + (g '' Icc a b) \ {g a, g b} = g '' Ioo a b := by + ext x + constructor + · rintro ⟨⟨t, ht, rfl⟩, hends⟩ + have hta : t ≠ a := fun h => hends (.inl (congrArg g h)) + have htb : t ≠ b := fun h => hends (.inr (congrArg g h)) + exact ⟨t, ⟨lt_of_le_of_ne ht.1 hta.symm, lt_of_le_of_ne ht.2 htb⟩, rfl⟩ + · rintro ⟨t, ht, rfl⟩ + refine ⟨⟨t, ⟨ht.1.le, ht.2.le⟩, rfl⟩, ?_⟩ + rintro (h | h) + · exact ht.1.ne' (hinj ⟨ht.1.le, ht.2.le⟩ ⟨le_rfl, hab.le⟩ h) + · exact ht.2.ne (hinj ⟨ht.1.le, ht.2.le⟩ ⟨hab.le, le_rfl⟩ h) + +/-- The full edge parameter covers precisely the closed edge. -/ +theorem edge_parameter_range {S : Type u} [TopologicalSpace S] [T2Space S] + {J : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {e : Set S} (he : e ∈ J.E) : range (γ e) = closure e := by + apply Subset.antisymm + · rintro x ⟨t, rfl⟩ + have ht : t ∈ closure (Ioo (0 : unitInterval) 1) := by + rw [closure_Ioo zero_ne_one] + exact ⟨bot_le, le_top⟩ + have hx := image_closure_subset_closure_image (hγ.cont e he) ⟨t, ht, rfl⟩ + exact (congrArg (fun A => γ e t ∈ closure A) (hγ.image e he)).mp hx + · apply closure_minimal _ (isCompact_range (hγ.cont e he)).isClosed + intro x hx + obtain ⟨t, _, rfl⟩ := (congrArg (fun A => x ∈ A) (hγ.image e he)).mpr hx + exact mem_range_self t + +/-- The old vertices on a closed edge are its two parameter ends. -/ +theorem edge_parameter_old_vertices {S : Type u} [TopologicalSpace S] [T2Space S] + {J : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {e : Set S} (he : e ∈ J.E) : + closure e ∩ J.V = {γ e 0, γ e 1} := by + apply Subset.antisymm + · intro x hx + obtain ⟨t, rfl⟩ := (congrArg (fun A => x ∈ A) (edge_parameter_range hγ he)).mpr hx.1 + by_cases h0 : t = 0 + · exact .inl (congrArg (γ e) h0) + by_cases h1 : t = 1 + · exact .inr (congrArg (γ e) h1) + have ht : t ∈ Ioo (0 : unitInterval) 1 := + ⟨unitInterval.pos_iff_ne_zero.mpr h0, unitInterval.lt_one_iff_ne_one.mpr h1⟩ + have hxE : γ e t ∈ e := + (congrArg (fun A => γ e t ∈ A) (hγ.image e he)).mp ⟨t, ht, rfl⟩ + exact ((he.2.1 hxE).2 hx.2).elim + · rintro x (rfl | rfl) + · exact ⟨(congrArg (fun A => γ e 0 ∈ A) (edge_parameter_range hγ he)).mp (mem_range_self 0), + hγ.zero e he⟩ + · exact ⟨(congrArg (fun A => γ e 1 ∈ A) (edge_parameter_range hγ he)).mp (mem_range_self 1), + hγ.one e he⟩ + +/-- The closure of an open injective parameter segment is the closed +segment. These are the closures used for the contact counts on linking +and central edges in VII (4.6), page 225. -/ +theorem closure_image_Ioo_eq_Icc {S : Type u} [TopologicalSpace S] [T2Space S] + {J : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {e : Set S} (he : e ∈ J.E) {a b : unitInterval} (hlt : a < b) + (hab : 0 < a ∨ b < 1) : + closure (γ e '' Ioo a b) = γ e '' Icc a b := by + have hL := edge_parameter_line_Icc hγ he hlt hab + have hinj := edge_parameter_injOn_Icc hγ he hab + rw [← image_Icc_diff_endpoints hlt hinj] + exact Subset.antisymm (closure_minimal sdiff_subset hL.isCompact.isClosed) + hL.subset_closure_diff + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46FibreCount.lean b/LeanPool/GraphMinor/GM07/Section46FibreCount.lean new file mode 100644 index 0000000000..2f139c81f1 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46FibreCount.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Data.Set.Card +import Mathlib.Combinatorics.SimpleGraph.Acyclic + +/-! +# Counting points joined by finitely many identifications + +For the fibre count on page 225 of VII (4.6), each pasted endpoint joins two +points of the net disc. A connected set joined by `m` such pairs has at most +`m + 1` points. We prove this count using the connected graph of the pairs. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set + +/-- A connected family of endpoint identifications joins at most one more +point than its number of pairs. This is the finite graph count used for +fibres of the net surjection in VII (4.6), page 225. -/ +theorem card_le_pairs_add_one {α ι : Type*} [Nonempty α] [Finite ι] + (f g : ι → α) + (hconn : ∀ x y : α, Relation.EqvGen + (fun x y => ∃ i, x = f i ∧ y = g i) x y) : + Nat.card α ≤ Nat.card ι + 1 := by + classical + let E : Set (Sym2 α) := range (fun i => s(f i, g i)) + let G := SimpleGraph.fromEdgeSet E + have hreach : ∀ x y, Relation.EqvGen + (fun x y => ∃ i, x = f i ∧ y = g i) x y → G.Reachable x y := by + intro x y h + induction h with + | rel x y h => + obtain ⟨i, rfl, rfl⟩ := h + by_cases he : f i = g i + · rw [he] + · exact SimpleGraph.Adj.reachable (show G.Adj (f i) (g i) from ⟨⟨i, rfl⟩, he⟩) + | refl x => exact SimpleGraph.Reachable.refl _ + | symm x y _ ih => exact ih.symm + | trans x y z _ _ ih₁ ih₂ => exact ih₁.trans ih₂ + have hG : G.Connected := { preconnected := fun x y => hreach x y (hconn x y) } + have hE : E.Finite := finite_range _ + have hsub : G.edgeSet ⊆ E := by + rw [SimpleGraph.edgeSet_fromEdgeSet] + exact sdiff_subset + have hcard : Nat.card G.edgeSet ≤ Nat.card ι := by + rw [Nat.card_coe_set_eq] + exact (ncard_le_ncard hsub hE).trans (by + rw [show E = (fun i => s(f i, g i)) '' univ from (image_univ).symm] + exact (ncard_image_le (finite_univ)).trans_eq (ncard_univ ι)) + exact hG.card_vert_le_card_edgeSet_add_one.trans (Nat.add_le_add_right hcard 1) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46FibreValency.lean b/LeanPool/GraphMinor/GM07/Section46FibreValency.lean new file mode 100644 index 0000000000..8a9178f26e --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46FibreValency.lean @@ -0,0 +1,110 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.MinimalNet +import LeanPool.GraphMinor.GM07.Section46Fibres +import LeanPool.GraphMinor.GM07.Section46InteriorIncidences +import LeanPool.GraphMinor.GM07.Section46Valency +import Mathlib.Algebra.BigOperators.Ring.Finset + +/-! +# The boundary fibre bound in VII (4.6) + +The pasted endpoint pairs join the preimages of a seam vertex. Each pair +contributes an interior seam incidence, and the cuff contributes two more. +Thus the fibre has at most the valency minus one points. The valency bound +from (2.4) then gives the denominator used to choose `l(z)`, on page 225. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +universe u + +private theorem endpoint_pair_card {S : Type u} [TopologicalSpace S] + (N : Net S) (v : S) : + Nat.card {p : Fin N.r × Bool // + N.φ (N.f p.1 (if p.2 then 1 else 0)) = v} = + (N.F₁ v).card + 2 * (N.F₂ v).card := by + classical + rw [Nat.card_eq_fintype_card, Fintype.card_subtype] + rw [Finset.card_eq_sum_ones, Finset.sum_filter] + rw [Fintype.sum_prod_type] + have hlocal : ∀ i : Fin N.r, + (∑ b : Bool, if N.φ (N.f i (if b then 1 else 0)) = v then 1 else 0) = + (if i ∈ N.F₁ v then 1 else 0) + 2 * (if i ∈ N.F₂ v then 1 else 0) := by + intro i + rw [Fintype.sum_bool] + by_cases h0 : N.φ (N.f i 0) = v <;> + by_cases h1 : N.φ (N.f i 1) = v <;> + simp [Net.mem_F₁_iff, Net.mem_F₂_iff, h0, h1] + simp_rw [hlocal] + rw [Finset.sum_add_distrib, ← Finset.mul_sum] + simp + +/-- The boundary fibre estimate in VII (4.6), page 225, before applying +(2.4). The two cuff incidences are included in `vertexValency`. -/ +theorem Net.fibre_ncard_add_one_le_valency {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {J : Drawing S} + (hJ : N.IsSeamGraphFor J) {z : S} (hz : z ∈ J.V) (hzbd : z ∈ bd S) : + (N.φ ⁻¹' {z}).ncard + 1 ≤ vertexValency J z := by + have hf := N.fibre_card_le_endpoint_pairs (hJ.2.2 ▸ hz) + rw [endpoint_pair_card] at hf + have hd := N.interior_valency_add_two_le hS hJ hz hzbd + omega + +/-- A boundary point outside the seam vertex set has a singleton fibre, +as used in VII (4.6), page 225. -/ +theorem Net.fibre_ncard_eq_one_of_notMem_seamV {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {z : S} + (hzbd : z ∈ bd S) (hzV : z ∉ N.seamV) : + (N.φ ⁻¹' {z}).ncard = 1 := by + have : T2Space S := hS.2.1 + have hf : ∀ i t, N.φ (N.f i t) ≠ z := by + intro i t heq + rcases unitInterval_eq_zero_or_one_or_mem_Ioo t with rfl | rfl | ht + · exact hzV ⟨i, .inl heq⟩ + · exact hzV ⟨i, .inr heq⟩ + · exact N.notMem_bd_of_mem_Ioo hS i ht (heq ▸ hzbd) + obtain ⟨x, hx⟩ := N.quotientMap_φ.surjective z + have hs : N.φ ⁻¹' {z} = {x} := by + apply Subset.antisymm + · intro y hy + have hclosed : ∀ i t, N.f i t ∈ ({x} : Set N.D) ↔ N.g i t ∈ ({x} : Set N.D) := by + intro i t + have hfx : N.f i t ≠ x := fun h => hf i t ((congrArg N.φ h).trans hx) + have hgx : N.g i t ≠ x := fun h => + hf i t ((N.pasting_eq i t).trans ((congrArg N.φ h).trans hx)) + simp [hfx, hgx] + exact N.mem_of_eq hclosed (hx.trans hy.symm) (mem_singleton x) + · exact singleton_subset_iff.mpr hx + rw [hs, ncard_singleton] + +/-- The uniform boundary fibre bound on page 225 of VII (4.6), obtained +from (2.4). This includes boundary points outside the seam vertex set. -/ +theorem Net.boundary_fibre_ncard_bound_4_6 {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {a b c : ℕ} + (habc : 1 < 2 * a + b + c) (hmodel : Nonempty (S ≃ₜ SurfaceModel a b c)) + {G J : Drawing S} (hG : G.IsProper) (hmin : N.IsMinimalFor G) + (hJ : N.IsSeamGraphFor J) {z : S} (hzbd : z ∈ bd S) : + (N.φ ⁻¹' {z}).ncard ≤ 6 * (2 * a + b + c - 1) := by + by_cases hzV : z ∈ J.V + · have hf := N.fibre_ncard_add_one_le_valency hS hJ hzV hzbd + have hd := seam_vertexValency_bound_4_6 hS habc hmodel hG hmin hJ hzV + omega + · have hz : z ∉ N.seamV := fun h => hzV (hJ.2.2 ▸ h) + rw [N.fibre_ncard_eq_one_of_notMem_seamV hS hzbd hz] + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46Fibres.lean b/LeanPool/GraphMinor/GM07/Section46Fibres.lean new file mode 100644 index 0000000000..a4054e8ffa --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46Fibres.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.GM07.MinimalNet +import LeanPool.GraphMinor.GM07.Section46FibreCount + +/-! +# Endpoint identifications in a seam vertex fibre + +The fibre over a seam vertex is joined by the pasted endpoint pairs. +We restrict the defining equivalence relation of the net to this fibre, +then count its points by its pairs. This supplies the finite count used +on page 225 in the proof of VII (4.6). +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +universe u + +/-- Each seam-vertex fibre has at most one more point than its pasted +endpoint pairs, as used in the fibre count of VII (4.6), page 225. -/ +theorem Net.fibre_card_le_endpoint_pairs {S : Type u} [TopologicalSpace S] + (N : Net S) {z : S} (hz : z ∈ N.seamV) : + (N.φ ⁻¹' {z}).ncard ≤ + Nat.card {p : Fin N.r × Bool // + N.φ (N.f p.1 (if p.2 then 1 else 0)) = z} + 1 := by + classical + let X := N.φ ⁻¹' {z} + let I := {p : Fin N.r × Bool // + N.φ (N.f p.1 (if p.2 then 1 else 0)) = z} + let f : I → X := fun p => ⟨N.f p.1.1 (if p.1.2 then 1 else 0), p.2⟩ + let g : I → X := fun p => ⟨N.g p.1.1 (if p.1.2 then 1 else 0), + (N.pasting_eq _ _).symm.trans p.2⟩ + have hfin : X.Finite := N.finite_fiber z + have : Finite X := hfin.to_subtype + have hne : Nonempty X := by + obtain ⟨x, hx⟩ := N.quotientMap_φ.surjective z + exact ⟨⟨x, hx⟩⟩ + have := hne + let R : N.D → N.D → Prop := fun a b => + ∃ (i : Fin N.r) (t : unitInterval), a = N.f i t ∧ b = N.g i t + let R' : X → X → Prop := fun a b => ∃ i, a = f i ∧ b = g i + have hlift : ∀ x y, Relation.EqvGen R x y → + ∀ hx : N.φ x = z, ∀ hy : N.φ y = z, + Relation.EqvGen R' ⟨x, hx⟩ ⟨y, hy⟩ := by + intro x y h + induction h with + | rel x y h => + obtain ⟨i, t, rfl, rfl⟩ := h + intro hx hy + have ht : t = 0 ∨ t = 1 := by + by_cases h0 : t = 0 + · exact .inl h0 + by_cases h1 : t = 1 + · exact .inr h1 + have hti : t ∈ Ioo (0 : unitInterval) 1 := Net.mem_Ioo_of_ne h0 h1 + exact False.elim (N.notMem_seamV_of_mem_Ioo i hti (hx ▸ hz)) + rcases ht with rfl | rfl + · exact .rel _ _ ⟨⟨(i, false), hx⟩, rfl, rfl⟩ + · exact .rel _ _ ⟨⟨(i, true), hx⟩, rfl, rfl⟩ + | refl x => + intro hx hy + exact .refl _ + | symm x y _ ih => + intro hx hy + exact .symm _ _ (ih hy hx) + | trans x y z' hxy _ ih₁ ih₂ => + intro hx hz' + have hy : N.φ y = z := ((N.bd_eq_iff x y).mpr hxy).symm.trans hx + exact .trans _ _ _ (ih₁ hx hy) (ih₂ hy hz') + have hc : ∀ x y : X, Relation.EqvGen R' x y := by + intro x y + exact hlift x y ((N.bd_eq_iff x y).mp (x.2.trans y.2.symm)) x.2 y.2 + exact card_le_pairs_add_one f g hc + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46Final.lean b/LeanPool/GraphMinor/GM07/Section46Final.lean new file mode 100644 index 0000000000..1fd1f3f423 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46Final.lean @@ -0,0 +1,103 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46Universe +public import LeanPool.GraphMinor.GM07.Section46Deficient +import LeanPool.GraphMinor.GM07.Section41 +import LeanPool.GraphMinor.GM19.Section4c +import LeanPool.GraphMinor.Surface.AddCrosscap + +/-! +# VII (4.6) + +The proof of VII (4.6), pages 224 to 230. `exists_disc_reduction` gives the +disc and the set `Λ`, `Net.deficient_test_arc` gives the inequality of (4.1) +for each test arc, and `isGFeasible_of_arcs` closes the proof. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +/-- VII (4.6) for a surface in `Type`. -/ +theorem theorem_4_6_type {S : Type} [TopologicalSpace S] [T1Space S] (hS : IsSurface S) + [ConnectedSpace S] (hcuffs : 2 ≤ (cuffs S).ncard) (k : ℕ) (G H : Drawing S) + (hG : G.IsProper) (hbd : (G.V ∩ bd S).ncard ≤ 2 * k) + (hi : ∀ B : Set S, G.IsNormal B → IsIArc B → (G.V ∩ B).ncard ≤ vSurface S k → + ∃ C ∈ cuffs S, lineEnds B ⊆ C) + (hii : ∀ B : Set S, G.IsNormal B → IsOArc B → (G.V ∩ B).ncard ≤ vSurface S k → + IsNullHomotopicOArc B ∨ + ∃ C ∈ cuffs S, IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) + (hH : IsSurfaceForest H) (hbdeq : G.V ∩ bd S = H.V ∩ bd S) : IsGFeasible G H := by + obtain ⟨N, J, K, a, b, c, Gd, Hd, γ, sK, tK, l, hmin, hJ, hc, hmodel, hv, hPull, hγ, hcut, hKU, + hl, + hGdp, hFd, hbdD, hfe, hΛ⟩ := exists_disc_reduction hS hcuffs k G H hG hbd hi hii hiii hH hbdeq + apply hfe + refine isGFeasible_of_arcs N.isSurface_D N.isClosedDisc_D hGdp hFd hbdD ?_ + intro F s t C₁ C₂ hFn hF hEnds hC hne + obtain ⟨hΛc, hΛd, hΛm, hΛv⟩ := hΛ s t C₁ C₂ hC hne _ rfl + exact N.deficient_test_arc hS hcuffs hc hmodel hv hG hmin hJ hPull hbd hi hii hiii hγ sK tK hcut + hKU l hl hFn hF hEnds hC hne hΛc hΛd hΛm hΛv + +/-- Graph Minors VII, (4.6) (pages 224–230): +"(4.6) *Let $\Sigma$ be a connected surface with at least two cuffs and let $k \ge 0$ be an +integer. Let $G$ be a proper graph in $\Sigma$, with $|V(G) \cap bd(\Sigma)| \le 2k$, such that* +*(i) for every $G$-normal $I$-arc $B$ with $|V(G) \cap B| \le v(\Sigma, k)$ the ends of $B$ are in +the same cuff of $\Sigma$,* +*(ii) for every $G$-normal $O$-arc $B$ with $|V(G) \cap B| \le v(\Sigma, k)$ either $B$ is +null-homotopic, or for some cuff $C$, $B$ is null-homotopic in $\Sigma + \hat{C}$ and +$V(G) \cap C \subseteq B$, and* +*(iii) for every cuff $C$, $|V(G) \cap C| \ge 2$.* +*Let $H$ be a forest in $\Sigma$ with $V(G) \cap bd(\Sigma) = V(H) \cap bd(\Sigma)$. Then $H$ is +$G$-feasible.*" -/ +theorem theorem_4_6_proof {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) [hConn : ConnectedSpace S] + (hcuffs : 2 ≤ (cuffs S).ncard) (k : ℕ) (G H : Drawing S) + (hG : G.IsProper) (hbd_card : (G.V ∩ bd S).ncard ≤ 2 * k) + (hi : ∀ B : Set S, G.IsNormal B → IsIArc B → (G.V ∩ B).ncard ≤ vSurface S k → + ∃ C ∈ cuffs S, lineEnds B ⊆ C) + (hii : ∀ B : Set S, G.IsNormal B → IsOArc B → (G.V ∩ B).ncard ≤ vSurface S k → + IsNullHomotopicOArc B ∨ + ∃ C ∈ cuffs S, IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) + (hH : IsSurfaceForest H) (hbd_eq : G.V ∩ bd S = H.V ∩ bd S) : + IsGFeasible G H := by + obtain ⟨a, b, c, -, ⟨e⟩, -⟩ := exists_model_vSurface_two_cuffs hS hcuffs k + have hT : IsSurface (SurfaceModel a b c) := isSurface_of_homeo e hS + have : T2Space (SurfaceModel a b c) := hT.2.1 + have : ConnectedSpace (SurfaceModel a b c) := e.surjective.connectedSpace e.continuous + have hbdimg : ∀ X : Set S, (e '' X ∩ bd (SurfaceModel a b c)) = e '' (X ∩ bd S) := fun X => by + rw [← GM19.image_bd e, image_inter e.injective] + have hk := vSurface_eq_of_homeo e k + refine isGFeasible_of_map e (theorem_4_6_type hT ?_ k _ _ ?_ ?_ ?_ ?_ (hiii_map e hiii) + (IsSurfaceForest.map_homeo e hH) ?_) + · rw [cuffs_image_homeo e, ncard_image_of_injective _ (image_injective.mpr e.injective)] + exact hcuffs + · rintro x ⟨hb, y, hy, rfl⟩ + rw [← GM19.image_bd e] at hb + obtain ⟨z, hz, hzy⟩ := hb + obtain rfl := e.injective hzy + exact mem_image_of_mem e (hG ⟨hz, hy⟩) + · change (e '' G.V ∩ _).ncard ≤ _ + rw [hbdimg, ncard_image_of_injective _ e.injective] + exact hbd_card + · rw [← hk] + exact hi_map e hi + · rw [← hk] + exact hii_map e hii + · change e '' G.V ∩ _ = e '' H.V ∩ _ + rw [hbdimg, hbdimg, hbd_eq] + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46FirstEdge.lean b/LeanPool/GraphMinor/GM07/Section46FirstEdge.lean new file mode 100644 index 0000000000..68d06c9128 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46FirstEdge.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section46EdgeIncidence +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# The lifted first edge of each path + +For a path with distinct ends, its simple walk starts with a non-loop edge. +The normal net lifts that edge to a single incidence over the initial +vertex. These are the incidences counted on page 225 of VII (4.6). +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +universe u + +/-- A nontrivial path in the original graph has a first edge with a unique +lifted incidence over its initial vertex, as in VII (4.6), page 225. -/ +theorem Net.exists_lifted_first_edge {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {G J P : Drawing S} + (hJ : N.IsSeamGraphFor J) (hnorm : G.IsNormal J.U) + (hPG : P.IsSubdrawing G) {a b : S} (hab : a ≠ b) + (hP : P.IsPathBetween a b) : + ∃ e ∈ P.E, ∃ a' : N.D, N.φ a' = a ∧ a' ∈ closure (N.φ ⁻¹' e) ∧ + ∀ x ∈ closure (N.φ ⁻¹' e), N.φ x = a → x = a' := by + obtain ⟨W, hsimple, _, hPE⟩ := hP + cases W with + | nil hv => exact (hab rfl).elim + | @cons a w b e hl W => + have heP : e ∈ P.E := by + rw [hPE] + exact List.mem_cons_self + have hne : a ≠ w := fun h => + (List.nodup_cons.mp hsimple).1 (h ▸ W.start_mem_support) + have hlink : G.toGraph.IsLink e a w := (hPG.isLink_iff heP).mp hl + have heG : e ∈ G.E := hPG.2 heP + have hcap : closure e ∩ G.V = {a, w} := hlink.2.2.2 + have hline : IsLineWithEnds (closure e) a w := by + rcases G.edge_cond e heG with ⟨u, v, _, huv, hL⟩ | ⟨u, hu, _⟩ + · have hpair : ({u, v} : Set S) = {a, w} := huv.symm.trans hcap + rcases pair_eq_pair_iff.mp hpair with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hL + · exact hL.symm + · have hau : a = u := by + have ha : a ∈ ({u} : Set S) := hu ▸ (hcap ▸ mem_insert a {w}) + exact ha + have hwu : w = u := by + have hw : w ∈ ({u} : Set S) := hu ▸ (hcap ▸ mem_insert_of_mem a (mem_singleton w)) + exact hw + exact (hne (hau.trans hwu.symm)).elim + obtain ⟨a', ha', ha'e, huniq⟩ := + N.exists_unique_lifted_edge_end hS hJ hnorm heG hcap hline + exact ⟨e, heP, a', ha', ha'e, huniq⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46InteriorIncidences.lean b/LeanPool/GraphMinor/GM07/Section46InteriorIncidences.lean new file mode 100644 index 0000000000..de082382db --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46InteriorIncidences.lean @@ -0,0 +1,133 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.GM07.Section2MinVal +import LeanPool.GraphMinor.GM07.Section46CuffIncidences + +/-! +# Interior and cuff incidences at a seam vertex + +On page 225 of VII (4.6), each pasted endpoint pair contributes one +interior seam incidence. The cuff contributes two further incidences. +We count the non-loop and loop edges separately, so loops count twice. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +universe u + +/-- The interior seam incidences and the two cuff incidences in the +boundary valency count of VII (4.6), page 225. -/ +theorem Net.interior_valency_add_two_le {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {J : Drawing S} + (hJ : N.IsSeamGraphFor J) {v : S} (hvV : v ∈ J.V) (hvbd : v ∈ bd S) : + (N.F₁ v).card + 2 * (N.F₂ v).card + 2 ≤ vertexValency J v := by + classical + have : T2Space S := hS.2.1 + let S₂ := {e ∈ J.E | J.VertexIncident v e ∧ (tilde e).ncard = 2} + let S₁ := {e ∈ J.E | J.VertexIncident v e ∧ (tilde e).ncard = 1} + let A := N.interiorSeamEdge '' (N.F₁ v : Set (Fin N.r)) + let B := N.interiorSeamEdge '' (N.F₂ v : Set (Fin N.r)) + have hf₂ : S₂.Finite := J.finite_edges.subset fun e he => he.1 + have hf₁ : S₁.Finite := J.finite_edges.subset fun e he => he.1 + have hA : A ⊆ S₂ := by + rintro _ ⟨i, hi, rfl⟩ + rw [ Finset.mem_coe, mem_F₁_iff ] at hi + have heE : N.interiorSeamEdge i ∈ J.E := N.e_int_mem_E hJ i + have htilde : tilde (N.interiorSeamEdge i) = {N.φ (N.f i 0), N.φ (N.f i 1)} + := N.tilde_e_int hJ i + rcases hi with ⟨h0, hne⟩ | ⟨hne, h1⟩ + · have hvV : v ∈ J.V := hJ.2.2 ▸ ⟨i, Or.inl h0⟩ + have hv_tilde : v ∈ tilde (N.interiorSeamEdge i) := htilde ▸ Or.inl h0.symm + refine ⟨heE, (vertexIncident_iff_mem_tilde J hvV heE).mpr hv_tilde, ?_⟩ + rw [htilde, h0, ncard_pair hne.symm] + · have hvV : v ∈ J.V := hJ.2.2 ▸ ⟨i, Or.inr h1⟩ + have hv_tilde : v ∈ tilde (N.interiorSeamEdge i) := htilde ▸ Or.inr h1.symm + refine ⟨heE, (vertexIncident_iff_mem_tilde J hvV heE).mpr hv_tilde, ?_⟩ + rw [htilde, h1, ncard_pair hne] + have hB : B ⊆ S₁ := by + rintro _ ⟨i, hi, rfl⟩ + rw [ Finset.mem_coe, mem_F₂_iff ] at hi + rcases hi with ⟨h0, h1⟩ + have heE : N.interiorSeamEdge i ∈ J.E := N.e_int_mem_E hJ i + have htilde : tilde (N.interiorSeamEdge i) = {v} := by + rw [N.tilde_e_int hJ i, h0, h1, pair_eq_singleton] + have hvV : v ∈ J.V := hJ.2.2 ▸ ⟨i, Or.inl h0⟩ + have hv_tilde : v ∈ tilde (N.interiorSeamEdge i) := htilde ▸ rfl + refine ⟨heE, (vertexIncident_iff_mem_tilde J hvV heE).mpr hv_tilde, ?_⟩ + rw [htilde, ncard_singleton] + have hd : Disjoint S₂ S₁ := disjoint_left.mpr fun e h₂ h₁ => by + have heq := h₂.2.2.symm.trans h₁.2.2 + omega + have hAB : Disjoint A B := hd.mono hA hB + have hfA : A.Finite := hf₂.subset hA + have hfB : B.Finite := hf₁.subset hB + have hcardA : A.ncard = (N.F₁ v).card := by + dsimp [A] + rw [ncard_image_of_injective _ N.e_int_injective, ncard_coe_finset] + have hcardB : B.ncard = (N.F₂ v).card := by + dsimp [B] + rw [ncard_image_of_injective _ N.e_int_injective, ncard_coe_finset] + have hinc : ∀ e ∈ J.E, J.VertexIncident v e → e ∈ S₂ ∪ S₁ := by + intro e he hi + rcases ncard_tilde_of_mem_E J he with h₂ | h₁ + · exact .inl ⟨he, hi, h₂⟩ + · exact .inr ⟨he, hi, h₁⟩ + have hoff : ∀ e : Set S, e ⊆ bd S → e ∉ A ∪ B := by + intro e hebd he + have heimg : e ∈ range N.interiorSeamEdge := by + rcases he with ⟨i, _, hi⟩ | ⟨i, _, hi⟩ + · exact ⟨i, hi⟩ + · exact ⟨i, hi⟩ + obtain ⟨i, rfl⟩ := heimg + let t : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht : t ∈ Ioo (0 : unitInterval) 1 := by + constructor <;> change (_ : ℝ) < _ <;> norm_num [t] + have hx : N.interiorSeamCurve i t ∈ N.interiorSeamEdge i := ⟨t, ht, rfl⟩ + exact disjoint_left.mp (N.disjoint_e_int_bd hS i) hx (hebd hx) + have hbase : A ∪ B ⊆ S₂ ∪ S₁ := union_subset_union hA hB + have hcardAB : (A ∪ B).ncard = (N.F₁ v).card + (N.F₂ v).card := by + rw [ncard_union_eq hAB hfA hfB, hcardA, hcardB] + have hsum : (S₂ ∪ S₁).ncard = S₂.ncard + S₁.ncard := ncard_union_eq hd hf₂ hf₁ + have hval : vertexValency J v = S₂.ncard + 2 * S₁.ncard := rfl + rcases N.exists_cuff_incident_edges hS hJ hvV hvbd with + ⟨e, he, hebd, hei, heloop⟩ | ⟨e₁, he₁, e₂, he₂, hne, hbd₁, hbd₂, hi₁, hi₂⟩ + · have heoff := hoff e hebd + have heb : e ∉ B := fun hb => heoff (.inr hb) + have hc₁ := ncard_le_ncard + (show insert e (A ∪ B) ⊆ S₂ ∪ S₁ from insert_subset (hinc e he hei) hbase) + (hf₂.union hf₁) + have hc₂ := ncard_le_ncard + (show insert e B ⊆ S₁ from insert_subset ⟨he, hei, heloop⟩ hB) hf₁ + rw [ncard_insert_of_notMem heoff (hfA.union hfB), hcardAB, hsum] at hc₁ + rw [ncard_insert_of_notMem heb hfB, hcardB] at hc₂ + omega + · have heoff₁ := hoff e₁ hbd₁ + have heoff₂ := hoff e₂ hbd₂ + have hnot : e₁ ∉ insert e₂ (A ∪ B) := by + rintro (h | h) + · exact hne h + · exact heoff₁ h + have hc₁ := ncard_le_ncard + (show insert e₁ (insert e₂ (A ∪ B)) ⊆ S₂ ∪ S₁ from + insert_subset (hinc e₁ he₁ hi₁) (insert_subset (hinc e₂ he₂ hi₂) hbase)) + (hf₂.union hf₁) + have hc₂ := ncard_le_ncard hB hf₁ + rw [ncard_insert_of_notMem hnot ((hfA.union hfB).insert e₂), + ncard_insert_of_notMem heoff₂ (hfA.union hfB), hcardAB, hsum] at hc₁ + rw [hcardB] at hc₂ + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46IntervalSlide.lean b/LeanPool/GraphMinor/GM07/Section46IntervalSlide.lean new file mode 100644 index 0000000000..b8dceb3538 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46IntervalSlide.lean @@ -0,0 +1,255 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs + +/-! +# Sliding finitely many points along an interval + +VII (4.6), page 227, says that `H₃` can be chosen to meet the matching +only at vertices of the graph, since each edge of the matching passes +through at least `w` of them. This is a slide of at most `w` points along +each edge. Here we build the slide of an interval: an increasing +homeomorphism, fixed off an open interval, that takes a given finite set +into a given larger finite set. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology + +/-- The increasing piecewise linear map which fixes `a` and `b` and sends `x` to `y`. -/ +noncomputable def twoPiece (a b x y r : ℝ) : ℝ := + if r ≤ a then r else if r ≤ x then a + (r - a) * (y - a) / (x - a) + else if r ≤ b then y + (r - x) * (b - y) / (b - x) else r + +private theorem twoPiece_inv {a b x y : ℝ} (hax : a < x) (hxb : x < b) (hay : a < y) (hyb : y < b) + (r : ℝ) : twoPiece a b y x (twoPiece a b x y r) = r := by + have h1 : 0 < x - a := by linarith + have h2 : 0 < y - a := by linarith + have h3 : 0 < b - x := by linarith + have h4 : 0 < b - y := by linarith + unfold twoPiece + by_cases hra : r ≤ a + · simp [hra] + by_cases hrx : r ≤ x + · have hr : a < r := not_le.mp hra + have hv : a + (r - a) * (y - a) / (x - a) = a + (r - a) / (x - a) * (y - a) := by ring + have hq : 0 < (r - a) / (x - a) := div_pos (by linarith) h1 + have hq1 : (r - a) / (x - a) ≤ 1 := (div_le_one h1).mpr (by linarith) + have h5 : ¬ a + (r - a) * (y - a) / (x - a) ≤ a := by + rw [hv] + have := mul_pos hq h2 + linarith + have h6 : a + (r - a) * (y - a) / (x - a) ≤ y := by + rw [hv] + have := mul_le_of_le_one_left h2.le hq1 + linarith + simp only [hra, hrx, ite_true, ite_false, h5, h6] + field_simp + ring + by_cases hrb : r ≤ b + · have hr : x < r := not_le.mp hrx + have hv : y + (r - x) * (b - y) / (b - x) = y + (r - x) / (b - x) * (b - y) := by ring + have hq : 0 < (r - x) / (b - x) := div_pos (by linarith) h3 + have hq1 : (r - x) / (b - x) ≤ 1 := (div_le_one h3).mpr (by linarith) + have h5 : ¬ y + (r - x) * (b - y) / (b - x) ≤ a := by + rw [hv] + have := mul_pos hq h4 + linarith + have h6 : ¬ y + (r - x) * (b - y) / (b - x) ≤ y := by + rw [hv] + have := mul_pos hq h4 + linarith + have h7 : y + (r - x) * (b - y) / (b - x) ≤ b := by + rw [hv] + have := mul_le_of_le_one_left h4.le hq1 + linarith + simp only [hra, hrx, hrb, ite_true, ite_false, h5, h6, h7] + field_simp + ring + · have hr : b < r := not_le.mp hrb + have h5 : ¬ r ≤ a := hra + have h6 : ¬ r ≤ y := by linarith + simp only [hra, hrx, hrb, ite_false, h6] + +private theorem continuous_twoPiece {a b x y : ℝ} (hax : a < x) (hxb : x < b) (hay : a < y) + (hyb : y < b) : Continuous (twoPiece a b x y) := by + have h1 : (x - a) ≠ 0 := by linarith + have h3 : (b - x) ≠ 0 := by linarith + unfold twoPiece + refine Continuous.if_le continuous_id ?_ continuous_id continuous_const ?_ + · refine Continuous.if_le (by fun_prop) ?_ continuous_id continuous_const ?_ + · refine Continuous.if_le (by fun_prop) continuous_id continuous_id continuous_const ?_ + intro r hr + subst hr + field_simp + ring + · intro r hr + subst hr + have hb : r ≤ b := hxb.le + simp only [hb, ite_true] + field_simp + ring + · intro r hr + subst hr + have : r ≤ x := hax.le + simp only [this, ite_true] + field_simp + ring + +/-- The two-piece homeomorphism of the line. -/ +theorem exists_twoPiece_homeo {a b x y : ℝ} (hax : a < x) (hxb : x < b) (hay : a < y) + (hyb : y < b) : + ∃ σ : ℝ ≃ₜ ℝ, StrictMono σ ∧ (∀ r, r ∉ Ioo a b → σ r = r) ∧ σ x = y := by + have hab : a < b := hax.trans hxb + let σ : ℝ ≃ₜ ℝ := + { toFun := twoPiece a b x y + invFun := twoPiece a b y x + left_inv := twoPiece_inv hax hxb hay hyb + right_inv := twoPiece_inv hay hyb hax hxb + continuous_toFun := continuous_twoPiece hax hxb hay hyb + continuous_invFun := continuous_twoPiece hay hyb hax hxb } + have hfix : ∀ r, r ∉ Ioo a b → σ r = r := by + intro r hr + change twoPiece a b x y r = r + unfold twoPiece + by_cases hra : r ≤ a + · simp [hra] + · have hrb : b ≤ r := by + by_contra h + exact hr ⟨not_le.mp hra, not_le.mp h⟩ + have hrx : ¬ r ≤ x := by linarith + by_cases hrb' : r ≤ b + · have hreq : r = b := le_antisymm hrb' hrb + subst hreq + simp only [hra, hrx, ite_false, ite_true, le_refl] + have : r - x ≠ 0 := by linarith + field_simp + ring + · simp [hra, hrx, hrb'] + have hxy : σ x = y := by + change twoPiece a b x y x = y + unfold twoPiece + have h1 : ¬ x ≤ a := by linarith + have h2 : x - a ≠ 0 := by linarith + simp only [h1, ite_false, le_refl, ite_true] + field_simp + ring + refine ⟨σ, ?_, hfix, hxy⟩ + rcases σ.continuous.strictMono_of_inj σ.injective with h | h + · exact h + · have := h hab + rw [hfix a (fun h => lt_irrefl _ h.1), hfix b (fun h => lt_irrefl _ h.2)] at this + linarith + +/-- A slide between two sorted lists of the same length. -/ +theorem exists_slide_lists : ∀ (n : ℕ) (l l' : List ℝ) (a b : ℝ), l.length = n → + l.length = l'.length → l.Pairwise (· < ·) → l'.Pairwise (· < ·) → + (∀ x ∈ l, x ∈ Ioo a b) → (∀ x ∈ l', x ∈ Ioo a b) → + ∃ σ : ℝ ≃ₜ ℝ, StrictMono σ ∧ (∀ r, r ∉ Ioo a b → σ r = r) ∧ l.map σ = l' := by + intro n + induction n with + | zero => + intro l l' a b hn hlen _ _ _ _ + have h1 : l = [] := List.length_eq_zero_iff.mp hn + have h2 : l' = [] := List.length_eq_zero_iff.mp (hlen ▸ hn) + subst h1 h2 + exact ⟨Homeomorph.refl ℝ, strictMono_id, fun _ _ => rfl, rfl⟩ + | succ n ih => + intro l l' a b hn hlen hl hl' hin hin' + obtain _ | ⟨x, xs⟩ := l + · simp at hn + obtain _ | ⟨y, ys⟩ := l' + · simp at hlen + rw [List.pairwise_cons] at hl hl' + have hx := hin x (by simp) + have hy := hin' y (by simp) + obtain ⟨τ, hτm, hτf, hτx⟩ := exists_twoPiece_homeo hx.1 hx.2 hy.1 hy.2 + have hτb : τ b = b := hτf b (fun h => lt_irrefl _ h.2) + have hpw : (xs.map τ).Pairwise (· < ·) := by + rw [List.pairwise_map] + exact hl.2.imp fun h => hτm h + obtain ⟨ρ, hρm, hρf, hρmap⟩ := ih (xs.map τ) ys y b (by simpa using hn) + (by simpa using hlen) hpw hl'.2 (by + intro z hz + obtain ⟨z₀, hz₀, rfl⟩ := List.mem_map.mp hz + have h1 := hl.1 z₀ hz₀ + have h2 := (hin z₀ (by simp [hz₀])).2 + exact ⟨hτx ▸ hτm h1, hτb ▸ hτm h2⟩) (by + intro z hz + exact ⟨hl'.1 z hz, (hin' z (by simp [hz])).2⟩) + refine ⟨τ.trans ρ, ?_, ?_, ?_⟩ + · exact hρm.comp hτm + · intro r hr + have h1 : τ r = r := hτf r hr + have h2 : r ∉ Ioo y b := fun h => hr ⟨hy.1.trans h.1, h.2⟩ + change ρ (τ r) = r + rw [h1, hρf r h2] + · have h1 : ρ y = y := hρf y (fun h => lt_irrefl _ h.1) + simp only [List.map_cons, Homeomorph.trans_apply, hτx, h1] + rw [← hρmap] + simp [List.map_map, Function.comp_def] + +/-- A slide of the line, fixed off `(a, b)`, that takes a finite subset of `(a, b)` into a larger +finite subset. -/ +theorem exists_slide_finset {a b : ℝ} {X Y : Finset ℝ} (hX : ↑X ⊆ Ioo a b) (hY : ↑Y ⊆ Ioo a b) + (hcard : X.card ≤ Y.card) : + ∃ σ : ℝ ≃ₜ ℝ, StrictMono σ ∧ (∀ r, r ∉ Ioo a b → σ r = r) ∧ ∀ x ∈ X, σ x ∈ Y := by + obtain ⟨Y', hsub, hc⟩ := Finset.exists_subset_card_eq hcard + obtain ⟨σ, hm, hf, hmap⟩ := exists_slide_lists _ (X.sort (· ≤ ·)) (Y'.sort (· ≤ ·)) a b rfl + (by simp [hc]) (Finset.sortedLT_sort X).pairwise (Finset.sortedLT_sort Y').pairwise + (fun x hx => hX (by simpa using hx)) (fun x hx => hY (hsub (by simpa using hx))) + refine ⟨σ, hm, hf, fun x hx => hsub ?_⟩ + have hmem : σ x ∈ (X.sort (· ≤ ·)).map σ := List.mem_map.mpr ⟨x, by simpa using hx, rfl⟩ + rw [hmap] at hmem + simpa using hmem + +/-- The slide of the unit interval. -/ +theorem exists_interval_slide {a b : unitInterval} {X Y : Set unitInterval} (hXf : X.Finite) + (hYf : Y.Finite) (hX : X ⊆ Ioo a b) (hY : Y ⊆ Ioo a b) (hcard : X.ncard ≤ Y.ncard) : + ∃ σ : unitInterval ≃ₜ unitInterval, (∀ r, r ∉ Ioo a b → σ r = r) ∧ ∀ x ∈ X, σ x ∈ Y := by + classical + let X' : Finset ℝ := hXf.toFinset.image Subtype.val + let Y' : Finset ℝ := hYf.toFinset.image Subtype.val + have hXc : X'.card = X.ncard := by + rw [Finset.card_image_of_injective _ Subtype.val_injective, ncard_eq_toFinset_card _ hXf] + have hYc : Y'.card = Y.ncard := by + rw [Finset.card_image_of_injective _ Subtype.val_injective, ncard_eq_toFinset_card _ hYf] + obtain ⟨σ, hm, hf, hmap⟩ := exists_slide_finset (X := X') (Y := Y') (a := a.1) (b := b.1) + (by + intro r hr + obtain ⟨x, hx, rfl⟩ := Finset.mem_image.mp hr + exact hX (hXf.mem_toFinset.mp hx)) + (by + intro r hr + obtain ⟨x, hx, rfl⟩ := Finset.mem_image.mp hr + exact hY (hYf.mem_toFinset.mp hx)) + (by omega) + have h0 : σ 0 = 0 := hf 0 (fun h => not_lt_of_ge a.2.1 h.1) + have h1 : σ 1 = 1 := hf 1 (fun h => not_lt_of_ge b.2.2 h.2) + have hiff : ∀ r : ℝ, r ∈ Icc (0 : ℝ) 1 ↔ σ r ∈ Icc (0 : ℝ) 1 := by + intro r + rw [mem_Icc, mem_Icc, ← h0, ← h1, hm.le_iff_le, hm.le_iff_le, h0, h1] + let τ : unitInterval ≃ₜ unitInterval := σ.subtype hiff + refine ⟨τ, ?_, ?_⟩ + · intro r hr + apply Subtype.ext + exact hf r.1 (fun h => hr ⟨h.1, h.2⟩) + · intro x hx + have hmem : (x : ℝ) ∈ X' := Finset.mem_image.mpr ⟨x, hXf.mem_toFinset.mpr hx, rfl⟩ + obtain ⟨y, hy, hyeq⟩ := Finset.mem_image.mp (hmap _ hmem) + have hτ : τ x = y := Subtype.ext hyeq.symm + rw [hτ] + exact hYf.mem_toFinset.mp hy + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46JPlus.lean b/LeanPool/GraphMinor/GM07/Section46JPlus.lean new file mode 100644 index 0000000000..72ac26395b --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46JPlus.lean @@ -0,0 +1,111 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM11.ArcDrawings +import LeanPool.GraphMinor.GM11.DrawingOps + +/-! +# Constructing the refined seam graph `J⁺` + +VII (4.6), page 225, keeps the point set of the seam graph and adds `W` +to its vertices. A finite enlargement of a drawing's vertex set is again +a drawing: mark each closed edge at the new vertices, then glue these +finite line or circle drawings at their shared old vertices. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +universe u + +/-- A finite enlargement of the vertex set gives an actual drawing on the +same point set. This constructs `J⁺` in VII (4.6), page 225. -/ +theorem exists_drawing_with_more_vertices {S : Type u} [TopologicalSpace S] + [T2Space S] (D : Drawing S) {A : Set S} (hA : A.Finite) + (hVA : D.V ⊆ A) (hAU : A ⊆ D.U) : + ∃ D' : Drawing S, D'.U = D.U ∧ D'.V = A := by + classical + have key : ∀ T : Finset (Set S), (∀ e ∈ T, e ∈ D.E) → + ∃ C : Drawing S, C.U = A ∪ ⋃ e ∈ T, closure e ∧ C.V = A := by + intro T + induction T using Finset.induction_on with + | empty => + intro _ + exact ⟨pointsDrawing hA, by simp [pointsDrawing], rfl⟩ + | insert e T he ih => + intro hT + obtain ⟨C, hCU, hCV⟩ := ih fun f hf => hT f (Finset.mem_insert_of_mem hf) + have heE := hT e (Finset.mem_insert_self _ _) + let B := closure e ∩ A + have hB : B.Finite := hA.subset inter_subset_right + obtain ⟨L, hLU, hLV⟩ : ∃ L : Drawing S, L.U = closure e ∧ L.V = B := by + rcases D.edge_cond e heE with ⟨u, v, huv, hcap, hline⟩ | ⟨u, hcap, hcircle⟩ + · have hu : u ∈ closure e ∩ D.V := hcap ▸ mem_insert u {v} + have hv : v ∈ closure e ∩ D.V := hcap ▸ mem_insert_of_mem u (mem_singleton v) + exact exists_drawing_on_line _ hline huv hB + ⟨hu.1, hVA hu.2⟩ ⟨hv.1, hVA hv.2⟩ inter_subset_left le_rfl + · have hu : u ∈ closure e ∩ D.V := hcap ▸ mem_singleton u + exact exists_drawing_on_oArc hcircle hB ⟨u, hu.1, hVA hu.2⟩ inter_subset_left + have hmeet : C.U ∩ L.U ⊆ C.V ∩ L.V := by + rw [hCU, hCV, hLU, hLV] + rintro x ⟨hx | hx, hxe⟩ + · exact ⟨hx, hxe, hx⟩ + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + have hfE := hT f (Finset.mem_insert_of_mem hf) + by_cases hxA : x ∈ A + · exact ⟨hxA, hxe, hxA⟩ + · have hxV : x ∉ D.V := fun h => hxA (hVA h) + have hxf' : x ∈ f := D.closure_diff_V hfE ▸ (⟨hxf, hxV⟩ : x ∈ closure f \ D.V) + have hxe' : x ∈ e := D.closure_diff_V heE ▸ (⟨hxe, hxV⟩ : x ∈ closure e \ D.V) + exact (he ((D.edge_eq_of_mem hfE heE hxf' hxe') ▸ hf)).elim + refine ⟨C.glue L hmeet, ?_, ?_⟩ + · change C.U ∪ L.U = _ + rw [hCU, hLU] + ext x + simp only [mem_union, mem_iUnion, Finset.mem_insert, exists_prop] + constructor + · rintro ((hx | ⟨f, hf, hx⟩) | hx) + · exact .inl hx + · exact .inr ⟨f, .inr hf, hx⟩ + · exact .inr ⟨e, .inl rfl, hx⟩ + · rintro (hx | ⟨f, rfl | hf, hx⟩) + · exact .inl (.inl hx) + · exact .inr hx + · exact .inl (.inr ⟨f, hf, hx⟩) + · change C.V ∪ L.V = A + rw [hCV, hLV] + exact union_eq_self_of_subset_right inter_subset_right + obtain ⟨D', hU, hV⟩ := key D.finite_edges.toFinset fun e he => D.finite_edges.mem_toFinset.mp he + refine ⟨D', ?_, hV⟩ + rw [hU] + apply Subset.antisymm + · rintro x (hx | hx) + · exact hAU hx + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact D.closure_subset_U (D.finite_edges.mem_toFinset.mp he) hxe + · intro x hx + rw [D.U_eq] at hx + rcases hx with hx | hx + · exact .inl (hVA hx) + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact .inr (mem_iUnion₂.mpr ⟨e, D.finite_edges.mem_toFinset.mpr he, hxe⟩) + +/-- The graph `(U(J), V(J) ∪ W)` of VII (4.6), page 225, exists as a drawing. -/ +theorem exists_J_plus {S : Type u} [TopologicalSpace S] [T2Space S] + (J : Drawing S) {W : Set S} (hW : W.Finite) (hWU : W ⊆ J.U) : + ∃ J' : Drawing S, J'.U = J.U ∧ J'.V = J.V ∪ W := + exists_drawing_with_more_vertices J (J.finite_V.union hW) subset_union_left + (union_subset J.V_subset_U hWU) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46LContactBounds.lean b/LeanPool/GraphMinor/GM07/Section46LContactBounds.lean new file mode 100644 index 0000000000..ff3d63bd5f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46LContactBounds.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46SeamPartsDefs +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46SplitEdges +import LeanPool.GraphMinor.GM07.Section46EdgeSegments + +/-! +# Vertex contacts on the retained edges + +For VII (4.6), page 226, an edge of `L` is short or linking. +A short edge has at most `w + 2μ + 1` contacts. A linking edge has +exactly `μ + 1` contacts on its closure. Central edges are excluded +by the definition of `L`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +/-- The contact bound for every edge of `L`, in VII (4.6), page 226. -/ +theorem L_edge_contact_bound {S : Type*} [TopologicalSpace S] [T2Space S] + {G J J' L : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (s t : longSeamEdges G J μ w → unitInterval) + (W : longSeamEdges G J μ w → Set S) + (hcuts : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)}) + (hleft : ∀ e, (γ e.1 '' Iic (s e) ∩ G.V).ncard = μ + 1) + (hright : ∀ e, (γ e.1 '' Ici (t e) ∩ G.V).ncard = μ + 1) + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ ⋃ e, W e) + (hLE : L.E = forestSeamEdges J' (centralEdges G J μ w γ s t)) : + ∀ f ∈ L.E, (closure f ∩ G.V).ncard ≤ w + 2 * μ + 1 := by + have hE := J_plus_edges hγ s t W hcuts hU hV + intro f hf + rw [hLE] at hf + have hfNew := hf.1 + rw [hE] at hfNew + rcases hfNew with hshort | hpieces + · exact shortSeamEdge_ncard_le hshort + · obtain ⟨e, he⟩ := mem_iUnion.mp hpieces + have hc := hcuts e + rcases he with rfl | rfl | rfl + · have hIcc : Icc (0 : unitInterval) (s e) = Iic (s e) := by ext x; simp + rw [closure_image_Ioo_eq_Icc hγ e.2.1 hc.1.1 (.inr hc.1.2), hIcc, hleft e] + omega + · exact (hf.2.1 ⟨e, rfl⟩).elim + · have hIcc : Icc (t e) (1 : unitInterval) = Ici (t e) := by + ext x + exact ⟨fun h => h.1, fun h => ⟨h, le_top⟩⟩ + rw [closure_image_Ioo_eq_Icc hγ e.2.1 hc.2.1.2 (.inl hc.2.1.1), hIcc, hright e] + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46LCoverage.lean b/LeanPool/GraphMinor/GM07/Section46LCoverage.lean new file mode 100644 index 0000000000..50372a9f7a --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46LCoverage.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46SeamPartsDefs +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section2MinVal +import LeanPool.GraphMinor.GM07.Section46OldVertexCoverage +import LeanPool.GraphMinor.GM07.Section46RetainedLinking +import LeanPool.GraphMinor.GM07.Section46EdgeSegments + +/-! +# Every vertex of `L` is on a retained edge + +Each old seam vertex is incident with a pasted seam edge, and retains +an incident short or linking edge. Each new vertex `W(e)` is an end +of a linking edge. Hence `L` has no isolated vertices, the coverage +needed for the contact count and cutting construction on page 226 +of VII (4.6). +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +/-- The graph `L` of VII (4.6), page 226, has no isolated vertices. -/ +theorem hasNoIsolatedVertices_L {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {G J J' L : Drawing S} + (hJ : N.IsSeamGraphFor J) {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (s t : longSeamEdges G J μ w → unitInterval) + (W : longSeamEdges G J μ w → Set S) + (hcuts : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)}) + (hsmall : (G.V ∩ bd S).ncard < 2 * μ + w + 2) + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ ⋃ e, W e) + (hLV : L.V = J'.V) (hLE : L.E = forestSeamEdges J' (centralEdges G J μ w γ s t)) : + HasNoIsolatedVertices L := by + have : T2Space S := hS.2.1 + intro v hvL + have hv : v ∈ J.V ∪ ⋃ e, W e := by rw [← hV, ← hLV]; exact hvL + have hex : ∃ f ∈ forestSeamEdges J' (centralEdges G J μ w γ s t), v ∈ closure f := by + rcases hv with hvold | hvnew + · have hvseam : v ∈ N.seamV := by rw [← hJ.2.2]; exact hvold + obtain ⟨i, hi⟩ := hvseam + have he := N.e_int_mem_E hJ i + have hcap := (N.e_int_isLink hJ i).2.2.2 + have hvpair : v ∈ ({N.φ (N.f i 0), N.φ (N.f i 1)} : Set S) := by + rcases hi with h | h + · exact .inl h.symm + · exact .inr h.symm + have hvcl : v ∈ closure (N.interiorSeamEdge i) := (hcap ▸ hvpair : v ∈ closure + (N.interiorSeamEdge i) ∩ J.V).1 + exact exists_retained_edge_at_old_vertex hS N hJ hγ s t W hcuts hsmall hU hV + hvold he (N.disjoint_e_int_bd hS i) hvcl + · obtain ⟨e, hve⟩ := mem_iUnion.mp hvnew + have hc := hcuts e + rw [hc.2.2.2] at hve + rcases hve with rfl | rfl + · refine ⟨γ e.1 '' Ioo 0 (s e), + linking_edge_mem_forestSeamEdges hS N hJ hγ s t W hcuts hsmall hU hV (.inl ⟨e, rfl⟩), ?_⟩ + rw [closure_image_Ioo_eq_Icc hγ e.2.1 hc.1.1 (.inr hc.1.2)] + exact ⟨s e, ⟨hc.1.1.le, le_rfl⟩, rfl⟩ + · refine ⟨γ e.1 '' Ioo (t e) 1, + linking_edge_mem_forestSeamEdges hS N hJ hγ s t W hcuts hsmall hU hV (.inr ⟨e, rfl⟩), ?_⟩ + rw [closure_image_Ioo_eq_Icc hγ e.2.1 hc.2.1.2 (.inl hc.2.1.1)] + exact ⟨t e, ⟨le_rfl, hc.2.1.2.le⟩, rfl⟩ + obtain ⟨f, hf, hvcl⟩ := hex + have hfL : f ∈ L.E := by rw [hLE]; exact hf + exact ⟨f, hfL, hvL, .inl hfL, hvcl⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46Lambda.lean b/LeanPool/GraphMinor/GM07/Section46Lambda.lean new file mode 100644 index 0000000000..9062688330 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46Lambda.lean @@ -0,0 +1,149 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Open +public import LeanPool.GraphMinor.GM07.Section4 +import LeanPool.GraphMinor.GM07.Section41 +import LeanPool.GraphMinor.GM07.Section46PsiFibres +import LeanPool.GraphMinor.GM07.Section46CentralLift + +/-! +# The bound on `Λ` in VII (4.6) + +Page 228: "We claim that `|Λ| ≤ w + k`." Two vertices of `λ ∈ Λ` lie on the +boundary of the disc, one on each side of the test arc. They are not isolated, +so their images lie in the part of `U(θ⁻¹(H))` that claim (1) controls. That +part has at most `2w + 2k` points over it. The text speaks of each `d ∈ λ`; +members of `λ` may be inside the disc, so we use one member on each side. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM06 + +variable {S' D : Type} [TopologicalSpace S'] [TopologicalSpace D] + +/-- A vertex of a component with a second vertex is on an edge of the whole graph. -/ +theorem exists_edge_of_component {Γ C : Drawing D} (hC : IsGraphComponent C.toGraph Γ.toGraph) + {x y : D} (hx : x ∈ C.V) (hy : y ∈ C.V) (hne : x ≠ y) : ∃ e ∈ Γ.E, x ∈ closure e := by + obtain ⟨W⟩ := hC.2.1.2 x hx y hy + cases W with + | nil _ => exact (hne rfl).elim + | @cons _ v _ e hl _ => + have hl' := hl.mono hC.1 + exact ⟨e, hl'.1, (hl'.2.2.2.symm.subset (by simp)).1⟩ + +/-- Page 228: a vertex on `bd(Δ)` of a component of `φ⁻¹(H)` with a second vertex lies over the part +of `U(θ⁻¹(H))` that claim (1) controls. -/ +theorem image_mem_of_component {K' H' : Drawing S'} {ψ : D → S'} {Hd C : Drawing D} + (hψ : IsCutAlongGraph K' D ψ) (hp : IsPullbackDrawing ψ H' Hd) + {T : Set S'} (hTc : IsClosed T) (hT : ∀ e' ∈ H'.E, closure e' ⊆ T) + (hC : IsGraphComponent C.toGraph Hd.toGraph) {d d' : D} (hd : d ∈ C.V) (hd' : d' ∈ C.V) + (hne : d ≠ d') (hb : d ∈ bd D) : ψ d ∈ T ∧ (ψ d ∈ K'.U ∨ ψ d ∈ bd S') := by + obtain ⟨e, he, hde⟩ := exists_edge_of_component hC hd hd' hne + have hsub : e ⊆ ψ ⁻¹' T := by + intro x hx + have hx' := he.2.1 hx + rw [hp.1, hp.2] at hx' + rcases (mem_U_iff_edge H').mp hx'.1 with h | ⟨e', he', hxe'⟩ + · exact (hx'.2 h).elim + · exact hT e' he' (subset_closure hxe') + refine ⟨closure_minimal hsub (hTc.preimage hψ.quotientMap.continuous) hde, ?_⟩ + have : d ∈ ψ ⁻¹' (bd S' ∪ K'.U) := by + rw [hψ.preimage_bd_union_U] + exact hb + exact this.symm + +private theorem ncard_preimage_le {α β : Type*} {ψ : α → β} {A : Set β} (hA : A.Finite) (n : ℕ) + (h : ∀ v ∈ A, (ψ ⁻¹' {v}).ncard ≤ n) : (ψ ⁻¹' A).ncard ≤ A.ncard * n := by + induction A, hA using Set.Finite.induction_on with + | empty => simp + | @insert a s has hs ih => + have hins : ψ ⁻¹' insert a s = ψ ⁻¹' {a} ∪ ψ ⁻¹' s := by + ext x + simp + rw [hins, ncard_insert_of_notMem has hs, add_mul, one_mul, add_comm] + exact (ncard_union_le _ _).trans + (Nat.add_le_add (h a (mem_insert a s)) (ih fun v hv => h v (mem_insert_of_mem a hv))) + +/-- `|Λ| ≤ w + k` in VII (4.6), page 228. -/ +theorem card_Lambda_le [T2Space D] {K' H' : Drawing S'} {ψ : D → S'} {Hd : Drawing D} + (hS' : IsSurface S') (hψ : IsCutAlongGraph K' D ψ) (hp : IsPullbackDrawing ψ H' Hd) + {T : Set S'} (hTc : IsClosed T) (hT : ∀ e' ∈ H'.E, closure e' ⊆ T) + {w k : ℕ} (hfK : (T ∩ K'.U).Finite) (hcK : (T ∩ K'.U).ncard ≤ w) + (hfb : (T ∩ bd S').Finite) (hcb : (T ∩ bd S').ncard ≤ 2 * k) + (hfib : ∀ v ∈ K'.U, (ψ ⁻¹' {v}).ncard ≤ 2) + {C₁ C₂ : Set D} (hC₁ : C₁ ⊆ bd D) (hC₂ : C₂ ⊆ bd D) (hdis : Disjoint C₁ C₂) (s t : D) : + {V₀ : Set D | ∃ C : Drawing D, IsGraphComponent C.toGraph Hd.toGraph ∧ V₀ = C.V ∧ + (V₀ ∩ C₁).Nonempty ∧ (V₀ ∩ C₂).Nonempty ∧ s ∉ V₀ ∧ t ∉ V₀}.ncard ≤ w + k := by + classical + set Λ : Set (Set D) := {V₀ : Set D | ∃ C : Drawing D, IsGraphComponent C.toGraph Hd.toGraph ∧ + V₀ = C.V ∧ (V₀ ∩ C₁).Nonempty ∧ (V₀ ∩ C₂).Nonempty ∧ s ∉ V₀ ∧ t ∉ V₀} with hΛ + rcases Λ.eq_empty_or_nonempty with h0 | ⟨A₀, hA₀⟩ + · rw [h0, ncard_empty] + exact Nat.zero_le _ + obtain ⟨C₀, -, -, ⟨d₀, -⟩, -⟩ := hA₀ + have : Nonempty D := ⟨d₀⟩ + let Z₁ : Set D := ψ ⁻¹' (T ∩ K'.U) + let Z₂ : Set D := ψ ⁻¹' ((T ∩ bd S') \ K'.U) + let Z : Set D := Z₁ ∪ Z₂ + have hZ₁f : Z₁.Finite := Set.Finite.preimage' hfK fun b _ => hψ.finite_fiber b + have hZ₂f : Z₂.Finite := Set.Finite.preimage' (hfb.subset sdiff_subset) fun b _ + => hψ.finite_fiber b + have hZf : Z.Finite := hZ₁f.union hZ₂f + have hZ₁c : Z₁.ncard ≤ w * 2 := + (ncard_preimage_le hfK 2 fun v hv => hfib v hv.2).trans (Nat.mul_le_mul_right 2 hcK) + have hZ₂c : Z₂.ncard ≤ 2 * k := by + have h1 : Z₂.ncard ≤ ((T ∩ bd S') \ K'.U).ncard * 1 := by + refine ncard_preimage_le (hfb.subset sdiff_subset) 1 fun v hv => ?_ + refine (Set.ncard_le_one (hψ.finite_fiber v)).mpr fun a ha b hb => ?_ + refine hψ.eq_of_eq_of_notMem hS' (ha.trans hb.symm) ?_ + rw [show ψ a = v from ha] + exact hv.2 + have h2 := ncard_le_ncard (sdiff_subset (s := T ∩ bd S') (t := K'.U)) hfb + omega + have hmem : ∀ d ∈ bd D, ψ d ∈ T ∧ (ψ d ∈ K'.U ∨ ψ d ∈ bd S') → d ∈ Z := by + rintro d - ⟨hdT, hdb⟩ + by_cases hK : ψ d ∈ K'.U + · exact .inl ⟨hdT, hK⟩ + · exact .inr ⟨⟨hdT, hdb.resolve_left hK⟩, hK⟩ + have hside : ∀ V₀ ∈ Λ, (∃ d ∈ V₀, d ∈ C₁ ∧ d ∈ Z) ∧ ∃ d ∈ V₀, d ∈ C₂ ∧ d ∈ Z := by + rintro V₀ ⟨C, hC, rfl, ⟨d₁, hd₁, hd₁C⟩, ⟨d₂, hd₂, hd₂C⟩, -⟩ + have hne : d₁ ≠ d₂ := fun h => disjoint_left.mp hdis hd₁C (h ▸ hd₂C) + exact ⟨⟨d₁, hd₁, hd₁C, hmem d₁ (hC₁ hd₁C) + (image_mem_of_component hψ hp hTc hT hC hd₁ hd₂ hne (hC₁ hd₁C))⟩, + d₂, hd₂, hd₂C, hmem d₂ (hC₂ hd₂C) + (image_mem_of_component hψ hp hTc hT hC hd₂ hd₁ hne.symm (hC₂ hd₂C))⟩ + choose! d₁ hd₁ using fun V₀ hV₀ => (hside V₀ hV₀).1 + choose! d₂ hd₂ using fun V₀ hV₀ => (hside V₀ hV₀).2 + have hcommon : ∀ {A B : Set D} {x : D}, A ∈ Λ → B ∈ Λ → x ∈ A → x ∈ B → A = B := by + rintro A B x ⟨C, hC, rfl, -⟩ ⟨C', hC', rfl, -⟩ hx hx' + exact congrArg (fun g : Graph D (Set D) => g.vertexSet) (hC.eq_of_mem_mem hC' hx hx') + have h₁ : Λ.ncard ≤ (Z ∩ C₁).ncard := by + refine ncard_le_ncard_of_injOn d₁ (fun A hA => ⟨(hd₁ A hA).2.2, (hd₁ A hA).2.1⟩) ?_ + (hZf.subset inter_subset_left) + intro A hA B hB h + exact hcommon hA hB (hd₁ A hA).1 (h ▸ (hd₁ B hB).1) + have h₂ : Λ.ncard ≤ (Z ∩ C₂).ncard := by + refine ncard_le_ncard_of_injOn d₂ (fun A hA => ⟨(hd₂ A hA).2.2, (hd₂ A hA).2.1⟩) ?_ + (hZf.subset inter_subset_left) + intro A hA B hB h + exact hcommon hA hB (hd₂ A hA).1 (h ▸ (hd₂ B hB).1) + have hdisZ : Disjoint (Z ∩ C₁) (Z ∩ C₂) := + hdis.mono inter_subset_right inter_subset_right + have hsum : (Z ∩ C₁).ncard + (Z ∩ C₂).ncard ≤ Z.ncard := by + rw [← ncard_union_eq hdisZ (hZf.subset inter_subset_left) (hZf.subset inter_subset_left)] + exact ncard_le_ncard (union_subset inter_subset_left inter_subset_left) hZf + have hZc : Z.ncard ≤ Z₁.ncard + Z₂.ncard := ncard_union_le _ _ + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46LongCutParameters.lean b/LeanPool/GraphMinor/GM07/Section46LongCutParameters.lean new file mode 100644 index 0000000000..9ea72d208c --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46LongCutParameters.lean @@ -0,0 +1,105 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46EdgeContacts +import LeanPool.GraphMinor.GM07.Section46OrderedContacts + +/-! +# The two cuts on each long seam edge + +VII (4.6), page 225, chooses two contacts `W(e)` on a long edge. We +choose them in its interval parameter. Injectivity away from the two +parameter ends gives the exact linking counts and the central lower bound, +including when the old seam edge is a loop. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +universe u + +/-- The two contacts defining `W(e)` and their counts in VII (4.6), page 225. +The left and right closed intervals each have `μ + 1` graph vertices, +and the open central interval has at least `w`. -/ +theorem exists_long_edge_cut_parameters {S : Type u} [TopologicalSpace S] + [T2Space S] {G J : Drawing S} {γ : Set S → unitInterval → S} + (hγ : EdgePar J γ) {e : Set S} (he : e ∈ J.E) {μ w : ℕ} + (hμ : 0 < μ) (hlong : 2 * μ + w + 2 ≤ (closure e ∩ G.V).ncard) : + ∃ s ∈ Ioo (0 : unitInterval) 1, ∃ t ∈ Ioo (0 : unitInterval) 1, + s < t ∧ γ e s ∈ e ∩ G.V ∧ γ e t ∈ e ∩ G.V ∧ γ e s ≠ γ e t ∧ + (γ e '' Iic s ∩ G.V).ncard = μ + 1 ∧ + (γ e '' Ici t ∩ G.V).ncard = μ + 1 ∧ + w ≤ (γ e '' Ioo s t ∩ G.V).ncard := by + let T := γ e ⁻¹' G.V + have hT := finite_edge_contact_parameters (G := G) hγ he + have hcard : 2 * μ + w + 2 ≤ T.ncard := + hlong.trans (ncard_edge_contacts_le_parameters hγ he) + obtain ⟨s, hsT, t, htT, hst, hsCount, htCount, hmidCount⟩ := + exists_ordered_contact_cuts hT hcard + have hs0 : s ≠ 0 := by + intro hs + have hsub : T ∩ Iic s ⊆ ({0} : Set unitInterval) := by + intro x hx + exact le_antisymm (hs ▸ hx.2) bot_le + have hc := ncard_le_ncard hsub (finite_singleton _) + rw [hsCount, ncard_singleton] at hc + omega + have ht1 : t ≠ 1 := by + intro ht + have hsub : T ∩ Ici t ⊆ ({1} : Set unitInterval) := by + intro x hx + exact le_antisymm le_top (ht ▸ hx.2) + have hc := ncard_le_ncard hsub (finite_singleton _) + rw [htCount, ncard_singleton] at hc + omega + have hs : s ∈ Ioo (0 : unitInterval) 1 := + ⟨unitInterval.pos_iff_ne_zero.mpr hs0, hst.trans_le le_top⟩ + have ht : t ∈ Ioo (0 : unitInterval) 1 := + ⟨bot_le.trans_lt hst, unitInterval.lt_one_iff_ne_one.mpr ht1⟩ + have hsE : γ e s ∈ e := + (congrArg (fun A => γ e s ∈ A) (hγ.image e he)).mp ⟨s, hs, rfl⟩ + have htE : γ e t ∈ e := + (congrArg (fun A => γ e t ∈ A) (hγ.image e he)).mp ⟨t, ht, rfl⟩ + have hleft : InjOn (γ e) (Iic s) := by + intro x hx y hy hxy + rcases edge_parameter_eq_or_ends hγ he hxy with h | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact h + · exact (not_le_of_gt hs.2 hy).elim + · exact (not_le_of_gt hs.2 hx).elim + have hright : InjOn (γ e) (Ici t) := by + intro x hx y hy hxy + rcases edge_parameter_eq_or_ends hγ he hxy with h | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact h + · exact (not_le_of_gt ht.1 hx).elim + · exact (not_le_of_gt ht.1 hy).elim + have himage : ∀ A : Set unitInterval, γ e '' A ∩ G.V = γ e '' (T ∩ A) := by + intro A + ext x + constructor + · rintro ⟨⟨u, hu, rfl⟩, hx⟩ + exact ⟨u, ⟨hx, hu⟩, rfl⟩ + · rintro ⟨u, ⟨hu, huA⟩, rfl⟩ + exact ⟨⟨u, huA, rfl⟩, hu⟩ + refine ⟨s, hs, t, ht, hst, ⟨hsE, hsT⟩, ⟨htE, htT⟩, + fun h => hst.ne (hγ.inj e he hs ht h), ?_, ?_, ?_⟩ + · rw [himage, (hleft.mono inter_subset_right).ncard_image] + exact hsCount + · rw [himage, (hright.mono inter_subset_right).ncard_image] + exact htCount + · have hsub : T ∩ Ioo s t ⊆ Ioo (0 : unitInterval) 1 := fun x hx => + ⟨hs.1.trans hx.2.1, hx.2.2.trans ht.2⟩ + rw [himage, ((hγ.inj e he).mono hsub).ncard_image] + exact hmidCount + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46LongEdges.lean b/LeanPool/GraphMinor/GM07/Section46LongEdges.lean new file mode 100644 index 0000000000..57955f12d2 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46LongEdges.lean @@ -0,0 +1,93 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section2MinVal +import LeanPool.GraphMinor.GM07.Section46Constants +import LeanPool.GraphMinor.Surface.Cuffs + +/-! +# Long and short seam edges in VII (4.6) + +On page 225 an edge is long when its closure meets at least `2μ + w + 2` +vertices of `G`. All other seam edges are short. The boundary vertex bound +excludes long edges on cuffs. Short edges have at most `w + 2μ + 1` contacts, +which is the bound later used for `L`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The long seam edges of VII (4.6), page 225: +“*long* if $|\bar{e} \cap V(G)| \ge 2\mu + w + 2$”. -/ +def longSeamEdges (G J : Drawing S) (μ w : ℕ) : Set (Set S) := + {e ∈ J.E | 2 * μ + w + 2 ≤ (closure e ∩ G.V).ncard} + +/-- The short edges of VII (4.6), page 225, are the seam edges which are +not long. -/ +def shortSeamEdges (G J : Drawing S) (μ w : ℕ) : Set (Set S) := + J.E \ longSeamEdges G J μ w + +/-- The short-edge contact bound used in VII (4.6), page 226. -/ +theorem shortSeamEdge_ncard_le {G J : Drawing S} {μ w : ℕ} {e : Set S} + (he : e ∈ shortSeamEdges G J μ w) : + (closure e ∩ G.V).ncard ≤ w + 2 * μ + 1 := by + have hn : ¬2 * μ + w + 2 ≤ (closure e ∩ G.V).ncard := fun h => he.2 ⟨he.1, h⟩ + omega + +/-- A seam edge with more contacts than the entire boundary has none +of its open points on the boundary, as in VII (4.6), page 225. -/ +theorem longSeamEdge_disjoint_bd_of_ncard_lt (hS : IsSurface S) (N : Net S) + {G J : Drawing S} (hJ : N.IsSeamGraphFor J) {μ w : ℕ} + (hsmall : (G.V ∩ bd S).ncard < 2 * μ + w + 2) {e : Set S} + (he : e ∈ longSeamEdges G J μ w) : Disjoint e (bd S) := by + have : T2Space S := hS.2.1 + have heJ := he.1 + rw [(N.seamGraph_edges_eq hS hJ).1] at heJ + rcases heJ with ⟨i, rfl⟩ | heB + · exact N.disjoint_e_int_bd hS i + · have hcl : closure e ⊆ bd S := + closure_minimal (heB.2.1.trans sdiff_subset) (isClosed_bd S) + have hsub : closure e ∩ G.V ⊆ G.V ∩ bd S := fun x hx => ⟨hx.2, hcl hx.1⟩ + have hcard := Set.ncard_le_ncard hsub (G.finite_V.subset inter_subset_left) + have hlong := he.2 + have hcontra : False := by omega + exact hcontra.elim + +/-- Every long seam edge is off the cuffs, as in VII (4.6), page 225. -/ +theorem longSeamEdge_disjoint_bd (hS : IsSurface S) (N : Net S) + {G J : Drawing S} (hJ : N.IsSeamGraphFor J) {a b c k : ℕ} + (hbd : (G.V ∩ bd S).ncard ≤ 2 * k) {e : Set S} + (he : e ∈ longSeamEdges G J (muModel a b c k) (wMaxModel a b c k)) : + Disjoint e (bd S) := by + have : T2Space S := hS.2.1 + have heJ := he.1 + rw [(N.seamGraph_edges_eq hS hJ).1] at heJ + rcases heJ with ⟨i, rfl⟩ | heB + · exact N.disjoint_e_int_bd hS i + · have heSub : e ⊆ bd S := heB.2.1.trans sdiff_subset + have hcl : closure e ⊆ bd S := closure_minimal heSub (isClosed_bd S) + have hsub : closure e ∩ G.V ⊆ G.V ∩ bd S := fun x hx => ⟨hx.2, hcl hx.1⟩ + have hcard := Set.ncard_le_ncard hsub (G.finite_V.subset inter_subset_left) + have hk : 2 * k ≤ muModel a b c k := by + unfold muModel + exact Nat.le_add_left _ _ + have hlong := he.2 + have hcontra : False := by omega + exact hcontra.elim + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46LongPieces.lean b/LeanPool/GraphMinor/GM07/Section46LongPieces.lean new file mode 100644 index 0000000000..d163613f71 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46LongPieces.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46LongEdges +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46EdgeSegments +import LeanPool.GraphMinor.GM07.Section46ThreePieces +import LeanPool.GraphMinor.GM07.Section46RefinedEdges +import LeanPool.GraphMinor.GM07.Section46WIntersections + +/-! +# Linking and central edges belong to `J⁺` + +The three-piece drawing on a closed long edge has the same marked vertices +there as the global drawing `J⁺`. Its three edges are therefore actual +edges of `J⁺`. This proves the division into two linking edges and one +central edge on page 225 of VII (4.6). +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +/-- The local three-edge drawing has exactly the new vertices on the +closed old edge, in VII (4.6), page 225. -/ +theorem exists_marked_long_edge_drawing {S : Type*} [TopologicalSpace S] [T2Space S] + {G J : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (W : longSeamEdges G J μ w → Set S) (hW : ∀ f, W f ⊆ f.1) + (e : longSeamEdges G J μ w) {s t : unitInterval} + (hs : s ∈ Ioo 0 1) (ht : t ∈ Ioo 0 1) (hst : s < t) + (hWe : W e = {γ e.1 s, γ e.1 t}) : + ∃ P : Drawing S, P.U = closure e.1 ∧ + P.V = (J.V ∪ ⋃ f, W f) ∩ closure e.1 ∧ + P.E = {γ e.1 '' Ioo 0 s, γ e.1 '' Ioo s t, γ e.1 '' Ioo t 1} := by + obtain ⟨P, hPU, hPV, hPE⟩ := exists_three_piece_drawing hγ e.2.1 hs ht hst + have hmarked := marked_vertices_closed_long_edge W hW e + rw [edge_parameter_old_vertices hγ e.2.1, hWe] at hmarked + have hPV' : P.V = (J.V ∪ ⋃ f, W f) ∩ closure e.1 := by + rw [hPV, hmarked] + ext x + simp only [mem_union, mem_insert_iff, mem_singleton_iff] + constructor + · rintro (((h | h) | (h | h)) | (h | h)) + · exact .inl (.inl h) + · exact .inr (.inl h) + · exact .inr (.inl h) + · exact .inr (.inr h) + · exact .inr (.inr h) + · exact .inl (.inr h) + · rintro ((h | h) | (h | h)) + · exact .inl (.inl (.inl h)) + · exact .inr (.inr h) + · exact .inl (.inl (.inr h)) + · exact .inr (.inl h) + exact ⟨P, hPU, hPV', hPE⟩ + +/-- The two linking edges and central edge of a long seam edge are edges +of `J⁺`, in VII (4.6), page 225. -/ +theorem long_edge_pieces_mem_J_plus {S : Type*} [TopologicalSpace S] [T2Space S] + {G J J' : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (W : longSeamEdges G J μ w → Set S) (hW : ∀ f, W f ⊆ f.1) + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ ⋃ f, W f) + (e : longSeamEdges G J μ w) {s t : unitInterval} + (hs : s ∈ Ioo 0 1) (ht : t ∈ Ioo 0 1) (hst : s < t) + (hWe : W e = {γ e.1 s, γ e.1 t}) : + γ e.1 '' Ioo 0 s ∈ J'.E ∧ γ e.1 '' Ioo s t ∈ J'.E ∧ γ e.1 '' Ioo t 1 ∈ J'.E := by + obtain ⟨P, hPU, hPV', hPE⟩ := exists_marked_long_edge_drawing hγ W hW e hs ht hst hWe + have hm : ∀ f ∈ P.E, f ∈ J'.E := + fun f hf => local_marked_edge_mem_refinement hU hV e.2.1 hPU hPV' hf + rw [hPE] at hm + exact ⟨hm _ (.inl rfl), hm _ (.inr (.inl rfl)), hm _ (.inr (.inr rfl))⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46MatchedId.lean b/LeanPool/GraphMinor/GM07/Section46MatchedId.lean new file mode 100644 index 0000000000..4d2db39e76 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46MatchedId.lean @@ -0,0 +1,145 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Matched +import LeanPool.GraphMinor.GM07.Section3 +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.Defs + +/-! +# Isolated vertices and homotopy + +In VII (4.6), page 227, `H₄` is `H₃` with the set `M₂` added back as +isolated vertices. Isolated vertices are not on any path to another +vertex, so adding the same isolated vertices to two homotopic forests +keeps them homotopic. `IsMatched.forestsHomotopic` gives the opposite +direction. Here is this one, for the identity map. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {X : Type u} [TopologicalSpace X] + +theorem end_mem_support {α β : Type*} {G : Graph α β} {a b : α} (W : GraphWalk G a b) : + b ∈ W.support := by + induction W with + | nil _ => simp [GraphWalk.support] + | cons _ _ ih => exact List.mem_cons_of_mem _ ih + +theorem isMatched_id {A A' : Drawing X} {B : Set X} (hsub : B ⊆ A.V) + (hoff : ∀ e ∈ A.E, Disjoint (closure e) B) (hU : A.U \ B = A'.U) (hV : A.V \ B = A'.V) + (hE : A'.E = A.E) : IsMatched A A' id B where + cont := continuous_id + inj := Function.injective_id.injOn + sub := hsub + off := hoff + image_U := by rw [image_id, hU] + image_V := by rw [image_id, hV] + image_E := by + have : image (id : X → X) = id := by + funext s + exact image_id s + rw [this, image_id, hE] + +variable [CompactSpace X] [T2Space X] [Nonempty X] + +/-- Adding the same isolated vertices to two homotopic forests keeps them homotopic. -/ +theorem ForestsHomotopic.of_matched_id {Γ₁ Γ₂ Γ₁' Γ₂' : Drawing X} {B : Set X} + (m₁ : IsMatched Γ₁ Γ₁' id B) (m₂ : IsMatched Γ₂ Γ₂' id B) (h : ForestsHomotopic Γ₁' Γ₂') + (hp₁ : Γ₁.IsProper) (hp₂ : Γ₂.IsProper) (hV : Γ₁.V ∩ bd X = Γ₂.V ∩ bd X) : + ForestsHomotopic Γ₁ Γ₂ := by + obtain ⟨-, -, f₁, f₂, -, hpaths⟩ := h + have hforget : ∀ {Γ Γ' : Drawing X}, IsMatched Γ Γ' id B → ∀ {s t : X}, s ≠ t → s ∈ Γ.V → + GraphWalk Γ.toGraph s t → s ∉ B ∧ t ∉ B := by + intro Γ Γ' m s t hne hs W + have hsB : s ∉ B := by + intro hsB + cases W with + | nil _ => exact hne rfl + | cons hl _ => + have hmem : s ∈ closure _ := (hl.2.2.2.symm.subset (by simp)).1 + exact disjoint_left.mp (m.off _ hl.1) hmem hsB + obtain ⟨-, -, -, h3, -⟩ := m.carry.walk W ⟨hs, hsB⟩ s t rfl rfl + have ht : t ∈ W.support := end_mem_support W + exact ⟨hsB, (h3 t ht).2⟩ + have hdown : ∀ {Γ Γ' : Drawing X}, IsMatched Γ Γ' id B → ∀ {s t : X}, s ∈ Γ.V \ B → + ∀ (W : GraphWalk Γ.toGraph s t), W.IsSimple → ∀ φ : Curve X, CurveTracesWalk Γ φ W → + ∃ W' : GraphWalk Γ'.toGraph s t, W'.IsSimple ∧ CurveTracesWalk Γ' φ W' := by + intro Γ Γ' m s t hs W hW φ hφ + obtain ⟨Q, h1, -, h3, h4⟩ := m.carry.walk W hs s t rfl rfl + obtain ⟨c, hc, hv⟩ := h4 φ hφ + have hceq : c = φ := ContinuousMap.ext hv + subst hceq + refine ⟨Q, ?_, hc⟩ + rw [GraphWalk.IsSimple, h1, List.map_id] + exact hW + have hup : ∀ {Γ Γ' : Drawing X}, IsMatched Γ Γ' id B → ∀ {s t : X}, s ∈ Γ.V \ B → + ∀ (W : GraphWalk Γ'.toGraph s t), W.IsSimple → + ∃ W' : GraphWalk Γ.toGraph s t, W'.IsSimple := by + intro Γ Γ' m s t hs W hW + obtain ⟨ψ, hl, -, hc⟩ := m.exists_inverse + have hsV : s ∈ Γ'.V := m.image_V ▸ ⟨s, hs, rfl⟩ + have hUsupp : ∀ z ∈ W.support, z ∈ Γ.U := by + intro z hz + have hzV : z ∈ Γ'.V := W.mem_vertexSet_of_mem_support hz + rw [← m.image_V] at hzV + obtain ⟨y, hy, rfl⟩ := hzV + exact Γ.V_subset_U hy.1 + have htU : t ∈ Γ.U := hUsupp t (end_mem_support W) + obtain ⟨Q, h1, -, h3, -⟩ := hc.walk W hsV s t (hl s (Γ.V_subset_U hs.1)) (hl t htU) + refine ⟨Q, ?_⟩ + have hmap : W.support.map ψ = W.support.map id := + List.map_congr_left fun z hz => hl z (hUsupp z hz) + rw [GraphWalk.IsSimple, h1, hmap, List.map_id] + exact hW + refine ⟨hp₁, hp₂, m₁.isGraphForest_iff.mpr f₁, m₂.isGraphForest_iff.mpr f₂, hV, + fun s hs t ht hne => ?_⟩ + have hs₂ : s ∈ Γ₂.V := (hV ▸ hs : s ∈ Γ₂.V ∩ bd X).1 + have ht₂ : t ∈ Γ₂.V := (hV ▸ ht : t ∈ Γ₂.V ∩ bd X).1 + by_cases hsB : s ∈ B + · refine ⟨⟨?_, ?_⟩, ?_⟩ + · rintro ⟨P, -⟩ + exact ((hforget m₁ hne hs.1 P).1 hsB).elim + · rintro ⟨P, -⟩ + exact ((hforget m₂ hne hs₂ P).1 hsB).elim + · intro P₁ + exact ((hforget m₁ hne hs.1 P₁).1 hsB).elim + by_cases htB : t ∈ B + · refine ⟨⟨?_, ?_⟩, ?_⟩ + · rintro ⟨P, -⟩ + exact ((hforget m₁ hne hs.1 P).2 htB).elim + · rintro ⟨P, -⟩ + exact ((hforget m₂ hne hs₂ P).2 htB).elim + · intro P₁ + exact ((hforget m₁ hne hs.1 P₁).2 htB).elim + have hs₁' : s ∈ Γ₁'.V ∩ bd X := ⟨m₁.image_V ▸ ⟨s, ⟨hs.1, hsB⟩, rfl⟩, hs.2⟩ + have ht₁' : t ∈ Γ₁'.V ∩ bd X := ⟨m₁.image_V ▸ ⟨t, ⟨ht.1, htB⟩, rfl⟩, ht.2⟩ + obtain ⟨hiff, hhom⟩ := hpaths s hs₁' t ht₁' hne + refine ⟨⟨?_, ?_⟩, ?_⟩ + · rintro ⟨P, hP⟩ + obtain ⟨Q, hQ⟩ := exists_curveTracesWalk P + obtain ⟨W, hW, -⟩ := hdown m₁ ⟨hs.1, hsB⟩ P hP Q hQ + exact hup m₂ ⟨hs₂, hsB⟩ _ (hiff.mp ⟨W, hW⟩).choose_spec + · rintro ⟨P, hP⟩ + obtain ⟨Q, hQ⟩ := exists_curveTracesWalk P + obtain ⟨W, hW, -⟩ := hdown m₂ ⟨hs₂, hsB⟩ P hP Q hQ + exact hup m₁ ⟨hs.1, hsB⟩ _ (hiff.mpr ⟨W, hW⟩).choose_spec + · intro P₁ P₂ φ₁ φ₂ h₁ h₂ t₁ t₂ + obtain ⟨W₁, hW₁, c₁⟩ := hdown m₁ ⟨hs.1, hsB⟩ P₁ h₁ φ₁ t₁ + obtain ⟨W₂, hW₂, c₂⟩ := hdown m₂ ⟨hs₂, hsB⟩ P₂ h₂ φ₂ t₂ + exact hhom W₁ W₂ φ₁ φ₂ hW₁ hW₂ c₁ c₂ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46Matching.lean b/LeanPool/GraphMinor/GM07/Section46Matching.lean new file mode 100644 index 0000000000..95f777c3df --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46Matching.lean @@ -0,0 +1,181 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.PullForest +import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.GM07.NetExists + +/-! +# The lifted matching in VII (4.6) + +On page 226, `θ⁻¹(K)` is a matching in `Σ′`, and `Δ` is obtained from `Σ′` +by cutting along it. Here we take three facts about `K`: each vertex +lies in the closure of exactly one edge, each edge has two ends, and `θ` +is one-to-one over `U(K)`. The pullback is then a matching. The cut map +`ψ` inherits its properties from `φ`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S S' : Type u} [TopologicalSpace S] [TopologicalSpace S'] + +/-- The property that every vertex ends exactly one edge, which has two different ends. -/ +@[expose] def IsPairing (K : Drawing S) : Prop := + ∀ v ∈ K.V, ∃ e ∈ K.E, v ∈ closure e ∧ (tilde e).ncard = 2 ∧ + ∀ e' ∈ K.E, v ∈ closure e' → e' = e + +theorem IsPairing.vertexValency_eq_one {K : Drawing S} (h : IsPairing K) {v : S} (hv : v ∈ K.V) : + vertexValency K v = 1 := by + obtain ⟨e, he, hve, hcard, huniq⟩ := h v hv + have hA : {f ∈ K.E | K.VertexIncident v f ∧ (tilde f).ncard = 2} = {e} := by + ext f + simp only [mem_ofPred_eq, mem_singleton_iff] + constructor + · rintro ⟨hf, hi, -⟩ + exact huniq f hf hi.2.2 + · rintro rfl + exact ⟨he, ⟨hv, .inl he, hve⟩, hcard⟩ + have hB : {f ∈ K.E | K.VertexIncident v f ∧ (tilde f).ncard = 1} = ∅ := by + ext f + simp only [mem_ofPred_eq, mem_empty_iff_false, iff_false] + rintro ⟨hf, hi, hone⟩ + rw [huniq f hf hi.2.2, hcard] at hone + omega + unfold vertexValency + rw [hA, hB] + simp + +theorem IsPairing.isGraphForest {K : Drawing S} (h : IsPairing K) : IsGraphForest K.toGraph := by + intro u W hW + match W, hW with + | .nil _, _ => rfl + | .cons (u := u) (v := v) (e := e) hlink rest, hW => + have hab : u ≠ v := by + rintro rfl + obtain ⟨e₀, he₀, hve₀, hcard, huniq⟩ := h u hlink.2.1 + have heq := huniq e hlink.1 (hlink.2.2.2.symm.subset (by simp) |>.1) + subst heq + rw [tilde_eq_closure_inter_V K he₀, hlink.2.2.2] at hcard + simp at hcard + match rest, hW with + | .nil _, _ => exact (hab rfl).elim + | .cons (e := e₂) hlink₂ rest₂, hW => + have hmem : ∀ {f x y}, K.toGraph.IsLink f x y → x ∈ closure f := fun hl => + (hl.2.2.2.symm.subset (by simp)).1 + obtain ⟨e₀, he₀, _, _, huniq⟩ := h _ hlink₂.2.1 + have h1 : e = e₀ := huniq e hlink.1 ((hlink.2.2.2.symm.subset (by simp)).1) + have h2 : e₂ = e₀ := huniq e₂ hlink₂.1 (hmem hlink₂) + have hnd := hW.2 + simp [GraphWalk.edges, h1, h2] at hnd + +/-- The pullback of `K` under `θ` is a matching, in VII (4.6), page 226. -/ +theorem exists_lifted_matching (hS : IsSurface S) {L K : Drawing S} {θ : S' → S} + (hθ : IsCutAlongGraph L S' θ) (hK : IsPairing K) (hKp : K.IsProper) (hKL : K.V ⊆ L.U) + (hKn : K.IsNormal L.U) (hinj : InjOn θ (θ ⁻¹' K.U)) : + ∃ K' : Drawing S', IsPullbackDrawing θ K K' ∧ IsMatching K' ∧ IsPairing K' := by + classical + have hF : IsSurfaceForest K := ⟨hKp, hK.isGraphForest⟩ + obtain ⟨K', hp, hprop, hE⟩ := exists_pullback hS hθ hF hKn + have hs := hθ.quotientMap.surjective + have hlift : ∀ e ∈ K.E, θ ⁻¹' e ∈ K'.E ∧ θ '' closure (θ ⁻¹' e) = closure e ∧ + InjOn θ (closure (θ ⁻¹' e)) := by + intro e he + obtain ⟨y, hy⟩ := he.1 + obtain ⟨y', rfl⟩ := hs y + have hyU : θ y' ∈ K.U \ K.V := he.2.1 hy + have hy' : y' ∈ K'.U \ K'.V := by + rw [hp.1, hp.2] + exact hyU + have he' : pathComponentIn (K'.U \ K'.V) y' ∈ K'.E := pathComponentIn_mem_arcComponentsIn hy' + obtain ⟨e₁, he₁, heq, him, hi⟩ := hE _ he' + have hmem : y' ∈ pathComponentIn (K'.U \ K'.V) y' := mem_pathComponentIn_self hy' + have hy₁ : θ y' ∈ e₁ := by + rw [heq] at hmem + exact hmem + have hee : e₁ = e := arcComponentsIn_eq_of_mem he₁ he hy₁ hy + subst hee + rw [heq] at he' + rw [heq] at him hi + exact ⟨he', him, hi⟩ + have hclosure : ∀ e ∈ K.E, ∀ x, θ x ∈ closure e → x ∈ closure (θ ⁻¹' e) := by + intro e he x hx + obtain ⟨hl, him, -⟩ := hlift e he + rw [← him] at hx + obtain ⟨x', hx', hxx⟩ := hx + have hxU : θ x ∈ K.U := K.closure_subset_U he (him ▸ ⟨x', hx', hxx⟩) + have : x' = x := hinj (show θ x' ∈ K.U from hxx ▸ hxU) hxU hxx + exact this ▸ hx' + have hpair : IsPairing K' := by + intro x hx + have hxV : θ x ∈ K.V := by + rw [hp.2] at hx + exact hx + obtain ⟨e, he, hxe, hcard, huniq⟩ := hK _ hxV + obtain ⟨hl, him, hi⟩ := hlift e he + refine ⟨θ ⁻¹' e, hl, hclosure e he x hxe, ?_, ?_⟩ + · have hti : θ '' tilde (θ ⁻¹' e) = tilde e := by + rw [tilde_eq_closure_inter_V K' hl, tilde_eq_closure_inter_V K he, hp.2] + ext z + constructor + · rintro ⟨w, ⟨hw, hwV⟩, rfl⟩ + exact ⟨him ▸ mem_image_of_mem θ hw, hwV⟩ + · rintro ⟨hz, hzV⟩ + rw [← him] at hz + obtain ⟨w, hw, rfl⟩ := hz + exact ⟨w, ⟨hw, hzV⟩, rfl⟩ + have hsub : tilde (θ ⁻¹' e) ⊆ closure (θ ⁻¹' e) := sdiff_subset + rw [← hcard, ← hti, (hi.mono hsub).ncard_image] + · intro e'' he'' hxe'' + obtain ⟨e₂, he₂, heq, him₂, -⟩ := hE e'' he'' + have hmem : θ x ∈ closure e₂ := him₂ ▸ mem_image_of_mem θ hxe'' + rw [heq, huniq e₂ he₂ hmem] + refine ⟨K', hp, ⟨hprop, ?_, fun v hv => hpair.vertexValency_eq_one hv⟩, hpair⟩ + intro x hx + rw [hp.2] at hx + rw [← hθ.preimage_bd_union_U] + exact .inr (hKL hx) + +/-- The map `ψ` cuts `Δ` from `Σ′` along the matching, in VII (4.6), page 226. -/ +theorem Net.isCutAlongGraph_psi {S S' : Type u} [TopologicalSpace S] [TopologicalSpace S'] + (N : Net S) {L K : Drawing S} {K' : Drawing S'} {θ : S' → S} {ψ : N.D → S'} + (hθ : IsCutAlongGraph L S' θ) (hp : IsPullbackDrawing θ K K') (hK' : IsMatching K') + (hK'p : IsPairing K') (hψc : Continuous ψ) (hψs : Function.Surjective ψ) + (hψ : ∀ x, θ (ψ x) = N.φ x) (hcover : bd S ∪ L.U ∪ K.U = N.seamU) : + IsCutAlongGraph K' N.D ψ := by + have hD := N.isSurface_D + have : CompactSpace N.D := hD.1 + have hS' := hθ.isSurface + have : T2Space S' := hS'.2.1 + have hbd : ψ ⁻¹' (bd S' ∪ K'.U) = bd N.D := by + rw [← N.preimage_seamU, ← hcover, ← hθ.preimage_bd_union_U, hp.1, ← preimage_union, + ← preimage_comp] + congr 1 + exact funext hψ + refine ⟨hK'.1, ?_, hD, hψc.isClosedMap.isQuotientMap hψc hψs, hbd, ?_, ?_⟩ + · intro v hv + obtain ⟨e, he, hve, -, -⟩ := hK'p v hv + exact ⟨e, he, hv, .inl he, hve⟩ + · intro x hx y hxy + exact N.interior_inj x hx y (by rw [← hψ, ← hψ, hxy]) + · intro z + obtain ⟨x, rfl⟩ := hψs z + apply (N.finite_preimage_singleton (N.φ x)).subset + intro y hy + have hy' : ψ y = ψ x := hy + change N.φ y = N.φ x + rw [← hψ, ← hψ, hy'] + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46NoArcs.lean b/LeanPool/GraphMinor/GM07/Section46NoArcs.lean new file mode 100644 index 0000000000..412a127cb9 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46NoArcs.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.ForestPeel +import LeanPool.GraphMinor.GM07.Section46RetainedCircles +import LeanPool.GraphMinor.GM07.Section46RetainedArcs + +/-! +# The no-arc conclusion for `L` and its cut surface + +VII (4.6), page 226, excludes circles and then boundary-to-boundary +arcs from `U(L)`. The forest cutting construction can therefore be +applied to `L`. It preserves the two genus parameters and adds cuffs, +giving the surface `Σ′` and its associated map `θ`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +universe u + +/-- The no-`O`-arc and no-`I`-arc conclusion of VII (4.6), page 226. -/ +theorem noArcs_L_of_contact_sum {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) (hcuffs : 2 ≤ (cuffs S).ncard) + {G J J' L : Drawing S} (hJ : N.IsSeamGraphFor J) (hG : G.IsProper) + (hnorm : G.IsNormal J.U) (hL : L.IsSubdrawing J') (hU : J'.U = J.U) + (hLp : L.IsProper) {v : ℕ} + (hsum : (G.V ∩ L.U).ncard + (G.V ∩ bd S).ncard ≤ v) + (hi : ∀ B : Set S, G.IsNormal B → IsIArc B → (G.V ∩ B).ncard ≤ v → + ∃ C ∈ cuffs S, lineEnds B ⊆ C) + (hii : ∀ B : Set S, G.IsNormal B → IsOArc B → (G.V ∩ B).ncard ≤ v → + IsNullHomotopicOArc B ∨ + ∃ C ∈ cuffs S, IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) : NoArcs L := + ⟨fun _F hF => not_isOArc_of_subset_retained hS N hcuffs hJ hG hnorm hL hU hLp hsum hii hiii hF, + fun _F hF => not_isIArc_of_subset_retained hS N hcuffs hJ hG hnorm hL hU hLp hsum hi hii hiii hF⟩ + +/-- Cutting along the graph `L` of VII (4.6), page 226, after the no-arc +argument: the genus parameters are unchanged and the cuff count increases. -/ +theorem exists_cut_L_4_6 {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) {a b c : ℕ} (hmodel : Nonempty (S ≃ₜ SurfaceModel a b c)) + (N : Net S) (hcuffs : 2 ≤ (cuffs S).ncard) + {G J J' L : Drawing S} (hJ : N.IsSeamGraphFor J) (hG : G.IsProper) + (hnorm : G.IsNormal J.U) (hL : L.IsSubdrawing J') (hU : J'.U = J.U) + (hLp : L.IsProper) (hLn : HasNoIsolatedVertices L) {v : ℕ} + (hsum : (G.V ∩ L.U).ncard + (G.V ∩ bd S).ncard ≤ v) + (hi : ∀ B : Set S, G.IsNormal B → IsIArc B → (G.V ∩ B).ncard ≤ v → + ∃ C ∈ cuffs S, lineEnds B ⊆ C) + (hii : ∀ B : Set S, G.IsNormal B → IsOArc B → (G.V ∩ B).ncard ≤ v → + IsNullHomotopicOArc B ∨ + ∃ C ∈ cuffs S, IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) : + ∃ (S' : Type u) (_ : TopologicalSpace S') (θ : S' → S) (c' : ℕ), + IsCutAlongGraph L S' θ ∧ c ≤ c' ∧ Nonempty (S' ≃ₜ SurfaceModel a b c') := by + have hN := noArcs_L_of_contact_sum hS N hcuffs hJ hG hnorm hL hU hLp hsum hi hii hiii + obtain ⟨S', top, θ, k, hcut, hmodel', _⟩ := exists_isCutAlongGraph hS hmodel hLp hLn hN + exact ⟨S', top, θ, c + k, hcut, Nat.le_add_right _ _, hmodel'⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46NullCircle.lean b/LeanPool/GraphMinor/GM07/Section46NullCircle.lean new file mode 100644 index 0000000000..76e9036ae3 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46NullCircle.lean @@ -0,0 +1,65 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section46SeamComplement +import LeanPool.GraphMinor.GM07.Section46DiscSides +import LeanPool.GraphMinor.GM07.Section11a +import LeanPool.GraphMinor.Surface.HoleDisc +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.Surface.AddCrosscap + +/-! +# A seam circle cannot bound a disc in the original surface + +In the circle argument of VII (4.6), page 226, a disc bounded by a +circle in the seam has the unique dense region entirely on one side. +It must contain the whole surface. A surface with at least two cuffs +is not a closed disc, so such a circle cannot be null-homotopic there. +This leaves the capped-cuff alternative of hypothesis (ii). +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +/-- A surface with at least two cuffs is not itself a closed disc. -/ +theorem not_isClosedDisc_univ_of_two_cuffs {S : Type*} [TopologicalSpace S] + (hcuffs : 2 ≤ (cuffs S).ncard) : ¬IsClosedDisc (univ : Set S) := by + intro hD + have hb : discBd (univ : Set S) = bd S := image_bd_homeomorph (Homeomorph.Set.univ S) + have hO : IsOArc (bd S) := hb ▸ hD.isOArc_discBd + have hc := cuffs_eq_of_isConnected hO.isConnected' + rw [hc, ncard_singleton] at hcuffs + omega + +/-- A circle in the seam cannot be null-homotopic in a surface with +at least two cuffs, in VII (4.6), page 226. -/ +theorem Net.not_nullHomotopic_circle_in_seam {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) (hcuffs : 2 ≤ (cuffs S).ncard) + {F : Set S} (hF : IsOArc F) (hFU : F ⊆ N.seamU) : ¬IsNullHomotopicOArc F := by + have : T2Space S := hS.2.1 + intro hnull + obtain ⟨D, hD, hbd⟩ := nullHomotopicOArc_bounds_disc hS hF hnull + have hside : (univ : Set S) ⊆ D ∨ D ∩ univ ⊆ discBd D := by + apply disc_side_of_dense_connected_set hS.2.2 hD N.isPreconnected_compl_seamU + (fun _ _ => N.dense_compl_seamU _) + rw [hbd] + exact disjoint_compl_left.mono_right hFU + rcases hside with hcover | hboundary + · have heq : D = univ := Subset.antisymm (subset_univ _) hcover + exact not_isClosedDisc_univ_of_two_cuffs hcuffs (heq ▸ hD) + · obtain ⟨x, hxD, hxbd⟩ := hD.nonempty_discInt + exact hxbd (hboundary ⟨hxD, mem_univ _⟩) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46OldVertexCoverage.lean b/LeanPool/GraphMinor/GM07/Section46OldVertexCoverage.lean new file mode 100644 index 0000000000..619c204896 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46OldVertexCoverage.lean @@ -0,0 +1,83 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46SeamPartsDefs +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46RetainedLinking +import LeanPool.GraphMinor.GM07.Section46ShortEdges +import LeanPool.GraphMinor.GM07.Section46OldVertices +import LeanPool.GraphMinor.GM07.Section46EdgeSegments + +/-! +# Old seam vertices remain incident with `L` + +An old seam vertex at an edge off the cuffs remains on an edge of `L`: +a short edge is retained, and a long edge contributes the linking edge +at that end. This is the old-vertex part of the coverage count used on +page 226 of VII (4.6). +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +/-- An old vertex incident with an old edge off the cuffs is incident +with a retained edge, in VII (4.6), page 226. -/ +theorem exists_retained_edge_at_old_vertex {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {G J J' : Drawing S} + (hJ : N.IsSeamGraphFor J) {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (s t : longSeamEdges G J μ w → unitInterval) + (W : longSeamEdges G J μ w → Set S) + (hcuts : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)}) + (hsmall : (G.V ∩ bd S).ncard < 2 * μ + w + 2) + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ ⋃ e, W e) + {v : S} (hvV : v ∈ J.V) {e : Set S} (he : e ∈ J.E) + (hoff : Disjoint e (bd S)) (hvcl : v ∈ closure e) : + ∃ f ∈ forestSeamEdges J' (centralEdges G J μ w γ s t), v ∈ closure f := by + have : T2Space S := hS.2.1 + have hcpos : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e := + fun e => ⟨(hcuts e).1, (hcuts e).2.1, (hcuts e).2.2.1⟩ + have hW : ∀ e : longSeamEdges G J μ w, W e ⊆ e.1 := by + intro e x hx + rw [(hcuts e).2.2.2] at hx + rcases hx with rfl | rfl + · exact (congrArg (fun A => γ e.1 (s e) ∈ A) (hγ.image e.1 e.2.1)).mp + ⟨s e, (hcuts e).1, rfl⟩ + · exact (congrArg (fun A => γ e.1 (t e) ∈ A) (hγ.image e.1 e.2.1)).mp + ⟨t e, (hcuts e).2.1, rfl⟩ + by_cases hlong : e ∈ longSeamEdges G J μ w + · let e' : longSeamEdges G J μ w := ⟨e, hlong⟩ + have hc := hcuts e' + have hp : v ∈ ({γ e'.1 0, γ e'.1 1} : Set S) := by + rw [← edge_parameter_old_vertices hγ he] + exact ⟨hvcl, hvV⟩ + rcases hp with rfl | rfl + · refine ⟨γ e'.1 '' Ioo 0 (s e'), + linking_edge_mem_forestSeamEdges hS N hJ hγ s t W hcuts hsmall hU hV (.inl ⟨e', rfl⟩), ?_⟩ + rw [closure_image_Ioo_eq_Icc hγ he hc.1.1 (.inr hc.1.2)] + exact ⟨0, ⟨le_rfl, hc.1.1.le⟩, rfl⟩ + · refine ⟨γ e'.1 '' Ioo (t e') 1, + linking_edge_mem_forestSeamEdges hS N hJ hγ s t W hcuts hsmall hU hV (.inr ⟨e', rfl⟩), ?_⟩ + rw [closure_image_Ioo_eq_Icc hγ he hc.2.1.2 (.inl hc.2.1.1)] + exact ⟨1, ⟨hc.2.1.2.le, le_rfl⟩, rfl⟩ + · have heShort : e ∈ shortSeamEdges G J μ w := ⟨he, hlong⟩ + have heNew := short_edge_mem_J_plus W hW hU hV heShort + have hnotcentral : e ∉ centralEdges G J μ w γ s t := fun hc => + disjoint_left.mp (central_closure_disjoint_old_vertices hγ s t hcpos hc) hvcl hvV + have hnotbd : ¬e ⊆ bd S := by + intro hsub + obtain ⟨x, hx⟩ := he.1 + exact disjoint_left.mp hoff hx (hsub hx) + exact ⟨e, ⟨heNew, hnotcentral, hnotbd⟩, hvcl⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46OldVertices.lean b/LeanPool/GraphMinor/GM07/Section46OldVertices.lean new file mode 100644 index 0000000000..d7c4b839c6 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46OldVertices.lean @@ -0,0 +1,73 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46SeamPartsDefs +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46EdgeSegments + +/-! +# Which refined edges meet old seam vertices + +Central edges have their closed intervals inside an old open edge, +so their closures miss `V(J)`. Each linking edge has an old seam vertex +as one end. These incidences are used for coverage of `L` and to separate +linking from central edges in VII (4.6), page 226. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +/-- Closed central edges stay inside their old open edges. -/ +theorem central_closure_subset_old_edge {S : Type*} [TopologicalSpace S] [T2Space S] + {J : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {e : Set S} (he : e ∈ J.E) {s t : unitInterval} + (hs : s ∈ Ioo 0 1) (ht : t ∈ Ioo 0 1) (hst : s < t) : + closure (γ e '' Ioo s t) ⊆ e := by + rw [closure_image_Ioo_eq_Icc hγ he hst (.inl hs.1)] + rintro x ⟨u, hu, rfl⟩ + exact (congrArg (fun A => γ e u ∈ A) (hγ.image e he)).mp + ⟨u, ⟨hs.1.trans_le hu.1, hu.2.trans_lt ht.2⟩, rfl⟩ + +/-- A closed central edge contains no old seam vertex, in VII (4.6), +page 226. -/ +theorem central_closure_disjoint_old_vertices {S : Type*} [TopologicalSpace S] [T2Space S] + {G J : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (s t : longSeamEdges G J μ w → unitInterval) + (hcuts : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e) + {f : Set S} (hf : f ∈ centralEdges G J μ w γ s t) : Disjoint (closure f) J.V := by + obtain ⟨e, rfl⟩ := hf + apply disjoint_left.mpr + intro x hx hxV + have hxE := central_closure_subset_old_edge hγ e.2.1 + (hcuts e).1 (hcuts e).2.1 (hcuts e).2.2 hx + exact (e.2.1.2.1 hxE).2 hxV + +/-- Each linking edge has an old seam vertex as an end, in VII (4.6), +page 226. -/ +theorem linking_closure_meets_old_vertices {S : Type*} [TopologicalSpace S] [T2Space S] + {G J : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (s t : longSeamEdges G J μ w → unitInterval) + (hcuts : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e) + {f : Set S} (hf : f ∈ linkingEdges G J μ w γ s t) : + (closure f ∩ J.V).Nonempty := by + rcases hf with ⟨e, rfl⟩ | ⟨e, rfl⟩ + · have hs := (hcuts e).1 + refine ⟨γ e.1 0, ?_, hγ.zero e.1 e.2.1⟩ + rw [closure_image_Ioo_eq_Icc hγ e.2.1 hs.1 (.inr hs.2)] + exact ⟨0, ⟨le_rfl, hs.1.le⟩, rfl⟩ + · have ht := (hcuts e).2.1 + refine ⟨γ e.1 1, ?_, hγ.one e.1 e.2.1⟩ + rw [closure_image_Ioo_eq_Icc hγ e.2.1 ht.2 (.inl ht.1)] + exact ⟨1, ⟨ht.2.le, le_rfl⟩, rfl⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46OrderedContacts.lean b/LeanPool/GraphMinor/GM07/Section46OrderedContacts.lean new file mode 100644 index 0000000000..11b234b65a --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46OrderedContacts.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Data.Set.Card +public import Mathlib.Order.Basic +import Mathlib.Data.Finset.Sort +import Mathlib.Order.Interval.Finset.Fin + +/-! +# The two ordered contacts on a long edge + +For VII (4.6), page 225, enumerate the contacts along an edge parameter. +Choose contact `μ + 1` from the start and contact `μ + 1` from the end. +Each closed linking interval has `μ + 1` contacts, and the open middle +interval has at least `w`. This finite order count also permits a loop's +two parameter ends to represent the same point of the surface. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set + +private theorem ncard_contacts_Iic {α : Type*} [LinearOrder α] {r : ℕ} + (f : Fin r ↪o α) (i : Fin r) : + (range f ∩ Iic (f i)).ncard = i.val + 1 := by + have heq : range f ∩ Iic (f i) = f '' Iic i := by + ext x + constructor + · rintro ⟨⟨j, rfl⟩, hj⟩ + exact ⟨j, f.le_iff_le.mp hj, rfl⟩ + · rintro ⟨j, hj, rfl⟩ + exact ⟨⟨j, rfl⟩, f.monotone hj⟩ + rw [heq, ncard_image_of_injective _ f.injective] + simp [← Finset.coe_Iic] + +private theorem ncard_contacts_Ici {α : Type*} [LinearOrder α] {r : ℕ} + (f : Fin r ↪o α) (i : Fin r) : + (range f ∩ Ici (f i)).ncard = r - i.val := by + have heq : range f ∩ Ici (f i) = f '' Ici i := by + ext x + constructor + · rintro ⟨⟨j, rfl⟩, hj⟩ + exact ⟨j, f.le_iff_le.mp hj, rfl⟩ + · rintro ⟨j, hj, rfl⟩ + exact ⟨⟨j, rfl⟩, f.monotone hj⟩ + rw [heq, ncard_image_of_injective _ f.injective] + simp [← Finset.coe_Ici] + +private theorem ncard_contacts_Ioo {α : Type*} [LinearOrder α] {r : ℕ} + (f : Fin r ↪o α) (i j : Fin r) : + (range f ∩ Ioo (f i) (f j)).ncard = j.val - i.val - 1 := by + have heq : range f ∩ Ioo (f i) (f j) = f '' Ioo i j := by + ext x + constructor + · rintro ⟨⟨k, rfl⟩, hk⟩ + exact ⟨k, ⟨f.lt_iff_lt.mp hk.1, f.lt_iff_lt.mp hk.2⟩, rfl⟩ + · rintro ⟨k, hk, rfl⟩ + exact ⟨⟨k, rfl⟩, ⟨f.strictMono hk.1, f.strictMono hk.2⟩⟩ + rw [heq, ncard_image_of_injective _ f.injective] + simp [← Finset.coe_Ioo] + +/-- The contact indices `μ + 1` and `r - μ` used to define `W(e)` in +VII (4.6), page 225, with the linking and central contact counts. -/ +theorem exists_ordered_contact_cuts {α : Type*} [LinearOrder α] + {T : Set α} (hT : T.Finite) {μ w : ℕ} (hcard : 2 * μ + w + 2 ≤ T.ncard) : + ∃ s ∈ T, ∃ t ∈ T, s < t ∧ + (T ∩ Iic s).ncard = μ + 1 ∧ (T ∩ Ici t).ncard = μ + 1 ∧ + w ≤ (T ∩ Ioo s t).ncard := by + classical + let r := hT.toFinset.card + let f : Fin r ↪o α := hT.toFinset.orderEmbOfFin rfl + have hrange : range f = T := by simp [f] + have hr : 2 * μ + w + 2 ≤ r := by + rwa [Set.ncard_eq_toFinset_card T hT] at hcard + let i : Fin r := ⟨μ, by omega⟩ + let j : Fin r := ⟨r - μ - 1, by omega⟩ + have hij : i < j := by change μ < r - μ - 1; omega + refine ⟨f i, hrange ▸ mem_range_self i, f j, hrange ▸ mem_range_self j, + f.strictMono hij, ?_, ?_, ?_⟩ + · rw [← hrange, ncard_contacts_Iic] + · rw [← hrange, ncard_contacts_Ici] + dsimp [j] + omega + · rw [← hrange, ncard_contacts_Ioo] + dsimp [i, j] + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46ProperSubarc.lean b/LeanPool/GraphMinor/GM07/Section46ProperSubarc.lean new file mode 100644 index 0000000000..4b5ea1b16b --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46ProperSubarc.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section5b +import Mathlib.Data.Set.Finite.Lemmas + +/-! +# Choosing a proper boundary-to-boundary subarc + +In VII (4.6), page 226, an `I`-arc in `U(L)` can be chosen to meet the +boundary only at its ends. Since `L` is proper, its boundary contacts +are vertices and hence finite. Starting at one end, choose the first +later contact in the line parameter and keep that initial segment. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +/-- The choice of a proper `I`-arc in `U(L)` in VII (4.6), page 226. -/ +theorem exists_proper_IArc_subset {S : Type*} [TopologicalSpace S] [T2Space S] + {L : Drawing S} (hL : L.IsProper) {F : Set S} (hF : IsIArc F) (hFL : F ⊆ L.U) : + ∃ P : Set S, P ⊆ F ∧ IsProperIArc P := by + obtain ⟨a, b, habd, hbbd, f, hf0, hf1⟩ := hF + let γ : unitInterval → S := fun u => (f u).1 + have hγc : Continuous γ := continuous_subtype_val.comp f.continuous + have hγi : Function.Injective γ := Subtype.val_injective.comp f.injective + let T := γ ⁻¹' bd S + have hT : T.Finite := (L.finite_V.preimage hγi.injOn).subset fun u hu => + hL ⟨hu, hFL (f u).2⟩ + have h0 : γ 0 ∈ bd S := by change (f 0).1 ∈ bd S; rw [hf0]; exact habd + have h1 : (1 : unitInterval) ∈ T := by change (f 1).1 ∈ bd S; rw [hf1]; exact hbbd + have hne : (T \ {0}).Nonempty := ⟨1, h1, one_ne_zero⟩ + obtain ⟨t, ht, hmin⟩ := Set.exists_min_image (T \ {0}) id hT.sdiff hne + have ht0 : (0 : unitInterval) < t := unitInterval.pos_iff_ne_zero.mpr ht.2 + let P := γ '' Icc 0 t + have hline : IsLineWithEnds P (γ 0) (γ t) := + isLineWithEnds_image_Icc_of_injOn hγc ht0 hγi.injOn + have hends : P ∩ bd S = {γ 0, γ t} := by + apply Subset.antisymm + · rintro x ⟨⟨u, hu, rfl⟩, hubd⟩ + by_cases hu0 : u = 0 + · exact .inl (congrArg γ hu0) + · have htu : t ≤ u := hmin u ⟨hubd, hu0⟩ + have hut : u = t := le_antisymm hu.2 htu + exact .inr (congrArg γ hut) + · rintro x (rfl | rfl) + · exact ⟨⟨0, ⟨le_rfl, ht0.le⟩, rfl⟩, h0⟩ + · exact ⟨⟨t, ⟨ht0.le, le_rfl⟩, rfl⟩, ht.1⟩ + refine ⟨P, ?_, γ 0, γ t, (fun h => ht0.ne (hγi h)), hends, hline⟩ + rintro x ⟨u, _, rfl⟩ + exact (f u).2 + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46Psi.lean b/LeanPool/GraphMinor/GM07/Section46Psi.lean new file mode 100644 index 0000000000..1912c65d4d --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46Psi.lean @@ -0,0 +1,166 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Open +import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.GM07.Section46DiscApproach +import LeanPool.GraphMinor.GM07.Section46SeamComplement +import LeanPool.GraphMinor.GM07.Section46UniqueLiftLimit +import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.SurfacePull + +/-! +# The second cutting map in VII (4.6) + +On page 226 the disc `Δ` is cut from `Σ` in two stages, so there is a +natural surjection `ψ : Δ → Σ′` with `θ(ψ(x)) = φ(x)`. On the open disc, +`φ(x)` avoids the seam, so `θ` has exactly one point over it, and this +point is `ψ(x)`. The map on the open disc is continuous since `θ` is a +closed map. It extends to the closed disc since two limits at one +point would be separated in a finite fibre of `θ`, while small +approaches to that point in the open disc are connected. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S S' : Type u} [TopologicalSpace S] [TopologicalSpace S'] + +/-- The natural surjection `ψ : Δ → Σ′` of VII (4.6), page 226. -/ +theorem Net.exists_psi [T2Space S] (_hS : IsSurface S) (N : Net S) {L : Drawing S} {θ : S' → S} + (hθ : IsCutAlongGraph L S' θ) (hL : L.U ⊆ N.seamU) : + ∃ ψ : N.D → S', Continuous ψ ∧ Function.Surjective ψ ∧ ∀ x, θ (ψ x) = N.φ x := by + classical + have hS' := hθ.isSurface + have : CompactSpace S' := hS'.1 + have : T2Space S' := hS'.2.1 + have hD := N.isSurface_D + have : CompactSpace N.D := hD.1 + have : T2Space N.D := hD.2.1 + have hθc : Continuous θ := hθ.quotientMap.continuous + have hθs : Function.Surjective θ := hθ.quotientMap.surjective + have hφc : Continuous N.φ := N.quotientMap_φ.continuous + let U : Set N.D := (bd N.D)ᶜ + have hint : ∀ x ∈ U, ∀ y : S', θ y = N.φ x → y ∉ bd S' := by + intro x hx y hy hyb + rw [← hθ.preimage_bd_union_U] at hyb + have hseam : θ y ∈ N.seamU := by + rcases hyb with h | h + · exact N.bd_subset_seamU h + · exact hL h + rw [hy] at hseam + exact hx (N.preimage_seamU ▸ hseam) + choose g hg using fun x => hθs (N.φ x) + have hclosed : IsClosedMap θ := hθc.isClosedMap + have hgc : ContinuousOn g U := by + intro x hx + rw [ContinuousWithinAt, tendsto_nhds] + intro O hO hgx + have hK : IsClosed (θ '' Oᶜ) := hclosed _ hO.isClosed_compl + have hxK : x ∈ N.φ ⁻¹' (θ '' Oᶜ)ᶜ := by + rintro ⟨y, hy, hyθ⟩ + have hgxb : g x ∉ bd S' := hint x hx (g x) (hg x) + have heq := hθ.interior_inj (g x) hgxb y ((hg x).trans hyθ.symm) + exact hy (heq ▸ hgx) + have hopen : IsOpen (N.φ ⁻¹' (θ '' Oᶜ)ᶜ) := hK.isOpen_compl.preimage hφc + apply mem_nhdsWithin.mpr + refine ⟨_, hopen, hxK, ?_⟩ + rintro z ⟨hz, -⟩ + by_contra hzO + exact hz ⟨g z, hzO, hg z⟩ + let Γ : Set (N.D × S') := closure ((fun z => (z, g z)) '' U) + have hΓc : IsClosed Γ := isClosed_closure + have hrel : ∀ p ∈ Γ, θ p.2 = N.φ p.1 := by + have hcl : IsClosed {p : N.D × S' | θ p.2 = N.φ p.1} := + isClosed_eq (hθc.comp continuous_snd) (hφc.comp continuous_fst) + have hsub : Γ ⊆ {p : N.D × S' | θ p.2 = N.φ p.1} := by + apply closure_minimal _ hcl + rintro p ⟨z, -, rfl⟩ + exact hg z + exact fun p hp => hsub hp + have hdense : Dense U := fun x => mem_closure_compl_bd (hD.2.2 x) + have hex : ∀ x : N.D, ∃ a : S', (x, a) ∈ Γ := by + have hfstc : IsClosed (Prod.fst '' Γ) := isClosedMap_fst_of_compactSpace _ hΓc + have hsub : U ⊆ Prod.fst '' Γ := fun z hz => + ⟨(z, g z), subset_closure ⟨z, hz, rfl⟩, rfl⟩ + intro x + have hx : x ∈ Prod.fst '' Γ := closure_minimal hsub hfstc (hdense x) + obtain ⟨⟨y, a⟩, hp, rfl⟩ := hx + exact ⟨a, hp⟩ + obtain ⟨e⟩ : Nonempty (ClosedUnitDisc ≃ₜ N.D) := by + obtain ⟨e⟩ := N.isClosedDisc_D + exact ⟨e.trans (Homeomorph.Set.univ N.D)⟩ + have huniq : ∀ {x : N.D} {a b : S'}, (x, a) ∈ Γ → (x, b) ∈ Γ → a = b := by + intro x a b ha hb + exact unique_lift_limit_of_connected_approach hφc hgc hθc hθ.finite_fiber (fun z _ => hg z) + (fun O hO hx => closed_disc_connected_approach e x O hO hx) ha hb + choose ψ hψ using hex + have hψc : Continuous ψ := by + rw [continuous_iff_isClosed] + intro C hC + have hpre : ψ ⁻¹' C = Prod.fst '' (Γ ∩ Prod.snd ⁻¹' C) := by + ext x + constructor + · intro hx + exact ⟨(x, ψ x), ⟨hψ x, hx⟩, rfl⟩ + · rintro ⟨⟨y, a⟩, ⟨hp, ha⟩, rfl⟩ + change ψ y ∈ C + rw [huniq (hψ y) hp] + exact ha + rw [hpre] + exact isClosedMap_fst_of_compactSpace _ (hΓc.inter (hC.preimage continuous_snd)) + have hψg : ∀ x ∈ U, ψ x = g x := fun x hx => huniq (hψ x) (subset_closure ⟨x, hx, rfl⟩) + have hsurj : Function.Surjective ψ := by + have hrange : IsClosed (range ψ) := isCompact_range hψc |>.isClosed + let Q : Set S' := θ ⁻¹' N.seamUᶜ + have hQsub : Q ⊆ range ψ := by + intro z hz + obtain ⟨x, hx⟩ := N.quotientMap_φ.surjective (θ z) + have hxU : x ∈ U := fun hb => hz (hx ▸ mem_image_of_mem N.φ hb) + have hzb : z ∉ bd S' := by + intro hb + rw [← hθ.preimage_bd_union_U] at hb + rcases hb with h | h + · exact hz (N.bd_subset_seamU h) + · exact hz (hL h) + exact ⟨x, by + rw [hψg x hxU] + exact (hθ.interior_inj z hzb (g x) (by rw [hg x, hx])).symm⟩ + have hQdense : Dense Q := by + intro y + rw [mem_closure_iff] + intro O hO hy + obtain ⟨z, hzO, hzb⟩ := mem_closure_iff.mp (mem_closure_compl_bd (hS'.2.2 y)) O hO hy + have hbc : IsOpen (bd S')ᶜ := (isClosed_bd S').isOpen_compl + let O' := O ∩ (bd S')ᶜ + have hO'o : IsOpen O' := hO.inter hbc + have hsat : θ ⁻¹' (θ '' O') = O' := by + apply Subset.antisymm _ (subset_preimage_image θ O') + rintro w ⟨w', hw', hww⟩ + rw [hθ.interior_inj w' hw'.2 w hww] at hw' + exact hw' + have him : IsOpen (θ '' O') := by + rw [← hθ.quotientMap.isOpen_preimage, hsat] + exact hO'o + obtain ⟨t, htO, htC⟩ := (N.dense_compl_seamU).inter_open_nonempty _ him ⟨θ z, z, ⟨hzO, hzb⟩, + rfl⟩ + obtain ⟨w, hw, rfl⟩ := htO + exact ⟨w, hw.1, htC⟩ + intro y + exact closure_minimal hQsub hrange (hQdense y) + exact ⟨ψ, hψc, hsurj, fun x => hrel _ (hψ x)⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46PsiFibres.lean b/LeanPool/GraphMinor/GM07/Section46PsiFibres.lean new file mode 100644 index 0000000000..c5eda1d65b --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46PsiFibres.lean @@ -0,0 +1,106 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Open +import LeanPool.GraphMinor.GM07.Section46SurfaceApproach +import LeanPool.GraphMinor.GM07.Section46UniqueLiftLimit +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.SurfacePull + +/-! +# The fibres of the second cutting map off the matching + +VII (4.6), page 228, says `|ψ⁻¹(v)| = 1` for a point `v` of `Σ′` off the +matching. Two points of one such fibre would be two limits at `v` of the +inverse of `ψ` on the open disc. A small neighbourhood of `v` misses the +matching and is connected after removing the boundary. So the two limits +are equal by the unique limit argument of page 226. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S D : Type u} [TopologicalSpace S] [TopologicalSpace D] + +/-- A cut map is one-to-one off its graph, in VII (4.6), page 228. -/ +theorem IsCutAlongGraph.eq_of_eq_of_notMem [T2Space D] {K : Drawing S} {ψ : D → S} + (hψ : IsCutAlongGraph K D ψ) (hS : IsSurface S) {x y : D} (hxy : ψ x = ψ y) + (hv : ψ x ∉ K.U) : x = y := by + classical + have hD := hψ.isSurface + have : CompactSpace D := hD.1 + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hc : Continuous ψ := hψ.quotientMap.continuous + have hs : Function.Surjective ψ := hψ.quotientMap.surjective + let U : Set S := (bd S ∪ K.U)ᶜ + have hbdU : ∀ z, z ∉ bd D → ψ z ∈ U := by + intro z hz hb + apply hz + rw [← hψ.preimage_bd_union_U] + exact hb + have huniq : ∀ a ∈ U, ∀ z w : D, ψ z = a → ψ w = a → z = w := by + intro a ha z w hz hw + have hzb : z ∉ bd D := by + intro hb + rw [← hψ.preimage_bd_union_U] at hb + exact ha (by rw [← hz]; exact hb) + exact hψ.interior_inj z hzb w (hz.trans hw.symm) + choose g hg using hs + have hgc : ContinuousOn g U := by + intro a ha + rw [ContinuousWithinAt, tendsto_nhds] + intro O hO hgx + have hK : IsClosed (ψ '' Oᶜ) := hc.isClosedMap _ hO.isClosed_compl + have hxK : a ∈ (ψ '' Oᶜ)ᶜ := by + rintro ⟨w, hw, hwa⟩ + exact hw (huniq a ha w (g a) hwa (hg a) ▸ hgx) + apply mem_nhdsWithin.mpr + refine ⟨_, hK.isOpen_compl, hxK, ?_⟩ + rintro z ⟨hz, -⟩ + by_contra hzO + exact hz ⟨g z, hzO, hg z⟩ + have hclosure : ∀ z, (ψ z, z) ∈ closure ((fun a => (a, g a)) '' U) := by + intro z + rw [mem_closure_iff] + intro T hT hmem + obtain ⟨O, P, hO, hP, hzO, hzP, hsub⟩ := isOpen_prod_iff.mp hT _ _ hmem + have hopen : IsOpen (P ∩ ψ ⁻¹' O) := hP.inter (hO.preimage hc) + obtain ⟨w, hw, hwb⟩ := mem_closure_iff.mp (mem_closure_compl_bd (hD.2.2 z)) _ hopen ⟨hzP, hzO⟩ + have hU : ψ w ∈ U := hbdU w hwb + have hgw : g (ψ w) = w := huniq _ hU _ _ (hg _) rfl + refine ⟨(ψ w, w), hsub ⟨hw.2, hw.1⟩, ⟨ψ w, hU, ?_⟩⟩ + simp [hgw] + have hyx : (ψ x, y) ∈ closure ((fun a => (a, g a)) '' U) := hxy ▸ hclosure y + refine unique_lift_limit_of_connected_approach (f := id) (U := U) (g := g) (θ := ψ) + continuous_id hgc hc hψ.finite_fiber (fun a _ => hg a) ?_ (hclosure x) hyx + intro O hO hxO + have hopen : IsOpen (O ∩ K.Uᶜ) := hO.inter K.isClosed_U.isOpen_compl + obtain ⟨W, hWo, hxW, hWsub, hWc⟩ := surface_connected_approach (hS.2.2 (ψ x)) hopen ⟨hxO, hv⟩ + refine ⟨W, hWo, hxW, fun z hz => (hWsub hz).1, ?_⟩ + have heq : W ∩ U = W ∩ (bd S)ᶜ := by + ext z + constructor + · rintro ⟨hz, hzU⟩ + exact ⟨hz, fun hb => hzU (.inl hb)⟩ + · rintro ⟨hz, hzb⟩ + refine ⟨hz, ?_⟩ + rintro (h | h) + · exact hzb h + · exact (hWsub hz).2 h + rw [heq] + exact hWc + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46PullGraph.lean b/LeanPool/GraphMinor/GM07/Section46PullGraph.lean new file mode 100644 index 0000000000..4dd4d432ee --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46PullGraph.lean @@ -0,0 +1,349 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.PullForest +import LeanPool.GraphMinor.GM07.CutLines +import LeanPool.GraphMinor.GM07.Section46CentralLift +import LeanPool.GraphMinor.GM11.ArcDrawings +import LeanPool.GraphMinor.GM11.DrawingOps +import LeanPool.GraphMinor.Surface.CutLift +import LeanPool.GraphMinor.Surface.ArcTools + +/-! +# The pullback of a graph across a cut + +Page 227 uses `φ⁻¹(G)` as a graph in the disc. `exists_pullback` builds a +pullback for forests. A graph `G` may have loops, and a loop of `G` lifts to +a line or to a loop, depending on the ends. We cut each edge at an inner point +into two lines, lift them with `exists_lift_line`, and join the lifts at the +one point over the inner point. Then we glue the results. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S S' : Type u} [TopologicalSpace S] [TopologicalSpace S'] + +/-- A line without one end is path connected. -/ +private theorem isPathConnected_line_diff {L : Set S'} {u v : S'} + (h : IsLineWithEnds L u v) : IsPathConnected (L \ {u}) := by + obtain ⟨a, ha, rfl, rfl, rfl⟩ := h.exists_arc + have hc : Continuous fun r : ℝ => a (Set.projIcc 0 1 zero_le_one r) := + ha.1.comp continuous_projIcc + have heq : (fun r : ℝ => a (Set.projIcc 0 1 zero_le_one r)) '' Ioc 0 1 = range a \ {a 0} := by + ext x + constructor + · rintro ⟨r, hr, rfl⟩ + refine ⟨mem_range_self _, fun h => ?_⟩ + have h0 := ha.2 h + have := congrArg Subtype.val h0 + rw [Set.projIcc_of_mem zero_le_one ⟨hr.1.le, hr.2⟩] at this + exact hr.1.ne' this + · rintro ⟨⟨r, rfl⟩, hr⟩ + refine ⟨r.1, ⟨lt_of_le_of_ne r.2.1 fun h => hr ?_, r.2.2⟩, ?_⟩ + · exact congrArg a (Subtype.ext h.symm) + · simp + rw [← heq] + exact (convex_Ioc (0 : ℝ) 1).isPathConnected ⟨1, by norm_num, le_rfl⟩ |>.image hc + +/-- The two lifted halves of an edge. -/ +private theorem exists_lift_edge [CompactSpace S'] [T2Space S'] [T2Space S] {B : Set S} {φ : S' → S} + (hφ : GM19.IsCutMap φ B) (hB : IsClosed B) {G : Drawing S} {e : Set S} (he : e ∈ G.E) + (hAB : closure e ∩ B ⊆ G.V) (hf : (φ ⁻¹' G.V).Finite) : + ∃ Le : Set S', (∃ D : Drawing S', D.U = Le ∧ D.V = Le ∩ φ ⁻¹' G.V) ∧ Le ⊆ φ ⁻¹' closure e ∧ + (∀ z, φ z ∈ e → z ∈ Le) ∧ IsPathConnected (φ ⁻¹' e) := by + classical + obtain ⟨m, hme⟩ := he.1 + have hmV : m ∉ G.V := (he.2.1 hme).2 + have hmc : m ∈ closure e := subset_closure hme + have hmB : m ∉ B := fun h => hmV (hAB ⟨hmc, h⟩) + have heB : ∀ z ∈ e, z ∉ B := fun z hz h => (he.2.1 hz).2 (hAB ⟨subset_closure hz, h⟩) + obtain ⟨u, v, A₁, A₂, hA₁, hA₂, hun, hcapV, hin⟩ : ∃ (u v : S) (A₁ A₂ : Set S), + IsLineWithEnds A₁ u m ∧ IsLineWithEnds A₂ v m ∧ A₁ ∪ A₂ = closure e ∧ + closure e ∩ G.V = {u, v} ∧ A₁ ∩ A₂ ⊆ {m} ∪ ({u} ∩ {v}) := by + rcases G.edge_cond e he with ⟨u, v, -, hcap, hl⟩ | ⟨u, hcap, hO⟩ + · have hu : u ∈ closure e ∩ G.V := hcap ▸ mem_insert u {v} + have hv : v ∈ closure e ∩ G.V := hcap ▸ mem_insert_of_mem u (mem_singleton v) + obtain ⟨L₁, L₂, h₁, h₂, hU, hI⟩ := hl.split hmc (fun h => hmV (h ▸ hu.2)) + (fun h => hmV (h ▸ hv.2)) + refine ⟨u, v, L₁, L₂, h₁, h₂.symm, hU, hcap, ?_⟩ + rw [hI] + exact subset_union_left + · have hu : u ∈ closure e ∩ G.V := hcap ▸ mem_singleton u + obtain ⟨A, B', hA, hB', hU, hI⟩ := hO.lines hu.1 hmc (fun h => hmV (h ▸ hu.2)) + refine ⟨u, u, A, B', hA, hB', hU, by rw [pair_eq_singleton]; exact hcap, ?_⟩ + rw [hI, inter_self, pair_comm] + rfl + have hA₁c : A₁ ⊆ closure e := hun ▸ subset_union_left + have hA₂c : A₂ ⊆ closure e := hun ▸ subset_union_right + have huv : ∀ z ∈ closure e, z ∈ B → z = u ∨ z = v := fun z hz hb => by + have : z ∈ closure e ∩ G.V := ⟨hz, hAB ⟨hz, hb⟩⟩ + rw [hcapV] at this + exact this + have hvA₁ : ∀ z ∈ A₁, z = v → z ∈ A₂ → z = u := fun z hz h h₂ => by + rcases hin ⟨hz, h₂⟩ with h' | h' + · have hvV : v ∈ closure e ∩ G.V := hcapV ▸ mem_insert_of_mem u (mem_singleton v) + exact (hmV ((mem_singleton_iff.mp h').symm.trans h ▸ hvV.2)).elim + · exact h'.1 + have hA₂v : v ∈ A₂ := hA₂.left_mem + have hA₁u : u ∈ A₁ := hA₁.left_mem + obtain ⟨L₁, u₁, m₁, hL₁, hu₁, hm₁, him₁, hinj₁, hpre₁⟩ := exists_lift_line hφ hB hA₁ + (fun z hz => by + rcases huv z (hA₁c hz.1) hz.2 with h | h + · exact h + · exact hvA₁ z hz.1 h (h ▸ hA₂v)) + obtain ⟨L₂, u₂, m₂, hL₂, hu₂, hm₂, him₂, hinj₂, hpre₂⟩ := exists_lift_line hφ hB hA₂ + (fun z hz => by + rcases huv z (hA₂c hz.1) hz.2 with h | h + · have := hvA₁ v (by + have hzu : z ∈ A₁ := h ▸ hA₁u + rcases hin ⟨hzu, hz.1⟩ with h' | h' + · have huV : u ∈ closure e ∩ G.V := hcapV ▸ mem_insert u {v} + exact (hmV ((mem_singleton_iff.mp h').symm.trans h ▸ huV.2)).elim + · have : v = u := h'.2.symm.trans h'.1 + exact this ▸ hA₁u) rfl hA₂v + exact h.trans this.symm + · exact h) + have hoff : ∀ {x y : S'}, φ x = m → φ y = m → x = y := fun {x y} hx hy => + hφ.2.2.1 (show φ x ∈ Bᶜ by rw [hx]; exact hmB) (show φ y ∈ Bᶜ by rw [hy]; exact hmB) + (hx.trans hy.symm) + obtain rfl : m₁ = m₂ := hoff hm₁ hm₂ + have hsub : L₁ ∪ L₂ ⊆ φ ⁻¹' closure e := by + rintro z (hz | hz) + · exact hA₁c (him₁ ▸ mem_image_of_mem φ hz) + · exact hA₂c (him₂ ▸ mem_image_of_mem φ hz) + have hcov : ∀ z, φ z ∈ e → z ∈ L₁ ∪ L₂ := by + intro z hz + have hzc : φ z ∈ A₁ ∪ A₂ := hun ▸ subset_closure hz + rcases hzc with h | h + · have : z ∈ φ ⁻¹' (A₁ ∪ B) := .inl h + rw [hpre₁] at this + exact .inl (this.resolve_right (heB _ hz)) + · have : z ∈ φ ⁻¹' (A₂ ∪ B) := .inl h + rw [hpre₂] at this + exact .inr (this.resolve_right (heB _ hz)) + have hAfin : ((L₁ ∪ L₂) ∩ φ ⁻¹' G.V).Finite := hf.subset inter_subset_right + have hu₁V : u₁ ∈ (L₁ ∪ L₂) ∩ φ ⁻¹' G.V := ⟨.inl hL₁.left_mem, by + change φ u₁ ∈ G.V + rw [hu₁] + exact (hcapV.symm.subset (mem_insert u {v})).2⟩ + have hu₂V : u₂ ∈ (L₁ ∪ L₂) ∩ φ ⁻¹' G.V := ⟨.inr hL₂.left_mem, by + change φ u₂ ∈ G.V + rw [hu₂] + exact (hcapV.symm.subset (mem_insert_of_mem u (mem_singleton v))).2⟩ + have hcross : ∀ z ∈ L₁ ∩ L₂, z = m₁ ∨ (z = u₁ ∧ z = u₂) := by + rintro z ⟨h₁, h₂⟩ + have hA : φ z ∈ A₁ ∩ A₂ := ⟨him₁ ▸ mem_image_of_mem φ h₁, him₂ ▸ mem_image_of_mem φ h₂⟩ + rcases hin hA with h | ⟨h, h'⟩ + · exact .inl (hoff h hm₁) + · refine .inr ⟨hinj₁ h₁ hL₁.left_mem ?_, hinj₂ h₂ hL₂.left_mem ?_⟩ + · rw [hu₁] + exact h + · rw [hu₂] + exact h' + have hdraw : ∃ D : Drawing S', D.U = L₁ ∪ L₂ ∧ D.V = (L₁ ∪ L₂) ∩ φ ⁻¹' G.V := by + by_cases heq : u₁ = u₂ + · subst heq + have hne : u₁ ≠ m₁ := fun h => hmV (by + have := hu₁V.2 + rw [h] at this + rw [← hm₁] + exact this) + have hO : IsOArc (L₁ ∪ L₂) := oArc_of_lines hL₁ hL₂ (by + ext z + constructor + · intro hz + rcases hcross z hz with h | h + · exact .inr h + · exact .inl h.1 + · rintro (rfl | h) + · exact ⟨hL₁.left_mem, hL₂.left_mem⟩ + · obtain rfl : z = m₁ := h + exact ⟨hL₁.right_mem, hL₂.right_mem⟩) + exact exists_drawing_on_oArc hO hAfin ⟨u₁, hu₁V⟩ inter_subset_left + · have hL : IsLineWithEnds (L₁ ∪ L₂) u₁ u₂ := hL₁.union hL₂.symm (by + ext z + constructor + · intro hz + rcases hcross z hz with h | h + · exact h + · exact (heq (h.1.symm.trans h.2)).elim + · intro h + obtain rfl : z = m₁ := h + exact ⟨hL₁.right_mem, hL₂.right_mem⟩) + exact exists_drawing_on_line _ hL heq hAfin hu₁V hu₂V inter_subset_left le_rfl + have hconn : IsPathConnected (φ ⁻¹' e) := by + have hu₁G : φ u₁ ∈ G.V := hu₁V.2 + have hu₂G : φ u₂ ∈ G.V := hu₂V.2 + have hin' : ∀ z, φ z ∈ closure e → φ z ∉ G.V → φ z ∈ e := fun z hz hn => by + rw [← G.closure_diff_V he] + exact ⟨hz, hn⟩ + have hmne : ∀ x, φ x ∈ G.V → m₁ ≠ x := fun x hx h => hmV (by + rw [← hm₁, h] + exact hx) + have hpart : φ ⁻¹' e = (L₁ \ {u₁}) ∪ (L₂ \ {u₂}) := by + ext z + constructor + · intro hz + have hzV : φ z ∉ G.V := (he.2.1 hz).2 + rcases hcov z hz with h | h + · exact .inl ⟨h, fun h' => hzV (by rw [mem_singleton_iff.mp h']; exact hu₁G)⟩ + · exact .inr ⟨h, fun h' => hzV (by rw [mem_singleton_iff.mp h']; exact hu₂G)⟩ + · have hcap : ∀ {w : S}, w ∈ closure e → w ∈ G.V → w = u ∨ w = v := fun {w} h₁ h₂ => by + have : w ∈ closure e ∩ G.V := ⟨h₁, h₂⟩ + rw [hcapV] at this + exact this + rintro (⟨hz, hne⟩ | ⟨hz, hne⟩) + · have hzA : φ z ∈ A₁ := him₁ ▸ mem_image_of_mem φ hz + refine hin' z (hA₁c hzA) fun hV => ?_ + have hu₀ : φ z = u := by + rcases hcap (hA₁c hzA) hV with h | h + · exact h + · exact hvA₁ _ hzA h (h ▸ hA₂v) + exact hne (hinj₁ hz hL₁.left_mem (hu₀.trans hu₁.symm)) + · have hzA : φ z ∈ A₂ := him₂ ▸ mem_image_of_mem φ hz + refine hin' z (hA₂c hzA) fun hV => ?_ + have hv₀ : φ z = v := by + rcases hcap (hA₂c hzA) hV with h | h + · rcases hin ⟨h ▸ hA₁u, hzA⟩ with h' | h' + · exact (hmV (mem_singleton_iff.mp h' ▸ hV)).elim + · exact h'.2 + · exact h + exact hne (hinj₂ hz hL₂.left_mem (hv₀.trans hu₂.symm)) + rw [hpart] + exact (isPathConnected_line_diff hL₁).union (isPathConnected_line_diff hL₂) + ⟨m₁, ⟨hL₁.right_mem, hmne _ hu₁G⟩, hL₂.right_mem, hmne _ hu₂G⟩ + exact ⟨L₁ ∪ L₂, hdraw, hsub, hcov, hconn⟩ + +/-- **The pullback of a graph.** When `U(J)` is `G`-normal, `φ⁻¹(G)` is a proper graph, and each of +its edges is the full preimage of an edge of `G`. -/ +theorem exists_pullback_graph {J G : Drawing S} {φ : S' → S} (hS : IsSurface S) + (hJ : IsCutAlongGraph J S' φ) (hG : G.IsProper) (hN : G.IsNormal J.U) : + ∃ G' : Drawing S', IsPullbackDrawing φ G G' ∧ G'.IsProper ∧ + ∀ e' ∈ G'.E, ∃ e ∈ G.E, e' = φ ⁻¹' e := by + classical + have ht2 : T2Space S := hS.2.1 + have hY := hJ.isSurface + have : CompactSpace S' := hY.1 + have : T2Space S' := hY.2.1 + have hcut := hJ.toSet + have hφ := hcut.isCutMap + have hB : IsClosed (bd S ∪ J.U) := (isClosed_bd S).union J.isClosed_U + have hUB : ∀ z ∈ G.U, z ∈ bd S ∪ J.U → z ∈ G.V := fun z hz hb => by + rcases hb with h | h + · exact hG ⟨h, hz⟩ + · exact hN ⟨h, hz⟩ + have hVf : (φ ⁻¹' G.V).Finite := Set.Finite.preimage' G.finite_V fun x _ => hcut.finite_fiber x + have hedge : ∀ e : G.E, ∃ Le : Set S', (∃ D : Drawing S', D.U = Le ∧ D.V = Le ∩ φ ⁻¹' G.V) ∧ + Le ⊆ φ ⁻¹' closure e.1 ∧ (∀ z, φ z ∈ e.1 → z ∈ Le) ∧ IsPathConnected (φ ⁻¹' e.1) := fun e => + exists_lift_edge hφ hB e.2 (fun z hz => hUB z (G.closure_subset_U e.2 hz.1) hz.2) hVf + choose Le hdraw hsub hcov hconn using hedge + have key : ∀ T : Finset (Set S), (∀ e ∈ T, e ∈ G.E) → + ∃ C : Drawing S', C.U = φ ⁻¹' G.V ∪ ⋃ e ∈ T, ⋃ he : e ∈ G.E, Le ⟨e, he⟩ ∧ C.V = φ ⁻¹' G.V + := by + intro T + induction T using Finset.induction_on with + | empty => + intro _ + exact ⟨pointsDrawing hVf, by simp [pointsDrawing], rfl⟩ + | insert e T he ih => + intro hT + obtain ⟨C, hCU, hCV⟩ := ih fun f hf => hT f (Finset.mem_insert_of_mem hf) + have heE := hT e (Finset.mem_insert_self _ _) + obtain ⟨L, hLU, hLV⟩ := hdraw ⟨e, heE⟩ + have hmeet : C.U ∩ L.U ⊆ C.V ∩ L.V := by + rw [hCU, hCV, hLU, hLV] + rintro x ⟨hx | hx, hxe⟩ + · exact ⟨hx, hxe, hx⟩ + · by_cases hxA : x ∈ φ ⁻¹' G.V + · exact ⟨hxA, hxe, hxA⟩ + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + obtain ⟨hfE, hxf⟩ := mem_iUnion.mp hxf + have h1 : φ x ∈ closure f := hsub ⟨f, hfE⟩ hxf + have h2 : φ x ∈ closure e := hsub ⟨e, heE⟩ hxe + have h1' : φ x ∈ f := G.closure_diff_V hfE ▸ (⟨h1, hxA⟩ : φ x ∈ closure f \ G.V) + have h2' : φ x ∈ e := G.closure_diff_V heE ▸ (⟨h2, hxA⟩ : φ x ∈ closure e \ G.V) + exact (he ((G.edge_eq_of_mem hfE heE h1' h2') ▸ hf)).elim + refine ⟨C.glue L hmeet, ?_, ?_⟩ + · change C.U ∪ L.U = _ + rw [hCU, hLU] + ext x + simp only [mem_union, mem_iUnion, Finset.mem_insert, exists_prop] + constructor + · rintro ((hx | ⟨f, hf, hx⟩) | hx) + · exact .inl hx + · exact .inr ⟨f, .inr hf, hx⟩ + · exact .inr ⟨e, .inl rfl, heE, hx⟩ + · rintro (hx | ⟨f, rfl | hf, hx⟩) + · exact .inl (.inl hx) + · exact .inr hx.2 + · exact .inl (.inr ⟨f, hf, hx⟩) + · change C.V ∪ L.V = _ + rw [hCV, hLV] + exact union_eq_self_of_subset_right inter_subset_right + obtain ⟨G', hU, hV⟩ := key G.finite_edges.toFinset fun e he => G.finite_edges.mem_toFinset.mp he + have hUeq : G'.U = φ ⁻¹' G.U := by + rw [hU] + ext z + constructor + · rintro (h | h) + · exact G.V_subset_U h + · obtain ⟨e, -, hz⟩ := mem_iUnion₂.mp h + obtain ⟨hE, hz⟩ := mem_iUnion.mp hz + exact G.closure_subset_U hE (hsub ⟨e, hE⟩ hz) + · intro hz + by_cases hzV : φ z ∈ G.V + · exact .inl hzV + · obtain ⟨e, he, hze⟩ := exists_edge_of_mem hz hzV + exact .inr (mem_iUnion₂.mpr ⟨e, G.finite_edges.mem_toFinset.mpr he, + mem_iUnion.mpr ⟨he, hcov ⟨e, he⟩ z hze⟩⟩) + have hφc := hJ.quotientMap.continuous + have hs := hJ.quotientMap.surjective + refine ⟨G', ⟨hUeq, hV⟩, ?_, ?_⟩ + · rintro z ⟨hzb, hzU⟩ + rw [hV] + rw [hUeq] at hzU + rw [← hJ.preimage_bd_union_U] at hzb + exact hUB _ hzU hzb + · intro e' he' + obtain ⟨x, hx⟩ := he'.1 + have hdiff : G'.U \ G'.V = φ ⁻¹' (G.U \ G.V) := by + rw [hUeq, hV] + rfl + have hx' := he'.2.1 hx + rw [hdiff] at hx' + obtain ⟨e, he, hxe⟩ := exists_edge_of_mem hx'.1 hx'.2 + refine ⟨e, he, Subset.antisymm ?_ ?_⟩ + · have hconn' : IsPathConnected (e ∪ φ '' e') := + he.2.2.1.union (he'.2.2.1.image hφc) ⟨φ x, hxe, mem_image_of_mem φ hx⟩ + have heq := he.2.2.2 _ (union_subset he.2.1 (by + rintro _ ⟨y, hy, rfl⟩ + have := he'.2.1 hy + rw [hdiff] at this + exact this)) hconn' subset_union_left + intro y hy + change φ y ∈ e + rw [← heq] + exact .inr (mem_image_of_mem φ hy) + · have hconn' : IsPathConnected (e' ∪ φ ⁻¹' e) := + he'.2.2.1.union (hconn ⟨e, he⟩) ⟨x, hx, hxe⟩ + have heq := he'.2.2.2 _ (union_subset he'.2.1 (by + rw [hdiff] + exact preimage_mono he.2.1)) hconn' subset_union_left + intro y hy + rw [← heq] + exact .inr hy + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46Reduce.lean b/LeanPool/GraphMinor/GM07/Section46Reduce.lean new file mode 100644 index 0000000000..1a7524d740 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46Reduce.lean @@ -0,0 +1,420 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46ClaimOne +public import LeanPool.GraphMinor.GM07.Section46Lambda +public import LeanPool.GraphMinor.GM07.Section46BoundaryPaths +public import LeanPool.GraphMinor.GM07.Section46Constants +public import LeanPool.GraphMinor.GM07.Section46ConstructAndCount +public import LeanPool.GraphMinor.GM07.Section46SlideWrap +import LeanPool.GraphMinor.GM07.Section46Descend +import LeanPool.GraphMinor.GM07.Section46PsiFibres +import LeanPool.GraphMinor.GM07.Section41 +import LeanPool.GraphMinor.GM07.Section46PullGraph +import LeanPool.GraphMinor.GM07.Section46NoArcs +import LeanPool.GraphMinor.GM07.Section46CuffBound +import LeanPool.GraphMinor.GM07.Section46WTransport +import LeanPool.GraphMinor.GM07.Section46Psi +import LeanPool.GraphMinor.GM07.Section46CentralLift +import LeanPool.GraphMinor.GM07.CuffSlide +import LeanPool.GraphMinor.GM07.Section35 +import LeanPool.GraphMinor.GM07.NetExists +import LeanPool.GraphMinor.GM07.NetSwapBasic +import LeanPool.GraphMinor.GM07.Section2 +import LeanPool.GraphMinor.GM07.Section2Base + +/-! +# The reduction to the disc in VII (4.6) + +Pages 224 to 228, up to the application of (4.1). From the hypotheses of (4.6) +we build the minimal net, the graphs `J`, `K`, `L`, the two cuts `θ` and `ψ`, +and the forest of claim (1). Then we pull `G` and the forest back to the disc, +and we prove `|Λ| ≤ w + k`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] + +theorem IsW36Bound.mono {X : Type} [TopologicalSpace X] {k n w w' : ℕ} (h : IsW36Bound X k n w) + (hw : w ≤ w') : IsW36Bound X k n w' := by + intro G H hG hV hH hk + obtain ⟨H', hF, hhom, hfin, hle⟩ := h G H hG hV hH hk + exact ⟨H', hF, hhom, hfin, hle.trans hw⟩ + +private theorem ncard_range_le {α β : Type*} [Finite α] (f : α → β) : + (range f).ncard ≤ Nat.card α := by + rw [← image_univ] + exact (ncard_image_le finite_univ).trans_eq (ncard_univ α) + +/-- The two components of `bd(Δ) - {s, t}` lie in `bd(Δ)` and are disjoint. -/ +private theorem components_facts {D : Type} [TopologicalSpace D] {s t : D} {C₁ C₂ : Set D} + (h : componentsIn (bd D \ {s, t}) = {C₁, C₂}) (hne : C₁ ≠ C₂) : + C₁ ⊆ bd D ∧ C₂ ⊆ bd D ∧ Disjoint C₁ C₂ := by + have hmem : ∀ C ∈ componentsIn (bd D \ {s, t}), C ⊆ bd D := by + rintro _ ⟨x, -, rfl⟩ + exact (connectedComponentIn_subset _ _).trans sdiff_subset + have h₁ : C₁ ∈ componentsIn (bd D \ {s, t}) := h ▸ mem_insert _ _ + have h₂ : C₂ ∈ componentsIn (bd D \ {s, t}) := h ▸ mem_insert_of_mem _ rfl + refine ⟨hmem _ h₁, hmem _ h₂, ?_⟩ + obtain ⟨x, hx, rfl⟩ := h₁ + obtain ⟨y, hy, rfl⟩ := h₂ + rw [disjoint_left] + intro z hz₁ hz₂ + exact hne ((connectedComponentIn_eq hz₁).trans (connectedComponentIn_eq hz₂).symm) + +private theorem bound_lifted_seam_vertices + {S : Type} + [TopologicalSpace S] + (k : ℕ) + (G : Drawing S) + (a : ℕ) + (b : ℕ) + (c : ℕ) + (J : Drawing S) + (γ : Set S → ↑unitInterval → S) + (s : ↑(longSeamEdges G J (muModel a b c k) (wMaxModel a b c k)) → ↑unitInterval) + (t : ↑(longSeamEdges G J (muModel a b c k) (wMaxModel a b c k)) → ↑unitInterval) + (W : ↑(longSeamEdges G J (muModel a b c k) (wMaxModel a b c k)) → Set S) + (K : Drawing S) + (hparts : ∀ (e : ↑(longSeamEdges G J (muModel a b c k) (wMaxModel a b c k))), s e ∈ Ioo 0 1 ∧ + t e ∈ Ioo 0 1 ∧ s e < t e ∧ W e = {γ (↑e) (s e), γ (↑e) (t e)} ∧ (W e).ncard = 2 ∧ W e ⊆ ↑e + ∩ G.V ∧ (γ ↑e '' Iic (s e) ∩ G.V).ncard = muModel a b c k + 1 ∧ (γ ↑e '' Ici (t e) ∩ + G.V).ncard = muModel a b c k + 1 ∧ wMaxModel a b c k ≤ (γ ↑e '' Ioo (s e) (t e) ∩ + G.V).ncard) + (hKV : K.V = ⋃ e, W e) + (S' : Type) + [TopologicalSpace S'] + (θ : S' → S) + (hinj : InjOn θ (θ ⁻¹' K.U)) + (K' : Drawing S') + (hp : IsPullbackDrawing θ K K') + (hJE : J.E.ncard ≤ 3 * (2 * a + b + c - 1)) : + K'.V.ncard ≤ 2 * (3 * (2 * a + b + c - 1)) := by + let μ := muModel a b c k + let w := wMaxModel a b c k + have : Finite (longSeamEdges G J μ w) := + Set.Finite.to_subtype (J.finite_edges.subset fun e (he : e ∈ longSeamEdges G J μ w) => he.1) + have hK'sub : InjOn θ K'.V := hinj.mono fun x hx => by + have := K'.V_subset_U hx + rw [hp.1] at this + exact this + have h1 : K'.V.ncard = (θ '' K'.V).ncard := (hK'sub.ncard_image).symm + have h2 : θ '' K'.V ⊆ K.V := by + rw [hp.2] + exact image_preimage_subset _ _ + have h3 : K.V ⊆ range fun p : longSeamEdges G J μ w × Bool => + bif p.2 then γ p.1.1 (s p.1) else γ p.1.1 (t p.1) := by + rw [hKV] + intro x hx + obtain ⟨e, he⟩ := mem_iUnion.mp hx + rw [(hparts e).2.2.2.1] at he + rcases he with rfl | h + · exact ⟨(e, true), rfl⟩ + · exact ⟨(e, false), (mem_singleton_iff.mp h).symm⟩ + have hrf := Set.toFinite (range fun p : longSeamEdges G J μ w × Bool => + bif p.2 then γ p.1.1 (s p.1) else γ p.1.1 (t p.1)) + have h4 := ncard_le_ncard h2 (hrf.subset h3) + have h5 := ncard_le_ncard h3 hrf + have h6 := ncard_range_le fun p : longSeamEdges G J μ w × Bool => + bif p.2 then γ p.1.1 (s p.1) else γ p.1.1 (t p.1) + have h7 : Nat.card (longSeamEdges G J μ w × Bool) = 2 * (longSeamEdges G J μ w).ncard := by + rw [Nat.card_prod, Nat.card_coe_set_eq, Nat.card_eq_fintype_card, Fintype.card_bool, mul_comm] + have h8 : (longSeamEdges G J μ w).ncard ≤ J.E.ncard := + ncard_le_ncard (fun e he => he.1) J.finite_edges + omega + +private theorem boundary_vertex_lifts_to_cuff + {S : Type} + [TopologicalSpace S] + [T1Space S] + (hS : IsSurface S) + [ConnectedSpace S] + (hcuffs : 2 ≤ (cuffs S).ncard) + (k : ℕ) + (G : Drawing S) + (hG : G.IsProper) + (hbd : (G.V ∩ bd S).ncard ≤ 2 * k) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) + (a : ℕ) + (b : ℕ) + (c : ℕ) + (hii : ∀ (B : Set S), G.IsNormal B → IsOArc B → (G.V ∩ B).ncard ≤ vModel a b c k → + IsNullHomotopicOArc B ∨ ∃ C ∈ cuffs S, IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) + (hc : 2 ≤ c) + [hmodel : Nonempty (S ≃ₜ SurfaceModel a b c)] + (hv : vSurface S k = vModel a b c k) + (N : Net S) + (hmin : N.IsMinimalFor G) + (J : Drawing S) + (hJ : N.IsSeamGraphFor J) + (hnorm : G.IsNormal J.U) + (z : S) + (hz : z ∈ G.V ∩ bd S) : + ∃ l : N.D, N.φ l = z ∧ ∃ C ∈ cuffs S, z ∈ C ∧ + ∃ (n : ℕ) (P : Fin n → Drawing S) (e : Fin n → S), + (∀ i, (P i).IsSubdrawing G ∧ e i ∈ G.V ∩ (bd S \ C) ∧ (P i).IsPathBetween z (e i)) ∧ + (∀ i j, i ≠ j → Disjoint ((P i).V \ {z, e i}) ((P j).V \ {z, e j})) ∧ + ∃ I : Finset (Fin n), muModel a b c k ≤ I.card ∧ + ∀ i ∈ I, ∃ f ∈ (P i).E, l ∈ closure (N.φ ⁻¹' f) ∧ + ∀ x ∈ closure (N.φ ⁻¹' f), N.φ x = z → x = l := by + obtain ⟨C, hC, hzC⟩ : ∃ C ∈ cuffs S, z ∈ C := by + have := hz.2 + rw [← sUnion_cuffs] at this + exact this + obtain ⟨C', hC', hne⟩ := Set.exists_ne_of_one_lt_ncard (s := cuffs S) + (lt_of_lt_of_le one_lt_two hcuffs) C + obtain ⟨P, e, l, hl, h1, h2, h3⟩ := N.exists_boundary_paths_and_lift_4_6 hS hc hmodel hv hG hmin + hJ hnorm hbd (by rw [hv]; exact hii) hiii hC hC' hne.symm hz.1 hzC + exact ⟨l, hl, C, hC, hzC, _, P, e, h1, h2, h3⟩ + +/-- Pages 224 to 228 of VII (4.6). -/ +theorem exists_disc_reduction [T1Space S] (hS : IsSurface S) [ConnectedSpace S] + (hcuffs : 2 ≤ (cuffs S).ncard) (k : ℕ) (G H : Drawing S) + (hG : G.IsProper) (hbd : (G.V ∩ bd S).ncard ≤ 2 * k) + (hi : ∀ B : Set S, G.IsNormal B → IsIArc B → (G.V ∩ B).ncard ≤ vSurface S k → + ∃ C ∈ cuffs S, lineEnds B ⊆ C) + (hii : ∀ B : Set S, G.IsNormal B → IsOArc B → (G.V ∩ B).ncard ≤ vSurface S k → + IsNullHomotopicOArc B ∨ + ∃ C ∈ cuffs S, IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) + (hH : IsSurfaceForest H) (hbdeq : G.V ∩ bd S = H.V ∩ bd S) : + ∃ (N : Net S) (J K : Drawing S) (a b c : ℕ) (Gd Hd : Drawing N.D) + (γ : Set S → unitInterval → S) + (sK tK : longSeamEdges G J (muModel a b c k) (wMaxModel a b c k) → unitInterval) + (l : S → N.D), + N.IsMinimalFor G ∧ N.IsSeamGraphFor J ∧ 2 ≤ c ∧ Nonempty (S ≃ₜ SurfaceModel a b c) ∧ + vSurface S k = vModel a b c k ∧ IsPullbackDrawing N.φ G Gd ∧ EdgePar J γ ∧ + (∀ e, sK e ∈ Ioo 0 1 ∧ tK e ∈ Ioo 0 1 ∧ sK e < tK e ∧ + (γ e.1 '' Iic (sK e) ∩ G.V).ncard = muModel a b c k + 1 ∧ + (γ e.1 '' Ici (tK e) ∩ G.V).ncard = muModel a b c k + 1) ∧ + K.U ⊆ (⋃ e, γ e.1 '' Icc (sK e) (tK e)) ∧ + (∀ z ∈ G.V ∩ bd S, N.φ (l z) = z ∧ ∃ C ∈ cuffs S, z ∈ C ∧ + ∃ (n : ℕ) (P : Fin n → Drawing S) (e : Fin n → S), + (∀ i, (P i).IsSubdrawing G ∧ e i ∈ G.V ∩ (bd S \ C) ∧ (P i).IsPathBetween z (e i)) ∧ + (∀ i j, i ≠ j → Disjoint ((P i).V \ {z, e i}) ((P j).V \ {z, e j})) ∧ + ∃ I : Finset (Fin n), muModel a b c k ≤ I.card ∧ + ∀ i ∈ I, ∃ f ∈ (P i).E, l z ∈ closure (N.φ ⁻¹' f) ∧ + ∀ x ∈ closure (N.φ ⁻¹' f), N.φ x = z → x = l z) ∧ + Gd.IsProper ∧ IsSurfaceForest Hd ∧ Hd.V ∩ bd N.D = Gd.V ∩ bd N.D ∧ + (IsGFeasible Gd Hd → IsGFeasible G H) ∧ + ∀ s t : N.D, ∀ C₁ C₂ : Set N.D, componentsIn (bd N.D \ {s, t}) = {C₁, C₂} → C₁ ≠ C₂ → + ∀ Λ : Set (Set N.D), Λ = {V₀ : Set N.D | ∃ C : Drawing N.D, + GM06.IsGraphComponent C.toGraph Hd.toGraph ∧ V₀ = C.V ∧ + (V₀ ∩ C₁).Nonempty ∧ (V₀ ∩ C₂).Nonempty ∧ s ∉ V₀ ∧ t ∉ V₀} → + Λ.ncard ≤ wMaxModel a b c k + k ∧ Λ.PairwiseDisjoint id ∧ + (∀ lam ∈ Λ, (lam ∩ C₁).Nonempty ∧ (lam ∩ C₂).Nonempty) ∧ + ∀ lam ∈ Λ, ∀ d ∈ lam ∩ (C₁ ∪ C₂), d ∈ Gd.V ∧ + (N.φ d ∈ K.U ∨ ∃ z ∈ G.V ∩ bd S, d = l z) := by + classical + have : T2Space S := hS.2.1 + have : Nonempty S := inferInstance + obtain ⟨a, b, c, hc, hmodel, hv⟩ := exists_model_vSurface_two_cuffs hS hcuffs k + obtain ⟨N, hmin⟩ := exists_minimal_net S hS inferInstance hcuffs G hG + obtain ⟨J, hJ, hnorm⟩ := hmin.1 + obtain ⟨γ, hγ, hsides⟩ := N.exists_edgePar_sides hJ + set μ := muModel a b c k with hμ + set w := wMaxModel a b c k with hw + obtain ⟨s, t, W, J', K, L, hparts, hU, hV, hKsub, hKV, hKE, hLsub, hLV, hLE, hLp, hLn, hLc⟩ := + exists_seam_parts_with_L_bound hS N hG hmin hJ hc hmodel hcuffs hbd hiii hγ + rw [hv] at hi hii + have h2k : 2 * k ≤ vModel a b c k := by + unfold vModel + omega + have hsum : (G.V ∩ L.U).ncard + (G.V ∩ bd S).ncard ≤ vModel a b c k := by omega + obtain ⟨S', top, θ, c', hθ, -, hmodel'⟩ := + exists_cut_L_4_6 hS hmodel N hcuffs hJ hG hnorm hLsub hU hLp hLn hsum hi hii hiii + have hNo := noArcs_L_of_contact_sum hS N hcuffs hJ hG hnorm hLsub hU hLp hsum hi hii hiii + have hbounds := constants_bounds_4_6 (a := a) (b := b) (k := k) hc + have hsmall : (G.V ∩ bd S).ncard < 2 * μ + w + 2 := by omega + have hlong : ∀ e : longSeamEdges G J μ w, Disjoint e.1 (bd S) := fun e => + longSeamEdge_disjoint_bd hS N hJ hbd e.2 + obtain ⟨hPair, hKp, hKL, hKn, hKU, hcover, hoff⟩ := central_K_facts hS N hJ hγ + (fun e => ⟨(hparts e).1, (hparts e).2.1, (hparts e).2.2.1, (hparts e).2.2.2.1, + (hparts e).2.2.2.2.1⟩) hsmall hlong hU hV hKsub hKV hKE hLsub hLV hLE + have hJU : J.U = bd S ∪ L.U ∪ K.U := by rw [hcover]; exact hJ.2.1 + have hLseam : L.U ⊆ N.seamU := by + rw [← hcover] + exact fun x hx => .inl (.inr hx) + obtain ⟨ψ, hψc, hψs, hψ⟩ := N.exists_psi hS hθ hLseam + have hS' := hθ.isSurface + have : T2Space S' := hS'.2.1 + choose i hi using fun e : longSeamEdges G J μ w => + hsides e.1 e.2.1 (disjoint_iff_inter_eq_empty.mp (hlong e)) + have hIoo : ∀ e, ∀ r ∈ Icc (s e) (t e), r ∈ Ioo (0 : unitInterval) 1 := fun e r hr => + ⟨lt_of_lt_of_le (hparts e).1.1 hr.1, lt_of_le_of_lt hr.2 (hparts e).2.1.2⟩ + have hoff' : ∀ e, ∀ r ∈ Ioo (s e) (t e), N.φ (N.f (i e) r) ∉ bd S ∪ L.U := fun e r hr => by + rw [← hi e r] + exact hoff e r hr + have hsame : ∀ e, ∀ r ∈ Icc (s e) (t e), ψ (N.f (i e) r) = ψ (N.g (i e) r) := fun e => + N.psi_sides_eq hθ hψc hψ (i e) (hparts e).2.2.1 (hoff' e) + have hfibre : ∀ e, ∀ r ∈ Icc (s e) (t e), ∀ z : S', θ z = γ e.1 r → z = ψ (N.f (i e) r) := by + intro e r hr z hz + obtain ⟨z₀, rfl⟩ := hψs z + have hmem : z₀ ∈ N.φ ⁻¹' {N.φ (N.f (i e) r)} := by + change N.φ z₀ = _ + rw [← hψ z₀, hz, hi e r] + rw [N.fiber_eq_pair_of_mem_Ioo (i e) (hIoo e r hr)] at hmem + rcases hmem with h | h + · rw [h] + · rw [mem_singleton_iff.mp h, hsame e r hr] + have hinj : InjOn θ (θ ⁻¹' K.U) := by + intro x hx y hy hxy + obtain ⟨e, r, hr, hrr⟩ := mem_iUnion.mp (hKU hx) + rw [hfibre e r hr x hrr.symm, hfibre e r hr y (hxy ▸ hrr.symm)] + obtain ⟨K', hp, hmatch, hpair⟩ := exists_lifted_matching hS hθ hPair hKp hKL hKn hinj + have hψcut := N.isCutAlongGraph_psi hθ hp hmatch hpair hψc hψs hψ hcover + have hendsG : ∀ e, γ e.1 (s e) ∈ G.V ∧ γ e.1 (t e) ∈ G.V := fun e => by + have hW := (hparts e).2.2.2.2.2.1 + have heq := (hparts e).2.2.2.1 + exact ⟨(hW (heq ▸ mem_insert _ _)).2, (hW (heq ▸ mem_insert_of_mem _ rfl)).2⟩ + have hendsL : ∀ e, γ e.1 (s e) ∈ L.U ∧ γ e.1 (t e) ∈ L.U := fun e => by + have heq := (hparts e).2.2.2.1 + have hsub : W e ⊆ L.U := fun x hx => L.V_subset_U (by + rw [hLV, hV] + exact .inr (mem_iUnion.mpr ⟨e, hx⟩)) + exact ⟨hsub (heq ▸ mem_insert _ _), hsub (heq ▸ mem_insert_of_mem _ rfl)⟩ + have hKIoo : ∀ e, ∀ r ∈ Ioo (s e) (t e), γ e.1 r ∈ K.U := fun e r hr => by + have hseam : γ e.1 r ∈ bd S ∪ L.U ∪ K.U := by + rw [hcover, hi e r] + exact mem_image_of_mem _ (N.range_f_subset_bd _ (mem_range_self r)) + exact hseam.resolve_left (hoff e r hr) + have hslide := N.exists_matching_slide hγ hsides hlong s t + (fun e => ⟨(hparts e).1, (hparts e).2.1, (hparts e).2.2.1⟩) hendsG hendsL + (fun e => (hparts e).2.2.2.2.2.2.2.2) hKU hKIoo hoff hθ hp hψcut hψc hψs hψ hinj + have habc : 2 * a + b + c > 1 := by omega + obtain ⟨-, hJE⟩ := theorem_2_4_proof hS habc hmodel hG hmin hJ + have hK'c : K'.V.ncard ≤ 2 * (3 * (2 * a + b + c - 1)) := by + exact bound_lifted_seam_vertices (S := S) k G a b c J γ s t W K hparts hKV S' θ hinj K' + hp hJE + have hcc := cut_model_cuff_bound_4_6 hS N hG hmin hJ hc hmodel hmodel' hγ s t W + (fun e => ⟨(hparts e).1, (hparts e).2.1, (hparts e).2.2.1, (hparts e).2.2.2.1⟩) hU hV hLE hLn + hθ hNo + have hw36 : IsW36Bound S' (2 * k) (3 * (2 * a + b + c - 1)) w := + (theorem_3_6_proof hS' _ _).mono + (wSurface_cut_model_le_wMaxModel hmodel' hcc) + have hlift : ∀ z ∈ G.V ∩ bd S, ∃ l : N.D, N.φ l = z ∧ ∃ C ∈ cuffs S, z ∈ C ∧ + ∃ (n : ℕ) (P : Fin n → Drawing S) (e : Fin n → S), + (∀ i, (P i).IsSubdrawing G ∧ e i ∈ G.V ∩ (bd S \ C) ∧ (P i).IsPathBetween z (e i)) ∧ + (∀ i j, i ≠ j → Disjoint ((P i).V \ {z, e i}) ((P j).V \ {z, e j})) ∧ + ∃ I : Finset (Fin n), muModel a b c k ≤ I.card ∧ + ∀ i ∈ I, ∃ f ∈ (P i).E, l ∈ closure (N.φ ⁻¹' f) ∧ + ∀ x ∈ closure (N.φ ⁻¹' f), N.φ x = z → x = l := fun z hz => by + exact boundary_vertex_lifts_to_cuff (S := S) hS hcuffs k G hG hbd hiii a b c hii hc hv N hmin + J hJ hnorm z hz + have : Nonempty N.D := ⟨(N.quotientMap_φ.surjective (Classical.arbitrary S)).choose⟩ + choose! l hl using hlift + have hnormL : G.IsNormal L.U := fun x hx => hnorm ⟨hJU ▸ .inl (.inr hx.1), hx.2⟩ + obtain ⟨H₆, H₆', T, hF₆, hhom₆, hp₆, hF₆', hE₆, hmain, hGV, hTc, hT, hTf, hTc', hTb⟩ := + exists_claim_one hS hθ hNo hH hbdeq hbd (fun z => ψ (l z)) + (fun z hz => by rw [hψ, (hl z hz).1]) hp hmatch hK'c hw36 hslide + have hnormH : H₆.IsNormal L.U := fun x hx => hGV (hmain ⟨hx.2, .inl (.inr hx.1)⟩) + have hnormH' : H₆'.IsNormal K'.U := by + rintro x ⟨hxK, hxU⟩ + rw [hp₆.2] + rw [hp₆.1] at hxU + rw [hp.1] at hxK + exact hGV (hmain ⟨hxU, .inr hxK⟩) + obtain ⟨Hd, hpd, hFd⟩ := exists_pull_forest hS' hψcut hF₆' hnormH' + obtain ⟨G₁, hG₁, hG₁p, hG₁E⟩ := exists_pullback_graph hS hθ hG hnormL + have hnormG₁ : G₁.IsNormal K'.U := by + rintro x ⟨hxK, hxU⟩ + rw [hG₁.2] + rw [hG₁.1] at hxU + rw [hp.1] at hxK + exact hnorm ⟨hJU ▸ .inr hxK, hxU⟩ + obtain ⟨Gd, hGd, hGdp, hGdE⟩ := exists_pullback_graph hS' hψcut hG₁p hnormG₁ + have hcomp : θ ∘ ψ = N.φ := funext hψ + have hE : ∀ e' ∈ Gd.E, ∃ e ∈ G.E, (θ ∘ ψ) '' e' = e := by + intro e' he' + obtain ⟨e₁, he₁, rfl⟩ := hGdE e' he' + obtain ⟨g, hg, rfl⟩ := hG₁E e₁ he₁ + refine ⟨g, hg, ?_⟩ + rw [← preimage_comp, image_preimage_eq _ (hθ.quotientMap.surjective.comp hψs)] + have hpull : IsPullbackDrawing N.φ G Gd := by + rw [← hcomp] + exact ⟨by rw [hGd.1, hG₁.1, preimage_comp], by rw [hGd.2, hG₁.2, preimage_comp]⟩ + have hHd : Hd.V = N.φ ⁻¹' H₆.V := by + rw [← hcomp, hpd.2, hp₆.2, preimage_comp] + have hbdD : Hd.V ∩ bd N.D = Gd.V ∩ bd N.D := by + rw [hHd, hpull.2] + ext x + constructor + · rintro ⟨hx, hb⟩ + refine ⟨?_, hb⟩ + have hseam : N.φ x ∈ bd S ∪ L.U ∪ K.U := by + rw [hcover] + exact mem_image_of_mem _ hb + exact hmain ⟨H₆.V_subset_U hx, hseam⟩ + · rintro ⟨hx, hb⟩ + exact ⟨hGV hx, hb⟩ + have : T2Space N.D := N.isSurface_D.2.1 + have hTbf : (T ∩ bd S').Finite := ((G.finite_V.subset inter_subset_left).image _).subset hTb + have hTbc : (T ∩ bd S').ncard ≤ 2 * k := + (ncard_le_ncard hTb ((G.finite_V.subset inter_subset_left).image _)).trans + ((ncard_image_le (G.finite_V.subset inter_subset_left)).trans hbd) + have hfib : ∀ v ∈ K'.U, (ψ ⁻¹' {v}).ncard ≤ 2 := by + intro v hv' + have hvK : θ v ∈ K.U := by + rw [hp.1] at hv' + exact hv' + obtain ⟨e, r, hr, hrr⟩ := mem_iUnion.mp (hKU hvK) + have hsub : ψ ⁻¹' {v} ⊆ N.φ ⁻¹' {N.φ (N.f (i e) r)} := by + intro x hx + change N.φ x = _ + rw [← hψ x, show ψ x = v from hx, ← hrr, hi e r] + have h2 := N.fiber_ncard_two_of_mem_Ioo (i e) (hIoo e r hr) + rw [← h2] + exact ncard_le_ncard hsub (N.finite_fiber _) + refine ⟨N, J, K, a, b, c, Gd, Hd, γ, s, t, l, hmin, hJ, hc, hmodel, hv, hpull, hγ, + fun e => ⟨(hparts e).1, (hparts e).2.1, (hparts e).2.2.1, (hparts e).2.2.2.2.2.2.1, + (hparts e).2.2.2.2.2.2.2.1⟩, hKU, hl, hGdp, hFd, hbdD, ?_, ?_⟩ + · intro hfe + have hfe₆ : IsGFeasible G H₆ := isGFeasible_of_pullback hS hθ hψcut hF₆ hnormH hF₆' hnormH' + hp₆ hpd hG₁ hGd hE hfe + obtain ⟨X, hX, hhX, hsub⟩ := hfe₆ + exact ⟨X, hX, hhom₆.trans hhX, hsub⟩ + · rintro s₀ t₀ C₁ C₂ hcomps hne Λ rfl + obtain ⟨hC₁, hC₂, hdis⟩ := components_facts hcomps hne + refine ⟨card_Lambda_le hS' hψcut hpd hTc hT hTf hTc' hTbf hTbc hfib hC₁ hC₂ hdis s₀ t₀, ?_, + ?_, ?_⟩ + · rintro A ⟨C, hC, rfl, -⟩ B ⟨C', hC', rfl, -⟩ hAB + change Disjoint C.V C'.V + rw [disjoint_left] + intro x hx hx' + have : C.toGraph = C'.toGraph := hC.eq_of_mem_mem hC' hx hx' + exact hAB (congrArg (fun g : Graph N.D (Set N.D) => g.vertexSet) this) + · rintro _ ⟨C, -, rfl, h₁, h₂, -⟩ + exact ⟨h₁, h₂⟩ + · rintro _ ⟨C, hC, rfl, ⟨d₁, hd₁, hd₁C⟩, ⟨d₂, hd₂, hd₂C⟩, -⟩ d ⟨hd, hdC⟩ + have hne' : d₁ ≠ d₂ := fun h => disjoint_left.mp hdis hd₁C (h ▸ hd₂C) + have hdb : d ∈ bd N.D := hdC.elim (fun h => hC₁ h) fun h => hC₂ h + have hdHd : d ∈ Hd.V := hC.1.vertexSet_mono hd + have hdG : d ∈ Gd.V := (hbdD.subset ⟨hdHd, hdb⟩).1 + obtain ⟨d', hd', hdne⟩ : ∃ d' ∈ C.V, d ≠ d' := by + by_cases h : d = d₁ + · exact ⟨d₂, hd₂, h ▸ hne'⟩ + · exact ⟨d₁, hd₁, h⟩ + obtain ⟨hT₁, hor⟩ := image_mem_of_component hψcut hpd hTc hT hC hd hd' hdne hdb + refine ⟨hdG, ?_⟩ + by_cases hK : ψ d ∈ K'.U + · left + rw [← hψ d] + rw [hp.1] at hK + exact hK + · right + obtain ⟨z, hz, hzeq⟩ := hTb _ ⟨hT₁, hor.resolve_left hK⟩ + exact ⟨z, hz, hψcut.eq_of_eq_of_notMem hS' hzeq.symm hK⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46Refine.lean b/LeanPool/GraphMinor/GM07/Section46Refine.lean new file mode 100644 index 0000000000..80f6cbb434 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46Refine.lean @@ -0,0 +1,165 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Matched +public import LeanPool.GraphMinor.GM07.Section46CentralLift +import LeanPool.GraphMinor.GM07.Section46JPlus +import LeanPool.GraphMinor.GM07.Section46WalkOfConnected +import LeanPool.GraphMinor.GM07.ForestFlat +import LeanPool.GraphMinor.GM07.CuffForest +import LeanPool.GraphMinor.GM07.CuffStep +import LeanPool.GraphMinor.GM11.Section4 +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Adding vertices to a forest + +The forest `H₆` of VII (4.6), page 227, is `H₅` with all of `V(G)` added +as vertices. Some of the new vertices lie on edges and others off `U(H₅)`. +The result is a forest with the same paths between boundary vertices, by +`exists_walk_of_preconnected`, and curves in a forest with the same ends +are homotopic. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A walk contains a simple walk with the same ends. -/ +theorem exists_simple_walk_of_walk {Γ : Drawing S} {a b : S} (W : GraphWalk Γ.toGraph a b) : + ∃ W' : GraphWalk Γ.toGraph a b, W'.IsSimple := by + induction W with + | nil h => exact ⟨.nil h, by simp [GraphWalk.IsSimple, GraphWalk.support]⟩ + | @cons u v w e h r ih => + obtain ⟨r', hr'⟩ := ih + by_cases hu : u ∈ r'.support + · obtain ⟨R₁, R₂, rfl⟩ := r'.exists_append_of_mem hu + exact ⟨R₂, (isSimple_of_append hr').2⟩ + · exact ⟨.cons h r', List.nodup_cons.mpr ⟨hu, hr'⟩⟩ + +variable [T1Space S] + +omit [T1Space S] in +theorem isPreconnected_closure_of_mem_E {Γ : Drawing S} {e : Set S} (he : e ∈ Γ.E) : + IsPreconnected (closure e) := + he.2.2.1.isConnected.isPreconnected.closure + +/-- A forest with more vertices has the same paths between boundary vertices, in VII (4.6), +page 227. -/ +theorem exists_refined_forest {S : Type} [TopologicalSpace S] [T1Space S] [ConnectedSpace S] + (hS : IsSurface S) {H : Drawing S} + (hH : IsSurfaceForest H) {W : Set S} (hW : W.Finite) (hWbd : W ∩ bd S ⊆ H.V) : + ∃ H₆ : Drawing S, H₆.U = H.U ∪ W ∧ H₆.V = H.V ∪ W ∧ IsSurfaceForest H₆ ∧ + ForestsHomotopic H H₆ ∧ ∀ e' ∈ H₆.E, ∃ e ∈ H.E, e' ⊆ e := by + classical + have : T2Space S := hS.2.1 + have hf₀ : (W ∩ H.U).Finite := hW.subset inter_subset_left + obtain ⟨D, hDU, hDV⟩ := exists_drawing_with_more_vertices H (H.finite_V.union hf₀) + subset_union_left (union_subset H.V_subset_U inter_subset_right) + have hDp : D.IsProper := by + rintro x ⟨hb, hx⟩ + rw [hDV] + exact .inl (hH.1 ⟨hb, hDU ▸ hx⟩) + have hDf : IsSurfaceForest D := ⟨hDp, isForest_of_noOArc fun F hF hs => + noOArc_of_forest hH.2 hF (hDU ▸ hs)⟩ + have hdis : Disjoint (W \ H.U) D.U := by + rw [hDU] + exact disjoint_sdiff_left + let H₆ := addIsolated D (W \ H.U) (hW.subset sdiff_subset) hdis + have hU : H₆.U = H.U ∪ W := by + change D.U ∪ (W \ H.U) = _ + rw [hDU, union_sdiff_self] + have hV : H₆.V = H.V ∪ W := by + change D.V ∪ (W \ H.U) = _ + rw [hDV] + ext x + simp only [mem_union, mem_inter_iff, mem_sdiff] + tauto + have hF : IsSurfaceForest H₆ := hDf.addIsolated hS _ hdis + have hedge : ∀ e' ∈ H₆.E, e' ⊆ H.U \ H.V := by + intro e' he' x hx + have hx' := he'.2.1 hx + rw [hU, hV] at hx' + refine ⟨?_, fun h => hx'.2 (.inl h)⟩ + rcases hx'.1 with h | h + · exact h + · exact (hx'.2 (.inr h)).elim + have hedge' : ∀ e' ∈ H₆.E, closure e' ⊆ H.U := fun e' he' => + closure_minimal ((hedge e' he').trans sdiff_subset) H.isClosed_U + have hsub : H.U ⊆ H₆.U := hU ▸ subset_union_left + have hup : ∀ {x y : S}, GraphWalk H.toGraph x y → Nonempty (GraphWalk H₆.toGraph x y) := by + intro x y W + induction W with + | nil h => exact ⟨.nil (show _ ∈ H₆.V from hV ▸ .inl h)⟩ + | @cons u v w e h r ih => + obtain ⟨R⟩ := ih + have hc : closure e ∩ H.V = {u, v} := h.2.2.2 + have hu : u ∈ closure e := (hc.symm.subset (by simp)).1 + have hv : v ∈ closure e := (hc.symm.subset (by simp)).1 + obtain ⟨Q⟩ := exists_walk_of_preconnected H₆ (isPreconnected_closure_of_mem_E h.1) + ((H.closure_subset_U h.1).trans hsub) (hV ▸ .inl h.2.1) hu (hV ▸ .inl h.2.2.1) hv + exact ⟨Q.append R⟩ + have hdown : ∀ {x y : S}, GraphWalk H₆.toGraph x y → x ∈ H.U → + ∃ A : Set S, IsPreconnected A ∧ A ⊆ H.U ∧ x ∈ A ∧ y ∈ A := by + intro x y W + induction W with + | nil h => + intro hx + exact ⟨{_}, isPreconnected_singleton, singleton_subset_iff.mpr hx, rfl, rfl⟩ + | @cons u v w e h r ih => + intro _ + have hc : closure e ∩ H₆.V = {u, v} := h.2.2.2 + have hu : u ∈ closure e := (hc.symm.subset (by simp)).1 + have hv : v ∈ closure e := (hc.symm.subset (by simp)).1 + obtain ⟨A, hA, hAU, hvA, hwA⟩ := ih (hedge' e h.1 hv) + exact ⟨closure e ∪ A, (isPreconnected_closure_of_mem_E h.1).union v hv hvA hA, + union_subset (hedge' e h.1) hAU, .inl hu, .inr hwA⟩ + refine ⟨H₆, hU, hV, hF, ⟨hH.1, hF.1, hH.2, hF.2, ?_, ?_⟩, ?_⟩ + · rw [hV] + ext x + constructor + · rintro ⟨hx, hb⟩ + exact ⟨.inl hx, hb⟩ + · rintro ⟨hx | hx, hb⟩ + · exact ⟨hx, hb⟩ + · exact ⟨hWbd ⟨hx, hb⟩, hb⟩ + · intro s hs t ht _ + have hs₆ : s ∈ H₆.V := hV ▸ .inl hs.1 + have ht₆ : t ∈ H₆.V := hV ▸ .inl ht.1 + refine ⟨⟨?_, ?_⟩, ?_⟩ + · rintro ⟨P, -⟩ + obtain ⟨Q⟩ := hup P + exact exists_simple_walk_of_walk Q + · rintro ⟨P, -⟩ + obtain ⟨A, hA, hAU, hsA, htA⟩ := hdown P (H.V_subset_U hs.1) + obtain ⟨Q⟩ := exists_walk_of_preconnected H hA hAU hs.1 hsA ht.1 htA + exact exists_simple_walk_of_walk Q + · intro P₁ P₂ φ₁ φ₂ _ _ h₁ h₂ + have e₁ := h₁.endpoints + have e₂ := h₂.endpoints + have hflat := isFlat_forest hF.2 + exact IsFlat.curvesHomotopic hflat + ((h₁.range_subset_U).trans hsub) h₂.range_subset_U (e₁.1.trans e₂.1.symm) + (e₁.2.trans e₂.2.symm) + · intro e' he' + have hx := he'.1 + obtain ⟨x, hx⟩ := hx + have hxU : x ∈ H.U \ H.V := hedge e' he' hx + let C := pathComponentIn (H.U \ H.V) x + have hC : C ∈ H.E := pathComponentIn_mem_arcComponentsIn hxU + exact ⟨C, hC, he'.2.2.1.subset_pathComponentIn hx (hedge e' he')⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46RefinedEdges.lean b/LeanPool/GraphMinor/GM07/Section46RefinedEdges.lean new file mode 100644 index 0000000000..d735bfe238 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46RefinedEdges.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.PullForest + +/-! +# Edges after adding the cut vertices + +For `J⁺` in VII (4.6), page 225, every new edge stays in an old edge. +An old edge containing no new vertex remains an edge. A drawing on one +closed old edge with exactly its marked vertices supplies actual edges +of `J⁺`. These facts identify the short, linking, and central edges. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +private theorem refined_off_vertices_subset {J J' : Drawing S} {W : Set S} + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ W) : J'.U \ J'.V ⊆ J.U \ J.V := by + rw [hU, hV] + exact sdiff_subset_sdiff_right subset_union_left + +/-- A refined edge is contained in an old edge, in the construction of +`J⁺` in VII (4.6), page 225. -/ +theorem refined_edge_subset_old_edge {J J' : Drawing S} {W : Set S} + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ W) {f : Set S} (hf : f ∈ J'.E) : + ∃ e ∈ J.E, f ⊆ e := by + have hsub := refined_off_vertices_subset hU hV + obtain ⟨x, hxf⟩ := hf.1 + have hx := hsub (hf.2.1 hxf) + obtain ⟨e, he, hxe⟩ := exists_edge_of_mem hx.1 hx.2 + have hconn := he.2.2.1.union hf.2.2.1 ⟨x, hxe, hxf⟩ + have heq := he.2.2.2 (e ∪ f) (union_subset he.2.1 (hf.2.1.trans hsub)) + hconn subset_union_left + exact ⟨e, he, fun y hy => heq ▸ (Or.inr hy : y ∈ e ∪ f)⟩ + +/-- An edge disjoint from the new vertex set is unchanged, as for short +edges in VII (4.6), page 225. -/ +theorem edge_mem_refinement_of_disjoint {J J' : Drawing S} {W : Set S} + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ W) {e : Set S} (he : e ∈ J.E) + (hoff : Disjoint e W) : e ∈ J'.E := by + refine ⟨he.1, ?_, he.2.2.1, ?_⟩ + · intro x hx + have hxold := he.2.1 hx + rw [hU, hV] + exact ⟨hxold.1, fun h => h.elim hxold.2 (disjoint_left.mp hoff hx)⟩ + · intro D hD hc heD + exact he.2.2.2 D (hD.trans (refined_off_vertices_subset hU hV)) hc heD + +/-- Drawings on the marked closed old edges give actual edges of `J⁺`, +as used for the three pieces of a long edge in VII (4.6), page 225. -/ +theorem local_marked_edge_mem_refinement {J J' P : Drawing S} {W : Set S} + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ W) {e : Set S} (he : e ∈ J.E) + (hPU : P.U = closure e) (hPV : P.V = (J.V ∪ W) ∩ closure e) + {f : Set S} (hf : f ∈ P.E) : f ∈ J'.E := by + have hfe : f ⊆ e := by + intro x hx + have hxP := hf.2.1 hx + rw [hPU, hPV] at hxP + have hxV : x ∉ J.V := fun h => hxP.2 ⟨.inl h, hxP.1⟩ + exact J.closure_diff_V he ▸ (⟨hxP.1, hxV⟩ : x ∈ closure e \ J.V) + have hfsub : f ⊆ J'.U \ J'.V := by + intro x hx + have hxP := hf.2.1 hx + rw [hPU, hPV] at hxP + rw [hU, hV] + exact ⟨J.closure_subset_U he hxP.1, fun h => hxP.2 ⟨h, hxP.1⟩⟩ + refine ⟨hf.1, hfsub, hf.2.2.1, ?_⟩ + intro D hD hc hfD + obtain ⟨x, hxf⟩ := hf.1 + have hsubold := refined_off_vertices_subset hU hV + have hconn := he.2.2.1.union hc ⟨x, hfe hxf, hfD hxf⟩ + have heq := he.2.2.2 (e ∪ D) (union_subset he.2.1 (hD.trans hsubold)) + hconn subset_union_left + have hDe : D ⊆ e := fun y hy => heq ▸ (Or.inr hy : y ∈ e ∪ D) + apply hf.2.2.2 D _ hc hfD + intro y hy + have hynew := hD hy + rw [hU, hV] at hynew + rw [hPU, hPV] + exact ⟨subset_closure (hDe hy), fun h => hynew.2 h.1⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46RetainedArcs.lean b/LeanPool/GraphMinor/GM07/Section46RetainedArcs.lean new file mode 100644 index 0000000000..40de0b5f1d --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46RetainedArcs.lean @@ -0,0 +1,100 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section46ProperSubarc +import LeanPool.GraphMinor.GM07.Section46RetainedCircles +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.GM07.DiscPlace +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.Classification +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.GM11.Walks + +/-! +# No `I`-arc lies in `U(L)` + +VII (4.6), page 226, chooses a proper subarc and applies (i) to put +its ends on one cuff. Join that subarc to one of the two arcs of the +cuff. This is a circle in `U(L) ∪ bd(Σ)`, so the preceding circle claim +makes it a cuff. It contains an interior point of the proper subarc, +which cannot lie in the boundary. This gives the contradiction. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +private theorem proper_IArc_not_subset_bd {S : Type*} [TopologicalSpace S] + {P : Set S} (hP : IsProperIArc P) : ¬P ⊆ bd S := by + obtain ⟨a, b, _, hends, f, hf0, hf1⟩ := hP + intro hsub + let t : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have hpt : (f t).1 ∈ P ∩ bd S := ⟨(f t).2, hsub (f t).2⟩ + have hpair : (f t).1 ∈ ({a, b} : Set S) := hends ▸ hpt + rcases hpair with h | h + · have hft : f t = f 0 := Subtype.ext (h.trans hf0.symm) + have heq := congrArg Subtype.val (f.injective hft) + norm_num [t] at heq + · have hft : f t = f 1 := Subtype.ext (h.trans hf1.symm) + have heq := congrArg Subtype.val (f.injective hft) + norm_num [t] at heq + +/-- No `I`-arc lies in `U(L)`, in VII (4.6), page 226. -/ +theorem not_isIArc_of_subset_retained {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) (hcuffs : 2 ≤ (cuffs S).ncard) + {G J J' L : Drawing S} (hJ : N.IsSeamGraphFor J) (hG : G.IsProper) + (hnorm : G.IsNormal J.U) (hL : L.IsSubdrawing J') (hU : J'.U = J.U) + (hLp : L.IsProper) {v : ℕ} + (hsum : (G.V ∩ L.U).ncard + (G.V ∩ bd S).ncard ≤ v) + (hi : ∀ B : Set S, G.IsNormal B → IsIArc B → (G.V ∩ B).ncard ≤ v → + ∃ C ∈ cuffs S, lineEnds B ⊆ C) + (hii : ∀ B : Set S, G.IsNormal B → IsOArc B → (G.V ∩ B).ncard ≤ v → + IsNullHomotopicOArc B ∨ + ∃ C ∈ cuffs S, IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) + {F : Set S} (hFL : F ⊆ L.U) : ¬IsIArc F := by + have : T2Space S := hS.2.1 + intro hF + obtain ⟨P, hPF, hP⟩ := exists_proper_IArc_subset hLp hF hFL + have hPL : P ⊆ L.U := hPF.trans hFL + obtain ⟨a, b, hab, hends, hline⟩ := hP + have haP : a ∈ P ∩ bd S := hends ▸ mem_insert a {b} + have hbP : b ∈ P ∩ bd S := hends ▸ mem_insert_of_mem a (mem_singleton b) + have hPi : IsIArc P := ⟨a, b, haP.2, hbP.2, hline⟩ + have hPN : G.IsNormal P := by + rintro x ⟨hxP, hxG⟩ + exact hnorm ⟨hU ▸ hL.U_subset (hPL hxP), hxG⟩ + have hsmall : (G.V ∩ P).ncard ≤ v := by + have hsub : G.V ∩ P ⊆ G.V ∩ L.U := inter_subset_inter_right G.V hPL + have hcard := ncard_le_ncard hsub (G.finite_V.subset inter_subset_left) + omega + obtain ⟨C, hC, hPC⟩ := hi P hPN hPi hsmall + have haC : a ∈ C := hPC ⟨b, hline⟩ + have hbC : b ∈ C := hPC ⟨a, hline.symm⟩ + have hCO := (cuff_statement S hS).2.2 C hC + obtain ⟨α, β, htwo, hα0, hα1, hcover⟩ := hCO.exists_arcs haC hbC hab + have hAline : IsLineWithEnds (range α) a b := by + simpa only [hα0, hα1] using isLineWithEnds_range_of_arc htwo.arc_left + have hAC : range α ⊆ C := subset_union_left.trans hcover.subset + have hCbd : C ⊆ bd S := fun x hx => sUnion_cuffs (S := S) ▸ ⟨C, hC, hx⟩ + have hmeet : P ∩ range α ⊆ {a, b} := fun x hx => hends ▸ ⟨hx.1, hCbd (hAC hx.2)⟩ + have hcircle : IsOArc (P ∪ range α) := isOArc_union hline hAline hmeet + have hcircleSub : P ∪ range α ⊆ L.U ∪ bd S := union_subset_union hPL (hAC.trans hCbd) + have hcircleCuff := circles_in_retained_union_are_cuffs hS N hcuffs hJ hG hnorm hL hU + hsum hii hiii hcircle hcircleSub + have hPbd : P ⊆ bd S := fun x hx => + sUnion_cuffs (S := S) ▸ ⟨P ∪ range α, hcircleCuff, Or.inl hx⟩ + exact proper_IArc_not_subset_bd ⟨a, b, hab, hends, hline⟩ hPbd + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46RetainedCircles.lean b/LeanPool/GraphMinor/GM07/Section46RetainedCircles.lean new file mode 100644 index 0000000000..5c04d04c60 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46RetainedCircles.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section46CircleCuff +import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.PaintingFacts +import LeanPool.GraphMinor.Surface.Classification + +/-! +# Circles in `U(L)` and in `U(L) ∪ bd(Σ)` + +The contact sum on page 226 of VII (4.6) lets hypothesis (ii) apply to +every circle in `U(L) ∪ bd(Σ)`. Normality follows from the normal seam +and properness of `G`. The disc-side argument says such a circle is a +cuff. No circle can lie in `U(L)`, since `L` is proper and its boundary +contacts are finite. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +/-- Every circle in `U(L) ∪ bd(Σ)` is a cuff, as claimed in VII (4.6), +page 226. The contact bound is the local bound established just before +this claim in the paper. -/ +theorem circles_in_retained_union_are_cuffs {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) (hcuffs : 2 ≤ (cuffs S).ncard) + {G J J' L : Drawing S} (hJ : N.IsSeamGraphFor J) (hG : G.IsProper) + (hnorm : G.IsNormal J.U) (hL : L.IsSubdrawing J') (hU : J'.U = J.U) + {v : ℕ} (hsum : (G.V ∩ L.U).ncard + (G.V ∩ bd S).ncard ≤ v) + (hii : ∀ B : Set S, G.IsNormal B → IsOArc B → (G.V ∩ B).ncard ≤ v → + IsNullHomotopicOArc B ∨ + ∃ C ∈ cuffs S, IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) + {F : Set S} (hF : IsOArc F) (hFU : F ⊆ L.U ∪ bd S) : F ∈ cuffs S := by + have : T2Space S := hS.2.1 + have hLU : L.U ⊆ J.U := hL.U_subset.trans hU.subset + have hFN : G.IsNormal F := by + rintro x ⟨hxF, hxG⟩ + rcases hFU hxF with hxL | hxbd + · exact hnorm ⟨hLU hxL, hxG⟩ + · exact hG ⟨hxbd, hxG⟩ + have hsub : G.V ∩ F ⊆ (G.V ∩ L.U) ∪ (G.V ∩ bd S) := by + rintro x ⟨hxV, hxF⟩ + rcases hFU hxF with hxL | hxbd + · exact .inl ⟨hxV, hxL⟩ + · exact .inr ⟨hxV, hxbd⟩ + have hf₁ : (G.V ∩ L.U).Finite := G.finite_V.subset inter_subset_left + have hf₂ : (G.V ∩ bd S).Finite := G.finite_V.subset inter_subset_left + have hcount : (G.V ∩ F).ncard ≤ v := + ((ncard_le_ncard hsub (hf₁.union hf₂)).trans (ncard_union_le _ _)).trans hsum + have hFseam : F ⊆ N.seamU := by + intro x hx + rcases hFU hx with hxL | hxbd + · exact hJ.2.1 ▸ hLU hxL + · exact N.bd_subset_seamU hxbd + exact N.small_normal_circle_in_seam_is_cuff hS hcuffs hii hiii hF hFN hcount hFseam + +/-- No circle lies in `U(L)`, in VII (4.6), page 226. -/ +theorem not_isOArc_of_subset_retained {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) (hcuffs : 2 ≤ (cuffs S).ncard) + {G J J' L : Drawing S} (hJ : N.IsSeamGraphFor J) (hG : G.IsProper) + (hnorm : G.IsNormal J.U) (hL : L.IsSubdrawing J') (hU : J'.U = J.U) + (hLp : L.IsProper) {v : ℕ} + (hsum : (G.V ∩ L.U).ncard + (G.V ∩ bd S).ncard ≤ v) + (hii : ∀ B : Set S, G.IsNormal B → IsOArc B → (G.V ∩ B).ncard ≤ v → + IsNullHomotopicOArc B ∨ + ∃ C ∈ cuffs S, IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) + {F : Set S} (hFU : F ⊆ L.U) : ¬IsOArc F := by + have : T2Space S := hS.2.1 + intro hF + have hC := circles_in_retained_union_are_cuffs hS N hcuffs hJ hG hnorm hL hU + hsum hii hiii hF (hFU.trans subset_union_left) + have hbd : F ⊆ bd S := fun x hx => sUnion_cuffs (S := S) ▸ ⟨F, hC, hx⟩ + have hFV : F ⊆ L.V := fun x hx => hLp ⟨hbd hx, hFU hx⟩ + exact (infinite_of_isOArc hF) (L.finite_V.subset hFV) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46RetainedLinking.lean b/LeanPool/GraphMinor/GM07/Section46RetainedLinking.lean new file mode 100644 index 0000000000..5f289dbc7e --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46RetainedLinking.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46SeamPartsDefs +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46LongPieces +import LeanPool.GraphMinor.GM07.Section46OldVertices + +/-! +# Linking edges are retained in `L` + +In VII (4.6), page 226, every linking edge is off the cuffs, because it +lies in a long old edge. Its closure has an old seam vertex, whereas +central edge closures have none. Thus deleting central and cuff edges +retains every linking edge. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +/-- Linking edges belong to the edge set defining `L` in VII (4.6), +page 226. -/ +theorem linking_edge_mem_forestSeamEdges {S : Type*} [TopologicalSpace S] + (hS : IsSurface S) (N : Net S) {G J J' : Drawing S} + (hJ : N.IsSeamGraphFor J) {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (s t : longSeamEdges G J μ w → unitInterval) + (W : longSeamEdges G J μ w → Set S) + (hcuts : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)}) + (hsmall : (G.V ∩ bd S).ncard < 2 * μ + w + 2) + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ ⋃ e, W e) + {f : Set S} (hf : f ∈ linkingEdges G J μ w γ s t) : + f ∈ forestSeamEdges J' (centralEdges G J μ w γ s t) := by + have : T2Space S := hS.2.1 + have hcpos : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e := + fun e => ⟨(hcuts e).1, (hcuts e).2.1, (hcuts e).2.2.1⟩ + have hW : ∀ e : longSeamEdges G J μ w, W e ⊆ e.1 := by + intro e x hx + rw [(hcuts e).2.2.2] at hx + rcases hx with rfl | rfl + · exact (congrArg (fun A => γ e.1 (s e) ∈ A) (hγ.image e.1 e.2.1)).mp + ⟨s e, (hcuts e).1, rfl⟩ + · exact (congrArg (fun A => γ e.1 (t e) ∈ A) (hγ.image e.1 e.2.1)).mp + ⟨t e, (hcuts e).2.1, rfl⟩ + have hnotcentral : f ∉ centralEdges G J μ w γ s t := by + intro hc + obtain ⟨x, hxcl, hxV⟩ := linking_closure_meets_old_vertices hγ s t hcpos hf + exact disjoint_left.mp (central_closure_disjoint_old_vertices hγ s t hcpos hc) hxcl hxV + have hnew : f ∈ J'.E ∧ Disjoint f (bd S) := by + rcases hf with ⟨e, rfl⟩ | ⟨e, rfl⟩ + · have hc := hcuts e + have hm := long_edge_pieces_mem_J_plus hγ W hW hU hV e hc.1 hc.2.1 hc.2.2.1 hc.2.2.2 + have hsub : γ e.1 '' Ioo 0 (s e) ⊆ e.1 := by + rintro x ⟨u, hu, rfl⟩ + exact (congrArg (fun A => γ e.1 u ∈ A) (hγ.image e.1 e.2.1)).mp + ⟨u, ⟨hu.1, hu.2.trans hc.1.2⟩, rfl⟩ + exact ⟨hm.1, (longSeamEdge_disjoint_bd_of_ncard_lt hS N hJ hsmall e.2).mono_left hsub⟩ + · have hc := hcuts e + have hm := long_edge_pieces_mem_J_plus hγ W hW hU hV e hc.1 hc.2.1 hc.2.2.1 hc.2.2.2 + have hsub : γ e.1 '' Ioo (t e) 1 ⊆ e.1 := by + rintro x ⟨u, hu, rfl⟩ + exact (congrArg (fun A => γ e.1 u ∈ A) (hγ.image e.1 e.2.1)).mp + ⟨u, ⟨hc.2.1.1.trans hu.1, hu.2⟩, rfl⟩ + exact ⟨hm.2.2, (longSeamEdge_disjoint_bd_of_ncard_lt hS N hJ hsmall e.2).mono_left hsub⟩ + refine ⟨hnew.1, hnotcentral, ?_⟩ + intro hsub + obtain ⟨x, hx⟩ := hnew.1.1 + exact disjoint_left.mp hnew.2 hx (hsub hx) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46SeamComplement.lean b/LeanPool/GraphMinor/GM07/Section46SeamComplement.lean new file mode 100644 index 0000000000..7b89156794 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46SeamComplement.lean @@ -0,0 +1,57 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.Surface.Disc + +/-! +# The dense connected complement of a seam + +For the disc-side argument on page 226 of VII (4.6), the unique seam +region is connected and dense in the surface. Connectedness comes from +the open disc before pasting. Density follows by mapping the dense +interior of that closed disc under the associated surjection. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +/-- The complement of a net seam is dense, as used in the disc-side +argument of VII (4.6), page 226. -/ +theorem Net.dense_compl_seamU {S : Type*} [TopologicalSpace S] (N : Net S) : + Dense N.seamUᶜ := by + have : T2Space N.D := N.isSurface_D.2.1 + have hb : discBd (univ : Set N.D) = bd N.D := image_bd_homeomorph (Homeomorph.Set.univ N.D) + have hd : Dense (discInt (univ : Set N.D)) := + fun x => N.isClosedDisc_D.subset_closure_discInt (mem_univ x) + have hInt : discInt (univ : Set N.D) = (bd N.D)ᶜ := by + unfold discInt + rw [hb] + ext x + simp + rw [hInt] at hd + have him := N.quotientMap_φ.surjective.denseRange.dense_image N.quotientMap_φ.continuous hd + rw [N.image_compl_bd] at him + simpa only [compl_eq_univ_sdiff] using him + +/-- The complement of the seam is connected, the single-region property +used in VII (4.6), page 226. -/ +theorem Net.isPreconnected_compl_seamU {S : Type*} [TopologicalSpace S] [T2Space S] + (N : Net S) : IsPreconnected N.seamUᶜ := by + simpa only [compl_eq_univ_sdiff] using + N.isOpenDisc_compl_seamU.isPathConnected.isConnected.isPreconnected + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46SeamEdgeCounts.lean b/LeanPool/GraphMinor/GM07/Section46SeamEdgeCounts.lean new file mode 100644 index 0000000000..e9a39540e6 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46SeamEdgeCounts.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46SeamPartsDefs +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46SplitEdges + +/-! +# Counting the edges retained in `L` + +For VII (4.6), page 226, each short old edge contributes at most one +edge to `L`, and each long old edge at most its two linking edges. +Thus `|E(L)| ≤ 2|E(J)|`. The central set has at most one edge for each +long old edge, as used for the matching bound on page 227. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +private theorem ncard_range_le_card {α β : Type*} [Finite α] (f : α → β) : + (range f).ncard ≤ Nat.card α := by + rw [← image_univ] + exact (ncard_image_le finite_univ).trans_eq (ncard_univ α) + +/-- There is at most one central edge for each long edge, in +VII (4.6), pages 226–227. -/ +theorem ncard_centralEdges_le {S : Type*} [TopologicalSpace S] + (G J : Drawing S) (μ w : ℕ) (γ : Set S → unitInterval → S) + (s t : longSeamEdges G J μ w → unitInterval) : + (centralEdges G J μ w γ s t).ncard ≤ (longSeamEdges G J μ w).ncard := by + have hlong : longSeamEdges G J μ w ⊆ J.E := fun _ he => he.1 + have : Finite (longSeamEdges G J μ w) := (J.finite_edges.subset hlong).to_subtype + exact ncard_range_le_card _ + +/-- At most two linking edges arise from each long edge in VII (4.6), +page 225. -/ +theorem ncard_linkingEdges_le {S : Type*} [TopologicalSpace S] + (G J : Drawing S) (μ w : ℕ) (γ : Set S → unitInterval → S) + (s t : longSeamEdges G J μ w → unitInterval) : + (linkingEdges G J μ w γ s t).ncard ≤ 2 * (longSeamEdges G J μ w).ncard := by + have hlong : longSeamEdges G J μ w ⊆ J.E := fun _ he => he.1 + have : Finite (longSeamEdges G J μ w) := (J.finite_edges.subset hlong).to_subtype + have hleft := ncard_range_le_card (fun e : longSeamEdges G J μ w => γ e.1 '' Ioo 0 (s e)) + have hright := ncard_range_le_card (fun e : longSeamEdges G J μ w => γ e.1 '' Ioo (t e) 1) + have hu := ncard_union_le (range fun e : longSeamEdges G J μ w => γ e.1 '' Ioo 0 (s e)) + (range fun e : longSeamEdges G J μ w => γ e.1 '' Ioo (t e) 1) + change (linkingEdges G J μ w γ s t).ncard ≤ _ at hu + rw [Nat.card_coe_set_eq] at hleft hright + omega + +/-- Every retained edge is short or linking, in VII (4.6), page 226. -/ +theorem L_edges_subset_short_union_linking {S : Type*} [TopologicalSpace S] [T2Space S] + {G J J' L : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (s t : longSeamEdges G J μ w → unitInterval) + (W : longSeamEdges G J μ w → Set S) + (hcuts : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)}) + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ ⋃ e, W e) + (hLE : L.E = forestSeamEdges J' (centralEdges G J μ w γ s t)) : + L.E ⊆ shortSeamEdges G J μ w ∪ linkingEdges G J μ w γ s t := by + have hE := J_plus_edges hγ s t W hcuts hU hV + intro f hf + rw [hLE] at hf + have hfE := hf.1 + rw [hE] at hfE + rcases hfE with hshort | hpieces + · exact .inl hshort + · obtain ⟨e, he⟩ := mem_iUnion.mp hpieces + rcases he with rfl | rfl | rfl + · exact .inr (.inl ⟨e, rfl⟩) + · exact (hf.2.1 ⟨e, rfl⟩).elim + · exact .inr (.inr ⟨e, rfl⟩) + +/-- The retained graph `L` has at most twice as many edges as `J`, +the edge count used on page 226 of VII (4.6). -/ +theorem L_edge_ncard_le_two_mul_old_edges {S : Type*} [TopologicalSpace S] [T2Space S] + {G J J' L : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (s t : longSeamEdges G J μ w → unitInterval) + (W : longSeamEdges G J μ w → Set S) + (hcuts : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)}) + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ ⋃ e, W e) + (hLE : L.E = forestSeamEdges J' (centralEdges G J μ w γ s t)) : + L.E.ncard ≤ 2 * J.E.ncard := by + have hsub := L_edges_subset_short_union_linking hγ s t W hcuts hU hV hLE + have hshortfin : (shortSeamEdges G J μ w).Finite := J.finite_edges.subset sdiff_subset + have hlongfin : (longSeamEdges G J μ w).Finite := J.finite_edges.subset fun e he => he.1 + have : Finite (longSeamEdges G J μ w) := hlongfin.to_subtype + have hlinkfin : (linkingEdges G J μ w γ s t).Finite := (finite_range _).union (finite_range _) + have hcard := ncard_le_ncard hsub (hshortfin.union hlinkfin) + have hu := ncard_union_le (shortSeamEdges G J μ w) (linkingEdges G J μ w γ s t) + have hl := ncard_linkingEdges_le G J μ w γ s t + have hlongsub : longSeamEdges G J μ w ⊆ J.E := fun e he => he.1 + have hpartition := ncard_sdiff_add_ncard_of_subset hlongsub J.finite_edges + change (shortSeamEdges G J μ w).ncard + (longSeamEdges G J μ w).ncard = J.E.ncard at hpartition + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46SeamParts.lean b/LeanPool/GraphMinor/GM07/Section46SeamParts.lean new file mode 100644 index 0000000000..3039c7c067 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46SeamParts.lean @@ -0,0 +1,81 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46SeamPartsDefs +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46LongPieces +import LeanPool.GraphMinor.GM07.Section46CentralEnds +import LeanPool.GraphMinor.GM11.Defs + +/-! +# Constructing `K` and `L` + +In VII (4.6), page 226, `K` has the central edges and vertices `W`. +The graph `L` keeps all vertices of `J⁺` and deletes the central edges +and the edges on cuffs. The central-end calculation ensures that these +specified vertices and edges give actual subdrawings of `J⁺`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +private theorem exists_subdrawing_with_sets {S : Type*} [TopologicalSpace S] [T1Space S] + {D : Drawing S} {V : Set S} {E : Set (Set S)} (hV : V ⊆ D.V) (hE : E ⊆ D.E) + (hc : ∀ e ∈ E, closure e ∩ D.V ⊆ V) : + ∃ D' : Drawing S, D'.IsSubdrawing D ∧ D'.V = V ∧ D'.E = E := by + refine ⟨D.span V E, D.span_isSubdrawing V E, ?_, ?_⟩ + · rw [D.span_V] + unfold Drawing.spanV + refine Subset.antisymm + (union_subset inter_subset_left (iUnion₂_subset fun e he => hc e he.1)) + (fun x hx => .inl ⟨hx, hV hx⟩) + · rw [D.span_E, inter_eq_left.mpr hE] + +/-- The two subgraphs `K` and `L` defined in VII (4.6), page 226. -/ +theorem exists_K_and_L {S : Type*} [TopologicalSpace S] [T2Space S] + {G J J' : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (s t : longSeamEdges G J μ w → unitInterval) + (W : longSeamEdges G J μ w → Set S) + (hcuts : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)}) + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ ⋃ e, W e) : + ∃ K L : Drawing S, + K.IsSubdrawing J' ∧ K.V = ⋃ e, W e ∧ K.E = centralEdges G J μ w γ s t ∧ + L.IsSubdrawing J' ∧ L.V = J'.V ∧ L.E = forestSeamEdges J' (centralEdges G J μ w γ s t) := by + have hW : ∀ e : longSeamEdges G J μ w, W e ⊆ e.1 := by + intro e x hx + rw [(hcuts e).2.2.2] at hx + rcases hx with rfl | rfl + · exact (congrArg (fun A => γ e.1 (s e) ∈ A) (hγ.image e.1 e.2.1)).mp + ⟨s e, (hcuts e).1, rfl⟩ + · exact (congrArg (fun A => γ e.1 (t e) ∈ A) (hγ.image e.1 e.2.1)).mp + ⟨t e, (hcuts e).2.1, rfl⟩ + have hWE : (⋃ e, W e) ⊆ J'.V := by rw [hV]; exact subset_union_right + have hCE : centralEdges G J μ w γ s t ⊆ J'.E := by + rintro f ⟨e, rfl⟩ + have hc := hcuts e + exact (long_edge_pieces_mem_J_plus hγ W hW hU hV e + hc.1 hc.2.1 hc.2.2.1 hc.2.2.2).2.1 + have hends : ∀ f ∈ centralEdges G J μ w γ s t, closure f ∩ J'.V ⊆ ⋃ e, W e := by + rintro f ⟨e, rfl⟩ + have hc := hcuts e + rw [central_edge_ends hγ W hW hV e hc.1 hc.2.1 hc.2.2.1 hc.2.2.2] + exact subset_iUnion W e + obtain ⟨K, hK, hKV, hKE⟩ := exists_subdrawing_with_sets (D := J') (V := ⋃ e, W e) + (E := centralEdges G J μ w γ s t) hWE hCE hends + have hLE : forestSeamEdges J' (centralEdges G J μ w γ s t) ⊆ J'.E := fun e he => he.1 + obtain ⟨L, hL, hLV, hLE'⟩ := exists_subdrawing_with_sets (D := J') (V := J'.V) + subset_rfl hLE (fun _ _ => inter_subset_right) + exact ⟨K, L, hK, hKV, hKE, hL, hLV, hLE'⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46SeamPartsDefs.lean b/LeanPool/GraphMinor/GM07/Section46SeamPartsDefs.lean new file mode 100644 index 0000000000..4f6e0c6467 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46SeamPartsDefs.lean @@ -0,0 +1,45 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46LongEdges + +/-! +# Central and linking edge sets in VII (4.6) + +On pages 225–226, the open middle segment of each long old edge is +central. The two outer open segments are linking edges. These definitions +use the chosen cut parameters and no graph or topological conclusions. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +/-- The central edges in VII (4.6), pages 225–226, are the open middle +parameter segments of long edges. -/ +def centralEdges {S : Type*} [TopologicalSpace S] (G J : Drawing S) (μ w : ℕ) + (γ : Set S → unitInterval → S) (s t : longSeamEdges G J μ w → unitInterval) : Set (Set S) := + range fun e => γ e.1 '' Ioo (s e) (t e) + +/-- The linking edges in VII (4.6), page 225, are the two outer open +parameter segments of long edges. -/ +def linkingEdges {S : Type*} [TopologicalSpace S] (G J : Drawing S) (μ w : ℕ) + (γ : Set S → unitInterval → S) (s t : longSeamEdges G J μ w → unitInterval) : Set (Set S) := + (range fun e => γ e.1 '' Ioo 0 (s e)) ∪ (range fun e => γ e.1 '' Ioo (t e) 1) + +/-- The edge set of `L` in VII (4.6), page 226, obtained by deleting the +central edges and the edges contained in the cuffs. -/ +def forestSeamEdges {S : Type*} [TopologicalSpace S] (J' : Drawing S) + (central : Set (Set S)) : Set (Set S) := + {e ∈ J'.E | e ∉ central ∧ ¬e ⊆ bd S} + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46SeamRefinement.lean b/LeanPool/GraphMinor/GM07/Section46SeamRefinement.lean new file mode 100644 index 0000000000..f0f5ebfe43 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46SeamRefinement.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46LongEdges +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46W +import LeanPool.GraphMinor.GM07.Section46JPlus +import LeanPool.GraphMinor.GM07.Section46SplitEdges + +/-! +# The refined seam graph of VII (4.6) + +This assembles the construction on page 225. Choose `W(e)` on every +long edge, add their union `W` to the vertices, and identify all edges +of `J⁺`. Short edges stay unchanged. Each long edge supplies two linking +edges and one central edge, with the contact counts used on page 226. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +/-- The construction of `W(e)`, `W`, and `J⁺`, with all its edges and +contact counts, in VII (4.6), page 225. -/ +theorem exists_J_plus_with_split_edges {S : Type*} [TopologicalSpace S] [T2Space S] + (G J : Drawing S) {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (hμ : 0 < μ) : + ∃ (s t : longSeamEdges G J μ w → unitInterval) + (W : longSeamEdges G J μ w → Set S) (J' : Drawing S), + (∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)} ∧ (W e).ncard = 2 ∧ W e ⊆ e.1 ∩ G.V ∧ + (γ e.1 '' Iic (s e) ∩ G.V).ncard = μ + 1 ∧ + (γ e.1 '' Ici (t e) ∩ G.V).ncard = μ + 1 ∧ + w ≤ (γ e.1 '' Ioo (s e) (t e) ∩ G.V).ncard) ∧ + (⋃ e, W e).Finite ∧ (⋃ e, W e) ⊆ G.V \ J.V ∧ + J'.U = J.U ∧ J'.V = J.V ∪ ⋃ e, W e ∧ + J'.E = shortSeamEdges G J μ w ∪ ⋃ e : longSeamEdges G J μ w, + {γ e.1 '' Ioo 0 (s e), γ e.1 '' Ioo (s e) (t e), γ e.1 '' Ioo (t e) 1} := by + obtain ⟨s, t, W, hcuts, hfin, hsub⟩ := exists_W_for_long_edges (G := G) hγ hμ + have hWU : (⋃ e, W e) ⊆ J.U := by + intro x hx + obtain ⟨e, hxe⟩ := mem_iUnion.mp hx + exact J.closure_subset_U e.2.1 (subset_closure ((hcuts e).2.2.2.2.2.1 hxe).1) + obtain ⟨J', hU, hV⟩ := exists_J_plus J hfin hWU + refine ⟨s, t, W, J', hcuts, hfin, hsub, hU, hV, ?_⟩ + exact J_plus_edges hγ s t W + (fun e => ⟨(hcuts e).1, (hcuts e).2.1, (hcuts e).2.2.1, (hcuts e).2.2.2.1⟩) hU hV + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46ShortEdges.lean b/LeanPool/GraphMinor/GM07/Section46ShortEdges.lean new file mode 100644 index 0000000000..e0d1622a8a --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46ShortEdges.lean @@ -0,0 +1,41 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46LongEdges +import LeanPool.GraphMinor.GM07.Section46RefinedEdges + +/-! +# Short edges remain edges of `J⁺` + +The new vertices `W(e)` lie inside long edges. Distinct old edges are +disjoint, so no short edge contains a new vertex. It therefore remains +an edge of the refined seam graph, as stated on page 225 of VII (4.6). +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +/-- Every short edge of `J` is an edge of `J⁺`, in VII (4.6), page 225. -/ +theorem short_edge_mem_J_plus {S : Type*} [TopologicalSpace S] + {G J J' : Drawing S} {μ w : ℕ} + (W : longSeamEdges G J μ w → Set S) (hW : ∀ f, W f ⊆ f.1) + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ ⋃ f, W f) + {e : Set S} (he : e ∈ shortSeamEdges G J μ w) : e ∈ J'.E := by + apply edge_mem_refinement_of_disjoint hU hV he.1 + apply disjoint_left.mpr + intro x hxe hxW + obtain ⟨f, hxf⟩ := mem_iUnion.mp hxW + have hef := J.edge_eq_of_mem he.1 f.2.1 hxe (hW f hxf) + exact he.2 (hef.symm ▸ f.2) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46SideParam.lean b/LeanPool/GraphMinor/GM07/Section46SideParam.lean new file mode 100644 index 0000000000..1faf40e462 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46SideParam.lean @@ -0,0 +1,109 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Rotation +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.GM07.NetExists +import LeanPool.GraphMinor.GM07.NetSwapBasic + +/-! +# Seam edges as net sides + +In VII (4.6), the edge `e` of the seam off `bd(Σ)` is the image of one +side of a pair, so its parameter can be taken to be `φ ∘ f`. Then the +positions on `e` used on pages 225 to 230 are also positions on the two +sides of `Δ`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- Each seam edge off the boundary is the image of the open side of a pair, by the point +that the side and the edge share. -/ +theorem Net.exists_side_of_edge [T2Space S] (N : Net S) {J : Drawing S} + (hJ : N.IsSeamGraphFor J) {e : Set S} (he : e ∈ J.E) (hbd : e ∩ bd S = ∅) : + ∃ i : Fin N.r, e = (N.φ ∘ N.f i) '' Ioo (0 : unitInterval) 1 := by + obtain ⟨z, hz⟩ := he.1 + have hzU : z ∈ J.U \ J.V := he.2.1 hz + have hzseam : z ∈ N.seamU := hJ.2.1 ▸ hzU.1 + obtain ⟨x, hx, rfl⟩ := hzseam + have hxb : N.φ x ∉ bd S := fun h => (eq_empty_iff_forall_notMem.mp hbd _) ⟨hz, h⟩ + have hxV : N.φ x ∉ N.seamV := fun h => hzU.2 (hJ.2.2 ▸ h) + obtain ⟨i, w, hw, hfw, -, -⟩ := N.exists_mem_Ioo_of_mem_bd_of_notMem_bd_of_notMem_seamV hx hxb hxV + let c : C(unitInterval, S) := ⟨N.φ ∘ N.f i, N.quotientMap_φ.continuous.comp (N.f i).continuous⟩ + have hc0 : c 0 ∈ J.V := hJ.2.2 ▸ ⟨i, .inl rfl⟩ + have hc1 : c 1 ∈ J.V := hJ.2.2 ▸ ⟨i, .inr rfl⟩ + have hIoo : ∀ t ∈ Ioo (0 : unitInterval) 1, c t ∈ J.U \ J.V := by + intro t ht + rw [hJ.2.1, hJ.2.2] + exact ⟨⟨N.f i t, N.range_f_subset_bd i ⟨t, rfl⟩, rfl⟩, N.notMem_seamV_of_mem_Ioo i ht⟩ + have hinj : InjOn c (Ioo (0 : unitInterval) 1) := by + intro a ha b hb hab + exact N.injective_f i (N.injOn_image_open_side i ⟨a, ha, rfl⟩ ⟨b, hb, rfl⟩ hab) + have hE := (GraphMinor.GM07.Drawing.eq_edge_of_injOn_Ioo J c hc0 hc1 hIoo hinj).1 + refine ⟨i, arcComponentsIn_eq_of_mem he hE hz ⟨w, hw, hfw⟩⟩ + +/-- A parameter of the seam graph which is `φ ∘ f` on each edge off the boundary. -/ +theorem Net.exists_edgePar_sides [T2Space S] [Nonempty S] (N : Net S) {J : Drawing S} + (hJ : N.IsSeamGraphFor J) : + ∃ γ : Set S → unitInterval → S, EdgePar J γ ∧ + ∀ e ∈ J.E, e ∩ bd S = ∅ → ∃ i : Fin N.r, ∀ t, γ e t = N.φ (N.f i t) := by + classical + obtain ⟨γ₀, hγ₀⟩ := exists_edgePar J + let P : Set S → Prop := fun e => ∃ i : Fin N.r, e = (N.φ ∘ N.f i) '' Ioo (0 : unitInterval) 1 + let γ : Set S → unitInterval → S := fun e => + if h : P e then N.φ ∘ N.f h.choose else γ₀ e + have hpos : ∀ e (h : P e), γ e = N.φ ∘ N.f h.choose := fun e h => dite_eq_left h + have hneg : ∀ e, ¬P e → γ e = γ₀ e := fun e h => dite_eq_right h + refine ⟨γ, ⟨?_, ?_, ?_, ?_, ?_⟩, ?_⟩ + · intro e he + by_cases h : P e + · rw [hpos e h] + exact N.quotientMap_φ.continuous.comp (N.f _).continuous + · rw [hneg e h] + exact hγ₀.cont e he + · intro e he + by_cases h : P e + · rw [hpos e h] + exact hJ.2.2 ▸ ⟨_, .inl rfl⟩ + · rw [hneg e h] + exact hγ₀.zero e he + · intro e he + by_cases h : P e + · rw [hpos e h] + exact hJ.2.2 ▸ ⟨_, .inr rfl⟩ + · rw [hneg e h] + exact hγ₀.one e he + · intro e he + by_cases h : P e + · rw [hpos e h] + intro a ha b hb hab + exact N.injective_f _ (N.injOn_image_open_side _ ⟨a, ha, rfl⟩ ⟨b, hb, rfl⟩ hab) + · rw [hneg e h] + exact hγ₀.inj e he + · intro e he + by_cases h : P e + · rw [hpos e h] + exact h.choose_spec.symm + · rw [hneg e h] + exact hγ₀.image e he + · intro e he hb + have h : P e := N.exists_side_of_edge hJ he hb + exact ⟨h.choose, fun t => by rw [hpos e h]; rfl⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46SlideDescent.lean b/LeanPool/GraphMinor/GM07/Section46SlideDescent.lean new file mode 100644 index 0000000000..f279d4f96e --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46SlideDescent.lean @@ -0,0 +1,261 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46DiscSlide +import LeanPool.GraphMinor.GM07.Section46IntervalSlide +import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.GM07.NetSwapBasic + +/-! +# The slide along the matching in `Σ′` + +We bring the slide of `Δ` down to `Σ′` by the quotient map `ψ`, for one +side, and then for all the central edges at once. This gives the +homeomorphism for the sentence of VII (4.6), page 227, that `H₃` may be +chosen to meet the matching only at vertices of `θ⁻¹(G)`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +/-- A homeomorphism which respects the fibres of a quotient map comes down. -/ +theorem exists_descended_homeo {D S' : Type*} [TopologicalSpace D] [TopologicalSpace S'] + {ψ : D → S'} (hq : IsQuotientMap ψ) (b : D ≃ₜ D) + (h₁ : ∀ x y, ψ x = ψ y → ψ (b x) = ψ (b y)) + (h₂ : ∀ x y, ψ x = ψ y → ψ (b.symm x) = ψ (b.symm y)) : + ∃ β : S' ≃ₜ S', ∀ x, β (ψ x) = ψ (b x) := by + choose sec hsec using hq.surjective + have ht : ∀ x, ψ (b (sec (ψ x))) = ψ (b x) := fun x => h₁ _ _ (hsec _) + have hi : ∀ x, ψ (b.symm (sec (ψ x))) = ψ (b.symm x) := fun x => h₂ _ _ (hsec _) + let β : S' ≃ₜ S' := + { toFun := fun y => ψ (b (sec y)) + invFun := fun y => ψ (b.symm (sec y)) + left_inv := fun y => by + obtain ⟨x, rfl⟩ := hq.surjective y + change ψ (b.symm (sec (ψ (b (sec (ψ x)))))) = ψ x + rw [ht, hi, b.symm_apply_apply] + right_inv := fun y => by + obtain ⟨x, rfl⟩ := hq.surjective y + change ψ (b (sec (ψ (b.symm (sec (ψ x)))))) = ψ x + rw [hi, ht, b.apply_symm_apply] + continuous_toFun := by + rw [hq.continuous_iff] + have : (fun y => ψ (b (sec y))) ∘ ψ = ψ ∘ b := funext ht + rw [this] + exact hq.continuous.comp b.continuous + continuous_invFun := by + rw [hq.continuous_iff] + have : (fun y => ψ (b.symm (sec y))) ∘ ψ = ψ ∘ b.symm := funext hi + rw [this] + exact hq.continuous.comp b.symm.continuous } + exact ⟨β, ht⟩ + +section + +variable {S S' : Type} [TopologicalSpace S] [TopologicalSpace S'] (N : Net S) + {ψ : N.D → S'} + +omit [TopologicalSpace S'] in +private theorem slide_compat (hφ : ∀ x y, ψ x = ψ y → N.φ x = N.φ y) (i : Fin N.r) + {a c : unitInterval} (ha : a ∈ Ioo (0 : unitInterval) 1) (hc : c ∈ Ioo (0 : unitInterval) 1) + (hsame : ∀ r ∈ Icc a c, ψ (N.f i r) = ψ (N.g i r)) {τ : unitInterval → unitInterval} + (hτ : ∀ r ∈ Ioo a c, τ r ∈ Icc a c) (hfix : ∀ r, r ∉ Ioo a c → τ r = r) + (b : N.D → N.D) (hf : ∀ r, b (N.f i r) = N.f i (τ r)) (hg : ∀ r, b (N.g i r) = N.g i (τ r)) + (hoff : ∀ x ∈ bd N.D, x ∉ N.f i '' Ioo (0 : unitInterval) 1 → + x ∉ N.g i '' Ioo (0 : unitInterval) 1 → b x = x) : + (∀ x ∈ bd N.D, x ∉ N.f i '' Ioo a c → x ∉ N.g i '' Ioo a c → b x = x) ∧ + ∀ x y, ψ x = ψ y → ψ (b x) = ψ (b y) := by + have hfix' : ∀ x ∈ bd N.D, x ∉ N.f i '' Ioo a c → x ∉ N.g i '' Ioo a c → b x = x := by + intro x hx h₁ h₂ + by_cases h₃ : x ∈ N.f i '' Ioo (0 : unitInterval) 1 + · obtain ⟨r, -, rfl⟩ := h₃ + rw [hf, hfix r fun h => h₁ ⟨r, h, rfl⟩] + by_cases h₄ : x ∈ N.g i '' Ioo (0 : unitInterval) 1 + · obtain ⟨r, -, rfl⟩ := h₄ + rw [hg, hfix r fun h => h₂ ⟨r, h, rfl⟩] + exact hoff x hx h₃ h₄ + have hsub : Ioo a c ⊆ Ioo (0 : unitInterval) 1 := fun r hr => ⟨ha.1.trans hr.1, hr.2.trans hc.2⟩ + have hside : ∀ x, (x ∈ N.f i '' Ioo a c ∨ x ∈ N.g i '' Ioo a c) → ∀ y, ψ x = ψ y → + ψ (b x) = ψ (b y) := by + intro x hx y hxy + have hφxy := hφ x y hxy + obtain ⟨r, hr, hxr⟩ : ∃ r ∈ Ioo a c, x = N.f i r ∨ x = N.g i r := by + rcases hx with ⟨r, hr, rfl⟩ | ⟨r, hr, rfl⟩ + · exact ⟨r, hr, .inl rfl⟩ + · exact ⟨r, hr, .inr rfl⟩ + have hpair := N.fiber_eq_pair_of_mem_Ioo i (hsub hr) + have hval : ψ (b (N.f i r)) = ψ (b (N.g i r)) := by + rw [hf, hg] + exact hsame _ (hτ r hr) + have hy : y ∈ N.φ ⁻¹' {N.φ (N.f i r)} := by + change N.φ y = N.φ (N.f i r) + rcases hxr with rfl | rfl + · exact hφxy.symm + · rw [← hφxy, N.pasting_eq] + rw [hpair] at hy + rcases hxr with rfl | rfl <;> rcases hy with rfl | hy + · rfl + · rw [show y = N.g i r from hy, hval] + · exact hval.symm + · rw [show y = N.g i r from hy] + refine ⟨hfix', fun x y hxy => ?_⟩ + by_cases hx : x ∈ N.f i '' Ioo a c ∨ x ∈ N.g i '' Ioo a c + · exact hside x hx y hxy + by_cases hy : y ∈ N.f i '' Ioo a c ∨ y ∈ N.g i '' Ioo a c + · exact (hside y hy x hxy.symm).symm + push Not at hx hy + by_cases hxb : x ∈ bd N.D + · by_cases hyb : y ∈ bd N.D + · rw [hfix' x hxb hx.1 hx.2, hfix' y hyb hy.1 hy.2, hxy] + · have := N.interior_inj y hyb x (hφ _ _ hxy.symm) + rw [this] + · have := N.interior_inj x hxb y (hφ _ _ hxy) + rw [this] + +/-- The slide along one central edge, in `Σ′`. -/ +theorem Net.exists_side_slide (hq : IsQuotientMap ψ) (hφ : ∀ x y, ψ x = ψ y → N.φ x = N.φ y) + (i : Fin N.r) {a c : unitInterval} (ha : a ∈ Ioo (0 : unitInterval) 1) + (hc : c ∈ Ioo (0 : unitInterval) 1) + (hsame : ∀ r ∈ Icc a c, ψ (N.f i r) = ψ (N.g i r)) (σ : unitInterval ≃ₜ unitInterval) + (hσ : ∀ r, r ∉ Ioo a c → σ r = r) : + ∃ β : S' ≃ₜ S', (∀ r, β (ψ (N.f i r)) = ψ (N.f i (σ r))) ∧ + ∀ x ∈ bd N.D, x ∉ N.f i '' Ioo a c → x ∉ N.g i '' Ioo a c → β (ψ x) = ψ x := by + have h0 : σ 0 = 0 := hσ 0 fun h => not_lt_of_ge bot_le (ha.1.trans h.1) + have h1 : σ 1 = 1 := hσ 1 fun h => not_lt_of_ge le_top (h.2.trans hc.2) + have hσ' : ∀ r, r ∉ Ioo a c → σ.symm r = r := fun r hr => by + rw [σ.symm_apply_eq, hσ r hr] + have hin : ∀ τ : unitInterval ≃ₜ unitInterval, (∀ r, r ∉ Ioo a c → τ r = r) → + ∀ r ∈ Ioo a c, τ r ∈ Ioo a c := by + intro τ hτ r hr + by_contra h + have heq := τ.injective (hτ _ h) + exact h (by rw [heq]; exact hr) + have h0' : σ.symm 0 = 0 := by rw [← h0, σ.symm_apply_apply, h0] + have h1' : σ.symm 1 = 1 := by rw [← h1, σ.symm_apply_apply, h1] + obtain ⟨b, hbf, hbg, hboff⟩ := N.exists_disc_slide i σ h0 h1 + have hbf' : ∀ r, b.symm (N.f i r) = N.f i (σ.symm r) := fun r => by + rw [Homeomorph.symm_apply_eq, hbf, σ.apply_symm_apply] + have hbg' : ∀ r, b.symm (N.g i r) = N.g i (σ.symm r) := fun r => by + rw [Homeomorph.symm_apply_eq, hbg, σ.apply_symm_apply] + have hboff' : ∀ x ∈ bd N.D, x ∉ N.f i '' Ioo (0 : unitInterval) 1 → + x ∉ N.g i '' Ioo (0 : unitInterval) 1 → b.symm x = x := fun x hx h₁ h₂ => by + rw [Homeomorph.symm_apply_eq, hboff x hx h₁ h₂] + obtain ⟨hfix, hc₁⟩ := slide_compat N hφ i ha hc hsame + (fun r hr => Ioo_subset_Icc_self (hin σ hσ r hr)) hσ b hbf hbg hboff + obtain ⟨-, hc₂⟩ := slide_compat N hφ i ha hc hsame + (fun r hr => Ioo_subset_Icc_self (hin σ.symm hσ' r hr)) hσ' b.symm hbf' hbg' hboff' + obtain ⟨β, hβ⟩ := exists_descended_homeo hq b hc₁ hc₂ + refine ⟨β, fun r => by rw [hβ, hbf], fun x hx h₁ h₂ => by rw [hβ, hfix x hx h₁ h₂]⟩ + +/-- The slide along all the central edges at once, in `Σ′`. -/ +theorem Net.exists_slide_family {ι : Type*} [Finite ι] (hq : IsQuotientMap ψ) + (hφ : ∀ x y, ψ x = ψ y → N.φ x = N.φ y) (i : ι → Fin N.r) (hi : Function.Injective i) + (a c : ι → unitInterval) (ha : ∀ e, a e ∈ Ioo (0 : unitInterval) 1) + (hc : ∀ e, c e ∈ Ioo (0 : unitInterval) 1) + (hsame : ∀ e, ∀ r ∈ Icc (a e) (c e), ψ (N.f (i e) r) = ψ (N.g (i e) r)) + {X : Set S'} (hX : X.Finite) (Y : ι → Set unitInterval) (hYf : ∀ e, (Y e).Finite) + (hY : ∀ e, Y e ⊆ Ioo (a e) (c e)) + (hcard : ∀ e, {r ∈ Ioo (a e) (c e) | ψ (N.f (i e) r) ∈ X}.ncard ≤ (Y e).ncard) : + ∃ β : S' ≃ₜ S', + (∀ x ∈ bd N.D, (∀ e, x ∉ N.f (i e) '' Ioo (a e) (c e) ∧ x ∉ N.g (i e) '' Ioo (a e) (c e)) → + β (ψ x) = ψ x) ∧ + (∀ e, ∀ r' ∈ Ioo (a e) (c e), ∃ r ∈ Ioo (a e) (c e), β (ψ (N.f (i e) r)) = ψ (N.f (i e) r')) ∧ + (∀ e, ∀ r ∈ Ioo (a e) (c e), ψ (N.f (i e) r) ∈ X → ∃ r' ∈ Y e, + β (ψ (N.f (i e) r)) = ψ (N.f (i e) r')) := by + classical + have : Fintype ι := Fintype.ofFinite ι + have hsub : ∀ e, Ioo (a e) (c e) ⊆ Ioo (0 : unitInterval) 1 := fun e r hr => + ⟨(ha e).1.trans hr.1, hr.2.trans (hc e).2⟩ + have hother : ∀ e e', e ≠ e' → ∀ r ∈ Ioo (a e) (c e), + N.f (i e) r ∉ N.f (i e') '' Ioo (a e') (c e') ∧ N.f (i e) r ∉ N.g (i e') '' Ioo (a e') (c e') + := by + intro e e' hne r hr + constructor + · rintro ⟨r', -, hr'⟩ + exact N.internally_disjoint_ff _ _ (fun h => hne (hi h)) r (hsub e hr) ⟨r', hr'⟩ + · rintro ⟨r', -, hr'⟩ + exact N.internally_disjoint_fg _ _ r (hsub e hr) ⟨r', hr'⟩ + have hfbd : ∀ j r, N.f j r ∈ bd N.D := fun j r => N.range_f_subset_bd j ⟨r, rfl⟩ + have key : ∀ A : Finset ι, ∃ β : S' ≃ₜ S', + (∀ x ∈ bd N.D, (∀ e ∈ A, x ∉ N.f (i e) '' Ioo (a e) (c e) ∧ + x ∉ N.g (i e) '' Ioo (a e) (c e)) → β (ψ x) = ψ x) ∧ + (∀ e ∈ A, ∀ r' ∈ Ioo (a e) (c e), ∃ r ∈ Ioo (a e) (c e), + β (ψ (N.f (i e) r)) = ψ (N.f (i e) r')) ∧ + (∀ e ∈ A, ∀ r ∈ Ioo (a e) (c e), ψ (N.f (i e) r) ∈ X → ∃ r' ∈ Y e, + β (ψ (N.f (i e) r)) = ψ (N.f (i e) r')) := by + intro A + induction A using Finset.induction_on with + | empty => exact ⟨Homeomorph.refl S', fun _ _ _ => rfl, by simp, by simp⟩ + | insert e₀ A he₀ ih => + obtain ⟨β, hβ₁, hβ₂, hβ₃⟩ := ih + have hinj : InjOn (fun r => ψ (N.f (i e₀) r)) (Ioo (a e₀) (c e₀)) := by + intro r hr r' hr' h + exact N.injective_f _ (N.injOn_image_open_side _ ⟨r, hsub e₀ hr, rfl⟩ ⟨r', hsub e₀ hr', rfl⟩ + (hφ _ _ h)) + have hXf : {r ∈ Ioo (a e₀) (c e₀) | ψ (N.f (i e₀) r) ∈ X}.Finite := by + refine Set.Finite.of_finite_image (f := fun r => ψ (N.f (i e₀) r)) (hX.subset ?_) + (hinj.mono fun r hr => hr.1) + rintro _ ⟨r, hr, rfl⟩ + exact hr.2 + obtain ⟨σ, hσf, hσX⟩ := exists_interval_slide hXf (hYf e₀) (fun r hr => hr.1) (hY e₀) + (hcard e₀) + obtain ⟨γ, hγf, hγoff⟩ := N.exists_side_slide hq hφ (i e₀) (ha e₀) (hc e₀) (hsame e₀) σ hσf + have hfixA : ∀ r ∈ Ioo (a e₀) (c e₀), β (ψ (N.f (i e₀) r)) = ψ (N.f (i e₀) r) := by + intro r hr + apply hβ₁ _ (hfbd _ _) + intro e he + exact hother e₀ e (fun h => he₀ (h ▸ he)) r hr + have hfix₀ : ∀ e ∈ A, ∀ r ∈ Ioo (a e) (c e), γ (ψ (N.f (i e) r)) = ψ (N.f (i e) r) := by + intro e he r hr + have hne : e ≠ e₀ := fun h => he₀ (h ▸ he) + exact hγoff _ (hfbd _ _) (hother e e₀ hne r hr).1 (hother e e₀ hne r hr).2 + have hσin : ∀ r ∈ Ioo (a e₀) (c e₀), σ r ∈ Ioo (a e₀) (c e₀) := by + intro r hr + by_contra h + have heq := σ.injective (hσf _ h) + exact h (by rw [heq]; exact hr) + refine ⟨β.trans γ, ?_, ?_, ?_⟩ + · intro x hx h + change γ (β (ψ x)) = ψ x + rw [hβ₁ x hx fun e he => h e (Finset.mem_insert_of_mem he)] + exact hγoff x hx (h e₀ (Finset.mem_insert_self _ _)).1 (h e₀ (Finset.mem_insert_self _ _)).2 + · intro e he r' hr' + rcases Finset.mem_insert.mp he with rfl | heA + · have hin : σ.symm r' ∈ Ioo (a e) (c e) := by + by_contra h + have h' := hσf _ h + rw [σ.apply_symm_apply] at h' + exact h (h' ▸ hr') + refine ⟨σ.symm r', hin, ?_⟩ + change γ (β (ψ _)) = _ + rw [hfixA _ hin, hγf, σ.apply_symm_apply] + · obtain ⟨r, hr, hrr⟩ := hβ₂ e heA r' hr' + refine ⟨r, hr, ?_⟩ + change γ (β (ψ _)) = _ + rw [hrr, hfix₀ e heA r' hr'] + · intro e he r hr hrX + rcases Finset.mem_insert.mp he with rfl | heA + · refine ⟨σ r, hσX r ⟨hr, hrX⟩, ?_⟩ + change γ (β (ψ _)) = _ + rw [hfixA r hr, hγf] + · obtain ⟨r', hr', hrr⟩ := hβ₃ e heA r hr hrX + refine ⟨r', hr', ?_⟩ + change γ (β (ψ _)) = _ + rw [hrr, hfix₀ e heA r' (hY e hr')] + obtain ⟨β, h₁, h₂, h₃⟩ := key Finset.univ + exact ⟨β, fun x hx h => h₁ x hx fun e _ => h e, fun e => h₂ e (Finset.mem_univ e), + fun e => h₃ e (Finset.mem_univ e)⟩ + +end + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46SlideWrap.lean b/LeanPool/GraphMinor/GM07/Section46SlideWrap.lean new file mode 100644 index 0000000000..110ddfa5fb --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46SlideWrap.lean @@ -0,0 +1,183 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46SlideDescent +public import LeanPool.GraphMinor.GM07.Open +public import LeanPool.GraphMinor.GM11.Rotation +public import LeanPool.GraphMinor.GM07.Section46SideParam +public import LeanPool.GraphMinor.GM07.Section46LongEdges +import LeanPool.GraphMinor.GM07.Section46CentralLift +import LeanPool.GraphMinor.GM07.Section2Base + +/-! +# The slide in VII (4.6) + +Page 227: "Since each edge of $\theta^{-1}(K)$ passes through at least $w$ vertices +of $\theta^{-1}(G)$, we may choose $H_3$ so that in addition $U(H_3) \cap U(\theta^{-1}(K)) +\subseteq +V(\theta^{-1}(G))$." Here is that sentence, in the form claim (1) uses. The homeomorphism +`β` comes from `Net.exists_slide_family`, applied to the open central +segments of the long edges. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S S' : Type} [TopologicalSpace S] [TopologicalSpace S'] + +/-- The slide of VII (4.6), page 227. -/ +theorem Net.exists_matching_slide (N : Net S) {G J K L : Drawing S} + {K' : Drawing S'} {θ : S' → S} {ψ : N.D → S'} {γ : Set S → unitInterval → S} {μ w : ℕ} + (hγ : EdgePar J γ) + (hsides : ∀ e ∈ J.E, e ∩ bd S = ∅ → ∃ i : Fin N.r, ∀ t, γ e t = N.φ (N.f i t)) + (hlong : ∀ e : longSeamEdges G J μ w, Disjoint e.1 (bd S)) + (s t : longSeamEdges G J μ w → unitInterval) + (hst : ∀ e, s e ∈ Ioo (0 : unitInterval) 1 ∧ t e ∈ Ioo (0 : unitInterval) 1 ∧ s e < t e) + (hendsG : ∀ e, γ e.1 (s e) ∈ G.V ∧ γ e.1 (t e) ∈ G.V) + (hendsL : ∀ e, γ e.1 (s e) ∈ L.U ∧ γ e.1 (t e) ∈ L.U) + (hcount : ∀ e, w ≤ (γ e.1 '' Ioo (s e) (t e) ∩ G.V).ncard) + (hKU : K.U ⊆ ⋃ e, γ e.1 '' Icc (s e) (t e)) + (hKIoo : ∀ e, ∀ r ∈ Ioo (s e) (t e), γ e.1 r ∈ K.U) + (hoff : ∀ e, ∀ r ∈ Ioo (s e) (t e), γ e.1 r ∉ bd S ∪ L.U) + (hθ : IsCutAlongGraph L S' θ) (hp : IsPullbackDrawing θ K K') + (hψcut : IsCutAlongGraph K' N.D ψ) (hψc : Continuous ψ) (hψs : Function.Surjective ψ) + (hψ : ∀ x, θ (ψ x) = N.φ x) (hinj : InjOn θ (θ ⁻¹' K.U)) : + ∀ X : Set S', X.Finite → X ⊆ K'.U → X.ncard ≤ w → + ∃ β : S' ≃ₜ S', (∀ x ∈ bd S', β x = x) ∧ K'.U ⊆ β '' K'.U ∧ ∀ x ∈ X, β x ∈ θ ⁻¹' G.V := by + classical + intro X hXf hXK hXw + have hne : ∀ e : longSeamEdges G J μ w, e.1 ∩ bd S = ∅ := fun e => + disjoint_iff_inter_eq_empty.mp (hlong e) + choose i hi using fun e : longSeamEdges G J μ w => hsides e.1 e.2.1 (hne e) + have : Finite (longSeamEdges G J μ w) := + Set.Finite.to_subtype (J.finite_edges.subset fun e (he : e ∈ longSeamEdges G J μ w) => he.1) + have hinjγ : ∀ e : longSeamEdges G J μ w, InjOn (γ e.1) (Ioo (s e) (t e)) := fun e => + (hγ.inj e.1 e.2.1).mono (Ioo_subset_Ioo (hst e).1.1.le (hst e).2.1.2.le) + have hiinj : Function.Injective i := by + intro e e' h + apply Subtype.ext + have hfun : γ e.1 = γ e'.1 := funext fun r => by rw [hi e r, hi e' r, h] + rw [← hγ.image e.1 e.2.1, ← hγ.image e'.1 e'.2.1, hfun] + have hoff' : ∀ e, ∀ r ∈ Ioo (s e) (t e), N.φ (N.f (i e) r) ∉ bd S ∪ L.U := fun e r hr => by + rw [← hi e r] + exact hoff e r hr + have hsame : ∀ e, ∀ r ∈ Icc (s e) (t e), ψ (N.f (i e) r) = ψ (N.g (i e) r) := fun e => + N.psi_sides_eq hθ hψc hψ (i e) (hst e).2.2 (hoff' e) + let Y : longSeamEdges G J μ w → Set unitInterval := fun e => {r ∈ Ioo (s e) (t e) | γ e.1 r ∈ G.V} + have hYimg : ∀ e, γ e.1 '' Y e = γ e.1 '' Ioo (s e) (t e) ∩ G.V := fun e => by + ext x + constructor + · rintro ⟨r, hr, rfl⟩ + exact ⟨mem_image_of_mem _ hr.1, hr.2⟩ + · rintro ⟨⟨r, hr, rfl⟩, hx⟩ + exact ⟨r, ⟨hr, hx⟩, rfl⟩ + have hYinj : ∀ e, InjOn (γ e.1) (Y e) := fun e => (hinjγ e).mono fun r hr => hr.1 + have hYf : ∀ e, (Y e).Finite := fun e => + Set.Finite.of_finite_image (by + rw [hYimg] + exact G.finite_V.subset inter_subset_right) (hYinj e) + have hcard : ∀ e, {r ∈ Ioo (s e) (t e) | ψ (N.f (i e) r) ∈ X}.ncard ≤ (Y e).ncard := by + intro e + have h1 : {r ∈ Ioo (s e) (t e) | ψ (N.f (i e) r) ∈ X}.ncard ≤ X.ncard := by + refine ncard_le_ncard_of_injOn (fun r => ψ (N.f (i e) r)) (fun r hr => hr.2) ?_ hXf + intro r hr r' hr' heq + apply hinjγ e hr.1 hr'.1 + have := congrArg θ heq + simp only [hψ] at this + rw [hi e r, hi e r', this] + have h2 : (Y e).ncard = (γ e.1 '' Ioo (s e) (t e) ∩ G.V).ncard := by + rw [← hYimg, (hYinj e).ncard_image] + have h3 := hcount e + omega + obtain ⟨β, hfix, hsurj, hmove⟩ := N.exists_slide_family hψcut.quotientMap + (fun x y h => by rw [← hψ x, ← hψ y, h]) i hiinj s t (fun e => (hst e).1) (fun e => (hst e).2.1) + hsame hXf Y hYf (fun e r hr => hr.1) hcard + have hgsame : ∀ e, ∀ r ∈ Ioo (s e) (t e), N.φ (N.g (i e) r) = N.φ (N.f (i e) r) := fun e r hr + => by + rw [← hψ, ← hψ, hsame e r ⟨hr.1.le, hr.2.le⟩] + have hfix' : ∀ x ∈ bd N.D, N.φ x ∈ bd S ∪ L.U → β (ψ x) = ψ x := by + intro x hx hb + refine hfix x hx fun e => ⟨?_, ?_⟩ + · rintro ⟨r, hr, rfl⟩ + exact hoff' e r hr hb + · rintro ⟨r, hr, rfl⟩ + rw [hgsame e r hr] at hb + exact hoff' e r hr hb + have hfbd : ∀ (j : Fin N.r) (r : unitInterval), N.f j r ∈ bd N.D := fun j r => + N.range_f_subset_bd j (mem_range_self r) + have hend : ∀ e, β (ψ (N.f (i e) (s e))) = ψ (N.f (i e) (s e)) ∧ + β (ψ (N.f (i e) (t e))) = ψ (N.f (i e) (t e)) := fun e => by + refine ⟨hfix' _ (hfbd _ _) (.inr ?_), hfix' _ (hfbd _ _) (.inr ?_)⟩ + · rw [← hi e] + exact (hendsL e).1 + · rw [← hi e] + exact (hendsL e).2 + have hstruct : ∀ y ∈ K'.U, ∃ e, ∃ r ∈ Icc (s e) (t e), y = ψ (N.f (i e) r) := by + intro y hy + have hyK : θ y ∈ K.U := by + rw [hp.1] at hy + exact hy + obtain ⟨e, r, hr, hrr⟩ := mem_iUnion.mp (hKU hyK) + refine ⟨e, r, hr, hinj hyK ?_ ?_⟩ + · change θ (ψ _) ∈ K.U + rw [hψ, ← hi e, hrr] + exact hyK + · rw [hψ, ← hi e, hrr] + have hcases : ∀ e, ∀ r ∈ Icc (s e) (t e), r = s e ∨ r = t e ∨ r ∈ Ioo (s e) (t e) := by + intro e r hr + rcases hr.1.eq_or_lt with h | h + · exact .inl h.symm + · rcases hr.2.eq_or_lt with h' | h' + · exact .inr (.inl h') + · exact .inr (.inr ⟨h, h'⟩) + refine ⟨β, ?_, ?_, ?_⟩ + · intro x hx + obtain ⟨y, rfl⟩ := hψs x + have hyD : y ∈ bd N.D := by + rw [← hψcut.preimage_bd_union_U] + exact .inl hx + refine hfix' y hyD ?_ + rw [← hψ] + have : ψ y ∈ θ ⁻¹' (bd S ∪ L.U) := by + rw [hθ.preimage_bd_union_U] + exact hx + exact this + · intro y hy + obtain ⟨e, r, hr, rfl⟩ := hstruct y hy + rcases hcases e r hr with rfl | rfl | hr' + · exact ⟨_, hy, (hend e).1⟩ + · exact ⟨_, hy, (hend e).2⟩ + · obtain ⟨r₀, hr₀, hb⟩ := hsurj e r hr' + refine ⟨ψ (N.f (i e) r₀), ?_, hb⟩ + rw [hp.1] + change θ (ψ _) ∈ K.U + rw [hψ, ← hi e] + exact hKIoo e r₀ hr₀ + · intro x hx + obtain ⟨e, r, hr, rfl⟩ := hstruct x (hXK hx) + rcases hcases e r hr with rfl | rfl | hr' + · rw [(hend e).1] + change θ (ψ _) ∈ G.V + rw [hψ, ← hi e] + exact (hendsG e).1 + · rw [(hend e).2] + change θ (ψ _) ∈ G.V + rw [hψ, ← hi e] + exact (hendsG e).2 + · obtain ⟨r', hr'Y, hb⟩ := hmove e r hr' hx + rw [hb] + change θ (ψ _) ∈ G.V + rw [hψ, ← hi e] + exact hr'Y.2 + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46SplitEdges.lean b/LeanPool/GraphMinor/GM07/Section46SplitEdges.lean new file mode 100644 index 0000000000..9c93a96d31 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46SplitEdges.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46LongEdges +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46ShortEdges +import LeanPool.GraphMinor.GM07.Section46LongPieces +import LeanPool.GraphMinor.GM07.Section46RefinedEdges +import LeanPool.GraphMinor.GM07.PullForest + +/-! +# All edges of the refined seam graph + +In VII (4.6), page 225, the edges of `J⁺` are the unchanged short edges +and the three pieces of each long edge. Every refined edge lies in one +old edge. On a long edge the local three-piece drawing has the same +marked vertices, so it accounts for every refined edge there. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +/-- The complete edge set of `J⁺` in VII (4.6), page 225. -/ +theorem J_plus_edges {S : Type*} [TopologicalSpace S] [T2Space S] + {G J J' : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (s t : longSeamEdges G J μ w → unitInterval) + (W : longSeamEdges G J μ w → Set S) + (hcuts : ∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)}) + (hU : J'.U = J.U) (hV : J'.V = J.V ∪ ⋃ e, W e) : + J'.E = shortSeamEdges G J μ w ∪ ⋃ e : longSeamEdges G J μ w, + {γ e.1 '' Ioo 0 (s e), γ e.1 '' Ioo (s e) (t e), γ e.1 '' Ioo (t e) 1} := by + have hW : ∀ e : longSeamEdges G J μ w, W e ⊆ e.1 := by + intro e x hx + rw [(hcuts e).2.2.2] at hx + rcases hx with rfl | rfl + · exact (congrArg (fun A => γ e.1 (s e) ∈ A) (hγ.image e.1 e.2.1)).mp + ⟨s e, (hcuts e).1, rfl⟩ + · exact (congrArg (fun A => γ e.1 (t e) ∈ A) (hγ.image e.1 e.2.1)).mp + ⟨t e, (hcuts e).2.1, rfl⟩ + apply Subset.antisymm + · intro f hf + obtain ⟨e, he, hfe⟩ := refined_edge_subset_old_edge hU hV hf + obtain ⟨x, hxf⟩ := hf.1 + by_cases helong : e ∈ longSeamEdges G J μ w + · let e' : longSeamEdges G J μ w := ⟨e, helong⟩ + have hc := hcuts e' + obtain ⟨P, hPU, hPV, hPE⟩ := exists_marked_long_edge_drawing hγ W hW e' + hc.1 hc.2.1 hc.2.2.1 hc.2.2.2 + have hxcl : x ∈ closure e'.1 := subset_closure (hfe hxf) + have hxP : x ∈ P.U := by rw [hPU]; exact hxcl + have hxPV : x ∉ P.V := by + intro hxV + rw [hPV] at hxV + have hxNew := (hf.2.1 hxf).2 + rw [hV] at hxNew + exact hxNew hxV.1 + obtain ⟨g, hg, hxg⟩ := exists_edge_of_mem hxP hxPV + have hgNew := local_marked_edge_mem_refinement hU hV he hPU hPV hg + have hfg := J'.edge_eq_of_mem hf hgNew hxf hxg + refine .inr (mem_iUnion.mpr ⟨e', ?_⟩) + rw [hfg, ← hPE] + exact hg + · have heShort : e ∈ shortSeamEdges G J μ w := ⟨he, helong⟩ + have heNew := short_edge_mem_J_plus W hW hU hV heShort + have hfeq := J'.edge_eq_of_mem hf heNew hxf (hfe hxf) + exact .inl (hfeq.symm ▸ heShort) + · intro f hf + rcases hf with hshort | hlong + · exact short_edge_mem_J_plus W hW hU hV hshort + · obtain ⟨e, he⟩ := mem_iUnion.mp hlong + have hc := hcuts e + have hm := long_edge_pieces_mem_J_plus hγ W hW hU hV e + hc.1 hc.2.1 hc.2.2.1 hc.2.2.2 + rcases he with rfl | rfl | rfl + · exact hm.1 + · exact hm.2.1 + · exact hm.2.2 + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46SurfaceApproach.lean b/LeanPool/GraphMinor/GM07/Section46SurfaceApproach.lean new file mode 100644 index 0000000000..219b845df2 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46SurfaceApproach.lean @@ -0,0 +1,200 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.CutComp +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.Gluing +import LeanPool.GraphMinor.Surface.InvarianceOfDomain + +/-! +# Small connected approaches in a surface + +In VII (4.6), page 228, `ψ` has one point over a point of `bd(Σ′)` off the +matching. The reason is local: a boundary point has small +neighbourhoods which stay connected once the boundary is removed. In a +half-plane chart such a neighbourhood contains an open half ball, which is +convex and lies off the boundary, and is dense in what remains. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface + +private theorem isInteriorPoint_halfSpace (q : EuclideanHalfSpace 2) (hq : 0 < q.1 0) : + IsInteriorPoint q := by + have hc : Continuous fun p : EuclideanPlane => p 0 := by fun_prop + have hopen : IsOpen {p : EuclideanPlane | 0 < p 0} := isOpen_lt continuous_const hc + obtain ⟨ρ, hρ, hball⟩ := Metric.isOpen_iff.mp hopen q.1 hq + have hind : IsInducing (fun x : EuclideanHalfSpace 2 => x.1) := ⟨rfl⟩ + have hinj : Function.Injective (fun x : EuclideanHalfSpace 2 => x.1) := Subtype.val_injective + have hemb : IsEmbedding (fun x : EuclideanHalfSpace 2 => x.1) := ⟨hind, hinj⟩ + let U : Set (EuclideanHalfSpace 2) := (fun x : EuclideanHalfSpace 2 => x.1) ⁻¹' ball q.1 ρ + have hUimg : (fun x : EuclideanHalfSpace 2 => x.1) '' U = ball q.1 ρ := by + ext p + constructor + · rintro ⟨x, hx, rfl⟩ + exact hx + · intro hp + exact ⟨⟨p, (hball hp).le⟩, hp, rfl⟩ + have e₁ : U ≃ₜ ball q.1 ρ := + (hemb.homeomorphImage U).trans (Homeomorph.setCongr hUimg) + have hρ' : ρ ≠ 0 := hρ.ne' + let e₂ : ball q.1 ρ ≃ₜ OpenUnitDisc := + { toFun := fun p => ⟨ρ⁻¹ • (p.1 - q.1), by + have hp : ‖p.1 - q.1‖ < ρ := by + have h := p.2 + rwa [mem_ball, dist_eq_norm] at h + simp only [OpenUnitDisc, mem_ball_zero_iff, norm_smul, norm_inv, Real.norm_eq_abs, + abs_of_pos hρ] + rw [inv_mul_lt_iff₀ hρ] + simpa using hp⟩ + invFun := fun y => ⟨q.1 + ρ • y.1, by + have hy : ‖y.1‖ < 1 := by simpa [OpenUnitDisc] using y.2 + simp only [mem_ball, dist_eq_norm, add_sub_cancel_left, norm_smul, Real.norm_eq_abs, + abs_of_pos hρ] + nlinarith⟩ + left_inv := fun p => by + apply Subtype.ext + simp [smul_smul, hρ'] + right_inv := fun y => by + apply Subtype.ext + simp [smul_smul, hρ'] + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop } + exact ⟨U, isOpen_ball.preimage hind.continuous, mem_ball_self hρ, ⟨e₁.trans e₂⟩⟩ + +/-- A manifold point has small neighbourhoods which stay connected without the boundary. -/ +theorem surface_connected_approach {Y : Type*} [TopologicalSpace Y] {x : Y} + (hx : IsManifoldPoint x) {O : Set Y} (hO : IsOpen O) (hxO : x ∈ O) : + ∃ W : Set Y, IsOpen W ∧ x ∈ W ∧ W ⊆ O ∧ IsPreconnected (W ∩ (bd Y)ᶜ) := by + classical + obtain ⟨U, V, hU, hV, hxU, ⟨e⟩⟩ := hx + have hind : IsInducing (fun x : EuclideanHalfSpace 2 => x.1) := ⟨rfl⟩ + -- The open embedding of the chart domain. + let c : V → Y := fun p => (e.symm p).1 + have hc : IsOpenEmbedding c := hU.isOpenEmbedding_subtypeVal.comp e.symm.isOpenEmbedding + let b : V → EuclideanHalfSpace 2 := Subtype.val + have hb : IsOpenEmbedding b := hV.isOpenEmbedding_subtypeVal + let vx : V := e ⟨x, hxU⟩ + have hcx : c vx = x := by simp [c, vx] + have hopen : IsOpen (b '' (c ⁻¹' O)) := hb.isOpenMap _ (hO.preimage hc.continuous) + obtain ⟨O₁, hO₁, hO₁e⟩ := hind.isOpen_iff.mp hopen + have hmem : (vx.1).1 ∈ O₁ := by + have : vx.1 ∈ (fun x : EuclideanHalfSpace 2 => x.1) ⁻¹' O₁ := by + rw [hO₁e] + exact ⟨vx, by simpa [hcx] using hxO, rfl⟩ + exact this + obtain ⟨r, hr, hball⟩ := Metric.isOpen_iff.mp hO₁ _ hmem + let B : Set V := b ⁻¹' ((fun x : EuclideanHalfSpace 2 => x.1) ⁻¹' ball (vx.1).1 r) + have hBo : IsOpen B := (isOpen_ball.preimage hind.continuous).preimage hb.continuous + have hBO : ∀ p ∈ B, c p ∈ O := by + intro p hp + have h1 : p.1 ∈ (fun x : EuclideanHalfSpace 2 => x.1) ⁻¹' O₁ := hball hp + rw [hO₁e] at h1 + obtain ⟨p', hp', hpp⟩ := h1 + rw [← hb.injective hpp] + exact hp' + refine ⟨c '' B, hc.isOpenMap _ hBo, ⟨vx, mem_ball_self hr, hcx⟩, ?_, ?_⟩ + · rintro _ ⟨p, hp, rfl⟩ + exact hBO p hp + -- The open half ball. + let P : Set EuclideanPlane := ball (vx.1).1 r ∩ {p | 0 < p 0} + have hPc : Convex ℝ P := by + apply (convex_ball _ _).inter + exact convex_halfSpace_gt (f := fun p : EuclideanPlane => p 0) ⟨fun _ _ => rfl, + fun _ _ => rfl⟩ 0 + let A : Set V := (fun p : V => (p.1).1) ⁻¹' P + have hvalemb : IsEmbedding (fun p : V => (p.1).1) := IsEmbedding.subtypeVal.comp hb.isEmbedding + have hAimg : (fun p : V => (p.1).1) '' A = P ∩ {p | ∃ h : 0 ≤ p 0, (⟨p, h⟩ : EuclideanHalfSpace + 2) ∈ V} := by + ext p + constructor + · rintro ⟨q, hq, rfl⟩ + exact ⟨hq, q.1.2, q.2⟩ + · rintro ⟨hp, h, hV'⟩ + exact ⟨⟨⟨p, h⟩, hV'⟩, hp, rfl⟩ + have hPV : P ⊆ {p | ∃ h : 0 ≤ p 0, (⟨p, h⟩ : EuclideanHalfSpace 2) ∈ V} := by + intro p hp + have h0 : 0 ≤ p 0 := hp.2.le + refine ⟨h0, ?_⟩ + have h1 : (⟨p, h0⟩ : EuclideanHalfSpace 2) ∈ (fun x : EuclideanHalfSpace 2 => x.1) ⁻¹' O₁ := + hball hp.1 + rw [hO₁e] at h1 + obtain ⟨p', -, hpp⟩ := h1 + exact hpp ▸ p'.2 + have hApre : IsPreconnected A := by + rw [← hvalemb.isInducing.isPreconnected_image, hAimg, inter_eq_left.mpr hPV] + exact hPc.isPreconnected + have hcA : c '' A ⊆ (bd Y)ᶜ := by + rintro _ ⟨p, hp, rfl⟩ hb' + apply hb' + apply isInteriorPoint_of_isOpenEmbedding hc + exact (isInteriorPoint_sub hV).mpr (isInteriorPoint_halfSpace _ hp.2) + have hAclosure : ∀ p ∈ B, p ∈ closure A := by + intro p hp + -- Push `p` upward by small amounts inside the ball and inside `V`. + let e₀ : EuclideanPlane := EuclideanSpace.single 0 1 + have he₀ : e₀ 0 = 1 := by simp [e₀] + let u : ℝ → EuclideanHalfSpace 2 := fun δ => ⟨(p.1).1 + max δ 0 • e₀, by + have h0 : 0 ≤ (p.1).1 0 := p.1.2 + have hm : 0 ≤ max δ 0 := le_max_right _ _ + simp only [PiLp.add_apply, PiLp.smul_apply, smul_eq_mul, he₀, mul_one] + linarith⟩ + have huc : Continuous u := by + apply Continuous.subtype_mk + fun_prop + have hu0 : u 0 = p.1 := by + apply Subtype.ext + simp [u] + have hB' : IsOpen (b '' B) := hb.isOpenMap _ hBo + have hmemB : p.1 ∈ b '' B := ⟨p, hp, rfl⟩ + have hev : ∀ᶠ δ in 𝓝 (0 : ℝ), u δ ∈ b '' B := by + apply huc.continuousAt.eventually_mem + rw [hu0] + exact hB'.mem_nhds hmemB + have hev' : ∀ᶠ δ in 𝓝[>] (0 : ℝ), u δ ∈ b '' B ∧ 0 < (u δ).1 0 := by + filter_upwards [hev.filter_mono nhdsWithin_le_nhds, self_mem_nhdsWithin] with δ h1 h2 + refine ⟨h1, ?_⟩ + have h0 : 0 ≤ (p.1).1 0 := p.1.2 + have hδ : (0 : ℝ) < δ := h2 + simp only [u, PiLp.add_apply, PiLp.smul_apply, smul_eq_mul, he₀, mul_one, max_eq_left hδ.le] + linarith + rw [_root_.mem_closure_iff] + intro G hG hpG + have hG' : IsOpen (b '' G) := hb.isOpenMap _ hG + have hev2 : ∀ᶠ δ in 𝓝[>] (0 : ℝ), u δ ∈ b '' G := by + apply Filter.Eventually.filter_mono nhdsWithin_le_nhds + apply huc.continuousAt.eventually_mem + rw [hu0] + exact hG'.mem_nhds ⟨p, hpG, rfl⟩ + obtain ⟨δ, ⟨hδB, hδpos⟩, hδG⟩ := (hev'.and hev2).exists + obtain ⟨q, hqG, hq⟩ := hδG + obtain ⟨q', hq'B, hq'⟩ := hδB + have hqq : q = q' := hb.injective (hq.trans hq'.symm) + subst hqq + refine ⟨q, hqG, ?_⟩ + have hqball : (q.1).1 ∈ ball (vx.1).1 r := hq'B + refine ⟨hqball, ?_⟩ + have : (q.1).1 = (u δ).1 := congrArg Subtype.val hq + change 0 < (q.1).1 0 + rw [this] + exact hδpos + have hsub1 : c '' A ⊆ c '' B ∩ (bd Y)ᶜ := fun y hy => by + obtain ⟨p, hp, rfl⟩ := hy + exact ⟨⟨p, hp.1, rfl⟩, hcA ⟨p, hp, rfl⟩⟩ + have hsub2 : c '' B ∩ (bd Y)ᶜ ⊆ closure (c '' A) := by + rintro _ ⟨⟨p, hp, rfl⟩, -⟩ + exact image_closure_subset_closure_image hc.continuous ⟨p, hAclosure p hp, rfl⟩ + exact (hApre.image c hc.continuous.continuousOn).subset_closure hsub1 hsub2 + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46ThreePieces.lean b/LeanPool/GraphMinor/GM07/Section46ThreePieces.lean new file mode 100644 index 0000000000..72c92579d7 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46ThreePieces.lean @@ -0,0 +1,102 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46EdgeSegments +import LeanPool.GraphMinor.GM07.Section46EdgeContacts +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM11.RadialBasics + +/-! +# The three-edge drawing on a long seam edge + +In VII (4.6), page 225, two interior contacts divide a long edge into +three edges. Glue the line drawings on its three closed parameter +intervals. The old edge may be a loop, so the first and last parameter +ends can coincide. All intersections are still at the marked vertices. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +universe u + +/-- The three actual edges obtained by the two cuts on a long seam edge, +in VII (4.6), page 225. -/ +theorem exists_three_piece_drawing {S : Type u} [TopologicalSpace S] [T2Space S] + {J : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {e : Set S} (he : e ∈ J.E) {s t : unitInterval} + (hs : s ∈ Ioo 0 1) (ht : t ∈ Ioo 0 1) (hst : s < t) : + ∃ D : Drawing S, D.U = closure e ∧ + D.V = ({γ e 0, γ e s} ∪ {γ e s, γ e t}) ∪ {γ e t, γ e 1} ∧ + D.E = {γ e '' Ioo 0 s, γ e '' Ioo s t, γ e '' Ioo t 1} := by + have hi₁ := edge_parameter_injOn_Icc hγ he (a := 0) (b := s) (.inr hs.2) + have hi₂ := edge_parameter_injOn_Icc hγ he (a := s) (b := t) (.inl hs.1) + have hi₃ := edge_parameter_injOn_Icc hγ he (a := t) (b := 1) (.inl ht.1) + have hL₁ := edge_parameter_line_Icc hγ he hs.1 (.inr hs.2) + have hL₂ := edge_parameter_line_Icc hγ he hst (.inl hs.1) + have hL₃ := edge_parameter_line_Icc hγ he ht.2 (.inl ht.1) + have hn₁ : γ e 0 ≠ γ e s := fun h => hs.1.ne (hi₁ ⟨le_rfl, hs.1.le⟩ ⟨hs.1.le, le_rfl⟩ h) + have hn₂ : γ e s ≠ γ e t := fun h => hst.ne (hi₂ ⟨le_rfl, hst.le⟩ ⟨hst.le, le_rfl⟩ h) + have hn₃ : γ e t ≠ γ e 1 := fun h => ht.2.ne (hi₃ ⟨le_rfl, ht.2.le⟩ ⟨ht.2.le, le_rfl⟩ h) + let D₁ := lineDrawing hL₁ hn₁ + let D₂ := lineDrawing hL₂ hn₂ + let D₃ := lineDrawing hL₃ hn₃ + have hmeet₁₂ : D₁.U ∩ D₂.U ⊆ D₁.V ∩ D₂.V := by + change (γ e '' Icc 0 s) ∩ (γ e '' Icc s t) ⊆ {γ e 0, γ e s} ∩ {γ e s, γ e t} + rintro x ⟨⟨u, hu, rfl⟩, ⟨v, hv, hvu⟩⟩ + rcases edge_parameter_eq_or_ends hγ he hvu.symm with huv | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · have hus : u = s := le_antisymm hu.2 (huv ▸ hv.1) + rw [hus] + exact ⟨.inr rfl, .inl rfl⟩ + · exact (not_le_of_gt ht.2 hv.2).elim + · exact (not_le_of_gt hs.2 hu.2).elim + let D₁₂ := D₁.glue D₂ hmeet₁₂ + have hmeet₃ : D₁₂.U ∩ D₃.U ⊆ D₁₂.V ∩ D₃.V := by + change ((γ e '' Icc 0 s) ∪ (γ e '' Icc s t)) ∩ (γ e '' Icc t 1) ⊆ + ({γ e 0, γ e s} ∪ {γ e s, γ e t}) ∩ {γ e t, γ e 1} + rintro x ⟨hx, ⟨v, hv, hvx⟩⟩ + rcases hx with ⟨u, hu, hux⟩ | ⟨u, hu, hux⟩ + · have huv' : γ e u = γ e v := hux.trans hvx.symm + rcases edge_parameter_eq_or_ends hγ he huv' with huv | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · have htu : t ≤ u := huv ▸ hv.1 + exact (not_le_of_gt hst (htu.trans hu.2)).elim + · exact ⟨.inl (.inl hux.symm), .inr hvx.symm⟩ + · exact (not_le_of_gt hs.2 hu.2).elim + · have huv' : γ e u = γ e v := hux.trans hvx.symm + rcases edge_parameter_eq_or_ends hγ he huv' with huv | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · have hut : u = t := le_antisymm hu.2 (huv ▸ hv.1) + have hxt : x = γ e t := hux.symm.trans (congrArg (γ e) hut) + exact ⟨.inr (.inr hxt), .inl hxt⟩ + · exact (not_le_of_gt hs.1 hu.1).elim + · exact (not_le_of_gt ht.2 hu.2).elim + refine ⟨D₁₂.glue D₃ hmeet₃, ?_, rfl, ?_⟩ + · change ((γ e '' Icc 0 s) ∪ (γ e '' Icc s t)) ∪ (γ e '' Icc t 1) = closure e + rw [← image_union, ← image_union] + have hcover : (Icc (0 : unitInterval) s ∪ Icc s t) ∪ Icc t 1 = univ := by + ext x + simp only [mem_union, mem_Icc, mem_univ, iff_true] + by_cases hxs : x ≤ s + · exact .inl (.inl ⟨bot_le, hxs⟩) + by_cases hxt : x ≤ t + · exact .inl (.inr ⟨(lt_of_not_ge hxs).le, hxt⟩) + · exact .inr ⟨(lt_of_not_ge hxt).le, le_top⟩ + rw [hcover, image_univ, edge_parameter_range hγ he] + · rw [Drawing.glue_E, Drawing.glue_E, lineDrawing_E, lineDrawing_E, lineDrawing_E] + rw [image_Icc_diff_endpoints hs.1 hi₁, image_Icc_diff_endpoints hst hi₂, + image_Icc_diff_endpoints ht.2 hi₃] + ext x + simp only [mem_union, mem_singleton_iff, mem_insert_iff] + exact or_assoc + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46UniqueLiftLimit.lean b/LeanPool/GraphMinor/GM07/Section46UniqueLiftLimit.lean new file mode 100644 index 0000000000..afd4efcb50 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46UniqueLiftLimit.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Topology.Connected.Basic +public import Mathlib.Topology.Maps.Proper.Basic +import Mathlib.Topology.Separation.Basic + +/-! +# Unique limiting values for a finite-fibre lift + +The second cutting map in VII (4.6), page 226, extends the lift of the +open net disc to its boundary. Near a boundary point, small pieces of +the open disc are connected. Two different limiting values would lie +in disjoint neighbourhoods of a finite fibre. Connectedness forces the +lift into one of those neighbourhoods, contradicting the other limit. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology + +/-- The limiting value of a lift is unique when small approaches from +its domain are connected and the target cutting map has finite fibres. +This is the boundary extension argument for the second cut in VII (4.6), +page 226. -/ +theorem unique_lift_limit_of_connected_approach + {X Y Z : Type*} [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] + [CompactSpace Y] [T2Space Y] [T2Space Z] + {U : Set X} {f : X → Z} {g : X → Y} {θ : Y → Z} + (hf : Continuous f) (hg : ContinuousOn g U) (hθ : Continuous θ) + (hfinite : ∀ z, (θ ⁻¹' {z}).Finite) (hrel : ∀ x ∈ U, θ (g x) = f x) + {x : X} + (happroach : ∀ O : Set X, IsOpen O → x ∈ O → + ∃ W : Set X, IsOpen W ∧ x ∈ W ∧ W ⊆ O ∧ IsPreconnected (W ∩ U)) + {a b : Y} + (ha : (x, a) ∈ closure ((fun z => (z, g z)) '' U)) + (hb : (x, b) ∈ closure ((fun z => (z, g z)) '' U)) : a = b := by + classical + have hclosed : IsClosed {p : X × Y | θ p.2 = f p.1} := + isClosed_eq (hθ.comp continuous_snd) (hf.comp continuous_fst) + have hclrel : closure ((fun z => (z, g z)) '' U) ⊆ {p : X × Y | θ p.2 = f p.1} := by + apply closure_minimal _ hclosed + rintro p ⟨z, hz, rfl⟩ + exact hrel z hz + have haθ : θ a = f x := hclrel ha + have hbθ : θ b = f x := hclrel hb + by_contra hne + have hrest : (θ ⁻¹' {f x} \ {a}).Finite := (hfinite (f x)).subset sdiff_subset + obtain ⟨O₁, O₂, hO₁, hO₂, haO, hrestO, hdis⟩ := + SeparatedNhds.of_finite (finite_singleton a) hrest (by simp) + have haO₁ : a ∈ O₁ := haO rfl + have hbO₂ : b ∈ O₂ := hrestO ⟨hbθ, fun h => hne h.symm⟩ + have hK : IsClosed (θ '' (O₁ ∪ O₂)ᶜ) := hθ.isClosedMap _ (hO₁.union hO₂).isClosed_compl + have hxO : x ∈ f ⁻¹' (θ '' (O₁ ∪ O₂)ᶜ)ᶜ := by + rintro ⟨y, hy, hyθ⟩ + by_cases hya : y = a + · exact hy (.inl (hya ▸ haO₁)) + · exact hy (.inr (hrestO ⟨hyθ, hya⟩)) + obtain ⟨W, hWo, hxW, hWO, hWc⟩ := happroach _ (hK.isOpen_compl.preimage hf) hxO + let T := g '' (W ∩ U) + have hTc : IsPreconnected T := hWc.image g (hg.mono inter_subset_right) + have hTsub : T ⊆ O₁ ∪ O₂ := by + rintro y ⟨z, ⟨hzW, hzU⟩, rfl⟩ + by_contra hn + exact hWO hzW ⟨g z, hn, hrel z hzU⟩ + have hmeet : ∀ (V : Set Y), IsOpen V → ∀ y ∈ V, + (x, y) ∈ closure ((fun z => (z, g z)) '' U) → (T ∩ V).Nonempty := by + intro V hVo y hy hcl + obtain ⟨p, hp, hpgraph⟩ := mem_closure_iff.mp hcl (W ×ˢ V) (hWo.prod hVo) ⟨hxW, hy⟩ + obtain ⟨z, hzU, hz⟩ := hpgraph + rw [← hz] at hp + exact ⟨g z, ⟨z, ⟨hp.1, hzU⟩, rfl⟩, hp.2⟩ + rcases IsPreconnected.subset_or_subset hO₁ hO₂ hdis hTsub hTc with h | h + · obtain ⟨y, hyT, hyO⟩ := hmeet O₂ hO₂ b hbO₂ hb + exact disjoint_left.mp hdis (h hyT) hyO + · obtain ⟨y, hyT, hyO⟩ := hmeet O₁ hO₁ a haO₁ ha + exact disjoint_left.mp hdis hyO (h hyT) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46Universe.lean b/LeanPool/GraphMinor/GM07/Section46Universe.lean new file mode 100644 index 0000000000..dd58cd3c02 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46Universe.lean @@ -0,0 +1,217 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46Reduce +import LeanPool.GraphMinor.GM07.Section46WTransport +import LeanPool.GraphMinor.GM07.Section3 +import LeanPool.GraphMinor.GM12.Section3HomeoWalks +import LeanPool.GraphMinor.GM19.Section4c +import LeanPool.GraphMinor.Surface.AddCrosscap + +/-! +# The hypotheses of VII (4.6) along a homeomorphism + +The proof of VII (4.6) takes place in a surface in `Type`. A surface in any +universe is homeomorphic to its model, so the hypotheses and the conclusion of +(4.6) move along that homeomorphism. Only hypothesis (ii) needs care, since it +speaks of all capped surfaces in the universe of the surface. There we lift a +capped surface to the larger universe with `ULift`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} {T : Type} [TopologicalSpace S] [TopologicalSpace T] + +/-- A homeomorphism carries cuffs to cuffs. -/ +theorem cuffs_image_homeo (e : S ≃ₜ T) : cuffs T = (fun C => e '' C) '' cuffs S := by + ext C + simp only [cuffs, componentsIn, mem_image] + constructor + · rintro ⟨y, hy, rfl⟩ + rw [← GM19.image_bd e] at hy + obtain ⟨x, hx, rfl⟩ := hy + refine ⟨_, ⟨x, hx, rfl⟩, ?_⟩ + rw [← GM19.image_bd e] + exact e.image_connectedComponentIn hx + · rintro ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + refine ⟨e x, by rw [← GM19.image_bd e]; exact mem_image_of_mem e hx, ?_⟩ + rw [← GM19.image_bd e] + exact (e.image_connectedComponentIn hx).symm + +/-- The number `v(Σ, k)` depends only on the homeomorphism type. -/ +theorem vSurface_eq_of_homeo (e : S ≃ₜ T) (k : ℕ) : vSurface S k = vSurface T k := by + unfold vSurface + congr 1 + ext v + constructor + · rintro ⟨a, b, c, ⟨f⟩, h⟩ + exact ⟨a, b, c, ⟨e.symm.trans f⟩, h⟩ + · rintro ⟨a, b, c, ⟨f⟩, h⟩ + exact ⟨a, b, c, ⟨e.trans f⟩, h⟩ + +private theorem isNormal_pull (e : S ≃ₜ T) {G : Drawing S} {B : Set T} + (h : (mapDrawingHomeo e G).IsNormal B) : G.IsNormal (e.symm '' B) := by + rintro x ⟨⟨y, hy, rfl⟩, hx⟩ + obtain ⟨z, hz, hzz⟩ := h ⟨hy, ⟨_, hx, by simp⟩⟩ + have : z = e.symm y := by + rw [← hzz] + simp + exact this ▸ hz + +private theorem ncard_pull (e : S ≃ₜ T) (G : Drawing S) (B : Set T) : + (G.V ∩ e.symm '' B).ncard = ((mapDrawingHomeo e G).V ∩ B).ncard := by + have : (mapDrawingHomeo e G).V ∩ B = e '' (G.V ∩ e.symm '' B) := by + ext y + constructor + · rintro ⟨⟨x, hx, rfl⟩, hy⟩ + exact ⟨x, ⟨hx, _, hy, by simp⟩, rfl⟩ + · rintro ⟨x, ⟨hx, y, hy, rfl⟩, rfl⟩ + exact ⟨⟨_, hx, rfl⟩, by simpa using hy⟩ + rw [this, ncard_image_of_injective _ e.injective] + +theorem IsNullHomotopicOArc.image_homeo {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + (e : X ≃ₜ Y) {F : Set X} (h : IsNullHomotopicOArc F) : IsNullHomotopicOArc (e '' F) := by + obtain ⟨φ, hφ⟩ := h + refine ⟨φ.trans (e.image F), ?_⟩ + obtain ⟨c, -, ψ, -, h0, h1⟩ := hφ + refine ⟨e c, mem_univ _, ⟨⟨fun p => e (ψ p), by fun_prop⟩, fun _ => mem_univ _, fun x => ?_, + fun x => ?_⟩⟩ + · change e (ψ (x, 0)) = e (φ x).1 + rw [h0] + rfl + · change e (ψ (x, 1)) = e c + rw [h1] + rfl + +/-- Hypothesis (i) of VII (4.6) along a homeomorphism. -/ +theorem hi_map (e : S ≃ₜ T) {G : Drawing S} {v : ℕ} + (hi : ∀ B : Set S, G.IsNormal B → IsIArc B → (G.V ∩ B).ncard ≤ v → + ∃ C ∈ cuffs S, lineEnds B ⊆ C) : + ∀ B : Set T, (mapDrawingHomeo e G).IsNormal B → IsIArc B → + ((mapDrawingHomeo e G).V ∩ B).ncard ≤ v → ∃ C ∈ cuffs T, lineEnds B ⊆ C := by + intro B hn hI hc + obtain ⟨u₀, v₀, hu, hv, hl⟩ := hI + have hsym : ∀ {x : T}, x ∈ bd T → e.symm x ∈ bd S := fun {x} hx => by + rw [← GM19.image_bd e.symm] + exact mem_image_of_mem _ hx + have hmap : ∀ {a b : T}, IsLineWithEnds B a b → IsLineWithEnds (e.symm '' B) (e.symm a) + (e.symm b) := + fun {a b} ⟨f, h0, h1⟩ => ⟨f.trans (e.symm.image B), by simp [h0], by simp [h1]⟩ + obtain ⟨C, hC, hsub⟩ := hi _ (isNormal_pull e hn) ⟨_, _, hsym hu, hsym hv, hmap hl⟩ + (by rw [ncard_pull]; exact hc) + refine ⟨e '' C, by rw [cuffs_image_homeo e]; exact mem_image_of_mem _ hC, ?_⟩ + rintro x ⟨y, hy⟩ + exact ⟨e.symm x, hsub ⟨_, hmap hy⟩, by simp⟩ + +private theorem discBd_image_homeo {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + (e : X ≃ₜ Y) (Δ : Set X) : discBd (e '' Δ) = e '' discBd Δ := by + unfold discBd + ext y + constructor + · rintro ⟨w, hw, rfl⟩ + rw [← GM19.image_bd (e.image Δ)] at hw + obtain ⟨x, hx, rfl⟩ := hw + exact ⟨x.1, ⟨x, hx, rfl⟩, rfl⟩ + · rintro ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + exact ⟨e.image Δ x, by + rw [← GM19.image_bd (e.image Δ)] + exact mem_image_of_mem _ hx, rfl⟩ + +/-- The null-homotopy condition in a capped surface moves to the model. -/ +private theorem capped_map (e : S ≃ₜ T) {C : Set S} {B : Set T} + (h : IsNullHomotopicOArcInCappedCuff C (e.symm '' B)) : + IsNullHomotopicOArcInCappedCuff (e '' C) B := by + obtain ⟨hC, hB, hall⟩ := h + have hC' : IsCuff (e '' C) := by + change e '' C ∈ cuffs T + rw [cuffs_image_homeo e] + exact mem_image_of_mem _ hC + refine ⟨hC', ?_, ?_⟩ + · have := isOArc_image e.isEmbedding hB + rwa [image_image, show (fun x => e (e.symm x)) = id from funext (by simp), image_id] at this + · intro S₀ _ j₀ D₀ hcap + let u : S₀ ≃ₜ ULift.{u} S₀ := Homeomorph.ulift.symm + have hcap' : IsCappedCuff C (ULift.{u} S₀) (fun x => u (j₀ (e x))) (u '' D₀) := by + obtain ⟨-, hsurf, hemb, hdisc, hbd, hun, hin⟩ := hcap + have himg : ∀ A : Set S, (fun x => u (j₀ (e x))) '' A = u '' (j₀ '' (e '' A)) := fun A => by + simp only [image_image] + have hrange : range (fun x => u (j₀ (e x))) = u '' range j₀ := by + rw [← image_univ, himg, image_univ, e.range_coe, image_univ] + refine ⟨hC, isSurface_of_homeo u hsurf, u.isEmbedding.comp (hemb.comp e.isEmbedding), ?_, + ?_, ?_, ?_⟩ + · obtain ⟨φ⟩ := hdisc + exact ⟨φ.trans (u.image D₀)⟩ + · rw [discBd_image_homeo, hbd, himg] + · rw [hrange, ← image_union, hun, image_univ, u.range_coe] + · rw [hrange, himg, ← image_inter u.injective, hin] + have hnull := hall (ULift.{u} S₀) _ _ hcap' + have := IsNullHomotopicOArc.image_homeo u.symm hnull + convert this using 1 + ext y + simp [image_image] + +/-- Hypothesis (ii) of VII (4.6) along a homeomorphism. -/ +theorem hii_map (e : S ≃ₜ T) {G : Drawing S} {v : ℕ} + (hii : ∀ B : Set S, G.IsNormal B → IsOArc B → (G.V ∩ B).ncard ≤ v → + IsNullHomotopicOArc B ∨ + ∃ C ∈ cuffs S, IsNullHomotopicOArcInCappedCuff C B ∧ G.V ∩ C ⊆ B) : + ∀ B : Set T, (mapDrawingHomeo e G).IsNormal B → IsOArc B → + ((mapDrawingHomeo e G).V ∩ B).ncard ≤ v → + IsNullHomotopicOArc B ∨ + ∃ C ∈ cuffs T, IsNullHomotopicOArcInCappedCuff C B ∧ (mapDrawingHomeo e G).V ∩ C ⊆ B := by + intro B hn hO hc + rcases hii _ (isNormal_pull e hn) (isOArc_image e.symm.isEmbedding hO) + (by rw [ncard_pull]; exact hc) with h | ⟨C, hC, hcap, hsub⟩ + · left + have := IsNullHomotopicOArc.image_homeo e h + rwa [image_image, show (fun x => e (e.symm x)) = id from funext (by simp), image_id] at this + · refine .inr ⟨e '' C, by rw [cuffs_image_homeo e]; exact mem_image_of_mem _ hC, + capped_map e hcap, ?_⟩ + rintro _ ⟨⟨x, hx, rfl⟩, ⟨y, hy, hxy⟩⟩ + obtain rfl := e.injective hxy + obtain ⟨b, hb, rfl⟩ := hsub ⟨hx, hy⟩ + simpa using hb + +/-- Hypothesis (iii) of VII (4.6) along a homeomorphism. -/ +theorem hiii_map (e : S ≃ₜ T) {G : Drawing S} + (hiii : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard) : + ∀ C ∈ cuffs T, 2 ≤ ((mapDrawingHomeo e G).V ∩ C).ncard := by + intro C hC + rw [cuffs_image_homeo e] at hC + obtain ⟨C₀, hC₀, rfl⟩ := hC + change 2 ≤ (e '' G.V ∩ e '' C₀).ncard + rw [← image_inter e.injective, ncard_image_of_injective _ e.injective] + exact hiii C₀ hC₀ + +/-- Feasibility comes back along a homeomorphism. -/ +theorem isGFeasible_of_map (e : S ≃ₜ T) {G H : Drawing S} + (h : IsGFeasible (mapDrawingHomeo e G) (mapDrawingHomeo e H)) : IsGFeasible G H := by + obtain ⟨X, hX, hhom, hsub⟩ := h + have hhom' := ForestsHomoplastic.map_homeomorph e.symm hhom + rw [GM12.mapDrawingHomeo_symm] at hhom' + refine ⟨mapDrawingHomeo e.symm X, IsSurfaceForest.map_homeo e.symm hX, hhom', ?_, ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + obtain ⟨y, hy, rfl⟩ := hsub.1 hx + simpa using hy + · intro f hf + rw [GM12.mapDrawingHomeo_edges] at hf + obtain ⟨g, hg, rfl⟩ := hf + have := hsub.2 hg + rw [GM12.mapDrawingHomeo_edges] at this + obtain ⟨g₀, hg₀, rfl⟩ := this + rwa [image_image, show (fun x => e.symm (e x)) = id from funext (by simp), image_id] + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46Valency.lean b/LeanPool/GraphMinor/GM07/Section46Valency.lean new file mode 100644 index 0000000000..86879cf88d --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46Valency.lean @@ -0,0 +1,54 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section2 + +/-! +# The seam valency bound in VII (4.6) + +The first count on page 225 bounds the valency of a seam vertex by twice +the number of edges. The handshaking identity proves this for every drawing. +Applying (2.4) gives the bound used when choosing `l(z)`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The inequality `d(z) ≤ 2|E(J)|` in VII (4.6), page 225. -/ +theorem vertexValency_le_two_mul_ncard_edges + (J : Drawing S) {z : S} (hz : z ∈ J.V) : + vertexValency J z ≤ 2 * J.E.ncard := by + classical + calc + vertexValency J z ≤ ∑ v ∈ J.finite_V.toFinset, vertexValency J v := + Finset.single_le_sum (fun _ _ => Nat.zero_le _) (J.finite_V.mem_toFinset.mpr hz) + _ = 2 * J.E.ncard := sum_vertexValency_eq_two_mul_ncard_E J + +/-- The valency estimate from (2.4) used in VII (4.6), page 225. -/ +theorem seam_vertexValency_bound_4_6 (hS : IsSurface S) + {a b c : ℕ} (habc : 1 < 2 * a + b + c) + (hmodel : Nonempty (S ≃ₜ SurfaceModel a b c)) + {G J : Drawing S} {N : Net S} (hG : G.IsProper) + (hmin : N.IsMinimalFor G) (hseam : N.IsSeamGraphFor J) + {z : S} (hz : z ∈ J.V) : + vertexValency J z ≤ 6 * (2 * a + b + c - 1) := by + have he := (theorem_2_4_proof hS habc hmodel hG hmin hseam).2 + have hv := vertexValency_le_two_mul_ncard_edges J hz + omega + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46W.lean b/LeanPool/GraphMinor/GM07/Section46W.lean new file mode 100644 index 0000000000..a9476508b3 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46W.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46LongEdges +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM07.Section46LongCutParameters + +/-! +# The sets `W(e)` and `W` in VII (4.6) + +Choose the two ordered contacts on each long edge, as on page 225. +Their union is finite and lies in `V(G)` off the old seam vertices. +Thus these are precisely points that can be added when forming `J⁺`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface GraphMinor.GM11 + +universe u + +/-- The cut points `W(e)` on all long edges, and their union `W`, in +VII (4.6), page 225. The counts refer to the closed linking intervals +and the open central interval in the edge parameter. -/ +theorem exists_W_for_long_edges {S : Type u} [TopologicalSpace S] [T2Space S] + {G J : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar J γ) + {μ w : ℕ} (hμ : 0 < μ) : + ∃ (s t : longSeamEdges G J μ w → unitInterval) + (W : longSeamEdges G J μ w → Set S), + (∀ e, s e ∈ Ioo 0 1 ∧ t e ∈ Ioo 0 1 ∧ s e < t e ∧ + W e = {γ e.1 (s e), γ e.1 (t e)} ∧ (W e).ncard = 2 ∧ W e ⊆ e.1 ∩ G.V ∧ + (γ e.1 '' Iic (s e) ∩ G.V).ncard = μ + 1 ∧ + (γ e.1 '' Ici (t e) ∩ G.V).ncard = μ + 1 ∧ + w ≤ (γ e.1 '' Ioo (s e) (t e) ∩ G.V).ncard) ∧ + (⋃ e, W e).Finite ∧ (⋃ e, W e) ⊆ G.V \ J.V := by + classical + have hex := fun e : longSeamEdges G J μ w => + exists_long_edge_cut_parameters (G := G) hγ e.2.1 hμ e.2.2 + choose s hs t ht hst hsG htG hne hleft hright hmid using hex + let W : longSeamEdges G J μ w → Set S := fun e => {γ e.1 (s e), γ e.1 (t e)} + have hsub : (⋃ e, W e) ⊆ G.V \ J.V := by + intro x hx + obtain ⟨e, he⟩ := mem_iUnion.mp hx + have hxG : x ∈ e.1 ∩ G.V := by + rcases he with rfl | rfl + · exact hsG e + · exact htG e + exact ⟨hxG.2, (e.2.1.2.1 hxG.1).2⟩ + refine ⟨s, t, W, ?_, G.finite_V.subset (hsub.trans sdiff_subset), hsub⟩ + intro e + refine ⟨hs e, ht e, hst e, rfl, ncard_pair (hne e), ?_, hleft e, hright e, hmid e⟩ + intro x hx + rcases hx with rfl | rfl + · exact hsG e + · exact htG e + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46WIntersections.lean b/LeanPool/GraphMinor/GM07/Section46WIntersections.lean new file mode 100644 index 0000000000..3f2e416c5f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46WIntersections.lean @@ -0,0 +1,54 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46LongEdges +import LeanPool.GraphMinor.GM11.Walks + +/-! +# The new vertices on each closed seam edge + +In VII (4.6), page 225, `W(e)` lies inside the old edge `e`. +Different old edges are disjoint. No point of `W` is an old vertex, +so intersecting `W` with a closed long edge gives exactly its own +pair of cut points. This identifies the marked local drawing in `J⁺`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +/-- Only the two cut points belonging to a long edge lie on its closure, +in the construction of `J⁺` in VII (4.6), page 225. -/ +theorem W_inter_closed_long_edge {S : Type*} [TopologicalSpace S] + {G J : Drawing S} {μ w : ℕ} (W : longSeamEdges G J μ w → Set S) + (hW : ∀ f, W f ⊆ f.1) (e : longSeamEdges G J μ w) : + (⋃ f, W f) ∩ closure e.1 = W e := by + apply Subset.antisymm + · intro x hx + obtain ⟨f, hxf⟩ := mem_iUnion.mp hx.1 + have hxfE := hW f hxf + have hxV : x ∉ J.V := (f.2.1.2.1 hxfE).2 + have hxe : x ∈ e.1 := J.closure_diff_V e.2.1 ▸ (⟨hx.2, hxV⟩ : x ∈ closure e.1 \ J.V) + have hef : e = f := Subtype.ext (J.edge_eq_of_mem e.2.1 f.2.1 hxe hxfE) + exact hef ▸ hxf + · intro x hx + exact ⟨mem_iUnion.mpr ⟨e, hx⟩, subset_closure (hW e hx)⟩ + +/-- The marked vertices of the local drawing on a closed long edge are +its old ends together with `W(e)`, in VII (4.6), page 225. -/ +theorem marked_vertices_closed_long_edge {S : Type*} [TopologicalSpace S] + {G J : Drawing S} {μ w : ℕ} (W : longSeamEdges G J μ w → Set S) + (hW : ∀ f, W f ⊆ f.1) (e : longSeamEdges G J μ w) : + (J.V ∪ ⋃ f, W f) ∩ closure e.1 = (closure e.1 ∩ J.V) ∪ W e := by + rw [union_inter_distrib_right, W_inter_closed_long_edge W hW e, inter_comm J.V] + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46WTransport.lean b/LeanPool/GraphMinor/GM07/Section46WTransport.lean new file mode 100644 index 0000000000..138491778e --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46WTransport.lean @@ -0,0 +1,106 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM07.Section3 +import LeanPool.GraphMinor.GM07.CuffSlide +import LeanPool.GraphMinor.GM07.Section35 +import LeanPool.GraphMinor.GM07.Section46Constants +import LeanPool.GraphMinor.Surface.ModelCriterion + +/-! +# The `w` bound after cutting + +VII (4.6), page 226, uses the fact that `w(Σ′,2k,3(2a+b+c-1))` +depends only on the homeomorphism type of `Σ′`. Transport matchings, +forests and their homoplasties along a homeomorphism to transport every +valid bound. The upper cuff bound then places its model among the +finitely many models in the maximum defining `w`. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set GraphMinor.Surface + +/-- Homoplasties transport under a homeomorphism, by conjugating the +boundary-fixing homeomorphism in their definition. -/ +theorem ForestsHomoplastic.map_homeomorph {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (e : S ≃ₜ T) {H H' : Drawing S} (h : ForestsHomoplastic H H') : + ForestsHomoplastic (mapDrawingHomeo e H) (mapDrawingHomeo e H') := by + obtain ⟨α, hα, hhom⟩ := h + let β := (e.symm.trans α).trans e + refine ⟨β, ?_, ?_⟩ + · intro x hx + have hxS : e.symm x ∈ bd S := by + rw [← image_bd_homeomorph e.symm] + exact mem_image_of_mem e.symm hx + change e (α (e.symm x)) = x + rw [hα _ hxS, e.apply_symm_apply] + · have hhom' := ForestsHomotopic.map_homeo e hhom + have heq : mapDrawingHomeo β (mapDrawingHomeo e H) = mapDrawingHomeo e (mapDrawingHomeo α H) + := by + cases H + simp only [mapDrawingHomeo, Drawing.mk.injEq] + constructor <;> ext x <;> simp [β, Homeomorph.trans_apply] + rw [heq] + exact hhom' + +/-- Valid bounds in (3.6) transport along a homeomorphism, as used +in VII (4.6), page 226. -/ +theorem IsW36Bound.map_homeomorph {S T : Type} [TopologicalSpace S] [TopologicalSpace T] + (e : S ≃ₜ T) {k n w : ℕ} (h : IsW36Bound S k n w) : IsW36Bound T k n w := by + intro G H hG hGV hH hHV + have hGV' : (mapDrawingHomeo e.symm G).V.ncard ≤ 2 * n := by + change (e.symm '' G.V).ncard ≤ _ + rw [ncard_image_of_injective _ e.symm.injective] + exact hGV + have hHV' : ((mapDrawingHomeo e.symm H).V ∩ bd S).ncard ≤ k := by + change (e.symm '' H.V ∩ bd S).ncard ≤ _ + rw [← image_bd_homeomorph e.symm, ← image_inter e.symm.injective, + ncard_image_of_injective _ e.symm.injective] + exact hHV + obtain ⟨H', hH', hhom, hfin, hbound⟩ := h (mapDrawingHomeo e.symm G) (mapDrawingHomeo e.symm H) + (IsMatching.map_homeo e.symm hG) hGV' (IsSurfaceForest.map_homeo e.symm hH) hHV' + have hhom' := ForestsHomoplastic.map_homeomorph e hhom + have hcancel : mapDrawingHomeo e (mapDrawingHomeo e.symm H) = H := by + simpa only [Homeomorph.symm_symm] using mapDrawingHomeo_symm_mapDrawingHomeo e.symm H + rw [hcancel] at hhom' + have hcontacts : G.U ∩ (mapDrawingHomeo e H').U = + e '' ((mapDrawingHomeo e.symm G).U ∩ H'.U) := by + rw [image_inter e.injective] + change G.U ∩ e '' H'.U = e '' (e.symm '' G.U) ∩ e '' H'.U + simp only [image_image, Homeomorph.apply_symm_apply, image_id'] + refine ⟨mapDrawingHomeo e H', IsSurfaceForest.map_homeo e hH', hhom', ?_, ?_⟩ + · rw [hcontacts] + exact hfin.image _ + · rw [hcontacts, ncard_image_of_injective _ e.injective] + exact hbound + +/-- The least (3.6) bound cannot increase when transporting a bound from +one homeomorphic surface, as used in VII (4.6), page 226. -/ +theorem wSurface_le_of_homeomorph {S T : Type} [TopologicalSpace S] [TopologicalSpace T] + (hS : IsSurface S) (e : S ≃ₜ T) (k n : ℕ) : + wSurface T k n ≤ wSurface S k n := by + have hw := theorem_3_6_proof hS k n + exact Nat.sInf_le (IsW36Bound.map_homeomorph e hw) + +/-- The maximum defining `w` bounds the cut surface's (3.6) constant, +from the upper cuff bound in VII (4.6), page 226. -/ +theorem wSurface_cut_model_le_wMaxModel {S' : Type} [TopologicalSpace S'] + {a b c c' k : ℕ} (hmodel : Nonempty (S' ≃ₜ SurfaceModel a b c')) + (hc' : c' ≤ 2 * (2 * a + b + c - 1)) : + wSurface S' (2 * k) (3 * (2 * a + b + c - 1)) ≤ wMaxModel a b c k := by + have hmodelS : IsSurface (SurfaceModel a b c') := (modelCriterion.1 a b c').1 + exact (wSurface_le_of_homeomorph hmodelS hmodel.some.symm _ _).trans + (wSurface_model_le_wMaxModel hc') + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section46WalkOfConnected.lean b/LeanPool/GraphMinor/GM07/Section46WalkOfConnected.lean new file mode 100644 index 0000000000..3cd34a3704 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section46WalkOfConnected.lean @@ -0,0 +1,109 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section46CentralLift +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM07.Section2Base +import LeanPool.GraphMinor.GM07.NetExists + +/-! +# Walks from connected sets + +The forest `H₆` of VII (4.6), page 227, is `H₅` with more vertices. To +compare their paths we use a plain fact: two vertices of a graph which lie +in a connected subset of its point set are joined by a walk. The vertices +joined to the first one, with the edges at them, form a closed set, as do +the other vertices with their edges. These two sets are disjoint and +cover the point set. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- Two vertices in a connected subset of `U(Γ)` are joined by a walk of `Γ`. -/ +theorem exists_walk_of_preconnected (Γ : Drawing S) {A : Set S} (hA : IsPreconnected A) + (hAU : A ⊆ Γ.U) {a b : S} (ha : a ∈ Γ.V) (haA : a ∈ A) (hb : b ∈ Γ.V) (hbA : b ∈ A) : + Nonempty (GraphWalk Γ.toGraph a b) := by + classical + let Rv : Set S := {v | v ∈ Γ.V ∧ Nonempty (GraphWalk Γ.toGraph a v)} + have hRa : a ∈ Rv := ⟨ha, ⟨.nil ha⟩⟩ + have hstep : ∀ e ∈ Γ.E, (closure e ∩ Rv).Nonempty → ∀ y ∈ closure e, y ∈ Γ.V → y ∈ Rv := by + rintro e he ⟨r, hrc, hrV, ⟨W⟩⟩ y hy hyV + by_cases hyr : y = r + · exact hyr ▸ ⟨hrV, ⟨W⟩⟩ + have hcap : closure e ∩ Γ.V = {r, y} := by + rcases Γ.edge_cond e he with ⟨u, v, -, hc, -⟩ | ⟨u, hc, -⟩ + · have h1 : r ∈ ({u, v} : Set S) := hc ▸ ⟨hrc, hrV⟩ + have h2 : y ∈ ({u, v} : Set S) := hc ▸ ⟨hy, hyV⟩ + rw [hc] + rcases h1 with rfl | rfl <;> rcases h2 with rfl | rfl + · exact (hyr rfl).elim + · rfl + · exact pair_comm _ _ + · exact (hyr rfl).elim + · have h1 : r ∈ ({u} : Set S) := hc ▸ ⟨hrc, hrV⟩ + have h2 : y ∈ ({u} : Set S) := hc ▸ ⟨hy, hyV⟩ + exact (hyr (h2.trans h1.symm)).elim + have hl : Γ.toGraph.IsLink e r y := ⟨he, hrV, hyV, hcap⟩ + exact ⟨hyV, ⟨W.append (.cons hl (.nil hyV))⟩⟩ + let Et : Set (Set S) := {e ∈ Γ.E | (closure e ∩ Rv).Nonempty} + let En : Set (Set S) := {e ∈ Γ.E | ¬(closure e ∩ Rv).Nonempty} + let T₁ : Set S := Rv ∪ ⋃ e ∈ Et, closure e + let T₂ : Set S := (Γ.V \ Rv) ∪ ⋃ e ∈ En, closure e + have hRvfin : Rv.Finite := Γ.finite_V.subset fun _ hv => hv.1 + have hEtfin : Et.Finite := Γ.finite_edges.subset fun _ he => he.1 + have hEnfin : En.Finite := Γ.finite_edges.subset fun _ he => he.1 + have hT₁ : IsClosed T₁ := + hRvfin.isClosed.union (hEtfin.isClosed_biUnion fun _ _ => isClosed_closure) + have hT₂ : IsClosed T₂ := + (Γ.finite_V.subset sdiff_subset).isClosed.union + (hEnfin.isClosed_biUnion fun _ _ => isClosed_closure) + have hcov : A ⊆ T₁ ∪ T₂ := by + intro x hx + rcases (mem_U_iff_edge Γ).mp (hAU hx) with h | ⟨e, he, hxe⟩ + · by_cases hR : x ∈ Rv + · exact .inl (.inl hR) + · exact .inr (.inl ⟨h, hR⟩) + · by_cases ht : (closure e ∩ Rv).Nonempty + · exact .inl (.inr (mem_biUnion (x := e) ⟨he, ht⟩ (subset_closure hxe))) + · exact .inr (.inr (mem_biUnion (x := e) ⟨he, ht⟩ (subset_closure hxe))) + have hdis : Disjoint T₁ T₂ := by + have hvert : ∀ x ∈ Rv, ∀ e ∈ En, x ∉ closure e := fun x hx e he hxe => he.2 ⟨x, hxe, hx⟩ + rw [disjoint_left] + rintro x (hx | hx) hx₂ + · rcases hx₂ with hx₂ | hx₂ + · exact hx₂.2 hx + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx₂ + exact hvert x hx e he hxe + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + rcases hx₂ with hx₂ | hx₂ + · exact hx₂.2 (hstep e he.1 he.2 x hxe hx₂.1) + · obtain ⟨e', he', hxe'⟩ := mem_iUnion₂.mp hx₂ + by_cases hV : x ∈ Γ.V + · exact hvert x (hstep e he.1 he.2 x hxe hV) e' he' hxe' + · have h1 : x ∈ e := (Γ.closure_diff_V he.1) ▸ ⟨hxe, hV⟩ + have h2 : x ∈ e' := (Γ.closure_diff_V he'.1) ▸ ⟨hxe', hV⟩ + have heq : e = e' := arcComponentsIn_eq_of_mem he.1 he'.1 h1 h2 + exact he'.2 (heq ▸ he.2) + by_contra hne + have hbT₂ : b ∈ T₂ := .inl ⟨hb, fun h => hne h.2⟩ + have haT₁ : a ∈ T₁ := .inl hRa + obtain ⟨z, -, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp hA _ _ hT₁ hT₂ hcov ⟨a, haA, haT₁⟩ + ⟨b, hbA, hbT₂⟩ + exact disjoint_left.mp hdis hz₁ hz₂ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section5.lean b/LeanPool/GraphMinor/GM07/Section5.lean new file mode 100644 index 0000000000..75eadd289a --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section5.lean @@ -0,0 +1,43 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section4 +public import LeanPool.GraphMinor.GM07.Section5a +public import LeanPool.GraphMinor.GM07.Section5b + +/-! +# Graph Minors VII, Section 5: The Main Result, Second Version + +This file completes Section 5 (pages 230–237) of N. Robertson and P. D. Seymour, +*Graph Minors. VII. Disjoint paths on a surface*, J. Combin. Theory Ser. B 45 (1988) 212–254: +- `(5.1)`–`(5.4)` are proved unconditionally in `GraphMinor/GM07/Section5a.lean` (`theorem_5_1`, + `theorem_5_2`, `theorem_5_3`, `theorem_5_4`). +- `(5.5)`–`(5.7)` are proved unconditionally in `GraphMinor/GM07/Section5b.lean` (`theorem_5_5`, + `theorem_5_6`, `theorem_5_7`). +- `(5.8)` (`theorem_5_8` in `GM07/CylinderCap.lean`, page 233): grid linkage of `r` paths and `s` + non-null-homotopic circuits + in a cylinder. +- `(5.9)` (`theorem_5_9` in `GM07/CuffFinal.lean`, pages 233–237): second version of the main + feasibility theorem on + `Σ ≅ Σ(a, b, c)` (`c ≥ 2`, `(a, b, c) ≠ (0, 0, 2)`) for boundary-linked graphs `G` with + `α(G) > 9k v(Σ, k)` and `|V(G) ∩ C| ≥ 2` for every cuff `C`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section5a.lean b/LeanPool/GraphMinor/GM07/Section5a.lean new file mode 100644 index 0000000000..6f6e93618c --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section5a.lean @@ -0,0 +1,1314 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section11 +public import LeanPool.GraphMinor.GM07.Section11a +public import LeanPool.GraphMinor.GM07.Section11g +public import LeanPool.GraphMinor.GM07.AlphaExists +public import LeanPool.GraphMinor.Surface.CutOArc +public import LeanPool.GraphMinor.Surface.PasteDisc +public import LeanPool.GraphMinor.Surface.DiscsInSurface +public import LeanPool.GraphMinor.Surface.ModelCriterion +public import LeanPool.GraphMinor.GM11.Nice73 +public import LeanPool.GraphMinor.GM11.PolarChart +import LeanPool.GraphMinor.GM19.Section6a + +/-! +# Graph Minors VII, Section 5 (Part A): (5.2)–(5.4) + +This file formalizes the first part of Section 5 of Robertson and Seymour, +*Graph Minors. VII. Disjoint Paths on a Surface*, J. Combin. Theory Ser. B **45** (1988), 212–254: +- `cappedCuff_homeo_model`: pasting a closed disc onto a cuff of `SurfaceModel a b c` yields a + connected surface homeomorphic to `SurfaceModel a b (c - 1)` with `1 ≤ c`. +- `theorem_5_2`: (5.2) (page 230). +- `surroundsCuff_and_planarInCappedCuff_imp_cylinder`: if an `O`-arc surrounds a cuff `C` and is + planar in `Σ + C'̂` for a cuff `C' ≠ C`, then `Σ ≅ Σ(0, 0, 2)`. +- `theorem_5_3`: (5.3) (page 231). +- `theorem_5_4`: (5.4) (page 231). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Function Topology unitInterval GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Capping a cuff of `SurfaceModel a b c` -/ + +/-- Every cuff of a surface `S` is a subset of `bd S`. -/ +theorem cuff_subset_bd {C : Set S} (hC : C ∈ cuffs S) : C ⊆ bd S := by + obtain ⟨x, _, rfl⟩ := hC + exact connectedComponentIn_subset (bd S) x + +/-- Every `O`-arc is nonempty. -/ +theorem isOArc_nonempty {F : Set S} (hF : IsOArc F) : F.Nonempty := by + obtain ⟨φ⟩ := id hF + exact ⟨(φ 1).1, (φ 1).2⟩ + +/-- Every cuff of a surface `S` is an `O`-arc. -/ +theorem cuff_isOArc (hS : IsSurface S) {C : Set S} (hC : C ∈ cuffs S) : IsOArc C := + (cuff_statement S hS).2.2 C hC + +/-- Distinct cuffs of a surface `S` are disjoint. -/ +theorem disjoint_cuffs {C C' : Set S} (hC : C ∈ cuffs S) (hC' : C' ∈ cuffs S) (hne : C ≠ C') : + Disjoint C C' := by + obtain ⟨x, _, rfl⟩ := hC + obtain ⟨y, _, rfl⟩ := hC' + refine disjoint_left.mpr fun z hzx hzy => hne ?_ + have h1 : connectedComponentIn (bd S) x = connectedComponentIn (bd S) z + := connectedComponentIn_eq hzx + have h2 : connectedComponentIn (bd S) y = connectedComponentIn (bd S) z + := connectedComponentIn_eq hzy + exact h1.trans h2.symm + +/-- Being a surface is preserved under homeomorphism. -/ +theorem isSurface_of_homeomorph {X : Type*} {Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + (e : X ≃ₜ Y) (hY : IsSurface Y) : IsSurface X := by + have : CompactSpace Y := hY.1 + have : T2Space Y := hY.2.1 + exact ⟨e.symm.surjective.compactSpace e.symm.continuous, e.isEmbedding.t2Space, + fun x => (isManifoldPoint_iff_of_isOpenEmbedding e.isOpenEmbedding).mp (hY.2.2 (e x))⟩ + +/-- If `(S', ι, D)` is a capped cuff of a connected surface `S`, then `S'` is connected. -/ +theorem IsCappedCuff.connectedSpace (hS : IsSurface S) [ConnectedSpace S] + {C : Set S} {S' : Type u} [TopologicalSpace S'] {ι : S → S'} {D : Set S'} + (hCap : IsCappedCuff C S' ι D) : ConnectedSpace S' := by + have : T2Space S' := hCap.isSurface.2.1 + obtain ⟨x₀, hx₀⟩ := isOArc_nonempty (cuff_isOArc hS hCap.cuff) + have hy : ι x₀ ∈ range ι ∩ D := hCap.inter_eq ▸ mem_image_of_mem ι hx₀ + have h1 : IsPreconnected (range ι) := isPreconnected_range hCap.isEmbedding.continuous + have h2 : IsPreconnected D := hCap.isClosedDisc.isPathConnected.isConnected.isPreconnected + have h3 := h1.union' ⟨ι x₀, hy.1, hy.2⟩ h2 + rw [hCap.union_eq] at h3 + exact { toPreconnectedSpace := ⟨h3⟩, toNonempty := ⟨ι x₀⟩ } + +/-- Pasting a closed disc `D` onto a cuff `C` of `S ≃ₜ SurfaceModel a b c` produces a connected +surface `S'` with `1 ≤ c` and `Nonempty (S' ≃ₜ SurfaceModel a b (c - 1))`. -/ +theorem cappedCuff_homeo_model + (hS : IsSurface S) [ConnectedSpace S] + {a b c : ℕ} (hmodel : Nonempty (S ≃ₜ SurfaceModel a b c)) + {C : Set S} (hC : C ∈ cuffs S) + {S' : Type u} [TopologicalSpace S'] + {ι : S → S'} {D : Set S'} (hCap : IsCappedCuff C S' ι D) : + 1 ≤ c ∧ Nonempty (S' ≃ₜ SurfaceModel a b (c - 1)) := by + classical + obtain ⟨e₁₀⟩ := hmodel + have hS' : IsSurface S' := hCap.isSurface + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have : CompactSpace S' := hS'.1 + have : T2Space S' := hS'.2.1 + have : ConnectedSpace S' := hCap.connectedSpace hS + have hι : IsEmbedding ι := hCap.isEmbedding + have hD : IsClosedDisc D := hCap.isClosedDisc + have hdiscBdD : discBd D = ι '' C := hCap.discBd_eq + have hmeet : range ι ∩ D = ι '' C := hCap.inter_eq + have hcov : range ι ∪ D = univ := hCap.union_eq + let Y := S ⊕ D + let ψ : Y → S' := Sum.elim ι Subtype.val + let F : Set S' := ι '' C + let W₁ : Set Y := range Sum.inl + let W₂ : Set Y := range Sum.inr + let X : Set Y := Sum.inl '' C + let X' : Set Y := Sum.inr '' {z : D | z.1 ∈ F} + have hW₁ : IsClopen W₁ := isClopen_range_inl + have hW₂ : IsClopen W₂ := isClopen_range_inr + have hdW : Disjoint W₁ W₂ := isCompl_range_inl_range_inr.disjoint + have hUW : W₁ ∪ W₂ = univ := isCompl_range_inl_range_inr.sup_eq_top + obtain ⟨φD⟩ := id hD + obtain ⟨eD₀⟩ := nonempty_disc_homeo + have hD_surf : IsSurface D := isSurface_of_homeomorph (φD.symm.trans eD₀.symm) + (isSurface_model 0 0 1).1 + have : CompactSpace D := hD_surf.1 + have : T2Space D := hD_surf.2.1 + have hY : IsSurface Y := by + refine ⟨inferInstance, inferInstance, fun y => ?_⟩ + rcases y with s | d + · exact isManifoldPoint_of_isOpenEmbedding IsOpenEmbedding.inl (hS.2.2 s) + · exact isManifoldPoint_of_isOpenEmbedding IsOpenEmbedding.inr (hD_surf.2.2 d) + have hbdY_inl : ∀ s ∈ bd S, (Sum.inl s : Y) ∈ bd Y := by + intro s hs hint + exact hs ((isInteriorPoint_iff_of_isOpenEmbedding IsOpenEmbedding.inl).mp hint) + have hbdY_inr : ∀ d ∈ bd D, (Sum.inr d : Y) ∈ bd Y := by + intro d hd hint + exact hd ((isInteriorPoint_iff_of_isOpenEmbedding IsOpenEmbedding.inr).mp hint) + have hbd_D_sub : {z : D | z.1 ∈ F} ⊆ bd D := by + intro z hz + have hz_bd : z.1 ∈ discBd D := hdiscBdD.symm ▸ hz + rcases hz_bd with ⟨w, hw, hwz⟩ + exact (Subtype.ext hwz : w = z) ▸ hw + have hψ_cont : Continuous ψ := continuous_sum_dom.mpr ⟨hι.continuous, continuous_subtype_val⟩ + have hψ_surj : Surjective ψ := by + intro y + have hy : y ∈ range ι ∪ D := hcov ▸ mem_univ y + rcases hy with ⟨s, rfl⟩ | hyD + · exact ⟨Sum.inl s, rfl⟩ + · exact ⟨Sum.inr ⟨y, hyD⟩, rfl⟩ + have hhun : X ∪ X' = ψ ⁻¹' F := by + ext y + rcases y with s | z + · constructor + · rintro (⟨s', hs', h⟩ | ⟨_, _, ⟨⟩⟩) + exact Sum.inl.inj h ▸ mem_image_of_mem ι hs' + · rintro ⟨s', hs', heq⟩ + exact Or.inl ⟨s', hs', congrArg Sum.inl (hι.injective heq)⟩ + · constructor + · rintro (⟨_, _, ⟨⟩⟩ | ⟨z', hz', h⟩) + exact Sum.inr.inj h ▸ hz' + · intro hz + exact Or.inr ⟨z, hz, rfl⟩ + have hψ_inj : InjOn ψ (ψ ⁻¹' Fᶜ) := by + intro y₁ hy₁ y₂ hy₂ heq + rcases y₁ with s₁ | z₁ <;> rcases y₂ with s₂ | z₂ + · exact congrArg Sum.inl (hι.injective heq) + · exfalso + change ι s₁ = z₂.1 at heq + have : ι s₁ ∈ range ι ∩ D := ⟨mem_range_self s₁, heq.symm ▸ z₂.2⟩ + rw [hmeet] at this + exact hy₁ this + · exfalso + change z₁.1 = ι s₂ at heq + have : ι s₂ ∈ range ι ∩ D := ⟨mem_range_self s₂, heq ▸ z₁.2⟩ + rw [hmeet] at this + exact hy₂ this + · exact congrArg Sum.inr (Subtype.ext heq) + have hψ_card : ∀ x ∈ F, (ψ ⁻¹' {x}).ncard = 2 := by + rintro _ ⟨s, hs, rfl⟩ + have hD_mem : ι s ∈ D := (hmeet ▸ mem_image_of_mem ι hs).2 + have hpre : ψ ⁻¹' {ι s} = {Sum.inl s, Sum.inr ⟨ι s, hD_mem⟩} := by + ext y + rcases y with s' | z' + · simp only [ψ, mem_preimage, mem_singleton_iff, Sum.elim_inl, mem_insert_iff, + reduceCtorEq, or_false, hι.injective.eq_iff] + exact ⟨congrArg Sum.inl, Sum.inl.inj⟩ + · simp only [ψ, mem_preimage, mem_singleton_iff, Sum.elim_inr, mem_insert_iff, + reduceCtorEq, false_or] + exact ⟨fun h => congrArg Sum.inr (Subtype.ext h), fun h => congrArg Subtype.val + (Sum.inr.inj h)⟩ + rw [hpre, ncard_pair Sum.inl_ne_inr] + have ht₁ : X ⊆ bd Y := by + rintro _ ⟨s, hs, rfl⟩ + exact hbdY_inl s (cuff_subset_bd hC hs) + have ht₂ : X' ⊆ bd Y := by + rintro _ ⟨z, hz, rfl⟩ + exact hbdY_inr z (hbd_D_sub hz) + have hψ : IsCutting ψ F := + ⟨hψ_cont, hψ_surj, hψ_inj, hψ_card, hhun ▸ union_subset ht₁ ht₂⟩ + have b1 : BijOn ψ X F := by + refine ⟨?_, ?_, ?_⟩ + · rintro _ ⟨s, hs, rfl⟩ + exact mem_image_of_mem ι hs + · rintro _ ⟨s₁, _, rfl⟩ _ ⟨s₂, _, rfl⟩ heq + exact congrArg Sum.inl (hι.injective heq) + · rintro _ ⟨s, hs, rfl⟩ + exact ⟨Sum.inl s, ⟨s, hs, rfl⟩, rfl⟩ + have b2 : BijOn ψ X' F := by + refine ⟨?_, ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact hz + · rintro _ ⟨z₁, _, rfl⟩ _ ⟨z₂, _, rfl⟩ heq + exact congrArg Sum.inr (Subtype.ext heq) + · rintro _ ⟨s, hs, rfl⟩ + have hD_mem : ι s ∈ D := (hmeet ▸ mem_image_of_mem ι hs).2 + exact ⟨Sum.inr ⟨ι s, hD_mem⟩, ⟨⟨ι s, hD_mem⟩, mem_image_of_mem ι hs, rfl⟩, rfl⟩ + have hC_oArc : IsOArc C := cuff_isOArc hS hC + have hF_oArc : IsOArc F := isOArc_image hC_oArc hι.continuous.continuousOn hι.injective.injOn + have hOX : IsOArc X := + isOArc_image hC_oArc continuous_inl.continuousOn Sum.inl_injective.injOn + have hOX' : IsOArc X' := by + have hsub_oArc : IsOArc {z : D | z.1 ∈ F} := by + obtain ⟨φF⟩ := id hF_oArc + refine ⟨Homeomorph.trans φF ?_⟩ + have : CompactSpace {z : D | z.1 ∈ F} := + isCompact_iff_compactSpace.mp + (hF_oArc.isCompact.isClosed.preimage continuous_subtype_val).isCompact + exact (Continuous.homeoOfEquivCompactToT2 + (f := { + toFun := fun z => ⟨z.1.1, z.2⟩ + invFun := fun x => ⟨⟨x.1, by + have hx : x.1 ∈ ι '' C := x.2 + rw [← hmeet] at hx + exact hx.2⟩, x.2⟩ + left_inv := fun z => rfl + right_inv := fun x => rfl }) + (Continuous.subtype_mk (continuous_subtype_val.comp continuous_subtype_val) _)).symm + exact isOArc_image hsub_oArc continuous_inr.continuousOn Sum.inr_injective.injOn + let eW₁ : W₁ ≃ₜ SurfaceModel a b c := + (IsOpenEmbedding.inl.toIsEmbedding.toHomeomorph).symm.trans e₁₀ + let eW₂ : W₂ ≃ₜ SurfaceModel 0 0 1 := + (IsOpenEmbedding.inr.toIsEmbedding.toHomeomorph).symm.trans (φD.symm.trans eD₀.symm) + have s₁ : X ⊆ W₁ := image_subset_range _ _ + have s₂ : X' ⊆ W₂ := image_subset_range _ _ + obtain ⟨i, j, sig, f, -, -, hi, hj, hf, -⟩ := + loop_comps_aux hY hψ hhun b1 b2 hOX hOX' hW₁ hW₂ hdW hUW eW₁ eW₂ s₁ s₂ ht₁ ht₂ + obtain ⟨hN₁, hL₁⟩ := erase_facts c i + obtain ⟨hN₂, hL₂⟩ := erase_facts 1 j + obtain ⟨e'⟩ := homeo_of_two_loop hi hj hN₁ hN₂ hL₁ hL₂ hf + rw [length_erase_range hi, length_erase_range hj] at e' + have heq : 0 + a = a ∧ 0 + b = b ∧ 1 - 1 + (c - 1) = c - 1 := ⟨by omega, by omega, by omega⟩ + rw [heq.1, heq.2.1, heq.2.2] at e' + exact ⟨by omega, ⟨e'⟩⟩ + +/-! ## 2. Proof of (5.2) -/ + +/-- If `bd S ≠ ∅`, any solid flat subset `X ⊆ S` of a connected surface `S` is planar (from (11.9) +and `solidFlat_boundarySurface_planar_core`). -/ +theorem isPlanar_of_solid_flat_bd_ne_empty + (hS : IsSurface S) (hbd : bd S ≠ ∅) [ConnectedSpace S] {X : Set S} + (hX_solid : IsSolid X) (hX_flat : IsFlat X) : + IsPlanar X := by + obtain ⟨Y, hXY, hY_open, hY_sc, _⟩ := + theorem_11_9_proof hS hX_flat hX_solid.1 (Or.inl hX_solid.2) + have : T2Space S := hS.2.1 + refine solidFlat_boundarySurface_planar_core hS hbd hX_solid.2 hXY hY_open + (IsArcConnected.isPreconnected hY_sc.1) fun F hFY hF => ?_ + obtain ⟨Δ, hΔ, hΔ_bd, hΔY⟩ := hY_sc.2 F hF hFY + exact ⟨Δ, hΔY, hΔ, hΔ_bd⟩ + +/-- Monotonicity of `IsPlanar`. -/ +theorem IsPlanar.mono {X Y : Set S} (hY : IsPlanar Y) (hXY : X ⊆ Y) : IsPlanar X := by + obtain ⟨Δ, hΔ, hYΔ⟩ := hY + exact ⟨Δ, hΔ, hXY.trans hYΔ⟩ + +/-- Monotonicity of `IsPlanarInCappedCuff`. -/ +theorem IsPlanarInCappedCuff.mono {C X Y : Set S} + (hY : IsPlanarInCappedCuff C Y) (hXY : X ⊆ Y) : IsPlanarInCappedCuff C X := by + refine ⟨hY.1, ?_, fun S' _ j D hCap => IsPlanar.mono (hY.2.2 S' j D hCap) (image_mono hXY)⟩ + obtain ⟨S', hTS', j, D, hCap, hpl⟩ := hY.2.1 + exact ⟨S', hTS', j, D, hCap, IsPlanar.mono hpl (image_mono hXY)⟩ + +/-- An `O`-arc `F` in a surface `S` is planar if and only if it is null-homotopic in `S`. -/ +theorem isPlanar_iff_isNullHomotopicOArc_of_isOArc + (hS : IsSurface S) {F : Set S} (hF : IsOArc F) : + IsPlanar F ↔ IsNullHomotopicOArc F := by + constructor + · rintro ⟨Δ, hΔ, hFΔ⟩ + exact isNullHomotopicOArcIn_of_subset_disc hF (subset_univ Δ) hΔ hFΔ + · intro h + obtain ⟨Δ, hΔ, hbd⟩ := nullHomotopicOArc_bounds_disc hS hF h + have : T2Space S := hS.2.1 + exact ⟨Δ, hΔ, hbd ▸ Surface.discBd_subset Δ⟩ + +/-- Pullback of `IsSolid` along a closed embedding `j : S → T`. -/ +theorem isSolid_of_isClosedEmbedding_aux [T2Space S] {T : Type u} [TopologicalSpace T] + {j : S → T} (hj : IsClosedEmbedding j) {Z : Set S} (hZ : IsSolid (j '' Z)) : + IsSolid Z := by + refine ⟨fun z hz U hU hzU => ?_, ?_⟩ + · obtain ⟨U_T, hU_T_open, rfl⟩ := hj.isInducing.isOpen_iff.mp hU + obtain ⟨V_T, hVT_sub, hjz_VT, hVT_open, h_arc⟩ := + hZ.1 (j z) ⟨z, hz, rfl⟩ U_T hU_T_open hzU + refine ⟨j ⁻¹' V_T, preimage_mono hVT_sub, hjz_VT, hVT_open.preimage hj.continuous, ?_⟩ + intro a ha b hb hab + have hja : j a ∈ j '' Z ∩ V_T := ⟨⟨a, ha.1, rfl⟩, ha.2⟩ + have hjb : j b ∈ j '' Z ∩ V_T := ⟨⟨b, hb.1, rfl⟩, hb.2⟩ + obtain ⟨F_T, hFT_sub, hFT_line⟩ := h_arc (j a) hja (j b) hjb (hj.injective.ne hab) + have hFT_range : F_T ⊆ range j := fun y hy => by + obtain ⟨w, _, rfl⟩ := (hFT_sub hy).1 + exact ⟨w, rfl⟩ + obtain ⟨a', b', ha', hb', h_line⟩ := hFT_line.pull hj.isEmbedding hFT_range + obtain rfl : a' = a := hj.injective ha' + obtain rfl : b' = b := hj.injective hb' + refine ⟨j ⁻¹' F_T, fun x hx => ?_, h_line⟩ + obtain ⟨⟨w, hwZ, hjw⟩, hxVT⟩ := hFT_sub hx + obtain rfl : w = x := hj.injective hjw + exact ⟨hwZ, hxVT⟩ + · have h_pre : Z = j ⁻¹' (j '' Z) := (preimage_image_eq Z hj.injective).symm + rw [h_pre] + exact hZ.2.preimage hj.continuous + +/-- A preconnected set meeting a clopen set is contained in it. -/ +theorem subset_of_isPreconnected_isClopen {A : Type*} [TopologicalSpace A] {P U : Set A} + (hP : IsPreconnected P) (hU : IsClopen U) (hne : (P ∩ U).Nonempty) : P ⊆ U := + hP.subset_left_of_subset_union hU.2 hU.compl.2 disjoint_compl_right (by simp) hne + +/-- Image of a closed disc under a continuous injection into a Hausdorff space is a closed disc. -/ +theorem isClosedDisc_image_of_injective {A B : Type*} [TopologicalSpace A] [TopologicalSpace B] + [T2Space B] {f : A → B} (hf_cont : Continuous f) (hf_inj : Function.Injective f) + {Δ : Set A} (hΔ : IsClosedDisc Δ) : IsClosedDisc (f '' Δ) := by + have : CompactSpace Δ := isCompact_iff_compactSpace.mp (IsClosedDisc.isCompact hΔ) + obtain ⟨e⟩ := hΔ + let g : Δ → f '' Δ := fun x => ⟨f x.1, ⟨x.1, x.2, rfl⟩⟩ + have hg_cont : Continuous g := Continuous.subtype_mk (hf_cont.comp continuous_subtype_val) _ + have hg_bij : Function.Bijective g := by + refine ⟨fun x₁ x₂ h => Subtype.ext (hf_inj (congrArg Subtype.val h)), ?_⟩ + rintro ⟨_, ⟨x, hx, rfl⟩⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + exact ⟨e.trans (Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective g hg_bij) hg_cont)⟩ + +/-- Preimage of a closed disc `Δ₀ ⊆ range f` under a continuous injection from a compact space is a +closed disc. -/ +theorem isClosedDisc_preimage_of_subset_range {A B : Type*} [TopologicalSpace A] [TopologicalSpace + B] + [CompactSpace A] [T2Space B] {f : A → B} (hf_cont : Continuous f) + (hf_inj : Function.Injective f) + {Δ₀ : Set B} (hΔ₀ : IsClosedDisc Δ₀) (hsub : Δ₀ ⊆ range f) : IsClosedDisc (f ⁻¹' Δ₀) := by + have : CompactSpace (f ⁻¹' Δ₀) := isCompact_iff_compactSpace.mp + (((IsClosedDisc.isCompact hΔ₀).isClosed.preimage hf_cont).isCompact) + obtain ⟨e⟩ := hΔ₀ + let g : f ⁻¹' Δ₀ → Δ₀ := fun x => ⟨f x.1, x.2⟩ + have hg_cont : Continuous g := Continuous.subtype_mk (hf_cont.comp continuous_subtype_val) _ + have hg_bij : Function.Bijective g := by + refine ⟨fun x₁ x₂ h => Subtype.ext (hf_inj (congrArg Subtype.val h)), fun ⟨y, hy⟩ => ?_⟩ + obtain ⟨a, rfl⟩ := hsub hy + exact ⟨⟨a, hy⟩, rfl⟩ + exact ⟨e.trans (Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective g hg_bij) + hg_cont).symm⟩ + +/-- Graph Minors VII, (5.2) (page 230): +"If $X \subseteq \Sigma$ is solid and $X$ is planar in $\Sigma + \hat{C}$, where $C$ is a cuff, +then $X$ surrounds $C$ in $\Sigma$ if and only if some $O$-arc included in $X$ surrounds $C$." -/ +theorem theorem_5_2_proof + (hS : IsSurface S) {X C : Set S} + (hX_solid : IsSolid X) (hXC : IsPlanarInCappedCuff C X) : + SurroundsCuff X C ↔ ∃ F : Set S, IsOArc F ∧ F ⊆ X ∧ SurroundsCuff F C := by + constructor + · intro hSurr + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := hS.locallyConnected + have hC : C ∈ cuffs S := hXC.1 + obtain ⟨c₀, hc₀⟩ := isOArc_nonempty (cuff_isOArc hS hC) + by_contra! hall + obtain ⟨S', topS', j, D, hCap, Δ₀, hΔ₀, hXΔ₀⟩ := hXC.2.1 + have hS' : IsSurface S' := hCap.isSurface + have : CompactSpace S' := hS'.1 + have : T2Space S' := hS'.2.1 + have hj_cont : Continuous j := hCap.isEmbedding.continuous + have hj_inj : Function.Injective j := hCap.isEmbedding.injective + let W : Set S := connectedComponent c₀ + have hW_clopen : IsClopen W := isClopen_connectedComponent + have hW_surf : IsSurface W := isSurface_sub hS hW_clopen + have : CompactSpace W := hW_surf.1 + have hW_conn : ConnectedSpace W := + isConnected_iff_connectedSpace.mp ⟨⟨c₀, mem_connectedComponent⟩, + isPreconnected_connectedComponent⟩ + have hC_sub_W : C ⊆ W := + subset_of_isPreconnected_isClopen + (IsArcConnected.isPreconnected (IsOArc.isArcConnected (cuff_isOArc hS hC))) + hW_clopen ⟨c₀, hc₀, mem_connectedComponent⟩ + have hjWD_cl : IsClosed (j '' W ∪ D) := + (hW_clopen.1.isCompact.image hj_cont).isClosed.union hCap.isClosedDisc.isCompact.isClosed + have hjWc_cl : IsClosed (j '' Wᶜ) := + (hW_clopen.2.isClosed_compl.isCompact.image hj_cont).isClosed + have hjWD_compl_eq : (j '' W ∪ D)ᶜ = j '' Wᶜ := by + ext y + simp only [mem_compl_iff, mem_union, not_or] + constructor + · rintro ⟨hyW, hyD⟩ + rcases hCap.union_eq.symm ▸ mem_univ y with ⟨z, rfl⟩ | hyD' + · exact ⟨z, fun hzW => hyW ⟨z, hzW, rfl⟩, rfl⟩ + · exact False.elim (hyD hyD') + · rintro ⟨z, hzW, rfl⟩ + refine ⟨fun ⟨w, hwW, hjw⟩ => hzW (hj_inj hjw ▸ hwW), fun hyD => ?_⟩ + have : j z ∈ range j ∩ D := ⟨⟨z, rfl⟩, hyD⟩ + rw [hCap.inter_eq] at this + obtain ⟨c, hcC, hjc⟩ := this + exact hzW (hj_inj hjc ▸ hC_sub_W hcC) + have hjWD_clopen : IsClopen (j '' W ∪ D) := + ⟨hjWD_cl, isClosed_compl_iff.mp (hjWD_compl_eq.symm ▸ hjWc_cl)⟩ + by_cases hXW : X ⊆ W + · have hbdW : bd W ≠ ∅ := by + refine Nonempty.ne_empty ⟨⟨c₀, hC_sub_W hc₀⟩, ?_⟩ + rw [mem_bd_sub hW_clopen.2] + exact cuff_subset_bd hC hc₀ + let X_W : Set W := Subtype.val ⁻¹' X + have hXW_img : Subtype.val '' X_W = X := by + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hXW] + have hXW_solid : IsSolid X_W := + isSolid_of_isClosedEmbedding_aux hW_clopen.1.isClosedEmbedding_subtypeVal + (hXW_img.symm ▸ hX_solid) + have hXW_flat : IsFlat X_W := by + refine isFlat_of_forall_isNullHomotopicOArc hW_surf fun F_W hFW_sub hFW_oarc => ?_ + let F : Set S := Subtype.val '' F_W + have hF_oarc : IsOArc F := + isOArc_image hFW_oarc continuous_subtype_val.continuousOn Subtype.val_injective.injOn + have hFX : F ⊆ X := by + rw [← hXW_img] + exact image_mono hFW_sub + have hF_pl : IsPlanar F := by + by_contra hF_npl + exact hall F hF_oarc hFX ⟨hC, hXC.mono hFX, hF_npl⟩ + have hF_null : IsNullHomotopicOArc F := + (isPlanar_iff_isNullHomotopicOArc_of_isOArc hS hF_oarc).mp hF_pl + obtain ⟨Δ_F, hΔ_F, hbd_F⟩ := nullHomotopicOArc_bounds_disc hS hF_oarc hF_null + obtain ⟨y₀, hy₀F⟩ := isOArc_nonempty hF_oarc + have hF_sub_ΔF : F ⊆ Δ_F := hbd_F ▸ Surface.discBd_subset Δ_F + have hΔF_sub_W : Δ_F ⊆ W := + subset_of_isPreconnected_isClopen hΔ_F.isPathConnected.isConnected.isPreconnected + hW_clopen + ⟨y₀, hF_sub_ΔF hy₀F, hXW (hFX hy₀F)⟩ + have hΔFW_disc : IsClosedDisc (Subtype.val ⁻¹' Δ_F : Set W) := + isClosedDisc_preimage_of_subset_range continuous_subtype_val Subtype.val_injective hΔ_F + (by rwa [Subtype.range_coe]) + refine isNullHomotopicOArcIn_of_subset_disc hFW_oarc + (subset_univ (Subtype.val ⁻¹' Δ_F : Set W)) hΔFW_disc ?_ + intro z hz + change z.1 ∈ Δ_F + exact hF_sub_ΔF ⟨z, hz, rfl⟩ + obtain ⟨Δ_W, hΔ_W, hXW_Δ⟩ := + isPlanar_of_solid_flat_bd_ne_empty hW_surf hbdW hXW_solid hXW_flat + refine hSurr.2.2 ⟨Subtype.val '' Δ_W, + isClosedDisc_image_of_injective continuous_subtype_val Subtype.val_injective hΔ_W, ?_⟩ + rw [← hXW_img] + exact image_mono hXW_Δ + · obtain ⟨x₁, hx₁X, hx₁W⟩ := not_subset.mp hXW + have hjWc_clopen : IsClopen (j '' Wᶜ) := by + rw [← hjWD_compl_eq] + exact hjWD_clopen.compl + have hΔ₀_sub : Δ₀ ⊆ j '' Wᶜ := + subset_of_isPreconnected_isClopen hΔ₀.isPathConnected.isConnected.isPreconnected hjWc_clopen + ⟨j x₁, hXΔ₀ ⟨x₁, hx₁X, rfl⟩, ⟨x₁, hx₁W, rfl⟩⟩ + have hΔ₀_range : Δ₀ ⊆ range j := hΔ₀_sub.trans (image_subset_range j Wᶜ) + exact hSurr.2.2 ⟨j ⁻¹' Δ₀, + isClosedDisc_preimage_of_subset_range hj_cont hj_inj hΔ₀ hΔ₀_range, + fun x hx => hXΔ₀ ⟨x, hx, rfl⟩⟩ + · rintro ⟨F, _, hFX, hF_surr⟩ + exact ⟨hXC.1, hXC, fun hX_pl => hF_surr.2.2 (IsPlanar.mono hX_pl hFX)⟩ + +/-! ## 3. Proof of (5.3) -/ + +/-- If `C, C' ∈ cuffs S` are distinct (`C ≠ C'`) and `(S₁, ι₁, Δ₁)` is obtained by pasting a disc +onto `C`, then `ι₁ '' C'` is a cuff of `S₁`. -/ +theorem image_cuff_of_cappedCuff + {C C' : Set S} (hC : C ∈ cuffs S) (hC' : C' ∈ cuffs S) (hne : C ≠ C') + {S₁ : Type u} [TopologicalSpace S₁] {ι₁ : S → S₁} + (hι₁ : IsClosedEmbedding ι₁) + (hbdS₁ : bd S₁ = ι₁ '' (bd S \ C)) : + ι₁ '' C' ∈ cuffs S₁ := by + have hdisj : Disjoint C C' := disjoint_cuffs hC hC' hne + have hC'_sub : C' ⊆ bd S \ C := + subset_sdiff.mpr ⟨cuff_subset_bd hC', hdisj.symm⟩ + obtain ⟨x, hxbd, rfl⟩ := hC' + have hxC' : x ∈ connectedComponentIn (bd S) x := mem_connectedComponentIn hxbd + have hx_S₁ : ι₁ x ∈ bd S₁ := hbdS₁ ▸ mem_image_of_mem ι₁ (hC'_sub hxC') + refine ⟨ι₁ x, hx_S₁, ?_⟩ + apply Subset.antisymm + · intro y hy + have hy_bd : y ∈ bd S₁ := connectedComponentIn_subset _ _ hy + rw [hbdS₁] at hy_bd + obtain ⟨z, ⟨hz_bd, _⟩, rfl⟩ := hy_bd + refine mem_image_of_mem ι₁ ?_ + have hpre : IsPreconnected (ι₁ ⁻¹' connectedComponentIn (bd S₁) (ι₁ x)) := by + refine hι₁.isInducing.isPreconnected_image.mp ?_ + have hsub_range : connectedComponentIn (bd S₁) (ι₁ x) ⊆ range ι₁ := + (connectedComponentIn_subset _ _).trans (hbdS₁ ▸ image_subset_range _ _) + rw [image_preimage_eq_of_subset hsub_range] + exact isPreconnected_connectedComponentIn + have hsub_bd : ι₁ ⁻¹' connectedComponentIn (bd S₁) (ι₁ x) ⊆ bd S := by + intro w hw + have hw' : ι₁ w ∈ bd S₁ := connectedComponentIn_subset _ _ hw + rw [hbdS₁] at hw' + obtain ⟨w₀, ⟨hw₀, _⟩, heq⟩ := hw' + exact hι₁.injective heq ▸ hw₀ + have hx_pre : x ∈ ι₁ ⁻¹' connectedComponentIn (bd S₁) (ι₁ x) := + mem_connectedComponentIn hx_S₁ + exact hpre.subset_connectedComponentIn hx_pre hsub_bd hy + · have hconn : IsPreconnected (ι₁ '' connectedComponentIn (bd S) x) := + isPreconnected_connectedComponentIn.image ι₁ hι₁.continuous.continuousOn + exact hconn.subset_connectedComponentIn (mem_image_of_mem ι₁ hxC') + (hbdS₁ ▸ image_mono hC'_sub) + +private theorem two_cap_domain_is_surface + {S : Type u} + [TopologicalSpace S] + (hS : IsSurface S) + {C : Set S} + {C' : Set S} + (hC' : C' ∈ cuffs S) + [this : T2Space S] + (S₁ : Type u) + [TopologicalSpace S₁] + (ι₁ : S → S₁) + (hι₁ : IsClosedEmbedding ι₁) + (S₂ : Type u) + [TopologicalSpace S₂] + (ι₂ : S₁ → S₂) + (Δ₂ : Set S₂) + (hS₂ : IsSurface S₂) + (hι₂ : IsClosedEmbedding ι₂) + (hΔ₂ : IsClosedDisc Δ₂) + (hmeet₂ : range ι₂ ∩ Δ₂ = ι₂ '' ι₁ '' C') + [this : T2Space S₂] + (D₁ : Set S₂) + (hD₁_disc : IsClosedDisc D₁ ∧ discBd D₁ = ι₂ '' ι₁ '' C) + (hdisj_D₁_Δ₂ : Disjoint D₁ Δ₂) + (W₂ : Set S₂) + (hW : W₂ = range (ι₂ ∘ ι₁) ∪ Δ₂) + [CompactSpace W₂] + (hW₂_eq_compl : W₂ = (discInt D₁)ᶜ) + (j₂ : S → W₂) + (hj : ∀ x, (j₂ x).1 = ι₂ (ι₁ x)) + (hj₂_emb : IsEmbedding j₂) : + IsSurface ↑W₂ := by + refine ⟨inferInstance, inferInstance, fun ⟨z, hzW₂⟩ => ?_⟩ + by_cases hzD₁ : z ∈ D₁ + · have hzW := hW ▸ hzW₂ + have hz_not_Δ₂ : z ∉ Δ₂ := disjoint_left.mp hdisj_D₁_Δ₂ hzD₁ + obtain ⟨x, rfl⟩ : z ∈ range (ι₂ ∘ ι₁) := hzW.resolve_right hz_not_Δ₂ + have hx_not_C' : x ∉ C' := fun hxC' => + hz_not_Δ₂ (hmeet₂ ▸ mem_image_of_mem ι₂ (mem_image_of_mem ι₁ hxC')).2 + have hU_S_open : IsOpen (C'ᶜ : Set S) := (cuff_isOArc hS hC').isCompact.isClosed.isOpen_compl + let f_open : (C'ᶜ : Set S) → W₂ := fun w => j₂ w.1 + have hf_emb : IsEmbedding f_open := + hj₂_emb.comp hU_S_open.isOpenEmbedding_subtypeVal.toIsEmbedding + have hf_range : range f_open = {w : W₂ | w.1 ∉ Δ₂} := by + ext ⟨w, hwW₂⟩ + simp only [f_open, hj, mem_range, Subtype.ext_iff, mem_ofPred_eq] + constructor + · rintro ⟨⟨x', hx'⟩, rfl⟩ hwΔ₂ + have : ι₂ (ι₁ x') ∈ range ι₂ ∩ Δ₂ := ⟨mem_range_self _, hwΔ₂⟩ + rw [hmeet₂] at this + obtain ⟨_, ⟨x₀, hx₀C', rfl⟩, heq⟩ := this + exact hx' (hι₁.injective (hι₂.injective heq) ▸ hx₀C') + · intro hw_not_Δ₂ + have hwW := hW ▸ hwW₂ + obtain ⟨x', rfl⟩ := hwW.resolve_right hw_not_Δ₂ + refine ⟨⟨x', fun hx'C' => hw_not_Δ₂ ?_⟩, rfl⟩ + exact (hmeet₂ ▸ mem_image_of_mem ι₂ (mem_image_of_mem ι₁ hx'C')).2 + have hf_open : IsOpenEmbedding f_open := + { toIsEmbedding := hf_emb + isOpen_range := by + rw [hf_range] + exact (hΔ₂.isCompact.isClosed.preimage continuous_subtype_val).isOpen_compl } + have hxj : j₂ x = ⟨(ι₂ ∘ ι₁) x, hzW₂⟩ := Subtype.ext (hj x) + rw [← hxj] + exact isManifoldPoint_of_isOpenEmbedding hf_open (x := ⟨x, hx_not_C'⟩) + ((isManifoldPoint_iff_of_isOpenEmbedding hU_S_open.isOpenEmbedding_subtypeVal).mp + (hS.2.2 x)) + · let U_W : Set W₂ := {w : W₂ | w.1 ∉ D₁} + have hU_W_open : IsOpen U_W := + (hD₁_disc.1.isCompact.isClosed.preimage continuous_subtype_val).isOpen_compl + let g_open : U_W → S₂ := fun w => w.1.1 + have hg_emb : IsEmbedding g_open := + IsEmbedding.subtypeVal.comp hU_W_open.isOpenEmbedding_subtypeVal.toIsEmbedding + have hg_range : range g_open = D₁ᶜ := by + ext w + simp only [g_open, mem_range, mem_compl_iff] + refine ⟨fun ⟨u, hu⟩ => hu ▸ u.2, fun hw => ?_⟩ + have hwW₂ : w ∈ W₂ := by + rw [hW₂_eq_compl] + exact fun h => hw h.1 + exact ⟨⟨⟨w, hwW₂⟩, hw⟩, rfl⟩ + have hg_open : IsOpenEmbedding g_open := + { toIsEmbedding := hg_emb + isOpen_range := hg_range ▸ hD₁_disc.1.isCompact.isClosed.isOpen_compl } + have hman_S₂ : IsManifoldPoint (g_open ⟨⟨z, hzW₂⟩, hzD₁⟩) := hS₂.2.2 z + have hman_UW := (isManifoldPoint_iff_of_isOpenEmbedding hg_open).mp hman_S₂ + exact isManifoldPoint_of_isOpenEmbedding hU_W_open.isOpenEmbedding_subtypeVal hman_UW + +private theorem second_cap_intersects_surface_in_cuff + {S : Type u} + {C' : Set S} + (S₁ : Type u) + (ι₁ : S → S₁) + (S₂ : Type u) + (ι₂ : S₁ → S₂) + (Δ₂ : Set S₂) + (hmeet₂ : range ι₂ ∩ Δ₂ = ι₂ '' ι₁ '' C') + (W₂ : Set S₂) + (j₂ : S → W₂) + (hj : ∀ x, (j₂ x).1 = ι₂ (ι₁ x)) + : range j₂ ∩ Subtype.val ⁻¹' Δ₂ = j₂ '' C' := by + ext ⟨z, hzW₂⟩ + simp only [mem_inter_iff, mem_range, Subtype.ext_iff, mem_preimage, mem_image, hj] + constructor + · rintro ⟨⟨x, rfl⟩, hzΔ₂⟩ + have : ι₂ (ι₁ x) ∈ range ι₂ ∩ Δ₂ := ⟨mem_range_self _, hzΔ₂⟩ + rw [hmeet₂] at this + obtain ⟨_, ⟨x₀, hx₀C', rfl⟩, heq⟩ := this + exact ⟨x₀, hx₀C', heq⟩ + · rintro ⟨x, hxC', rfl⟩ + exact ⟨⟨x, rfl⟩, (hmeet₂ ▸ mem_image_of_mem ι₂ (mem_image_of_mem ι₁ hxC')).2⟩ + +private theorem pulled_cap_boundary + {S : Type u} + {C' : Set S} + (S₁ : Type u) + (ι₁ : S → S₁) + (S₂ : Type u) + [TopologicalSpace S₂] + (ι₂ : S₁ → S₂) + (Δ₂ : Set S₂) + (hbdΔ₂ : discBd Δ₂ = ι₂ '' ι₁ '' C') + [T2Space S₂] + (W₂ : Set S₂) + (j₂ : S → W₂) + (hj : ∀ x, (j₂ x).1 = ι₂ (ι₁ x)) + [Nonempty ↑W₂] + (hΔ₂_sub_W₂ : Δ₂ ⊆ W₂) + (hΔ₂'_disc : IsClosedDisc (Subtype.val ⁻¹' Δ₂ : Set W₂)) : + discBd (Subtype.val ⁻¹' Δ₂ : Set W₂) = j₂ '' C' := by + let Δ₂' : Set W₂ := Subtype.val ⁻¹' Δ₂ + have h_img : Subtype.val '' discBd Δ₂' = discBd Δ₂ := by + obtain ⟨d', hd'c, hd'l⟩ := exists_inv_of_compactOn hΔ₂'_disc.isCompact + continuous_subtype_val.continuousOn Subtype.val_injective.injOn + have h := (hΔ₂'_disc.image continuous_subtype_val.continuousOn hd'c hd'l).2 + have heq : Subtype.val '' Δ₂' = Δ₂ := Subtype.image_preimage_coe W₂ Δ₂ ▸ inter_eq_right.mpr + hΔ₂_sub_W₂ + rw [heq] at h + exact h.symm + ext ⟨z, hzW₂⟩ + constructor + · intro hz + have hz' : z ∈ discBd Δ₂ := h_img ▸ mem_image_of_mem Subtype.val hz + rw [hbdΔ₂] at hz' + obtain ⟨_, ⟨x, hxC', rfl⟩, rfl⟩ := hz' + exact ⟨x, hxC', Subtype.ext (hj x)⟩ + · rintro ⟨x, hxC', h⟩ + rw [← h] + have hz' : ι₂ (ι₁ x) ∈ Subtype.val '' discBd Δ₂' := by + rw [h_img, hbdΔ₂] + exact mem_image_of_mem ι₂ (mem_image_of_mem ι₁ hxC') + obtain ⟨w, hw, heq⟩ := hz' + exact (Subtype.ext (heq.trans (hj x).symm) : w = j₂ x) ▸ hw + +/-- If `C, C' ∈ cuffs S` are distinct (`C ≠ C'`) and `F ⊆ S` is an `O`-arc that surrounds `C` +and is planar in `Σ + C'̂`, then `Nonempty (S ≃ₜ SurfaceModel 0 0 2)`. -/ +theorem surroundsCuff_and_planarInCappedCuff_imp_cylinder + (hS : IsSurface S) [ConnectedSpace S] {C C' F : Set S} + (hC : C ∈ cuffs S) (hC' : C' ∈ cuffs S) (hne : C ≠ C') + (hF : IsOArc F) (hFC : SurroundsCuff F C) (hFC' : IsPlanarInCappedCuff C' F) : + Nonempty (S ≃ₜ SurfaceModel 0 0 2) := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hdisj_CC' : Disjoint C C' := disjoint_cuffs hC hC' hne + obtain ⟨S₁, _, ι₁, Δ₁, hS₁, hι₁, hΔ₁, hcov₁, hmeet₁, hbdΔ₁, hbdS₁⟩ := + paste_disc S C hS hC + have : T2Space S₁ := hS₁.2.1 + have hCap₁ : IsCappedCuff C S₁ ι₁ Δ₁ := + ⟨hC, hS₁, hι₁.toIsEmbedding, hΔ₁, hbdΔ₁, hcov₁, hmeet₁⟩ + have : ConnectedSpace S₁ := hCap₁.connectedSpace hS + have hC'₁ : ι₁ '' C' ∈ cuffs S₁ := + image_cuff_of_cappedCuff hC hC' hne hι₁ hbdS₁ + obtain ⟨S₂, _, ι₂, Δ₂, hS₂, hι₂, hΔ₂, hcov₂, hmeet₂, hbdΔ₂, hbdS₂⟩ := + paste_disc S₁ (ι₁ '' C') hS₁ hC'₁ + have : CompactSpace S₂ := hS₂.1 + have : T2Space S₂ := hS₂.2.1 + have hCap₂ : IsCappedCuff (ι₁ '' C') S₂ ι₂ Δ₂ := + ⟨hC'₁, hS₂, hι₂.toIsEmbedding, hΔ₂, hbdΔ₂, hcov₂, hmeet₂⟩ + have : ConnectedSpace S₂ := hCap₂.connectedSpace hS₁ + have hF₁_oArc : IsOArc (ι₁ '' F) := + isOArc_image hF hι₁.continuous.continuousOn hι₁.injective.injOn + have hF₁_pl : IsPlanar (ι₁ '' F) := hFC.2.1.2.2 S₁ ι₁ Δ₁ hCap₁ + have hF₁_null : IsNullHomotopicOArc (ι₁ '' F) := + (isPlanar_iff_isNullHomotopicOArc_of_isOArc hS₁ hF₁_oArc).mp hF₁_pl + obtain ⟨E₁', hE₁'_disc, hE₁'_bd⟩ := + nullHomotopicOArc_bounds_disc hS₁ hF₁_oArc hF₁_null + have hdisj_int₁ : Disjoint (discInt Δ₁) (discBd E₁') := by + rw [hE₁'_bd] + refine disjoint_left.mpr ?_ + rintro _ ⟨hxΔ₁, hxbd⟩ ⟨x, _, rfl⟩ + have : ι₁ x ∈ range ι₁ ∩ Δ₁ := ⟨mem_range_self x, hxΔ₁⟩ + rw [hmeet₁, ← hbdΔ₁] at this + exact hxbd this + have h_int₁_sub : discInt Δ₁ ⊆ discInt E₁' := by + rcases hE₁'_disc.side hS₁.2.2 hΔ₁.isPreconnected_discInt hdisj_int₁ with hsub | hdisj + · exact hsub + · exfalso + have hE₁'_range : E₁' ⊆ range ι₁ := by + intro y hy + rcases (hcov₁ ▸ mem_univ y : y ∈ range ι₁ ∪ Δ₁) with hy_r | hy_Δ₁ + · exact hy_r + · by_cases hy_bd : y ∈ discBd Δ₁ + · rw [hbdΔ₁, ← hmeet₁] at hy_bd + exact hy_bd.1 + · exact (disjoint_right.mp hdisj hy ⟨hy_Δ₁, hy_bd⟩).elim + obtain ⟨φE₁'⟩ := id hE₁'_disc + have hpre_disc : IsClosedDisc (ι₁ ⁻¹' E₁') := by + refine ⟨Homeomorph.trans φE₁' ?_⟩ + have h_inv_cont : Continuous (fun x : (ι₁ ⁻¹' E₁' : Set S) => (⟨ι₁ x.1, x.2⟩ : E₁')) := + Continuous.subtype_mk (hι₁.continuous.comp continuous_subtype_val) _ + have : CompactSpace (ι₁ ⁻¹' E₁' : Set S) := + isCompact_iff_compactSpace.mp (hE₁'_disc.isCompact.isClosed.preimage + hι₁.continuous).isCompact + exact (h_inv_cont.homeoOfEquivCompactToT2 (f := { + toFun := fun x => ⟨ι₁ x.1, x.2⟩ + invFun := fun z => ⟨Classical.choose (hE₁'_range z.2), by + have hspec := Classical.choose_spec (hE₁'_range z.2) + simp [hspec]⟩ + left_inv := fun x => Subtype.ext (hι₁.injective + (Classical.choose_spec (hE₁'_range x.2))) + right_inv := fun z => Subtype.ext (Classical.choose_spec (hE₁'_range z.2)) })).symm + have hF_sub : F ⊆ ι₁ ⁻¹' E₁' := by + intro x hx + have : ι₁ x ∈ discBd E₁' := hE₁'_bd ▸ mem_image_of_mem ι₁ hx + exact Surface.discBd_subset E₁' this + exact hFC.2.2 ⟨ι₁ ⁻¹' E₁', hpre_disc, hF_sub⟩ + let E₁ : Set S₂ := ι₂ '' E₁' + let D₁ : Set S₂ := ι₂ '' Δ₁ + have hE₁_disc : IsClosedDisc E₁ ∧ discBd E₁ = ι₂ '' (ι₁ '' F) := by + obtain ⟨d', hd'c, hd'l⟩ := exists_inv_of_compactOn hE₁'_disc.isCompact + hι₂.continuous.continuousOn hι₂.injective.injOn + have h := hE₁'_disc.image hι₂.continuous.continuousOn hd'c hd'l + rwa [hE₁'_bd] at h + have hD₁_disc : IsClosedDisc D₁ ∧ discBd D₁ = ι₂ '' (ι₁ '' C) := by + obtain ⟨d', hd'c, hd'l⟩ := exists_inv_of_compactOn hΔ₁.isCompact + hι₂.continuous.continuousOn hι₂.injective.injOn + have h := hΔ₁.image hι₂.continuous.continuousOn hd'c hd'l + rwa [hbdΔ₁] at h + have hdisj_Δ₁_C' : Disjoint Δ₁ (ι₁ '' C') := by + refine disjoint_left.mpr ?_ + rintro y hyΔ₁ ⟨x, hxC', rfl⟩ + have : ι₁ x ∈ range ι₁ ∩ Δ₁ := ⟨mem_range_self x, hyΔ₁⟩ + rw [hmeet₁] at this + obtain ⟨z, hzC, heq⟩ := this + exact disjoint_left.mp hdisj_CC' (hι₁.injective heq ▸ hzC) hxC' + have hdisj_D₁_Δ₂ : Disjoint D₁ Δ₂ := by + refine disjoint_left.mpr ?_ + rintro _ ⟨y, hyΔ₁, rfl⟩ hyΔ₂ + have : ι₂ y ∈ range ι₂ ∩ Δ₂ := ⟨mem_range_self y, hyΔ₂⟩ + rw [hmeet₂] at this + obtain ⟨w, hw, heq⟩ := this + exact disjoint_left.mp hdisj_Δ₁_C' (hι₂.injective heq ▸ hyΔ₁) hw + let W₂ : Set S₂ := range (ι₂ ∘ ι₁) ∪ Δ₂ + have hW₂_closed : IsClosed W₂ := + ((hι₂.comp hι₁).isClosed_range).union hΔ₂.isCompact.isClosed + have : CompactSpace W₂ := isCompact_iff_compactSpace.mp hW₂_closed.isCompact + have hW₂_eq_compl : W₂ = (discInt D₁)ᶜ := by + ext z + simp only [W₂, mem_union, mem_range, Function.comp_apply, mem_compl_iff, discInt, mem_sdiff, + not_and, not_not] + constructor + · rintro (⟨x, rfl⟩ | hzΔ₂) hzD₁ + · obtain ⟨y, hyΔ₁, heq⟩ := hzD₁ + have hy : y = ι₁ x := hι₂.injective heq + subst hy + have : ι₁ x ∈ range ι₁ ∩ Δ₁ := ⟨mem_range_self x, hyΔ₁⟩ + rw [hmeet₁] at this + rw [hD₁_disc.2] + exact mem_image_of_mem ι₂ this + · exact (disjoint_right.mp hdisj_D₁_Δ₂ hzΔ₂ hzD₁).elim + · intro hz + rcases (hcov₂ ▸ mem_univ z : z ∈ range ι₂ ∪ Δ₂) with ⟨y, rfl⟩ | hzΔ₂ + · rcases (hcov₁ ▸ mem_univ y : y ∈ range ι₁ ∪ Δ₁) with ⟨x, rfl⟩ | hyΔ₁ + · exact Or.inl ⟨x, rfl⟩ + · have hzD₁ : ι₂ y ∈ D₁ := mem_image_of_mem ι₂ hyΔ₁ + have hzbd := hz hzD₁ + rw [hD₁_disc.2] at hzbd + obtain ⟨_, ⟨x, _, rfl⟩, heq⟩ := hzbd + exact Or.inl ⟨x, heq⟩ + · exact Or.inr hzΔ₂ + let j₂ : S → W₂ := fun x => ⟨ι₂ (ι₁ x), Or.inl ⟨x, rfl⟩⟩ + have : Nonempty W₂ := ⟨j₂ (Classical.choice ‹ConnectedSpace S›.toNonempty)⟩ + have hj₂_emb : IsEmbedding j₂ := + IsEmbedding.of_comp (Continuous.subtype_mk (hι₂.continuous.comp hι₁.continuous) _) + continuous_subtype_val (hι₂.comp hι₁).toIsEmbedding + have hj₂_closed : IsClosed (range j₂) := by + have heq : range j₂ = Subtype.val ⁻¹' range (ι₂ ∘ ι₁) := by + ext ⟨z, hz⟩ + simp [j₂, Subtype.ext_iff] + rw [heq] + exact (hι₂.comp hι₁).isClosed_range.preimage continuous_subtype_val + have hW₂_surf := two_cap_domain_is_surface hS hC' S₁ ι₁ hι₁ S₂ ι₂ Δ₂ hS₂ hι₂ hΔ₂ hmeet₂ D₁ + hD₁_disc hdisj_D₁_Δ₂ W₂ rfl hW₂_eq_compl j₂ (fun _ => rfl) hj₂_emb + let Δ₂' : Set W₂ := Subtype.val ⁻¹' Δ₂ + have hΔ₂_sub_W₂ : Δ₂ ⊆ W₂ := subset_union_right + have hΔ₂'_disc : IsClosedDisc Δ₂' := by + obtain ⟨φΔ₂⟩ := id hΔ₂ + have : CompactSpace Δ₂ := isCompact_iff_compactSpace.mp hΔ₂.isCompact + refine ⟨Homeomorph.trans φΔ₂ ?_⟩ + exact Continuous.homeoOfEquivCompactToT2 + (f := { + toFun := fun z => ⟨⟨z.1, hΔ₂_sub_W₂ z.2⟩, z.2⟩ + invFun := fun w => ⟨w.1.1, w.2⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl }) + (Continuous.subtype_mk (Continuous.subtype_mk continuous_subtype_val _) _) + have hcov_W₂ : range j₂ ∪ Δ₂' = univ := by + ext ⟨z, hzW₂⟩ + simp only [j₂, Δ₂', mem_union, mem_range, Subtype.ext_iff, mem_preimage, mem_univ, iff_true] + exact hzW₂ + have hbd_Δ₂' : discBd Δ₂' = j₂ '' C' := by + exact pulled_cap_boundary S₁ ι₁ S₂ ι₂ Δ₂ hbdΔ₂ W₂ j₂ (fun _ => rfl) + hΔ₂_sub_W₂ hΔ₂'_disc + have hCap_W₂ : IsCappedCuff C' W₂ j₂ Δ₂' := + ⟨hC', hW₂_surf, hj₂_emb, hΔ₂'_disc, hbd_Δ₂', hcov_W₂, + second_cap_intersects_surface_in_cuff S₁ ι₁ S₂ ι₂ Δ₂ hmeet₂ W₂ j₂ (fun _ => rfl)⟩ + have hF_W₂_oArc : IsOArc (j₂ '' F) := + isOArc_image hF hj₂_emb.continuous.continuousOn hj₂_emb.injective.injOn + have hF_W₂_pl : IsPlanar (j₂ '' F) := hFC'.2.2 W₂ j₂ Δ₂' hCap_W₂ + have hF_W₂_null : IsNullHomotopicOArc (j₂ '' F) := + (isPlanar_iff_isNullHomotopicOArc_of_isOArc hW₂_surf hF_W₂_oArc).mp hF_W₂_pl + obtain ⟨E₂', hE₂'_disc, hE₂'_bd⟩ := + nullHomotopicOArc_bounds_disc hW₂_surf hF_W₂_oArc hF_W₂_null + let E₂ : Set S₂ := Subtype.val '' E₂' + have hE₂_disc : IsClosedDisc E₂ ∧ discBd E₂ = ι₂ '' (ι₁ '' F) := by + obtain ⟨d', hd'c, hd'l⟩ := exists_inv_of_compactOn hE₂'_disc.isCompact + continuous_subtype_val.continuousOn Subtype.val_injective.injOn + have h := hE₂'_disc.image continuous_subtype_val.continuousOn hd'c hd'l + rw [hE₂'_bd] at h + refine ⟨h.1, h.2.trans ?_⟩ + ext z + simp [j₂, mem_image] + have hE₁_ne_E₂ : E₁ ≠ E₂ := by + intro heq + obtain ⟨z₀, hz₀⟩ := hΔ₁.nonempty_discInt + have hz₀_E₁' : z₀ ∈ E₁' := (h_int₁_sub hz₀).1 + have hz₀_E₁ : ι₂ z₀ ∈ E₁ := mem_image_of_mem ι₂ hz₀_E₁' + rw [heq] at hz₀_E₁ + obtain ⟨⟨w, hwW₂⟩, _, rfl⟩ := hz₀_E₁ + rw [hW₂_eq_compl] at hwW₂ + apply hwW₂ + refine ⟨mem_image_of_mem ι₂ hz₀.1, ?_⟩ + rw [hD₁_disc.2, ← hbdΔ₁] + rintro ⟨y, hy, hyz₀⟩ + exact hz₀.2 (hι₂.injective hyz₀ ▸ hy) + have hS₂_sph : IsSphere S₂ := by + by_contra hns + exact hE₁_ne_E₂ (eq_of_discBd_eq hS₂ hns hE₁_disc.1 hE₂_disc.1 + (hE₁_disc.2.trans hE₂_disc.2.symm)) + obtain ⟨a, b, c, hmodel⟩ := classification S hS ‹ConnectedSpace S› + obtain ⟨hc1, hmodel₁⟩ := cappedCuff_homeo_model hS hmodel hC hCap₁ + obtain ⟨hc2, ⟨e₂⟩⟩ := cappedCuff_homeo_model hS₁ hmodel₁ hC'₁ hCap₂ + obtain ⟨e_sph⟩ := id hS₂_sph + obtain ⟨e_m0⟩ := GraphMinor.GM19.isSphere_model + have h_crit := (modelCriterion.2 a b (c - 1 - 1) 0 0 0).mp ⟨e₂.symm.trans (e_sph.trans e_m0.symm)⟩ + have ha : a = 0 ∧ b = 0 ∧ c = 2 := by + have hb0 : b = 0 := h_crit.2.2.mpr rfl + omega + rcases ha with ⟨rfl, rfl, rfl⟩ + exact hmodel + +/-- Graph Minors VII, (5.3) (page 231): +"If $\Sigma \not\cong \Sigma(0, 0, 2)$ and $G$ is a proper graph in $\Sigma$, and $C$, $C'$ +are distinct cuffs and $r$, $r' \ge 0$ are integers with $r + r' < \alpha(G)$ then +$\mathscr{A}_r(C) \cap \mathscr{A}_{r'}(C') = \emptyset$." -/ +theorem theorem_5_3_proof + (hS : IsSurface S) [ConnectedSpace S] + (hnot_cyl : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 2)) + (G : Drawing S) {C C' : Set S} (hC : C ∈ cuffs S) (hC' : C' ∈ cuffs S) (hne : C ≠ C') + {r r' : ℕ} (hr : r + r' < alpha G) : + scriptA G r C ∩ scriptA G r' C' = ∅ := by + have : T2Space S := hS.2.1 + rw [eq_empty_iff_forall_notMem] + rintro x ⟨hx, hx'⟩ + simp only [scriptA, mem_sUnion, mem_ofPred_eq] at hx hx' + obtain ⟨X, ⟨hX_sol, hX_conn, hX_norm, hX_surr, hX_card⟩, hxX⟩ := hx + obtain ⟨X', ⟨hX'_sol, hX'_conn, hX'_norm, hX'_surr, hX'_card⟩, hxX'⟩ := hx' + have hU_sol : IsSolid (X ∪ X') := + theorem_11_6_proof hS hX_sol hX'_sol + have hU_conn : IsConnected (X ∪ X') := + ⟨⟨x, Or.inl hxX⟩, hX_conn.2.union' ⟨x, hxX, hxX'⟩ hX'_conn.2⟩ + have hU_norm : G.IsNormal (X ∪ X') := by + rintro y ⟨hyX | hyX', hyU⟩ + · exact hX_norm ⟨hyX, hyU⟩ + · exact hX'_norm ⟨hyX', hyU⟩ + have hU_not_np : ¬ IsNearPlanar (X ∪ X') := by + rintro (hpl | ⟨C'', hC'', hplC''⟩) + · exact hX_surr.2.2 (IsPlanar.mono hpl subset_union_left) + · rcases eq_or_ne C'' C with rfl | hC''C + · have hne' : C' ≠ C'' := hne.symm + obtain ⟨F', hF', hF'X', hF'_surr⟩ := + (theorem_5_2_proof hS hX'_sol hX'_surr.2.1).mp hX'_surr + exact hnot_cyl (surroundsCuff_and_planarInCappedCuff_imp_cylinder + hS hC' hC'' hne' hF' hF'_surr (hplC''.mono (hF'X'.trans subset_union_right))) + · have hne' : C ≠ C'' := Ne.symm hC''C + obtain ⟨F, hF, hFX, hF_surr⟩ := + (theorem_5_2_proof hS hX_sol hX_surr.2.1).mp hX_surr + exact hnot_cyl (surroundsCuff_and_planarInCappedCuff_imp_cylinder + hS hC hC'' hne' hF hF_surr (hplC''.mono (hFX.trans subset_union_left))) + have hU_cand : IsAlphaCandidate G (X ∪ X') := + ⟨hU_sol, hU_conn, hU_norm, hU_not_np⟩ + have h_le_alpha : alpha G ≤ ((X ∪ X') ∩ G.V).ncard := + Nat.sInf_le ⟨X ∪ X', hU_cand, rfl⟩ + have h_card_union : ((X ∪ X') ∩ G.V).ncard ≤ r + r' := by + have heq : (X ∪ X') ∩ G.V = (G.V ∩ X) ∪ (G.V ∩ X') := by + ext z + simp [and_comm, or_and_right] + rw [heq] + exact (ncard_union_le (G.V ∩ X) (G.V ∩ X')).trans (Nat.add_le_add hX_card hX'_card) + omega + +/-! ## 4. Proof of (5.4) -/ + +/-- If `B ∈ componentsIn (F₀ \ {x, y})` where `F₀` is an `O`-arc and `x ≠ y ∈ F₀`, then `x` and `y` +are joined by a path in `B ∪ {x, y} ⊆ F₀`. -/ +theorem joinedIn_component_oArc_diff_pair + {F₀ B : Set S} (hF₀ : IsOArc F₀) {x y : S} (hx : x ∈ F₀) (hy : y ∈ F₀) (hxy : x ≠ y) + (hB : B ∈ componentsIn (F₀ \ {x, y})) : + B ⊆ F₀ ∧ JoinedIn (B ∪ {x, y}) x y := by + obtain ⟨φ⟩ := id hF₀ + have hB_sub : B ⊆ F₀ \ {x, y} := by + obtain ⟨z, _, rfl⟩ := hB + exact connectedComponentIn_subset _ _ + refine ⟨hB_sub.trans sdiff_subset, ?_⟩ + let a : Circle := φ.symm ⟨x, hx⟩ + let b : Circle := φ.symm ⟨y, hy⟩ + have hab : a ≠ b := by + intro h + have h' : (⟨x, hx⟩ : F₀) = ⟨y, hy⟩ := by simpa [a, b] using congrArg φ h + exact hxy (congrArg Subtype.val h') + let ι : Circle → S := fun w => (φ w).1 + have hι : Continuous ι := continuous_subtype_val.comp φ.continuous + have hιinj : Injective ι := fun u w h => φ.injective (Subtype.ext h) + have hιa : ι a = x := by simp [ι, a] + have hιb : ι b = y := by simp [ι, b] + have hsub_arc : ∀ c d : Circle, c ≠ d → (c = a ∧ d = b ∨ c = b ∧ d = a) → + ι '' circleOpenArc c d ⊆ F₀ \ {x, y} := by + rintro c d _ hor _ ⟨w, hw, rfl⟩ + refine ⟨(φ w).2, ?_⟩ + have h₁ : w ∈ ({a, b}ᶜ : Set Circle) := by + rw [compl_pair_eq_union_circleOpenArc hab] + rcases hor with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl hw + · exact Or.inr hw + rintro (h | h) + · exact h₁ (Or.inl (hιinj (h.trans hιa.symm))) + · exact h₁ (Or.inr (hιinj (h.trans hιb.symm))) + obtain ⟨z, hz, rfl⟩ := hB + let w : Circle := φ.symm ⟨z, hz.1⟩ + have hιw : ι w = z := by simp [ι, w] + have hwc : w ∈ ({a, b}ᶜ : Set Circle) := by + rintro (h | h) + · exact hz.2 (Or.inl (by rw [← hιw, h, hιa])) + · exact hz.2 (Or.inr (mem_singleton_iff.mpr (by rw [← hιw, mem_singleton_iff.mp h, hιb]))) + rw [compl_pair_eq_union_circleOpenArc hab] at hwc + rcases hwc with hwc | hwc + · have hconn : IsPreconnected (ι '' circleOpenArc a b) := + (isPathConnected_circleOpenArc a b).isConnected.isPreconnected.image _ hι.continuousOn + have hs := hconn.subset_connectedComponentIn ⟨w, hwc, hιw⟩ + (hsub_arc a b hab (Or.inl ⟨rfl, rfl⟩)) + refine ⟨⟨⟨fun t => ι (Circle.path a b t), hι.comp (Circle.path a b).continuous⟩, + by simp [hιa], by simp [hιb]⟩, fun t => ?_⟩ + by_cases ht0 : t = 0 + · subst ht0; exact Or.inr (Or.inl (by simp)) + · by_cases ht1 : t = 1 + · subst ht1; exact Or.inr (Or.inr (by simp)) + · exact Or.inl (hs ⟨Circle.path a b t, ⟨t, ⟨unitInterval.pos_iff_ne_zero.mpr ht0, + unitInterval.lt_one_iff_ne_one.mpr ht1⟩, rfl⟩, rfl⟩) + · have hconn : IsPreconnected (ι '' circleOpenArc b a) := + (isPathConnected_circleOpenArc b a).isConnected.isPreconnected.image _ hι.continuousOn + have hs := hconn.subset_connectedComponentIn ⟨w, hwc, hιw⟩ + (hsub_arc b a hab.symm (Or.inr ⟨rfl, rfl⟩)) + have hj : JoinedIn (connectedComponentIn (F₀ \ {x, y}) z ∪ {x, y}) y x := by + refine ⟨⟨⟨fun t => ι (Circle.path b a t), hι.comp (Circle.path b a).continuous⟩, + by simp [hιb], by simp [hιa]⟩, fun t => ?_⟩ + by_cases ht0 : t = 0 + · subst ht0; exact Or.inr (Or.inr (by simp)) + · by_cases ht1 : t = 1 + · subst ht1; exact Or.inr (Or.inl (by simp)) + · exact Or.inl (hs ⟨Circle.path b a t, ⟨t, ⟨unitInterval.pos_iff_ne_zero.mpr ht0, + unitInterval.lt_one_iff_ne_one.mpr ht1⟩, rfl⟩, rfl⟩) + exact hj.symm + +/-- Helper for the final step of (5.4): if `Cl.mk γ_r = (Cl.mk π₀).trans ((Cl.mk q).trans (Cl.mk +πr).symm)` +with `vr = v₀`, `ur = u₀`, `q` null-homotopic, and `πr` equal to `π₀`, then `γ_r` is null-homotopic. +-/ +theorem cl_conj_eq_refl {v₀ vr u₀ ur : S} (hv : v₀ = vr) (hu : u₀ = ur) + (γ_r : Path v₀ vr) (π₀ : Path v₀ u₀) (πr : Path vr ur) (q : Path u₀ ur) + (hq_eq : Cl.mk γ_r = (Cl.mk π₀).trans ((Cl.mk q).trans (Cl.mk πr).symm)) + (hq_null : (q.cast rfl hu).Homotopic (Path.refl u₀)) + (hπ_eq : πr.cast hv hu = π₀) : + (γ_r.cast rfl hv).Homotopic (Path.refl v₀) := by + subst hv; subst hu + apply Path.Homotopic.Quotient.eq.mp + change Cl.mk γ_r = Cl.rf v₀ + have hq : Cl.mk q = Cl.rf u₀ := Path.Homotopic.Quotient.eq.mpr hq_null + have hπ : πr = π₀ := hπ_eq + rw [hq_eq, hq, hπ, cl_refl_trans, cl_trans_symm] + +private theorem paths_within_subdivision + {S : Type u} + [TopologicalSpace S] + {F₀ : Set S} + {r : ℕ} + (v : ℕ → S) + (u : ℕ → S) + (P : ℕ → Set S) + (hP : ∀ i ≤ r, IsLineWithEnds (P i) (v i) (u i) ∧ u i ∈ F₀) + (v' : ℕ → S) + (u' : ℕ → S) + (hv'_eq : ∀ i ≤ r, v' i = v i) + (hu'_eq : ∀ i ≤ r, u' i = u i) : + ∀ i ≤ r, ∃ p : Path (v' i) (u' i), ∀ t, p t ∈ P i := by + intro i hi + obtain ⟨e, he0, he1⟩ := (hP i hi).1 + exact ⟨⟨⟨fun t => (e t).1, continuous_subtype_val.comp e.continuous⟩, + he0.trans (hv'_eq i hi).symm, he1.trans (hu'_eq i hi).symm⟩, fun t => (e t).2⟩ + +private theorem subdivision_loop_is_null + {S : Type u} + [TopologicalSpace S] + {r : ℕ} + (s : ℕ → ↑I) + (hsr : s r = 1) + (f : C(Circle, S)) + (γ : Path (f ((arcParam 1) 0)) (f ((arcParam 1) 0))) + (v' : ℕ → S) + (hv' : ∀ i ≤ r, v' i = γ (s i)) + (hv'0 : v' 0 = γ 0) + (hv'r : v' 0 = v' r) + (hγ_cast : (((γ.subpath 0 (s r)).cast hv'0 (hv' r le_rfl)).cast rfl hv'r).Homotopic + (Path.refl (v' 0))) : + γ.Homotopic (Path.refl (f ((arcParam 1) 0))) := by + have hsource := hv'0.trans γ.source + have h1 := Path.Homotopic.pathCast hγ_cast hsource.symm hsource.symm + have h2 : ((((γ.subpath 0 (s r)).cast hv'0 (hv' r le_rfl)).cast rfl hv'r).cast + hsource.symm hsource.symm) = γ := by + ext t + change (γ.subpath 0 (s r)) t = γ t + rw [hsr, Path.subpath_zero_one] + rfl + have h3 : (Path.refl (v' 0)).cast hsource.symm hsource.symm = Path.refl (f (arcParam 1 0)) := by + ext t + exact hv'0.trans γ.source + rwa [h2, h3] at h1 + +private theorem loop_in_univ_is_null {S : Type u} [TopologicalSpace S] {x : S} + (γ : Path x x) (hγ : γ.Homotopic (Path.refl x)) : + let y : (univ : Set S) := ⟨x, mem_univ x⟩ + let γ' : Path y y := + ⟨⟨fun t => ⟨γ t, mem_univ _⟩, Continuous.subtype_mk γ.continuous _⟩, + Subtype.ext γ.source, Subtype.ext γ.target⟩ + γ'.Homotopic (Path.refl y) := + by + let incl : C(S, (univ : Set S)) := ⟨fun z => ⟨z, mem_univ z⟩, + Continuous.subtype_mk continuous_id _⟩ + exact hγ.map incl + +/-- Graph Minors VII, (5.4) (page 231): +"Let $F$, $F_0$ be $O$-arcs in $\Sigma$, where $F_0$ is null-homotopic. Let $r > 0$, and let +$v_1, \dots, v_r \in F$ be distinct, and in order on $F$. Let the components of $F - \{v_1, +\dots, v_r\}$ be $A_1, \dots, A_r$, where $\{v_{i-1}, v_i\} \subseteq \bar{A}_i$ ($1 \le i +\le r$). (Throughout, subscripts should be read modulo $r$.) Let $P_1, \dots, P_r$ be $[0, +1]$-arcs, such that for $1 \le i \le r$, $v_i$ is one end of $P_i$ and the other end ($u_i$ +say) is in $F_0$. For $1 \le i \le r$, let $B_i = \emptyset$ if $u_{i-1} = u_i$, and be a +component of $F_0 - \{u_{i-1}, u_i\}$ if $u_{i-1} \ne u_i$. Suppose that $P_{i-1} \cup P_i +\cup A_i \cup B_i$ is planar ($1 \le i \le r$). Then $F$ is null-homotopic." + +Here the cyclic order of $v_0, \dots, v_{r-1}$ on $F$ and the open arcs $A_0, \dots, A_{r-1}$ are +given by a homeomorphism $\phi \colon S^1 \cong F$ and a monotone partition +$0 = s_0 \le s_1 \le \dots \le s_r = 1$ of $[0, 1]$ under `arcParam 1` such that for each +$i < r$, $v_i = \phi(\text{arcParam } 1\ (s_{i+1}))$ and +$\phi(\text{arcParam } 1 '' (s_i, s_{i+1})) \subseteq A_i \subseteq F$. -/ +theorem theorem_5_4_proof + (hS : IsSurface S) {F F₀ : Set S} + (_hF : IsOArc F) (hF₀ : IsOArc F₀) (hF₀_null : IsNullHomotopicOArc F₀) + {r : ℕ} (hr : 0 < r) + (φ : Circle ≃ₜ F) (s : ℕ → I) (hs0 : s 0 = 0) (hsr : s r = 1) + (hs_mono : ∀ i < r, s i ≤ s (i + 1)) + (v u : ℕ → S) (A P B : ℕ → Set S) + (hv : ∀ i ≤ r, v i = (φ (arcParam 1 (s i))).1) + (hA : ∀ i < r, (fun t => (φ (arcParam 1 t)).1) '' Ioo (s i) (s (i + 1)) ⊆ A i ∧ A i ⊆ F) + (hP : ∀ i ≤ r, IsLineWithEnds (P i) (v i) (u i) ∧ u i ∈ F₀) + (hP_wrap : P 0 = P r ∧ u 0 = u r) + (hB : ∀ i < r, (u i = u (i + 1) ∧ B i = ∅) ∨ + (u i ≠ u (i + 1) ∧ B i ∈ componentsIn (F₀ \ {u i, u (i + 1)}))) + (hPlanar : ∀ i < r, IsPlanar (P i ∪ P (i + 1) ∪ A i ∪ B i)) : + IsNullHomotopicOArc F := by + have : T2Space S := hS.2.1 + let f : C(Circle, S) := ⟨fun z => (φ z).1, continuous_subtype_val.comp φ.continuous⟩ + have hf01 : f (arcParam 1 0) = f (arcParam 1 1) := by simp [f] + let γ : Path (f (arcParam 1 0)) (f (arcParam 1 0)) := + ⟨⟨fun t => f (arcParam 1 t), f.continuous.comp (arcParam 1).continuous⟩, rfl, hf01.symm⟩ + have hv0r : v 0 = v r := by + rw [hv 0 (Nat.zero_le r), hv r le_rfl, hs0, hsr] + exact hf01 + let v' : ℕ → S := fun i => if i = r then v 0 else v i + let u' : ℕ → S := fun i => if i = r then u 0 else u i + have hv'_eq : ∀ i ≤ r, v' i = v i := by + intro i hi + dsimp only [v'] + split_ifs with h + · subst h; exact hv0r + · rfl + have hu'_eq : ∀ i ≤ r, u' i = u i := by + intro i hi + dsimp only [u'] + split_ifs with h + · subst h; exact hP_wrap.2 + · rfl + have hv' : ∀ i ≤ r, v' i = γ (s i) := fun i hi => (hv'_eq i hi).trans (hv i hi) + have hv'0 : v' 0 = γ 0 := by + rw [hv' 0 (Nat.zero_le r), hs0] + -- For each `i ≤ r`, choose a path `π₀ i` in `P i` from `v' i` to `u' i`. + have hπ_ex : ∀ i ≤ r, ∃ p : Path (v' i) (u' i), ∀ t, p t ∈ P i := by + exact paths_within_subdivision (S := S) (F₀ := F₀) (r := r) v u P hP v' u' hv'_eq hu'_eq + choose π₀ hπ₀ using hπ_ex + let π : ∀ i, i ≤ r → Path (v' i) (u' i) := fun i hi => + if h : i = r then (π₀ 0 (Nat.zero_le r)).cast (by simp [v', h]) (by simp [u', h]) + else π₀ i hi + -- For each `i < r`, choose a path `β i` in `B i ∪ {u i, u (i + 1)} ⊆ F₀` from `u' i` to `u' (i + + -- 1)`. + have hβ_ex : ∀ i < r, ∃ q : Path (u' i) (u' (i + 1)), + (∀ t, q t ∈ B i ∪ {u i, u (i + 1)}) ∧ (∀ t, q t ∈ F₀) := by + intro i hi + rcases hB i hi with ⟨heq, _⟩ | ⟨hne, hB_comp⟩ + · refine ⟨(Path.refl (u i)).cast (hu'_eq i hi.le) + ((hu'_eq (i + 1) (Nat.succ_le_of_lt hi)).trans heq.symm), + fun t => Or.inr (Or.inl (by simp)), + fun t => by simpa using (hP i hi.le).2⟩ + · obtain ⟨hBF₀, hj⟩ := joinedIn_component_oArc_diff_pair hF₀ (hP i hi.le).2 + (hP (i + 1) (Nat.succ_le_of_lt hi)).2 hne hB_comp + refine ⟨hj.somePath.cast (hu'_eq i hi.le) (hu'_eq (i + 1) (Nat.succ_le_of_lt hi)), + fun t => by simp, fun t => ?_⟩ + change hj.somePath t ∈ F₀ + rcases hj.somePath_mem t with ht | (h1 | h2) + · exact hBF₀ ht + · rw [mem_singleton_iff.mp h1] + exact (hP i hi.le).2 + · rw [mem_singleton_iff.mp h2] + exact (hP (i + 1) (Nat.succ_le_of_lt hi)).2 + choose β hβ_B hβ_F₀ using hβ_ex + have h_step : ∀ i (hi : i < r), + let α_i : Path (v' i) (v' (i + 1)) := + (γ.subpath (s i) (s (i + 1))).cast (hv' i hi.le) (hv' (i + 1) (Nat.succ_le_of_lt hi)) + Cl.mk α_i = (Cl.mk (π i hi.le)).trans + ((Cl.mk (β i hi)).trans (Cl.mk (π (i + 1) (Nat.succ_le_of_lt hi))).symm) := by + intro i hi α_i + obtain ⟨Δ, hΔ, hsubΔ⟩ := hPlanar i hi + have hP_i_Δ : P i ⊆ Δ := + ((subset_union_left.trans subset_union_left).trans subset_union_left).trans hsubΔ + have hP_i1_Δ : P (i + 1) ⊆ Δ := + ((subset_union_right.trans subset_union_left).trans subset_union_left).trans hsubΔ + have hA_i_Δ : A i ⊆ Δ := + (subset_union_right.trans subset_union_left).trans hsubΔ + have hB_i_Δ : B i ⊆ Δ := subset_union_right.trans hsubΔ + have hα_Δ : ∀ t, α_i t ∈ Δ := by + intro t + have ht_mem : (γ.subpath (s i) (s (i + 1))) t ∈ γ '' uIcc (s i) (s (i + 1)) := by + rw [← Path.range_subpath] + exact mem_range_self t + obtain ⟨w, hw, htw⟩ := ht_mem + rw [uIcc_of_le (hs_mono i hi)] at hw + change (γ.subpath (s i) (s (i + 1))) t ∈ Δ + rw [← htw] + by_cases hw0 : w = s i + · subst hw0 + have : γ (s i) = v i := (hv i hi.le).symm + rw [this] + obtain ⟨e, he0, _⟩ := (hP i hi.le).1 + exact hP_i_Δ (he0 ▸ (e 0).2) + · by_cases hw1 : w = s (i + 1) + · subst hw1 + have : γ (s (i + 1)) = v (i + 1) := (hv (i + 1) (Nat.succ_le_of_lt hi)).symm + rw [this] + obtain ⟨e, he0, _⟩ := (hP (i + 1) (Nat.succ_le_of_lt hi)).1 + exact hP_i1_Δ (he0 ▸ (e 0).2) + · have hw_oo : w ∈ Ioo (s i) (s (i + 1)) := + ⟨lt_of_le_of_ne hw.1 (Ne.symm hw0), lt_of_le_of_ne hw.2 hw1⟩ + exact hA_i_Δ ((hA i hi).1 ⟨w, hw_oo, rfl⟩) + have hπ_Δ : ∀ j (hj : j ≤ r), ∀ t, π j hj t ∈ P j := by + intro j hj t + dsimp only [π] + split_ifs with hjr + · change π₀ 0 (Nat.zero_le r) t ∈ P j + rw [hjr, ← hP_wrap.1] + exact hπ₀ 0 (Nat.zero_le r) t + · exact hπ₀ j hj t + have hπ_i_Δ : ∀ t, π i hi.le t ∈ Δ := fun t => hP_i_Δ (hπ_Δ i hi.le t) + have hπ_i1_Δ : ∀ t, π (i + 1) (Nat.succ_le_of_lt hi) t ∈ Δ := + fun t => hP_i1_Δ (hπ_Δ (i + 1) (Nat.succ_le_of_lt hi) t) + have hβ_i_Δ : ∀ t, β i hi t ∈ Δ := by + intro t + rcases hβ_B i hi t with htB | (htu | htu1) + · exact hB_i_Δ htB + · rw [htu] + obtain ⟨e, _, he1⟩ := (hP i hi.le).1 + exact hP_i_Δ (he1 ▸ (e 1).2) + · rw [htu1] + obtain ⟨e, _, he1⟩ := (hP (i + 1) (Nat.succ_le_of_lt hi)).1 + exact hP_i1_Δ (he1 ▸ (e 1).2) + have hflatΔ : Flat Δ := IsSimplyConnectedSet.flat hΔ.isSimplyConnectedSet + refine hflatΔ.eq (Arw.of_path α_i hα_Δ) ?_ + exact (Arw.of_path (π i hi.le) hπ_i_Δ).trans + ((Arw.of_path (β i hi) hβ_i_Δ).trans (Arw.of_path (π (i + 1) (Nat.succ_le_of_lt hi)) + hπ_i1_Δ).symm) + have h_ind : ∀ k (hk : k ≤ r), + ∃ q : Path (u' 0) (u' k), (∀ t, q t ∈ F₀) ∧ + Cl.mk ((γ.subpath 0 (s k)).cast hv'0 (hv' k hk)) = + (Cl.mk (π 0 (Nat.zero_le r))).trans ((Cl.mk q).trans (Cl.mk (π k hk)).symm) := by + intro k hk + induction k with + | zero => + refine ⟨Path.refl (u' 0), fun _ => hu'_eq 0 (Nat.zero_le r) ▸ (hP 0 (Nat.zero_le r)).2, ?_⟩ + have hsub0 : (γ.subpath 0 (s 0)).cast hv'0 (hv' 0 (Nat.zero_le r)) = Path.refl (v' 0) := by + ext t + change (γ.subpath 0 (s 0)) t = v' 0 + rw [hs0, Path.subpath_self, Path.refl_apply, hv'0] + rw [hsub0] + change Cl.rf (v' 0) = + (Cl.mk (π 0 (Nat.zero_le r))).trans ((Cl.rf (u' 0)).trans (Cl.mk (π 0 hk)).symm) + rw [cl_refl_trans, cl_trans_symm] + | succ k ih => + obtain ⟨q, hqF₀, hq_eq⟩ := ih (Nat.le_of_succ_le hk) + refine ⟨q.trans (β k hk), ?_, ?_⟩ + · intro t + have : (q.trans (β k hk)) t ∈ range q ∪ range (β k hk) := by + rw [← Path.trans_range]; exact mem_range_self t + rcases this with ⟨w, hw⟩ | ⟨w, hw⟩ + · exact hw ▸ hqF₀ w + · exact hw ▸ hβ_F₀ k hk w + · let α_k : Path (v' k) (v' (k + 1)) := + (γ.subpath (s k) (s (k + 1))).cast (hv' k (Nat.le_of_succ_le hk)) (hv' (k + 1) hk) + let γ_k : Path (v' 0) (v' k) := + (γ.subpath 0 (s k)).cast hv'0 (hv' k (Nat.le_of_succ_le hk)) + let γ_k1 : Path (v' 0) (v' (k + 1)) := + (γ.subpath 0 (s (k + 1))).cast hv'0 (hv' (k + 1) hk) + have h_trans : γ_k1.Homotopic (γ_k.trans α_k) := by + have h1 := Path.Homotopic.subpath_trans_subpath γ 0 (s k) (s (k + 1)) + have h2 := Path.Homotopic.pathCast h1 hv'0 (hv' (k + 1) hk) + exact h2.symm.trans (by + have heq : ((γ.subpath 0 (s k)).trans (γ.subpath (s k) (s (k + 1)))).cast + hv'0 (hv' (k + 1) hk) = γ_k.trans α_k := by + ext t + simp [γ_k, α_k, Path.trans_apply] + rw [heq]) + have h_cl_trans : Cl.mk γ_k1 = (Cl.mk γ_k).trans (Cl.mk α_k) := by + rw [← Path.Homotopic.Quotient.mk_trans] + exact Path.Homotopic.Quotient.eq.mpr h_trans + have h_mk_qβ : Cl.mk (q.trans (β k hk)) = (Cl.mk q).trans (Cl.mk (β k hk)) := + (Path.Homotopic.Quotient.mk_trans q (β k hk)).symm + rw [h_cl_trans, hq_eq, h_step k hk, h_mk_qβ] + calc + ((Cl.mk (π 0 (Nat.zero_le r))).trans ((Cl.mk q).trans (Cl.mk (π k + (Nat.le_of_succ_le hk))).symm)).trans + ((Cl.mk (π k (Nat.le_of_succ_le hk))).trans ((Cl.mk (β k hk)).trans (Cl.mk (π + (k + 1) hk)).symm)) + = (Cl.mk (π 0 (Nat.zero_le r))).trans ((Cl.mk q).trans + (((Cl.mk (π k (Nat.le_of_succ_le hk))).symm.trans (Cl.mk (π k + (Nat.le_of_succ_le hk)))).trans + ((Cl.mk (β k hk)).trans (Cl.mk (π (k + 1) hk)).symm))) := by + simp only [cl_assoc] + _ = (Cl.mk (π 0 (Nat.zero_le r))).trans (((Cl.mk q).trans (Cl.mk (β k hk))).trans (Cl.mk + (π (k + 1) hk)).symm) := by + rw [cl_symm_trans, cl_refl_trans, cl_assoc] + obtain ⟨q, hqF₀, hq_eq⟩ := h_ind r le_rfl + have hv'r : v' 0 = v' r := by simp [v'] + have hu'r : u' 0 = u' r := by simp [u'] + let q_loop : Path (⟨u' 0, mem_univ _⟩ : (univ : Set S)) ⟨u' 0, mem_univ _⟩ := + ⟨⟨fun t => ⟨q t, mem_univ _⟩, Continuous.subtype_mk q.continuous _⟩, + Subtype.ext q.source, Subtype.ext (q.target.trans hu'r.symm)⟩ + have hq_null := homotopic_refl_of_null hF₀_null q_loop (fun t => hqF₀ t) + have hq_null' : (q.cast rfl hu'r).Homotopic (Path.refl (u' 0)) := by + let proj : C((univ : Set S), S) := ⟨Subtype.val, continuous_subtype_val⟩ + exact hq_null.map proj + have hπ_r0 : (π r le_rfl).cast hv'r hu'r = π 0 (Nat.zero_le r) := by + ext t + simp [π] + have hγ_cast := cl_conj_eq_refl hv'r hu'r + ((γ.subpath 0 (s r)).cast hv'0 (hv' r le_rfl)) + (π 0 (Nat.zero_le r)) (π r le_rfl) q hq_eq hq_null' hπ_r0 + have hγ_null : γ.Homotopic (Path.refl (f (arcParam 1 0))) := by + exact subdivision_loop_is_null (S := S) (r := r) s hsr f γ v' hv' hv'0 hv'r hγ_cast + let a_univ : (univ : Set S) := ⟨f (arcParam 1 0), mem_univ _⟩ + let γ_univ : Path a_univ a_univ := + ⟨⟨fun t => ⟨γ t, mem_univ _⟩, Continuous.subtype_mk γ.continuous _⟩, + Subtype.ext γ.source, Subtype.ext γ.target⟩ + refine ⟨φ, a_univ.1, a_univ.2, ?_⟩ + exact closedCurvesHomotopicIn_of_path 1 f (ContinuousMap.const _ a_univ.1) + γ_univ (Path.refl a_univ) (fun _ => rfl) (fun _ => rfl) (loop_in_univ_is_null γ hγ_null) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section5b.lean b/LeanPool/GraphMinor/GM07/Section5b.lean new file mode 100644 index 0000000000..553d7b304c --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section5b.lean @@ -0,0 +1,3771 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section5a +public import LeanPool.GraphMinor.GM07.Section11b +public import LeanPool.GraphMinor.GM07.Section11d +public import LeanPool.GraphMinor.GM07.AlphaExists +public import LeanPool.GraphMinor.Surface.PushOff +public import LeanPool.GraphMinor.Surface.SurfacePull +public import LeanPool.GraphMinor.GM11.ArcDrawings +import LeanPool.GraphMinor.GM19.Section6a +import LeanPool.GraphMinor.GM07.Section2Base + +/-! +# Graph Minors VII, Section 5 (Part B): (5.5)–(5.7) + +This file formalizes (5.5), (5.6), and (5.7) of Robertson and Seymour, +*Graph Minors. VII. Disjoint Paths on a Surface*, J. Combin. Theory Ser. B **45** (1988), 212–254: +- `isSolid_closure_sUnion_regions`: the closure of the union of a collection of regions of a proper + drawing `G` in a surface `S` is solid (`IsSolid`). +- `theorem_5_5`: (5.5) (page 231, proof on page 254). +- `theorem_5_6`: (5.6) (page 232). +- `theorem_5_7`: (5.7) (page 232). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Function Topology Filter unitInterval +open GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Closed Nice Sets from Unions of Regions and Solidarity -/ + +/-- On a closed surface `T`, the closure of the union of any collection `ℛ ⊆ Γ.R` of regions of a +drawing `Γ` is `Γ`-nice (`IsGammaNice Γ (closure (⋃₀ ℛ))`). -/ +theorem isGammaNice_closure_sUnion_regions (hS : IsClosedSurface S) + (Γ : Drawing S) {ℛ : Set (Set S)} (hℛ : ℛ ⊆ Γ.R) : + IsGammaNice Γ (closure (⋃₀ ℛ)) := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + set Z := closure (⋃₀ ℛ) + refine isGammaNice_of_sat fun a ha hne => ?_ + rcases ha with (⟨v, _, rfl⟩ | he) | hr + · obtain ⟨x, rfl : x = v, hxZ⟩ := hne + exact singleton_subset_iff.mpr hxZ + · obtain ⟨y, hye, hyZ⟩ := hne + obtain ⟨W, A₁, A₂, hW, hyW, -, hcov, c₁, c₂, d₁, d₂, h₁, h₂⟩ := + exists_edge_sides hS Γ he hye + obtain ⟨w, hwW, hwR⟩ := mem_closure_iff.mp hyZ W hW hyW + obtain ⟨r₀, hr₀ℛ, hwr₀⟩ := mem_sUnion.mp hwR + have hr₀ : r₀ ∈ Γ.R := hℛ hr₀ℛ + have hwU : w ∉ Γ.U := region_subset hr₀ hwr₀ + have hinc : (a ∩ closure r₀).Nonempty := by + rcases hcov ⟨hwW, hwU⟩ with hA₁ | hA₂ + · exact ⟨y, hye, closure_mono (subset_region hr₀ c₁ d₁ hA₁ hwr₀) (h₁ ⟨hye, hyW⟩)⟩ + · exact ⟨y, hye, closure_mono (subset_region hr₀ c₂ d₂ hA₂ hwr₀) (h₂ ⟨hye, hyW⟩)⟩ + have he_sub : a ⊆ closure r₀ := + edge_subset_closure_of_incident hS he hr₀ hinc + exact he_sub.trans (closure_mono (subset_sUnion_of_mem hr₀ℛ)) + · obtain ⟨y, hyr, hyZ⟩ := hne + obtain ⟨w, hwr, hwR⟩ := mem_closure_iff.mp hyZ a (region_isOpen hr) hyr + obtain ⟨r₀, hr₀ℛ, hwr₀⟩ := mem_sUnion.mp hwR + have hr₀ : r₀ ∈ Γ.R := hℛ hr₀ℛ + have h_eq : a = r₀ := region_eq_of_mem hr hr₀ hwr hwr₀ + subst h_eq + exact (subset_sUnion_of_mem hr₀ℛ).trans subset_closure + +/-- Adding boundary cuff drawings to a proper drawing `G` in `S` yields a drawing `G_bd : Drawing S` +with `G_bd.U = G.U ∪ bd S` and `G_bd.V ⊆ G.V ∪ bd S` such that `G.V ⊆ G_bd.V`. -/ +theorem exists_drawing_union_bd (hS : IsSurface S) (G : Drawing S) (hG : G.IsProper) : + ∃ G_bd : Drawing S, G_bd.U = G.U ∪ bd S ∧ G.V ⊆ G_bd.V ∧ G_bd.V ⊆ G.V ∪ bd S := by + classical + have : T2Space S := hS.2.1 + have hcuffs := cuff_statement.{u} S hS + have hfin_cuffs : (cuffs S).Finite := hcuffs.2.1 + have key : ∀ L : Finset (Set S), (∀ C ∈ L, C ∈ cuffs S) → + ∃ D : Drawing S, D.U = G.U ∪ ⋃ C ∈ L, C ∧ G.V ⊆ D.V ∧ D.V ⊆ G.V ∪ ⋃ C ∈ L, C := by + intro L + induction L using Finset.induction_on with + | empty => + intro _ + exact ⟨G, by simp, Subset.rfl, by simp⟩ + | insert C L hCL ih => + intro hL + obtain ⟨D₀, hD₀U, hGV_D₀, hD₀V⟩ := ih fun C' hC' => hL C' (Finset.mem_insert_of_mem hC') + have hC_cuff : C ∈ cuffs S := hL C (Finset.mem_insert_self C L) + have hC_oarc : IsOArc C := hcuffs.2.2 C hC_cuff + obtain ⟨c₀, hc₀⟩ := isOArc_nonempty hC_oarc + let A : Set S := insert c₀ (G.V ∩ C) + have hA_fin : A.Finite := (G.finite_V.inter_of_left C).insert c₀ + have hA_ne : A.Nonempty := insert_nonempty c₀ (G.V ∩ C) + have hA_sub : A ⊆ C := insert_subset hc₀ inter_subset_right + obtain ⟨D_C, hDC_U, hDC_V⟩ := exists_drawing_on_oArc hC_oarc hA_fin hA_ne hA_sub + have hmeet : D₀.U ∩ D_C.U ⊆ D₀.V ∩ D_C.V := by + rw [hD₀U, hDC_U, hDC_V] + rintro x ⟨hxG | hxL, hxC⟩ + · have hxbd : x ∈ bd S := cuff_subset_bd hC_cuff hxC + have hxV : x ∈ G.V := hG ⟨hxbd, hxG⟩ + exact ⟨hGV_D₀ hxV, mem_insert_of_mem c₀ ⟨hxV, hxC⟩⟩ + · obtain ⟨C', hC'L, hxC'⟩ := mem_iUnion₂.mp hxL + have hC'_cuff : C' ∈ cuffs S := hL C' (Finset.mem_insert_of_mem hC'L) + have hCC' : C' = C := by + obtain ⟨y, hy, rfl⟩ := hC'_cuff + obtain ⟨z, hz, rfl⟩ := hC_cuff + have h1 := connectedComponentIn_eq hxC' + have h2 := connectedComponentIn_eq hxC + exact h1.trans h2.symm + exact False.elim (hCL (hCC' ▸ hC'L)) + refine ⟨D₀.glue D_C hmeet, ?_, ?_, ?_⟩ + · change D₀.U ∪ D_C.U = _ + rw [hD₀U, hDC_U] + ext x + simp only [mem_union, mem_iUnion, Finset.mem_insert, exists_prop] + constructor + · rintro ((h | ⟨C', hC', hx⟩) | hx) + · exact Or.inl h + · exact Or.inr ⟨C', Or.inr hC', hx⟩ + · exact Or.inr ⟨C, Or.inl rfl, hx⟩ + · rintro (h | ⟨C', rfl | hC', hx⟩) + · exact Or.inl (Or.inl h) + · exact Or.inr hx + · exact Or.inl (Or.inr ⟨C', hC', hx⟩) + · exact hGV_D₀.trans subset_union_left + · change D₀.V ∪ D_C.V ⊆ _ + rw [hDC_V] + rintro x (hxD₀ | rfl | ⟨hxV, hxC⟩) + · rcases hD₀V hxD₀ with hxV | hxL + · exact Or.inl hxV + · obtain ⟨C', hC'L, hxC'⟩ := mem_iUnion₂.mp hxL + exact Or.inr (mem_iUnion₂.mpr ⟨C', Finset.mem_insert_of_mem hC'L, hxC'⟩) + · exact Or.inr (mem_iUnion₂.mpr ⟨C, Finset.mem_insert_self C L, hc₀⟩) + · exact Or.inl hxV + obtain ⟨D, hDU, hGV, hDV⟩ := key hfin_cuffs.toFinset fun C hC => hfin_cuffs.mem_toFinset.mp hC + have h_cuffs_eq_bd : (⋃ C ∈ hfin_cuffs.toFinset, C) = bd S := by + ext x + simp only [mem_iUnion, Finite.mem_toFinset] + constructor + · rintro ⟨C, hC, hxC⟩ + exact cuff_subset_bd hC hxC + · intro hx + exact ⟨connectedComponentIn (bd S) x, ⟨x, hx, rfl⟩, mem_connectedComponentIn hx⟩ + rw [h_cuffs_eq_bd] at hDU hDV + exact ⟨D, hDU, hGV, hDV⟩ + +/-- Pullback of `IsSolid` along a closed embedding `j : S → T`. -/ +theorem isSolid_of_isClosedEmbedding [T2Space S] {T : Type u} [TopologicalSpace T] + {j : S → T} (hj : IsClosedEmbedding j) {Z : Set S} (hZ : IsSolid (j '' Z)) : + IsSolid Z := + isSolid_of_isClosedEmbedding_aux hj hZ + +/-- Embed a surface `S` with a proper drawing `G` into a closed surface `T` with a drawing +`Γ : Drawing T` such that for any `ℛ ⊆ G.R` and `Z = closure (⋃₀ ℛ)`, `j '' Z = closure (⋃₀ ℛ_T)` +for a subset `ℛ_T ⊆ Γ.R`. -/ +theorem exists_capped_drawing [ConnectedSpace S] (hS : IsSurface S) (G : Drawing S) + (hG : G.IsProper) : + ∃ (T : Type u) (_ : TopologicalSpace T) (j : S → T) (K : Set T) (Γ : Drawing T), + IsClosedSurface T ∧ ConnectedSpace T ∧ IsClosedEmbedding j ∧ IsClosed K ∧ + range j ∪ K = univ ∧ range j ∩ K = j '' bd S ∧ + Γ.U = j '' (G.U ∪ bd S) ∧ j '' G.V ⊆ Γ.V ∧ Γ.V ⊆ j '' (G.V ∪ bd S) ∧ + ∀ ℛ : Set (Set S), ℛ ⊆ G.R → + ∃ ℛ_T : Set (Set T), ℛ_T ⊆ Γ.R ∧ j '' closure (⋃₀ ℛ) = closure (⋃₀ ℛ_T) ∧ + ⋃₀ ℛ_T = j '' (⋃₀ ℛ \ bd S) := by + obtain ⟨T, topT, j, K, hT, hj, hK, hunion, hinter, hconnT⟩ := exists_capAll S hS + have hT_conn : ConnectedSpace T := hconnT inferInstance + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have : T2Space T := hT.2.1 + obtain ⟨G_bd, hGbd_U, hGV_Gbd, hGbd_V⟩ := exists_drawing_union_bd hS G hG + obtain ⟨Γ, hΓ_U, hΓ_V, -, -⟩ := + exists_transport G_bd hj.continuous hj.injective.injOn + rw [hGbd_U] at hΓ_U + refine ⟨T, topT, j, K, Γ, hT, hT_conn, hj, hK, hunion, hinter, hΓ_U, + (image_mono hGV_Gbd).trans (le_of_eq hΓ_V.symm), + (le_of_eq hΓ_V).trans (image_mono hGbd_V), ?_⟩ + intro ℛ hℛ + have h_open_S_int : IsOpen (j '' (bd S)ᶜ) := by + have heq : j '' (bd S)ᶜ = Kᶜ := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ hyK + have : j x ∈ range j ∩ K := ⟨⟨x, rfl⟩, hyK⟩ + rw [hinter] at this + obtain ⟨x', hx', hjx⟩ := this + exact hx (hj.injective hjx ▸ hx') + · intro hyK + have : y ∈ range j ∪ K := hunion.symm ▸ mem_univ y + rcases this with ⟨x, rfl⟩ | hyK' + · refine ⟨x, fun hxbd => hyK ?_, rfl⟩ + have : j x ∈ range j ∩ K := hinter ▸ ⟨x, hxbd, rfl⟩ + exact this.2 + · exact False.elim (hyK hyK') + rw [heq] + exact hK.isOpen_compl + set ℛ_T : Set (Set T) := {R' ∈ Γ.R | R' ⊆ j '' (⋃₀ ℛ \ bd S)} + have h_sUnion_eq : ⋃₀ ℛ_T = j '' (⋃₀ ℛ \ bd S) := by + apply Subset.antisymm + · exact sUnion_subset fun R' hR' => hR'.2 + · rintro _ ⟨x, ⟨hxℛ, hxbd⟩, rfl⟩ + obtain ⟨r, hrℛ, hxr⟩ := mem_sUnion.mp hxℛ + have hr : r ∈ G.R := hℛ hrℛ + have hjx_notU : j x ∉ Γ.U := by + rw [hΓ_U] + rintro ⟨x', hx'U | hx'bd, hjx⟩ + · have hxx' : x = x' := hj.injective hjx.symm + exact region_subset hr hxr (hxx' ▸ hx'U) + · have hxx' : x = x' := hj.injective hjx.symm + exact hxbd (hxx' ▸ hx'bd) + obtain ⟨R', hR'Γ, hjxR'⟩ := exists_region_of_notMem hjx_notU + refine mem_sUnion.mpr ⟨R', ⟨hR'Γ, ?_⟩, hjxR'⟩ + have h_sub_range : R' ⊆ j '' (univ \ (G.U ∪ bd S)) := by + intro y hy + have hy_notU : y ∉ Γ.U := region_subset hR'Γ hy + have hy_notK : y ∉ K := by + have h_disj : Disjoint R' K := by + by_contra hnot + obtain ⟨z, hzR', hzK⟩ := not_disjoint_iff.mp hnot + have hR'_pre : IsPreconnected R' := region_isPreconnected hR'Γ + have h1 : R' ⊆ j '' (bd S)ᶜ ∪ (range j)ᶜ := by + intro w hw + by_cases hw_range : w ∈ range j + · obtain ⟨x_w, hw_eq⟩ := hw_range + left + refine ⟨x_w, fun hx_bd => region_subset hR'Γ hw ?_, hw_eq⟩ + rw [hΓ_U] + exact ⟨x_w, Or.inr hx_bd, hw_eq⟩ + · exact Or.inr hw_range + have h_open1 : IsOpen (j '' (bd S)ᶜ) := h_open_S_int + have h_open2 : IsOpen (range j)ᶜ := hj.isClosed_range.isOpen_compl + have h_disj12 : Disjoint (j '' (bd S)ᶜ) (range j)ᶜ := + disjoint_left.mpr fun w ⟨x_w, _, hw_eq⟩ hw_c => hw_c ⟨x_w, hw_eq⟩ + have h_sub1 := hR'_pre.subset_left_of_subset_union h_open1 h_open2 h_disj12 h1 + ⟨j x, hjxR', ⟨x, hxbd, rfl⟩⟩ + obtain ⟨x_z, hx_z_bd, hxz_eq⟩ := h_sub1 hzR' + have : j x_z ∈ range j ∩ K := ⟨⟨x_z, rfl⟩, hxz_eq.symm ▸ hzK⟩ + rw [hinter] at this + obtain ⟨x', hx'bd, hjx'⟩ := this + exact hx_z_bd (hj.injective hjx' ▸ hx'bd) + exact disjoint_left.mp h_disj hy + have hy_range : y ∈ range j := by + have : y ∈ range j ∪ K := hunion.symm ▸ mem_univ y + exact this.resolve_right hy_notK + obtain ⟨x_y, rfl⟩ := hy_range + refine ⟨x_y, ⟨mem_univ _, fun h_in => hy_notU ?_⟩, rfl⟩ + rw [hΓ_U] + exact ⟨x_y, h_in, rfl⟩ + intro y hyR' + obtain ⟨x_y, ⟨_, hx_y_not⟩, rfl⟩ := h_sub_range hyR' + have hx_y_bd : x_y ∉ bd S := fun h => hx_y_not (Or.inr h) + have h_pre : IsPreconnected (j ⁻¹' R') := by + let h_homeo := hj.toHomeomorph + have h_eq : j ⁻¹' R' = h_homeo.symm '' (Subtype.val ⁻¹' R' : Set (range j)) := by + ext w + constructor + · intro hw + exact ⟨⟨j w, ⟨w, rfl⟩⟩, hw, by simp [h_homeo]⟩ + · rintro ⟨⟨_, ⟨w', rfl⟩⟩, hw', rfl⟩ + simpa [h_homeo] using hw' + have h_sub_eq : (Subtype.val ⁻¹' R' : Set (range j)) = + (fun z : R' => (⟨z.1, let ⟨w, _, hw⟩ := h_sub_range z.2; ⟨w, hw⟩⟩ : range j)) '' + univ := by + ext ⟨z, hz_range⟩ + constructor + · intro hzR' + exact ⟨⟨z, hzR'⟩, mem_univ _, rfl⟩ + · rintro ⟨⟨z', hz'R'⟩, _, h_eq'⟩ + obtain rfl : z' = z := congrArg Subtype.val h_eq' + exact hz'R' + rw [h_eq, h_sub_eq, ← image_comp] + have : PreconnectedSpace R' := isPreconnected_iff_preconnectedSpace.mp + (region_isPreconnected hR'Γ) + refine isPreconnected_univ.image _ ?_ + exact (h_homeo.symm.continuous.comp + (Continuous.subtype_mk continuous_subtype_val _)).continuousOn + have h_sub_compl : j ⁻¹' R' ⊆ G.Uᶜ := fun w hw hwU => + region_subset hR'Γ hw (by rw [hΓ_U]; exact ⟨w, Or.inl hwU, rfl⟩) + have hx_y_r : x_y ∈ r := + subset_region hr h_pre (disjoint_left.mpr h_sub_compl) hjxR' hxr hyR' + exact ⟨x_y, ⟨mem_sUnion.mpr ⟨r, hrℛ, hx_y_r⟩, hx_y_bd⟩, rfl⟩ + refine ⟨ℛ_T, fun R' hR' => hR'.1, ?_, h_sUnion_eq⟩ + rw [h_sUnion_eq, hj.closure_image_eq (⋃₀ ℛ \ bd S)] + congr 1 + have : LocallyConnectedSpace S := hS.locallyConnected + apply Subset.antisymm + · refine closure_minimal (fun x hx => ?_) isClosed_closure + obtain ⟨r, hrℛ, hxr⟩ := mem_sUnion.mp hx + have hr_open : IsOpen r := region_isOpen (hℛ hrℛ) + rw [mem_closure_iff] + intro V hV hxV + have hx_cl : x ∈ closure (bd S)ᶜ := mem_closure_compl_bd (hS.2.2 x) + obtain ⟨w, ⟨hwV, hwr⟩, hw_not_bd⟩ := mem_closure_iff.mp hx_cl (V ∩ r) + (hV.inter hr_open) ⟨hxV, hxr⟩ + exact ⟨w, hwV, mem_sUnion.mpr ⟨r, hrℛ, hwr⟩, hw_not_bd⟩ + · exact closure_mono sdiff_subset + +/-- If `G` is a proper drawing in a connected surface `S` and `ℛ ⊆ G.R` is a set of regions of `G`, +then `closure (⋃₀ ℛ)` is solid (`IsSolid (closure (⋃₀ ℛ))`). -/ +theorem isSolid_closure_sUnion_regions [ConnectedSpace S] (hS : IsSurface S) (G : Drawing S) + (hG : G.IsProper) {ℛ : Set (Set S)} (hℛ : ℛ ⊆ G.R) : + IsSolid (closure (⋃₀ ℛ)) := by + obtain ⟨T, topT, j, K, Γ, hT, hT_conn, hj, -, -, -, -, -, -, hℛ_map⟩ := + exists_capped_drawing hS G hG + have : T2Space S := hS.2.1 + have : T2Space T := hT.2.1 + obtain ⟨ℛ_T, hℛ_T, h_cl_eq, -⟩ := hℛ_map ℛ hℛ + have hZn : IsGammaNice Γ (closure (⋃₀ ℛ_T)) := + isGammaNice_closure_sUnion_regions hT Γ hℛ_T + have hSolid_T : IsSolid (j '' closure (⋃₀ ℛ)) := by + rw [h_cl_eq] + exact isSolid_of_nice hT isClosed_closure hZn + exact isSolid_of_isClosedEmbedding hj hSolid_T + +/-! ## 2. Proof of (5.5) (pages 231, 254) -/ + +/-- An open set `O` is *good in `closure (⋃₀ ℛ)`* for a drawing `Γ` if `O ∩ closure (⋃₀ ℛ)` is +contained in a simply connected subset `K ⊆ closure (⋃₀ ℛ)` and any two points +`x, y ∈ O ∩ ⋃₀ ℛ` are joined in `closure (⋃₀ ℛ)` by a path `p` in `K` and a homotopic path `q` +in `(Γ.U \ Γ.V)ᶜ`. -/ +def GoodOpenIn (Γ : Drawing S) (ℛ : Set (Set S)) (O : Set S) : Prop := + let Z := closure (⋃₀ ℛ) + IsOpen O ∧ ∃ K : Set S, IsSimplyConnectedSet K ∧ K ⊆ Z ∧ O ∩ Z ⊆ K ∧ + ∀ x (hx : x ∈ O ∩ ⋃₀ ℛ) y (hy : y ∈ O ∩ ⋃₀ ℛ), + ∃ (p q : Path (⟨x, subset_closure hx.2⟩ : Z) ⟨y, subset_closure hy.2⟩), + (∀ u, (p u).1 ∈ K) ∧ (∀ u, (q u).1 ∈ (Γ.U \ Γ.V)ᶜ) ∧ p.Homotopic q + +theorem goodOpenIn_of_joinedIn (Γ : Drawing S) (ℛ : Set (Set S)) {O K : Set S} + (hO : IsOpen O) (hK : IsSimplyConnectedSet K) (hKZ : K ⊆ closure (⋃₀ ℛ)) + (hOK : O ∩ closure (⋃₀ ℛ) ⊆ K) + (hjoin : ∀ x ∈ O ∩ ⋃₀ ℛ, ∀ y ∈ O ∩ ⋃₀ ℛ, JoinedIn (K ∩ (Γ.U \ Γ.V)ᶜ) x y) : + GoodOpenIn Γ ℛ O := by + refine ⟨hO, K, hK, hKZ, hOK, fun x hx y hy => ?_⟩ + obtain ⟨p₀, hp₀⟩ := hjoin x hx y hy + let p : Path (⟨x, subset_closure hx.2⟩ : closure (⋃₀ ℛ)) ⟨y, subset_closure hy.2⟩ := + pathCod p₀ (subset_closure hx.2) (subset_closure hy.2) fun u => hKZ (hp₀ u).1 + exact ⟨p, p, fun u => (hp₀ u).1, fun u => (hp₀ u).2, Path.Homotopic.refl p⟩ + +theorem sub_path_trans_mem {Z A : Set S} {a b c : Z} {p : Path a b} {q : Path b c} + (hp : ∀ u, (p u).1 ∈ A) (hq : ∀ u, (q u).1 ∈ A) (u : I) : ((p.trans q) u).1 ∈ A := by + have : (p.trans q) u ∈ range p ∪ range q := Path.trans_range p q ▸ mem_range_self u + rcases this with ⟨v, hv⟩ | ⟨v, hv⟩ + · exact hv ▸ hp v + · exact hv ▸ hq v + +theorem sub_path_symm_mem {Z A : Set S} {a b : Z} {p : Path a b} + (hp : ∀ u, (p u).1 ∈ A) (u : I) : (p.symm u).1 ∈ A := by + rw [Path.symm_apply] + exact hp _ + +/-- Case 1: Every point `z ∈ closure (⋃₀ ℛ) \ Γ.U` has a `GoodOpenIn` neighborhood. -/ +theorem exists_goodOpenIn_of_notMem_U (hS : IsClosedSurface S) + (Γ : Drawing S) {ℛ : Set (Set S)} (hℛ : ℛ ⊆ Γ.R) {z : S} + (hzZ : z ∈ closure (⋃₀ ℛ)) (hzU : z ∉ Γ.U) : + ∃ O : Set S, z ∈ O ∧ GoodOpenIn Γ ℛ O := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hZn : IsGammaNice Γ (closure (⋃₀ ℛ)) := isGammaNice_closure_sUnion_regions hS Γ hℛ + obtain ⟨r, hr, hzr⟩ := exists_region_of_notMem hzU + have hrZ : r ⊆ closure (⋃₀ ℛ) := nice_region hZn hr ⟨z, hzr, hzZ⟩ + obtain ⟨D, D', hD, hD', hzD', hD'D, hDr, -⟩ := + exists_closedDisc_nbhd hS (region_isOpen hr) hzr + refine ⟨D', hzD', goodOpenIn_of_joinedIn Γ ℛ hD' hD.isSimplyConnectedSet + (hDr.trans hrZ) (inter_subset_left.trans hD'D) fun x hx y hy => ?_⟩ + refine (hD.isPathConnected.joinedIn x (hD'D hx.1) y (hD'D hy.1)).mono fun w hw => ?_ + exact ⟨hw, fun h => region_subset hr (hDr hw) h.1⟩ + +/-- Case 2a: A polar chart at `z ∈ Γ.V ∩ closure (⋃₀ ℛ)` gives a `GoodOpenIn` neighborhood. -/ +theorem exists_goodOpenIn_of_isPolar (hS : IsClosedSurface S) + {Γ : Drawing S} {ℛ : Set (Set S)} (hℛ : ℛ ⊆ Γ.R) {z : S} + (hzV : z ∈ Γ.V) (hzZ : z ∈ closure (⋃₀ ℛ)) {Φ : C(ClosedUnitDisc, S)} + (hp : IsPolar Γ z Φ) : + ∃ O : Set S, z ∈ O ∧ GoodOpenIn Γ ℛ O := by + have : T2Space S := hS.2.1 + have hZn : IsGammaNice Γ (closure (⋃₀ ℛ)) := isGammaNice_closure_sUnion_regions hS Γ hℛ + set Z := closure (⋃₀ ℛ) + let T₀ : Set ClosedUnitDisc := Φ ⁻¹' Z + have hT₀_star : ∀ x ∈ T₀, ∀ c : I, discScale c x ∈ T₀ := + fun x hx c => hp.star isClosed_closure hZn hx c + have hcT₀ : polarCentre ∈ T₀ := by + change Φ polarCentre ∈ Z + rw [hp.centre] + exact hzZ + have hK_sc : IsSimplyConnectedSet (Φ '' T₀) := + isSimplyConnected_star hp.inj hT₀_star ⟨polarCentre, hcT₀⟩ + have hKZ : Φ '' T₀ ⊆ Z := by rintro _ ⟨x, hx, rfl⟩; exact hx + have hOK : interior (range Φ) ∩ Z ⊆ Φ '' T₀ := by + rintro y ⟨hy_int, hyZ⟩ + obtain ⟨x, rfl⟩ := interior_subset hy_int + exact ⟨x, hyZ, rfl⟩ + refine ⟨interior (range Φ), hp.nhd, + goodOpenIn_of_joinedIn Γ ℛ isOpen_interior hK_sc hKZ hOK fun x hx y hy => ?_⟩ + have hray_join : ∀ w ∈ interior (range Φ) ∩ ⋃₀ ℛ, + JoinedIn (Φ '' T₀ ∩ (Γ.U \ Γ.V)ᶜ) z w := by + intro w ⟨hw_int, hwℛ⟩ + obtain ⟨r₀, hr₀ℛ, hwr₀⟩ := mem_sUnion.mp hwℛ + have hwU : w ∉ Γ.U := region_subset (hℛ hr₀ℛ) hwr₀ + obtain ⟨u, rfl⟩ := interior_subset hw_int + have huT₀ : u ∈ T₀ := subset_closure hwℛ + have huc : u ≠ polarCentre := by + rintro rfl + exact hwU (hp.centre.symm ▸ Γ.V_subset_U hzV) + have hcont : Continuous fun t : I => Φ (discScale t u) := + (Φ.continuous.comp continuous_discScale).comp (Continuous.prodMk continuous_id + continuous_const) + refine ⟨⟨⟨fun t => Φ (discScale t u), hcont⟩, by simp [discScale_zero, hp.centre], + by simp [discScale_one]⟩, fun t => ⟨⟨discScale t u, hT₀_star u huT₀ t, rfl⟩, ?_⟩⟩ + change Φ (discScale t u) ∈ (Γ.U \ Γ.V)ᶜ + rcases eq_or_lt_of_le (unitInterval.nonneg t) with h0 | h0 + · have ht0 : t = 0 := Subtype.ext h0.symm + rw [ht0, discScale_zero, hp.centre] + exact fun h => h.2 hzV + · obtain ⟨a, ha, h1, h2⟩ := hp.ray u huc t h0 + intro hU_diff + rcases ha with (⟨v, hv, rfl⟩ | he) | hr + · exact hwU (h1.symm ▸ Γ.V_subset_U hv) + · exact hwU (he.2.1 h1).1 + · exact region_subset hr h2 hU_diff.1 + exact (hray_join x hx).symm.trans (hray_join y hy) + +/-- Case 2: Every vertex `z ∈ Γ.V ∩ closure (⋃₀ ℛ)` has a `GoodOpenIn` neighborhood. -/ +theorem exists_goodOpenIn_of_mem_V [ConnectedSpace S] (hS : IsClosedSurface S) + (Γ : Drawing S) {ℛ : Set (Set S)} (hℛ : ℛ ⊆ Γ.R) {z : S} + (hzV : z ∈ Γ.V) (hzZ : z ∈ closure (⋃₀ ℛ)) : + ∃ O : Set S, z ∈ O ∧ GoodOpenIn Γ ℛ O := by + classical + have : T2Space S := hS.2.1 + have : Nonempty S := ⟨z⟩ + have : LocallyPathConnectedSpace S := IsClosedSurface.locallyPathConnectedSpace hS + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + by_cases h2 : 2 ≤ Nat.card (halfEdges Γ γ z) + · obtain ⟨Φ, hΦ⟩ := exists_isPolar_of_sectors hS hγ hzV h2 + exact exists_goodOpenIn_of_isPolar hS hℛ hzV hzZ hΦ + · have hfinℛ : ℛ.Finite := (finite_R hS Γ).subset hℛ + have hz_biUnion : z ∈ ⋃ r ∈ ℛ, closure r := by + have h_eq : closure (⋃₀ ℛ) = ⋃ r ∈ ℛ, closure r := by + rw [sUnion_eq_biUnion, hfinℛ.closure_biUnion] + rwa [← h_eq] + obtain ⟨r₀, hr₀ℛ, hzr₀⟩ := mem_iUnion₂.mp hz_biUnion + have hr₀ : r₀ ∈ Γ.R := hℛ hr₀ℛ + obtain ⟨W_r, hW_r, hzW_r, hW_r_sub⟩ := exists_nbhd_of_few hS hγ hzV h2 hr₀ hzr₀ + have hW_r_Z : W_r ⊆ closure (⋃₀ ℛ) := + hW_r_sub.trans (closure_mono (subset_sUnion_of_mem hr₀ℛ)) + have hfinH : Finite (halfEdges Γ γ z) := (finite_halfEdges Γ γ z).to_subtype + have hss : Subsingleton (halfEdges Γ γ z) := + Finite.card_le_one_iff_subsingleton.mp (by omega) + rcases isEmpty_or_nonempty (halfEdges Γ γ z) with h0 | ⟨⟨⟨e, b⟩, he, hb⟩⟩ + · have hno : ∀ g ∈ Γ.E, z ∉ closure g := by + intro g hg hzg + obtain ⟨b, hb⟩ := exists_end_eq hγ hg hzV hzg + exact h0.false ⟨(g, b), hg, hb⟩ + let T : Set S := (Γ.V \ {z}) ∪ ⋃ g ∈ Γ.E, closure g + have hT : IsClosed T := (Γ.finite_V.subset sdiff_subset).isClosed.union + (Γ.finite_edges.isClosed_biUnion fun _ _ => isClosed_closure) + have hzT : z ∉ T := by + rintro (h | h) + · exact h.2 rfl + · obtain ⟨g, hg, hzg⟩ := mem_iUnion₂.mp h + exact hno g hg hzg + obtain ⟨D, D', hD, hD', hzD', hD'D, hDT, -⟩ := + exists_closedDisc_nbhd hS (hW_r.inter hT.isOpen_compl) ⟨hzW_r, hzT⟩ + have hDZ : D ⊆ closure (⋃₀ ℛ) := fun w hw => hW_r_Z (hDT hw).1 + refine ⟨D', hzD', goodOpenIn_of_joinedIn Γ ℛ hD' hD.isSimplyConnectedSet hDZ + (inter_subset_left.trans hD'D) fun x hx y hy => ?_⟩ + refine (hD.isPathConnected.joinedIn x (hD'D hx.1) y (hD'D hy.1)).mono fun w hw => ⟨hw, ?_⟩ + rintro ⟨hwU, hwV⟩ + obtain ⟨g, hg, hwg⟩ := Γ.exists_edge_of_mem hwU hwV + exact (hDT hw).2 (Or.inr (mem_iUnion₂.mpr ⟨g, hg, subset_closure hwg⟩)) + · have hleaf : ∀ f ∈ Γ.E, f ≠ e → z ∉ closure f := by + intro f hf hfe hzf + obtain ⟨b', hb'⟩ := exists_end_eq hγ hf hzV hzf + have := congrArg (fun k : halfEdges Γ γ z => k.1.1) + (hss.elim ⟨(f, b'), hf, hb'⟩ ⟨(e, b), he, hb⟩) + exact hfe this + have hzcl : z ∈ closure e := by + have := end_mem_closure hγ he b + rwa [hb] at this + have hnot_loop : ∃ u : S, u ≠ z ∧ closure e ∩ Γ.V = {u, z} ∧ IsLineWithEnds (closure e) u z + := by + rcases Γ.edge_cond e he with ⟨u, v, huv, hcap, hl⟩ | ⟨u, hu, -⟩ + · have hz_uv : z = u ∨ z = v := by + have : z ∈ closure e ∩ Γ.V := ⟨hzcl, hzV⟩ + rwa [hcap, mem_insert_iff, mem_singleton_iff] at this + rcases hz_uv with rfl | rfl + · exact ⟨v, huv.symm, by rw [pair_comm]; exact hcap, hl.symm⟩ + · exact ⟨u, huv, hcap, hl⟩ + · exfalso + have hend : ∀ c, γ e (endOf c) = z := by + intro c + have h₁ : γ e (endOf c) ∈ closure e ∩ Γ.V := by + refine ⟨end_mem_closure hγ he c, ?_⟩ + cases c + · exact hγ.zero e he + · exact hγ.one e he + have h₂ : z ∈ closure e ∩ Γ.V := ⟨hzcl, hzV⟩ + rw [hu] at h₁ h₂ + exact h₁.trans h₂.symm + have := congrArg (fun k : halfEdges Γ γ z => k.1.2) + (hss.elim ⟨(e, true), he, hend true⟩ ⟨(e, false), he, hend false⟩) + simp at this + obtain ⟨u, huz, hcap, hL⟩ := hnot_loop + obtain ⟨D, D', hD, hD', hzD', hD'D, hDW_r, -⟩ := + exists_closedDisc_nbhd hS hW_r hzW_r + have hDZ : D ⊆ closure (⋃₀ ℛ) := hDW_r.trans hW_r_Z + obtain ⟨Z_leaf, hZ_leaf, hzZ_leaf, hZ_conn⟩ := + exists_leaf_nbhd hS Γ he huz hcap hL hleaf hD' hzD' + refine ⟨Z_leaf ∩ D', ⟨hzZ_leaf, hzD'⟩, + goodOpenIn_of_joinedIn Γ ℛ (hZ_leaf.inter hD') hD.isSimplyConnectedSet hDZ + ((inter_subset_left.trans inter_subset_right).trans hD'D) + fun x hx y hy => ?_⟩ + have hxU : x ∉ Γ.U := by + obtain ⟨r, hrℛ, hxr⟩ := mem_sUnion.mp hx.2 + exact region_subset (hℛ hrℛ) hxr + have hyU : y ∉ Γ.U := by + obtain ⟨r, hrℛ, hyr⟩ := mem_sUnion.mp hy.2 + exact region_subset (hℛ hrℛ) hyr + obtain ⟨A, hA_conn, hA_disj, hxA, hyA, hAD'⟩ := + hZ_conn x hx.1.1 hxU y hy.1.1 hyU + have hAU : A ⊆ D' \ Γ.U := fun w hw => ⟨hAD' hw, disjoint_left.mp hA_disj hw⟩ + have hj := joinedIn_of_isOpen_of_isPreconnected (hD'.sdiff Γ.isClosed_U) hA_conn hAU hxA hyA + exact hj.mono fun w ⟨hwD', hwU⟩ => ⟨hD'D hwD', fun h => hwU h.1⟩ + +/-- In an edge chart `c : IsEdgeChart Γ γ t₀ M a b` at `γ t₀ ∈ e ∩ closure (⋃₀ ℛ)`, the intersection +`c.disc ∩ closure (⋃₀ ℛ)` is simply connected (`IsSimplyConnectedSet`). -/ +theorem IsEdgeChart.isSimplyConnectedSet_inter_closure_regions + (hS : IsClosedSurface S) {Γ : Drawing S} {ℛ : Set (Set S)} (hℛ : ℛ ⊆ Γ.R) + {e : Set S} (he : e ∈ Γ.E) {γ : I → S} (hγ : Continuous γ) (hγe : γ '' Ioo 0 1 = e) + {t₀ a b : I} (ht₀ : t₀ ∈ Ioo (0 : I) 1) {M : ℂ → S} + (c : IsEdgeChart Γ γ t₀ M a b) (hzZ : γ t₀ ∈ closure (⋃₀ ℛ)) : + IsSimplyConnectedSet (c.disc ∩ closure (⋃₀ ℛ)) := by + have : T2Space S := hS.2.1 + have hZn : IsGammaNice Γ (closure (⋃₀ ℛ)) := isGammaNice_closure_sUnion_regions hS Γ hℛ + have heZ : e ⊆ closure (⋃₀ ℛ) := + nice_edge hZn he ⟨γ t₀, hγe ▸ mem_image_of_mem γ ht₀, hzZ⟩ + have hcl_eZ : closure e ⊆ closure (⋃₀ ℛ) := closure_minimal heZ isClosed_closure + set Z := closure (⋃₀ ℛ) + let B := Metric.closedBall (0 : ℂ) 1 + let c₀ : B := ⟨0, Metric.mem_closedBall_self zero_le_one⟩ + let scale : I → B → B := fun s w => + ⟨(s : ℝ) • w.1, by + rw [Metric.mem_closedBall, dist_zero_right, norm_smul, Real.norm_eq_abs, + abs_of_nonneg (unitInterval.nonneg s)] + have hw1 : ‖w.1‖ ≤ 1 := by + have h := w.2 + rwa [Metric.mem_closedBall, dist_zero_right] at h + nlinarith [unitInterval.nonneg s, unitInterval.le_one s, norm_nonneg w.1]⟩ + have hscale_cont : Continuous fun p : I × B => scale p.1 p.2 := by + refine Continuous.subtype_mk ?_ _ + exact (continuous_subtype_val.comp continuous_fst).smul (continuous_subtype_val.comp + continuous_snd) + have hscale_zero : ∀ w : B, scale 0 w = c₀ := fun w => Subtype.ext (by simp [scale, c₀]) + have hscale_one : ∀ w : B, scale 1 w = w := fun w => Subtype.ext (by simp [scale]) + let Φ : C(B, S) := + ⟨fun w => M w.1, c.cont.comp_continuous continuous_subtype_val fun w => w.2⟩ + have hΦ_inj : Function.Injective Φ := fun u v h => Subtype.ext (c.inj u.2 v.2 h) + let T₀ : Set B := Φ ⁻¹' Z + have hcT₀ : c₀ ∈ T₀ := by + change M 0 ∈ Z + rw [c.zero] + exact hzZ + have hT₀_star : ∀ w ∈ T₀, ∀ s : I, scale s w ∈ T₀ := by + intro w hwZ s + rcases eq_or_lt_of_le (unitInterval.nonneg s) with h0 | hs_pos + · have hs0 : s = 0 := Subtype.ext h0.symm + rw [hs0, hscale_zero] + exact hcT₀ + · have hs_pos' : (0 : ℝ) < (s : ℝ) := hs_pos + rcases IsEdgeChart.cases_of_closedBall w.2 with hwL | hw0 | hwU + · have hsw_L : (scale s w).1 ∈ IsEdgeChart.lower := by + refine ⟨(scale s w).2, ?_⟩ + change ((s : ℝ) • w.1).im < 0 + rw [Complex.real_smul, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, + zero_mul, add_zero] + exact mul_neg_of_pos_of_neg hs_pos' hwL.2 + obtain ⟨r, hr, hwr⟩ := exists_region_of_notMem + (disjoint_left.mp c.lower_disjoint ⟨w.1, hwL, rfl⟩) + have hrZ : r ⊆ Z := nice_region hZn hr ⟨M w.1, hwr, hwZ⟩ + have hL_r : M '' IsEdgeChart.lower ⊆ r := + subset_region hr c.lower_conn c.lower_disjoint ⟨w.1, hwL, rfl⟩ hwr + exact hrZ (hL_r ⟨(scale s w).1, hsw_L, rfl⟩) + · have hsw_0 : (scale s w).1 ∈ {z : ℂ | z ∈ Metric.closedBall 0 1 ∧ z.im = 0} := by + refine ⟨(scale s w).2, ?_⟩ + change ((s : ℝ) • w.1).im = 0 + rw [Complex.real_smul, Complex.mul_im, hw0, Complex.ofReal_im, mul_zero, zero_mul, + add_zero] + have hM_mem : M (scale s w).1 ∈ γ '' Icc a b := by + rw [← c.closed_eq] + exact ⟨(scale s w).1, hsw_0, rfl⟩ + obtain ⟨t, _, hMt⟩ := hM_mem + have ht_cl : γ t ∈ closure e := by + have ht_Ioo : t ∈ closure (Ioo (0 : I) 1) := by + rw [closure_Ioo (zero_ne_one' I)] + exact ⟨t.2.1, t.2.2⟩ + have := image_closure_subset_closure_image hγ ⟨t, ht_Ioo, rfl⟩ + rwa [hγe] at this + change M (scale s w).1 ∈ Z + rw [← hMt] + exact hcl_eZ ht_cl + · have hsw_U : (scale s w).1 ∈ IsEdgeChart.upper := by + refine ⟨(scale s w).2, ?_⟩ + change 0 < ((s : ℝ) • w.1).im + rw [Complex.real_smul, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, + zero_mul, add_zero] + exact mul_pos hs_pos' hwU.2 + obtain ⟨r, hr, hwr⟩ := exists_region_of_notMem + (disjoint_left.mp c.upper_disjoint ⟨w.1, hwU, rfl⟩) + have hrZ : r ⊆ Z := nice_region hZn hr ⟨M w.1, hwr, hwZ⟩ + have hU_r : M '' IsEdgeChart.upper ⊆ r := + subset_region hr c.upper_conn c.upper_disjoint ⟨w.1, hwU, rfl⟩ hwr + exact hrZ (hU_r ⟨(scale s w).1, hsw_U, rfl⟩) + have h_eq : c.disc ∩ Z = Φ '' T₀ := by + ext y + constructor + · rintro ⟨⟨w, hw, rfl⟩, hyZ⟩ + exact ⟨⟨w, hw⟩, hyZ, rfl⟩ + · rintro ⟨⟨w, hw⟩, hwZ, rfl⟩ + exact ⟨⟨w, hw, rfl⟩, hwZ⟩ + rw [h_eq] + have hcont : Continuous fun p : I × B => Φ (scale p.1 p.2) := + Φ.continuous.comp hscale_cont + refine ⟨⟨Φ c₀, ⟨c₀, hcT₀, rfl⟩, ?_⟩, fun φ hφ => ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + have hp : Continuous fun t : I => Φ (scale t x) := + hcont.comp (Continuous.prodMk continuous_id continuous_const) + refine ⟨⟨⟨fun t => Φ (scale t x), hp⟩, by simp [hscale_zero], by simp [hscale_one]⟩, + fun t => ?_⟩ + exact ⟨_, hT₀_star x hx t, rfl⟩ + · have : CompactSpace B := isCompact_iff_compactSpace.mp (ProperSpace.isCompact_closedBall + (0 : ℂ) 1) + have hemb : IsEmbedding Φ := (Φ.continuous.isClosedEmbedding hΦ_inj).isEmbedding + have hex : ∀ z, ∃ x ∈ T₀, Φ x = φ z := fun z => hφ (mem_range_self z) + choose ψ hψT hψ using hex + have hψc : Continuous ψ := hemb.continuous_iff.mpr (by + have : (Φ ∘ ψ) = φ := funext hψ + rw [this] + exact φ.continuous) + refine ⟨Φ c₀, ⟨c₀, hcT₀, rfl⟩, ⟨⟨fun p => Φ (scale (σ p.2) (ψ p.1)), ?_⟩, ?_, ?_, ?_⟩⟩ + · exact hcont.comp (Continuous.prodMk (by fun_prop) (by fun_prop)) + · intro p + exact ⟨_, hT₀_star _ (hψT _) _, rfl⟩ + · intro z + change Φ (scale (σ 0) (ψ z)) = φ z + rw [unitInterval.symm_zero, hscale_one, hψ] + · intro z + change Φ (scale (σ 1) (ψ z)) = Φ c₀ + rw [unitInterval.symm_one, hscale_zero] + +private theorem good_open_times_closed + {S : Type u} + [TopologicalSpace S] + (hS : IsClosedSurface S) + (Γ : Drawing S) + {ℛ : Set (Set S)} + (hℛ : ℛ ⊆ Γ.R) + {e : Set S} + (he : e ∈ Γ.E) + [this : T2Space S] + (hman : ∀ (x : S), IsManifoldPoint x) + (γ : ↑I → S) + (hγ : Continuous γ) + (hγ0 : γ 0 ∈ Γ.V) + (hγ1 : γ 1 ∈ Γ.V) + (hinj : InjOn γ (Ioo 0 1)) + (hγe : γ '' Ioo 0 1 = e) + (hγ_mem_Z : ∀ (t : ↑I), γ t ∈ closure (⋃₀ ℛ)) + (h0T : 0 ∈ ({t | ∃ O, γ t ∈ O ∧ GoodOpenIn Γ ℛ O})) + (h1T : 1 ∈ ({t | ∃ O, γ t ∈ O ∧ GoodOpenIn Γ ℛ O})) : + IsClosed ({t | ∃ O, γ t ∈ O ∧ GoodOpenIn Γ ℛ O}) := by + let Z := closure (⋃₀ ℛ) + let T := {t | ∃ O, γ t ∈ O ∧ GoodOpenIn Γ ℛ O} + rw [← closure_subset_iff_isClosed] + intro t₀ ht₀_cl + rcases eq_or_lt_of_le (unitInterval.nonneg t₀) with h0 | h0 + · exact (Subtype.ext h0.symm : t₀ = 0) ▸ h0T + rcases eq_or_lt_of_le (unitInterval.le_one t₀) with h1 | h1 + · exact (Subtype.ext h1 : t₀ = 1) ▸ h1T + have ht₀ : t₀ ∈ Ioo (0 : I) 1 := ⟨h0, h1⟩ + obtain ⟨M, a, b, g₁, g₂, _, g₄, g₅, _, g₇, g₈, g₉, g₁₀, g₁₁⟩ := + exists_edge_chart hS Γ he hγ hγ0 hγ1 hinj hγe ht₀ ht₀.1 ht₀.2 + have c : IsEdgeChart Γ γ t₀ M a b := ⟨g₁, g₂, g₄, g₅, g₇, g₈, g₉, g₁₀, g₁₁⟩ + let O : Set S := M '' Metric.ball 0 1 + have hO_open : IsOpen O := by + change IsOpen (M '' Metric.ball 0 1) + rw [← c.discInt_eq] + exact c.isClosedDisc.isOpen_discInt hman + have ht₀_O : γ t₀ ∈ O := ⟨0, by simp, c.zero⟩ + have hOD : O ⊆ c.disc := image_mono Metric.ball_subset_closedBall + let K : Set S := c.disc ∩ Z + have hK_sc : IsSimplyConnectedSet K := + IsEdgeChart.isSimplyConnectedSet_inter_closure_regions hS hℛ he hγ hγe ht₀ c (hγ_mem_Z t₀) + have hKZ : K ⊆ Z := inter_subset_right + have hOK : O ∩ Z ⊆ K := fun w hw => ⟨hOD hw.1, hw.2⟩ + have h_side : ∀ w ∈ O ∩ ⋃₀ ℛ, w ∈ M '' IsEdgeChart.lower ∨ w ∈ M '' IsEdgeChart.upper := by + rintro _ ⟨⟨z, hz, rfl⟩, hwℛ⟩ + obtain ⟨r, hrℛ, hwr⟩ := mem_sUnion.mp hwℛ + have hnU : M z ∉ Γ.U := region_subset (hℛ hrℛ) hwr + rcases IsEdgeChart.cases_of_closedBall (Metric.ball_subset_closedBall hz) with h | h | h + · exact Or.inl ⟨z, h, rfl⟩ + · exact absurd ((c.mem_U z (Metric.ball_subset_closedBall hz)).mpr h) hnU + · exact Or.inr ⟨z, h, rfl⟩ + have hL_in_R : ∀ w ∈ M '' IsEdgeChart.lower, w ∈ ⋃₀ ℛ → + M '' IsEdgeChart.lower ⊆ ⋃₀ ℛ ∧ M '' IsEdgeChart.lower ⊆ K ∩ (Γ.U \ Γ.V)ᶜ := by + intro w hwL hwℛ + obtain ⟨r, hrℛ, hwr⟩ := mem_sUnion.mp hwℛ + have h_sub_r : M '' IsEdgeChart.lower ⊆ r := + subset_region (hℛ hrℛ) c.lower_conn c.lower_disjoint hwL hwr + have h_sub_ℛ : M '' IsEdgeChart.lower ⊆ ⋃₀ ℛ := h_sub_r.trans (subset_sUnion_of_mem hrℛ) + refine ⟨h_sub_ℛ, fun u huL => ⟨⟨?_, subset_closure (h_sub_ℛ huL)⟩, ?_⟩⟩ + · obtain ⟨z_u, hz_u, rfl⟩ := huL + exact ⟨z_u, hz_u.1, rfl⟩ + · exact fun h => disjoint_left.mp c.lower_disjoint huL h.1 + have hU_in_R : ∀ w ∈ M '' IsEdgeChart.upper, w ∈ ⋃₀ ℛ → + M '' IsEdgeChart.upper ⊆ ⋃₀ ℛ ∧ M '' IsEdgeChart.upper ⊆ K ∩ (Γ.U \ Γ.V)ᶜ := by + intro w hwU hwℛ + obtain ⟨r, hrℛ, hwr⟩ := mem_sUnion.mp hwℛ + have h_sub_r : M '' IsEdgeChart.upper ⊆ r := + subset_region (hℛ hrℛ) c.upper_conn c.upper_disjoint hwU hwr + have h_sub_ℛ : M '' IsEdgeChart.upper ⊆ ⋃₀ ℛ := h_sub_r.trans (subset_sUnion_of_mem hrℛ) + refine ⟨h_sub_ℛ, fun u huU => ⟨⟨?_, subset_closure (h_sub_ℛ huU)⟩, ?_⟩⟩ + · obtain ⟨z_u, hz_u, rfl⟩ := huU + exact ⟨z_u, hz_u.1, rfl⟩ + · exact fun h => disjoint_left.mp c.upper_disjoint huU h.1 + obtain ⟨t₁, ⟨ht₁_ab, ⟨O₁, ht₁_O₁, hO₁_open, K₁, hK₁_sc, hK₁Z, hO₁K₁, hO₁_join⟩⟩⟩ := + mem_closure_iff.mp ht₀_cl (Ioo a b) isOpen_Ioo ⟨c.left, c.right⟩ + have hγt₁_ball : γ t₁ ∈ M '' {z | z ∈ Metric.ball (0 : ℂ) 1 ∧ z.im = 0} := by + rw [c.ball_eq] + exact ⟨t₁, ht₁_ab, rfl⟩ + obtain ⟨z₁, ⟨hz₁_ball, hz₁_im⟩, hMz₁⟩ := hγt₁_ball + have hγt₁_O : γ t₁ ∈ O₁ ∩ O := ⟨ht₁_O₁, z₁, hz₁_ball, hMz₁⟩ + obtain ⟨E, E', hE, hE', hγt₁_E', hE'E, hE_sub, -⟩ := + exists_closedDisc_nbhd hS (hO₁_open.inter hO_open) hγt₁_O + have hcont_z₁ : ContinuousAt M z₁ := + c.cont.continuousAt (mem_of_superset (Metric.isOpen_ball.mem_nhds hz₁_ball) + Metric.ball_subset_closedBall) + have hnhds : M ⁻¹' E' ∩ Metric.ball (0 : ℂ) 1 ∈ 𝓝 z₁ := + Filter.inter_mem (hcont_z₁.preimage_mem_nhds (hE'.mem_nhds (hMz₁.symm ▸ hγt₁_E'))) + (Metric.isOpen_ball.mem_nhds hz₁_ball) + obtain ⟨δ, hδ_pos, hδ_ball⟩ := Metric.mem_nhds_iff.mp hnhds + let w_low : ℂ := z₁ - ((δ / 2 : ℝ) : ℂ) * Complex.I + let w_up : ℂ := z₁ + ((δ / 2 : ℝ) : ℂ) * Complex.I + have hw_low_mem : w_low ∈ Metric.ball z₁ δ := by + rw [Metric.mem_ball, dist_eq_norm, sub_sub_cancel_left, norm_neg, norm_mul, Complex.norm_I, + mul_one, + Complex.norm_real, Real.norm_eq_abs, abs_of_pos (half_pos hδ_pos)] + linarith + have hw_up_mem : w_up ∈ Metric.ball z₁ δ := by + rw [Metric.mem_ball, dist_eq_norm, add_sub_cancel_left, norm_mul, Complex.norm_I, mul_one, + Complex.norm_real, Real.norm_eq_abs, abs_of_pos (half_pos hδ_pos)] + linarith + have hw_low_in : w_low ∈ IsEdgeChart.lower := by + refine ⟨Metric.ball_subset_closedBall (hδ_ball hw_low_mem).2, ?_⟩ + simp [w_low, hz₁_im] + linarith + have hw_up_in : w_up ∈ IsEdgeChart.upper := by + refine ⟨Metric.ball_subset_closedBall (hδ_ball hw_up_mem).2, ?_⟩ + simp [w_up, hz₁_im] + linarith + let x_L : S := M w_low + let x_U : S := M w_up + have hx_L_L : x_L ∈ M '' IsEdgeChart.lower := ⟨w_low, hw_low_in, rfl⟩ + have hx_U_U : x_U ∈ M '' IsEdgeChart.upper := ⟨w_up, hw_up_in, rfl⟩ + have hx_L_E' : x_L ∈ E' := (hδ_ball hw_low_mem).1 + have hx_U_E' : x_U ∈ E' := (hδ_ball hw_up_mem).1 + refine ⟨O, ht₀_O, hO_open, K, hK_sc, hKZ, hOK, fun x hx y hy => ?_⟩ + rcases h_side x hx with hxL | hxU <;> rcases h_side y hy with hyL | hyU + · obtain ⟨_, hL_sub⟩ := hL_in_R x hxL hx.2 + obtain ⟨p₀, hp₀⟩ := ((IsEdgeChart.lower_pathConnected c).joinedIn x hxL y hyL).mono hL_sub + let p : Path (⟨x, subset_closure hx.2⟩ : Z) ⟨y, subset_closure hy.2⟩ := + pathCod p₀ (subset_closure hx.2) (subset_closure hy.2) fun u => hKZ (hp₀ u).1 + exact ⟨p, p, fun u => (hp₀ u).1, fun u => (hp₀ u).2, Path.Homotopic.refl p⟩ + · obtain ⟨hL_ℛ, hL_sub⟩ := hL_in_R x hxL hx.2 + obtain ⟨hU_ℛ, hU_sub⟩ := hU_in_R y hyU hy.2 + have hc_disc_Z : c.disc ⊆ Z := by + rintro _ ⟨w, hw, rfl⟩ + rcases IsEdgeChart.cases_of_closedBall hw with h | h | h + · exact subset_closure (hL_ℛ ⟨w, h, rfl⟩) + · have : M w ∈ γ '' Icc a b := c.closed_eq ▸ ⟨w, ⟨hw, h⟩, rfl⟩ + obtain ⟨t, _, hMt⟩ := this + rw [← hMt] + exact hγ_mem_Z t + · exact subset_closure (hU_ℛ ⟨w, h, rfl⟩) + have hEZ : E ⊆ Z := fun w hw => hc_disc_Z (hOD (hE_sub hw).2) + have hEK : E ⊆ K := fun w hw => ⟨hOD (hE_sub hw).2, hEZ hw⟩ + have hEK₁ : E ⊆ K₁ := fun w hw => hO₁K₁ ⟨(hE_sub hw).1, hEZ hw⟩ + have hx_L_O₁ : x_L ∈ O₁ ∩ ⋃₀ ℛ := ⟨(hE_sub (hE'E hx_L_E')).1, hL_ℛ hx_L_L⟩ + have hx_U_O₁ : x_U ∈ O₁ ∩ ⋃₀ ℛ := ⟨(hE_sub (hE'E hx_U_E')).1, hU_ℛ hx_U_U⟩ + obtain ⟨p₁, q₀, hp₁K₁, hq₀G, hp₁q₀⟩ := hO₁_join x_L hx_L_O₁ x_U hx_U_O₁ + obtain ⟨p₀_S, hp₀E⟩ := hE.isPathConnected.joinedIn x_L (hE'E hx_L_E') x_U (hE'E hx_U_E') + let p₀ : Path (⟨x_L, subset_closure hx_L_O₁.2⟩ : Z) ⟨x_U, subset_closure hx_U_O₁.2⟩ := + pathCod p₀_S (subset_closure hx_L_O₁.2) (subset_closure hx_U_O₁.2) fun u => hEZ (hp₀E u) + have hp₀K : ∀ u, (p₀ u).1 ∈ K := fun u => hEK (hp₀E u) + have hp₀K₁ : ∀ u, (p₀ u).1 ∈ K₁ := fun u => hEK₁ (hp₀E u) + have hp₀p₁ : p₀.Homotopic p₁ := + homotopic_of_mem hK₁_sc hK₁Z p₀ p₁ + (hO₁K₁ ⟨hx_L_O₁.1, subset_closure hx_L_O₁.2⟩) + (hO₁K₁ ⟨hx_U_O₁.1, subset_closure hx_U_O₁.2⟩) hp₀K₁ hp₁K₁ + have hp₀q₀ : p₀.Homotopic q₀ := hp₀p₁.trans hp₁q₀ + obtain ⟨α_S, hα⟩ := ((IsEdgeChart.lower_pathConnected c).joinedIn x hxL x_L hx_L_L).mono + hL_sub + obtain ⟨β_S, hβ⟩ := ((IsEdgeChart.upper_pathConnected c).joinedIn x_U hx_U_U y hyU).mono + hU_sub + let α : Path (⟨x, subset_closure hx.2⟩ : Z) ⟨x_L, subset_closure hx_L_O₁.2⟩ := + pathCod α_S (subset_closure hx.2) (subset_closure hx_L_O₁.2) fun u => hKZ (hα u).1 + let β : Path (⟨x_U, subset_closure hx_U_O₁.2⟩ : Z) ⟨y, subset_closure hy.2⟩ := + pathCod β_S (subset_closure hx_U_O₁.2) (subset_closure hy.2) fun u => hKZ (hβ u).1 + refine ⟨α.trans (p₀.trans β), α.trans (q₀.trans β), + sub_path_trans_mem (fun u => (hα u).1) (sub_path_trans_mem hp₀K fun u => (hβ u).1), + sub_path_trans_mem (fun u => (hα u).2) (sub_path_trans_mem hq₀G fun u => (hβ u).2), + (Path.Homotopic.refl α).hcomp (hp₀q₀.hcomp (Path.Homotopic.refl β))⟩ + · obtain ⟨hU_ℛ, hU_sub⟩ := hU_in_R x hxU hx.2 + obtain ⟨hL_ℛ, hL_sub⟩ := hL_in_R y hyL hy.2 + have hc_disc_Z : c.disc ⊆ Z := by + rintro _ ⟨w, hw, rfl⟩ + rcases IsEdgeChart.cases_of_closedBall hw with h | h | h + · exact subset_closure (hL_ℛ ⟨w, h, rfl⟩) + · have : M w ∈ γ '' Icc a b := c.closed_eq ▸ ⟨w, ⟨hw, h⟩, rfl⟩ + obtain ⟨t, _, hMt⟩ := this + rw [← hMt] + exact hγ_mem_Z t + · exact subset_closure (hU_ℛ ⟨w, h, rfl⟩) + have hEZ : E ⊆ Z := fun w hw => hc_disc_Z (hOD (hE_sub hw).2) + have hEK : E ⊆ K := fun w hw => ⟨hOD (hE_sub hw).2, hEZ hw⟩ + have hEK₁ : E ⊆ K₁ := fun w hw => hO₁K₁ ⟨(hE_sub hw).1, hEZ hw⟩ + have hx_L_O₁ : x_L ∈ O₁ ∩ ⋃₀ ℛ := ⟨(hE_sub (hE'E hx_L_E')).1, hL_ℛ hx_L_L⟩ + have hx_U_O₁ : x_U ∈ O₁ ∩ ⋃₀ ℛ := ⟨(hE_sub (hE'E hx_U_E')).1, hU_ℛ hx_U_U⟩ + obtain ⟨p₁, q₀, hp₁K₁, hq₀G, hp₁q₀⟩ := hO₁_join x_L hx_L_O₁ x_U hx_U_O₁ + obtain ⟨p₀_S, hp₀E⟩ := hE.isPathConnected.joinedIn x_L (hE'E hx_L_E') x_U (hE'E hx_U_E') + let p₀ : Path (⟨x_L, subset_closure hx_L_O₁.2⟩ : Z) ⟨x_U, subset_closure hx_U_O₁.2⟩ := + pathCod p₀_S (subset_closure hx_L_O₁.2) (subset_closure hx_U_O₁.2) fun u => hEZ (hp₀E u) + have hp₀K : ∀ u, (p₀ u).1 ∈ K := fun u => hEK (hp₀E u) + have hp₀K₁ : ∀ u, (p₀ u).1 ∈ K₁ := fun u => hEK₁ (hp₀E u) + have hp₀p₁ : p₀.Homotopic p₁ := + homotopic_of_mem hK₁_sc hK₁Z p₀ p₁ + (hO₁K₁ ⟨hx_L_O₁.1, subset_closure hx_L_O₁.2⟩) + (hO₁K₁ ⟨hx_U_O₁.1, subset_closure hx_U_O₁.2⟩) hp₀K₁ hp₁K₁ + have hp₀q₀ : p₀.Homotopic q₀ := hp₀p₁.trans hp₁q₀ + obtain ⟨α_S, hα⟩ := ((IsEdgeChart.upper_pathConnected c).joinedIn x hxU x_U hx_U_U).mono + hU_sub + obtain ⟨β_S, hβ⟩ := ((IsEdgeChart.lower_pathConnected c).joinedIn x_L hx_L_L y hyL).mono + hL_sub + let α : Path (⟨x, subset_closure hx.2⟩ : Z) ⟨x_U, subset_closure hx_U_O₁.2⟩ := + pathCod α_S (subset_closure hx.2) (subset_closure hx_U_O₁.2) fun u => hKZ (hα u).1 + let β : Path (⟨x_L, subset_closure hx_L_O₁.2⟩ : Z) ⟨y, subset_closure hy.2⟩ := + pathCod β_S (subset_closure hx_L_O₁.2) (subset_closure hy.2) fun u => hKZ (hβ u).1 + refine ⟨α.trans (p₀.symm.trans β), α.trans (q₀.symm.trans β), + sub_path_trans_mem (fun u => (hα u).1) (sub_path_trans_mem (sub_path_symm_mem hp₀K) fun u + => (hβ u).1), + sub_path_trans_mem (fun u => (hα u).2) (sub_path_trans_mem (sub_path_symm_mem hq₀G) fun u + => (hβ u).2), + (Path.Homotopic.refl α).hcomp ((path_homotopic_symm hp₀q₀).hcomp (Path.Homotopic.refl β))⟩ + · obtain ⟨_, hU_sub⟩ := hU_in_R x hxU hx.2 + obtain ⟨p₀, hp₀⟩ := ((IsEdgeChart.upper_pathConnected c).joinedIn x hxU y hyU).mono hU_sub + let p : Path (⟨x, subset_closure hx.2⟩ : Z) ⟨y, subset_closure hy.2⟩ := + pathCod p₀ (subset_closure hx.2) (subset_closure hy.2) fun u => hKZ (hp₀ u).1 + exact ⟨p, p, fun u => (hp₀ u).1, fun u => (hp₀ u).2, Path.Homotopic.refl p⟩ + +/-- Case 3: Every point `z ∈ e ∩ closure (⋃₀ ℛ)` (`e ∈ Γ.E`) has a `GoodOpenIn` neighborhood. -/ +theorem exists_goodOpenIn_of_mem_edge [ConnectedSpace S] (hS : IsClosedSurface S) + (Γ : Drawing S) {ℛ : Set (Set S)} (hℛ : ℛ ⊆ Γ.R) {e : Set S} + (he : e ∈ Γ.E) {z : S} (hze : z ∈ e) (hzZ : z ∈ closure (⋃₀ ℛ)) : + ∃ O : Set S, z ∈ O ∧ GoodOpenIn Γ ℛ O := by + have : T2Space S := hS.2.1 + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hZn : IsGammaNice Γ (closure (⋃₀ ℛ)) := isGammaNice_closure_sUnion_regions hS Γ hℛ + have heZ : e ⊆ closure (⋃₀ ℛ) := nice_edge hZn he ⟨z, hze, hzZ⟩ + have hcl_eZ : closure e ⊆ closure (⋃₀ ℛ) := closure_minimal heZ isClosed_closure + set Z := closure (⋃₀ ℛ) + obtain ⟨γ, hγ, hγ0, hγ1, hinj, hγe⟩ := exists_edge_param Γ he + have hγ_mem_Z : ∀ t : I, γ t ∈ Z := by + intro t + have ht_Ioo : t ∈ closure (Ioo (0 : I) 1) := by + rw [closure_Ioo (zero_ne_one' I)] + exact ⟨t.2.1, t.2.2⟩ + have := image_closure_subset_closure_image hγ ⟨t, ht_Ioo, rfl⟩ + rw [hγe] at this + exact hcl_eZ this + let T : Set I := {t : I | ∃ O : Set S, γ t ∈ O ∧ GoodOpenIn Γ ℛ O} + have h0T : (0 : I) ∈ T := exists_goodOpenIn_of_mem_V hS Γ hℛ hγ0 (hγ_mem_Z 0) + have h1T : (1 : I) ∈ T := exists_goodOpenIn_of_mem_V hS Γ hℛ hγ1 (hγ_mem_Z 1) + have hT_open : IsOpen T := by + rw [isOpen_iff_forall_mem_open] + rintro t ⟨O, htO, hGO⟩ + exact ⟨γ ⁻¹' O, fun s hs => ⟨O, hs, hGO⟩, hGO.1.preimage hγ, htO⟩ + have hT_closed : IsClosed T := by + exact good_open_times_closed (S := S) hS Γ (ℛ := ℛ) hℛ (e := e) he hman γ hγ hγ0 hγ1 hinj + hγe hγ_mem_Z h0T h1T + have hT_univ : T = univ := IsClopen.eq_univ ⟨hT_closed, hT_open⟩ ⟨0, h0T⟩ + obtain ⟨t, -, rfl⟩ : z ∈ γ '' Ioo 0 1 := hγe.symm ▸ hze + have htT : t ∈ T := hT_univ.symm ▸ mem_univ t + exact htT + +/-- Every point `z ∈ closure (⋃₀ ℛ)` on a closed surface `S` has a `GoodOpenIn` neighborhood. -/ +theorem exists_goodOpenIn [ConnectedSpace S] (hS : IsClosedSurface S) (Γ : Drawing S) + {ℛ : Set (Set S)} (hℛ : ℛ ⊆ Γ.R) {z : S} (hzZ : z ∈ closure (⋃₀ ℛ)) : + ∃ O : Set S, z ∈ O ∧ GoodOpenIn Γ ℛ O := by + by_cases hzV : z ∈ Γ.V + · exact exists_goodOpenIn_of_mem_V hS Γ hℛ hzV hzZ + · by_cases hzU : z ∈ Γ.U + · obtain ⟨e, he, hze⟩ := Γ.exists_edge_of_mem hzU hzV + exact exists_goodOpenIn_of_mem_edge hS Γ hℛ he hze hzZ + · exact exists_goodOpenIn_of_notMem_U hS Γ hℛ hzZ hzU + +private theorem joinedIn_of_isArcConnected {X : Set S} (hX : IsArcConnected X) {x y : S} + (hx : x ∈ X) (hy : y ∈ X) : JoinedIn X x y := by + by_cases hxy : x = y + · subst hxy; exact JoinedIn.refl hx + · obtain ⟨L, hL, f, h0, h1⟩ := hX x hx y hy hxy + exact (show JoinedIn L x y from + ⟨⟨⟨fun t => (f t).1, by fun_prop⟩, h0, h1⟩, fun t => (f t).2⟩).mono hL + +/-- Every path `p : Path a b` in `Z = closure (⋃₀ ℛ)` on a closed surface `S` whose endpoints lie in +`⋃₀ ℛ` is homotopic in `Z` (with fixed endpoints) to a path `q : Path a b` in `Z` with +`∀ t, (q t).1 ∈ (Γ.U \ Γ.V)ᶜ`. -/ +theorem exists_homotopic_normal_path_in_closed [ConnectedSpace S] (hS : IsClosedSurface S) + (Γ : Drawing S) {ℛ : Set (Set S)} (hℛ : ℛ ⊆ Γ.R) + {a b : closure (⋃₀ ℛ)} (ha : a.1 ∈ ⋃₀ ℛ) (hb : b.1 ∈ ⋃₀ ℛ) (p : Path a b) : + ∃ q : Path a b, p.Homotopic q ∧ ∀ t, (q t).1 ∈ (Γ.U \ Γ.V)ᶜ := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let Z := closure (⋃₀ ℛ) + have hSolid : IsSolid Z := isSolid_of_nice hS isClosed_closure + (isGammaNice_closure_sUnion_regions hS Γ hℛ) + have hnotU_of_mem_ℛ : ∀ {w : S}, w ∈ ⋃₀ ℛ → w ∉ Γ.U := by + rintro w ⟨r, hr, hwr⟩ + exact region_subset (hℛ hr) hwr + let good : Set I → Prop := fun W => IsOpen W ∧ ∃ U : Set S, GoodOpenIn Γ ℛ U ∧ ∀ t ∈ W, + (p t).1 ∈ U + have hp_cont : Continuous fun t : I => (p t).1 := continuous_subtype_val.comp p.continuous + have hcover : (univ : Set I) ⊆ ⋃ W : {W : Set I // good W}, W.1 := by + intro t _ + obtain ⟨U, htU, hGU⟩ := exists_goodOpenIn hS Γ hℛ (p t).2 + exact mem_iUnion.mpr ⟨⟨(fun s => (p s).1) ⁻¹' U, hGU.1.preimage hp_cont, U, hGU, + fun _ hw => hw⟩, htU⟩ + obtain ⟨t, ht0, htmono, ⟨n₀, hn₀⟩, htW⟩ := + exists_monotone_Icc_subset_open_cover_unitInterval + (fun W : {W : Set I // good W} => W.2.1) hcover + have key : ∀ n (U : Set S), IsOpen U → (p (t n)).1 ∈ U → + ∃ (x : S) (hx : x ∈ U ∩ ⋃₀ ℛ) (α : Path (p (t n)) ⟨x, subset_closure hx.2⟩) + (q : Path (p 0) ⟨x, subset_closure hx.2⟩), + (∀ u, (α u).1 ∈ U) ∧ (∀ u, (q u).1 ∈ (Γ.U \ Γ.V)ᶜ) ∧ + (p.subpath 0 (t n)).Homotopic (q.trans α.symm) := by + intro n + induction n with + | zero => + intro U _ hpU + rw [ht0] at hpU ⊢ + have hp0_ℛ : (p 0).1 ∈ ⋃₀ ℛ := by rw [p.source]; exact ha + have hp0_notU : (p 0).1 ∉ Γ.U := hnotU_of_mem_ℛ hp0_ℛ + refine ⟨(p 0).1, ⟨hpU, hp0_ℛ⟩, Path.refl (p 0), Path.refl (p 0), + fun _ => hpU, fun _ h => hp0_notU h.1, ?_⟩ + rw [Path.subpath_self] + exact (Path.Homotopic.refl_trans (Path.refl (p 0))).symm + | succ n ih => + intro U' hU'_open hp_U' + obtain ⟨⟨W, _, U_n, hUn, hW_Un⟩, hsub⟩ := htW n + have hle : t n ≤ t (n + 1) := htmono (Nat.le_succ n) + have hp_Un : ∀ w ∈ Icc (t n) (t (n + 1)), (p w).1 ∈ U_n := fun w hw => hW_Un w (hsub hw) + obtain ⟨hUn_open, K_n, hK_n_sc, hK_n_Z, hUn_Kn, hUn_join⟩ := hUn + obtain ⟨x_n, hx_n, α_n, q_n, hα_n, hq_n, hhom_n⟩ := + ih U_n hUn_open (hp_Un (t n) ⟨le_rfl, hle⟩) + have hp_inter : (p (t (n + 1))).1 ∈ U_n ∩ U' := ⟨hp_Un (t (n + 1)) ⟨hle, le_rfl⟩, hp_U'⟩ + obtain ⟨V, hV_sub, hp_V, hV_open, hZV_arc⟩ := + hSolid.1 (p (t (n + 1))).1 (p (t (n + 1))).2 (U_n ∩ U') (hUn_open.inter hU'_open) hp_inter + obtain ⟨x', hx'_V, hx'_ℛ⟩ := mem_closure_iff.mp (p (t (n + 1))).2 V hV_open hp_V + have hx'_Un : x' ∈ U_n ∩ ⋃₀ ℛ := ⟨(hV_sub hx'_V).1, hx'_ℛ⟩ + have hx'_U' : x' ∈ U' ∩ ⋃₀ ℛ := ⟨(hV_sub hx'_V).2, hx'_ℛ⟩ + obtain ⟨α'_S, hα'_ZV⟩ := + joinedIn_of_isArcConnected hZV_arc + ⟨(p (t (n + 1))).2, hp_V⟩ ⟨subset_closure hx'_ℛ, hx'_V⟩ + let α' : Path (p (t (n + 1))) ⟨x', subset_closure hx'_ℛ⟩ := + pathCod α'_S (p (t (n + 1))).2 (subset_closure hx'_ℛ) fun u => (hα'_ZV u).1 + obtain ⟨r, s, hrK, hsG, hrs⟩ := hUn_join x_n hx_n x' hx'_Un + have hpiece : ∀ u, ((p.subpath (t n) (t (n + 1))) u).1 ∈ K_n := by + intro u + have : (p.subpath (t n) (t (n + 1))) u ∈ p '' uIcc (t n) (t (n + 1)) := by + rw [← Path.range_subpath] + exact mem_range_self u + obtain ⟨v, hv, hv'⟩ := this + rw [uIcc_of_le hle] at hv + rw [← hv'] + exact hUn_Kn ⟨hp_Un v hv, (p v).2⟩ + have hα_n_K : ∀ u, (α_n u).1 ∈ K_n := fun u => hUn_Kn ⟨hα_n u, (α_n u).2⟩ + have hα'_K : ∀ u, (α' u).1 ∈ K_n := fun u => hUn_Kn ⟨(hV_sub (hα'_ZV u).2).1, (hα'_ZV u).1⟩ + have h_K_hom : (α_n.symm.trans (p.subpath (t n) (t (n + 1)))).Homotopic (r.trans α'.symm) := + homotopic_of_mem hK_n_sc hK_n_Z _ _ + (hUn_Kn ⟨hx_n.1, subset_closure hx_n.2⟩) + (hUn_Kn ⟨hp_inter.1, (p (t (n + 1))).2⟩) + (sub_path_trans_mem (sub_path_symm_mem hα_n_K) hpiece) + (sub_path_trans_mem hrK (sub_path_symm_mem hα'_K)) + have h_step_hom : (p.subpath 0 (t (n + 1))).Homotopic ((q_n.trans s).trans α'.symm) := by + refine (Path.Homotopic.subpath_trans_subpath p 0 (t n) (t (n + 1))).symm.trans ?_ + refine (hhom_n.hcomp (Path.Homotopic.refl _)).trans ?_ + refine (Path.Homotopic.trans_assoc q_n α_n.symm _).trans ?_ + refine ((Path.Homotopic.refl q_n).hcomp (h_K_hom.trans (hrs.hcomp + (Path.Homotopic.refl α'.symm)))).trans ?_ + exact (Path.Homotopic.trans_assoc q_n s α'.symm).symm + exact ⟨x', hx'_U', α', q_n.trans s, + fun u => (hV_sub (hα'_ZV u).2).2, sub_path_trans_mem hq_n hsG, h_step_hom⟩ + obtain ⟨r_b, hr_b, hb_rb⟩ := hb + have hr_b_open : IsOpen r_b := region_isOpen (hℛ hr_b) + have htn₀ : t n₀ = 1 := hn₀ n₀ le_rfl + have hp_tn₀ : p (t n₀) = b := by rw [htn₀, p.target] + obtain ⟨x, hx, α, q, hα_rb, hqG, hhom⟩ := key n₀ r_b hr_b_open (hp_tn₀.symm ▸ hb_rb) + have hα_G : ∀ u, (α.symm u).1 ∈ (Γ.U \ Γ.V)ᶜ := fun u => by + change (α (σ u)).1 ∈ (Γ.U \ Γ.V)ᶜ + exact fun h => hnotU_of_mem_ℛ ⟨r_b, hr_b, hα_rb (σ u)⟩ h.1 + let q_final : Path a b := (q.trans α.symm).cast p.source.symm hp_tn₀.symm + refine ⟨q_final, ?_, fun u => ?_⟩ + · have hsub01 : (p.subpath 0 (t n₀)).cast p.source.symm hp_tn₀.symm = p := by + ext u + change ((p.subpath 0 (t n₀)) u).1 = (p u).1 + rw [htn₀, Path.subpath_zero_one] + rfl + rw [← hsub01] + exact Path.Homotopic.pathCast hhom p.source.symm hp_tn₀.symm + · change ((q.trans α.symm) u).1 ∈ (Γ.U \ Γ.V)ᶜ + exact sub_path_trans_mem hqG hα_G u + +/-- Every closed curve `φ : C(Circle, S)` in `Z = closure (⋃₀ ℛ)` on a closed surface `S` is +homotopic in `Z` (`ClosedCurvesHomotopicIn Z φ ψ`) to a `Γ`-normal closed curve `ψ : C(Circle, S)` +in `Z`. -/ +theorem exists_homotopic_normal_curve_in_closed [ConnectedSpace S] (hS : IsClosedSurface S) + (Γ : Drawing S) {ℛ : Set (Set S)} (hℛ : ℛ ⊆ Γ.R) (φ : C(Circle, S)) + (hφ : range φ ⊆ closure (⋃₀ ℛ)) : + ∃ ψ : C(Circle, S), range ψ ⊆ closure (⋃₀ ℛ) ∩ (Γ.U \ Γ.V)ᶜ ∧ + ClosedCurvesHomotopicIn (closure (⋃₀ ℛ)) φ ψ := by + have : T2Space S := hS.2.1 + set Z := closure (⋃₀ ℛ) + have hSolid : IsSolid Z := isSolid_of_nice hS isClosed_closure + (isGammaNice_closure_sUnion_regions hS Γ hℛ) + have hφ_mem : ∀ z : Circle, φ z ∈ Z := fun z => hφ (mem_range_self z) + obtain ⟨V, _, hp0_V, hV_open, hZV_arc⟩ := + hSolid.1 (φ 1) (hφ_mem 1) univ isOpen_univ (mem_univ _) + obtain ⟨x₀, hx₀_V, hx₀_ℛ⟩ := mem_closure_iff.mp (hφ_mem 1) V hV_open hp0_V + let z₀ : Z := ⟨x₀, subset_closure hx₀_ℛ⟩ + obtain ⟨α_S, hα_ZV⟩ := + joinedIn_of_isArcConnected hZV_arc ⟨hφ_mem 1, hp0_V⟩ ⟨z₀.2, hx₀_V⟩ + let α : Path (⟨φ 1, hφ_mem 1⟩ : Z) z₀ := + pathCod α_S (hφ_mem 1) z₀.2 fun u => (hα_ZV u).1 + let p₀ : Path (⟨φ 1, hφ_mem 1⟩ : Z) ⟨φ 1, hφ_mem 1⟩ := + { toFun := fun t => ⟨φ (arcParam 1 t), hφ_mem (arcParam 1 t)⟩ + continuous_toFun := Continuous.subtype_mk (φ.continuous.comp (arcParam 1).continuous) _ + source' := Subtype.ext (by simp) + target' := Subtype.ext (by simp) } + let p₁ : Path (⟨φ 1, hφ_mem 1⟩ : Z) ⟨φ 1, hφ_mem 1⟩ := p₀.trans (α.trans α.symm) + have hp₀_p₁ : p₀.Homotopic p₁ := + (Path.Homotopic.trans_refl p₀).symm.trans + ((Path.Homotopic.refl p₀).hcomp (Path.Homotopic.trans_symm α).symm) + let f₁ : C(I, S) := ⟨fun t => (p₁ t).1, continuous_subtype_val.comp p₁.continuous⟩ + have hf₁ : f₁ 0 = f₁ 1 := by simp [f₁] + let φ₁ : C(Circle, S) := loopLift 1 f₁ hf₁ + have hφ₁_mem : ∀ z : Circle, φ₁ z ∈ Z := by + intro z + obtain ⟨t, rfl⟩ := arcParam_surjective 1 z + change loopLift 1 f₁ hf₁ (arcParam 1 t) ∈ Z + rw [loopLift_apply] + exact (p₁ t).2 + have hhom₁ : ClosedCurvesHomotopicIn Z φ φ₁ := + closedCurvesHomotopicIn_of_path 1 φ φ₁ p₀ p₁ + (fun _ => rfl) + (fun t => (loopLift_apply 1 f₁ hf₁ t).symm) + hp₀_p₁ + have hz₀_range : z₀ ∈ range p₁ := by + change z₀ ∈ range (p₀.trans (α.trans α.symm)) + rw [Path.trans_range, Path.trans_range] + exact Or.inr (Or.inl ⟨1, α.target⟩) + obtain ⟨t₁, ht₁⟩ := hz₀_range + let w₁ : Circle := arcParam 1 t₁ + have hφ₁_w₁ : (⟨φ₁ w₁, hφ₁_mem w₁⟩ : Z) = z₀ := by + ext + change loopLift 1 f₁ hf₁ (arcParam 1 t₁) = x₀ + rw [loopLift_apply] + exact congrArg Subtype.val ht₁ + let p₂ : Path (⟨φ₁ w₁, hφ₁_mem w₁⟩ : Z) ⟨φ₁ w₁, hφ₁_mem w₁⟩ := + { toFun := fun t => ⟨φ₁ (arcParam w₁ t), hφ₁_mem (arcParam w₁ t)⟩ + continuous_toFun := Continuous.subtype_mk (φ₁.continuous.comp (arcParam w₁).continuous) _ + source' := Subtype.ext (by simp) + target' := Subtype.ext (by simp) } + have hw₁_ℛ : (⟨φ₁ w₁, hφ₁_mem w₁⟩ : Z).1 ∈ ⋃₀ ℛ := by + rw [hφ₁_w₁] + exact hx₀_ℛ + obtain ⟨q, hp₂_q, hq_G⟩ := exists_homotopic_normal_path_in_closed hS Γ hℛ hw₁_ℛ hw₁_ℛ p₂ + let f₂ : C(I, S) := ⟨fun t => (q t).1, continuous_subtype_val.comp q.continuous⟩ + have hf₂ : f₂ 0 = f₂ 1 := by simp [f₂] + let ψ : C(Circle, S) := loopLift w₁ f₂ hf₂ + have hhom₂ : ClosedCurvesHomotopicIn Z φ₁ ψ := + closedCurvesHomotopicIn_of_path w₁ φ₁ ψ p₂ q + (fun _ => rfl) + (fun t => (loopLift_apply w₁ f₂ hf₂ t).symm) + hp₂_q + refine ⟨ψ, ?_, GraphMinor.Surface.ClosedCurvesHomotopicIn.trans hhom₁ hhom₂⟩ + rintro _ ⟨w, rfl⟩ + obtain ⟨t, rfl⟩ := arcParam_surjective w₁ w + change loopLift w₁ f₂ hf₂ (arcParam w₁ t) ∈ Z ∩ (Γ.U \ Γ.V)ᶜ + rw [loopLift_apply] + exact ⟨(q t).2, hq_G t⟩ + +/-- Every closed curve `φ : C(Circle, S)` in `Z = closure (⋃₀ ℛ)` for a proper drawing `G` on a +connected surface `S` (`ℛ ⊆ G.R`) is homotopic in `Z` (`ClosedCurvesHomotopicIn Z φ ψ`) to a +`G`-normal closed curve `ψ : C(Circle, S)` in `Z`. -/ +theorem exists_homotopic_normal_curve_in (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) {ℛ : Set (Set S)} (hℛ : ℛ ⊆ G.R) + (φ : C(Circle, S)) (hφ : range φ ⊆ closure (⋃₀ ℛ)) : + ∃ ψ : C(Circle, S), range ψ ⊆ closure (⋃₀ ℛ) ∩ (G.U \ G.V)ᶜ ∧ + ClosedCurvesHomotopicIn (closure (⋃₀ ℛ)) φ ψ := by + obtain ⟨T, topT, j, -, Γ, hT, hT_conn, hj, -, -, -, hΓU, -, hΓV, hℛ_map⟩ := + exists_capped_drawing hS G hG + obtain ⟨ℛ_T, hℛ_T, hj_Z, -⟩ := hℛ_map ℛ hℛ + let φ_T : C(Circle, T) := ⟨j ∘ φ, hj.continuous.comp φ.continuous⟩ + have hφ_T : range φ_T ⊆ closure (⋃₀ ℛ_T) := by + rintro _ ⟨w, rfl⟩ + rw [← hj_Z] + exact ⟨φ w, hφ (mem_range_self w), rfl⟩ + obtain ⟨ψ_T, hψ_T, H_T, hH_T, hH0, hH1⟩ := + exists_homotopic_normal_curve_in_closed hT Γ hℛ_T φ_T hφ_T + have hψ_ex : ∀ w : Circle, ∃ x ∈ closure (⋃₀ ℛ), j x = ψ_T w := by + intro w + have hw : ψ_T w ∈ closure (⋃₀ ℛ_T) := (hψ_T (mem_range_self w)).1 + rwa [← hj_Z] at hw + choose ψ₀ hψ₀_Z hψ₀_eq using hψ_ex + have hψ₀_cont : Continuous ψ₀ := hj.isEmbedding.continuous_iff.mpr (by + have : j ∘ ψ₀ = ψ_T := funext hψ₀_eq + rw [this] + exact ψ_T.continuous) + let ψ : C(Circle, S) := ⟨ψ₀, hψ₀_cont⟩ + have hH_ex : ∀ p : Circle × I, ∃ x ∈ closure (⋃₀ ℛ), j x = H_T p := by + intro p + have hp : H_T p ∈ closure (⋃₀ ℛ_T) := hH_T p + rwa [← hj_Z] at hp + choose H₀ hH₀_Z hH₀_eq using hH_ex + have hH₀_cont : Continuous H₀ := hj.isEmbedding.continuous_iff.mpr (by + have : j ∘ H₀ = H_T := funext hH₀_eq + rw [this] + exact H_T.continuous) + let H : C(Circle × I, S) := ⟨H₀, hH₀_cont⟩ + refine ⟨ψ, ?_, H, hH₀_Z, ?_, ?_⟩ + · rintro _ ⟨w, rfl⟩ + refine ⟨hψ₀_Z w, ?_⟩ + rintro ⟨hwU, hwV⟩ + have hw_not_bd : ψ w ∉ bd S := fun hbd => hwV (hG ⟨hbd, hwU⟩) + have hjw_U : ψ_T w ∈ Γ.U := by + rw [← hψ₀_eq w, hΓU] + exact ⟨ψ w, Or.inl hwU, rfl⟩ + have hjw_notV : ψ_T w ∉ Γ.V := by + intro hjV + obtain ⟨y, hy, hjy⟩ := hΓV hjV + rw [← hψ₀_eq w] at hjy + rcases hj.injective hjy ▸ hy with h | h + · exact hwV h + · exact hw_not_bd h + exact (hψ_T (mem_range_self w)).2 ⟨hjw_U, hjw_notV⟩ + · intro w + exact hj.injective ((hH₀_eq (w, 0)).trans (hH0 w)) + · intro w + exact hj.injective ((hH₀_eq (w, 1)).trans ((hH1 w).trans (hψ₀_eq w).symm)) + +/-- **(5.5)** of Graph Minors VII (Section 5, page 231): +"Let $G$ be a proper graph in a connected surface $\Sigma$, and let $Z$ be the closure of the +union of some of the regions of $G$, with $Z \ne \Sigma$. Then $Z$ is planar if and only if +every $G$-normal $O$-arc included in $Z$ is null-homotopic." -/ +theorem theorem_5_5_proof (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) {ℛ : Set (Set S)} (hℛ : ℛ ⊆ G.R) + {Z : Set S} (hZ : Z = closure (⋃₀ ℛ)) (hZ_ne : Z ≠ univ) : + IsPlanar Z ↔ ∀ F : Set S, F ⊆ Z → G.IsNormal F → IsOArc F → IsNullHomotopicOArc F := by + have hZ_solid : IsSolid Z := hZ ▸ isSolid_closure_sUnion_regions hS G hG hℛ + rw [theorem_5_1_proof hS hZ_solid hZ_ne] + constructor + · intro h F hFZ _ hF + exact h F hF hFZ + · intro h F₀ hF₀ hF₀Z + by_contra hF₀_not_null + obtain ⟨e₀⟩ := hF₀ + let φ₀ : C(Circle, S) := ⟨fun z => (e₀ z).1, continuous_subtype_val.comp e₀.continuous⟩ + have hφ₀_Z : range φ₀ ⊆ closure (⋃₀ ℛ) := by + rw [← hZ] + rintro _ ⟨w, rfl⟩ + exact hF₀Z (e₀ w).2 + have hφ₀_not_null : ¬ ClosedCurveIsNullHomotopicIn univ φ₀ := fun hnull => + hF₀_not_null ⟨e₀, hnull⟩ + obtain ⟨ψ, hψ_sub, hhom_Z⟩ := exists_homotopic_normal_curve_in hS hG hℛ φ₀ hφ₀_Z + have hhom_univ : ClosedCurvesHomotopicIn univ φ₀ ψ := by + obtain ⟨H, _, hH0, hH1⟩ := hhom_Z + exact ⟨H, fun _ => mem_univ _, hH0, hH1⟩ + have hψ_not_null : ¬ ClosedCurveIsNullHomotopicIn univ ψ := fun hnull => + hφ₀_not_null (null_of_homotopic subset_rfl hhom_univ hnull) + obtain ⟨F, hF_oarc, hF_sub, hF_not_null⟩ := theorem_11_2_proof hS ψ hψ_not_null + have hFZ : F ⊆ Z := by + rw [hZ] + exact fun x hx => (hψ_sub (hF_sub hx)).1 + have hF_norm : G.IsNormal F := fun x ⟨hxF, hxU⟩ => + by_contra fun hxV => (hψ_sub (hF_sub hxF)).2 ⟨hxU, hxV⟩ + exact hF_not_null (h F hFZ hF_norm hF_oarc) + +/-! ## 3. Proof of (5.6) (page 232) -/ + +/-- Pushforward of `IsSolid` along a closed embedding `j : S → T`. -/ +theorem isSolid_image_of_isClosedEmbedding {T : Type u} [TopologicalSpace T] [T2Space T] + {j : S → T} (hj : IsClosedEmbedding j) {Z : Set S} (hZ : IsSolid Z) : + IsSolid (j '' Z) := by + refine ⟨?_, hj.isClosedMap Z hZ.2⟩ + rintro _ ⟨z, hz, rfl⟩ U_T hU_T hjz_UT + obtain ⟨V, hV_sub, hzV, hV_open, h_arc⟩ := + hZ.1 z hz (j ⁻¹' U_T) (hU_T.preimage hj.continuous) hjz_UT + obtain ⟨W_T, hW_T_open, hW_T_pre⟩ := hj.isInducing.isOpen_iff.mp hV_open + have hjz_WT : j z ∈ W_T := by + change z ∈ j ⁻¹' W_T + rwa [hW_T_pre] + refine ⟨W_T ∩ U_T, inter_subset_right, ⟨hjz_WT, hjz_UT⟩, hW_T_open.inter hU_T, ?_⟩ + rintro _ ⟨⟨a, haZ, rfl⟩, haW, haU⟩ _ ⟨⟨b, hbZ, rfl⟩, hbW, hbU⟩ hab + have haV : a ∈ Z ∩ V := ⟨haZ, hW_T_pre ▸ haW⟩ + have hbV : b ∈ Z ∩ V := ⟨hbZ, hW_T_pre ▸ hbW⟩ + obtain ⟨L, hL_sub, hL_line⟩ := h_arc a haV b hbV (fun h => hab (congrArg j h)) + refine ⟨j '' L, ?_, hL_line.map_of_embedding hj.isEmbedding⟩ + rintro _ ⟨x, hxL, rfl⟩ + obtain ⟨hxZ, hxV⟩ := hL_sub hxL + have hjx_WT : j x ∈ W_T := by + change x ∈ j ⁻¹' W_T + rwa [hW_T_pre] + exact ⟨⟨x, hxZ, rfl⟩, hjx_WT, hV_sub hxV⟩ + +/-- Pullback of `IsOArc` along an embedding `j : S → T` when `F' ⊆ range j`. -/ +theorem IsOArc.pull_of_embedding [T2Space S] {T : Type u} [TopologicalSpace T] + {j : S → T} (hj : IsEmbedding j) {F' : Set T} (hF' : IsOArc F') (hsub : F' ⊆ range j) : + IsOArc (j ⁻¹' F') := by + obtain ⟨e'⟩ := id hF' + have hex : ∀ w : Circle, ∃ x : S, j x = (e' w).1 := fun w => hsub (e' w).2 + choose f hf using hex + have hfc : Continuous f := hj.continuous_iff.mpr (by + have : j ∘ f = fun w => (e' w).1 := funext hf + rw [this] + exact continuous_subtype_val.comp e'.continuous) + let g : Circle → j ⁻¹' F' := fun w => ⟨f w, by + change j (f w) ∈ F' + rw [hf w] + exact (e' w).2⟩ + have hgc : Continuous g := Continuous.subtype_mk hfc _ + have hgbij : Function.Bijective g := by + refine ⟨fun w₁ w₂ h => ?_, fun ⟨x, hx⟩ => ?_⟩ + · have h1 : j (f w₁) = j (f w₂) := congrArg (fun u : j ⁻¹' F' => j u.1) h + rw [hf w₁, hf w₂] at h1 + exact e'.injective (Subtype.ext h1) + · obtain ⟨w, hw⟩ := e'.surjective ⟨j x, hx⟩ + refine ⟨w, Subtype.ext (hj.injective ?_)⟩ + rw [hf w] + exact congrArg Subtype.val hw + exact ⟨hgc.homeoOfEquivCompactToT2 (f := Equiv.ofBijective g hgbij)⟩ + +/-- Capped-cuff version of (5.5): if `(S', j, D)` is a capped cuff of `(S, C)` and +`Z = closure (⋃₀ ℛ)` (`ℛ ⊆ G.R`), then `j '' Z` is planar in `S'` if and only if for every +`G`-normal `O`-arc `F ⊆ Z`, `j '' F` is null-homotopic in `S'`. -/ +theorem theorem_5_5_cappedCuff (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) {ℛ : Set (Set S)} (hℛ : ℛ ⊆ G.R) + {Z : Set S} (hZ : Z = closure (⋃₀ ℛ)) + {C : Set S} {S' : Type u} [TopologicalSpace S'] {j : S → S'} {D : Set S'} + (hCap : IsCappedCuff C S' j D) : + IsPlanar (j '' Z) ↔ + ∀ F : Set S, F ⊆ Z → G.IsNormal F → IsOArc F → IsNullHomotopicOArc (j '' F) := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hS' : IsSurface S' := hCap.isSurface + have : T2Space S' := hS'.2.1 + have : ConnectedSpace S' := hCap.connectedSpace hS + have hj_closed : IsClosedEmbedding j := + hCap.isEmbedding.continuous.isClosedEmbedding hCap.isEmbedding.injective + have hZ_solid : IsSolid (j '' Z) := + isSolid_image_of_isClosedEmbedding hj_closed (hZ ▸ isSolid_closure_sUnion_regions hS G hG hℛ) + have hjZ_ne : j '' Z ≠ univ := by + intro heq + obtain ⟨w, hwD, hw_not_bd⟩ := hCap.isClosedDisc.nonempty_discInt + have hw_range : w ∈ range j := (image_subset_range j Z) (heq.symm ▸ mem_univ w) + have hw_inter : w ∈ range j ∩ D := ⟨hw_range, hwD⟩ + rw [hCap.inter_eq, ← hCap.discBd_eq] at hw_inter + exact hw_not_bd hw_inter + rw [theorem_5_1_proof hS' hZ_solid hjZ_ne] + constructor + · intro h F hFZ _ hF + exact h (j '' F) (isOArc_image hF hCap.isEmbedding.continuous.continuousOn + hCap.isEmbedding.injective.injOn) + (image_mono hFZ) + · intro h F' hF' hF'Z + by_contra hF'_not_null + obtain ⟨e₀'⟩ := hF' + have hex : ∀ w : Circle, ∃ x ∈ Z, j x = (e₀' w).1 := fun w => hF'Z (e₀' w).2 + choose φ₀_fun hφ₀_mem hφ₀_eq using hex + have hφ₀_cont : Continuous φ₀_fun := hCap.isEmbedding.continuous_iff.mpr (by + have : j ∘ φ₀_fun = fun w => (e₀' w).1 := funext hφ₀_eq + rw [this] + exact continuous_subtype_val.comp e₀'.continuous) + let φ₀ : C(Circle, S) := ⟨φ₀_fun, hφ₀_cont⟩ + have hφ₀_Z : range φ₀ ⊆ closure (⋃₀ ℛ) := by + rw [← hZ] + rintro _ ⟨w, rfl⟩ + exact hφ₀_mem w + obtain ⟨ψ, hψ_sub, hhom_Z⟩ := exists_homotopic_normal_curve_in hS hG hℛ φ₀ hφ₀_Z + let φ₀' : C(Circle, S') := ⟨fun w => (e₀' w).1, continuous_subtype_val.comp e₀'.continuous⟩ + let ψ' : C(Circle, S') := ⟨j ∘ ψ, hCap.isEmbedding.continuous.comp ψ.continuous⟩ + have hhom_S' : ClosedCurvesHomotopicIn univ φ₀' ψ' := by + obtain ⟨H, _, hH0, hH1⟩ := hhom_Z + refine ⟨⟨j ∘ H, hCap.isEmbedding.continuous.comp H.continuous⟩, fun _ => mem_univ _, ?_, ?_⟩ + · intro w; exact (congrArg j (hH0 w)).trans (hφ₀_eq w) + · intro w; exact congrArg j (hH1 w) + have hφ₀'_not_null : ¬ ClosedCurveIsNullHomotopicIn univ φ₀' := fun hnull => + hF'_not_null ⟨e₀', hnull⟩ + have hψ'_not_null : ¬ ClosedCurveIsNullHomotopicIn univ ψ' := fun hnull => + hφ₀'_not_null (null_of_homotopic subset_rfl hhom_S' hnull) + obtain ⟨F₁', hF₁'_oarc, hF₁'_sub, hF₁'_not_null⟩ := theorem_11_2_proof hS' ψ' hψ'_not_null + have hF₁'_range : F₁' ⊆ range j := by + intro y hy + obtain ⟨w, rfl⟩ := hF₁'_sub hy + exact ⟨ψ w, rfl⟩ + let F₁ : Set S := j ⁻¹' F₁' + have hF₁_oarc : IsOArc F₁ := IsOArc.pull_of_embedding hCap.isEmbedding hF₁'_oarc hF₁'_range + have hjF₁ : j '' F₁ = F₁' := image_preimage_eq_of_subset hF₁'_range + have hF₁_Z : F₁ ⊆ Z := by + rw [hZ] + intro x hx + obtain ⟨w, hw⟩ := hF₁'_sub hx + have hxw : ψ w = x := hCap.isEmbedding.injective hw + exact hxw ▸ (hψ_sub (mem_range_self w)).1 + have hF₁_norm : G.IsNormal F₁ := by + rintro x ⟨hxF₁, hxU⟩ + obtain ⟨w, hw⟩ := hF₁'_sub hxF₁ + have hxw : ψ w = x := hCap.isEmbedding.injective hw + by_contra hxV + exact (hψ_sub (mem_range_self w)).2 (hxw.symm ▸ ⟨hxU, hxV⟩) + exact hF₁'_not_null (hjF₁ ▸ h F₁ hF₁_Z hF₁_norm hF₁_oarc) + +/-- Every open subset of a surface `S` is locally arc-connected (`IsLocallyArcConnected`). -/ +theorem isLocallyArcConnected_of_isOpen (hS : IsSurface S) {Z : Set S} (hZ : IsOpen Z) : + IsLocallyArcConnected Z := by + intro x hx A hA hxA + obtain ⟨W, hW_sub, hxW, hW_open, hW_arc, _, _⟩ := + exists_chart_ball_subset hS x (hZ.inter hA) ⟨hx, hxA⟩ + exact ⟨W, hW_sub.trans inter_subset_right, hxW, hW_open, + (inter_eq_right.mpr (hW_sub.trans inter_subset_left)).symm ▸ hW_arc⟩ + +/-- Every connected open subset of a surface `S` is arc-connected (`IsArcConnected`). -/ +theorem isArcConnected_of_isOpen_of_isConnected (hS : IsSurface S) {Z : Set S} + (hZ_open : IsOpen Z) (hZ_conn : IsConnected Z) : IsArcConnected Z := + theorem_11_4_proof hS hZ_conn (isLocallyArcConnected_of_isOpen hS hZ_open) + +/-- For any proper drawing `G` on a connected surface `S`, `G.R` is finite. -/ +theorem finite_regions_of_isProper (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) : G.R.Finite := by + obtain ⟨T, topT, j, K, Γ, hT, hT_conn, hj, -, -, -, -, -, -, hℛ_map⟩ := + exists_capped_drawing hS G hG + have : T2Space S := hS.2.1 + have : T2Space T := hT.2.1 + have : LocallyConnectedSpace S := hS.locallyConnected + have hfinΓ : Γ.R.Finite := finite_R hT Γ + have hex : ∀ r : G.R, ∃ R' ∈ Γ.R, R' ⊆ j '' (r.1 \ bd S) := by + rintro ⟨r, hr⟩ + obtain ⟨ℛ_T, hℛ_T, -, hsU⟩ := hℛ_map {r} (singleton_subset_iff.mpr hr) + rw [sUnion_singleton] at hsU + obtain ⟨x₀, hx₀r⟩ := region_nonempty hr + have hx₀_cl : x₀ ∈ closure (bd S)ᶜ := mem_closure_compl_bd (hS.2.2 x₀) + obtain ⟨x, hxr, hx_bd⟩ := mem_closure_iff.mp hx₀_cl r (region_isOpen hr) hx₀r + have hjx : j x ∈ ⋃₀ ℛ_T := hsU ▸ ⟨x, ⟨hxr, hx_bd⟩, rfl⟩ + obtain ⟨R', hR'ℛ, hjxR'⟩ := mem_sUnion.mp hjx + exact ⟨R', hℛ_T hR'ℛ, (subset_sUnion_of_mem hR'ℛ).trans (le_of_eq hsU)⟩ + choose f hf_mem hf_sub using hex + have : Finite Γ.R := hfinΓ.to_subtype + have h_inj : Function.Injective (fun r : G.R => (⟨f r, hf_mem r⟩ : Γ.R)) := by + intro r₁ r₂ heq + have hfeq : f r₁ = f r₂ := congrArg Subtype.val heq + obtain ⟨y, hy⟩ := region_nonempty (hf_mem r₁) + obtain ⟨x₁, ⟨hx₁, _⟩, hjx₁⟩ := hf_sub r₁ hy + obtain ⟨x₂, ⟨hx₂, _⟩, hjx₂⟩ := hf_sub r₂ (hfeq ▸ hy) + have hxx : x₁ = x₂ := hj.injective (hjx₁.trans hjx₂.symm) + exact Subtype.ext (region_eq_of_mem r₁.2 r₂.2 hx₁ (hxx ▸ hx₂)) + exact Finite.of_injective _ h_inj + +/-- For any proper drawing `G` on a connected surface `S`, `closure (⋃₀ G.R) = univ`. -/ +theorem closure_sUnion_regions_eq_univ (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) : closure (⋃₀ G.R) = univ := by + obtain ⟨T, topT, j, K, Γ, hT, hT_conn, hj, hK, hunion, hinter, hΓU, -, -, -⟩ := + exists_capped_drawing hS G hG + have : T2Space S := hS.2.1 + have : T2Space T := hT.2.1 + apply eq_univ_of_forall + intro x + rw [mem_closure_iff] + intro O hO hxO + have hx_cl : x ∈ closure (bd S)ᶜ := mem_closure_compl_bd (hS.2.2 x) + obtain ⟨w, hwO, hw_bd⟩ := mem_closure_iff.mp hx_cl O hO hxO + obtain ⟨W_T, hW_T_open, hW_T_pre⟩ := hj.isInducing.isOpen_iff.mp hO + have hjw_WT : j w ∈ W_T ∩ Kᶜ := by + refine ⟨?_, fun hjwK => ?_⟩ + · change w ∈ j ⁻¹' W_T; rwa [hW_T_pre] + · have : j w ∈ range j ∩ K := ⟨⟨w, rfl⟩, hjwK⟩ + rw [hinter] at this + obtain ⟨w', hw'bd, hjw'⟩ := this + exact hw_bd (hj.injective hjw' ▸ hw'bd) + obtain ⟨y, ⟨hyWT, hyK⟩, hyU⟩ := + exists_notMem_U (Γ := Γ) hT (hW_T_open.inter hK.isOpen_compl) ⟨j w, hjw_WT⟩ + have hy_range : y ∈ range j := (hunion.symm ▸ mem_univ y).resolve_right hyK + obtain ⟨z, rfl⟩ := hy_range + have hzO : z ∈ O := by rw [← hW_T_pre]; exact hyWT + have hzU : z ∉ G.U := fun hzG => hyU (hΓU ▸ ⟨z, Or.inl hzG, rfl⟩) + obtain ⟨r, hr, hzr⟩ := exists_region_of_notMem hzU + exact ⟨z, hzO, mem_sUnion.mpr ⟨r, hr, hzr⟩⟩ + +/-- Every point `a ∈ closure r ∩ (G.U \ G.V)ᶜ` (`r ∈ G.R`) is joined in `r ∪ {a}` to some point +of `r`. -/ +theorem joinedIn_region_of_mem_closure (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) {r : Set S} (hr : r ∈ G.R) + {a : S} (har : a ∈ closure r) (ha_norm : a ∈ (G.U \ G.V)ᶜ) : + ∃ w ∈ r, JoinedIn (r ∪ {a}) a w := by + classical + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := hS.locallyConnected + by_cases haU : a ∈ G.U + · have haV : a ∈ G.V := by_contra fun haV => ha_norm ⟨haU, haV⟩ + obtain ⟨T, topT, j, K, Γ, hT, hT_conn, hj, -, -, -, hΓU, hGV, -, hℛ_map⟩ := + exists_capped_drawing hS G hG + have : T2Space T := hT.2.1 + have : LocallyPathConnectedSpace T := IsClosedSurface.locallyPathConnectedSpace hT + obtain ⟨ℛ_T, hℛ_T, h_cl_eq, hsU⟩ := hℛ_map {r} (singleton_subset_iff.mpr hr) + rw [sUnion_singleton] at h_cl_eq hsU + have hja_V : j a ∈ Γ.V := hGV ⟨a, haV, rfl⟩ + have hja_cl : j a ∈ closure (⋃₀ ℛ_T) := h_cl_eq ▸ ⟨a, har, rfl⟩ + have hfinℛ : ℛ_T.Finite := (finite_R hT Γ).subset hℛ_T + have hja_bi : j a ∈ ⋃ p ∈ ℛ_T, closure p := by + have heq : closure (⋃₀ ℛ_T) = ⋃ p ∈ ℛ_T, closure p := by + rw [sUnion_eq_biUnion, hfinℛ.closure_biUnion] + rwa [← heq] + obtain ⟨p, hpℛ, hjap⟩ := mem_iUnion₂.mp hja_bi + have hp : p ∈ Γ.R := hℛ_T hpℛ + have hp_sub : p ⊆ j '' r := + (subset_sUnion_of_mem hpℛ).trans ((le_of_eq hsU).trans (image_mono sdiff_subset)) + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + rcases isEmpty_or_nonempty (halfEdges Γ γ (j a)) with h0 | ⟨⟨he_pair, hhe_mem⟩⟩ + · have h2 : ¬ 2 ≤ Nat.card (halfEdges Γ γ (j a)) := by + have : Nat.card (halfEdges Γ γ (j a)) = 0 := Nat.card_eq_zero.mpr (Or.inl h0) + omega + obtain ⟨W_p, hW_p, hja_Wp, hWp_sub⟩ := exists_nbhd_of_few hT hγ hja_V h2 hp hjap + have hno : ∀ g ∈ Γ.E, j a ∉ closure g := by + intro g hg hjag + obtain ⟨b, hb⟩ := exists_end_eq hγ hg hja_V hjag + exact h0.false ⟨(g, b), hg, hb⟩ + let T_cl : Set T := (Γ.V \ {j a}) ∪ ⋃ g ∈ Γ.E, closure g + have hT_cl : IsClosed T_cl := (Γ.finite_V.subset sdiff_subset).isClosed.union + (Γ.finite_edges.isClosed_biUnion fun _ _ => isClosed_closure) + have hja_Tcl : j a ∉ T_cl := by + rintro (h | h) + · exact h.2 rfl + · obtain ⟨g, hg, hjag⟩ := mem_iUnion₂.mp h + exact hno g hg hjag + obtain ⟨D, D', hD, hD', hja_D', hD'D, hDT, -⟩ := + exists_closedDisc_nbhd hT (hW_p.inter hT_cl.isOpen_compl) ⟨hja_Wp, hja_Tcl⟩ + obtain ⟨y, hyD', hyp⟩ := mem_closure_iff.mp hjap D' hD' hja_D' + have hD_sub : D ⊆ p ∪ {j a} := by + intro u huD + by_cases hu_ja : u = j a + · exact Or.inr hu_ja + · left + have hu_cl : u ∈ closure p := hWp_sub (hDT huD).1 + have hu_notU : u ∉ Γ.U := by + intro huU + by_cases huV : u ∈ Γ.V + · exact (hDT huD).2 (Or.inl ⟨huV, hu_ja⟩) + · obtain ⟨g, hg, hug⟩ := Γ.exists_edge_of_mem huU huV + exact (hDT huD).2 (Or.inr (mem_iUnion₂.mpr ⟨g, hg, subset_closure hug⟩)) + obtain ⟨q, hq, huq⟩ := exists_region_of_notMem hu_notU + obtain ⟨z, hzq, hzp⟩ := mem_closure_iff.mp hu_cl q (region_isOpen hq) huq + exact region_eq_of_mem hq hp hzq hzp ▸ huq + obtain ⟨q_T, hq_T⟩ := + (hD.isPathConnected.joinedIn (j a) (hD'D hja_D') y (hD'D hyD')).mono hD_sub + obtain ⟨w, hwr, hjw⟩ := hp_sub hyp + have hex_q : ∀ t : I, ∃ x ∈ r ∪ {a}, j x = q_T t := by + intro t + rcases hq_T t with htp | ht_eq + · obtain ⟨x, hxr, hjx⟩ := hp_sub htp + exact ⟨x, Or.inl hxr, hjx⟩ + · exact ⟨a, Or.inr rfl, (mem_singleton_iff.mp ht_eq).symm⟩ + choose q_S hq_S_mem hq_S_eq using hex_q + have hq_S_cont : Continuous q_S := hj.isEmbedding.continuous_iff.mpr (by + have : j ∘ q_S = q_T := funext hq_S_eq + rw [this] + exact q_T.continuous) + refine ⟨w, hwr, ⟨⟨q_S, hq_S_cont⟩, ?_, ?_⟩, hq_S_mem⟩ + · exact hj.injective ((hq_S_eq 0).trans q_T.source) + · exact hj.injective ((hq_S_eq 1).trans (q_T.target.trans hjw.symm)) + · obtain ⟨g, hg_cont, hg0, hgt⟩ := exists_access hT Γ hγ hja_V ⟨he_pair, hhe_mem⟩ hp hjap + have hg1 : g 1 ∈ p := hgt 1 zero_lt_one + obtain ⟨w, hwr, hjw⟩ := hp_sub hg1 + have hex_g : ∀ t : I, ∃ x ∈ r ∪ {a}, j x = g t := by + intro t + rcases eq_or_lt_of_le (unitInterval.nonneg t) with h0 | ht_pos + · have ht0 : t = 0 := Subtype.ext h0.symm + rw [ht0, hg0] + exact ⟨a, Or.inr rfl, rfl⟩ + · obtain ⟨x, hxr, hjx⟩ := hp_sub (hgt t ht_pos) + exact ⟨x, Or.inl hxr, hjx⟩ + choose g_S hg_S_mem hg_S_eq using hex_g + have hg_S_cont : Continuous g_S := hj.isEmbedding.continuous_iff.mpr (by + have : j ∘ g_S = g := funext hg_S_eq + rw [this] + exact hg_cont) + refine ⟨w, hwr, ⟨⟨g_S, hg_S_cont⟩, ?_, ?_⟩, hg_S_mem⟩ + · exact hj.injective ((hg_S_eq 0).trans hg0) + · exact hj.injective ((hg_S_eq 1).trans hjw.symm) + · obtain ⟨r', hr', har'⟩ := exists_region_of_notMem haU + obtain ⟨z, hzr', hzr⟩ := mem_closure_iff.mp har r' (region_isOpen hr') har' + have har_mem : a ∈ r := region_eq_of_mem hr' hr hzr' hzr ▸ har' + exact ⟨a, har_mem, JoinedIn.refl (Or.inl har_mem)⟩ + +/-- Any two points `a, b ∈ closure r ∩ (G.U \ G.V)ᶜ` (`r ∈ G.R`) are joined in `r ∪ {a, b}`. -/ +theorem joinedIn_region_union_pair (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) {r : Set S} (hr : r ∈ G.R) + {a b : S} (har : a ∈ closure r) (ha_norm : a ∈ (G.U \ G.V)ᶜ) + (hbr : b ∈ closure r) (hb_norm : b ∈ (G.U \ G.V)ᶜ) : + JoinedIn (r ∪ {a, b}) a b := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := hS.locallyConnected + obtain ⟨w_a, hwa, hja⟩ := joinedIn_region_of_mem_closure hS hG hr har ha_norm + obtain ⟨w_b, hwb, hjb⟩ := joinedIn_region_of_mem_closure hS hG hr hbr hb_norm + have hr_arc : IsArcConnected r := + isArcConnected_of_isOpen_of_isConnected hS (region_isOpen hr) + ⟨region_nonempty hr, region_isPreconnected hr⟩ + have hj_mid : JoinedIn r w_a w_b := + isArcConnected_iff_joinedIn.mp hr_arc w_a hwa w_b hwb + have h1 : JoinedIn (r ∪ {a, b}) a w_a := + hja.mono (union_subset_union_right r (fun _ hx => Or.inl hx)) + have h2 : JoinedIn (r ∪ {a, b}) w_a w_b := hj_mid.mono subset_union_left + have h3 : JoinedIn (r ∪ {a, b}) w_b b := + hjb.symm.mono (union_subset_union_right r (fun _ hx => Or.inr hx)) + exact (h1.trans h2).trans h3 + +/-- Every point `x ∈ S` is joined in `(G.U \ G.V)ᶜ ∪ {x}` to a point of `⋃₀ G.R`. -/ +theorem joinedIn_regions_of_any (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) (x : S) : + ∃ w ∈ ⋃₀ G.R, JoinedIn ((G.U \ G.V)ᶜ ∪ {x}) x w := by + have : T2Space S := hS.2.1 + by_cases hx : x ∈ (G.U \ G.V)ᶜ + · have hfinR : G.R.Finite := finite_regions_of_isProper hS hG + have hx_cl : x ∈ closure (⋃₀ G.R) := (closure_sUnion_regions_eq_univ hS hG).symm ▸ mem_univ x + have hx_bi : x ∈ ⋃ r ∈ G.R, closure r := by + have heq : closure (⋃₀ G.R) = ⋃ r ∈ G.R, closure r := by + rw [sUnion_eq_biUnion, hfinR.closure_biUnion] + rwa [← heq] + obtain ⟨r, hr, hxr⟩ := mem_iUnion₂.mp hx_bi + obtain ⟨w, hwr, hjw⟩ := joinedIn_region_of_mem_closure hS hG hr hxr hx + refine ⟨w, mem_sUnion.mpr ⟨r, hr, hwr⟩, hjw.mono ?_⟩ + rintro z (hzr | hzx) + · exact Or.inl (fun h => region_subset hr hzr h.1) + · exact Or.inr hzx + · rw [mem_compl_iff, not_not] at hx + have hx_not_bd : x ∉ bd S := fun hbd => hx.2 (hG ⟨hbd, hx.1⟩) + obtain ⟨T, topT, j, K, Γ, hT, hT_conn, hj, hK, hunion, hinter, hΓU, -, hΓV, -⟩ := + exists_capped_drawing hS G hG + have : T2Space T := hT.2.1 + have hjx_U : j x ∈ Γ.U := hΓU ▸ ⟨x, Or.inl hx.1, rfl⟩ + have hjx_notV : j x ∉ Γ.V := by + intro hjV + obtain ⟨y, hy, hjy⟩ := hΓV hjV + rcases hj.injective hjy ▸ hy with h | h + · exact hx.2 h + · exact hx_not_bd h + have hjx_notK : j x ∉ K := by + intro hjK + have : j x ∈ range j ∩ K := ⟨⟨x, rfl⟩, hjK⟩ + rw [hinter] at this + obtain ⟨x', hx'bd, hjx'⟩ := this + exact hx_not_bd (hj.injective hjx' ▸ hx'bd) + obtain ⟨e, he, hjxe⟩ := Γ.exists_edge_of_mem hjx_U hjx_notV + obtain ⟨γ, hγ, hγ0, hγ1, hinj, hγe⟩ := exists_edge_param Γ he + obtain ⟨t₀, ht₀, hγt₀⟩ : j x ∈ γ '' Ioo 0 1 := hγe.symm ▸ hjxe + obtain ⟨M, a, b, g₁, g₂, _, g₄, g₅, _, g₇, g₈, g₉, g₁₀, g₁₁⟩ := + exists_edge_chart hT Γ he hγ hγ0 hγ1 hinj hγe ht₀ ht₀.1 ht₀.2 + have c : IsEdgeChart Γ γ t₀ M a b := ⟨g₁, g₂, g₄, g₅, g₇, g₈, g₉, g₁₀, g₁₁⟩ + let seg : I → ℂ := fun s => ((s : ℝ) / 2 : ℂ) * Complex.I + have hseg_ball : ∀ s : I, seg s ∈ Metric.closedBall (0 : ℂ) 1 := by + intro s + rw [Metric.mem_closedBall, dist_zero_right, norm_mul, Complex.norm_I, mul_one, + Complex.norm_div, Complex.norm_real, Complex.norm_ofNat, Real.norm_eq_abs, + abs_of_nonneg (unitInterval.nonneg s)] + linarith [unitInterval.le_one s] + have hseg_cont : Continuous fun s : I => M (seg s) := + c.cont.comp_continuous (by fun_prop) hseg_ball + have hseg_zero : M (seg 0) = j x := by + change M (((0 : ℝ) / 2 : ℂ) * Complex.I) = j x + simp [c.zero, hγt₀] + have hseg_pos : ∀ s : I, (0 : I) < s → M (seg s) ∈ M '' IsEdgeChart.upper := by + intro s hs + have hs' : (0 : ℝ) < (s : ℝ) := hs + refine ⟨seg s, ⟨hseg_ball s, ?_⟩, rfl⟩ + have him : (seg s).im = (s : ℝ) / 2 := by + simp [seg, Complex.mul_im, Complex.I_re, Complex.I_im, Complex.div_ofNat_re, + Complex.ofReal_re] + linarith [him, hs'] + obtain ⟨u₀, hu₀_pos, _, hu₀_notK⟩ := + exists_pos_le hseg_cont hK.isOpen_compl (hseg_zero.symm ▸ hjx_notK) (zero_lt_one' I) + let m : I → I := fun t => ⟨(t : ℝ) * (u₀ : ℝ), mul_nonneg t.2.1 u₀.2.1, + by nlinarith [t.2.1, t.2.2, u₀.2.1, u₀.2.2]⟩ + have hm_cont : Continuous m := Continuous.subtype_mk (by fun_prop) _ + have hm_le : ∀ t : I, m t ≤ u₀ := fun t => by + change (t : ℝ) * (u₀ : ℝ) ≤ (u₀ : ℝ) + nlinarith [t.2.2, u₀.2.1] + have hex_q : ∀ t : I, ∃ z ∈ (G.U \ G.V)ᶜ ∪ {x}, j z = M (seg (m t)) := by + intro t + rcases eq_or_lt_of_le (unitInterval.nonneg t) with h0 | ht_pos + · have ht0 : t = 0 := Subtype.ext h0.symm + have hm0 : m t = 0 := Subtype.ext (by simp [m, ht0]) + rw [hm0, hseg_zero] + exact ⟨x, Or.inr rfl, rfl⟩ + · have hmt_pos : (0 : I) < m t := by + change (0 : ℝ) < (t : ℝ) * (u₀ : ℝ) + exact mul_pos ht_pos hu₀_pos + have h_notK : M (seg (m t)) ∈ Kᶜ := hu₀_notK (m t) (hm_le t) + have h_range : M (seg (m t)) ∈ range j := + (hunion.symm ▸ mem_univ _).resolve_right h_notK + obtain ⟨z, hjz⟩ := h_range + have hz_notU : z ∉ G.U := fun hzU => + disjoint_left.mp c.upper_disjoint (hseg_pos (m t) hmt_pos) + (hΓU ▸ ⟨z, Or.inl hzU, hjz⟩) + exact ⟨z, Or.inl (fun h => hz_notU h.1), hjz⟩ + choose q_S hq_S_mem hq_S_eq using hex_q + have hq_S_cont : Continuous q_S := hj.isEmbedding.continuous_iff.mpr (by + have : j ∘ q_S = fun t => M (seg (m t)) := funext hq_S_eq + rw [this] + exact hseg_cont.comp hm_cont) + have hq1_notU : q_S 1 ∉ G.U := by + intro hU + have hm1 : m 1 = u₀ := Subtype.ext (by simp [m]) + exact disjoint_left.mp c.upper_disjoint + (hm1 ▸ hseg_pos u₀ hu₀_pos) + (hΓU ▸ ⟨q_S 1, Or.inl hU, hq_S_eq 1⟩) + obtain ⟨r, hr, hq1r⟩ := exists_region_of_notMem hq1_notU + refine ⟨q_S 1, mem_sUnion.mpr ⟨r, hr, hq1r⟩, ⟨⟨q_S, hq_S_cont⟩, ?_, rfl⟩, hq_S_mem⟩ + have hm0 : m 0 = 0 := Subtype.ext (by simp [m]) + exact hj.injective ((hq_S_eq 0).trans (hm0.symm ▸ hseg_zero)) + +/-- Any two points `w₁, w₂ ∈ ⋃₀ G.R` are joined in `(G.U \ G.V)ᶜ`. -/ +theorem joinedIn_normal_of_mem_regions (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) {w₁ w₂ : S} + (hw₁ : w₁ ∈ ⋃₀ G.R) (hw₂ : w₂ ∈ ⋃₀ G.R) : + JoinedIn (G.U \ G.V)ᶜ w₁ w₂ := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := hS.locallyConnected + obtain ⟨r₁, hr₁, hw₁r₁⟩ := mem_sUnion.mp hw₁ + obtain ⟨r₂, hr₂, hw₂r₂⟩ := mem_sUnion.mp hw₂ + obtain ⟨w₁', hw₁'r₁, hw₁'_bd⟩ := + mem_closure_iff.mp (mem_closure_compl_bd (hS.2.2 w₁)) r₁ (region_isOpen hr₁) hw₁r₁ + obtain ⟨w₂', hw₂'r₂, hw₂'_bd⟩ := + mem_closure_iff.mp (mem_closure_compl_bd (hS.2.2 w₂)) r₂ (region_isOpen hr₂) hw₂r₂ + have hj₁ : JoinedIn (G.U \ G.V)ᶜ w₁ w₁' := by + have hr₁_arc := isArcConnected_of_isOpen_of_isConnected hS (region_isOpen hr₁) + ⟨region_nonempty hr₁, region_isPreconnected hr₁⟩ + exact (isArcConnected_iff_joinedIn.mp hr₁_arc w₁ hw₁r₁ w₁' hw₁'r₁).mono + fun z hz h => region_subset hr₁ hz h.1 + have hj₂ : JoinedIn (G.U \ G.V)ᶜ w₂' w₂ := by + have hr₂_arc := isArcConnected_of_isOpen_of_isConnected hS (region_isOpen hr₂) + ⟨region_nonempty hr₂, region_isPreconnected hr₂⟩ + exact (isArcConnected_iff_joinedIn.mp hr₂_arc w₂' hw₂'r₂ w₂ hw₂r₂).mono + fun z hz h => region_subset hr₂ hz h.1 + obtain ⟨T, topT, j, K, Γ, hT, hT_conn, hj, -, -, -, hΓU, -, hΓV, hℛ_map⟩ := + exists_capped_drawing hS G hG + have : T2Space T := hT.2.1 + obtain ⟨ℛ_T, hℛ_T, h_cl_eq, hsU⟩ := hℛ_map G.R Subset.rfl + have hcl_S : closure (⋃₀ G.R) = univ := closure_sUnion_regions_eq_univ hS hG + have hS_arc : IsArcConnected (univ : Set S) := + isArcConnected_of_isOpen_of_isConnected hS isOpen_univ isConnected_univ + obtain ⟨p_S, _⟩ := isArcConnected_iff_joinedIn.mp hS_arc w₁' (mem_univ _) w₂' (mem_univ _) + have h_in_cl : ∀ z : S, j z ∈ closure (⋃₀ ℛ_T) := fun z => by + rw [← h_cl_eq, hcl_S] + exact ⟨z, mem_univ z, rfl⟩ + let a_T : closure (⋃₀ ℛ_T) := ⟨j w₁', h_in_cl w₁'⟩ + let b_T : closure (⋃₀ ℛ_T) := ⟨j w₂', h_in_cl w₂'⟩ + have ha_T : a_T.1 ∈ ⋃₀ ℛ_T := by + change j w₁' ∈ ⋃₀ ℛ_T + rw [hsU] + exact ⟨w₁', ⟨mem_sUnion.mpr ⟨r₁, hr₁, hw₁'r₁⟩, hw₁'_bd⟩, rfl⟩ + have hb_T : b_T.1 ∈ ⋃₀ ℛ_T := by + change j w₂' ∈ ⋃₀ ℛ_T + rw [hsU] + exact ⟨w₂', ⟨mem_sUnion.mpr ⟨r₂, hr₂, hw₂'r₂⟩, hw₂'_bd⟩, rfl⟩ + let p_T : Path a_T b_T := + { toFun := fun t => ⟨j (p_S t), h_in_cl (p_S t)⟩ + continuous_toFun := Continuous.subtype_mk (hj.continuous.comp p_S.continuous) _ + source' := Subtype.ext (congrArg j p_S.source) + target' := Subtype.ext (congrArg j p_S.target) } + obtain ⟨q_T, -, hq_T_norm⟩ := exists_homotopic_normal_path_in_closed hT Γ hℛ_T ha_T hb_T p_T + have hex_q : ∀ t : I, ∃ z ∈ (G.U \ G.V)ᶜ, j z = (q_T t).1 := by + intro t + have ht_cl : (q_T t).1 ∈ j '' closure (⋃₀ G.R) := h_cl_eq.symm ▸ (q_T t).2 + obtain ⟨z, _, hjz⟩ := ht_cl + refine ⟨z, ?_, hjz⟩ + rintro ⟨hzU, hzV⟩ + have hz_not_bd : z ∉ bd S := fun hbd => hzV (hG ⟨hbd, hzU⟩) + have hjz_U : (q_T t).1 ∈ Γ.U := hjz ▸ hΓU ▸ ⟨z, Or.inl hzU, rfl⟩ + have hjz_notV : (q_T t).1 ∉ Γ.V := by + intro hjV + obtain ⟨y, hy, hjy⟩ := hΓV (hjz ▸ hjV) + rcases hj.injective hjy ▸ hy with h | h + · exact hzV h + · exact hz_not_bd h + exact hq_T_norm t ⟨hjz_U, hjz_notV⟩ + choose q_S hq_S_mem hq_S_eq using hex_q + have hq_S_cont : Continuous q_S := hj.isEmbedding.continuous_iff.mpr (by + have : j ∘ q_S = fun t => (q_T t).1 := funext hq_S_eq + rw [this] + exact continuous_subtype_val.comp q_T.continuous) + have hj_mid : JoinedIn (G.U \ G.V)ᶜ w₁' w₂' := by + refine ⟨⟨⟨q_S, hq_S_cont⟩, ?_, ?_⟩, hq_S_mem⟩ + · exact hj.injective ((hq_S_eq 0).trans (congrArg Subtype.val q_T.source)) + · exact hj.injective ((hq_S_eq 1).trans (congrArg Subtype.val q_T.target)) + exact (hj₁.trans hj_mid).trans hj₂ + +/-- For any two distinct points `x, y ∈ S` on a connected surface `S` with a proper drawing `G`, +there is a `[0, 1]`-arc `X` with ends `x, y` such that `(G.U ∩ X).Finite` (and in fact +`G.U ∩ X ⊆ G.V ∪ {x, y}`). -/ +theorem exists_lineWithEnds_finite_inter_U (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) {x y : S} (hxy : x ≠ y) : + ∃ X : Set S, IsLineWithEnds X x y ∧ G.U ∩ X ⊆ G.V ∪ {x, y} ∧ (G.U ∩ X).Finite := by + have : T2Space S := hS.2.1 + obtain ⟨w_x, hwx, hjx⟩ := joinedIn_regions_of_any hS hG x + obtain ⟨w_y, hwy, hjy⟩ := joinedIn_regions_of_any hS hG y + have hj_mid := joinedIn_normal_of_mem_regions hS hG hwx hwy + have h1 : JoinedIn ((G.U \ G.V)ᶜ ∪ {x, y}) x w_x := + hjx.mono (union_subset_union_right _ (by intro z hz; exact Or.inl hz)) + have h2 : JoinedIn ((G.U \ G.V)ᶜ ∪ {x, y}) w_x w_y := hj_mid.mono subset_union_left + have h3 : JoinedIn ((G.U \ G.V)ᶜ ∪ {x, y}) w_y y := + hjy.symm.mono (union_subset_union_right _ (fun _ hz => Or.inr (mem_singleton_iff.mpr hz))) + have hj_xy := (h1.trans h2).trans h3 + obtain ⟨X, hX_sub, hX_line⟩ := + ((joinedIn_iff_eq_or_exists_isLineWithEnds (Z := (G.U \ G.V)ᶜ ∪ {x, y}) + (Or.inr (Or.inl rfl)) (Or.inr (Or.inr rfl))).mp hj_xy).resolve_left hxy + have hUX : G.U ∩ X ⊆ G.V ∪ {x, y} := by + rintro z ⟨hzU, hzX⟩ + rcases hX_sub hzX with hz_norm | hz_xy + · exact Or.inl (by_contra fun hzV => hz_norm ⟨hzU, hzV⟩) + · exact Or.inr hz_xy + exact ⟨X, hX_line, hUX, (G.finite_V.union ((finite_singleton y).insert x)).subset hUX⟩ + +/-- Any `[0, 1]`-arc `X` with ends `x, y` and `(G.U ∩ X).Finite` bounds `distPoint G x y`. -/ +theorem distPoint_le_of_lineWithEnds {G : Drawing S} {X : Set S} {x y : S} + (hX : IsLineWithEnds X x y) (hfin : (G.U ∩ X).Finite) : + distPoint G x y ≤ (G.U ∩ X).ncard := by + have hxy : x ≠ y := hX.ne' + simp only [distPoint, hxy, ↓reduceIte] + exact Nat.sInf_le ⟨X, hX, hfin, rfl⟩ + +/-- For distinct points `x, y ∈ S`, `distPoint G x y` is attained by a `[0, 1]`-arc `X`. -/ +theorem distPoint_exists_arc (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) {x y : S} (hxy : x ≠ y) : + ∃ X : Set S, IsLineWithEnds X x y ∧ (G.U ∩ X).Finite ∧ (G.U ∩ X).ncard = distPoint G x y := by + obtain ⟨X₀, hX₀, _, hfin₀⟩ := exists_lineWithEnds_finite_inter_U hS hG hxy + have hne : {n : ℕ | ∃ X : Set S, IsLineWithEnds X x y ∧ (G.U ∩ X).Finite ∧ (G.U ∩ X).ncard + = n}.Nonempty := + ⟨(G.U ∩ X₀).ncard, X₀, hX₀, hfin₀, rfl⟩ + obtain ⟨X, hX, hfin, hcard⟩ := Nat.sInf_mem hne + refine ⟨X, hX, hfin, ?_⟩ + simp only [distPoint, hxy, ↓reduceIte, hcard] + +/-- If a region `r ∈ G.R` meets `nearSet G t A`, then `r ⊆ nearSet G t A`. -/ +theorem region_subset_nearSet_of_mem (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) {r A : Set S} {t : ℕ} + (hr : r ∈ G.R) {x : S} (hxr : x ∈ r) (hxA : x ∈ nearSet G t A) : + r ⊆ nearSet G t A := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := hS.locallyConnected + intro x' hx'r + obtain ⟨y, hyA, hxy_le⟩ := hxA + refine ⟨y, hyA, ?_⟩ + by_cases hx'y : x' = y + · subst hx'y + have hx'_notU : x' ∉ G.U := region_subset hr hx'r + simp [distPoint, hx'_notU] + · have hr_arc : IsArcConnected r := + isArcConnected_of_isOpen_of_isConnected hS (region_isOpen hr) + ⟨region_nonempty hr, region_isPreconnected hr⟩ + by_cases hxy : x = y + · subst hxy + obtain ⟨L, hLr, hL_line⟩ := hr_arc x' hx'r x hxr hx'y + have hUL_empty : G.U ∩ L = ∅ := eq_empty_iff_forall_notMem.mpr + fun z ⟨hzU, hzL⟩ => region_subset hr (hLr hzL) hzU + have hle := distPoint_le_of_lineWithEnds (G := G) hL_line (by simp [hUL_empty]) + simp only [hUL_empty, ncard_empty, Nat.le_zero] at hle + exact hle ▸ Nat.zero_le t + · obtain ⟨X, hX_line, hX_fin, hX_card⟩ := distPoint_exists_arc hS hG hxy + have hj_r : JoinedIn r x' x := isArcConnected_iff_joinedIn.mp hr_arc x' hx'r x hxr + have hj_X : JoinedIn X x y := + (joinedIn_iff_eq_or_exists_isLineWithEnds (Z := X) hX_line.left_mem hX_line.right_mem).mpr + (Or.inr ⟨X, Subset.rfl, hX_line⟩) + have hj_union : JoinedIn (r ∪ X) x' y := + (hj_r.mono subset_union_left).trans (hj_X.mono subset_union_right) + obtain ⟨X', hX'_sub, hX'_line⟩ := + ((joinedIn_iff_eq_or_exists_isLineWithEnds (Z := r ∪ X) + (Or.inl hx'r) (Or.inr hX_line.right_mem)).mp hj_union).resolve_left hx'y + have hUX'_sub : G.U ∩ X' ⊆ G.U ∩ X := by + rintro z ⟨hzU, hzX'⟩ + rcases hX'_sub hzX' with hzr | hzX + · exact False.elim (region_subset hr hzr hzU) + · exact ⟨hzU, hzX⟩ + have hX'_fin : (G.U ∩ X').Finite := hX_fin.subset hUX'_sub + calc distPoint G x' y + _ ≤ (G.U ∩ X').ncard := distPoint_le_of_lineWithEnds hX'_line hX'_fin + _ ≤ (G.U ∩ X).ncard := ncard_le_ncard hUX'_sub hX_fin + _ = distPoint G x y := hX_card + _ ≤ t := hxy_le + +/-- For any `G`-normal subset `F₀ ⊆ S`, `closure (nearSet G t F₀)` is the closure of the union of +the regions of `G` contained in `nearSet G t F₀`. -/ +theorem closure_nearSet_eq_closure_sUnion_regions (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) {F₀ : Set S} (hF₀_norm : G.IsNormal F₀) (t : ℕ) : + closure (nearSet G t F₀) = closure (⋃₀ {r ∈ G.R | r ⊆ nearSet G t F₀}) := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := hS.locallyConnected + apply Subset.antisymm + · refine closure_minimal (fun x hx => ?_) isClosed_closure + obtain ⟨y, hyF₀, hxy_le⟩ := hx + by_cases hxy : x = y + · subst hxy + have hfinR : G.R.Finite := finite_regions_of_isProper hS hG + have hx_cl : x ∈ closure (⋃₀ G.R) := (closure_sUnion_regions_eq_univ hS hG).symm ▸ mem_univ x + have hx_bi : x ∈ ⋃ r ∈ G.R, closure r := by + have heq : closure (⋃₀ G.R) = ⋃ r ∈ G.R, closure r := by + rw [sUnion_eq_biUnion, hfinR.closure_biUnion] + rwa [← heq] + obtain ⟨r, hr, hxr⟩ := mem_iUnion₂.mp hx_bi + have hx_norm : x ∈ (G.U \ G.V)ᶜ := fun ⟨hxU, hxV⟩ => hxV (hF₀_norm ⟨hyF₀, hxU⟩) + obtain ⟨x₀, hx₀r⟩ := region_nonempty hr + have hr_sub : r ⊆ nearSet G t F₀ := by + by_cases hx₀x : x₀ = x + · subst hx₀x + exact region_subset_nearSet_of_mem hS hG hr hx₀r ⟨x₀, hyF₀, hxy_le⟩ + · have hj := joinedIn_region_union_pair hS hG hr (subset_closure hx₀r) + (fun h => region_subset hr hx₀r h.1) hxr hx_norm + obtain ⟨L, hL_sub, hL_line⟩ := + ((joinedIn_iff_eq_or_exists_isLineWithEnds (Z := r ∪ {x₀, x}) + (Or.inl hx₀r) (Or.inr (Or.inr rfl))).mp hj).resolve_left hx₀x + have hUL_sub : G.U ∩ L ⊆ G.U ∩ {x} := by + rintro z ⟨hzU, hzL⟩ + rcases hL_sub hzL with hzr | (rfl | hz_x) + · exact False.elim (region_subset hr hzr hzU) + · exact False.elim (region_subset hr hx₀r hzU) + · exact ⟨hzU, hz_x⟩ + have hUL_fin : (G.U ∩ L).Finite := ((finite_singleton x).inter_of_right G.U).subset + hUL_sub + have hx₀_near : x₀ ∈ nearSet G t F₀ := by + refine ⟨x, hyF₀, ?_⟩ + calc distPoint G x₀ x + _ ≤ (G.U ∩ L).ncard := distPoint_le_of_lineWithEnds hL_line hUL_fin + _ ≤ (G.U ∩ {x}).ncard := ncard_le_ncard hUL_sub ((finite_singleton x).inter_of_right + G.U) + _ = distPoint G x x := by + by_cases hxU : x ∈ G.U + · have heq : G.U ∩ {x} = {x} := inter_eq_right.mpr (singleton_subset_iff.mpr hxU) + simp [distPoint, hxU] + · have heq : G.U ∩ {x} = ∅ := eq_empty_iff_forall_notMem.mpr + fun z ⟨hzU, hzx⟩ => hxU (mem_singleton_iff.mp hzx ▸ hzU) + simp [distPoint, hxU, heq] + _ ≤ t := hxy_le + exact region_subset_nearSet_of_mem hS hG hr hx₀r hx₀_near + have hr_mem : r ∈ {r ∈ G.R | r ⊆ nearSet G t F₀} := ⟨hr, hr_sub⟩ + exact closure_mono (subset_sUnion_of_mem hr_mem) hxr + · obtain ⟨X, hX_line, hX_fin, hX_card⟩ := distPoint_exists_arc hS hG hxy + obtain ⟨e, he0, he1⟩ := id hX_line + let g : I → S := fun s => (e s).1 + have hgc : Continuous g := continuous_subtype_val.comp e.continuous + have hgi : Function.Injective g := Subtype.val_injective.comp e.injective + have hg0 : g 0 = x := he0 + have hg1 : g 1 = y := he1 + have hfin_sdiff : ((G.U ∩ X) \ {x}).Finite := hX_fin.subset sdiff_subset + have h_open : IsOpen (((G.U ∩ X) \ {x})ᶜ) := hfin_sdiff.isClosed.isOpen_compl + have hx_mem_open : g 0 ∈ ((G.U ∩ X) \ {x})ᶜ := by + rw [hg0] + exact fun h => h.2 rfl + obtain ⟨u₀, hu₀_pos, _, hu₀_mem⟩ := + exists_pos_le hgc h_open hx_mem_open (zero_lt_one' I) + have h_disj_U : ∀ s ∈ Ioc (0 : I) u₀, g s ∉ G.U := by + intro s ⟨hs_pos, hs_le⟩ hsU + have hs_ne0 : s ≠ 0 := ne_of_gt hs_pos + have hgs_ne_x : g s ≠ x := fun h => hs_ne0 (hgi (h.trans hg0.symm)) + exact hu₀_mem s hs_le ⟨⟨hsU, (e s).2⟩, hgs_ne_x⟩ + have hgu₀_notU : g u₀ ∉ G.U := h_disj_U u₀ ⟨hu₀_pos, le_rfl⟩ + obtain ⟨r, hr, hgu₀_r⟩ := exists_region_of_notMem hgu₀_notU + have hIoc_conn : IsPreconnected (g '' Ioc 0 u₀) := + (isPreconnected_Ioc (a := (0 : I)) (b := u₀)).image g hgc.continuousOn + have hIoc_disj : Disjoint (g '' Ioc 0 u₀) G.U := + disjoint_left.mpr (by rintro _ ⟨s, hs, rfl⟩; exact h_disj_U s hs) + have hIoc_sub_r : g '' Ioc 0 u₀ ⊆ r := + subset_region hr hIoc_conn hIoc_disj ⟨u₀, ⟨hu₀_pos, le_rfl⟩, rfl⟩ hgu₀_r + have hxr : x ∈ closure r := by + have h0_cl : (0 : I) ∈ closure (Ioc (0 : I) u₀) := by + rw [closure_Ioc (ne_of_lt hu₀_pos)] + exact ⟨le_rfl, hu₀_pos.le⟩ + have hgx := image_closure_subset_closure_image hgc ⟨0, h0_cl, hg0⟩ + exact closure_mono hIoc_sub_r hgx + have hgu₀_near : g u₀ ∈ nearSet G t F₀ := by + refine ⟨y, hyF₀, ?_⟩ + rcases eq_or_lt_of_le (unitInterval.le_one u₀) with hu₀1 | hu₀_lt1 + · have hu₀_eq1 : u₀ = 1 := Subtype.ext hu₀1 + rw [hu₀_eq1, hg1] at hgu₀_notU ⊢ + simp [distPoint, hgu₀_notU] + · have hL_sub : g '' Icc u₀ 1 ⊆ X := by + rintro _ ⟨s, _, rfl⟩ + exact (e s).2 + have hL_line : IsLineWithEnds (g '' Icc u₀ 1) (g u₀) y := + hg1 ▸ isLine_piece hgc hgi hu₀_lt1 + have hUL_sub : G.U ∩ (g '' Icc u₀ 1) ⊆ G.U ∩ X := inter_subset_inter_right G.U hL_sub + have hUL_fin : (G.U ∩ (g '' Icc u₀ 1)).Finite := hX_fin.subset hUL_sub + calc distPoint G (g u₀) y + _ ≤ (G.U ∩ (g '' Icc u₀ 1)).ncard := distPoint_le_of_lineWithEnds hL_line hUL_fin + _ ≤ (G.U ∩ X).ncard := ncard_le_ncard hUL_sub hX_fin + _ = distPoint G x y := hX_card + _ ≤ t := hxy_le + have hr_sub : r ⊆ nearSet G t F₀ := + region_subset_nearSet_of_mem hS hG hr hgu₀_r hgu₀_near + have hr_mem : r ∈ {r ∈ G.R | r ⊆ nearSet G t F₀} := ⟨hr, hr_sub⟩ + exact closure_mono (subset_sUnion_of_mem hr_mem) hxr + · exact closure_mono (sUnion_subset fun _ hr => hr.2) + +/-- For a proper drawing `G` on a connected surface `S`, if an edge `e ∈ G.E` meets `closure r` for +a region `r ∈ G.R`, then `closure e ⊆ closure r`. -/ +theorem edge_closure_subset_closure_region (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) {e r : Set S} (he : e ∈ G.E) (hr : r ∈ G.R) + {z : S} (hze : z ∈ e) (hzr : z ∈ closure r) : + closure e ⊆ closure r := by + obtain ⟨T, topT, j, K, Γ, hT, hT_conn, hj, -, -, -, hΓU, -, hΓV, hℛ_map⟩ := + exists_capped_drawing hS G hG + have : T2Space T := hT.2.1 + obtain ⟨ℛ_T, hℛ_T, h_cl_eq, -⟩ := hℛ_map {r} (singleton_subset_iff.mpr hr) + rw [sUnion_singleton] at h_cl_eq + have hnice := isGammaNice_closure_sUnion_regions hT Γ hℛ_T + have hjx_UV : ∀ x ∈ e, j x ∈ Γ.U ∧ j x ∉ Γ.V := by + intro x hxe + have hxU : x ∈ G.U := (he.2.1 hxe).1 + have hxV : x ∉ G.V := (he.2.1 hxe).2 + have hx_not_bd : x ∉ bd S := fun hbd => hxV (hG ⟨hbd, hxU⟩) + refine ⟨hΓU ▸ ⟨x, Or.inl hxU, rfl⟩, fun hjV => ?_⟩ + obtain ⟨y, hy, hjy⟩ := hΓV hjV + rcases hj.injective hjy ▸ hy with h | h + · exact hxV h + · exact hx_not_bd h + obtain ⟨e_T, he_T, hjz_eT⟩ := Γ.exists_edge_of_mem (hjx_UV z hze).1 (hjx_UV z hze).2 + have he_T_sub : e_T ⊆ closure (⋃₀ ℛ_T) := + nice_edge hnice he_T ⟨j z, hjz_eT, h_cl_eq ▸ ⟨z, hzr, rfl⟩⟩ + have he_sub : e ⊆ closure r := by + by_contra hnot + obtain ⟨w, hwe, hwr⟩ := not_subset.mp hnot + let O₁ : Set S := j ⁻¹' (Γ.U \ e_T)ᶜ + have hO₁ : IsOpen O₁ := (isClosed_U_sdiff_edge Γ he_T).isOpen_compl.preimage hj.continuous + have hO₂' : IsOpen (j ⁻¹' (closure e_T)ᶜ) := + isClosed_closure.isOpen_compl.preimage hj.continuous + have hcov : e ⊆ O₁ ∪ j ⁻¹' (closure e_T)ᶜ := by + intro x hxe + by_cases hjx : j x ∈ e_T + · exact Or.inl fun h => h.2 hjx + · refine Or.inr fun hjx_cl => ?_ + have hjx_in : j x ∈ closure e_T \ Γ.V := ⟨hjx_cl, (hjx_UV x hxe).2⟩ + rw [Γ.closure_diff_V he_T] at hjx_in + exact hjx hjx_in + have hz_O₁ : z ∈ e ∩ O₁ := ⟨hze, fun h => h.2 hjz_eT⟩ + have hw_O₂ : w ∈ e ∩ j ⁻¹' (closure e_T)ᶜ := by + refine ⟨hwe, fun hjw_cl => hwr ?_⟩ + have hjw_r : j w ∈ j '' closure r := + h_cl_eq.symm ▸ closure_minimal he_T_sub isClosed_closure hjw_cl + obtain ⟨w', hw', hjw'⟩ := hjw_r + exact hj.injective hjw' ▸ hw' + obtain ⟨x, hxe, hxO₁, hxO₂⟩ := + he.2.2.1.isConnected.isPreconnected O₁ (j ⁻¹' (closure e_T)ᶜ) hO₁ hO₂' hcov ⟨z, hz_O₁⟩ ⟨w, + hw_O₂⟩ + have hjx_eT : j x ∈ e_T := by_contra fun h => hxO₁ ⟨(hjx_UV x hxe).1, h⟩ + exact hxO₂ (subset_closure hjx_eT) + exact closure_minimal he_sub isClosed_closure + +/-- If `z ∈ G.U ∩ closure r₁ ∩ closure r₂` for regions `r₁, r₂ ∈ G.R` of a proper drawing `G`, +then there is a vertex `v ∈ G.V ∩ closure r₁ ∩ closure r₂`. -/ +theorem exists_vertex_in_closure_regions (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) {r₁ r₂ : Set S} (hr₁ : r₁ ∈ G.R) (hr₂ : r₂ ∈ G.R) + {z : S} (hzU : z ∈ G.U) (hz₁ : z ∈ closure r₁) (hz₂ : z ∈ closure r₂) : + ∃ v ∈ G.V, v ∈ closure r₁ ∧ v ∈ closure r₂ := by + have : T2Space S := hS.2.1 + by_cases hzV : z ∈ G.V + · exact ⟨z, hzV, hz₁, hz₂⟩ + · obtain ⟨e, he, hze⟩ := G.exists_edge_of_mem hzU hzV + obtain ⟨γ, hγ, hγ0, -, -, hγe⟩ := exists_edge_param G he + have he_cl₁ := edge_closure_subset_closure_region hS hG he hr₁ hze hz₁ + have he_cl₂ := edge_closure_subset_closure_region hS hG he hr₂ hze hz₂ + have h0_cl : γ 0 ∈ closure e := by + rw [← hγe] + have h0 : (0 : I) ∈ closure (Ioo (0 : I) 1) := by + rw [closure_Ioo zero_ne_one] + exact ⟨le_rfl, zero_le_one⟩ + exact image_closure_subset_closure_image hγ ⟨0, h0, rfl⟩ + exact ⟨γ 0, hγ0, he_cl₁ h0_cl, he_cl₂ h0_cl⟩ + +/-- Auxiliary induction for `exists_normal_arc_of_lineWithEnds`: for any `[0, 1]`-arc `X` with ends +`a, b ∈ (G.U \ G.V)ᶜ` and `(G.U ∩ X).Finite`, there is a finite subset `W ⊆ G.V` of cardinality at +most `(G.U ∩ (X \ {a, b})).ncard` such that `JoinedIn (G.Uᶜ ∪ W ∪ {a, b}) a b`. -/ +theorem exists_joinedIn_normal_of_lineWithEnds (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) : + ∀ m : ℕ, ∀ {a b : S} {X : Set S}, + a ∈ (G.U \ G.V)ᶜ → b ∈ (G.U \ G.V)ᶜ → + IsLineWithEnds X a b → (G.U ∩ X).Finite → (G.U ∩ (X \ {a, b})).ncard ≤ m → + ∃ W ⊆ G.V, W.Finite ∧ W.ncard ≤ m ∧ JoinedIn (G.Uᶜ ∪ W ∪ {a, b}) a b := by + have : T2Space S := hS.2.1 + intro m + induction m with + | zero => + intro a b X _ _ hX hX_fin hm + have hfin_int : (G.U ∩ (X \ {a, b})).Finite := + hX_fin.subset (inter_subset_inter_right _ sdiff_subset) + have hempty : G.U ∩ (X \ {a, b}) = ∅ := + (ncard_eq_zero hfin_int).mp (Nat.eq_zero_of_le_zero hm) + refine ⟨∅, empty_subset _, finite_empty, by simp, ?_⟩ + have hjX : JoinedIn X a b := + (joinedIn_iff_eq_or_exists_isLineWithEnds (Z := X) hX.left_mem hX.right_mem).mpr + (Or.inr ⟨X, Subset.rfl, hX⟩) + refine hjX.mono fun z hzX => ?_ + by_cases hz_ab : z ∈ ({a, b} : Set S) + · exact Or.inr hz_ab + · refine Or.inl (Or.inl fun hzU => ?_) + have : z ∈ G.U ∩ (X \ {a, b}) := ⟨hzU, hzX, hz_ab⟩ + rw [hempty] at this + exact this + | succ m ih => + intro a b X ha hb hX hX_fin hm + have hfin_int : (G.U ∩ (X \ {a, b})).Finite := + hX_fin.subset (inter_subset_inter_right _ sdiff_subset) + rcases le_or_gt (G.U ∩ (X \ {a, b})).ncard m with hle | hgt + · obtain ⟨W, hWV, hWfin, hWcard, hj⟩ := ih ha hb hX hX_fin hle + exact ⟨W, hWV, hWfin, hWcard.trans (Nat.le_succ m), hj⟩ + · have hm_eq : (G.U ∩ (X \ {a, b})).ncard = m + 1 := le_antisymm hm hgt + obtain ⟨e, he0, he1⟩ := id hX + let g : I → S := fun s => (e s).1 + have hgc : Continuous g := continuous_subtype_val.comp e.continuous + have hgi : Function.Injective g := Subtype.val_injective.comp e.injective + have hg0 : g 0 = a := he0 + have hg1 : g 1 = b := he1 + let M : Set I := {s : I | s ∈ Ioo (0 : I) 1 ∧ g s ∈ G.U} + have hM_image : g '' M = G.U ∩ (X \ {a, b}) := by + ext z + constructor + · rintro ⟨s, ⟨⟨hs0, hs1⟩, hsU⟩, rfl⟩ + refine ⟨hsU, (e s).2, ?_⟩ + rintro (hza | hzb) + · exact ne_of_gt hs0 (hgi (hza.trans hg0.symm)) + · exact ne_of_lt hs1 (hgi (hzb.trans hg1.symm)) + · rintro ⟨hzU, hzX, hz_ab⟩ + let s : I := e.symm ⟨z, hzX⟩ + have hgs : g s = z := congrArg Subtype.val (e.apply_symm_apply ⟨z, hzX⟩) + have hs0 : (0 : I) < s := lt_of_le_of_ne (unitInterval.nonneg s) fun h => + hz_ab (Or.inl (hgs.symm.trans (h ▸ hg0))) + have hs1 : s < 1 := lt_of_le_of_ne (unitInterval.le_one s) fun h => + hz_ab (Or.inr (hgs.symm.trans (h ▸ hg1))) + exact ⟨s, ⟨⟨hs0, hs1⟩, hgs.symm ▸ hzU⟩, hgs⟩ + have hM_fin : M.Finite := hfin_int.preimage hgi.injOn |>.subset fun s hs => by + rw [mem_preimage, ← hM_image] + exact ⟨s, hs, rfl⟩ + have h_int_ne : (G.U ∩ (X \ {a, b})).Nonempty := + ncard_pos hfin_int |>.mp (by omega) + have hM_ne : M.Nonempty := by + obtain ⟨z, hz⟩ := h_int_ne + rw [← hM_image] at hz + obtain ⟨s, hs, _⟩ := hz + exact ⟨s, hs⟩ + let s₁ : I := hM_fin.toFinset.min' (hM_fin.toFinset_nonempty.mpr hM_ne) + have hs₁_M : s₁ ∈ M := hM_fin.mem_toFinset.mp (Finset.min'_mem _ _) + have hs₁_min : ∀ s ∈ M, s₁ ≤ s := fun s hs => + Finset.min'_le _ _ (hM_fin.mem_toFinset.mpr hs) + have hs₁_pos : (0 : I) < s₁ := hs₁_M.1.1 + have hs₁_lt1 : s₁ < 1 := hs₁_M.1.2 + have h_disj₁ : ∀ s ∈ Ioo (0 : I) s₁, g s ∉ G.U := by + intro s ⟨hs0, hss₁⟩ hsU + have hs_M : s ∈ M := ⟨⟨hs0, hss₁.trans hs₁_lt1⟩, hsU⟩ + exact not_le_of_gt hss₁ (hs₁_min s hs_M) + let mid₁ : I := ⟨(s₁ : ℝ) / 2, by linarith [s₁.2.1], by linarith [s₁.2.2]⟩ + have hmid₁_mem : mid₁ ∈ Ioo (0 : I) s₁ := by + have hs₁_r : (0 : ℝ) < (s₁ : ℝ) := hs₁_pos + exact ⟨by change (0 : ℝ) < (s₁ : ℝ) / 2; linarith, + by change (s₁ : ℝ) / 2 < (s₁ : ℝ); linarith⟩ + obtain ⟨r₁, hr₁, hmid₁_r₁⟩ := exists_region_of_notMem (h_disj₁ mid₁ hmid₁_mem) + have hIoo₁_conn : IsPreconnected (g '' Ioo 0 s₁) := + (isPreconnected_Ioo (a := (0 : I)) (b := s₁)).image g hgc.continuousOn + have hIoo₁_disj : Disjoint (g '' Ioo 0 s₁) G.U := + disjoint_left.mpr (by rintro _ ⟨s, hs, rfl⟩; exact h_disj₁ s hs) + have hIoo₁_sub : g '' Ioo 0 s₁ ⊆ r₁ := + subset_region hr₁ hIoo₁_conn hIoo₁_disj ⟨mid₁, hmid₁_mem, rfl⟩ hmid₁_r₁ + have ha_cl₁ : a ∈ closure r₁ := by + have h0 : (0 : I) ∈ closure (Ioo (0 : I) s₁) := by + rw [closure_Ioo (ne_of_lt hs₁_pos)] + exact ⟨le_rfl, hs₁_pos.le⟩ + exact closure_mono hIoo₁_sub (image_closure_subset_closure_image hgc ⟨0, h0, hg0⟩) + have hz₁_cl₁ : g s₁ ∈ closure r₁ := by + have hs₁_cl : s₁ ∈ closure (Ioo (0 : I) s₁) := by + rw [closure_Ioo (ne_of_lt hs₁_pos)] + exact ⟨hs₁_pos.le, le_rfl⟩ + exact closure_mono hIoo₁_sub (image_closure_subset_closure_image hgc ⟨s₁, hs₁_cl, rfl⟩) + -- Now find s₁' ∈ Ioo s₁ 1 such that g '' Ioc s₁ s₁' ∩ G.U = ∅ + have hex_s₂ : ∃ s₂ : I, s₁ < s₂ ∧ ∀ s ∈ Ioo s₁ s₂, g s ∉ G.U := by + have hM₂_fin : (M \ {s₁}).Finite := hM_fin.subset sdiff_subset + rcases (M \ {s₁}).eq_empty_or_nonempty with h_emp | h_ne + · refine ⟨1, hs₁_lt1, fun s ⟨hss₁, hs1⟩ hsU => ?_⟩ + have hs_M : s ∈ M \ {s₁} := ⟨⟨⟨hs₁_pos.trans hss₁, hs1⟩, hsU⟩, ne_of_gt hss₁⟩ + rw [h_emp] at hs_M + exact hs_M + · let s₂ : I := hM₂_fin.toFinset.min' (hM₂_fin.toFinset_nonempty.mpr h_ne) + have hs₂_mem : s₂ ∈ M \ {s₁} := hM₂_fin.mem_toFinset.mp (Finset.min'_mem _ _) + have hs₂_min : ∀ s ∈ M \ {s₁}, s₂ ≤ s := fun s hs => + Finset.min'_le _ _ (hM₂_fin.mem_toFinset.mpr hs) + have hs₁_lt_s₂ : s₁ < s₂ := + lt_of_le_of_ne (hs₁_min s₂ hs₂_mem.1) (Ne.symm hs₂_mem.2) + refine ⟨s₂, hs₁_lt_s₂, fun s ⟨hss₁, hss₂⟩ hsU => ?_⟩ + have hs_M₂ : s ∈ M \ {s₁} := + ⟨⟨⟨hs₁_pos.trans hss₁, hss₂.trans hs₂_mem.1.1.2⟩, hsU⟩, ne_of_gt hss₁⟩ + exact not_le_of_gt hss₂ (hs₂_min s hs_M₂) + obtain ⟨s₂, hs₁_lt_s₂, h_disj_s₂⟩ := hex_s₂ + let s₁' : I := ⟨((s₁ : ℝ) + (s₂ : ℝ)) / 2, + by linarith [s₁.2.1, s₂.2.1], by linarith [s₁.2.2, s₂.2.2]⟩ + have hs₁_r_lt : (s₁ : ℝ) < (s₂ : ℝ) := hs₁_lt_s₂ + have hs₁_lt_s₁' : s₁ < s₁' := by + change (s₁ : ℝ) < ((s₁ : ℝ) + (s₂ : ℝ)) / 2 + linarith + have hs₁'_lt_s₂ : s₁' < s₂ := by + change ((s₁ : ℝ) + (s₂ : ℝ)) / 2 < (s₂ : ℝ) + linarith + have hs₁'_lt1 : s₁' < 1 := lt_of_lt_of_le hs₁'_lt_s₂ (unitInterval.le_one s₂) + have h_disj₂ : ∀ s ∈ Ioc s₁ s₁', g s ∉ G.U := fun s ⟨h1, h2⟩ => + h_disj_s₂ s ⟨h1, lt_of_le_of_lt h2 hs₁'_lt_s₂⟩ + have hgs₁'_notU : g s₁' ∉ G.U := h_disj₂ s₁' ⟨hs₁_lt_s₁', le_rfl⟩ + obtain ⟨r₂, hr₂, hgs₁'_r₂⟩ := exists_region_of_notMem hgs₁'_notU + have hIoc₂_conn : IsPreconnected (g '' Ioc s₁ s₁') := + (isPreconnected_Ioc (a := s₁) (b := s₁')).image g hgc.continuousOn + have hIoc₂_disj : Disjoint (g '' Ioc s₁ s₁') G.U := + disjoint_left.mpr (by rintro _ ⟨s, hs, rfl⟩; exact h_disj₂ s hs) + have hIoc₂_sub : g '' Ioc s₁ s₁' ⊆ r₂ := + subset_region hr₂ hIoc₂_conn hIoc₂_disj ⟨s₁', ⟨hs₁_lt_s₁', le_rfl⟩, rfl⟩ hgs₁'_r₂ + have hz₁_cl₂ : g s₁ ∈ closure r₂ := by + have hs₁_cl : s₁ ∈ closure (Ioc s₁ s₁') := by + rw [closure_Ioc (ne_of_lt hs₁_lt_s₁')] + exact ⟨le_rfl, hs₁_lt_s₁'.le⟩ + exact closure_mono hIoc₂_sub (image_closure_subset_closure_image hgc ⟨s₁, hs₁_cl, rfl⟩) + obtain ⟨v₁, hv₁V, hv₁_cl₁, hv₁_cl₂⟩ := + exists_vertex_in_closure_regions hS hG hr₁ hr₂ hs₁_M.2 hz₁_cl₁ hz₁_cl₂ + have hv₁_norm : v₁ ∈ (G.U \ G.V)ᶜ := fun h => h.2 hv₁V + have hj_av₁ : JoinedIn (r₁ ∪ {a, v₁}) a v₁ := + joinedIn_region_union_pair hS hG hr₁ ha_cl₁ ha hv₁_cl₁ hv₁_norm + have hj_v₁x' : JoinedIn (r₂ ∪ {v₁, g s₁'}) v₁ (g s₁') := + joinedIn_region_union_pair hS hG hr₂ hv₁_cl₂ hv₁_norm (subset_closure hgs₁'_r₂) + (fun h => hgs₁'_notU h.1) + -- Apply IH to X' = g '' Icc s₁' 1 + let X' : Set S := g '' Icc s₁' 1 + have hX'_line : IsLineWithEnds X' (g s₁') b := hg1 ▸ isLine_piece hgc hgi hs₁'_lt1 + have hX'_sub : X' ⊆ X := by rintro _ ⟨s, _, rfl⟩; exact (e s).2 + have hX'_fin : (G.U ∩ X').Finite := hX_fin.subset (inter_subset_inter_right _ hX'_sub) + have hX'_int_sub : G.U ∩ (X' \ {g s₁', b}) ⊆ (G.U ∩ (X \ {a, b})) \ {g s₁} := by + rintro z ⟨hzU, ⟨⟨s, ⟨hss₁', hs1⟩, rfl⟩, hz_end⟩⟩ + have hs_gt : s₁' < s := lt_of_le_of_ne hss₁' fun h => hz_end (Or.inl (congrArg g h.symm)) + have hs_lt1 : s < 1 := lt_of_le_of_ne hs1 fun h => hz_end (Or.inr (h ▸ hg1)) + have hs_gt1 : s₁ < s := hs₁_lt_s₁'.trans hs_gt + have hs_M : s ∈ M := ⟨⟨hs₁_pos.trans hs_gt1, hs_lt1⟩, hzU⟩ + refine ⟨hM_image ▸ ⟨s, hs_M, rfl⟩, ?_⟩ + intro h_eq + exact ne_of_gt hs_gt1 (hgi h_eq) + have hgs₁_mem : g s₁ ∈ G.U ∩ (X \ {a, b}) := hM_image ▸ ⟨s₁, hs₁_M, rfl⟩ + have hX'_card : (G.U ∩ (X' \ {g s₁', b})).ncard ≤ m := by + calc (G.U ∩ (X' \ {g s₁', b})).ncard + _ ≤ ((G.U ∩ (X \ {a, b})) \ {g s₁}).ncard := + ncard_le_ncard hX'_int_sub (hfin_int.subset sdiff_subset) + _ = (G.U ∩ (X \ {a, b})).ncard - 1 := ncard_sdiff_singleton_of_mem hgs₁_mem + _ = m := by omega + obtain ⟨W', hW'V, hW'fin, hW'card, hj_x'b⟩ := + ih (fun h => hgs₁'_notU h.1) hb hX'_line hX'_fin hX'_card + refine ⟨insert v₁ W', insert_subset hv₁V hW'V, hW'fin.insert v₁, ?_, ?_⟩ + · calc (insert v₁ W').ncard + _ ≤ W'.ncard + 1 := ncard_insert_le v₁ W' + _ ≤ m + 1 := Nat.add_le_add_right hW'card 1 + · have hsub₁ : r₁ ∪ {a, v₁} ⊆ G.Uᶜ ∪ insert v₁ W' ∪ {a, b} := by + rintro z (hzr₁ | (rfl | hzv₁)) + · exact Or.inl (Or.inl (region_subset hr₁ hzr₁)) + · exact Or.inr (Or.inl rfl) + · exact Or.inl (Or.inr (mem_singleton_iff.mp hzv₁ ▸ mem_insert v₁ W')) + have hsub₂ : r₂ ∪ {v₁, g s₁'} ⊆ G.Uᶜ ∪ insert v₁ W' ∪ {a, b} := by + rintro z (hzr₂ | (rfl | hzx')) + · exact Or.inl (Or.inl (region_subset hr₂ hzr₂)) + · exact Or.inl (Or.inr (mem_insert z W')) + · exact Or.inl (Or.inl (mem_singleton_iff.mp hzx' ▸ hgs₁'_notU)) + have hsub₃ : G.Uᶜ ∪ W' ∪ {g s₁', b} ⊆ G.Uᶜ ∪ insert v₁ W' ∪ {a, b} := by + rintro z ((hzUc | hzW') | (rfl | hzb)) + · exact Or.inl (Or.inl hzUc) + · exact Or.inl (Or.inr (mem_insert_of_mem v₁ hzW')) + · exact Or.inl (Or.inl hgs₁'_notU) + · exact Or.inr (Or.inr (mem_singleton_iff.mp hzb)) + exact ((hj_av₁.mono hsub₁).trans (hj_v₁x'.mono hsub₂)).trans (hj_x'b.mono hsub₃) + +/-- For any distinct `a, b ∈ (G.U \ G.V)ᶜ` and any `[0, 1]`-arc `X` with ends `a, b` and +`(G.U ∩ X).Finite`, there is a `G`-normal `[0, 1]`-arc `P` with ends `a, b` such that +`(G.V ∩ P).ncard ≤ (G.U ∩ X).ncard`. -/ +theorem exists_normal_arc_of_lineWithEnds (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) {a b : S} + (ha : a ∈ (G.U \ G.V)ᶜ) (hb : b ∈ (G.U \ G.V)ᶜ) {X : Set S} + (hX : IsLineWithEnds X a b) (hX_fin : (G.U ∩ X).Finite) : + ∃ P : Set S, IsLineWithEnds P a b ∧ G.IsNormal P ∧ (G.V ∩ P).ncard ≤ (G.U ∩ X).ncard := by + have : T2Space S := hS.2.1 + obtain ⟨W, hWV, hWfin, hWcard, hj⟩ := + exists_joinedIn_normal_of_lineWithEnds hS hG (G.U ∩ (X \ {a, b})).ncard ha hb hX hX_fin le_rfl + obtain ⟨P, hP_sub, hP_line⟩ := + ((joinedIn_iff_eq_or_exists_isLineWithEnds (Z := G.Uᶜ ∪ W ∪ {a, b}) + (Or.inr (Or.inl rfl)) (Or.inr (Or.inr rfl))).mp hj).resolve_left hX.ne' + have hP_norm : G.IsNormal P := by + rintro z ⟨hzP, hzU⟩ + rcases hP_sub hzP with (hzUc | hzW) | (rfl | hzb) + · exact False.elim (hzUc hzU) + · exact hWV hzW + · exact by_contra fun hzV => ha ⟨hzU, hzV⟩ + · exact by_contra fun hzV => hb ⟨mem_singleton_iff.mp hzb ▸ hzU, mem_singleton_iff.mp hzb ▸ hzV⟩ + have hVP_sub : G.V ∩ P ⊆ (G.V ∩ (P \ {a, b})) ∪ (G.U ∩ (X ∩ {a, b})) := by + rintro z ⟨hzV, hzP⟩ + by_cases hz_ab : z ∈ ({a, b} : Set S) + · refine Or.inr ⟨G.V_subset_U hzV, ?_, hz_ab⟩ + rcases hz_ab with rfl | hzb + · exact hX.left_mem + · exact mem_singleton_iff.mp hzb ▸ hX.right_mem + · exact Or.inl ⟨hzV, hzP, hz_ab⟩ + have hVP_diff_sub : G.V ∩ (P \ {a, b}) ⊆ W := by + rintro z ⟨hzV, hzP, hz_ab⟩ + rcases hP_sub hzP with (hzUc | hzW) | hz_ab' + · exact False.elim (hzUc (G.V_subset_U hzV)) + · exact hzW + · exact False.elim (hz_ab hz_ab') + have hfin1 : (G.V ∩ (P \ {a, b})).Finite := hWfin.subset hVP_diff_sub + have hfin2 : (G.U ∩ (X ∩ {a, b})).Finite := hX_fin.subset (inter_subset_inter_right _ + inter_subset_left) + have hfin3 : (G.U ∩ (X \ {a, b})).Finite := hX_fin.subset (inter_subset_inter_right _ + sdiff_subset) + have hX_split : G.U ∩ X = (G.U ∩ (X \ {a, b})) ∪ (G.U ∩ (X ∩ {a, b})) := by + ext z + simp only [mem_inter_iff, mem_union, Set.mem_sdiff] + by_cases h : z ∈ ({a, b} : Set S) <;> tauto + have hX_disj : Disjoint (G.U ∩ (X \ {a, b})) (G.U ∩ (X ∩ {a, b})) := + disjoint_left.mpr fun _ ⟨_, _, h1⟩ ⟨_, _, h2⟩ => h1 h2 + refine ⟨P, hP_line, hP_norm, ?_⟩ + calc (G.V ∩ P).ncard + _ ≤ ((G.V ∩ (P \ {a, b})) ∪ (G.U ∩ (X ∩ {a, b}))).ncard := + ncard_le_ncard hVP_sub (hfin1.union hfin2) + _ ≤ (G.V ∩ (P \ {a, b})).ncard + (G.U ∩ (X ∩ {a, b})).ncard := + ncard_union_le _ _ + _ ≤ W.ncard + (G.U ∩ (X ∩ {a, b})).ncard := + Nat.add_le_add_right (ncard_le_ncard hVP_diff_sub hWfin) _ + _ ≤ (G.U ∩ (X \ {a, b})).ncard + (G.U ∩ (X ∩ {a, b})).ncard := + Nat.add_le_add_right hWcard _ + _ = (G.U ∩ X).ncard := by + rw [hX_split, ncard_union_eq hX_disj hfin3 hfin2] + +/-- If `C ∈ cuffs S` and `IsPlanar X`, then `IsPlanarInCappedCuff C X`. -/ +theorem isPlanarInCappedCuff_of_isPlanar (hS : IsSurface S) {C X : Set S} + (hC : C ∈ cuffs S) (hX : IsPlanar X) : + IsPlanarInCappedCuff C X := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + obtain ⟨c₀, hc₀⟩ := isOArc_nonempty (cuff_isOArc hS hC) + have : Nonempty S := ⟨c₀⟩ + have h_all : ∀ (S' : Type u) [TopologicalSpace S'] (j : S → S') (D : Set S'), + IsCappedCuff C S' j D → IsPlanar (j '' X) := by + intro S' _ j D hCap + have : T2Space S' := hCap.isSurface.2.1 + obtain ⟨Δ, hΔ, hXΔ⟩ := hX + obtain ⟨d', hd'c, hd'l⟩ := exists_inv_of_compactOn hΔ.isCompact + hCap.isEmbedding.continuous.continuousOn hCap.isEmbedding.injective.injOn + exact ⟨j '' Δ, (hΔ.image hCap.isEmbedding.continuous.continuousOn hd'c hd'l).1, image_mono hXΔ⟩ + obtain ⟨S', topS', j, D, hS', hj, hD, hunion, hinter, hbdD⟩ := + paste_disc S C hS hC + have hCap : IsCappedCuff C S' j D := ⟨hC, hS', hj.isEmbedding, hD, hbdD.1, hunion, hinter⟩ + exact ⟨hC, ⟨S', topS', j, D, hCap, h_all S' j D hCap⟩, h_all⟩ + +/-- If `g : I → S` is continuous, `a < b` in `I`, and `InjOn g (Icc a b)`, then `g '' Icc a b` is a +`[0, 1]`-arc with ends `g a` and `g b`. -/ +theorem isLineWithEnds_image_Icc_of_injOn [T2Space S] {g : I → S} (hgc : Continuous g) + {a b : I} (hab : a < b) (hinj : InjOn g (Icc a b)) : + IsLineWithEnds (g '' Icc a b) (g a) (g b) := by + have hab_r : (a : ℝ) < (b : ℝ) := hab + have hm_mem : ∀ t : I, (1 - (t : ℝ)) * (a : ℝ) + (t : ℝ) * (b : ℝ) ∈ Icc (a : ℝ) (b : ℝ) := by + intro t + exact ⟨by nlinarith [t.2.1, t.2.2, hab_r], by nlinarith [t.2.1, t.2.2, hab_r]⟩ + let m : I → I := fun t => ⟨(1 - (t : ℝ)) * (a : ℝ) + (t : ℝ) * (b : ℝ), + a.2.1.trans (hm_mem t).1, (hm_mem t).2.trans b.2.2⟩ + have hm_cont : Continuous m := Continuous.subtype_mk (by fun_prop) _ + have hm_inj : Function.Injective m := by + intro t₁ t₂ h + have hr_eq : (1 - (t₁ : ℝ)) * (a : ℝ) + (t₁ : ℝ) * (b : ℝ) = + (1 - (t₂ : ℝ)) * (a : ℝ) + (t₂ : ℝ) * (b : ℝ) := congrArg Subtype.val h + exact Subtype.ext (by nlinarith [hab_r, hr_eq]) + have hgm_inj : Function.Injective (g ∘ m) := fun t₁ t₂ h => + hm_inj (hinj (hm_mem t₁) (hm_mem t₂) h) + have hrange : range (g ∘ m) = g '' Icc a b := by + ext z + constructor + · rintro ⟨t, rfl⟩ + exact ⟨m t, hm_mem t, rfl⟩ + · rintro ⟨s, ⟨hsa, hsb⟩, rfl⟩ + have hba_pos : 0 < (b : ℝ) - (a : ℝ) := sub_pos.mpr hab_r + have hsa_r : (a : ℝ) ≤ (s : ℝ) := hsa + have hsb_r : (s : ℝ) ≤ (b : ℝ) := hsb + let t : I := ⟨((s : ℝ) - (a : ℝ)) / ((b : ℝ) - (a : ℝ)), + div_nonneg (sub_nonneg.mpr hsa_r) hba_pos.le, + (div_le_one hba_pos).mpr (sub_le_sub_right hsb_r (a : ℝ))⟩ + refine ⟨t, congrArg g (Subtype.ext ?_)⟩ + change (1 - ((s : ℝ) - (a : ℝ)) / ((b : ℝ) - (a : ℝ))) * (a : ℝ) + + (((s : ℝ) - (a : ℝ)) / ((b : ℝ) - (a : ℝ))) * (b : ℝ) = (s : ℝ) + have hne : (b : ℝ) - (a : ℝ) ≠ 0 := ne_of_gt hba_pos + calc (1 - ((s : ℝ) - (a : ℝ)) / ((b : ℝ) - (a : ℝ))) * (a : ℝ) + + (((s : ℝ) - (a : ℝ)) / ((b : ℝ) - (a : ℝ))) * (b : ℝ) + _ = (a : ℝ) + (((s : ℝ) - (a : ℝ)) / ((b : ℝ) - (a : ℝ))) * ((b : ℝ) - (a : ℝ)) := by ring + _ = (a : ℝ) + ((s : ℝ) - (a : ℝ)) := by rw [div_mul_cancel₀ _ hne] + _ = (s : ℝ) := by ring + have hemb : IsEmbedding (g ∘ m) := ((hgc.comp hm_cont).isClosedEmbedding hgm_inj).isEmbedding + rw [← hrange] + refine ⟨hemb.toHomeomorph, ?_, ?_⟩ + · change g (m 0) = g a + have hm0 : m 0 = a := Subtype.ext (by simp [m]) + rw [hm0] + · change g (m 1) = g b + have hm1 : m 1 = b := Subtype.ext (by simp [m]) + rw [hm1] + +/-- An embedding `j : S → T` maps components of `X ⊆ S` to components of `j '' X ⊆ T`. -/ +theorem image_mem_componentsIn_of_isEmbedding {T : Type*} [TopologicalSpace T] + {j : S → T} (hj : IsEmbedding j) {X B : Set S} (hB : B ∈ componentsIn X) : + j '' B ∈ componentsIn (j '' X) := by + obtain ⟨z, hzX, rfl⟩ := hB + refine ⟨j z, mem_image_of_mem j hzX, ?_⟩ + apply Subset.antisymm + · intro y hy + have hex : ∀ w : connectedComponentIn (j '' X) (j z), ∃ x ∈ X, j x = w.1 := + fun w => connectedComponentIn_subset (j '' X) (j z) w.2 + choose f hfX hfeq using hex + have hf_cont : Continuous f := hj.continuous_iff.mpr (by + have : j ∘ f = Subtype.val := funext hfeq + rw [this] + exact continuous_subtype_val) + have : PreconnectedSpace (connectedComponentIn (j '' X) (j z)) := + isPreconnected_iff_preconnectedSpace.mp isPreconnected_connectedComponentIn + have h_range_pre : IsPreconnected (range f) := isPreconnected_range hf_cont + let w₀ : connectedComponentIn (j '' X) (j z) := ⟨j z, mem_connectedComponentIn + (mem_image_of_mem j hzX)⟩ + have hfw₀ : f w₀ = z := hj.injective (hfeq w₀) + have h_sub : range f ⊆ connectedComponentIn X z := + h_range_pre.subset_connectedComponentIn ⟨w₀, hfw₀⟩ (by rintro _ ⟨w, rfl⟩; exact hfX w) + exact ⟨f ⟨y, hy⟩, h_sub ⟨⟨y, hy⟩, rfl⟩, hfeq ⟨y, hy⟩⟩ + · have h_pre : IsPreconnected (j '' connectedComponentIn X z) := + isPreconnected_connectedComponentIn.image j hj.continuous.continuousOn + exact h_pre.subset_connectedComponentIn + (mem_image_of_mem j (mem_connectedComponentIn hzX)) + (image_mono (connectedComponentIn_subset X z)) + +/-- For any `v ∈ closure (nearSet G t F₀) ∩ (G.U \ G.V)ᶜ` where `F₀` is a `G`-normal `O`-arc, there +is a point `u ∈ F₀` and a `G`-normal `[0, 1]`-arc `P` with ends `v, u` such that +`(G.V ∩ P).ncard ≤ t + 1`. -/ +theorem exists_normal_arc_to_F0 (hS : IsSurface S) [ConnectedSpace S] + {G : Drawing S} (hG : G.IsProper) {F₀ : Set S} (hF₀_oarc : IsOArc F₀) + (hF₀_norm : G.IsNormal F₀) {t : ℕ} {v : S} + (hv_cl : v ∈ closure (nearSet G t F₀)) (hv_norm : v ∈ (G.U \ G.V)ᶜ) : + ∃ (u : S) (P : Set S), u ∈ F₀ ∧ IsLineWithEnds P v u ∧ G.IsNormal P ∧ + (G.V ∩ P).ncard ≤ t + 1 := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := hS.locallyConnected + rw [closure_nearSet_eq_closure_sUnion_regions hS hG hF₀_norm t] at hv_cl + let ℛ : Set (Set S) := {r ∈ G.R | r ⊆ nearSet G t F₀} + have hfinℛ : ℛ.Finite := (finite_regions_of_isProper hS hG).subset (sep_subset _ _) + have hv_bi : v ∈ ⋃ r ∈ ℛ, closure r := by + have heq : closure (⋃₀ ℛ) = ⋃ r ∈ ℛ, closure r := by + rw [sUnion_eq_biUnion, hfinℛ.closure_biUnion] + rwa [← heq] + obtain ⟨r, ⟨hr, hr_sub⟩, hvr⟩ := mem_iUnion₂.mp hv_bi + obtain ⟨x₀, hx₀r⟩ := region_nonempty hr + obtain ⟨y, hyF₀, hx₀y_le⟩ := hr_sub hx₀r + have hy_norm : y ∈ (G.U \ G.V)ᶜ := fun ⟨hyU, hyV⟩ => hyV (hF₀_norm ⟨hyF₀, hyU⟩) + by_cases hvy : v = y + · subst hvy + obtain ⟨φ₀⟩ := id hF₀_oarc + let w₀ : Circle := φ₀.symm ⟨v, hyF₀⟩ + let g₀ : I → S := fun s => (φ₀ (arcParam w₀ s)).1 + have hg₀c : Continuous g₀ := + continuous_subtype_val.comp (φ₀.continuous.comp (arcParam w₀).continuous) + have hg₀0 : g₀ 0 = v := by + change (φ₀ (arcParam w₀ 0)).1 = v + rw [arcParam_zero, φ₀.apply_symm_apply] + have hV_open : IsOpen ((G.V \ {v})ᶜ) := (G.finite_V.subset sdiff_subset).isClosed.isOpen_compl + have hg₀_mem : g₀ 0 ∈ (G.V \ {v})ᶜ := by rw [hg₀0]; exact fun h => h.2 rfl + let half : I := ⟨1 / 2, by norm_num, by norm_num⟩ + have hhalf_pos : (0 : I) < half := by change (0 : ℝ) < 1 / 2; norm_num + obtain ⟨u₀, hu₀_pos, hu₀_le_half, hu₀_mem⟩ := + exists_pos_le hg₀c hV_open hg₀_mem hhalf_pos + have hu₀_lt1 : u₀ < 1 := by + change (u₀ : ℝ) < 1 + have : (u₀ : ℝ) ≤ 1 / 2 := hu₀_le_half + linarith + let P : Set S := g₀ '' Icc 0 u₀ + have hg₀_inj_Icc : InjOn g₀ (Icc 0 u₀) := by + intro s₁ hs₁ s₂ hs₂ heq + have hφ_eq : φ₀ (arcParam w₀ s₁) = φ₀ (arcParam w₀ s₂) := Subtype.ext heq + rcases arcParam_eq_iff w₀ (φ₀.injective hφ_eq) with h | ⟨_, h1⟩ | ⟨h1, _⟩ + · exact h + · exact False.elim (ne_of_lt (lt_of_le_of_lt hs₂.2 hu₀_lt1) h1) + · exact False.elim (ne_of_lt (lt_of_le_of_lt hs₁.2 hu₀_lt1) h1) + have hP_line : IsLineWithEnds P v (g₀ u₀) := by + have hm_le : ∀ s : I, (s : ℝ) * (u₀ : ℝ) ≤ (u₀ : ℝ) := fun s => + mul_le_of_le_one_left u₀.2.1 s.2.2 + let m : I → I := fun s => ⟨(s : ℝ) * (u₀ : ℝ), mul_nonneg s.2.1 u₀.2.1, + (hm_le s).trans u₀.2.2⟩ + have hm_cont : Continuous m := Continuous.subtype_mk (by fun_prop) _ + have hm_inj : Function.Injective m := by + intro s₁ s₂ h + have hr_eq : (s₁ : ℝ) * (u₀ : ℝ) = (s₂ : ℝ) * (u₀ : ℝ) := congrArg Subtype.val h + have hu₀_r : (0 : ℝ) < (u₀ : ℝ) := hu₀_pos + exact Subtype.ext (mul_right_cancel₀ (ne_of_gt hu₀_r) hr_eq) + have hgm_inj : Function.Injective (g₀ ∘ m) := fun s₁ s₂ h => + hm_inj (hg₀_inj_Icc ⟨(m s₁).2.1, hm_le s₁⟩ ⟨(m s₂).2.1, hm_le s₂⟩ h) + have hrange : range (g₀ ∘ m) = P := by + ext z + constructor + · rintro ⟨s, rfl⟩ + exact ⟨m s, ⟨(m s).2.1, hm_le s⟩, rfl⟩ + · rintro ⟨s, ⟨hs0, hsu₀⟩, rfl⟩ + have hu₀_r : (0 : ℝ) < (u₀ : ℝ) := hu₀_pos + let t : I := ⟨(s : ℝ) / (u₀ : ℝ), div_nonneg hs0 hu₀_r.le, (div_le_one hu₀_r).mpr hsu₀⟩ + refine ⟨t, congrArg g₀ (Subtype.ext ?_)⟩ + change ((s : ℝ) / (u₀ : ℝ)) * (u₀ : ℝ) = (s : ℝ) + exact div_mul_cancel₀ (s : ℝ) (ne_of_gt hu₀_r) + have hemb : IsEmbedding (g₀ ∘ m) := ((hg₀c.comp hm_cont).isClosedEmbedding + hgm_inj).isEmbedding + rw [← hrange] + refine ⟨hemb.toHomeomorph, ?_, ?_⟩ + · change g₀ (m 0) = v + have hm0 : m 0 = 0 := Subtype.ext (by simp [m]) + rw [hm0, hg₀0] + · change g₀ (m 1) = g₀ u₀ + have hm1 : m 1 = u₀ := Subtype.ext (by simp [m]) + rw [hm1] + have hP_sub : P ⊆ F₀ := by rintro _ ⟨s, _, rfl⟩; exact (φ₀ (arcParam w₀ s)).2 + have hVP_sub : G.V ∩ P ⊆ {v} := by + rintro z ⟨hzV, s, ⟨_, hsu₀⟩, rfl⟩ + by_contra hzv + exact hu₀_mem s hsu₀ ⟨hzV, hzv⟩ + refine ⟨g₀ u₀, P, (φ₀ (arcParam w₀ u₀)).2, hP_line, + fun z ⟨hzP, hzU⟩ => hF₀_norm ⟨hP_sub hzP, hzU⟩, ?_⟩ + calc (G.V ∩ P).ncard + _ ≤ ({v} : Set S).ncard := ncard_le_ncard hVP_sub (finite_singleton v) + _ = 1 := ncard_singleton v + _ ≤ t + 1 := Nat.le_add_left 1 t + · have hdist_vy : distPoint G v y ≤ t + 1 := by + by_cases hx₀v : x₀ = v + · subst hx₀v + exact hx₀y_le.trans (Nat.le_succ t) + · have hj_vx₀ := joinedIn_region_union_pair hS hG hr hvr hv_norm (subset_closure hx₀r) + (fun h => region_subset hr hx₀r h.1) + by_cases hx₀y : x₀ = y + · subst hx₀y + obtain ⟨L, hL_sub, hL_line⟩ := + ((joinedIn_iff_eq_or_exists_isLineWithEnds (Z := r ∪ {v, x₀}) + (Or.inr (Or.inl rfl)) (Or.inl hx₀r)).mp hj_vx₀).resolve_left hvy + have hUL_sub : G.U ∩ L ⊆ {v} := by + rintro z ⟨hzU, hzL⟩ + rcases hL_sub hzL with hzr | (rfl | hzx₀) + · exact False.elim (region_subset hr hzr hzU) + · rfl + · exact False.elim (region_subset hr (mem_singleton_iff.mp hzx₀ ▸ hx₀r) hzU) + have hUL_fin : (G.U ∩ L).Finite := (finite_singleton v).subset hUL_sub + calc distPoint G v x₀ + _ ≤ (G.U ∩ L).ncard := distPoint_le_of_lineWithEnds hL_line hUL_fin + _ ≤ ({v} : Set S).ncard := ncard_le_ncard hUL_sub (finite_singleton v) + _ = 1 := ncard_singleton v + _ ≤ t + 1 := Nat.le_add_left 1 t + · obtain ⟨X, hX_line, hX_fin, hX_card⟩ := distPoint_exists_arc hS hG hx₀y + have hj_X : JoinedIn X x₀ y := + (joinedIn_iff_eq_or_exists_isLineWithEnds (Z := X) hX_line.left_mem + hX_line.right_mem).mpr + (Or.inr ⟨X, Subset.rfl, hX_line⟩) + have hj_vy : JoinedIn ((r ∪ {v, x₀}) ∪ X) v y := + (hj_vx₀.mono subset_union_left).trans (hj_X.mono subset_union_right) + obtain ⟨X', hX'_sub, hX'_line⟩ := + ((joinedIn_iff_eq_or_exists_isLineWithEnds (Z := (r ∪ {v, x₀}) ∪ X) + (Or.inl (Or.inr (Or.inl rfl))) (Or.inr hX_line.right_mem)).mp hj_vy).resolve_left hvy + have hUX'_sub : G.U ∩ X' ⊆ insert v (G.U ∩ X) := by + rintro z ⟨hzU, hzX'⟩ + rcases hX'_sub hzX' with (hzr | (rfl | hzx₀)) | hzX + · exact False.elim (region_subset hr hzr hzU) + · exact mem_insert z (G.U ∩ X) + · exact False.elim (region_subset hr (mem_singleton_iff.mp hzx₀ ▸ hx₀r) hzU) + · exact mem_insert_of_mem v ⟨hzU, hzX⟩ + have hUX'_fin : (G.U ∩ X').Finite := (hX_fin.insert v).subset hUX'_sub + calc distPoint G v y + _ ≤ (G.U ∩ X').ncard := distPoint_le_of_lineWithEnds hX'_line hUX'_fin + _ ≤ (insert v (G.U ∩ X)).ncard := ncard_le_ncard hUX'_sub (hX_fin.insert v) + _ ≤ (G.U ∩ X).ncard + 1 := ncard_insert_le v (G.U ∩ X) + _ = distPoint G x₀ y + 1 := by rw [hX_card] + _ ≤ t + 1 := Nat.add_le_add_right hx₀y_le 1 + obtain ⟨X, hX_line, hX_fin, hX_card⟩ := distPoint_exists_arc hS hG hvy + obtain ⟨P, hP_line, hP_norm, hP_card⟩ := + exists_normal_arc_of_lineWithEnds hS hG hv_norm hy_norm hX_line hX_fin + exact ⟨y, P, hyF₀, hP_line, hP_norm, hP_card.trans (hX_card ▸ hdist_vy)⟩ + +/-- Given an `O`-arc `F₀`, distinct points `x, y ∈ F₀`, and a finite set `V : Set S`, there is a +component `B ∈ componentsIn (F₀ \ {x, y})` such that `B ⊆ F₀`, `2 * (V ∩ B).ncard ≤ (V ∩ F₀).ncard`, +and `IsLineWithEnds (B ∪ {x, y}) x y`. -/ +theorem exists_short_component_oArc_diff_pair [T2Space S] {F₀ V : Set S} (hF₀ : IsOArc F₀) + (hV : V.Finite) {x y : S} (hx : x ∈ F₀) (hy : y ∈ F₀) (hxy : x ≠ y) : + ∃ B ∈ componentsIn (F₀ \ {x, y}), B ⊆ F₀ ∧ 2 * (V ∩ B).ncard ≤ (V ∩ F₀).ncard ∧ + IsLineWithEnds (B ∪ {x, y}) x y := by + obtain ⟨B₁, B₂, hcomponents, hdisjoint, hcover, hline₁, hline₂⟩ := + Net.oArc_components_diff_pair hF₀ hx hy hxy + have hsub : B₁ ∪ B₂ ⊆ F₀ := by + rw [← hcover] + exact sdiff_subset + have hsub₁ : B₁ ⊆ F₀ := subset_union_left.trans hsub + have hsub₂ : B₂ ⊆ F₀ := subset_union_right.trans hsub + have hsum : (V ∩ B₁).ncard + (V ∩ B₂).ncard ≤ (V ∩ F₀).ncard := by + rw [← ncard_union_eq (hdisjoint.mono inter_subset_right inter_subset_right) + (hV.inter_of_left B₁) (hV.inter_of_left B₂)] + exact ncard_le_ncard + (union_subset (inter_subset_inter_right V hsub₁) (inter_subset_inter_right V hsub₂)) + (hV.inter_of_left F₀) + rcases le_or_gt (2 * (V ∩ B₁).ncard) (V ∩ F₀).ncard with hle | hgt + · exact ⟨B₁, by rw [hcomponents]; exact mem_insert _ _, hsub₁, hle, hline₁⟩ + · exact ⟨B₂, by rw [hcomponents]; exact mem_insert_of_mem _ rfl, hsub₂, by omega, hline₂⟩ + +/-- Every `O`-arc is connected (`IsConnected`). -/ +theorem isConnected_of_isOArc {F : Set S} (hF : IsOArc F) : IsConnected F := by + obtain ⟨φ⟩ := id hF + have hrange : F = range (fun w : Circle => (φ w).1) := by + ext x + exact ⟨fun hx => ⟨φ.symm ⟨x, hx⟩, by simp⟩, by rintro ⟨w, rfl⟩; exact (φ w).2⟩ + rw [hrange] + exact isConnected_range (continuous_subtype_val.comp φ.continuous) + +/-- Every `O`-arc in a surface `S` is solid (`IsSolid`). -/ +theorem isSolid_of_isOArc (hS : IsSurface S) {F : Set S} (hF : IsOArc F) : IsSolid F := by + have : T2Space S := hS.2.1 + obtain ⟨φ⟩ := id hF + let g : I → S := fun s => (φ (arcParam 1 s)).1 + have hgc : Continuous g := + continuous_subtype_val.comp (φ.continuous.comp (arcParam 1).continuous) + let h : I := ⟨1 / 2, by norm_num, by norm_num⟩ + have h0h : (0 : I) < h := Subtype.mk_lt_mk.mpr (by norm_num) + have hh1 : h < (1 : I) := Subtype.mk_lt_mk.mpr (by norm_num) + have hinj1 : InjOn g (Icc 0 h) := by + intro s₁ hs₁ s₂ hs₂ heq + have hφ_eq : φ (arcParam 1 s₁) = φ (arcParam 1 s₂) := Subtype.ext heq + rcases arcParam_eq_iff 1 (φ.injective hφ_eq) with h_eq | ⟨_, h1⟩ | ⟨h1, _⟩ + · exact h_eq + · exact False.elim (ne_of_lt (lt_of_le_of_lt hs₂.2 hh1) h1) + · exact False.elim (ne_of_lt (lt_of_le_of_lt hs₁.2 hh1) h1) + have hinj2 : InjOn g (Icc h 1) := by + intro s₁ hs₁ s₂ hs₂ heq + have hφ_eq : φ (arcParam 1 s₁) = φ (arcParam 1 s₂) := Subtype.ext heq + rcases arcParam_eq_iff 1 (φ.injective hφ_eq) with h_eq | ⟨h0, _⟩ | ⟨_, h0⟩ + · exact h_eq + · exact False.elim (ne_of_gt (lt_of_lt_of_le h0h hs₁.1) h0) + · exact False.elim (ne_of_gt (lt_of_lt_of_le h0h hs₂.1) h0) + have hL1 : IsLineWithEnds (g '' Icc 0 h) (g 0) (g h) := + isLineWithEnds_image_Icc_of_injOn hgc h0h hinj1 + have hL2 : IsLineWithEnds (g '' Icc h 1) (g h) (g 1) := + isLineWithEnds_image_Icc_of_injOn hgc hh1 hinj2 + have hF_eq : F = g '' Icc 0 h ∪ g '' Icc h 1 := by + ext z + constructor + · intro hz + obtain ⟨τ, hτ⟩ := arcParam_surjective 1 (φ.symm ⟨z, hz⟩) + have hz_eq : g τ = z := by simp [g, hτ] + rcases le_total τ h with hle | hge + · exact Or.inl ⟨τ, ⟨unitInterval.nonneg τ, hle⟩, hz_eq⟩ + · exact Or.inr ⟨τ, ⟨hge, unitInterval.le_one τ⟩, hz_eq⟩ + · rintro (⟨τ, _, rfl⟩ | ⟨τ, _, rfl⟩) <;> exact (φ (arcParam 1 τ)).2 + rw [hF_eq] + exact theorem_11_6_proof hS (isSolid_of_isLineWithEnds hS hL1) (isSolid_of_isLineWithEnds hS hL2) + +/-- Every `[0, 1]`-arc is connected (`IsConnected`). -/ +theorem isConnected_of_isLineWithEnds {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) : + IsConnected L := by + obtain ⟨e, -, -⟩ := id hL + have hrange : L = range (fun t : I => (e t).1) := by + ext x + exact ⟨fun hx => ⟨e.symm ⟨x, hx⟩, by simp⟩, by rintro ⟨t, rfl⟩; exact (e t).2⟩ + rw [hrange] + exact isConnected_range (continuous_subtype_val.comp e.continuous) + +theorem left_mem_of_isLineWithEnds {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) : a ∈ L := by + obtain ⟨e, he0, -⟩ := id hL + exact he0 ▸ (e 0).2 + +theorem right_mem_of_isLineWithEnds {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) : b ∈ L := by + obtain ⟨e, -, he1⟩ := id hL + exact he1 ▸ (e 1).2 + +/-- Pushforward of `IsLineWithEnds` along an embedding `j : S → T`. -/ +theorem image_of_isLineWithEnds {T : Type*} [TopologicalSpace T] + {j : S → T} (hj : IsEmbedding j) {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) : + IsLineWithEnds (j '' L) (j a) (j b) := by + obtain ⟨e, he0, he1⟩ := id hL + let f : I → T := fun t => j (e t).1 + have hrange : range f = j '' L := by + ext y + constructor + · rintro ⟨t, rfl⟩ + exact ⟨(e t).1, (e t).2, rfl⟩ + · rintro ⟨x, hxL, rfl⟩ + exact ⟨e.symm ⟨x, hxL⟩, by simp [f]⟩ + have hemb : IsEmbedding f := hj.comp (IsEmbedding.subtypeVal.comp e.isEmbedding) + rw [← hrange] + exact ⟨hemb.toHomeomorph, congrArg j he0, congrArg j he1⟩ + +omit [TopologicalSpace S] in +/-- Given a finite subset `V ⊆ S` and a parameterization `g : I → S` injective on `Ico 0 1`, +there is a strictly increasing partition `0 = s 0 < s 1 < ... < s r = 1` of `[0, 1]` such that +`g '' Ioo (s i) (s (i + 1))` is disjoint from `V` for all `i < r`. -/ +theorem exists_partition_of_oArc {V : Set S} (hV : V.Finite) {g : I → S} + (hg_inj_Ico : InjOn g (Ico 0 1)) : + ∃ (r : ℕ) (_ : 0 < r) (s : ℕ → I), + s 0 = 0 ∧ s r = 1 ∧ (∀ i < r, s i < s (i + 1)) ∧ + (∀ i < r, ∀ τ ∈ Ioo (s i) (s (i + 1)), g τ ∉ V) := by + classical + let S_V : Set I := (g ⁻¹' V ∩ Ico 0 1) ∪ {0, 1} + have hSV_fin : S_V.Finite := + ((hV.subset (by rintro _ ⟨s, ⟨hsV, _⟩, rfl⟩; exact hsV)).of_finite_image + (hg_inj_Ico.mono inter_subset_right)).union ((finite_singleton (1 : I)).insert 0) + let L : Finset I := hSV_fin.toFinset + have h0_L : (0 : I) ∈ L := hSV_fin.mem_toFinset.mpr (Or.inr (Or.inl rfl)) + have h1_L : (1 : I) ∈ L := hSV_fin.mem_toFinset.mpr (Or.inr (Or.inr rfl)) + have hL_card2 : 2 ≤ L.card := by + have hsub : ({0, 1} : Finset I) ⊆ L := by + intro x hx + rcases Finset.mem_insert.mp hx with rfl | hx1 + · exact h0_L + · exact (Finset.mem_singleton.mp hx1) ▸ h1_L + have hpair : ({0, 1} : Finset I).card = 2 := Finset.card_pair zero_ne_one + exact hpair ▸ Finset.card_le_card hsub + let r : ℕ := L.card - 1 + have hr : 0 < r := by omega + have hL_card : L.card = r + 1 := by omega + let emb : Fin (r + 1) ↪o I := L.orderEmbOfFin hL_card + have hemb0 : emb ⟨0, Nat.succ_pos r⟩ = 0 := by + have h0_mem : (0 : I) ∈ Set.range emb := by + rw [Finset.range_orderEmbOfFin] + exact h0_L + obtain ⟨k, hk⟩ := h0_mem + have hle : emb ⟨0, Nat.succ_pos r⟩ ≤ 0 := hk ▸ emb.monotone (Fin.zero_le k) + exact le_antisymm hle (Subtype.mk_le_mk.mpr (unitInterval.nonneg _)) + have hembr : emb ⟨r, Nat.lt_succ_self r⟩ = 1 := by + have h1_mem : (1 : I) ∈ Set.range emb := by + rw [Finset.range_orderEmbOfFin] + exact h1_L + obtain ⟨k, hk⟩ := h1_mem + have hge : (1 : I) ≤ emb ⟨r, Nat.lt_succ_self r⟩ := hk ▸ emb.monotone (Fin.le_last k) + exact le_antisymm (Subtype.mk_le_mk.mpr (unitInterval.le_one _)) hge + let s : ℕ → I := fun i => if hi : i ≤ r then emb ⟨i, Nat.lt_succ_of_le hi⟩ else 1 + refine ⟨r, hr, s, by simpa [s] using hemb0, by simp [s, hembr], ?_, ?_⟩ + · intro i hi + have hi1 : i + 1 ≤ r := hi + have hi0 : i ≤ r := Nat.le_of_succ_le hi1 + simp only [s, hi0, hi1, ↓reduceDIte] + exact emb.strictMono (Nat.lt_succ_self i) + · intro i hi τ ⟨hτ1, hτ2⟩ hτV + have hi1 : i + 1 ≤ r := hi + have hi0 : i ≤ r := Nat.le_of_succ_le hi1 + have hs0_le : (0 : I) ≤ s i := Subtype.mk_le_mk.mpr (unitInterval.nonneg _) + have hsr_le : s (i + 1) ≤ 1 := Subtype.mk_le_mk.mpr (unitInterval.le_one _) + have hτ_Ico : τ ∈ Ico (0 : I) 1 := ⟨hs0_le.trans hτ1.le, lt_of_lt_of_le hτ2 hsr_le⟩ + have hτ_L : τ ∈ L := hSV_fin.mem_toFinset.mpr (Or.inl ⟨hτV, hτ_Ico⟩) + have hτ_range : τ ∈ Set.range emb := by rwa [Finset.range_orderEmbOfFin] + obtain ⟨k, hk⟩ := hτ_range + simp only [s, hi0, hi1, ↓reduceDIte, ← hk] at hτ1 hτ2 + have hk1 : i < k.1 := emb.strictMono.lt_iff_lt.mp hτ1 + have hk2 : k.1 < i + 1 := emb.strictMono.lt_iff_lt.mp hτ2 + omega + +private theorem closed_arc_segment_solid_connected + {S : Type u} + [TopologicalSpace S] + (hS : IsSurface S) + [T2Space S] + (F : Set S) + (hF_oarc : IsOArc F) + (φ : Circle ≃ₜ ↑F) + (g : ↑I → S) + (hg_def : ∀ (s : ↑I), g s = ↑(φ ((arcParam 1) s))) + (hgc : Continuous g) + (hg_mem : ∀ (s : ↑I), g s ∈ F) + (r : ℕ) + (hr : 0 < r) + (s : ℕ → ↑I) + (hs0 : s 0 = 0) + (hsr : s r = 1) + (hs_lt : ∀ i < r, s i < s (i + 1)) + (v : ℕ → S) + (hv_def : ∀ (i : ℕ), v i = g (s i)) + (Abar : ℕ → Set S) + (hAbar_def : ∀ (i : ℕ), Abar i = g '' Icc (s i) (s (i + 1))) : + ∀ i < r, IsSolid (Abar i) ∧ IsConnected (Abar i) := by + intro i hi + by_cases hr1 : r = 1 + · have hi0 : i = 0 := by omega + subst hi0 + have hs1 : s 1 = 1 := by rw [← hr1]; exact hsr + have heq_F : Abar 0 = F := by + rw [hAbar_def, hs0, hs1] + ext z + constructor + · rintro ⟨τ, _, rfl⟩; exact hg_mem τ + · intro hz + obtain ⟨τ, hτ⟩ := arcParam_surjective 1 (φ.symm ⟨z, hz⟩) + exact ⟨τ, ⟨Subtype.mk_le_mk.mpr (unitInterval.nonneg τ), + Subtype.mk_le_mk.mpr (unitInterval.le_one τ)⟩, by simp [hg_def, hτ]⟩ + rw [heq_F] + exact ⟨isSolid_of_isOArc hS hF_oarc, isConnected_of_isOArc hF_oarc⟩ + · have h_not_01 : ¬ (s i = 0 ∧ s (i + 1) = 1) := by + rintro ⟨hsi0, hsi1⟩ + rcases eq_or_lt_of_le (Nat.zero_le i) with rfl | hi_pos + · have hlt := hs_lt 1 (by omega) + have hle : s 2 ≤ 1 := Subtype.mk_le_mk.mpr (unitInterval.le_one (s 2)) + rw [hsi1] at hlt + exact not_lt_of_ge hle hlt + · have h0_lt : s 0 < s i := by + clear hsi0 hsi1 + induction i, hi_pos using Nat.le_induction with + | base => exact hs_lt 0 (by omega) + | succ k hk ih => exact (ih (by omega)).trans (hs_lt k (by omega)) + rw [hs0, hsi0] at h0_lt + exact lt_irrefl 0 h0_lt + have hinj_Icc : InjOn g (Icc (s i) (s (i + 1))) := by + intro τ₁ hτ₁ τ₂ hτ₂ heq + rw [hg_def, hg_def] at heq + have hφ_eq : φ (arcParam 1 τ₁) = φ (arcParam 1 τ₂) := Subtype.ext heq + rcases arcParam_eq_iff 1 (φ.injective hφ_eq) with h | ⟨h0, h1⟩ | ⟨h1, h0⟩ + · exact h + · exfalso + have hsi0 : s i = 0 := + le_antisymm (h0 ▸ hτ₁.1) (Subtype.mk_le_mk.mpr (unitInterval.nonneg _)) + have hsi1 : s (i + 1) = 1 := + le_antisymm (Subtype.mk_le_mk.mpr (unitInterval.le_one _)) (h1 ▸ hτ₂.2) + exact h_not_01 ⟨hsi0, hsi1⟩ + · exfalso + have hsi0 : s i = 0 := + le_antisymm (h0 ▸ hτ₂.1) (Subtype.mk_le_mk.mpr (unitInterval.nonneg _)) + have hsi1 : s (i + 1) = 1 := + le_antisymm (Subtype.mk_le_mk.mpr (unitInterval.le_one _)) (h1 ▸ hτ₁.2) + exact h_not_01 ⟨hsi0, hsi1⟩ + have hline : IsLineWithEnds (Abar i) (v i) (v (i + 1)) := by + rw [hAbar_def, hv_def, hv_def] + exact isLineWithEnds_image_Icc_of_injOn hgc (hs_lt i hi) hinj_Icc + exact ⟨isSolid_of_isLineWithEnds hS hline, isConnected_of_isLineWithEnds hline⟩ + +private theorem short_return_arc_for_subdivision + {S : Type u} + [TopologicalSpace S] + {G : Drawing S} + {F₀ : Set S} + (hF₀_oarc : IsOArc F₀) + {t : ℕ} + [T2Space S] + (r : ℕ) + (v : ℕ → S) + (u : ℕ → S) + (P : ℕ → Set S) + (hP_props : ∀ i ≤ r, u i ∈ F₀ ∧ IsLineWithEnds (P i) (v i) (u i) ∧ G.IsNormal (P i) ∧ (G.V ∩ P + i).ncard ≤ t + 1) : + ∀ i : ℕ, ∃ B : Set S, i < r → + (u i = u (i + 1) ∧ B = ∅ ∨ + u i ≠ u (i + 1) ∧ B ∈ componentsIn (F₀ \ {u i, u (i + 1)}) ∧ + IsLineWithEnds (B ∪ {u i, u (i + 1)}) (u i) (u (i + 1))) ∧ + B ⊆ F₀ ∧ 2 * (G.V ∩ B).ncard ≤ (G.V ∩ F₀).ncard := by + intro i + by_cases hi : i < r + · by_cases hueq : u i = u (i + 1) + · exact ⟨∅, fun _ => ⟨Or.inl ⟨hueq, rfl⟩, empty_subset _, by simp⟩⟩ + · obtain ⟨B, hB_comp, hB_sub, hB_card, hB_line⟩ := + exists_short_component_oArc_diff_pair hF₀_oarc G.finite_V + (hP_props i hi.le).1 (hP_props (i + 1) hi).1 hueq + exact ⟨B, fun _ => ⟨Or.inr ⟨hueq, hB_comp, hB_line⟩, hB_sub, hB_card⟩⟩ + · exact ⟨∅, fun h => False.elim (hi h)⟩ + +private theorem subdivision_cycle_planar_in_cap + {S : Type u} + [TopologicalSpace S] + (hS : IsSurface S) + [ConnectedSpace S] + (hnot_small : ∀ c ≤ 2, IsEmpty (S ≃ₜ SurfaceModel 0 0 c)) + {G : Drawing S} + {C : Set S} + {F₀ : Set S} + (hC : C ∈ cuffs S) + (hF₀_oarc : IsOArc F₀) + (hF₀_norm : G.IsNormal F₀) + (hF₀_surr : SurroundsCuff F₀ C) + {t : ℕ} + (ht_low : (G.V ∩ F₀).ncard ≤ t) + (ht_high : 9 * (t + 1) ≤ 2 * alpha G) + (S' : Type u) + [TopologicalSpace S'] + (j : S → S') + (D : Set S') + (hCap : IsCappedCuff C S' j D) + (F : Set S) + (hF_norm : G.IsNormal F) + (g : ↑I → S) + (hg_mem : ∀ (s : ↑I), g s ∈ F) + (r : ℕ) + (s : ℕ → ↑I) + (hs_disj_V : ∀ i < r, ∀ τ ∈ Ioo (s i) (s (i + 1)), g τ ∉ G.V) + (v : ℕ → S) + (u : ℕ → S) + (P : ℕ → Set S) + (hP_wrap : P 0 = P r ∧ u 0 = u r) + (hP_props : ∀ i ≤ r, u i ∈ F₀ ∧ IsLineWithEnds (P i) (v i) (u i) ∧ G.IsNormal (P i) ∧ (G.V ∩ P + i).ncard ≤ t + 1) + (A : ℕ → Set S) + (hA_def : ∀ (i : ℕ), A i = g '' Ioo (s i) (s (i + 1))) + (Abar : ℕ → Set S) + (hAbar_eq : ∀ i < r, Abar i = A i ∪ {v i, v (i + 1)}) + (hAbar_sol_conn : ∀ i < r, IsSolid (Abar i) ∧ IsConnected (Abar i)) + (B : ℕ → Set S) + (hB_props : ∀ i < r, (u i = u (i + 1) ∧ B i = ∅ ∨ u i ≠ u (i + 1) ∧ B i ∈ componentsIn (F₀ \ + {u i, u (i + 1)}) ∧ IsLineWithEnds (B i ∪ {u i, u (i + 1)}) (u i) (u (i + 1))) ∧ B i ⊆ F₀ ∧ + 2 * (G.V ∩ B i).ncard ≤ (G.V ∩ F₀).ncard) : + ∀ i < r, IsPlanar (j '' (P i ∪ P (i + 1) ∪ A i ∪ B i)) := by + intro i hi + obtain ⟨Ci, hCi_def⟩ : ∃ Ci : Set S, Ci = P i ∪ P (i + 1) ∪ A i ∪ B i := ⟨_, rfl⟩ + rw [← hCi_def] + have hPi := hP_props i hi.le + have hPi1 := hP_props (i + 1) hi + have hBi := hB_props i hi + have hCi_3 : P i ∪ P (i + 1) ∪ A i = P i ∪ P (i + 1) ∪ Abar i := by + rw [hAbar_eq i hi] + ext z + simp only [mem_union, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ((h1 | h2) | h3) + · exact Or.inl (Or.inl h1) + · exact Or.inl (Or.inr h2) + · exact Or.inr (Or.inl h3) + · rintro ((h1 | h2) | (h3 | (rfl | rfl))) + · exact Or.inl (Or.inl h1) + · exact Or.inl (Or.inr h2) + · exact Or.inr h3 + · exact Or.inl (Or.inl (left_mem_of_isLineWithEnds hPi.2.1)) + · exact Or.inl (Or.inr (left_mem_of_isLineWithEnds hPi1.2.1)) + have h3_sol : IsSolid (P i ∪ P (i + 1) ∪ A i) := by + rw [hCi_3] + exact theorem_11_6_proof hS + (theorem_11_6_proof hS (isSolid_of_isLineWithEnds hS hPi.2.1) + (isSolid_of_isLineWithEnds hS hPi1.2.1)) + (hAbar_sol_conn i hi).1 + have h3_conn : IsConnected (P i ∪ P (i + 1) ∪ A i) := by + rw [hCi_3] + have h_PA : IsConnected (P i ∪ Abar i) := by + refine ⟨⟨v i, Or.inl (left_mem_of_isLineWithEnds hPi.2.1)⟩, + (isConnected_of_isLineWithEnds hPi.2.1).2.union' ⟨v i, left_mem_of_isLineWithEnds + hPi.2.1, ?_⟩ (hAbar_sol_conn i hi).2.2⟩ + rw [hAbar_eq i hi] + exact Or.inr (Or.inl rfl) + have h_eq_ord : P i ∪ P (i + 1) ∪ Abar i = (P i ∪ Abar i) ∪ P (i + 1) := by + ext z + simp only [mem_union] + tauto + rw [h_eq_ord] + refine ⟨⟨v (i + 1), Or.inr (left_mem_of_isLineWithEnds hPi1.2.1)⟩, + h_PA.2.union' ⟨v (i + 1), Or.inr ?_, left_mem_of_isLineWithEnds hPi1.2.1⟩ + (isConnected_of_isLineWithEnds hPi1.2.1).2⟩ + rw [hAbar_eq i hi] + exact Or.inr (Or.inr rfl) + have hCi_sol_conn : IsSolid Ci ∧ IsConnected Ci := by + rcases hBi.1 with ⟨_, hB_emp⟩ | ⟨_, _, hB_line⟩ + · rw [hCi_def, hB_emp, union_empty] + exact ⟨h3_sol, h3_conn⟩ + · have hCi_4 : Ci = (P i ∪ P (i + 1) ∪ A i) ∪ (B i ∪ {u i, u (i + 1)}) := by + rw [hCi_def] + ext z + simp only [mem_union, mem_insert_iff, mem_singleton_iff] + constructor + · rintro (((h1 | h2) | h3) | h4) + · exact Or.inl (Or.inl (Or.inl h1)) + · exact Or.inl (Or.inl (Or.inr h2)) + · exact Or.inl (Or.inr h3) + · exact Or.inr (Or.inl h4) + · rintro (((h1 | h2) | h3) | (h4 | (rfl | rfl))) + · exact Or.inl (Or.inl (Or.inl h1)) + · exact Or.inl (Or.inl (Or.inr h2)) + · exact Or.inl (Or.inr h3) + · exact Or.inr h4 + · exact Or.inl (Or.inl (Or.inl (right_mem_of_isLineWithEnds hPi.2.1))) + · exact Or.inl (Or.inl (Or.inr (right_mem_of_isLineWithEnds hPi1.2.1))) + rw [hCi_4] + refine ⟨theorem_11_6_proof hS h3_sol (isSolid_of_isLineWithEnds hS hB_line), + ⟨⟨u i, Or.inl (Or.inl (Or.inl (right_mem_of_isLineWithEnds hPi.2.1)))⟩, + h3_conn.2.union' ⟨u i, Or.inl (Or.inl (right_mem_of_isLineWithEnds hPi.2.1)), Or.inr + (Or.inl rfl)⟩ + (isConnected_of_isLineWithEnds hB_line).2⟩⟩ + have hCi_norm : G.IsNormal Ci := by + rw [hCi_def, hA_def] + rintro z ⟨((hz1 | hz2) | ⟨τ, _, rfl⟩) | hz4, hzU⟩ + · exact hPi.2.2.1 ⟨hz1, hzU⟩ + · exact hPi1.2.2.1 ⟨hz2, hzU⟩ + · exact hF_norm ⟨hg_mem τ, hzU⟩ + · exact hF₀_norm ⟨hBi.2.1 hz4, hzU⟩ + have hCi_V_sub : G.V ∩ Ci ⊆ (G.V ∩ P i) ∪ (G.V ∩ P (i + 1)) ∪ (G.V ∩ B i) := by + rw [hCi_def, hA_def] + rintro z ⟨hzV, ((hz1 | hz2) | ⟨τ, hτ, rfl⟩) | hz4⟩ + · exact Or.inl (Or.inl ⟨hzV, hz1⟩) + · exact Or.inl (Or.inr ⟨hzV, hz2⟩) + · exact False.elim (hs_disj_V i hi τ hτ hzV) + · exact Or.inr ⟨hzV, hz4⟩ + have hB_card : (G.V ∩ B i).ncard ≤ t / 2 := by + have h2 : 2 * (G.V ∩ B i).ncard ≤ t := hBi.2.2.trans ht_low + omega + let m_bound : ℕ := 2 * t + t / 2 + 2 + have hCi_card : (G.V ∩ Ci).ncard ≤ m_bound := by + calc (G.V ∩ Ci).ncard + _ ≤ ((G.V ∩ P i) ∪ (G.V ∩ P (i + 1)) ∪ (G.V ∩ B i)).ncard := + ncard_le_ncard hCi_V_sub + (((G.finite_V.inter_of_left _).union (G.finite_V.inter_of_left _)).union + (G.finite_V.inter_of_left _)) + _ ≤ ((G.V ∩ P i) ∪ (G.V ∩ P (i + 1))).ncard + (G.V ∩ B i).ncard := ncard_union_le _ _ + _ ≤ (G.V ∩ P i).ncard + (G.V ∩ P (i + 1)).ncard + (G.V ∩ B i).ncard := + Nat.add_le_add_right (ncard_union_le _ _) _ + _ ≤ (t + 1) + (t + 1) + t / 2 := + Nat.add_le_add (Nat.add_le_add hPi.2.2.2 hPi1.2.2.2) hB_card + _ = m_bound := by omega + have hCi_np : IsNearPlanar Ci := by + by_contra hnot_np + have hcand : IsAlphaCandidate G Ci := ⟨hCi_sol_conn.1, hCi_sol_conn.2, hCi_norm, hnot_np⟩ + have h_le_alpha : alpha G ≤ (Ci ∩ G.V).ncard := Nat.sInf_le ⟨Ci, hcand, rfl⟩ + rw [inter_comm Ci G.V] at h_le_alpha + omega + have hCi_capped : IsPlanarInCappedCuff C Ci := by + by_cases hpl : IsPlanar Ci + · exact isPlanarInCappedCuff_of_isPlanar hS hC hpl + · rcases hCi_np with hpl' | ⟨C', hC', hplC'⟩ + · exact False.elim (hpl hpl') + · rcases eq_or_ne C' C with rfl | hC'C + · exact hplC' + · exfalso + have hnot_cyl : ¬ Nonempty (S ≃ₜ SurfaceModel 0 0 2) := by + rintro ⟨e⟩ + exact (hnot_small 2 le_rfl).false e + have h_empty := theorem_5_3_proof hS hnot_cyl G hC' hC hC'C (r := m_bound) (r' := t) + (by omega) + have hui_C' : u i ∈ scriptA G m_bound C' := by + refine mem_sUnion.mpr ⟨Ci, ⟨hCi_sol_conn.1, hCi_sol_conn.2, hCi_norm, + ⟨hC', hplC', hpl⟩, hCi_card⟩, ?_⟩ + rw [hCi_def] + exact Or.inl (Or.inl (Or.inl (right_mem_of_isLineWithEnds hPi.2.1))) + have hui_C : u i ∈ scriptA G t C := by + refine mem_sUnion.mpr ⟨F₀, ⟨isSolid_of_isOArc hS hF₀_oarc, + isConnected_of_isOArc hF₀_oarc, hF₀_norm, + hF₀_surr, ht_low⟩, hPi.1⟩ + have hui_inter : u i ∈ scriptA G m_bound C' ∩ scriptA G t C := ⟨hui_C', hui_C⟩ + rw [h_empty] at hui_inter + exact hui_inter + exact hCi_capped.2.2 S' j D hCap + +/-- Graph Minors VII, (5.6) (page 232): +"Let $\Sigma$ be a connected surface such that $\Sigma \not\cong \Sigma(0, 0, c)(c = 0, 1, +2)$, and let $G$ be a proper graph in $\Sigma$. Let $C$ be a cuff of $\Sigma$, and let $F_0$ +be a $G$-normal $O$-arc surrounding $C$. Let $t$ be an integer with* $$ |V(G) \cap F_0| \le +t \le \frac{2}{9}\alpha(G) - 1. $$ *Then $Y_t(F_0)$ is planar in $\Sigma + \hat{C}$." -/ +theorem theorem_5_6_proof + (hS : IsSurface S) [ConnectedSpace S] + (hnot_small : ∀ c ≤ 2, IsEmpty (S ≃ₜ SurfaceModel 0 0 c)) + {G : Drawing S} (hG : G.IsProper) + {C F₀ : Set S} (hC : C ∈ cuffs S) + (hF₀_oarc : IsOArc F₀) (hF₀_norm : G.IsNormal F₀) (hF₀_surr : SurroundsCuff F₀ C) + {t : ℕ} (ht_low : (G.V ∩ F₀).ncard ≤ t) (ht_high : 9 * (t + 1) ≤ 2 * alpha G) : + IsPlanarInCappedCuff C (nearSet G t F₀) := by + classical + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + let Z : Set S := closure (nearSet G t F₀) + let ℛ : Set (Set S) := {r ∈ G.R | r ⊆ nearSet G t F₀} + have hZ : Z = closure (⋃₀ ℛ) := closure_nearSet_eq_closure_sUnion_regions hS hG hF₀_norm t + suffices hZ_pl : IsPlanarInCappedCuff C Z from hZ_pl.mono subset_closure + have h_all : ∀ (S' : Type u) [TopologicalSpace S'] (j : S → S') (D : Set S'), + IsCappedCuff C S' j D → IsPlanar (j '' Z) := by + intro S' _ j D hCap + rw [theorem_5_5_cappedCuff hS hG (sep_subset _ _) hZ hCap] + intro F hFZ hF_norm hF_oarc + obtain ⟨φ⟩ := id hF_oarc + obtain ⟨g, hg_def⟩ : ∃ g : I → S, ∀ s : I, g s = (φ (arcParam 1 s)).1 := ⟨_, fun _ => rfl⟩ + have hgc : Continuous g := by + have : g = fun s => (φ (arcParam 1 s)).1 := funext hg_def + rw [this] + exact continuous_subtype_val.comp (φ.continuous.comp (arcParam 1).continuous) + have hg01 : g 0 = g 1 := by simp [hg_def] + have hg_mem : ∀ s : I, g s ∈ F := fun s => hg_def s ▸ (φ (arcParam 1 s)).2 + have hg_inj_Ico : InjOn g (Ico 0 1) := by + intro s₁ hs₁ s₂ hs₂ heq + rw [hg_def, hg_def] at heq + have hφ_eq : φ (arcParam 1 s₁) = φ (arcParam 1 s₂) := Subtype.ext heq + rcases arcParam_eq_iff 1 (φ.injective hφ_eq) with h | ⟨_, h1⟩ | ⟨h1, _⟩ + · exact h + · exact False.elim (ne_of_lt hs₂.2 h1) + · exact False.elim (ne_of_lt hs₁.2 h1) + obtain ⟨r, hr, s, hs0, hsr, hs_lt, hs_disj_V⟩ := + exists_partition_of_oArc G.finite_V hg_inj_Ico + have hs_mono : ∀ i < r, s i ≤ s (i + 1) := fun i hi => (hs_lt i hi).le + obtain ⟨v, hv_def⟩ : ∃ v : ℕ → S, ∀ i, v i = g (s i) := ⟨_, fun _ => rfl⟩ + have hv_eq : ∀ i ≤ r, v i = (φ (arcParam 1 (s i))).1 := fun i _ => by rw [hv_def, hg_def] + have hv0r : v 0 = v r := by rw [hv_def, hv_def, hs0, hsr, hg01] + have hex_uP : ∀ i : ℕ, ∃ (u : S) (P : Set S), u ∈ F₀ ∧ IsLineWithEnds P (v i) u ∧ + G.IsNormal P ∧ (G.V ∩ P).ncard ≤ t + 1 := by + intro i + have hvi_F : v i ∈ F := hv_def i ▸ hg_mem (s i) + exact exists_normal_arc_to_F0 hS hG hF₀_oarc hF₀_norm (hFZ hvi_F) + (fun ⟨hU, hV⟩ => hV (hF_norm ⟨hvi_F, hU⟩)) + choose u₀ P₀ hu₀_F₀ hP₀_line hP₀_norm hP₀_card using hex_uP + obtain ⟨u, P, hP_wrap, hP_props⟩ : ∃ (u : ℕ → S) (P : ℕ → Set S), + (P 0 = P r ∧ u 0 = u r) ∧ + (∀ i ≤ r, u i ∈ F₀ ∧ IsLineWithEnds (P i) (v i) (u i) ∧ + G.IsNormal (P i) ∧ (G.V ∩ P i).ncard ≤ t + 1) := by + refine ⟨fun i => if i = r then u₀ 0 else u₀ i, + fun i => if i = r then P₀ 0 else P₀ i, ?_, ?_⟩ + · dsimp only + have h0r : (0 : ℕ) ≠ r := ne_of_lt hr + simp [h0r] + · intro i hi + dsimp only + split_ifs with h + · subst h + exact ⟨hu₀_F₀ 0, hv0r ▸ hP₀_line 0, hP₀_norm 0, hP₀_card 0⟩ + · exact ⟨hu₀_F₀ i, hP₀_line i, hP₀_norm i, hP₀_card i⟩ + obtain ⟨A, hA_def⟩ : ∃ A : ℕ → Set S, ∀ i, A i = g '' Ioo (s i) (s (i + 1)) := + ⟨_, fun _ => rfl⟩ + obtain ⟨Abar, hAbar_def⟩ : ∃ Abar : ℕ → Set S, ∀ i, Abar i = g '' Icc (s i) (s (i + 1)) := + ⟨_, fun _ => rfl⟩ + have hAbar_eq : ∀ i < r, Abar i = A i ∪ {v i, v (i + 1)} := by + intro i hi + rw [hAbar_def, hA_def, hv_def, hv_def] + ext z + constructor + · rintro ⟨τ, ⟨h1, h2⟩, rfl⟩ + rcases eq_or_lt_of_le h1 with rfl | h1' + · exact Or.inr (Or.inl rfl) + · rcases eq_or_lt_of_le h2 with rfl | h2' + · exact Or.inr (Or.inr rfl) + · exact Or.inl ⟨τ, ⟨h1', h2'⟩, rfl⟩ + · rintro (⟨τ, ⟨h1, h2⟩, rfl⟩ | (rfl | hz)) + · exact ⟨τ, ⟨h1.le, h2.le⟩, rfl⟩ + · exact ⟨s i, ⟨le_rfl, (hs_lt i hi).le⟩, rfl⟩ + · rw [mem_singleton_iff.mp hz] + exact ⟨s (i + 1), ⟨(hs_lt i hi).le, le_rfl⟩, rfl⟩ + have hAbar_sol_conn : ∀ i < r, IsSolid (Abar i) ∧ IsConnected (Abar i) := by + exact closed_arc_segment_solid_connected (S := S) hS F hF_oarc + φ g hg_def hgc hg_mem r hr s hs0 hsr hs_lt v hv_def Abar hAbar_def + have hex_B : ∀ i : ℕ, ∃ B : Set S, + i < r → + (((u i = u (i + 1) ∧ B = ∅) ∨ + (u i ≠ u (i + 1) ∧ B ∈ componentsIn (F₀ \ {u i, u (i + 1)}) ∧ + IsLineWithEnds (B ∪ {u i, u (i + 1)}) (u i) (u (i + 1)))) ∧ + B ⊆ F₀ ∧ 2 * (G.V ∩ B).ncard ≤ (G.V ∩ F₀).ncard) := by + exact short_return_arc_for_subdivision (S := S) (G := G) (F₀ := F₀) hF₀_oarc (t := t) r v u + P hP_props + choose B hB_props using hex_B + -- Prove each C_i = P i ∪ P (i + 1) ∪ A i ∪ B i is planar in Σ + Ĉ + have hCi_planar : ∀ i < r, IsPlanar (j '' (P i ∪ P (i + 1) ∪ A i ∪ B i)) := by + exact subdivision_cycle_planar_in_cap (S := S) hS hnot_small (G := G) (C := C) (F₀ := F₀) hC + hF₀_oarc hF₀_norm hF₀_surr (t := t) ht_low ht_high S' j D hCap F hF_norm g hg_mem r s + hs_disj_V v u P hP_wrap hP_props A hA_def Abar hAbar_eq hAbar_sol_conn B hB_props + -- Apply (5.4) in S' + have hS' : IsSurface S' := hCap.isSurface + have : T2Space S' := hS'.2.1 + have hj_emb : IsEmbedding j := hCap.isEmbedding + have hjF_oarc : IsOArc (j '' F) := + isOArc_image hF_oarc hj_emb.continuous.continuousOn hj_emb.injective.injOn + have hjF₀_oarc : IsOArc (j '' F₀) := + isOArc_image hF₀_oarc hj_emb.continuous.continuousOn hj_emb.injective.injOn + have hjF₀_null : IsNullHomotopicOArc (j '' F₀) := + (isPlanar_iff_isNullHomotopicOArc_of_isOArc hS' hjF₀_oarc).mp + (hF₀_surr.2.1.2.2 S' j D hCap) + have hrange_jF : range (j ∘ (Subtype.val : F → S)) = j '' F := by + ext y + exact ⟨by rintro ⟨x, rfl⟩; exact ⟨x.1, x.2, rfl⟩, + by rintro ⟨x, hxF, rfl⟩; exact ⟨⟨x, hxF⟩, rfl⟩⟩ + let jF_homeo : F ≃ₜ j '' F := + (hj_emb.comp IsEmbedding.subtypeVal).toHomeomorph.trans (Homeomorph.setCongr hrange_jF) + let φ' : Circle ≃ₜ j '' F := φ.trans jF_homeo + let v' : ℕ → S' := fun i => j (v i) + let u' : ℕ → S' := fun i => j (u i) + let A' : ℕ → Set S' := fun i => j '' A i + let P' : ℕ → Set S' := fun i => j '' P i + let B' : ℕ → Set S' := fun i => j '' B i + refine theorem_5_4_proof hS' hjF_oarc hjF₀_oarc hjF₀_null hr φ' s hs0 hsr hs_mono v' u' A' P' B' + (fun i hi => by + change j (v i) = j (φ (arcParam 1 (s i))).1 + exact congrArg j (hv_eq i hi)) + (fun i hi => ?_) + (fun i hi => ⟨image_of_isLineWithEnds hj_emb (hP_props i hi).2.1, + mem_image_of_mem j (hP_props i hi).1⟩) + ⟨congrArg (j '' ·) hP_wrap.1, congrArg j hP_wrap.2⟩ + (fun i hi => ?_) + (fun i hi => ?_) + · dsimp only [A'] + rw [hA_def] + refine ⟨?_, image_mono (by rintro _ ⟨τ, _, rfl⟩; exact hg_mem τ)⟩ + rintro _ ⟨τ, hτ, rfl⟩ + refine ⟨g τ, ⟨τ, hτ, rfl⟩, ?_⟩ + change j (g τ) = j (φ (arcParam 1 τ)).1 + exact congrArg j (hg_def τ) + · rcases (hB_props i hi).1 with ⟨hueq, hBemp⟩ | ⟨hune, hBcomp, _⟩ + · exact Or.inl ⟨congrArg j hueq, by simp [B', hBemp]⟩ + · refine Or.inr ⟨fun h => hune (hj_emb.injective h), ?_⟩ + have h_diff_eq : j '' F₀ \ {u' i, u' (i + 1)} = j '' (F₀ \ {u i, u (i + 1)}) := by + ext y + constructor + · rintro ⟨⟨x, hxF₀, rfl⟩, hy_end⟩ + refine ⟨x, ⟨hxF₀, ?_⟩, rfl⟩ + rintro (rfl | h) + · exact hy_end (Or.inl rfl) + · exact hy_end (Or.inr (mem_singleton_iff.mpr (congrArg j (mem_singleton_iff.mp h)))) + · rintro ⟨x, ⟨hxF₀, hx_end⟩, rfl⟩ + refine ⟨⟨x, hxF₀, rfl⟩, ?_⟩ + rintro (h | h) + · exact hx_end (Or.inl (hj_emb.injective h)) + · exact hx_end (Or.inr (mem_singleton_iff.mpr (hj_emb.injective + (mem_singleton_iff.mp h)))) + rw [h_diff_eq] + exact image_mem_componentsIn_of_isEmbedding hj_emb hBcomp + · have heq_img : P' i ∪ P' (i + 1) ∪ A' i ∪ B' i = j '' (P i ∪ P (i + 1) ∪ A i ∪ B i) := by + simp only [P', A', B', image_union] + rw [heq_img] + exact hCi_planar i hi + obtain ⟨c₀, _⟩ := isOArc_nonempty (cuff_isOArc hS hC) + have : Nonempty S := ⟨c₀⟩ + obtain ⟨S', topS', j, D, hS', hj, hD, hunion, hinter, hbdD⟩ := paste_disc S C hS hC + have hCap : IsCappedCuff C S' j D := ⟨hC, hS', hj.isEmbedding, hD, hbdD.1, hunion, hinter⟩ + exact ⟨hC, ⟨S', topS', j, D, hCap, h_all S' j D hCap⟩, h_all⟩ + +/-! ## 5. Proof of (5.7) -/ + +/-- If `F ⊆ S` is a `G`-normal set with `(G.V ∩ F).ncard ≤ r`, then `F ⊆ nearSet G r F`. -/ +theorem subset_nearSet_of_isNormal {G : Drawing S} {F : Set S} (hF_norm : G.IsNormal F) + {r : ℕ} (hr : (G.V ∩ F).ncard ≤ r) : + F ⊆ nearSet G r F := by + intro y hyF + refine ⟨y, hyF, ?_⟩ + by_cases hyU : y ∈ G.U + · have hyV : y ∈ G.V ∩ F := ⟨hF_norm ⟨hyF, hyU⟩, hyF⟩ + have h1 : 1 ≤ (G.V ∩ F).ncard := by + have hsub : ({y} : Set S) ⊆ G.V ∩ F := singleton_subset_iff.mpr hyV + simpa using ncard_le_ncard hsub (G.finite_V.inter_of_left F) + have hdyy : distPoint G y y = 1 := by simp [distPoint, hyU] + omega + · have hdyy : distPoint G y y = 0 := by simp [distPoint, hyU] + omega + +/-- In any capped cuff `(S', j, D)` of `C`, an `O`-arc `F` surrounding `C` bounds a closed disc +`Δ ⊆ S'` with `discBd Δ = j '' F` and `discInt D ⊆ discInt Δ`. -/ +theorem surroundsCuff_bounds_disc_containing_cap + (hS : IsSurface S) [ConnectedSpace S] + {C F : Set S} (hF : IsOArc F) (hFC : SurroundsCuff F C) + {S' : Type u} [TopologicalSpace S'] {j : S → S'} {D : Set S'} + (hCap : IsCappedCuff C S' j D) : + ∃ Δ : Set S', IsClosedDisc Δ ∧ discBd Δ = j '' F ∧ discInt D ⊆ discInt Δ := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hS' : IsSurface S' := hCap.isSurface + have : CompactSpace S' := hS'.1 + have : T2Space S' := hS'.2.1 + have : ConnectedSpace S' := hCap.connectedSpace hS + have hj : IsEmbedding j := hCap.isEmbedding + have hD : IsClosedDisc D := hCap.isClosedDisc + have hbdD : discBd D = j '' C := hCap.discBd_eq + have hmeet : range j ∩ D = j '' C := hCap.inter_eq + have hcov : range j ∪ D = univ := hCap.union_eq + have hjF_oarc : IsOArc (j '' F) := + isOArc_image hF hj.continuous.continuousOn hj.injective.injOn + have hjF_pl : IsPlanar (j '' F) := hFC.2.1.2.2 S' j D hCap + have hjF_null : IsNullHomotopicOArc (j '' F) := + (isPlanar_iff_isNullHomotopicOArc_of_isOArc hS' hjF_oarc).mp hjF_pl + obtain ⟨Δ, hΔ_disc, hΔ_bd⟩ := nullHomotopicOArc_bounds_disc hS' hjF_oarc hjF_null + have hdisj_int : Disjoint (discInt D) (discBd Δ) := by + rw [hΔ_bd] + refine disjoint_left.mpr ?_ + rintro _ ⟨hxD, hxbd⟩ ⟨x, _, rfl⟩ + have : j x ∈ range j ∩ D := ⟨mem_range_self x, hxD⟩ + rw [hmeet, ← hbdD] at this + exact hxbd this + have h_int_sub : discInt D ⊆ discInt Δ := by + rcases hΔ_disc.side hS'.2.2 hD.isPreconnected_discInt hdisj_int with hsub | hdisj + · exact hsub + · exfalso + have hΔ_range : Δ ⊆ range j := by + intro y hy + rcases (hcov ▸ mem_univ y : y ∈ range j ∪ D) with hy_r | hy_D + · exact hy_r + · by_cases hy_bd : y ∈ discBd D + · rw [hbdD, ← hmeet] at hy_bd + exact hy_bd.1 + · exact (disjoint_right.mp hdisj hy ⟨hy_D, hy_bd⟩).elim + obtain ⟨φΔ⟩ := id hΔ_disc + have hpre_disc : IsClosedDisc (j ⁻¹' Δ) := by + refine ⟨Homeomorph.trans φΔ ?_⟩ + have h_inv_cont : Continuous (fun x : (j ⁻¹' Δ : Set S) => (⟨j x.1, x.2⟩ : Δ)) := + Continuous.subtype_mk (hj.continuous.comp continuous_subtype_val) _ + have : CompactSpace (j ⁻¹' Δ : Set S) := + isCompact_iff_compactSpace.mp (hΔ_disc.isCompact.isClosed.preimage + hj.continuous).isCompact + exact (h_inv_cont.homeoOfEquivCompactToT2 (f := { + toFun := fun x => ⟨j x.1, x.2⟩ + invFun := fun z => ⟨Classical.choose (hΔ_range z.2), by + have hspec := Classical.choose_spec (hΔ_range z.2) + simp [hspec]⟩ + left_inv := fun x => Subtype.ext (hj.injective + (Classical.choose_spec (hΔ_range x.2))) + right_inv := fun z => Subtype.ext (Classical.choose_spec (hΔ_range z.2)) })).symm + have hF_sub : F ⊆ j ⁻¹' Δ := by + intro x hx + have : j x ∈ discBd Δ := hΔ_bd ▸ mem_image_of_mem j hx + exact Surface.discBd_subset Δ this + exact hFC.2.2 ⟨j ⁻¹' Δ, hpre_disc, hF_sub⟩ + exact ⟨Δ, hΔ_disc, hΔ_bd, h_int_sub⟩ + +/-- Pulling back a `[0, 1]`-arc along an embedding `j : S → T` when the arc lies in `range j`. -/ +theorem pull_of_isLineWithEnds [T2Space S] {T : Type*} [TopologicalSpace T] + {j : S → T} (hj : IsEmbedding j) {L : Set T} {a b : S} + (hL : IsLineWithEnds L (j a) (j b)) (hsub : L ⊆ range j) : + IsLineWithEnds (j ⁻¹' L) a b ∧ j '' (j ⁻¹' L) = L := by + have himg : j '' (j ⁻¹' L) = L := image_preimage_eq_of_subset hsub + obtain ⟨e, he0, he1⟩ := id hL + have hex : ∀ t : I, ∃ x ∈ j ⁻¹' L, j x = (e t).1 := by + intro t + obtain ⟨x, hx⟩ := hsub (e t).2 + exact ⟨x, by change j x ∈ L; rw [hx]; exact (e t).2, hx⟩ + choose f hf_mem hf_eq using hex + have hfc : Continuous f := hj.continuous_iff.mpr (by + have : j ∘ f = Subtype.val ∘ e := funext hf_eq + rw [this] + exact continuous_subtype_val.comp e.continuous) + have hfinj : Function.Injective f := fun t₁ t₂ h => by + have : (e t₁).1 = (e t₂).1 := by rw [← hf_eq t₁, ← hf_eq t₂, h] + exact e.injective (Subtype.ext this) + have hrange : range f = j ⁻¹' L := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact hf_mem t + · intro hx + let t := e.symm ⟨j x, hx⟩ + refine ⟨t, hj.injective ?_⟩ + rw [hf_eq t] + simp [t] + have hemb : IsEmbedding f := (hfc.isClosedEmbedding hfinj).isEmbedding + refine ⟨?_, himg⟩ + rw [← hrange] + refine ⟨hemb.toHomeomorph, ?_, ?_⟩ + · exact hj.injective (by change j (f 0) = j a; rw [hf_eq 0, he0]) + · exact hj.injective (by change j (f 1) = j b; rw [hf_eq 1, he1]) + +/-- If `Δ, Δ'` are closed discs in a surface `S'` with `Δ ⊆ discInt Δ'`, then there is a `[0, +1]`-arc +`Q₁ ⊆ Δ'` with one end `p ∈ discBd Δ'` and the other end `q ∈ discBd Δ` such that +`Q₁ \ {p} ⊆ discInt Δ'` and `Q₁ \ {q} ⊆ Δ' \ Δ`. -/ +theorem exists_subarc_in_annulus {S' : Type u} [TopologicalSpace S'] (hS' : IsSurface S') + {Δ Δ' : Set S'} (hΔ : IsClosedDisc Δ) (hΔ' : IsClosedDisc Δ') + (hsub : Δ ⊆ discInt Δ') : + ∃ (Q₁ : Set S') (p q : S'), + p ∈ discBd Δ' ∧ q ∈ discBd Δ ∧ IsLineWithEnds Q₁ p q ∧ + Q₁ ⊆ Δ' \ discInt Δ ∧ Q₁ \ {p, q} ⊆ discInt Δ' \ Δ := by + have : T2Space S' := hS'.2.1 + obtain ⟨z₀, hz₀_bd⟩ := isOArc_nonempty hΔ'.isOArc_discBd + obtain ⟨y₀, hy₀_bd⟩ := isOArc_nonempty hΔ.isOArc_discBd + have hz₀_Δ' : z₀ ∈ Δ' := Surface.discBd_subset Δ' hz₀_bd + have hy₀_Δ : y₀ ∈ Δ := Surface.discBd_subset Δ hy₀_bd + have hy₀_Δ' : y₀ ∈ Δ' := (hsub hy₀_Δ).1 + have hz₀_not_Δ : z₀ ∉ Δ := fun h => (hsub h).2 hz₀_bd + have hne_zy : z₀ ≠ y₀ := fun h => hz₀_not_Δ (h ▸ hy₀_Δ) + have hjoined : JoinedIn Δ' z₀ y₀ := hΔ'.isPathConnected.joinedIn z₀ hz₀_Δ' y₀ hy₀_Δ' + obtain ⟨P₀, hP₀_sub, e, he0, he1⟩ := + ((joinedIn_iff_eq_or_exists_isLineWithEnds hz₀_Δ' hy₀_Δ').mp hjoined).resolve_left hne_zy + let γ : I → S' := fun t => (e t).1 + have hγc : Continuous γ := continuous_subtype_val.comp e.continuous + have hγ_inj : Function.Injective γ := Subtype.val_injective.comp e.injective + have hγ_mem : ∀ t : I, γ t ∈ Δ' := fun t => hP₀_sub (e t).2 + have hγ0 : γ 0 = z₀ := he0 + have hγ1 : γ 1 = y₀ := he1 + let K₁ : Set I := γ ⁻¹' Δ + have hK₁_closed : IsClosed K₁ := hΔ.isCompact.isClosed.preimage hγc + have hK₁_ne : K₁.Nonempty := ⟨1, by change γ 1 ∈ Δ; rw [hγ1]; exact hy₀_Δ⟩ + let t₁ : I := sInf K₁ + have ht₁_mem : t₁ ∈ K₁ := hK₁_closed.csInf_mem hK₁_ne (OrderBot.bddBelow K₁) + have hγt₁_Δ : γ t₁ ∈ Δ := ht₁_mem + have ht₁_lt_not_Δ : ∀ t : I, t < t₁ → γ t ∉ Δ := + fun t hlt ht => not_lt_of_ge (csInf_le (OrderBot.bddBelow K₁) ht) hlt + have ht₁_pos : (0 : I) < t₁ := by + rcases eq_or_lt_of_le (show (0 : I) ≤ t₁ from Subtype.mk_le_mk.mpr + (unitInterval.nonneg t₁)) with h0 | hlt + · exfalso + have : γ 0 ∈ Δ := h0.symm ▸ hγt₁_Δ + rw [hγ0] at this + exact hz₀_not_Δ this + · exact hlt + have hγt₁_not_int : γ t₁ ∉ discInt Δ := by + intro hint + have hU_open : IsOpen (γ ⁻¹' discInt Δ) := (hΔ.isOpen_discInt hS'.2.2).preimage hγc + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hU_open t₁ hint + have ht₁_r : 0 < (t₁ : ℝ) := ht₁_pos + let δ : ℝ := min ((t₁ : ℝ) / 2) (ε / 2) + have hδ_pos : 0 < δ := lt_min (by linarith) (by linarith) + have hδ_le : δ ≤ (t₁ : ℝ) / 2 := min_le_left _ _ + have hδ_lt_ε : δ < ε := lt_of_le_of_lt (min_le_right _ _) (by linarith) + let t' : I := ⟨(t₁ : ℝ) - δ, by linarith, by linarith [unitInterval.le_one t₁]⟩ + have ht'_lt : t' < t₁ := show (t' : ℝ) < (t₁ : ℝ) from by dsimp [t']; linarith + have ht'_ball : t' ∈ Metric.ball t₁ ε := by + rw [Metric.mem_ball, Subtype.dist_eq, Real.dist_eq] + have : |(t₁ : ℝ) - δ - (t₁ : ℝ)| = δ := by + rw [sub_sub_cancel_left, abs_neg, abs_of_pos hδ_pos] + linarith + exact ht₁_lt_not_Δ t' ht'_lt (discInt_subset Δ (hball ht'_ball)) + have hγt₁_bd : γ t₁ ∈ discBd Δ := by + by_contra hnot_bd + exact hγt₁_not_int ⟨hγt₁_Δ, hnot_bd⟩ + let K₀ : Set I := γ ⁻¹' discBd Δ' ∩ Icc 0 t₁ + have hbdΔ'_closed : IsClosed (discBd Δ') := hΔ'.isOArc_discBd.isCompact.isClosed + have hK₀_closed : IsClosed K₀ := (hbdΔ'_closed.preimage hγc).inter isClosed_Icc + have hK₀_ne : K₀.Nonempty := + ⟨0, by change γ 0 ∈ discBd Δ'; rw [hγ0]; exact hz₀_bd, + le_rfl, Subtype.mk_le_mk.mpr (unitInterval.nonneg t₁)⟩ + let t₀ : I := sSup K₀ + have ht₀_mem : t₀ ∈ K₀ := hK₀_closed.csSup_mem hK₀_ne (OrderTop.bddAbove K₀) + have hγt₀_bd : γ t₀ ∈ discBd Δ' := ht₀_mem.1 + have ht₀_le_t₁ : t₀ ≤ t₁ := ht₀_mem.2.2 + have ht₀_lt_t₁ : t₀ < t₁ := by + rcases eq_or_lt_of_le ht₀_le_t₁ with heq | hlt + · exfalso + have : γ t₁ ∈ discBd Δ' := heq ▸ hγt₀_bd + exact (hsub hγt₁_Δ).2 this + · exact hlt + refine ⟨γ '' Icc t₀ t₁, γ t₀, γ t₁, hγt₀_bd, hγt₁_bd, + isLineWithEnds_image_Icc_of_injOn hγc ht₀_lt_t₁ hγ_inj.injOn, ?_, ?_⟩ + · rintro _ ⟨t, ⟨ht0, ht1⟩, rfl⟩ + refine ⟨hγ_mem t, ?_⟩ + rcases eq_or_lt_of_le ht1 with rfl | hlt + · exact hγt₁_not_int + · exact fun hint => ht₁_lt_not_Δ t hlt hint.1 + · rintro _ ⟨⟨t, ⟨ht0, ht1⟩, rfl⟩, hnot_end⟩ + have ht0_lt : t₀ < t := + lt_of_le_of_ne ht0 (fun h => hnot_end (Or.inl (congrArg γ h.symm))) + have ht1_lt : t < t₁ := + lt_of_le_of_ne ht1 (fun h => hnot_end (Or.inr (mem_singleton_iff.mpr (congrArg γ h)))) + have hnot_K₀ : t ∉ K₀ := + fun ht => not_lt_of_ge (le_csSup (OrderTop.bddAbove K₀) ht) ht0_lt + have ht_Icc : t ∈ Icc (0 : I) t₁ := + ⟨Subtype.mk_le_mk.mpr (unitInterval.nonneg t), ht1⟩ + have hnot_bdΔ' : γ t ∉ discBd Δ' := fun h => hnot_K₀ ⟨h, ht_Icc⟩ + exact ⟨⟨hγ_mem t, hnot_bdΔ'⟩, ht₁_lt_not_Δ t ht1_lt⟩ + +private theorem disc_score_le_drawing_size {G : Drawing S} (A : Set S) : + (G.V ∩ A).ncard + {e ∈ G.E | e ⊆ A}.ncard ≤ G.V.ncard + G.E.ncard := + Nat.add_le_add (ncard_le_ncard inter_subset_left G.finite_V) + (ncard_le_ncard (sep_subset _ _) G.finite_edges) + +omit [TopologicalSpace S] in +private theorem minimal_score_deficit_maximizes_score + (ℱ : Set (Set S)) (score : (F : Set S) → F ∈ ℱ → ℕ) (M : ℕ) + (hscore_le_M : ∀ (F : Set S) (hF : F ∈ ℱ), score F hF ≤ M) + (F : Set S) (hF : F ∈ ℱ) + (hF_min : M - score F hF = sInf {k | ∃ F, ∃ (hF : F ∈ ℱ), M - score F hF = k}) : + ∀ (F' : Set S) (hF' : F' ∈ ℱ), score F' hF' ≤ score F hF := by + intro F' hF' + have hle : sInf {k : ℕ | ∃ (F : Set S) (hF : F ∈ ℱ), M - score F hF = k} ≤ + M - score F' hF' := Nat.sInf_le ⟨F', hF', rfl⟩ + have h1 := hscore_le_M F hF + have h2 := hscore_le_M F' hF' + omega + +private theorem disjoint_curve_lies_outside_disc + {S : Type u} + [TopologicalSpace S] + (S' : Type u) + [TopologicalSpace S'] + (j : S → S') + (hS' : IsSurface S') + [T2Space S'] + (hj : IsEmbedding j) + (Δ : Set S') + (hΔ_disc : IsClosedDisc Δ) + (x : S) + (hjx_Δ : j x ∉ Δ) + (X : Set S) + (hxX : x ∈ X) + (hX_conn : IsConnected X) + (hdisj_X_bdΔ : Disjoint (j '' X) (discBd Δ)) : + Disjoint (discInt Δ) (j '' X) := by + rcases hΔ_disc.side hS'.2.2 (hX_conn.isPreconnected.image j hj.continuous.continuousOn) + hdisj_X_bdΔ with hsub_X | hdisj + · exact False.elim (hjx_Δ (discInt_subset Δ (hsub_X (mem_image_of_mem j hxX)))) + · exact hdisj.symm.mono_left (discInt_subset Δ) + +private theorem nested_capped_discs_strictly_inside + {S : Type u} + [TopologicalSpace S] + (S' : Type u) + [TopologicalSpace S'] + (j : S → S') + (hj : IsEmbedding j) + (F : Set S) + (Δ : Set S') + (hΔ_bd : discBd Δ = j '' F) + (X : Set S) + (hXF : X ∩ F = ∅) + (F' : Set S) + (hF'_sub_X : F' ⊆ X) + (Δ' : Set S') + (hΔ'_bd : discBd Δ' = j '' F') + (hdisj_intΔ_bdΔ' : Disjoint (discInt Δ) (discBd Δ')) + (hΔ_sub_Δ' : Δ ⊆ Δ') : + Δ ⊆ discInt Δ' := by + intro y hyΔ + refine ⟨hΔ_sub_Δ' hyΔ, fun hy_bd' => ?_⟩ + by_cases hy_bd : y ∈ discBd Δ + · rw [hΔ_bd] at hy_bd + rw [hΔ'_bd] at hy_bd' + obtain ⟨z₁, hz₁F, rfl⟩ := hy_bd + obtain ⟨z₂, hz₂F', heq⟩ := hy_bd' + have : z₁ ∈ X ∩ F := ⟨hF'_sub_X (hj.injective heq ▸ hz₂F'), hz₁F⟩ + rw [hXF] at this + exact this + · exact disjoint_left.mp hdisj_intΔ_bdΔ' ⟨hyΔ, hy_bd⟩ hy_bd' + +private theorem vertices_in_strictly_nested_discs + {S : Type u} + [TopologicalSpace S] + {G : Drawing S} + (S' : Type u) + [TopologicalSpace S'] + (j : S → S') + (F : Set S) + (Δ : Set S') + (Δ' : Set S') + (hpre_sub_V : G.V ∩ j ⁻¹' discInt Δ ∪ G.V ∩ F ⊆ G.V ∩ j ⁻¹' discInt Δ') + (hdisj_VF : Disjoint (G.V ∩ j ⁻¹' discInt Δ) (G.V ∩ F)) : + (G.V ∩ j ⁻¹' discInt Δ).ncard + (G.V ∩ F).ncard ≤ (G.V ∩ j ⁻¹' discInt Δ').ncard := by + rw [← ncard_union_eq hdisj_VF (G.finite_V.inter_of_left _) (G.finite_V.inter_of_left _)] + exact ncard_le_ncard hpre_sub_V (G.finite_V.inter_of_left _) + +private theorem boundary_without_vertices_avoids_drawing {G : Drawing S} {F : Set S} + (hF : G.IsNormal F) (hVF_empty : G.V ∩ F = ∅) : + G.U ∩ F = ∅ := by + apply eq_empty_iff_forall_notMem.mpr + intro z hz + have hzVF : z ∈ G.V ∩ F := ⟨hF ⟨hz.2, hz.1⟩, hz.2⟩ + rwa [hVF_empty] at hzVF + +private theorem equal_disc_scores_leave_annulus_disjoint + {S : Type u} + [TopologicalSpace S] + {G : Drawing S} + (S' : Type u) + [TopologicalSpace S'] + (j : S → S') + (hS' : IsSurface S') + [T2Space S'] + (hj : IsEmbedding j) + (Δ : Set S') + (F' : Set S) + (hF'_norm : G.IsNormal F') + (Δ' : Set S') + (hΔ'_disc : IsClosedDisc (Δ')) + (hΔ'_bd : discBd (Δ') = j '' F') + (hV_eq : G.V ∩ j ⁻¹' discInt Δ = G.V ∩ j ⁻¹' discInt Δ') + (hE_eq : {e | e ∈ G.E ∧ e ⊆ j ⁻¹' discInt Δ} = {e | e ∈ G.E ∧ e ⊆ j ⁻¹' discInt Δ'}) : + ∀ (z : S), j z ∈ discInt Δ' \ Δ → z ∉ G.U := by + intro z ⟨hz_int', hz_not_Δ⟩ hzU + by_cases hzV : z ∈ G.V + · have hz_mem' : z ∈ G.V ∩ j ⁻¹' discInt Δ' := ⟨hzV, hz_int'⟩ + rw [← hV_eq] at hz_mem' + exact hz_not_Δ (discInt_subset Δ hz_mem'.2) + · obtain ⟨e, heE, hze⟩ := G.exists_edge_of_mem hzU hzV + have he_disj_bdΔ' : Disjoint (j '' e) (discBd Δ') := by + rw [hΔ'_bd, disjoint_left] + rintro _ ⟨w₁, hw₁e, rfl⟩ ⟨w₂, hw₂F', heq⟩ + have hw₁F' : w₁ ∈ F' := hj.injective heq ▸ hw₂F' + have hw₁U : w₁ ∈ G.U \ G.V := heE.2.1 hw₁e + exact hw₁U.2 (hF'_norm ⟨hw₁F', hw₁U.1⟩) + have he_conn : IsPreconnected (j '' e) := + (heE.2.2.1.isConnected.isPreconnected).image j hj.continuous.continuousOn + have he_sub' : j '' e ⊆ discInt Δ' := by + rcases hΔ'_disc.side hS'.2.2 he_conn he_disj_bdΔ' with hsub_e | hdisj_e + · exact hsub_e + · exact False.elim (disjoint_right.mp hdisj_e (discInt_subset Δ' hz_int') + (mem_image_of_mem j hze)) + have he_mem' : e ∈ {e ∈ G.E | e ⊆ j ⁻¹' discInt Δ'} := + ⟨heE, image_subset_iff.mp he_sub'⟩ + rw [← hE_eq] at he_mem' + exact hz_not_Δ (discInt_subset Δ (he_mem'.2 hze)) + +private theorem mem_nearSet_through_annulus [T2Space S] + {S' : Type u} [TopologicalSpace S'] + {G : Drawing S} {C F X : Set S} {D Δ Δ' Q₁ : Set S'} + {j : S → S'} {x z w : S} {r : ℕ} + (hCap : IsCappedCuff C S' j D) (hj : IsEmbedding j) (hD_sub_Δ : discInt D ⊆ discInt Δ) + (hxX : x ∈ X) (hzX : z ∈ X) (hwF : w ∈ F) (hX_arc : IsArcConnected X) + (hX_norm : G.IsNormal X) (hX_card : (G.V ∩ X).ncard ≤ r) + (hXF : X ∩ F = ∅) (hUF : G.U ∩ F = ∅) + (hU_annulus : ∀ y : S, j y ∈ discInt Δ' \ Δ → y ∉ G.U) + (hQ₁ : IsLineWithEnds Q₁ (j z) (j w)) + (hQ₁_sub : Q₁ ⊆ Δ' \ discInt Δ) + (hQ₁_int : Q₁ \ {j z, j w} ⊆ discInt Δ' \ Δ) : + x ∈ nearSet G r F := by + have hQ₁_range : Q₁ ⊆ range j := by + intro y hy + have hy_not_intD : y ∉ discInt D := fun h => (hQ₁_sub hy).2 (hD_sub_Δ h) + rcases (hCap.union_eq ▸ mem_univ y : y ∈ range j ∪ D) with hy_r | hy_D + · exact hy_r + · have hy_bdD : y ∈ discBd D := by + by_contra h + exact hy_not_intD ⟨hy_D, h⟩ + rw [hCap.discBd_eq, ← hCap.inter_eq] at hy_bdD + exact hy_bdD.1 + obtain ⟨hQ_line, _⟩ := pull_of_isLineWithEnds hj hQ₁ hQ₁_range + let Q : Set S := j ⁻¹' Q₁ + have hUQ_sub : G.U ∩ Q ⊆ G.V ∩ X := by + intro y ⟨hyU, hyQ⟩ + by_cases hy_end : j y ∈ ({j z, j w} : Set S') + · rcases mem_insert_iff.mp hy_end with hyz | hyw + · have h : y = z := hj.injective hyz + subst y + exact ⟨hX_norm ⟨hzX, hyU⟩, hzX⟩ + · have h : y = w := hj.injective (mem_singleton_iff.mp hyw) + subst y + have hy : w ∈ G.U ∩ F := ⟨hyU, hwF⟩ + rw [hUF] at hy + exact hy.elim + · exact (hU_annulus y (hQ₁_int ⟨hyQ, hy_end⟩) hyU).elim + have hx_XQ : x ∈ X ∪ Q := Or.inl hxX + have hw_XQ : w ∈ X ∪ Q := Or.inr (right_mem_of_isLineWithEnds hQ_line) + have hxz := (isArcConnected_iff_joinedIn.mp hX_arc x hxX z hzX).mono + (subset_union_left : X ⊆ X ∪ Q) + have hzw : JoinedIn (X ∪ Q) z w := + (joinedIn_iff_eq_or_exists_isLineWithEnds (Or.inl hzX) hw_XQ).mpr + (Or.inr ⟨Q, subset_union_right, hQ_line⟩) + have hxw_ne : x ≠ w := fun h => by + have hx : x ∈ X ∩ F := ⟨hxX, h ▸ hwF⟩ + rwa [hXF] at hx + obtain ⟨L, hL_sub, hL_line⟩ := + ((joinedIn_iff_eq_or_exists_isLineWithEnds hx_XQ hw_XQ).mp (hxz.trans hzw)).resolve_left hxw_ne + have hUL_sub : G.U ∩ L ⊆ G.V ∩ X := by + rintro y ⟨hyU, hyL⟩ + rcases hL_sub hyL with hyX | hyQ + · exact ⟨hX_norm ⟨hyX, hyU⟩, hyX⟩ + · exact hUQ_sub ⟨hyU, hyQ⟩ + have hfin := G.finite_V.inter_of_left X + refine ⟨w, hwF, (distPoint_le_of_lineWithEnds hL_line (hfin.subset hUL_sub)).trans ?_⟩ + exact (ncard_le_ncard hUL_sub hfin).trans hX_card + +/-- Graph Minors VII, (5.7) (page 232): +"Let $\Sigma \cong \Sigma(a, b, c)$, where $3a + 3b + c \ge 3$, and let $G$ be a proper graph in +$\Sigma$. Let $C$ be a cuff, and let $r \ge 0$ be an integer with $r \le \frac{2}{9}\alpha(G) - 1$. +Then $\mathscr{A}_r(C)$ is planar in $\Sigma + \hat{C}$." -/ +theorem theorem_5_7_proof + (hS : IsSurface S) [ConnectedSpace S] + {a b c : ℕ} (hmodel : Nonempty (S ≃ₜ SurfaceModel a b c)) + (habc : 3 ≤ 3 * a + 3 * b + c) + {G : Drawing S} (hG : G.IsProper) + {C : Set S} (hC : C ∈ cuffs S) + {r : ℕ} (hr : 9 * (r + 1) ≤ 2 * alpha G) : + IsPlanarInCappedCuff C (scriptA G r C) := by + classical + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hnot_small : ∀ c' ≤ 2, IsEmpty (S ≃ₜ SurfaceModel 0 0 c') := by + intro c' hc' + refine ⟨fun e' => ?_⟩ + obtain ⟨e₀⟩ := hmodel + have hcrit := (modelCriterion.2 a b c 0 0 c').mp ⟨e₀.symm.trans e'⟩ + have hb0 : b = 0 := hcrit.2.2.mpr rfl + omega + by_cases hA_ne : (scriptA G r C).Nonempty + · have h_all : ∀ (S' : Type u) [TopologicalSpace S'] (j : S → S') (D : Set S'), + IsCappedCuff C S' j D → IsPlanar (j '' scriptA G r C) := by + intro S' _ j D hCap + have hS' : IsSurface S' := hCap.isSurface + have : CompactSpace S' := hS'.1 + have : T2Space S' := hS'.2.1 + have : ConnectedSpace S' := hCap.connectedSpace hS + have hj : IsEmbedding j := hCap.isEmbedding + have hns_S' : ¬ IsSphere S' := by + intro hsph + obtain ⟨hc1, ⟨e₁⟩⟩ := cappedCuff_homeo_model hS hmodel hC hCap + obtain ⟨e_sph⟩ := id hsph + obtain ⟨e_m0⟩ := GraphMinor.GM19.isSphere_model + have hcrit := (modelCriterion.2 a b (c - 1) 0 0 0).mp ⟨e₁.symm.trans + (e_sph.trans e_m0.symm)⟩ + have hb0 : b = 0 := hcrit.2.2.mpr rfl + omega + let ℱ : Set (Set S) := + {F : Set S | IsOArc F ∧ G.IsNormal F ∧ SurroundsCuff F C ∧ (G.V ∩ F).ncard ≤ r} + have hℱ_ne : ℱ.Nonempty := by + obtain ⟨x₀, hx₀⟩ := hA_ne + obtain ⟨X₀, ⟨hX₀_sol, _, hX₀_norm, hX₀_surr, hX₀_card⟩, -⟩ := mem_sUnion.mp hx₀ + obtain ⟨F₀, hF₀_oarc, hF₀_sub, hF₀_surr⟩ := + (theorem_5_2_proof hS hX₀_sol hX₀_surr.2.1).mp hX₀_surr + refine ⟨F₀, hF₀_oarc, fun z ⟨hzF, hzU⟩ => hX₀_norm ⟨hF₀_sub hzF, hzU⟩, hF₀_surr, ?_⟩ + exact (ncard_le_ncard (inter_subset_inter_right G.V hF₀_sub) + (G.finite_V.inter_of_left X₀)).trans hX₀_card + let discOf : (F : Set S) → F ∈ ℱ → Set S' := fun F hF => + Classical.choose (surroundsCuff_bounds_disc_containing_cap hS hF.1 hF.2.2.1 hCap) + have hdiscOf_spec : ∀ (F : Set S) (hF : F ∈ ℱ), + IsClosedDisc (discOf F hF) ∧ discBd (discOf F hF) = j '' F ∧ + discInt D ⊆ discInt (discOf F hF) := + fun F hF => Classical.choose_spec + (surroundsCuff_bounds_disc_containing_cap hS hF.1 hF.2.2.1 hCap) + let score : (F : Set S) → F ∈ ℱ → ℕ := fun F hF => + (G.V ∩ j ⁻¹' discInt (discOf F hF)).ncard + + {e ∈ G.E | e ⊆ j ⁻¹' discInt (discOf F hF)}.ncard + let M : ℕ := G.V.ncard + G.E.ncard + have hscore_le_M : ∀ (F : Set S) (hF : F ∈ ℱ), score F hF ≤ M := by + intro F hF + exact disc_score_le_drawing_size (G := G) (j ⁻¹' discInt (discOf F hF)) + have hK_ne : {k : ℕ | ∃ (F : Set S) (hF : F ∈ ℱ), M - score F hF = k}.Nonempty := by + obtain ⟨F₀, hF₀⟩ := hℱ_ne + exact ⟨M - score F₀ hF₀, F₀, hF₀, rfl⟩ + obtain ⟨F, hF, hF_min⟩ := Nat.sInf_mem hK_ne + have hF_max : ∀ (F' : Set S) (hF' : F' ∈ ℱ), score F' hF' ≤ score F hF := by + exact minimal_score_deficit_maximizes_score ℱ score M hscore_le_M F hF hF_min + let Δ : Set S' := discOf F hF + obtain ⟨hΔ_disc, hΔ_bd, hD_sub_Δ⟩ := hdiscOf_spec F hF + -- Show Δ ∪ j '' nearSet G r F is planar in S' + have hY_capped : IsPlanarInCappedCuff C (nearSet G r F) := + theorem_5_6_proof hS hnot_small hG hC hF.1 hF.2.1 hF.2.2.1 hF.2.2.2 hr + obtain ⟨Δ₀, hΔ₀_disc, hY_sub_Δ₀⟩ := hY_capped.2.2 S' j D hCap + have hF_sub_Y : F ⊆ nearSet G r F := subset_nearSet_of_isNormal hF.2.1 hF.2.2.2 + have hbdΔ_sub_Δ₀ : discBd Δ ⊆ Δ₀ := + hΔ_bd ▸ (image_mono hF_sub_Y).trans hY_sub_Δ₀ + have hjF_oarc : IsOArc (j '' F) := + isOArc_image hF.1 hj.continuous.continuousOn hj.injective.injOn + obtain ⟨Δ'', ⟨hΔ''_sub_Δ₀, hΔ''_disc, hΔ''_bd, -⟩, -⟩ := + disc_oArc Δ₀ (j '' F) hΔ₀_disc (hΔ_bd ▸ hbdΔ_sub_Δ₀) hjF_oarc + have hΔ_eq_Δ'' : Δ = Δ'' := + eq_of_discBd_eq hS' hns_S' hΔ_disc hΔ''_disc (hΔ_bd.trans hΔ''_bd.symm) + have hΔ_sub_Δ₀ : Δ ⊆ Δ₀ := hΔ_eq_Δ'' ▸ hΔ''_sub_Δ₀ + refine ⟨Δ₀, hΔ₀_disc, ?_⟩ + rintro _ ⟨x, hxA, rfl⟩ + by_cases hjx_Δ : j x ∈ Δ + · exact hΔ_sub_Δ₀ hjx_Δ + -- Suffices to show x ∈ nearSet G r F when j x ∉ Δ + suffices hxY : x ∈ nearSet G r F from hY_sub_Δ₀ (mem_image_of_mem j hxY) + obtain ⟨X, ⟨hX_sol, hX_conn, hX_norm, hX_surr, hX_card⟩, hxX⟩ := mem_sUnion.mp hxA + have hX_arc : IsArcConnected X := + theorem_11_4_proof hS hX_conn hX_sol.1 + by_cases hXF : (X ∩ F).Nonempty + · obtain ⟨w₀, hw₀X, hw₀F⟩ := hXF + rcases eq_or_ne x w₀ with rfl | hxw₀ + · exact hF_sub_Y hw₀F + · obtain ⟨L, hLX, hL_line⟩ := hX_arc x hxX w₀ hw₀X hxw₀ + have hUL_sub : G.U ∩ L ⊆ G.V ∩ X := fun z ⟨hzU, hzL⟩ => + ⟨hX_norm ⟨hLX hzL, hzU⟩, hLX hzL⟩ + have hUL_fin : (G.U ∩ L).Finite := (G.finite_V.inter_of_left X).subset hUL_sub + have hdist : distPoint G x w₀ ≤ r := + (distPoint_le_of_lineWithEnds hL_line hUL_fin).trans + ((ncard_le_ncard hUL_sub (G.finite_V.inter_of_left X)).trans hX_card) + exact ⟨w₀, hw₀F, hdist⟩ + · rw [not_nonempty_iff_eq_empty] at hXF + obtain ⟨F', hF'_oarc, hF'_sub_X, hF'_surr⟩ := + (theorem_5_2_proof hS hX_sol hX_surr.2.1).mp hX_surr + have hF'_norm : G.IsNormal F' := fun z ⟨hzF', hzU⟩ => hX_norm ⟨hF'_sub_X hzF', hzU⟩ + have hF'_card : (G.V ∩ F').ncard ≤ r := + (ncard_le_ncard (inter_subset_inter_right G.V hF'_sub_X) + (G.finite_V.inter_of_left X)).trans hX_card + have hF'_mem : F' ∈ ℱ := ⟨hF'_oarc, hF'_norm, hF'_surr, hF'_card⟩ + let Δ' : Set S' := discOf F' hF'_mem + obtain ⟨hΔ'_disc, hΔ'_bd, hD_sub_Δ'⟩ := hdiscOf_spec F' hF'_mem + -- Show Disjoint (discInt Δ) (j '' X) + have hdisj_X_bdΔ : Disjoint (j '' X) (discBd Δ) := by + rw [hΔ_bd, disjoint_left] + rintro _ ⟨z₁, hz₁X, rfl⟩ ⟨z₂, hz₂F, heq⟩ + have hz₁F : z₁ ∈ F := hj.injective heq ▸ hz₂F + have : z₁ ∈ X ∩ F := ⟨hz₁X, hz₁F⟩ + rw [hXF] at this + exact this + have hdisj_intΔ_X : Disjoint (discInt Δ) (j '' X) := by + exact disjoint_curve_lies_outside_disc (S := S) S' j hS' hj Δ hΔ_disc x + hjx_Δ X hxX hX_conn hdisj_X_bdΔ + have hdisj_intΔ_bdΔ' : Disjoint (discInt Δ) (discBd Δ') := by + rw [hΔ'_bd] + exact hdisj_intΔ_X.mono_right (image_mono hF'_sub_X) + -- Show Δ ⊆ discInt Δ' + have hintΔ_sub_intΔ' : discInt Δ ⊆ discInt Δ' := by + rcases hΔ'_disc.side hS'.2.2 hΔ_disc.isPreconnected_discInt hdisj_intΔ_bdΔ' with + hsub_int | hdisj_int + · exact hsub_int + · exfalso + obtain ⟨d₀, hd₀⟩ := hCap.isClosedDisc.nonempty_discInt + exact disjoint_left.mp hdisj_int (hD_sub_Δ hd₀) (discInt_subset Δ' (hD_sub_Δ' hd₀)) + have hΔ_sub_Δ' : Δ ⊆ Δ' := + hΔ_disc.subset_closure_discInt.trans + (closure_minimal (hintΔ_sub_intΔ'.trans (discInt_subset Δ')) + hΔ'_disc.isCompact.isClosed) + have hΔ_sub_intΔ' : Δ ⊆ discInt Δ' := by + exact nested_capped_discs_strictly_inside (S := S) S' j hj F Δ hΔ_bd X hXF + F' hF'_sub_X Δ' hΔ'_bd hdisj_intΔ_bdΔ' hΔ_sub_Δ' + -- Use maximality of score F to deduce G.V ∩ F = ∅ and no vertices/edges in discInt Δ' \ Δ + have hpre_sub_V : + (G.V ∩ j ⁻¹' discInt Δ) ∪ (G.V ∩ F) ⊆ G.V ∩ j ⁻¹' discInt Δ' := by + rintro z (⟨hzV, hzj⟩ | ⟨hzV, hzF⟩) + · exact ⟨hzV, hintΔ_sub_intΔ' hzj⟩ + · refine ⟨hzV, hΔ_sub_intΔ' ?_⟩ + have : j z ∈ discBd Δ := hΔ_bd ▸ mem_image_of_mem j hzF + exact Surface.discBd_subset Δ this + have hdisj_VF : Disjoint (G.V ∩ j ⁻¹' discInt Δ) (G.V ∩ F) := by + refine disjoint_left.mpr fun z ⟨_, hzj⟩ ⟨_, hzF⟩ => ?_ + exact hzj.2 (hΔ_bd ▸ mem_image_of_mem j hzF) + have hV_ineq : + (G.V ∩ j ⁻¹' discInt Δ).ncard + (G.V ∩ F).ncard ≤ + (G.V ∩ j ⁻¹' discInt Δ').ncard := by + exact vertices_in_strictly_nested_discs (S := S) (G := G) S' j F Δ Δ' hpre_sub_V + hdisj_VF + have hE_sub : + {e ∈ G.E | e ⊆ j ⁻¹' discInt Δ} ⊆ {e ∈ G.E | e ⊆ j ⁻¹' discInt Δ'} := + fun e ⟨heE, he_sub⟩ => ⟨heE, he_sub.trans (preimage_mono hintΔ_sub_intΔ')⟩ + have hE_ineq : + {e ∈ G.E | e ⊆ j ⁻¹' discInt Δ}.ncard ≤ + {e ∈ G.E | e ⊆ j ⁻¹' discInt Δ'}.ncard := + ncard_le_ncard hE_sub (G.finite_edges.subset (sep_subset _ _)) + have hmax_F' : + (G.V ∩ j ⁻¹' discInt Δ').ncard + {e ∈ G.E | e ⊆ j ⁻¹' discInt Δ'}.ncard ≤ + (G.V ∩ j ⁻¹' discInt Δ).ncard + {e ∈ G.E | e ⊆ j ⁻¹' discInt Δ}.ncard := + hF_max F' hF'_mem + have hVF_zero : (G.V ∩ F).ncard = 0 := by omega + have hV_ncard_le : + (G.V ∩ j ⁻¹' discInt Δ').ncard ≤ (G.V ∩ j ⁻¹' discInt Δ).ncard := by omega + have hE_ncard_le : + {e ∈ G.E | e ⊆ j ⁻¹' discInt Δ'}.ncard ≤ + {e ∈ G.E | e ⊆ j ⁻¹' discInt Δ}.ncard := by omega + have hVF_empty : G.V ∩ F = ∅ := + (ncard_eq_zero (G.finite_V.inter_of_left F)).mp hVF_zero + have hUF_empty : G.U ∩ F = ∅ := by + exact boundary_without_vertices_avoids_drawing hF.2.1 hVF_empty + have hV_eq : G.V ∩ j ⁻¹' discInt Δ = G.V ∩ j ⁻¹' discInt Δ' := + eq_of_subset_of_ncard_le + (inter_subset_inter_right G.V (preimage_mono hintΔ_sub_intΔ')) + hV_ncard_le (G.finite_V.inter_of_left _) + have hE_eq : + {e ∈ G.E | e ⊆ j ⁻¹' discInt Δ} = {e ∈ G.E | e ⊆ j ⁻¹' discInt Δ'} := + eq_of_subset_of_ncard_le hE_sub hE_ncard_le (G.finite_edges.subset (sep_subset _ _)) + -- Show G.U is disjoint from j ⁻¹' (discInt Δ' \ Δ) + have hU_annulus_empty : ∀ z : S, j z ∈ discInt Δ' \ Δ → z ∉ G.U := by + exact equal_disc_scores_leave_annulus_disjoint (S := S) (G := G) S' j hS' hj Δ + F' hF'_norm Δ' hΔ'_disc hΔ'_bd hV_eq hE_eq + -- Construct the subarc Q₁ in Δ' \ discInt Δ and pull back to S + obtain ⟨Q₁, p, q, hp_bd', hq_bd, hQ₁_line, hQ₁_sub, hQ₁_int⟩ := + exists_subarc_in_annulus hS' hΔ_disc hΔ'_disc hΔ_sub_intΔ' + rw [hΔ'_bd] at hp_bd' + rw [hΔ_bd] at hq_bd + obtain ⟨z₁, hz₁F', rfl⟩ := hp_bd' + obtain ⟨w₀, hw₀F, rfl⟩ := hq_bd + exact mem_nearSet_through_annulus hCap hj hD_sub_Δ hxX (hF'_sub_X hz₁F') hw₀F + hX_arc hX_norm hX_card hXF hUF_empty hU_annulus_empty hQ₁_line hQ₁_sub hQ₁_int + obtain ⟨c₀, _⟩ := isOArc_nonempty (cuff_isOArc hS hC) + have : Nonempty S := ⟨c₀⟩ + obtain ⟨S', topS', j, D, hS', hj, hD, hunion, hinter, hbdD⟩ := paste_disc S C hS hC + have hCap : IsCappedCuff C S' j D := ⟨hC, hS', hj.isEmbedding, hD, hbdD.1, hunion, hinter⟩ + exact ⟨hC, ⟨S', topS', j, D, hCap, h_all S' j D hCap⟩, h_all⟩ + · rw [not_nonempty_iff_eq_empty.mp hA_ne] + obtain ⟨c₀, _⟩ := isOArc_nonempty (cuff_isOArc hS hC) + have : Nonempty S := ⟨c₀⟩ + obtain ⟨S', topS', j, D, hS', hj, hD, hunion, hinter, hbdD⟩ := paste_disc S C hS hC + have hCap : IsCappedCuff C S' j D := ⟨hC, hS', hj.isEmbedding, hD, hbdD.1, hunion, hinter⟩ + exact ⟨hC, ⟨S', topS', j, D, hCap, ⟨D, hD, by simp⟩⟩, + fun _ _ _ D' hCap' => ⟨D', hCap'.isClosedDisc, by simp⟩⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section6.lean b/LeanPool/GraphMinor/GM07/Section6.lean new file mode 100644 index 0000000000..ac8a7ee6c3 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section6.lean @@ -0,0 +1,148 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section5 +public import LeanPool.GraphMinor.GM07.CuffStep +public import LeanPool.GraphMinor.GM07.CuffFinal +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.ModelCriterion + +/-! +# Graph Minors VII, Section 6: Allowing Smaller Cuffs + +This file formalizes Section 6 (pages 237–238) of N. Robertson and P. D. Seymour, +*Graph Minors. VII. Disjoint paths on a surface*, J. Combin. Theory Ser. B 45 (1988) 212–254: +- `ncard_small_cuffs_le`: `{C ∈ cuffs S | (G.V ∩ C).ncard ≤ 1}.ncard ≤ c`; +- `theorem_6_1_general`: proof by induction on `g = {C ∈ cuffs S | (G.V ∩ C).ncard ≤ 1}.ncard` + that `IsGFeasibleProper G H` holds whenever `(G.V ∩ bd S).ncard ≤ 2 * k - 2 * g`, using + `theorem_5_9` in the base case `g = 0` and `smallCuffReductionStep` in the inductive + step `g = g₀ + 1`; +- `(6.1)` (`theorem_6_1`): third version of the main feasibility theorem, removing the condition + `|V(G) ∩ C| ≥ 2` for each cuff `C`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- On a surface `S ≃ₜ SurfaceModel a b c`, the number `g` of cuffs `C` of `S` with +`(G.V ∩ C).ncard ≤ 1` is at most `c`. -/ +theorem ncard_small_cuffs_le (hS : IsSurface S) {a b c : ℕ} + (he : Nonempty (S ≃ₜ SurfaceModel a b c)) (G : Drawing S) : + {C ∈ cuffs S | (G.V ∩ C).ncard ≤ 1}.ncard ≤ c := by + have hfin : (cuffs S).Finite := (cuff_statement S hS).2.1 + calc + {C ∈ cuffs S | (G.V ∩ C).ncard ≤ 1}.ncard + ≤ (cuffs S).ncard := ncard_le_ncard (fun _ h => h.1) hfin + _ = c := ncard_cuffs_of_homeomorph_surfaceModel he + +/-- A forest with no vertex on the boundary is feasible: only paths between boundary vertices count, +so it is homotopic to the empty forest. -/ +theorem isGFeasible_of_no_boundary_vertices [T1Space S] {G H : Drawing S} + (hH : IsSurfaceForest H) + (hb : H.V ∩ bd S = ∅) : IsGFeasible G H := by + have hE : (G.span ∅ ∅).E = ∅ := by + rw [Drawing.span_E, empty_inter] + have hV : (G.span ∅ ∅).V = ∅ := by + rw [Drawing.span_V, Drawing.spanV] + simp + have hU : (G.span ∅ ∅).U = ∅ := by + rw [Drawing.span_U, Drawing.spanU, Drawing.spanV] + simp + have hF : IsSurfaceForest (G.span ∅ ∅) := by + refine ⟨?_, fun u W _ => ?_⟩ + · rintro x ⟨-, hx⟩ + rw [hU] at hx + exact hx.elim + · cases W with + | nil hv => rfl + | cons hlink _ => + have := hlink.1 + rw [hE] at this + exact this.elim + refine ⟨G.span ∅ ∅, hF, ⟨Homeomorph.refl S, fun _ _ => rfl, ?_⟩, Drawing.span_isSubdrawing _ _ _⟩ + rw [mapDrawingHomeo_refl] + refine ⟨hH.1, hF.1, hH.2, hF.2, ?_, fun s hs => ?_⟩ + · rw [hb, hV, empty_inter] + · rw [hb] at hs + exact hs.elim + +/-- General form of Graph Minors VII, (6.1) (pages 237–238), proved by induction on +`g = {C ∈ cuffs S | (G.V ∩ C).ncard ≤ 1}.ncard` under the weaker hypothesis +`|V(G) ∩ bd(Σ)| ≤ 2k - 2g`. -/ +theorem theorem_6_1_general + {a b c k g : ℕ} (hc : 2 ≤ c) (hne : (a, b, c) ≠ (0, 0, 2)) : + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsSurface S → Nonempty (S ≃ₜ SurfaceModel a b c) → + ∀ (G H : Drawing S), + IsBoundaryLinked G → + {C ∈ cuffs S | (G.V ∩ C).ncard ≤ 1}.ncard = g → + (G.V ∩ bd S).ncard ≤ 2 * k - 2 * g → + 9 * k * vSurface S k < alpha G → + IsSurfaceForest H → G.V ∩ bd S = H.V ∩ bd S → + IsGFeasible G H := by + induction g with + | zero => + intro S _ _ hS he G H hBL hg0 hbd_card halpha hH hbd_eq + have hfin_cuffs : (cuffs S).Finite := (cuff_statement S hS).2.1 + have hfin_small : {C ∈ cuffs S | (G.V ∩ C).ncard ≤ 1}.Finite := + hfin_cuffs.subset (fun _ h => h.1) + have hempty : {C ∈ cuffs S | (G.V ∩ C).ncard ≤ 1} = ∅ := + (ncard_eq_zero hfin_small).mp hg0 + have hcuff2 : ∀ C ∈ cuffs S, 2 ≤ (G.V ∩ C).ncard := by + intro C hC + by_contra hlt + have hle1 : (G.V ∩ C).ncard ≤ 1 := by omega + have hmem : C ∈ {C ∈ cuffs S | (G.V ∩ C).ncard ≤ 1} := ⟨hC, hle1⟩ + rw [hempty] at hmem + exact hmem + have hbd_card' : (G.V ∩ bd S).ncard ≤ 2 * k := by omega + exact theorem_5_9_proof hS hc hne he k G H hBL hbd_card' halpha hcuff2 hH hbd_eq + | succ g₀ ih => + intro S _ _ hS he G H hBL hg_succ hbd_card halpha hH hbd_eq + by_cases hk : g₀ + 1 ≤ k + swap + · -- When the bound is negative, the boundary has no vertices. + have hb0 : (G.V ∩ bd S).ncard = 0 := by omega + have hempty : G.V ∩ bd S = ∅ := (ncard_eq_zero (G.finite_V.subset inter_subset_left)).mp hb0 + exact isGFeasible_of_no_boundary_vertices hH (hbd_eq ▸ hempty) + obtain ⟨S', tS', t1S', G', H', hS', he', hBL', hg₀', hbd_card', halpha', hH', hbd_eq', himp⟩ := + smallCuffReductionStep S hS a b c hc hne he k g₀ G H hk hBL hg_succ hbd_card halpha hH hbd_eq + exact himp (@ih S' tS' t1S' hS' he' G' H' hBL' hg₀' hbd_card' halpha' hH' hbd_eq') + +/-- Graph Minors VII, (6.1) (pages 237–238): +"(6.1) *Let $\Sigma \cong \Sigma(a, b, c)$, where $c \ge 2$ and $(a, b, c) \ne (0, 0, 2)$. Let +$k \ge 0$ be an integer. Let $G$ be a boundary-linked proper graph in $\Sigma$ with +$|V(G) \cap bd(\Sigma)| \le 2k - 2c$ and with $\alpha(G) > 9kv(\Sigma, k)$. Let $H$ be a forest in +$\Sigma$ with $V(G) \cap bd(\Sigma) = V(H) \cap bd(\Sigma)$. Then $H$ is $G$-feasible.*" -/ +theorem theorem_6_1_proof + [T1Space S] (hS : IsSurface S) {a b c : ℕ} (hc : 2 ≤ c) (hne : (a, b, c) ≠ (0, 0, 2)) + (he : Nonempty (S ≃ₜ SurfaceModel a b c)) + (k : ℕ) (G H : Drawing S) + (hBL : IsBoundaryLinked G) + (hbd_card : (G.V ∩ bd S).ncard ≤ 2 * k - 2 * c) + (halpha : 9 * k * vSurface S k < alpha G) + (hH : IsSurfaceForest H) (hbd_eq : G.V ∩ bd S = H.V ∩ bd S) : + IsGFeasible G H := by + have hg_le_c : {C ∈ cuffs S | (G.V ∩ C).ncard ≤ 1}.ncard ≤ c := + ncard_small_cuffs_le hS he G + have hbd_card_g : + (G.V ∩ bd S).ncard ≤ 2 * k - 2 * {C ∈ cuffs S | (G.V ∩ C).ncard ≤ 1}.ncard := by + omega + exact theorem_6_1_general hc hne S hS he G H hBL rfl + hbd_card_g halpha hH hbd_eq + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section7.lean b/LeanPool/GraphMinor/GM07/Section7.lean new file mode 100644 index 0000000000..723735f024 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section7.lean @@ -0,0 +1,348 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section6 +public import LeanPool.GraphMinor.GM07.CutBounds +public import LeanPool.GraphMinor.GM07.GoodEdge +public import LeanPool.GraphMinor.GM07.CutFeasible +import LeanPool.GraphMinor.GM07.CuffSlide +import LeanPool.GraphMinor.GM07.Section35 +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.Surface.ModelCriterion + +/-! +# Graph Minors VII, Section 7: Adding New Cuffs + +This file formalizes Section 7 (pages 238–241) of N. Robertson and P. D. Seymour, +*Graph Minors. VII. Disjoint paths on a surface*, J. Combin. Theory Ser. B 45 (1988) 212–254: +- `(7.1)` (`theorem_7_1`): lower bound `α(φ_e⁻¹(G \ e)) ≥ r` when cutting along a non-loop edge `e` + outside `Δ_{r-1}` disjoint from `bd(Σ)`; +- `(7.2)` (`theorem_7_2`): `φ_e⁻¹(G \ e)` is boundary-linked in `Σ_e` when no null-homotopic + `G$-normal `O`-arc with `≤ 1` vertex of `G` has `e` inside it; +- `(7.3)` (`theorem_7_3`): existence of a non-loop edge `e` satisfying the hypotheses of `(7.1)` and + `(7.2)`; +- `(7.4)` (`theorem_7_4`): deduced directly by combining `(7.1)`, `(7.2)`, and `(7.3)`; +- Unconditional monotonicity and base-case lemmas for `(7.5)` (`isW36BoundProper_anti_n`, + `wSurfaceProper_mono_n`, `wMaxModelProper_mono_c`, `muModelProper_mono_c`, `vModelProper_mono_c`, + `two_mul_k_le_vModelProper`, `bd_eq_empty_of_homeomorph_surfaceModel_zero`, + `isGFeasibleProper_of_bd_inter_empty`); +- `(7.5)` (`theorem_7_5`): final form of the main feasibility theorem on `Σ ≅ Σ(a, b, c)` + (`3a + 3b + c ≥ 3`), proved by following the paper's three cases (`c ≥ 2` via `(6.1)`, + `V(H) ∩ bd(Σ) = ∅` via `emptyDrawing S`, and `c = 1` via `(7.4)` and `(6.1)`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Cutting along an edge: (7.1)–(7.4) -/ + +/-- Graph Minors VII, (7.1) (pages 238–239): +"(7.1) *Suppose that $\Sigma$, $G$ are as above, and $2 \le r \le \frac{2}{9}\alpha(G)$, and that +$e$ is an edge of $G$, not a loop, with $e \notin \Delta_{r-1}$ and with +$\bar{e} \cap bd(\Sigma) = \emptyset$. Then $\alpha(\phi_e^{-1}(G \setminus e)) \ge r$.*" -/ +theorem theorem_7_1_proof + {S_e : Type u} [TopologicalSpace S_e] + (hS : IsSurface S) {a b c : ℕ} (h3 : 3 ≤ 3 * a + 3 * b + c) + (he_model : Nonempty (S ≃ₜ SurfaceModel a b c)) + (G : Drawing S) (r : ℕ) (e : Set S) (φ_e : S_e → S) (G_e : Drawing S_e) + (hr : 2 ≤ r) (halpha : 9 * r ≤ 2 * alpha G) + (hnot_in : ¬ (e ⊆ allCuffsInsideSet G (r - 1))) + (hCut : IsCutAlongEdge G e a b c S_e φ_e G_e) : + r ≤ alpha G_e := + hCut.alpha_bound hS h3 he_model hr halpha hnot_in + +/-- Graph Minors VII, (7.2) (page 239): +"(7.2) *Let $\Sigma \cong \Sigma(a, b, c)$, where $3a + 3b + c \ge 3$, and let $G$ be a +boundary-linked proper graph in $\Sigma$. Let $e$ be an edge of $G$ which is not a loop, such that +$\bar{e} \cap bd(\Sigma) = \emptyset$, and there is no null-homotopic $G$-normal $O$-arc $A$ with +$|V(G) \cap A| \le 1$ and with $e$ inside $A$. Then $\phi_e^{-1}(G \setminus e)$ is boundary-linked +in $\Sigma_e$.*" -/ +theorem theorem_7_2_proof + {S_e : Type u} [TopologicalSpace S_e] + (hS : IsSurface S) {a b c : ℕ} (h3 : 3 ≤ 3 * a + 3 * b + c) + (he_model : Nonempty (S ≃ₜ SurfaceModel a b c)) + (G : Drawing S) (e : Set S) (φ_e : S_e → S) (G_e : Drawing S_e) + (hBL : IsBoundaryLinked G) + (hNoNull : ¬ ∃ A : Set S, G.IsNormal A ∧ IsNullHomotopicOArc A ∧ + (G.V ∩ A).ncard ≤ 1 ∧ IsInsideOArc e A) + (hCut : IsCutAlongEdge G e a b c S_e φ_e G_e) : + IsBoundaryLinked G_e := + hCut.boundaryLinked hS h3 he_model hBL hNoNull + +/-- Graph Minors VII, (7.3) (pages 239–240): +"(7.3) *Let $\Sigma \cong \Sigma(a, b, c)$ where $3a + 3b + c \ge 3$. Let $G$ be a proper graph in +$\Sigma$, and let $r$ be an integer with $|V(G) \cap C| \le r - 1$ for every cuff $C$ of $\Sigma$, +and with $2 \le r \le \frac{2}{9}\alpha(G)$. Then there is an edge $e$ of $G$ which is not a loop, +such that $e \notin \Delta_{r-1}$ and $\bar{e} \cap bd(\Sigma) = \emptyset$, and such that there is +no $G$-normal null-homotopic $O$-arc $F$ with $|V(G) \cap F| \le 1$ and with $e$ inside $F$.*" -/ +theorem theorem_7_3_proof + [T1Space S] (hS : IsSurface S) {a b c : ℕ} (h3 : 3 ≤ 3 * a + 3 * b + c) + (he_model : Nonempty (S ≃ₜ SurfaceModel a b c)) + (G : Drawing S) (r : ℕ) (hG : G.IsProper) + (hcuff : ∀ C ∈ cuffs S, (G.V ∩ C).ncard ≤ r - 1) + (hr : 2 ≤ r) (halpha : 9 * r ≤ 2 * alpha G) : + ∃ (e : Set S) (S_e : Type u) (_ : TopologicalSpace S_e) (_ : T1Space S_e) + (φ_e : S_e → S) (G_e : Drawing S_e), + IsCutAlongEdge G e a b c S_e φ_e G_e ∧ + ¬ (e ⊆ allCuffsInsideSet G (r - 1)) ∧ + (¬ ∃ F : Set S, G.IsNormal F ∧ IsNullHomotopicOArc F ∧ + (G.V ∩ F).ncard ≤ 1 ∧ IsInsideOArc e F) := + by + have : ConnectedSpace S := connectedSpace_of_model he_model + have ht2 : T2Space S := hS.2.1 + obtain ⟨e, he, h1, h2, h3', h4⟩ := exists_good_edge hS h3 he_model (r := r - 1) + (by omega) _ G rfl hG + (by rwa [Nat.sub_add_cancel (by omega)]) hcuff + obtain ⟨Y, tY, t1Y, φ, G', hcut⟩ := exists_cut hS he_model G hG he h1 + (disjoint_iff_inter_eq_empty.mp h2) + exact ⟨e, Y, tY, t1Y, φ, G', hcut, h3', h4⟩ + +/-- Graph Minors VII, (7.4) (page 240): +"(7.4) *Let $\Sigma \cong \Sigma(a, b, c)$, where $3a + 3b + c \ge 3$, and let $G$ be a +boundary-linked proper graph in $\Sigma$ with $\alpha(G) \ge \frac{9}{2}r$, where $r \ge 2$ is an +integer, and $|V(G) \cap C| \le r-1$ for every cuff $C$. Then there is an edge $e$ of $G$ which is +not a loop, with $\bar{e} \cap bd(\Sigma) = \emptyset$, such that $\phi_e^{-1}(G \setminus e)$ is +boundary-linked in $\Sigma_e$ and* +$$\alpha(\phi_e^{-1}(G \setminus e)) \ge r.$$" +Proved directly by combining `(7.1)`, `(7.2)`, and `(7.3)`. -/ +theorem theorem_7_4_proof + [T1Space S] (hS : IsSurface S) {a b c : ℕ} (h3 : 3 ≤ 3 * a + 3 * b + c) + (he_model : Nonempty (S ≃ₜ SurfaceModel a b c)) + (G : Drawing S) (r : ℕ) (hBL : IsBoundaryLinked G) + (halpha : 9 * r ≤ 2 * alpha G) (hr : 2 ≤ r) + (hcuff : ∀ C ∈ cuffs S, (G.V ∩ C).ncard ≤ r - 1) : + ∃ (e : Set S) (S_e : Type u) (_ : TopologicalSpace S_e) (_ : T1Space S_e) + (φ_e : S_e → S) (G_e : Drawing S_e), + IsCutAlongEdge G e a b c S_e φ_e G_e ∧ + IsBoundaryLinked G_e ∧ + r ≤ alpha G_e := by + obtain ⟨e, S_e, tS_e, t1S_e, φ_e, G_e, hCut, hnot_in, hNoNull⟩ := + theorem_7_3_proof hS h3 he_model G r hBL.1 hcuff hr halpha + have hBL_e : @IsBoundaryLinked S_e tS_e G_e := + @theorem_7_2_proof S _ S_e tS_e hS a b c h3 he_model G e φ_e G_e hBL hNoNull hCut + have halpha_e : r ≤ @alpha S_e tS_e G_e := + @theorem_7_1_proof S _ S_e tS_e hS a b c h3 he_model G r e φ_e G_e hr halpha hnot_in hCut + exact ⟨e, S_e, tS_e, t1S_e, φ_e, G_e, hCut, hBL_e, halpha_e⟩ + +/-! ## 2. Unconditional monotonicity and base cases for (7.5) -/ + +/-- `IsW36Bound S k n w` is antitone in `n`: if `n₁ ≤ n₂`, any bound `w` for matchings with +`≤ 2 * n₂` vertices is also a bound for matchings with `≤ 2 * n₁` vertices. -/ +theorem isW36Bound_anti_n {k n₁ n₂ w : ℕ} (hn : n₁ ≤ n₂) + (hw : IsW36Bound S k n₂ w) : + IsW36Bound S k n₁ w := by + intro G H hG hGV hH hHV + have hGV' : G.V.ncard ≤ 2 * n₂ := by omega + exact hw G H hG hGV' hH hHV + +/-- `wSurface S k n` is monotone in `n` on any surface `S`. -/ +theorem wSurface_mono_n + (hS : IsSurface S) (k : ℕ) {n₁ n₂ : ℕ} (hn : n₁ ≤ n₂) : + wSurface S k n₁ ≤ wSurface S k n₂ := by + obtain ⟨w₀, hw₀⟩ := exists_isW36Bound hS k n₂ + refine csInf_le_csInf ⟨0, fun w _ => Nat.zero_le w⟩ ⟨w₀, hw₀⟩ ?_ + intro w hw + exact isW36Bound_anti_n hn hw + +/-- `wMaxModel a b c k ≤ wMaxModel a b (c + 1) k` (Graph Minors VII, proof of (7.5), +page 240: "since $v(\Sigma, k) \le v$"). -/ +theorem wMaxModel_mono_c (a b c k : ℕ) : + wMaxModel a b c k ≤ wMaxModel a b (c + 1) k := by + unfold wMaxModel + have hsub : Finset.range (2 * (2 * a + b + c - 1) + 1) ⊆ + Finset.range (2 * (2 * a + b + (c + 1) - 1) + 1) := by + intro x hx + rw [Finset.mem_range] at hx ⊢ + omega + refine le_trans (Finset.sup_mono hsub) ?_ + refine Finset.sup_mono_fun fun c' _ => ?_ + have hS_model : IsSurface (SurfaceModel a b c') := (modelCriterion.1 a b c').1 + refine wSurface_mono_n hS_model (2 * k) ?_ + exact Nat.mul_le_mul_left 3 (by omega) + +/-- `muModel a b c k ≤ muModel a b (c + 1) k`. -/ +theorem muModel_mono_c (a b c k : ℕ) : + muModel a b c k ≤ muModel a b (c + 1) k := by + unfold muModel + have hw := wMaxModel_mono_c a b c k + have h1 : 2 * (2 * a + b + c) ≤ 2 * (2 * a + b + (c + 1)) := by omega + have h2 : k + wMaxModel a b c k ≤ k + wMaxModel a b (c + 1) k := by omega + exact Nat.add_le_add_right (Nat.mul_le_mul h1 h2) (2 * k) + +/-- `vModel a b c k ≤ vModel a b (c + 1) k` (Graph Minors VII, proof of (7.5), +page 240: "since $v(\Sigma, k) \le v$"). -/ +theorem vModel_mono_c (a b c k : ℕ) : + vModel a b c k ≤ vModel a b (c + 1) k := by + unfold vModel + have hw := wMaxModel_mono_c a b c k + have hmu := muModel_mono_c a b c k + have h1 : 6 * (2 * a + b + c - 1) ≤ 6 * (2 * a + b + (c + 1) - 1) := by omega + have h2 : + wMaxModel a b c k + 2 * muModel a b c k + 1 ≤ + wMaxModel a b (c + 1) k + 2 * muModel a b (c + 1) k + 1 := by omega + exact Nat.add_le_add_right (Nat.mul_le_mul h1 h2) (2 * k) + +/-- For all `a b c k : ℕ`, `2 * k ≤ vModel a b c k`. -/ +theorem two_mul_k_le_vModel (a b c k : ℕ) : + 2 * k ≤ vModel a b c k := by + unfold vModel + omega + +/-- If `S ≃ₜ SurfaceModel a b 0`, then `cuffs S = ∅` and `bd S = ∅`. -/ +theorem bd_eq_empty_of_homeomorph_surfaceModel_zero {a b : ℕ} + (he : Nonempty (S ≃ₜ SurfaceModel a b 0)) : + cuffs S = ∅ ∧ bd S = ∅ := by + rcases he with ⟨e⟩ + obtain ⟨ht, f, hf⟩ := presents_ew a b 0 + have : T2Space (SurfaceModel a b 0) := ht + have hcuffs0 : cuffs (SurfaceModel a b 0) = ∅ := by + rw [cuffs_eq_holeC hf] + simp + have hbd0 : bd (SurfaceModel a b 0) = ∅ := by + rw [← sUnion_cuffs, hcuffs0, sUnion_empty] + have hbdS : bd S = ∅ := by + have himg := image_bd_homeomorph e.symm + rw [hbd0, image_empty] at himg + exact himg.symm + have hcuffsS : cuffs S = ∅ := by + unfold cuffs + rw [hbdS] + simp [componentsIn] + exact ⟨hcuffsS, hbdS⟩ + +/-- The empty drawing `emptyDrawing S` in any space `S` is a surface forest. -/ +theorem isSurfaceForest_emptyDrawing : IsSurfaceForest (emptyDrawing S) := by + refine ⟨?_, ?_⟩ + · change bd S ∩ (emptyDrawing S).U ⊆ (emptyDrawing S).V + simp [emptyDrawing] + · intro u W _ + cases W with + | nil hv => exact False.elim hv + | cons hlink _ => exact False.elim hlink.2.1 + +/-- Unconditional proof of the base case `V(H) ∩ bd(Σ) = ∅` in Graph Minors VII, (7.5) (page 240: +"If $V(H) \cap bd(\Sigma) = \emptyset$ the theorem is trivial."): the empty subdrawing +`emptyDrawing S` of `G` is a surface forest homoplastic to `H`. -/ +theorem isGFeasible_of_bd_inter_empty (G : Drawing S) {H : Drawing S} + (hH : IsSurfaceForest H) (hbd_empty : H.V ∩ bd S = ∅) : + IsGFeasible G H := by + refine ⟨emptyDrawing S, isSurfaceForest_emptyDrawing, ?_, ?_⟩ + · refine ⟨Homeomorph.refl S, fun _ _ => rfl, ?_⟩ + have hmapV : (mapDrawingHomeo (Homeomorph.refl S) H).V = H.V := image_id H.V + refine ⟨IsProper.map_homeo (Homeomorph.refl S) hH.1, isSurfaceForest_emptyDrawing.1, + IsGraphForest.map_homeo (Homeomorph.refl S) hH.2, isSurfaceForest_emptyDrawing.2, ?_, ?_⟩ + · rw [hmapV, hbd_empty] + simp [emptyDrawing] + · intro s hs + rw [hmapV, hbd_empty] at hs + exact False.elim hs + · refine ⟨empty_subset _, ?_⟩ + intro e he + exfalso + exact he.1.ne_empty (subset_empty_iff.mp (he.2.1.trans sdiff_subset)) + +/-- Graph Minors VII, (7.5) (pages 240–241): +"(7.5) *Let $\Sigma \cong \Sigma(a, b, c)$, where $3a + 3b + c \ge 3$. Let $k \ge 0$ be an +integer, and let $v = v(\Sigma(a, b, c+1), k)$. Let $G$ be a boundary-linked proper graph in +$\Sigma$ with $\alpha(G) \ge 42kv$ and with $|V(G) \cap bd(\Sigma)| \le 2k - 2c - 2$. Let $H$ be a +forest in $\Sigma$ with $V(G) \cap bd(\Sigma) = V(H) \cap bd(\Sigma)$. Then $H$ is $G$-feasible.*" +-/ +theorem theorem_7_5_proof + [T1Space S] (hS : IsSurface S) {a b c : ℕ} (h3 : 3 ≤ 3 * a + 3 * b + c) + (he : Nonempty (S ≃ₜ SurfaceModel a b c)) + (k : ℕ) (G H : Drawing S) + (hBL : IsBoundaryLinked G) + (halpha : 42 * k * vModel a b (c + 1) k ≤ alpha G) + (hbd_card : (G.V ∩ bd S).ncard + 2 * c + 2 ≤ 2 * k) + (hH : IsSurfaceForest H) (hbd_eq : G.V ∩ bd S = H.V ∩ bd S) : + IsGFeasible G H := by + -- Follow the paper's three cases (pages 240–241): + by_cases hc2 : 2 ≤ c + · -- Case 1: "If c ≥ 2 this follows from (6.1), since v(Σ, k) ≤ v." + have hne : (a, b, c) ≠ (0, 0, 2) := by + rintro ⟨rfl, rfl, rfl⟩ + omega + have hk_pos : 3 ≤ k := by omega + have hv_le : vSurface S k ≤ vModel a b (c + 1) k := + le_trans (vSurface_le_vModel he k) (vModel_mono_c a b c k) + have hv_pos : 6 ≤ vModel a b (c + 1) k := by + have := two_mul_k_le_vModel a b (c + 1) k + omega + have h9_lt : 9 * k * vSurface S k < alpha G := by + have hmul : 9 * k * vSurface S k ≤ 9 * k * vModel a b (c + 1) k := + Nat.mul_le_mul_left (9 * k) hv_le + nlinarith + have hbd_card' : (G.V ∩ bd S).ncard ≤ 2 * k - 2 * c := by omega + exact theorem_6_1_proof hS hc2 hne he k G H hBL hbd_card' h9_lt hH hbd_eq + · -- Case 2: "If V(H) ∩ bd(Σ) = ∅ the theorem is trivial." + rcases (H.V ∩ bd S).eq_empty_or_nonempty with hbd_empty | hbd_ne + · exact isGFeasible_of_bd_inter_empty G hH hbd_empty + · -- Case 3: "We assume then that V(H) ∩ bd(Σ) ≠ ∅ and c ≤ 1. It follows that c = 1 and k ≥ 3." + have hc_ne_zero : c ≠ 0 := by + rintro rfl + have hbdS := (bd_eq_empty_of_homeomorph_surfaceModel_zero he).2 + rw [hbdS, inter_empty] at hbd_ne + exact hbd_ne.ne_empty rfl + have hc1 : c = 1 := by omega + subst hc1 + have hGV_ne : (G.V ∩ bd S).Nonempty := hbd_eq.symm ▸ hbd_ne + have hGV_pos : 1 ≤ (G.V ∩ bd S).ncard := + (ncard_pos (G.finite_V.subset inter_subset_left)).mpr hGV_ne + have hk3 : 3 ≤ k := by omega + let v := vModel a b 2 k + let r := (28 * k * v) / 3 + have hv_ge : 2 * k ≤ v := two_mul_k_le_vModel a b 2 k + have hkv_ge : 6 * k ≤ 28 * k * v := by nlinarith + have hr_ge : 2 * k ≤ r := by + dsimp [r] + omega + have hr2 : 2 ≤ r := by omega + have h9r : 9 * r ≤ 2 * alpha G := by + dsimp [r] + have hdiv : 3 * ((28 * k * v) / 3) ≤ 28 * k * v := Nat.mul_div_le (28 * k * v) 3 + nlinarith + have hcuff_le : ∀ C ∈ cuffs S, (G.V ∩ C).ncard ≤ r - 1 := by + intro C hC + have hC_sub : C ⊆ bd S := by + rw [← sUnion_cuffs] + exact subset_sUnion_of_mem hC + have hle_bd : (G.V ∩ C).ncard ≤ (G.V ∩ bd S).ncard := + ncard_le_ncard (inter_subset_inter_right G.V hC_sub) + (G.finite_V.subset inter_subset_left) + omega + obtain ⟨e, S_e, tS_e, t1S_e, φ_e, G_e, hCut, hBL_e, halpha_e⟩ := + theorem_7_4_proof hS h3 he G r hBL h9r hr2 hcuff_le + have hbd_card4 : (G.V ∩ bd S).ncard + 4 ≤ 2 * k := by omega + obtain ⟨H', hH', hbd_eq', hbd_card', h9_lt', himp⟩ := + oneCuffCutEdgeFeasibilityStep hS a b he k G H e φ_e G_e hbd_card4 hH hbd_eq hCut halpha_e + have hne2 : (a, b, 2) ≠ (0, 0, 2) := by + rintro ⟨rfl, rfl, -⟩ + omega + have hFeas' : @IsGFeasible S_e tS_e G_e H' := + theorem_6_1_general (by omega) hne2 S_e hCut.isSurface hCut.homeo_model G_e H' hBL_e + rfl hbd_card' h9_lt' hH' hbd_eq' + exact himp hFeas' + +/-- Graph Minors VII, (7.5) for the cited interface `GM12.GM07Theorem75Statement`. -/ +theorem gm07_theorem_7_5 + : + GM12.GM07Theorem75Statement.{u} := by + intro S _ _ hS a b c h3 he k G _ hBL halpha hbd_card H hH hbd_eq + exact theorem_7_5_proof hS h3 he k G H hBL halpha hbd_card hH hbd_eq + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section8.lean b/LeanPool/GraphMinor/GM07/Section8.lean new file mode 100644 index 0000000000..5a31e5d5ff --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section8.lean @@ -0,0 +1,1416 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section5a +public import LeanPool.GraphMinor.GM07.Section5b +public import LeanPool.GraphMinor.GM07.Section11b +public import LeanPool.GraphMinor.Surface.CutLift +public import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.GM19.Section6a +import LeanPool.GraphMinor.Surface.Epstein + +/-! +# Graph Minors VII, Section 8: Schisms and Schismatic Sets (pages 241–242) + +This file formalizes Section 8 of Robertson and Seymour, +*Graph Minors. VII. Disjoint Paths on a Surface*, J. Combin. Theory Ser. B **45** (1988), 212–254: +- `not_ssubset_of_isOArc`: no `O`-arc is a proper subset of another `O`-arc. +- `IsNearPlanar.mono`: monotonicity of `IsNearPlanar`. +- `theorem_5_1_of_not_isSphere`: (5.1) for any solid subset `X ⊆ S` when `¬ IsSphere S ∨ X ≠ univ`. +- `isPlanarInCappedCuff_iff_forall_isOArc`: a solid subset `X ⊆ S` is planar in `Σ + Ĉ` if and only + if every `O`-arc `F ⊆ X` is planar in `Σ + Ĉ`. +- `isNearPlanar_iff_forall_not_isSchismatic`: "It is easy to verify, using (5.1) and (5.2), that if + $X \subseteq \Sigma$ is solid and connected, then $X$ is near-planar if and only if no subset of + $X$ is + schismatic." (page 241). +- `exists_schismatic_of_isAlphaCandidate`: every `α(G)`-candidate `X` (`IsAlphaCandidate G X`) on a + connected non-sphere surface contains a `G`-normal schismatic subset `Y ⊆ X` (providing the + hypothesis `hcontains` of `GraphMinor.GM12.alpha_ge_of_schismatic_counts`). +- `alpha_eq_sInf_schismatic`: "Thus $\alpha(G)$ equals the minimum of $|V(G) \cap X|$, taken over + all + $G$-normal schismatic sets $X$" (page 241). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Function Topology Metric Filter unitInterval +open GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Basic Properties of `O`-Arcs, `[0, 1]`-Arcs, and `X_i`-Arcs -/ + +/-- No `O`-arc in a Hausdorff space is a proper subset of another `O`-arc. -/ +theorem not_ssubset_of_isOArc [T2Space S] {F F' : Set S} + (hF : IsOArc F) (hF' : IsOArc F') : + ¬ (F' ⊂ F) := by + intro ⟨hsub, hnot⟩ + obtain ⟨x, hxF, hxF'⟩ := not_subset.mp hnot + obtain ⟨y, hyF'⟩ := isOArc_nonempty hF' + have hyF : y ∈ F := hsub hyF' + have hxy : x ≠ y := fun h => hxF' (h ▸ hyF') + obtain ⟨A, B, hA, hB, hAB_union, hAB_inter⟩ := hF.lines hxF hyF hxy + have hG : IsGraph ({x, y} : Set S) ({A, B} : Set (Set S)) := by + refine ⟨(finite_singleton y).insert x, (finite_singleton B).insert A, ?_, ?_⟩ + · rintro e (rfl | rfl) + · exact ⟨x, y, hxy, hA, inter_eq_right.mpr + (pair_subset hA.left_mem hA.right_mem)⟩ + · exact ⟨x, y, hxy, hB, inter_eq_right.mpr + (pair_subset hB.left_mem hB.right_mem)⟩ + · rintro e (rfl | rfl) f (rfl | rfl) hne + · exact (hne rfl).elim + · exact hAB_inter.le + · rw [inter_comm] + exact hAB_inter.le + · exact (hne rfl).elim + have hF'_gr : F' ⊆ gr ({x, y} : Set S) ({A, B} : Set (Set S)) := by + intro z hz + rcases hAB_union ▸ hsub hz with hzA | hzB + · exact Or.inr ⟨A, Or.inl rfl, hzA⟩ + · exact Or.inr ⟨B, Or.inr rfl, hzB⟩ + have hnot_A : ¬ (A ⊆ F') := fun h => hxF' (h hA.left_mem) + have hnot_B : ¬ (B ⊆ F') := fun h => hxF' (h hB.left_mem) + have hdisj_A : Disjoint (A \ {x, y}) F' := + (hG.edge_or hF' hF'_gr (Or.inl rfl)).resolve_left hnot_A + have hdisj_B : Disjoint (B \ {x, y}) F' := + (hG.edge_or hF' hF'_gr (Or.inr rfl)).resolve_left hnot_B + obtain ⟨z, hzF', hzy⟩ := hF'.exists_ne y + have hzx : z ≠ x := fun h => hxF' (h ▸ hzF') + have hz_not_xy : z ∉ ({x, y} : Set S) := by + rw [mem_insert_iff, mem_singleton_iff] + exact not_or.mpr ⟨hzx, hzy⟩ + rcases hAB_union ▸ hsub hzF' with hzA | hzB + · exact disjoint_left.mp hdisj_A ⟨hzA, hz_not_xy⟩ hzF' + · exact disjoint_left.mp hdisj_B ⟨hzB, hz_not_xy⟩ hzF' + +/-- Every `[0, 1]`-arc in a Hausdorff space is solid (`IsSolid`). -/ +theorem IsLineWithEnds.isSolid [T2Space S] {L : Set S} {u v : S} + (hL : IsLineWithEnds L u v) : IsSolid L := by + obtain ⟨f, _, _⟩ := hL + let g : I → S := fun t => (f t).1 + have hg : Continuous g := continuous_subtype_val.comp f.continuous + have hrange : L = range g := by + ext x + constructor + · intro hx + exact ⟨f.symm ⟨x, hx⟩, by simp [g]⟩ + · rintro ⟨t, rfl⟩ + exact (f t).2 + rw [hrange] + exact ⟨isLocallyArcConnected_of_locJoin fun x hx => locJoin_range hg hx, + (isCompact_range hg).isClosed⟩ + +/-- Every `[0, 1]`-arc is connected (`IsConnected`). -/ +theorem IsLineWithEnds.isConnected {L : Set S} {u v : S} + (hL : IsLineWithEnds L u v) : IsConnected L := by + obtain ⟨f, _, _⟩ := hL + let g : I → S := fun t => (f t).1 + have hg : Continuous g := continuous_subtype_val.comp f.continuous + have hrange : L = range g := by + ext x + constructor + · intro hx + exact ⟨f.symm ⟨x, hx⟩, by simp [g]⟩ + · rintro ⟨t, rfl⟩ + exact (f t).2 + rw [hrange] + exact isConnected_range hg + +/-- Every `O`-arc is connected (`IsConnected`). -/ +theorem IsOArc.isConnected {F : Set S} (hF : IsOArc F) : IsConnected F := + ⟨isOArc_nonempty hF, hF.isPreconnected⟩ + +private lemma isConnected_union {A B : Set S} (hA : IsConnected A) (hB : IsConnected B) + (hne : (A ∩ B).Nonempty) : IsConnected (A ∪ B) := by + obtain ⟨x, hxA, hxB⟩ := hne + exact ⟨⟨x, Or.inl hxA⟩, hA.2.union x hxA hxB hB.2⟩ + +/-- Every `X₁`-arc in a surface is solid and connected. -/ +theorem IsX1Arc.isSolid_and_isConnected (hS : IsSurface S) {X : Set S} (hX : IsX1Arc X) : + IsSolid X ∧ IsConnected X := by + have : T2Space S := hS.2.1 + obtain ⟨A₁, A₂, P, u, v, hA₁, hA₂, _, hP, huA₁, hvA₂, _, _, rfl⟩ := hX + have hsol : IsSolid (A₁ ∪ A₂ ∪ P) := + theorem_11_6_proof hS (theorem_11_6_proof hS (IsOArc.isSolid hA₁) (IsOArc.isSolid hA₂)) + (IsLineWithEnds.isSolid hP) + have hA₁P_conn : IsConnected (A₁ ∪ P) := + isConnected_union (IsOArc.isConnected hA₁) (IsLineWithEnds.isConnected hP) + ⟨u, huA₁, hP.left_mem⟩ + have hconn : IsConnected (A₁ ∪ P ∪ A₂) := + isConnected_union hA₁P_conn (IsOArc.isConnected hA₂) + ⟨v, Or.inr hP.right_mem, hvA₂⟩ + rw [union_right_comm] at hconn + exact ⟨hsol, hconn⟩ + +/-- Every `X₂`-arc in a surface is solid and connected. -/ +theorem IsX2Arc.isSolid_and_isConnected (hS : IsSurface S) {X : Set S} (hX : IsX2Arc X) : + IsSolid X ∧ IsConnected X := by + have : T2Space S := hS.2.1 + obtain ⟨A₁, A₂, u, hA₁, hA₂, hcap, rfl⟩ := hX + have hu : u ∈ A₁ ∩ A₂ := hcap ▸ mem_singleton u + exact ⟨theorem_11_6_proof hS (IsOArc.isSolid hA₁) (IsOArc.isSolid hA₂), + isConnected_union (IsOArc.isConnected hA₁) (IsOArc.isConnected hA₂) ⟨u, hu.1, hu.2⟩⟩ + +/-- Every `X₃`-arc in a surface is solid and connected. -/ +theorem IsX3Arc.isSolid_and_isConnected (hS : IsSurface S) {X : Set S} (hX : IsX3Arc X) : + IsSolid X ∧ IsConnected X := by + have : T2Space S := hS.2.1 + obtain ⟨P₁, P₂, P₃, u, v, _, hP₁, hP₂, hP₃, _, _, _, rfl⟩ := hX + have hsol : IsSolid (P₁ ∪ P₂ ∪ P₃) := + theorem_11_6_proof hS (theorem_11_6_proof hS (IsLineWithEnds.isSolid hP₁) + (IsLineWithEnds.isSolid hP₂)) + (IsLineWithEnds.isSolid hP₃) + have h12 : IsConnected (P₁ ∪ P₂) := + isConnected_union (IsLineWithEnds.isConnected hP₁) (IsLineWithEnds.isConnected hP₂) + ⟨u, hP₁.left_mem, hP₂.left_mem⟩ + have h123 : IsConnected (P₁ ∪ P₂ ∪ P₃) := + isConnected_union h12 (IsLineWithEnds.isConnected hP₃) + ⟨u, Or.inl hP₁.left_mem, hP₃.left_mem⟩ + exact ⟨hsol, h123⟩ + +/-- Every schismatic subset of a surface is solid and connected. -/ +theorem IsSchismatic.isSolid_and_isConnected (hS : IsSurface S) {X : Set S} + (hX : IsSchismatic X) : IsSolid X ∧ IsConnected X := by + have : T2Space S := hS.2.1 + rcases hX.1 with h | h | h | h + · exact ⟨IsOArc.isSolid h, IsOArc.isConnected h⟩ + · exact h.isSolid_and_isConnected hS + · exact h.isSolid_and_isConnected hS + · exact h.isSolid_and_isConnected hS + +/-- Monotonicity of `IsNearPlanar`. -/ +theorem IsNearPlanar.mono {X Y : Set S} (hX : IsNearPlanar X) (hYX : Y ⊆ X) : + IsNearPlanar Y := by + rcases hX with hpl | ⟨C, hC, hcap⟩ + · exact Or.inl (IsPlanar.mono hpl hYX) + · exact Or.inr ⟨C, hC, IsPlanarInCappedCuff.mono hcap hYX⟩ + +/-! ## 2. Planarity of Solid Sets in `Σ` and `Σ + Ĉ` via `O`-Arcs -/ + +/-- Graph Minors VII, (5.1) extended to all solid `X ⊆ S` when `¬ IsSphere S ∨ X ≠ univ`: +`X` is planar in `S` if and only if every `O`-arc `F ⊆ X` is planar in `S`. -/ +theorem theorem_5_1_of_not_isSphere + (hS : IsSurface S) [ConnectedSpace S] {X : Set S} + (hns : ¬ IsSphere S ∨ X ≠ univ) (hX_solid : IsSolid X) : + IsPlanar X ↔ ∀ F : Set S, IsOArc F → F ⊆ X → IsPlanar F := by + have : T2Space S := hS.2.1 + constructor + · intro hX F _ hFX + exact IsPlanar.mono hX hFX + · intro hall + by_cases hX_ne : X ≠ univ + · refine (theorem_5_1_proof hS hX_solid hX_ne).mpr fun F hF hFX => ?_ + exact (isPlanar_iff_isNullHomotopicOArc_of_isOArc hS hF).mp (hall F hF hFX) + · have hns_S : ¬ IsSphere S := hns.resolve_right hX_ne + have hX_univ : X = univ := not_ne_iff.mp hX_ne + by_cases hbd : bd S = ∅ + · obtain ⟨F₀, hF₀, hF₀_nn⟩ := + GraphMinor.GM19.exists_not_nullHomotopic hS hbd hns_S + exfalso + exact hF₀_nn ((isPlanar_iff_isNullHomotopicOArc_of_isOArc hS hF₀).mp + (hall F₀ hF₀ (hX_univ ▸ subset_univ F₀))) + · refine isPlanar_of_solid_flat_bd_ne_empty hS hbd hX_solid ?_ + refine isFlat_of_forall_isNullHomotopicOArc hS fun F hFX hF => ?_ + exact (isPlanar_iff_isNullHomotopicOArc_of_isOArc hS hF).mp (hall F hF hFX) + +/-- The image of a solid set `X ⊆ S` under the embedding `j : S → S'` of a capped cuff is solid +in `S'`. -/ +theorem IsSolid.image_of_isCappedCuff (hS : IsSurface S) {C X : Set S} + {S' : Type u} [TopologicalSpace S'] {j : S → S'} {D : Set S'} + (hCap : IsCappedCuff C S' j D) (hX : IsSolid X) : + IsSolid (j '' X) := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have : T2Space S' := hCap.isSurface.2.1 + have hj : IsEmbedding j := hCap.isEmbedding + refine ⟨?_, (hX.2.isCompact.image hj.continuous).isClosed⟩ + rintro _ ⟨x, hxX, rfl⟩ A' hA'_open hjx_A' + obtain ⟨A, hA_sub, hxA, hA_open, hXA_arc⟩ := + hX.1 x hxX (j ⁻¹' A') (hA'_open.preimage hj.continuous) hjx_A' + obtain ⟨U', hU'_open, hU'_pre⟩ := hj.isInducing.isOpen_iff.mp hA_open + refine ⟨U' ∩ A', inter_subset_right, ⟨mem_preimage.mp (hU'_pre.symm ▸ hxA), hjx_A'⟩, + hU'_open.inter hA'_open, ?_⟩ + have heq : j '' X ∩ (U' ∩ A') = j '' (X ∩ A) := by + ext y + constructor + · rintro ⟨⟨z, hzX, rfl⟩, hzU', _⟩ + exact ⟨z, ⟨hzX, hU'_pre ▸ hzU'⟩, rfl⟩ + · rintro ⟨z, ⟨hzX, hzA⟩, rfl⟩ + exact ⟨⟨z, hzX, rfl⟩, mem_preimage.mp (hU'_pre.symm ▸ hzA), hA_sub hzA⟩ + rw [heq] + rintro _ ⟨z₁, hz₁, rfl⟩ _ ⟨z₂, hz₂, rfl⟩ hne + obtain ⟨L, hL_sub, hL_line⟩ := hXA_arc z₁ hz₁ z₂ hz₂ (fun h => hne (congrArg j h)) + exact ⟨j '' L, image_mono hL_sub, hL_line.map_of_embedding hj⟩ + +/-- A solid subset `X ⊆ S` is planar in `Σ + Ĉ` (`IsPlanarInCappedCuff C X`) if and only if every +`O`-arc `F ⊆ X` is planar in `Σ + Ĉ`. -/ +theorem isPlanarInCappedCuff_iff_forall_isOArc + (hS : IsSurface S) [ConnectedSpace S] {C X : Set S} + (hC : C ∈ cuffs S) (hX_solid : IsSolid X) : + IsPlanarInCappedCuff C X ↔ + ∀ F : Set S, IsOArc F → F ⊆ X → IsPlanarInCappedCuff C F := by + constructor + · intro hX F _ hFX + exact hX.mono hFX + · intro hall + have h_all : ∀ (S' : Type u) [TopologicalSpace S'] (j : S → S') (D : Set S'), + IsCappedCuff C S' j D → IsPlanar (j '' X) := by + intro S' _ j D hCap + have hS' : IsSurface S' := hCap.isSurface + have : T2Space S' := hS'.2.1 + have : T2Space S := hS.2.1 + have : ConnectedSpace S' := hCap.connectedSpace hS + have hj : IsEmbedding j := hCap.isEmbedding + have hjX_solid : IsSolid (j '' X) := IsSolid.image_of_isCappedCuff hS hCap hX_solid + have hjX_ne : j '' X ≠ univ := by + obtain ⟨hD_map, gD, cD⟩ := hCap.isClosedDisc.exists_isChart + have hz₀ : gD 0 ∈ discInt D := by + refine ⟨cD.gm (mem_closedBall_self zero_le_one), fun hbd => ?_⟩ + have h_sph : hD_map (gD 0) ∈ sphere (0 : ℂ) 1 := + cD.bd ▸ mem_image_of_mem hD_map hbd + rw [cD.hg (mem_closedBall_self zero_le_one)] at h_sph + simp at h_sph + intro huniv + have hz₀_mem : gD 0 ∈ j '' X := huniv ▸ mem_univ (gD 0) + obtain ⟨x, _, h_eq⟩ := hz₀_mem + have hmem_D : j x ∈ range j ∩ D := ⟨mem_range_self x, h_eq ▸ hz₀.1⟩ + rw [hCap.inter_eq, ← hCap.discBd_eq] at hmem_D + exact hz₀.2 (h_eq ▸ hmem_D) + refine (theorem_5_1_proof hS' hjX_solid hjX_ne).mpr fun F' hF' hF'jX => ?_ + have hF'_range : F' ⊆ range j := hF'jX.trans (image_subset_range j X) + have hj_pre_oarc : IsOArc (j ⁻¹' F') := by + obtain ⟨φ⟩ := id hF' + have hex : ∀ z : Circle, ∃ x : S, j x = (φ z).1 := fun z => hF'_range (φ z).2 + choose g hg using hex + have hg_cont : Continuous g := by + rw [hj.continuous_iff] + have : j ∘ g = Subtype.val ∘ φ := funext hg + rw [this] + exact continuous_subtype_val.comp φ.continuous + have hg_inj : Function.Injective g := fun z₁ z₂ heq => + φ.injective (Subtype.ext (by rw [← hg z₁, ← hg z₂, heq])) + have : CompactSpace S := hS.1 + have hg_emb : IsEmbedding g := (hg_cont.isClosedEmbedding hg_inj).isEmbedding + have hrange_g : range g = j ⁻¹' F' := by + ext x + constructor + · rintro ⟨z, rfl⟩ + change j (g z) ∈ F' + rw [hg z] + exact (φ z).2 + · intro hx + exact ⟨φ.symm ⟨j x, hx⟩, hj.injective (by rw [hg]; simp)⟩ + rw [← hrange_g] + exact ⟨hg_emb.toHomeomorph⟩ + have hj_pre_sub : j ⁻¹' F' ⊆ X := by + intro x hx + obtain ⟨y, hyX, hy_eq⟩ := hF'jX hx + exact hj.injective hy_eq ▸ hyX + have hj_img_eq : j '' (j ⁻¹' F') = F' := image_preimage_eq_iff.mpr hF'_range + have hpl : IsPlanar F' := + hj_img_eq ▸ (hall (j ⁻¹' F') hj_pre_oarc hj_pre_sub).2.2 S' j D hCap + exact (isPlanar_iff_isNullHomotopicOArc_of_isOArc hS' hF').mp hpl + obtain ⟨c₀, _⟩ := isOArc_nonempty (cuff_isOArc hS hC) + have : Nonempty S := ⟨c₀⟩ + obtain ⟨S', topS', j, D, hS', hj, hD, hunion, hinter, hbdD⟩ := paste_disc S C hS hC + have hCap : IsCappedCuff C S' j D := ⟨hC, hS', hj.isEmbedding, hD, hbdD.1, hunion, hinter⟩ + exact ⟨hC, ⟨S', topS', j, D, hCap, h_all S' j D hCap⟩, h_all⟩ + +/-! ## 3. Connecting Disjoint `O`-Arcs and Non-Near-Planarity Criterion -/ + +/-- In a Hausdorff space, if `A₁, A₂` are nonempty disjoint closed subsets of an arc-connected set +`X`, there is a `[0, 1]`-arc `P ⊆ X` with ends `u ∈ A₁` and `v ∈ A₂` such that `P ∩ A₁ = {u}` and +`P ∩ A₂ = {v}`. -/ +theorem exists_connecting_line_between_disjoint_closed [T2Space S] {X A₁ A₂ : Set S} + (hX_arc : IsArcConnected X) (hA₁X : A₁ ⊆ X) (hA₂X : A₂ ⊆ X) + (hA₁_closed : IsClosed A₁) (hA₂_closed : IsClosed A₂) + (hA₁_ne : A₁.Nonempty) (hA₂_ne : A₂.Nonempty) (hdisj : Disjoint A₁ A₂) : + ∃ P : Set S, ∃ u v : S, + P ⊆ X ∧ u ∈ A₁ ∧ v ∈ A₂ ∧ IsLineWithEnds P u v ∧ P ∩ A₁ = {u} ∧ P ∩ A₂ = {v} := by + obtain ⟨x₁, hx₁⟩ := hA₁_ne + obtain ⟨x₂, hx₂⟩ := hA₂_ne + have hx₁₂ : x₁ ≠ x₂ := fun h => disjoint_left.mp hdisj hx₁ (h ▸ hx₂) + obtain ⟨L, hLX, e, he0, he1⟩ := hX_arc x₁ (hA₁X hx₁) x₂ (hA₂X hx₂) hx₁₂ + let γ : I → S := fun t => (e t).1 + have hγc : Continuous γ := continuous_subtype_val.comp e.continuous + have hγ_inj : Function.Injective γ := Subtype.val_injective.comp e.injective + have hγ_mem : ∀ t : I, γ t ∈ X := fun t => hLX (e t).2 + have hγ0 : γ 0 = x₁ := he0 + have hγ1 : γ 1 = x₂ := he1 + let K₁ : Set I := γ ⁻¹' A₂ + have hK₁_closed : IsClosed K₁ := hA₂_closed.preimage hγc + have hK₁_ne : K₁.Nonempty := ⟨1, by change γ 1 ∈ A₂; rw [hγ1]; exact hx₂⟩ + let t₁ : I := sInf K₁ + have ht₁_mem : t₁ ∈ K₁ := hK₁_closed.csInf_mem hK₁_ne (OrderBot.bddBelow K₁) + have hγt₁_A₂ : γ t₁ ∈ A₂ := ht₁_mem + have ht₁_lt_not_A₂ : ∀ t : I, t < t₁ → γ t ∉ A₂ := + fun t hlt ht => not_lt_of_ge (csInf_le (OrderBot.bddBelow K₁) ht) hlt + let K₀ : Set I := γ ⁻¹' A₁ ∩ Icc 0 t₁ + have hK₀_closed : IsClosed K₀ := (hA₁_closed.preimage hγc).inter isClosed_Icc + have hK₀_ne : K₀.Nonempty := + ⟨0, by change γ 0 ∈ A₁; rw [hγ0]; exact hx₁, + le_rfl, Subtype.mk_le_mk.mpr (unitInterval.nonneg t₁)⟩ + let t₀ : I := sSup K₀ + have ht₀_mem : t₀ ∈ K₀ := hK₀_closed.csSup_mem hK₀_ne (OrderTop.bddAbove K₀) + have hγt₀_A₁ : γ t₀ ∈ A₁ := ht₀_mem.1 + have ht₀_lt_t₁ : t₀ < t₁ := by + rcases eq_or_lt_of_le ht₀_mem.2.2 with heq | hlt + · exfalso + have : γ t₁ ∈ A₁ := heq ▸ hγt₀_A₁ + exact disjoint_left.mp hdisj this hγt₁_A₂ + · exact hlt + refine ⟨γ '' Icc t₀ t₁, γ t₀, γ t₁, ?_, hγt₀_A₁, hγt₁_A₂, + isLineWithEnds_image_Icc_of_injOn hγc ht₀_lt_t₁ hγ_inj.injOn, ?_, ?_⟩ + · rintro _ ⟨t, _, rfl⟩ + exact hγ_mem t + · ext z + simp only [mem_inter_iff, mem_image, mem_Icc, mem_singleton_iff] + constructor + · rintro ⟨⟨t, ⟨ht0, ht1⟩, rfl⟩, hγt_A₁⟩ + have ht_K₀ : t ∈ K₀ := + ⟨hγt_A₁, Subtype.mk_le_mk.mpr (unitInterval.nonneg t), ht1⟩ + have ht_le : t ≤ t₀ := le_csSup (OrderTop.bddAbove K₀) ht_K₀ + exact congrArg γ (le_antisymm ht_le ht0) + · rintro rfl + exact ⟨⟨t₀, ⟨le_rfl, ht₀_lt_t₁.le⟩, rfl⟩, hγt₀_A₁⟩ + · ext z + simp only [mem_inter_iff, mem_image, mem_Icc, mem_singleton_iff] + constructor + · rintro ⟨⟨t, ⟨_, ht1⟩, rfl⟩, hγt_A₂⟩ + have ht_ge : t₁ ≤ t := csInf_le (OrderBot.bddBelow K₁) hγt_A₂ + exact congrArg γ (le_antisymm ht1 ht_ge) + · rintro rfl + exact ⟨⟨t₁, ⟨ht₀_lt_t₁.le, le_rfl⟩, rfl⟩, hγt₁_A₂⟩ + +/-- In a cylinder `S ≃ₜ SurfaceModel 0 0 2`, every subset `Z ⊆ S` is planar in `Σ + Ĉ` for every +cuff `C ∈ cuffs S`. -/ +theorem isPlanarInCappedCuff_of_homeo_cylinder + (hS : IsSurface S) [ConnectedSpace S] + (hcyl : Nonempty (S ≃ₜ SurfaceModel 0 0 2)) + {C : Set S} (hC : C ∈ cuffs S) (Z : Set S) : + IsPlanarInCappedCuff C Z := by + have h_all : ∀ (S' : Type u) [TopologicalSpace S'] (j : S → S') (D : Set S'), + IsCappedCuff C S' j D → IsPlanar (j '' Z) := by + intro S' _ j D hCap + obtain ⟨_, ⟨e₁⟩⟩ := cappedCuff_homeo_model hS hcyl hC hCap + obtain ⟨eD₀⟩ := nonempty_disc_homeo + have huniv_disc : IsClosedDisc (univ : Set S') := + ⟨((Homeomorph.Set.univ S').trans (e₁.trans eD₀)).symm⟩ + exact ⟨univ, huniv_disc, subset_univ _⟩ + obtain ⟨c₀, _⟩ := isOArc_nonempty (cuff_isOArc hS hC) + have : Nonempty S := ⟨c₀⟩ + obtain ⟨S', topS', j, D, hS', hj, hD, hunion, hinter, hbdD⟩ := paste_disc S C hS hC + have hCap : IsCappedCuff C S' j D := ⟨hC, hS', hj.isEmbedding, hD, hbdD.1, hunion, hinter⟩ + exact ⟨hC, ⟨S', topS', j, D, hCap, h_all S' j D hCap⟩, h_all⟩ + +/-- If `F₁ ⊆ Y` is an `O`-arc surrounding a cuff `C₁`, some subset `F₂ ⊆ S` is not planar in +`Σ + Ĉ₁` (witnessing `S ≇ Σ(0, 0, 2)`), and `Y` is not planar in `Σ + Ĉ₁`, then `Y` is not +near-planar (`¬ IsNearPlanar Y`). -/ +theorem not_isNearPlanar_of_surroundsCuff_and_not_planarInCappedCuff + (hS : IsSurface S) [ConnectedSpace S] + {F₁ F₂ C₁ Y : Set S} (hF₁ : IsOArc F₁) + (hF₁_surr : SurroundsCuff F₁ C₁) (hF₂_ncap : ¬ IsPlanarInCappedCuff C₁ F₂) + (hF₁Y : F₁ ⊆ Y) (hY_ncap : ¬ IsPlanarInCappedCuff C₁ Y) : + ¬ IsNearPlanar Y := by + rintro (hY_pl | ⟨C, hC, hY_cap⟩) + · exact hF₁_surr.2.2 (IsPlanar.mono hY_pl hF₁Y) + · by_cases hCC₁ : C = C₁ + · exact hY_ncap (hCC₁ ▸ hY_cap) + · have hF₁_capC : IsPlanarInCappedCuff C F₁ := hY_cap.mono hF₁Y + have hcyl : Nonempty (S ≃ₜ SurfaceModel 0 0 2) := + surroundsCuff_and_planarInCappedCuff_imp_cylinder hS hF₁_surr.1 hC (Ne.symm hCC₁) + hF₁ hF₁_surr hF₁_capC + exact hF₂_ncap (isPlanarInCappedCuff_of_homeo_cylinder hS hcyl hF₁_surr.1 F₂) + +/-- Union of an `O`-arc `F₁` and a `[0, 1]`-arc `P` with distinct ends `u, v` and `P ∩ F₁ = {u, v}` +is an `X₃`-arc (`IsX3Arc (F₁ ∪ P)`). -/ +theorem isX3Arc_union_chord [T2Space S] {F₁ P : Set S} {u v : S} + (hF₁ : IsOArc F₁) (huv : u ≠ v) (hP : IsLineWithEnds P u v) + (hPF₁ : P ∩ F₁ = {u, v}) : + IsX3Arc (F₁ ∪ P) := by + have huF₁ : u ∈ F₁ := (hPF₁ ▸ mem_insert u {v} : u ∈ P ∩ F₁).2 + have hvF₁ : v ∈ F₁ := (hPF₁ ▸ mem_insert_of_mem u (mem_singleton v) : v ∈ P ∩ F₁).2 + obtain ⟨P₁, P₂, hP₁, hP₂, hP₁₂_union, hP₁₂_inter⟩ := hF₁.lines huF₁ hvF₁ huv + have hP₁F₁ : P₁ ⊆ F₁ := hP₁₂_union ▸ subset_union_left + have hP₂F₁ : P₂ ⊆ F₁ := hP₁₂_union ▸ subset_union_right + have hP₁P : P₁ ∩ P = {u, v} := by + refine Subset.antisymm ?_ (pair_subset ⟨hP₁.left_mem, hP.left_mem⟩ ⟨hP₁.right_mem, + hP.right_mem⟩) + intro z ⟨hzP₁, hzP⟩ + exact hPF₁ ▸ ⟨hzP, hP₁F₁ hzP₁⟩ + have hP₂P : P₂ ∩ P = {u, v} := by + refine Subset.antisymm ?_ (pair_subset ⟨hP₂.left_mem, hP.left_mem⟩ ⟨hP₂.right_mem, + hP.right_mem⟩) + intro z ⟨hzP₂, hzP⟩ + exact hPF₁ ▸ ⟨hzP, hP₂F₁ hzP₂⟩ + exact ⟨P₁, P₂, P, u, v, huv, hP₁, hP₂, hP, hP₁₂_inter, hP₁P, hP₂P, hP₁₂_union ▸ rfl⟩ + +/-! ## 4. Interval Decomposition and Single-Chord Extraction on `F₁ ∪ F₂` -/ + +private noncomputable def leftEnd8 (U : Set ℝ) (t : ℝ) : ℝ := + sSup {s : ℝ | s ≤ t ∧ s ∉ U} + +private noncomputable def rightEnd8 (U : Set ℝ) (t : ℝ) : ℝ := + sInf {s : ℝ | t ≤ s ∧ s ∉ U} + +private lemma leftEnd8_props {U : Set ℝ} (hU_open : IsOpen U) (hU_sub : U ⊆ Ioo 0 1) + {t : ℝ} (ht : t ∈ U) : + 0 ≤ leftEnd8 U t ∧ leftEnd8 U t ∉ U ∧ leftEnd8 U t < t ∧ Ioo (leftEnd8 U t) t ⊆ U := by + let A : Set ℝ := {s : ℝ | s ≤ t ∧ s ∉ U} + have h0_mem : (0 : ℝ) ∈ A := + ⟨(hU_sub ht).1.le, fun h0 => (hU_sub h0).1.ne rfl⟩ + have hA_ne : A.Nonempty := ⟨0, h0_mem⟩ + have hA_bdd : BddAbove A := ⟨t, fun _ hs => hs.1⟩ + have hA_closed : IsClosed A := isClosed_Iic.inter hU_open.isClosed_compl + have ha_mem : leftEnd8 U t ∈ A := hA_closed.csSup_mem hA_ne hA_bdd + have h0_le : 0 ≤ leftEnd8 U t := le_csSup hA_bdd h0_mem + have ha_lt_t : leftEnd8 U t < t := + lt_of_le_of_ne ha_mem.1 (fun heq => ha_mem.2 (heq.symm ▸ ht)) + refine ⟨h0_le, ha_mem.2, ha_lt_t, fun s hs => ?_⟩ + by_contra hsU + exact not_lt_of_ge (le_csSup hA_bdd ⟨hs.2.le, hsU⟩) hs.1 + +private lemma rightEnd8_props {U : Set ℝ} (hU_open : IsOpen U) (hU_sub : U ⊆ Ioo 0 1) + {t : ℝ} (ht : t ∈ U) : + rightEnd8 U t ≤ 1 ∧ rightEnd8 U t ∉ U ∧ t < rightEnd8 U t ∧ Ioo t (rightEnd8 U t) ⊆ U := by + let B : Set ℝ := {s : ℝ | t ≤ s ∧ s ∉ U} + have h1_mem : (1 : ℝ) ∈ B := + ⟨(hU_sub ht).2.le, fun h1 => (hU_sub h1).2.ne rfl⟩ + have hB_ne : B.Nonempty := ⟨1, h1_mem⟩ + have hB_bdd : BddBelow B := ⟨t, fun _ hs => hs.1⟩ + have hB_closed : IsClosed B := isClosed_Ici.inter hU_open.isClosed_compl + have hb_mem : rightEnd8 U t ∈ B := hB_closed.csInf_mem hB_ne hB_bdd + have hb_le_1 : rightEnd8 U t ≤ 1 := csInf_le hB_bdd h1_mem + have ht_lt_b : t < rightEnd8 U t := + lt_of_le_of_ne hb_mem.1 (fun heq => hb_mem.2 (heq ▸ ht)) + refine ⟨hb_le_1, hb_mem.2, ht_lt_b, fun s hs => ?_⟩ + by_contra hsU + exact not_lt_of_ge (csInf_le hB_bdd ⟨hs.1.le, hsU⟩) hs.2 + +private lemma Ioo_leftEnd8_rightEnd8_subset {U : Set ℝ} (hU_open : IsOpen U) (hU_sub : U ⊆ Ioo 0 1) + {t : ℝ} (ht : t ∈ U) : + Ioo (leftEnd8 U t) (rightEnd8 U t) ⊆ U := by + intro s hs + rcases lt_trichotomy s t with hlt | rfl | hgt + · exact (leftEnd8_props hU_open hU_sub ht).2.2.2 ⟨hs.1, hlt⟩ + · exact ht + · exact (rightEnd8_props hU_open hU_sub ht).2.2.2 ⟨hgt, hs.2⟩ + +private lemma interval8_eq_or_disjoint {U : Set ℝ} (hU_open : IsOpen U) (hU_sub : U ⊆ Ioo 0 1) + {t₁ t₂ : ℝ} (ht₁ : t₁ ∈ U) (ht₂ : t₂ ∈ U) : + (leftEnd8 U t₁ = leftEnd8 U t₂ ∧ rightEnd8 U t₁ = rightEnd8 U t₂) ∨ + (rightEnd8 U t₁ ≤ leftEnd8 U t₂ ∨ rightEnd8 U t₂ ≤ leftEnd8 U t₁) := by + obtain ⟨_, ha₁_not, ha₁_lt, _⟩ := leftEnd8_props hU_open hU_sub ht₁ + obtain ⟨_, hb₁_not, hb₁_gt, _⟩ := rightEnd8_props hU_open hU_sub ht₁ + obtain ⟨_, ha₂_not, ha₂_lt, _⟩ := leftEnd8_props hU_open hU_sub ht₂ + obtain ⟨_, hb₂_not, hb₂_gt, _⟩ := rightEnd8_props hU_open hU_sub ht₂ + have hsub₁ := Ioo_leftEnd8_rightEnd8_subset hU_open hU_sub ht₁ + have hsub₂ := Ioo_leftEnd8_rightEnd8_subset hU_open hU_sub ht₂ + by_cases hsep : rightEnd8 U t₁ ≤ leftEnd8 U t₂ ∨ rightEnd8 U t₂ ≤ leftEnd8 U t₁ + · exact Or.inr hsep + · left + push Not at hsep + have ha_eq : leftEnd8 U t₁ = leftEnd8 U t₂ := by + rcases lt_trichotomy (leftEnd8 U t₁) (leftEnd8 U t₂) with hlt | heq | hgt + · exfalso + exact ha₂_not (hsub₁ ⟨hlt, hsep.1⟩) + · exact heq + · exfalso + exact ha₁_not (hsub₂ ⟨hgt, hsep.2⟩) + have hb_eq : rightEnd8 U t₁ = rightEnd8 U t₂ := by + rcases lt_trichotomy (rightEnd8 U t₁) (rightEnd8 U t₂) with hlt | heq | hgt + · exfalso + exact hb₁_not (hsub₂ ⟨hsep.1, hlt⟩) + · exact heq + · exfalso + exact hb₂_not (hsub₁ ⟨hsep.2, hgt⟩) + exact ⟨ha_eq, hb_eq⟩ + +/-- Replacing a path `q : C(I, T)` on a subinterval `[a, b] ⊆ [0, 1]` (`0 ≤ a < b ≤ 1`) by a path +`β : C(I, T)` with `β 0 = q a` and `β 1 = q b`. -/ +private noncomputable def replaceOnIcc {T : Type u} [TopologicalSpace T] + (q : C(I, T)) (a b : ℝ) (hab : 0 ≤ a ∧ a < b ∧ b ≤ 1) + (β : C(I, T)) (hβ0 : β 0 = q ⟨a, hab.1, hab.2.1.le.trans hab.2.2⟩) + (hβ1 : β 1 = q ⟨b, hab.1.trans hab.2.1.le, hab.2.2⟩) : C(I, T) := by + let scale (t : I) : I := projIcc 0 1 zero_le_one (((t : ℝ) - a) / (b - a)) + have hscale_cont : Continuous scale := + continuous_projIcc.comp ((continuous_subtype_val.sub continuous_const).div_const _) + let f_mid : I → T := fun t => β (scale t) + have hf_mid_cont : Continuous f_mid := β.continuous.comp hscale_cont + let f_left : I → T := fun t => if (t : ℝ) ≤ a then q t else f_mid t + have hf_left_cont : Continuous f_left := by + refine Continuous.if_le q.continuous hf_mid_cont continuous_subtype_val continuous_const ?_ + intro t ht + have h0 : scale t = 0 := by + ext + change max (0 : ℝ) (min 1 (((t : ℝ) - a) / (b - a))) = 0 + rw [ht, sub_self, zero_div, min_eq_right zero_le_one, max_self] + change q t = β (scale t) + rw [h0, hβ0] + congr 1 + exact Subtype.ext ht + let f : I → T := fun t => if (t : ℝ) ≤ b then f_left t else q t + have hf_cont : Continuous f := by + refine Continuous.if_le hf_left_cont q.continuous continuous_subtype_val continuous_const ?_ + intro t ht + have hnot_le : ¬ ((t : ℝ) ≤ a) := by linarith [hab.2.1] + have h1 : scale t = 1 := by + ext + change max (0 : ℝ) (min 1 (((t : ℝ) - a) / (b - a))) = 1 + have hdiv : ((t : ℝ) - a) / (b - a) = 1 := by + rw [ht] + exact div_self (sub_ne_zero.mpr hab.2.1.ne') + rw [hdiv, min_self, max_eq_right zero_le_one] + change f_left t = q t + dsimp [f_left] + simp only [hnot_le, ↓reduceIte] + change β (scale t) = q t + rw [h1, hβ1] + congr 1 + exact Subtype.ext ht.symm + exact ⟨f, hf_cont⟩ + +private lemma replaceOnIcc_apply_not_Ioo {T : Type u} [TopologicalSpace T] + (q : C(I, T)) (a b : ℝ) (hab : 0 ≤ a ∧ a < b ∧ b ≤ 1) + (β : C(I, T)) (hβ0 : β 0 = q ⟨a, hab.1, hab.2.1.le.trans hab.2.2⟩) + (hβ1 : β 1 = q ⟨b, hab.1.trans hab.2.1.le, hab.2.2⟩) + (t : I) (ht : (t : ℝ) ∉ Ioo a b) : + replaceOnIcc q a b hab β hβ0 hβ1 t = q t := by + dsimp [replaceOnIcc] + by_cases htb : (t : ℝ) ≤ b + · simp only [htb, ↓reduceIte] + rcases eq_or_lt_of_le htb with htb_eq | htb_lt + · have hnot_le : ¬ ((t : ℝ) ≤ a) := by linarith [hab.2.1] + simp only [hnot_le, ↓reduceIte] + have hdiv : ((t : ℝ) - a) / (b - a) = 1 := by + rw [htb_eq] + exact div_self (sub_ne_zero.mpr hab.2.1.ne') + have h1 : projIcc 0 1 zero_le_one (((t : ℝ) - a) / (b - a)) = 1 := by + ext + change max (0 : ℝ) (min 1 (((t : ℝ) - a) / (b - a))) = 1 + rw [hdiv, min_self, max_eq_right zero_le_one] + rw [h1, hβ1] + congr 1 + exact Subtype.ext htb_eq.symm + · have hta : (t : ℝ) ≤ a := by + by_contra hgt + exact ht ⟨not_le.mp hgt, htb_lt⟩ + simp only [hta, ↓reduceIte] + · simp only [htb, ↓reduceIte] + +private lemma replaceOnIcc_apply_mem_Icc {T : Type u} [TopologicalSpace T] + (q : C(I, T)) (a b : ℝ) (hab : 0 ≤ a ∧ a < b ∧ b ≤ 1) + (β : C(I, T)) (hβ0 : β 0 = q ⟨a, hab.1, hab.2.1.le.trans hab.2.2⟩) + (hβ1 : β 1 = q ⟨b, hab.1.trans hab.2.1.le, hab.2.2⟩) + (t : I) (ht : (t : ℝ) ∈ Icc a b) : + replaceOnIcc q a b hab β hβ0 hβ1 t ∈ range β := by + dsimp [replaceOnIcc] + simp only [ht.2, ↓reduceIte] + by_cases hta : (t : ℝ) ≤ a + · simp only [hta, ↓reduceIte] + have hta_eq : (t : ℝ) = a := le_antisymm hta ht.1 + have ht_eq : t = ⟨a, hab.1, hab.2.1.le.trans hab.2.2⟩ := Subtype.ext hta_eq + rw [ht_eq, ← hβ0] + exact mem_range_self 0 + · simp only [hta, ↓reduceIte] + exact mem_range_self _ + +private lemma pathsHomotopicRelIn_trans {T : Type u} [TopologicalSpace T] + {W : Set T} {γ₀ γ₁ γ₂ : C(I, T)} + (h₁ : PathsHomotopicRelIn W γ₀ γ₁) (h₂ : PathsHomotopicRelIn W γ₁ γ₂) : + PathsHomotopicRelIn W γ₀ γ₂ := by + obtain ⟨H₁, hH₁W, hH₁0, hH₁1, hH₁s0, hH₁s1⟩ := h₁ + obtain ⟨H₂, hH₂W, hH₂0, hH₂1, hH₂s0, hH₂s1⟩ := h₂ + let t₁ : I × I → I × I := + fun p => (p.1, projIcc 0 1 zero_le_one (2 * (p.2 : ℝ))) + let t₂ : I × I → I × I := + fun p => (p.1, projIcc 0 1 zero_le_one (2 * (p.2 : ℝ) - 1)) + have ht₁_cont : Continuous t₁ := + continuous_fst.prodMk (continuous_projIcc.comp (continuous_const.mul + (continuous_subtype_val.comp continuous_snd))) + have ht₂_cont : Continuous t₂ := + continuous_fst.prodMk (continuous_projIcc.comp + ((continuous_const.mul (continuous_subtype_val.comp continuous_snd)).sub continuous_const)) + let f₁ : I × I → T := H₁ ∘ t₁ + let f₂ : I × I → T := H₂ ∘ t₂ + have hf₁_cont : Continuous f₁ := H₁.continuous.comp ht₁_cont + have hf₂_cont : Continuous f₂ := H₂.continuous.comp ht₂_cont + let H_fun : I × I → T := + fun p => if (p.2 : ℝ) ≤ 1 / 2 then f₁ p else f₂ p + have hH_cont : Continuous H_fun := by + refine Continuous.if_le hf₁_cont hf₂_cont + (continuous_subtype_val.comp continuous_snd) continuous_const ?_ + intro p hp + have hp1 : projIcc 0 1 zero_le_one (2 * (p.2 : ℝ)) = 1 := by + rw [hp]; ext; simp + have hp0 : projIcc 0 1 zero_le_one (2 * (p.2 : ℝ) - 1) = 0 := by + rw [hp]; ext; simp + change H₁ (p.1, projIcc 0 1 zero_le_one (2 * (p.2 : ℝ))) = + H₂ (p.1, projIcc 0 1 zero_le_one (2 * (p.2 : ℝ) - 1)) + rw [hp1, hp0, hH₁1 p.1, hH₂0 p.1] + refine ⟨⟨H_fun, hH_cont⟩, fun p => ?_, fun t => ?_, fun t => ?_, fun s => ?_, fun s => ?_⟩ + · dsimp [H_fun] + split_ifs + · exact hH₁W (t₁ p) + · exact hH₂W (t₂ p) + · have hle : ((0 : I) : ℝ) ≤ 1 / 2 := by norm_num + have hp0 : projIcc 0 1 zero_le_one (2 * ((0 : I) : ℝ)) = 0 := by + ext; change max (0 : ℝ) (min 1 (2 * 0)) = 0; norm_num + change (if ((0 : I) : ℝ) ≤ 1 / 2 then f₁ (t, 0) else f₂ (t, 0)) = γ₀ t + simp only [hle, ↓reduceIte] + change H₁ (t, projIcc 0 1 zero_le_one (2 * ((0 : I) : ℝ))) = γ₀ t + rw [hp0, hH₁0 t] + · have hnot : ¬ (((1 : I) : ℝ) ≤ 1 / 2) := by norm_num + have hp1 : projIcc 0 1 zero_le_one (2 * ((1 : I) : ℝ) - 1) = 1 := by + ext; change max (0 : ℝ) (min 1 (2 * 1 - 1)) = 1; norm_num + change (if ((1 : I) : ℝ) ≤ 1 / 2 then f₁ (t, 1) else f₂ (t, 1)) = γ₂ t + simp only [hnot, ↓reduceIte] + change H₂ (t, projIcc 0 1 zero_le_one (2 * ((1 : I) : ℝ) - 1)) = γ₂ t + rw [hp1, hH₂1 t] + · dsimp [H_fun] + split_ifs + · exact hH₁s0 _ + · exact (hH₂s0 _).trans (hH₁1 0).symm |>.trans (hH₁s0 1) + · dsimp [H_fun] + split_ifs + · exact hH₁s1 _ + · exact (hH₂s1 _).trans (hH₁1 1).symm |>.trans (hH₁s1 1) + +private lemma pathsHomotopicRelIn_replaceOnIcc {T : Type u} [TopologicalSpace T] + {E : Set T} (hE : IsClosedDisc E) + (q : C(I, T)) (a b : ℝ) (hab : 0 ≤ a ∧ a < b ∧ b ≤ 1) + (β : C(I, T)) (hβ0 : β 0 = q ⟨a, hab.1, hab.2.1.le.trans hab.2.2⟩) + (hβ1 : β 1 = q ⟨b, hab.1.trans hab.2.1.le, hab.2.2⟩) + (hq_E : ∀ t : I, (t : ℝ) ∈ Icc a b → q t ∈ E) + (hβ_E : range β ⊆ E) : + PathsHomotopicRelIn univ q (replaceOnIcc q a b hab β hβ0 hβ1) := by + let q' := replaceOnIcc q a b hab β hβ0 hβ1 + have hq'_E : ∀ t : I, (t : ℝ) ∈ Icc a b → q' t ∈ E := + fun t ht => hβ_E (replaceOnIcc_apply_mem_Icc q a b hab β hβ0 hβ1 t ht) + obtain ⟨hE_map, gE_map, cE⟩ := hE.exists_isChart + let K_mid : Set (I × I) := {p : I × I | (p.1 : ℝ) ∈ Icc a b} + let K_out : Set (I × I) := {p : I × I | (p.1 : ℝ) ≤ a ∨ b ≤ (p.1 : ℝ)} + have hK_mid_closed : IsClosed K_mid := + isClosed_Icc.preimage (continuous_subtype_val.comp continuous_fst) + have hK_out_closed : IsClosed K_out := + (isClosed_Iic.union isClosed_Ici).preimage (continuous_subtype_val.comp continuous_fst) + have hK_union : K_mid ∪ K_out = univ := by + ext p + simp only [K_mid, K_out, mem_union, mem_Icc, mem_univ, iff_true] + change (a ≤ (p.1 : ℝ) ∧ (p.1 : ℝ) ≤ b) ∨ ((p.1 : ℝ) ≤ a ∨ b ≤ (p.1 : ℝ)) + rcases le_total (p.1 : ℝ) a with h1 | h1 + · exact Or.inr (Or.inl h1) + · rcases le_total (p.1 : ℝ) b with h2 | h2 + · exact Or.inl ⟨h1, h2⟩ + · exact Or.inr (Or.inr h2) + let H_fun : I × I → T := by + classical + exact fun p => + if (p.1 : ℝ) ∈ Icc a b then + gE_map ((1 - (p.2 : ℝ)) • hE_map (q p.1) + (p.2 : ℝ) • hE_map (q' p.1)) + else + q p.1 + have hH_out : ∀ p ∈ K_out, H_fun p = q p.1 := by + intro p hp + dsimp [H_fun] + split_ifs with h_in + · have h_eq : q' p.1 = q p.1 := + replaceOnIcc_apply_not_Ioo q a b hab β hβ0 hβ1 p.1 (fun h_oo => by + rcases hp with hle | hge + · linarith [h_oo.1] + · linarith [h_oo.2]) + change gE_map ((1 - (p.2 : ℝ)) • hE_map (q p.1) + (p.2 : ℝ) • hE_map (q' p.1)) = q p.1 + rw [h_eq, ← add_smul, sub_add_cancel, one_smul, cE.gh (hq_E p.1 h_in)] + · rfl + have hcont_mid : ContinuousOn H_fun K_mid := by + have hcont_g : ContinuousOn + (fun p : I × I => + gE_map ((1 - (p.2 : ℝ)) • hE_map (q p.1) + (p.2 : ℝ) • hE_map (q' p.1))) K_mid := by + have hhq : ContinuousOn (fun p : I × I => hE_map (q p.1)) K_mid := + cE.hc.comp (q.continuous.comp continuous_fst).continuousOn (fun p hp => hq_E p.1 hp) + have hhq' : ContinuousOn (fun p : I × I => hE_map (q' p.1)) K_mid := + cE.hc.comp (q'.continuous.comp continuous_fst).continuousOn (fun p hp => hq'_E p.1 hp) + have hs : ContinuousOn (fun p : I × I => (p.2 : ℝ)) K_mid := + (continuous_subtype_val.comp continuous_snd).continuousOn + have hL : ContinuousOn + (fun p : I × I => (1 - (p.2 : ℝ)) • hE_map (q p.1) + (p.2 : ℝ) • hE_map (q' p.1)) K_mid := + ((continuousOn_const.sub hs).smul hhq).add (hs.smul hhq') + refine cE.gc.comp hL fun p hp => ?_ + exact convex_closedBall (0 : ℂ) 1 + (cE.hm (hq_E p.1 hp)) (cE.hm (hq'_E p.1 hp)) + (sub_nonneg.mpr p.2.2.2) p.2.2.1 (sub_add_cancel 1 (p.2 : ℝ)) + refine hcont_g.congr fun p hp => ?_ + have hp_in : (p.1 : ℝ) ∈ Icc a b := hp + dsimp [H_fun] + simp only [hp_in, ↓reduceIte] + have hcont_out : ContinuousOn H_fun K_out := + (q.continuous.comp continuous_fst).continuousOn.congr hH_out + have hH_cont : Continuous H_fun := by + rw [← continuousOn_univ, ← hK_union] + exact hcont_mid.union_of_isClosed hcont_out hK_mid_closed hK_out_closed + refine ⟨⟨H_fun, hH_cont⟩, fun _ => mem_univ _, fun t => ?_, fun t => ?_, fun s => ?_, fun s => ?_⟩ + · dsimp [H_fun] + split_ifs with ht + · change gE_map ((1 - (0 : ℝ)) • hE_map (q t) + (0 : ℝ) • hE_map (q' t)) = q t + simp [cE.gh (hq_E t ht)] + · rfl + · dsimp [H_fun] + split_ifs with ht + · change gE_map ((1 - (1 : ℝ)) • hE_map (q t) + (1 : ℝ) • hE_map (q' t)) = q' t + simp [cE.gh (hq'_E t ht)] + · exact (replaceOnIcc_apply_not_Ioo q a b hab β hβ0 hβ1 t + (fun h_oo => ht ⟨h_oo.1.le, h_oo.2.le⟩)).symm + · exact hH_out (0, s) (Or.inl hab.1) + · exact hH_out (1, s) (Or.inr hab.2.2) + +private theorem closed_parameter_interval_covers_circle + {S : Type u} + [TopologicalSpace S] + {F₂ : Set S} + (φ₂ : Circle ≃ₜ ↑F₂) + (z₀ : Circle) + : + let γ_R : ℝ → S := fun t => (φ₂ (z₀ * Circle.exp (2 * Real.pi * t))).1 + γ_R '' Icc 0 1 = F₂ := by + intro γ_R + ext x + constructor + · rintro ⟨t, _, rfl⟩ + exact (φ₂ (z₀ * Circle.exp (2 * Real.pi * t))).2 + · intro hxF₂ + have h2pi : (0 : ℝ) < 2 * Real.pi := by positivity + let w : Circle := z₀⁻¹ * φ₂.symm ⟨x, hxF₂⟩ + let r : ℝ := toIcoMod h2pi 0 (Complex.arg w) / (2 * Real.pi) + have hr_mem : r ∈ Icc (0 : ℝ) 1 := by + have h_ico := toIcoMod_mem_Ico h2pi 0 (Complex.arg w) + refine ⟨div_nonneg h_ico.1 h2pi.le, (div_le_one h2pi).mpr (by linarith [h_ico.2])⟩ + have hexp_r : Circle.exp (2 * Real.pi * r) = w := by + have h1 : 2 * Real.pi * r = toIcoMod h2pi 0 (Complex.arg w) := by + dsimp [r]; field_simp + rw [h1] + have h2 : toIcoMod h2pi 0 (Complex.arg w) = + Complex.arg w - toIcoDiv h2pi 0 (Complex.arg w) • (2 * Real.pi) := rfl + have h3 : Circle.exp (toIcoMod h2pi 0 (Complex.arg w)) = Circle.exp (Complex.arg w) := by + rw [h2, zsmul_eq_mul] + exact Circle.exp_eq_exp.mpr ⟨-toIcoDiv h2pi 0 (Complex.arg w), by push_cast; ring⟩ + exact h3.trans (Circle.exp_arg w) + refine ⟨r, hr_mem, ?_⟩ + change (φ₂ (z₀ * Circle.exp (2 * Real.pi * r))).1 = x + rw [hexp_r] + dsimp [w] + rw [mul_inv_cancel_left, φ₂.apply_symm_apply] + +private theorem circle_parameter_repeats_only_endpoints + {S : Type u} + [TopologicalSpace S] + {F₂ : Set S} + (φ₂ : Circle ≃ₜ ↑F₂) + (z₀ : Circle) + : + let E_param : ℝ → Circle := fun t => z₀ * Circle.exp (2 * Real.pi * t) + let γ_R : ℝ → S := fun t => (φ₂ (E_param t)).1 + ∀ (s t : ℝ), s ∈ Icc 0 1 → t ∈ Icc 0 1 → + γ_R s = γ_R t → s = t ∨ s = 0 ∧ t = 1 ∨ s = 1 ∧ t = 0 := by + intro E_param γ_R s t hs ht heq + have hE_eq : E_param s = E_param t := φ₂.injective (Subtype.ext heq) + have hexp_eq : Circle.exp (2 * Real.pi * s) = Circle.exp (2 * Real.pi * t) := + mul_left_cancel hE_eq + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp hexp_eq + have hpi : (0 : ℝ) < 2 * Real.pi := by positivity + have hdiff : s - t = (m : ℝ) := by + have : (2 * Real.pi) * (s - t) = (2 * Real.pi) * (m : ℝ) := by linarith + exact mul_left_cancel₀ hpi.ne' this + rcases lt_trichotomy m 0 with hlt | rfl | hgt + · rcases eq_or_lt_of_le (show m ≤ -1 by omega) with rfl | hlt' + · right; left + have : s - t = -1 := by simpa using hdiff + exact ⟨by linarith [hs.1, ht.2], by linarith [hs.1, ht.2]⟩ + · exfalso + have : (m : ℝ) ≤ -2 := by exact_mod_cast (show m ≤ -2 by omega) + linarith [hs.1, ht.2] + · left + have : s - t = 0 := by simpa using hdiff + linarith + · rcases eq_or_lt_of_le (show 1 ≤ m by omega) with rfl | hgt' + · right; right + have : s - t = 1 := by simpa using hdiff + exact ⟨by linarith [hs.2, ht.1], by linarith [hs.2, ht.1]⟩ + · exfalso + have : (2 : ℝ) ≤ (m : ℝ) := by exact_mod_cast (show 2 ≤ m by omega) + linarith [hs.2, ht.1] + +private theorem component_of_arc_complement_is_chord + {S : Type u} + [TopologicalSpace S] + {F₁ : Set S} + {F₂ : Set S} + [T2Space S] + (γ_R : ℝ → S) + (hγ_R_cont : Continuous γ_R) + (hγ_R_mem : ∀ (t : ℝ), γ_R t ∈ F₂) + (hγ_R_inj_diff : ∀ (s t : ℝ), s ∈ Icc 0 1 → t ∈ Icc 0 1 → γ_R s = γ_R t → s = t ∨ s = 0 ∧ t = + 1 ∨ s = 1 ∧ t = 0) + (U : Set ℝ) (hU_eq : U = Ioo 0 1 ∩ γ_R ⁻¹' F₁ᶜ) + (hU_open : IsOpen U) + (hU_sub : U ⊆ Ioo 0 1) + (hnot_U_mem_F₁ : ∀ t ∈ Icc 0 1, t ∉ U → γ_R t ∈ F₁) + (h_full : ∀ t ∈ U, leftEnd8 U t = 0 → rightEnd8 U t ≠ 1) : + ∀ t ∈ U, let a := leftEnd8 U t; let b := rightEnd8 U t; 0 ≤ a ∧ a < b ∧ b ≤ 1 ∧ γ_R a ≠ γ_R b + ∧ IsLineWithEnds (γ_R '' Icc a b) (γ_R a) (γ_R b) ∧ γ_R '' Icc a b ∩ F₁ = {γ_R a, γ_R b} ∧ + γ_R '' Icc a b ⊆ F₂ := by + intro t htU + obtain ⟨ha0, ha_notU, ha_lt_t, _⟩ := leftEnd8_props hU_open hU_sub htU + obtain ⟨hb1, hb_notU, ht_lt_b, _⟩ := rightEnd8_props hU_open hU_sub htU + have hab : leftEnd8 U t < rightEnd8 U t := ha_lt_t.trans ht_lt_b + have ha_Icc : leftEnd8 U t ∈ Icc (0 : ℝ) 1 := ⟨ha0, hab.le.trans hb1⟩ + have hb_Icc : rightEnd8 U t ∈ Icc (0 : ℝ) 1 := ⟨ha0.trans hab.le, hb1⟩ + have h_inj : InjOn γ_R (Icc (leftEnd8 U t) (rightEnd8 U t)) := by + intro s₁ hs₁ s₂ hs₂ heq + have hs₁_01 : s₁ ∈ Icc (0 : ℝ) 1 := ⟨ha0.trans hs₁.1, hs₁.2.trans hb1⟩ + have hs₂_01 : s₂ ∈ Icc (0 : ℝ) 1 := ⟨ha0.trans hs₂.1, hs₂.2.trans hb1⟩ + rcases hγ_R_inj_diff s₁ s₂ hs₁_01 hs₂_01 heq with h | ⟨hs0, ht1⟩ | ⟨hs1, ht0⟩ + · exact h + · exfalso + have ha_eq : leftEnd8 U t = 0 := le_antisymm (hs0 ▸ hs₁.1) ha0 + have hb_eq : rightEnd8 U t = 1 := le_antisymm hb1 (ht1 ▸ hs₂.2) + exact h_full t htU ha_eq hb_eq + · exfalso + have ha_eq : leftEnd8 U t = 0 := le_antisymm (ht0 ▸ hs₂.1) ha0 + have hb_eq : rightEnd8 U t = 1 := le_antisymm hb1 (hs1 ▸ hs₁.2) + exact h_full t htU ha_eq hb_eq + have hne_ends : γ_R (leftEnd8 U t) ≠ γ_R (rightEnd8 U t) := + fun heq => hab.ne (h_inj (left_mem_Icc.mpr hab.le) (right_mem_Icc.mpr hab.le) heq) + have hline : IsLineWithEnds (γ_R '' Icc (leftEnd8 U t) (rightEnd8 U t)) + (γ_R (leftEnd8 U t)) (γ_R (rightEnd8 U t)) := by + let a_I : I := ⟨leftEnd8 U t, ha_Icc⟩ + let b_I : I := ⟨rightEnd8 U t, hb_Icc⟩ + have hab_I : a_I < b_I := hab + let γ_I : I → S := fun s => γ_R s.1 + have hγ_I_cont : Continuous γ_I := hγ_R_cont.comp continuous_subtype_val + have hγ_I_inj : InjOn γ_I (Icc a_I b_I) := + fun s₁ hs₁ s₂ hs₂ heq => Subtype.ext (h_inj hs₁ hs₂ heq) + have himg_eq : γ_I '' Icc a_I b_I = γ_R '' Icc (leftEnd8 U t) (rightEnd8 U t) := by + ext x + constructor + · rintro ⟨s, hs, rfl⟩ + exact ⟨s.1, hs, rfl⟩ + · rintro ⟨s, hs, rfl⟩ + exact ⟨⟨s, ha0.trans hs.1, hs.2.trans hb1⟩, hs, rfl⟩ + rw [← himg_eq] + exact isLineWithEnds_image_Icc_of_injOn hγ_I_cont hab_I hγ_I_inj + have hinter_F₁ : (γ_R '' Icc (leftEnd8 U t) (rightEnd8 U t)) ∩ F₁ = + {γ_R (leftEnd8 U t), γ_R (rightEnd8 U t)} := by + ext x + simp only [mem_inter_iff, mem_image, mem_Icc, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨⟨s, ⟨hsa, hsb⟩, rfl⟩, hγs_F₁⟩ + rcases eq_or_lt_of_le hsa with rfl | hsa_lt + · exact Or.inl rfl + · rcases eq_or_lt_of_le hsb with rfl | hsb_lt + · exact Or.inr rfl + · exfalso + have hsU : s ∈ U := + Ioo_leftEnd8_rightEnd8_subset hU_open hU_sub htU ⟨hsa_lt, hsb_lt⟩ + exact (hU_eq ▸ hsU).2 hγs_F₁ + · rintro (rfl | rfl) + · exact ⟨⟨leftEnd8 U t, ⟨le_rfl, hab.le⟩, rfl⟩, + hnot_U_mem_F₁ _ ha_Icc ha_notU⟩ + · exact ⟨⟨rightEnd8 U t, ⟨hab.le, le_rfl⟩, rfl⟩, + hnot_U_mem_F₁ _ hb_Icc hb_notU⟩ + refine ⟨ha0, hab, hb1, hne_ends, hline, hinter_F₁, ?_⟩ + rintro _ ⟨s, _, rfl⟩ + exact hγ_R_mem s + +private theorem replace_finitely_many_chords_by_boundary_paths + {S : Type u} + [TopologicalSpace S] + {F₁ : Set S} + {F₂ : Set S} + {C₁ : Set S} + (γ_R : ℝ → S) + (U : Set ℝ) + (hU_open : IsOpen U) + (hU_sub : U ⊆ Ioo 0 1) + (hnot_U_mem_F₁ : ∀ t ∈ Icc 0 1, t ∉ U → γ_R t ∈ F₁) + (hchord_of_mem_U : ∀ t ∈ U, let a := leftEnd8 U t; let b := rightEnd8 U t; 0 ≤ a ∧ a < b ∧ b ≤ + 1 ∧ γ_R a ≠ γ_R b ∧ IsLineWithEnds (γ_R '' Icc a b) (γ_R a) (γ_R b) ∧ γ_R '' Icc a b ∩ F₁ = + {γ_R a, γ_R b} ∧ γ_R '' Icc a b ⊆ F₂) + (hall_planar : ∀ (P : Set S) (u v : S), P ⊆ F₂ → u ≠ v → IsLineWithEnds P u v → P ∩ F₁ = {u, + v} → IsPlanarInCappedCuff C₁ (F₁ ∪ P)) + (S' : Type u) + [TopologicalSpace S'] + (j : S → S') + (D : Set S') + (hCap : IsCappedCuff C₁ S' j D) + [T2Space S'] + (hjF₁_oarc : IsOArc (j '' F₁)) + (W : Set S') + (hjF₁_W : j '' F₁ ⊆ W) + (q₀ : C(I, S')) (hq₀ : ∀ s : I, q₀ s = j (γ_R s.1)) : + ∀ (G : Finset ℝ), (∀ t ∈ G, t ∈ U) → ∃ q, PathsHomotopicRelIn univ q₀ q ∧ (∀ (s : ↑I), (∀ t ∈ + G, ↑s ∉ Ioo (leftEnd8 U t) (rightEnd8 U t)) → q s = q₀ s) ∧ ∀ (s : ↑I), (∃ t ∈ G, ↑s ∈ Ioo + (leftEnd8 U t) (rightEnd8 U t)) → q s ∈ W := by + intro G + induction G using Finset.induction_on with + | empty => + intro _ + exact ⟨q₀, PathsHomotopicRelIn.refl (subset_univ _), + fun _ _ => rfl, fun _ ⟨_, ht, _⟩ => (Finset.notMem_empty _ ht).elim⟩ + | @insert t₀ G ht₀_notG ih => + intro hG_U + have ht₀U : t₀ ∈ U := hG_U t₀ (Finset.mem_insert_self t₀ G) + obtain ⟨q₁, hhom₁, hq₁_out, hq₁_in⟩ := + ih (fun t ht => hG_U t (Finset.mem_insert_of_mem ht)) + let a := leftEnd8 U t₀ + let b := rightEnd8 U t₀ + by_cases h_already : ∃ t ∈ G, leftEnd8 U t = a ∧ rightEnd8 U t = b + · obtain ⟨t', ht'G, ha_eq, hb_eq⟩ := h_already + refine ⟨q₁, hhom₁, fun s hs => hq₁_out s (fun t ht => hs t (Finset.mem_insert_of_mem ht)), + fun s ⟨t, ht_ins, hs_oo⟩ => ?_⟩ + rcases Finset.mem_insert.mp ht_ins with rfl | htG + · exact hq₁_in s ⟨t', ht'G, by rwa [ha_eq, hb_eq]⟩ + · exact hq₁_in s ⟨t, htG, hs_oo⟩ + · push Not at h_already + have hdisj_G : ∀ t ∈ G, rightEnd8 U t ≤ a ∨ b ≤ leftEnd8 U t := by + intro t htG + rcases interval8_eq_or_disjoint hU_open hU_sub (hG_U t (Finset.mem_insert_of_mem htG)) + ht₀U + with ⟨ha_eq, hb_eq⟩ | hsep + · exact (h_already t htG ha_eq hb_eq).elim + · exact hsep + obtain ⟨ha0, hab, hb1, hne_ends, hline, hinter_F₁, hP_sub_F₂⟩ := + hchord_of_mem_U t₀ ht₀U + let P := γ_R '' Icc a b + have hcap_P : IsPlanarInCappedCuff C₁ (F₁ ∪ P) := + hall_planar P (γ_R a) (γ_R b) hP_sub_F₂ hne_ends hline hinter_F₁ + obtain ⟨E_disc, hE_disc, hjF₁P_sub_E⟩ := hcap_P.2.2 S' j D hCap + have ha_F₁ : γ_R a ∈ F₁ := + hnot_U_mem_F₁ a ⟨ha0, hab.le.trans hb1⟩ (leftEnd8_props hU_open hU_sub ht₀U).2.1 + have hb_F₁ : γ_R b ∈ F₁ := + hnot_U_mem_F₁ b ⟨ha0.trans hab.le, hb1⟩ (rightEnd8_props hU_open hU_sub ht₀U).2.1 + obtain ⟨β, hβ_range, hβ0_eq, hβ1_eq⟩ := + exists_path_of_isArcConnected (IsOArc.isArcConnected hjF₁_oarc) + (mem_image_of_mem j ha_F₁) (mem_image_of_mem j hb_F₁) + have hq₁_eq_on_ab : ∀ s : I, (s : ℝ) ∈ Icc a b → q₁ s = q₀ s := by + intro s hs + refine hq₁_out s fun t htG hs_oo => ?_ + rcases hdisj_G t htG with hle | hge + · linarith [hs.1, hs_oo.2] + · linarith [hs.2, hs_oo.1] + let a_I : I := ⟨a, ha0, hab.le.trans hb1⟩ + let b_I : I := ⟨b, ha0.trans hab.le, hb1⟩ + have hβ0 : β 0 = q₁ a_I := + hβ0_eq.trans ((hq₁_eq_on_ab a_I (left_mem_Icc.mpr hab.le)).trans (hq₀ a_I)).symm + have hβ1 : β 1 = q₁ b_I := + hβ1_eq.trans ((hq₁_eq_on_ab b_I (right_mem_Icc.mpr hab.le)).trans (hq₀ b_I)).symm + have hq₁_E : ∀ s : I, (s : ℝ) ∈ Icc a b → q₁ s ∈ E_disc := by + intro s hs + rw [hq₁_eq_on_ab s hs, hq₀] + exact hjF₁P_sub_E (mem_image_of_mem j (Or.inr ⟨s.1, hs, rfl⟩)) + have hβ_E : range β ⊆ E_disc := + hβ_range.trans ((image_mono subset_union_left).trans hjF₁P_sub_E) + let q₂ := replaceOnIcc q₁ a b ⟨ha0, hab, hb1⟩ β hβ0 hβ1 + have hhom₂ : PathsHomotopicRelIn univ q₁ q₂ := + pathsHomotopicRelIn_replaceOnIcc hE_disc q₁ a b ⟨ha0, hab, hb1⟩ β hβ0 hβ1 hq₁_E hβ_E + refine ⟨q₂, pathsHomotopicRelIn_trans hhom₁ hhom₂, ?_, ?_⟩ + · intro s hs + have hs_not_ab : (s : ℝ) ∉ Ioo a b := hs t₀ (Finset.mem_insert_self t₀ G) + rw [replaceOnIcc_apply_not_Ioo q₁ a b ⟨ha0, hab, hb1⟩ β hβ0 hβ1 s hs_not_ab] + exact hq₁_out s (fun t htG => hs t (Finset.mem_insert_of_mem htG)) + · intro s ⟨t, ht_ins, hs_oo⟩ + rcases Finset.mem_insert.mp ht_ins with rfl | htG + · exact hjF₁_W (hβ_range (replaceOnIcc_apply_mem_Icc q₁ a b ⟨ha0, hab, hb1⟩ + β hβ0 hβ1 s ⟨hs_oo.1.le, hs_oo.2.le⟩)) + · have hs_not_ab : (s : ℝ) ∉ Ioo a b := by + intro hs_ab + rcases hdisj_G t htG with hle | hge + · linarith [hs_oo.2, hs_ab.1] + · linarith [hs_oo.1, hs_ab.2] + rw [replaceOnIcc_apply_not_Ioo q₁ a b ⟨ha0, hab, hb1⟩ β hβ0 hβ1 s hs_not_ab] + exact hq₁_in s ⟨t, htG, hs_oo⟩ + +private theorem range_of_rotated_circle_embedding + {S : Type u} + [TopologicalSpace S] + {F₂ : Set S} + (φ₂ : Circle ≃ₜ ↑F₂) + (z₀ : Circle) + (S' : Type u) + (j : S → S') : + range (fun w => j ↑(φ₂ (z₀ * w))) = j '' F₂ := by + let f_emb := fun w => j ↑(φ₂ (z₀ * w)) + ext y + constructor + · rintro ⟨w, rfl⟩ + exact mem_image_of_mem j (φ₂ (z₀ * w)).2 + · rintro ⟨x, hxF₂, rfl⟩ + refine ⟨z₀⁻¹ * φ₂.symm ⟨x, hxF₂⟩, ?_⟩ + dsimp [f_emb] + rw [mul_inv_cancel_left, φ₂.apply_symm_apply] + +/-- If two `O`-arcs `F₁, F₂` in a connected surface `S` satisfy `SurroundsCuff F₁ C₁`, +`¬ IsPlanarInCappedCuff C₁ F₂`, and `(F₁ ∩ F₂).Nonempty`, then either `F₁ ∩ F₂ = {u}` is a +singleton, or there is a `[0, 1]`-arc `P ⊆ F₂` with distinct ends `u, v ∈ F₁` and `P ∩ F₁ = {u, v}` +such that `¬ IsPlanarInCappedCuff C₁ (F₁ ∪ P)`. -/ +theorem exists_chord_not_planarInCappedCuff_of_inter_nonempty + (hS : IsSurface S) + {F₁ F₂ C₁ : Set S} (hF₁ : IsOArc F₁) (hF₂ : IsOArc F₂) + (hF₁_surr : SurroundsCuff F₁ C₁) (hF₂_ncap : ¬ IsPlanarInCappedCuff C₁ F₂) + (hinter_ne : (F₁ ∩ F₂).Nonempty) : + (∃ u : S, F₁ ∩ F₂ = {u}) ∨ + (∃ P : Set S, ∃ u v : S, + P ⊆ F₂ ∧ u ≠ v ∧ IsLineWithEnds P u v ∧ P ∩ F₁ = {u, v} ∧ + ¬ IsPlanarInCappedCuff C₁ (F₁ ∪ P)) := by + classical + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + obtain ⟨u₀, hu₀F₁, hu₀F₂⟩ := hinter_ne + obtain ⟨φ₂⟩ := id hF₂ + let z₀ : Circle := φ₂.symm ⟨u₀, hu₀F₂⟩ + have hφ₂_z₀ : (φ₂ z₀).1 = u₀ := by simp [z₀] + let E_param : ℝ → Circle := fun t => z₀ * Circle.exp (2 * Real.pi * t) + have hE_cont : Continuous E_param := + continuous_const.mul (Circle.exp.continuous.comp (continuous_const.mul continuous_id)) + let γ_R : ℝ → S := fun t => (φ₂ (E_param t)).1 + have hγ_R_cont : Continuous γ_R := + continuous_subtype_val.comp (φ₂.continuous.comp hE_cont) + have hγ_R_0 : γ_R 0 = u₀ := by + change (φ₂ (z₀ * Circle.exp (2 * Real.pi * 0))).1 = u₀ + simp [hφ₂_z₀] + have hγ_R_1 : γ_R 1 = u₀ := by + change (φ₂ (z₀ * Circle.exp (2 * Real.pi * 1))).1 = u₀ + rw [mul_one, Circle.exp_two_pi, mul_one, hφ₂_z₀] + have hγ_R_mem : ∀ t : ℝ, γ_R t ∈ F₂ := fun t => (φ₂ (E_param t)).2 + have hγ_R_surj : γ_R '' Icc 0 1 = F₂ := by + exact closed_parameter_interval_covers_circle (S := S) (F₂ := F₂) φ₂ z₀ + have hγ_R_inj_diff : ∀ s t : ℝ, s ∈ Icc (0 : ℝ) 1 → t ∈ Icc (0 : ℝ) 1 → + γ_R s = γ_R t → s = t ∨ (s = 0 ∧ t = 1) ∨ (s = 1 ∧ t = 0) := by + exact circle_parameter_repeats_only_endpoints (S := S) (F₂ := F₂) φ₂ z₀ + let U : Set ℝ := Ioo (0 : ℝ) 1 ∩ γ_R ⁻¹' F₁ᶜ + have hU_open : IsOpen U := isOpen_Ioo.inter (hF₁.isCompact.isClosed.isOpen_compl.preimage + hγ_R_cont) + have hU_sub : U ⊆ Ioo 0 1 := inter_subset_left + have hnot_U_mem_F₁ : ∀ t ∈ Icc (0 : ℝ) 1, t ∉ U → γ_R t ∈ F₁ := by + intro t ht hnotU + rcases eq_or_lt_of_le ht.1 with rfl | h0 + · exact hγ_R_0 ▸ hu₀F₁ + · rcases eq_or_lt_of_le ht.2 with rfl | h1 + · exact hγ_R_1 ▸ hu₀F₁ + · by_contra hnotF₁ + exact hnotU ⟨⟨h0, h1⟩, hnotF₁⟩ + by_cases h_full : ∃ t ∈ U, leftEnd8 U t = 0 ∧ rightEnd8 U t = 1 + · left + obtain ⟨t₀, ht₀U, hl0, hr1⟩ := h_full + have hIoo_sub : Ioo (0 : ℝ) 1 ⊆ U := by + have h := Ioo_leftEnd8_rightEnd8_subset hU_open hU_sub ht₀U + rwa [hl0, hr1] at h + refine ⟨u₀, Subset.antisymm ?_ (singleton_subset_iff.mpr ⟨hu₀F₁, hu₀F₂⟩)⟩ + rintro x ⟨hxF₁, hxF₂⟩ + rw [← hγ_R_surj] at hxF₂ + obtain ⟨t, ht, rfl⟩ := hxF₂ + rcases eq_or_lt_of_le ht.1 with rfl | h0 + · exact mem_singleton_iff.mpr hγ_R_0 + · rcases eq_or_lt_of_le ht.2 with rfl | h1 + · exact mem_singleton_iff.mpr hγ_R_1 + · exfalso + exact (hIoo_sub ⟨h0, h1⟩).2 hxF₁ + · right + push Not at h_full + have hchord_of_mem_U : ∀ t ∈ U, + let a := leftEnd8 U t + let b := rightEnd8 U t + 0 ≤ a ∧ a < b ∧ b ≤ 1 ∧ γ_R a ≠ γ_R b ∧ + IsLineWithEnds (γ_R '' Icc a b) (γ_R a) (γ_R b) ∧ + (γ_R '' Icc a b) ∩ F₁ = {γ_R a, γ_R b} ∧ + γ_R '' Icc a b ⊆ F₂ := by + exact component_of_arc_complement_is_chord (S := S) (F₁ := F₁) (F₂ := F₂) γ_R hγ_R_cont + hγ_R_mem hγ_R_inj_diff U rfl hU_open hU_sub hnot_U_mem_F₁ h_full + by_contra! hall_planar + obtain ⟨S', topS', j, D, hCap, hF₂_npl_S'⟩ : + ∃ (S' : Type u) (_ : TopologicalSpace S') (j : S → S') (D : Set S'), + IsCappedCuff C₁ S' j D ∧ ¬ IsPlanar (j '' F₂) := by + by_contra! h_all_S' + have hC₁ : C₁ ∈ cuffs S := hF₁_surr.1 + obtain ⟨c₀, _⟩ := isOArc_nonempty (cuff_isOArc hS hC₁) + have : Nonempty S := ⟨c₀⟩ + obtain ⟨S', topS', j, D, hS', hj, hD, hunion, hinter, hbdD⟩ := paste_disc S C₁ hS hC₁ + have hCap : IsCappedCuff C₁ S' j D := ⟨hC₁, hS', hj.isEmbedding, hD, hbdD.1, hunion, hinter⟩ + exact hF₂_ncap ⟨hC₁, ⟨S', topS', j, D, hCap, h_all_S' S' topS' j D hCap⟩, + fun S'' topS'' j' D' hCap' => h_all_S' S'' topS'' j' D' hCap'⟩ + have hS' : IsSurface S' := hCap.isSurface + have : T2Space S' := hS'.2.1 + have hj : IsEmbedding j := hCap.isEmbedding + have hjF₁_oarc : IsOArc (j '' F₁) := + isOArc_image hF₁ hj.continuous.continuousOn hj.injective.injOn + have hjF₂_oarc : IsOArc (j '' F₂) := + isOArc_image hF₂ hj.continuous.continuousOn hj.injective.injOn + obtain ⟨Δ₁, hΔ₁_disc, hjF₁_sub_Δ₁⟩ := hF₁_surr.2.1.2.2 S' j D hCap + have hjF₁_flat : IsFlat (j '' F₁) := by + refine isFlat_of_forall_isNullHomotopicOArc hS' fun F' hF' hF'_oarc => ?_ + exact isNullHomotopicOArcIn_of_subset_disc hF'_oarc (subset_univ Δ₁) hΔ₁_disc + (hF'.trans hjF₁_sub_Δ₁) + obtain ⟨W, hjF₁_W, hW_open, hW_flat, _, _⟩ := + theorem_11_5_proof hS' hjF₁_flat (IsOArc.isSolid hjF₁_oarc).1 + let q₀ : C(I, S') := ⟨fun t => j (γ_R t.1), hj.continuous.comp (hγ_R_cont.comp + continuous_subtype_val)⟩ + have hq₀_01 : q₀ 1 = q₀ 0 := by + change j (γ_R 1) = j (γ_R 0) + rw [hγ_R_1, hγ_R_0] + let K : Set ℝ := Icc (0 : ℝ) 1 ∩ (j ∘ γ_R) ⁻¹' Wᶜ + have hK_compact : IsCompact K := + IsCompact.inter_right isCompact_Icc (hW_open.isClosed_compl.preimage + (hj.continuous.comp hγ_R_cont)) + have hK_sub_U : K ⊆ U := by + rintro t ⟨ht_Icc, ht_notW⟩ + by_contra ht_notU + exact ht_notW (hjF₁_W (mem_image_of_mem j (hnot_U_mem_F₁ t ht_Icc ht_notU))) + have hK_cov : K ⊆ ⋃ t ∈ U, Ioo (leftEnd8 U t) (rightEnd8 U t) := by + intro t htK + have htU : t ∈ U := hK_sub_U htK + obtain ⟨_, _, ha_lt, _⟩ := leftEnd8_props hU_open hU_sub htU + obtain ⟨_, _, hb_gt, _⟩ := rightEnd8_props hU_open hU_sub htU + exact mem_iUnion₂.mpr ⟨t, htU, ha_lt, hb_gt⟩ + obtain ⟨F_K, hF_K_U, hF_K_fin, hK_sub_FK⟩ := + hK_compact.elim_finite_subcover_image + (b := U) (c := fun t : ℝ => Ioo (leftEnd8 U t) (rightEnd8 U t)) + (fun _ _ => isOpen_Ioo) hK_cov + -- Deduplicate by interval `(leftEnd8 U t, rightEnd8 U t)` and induct on `Finset` + have h_step : ∀ (G : Finset ℝ), (∀ t ∈ G, t ∈ U) → + ∃ q : C(I, S'), + PathsHomotopicRelIn univ q₀ q ∧ + (∀ s : I, (∀ t ∈ G, (s : ℝ) ∉ Ioo (leftEnd8 U t) (rightEnd8 U t)) → q s = q₀ s) ∧ + (∀ s : I, (∃ t ∈ G, (s : ℝ) ∈ Ioo (leftEnd8 U t) (rightEnd8 U t)) → q s ∈ W) := by + exact replace_finitely_many_chords_by_boundary_paths (S := S) (F₁ := F₁) (F₂ := F₂) (C₁ := + C₁) γ_R U hU_open hU_sub hnot_U_mem_F₁ hchord_of_mem_U hall_planar S' j D hCap hjF₁_oarc W + hjF₁_W q₀ (fun _ => rfl) + have hFK_sub : ∀ t ∈ hF_K_fin.toFinset, t ∈ U := + fun t ht => hF_K_U (hF_K_fin.mem_toFinset.mp ht) + obtain ⟨q_final, ⟨H, hH_univ, hH0, hH1, hHs0, hHs1⟩, hq_final_out, hq_final_in⟩ := + h_step hF_K_fin.toFinset hFK_sub + have hq_final_W : range q_final ⊆ W := by + rintro _ ⟨s, rfl⟩ + by_cases hsK : (s : ℝ) ∈ K + · obtain ⟨t, htFK, hs_oo⟩ := mem_iUnion₂.mp (hK_sub_FK hsK) + exact hq_final_in s ⟨t, hF_K_fin.mem_toFinset.mpr htFK, hs_oo⟩ + · by_cases hs_in : ∃ t ∈ hF_K_fin.toFinset, (s : ℝ) ∈ Ioo (leftEnd8 U t) (rightEnd8 U t) + · exact hq_final_in s hs_in + · push Not at hs_in + rw [hq_final_out s hs_in] + change j (γ_R s.1) ∈ W + by_contra hs_notW + exact hsK ⟨s.2, hs_notW⟩ + have hq_final_01 : q_final 1 = q_final 0 := by + rw [← hH1 1, hHs1 1, hq₀_01, ← hHs0 1, hH1 0] + let ψ₀ : C(Circle, S') := concatLoop one_pos (fun _ => q₀) (fun _ => hq₀_01) + let ψ₁ : C(Circle, S') := concatLoop one_pos (fun _ => q_final) (fun _ => hq_final_01) + have hhom : ClosedCurvesHomotopicIn univ ψ₀ ψ₁ := + concatLoop_homotopic one_pos (fun _ => q₀) (fun _ => q_final) + (fun _ => hq₀_01) (fun _ => hq_final_01) (fun _ => H) + (fun _ p => hH_univ p) (fun _ t => hH0 t) (fun _ t => hH1 t) + (fun _ s => (hHs1 s).trans hq₀_01 |>.trans (hHs0 s).symm) + have hψ₁_W : range ψ₁ ⊆ W := by + rw [range_concatLoop] + rintro _ ⟨_, ⟨_, rfl⟩, hy⟩ + exact hq_final_W hy + have hψ₁_null : ClosedCurveIsNullHomotopicIn univ ψ₁ := hW_flat ψ₁ hψ₁_W + have hψ₀_null : ClosedCurveIsNullHomotopicIn univ ψ₀ := + null_of_homotopic subset_rfl hhom hψ₁_null + let f_emb : Circle → S' := fun w => j (φ₂ (z₀ * w)).1 + have hf_emb_cont : Continuous f_emb := + hj.continuous.comp (continuous_subtype_val.comp (φ₂.continuous.comp + (continuous_const.mul continuous_id))) + have hf_emb_inj : Function.Injective f_emb := fun w₁ w₂ heq => + mul_left_cancel (φ₂.injective (Subtype.ext (hj.injective heq))) + have hrange_f_emb : range f_emb = j '' F₂ := by + exact range_of_rotated_circle_embedding (S := S) (F₂ := F₂) φ₂ z₀ S' j + have hψ₀_eq : ψ₀ = ⟨f_emb, hf_emb_cont⟩ := by + ext w + have h2pi : (0 : ℝ) < 2 * Real.pi := by positivity + let r : ℝ := toIcoMod h2pi 0 (Complex.arg w) / (2 * Real.pi) + have hr_mem : r ∈ Icc (0 : ℝ) 1 := by + have h_ico := toIcoMod_mem_Ico h2pi 0 (Complex.arg w) + refine ⟨div_nonneg h_ico.1 h2pi.le, (div_le_one h2pi).mpr (by linarith [h_ico.2])⟩ + let t : I := ⟨r, hr_mem⟩ + let w_t : Circle := Circle.exp (2 * Real.pi * (((0 : Fin 1).1 : ℝ) + (t : ℝ)) / ((1 : ℕ) : ℝ)) + have hexp_t : w_t = w := by + have h1 : 2 * Real.pi * (((0 : Fin 1).1 : ℝ) + (t : ℝ)) / ((1 : ℕ) : ℝ) = + toIcoMod h2pi 0 (Complex.arg w) := by + have ht_eq : (t : ℝ) = r := rfl + rw [ht_eq] + dsimp [r] + simp [mul_div_cancel₀ _ h2pi.ne'] + change Circle.exp (2 * Real.pi * (((0 : Fin 1).1 : ℝ) + (t : ℝ)) / ((1 : ℕ) : ℝ)) = w + rw [h1] + have h2 : toIcoMod h2pi 0 (Complex.arg w) = + Complex.arg w - toIcoDiv h2pi 0 (Complex.arg w) • (2 * Real.pi) := rfl + have h3 : Circle.exp (toIcoMod h2pi 0 (Complex.arg w)) = Circle.exp (Complex.arg w) := by + rw [h2, zsmul_eq_mul] + exact Circle.exp_eq_exp.mpr ⟨-toIcoDiv h2pi 0 (Complex.arg w), by push_cast; ring⟩ + exact h3.trans (Circle.exp_arg w) + have hpiece : ψ₀ w_t = q₀ t := + concatLoop_exp_piece one_pos (fun _ => q₀) (fun _ => hq₀_01) 0 t + change ψ₀ w = f_emb w + rw [← hexp_t, hpiece] + change j (φ₂ (z₀ * Circle.exp (2 * Real.pi * (t : ℝ)))).1 = f_emb w_t + dsimp [f_emb, w_t] + congr 3 + congr 1 + simp + have hjF₂_null : IsNullHomotopicOArc (j '' F₂) := by + rw [← hrange_f_emb] + have hemb : IsEmbedding f_emb := (hf_emb_cont.isClosedEmbedding hf_emb_inj).isEmbedding + exact ⟨hemb.toHomeomorph, hψ₀_eq ▸ hψ₀_null⟩ + exact hF₂_npl_S' ((isPlanar_iff_isNullHomotopicOArc_of_isOArc hS' hjF₂_oarc).mpr hjF₂_null) + +/-! ## 5. Main Section 8 Characterization and Consequences for `α(G)` -/ + +/-- Graph Minors VII, Section 8 (page 241): +"It is easy to verify, using (5.1) and (5.2), that if $X \subseteq \Sigma$ is solid and connected, +then $X$ is near-planar if and only if no subset of $X$ is schismatic." -/ +theorem isNearPlanar_iff_forall_not_isSchismatic + (hS : IsSurface S) [ConnectedSpace S] {X : Set S} + (hns : ¬ IsSphere S ∨ X ≠ univ) + (hX_solid : IsSolid X) (hX_conn : IsConnected X) : + IsNearPlanar X ↔ ∀ Y : Set S, Y ⊆ X → ¬ IsSchismatic Y := by + have : T2Space S := hS.2.1 + constructor + · intro hX Y hYX hY_sch + exact hY_sch.2.1 (hX.mono hYX) + · intro hall_not_sch + by_contra hX_nnp + by_cases hex_oarc : ∃ F : Set S, IsOArc F ∧ F ⊆ X ∧ ¬ IsNearPlanar F + · obtain ⟨F, hF, hFX, hF_nnp⟩ := hex_oarc + exact hall_not_sch F hFX + ⟨Or.inl hF, hF_nnp, fun F' hF' hF'_ss => (not_ssubset_of_isOArc hF hF' hF'_ss).elim⟩ + · push Not at hex_oarc + have hX_npl : ¬ IsPlanar X := fun hpl => hX_nnp (Or.inl hpl) + have hex_F₁ : ∃ F₁ : Set S, IsOArc F₁ ∧ F₁ ⊆ X ∧ ¬ IsPlanar F₁ := by + by_contra! hall_pl + exact hX_npl ((theorem_5_1_of_not_isSphere hS hns hX_solid).mpr hall_pl) + obtain ⟨F₁, hF₁, hF₁X, hF₁_npl⟩ := hex_F₁ + obtain ⟨C₁, hC₁, hF₁_cap⟩ := (hex_oarc F₁ hF₁ hF₁X).resolve_left hF₁_npl + have hF₁_surr : SurroundsCuff F₁ C₁ := ⟨hC₁, hF₁_cap, hF₁_npl⟩ + have hX_ncap : ¬ IsPlanarInCappedCuff C₁ X := + fun hcap => hX_nnp (Or.inr ⟨C₁, hC₁, hcap⟩) + have hex_F₂ : ∃ F₂ : Set S, IsOArc F₂ ∧ F₂ ⊆ X ∧ ¬ IsPlanarInCappedCuff C₁ F₂ := by + by_contra! hall_cap + exact hX_ncap ((isPlanarInCappedCuff_iff_forall_isOArc hS hC₁ hX_solid).mpr hall_cap) + obtain ⟨F₂, hF₂, hF₂X, hF₂_ncap⟩ := hex_F₂ + by_cases hdisj : Disjoint F₁ F₂ + · have hX_arc : IsArcConnected X := theorem_11_4_proof hS hX_conn hX_solid.1 + obtain ⟨P, u, v, hPX, huF₁, hvF₂, hP_line, hPF₁, hPF₂⟩ := + exists_connecting_line_between_disjoint_closed hX_arc hF₁X hF₂X + hF₁.isCompact.isClosed hF₂.isCompact.isClosed + (isOArc_nonempty hF₁) (isOArc_nonempty hF₂) hdisj + let Y := F₁ ∪ F₂ ∪ P + have hYX : Y ⊆ X := union_subset (union_subset hF₁X hF₂X) hPX + have hY_x1 : IsX1Arc Y := + ⟨F₁, F₂, P, u, v, hF₁, hF₂, hdisj, hP_line, huF₁, hvF₂, hPF₁, hPF₂, rfl⟩ + have hY_ncap : ¬ IsPlanarInCappedCuff C₁ Y := + fun hcap => hF₂_ncap (hcap.mono (subset_union_right.trans subset_union_left)) + have hY_nnp : ¬ IsNearPlanar Y := + not_isNearPlanar_of_surroundsCuff_and_not_planarInCappedCuff hS hF₁ hF₁_surr hF₂_ncap + (subset_union_left.trans subset_union_left) hY_ncap + exact hall_not_sch Y hYX + ⟨Or.inr (Or.inl hY_x1), hY_nnp, fun F' hF' hF'Y => hex_oarc F' hF' (hF'Y.1.trans hYX)⟩ + · rw [not_disjoint_iff_nonempty_inter] at hdisj + rcases exists_chord_not_planarInCappedCuff_of_inter_nonempty hS hF₁ hF₂ + hF₁_surr hF₂_ncap hdisj with ⟨u, h_single⟩ | ⟨P, u, v, hPF₂, huv, hP_line, hPF₁, + hY_ncap⟩ + · let Y := F₁ ∪ F₂ + have hYX : Y ⊆ X := union_subset hF₁X hF₂X + have hY_x2 : IsX2Arc Y := ⟨F₁, F₂, u, hF₁, hF₂, h_single, rfl⟩ + have hY_ncap : ¬ IsPlanarInCappedCuff C₁ Y := + fun hcap => hF₂_ncap (hcap.mono subset_union_right) + have hY_nnp : ¬ IsNearPlanar Y := + not_isNearPlanar_of_surroundsCuff_and_not_planarInCappedCuff hS hF₁ hF₁_surr hF₂_ncap + subset_union_left hY_ncap + exact hall_not_sch Y hYX + ⟨Or.inr (Or.inr (Or.inl hY_x2)), hY_nnp, + fun F' hF' hF'Y => hex_oarc F' hF' (hF'Y.1.trans hYX)⟩ + · let Y := F₁ ∪ P + have hYX : Y ⊆ X := union_subset hF₁X (hPF₂.trans hF₂X) + have hY_x3 : IsX3Arc Y := isX3Arc_union_chord hF₁ huv hP_line hPF₁ + have hY_nnp : ¬ IsNearPlanar Y := + not_isNearPlanar_of_surroundsCuff_and_not_planarInCappedCuff hS hF₁ hF₁_surr hF₂_ncap + subset_union_left hY_ncap + exact hall_not_sch Y hYX + ⟨Or.inr (Or.inr (Or.inr hY_x3)), hY_nnp, + fun F' hF' hF'Y => hex_oarc F' hF' (hF'Y.1.trans hYX)⟩ + +/-- Every `α(G)`-candidate `X` (`IsAlphaCandidate G X`) with `¬ IsSphere S ∨ X ≠ univ` contains a +`G`-normal schismatic subset `Y ⊆ X`. -/ +theorem exists_schismatic_of_isAlphaCandidate_of_ne_univ + (hS : IsSurface S) [ConnectedSpace S] (G : Drawing S) {X : Set S} + (hns : ¬ IsSphere S ∨ X ≠ univ) + (hX : IsAlphaCandidate G X) : + ∃ Y : Set S, Y ⊆ X ∧ IsSchismatic Y ∧ G.IsNormal Y := by + obtain ⟨hX_solid, hX_conn, hX_norm, hX_nnp⟩ := hX + have hnot_all : ¬ (∀ Y : Set S, Y ⊆ X → ¬ IsSchismatic Y) := + fun hall => hX_nnp ((isNearPlanar_iff_forall_not_isSchismatic hS hns hX_solid hX_conn).mpr hall) + push Not at hnot_all + obtain ⟨Y, hYX, hY_sch⟩ := hnot_all + exact ⟨Y, hYX, hY_sch, fun z ⟨hzY, hzU⟩ => hX_norm ⟨hYX hzY, hzU⟩⟩ + +/-- On any connected surface `S` that is not a 2-sphere (`¬ IsSphere S`), every `α(G)`-candidate +`X` (`IsAlphaCandidate G X`) contains a `G`-normal schismatic subset `Y ⊆ X`. +This provides the hypothesis `hcontains` of `GraphMinor.GM12.alpha_ge_of_schismatic_counts`. -/ +theorem exists_schismatic_of_isAlphaCandidate + (hS : IsSurface S) [ConnectedSpace S] (hns : ¬ IsSphere S) + (G : Drawing S) : + ∀ X : Set S, IsAlphaCandidate G X → + ∃ Y : Set S, Y ⊆ X ∧ IsSchismatic Y ∧ G.IsNormal Y := + fun _ hX => exists_schismatic_of_isAlphaCandidate_of_ne_univ hS G (Or.inl hns) hX + +/-- Every `G`-normal schismatic set `Y` in a surface `S` is an `α(G)`-candidate +(`IsAlphaCandidate G Y`). -/ +theorem IsSchismatic.isAlphaCandidate + (hS : IsSurface S) {G : Drawing S} {Y : Set S} + (hY : IsSchismatic Y) (hnorm : G.IsNormal Y) : + IsAlphaCandidate G Y := by + obtain ⟨hsol, hconn⟩ := hY.isSolid_and_isConnected hS + exact ⟨hsol, hconn, hnorm, hY.2.1⟩ + +/-- Graph Minors VII, Section 8 (page 241): +"Thus $\alpha(G)$ equals the minimum of $|V(G) \cap X|$, taken over all $G$-normal schismatic sets +$X$; and this provides us with an alternative definition of $\alpha(G)$." -/ +theorem alpha_eq_sInf_schismatic + (hS : IsSurface S) [ConnectedSpace S] (hns : ¬ IsSphere S) + (G : Drawing S) : + alpha G = sInf {(G.V ∩ X).ncard | (X : Set S) (_ : IsSchismatic X ∧ G.IsNormal X)} := by + let S_cand : Set ℕ := {n : ℕ | ∃ X : Set S, IsAlphaCandidate G X ∧ (X ∩ G.V).ncard = n} + let S_sch : Set ℕ := {(G.V ∩ X).ncard | (X : Set S) (_ : IsSchismatic X ∧ G.IsNormal X)} + change sInf S_cand = sInf S_sch + have h_sub : S_sch ⊆ S_cand := by + rintro _ ⟨Y, ⟨hY_sch, hY_norm⟩, rfl⟩ + exact ⟨Y, hY_sch.isAlphaCandidate hS hY_norm, by rw [inter_comm]⟩ + by_cases hne : S_cand.Nonempty + · obtain ⟨_, ⟨X₀, hX₀, rfl⟩⟩ := hne + obtain ⟨Y₀, _, hY₀_sch, hY₀_norm⟩ := + exists_schismatic_of_isAlphaCandidate hS hns G X₀ hX₀ + have hne_sch : S_sch.Nonempty := ⟨(G.V ∩ Y₀).ncard, Y₀, ⟨hY₀_sch, hY₀_norm⟩, rfl⟩ + refine le_antisymm (csInf_le_csInf (OrderBot.bddBelow S_cand) hne_sch h_sub) ?_ + obtain ⟨X, hX, hk_eq⟩ := Nat.sInf_mem (⟨_, X₀, hX₀, rfl⟩ : S_cand.Nonempty) + rw [← hk_eq, inter_comm] + obtain ⟨Y, hYX, hY_sch, hY_norm⟩ := + exists_schismatic_of_isAlphaCandidate hS hns G X hX + have hle : (G.V ∩ Y).ncard ≤ (G.V ∩ X).ncard := + ncard_le_ncard (inter_subset_inter_right G.V hYX) (G.finite_V.inter_of_left X) + have hY_mem : (G.V ∩ Y).ncard ∈ S_sch := ⟨Y, ⟨hY_sch, hY_norm⟩, rfl⟩ + exact (Nat.sInf_le hY_mem).trans hle + · have h_cand_emp : S_cand = ∅ := not_nonempty_iff_eq_empty.mp hne + have h_sch_emp : S_sch = ∅ := eq_empty_of_subset h_sub h_cand_emp + rw [h_cand_emp, h_sch_emp] + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section9.lean b/LeanPool/GraphMinor/GM07/Section9.lean new file mode 100644 index 0000000000..e159f3da47 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section9.lean @@ -0,0 +1,135 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section9CoreProved +import LeanPool.GraphMinor.GM07.Section9CylinderProved + +/-! +# Graph Minors VII, (9.3) to (9.6) + +The cylinder case uses the proved (9.1) on the punctured surface. The disc, +sphere, and grid consequences follow in the order of Section 9, pages 244–246. +The proofs of (9.1) and (9.2) are exposed by `Section9CoreProved`. +-/ + +@[expose] public section +namespace GraphMinor.GM07 +open Set Topology GraphMinor.Surface +universe u +variable {S : Type u} [TopologicalSpace S] + +/-! ## Proofs of (9.3), (9.4), (9.5), and (9.6) -/ + +/-- Graph Minors VII, (9.3) (pages 244–245): +"(9.3) *Let $\Sigma$ be a cylinder with cuffs $C_1$ and $C_2$. Let $(H, H^+, H^-)$ be a proper +digraph in $\Sigma$. Let $t = |V(H)| + |E(H)|$, and let $r = 84(t+2) 5^t v(\Sigma(0, 0, t+4), +2t+4)$. +Let $(G, G^+, G^-)$ be a proper digraph in $\Sigma$ such that +$V(G) \cap \mathrm{bd}(\Sigma) = V(H) \cap \mathrm{bd}(\Sigma)$. Suppose that there are disjoint +$G$-normal $O$-arcs $F_1, F_2$ with the following properties:* +(i) *$F_1, F_2$ are not null-homotopic, and $C_1, F_2, F_1, C_2$ occur on $\Sigma$ in that order +(in the natural sense),* +(ii) *$|V(G) \cap F| \ge 2r$ for every $G$-normal $[0, 1]$-arc $F$ with +$F \cap F_1 \ne \emptyset \ne F \cap F_2$,* +(iii) *$k(F_1, F_2) \ge r$, and* +(iv) *$k(F_i, C_i) \ge |V(G) \cap C_i| \ (i = 1, 2)$.* +*Then $(H, H^+, H^-)$ is a boundary-rooted minor of $(G, G^+, G^-)$.*" -/ +theorem theorem_9_3_proof + (hS : IsSurface S) (he : Nonempty (S ≃ₜ SurfaceModel 0 0 2)) + {C₁ C₂ : Set S} (hcuffs : cuffs S = {C₁, C₂}) (hne : C₁ ≠ C₂) + (H G : SurfaceDigraph S) (hH : H.IsProper) (hG : G.IsProper) + (hbd_eq : G.G.V ∩ bd S = H.G.V ∩ bd S) + {F₁ F₂ : Set S} (hF₁ : G.G.IsNormal F₁) (hF₂ : G.G.IsNormal F₂) + (hOrder : CylinderOArcsInOrder C₁ F₂ F₁ C₂) + (hInC₁ : ∀ x ∈ F₂, IsPointInsideSurroundingOArc C₁ F₁ x) + (hbd₁ : Disjoint F₁ (bd S)) (hbd₂ : Disjoint F₂ (bd S)) + (hLine : ∀ F : Set S, G.G.IsNormal F → IsLine F → + (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → + 2 * (rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard)) ≤ (G.G.V ∩ F).ncard) + (hk12 : rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard) ≤ maxDisjointPaths G.G F₁ F₂) + (hkC₁ : (G.G.V ∩ C₁).ncard ≤ maxDisjointPaths G.G F₁ C₁) + (hkC₂ : (G.G.V ∩ C₂).ncard ≤ maxDisjointPaths G.G F₂ C₂) : + IsBoundaryRootedMinor H G := + cylinderPunctureReduction + S hS he C₁ C₂ hcuffs hne H G hH hG hbd_eq F₁ F₂ hF₁ hF₂ + hOrder hInC₁ hbd₁ hbd₂ hLine hk12 hkC₁ hkC₂ + +/-- Graph Minors VII, (9.4) (page 246): +"(9.4) *Let $\Sigma$ be a closed disc with cuff $C$ and let $(H, H^+, H^-)$ be a proper digraph in +$\Sigma$. Let $r$ be defined as in (9.3). Let $(G, G^+, G^-)$ be a proper digraph in $\Sigma$, such +that $V(G) \cap \mathrm{bd}(\Sigma) = V(H) \cap \mathrm{bd}(\Sigma)$. Suppose that there are +disjoint $G$-normal $O$-arcs $F_1, F_2$ of $\Sigma$, with $F_1$ inside $F_2$, such that* +(i) *$|V(G) \cap F| \ge 2r$ for every $G$-normal $[0, 1]$-arc $F$ with +$F \cap F_1 \ne \emptyset \ne F \cap F_2$,* +(ii) *$k(F_1, F_2) \ge r$, and* +(iii) *$k(F_1, C) \ge |V(G) \cap C|$.* +*Then $(H, H^+, H^-)$ is a boundary-rooted minor of $(G, G^+, G^-)$.*" -/ +theorem theorem_9_4_proof + (hS : IsSurface S) (hD : IsClosedDisc (univ : Set S)) + {C : Set S} (hcuffs : cuffs S = {C}) + (H G : SurfaceDigraph S) (hH : H.IsProper) (hG : G.IsProper) + (hbd_eq : G.G.V ∩ bd S = H.G.V ∩ bd S) + {F₁ F₂ : Set S} (hF₁ : G.G.IsNormal F₁) (hF₂ : G.G.IsNormal F₂) + (hO₁ : IsOArc F₁) (hO₂ : IsOArc F₂) (hDisj : Disjoint F₁ F₂) + (hInside : IsInsideOArc F₁ F₂) (hbd₂ : Disjoint F₂ (bd S)) + (hLine : ∀ F : Set S, G.G.IsNormal F → IsLine F → + (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → + 2 * (rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard)) ≤ (G.G.V ∩ F).ncard) + (hk12 : rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard) ≤ maxDisjointPaths G.G F₁ F₂) + (hkC : (G.G.V ∩ C).ncard ≤ maxDisjointPaths G.G F₁ C) : + IsBoundaryRootedMinor H G := by + obtain ⟨S', tS', -, C₁, C₂, H', G', F₁', F₂', hS', he', hcuffs', hne', hH', hG', hbd_eq', + hF₁', hF₂', hOrder', hInC₁', hbd₁', hbd₂', hLine', hk12', hkC₁', hkC₂', himp⟩ := + discToCylinderReduction S hS hD C hcuffs H G hH hG hbd_eq F₁ F₂ hF₁ hF₂ hO₁ hO₂ hDisj hInside + hbd₂ hLine hk12 hkC + exact himp (@theorem_9_3_proof S' tS' hS' he' C₁ C₂ hcuffs' hne' H' G' hH' hG' + hbd_eq' F₁' F₂' hF₁' hF₂' hOrder' hInC₁' hbd₁' hbd₂' hLine' hk12' hkC₁' hkC₂') + +/-- Graph Minors VII, (9.5) (page 246): +"(9.5) *Let $\Sigma$ be a sphere, and let $(H, H^+, H^-)$ be a proper digraph in $\Sigma$. Let $r$ +be defined as in (9.3). Let $(G, G^+, G^-)$ be a proper digraph in $\Sigma$. Suppose that there are +disjoint $G$-normal $O$-arcs $F_1, F_2$ of $\Sigma$ satisfying (i) and (ii) of (9.4). Then +$(H, H^+, H^-)$ is a boundary-rooted minor of $(G, G^+, G^-)$.*" -/ +theorem theorem_9_5_proof + [T1Space S] (hS : IsSurface S) (hSph : IsSphere S) + (H G : SurfaceDigraph S) (hH : H.IsProper) (hG : G.IsProper) + {F₁ F₂ : Set S} (hF₁ : G.G.IsNormal F₁) (hF₂ : G.G.IsNormal F₂) + (hO₁ : IsOArc F₁) (hO₂ : IsOArc F₂) (hDisj : Disjoint F₁ F₂) + (hLine : ∀ F : Set S, G.G.IsNormal F → IsLine F → + (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → + 2 * (rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard)) ≤ (G.G.V ∩ F).ncard) + (hk12 : rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard) ≤ maxDisjointPaths G.G F₁ F₂) : + IsBoundaryRootedMinor H G := by + obtain ⟨S', tS', -, C, H', G', F₁', F₂', hS', hD', hcuffs', hH', hG', hbd_eq', hF₁', hF₂', + hO₁', hO₂', hDisj', hInside', hbd₂', hLine', hk12', hkC', himp⟩ := + sphereToDiscReduction S hS hSph H G hH hG F₁ F₂ hF₁ hF₂ hO₁ hO₂ hDisj hLine hk12 + exact himp (@theorem_9_4_proof S' tS' hS' hD' C hcuffs' H' G' hH' hG' + hbd_eq' F₁' F₂' hF₁' hF₂' hO₁' hO₂' hDisj' hInside' hbd₂' hLine' hk12' hkC') + +/-- Graph Minors VII, (9.6) (page 246): +"(9.6) *Let $(G, G^+, G^-)$, $(H, H^+, H^-)$ be directed graphs in a sphere $\Sigma$, where $G$ is +isomorphic to an $N \times N$-grid. If $N$ is sufficiently large (bounded below by a function of +$H$) then $(H, H^+, H^-)$ is a minor of $(G, G^+, G^-)$.*" -/ +theorem theorem_9_6_proof + [T1Space S] (hS : IsSurface S) (hSph : IsSphere S) + (H : SurfaceDigraph S) : + ∃ N₀ : ℕ, ∀ (N : ℕ) (G : SurfaceDigraph S), + N₀ ≤ N → IsGridDrawing G.G N → IsDigraphMinor H G := by + have hbd : bd S = ∅ := by + by_contra hbd_ne + exact not_isSphere_of_bd_ne_empty hbd_ne hSph + have hH : H.IsProper := isProper_of_bd_eq_empty hbd H.G + obtain ⟨N₀, hN₀⟩ := sphereGridMinorReduction S hS H + refine ⟨N₀, fun N G hN hG_grid => ⟨hbd, ?_⟩⟩ + have hG : G.IsProper := isProper_of_bd_eq_empty hbd G.G + obtain ⟨F₁, F₂, hF₁, hF₂, hO₁, hO₂, hDisj, hLine, hk12⟩ := hN₀ N G hN hG_grid + exact theorem_9_5_proof hS hSph H G hH hG hF₁ hF₂ hO₁ hO₂ hDisj hLine hk12 + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section9CoreProved.lean b/LeanPool/GraphMinor/GM07/Section9CoreProved.lean new file mode 100644 index 0000000000..5e2399f816 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section9CoreProved.lean @@ -0,0 +1,477 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section7 +public import LeanPool.GraphMinor.GM07.CutEdges +public import LeanPool.GraphMinor.GM07.Section9Grid +import LeanPool.GraphMinor.GM07.CuffSlide +import LeanPool.GraphMinor.GM07.Section35 +public import LeanPool.GraphMinor.GM11.ArcDrawings +public import LeanPool.GraphMinor.Surface.DiscMerge +public import LeanPool.GraphMinor.Surface.Cuffs + +/-! +# Graph Minors VII, (9.1) and (9.2) + +The proof of (9.1) inducts on the number of internal isolated vertices and +uses (7.5) in the base case. The closed-surface consequence (9.2) follows +from (9.1). These proofs precede the punctured-cylinder deduction of (9.3). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## Loop-addition invariance for boundary-rooted minors -/ + +/-- Unconditional proof of the observation in Graph Minors VII, proof of (9.1) (page 243: "If the +theorem is true for this new digraph it is true for $(H, H^+, H^-)$"): if `H'` is obtained from `H` +by adding edges (keeping the same vertex set `H'.G.V = H.G.V` and the same `plus`/`minus` endpoints +on `H.G.E`), then `IsBoundaryRootedMinor H' G` implies `IsBoundaryRootedMinor H G`. -/ +theorem isBoundaryRootedMinor_of_edge_subdigraph {H H' G : SurfaceDigraph S} + (hV : H'.G.V = H.G.V) (hE : H.G.E ⊆ H'.G.E) + (hends : ∀ e ∈ H.G.E, H'.plus e = H.plus e ∧ H'.minus e = H.minus e) + (hMinor : IsBoundaryRootedMinor H' G) : + IsBoundaryRootedMinor H G := by + rcases hMinor with ⟨hbd, φv, φe, hφv, hφe, hdisj, hinj, hnotMem, hinc, hroot⟩ + refine ⟨by rw [← hV]; exact hbd, φv, φe, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro v hv + exact hφv v (hV.symm ▸ hv) + · intro e he + exact hφe e (hE he) + · intro v hv v' hv' hne + exact hdisj v (hV.symm ▸ hv) v' (hV.symm ▸ hv') hne + · intro e he e' he' hne + exact hinj e (hE he) e' (hE he') hne + · intro v hv e he + exact hnotMem v (hV.symm ▸ hv) e (hE he) + · intro e he + have h := hinc e (hE he) + rw [(hends e he).1, (hends e he).2] at h + exact h + · intro v hv + exact hroot v ⟨hV.symm ▸ hv.1, hv.2⟩ + +/-- `vModel a b c k` is monotone in `c` for all `c₁ ≤ c₂`. -/ +theorem vModel_mono_c_le (a b : ℕ) {c₁ c₂ : ℕ} (hc : c₁ ≤ c₂) (k : ℕ) : + vModel a b c₁ k ≤ vModel a b c₂ k := by + induction hc with + | refl => exact le_rfl + | @step m _ ih => exact le_trans ih (vModel_mono_c a b m k) + +private theorem punctured_circle_is_angle_image + {S : Type u} + (v : S) + (F : Set S) : + let e₀ : Set S := F \ {v} + ∀ (p : ℝ → S), + (p 0 = v) → + (∀ (s t : ℝ), p s = p t → ∃ m : ℤ, s = t + (m : ℝ) * (2 * Real.pi)) → + (p '' Ico 0 (2 * Real.pi) = F) → + (range p ⊆ F) → + (0 < 2 * Real.pi) → + e₀ = p '' Ioo 0 (2 * Real.pi) := by + intro e₀ p hp0 hper himg hr hpos + ext y + constructor + · rintro ⟨hy, hyv⟩ + rw [← himg] at hy + obtain ⟨s, hs, rfl⟩ := hy + refine ⟨s, ⟨lt_of_le_of_ne hs.1 fun hs0 => hyv ?_, hs.2⟩, rfl⟩ + rw [← hs0, hp0] + rfl + · rintro ⟨s, hs, rfl⟩ + refine ⟨hr ⟨s, rfl⟩, fun h => ?_⟩ + have h' : p s = p 0 := h.trans hp0.symm + obtain ⟨m, hm⟩ := hper s 0 h' + rw [zero_add] at hm + have h₁ : (0 : ℝ) < m := by + by_contra hc + push Not at hc + nlinarith [hs.1] + have h₂ : (m : ℝ) < 1 := by + by_contra hc + push Not at hc + nlinarith [hs.2] + have h₃ : (0 : ℤ) < m := by exact_mod_cast h₁ + have h₄ : m < (1 : ℤ) := by exact_mod_cast h₂ + omega + +private theorem auxiliary_loop_meets_graph_at_vertices {S : Type u} [TopologicalSpace S] + (H : SurfaceDigraph S) {v : S} (hvV : v ∈ H.G.V) {Bad F : Set S} + (hU_sub_Bad : H.G.U \ {v} ⊆ Bad) (hF_not_Bad : ∀ x ∈ F, x ∉ Bad) + (D : Drawing S) (hDU : D.U = F) (hDV : D.V = {v}) : + H.G.U ∩ D.U ⊆ H.G.V ∩ D.V := by + rw [hDU, hDV] + rintro x ⟨hxU, hxF⟩ + by_cases hxv : x = v + · subst hxv + exact ⟨hvV, rfl⟩ + · exact (hF_not_Bad x hxF (hU_sub_Bad ⟨hxU, hxv⟩)).elim + +/-- Graph Minors VII, proof of (9.1), Step 1 (page 243): +"If $g \ne 0$, let us add a (directed) loop to an isolated vertex of $H$ not in $bd(\Sigma)$. If +the theorem is true for this new digraph it is true for $(H, H^+, H^-)$; and the new digraph +satisfies all the hypotheses of the theorem (leaving $k$ and $c$ unchanged)." -/ +theorem addLoop_to_isolatedVertex [T1Space S] (hS : IsSurface S) + (H : SurfaceDigraph S) (hH : H.IsProper) + (hg_pos : 0 < numInternalIsolatedVertices H.G) : + ∃ H' : SurfaceDigraph S, + H'.IsProper ∧ + H'.G.V = H.G.V ∧ + H.G.E ⊆ H'.G.E ∧ + (∀ e ∈ H.G.E, H'.plus e = H.plus e ∧ H'.minus e = H.minus e) ∧ + H'.G.E.ncard = H.G.E.ncard + 1 ∧ + numInternalIsolatedVertices H'.G + 1 = numInternalIsolatedVertices H.G := by + classical + have : T2Space S := hS.2.1 + let IsoSet : Set S := {v ∈ H.G.V \ bd S | IsIsolatedVertex H.G v} + have hIso_fin : IsoSet.Finite := (H.G.finite_V.subset sdiff_subset).sep _ + have hIso_ne : IsoSet.Nonempty := (ncard_pos hIso_fin).mp hg_pos + obtain ⟨v, ⟨hvV, hv_not_bd⟩, hiso⟩ := hIso_ne + have hv_not_cl : ∀ e ∈ H.G.E, v ∉ closure e := fun e he hcl => + hiso.2 e he ⟨hvV, Or.inl he, hcl⟩ + let Bad : Set S := bd S ∪ (H.G.V \ {v}) ∪ ⋃ e ∈ H.G.E, closure e + have hBad_closed : IsClosed Bad := + ((isClosed_bd S).union (H.G.finite_V.subset sdiff_subset).isClosed).union + (H.G.finite_edges.isClosed_biUnion fun _ _ => isClosed_closure) + have hv_not_Bad : v ∉ Bad := by + rintro ((h | h) | h) + · exact hv_not_bd h + · exact h.2 rfl + · obtain ⟨e, he, hve⟩ := mem_iUnion₂.mp h + exact hv_not_cl e he hve + have hU_sub_Bad : H.G.U \ {v} ⊆ Bad := by + rintro x ⟨hxU, hxv⟩ + rw [H.G.U_eq] at hxU + rcases hxU with hxV | hxE + · exact Or.inl (Or.inr ⟨hxV, hxv⟩) + · exact Or.inr hxE + have hv_int : IsInteriorPoint v := not_not.mp hv_not_bd + obtain ⟨U₀, h, g, hc, hU₀, h0⟩ := + hv_int.exists_ballChart hBad_closed.isOpen_compl hv_not_Bad (R := 3) (by norm_num) + have hmem_ball : ∀ u : Circle, (u : ℂ) - 1 ∈ Metric.ball (0 : ℂ) 3 := fun u => by + rw [Metric.mem_ball, dist_zero_right] + calc + ‖(u : ℂ) - 1‖ ≤ ‖(u : ℂ)‖ + ‖(1 : ℂ)‖ := norm_sub_le _ _ + _ = 1 + 1 := by simp [Circle.norm_coe] + _ < 3 := by norm_num + let j : Circle → S := fun u => g ((u : ℂ) - 1) + have hj_cont : Continuous j := hc.gc.comp_continuous (by fun_prop) hmem_ball + have hj_inj : Function.Injective j := by + intro u₁ u₂ heq + have h₁ := hc.hg (hmem_ball u₁) + have h₂ := hc.hg (hmem_ball u₂) + have hsub_eq : (u₁ : ℂ) - 1 = (u₂ : ℂ) - 1 := by + calc + (u₁ : ℂ) - 1 = h (j u₁) := h₁.symm + _ = h (j u₂) := congrArg h heq + _ = (u₂ : ℂ) - 1 := h₂ + exact Subtype.ext (sub_left_inj.mp hsub_eq) + let F : Set S := range j + have hF_oarc : IsOArc F := ⟨(hj_cont.isClosedEmbedding hj_inj).isEmbedding.toHomeomorph⟩ + have hvF : v ∈ F := ⟨1, by simp [j, h0]⟩ + have hF_not_Bad : ∀ x ∈ F, x ∉ Bad := by + rintro _ ⟨u, rfl⟩ + exact hU₀ (hc.gm (hmem_ball u)) + obtain ⟨D, hDU, hDV⟩ := GM11.exists_loop_drawing hF_oarc hvF + let e₀ : Set S := F \ {v} + obtain ⟨p, hp, hp0, hp2, hper, himg, hr⟩ := GM11.exists_oArc_par hF_oarc hvF + have hpos : (0 : ℝ) < 2 * Real.pi := Real.two_pi_pos + have hsd : e₀ = p '' Ioo 0 (2 * Real.pi) := by + exact punctured_circle_is_angle_image (S := S) v F p hp0 hper himg hr hpos + have hpc : IsPathConnected e₀ := by + rw [hsd] + exact ((convex_Ioo _ _).isPathConnected (nonempty_Ioo.mpr hpos)).image hp + have he₀_ne : e₀.Nonempty := hpc.nonempty + have hDE : D.E = {e₀} := by + change arcComponentsIn (D.U \ D.V) = {e₀} + rw [hDU, hDV] + apply Subset.antisymm + · rintro C ⟨-, hsub, -, hmax⟩ + exact mem_singleton_iff.mpr (hmax e₀ Subset.rfl hpc hsub).symm + · rintro _ rfl + exact ⟨he₀_ne, Subset.rfl, hpc, fun C hC _ hsub => Subset.antisymm hC hsub⟩ + have he₀_D : e₀ ∈ D.E := by rw [hDE]; exact mem_singleton e₀ + have hcl_e₀ : closure e₀ = F := by + have hFc : IsClosed F := isCompact_range hj_cont |>.isClosed + apply Subset.antisymm (closure_minimal sdiff_subset hFc) + change F ⊆ closure e₀ + rw [hsd] + intro y hy + rw [← himg] at hy + obtain ⟨s, hs, rfl⟩ := hy + have hs_cl : s ∈ closure (Ioo 0 (2 * Real.pi)) := by + rw [closure_Ioo hpos.ne] + exact Ico_subset_Icc_self hs + exact map_mem_closure hp hs_cl fun t ht => ⟨t, ht, rfl⟩ + have htilde_e₀ : tilde e₀ = {v} := by + change closure e₀ \ e₀ = {v} + rw [hcl_e₀] + ext x + simp only [e₀, mem_sdiff, mem_singleton_iff] + exact ⟨fun ⟨hxF, h⟩ => not_not.mp fun hxv => h ⟨hxF, hxv⟩, + fun hxv => ⟨hxv ▸ hvF, fun ⟨_, hne⟩ => hne hxv⟩⟩ + have hmeet : H.G.U ∩ D.U ⊆ H.G.V ∩ D.V := + auxiliary_loop_meets_graph_at_vertices H hvV hU_sub_Bad hF_not_Bad D hDU hDV + let G' : Drawing S := H.G.glue D hmeet + have hG'_U : G'.U = H.G.U ∪ F := by + change H.G.U ∪ D.U = H.G.U ∪ F + rw [hDU] + have hG'_V : G'.V = H.G.V := by + change H.G.V ∪ D.V = H.G.V + rw [hDV, union_eq_left] + exact singleton_subset_iff.mpr hvV + have hG'_E : G'.E = insert e₀ H.G.E := by + change (H.G.glue D hmeet).E = insert e₀ H.G.E + rw [Drawing.glue_E, hDE, union_singleton] + have he₀_notMem : e₀ ∉ H.G.E := by + intro he₀H + obtain ⟨x₀, hx₀F, hx₀v⟩ := he₀_ne + have hx₀U : x₀ ∈ H.G.U := (he₀H.2.1 ⟨hx₀F, hx₀v⟩).1 + exact hF_not_Bad x₀ hx₀F (hU_sub_Bad ⟨hx₀U, hx₀v⟩) + let H' : SurfaceDigraph S := { + G := G' + plus := fun e => if e = e₀ then v else H.plus e + minus := fun e => if e = e₀ then v else H.minus e + plus_mem := by + intro e he + rw [hG'_V] + rw [hG'_E] at he + rcases mem_insert_iff.mp he with rfl | heH + · simp [hvV] + · rw [ite_eq_right (ne_of_mem_of_not_mem heH he₀_notMem)] + exact H.plus_mem e heH + minus_mem := by + intro e he + rw [hG'_V] + rw [hG'_E] at he + rcases mem_insert_iff.mp he with rfl | heH + · simp [hvV] + · rw [ite_eq_right (ne_of_mem_of_not_mem heH he₀_notMem)] + exact H.minus_mem e heH + ends_eq := by + intro e he + rw [hG'_E] at he + rcases mem_insert_iff.mp he with rfl | heH + · simp [htilde_e₀] + · have hne : e ≠ e₀ := ne_of_mem_of_not_mem heH he₀_notMem + rw [ite_eq_right hne, ite_eq_right hne] + exact H.ends_eq e heH + } + refine ⟨H', ?_, hG'_V, ?_, ?_, ?_, ?_⟩ + · change bd S ∩ G'.U ⊆ G'.V + rw [hG'_U, hG'_V] + rintro x ⟨hx_bd, hxU | hxF⟩ + · exact hH ⟨hx_bd, hxU⟩ + · exact (hF_not_Bad x hxF (Or.inl (Or.inl hx_bd))).elim + · change H.G.E ⊆ G'.E + rw [hG'_E] + exact subset_insert e₀ H.G.E + · intro e he + have hne : e ≠ e₀ := ne_of_mem_of_not_mem he he₀_notMem + exact ⟨ite_eq_right hne, ite_eq_right hne⟩ + · change G'.E.ncard = H.G.E.ncard + 1 + rw [hG'_E, ncard_insert_of_notMem he₀_notMem H.G.finite_edges] + · change {w ∈ G'.V \ bd S | IsIsolatedVertex G' w}.ncard + 1 = IsoSet.ncard + let IsoSet' : Set S := {w ∈ G'.V \ bd S | IsIsolatedVertex G' w} + have hIso_eq : IsoSet = insert v IsoSet' := by + ext w + simp only [IsoSet, IsoSet', mem_sdiff, mem_insert_iff] + constructor + · rintro ⟨⟨hwV, hw_bd⟩, hw_iso⟩ + by_cases hwv : w = v + · exact Or.inl hwv + · have hwV' : w ∈ G'.V := hG'_V.symm ▸ hwV + refine Or.inr ⟨⟨hwV', hw_bd⟩, hwV', fun e he hinc => ?_⟩ + rcases hinc with ⟨_, _, hw_cl⟩ + rw [hG'_E] at he + rcases mem_insert_iff.mp he with rfl | heH + · rw [hcl_e₀] at hw_cl + exact hF_not_Bad w hw_cl (Or.inl (Or.inr ⟨hwV, hwv⟩)) + · exact hw_iso.2 e heH ⟨hwV, Or.inl heH, hw_cl⟩ + · rintro (rfl | ⟨⟨hwV', hw_bd⟩, hw_iso'⟩) + · exact ⟨⟨hvV, hv_not_bd⟩, hiso⟩ + · have hwV : w ∈ H.G.V := hG'_V ▸ hwV' + refine ⟨⟨hwV, hw_bd⟩, hwV, fun e he hinc => ?_⟩ + rcases hinc with ⟨_, _, hw_cl⟩ + have he' : e ∈ G'.E := by rw [hG'_E]; exact mem_insert_of_mem e₀ he + exact hw_iso'.2 e he' ⟨hwV', Or.inl he', hw_cl⟩ + have hv_notMem_Iso' : v ∉ IsoSet' := by + rintro ⟨_, hv_iso'⟩ + have he₀_G' : e₀ ∈ G'.E := by rw [hG'_E]; exact mem_insert e₀ H.G.E + exact hv_iso'.2 e₀ he₀_G' ⟨hG'_V.symm ▸ hvV, Or.inl he₀_G', by rw [hcl_e₀]; exact hvF⟩ + have hIso'_fin : IsoSet'.Finite := hIso_fin.subset (hIso_eq ▸ subset_insert v IsoSet') + rw [hIso_eq, ncard_insert_of_notMem hv_notMem_Iso' hIso'_fin] + +/-! ## Proof of (9.1) -/ + +/-- General form of Graph Minors VII, (9.1) (pages 242–243), proved by induction on +`g = numInternalIsolatedVertices H.G` and calling `theorem_7_5_proof` in the base case `g = 0`. -/ +theorem theorem_9_1_general + (g : ℕ) : + ∀ {S : Type u} [TopologicalSpace S] [T1Space S], + IsSurface S → + ∀ a b c : ℕ, 3 ≤ 3 * a + 3 * b + c → Nonempty (S ≃ₜ SurfaceModel a b c) → + ∀ H : SurfaceDigraph S, H.IsProper → + numInternalIsolatedVertices H.G = g → + ∀ k c₀ : ℕ, + 2 * k ≥ 4 * H.G.E.ncard + 4 * g + (H.G.V ∩ bd S).ncard + 2 * c + 2 → + c₀ ≥ c + H.G.E.ncard + g + 1 → + ∀ G : SurfaceDigraph S, G.IsProper → + G.G.V ∩ bd S = H.G.V ∩ bd S → + IsBoundaryLinked G.G → + alpha G.G ≥ 42 * k * 5 ^ (g + H.G.E.ncard) * vModel a b c₀ k → + IsBoundaryRootedMinor H G := by + induction g with + | zero => + intro S _ _ hS a b c h3 he H hH hg0 k c₀ hk hc₀ G hG hbd_eq hBL halpha + have hk' : 2 * k ≥ 4 * H.G.E.ncard + (H.G.V ∩ bd S).ncard + 2 * c + 2 := by omega + have halpha' : alpha G.G ≥ 42 * k * 5 ^ H.G.E.ncard * vModel a b c₀ k := by + simpa using halpha + obtain ⟨S_r, tS_r, t1S_r, G_r, H', hS_r, he_r, hBL_r, halpha_r, hbd_card_r, hH'_forest, + hbd_eq_r, himp⟩ := + cutEdgesForestReduction hS a b c h3 he H hH hg0 k c₀ hk' G hbd_eq hBL halpha' + have h3_r : 3 ≤ 3 * a + 3 * b + (c + H.G.E.ncard) := by omega + have hv_mono : vModel a b (c + H.G.E.ncard + 1) k ≤ vModel a b c₀ k := + vModel_mono_c_le a b (by omega) k + have halpha_r' : 42 * k * vModel a b (c + H.G.E.ncard + 1) k ≤ alpha G_r := by + have hmul : + 42 * k * vModel a b (c + H.G.E.ncard + 1) k ≤ + 42 * k * vModel a b c₀ k := + Nat.mul_le_mul_left (42 * k) hv_mono + exact le_trans hmul halpha_r + have hFeas : @IsGFeasible S_r tS_r G_r H' := + @theorem_7_5_proof S_r tS_r t1S_r hS_r a b (c + H.G.E.ncard) h3_r he_r k G_r H' hBL_r + halpha_r' hbd_card_r hH'_forest hbd_eq_r + exact himp hFeas + | succ g ih => + intro S _ _ hS a b c h3 he H hH hg_succ k c₀ hk hc₀ G hG hbd_eq hBL halpha + have hg_pos : 0 < numInternalIsolatedVertices H.G := by omega + obtain ⟨H₁, hH₁_prop, hV₁, hE₁, hends₁, hE_card₁, hg_card₁⟩ := + addLoop_to_isolatedVertex hS H hH hg_pos + have hg₁ : numInternalIsolatedVertices H₁.G = g := by omega + have hk₁ : 2 * k ≥ 4 * H₁.G.E.ncard + 4 * g + (H₁.G.V ∩ bd S).ncard + 2 * c + 2 := by + rw [hV₁, hE_card₁] + omega + have hc₀₁ : c₀ ≥ c + H₁.G.E.ncard + g + 1 := by + rw [hE_card₁] + omega + have hbd_eq₁ : G.G.V ∩ bd S = H₁.G.V ∩ bd S := by + rw [hV₁, hbd_eq] + have hsum_eq : g + H₁.G.E.ncard = (g + 1) + H.G.E.ncard := by omega + have halpha₁ : alpha G.G ≥ 42 * k * 5 ^ (g + H₁.G.E.ncard) * vModel a b c₀ k := by + rw [hsum_eq] + exact halpha + have hMinor₁ : IsBoundaryRootedMinor H₁ G := + ih hS a b c h3 he H₁ hH₁_prop hg₁ k c₀ hk₁ hc₀₁ G hG hbd_eq₁ hBL halpha₁ + exact isBoundaryRootedMinor_of_edge_subdigraph hV₁ hE₁ hends₁ hMinor₁ + +/-- Graph Minors VII, (9.1) (pages 242–243): +"(9.1) *Let $\Sigma \cong \Sigma(a, b, c)$ where $3a + 3b + c \ge 3$. Let $(H, H^+, H^-)$ be a +proper digraph in $\Sigma$. Let $g$ be the number of isolated vertices of $H$ which are not in +$bd(\Sigma)$. Let $k$ be an integer with* +$$2k \ge 4|E(H)| + 4g + |V(H) \cap bd(\Sigma)| + 2c + 2$$ +*and let $c_0$ be an integer with $c_0 \ge c + |E(H)| + g + 1$. Let $(G, G^+, G^-)$ be a proper +digraph in $\Sigma$ such that* ... +(i) $V(G) \cap bd(\Sigma) = V(H) \cap bd(\Sigma)$, +(ii) $G$ *is boundary-linked, and* +(iii) $\alpha(G) \ge 42k 5^{(g+|E(H)|)} v(\Sigma(a, b, c_0), k)$. +*Then $(H, H^+, H^-)$ is a boundary-rooted minor of $(G, G^+, G^-)$.*" -/ +theorem theorem_9_1_proof + [T1Space S] (hS : IsSurface S) (a b c : ℕ) (h3 : 3 * a + 3 * b + c ≥ 3) + (he : Nonempty (S ≃ₜ SurfaceModel a b c)) + (H : SurfaceDigraph S) (hH : H.IsProper) + (k c₀ : ℕ) + (hk : 2 * k ≥ 4 * H.G.E.ncard + 4 * numInternalIsolatedVertices H.G + + (H.G.V ∩ bd S).ncard + 2 * c + 2) + (hc₀ : c₀ ≥ c + H.G.E.ncard + numInternalIsolatedVertices H.G + 1) + (G : SurfaceDigraph S) (hG : G.IsProper) + (hbd_eq : G.G.V ∩ bd S = H.G.V ∩ bd S) + (hBL : IsBoundaryLinked G.G) + (halpha : alpha G.G ≥ + 42 * k * 5 ^ (numInternalIsolatedVertices H.G + H.G.E.ncard) * vModel a b c₀ k) : + IsBoundaryRootedMinor H G := + theorem_9_1_general (numInternalIsolatedVertices H.G) hS a b c h3 he H hH rfl k c₀ + hk hc₀ G hG hbd_eq hBL halpha + +/-- Graph Minors VII, (9.1) for the interface `GM07Theorem91Statement`. -/ +theorem gm07_theorem_9_1 + : + GM07Theorem91Statement.{u} := by + intro S _ _ hS a b c h3 he H hH k c₀ _ hk hc₀ G hG hbd_eq hBL halpha + exact theorem_9_1_proof hS a b c h3 he H hH k c₀ hk hc₀ G hG hbd_eq hBL halpha + +/-! ## Proof of (9.2) from (9.1) -/ + +/-- On a surface with empty boundary `bd S = ∅`, every drawing `G` is proper. -/ +theorem isProper_of_bd_eq_empty (hbd : bd S = ∅) (G : Drawing S) : + G.IsProper := by + change bd S ∩ G.U ⊆ G.V + rw [hbd, empty_inter] + exact empty_subset G.V + +/-- On a surface with `cuffs S = ∅` and `bd S = ∅`, every drawing `G` is boundary-linked. -/ +theorem isBoundaryLinked_of_bd_eq_empty (hcuffs : cuffs S = ∅) (hbd : bd S = ∅) + (G : Drawing S) : + IsBoundaryLinked G := by + refine ⟨isProper_of_bd_eq_empty hbd G, ?_⟩ + intro C hC + rw [hcuffs] at hC + exact False.elim hC + +/-- Graph Minors VII, (9.2) (page 244): +"(9.2) *Let $\Sigma \cong \Sigma(a, b, 0)$ where $a + b \ge 1$, and let $(H, H^+, H^-)$ be a digraph +in $\Sigma$. Then there is a number $N$ such that $(H, H^+, H^-)$ is a minor of every digraph +$(G, G^+, G^-)$ in $\Sigma$ with $\alpha(G) \ge N$.*" +Proved directly from `theorem_9_1_proof` by setting `k = 2 * |E(H)| + 2 * g + 1`, +`c₀ = |E(H)| + g + 1`, and `N = 42 * k * 5 ^ (g + |E(H)|) * vModel a b c₀ k`. -/ +theorem theorem_9_2_proof + [T1Space S] (hS : IsSurface S) (a b : ℕ) (hab : a + b ≥ 1) + (he : Nonempty (S ≃ₜ SurfaceModel a b 0)) + (H : SurfaceDigraph S) : + ∃ N : ℕ, ∀ G : SurfaceDigraph S, alpha G.G ≥ N → IsDigraphMinor H G := by + obtain ⟨hcuffs, hbd⟩ := bd_eq_empty_of_homeomorph_surfaceModel_zero he + let g := numInternalIsolatedVertices H.G + let k := 2 * H.G.E.ncard + 2 * g + 1 + let c₀ := H.G.E.ncard + g + 1 + use 42 * k * 5 ^ (g + H.G.E.ncard) * vModel a b c₀ k + intro G halpha + refine ⟨hbd, ?_⟩ + have h3 : 3 * a + 3 * b + 0 ≥ 3 := by omega + have hH_prop : H.IsProper := isProper_of_bd_eq_empty hbd H.G + have hG_prop : G.IsProper := isProper_of_bd_eq_empty hbd G.G + have hBL : IsBoundaryLinked G.G := isBoundaryLinked_of_bd_eq_empty hcuffs hbd G.G + have hbd_eq : G.G.V ∩ bd S = H.G.V ∩ bd S := by rw [hbd, inter_empty, inter_empty] + have hbd_card : (H.G.V ∩ bd S).ncard = 0 := by rw [hbd, inter_empty, ncard_empty] + have hk : 2 * k ≥ 4 * H.G.E.ncard + 4 * g + (H.G.V ∩ bd S).ncard + 2 * 0 + 2 := by + rw [hbd_card] + dsimp [k] + omega + have hc₀ : c₀ ≥ 0 + H.G.E.ncard + g + 1 := by + dsimp [c₀] + omega + exact theorem_9_1_proof hS a b 0 h3 he H hH_prop k c₀ hk hc₀ G hG_prop hbd_eq hBL halpha + +/-- Graph Minors VII, (9.2) for `GM07Theorem92Statement`, proved directly from +`theorem_9_2_proof`. -/ +theorem gm07_theorem_9_2 + : + GM07Theorem92Statement.{u} := by + intro S _ _ hS a b hab he H + exact theorem_9_2_proof hS a b hab he H + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section9Cylinder.lean b/LeanPool/GraphMinor/GM07/Section9Cylinder.lean new file mode 100644 index 0000000000..51d13f1063 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section9Cylinder.lean @@ -0,0 +1,1966 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section9DiscSphere +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Section8 +import LeanPool.GraphMinor.GM07.CuffForest +import LeanPool.GraphMinor.Surface.DiscsInSurface +import LeanPool.GraphMinor.GM12.Section2ChordGap +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs +import LeanPool.GraphMinor.GM12.Section3NormalPuncturedPaths +import LeanPool.GraphMinor.GM12.Section3BoundaryLinked +import LeanPool.GraphMinor.GM12.Section3CandidateExistence +import LeanPool.GraphMinor.GM12.Section3Alpha +import LeanPool.GraphMinor.GM12.Section3NearPlanarCircle +import LeanPool.GraphMinor.GM12.Section3LoopCuffClassification +import LeanPool.GraphMinor.GM12.Section3ThetaSurrounding + +/-! +# Proof of Graph Minors VII, (9.3) (pages 244–245) + +This file proves the two claims about the punctured cylinder used for (9.3) +on pages 244–245: +- `lemma_9_3_obs`: every `G`-normal `[0, 1]`-arc `R` meeting `F_j` and `barI_j` (`j = 1, 2`) + contains at least `r` vertices of `G`. +- `lemma_9_3_claim_1`: Claim 1 ("$G$ is boundary-linked in $\Sigma'$", page 244). +- `lemma_9_3_claim_2`: Claim 2 ("As a drawing in $\Sigma'$, $G$ satisfies $\alpha(G) \ge r$", + page 245). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM12 + +universe u + +/-- If a preconnected set `s` is covered by two closed sets `A, B` and meets both `A` and `B`, then +`s` meets `A ∩ B`. -/ +theorem preconnected_inter_nonempty_of_closed_cover {X : Type*} [TopologicalSpace X] + {s A B : Set X} (hs : IsPreconnected s) (hA : IsClosed A) (hB : IsClosed B) + (hsub : s ⊆ A ∪ B) (ha : (s ∩ A).Nonempty) (hb : (s ∩ B).Nonempty) : + (s ∩ (A ∩ B)).Nonempty := by + by_contra h + rw [not_nonempty_iff_eq_empty] at h + obtain ⟨x, hx⟩ := ha + obtain ⟨y, hy⟩ := hb + have h1 : (s ∩ Bᶜ).Nonempty := ⟨x, hx.1, fun hxB => by + have : x ∈ s ∩ (A ∩ B) := ⟨hx.1, hx.2, hxB⟩ + rwa [h] at this⟩ + have h2 : (s ∩ Aᶜ).Nonempty := ⟨y, hy.1, fun hyA => by + have : y ∈ s ∩ (A ∩ B) := ⟨hy.1, hyA, hy.2⟩ + rwa [h] at this⟩ + have hcov : s ⊆ Bᶜ ∪ Aᶜ := fun z hz => by + by_contra hnz + rw [mem_union, mem_compl_iff, mem_compl_iff, not_or, not_not, not_not] at hnz + have : z ∈ s ∩ (A ∩ B) := ⟨hz, hnz.2, hnz.1⟩ + rwa [h] at this + obtain ⟨z, hz, hzB, hzA⟩ := hs Bᶜ Aᶜ hB.isOpen_compl hA.isOpen_compl hcov h1 h2 + rcases hsub hz with hzA' | hzB' + · exact hzA hzA' + · exact hzB hzB' + +/-- Every walk in a subdrawing `D` of `G` from a closed set `A` to a closed set `B` with +`A ∪ B = univ` and `A ∩ B ⊆ F` (where `F` is `G`-normal) contains a vertex in `D.V ∩ (G.V ∩ F)`. -/ +theorem walk_meets_of_closed_cover {S : Type u} [TopologicalSpace S] + {D G : Drawing S} (hsub : D.IsSubdrawing G) {F A B : Set S} + (hnorm : G.IsNormal F) (hA : IsClosed A) (hB : IsClosed B) + (hcov : A ∪ B = univ) (hAB : A ∩ B ⊆ F) + {u v : S} (W : GraphWalk D.toGraph u v) (hu : u ∈ A) (hv : v ∈ B) : + ∃ z ∈ D.V, z ∈ G.V ∩ F := by + induction W with + | @nil a ha => + exact ⟨a, ha, hsub.1 ha, hAB ⟨hu, hv⟩⟩ + | @cons a b c e hlink rest ih => + rcases (hcov ▸ mem_univ b : b ∈ A ∪ B) with hbA | hbB + · exact ih hbA hv + · have he : e ∈ D.E := hlink.1 + have ha_cl : a ∈ closure e := by + have hmem : a ∈ ({a, b} : Set S) := mem_insert a {b} + rw [← hlink.2.2.2] at hmem + exact hmem.1 + have hb_cl : b ∈ closure e := by + have hmem : b ∈ ({a, b} : Set S) := mem_insert_of_mem a rfl + rw [← hlink.2.2.2] at hmem + exact hmem.1 + have hpc : IsPreconnected (closure e) := by + rcases D.edge_cond e he with ⟨_, _, _, _, hL⟩ | ⟨_, _, hO⟩ + · exact (IsLineWithEnds.isConnected hL).2 + · exact hO.isPreconnected + obtain ⟨z, hze, hzAB⟩ := preconnected_inter_nonempty_of_closed_cover hpc hA hB + (fun x _ => hcov ▸ mem_univ x) ⟨a, ha_cl, hu⟩ ⟨b, hb_cl, hbB⟩ + have hzF : z ∈ F := hAB hzAB + have hzDU : z ∈ D.U := D.closure_subset_U he hze + have hzGU : z ∈ G.U := G.closure_subset_U (hsub.2 he) hze + have hzGV : z ∈ G.V := hnorm ⟨hzF, hzGU⟩ + have hzDV : z ∈ D.V := mem_V_of_subdrawing hsub hzDU hzGV + exact ⟨z, hzDV, hzGV, hzF⟩ + +/-- If `A` and `B` are closed sets covering `S` with `A ∩ B ⊆ F` for a `G`-normal set `F`, and +`X ⊆ A`, `Y ⊆ B`, then `maxDisjointPaths G X Y ≤ (G.V ∩ F).ncard`. -/ +theorem maxDisjointPaths_le_of_closed_cover {S : Type u} [TopologicalSpace S] + (G : Drawing S) {X Y F A B : Set S} + (hnorm : G.IsNormal F) (hA : IsClosed A) (hB : IsClosed B) + (hcov : A ∪ B = univ) (hAB : A ∩ B ⊆ F) (hX : X ⊆ A) (hY : Y ⊆ B) : + maxDisjointPaths G X Y ≤ (G.V ∩ F).ncard := by + classical + have hne : {k : ℕ | HasDisjointPathsBetween G X Y k}.Nonempty := + ⟨0, hasDisjointPathsBetween_zero G X Y⟩ + refine csSup_le hne fun k hk => ?_ + obtain ⟨P, s, t, hP, hdisj⟩ := hk + have hex : ∀ i : Fin k, ∃ z ∈ (P i).V, z ∈ G.V ∩ F := fun i => by + obtain ⟨hsub, hsX, htY, W, _, _, _⟩ := hP i + exact walk_meets_of_closed_cover hsub hnorm hA hB hcov hAB W (hX hsX) (hY htY) + choose z hzPV hzVF using hex + have hinj : Injective z := fun i j hij => by + by_contra hne + exact disjoint_left.mp (hdisj i j hne) (hzPV i) (hij ▸ hzPV j) + have hcard : (range z).ncard = k := by + rw [Set.ncard_range_of_injective hinj, Nat.card_fin] + rw [← hcard] + exact Set.ncard_le_ncard (range_subset_iff.mpr hzVF) (G.finite_V.inter_of_left F) + +private theorem inner_disc_lies_inside_outer_disc + {S : Type u} + {F₂ : Set S} + (Y : Type u) + [TopologicalSpace Y] + (j₁ : S → Y) + (E₁_Y : Set Y) + (hj₁F₂_in_E₁ : j₁ '' F₂ ⊆ discInt E₁_Y) + (E₂_Y : Set Y) + (hE₂_Y_sub : E₂_Y ⊆ E₁_Y) + (hE₂_Y_disj_bd : Disjoint (E₂_Y \ j₁ '' F₂) (discBd E₁_Y)) : + E₂_Y ⊆ discInt E₁_Y := by + intro y hy + by_cases hyF₂ : y ∈ j₁ '' F₂ + · exact hj₁F₂_in_E₁ hyF₂ + · exact ⟨hE₂_Y_sub hy, disjoint_left.mp hE₂_Y_disj_bd ⟨hy, hyF₂⟩⟩ + +private theorem first_cap_lies_inside_inner_disc + {S : Type u} + [TopologicalSpace S] + {C₁ : Set S} + {C₂ : Set S} + {F₂ : Set S} + (hbd₂ : Disjoint F₂ (bd S)) + [T2Space S] + [CompactSpace S] + (hbdS : bd S = C₁ ∪ C₂) + (hSurr₂ : SurroundsCuff F₂ C₁) + (Y : Type u) + [TopologicalSpace Y] + (j₁ : S → Y) + (D₁' : Set Y) + (hcap₁ : IsCappedCuff C₁ Y j₁ D₁') + (hY : IsSurface Y) + [T2Space Y] + (hj₁ : IsEmbedding j₁) + (E₂_Y : Set Y) + (hE₂_Y : IsClosedDisc E₂_Y) + (hbE₂_Y : discBd E₂_Y = j₁ '' F₂) : + D₁' ⊆ discInt E₂_Y := by + have hdis_int : Disjoint (discInt D₁') (discBd E₂_Y) := by + rw [hbE₂_Y, disjoint_left] + rintro y hyI ⟨x, hxF₂, rfl⟩ + have hj₁x : j₁ x ∈ range j₁ ∩ D₁' := ⟨mem_range_self x, hyI.1⟩ + rw [hcap₁.inter_eq, ← hcap₁.discBd_eq] at hj₁x + exact hyI.2 hj₁x + rcases hE₂_Y.side hY.2.2 hcap₁.isClosedDisc.isPreconnected_discInt hdis_int with hin | hout + · have hD₁'_sub : D₁' ⊆ E₂_Y := by + apply hcap₁.isClosedDisc.subset_closure_discInt.trans + rw [← hE₂_Y.isClosed.closure_eq] + exact closure_mono (hin.trans (discInt_subset E₂_Y)) + intro y hy + refine ⟨hD₁'_sub hy, ?_⟩ + rw [hbE₂_Y] + rintro ⟨x, hxF₂, rfl⟩ + have hj₁x : j₁ x ∈ range j₁ ∩ D₁' := ⟨mem_range_self x, hy⟩ + rw [hcap₁.inter_eq] at hj₁x + obtain ⟨c, hc, hcj⟩ := hj₁x + exact disjoint_left.mp hbd₂ hxF₂ (hbdS ▸ hj₁.injective hcj ▸ Or.inl hc) + · exfalso + have hE₂_range : E₂_Y ⊆ range j₁ := by + intro y hy + rcases hcap₁.union_eq ▸ mem_univ y with hyR | hyD + · exact hyR + · by_cases hyb : y ∈ discBd D₁' + · rw [hcap₁.discBd_eq] at hyb + exact image_subset_range _ _ hyb + · exact (disjoint_left.mp hout ⟨hyD, hyb⟩ hy).elim + have hplan₂ : IsPlanar F₂ := by + refine ⟨j₁ ⁻¹' E₂_Y, ?_, fun x hx => Surface.discBd_subset E₂_Y + (hbE₂_Y ▸ mem_image_of_mem j₁ hx)⟩ + have himg : j₁ '' (j₁ ⁻¹' E₂_Y) = E₂_Y := image_preimage_eq_of_subset hE₂_range + obtain ⟨φD⟩ := hE₂_Y + exact ⟨(φD.trans (Homeomorph.setCongr himg.symm)).trans + (hj₁.isEmbedding.homeomorphImage (j₁ ⁻¹' E₂_Y)).symm⟩ + exact hSurr₂.2.2 hplan₂ + +private theorem outer_disc_avoids_remaining_cuff + {S : Type u} + [TopologicalSpace S] + {C₁ : Set S} + {C₂ : Set S} + {F₁ : Set S} + (hbd₁ : Disjoint F₁ (bd S)) + (hbdS : bd S = C₁ ∪ C₂) + (Y : Type u) + [TopologicalSpace Y] + (j₁ : S → Y) + (hbdY' : bd Y = j₁ '' C₂) + (hj₁ : IsEmbedding j₁) + (hDiscY : IsClosedDisc (univ : Set Y)) + (hdiscBd_univ_Y : discBd (univ : Set Y) = bd Y) + (E₁_Y : Set Y) + (hE₁_Y : IsClosedDisc E₁_Y) + (hbE₁_Y : discBd E₁_Y = j₁ '' F₁) + (hj₁F₁_oarc : IsOArc (j₁ '' F₁)) : + Disjoint E₁_Y (bd Y) := by + obtain ⟨E₁_Y', ⟨-, hE₁_Y', hbE₁_Y', -, hE₁_Y'_disj_bd, -⟩, huniq⟩ := + disc_oArc univ (j₁ '' F₁) hDiscY (subset_univ _) hj₁F₁_oarc + have hE₁_eq : E₁_Y = E₁_Y' := huniq E₁_Y (subset_univ _) hE₁_Y hbE₁_Y + rw [← hdiscBd_univ_Y, disjoint_left] + intro y hyE₁ hybd + by_cases hyF₁ : y ∈ j₁ '' F₁ + · obtain ⟨x, hxF₁, rfl⟩ := hyF₁ + rw [hdiscBd_univ_Y, hbdY'] at hybd + obtain ⟨c, hc, hcj⟩ := hybd + exact disjoint_left.mp hbd₁ hxF₁ (hbdS ▸ hj₁.injective hcj ▸ Or.inr hc) + · exact disjoint_left.mp hE₁_Y'_disj_bd ⟨hE₁_eq ▸ hyE₁, hyF₁⟩ hybd + +private theorem cap_discs_and_embedding_cover + {S : Type u} + [TopologicalSpace S] + {C₁ : Set S} + {C₂ : Set S} + (Y : Type u) + [TopologicalSpace Y] + (j₁ : S → Y) + (D₁' : Set Y) + (hcap₁ : IsCappedCuff C₁ Y j₁ D₁') + (Z : Type u) + [TopologicalSpace Z] + (j₂ : Y → Z) + (D₂ : Set Z) + (hcap₂ : IsCappedCuff (j₁ '' C₂) Z j₂ D₂) : + let j : S → Z := j₂ ∘ j₁ + let D₁ : Set Z := j₂ '' D₁' + range j ∪ D₁ ∪ D₂ = univ := by + intro j D₁ + refine eq_univ_of_forall fun z => ?_ + rcases (hcap₂.union_eq ▸ mem_univ z : z ∈ range j₂ ∪ D₂) with ⟨y, rfl⟩ | hzD₂ + · rcases (hcap₁.union_eq ▸ mem_univ y : y ∈ range j₁ ∪ D₁') with ⟨c, rfl⟩ | hyD₁' + · exact Or.inl (Or.inl ⟨c, rfl⟩) + · exact Or.inl (Or.inr ⟨y, hyD₁', rfl⟩) + · exact Or.inr hzD₂ + +private theorem cylinder_range_is_disc_complement + {S : Type u} + {C₁ : Set S} + {C₂ : Set S} + (Z : Type u) + [TopologicalSpace Z] + (j : S → Z) + (D₁ D₂ : Set Z) + [T2Space Z] + (hCS_Z : IsClosedSurface Z) : + (discBd D₁ = j '' C₁) → + (discBd D₂ = j '' C₂) → + (range j ∪ D₁ ∪ D₂ = univ) → + (range j ∩ D₁ = j '' C₁) → + (range j ∩ D₂ = j '' C₂) → + (∀ (i : Fin 2), IsClosedDisc (![D₁, D₂] i)) → + (Pairwise fun i k => Disjoint (![D₁, D₂] i) (![D₁, D₂] k)) → + range j = discComplement ![D₁, D₂] := by + intro hbD₁_eq hbD₂_eq hunion hinter₁ hinter₂ hP₂ hP₂_disj + ext z + rw [mem_discComplement_iff hCS_Z ![D₁, D₂] hP₂ hP₂_disj] + constructor + · intro hz i hzi + fin_cases i + · have hzC₁ : z ∈ j '' C₁ := hinter₁ ▸ ⟨hz, hzi.1⟩ + exact hzi.2 (hbD₁_eq ▸ hzC₁) + · have hzC₂ : z ∈ j '' C₂ := hinter₂ ▸ ⟨hz, hzi.1⟩ + exact hzi.2 (hbD₂_eq ▸ hzC₂) + · intro hnot + rcases (hunion ▸ mem_univ z : z ∈ range j ∪ D₁ ∪ D₂) with (hzR | hzD₁) | hzD₂ + · exact hzR + · have hzb : z ∈ discBd D₁ := by + by_contra hnb + exact hnot 0 ⟨hzD₁, hnb⟩ + rw [hbD₁_eq] at hzb + exact image_subset_range _ _ hzb + · have hzb : z ∈ discBd D₂ := by + by_contra hnb + exact hnot 1 ⟨hzD₂, hnb⟩ + rw [hbD₂_eq] at hzb + exact image_subset_range _ _ hzb + +private theorem second_cap_lies_inside_outer_complement + (Y : Type u) + (E₁_Y : Set Y) + (Z : Type u) + [TopologicalSpace Z] + (j₂ : Y → Z) + (D₂ : Set Z) : + let E₁ : Set Z := j₂ '' E₁_Y + (Disjoint E₁ D₂) → + ∀ (E₁' : Set Z), + (discInt E₁' = (j₂ '' E₁_Y)ᶜ) → + D₂ ⊆ discInt E₁' := by + intro E₁ hE₁_disj_D₂ E₁' hE₁'_int + rw [hE₁'_int] + exact fun z hzD₂ hzE₁ => disjoint_left.mp hE₁_disj_D₂ hzE₁ hzD₂ + +private theorem disc_complements_reverse_containment + (Y : Type u) + (E₁_Y : Set Y) + (E₂_Y : Set Y) + (Z : Type u) + [TopologicalSpace Z] + (j₂ : Y → Z) : + let E₁ : Set Z := j₂ '' E₁_Y + let E₂ : Set Z := j₂ '' E₂_Y + (E₂ ⊆ discInt E₁) → + ∀ (E₁' : Set Z), + (E₁' = (discInt (j₂ '' E₁_Y))ᶜ) → + ∀ (E₂' : Set Z), + (discInt E₂' = (j₂ '' E₂_Y)ᶜ) → + E₁' ⊆ discInt E₂' := by + intro E₁ E₂ hE₂_in_E₁ E₁' hE₁'_compl E₂' hE₂'_int + rw [hE₁'_compl, hE₂'_int] + exact compl_subset_compl.mpr hE₂_in_E₁ + +/-- Capping both cuffs `C₁, C₂` of a cylinder `S : Type u` yields a sphere `Z : Type u` and nested +closed discs `D₁ ⊆ discInt E₂`, `E₂ ⊆ discInt E₁`, `Disjoint E₁ D₂` (with complementary closed discs +`E₁' = (discInt E₁)ᶜ` and `E₂' = (discInt E₂)ᶜ` satisfying `D₂ ⊆ discInt E₁'`, `E₁' ⊆ discInt E₂'`, +`Disjoint E₂' D₁`) bounded by `j '' C₁`, `j '' F₂`, `j '' F₁`, and `j '' C₂`. -/ +theorem exists_sphere_cap_and_nested_discs {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) (he : Nonempty (S ≃ₜ SurfaceModel 0 0 2)) + {C₁ C₂ F₁ F₂ : Set S} (hcuffs : cuffs S = {C₁, C₂}) (hne : C₁ ≠ C₂) + (hOrd : CylinderOArcsInOrder C₁ F₂ F₁ C₂) + (hInside₁₂ : ∀ x ∈ F₂, IsPointInsideSurroundingOArc C₁ F₁ x) + (hbd₁ : Disjoint F₁ (bd S)) (hbd₂ : Disjoint F₂ (bd S)) : + ∃ (Z : Type u) (_ : TopologicalSpace Z) (_ : Z ≃ₜ SurfaceModel 0 0 0) + (j : S → Z) (D₁ D₂ E₁ E₂ E₁' E₂' : Set Z), + IsClosedSurface Z ∧ IsSphere Z ∧ ConnectedSpace Z ∧ IsClosedEmbedding j ∧ + IsClosedDisc D₁ ∧ IsClosedDisc D₂ ∧ Disjoint D₁ D₂ ∧ + discBd D₁ = j '' C₁ ∧ discBd D₂ = j '' C₂ ∧ + range j ∪ D₁ ∪ D₂ = univ ∧ range j ∩ D₁ = j '' C₁ ∧ range j ∩ D₂ = j '' C₂ ∧ + range j = discComplement ![D₁, D₂] ∧ + IsClosedDisc E₁ ∧ discBd E₁ = j '' F₁ ∧ + IsClosedDisc E₂ ∧ discBd E₂ = j '' F₂ ∧ + IsClosedDisc E₁' ∧ discBd E₁' = j '' F₁ ∧ E₁' = (discInt E₁)ᶜ ∧ discInt E₁' = E₁ᶜ ∧ + IsClosedDisc E₂' ∧ discBd E₂' = j '' F₂ ∧ E₂' = (discInt E₂)ᶜ ∧ discInt E₂' = E₂ᶜ ∧ + D₁ ⊆ discInt E₂ ∧ E₂ ⊆ discInt E₁ ∧ Disjoint E₁ D₂ ∧ + D₂ ⊆ discInt E₁' ∧ E₁' ⊆ discInt E₂' ∧ Disjoint E₂' D₁ := by + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + obtain ⟨e₀⟩ := he + have : ConnectedSpace S := by + have := (isSurface_model 0 0 2).2 + exact e₀.symm.surjective.connectedSpace e₀.symm.continuous + have hC₁ : C₁ ∈ cuffs S := by rw [hcuffs]; simp + have hC₂ : C₂ ∈ cuffs S := by rw [hcuffs]; simp + have hdis : Disjoint C₁ C₂ := cuffs_disjoint hC₁ hC₂ hne + have hbdS : bd S = C₁ ∪ C₂ := by rw [← sUnion_cuffs, hcuffs, sUnion_pair] + have hO₁ : IsOArc F₁ := hOrd.2.2.2.1 + have hO₂ : IsOArc F₂ := hOrd.2.2.2.2.1 + have hDisj₁₂ : Disjoint F₁ F₂ := hOrd.2.2.2.2.2.1 + have hSurr₂ : SurroundsCuff F₂ C₁ := hOrd.2.2.2.2.2.2.2.2.1 + have hSurr₁ : SurroundsCuff F₁ C₁ := hOrd.2.2.2.2.2.2.2.2.2.1 + -- Step 1: Cap C₁ to obtain a closed disc Y + obtain ⟨Y, tY, j₁, D₁', hcap₁, hbdY⟩ := exists_cappedCuff hS hC₁ + obtain ⟨-, ⟨e₁⟩⟩ := cappedCuff_homeo_model hS ⟨e₀⟩ hC₁ hcap₁ + have hY : IsSurface Y := hcap₁.isSurface + have : T2Space Y := hY.2.1 + have : CompactSpace Y := hY.1 + have : ConnectedSpace Y := by + have := (isSurface_model 0 0 1).2 + exact e₁.symm.surjective.connectedSpace e₁.symm.continuous + have hbdY' : bd Y = j₁ '' C₂ := by + rw [hbdY, hbdS, union_sdiff_left, sdiff_eq_left.mpr hdis.symm] + have hj₁ := hcap₁.isEmbedding + have hj₁_ce : IsClosedEmbedding j₁ := hj₁.continuous.isClosedEmbedding hj₁.injective + obtain ⟨eD₀⟩ := nonempty_disc_homeo + have hDiscY : IsClosedDisc (univ : Set Y) := + ⟨eD₀.symm.trans (e₁.symm.trans (Homeomorph.Set.univ Y).symm)⟩ + have hdiscBd_univ_Y : discBd (univ : Set Y) = bd Y := by + simpa [discBd, Homeomorph.Set.univ] using image_bd_homeomorph (Homeomorph.Set.univ Y) + -- Step 2: Construct E₁_Y and E₂_Y in Y + obtain ⟨x₀, hx₀⟩ : F₂.Nonempty := hO₂.elim fun φ => ⟨(φ 1).1, (φ 1).2⟩ + have hx₀_in₁ : IsPointInsideNullOArc (j₁ '' F₁) (j₁ x₀) := + (hInside₁₂ x₀ hx₀).2.2.2 Y j₁ D₁' hcap₁ + obtain ⟨_, E₁_Y, hE₁_Y, hbE₁_Y, hj₁x₀_in⟩ := hx₀_in₁ + have hj₁F₁_oarc : IsOArc (j₁ '' F₁) := hbE₁_Y ▸ hE₁_Y.isOArc_discBd + have hj₁F₂_oarc : IsOArc (j₁ '' F₂) := ⟨(Classical.choice hO₂).trans (hj₁.homeomorphImage F₂)⟩ + have hj₁_disj₁₂ : Disjoint (j₁ '' F₂) (j₁ '' F₁) := + (disjoint_image_iff hj₁.injective).mpr hDisj₁₂.symm + have hj₁F₂_in_E₁ : j₁ '' F₂ ⊆ discInt E₁_Y := by + rcases hE₁_Y.side hY.2.2 hj₁F₂_oarc.isPreconnected (hbE₁_Y.symm ▸ hj₁_disj₁₂) with hin | hout + · exact hin + · exact (disjoint_left.mp hout (mem_image_of_mem j₁ hx₀) hj₁x₀_in.1).elim + obtain ⟨E₂_Y, ⟨hE₂_Y_sub, hE₂_Y, hbE₂_Y, -, hE₂_Y_disj_bd, -⟩, -⟩ := + disc_oArc E₁_Y (j₁ '' F₂) hE₁_Y (hj₁F₂_in_E₁.trans (discInt_subset E₁_Y)) hj₁F₂_oarc + have hE₂_Y_in_E₁ : E₂_Y ⊆ discInt E₁_Y := by + exact inner_disc_lies_inside_outer_disc (S := S) (F₂ := F₂) Y j₁ E₁_Y hj₁F₂_in_E₁ E₂_Y + hE₂_Y_sub hE₂_Y_disj_bd + -- D₁' ⊆ discInt E₂_Y + have hD₁'_in_E₂ : D₁' ⊆ discInt E₂_Y := by + exact first_cap_lies_inside_inner_disc (S := S) (C₁ := C₁) (C₂ := C₂) (F₂ := F₂) hbd₂ hbdS + hSurr₂ Y j₁ D₁' hcap₁ hY hj₁ E₂_Y hE₂_Y hbE₂_Y + -- E₁_Y is disjoint from bd Y + have hE₁_Y_disj_bdY : Disjoint E₁_Y (bd Y) := by + exact outer_disc_avoids_remaining_cuff (S := S) (C₁ := C₁) (C₂ := C₂) (F₁ := F₁) hbd₁ hbdS Y + j₁ hbdY' hj₁ hDiscY hdiscBd_univ_Y E₁_Y hE₁_Y hbE₁_Y hj₁F₁_oarc + -- Step 3: Cap bd Y = j₁ '' C₂ to obtain a sphere Z : Type u + have hC₂Y : j₁ '' C₂ ∈ cuffs Y := by + obtain ⟨x, hx, hxe⟩ := hC₂ + have hp : IsPreconnected C₂ := hxe ▸ isPreconnected_connectedComponentIn + have hxC : x ∈ C₂ := hxe ▸ mem_connectedComponentIn hx + have hbp : IsPreconnected (bd Y) := hbdY' ▸ hp.image _ hj₁.continuous.continuousOn + have hy : j₁ x ∈ bd Y := hbdY' ▸ mem_image_of_mem _ hxC + refine ⟨j₁ x, hy, ?_⟩ + rw [hbp.connectedComponentIn hy, hbdY'] + obtain ⟨Z, tZ, j₂, D₂, hcap₂, hbdZ⟩ := exists_cappedCuff hY hC₂Y + obtain ⟨-, ⟨e₂⟩⟩ := cappedCuff_homeo_model hY ⟨e₁⟩ hC₂Y hcap₂ + have hZ : IsSurface Z := hcap₂.isSurface + have : T2Space Z := hZ.2.1 + have : CompactSpace Z := hZ.1 + obtain ⟨s₀⟩ := isSphere_model_zero + have hSphZ : IsSphere Z := ⟨e₂.trans s₀⟩ + obtain ⟨_, hCS_Z, hconnZ, _⟩ := closedSurface_and_connected_of_isSphere hZ hSphZ + have : ConnectedSpace Z := hconnZ + have hj₂ := hcap₂.isEmbedding + let j : S → Z := j₂ ∘ j₁ + have hjc : Continuous j := hj₂.continuous.comp hj₁.continuous + have hji : Injective j := hj₂.injective.comp hj₁.injective + have hj : IsClosedEmbedding j := hjc.isClosedEmbedding hji + let D₁ : Set Z := j₂ '' D₁' + obtain ⟨hD₁, hbD₁⟩ := isClosedDisc_image hcap₁.isClosedDisc hj₂.continuous.continuousOn + hj₂.injective.injOn + have hD₂ : IsClosedDisc D₂ := hcap₂.isClosedDisc + have hbD₁_eq : discBd D₁ = j '' C₁ := by + rw [hbD₁, hcap₁.discBd_eq, image_image] + rfl + have hbD₂_eq : discBd D₂ = j '' C₂ := by + rw [hcap₂.discBd_eq, image_image] + rfl + have hm₁ : ∀ {y}, y ∈ D₁' → ∀ c, j₁ c = y → c ∈ C₁ := fun {y} hy c hc => by + have h3 : y ∈ range j₁ ∩ D₁' := ⟨⟨c, hc⟩, hy⟩ + rw [hcap₁.inter_eq] at h3 + obtain ⟨c', hc', he⟩ := h3 + exact hj₁.injective (he.trans hc.symm) ▸ hc' + have hm₂ : ∀ {y}, j₂ y ∈ D₂ → ∃ c ∈ C₂, j₁ c = y := fun {y} hy => by + have h3 : j₂ y ∈ range j₂ ∩ D₂ := ⟨⟨y, rfl⟩, hy⟩ + rw [hcap₂.inter_eq] at h3 + obtain ⟨y', ⟨c, hc, rfl⟩, he⟩ := h3 + exact ⟨c, hc, hj₂.injective he⟩ + have hD₁D₂_disj : Disjoint D₁ D₂ := by + refine disjoint_left.mpr ?_ + rintro _ ⟨y, hy, rfl⟩ hz + obtain ⟨c, hc, rfl⟩ := hm₂ hz + exact disjoint_left.mp hdis (hm₁ hy c rfl) hc + have hunion : range j ∪ D₁ ∪ D₂ = univ := by + exact cap_discs_and_embedding_cover (S := S) (C₁ := C₁) (C₂ := C₂) Y j₁ D₁' hcap₁ Z j₂ D₂ + hcap₂ + have hinter₁ : range j ∩ D₁ = j '' C₁ := by + ext z + constructor + · rintro ⟨⟨c, rfl⟩, y, hy, he⟩ + exact ⟨c, hm₁ hy c (hj₂.injective he).symm, rfl⟩ + · rintro ⟨c, hc, rfl⟩ + refine ⟨mem_range_self c, j₁ c, ?_, rfl⟩ + have h3 : j₁ c ∈ range j₁ ∩ D₁' := by + rw [hcap₁.inter_eq] + exact ⟨c, hc, rfl⟩ + exact h3.2 + have hinter₂ : range j ∩ D₂ = j '' C₂ := by + ext z + constructor + · rintro ⟨⟨c, rfl⟩, hz⟩ + obtain ⟨c', hc', he'⟩ := hm₂ hz + exact ⟨c, hj₁.injective he' ▸ hc', rfl⟩ + · rintro ⟨c, hc, rfl⟩ + refine ⟨mem_range_self c, ?_⟩ + have h3 : j₂ (j₁ c) ∈ range j₂ ∩ D₂ := by + rw [hcap₂.inter_eq] + exact ⟨_, ⟨c, hc, rfl⟩, rfl⟩ + exact h3.2 + have hP₂ : ∀ i : Fin 2, IsClosedDisc (![D₁, D₂] i) := fun i => by + fin_cases i + · exact hD₁ + · exact hD₂ + have hP₂_disj : Pairwise (fun i k : Fin 2 => Disjoint (![D₁, D₂] i) (![D₁, D₂] k)) := fun i k hik + => by + fin_cases i <;> fin_cases k + · exact (hik rfl).elim + · exact hD₁D₂_disj + · exact hD₁D₂_disj.symm + · exact (hik rfl).elim + have hrange_eq : range j = discComplement ![D₁, D₂] := by + exact cylinder_range_is_disc_complement (S := S) (C₁ := C₁) (C₂ := C₂) Z j D₁ D₂ hCS_Z hbD₁_eq + hbD₂_eq hunion hinter₁ hinter₂ hP₂ hP₂_disj + -- Step 4: Push E₁_Y and E₂_Y to Z and take complementary discs E₁', E₂' + let E₁ : Set Z := j₂ '' E₁_Y + let E₂ : Set Z := j₂ '' E₂_Y + obtain ⟨hE₁, hbE₁⟩ := isClosedDisc_image hE₁_Y hj₂.continuous.continuousOn hj₂.injective.injOn + obtain ⟨hE₂, hbE₂⟩ := isClosedDisc_image hE₂_Y hj₂.continuous.continuousOn hj₂.injective.injOn + have hbE₁_eq : discBd E₁ = j '' F₁ := by + rw [hbE₁, hbE₁_Y, image_image] + rfl + have hbE₂_eq : discBd E₂ = j '' F₂ := by + rw [hbE₂, hbE₂_Y, image_image] + rfl + have hD₁_in_E₂ : D₁ ⊆ discInt E₂ := by + rintro _ ⟨y, hyD₁', rfl⟩ + have hy_in := hD₁'_in_E₂ hyD₁' + refine ⟨⟨y, hy_in.1, rfl⟩, ?_⟩ + rw [hbE₂] + rintro ⟨y', hy', heq⟩ + exact hy_in.2 (hj₂.injective heq ▸ hy') + have hE₂_in_E₁ : E₂ ⊆ discInt E₁ := by + rintro _ ⟨y, hyE₂, rfl⟩ + have hy_in := hE₂_Y_in_E₁ hyE₂ + refine ⟨⟨y, hy_in.1, rfl⟩, ?_⟩ + rw [hbE₁] + rintro ⟨y', hy', heq⟩ + exact hy_in.2 (hj₂.injective heq ▸ hy') + have hE₁_disj_D₂ : Disjoint E₁ D₂ := by + rw [disjoint_left] + rintro _ ⟨y, hyE₁, rfl⟩ hzD₂ + have hj₂y : j₂ y ∈ range j₂ ∩ D₂ := ⟨mem_range_self y, hzD₂⟩ + rw [hcap₂.inter_eq, ← hbdY'] at hj₂y + obtain ⟨y', hy'bd, heq⟩ := hj₂y + exact disjoint_left.mp hE₁_Y_disj_bdY hyE₁ (hj₂.injective heq ▸ hy'bd) + obtain ⟨E₁', hE₁', hbE₁'_eq, hE₁'_compl, hE₁'_int⟩ := exists_compl_disc_in_sphere hSphZ hE₁ + rw [hbE₁_eq] at hbE₁'_eq + obtain ⟨E₂', hE₂', hbE₂'_eq, hE₂'_compl, hE₂'_int⟩ := exists_compl_disc_in_sphere hSphZ hE₂ + rw [hbE₂_eq] at hbE₂'_eq + have hD₂_in_E₁' : D₂ ⊆ discInt E₁' := by + exact second_cap_lies_inside_outer_complement Y E₁_Y Z j₂ D₂ hE₁_disj_D₂ E₁' hE₁'_int + have hE₁'_in_E₂' : E₁' ⊆ discInt E₂' := by + exact disc_complements_reverse_containment Y E₁_Y E₂_Y Z j₂ hE₂_in_E₁ E₁' hE₁'_compl E₂' + hE₂'_int + have hE₂'_disj_D₁ : Disjoint E₂' D₁ := by + rw [hE₂'_compl, disjoint_compl_left_iff_subset] + exact hD₁_in_E₂ + exact ⟨Z, tZ, e₂, j, D₁, D₂, E₁, E₂, E₁', E₂', hCS_Z, hSphZ, hconnZ, hj, hD₁, hD₂, hD₁D₂_disj, + hbD₁_eq, hbD₂_eq, hunion, hinter₁, hinter₂, hrange_eq, hE₁, hbE₁_eq, hE₂, hbE₂_eq, + hE₁', hbE₁'_eq, hE₁'_compl, hE₁'_int, hE₂', hbE₂'_eq, hE₂'_compl, hE₂'_int, + hD₁_in_E₂, hE₂_in_E₁, hE₁_disj_D₂, hD₂_in_E₁', hE₁'_in_E₂', hE₂'_disj_D₁⟩ + +/-- Every `[0, 1]`-arc with ends (`IsLineWithEnds`) is a `[0, 1]`-arc (`IsLine`). -/ +theorem IsLineWithEnds.isLine {S : Type*} [TopologicalSpace S] {L : Set S} {u v : S} + (hL : IsLineWithEnds L u v) : IsLine L := by + obtain ⟨f, _, _⟩ := hL + exact ⟨f⟩ + +/-- Every `[0, 1]`-arc (`IsLine`) in a space is path-connected. -/ +theorem IsLine.isPathConnected {S : Type*} [TopologicalSpace S] {L : Set S} (hL : IsLine L) : + IsPathConnected L := by + obtain ⟨f⟩ := hL + have hI : IsPathConnected (univ : Set unitInterval) := isPathConnected_univ + have himg : (Subtype.val ∘ f) '' univ = L := by + ext x + constructor + · rintro ⟨t, _, rfl⟩ + exact (f t).2 + · intro hx + exact ⟨f.symm ⟨x, hx⟩, mem_univ _, congrArg Subtype.val (f.apply_symm_apply ⟨x, hx⟩)⟩ + rw [← himg] + exact hI.image (continuous_subtype_val.comp f.continuous) + +/-- Every closed disc in a topological space is preconnected. -/ +theorem _root_.GraphMinor.Surface.IsClosedDisc.isPreconnected {X : Type*} [TopologicalSpace X] {D : + Set X} + (hD : IsClosedDisc D) : IsPreconnected D := + IsPreconnected.subset_closure hD.isPreconnected_discInt (discInt_subset D) + hD.subset_closure_discInt + +private theorem minimal_line_meets_boundaries_at_ends + {S : Type u} + [TopologicalSpace S] + {F₁ : Set S} + {F₂ : Set S} + (hDisj : Disjoint F₁ F₂) + (g₁ : unitInterval → S) : + ∀ (a : ↑unitInterval), + ∀ (b : ↑unitInterval), + (g₁ a ∈ F₂) → + (g₁ b ∈ F₁) → + let I : Set S := g₁ '' Icc a b + let u : S := g₁ a + let v : S := g₁ b + (Disjoint (I \ {u, v}) (F₁ ∪ F₂)) → + ∀ (f : ↑unitInterval ≃ₜ ↑I), + (↑(f 0) = u) → + (↑(f 1) = v) → + let g : ↑unitInterval → S := fun t => ↑(f t) + (Injective g) → + (∀ t : unitInterval, g t ∈ F₁ ↔ t = 1) ∧ + (∀ t : unitInterval, g t ∈ F₂ ↔ t = 0) := by + intro a b haF₂ hbF₁ I u v hI_disj f hf0 hf1 g hg_inj + have interior_misses {t : unitInterval} (ht0 : t ≠ 0) (ht1 : t ≠ 1) : + g t ∉ F₁ ∪ F₂ := by + have hEnds : g t ∉ ({u, v} : Set S) := by + rintro (hgu | hgv) + · exact ht0 (hg_inj (hgu.trans hf0.symm)) + · exact ht1 (hg_inj (hgv.trans hf1.symm)) + exact disjoint_left.mp hI_disj ⟨(f t).2, hEnds⟩ + constructor + · intro t + constructor + · intro ht + by_contra ht1 + have ht0 : t ≠ 0 := by + rintro rfl + exact disjoint_left.mp hDisj ht (show (f 0).1 ∈ F₂ from hf0.symm ▸ haF₂) + exact interior_misses ht0 ht1 (Or.inl ht) + · rintro rfl + change (f 1).1 ∈ F₁ + rwa [hf1] + · intro t + constructor + · intro ht + by_contra ht0 + have ht1 : t ≠ 1 := by + rintro rfl + exact disjoint_left.mp hDisj (show (f 1).1 ∈ F₁ from hf1.symm ▸ hbF₁) ht + exact interior_misses ht0 ht1 (Or.inr ht) + · rintro rfl + change (f 0).1 ∈ F₂ + rwa [hf0] + +private theorem parametrization_maps_vertex_times_to_vertices + {S : Type u} + [TopologicalSpace S] + (G : Drawing S) + (I : Set S) + (g : ↑unitInterval → S) + (hg_range : range g = I) : + let T_V : Set ↑unitInterval := g ⁻¹' G.V + g '' T_V = G.V ∩ I := by + intro T_V + ext x + constructor + · rintro ⟨t, ht, rfl⟩ + exact ⟨ht, hg_range ▸ mem_range_self t⟩ + · rintro ⟨hxV, hxI⟩ + rw [← hg_range] at hxI + obtain ⟨t, rfl⟩ := hxI + exact ⟨t, hxV, rfl⟩ + +private theorem vertex_time_before_split_iff_index_lt {m r : ℕ} (hr : 1 ≤ r) + (hm : r < m) (emb : Fin m ↪o unitInterval) (t₀ : unitInterval) + (ha : emb ⟨r - 1, by omega⟩ < t₀) (hb : t₀ < emb ⟨r, hm⟩) : + ∀ i : Fin m, emb i ≤ t₀ ↔ i.val < r := by + intro i + constructor + · intro hle + by_contra hge + have hi : (⟨r, hm⟩ : Fin m) ≤ i := by + change r ≤ i.val + omega + exact (not_le_of_gt hb) ((emb.monotone hi).trans hle) + · intro hlt + have hi : i ≤ (⟨r - 1, by omega⟩ : Fin m) := by + change i.val ≤ r - 1 + omega + exact (emb.monotone hi).trans ha.le + +private theorem split_time_is_between_vertices {m r : ℕ} (hr : 1 ≤ r) + (hm : r < m) (emb : Fin m ↪o unitInterval) (t₀ : unitInterval) + (ha : emb ⟨r - 1, by omega⟩ < t₀) (hb : t₀ < emb ⟨r, hm⟩) : + t₀ ∉ range emb := by + rintro ⟨i, hi⟩ + by_cases hir : i.val < r + · have hle : i ≤ (⟨r - 1, by omega⟩ : Fin m) := by + change i.val ≤ r - 1 + omega + exact (lt_of_le_of_lt (emb.monotone hle) ha).ne hi + · have hle : (⟨r, hm⟩ : Fin m) ≤ i := by + change r ≤ i.val + omega + exact (lt_of_lt_of_le hb (emb.monotone hle)).ne' hi + +private theorem line_halves_cover_line + {S : Type u} + (I : Set S) + (g : ↑unitInterval → S) + (hg_range : range g = I) + (t₀ : ↑unitInterval) : + let barI₁ : Set S := g '' Icc 0 t₀ + let barI₂ : Set S := g '' Icc t₀ 1 + barI₁ ∪ barI₂ = I := by + intro barI₁ barI₂ + rw [← hg_range, ← image_union] + ext x + constructor + · rintro ⟨t, _, rfl⟩ + exact mem_range_self t + · rintro ⟨t, rfl⟩ + rcases le_total t t₀ with hle | hge + · exact ⟨t, Or.inl ⟨t.2.1, hle⟩, rfl⟩ + · exact ⟨t, Or.inr ⟨hge, t.2.2⟩, rfl⟩ + +private theorem upper_vertex_times_biject_later_indices {m r : ℕ} (hrm : r ≤ m) + (T_V : Set unitInterval) (emb : Fin m ↪o unitInterval) + (hemb_mem : ∀ i, emb i ∈ T_V) (hemb_range : range emb = T_V) + (t₀ : unitInterval) (hemb_le_t₀_iff : ∀ i : Fin m, emb i ≤ t₀ ↔ i.val < r) + (ht₀_notMem_TV : t₀ ∉ T_V) (φ₂ : Fin (m - r) → ↥(T_V ∩ Ici t₀)) + (hφ₂ : ∀ j, (φ₂ j).val = emb ⟨r + j.val, by omega⟩) : Bijective φ₂ := by + refine ⟨fun j₁ j₂ h => ?_, fun ⟨t, htV, ht_ge⟩ => ?_⟩ + · have hval : (φ₂ j₁).val = (φ₂ j₂).val := congrArg Subtype.val h + rw [hφ₂, hφ₂] at hval + have heq : r + j₁.val = r + j₂.val := Fin.mk.inj (emb.injective hval) + exact Fin.ext (by omega) + · rw [← hemb_range] at htV + obtain ⟨i, rfl⟩ := htV + have hir : ¬ (i.val < r) := fun hlt => by + have hle : emb i ≤ t₀ := (hemb_le_t₀_iff i).mpr hlt + exact ht₀_notMem_TV (le_antisymm hle ht_ge ▸ hemb_mem i) + have hidx : (⟨r + (i.val - r), by omega⟩ : Fin m) = i := Fin.ext (by dsimp; omega) + refine ⟨⟨i.val - r, by omega⟩, Subtype.ext ?_⟩ + rw [hφ₂] + exact congrArg emb hidx + +/-- In the proof of (9.3) (page 244): +"Choose a $G$-normal $[0, 1]$-arc $I$ with $I \cap F_1 \ne \emptyset \ne I \cap F_2$ and with +$|V(G) \cap I|$ minimum. Choose $z \in I - U(G)$ such that the two components of $I - \{z\}$ both +contain at least $r$ vertices.. Let $I_1, I_2$ be the two components of $I - \{z\}$, numbered so +that $I_j$ meets $F_{3-j} \ (j = 1, 2)$." -/ +theorem exists_minimal_line_and_split {S : Type u} [TopologicalSpace S] [T2Space S] + (G : Drawing S) {F₁ F₂ : Set S} (hO₁ : IsOArc F₁) (hO₂ : IsOArc F₂) (hDisj : Disjoint F₁ F₂) + {r : ℕ} (hr : 1 ≤ r) + (hex : ∃ F : Set S, G.IsNormal F ∧ IsLine F ∧ (F ∩ F₁).Nonempty ∧ (F ∩ F₂).Nonempty) + (hLine : ∀ F : Set S, G.IsNormal F → IsLine F → (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → + 2 * r ≤ (G.V ∩ F).ncard) : + ∃ (I barI₁ barI₂ : Set S) (u v z : S) (m : ℕ), + IsLineWithEnds I u v ∧ u ∈ F₂ ∧ v ∈ F₁ ∧ + Disjoint (I \ {u, v}) (F₁ ∪ F₂) ∧ + G.IsNormal I ∧ G.IsNormal barI₁ ∧ G.IsNormal barI₂ ∧ + IsLineWithEnds barI₁ u z ∧ IsLineWithEnds barI₂ z v ∧ + barI₁ ⊆ I ∧ barI₂ ⊆ I ∧ barI₁ ∪ barI₂ = I ∧ + z ∈ I \ (G.U ∪ {u, v}) ∧ + u ∈ barI₁ ∩ F₂ ∧ Disjoint barI₁ F₁ ∧ + v ∈ barI₂ ∩ F₁ ∧ Disjoint barI₂ F₂ ∧ + 2 * r ≤ m ∧ + (G.V ∩ I).ncard = m ∧ (G.V ∩ barI₁).ncard = r ∧ (G.V ∩ barI₂).ncard = m - r ∧ + (∀ F : Set S, G.IsNormal F → IsLine F → (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → + m ≤ (G.V ∩ F).ncard) := by + classical + let S_lines : Set ℕ := + {n : ℕ | ∃ F : Set S, G.IsNormal F ∧ IsLine F ∧ (F ∩ F₁).Nonempty ∧ (F ∩ F₂).Nonempty ∧ + (G.V ∩ F).ncard = n} + have hS_ne : S_lines.Nonempty := by + obtain ⟨F, hFn, hFl, hF1, hF2⟩ := hex + exact ⟨(G.V ∩ F).ncard, F, hFn, hFl, hF1, hF2, rfl⟩ + let m : ℕ := sInf S_lines + obtain ⟨I₀, hI₀_norm, hI₀_line, ⟨v₀, hv₀I₀, hv₀F₁⟩, ⟨u₀, hu₀I₀, hu₀F₂⟩, hm_eq⟩ := + Nat.sInf_mem hS_ne + have hmin : ∀ F : Set S, G.IsNormal F → IsLine F → (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → + m ≤ (G.V ∩ F).ncard := fun F hFn hFl h1 h2 => + Nat.sInf_le ⟨F, hFn, hFl, h1, h2, rfl⟩ + have h2r : 2 * r ≤ m := by + change 2 * r ≤ sInf S_lines + rw [← hm_eq] + exact hLine I₀ hI₀_norm hI₀_line ⟨v₀, hv₀I₀, hv₀F₁⟩ ⟨u₀, hu₀I₀, hu₀F₂⟩ + have hu₀v₀_ne : u₀ ≠ v₀ := fun heq => disjoint_left.mp hDisj hv₀F₁ (heq ▸ hu₀F₂) + have hjI₀ : JoinedIn I₀ u₀ v₀ := (IsLine.isPathConnected hI₀_line).joinedIn u₀ hu₀I₀ v₀ hv₀I₀ + obtain ⟨I₁, hI₁_sub, f₁, hf₁0, hf₁1⟩ := + (joinedIn_iff_eq_or_exists_isLineWithEnds hu₀I₀ hv₀I₀).mp hjI₀ |>.resolve_left hu₀v₀_ne + let g₁ : unitInterval → S := fun t => (f₁ t).1 + have hg₁_cont : Continuous g₁ := continuous_subtype_val.comp f₁.continuous + have hg₁_inj : Injective g₁ := fun a b h => f₁.injective (Subtype.ext h) + have hF₂_cl : IsClosed (g₁ ⁻¹' F₂) := (IsOArc.isSolid hO₂).2.preimage hg₁_cont + have hF₁_cl : IsClosed (g₁ ⁻¹' F₁) := (IsOArc.isSolid hO₁).2.preimage hg₁_cont + have h0F₂ : g₁ 0 ∈ F₂ := by + change (f₁ 0).1 ∈ F₂ + rwa [hf₁0] + have h1F₁ : g₁ 1 ∈ F₁ := by + change (f₁ 1).1 ∈ F₁ + rwa [hf₁1] + obtain ⟨a, b, hab, haF₂, hbF₁, hgap⟩ := + exists_parameter_gap hF₂_cl hF₁_cl hDisj.symm h0F₂ h1F₁ + let I : Set S := g₁ '' Icc a b + let u : S := g₁ a + let v : S := g₁ b + have hI_ends : IsLineWithEnds I u v := isLine_piece hg₁_cont hg₁_inj hab + have hI_sub : I ⊆ I₀ := (image_subset_range g₁ _).trans (by + rintro _ ⟨t, rfl⟩ + exact hI₁_sub (f₁ t).2) + have hI_norm : G.IsNormal I := fun x hx => hI₀_norm ⟨hI_sub hx.1, hx.2⟩ + have hI_line : IsLine I := IsLineWithEnds.isLine hI_ends + have huI : u ∈ I := ⟨a, left_mem_Icc.mpr hab.le, rfl⟩ + have hvI : v ∈ I := ⟨b, right_mem_Icc.mpr hab.le, rfl⟩ + have hI_disj : Disjoint (I \ {u, v}) (F₁ ∪ F₂) := by + rw [disjoint_left] + rintro _ ⟨⟨t, ht, rfl⟩, hnot_uv⟩ htF + have hta : a < t := lt_of_le_of_ne ht.1 (fun heq => hnot_uv (Or.inl (congrArg g₁ heq.symm))) + have htb : t < b := lt_of_le_of_ne ht.2 (fun heq => hnot_uv (Or.inr (congrArg g₁ heq))) + exact hgap t ⟨hta, htb⟩ (union_comm F₁ F₂ ▸ htF) + have hI_ncard : (G.V ∩ I).ncard = m := by + apply le_antisymm + · change (G.V ∩ I).ncard ≤ sInf S_lines + rw [← hm_eq] + exact Set.ncard_le_ncard (inter_subset_inter_right G.V hI_sub) (G.finite_V.inter_of_left I₀) + · exact hmin I hI_norm hI_line ⟨v, hvI, hbF₁⟩ ⟨u, huI, haF₂⟩ + -- Parameterize I by f : unitInterval ≃ₜ I + obtain ⟨f, hf0, hf1⟩ := id hI_ends + let g : unitInterval → S := fun t => (f t).1 + have hg_cont : Continuous g := continuous_subtype_val.comp f.continuous + have hg_inj : Injective g := fun s t h => f.injective (Subtype.ext h) + have hg_range : range g = I := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (f t).2 + · intro hx + exact ⟨f.symm ⟨x, hx⟩, congrArg Subtype.val (f.apply_symm_apply ⟨x, hx⟩)⟩ + obtain ⟨hg_F₁_iff, hg_F₂_iff⟩ := + minimal_line_meets_boundaries_at_ends hDisj g₁ a b haF₂ hbF₁ hI_disj f hf0 hf1 hg_inj + -- Order the m vertices of G on I along unitInterval + let T_V : Set unitInterval := g ⁻¹' G.V + have hTV_fin : T_V.Finite := G.finite_V.preimage hg_inj.injOn + have hTV_img : g '' T_V = G.V ∩ I := by + exact parametrization_maps_vertex_times_to_vertices (S := S) G I g hg_range + have hTV_ncard : T_V.ncard = m := by + rw [← ncard_image_of_injective T_V hg_inj, hTV_img, hI_ncard] + let L : Finset unitInterval := hTV_fin.toFinset + have hL_card : L.card = m := by + rw [← hTV_ncard, Set.ncard_eq_toFinset_card T_V hTV_fin] + let emb : Fin m ↪o unitInterval := L.orderEmbOfFin hL_card + have hemb_mem : ∀ i : Fin m, emb i ∈ T_V := fun i => + (hTV_fin.mem_toFinset).mp (L.orderEmbOfFin_mem hL_card i) + have hemb_range : range emb = T_V := by + rw [Finset.range_orderEmbOfFin L hL_card, Finite.coe_toFinset] + let i_a : Fin m := ⟨r - 1, by omega⟩ + let i_b : Fin m := ⟨r, by omega⟩ + have hia_lt_ib : i_a < i_b := by + change r - 1 < r + omega + let t_a : unitInterval := emb i_a + let t_b : unitInterval := emb i_b + have hta_lt_tb : (t_a : ℝ) < (t_b : ℝ) := emb.strictMono hia_lt_ib + let t₀ : unitInterval := + ⟨((t_a : ℝ) + (t_b : ℝ)) / 2, ⟨by linarith [t_a.2.1, t_b.2.1], by linarith [t_a.2.2, t_b.2.2]⟩⟩ + have hta_lt_t₀ : t_a < t₀ := by + change (t_a : ℝ) < ((t_a : ℝ) + (t_b : ℝ)) / 2 + linarith + have ht₀_lt_tb : t₀ < t_b := by + change ((t_a : ℝ) + (t_b : ℝ)) / 2 < (t_b : ℝ) + linarith + have ht₀_pos : (0 : unitInterval) < t₀ := lt_of_le_of_lt t_a.2.1 hta_lt_t₀ + have ht₀_lt_one : t₀ < (1 : unitInterval) := lt_of_lt_of_le ht₀_lt_tb t_b.2.2 + have hemb_le_t₀_iff : ∀ i : Fin m, emb i ≤ t₀ ↔ i.1 < r := by + exact vertex_time_before_split_iff_index_lt hr (by omega) emb t₀ hta_lt_t₀ ht₀_lt_tb + have ht₀_notMem_TV : t₀ ∉ T_V := by + rw [← hemb_range] + exact split_time_is_between_vertices hr (by omega) emb t₀ hta_lt_t₀ ht₀_lt_tb + let z : S := g t₀ + let barI₁ : Set S := g '' Icc 0 t₀ + let barI₂ : Set S := g '' Icc t₀ 1 + have hg0 : g 0 = u := hf0 + have hg1 : g 1 = v := hf1 + have hbarI₁_ends : IsLineWithEnds barI₁ u z := by + have h := isLine_piece hg_cont hg_inj ht₀_pos + rwa [hg0] at h + have hbarI₂_ends : IsLineWithEnds barI₂ z v := by + have h := isLine_piece hg_cont hg_inj ht₀_lt_one + rwa [hg1] at h + have hbarI₁_sub : barI₁ ⊆ I := by + rw [← hg_range] + exact image_subset_range g _ + have hbarI₂_sub : barI₂ ⊆ I := by + rw [← hg_range] + exact image_subset_range g _ + have hbar_union : barI₁ ∪ barI₂ = I := by + exact line_halves_cover_line (S := S) I g hg_range t₀ + have hz_mem : z ∈ I \ (G.U ∪ {u, v}) := by + refine ⟨(f t₀).2, ?_⟩ + rintro (hzU | hzu | hzv) + · exact ht₀_notMem_TV (hI_norm ⟨(f t₀).2, hzU⟩) + · exact ht₀_pos.ne' (hg_inj (hzu.trans hf0.symm)) + · exact ht₀_lt_one.ne (hg_inj (hzv.trans hf1.symm)) + have hbarI₁_disj_F₁ : Disjoint barI₁ F₁ := by + rw [disjoint_left] + rintro _ ⟨t, ht, rfl⟩ htF₁ + rw [hg_F₁_iff] at htF₁ + exact ht₀_lt_one.not_ge (htF₁ ▸ ht.2) + have hbarI₂_disj_F₂ : Disjoint barI₂ F₂ := by + rw [disjoint_left] + rintro _ ⟨t, ht, rfl⟩ htF₂ + rw [hg_F₂_iff] at htF₂ + exact ht₀_pos.not_ge (htF₂ ▸ ht.1) + -- Count vertices in barI₁ and barI₂ + have hbarI₁_V_eq : G.V ∩ barI₁ = g '' (T_V ∩ Iic t₀) := by + ext x + constructor + · rintro ⟨hxV, t, ht, rfl⟩ + exact ⟨t, ⟨hxV, ht.2⟩, rfl⟩ + · rintro ⟨t, ⟨htV, ht⟩, rfl⟩ + exact ⟨htV, t, ⟨t.2.1, ht⟩, rfl⟩ + have hbarI₂_V_eq : G.V ∩ barI₂ = g '' (T_V ∩ Ici t₀) := by + ext x + constructor + · rintro ⟨hxV, t, ht, rfl⟩ + exact ⟨t, ⟨hxV, ht.1⟩, rfl⟩ + · rintro ⟨t, ⟨htV, ht⟩, rfl⟩ + exact ⟨htV, t, ⟨ht, t.2.2⟩, rfl⟩ + let φ₁ : Fin r → ↥(T_V ∩ Iic t₀) := fun j => + ⟨emb ⟨j.1, by omega⟩, hemb_mem ⟨j.1, by omega⟩, (hemb_le_t₀_iff ⟨j.1, by omega⟩).mpr j.2⟩ + have hφ₁_bij : Bijective φ₁ := by + refine ⟨fun j₁ j₂ h => ?_, fun ⟨t, htV, ht_le⟩ => ?_⟩ + · have hval : (φ₁ j₁).1 = (φ₁ j₂).1 := congrArg Subtype.val h + exact Fin.ext (Fin.mk.inj (emb.injective hval)) + · rw [← hemb_range] at htV + obtain ⟨i, rfl⟩ := htV + have hir : i.1 < r := (hemb_le_t₀_iff i).mp ht_le + exact ⟨⟨i.1, hir⟩, rfl⟩ + have hbarI₁_ncard : (G.V ∩ barI₁).ncard = r := by + rw [hbarI₁_V_eq, ncard_image_of_injective _ hg_inj, ← Nat.card_coe_set_eq, + ← Nat.card_congr (Equiv.ofBijective φ₁ hφ₁_bij), Nat.card_fin] + let φ₂ : Fin (m - r) → ↥(T_V ∩ Ici t₀) := fun j => + ⟨emb ⟨r + j.1, by omega⟩, hemb_mem ⟨r + j.1, by omega⟩, by + have hnot : ¬ (emb ⟨r + j.1, by omega⟩ ≤ t₀) := by + rw [hemb_le_t₀_iff] + change ¬ (r + j.1 < r) + omega + exact le_of_not_ge hnot⟩ + have hφ₂_bij : Bijective φ₂ := by + exact upper_vertex_times_biject_later_indices (by omega) T_V emb hemb_mem hemb_range t₀ + hemb_le_t₀_iff ht₀_notMem_TV φ₂ (fun _ => rfl) + have hbarI₂_ncard : (G.V ∩ barI₂).ncard = m - r := by + rw [hbarI₂_V_eq, ncard_image_of_injective _ hg_inj, ← Nat.card_coe_set_eq, + ← Nat.card_congr (Equiv.ofBijective φ₂ hφ₂_bij), Nat.card_fin] + refine ⟨I, barI₁, barI₂, u, v, z, m, hI_ends, haF₂, hbF₁, hI_disj, + hI_norm, fun x hx => hI_norm ⟨hbarI₁_sub hx.1, hx.2⟩, fun x hx => hI_norm ⟨hbarI₂_sub hx.1, + hx.2⟩, + hbarI₁_ends, hbarI₂_ends, hbarI₁_sub, hbarI₂_sub, hbar_union, hz_mem, + ⟨hbarI₁_ends.left_mem, haF₂⟩, hbarI₁_disj_F₁, + ⟨hbarI₂_ends.right_mem, hbF₁⟩, hbarI₂_disj_F₂, + h2r, hI_ncard, hbarI₁_ncard, hbarI₂_ncard, hmin⟩ + +/-- **Graph Minors VII, (9.3), Observation** (page 244): +"It follows from the choice of $I$ that $|V(G) \cap R| \ge r$ for every $G$-normal $[0, 1]$-arc $R$ +which for some $j$ ($j = 1$ or $2$) meets both $F_j$ and $I_j$." -/ +theorem lemma_9_3_obs {S : Type u} [TopologicalSpace S] [T2Space S] + (G : Drawing S) {F₁ F₂ barI₁ barI₂ : Set S} {u v z : S} {r m : ℕ} + (hDisj : Disjoint F₁ F₂) + (hbarI₁_norm : G.IsNormal barI₁) (hbarI₂_norm : G.IsNormal barI₂) + (hbarI₁_ends : IsLineWithEnds barI₁ u z) (hbarI₂_ends : IsLineWithEnds barI₂ z v) + (hu : u ∈ barI₁ ∩ F₂) (hv : v ∈ barI₂ ∩ F₁) + (h2r : 2 * r ≤ m) + (hbarI₁_ncard : (G.V ∩ barI₁).ncard = r) (hbarI₂_ncard : (G.V ∩ barI₂).ncard = m - r) + (hmin : ∀ F : Set S, G.IsNormal F → IsLine F → (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → + m ≤ (G.V ∩ F).ncard) + {R : Set S} (hR_norm : G.IsNormal R) (hR_line : IsLine R) + (hmeets : ((R ∩ F₁).Nonempty ∧ (R ∩ barI₁).Nonempty) ∨ + ((R ∩ F₂).Nonempty ∧ (R ∩ barI₂).Nonempty)) : + r ≤ (G.V ∩ R).ncard := by + have hR_pc : IsPathConnected R := IsLine.isPathConnected hR_line + rcases hmeets with ⟨⟨a, haR, haF₁⟩, hR_barI₁⟩ | ⟨⟨a, haR, haF₂⟩, hR_barI₂⟩ + · have hbarI₁_pc : IsPathConnected barI₁ := IsLine.isPathConnected (IsLineWithEnds.isLine + hbarI₁_ends) + have hunion_pc : IsPathConnected (R ∪ barI₁) := hR_pc.union hbarI₁_pc hR_barI₁ + have hau_ne : a ≠ u := fun heq => disjoint_left.mp hDisj haF₁ (heq ▸ hu.2) + have hj : JoinedIn (R ∪ barI₁) a u := hunion_pc.joinedIn a (Or.inl haR) u (Or.inr hu.1) + have hL_ex := ((joinedIn_iff_eq_or_exists_isLineWithEnds (Z := R ∪ barI₁) (Or.inl haR) + (Or.inr hu.1)).mp hj).resolve_left hau_ne + obtain ⟨L, hL_sub, hL_ends⟩ := hL_ex + have hL_norm : G.IsNormal L := fun x hx => by + rcases hL_sub hx.1 with hxR | hxI₁ + · exact hR_norm ⟨hxR, hx.2⟩ + · exact hbarI₁_norm ⟨hxI₁, hx.2⟩ + have hm_le : m ≤ (G.V ∩ L).ncard := + hmin L hL_norm (IsLineWithEnds.isLine hL_ends) ⟨a, hL_ends.left_mem, haF₁⟩ ⟨u, + hL_ends.right_mem, hu.2⟩ + have hsub_V : G.V ∩ L ⊆ (G.V ∩ R) ∪ (G.V ∩ barI₁) := fun x hx => by + rcases hL_sub hx.2 with hxR | hxI₁ + · exact Or.inl ⟨hx.1, hxR⟩ + · exact Or.inr ⟨hx.1, hxI₁⟩ + have hle_sum : (G.V ∩ L).ncard ≤ (G.V ∩ R).ncard + (G.V ∩ barI₁).ncard := + (Set.ncard_le_ncard hsub_V ((G.finite_V.inter_of_left R).union (G.finite_V.inter_of_left + barI₁))).trans + (Set.ncard_union_le _ _) + omega + · have hbarI₂_pc : IsPathConnected barI₂ := IsLine.isPathConnected (IsLineWithEnds.isLine + hbarI₂_ends) + have hunion_pc : IsPathConnected (R ∪ barI₂) := hR_pc.union hbarI₂_pc hR_barI₂ + have hav_ne : a ≠ v := fun heq => disjoint_left.mp hDisj (heq ▸ hv.2) haF₂ + have hj : JoinedIn (R ∪ barI₂) a v := hunion_pc.joinedIn a (Or.inl haR) v (Or.inr hv.1) + have hL_ex := ((joinedIn_iff_eq_or_exists_isLineWithEnds (Z := R ∪ barI₂) (Or.inl haR) + (Or.inr hv.1)).mp hj).resolve_left hav_ne + obtain ⟨L, hL_sub, hL_ends⟩ := hL_ex + have hL_norm : G.IsNormal L := fun x hx => by + rcases hL_sub hx.1 with hxR | hxI₂ + · exact hR_norm ⟨hxR, hx.2⟩ + · exact hbarI₂_norm ⟨hxI₂, hx.2⟩ + have hm_le : m ≤ (G.V ∩ L).ncard := + hmin L hL_norm (IsLineWithEnds.isLine hL_ends) ⟨v, hL_ends.right_mem, hv.2⟩ ⟨a, + hL_ends.left_mem, haF₂⟩ + have hsub_V : G.V ∩ L ⊆ (G.V ∩ R) ∪ (G.V ∩ barI₂) := fun x hx => by + rcases hL_sub hx.2 with hxR | hxI₂ + · exact Or.inl ⟨hx.1, hxR⟩ + · exact Or.inr ⟨hx.1, hxI₂⟩ + have hle_sum : (G.V ∩ L).ncard ≤ (G.V ∩ R).ncard + (G.V ∩ barI₂).ncard := + (Set.ncard_le_ncard hsub_V ((G.finite_V.inter_of_left R).union (G.finite_V.inter_of_left + barI₂))).trans + (Set.ncard_union_le _ _) + omega + +/-- Any `G`-normal arc-connected set `K ⊆ S` meeting `F₁` and `F₂ ∪ barI₁` (or meeting `F₂` and +`F₁ ∪ barI₂`) contains a `G`-normal `[0, 1]`-arc `R ⊆ K` with `r ≤ (G.V ∩ R).ncard ≤ (G.V ∩ +K).ncard`. -/ +theorem ncard_ge_of_arcConnected_meets {S : Type u} [TopologicalSpace S] [T2Space S] + (G : Drawing S) {F₁ F₂ barI₁ barI₂ : Set S} {u v z : S} {r m : ℕ} + (hDisj : Disjoint F₁ F₂) + (hbarI₁_norm : G.IsNormal barI₁) (hbarI₂_norm : G.IsNormal barI₂) + (hbarI₁_ends : IsLineWithEnds barI₁ u z) (hbarI₂_ends : IsLineWithEnds barI₂ z v) + (hu : u ∈ barI₁ ∩ F₂) (hbarI₁_disj : Disjoint barI₁ F₁) + (hv : v ∈ barI₂ ∩ F₁) (hbarI₂_disj : Disjoint barI₂ F₂) + (h2r : 2 * r ≤ m) + (hbarI₁_ncard : (G.V ∩ barI₁).ncard = r) (hbarI₂_ncard : (G.V ∩ barI₂).ncard = m - r) + (hmin : ∀ F : Set S, G.IsNormal F → IsLine F → (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → + m ≤ (G.V ∩ F).ncard) + {K : Set S} (hK_norm : G.IsNormal K) (hK_arc : IsArcConnected K) + (hmeets : ((K ∩ F₁).Nonempty ∧ (K ∩ (F₂ ∪ barI₁)).Nonempty) ∨ + ((K ∩ F₂).Nonempty ∧ (K ∩ (F₁ ∪ barI₂)).Nonempty)) : + r ≤ (G.V ∩ K).ncard := by + rcases hmeets with ⟨⟨a, haK, haF₁⟩, ⟨b, hbK, hb_or⟩⟩ | ⟨⟨a, haK, haF₂⟩, ⟨b, hbK, hb_or⟩⟩ + · have hab : a ≠ b := by + rintro rfl + rcases hb_or with haF₂ | haI₁ + · exact disjoint_left.mp hDisj haF₁ haF₂ + · exact disjoint_left.mp hbarI₁_disj haI₁ haF₁ + obtain ⟨R, hRK, hR_ends⟩ := hK_arc a haK b hbK hab + have hR_norm : G.IsNormal R := fun x hx => hK_norm ⟨hRK hx.1, hx.2⟩ + have hR_le : (G.V ∩ R).ncard ≤ (G.V ∩ K).ncard := + Set.ncard_le_ncard (inter_subset_inter_right G.V hRK) (G.finite_V.inter_of_left K) + rcases hb_or with hbF₂ | hbI₁ + · have hm_le := hmin R hR_norm (IsLineWithEnds.isLine hR_ends) ⟨a, hR_ends.left_mem, haF₁⟩ ⟨b, + hR_ends.right_mem, hbF₂⟩ + omega + · have hr_le := lemma_9_3_obs G hDisj hbarI₁_norm hbarI₂_norm hbarI₁_ends hbarI₂_ends + hu hv h2r hbarI₁_ncard hbarI₂_ncard hmin hR_norm (IsLineWithEnds.isLine hR_ends) + (Or.inl ⟨⟨a, hR_ends.left_mem, haF₁⟩, ⟨b, hR_ends.right_mem, hbI₁⟩⟩) + omega + · have hab : a ≠ b := by + rintro rfl + rcases hb_or with haF₁ | haI₂ + · exact disjoint_left.mp hDisj haF₁ haF₂ + · exact disjoint_left.mp hbarI₂_disj haI₂ haF₂ + obtain ⟨R, hRK, hR_ends⟩ := hK_arc a haK b hbK hab + have hR_norm : G.IsNormal R := fun x hx => hK_norm ⟨hRK hx.1, hx.2⟩ + have hR_le : (G.V ∩ R).ncard ≤ (G.V ∩ K).ncard := + Set.ncard_le_ncard (inter_subset_inter_right G.V hRK) (G.finite_V.inter_of_left K) + rcases hb_or with hbF₁ | hbI₂ + · have hm_le := hmin R hR_norm (IsLineWithEnds.isLine hR_ends) ⟨b, hR_ends.right_mem, hbF₁⟩ ⟨a, + hR_ends.left_mem, haF₂⟩ + omega + · have hr_le := lemma_9_3_obs G hDisj hbarI₁_norm hbarI₂_norm hbarI₁_ends hbarI₂_ends + hu hv h2r hbarI₁_ncard hbarI₂_ncard hmin hR_norm (IsLineWithEnds.isLine hR_ends) + (Or.inr ⟨⟨a, hR_ends.left_mem, haF₂⟩, ⟨b, hR_ends.right_mem, hbI₂⟩⟩) + omega + +/-- Helper lemma for Claims 1 and 2 of (9.3): if `j '' K` (where `K ⊆ S` is preconnected) meets +`E₁'` and `E₂ ∪ j '' barI₁`, then `K` meets `F₁` and `F₂ ∪ barI₁`; symmetrically, if `j '' K` meets +`E₂` and `E₁' ∪ j '' barI₂`, then `K` meets `F₂` and `F₁ ∪ barI₂`. -/ +theorem meets_F₁_or_F₂_of_meets_E {S Z : Type u} [TopologicalSpace S] [TopologicalSpace Z] [T2Space + Z] + {j : S → Z} (hj : IsClosedEmbedding j) + {F₁ F₂ barI₁ barI₂ : Set S} {E₁ E₂ E₁' E₂' : Set Z} + (hE₁ : IsClosedDisc E₁) (hbE₁ : discBd E₁ = j '' F₁) + (hE₂ : IsClosedDisc E₂) (hbE₂ : discBd E₂ = j '' F₂) + (hE₁' : IsClosedDisc E₁') (hE₁'_compl : E₁' = (discInt E₁)ᶜ) + (hE₂' : IsClosedDisc E₂') (hE₂'_compl : E₂' = (discInt E₂)ᶜ) + (hE₂_in_E₁ : E₂ ⊆ discInt E₁) (hE₁'_in_E₂' : E₁' ⊆ discInt E₂') + (hbarI₁_in_E₁ : j '' barI₁ ⊆ discInt E₁) + (hbarI₂_in_E₂' : j '' barI₂ ⊆ discInt E₂') + {K : Set S} (hK_pc : IsPreconnected K) : + (((j '' K ∩ E₁').Nonempty ∧ (j '' K ∩ (E₂ ∪ j '' barI₁)).Nonempty) → + (K ∩ F₁).Nonempty ∧ (K ∩ (F₂ ∪ barI₁)).Nonempty) ∧ + (((j '' K ∩ E₂).Nonempty ∧ (j '' K ∩ (E₁' ∪ j '' barI₂)).Nonempty) → + (K ∩ F₂).Nonempty ∧ (K ∩ (F₁ ∪ barI₂)).Nonempty) := by + have hjK_pc : IsPreconnected (j '' K) := hK_pc.image j hj.continuous.continuousOn + have hcov₁ : E₁ ∪ E₁' = univ := by + rw [hE₁'_compl] + apply eq_univ_of_forall + intro w + by_cases hw : w ∈ E₁ + · exact Or.inl hw + · exact Or.inr fun h => hw h.1 + have hinter₁ : E₁ ∩ E₁' = j '' F₁ := by + rw [← hbE₁, hE₁'_compl] + ext w + simp only [mem_inter_iff, mem_compl_iff, discInt, mem_sdiff, not_and, not_not] + exact ⟨fun h => h.2 h.1, fun h => ⟨Surface.discBd_subset E₁ h, fun _ => h⟩⟩ + have hcov₂ : E₂ ∪ E₂' = univ := by + rw [hE₂'_compl] + apply eq_univ_of_forall + intro w + by_cases hw : w ∈ E₂ + · exact Or.inl hw + · exact Or.inr fun h => hw h.1 + have hinter₂ : E₂ ∩ E₂' = j '' F₂ := by + rw [← hbE₂, hE₂'_compl] + ext w + simp only [mem_inter_iff, mem_compl_iff, discInt, mem_sdiff, not_and, not_not] + exact ⟨fun h => h.2 h.1, fun h => ⟨Surface.discBd_subset E₂ h, fun _ => h⟩⟩ + constructor + · rintro ⟨⟨w₁, hw₁K, hw₁E₁'⟩, ⟨w₂, hw₂K, hw₂_or⟩⟩ + have hw₂E₁ : w₂ ∈ E₁ := by + rcases hw₂_or with hw₂E₂ | hw₂I₁ + · exact (hE₂_in_E₁ hw₂E₂).1 + · exact (hbarI₁_in_E₁ hw₂I₁).1 + obtain ⟨_, ⟨x₁, hx₁K, rfl⟩, hx₁_in⟩ := preconnected_inter_nonempty_of_closed_cover hjK_pc + hE₁.isClosed hE₁'.isClosed (fun w _ => hcov₁ ▸ mem_univ w) ⟨w₂, hw₂K, hw₂E₁⟩ ⟨w₁, hw₁K, + hw₁E₁'⟩ + rw [hinter₁] at hx₁_in + obtain ⟨x₁', hx₁'F₁, hx₁'_eq⟩ := hx₁_in + have hx₁F₁ : x₁ ∈ F₁ := hj.injective hx₁'_eq ▸ hx₁'F₁ + refine ⟨⟨x₁, hx₁K, hx₁F₁⟩, ?_⟩ + rcases hw₂_or with hw₂E₂ | ⟨x₂, hx₂I₁, rfl⟩ + · have hw₁E₂' : w₁ ∈ E₂' := (hE₁'_in_E₂' hw₁E₁').1 + obtain ⟨_, ⟨x₂, hx₂K, rfl⟩, hx₂_in⟩ := preconnected_inter_nonempty_of_closed_cover hjK_pc + hE₂.isClosed hE₂'.isClosed (fun w _ => hcov₂ ▸ mem_univ w) ⟨w₂, hw₂K, hw₂E₂⟩ ⟨w₁, hw₁K, + hw₁E₂'⟩ + rw [hinter₂] at hx₂_in + obtain ⟨x₂', hx₂'F₂, hx₂'_eq⟩ := hx₂_in + exact ⟨x₂, hx₂K, Or.inl (hj.injective hx₂'_eq ▸ hx₂'F₂)⟩ + · obtain ⟨x₂', hx₂'K, hx₂'_eq⟩ := hw₂K + exact ⟨x₂', hx₂'K, Or.inr (hj.injective hx₂'_eq.symm ▸ hx₂I₁)⟩ + · rintro ⟨⟨w₁, hw₁K, hw₁E₂⟩, ⟨w₂, hw₂K, hw₂_or⟩⟩ + have hw₂E₂' : w₂ ∈ E₂' := by + rcases hw₂_or with hw₂E₁' | hw₂I₂ + · exact (hE₁'_in_E₂' hw₂E₁').1 + · exact (hbarI₂_in_E₂' hw₂I₂).1 + obtain ⟨_, ⟨x₁, hx₁K, rfl⟩, hx₁_in⟩ := preconnected_inter_nonempty_of_closed_cover hjK_pc + hE₂.isClosed hE₂'.isClosed (fun w _ => hcov₂ ▸ mem_univ w) ⟨w₁, hw₁K, hw₁E₂⟩ ⟨w₂, hw₂K, + hw₂E₂'⟩ + rw [hinter₂] at hx₁_in + obtain ⟨x₁', hx₁'F₂, hx₁'_eq⟩ := hx₁_in + have hx₁F₂ : x₁ ∈ F₂ := hj.injective hx₁'_eq ▸ hx₁'F₂ + refine ⟨⟨x₁, hx₁K, hx₁F₂⟩, ?_⟩ + rcases hw₂_or with hw₂E₁' | ⟨x₂, hx₂I₂, rfl⟩ + · have hw₁E₁ : w₁ ∈ E₁ := (hE₂_in_E₁ hw₁E₂).1 + obtain ⟨_, ⟨x₂, hx₂K, rfl⟩, hx₂_in⟩ := preconnected_inter_nonempty_of_closed_cover hjK_pc + hE₁.isClosed hE₁'.isClosed (fun w _ => hcov₁ ▸ mem_univ w) ⟨w₁, hw₁K, hw₁E₁⟩ ⟨w₂, hw₂K, + hw₂E₁'⟩ + rw [hinter₁] at hx₂_in + obtain ⟨x₂', hx₂'F₁, hx₂'_eq⟩ := hx₂_in + exact ⟨x₂, hx₂K, Or.inl (hj.injective hx₂'_eq ▸ hx₂'F₁)⟩ + · obtain ⟨x₂', hx₂'K, hx₂'_eq⟩ := hw₂K + exact ⟨x₂', hx₂'K, Or.inr (hj.injective hx₂'_eq.symm ▸ hx₂I₂)⟩ + +/-- If a closed disc `D ⊆ Z` with `discBd D ⊆ discComplement P` separates `P 0` and `P 2` (or `P 1` +and `P 2`), then `discBd D` meets `E₂ ∪ j '' barI₁` (respectively `E₁' ∪ j '' barI₂`). -/ +theorem discBd_meets_K₁_or_K₂ {S Z : Type u} [TopologicalSpace S] [TopologicalSpace Z] [T2Space Z] + (hCS_Z : IsClosedSurface Z) (hSphZ : IsSphere Z) {j : S → Z} (hj : IsClosedEmbedding j) + {F₁ F₂ barI₁ barI₂ : Set S} {u v z : S} + (hbarI₁_ends : IsLineWithEnds barI₁ u z) (hbarI₂_ends : IsLineWithEnds barI₂ z v) + (hu : u ∈ barI₁ ∩ F₂) (hv : v ∈ barI₂ ∩ F₁) + {D₁ D₂ D₃ E₂ E₁' : Set Z} + (hD₁ : IsClosedDisc D₁) (hD₂ : IsClosedDisc D₂) (hD₃ : IsClosedDisc D₃) + (hE₂ : IsClosedDisc E₂) (hbE₂ : discBd E₂ = j '' F₂) + (hE₁' : IsClosedDisc E₁') (hbE₁' : discBd E₁' = j '' F₁) + (hD₁_in_E₂ : D₁ ⊆ discInt E₂) (hD₂_in_E₁' : D₂ ⊆ discInt E₁') + (hjz_D₃ : j z ∈ discInt D₃) + {D : Set Z} (hD : IsClosedDisc D) + (hbd_sub : discBd D ⊆ discComplement ![D₁, D₂, D₃]) : + ((D₁ ⊆ D ∧ ¬ D₃ ⊆ D) ∨ (¬ D₁ ⊆ D ∧ D₃ ⊆ D) → + (discBd D ∩ (E₂ ∪ j '' barI₁)).Nonempty) ∧ + ((D₂ ⊆ D ∧ ¬ D₃ ⊆ D) ∨ (¬ D₂ ⊆ D ∧ D₃ ⊆ D) → + (discBd D ∩ (E₁' ∪ j '' barI₂)).Nonempty) := by + have hmanZ : ∀ x : Z, IsManifoldPoint x := fun x => (hCS_Z.2.2 x).isManifoldPoint + let P : Fin 3 → Set Z := ![D₁, D₂, D₃] + have hP : ∀ i, IsClosedDisc (P i) := fun i => by + fin_cases i + · exact hD₁ + · exact hD₂ + · exact hD₃ + obtain ⟨D', hD', hbD', hD'_compl, _⟩ := exists_compl_disc_in_sphere hSphZ hD + have hcov : D ∪ D' = univ := by + rw [hD'_compl] + apply eq_univ_of_forall + intro w + by_cases hw : w ∈ D + · exact Or.inl hw + · exact Or.inr fun h => hw h.1 + have hinter : D ∩ D' = discBd D := by + rw [hD'_compl] + ext w + simp only [mem_inter_iff, mem_compl_iff, discInt, mem_sdiff, not_and, not_not] + exact ⟨fun h => h.2 h.1, fun h => ⟨Surface.discBd_subset D h, fun _ => h⟩⟩ + have hdisj_int : ∀ i : Fin 3, Disjoint (discInt (P i)) (discBd D) := by + intro i + rw [disjoint_left] + intro w hwI hwB + exact hwI.2 (discComplement_inter_disc_subset_boundary hCS_Z P hP i ⟨hbd_sub hwB, hwI.1⟩) + have hpt_in_D' : ∀ (i : Fin 3) (q : Z), q ∈ discInt (P i) → ¬ P i ⊆ D → q ∈ D' := by + intro i q hq hnot + rw [hD'_compl] + intro hqD + rcases hD.side hmanZ (hP i).isPreconnected_discInt (hdisj_int i) with hin | hout + · apply hnot + apply (hP i).subset_closure_discInt.trans + rw [← hD.isClosed.closure_eq] + exact closure_mono (hin.trans (discInt_subset D)) + · exact disjoint_left.mp hout hq hqD.1 + obtain ⟨p₁, hp₁⟩ := hD₁.nonempty_discInt + obtain ⟨p₂, hp₂⟩ := hD₂.nonempty_discInt + have hp₁_E₂ : p₁ ∈ E₂ := (hD₁_in_E₂ hp₁.1).1 + have hp₂_E₁' : p₂ ∈ E₁' := (hD₂_in_E₁' hp₂.1).1 + have hjz_I₁ : j z ∈ j '' barI₁ := mem_image_of_mem j hbarI₁_ends.right_mem + have hjz_I₂ : j z ∈ j '' barI₂ := mem_image_of_mem j hbarI₂_ends.left_mem + have hK₁_pc : IsPreconnected (E₂ ∪ j '' barI₁) := by + have h1 : IsPreconnected E₂ := hE₂.isPreconnected + have h2 : IsPreconnected (j '' barI₁) := + (IsLineWithEnds.isConnected hbarI₁_ends).2.image j hj.continuous.continuousOn + exact h1.union (j u) (Surface.discBd_subset E₂ (hbE₂.symm ▸ mem_image_of_mem j hu.2)) + (mem_image_of_mem j hu.1) h2 + have hK₂_pc : IsPreconnected (E₁' ∪ j '' barI₂) := by + have h1 : IsPreconnected E₁' := hE₁'.isPreconnected + have h2 : IsPreconnected (j '' barI₂) := + (IsLineWithEnds.isConnected hbarI₂_ends).2.image j hj.continuous.continuousOn + exact h1.union (j v) (Surface.discBd_subset E₁' (hbE₁'.symm ▸ mem_image_of_mem j hv.2)) + (mem_image_of_mem j hv.1) h2 + constructor + · intro hsep + have hne_D : ((E₂ ∪ j '' barI₁) ∩ D).Nonempty := by + rcases hsep with ⟨h1, _⟩ | ⟨_, h3⟩ + · exact ⟨p₁, Or.inl hp₁_E₂, h1 hp₁.1⟩ + · exact ⟨j z, Or.inr hjz_I₁, h3 hjz_D₃.1⟩ + have hne_D' : ((E₂ ∪ j '' barI₁) ∩ D').Nonempty := by + rcases hsep with ⟨_, h3⟩ | ⟨h1, _⟩ + · exact ⟨j z, Or.inr hjz_I₁, hpt_in_D' 2 (j z) hjz_D₃ h3⟩ + · exact ⟨p₁, Or.inl hp₁_E₂, hpt_in_D' 0 p₁ hp₁ h1⟩ + obtain ⟨w, hwK₁, hwDD'⟩ := preconnected_inter_nonempty_of_closed_cover hK₁_pc + hD.isClosed hD'.isClosed (fun w _ => hcov ▸ mem_univ w) hne_D hne_D' + exact ⟨w, hinter ▸ hwDD', hwK₁⟩ + · intro hsep + have hne_D : ((E₁' ∪ j '' barI₂) ∩ D).Nonempty := by + rcases hsep with ⟨h2, _⟩ | ⟨_, h3⟩ + · exact ⟨p₂, Or.inl hp₂_E₁', h2 hp₂.1⟩ + · exact ⟨j z, Or.inr hjz_I₂, h3 hjz_D₃.1⟩ + have hne_D' : ((E₁' ∪ j '' barI₂) ∩ D').Nonempty := by + rcases hsep with ⟨_, h3⟩ | ⟨h2, _⟩ + · exact ⟨j z, Or.inr hjz_I₂, hpt_in_D' 2 (j z) hjz_D₃ h3⟩ + · exact ⟨p₂, Or.inl hp₂_E₁', hpt_in_D' 1 p₂ hp₂ h2⟩ + obtain ⟨w, hwK₂, hwDD'⟩ := preconnected_inter_nonempty_of_closed_cover hK₂_pc + hD.isClosed hD'.isClosed (fun w _ => hcov ▸ mem_univ w) hne_D hne_D' + exact ⟨w, hinter ▸ hwDD', hwK₂⟩ + +private theorem two_cuff_complement_lies_in_embedding_range + {S : Type u} + {Z : Type u} + [TopologicalSpace Z] + [T2Space Z] + (hCS_Z : IsClosedSurface Z) + {j : S → Z} + {D₁ : Set Z} + {D₂ : Set Z} + {D₃ : Set Z} + (hP_disj : Pairwise fun i k => Disjoint (![D₁, D₂, D₃] i) (![D₁, D₂, D₃] k)) + (hrange_eq : range j = discComplement ![D₁, D₂]) : + let P : Fin 3 → Set Z := ![D₁, D₂, D₃] + (∀ (i : Fin 3), IsClosedDisc (P i)) → + (∀ (i : Fin 2), IsClosedDisc (![D₁, D₂] i)) → + (Pairwise fun i k => Disjoint (![D₁, D₂] i) (![D₁, D₂] k)) → + discComplement P ⊆ range j := by + intro P hP hP₂ hP₂_disj + rw [hrange_eq] + intro w hw + rw [mem_discComplement_iff hCS_Z P hP hP_disj] at hw + rw [mem_discComplement_iff hCS_Z ![D₁, D₂] hP₂ hP₂_disj] + intro i + fin_cases i + · exact hw 0 + · exact hw 1 + +/-- **Graph Minors VII, (9.3), Claim 1** (pages 244–245): +"*Claim 1.* *$G$ is boundary-linked in $\Sigma'$.*" -/ +theorem lemma_9_3_claim_1 {S Z : Type u} [TopologicalSpace S] [T2Space S] + [TopologicalSpace Z] [T2Space Z] + (hCS_Z : IsClosedSurface Z) (hSphZ : IsSphere Z) {j : S → Z} (hj : IsClosedEmbedding j) + (G : Drawing S) {C₁ C₂ F₁ F₂ barI₁ barI₂ : Set S} {u v z : S} {r m : ℕ} + (hDisj : Disjoint F₁ F₂) + (hbarI₁_norm : G.IsNormal barI₁) (hbarI₂_norm : G.IsNormal barI₂) + (hbarI₁_ends : IsLineWithEnds barI₁ u z) (hbarI₂_ends : IsLineWithEnds barI₂ z v) + (hu : u ∈ barI₁ ∩ F₂) (hbarI₁_disj : Disjoint barI₁ F₁) + (hv : v ∈ barI₂ ∩ F₁) (hbarI₂_disj : Disjoint barI₂ F₂) + (h2r : 2 * r ≤ m) + (hbarI₁_ncard : (G.V ∩ barI₁).ncard = r) (hbarI₂_ncard : (G.V ∩ barI₂).ncard = m - r) + (hmin : ∀ F : Set S, G.IsNormal F → IsLine F → (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → + m ≤ (G.V ∩ F).ncard) + {D₁ D₂ D₃ E₁ E₂ E₁' E₂' : Set Z} + (hD₁ : IsClosedDisc D₁) (hbD₁ : discBd D₁ = j '' C₁) + (hD₂ : IsClosedDisc D₂) (hbD₂ : discBd D₂ = j '' C₂) + (hD₃ : IsClosedDisc D₃) (hD₃_disj_V : Disjoint (j '' G.V) (discBd D₃)) + (hP_disj : Pairwise (fun i k : Fin 3 => Disjoint (![D₁, D₂, D₃] i) (![D₁, D₂, D₃] k))) + (havoid : ∀ i : Fin 3, (embedDrawing hj G).U ∩ ![D₁, D₂, D₃] i = + (embedDrawing hj G).V ∩ discBd (![D₁, D₂, D₃] i)) + (hrange_eq : range j = discComplement ![D₁, D₂]) + (hE₁ : IsClosedDisc E₁) (hbE₁ : discBd E₁ = j '' F₁) + (hE₂ : IsClosedDisc E₂) (hbE₂ : discBd E₂ = j '' F₂) + (hE₁' : IsClosedDisc E₁') (hbE₁' : discBd E₁' = j '' F₁) (hE₁'_compl : E₁' = (discInt E₁)ᶜ) + (hE₂' : IsClosedDisc E₂') (hE₂'_compl : E₂' = (discInt E₂)ᶜ) + (hD₁_in_E₂ : D₁ ⊆ discInt E₂) (hE₂_in_E₁ : E₂ ⊆ discInt E₁) + (hD₂_in_E₁' : D₂ ⊆ discInt E₁') (hE₁'_in_E₂' : E₁' ⊆ discInt E₂') + (hbarI₁_in_E₁ : j '' barI₁ ⊆ discInt E₁) (hbarI₂_in_E₂' : j '' barI₂ ⊆ discInt E₂') + (hjz_D₃ : j z ∈ discInt D₃) + (hC₁_lt_r : (G.V ∩ C₁).ncard < r) (hC₂_lt_r : (G.V ∩ C₂).ncard < r) + (hkC₁ : (G.V ∩ C₁).ncard ≤ maxDisjointPaths G F₁ C₁) + (hkC₂ : (G.V ∩ C₂).ncard ≤ maxDisjointPaths G F₂ C₂) : + let P : Fin 3 → Set Z := ![D₁, D₂, D₃] + let hP : ∀ i, IsClosedDisc (P i) := fun i => by + fin_cases i + · exact hD₁ + · exact hD₂ + · exact hD₃ + IsBoundaryLinked (drawingInSubspace (embedDrawing hj G) (discComplement P) + (drawing_support_subset_discComplement hCS_Z (embedDrawing hj G) P hP hP_disj havoid)) := by + intro P hP + have hmanZ : ∀ x : Z, IsManifoldPoint x := fun x => (hCS_Z.2.2 x).isManifoldPoint + let Γ := embedDrawing hj G + have hP₂ : ∀ i : Fin 2, IsClosedDisc (![D₁, D₂] i) := fun i => by + fin_cases i + · exact hD₁ + · exact hD₂ + have hP₂_disj : Pairwise (fun i k : Fin 2 => Disjoint (![D₁, D₂] i) (![D₁, D₂] k)) := fun i k hik + => by + fin_cases i <;> fin_cases k + · exact (hik rfl).elim + · exact hP_disj (by decide : (0 : Fin 3) ≠ 1) + · exact hP_disj (by decide : (1 : Fin 3) ≠ 0) + · exact (hik rfl).elim + have hC_sub_range : discComplement P ⊆ range j := by + exact two_cuff_complement_lies_in_embedding_range (S := S) (Z := Z) hCS_Z (j := j) (D₁ := D₁) + (D₂ := D₂) (D₃ := D₃) hP_disj hrange_eq hP hP₂ hP₂_disj + apply drawingInDiscComplement_isBoundaryLinked hCS_Z Γ P hP hP_disj havoid + intro F_Z hFZ_norm hFZ_oarc hFZ_sub D hD hbdD i hone + have hFZ_range : F_Z ⊆ range j := hFZ_sub.trans hC_sub_range + let F : Set S := j ⁻¹' F_Z + have hjF_eq : j '' F = F_Z := image_preimage_eq_iff.mpr hFZ_range + have hF_norm : G.IsNormal F := by + rintro x ⟨hxF, hxU⟩ + have hjx : j x ∈ F_Z ∩ Γ.U := ⟨hxF, ⟨x, hxU, rfl⟩⟩ + obtain ⟨y, hyV, hyx⟩ := hFZ_norm hjx + exact hj.injective hyx ▸ hyV + have hF_oarc : IsOArc F := by + obtain ⟨φ⟩ := hFZ_oarc + exact ⟨φ.trans ((Homeomorph.setCongr hjF_eq.symm).trans (hj.isEmbedding.homeomorphImage + F).symm)⟩ + have hF_arc : IsArcConnected F := IsOArc.isArcConnected hF_oarc + have hF_pc : IsPreconnected F := hF_oarc.isPreconnected + have hVF_eq : (Γ.V ∩ F_Z).ncard = (G.V ∩ F).ncard := by + have himg : Γ.V ∩ F_Z = j '' (G.V ∩ F) := by + ext w + constructor + · rintro ⟨⟨x, hxV, rfl⟩, hwF⟩ + exact ⟨x, ⟨hxV, hwF⟩, rfl⟩ + · rintro ⟨x, ⟨hxV, hxF⟩, rfl⟩ + exact ⟨⟨x, hxV, rfl⟩, hxF⟩ + rw [himg, ncard_image_of_injective _ hj.injective] + rw [hVF_eq] + obtain ⟨D', hD', hbD', hD'_compl, _⟩ := exists_compl_disc_in_sphere hSphZ hD + have hcov_S : (j ⁻¹' D') ∪ (j ⁻¹' D) = univ := by + ext x + simp only [mem_union, mem_preimage, hD'_compl, mem_compl_iff, discInt, mem_sdiff, not_and, + not_not, mem_univ, iff_true] + by_cases hx : j x ∈ D + · exact Or.inr hx + · exact Or.inl fun h => (hx h).elim + have hinter_S : (j ⁻¹' D') ∩ (j ⁻¹' D) ⊆ F := by + intro x ⟨hxD', hxD⟩ + rw [mem_preimage, hD'_compl, mem_compl_iff, discInt, mem_sdiff, not_and, not_not] at hxD' + change j x ∈ F_Z + rw [← hbdD] + exact hxD' hxD + have hmeets_E := meets_F₁_or_F₂_of_meets_E hj hE₁ hbE₁ hE₂ hbE₂ hE₁' hE₁'_compl hE₂' hE₂'_compl + hE₂_in_E₁ hE₁'_in_E₂' hbarI₁_in_E₁ hbarI₂_in_E₂' hF_pc + have hmeets_K := discBd_meets_K₁_or_K₂ hCS_Z hSphZ hj hbarI₁_ends hbarI₂_ends hu hv + hD₁ hD₂ hD₃ hE₂ hbE₂ hE₁' hbE₁' hD₁_in_E₂ hD₂_in_E₁' hjz_D₃ + hD (hbdD ▸ hFZ_sub) + fin_cases i + · -- Case i = 0 (D₁) + change (Γ.V ∩ discBd (P 0)).ncard ≤ (G.V ∩ F).ncard + have hVC₁_eq : (Γ.V ∩ discBd (P 0)).ncard = (G.V ∩ C₁).ncard := by + change (j '' G.V ∩ discBd D₁).ncard = (G.V ∩ C₁).ncard + rw [hbD₁, ← image_inter hj.injective, ncard_image_of_injective _ hj.injective] + rw [hVC₁_eq] + have hD₁_sub : D₁ ⊆ D := (hone 0).mpr rfl + have hD₂_not : ¬ D₂ ⊆ D := fun h => by have := (hone 1).mp h; revert this; decide + have hD₃_not : ¬ D₃ ⊆ D := fun h => by have := (hone 2).mp h; revert this; decide + have hK₁_ne : (j '' F ∩ (E₂ ∪ j '' barI₁)).Nonempty := by + rw [hjF_eq, ← hbdD] + exact hmeets_K.1 (Or.inl ⟨hD₁_sub, hD₃_not⟩) + by_cases hFE₁' : (j '' F ∩ E₁').Nonempty + · have hr_le := ncard_ge_of_arcConnected_meets G hDisj hbarI₁_norm hbarI₂_norm + hbarI₁_ends hbarI₂_ends hu hbarI₁_disj hv hbarI₂_disj h2r hbarI₁_ncard hbarI₂_ncard hmin + hF_norm hF_arc (Or.inl (hmeets_E.1 ⟨hFE₁', hK₁_ne⟩)) + omega + · have hdisj_E₁' : Disjoint E₁' (discBd D) := by + rw [hbdD, ← hjF_eq, disjoint_left] + intro w hwE₁' hwF + exact hFE₁' ⟨w, hwF, hwE₁'⟩ + have hdisj_D : Disjoint E₁' D := by + rcases hD.side hmanZ hE₁'.isPreconnected hdisj_E₁' with hin | hout + · exfalso + apply hD₂_not + intro w hwD₂ + exact (hin (hD₂_in_E₁' hwD₂).1).1 + · exact hout + have hF₁_in_D' : F₁ ⊆ j ⁻¹' D' := by + intro x hxF₁ + rw [mem_preimage, hD'_compl] + intro hxD + have hjx_E₁' : j x ∈ E₁' := + Surface.discBd_subset E₁' (hbE₁'.symm ▸ mem_image_of_mem j hxF₁) + exact disjoint_left.mp hdisj_D hjx_E₁' hxD.1 + have hC₁_in_D : C₁ ⊆ j ⁻¹' D := fun x hx => + hD₁_sub (Surface.discBd_subset D₁ (hbD₁.symm ▸ mem_image_of_mem j hx)) + have hk_le := maxDisjointPaths_le_of_closed_cover G hF_norm + (hD'.isClosed.preimage hj.continuous) (hD.isClosed.preimage hj.continuous) + hcov_S hinter_S hF₁_in_D' hC₁_in_D + exact hkC₁.trans hk_le + · -- Case i = 1 (D₂) + change (Γ.V ∩ discBd (P 1)).ncard ≤ (G.V ∩ F).ncard + have hVC₂_eq : (Γ.V ∩ discBd (P 1)).ncard = (G.V ∩ C₂).ncard := by + change (j '' G.V ∩ discBd D₂).ncard = (G.V ∩ C₂).ncard + rw [hbD₂, ← image_inter hj.injective, ncard_image_of_injective _ hj.injective] + rw [hVC₂_eq] + have hD₁_not : ¬ D₁ ⊆ D := fun h => by have := (hone 0).mp h; revert this; decide + have hD₂_sub : D₂ ⊆ D := (hone 1).mpr rfl + have hD₃_not : ¬ D₃ ⊆ D := fun h => by have := (hone 2).mp h; revert this; decide + have hK₂_ne : (j '' F ∩ (E₁' ∪ j '' barI₂)).Nonempty := by + rw [hjF_eq, ← hbdD] + exact hmeets_K.2 (Or.inl ⟨hD₂_sub, hD₃_not⟩) + by_cases hFE₂ : (j '' F ∩ E₂).Nonempty + · have hr_le := ncard_ge_of_arcConnected_meets G hDisj hbarI₁_norm hbarI₂_norm + hbarI₁_ends hbarI₂_ends hu hbarI₁_disj hv hbarI₂_disj h2r hbarI₁_ncard hbarI₂_ncard hmin + hF_norm hF_arc (Or.inr (hmeets_E.2 ⟨hFE₂, hK₂_ne⟩)) + omega + · have hdisj_E₂ : Disjoint E₂ (discBd D) := by + rw [hbdD, ← hjF_eq, disjoint_left] + intro w hwE₂ hwF + exact hFE₂ ⟨w, hwF, hwE₂⟩ + have hdisj_D : Disjoint E₂ D := by + rcases hD.side hmanZ hE₂.isPreconnected hdisj_E₂ with hin | hout + · exfalso + apply hD₁_not + intro w hwD₁ + exact (hin (hD₁_in_E₂ hwD₁).1).1 + · exact hout + have hF₂_in_D' : F₂ ⊆ j ⁻¹' D' := by + intro x hxF₂ + rw [mem_preimage, hD'_compl] + intro hxD + have hjx_E₂ : j x ∈ E₂ := + Surface.discBd_subset E₂ (hbE₂.symm ▸ mem_image_of_mem j hxF₂) + exact disjoint_left.mp hdisj_D hjx_E₂ hxD.1 + have hC₂_in_D : C₂ ⊆ j ⁻¹' D := fun x hx => + hD₂_sub (Surface.discBd_subset D₂ (hbD₂.symm ▸ mem_image_of_mem j hx)) + have hk_le := maxDisjointPaths_le_of_closed_cover G hF_norm + (hD'.isClosed.preimage hj.continuous) (hD.isClosed.preimage hj.continuous) + hcov_S hinter_S hF₂_in_D' hC₂_in_D + exact hkC₂.trans hk_le + · -- Case i = 2 (D₃) + change (Γ.V ∩ discBd (P 2)).ncard ≤ (G.V ∩ F).ncard + have hVD₃_empty : Γ.V ∩ discBd (P 2) = ∅ := hD₃_disj_V.inter_eq + rw [hVD₃_empty, Set.ncard_empty] + exact Nat.zero_le _ + +private theorem two_cuffs_supply_discs_inside_candidate + {Z : Type u} + [TopologicalSpace Z] + [T2Space Z] + (hCS_Z : IsClosedSurface Z) + (hSphZ : IsSphere Z) + {D₁ : Set Z} + {D₂ : Set Z} + {D₃ : Set Z} + (Γ : Drawing Z) + (hP_disj : Pairwise fun i k => Disjoint (![D₁, D₂, D₃] i) (![D₁, D₂, D₃] k)) : + let P : Fin 3 → Set Z := ![D₁, D₂, D₃] + (∀ (i : Fin 3), IsClosedDisc (P i)) → + let C_sub : Set Z := discComplement P + let S' : Type u := ↥C_sub + (IsSurface S') → + ∀ [T2Space S'], + ∀ [ConnectedSpace S'], + ∀ (hUC_G : Γ.U ⊆ C_sub), + let G'_draw : Drawing ↥C_sub := drawingInSubspace Γ C_sub hUC_G + ((cuffs S').Nonempty) → + ∀ (X' : Set ↥C_sub), + (IsSchismatic X') → + (G'_draw.IsNormal X') → + ∃ B₁ B₂ K₁ K₂, B₁ ⊆ X' ∧ B₂ ⊆ X' ∧ IsOArc B₁ ∧ IsOArc B₂ ∧ SurroundsCuff B₁ K₁ ∧ SurroundsCuff + B₂ K₂ ∧ K₁ ≠ K₂ := by + intro P hP C_sub S' hS' _ _ hUC_G G'_draw hcuffs_ne X' hX'_sch hX'_norm + classical + rcases hX'_sch.1 with hO | hX1 | hX2 | hX3 + · exfalso + have hval_oarc : IsOArc ((Subtype.val : S' → Z) '' X') := by + obtain ⟨φ⟩ := hO + exact ⟨φ.trans (IsEmbedding.subtypeVal.homeomorphImage X')⟩ + obtain ⟨M₁, M₂, -, hM₁, hM₂, hbM₁, hbM₂, hcupM, hcapM, -, -⟩ := + sphere_disc Z hSphZ _ hval_oarc + have hdisj_idx : ∀ k : Fin 3, ¬ (P k ⊆ M₁ ∧ P k ⊆ M₂) := by + intro k ⟨hk1, hk2⟩ + obtain ⟨q, hq⟩ := (hP k).nonempty_discInt + have hq_cap : q ∈ M₁ ∩ M₂ := ⟨hk1 hq.1, hk2 hq.1⟩ + rw [hcapM] at hq_cap + obtain ⟨y, _, rfl⟩ := hq_cap + exact hq.2 (discComplement_inter_disc_subset_boundary hCS_Z P hP k ⟨y.2, hq.1⟩) + have hone_M : (∀ i k : Fin 3, P i ⊆ M₁ → P k ⊆ M₁ → i = k) ∨ + (∀ i k : Fin 3, P i ⊆ M₂ → P k ⊆ M₂ → i = k) := by + by_contra hnot + push Not at hnot + obtain ⟨⟨i₁, k₁, hi₁, hk₁, hne₁⟩, ⟨i₂, k₂, hi₂, hk₂, hne₂⟩⟩ := hnot + have hcard₁ : 2 ≤ (Finset.univ.filter (fun i : Fin 3 => P i ⊆ M₁)).card := + Finset.one_lt_card.mpr ⟨i₁, Finset.mem_filter.mpr ⟨Finset.mem_univ _, hi₁⟩, + k₁, Finset.mem_filter.mpr ⟨Finset.mem_univ _, hk₁⟩, hne₁⟩ + have hcard₂ : 2 ≤ (Finset.univ.filter (fun i : Fin 3 => P i ⊆ M₂)).card := + Finset.one_lt_card.mpr ⟨i₂, Finset.mem_filter.mpr ⟨Finset.mem_univ _, hi₂⟩, + k₂, Finset.mem_filter.mpr ⟨Finset.mem_univ _, hk₂⟩, hne₂⟩ + have hdisj_fin : Disjoint (Finset.univ.filter (fun i : Fin 3 => P i ⊆ M₁)) + (Finset.univ.filter (fun i : Fin 3 => P i ⊆ M₂)) := by + rw [Finset.disjoint_left] + intro k hkM₁ hkM₂ + exact hdisj_idx k ⟨(Finset.mem_filter.mp hkM₁).2, (Finset.mem_filter.mp hkM₂).2⟩ + have hle3 : (Finset.univ.filter (fun i : Fin 3 => P i ⊆ M₁) ∪ + Finset.univ.filter (fun i : Fin 3 => P i ⊆ M₂)).card ≤ Fintype.card (Fin 3) := + Finset.card_le_univ _ + rw [Finset.card_union_of_disjoint hdisj_fin, Fintype.card_fin] at hle3 + omega + rcases hone_M with hone₁ | hone₂ + · exact hX'_sch.2.1 (isNearPlanar_of_bounds_disc_including_at_most_one hCS_Z P hP hP_disj + hM₁ hbM₁ hone₁) + · exact hX'_sch.2.1 (isNearPlanar_of_bounds_disc_including_at_most_one hCS_Z P hP hP_disj + hM₂ hbM₂ hone₂) + · obtain ⟨B₁, B₂, P_line, a, b, hB₁, hB₂, hdisB, hP_line, ha, hb, hPB₁, hPB₂, rfl⟩ := hX1 + obtain ⟨K₁, K₂, hs₁, hs₂, hneK⟩ := + surrounding_cuffs_of_schismatic_x1 hS' hcuffs_ne hB₁ hB₂ hdisB hP_line ha hb hPB₁ hPB₂ + hX'_sch + exact ⟨B₁, B₂, K₁, K₂, subset_union_left.trans subset_union_left, + subset_union_right.trans subset_union_left, hB₁, hB₂, hs₁, hs₂, hneK⟩ + · obtain ⟨B₁, B₂, a, hB₁, hB₂, hcapB, rfl⟩ := hX2 + obtain ⟨K₁, K₂, hs₁, hs₂, hneK⟩ := + surrounding_cuffs_of_schismatic_x2 hS' hcuffs_ne hB₁ hB₂ hcapB hX'_sch + exact ⟨B₁, B₂, K₁, K₂, subset_union_left, subset_union_right, hB₁, hB₂, hs₁, hs₂, hneK⟩ + · obtain ⟨P₁, P₂, P₃, a, b, hab, hP₁, hP₂, hP₃, h12, h13, h23, rfl⟩ := hX3 + obtain ⟨K₁, K₂, _, hs₁, hs₂, _, hne12, _, _⟩ := + surrounding_pairs_of_schismatic_theta hS' hcuffs_ne hab hP₁ hP₂ hP₃ h12 h13 h23 hX'_sch + exact ⟨P₁ ∪ P₂, P₁ ∪ P₃, K₁, K₂, subset_union_left, + union_subset (subset_union_left.trans subset_union_left) subset_union_right, + isOArc_union_of_lines_inter_eq_ends hP₁ hP₂ h12, + isOArc_union_of_lines_inter_eq_ends hP₁ hP₃ h13, hs₁, hs₂, hne12⟩ + +private theorem pullback_candidate_is_arc_connected + {S : Type u} + {Z : Type u} + [TopologicalSpace S] + [TopologicalSpace Z] + {j : S → Z} + (hj : IsClosedEmbedding j) + (C_sub : Set Z) + (X' : Set ↥C_sub) : + let X : Set S := unliftEdge j C_sub X' + (Subtype.val '' X' ⊆ range j) → + (IsArcConnected X') → + IsArcConnected X := by + intro X hX'_val_range hX'_arc a ⟨a', ha', hja⟩ b ⟨b', hb', hjb⟩ hab + have ha'b' : a' ≠ b' := fun h => + hab (hj.injective (hja.symm.trans ((congrArg Subtype.val h).trans hjb))) + obtain ⟨R', hR'_sub, fR, hfR0, hfR1⟩ := hX'_arc a' ha' b' hb' ha'b' + let R : Set S := unliftEdge j C_sub R' + have hR_sub : R ⊆ X := fun x ⟨y, hy, hyx⟩ => ⟨y, hR'_sub hy, hyx⟩ + have hR'_range : (Subtype.val : ↥C_sub → Z) '' R' ⊆ range j := + (image_mono hR'_sub).trans hX'_val_range + let eR : R' ≃ₜ R := unliftEdgeHomeomorph hj.isEmbedding hR'_range + have hjeR : ∀ y : R', j (eR y).1 = y.1.1 := fun y => + congrArg Subtype.val ((hj.isEmbedding.homeomorphImage R).apply_symm_apply + ⟨y.1.1, (image_unliftEdge_of_subset hR'_range).symm ▸ ⟨y.1, y.2, rfl⟩⟩) + let φ : unitInterval ≃ₜ R := fR.trans eR + have hφ0 : (φ 0).1 = a := hj.injective (by + change j (eR (fR 0)).1 = j a + rw [hjeR, hfR0, hja]) + have hφ1 : (φ 1).1 = b := hj.injective (by + change j (eR (fR 1)).1 = j b + rw [hjeR, hfR1, hjb]) + exact ⟨R, hR_sub, φ, hφ0, hφ1⟩ + +private theorem pullback_candidate_is_preconnected + {S : Type u} + {Z : Type u} + [TopologicalSpace S] + [TopologicalSpace Z] + {j : S → Z} + (hj : IsClosedEmbedding j) + (C_sub : Set Z) : + ∀ (X' : Set ↥C_sub), + let X : Set S := unliftEdge j C_sub X' + (Subtype.val '' X' ⊆ range j) → + (IsConnected X') → + IsPreconnected X := by + intro X' X hX'_val_range hX'_conn + let e := unliftEdgeHomeomorph hj.isEmbedding hX'_val_range + have himg : (Subtype.val ∘ e) '' univ = X := by + ext x + constructor + · rintro ⟨y, _, rfl⟩ + exact (e y).2 + · intro hx + exact ⟨e.symm ⟨x, hx⟩, mem_univ _, congrArg Subtype.val (e.apply_symm_apply ⟨x, hx⟩)⟩ + have : ConnectedSpace X' := Subtype.connectedSpace hX'_conn + rw [← himg] + exact isPreconnected_univ.image _ (continuous_subtype_val.comp e.continuous).continuousOn + +private theorem pullback_candidate_meets_barrier + {S Z : Type u} [TopologicalSpace Z] {j : S → Z} {X : Set S} {C_sub : Set Z} + {X' B₁ B₂ : Set C_sub} (hB₁ : B₁ ⊆ X') (hB₂ : B₂ ⊆ X') + {i₁ i₂ : Fin 3} (hne : i₁ ≠ i₂) (hX : j '' X = Subtype.val '' X') + (P : Fin 3 → Set Z) (index : Fin 3) (hIndex : index ≠ 2) {barrier D₁ D₂ : Set Z} + (hBd₁ : discBd D₁ = Subtype.val '' B₁) (hOnly₁ : ∀ k, P k ⊆ D₁ ↔ k = i₁) + (hBd₂ : discBd D₂ = Subtype.val '' B₂) (hOnly₂ : ∀ k, P k ⊆ D₂ ↔ k = i₂) + (hMeet₁ : (P index ⊆ D₁ ∧ ¬ P 2 ⊆ D₁) ∨ (¬ P index ⊆ D₁ ∧ P 2 ⊆ D₁) → + (discBd D₁ ∩ barrier).Nonempty) + (hMeet₂ : (P index ⊆ D₂ ∧ ¬ P 2 ⊆ D₂) ∨ (¬ P index ⊆ D₂ ∧ P 2 ⊆ D₂) → + (discBd D₂ ∩ barrier).Nonempty) : + (j '' X ∩ barrier).Nonempty := by + have selectDisc : ∀ k a b : Fin 3, k ≠ 2 → a ≠ b → + (a = k ∨ a = 2) ∨ (b = k ∨ b = 2) := by decide + have meet {B : Set C_sub} {D : Set Z} {i : Fin 3} (hB : B ⊆ X') + (hBd : discBd D = Subtype.val '' B) (hOnly : ∀ k, P k ⊆ D ↔ k = i) + (hMeet : (P index ⊆ D ∧ ¬ P 2 ⊆ D) ∨ (¬ P index ⊆ D ∧ P 2 ⊆ D) → + (discBd D ∩ barrier).Nonempty) (hi : i = index ∨ i = 2) : + (Subtype.val '' X' ∩ barrier).Nonempty := by + have hinter : (discBd D ∩ barrier).Nonempty := by + apply hMeet + rcases hi with h | h + · exact Or.inl + ⟨(hOnly index).mpr h.symm, fun hp => hIndex (h.symm.trans ((hOnly 2).mp hp).symm)⟩ + · exact Or.inr ⟨fun hp => hIndex (((hOnly index).mp hp).trans h), (hOnly 2).mpr h.symm⟩ + rw [hBd] at hinter + exact hinter.mono (inter_subset_inter_left _ (image_mono hB)) + rw [hX] + rcases selectDisc index i₁ i₂ hIndex hne with h | h + · exact meet hB₁ hBd₁ hOnly₁ hMeet₁ h + · exact meet hB₂ hBd₂ hOnly₂ hMeet₂ h + +private theorem one_candidate_disc_surrounds_original_cuff + {Z : Type u} + [TopologicalSpace Z] + (P : Fin 3 → Set Z) + (C_sub : Set Z) + (X' : Set ↥C_sub) + (B₁ : Set ↥C_sub) + (B₂ : Set ↥C_sub) + (hB₁_sub : B₁ ⊆ X') + (hB₂_sub : B₂ ⊆ X') + (i₁ : Fin 3) + (i₂ : Fin 3) + (hi₁i₂_ne : i₁ ≠ i₂) + (D_B₁ : Set Z) + (hDB₁ : IsClosedDisc D_B₁) + (hbdB₁ : discBd D_B₁ = Subtype.val '' B₁) + (honeB₁ : ∀ (j : Fin 3), P j ⊆ D_B₁ ↔ j = i₁) + (D_B₂ : Set Z) + (hDB₂ : IsClosedDisc D_B₂) + (hbdB₂ : discBd D_B₂ = Subtype.val '' B₂) + (honeB₂ : ∀ (j : Fin 3), P j ⊆ D_B₂ ↔ j = i₂) : + ∃ B₀ D₀ i₀, B₀ ⊆ X' ∧ IsClosedDisc D₀ ∧ discBd D₀ = Subtype.val '' B₀ ∧ (∀ (k : Fin 3), P k ⊆ + D₀ ↔ k = i₀) ∧ (i₀ = 0 ∨ i₀ = 1) := by + have h01 : (i₁ = 0 ∨ i₁ = 1) ∨ (i₂ = 0 ∨ i₂ = 1) := by + fin_cases i₁ <;> fin_cases i₂ <;> first | exact (hi₁i₂_ne rfl).elim | decide + rcases h01 with hi₁ | hi₂ + · exact ⟨B₁, D_B₁, i₁, hB₁_sub, hDB₁, hbdB₁, honeB₁, hi₁⟩ + · exact ⟨B₂, D_B₂, i₂, hB₂_sub, hDB₂, hbdB₂, honeB₂, hi₂⟩ + +private theorem pulled_disc_sides_cover_cylinder + {S : Type u} + {Z : Type u} + [TopologicalSpace Z] + {j : S → Z} + (D₀ : Set Z) + (D₀' : Set Z) + (hD₀'_compl : D₀' = (discInt D₀)ᶜ) : + j ⁻¹' D₀ ∪ j ⁻¹' D₀' = univ ∧ j ⁻¹' D₀' ∪ j ⁻¹' D₀ = univ := by + have h1 : (j ⁻¹' D₀) ∪ (j ⁻¹' D₀') = univ := by + ext x + simp only [mem_union, mem_preimage, hD₀'_compl, mem_compl_iff, discInt, mem_sdiff, + not_and, not_not, mem_univ, iff_true] + by_cases hx : j x ∈ D₀ + · exact Or.inl hx + · exact Or.inr fun h => (hx h).elim + exact ⟨h1, union_comm (j ⁻¹' D₀) (j ⁻¹' D₀') ▸ h1⟩ + +private theorem pulled_disc_sides_meet_along_candidate + {S : Type u} + {Z : Type u} + [TopologicalSpace S] + [TopologicalSpace Z] + {j : S → Z} + (hj : IsClosedEmbedding j) + (D₀ : Set Z) + (A : Set S) + (hjA_eq : j '' A = discBd D₀) + (D₀' : Set Z) + (hD₀'_compl : D₀' = (discInt D₀)ᶜ) : + j ⁻¹' D₀ ∩ j ⁻¹' D₀' ⊆ A ∧ j ⁻¹' D₀' ∩ j ⁻¹' D₀ ⊆ A := by + have h1 : (j ⁻¹' D₀) ∩ (j ⁻¹' D₀') ⊆ A := by + intro x ⟨hxD₀, hxD₀'⟩ + rw [mem_preimage, hD₀'_compl, mem_compl_iff, discInt, mem_sdiff, not_and, + not_not] at hxD₀' + have hjx_A : j x ∈ j '' A := hjA_eq ▸ hxD₀' hxD₀ + obtain ⟨x', hx'A, hx'_eq⟩ := hjx_A + exact hj.injective hx'_eq ▸ hx'A + exact ⟨h1, inter_comm (j ⁻¹' D₀) (j ⁻¹' D₀') ▸ h1⟩ + +/-- **Graph Minors VII, (9.3), Claim 2** (page 245): +"*Claim 2. As a drawing in $\Sigma'$, $G$ satisfies $\alpha(G) \ge r$.*" -/ +theorem lemma_9_3_claim_2 {S Z : Type u} [TopologicalSpace S] [T2Space S] + [TopologicalSpace Z] [T2Space Z] [ConnectedSpace Z] + (hCS_Z : IsClosedSurface Z) (hSphZ : IsSphere Z) {j : S → Z} (hj : IsClosedEmbedding j) + (G : Drawing S) {F₁ F₂ barI₁ barI₂ : Set S} {u v z : S} {r m : ℕ} + (hDisj : Disjoint F₁ F₂) + (hbarI₁_norm : G.IsNormal barI₁) (hbarI₂_norm : G.IsNormal barI₂) + (hbarI₁_ends : IsLineWithEnds barI₁ u z) (hbarI₂_ends : IsLineWithEnds barI₂ z v) + (hu : u ∈ barI₁ ∩ F₂) (hbarI₁_disj : Disjoint barI₁ F₁) + (hv : v ∈ barI₂ ∩ F₁) (hbarI₂_disj : Disjoint barI₂ F₂) + (h2r : 2 * r ≤ m) + (hbarI₁_ncard : (G.V ∩ barI₁).ncard = r) (hbarI₂_ncard : (G.V ∩ barI₂).ncard = m - r) + (hmin : ∀ F : Set S, G.IsNormal F → IsLine F → (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → + m ≤ (G.V ∩ F).ncard) + {D₁ D₂ D₃ E₁ E₂ E₁' E₂' : Set Z} + (hD₁ : IsClosedDisc D₁) (hD₂ : IsClosedDisc D₂) (hD₃ : IsClosedDisc D₃) + (hP_disj : Pairwise (fun i k : Fin 3 => Disjoint (![D₁, D₂, D₃] i) (![D₁, D₂, D₃] k))) + (havoid : ∀ i : Fin 3, (embedDrawing hj G).U ∩ ![D₁, D₂, D₃] i = + (embedDrawing hj G).V ∩ discBd (![D₁, D₂, D₃] i)) + (hrange_eq : range j = discComplement ![D₁, D₂]) + (hE₁ : IsClosedDisc E₁) (hbE₁ : discBd E₁ = j '' F₁) + (hE₂ : IsClosedDisc E₂) (hbE₂ : discBd E₂ = j '' F₂) + (hE₁' : IsClosedDisc E₁') (hbE₁' : discBd E₁' = j '' F₁) (hE₁'_compl : E₁' = (discInt E₁)ᶜ) + (hE₂' : IsClosedDisc E₂') (hE₂'_compl : E₂' = (discInt E₂)ᶜ) + (hD₁_in_E₂ : D₁ ⊆ discInt E₂) (hE₂_in_E₁ : E₂ ⊆ discInt E₁) + (hD₂_in_E₁' : D₂ ⊆ discInt E₁') (hE₁'_in_E₂' : E₁' ⊆ discInt E₂') + (hbarI₁_in_E₁ : j '' barI₁ ⊆ discInt E₁) (hbarI₂_in_E₂' : j '' barI₂ ⊆ discInt E₂') + (hjz_D₃ : j z ∈ discInt D₃) + (hk12 : r ≤ maxDisjointPaths G F₁ F₂) : + let P : Fin 3 → Set Z := ![D₁, D₂, D₃] + let hP : ∀ i, IsClosedDisc (P i) := fun i => by + fin_cases i + · exact hD₁ + · exact hD₂ + · exact hD₃ + r ≤ alpha (drawingInSubspace (embedDrawing hj G) (discComplement P) + (drawing_support_subset_discComplement hCS_Z (embedDrawing hj G) P hP hP_disj havoid)) := by + classical + intro P hP + have hmanZ : ∀ x : Z, IsManifoldPoint x := fun x => (hCS_Z.2.2 x).isManifoldPoint + let Γ := embedDrawing hj G + let C_sub := discComplement P + let S' : Type u := ↥C_sub + have hS' : IsSurface S' := discComplement_isSurface hCS_Z P hP hP_disj + have : T2Space S' := hS'.2.1 + have : ConnectedSpace S' := Subtype.connectedSpace (discComplement_isConnected hCS_Z P hP hP_disj) + have hUC_G := drawing_support_subset_discComplement hCS_Z Γ P hP hP_disj havoid + let G'_draw := drawingInSubspace Γ C_sub hUC_G + have hcuffs_eq := discComplement_cuffs_eq hCS_Z P hP hP_disj + have hcuffs_ne : (cuffs S').Nonempty := by + rw [hcuffs_eq] + exact ⟨_, 0, rfl⟩ + have hbd_ne : bd S' ≠ ∅ := by + rw [← sUnion_cuffs] + obtain ⟨C₀, hC₀⟩ := hcuffs_ne + obtain ⟨x₀, hx₀⟩ := isOArc_nonempty (cuff_isOArc hS' hC₀) + exact nonempty_iff_ne_empty.mp ⟨x₀, C₀, hC₀, hx₀⟩ + have hnsS' : ¬ IsSphere S' := not_isSphere_of_bd_ne_empty hbd_ne + have hex_cand : ∃ X', IsAlphaCandidate G'_draw X' := + exists_alphaCandidate_of_two_prescribed_cuffs hCS_Z Γ P hP hP_disj + (Or.inr (by simp)) havoid (by decide : (0 : Fin 3) ≠ 1) + have h51 : GM07Theorem51Statement.{u} := fun M _ hM _ X hX_solid hX_ne => + @theorem_5_1_proof M _ hM _ X hX_solid hX_ne + have hP₂ : ∀ i : Fin 2, IsClosedDisc (![D₁, D₂] i) := fun i => by + fin_cases i + · exact hD₁ + · exact hD₂ + have hP₂_disj : Pairwise (fun i k : Fin 2 => Disjoint (![D₁, D₂] i) (![D₁, D₂] k)) := fun i k hik + => by + fin_cases i <;> fin_cases k + · exact (hik rfl).elim + · exact hP_disj (by decide : (0 : Fin 3) ≠ 1) + · exact hP_disj (by decide : (1 : Fin 3) ≠ 0) + · exact (hik rfl).elim + have hC_sub_range : C_sub ⊆ range j := by + rw [hrange_eq] + intro w hw + rw [mem_discComplement_iff hCS_Z P hP hP_disj] at hw + rw [mem_discComplement_iff hCS_Z ![D₁, D₂] hP₂ hP₂_disj] + intro i + fin_cases i + · exact hw 0 + · exact hw 1 + apply alpha_ge_of_schismatic_counts G'_draw hex_cand (exists_schismatic_of_isAlphaCandidate hS' + hnsS' G'_draw) + intro X' hX'_sch hX'_norm + -- Step 1: Extract two O-arcs B₁, B₂ ⊆ X' surrounding distinct cuffs of S' + have hex_two_cuffs : ∃ (B₁ B₂ : Set S') (K₁ K₂ : Set S'), + B₁ ⊆ X' ∧ B₂ ⊆ X' ∧ IsOArc B₁ ∧ IsOArc B₂ ∧ + SurroundsCuff B₁ K₁ ∧ SurroundsCuff B₂ K₂ ∧ K₁ ≠ K₂ := by + exact two_cuffs_supply_discs_inside_candidate hCS_Z hSphZ (D₁ := D₁) (D₂ := D₂) (D₃ := D₃) + Γ hP_disj hP hS' hUC_G hcuffs_ne X' hX'_sch hX'_norm + obtain ⟨B₁, B₂, K₁, K₂, hB₁_sub, hB₂_sub, hB₁_oarc, hB₂_oarc, hs₁, hs₂, hK₁K₂_ne⟩ := hex_two_cuffs + have hK₁_mem : K₁ ∈ cuffs S' := hs₁.1 + have hK₂_mem : K₂ ∈ cuffs S' := hs₂.1 + rw [hcuffs_eq] at hK₁_mem hK₂_mem + obtain ⟨i₁, rfl⟩ := hK₁_mem + obtain ⟨i₂, rfl⟩ := hK₂_mem + have hi₁i₂_ne : i₁ ≠ i₂ := by + rintro rfl + exact hK₁K₂_ne rfl + -- Step 2: Pull X' back to S as X := unliftEdge j C_sub X' + let X : Set S := unliftEdge j C_sub X' + have hX'_val_range : (Subtype.val : S' → Z) '' X' ⊆ range j := + (image_subset_iff.mpr fun y _ => y.2).trans hC_sub_range + have hjX_eq : j '' X = (Subtype.val : S' → Z) '' X' := + image_unliftEdge_of_subset hX'_val_range + obtain ⟨hX'_sol, hX'_conn⟩ := hX'_sch.isSolid_and_isConnected hS' + have hX'_arc : IsArcConnected X' := theorem_11_4_proof hS' hX'_conn hX'_sol.1 + have hX_arc : IsArcConnected X := by + exact pullback_candidate_is_arc_connected (S := S) (Z := Z) (j := j) hj C_sub X' + hX'_val_range hX'_arc + have hX_pre : IsPreconnected X := by + exact pullback_candidate_is_preconnected (S := S) (Z := Z) (j := j) hj C_sub X' + hX'_val_range hX'_conn + have hX_norm : G.IsNormal X := + drawingInSubspace_embedDrawing_isNormal_unliftEdge hj G C_sub hUC_G hX'_norm + have hVX_eq : (X' ∩ G'_draw.V).ncard = (G.V ∩ X).ncard := by + rw [inter_comm, drawingInSubspace_embedDrawing_V_inter_unliftEdge_ncard hj G C_sub hUC_G X'] + rw [hVX_eq] + have hmeets_E := meets_F₁_or_F₂_of_meets_E hj hE₁ hbE₁ hE₂ hbE₂ hE₁' hE₁'_compl hE₂' hE₂'_compl + hE₂_in_E₁ hE₁'_in_E₂' hbarI₁_in_E₁ hbarI₂_in_E₂' hX_pre + -- Step 3: For each surrounding circle B_m, obtain the disc D_m in Z + obtain ⟨D_B₁, hDB₁, hbdB₁, honeB₁⟩ := + surrounding_bounds_disc_including_exactly_one hCS_Z P hP hP_disj i₁ hB₁_oarc hs₁ + obtain ⟨D_B₂, hDB₂, hbdB₂, honeB₂⟩ := + surrounding_bounds_disc_including_exactly_one hCS_Z P hP hP_disj i₂ hB₂_oarc hs₂ + have hbdB₁_sub : discBd D_B₁ ⊆ C_sub := by rw [hbdB₁]; rintro _ ⟨y, _, rfl⟩; exact y.2 + have hbdB₂_sub : discBd D_B₂ ⊆ C_sub := by rw [hbdB₂]; rintro _ ⟨y, _, rfl⟩; exact y.2 + have hDB₁_K := discBd_meets_K₁_or_K₂ hCS_Z hSphZ hj hbarI₁_ends hbarI₂_ends hu hv + hD₁ hD₂ hD₃ hE₂ hbE₂ hE₁' hbE₁' hD₁_in_E₂ hD₂_in_E₁' hjz_D₃ hDB₁ hbdB₁_sub + have hDB₂_K := discBd_meets_K₁_or_K₂ hCS_Z hSphZ hj hbarI₁_ends hbarI₂_ends hu hv + hD₁ hD₂ hD₃ hE₂ hbE₂ hE₁' hbE₁' hD₁_in_E₂ hD₂_in_E₁' hjz_D₃ hDB₂ hbdB₂_sub + have hX_meets_K₁ : (j '' X ∩ (E₂ ∪ j '' barI₁)).Nonempty := + pullback_candidate_meets_barrier hB₁_sub hB₂_sub hi₁i₂_ne hjX_eq P 0 (by decide) + hbdB₁ honeB₁ hbdB₂ honeB₂ hDB₁_K.1 hDB₂_K.1 + have hX_meets_K₂ : (j '' X ∩ (E₁' ∪ j '' barI₂)).Nonempty := + pullback_candidate_meets_barrier hB₁_sub hB₂_sub hi₁i₂_ne hjX_eq P 1 (by decide) + hbdB₁ honeB₁ hbdB₂ honeB₂ hDB₁_K.2 hDB₂_K.2 + -- Step 4: Case split on whether j '' X meets E₁' or E₂ + by_cases hXE₁' : (j '' X ∩ E₁').Nonempty + · exact ncard_ge_of_arcConnected_meets G hDisj hbarI₁_norm hbarI₂_norm + hbarI₁_ends hbarI₂_ends hu hbarI₁_disj hv hbarI₂_disj h2r hbarI₁_ncard hbarI₂_ncard hmin + hX_norm hX_arc (Or.inl (hmeets_E.1 ⟨hXE₁', hX_meets_K₁⟩)) + · by_cases hXE₂ : (j '' X ∩ E₂).Nonempty + · exact ncard_ge_of_arcConnected_meets G hDisj hbarI₁_norm hbarI₂_norm + hbarI₁_ends hbarI₂_ends hu hbarI₁_disj hv hbarI₂_disj h2r hbarI₁_ncard hbarI₂_ncard hmin + hX_norm hX_arc (Or.inr (hmeets_E.2 ⟨hXE₂, hX_meets_K₂⟩)) + · -- Neither E₁' nor E₂ meets j '' X; take the circle B₀ ⊆ X' surrounding P 0 or P 1 + have hex_B₀ : ∃ (B₀ : Set S') (D₀ : Set Z) (i₀ : Fin 3), + B₀ ⊆ X' ∧ IsClosedDisc D₀ ∧ discBd D₀ = (Subtype.val : S' → Z) '' B₀ ∧ + (∀ k, P k ⊆ D₀ ↔ k = i₀) ∧ (i₀ = 0 ∨ i₀ = 1) := by + exact one_candidate_disc_surrounds_original_cuff (Z := Z) P C_sub X' B₁ B₂ + hB₁_sub hB₂_sub i₁ i₂ hi₁i₂_ne D_B₁ hDB₁ hbdB₁ honeB₁ D_B₂ hDB₂ hbdB₂ honeB₂ + obtain ⟨B₀, D₀, i₀, hB₀_sub, hD₀, hbdD₀, honeD₀, hi₀⟩ := hex_B₀ + let A : Set S := unliftEdge j C_sub B₀ + have hA_sub_X : A ⊆ X := fun x ⟨y, hy, hyx⟩ => ⟨y, hB₀_sub hy, hyx⟩ + have hA_norm : G.IsNormal A := fun x hx => hX_norm ⟨hA_sub_X hx.1, hx.2⟩ + have hB₀_val_range : (Subtype.val : S' → Z) '' B₀ ⊆ range j := + (image_mono hB₀_sub).trans hX'_val_range + have hjA_eq : j '' A = discBd D₀ := by + rw [hbdD₀, image_unliftEdge_of_subset hB₀_val_range] + have hbdD₀_disj_E₁' : Disjoint E₁' (discBd D₀) := by + rw [← hjA_eq, disjoint_left] + intro w hwE₁' hwA + exact hXE₁' ⟨w, image_mono hA_sub_X hwA, hwE₁'⟩ + have hbdD₀_disj_E₂ : Disjoint E₂ (discBd D₀) := by + rw [← hjA_eq, disjoint_left] + intro w hwE₂ hwA + exact hXE₂ ⟨w, image_mono hA_sub_X hwA, hwE₂⟩ + obtain ⟨D₀', hD₀', _, hD₀'_compl, _⟩ := exists_compl_disc_in_sphere hSphZ hD₀ + have hcover_candidate_disc : (j ⁻¹' D₀) ∪ (j ⁻¹' D₀') = univ ∧ (j ⁻¹' D₀') ∪ (j ⁻¹' D₀) + = univ := by + exact pulled_disc_sides_cover_cylinder (S := S) (Z := Z) (j := j) D₀ D₀' hD₀'_compl + have hinter_candidate_disc : (j ⁻¹' D₀) ∩ (j ⁻¹' D₀') ⊆ A ∧ (j ⁻¹' D₀') ∩ (j ⁻¹' D₀) ⊆ A := by + exact pulled_disc_sides_meet_along_candidate (S := S) (Z := Z) (j := j) hj D₀ A hjA_eq D₀' + hD₀'_compl + obtain ⟨p₁, hp₁⟩ := hD₁.nonempty_discInt + obtain ⟨p₂, hp₂⟩ := hD₂.nonempty_discInt + have hp₁_E₂ : p₁ ∈ E₂ := (hD₁_in_E₂ hp₁.1).1 + have hp₂_E₁' : p₂ ∈ E₁' := (hD₂_in_E₁' hp₂.1).1 + have hVA_le : (G.V ∩ A).ncard ≤ (G.V ∩ X).ncard := + Set.ncard_le_ncard (inter_subset_inter_right G.V hA_sub_X) (G.finite_V.inter_of_left X) + rcases hi₀ with rfl | rfl + · -- i₀ = 0: D₁ ⊆ D₀ and ¬ D₂ ⊆ D₀ + have hp₁_D₀ : p₁ ∈ D₀ := (honeD₀ 0).mpr rfl hp₁.1 + have hD₂_not : ¬ D₂ ⊆ D₀ := fun h => by have := (honeD₀ 1).mp h; revert this; decide + have hE₂_in_D₀ : E₂ ⊆ discInt D₀ := by + rcases hD₀.side hmanZ hE₂.isPreconnected hbdD₀_disj_E₂ with hin | hout + · exact hin + · exact (disjoint_left.mp hout hp₁_E₂ hp₁_D₀).elim + have hE₁'_in_D₀' : E₁' ⊆ D₀' := by + rcases hD₀.side hmanZ hE₁'.isPreconnected hbdD₀_disj_E₁' with hin | hout + · exfalso + apply hD₂_not + intro w hwD₂ + exact (hin (hD₂_in_E₁' hwD₂).1).1 + · rw [hD₀'_compl] + intro w hwE₁' hwD₀ + exact disjoint_left.mp hout hwE₁' hwD₀.1 + have hF₁_in_D₀' : F₁ ⊆ j ⁻¹' D₀' := fun x hx => + hE₁'_in_D₀' (Surface.discBd_subset E₁' (hbE₁'.symm ▸ mem_image_of_mem j hx)) + have hF₂_in_D₀ : F₂ ⊆ j ⁻¹' D₀ := fun x hx => + (hE₂_in_D₀ (Surface.discBd_subset E₂ (hbE₂.symm ▸ mem_image_of_mem j hx))).1 + have hk_le := maxDisjointPaths_le_of_closed_cover G hA_norm + (hD₀'.isClosed.preimage hj.continuous) (hD₀.isClosed.preimage hj.continuous) + hcover_candidate_disc.2 hinter_candidate_disc.2 hF₁_in_D₀' hF₂_in_D₀ + exact (hk12.trans hk_le).trans hVA_le + · -- i₀ = 1: D₂ ⊆ D₀ and ¬ D₁ ⊆ D₀ + have hp₂_D₀ : p₂ ∈ D₀ := (honeD₀ 1).mpr rfl hp₂.1 + have hD₁_not : ¬ D₁ ⊆ D₀ := fun h => by have := (honeD₀ 0).mp h; revert this; decide + have hE₁'_in_D₀ : E₁' ⊆ discInt D₀ := by + rcases hD₀.side hmanZ hE₁'.isPreconnected hbdD₀_disj_E₁' with hin | hout + · exact hin + · exact (disjoint_left.mp hout hp₂_E₁' hp₂_D₀).elim + have hE₂_in_D₀' : E₂ ⊆ D₀' := by + rcases hD₀.side hmanZ hE₂.isPreconnected hbdD₀_disj_E₂ with hin | hout + · exfalso + apply hD₁_not + intro w hwD₁ + exact (hin (hD₁_in_E₂ hwD₁).1).1 + · rw [hD₀'_compl] + intro w hwE₂ hwD₀ + exact disjoint_left.mp hout hwE₂ hwD₀.1 + have hF₁_in_D₀ : F₁ ⊆ j ⁻¹' D₀ := fun x hx => + (hE₁'_in_D₀ (Surface.discBd_subset E₁' (hbE₁'.symm ▸ mem_image_of_mem j hx))).1 + have hF₂_in_D₀' : F₂ ⊆ j ⁻¹' D₀' := fun x hx => + hE₂_in_D₀' (Surface.discBd_subset E₂ (hbE₂.symm ▸ mem_image_of_mem j hx)) + have hk_le := maxDisjointPaths_le_of_closed_cover G hA_norm + (hD₀.isClosed.preimage hj.continuous) (hD₀'.isClosed.preimage hj.continuous) + hcover_candidate_disc.1 hinter_candidate_disc.1 hF₁_in_D₀ hF₂_in_D₀' + exact (hk12.trans hk_le).trans hVA_le + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section9CylinderProved.lean b/LeanPool/GraphMinor/GM07/Section9CylinderProved.lean new file mode 100644 index 0000000000..1d752f78f2 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section9CylinderProved.lean @@ -0,0 +1,724 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section9CoreProved +import LeanPool.GraphMinor.GM07.Section9Cylinder +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Section8 +import LeanPool.GraphMinor.GM07.CuffForest +import LeanPool.GraphMinor.Surface.DiscsInSurface +import LeanPool.GraphMinor.GM12.Section2ChordGap +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs +import LeanPool.GraphMinor.GM12.Section3NormalPuncturedPaths +import LeanPool.GraphMinor.GM12.Section3BoundaryLinked +import LeanPool.GraphMinor.GM12.Section3CandidateExistence +import LeanPool.GraphMinor.GM12.Section3Alpha +import LeanPool.GraphMinor.GM12.Section3NearPlanarCircle +import LeanPool.GraphMinor.GM12.Section3LoopCuffClassification +import LeanPool.GraphMinor.GM12.Section3ThetaSurrounding + +/-! +# The punctured-cylinder deduction of Graph Minors VII, (9.3) + +Claims 1 and 2 establish boundary linkage and the required lower bound on +the punctured cylinder. Applying the proved (9.1) gives the boundary-rooted minor. +-/ + +public section +namespace GraphMinor.GM07 +open Set Topology Function Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM12 +universe u + +private theorem cylinder_has_normal_line_between_boundaries + (S : Type u) + [TopologicalSpace S] + (C₁ : Set S) + (C₂ : Set S) + (G : SurfaceDigraph S) + (hG : G.IsProper) + (F₁ : Set S) + (F₂ : Set S) + (hF₁ : G.G.IsNormal F₁) + (hF₂ : G.G.IsNormal F₂) + (hbdS : bd S = C₁ ∪ C₂) + (hO₁ : IsOArc F₁) + (hO₂ : IsOArc F₂) + (hDisj : Disjoint F₁ F₂) + (Z : Type u) + [TopologicalSpace Z] + (j : S → Z) + (D₁ : Set Z) + (D₂ : Set Z) + (hCS_Z : IsClosedSurface Z) + (hj : IsClosedEmbedding j) + (hD₁ : IsClosedDisc D₁) + (hD₂ : IsClosedDisc D₂) + (hD₁D₂_disj : Disjoint D₁ D₂) + (hbD₁ : discBd D₁ = j '' C₁) + (hbD₂ : discBd D₂ = j '' C₂) + (hinter₁ : range j ∩ D₁ = j '' C₁) + (hinter₂ : range j ∩ D₂ = j '' C₂) + (hrange_eq : range j = discComplement ![D₁, D₂]) + [T2Space Z] + [ConnectedSpace Z] : + ∃ F, G.G.IsNormal F ∧ IsLine F ∧ (F ∩ F₁).Nonempty ∧ (F ∩ F₂).Nonempty := by + let Γ₀ := embedDrawing hj G.G + let P₂ : Fin 2 → Set Z := ![D₁, D₂] + have hP₂ : ∀ i, IsClosedDisc (P₂ i) := fun i => by + fin_cases i + · exact hD₁ + · exact hD₂ + have hP₂_disj : Pairwise (fun i k => Disjoint (P₂ i) (P₂ k)) := fun i k hik => by + fin_cases i <;> fin_cases k + · exact (hik rfl).elim + · exact hD₁D₂_disj + · exact hD₁D₂_disj.symm + · exact (hik rfl).elim + have havoid₂ : ∀ i : Fin 2, Γ₀.U ∩ P₂ i = Γ₀.V ∩ discBd (P₂ i) := by + intro i + fin_cases i + · change j '' G.G.U ∩ D₁ = j '' G.G.V ∩ discBd D₁ + rw [hbD₁] + ext w + constructor + · rintro ⟨⟨x, hxU, rfl⟩, hwD₁⟩ + have hjx : j x ∈ range j ∩ D₁ := ⟨mem_range_self x, hwD₁⟩ + rw [hinter₁] at hjx + obtain ⟨c, hc, hcj⟩ := hjx + have hxc : x = c := hj.injective hcj.symm + have hxV : x ∈ G.G.V := hG ⟨hbdS ▸ Or.inl (hxc ▸ hc), hxU⟩ + exact ⟨⟨x, hxV, rfl⟩, ⟨x, hxc ▸ hc, rfl⟩⟩ + · rintro ⟨⟨x, hxV, rfl⟩, hwC₁⟩ + have hwD₁ : j x ∈ D₁ := Surface.discBd_subset D₁ (hbD₁.symm ▸ hwC₁) + exact ⟨⟨x, G.G.V_subset_U hxV, rfl⟩, hwD₁⟩ + · change j '' G.G.U ∩ D₂ = j '' G.G.V ∩ discBd D₂ + rw [hbD₂] + ext w + constructor + · rintro ⟨⟨x, hxU, rfl⟩, hwD₂⟩ + have hjx : j x ∈ range j ∩ D₂ := ⟨mem_range_self x, hwD₂⟩ + rw [hinter₂] at hjx + obtain ⟨c, hc, hcj⟩ := hjx + have hxc : x = c := hj.injective hcj.symm + have hxV : x ∈ G.G.V := hG ⟨hbdS ▸ Or.inr (hxc ▸ hc), hxU⟩ + exact ⟨⟨x, hxV, rfl⟩, ⟨x, hxc ▸ hc, rfl⟩⟩ + · rintro ⟨⟨x, hxV, rfl⟩, hwC₂⟩ + have hwD₂ : j x ∈ D₂ := Surface.discBd_subset D₂ (hbD₂.symm ▸ hwC₂) + exact ⟨⟨x, G.G.V_subset_U hxV, rfl⟩, hwD₂⟩ + obtain ⟨x₁, hx₁⟩ := isOArc_nonempty hO₁ + obtain ⟨x₂, hx₂⟩ := isOArc_nonempty hO₂ + have hjx₁_C : j x₁ ∈ discComplement P₂ := hrange_eq ▸ mem_range_self x₁ + have hjx₂_C : j x₂ ∈ discComplement P₂ := hrange_eq ▸ mem_range_self x₂ + have hjx₁_N : j x₁ ∈ Γ₀.Uᶜ ∪ Γ₀.V := by + by_cases hxU : x₁ ∈ G.G.U + · exact Or.inr ⟨x₁, hF₁ ⟨hx₁, hxU⟩, rfl⟩ + · exact Or.inl fun ⟨y, hyU, hyx⟩ => hxU (hj.injective hyx ▸ hyU) + have hjx₂_N : j x₂ ∈ Γ₀.Uᶜ ∪ Γ₀.V := by + by_cases hxU : x₂ ∈ G.G.U + · exact Or.inr ⟨x₂, hF₂ ⟨hx₂, hxU⟩, rfl⟩ + · exact Or.inl fun ⟨y, hyU, hyx⟩ => hxU (hj.injective hyx ▸ hyU) + obtain ⟨q, hq_sub, hq_norm⟩ := exists_normal_path_in_discComplement hCS_Z Γ₀ P₂ hP₂ hP₂_disj + havoid₂ hjx₁_C hjx₂_C hjx₁_N hjx₂_N + have hx₁x₂_ne : j x₁ ≠ j x₂ := fun heq => + disjoint_left.mp hDisj hx₁ (hj.injective heq ▸ hx₂) + have hjoined : JoinedIn (range q) (j x₁) (j x₂) := + ⟨q, fun t => mem_range_self t⟩ + have hjx₁_q : j x₁ ∈ range q := ⟨0, q.source⟩ + have hjx₂_q : j x₂ ∈ range q := ⟨1, q.target⟩ + obtain ⟨L_Z, hLZ_sub, hLZ_ends⟩ := + ((joinedIn_iff_eq_or_exists_isLineWithEnds (Z := range q) hjx₁_q hjx₂_q).mp + hjoined).resolve_left hx₁x₂_ne + have hLZ_range : L_Z ⊆ range j := hLZ_sub.trans (hrange_eq ▸ hq_sub) + let L : Set S := j ⁻¹' L_Z + have hjL_eq : j '' L = L_Z := image_preimage_eq_iff.mpr hLZ_range + have hL_norm : G.G.IsNormal L := by + rintro x ⟨hxL, hxU⟩ + obtain ⟨y, hyV, hyx⟩ := hq_norm ⟨hLZ_sub hxL, ⟨x, hxU, rfl⟩⟩ + exact hj.injective hyx ▸ hyV + obtain ⟨fZ, _, _⟩ := id hLZ_ends + exact ⟨L, hL_norm, + ⟨fZ.trans ((Homeomorph.setCongr hjL_eq.symm).trans (hj.isEmbedding.homeomorphImage L).symm)⟩, + ⟨x₁, hLZ_ends.left_mem, hx₁⟩, ⟨x₂, hLZ_ends.right_mem, hx₂⟩⟩ + +private theorem first_half_line_lies_inside_outer_disc + (S : Type u) + [TopologicalSpace S] + (F₁ : Set S) + (F₂ : Set S) + (Z : Type u) + [TopologicalSpace Z] + (j : S → Z) + (E₁ : Set Z) + (E₂ : Set Z) + (hj : IsClosedEmbedding j) + (hE₁ : IsClosedDisc E₁) + (hbE₁ : discBd E₁ = j '' F₁) + (hbE₂ : discBd E₂ = j '' F₂) + (hE₂_in_E₁ : E₂ ⊆ discInt E₁) + [T2Space Z] + (hmanZ : ∀ (x : Z), IsManifoldPoint x) + (barI₁ : Set S) + (u : S) + (z : S) + (hbarI₁_ends : IsLineWithEnds barI₁ u z) + (hu : u ∈ barI₁ ∩ F₂) + (hbarI₁_disj : Disjoint barI₁ F₁) : + j '' barI₁ ⊆ discInt E₁ := by + have hpc : IsPreconnected (j '' barI₁) := + (IsLineWithEnds.isConnected hbarI₁_ends).2.image j hj.continuous.continuousOn + have hdisj_bd : Disjoint (j '' barI₁) (discBd E₁) := by + rw [hbE₁] + exact (disjoint_image_iff hj.injective).mpr hbarI₁_disj + rcases hE₁.side hmanZ hpc hdisj_bd with hin | hout + · exact hin + · have hju_in : j u ∈ discInt E₁ := hE₂_in_E₁ (Surface.discBd_subset E₂ + (hbE₂.symm ▸ mem_image_of_mem j hu.2)) + exact (disjoint_left.mp hout (mem_image_of_mem j hu.1) hju_in.1).elim + +private theorem second_half_line_lies_inside_inner_complement + (S : Type u) + [TopologicalSpace S] + (F₁ : Set S) + (F₂ : Set S) + (Z : Type u) + [TopologicalSpace Z] + (j : S → Z) + (E₁' : Set Z) + (E₂' : Set Z) + (hj : IsClosedEmbedding j) + (hbE₁' : discBd E₁' = j '' F₁) + (hE₂' : IsClosedDisc E₂') + (hbE₂' : discBd E₂' = j '' F₂) + (hE₁'_in_E₂' : E₁' ⊆ discInt E₂') + [T2Space Z] + (hmanZ : ∀ (x : Z), IsManifoldPoint x) + (barI₂ : Set S) + (v : S) + (z : S) + (hbarI₂_ends : IsLineWithEnds barI₂ z v) + (hv : v ∈ barI₂ ∩ F₁) + (hbarI₂_disj : Disjoint barI₂ F₂) : + j '' barI₂ ⊆ discInt E₂' := by + have hpc : IsPreconnected (j '' barI₂) := + (IsLineWithEnds.isConnected hbarI₂_ends).2.image j hj.continuous.continuousOn + have hdisj_bd : Disjoint (j '' barI₂) (discBd E₂') := by + rw [hbE₂'] + exact (disjoint_image_iff hj.injective).mpr hbarI₂_disj + rcases hE₂'.side hmanZ hpc hdisj_bd with hin | hout + · exact hin + · have hjv_in : j v ∈ discInt E₂' := hE₁'_in_E₂' (Surface.discBd_subset E₁' + (hbE₁'.symm ▸ mem_image_of_mem j hv.2)) + exact (disjoint_left.mp hout (mem_image_of_mem j hv.1) hjv_in.1).elim + +private theorem three_caps_pairwise_disjoint + (Z : Type u) + (D₁ : Set Z) + (D₂ : Set Z) + (hD₁D₂_disj : Disjoint D₁ D₂) + (D₃ : Set Z) + (hD₁D₃_disj : Disjoint D₁ D₃) + (hD₂D₃_disj : Disjoint D₂ D₃) : + let P : Fin 3 → Set Z := ![D₁, D₂, D₃] + ∀ (i k : Fin 3), i ≠ k → Disjoint (P i) (P k) := by + intro P i k hik + fin_cases i <;> fin_cases k + · exact (hik rfl).elim + · exact hD₁D₂_disj + · exact hD₁D₃_disj + · exact hD₁D₂_disj.symm + · exact (hik rfl).elim + · exact hD₂D₃_disj + · exact hD₁D₃_disj.symm + · exact hD₂D₃_disj.symm + · exact (hik rfl).elim + +private theorem graph_intersects_removed_discs_only_at_boundary_vertices + (S : Type u) + [TopologicalSpace S] + (C₁ : Set S) + (C₂ : Set S) + (G : SurfaceDigraph S) + (hG : G.IsProper) + (hbdS : bd S = C₁ ∪ C₂) + (Z : Type u) + [TopologicalSpace Z] + (j : S → Z) + (D₁ : Set Z) + (D₂ : Set Z) + (hj : IsClosedEmbedding j) + (hbD₁ : discBd D₁ = j '' C₁) + (hbD₂ : discBd D₂ = j '' C₂) + (hinter₁ : range j ∩ D₁ = j '' C₁) + (hinter₂ : range j ∩ D₂ = j '' C₂) + (Δ : Set S) + (hΔ_disj_G : Disjoint Δ G.G.U) : + let D₃ : Set Z := j '' Δ + let P : Fin 3 → Set Z := ![D₁, D₂, D₃] + ∀ (i : Fin 3), (embedDrawing hj G.G).U ∩ P i = (embedDrawing hj G.G).V ∩ discBd (P i) := by + intro D₃ P i + fin_cases i + · change j '' G.G.U ∩ D₁ = j '' G.G.V ∩ discBd D₁ + rw [hbD₁] + ext w + constructor + · rintro ⟨⟨x, hxU, rfl⟩, hwD₁⟩ + have hjx : j x ∈ range j ∩ D₁ := ⟨mem_range_self x, hwD₁⟩ + rw [hinter₁] at hjx + obtain ⟨c, hc, hcj⟩ := hjx + have hxc : x = c := hj.injective hcj.symm + have hxV : x ∈ G.G.V := hG ⟨hbdS ▸ Or.inl (hxc ▸ hc), hxU⟩ + exact ⟨⟨x, hxV, rfl⟩, ⟨x, hxc ▸ hc, rfl⟩⟩ + · rintro ⟨⟨x, hxV, rfl⟩, hwC₁⟩ + exact ⟨⟨x, G.G.V_subset_U hxV, rfl⟩, Surface.discBd_subset D₁ (hbD₁.symm ▸ hwC₁)⟩ + · change j '' G.G.U ∩ D₂ = j '' G.G.V ∩ discBd D₂ + rw [hbD₂] + ext w + constructor + · rintro ⟨⟨x, hxU, rfl⟩, hwD₂⟩ + have hjx : j x ∈ range j ∩ D₂ := ⟨mem_range_self x, hwD₂⟩ + rw [hinter₂] at hjx + obtain ⟨c, hc, hcj⟩ := hjx + have hxc : x = c := hj.injective hcj.symm + have hxV : x ∈ G.G.V := hG ⟨hbdS ▸ Or.inr (hxc ▸ hc), hxU⟩ + exact ⟨⟨x, hxV, rfl⟩, ⟨x, hxc ▸ hc, rfl⟩⟩ + · rintro ⟨⟨x, hxV, rfl⟩, hwC₂⟩ + exact ⟨⟨x, G.G.V_subset_U hxV, rfl⟩, Surface.discBd_subset D₂ (hbD₂.symm ▸ hwC₂)⟩ + · change j '' G.G.U ∩ D₃ = j '' G.G.V ∩ discBd D₃ + have h1 : j '' G.G.U ∩ D₃ = ∅ := + ((disjoint_image_iff hj.injective).mpr hΔ_disj_G.symm).inter_eq + have h2 : j '' G.G.V ∩ discBd D₃ = ∅ := + (Disjoint.mono (image_mono G.G.V_subset_U) (Surface.discBd_subset D₃) + ((disjoint_image_iff hj.injective).mpr hΔ_disj_G.symm)).inter_eq + rw [h1, h2] + +private theorem moved_model_intersects_removed_discs_only_at_boundary_vertices + (S : Type u) + [TopologicalSpace S] + (C₁ : Set S) + (C₂ : Set S) + (H : SurfaceDigraph S) + (hH : H.IsProper) + (hbdS : bd S = C₁ ∪ C₂) + (Z : Type u) + [TopologicalSpace Z] + (j : S → Z) + (D₁ : Set Z) + (D₂ : Set Z) + (hj : IsClosedEmbedding j) + (hbD₁ : discBd D₁ = j '' C₁) + (hbD₂ : discBd D₂ = j '' C₂) + (hinter₁ : range j ∩ D₁ = j '' C₁) + (hinter₂ : range j ∩ D₂ = j '' C₂) + (Δ : Set S) + (β : S ≃ₜ S) + (hβ_fix : ∀ x ∈ bd S, β x = x) + (hΔ_disj_H : Disjoint (⇑β '' H.G.U) Δ) : + let D₃ : Set Z := j '' Δ + let P : Fin 3 → Set Z := ![D₁, D₂, D₃] + let fH : S → Z := j ∘ ⇑β + ∀ (hfH : IsClosedEmbedding fH), + ∀ (i : Fin 3), (embedDrawing hfH H.G).U ∩ P i = (embedDrawing hfH H.G).V ∩ discBd (P i) := by + intro D₃ P fH hfH i + fin_cases i + · change fH '' H.G.U ∩ D₁ = fH '' H.G.V ∩ discBd D₁ + rw [hbD₁] + ext w + constructor + · rintro ⟨⟨x, hxU, rfl⟩, hwD₁⟩ + have hjx : j (β x) ∈ range j ∩ D₁ := ⟨mem_range_self (β x), hwD₁⟩ + rw [hinter₁] at hjx + obtain ⟨c, hc, hcj⟩ := hjx + have hβxc : β x = c := hj.injective hcj.symm + have hxc : x = c := β.injective (hβxc.trans (hβ_fix c (hbdS ▸ Or.inl hc)).symm) + have hxV : x ∈ H.G.V := hH ⟨hbdS ▸ Or.inl (hxc ▸ hc), hxU⟩ + exact ⟨⟨x, hxV, rfl⟩, ⟨c, hc, hcj⟩⟩ + · rintro ⟨⟨x, hxV, rfl⟩, hwC₁⟩ + exact ⟨⟨x, H.G.V_subset_U hxV, rfl⟩, Surface.discBd_subset D₁ (hbD₁.symm ▸ hwC₁)⟩ + · change fH '' H.G.U ∩ D₂ = fH '' H.G.V ∩ discBd D₂ + rw [hbD₂] + ext w + constructor + · rintro ⟨⟨x, hxU, rfl⟩, hwD₂⟩ + have hjx : j (β x) ∈ range j ∩ D₂ := ⟨mem_range_self (β x), hwD₂⟩ + rw [hinter₂] at hjx + obtain ⟨c, hc, hcj⟩ := hjx + have hβxc : β x = c := hj.injective hcj.symm + have hxc : x = c := β.injective (hβxc.trans (hβ_fix c (hbdS ▸ Or.inr hc)).symm) + have hxV : x ∈ H.G.V := hH ⟨hbdS ▸ Or.inr (hxc ▸ hc), hxU⟩ + exact ⟨⟨x, hxV, rfl⟩, ⟨c, hc, hcj⟩⟩ + · rintro ⟨⟨x, hxV, rfl⟩, hwC₂⟩ + exact ⟨⟨x, H.G.V_subset_U hxV, rfl⟩, Surface.discBd_subset D₂ (hbD₂.symm ▸ hwC₂)⟩ + · change fH '' H.G.U ∩ D₃ = fH '' H.G.V ∩ discBd D₃ + rw [image_comp, image_comp] + have h1 : j '' (β '' H.G.U) ∩ D₃ = ∅ := + ((disjoint_image_iff hj.injective).mpr hΔ_disj_H).inter_eq + have h2 : j '' (β '' H.G.V) ∩ discBd D₃ = ∅ := + (Disjoint.mono (image_mono (image_mono H.G.V_subset_U)) (Surface.discBd_subset D₃) + ((disjoint_image_iff hj.injective).mpr hΔ_disj_H)).inter_eq + rw [h1, h2] + +private theorem lifted_drawings_agree_on_three_cuffs + (S : Type u) + [TopologicalSpace S] + (C₁ : Set S) + (C₂ : Set S) + (H : SurfaceDigraph S) + (G : SurfaceDigraph S) + (hbd_eq : G.G.V ∩ bd S = H.G.V ∩ bd S) + [Nonempty S] + (hbdS : bd S = C₁ ∪ C₂) + (Z : Type u) + [TopologicalSpace Z] + (j : S → Z) + (D₁ : Set Z) + (D₂ : Set Z) + (hj : IsClosedEmbedding j) + (hbD₁ : discBd D₁ = j '' C₁) + (hbD₂ : discBd D₂ = j '' C₂) + (β : S ≃ₜ S) + (hβ_fix : ∀ x ∈ bd S, β x = x) : + ∀ (D₃ : Set Z), + ∀ (C_sub : Set Z), + let S' : Type u := ↥C_sub + ∀ [Nonempty S'], + (bd S' = Subtype.val ⁻¹' (discBd D₁ ∪ discBd D₂ ∪ discBd D₃)) → + let fH : S → Z := j ∘ ⇑β + ∀ (hfH : IsClosedEmbedding fH), + ∀ (hUC_G : (embedDrawing hj G.G).U ⊆ C_sub), + ∀ (hUC_H : (embedDrawing hfH H.G).U ⊆ C_sub), + let G' : SurfaceDigraph S' := liftSurfaceDigraph hj G C_sub hUC_G + let H' : SurfaceDigraph S' := liftSurfaceDigraph hfH H C_sub hUC_H + (Disjoint (j '' G.G.V) (discBd D₃)) → + (Disjoint (fH '' H.G.V) (discBd D₃)) → + G'.G.V ∩ bd S' = H'.G.V ∩ bd S' := by + intro D₃ C_sub S' _ hbdS' fH hfH hUC_G hUC_H G' H' hD₃_disj_GV hD₃_disj_HV + ext y + rw [show G'.G = drawingInSubspace (embedDrawing hj G.G) C_sub hUC_G from rfl, + show H'.G = drawingInSubspace (embedDrawing hfH H.G) C_sub hUC_H from rfl, + drawingInSubspace_embedDrawing_V, drawingInSubspace_embedDrawing_V, hbdS'] + constructor + · rintro ⟨⟨x, hxV, hzx⟩, hy_bd⟩ + have hyz : y.val = j x := hzx.symm + have hjx_bd : j x ∈ discBd D₁ ∪ discBd D₂ := by + rcases hy_bd with h12 | h3 + · exact hyz ▸ h12 + · exact (disjoint_left.mp hD₃_disj_GV ⟨x, hxV, rfl⟩ (hyz ▸ h3)).elim + have hx_bd : x ∈ bd S := by + rw [hbdS] + rcases hjx_bd with h1 | h2 + · rw [hbD₁] at h1; obtain ⟨c, hc, hcj⟩ := h1; exact Or.inl (hj.injective hcj ▸ hc) + · rw [hbD₂] at h2; obtain ⟨c, hc, hcj⟩ := h2; exact Or.inr (hj.injective hcj ▸ hc) + have hxHV : x ∈ H.G.V := by + have : x ∈ G.G.V ∩ bd S := ⟨hxV, hx_bd⟩ + rw [hbd_eq] at this + exact this.1 + refine ⟨⟨x, hxHV, ?_⟩, hy_bd⟩ + change j (β x) = y.val + rw [hβ_fix x hx_bd, hzx] + · rintro ⟨⟨x, hxHV, hzx⟩, hy_bd⟩ + have hyz : y.val = fH x := hzx.symm + have hjx_bd : fH x ∈ discBd D₁ ∪ discBd D₂ := by + rcases hy_bd with h12 | h3 + · exact hyz ▸ h12 + · exact (disjoint_left.mp hD₃_disj_HV ⟨x, hxHV, rfl⟩ (hyz ▸ h3)).elim + have hx_bd : x ∈ bd S := by + rw [hbdS] + rcases hjx_bd with h1 | h2 + · rw [hbD₁] at h1 + obtain ⟨c, hc, hcj⟩ := h1 + have hβxc : β x = c := hj.injective hcj.symm + have hxc : x = c := β.injective (hβxc.trans (hβ_fix c (hbdS ▸ Or.inl hc)).symm) + exact Or.inl (hxc ▸ hc) + · rw [hbD₂] at h2 + obtain ⟨c, hc, hcj⟩ := h2 + have hβxc : β x = c := hj.injective hcj.symm + have hxc : x = c := β.injective (hβxc.trans (hβ_fix c (hbdS ▸ Or.inr hc)).symm) + exact Or.inr (hxc ▸ hc) + have hxGV : x ∈ G.G.V := by + have : x ∈ H.G.V ∩ bd S := ⟨hxHV, hx_bd⟩ + rw [← hbd_eq] at this + exact this.1 + refine ⟨⟨x, hxGV, ?_⟩, hy_bd⟩ + have : fH x = j x := congrArg j (hβ_fix x hx_bd) + rw [← this, hzx] + +private theorem lifted_cylinder_alpha_bound + {S : Type u} {S' : Type u} [TopologicalSpace S] [TopologicalSpace S'] + (H : Drawing S) (G' H' : Drawing S') : + let t := H.V.ncard + H.E.ncard + let g' := numInternalIsolatedVertices H' + rCylinderBound H * 5 ^ t ≤ alpha G' → + H'.E.ncard = H.E.ncard → + g' ≤ H.V.ncard → + 42 * (2 * t + 4) * 5 ^ (g' + H'.E.ncard) * vModel 0 0 (t + 4) (2 * t + 4) ≤ alpha G' := by + intro t g' halpha' hH'_E_ncard hg'_le_V + have hpow_le : 5 ^ (g' + H'.E.ncard) ≤ 5 ^ t := by + apply Nat.pow_le_pow_right (by decide) + rw [hH'_E_ncard] + omega + have h42 : 42 * (2 * t + 4) * vModel 0 0 (t + 4) (2 * t + 4) = rCylinderBound H := by + unfold rCylinderBound + dsimp + ring + calc 42 * (2 * t + 4) * 5 ^ (g' + H'.E.ncard) * vModel 0 0 (t + 4) (2 * t + 4) + = (42 * (2 * t + 4) * vModel 0 0 (t + 4) (2 * t + 4)) * 5 ^ (g' + H'.E.ncard) := by ring + _ = rCylinderBound H * 5 ^ (g' + H'.E.ncard) := by rw [h42] + _ ≤ rCylinderBound H * 5 ^ t := Nat.mul_le_mul_left _ hpow_le + _ ≤ alpha G' := halpha' + +private theorem boundary_subset_card_lt_of_agreement + {S : Type u} [TopologicalSpace S] {G H : Drawing S} {C : Set S} {r : ℕ} + (hC : C ⊆ bd S) (hbd : G.V ∩ bd S = H.V ∩ bd S) + (hr : H.V.ncard < r) : (G.V ∩ C).ncard < r := by + have hsub : G.V ∩ C ⊆ H.V := fun x hx => by + have hmem : x ∈ G.V ∩ bd S := ⟨hx.1, hC hx.2⟩ + rw [hbd] at hmem + exact hmem.1 + exact (Set.ncard_le_ncard hsub H.finite_V).trans_lt hr + +private theorem cylinder_bound_exceeds_size {S : Type u} [TopologicalSpace S] + (H : Drawing S) : + let t := H.V.ncard + H.E.ncard + t < rCylinderBound H * 5 ^ t := by + intro t + have hv_ge : 2 * (2 * t + 4) ≤ vModel 0 0 (t + 4) (2 * t + 4) := + two_mul_k_le_vModel 0 0 (t + 4) (2 * t + 4) + have h5_pos : 1 ≤ 5 ^ t := Nat.one_le_pow t 5 (by decide) + have h1 : 1 ≤ vModel 0 0 (t + 4) (2 * t + 4) := by omega + have h2 : 1 ≤ vModel 0 0 (t + 4) (2 * t + 4) * 5 ^ t := Nat.mul_le_mul h1 h5_pos + have h3 : 84 * (t + 2) ≤ 84 * (t + 2) * (vModel 0 0 (t + 4) (2 * t + 4) * 5 ^ t) := + Nat.le_mul_of_pos_right _ (by omega) + have h4 : rCylinderBound H * 5 ^ t = 84 * (t + 2) * (vModel 0 0 (t + 4) (2 * t + 4) * 5 ^ t) := by + dsimp [rCylinderBound, t] + ring + rw [h4] + omega + +/-- **Graph Minors VII, proof of (9.3) from (9.1)** (pages 244–245): +"Because of Claims 1 and 2, we can apply (9.1) with $\Sigma, a, b, c, c_0, k$ replaced by +$\Sigma', 0, 0, 3, t+4, 2t+4$, respectively; and we deduce that $(H, H^+, H^-)$ is a +boundary-rooted minor of $(G, G^+, G^-)$ in $\Sigma'$, and therefore also in $\Sigma$, as +required." -/ +theorem cylinderPunctureReduction : + ∀ (S : Type u) [TopologicalSpace S], + IsSurface S → Nonempty (S ≃ₜ SurfaceModel 0 0 2) → + ∀ C₁ C₂ : Set S, cuffs S = {C₁, C₂} → C₁ ≠ C₂ → + ∀ H G : SurfaceDigraph S, H.IsProper → G.IsProper → + G.G.V ∩ bd S = H.G.V ∩ bd S → + ∀ F₁ F₂ : Set S, + G.G.IsNormal F₁ → G.G.IsNormal F₂ → + CylinderOArcsInOrder C₁ F₂ F₁ C₂ → + (∀ x ∈ F₂, IsPointInsideSurroundingOArc C₁ F₁ x) → + Disjoint F₁ (bd S) → Disjoint F₂ (bd S) → + (∀ F : Set S, G.G.IsNormal F → IsLine F → + (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → + 2 * (rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard)) ≤ (G.G.V ∩ F).ncard) → + rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard) ≤ maxDisjointPaths G.G F₁ F₂ → + (G.G.V ∩ C₁).ncard ≤ maxDisjointPaths G.G F₁ C₁ → + (G.G.V ∩ C₂).ncard ≤ maxDisjointPaths G.G F₂ C₂ → + IsBoundaryRootedMinor H G := by + intro S _ hS he C₁ C₂ hcuffs hne H G hH hG hbd_eq F₁ F₂ hF₁ hF₂ hOrd hInside₁₂ hbd₁ hbd₂ + hLine hk12 hkC₁ hkC₂ + classical + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + obtain ⟨e₀⟩ := id he + have : ConnectedSpace S := by + have := (isSurface_model 0 0 2).2 + exact e₀.symm.surjective.connectedSpace e₀.symm.continuous + have : Nonempty S := (inferInstance : ConnectedSpace S).toNonempty + have hC₁ : C₁ ∈ cuffs S := by rw [hcuffs]; simp + have hC₂ : C₂ ∈ cuffs S := by rw [hcuffs]; simp + have hbdS : bd S = C₁ ∪ C₂ := by rw [← sUnion_cuffs, hcuffs, sUnion_pair] + have hO₁ : IsOArc F₁ := hOrd.2.2.2.1 + have hO₂ : IsOArc F₂ := hOrd.2.2.2.2.1 + have hDisj : Disjoint F₁ F₂ := hOrd.2.2.2.2.2.1 + let t : ℕ := H.G.V.ncard + H.G.E.ncard + let r : ℕ := rCylinderBound H.G * 5 ^ t + have hr_gt_t : t < r := cylinder_bound_exceeds_size H.G + have hr_pos : 1 ≤ r := by omega + -- Step 1: Cap cuffs C₁, C₂ to get sphere Z and nested discs E₁, E₂, E₁', E₂' + obtain ⟨Z, tZ, eZ, j, D₁, D₂, E₁, E₂, E₁', E₂', hCS_Z, hSphZ, hconnZ, hj, hD₁, hD₂, hD₁D₂_disj, + hbD₁, hbD₂, hunion, hinter₁, hinter₂, hrange_eq, hE₁, hbE₁, hE₂, hbE₂, + hE₁', hbE₁', hE₁'_compl, hE₁'_int, hE₂', hbE₂', hE₂'_compl, hE₂'_int, + hD₁_in_E₂, hE₂_in_E₁, hE₁_disj_D₂, hD₂_in_E₁', hE₁'_in_E₂', hE₂'_disj_D₁⟩ := + exists_sphere_cap_and_nested_discs hS he hcuffs hne hOrd hInside₁₂ hbd₁ hbd₂ + have : T2Space Z := hCS_Z.2.1 + have : ConnectedSpace Z := hconnZ + have hmanZ : ∀ x : Z, IsManifoldPoint x := fun x => (hCS_Z.2.2 x).isManifoldPoint + -- Step 2: Show a G.G-normal line exists between F₁ and F₂, and choose minimal I and z + have hex_line : ∃ F : Set S, G.G.IsNormal F ∧ IsLine F ∧ (F ∩ F₁).Nonempty ∧ (F ∩ F₂).Nonempty + := by + exact cylinder_has_normal_line_between_boundaries S C₁ C₂ G hG F₁ F₂ hF₁ hF₂ hbdS hO₁ hO₂ + hDisj Z j D₁ D₂ hCS_Z hj hD₁ hD₂ hD₁D₂_disj hbD₁ hbD₂ hinter₁ hinter₂ hrange_eq + obtain ⟨I, barI₁, barI₂, u, v, z, m, hI_ends, huF₂, hvF₁, hI_disj, + hI_norm, hbarI₁_norm, hbarI₂_norm, hbarI₁_ends, hbarI₂_ends, hbarI₁_sub, hbarI₂_sub, hbar_union, + hz_mem, hu, hbarI₁_disj, hv, hbarI₂_disj, h2r, hI_ncard, hbarI₁_ncard, hbarI₂_ncard, hmin⟩ := + exists_minimal_line_and_split G.G hO₁ hO₂ hDisj hr_pos hex_line hLine + -- Step 3: Show j '' barI₁ ⊆ discInt E₁ and j '' barI₂ ⊆ discInt E₂' + have hbarI₁_in_E₁ : j '' barI₁ ⊆ discInt E₁ := by + exact first_half_line_lies_inside_outer_disc S F₁ F₂ Z j E₁ E₂ hj hE₁ hbE₁ hbE₂ hE₂_in_E₁ + hmanZ barI₁ u z hbarI₁_ends hu hbarI₁_disj + have hbarI₂_in_E₂' : j '' barI₂ ⊆ discInt E₂' := by + exact second_half_line_lies_inside_inner_complement S F₁ F₂ Z j E₁' E₂' hj hbE₁' hE₂' hbE₂' + hE₁'_in_E₂' hmanZ barI₂ v z hbarI₂_ends hv hbarI₂_disj + have hjz_in_E₁ : j z ∈ discInt E₁ := hbarI₁_in_E₁ (mem_image_of_mem j hbarI₁_ends.right_mem) + have hjz_in_E₂' : j z ∈ discInt E₂' := hbarI₂_in_E₂' (mem_image_of_mem j hbarI₂_ends.left_mem) + -- Step 4: Construct Δ around z and move H off Δ + have hz_not_bd : z ∉ bd S := by + intro hz_bd + rcases hbdS ▸ hz_bd with hzC₁ | hzC₂ + · have hjz_D₁ : j z ∈ D₁ := Surface.discBd_subset D₁ (hbD₁.symm ▸ mem_image_of_mem j hzC₁) + exact disjoint_left.mp hE₂'_disj_D₁ hjz_in_E₂'.1 hjz_D₁ + · have hjz_D₂ : j z ∈ D₂ := Surface.discBd_subset D₂ (hbD₂.symm ▸ mem_image_of_mem j hzC₂) + exact disjoint_left.mp hE₁_disj_D₂ hjz_in_E₁.1 hjz_D₂ + have hz_int : IsInteriorPoint z := by + by_contra h + exact hz_not_bd h + let W : Set S := j ⁻¹' (discInt E₁ ∩ discInt E₂') ∩ G.G.Uᶜ ∩ (bd S)ᶜ + have hW_open : IsOpen W := + ((((hE₁.isOpen_discInt hmanZ).inter (hE₂'.isOpen_discInt hmanZ)).preimage hj.continuous).inter + G.G.isClosed_U.isOpen_compl).inter (isClosed_bd S).isOpen_compl + have hzW : z ∈ W := ⟨⟨⟨hjz_in_E₁, hjz_in_E₂'⟩, fun hzU => hz_mem.2 (Or.inl hzU)⟩, hz_not_bd⟩ + obtain ⟨Δ, hΔ, hzΔ, hΔ_sub⟩ := exists_disc_in_open hz_int hW_open hzW + have hΔ_disj_G : Disjoint Δ G.G.U := disjoint_left.mpr fun x hxΔ hxU => (hΔ_sub hxΔ).1.2 hxU + have hΔ_disj_bd : Disjoint Δ (bd S) := disjoint_left.mpr fun x hxΔ hxbd => (hΔ_sub hxΔ).2 hxbd + have hΔ_bd : Δ ∩ bd S = ∅ := hΔ_disj_bd.inter_eq + obtain ⟨β, hβ_fix, hΔ_disj_H⟩ := exists_move_drawing_off_disc hS H.G hΔ hΔ_bd + let D₃ : Set Z := j '' Δ + obtain ⟨hD₃, hbD₃⟩ := isClosedDisc_image hΔ hj.continuous.continuousOn hj.injective.injOn + have hjz_D₃ : j z ∈ discInt D₃ := by + refine ⟨mem_image_of_mem j hzΔ.1, ?_⟩ + rw [hbD₃] + rintro ⟨x, hx, hxz⟩ + exact hzΔ.2 (hj.injective hxz ▸ hx) + have hD₃_in_E₁ : D₃ ⊆ discInt E₁ := by + rintro _ ⟨x, hxΔ, rfl⟩ + exact (hΔ_sub hxΔ).1.1.1 + have hD₃_in_E₂' : D₃ ⊆ discInt E₂' := by + rintro _ ⟨x, hxΔ, rfl⟩ + exact (hΔ_sub hxΔ).1.1.2 + have hD₁D₃_disj : Disjoint D₁ D₃ := + hE₂'_disj_D₁.symm.mono_right (hD₃_in_E₂'.trans (discInt_subset E₂')) + have hD₂D₃_disj : Disjoint D₂ D₃ := + hE₁_disj_D₂.symm.mono_right (hD₃_in_E₁.trans (discInt_subset E₁)) + let P : Fin 3 → Set Z := ![D₁, D₂, D₃] + have hP : ∀ i, IsClosedDisc (P i) := fun i => by + fin_cases i + · exact hD₁ + · exact hD₂ + · exact hD₃ + have hP_disj : Pairwise (fun i k => Disjoint (P i) (P k)) := fun i k hik => by + exact three_caps_pairwise_disjoint Z D₁ D₂ hD₁D₂_disj D₃ hD₁D₃_disj hD₂D₃_disj i k hik + let C_sub : Set Z := discComplement P + let S' : Type u := ↥C_sub + have hS' : IsSurface S' := discComplement_isSurface hCS_Z P hP hP_disj + have : T2Space S' := hS'.2.1 + have : ConnectedSpace S' := Subtype.connectedSpace (discComplement_isConnected hCS_Z P hP hP_disj) + have : Nonempty S' := (inferInstance : ConnectedSpace S').toNonempty + have heS' : Nonempty (S' ≃ₜ SurfaceModel 0 0 3) := by + have hcard : Nat.card (Fin 3) = 3 := by simp + exact hcard ▸ discComplement_model_of_closed_model hCS_Z P hP hP_disj eZ + have hbdS' : bd S' = (Subtype.val : S' → Z) ⁻¹' (discBd D₁ ∪ discBd D₂ ∪ discBd D₃) := by + rw [discComplement_boundary_eq hCS_Z P hP] + ext y + simp only [mem_preimage, mem_iUnion, Fin.exists_fin_succ, Fin.exists_fin_zero, or_false, P, + Matrix.cons_val_zero, mem_union] + tauto + -- Step 5: Lift H and G to S' + let fH : S → Z := j ∘ β + have hfH : IsClosedEmbedding fH := hj.comp β.isClosedEmbedding + have havoid_G : ∀ i : Fin 3, (embedDrawing hj G.G).U ∩ P i = (embedDrawing hj G.G).V ∩ discBd + (P i) := by + exact graph_intersects_removed_discs_only_at_boundary_vertices S C₁ C₂ G hG hbdS Z j D₁ D₂ hj + hbD₁ hbD₂ hinter₁ hinter₂ Δ hΔ_disj_G + have havoid_H : ∀ i : Fin 3, (embedDrawing hfH H.G).U ∩ P i = (embedDrawing hfH H.G).V ∩ discBd + (P i) := by + exact moved_model_intersects_removed_discs_only_at_boundary_vertices S C₁ C₂ H hH hbdS Z j D₁ + D₂ hj hbD₁ hbD₂ hinter₁ hinter₂ Δ β hβ_fix hΔ_disj_H hfH + have hUC_G := drawing_support_subset_discComplement hCS_Z (embedDrawing hj G.G) P hP hP_disj + havoid_G + have hUC_H := drawing_support_subset_discComplement hCS_Z (embedDrawing hfH H.G) P hP hP_disj + havoid_H + let G' : SurfaceDigraph S' := liftSurfaceDigraph hj G C_sub hUC_G + let H' : SurfaceDigraph S' := liftSurfaceDigraph hfH H C_sub hUC_H + have hH'_prop : H'.IsProper := + drawingInDiscComplement_isProper hCS_Z (embedDrawing hfH H.G) P hP hP_disj havoid_H + have hG'_prop : G'.IsProper := + drawingInDiscComplement_isProper hCS_Z (embedDrawing hj G.G) P hP hP_disj havoid_G + have hD₃_disj_GV : Disjoint (j '' G.G.V) (discBd D₃) := + Disjoint.mono (image_mono G.G.V_subset_U) (Surface.discBd_subset D₃) + ((disjoint_image_iff hj.injective).mpr hΔ_disj_G.symm) + have hD₃_disj_HV : Disjoint (fH '' H.G.V) (discBd D₃) := by + rw [image_comp] + exact Disjoint.mono (image_mono (image_mono H.G.V_subset_U)) (Surface.discBd_subset D₃) + ((disjoint_image_iff hj.injective).mpr hΔ_disj_H) + have hbd_eq' : G'.G.V ∩ bd S' = H'.G.V ∩ bd S' := by + exact lifted_drawings_agree_on_three_cuffs S C₁ C₂ H G hbd_eq hbdS Z j D₁ D₂ hj hbD₁ hbD₂ β + hβ_fix D₃ C_sub hbdS' hfH hUC_G hUC_H hD₃_disj_GV hD₃_disj_HV + -- Step 6: Verify Claims 1 and 2 and apply (9.1) + have hsize : H.G.V.ncard < r := (Nat.le_add_right _ _).trans_lt hr_gt_t + have hC₁_lt_r := boundary_subset_card_lt_of_agreement + (hbdS ▸ subset_union_left : C₁ ⊆ bd S) hbd_eq hsize + have hC₂_lt_r := boundary_subset_card_lt_of_agreement + (hbdS ▸ subset_union_right : C₂ ⊆ bd S) hbd_eq hsize + have hBL' : IsBoundaryLinked G'.G := + lemma_9_3_claim_1 hCS_Z hSphZ hj G.G hDisj hbarI₁_norm hbarI₂_norm hbarI₁_ends hbarI₂_ends + hu hbarI₁_disj hv hbarI₂_disj h2r hbarI₁_ncard hbarI₂_ncard hmin + hD₁ hbD₁ hD₂ hbD₂ hD₃ hD₃_disj_GV hP_disj havoid_G hrange_eq + hE₁ hbE₁ hE₂ hbE₂ hE₁' hbE₁' hE₁'_compl hE₂' hE₂'_compl + hD₁_in_E₂ hE₂_in_E₁ hD₂_in_E₁' hE₁'_in_E₂' hbarI₁_in_E₁ hbarI₂_in_E₂' hjz_D₃ + hC₁_lt_r hC₂_lt_r hkC₁ hkC₂ + have halpha' : r ≤ alpha G'.G := + lemma_9_3_claim_2 hCS_Z hSphZ hj G.G hDisj hbarI₁_norm hbarI₂_norm hbarI₁_ends hbarI₂_ends + hu hbarI₁_disj hv hbarI₂_disj h2r hbarI₁_ncard hbarI₂_ncard hmin + hD₁ hD₂ hD₃ hP_disj havoid_G hrange_eq + hE₁ hbE₁ hE₂ hbE₂ hE₁' hbE₁' hE₁'_compl hE₂' hE₂'_compl + hD₁_in_E₂ hE₂_in_E₁ hD₂_in_E₁' hE₁'_in_E₂' hbarI₁_in_E₁ hbarI₂_in_E₂' hjz_D₃ hk12 + have hH'_V_ncard : H'.G.V.ncard = H.G.V.ncard := + drawingInSubspace_embedDrawing_V_ncard hfH H.G C_sub hUC_H + have hH'_E_ncard : H'.G.E.ncard = H.G.E.ncard := + drawingInSubspace_embedDrawing_E_ncard hfH H.G C_sub hUC_H + let g' : ℕ := numInternalIsolatedVertices H'.G + have hg'_le_diff : g' ≤ (H'.G.V \ bd S').ncard := + Set.ncard_le_ncard (sep_subset _ _) H'.G.finite_V.sdiff + have hdiff_inter : (H'.G.V \ bd S').ncard + (H'.G.V ∩ bd S').ncard = H.G.V.ncard := by + have hdisj_diff : Disjoint (H'.G.V \ bd S') (H'.G.V ∩ bd S') := + disjoint_sdiff_left.mono_right inter_subset_right + rw [← hH'_V_ncard, ← Set.ncard_union_eq hdisj_diff H'.G.finite_V.sdiff + (H'.G.finite_V.inter_of_left _), + sdiff_union_inter] + have hg'_le_V : g' ≤ H.G.V.ncard := by omega + have hk_bound : 2 * (2 * t + 4) ≥ 4 * H'.G.E.ncard + 4 * g' + (H'.G.V ∩ bd S').ncard + 2 * 3 + 2 + := by + rw [hH'_E_ncard] + omega + have hc₀_bound : t + 4 ≥ 3 + H'.G.E.ncard + g' + 1 := by + rw [hH'_E_ncard] + omega + have halpha_bound : alpha G'.G ≥ 42 * (2 * t + 4) * 5 ^ (g' + H'.G.E.ncard) * vModel 0 0 (t + 4) + (2 * t + 4) := by + exact lifted_cylinder_alpha_bound H.G G'.G H'.G halpha' hH'_E_ncard hg'_le_V + have hminor' : IsBoundaryRootedMinor H' G' := + gm07_theorem_9_1.{u} S' hS' 0 0 3 (by decide) heS' H' hH'_prop (2 * t + 4) + (t + 4) hk_bound hc₀_bound + G' hG'_prop hbd_eq' hBL' halpha_bound + refine isBoundaryRootedMinor_of_lift hfH hj H G C_sub hUC_H hUC_G hbd_eq.symm + (fun x hx => congrArg j (hβ_fix x hx)) + (fun v ⟨hvV, hv_bd⟩ => ?_) hminor' + rw [hbdS'] + change fH v ∈ discBd D₁ ∪ discBd D₂ ∪ discBd D₃ + have hfv : fH v = j v := congrArg j (hβ_fix v hv_bd) + rw [hfv] + rcases hbdS ▸ hv_bd with hvC₁ | hvC₂ + · exact Or.inl (Or.inl (hbD₁.symm ▸ mem_image_of_mem j hvC₁)) + · exact Or.inl (Or.inr (hbD₂.symm ▸ mem_image_of_mem j hvC₂)) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section9DiscSphere.lean b/LeanPool/GraphMinor/GM07/Section9DiscSphere.lean new file mode 100644 index 0000000000..f4b07ececc --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section9DiscSphere.lean @@ -0,0 +1,1241 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Open +public import LeanPool.GraphMinor.GM07.Section9MoveOff +import LeanPool.GraphMinor.GM07.Section5a +import LeanPool.GraphMinor.GM07.DiscChain +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs +import LeanPool.GraphMinor.GM12.Section3OneDiscComplement +import LeanPool.GraphMinor.GM12.Section3PuncturedModel +import LeanPool.GraphMinor.GM12.Section3CapOneDisc +import LeanPool.GraphMinor.GM12.Section3CapComparison +import LeanPool.GraphMinor.Surface.DiscsInSurface +import LeanPool.GraphMinor.Surface.CutIArc + +/-! +# Reductions from Sphere to Disc and Disc to Cylinder (Graph Minors VII, (9.4)–(9.5)) + +This file proves `sphereToDiscReduction` ((9.5) from (9.4), page 246) and +`discToCylinderReduction` ((9.4) from (9.3), page 246), formalizing each claim of the +paper's proofs as a lemma. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM12 + +universe u + +/-- Membership in `discComplement Δ` is equivalent to avoiding `discInt (Δ i)` for every `i`. -/ +theorem mem_discComplement_iff {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) (x : S) : + x ∈ discComplement Δ ↔ ∀ i, x ∉ discInt (Δ i) := by + constructor + · intro hx i hxi + exact hxi.2 (discComplement_inter_disc_subset_boundary hS Δ hΔ i ⟨hx, hxi.1⟩) + · intro h + by_cases hxU : x ∈ ⋃ i, Δ i + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxU + have hxb : x ∈ discBd (Δ i) := by + by_contra hnb + exact h i ⟨hxi, hnb⟩ + exact disc_boundary_subset_discComplement hS Δ hΔ hdisj i hxb + · exact subset_closure hxU + +/-- A sphere `S` is a closed connected surface. -/ +theorem closedSurface_and_connected_of_isSphere {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) (hSph : IsSphere S) : + bd S = ∅ ∧ IsClosedSurface S ∧ ConnectedSpace S ∧ Nonempty (S ≃ₜ SurfaceModel 0 0 0) := by + have hbd : bd S = ∅ := by + by_contra hbd_ne + exact not_isSphere_of_bd_ne_empty hbd_ne hSph + have hCS : IsClosedSurface S := + ⟨hS.1, hS.2.1, fun x => by + by_contra hn + have : x ∈ bd S := hn + rw [hbd] at this + exact this⟩ + obtain ⟨φ⟩ := hSph + obtain ⟨s₀⟩ := isSphere_model_zero + have : ConnectedSpace (SurfaceModel 0 0 0) := (isSurface_model 0 0 0).2 + let e : SurfaceModel 0 0 0 ≃ₜ S := s₀.trans φ.symm + have hconn : ConnectedSpace S := e.surjective.connectedSpace e.continuous + exact ⟨hbd, hCS, hconn, ⟨e.symm⟩⟩ + +/-- **Graph Minors VII, (9.5), Claim 1** (page 246): +In the proof of (9.5) ("Choose a closed disc $\Delta \subseteq \Sigma$ with $\Delta \cap F_2 = +\emptyset$ +and $\Delta \cap U(G) = \emptyset$, such that $\Delta$ and $F_1$ lie in different components of +$\Sigma - F_2$"), there exist closed discs $\Delta_1, \Delta_2 \subseteq \Sigma$ with +$\Delta_1 \cup \Delta_2 = \Sigma$ and $\Delta_1 \cap \Delta_2 = \mathrm{bd}(\Delta_1) = +\mathrm{bd}(\Delta_2) = F_2$ +such that $F_1 \subseteq \mathrm{int}(\Delta_1)$. -/ +theorem lemma_9_5_claim_1 {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) (hSph : IsSphere S) + {F₁ F₂ : Set S} (hO₁ : IsOArc F₁) (hO₂ : IsOArc F₂) (hDisj : Disjoint F₁ F₂) : + ∃ Δ₁ Δ₂ : Set S, IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ + Δ₁ ∪ Δ₂ = univ ∧ Δ₁ ∩ Δ₂ = F₂ ∧ + discBd Δ₁ = F₂ ∧ discBd Δ₂ = F₂ ∧ + F₁ ⊆ discInt Δ₁ ∧ Disjoint F₁ Δ₂ := by + have : T2Space S := hS.2.1 + obtain ⟨A, B, -, hA, hB, hbA, hbB, hcup, hcap, -, -⟩ := sphere_disc S hSph F₂ hO₂ + have hconn₁ : IsPreconnected F₁ := hO₁.isPreconnected + rcases hA.side hS.2.2 hconn₁ (hbA.symm ▸ hDisj) with hin | hout + · refine ⟨A, B, hA, hB, hcup, hcap, hbA, hbB, hin, disjoint_left.mpr fun x hx₁ hxB => ?_⟩ + have hxA := hin hx₁ + have hxF₂ : x ∈ F₂ := hcap ▸ ⟨hxA.1, hxB⟩ + exact hxA.2 (hbA.symm ▸ hxF₂) + · refine ⟨B, A, hB, hA, union_comm A B ▸ hcup, inter_comm A B ▸ hcap, hbB, hbA, + fun x hx₁ => ⟨?_, ?_⟩, hout⟩ + · have hxU : x ∈ A ∪ B := hcup ▸ mem_univ x + exact hxU.resolve_left (disjoint_left.mp hout hx₁) + · rw [hbB] + exact disjoint_left.mp hDisj hx₁ + +/-- **Graph Minors VII, (9.5), Claim 2** (page 246): +In the closed disc $\Sigma' = \Sigma - \mathrm{int}(\Delta)$ obtained by removing the interior of a +closed disc $\Delta \subseteq \Delta_2 - F_2$, the lifted $O$-arc $F_1'$ is inside $F_2'$, witnessed +by the preimage of $\Delta_1$. -/ +theorem lemma_9_5_claim_2 {S : Type u} [TopologicalSpace S] + {F₁ F₂ Δ₁ Δ : Set S} (hO₂ : IsOArc F₂) (hΔ₁ : IsClosedDisc Δ₁) + (hb₁ : discBd Δ₁ = F₂) (hF₁_in : F₁ ⊆ discInt Δ₁) + (hΔ₁_sub : Δ₁ ⊆ discComplement ![Δ]) : + let C_sub := discComplement ![Δ] + IsInsideOArc (liftEdge id C_sub F₁) (liftEdge id C_sub F₂) := by + intro C_sub x hx + have hF₂_sub : F₂ ⊆ C_sub := hb₁ ▸ (Surface.discBd_subset Δ₁).trans hΔ₁_sub + have hF₂'_eq : liftEdge id C_sub F₂ = (Subtype.val : C_sub → S) ⁻¹' F₂ := by + simp [liftEdge] + obtain ⟨hΔ₁'_disc, hΔ₁'_bd⟩ := isClosedDisc_subtype_preimage hΔ₁_sub hΔ₁ + rw [hb₁, ← hF₂'_eq] at hΔ₁'_bd + have hO₂' : IsOArc (liftEdge id C_sub F₂) := + isOArc_liftEdge IsEmbedding.id (by simpa using hF₂_sub) hO₂ + have hnull : IsNullHomotopicOArc (liftEdge id C_sub F₂) := + isNullHomotopicOArcIn_of_subset_disc hO₂' (subset_univ _) hΔ₁'_disc + (hΔ₁'_bd ▸ Surface.discBd_subset _) + left + refine ⟨hnull, (Subtype.val : C_sub → S) ⁻¹' Δ₁, hΔ₁'_disc, hΔ₁'_bd, ?_⟩ + have hxF₁ : x.val ∈ F₁ := by simpa [liftEdge] using hx + have hx_in := hF₁_in hxF₁ + refine ⟨hx_in.1, ?_⟩ + rw [hF₂'_eq] + exact hb₁ ▸ hx_in.2 + +/-- **Graph Minors VII, proof of (9.5) from (9.4)** (page 246): +"Choose a closed disc $\Delta \subseteq \Sigma$ with $\Delta \cap F_2 = \emptyset$ and +$\Delta \cap U(G) = \emptyset$, such that $\Delta$ and $F_1$ lie in different components of +$\Sigma - F_2$. The result follows by applying (9.4) to the surface obtained from $\Sigma$ by +removing the interior of $\Delta$, and to an isomorphic copy of $(H, H^+, H^-)$ in this surface." -/ +theorem sphereToDiscReduction : + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsSurface S → IsSphere S → + ∀ H G : SurfaceDigraph S, H.IsProper → G.IsProper → + ∀ F₁ F₂ : Set S, + G.G.IsNormal F₁ → G.G.IsNormal F₂ → + IsOArc F₁ → IsOArc F₂ → Disjoint F₁ F₂ → + (∀ F : Set S, G.G.IsNormal F → IsLine F → + (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → + 2 * (rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard)) ≤ (G.G.V ∩ F).ncard) → + rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard) ≤ maxDisjointPaths G.G F₁ F₂ → + ∃ (S' : Type u) (_ : TopologicalSpace S') (_ : T1Space S') + (C : Set S') (H' G' : SurfaceDigraph S') (F₁' F₂' : Set S'), + IsSurface S' ∧ IsClosedDisc (univ : Set S') ∧ + cuffs S' = {C} ∧ + H'.IsProper ∧ G'.IsProper ∧ G'.G.V ∩ bd S' = H'.G.V ∩ bd S' ∧ + G'.G.IsNormal F₁' ∧ G'.G.IsNormal F₂' ∧ + IsOArc F₁' ∧ IsOArc F₂' ∧ Disjoint F₁' F₂' ∧ + IsInsideOArc F₁' F₂' ∧ Disjoint F₂' (bd S') ∧ + (∀ F : Set S', G'.G.IsNormal F → IsLine F → + (F ∩ F₁').Nonempty → (F ∩ F₂').Nonempty → + 2 * (rCylinderBound H'.G * 5 ^ (H'.G.V.ncard + H'.G.E.ncard)) ≤ (G'.G.V ∩ F).ncard) ∧ + rCylinderBound H'.G * 5 ^ (H'.G.V.ncard + H'.G.E.ncard) ≤ maxDisjointPaths G'.G F₁' F₂' + ∧ + (G'.G.V ∩ C).ncard ≤ maxDisjointPaths G'.G F₁' C ∧ + (IsBoundaryRootedMinor H' G' → IsBoundaryRootedMinor H G) := by + intro S _ _ hS hSph H G hH hG F₁ F₂ hF₁ hF₂ hO₁ hO₂ hDisj hLine hk12 + classical + have : T2Space S := hS.2.1 + obtain ⟨hbdS, hCS, hconnS, _⟩ := closedSurface_and_connected_of_isSphere hS hSph + have : ConnectedSpace S := hconnS + have : Nonempty S := hO₂.elim fun f => ⟨(f 1).val⟩ + obtain ⟨Δ₁, Δ₂, hΔ₁, hΔ₂, hcup, hcap, hb₁, hb₂, hF₁_in, hF₁_disj_Δ₂⟩ := + lemma_9_5_claim_1 hS hSph hO₁ hO₂ hDisj + have hΔ₂_bd : Δ₂ ∩ bd S = ∅ := by simp [hbdS] + obtain ⟨Δ, hΔ, hΔ_in_Δ₂, hΔ_disj_G⟩ := + exists_subdisc_disjoint_drawing hS G.G hΔ₂ hΔ₂_bd + have hΔ_bd : Δ ∩ bd S = ∅ := by simp [hbdS] + obtain ⟨β, hβ_fix, hΔ_disj_H⟩ := exists_move_drawing_off_disc hS H.G hΔ hΔ_bd + let P : Fin 1 → Set S := ![Δ] + have hP : ∀ i, IsClosedDisc (P i) := fun i => by fin_cases i; exact hΔ + have hP_disj : Pairwise (fun i j => Disjoint (P i) (P j)) := fun i j hij => by + fin_cases i; fin_cases j; exact (hij rfl).elim + let C_sub : Set S := discComplement P + let S' : Type u := ↥C_sub + have hS' : IsSurface S' := discComplement_isSurface hCS P hP hP_disj + have : T2Space S' := hS'.2.1 + have hDiscS' : IsClosedDisc (univ : Set S') := by + obtain ⟨φ⟩ := isClosedDiscSpace_discComplement_one hCS hSph P hP + exact ⟨φ.trans (Homeomorph.Set.univ S').symm⟩ + let C : Set S' := (Subtype.val : S' → S) ⁻¹' discBd Δ + have hcuffs' : cuffs S' = {C} := by + rw [discComplement_cuffs_eq hCS P hP hP_disj] + ext X + simp only [mem_range, Fin.exists_fin_one, mem_singleton_iff] + exact eq_comm + have hbdS' : bd S' = C := by + rw [discComplement_boundary_eq hCS P hP] + ext x + simp [P, C] + have : Nonempty S' := (Subtype.connectedSpace (discComplement_isConnected hCS P hP + hP_disj)).toNonempty + have hUC_H : (embedDrawing β.isClosedEmbedding H.G).U ⊆ C_sub := by + rintro y ⟨x, hxU, rfl⟩ + rw [mem_discComplement_iff hCS P hP hP_disj] + intro i + fin_cases i + intro hxΔ + exact disjoint_left.mp hΔ_disj_H ⟨x, hxU, rfl⟩ hxΔ.1 + have hUC_G : (embedDrawing IsClosedEmbedding.id G.G).U ⊆ C_sub := by + rintro y ⟨x, hxU, rfl⟩ + rw [mem_discComplement_iff hCS P hP hP_disj] + intro i + fin_cases i + intro hxΔ + exact disjoint_left.mp hΔ_disj_G hxΔ.1 hxU + let H' : SurfaceDigraph S' := liftSurfaceDigraph β.isClosedEmbedding H C_sub hUC_H + let G' : SurfaceDigraph S' := liftSurfaceDigraph IsClosedEmbedding.id G C_sub hUC_G + have hH'_bd_U : bd S' ∩ H'.G.U = ∅ := by + rw [hbdS', eq_empty_iff_forall_notMem] + rintro x ⟨hxC, hxU⟩ + rw [show H'.G = drawingInSubspace (embedDrawing β.isClosedEmbedding H.G) C_sub hUC_H from rfl, + drawingInSubspace_embedDrawing_U] at hxU + obtain ⟨z, hzU, hβz⟩ := hxU + exact disjoint_left.mp hΔ_disj_H ⟨z, hzU, hβz⟩ (Surface.discBd_subset Δ hxC) + have hG'_bd_U : bd S' ∩ G'.G.U = ∅ := by + rw [hbdS', eq_empty_iff_forall_notMem] + rintro x ⟨hxC, hxU⟩ + rw [show G'.G = drawingInSubspace (embedDrawing IsClosedEmbedding.id G.G) C_sub hUC_G from rfl, + drawingInSubspace_embedDrawing_U] at hxU + obtain ⟨z, hzU, hfz⟩ := hxU + have hxz : x.val = z := hfz.symm + exact disjoint_left.mp hΔ_disj_G (Surface.discBd_subset Δ hxC) (hxz ▸ hzU) + have hH'_prop : H'.IsProper := by + change bd S' ∩ H'.G.U ⊆ H'.G.V + rw [hH'_bd_U] + exact empty_subset _ + have hG'_prop : G'.IsProper := by + change bd S' ∩ G'.G.U ⊆ G'.G.V + rw [hG'_bd_U] + exact empty_subset _ + have hH'_bd_V : H'.G.V ∩ bd S' = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro x ⟨hxV, hxBd⟩ + have : x ∈ bd S' ∩ H'.G.U := ⟨hxBd, H'.G.V_subset_U hxV⟩ + rw [hH'_bd_U] at this + exact this + have hG'_bd_V : G'.G.V ∩ bd S' = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro x ⟨hxV, hxBd⟩ + have : x ∈ bd S' ∩ G'.G.U := ⟨hxBd, G'.G.V_subset_U hxV⟩ + rw [hG'_bd_U] at this + exact this + have hbd_eq' : G'.G.V ∩ bd S' = H'.G.V ∩ bd S' := by rw [hG'_bd_V, hH'_bd_V] + have hΔ₁_disj_Δ : Disjoint Δ₁ Δ := by + rw [disjoint_left] + intro x hx₁ hxΔ + have hx₂ := hΔ_in_Δ₂ hxΔ + have hxF₂ : x ∈ F₂ := hcap ▸ ⟨hx₁, hx₂.1⟩ + exact hx₂.2 (hb₂.symm ▸ hxF₂) + have hΔ₁_sub : Δ₁ ⊆ C_sub := by + intro x hx₁ + rw [mem_discComplement_iff hCS P hP hP_disj] + intro i + fin_cases i + intro hxΔ + exact disjoint_left.mp hΔ₁_disj_Δ hx₁ hxΔ.1 + have hF₁_sub : F₁ ⊆ C_sub := (hF₁_in.trans (discInt_subset Δ₁)).trans hΔ₁_sub + have hF₂_sub : F₂ ⊆ C_sub := hb₁ ▸ (Surface.discBd_subset Δ₁).trans hΔ₁_sub + let F₁' : Set S' := liftEdge id C_sub F₁ + let F₂' : Set S' := liftEdge id C_sub F₂ + have hF₁'_norm : G'.G.IsNormal F₁' := + drawingInSubspace_embedDrawing_isNormal_liftEdge IsClosedEmbedding.id G.G C_sub hUC_G hF₁ + have hF₂'_norm : G'.G.IsNormal F₂' := + drawingInSubspace_embedDrawing_isNormal_liftEdge IsClosedEmbedding.id G.G C_sub hUC_G hF₂ + have hO₁' : IsOArc F₁' := isOArc_liftEdge IsEmbedding.id (by simpa using hF₁_sub) hO₁ + have hO₂' : IsOArc F₂' := isOArc_liftEdge IsEmbedding.id (by simpa using hF₂_sub) hO₂ + have hDisj' : Disjoint F₁' F₂' := disjoint_liftEdge injective_id C_sub hDisj + have hInside' : IsInsideOArc F₁' F₂' := lemma_9_5_claim_2 hO₂ hΔ₁ hb₁ hF₁_in hΔ₁_sub + have hbd₂' : Disjoint F₂' (bd S') := by + rw [hbdS', disjoint_left] + rintro x ⟨z, hzF₂, hzx⟩ hxC + have hxz : x.val = z := hzx.symm + have hzΔ₁ : z ∈ Δ₁ := Surface.discBd_subset Δ₁ (hb₁.symm ▸ hzF₂) + have hzΔ : z ∈ Δ := hxz ▸ Surface.discBd_subset Δ hxC + exact disjoint_left.mp hΔ₁_disj_Δ hzΔ₁ hzΔ + have hH'_V_ncard : H'.G.V.ncard = H.G.V.ncard := + drawingInSubspace_embedDrawing_V_ncard β.isClosedEmbedding H.G C_sub hUC_H + have hH'_E_ncard : H'.G.E.ncard = H.G.E.ncard := + drawingInSubspace_embedDrawing_E_ncard β.isClosedEmbedding H.G C_sub hUC_H + have hr_eq : rCylinderBound H'.G = rCylinderBound H.G := by + simp only [rCylinderBound, hH'_V_ncard, hH'_E_ncard] + refine ⟨S', inferInstance, inferInstance, C, H', G', F₁', F₂', + hS', hDiscS', hcuffs', hH'_prop, hG'_prop, hbd_eq', + hF₁'_norm, hF₂'_norm, hO₁', hO₂', hDisj', hInside', hbd₂', + ?_, ?_, ?_, ?_⟩ + · intro F' hF'_norm hF'_line hF'₁ hF'₂ + rw [hr_eq, hH'_V_ncard, hH'_E_ncard, + show G'.G = drawingInSubspace (embedDrawing IsClosedEmbedding.id G.G) C_sub hUC_G from rfl, + drawingInSubspace_embedDrawing_V_inter_unliftEdge_ncard] + apply hLine (unliftEdge id C_sub F') + · exact drawingInSubspace_embedDrawing_isNormal_unliftEdge IsClosedEmbedding.id G.G C_sub + hUC_G hF'_norm + · exact isLine_unliftEdge IsEmbedding.id (by simp) hF'_line + · obtain ⟨x, hxF', z, hzF₁, hzx⟩ := hF'₁ + exact ⟨z, ⟨x, hxF', hzx.symm⟩, hzF₁⟩ + · obtain ⟨x, hxF', z, hzF₂, hzx⟩ := hF'₂ + exact ⟨z, ⟨x, hxF', hzx.symm⟩, hzF₂⟩ + · rw [hr_eq, hH'_V_ncard, hH'_E_ncard] + exact hk12.trans (maxDisjointPaths_le_liftEdge IsClosedEmbedding.id G.G C_sub hUC_G F₁ F₂) + · have hC_empty : G'.G.V ∩ C = ∅ := hbdS' ▸ hG'_bd_V + rw [hC_empty, Set.ncard_empty] + exact Nat.zero_le _ + · intro hminor' + exact isBoundaryRootedMinor_of_lift β.isClosedEmbedding IsClosedEmbedding.id H G C_sub + hUC_H hUC_G (by simp [hbdS]) (fun x hx => by rw [hbdS] at hx; exact hx.elim) + (fun v hv => by rw [hbdS] at hv; exact hv.2.elim) hminor' + +/-! ### Reduction from Closed Disc to Cylinder ((9.4) from (9.3), page 246) -/ + +/-- **Graph Minors VII, (9.4), Claim 1** (page 246): +In a closed disc `Σ` with disjoint `O`-arcs `F₁, F₂` such that `F₁` is inside `F₂` and +`Disjoint F₂ (bd Σ)`, `F₁` and `F₂` bound closed discs `Δ₁ ⊆ discInt Δ₂` with +`Disjoint Δ₂ (bd Σ)`. -/ +theorem lemma_9_4_claim_1 {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) (hD : IsClosedDisc (univ : Set S)) + {F₁ F₂ : Set S} (hO₁ : IsOArc F₁) (hO₂ : IsOArc F₂) (hDisj : Disjoint F₁ F₂) + (hInside : IsInsideOArc F₁ F₂) (hbd₂ : Disjoint F₂ (bd S)) : + ∃ Δ₁ Δ₂ : Set S, IsClosedDisc Δ₁ ∧ discBd Δ₁ = F₁ ∧ + IsClosedDisc Δ₂ ∧ discBd Δ₂ = F₂ ∧ + Δ₁ ⊆ discInt Δ₂ ∧ Disjoint Δ₂ (bd S) := by + have : T2Space S := hS.2.1 + obtain ⟨x₀, hx₀⟩ : F₁.Nonempty := hO₁.elim fun φ => ⟨(φ 1).1, (φ 1).2⟩ + have hx₀_null : IsPointInsideNullOArc F₂ x₀ := by + rcases hInside x₀ hx₀ with hnull | ⟨C', _, hsurr⟩ + · exact hnull + · exact (hsurr.2.1.2.2 ⟨univ, hD, subset_univ F₂⟩).elim + obtain ⟨_, Δ₂, hΔ₂, hb₂, hx₀_in⟩ := hx₀_null + have hF₁_in : F₁ ⊆ discInt Δ₂ := by + rcases hΔ₂.side hS.2.2 hO₁.isPreconnected (hb₂.symm ▸ hDisj) with hin | hout + · exact hin + · exact (disjoint_left.mp hout hx₀ hx₀_in.1).elim + obtain ⟨Δ₁, ⟨hΔ₁_sub, hΔ₁, hb₁, -, hΔ₁_disj_bd, -⟩, -⟩ := + disc_oArc Δ₂ F₁ hΔ₂ (hF₁_in.trans (discInt_subset Δ₂)) hO₁ + have hΔ₁_in_Δ₂ : Δ₁ ⊆ discInt Δ₂ := by + intro x hx + by_cases hxF₁ : x ∈ F₁ + · exact hF₁_in hxF₁ + · exact ⟨hΔ₁_sub hx, disjoint_left.mp hΔ₁_disj_bd ⟨hx, hxF₁⟩⟩ + obtain ⟨Δ₂', ⟨-, hΔ₂', hb₂', -, hΔ₂'_disj_bd, -⟩, huniq⟩ := + disc_oArc univ F₂ hD (subset_univ F₂) hO₂ + have hΔ₂_eq : Δ₂ = Δ₂' := huniq Δ₂ (subset_univ Δ₂) hΔ₂ hb₂ + have hdiscBd_univ : discBd (univ : Set S) = bd S := by + simpa [discBd, Homeomorph.Set.univ] using image_bd_homeomorph (Homeomorph.Set.univ S) + have hΔ₂_disj_bd : Disjoint Δ₂ (bd S) := by + rw [← hdiscBd_univ, disjoint_left] + intro x hxΔ₂ hxbd + by_cases hxF₂ : x ∈ F₂ + · exact disjoint_left.mp hbd₂ hxF₂ (hdiscBd_univ ▸ hxbd) + · exact disjoint_left.mp hΔ₂'_disj_bd ⟨hΔ₂_eq ▸ hxΔ₂, hxF₂⟩ hxbd + exact ⟨Δ₁, Δ₂, hΔ₁, hb₁, hΔ₂, hb₂, hΔ₁_in_Δ₂, hΔ₂_disj_bd⟩ + +/-- In a closed sphere `Z`, every closed disc `A` has a complementary closed disc `E = (discInt A)ᶜ` +with `discBd E = discBd A` and `discInt E = Aᶜ`. -/ +theorem exists_compl_disc_in_sphere {Z : Type u} [TopologicalSpace Z] + (hSph : IsSphere Z) {A : Set Z} (hA : IsClosedDisc A) : + ∃ E : Set Z, IsClosedDisc E ∧ discBd E = discBd A ∧ + E = (discInt A)ᶜ ∧ discInt E = Aᶜ := by + obtain ⟨D₁, D₂, -, hD₁, hD₂, hb₁, hb₂, hcup, hcap, -, huniq⟩ := + sphere_disc Z hSph (discBd A) hA.isOArc_discBd + have hex : ∃ E : Set Z, IsClosedDisc E ∧ discBd E = discBd A ∧ + A ∪ E = univ ∧ A ∩ E = discBd A := by + rcases huniq A hA rfl with rfl | rfl + · exact ⟨D₂, hD₂, hb₂, hcup, hcap⟩ + · exact ⟨D₁, hD₁, hb₁, union_comm D₁ A ▸ hcup, inter_comm D₁ A ▸ hcap⟩ + obtain ⟨E, hE, hbE, hU, hI⟩ := hex + refine ⟨E, hE, hbE, ?_, ?_⟩ + · ext z + simp only [mem_compl_iff, discInt, mem_sdiff, not_and, not_not] + constructor + · intro hzE hzA + exact hI ▸ ⟨hzA, hzE⟩ + · intro h + rcases (hU ▸ mem_univ z : z ∈ A ∪ E) with hzA | hzE + · exact Surface.discBd_subset E (hbE.symm ▸ h hzA) + · exact hzE + · ext z + simp only [discInt, hbE, mem_sdiff, mem_compl_iff] + constructor + · rintro ⟨hzE, hnb⟩ hzA + exact hnb (hI ▸ ⟨hzA, hzE⟩) + · intro hnzA + refine ⟨(hU ▸ mem_univ z : z ∈ A ∪ E).resolve_left hnzA, fun hzb => ?_⟩ + exact hnzA (Surface.discBd_subset A hzb) + +/-- Homeomorphism invariance of `IsPointInsideNullOArc`. -/ +theorem isPointInsideNullOArc_image_homeo {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + (e : X ≃ₜ Y) {F : Set X} {x : X} (h : IsPointInsideNullOArc F x) : + IsPointInsideNullOArc (e '' F) (e x) := by + obtain ⟨_, Δ, hΔ, hbd, hxΔ, hxF⟩ := h + obtain ⟨hΔ', hbd'⟩ := hΔ.image e.continuous.continuousOn e.symm.continuous.continuousOn + (fun z _ => e.symm_apply_apply z) + rw [hbd] at hbd' + have hO' : IsOArc (e '' F) := hbd' ▸ hΔ'.isOArc_discBd + have hnull' : IsNullHomotopicOArc (e '' F) := + isNullHomotopicOArcIn_of_subset_disc hO' (subset_univ _) hΔ' + (hbd' ▸ Surface.discBd_subset _) + refine ⟨hnull', e '' Δ, hΔ', hbd', ⟨x, hxΔ, rfl⟩, ?_⟩ + rintro ⟨z, hzF, hze⟩ + exact hxF (e.injective hze ▸ hzF) + +/-- If `IsPointInsideNullOArc (j₁ '' F) (j₁ x)` holds in one cap `(S₁, j₁, D₁)` of a cuff `C`, then +`IsPointInsideSurroundingOArc C F x` holds. -/ +theorem isPointInsideSurroundingOArc_of_one_cap {S S₁ : Type u} + [TopologicalSpace S] [TopologicalSpace S₁] + (hS : IsSurface S) {C F : Set S} {x : S} (hO : IsOArc F) (hSurr : SurroundsCuff F C) + {j₁ : S → S₁} {D₁ : Set S₁} (h₁ : IsCappedCuff C S₁ j₁ D₁) + (hin₁ : IsPointInsideNullOArc (j₁ '' F) (j₁ x)) : + IsPointInsideSurroundingOArc C F x := by + refine ⟨hO, hSurr, ⟨S₁, inferInstance, j₁, D₁, h₁, hin₁⟩, fun S₂ _ j₂ D₂ h₂ => ?_⟩ + obtain ⟨H, hH⟩ := cappedCuff_homeomorph hS h₁ h₂ + have himg : H '' (j₁ '' F) = j₂ '' F := by + rw [image_image] + exact image_congr fun y _ => hH y + rw [← himg, ← hH x] + exact isPointInsideNullOArc_image_homeo H hin₁ + +/-- Universe-polymorphic version of `not_null_of_separating`: an `O`-arc in a surface `S` embedded +in a sphere `Z` whose image bounds a closed disc `B ⊆ Z` separating two points outside `range j` is +not null-homotopic in `S`. -/ +theorem not_null_of_separating_u {S Z : Type u} [TopologicalSpace S] + [TopologicalSpace Z] [T2Space Z] (hS : IsSurface S) (hsph : IsSphere Z) + {j : S → Z} (hj : IsClosedEmbedding j) {F : Set S} (hF : IsOArc F) {B : Set Z} + (hB : IsClosedDisc B) (hb : discBd B = j '' F) {p a : Z} + (hpB : p ∈ B) (haB : a ∉ B) (hp : p ∉ range j) (ha : a ∉ range j) : + ¬ IsNullHomotopicOArc F := by + intro hnull + obtain ⟨Δ, hΔ, hbΔ⟩ := nullHomotopicOArc_bounds_disc hS hF hnull + obtain ⟨hd, hbd⟩ := isClosedDisc_image hΔ hj.continuous.continuousOn hj.injective.injOn + have hO : IsOArc (j '' F) := hb ▸ hB.isOArc_discBd + obtain ⟨Δ₁, Δ₂, -, h1, h2, b1, b2, hcup, -, -, huniq⟩ := sphere_disc Z hsph _ hO + have hset : discBd (j '' Δ) = j '' F := by rw [hbd, hbΔ] + have hBeq := huniq B hB hb + have hΔeq := huniq _ hd hset + have hra : ∀ {x}, x ∈ j '' Δ → x ∈ range j := fun {x} hx => image_subset_range _ _ hx + rcases hBeq with rfl | rfl <;> rcases hΔeq with h | h + · exact hp (hra (h ▸ hpB)) + · have : a ∈ B ∪ Δ₂ := hcup ▸ mem_univ a + exact ha (hra (h ▸ this.resolve_left haB)) + · have : a ∈ Δ₁ ∪ B := hcup ▸ mem_univ a + exact ha (hra (h ▸ this.resolve_right haB)) + · exact hp (hra (h ▸ hpB)) + +private theorem lift_preserves_proper_first_drawing + (S : Type u) + [TopologicalSpace S] + [Nonempty S] + (C : Set S) + (H : SurfaceDigraph S) + (hH : H.IsProper) + (hbdS : bd S = C) + (β : S ≃ₜ S) + (hβ_fix : ∀ x ∈ bd S, β x = x) + (Z : Type u) + [TopologicalSpace Z] + (j : S → Z) + (D₁ : Set Z) + (hcap : IsCappedCuff C Z j D₁) + (hj : IsClosedEmbedding j) + (C_sub : Set Z) [Nonempty ↥C_sub] : + let S' : Type u := ↥C_sub + let C₁ : Set S' := Subtype.val ⁻¹' discBd D₁ + ∀ (C₂ : Set S'), + (bd S' = C₁ ∪ C₂) → + let f_H : S → Z := j ∘ ⇑β + ∀ (hf_H : IsClosedEmbedding f_H), + ∀ (hUC_H : (embedDrawing hf_H H.G).U ⊆ C_sub), + let H' : SurfaceDigraph S' := liftSurfaceDigraph hf_H H C_sub hUC_H + (C₂ ∩ H'.G.U = ∅) → + H'.IsProper := by + intro S' C₁ C₂ hbdS' f_H hf_H hUC_H H' hH'_C₂_U + rintro x ⟨hxBd, hxU⟩ + rw [hbdS'] at hxBd + rcases hxBd with hxC₁ | hxC₂ + · have : x ∈ C₁ := hxC₁ + change x.val ∈ discBd D₁ at this + rw [hcap.discBd_eq] at this + obtain ⟨c, hc, hcx⟩ := this + rw [show H'.G = drawingInSubspace (embedDrawing hf_H H.G) C_sub hUC_H from rfl, + drawingInSubspace_embedDrawing_U] at hxU + obtain ⟨z, hzU, hfz⟩ := hxU + have hcz : c = β z := hj.injective (hcx.trans hfz.symm) + have hc_bd : c ∈ bd S := hbdS.symm ▸ hc + have hβc : β c = c := hβ_fix c hc_bd + have hzc : z = c := β.injective (hcz.symm.trans hβc.symm) + subst hzc + have hzV : z ∈ H.G.V := hH ⟨hc_bd, hzU⟩ + rw [show H'.G = drawingInSubspace (embedDrawing hf_H H.G) C_sub hUC_H from rfl, + drawingInSubspace_embedDrawing_V] + exact ⟨z, hzV, hfz⟩ + · exfalso + have : x ∈ C₂ ∩ H'.G.U := ⟨hxC₂, hxU⟩ + rw [hH'_C₂_U] at this + exact this + +private theorem lift_preserves_proper_second_drawing + (S : Type u) + [TopologicalSpace S] + [Nonempty S] + (C : Set S) + (G : SurfaceDigraph S) + (hG : G.IsProper) + (hbdS : bd S = C) + (Z : Type u) + [TopologicalSpace Z] + (j : S → Z) + (D₁ : Set Z) + (hcap : IsCappedCuff C Z j D₁) + (hj : IsClosedEmbedding j) + (C_sub : Set Z) [Nonempty ↥C_sub] : + let S' : Type u := ↥C_sub + let C₁ : Set S' := Subtype.val ⁻¹' discBd D₁ + ∀ (C₂ : Set S'), + (bd S' = C₁ ∪ C₂) → + ∀ (hUC_G : (embedDrawing hj G.G).U ⊆ C_sub), + let G' : SurfaceDigraph S' := liftSurfaceDigraph hj G C_sub hUC_G + (C₂ ∩ G'.G.U = ∅) → + G'.IsProper := by + intro S' C₁ C₂ hbdS' hUC_G G' hG'_C₂_U + rintro x ⟨hxBd, hxU⟩ + rw [hbdS'] at hxBd + rcases hxBd with hxC₁ | hxC₂ + · have : x ∈ C₁ := hxC₁ + change x.val ∈ discBd D₁ at this + rw [hcap.discBd_eq] at this + obtain ⟨c, hc, hcx⟩ := this + rw [show G'.G = drawingInSubspace (embedDrawing hj G.G) C_sub hUC_G from rfl, + drawingInSubspace_embedDrawing_U] at hxU + obtain ⟨z, hzU, hfz⟩ := hxU + have hcz : c = z := hj.injective (hcx.trans hfz.symm) + subst hcz + have hcV : c ∈ G.G.V := hG ⟨hbdS.symm ▸ hc, hzU⟩ + rw [show G'.G = drawingInSubspace (embedDrawing hj G.G) C_sub hUC_G from rfl, + drawingInSubspace_embedDrawing_V] + exact ⟨c, hcV, hfz⟩ + · exfalso + have : x ∈ C₂ ∩ G'.G.U := ⟨hxC₂, hxU⟩ + rw [hG'_C₂_U] at this + exact this + +private theorem lift_preserves_boundary_vertex_agreement + (S : Type u) + [TopologicalSpace S] + [Nonempty S] + (C : Set S) + (H : SurfaceDigraph S) + (G : SurfaceDigraph S) + (hbd_eq : G.G.V ∩ bd S = H.G.V ∩ bd S) + (hbdS : bd S = C) + (β : S ≃ₜ S) + (hβ_fix : ∀ x ∈ bd S, β x = x) + (Z : Type u) + [TopologicalSpace Z] + (j : S → Z) + (D₁ : Set Z) + (hcap : IsCappedCuff C Z j D₁) + (hj : IsClosedEmbedding j) + (C_sub : Set Z) [Nonempty ↥C_sub] : + let S' : Type u := ↥C_sub + let C₁ : Set S' := Subtype.val ⁻¹' discBd D₁ + ∀ (C₂ : Set S'), + (bd S' = C₁ ∪ C₂) → + let f_H : S → Z := j ∘ ⇑β + ∀ (hf_H : IsClosedEmbedding f_H), + ∀ (hUC_H : (embedDrawing hf_H H.G).U ⊆ C_sub), + ∀ (hUC_G : (embedDrawing hj G.G).U ⊆ C_sub), + let H' : SurfaceDigraph S' := liftSurfaceDigraph hf_H H C_sub hUC_H + let G' : SurfaceDigraph S' := liftSurfaceDigraph hj G C_sub hUC_G + (C₂ ∩ H'.G.U = ∅) → + (C₂ ∩ G'.G.U = ∅) → + G'.G.V ∩ bd S' = H'.G.V ∩ bd S' := by + intro S' C₁ C₂ hbdS' f_H hf_H hUC_H hUC_G H' G' hH'_C₂_U hG'_C₂_U + ext x + rw [hbdS'] + constructor + · rintro ⟨hxV, hxC₁ | hxC₂⟩ + · rw [show G'.G = drawingInSubspace (embedDrawing hj G.G) C_sub hUC_G from rfl, + drawingInSubspace_embedDrawing_V] at hxV + obtain ⟨z, hzV, hfz⟩ := hxV + have hxc : x.val ∈ j '' C := hcap.discBd_eq ▸ hxC₁ + obtain ⟨c, hc, hcx⟩ := hxc + have hzc : z = c := hj.injective (hfz.trans hcx.symm) + subst hzc + have hz_bd : z ∈ bd S := hbdS.symm ▸ hc + have hz_HV : z ∈ H.G.V := by + have hmem : z ∈ G.G.V ∩ bd S := ⟨hzV, hz_bd⟩ + rw [hbd_eq] at hmem + exact hmem.1 + refine ⟨?_, Or.inl hxC₁⟩ + rw [show H'.G = drawingInSubspace (embedDrawing hf_H H.G) C_sub hUC_H from rfl, + drawingInSubspace_embedDrawing_V] + refine ⟨z, hz_HV, ?_⟩ + change j (β z) = x.val + rw [hβ_fix z hz_bd, hfz] + · exfalso + have : x ∈ C₂ ∩ G'.G.U := ⟨hxC₂, G'.G.V_subset_U hxV⟩ + rw [hG'_C₂_U] at this + exact this + · rintro ⟨hxV, hxC₁ | hxC₂⟩ + · rw [show H'.G = drawingInSubspace (embedDrawing hf_H H.G) C_sub hUC_H from rfl, + drawingInSubspace_embedDrawing_V] at hxV + obtain ⟨z, hzV, hfz⟩ := hxV + have hxc : x.val ∈ j '' C := hcap.discBd_eq ▸ hxC₁ + obtain ⟨c, hc, hcx⟩ := hxc + have hβz_c : β z = c := hj.injective (hfz.trans hcx.symm) + have hc_bd : c ∈ bd S := hbdS.symm ▸ hc + have hzc : z = c := β.injective (hβz_c.trans (hβ_fix c hc_bd).symm) + subst hzc + have hz_GV : z ∈ G.G.V := by + have hmem : z ∈ H.G.V ∩ bd S := ⟨hzV, hc_bd⟩ + rw [← hbd_eq] at hmem + exact hmem.1 + refine ⟨?_, Or.inl hxC₁⟩ + rw [show G'.G = drawingInSubspace (embedDrawing hj G.G) C_sub hUC_G from rfl, + drawingInSubspace_embedDrawing_V] + exact ⟨z, hz_GV, hcx⟩ + · exfalso + have : x ∈ C₂ ∩ H'.G.U := ⟨hxC₂, H'.G.V_subset_U hxV⟩ + rw [hH'_C₂_U] at this + exact this + +private theorem construct_cylinder_reduction + (S : Type u) + [TopologicalSpace S] + [Nonempty S] + (C : Set S) + (H : SurfaceDigraph S) + (G : SurfaceDigraph S) + (hbd_eq : G.G.V ∩ bd S = H.G.V ∩ bd S) + (F₁ : Set S) + (F₂ : Set S) + (hLine : ∀ (F : Set S), G.G.IsNormal F → IsLine F → (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → 2 + * (rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard)) ≤ (G.G.V ∩ F).ncard) + (hk12 : rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard) ≤ maxDisjointPaths G.G F₁ F₂) + (hkC : (G.G.V ∩ C).ncard ≤ maxDisjointPaths G.G F₁ C) + [this : T2Space S] + (hbdS : bd S = C) + (Δ₁ : Set S) + (Δ₂ : Set S) + (hb₁ : discBd Δ₁ = F₁) + (hb₂ : discBd Δ₂ = F₂) + (hΔ₁_in_Δ₂ : Δ₁ ⊆ discInt Δ₂) + (hΔ₂_disj_bd : Disjoint Δ₂ (bd S)) + (Δ : Set S) + (hΔ_in_Δ₁ : Δ ⊆ discInt Δ₁) + (β : S ≃ₜ S) + (hβ_fix : ∀ x ∈ bd S, β x = x) + (Z : Type u) + [TopologicalSpace Z] + (j : S → Z) + (D₁ : Set Z) + (hcap : IsCappedCuff C Z j D₁) + (hSphZ : IsSphere Z) + (hCS_Z : IsClosedSurface Z) + [this : T2Space Z] + (hj : IsClosedEmbedding j) : + let D₂ : Set Z := j '' Δ + (IsClosedDisc (j '' Δ)) → + let P : Fin 2 → Set Z := ![D₁, D₂] + (∀ (i : Fin 2), IsClosedDisc (P i)) → + (Pairwise fun i k => Disjoint (P i) (P k)) → + let C_sub : Set Z := discComplement P + let S' : Type u := ↥C_sub + (IsSurface S') → + ∀ [T2Space S'], + ∀ [Nonempty S'], + ∀ [Nonempty (S' ≃ₜ SurfaceModel 0 0 2)], + let C₁ : Set S' := Subtype.val ⁻¹' discBd D₁ + let C₂ : Set S' := Subtype.val ⁻¹' discBd D₂ + (C₁ = liftEdge j C_sub C) → + (cuffs S' = {C₁, C₂}) → + (C₁ ∈ cuffs S') → + (C₂ ∈ cuffs S') → + (C₁ ≠ C₂) → + (bd S' = C₁ ∪ C₂) → + let f_H : S → Z := j ∘ ⇑β + ∀ (hf_H : IsClosedEmbedding f_H), + ∀ (hUC_H : (embedDrawing hf_H H.G).U ⊆ C_sub), + ∀ (hUC_G : (embedDrawing hj G.G).U ⊆ C_sub), + let H' : SurfaceDigraph S' := liftSurfaceDigraph hf_H H C_sub hUC_H + let G' : SurfaceDigraph S' := liftSurfaceDigraph hj G C_sub hUC_G + (C₂ ∩ G'.G.U = ∅) → + (H'.IsProper) → + (G'.IsProper) → + (G'.G.V ∩ bd S' = H'.G.V ∩ bd S') → + (j '' F₁ ⊆ C_sub) → + (j '' F₂ ⊆ C_sub) → + let F₁' : Set S' := liftEdge j C_sub F₁ + let F₂' : Set S' := liftEdge j C_sub F₂ + (G'.G.IsNormal F₁') → + (G'.G.IsNormal F₂') → + (IsOArc F₁') → + (IsOArc F₂') → + (Disjoint F₁' F₂') → + (Disjoint F₁' (bd S')) → + (Disjoint F₂' (bd S')) → + (discBd (j '' Δ₁) = j '' F₁) → + (discBd (j '' Δ₂) = j '' F₂) → + ∀ (E₁ : Set Z), + (IsClosedDisc E₁) → + (discBd E₁ = j '' F₁) → + (E₁ = (discInt (j '' Δ₁))ᶜ) → + (discInt E₁ = (j '' Δ₁)ᶜ) → + ∀ (E₂ : Set Z), + (IsClosedDisc E₂) → + (discBd E₂ = j '' F₂) → + (E₂ = (discInt (j '' Δ₂))ᶜ) → + (discInt E₂ = (j '' Δ₂)ᶜ) → + ∃ (S' : Type u) (_ : TopologicalSpace S') (_ : T1Space S') (C₁ C₂ : Set S') (H' G' : + SurfaceDigraph S') (F₁' F₂' : Set S'), IsSurface S' ∧ Nonempty (S' ≃ₜ SurfaceModel 0 0 2) ∧ + cuffs S' = {C₁, C₂} ∧ C₁ ≠ C₂ ∧ H'.IsProper ∧ G'.IsProper ∧ G'.G.V ∩ bd S' = H'.G.V ∩ bd S' + ∧ G'.G.IsNormal F₁' ∧ G'.G.IsNormal F₂' ∧ CylinderOArcsInOrder C₁ F₂' F₁' C₂ ∧ (∀ x ∈ F₂', + IsPointInsideSurroundingOArc C₁ F₁' x) ∧ Disjoint F₁' (bd S') ∧ Disjoint F₂' (bd S') ∧ (∀ F + : Set S', G'.G.IsNormal F → IsLine F → (F ∩ F₁').Nonempty → (F ∩ F₂').Nonempty → 2 * + (rCylinderBound H'.G * 5 ^ (H'.G.V.ncard + H'.G.E.ncard)) ≤ (G'.G.V ∩ F).ncard) ∧ + rCylinderBound H'.G * 5 ^ (H'.G.V.ncard + H'.G.E.ncard) ≤ maxDisjointPaths G'.G F₁' F₂' ∧ + (G'.G.V ∩ C₁).ncard ≤ maxDisjointPaths G'.G F₁' C₁ ∧ (G'.G.V ∩ C₂).ncard ≤ maxDisjointPaths + G'.G F₂' C₂ ∧ (IsBoundaryRootedMinor H' G' → IsBoundaryRootedMinor H G) := by + intro D₂ hD₂_disc P hP hP_disj C_sub S' hS' this this heS' C₁ C₂ hC₁_eq_lift hcuffs' hC₁_mem + hC₂_mem hC₁C₂_ne hbdS' f_H hf_H hUC_H hUC_G H' G' hG'_C₂_U hProperLiftH hProperLiftG + hLiftBoundaryEq hF₁_sub hF₂_sub F₁' F₂' hF₁'_norm hF₂'_norm hO₁' hO₂' hDisj' hbd₁' hbd₂' + hΔ₁Z_bd hΔ₂Z_bd E₁ hE₁ hbE₁ hE₁_eq hE₁_int E₂ hE₂ hbE₂ hE₂_eq hE₂_int + classical + have hD₁_in_E₂ : D₁ ⊆ discInt E₂ := by + rw [hE₂_int] + rintro z hz₁ ⟨x, hxΔ₂, rfl⟩ + have hjx : j x ∈ range j ∩ D₁ := ⟨⟨x, rfl⟩, hz₁⟩ + rw [hcap.inter_eq] at hjx + obtain ⟨c, hc, hcj⟩ := hjx + have hxc : x = c := hj.injective hcj.symm + exact disjoint_left.mp hΔ₂_disj_bd hxΔ₂ (hbdS ▸ hxc ▸ hc) + have hE₂_in_E₁ : E₂ ⊆ discInt E₁ := by + rw [hE₂_eq, hE₁_int] + rintro z hz ⟨x, hxΔ₁, rfl⟩ + apply hz + have hx₂ := hΔ₁_in_Δ₂ hxΔ₁ + refine ⟨⟨x, hx₂.1, rfl⟩, ?_⟩ + rw [hΔ₂Z_bd] + rintro ⟨y, hyF₂, hyx⟩ + exact hx₂.2 (hb₂ ▸ hj.injective hyx ▸ hyF₂) + have hE₁_disj_D₂ : Disjoint E₁ D₂ := by + rw [hE₁_eq, disjoint_left] + rintro z hz ⟨x, hxΔ, rfl⟩ + apply hz + have hx₁ := hΔ_in_Δ₁ hxΔ + refine ⟨⟨x, hx₁.1, rfl⟩, ?_⟩ + rw [hΔ₁Z_bd] + rintro ⟨y, hyF₁, hyx⟩ + exact hx₁.2 (hb₁ ▸ hj.injective hyx ▸ hyF₁) + -- Non-null-homotopy and non-planarity of `F₁', F₂'` in `S'` + obtain ⟨p₁, hp₁⟩ := hcap.isClosedDisc.nonempty_discInt + obtain ⟨p₂, hp₂⟩ := hD₂_disc.nonempty_discInt + have hp₁_not_C_sub : p₁ ∉ range (Subtype.val : S' → Z) := by + rw [Subtype.range_val, mem_discComplement_iff hCS_Z P hP hP_disj] + intro h + exact h 0 hp₁ + have hp₂_not_C_sub : p₂ ∉ range (Subtype.val : S' → Z) := by + rw [Subtype.range_val, mem_discComplement_iff hCS_Z P hP hP_disj] + intro h + exact h 1 hp₂ + have hp₁_E₂ : p₁ ∈ E₂ := discInt_subset E₂ (hD₁_in_E₂ (discInt_subset D₁ hp₁)) + have hp₁_E₁ : p₁ ∈ E₁ := discInt_subset E₁ (hE₂_in_E₁ hp₁_E₂) + have hp₂_not_E₁ : p₂ ∉ E₁ := fun h => disjoint_left.mp hE₁_disj_D₂ h (discInt_subset D₂ hp₂) + have hp₂_not_E₂ : p₂ ∉ E₂ := fun h => hp₂_not_E₁ (discInt_subset E₁ (hE₂_in_E₁ h)) + have hval_emb : IsClosedEmbedding (Subtype.val : S' → Z) := + isClosed_closure.isClosedEmbedding_subtypeVal + have hval_F₁' : (Subtype.val : S' → Z) '' F₁' = j '' F₁ := + subtype_image_liftEdge_of_subset hF₁_sub + have hval_F₂' : (Subtype.val : S' → Z) '' F₂' = j '' F₂ := + subtype_image_liftEdge_of_subset hF₂_sub + have hnot_null₁ : ¬ IsNullHomotopicOArc F₁' := + not_null_of_separating_u hS' hSphZ hval_emb hO₁' hE₁ (hbE₁.trans hval_F₁'.symm) + hp₁_E₁ hp₂_not_E₁ hp₁_not_C_sub hp₂_not_C_sub + have hnot_null₂ : ¬ IsNullHomotopicOArc F₂' := + not_null_of_separating_u hS' hSphZ hval_emb hO₂' hE₂ (hbE₂.trans hval_F₂'.symm) + hp₁_E₂ hp₂_not_E₂ hp₁_not_C_sub hp₂_not_C_sub + have hnot_plan₁ : ¬ IsPlanar F₁' := fun hp => + hnot_null₁ ((isPlanar_iff_isNullHomotopicOArc_of_isOArc hS' hO₁').mp hp) + have hnot_plan₂ : ¬ IsPlanar F₂' := fun hp => + hnot_null₂ ((isPlanar_iff_isNullHomotopicOArc_of_isOArc hS' hO₂').mp hp) + -- Cap `C₁` of `S'` via `exists_cap_discComplement_cuff` + obtain ⟨j_cap, hcap_C₁, hj_cap_val⟩ := exists_cap_discComplement_cuff hCS_Z P hP hP_disj 0 + let T_cap := discComplement (fun k : {k : Fin 2 // k ≠ 0} => P k.val) + have hE₁_sub_T : E₁ ⊆ T_cap := by + change E₁ ⊆ discComplement (fun k : {k : Fin 2 // k ≠ 0} => P k.val) + rw [discComplement_except_eq_union P hP hP_disj 0] + intro z hzE₁ + by_cases hzD₁ : z ∈ D₁ + · exact Or.inr hzD₁ + · left + rw [mem_discComplement_iff hCS_Z P hP hP_disj] + intro i + fin_cases i + · exact fun h => hzD₁ h.1 + · exact fun h => disjoint_left.mp hE₁_disj_D₂ hzE₁ h.1 + have hE₂_sub_T : E₂ ⊆ T_cap := (hE₂_in_E₁.trans (discInt_subset E₁)).trans hE₁_sub_T + obtain ⟨hE₁T_disc, hE₁T_bd⟩ := isClosedDisc_subtype_preimage hE₁_sub_T hE₁ + obtain ⟨hE₂T_disc, hE₂T_bd⟩ := isClosedDisc_subtype_preimage hE₂_sub_T hE₂ + have hj_cap_F₁' : j_cap '' F₁' = (Subtype.val : T_cap → Z) ⁻¹' (j '' F₁) := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + rw [mem_preimage, hj_cap_val] + exact hx + · intro hy + have hyC : y.val ∈ C_sub := hF₁_sub hy + refine ⟨⟨y.val, hyC⟩, hy, Subtype.ext (hj_cap_val ⟨y.val, hyC⟩)⟩ + have hj_cap_F₂' : j_cap '' F₂' = (Subtype.val : T_cap → Z) ⁻¹' (j '' F₂) := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + rw [mem_preimage, hj_cap_val] + exact hx + · intro hy + have hyC : y.val ∈ C_sub := hF₂_sub hy + refine ⟨⟨y.val, hyC⟩, hy, Subtype.ext (hj_cap_val ⟨y.val, hyC⟩)⟩ + rw [hbE₁, ← hj_cap_F₁'] at hE₁T_bd + rw [hbE₂, ← hj_cap_F₂'] at hE₂T_bd + have hplan_cap₁ : IsPlanarInCappedCuff C₁ F₁' := + isPlanarInCappedCuff_of_one_cap hS' hcap_C₁ + ⟨(Subtype.val : T_cap → Z) ⁻¹' E₁, hE₁T_disc, hE₁T_bd ▸ Surface.discBd_subset _⟩ + have hplan_cap₂ : IsPlanarInCappedCuff C₁ F₂' := + isPlanarInCappedCuff_of_one_cap hS' hcap_C₁ + ⟨(Subtype.val : T_cap → Z) ⁻¹' E₂, hE₂T_disc, hE₂T_bd ▸ Surface.discBd_subset _⟩ + have hSurr₁ : SurroundsCuff F₁' C₁ := ⟨hC₁_mem, hplan_cap₁, hnot_plan₁⟩ + have hSurr₂ : SurroundsCuff F₂' C₁ := ⟨hC₁_mem, hplan_cap₂, hnot_plan₂⟩ + have hInC₁' : ∀ x ∈ F₂', IsPointInsideSurroundingOArc C₁ F₁' x := by + intro x hx + apply isPointInsideSurroundingOArc_of_one_cap hS' hO₁' hSurr₁ hcap_C₁ + have hO₁'_cap : IsOArc (j_cap '' F₁') := hE₁T_bd ▸ hE₁T_disc.isOArc_discBd + have hnull₁'_cap : IsNullHomotopicOArc (j_cap '' F₁') := + isNullHomotopicOArcIn_of_subset_disc hO₁'_cap (subset_univ _) hE₁T_disc + (hE₁T_bd ▸ Surface.discBd_subset _) + refine ⟨hnull₁'_cap, (Subtype.val : T_cap → Z) ⁻¹' E₁, hE₁T_disc, hE₁T_bd, ?_⟩ + have hx_E₂ : x.val ∈ E₂ := Surface.discBd_subset E₂ (hbE₂.symm ▸ hx) + have hx_in_E₁ : x.val ∈ discInt E₁ := hE₂_in_E₁ hx_E₂ + refine ⟨by rw [mem_preimage, hj_cap_val]; exact hx_in_E₁.1, ?_⟩ + rw [hj_cap_F₁', mem_preimage, hj_cap_val] + exact hbE₁ ▸ hx_in_E₁.2 + have hInside' : IsInsideOArc F₂' F₁' := fun x hx => Or.inr ⟨C₁, hC₁_mem, hInC₁' x hx⟩ + have hOrder' : CylinderOArcsInOrder C₁ F₂' F₁' C₂ := + ⟨hC₁_mem, hC₂_mem, hC₁C₂_ne, hO₁', hO₂', hDisj', hnot_null₁, hnot_null₂, hSurr₂, hSurr₁, + hInside'⟩ + have hH'_V_ncard : H'.G.V.ncard = H.G.V.ncard := + drawingInSubspace_embedDrawing_V_ncard hf_H H.G C_sub hUC_H + have hH'_E_ncard : H'.G.E.ncard = H.G.E.ncard := + drawingInSubspace_embedDrawing_E_ncard hf_H H.G C_sub hUC_H + have hr_eq : rCylinderBound H'.G = rCylinderBound H.G := by + simp only [rCylinderBound, hH'_V_ncard, hH'_E_ncard] + refine ⟨S', inferInstance, inferInstance, C₁, C₂, H', G', F₁', F₂', + hS', heS', hcuffs', hC₁C₂_ne, hProperLiftH, hProperLiftG, hLiftBoundaryEq, + hF₁'_norm, hF₂'_norm, hOrder', hInC₁', hbd₁', hbd₂', + ?_, ?_, ?_, ?_, ?_⟩ + · intro F' hF'_norm hF'_line hF'₁ hF'₂ + rw [hr_eq, hH'_V_ncard, hH'_E_ncard, + show G'.G = drawingInSubspace (embedDrawing hj G.G) C_sub hUC_G from rfl, + drawingInSubspace_embedDrawing_V_inter_unliftEdge_ncard] + have hF'_range : (Subtype.val : S' → Z) '' F' ⊆ range j := by + rintro _ ⟨x, -, rfl⟩ + by_contra hnr + have hxD₁ : x.val ∈ discInt D₁ := by + have hxU : x.val ∈ range j ∪ D₁ := hcap.union_eq ▸ mem_univ x.val + refine ⟨hxU.resolve_left hnr, fun hxb => hnr ?_⟩ + rw [hcap.discBd_eq] at hxb + obtain ⟨c, _, hcj⟩ := hxb + exact ⟨c, hcj⟩ + exact (mem_discComplement_iff hCS_Z P hP hP_disj x.val).mp x.property 0 hxD₁ + apply hLine (unliftEdge j C_sub F') + · exact drawingInSubspace_embedDrawing_isNormal_unliftEdge hj G.G C_sub hUC_G hF'_norm + · exact isLine_unliftEdge hj.isEmbedding hF'_range hF'_line + · obtain ⟨x, hxF', z, hzF₁, hzx⟩ := hF'₁ + exact ⟨z, ⟨x, hxF', hzx.symm⟩, hzF₁⟩ + · obtain ⟨x, hxF', z, hzF₂, hzx⟩ := hF'₂ + exact ⟨z, ⟨x, hxF', hzx.symm⟩, hzF₂⟩ + · rw [hr_eq, hH'_V_ncard, hH'_E_ncard] + exact hk12.trans (maxDisjointPaths_le_liftEdge hj G.G C_sub hUC_G F₁ F₂) + · rw [hC₁_eq_lift, + show G'.G = drawingInSubspace (embedDrawing hj G.G) C_sub hUC_G from rfl, + drawingInSubspace_embedDrawing_V_inter_liftEdge_ncard] + exact hkC.trans (maxDisjointPaths_le_liftEdge hj G.G C_sub hUC_G F₁ C) + · have hC₂_empty : G'.G.V ∩ C₂ = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro x ⟨hxV, hxC₂⟩ + have : x ∈ C₂ ∩ G'.G.U := ⟨hxC₂, G'.G.V_subset_U hxV⟩ + rw [hG'_C₂_U] at this + exact this + rw [hC₂_empty, Set.ncard_empty] + exact Nat.zero_le _ + · intro hminor' + refine isBoundaryRootedMinor_of_lift hf_H hj H G C_sub hUC_H hUC_G hbd_eq.symm + (fun x hx => by change j (β x) = j x; rw [hβ_fix x hx]) ?_ hminor' + intro v hv + rw [hbdS'] + left + change j (β v) ∈ discBd D₁ + rw [hβ_fix v hv.2, hcap.discBd_eq] + exact ⟨v, hbdS ▸ hv.2, rfl⟩ + +private theorem cylinder_cuffs_distinct + (S : Type u) + [TopologicalSpace S] + (C : Set S) + (Z : Type u) + [TopologicalSpace Z] + (j : S → Z) + (D₁ : Set Z) + (hcap : IsCappedCuff C Z j D₁) + (hCS_Z : IsClosedSurface Z) + [T2Space Z] : + ∀ (D₂ : Set Z), + (Disjoint D₁ D₂) → + let P : Fin 2 → Set Z := ![D₁, D₂] + (∀ (i : Fin 2), IsClosedDisc (P i)) → + (Pairwise fun i k => Disjoint (P i) (P k)) → + let C_sub : Set Z := discComplement P + let S' : Type u := ↥C_sub + let C₁ : Set S' := Subtype.val ⁻¹' discBd D₁ + let C₂ : Set S' := Subtype.val ⁻¹' discBd D₂ + C₁ ≠ C₂ := by + intro D₂ hD₁D₂_disj P hP hP_disj C_sub S' C₁ C₂ heq + obtain ⟨φ₁⟩ := hcap.isClosedDisc.isOArc_discBd + let z := (φ₁ 1).val + have hz₁ : z ∈ discBd D₁ := (φ₁ 1).property + have hzC : z ∈ C_sub := disc_boundary_subset_discComplement hCS_Z P hP hP_disj 0 hz₁ + have hzC₁ : (⟨z, hzC⟩ : S') ∈ C₁ := hz₁ + have hzC₂ : (⟨z, hzC⟩ : S') ∈ C₂ := heq ▸ hzC₁ + exact disjoint_left.mp hD₁D₂_disj (Surface.discBd_subset D₁ hz₁) + (Surface.discBd_subset D₂ hzC₂) + +private theorem first_lift_disjoint_from_inner_cuff + (S : Type u) + [TopologicalSpace S] + [Nonempty S] + (H : SurfaceDigraph S) + (Δ : Set S) + (β : S ≃ₜ S) + (hΔ_disj_H : Disjoint (⇑β '' H.G.U) Δ) + (Z : Type u) + [TopologicalSpace Z] + (j : S → Z) + (hj : IsClosedEmbedding j) : + let D₂ : Set Z := j '' Δ + (discBd (j '' Δ) = j '' discBd Δ) → + ∀ (C_sub : Set Z), + ∀ [Nonempty ↥C_sub], + let S' : Type u := ↥C_sub + let C₂ : Set S' := Subtype.val ⁻¹' discBd D₂ + let f_H : S → Z := j ∘ ⇑β + ∀ (hf_H : IsClosedEmbedding f_H), + ∀ (hUC_H : (embedDrawing hf_H H.G).U ⊆ C_sub), + let H' : SurfaceDigraph S' := liftSurfaceDigraph hf_H H C_sub hUC_H + C₂ ∩ H'.G.U = ∅ := by + intro D₂ hD₂_bd C_sub nonemptySubspace S' C₂ f_H hf_H hUC_H H' + rw [eq_empty_iff_forall_notMem] + rintro x ⟨hxC₂, hxU⟩ + rw [show H'.G = drawingInSubspace (embedDrawing hf_H H.G) C_sub hUC_H from rfl, + drawingInSubspace_embedDrawing_U] at hxU + obtain ⟨z, hzU, hfz⟩ := hxU + have hxD₂ : j (β z) ∈ discBd (j '' Δ) := by + change f_H z ∈ discBd D₂ + rw [hfz] + exact hxC₂ + rw [hD₂_bd] at hxD₂ + obtain ⟨w, hw, hwz⟩ := hxD₂ + have hw_eq : β z = w := hj.injective hwz.symm + exact disjoint_left.mp hΔ_disj_H ⟨z, hzU, rfl⟩ (hw_eq ▸ Surface.discBd_subset Δ hw) + +private theorem second_lift_disjoint_from_inner_cuff + (S : Type u) + [TopologicalSpace S] + [Nonempty S] + (G : SurfaceDigraph S) + (Δ : Set S) + (hΔ_disj_G : Disjoint Δ G.G.U) + (Z : Type u) + [TopologicalSpace Z] + (j : S → Z) + (hj : IsClosedEmbedding j) + (hD₂_bd : discBd (j '' Δ) = j '' discBd Δ) + (C_sub : Set Z) [Nonempty ↥C_sub] : + let S' : Type u := ↥C_sub + let C₂ : Set S' := Subtype.val ⁻¹' discBd (j '' Δ) + ∀ (hUC_G : (embedDrawing hj G.G).U ⊆ C_sub), + let G' : SurfaceDigraph S' := liftSurfaceDigraph hj G C_sub hUC_G + C₂ ∩ G'.G.U = ∅ := by + intro S' C₂ hUC_G G' + rw [eq_empty_iff_forall_notMem] + rintro x ⟨hxC₂, hxU⟩ + rw [show G'.G = drawingInSubspace (embedDrawing hj G.G) C_sub hUC_G from rfl, + drawingInSubspace_embedDrawing_U] at hxU + obtain ⟨z, hzU, hfz⟩ := hxU + have hxD₂ : j z ∈ discBd (j '' Δ) := hfz ▸ hxC₂ + rw [hD₂_bd] at hxD₂ + obtain ⟨w, hw, hwz⟩ := hxD₂ + have hw_eq : z = w := hj.injective hwz.symm + exact disjoint_left.mp hΔ_disj_G (hw_eq ▸ Surface.discBd_subset Δ hw) hzU + +/-- **Graph Minors VII, proof of (9.4) from (9.3)** (page 246): +"Choose a closed disc $\Delta \subseteq \Sigma$ with $\Delta$ inside $F_1$ and +$\Delta \cap U(G) = \emptyset$. The result follows by applying (9.3) to the surface obtained from +$\Sigma$ by removing the interior of $\Delta$, and to an isomorphic copy of $(H, H^+, H^-)$ in this +surface." -/ +theorem discToCylinderReduction : + ∀ (S : Type u) [TopologicalSpace S], + IsSurface S → IsClosedDisc (univ : Set S) → + ∀ C : Set S, cuffs S = {C} → + ∀ H G : SurfaceDigraph S, H.IsProper → G.IsProper → + G.G.V ∩ bd S = H.G.V ∩ bd S → + ∀ F₁ F₂ : Set S, + G.G.IsNormal F₁ → G.G.IsNormal F₂ → + IsOArc F₁ → IsOArc F₂ → Disjoint F₁ F₂ → + IsInsideOArc F₁ F₂ → Disjoint F₂ (bd S) → + (∀ F : Set S, G.G.IsNormal F → IsLine F → + (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → + 2 * (rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard)) ≤ (G.G.V ∩ F).ncard) → + rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard) ≤ maxDisjointPaths G.G F₁ F₂ → + (G.G.V ∩ C).ncard ≤ maxDisjointPaths G.G F₁ C → + ∃ (S' : Type u) (_ : TopologicalSpace S') (_ : T1Space S') + (C₁ C₂ : Set S') (H' G' : SurfaceDigraph S') (F₁' F₂' : Set S'), + IsSurface S' ∧ Nonempty (S' ≃ₜ SurfaceModel 0 0 2) ∧ + cuffs S' = {C₁, C₂} ∧ C₁ ≠ C₂ ∧ + H'.IsProper ∧ G'.IsProper ∧ G'.G.V ∩ bd S' = H'.G.V ∩ bd S' ∧ + G'.G.IsNormal F₁' ∧ G'.G.IsNormal F₂' ∧ + CylinderOArcsInOrder C₁ F₂' F₁' C₂ ∧ + (∀ x ∈ F₂', IsPointInsideSurroundingOArc C₁ F₁' x) ∧ + Disjoint F₁' (bd S') ∧ Disjoint F₂' (bd S') ∧ + (∀ F : Set S', G'.G.IsNormal F → IsLine F → + (F ∩ F₁').Nonempty → (F ∩ F₂').Nonempty → + 2 * (rCylinderBound H'.G * 5 ^ (H'.G.V.ncard + H'.G.E.ncard)) ≤ (G'.G.V ∩ F).ncard) ∧ + rCylinderBound H'.G * 5 ^ (H'.G.V.ncard + H'.G.E.ncard) ≤ maxDisjointPaths G'.G F₁' F₂' + ∧ + (G'.G.V ∩ C₁).ncard ≤ maxDisjointPaths G'.G F₁' C₁ ∧ + (G'.G.V ∩ C₂).ncard ≤ maxDisjointPaths G'.G F₂' C₂ ∧ + (IsBoundaryRootedMinor H' G' → IsBoundaryRootedMinor H G) := by + intro S _ hS hD C hcuffs H G hH hG hbd_eq F₁ F₂ hF₁ hF₂ hO₁ hO₂ hDisj hInside hbd₂ hLine hk12 + hkC + classical + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + let ⟨φD⟩ := hD + obtain ⟨eD₀⟩ := nonempty_disc_homeo + let eS : S ≃ₜ SurfaceModel 0 0 1 := + (Homeomorph.Set.univ S).symm.trans (φD.symm.trans eD₀.symm) + have heS : Nonempty (S ≃ₜ SurfaceModel 0 0 1) := ⟨eS⟩ + have hconnS : ConnectedSpace S := by + have : ConnectedSpace (SurfaceModel 0 0 1) := (isSurface_model 0 0 1).2 + exact eS.symm.surjective.connectedSpace eS.symm.continuous + have : Nonempty S := hconnS.toNonempty + have hC : C ∈ cuffs S := by rw [hcuffs]; exact mem_singleton C + have hbdS : bd S = C := by rw [← sUnion_cuffs, hcuffs, sUnion_singleton] + obtain ⟨Δ₁, Δ₂, hΔ₁, hb₁, hΔ₂, hb₂, hΔ₁_in_Δ₂, hΔ₂_disj_bd⟩ := + lemma_9_4_claim_1 hS hD hO₁ hO₂ hDisj hInside hbd₂ + have hΔ₁_disj_bd : Disjoint Δ₁ (bd S) := + hΔ₂_disj_bd.mono_left (hΔ₁_in_Δ₂.trans (discInt_subset Δ₂)) + have hΔ₁_bd : Δ₁ ∩ bd S = ∅ := hΔ₁_disj_bd.inter_eq + obtain ⟨Δ, hΔ, hΔ_in_Δ₁, hΔ_disj_G⟩ := + exists_subdisc_disjoint_drawing hS G.G hΔ₁ hΔ₁_bd + have hΔ_disj_bd : Disjoint Δ (bd S) := + hΔ₁_disj_bd.mono_left (hΔ_in_Δ₁.trans (discInt_subset Δ₁)) + have hΔ_bd : Δ ∩ bd S = ∅ := hΔ_disj_bd.inter_eq + obtain ⟨β, hβ_fix, hΔ_disj_H⟩ := exists_move_drawing_off_disc hS H.G hΔ hΔ_bd + obtain ⟨Z, tZ, j, D₁, hcap, hbdZ⟩ := exists_cappedCuff hS hC + obtain ⟨-, ⟨eZ⟩⟩ := cappedCuff_homeo_model hS heS hC hcap + obtain ⟨s₀⟩ := isSphere_model_zero + have hSphZ : IsSphere Z := ⟨eZ.trans s₀⟩ + obtain ⟨_, hCS_Z, hconnZ, _⟩ := closedSurface_and_connected_of_isSphere hcap.isSurface hSphZ + have : T2Space Z := hcap.isSurface.2.1 + have : ConnectedSpace Z := hconnZ + have hj : IsClosedEmbedding j := hcap.isEmbedding.continuous.isClosedEmbedding + hcap.isEmbedding.injective + let D₂ : Set Z := j '' Δ + obtain ⟨hD₂_disc, hD₂_bd⟩ := isClosedDisc_image hΔ hj.continuous.continuousOn hj.injective.injOn + have hD₁D₂_disj : Disjoint D₁ D₂ := by + rw [disjoint_left] + rintro z hz₁ ⟨x, hxΔ, rfl⟩ + have hjx : j x ∈ range j ∩ D₁ := ⟨⟨x, rfl⟩, hz₁⟩ + rw [hcap.inter_eq] at hjx + obtain ⟨c, hc, hcj⟩ := hjx + have hxc : x = c := hj.injective hcj.symm + exact disjoint_left.mp hΔ_disj_bd hxΔ (hbdS ▸ hxc ▸ hc) + let P : Fin 2 → Set Z := ![D₁, D₂] + have hP : ∀ i, IsClosedDisc (P i) := fun i => by + fin_cases i + · exact hcap.isClosedDisc + · exact hD₂_disc + have hP_disj : Pairwise (fun i k => Disjoint (P i) (P k)) := fun i k hik => by + fin_cases i <;> fin_cases k + · exact (hik rfl).elim + · exact hD₁D₂_disj + · exact hD₁D₂_disj.symm + · exact (hik rfl).elim + let C_sub : Set Z := discComplement P + let S' : Type u := ↥C_sub + have hS' : IsSurface S' := discComplement_isSurface hCS_Z P hP hP_disj + have : T2Space S' := hS'.2.1 + have : ConnectedSpace S' := Subtype.connectedSpace (discComplement_isConnected hCS_Z P hP hP_disj) + have : Nonempty S' := (inferInstance : ConnectedSpace S').toNonempty + have heS' : Nonempty (S' ≃ₜ SurfaceModel 0 0 2) := by + have hcard : Nat.card (Fin 2) = 2 := by simp + exact hcard ▸ discComplement_model_of_closed_model hCS_Z P hP hP_disj eZ + let C₁ : Set S' := (Subtype.val : S' → Z) ⁻¹' discBd D₁ + let C₂ : Set S' := (Subtype.val : S' → Z) ⁻¹' discBd D₂ + have hC₁_eq_lift : C₁ = liftEdge j C_sub C := by + simp [C₁, liftEdge, hcap.discBd_eq] + have hC₂_eq_lift : C₂ = liftEdge j C_sub (discBd Δ) := by + change (Subtype.val : S' → Z) ⁻¹' discBd (j '' Δ) = liftEdge j C_sub (discBd Δ) + simp [liftEdge, hD₂_bd] + have hcuffs' : cuffs S' = {C₁, C₂} := by + rw [discComplement_cuffs_eq hCS_Z P hP hP_disj] + ext X + simp only [mem_range, Fin.exists_fin_two, mem_insert_iff, mem_singleton_iff] + tauto + have hC₁_mem : C₁ ∈ cuffs S' := by rw [hcuffs']; exact Or.inl rfl + have hC₂_mem : C₂ ∈ cuffs S' := by rw [hcuffs']; exact Or.inr rfl + have hC₁C₂_ne : C₁ ≠ C₂ := by + exact cylinder_cuffs_distinct S C Z j D₁ hcap hCS_Z D₂ hD₁D₂_disj hP hP_disj + have hbdS' : bd S' = C₁ ∪ C₂ := by + rw [discComplement_boundary_eq hCS_Z P hP] + ext x + simp [P, C₁, C₂, Fin.exists_fin_two] + have hj_mem_C_sub : ∀ x : S, x ∉ discInt Δ → j x ∈ C_sub := by + intro x hx + rw [mem_discComplement_iff hCS_Z P hP hP_disj] + intro i + fin_cases i + · rintro ⟨hz₁, hnb₁⟩ + have hjx : j x ∈ range j ∩ D₁ := ⟨⟨x, rfl⟩, hz₁⟩ + rw [hcap.inter_eq, ← hcap.discBd_eq] at hjx + exact hnb₁ hjx + · rintro ⟨⟨y, hyΔ, hyx⟩, hnb₂⟩ + have hyx' : y = x := hj.injective hyx + subst hyx' + apply hx ⟨hyΔ, fun hxb => hnb₂ ?_⟩ + change j y ∈ discBd (j '' Δ) + rw [hD₂_bd] + exact ⟨y, hxb, rfl⟩ + let f_H : S → Z := j ∘ β + have hf_H : IsClosedEmbedding f_H := hj.comp β.isClosedEmbedding + have hUC_H : (embedDrawing hf_H H.G).U ⊆ C_sub := by + rintro _ ⟨x, hxU, rfl⟩ + refine hj_mem_C_sub (β x) fun hxΔ => ?_ + exact disjoint_left.mp hΔ_disj_H ⟨x, hxU, rfl⟩ hxΔ.1 + have hUC_G : (embedDrawing hj G.G).U ⊆ C_sub := by + rintro _ ⟨x, hxU, rfl⟩ + refine hj_mem_C_sub x fun hxΔ => ?_ + exact disjoint_left.mp hΔ_disj_G hxΔ.1 hxU + let H' : SurfaceDigraph S' := liftSurfaceDigraph hf_H H C_sub hUC_H + let G' : SurfaceDigraph S' := liftSurfaceDigraph hj G C_sub hUC_G + have hH'_C₂_U : C₂ ∩ H'.G.U = ∅ := by + exact first_lift_disjoint_from_inner_cuff S H Δ β hΔ_disj_H Z j hj hD₂_bd C_sub + hf_H hUC_H + have hG'_C₂_U : C₂ ∩ G'.G.U = ∅ := by + exact second_lift_disjoint_from_inner_cuff S G Δ hΔ_disj_G Z j hj hD₂_bd C_sub hUC_G + have hProperLiftH : H'.IsProper := by + exact lift_preserves_proper_first_drawing S C H hH hbdS β hβ_fix Z j D₁ hcap hj C_sub C₂ + hbdS' hf_H hUC_H hH'_C₂_U + have hProperLiftG : G'.IsProper := by + exact lift_preserves_proper_second_drawing S C G hG hbdS Z j D₁ hcap hj C_sub C₂ hbdS' + hUC_G hG'_C₂_U + have hLiftBoundaryEq : G'.G.V ∩ bd S' = H'.G.V ∩ bd S' := by + exact lift_preserves_boundary_vertex_agreement S C H G hbd_eq hbdS β hβ_fix Z j D₁ hcap hj + C_sub C₂ hbdS' hf_H hUC_H hUC_G hH'_C₂_U hG'_C₂_U + have hF₁_disj_Δ : Disjoint F₁ Δ := by + rw [disjoint_left] + intro x hx₁ hxΔ + exact (hΔ_in_Δ₁ hxΔ).2 (hb₁.symm ▸ hx₁) + have hF₂_disj_Δ : Disjoint F₂ Δ := by + rw [disjoint_left] + intro x hx₂ hxΔ + exact (hΔ₁_in_Δ₂ (discInt_subset Δ₁ (hΔ_in_Δ₁ hxΔ))).2 (hb₂.symm ▸ hx₂) + have hF₁_sub : j '' F₁ ⊆ C_sub := by + rintro _ ⟨x, hx₁, rfl⟩ + exact hj_mem_C_sub x fun hxΔ => disjoint_left.mp hF₁_disj_Δ hx₁ hxΔ.1 + have hF₂_sub : j '' F₂ ⊆ C_sub := by + rintro _ ⟨x, hx₂, rfl⟩ + exact hj_mem_C_sub x fun hxΔ => disjoint_left.mp hF₂_disj_Δ hx₂ hxΔ.1 + let F₁' : Set S' := liftEdge j C_sub F₁ + let F₂' : Set S' := liftEdge j C_sub F₂ + have hF₁'_norm : G'.G.IsNormal F₁' := + drawingInSubspace_embedDrawing_isNormal_liftEdge hj G.G C_sub hUC_G hF₁ + have hF₂'_norm : G'.G.IsNormal F₂' := + drawingInSubspace_embedDrawing_isNormal_liftEdge hj G.G C_sub hUC_G hF₂ + have hO₁' : IsOArc F₁' := isOArc_liftEdge hj.isEmbedding hF₁_sub hO₁ + have hO₂' : IsOArc F₂' := isOArc_liftEdge hj.isEmbedding hF₂_sub hO₂ + have hDisj' : Disjoint F₁' F₂' := disjoint_liftEdge hj.injective C_sub hDisj + have hbd₁ : Disjoint F₁ (bd S) := + hΔ₁_disj_bd.mono_left (hb₁ ▸ Surface.discBd_subset Δ₁) + have hbd₁' : Disjoint F₁' (bd S') := by + rw [hbdS', disjoint_union_right, hC₁_eq_lift, hC₂_eq_lift] + exact ⟨disjoint_liftEdge hj.injective C_sub (hbdS ▸ hbd₁), + disjoint_liftEdge hj.injective C_sub (hF₁_disj_Δ.mono_right (Surface.discBd_subset Δ))⟩ + have hbd₂' : Disjoint F₂' (bd S') := by + rw [hbdS', disjoint_union_right, hC₁_eq_lift, hC₂_eq_lift] + exact ⟨disjoint_liftEdge hj.injective C_sub (hbdS ▸ hbd₂), + disjoint_liftEdge hj.injective C_sub (hF₂_disj_Δ.mono_right (Surface.discBd_subset Δ))⟩ + -- Complementary discs `E₁, E₂` in the sphere `Z` + obtain ⟨hΔ₁Z_disc, hΔ₁Z_bd⟩ := isClosedDisc_image hΔ₁ hj.continuous.continuousOn + hj.injective.injOn + obtain ⟨hΔ₂Z_disc, hΔ₂Z_bd⟩ := isClosedDisc_image hΔ₂ hj.continuous.continuousOn + hj.injective.injOn + rw [hb₁] at hΔ₁Z_bd + rw [hb₂] at hΔ₂Z_bd + obtain ⟨E₁, hE₁, hbE₁, hE₁_eq, hE₁_int⟩ := exists_compl_disc_in_sphere hSphZ hΔ₁Z_disc + obtain ⟨E₂, hE₂, hbE₂, hE₂_eq, hE₂_int⟩ := exists_compl_disc_in_sphere hSphZ hΔ₂Z_disc + rw [hΔ₁Z_bd] at hbE₁ + rw [hΔ₂Z_bd] at hbE₂ + have annulus_reduction : ∃ (S' : Type u) (_ : TopologicalSpace S') (_ : T1Space S') + (C₁ C₂ : Set S') (H' G' : SurfaceDigraph S') (F₁' F₂' : Set S'), + IsSurface S' ∧ Nonempty (S' ≃ₜ SurfaceModel 0 0 2) ∧ + cuffs S' = {C₁, C₂} ∧ C₁ ≠ C₂ ∧ + H'.IsProper ∧ G'.IsProper ∧ G'.G.V ∩ bd S' = H'.G.V ∩ bd S' ∧ + G'.G.IsNormal F₁' ∧ G'.G.IsNormal F₂' ∧ + CylinderOArcsInOrder C₁ F₂' F₁' C₂ ∧ + (∀ x ∈ F₂', IsPointInsideSurroundingOArc C₁ F₁' x) ∧ + Disjoint F₁' (bd S') ∧ Disjoint F₂' (bd S') ∧ + (∀ F : Set S', G'.G.IsNormal F → IsLine F → + (F ∩ F₁').Nonempty → (F ∩ F₂').Nonempty → + 2 * (rCylinderBound H'.G * 5 ^ (H'.G.V.ncard + H'.G.E.ncard)) ≤ (G'.G.V ∩ F).ncard) ∧ + rCylinderBound H'.G * 5 ^ (H'.G.V.ncard + H'.G.E.ncard) ≤ maxDisjointPaths G'.G F₁' F₂' + ∧ + (G'.G.V ∩ C₁).ncard ≤ maxDisjointPaths G'.G F₁' C₁ ∧ + (G'.G.V ∩ C₂).ncard ≤ maxDisjointPaths G'.G F₂' C₂ ∧ + (IsBoundaryRootedMinor H' G' → IsBoundaryRootedMinor H G) := by + exact construct_cylinder_reduction S C H G hbd_eq F₁ F₂ hLine hk12 hkC hbdS Δ₁ Δ₂ hb₁ hb₂ + hΔ₁_in_Δ₂ hΔ₂_disj_bd Δ hΔ_in_Δ₁ β hβ_fix Z j D₁ hcap hSphZ hCS_Z hj hD₂_disc hP + hP_disj hS' hC₁_eq_lift hcuffs' hC₁_mem hC₂_mem hC₁C₂_ne hbdS' hf_H hUC_H + hUC_G hG'_C₂_U hProperLiftH hProperLiftG hLiftBoundaryEq hF₁_sub hF₂_sub + hF₁'_norm hF₂'_norm hO₁' hO₂' hDisj' hbd₁' hbd₂' hΔ₁Z_bd hΔ₂Z_bd E₁ hE₁ hbE₁ hE₁_eq hE₁_int + E₂ hE₂ hbE₂ hE₂_eq hE₂_int + exact annulus_reduction + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section9Grid.lean b/LeanPool/GraphMinor/GM07/Section9Grid.lean new file mode 100644 index 0000000000..f41cd095cb --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section9Grid.lean @@ -0,0 +1,656 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section9Cylinder +public import LeanPool.GraphMinor.GM16.RectangularGridDrawing +import LeanPool.GraphMinor.GM16.SpherePlaneEmbedding +import LeanPool.GraphMinor.GM16.RectangularDisc +import LeanPool.GraphMinor.GM16.DrawingGraphPaths +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Ring + +/-! +# Proof of Graph Minors VII, (9.6) from (9.5) (page 246) + +This file proves the grid reduction step of Graph Minors VII, (9.6) (page 246): +in a sufficiently large `N × N`-grid drawn in a sphere `Σ`, there exist two disjoint `G`-normal +`O`-arcs `F₁, F₂` in `Σ` satisfying conditions (i) and (ii) of (9.4)/(9.5) with +`r = rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Function Topology +open Graph SimpleGraph +open GraphMinor.Surface GraphMinor.GM01 GraphMinor.GM11 GraphMinor.GM16 + +universe u + +/-- A drawing `G` in `S` is isomorphic to an `N × N`-grid (Graph Minors VII, (9.6), page 246: +"[The $N \times N$-grid is the adjacency graph of the squares of a chessboard with $N^2$ +squares.]"): it is the image under an open embedding `j : ℝ × ℝ → S` of the standard `N × N` +rectangular grid drawing in `ℝ × ℝ`, together with a graph isomorphism between `GM01.gridGraph N` +and `G.toGraph`. -/ +def IsGridDrawing {S : Type u} [TopologicalSpace S] (G : Drawing S) (N : ℕ) : Prop := + ∃ (j : (ℝ × ℝ) → S) (iso : GraphMinor.Iso (GM01.gridGraph N) G.toGraph), + IsOpenEmbedding j ∧ + G.V = range (j ∘ @rectangularGridPoint N N) ∧ + (∀ v : V(GM01.gridGraph N), (iso.vertexEquiv v).val = j (rectangularGridPoint v.val)) ∧ + (∀ e : E(GM01.gridGraph N), closure (iso.edgeEquiv e).val = j '' rectangularGridLine e.val) + +/-- Every sphere admits a drawing of the `N × N`-grid satisfying `IsGridDrawing`. -/ +theorem exists_isGridDrawing {S : Type u} [TopologicalSpace S] [T2Space S] + (hSph : IsSphere S) (N : ℕ) : + ∃ G : Drawing S, IsGridDrawing G N := by + obtain ⟨j, hj⟩ := exists_plane_openEmbedding_of_isSphere hSph + obtain ⟨Γ, hV, hVertices, hEdges⟩ := + exists_rectangularGrid_embedded_drawing (pathGraph N □ pathGraph N) le_rfl j hj.isEmbedding + exact ⟨Γ.drawing, j, Γ.iso, hj, hV, hVertices, hEdges⟩ + +/-- The 45-degree rotation/scaling homeomorphism `(u, v) ↦ (u - v, u + v)` of `ℝ × ℝ`. -/ +noncomputable def diamondHomeo : (ℝ × ℝ) ≃ₜ (ℝ × ℝ) where + toFun p := (p.1 - p.2, p.1 + p.2) + invFun q := ((q.1 + q.2) / 2, (q.2 - q.1) / 2) + left_inv p := by ext <;> dsimp <;> ring + right_inv q := by ext <;> dsimp <;> ring + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop + +@[simp] +theorem diamondHomeo_apply (p : ℝ × ℝ) : + diamondHomeo p = (p.1 - p.2, p.1 + p.2) := + rfl + +/-- Coordinate bounds and integrality of at least one coordinate for points in `G.U` of an +`N × N`-grid drawing. -/ +theorem mem_grid_U_coords {S : Type u} [TopologicalSpace S] {G : Drawing S} {N : ℕ} + {j : (ℝ × ℝ) → S} {iso : GraphMinor.Iso (GM01.gridGraph N) G.toGraph} + (hj : IsOpenEmbedding j) + (hV : G.V = range (j ∘ @rectangularGridPoint N N)) + (hEdges : ∀ e : E(GM01.gridGraph N), + closure (iso.edgeEquiv e).val = j '' rectangularGridLine e.val) + {p : ℝ × ℝ} (hp : j p ∈ G.U) : + 0 ≤ p.1 ∧ p.1 < (N : ℝ) ∧ 0 ≤ p.2 ∧ p.2 < (N : ℝ) ∧ + ((∃ i : Fin N, p.1 = (i.val : ℝ)) ∨ (∃ k : Fin N, p.2 = (k.val : ℝ))) := by + by_cases hpV : j p ∈ G.V + · rw [hV] at hpV + obtain ⟨v, hv⟩ := hpV + have hp_eq : rectangularGridPoint v = p := hj.injective hv + have hp1 : p.1 = (v.1.val : ℝ) := (congrArg Prod.fst hp_eq).symm + have hp2 : p.2 = (v.2.val : ℝ) := (congrArg Prod.snd hp_eq).symm + refine ⟨hp1 ▸ Nat.cast_nonneg _, hp1 ▸ Nat.cast_lt.mpr v.1.isLt, + hp2 ▸ Nat.cast_nonneg _, hp2 ▸ Nat.cast_lt.mpr v.2.isLt, Or.inl ⟨v.1, hp1⟩⟩ + · have hpUV : j p ∈ G.U \ G.V := ⟨hp, hpV⟩ + let e_S : Set S := pathComponentIn (G.U \ G.V) (j p) + have he_S : e_S ∈ G.E := pathComponentIn_mem_arcComponentsIn hpUV + have hjp_cl : j p ∈ closure e_S := subset_closure (mem_pathComponentIn_self hpUV) + let e_G : E(GM01.gridGraph N) := iso.edgeEquiv.symm ⟨e_S, he_S⟩ + have he_eq : (iso.edgeEquiv e_G).val = e_S := + congrArg Subtype.val (iso.edgeEquiv.apply_symm_apply ⟨e_S, he_S⟩) + have hcl_eq : closure e_S = j '' rectangularGridLine e_G.val := by + rw [← he_eq, hEdges e_G] + rw [hcl_eq] at hjp_cl + obtain ⟨q, hq, hqp⟩ := hjp_cl + have hp_mem : p ∈ rectangularGridLine e_G.val := hj.injective hqp ▸ hq + rcases rectangularGridLine_spec e_G.property with + ⟨i, k, hi, _, hLine⟩ | ⟨i, k, hk, _, hLine⟩ + · rw [hLine] at hp_mem + have hp1_lo : (i.val : ℝ) ≤ p.1 := hp_mem.1.1 + have hp1_hi : p.1 ≤ (i.val : ℝ) + 1 := hp_mem.1.2 + have hp2_eq : p.2 = (k.val : ℝ) := hp_mem.2 + have hi_lt : (i.val : ℝ) + 1 < (N : ℝ) := by exact_mod_cast hi + have hi0 : (0 : ℝ) ≤ (i.val : ℝ) := Nat.cast_nonneg _ + refine ⟨by linarith, by linarith, hp2_eq ▸ Nat.cast_nonneg _, + hp2_eq ▸ Nat.cast_lt.mpr k.isLt, Or.inr ⟨k, hp2_eq⟩⟩ + · rw [hLine] at hp_mem + have hp1_eq : p.1 = (i.val : ℝ) := hp_mem.1 + have hp2_lo : (k.val : ℝ) ≤ p.2 := hp_mem.2.1 + have hp2_hi : p.2 ≤ (k.val : ℝ) + 1 := hp_mem.2.2 + have hk_lt : (k.val : ℝ) + 1 < (N : ℝ) := by exact_mod_cast hk + have hk0 : (0 : ℝ) ≤ (k.val : ℝ) := Nat.cast_nonneg _ + refine ⟨hp1_eq ▸ Nat.cast_nonneg _, hp1_eq ▸ Nat.cast_lt.mpr i.isLt, + by linarith, by linarith, Or.inl ⟨i, hp1_eq⟩⟩ + +/-- Any point `p : ℝ × ℝ` with integer coordinates in `[0, N)` maps into `G.V`. -/ +theorem mem_grid_V_of_int_coords {S : Type u} [TopologicalSpace S] {G : Drawing S} {N : ℕ} + {j : (ℝ × ℝ) → S} + (hV : G.V = range (j ∘ @rectangularGridPoint N N)) + {p : ℝ × ℝ} (hp1_ge : 0 ≤ p.1) (hp1_lt : p.1 < (N : ℝ)) + (hp2_ge : 0 ≤ p.2) (hp2_lt : p.2 < (N : ℝ)) + {z₁ z₂ : ℤ} (hz₁ : p.1 = (z₁ : ℝ)) (hz₂ : p.2 = (z₂ : ℝ)) : + j p ∈ G.V := by + have hz₁_nn : 0 ≤ z₁ := by exact_mod_cast (hz₁ ▸ hp1_ge : (0 : ℝ) ≤ (z₁ : ℝ)) + have hz₁_lt : z₁ < (N : ℤ) := by exact_mod_cast (hz₁ ▸ hp1_lt : (z₁ : ℝ) < (N : ℝ)) + have hz₂_nn : 0 ≤ z₂ := by exact_mod_cast (hz₂ ▸ hp2_ge : (0 : ℝ) ≤ (z₂ : ℝ)) + have hz₂_lt : z₂ < (N : ℤ) := by exact_mod_cast (hz₂ ▸ hp2_lt : (z₂ : ℝ) < (N : ℝ)) + have hi : z₁.toNat < N := by omega + have hk : z₂.toNat < N := by omega + have hp_eq : p = rectangularGridPoint (⟨z₁.toNat, hi⟩, ⟨z₂.toNat, hk⟩) := by + ext + · change p.1 = (z₁.toNat : ℝ) + rw [hz₁] + exact_mod_cast (Int.toNat_of_nonneg hz₁_nn).symm + · change p.2 = (z₂.toNat : ℝ) + rw [hz₂] + exact_mod_cast (Int.toNat_of_nonneg hz₂_nn).symm + rw [hV, hp_eq] + exact ⟨(⟨z₁.toNat, hi⟩, ⟨z₂.toNat, hk⟩), rfl⟩ + +/-- For any rectangle `R = [a, b] × [c, d]` with integer coordinates `a < b` and `c < d`, +`(j ∘ diamondHomeo) '' frontier R` is a `G`-normal `O`-arc in `S`. -/ +theorem diamond_frontier_isOArc_and_isNormal {S : Type u} [TopologicalSpace S] [T2Space S] + {G : Drawing S} {N : ℕ} + {j : (ℝ × ℝ) → S} {iso : GraphMinor.Iso (GM01.gridGraph N) G.toGraph} + (hj : IsOpenEmbedding j) + (hV : G.V = range (j ∘ @rectangularGridPoint N N)) + (hEdges : ∀ e : E(GM01.gridGraph N), + closure (iso.edgeEquiv e).val = j '' rectangularGridLine e.val) + {a b c d : ℤ} (hab : a < b) (hcd : c < d) : + let R : Set (ℝ × ℝ) := Icc (a : ℝ) (b : ℝ) ×ˢ Icc (c : ℝ) (d : ℝ) + let F : Set S := (j ∘ diamondHomeo) '' frontier R + IsOArc F ∧ G.IsNormal F := by + intro R F + have habR : (a : ℝ) < (b : ℝ) := by exact_mod_cast hab + have hcdR : (c : ℝ) < (d : ℝ) := by exact_mod_cast hcd + have hemb : IsEmbedding (j ∘ diamondHomeo) := hj.isEmbedding.comp diamondHomeo.isEmbedding + obtain ⟨hDiscR, hBdR⟩ := isClosedDisc_real_rectangle_with_boundary habR hcdR + obtain ⟨hDiscImg, hBdImg⟩ := isClosedDisc_image_injOn hDiscR (isCompact_Icc.prod isCompact_Icc) + hemb.continuous.continuousOn hemb.injective.injOn + have hF_bd : discBd ((j ∘ diamondHomeo) '' R) = F := by + rw [hBdImg, hBdR] + refine ⟨hF_bd ▸ hDiscImg.isOArc_discBd, ?_⟩ + rintro w ⟨⟨p, hp_fr, rfl⟩, hwU⟩ + change j (diamondHomeo p) ∈ G.U at hwU + obtain ⟨hq1_ge, hq1_lt, hq2_ge, hq2_lt, hq_int⟩ := mem_grid_U_coords hj hV hEdges hwU + have hp_mem : p ∈ R := (isClosed_Icc.prod isClosed_Icc).frontier_subset hp_fr + have hp_not_int : p ∉ Ioo (a : ℝ) (b : ℝ) ×ˢ Ioo (c : ℝ) (d : ℝ) := by + have hint : interior R = Ioo (a : ℝ) (b : ℝ) ×ˢ Ioo (c : ℝ) (d : ℝ) := by + rw [interior_prod_eq, interior_Icc, interior_Icc] + rw [← hint] + exact hp_fr.2 + have hp_coord_int : (∃ m : ℤ, p.1 = (m : ℝ)) ∨ (∃ n : ℤ, p.2 = (n : ℝ)) := by + by_contra hnot + push Not at hnot + apply hp_not_int + refine ⟨⟨lt_of_le_of_ne hp_mem.1.1 (hnot.1 a).symm, lt_of_le_of_ne hp_mem.1.2 (hnot.1 b)⟩, + ⟨lt_of_le_of_ne hp_mem.2.1 (hnot.2 c).symm, lt_of_le_of_ne hp_mem.2.2 (hnot.2 d)⟩⟩ + have hboth_int : ∃ z₁ z₂ : ℤ, (diamondHomeo p).1 = (z₁ : ℝ) ∧ (diamondHomeo p).2 = (z₂ : ℝ) := by + rcases hp_coord_int with ⟨m, hm⟩ | ⟨n, hn⟩ <;> rcases hq_int with ⟨i, hi⟩ | ⟨k, hk⟩ + · refine ⟨(i.val : ℤ), 2 * m - (i.val : ℤ), by exact_mod_cast hi, ?_⟩ + change p.1 + p.2 = _ + change p.1 - p.2 = (i.val : ℝ) at hi + push_cast + linarith + · refine ⟨2 * m - (k.val : ℤ), (k.val : ℤ), ?_, by exact_mod_cast hk⟩ + change p.1 - p.2 = _ + change p.1 + p.2 = (k.val : ℝ) at hk + push_cast + linarith + · refine ⟨(i.val : ℤ), (i.val : ℤ) + 2 * n, by exact_mod_cast hi, ?_⟩ + change p.1 + p.2 = _ + change p.1 - p.2 = (i.val : ℝ) at hi + push_cast + linarith + · refine ⟨(k.val : ℤ) - 2 * n, (k.val : ℤ), ?_, by exact_mod_cast hk⟩ + change p.1 - p.2 = _ + change p.1 + p.2 = (k.val : ℝ) at hk + push_cast + linarith + obtain ⟨z₁, z₂, hz₁, hz₂⟩ := hboth_int + exact mem_grid_V_of_int_coords hV hq1_ge hq1_lt hq2_ge hq2_lt hz₁ hz₂ + +/-- Any real number `t ∈ [a, b]` with `a < b` in `ℕ` lies in `[m, m + 1]` for some `m : ℕ` with +`a ≤ m` and `m + 1 ≤ b`. -/ +theorem exists_nat_unit_interval_of_mem_Icc {a b : ℕ} (hab : a < b) {t : ℝ} + (ht1 : (a : ℝ) ≤ t) (ht2 : t ≤ (b : ℝ)) : + ∃ m : ℕ, a ≤ m ∧ m + 1 ≤ b ∧ (m : ℝ) ≤ t ∧ t ≤ (m : ℝ) + 1 := by + have ht0 : 0 ≤ t := le_trans (Nat.cast_nonneg a) ht1 + have hfl_le : (⌊t⌋₊ : ℝ) ≤ t := Nat.floor_le ht0 + have hlt_fl : t < (⌊t⌋₊ : ℝ) + 1 := Nat.lt_floor_add_one t + have ha_le : a ≤ ⌊t⌋₊ := Nat.le_floor ht1 + by_cases hlt : ⌊t⌋₊ < b + · exact ⟨⌊t⌋₊, ha_le, hlt, hfl_le, le_of_lt hlt_fl⟩ + · have hb_le : (b : ℝ) ≤ (⌊t⌋₊ : ℝ) := by exact_mod_cast not_lt.mp hlt + have htb : t = (b : ℝ) := le_antisymm ht2 (le_trans hb_le hfl_le) + refine ⟨b - 1, by omega, by omega, ?_, ?_⟩ + · rw [htb, Nat.cast_sub (by omega : 1 ≤ b), Nat.cast_one] + linarith + · rw [htb, Nat.cast_sub (by omega : 1 ≤ b), Nat.cast_one] + linarith + +/-- Every point on the boundary of an integer box `[x₁, x₂] × [y₁, y₂]` (`x₁ < x₂ < N`, +`y₁ < y₂ < N`) maps into `G.U`. -/ +theorem box_boundary_subset_grid_U {S : Type u} [TopologicalSpace S] {G : Drawing S} {N : ℕ} + {j : (ℝ × ℝ) → S} {iso : GraphMinor.Iso (GM01.gridGraph N) G.toGraph} + (hEdges : ∀ e : E(GM01.gridGraph N), + closure (iso.edgeEquiv e).val = j '' rectangularGridLine e.val) + {x₁ x₂ y₁ y₂ : ℕ} (hx : x₁ < x₂) (hxN : x₂ < N) (hy : y₁ < y₂) (hyN : y₂ < N) + {p : ℝ × ℝ} + (hp_in : p ∈ Icc (x₁ : ℝ) (x₂ : ℝ) ×ˢ Icc (y₁ : ℝ) (y₂ : ℝ)) + (hp_out : p ∉ Ioo (x₁ : ℝ) (x₂ : ℝ) ×ˢ Ioo (y₁ : ℝ) (y₂ : ℝ)) : + j p ∈ G.U := by + have hedge_sub : ∀ e : E(GM01.gridGraph N), j '' rectangularGridLine e.val ⊆ G.U := by + intro e + rw [← hEdges e] + exact G.isClosed_U.closure_subset_iff.mpr + ((iso.edgeEquiv e).property.2.1.trans sdiff_subset) + have hhoriz : ∀ (i k : ℕ) (hi : i + 1 < N) (hk : k < N), + (i : ℝ) ≤ p.1 → p.1 ≤ (i : ℝ) + 1 → p.2 = (k : ℝ) → j p ∈ G.U := by + intro i k hi hk hp1_lo hp1_hi hp2_eq + let u : Fin N × Fin N := (⟨i, by omega⟩, ⟨k, hk⟩) + let v : Fin N × Fin N := (⟨i + 1, hi⟩, ⟨k, hk⟩) + have hadj : (pathGraph N □ pathGraph N).Adj u v := + Or.inl ⟨pathGraph_adj.mpr (Or.inl rfl), rfl⟩ + let e : E(GM01.gridGraph N) := ⟨s(u, v), hadj⟩ + have hline : rectangularGridLine e.val = horizontalLatticeLine i k := by + change rectangularGridLinePair u v = _ + simp only [rectangularGridLinePair, u, v, ite_true, Nat.min_eq_left (Nat.le_succ i), min_self] + apply hedge_sub e + rw [hline] + exact ⟨p, ⟨⟨hp1_lo, hp1_hi⟩, hp2_eq⟩, rfl⟩ + have hvert : ∀ (i k : ℕ) (hi : i < N) (hk : k + 1 < N), + p.1 = (i : ℝ) → (k : ℝ) ≤ p.2 → p.2 ≤ (k : ℝ) + 1 → j p ∈ G.U := by + intro i k hi hk hp1_eq hp2_lo hp2_hi + let u : Fin N × Fin N := (⟨i, hi⟩, ⟨k, by omega⟩) + let v : Fin N × Fin N := (⟨i, hi⟩, ⟨k + 1, hk⟩) + have hadj : (pathGraph N □ pathGraph N).Adj u v := + Or.inr ⟨pathGraph_adj.mpr (Or.inl rfl), rfl⟩ + let e : E(GM01.gridGraph N) := ⟨s(u, v), hadj⟩ + have hne : u.2 ≠ v.2 := by + intro h + have := congrArg Fin.val h + dsimp [u, v] at this + omega + have hline : rectangularGridLine e.val = verticalLatticeLine i k := by + change rectangularGridLinePair u v = _ + rw [rectangularGridLinePair, ite_eq_right hne] + simp only [u, v, min_self, Nat.min_eq_left (Nat.le_succ k)] + apply hedge_sub e + rw [hline] + exact ⟨p, ⟨hp1_eq, ⟨hp2_lo, hp2_hi⟩⟩, rfl⟩ + have hbd : (p.1 = (x₁ : ℝ) ∨ p.1 = (x₂ : ℝ)) ∨ (p.2 = (y₁ : ℝ) ∨ p.2 = (y₂ : ℝ)) := by + by_contra hnot + push Not at hnot + exact hp_out ⟨⟨lt_of_le_of_ne hp_in.1.1 hnot.1.1.symm, lt_of_le_of_ne hp_in.1.2 hnot.1.2⟩, + ⟨lt_of_le_of_ne hp_in.2.1 hnot.2.1.symm, lt_of_le_of_ne hp_in.2.2 hnot.2.2⟩⟩ + rcases hbd with (hp1 | hp1) | (hp2 | hp2) + · obtain ⟨k, _, hk2, hk_lo, hk_hi⟩ := exists_nat_unit_interval_of_mem_Icc hy hp_in.2.1 hp_in.2.2 + exact hvert x₁ k (by omega) (by omega) hp1 hk_lo hk_hi + · obtain ⟨k, _, hk2, hk_lo, hk_hi⟩ := exists_nat_unit_interval_of_mem_Icc hy hp_in.2.1 hp_in.2.2 + exact hvert x₂ k hxN (by omega) hp1 hk_lo hk_hi + · obtain ⟨i, _, hi2, hi_lo, hi_hi⟩ := exists_nat_unit_interval_of_mem_Icc hx hp_in.1.1 hp_in.1.2 + exact hhoriz i y₁ (by omega) (by omega) hi_lo hi_hi hp2 + · obtain ⟨i, _, hi2, hi_lo, hi_hi⟩ := exists_nat_unit_interval_of_mem_Icc hx hp_in.1.1 hp_in.1.2 + exact hhoriz i y₂ (by omega) hyN hi_lo hi_hi hp2 + +/-- Walk along row `y` of the `N × N`-grid from column `a` to column `b = a + n`. -/ +noncomputable def gridRowWalkTo {S : Type u} [TopologicalSpace S] {G : Drawing S} {N : ℕ} + (iso : GraphMinor.Iso (GM01.gridGraph N) G.toGraph) (y b : Fin N) : + ∀ (n a : ℕ) (ha : a < N) (_ : a + n = b.val), + GraphWalk G.toGraph + (iso.vertexEquiv ⟨(⟨a, ha⟩, y), mem_univ _⟩).val + (iso.vertexEquiv ⟨(b, y), mem_univ _⟩).val + | 0, a, ha, hab => + have h_eq : (⟨a, ha⟩ : Fin N) = b := Fin.ext hab + h_eq ▸ GraphWalk.nil (iso.vertexEquiv ⟨(⟨a, ha⟩, y), mem_univ _⟩).property + | n + 1, a, ha, hab => + have ha1 : a + 1 < N := by omega + have hab1 : (a + 1) + n = b.val := by omega + have hadj : (GM01.gridGraph N).IsLink + s((⟨a, ha⟩, y), (⟨a + 1, ha1⟩, y)) (⟨a, ha⟩, y) (⟨a + 1, ha1⟩, y) := + ⟨rfl, Or.inl ⟨pathGraph_adj.mpr (Or.inl rfl), rfl⟩⟩ + have hlink : G.toGraph.IsLink + (iso.edgeEquiv ⟨s((⟨a, ha⟩, y), (⟨a + 1, ha1⟩, y)), hadj.2⟩).val + (iso.vertexEquiv ⟨(⟨a, ha⟩, y), mem_univ _⟩).val + (iso.vertexEquiv ⟨(⟨a + 1, ha1⟩, y), mem_univ _⟩).val := + (iso.isLink_iff ⟨s((⟨a, ha⟩, y), (⟨a + 1, ha1⟩, y)), hadj.2⟩ + ⟨(⟨a, ha⟩, y), mem_univ _⟩ ⟨(⟨a + 1, ha1⟩, y), mem_univ _⟩).mp hadj + GraphWalk.cons hlink (gridRowWalkTo iso y b n (a + 1) ha1 hab1) + +theorem gridRowWalkTo_mem_support {S : Type u} [TopologicalSpace S] {G : Drawing S} {N : ℕ} + (iso : GraphMinor.Iso (GM01.gridGraph N) G.toGraph) (y b : Fin N) : + ∀ (n a : ℕ) (ha : a < N) (hab : a + n = b.val) {w : S}, + w ∈ (gridRowWalkTo iso y b n a ha hab).support → + ∃ i : Fin N, a ≤ i.val ∧ i.val ≤ b.val ∧ + w = (iso.vertexEquiv ⟨(i, y), mem_univ _⟩).val + | 0, a, ha, hab, w, hw => by + have h_eq : (⟨a, ha⟩ : Fin N) = b := Fin.ext hab + subst h_eq + simp only [gridRowWalkTo, GraphWalk.support, List.mem_singleton] at hw + exact ⟨⟨a, ha⟩, le_rfl, le_rfl, hw⟩ + | n + 1, a, ha, hab, w, hw => by + simp only [gridRowWalkTo, GraphWalk.support, List.mem_cons] at hw + rcases hw with rfl | hw_rest + · exact ⟨⟨a, ha⟩, le_rfl, by change a ≤ b.val; omega, rfl⟩ + · obtain ⟨i, hi_lo, hi_hi, rfl⟩ := + gridRowWalkTo_mem_support iso y b n (a + 1) (by omega) (by omega) hw_rest + exact ⟨i, by omega, hi_hi, rfl⟩ + +theorem gridRowWalkTo_isSimple {S : Type u} [TopologicalSpace S] {G : Drawing S} {N : ℕ} + (iso : GraphMinor.Iso (GM01.gridGraph N) G.toGraph) (y b : Fin N) : + ∀ (n a : ℕ) (ha : a < N) (hab : a + n = b.val), + (gridRowWalkTo iso y b n a ha hab).IsSimple + | 0, a, ha, hab => by + have h_eq : (⟨a, ha⟩ : Fin N) = b := Fin.ext hab + subst h_eq + exact List.nodup_singleton _ + | n + 1, a, ha, hab => by + change (GraphWalk.support _).Nodup + simp only [gridRowWalkTo, GraphWalk.support, List.nodup_cons] + refine ⟨?_, gridRowWalkTo_isSimple iso y b n (a + 1) (by omega) (by omega)⟩ + intro hmem + obtain ⟨i, hi_lo, _, heq⟩ := + gridRowWalkTo_mem_support iso y b n (a + 1) (by omega) (by omega) hmem + have h_inj := iso.vertexEquiv.injective (Subtype.ext heq) + have h_fst : (⟨a, ha⟩ : Fin N) = i := congrArg (Prod.fst ∘ Subtype.val) h_inj + have : a = i.val := congrArg Fin.val h_fst + omega + +private theorem first_box_diamond_coordinate_bounds + {r : ℕ} : + let a₁ : ℤ := 2 * ↑r + 2 + let b₁ : ℤ := 3 * ↑r + 2 + let c₁ : ℤ := 0 + let d₁ : ℤ := 1 + let R₁ : Set (ℝ × ℝ) := Icc ↑a₁ ↑b₁ ×ˢ Icc ↑c₁ ↑d₁ + ∀ p ∈ R₁, 2 * ↑r + 1 ≤ (diamondHomeo p).1 ∧ (diamondHomeo p).1 ≤ 3 * ↑r + 2 ∧ 2 * ↑r + 2 ≤ + (diamondHomeo p).2 ∧ (diamondHomeo p).2 ≤ 3 * ↑r + 3 := by + intro a₁ b₁ c₁ d₁ R₁ p ⟨⟨hu1, hu2⟩, ⟨hv1, hv2⟩⟩ + change (2 * (r : ℤ) + 2 : ℤ) ≤ p.1 at hu1 + change p.1 ≤ (3 * (r : ℤ) + 2 : ℤ) at hu2 + change (0 : ℤ) ≤ p.2 at hv1 + change p.2 ≤ (1 : ℤ) at hv2 + push_cast at hu1 hu2 hv1 hv2 + dsimp [diamondHomeo] + exact ⟨by linarith, by linarith, by linarith, by linarith⟩ + +private theorem second_box_diamond_coordinate_bound + {r : ℕ} : + let a₂ : ℤ := 4 * ↑r + 2 + let b₂ : ℤ := 5 * ↑r + 2 + let c₂ : ℤ := -(2 * ↑r + 1) + let d₂ : ℤ := -(2 * ↑r) + let R₂ : Set (ℝ × ℝ) := Icc ↑a₂ ↑b₂ ×ˢ Icc ↑c₂ ↑d₂ + ∀ p ∈ R₂, 6 * ↑r + 2 ≤ (diamondHomeo p).1 := by + intro a₂ b₂ c₂ d₂ R₂ p ⟨⟨hu1, _⟩, ⟨_, hv2⟩⟩ + change (4 * (r : ℤ) + 2 : ℤ) ≤ p.1 at hu1 + change p.2 ≤ (-(2 * (r : ℤ)) : ℤ) at hv2 + push_cast at hu1 hv2 + dsimp [diamondHomeo] + linarith + +private theorem diamond_box_boundaries_disjoint + {S : Type u} + [TopologicalSpace S] + {r : ℕ} + (hr : 1 ≤ r) + (j : ℝ × ℝ → S) + (hj : IsOpenEmbedding j) + (R₁ : Set (ℝ × ℝ)) + (R₂ : Set (ℝ × ℝ)) (hclosed₁ : IsClosed R₁) (hclosed₂ : IsClosed R₂) : + let F₁ : Set S := j ∘ ⇑diamondHomeo '' frontier R₁ + let F₂ : Set S := j ∘ ⇑diamondHomeo '' frontier R₂ + (∀ p ∈ R₁, 2 * ↑r + 1 ≤ (diamondHomeo p).1 ∧ (diamondHomeo p).1 ≤ 3 * ↑r + 2 ∧ + 2 * ↑r + 2 ≤ (diamondHomeo p).2 ∧ (diamondHomeo p).2 ≤ 3 * ↑r + 3) → + (∀ p ∈ R₂, 6 * ↑r + 2 ≤ (diamondHomeo p).1) → + Disjoint F₁ F₂ := by + intro F₁ F₂ hR₁_bounds hR₂_bounds + rw [Set.disjoint_left] + rintro _ ⟨p₁, hp₁, rfl⟩ ⟨p₂, hp₂, heq⟩ + have hp₁R : p₁ ∈ R₁ := hclosed₁.frontier_subset hp₁ + have hp₂R : p₂ ∈ R₂ := hclosed₂.frontier_subset hp₂ + have h_eq : diamondHomeo p₁ = diamondHomeo p₂ := hj.injective heq.symm + have h1 := (hR₁_bounds p₁ hp₁R).2.1 + have h2 := hR₂_bounds p₂ hp₂R + rw [← h_eq] at h2 + have hr1 : (1 : ℝ) ≤ (r : ℝ) := by exact_mod_cast hr + linarith + +/-- In the `N × N`-grid drawing (`N ≥ 7r + 3`, `r ≥ 1`), the two diamond `O`-arcs `F₁` and `F₂` +satisfy (i) and (ii) of (9.4)/(9.5): every `G`-normal `[0, 1]`-arc meeting `F₁` and `F₂` contains +at least `2r` vertices of `G`, and `k(F₁, F₂) ≥ r`. -/ +theorem sphereGridMinorReduction_aux {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) + {G : Drawing S} {N r : ℕ} (hr : 1 ≤ r) (hN : 7 * r + 3 ≤ N) + (hGrid : IsGridDrawing G N) : + ∃ F₁ F₂ : Set S, + G.IsNormal F₁ ∧ G.IsNormal F₂ ∧ + IsOArc F₁ ∧ IsOArc F₂ ∧ Disjoint F₁ F₂ ∧ + (∀ F : Set S, G.IsNormal F → IsLine F → + (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → + 2 * r ≤ (G.V ∩ F).ncard) ∧ + r ≤ maxDisjointPaths G F₁ F₂ := by + have : T2Space S := hS.2.1 + obtain ⟨j, iso, hj, hV, hVertices, hEdges⟩ := hGrid + let a₁ : ℤ := 2 * (r : ℤ) + 2 + let b₁ : ℤ := 3 * (r : ℤ) + 2 + let c₁ : ℤ := 0 + let d₁ : ℤ := 1 + let a₂ : ℤ := 4 * (r : ℤ) + 2 + let b₂ : ℤ := 5 * (r : ℤ) + 2 + let c₂ : ℤ := -(2 * (r : ℤ) + 1) + let d₂ : ℤ := -(2 * (r : ℤ)) + let R₁ : Set (ℝ × ℝ) := Icc (a₁ : ℝ) (b₁ : ℝ) ×ˢ Icc (c₁ : ℝ) (d₁ : ℝ) + let R₂ : Set (ℝ × ℝ) := Icc (a₂ : ℝ) (b₂ : ℝ) ×ˢ Icc (c₂ : ℝ) (d₂ : ℝ) + let F₁ : Set S := (j ∘ diamondHomeo) '' frontier R₁ + let F₂ : Set S := (j ∘ diamondHomeo) '' frontier R₂ + have hab₁ : a₁ < b₁ := by dsimp [a₁, b₁]; omega + have hcd₁ : c₁ < d₁ := by dsimp [c₁, d₁]; omega + have hab₂ : a₂ < b₂ := by dsimp [a₂, b₂]; omega + have hcd₂ : c₂ < d₂ := by dsimp [c₂, d₂]; omega + obtain ⟨hO₁, hNorm₁⟩ := diamond_frontier_isOArc_and_isNormal hj hV hEdges hab₁ hcd₁ + obtain ⟨hO₂, hNorm₂⟩ := diamond_frontier_isOArc_and_isNormal hj hV hEdges hab₂ hcd₂ + have hR₁_bounds : ∀ p ∈ R₁, + 2 * (r : ℝ) + 1 ≤ (diamondHomeo p).1 ∧ (diamondHomeo p).1 ≤ 3 * (r : ℝ) + 2 ∧ + 2 * (r : ℝ) + 2 ≤ (diamondHomeo p).2 ∧ (diamondHomeo p).2 ≤ 3 * (r : ℝ) + 3 := by + exact first_box_diamond_coordinate_bounds (r := r) + have hR₂_bounds : ∀ p ∈ R₂, 6 * (r : ℝ) + 2 ≤ (diamondHomeo p).1 := by + exact second_box_diamond_coordinate_bound (r := r) + have hDisj : Disjoint F₁ F₂ := by + exact diamond_box_boundaries_disjoint (S := S) (r := r) hr j hj R₁ R₂ + (isClosed_Icc.prod isClosed_Icc) (isClosed_Icc.prod isClosed_Icc) hR₁_bounds hR₂_bounds + refine ⟨F₁, F₂, hNorm₁, hNorm₂, hO₁, hO₂, hDisj, ?_, ?_⟩ + · -- Condition (i): every G-normal line F meeting F₁ and F₂ has ≥ 2r vertices of G + intro F hF_norm hF_line hFF₁ hFF₂ + obtain ⟨fF⟩ := hF_line + have hF_ends : IsLineWithEnds F (fF 0).1 (fF 1).1 := ⟨fF, rfl, rfl⟩ + have hF_pc : IsPreconnected F := (IsLineWithEnds.isConnected hF_ends).2 + let x₁ : Fin (2 * r) → ℕ := fun m => 2 * r - m.val + let x₂ : Fin (2 * r) → ℕ := fun m => 3 * r + 4 + m.val + let Box : Fin (2 * r) → Set (ℝ × ℝ) := fun m => + Icc (x₁ m : ℝ) (x₂ m : ℝ) ×ˢ Icc (x₁ m : ℝ) (x₂ m : ℝ) + let OpenBox : Fin (2 * r) → Set (ℝ × ℝ) := fun m => + Ioo (x₁ m : ℝ) (x₂ m : ℝ) ×ˢ Ioo (x₁ m : ℝ) (x₂ m : ℝ) + let BdBox : Fin (2 * r) → Set (ℝ × ℝ) := fun m => Box m \ OpenBox m + have hex_pt : ∀ m : Fin (2 * r), ∃ p ∈ BdBox m, j p ∈ G.V ∩ F := by + intro m + let A : Set S := j '' Box m + let B : Set S := (j '' OpenBox m)ᶜ + have hA_closed : IsClosed A := + ((isCompact_Icc.prod isCompact_Icc).image hj.continuous).isClosed + have hB_closed : IsClosed B := + (hj.isOpenMap _ (isOpen_Ioo.prod isOpen_Ioo)).isClosed_compl + have hcov : F ⊆ A ∪ B := fun w _ => by + by_cases hw : w ∈ j '' OpenBox m + · exact Or.inl (image_mono (Set.prod_mono Ioo_subset_Icc_self Ioo_subset_Icc_self) hw) + · exact Or.inr hw + have hF₁_sub_A : F₁ ⊆ A := by + rintro _ ⟨p, hp, rfl⟩ + have hpR : p ∈ R₁ := (isClosed_Icc.prod isClosed_Icc).frontier_subset hp + obtain ⟨hb1, hb2, hb3, hb4⟩ := hR₁_bounds p hpR + have hx₁_le : (x₁ m : ℝ) ≤ 2 * (r : ℝ) := by + exact_mod_cast (Nat.sub_le (2 * r) m.val) + have hx₂_ge : 3 * (r : ℝ) + 4 ≤ (x₂ m : ℝ) := by + exact_mod_cast (Nat.le_add_right (3 * r + 4) m.val) + exact ⟨diamondHomeo p, ⟨⟨by linarith, by linarith⟩, ⟨by linarith, by linarith⟩⟩, rfl⟩ + have hF₂_sub_B : F₂ ⊆ B := by + rintro _ ⟨p, hp, rfl⟩ ⟨q, hq, hqp⟩ + have hpR : p ∈ R₂ := (isClosed_Icc.prod isClosed_Icc).frontier_subset hp + have hb := hR₂_bounds p hpR + have hq_eq : q = diamondHomeo p := hj.injective hqp + have hq_hi : q.1 < (x₂ m : ℝ) := hq.1.2 + have hx₂_le : (x₂ m : ℝ) ≤ 5 * (r : ℝ) + 3 := by + have : x₂ m ≤ 5 * r + 3 := by dsimp [x₂]; omega + exact_mod_cast this + rw [hq_eq] at hq_hi + have hr1 : (1 : ℝ) ≤ (r : ℝ) := by exact_mod_cast hr + linarith + obtain ⟨w, hwF, hwAB⟩ := preconnected_inter_nonempty_of_closed_cover hF_pc + hA_closed hB_closed hcov (hFF₁.mono (inter_subset_inter_right F hF₁_sub_A)) + (hFF₂.mono (inter_subset_inter_right F hF₂_sub_B)) + obtain ⟨⟨p, hpBox, rfl⟩, hpNotOpen⟩ := hwAB + have hpOpen : p ∉ OpenBox m := fun h => hpNotOpen ⟨p, h, rfl⟩ + have hjpU : j p ∈ G.U := box_boundary_subset_grid_U hEdges + (by dsimp [x₁, x₂]; omega) (by dsimp [x₂]; omega) + (by dsimp [x₁, x₂]; omega) (by dsimp [x₂]; omega) hpBox hpOpen + exact ⟨p, ⟨hpBox, hpOpen⟩, hF_norm ⟨hwF, hjpU⟩, hwF⟩ + choose p hp_bd hp_VF using hex_pt + have hsub_VF : range (j ∘ p) ⊆ G.V ∩ F := by + rintro _ ⟨m, rfl⟩ + exact hp_VF m + have hinj_jp : Injective (j ∘ p) := by + intro m₁ m₂ heq + have hp_eq : p m₁ = p m₂ := hj.injective heq + by_contra hne + have hlt_or : m₁.val < m₂.val ∨ m₂.val < m₁.val := + lt_or_gt_of_ne (Fin.val_ne_of_ne hne) + have hsub_open : ∀ a b : Fin (2 * r), a.val < b.val → Box a ⊆ OpenBox b := by + intro a b hab q ⟨⟨hq1, hq2⟩, ⟨hq3, hq4⟩⟩ + have hx₁_lt : (x₁ b : ℝ) < (x₁ a : ℝ) := by + have : x₁ b < x₁ a := by dsimp [x₁]; omega + exact_mod_cast this + have hx₂_lt : (x₂ a : ℝ) < (x₂ b : ℝ) := by + have : x₂ a < x₂ b := by dsimp [x₂]; omega + exact_mod_cast this + exact ⟨⟨by linarith, by linarith⟩, ⟨by linarith, by linarith⟩⟩ + rcases hlt_or with hlt | hlt + · exact (hp_bd m₂).2 (hp_eq ▸ hsub_open m₁ m₂ hlt (hp_bd m₁).1) + · exact (hp_bd m₁).2 (hp_eq.symm ▸ hsub_open m₂ m₁ hlt (hp_bd m₂).1) + have hcard_range : (range (j ∘ p)).ncard = 2 * r := by + rw [← image_univ, ncard_image_of_injective _ hinj_jp, ncard_univ, Nat.card_fin] + exact hcard_range ▸ ncard_le_ncard hsub_VF (G.finite_V.inter_of_left F) + · -- Condition (ii): r ≤ maxDisjointPaths G F₁ F₂ + apply le_csSup ⟨G.V.ncard, fun _ hk => hasDisjointPathsBetween_le_ncard_V hk⟩ + let rowIdx : Fin r → Fin N := fun k => ⟨2 * r + 2 + k.val, by omega⟩ + let startCol : Fin r → Fin N := fun k => ⟨2 * r + 2 + k.val, by omega⟩ + let endCol : Fin r → Fin N := fun k => ⟨6 * r + 2 + k.val, by omega⟩ + let W : ∀ k : Fin r, + GraphWalk G.toGraph + (iso.vertexEquiv ⟨(startCol k, rowIdx k), mem_univ _⟩).val + (iso.vertexEquiv ⟨(endCol k, rowIdx k), mem_univ _⟩).val := + fun k => gridRowWalkTo iso (rowIdx k) (endCol k) (4 * r) (2 * r + 2 + k.val) + (by omega) (by dsimp [endCol]; omega) + let P : Fin r → Drawing S := fun k => walkDrawing G (W k) + let s : Fin r → S := fun k => (iso.vertexEquiv ⟨(startCol k, rowIdx k), mem_univ _⟩).val + let t : Fin r → S := fun k => (iso.vertexEquiv ⟨(endCol k, rowIdx k), mem_univ _⟩).val + refine ⟨P, s, t, ?_, ?_⟩ + · intro k + refine ⟨walkDrawing_isSubdrawing G (W k), ?_, ?_, + walkDrawing_isPathBetween G (gridRowWalkTo_isSimple iso (rowIdx k) (endCol k) + (4 * r) (2 * r + 2 + k.val) (by omega) (by dsimp [endCol]; omega))⟩ + · -- s k ∈ F₁ + have hs_eq : s k = j (rectangularGridPoint (startCol k, rowIdx k)) := + hVertices ⟨(startCol k, rowIdx k), mem_univ _⟩ + rw [hs_eq] + let p₁ : ℝ × ℝ := ((2 * r + 2 + k.val : ℝ), 0) + have hp₁_in : p₁ ∈ R₁ := by + refine ⟨⟨?_, ?_⟩, ⟨by dsimp [p₁, c₁]; norm_num, by dsimp [p₁, d₁]; norm_num⟩⟩ + · dsimp [p₁, a₁]; push_cast; linarith + · have : k.val ≤ r := le_of_lt k.isLt + have hk_le : (k.val : ℝ) ≤ (r : ℝ) := by exact_mod_cast this + dsimp [p₁, b₁]; push_cast; linarith + have hp₁_out : p₁ ∉ interior R₁ := by + rw [interior_prod_eq, interior_Icc, interior_Icc] + intro h + have : (c₁ : ℝ) < p₁.2 := h.2.1 + dsimp [p₁, c₁] at this + norm_num at this + have h_img : diamondHomeo p₁ = rectangularGridPoint (startCol k, rowIdx k) := by + ext <;> dsimp [diamondHomeo, p₁, rectangularGridPoint, latticePoint, startCol, rowIdx] <;> + push_cast <;> ring + exact ⟨p₁, ⟨subset_closure hp₁_in, hp₁_out⟩, congrArg j h_img⟩ + · -- t k ∈ F₂ + have ht_eq : t k = j (rectangularGridPoint (endCol k, rowIdx k)) := + hVertices ⟨(endCol k, rowIdx k), mem_univ _⟩ + rw [ht_eq] + let p₂ : ℝ × ℝ := ((4 * r + 2 + k.val : ℝ), -(2 * (r : ℝ))) + have hp₂_in : p₂ ∈ R₂ := by + refine ⟨⟨?_, ?_⟩, ⟨?_, ?_⟩⟩ + · dsimp [p₂, a₂]; push_cast; linarith + · have : k.val ≤ r := le_of_lt k.isLt + have hk_le : (k.val : ℝ) ≤ (r : ℝ) := by exact_mod_cast this + dsimp [p₂, b₂]; push_cast; linarith + · dsimp [p₂, c₂]; push_cast; linarith + · dsimp [p₂, d₂]; push_cast; linarith + have hp₂_out : p₂ ∉ interior R₂ := by + rw [interior_prod_eq, interior_Icc, interior_Icc] + intro h + have : p₂.2 < (d₂ : ℝ) := h.2.2 + dsimp [p₂, d₂] at this + push_cast at this + linarith + have h_img : diamondHomeo p₂ = rectangularGridPoint (endCol k, rowIdx k) := by + ext <;> dsimp [diamondHomeo, p₂, rectangularGridPoint, latticePoint, endCol, rowIdx] <;> + push_cast <;> ring + exact ⟨p₂, ⟨subset_closure hp₂_in, hp₂_out⟩, congrArg j h_img⟩ + · -- Pairwise vertex-disjointness of P k₁ and P k₂ for k₁ ≠ k₂ + intro k₁ k₂ hne + rw [Set.disjoint_left] + intro w hw₁ hw₂ + have hw₁_supp : w ∈ (W k₁).support := by + have : w ∈ (P k₁).V := hw₁ + rwa [walkDrawing_V G (W k₁)] at this + have hw₂_supp : w ∈ (W k₂).support := by + have : w ∈ (P k₂).V := hw₂ + rwa [walkDrawing_V G (W k₂)] at this + obtain ⟨i₁, _, _, heq₁⟩ := gridRowWalkTo_mem_support iso (rowIdx k₁) (endCol k₁) + (4 * r) (2 * r + 2 + k₁.val) (by omega) (by dsimp [endCol]; omega) hw₁_supp + obtain ⟨i₂, _, _, heq₂⟩ := gridRowWalkTo_mem_support iso (rowIdx k₂) (endCol k₂) + (4 * r) (2 * r + 2 + k₂.val) (by omega) (by dsimp [endCol]; omega) hw₂_supp + have h_inj := iso.vertexEquiv.injective (Subtype.ext (heq₁.symm.trans heq₂)) + have h_snd : rowIdx k₁ = rowIdx k₂ := congrArg (Prod.snd ∘ Subtype.val) h_inj + have : 2 * r + 2 + k₁.val = 2 * r + 2 + k₂.val := congrArg Fin.val h_snd + exact hne (Fin.ext (by omega)) + +/-- **Graph Minors VII, proof of (9.6) from (9.5)** (page 246): +In a sufficiently large `N × N`-grid drawn on a sphere `Σ`, there exist two disjoint `G`-normal +`O`-arcs `F₁, F₂` satisfying conditions (i) and (ii) of (9.4)/(9.5) with +`r = rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard)`. -/ +theorem sphereGridMinorReduction : + ∀ (S : Type u) [TopologicalSpace S], + IsSurface S → + ∀ H : SurfaceDigraph S, + ∃ N₀ : ℕ, ∀ (N : ℕ) (G : SurfaceDigraph S), + N₀ ≤ N → IsGridDrawing G.G N → + ∃ F₁ F₂ : Set S, + G.G.IsNormal F₁ ∧ G.G.IsNormal F₂ ∧ + IsOArc F₁ ∧ IsOArc F₂ ∧ Disjoint F₁ F₂ ∧ + (∀ F : Set S, G.G.IsNormal F → IsLine F → + (F ∩ F₁).Nonempty → (F ∩ F₂).Nonempty → + 2 * (rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard)) ≤ (G.G.V ∩ F).ncard) ∧ + rCylinderBound H.G * 5 ^ (H.G.V.ncard + H.G.E.ncard) ≤ maxDisjointPaths G.G F₁ F₂ := by + intro S _ hS H + let t := H.G.V.ncard + H.G.E.ncard + let r := rCylinderBound H.G * 5 ^ t + have hr : 1 ≤ r := by + have hv : 1 ≤ vModel 0 0 (t + 4) (2 * t + 4) := by unfold vModel; omega + have hrC : 1 ≤ rCylinderBound H.G := by + unfold rCylinderBound + dsimp + have : 1 * 1 ≤ (84 * (t + 2)) * vModel 0 0 (t + 4) (2 * t + 4) := + Nat.mul_le_mul (by omega) hv + omega + have hpow : 1 ≤ 5 ^ t := Nat.one_le_pow t 5 (by decide) + exact le_trans (by decide : 1 ≤ 1 * 1) (Nat.mul_le_mul hrC hpow) + exact ⟨7 * r + 3, fun N G hN hGrid => sphereGridMinorReduction_aux hS hr hN hGrid⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Section9MoveOff.lean b/LeanPool/GraphMinor/GM07/Section9MoveOff.lean new file mode 100644 index 0000000000..08abc33704 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Section9MoveOff.lean @@ -0,0 +1,1047 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.MoveOff +public import LeanPool.GraphMinor.GM07.CylinderCap +public import LeanPool.GraphMinor.GM12.Section3SubspaceDrawing +public import LeanPool.GraphMinor.GM12.Section3PuncturedBoundary +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs +import LeanPool.GraphMinor.GM12.Section4DiscMatch + +/-! +# Moving a digraph off a disc and lifting to a punctured surface + +This file provides the surface-digraph transport lemmas used in Graph Minors VII, +Section 9, (9.3)–(9.5) (pages 244–246): + +- `exists_move_drawing_off_disc`: for any drawing `H` on a connected surface `S` and any closed + disc `B ⊆ S` disjoint from `bd S`, there is a homeomorphism `β : S ≃ₜ S` fixing `bd S` + pointwise such that `Disjoint (β '' H.U) B`. +- `embedDrawing`: the image of a drawing `G` under a closed embedding `f : S → T`, matching `G` + via `IsMatched`. +- `liftSurfaceDigraph`: lifts a `SurfaceDigraph S` along a closed embedding `f : S → T` into a + subspace `C ⊆ T` containing `f '' H.G.U`, with underlying drawing + `GM12.drawingInSubspace (embedDrawing hf H.G) C hUC`. +- `isBoundaryRootedMinor_of_lift`: transfers `IsBoundaryRootedMinor` from the lifted surface + digraphs on `C` back to `S`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Function Metric GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM12 + +universe u v + +/-- Every edge closure in a drawing is a union of at most two lines. -/ +theorem edge_closure_subset_lines {S : Type u} [TopologicalSpace S] [T2Space S] (H : Drawing S) : + ∃ 𝓛 : Set (Set S), 𝓛.Finite ∧ + (∀ L ∈ 𝓛, ∃ a b, IsLineWithEnds L a b) ∧ + (⋃ e ∈ H.E, closure e) = ⋃₀ 𝓛 := by + classical + have hpiece : ∀ e ∈ H.E, ∃ P : Set (Set S), P.Finite ∧ + (∀ L ∈ P, ∃ a b, IsLineWithEnds L a b) ∧ closure e = ⋃₀ P := by + intro e he + rcases H.edge_cond e he with ⟨u, v, _, _, hL⟩ | ⟨_, _, hO⟩ + · refine ⟨{closure e}, finite_singleton _, ?_, (sUnion_singleton _).symm⟩ + rintro L rfl + exact ⟨u, v, hL⟩ + · obtain ⟨φ⟩ := id hO + have hne : (φ 1).1 ≠ (φ (-1)).1 := fun h => by + have h1 := φ.injective (Subtype.ext h) + have h2 := congrArg (fun z : Circle => (z : ℂ)) h1 + norm_num at h2 + obtain ⟨A, B, hA, hB, hu, -⟩ := hO.lines (φ 1).2 (φ (-1)).2 hne + refine ⟨{A, B}, (finite_singleton B).insert A, ?_, ?_⟩ + · rintro L (rfl | rfl) + · exact ⟨_, _, hA⟩ + · exact ⟨_, _, hB⟩ + · rw [sUnion_insert, sUnion_singleton, hu] + choose! P hPfin hPline hPeq using hpiece + refine ⟨⋃ e ∈ H.E, P e, H.finite_edges.biUnion fun e he => hPfin e he, ?_, ?_⟩ + · rintro L hL + obtain ⟨e, he, hLP⟩ := mem_iUnion₂.mp hL + exact hPline e he L hLP + · ext x + simp only [mem_iUnion, mem_sUnion, exists_prop] + constructor + · rintro ⟨e, he, hxe⟩ + rw [hPeq e he, mem_sUnion] at hxe + obtain ⟨L, hLP, hxL⟩ := hxe + exact ⟨L, ⟨e, he, hLP⟩, hxL⟩ + · rintro ⟨L, ⟨e, he, hLP⟩, hxL⟩ + refine ⟨e, he, ?_⟩ + rw [hPeq e he, mem_sUnion] + exact ⟨L, hLP, hxL⟩ + +/-- In any closed disc `B` in the interior of a surface `S`, there is a closed disc `A ⊆ discInt B` +disjoint from `H.U`. -/ +theorem exists_subdisc_disjoint_drawing {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) [ConnectedSpace S] (H : Drawing S) + {B : Set S} (hB : IsClosedDisc B) (hoff : B ∩ bd S = ∅) : + ∃ A : Set S, IsClosedDisc A ∧ A ⊆ discInt B ∧ Disjoint A H.U := by + classical + have ht2 : T2Space S := hS.2.1 + have hman := hS.2.2 + have hBint : ∀ x ∈ B, IsInteriorPoint x := fun x hx => by + by_contra hn + have h1 : x ∈ B ∩ bd S := ⟨hx, hn⟩ + rw [hoff] at h1 + exact h1 + obtain ⟨𝓛, hfin, hlines, hUeq⟩ := edge_closure_subset_lines H + obtain ⟨p, hp, hpoff⟩ := exists_mem_discInt_off hS hB hfin hlines + have hUclosed : IsClosed (⋃ e ∈ H.E, closure e) := + H.finite_edges.isClosed_biUnion fun _ _ => isClosed_closure + have hp_not_edges : p ∉ ⋃ e ∈ H.E, closure e := by rwa [hUeq] + have hOpen := (hB.isOpen_discInt hman).inter hUclosed.isOpen_compl + obtain ⟨D₀, hD₀, hpD₀, hD₀s⟩ := exists_disc_in_open (hBint p hp.1) hOpen ⟨hp, hp_not_edges⟩ + obtain ⟨q, hq, hqV⟩ : ∃ q ∈ discBd D₀, q ∉ H.V := by + by_contra hn + have hsub : discBd D₀ ⊆ H.V := fun x hx => by + by_contra hxV + exact hn ⟨x, hx, hxV⟩ + exact (infinite_of_isOArc hD₀.isOArc_discBd) (H.finite_V.subset hsub) + have hqO := hD₀s (Surface.discBd_subset _ hq) + have hqU : q ∉ H.U := fun hU => by + rw [H.U_eq] at hU + rcases hU with hV | hE_mem + · exact hqV hV + · exact hqO.2 hE_mem + obtain ⟨A, hA, _, hAs⟩ := exists_disc_in_open (hBint q hqO.1.1) + ((hB.isOpen_discInt hman).inter H.isClosed_U.isOpen_compl) ⟨hqO.1, hqU⟩ + exact ⟨A, hA, fun x hx => (hAs hx).1, disjoint_left.mpr fun x hx hxU => (hAs hx).2 hxU⟩ + +/-- Graph Minors VII, proof of (9.3) (page 244): +"Moreover, by replacing $(H, H^+, H^-)$ by an isomorphic copy (under an isomorphism which fixes all +elements of $V(H) \cap \mathrm{bd}(\Sigma)$) we may arrange that $U(H) \cap \Delta = \emptyset$, so +that $(H, H^+, H^-)$ is also a proper digraph in $\Sigma'$." +For any drawing `H` on a connected surface `S` and any closed disc `B ⊆ S` with `B ∩ bd S = ∅`, +there is a homeomorphism `β : S ≃ₜ S` fixing `bd S` pointwise such that +`Disjoint (β '' H.U) B`. -/ +theorem exists_move_drawing_off_disc {S : Type u} [TopologicalSpace S] + (hS : IsSurface S) [ConnectedSpace S] (H : Drawing S) + {B : Set S} (hB : IsClosedDisc B) (hoff : B ∩ bd S = ∅) : + ∃ β : S ≃ₜ S, (∀ x ∈ bd S, β x = x) ∧ Disjoint (β '' H.U) B := by + classical + have ht2 : T2Space S := hS.2.1 + have hman := hS.2.2 + have hBint : ∀ x ∈ B, IsInteriorPoint x := fun x hx => by + by_contra hn + have h1 : x ∈ B ∩ bd S := ⟨hx, hn⟩ + rw [hoff] at h1 + exact h1 + obtain ⟨E, hE, hBE, hEs⟩ := exists_disc_around hman hB + (fun x hx => hBint x (Surface.discBd_subset _ hx)) + (isClosed_bd S).isOpen_compl + (fun x hx hb => by + have h1 : x ∈ B ∩ bd S := ⟨Surface.discBd_subset _ hx, hb⟩ + rw [hoff] at h1 + exact h1) + have hEoff : ∀ x ∈ bd S, x ∉ E := fun x hx hxE => by + rcases hEs hxE with h1 | h1 + · have h2 : x ∈ B ∩ bd S := ⟨h1, hx⟩ + rw [hoff] at h2 + exact h2 + · exact h1 hx + obtain ⟨A, hA, hAB, hdisj⟩ := exists_subdisc_disjoint_drawing hS H hB hoff + obtain ⟨e, he, hfix⟩ := GraphMinor.GM12.exists_disc_onto_nested hman hA hB hE hAB hBE + refine ⟨e, fun x hx => hfix x (hEoff x hx), ?_⟩ + rw [disjoint_left] + rintro _ ⟨x, hxU, rfl⟩ hxB + rw [← he] at hxB + obtain ⟨y, hy, hyx⟩ := hxB + rw [e.injective hyx] at hy + exact disjoint_left.mp hdisj hy hxU + +/-- Concrete image drawing under a closed embedding `f : S → T`. -/ +noncomputable def embedDrawing {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) : Drawing T where + U := f '' G.U + V := f '' G.V + V_subset_U := image_mono G.V_subset_U + isClosed_U := hf.isClosedMap _ G.isClosed_U + finite_V := G.finite_V.image _ + finite_edges := by + by_cases hne : Nonempty S + · have hset : f '' G.U \ f '' G.V = f '' (G.U \ G.V) := + (image_sdiff hf.injective _ _).symm + have harc : arcComponentsIn (f '' (G.U \ G.V)) = image f '' arcComponentsIn (G.U \ G.V) := by + refine arcComponentsIn_image (g := invFun f) hf.continuous.continuousOn ?_ + fun x _ => leftInverse_invFun hf.injective x + rw [hf.isInducing.continuousOn_iff] + refine continuousOn_id.congr ?_ + rintro _ ⟨x, -, rfl⟩ + simp [leftInverse_invFun hf.injective x] + rw [hset, harc] + exact G.finite_edges.image _ + · rw [not_nonempty_iff] at hne + have : f '' G.U \ f '' G.V = ∅ := eq_empty_of_forall_notMem fun _ ⟨⟨x, _, _⟩, _⟩ + => hne.false x + rw [this] + exact finite_empty.subset fun C hC => by + obtain ⟨x, hx⟩ := hC.1 + exact False.elim (hC.2.1 hx) + edge_cond := by + by_cases hne : Nonempty S + · have hset : f '' G.U \ f '' G.V = f '' (G.U \ G.V) := + (image_sdiff hf.injective _ _).symm + have harc : arcComponentsIn (f '' (G.U \ G.V)) = image f '' arcComponentsIn (G.U \ G.V) := by + refine arcComponentsIn_image (g := invFun f) hf.continuous.continuousOn ?_ + fun x _ => leftInverse_invFun hf.injective x + rw [hf.isInducing.continuousOn_iff] + refine continuousOn_id.congr ?_ + rintro _ ⟨x, -, rfl⟩ + simp [leftInverse_invFun hf.injective x] + have hcl : ∀ e : Set S, closure (f '' e) = f '' closure e := fun e => + (image_closure_subset_closure_image hf.continuous).antisymm' + (closure_minimal (image_mono subset_closure) (hf.isClosedMap _ isClosed_closure)) + have hcap : ∀ e : Set S, closure (f '' e) ∩ f '' G.V = f '' (closure e ∩ G.V) := fun e => by + rw [hcl, image_inter hf.injective] + rw [hset, harc] + rintro _ ⟨e, he, rfl⟩ + rcases G.edge_cond e he with ⟨u, v, h1, h2, h3⟩ | ⟨u, h2, h3⟩ + · refine .inl ⟨f u, f v, hf.injective.ne h1, by rw [hcap, h2, image_pair], ?_⟩ + rw [hcl] + exact image_line hf.isEmbedding h3 + · refine .inr ⟨f u, by rw [hcap, h2, image_singleton], ?_⟩ + rw [hcl] + exact h3.elim fun φ => ⟨φ.trans (hf.isEmbedding.homeomorphImage _)⟩ + · rw [not_nonempty_iff] at hne + rintro C ⟨⟨w, hw⟩, hC, -⟩ + obtain ⟨⟨x, _, _⟩, _⟩ := hC hw + exact (hne.false x).elim + +@[simp] +theorem embedDrawing_U {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) : + (embedDrawing hf G).U = f '' G.U := rfl + +@[simp] +theorem embedDrawing_V {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) : + (embedDrawing hf G).V = f '' G.V := rfl + +theorem embedDrawing_E {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] [Nonempty S] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) : + (embedDrawing hf G).E = image f '' G.E := by + have hset : f '' G.U \ f '' G.V = f '' (G.U \ G.V) := + (image_sdiff hf.injective _ _).symm + have harc : arcComponentsIn (f '' (G.U \ G.V)) = image f '' arcComponentsIn (G.U \ G.V) := by + refine arcComponentsIn_image (g := invFun f) hf.continuous.continuousOn ?_ + fun x _ => leftInverse_invFun hf.injective x + rw [hf.isInducing.continuousOn_iff] + refine continuousOn_id.congr ?_ + rintro _ ⟨x, -, rfl⟩ + simp [leftInverse_invFun hf.injective x] + change arcComponentsIn (f '' G.U \ f '' G.V) = _ + rw [hset, harc] + rfl + +theorem embedDrawing_isMatched {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] [Nonempty S] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) : + IsMatched G (embedDrawing hf G) f ∅ := + ⟨hf.continuous, hf.injective.injOn, empty_subset _, fun _ _ => disjoint_empty _, + by simp, by simp, embedDrawing_E hf G⟩ + +/-- Lifts a subset `s ⊆ S` into a subspace `C ⊆ T` along `f : S → T`. -/ +def liftEdge {S : Type u} {T : Type v} (f : S → T) (C : Set T) (s : Set S) : Set C := + (Subtype.val : C → T) ⁻¹' (f '' s) + +/-- Unlifts a subset `s' ⊆ C` back to `S` along `f : S → T`. -/ +def unliftEdge {S : Type u} {T : Type v} (f : S → T) (C : Set T) (s' : Set C) : Set S := + f ⁻¹' ((Subtype.val : C → T) '' s') + +/-- Lifts a point `x ∈ G.U` into `C` along `f : S → T`. -/ +def liftPt {S : Type u} {T : Type v} [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) {G : Drawing S} {C : Set T} + (hUC : (embedDrawing hf G).U ⊆ C) (x : S) (hx : x ∈ G.U) : C := + ⟨f x, hUC ⟨x, hx, rfl⟩⟩ + +@[simp] +theorem liftPt_val {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) {G : Drawing S} {C : Set T} + (hUC : (embedDrawing hf G).U ⊆ C) (x : S) (hx : x ∈ G.U) : + (liftPt hf hUC x hx).val = f x := rfl + +theorem liftPt_inj {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) {G : Drawing S} {C : Set T} + (hUC : (embedDrawing hf G).U ⊆ C) {x y : S} (hx : x ∈ G.U) (hy : y ∈ G.U) : + liftPt hf hUC x hx = liftPt hf hUC y hy ↔ x = y := by + simp [liftPt, Subtype.ext_iff, hf.injective.eq_iff] + +theorem subtype_image_liftEdge {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) {G : Drawing S} {C : Set T} + (hUC : (embedDrawing hf G).U ⊆ C) {s : Set S} (hs : s ⊆ G.U) : + (Subtype.val : C → T) '' liftEdge f C s = f '' s := by + rw [liftEdge, Subtype.image_preimage_coe, inter_eq_right.mpr ((image_mono hs).trans hUC)] + +theorem unliftEdge_liftEdge {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) {G : Drawing S} {C : Set T} + (hUC : (embedDrawing hf G).U ⊆ C) {s : Set S} (hs : s ⊆ G.U) : + unliftEdge f C (liftEdge f C s) = s := by + rw [unliftEdge, subtype_image_liftEdge hf hUC hs, preimage_image_eq _ hf.injective] + +theorem liftEdge_inj {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) {G : Drawing S} {C : Set T} + (hUC : (embedDrawing hf G).U ⊆ C) {s₁ s₂ : Set S} (hs₁ : s₁ ⊆ G.U) (hs₂ : s₂ ⊆ G.U) : + liftEdge f C s₁ = liftEdge f C s₂ ↔ s₁ = s₂ := by + constructor + · intro h + rw [← unliftEdge_liftEdge hf hUC hs₁, ← unliftEdge_liftEdge hf hUC hs₂, h] + · rintro rfl + rfl + +theorem closure_liftEdge {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) {G : Drawing S} {C : Set T} + (hUC : (embedDrawing hf G).U ⊆ C) {s : Set S} (hs : s ⊆ G.U) : + closure (liftEdge f C s) = liftEdge f C (closure s) := by + have hsC : f '' s ⊆ C := (image_mono hs).trans hUC + have hcl : closure (f '' s) = f '' closure s := + (image_closure_subset_closure_image hf.continuous).antisymm' + (closure_minimal (image_mono subset_closure) (hf.isClosedMap _ isClosed_closure)) + rw [liftEdge, closure_subtype_preimage hsC, hcl, liftEdge] + +theorem liftEdge_inter {S : Type u} {T : Type v} + {f : S → T} (hf : Injective f) (C : Set T) (s₁ s₂ : Set S) : + liftEdge f C (s₁ ∩ s₂) = liftEdge f C s₁ ∩ liftEdge f C s₂ := by + rw [liftEdge, image_inter hf, preimage_inter, ← liftEdge, ← liftEdge] + +theorem liftEdge_sdiff {S : Type u} {T : Type v} + {f : S → T} (hf : Injective f) (C : Set T) (s₁ s₂ : Set S) : + liftEdge f C (s₁ \ s₂) = liftEdge f C s₁ \ liftEdge f C s₂ := by + rw [liftEdge, image_sdiff hf, preimage_sdiff, ← liftEdge, ← liftEdge] + +theorem liftPt_mem_liftEdge {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) {G : Drawing S} {C : Set T} + (hUC : (embedDrawing hf G).U ⊆ C) {x : S} (hx : x ∈ G.U) (s : Set S) : + liftPt hf hUC x hx ∈ liftEdge f C s ↔ x ∈ s := by + simp [liftEdge, liftPt, hf.injective.eq_iff] + +theorem liftEdge_singleton {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) {G : Drawing S} {C : Set T} + (hUC : (embedDrawing hf G).U ⊆ C) {x : S} (hx : x ∈ G.U) : + liftEdge f C {x} = {liftPt hf hUC x hx} := by + ext y + simp [liftEdge, Subtype.ext_iff] + +theorem liftEdge_pair {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) {G : Drawing S} {C : Set T} + (hUC : (embedDrawing hf G).U ⊆ C) {x y : S} (hx : x ∈ G.U) (hy : y ∈ G.U) : + liftEdge f C {x, y} = {liftPt hf hUC x hx, liftPt hf hUC y hy} := by + ext z + simp [liftEdge, Subtype.ext_iff] + +theorem drawingInSubspace_embedDrawing_U {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) (C : Set T) + (hUC : (embedDrawing hf G).U ⊆ C) : + (drawingInSubspace (embedDrawing hf G) C hUC).U = liftEdge f C G.U := by + rw [drawingInSubspace_U, embedDrawing_U] + rfl + +theorem drawingInSubspace_embedDrawing_V {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) (C : Set T) + (hUC : (embedDrawing hf G).U ⊆ C) : + (drawingInSubspace (embedDrawing hf G) C hUC).V = liftEdge f C G.V := by + rw [drawingInSubspace_V, embedDrawing_V] + rfl + +theorem drawingInSubspace_embedDrawing_E {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] [Nonempty S] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) (C : Set T) + (hUC : (embedDrawing hf G).U ⊆ C) : + (drawingInSubspace (embedDrawing hf G) C hUC).E = liftEdge f C '' G.E := by + rw [drawingInSubspace_E, embedDrawing_E, image_image] + rfl + +theorem drawingInSubspace_embedDrawing_V_eq_image {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) (C : Set T) + (hUC : (embedDrawing hf G).U ⊆ C) : + (Subtype.val : C → T) '' (drawingInSubspace (embedDrawing hf G) C hUC).V = f '' G.V := by + rw [drawingInSubspace_embedDrawing_V] + exact subtype_image_liftEdge hf hUC G.V_subset_U + +theorem drawingInSubspace_embedDrawing_V_ncard {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) (C : Set T) + (hUC : (embedDrawing hf G).U ⊆ C) : + (drawingInSubspace (embedDrawing hf G) C hUC).V.ncard = G.V.ncard := by + rw [← Set.ncard_image_of_injective _ Subtype.val_injective, + drawingInSubspace_embedDrawing_V_eq_image, Set.ncard_image_of_injective _ hf.injective] + +theorem drawingInSubspace_embedDrawing_E_ncard {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] [Nonempty S] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) (C : Set T) + (hUC : (embedDrawing hf G).U ⊆ C) : + (drawingInSubspace (embedDrawing hf G) C hUC).E.ncard = G.E.ncard := by + rw [drawingInSubspace_embedDrawing_E] + refine Set.InjOn.ncard_image fun e₁ he₁ e₂ he₂ h => ?_ + exact (liftEdge_inj hf hUC ((subset_closure.trans (G.closure_subset_U he₁))) + ((subset_closure.trans (G.closure_subset_U he₂)))).mp h + +/-- Head function for `liftSurfaceDigraph`. -/ +noncomputable def liftPlus {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) (D : SurfaceDigraph S) (C : Set T) [Nonempty C] + (hUC : (embedDrawing hf D.G).U ⊆ C) (e' : Set C) : C := + letI := Classical.dec + if he : unliftEdge f C e' ∈ D.G.E then + liftPt hf hUC (D.plus (unliftEdge f C e')) (D.G.V_subset_U (D.plus_mem _ he)) + else Classical.arbitrary C + +/-- Tail function for `liftSurfaceDigraph`. -/ +noncomputable def liftMinus {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) (D : SurfaceDigraph S) (C : Set T) [Nonempty C] + (hUC : (embedDrawing hf D.G).U ⊆ C) (e' : Set C) : C := + letI := Classical.dec + if he : unliftEdge f C e' ∈ D.G.E then + liftPt hf hUC (D.minus (unliftEdge f C e')) (D.G.V_subset_U (D.minus_mem _ he)) + else Classical.arbitrary C + +theorem liftPlus_eq {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) (D : SurfaceDigraph S) (C : Set T) [Nonempty C] + (hUC : (embedDrawing hf D.G).U ⊆ C) {e' : Set C} {e : Set S} + (hun : unliftEdge f C e' = e) (he : e ∈ D.G.E) : + liftPlus hf D C hUC e' = liftPt hf hUC (D.plus e) (D.G.V_subset_U (D.plus_mem e he)) := by + subst hun + simp [liftPlus, he] + +theorem liftMinus_eq {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) (D : SurfaceDigraph S) (C : Set T) [Nonempty C] + (hUC : (embedDrawing hf D.G).U ⊆ C) {e' : Set C} {e : Set S} + (hun : unliftEdge f C e' = e) (he : e ∈ D.G.E) : + liftMinus hf D C hUC e' = liftPt hf hUC (D.minus e) (D.G.V_subset_U (D.minus_mem e he)) := by + subst hun + simp [liftMinus, he] + +/-- Lifts a `SurfaceDigraph S` along a closed embedding `f : S → T` into a subspace `C ⊆ T` +containing `f '' D.G.U`, with underlying drawing +`GM12.drawingInSubspace (embedDrawing hf D.G) C hUC`. -/ +noncomputable def liftSurfaceDigraph {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] [Nonempty S] + {f : S → T} (hf : IsClosedEmbedding f) (D : SurfaceDigraph S) (C : Set T) [Nonempty C] + (hUC : (embedDrawing hf D.G).U ⊆ C) : SurfaceDigraph C where + G := drawingInSubspace (embedDrawing hf D.G) C hUC + plus := liftPlus hf D C hUC + minus := liftMinus hf D C hUC + plus_mem := by + rw [drawingInSubspace_embedDrawing_E, drawingInSubspace_embedDrawing_V] + rintro _ ⟨e, he, rfl⟩ + have heU : e ⊆ D.G.U := subset_closure.trans (D.G.closure_subset_U he) + rw [liftPlus_eq hf D C hUC (unliftEdge_liftEdge hf hUC heU) he] + exact (liftPt_mem_liftEdge hf hUC _ _).mpr (D.plus_mem e he) + minus_mem := by + rw [drawingInSubspace_embedDrawing_E, drawingInSubspace_embedDrawing_V] + rintro _ ⟨e, he, rfl⟩ + have heU : e ⊆ D.G.U := subset_closure.trans (D.G.closure_subset_U he) + rw [liftMinus_eq hf D C hUC (unliftEdge_liftEdge hf hUC heU) he] + exact (liftPt_mem_liftEdge hf hUC _ _).mpr (D.minus_mem e he) + ends_eq := by + rw [drawingInSubspace_embedDrawing_E] + rintro _ ⟨e, he, rfl⟩ + have heU : e ⊆ D.G.U := subset_closure.trans (D.G.closure_subset_U he) + have hun := unliftEdge_liftEdge hf hUC heU + rw [liftPlus_eq hf D C hUC hun he, liftMinus_eq hf D C hUC hun he] + have htilde : tilde (liftEdge f C e) = liftEdge f C (tilde e) := by + rw [tilde, tilde, closure_liftEdge hf hUC heU, liftEdge_sdiff hf.injective] + rw [htilde, ← D.ends_eq e he, liftEdge_pair hf hUC] + +/-- Pulling a subdrawing of `drawingInSubspace (embedDrawing hf G) C hUC` back to `G`. -/ +theorem exists_pull_from_subspace {S : Type u} {T : Type v} + [TopologicalSpace S] [T1Space S] [TopologicalSpace T] [Nonempty S] + {f : S → T} (hf : IsClosedEmbedding f) {G : Drawing S} {C : Set T} + (hUC : (embedDrawing hf G).U ⊆ C) {D' : Drawing C} + (hD' : D'.IsSubdrawing (drawingInSubspace (embedDrawing hf G) C hUC)) : + ∃ D : Drawing S, D.IsSubdrawing G ∧ + liftEdge f C D.V = D'.V ∧ liftEdge f C '' D.E = D'.E ∧ + (D'.V.Nonempty → D.V.Nonempty) ∧ (D'.IsConnected → D.IsConnected) := by + classical + let G' := drawingInSubspace (embedDrawing hf G) C hUC + let D := G.span (unliftEdge f C D'.V) {e | liftEdge f C e ∈ D'.E} + have hDE : D.E = {e ∈ G.E | liftEdge f C e ∈ D'.E} := by + rw [G.span_E] + exact inter_comm _ _ + have hDV : D.V = unliftEdge f C D'.V ∩ G.V := by + rw [G.span_V, Drawing.spanV] + refine subset_antisymm ?_ (fun x hx => Or.inl hx) + rintro x (hx | hx) + · exact hx + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + have heD : e ∈ D.E := by rw [hDE]; exact ⟨he.2, he.1⟩ + have heU : e ⊆ G.U := subset_closure.trans (G.closure_subset_U he.2) + have hxU : x ∈ G.U := G.V_subset_U hxe.2 + have hmem : liftPt hf hUC x hxU ∈ closure (liftEdge f C e) ∩ G'.V := by + rw [closure_liftEdge hf hUC heU, drawingInSubspace_embedDrawing_V, + ← liftEdge_inter hf.injective] + exact (liftPt_mem_liftEdge hf hUC hxU _).mpr hxe + rw [← hD'.closure_inter_V he.1] at hmem + exact ⟨⟨liftPt hf hUC x hxU, hmem.2, rfl⟩, hxe.2⟩ + have hIV : liftEdge f C D.V = D'.V := by + ext y + constructor + · rintro ⟨x, hx, hxy⟩ + rw [hDV] at hx + obtain ⟨y', hy', hfy⟩ := hx.1 + have hyy' : y = y' := Subtype.ext (hxy.symm.trans hfy.symm) + rwa [hyy'] + · intro hy + have hyG' := hD'.1 hy + rw [drawingInSubspace_embedDrawing_V] at hyG' + obtain ⟨x, hxV, hxy⟩ := hyG' + refine ⟨x, ?_, hxy⟩ + rw [hDV] + exact ⟨⟨y, hy, hxy.symm⟩, hxV⟩ + have hIE : liftEdge f C '' D.E = D'.E := by + rw [hDE] + refine subset_antisymm ?_ fun e' he' => ?_ + · rintro _ ⟨e, he, rfl⟩ + exact he.2 + · have heG' := hD'.2 he' + rw [drawingInSubspace_embedDrawing_E] at heG' + obtain ⟨e, he, rfl⟩ := heG' + exact ⟨e, ⟨he, he'⟩, rfl⟩ + have hDV_sub : D.V ⊆ G.U := (G.span_isSubdrawing _ _).1.trans G.V_subset_U + have hne : D'.V.Nonempty → D.V.Nonempty := by + rintro ⟨y, hy⟩ + rw [← hIV] at hy + obtain ⟨x, hx, -⟩ := hy + exact ⟨x, hx⟩ + refine ⟨D, G.span_isSubdrawing _ _, hIV, hIE, hne, ?_⟩ + rintro ⟨hne', hwalk'⟩ + refine ⟨hne hne', fun x hx y hy => ?_⟩ + have hx' : liftPt hf hUC x (hDV_sub hx) ∈ D'.V := by + rw [← hIV] + exact (liftPt_mem_liftEdge hf hUC (hDV_sub hx) _).mpr hx + have hy' : liftPt hf hUC y (hDV_sub hy) ∈ D'.V := by + rw [← hIV] + exact (liftPt_mem_liftEdge hf hUC (hDV_sub hy) _).mpr hy + obtain ⟨W'⟩ := hwalk' _ hx' _ hy' + have hg : ∀ z : S, invFun f (f z) = z := leftInverse_invFun hf.injective + have hpull_walk : ∀ {u' v' : C}, GraphWalk D'.toGraph u' v' → + Nonempty (GraphWalk D.toGraph (invFun f u'.val) (invFun f v'.val)) := by + intro u' v' W + induction W with + | nil hv' => + change _ ∈ D'.V at hv' + rw [← hIV] at hv' + obtain ⟨u, hu, hfu⟩ := hv' + rw [← hfu, hg] + exact ⟨.nil hu⟩ + | @cons a' b' c' e' hlink rest ih => + obtain ⟨W_rest⟩ := ih + obtain ⟨he', ha', hb', hcap'⟩ := hlink + rw [← hIE] at he' + obtain ⟨e, he, rfl⟩ := he' + have heG : e ∈ G.E := (G.span_isSubdrawing _ _).2 he + have heU : e ⊆ G.U := subset_closure.trans (G.closure_subset_U heG) + rw [← hIV] at ha' hb' + obtain ⟨a, ha, hfa⟩ := ha' + obtain ⟨b, hb, hfb⟩ := hb' + have haU : a ∈ G.U := hDV_sub ha + have hbU : b ∈ G.U := hDV_sub hb + have ha'_eq : a' = liftPt hf hUC a haU := Subtype.ext hfa.symm + have hb'_eq : b' = liftPt hf hUC b hbU := Subtype.ext hfb.symm + have hcap : closure e ∩ D.V = {a, b} := by + apply (liftEdge_inj hf hUC (inter_subset_right.trans hDV_sub) (pair_subset haU hbU)).mp + rw [liftEdge_inter hf.injective, ← closure_liftEdge hf hUC heU, hIV, hcap', + ha'_eq, hb'_eq, liftEdge_pair hf hUC haU hbU] + have hlink_D : D.toGraph.IsLink e (invFun f a'.val) (invFun f b'.val) := by + change _ ∧ _ ∧ _ ∧ _ + rw [← hfa, ← hfb, hg, hg] + exact ⟨he, ha, hb, hcap⟩ + exact ⟨.cons hlink_D W_rest⟩ + obtain ⟨W⟩ := hpull_walk W' + dsimp only [liftPt_val] at W + rw [hg, hg] at W + exact ⟨W⟩ + +/-- Transfers `IsBoundaryRootedMinor` from lifted surface digraphs in `C` back to `S`. -/ +theorem isBoundaryRootedMinor_of_lift {S : Type u} {T : Type v} + [TopologicalSpace S] [T1Space S] [TopologicalSpace T] [Nonempty S] + {f_H f_G : S → T} (hf_H : IsClosedEmbedding f_H) (hf_G : IsClosedEmbedding f_G) + (H G : SurfaceDigraph S) (C : Set T) [Nonempty C] + (hC_H : (embedDrawing hf_H H.G).U ⊆ C) (hC_G : (embedDrawing hf_G G.G).U ⊆ C) + (hbd_VG : H.G.V ∩ bd S = G.G.V ∩ bd S) + (hbd_eq : ∀ x ∈ bd S, f_H x = f_G x) + (hbd_lift : ∀ v (hv : v ∈ H.G.V ∩ bd S), + liftPt hf_H hC_H v (H.G.V_subset_U hv.1) ∈ bd C) + (hminor : IsBoundaryRootedMinor + (liftSurfaceDigraph hf_H H C hC_H) (liftSurfaceDigraph hf_G G C hC_G)) : + IsBoundaryRootedMinor H G := by + classical + let H' := liftSurfaceDigraph hf_H H C hC_H + let G' := liftSurfaceDigraph hf_G G C hC_G + obtain ⟨_, φv', φe', hsub', hedge', hdisj', hinj', hnotMem', hends', hbd'⟩ := hminor + have hpull : ∀ v (hv : v ∈ H.G.V), ∃ D : Drawing S, D.IsSubdrawing G.G ∧ + liftEdge f_G C D.V = (φv' (liftPt hf_H hC_H v (H.G.V_subset_U hv))).V ∧ + liftEdge f_G C '' D.E = (φv' (liftPt hf_H hC_H v (H.G.V_subset_U hv))).E ∧ + D.V.Nonempty ∧ D.IsConnected := by + intro v hv + have hv' : liftPt hf_H hC_H v (H.G.V_subset_U hv) ∈ H'.G.V := by + rw [show H'.G = drawingInSubspace (embedDrawing hf_H H.G) C hC_H from rfl, + drawingInSubspace_embedDrawing_V] + exact (liftPt_mem_liftEdge hf_H hC_H _ _).mpr hv + obtain ⟨h1, h2, h3⟩ := hsub' _ hv' + obtain ⟨D, hDsub, hDV, hDE, hne, hconn⟩ := exists_pull_from_subspace hf_G hC_G h1 + exact ⟨D, hDsub, hDV, hDE, hne h2, hconn h3⟩ + choose! φv hφv_sub hφv_V hφv_E hφv_ne hφv_conn using hpull + let φe : Set S → Set S := fun e => unliftEdge f_G C (φe' (liftEdge f_H C e)) + have hφe_lift : ∀ e ∈ H.G.E, φe e ∈ G.G.E ∧ liftEdge f_G C (φe e) = φe' (liftEdge f_H C e) := by + intro e he + have he' : liftEdge f_H C e ∈ H'.G.E := by + rw [show H'.G = drawingInSubspace (embedDrawing hf_H H.G) C hC_H from rfl, + drawingInSubspace_embedDrawing_E] + exact ⟨e, he, rfl⟩ + have hmem := hedge' _ he' + rw [show G'.G = drawingInSubspace (embedDrawing hf_G G.G) C hC_G from rfl, + drawingInSubspace_embedDrawing_E] at hmem + obtain ⟨g, hg, hg_eq⟩ := hmem + have hgU : g ⊆ G.G.U := subset_closure.trans (G.G.closure_subset_U hg) + have hφe_eq : φe e = g := by + change unliftEdge f_G C (φe' (liftEdge f_H C e)) = g + rw [← hg_eq, unliftEdge_liftEdge hf_G hC_G hgU] + rw [hφe_eq] + exact ⟨hg, hg_eq⟩ + refine ⟨hbd_VG, φv, φe, + fun v hv => ⟨hφv_sub v hv, hφv_ne v hv, hφv_conn v hv⟩, + fun e he => (hφe_lift e he).1, ?_, ?_, ?_, ?_, ?_⟩ + · intro v hv v' hv' hne + rw [disjoint_left] + intro x hxv hxv' + have hxU : x ∈ G.G.U := G.G.V_subset_U ((hφv_sub v hv).1 hxv) + have hx1 : liftPt hf_G hC_G x hxU ∈ (φv' (liftPt hf_H hC_H v (H.G.V_subset_U hv))).V := by + rw [← hφv_V v hv] + exact (liftPt_mem_liftEdge hf_G hC_G hxU _).mpr hxv + have hx2 : liftPt hf_G hC_G x hxU ∈ (φv' (liftPt hf_H hC_H v' (H.G.V_subset_U hv'))).V := by + rw [← hφv_V v' hv'] + exact (liftPt_mem_liftEdge hf_G hC_G hxU _).mpr hxv' + have hv_mem : liftPt hf_H hC_H v (H.G.V_subset_U hv) ∈ H'.G.V := by + rw [show H'.G = drawingInSubspace (embedDrawing hf_H H.G) C hC_H from rfl, + drawingInSubspace_embedDrawing_V] + exact (liftPt_mem_liftEdge hf_H hC_H _ _).mpr hv + have hv'_mem : liftPt hf_H hC_H v' (H.G.V_subset_U hv') ∈ H'.G.V := by + rw [show H'.G = drawingInSubspace (embedDrawing hf_H H.G) C hC_H from rfl, + drawingInSubspace_embedDrawing_V] + exact (liftPt_mem_liftEdge hf_H hC_H _ _).mpr hv' + have hne' : liftPt hf_H hC_H v (H.G.V_subset_U hv) ≠ + liftPt hf_H hC_H v' (H.G.V_subset_U hv') := by + rwa [Ne, liftPt_inj hf_H hC_H] + exact disjoint_left.mp (hdisj' _ hv_mem _ hv'_mem hne') hx1 hx2 + · intro e₁ he₁ e₂ he₂ hne heq + have he₁' : liftEdge f_H C e₁ ∈ H'.G.E := by + rw [show H'.G = drawingInSubspace (embedDrawing hf_H H.G) C hC_H from rfl, + drawingInSubspace_embedDrawing_E] + exact ⟨e₁, he₁, rfl⟩ + have he₂' : liftEdge f_H C e₂ ∈ H'.G.E := by + rw [show H'.G = drawingInSubspace (embedDrawing hf_H H.G) C hC_H from rfl, + drawingInSubspace_embedDrawing_E] + exact ⟨e₂, he₂, rfl⟩ + have hne' : liftEdge f_H C e₁ ≠ liftEdge f_H C e₂ := by + rwa [Ne, liftEdge_inj hf_H hC_H (subset_closure.trans (H.G.closure_subset_U he₁)) + (subset_closure.trans (H.G.closure_subset_U he₂))] + apply hinj' _ he₁' _ he₂' hne' + rw [← (hφe_lift e₁ he₁).2, ← (hφe_lift e₂ he₂).2, heq] + · intro v hv e he hmem + have hv' : liftPt hf_H hC_H v (H.G.V_subset_U hv) ∈ H'.G.V := by + rw [show H'.G = drawingInSubspace (embedDrawing hf_H H.G) C hC_H from rfl, + drawingInSubspace_embedDrawing_V] + exact (liftPt_mem_liftEdge hf_H hC_H _ _).mpr hv + have he' : liftEdge f_H C e ∈ H'.G.E := by + rw [show H'.G = drawingInSubspace (embedDrawing hf_H H.G) C hC_H from rfl, + drawingInSubspace_embedDrawing_E] + exact ⟨e, he, rfl⟩ + apply hnotMem' _ hv' _ he' + rw [← (hφe_lift e he).2, ← hφv_E v hv] + exact ⟨φe e, hmem, rfl⟩ + · intro e he + have he' : liftEdge f_H C e ∈ H'.G.E := by + rw [show H'.G = drawingInSubspace (embedDrawing hf_H H.G) C hC_H from rfl, + drawingInSubspace_embedDrawing_E] + exact ⟨e, he, rfl⟩ + obtain ⟨hp', hm'⟩ := hends' _ he' + have heU_H : e ⊆ H.G.U := subset_closure.trans (H.G.closure_subset_U he) + have hun_H : unliftEdge f_H C (liftEdge f_H C e) = e := unliftEdge_liftEdge hf_H hC_H heU_H + have hHplus : H'.plus (liftEdge f_H C e) = + liftPt hf_H hC_H (H.plus e) (H.G.V_subset_U (H.plus_mem e he)) := + liftPlus_eq hf_H H C hC_H hun_H he + have hHminus : H'.minus (liftEdge f_H C e) = + liftPt hf_H hC_H (H.minus e) (H.G.V_subset_U (H.minus_mem e he)) := + liftMinus_eq hf_H H C hC_H hun_H he + have hφeG := (hφe_lift e he).1 + have hφeU_G : φe e ⊆ G.G.U := subset_closure.trans (G.G.closure_subset_U hφeG) + have hun_G : unliftEdge f_G C (φe' (liftEdge f_H C e)) = φe e := by + rw [← (hφe_lift e he).2, unliftEdge_liftEdge hf_G hC_G hφeU_G] + have hGplus : G'.plus (φe' (liftEdge f_H C e)) = + liftPt hf_G hC_G (G.plus (φe e)) (G.G.V_subset_U (G.plus_mem _ hφeG)) := + liftPlus_eq hf_G G C hC_G hun_G hφeG + have hGminus : G'.minus (φe' (liftEdge f_H C e)) = + liftPt hf_G hC_G (G.minus (φe e)) (G.G.V_subset_U (G.minus_mem _ hφeG)) := + liftMinus_eq hf_G G C hC_G hun_G hφeG + rw [hHplus, hGplus, ← hφv_V (H.plus e) (H.plus_mem e he), + liftPt_mem_liftEdge hf_G hC_G] at hp' + rw [hHminus, hGminus, ← hφv_V (H.minus e) (H.minus_mem e he), + liftPt_mem_liftEdge hf_G hC_G] at hm' + exact ⟨hp', hm'⟩ + · intro v hv + have hv' : liftPt hf_H hC_H v (H.G.V_subset_U hv.1) ∈ H'.G.V ∩ bd C := by + refine ⟨?_, hbd_lift v hv⟩ + rw [show H'.G = drawingInSubspace (embedDrawing hf_H H.G) C hC_H from rfl, + drawingInSubspace_embedDrawing_V] + exact (liftPt_mem_liftEdge hf_H hC_H _ _).mpr hv.1 + have hmem := hbd' _ hv' + have hvG : v ∈ G.G.V := (hbd_VG ▸ hv).1 + have hpt_eq : liftPt hf_H hC_H v (H.G.V_subset_U hv.1) = + liftPt hf_G hC_G v (G.G.V_subset_U hvG) := + Subtype.ext (hbd_eq v hv.2) + rw [← hφv_V v hv.1] at hmem + rw [hpt_eq, liftPt_mem_liftEdge hf_G hC_G] at hmem + exact hmem + +/-- Arithmetic bound on `numInternalIsolatedVertices` used in the proofs of (9.3)–(9.5). -/ +theorem numInternalIsolatedVertices_add_bd_le {X : Type*} [TopologicalSpace X] (Γ : Drawing X) : + numInternalIsolatedVertices Γ + (Γ.V ∩ bd X).ncard ≤ Γ.V.ncard := by + have hle : numInternalIsolatedVertices Γ ≤ (Γ.V \ bd X).ncard := + Set.ncard_le_ncard (fun _ hx => hx.1) Γ.finite_V.sdiff + have heq : (Γ.V ∩ bd X).ncard + (Γ.V \ bd X).ncard = Γ.V.ncard := + Set.ncard_inter_add_ncard_sdiff_eq_ncard Γ.V (bd X) Γ.finite_V + omega + +/-! ### Transport of arcs, normality, vertex counts, and disjoint paths along `liftEdge` -/ + +theorem subtype_image_liftEdge_of_subset {S : Type u} {T : Type v} + {f : S → T} {C : Set T} {s : Set S} (hsC : f '' s ⊆ C) : + (Subtype.val : C → T) '' liftEdge f C s = f '' s := by + rw [liftEdge, Subtype.image_preimage_coe, inter_eq_right.mpr hsC] + +theorem unliftEdge_liftEdge_of_subset {S : Type u} {T : Type v} + {f : S → T} (hf : Injective f) {C : Set T} {s : Set S} (hsC : f '' s ⊆ C) : + unliftEdge f C (liftEdge f C s) = s := by + rw [unliftEdge, subtype_image_liftEdge_of_subset hsC, preimage_image_eq _ hf] + +theorem image_unliftEdge_of_subset {S : Type u} {T : Type v} + {f : S → T} {C : Set T} {s' : Set C} (hs' : (Subtype.val : C → T) '' s' ⊆ range f) : + f '' unliftEdge f C s' = (Subtype.val : C → T) '' s' := by + rw [unliftEdge, image_preimage_eq_inter_range, inter_eq_left.mpr hs'] + +theorem liftEdge_unliftEdge_of_subset {S : Type u} {T : Type v} + {f : S → T} {C : Set T} {s' : Set C} (hs' : (Subtype.val : C → T) '' s' ⊆ range f) : + liftEdge f C (unliftEdge f C s') = s' := by + rw [liftEdge, image_unliftEdge_of_subset hs', preimage_image_eq _ Subtype.val_injective] + +theorem disjoint_liftEdge {S : Type u} {T : Type v} + {f : S → T} (hf : Injective f) (C : Set T) {s₁ s₂ : Set S} (hd : Disjoint s₁ s₂) : + Disjoint (liftEdge f C s₁) (liftEdge f C s₂) := by + rw [disjoint_iff_inter_eq_empty, ← liftEdge_inter hf, hd.inter_eq, liftEdge, image_empty, + preimage_empty] + +theorem nonempty_liftEdge_iff {S : Type u} {T : Type v} + {f : S → T} {C : Set T} {s : Set S} (hsC : f '' s ⊆ C) : + (liftEdge f C s).Nonempty ↔ s.Nonempty := by + constructor + · rintro ⟨y, x, hx, _⟩ + exact ⟨x, hx⟩ + · rintro ⟨x, hx⟩ + exact ⟨⟨f x, hsC ⟨x, hx, rfl⟩⟩, x, hx, rfl⟩ + +theorem nonempty_unliftEdge_iff {S : Type u} {T : Type v} + {f : S → T} {C : Set T} {s' : Set C} (hs' : (Subtype.val : C → T) '' s' ⊆ range f) : + (unliftEdge f C s').Nonempty ↔ s'.Nonempty := by + constructor + · rintro ⟨x, y, hy, _⟩ + exact ⟨y, hy⟩ + · rintro ⟨y, hy⟩ + obtain ⟨x, hx⟩ := hs' ⟨y, hy, rfl⟩ + exact ⟨x, y, hy, hx.symm⟩ + +/-- Homeomorphism between `F : Set S` and `liftEdge f C F : Set C` when `f : S → T` is an embedding +and `f '' F ⊆ C`. -/ +noncomputable def liftEdgeHomeomorph {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsEmbedding f) {C : Set T} {F : Set S} (hFC : f '' F ⊆ C) : + F ≃ₜ liftEdge f C F := + (hf.homeomorphImage F).trans + { toFun := fun x => ⟨⟨x.1, hFC x.2⟩, x.2⟩ + invFun := fun x => ⟨x.1.1, x.2⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl + continuous_toFun := (continuous_subtype_val.subtype_mk _).subtype_mk _ + continuous_invFun := (continuous_subtype_val.comp continuous_subtype_val).subtype_mk _ } + +/-- Homeomorphism between `F' : Set C` and `unliftEdge f C F' : Set S` when `f : S → T` is an +embedding and `(Subtype.val : C → T) '' F' ⊆ range f`. -/ +noncomputable def unliftEdgeHomeomorph {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsEmbedding f) {C : Set T} {F' : Set C} + (hF' : (Subtype.val : C → T) '' F' ⊆ range f) : + F' ≃ₜ unliftEdge f C F' := + let e : F' ≃ₜ f '' unliftEdge f C F' := + (IsEmbedding.subtypeVal.homeomorphImage F').trans + (Homeomorph.setCongr (image_unliftEdge_of_subset hF').symm) + e.trans (hf.homeomorphImage (unliftEdge f C F')).symm + +theorem isOArc_liftEdge {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsEmbedding f) {C : Set T} {F : Set S} + (hFC : f '' F ⊆ C) (hF : IsOArc F) : + IsOArc (liftEdge f C F) := + hF.elim fun φ => ⟨φ.trans (liftEdgeHomeomorph hf hFC)⟩ + +theorem isLine_liftEdge {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsEmbedding f) {C : Set T} {F : Set S} + (hFC : f '' F ⊆ C) (hF : IsLine F) : + IsLine (liftEdge f C F) := + hF.elim fun φ => ⟨φ.trans (liftEdgeHomeomorph hf hFC)⟩ + +theorem isLine_unliftEdge {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsEmbedding f) {C : Set T} {F' : Set C} + (hF' : (Subtype.val : C → T) '' F' ⊆ range f) (hL : IsLine F') : + IsLine (unliftEdge f C F') := + hL.elim fun φ => ⟨φ.trans (unliftEdgeHomeomorph hf hF')⟩ + +theorem isOArc_unliftEdge {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsEmbedding f) {C : Set T} {F' : Set C} + (hF' : (Subtype.val : C → T) '' F' ⊆ range f) (hO : IsOArc F') : + IsOArc (unliftEdge f C F') := + hO.elim fun φ => ⟨φ.trans (unliftEdgeHomeomorph hf hF')⟩ + +theorem drawingInSubspace_embedDrawing_isNormal_unliftEdge {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) (C : Set T) + (hUC : (embedDrawing hf G).U ⊆ C) {F' : Set C} + (hn : (drawingInSubspace (embedDrawing hf G) C hUC).IsNormal F') : + G.IsNormal (unliftEdge f C F') := by + rintro x ⟨⟨y, hyF', hfy⟩, hxU⟩ + have hyU : y ∈ (drawingInSubspace (embedDrawing hf G) C hUC).U := by + rw [drawingInSubspace_embedDrawing_U] + exact ⟨x, hxU, hfy.symm⟩ + have hyV := hn ⟨hyF', hyU⟩ + rw [drawingInSubspace_embedDrawing_V] at hyV + obtain ⟨z, hzV, hfz⟩ := hyV + rwa [hf.injective (hfy.symm.trans hfz.symm)] + +theorem drawingInSubspace_embedDrawing_isNormal_liftEdge {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) (C : Set T) + (hUC : (embedDrawing hf G).U ⊆ C) {F : Set S} + (hn : G.IsNormal F) : + (drawingInSubspace (embedDrawing hf G) C hUC).IsNormal (liftEdge f C F) := by + rintro y ⟨⟨x, hxF, hfx⟩, hyU⟩ + rw [drawingInSubspace_embedDrawing_U] at hyU + obtain ⟨z, hzU, hfz⟩ := hyU + have hxz : x = z := hf.injective (hfx.trans hfz.symm) + subst hxz + rw [drawingInSubspace_embedDrawing_V] + exact ⟨x, hn ⟨hxF, hzU⟩, hfx⟩ + +theorem drawingInSubspace_embedDrawing_V_inter_unliftEdge_ncard {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) (C : Set T) + (hUC : (embedDrawing hf G).U ⊆ C) (F' : Set C) : + ((drawingInSubspace (embedDrawing hf G) C hUC).V ∩ F').ncard = + (G.V ∩ unliftEdge f C F').ncard := by + have heq : (Subtype.val : C → T) '' ((drawingInSubspace (embedDrawing hf G) C hUC).V ∩ F') = + f '' (G.V ∩ unliftEdge f C F') := by + rw [drawingInSubspace_image_vertices_inter, embedDrawing_V] + ext z + constructor + · rintro ⟨⟨x, hxV, rfl⟩, y, hyF', hfy⟩ + exact ⟨x, ⟨hxV, y, hyF', hfy⟩, rfl⟩ + · rintro ⟨x, ⟨hxV, y, hyF', hfy⟩, rfl⟩ + exact ⟨⟨x, hxV, rfl⟩, y, hyF', hfy⟩ + rw [← Set.ncard_image_of_injective _ Subtype.val_injective, heq, + Set.ncard_image_of_injective _ hf.injective] + +theorem drawingInSubspace_embedDrawing_V_inter_liftEdge_ncard {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) (C : Set T) + (hUC : (embedDrawing hf G).U ⊆ C) (F : Set S) : + ((drawingInSubspace (embedDrawing hf G) C hUC).V ∩ liftEdge f C F).ncard = + (G.V ∩ F).ncard := by + rw [drawingInSubspace_embedDrawing_V, ← liftEdge_inter hf.injective] + have hsub : f '' (G.V ∩ F) ⊆ C := + (image_mono (inter_subset_left.trans G.V_subset_U)).trans hUC + rw [← Set.ncard_image_of_injective _ Subtype.val_injective, + subtype_image_liftEdge_of_subset hsub, Set.ncard_image_of_injective _ hf.injective] + +theorem hasDisjointPathsBetween_zero {S : Type u} [TopologicalSpace S] + (G : Drawing S) (X Y : Set S) : HasDisjointPathsBetween G X Y 0 := + ⟨Fin.elim0, Fin.elim0, Fin.elim0, fun i => i.elim0, fun i => i.elim0⟩ + +theorem hasDisjointPathsBetween_le_ncard_V {S : Type u} [TopologicalSpace S] + {G : Drawing S} {X Y : Set S} {k : ℕ} (h : HasDisjointPathsBetween G X Y k) : + k ≤ G.V.ncard := by + classical + obtain ⟨P, s, t, hP, hdisj⟩ := h + have hsV : ∀ i, s i ∈ (P i).V := fun i => by + obtain ⟨W, _, hV, _⟩ := (hP i).2.2.2 + rw [hV] + exact W.start_mem_support + have hsG : range s ⊆ G.V := by + rintro _ ⟨i, rfl⟩ + exact (hP i).1.1 (hsV i) + have hinj : Injective s := fun i j hij => by + by_contra hne + exact disjoint_left.mp (hdisj i j hne) (hsV i) (hij ▸ hsV j) + have hcard : (range s).ncard = k := by + rw [Set.ncard_range_of_injective hinj, Nat.card_fin] + rw [← hcard] + exact Set.ncard_le_ncard hsG G.finite_V + +/-- Pushing a graph walk of `D` to `drawingInSubspace (embedDrawing hf D) C hDU`. -/ +noncomputable def liftGraphWalk {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] [Nonempty S] + {f : S → T} (hf : IsClosedEmbedding f) {D : Drawing S} {C : Set T} + (hDU : (embedDrawing hf D).U ⊆ C) : + ∀ {u v : S} (W : GraphWalk D.toGraph u v), + GraphWalk (drawingInSubspace (embedDrawing hf D) C hDU).toGraph + (liftPt hf hDU u (D.V_subset_U (W.mem_vertexSet_of_mem_support W.start_mem_support))) + (liftPt hf hDU v (D.V_subset_U (W.mem_vertexSet_of_mem_support W.end_mem_support))) + | _, _, .nil hv => .nil (by + change _ ∈ (drawingInSubspace (embedDrawing hf D) C hDU).V + rw [drawingInSubspace_embedDrawing_V] + exact (liftPt_mem_liftEdge hf hDU (D.V_subset_U hv) D.V).mpr hv) + | a, _, @GraphWalk.cons _ _ _ _ b c e hlink rest => + have ha : a ∈ D.V := hlink.2.1 + have hb : b ∈ D.V := hlink.2.2.1 + have he : e ∈ D.E := hlink.1 + have heU : e ⊆ D.U := subset_closure.trans (D.closure_subset_U he) + have hlink' : (drawingInSubspace (embedDrawing hf D) C hDU).toGraph.IsLink + (liftEdge f C e) + (liftPt hf hDU a (D.V_subset_U ha)) + (liftPt hf hDU b (D.V_subset_U hb)) := by + refine ⟨?_, ?_, ?_, ?_⟩ + · rw [drawingInSubspace_embedDrawing_E] + exact ⟨e, he, rfl⟩ + · rw [drawingInSubspace_embedDrawing_V] + exact (liftPt_mem_liftEdge hf hDU (D.V_subset_U ha) D.V).mpr ha + · rw [drawingInSubspace_embedDrawing_V] + exact (liftPt_mem_liftEdge hf hDU (D.V_subset_U hb) D.V).mpr hb + · rw [closure_liftEdge hf hDU heU, drawingInSubspace_embedDrawing_V, + ← liftEdge_inter hf.injective, hlink.2.2.2, + liftEdge_pair hf hDU (D.V_subset_U ha) (D.V_subset_U hb)] + .cons hlink' (liftGraphWalk hf hDU rest) + +theorem liftGraphWalk_support_val {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] [Nonempty S] + {f : S → T} (hf : IsClosedEmbedding f) {D : Drawing S} {C : Set T} + (hDU : (embedDrawing hf D).U ⊆ C) {u v : S} (W : GraphWalk D.toGraph u v) : + (liftGraphWalk hf hDU W).support.map Subtype.val = W.support.map f := by + induction W with + | nil _ => rfl + | cons _ _ ih => simp [liftGraphWalk, ih] + +theorem liftGraphWalk_edges {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] [Nonempty S] + {f : S → T} (hf : IsClosedEmbedding f) {D : Drawing S} {C : Set T} + (hDU : (embedDrawing hf D).U ⊆ C) {u v : S} (W : GraphWalk D.toGraph u v) : + (liftGraphWalk hf hDU W).edges = W.edges.map (liftEdge f C) := by + induction W with + | nil _ => rfl + | cons _ _ ih => simp [liftGraphWalk, ih] + +theorem hasDisjointPathsBetween_liftEdge {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] [Nonempty S] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) (C : Set T) + (hUC : (embedDrawing hf G).U ⊆ C) {X Y : Set S} {k : ℕ} + (h : HasDisjointPathsBetween G X Y k) : + HasDisjointPathsBetween (drawingInSubspace (embedDrawing hf G) C hUC) + (liftEdge f C X) (liftEdge f C Y) k := by + obtain ⟨P, s, t, hP, hdisj⟩ := h + have hPU : ∀ i, (embedDrawing hf (P i)).U ⊆ C := fun i => + (image_mono (hP i).1.U_subset).trans hUC + let P' : Fin k → Drawing C := fun i => drawingInSubspace (embedDrawing hf (P i)) C (hPU i) + have hsV : ∀ i, s i ∈ (P i).V := fun i => by + obtain ⟨W, _, hV, _⟩ := (hP i).2.2.2 + rw [hV] + exact W.start_mem_support + have htV : ∀ i, t i ∈ (P i).V := fun i => by + obtain ⟨W, _, hV, _⟩ := (hP i).2.2.2 + rw [hV] + exact W.end_mem_support + let s' : Fin k → C := fun i => liftPt hf (hPU i) (s i) ((P i).V_subset_U (hsV i)) + let t' : Fin k → C := fun i => liftPt hf (hPU i) (t i) ((P i).V_subset_U (htV i)) + refine ⟨P', s', t', fun i => ?_, fun i j hij => ?_⟩ + · obtain ⟨hsub, hsX, htY, W, hWsim, hPV, hPE⟩ := hP i + refine ⟨⟨?_, ?_⟩, ?_, ?_, ?_⟩ + · rw [drawingInSubspace_embedDrawing_V, drawingInSubspace_embedDrawing_V] + exact preimage_mono (image_mono hsub.1) + · rw [drawingInSubspace_embedDrawing_E, drawingInSubspace_embedDrawing_E] + exact image_mono hsub.2 + · exact (liftPt_mem_liftEdge hf (hPU i) ((P i).V_subset_U (hsV i)) X).mpr hsX + · exact (liftPt_mem_liftEdge hf (hPU i) ((P i).V_subset_U (htV i)) Y).mpr htY + · refine ⟨liftGraphWalk hf (hPU i) W, ?_, ?_, ?_⟩ + · change (liftGraphWalk hf (hPU i) W).support.Nodup + have hmap : (liftGraphWalk hf (hPU i) W).support.map Subtype.val = W.support.map f := + liftGraphWalk_support_val hf (hPU i) W + exact List.Nodup.of_map Subtype.val (hmap ▸ hWsim.map hf.injective) + · ext y + rw [show (P' i).V = liftEdge f C (P i).V from drawingInSubspace_embedDrawing_V _ _ _ _] + constructor + · rintro ⟨x, hx, hfx⟩ + rw [hPV] at hx + have hmem : f x ∈ (liftGraphWalk hf (hPU i) W).support.map Subtype.val := by + rw [liftGraphWalk_support_val] + exact List.mem_map_of_mem hx + obtain ⟨y', hy', hfy'⟩ := List.mem_map.mp hmem + rwa [Subtype.ext (hfx.symm.trans hfy'.symm)] + · intro hy + have hmem : y.val ∈ W.support.map f := by + rw [← liftGraphWalk_support_val hf (hPU i) W] + exact List.mem_map_of_mem hy + obtain ⟨x, hx, hfx⟩ := List.mem_map.mp hmem + have hxV : x ∈ (P i).V := by rw [hPV]; exact hx + exact ⟨x, hxV, hfx⟩ + · ext e' + rw [show (P' i).E = liftEdge f C '' (P i).E from drawingInSubspace_embedDrawing_E _ _ _ _, + liftGraphWalk_edges] + simp [hPE] + · rw [show (P' i).V = liftEdge f C (P i).V from drawingInSubspace_embedDrawing_V _ _ _ _, + show (P' j).V = liftEdge f C (P j).V from drawingInSubspace_embedDrawing_V _ _ _ _] + exact disjoint_liftEdge hf.injective C (hdisj i j hij) + +theorem maxDisjointPaths_le_liftEdge {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] [Nonempty S] + {f : S → T} (hf : IsClosedEmbedding f) (G : Drawing S) (C : Set T) + (hUC : (embedDrawing hf G).U ⊆ C) (X Y : Set S) : + maxDisjointPaths G X Y ≤ + maxDisjointPaths (drawingInSubspace (embedDrawing hf G) C hUC) + (liftEdge f C X) (liftEdge f C Y) := by + let G' := drawingInSubspace (embedDrawing hf G) C hUC + have hne : {k : ℕ | HasDisjointPathsBetween G X Y k}.Nonempty := + ⟨0, hasDisjointPathsBetween_zero G X Y⟩ + have hbdd' : BddAbove {k : ℕ | HasDisjointPathsBetween G' (liftEdge f C X) (liftEdge f C Y) k} := + ⟨G'.V.ncard, fun k hk => hasDisjointPathsBetween_le_ncard_V hk⟩ + exact csSup_le hne fun k hk => + le_csSup hbdd' (hasDisjointPathsBetween_liftEdge hf G C hUC hk) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/ShrinkForest.lean b/LeanPool/GraphMinor/GM07/ShrinkForest.lean new file mode 100644 index 0000000000..5717091fab --- /dev/null +++ b/LeanPool/GraphMinor/GM07/ShrinkForest.lean @@ -0,0 +1,268 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.MoveHomotopy +public import LeanPool.GraphMinor.GM07.ForestPeel + +/-! +# Shrinking a forest to a finite set + +This is the induction on `|E(L)|` that Graph Minors VII offers for (4.4) on page 223. A forest with +no `O`-arc and no `I`-arc grows from `bd(Σ)` one line at a time (`exists_growth`). The last line has +a free end, so it can be slid along itself into any open set around its other end. So a move carries +the whole forest into any open set around a finite set of roots (`exists_shrink`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] + +/-- A small initial piece of a path stays in an open set. -/ +theorem exists_initial {f : unitInterval → S} (hf : Continuous f) {N : Set S} (hN : IsOpen N) + (hf0 : f 0 ∈ N) : ∃ t : unitInterval, 0 < t.1 ∧ t.1 < 1 ∧ ∀ s, s ≤ t → f s ∈ N := by + obtain ⟨r, hr, hball⟩ := Metric.isOpen_iff.mp (hN.preimage hf) 0 hf0 + have h2 : 0 < min (r / 2) (1 / 2 : ℝ) := lt_min (by positivity) (by norm_num) + have h3 : min (r / 2) (1 / 2 : ℝ) ≤ 1 / 2 := min_le_right _ _ + refine ⟨⟨min (r / 2) (1 / 2), h2.le, by linarith⟩, h2, ?_, fun s hs => hball ?_⟩ + · change min (r / 2) (1 / 2 : ℝ) < 1 + linarith + · rw [Metric.mem_ball, Subtype.dist_eq, Real.dist_eq] + have h1 : s.1 ≤ min (r / 2) (1 / 2) := hs + have h4 : min (r / 2) (1 / 2 : ℝ) ≤ r / 2 := min_le_left _ _ + have h5 := s.2.1 + change |s.1 - 0| < r + rw [sub_zero, abs_of_nonneg h5] + linarith + +/-- The arc `f` from `f t` on. -/ +theorem exists_tail {f : unitInterval → S} (hf : IsArcMap f) {t : unitInterval} (ht0 : 0 < t.1) + (ht1 : t.1 < 1) : + ∃ A : unitInterval → S, IsArcMap A ∧ A 0 = f t ∧ (∀ s, s ≠ 0 → ∃ s', t < s' ∧ A s = f s') ∧ + (∀ s, t ≤ s → ∃ s', A s' = f s) ∧ A 1 = f 1 := by + let par : unitInterval → unitInterval := fun s => + ⟨t.1 + s.1 * (1 - t.1), by nlinarith [s.2.1, t.2.2], by nlinarith [s.2.2, t.2.2]⟩ + have hparc : Continuous par := by + refine Continuous.subtype_mk ?_ _ + fun_prop + have hpar0 : par 0 = t := Subtype.ext (by simp [par]) + have hpari : Function.Injective par := fun s s' h => by + have h1 : t.1 + s.1 * (1 - t.1) = t.1 + s'.1 * (1 - t.1) := congrArg Subtype.val h + have h2 : s.1 * (1 - t.1) = s'.1 * (1 - t.1) := by linarith + exact Subtype.ext (mul_right_cancel₀ (sub_ne_zero.mpr (ne_of_gt ht1)) h2) + have hpar1 : par 1 = 1 := Subtype.ext (by simp [par]) + refine ⟨f ∘ par, ⟨hf.1.comp hparc, hf.2.comp hpari⟩, by simp [hpar0], fun s hs => ⟨par s, ?_, + rfl⟩, fun s hs => ?_, by simp [hpar1]⟩ + · have h1 : 0 < s.1 := lt_of_le_of_ne s.2.1 fun h => hs (Subtype.ext h.symm) + change t.1 < t.1 + s.1 * (1 - t.1) + nlinarith + · have hst : t.1 ≤ s.1 := hs + have hd : 0 < 1 - t.1 := by linarith + let s' : unitInterval := ⟨(s.1 - t.1) / (1 - t.1), div_nonneg (by linarith) hd.le, + (div_le_one hd).mpr (by linarith [s.2.2])⟩ + refine ⟨s', congrArg f (Subtype.ext ?_)⟩ + change t.1 + (s.1 - t.1) / (1 - t.1) * (1 - t.1) = s.1 + field_simp + ring + +/-- One slide. The arc `f` may touch `bd(Σ)` and the closed set `Z` only at `f 0`. A move carries +`f` and `Z` into any open set around them that holds `f 0` and `Z`. -/ +theorem exists_step (hS : IsSurface S) {f : unitInterval → S} (hf : IsArcMap f) {Z N W : Set S} + (hZ : IsClosed Z) (hN : IsOpen N) (hW : IsClosed W) (hNW : Disjoint N W) (hfW : ∀ s, f s ∉ W) + (hZN : Z ⊆ N) (hf0 : f 0 ∈ N) (hbd : ∀ s, s ≠ 0 → f s ∉ bd S) (hfZ : ∀ s, s ≠ 0 → f s ∉ Z) : + ∃ α : S ≃ₜ S, IsMove α ∧ (∀ z ∈ Z, α z ∈ N) ∧ (∀ s, α (f s) ∈ N) ∧ ∀ z ∈ W, α z = z := by + classical + have ht2 : T2Space S := hS.2.1 + obtain ⟨t, ht0, ht1, htN⟩ := exists_initial hf.1 hN hf0 + obtain ⟨A, hA, hA0, hAf, hfA, -⟩ := exists_tail hf ht0 ht1 + have hne : ∀ s', t < s' → s' ≠ 0 := fun s' h h0 => by + rw [h0] at h + exact absurd (show t.1 < 0 from h) (not_lt.mpr t.2.1) + let Y : Set S := f '' Iic t + have hYc : IsClosed Y := (isClosed_Iic.isCompact.image hf.1).isClosed + have hZY : IsClosed (Z ∪ Y ∪ W) := (hZ.union hYc).union hW + have hoff : ∀ s, A s ∉ bd S := fun s h => by + by_cases hs : s = 0 + · rw [hs, hA0] at h + exact hbd t (fun h0 => by rw [h0] at ht0; simp at ht0) h + · obtain ⟨s', hs', he⟩ := hAf s hs + exact hbd s' (hne s' hs') (he ▸ h) + obtain ⟨α, hm, hz, hA'⟩ := exists_line_slide hS hA hoff hZY (fun s hs h => by + obtain ⟨s', hs', he⟩ := hAf s hs + rw [he] at h + rcases h with (h | ⟨s'', hs'', he'⟩) | h + · exact hfZ _ (hne s' hs') h + · have := hf.2 he' + exact absurd (show s'' ≤ t from hs'') (not_le.mpr (this ▸ hs')) + · exact hfW _ h) hN (by + rw [hA0] + exact htN t le_rfl) + have hZN' : ∀ z ∈ Z ∪ Y, z ∈ N := by + rintro z (h | ⟨s', hs', rfl⟩) + · exact hZN h + · exact htN s' hs' + have hall : ∀ z ∈ Z ∪ Y, α z ∈ N := fun z hzz => by + rcases hz z (.inl hzz) with h | h + · rw [h] + exact hZN' z hzz + · exact h.2 + refine ⟨α, hm, fun z hzz => hall z (.inl hzz), fun s => ?_, fun z hzz => ?_⟩ + · by_cases hs : s ≤ t + · exact hall _ (.inr ⟨s, hs, rfl⟩) + · obtain ⟨s', hs'⟩ := hfA s (le_of_not_ge hs) + rw [← hs'] + exact hA' s' + · rcases hz z (.inr hzz) with h | h + · exact h + · exact (disjoint_left.mp hNW h.1 hzz).elim + +/-- The step of `exists_shrink_part`: first slide the new line, then apply the moves for the lines +after it. -/ +theorem shrink_step (hS : IsSurface S) {P A R' W Q : Set S} (hP : IsClosed P) (hRf : R'.Finite) + (f : unitInterval ≃ₜ A) (hbd : ∀ s, s ≠ 0 → (f s).1 ∉ bd S) (hfP : ∀ s, s ≠ 0 → (f s).1 ∉ P) + (hW : IsClosed W) (hfW : ∀ s, (f s).1 ∉ W) (hRoff : ∀ r ∈ R', r ∈ bd S ∨ r ∉ P ∪ A) + (hR : ∀ N, IsOpen N → P ∪ A ⊆ N → R' ⊆ N → Disjoint N W → ∃ α : S ≃ₜ S, IsMove α ∧ (∀ z ∈ + (P ∪ A) ∪ Q, α z ∈ N) ∧ ∀ z ∈ W, α z = z) + (N : Set S) (hN : IsOpen N) (hPN : P ⊆ N) (hRN : R' ⊆ N) (hNW : Disjoint N W) (hf0 : + (f 0).1 ∈ N) : ∃ α : S ≃ₜ S, IsMove α ∧ (∀ z ∈ P ∪ A ∪ Q, α z ∈ N) ∧ ∀ z ∈ W, α z = z := by + have ht2 : T2Space S := hS.2.1 + have hc : IsArcMap fun t => (f t).1 := ⟨by fun_prop, fun x y h => f.injective (Subtype.ext h)⟩ + have hR'c : IsClosed R' := hRf.isClosed + obtain ⟨α₀, hm₀, hZ₀, hf₀, hW₀⟩ := exists_step hS hc (hP.union hR'c) hN hW hNW hfW + (union_subset hPN hRN) hf0 hbd (fun s hs h => by + rcases h with h | h + · exact hfP s hs h + · rcases hRoff _ h with h' | h' + · exact hbd s hs h' + · exact h' (.inr (f s).2)) + obtain ⟨α₁, hm₁, h₁, hw₁⟩ := hR (α₀ ⁻¹' N) (hN.preimage α₀.continuous) (union_subset (fun z hz + => hZ₀ z (.inl hz)) fun z hz => by + obtain ⟨t, rfl⟩ : ∃ t, (f t).1 = z := ⟨f.symm ⟨z, hz⟩, by simp⟩ + exact hf₀ t) (fun z hz => hZ₀ z (.inr hz)) (disjoint_left.mpr fun z hz hzW => by + have h1 : α₀ z ∈ N := hz + rw [hW₀ z hzW] at h1 + exact disjoint_left.mp hNW h1 hzW) + refine ⟨α₁.trans α₀, hm₁.trans hm₀, fun z hz => h₁ z hz, fun z hz => ?_⟩ + rw [Homeomorph.trans_apply, hw₁ z hz, hW₀ z hz] + +/-- **Shrinking one part of a forest.** Let `l` grow from `B`, and let `K` be a closed set such that +every line of `l` lies in `K` or misses it. Assume that `bd(Σ) ∪ P ⊆ B`, and that `K` meets `B` only +in `bd(Σ) ∪ P`. Then there is a finite subset `R` of `K`, each point on `bd(Σ)` or off `P`, such +that a move carries `P` and the part of `l` in `K` into any open set around `P ∪ R`. The move fixes +every point of a given closed set `W` off `K` and off this open set. -/ +theorem exists_shrink_part (hS : IsSurface S) {B : Set S} {l : List (Set S)} {k : ℕ} + (h : IsGrowth B l k) : + ∀ P K : Set S, IsClosed P → bd S ∪ P ⊆ B → B ∩ K ⊆ bd S ∪ P → (∀ A ∈ l, A ⊆ K ∨ Disjoint A K) + → ∃ R : Set S, R.Finite ∧ R ⊆ K ∧ (∀ r ∈ R, r ∈ bd S ∨ r ∉ P) ∧ + ∀ W : Set S, IsClosed W → Disjoint W K → ∀ N, IsOpen N → P ⊆ N → R ⊆ N → Disjoint N W + → ∃ α : S ≃ₜ S, IsMove α ∧ (∀ z ∈ P ∪ (listUnion l ∩ K), α z ∈ N) ∧ ∀ z ∈ W, α z = z := by + classical + have ht2 : T2Space S := hS.2.1 + have hmem : ∀ {A K : Set S} {l : List (Set S)} {P : Set S} {z : S}, z ∈ P ∪ (listUnion + (A :: l) ∩ K) → z ∈ P ∪ A ∪ (listUnion l ∩ K) := fun {A K l P z} hz => by + rcases hz with hz | ⟨hz, hzK⟩ + · exact .inl (.inl hz) + · rw [listUnion_cons] at hz + rcases hz with hz | hz + · exact .inl (.inr hz) + · exact .inr ⟨hz, hzK⟩ + have hskip : ∀ {A K : Set S} {l : List (Set S)} {P : Set S} {z : S}, Disjoint A K → z ∈ P ∪ + (listUnion (A :: l) ∩ K) → z ∈ P ∪ (listUnion l ∩ K) := fun {A K l P z} hd hz => by + rcases hz with hz | ⟨hz, hzK⟩ + · exact .inl hz + · rw [listUnion_cons] at hz + rcases hz with hz | hz + · exact (disjoint_left.mp hd hz hzK).elim + · exact .inr ⟨hz, hzK⟩ + have hgrow : ∀ {B K P A : Set S}, B ∩ K ⊆ bd S ∪ P → (B ∪ A) ∩ K ⊆ bd S ∪ (P ∪ A) + := fun {B K P A} hK => by + rintro z ⟨h1 | h1, h2⟩ + · rcases hK ⟨h1, h2⟩ with h3 | h3 + · exact .inl h3 + · exact .inr (.inl h3) + · exact .inr (.inr h1) + have hgrow' : ∀ {B K P A : Set S}, B ∩ K ⊆ bd S ∪ P → Disjoint A K → (B ∪ A) ∩ K ⊆ bd S ∪ P + := fun {B K P A} hK hd => by + rintro z ⟨h1 | h1, h2⟩ + · exact hK ⟨h1, h2⟩ + · exact (disjoint_left.mp hd h1 h2).elim + have hup : ∀ {B P A : Set S}, bd S ∪ P ⊆ B → bd S ∪ (P ∪ A) ⊆ B ∪ A := fun {B P A} hB => by + rw [← union_assoc] + exact union_subset_union_left _ hB + induction h with + | nil B => + intro P K _ _ _ _ + refine ⟨∅, finite_empty, empty_subset _, by simp, fun W _ _ N _ hP _ _ => ⟨Homeomorph.refl S, + IsMove.refl, fun z hz => ?_, fun _ _ => rfl⟩⟩ + simp only [listUnion_nil, empty_inter, union_empty] at hz + exact hP hz + | @free B A l k hA hd _ ih => + intro P K hP hB hK hl + have hl' : ∀ A' ∈ l, A' ⊆ K ∨ Disjoint A' K := fun A' h => hl A' (List.mem_cons_of_mem _ h) + rcases hl A List.mem_cons_self with hAK | hAK + · obtain ⟨f⟩ := hA + have hL : IsLineWithEnds A (f 0).1 (f 1).1 := ⟨f, rfl, rfl⟩ + have hoff : ∀ s, (f s).1 ∉ B := fun s h => by + have : (f s).1 ∈ A ∩ B := ⟨(f s).2, h⟩ + rw [hd] at this + exact this + obtain ⟨R', hRf, hRK, hRoff, hR⟩ := ih (P ∪ A) K (hP.union hL.isCompact.isClosed) (hup hB) + (hgrow hK) hl' + refine ⟨insert (f 0).1 R', hRf.insert _, insert_subset (hAK (f 0).2) hRK, fun r hr => ?_, + fun W hW hWK N hN hPN hRN hNW => ?_⟩ + · rcases hr with rfl | hr + · exact .inr fun h => hoff 0 (hB (.inr h)) + · exact (hRoff r hr).imp id fun h h' => h (.inl h') + · obtain ⟨α, hm, h1, h2⟩ := shrink_step hS hP hRf f (fun s _ h => hoff s (hB (.inl h))) + (fun s _ h => hoff s (hB (.inr h))) hW (fun s h => disjoint_left.mp hWK h (hAK + (f s).2)) hRoff (hR W hW hWK) N hN hPN (fun r hr => hRN (mem_insert_of_mem _ hr)) hNW + (hRN (mem_insert _ _)) + exact ⟨α, hm, fun z hz => h1 z (hmem hz), h2⟩ + · obtain ⟨R', hRf, hRK, hRoff, hR⟩ := ih P K hP (hB.trans subset_union_left) (hgrow' hK hAK) hl' + refine ⟨R', hRf, hRK, hRoff, fun W hW hWK N hN hPN hRN hNW => ?_⟩ + obtain ⟨α, hm, h1, h2⟩ := hR W hW hWK N hN hPN hRN hNW + exact ⟨α, hm, fun z hz => h1 z (hskip hAK hz), h2⟩ + | @attached B A l k p q hA hd _ ih => + intro P K hP hB hK hl + have hl' : ∀ A' ∈ l, A' ⊆ K ∨ Disjoint A' K := fun A' h => hl A' (List.mem_cons_of_mem _ h) + rcases hl A List.mem_cons_self with hAK | hAK + · obtain ⟨f, h0, h1⟩ := id hA + have hoff : ∀ s, s ≠ 0 → (f s).1 ∉ B := fun s hs h => by + have h2 : (f s).1 ∈ A ∩ B := ⟨(f s).2, h⟩ + rw [hd] at h2 + have h3 : (f s).1 = (f 0).1 := h2.trans h0.symm + exact hs (f.injective (Subtype.ext h3)) + obtain ⟨R', hRf, hRK, hRoff, hR⟩ := ih (P ∪ A) K (hP.union hA.isCompact.isClosed) (hup hB) + (hgrow hK) hl' + have hpA : p ∈ A := h0 ▸ (f 0).2 + refine ⟨R' ∪ ({p} \ P), hRf.union ((finite_singleton p).subset sdiff_subset), + union_subset hRK ?_, fun r hr => ?_, fun W hW hWK N hN hPN hRN hNW => ?_⟩ + · rintro _ ⟨rfl, -⟩ + exact hAK hpA + · rcases hr with hr | hr + · exact (hRoff r hr).imp id fun h h' => h (.inl h') + · exact .inr hr.2 + · obtain ⟨α, hm, h1, h2⟩ := shrink_step hS hP hRf f (fun s hs h => hoff s hs (hB (.inl h))) + (fun s hs h => hoff s hs (hB (.inr h))) hW (fun s h => disjoint_left.mp hWK h (hAK + (f s).2)) hRoff (hR W hW hWK) N hN hPN (fun r hr => hRN (.inl hr)) hNW (by + rw [h0] + by_cases hpP : p ∈ P + · exact hPN hpP + · exact hRN (.inr ⟨rfl, hpP⟩)) + exact ⟨α, hm, fun z hz => h1 z (hmem hz), h2⟩ + · obtain ⟨R', hRf, hRK, hRoff, hR⟩ := ih P K hP (hB.trans subset_union_left) (hgrow' hK hAK) hl' + refine ⟨R', hRf, hRK, hRoff, fun W hW hWK N hN hPN hRN hNW => ?_⟩ + obtain ⟨α, hm, h1, h2⟩ := hR W hW hWK N hN hPN hRN hNW + exact ⟨α, hm, fun z hz => h1 z (hskip hAK hz), h2⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/SideDisc.lean b/LeanPool/GraphMinor/GM07/SideDisc.lean new file mode 100644 index 0000000000..ef5493fceb --- /dev/null +++ b/LeanPool/GraphMinor/GM07/SideDisc.lean @@ -0,0 +1,847 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.TameLines +public import LeanPool.GraphMinor.GM06.Section3Dual + +/-! +# A disc around one side of a vertex separation + +Let `Γ` be a drawing in a sphere, with two disjoint discs `B₀` and `E₀` that its edges keep out of. +Let `X` be a set of vertices that cuts `Γ` so that the part `K` next to +`B₀` misses `E₀`. Then a disc holds `B₀` and misses the inside of `E₀`, and its boundary meets `Γ` +only in `X`. This is `exists_disc_of_side`, the step from a Menger separator +to a curve. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Function GraphMinor.Surface GraphMinor.GM11 + +local notation "I" => unitInterval + +variable {T : Type} [TopologicalSpace T] + +/-- Star discs at finitely many vertices, disjoint, each off a given closed set. -/ +theorem exists_star_family (hS : IsClosedSurface T) (Γ : Drawing T) {K : Set T} + (hK : K ⊆ Γ.V) {P : T → Set T} (hP : ∀ v ∈ K, IsClosed (P v)) (hvP : ∀ v ∈ K, v ∉ P v) : + ∃ R : T → Set T, (∀ v ∈ K, IsStarDisc Γ v (R v) ∧ Disjoint (R v) (P v)) + ∧ ∀ u ∈ K, ∀ v ∈ K, u ≠ v → Disjoint (R u) (R v) := by + have ht2 : T2Space T := hS.2.1 + obtain ⟨Uo, hUo, hdU⟩ := (Γ.finite_V.subset hK).t2_separation + have hex : ∀ v ∈ K, ∃ R, IsStarDisc Γ v R ∧ R ⊆ Uo v ∩ (P v)ᶜ := fun v hv => + exists_starDisc hS Γ (hK hv) ((hUo v).2.inter (hP v hv).isOpen_compl) ⟨(hUo v).1, hvP v hv⟩ + choose! R hR hsub using hex + refine ⟨R, fun v hv => ⟨hR v hv, disjoint_left.mpr fun x hx h => (hsub v hv hx).2 h⟩, + fun u hu v hv huv => ?_⟩ + exact (hdU hu hv huv).mono ((hsub u hu).trans inter_subset_left) ((hsub v hv).trans + inter_subset_left) + +variable [T2Space T] {H : Drawing T} {f : Set T} {γ : I → T} + +theorem EdgeParam.closure_eq (h : EdgeParam H f γ) : closure f = range γ := by + have h1 := h.closure_Ioo (τ := 1) zero_lt_one + rw [h.img] at h1 + rw [h1, ← image_univ] + congr 1 + ext t + exact ⟨fun _ => trivial, fun _ => ⟨unitInterval.nonneg t, unitInterval.le_one t⟩⟩ + +theorem EdgeParam.exists_orient (hf : f ∈ H.E) {u : T} (hu : u ∈ closure f) + (huV : u ∈ H.V) : ∃ γ, EdgeParam H f γ ∧ γ 0 = u := by + obtain ⟨γ, h1, h2, h3, h4, h5⟩ := exists_edge_param H hf + have hγ : EdgeParam H f γ := ⟨h1, h2, h3, h4, h5⟩ + rw [hγ.closure_eq] at hu + obtain ⟨z, rfl⟩ := hu + by_cases h0 : z = 0 + · exact ⟨γ, hγ, by rw [h0]⟩ + by_cases h6 : z = 1 + · exact ⟨_, hγ.rev, by simp [h6]⟩ + · exact absurd huV (hγ.not_V hf (unitInterval.pos_iff_ne_zero.mpr h0) + (unitInterval.lt_one_iff_ne_one.mpr h6)) + +/-- The closure of an edge is a union of atoms. -/ +theorem isGammaNice_closure {Γ : Drawing T} {H : Drawing T} (hH : H.E ⊆ Γ.E) (hV : H.V ⊆ Γ.V) + (hf : f ∈ H.E) (hγ : EdgeParam H f γ) : IsGammaNice Γ (closure f) := by + refine ⟨insert f ((fun v => ({v} : Set T)) '' (closure f ∩ H.V)), ?_, ?_⟩ + · rintro _ (rfl | ⟨v, hv, rfl⟩) + · exact .inl (.inr (hH hf)) + · exact .inl (.inl ⟨v, hV hv.2, rfl⟩) + · apply Subset.antisymm + · intro x hx + rw [hγ.closure_eq] at hx + obtain ⟨z, rfl⟩ := hx + by_cases hv : γ z ∈ H.V + · exact ⟨{γ z}, .inr ⟨γ z, ⟨hγ.closure_eq ▸ mem_range_self z, hv⟩, rfl⟩, rfl⟩ + · obtain ⟨h1, h2⟩ := hγ.pos_of_ne hv + exact ⟨f, .inl rfl, hγ.mem_edge h1 h2⟩ + · rintro x ⟨_, (rfl | ⟨v, hv, rfl⟩), hx⟩ + · exact subset_closure hx + · obtain rfl := hx + exact hv.1 + +omit [T2Space T] in +/-- The boundary curve of a drawing on it is a union of atoms. -/ +theorem isGammaNice_of_U {Γ D : Drawing T} (hE : D.E ⊆ Γ.E) (hV : D.V ⊆ Γ.V) : IsGammaNice Γ D.U + := by + refine ⟨D.E ∪ (fun v => ({v} : Set T)) '' D.V, ?_, ?_⟩ + · rintro _ (h | ⟨v, hv, rfl⟩) + · exact .inl (.inr (hE h)) + · exact .inl (.inl ⟨v, hV hv, rfl⟩) + · apply Subset.antisymm + · intro x hx + by_cases hv : x ∈ D.V + · exact ⟨{x}, .inr ⟨x, hv, rfl⟩, rfl⟩ + · obtain ⟨e, he, h⟩ := D.exists_edge_of_mem hx hv + exact ⟨e, .inl he, h⟩ + · rintro x ⟨_, h | ⟨v, hv, rfl⟩, hx⟩ + · exact (h.2.1 hx).1 + · obtain rfl := hx + exact D.V_subset_U hv + +/-- What the proof of `exists_disc_of_side` needs of the middle piece `γ '' Icc s t` of an edge `f` +of `Γ` that starts in `K`. -/ +structure IsPiece (Γ : Drawing T) (K X : Set T) (R : T → Set T) (f : Set T) (L : Set T) (a b : T) + (u v : T) : Prop where + edge : f ∈ Γ.E + line : IsLineWithEnds L a b + ne : a ≠ b + sub : L ⊆ closure f + ends_mem : u ∈ K + a_bd : a ∈ discBd (R u) + a_notV : a ∉ Γ.V + b_mem : (v ∈ K ∧ b ∈ discBd (R v) ∧ b ∉ Γ.V) ∨ v ∉ K ∧ b ∈ X + vertex : ∀ x ∈ L, x ∈ Γ.V → x = b ∧ b ∈ X + disc : ∀ w ∈ K, ∀ x ∈ L, x ∈ R w → x = a ∨ x = b + rest : ∀ x ∈ f, x ∉ L → ∃ w ∈ K, x ∈ discInt (R w) + onEdge : ∀ x ∈ L, x ∈ f ∨ x ∈ Γ.V + +/-- The cut of an edge gives a piece. -/ +theorem exists_piece {Γ Γ₁ : Drawing T} {K X : Set T} {R : T → Set T} + (hman : ∀ x : T, IsManifoldPoint x) (hE : Γ.E ⊆ Γ₁.E) (hV : Γ.V ⊆ Γ₁.V) (hVK : K ⊆ Γ.V) + (hR : ∀ v ∈ K, IsStarDisc Γ₁ v (R v)) + (hγ : EdgeParam Γ f γ) (hf : f ∈ Γ.E) (h0 : γ 0 ∈ K) (hm : ∀ v ∈ K, γ quarter₂ ∉ R v) + (hoffV : ∀ v ∈ K, ∀ w ∈ Γ.V, w ≠ v → w ∉ R v) + (hends : ∀ v ∈ K, (R v ∩ closure f).Nonempty → v ∈ closure f) (hK : γ 1 ∈ K ∪ X) : + ∃ L a b, IsPiece Γ K X R f L a b (γ 0) (γ 1) := by + have hR' : ∀ v ∈ K, IsClosedDisc (R v) ∧ v ∈ discInt (R v) ∧ IsOpen (discInt (R v)) := fun v hv => + ⟨(hR v hv).disc, (hR v hv).mem, (hR v hv).disc.isOpen_discInt hman⟩ + have hcl := hγ.closure_eq + have hstar : ∀ v ∈ K, ∀ y ∈ R v ∩ range γ, ∃ C, IsPreconnected C ∧ C ⊆ range γ ∧ y ∈ C ∧ v ∈ C + ∧ C \ {y} ⊆ discInt (R v) := fun v hv y hy => by + rw [← hcl] at hy ⊢ + exact (hR v hv).star _ isClosed_closure (isGammaNice_closure hE hV hf hγ) y hy + have hvert : ∀ v ∈ K, v ∈ range γ → v = γ 0 ∨ v = γ 1 := fun v hv h => by + obtain ⟨z, rfl⟩ := h + by_contra hn + push Not at hn + have h1 : 0 < z := unitInterval.pos_iff_ne_zero.mpr fun e => hn.1 (by rw [e]) + have h2 : z < 1 := unitInterval.lt_one_iff_ne_one.mpr fun e => hn.2 (by rw [e]) + exact hγ.not_V hf h1 h2 (hVK hv) + have hq1 : quarter₂ < (1 : I) := unitInterval.lt_one_iff_ne_one.mpr fun e => by + have h1 := congrArg Subtype.val e + norm_num [quarter₂] at h1 + have hq0 : (0 : I) < quarter₂ := unitInterval.pos_iff_ne_zero.mpr fun e => by + have h1 := congrArg Subtype.val e + norm_num [quarter₂] at h1 + obtain ⟨s, t, hs0, hsm, hmt, hsb, hspre, hcase, hmiss⟩ := hγ.exists_cut hf hR' hstar h0 hq1 hm + (fun h1 v hv he => hoffV v hv _ hγ.mem1 (fun e => h1 (e ▸ hv)) he) + (fun v hv ⟨y, h1, h2⟩ => hvert v hv (hcl ▸ hends v hv ⟨y, h1, hcl.symm ▸ h2⟩)) + (fun hne h1 => ⟨hoffV _ h1 _ hγ.mem0 (Ne.symm hne), hoffV _ h0 _ hγ.mem1 hne⟩) + have hst : s < t := hsm.trans hmt + have hs1 : s < 1 := lt_of_lt_of_le hst (unitInterval.le_one t) + have hle : ∀ τ ∈ Icc s t, 0 < τ := fun τ h => hs0.trans_le h.1 + have hsV : γ s ∉ Γ.V := hγ.not_V hf hs0 hs1 + have hbX : γ 1 ∉ K → γ 1 ∈ X := fun h => hK.resolve_left h + have hcasesplit : t < 1 ∨ t = 1 := lt_or_eq_of_le (unitInterval.le_one t) + refine ⟨γ '' Icc s t, γ s, γ t, ⟨hf, hγ.line_Icc hf hs0 hst, fun e => ?_, ?_, h0, hsb, hsV, ?_, + ?_, ?_, ?_, ?_⟩⟩ + · rcases hcasesplit with h | h + · exact hst.ne (hγ.inj ⟨hs0, hs1⟩ ⟨hs0.trans hst, h⟩ e) + · rw [h] at e + exact hsV (e ▸ hγ.mem1) + · rintro _ ⟨τ, -, rfl⟩ + exact hcl ▸ mem_range_self τ + · rcases hcase with ⟨h1, h2, h3, -⟩ | ⟨h1, h2⟩ + · exact .inl ⟨h1, h3, hγ.not_V hf (hs0.trans hst) h2⟩ + · rw [h2] + exact .inr ⟨h1, hbX h1⟩ + · rintro _ ⟨τ, hτ, rfl⟩ hv + obtain ⟨-, h2⟩ := by_contra (fun hn : ¬ (0 < τ ∧ ¬ τ < 1) => hn ⟨hle τ hτ, fun h3 + => hγ.not_V hf (hle τ hτ) h3 hv⟩) + have hτ1 : τ = 1 := le_antisymm (unitInterval.le_one τ) (not_lt.mp h2) + have ht1 : t = 1 := le_antisymm (unitInterval.le_one t) (hτ1 ▸ hτ.2) + rcases hcase with ⟨-, h3, -⟩ | ⟨h3, -⟩ + · exact absurd ht1 h3.ne + · rw [hτ1, ht1] + exact ⟨rfl, hbX h3⟩ + · rintro w hw _ ⟨τ, hτ, rfl⟩ hx + by_contra hn + push Not at hn + have h1 : s < τ := lt_of_le_of_ne hτ.1 fun e => hn.1 (by rw [e]) + have h2 : τ < t := lt_of_le_of_ne hτ.2 fun e => hn.2 (by rw [e]) + exact hmiss w hw τ h1 h2 hx + · intro x hx hxL + rw [← hγ.img] at hx + obtain ⟨τ, hτ, rfl⟩ := hx + by_cases h1 : τ < s + · exact ⟨_, h0, hspre τ h1⟩ + by_cases h2 : t < τ + · rcases hcase with ⟨h3, -, -, h4⟩ | ⟨-, h3⟩ + · exact ⟨_, h3, h4 τ h2⟩ + · exact absurd hτ.2 (not_lt.mpr (h3 ▸ h2.le)) + · exact absurd ⟨τ, ⟨not_lt.mp h1, not_lt.mp h2⟩, rfl⟩ hxL + · rintro _ ⟨τ, hτ, rfl⟩ + have hcs : τ < 1 ∨ τ = 1 := lt_or_eq_of_le (unitInterval.le_one τ) + rcases hcs with h | h + · exact .inl (hγ.mem_edge (hle τ hτ) h) + · rw [h] + exact .inr hγ.mem1 + +private theorem tree_attachment_lines_disjoint + {T : Type} + [TopologicalSpace T] + (Γ : Drawing T) + {B₀ : Set T} + {K : Set T} + (hKV : K ⊆ Γ.V) + {ρ : T → ℕ} + (𝓔 : Set (Set T)) + (γ : Set T → ↑I → T) + (L : Set T → Set T) + (hmeetV : ∀ e ∈ 𝓔, ∀ f ∈ 𝓔, e ≠ f → ∀ x ∈ L e, x ∈ L f → x ∈ Γ.V) + (hvert : ∀ e ∈ 𝓔, ∀ x ∈ closure e, x ∈ Γ.V → x = γ e 0 ∨ x = γ e 1) + (hnoV : ∀ e ∈ 𝓔, γ e 1 ∈ K → ∀ x ∈ L e, x ∉ Γ.V) : + let N : Type := ↥(K \ discBd B₀) + ∀ (eT : N → Set T), + (∀ (u : N), eT u ∈ 𝓔) → + ∀ (wT : N → T), + (∀ (u : N), wT u ∈ K) → + (∀ (u : N), wT u ≠ ↑u) → + (∀ (u : N), ↑u ∈ closure (eT u)) → + (∀ (u : N), wT u ∈ closure (eT u)) → + (∀ (u : N), wT u ∉ discBd B₀ → ρ (wT u) < ρ ↑u) → + (∀ (u : N), γ (eT u) 1 ∈ K) → + ∀ (u : N), + ∀ (v : N), + (u ≠ v) → + Disjoint (L (eT u)) (L (eT v)) := by + intro N eT heT wT hwT hwne huc hwc hrk hT1 u v huv + have hne : eT u ≠ eT v := fun he => by + have hvu : u.1 ≠ v.1 := fun e => huv (Subtype.ext e) + have h1 := hvert _ (heT u) _ (huc u) (hKV u.2.1) + have h2 := hvert _ (heT u) _ (hwc u) (hKV (hwT u)) + have h3 := hvert _ (heT u) _ (he ▸ huc v) (hKV v.2.1) + have h4 := hvert _ (heT u) _ (he ▸ hwc v) (hKV (hwT v)) + have hw1 : wT u = v.1 := by + rcases h1 with h1 | h1 <;> rcases h2 with h2 | h2 <;> rcases h3 with h3 | h3 + · exact absurd (h2.trans h1.symm) (hwne u) + · exact absurd (h2.trans h1.symm) (hwne u) + · exact absurd (h1.trans h3.symm) hvu + · exact h2.trans h3.symm + · exact h2.trans h3.symm + · exact absurd (h1.trans h3.symm) hvu + · exact absurd (h2.trans h1.symm) (hwne u) + · exact absurd (h2.trans h1.symm) (hwne u) + have hw2 : wT v = u.1 := by + rcases h1 with h1 | h1 <;> rcases h3 with h3 | h3 <;> rcases h4 with h4 | h4 + · exact absurd (h1.trans h3.symm) hvu + · exact absurd (h1.trans h3.symm) hvu + · exact h4.trans h1.symm + · exact absurd (h4.trans h3.symm) (hwne v) + · exact absurd (h4.trans h3.symm) (hwne v) + · exact h4.trans h1.symm + · exact absurd (h1.trans h3.symm) hvu + · exact absurd (h1.trans h3.symm) hvu + have h5 := hrk u (hw1 ▸ v.2.2) + have h6 := hrk v (hw2 ▸ u.2.2) + rw [hw1] at h5 + rw [hw2] at h6 + omega + refine disjoint_left.mpr fun x hx hy => ?_ + exact hnoV _ (heT u) (hT1 u) x hx (hmeetV _ (heT u) _ (heT v) hne x hx hy) + +private theorem disc_from_rooted_attachments + {T : Type} + [TopologicalSpace T] + [T2Space T] + (hS : IsClosedSurface T) + (hsph : IsSphere T) + (Γ : Drawing T) + {B₀ : Set T} + {E₀ : Set T} + {X : Set T} + {K : Set T} + (hE₀ : IsClosedDisc E₀) + (hd : Disjoint B₀ E₀) + (hbd : Γ.U ∩ discBd B₀ ⊆ Γ.V) + (hEU : Γ.U ∩ E₀ ⊆ Γ.V) + (hEint : Disjoint Γ.U (discInt E₀)) + (hXV : X ⊆ Γ.V) + (hXK : Disjoint X K) + (hcuff : Γ.V ∩ discBd B₀ ⊆ K ∪ X) + {ρ : T → ℕ} + (hB₀V : ∀ x ∈ Γ.U, x ∈ B₀ → x ∈ discBd B₀ ∧ x ∈ Γ.V) + (hclV : ∀ g ∈ Γ.E, ∀ x ∈ closure g, x ∉ Γ.V → x ∈ g) + (hclU : ∀ g ∈ Γ.E, closure g ⊆ Γ.U) : + let 𝓔 : Set (Set T) := {e | e ∈ Γ.E ∧ ∃ u ∈ K, u ∈ closure e} + (𝓔.Finite) → + ∀ (γ : Set T → ↑I → T), + (∀ e ∈ 𝓔, γ e 0 ∈ K) → + ∀ (R : T → Set T), + (∀ v ∈ K, v ∈ discInt (R v)) → + (∀ v ∈ K, ∀ w ∈ Γ.V, w ≠ v → w ∉ R v) → + (∀ v ∈ K, ∀ e ∈ Γ.E, v ∉ closure e → Disjoint (R v) (closure e)) → + (∀ v ∈ K, Disjoint (R v) E₀) → + ∀ (L : Set T → Set T), + ∀ (a : Set T → T), + ∀ (b : Set T → T), + (∀ e ∈ 𝓔, IsPiece Γ K X R e (L e) (a e) (b e) (γ e 0) (γ e 1)) → + (∀ e ∈ 𝓔, L e ⊆ Γ.U) → + (∀ e ∈ 𝓔, ∀ x ∈ L e, x ∈ Γ.V → x = b e ∧ b e ∈ X) → + (∀ e ∈ 𝓔, ∀ f ∈ 𝓔, e ≠ f → ∀ x ∈ L e, x ∈ L f → x ∈ Γ.V) → + (K.Finite) → + ∀ (K₀ : Set T), + (∀ {v : T}, v ∈ K₀ → v ∈ K ∩ discBd B₀) → + ∀ (B₁ : Set T), + (B₀ ⊆ B₁) → + (discBd B₁ ⊆ discBd B₀ ∪ (⋃ i ∈ K₀, discBd (R i))) → + (discBd B₀ \ (⋃ i ∈ K₀, R i) ⊆ discBd B₁) → + (∀ x ∈ B₁, x ∈ B₀ ∨ ∃ v ∈ K, v ∈ discBd B₀ ∧ x ∈ R v) → + (∀ v ∈ K, v ∈ discBd B₀ → ∀ x ∈ discBd (R v), x ∉ Γ.V → x ∈ Γ.U → x ∈ discBd B₁) → + (∀ v ∈ K, v ∈ discBd B₀ → discInt (R v) ⊆ discInt B₁) → + (∀ e ∈ 𝓔, ∀ x ∈ L e, x ∈ B₁ → x = a e ∨ x = b e) → + (∀ e ∈ 𝓔, γ e 1 ∈ K → ∀ x ∈ L e, x ∉ Γ.V) → + let N : Type := ↥(K \ discBd B₀) + ∀ (eT : N → Set T), + (∀ (u : N), eT u ∈ 𝓔) → + (∀ (u : N), γ (eT u) 1 ∈ K) → + ∀ (p : N → T), + ∀ (q : N → T), + (∀ (u : N), IsLineWithEnds (L (eT u)) (p u) (q u)) → + (∀ (u : N), p u ∈ discBd (R ↑u)) → + ∀ (par : N → Option N), + let c₀ : Option N → Set T := fun n => n.elim B₁ fun u => R ↑u + (∀ (n : Option N), IsClosedDisc (c₀ n)) → + (∀ (m n : Option N), m ≠ n → Disjoint (c₀ m) (c₀ n)) → + (∀ (u v : N), par u = some v → ρ ↑v < ρ ↑u) → + (∀ (u : N), q u ∈ discBd (c₀ (par u))) → + (∀ (u : N) (n : Option N), L (eT u) ∩ c₀ n ⊆ {p u, q u}) → + (∀ (u v : N), u ≠ v → Disjoint (L (eT u)) (L (eT v))) → + ∃ B : Set T, IsClosedDisc B ∧ B₀ ⊆ B ∧ Disjoint (discInt E₀) B ∧ discBd B ∩ Γ.U ⊆ X := by + intro 𝓔 h𝓔 γ hγK R hRmem hoffV hcloff hRE L a b hL hLU hLVmem hmeetV hKfin K₀ hmemK₀ B₁ h1a h1d + h1g hB₁cases hbB₁ hintR hLB₁ hnoV N eT heT hT1 p q hpql hpb par c₀ hd' hdj' hρ' hq' hLc' hLL' + classical + have hfin : (𝓔 \ range eT).Finite := h𝓔.subset sdiff_subset + set s := hfin.toFinset with hs + have hmem : ∀ {e}, e ∈ s → e ∈ 𝓔 ∧ ∀ u, eT u ≠ e := fun {e} h => by + obtain ⟨h1, h2⟩ := hfin.mem_toFinset.mp h + exact ⟨h1, fun u hu => h2 ⟨u, hu⟩⟩ + have hXfin : X.Finite := Γ.finite_V.subset hXV + set Y : Set T := X ∪ (Γ.V \ K) ∪ (⋃ f ∈ Γ.E \ 𝓔, closure f) ∪ E₀ with hY + have hYc : IsClosed Y := ((hXfin.isClosed.union (Γ.finite_V.subset sdiff_subset).isClosed).union + ((Γ.finite_edges.subset sdiff_subset).isClosed_biUnion fun e _ => isClosed_closure)).union + hE₀.isClosed + have hclf : ∀ f ∈ Γ.E \ 𝓔, ∀ v ∈ K, v ∉ closure f := fun f hf v hv h => hf.2 ⟨hf.1, v, hv, h⟩ + have hYR : ∀ v ∈ K, ∀ x ∈ R v, x ∉ Y := fun v hv x hx => by + rintro (((h | h) | h) | h) + · exact hoffV v hv x (hXV h) (fun e => disjoint_left.mp hXK h (e ▸ hv)) hx + · exact hoffV v hv x h.1 (fun e => h.2 (e ▸ hv)) hx + · obtain ⟨f, hf, h1⟩ := mem_iUnion₂.mp h + exact disjoint_left.mp (hcloff v hv f hf.1 (hclf f hf v hv)) hx h1 + · exact disjoint_left.mp (hRE v hv) hx h + have hYL : ∀ e ∈ 𝓔, ∀ x ∈ L e, x ∈ Y → x ∈ Γ.V := fun e he x hx => by + rintro (((h | h) | h) | h) + · exact hXV h + · exact h.1 + · obtain ⟨f, hf, h1⟩ := mem_iUnion₂.mp h + by_contra hn + have h2 := hclV f hf.1 x h1 hn + rcases (hL e he).onEdge x hx with h3 | h3 + · have hef : e = f := by + by_contra hne + exact disjoint_left.mp (GM06.disjoint_edges_of_ne Γ he.1 hf.1 hne) h3 h2 + exact hf.2 (hef ▸ he) + · exact hn h3 + · exact hEU ⟨hLU e he hx, h⟩ + have hint' : IsPreconnected (discInt E₀) := hE₀.isPreconnected_discInt + have hYne : (discInt E₀).Nonempty := hE₀.nonempty_discInt + have hXY : Disjoint X (discInt E₀) := disjoint_left.mpr fun x hx h => disjoint_left.mp hEint + (Γ.V_subset_U (hXV hx)) h + have hY₀Y : discInt E₀ ⊆ Y := fun x hx => .inr hx.1 + have hLY' : ∀ u, Disjoint (L (eT u)) Y := fun u => disjoint_left.mpr fun x hx h => + hnoV _ (heT u) (hT1 u) x hx (hYL _ (heT u) x hx h) + have hLℓ : ∀ u, ∀ e ∈ s, Disjoint (L (eT u)) (L e) := fun u e he => disjoint_left.mpr fun x hx h + => + hnoV _ (heT u) (hT1 u) x hx (hmeetV _ (heT u) _ (hmem he).1 ((hmem he).2 u) x hx h) + have hcY₀ : ∀ n, Disjoint (discInt E₀) (c₀ n) := fun n => by + cases n with + | none => + refine disjoint_left.mpr fun x hx h => ?_ + rcases hB₁cases x h with h1 | ⟨v, hv, -, h1⟩ + · exact disjoint_left.mp hd h1 hx.1 + · exact disjoint_left.mp (hRE v hv) h1 hx.1 + | some u => exact ((hRE u.1 u.2.1).mono_right fun x hx => hx.1).symm + have hbY : ∀ n, discBd (c₀ n) ∩ Y ⊆ X := fun n => by + cases n with + | none => + rintro x ⟨hx, hy⟩ + rcases h1d hx with h | h + · have hxB := h + rcases hy with ((h1 | h1) | h1) | h1 + · exact h1 + · rcases h1 with ⟨h2, h3⟩ + exact (hcuff ⟨h2, hxB⟩).resolve_left h3 + · obtain ⟨f, hf, h2⟩ := mem_iUnion₂.mp h1 + have h3 := hbd ⟨hclU f hf.1 h2, hxB⟩ + rcases hcuff ⟨h3, hxB⟩ with h4 | h4 + · exact absurd h2 (hclf f hf x h4) + · exact h4 + · exact absurd h1 (disjoint_left.mp hd (GM11.discBd_subset _ hxB)) + · obtain ⟨v, hv, h2⟩ := mem_iUnion₂.mp h + exact absurd hy (hYR v (hmemK₀ hv).1 x (GM11.discBd_subset _ h2)) + | some u => + rintro x ⟨hx, hy⟩ + exact absurd hy (hYR u.1 u.2.1 x (GM11.discBd_subset _ hx)) + have hbon : ∀ v ∈ K, ∀ x ∈ discBd (R v), x ∉ Γ.V → x ∈ Γ.U → ∃ n, x ∈ discBd (c₀ n) + := fun v hv x hx h2 h3 => by + by_cases h1 : v ∈ discBd B₀ + · exact ⟨none, hbB₁ v hv h1 x hx h2 h3⟩ + · exact ⟨some ⟨v, hv, h1⟩, hx⟩ + have : Finite N := (hKfin.subset sdiff_subset).to_subtype + obtain ⟨B, hB, hc, hLint, hY₀B, hbdY, hbdL⟩ := exists_disc_of_tree hS hsph (c₀ := c₀) (L := fun u + => L (eT u)) (p := p) (q := q) (par := par) (ρ := fun u => ρ u.1) hd' hdj' hρ' hpql hpb hq' + hLc' hLL' + s L a b (X := X) (Y := Y) (Y₀ := discInt E₀) hint' hYne hXY hYc hY₀Y hLY' hLℓ hcY₀ hbY + (fun e he => (hL e (hmem he).1).line) (fun e he => (hL e (hmem he).1).ne) + (fun e he h => (hL e (hmem he).1).a_notV (hXV h)) (fun e he => hbon _ (hγK e (hmem he).1) _ + (hL e (hmem he).1).a_bd (hL e (hmem he).1).a_notV (hLU e (hmem he).1 (hL e + (hmem he).1).line.left_mem)) + (fun e he => by + have h𝓔e := (hmem he).1 + rcases (hL e h𝓔e).b_mem with ⟨h1, h2, h3⟩ | ⟨h1, h2⟩ + · exact .inl (hbon _ h1 _ h2 h3 (hLU e h𝓔e (hL e h𝓔e).line.right_mem)) + · have hbU := hLU e h𝓔e (hL e h𝓔e).line.right_mem + have hbR : ∀ v ∈ K, b e ∉ R v := fun v hv h => hYR v hv _ h (.inl (.inl (.inl h2))) + by_cases h3 : b e ∈ discBd B₀ + · refine .inl ⟨none, h1g ⟨h3, fun h => ?_⟩⟩ + obtain ⟨v, hv, h4⟩ := mem_iUnion₂.mp h + exact hbR v (hmemK₀ hv).1 h4 + · refine .inr ⟨h2, fun n h => ?_⟩ + cases n with + | none => + rcases hB₁cases _ h with h4 | ⟨v, hv, -, h4⟩ + · exact h3 (hB₀V _ hbU h4).1 + · exact hbR v hv h4 + | some u => exact hbR u.1 u.2.1 h) + (fun e he n x hx => by + have h𝓔e := (hmem he).1 + cases n with + | none => exact hLB₁ e h𝓔e x hx.1 hx.2 + | some v => exact (hL e h𝓔e).disc v.1 v.2.1 x hx.1 hx.2) + (fun e he x hx => (hLVmem e (hmem he).1 x hx.1 (hYL e (hmem he).1 x hx.1 hx.2)).1 ▸ (hLVmem e + (hmem he).1 x hx.1 (hYL e (hmem he).1 x hx.1 hx.2)).2) + (fun e he => disjoint_left.mpr fun x hx h => hx.2 (.inr (hLVmem e (hmem he).1 x hx.1 + (hXV h)).1)) + (fun e he f hf hef x hx => by + have h2 := hmeetV e (hmem he).1 f (hmem hf).1 hef x hx.1 hx.2 + have h3 := hLVmem e (hmem he).1 x hx.1 h2 + exact h3.1 ▸ h3.2) + have hRint : ∀ v ∈ K, discInt (R v) ⊆ discInt B := fun v hv x hx => by + by_cases h1 : v ∈ discBd B₀ + · exact (hc none).2 (hintR v hv h1 hx) + · exact (hc (some ⟨v, hv, h1⟩)).2 hx + refine ⟨B, hB, h1a.trans (hc none).1, hY₀B, ?_⟩ + rintro x ⟨hx, hU⟩ + have hnotint : x ∉ discInt B := fun h => h.2 hx + by_cases hV : x ∈ Γ.V + · by_cases hK : x ∈ K + · exact absurd (hRint x hK (hRmem x hK)) hnotint + · exact hbdY ⟨hx, .inl (.inl (.inr ⟨hV, hK⟩))⟩ + obtain ⟨e, he, hxe⟩ := Γ.exists_edge_of_mem hU hV + by_cases h𝓔e : e ∈ 𝓔 + · by_cases hxL : x ∈ L e + · by_cases hmemT : e ∈ range eT + · obtain ⟨u, rfl⟩ := hmemT + exact absurd (hLint u hxL) hnotint + · exact hbdL e (hfin.mem_toFinset.mpr ⟨h𝓔e, hmemT⟩) ⟨hx, hxL⟩ + · obtain ⟨w, hw, h1⟩ := (hL e h𝓔e).rest x hxe hxL + exact absurd (hRint w hw h1) hnotint + · exact hbdY ⟨hx, .inl (.inr (mem_iUnion₂.mpr ⟨e, ⟨he, h𝓔e⟩, subset_closure hxe⟩))⟩ + +private theorem tree_edge_endpoints + {T : Type} + [TopologicalSpace T] + (Γ : Drawing T) + {B₀ : Set T} + {K : Set T} + (hKV : K ⊆ Γ.V) + (𝓔 : Set (Set T)) + (γ : Set T → ↑I → T) + (hvert : ∀ e ∈ 𝓔, ∀ x ∈ closure e, x ∈ Γ.V → x = γ e 0 ∨ x = γ e 1) : + let N : Type := ↥(K \ discBd B₀) + ∀ (eT : N → Set T), + (∀ (u : N), eT u ∈ 𝓔) → + ∀ (wT : N → T), + (∀ (u : N), wT u ∈ K) → + (∀ (u : N), wT u ≠ ↑u) → + (∀ (u : N), ↑u ∈ closure (eT u)) → + (∀ (u : N), wT u ∈ closure (eT u)) → + ∀ (u : N), + γ (eT u) 0 = ↑u ∧ γ (eT u) 1 = wT u ∨ γ (eT u) 0 = wT u ∧ γ (eT u) 1 = ↑u := by + intro N eT heT wT hwT hwne huc hwc u + have hu := hvert _ (heT u) _ (huc u) (hKV u.2.1) + have hw := hvert _ (heT u) _ (hwc u) (hKV (hwT u)) + rcases hu with h1 | h1 <;> rcases hw with h2 | h2 + · exact absurd (h2.trans h1.symm) (hwne u) + · exact .inl ⟨h1.symm, h2.symm⟩ + · exact .inr ⟨h2.symm, h1.symm⟩ + · exact absurd (h2.trans h1.symm) (hwne u) + +private theorem orient_tree_attachment + {T : Type} + [TopologicalSpace T] + (Γ : Drawing T) + {B₀ : Set T} + {X : Set T} + {K : Set T} + (𝓔 : Set (Set T)) + (γ : Set T → ↑I → T) + (R : T → Set T) + (L : Set T → Set T) + (a : Set T → T) + (b : Set T → T) + (hL : ∀ e ∈ 𝓔, IsPiece Γ K X R e (L e) (a e) (b e) (γ e 0) (γ e 1)) + (hbK : ∀ e ∈ 𝓔, γ e 1 ∈ K → b e ∈ discBd (R (γ e 1)) ∧ b e ∉ Γ.V) : + let N : Type := ↥(K \ discBd B₀) + ∀ (eT : N → Set T), + (∀ (u : N), eT u ∈ 𝓔) → + ∀ (wT : N → T), + (∀ (u : N), γ (eT u) 0 = ↑u ∧ γ (eT u) 1 = wT u ∨ γ (eT u) 0 = wT u ∧ γ (eT u) 1 = + ↑u) → + (∀ (u : N), γ (eT u) 1 ∈ K) → + ∀ (u : N), + ∃ p q : T, IsLineWithEnds (L (eT u)) p q ∧ p ∈ discBd (R ↑u) ∧ q ∈ discBd (R (wT u)) ∧ + ({p, q} : Set T) = {a (eT u), b (eT u)} := by + intro N eT heT wT hTends hT1 u + have hP := hL _ (heT u) + have hb' := (hbK _ (heT u) (hT1 u)).1 + rcases hTends u with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · exact ⟨a _, b _, hP.line, h1 ▸ hP.a_bd, h2 ▸ hb', rfl⟩ + · exact ⟨b _, a _, hP.line.symm, h2 ▸ hb', h1 ▸ hP.a_bd, pair_comm _ _⟩ + +private theorem rooted_discs_disjoint + {T : Type} + [TopologicalSpace T] + {B₀ : Set T} + {K : Set T} + (R : T → Set T) + (hRd : ∀ u ∈ K, ∀ v ∈ K, u ≠ v → Disjoint (R u) (R v)) + (B₁ : Set T) : + let N : Type := ↥(K \ discBd B₀) + let c₀ : Option N → Set T := fun n => n.elim B₁ fun u => R ↑u + (∀ (u : N), Disjoint (R ↑u) B₁) → + ∀ (m : Option N), + ∀ (n : Option N), + (m ≠ n) → + Disjoint (c₀ m) (c₀ n) := by + intro N c₀ hRB₁ m n hmn + cases m with + | none => + cases n with + | none => exact absurd rfl hmn + | some u => exact (hRB₁ u).symm + | some u => + cases n with + | none => exact hRB₁ u + | some v => exact hRd u.1 u.2.1 v.1 v.2.1 fun e => hmn (congrArg some (Subtype.ext e)) + +private theorem parent_rank_decreases + {T : Type} + [TopologicalSpace T] + {B₀ : Set T} + {K : Set T} + {ρ : T → ℕ} : + let N : Type := ↥(K \ discBd B₀) + ∀ (wT : N → T), + ∀ (hwT : ∀ (u : N), wT u ∈ K), + (∀ (u : N), wT u ∉ discBd B₀ → ρ (wT u) < ρ ↑u) → + let par : N → Option N := fun u => @dite (Option N) (wT u ∉ discBd B₀) + (Classical.propDecidable _) (fun h => some ⟨wT u, hwT u, h⟩) (fun _ => none) + ∀ (u : N), + ∀ (v : N), + (par u = some v) → + ρ ↑v < ρ ↑u := by + intro N wT hwT hrk par u v h + by_cases h1 : wT u ∉ discBd B₀ + · have h2 : par u = some ⟨wT u, hwT u, h1⟩ := dite_eq_left h1 + rw [h2] at h + obtain rfl := Option.some.inj h + exact hrk u h1 + · have h2 : par u = none := dite_eq_right h1 + rw [h2] at h + exact absurd h (by simp) + +private theorem attachment_end_on_parent_disc + {T : Type} + [TopologicalSpace T] + (Γ : Drawing T) + {B₀ : Set T} + {K : Set T} + (𝓔 : Set (Set T)) + (γ : Set T → ↑I → T) + (R : T → Set T) + (L : Set T → Set T) + (hLU : ∀ e ∈ 𝓔, L e ⊆ Γ.U) + (B₁ : Set T) + (hbB₁ : ∀ v ∈ K, v ∈ discBd B₀ → ∀ x ∈ discBd (R v), x ∉ Γ.V → x ∈ Γ.U → x ∈ discBd B₁) + (hnoV : ∀ e ∈ 𝓔, γ e 1 ∈ K → ∀ x ∈ L e, x ∉ Γ.V) : + let N : Type := ↥(K \ discBd B₀) + ∀ (eT : N → Set T), + (∀ (u : N), eT u ∈ 𝓔) → + ∀ (wT : N → T), + ∀ (hwT : ∀ (u : N), wT u ∈ K), + (∀ (u : N), γ (eT u) 1 ∈ K) → + ∀ (p : N → T), + ∀ (q : N → T), + (∀ (u : N), IsLineWithEnds (L (eT u)) (p u) (q u)) → + (∀ (u : N), q u ∈ discBd (R (wT u))) → + let par : N → Option N := fun u => @dite (Option N) (wT u ∉ discBd B₀) + (Classical.propDecidable _) (fun h => some ⟨wT u, hwT u, h⟩) (fun _ => none) + let c₀ : Option N → Set T := fun n => n.elim B₁ fun u => R ↑u + ∀ (u : N), + q u ∈ discBd (c₀ (par u)) := by + intro N eT heT wT hwT hT1 p q hpql hqb par c₀ u + have hqU : q u ∈ L (eT u) := (hpql u).right_mem + by_cases h1 : wT u ∉ discBd B₀ + · have h2 : par u = some ⟨wT u, hwT u, h1⟩ := dite_eq_left h1 + rw [h2] + exact hqb u + · have h2 : par u = none := dite_eq_right h1 + rw [h2] + exact hbB₁ _ (hwT u) (not_not.mp h1) _ (hqb u) (hnoV _ (heT u) (hT1 u) _ hqU) (hLU _ + (heT u) hqU) + +/-- **A disc around one side of a separation.** See the module docstring. The rank `ρ` says that +each vertex of `K` is joined to `B₀` inside `K`. -/ +theorem exists_disc_of_side (hS : IsClosedSurface T) (hsph : IsSphere T) + (Γ : Drawing T) {B₀ E₀ X K : Set T} (hB₀ : IsClosedDisc B₀) (hE₀ : IsClosedDisc E₀) + (hd : Disjoint B₀ E₀) + (hbd : Γ.U ∩ discBd B₀ ⊆ Γ.V) (hint : Disjoint Γ.U (discInt B₀)) (hEU : Γ.U ∩ E₀ ⊆ Γ.V) + (hEint : Disjoint Γ.U (discInt E₀)) (hKV : K ⊆ Γ.V) (hXV : X ⊆ Γ.V) (hXK : Disjoint X K) + (hcuff : Γ.V ∩ discBd B₀ ⊆ K ∪ X) (hKE : Disjoint K E₀) (hedge : ∀ e ∈ Γ.E, ∀ u ∈ K, u ∈ + closure e → ∀ w ∈ Γ.V, w ∈ closure e → w ∈ K ∪ X) + {ρ : T → ℕ} (hreach : ∀ u ∈ K, u ∉ discBd B₀ → ∃ e ∈ Γ.E, ∃ w ∈ K, w ≠ u ∧ u ∈ closure e + ∧ w ∈ closure e ∧ (w ∉ discBd B₀ → ρ w < ρ u)) : + ∃ B, IsClosedDisc B ∧ B₀ ⊆ B ∧ Disjoint (discInt E₀) B ∧ discBd B ∩ Γ.U ⊆ X := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + by_cases hA : (Γ.V ∩ discBd B₀).Nonempty + swap + · refine ⟨B₀, hB₀, Subset.rfl, hd.symm.mono_left fun x hx => hx.1, fun x hx => ?_⟩ + exact absurd ⟨x, hbd ⟨hx.2, hx.1⟩, hx.1⟩ hA + obtain ⟨D, hDU, hDV⟩ := exists_drawing_on_oArc hB₀.isOArc_discBd (Γ.finite_V.subset + inter_subset_left) hA inter_subset_right + have hmeet : Γ.U ∩ D.U ⊆ Γ.V ∩ D.V := fun x hx => by + have hx2 : x ∈ discBd B₀ := hDU ▸ hx.2 + have hxV := hbd ⟨hx.1, hx2⟩ + exact ⟨hxV, hDV ▸ ⟨hxV, hx2⟩⟩ + have hE₁ : Γ.E ⊆ (Γ.glue D hmeet).E := by + rw [Drawing.glue_E] + exact subset_union_left + have hD₁ : D.E ⊆ (Γ.glue D hmeet).E := by + rw [Drawing.glue_E] + exact subset_union_right + have hV₁ : Γ.V ⊆ (Γ.glue D hmeet).V := subset_union_left + have hDV₁ : D.V ⊆ (Γ.glue D hmeet).V := subset_union_right + have hB₀V : ∀ x ∈ Γ.U, x ∈ B₀ → x ∈ discBd B₀ ∧ x ∈ Γ.V := fun x hx h => by + have h1 : x ∈ discBd B₀ := by + by_contra hn + exact disjoint_left.mp hint hx ⟨h, hn⟩ + exact ⟨h1, hbd ⟨hx, h1⟩⟩ + have hclV : ∀ g ∈ Γ.E, ∀ x ∈ closure g, x ∉ Γ.V → x ∈ g := fun g hg x hx hn => by + rw [← Γ.closure_diff_V hg] + exact ⟨hx, hn⟩ + have hclU : ∀ g ∈ Γ.E, closure g ⊆ Γ.U := fun _ hg => Γ.closure_subset_U hg + let 𝓔 : Set (Set T) := {e ∈ Γ.E | ∃ u ∈ K, u ∈ closure e} + have h𝓔 : 𝓔.Finite := Γ.finite_edges.subset (sep_subset _ _) + have hor : ∀ e ∈ 𝓔, ∃ c, EdgeParam Γ e c ∧ c 0 ∈ K := fun e he => by + obtain ⟨u, hu, huc⟩ := he.2 + obtain ⟨c, h1, h2⟩ := EdgeParam.exists_orient he.1 huc (hKV hu) + exact ⟨c, h1, h2 ▸ hu⟩ + have : Nonempty (I → T) := ⟨fun _ => hA.some⟩ + choose! γ hγ hγK using hor + have hzex : ∀ v : T, ∃ z ∈ discBd B₀, z ≠ v := fun v => hB₀.isOArc_discBd.exists_ne v + choose z hz hzv using hzex + have hq1 : quarter₂ < (1 : I) := unitInterval.lt_one_iff_ne_one.mpr fun e => by + have h1 := congrArg Subtype.val e + norm_num [quarter₂] at h1 + have hq0 : (0 : I) < quarter₂ := unitInterval.pos_iff_ne_zero.mpr fun e => by + have h1 := congrArg Subtype.val e + norm_num [quarter₂] at h1 + let P : T → Set T := fun v => (Γ.V \ {v}) ∪ (⋃ e ∈ {e ∈ Γ.E | v ∉ closure e}, closure e) ∪ + ((fun e => γ e quarter₂) '' 𝓔) ∪ E₀ ∪ (if v ∈ discBd B₀ then {z v} else B₀) + have hPc : ∀ v ∈ K, IsClosed (P v) := fun v _ => by + refine (((((Γ.finite_V.subset sdiff_subset).isClosed).union ((Γ.finite_edges.subset + (sep_subset _ _)).isClosed_biUnion fun e _ => isClosed_closure)).union + (h𝓔.image _).isClosed).union hE₀.isClosed).union ?_ + split_ifs + · exact isClosed_singleton + · exact hB₀.isClosed + have hvP : ∀ v ∈ K, v ∉ P v := fun v hv => by + rintro ((((h | h) | ⟨e, he, h⟩) | h) | h) + · exact h.2 rfl + · obtain ⟨e, he, h1⟩ := mem_iUnion₂.mp h + exact he.2 h1 + · have h' : γ e quarter₂ = v := h + exact (hγ e he).not_V he.1 hq0 hq1 (h'.symm ▸ hKV hv) + · exact disjoint_left.mp hKE hv h + · split_ifs at h with h2 + · exact hzv v h.symm + · exact h2 (hB₀V v (Γ.V_subset_U (hKV hv)) h).1 + obtain ⟨R, hR, hRd⟩ := exists_star_family hS (Γ.glue D hmeet) (hKV.trans hV₁) hPc hvP + have hRP : ∀ v ∈ K, ∀ x ∈ R v, x ∉ P v := fun v hv x hx h => disjoint_left.mp (hR v hv).2 hx h + have hoffV : ∀ v ∈ K, ∀ w ∈ Γ.V, w ≠ v → w ∉ R v := fun v hv w hw hne h => hRP v hv w h (.inl + (.inl (.inl (.inl ⟨hw, hne⟩)))) + have hcloff : ∀ v ∈ K, ∀ e ∈ Γ.E, v ∉ closure e → Disjoint (R v) (closure e) := fun v hv e he hn + => disjoint_left.mpr fun x hx h => + hRP v hv x hx (.inl (.inl (.inl (.inr (mem_iUnion₂.mpr ⟨e, ⟨he, hn⟩, h⟩))))) + have hRE : ∀ v ∈ K, Disjoint (R v) E₀ := fun v hv => disjoint_left.mpr fun x hx h + => hRP v hv x hx (.inl (.inr h)) + have hRB₀ : ∀ v ∈ K, v ∉ discBd B₀ → Disjoint (R v) B₀ := fun v hv hn + => disjoint_left.mpr fun x hx h => hRP v hv x hx (.inr (by rwa [ite_eq_right hn])) + have hpiece : ∀ e ∈ 𝓔, ∃ L a b, IsPiece Γ K X R e L a b (γ e 0) (γ e 1) := fun e he => + exists_piece hman hE₁ hV₁ hKV (fun v hv => (hR v hv).1) (hγ e he) he.1 (hγK e he) (fun v hv h + => hRP v hv _ h (.inl (.inl (.inr ⟨e, he, rfl⟩)))) + hoffV (fun v hv ⟨y, h1, h2⟩ => by + by_contra hn + exact disjoint_left.mp (hcloff v hv e he.1 hn) h1 h2) + (hedge e he.1 _ (hγK e he) ((hγ e he).closure_eq ▸ mem_range_self _) _ (hγ e he).mem1 + ((hγ e he).closure_eq ▸ mem_range_self _)) + have : Nonempty T := ⟨hA.some⟩ + choose! L a b hL using hpiece + have hLU : ∀ e ∈ 𝓔, L e ⊆ Γ.U := fun e he x hx => hclU e he.1 ((hL e he).sub hx) + have hLVmem : ∀ e ∈ 𝓔, ∀ x ∈ L e, x ∈ Γ.V → x = b e ∧ b e ∈ X := fun e he x hx hv => + (hL e he).vertex x hx hv + have hmeetV : ∀ e ∈ 𝓔, ∀ f ∈ 𝓔, e ≠ f → ∀ x ∈ L e, x ∈ L f → x ∈ Γ.V := fun e he f hf hef x hx hy + => by + rcases (hL e he).onEdge x hx with h1 | h1 + · rcases (hL f hf).onEdge x hy with h2 | h2 + · exact absurd h2 (disjoint_left.mp (GM06.disjoint_edges_of_ne Γ he.1 hf.1 hef) h1) + · exact h2 + · exact h1 + -- The discs at the vertices of `K` on the boundary of `B₀`, joined to it. + have hKfin : K.Finite := Γ.finite_V.subset hKV + have hchord : ∀ v ∈ K ∩ discBd B₀, ∃ F y₁ y₂, IsLineWithEnds F y₁ y₂ ∧ y₁ ≠ y₂ ∧ F ⊆ R v + ∧ F ∩ discBd (R v) = {y₁, y₂} ∧ R v ∩ discBd B₀ = F ∧ v ∈ F := fun v hv => by + have hst := (hR v hv.1).1 + refine exists_star_chord hB₀.isOArc_discBd hv.2 hst.disc (hst.disc.isOpen_discInt hman) hst.mem + (hz v) (fun h => ?_) (fun y hy => ?_) + · exact hRP v hv.1 _ h (.inr (by rw [ite_eq_left hv.2]; exact rfl)) + · exact hst.star _ hB₀.isOArc_discBd.isCompact.isClosed (hDU ▸ isGammaNice_of_U hD₁ hDV₁) y hy + choose! F y₁ y₂ hF₁ hF₂ hF₃ hF₄ hF₅ hF₆ using hchord + have hK₀ : (K ∩ discBd B₀).Finite := hKfin.subset inter_subset_left + have hmemK₀ : ∀ {v}, v ∈ hK₀.toFinset → v ∈ K ∩ discBd B₀ := fun {v} h => hK₀.mem_toFinset.mp h + obtain ⟨B₁, hB₁, h1a, h1b, h1c, h1d, h1e, h1f, h1g⟩ := exists_blob (R := R) (F := F) (y₁ := y₁) + (y₂ := y₂) (v := id) hS hB₀ hK₀.toFinset (fun v hv => (hR v (hmemK₀ hv).1).1.disc) + (fun v hv => hF₁ v (hmemK₀ hv)) (fun v hv => hF₂ v (hmemK₀ hv)) (fun v hv => hF₃ v (hmemK₀ hv)) + (fun v hv => hF₄ v (hmemK₀ hv)) (fun v hv => hF₅ v (hmemK₀ hv)) + (fun v hv => hF₆ v (hmemK₀ hv)) (fun v hv => (hR v (hmemK₀ hv).1).1.mem) (fun u hu v hv huv + => hRd u (hmemK₀ hu).1 v (hmemK₀ hv).1 huv) + have hB₁cases : ∀ x ∈ B₁, x ∈ B₀ ∨ ∃ v ∈ K, v ∈ discBd B₀ ∧ x ∈ R v := fun x hx => by + rcases h1c hx with h | h + · exact .inl h + · obtain ⟨v, hv, h2⟩ := mem_iUnion₂.mp h + exact .inr ⟨v, (hmemK₀ hv).1, (hmemK₀ hv).2, h2⟩ + have hbB₁ : ∀ v ∈ K, v ∈ discBd B₀ → ∀ x ∈ discBd (R v), x ∉ Γ.V → x ∈ Γ.U → x ∈ discBd B₁ + := fun v hv hvb x hx h2 h3 => + h1f v (hK₀.mem_toFinset.mpr ⟨hv, hvb⟩) ⟨hx, fun h => h2 (hB₀V x h3 h).2⟩ + have hintR : ∀ v ∈ K, v ∈ discBd B₀ → discInt (R v) ⊆ discInt B₁ := fun v hv hvb x hx => by + have hm := hK₀.mem_toFinset.mpr ⟨hv, hvb⟩ + exact ⟨h1b v hm hx.1, fun h => disjoint_left.mp (h1e v hm) h hx⟩ + have hLB₁ : ∀ e ∈ 𝓔, ∀ x ∈ L e, x ∈ B₁ → x = a e ∨ x = b e := fun e he x hx hxB => by + rcases hB₁cases x hxB with h | ⟨v, hv, -, h⟩ + · exact .inr (hLVmem e he x hx (hB₀V x (hLU e he hx) h).2).1 + · exact (hL e he).disc v hv x hx h + -- The tree. + have hvert : ∀ e ∈ 𝓔, ∀ x ∈ closure e, x ∈ Γ.V → x = γ e 0 ∨ x = γ e 1 := fun e he x hx hv => by + rw [(hγ e he).closure_eq] at hx + obtain ⟨y, rfl⟩ := hx + by_contra hn + push Not at hn + have h1 : 0 < y := unitInterval.pos_iff_ne_zero.mpr fun e' => hn.1 (by rw [e']) + have h2 : y < 1 := unitInterval.lt_one_iff_ne_one.mpr fun e' => hn.2 (by rw [e']) + exact (hγ e he).not_V he.1 h1 h2 hv + have hnoV : ∀ e ∈ 𝓔, γ e 1 ∈ K → ∀ x ∈ L e, x ∉ Γ.V := fun e he h1 x hx hv => by + obtain ⟨-, h2⟩ := hLVmem e he x hx hv + rcases (hL e he).b_mem with ⟨-, -, h3⟩ | ⟨h3, -⟩ + · exact h3 (hXV h2) + · exact h3 h1 + have hbK : ∀ e ∈ 𝓔, γ e 1 ∈ K → b e ∈ discBd (R (γ e 1)) ∧ b e ∉ Γ.V := fun e he h1 => by + rcases (hL e he).b_mem with ⟨-, h3, h4⟩ | ⟨h3, -⟩ + · exact ⟨h3, h4⟩ + · exact absurd h1 h3 + let N : Type := ↥(K \ discBd B₀) + have htree : ∀ u : N, ∃ e ∈ 𝓔, ∃ w ∈ K, w ≠ u.1 ∧ u.1 ∈ closure e ∧ w ∈ closure e ∧ + (w ∉ discBd B₀ → ρ w < ρ u.1) := fun u => by + obtain ⟨e, he, w, hw, h1, h2, h3, h4⟩ := hreach u.1 u.2.1 u.2.2 + exact ⟨e, ⟨he, u.1, u.2.1, h2⟩, w, hw, h1, h2, h3, h4⟩ + choose eT heT wT hwT hwne huc hwc hrk using htree + have hTends : ∀ u : N, (γ (eT u) 0 = u.1 ∧ γ (eT u) 1 = wT u) ∨ (γ (eT u) 0 = wT u ∧ γ (eT u) 1 + = u.1) := fun u => by + exact tree_edge_endpoints (T := T) Γ (B₀ := B₀) (K := K) hKV 𝓔 γ hvert eT heT wT hwT hwne + huc hwc u + have hT1 : ∀ u : N, γ (eT u) 1 ∈ K := fun u => by + rcases hTends u with ⟨-, h⟩ | ⟨-, h⟩ + · exact h ▸ hwT u + · exact h ▸ u.2.1 + have hpq : ∀ u : N, ∃ p q, IsLineWithEnds (L (eT u)) p q ∧ p ∈ discBd (R u.1) ∧ q ∈ discBd (R + (wT u)) ∧ ({p, q} : Set T) = {a (eT u), b (eT u)} := fun u => by + exact orient_tree_attachment (T := T) Γ (B₀ := B₀) (X := X) (K := K) 𝓔 γ R L a b hL hbK eT + heT wT hTends hT1 u + choose p q hpql hpb hqb hpq_ends using hpq + let par : N → Option N := fun u => + @dite (Option N) (wT u ∉ discBd B₀) (Classical.propDecidable _) + (fun h => some ⟨wT u, hwT u, h⟩) (fun _ => none) + let c₀ : Option N → Set T := fun n => n.elim B₁ fun u => R u.1 + have hRB₁ : ∀ u : N, Disjoint (R u.1) B₁ := fun u => disjoint_left.mpr fun x hx h => by + rcases hB₁cases x h with h1 | ⟨v, hv, hvb, h1⟩ + · exact disjoint_left.mp (hRB₀ u.1 u.2.1 u.2.2) hx h1 + · exact disjoint_left.mp (hRd u.1 u.2.1 v hv fun e => u.2.2 (e ▸ hvb)) hx h1 + have hd' : ∀ n, IsClosedDisc (c₀ n) := fun n => by + cases n with + | none => exact hB₁ + | some u => exact (hR u.1 u.2.1).1.disc + have hdj' : ∀ m n, m ≠ n → Disjoint (c₀ m) (c₀ n) := fun m n hmn => by + exact rooted_discs_disjoint (T := T) (B₀ := B₀) (K := K) R hRd B₁ hRB₁ m n hmn + have hρ' : ∀ u v, par u = some v → ρ v.1 < ρ u.1 := fun u v h => by + exact parent_rank_decreases (T := T) (B₀ := B₀) (K := K) (ρ := ρ) wT hwT hrk u v h + have hq' : ∀ u, q u ∈ discBd (c₀ (par u)) := fun u => by + exact attachment_end_on_parent_disc (T := T) Γ (B₀ := B₀) (K := K) 𝓔 γ R L hLU B₁ hbB₁ hnoV + eT heT wT hwT hT1 p q hpql hqb u + have hLc' : ∀ u n, L (eT u) ∩ c₀ n ⊆ {p u, q u} := fun u n x hx => by + rw [hpq_ends u] + cases n with + | none => exact hLB₁ _ (heT u) x hx.1 hx.2 + | some v => exact (hL _ (heT u)).disc v.1 v.2.1 x hx.1 hx.2 + have hLL' : ∀ u v, u ≠ v → Disjoint (L (eT u)) (L (eT v)) := fun u v huv => by + exact tree_attachment_lines_disjoint (T := T) Γ (B₀ := B₀) (K := K) hKV (ρ := ρ) 𝓔 γ L hmeetV + hvert hnoV eT heT wT hwT hwne huc hwc hrk hT1 u v huv + -- The other lines, and the rest of the drawing. + exact disc_from_rooted_attachments (T := T) hS hsph Γ (B₀ := B₀) (E₀ := E₀) (X := X) (K := K) + hE₀ hd hbd hEU hEint hXV hXK hcuff (ρ := ρ) hB₀V hclV hclU h𝓔 γ hγK R + (fun v hv => (hR v hv).1.mem) hoffV + hcloff hRE L a b hL hLU hLVmem hmeetV hKfin hK₀.toFinset hmemK₀ B₁ h1a h1d h1g hB₁cases hbB₁ + hintR + hLB₁ hnoV eT heT hT1 p q hpql hpb par hd' hdj' hρ' hq' hLc' hLL' + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Slit.lean b/LeanPool/GraphMinor/GM07/Slit.lean new file mode 100644 index 0000000000..1bc3b18ec3 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Slit.lean @@ -0,0 +1,607 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.SlitPlane +public import LeanPool.GraphMinor.Surface.Collapse +public import LeanPool.GraphMinor.Surface.DiscRemove +public import LeanPool.GraphMinor.Surface.PushOff +public import LeanPool.GraphMinor.Surface.SurfacePull + +/-! +# Cutting a surface along a line + +Let `L` be a line of a surface that misses the boundary. We make `L` a segment of the real axis in a +chart, and remove the +open ball around it that has the segment as a diameter. The map `slitMap` of `SlitPlane.lean` folds +the circle onto the +segment, and it is the identity on a larger circle. So the surface without the open disc, with this +map, is the surface cut +along `L`. The surface with the disc back in is the old surface, and the inclusion is homotopic to +the map onto the old +surface. `IsSlit` collects these facts, and `exists_slit` proves them. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Complex GraphMinor.Surface + +universe u + +local notation "𝕀" => unitInterval + +theorem closedBall_disc {s : ℝ} (h0 : 0 < s) : + IsClosedDisc (closedBall (0 : ℂ) s) ∧ discBd (closedBall (0 : ℂ) s) = sphere 0 s := by + have h := isClosedDisc_of_convex (K := closedBall (0 : ℂ) s) (convex_closedBall 0 s) + (by rw [interior_closedBall _ h0.ne']; exact ⟨0, by simpa using h0⟩) isBounded_closedBall + isClosed_closedBall + rw [frontier_closedBall _ h0.ne'] at h + exact h + +/-- The chart of a line, as a segment of the real axis, in a given open set. -/ +theorem exists_ball_chart {T : Type} [TopologicalSpace T] (hT : IsClosedSurface T) {a : 𝕀 → T} + (ha : IsArcMap a) {W : Set T} + (hW : IsOpen W) (haW : range a ⊆ W) : + ∃ (O : Set ℂ) (K : ℂ → T) (s : ℝ), StripChart O K ∧ 0 < s ∧ s < 1 ∧ closedBall 0 1 ⊆ O + ∧ K '' closedBall 0 1 ⊆ W ∧ + K (-s : ℝ) = a 0 ∧ K (s : ℝ) = a 1 ∧ ∀ x, x ∈ range a ↔ ∃ z ∈ closedBall (0 : ℂ) 1, z.im = 0 + ∧ |z.re| ≤ s ∧ K z = x := + exists_stretched_arc_chart hT ha hW haW + +private theorem exists_line_chart_in_cap {M : Type} [TopologicalSpace M] + (hM : IsSurface M) {L : Set M} {u v : M} + (hL : IsLineWithEnds L u v) (hd : L ∩ bd M = ∅) + {W : Set M} (hW : IsOpen W) (hLW : L ⊆ W) : + let B : Set ℂ := closedBall 0 1 + ∃ (T : Type) (_ : TopologicalSpace T) (j : M → T) (J : T → M) + (O : Set ℂ) (K : ℂ → T) (s : ℝ), + IsClosedSurface T ∧ IsClosedEmbedding j ∧ StripChart O K ∧ + 0 < s ∧ s < 1 ∧ B ⊆ O ∧ + (∀ z ∈ B, K z ∈ range j) ∧ (∀ y ∈ range j, j (J y) = y) ∧ + ContinuousOn (J ∘ K) B ∧ InjOn (J ∘ K) B ∧ (J ∘ K) '' B ⊆ W ∧ + (∀ z ∈ B, J (K z) ∉ bd M) ∧ J (K (-s : ℝ)) = u ∧ J (K (s : ℝ)) = v ∧ + ∀ x, x ∈ L ↔ ∃ z ∈ B, z.im = 0 ∧ |z.re| ≤ s ∧ J (K z) = x := by + classical + obtain ⟨T, tT, j, Kc, hT, hj, hKc, hun, hint, -⟩ := exists_capAll M hM + have ht2 : T2Space T := hT.2.1 + have ht2M : T2Space M := hM.2.1 + have hcM : CompactSpace M := hM.1 + obtain ⟨a₀, ha₀, hr, ha0, ha1⟩ := hL.exists_arc + have ha : IsArcMap (j ∘ a₀) := ⟨hj.continuous.comp ha₀.1, hj.injective.comp ha₀.2⟩ + have hWT : IsOpen (Kcᶜ ∩ (j '' Wᶜ)ᶜ) := hKc.isOpen_compl.inter (hj.isClosedMap _ + hW.isClosed_compl).isOpen_compl + have haW : range (j ∘ a₀) ⊆ Kcᶜ ∩ (j '' Wᶜ)ᶜ := by + rintro _ ⟨t, rfl⟩ + have htL : a₀ t ∈ L := hr ▸ mem_range_self t + refine ⟨fun hc => ?_, ?_⟩ + · have h1 : j (a₀ t) ∈ range j ∩ Kc := ⟨mem_range_self _, hc⟩ + rw [hint] at h1 + obtain ⟨y, hy, he⟩ := h1 + have h3 : a₀ t ∈ L ∩ bd M := ⟨htL, hj.injective he ▸ hy⟩ + rw [hd] at h3 + exact h3 + · rintro ⟨y, hy, he⟩ + exact hy (hj.injective he ▸ hLW htL) + obtain ⟨O, K, s, hK, hs0, hs1, hBO, hBW, hKm, hKp, hrange⟩ := exists_ball_chart hT ha hWT haW + let B : Set ℂ := closedBall 0 1 + have hKr : ∀ z ∈ B, K z ∈ range j := fun z hz => by + have h1 := hun.ge (mem_univ (K z)) + exact h1.resolve_right (hBW ⟨z, hz, rfl⟩).1 + have : Nonempty M := by + obtain ⟨y, -⟩ := hKr 0 (by simp [B]) + exact ⟨y⟩ + let J : T → M := Function.invFun j + have hJ : ∀ x, J (j x) = x := Function.leftInverse_invFun hj.injective + have hjJ : ∀ y ∈ range j, j (J y) = y := fun y ⟨x, hx⟩ => by rw [← hx, hJ] + let K₀ : ℂ → M := fun z => J (K z) + have hjK : ∀ z ∈ B, j (K₀ z) = K z := fun z hz => hjJ _ (hKr z hz) + have hK₀i : InjOn K₀ B := fun z hz w hw he => hK.hi (hBO hz) (hBO hw) + (by rw [← hjK z hz, ← hjK w hw, he]) + have hK₀c : ContinuousOn K₀ B := by + rw [hj.isEmbedding.continuousOn_iff] + exact (hK.hc.mono hBO).congr fun z hz => hjK z hz + refine ⟨T, tT, j, J, O, K, s, hT, hj, hK, hs0, hs1, hBO, hKr, hjJ, + hK₀c, hK₀i, ?_, ?_, ?_, ?_, fun x => ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + by_contra hn + exact (hBW ⟨z, hz, rfl⟩).2 ⟨_, hn, hjK z hz⟩ + · intro z hz hb + have h1 : j (K₀ z) ∈ range j ∩ Kc := hint ▸ mem_image_of_mem j hb + rw [hjK z hz] at h1 + exact (hBW ⟨z, hz, rfl⟩).1 h1.2 + · rw [hKm, Function.comp_apply, ha0, hJ] + · rw [hKp, Function.comp_apply, ha1, hJ] + · constructor + · intro hx + rw [← hr] at hx + obtain ⟨t, rfl⟩ := hx + obtain ⟨z, hz, him, hre, hEq⟩ := (hrange (j (a₀ t))).mp ⟨t, rfl⟩ + exact ⟨z, hz, him, hre, by rw [hEq, hJ]⟩ + · rintro ⟨z, hz, him, hre, rfl⟩ + obtain ⟨t, ht⟩ := (hrange (K z)).mpr ⟨z, hz, him, hre, rfl⟩ + have he : a₀ t = J (K z) := hj.injective (by rw [hjK z hz]; exact ht) + rw [← he, ← hr] + exact mem_range_self t + +/-- A chart of a disc around a line off the boundary: the line is a segment of a diameter. -/ +theorem exists_line_chart_aux {M : Type} [TopologicalSpace M] (hM : IsSurface M) {L : Set M} {u v : + M} (hL : IsLineWithEnds L u v) (hd : L ∩ bd M = ∅) + {W : Set M} (hW : IsOpen W) (hLW : L ⊆ W) : + ∃ (K₀ : ℂ → M) (s : ℝ), 0 < s ∧ s < 1 ∧ ContinuousOn K₀ (closedBall 0 1) ∧ InjOn K₀ + (closedBall 0 1) ∧ K₀ '' closedBall 0 1 ⊆ W ∧ + (∀ z ∈ closedBall (0 : ℂ) 1, K₀ z ∉ bd M) ∧ K₀ (-s : ℝ) = u ∧ K₀ (s : ℝ) = v + ∧ ∀ x, x ∈ L ↔ ∃ z ∈ closedBall (0 : ℂ) 1, z.im = 0 ∧ |z.re| ≤ s ∧ K₀ z = x := by + obtain ⟨T, tT, j, J, O, K, s, _, _, _, hs0, hs1, _, _, _, hc, hi, hW, hb, hu, hv, hL⟩ := + exists_line_chart_in_cap hM hL hd hW hLW + exact ⟨J ∘ K, s, hs0, hs1, hc, hi, hW, hb, hu, hv, hL⟩ + +/-- `E` is a closed disc off the boundary, and `c` is a homotopy from the identity to a map of the +surface that takes `E` +to the line `L`. Off the inside of `E`, this map is onto, it folds `discBd E` onto `L` with two +points over each inner point +of `L` and one over each end, and it is one to one elsewhere. -/ +structure IsSlit {S : Type u} [TopologicalSpace S] (L : Set S) (u v : S) (E : Set S) (c : 𝕀 × S + → S) : Prop where + disc : IsClosedDisc E + off_bd : E ∩ bd S = ∅ + cont : Continuous c + c0 : ∀ x, c (0, x) = x + fix : ∀ x ∈ bd S, ∀ t, c (t, x) = x + bd_iff : ∀ x, c (1, x) ∈ bd S ↔ x ∈ bd S + onto : ∀ y, ∃ x, x ∉ discInt E ∧ c (1, x) = y + fold : ∀ x ∈ discBd E, c (1, x) ∈ L + off : ∀ x, x ∉ E → c (1, x) ∉ L + sub : L ⊆ E + inj : ∀ x y, x ∉ discInt E → y ∉ discInt E → c (1, x) = c (1, y) → + x = y ∨ (x ∈ discBd E ∧ y ∈ discBd E ∧ c (1, x) ≠ u ∧ c (1, x) ≠ v) + two : ∀ y ∈ L, y ≠ u → y ≠ v → ∃ x x', x ≠ x' ∧ x ∈ discBd E ∧ x' ∈ discBd E ∧ c (1, x) = y ∧ c + (1, x') = y + /-- Off the inside of `E`, each fiber of the map has at most two points. -/ + pair : ∀ y, ∃ a b, {x | x ∉ discInt E ∧ c (1, x) = y} ⊆ {a, b} + +/-- Off the inside of `E`, the map has finite fibers. -/ +theorem IsSlit.fiber {S : Type u} [TopologicalSpace S] {L : Set S} {u v : S} {E : Set S} + {c : 𝕀 × S → S} (hs : IsSlit L u v E c) (y : S) : + {x | x ∉ discInt E ∧ c (1, x) = y}.Finite := by + obtain ⟨a, b, h⟩ := hs.pair y + exact ((finite_singleton b).insert a).subset h + +private theorem discInt_image_closedBall + {M : Type} + [TopologicalSpace M] + (s : ℝ) + (B : Set ℂ) + (K₀ : ℂ → M) + (hK₀i : InjOn K₀ B) + (hsB : closedBall 0 s ⊆ B) + (hEb : discBd (K₀ '' closedBall 0 s) = K₀ '' sphere 0 s) : + discInt (K₀ '' closedBall 0 s) = K₀ '' ball 0 s := by + let E := K₀ '' closedBall 0 s + ext x + simp only [discInt, mem_sdiff, hEb] + constructor + · rintro ⟨⟨z, hz, rfl⟩, h2⟩ + refine ⟨z, ?_, rfl⟩ + have hz' : ‖z‖ ≤ s := mem_closedBall_zero_iff.mp hz + refine mem_ball_zero_iff.mpr (lt_of_le_of_ne hz' fun he => h2 ⟨z, + mem_sphere_zero_iff_norm.mpr he, rfl⟩) + · rintro ⟨z, hz, rfl⟩ + refine ⟨⟨z, ball_subset_closedBall hz, rfl⟩, ?_⟩ + rintro ⟨w, hw, he⟩ + have h1 := hK₀i (hsB (sphere_subset_closedBall hw)) (hsB (ball_subset_closedBall hz)) he + rw [h1, mem_sphere_zero_iff_norm] at hw + exact (mem_ball_zero_iff.mp hz).ne hw + +private theorem slit_boundary_collision + {M : Type} + [TopologicalSpace M] + {u : M} + {v : M} + (s : ℝ) + (hs0 : 0 < s) + (hs1 : s < 1) + (B : Set ℂ) + (hslB : ∀ z ∈ B, slitMap s z ∈ B) + (K₀ : ℂ → M) + (hK₀i : InjOn K₀ B) + (c₀ : 𝕀 × M → M) + (hc₀2 : ∀ (p : 𝕀), ∀ x ∉ K₀ '' B, c₀ (p, x) = x) + (E : Set M) + (hEb : discBd E = K₀ '' sphere 0 s) + (hreal : ∀ {x : ℝ}, |x| ≤ s → ↑x ∈ B) + (hu : K₀ ↑(-s) = u) + (hv : K₀ ↑s = v) + (hnotint : ∀ {z : ℂ}, z ∈ B → K₀ z ∉ discInt E → s ≤ ‖z‖) + (hc₀s : ∀ z ∈ B, c₀ (1, K₀ z) = K₀ (slitMap s z)) : + ∀ (x y : M), x ∉ discInt E → y ∉ discInt E → c₀ (1, x) = c₀ (1, y) → x = y ∨ x ∈ discBd E ∧ y + ∈ discBd E ∧ c₀ (1, x) ≠ u ∧ c₀ (1, x) ≠ v := by + intro x y hx hy he + by_cases hin : x ∈ K₀ '' B <;> by_cases hin' : y ∈ K₀ '' B + · obtain ⟨z, hz, rfl⟩ := hin + obtain ⟨w, hw, rfl⟩ := hin' + rw [hc₀s z hz, hc₀s w hw] at he + have h1 := hK₀i (hslB z hz) (hslB w hw) he + rcases slitMap_eq hs0 hs1 (hnotint hz hx) (hnotint hw hy) h1 with rfl | ⟨h2, h3, h4⟩ + · exact .inl rfl + by_cases hre : z.im = 0 + · have : w = z := by rw [h4]; exact Complex.conj_eq_iff_im.mpr hre + rw [this] + exact .inl rfl + right + refine ⟨hEb ▸ ⟨z, mem_sphere_zero_iff_norm.mpr h2, rfl⟩, hEb ▸ ⟨w, + mem_sphere_zero_iff_norm.mpr h3, rfl⟩, ?_, ?_⟩ + all_goals + rw [hc₀s z hz, slitMap_of_norm_le hs0 hs1 h2.le] + intro hb + have hb' : K₀ (z.re : ℂ) = K₀ _ := hb.trans (by first | exact hu.symm | exact hv.symm) + have hre1 : |z.re| ≤ s := (Complex.abs_re_le_norm z).trans h2.le + have h6 := congrArg Complex.re (hK₀i (hreal hre1) (hreal (x := _) + (by first | rw [abs_neg, abs_of_pos hs0] | rw [abs_of_pos hs0])) hb') + simp only [ofReal_re] at h6 + have h7 : z.re ^ 2 + z.im ^ 2 = s ^ 2 := by + rw [← h2, Complex.sq_norm, Complex.normSq_apply] + ring + have h8 : z.im ^ 2 = 0 := by rw [h6] at h7; nlinarith + exact hre (pow_eq_zero_iff (two_ne_zero)|>.mp h8) + · obtain ⟨z, hz, rfl⟩ := hin + rw [hc₀s z hz, hc₀2 _ y hin'] at he + exact absurd ⟨_, hslB z hz, he⟩ hin' + · obtain ⟨w, hw, rfl⟩ := hin' + rw [hc₀s w hw, hc₀2 _ x hin] at he + exact absurd ⟨_, hslB w hw, he.symm⟩ hin + · rw [hc₀2 _ x hin, hc₀2 _ y hin'] at he + exact .inl he + +private theorem slit_boundary_pair + {M : Type} + [TopologicalSpace M] + {L : Set M} + {u : M} + {v : M} + (s : ℝ) + (hs0 : 0 < s) + (hs1 : s < 1) + (B : Set ℂ) + (K₀ : ℂ → M) + (hK₀i : InjOn K₀ B) + (c₀ : 𝕀 × M → M) + (E : Set M) + (hEb : discBd E = K₀ '' sphere 0 s) + (hjp : ∀ (x : M), x ∈ L ↔ ∃ z ∈ B, z.im = 0 ∧ |z.re| ≤ s ∧ K₀ z = x) + (hmem : ∀ {z : ℂ}, ‖z‖ ≤ 1 → z ∈ B) + (hu : K₀ ↑(-s) = u) + (hv : K₀ ↑s = v) + (hc₀s : ∀ z ∈ B, c₀ (1, K₀ z) = K₀ (slitMap s z)) : + ∀ y ∈ L, y ≠ u → y ≠ v → ∃ x x', x ≠ x' ∧ x ∈ discBd E ∧ x' ∈ discBd E ∧ c₀ (1, x) = y ∧ c₀ + (1, x') = y := by + intro y hy hyu hyv + obtain ⟨z, hz, h2, h3, rfl⟩ := (hjp y).mp hy + have hlt : |z.re| < s := by + refine lt_of_le_of_ne h3 fun he => ?_ + have hz_eq : ∀ r : ℝ, z.re = r → z = (r : ℂ) := fun r hr => Complex.ext (by simpa using hr) + (by simpa using h2) + rcases abs_eq hs0.le |>.mp he with h5 | h5 + · exact hyv (by rw [hz_eq _ h5, hv]) + · exact hyu (by rw [hz_eq _ h5, ← hu]) + set r := Real.sqrt (s ^ 2 - z.re ^ 2) with hr + have hs2 : 0 < s ^ 2 - z.re ^ 2 := by + have : z.re ^ 2 < s ^ 2 := by + rw [sq_lt_sq, abs_of_pos hs0] + exact hlt + linarith + have hrpos : 0 < r := Real.sqrt_pos.mpr hs2 + have hr2 : r ^ 2 = s ^ 2 - z.re ^ 2 := Real.sq_sqrt hs2.le + have hn : ∀ σ : ℝ, σ ^ 2 = 1 → ‖(⟨z.re, σ * r⟩ : ℂ)‖ = s := fun σ hσ => by + rw [norm_of_re_im, mul_pow, hσ, one_mul, hr2] + have : z.re ^ 2 + (s ^ 2 - z.re ^ 2) = s ^ 2 := by ring + rw [this, Real.sqrt_sq hs0.le] + have hzeq : z = (z.re : ℂ) := Complex.ext (by simp) (by simpa using h2) + have hfold : ∀ σ : ℝ, σ ^ 2 = 1 → c₀ (1, K₀ ⟨z.re, σ * r⟩) = K₀ z := fun σ hσ => by + have h5 := hn σ hσ + rw [hc₀s _ (hmem (by linarith)), slitMap_of_norm_le hs0 hs1 h5.le] + rw [hzeq] + simp + have hb : ∀ σ : ℝ, σ ^ 2 = 1 → K₀ ⟨z.re, σ * r⟩ ∈ discBd E := fun σ hσ => + hEb ▸ ⟨_, mem_sphere_zero_iff_norm.mpr (hn σ hσ), rfl⟩ + refine ⟨K₀ ⟨z.re, 1 * r⟩, K₀ ⟨z.re, -1 * r⟩, ?_, hb 1 (by norm_num), hb (-1) (by norm_num), + hfold 1 (by norm_num), hfold (-1) (by norm_num)⟩ + intro he + have hleft : ‖(⟨z.re, 1 * r⟩ : ℂ)‖ ≤ 1 := (hn 1 (by norm_num)).le.trans hs1.le + have hright : ‖(⟨z.re, -1 * r⟩ : ℂ)‖ ≤ 1 := (hn (-1) (by norm_num)).le.trans hs1.le + have h5 := hK₀i (hmem hleft) (hmem hright) he + have h6 := congrArg Complex.im h5 + simp only at h6 + linarith + +private theorem slit_boundary_fiber + {M : Type} + [TopologicalSpace M] + (s : ℝ) + (hs0 : 0 < s) + (hs1 : s < 1) + (B : Set ℂ) + (hslB : ∀ z ∈ B, slitMap s z ∈ B) + (K₀ : ℂ → M) + (hK₀i : InjOn K₀ B) + (c₀ : 𝕀 × M → M) + (hc₀2 : ∀ (p : 𝕀), ∀ x ∉ K₀ '' B, c₀ (p, x) = x) + (E : Set M) + (hnotint : ∀ {z : ℂ}, z ∈ B → K₀ z ∉ discInt E → s ≤ ‖z‖) + (hc₀s : ∀ z ∈ B, c₀ (1, K₀ z) = K₀ (slitMap s z)) : + ∀ (y : M), ∃ a b, {x | x ∉ discInt E ∧ c₀ (1, x) = y} ⊆ {a, b} := by + intro y₀ + by_cases hne : {x | x ∉ discInt E ∧ c₀ (1, x) = y₀}.Nonempty + swap + · rw [not_nonempty_iff_eq_empty.mp hne] + exact ⟨y₀, y₀, empty_subset _⟩ + obtain ⟨x₀, hx₀, rfl⟩ := hne + by_cases hin : x₀ ∈ K₀ '' B + · obtain ⟨z, hz, rfl⟩ := hin + refine ⟨K₀ z, K₀ ((starRingEnd ℂ) z), ?_⟩ + rintro y ⟨hy, he⟩ + by_cases hin' : y ∈ K₀ '' B + · obtain ⟨w, hw, rfl⟩ := hin' + rw [hc₀s w hw, hc₀s z hz] at he + rcases slitMap_eq hs0 hs1 (hnotint hz hx₀) (hnotint hw hy) (hK₀i (hslB z hz) + (hslB w hw) he.symm) with rfl | ⟨-, -, h4⟩ + · exact .inl rfl + · rw [h4] + exact .inr rfl + · rw [hc₀s z hz, hc₀2 _ y hin'] at he + exact absurd ⟨_, hslB z hz, he.symm⟩ hin' + · refine ⟨x₀, x₀, ?_⟩ + rintro y ⟨hy, he⟩ + by_cases hin' : y ∈ K₀ '' B + · obtain ⟨w, hw, rfl⟩ := hin' + rw [hc₀s w hw, hc₀2 _ x₀ hin] at he + exact absurd ⟨_, hslB w hw, he⟩ hin + · rw [hc₀2 _ y hin', hc₀2 _ x₀ hin] at he + exact .inl he + +/-- A line off the boundary of a surface has a slit. -/ +theorem exists_slit_aux {M : Type} [TopologicalSpace M] (hM : IsSurface M) {L : Set M} {u v : M} + (hL : IsLineWithEnds L u v) (hd : L ∩ bd M = ∅) : ∃ E c, IsSlit L u v E c := by + classical + obtain ⟨T, tT, j, J, O, K, s, hT, hj, hK, hs0, hs1, hBO, hKr, hjJ, + hK₀c, hK₀i, _, hK₀bd, hu, hv, hjp⟩ := + exists_line_chart_in_cap hM hL hd isOpen_univ (subset_univ L) + have ht2 : T2Space T := hT.2.1 + have ht2M : T2Space M := hM.2.1 + have hcM : CompactSpace M := hM.1 + let B : Set ℂ := closedBall 0 1 + have hBc : IsCompact B := isCompact_closedBall _ _ + let K₀ : ℂ → M := J ∘ K + change (∀ z ∈ B, K₀ z ∉ bd M) at hK₀bd + have hjK : ∀ z ∈ B, j (K₀ z) = K z := fun z hz => hjJ _ (hKr z hz) + let Φ : 𝕀 × ℂ → ℂ := fun q => ((1 - q.1.1 : ℝ) : ℂ) * q.2 + ((q.1.1 : ℝ) : ℂ) * slitMap s q.2 + have hsl := continuous_slitMap hs0 + have hΦc : Continuous Φ := by + have h1 : Continuous fun q : 𝕀 × ℂ => ((q.1.1 : ℝ) : ℂ) := continuous_ofReal.comp + (continuous_subtype_val.comp continuous_fst) + have h2 : Continuous fun q : 𝕀 × ℂ => ((1 - q.1.1 : ℝ) : ℂ) := continuous_ofReal.comp + (by fun_prop) + exact (h2.mul continuous_snd).add (h1.mul (hsl.comp continuous_snd)) + have hslB : ∀ z ∈ B, slitMap s z ∈ B := fun z hz => by + have h1 : ‖z‖ ≤ 1 := mem_closedBall_zero_iff.mp hz + exact mem_closedBall_zero_iff.mpr (norm_slitMap_le hs0 hs1 h1) + have hΦm : ∀ p, ∀ z ∈ B, Φ (p, z) ∈ B := fun p z hz => by + have h1 := (convex_closedBall (0 : ℂ) 1) hz (hslB z hz) (a := 1 - p.1) (b := p.1) + (by linarith [p.2.2]) p.2.1 (by ring) + have h2 : Φ (p, z) = (1 - p.1) • z + p.1 • slitMap s z := by simp [Φ, Complex.real_smul] + rw [h2] + exact h1 + have hΦid : ∀ p, ∀ z ∈ frontier B, Φ (p, z) = z := fun p z hz => by + have hz' : z ∈ sphere (0 : ℂ) 1 := by rwa [frontier_closedBall _ one_ne_zero] at hz + have h1 : slitMap s z = z := slitMap_of_norm_eq_one hs1 (mem_sphere_zero_iff_norm.mp hz') + simp only [Φ, h1] + push_cast + ring + obtain ⟨c, hcc, hc1, hc2⟩ := exists_glue hK hBc hBO Φ hΦc.continuousOn hΦm hΦid + have hΦ0 : ∀ z, Φ (0, z) = z := fun z => by simp [Φ] + have hΦ1 : ∀ z, Φ (1, z) = slitMap s z := fun z => by simp [Φ] + have hrj : ∀ q : 𝕀 × M, c (q.1, j q.2) ∈ range j := fun q => by + by_cases hin : j q.2 ∈ K '' B + · obtain ⟨z, hz, he⟩ := hin + rw [← he, hc1 _ z hz] + exact hKr _ (hΦm _ z hz) + · rw [hc2 _ _ hin] + exact mem_range_self _ + let c₀ : 𝕀 × M → M := fun q => J (c (q.1, j q.2)) + have hjc : ∀ q, j (c₀ q) = c (q.1, j q.2) := fun q => hjJ _ (hrj q) + have hc₀c : Continuous c₀ := by + rw [hj.isEmbedding.continuous_iff] + have : j ∘ c₀ = fun q => c (q.1, j q.2) := funext hjc + rw [this] + exact hcc.comp (continuous_fst.prodMk (hj.continuous.comp continuous_snd)) + have hc₀1 : ∀ p, ∀ z ∈ B, c₀ (p, K₀ z) = K₀ (Φ (p, z)) := fun p z hz => hj.injective (by + rw [hjc, hjK z hz, hc1 _ z hz, hjK _ (hΦm p z hz)]) + have hc₀2 : ∀ p, ∀ x, x ∉ K₀ '' B → c₀ (p, x) = x := fun p x hx => hj.injective (by + rw [hjc] + refine hc2 _ _ ?_ + rintro ⟨z, hz, he⟩ + exact hx ⟨z, hz, hj.injective (by rw [hjK z hz, he])⟩) + have hsB : closedBall (0 : ℂ) s ⊆ B := closedBall_subset_closedBall hs1.le + obtain ⟨hD, hDb⟩ := closedBall_disc hs0 + obtain ⟨K', hK'c, hK'l⟩ := exists_inv_of_compactOn (hBc.of_isClosed_subset isClosed_closedBall + hsB) (hK₀c.mono hsB) + (hK₀i.mono hsB) + obtain ⟨hE, hEb⟩ := hD.image (hK₀c.mono hsB) hK'c hK'l + set E := K₀ '' closedBall (0 : ℂ) s with hEdef + rw [hDb] at hEb + have hint' : discInt E = K₀ '' ball 0 s := by + exact discInt_image_closedBall (M := M) s B K₀ hK₀i hsB hEb + have hmem : ∀ {z : ℂ}, ‖z‖ ≤ 1 → z ∈ B := fun h => mem_closedBall_zero_iff.mpr h + have hreal : ∀ {x : ℝ}, |x| ≤ s → (x : ℂ) ∈ B := fun {x} h => hmem (by + rw [Complex.norm_real, Real.norm_eq_abs] + linarith) + have hnotint : ∀ {z}, z ∈ B → K₀ z ∉ discInt E → s ≤ ‖z‖ := fun {z} hz hn => by + by_contra hlt + exact hn (hint' ▸ ⟨z, mem_ball_zero_iff.mpr (not_le.mp hlt), rfl⟩) + have hc₀s : ∀ z ∈ B, c₀ (1, K₀ z) = K₀ (slitMap s z) := fun z hz => by rw [hc₀1 _ z hz, hΦ1] + have hLsub : L ⊆ E := by + intro x hx + obtain ⟨z, hz, h2, h3, rfl⟩ := (hjp x).mp hx + refine ⟨z, mem_closedBall_zero_iff.mpr ?_, rfl⟩ + rw [Complex.norm_eq_sqrt_sq_add_sq, h2] + simpa [Real.sqrt_sq_eq_abs] using h3 + have hEB : E ⊆ K₀ '' B := image_mono hsB + refine ⟨E, c₀, hE, ?_, hc₀c, ?_, ?_, ?_, ?_, ?_, ?_, hLsub, ?_, ?_, ?_⟩ + · rw [eq_empty_iff_forall_notMem] + rintro x ⟨⟨z, hz, rfl⟩, hb⟩ + exact hK₀bd z (hsB hz) hb + · intro x + by_cases hx : x ∈ K₀ '' B + · obtain ⟨z, hz, rfl⟩ := hx + rw [hc₀1 _ z hz, hΦ0] + · exact hc₀2 _ x hx + · intro x hx t + exact hc₀2 _ x fun ⟨z, hz, he⟩ => hK₀bd z hz (he ▸ hx) + · intro x + by_cases hx : x ∈ K₀ '' B + · obtain ⟨z, hz, rfl⟩ := hx + rw [hc₀s z hz] + exact ⟨fun h => (hK₀bd _ (hslB z hz) h).elim, fun h => (hK₀bd _ hz h).elim⟩ + · rw [hc₀2 _ x hx] + · intro y + by_cases hy : y ∈ K₀ '' B + · obtain ⟨w, hw, rfl⟩ := hy + obtain ⟨z, h1, h2, rfl⟩ := exists_slitMap_eq hs0 hs1 (mem_closedBall_zero_iff.mp hw) + refine ⟨K₀ z, ?_, hc₀s z (hmem h2)⟩ + rw [hint'] + rintro ⟨z', hz', he⟩ + have h3 := hK₀i (hsB (ball_subset_closedBall hz')) (hmem h2) he + rw [h3, mem_ball_zero_iff] at hz' + linarith + · refine ⟨y, fun h => hy (hEB h.1), hc₀2 _ y hy⟩ + · intro x hx + rw [hEb] at hx + obtain ⟨z, hz, rfl⟩ := hx + have hz' : ‖z‖ = s := mem_sphere_zero_iff_norm.mp hz + have hzB : z ∈ B := hsB (sphere_subset_closedBall hz) + rw [hc₀s z hzB, slitMap_of_norm_le hs0 hs1 hz'.le] + have h1 : |z.re| ≤ s := (Complex.abs_re_le_norm z).trans hz'.le + exact (hjp _).mpr ⟨_, hreal h1, by simp, by simpa using h1, rfl⟩ + · intro x hx hL' + by_cases hin : x ∈ K₀ '' B + · obtain ⟨z, hz, rfl⟩ := hin + have hzs : s < ‖z‖ := by + by_contra hle + exact hx ⟨z, mem_closedBall_zero_iff.mpr (not_lt.mp hle), rfl⟩ + rw [hc₀s z hz] at hL' + obtain ⟨w, hw, h2, h3, he⟩ := (hjp _).mp hL' + have h4 := hK₀i hw (hslB z hz) he + have h5 : (slitMap s z).im = 0 := by rw [← h4, h2] + have h6 := slitMap_notMem_segment hs0 hs1 hzs h5 + rw [h4, slitMap_re] at h3 + linarith + · rw [hc₀2 _ x hin] at hL' + exact hx (hLsub hL') + · exact slit_boundary_collision (M := M) (u := u) (v := v) s hs0 hs1 B hslB K₀ hK₀i c₀ hc₀2 E + hEb hreal hu hv hnotint hc₀s + · exact slit_boundary_pair (M := M) (L := L) (u := u) (v := v) s hs0 hs1 B K₀ hK₀i c₀ E hEb hjp + hmem hu hv hc₀s + · exact slit_boundary_fiber (M := M) s hs0 hs1 B hslB K₀ hK₀i c₀ hc₀2 E hnotint hc₀s +/-- A slit, on a surface in any universe: we move it from the model. -/ +theorem exists_slit {S : Type u} [TopologicalSpace S] {M : Type} [TopologicalSpace M] + (hM : IsSurface M) (h : S ≃ₜ M) + {L : Set S} {u v : S} (hL : IsLineWithEnds L u v) (hd : L ∩ bd S = ∅) : ∃ E c, IsSlit L u v E c + := by + have hb : ∀ x, h x ∈ bd M ↔ x ∈ bd S := fun x => by + rw [← image_bd_homeomorph h] + exact h.injective.mem_set_image + have hL' : IsLineWithEnds (h '' L) (h u) (h v) := by + obtain ⟨f, h0, h1⟩ := hL + exact ⟨f.trans (h.image L), congrArg h h0, congrArg h h1⟩ + obtain ⟨E₀, c₀, hs⟩ := exists_slit_aux hM hL' (by + rw [eq_empty_iff_forall_notMem] + rintro _ ⟨⟨x, hx, rfl⟩, hxb⟩ + have : x ∈ L ∩ bd S := ⟨hx, (hb x).mp hxb⟩ + rw [hd] at this + exact this) + obtain ⟨hE, hEb⟩ := hs.disc.image (f := h.symm) (f' := h) h.symm.continuous.continuousOn + h.continuous.continuousOn + fun x _ => h.apply_symm_apply x + have hmem : ∀ {A : Set M} {x : S}, x ∈ h.symm '' A ↔ h x ∈ A := fun {A x} => by + constructor + · rintro ⟨y, hy, rfl⟩ + rwa [h.apply_symm_apply] + · intro hx + exact ⟨h x, hx, h.symm_apply_apply x⟩ + have hint : ∀ x, x ∈ discInt (h.symm '' E₀) ↔ h x ∈ discInt E₀ := fun x => by + simp only [discInt, mem_sdiff, hEb, hmem] + have hmemL : ∀ {x : S}, h x ∈ h '' L ↔ x ∈ L := h.injective.mem_set_image + refine ⟨h.symm '' E₀, fun q => h.symm (c₀ (q.1, h q.2)), hE, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, + ?_, ?_, ?_, ?_⟩ + · rw [eq_empty_iff_forall_notMem] + rintro x ⟨hx, hxb⟩ + have : h x ∈ E₀ ∩ bd M := ⟨hmem.mp hx, (hb x).mpr hxb⟩ + rw [hs.off_bd] at this + exact this + · exact h.symm.continuous.comp (hs.cont.comp (continuous_fst.prodMk + (h.continuous.comp continuous_snd))) + · intro x + simp [hs.c0] + · intro x hx t + simp [hs.fix _ ((hb x).mpr hx)] + · intro x + rw [← hb, h.apply_symm_apply, hs.bd_iff, hb] + · intro y + obtain ⟨x, hx, he⟩ := hs.onto (h y) + refine ⟨h.symm x, fun hi => hx (by simpa using (hint _).mp hi), ?_⟩ + simp [he] + · intro x hx + have h1 : h x ∈ discBd E₀ := by rw [hEb] at hx; exact hmem.mp hx + have h2 := hs.fold _ h1 + obtain ⟨y, hy, he⟩ := h2 + change h.symm _ ∈ L + rw [← he, h.symm_apply_apply] + exact hy + · intro x hx hL2 + refine hs.off (h x) (fun h1 => hx (hmem.mpr h1)) ?_ + have : h (h.symm (c₀ (1, h x))) ∈ h '' L := mem_image_of_mem h hL2 + rwa [h.apply_symm_apply] at this + · intro x hx + exact hmem.mpr (hs.sub (mem_image_of_mem h hx)) + · intro x y hx hy he + have he' : c₀ (1, h x) = c₀ (1, h y) := h.symm.injective he + rcases hs.inj (h x) (h y) (fun h1 => hx ((hint x).mpr h1)) (fun h1 => hy + ((hint y).mpr h1)) he' with h1 | ⟨h1, h2, h3, h4⟩ + · exact .inl (h.injective h1) + · right + rw [hEb] + refine ⟨hmem.mpr h1, hmem.mpr h2, fun h5 => h3 ?_, fun h5 => h4 ?_⟩ + · have := congrArg h h5 + simpa using this + · have := congrArg h h5 + simpa using this + · intro y hy hyu hyv + obtain ⟨x, x', hne, hx, hx', h1, h2⟩ := hs.two (h y) (mem_image_of_mem h hy) (fun he => hyu + (h.injective he)) (fun he => hyv (h.injective he)) + refine ⟨h.symm x, h.symm x', fun he => hne (h.symm.injective he), ?_, ?_, ?_, ?_⟩ + · rw [hEb] + exact mem_image_of_mem _ hx + · rw [hEb] + exact mem_image_of_mem _ hx' + · simp [h1] + · simp [h2] + · intro y + obtain ⟨a, b, hab⟩ := hs.pair (h y) + refine ⟨h.symm a, h.symm b, ?_⟩ + rintro x ⟨hx, he⟩ + have hx' : h x ∈ {x | x ∉ discInt E₀ ∧ c₀ (1, x) = h y} := by + refine ⟨fun h1 => hx ((hint x).mpr h1), ?_⟩ + have := congrArg h he + simpa using this + rcases hab hx' with h1 | h1 + · exact .inl (by rw [← h1, h.symm_apply_apply]) + · exact .inr (by rw [← mem_singleton_iff.mp h1, h.symm_apply_apply]; rfl) + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/SlitPlane.lean b/LeanPool/GraphMinor/GM07/SlitPlane.lean new file mode 100644 index 0000000000..734ce43608 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/SlitPlane.lean @@ -0,0 +1,320 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Analysis.Complex.Basic +public import Mathlib.Analysis.SpecialFunctions.Pow.Real +public import Mathlib.Analysis.InnerProductSpace.Basic + +/-! +# Opening a slit in the unit ball + +To cut a surface along a line we work in a chart in which the line is the segment `[-s, s]` of the +real axis, and we +remove the open ball of radius `s`. The map `slitMap s` of the closed unit ball is the identity on +the unit circle. +It leaves the real part alone and scales the imaginary part by a factor that grows with the norm, +from `0` at norm `s` +to `1` at norm `1`. So the circle of radius `s` is folded onto the segment, and off this circle the +map is one to one +(`slitMap_eq`). Each vertical line is treated on its own, by the intermediate value theorem +(`exists_slitMap_eq`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Metric Complex + +/-- The factor at norm `ρ`: `0` up to `s`, and `1` at `1`. -/ +noncomputable def slitFactor (s ρ : ℝ) : ℝ := (1 - s / max ρ s) / (1 - s) + +/-- The map that folds the circle of radius `s` onto the segment `[-s, s]`. -/ +noncomputable def slitMap (s : ℝ) (z : ℂ) : ℂ := ⟨z.re, z.im * slitFactor s ‖z‖⟩ + +variable {s : ℝ} + +theorem slitFactor_nonneg (h0 : 0 < s) (h1 : s < 1) (ρ : ℝ) : 0 ≤ slitFactor s ρ := by + have hm : s ≤ max ρ s := le_max_right _ _ + have hp : 0 < max ρ s := lt_of_lt_of_le h0 hm + have : s / max ρ s ≤ 1 := (div_le_one hp).mpr hm + exact div_nonneg (by linarith) (by linarith) + +theorem slitFactor_le_one (h0 : 0 < s) (h1 : s < 1) {ρ : ℝ} (hρ : ρ ≤ 1) : slitFactor s ρ ≤ 1 := by + have hm : s ≤ max ρ s := le_max_right _ _ + have hp : 0 < max ρ s := lt_of_lt_of_le h0 hm + have hm1 : max ρ s ≤ 1 := max_le hρ h1.le + have : s ≤ s / max ρ s := by + rw [le_div_iff₀ hp] + nlinarith + rw [slitFactor, div_le_one (by linarith)] + linarith + +theorem slitFactor_one (h1 : s < 1) : slitFactor s 1 = 1 := by + have : (1 - s) ≠ 0 := by linarith + rw [slitFactor, max_eq_left h1.le, div_one, div_self this] + +theorem slitFactor_of_le (_h1 : s < 1) {ρ : ℝ} (h : ρ ≤ s) (h0 : 0 < s) : slitFactor s ρ = 0 := by + rw [slitFactor, max_eq_right h, div_self h0.ne'] + simp + +theorem slitFactor_pos (h0 : 0 < s) (h1 : s < 1) {ρ : ℝ} (h : s < ρ) : 0 < slitFactor s ρ := by + have hp : 0 < ρ := h0.trans h + rw [slitFactor, max_eq_left h.le] + have : s / ρ < 1 := (div_lt_one hp).mpr h + exact div_pos (by linarith) (by linarith) + +theorem slitFactor_mono (h0 : 0 < s) (h1 : s < 1) {ρ ρ' : ℝ} (h : ρ ≤ ρ') : slitFactor s ρ + ≤ slitFactor s ρ' := by + have hm : max ρ s ≤ max ρ' s := max_le_max_right _ h + have hp : 0 < max ρ s := lt_of_lt_of_le h0 (le_max_right _ _) + have : s / max ρ' s ≤ s / max ρ s := div_le_div_of_nonneg_left h0.le hp hm + exact div_le_div_of_nonneg_right (by linarith) (by linarith) + +theorem continuous_slitFactor (h0 : 0 < s) : Continuous (slitFactor s) := by + have hne : ∀ ρ : ℝ, max ρ s ≠ 0 := fun ρ => (lt_of_lt_of_le h0 (le_max_right _ _)).ne' + unfold slitFactor + exact ((continuous_const.sub (continuous_const.div (continuous_id.max continuous_const) + hne))).div_const _ + +theorem continuous_slitMap (h0 : 0 < s) : Continuous (slitMap s) := by + have h : Continuous fun z : ℂ => z.im * slitFactor s ‖z‖ := + continuous_im.mul ((continuous_slitFactor h0).comp continuous_norm) + have hre := Complex.continuous_re + have : slitMap s = fun z => (z.re : ℂ) + ((z.im * slitFactor s ‖z‖ : ℝ) : ℂ) * I := by + funext z + apply Complex.ext <;> simp [slitMap] + rw [this] + exact (continuous_ofReal.comp hre).add ((continuous_ofReal.comp h).mul continuous_const) + +theorem slitMap_re (z : ℂ) : (slitMap s z).re = z.re := rfl + +theorem slitMap_im (z : ℂ) : (slitMap s z).im = z.im * slitFactor s ‖z‖ := rfl + +theorem slitMap_of_norm_eq_one (h1 : s < 1) {z : ℂ} (hz : ‖z‖ = 1) : slitMap s z = z := by + apply Complex.ext + · rfl + · rw [slitMap_im, hz, slitFactor_one h1, mul_one] + +theorem slitMap_of_norm_le (h0 : 0 < s) (h1 : s < 1) {z : ℂ} (hz : ‖z‖ ≤ s) : slitMap s z = + (z.re : ℂ) := by + apply Complex.ext + · simp [slitMap_re] + · rw [slitMap_im, slitFactor_of_le h1 hz h0] + simp + +theorem norm_of_re_im (x y : ℝ) : ‖(⟨x, y⟩ : ℂ)‖ = Real.sqrt (x ^ 2 + y ^ 2) := by + rw [Complex.norm_eq_sqrt_sq_add_sq] + +theorem norm_slitMap_le (h0 : 0 < s) (h1 : s < 1) {z : ℂ} (hz : ‖z‖ ≤ 1) : ‖slitMap s z‖ ≤ 1 := by + have hf := slitFactor_nonneg h0 h1 ‖z‖ + have hf1 := slitFactor_le_one h0 h1 hz + have : ‖slitMap s z‖ ≤ ‖z‖ := by + rw [Complex.norm_eq_sqrt_sq_add_sq, Complex.norm_eq_sqrt_sq_add_sq] + apply Real.sqrt_le_sqrt + rw [slitMap_re, slitMap_im] + have : (z.im * slitFactor s ‖z‖) ^ 2 ≤ z.im ^ 2 := by + rw [mul_pow] + have : slitFactor s ‖z‖ ^ 2 ≤ 1 := by nlinarith + nlinarith [sq_nonneg z.im] + linarith + linarith + +/-- On a vertical line and above the circle of radius `s`, the map is strictly increasing. -/ +theorem slit_strict (h0 : 0 < s) (h1 : s < 1) {x y y' : ℝ} (hy : 0 ≤ y) (hyy : y < y') + (hs : s ≤ ‖(⟨x, y⟩ : ℂ)‖) : y * slitFactor s ‖(⟨x, y⟩ : ℂ)‖ < y' * slitFactor s ‖(⟨x, y'⟩ : ℂ)‖ + := by + have hn : ‖(⟨x, y⟩ : ℂ)‖ < ‖(⟨x, y'⟩ : ℂ)‖ := by + rw [norm_of_re_im, norm_of_re_im] + apply Real.sqrt_lt_sqrt (by positivity) + nlinarith + have hp := slitFactor_pos h0 h1 (lt_of_le_of_lt hs hn) + have hm := slitFactor_mono h0 h1 hn.le + have hf := slitFactor_nonneg h0 h1 ‖(⟨x, y⟩ : ℂ)‖ + nlinarith + +/-- A point and its mirror image have the same norm. -/ +theorem norm_neg_im (x y : ℝ) : ‖(⟨x, -y⟩ : ℂ)‖ = ‖(⟨x, y⟩ : ℂ)‖ := by + rw [norm_of_re_im, norm_of_re_im, neg_sq] + +/-- Two points off the open ball of radius `s` with the same image are equal, or are mirror images +on the circle. -/ +theorem slitMap_eq (h0 : 0 < s) (h1 : s < 1) {z w : ℂ} (hz : s ≤ ‖z‖) (hw : s ≤ ‖w‖) + (he : slitMap s z = slitMap s w) : z = w ∨ (‖z‖ = s ∧ ‖w‖ = s ∧ w = (starRingEnd ℂ) z) := by + have hre : z.re = w.re := by simpa only [slitMap_re] using congrArg Complex.re he + have him : z.im * slitFactor s ‖z‖ = w.im * slitFactor s ‖w‖ := by + simpa only [slitMap_im] using congrArg Complex.im he + obtain ⟨x, y⟩ := z + obtain ⟨x', y'⟩ := w + simp only at hre him + subst hre + -- Same sign: the map is strictly monotone. Opposite signs: both values vanish. + have key : ∀ {a b : ℝ}, 0 ≤ a → a < b → s ≤ ‖(⟨x, a⟩ : ℂ)‖ → + a * slitFactor s ‖(⟨x, a⟩ : ℂ)‖ ≠ b * slitFactor s ‖(⟨x, b⟩ : ℂ)‖ := fun ha hab hs => + (slit_strict h0 h1 ha hab hs).ne + have hconj : (starRingEnd ℂ) (⟨x, y⟩ : ℂ) = ⟨x, -y⟩ := rfl + rcases lt_trichotomy y y' with hlt | rfl | hlt + · rcases le_or_gt 0 y with hy | hy + · exact (key hy hlt hz him).elim + · rcases le_or_gt y' 0 with hy' | hy' + · have hz' : s ≤ ‖(⟨x, -y'⟩ : ℂ)‖ := by rwa [norm_neg_im] + have := key (a := -y') (b := -y) (by linarith) (by linarith) hz' + rw [norm_neg_im, norm_neg_im] at this + exact (this (by linarith)).elim + · have hf := slitFactor_nonneg h0 h1 ‖(⟨x, y⟩ : ℂ)‖ + have hf' := slitFactor_nonneg h0 h1 ‖(⟨x, y'⟩ : ℂ)‖ + have h3 : y * slitFactor s ‖(⟨x, y⟩ : ℂ)‖ = 0 := by nlinarith + have h4 : y' * slitFactor s ‖(⟨x, y'⟩ : ℂ)‖ = 0 := by nlinarith + have h5 : slitFactor s ‖(⟨x, y⟩ : ℂ)‖ = 0 := (mul_eq_zero.mp h3).resolve_left hy.ne + have h6 : slitFactor s ‖(⟨x, y'⟩ : ℂ)‖ = 0 := (mul_eq_zero.mp h4).resolve_left hy'.ne' + have h7 : ‖(⟨x, y⟩ : ℂ)‖ = s := le_antisymm (not_lt.mp fun h => + (slitFactor_pos h0 h1 h).ne' h5) hz + have h8 : ‖(⟨x, y'⟩ : ℂ)‖ = s := le_antisymm (not_lt.mp fun h => + (slitFactor_pos h0 h1 h).ne' h6) hw + have h9 : y' ^ 2 = y ^ 2 := by + have h10 := congrArg (· ^ 2) (h7.trans h8.symm) + simp only [norm_of_re_im] at h10 + rw [Real.sq_sqrt (by positivity), Real.sq_sqrt (by positivity)] at h10 + linarith + have h11 : y' = -y := by nlinarith + exact .inr ⟨h7, h8, by rw [hconj, h11]⟩ + · exact .inl rfl + · rcases le_or_gt 0 y' with hy | hy + · exact (key hy hlt hw him.symm).elim + · rcases le_or_gt y 0 with hy' | hy' + · have hz' : s ≤ ‖(⟨x, -y⟩ : ℂ)‖ := by rwa [norm_neg_im] + have := key (a := -y) (b := -y') (by linarith) (by linarith) hz' + rw [norm_neg_im, norm_neg_im] at this + exact (this (by linarith)).elim + · have hf := slitFactor_nonneg h0 h1 ‖(⟨x, y⟩ : ℂ)‖ + have hf' := slitFactor_nonneg h0 h1 ‖(⟨x, y'⟩ : ℂ)‖ + have h3 : y' * slitFactor s ‖(⟨x, y'⟩ : ℂ)‖ = 0 := by nlinarith + have h4 : y * slitFactor s ‖(⟨x, y⟩ : ℂ)‖ = 0 := by nlinarith + have h5 : slitFactor s ‖(⟨x, y'⟩ : ℂ)‖ = 0 := (mul_eq_zero.mp h3).resolve_left hy.ne + have h6 : slitFactor s ‖(⟨x, y⟩ : ℂ)‖ = 0 := (mul_eq_zero.mp h4).resolve_left hy'.ne' + have h7 : ‖(⟨x, y'⟩ : ℂ)‖ = s := le_antisymm (not_lt.mp fun h => + (slitFactor_pos h0 h1 h).ne' h5) hw + have h8 : ‖(⟨x, y⟩ : ℂ)‖ = s := le_antisymm (not_lt.mp fun h => + (slitFactor_pos h0 h1 h).ne' h6) hz + have h9 : y' ^ 2 = y ^ 2 := by + have h10 := congrArg (· ^ 2) (h7.trans h8.symm) + simp only [norm_of_re_im] at h10 + rw [Real.sq_sqrt (by positivity), Real.sq_sqrt (by positivity)] at h10 + linarith + have h11 : y' = -y := by nlinarith + exact .inr ⟨h8, h7, by rw [hconj, h11]⟩ + +/-- Over a real point of norm less than `s`, the two points of the circle. Over any other point of +the ball there is a +point off the open ball of radius `s`, by the intermediate value theorem on the vertical line +through it. -/ +theorem exists_slitMap_eq (h0 : 0 < s) (h1 : s < 1) {w : ℂ} (hw : ‖w‖ ≤ 1) : + ∃ z : ℂ, s ≤ ‖z‖ ∧ ‖z‖ ≤ 1 ∧ slitMap s z = w := by + -- It is enough to treat `0 ≤ w.im`, by the mirror image. + have hmirror : ∀ z : ℂ, slitMap s ((starRingEnd ℂ) z) = (starRingEnd ℂ) (slitMap s z) := fun z + => by + apply Complex.ext + · simp [slitMap_re] + · simp [slitMap_im] + suffices key : ∀ w : ℂ, ‖w‖ ≤ 1 → 0 ≤ w.im → ∃ z : ℂ, s ≤ ‖z‖ ∧ ‖z‖ ≤ 1 ∧ slitMap s z = w by + rcases le_total 0 w.im with h | h + · exact key w hw h + · have hconj : ‖(starRingEnd ℂ) w‖ ≤ 1 := by simpa only [Complex.norm_conj] using hw + obtain ⟨z, h2, h3, h4⟩ := key ((starRingEnd ℂ) w) hconj (by simpa using h) + refine ⟨(starRingEnd ℂ) z, by rwa [Complex.norm_conj], by rwa [Complex.norm_conj], ?_⟩ + rw [hmirror, h4] + simp + intro w hw him + set x := w.re with hx + set η := w.im with hη + have hsq : x ^ 2 + η ^ 2 ≤ 1 := by + have : ‖w‖ ^ 2 ≤ 1 := by nlinarith [norm_nonneg w] + rw [Complex.sq_norm, Complex.normSq_apply] at this + nlinarith + -- The lower end of the vertical segment: on the circle of radius `s`, or on the real axis. + set y₀ := Real.sqrt (max (s ^ 2 - x ^ 2) 0) with hy₀ + set y₁ := Real.sqrt (1 - x ^ 2) with hy₁ + have hx1 : 0 ≤ 1 - x ^ 2 := by nlinarith [sq_nonneg η] + have hy₀nn : 0 ≤ y₀ := Real.sqrt_nonneg _ + have hy₀sq : y₀ ^ 2 = max (s ^ 2 - x ^ 2) 0 := Real.sq_sqrt (le_max_right _ _) + have hy₁sq : y₁ ^ 2 = 1 - x ^ 2 := Real.sq_sqrt hx1 + have hy₁nn : 0 ≤ y₁ := Real.sqrt_nonneg _ + have hs2 : s ^ 2 < 1 := by nlinarith + have hy₀₁ : y₀ ≤ y₁ := by + apply Real.sqrt_le_sqrt + exact max_le (by linarith) hx1 + have hηy₁ : η ≤ y₁ := by + apply Real.le_sqrt_of_sq_le + linarith + let f : ℝ → ℝ := fun y => y * slitFactor s ‖(⟨x, y⟩ : ℂ)‖ + have hfc : Continuous f := by + have h2 : Continuous fun y : ℝ => (⟨x, y⟩ : ℂ) := by + have : (fun y : ℝ => (⟨x, y⟩ : ℂ)) = fun y : ℝ => (x : ℂ) + (y : ℂ) * I := by + funext y + apply Complex.ext <;> simp + rw [this] + exact continuous_const.add (continuous_ofReal.mul continuous_const) + exact continuous_id.mul ((continuous_slitFactor h0).comp (continuous_norm.comp h2)) + have hn₀ : ‖(⟨x, y₀⟩ : ℂ)‖ ≤ s ∨ y₀ = 0 := by + rcases le_total (s ^ 2 - x ^ 2) 0 with h | h + · right + rw [hy₀, max_eq_right h, Real.sqrt_zero] + · left + rw [norm_of_re_im] + rw [max_eq_left h] at hy₀sq + rw [hy₀sq] + refine Real.sqrt_le_iff.mpr ⟨h0.le, by linarith⟩ + have hf0 : f y₀ = 0 := by + rcases hn₀ with h | h + · change y₀ * slitFactor s _ = 0 + rw [slitFactor_of_le h1 h h0, mul_zero] + · change y₀ * _ = 0 + rw [h, zero_mul] + have hn₁ : ‖(⟨x, y₁⟩ : ℂ)‖ = 1 := by + rw [norm_of_re_im, hy₁sq] + simp + have hf1 : f y₁ = y₁ := by + change y₁ * slitFactor s _ = _ + rw [hn₁, slitFactor_one h1, mul_one] + obtain ⟨y, hy, hfy⟩ := intermediate_value_Icc hy₀₁ hfc.continuousOn (show η ∈ Icc (f y₀) (f y₁) by + rw [hf0, hf1] + exact ⟨him, hηy₁⟩) + have hy0 : 0 ≤ y := hy₀nn.trans hy.1 + have hsq₀ : s ≤ ‖(⟨x, y⟩ : ℂ)‖ := by + rw [norm_of_re_im] + apply Real.le_sqrt_of_sq_le + have h2 : y₀ ^ 2 ≤ y ^ 2 := by nlinarith [hy.1] + have h3 : s ^ 2 - x ^ 2 ≤ y₀ ^ 2 := by + rw [hy₀sq] + exact le_max_left _ _ + linarith + have hle1 : ‖(⟨x, y⟩ : ℂ)‖ ≤ 1 := by + rw [norm_of_re_im] + refine Real.sqrt_le_iff.mpr ⟨zero_le_one, ?_⟩ + have h2 : y ^ 2 ≤ y₁ ^ 2 := by nlinarith [hy.2] + rw [hy₁sq] at h2 + linarith + refine ⟨⟨x, y⟩, hsq₀, hle1, ?_⟩ + apply Complex.ext + · rfl + · exact hfy + +/-- Off the closed ball of radius `s`, the image is not on the segment. -/ +theorem slitMap_notMem_segment (h0 : 0 < s) (h1 : s < 1) {z : ℂ} (hz : s < ‖z‖) (him : + (slitMap s z).im = 0) : + s < |z.re| := by + rw [slitMap_im] at him + have h2 : z.im = 0 := (mul_eq_zero.mp him).resolve_right (slitFactor_pos h0 h1 hz).ne' + have h3 : ‖z‖ = |z.re| := by + rw [Complex.norm_eq_sqrt_sq_add_sq, h2] + simp [Real.sqrt_sq_eq_abs] + linarith + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/SplitForest.lean b/LeanPool/GraphMinor/GM07/SplitForest.lean new file mode 100644 index 0000000000..506acf4d83 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/SplitForest.lean @@ -0,0 +1,643 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Matched +public import LeanPool.GraphMinor.GM11.EdgeSides +public import LeanPool.GraphMinor.GM07.DiscPlace +import LeanPool.GraphMinor.GM06.Section3Dual + +/-! +# Removing the middle of each edge + +For step 2 of (9.1), page 243: "Let $H' = (U(H) - Y, V(H) \cup Z)$ ... Then $H'$ is a forest in +$\Sigma$, and its components are in a natural correspondence with +$V(H)$." Here we remove from each edge `f` of a graph `H` the middle part of `f`. Each edge of the +new drawing joins a vertex of `H` to one of the new +vertices, and each new vertex has just one edge. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Function GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A graph in which each edge has one end in `P`, and each vertex in `P` has one edge, is a forest. +-/ +theorem isGraphForest_of_leaves {α β : Type*} (G : Graph α β) (P : Set α) + (h1 : ∀ {e x y}, G.IsLink e x y → (x ∈ P ∧ y ∉ P) ∨ (x ∉ P ∧ y ∈ P)) + (h2 : ∀ x ∈ P, ∀ {e f y z}, G.IsLink e x y → G.IsLink f x z → e = f) : IsGraphForest G := by + -- The end of a walk with distinct ends lies on one of its edges. + have hlast : ∀ {a b : α} (W : GraphWalk G a b), a ≠ b → ∃ e ∈ W.edges, ∃ y, G.IsLink e b y := by + intro a b W + induction W with + | nil _ => exact fun h => absurd rfl h + | @cons a' b' c' e hl rest ih => + intro _ + by_cases hbc : b' = c' + · subst hbc + exact ⟨e, by simp [GraphWalk.edges], a', hl.symm⟩ + · obtain ⟨e', he', y, hy⟩ := ih hbc + exact ⟨e', by simp [GraphWalk.edges, he'], y, hy⟩ + intro u W hW + cases W with + | nil hv => rfl + | @cons _ b _ e hl rest => + exfalso + have hnodup : (GraphWalk.edges (.cons hl rest)).Nodup := hW.2 + have he : e ∉ rest.edges := by + simp only [GraphWalk.edges, List.nodup_cons] at hnodup + exact hnodup.1 + rcases h1 hl with ⟨hu, hb⟩ | ⟨hu, hb⟩ + · have hne : b ≠ u := fun h => hb (h ▸ hu) + obtain ⟨e', he', y, hy⟩ := hlast rest hne + rw [h2 u hu hl hy] at he + exact he he' + · cases rest with + | nil _ => exact hu hb + | @cons _ c _ e₂ hl₂ rest₂ => + have := h2 b hb hl.symm hl₂ + apply he + rw [this] + simp [GraphWalk.edges] + +/-- `γ` runs along the edge `f` of `H`, from one end to the other. -/ +structure EdgeParam (H : Drawing S) (f : Set S) (γ : I → S) : Prop where + cont : Continuous γ + mem0 : γ 0 ∈ H.V + mem1 : γ 1 ∈ H.V + inj : InjOn γ (Ioo 0 1) + img : γ '' Ioo 0 1 = f + +/-- The same edge, the other way. -/ +theorem EdgeParam.rev {H : Drawing S} {f : Set S} {γ : I → S} (h : EdgeParam H f γ) : EdgeParam H f + (γ ∘ σ) where + cont := h.cont.comp continuous_symm + mem0 := by simpa using h.mem1 + mem1 := by simpa using h.mem0 + inj := by + intro x hx y hy he + have hm : ∀ {z : I}, z ∈ Ioo (0 : I) 1 → σ z ∈ Ioo (0 : I) 1 := fun {z} hz => by + constructor + · rw [← unitInterval.symm_one, unitInterval.symm_lt_symm] + exact hz.2 + · rw [← unitInterval.symm_zero, unitInterval.symm_lt_symm] + exact hz.1 + simpa using h.inj (hm hx) (hm hy) he + img := by + rw [← h.img, image_comp] + congr 1 + ext z + constructor + · rintro ⟨y, hy, rfl⟩ + constructor + · rw [← unitInterval.symm_one, unitInterval.symm_lt_symm] + exact hy.2 + · rw [← unitInterval.symm_zero, unitInterval.symm_lt_symm] + exact hy.1 + · intro hz + refine ⟨σ z, ⟨?_, ?_⟩, by simp⟩ + · rw [← unitInterval.symm_one, unitInterval.symm_lt_symm] + exact hz.2 + · rw [← unitInterval.symm_zero, unitInterval.symm_lt_symm] + exact hz.1 + +variable {H : Drawing S} {f : Set S} {γ : I → S} + +theorem EdgeParam.mem_edge (h : EdgeParam H f γ) {y : I} (h0 : 0 < y) (h1 : y < 1) : γ y ∈ f := + h.img ▸ mem_image_of_mem γ ⟨h0, h1⟩ + +theorem EdgeParam.not_V (h : EdgeParam H f γ) (hf : f ∈ H.E) {y : I} (h0 : 0 < y) + (h1 : y < 1) : γ y ∉ H.V := + (hf.2.1 (h.mem_edge h0 h1)).2 + +theorem EdgeParam.pos_of_ne (h : EdgeParam H f γ) {y : I} (hy : γ y ∉ H.V) : 0 < y + ∧ y < 1 := by + constructor + · rw [unitInterval.pos_iff_ne_zero] + rintro rfl + exact hy h.mem0 + · rw [unitInterval.lt_one_iff_ne_one] + rintro rfl + exact hy h.mem1 + +theorem EdgeParam.injOn_Ico (h : EdgeParam H f γ) (hf : f ∈ H.E) {τ : I} (hτ : τ < 1) : InjOn γ + (Icc 0 τ) := by + have hcase : ∀ {y : I}, y ∈ Icc 0 τ → y ≠ 0 → y ∈ Ioo (0 : I) 1 := fun {y} hy h0 => + ⟨unitInterval.pos_iff_ne_zero.mpr h0, hy.2.trans_lt hτ⟩ + intro x hx y hy he + by_cases hx0 : x = 0 + · by_cases hy0 : y = 0 + · rw [hx0, hy0] + · have := hcase hy hy0 + rw [hx0] at he + exact absurd h.mem0 (he ▸ h.not_V hf this.1 this.2) + · by_cases hy0 : y = 0 + · have := hcase hx hx0 + rw [hy0] at he + exact absurd h.mem0 (he.symm ▸ h.not_V hf this.1 this.2) + · exact h.inj (hcase hx hx0) (hcase hy hy0) he + +theorem EdgeParam.line [T2Space S] (h : EdgeParam H f γ) (hf : f ∈ H.E) {τ : I} (h0 : 0 < τ) + (h1 : τ < 1) : + IsLineWithEnds (γ '' Icc 0 τ) (γ 0) (γ τ) := by + have ha : IsArcMap (subArc γ 0 τ) := by + refine ⟨h.cont.comp (continuous_lerpI _ _), ?_⟩ + intro x y he + have hm : ∀ z, lerpI 0 τ z ∈ Icc 0 τ := fun z => by + rw [← range_lerpI h0.le] + exact mem_range_self z + exact lerpI_injective h0.ne (h.injOn_Ico hf h1 (hm x) (hm y) he) + have := isLineWithEnds_range_of_arc ha + rwa [range_subArc _ h0.le, subArc_zero, subArc_one] at this + +theorem EdgeParam.isPathConnected_Ioo (h : EdgeParam H f γ) {τ : I} (h0 : 0 < τ) : IsPathConnected + (γ '' Ioo 0 τ) := by + have hc : Continuous fun x : ℝ => γ (projIcc 0 1 zero_le_one x) := h.cont.comp continuous_projIcc + have hconv : IsPathConnected (Ioo (0 : ℝ) τ.1) := (convex_Ioo _ _).isPathConnected + (nonempty_Ioo.mpr h0) + have himg := hconv.image hc + convert himg using 1 + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + refine ⟨y.1, ⟨hy.1, hy.2⟩, ?_⟩ + change γ (projIcc 0 1 zero_le_one y.1) = _ + rw [projIcc_val] + · rintro ⟨y, hy, rfl⟩ + have hmem : y ∈ Icc (0 : ℝ) 1 := ⟨hy.1.le, hy.2.le.trans τ.2.2⟩ + refine ⟨⟨y, hmem⟩, ⟨hy.1, hy.2⟩, ?_⟩ + change _ = γ (projIcc 0 1 zero_le_one y) + rw [projIcc_of_mem zero_le_one hmem] + +theorem EdgeParam.closure_Ioo [T2Space S] (h : EdgeParam H f γ) {τ : I} (h0 : 0 < τ) : closure + (γ '' Ioo 0 τ) = γ '' Icc 0 τ := by + apply Subset.antisymm + · exact closure_minimal (image_mono Ioo_subset_Icc_self) (isCompact_Icc.image h.cont).isClosed + · rw [← _root_.closure_Ioo h0.ne] + exact image_closure_subset_closure_image h.cont + +/-- The set `γ((0, τ))` is open in `U(H) - V(H)` and its subsets. -/ +theorem EdgeParam.sep [T2Space S] (h : EdgeParam H f γ) (hf : f ∈ H.E) {τ : I} (h1 : τ < 1) : + ∃ O, IsOpen O ∧ ∀ x ∈ H.U \ H.V, x ∈ O ↔ x ∈ γ '' Ioo 0 τ := by + refine ⟨(H.U \ f)ᶜ ∩ (γ '' Icc τ 1)ᶜ, (isClosed_U_sdiff_edge H hf).isOpen_compl.inter + (isCompact_Icc.image h.cont).isClosed.isOpen_compl, fun x hx => ?_⟩ + constructor + · rintro ⟨h2, h3⟩ + have hxf : x ∈ f := by + by_contra hn + exact h2 ⟨hx.1, hn⟩ + rw [← h.img] at hxf + obtain ⟨y, hy, rfl⟩ := hxf + refine ⟨y, ⟨hy.1, ?_⟩, rfl⟩ + by_contra hn + exact h3 ⟨y, ⟨not_lt.mp hn, hy.2.le⟩, rfl⟩ + · rintro ⟨y, hy, rfl⟩ + have hy1 : y < 1 := hy.2.trans h1 + refine ⟨fun h2 => h2.2 (h.mem_edge hy.1 hy1), ?_⟩ + rintro ⟨y', hy', he⟩ + by_cases hy'1 : y' = 1 + · rw [hy'1] at he + exact h.not_V hf hy.1 hy1 (he ▸ h.mem1) + · have hlt : y' < 1 := unitInterval.lt_one_iff_ne_one.mpr hy'1 + have := h.inj ⟨hy.1.trans_le (hy.2.le.trans hy'.1), hlt⟩ ⟨hy.1, hy1⟩ he + exact absurd (this ▸ hy'.1) (not_le.mpr hy.2) + +/-- The arc components of a union of pieces, each open in the union. -/ +theorem arcComponentsIn_eq_pieces {F : Set S} {𝓟 : Set (Set S)} (hcov : ⋃₀ 𝓟 = F) + (hpc : ∀ P ∈ 𝓟, IsPathConnected P) + (hsep : ∀ P ∈ 𝓟, ∃ O, IsOpen O ∧ ∀ x ∈ F, x ∈ O ↔ x ∈ P) (hdisj : ∀ P ∈ 𝓟, ∀ Q ∈ 𝓟, P ≠ Q + → Disjoint P Q) : arcComponentsIn F = 𝓟 := by + have hsub : ∀ P ∈ 𝓟, P ⊆ F := fun P hP => hcov ▸ subset_sUnion_of_mem hP + have key : ∀ {D P : Set S}, D ⊆ F → IsPreconnected D → P ∈ 𝓟 → (D ∩ P).Nonempty → D ⊆ P := by + intro D P hD hc hP hne + choose! O hO hOF using hsep + let O' : Set S := ⋃ Q ∈ 𝓟 \ {P}, O Q + have hO' : IsOpen O' := isOpen_biUnion fun Q hQ => hO Q hQ.1 + have hcover : D ⊆ O P ∪ O' := fun x hx => by + have hxF := hD hx + rw [← hcov] at hxF + obtain ⟨Q, hQ, hxQ⟩ := hxF + by_cases hQP : Q = P + · exact .inl ((hOF P hP x (hD hx)).mpr (hQP ▸ hxQ)) + · exact .inr (mem_iUnion₂.mpr ⟨Q, ⟨hQ, hQP⟩, (hOF Q hQ x (hD hx)).mpr hxQ⟩) + have hempty : D ∩ (O P ∩ O') = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro x ⟨hxD, hx1, hx2⟩ + obtain ⟨Q, hQ, hx3⟩ := mem_iUnion₂.mp hx2 + have h4 := (hOF P hP x (hD hxD)).mp hx1 + have h5 := (hOF Q hQ.1 x (hD hxD)).mp hx3 + exact disjoint_left.mp (hdisj P hP Q hQ.1 (Ne.symm hQ.2)) h4 h5 + have h1 : D ⊆ O P := by + rcases isPreconnected_iff_subset_of_disjoint.mp hc _ _ (hO P hP) hO' hcover hempty with h1 | + h1 + · exact h1 + · obtain ⟨x, hxD, hxP⟩ := hne + have h2 : x ∈ D ∩ (O P ∩ O') := ⟨hxD, (hOF P hP x (hD hxD)).mpr hxP, h1 hxD⟩ + rw [hempty] at h2 + exact h2.elim + exact fun x hx => (hOF P hP x (hD hx)).mp (h1 hx) + ext P + constructor + · rintro ⟨hne, hPF, hpcP, hmax⟩ + obtain ⟨x, hx⟩ := hne + have hxF := hPF hx + rw [← hcov] at hxF + obtain ⟨Q, hQ, hxQ⟩ := hxF + have hPQ : P ⊆ Q := key hPF hpcP.isConnected.isPreconnected hQ ⟨x, hx, hxQ⟩ + rw [hmax Q (hsub Q hQ) (hpc Q hQ) hPQ] at hQ + exact hQ + · intro hP + refine ⟨(hpc P hP).nonempty, hsub P hP, hpc P hP, fun D hD hpcD hPD => ?_⟩ + obtain ⟨x, hx⟩ := (hpc P hP).nonempty + exact (key hD hpcD.isConnected.isPreconnected hP ⟨x, hPD hx, hx⟩).antisymm hPD + +/-- Each edge `f` of `H` has two halves `(f, false)` and `(f, true)`. The half `q` runs along `β q` +from an end of `f` to the point `β q (τ q)`, which will +be a new vertex. -/ +structure IsSplit (H : Drawing S) (β : Set S × Bool → I → S) (τ : Set S × Bool → I) : Prop where + param : ∀ q : Set S × Bool, q.1 ∈ H.E → EdgeParam H q.1 (β q) + pos : ∀ q : Set S × Bool, q.1 ∈ H.E → 0 < τ q + lt : ∀ q : Set S × Bool, q.1 ∈ H.E → τ q < 1 + apart : ∀ f ∈ H.E, Disjoint (β (f, false) '' Ioc 0 (τ (f, false))) (β (f, true) '' Ioc 0 (τ + (f, true))) + +@[expose] public section + +/-- The halves of the edges of `H`. -/ +def halves (H : Drawing S) : Set (Set S × Bool) := {q | q.1 ∈ H.E} + +end + +theorem halves_finite (H : Drawing S) : (halves H).Finite := by + have : halves H = H.E ×ˢ univ := by + ext q + simp [halves] + rw [this] + exact H.finite_edges.prod finite_univ + +variable {β : Set S × Bool → I → S} {τ : Set S × Bool → I} + +/-- The part of a half that is not its first end. -/ +@[expose] def halfRest (β : Set S × Bool → I → S) (τ : Set S × Bool → I) (q : Set S × Bool) : Set S + := β q '' Ioc 0 (τ q) + +theorem IsSplit.halfRest_subset (h : IsSplit H β τ) {q : Set S × Bool} + (hq : q ∈ halves H) : halfRest β τ q ⊆ q.1 := by + rintro _ ⟨y, hy, rfl⟩ + exact (h.param q hq).mem_edge hy.1 (hy.2.trans_lt (h.lt q hq)) + +theorem IsSplit.disjoint_rest (h : IsSplit H β τ) {q q' : Set S × Bool} (hq : q ∈ halves H) + (hq' : q' ∈ halves H) (hne : q ≠ q') : + Disjoint (halfRest β τ q) (halfRest β τ q') := by + obtain ⟨f, b⟩ := q + obtain ⟨f', b'⟩ := q' + by_cases hf : f = f' + · subst hf + have hb : b ≠ b' := fun he => hne (by rw [he]) + have := h.apart f hq + cases b <;> cases b' + · exact absurd rfl hb + · exact this + · exact this.symm + · exact absurd rfl hb + · exact (GraphMinor.GM06.disjoint_edges_of_ne H hq hq' hf).mono (h.halfRest_subset hq) + (h.halfRest_subset hq') + +theorem IsSplit.mark_mem (h : IsSplit H β τ) {q : Set S × Bool} (hq : q ∈ halves H) : β q + (τ q) ∈ halfRest β τ q := + ⟨τ q, ⟨h.pos q hq, le_rfl⟩, rfl⟩ + +theorem IsSplit.mark_not_V (h : IsSplit H β τ) {q : Set S × Bool} (hq : q ∈ halves H) : β q + (τ q) ∉ H.V := + (h.param q hq).not_V hq (h.pos q hq) (h.lt q hq) + +theorem IsSplit.mark_inj (h : IsSplit H β τ) {q q' : Set S × Bool} (hq : q ∈ halves H) + (hq' : q' ∈ halves H) (he : β q (τ q) = β q' (τ q')) : q = q' := by + by_contra hne + exact disjoint_left.mp (h.disjoint_rest hq hq' hne) (h.mark_mem hq) (he ▸ h.mark_mem hq') + +omit [TopologicalSpace S] in +/-- A point of a closed half is its first end, or lies in the rest of the half. -/ +theorem mem_closed_half {q : Set S × Bool} {x : S} (hx : x ∈ β q '' Icc 0 + (τ q)) : x = β q 0 ∨ x ∈ halfRest β τ q := by + obtain ⟨y, hy, rfl⟩ := hx + by_cases h0 : y = 0 + · exact .inl (by rw [h0]) + · exact .inr ⟨y, ⟨unitInterval.pos_iff_ne_zero.mpr h0, hy.2⟩, rfl⟩ + +theorem IsSplit.piece_cases (h : IsSplit H β τ) {x : S} (hx : x ∈ + (H.V ∪ ⋃ q ∈ halves H, β q '' Icc 0 (τ q)) \ (H.V ∪ (fun q => β q (τ q)) '' halves H)) : + ∃ q ∈ halves H, x ∈ β q '' Ioo 0 (τ q) := by + obtain ⟨h1 | h1, h2⟩ := hx + · exact absurd (.inl h1) h2 + · obtain ⟨q, hq, y, hy, rfl⟩ := mem_iUnion₂.mp h1 + refine ⟨q, hq, y, ⟨?_, ?_⟩, rfl⟩ + · rw [unitInterval.pos_iff_ne_zero] + rintro rfl + exact h2 (.inl (h.param q hq).mem0) + · refine lt_of_le_of_ne hy.2 ?_ + rintro rfl + exact h2 (.inr ⟨q, hq, rfl⟩) + +theorem IsSplit.piece_off (h : IsSplit H β τ) {q : Set S × Bool} (hq : q ∈ halves H) {x : S} + (hx : x ∈ β q '' Ioo 0 (τ q)) : x ∉ H.V ∪ (fun q => β q (τ q)) '' halves H := by + obtain ⟨y, hy, rfl⟩ := hx + have hτ := h.lt q hq + have hp := h.param q hq + rintro (h1 | ⟨q', hq', he⟩) + · exact hp.not_V hq hy.1 (hy.2.trans hτ) h1 + · have hmem : β q y ∈ halfRest β τ q := ⟨y, ⟨hy.1, hy.2.le⟩, rfl⟩ + have heq : q' = q := by + by_contra hne + have he' : β q' (τ q') = β q y := he + exact disjoint_left.mp (h.disjoint_rest hq' hq hne) (h.mark_mem hq') (by rw [he']; exact hmem) + subst heq + have := hp.inj ⟨h.pos q' hq', hτ⟩ ⟨hy.1, hy.2.trans hτ⟩ he + exact absurd (this ▸ hy.2) (lt_irrefl _) + +theorem IsSplit.arcComponents (h : IsSplit H β τ) [T2Space S] : + arcComponentsIn ((H.V ∪ ⋃ q ∈ halves H, β q '' Icc 0 (τ q)) \ (H.V ∪ (fun q => β q + (τ q)) '' halves H)) = (fun q => β q '' Ioo 0 (τ q)) '' halves H := by + refine arcComponentsIn_eq_pieces ?_ ?_ ?_ ?_ + · ext x + constructor + · rintro ⟨_, ⟨q, hq, rfl⟩, hx⟩ + obtain ⟨y, hy, he⟩ := id hx + exact ⟨.inr (mem_iUnion₂.mpr ⟨q, hq, y, ⟨hy.1.le, hy.2.le⟩, he⟩), h.piece_off hq hx⟩ + · intro hx + obtain ⟨q, hq, hxq⟩ := h.piece_cases hx + exact ⟨_, ⟨q, hq, rfl⟩, hxq⟩ + · rintro _ ⟨q, hq, rfl⟩ + exact (h.param q hq).isPathConnected_Ioo (h.pos q hq) + · rintro _ ⟨q, hq, rfl⟩ + obtain ⟨O, hO, hOx⟩ := (h.param q hq).sep hq (h.lt q hq) + refine ⟨O, hO, fun x hx => hOx x ?_⟩ + obtain ⟨q', hq', y, hy, rfl⟩ := h.piece_cases hx + exact hq'.2.1 ((h.param q' hq').mem_edge hy.1 (hy.2.trans (h.lt q' hq'))) + · rintro _ ⟨q, hq, rfl⟩ _ ⟨q', hq', rfl⟩ hne + have hqq : q ≠ q' := fun he => hne (by rw [he]) + exact (h.disjoint_rest hq hq' hqq).mono (image_mono Ioo_subset_Ioc_self) + (image_mono Ioo_subset_Ioc_self) + +theorem IsSplit.cap (h : IsSplit H β τ) {q : Set S × Bool} (hq : q ∈ halves H) : + β q '' Icc 0 (τ q) ∩ (H.V ∪ (fun q => β q (τ q)) '' halves H) = {β q 0, β q (τ q)} := by + ext x + constructor + · rintro ⟨h1, h2⟩ + rcases mem_closed_half h1 with rfl | h3 + · exact .inl rfl + · have hrest := h.halfRest_subset hq h3 + rcases h2 with h4 | ⟨q', hq', rfl⟩ + · exact absurd h4 (hq.2.1 hrest).2 + · have : q' = q := by + by_contra hne + exact disjoint_left.mp (h.disjoint_rest hq' hq hne) (h.mark_mem hq') h3 + subst this + exact .inr rfl + · rintro (rfl | rfl) + · exact ⟨⟨0, ⟨le_rfl, (h.pos q hq).le⟩, rfl⟩, Or.inl (h.param q hq).mem0⟩ + · exact ⟨⟨τ q, ⟨(h.pos q hq).le, le_rfl⟩, rfl⟩, Or.inr ⟨q, hq, rfl⟩⟩ + +/-- `H` with the middle of each edge removed. -/ +@[expose] def IsSplit.drawing [T2Space S] (h : IsSplit H β τ) : Drawing S where + U := H.V ∪ ⋃ q ∈ halves H, β q '' Icc 0 (τ q) + V := H.V ∪ (fun q => β q (τ q)) '' halves H + V_subset_U := by + refine union_subset subset_union_left ?_ + rintro _ ⟨q, hq, rfl⟩ + exact .inr (mem_iUnion₂.mpr ⟨q, hq, τ q, ⟨(h.pos q hq).le, le_rfl⟩, rfl⟩) + isClosed_U := H.finite_V.isClosed.union ((halves_finite H).isClosed_biUnion fun q hq => + (isCompact_Icc.image (h.param q hq).cont).isClosed) + finite_V := H.finite_V.union ((halves_finite H).image _) + finite_edges := by + rw [h.arcComponents] + exact (halves_finite H).image _ + edge_cond := by + rw [h.arcComponents] + rintro _ ⟨q, hq, rfl⟩ + have hp := h.param q hq + left + refine ⟨β q 0, β q (τ q), fun he => h.mark_not_V hq (he ▸ hp.mem0), ?_, ?_⟩ + · rw [hp.closure_Ioo (h.pos q hq), h.cap hq] + · rw [hp.closure_Ioo (h.pos q hq)] + exact hp.line hq (h.pos q hq) (h.lt q hq) + +variable [T2Space S] + +theorem IsSplit.drawing_E (h : IsSplit H β τ) : h.drawing.E = (fun q => β q '' Ioo 0 + (τ q)) '' halves H := h.arcComponents + +theorem IsSplit.drawing_U (h : IsSplit H β τ) : h.drawing.U = H.V ∪ ⋃ q ∈ halves H, β q '' Icc 0 + (τ q) := rfl + +theorem IsSplit.drawing_V (h : IsSplit H β τ) : h.drawing.V = H.V ∪ (fun q => β q + (τ q)) '' halves H := rfl + +/-- The links of the split drawing. -/ +theorem IsSplit.link (h : IsSplit H β τ) {e : Set S} {x y : S} (hl : h.drawing.toGraph.IsLink e x + y) : + ∃ q ∈ halves H, e = β q '' Ioo 0 (τ q) ∧ ((x = β q 0 ∧ y = β q (τ q)) ∨ (x = β q (τ q) ∧ y + = β q 0)) := by + obtain ⟨he, -, -, hcap⟩ := hl + rw [h.drawing_E] at he + obtain ⟨q, hq, rfl⟩ := he + refine ⟨q, hq, rfl, ?_⟩ + have hp := h.param q hq + have hcap' : closure (β q '' Ioo 0 (τ q)) ∩ h.drawing.V = {β q 0, β q (τ q)} := by + rw [hp.closure_Ioo (h.pos q hq), h.drawing_V, h.cap hq] + rw [hcap'] at hcap + have hne : β q 0 ≠ β q (τ q) := fun he => h.mark_not_V hq (he ▸ hp.mem0) + have hx : x ∈ ({β q 0, β q (τ q)} : Set S) := by rw [hcap]; simp + have hy : y ∈ ({β q 0, β q (τ q)} : Set S) := by rw [hcap]; simp + have h1 : β q 0 ∈ ({x, y} : Set S) := by rw [← hcap]; simp + have h2 : β q (τ q) ∈ ({x, y} : Set S) := by rw [← hcap]; simp + simp only [mem_insert_iff, mem_singleton_iff] at hx hy h1 h2 + grind + +theorem IsSplit.isGraphForest (h : IsSplit H β τ) : IsGraphForest h.drawing.toGraph := by + refine isGraphForest_of_leaves _ ((fun q => β q (τ q)) '' halves H) (fun {e x y} hl + => ?_) fun x hx {e f y z} hl hl' => ?_ + · obtain ⟨q, hq, -, hc⟩ := h.link hl + have hnot : β q 0 ∉ (fun q => β q (τ q)) '' halves H := by + rintro ⟨q', hq', he⟩ + have he' : β q' (τ q') = β q 0 := he + exact h.mark_not_V hq' (by rw [he']; exact (h.param q hq).mem0) + rcases hc with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact .inr ⟨hnot, q, hq, rfl⟩ + · exact .inl ⟨⟨q, hq, rfl⟩, hnot⟩ + · obtain ⟨q₀, hq₀, rfl⟩ := hx + have hown : ∀ {e y}, h.drawing.toGraph.IsLink e (β q₀ (τ q₀)) y → e = β q₀ '' Ioo 0 (τ q₀) + := fun {e y} hl => by + obtain ⟨q, hq, rfl, hc⟩ := h.link hl + have hm : β q₀ (τ q₀) = β q (τ q) := by + rcases hc with ⟨h1, -⟩ | ⟨h1, -⟩ + · exact absurd (by rw [h1]; exact (h.param q hq).mem0) (h.mark_not_V hq₀) + · exact h1 + rw [h.mark_inj hq₀ hq hm] + rw [hown hl, hown hl'] + +/-- The vertex of `H` that a vertex of the split drawing belongs to. -/ +@[expose] noncomputable def splitOwner (H : Drawing S) (β : Set S × Bool → I → S) (τ : Set S × Bool + → I) (x : S) : S := + open Classical in if h : ∃ q ∈ halves H, x = β q (τ q) then β h.choose 0 else x + +omit [T2Space S] in +theorem IsSplit.owner_mark (h : IsSplit H β τ) {q : Set S × Bool} (hq : q ∈ halves H) : splitOwner + H β τ (β q (τ q)) = β q 0 := by + classical + have hex : ∃ q' ∈ halves H, β q (τ q) = β q' (τ q') := ⟨q, hq, rfl⟩ + rw [splitOwner, dite_eq_left hex] + exact congrArg (fun r => β r 0) (h.mark_inj hq hex.choose_spec.1 hex.choose_spec.2).symm + +omit [T2Space S] in +theorem IsSplit.owner_V (h : IsSplit H β τ) {x : S} (hx : x ∈ H.V) : splitOwner H β τ x = x := by + classical + rw [splitOwner, dite_eq_right] + rintro ⟨q, hq, rfl⟩ + exact h.mark_not_V hq hx + +theorem IsSplit.owner_walk (h : IsSplit H β τ) {x y : S} (W : GraphWalk h.drawing.toGraph x y) : + splitOwner H β τ x = splitOwner H β τ y := by + induction W with + | nil _ => rfl + | cons hl _ ih => + rw [← ih] + obtain ⟨q, hq, -, hc⟩ := h.link hl + rcases hc with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rw [h.owner_mark hq, h.owner_V (h.param q hq).mem0] + · rw [h.owner_mark hq, h.owner_V (h.param q hq).mem0] + +theorem IsSplit.owner_mem (h : IsSplit H β τ) {x : S} (hx : x ∈ h.drawing.V) : splitOwner H β τ x ∈ + H.V := by + rcases hx with hx | ⟨q, hq, rfl⟩ + · rw [h.owner_V hx] + exact hx + · change splitOwner H β τ (β q (τ q)) ∈ _ + rw [h.owner_mark hq] + exact (h.param q hq).mem0 + +/-- The half `q` as an edge of the split drawing. -/ +theorem IsSplit.link_half (h : IsSplit H β τ) {q : Set S × Bool} (hq : q ∈ halves H) : + h.drawing.toGraph.IsLink (β q '' Ioo 0 (τ q)) (β q 0) (β q (τ q)) := by + have hp := h.param q hq + refine ⟨?_, .inl hp.mem0, .inr ⟨q, hq, rfl⟩, ?_⟩ + · rw [h.drawing_E] + exact ⟨q, hq, rfl⟩ + · rw [hp.closure_Ioo (h.pos q hq), h.drawing_V, h.cap hq] + +/-- Two vertices with one owner are joined by a path. -/ +theorem IsSplit.exists_simple_walk (h : IsSplit H β τ) {x y : S} (hx : x ∈ h.drawing.V) + (hy : y ∈ h.drawing.V) (he : splitOwner H β τ x = splitOwner H β τ y) + (hne : x ≠ y) : ∃ W : GraphWalk h.drawing.toGraph x y, W.IsSimple := by + have hmarkV : ∀ {q : Set S × Bool}, q ∈ halves H → β q 0 ≠ β q (τ q) := fun {q} hq he' + => h.mark_not_V hq (he' ▸ (h.param q hq).mem0) + have hV₀ : ∀ {q : Set S × Bool}, q ∈ halves H → β q 0 ∈ h.drawing.V := fun {q} hq => .inl + (h.param q hq).mem0 + rcases hx with hx | ⟨q, hq, rfl⟩ <;> rcases hy with hy | ⟨q', hq', rfl⟩ + · rw [h.owner_V hx, h.owner_V hy] at he + exact absurd he hne + · change splitOwner H β τ x = splitOwner H β τ (β q' (τ q')) at he + rw [h.owner_V hx, h.owner_mark hq'] at he + subst he + refine ⟨.cons (h.link_half hq') (.nil (.inr ⟨q', hq', rfl⟩)), ?_⟩ + simpa [GraphWalk.IsSimple, GraphWalk.support] using hmarkV hq' + · change splitOwner H β τ (β q (τ q)) = splitOwner H β τ y at he + rw [h.owner_V hy, h.owner_mark hq] at he + subst he + exact ⟨.cons (h.link_half hq).symm (.nil (hV₀ hq)), by simpa [GraphWalk.IsSimple, + GraphWalk.support] using (hmarkV hq).symm⟩ + · change splitOwner H β τ (β q (τ q)) = splitOwner H β τ (β q' (τ q')) at he + rw [h.owner_mark hq, h.owner_mark hq'] at he + have h1 : h.drawing.toGraph.IsLink (β q' '' Ioo 0 (τ q')) (β q 0) (β q' (τ q')) + := he ▸ h.link_half hq' + refine ⟨.cons (h.link_half hq).symm (.cons h1 (.nil (.inr ⟨q', hq', rfl⟩))), ?_⟩ + have h2 : β q 0 ≠ β q' (τ q') := he ▸ hmarkV hq' + simpa [GraphWalk.IsSimple, GraphWalk.support, hne, h2] using (hmarkV hq).symm + +/-- Three inner points of the unit interval. -/ +@[expose] noncomputable def quarter₁ : I := ⟨1 / 4, by norm_num, by norm_num⟩ +@[expose] public section + +/-- See `quarter₁`. -/ +noncomputable def quarter₂ : I := ⟨1 / 2, by norm_num, by norm_num⟩ + +end +/-- See `quarter₁`. -/ +@[expose] noncomputable def quarter₃ : I := ⟨3 / 4, by norm_num, by norm_num⟩ + +theorem quarter₁_pos : (0 : I) < quarter₁ := by + rw [← Subtype.coe_lt_coe] + norm_num [quarter₁] + +theorem quarter_lt₁₂ : quarter₁ < quarter₂ := by + rw [← Subtype.coe_lt_coe] + norm_num [quarter₁, quarter₂] + +theorem quarter_lt₂₃ : quarter₂ < quarter₃ := by + rw [← Subtype.coe_lt_coe] + norm_num [quarter₂, quarter₃] + +theorem quarter₃_lt : quarter₃ < 1 := by + rw [← Subtype.coe_lt_coe] + norm_num [quarter₃] + +omit [T2Space S] in +theorem EdgeParam.subset_U (hγ : EdgeParam H f γ) (hf : f ∈ H.E) (y : I) : γ y ∈ H.U := by + have h1 : Ioo (0 : I) 1 ⊆ γ ⁻¹' H.U := fun z hz => by + have := hγ.mem_edge hz.1 hz.2 + exact (hf.2.1 this).1 + have h2 : closure (Ioo (0 : I) 1) ⊆ γ ⁻¹' H.U := closure_minimal h1 + (H.isClosed_U.preimage hγ.cont) + rw [_root_.closure_Ioo zero_ne_one] at h2 + exact h2 ⟨unitInterval.nonneg y, unitInterval.le_one y⟩ + +/-- An edge run from its head to its tail. -/ +theorem exists_oriented_param (hf : f ∈ H.E) {p m : S} (hpm : ({p, m} : Set S) = tilde f) : ∃ γ : I + → S, EdgeParam H f γ ∧ γ 0 = p ∧ γ 1 = m := by + obtain ⟨γ, h1, h2, h3, h4, h5⟩ := exists_edge_param H hf + have hγ : EdgeParam H f γ := ⟨h1, h2, h3, h4, h5⟩ + have hcl : closure f = γ '' Icc 0 1 := by + rw [← h5] + exact hγ.closure_Ioo zero_lt_one + have ht : tilde f = {γ 0, γ 1} := by + ext x + constructor + · rintro ⟨hx, hxf⟩ + rw [hcl] at hx + obtain ⟨y, hy, rfl⟩ := hx + by_cases hy0 : y = 0 + · exact .inl (by rw [hy0]) + · by_cases hy1 : y = 1 + · exact .inr (by rw [hy1]; rfl) + · exact absurd (hγ.mem_edge (unitInterval.pos_iff_ne_zero.mpr hy0) + (unitInterval.lt_one_iff_ne_one.mpr hy1)) hxf + · rintro (rfl | rfl) + · exact ⟨hcl ▸ ⟨0, ⟨le_rfl, zero_le_one⟩, rfl⟩, fun hx => (hf.2.1 hx).2 h2⟩ + · exact ⟨hcl ▸ ⟨1, ⟨zero_le_one, le_rfl⟩, rfl⟩, fun hx => (hf.2.1 hx).2 h3⟩ + rw [ht] at hpm + have h6 : p ∈ ({γ 0, γ 1} : Set S) := by rw [← hpm]; simp + have h7 : m ∈ ({γ 0, γ 1} : Set S) := by rw [← hpm]; simp + have h8 : γ 0 ∈ ({p, m} : Set S) := by rw [hpm]; simp + have h9 : γ 1 ∈ ({p, m} : Set S) := by rw [hpm]; simp + simp only [mem_insert_iff, mem_singleton_iff] at h6 h7 h8 h9 + by_cases hc : γ 0 = p ∧ γ 1 = m + · exact ⟨γ, hγ, hc.1, hc.2⟩ + · refine ⟨γ ∘ σ, hγ.rev, ?_, ?_⟩ + · simp only [comp_apply, unitInterval.symm_zero] + grind + · simp only [comp_apply, unitInterval.symm_one] + grind + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/StarDisc.lean b/LeanPool/GraphMinor/GM07/StarDisc.lean new file mode 100644 index 0000000000..5ec616964f --- /dev/null +++ b/LeanPool/GraphMinor/GM07/StarDisc.lean @@ -0,0 +1,948 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.LocalCone +public import LeanPool.GraphMinor.Surface.EdgeLens +public import LeanPool.GraphMinor.Surface.Fan + +/-! +# Star-shaped discs around a vertex + +Near a point of a closed surface a drawing is a finite set of rays. For this we use the polar charts +of +Graph Minors XI (`GM11.IsPolar`), which that paper builds at a vertex with at least two half-edges +and at +a point of an edge. We add the vertices with fewer half-edges (`exists_isPolar_of_vertex`), so that +every +vertex has a polar chart. + +A round disc of a polar chart is a *star disc* (`IsStarDisc`): each closed union of atoms of the +drawing +that meets the disc in a point `y` holds a connected set from `y` to the centre, which stays inside +the +disc after it leaves `y`. This is all that we use. From it we read how lines and `O`-arcs of the +drawing +cross the disc (`exists_ray`, `exists_chord`). They are used for Graph Minors VII, (3.4), claim (1) +(page 220), which thickens a forest to a family of discs. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 unitInterval + + + +variable {S : Type} [TopologicalSpace S] + +/-- A strip chart around an arc of a closed surface. -/ +theorem exists_stripChart_of_arc (hS : IsClosedSurface S) {a : I → S} (ha : IsArcMap a) : + ∃ (O : Set ℂ) (K : ℂ → S) (θ : I → ℝ), StripChart O K ∧ Continuous θ ∧ StrictMono θ ∧ + ∀ t, (θ t : ℂ) ∈ O ∧ K (θ t) = a t := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have : T2Space S := hS.2.1 + obtain ⟨D₀, hD₀, hs⟩ := exists_disc_of_arc hS ha + obtain ⟨h, g, cc⟩ := hD₀.exists_isChart + have hbc : BallChart 1 (g '' ball 0 1) h g := by + refine ⟨cc.isOpen_image_ball hman, cc.hc.mono ?_, cc.gc.mono ball_subset_closedBall, ?_, ?_, + ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact cc.gm (ball_subset_closedBall hz) + · rintro _ ⟨z, hz, rfl⟩ + rwa [cc.hg (ball_subset_closedBall hz)] + · exact fun z hz => ⟨z, hz, rfl⟩ + · rintro _ ⟨z, hz, rfl⟩ + rw [cc.hg (ball_subset_closedBall hz)] + · exact fun z hz => cc.hg (ball_subset_closedBall hz) + have hU : range a ⊆ g '' ball 0 1 := by + rw [← cc.discInt_eq] + exact hs + exact exists_stripChart hman hbc ha hU + +/-- The plane of the closed disc, read as the complex numbers. -/ +noncomputable def toC (x : ClosedUnitDisc) : ℂ := planeOf.symm x.1 + +theorem continuous_toC : Continuous toC := + planeOf.symm.continuous.comp continuous_subtype_val + +theorem norm_toC (x : ClosedUnitDisc) : ‖toC x‖ ≤ 1 := by + rw [toC, LinearIsometryEquiv.norm_map] + exact mem_closedBall_zero_iff.mp x.2 + +theorem toC_injective : Function.Injective toC := fun _x _y h => + Subtype.ext (planeOf.symm.injective h) + +theorem toC_discScale (c : I) (x : ClosedUnitDisc) : toC (discScale c x) = (c.1 : ℂ) * toC x := by + simp [toC, discScale, map_smul] + +theorem toC_centre : toC polarCentre = 0 := by simp [toC, polarCentre] + +theorem exists_toC_eq {z : ℂ} (hz : ‖z‖ ≤ 1) : ∃ x, toC x = z := + ⟨⟨planeOf z, by simpa [ClosedUnitDisc] using hz⟩, by simp [toC]⟩ + +/-- A round disc of a chart in which the drawing is empty, except for a part of one atom on the +segment +to the left of the centre. -/ +theorem exists_polar_of_chart (Γ : Drawing S) {O : Set ℂ} {K : ℂ → S} + (hK : StripChart O K) {x₀ : ℝ} {ε : ℝ} + (hε : 0 < ε) (hO : closedBall (x₀ : ℂ) ε ⊆ O) {a : Set S} (ha : a ∈ Γ.A) + (hleft : ∀ s : ℝ, -ε ≤ s → s < 0 → K ((x₀ + s : ℝ) : ℂ) ∈ a) + (hoff : ∀ z ∈ closedBall (x₀ : ℂ) ε, ¬ (z.im = 0 ∧ z.re ≤ x₀) → K z ∉ Γ.U) : ∃ Φ, IsPolar Γ + (K x₀) Φ := by + have hεc : (ε : ℂ) ≠ 0 := by exact_mod_cast hε.ne' + let f : ClosedUnitDisc → ℂ := fun x => (x₀ : ℂ) + ε * toC x + have hf : Continuous f := by + have := continuous_toC + fun_prop + have hfm : ∀ x, f x ∈ closedBall (x₀ : ℂ) ε := fun x => by + rw [mem_closedBall, dist_eq_norm] + simp only [f, add_sub_cancel_left, norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hε] + nlinarith [norm_toC x] + have hfi : Function.Injective f := fun x y h => + toC_injective (mul_left_cancel₀ hεc (add_left_cancel h)) + have hΦc : Continuous fun x => K (f x) := hK.hc.comp_continuous hf fun x => hO (hfm x) + refine ⟨⟨fun x => K (f x), hΦc⟩, fun x y h => hfi (hK.hi (hO (hfm x)) (hO (hfm y)) h), ?_, ?_, ?_⟩ + · simp [f, toC_centre] + · have hsub : K '' ball (x₀ : ℂ) ε ⊆ range fun x => K (f x) := by + rintro _ ⟨z, hz, rfl⟩ + have h1 : ‖(z - x₀) / ε‖ ≤ 1 := by + rw [norm_div, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hε, div_le_one hε] + rw [← dist_eq_norm] + exact (mem_ball.mp hz).le + obtain ⟨x, hx⟩ := exists_toC_eq h1 + refine ⟨x, ?_⟩ + simp only [f, hx] + congr 1 + field_simp + ring + exact interior_maximal hsub (hK.ho _ isOpen_ball (ball_subset_closedBall.trans hO)) ⟨x₀, + mem_ball_self hε, rfl⟩ + · intro x hx c hc + have hne : toC x ≠ 0 := fun h => hx (toC_injective (h.trans toC_centre.symm)) + have hsc : f (discScale c x) = (x₀ : ℂ) + ε * ((c.1 : ℂ) * toC x) := by + simp only [f, toC_discScale] + change ∃ a ∈ Γ.A, K (f x) ∈ a ∧ K (f (discScale c x)) ∈ a + by_cases hl : (toC x).im = 0 ∧ (toC x).re < 0 + · -- Both points lie on the left segment. + have hre : toC x = (((toC x).re : ℝ) : ℂ) := Complex.ext (by simp) (by simp [hl.1]) + have hn : -1 ≤ (toC x).re := by + have := (Complex.abs_re_le_norm (toC x)).trans (norm_toC x) + exact (abs_le.mp this).1 + have hc1 := c.2.2 + have hc0 : (0 : ℝ) < c.1 := hc + have h1 : f x = ((x₀ + ε * (toC x).re : ℝ) : ℂ) := by + simp only [f] + rw [hre] + push_cast + simp + have h2 : f (discScale c x) = ((x₀ + ε * (c.1 * (toC x).re) : ℝ) : ℂ) := by + rw [hsc, hre] + push_cast + simp + have hcr : (toC x).re ≤ c.1 * (toC x).re := by nlinarith [hl.2] + have hcn : c.1 * (toC x).re < 0 := mul_neg_of_pos_of_neg hc0 hl.2 + have hn1 : -ε ≤ ε * (toC x).re := by nlinarith + refine ⟨a, ha, ?_, ?_⟩ + · rw [h1] + exact hleft _ hn1 (mul_neg_of_pos_of_neg hε hl.2) + · rw [h2] + exact hleft _ (by nlinarith) (mul_neg_of_pos_of_neg hε hcn) + · -- Both points lie on a segment that misses the drawing. + let seg : ℝ → ℂ := fun u => (x₀ : ℂ) + ε * ((u : ℂ) * toC x) + have hsc' : Continuous seg := by fun_prop + have hc0 : (0 : ℝ) < c.1 := hc + have hsm : ∀ u ∈ Icc c.1 1, seg u ∈ closedBall (x₀ : ℂ) ε := fun u hu => by + rw [mem_closedBall, dist_eq_norm] + simp only [seg, add_sub_cancel_left, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos hε] + have hu0 : 0 ≤ u := hc0.le.trans hu.1 + rw [abs_of_nonneg hu0] + have := norm_toC x + have h4 : u * ‖toC x‖ ≤ 1 := by nlinarith [hu.2, norm_nonneg (toC x)] + nlinarith + have hsoff : ∀ u ∈ Icc c.1 1, K (seg u) ∉ Γ.U := fun u hu => by + refine hoff _ (hsm u hu) fun hz => ?_ + have hu0 : 0 < u := hc0.trans_le hu.1 + have him : (seg u).im = ε * (u * (toC x).im) := by simp [seg] + have hre : (seg u).re = x₀ + ε * (u * (toC x).re) := by simp [seg] + have h1 : (toC x).im = 0 := by + have := hz.1 + rw [him] at this + have h2 := mul_ne_zero hε.ne' hu0.ne' + by_contra h3 + exact mul_ne_zero h2 h3 (by rw [mul_assoc]; exact this) + have h2 : (toC x).re ≤ 0 := by + have := hz.2 + rw [hre] at this + by_contra h3 + have := mul_pos hε (mul_pos hu0 (not_le.mp h3)) + linarith + rcases h2.lt_or_eq with h3 | h3 + · exact hl ⟨h1, h3⟩ + · exact hne (Complex.ext (by simpa using h3) (by simpa using h1)) + have hcont : ContinuousOn (fun u => K (seg u)) (Icc c.1 1) := + hK.hc.comp hsc'.continuousOn fun u hu => hO (hsm u hu) + have hpre : IsPreconnected ((fun u => K (seg u)) '' Icc c.1 1) := isPreconnected_Icc.image _ + hcont + have h1m : (1 : ℝ) ∈ Icc c.1 1 := ⟨c.2.2, le_rfl⟩ + have hcm : c.1 ∈ Icc c.1 1 := ⟨le_rfl, c.2.2⟩ + have e1 : K (seg 1) = K (f x) := by simp [seg, f] + have e2 : K (seg c.1) = K (f (discScale c x)) := by rw [hsc] + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem (Γ := Γ) (hsoff 1 h1m) + have hsub := subset_region hr hpre + (disjoint_left.mpr fun _ ⟨u, hu, e⟩ => e ▸ hsoff u hu) (mem_image_of_mem _ h1m) hxr + refine ⟨r, Or.inr hr, ?_, ?_⟩ + · rw [← e1] + exact hxr + · rw [← e2] + exact hsub (mem_image_of_mem _ hcm) + +/-- A polar chart at a vertex with no half-edges or one half-edge. -/ +theorem exists_isPolar_of_few (hS : IsClosedSurface S) {Γ : Drawing S} {γ : Set S → I → S} + (hγ : EdgePar Γ γ) {v : S} + (hv : v ∈ Γ.V) (h2 : ¬ 2 ≤ Nat.card (halfEdges Γ γ v)) : ∃ Φ, IsPolar Γ v Φ := by + classical + have : T2Space S := hS.2.1 + have hfinH : Finite (halfEdges Γ γ v) := (finite_halfEdges Γ γ v).to_subtype + have hss : Subsingleton (halfEdges Γ γ v) := Finite.card_le_one_iff_subsingleton.mp (by omega) + rcases isEmpty_or_nonempty (halfEdges Γ γ v) with h0 | ⟨⟨k⟩⟩ + · -- No half-edges: a small round disc misses the rest of the drawing. + have hno : ∀ g ∈ Γ.E, v ∉ closure g := by + intro g hg hzg + obtain ⟨b, hb⟩ := exists_end_eq hγ hg hv hzg + exact h0.false ⟨(g, b), hg, hb⟩ + let P : Set S := (Γ.V \ {v}) ∪ ⋃ g ∈ Γ.E, closure g + have hP : IsClosed P := (Γ.finite_V.subset sdiff_subset).isClosed.union + (Γ.finite_edges.isClosed_biUnion fun _ _ => isClosed_closure) + have hvP : v ∉ P := by + rintro (h | h) + · exact h.2 rfl + · obtain ⟨g, hg, hzg⟩ := mem_iUnion₂.mp h + exact hno g hg hzg + have hUP : Γ.U ⊆ P ∪ {v} := by + intro x hx + rw [Γ.U_eq] at hx + rcases hx with h | h + · by_cases hxv : x = v + · exact Or.inr hxv + · exact Or.inl (Or.inl ⟨h, hxv⟩) + · exact Or.inl (Or.inr h) + obtain ⟨U, h, g, c, hUsub, hy⟩ := (hS.2.2 v).exists_ballChart hP.isOpen_compl hvP (R := 2) + (by norm_num) + have hK : StripChart (ball 0 2) g := ⟨isOpen_ball, c.gc, fun x hx y hy e => by + rw [← c.hg hx, ← c.hg hy, e], fun W hW hsub => c.isOpen_image hW hsub⟩ + have hsub : closedBall ((0 : ℝ) : ℂ) 1 ⊆ ball 0 2 := by + simpa using closedBall_subset_ball (x := (0 : ℂ)) (by norm_num : (1 : ℝ) < 2) + have hoff : ∀ z ∈ closedBall ((0 : ℝ) : ℂ) 1, z ≠ 0 → g z ∉ Γ.U := fun z hz hz0 hU => by + rcases hUP hU with h1 | h1 + · exact hUsub (c.gm (hsub hz)) h1 + · have h3 : g z = g 0 := h1.trans hy.symm + exact hz0 (hK.hi (hsub hz) (by simp) h3) + have hmem : ∀ s : ℝ, -1 ≤ s → s < 0 → ((((0 : ℝ) + s : ℝ) : ℂ)) ∈ closedBall ((0 : ℝ) : ℂ) 1 ∧ + ((((0 : ℝ) + s : ℝ) : ℂ)) ≠ 0 := fun s h1 h3 => by + refine ⟨?_, ?_⟩ + · simp [abs_le] + constructor <;> linarith + · simpa using h3.ne + have hcont : ContinuousOn (fun s : ℝ => g (((0 : ℝ) + s : ℝ) : ℂ)) (Ico (-1) 0) := + hK.hc.comp (by fun_prop) fun s hs => hsub (hmem s hs.1 hs.2).1 + have hpre : IsPreconnected ((fun s : ℝ => g (((0 : ℝ) + s : ℝ) : ℂ)) '' Ico (-1) 0) := + isPreconnected_Ico.image _ hcont + have hm1 : (-1 : ℝ) ∈ Ico (-1 : ℝ) 0 := ⟨le_rfl, by norm_num⟩ + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem (Γ := Γ) (hoff _ (hmem (-1) le_rfl + (by norm_num)).1 (hmem (-1) le_rfl (by norm_num)).2) + have hsr := subset_region hr hpre (disjoint_left.mpr fun _ ⟨s, hs, e⟩ => + e ▸ hoff _ (hmem s hs.1 hs.2).1 (hmem s hs.1 hs.2).2) (mem_image_of_mem _ hm1) hxr + obtain ⟨Φ, hΦ⟩ := exists_polar_of_chart Γ hK one_pos hsub (a := r) (Or.inr hr) + (fun s h1 h3 => hsr (mem_image_of_mem _ ⟨h1, h3⟩)) (fun z hz hn => hoff z hz fun e => hn + (by simp [e])) + refine ⟨Φ, ?_⟩ + have e : g ((0 : ℝ) : ℂ) = v := by simpa using hy + rwa [e] at hΦ + · -- One half-edge: straighten the edge and take a round disc at its end. + obtain ⟨⟨e, b⟩, he, hb⟩ := k + have hbe : e ∈ Γ.E := he + have hother : γ e (endOf (!b)) ≠ v := fun h => by + have := congrArg (fun k : halfEdges Γ γ v => k.1.2) (hss.elim ⟨(e, !b), hbe, h⟩ ⟨(e, b), hbe, + hb⟩) + cases b <;> simp at this + let P : Set S := (Γ.V \ {v}) ∪ ⋃ g ∈ Γ.E \ {e}, closure g + have hP : IsClosed P := (Γ.finite_V.subset sdiff_subset).isClosed.union + ((Γ.finite_edges.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure) + have hvP : v ∉ P := by + rintro (h | h) + · exact h.2 rfl + · obtain ⟨g, hg, hzg⟩ := mem_iUnion₂.mp h + obtain ⟨b', hb'⟩ := exists_end_eq hγ hg.1 hv hzg + have := congrArg (fun k : halfEdges Γ γ v => k.1.1) (hss.elim ⟨(g, b'), hg.1, hb'⟩ ⟨(e, b), + hbe, hb⟩) + exact hg.2 this + let f : I → I := fun t => if b then t else σ t + have hfc : Continuous f := by + cases b + · have e1 : f = σ := by funext t; simp [f] + rw [e1] + exact continuous_symm + · have e1 : f = id := by funext t; simp [f] + rw [e1] + exact continuous_id + have hfi : Function.Injective f := by + cases b + · have e1 : f = σ := by funext t; simp [f] + rw [e1] + exact symm_bijective.injective + · have e1 : f = id := by funext t; simp [f] + rw [e1] + exact Function.injective_id + have hf1 : f 1 = endOf b := by cases b <;> simp [f, endOf] + have hf0 : f 0 = endOf (!b) := by cases b <;> simp [f, endOf] + have hfI : ∀ t ∈ Ioo (0 : I) 1, f t ∈ Ioo (0 : I) 1 := fun t ht => by + cases b + · have e1 : f t = σ t := by simp [f] + rw [e1] + have h1 : (t : ℝ) < 1 := ht.2 + have h0 : (0 : ℝ) < t := ht.1 + exact ⟨Subtype.coe_lt_coe.mp (show (0 : ℝ) < 1 - t by linarith), + Subtype.coe_lt_coe.mp (show (1 : ℝ) - t < 1 by linarith)⟩ + · simpa [f] using ht + let a : I → S := fun t => γ e (f t) + have hac : Continuous a := (hγ.cont e hbe).comp hfc + have ha1 : a 1 = v := by simp only [a, hf1, hb] + have ha0 : a 0 ≠ v := by simp only [a, hf0]; exact hother + have hmid : ∀ t ∈ Ioo (0 : I) 1, a t ∈ e := fun t ht => by + have := mem_image_of_mem (γ e) (hfI t ht) + rwa [hγ.image e hbe] at this + have hendV : ∀ t : I, t = 0 ∨ t = 1 → a t ∈ Γ.V := by + rintro t (rfl | rfl) + · simp only [a, hf0] + cases !b + · exact hγ.zero e hbe + · exact hγ.one e hbe + · rw [ha1] + exact hv + have hcases : ∀ t : I, t = 0 ∨ t = 1 ∨ t ∈ Ioo (0 : I) 1 := fun t => by + by_cases h0 : t = 0 + · exact .inl h0 + by_cases h1 : t = 1 + · exact .inr (.inl h1) + · exact .inr (.inr ⟨unitInterval.pos_iff_ne_zero.mpr h0, unitInterval.lt_one_iff_ne_one.mpr + h1⟩) + have hnotV : ∀ t ∈ Ioo (0 : I) 1, a t ∉ Γ.V := fun t ht => (he.2.1 (hmid t ht)).2 + have hai : IsArcMap a := by + refine ⟨hac, fun s t hst => ?_⟩ + rcases hcases s with rfl | rfl | hs <;> rcases hcases t with rfl | rfl | ht + · rfl + · rw [ha1] at hst + exact (ha0 hst).elim + · exact (hnotV t ht (hst ▸ hendV 0 (.inl rfl))).elim + · rw [ha1] at hst + exact (ha0 hst.symm).elim + · rfl + · exact (hnotV t ht (hst ▸ hendV 1 (.inr rfl))).elim + · exact (hnotV s hs (hst.symm ▸ hendV 0 (.inl rfl))).elim + · exact (hnotV s hs (hst.symm ▸ hendV 1 (.inr rfl))).elim + · exact hfi ((hγ.inj e hbe) (hfI s hs) (hfI t ht) hst) + have hUP : Γ.U ⊆ P ∪ range a := by + have hcl : closure e ⊆ range a := by + refine closure_minimal (fun x hx => ?_) (isCompact_range hac).isClosed + rw [← hγ.image e hbe] at hx + obtain ⟨t, ht, rfl⟩ := hx + have hft : f (f t) = t := by + cases b <;> simp [f] + exact ⟨f t, by simp only [a, hft]⟩ + intro x hx + rw [Γ.U_eq] at hx + rcases hx with h | h + · by_cases hxv : x = v + · exact Or.inr ⟨1, ha1.trans hxv.symm⟩ + · exact Or.inl (Or.inl ⟨h, hxv⟩) + · obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h + by_cases hge : g = e + · exact Or.inr (hcl (hge ▸ hxg)) + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨g, ⟨hg, hge⟩, hxg⟩)) + obtain ⟨O, K, θ, hK, hθc, hθm, hθ⟩ := exists_stripChart_of_arc hS hai + have hN : IsOpen (O ∩ K ⁻¹' Pᶜ) := hK.hc.isOpen_inter_preimage hK.isOpen hP.isOpen_compl + have hx₀ : ((θ 1 : ℝ) : ℂ) ∈ O ∩ K ⁻¹' Pᶜ := ⟨(hθ 1).1, by + change K _ ∉ P + rw [(hθ 1).2, ha1] + exact hvP⟩ + obtain ⟨ε₀, hε₀, hb₀⟩ := Metric.isOpen_iff.mp hN _ hx₀ + have hlt : θ 0 < θ 1 := hθm (by simp) + set ε : ℝ := min (ε₀ / 2) ((θ 1 - θ 0) / 2) with hεd + have hε : 0 < ε := lt_min (by linarith) (by linarith) + have hε1 : ε ≤ ε₀ / 2 := min_le_left _ _ + have hε2 : ε ≤ (θ 1 - θ 0) / 2 := min_le_right _ _ + have hsub : closedBall ((θ 1 : ℝ) : ℂ) ε ⊆ O ∩ K ⁻¹' Pᶜ := + (closedBall_subset_ball (by linarith)).trans hb₀ + obtain ⟨Φ, hΦ⟩ := exists_polar_of_chart Γ hK hε (x₀ := θ 1) (fun z hz => (hsub hz).1) (a := e) + (Or.inl (Or.inr hbe)) + (fun s h1 h3 => by + obtain ⟨t, ht⟩ : θ 1 + s ∈ range θ := + mem_range_of_exists_le_of_exists_ge hθc ⟨0, by linarith⟩ ⟨1, by linarith⟩ + rw [← ht, (hθ t).2] + refine hmid t ⟨?_, ?_⟩ + · exact hθm.lt_iff_lt.mp (by rw [ht]; linarith) + · exact hθm.lt_iff_lt.mp (by rw [ht]; linarith)) + (fun z hz hn hU => by + rcases hUP hU with h1 | ⟨t, ht⟩ + · exact (hsub hz).2 h1 + · rw [← (hθ t).2] at ht + have hzt : z = (θ t : ℂ) := hK.hi (hsub hz).1 (hθ t).1 ht.symm + refine hn ⟨by simp [hzt], ?_⟩ + rw [hzt, Complex.ofReal_re] + exact hθm.monotone (le_one t)) + refine ⟨Φ, ?_⟩ + rwa [(hθ 1).2, ha1] at hΦ + +/-- Every vertex of a drawing in a closed surface has a polar chart. -/ +theorem exists_isPolar_of_vertex (hS : IsClosedSurface S) (Γ : Drawing S) {v : S} (hv : v ∈ Γ.V) : + ∃ Φ, IsPolar Γ v Φ := by + have : T2Space S := hS.2.1 + have hne : Nonempty S := ⟨v⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + by_cases h2 : 2 ≤ Nat.card (halfEdges Γ γ v) + · exact exists_isPolar_of_sectors hS hγ hv h2 + · exact exists_isPolar_of_few hS hγ hv h2 + +/-- A closed disc `R` around `v` in which each closed union of atoms of `Γ` is a star at `v`. -/ +structure IsStarDisc (Γ : Drawing S) (v : S) (R : Set S) : Prop where + disc : IsClosedDisc R + mem : v ∈ discInt R + star : ∀ X, IsClosed X → IsGammaNice Γ X → ∀ y ∈ R ∩ X, ∃ C, IsPreconnected C ∧ C ⊆ X ∧ y ∈ C + ∧ v ∈ C ∧ + C \ {y} ⊆ discInt R + +/-- Each vertex has a star disc in each of its neighbourhoods. -/ +theorem exists_starDisc (hS : IsClosedSurface S) (Γ : Drawing S) {v : S} (hv : v ∈ Γ.V) {W : Set S} + (hW : IsOpen W) + (hvW : v ∈ W) : ∃ R, IsStarDisc Γ v R ∧ R ⊆ W := by + have : T2Space S := hS.2.1 + obtain ⟨Φ, hΦ⟩ := exists_isPolar_of_vertex hS Γ hv + have hN : IsOpen (Φ ⁻¹' W) := hW.preimage Φ.continuous + have h0 : polarCentre ∈ Φ ⁻¹' W := by + change Φ _ ∈ W + rw [hΦ.centre] + exact hvW + obtain ⟨ε, hε, hb⟩ := Metric.isOpen_iff.mp hN _ h0 + set r : ℝ := min (ε / 2) (1 / 2) with hrd + have hr : 0 < r := lt_min (by linarith) (by norm_num) + have hr1 : r ≤ 1 / 2 := min_le_right _ _ + have hr2 : r ≤ ε / 2 := min_le_left _ _ + let c : I := ⟨r, hr.le, by linarith⟩ + have hc0 : (c.1 : ℝ) ≠ 0 := hr.ne' + let ψ : ClosedUnitDisc → S := fun x => Φ (discScale c x) + have hψc : Continuous ψ := Φ.continuous.comp (continuous_discScale.comp + (continuous_const.prodMk continuous_id)) + have hψi : Function.Injective ψ := fun x y h => by + have h1 := hΦ.inj h + have h2 := congrArg Subtype.val h1 + exact Subtype.ext (smul_right_injective _ hc0 h2) + have hemb : IsEmbedding ψ := (hψc.isClosedEmbedding hψi).isEmbedding + let e : ClosedUnitDisc ≃ₜ range ψ := hemb.toHomeomorph + have hD : IsClosedDisc (range ψ) := ⟨e⟩ + have hbd : discBd (range ψ) = (fun x : ClosedUnitDisc => (e x).1) '' {x | ‖x.1‖ = 1} := by + have h := disc_boundary (range ψ) e + rw [h] + have hu : ∀ x : ClosedUnitDisc, x.1 ∈ UnitCircle ↔ ‖x.1‖ = 1 := fun x => by simp [UnitCircle] + ext z + simp only [mem_image, mem_ofPred_eq, hu] + have hint : ∀ x : ClosedUnitDisc, ‖x.1‖ < 1 → ψ x ∈ discInt (range ψ) := fun x hx => by + refine ⟨⟨x, rfl⟩, ?_⟩ + rw [hbd] + rintro ⟨y, hy, hxy⟩ + have : y = x := e.injective (Subtype.ext hxy) + rw [this] at hy + exact hx.ne hy + have hnorm : ∀ (d : I) (x : ClosedUnitDisc), d < 1 → ‖(discScale d x).1‖ < 1 := fun d x hd => by + have hx : ‖x.1‖ ≤ 1 := mem_closedBall_zero_iff.mp x.2 + have hd0 := d.2.1 + have hd1 : (d.1 : ℝ) < 1 := hd + simp only [discScale, norm_smul, Real.norm_eq_abs, abs_of_nonneg hd0] + nlinarith [norm_nonneg x.1] + have hmul : ∀ (d : I) (x : ClosedUnitDisc), discScale c (discScale d x) = discScale d + (discScale c x) := fun d x => + Subtype.ext (smul_comm _ _ _) + refine ⟨range ψ, ⟨hD, ?_, ?_⟩, ?_⟩ + · have e0 : ψ polarCentre = v := by + have : discScale c polarCentre = polarCentre := Subtype.ext (by simp [discScale, polarCentre]) + simp only [ψ, this, hΦ.centre] + rw [← e0] + exact hint _ (by simp [polarCentre]) + · rintro X hXc hXn y ⟨⟨x, rfl⟩, hyX⟩ + let C : Set S := (fun d : I => ψ (discScale d x)) '' univ + have hcont : Continuous fun d : I => ψ (discScale d x) := + hψc.comp (continuous_discScale.comp (continuous_id.prodMk continuous_const)) + refine ⟨C, isPreconnected_univ.image _ hcont.continuousOn, ?_, ⟨1, mem_univ _, ?_⟩, ⟨0, + mem_univ _, ?_⟩, ?_⟩ + · rintro _ ⟨d, -, rfl⟩ + change Φ _ ∈ X + rw [hmul] + exact hΦ.star hXc hXn hyX d + · simp only [discScale_one] + · simp only [discScale_zero, ψ] + have : discScale c polarCentre = polarCentre := Subtype.ext (by simp [discScale, polarCentre]) + rw [this, hΦ.centre] + · rintro _ ⟨⟨d, -, rfl⟩, hne⟩ + refine hint _ (hnorm d x ?_) + refine lt_of_le_of_ne (le_one d) fun hd => hne ?_ + simp only [hd, discScale_one, mem_singleton_iff] + · rintro _ ⟨x, rfl⟩ + refine hb ?_ + rw [mem_ball, Subtype.dist_eq, dist_eq_norm] + have hx : ‖x.1‖ ≤ 1 := mem_closedBall_zero_iff.mp x.2 + have : ‖((discScale c x).1 - polarCentre.1)‖ = r * ‖x.1‖ := by + simp [discScale, polarCentre, norm_smul, abs_of_pos hr, c] + change ‖((discScale c x).1 - polarCentre.1)‖ < ε + rw [this] + nlinarith [norm_nonneg x.1] + +/-- Near a point other than `0`, an open set of the interval has smaller points. -/ +theorem exists_lt_of_isOpen {O : Set I} (hO : IsOpen O) {t : I} (ht : t ∈ O) + (h0 : 0 < t) : ∃ u, u < t ∧ u ∈ O := by + obtain ⟨ε, hε, hb⟩ := Metric.isOpen_iff.mp hO t ht + have h0' : (0 : ℝ) < t := h0 + set d : ℝ := min (ε / 2) t with hd + have hd0 : 0 < d := lt_min (by linarith) h0' + have hd1 : d ≤ ε / 2 := min_le_left _ _ + have hd2 : d ≤ t := min_le_right _ _ + refine ⟨⟨t - d, by linarith, by linarith [t.2.2]⟩, Subtype.coe_lt_coe.mp (by simpa using hd0), + hb ?_⟩ + rw [mem_ball, Subtype.dist_eq, Real.dist_eq] + simp only [sub_sub_cancel_left, abs_neg, abs_of_pos hd0] + linarith + +/-- A line split at a point, read off a parametrization. -/ +theorem split_at [T2Space S] {a : I → S} (ha : IsArcMap a) {t : I} (h0 : 0 < t) (h1 : t < 1) : + IsLineWithEnds (a '' Iic t) (a 0) (a t) ∧ IsLineWithEnds (a '' Ici t) (a t) (a 1) := by + have h0' : (0 : ℝ) < t := h0 + have h1' : (t : ℝ) < 1 := h1 + have a1 := isArcMap_pieceA ha le_rfl h0' h1'.le + have a2 := isArcMap_pieceA ha h0'.le h1' le_rfl + have e1 : extI a 0 = a 0 := extI_coe a 0 + have e2 : extI a 1 = a 1 := extI_coe a 1 + have e3 : extI a t = a t := extI_coe a t + have r1 : range (pieceA a 0 t) = a '' Iic t := by + rw [range_pieceA a le_rfl h0'.le h1'.le] + ext y + constructor + · rintro ⟨r, hr, rfl⟩ + exact ⟨⟨r, hr.1, hr.2.trans h1'.le⟩, hr.2, (extI_of_mem a ⟨hr.1, hr.2.trans h1'.le⟩).symm⟩ + · rintro ⟨r, hr, rfl⟩ + exact ⟨r, ⟨r.2.1, hr⟩, extI_coe a r⟩ + have r2 : range (pieceA a t 1) = a '' Ici t := by + rw [range_pieceA a h0'.le h1'.le le_rfl] + ext y + constructor + · rintro ⟨r, hr, rfl⟩ + exact ⟨⟨r, h0'.le.trans hr.1, hr.2⟩, hr.1, (extI_of_mem a ⟨h0'.le.trans hr.1, hr.2⟩).symm⟩ + · rintro ⟨r, hr, rfl⟩ + exact ⟨r, ⟨hr, r.2.2⟩, extI_coe a r⟩ + constructor + · have := a1.isLineWithEnds + rwa [pieceA_zero, pieceA_one, e1, e3, r1] at this + · have := a2.isLineWithEnds + rwa [pieceA_zero, pieceA_one, e2, e3, r2] at this + +/-- **A line from outside to the centre of a star disc.** It enters the disc once. Here `Y` is the +rest of +a closed union of atoms `X` of the drawing, which may hold the connected sets to the centre. -/ +theorem exists_ray_param (hS : IsClosedSurface S) {Γ : Drawing S} {R : Set S} {b : I → S} + (h : IsStarDisc Γ (b 1) R) {X Y : Set S} + (hb : IsArcMap b) (hw : b 0 ∉ R) (hXc : IsClosed X) (hXn : IsGammaNice Γ X) (hX : X + = range b ∪ Y) + (hY : IsClosed Y) (hLY : range b ∩ Y ⊆ {b 0, b 1}) : + ∃ τ : I, 0 < τ ∧ τ < 1 ∧ (∀ t, b t ∈ R ↔ τ ≤ t) ∧ b τ ∈ discBd R ∧ ∀ t, τ < t → b t ∈ discInt R + := by + have ht2 : T2Space S := hS.2.1 + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hint : IsOpen (discInt R) := h.disc.isOpen_discInt hman + have hRc : IsClosed R := h.disc.isClosed + let T : Set I := b ⁻¹' R + have hTc : IsClosed T := hRc.preimage hb.1 + have h1T : (1 : I) ∈ T := h.mem.1 + have hne : T.Nonempty := ⟨1, h1T⟩ + have hτ : sInf T ∈ T := hTc.csInf_mem hne (OrderBot.bddBelow T) + set τ : I := sInf T with hτd + have h0T : (0 : I) ∉ T := hw + have hτ0 : 0 < τ := unitInterval.pos_iff_ne_zero.mpr fun e => h0T (e ▸ hτ) + -- A point of the line in the disc: everything after it lies inside. + have hafter : ∀ t ∈ T, ∀ u, t < u → b u ∈ discInt R := by + intro t ht u htu + by_cases hu1 : u = 1 + · rw [hu1] + exact h.mem + have hu1' : u < 1 := unitInterval.lt_one_iff_ne_one.mpr hu1 + have ht0 : 0 < t := unitInterval.pos_iff_ne_zero.mpr fun e => h0T (e ▸ ht) + have hyX : b t ∈ X := hX ▸ Or.inl ⟨t, rfl⟩ + obtain ⟨C, hC, hCX, hyC, hvC, hCint⟩ := h.star X hXc hXn (b t) ⟨ht, hyX⟩ + have hCR : C ⊆ R := fun z hz => by + by_cases hzy : z = b t + · rw [hzy] + exact ht + · exact (hCint ⟨hz, hzy⟩).1 + suffices hbu : b u ∈ C from hCint ⟨hbu, fun e => htu.ne (hb.2 e.symm)⟩ + by_contra hbu + have c1 : IsClosed (b '' Iic u) := (isClosed_Iic.isCompact.image hb.1).isClosed + have c2 : IsClosed (b '' Ici u ∪ Y) := (isClosed_Ici.isCompact.image hb.1).isClosed.union hY + have hcov : C ⊆ b '' Iic u ∪ (b '' Ici u ∪ Y) := fun z hz => by + have hzX := hCX hz + rw [hX] at hzX + rcases hzX with ⟨r, rfl⟩ | hzY + · rcases le_total r u with hr | hr + · exact .inl ⟨r, hr, rfl⟩ + · exact .inr (.inl ⟨r, hr, rfl⟩) + · exact .inr (.inr hzY) + obtain ⟨z, hzC, hz1, hz2⟩ := isPreconnected_closed_iff.mp hC _ _ c1 c2 hcov ⟨_, hyC, ⟨t, + htu.le, rfl⟩⟩ + ⟨_, hvC, .inl ⟨1, le_one u, rfl⟩⟩ + obtain ⟨r, hr, rfl⟩ := hz1 + rcases hz2 with ⟨r', hr', e⟩ | hzY + · have e1 := hb.2 e + rw [e1] at hr' + have e2 : r = u := le_antisymm hr hr' + rw [e2] at hzC + exact hbu hzC + · have hmem : b r ∈ ({b 0, b 1} : Set S) := hLY ⟨⟨r, rfl⟩, hzY⟩ + rcases hmem with e | e + · have := hCR hzC + rw [e] at this + exact hw this + · have e' : r = 1 := hb.2 e + rw [e'] at hr + exact absurd (lt_of_le_of_lt hr hu1') (lt_irrefl _) + have hOo : IsOpen (b ⁻¹' discInt R) := hint.preimage hb.1 + have hτ1 : τ < 1 := by + obtain ⟨u, hu, huO⟩ := exists_lt_of_isOpen hOo (t := 1) h.mem one_pos + exact lt_of_le_of_lt (csInf_le (OrderBot.bddBelow T) (show b u ∈ R from huO.1)) hu + have hT : ∀ t, b t ∈ R ↔ τ ≤ t := fun t => by + constructor + · exact fun ht => csInf_le (OrderBot.bddBelow T) ht + · intro ht + rcases ht.eq_or_lt with e | e + · rw [← e] + exact hτ + · exact (hafter τ hτ t e).1 + have hp : b τ ∈ discBd R := by + by_contra hn + obtain ⟨u, hu, huO⟩ := exists_lt_of_isOpen hOo (t := τ) (show b τ ∈ discInt R from ⟨hτ, hn⟩) hτ0 + exact absurd ((hT u).mp huO.1) (not_le.mpr hu) + exact ⟨τ, hτ0, hτ1, hT, hp, hafter τ hτ⟩ + +/-- The set form of `exists_ray_param`. -/ +theorem exists_ray (hS : IsClosedSurface S) {Γ : Drawing S} {v : S} {R : Set S} + (h : IsStarDisc Γ v R) {X Y L : Set S} {w : S} + (hL : IsLineWithEnds L w v) (hw : w ∉ R) (hXc : IsClosed X) (hXn : IsGammaNice Γ X) (hX : X + = L ∪ Y) + (hY : IsClosed Y) (hLY : L ∩ Y ⊆ {w, v}) : + ∃ p L₁ L₂, IsLineWithEnds L₁ w p ∧ IsLineWithEnds L₂ p v ∧ L₁ ∪ L₂ = L ∧ L₁ ∩ L₂ = {p} ∧ L₂ + = L ∩ R ∧ + p ∈ discBd R ∧ L₂ \ {p} ⊆ discInt R ∧ p ≠ w ∧ p ≠ v := by + have ht2 : T2Space S := hS.2.1 + obtain ⟨b, hb, rfl, rfl, rfl⟩ := hL.exists_arc + obtain ⟨τ, hτ0, hτ1, hT, hp, hafter⟩ := exists_ray_param hS h hb hw hXc hXn hX hY hLY + obtain ⟨l1, l2⟩ := split_at hb hτ0 hτ1 + refine ⟨b τ, _, _, l1, l2, ?_, ?_, ?_, hp, ?_, fun e => hτ0.ne (hb.2 e).symm, + fun e => hτ1.ne (hb.2 e)⟩ + · ext y + constructor + · rintro (⟨r, -, rfl⟩ | ⟨r, -, rfl⟩) <;> exact ⟨r, rfl⟩ + · rintro ⟨r, rfl⟩ + rcases le_total r τ with hr | hr + · exact .inl ⟨r, hr, rfl⟩ + · exact .inr ⟨r, hr, rfl⟩ + · ext y + constructor + · rintro ⟨⟨r, hr, rfl⟩, ⟨r', hr', e⟩⟩ + have e1 := hb.2 e + rw [e1] at hr' + have e2 : r = τ := le_antisymm hr hr' + rw [e2] + rfl + · rintro rfl + exact ⟨⟨τ, le_refl τ, rfl⟩, ⟨τ, le_refl τ, rfl⟩⟩ + · ext y + constructor + · rintro ⟨r, hr, rfl⟩ + exact ⟨⟨r, rfl⟩, (hT r).mpr hr⟩ + · rintro ⟨⟨r, rfl⟩, hr⟩ + exact ⟨r, (hT r).mp hr, rfl⟩ + · rintro _ ⟨⟨r, hr, rfl⟩, hne⟩ + rcases (show τ ≤ r from hr).eq_or_lt with e | e + · exact (hne (by rw [e]; rfl)).elim + · exact hafter r e + +/-- **Two lines from outside to the centre of a star disc.** Two lines from `w` to `v` that make up +an +`O`-arc `F` of the drawing, with `w` outside the disc. Then `F` crosses the disc in one chord +through `v`. -/ +theorem exists_chord (hS : IsClosedSurface S) {Γ : Drawing S} {v : S} {R : Set S} + (h : IsStarDisc Γ v R) {F A₁ A₂ : Set S} {w : S} + (h₁ : IsLineWithEnds A₁ w v) (h₂ : IsLineWithEnds A₂ w v) (hF : F = A₁ ∪ A₂) (hm : A₁ ∩ A₂ + = {w, v}) (hw : w ∉ R) + (hFc : IsClosed F) (hFn : IsGammaNice Γ F) : + ∃ s t ρ₁ ρ₂ B₁ B₂, IsLineWithEnds ρ₁ s v ∧ IsLineWithEnds ρ₂ t v ∧ IsLineWithEnds B₁ w s + ∧ IsLineWithEnds B₂ w t ∧ + B₁ ∪ ρ₁ = A₁ ∧ B₂ ∪ ρ₂ = A₂ ∧ IsLineWithEnds (ρ₁ ∪ ρ₂) s t ∧ s ≠ t ∧ ρ₁ ∪ ρ₂ = F ∩ R ∧ + (ρ₁ ∪ ρ₂) ∩ discBd R = {s, t} := by + have ht2 : T2Space S := hS.2.1 + have hc₁ : IsClosed A₁ := h₁.isCompact.isClosed + have hc₂ : IsClosed A₂ := h₂.isCompact.isClosed + obtain ⟨s, B₁, ρ₁, l₁, r₁, u₁, m₁, e₁, hsb, hi₁, hsw, hsv⟩ := + exists_ray hS h h₁ hw hFc hFn hF hc₂ (by rw [hm]) + obtain ⟨t, B₂, ρ₂, l₂, r₂, u₂, m₂, e₂, htb, hi₂, htw, htv⟩ := + exists_ray hS h h₂ hw hFc hFn (by rw [hF, union_comm]) hc₁ (by rw [inter_comm, hm]) + have hρ : ρ₁ ∩ ρ₂ = {v} := by + ext y + constructor + · rintro ⟨h3, h4⟩ + have h5 : y ∈ A₁ ∩ A₂ := ⟨(e₁ ▸ h3 : y ∈ A₁ ∩ R).1, (e₂ ▸ h4 : y ∈ A₂ ∩ R).1⟩ + rw [hm] at h5 + rcases h5 with e | e + · exact (hw (by rw [← e]; exact (e₁ ▸ h3 : y ∈ A₁ ∩ R).2)).elim + · exact e + · rintro rfl + exact ⟨r₁.right_mem, r₂.right_mem⟩ + have hst : s ≠ t := fun e => by + have : s ∈ ρ₁ ∩ ρ₂ := ⟨r₁.left_mem, e ▸ r₂.left_mem⟩ + rw [hρ] at this + exact hsv this + refine ⟨s, t, ρ₁, ρ₂, B₁, B₂, r₁, r₂, l₁, l₂, u₁, u₂, IsLineWithEnds.union r₁ r₂.symm hρ, hst, + ?_, ?_⟩ + · rw [e₁, e₂, hF, union_inter_distrib_right] + · ext y + constructor + · rintro ⟨h3 | h3, h4⟩ + · by_cases e : y = s + · exact .inl e + · exact ((disjoint_left.mp (show Disjoint (discInt R) (discBd R) from disjoint_sdiff_left) + (hi₁ ⟨h3, e⟩)) h4).elim + · by_cases e : y = t + · exact .inr e + · exact ((disjoint_left.mp (show Disjoint (discInt R) (discBd R) from disjoint_sdiff_left) + (hi₂ ⟨h3, e⟩)) h4).elim + · rintro (rfl | rfl) + · exact ⟨.inl r₁.left_mem, hsb⟩ + · exact ⟨.inr r₂.left_mem, htb⟩ + +/-- A chord splits a closed disc, with the two arcs of the boundary as lines. -/ +theorem disc_split [T2Space S] {D F : Set S} {s t : S} (hD : IsClosedDisc D) (hFD : F ⊆ D) + (hst : s ≠ t) + (hF : IsLineWithEnds F s t) (hb : F ∩ discBd D = {s, t}) : + ∃ Δ₁ Δ₂ A₁ A₂, IsLineWithEnds A₁ s t ∧ IsLineWithEnds A₂ s t ∧ A₁ ∪ A₂ = discBd D ∧ A₁ ∩ A₂ + = {s, t} ∧ + IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ Δ₁ ∪ Δ₂ = D ∧ Δ₁ ∩ Δ₂ = F ∧ discBd Δ₁ = A₁ ∪ F + ∧ discBd Δ₂ = A₂ ∪ F ∧ + IsPreconnected (Δ₁ \ F) ∧ IsPreconnected (Δ₂ \ F) := by + obtain ⟨c₁, c₂, Δ₁, Δ₂, hne, hc, d₁, d₂, hu, hi, b₁, b₂, hcc⟩ := disc_iArc D F s t hD hFD hst hF + hb + have hs : s ∈ discBd D := (hb ▸ (mem_insert s {t}) : s ∈ F ∩ discBd D).2 + have ht : t ∈ discBd D := (hb ▸ (Or.inr rfl : t ∈ ({s, t} : Set S)) : t ∈ F ∩ discBd D).2 + obtain ⟨a, b, hab, ha0, ha1, hr⟩ := hD.isOArc_discBd.exists_arcs hs ht hst + have la : IsLineWithEnds (range a) s t := ha0 ▸ ha1 ▸ hab.arc_left.isLineWithEnds + have lb : IsLineWithEnds (range b) s t := by + have := hab.arc_right.isLineWithEnds + rwa [hab.zero, hab.one, ha0, ha1] at this + have hne' : ∀ {c : I → S}, IsArcMap c → c 0 = s → c 1 = t → (range c \ {s, t}).Nonempty + := fun {c} hc h0 h1 => + ⟨c ⟨1 / 2, by norm_num, by norm_num⟩, ⟨_, rfl⟩, by + rintro (e | e) + · have := hc.2 (e.trans h0.symm) + simpa using congrArg Subtype.val this + · have := hc.2 (e.trans h1.symm) + simpa using congrArg Subtype.val this⟩ + have hY : discBd D \ {s, t} = (range a \ {s, t}) ∪ (range b \ {s, t}) := by + rw [← hr, union_sdiff_distrib] + have hdis : Disjoint (range a \ {s, t}) (range b \ {s, t}) := disjoint_left.mpr fun y hy hy' => by + obtain ⟨⟨r, rfl⟩, hn⟩ := hy + obtain ⟨⟨r', e⟩, -⟩ := hy' + rcases hab.meet r r' e.symm with ⟨h0, -⟩ | ⟨h1, -⟩ + · exact hn (.inl (by rw [h0, ha0])) + · exact hn (.inr (by rw [h1, ha1]; rfl)) + have hPre : ∀ X ∈ componentsIn (D \ F), IsPreconnected X := fun X hX => by + obtain ⟨x, -, rfl⟩ := hX + exact isPreconnected_connectedComponentIn + have hp₁ := hPre (Δ₁ \ F) (hcc ▸ Or.inl rfl) + have hp₂ := hPre (Δ₂ \ F) (hcc ▸ Or.inr rfl) + have hsF : s ∈ F := hF.left_mem + have htF : t ∈ F := hF.right_mem + have hadd : ∀ {L : Set S}, s ∈ L → t ∈ L → (L \ {s, t}) ∪ F = L ∪ F := fun {L} h1 h2 => by + ext y + constructor + · rintro (⟨h3, -⟩ | h3) + · exact .inl h3 + · exact .inr h3 + · rintro (h3 | h3) + · by_cases hy : y ∈ ({s, t} : Set S) + · rcases hy with rfl | rfl + · exact .inr hsF + · exact .inr htF + · exact .inl ⟨h3, hy⟩ + · exact .inr h3 + have hmeet : range a ∩ range b = {s, t} := by + ext y + constructor + · rintro ⟨⟨r, rfl⟩, ⟨r', e⟩⟩ + rcases hab.meet r r' e.symm with ⟨h0, -⟩ | ⟨h1, -⟩ + · exact .inl (by rw [h0, ha0]) + · exact .inr (by rw [h1, ha1]; rfl) + · rintro (rfl | rfl) + · exact ⟨la.left_mem, lb.left_mem⟩ + · exact ⟨la.right_mem, lb.right_mem⟩ + rcases comps_two hne hc hY hdis la.isPreconnected_diff lb.isPreconnected_diff + (hne' hab.arc_left ha0 ha1) + (hne' hab.arc_right (hab.zero.trans ha0) (hab.one.trans ha1)) with ⟨e1, e2⟩ | ⟨e1, e2⟩ + · refine ⟨Δ₁, Δ₂, range a, range b, la, lb, hr, hmeet, d₁, d₂, hu, hi, ?_, ?_, hp₁, hp₂⟩ + · rw [b₁, e1, hadd la.left_mem la.right_mem] + · rw [b₂, e2, hadd lb.left_mem lb.right_mem] + · refine ⟨Δ₁, Δ₂, range b, range a, lb, la, by rw [union_comm, hr], by rw [inter_comm, hmeet], + d₁, d₂, hu, hi, ?_, ?_, hp₁, hp₂⟩ + · rw [b₁, e1, hadd lb.left_mem lb.right_mem] + · rw [b₂, e2, hadd la.left_mem la.right_mem] + +/-- A connected set off the frontier of a closed set lies inside it or outside it. -/ +theorem inside_or_outside {X B : Set S} (hX : IsPreconnected X) (hB : IsClosed B) (hf : Disjoint X + (frontier B)) : + X ⊆ interior B ∨ X ⊆ Bᶜ := by + have hcov : X ⊆ interior B ∪ Bᶜ := fun x hx => by + by_cases h1 : x ∈ B + · refine .inl ?_ + by_contra h2 + exact disjoint_left.mp hf hx ⟨hB.closure_eq.symm ▸ h1, h2⟩ + · exact .inr h1 + have hdj : Disjoint (interior B) Bᶜ := disjoint_left.mpr fun x h1 h2 => h2 (interior_subset h1) + exact hX.subset_or_subset isOpen_interior hB.isOpen_compl hdj hcov + +/-- **The two sides of a chord.** Let the frontier of the closed set `B` meet the disc `D` exactly +in the +chord `F`, with `B` on both sides near a point of `F`. Then one side of `F` lies in `B`, and the +other misses +`B` off `F`. -/ +theorem side_of_frontier (hS : IsClosedSurface S) {D F Δ₁ Δ₂ B : Set S} {p : S} + (hD : IsClosedDisc D) + (hu : Δ₁ ∪ Δ₂ = D) (_hi : Δ₁ ∩ Δ₂ = F) (hp₁ : IsPreconnected (Δ₁ \ F)) (hp₂ : IsPreconnected + (Δ₂ \ F)) + (hB : IsClosed B) (hf : frontier B ∩ D = F) (_hpF : p ∈ F) (hpi : p ∈ discInt D) + (hin : p ∈ closure (interior B)) + (hout : p ∈ closure Bᶜ) : (Δ₁ ⊆ B ∧ Disjoint (Δ₂ \ F) B) ∨ (Δ₂ ⊆ B ∧ Disjoint (Δ₁ \ F) B) := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hint : IsOpen (discInt D) := hD.isOpen_discInt hman + have hFf : F ⊆ frontier B := fun x hx => (hf ▸ hx : x ∈ frontier B ∩ D).1 + have hFB : F ⊆ B := hFf.trans hB.frontier_subset + have hoff : ∀ {X}, X ⊆ D \ F → Disjoint X (frontier B) := fun {X} hX + => disjoint_left.mpr fun x hx hxf => + (hX hx).2 (hf ▸ ⟨hxf, (hX hx).1⟩) + have h1 : Δ₁ \ F ⊆ D \ F := fun x hx => ⟨hu ▸ Or.inl hx.1, hx.2⟩ + have h2 : Δ₂ \ F ⊆ D \ F := fun x hx => ⟨hu ▸ Or.inr hx.1, hx.2⟩ + obtain ⟨z, hzD, hzB⟩ := mem_closure_iff.mp hin _ hint hpi + obtain ⟨z', hz'D, hz'B⟩ := mem_closure_iff.mp hout _ hint hpi + have hzF : z ∉ F := fun h => (hFf h).2 hzB + have hz'F : z' ∉ F := fun h => hz'B (hFB h) + have hclose : ∀ {Δ : Set S}, Δ \ F ⊆ interior B → Δ ⊆ B := fun {Δ} h x hx => by + by_cases hxF : x ∈ F + · exact hFB hxF + · exact interior_subset (h ⟨hx, hxF⟩) + have hdj : ∀ {Δ : Set S}, Δ \ F ⊆ Bᶜ → Disjoint (Δ \ F) B := fun h => disjoint_left.mpr fun x hx + hxB => h hx hxB + have hzm : z ∈ Δ₁ ∪ Δ₂ := hu ▸ hzD.1 + have hz'm : z' ∈ Δ₁ ∪ Δ₂ := hu ▸ hz'D.1 + rcases inside_or_outside hp₁ hB (hoff h1) with a | a <;> rcases inside_or_outside hp₂ hB + (hoff h2) with b | b + · rcases hz'm with h3 | h3 + · exact (hz'B (interior_subset (a ⟨h3, hz'F⟩))).elim + · exact (hz'B (interior_subset (b ⟨h3, hz'F⟩))).elim + · exact .inl ⟨hclose a, hdj b⟩ + · exact .inr ⟨hclose b, hdj a⟩ + · rcases hzm with h3 | h3 + · exact (a ⟨h3, hzF⟩ (interior_subset hzB)).elim + · exact (b ⟨h3, hzF⟩ (interior_subset hzB)).elim + +/-- A closed subset `X` of `U(Γ)` is a union of atoms, if the rest of `U(Γ)` lies in a closed set +that meets `X` +only in vertices. -/ +theorem nice_of_cover {Γ : Drawing S} {X Y : Set S} (hX : IsClosed X) (hY : IsClosed Y) + (hU : Γ.U ⊆ X ∪ Y) (hXU : X ⊆ Γ.U) + (hV : X ∩ Y ⊆ Γ.V) : IsGammaNice Γ X := by + refine ⟨(singleton '' (X ∩ Γ.V)) ∪ {e ∈ Γ.E | (e ∩ X).Nonempty}, ?_, ?_⟩ + · rintro a (⟨v, hv, rfl⟩ | ⟨he, -⟩) + · exact Or.inl (Or.inl ⟨v, hv.2, rfl⟩) + · exact Or.inl (Or.inr he) + · ext x + constructor + · intro hx + by_cases hxV : x ∈ Γ.V + · exact ⟨{x}, .inl ⟨x, ⟨hx, hxV⟩, rfl⟩, rfl⟩ + · obtain ⟨e, he, hxe⟩ := Γ.exists_edge_of_mem (hXU hx) hxV + exact ⟨e, .inr ⟨he, x, hxe, hx⟩, hxe⟩ + · rintro ⟨a, (⟨v, hv, rfl⟩ | ⟨he, y, hye, hyX⟩), hxa⟩ + · rw [mem_singleton_iff.mp hxa] + exact hv.1 + · have hpre : IsPreconnected a := he.2.2.1.isConnected.isPreconnected + have hcov : a ⊆ X ∪ Y := fun z hz => hU (he.2.1 hz).1 + by_contra hxX + have hxY : x ∈ Y := (hcov hxa).resolve_left hxX + obtain ⟨z, hza, hz1, hz2⟩ := isPreconnected_closed_iff.mp hpre _ _ hX hY hcov ⟨y, hye, hyX⟩ + ⟨x, hxa, hxY⟩ + exact (he.2.1 hza).2 (hV ⟨hz1, hz2⟩) + +/-- **The sides of a boundary in a star disc.** Let `v` be a point of the boundary of a closed disc +`A`, with +`w ∈ bd(A)` outside the star disc `R`. Then `bd(A)` is a chord of `R`, one side of it lies in `A`, +and the other +misses `A` off the chord. -/ +theorem exists_disc_sides (hS : IsClosedSurface S) {Γ : Drawing S} {v : S} {R A : Set S} + (h : IsStarDisc Γ v R) (hA : IsClosedDisc A) + (hv : v ∈ discBd A) {w : S} (hwA : w ∈ discBd A) (hw : w ∉ R) (hn : IsGammaNice Γ (discBd A)) : + ∃ ℓ s t Δ E c c', IsLineWithEnds ℓ s t ∧ s ≠ t ∧ ℓ = discBd A ∩ R ∧ IsClosedDisc Δ + ∧ IsClosedDisc E ∧ Δ ∪ E = R ∧ + Δ ∩ E = ℓ ∧ IsLineWithEnds c s t ∧ IsLineWithEnds c' s t ∧ c ∪ c' = discBd R ∧ c ∩ c' + = {s, t} ∧ + discBd Δ = c ∪ ℓ ∧ discBd E = c' ∪ ℓ ∧ ℓ ∩ discBd R = {s, t} ∧ v ∈ ℓ ∧ Δ ⊆ A ∧ Disjoint + (E \ ℓ) A := by + have ht2 : T2Space S := hS.2.1 + have hne : w ≠ v := fun e => hw (e ▸ h.mem.1) + have hbc : IsClosed (discBd A) := hA.isOArc_discBd.isCompact.isClosed + obtain ⟨a, b, hab, ha0, ha1, hr⟩ := hA.isOArc_discBd.exists_arcs hwA hv hne + have la : IsLineWithEnds (range a) w v := ha0 ▸ ha1 ▸ hab.arc_left.isLineWithEnds + have lb : IsLineWithEnds (range b) w v := by + have := hab.arc_right.isLineWithEnds + rwa [hab.zero, hab.one, ha0, ha1] at this + have hmeet : range a ∩ range b = {w, v} := by + ext y + constructor + · rintro ⟨⟨r, rfl⟩, ⟨r', e⟩⟩ + rcases hab.meet r r' e.symm with ⟨h0, -⟩ | ⟨h1, -⟩ + · exact .inl (by rw [h0, ha0]) + · exact .inr (by rw [h1, ha1]; rfl) + · rintro (rfl | rfl) + · exact ⟨la.left_mem, lb.left_mem⟩ + · exact ⟨la.right_mem, lb.right_mem⟩ + obtain ⟨s, t, ρ₁, ρ₂, -, -, r₁, r₂, -, -, -, -, hl, hst, hF, hbd⟩ := exists_chord hS h la lb + hr.symm hmeet hw hbc hn + have hvℓ : v ∈ ρ₁ ∪ ρ₂ := .inl r₁.right_mem + have hsub : ρ₁ ∪ ρ₂ ⊆ R := by rw [hF]; exact inter_subset_right + obtain ⟨Δ₁, Δ₂, c₁, c₂, l₁, l₂, hu, hi, d₁, d₂, hU, hI, b₁, b₂, p₁, p₂⟩ + := disc_split h.disc hsub hst hl hbd + have hfr : frontier A ∩ R = ρ₁ ∪ ρ₂ := by rw [IsClosedDisc.frontier_eq_discBd hS hA, hF] + have hin : v ∈ closure (interior A) := by + rw [interior_eq_sdiff_discBd hS hA] + exact hA.subset_closure_discInt (GM11.discBd_subset A hv) + have hout : v ∈ closure Aᶜ := by + rw [closure_compl, interior_eq_sdiff_discBd hS hA] + exact fun h3 => h3.2 hv + rcases side_of_frontier hS h.disc hU hI p₁ p₂ hA.isClosed hfr hvℓ h.mem hin hout with ⟨h3, h4⟩ | + ⟨h3, h4⟩ + · exact ⟨_, s, t, Δ₁, Δ₂, c₁, c₂, hl, hst, hF.symm ▸ rfl, d₁, d₂, hU, hI, l₁, l₂, hu, hi, b₁, + b₂, hbd, hvℓ, h3, h4⟩ + · exact ⟨_, s, t, Δ₂, Δ₁, c₂, c₁, hl, hst, hF.symm ▸ rfl, d₂, d₁, by rw [union_comm, hU], + by rw [inter_comm, hI], l₂, l₁, + by rw [union_comm, hu], by rw [inter_comm, hi], b₂, b₁, hbd, hvℓ, h3, h4⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/TameDisc.lean b/LeanPool/GraphMinor/GM07/TameDisc.lean new file mode 100644 index 0000000000..40c9b4dbfd --- /dev/null +++ b/LeanPool/GraphMinor/GM07/TameDisc.lean @@ -0,0 +1,803 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.JoinDiscs +public import LeanPool.GraphMinor.GM07.Slit +public import LeanPool.GraphMinor.Surface.Collar +public import LeanPool.GraphMinor.Surface.EdgeLens +public import LeanPool.GraphMinor.GM07.StarDisc +public import LeanPool.GraphMinor.GM14.DiscSlope +public import LeanPool.GraphMinor.GM12.Section3OneDiscComplement + +/-! +# Growing a disc around a part of a drawing + +The tools here fill in two sentences of Graph Minors VII: "by Menger's theorem" in the use of Graph +Minors III, (4.1) for (5.8), and "because `G` is +boundary-linked" on page 238. Each says that a part of a drawing, cut off from the rest by a set `X` +of vertices, is cut off by a normal `O`-arc through `X`. +We grow a closed disc around the part. + +First, `exists_disc_push_off`: a closed disc grows a little past its boundary, keeping away from a +closed set. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Function GraphMinor.Surface GraphMinor.GM11 + +/-- Scaling by a bounded factor is continuous at `0`. -/ +theorem continuous_mul_of_bounded {u : ℂ → ℝ} (hu : ContinuousOn u {0}ᶜ) {M : ℝ} (hM : ∀ z, |u z| + ≤ M) : Continuous fun z : ℂ => z * (u z : ℂ) := by + rw [continuous_iff_continuousAt] + intro z + by_cases hz : z = 0 + · subst hz + rw [ContinuousAt, zero_mul] + have h1 : Filter.Tendsto (fun z : ℂ => ‖z‖ * M) (𝓝 0) (𝓝 0) := by + have : Continuous fun z : ℂ => ‖z‖ * M := by fun_prop + simpa using this.tendsto 0 + refine squeeze_zero_norm (fun z => ?_) h1 + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs] + exact mul_le_mul_of_nonneg_left (hM z) (norm_nonneg z) + · have h2 : ContinuousAt u z := hu.continuousAt (isOpen_compl_singleton.mem_nhds hz) + exact continuousAt_id.mul (Complex.continuous_ofReal.continuousAt.comp h2) + +/-- The point of the unit circle in the direction of `z`. -/ +noncomputable def dirOf (z : ℂ) : ℂ := z / (‖z‖ : ℂ) + +theorem norm_dirOf {z : ℂ} (hz : z ≠ 0) : ‖dirOf z‖ = 1 := by + rw [dirOf, norm_div, Complex.norm_real, norm_norm, div_self (norm_ne_zero_iff.mpr hz)] + +theorem continuousOn_dirOf : ContinuousOn dirOf {0}ᶜ := by + refine ContinuousOn.div continuousOn_id (by fun_prop) fun z hz => ?_ + simpa using hz + +theorem eq_mul_dirOf {z : ℂ} (hz : z ≠ 0) : z = (‖z‖ : ℂ) * dirOf z := by + have : (‖z‖ : ℂ) ≠ 0 := by simpa using hz + rw [dirOf] + field_simp + +theorem dirOf_of_norm_one {z : ℂ} (hz : ‖z‖ = 1) : dirOf z = z := by + simp [dirOf, hz] + +theorem dirOf_mul_pos {z : ℂ} {r : ℝ} (hr : 0 < r) (hz : z ≠ 0) : dirOf ((r : ℂ) * z) = dirOf z + := by + have h0 : (r : ℂ) ≠ 0 := by simpa using hr.ne' + have h1 : (‖z‖ : ℂ) ≠ 0 := by simpa using hz + rw [dirOf, dirOf, norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hr] + push_cast + field_simp + +variable {T : Type*} [TopologicalSpace T] [T2Space T] + +private theorem radial_push_injective + (Z₁ : Set ℂ) + (m : ℂ → ℂ) + (u : ℂ → ℝ) + (hu : u = fun z => 1 + infDist (dirOf z) Z₁ / 2) + (hun : ∀ (z : ℂ), 1 ≤ u z) + (hm0 : m 0 = 0) + (hmne : ∀ (z : ℂ), z ≠ 0 → m z ≠ 0) + (hnorm : ∀ (z : ℂ), z ≠ 0 → ‖m z‖ = ‖z‖ * u z) + (hdir : ∀ (z : ℂ), z ≠ 0 → dirOf (m z) = dirOf z) + (a : ℂ) + (b : ℂ) + (he : m a = m b) : + a = b := by + by_cases ha : a = 0 + · subst ha + by_contra hne + exact hmne b (Ne.symm hne) (by rw [← he, hm0]) + by_cases hb : b = 0 + · subst hb + exact absurd (he.trans hm0) (hmne a ha) + have h1 : dirOf a = dirOf b := by rw [← hdir a ha, he, hdir b hb] + have h2 : u a = u b := by simp only [hu, h1] + have h3 : ‖a‖ = ‖b‖ := by + have := hnorm a ha + rw [he, hnorm b hb, h2] at this + have h4 := hun b + exact (mul_right_cancel₀ (by linarith) this).symm + rw [eq_mul_dirOf ha, eq_mul_dirOf hb, h1, h3] + +private theorem radial_push_avoids_outer_set + (Z₁ : Set ℂ) + (m : ℂ → ℂ) + (u : ℂ → ℝ) + (hu : u = fun z => 1 + infDist (dirOf z) Z₁ / 2) + (hun : ∀ (z : ℂ), 1 ≤ u z) + (hm0 : m 0 = 0) + (hmne : ∀ (z : ℂ), z ≠ 0 → m z ≠ 0) + (hnorm : ∀ (z : ℂ), z ≠ 0 → ‖m z‖ = ‖z‖ * u z) + (hdir : ∀ (z : ℂ), z ≠ 0 → dirOf (m z) = dirOf z) + (z : ℂ) + (hz : z ∈ closedBall 0 1) + (h1 : m z ∈ Z₁) : + ‖m z‖ ≤ 1 := by + by_contra hgt + push Not at hgt + have h0 : z ≠ 0 := fun h => by simp [h, hm0] at hgt; linarith + have hz1 : ‖z‖ ≤ 1 := by simpa using hz + have hn := hnorm z h0 + set d := dirOf z with hd + have hdn : ‖d‖ = 1 := norm_dirOf h0 + have h2 : m z = (‖m z‖ : ℂ) * d := by + have h7 := eq_mul_dirOf (hmne z h0) + rw [hdir z h0] at h7 + exact h7 + have h3 : dist d (m z) = ‖m z‖ - 1 := by + rw [dist_comm, dist_eq_norm] + conv_lhs => rw [h2] + have heq : (‖m z‖ : ℂ) * d - d = ((‖m z‖ - 1 : ℝ) : ℂ) * d := by + push_cast + ring + rw [heq, norm_mul, hdn, mul_one, Complex.norm_real, Real.norm_eq_abs, abs_of_pos (by linarith)] + have h4 : infDist d Z₁ ≤ ‖m z‖ - 1 := h3 ▸ infDist_le_dist_of_mem h1 + have h5 : ‖m z‖ ≤ 1 + infDist d Z₁ / 2 := by + rw [hn] + have h6 : u z = 1 + infDist d Z₁ / 2 := by rw [hd, hu] + nlinarith [hun z, norm_nonneg z] + linarith + +/-- **Pushing a disc off a closed set.** A closed disc `B` inside `E` lies in a slightly larger +closed disc, which adds no point of `Z`, and whose boundary +meets `B` only in points of `Z`. -/ +theorem exists_disc_push_off {B E Z : Set T} (hB : IsClosedDisc B) (hE : IsClosedDisc E) + (hBE : B ⊆ E \ discBd E) (hZ : IsClosed Z) : + ∃ D, IsClosedDisc D ∧ B ⊆ D ∧ D ⊆ E \ discBd E ∧ Disjoint (D \ B) Z ∧ discBd D ∩ B ⊆ Z + ∧ discBd B ∩ Z ⊆ discBd D ∧ discBd D ∩ Z ⊆ discBd B := by + classical + obtain ⟨p⟩ := hB.isOArc_discBd + obtain ⟨c, c', hc, hc', hm, hm', hl, hr, hin, hs, hcp⟩ := exists_disc_collar hB hE hBE p + have hEc : IsCompact E := hE.isCompact + have hZE : IsCompact (Z ∩ E) := hEc.inter_left hZ + have hZ₀ : IsCompact (c' '' (Z ∩ E)) := hZE.image_of_continuousOn (hc'.mono inter_subset_right) + set Z₁ : Set ℂ := (c' '' (Z ∩ E) ∩ {z | 1 ≤ ‖z‖}) ∪ sphere 0 2 with hZ₁ + have hZ₁c : IsCompact Z₁ := (hZ₀.inter_right (isClosed_le continuous_const + continuous_norm)).union (isCompact_sphere 0 2) + have hZ₁ne : Z₁.Nonempty := ⟨2, .inr (by simp)⟩ + set u : ℂ → ℝ := fun z => 1 + infDist (dirOf z) Z₁ / 2 with hu + have hdist : ∀ w : ℂ, ‖w‖ = 1 → infDist w Z₁ ≤ 1 := fun w hw => by + have hmem : (2 : ℂ) * w ∈ Z₁ := .inr (by simp [hw]) + refine (infDist_le_dist_of_mem hmem).trans (le_of_eq ?_) + rw [dist_eq_norm, show w - 2 * w = -w by ring, norm_neg, hw] + have hun : ∀ z, 1 ≤ u z := fun z => by + have := infDist_nonneg (x := dirOf z) (s := Z₁) + simp only [hu] + linarith + have hub : ∀ z, z ≠ 0 → u z ≤ 3 / 2 := fun z hz => by + have := hdist _ (norm_dirOf hz) + simp only [hu] + linarith + -- At `0` the factor is arbitrary, so we cut it off. + set v : ℂ → ℝ := fun z => min (u z) (3 / 2) with hv + have hvz : ∀ z, z ≠ 0 → v z = u z := fun z hz => min_eq_left (hub z hz) + have hvb : ∀ z, |v z| ≤ 3 / 2 := fun z => by + have h1 := hun z + simp only [hv] + rw [abs_of_nonneg (le_min (by linarith) (by norm_num))] + exact min_le_right _ _ + have hvc : ContinuousOn v {0}ᶜ := by + have h1 : ContinuousOn u {0}ᶜ := by + refine continuousOn_const.add (ContinuousOn.div_const ?_ _) + exact (continuous_infDist_pt Z₁).comp_continuousOn continuousOn_dirOf + exact continuous_min.comp_continuousOn (h1.prodMk continuousOn_const) + set m : ℂ → ℂ := fun z => z * (v z : ℂ) with hmdef + have hmc : Continuous m := continuous_mul_of_bounded hvc hvb + have hmz : ∀ z, z ≠ 0 → m z = (‖z‖ * u z : ℝ) * dirOf z := fun z hz => by + have h1 := eq_mul_dirOf hz + calc z * (v z : ℂ) = ((‖z‖ : ℂ) * dirOf z) * (u z : ℂ) := by rw [← h1, hvz z hz] + _ = _ := by push_cast; ring + have hm0 : m 0 = 0 := by simp [hmdef] + have hmne : ∀ z, z ≠ 0 → m z ≠ 0 := fun z hz => by + simp only [hmdef, ne_eq, mul_eq_zero, not_or] + refine ⟨hz, ?_⟩ + rw [hvz z hz] + have := hun z + exact_mod_cast (by linarith : u z ≠ 0) + have hnorm : ∀ z, z ≠ 0 → ‖m z‖ = ‖z‖ * u z := fun z hz => by + rw [hmz z hz, norm_mul, norm_dirOf hz, mul_one, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg] + have := hun z + positivity + have hdir : ∀ z, z ≠ 0 → dirOf (m z) = dirOf z := fun z hz => by + have h1 : 0 < ‖z‖ * u z := by + have := hun z + have := norm_pos_iff.mpr hz + positivity + have h5 : dirOf z ≠ 0 := fun h => by simpa [h] using norm_dirOf hz + rw [hmz z hz, dirOf_mul_pos h1 h5] + exact dirOf_of_norm_one (norm_dirOf hz) + have hminj : Injective m := fun a b he => by + exact radial_push_injective Z₁ m u hu hun hm0 hmne hnorm hdir a b he + have hmr : ∀ z ∈ closedBall (0 : ℂ) 1, ‖m z‖ ≤ 3 / 2 := fun z hz => by + by_cases h0 : z = 0 + · rw [h0, hm0] + norm_num + · rw [hnorm z h0] + have h1 := hub z h0 + have h2 : ‖z‖ ≤ 1 := by simpa using hz + have h3 := hun z + nlinarith [norm_nonneg z] + have hball : closedBall (0 : ℂ) (3 / 2) ⊆ closedBall 0 2 := closedBall_subset_closedBall + (by norm_num) + have hmb : MapsTo m (closedBall 0 1) (closedBall 0 2) := fun z hz => hball + (by simpa using hmr z hz) + have hgi : InjOn (c ∘ m) (closedBall 0 1) := fun a ha b hb he => hminj (hl.injOn (hmb ha) + (hmb hb) he) + have hgc : ContinuousOn (c ∘ m) (closedBall 0 1) := hc.comp hmc.continuousOn hmb + have hdisc := isClosedDisc_image (closedBall_disc (s := 1) one_pos).1 hgc hgi + rw [(closedBall_disc (s := 1) one_pos).2] at hdisc + have hcball : ∀ z ∈ closedBall (0 : ℂ) 1, c z ∈ B := fun z hz => hin ▸ mem_image_of_mem c hz + have hB2 : ∀ {a : ℂ}, a ∈ closedBall (0 : ℂ) 2 → c a ∈ B → ‖a‖ ≤ 1 := fun {a} ha h1 => by + rw [← hin] at h1 + obtain ⟨b, hb, he⟩ := h1 + have := hl.injOn (closedBall_subset_closedBall (by norm_num) hb) ha he + simpa [← this] using hb + -- The boundary of the new disc meets `B` only where the factor is `1`. + have hzero : ∀ z : ℂ, ‖z‖ = 1 → u z = 1 → z ∈ Z₁ := fun z hz h1 => by + have h2 : infDist z Z₁ = 0 := by + have h3 : u z = 1 + infDist z Z₁ / 2 := by simp only [hu, dirOf_of_norm_one hz] + linarith + exact (hZ₁c.isClosed.mem_iff_infDist_zero hZ₁ne).mpr h2 + have hunit : ∀ z : ℂ, ‖z‖ = 1 → z ∈ Z₁ → u z = 1 := fun z hz h1 => by + simp only [hu, dirOf_of_norm_one hz, infDist_zero_of_mem h1] + norm_num + have hne1 : ∀ z : ℂ, ‖z‖ = 1 → z ≠ 0 := fun z hz h => by simp [h] at hz + have hZ₁pt : ∀ a : ℂ, ‖a‖ = 1 → a ∈ Z₁ → c a ∈ Z := fun a ha h1 => by + rcases h1 with ⟨⟨x, hx, rfl⟩, -⟩ | h1 + · rw [hr hx.2] + exact hx.1 + · simp [ha] at h1 + have hnotB : ∀ z ∈ closedBall (0 : ℂ) 1, m z ∈ Z₁ → ‖m z‖ ≤ 1 := fun z hz h1 => by + exact radial_push_avoids_outer_set Z₁ m u hu hun hm0 hmne hnorm hdir z hz h1 + have hin1 : ∀ z, ‖z‖ = 1 → c (m z) ∈ B → u z = 1 ∧ m z = z := fun z hz h1 => by + have h0 := hne1 z hz + have h2 : ‖m z‖ ≤ 1 := hB2 (hmb (by simp [hz])) h1 + rw [hnorm z h0, hz, one_mul] at h2 + have h3 : u z = 1 := le_antisymm h2 (hun z) + refine ⟨h3, ?_⟩ + simp only [hmdef, hvz z h0, h3] + simp + have hbdD : discBd ((c ∘ m) '' closedBall 0 1) = c '' (m '' sphere 0 1) := by + rw [hdisc.2, image_comp] + have hsZ : ∀ z : ℂ, ‖z‖ = 1 → c z ∈ Z → z ∈ Z₁ := fun z hz h1 => by + have hz2 : z ∈ closedBall (0 : ℂ) 2 := by + rw [mem_closedBall_zero_iff, hz] + norm_num + exact .inl ⟨⟨c z, ⟨h1, hm hz2⟩, hl hz2⟩, hz.ge⟩ + have hDisj : Disjoint ((c ∘ m) '' closedBall 0 1 \ B) Z := by + rw [disjoint_left] + rintro _ ⟨⟨z, hz, rfl⟩, hnB⟩ hZm + have hz2 := hmb hz + have h1 : m z ∈ Z₁ := by + by_contra hn + have h2 : ¬ ‖m z‖ ≤ 1 := fun h3 => hnB (hcball _ (by simpa using h3)) + push Not at h2 + exact hn (.inl ⟨⟨_, ⟨hZm, hm hz2⟩, hl hz2⟩, h2.le⟩) + exact hnB (hcball _ (by simpa using hnotB z hz h1)) + refine ⟨(c ∘ m) '' closedBall 0 1, hdisc.1, ?_, ?_, hDisj, ?_, ?_, ?_⟩ + · intro x hx + rw [← hin] at hx + obtain ⟨z, hz, rfl⟩ := hx + by_cases h0 : z = 0 + · exact ⟨0, by simp, by simp [h0, hm0]⟩ + · have hz1 : ‖z‖ ≤ 1 := by simpa using hz + have hp := lt_of_lt_of_le one_pos (hun z) + have hnz := norm_pos_iff.mpr h0 + set y : ℂ := ((‖z‖ / u z : ℝ) : ℂ) * dirOf z with hy + have hd0 : dirOf z ≠ 0 := fun h => by simpa [h] using norm_dirOf h0 + have hr0 : 0 < ‖z‖ / u z := by positivity + have hy0 : y ≠ 0 := mul_ne_zero (by exact_mod_cast hr0.ne') hd0 + have hdy : dirOf y = dirOf z := by + rw [hy, dirOf_mul_pos hr0 hd0] + exact dirOf_of_norm_one (norm_dirOf h0) + have huy : u y = u z := by simp only [hu, hdy] + have hny : ‖y‖ = ‖z‖ / u z := by + rw [hy, norm_mul, norm_dirOf h0, mul_one, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos hr0] + refine ⟨y, ?_, ?_⟩ + · have : ‖y‖ ≤ 1 := by + rw [hny, div_le_one hp] + linarith [hun z] + simpa using this + · change c (m y) = c z + rw [hmz y hy0, huy, hny, hdy, div_mul_cancel₀ _ hp.ne', ← eq_mul_dirOf h0] + · rintro _ ⟨z, hz, rfl⟩ + refine ⟨hm (hmb hz), fun hb => ?_⟩ + rw [← hs] at hb + obtain ⟨a, ha, he⟩ := hb + have h1 := hl.injOn (sphere_subset_closedBall ha) (hmb hz) he + have h2 := hmr z hz + rw [← h1] at h2 + simp only [mem_sphere_zero_iff_norm] at ha + linarith + · rintro x ⟨hxb, hxB⟩ + rw [hbdD] at hxb + obtain ⟨_, ⟨z, hz, rfl⟩, rfl⟩ := hxb + have hz1 : ‖z‖ = 1 := by simpa using hz + obtain ⟨h1, h2⟩ := hin1 z hz1 hxB + rw [h2] + exact hZ₁pt z hz1 (hzero z hz1 h1) + · rintro x ⟨hxb, hxZ⟩ + obtain ⟨w, rfl⟩ : ∃ w : Circle, (p w).1 = x := by + obtain ⟨w, hw⟩ := p.surjective ⟨x, hxb⟩ + exact ⟨w, congrArg Subtype.val hw⟩ + have hw1 : ‖(w : ℂ)‖ = 1 := Circle.norm_coe w + rw [← hcp w] at hxZ ⊢ + have h1 := hunit _ hw1 (hsZ _ hw1 hxZ) + rw [hbdD] + refine ⟨m w, ⟨w, by simp, rfl⟩, ?_⟩ + have h2 : m (w : ℂ) = w := by + simp only [hmdef, hvz _ (hne1 _ hw1), h1] + simp + rw [h2] + · rintro x ⟨hxb, hxZ⟩ + by_cases hxB : x ∈ B + · rw [hbdD] at hxb + obtain ⟨_, ⟨z, hz, rfl⟩, rfl⟩ := hxb + have hz1 : ‖z‖ = 1 := by simpa using hz + obtain ⟨-, h2⟩ := hin1 z hz1 hxB + have hw : ∃ w : Circle, (w : ℂ) = z := ⟨Circle.exp (Complex.arg z), by + rw [Circle.coe_exp] + have h7 := Complex.norm_mul_exp_arg_mul_I z + rw [hz1] at h7 + simpa using h7⟩ + obtain ⟨w, rfl⟩ := hw + rw [h2, hcp w] + exact (p w).2 + · exact absurd hxZ (disjoint_left.mp hDisj ⟨Surface.discBd_subset _ hxb, hxB⟩) + +omit [T2Space T] in +theorem closure_line_diff_ends {L : Set T} {u v : T} (hL : IsLineWithEnds L u v) : L ⊆ closure + (L \ {u, v}) := by + obtain ⟨f, h0, h1⟩ := hL + intro x hx + obtain ⟨z, hz⟩ := f.surjective ⟨x, hx⟩ + have hx' : x = (f z).1 := by rw [hz] + have hc : Continuous fun t : unitInterval => (f t).1 := continuous_subtype_val.comp f.continuous + have hd : closure (Ioo (0 : unitInterval) 1) = univ := by + rw [closure_Ioo zero_ne_one] + ext t + exact ⟨fun _ => trivial, fun _ => ⟨unitInterval.nonneg t, unitInterval.le_one t⟩⟩ + have h2 : (fun t : unitInterval => (f t).1) z ∈ closure ((fun t : unitInterval => + (f t).1) '' Ioo 0 1) := + image_closure_subset_closure_image hc ⟨z, by rw [hd]; trivial, rfl⟩ + rw [hx'] + refine closure_mono ?_ h2 + rintro _ ⟨t, ht, rfl⟩ + refine ⟨(f t).2, ?_⟩ + rintro (he | he) + · have := f.injective (Subtype.ext (he.trans h0.symm)) + exact ht.1.ne' this + · have := f.injective (Subtype.ext (he.trans h1.symm)) + exact ht.2.ne this + +/-- What a line must satisfy, relative to a disc `B`, a closed set `Y` and a finite set `X`, to be +absorbed: it runs from a point `a` of the boundary of `B` +outside `X` to a point `b` that is on the boundary or is a point of `X` outside `B`, and it meets +`B` and `Y` only as allowed. -/ +structure IsOutLine (X Y B L : Set T) (a b : T) : Prop where + line : IsLineWithEnds L a b + ne : a ≠ b + a_notX : a ∉ X + a_bd : a ∈ discBd B + b_mem : b ∈ discBd B ∨ b ∈ X ∧ b ∉ B + inter : L ∩ B ⊆ {a, b} + interY : L ∩ Y ⊆ X + mid : Disjoint (L \ {a, b}) X + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +/-- The chord case of `exists_disc_absorbing`: a line with both ends on the boundary of `B` lies, +with one side of it, in a larger disc. -/ +theorem exists_chord_fill (hS : IsClosedSurface T) (hsph : IsSphere T) {B L Y₀ : Set T} {a b : T} + (hB : IsClosedDisc B) (hL : IsLineWithEnds L a b) (hab : a ≠ b) + (ha : a ∈ discBd B) (hb : b ∈ discBd B) (hLB : L ∩ B ⊆ {a, b}) (hY₀ : IsPreconnected Y₀) + (hYB : Disjoint Y₀ B) (hYL : Disjoint Y₀ L) : + ∃ A₂ Δ₁ Δ₂, IsClosedDisc (B ∪ Δ₁) ∧ L ⊆ Δ₁ ∧ Disjoint Y₀ (B ∪ Δ₁) ∧ discBd (B ∪ Δ₁) = A₂ ∪ L + ∧ A₂ ⊆ discBd B ∧ IsClosed Δ₁ ∧ IsClosed Δ₂ ∧ A₂ ⊆ Δ₂ ∧ Δ₁ ∩ Δ₂ = L ∧ + (B ∪ Δ₁) ∩ Δ₂ = A₂ ∪ L ∧ B ∪ Δ₁ ∪ Δ₂ = univ := by + obtain ⟨hE, hbE⟩ := GM12.isClosedDisc_closure_compl_of_sphere hS hsph hB + set E := closure (univ \ B) with hEdef + have hfr := IsClosedDisc.frontier_eq_discBd hS hB + have hBc : IsClosed B := hB.isClosed + have hEB : E ∩ B = discBd B := by + rw [← hfr, frontier_eq_closure_inter_closure, hBc.closure_eq, compl_eq_univ_sdiff, inter_comm] + have hcov : B ∪ E = univ := by + refine eq_univ_of_forall fun x => ?_ + by_cases hx : x ∈ B + · exact .inl hx + · exact .inr (subset_closure ⟨mem_univ x, hx⟩) + have hbdB : discBd B ⊆ E := hEB ▸ inter_subset_left + have hLE : L ⊆ E := fun x hx => by + by_cases hxB : x ∈ B + · rcases hLB ⟨hx, hxB⟩ with rfl | rfl + · exact hbdB ha + · exact hbdB hb + · exact subset_closure ⟨mem_univ x, hxB⟩ + have hLbd : L ∩ discBd E = {a, b} := by + rw [hbE] + apply Subset.antisymm + · exact fun x hx => hLB ⟨hx.1, GM11.discBd_subset B hx.2⟩ + · rintro x (rfl | rfl) + · exact ⟨hL.left_mem, ha⟩ + · exact ⟨hL.right_mem, hb⟩ + obtain ⟨Δ₁, Δ₂, A₁, A₂, l₁, l₂, hun, hin, d₁, d₂, hcup, hcap, b₁, b₂, -, -⟩ + := disc_split hE hLE hab hL hLbd + rw [hbE] at hun + -- `Y₀` lies on one side. + have hYE : Y₀ ⊆ Δ₁ ∪ Δ₂ := fun x hx => by + rw [hcup] + exact (hcov.ge (mem_univ x)).resolve_left (disjoint_left.mp hYB hx) + -- By symmetry, the side away from `Y₀` is the first. + wlog hmiss : Disjoint Y₀ Δ₁ generalizing Δ₁ Δ₂ A₁ A₂ + · have hmiss₂ : Disjoint Y₀ Δ₂ := by + by_contra hn + obtain ⟨x, hx1, hx2⟩ := not_disjoint_iff.mp hn + obtain ⟨y, hy1, hy2⟩ := not_disjoint_iff.mp hmiss + obtain ⟨z, hz, hz1, hz2⟩ := isPreconnected_closed_iff.mp hY₀ _ _ d₁.isClosed d₂.isClosed hYE + ⟨y, hy1, hy2⟩ ⟨x, hx1, hx2⟩ + have : z ∈ L := hcap ▸ ⟨hz1, hz2⟩ + exact disjoint_left.mp hYL hz this + exact this Δ₂ Δ₁ A₂ A₁ l₂ l₁ (by rw [union_comm]; exact hun) (by rw [inter_comm]; exact hin) + d₂ d₁ (by rw [union_comm]; exact hcup) (by rw [inter_comm]; exact hcap) b₂ b₁ + (by rw [union_comm]; exact hYE) hmiss₂ + have hA₁Δ : A₁ ⊆ Δ₁ := fun x hx => GM11.discBd_subset Δ₁ (b₁ ▸ .inl hx) + have hA₂Δ : A₂ ⊆ Δ₂ := fun x hx => GM11.discBd_subset Δ₂ (b₂ ▸ .inl hx) + have hLΔ₁ : L ⊆ Δ₁ := fun x hx => GM11.discBd_subset Δ₁ (b₁ ▸ .inr hx) + have hLΔ₂ : L ⊆ Δ₂ := fun x hx => GM11.discBd_subset Δ₂ (b₂ ▸ .inr hx) + have hBΔ : B ∩ Δ₁ = A₁ := by + apply Subset.antisymm + · rintro x ⟨hx, hx1⟩ + have hxE : x ∈ E := hcup ▸ Or.inl hx1 + have hxb : x ∈ discBd B := hEB ▸ ⟨hxE, hx⟩ + rcases hun.ge hxb with h | h + · exact h + · have : x ∈ L := hcap ▸ ⟨hx1, hA₂Δ h⟩ + have h3 := hLB ⟨this, hx⟩ + have h4 : x ∈ A₁ ∩ A₂ := by + rw [hin]; exact h3 + exact h4.1 + · intro x hx + exact ⟨GM11.discBd_subset B (hun ▸ .inl hx), hA₁Δ hx⟩ + obtain ⟨hdisc, hbd⟩ := disc_union B Δ₁ A₁ a b hB d₁ l₁ hBΔ (hun ▸ subset_union_left) + (b₁ ▸ subset_union_left) + have hLA₁ : ∀ x ∈ L, x ∈ A₁ → x ∈ ({a, b} : Set T) := fun x hx h => + hLbd.le ⟨hx, hbE ▸ hun ▸ .inl h⟩ + have hend : ∀ x ∈ ({a, b} : Set T), x ∈ L := by + rintro x (rfl | rfl) + · exact hL.left_mem + · exact hL.right_mem + have hbdeq : discBd (B ∪ Δ₁) = A₂ ∪ L := by + rw [hbd, ← hun, b₁] + apply Subset.antisymm + · rintro x ⟨h | h, h2⟩ + · rcases h with h | h + · exact .inr (hend x (by_contra fun hn => h2 ⟨h, hn⟩)) + · exact .inl h + · rcases h with h | h + · exact .inr (hend x (by_contra fun hn => h2 ⟨h, hn⟩)) + · exact .inr h + · rintro x (h | h) + · exact ⟨.inl (.inr h), fun h3 => h3.2 (hin ▸ ⟨h3.1, h⟩)⟩ + · exact ⟨.inr (.inr h), fun h3 => h3.2 (hLA₁ x h h3.1)⟩ + refine ⟨A₂, Δ₁, Δ₂, hdisc, hLΔ₁, ?_, hbdeq, hun ▸ subset_union_right, d₁.isClosed, d₂.isClosed, + hA₂Δ, hcap, ?_, ?_⟩ + · exact disjoint_union_right.mpr ⟨hYB, hmiss⟩ + · apply Subset.antisymm + · rintro x ⟨h | h, h2⟩ + · have hxE : x ∈ E := hcup ▸ Or.inr h2 + have hxb : x ∈ discBd B := hEB ▸ ⟨hxE, h⟩ + rcases hun.ge hxb with h3 | h3 + · exact .inr (hcap ▸ ⟨hA₁Δ h3, h2⟩) + · exact .inl h3 + · exact .inr (hcap ▸ ⟨h, h2⟩) + · exact union_subset (fun x hx => ⟨.inl (GM11.discBd_subset B (hun ▸ .inr hx)), + hA₂Δ hx⟩) fun x hx => ⟨.inr (hLΔ₁ hx), hLΔ₂ hx⟩ + · refine eq_univ_of_forall fun x => ?_ + rcases hcov.ge (mem_univ x) with h | h + · exact .inl (.inl h) + · rw [← hcup] at h + rcases h with h | h + · exact .inl (.inr h) + · exact .inr h + +omit [T2Space T] in +private theorem extend_disc_over_line + {T : Type} + [TopologicalSpace T] + (hS : IsClosedSurface T) + (hsph : IsSphere T) + {ι : Type*} + (ℓ : ι → Set T) + (a : ι → T) + (b : ι → T) + {X : Set T} + {Y₀ : Set T} + (hY₀ : IsPreconnected Y₀) + (hXY : Disjoint X Y₀) + [T2Space T] + (s : Finset ι) + (B : Set T) + (Y : Set T) + (hB : IsClosedDisc B) + (hY₀Y : Y₀ ⊆ Y) + (hY₀B : Disjoint Y₀ B) + (hbY : discBd B ∩ Y ⊆ X) + (hl : ∀ i ∈ s, IsOutLine X Y B (ℓ i) (a i) (b i)) + (hp : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → ℓ i ∩ ℓ j ⊆ X) + (i : ι) + (hi : i ∈ s) + (hli : IsOutLine X Y B (ℓ i) (a i) (b i)) + (s' : Finset ι) + (hmem' : ∀ {j : ι}, j ∈ s' → j ∈ s ∧ i ≠ j) + (Z : Set T) + (hYZ : Y ⊆ Z) + (hZc : IsClosed Z) + (hZj : ∀ {j : ι}, j ∈ s' → ℓ j ⊆ Z) + (hℓZ : ℓ i ∩ Z ⊆ X) + (haZ : a i ∉ Z) : + ∃ B₁, IsClosedDisc B₁ ∧ B ⊆ B₁ ∧ ℓ i ⊆ B₁ ∧ Disjoint Y₀ B₁ ∧ discBd B₁ ∩ Y ⊆ X ∧ ∀ j ∈ s', ℓ j + ∩ B₁ ⊆ {a j, b j} ∧ a j ∈ discBd B₁ ∧ (b j ∈ discBd B₁ ∨ b j ∈ X ∧ b j ∉ B₁) ∨ discBd B₁ ∩ ℓ + j ⊆ X := by + rcases hli.b_mem with hbi | ⟨hbX, hbB⟩ + · have hYL : Disjoint Y₀ (ℓ i) := disjoint_left.mpr fun x hx hxl => + disjoint_left.mp hXY (hli.interY ⟨hxl, hY₀Y hx⟩) hx + obtain ⟨A₂, Δ₁, Δ₂, hd, hLΔ, hYd, hbd, hA₂, hc₁, hc₂, hA₂Δ, hcap, hcap', hcov⟩ + := exists_chord_fill hS hsph hB hli.line hli.ne hli.a_bd hbi hli.inter hY₀ hY₀B hYL + refine ⟨B ∪ Δ₁, hd, subset_union_left, hLΔ.trans subset_union_right, hYd, ?_, fun j hj => ?_⟩ + · rw [hbd] + rintro x ⟨h | h, hy⟩ + · exact hbY ⟨hA₂ h, hy⟩ + · exact hli.interY ⟨h, hy⟩ + obtain ⟨hjs, hij⟩ := hmem' hj + have hlj := hl j hjs + have hOi : ∀ x ∈ ℓ j \ {a j, b j}, x ∉ ℓ i := fun x hx hxi => + disjoint_left.mp hlj.mid hx (hp i hi j hjs hij ⟨hxi, hx.1⟩) + have hOB : ∀ x ∈ ℓ j \ {a j, b j}, x ∉ B := fun x hx hxB => hx.2 (hlj.inter ⟨hx.1, hxB⟩) + have hO := hlj.line.isPreconnected_diff + have hcovO : ℓ j \ {a j, b j} ⊆ Δ₁ ∪ Δ₂ := fun x hx => by + rcases hcov.ge (mem_univ x) with (h | h) | h + · exact absurd h (hOB x hx) + · exact .inl h + · exact .inr h + have hside : ℓ j \ {a j, b j} ⊆ Δ₁ ∨ ℓ j \ {a j, b j} ⊆ Δ₂ := by + by_contra hn + push Not at hn + obtain ⟨hn1, hn2⟩ := hn + obtain ⟨x, hx, hx1⟩ := not_subset.mp hn1 + obtain ⟨y, hy, hy2⟩ := not_subset.mp hn2 + obtain ⟨z, hz, hz1, hz2⟩ := isPreconnected_closed_iff.mp hO _ _ hc₁ hc₂ hcovO ⟨y, hy, + (hcovO hy).resolve_right hy2⟩ ⟨x, hx, (hcovO hx).resolve_left hx1⟩ + exact hOi z hz (hcap ▸ ⟨hz1, hz2⟩) + rcases hside with hs₁ | hs₂ + · refine .inr ?_ + have hlΔ : ℓ j ⊆ Δ₁ := (closure_line_diff_ends hlj.line).trans (closure_minimal hs₁ hc₁) + rw [hbd] + rintro x ⟨h | h, hx⟩ + · exact hp i hi j hjs hij ⟨hcap ▸ ⟨hlΔ hx, hA₂Δ h⟩, hx⟩ + · exact hp i hi j hjs hij ⟨h, hx⟩ + · refine .inl ?_ + have hlΔ : ℓ j ⊆ Δ₂ := (closure_line_diff_ends hlj.line).trans (closure_minimal hs₂ hc₂) + have hon : ∀ x, x ∈ ℓ j → x ∈ B → x ∈ discBd (B ∪ Δ₁) := fun x hx hxB => by + rw [hbd, ← hcap'] + exact ⟨.inl hxB, hlΔ hx⟩ + refine ⟨?_, hon _ hlj.line.left_mem (GM11.discBd_subset B hlj.a_bd), ?_⟩ + · rintro x ⟨hx, h | h⟩ + · exact hlj.inter ⟨hx, h⟩ + · by_contra hn + exact hOi x ⟨hx, hn⟩ (hcap ▸ ⟨h, hlΔ hx⟩) + · rcases hlj.b_mem with h | ⟨h1, h2⟩ + · exact .inl (hon _ hlj.line.right_mem (GM11.discBd_subset B h)) + · by_cases h3 : b j ∈ B ∪ Δ₁ + · refine .inl ?_ + rw [hbd, ← hcap'] + exact ⟨h3, hlΔ hlj.line.right_mem⟩ + · exact .inr ⟨h1, h3⟩ + · -- A thin disc around the line. + have hBc : IsClosed B := hB.isClosed + have hend : ∀ x ∈ ℓ i, x ∈ X → x = a i ∨ x = b i := fun x hx hxX => by + by_contra hn + have h1 : x ∉ ({a i, b i} : Set T) := hn + exact disjoint_left.mp hli.mid ⟨hx, h1⟩ hxX + have hLZ : ℓ i ∩ (B ∪ Z) ⊆ {a i, b i} := by + rintro x ⟨hx, h | h⟩ + · exact hli.inter ⟨hx, h⟩ + · exact hend x hx (hℓZ ⟨hx, h⟩) + obtain ⟨D, -, -, hD, hLD, hDZ, haD, hbD, -, -⟩ := exists_edge_lens hS hli.line hli.ne + (hBc.union hZc) hLZ + have hab : B ∩ D = {a i} := by + apply Subset.antisymm + · rintro x ⟨h1, h2⟩ + rcases hDZ ⟨h2, .inl h1⟩ with h | h + · exact h + · exact absurd (h ▸ h1) hbB + · rintro x rfl + exact ⟨GM11.discBd_subset B hli.a_bd, GM11.discBd_subset D haD⟩ + obtain ⟨D', hD', hsub, hsup, -, hkeep, hbsub⟩ := exists_join hS hB hD hab hli.a_bd haD + hZc.isOpen_compl haZ + have hb'Z : ∀ x ∈ discBd D', x ∈ Z → x ∈ discBd B ∨ x ∈ D := fun x hx hxZ => by + rcases hbsub hx with (h | h) | h + · exact .inl h + · exact .inr (GM11.discBd_subset D h) + · exact absurd hxZ h + have hD'Z : ∀ x ∈ D', x ∈ Z → x ∈ B ∨ x ∈ D := fun x hx hxZ => by + rcases hsup hx with (h | h) | h + · exact .inl h + · exact .inr h + · exact absurd hxZ h + have hDZ' : ∀ x ∈ D, x ∈ Z → x = b i := fun x hx hxZ => by + rcases hDZ ⟨hx, .inr hxZ⟩ with rfl | h + · exact absurd hxZ haZ + · exact h + refine ⟨D', hD', subset_union_left.trans hsub, hLD.trans (subset_union_right.trans hsub), + ?_, ?_, fun j hj => .inl ?_⟩ + · refine disjoint_left.mpr fun x hx hxD => ?_ + have hxZ : x ∈ Z := hYZ (hY₀Y hx) + rcases hD'Z x hxD hxZ with h | h + · exact disjoint_left.mp hY₀B hx h + · exact disjoint_left.mp hXY (hDZ' x h hxZ ▸ hbX) hx + · rintro x ⟨hx, hy⟩ + rcases hb'Z x hx (hYZ hy) with h | h + · exact hbY ⟨h, hy⟩ + · rw [hDZ' x h (hYZ hy)] + exact hbX + · obtain ⟨hjs, hij⟩ := hmem' hj + have hlj := hl j hjs + have hjZ := hZj hj + have hkeepZ : ∀ x, x ∈ Z → x ∈ discBd B ∪ discBd D → x ∈ discBd D' := fun x hx h + => hkeep ⟨h, not_not.mpr hx⟩ + have hbon : ∀ x, x ∈ Z → x ∈ D' → x ∉ B → x ∈ discBd D' := fun x hx h1 h2 => by + rcases hD'Z x h1 hx with h | h + · exact absurd h h2 + · rw [hDZ' x h hx] + exact hkeepZ _ (hDZ' x h hx ▸ hx) (.inr hbD) + refine ⟨?_, hkeepZ _ (hjZ hlj.line.left_mem) (.inl hlj.a_bd), ?_⟩ + · rintro x ⟨hx, hxD⟩ + rcases hD'Z x hxD (hjZ hx) with h | h + · exact hlj.inter ⟨hx, h⟩ + · have h3 := hDZ' x h (hjZ hx) + have h4 : x ∈ X := hp i hi j hjs hij ⟨h3 ▸ hli.line.right_mem, hx⟩ + by_contra hn + exact disjoint_left.mp hlj.mid ⟨hx, hn⟩ h4 + · rcases hlj.b_mem with h | ⟨h1, h2⟩ + · exact .inl (hkeepZ _ (hjZ hlj.line.right_mem) (.inl h)) + · by_cases h3 : b j ∈ D' + · exact .inl (hbon _ (hjZ hlj.line.right_mem) h3 h2) + · exact .inr ⟨h1, h3⟩ + +omit [T2Space T] in +/-- **Absorbing lines into a disc.** On a sphere, let `B` be a closed disc and let `ℓ` be finitely +many lines, which run outside `B` from its boundary to its boundary +or to points of `X`. They meet each other and `Y` only in `X`. Then a larger disc holds `B`, it +misses the connected set `Y₀`, and its boundary meets `Y` and the +lines only in `X`. We take the lines one at a time. A line with both ends on `B` is added with the +side of it away from `Y₀`, and any other line is added with a +thin disc around it. Then `exists_disc_push_off` takes the boundary off the line. -/ +theorem exists_disc_absorbing (hS : IsClosedSurface T) (hsph : IsSphere T) {ι : Type*} (ℓ : ι + → Set T) (a b : ι → T) {X Y₀ : Set T} (hY₀ : IsPreconnected Y₀) + (hY₀n : Y₀.Nonempty) (hXY : Disjoint X Y₀) : + ∀ (n : ℕ) (s : Finset ι), s.card = n → ∀ B Y : Set T, IsClosedDisc B → IsClosed Y → Y₀ ⊆ Y + → Disjoint Y₀ B → discBd B ∩ Y ⊆ X → + (∀ i ∈ s, IsOutLine X Y B (ℓ i) (a i) (b i)) → (∀ i ∈ s, ∀ j ∈ s, i ≠ j → ℓ i ∩ ℓ j ⊆ X) → + ∃ B', IsClosedDisc B' ∧ B ⊆ B' ∧ Disjoint Y₀ B' ∧ discBd B' ∩ Y ⊆ X + ∧ ∀ i ∈ s, discBd B' ∩ ℓ i ⊆ X := by + classical + have ht2 : T2Space T := hS.2.1 + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + intro n + induction n using Nat.strong_induction_on with + | _ n ih => + intro s hs B Y hB hY hY₀Y hY₀B hbY hl hp + rcases s.eq_empty_or_nonempty with rfl | ⟨i, hi⟩ + · exact ⟨B, hB, Subset.rfl, hY₀B, hbY, by simp⟩ + have hli := hl i hi + set s' := s.erase i with hs' + have hmem' : ∀ {j}, j ∈ s' → j ∈ s ∧ i ≠ j := fun {j} hj => by + rw [hs', Finset.mem_erase] at hj + exact ⟨hj.2, hj.1.symm⟩ + set Z : Set T := Y ∪ ⋃ j ∈ s', ℓ j with hZ + have hZc : IsClosed Z := hY.union (s'.finite_toSet.isClosed_biUnion fun j hj => (hl j + (hmem' hj).1).line.isCompact.isClosed) + have hZj : ∀ {j}, j ∈ s' → ℓ j ⊆ Z := fun {j} hj x hx => .inr (mem_iUnion₂.mpr ⟨j, hj, hx⟩) + have hℓZ : ℓ i ∩ Z ⊆ X := by + rintro x ⟨h1, h2 | h2⟩ + · exact hli.interY ⟨h1, h2⟩ + · obtain ⟨j, hj, h3⟩ := mem_iUnion₂.mp h2 + exact hp i hi j (hmem' hj).1 (hmem' hj).2 ⟨h1, h3⟩ + have haZ : a i ∉ Z := fun h => hli.a_notX (hℓZ ⟨hli.line.left_mem, h⟩) + -- The disc that holds the line `ℓ i`. + have hstep : ∃ B₁, IsClosedDisc B₁ ∧ B ⊆ B₁ ∧ ℓ i ⊆ B₁ ∧ Disjoint Y₀ B₁ ∧ discBd B₁ ∩ Y ⊆ X + ∧ ∀ j ∈ s', + (ℓ j ∩ B₁ ⊆ {a j, b j} ∧ a j ∈ discBd B₁ ∧ (b j ∈ discBd B₁ ∨ b j ∈ X ∧ b j ∉ B₁)) + ∨ discBd B₁ ∩ ℓ j ⊆ X := by + exact extend_disc_over_line (T := T) hS hsph (ι := ι) ℓ a b (X := X) (Y₀ := Y₀) hY₀ hXY s B Y + hB hY₀Y hY₀B hbY hl hp i hi hli s' hmem' Z subset_union_left hZc hZj hℓZ haZ + obtain ⟨B₁, hB₁, hBB₁, hℓB₁, hY₀B₁, hb₁Y, hdich⟩ := hstep + -- Move the boundary off the line. + obtain ⟨w, hw⟩ := hY₀n + have hwB₁ : w ∉ B₁ := disjoint_left.mp hY₀B₁ hw + obtain ⟨E, hE, hsubE, -⟩ := exists_disc_around hman hB₁ (fun x _ => hS.2.2 x) (W + := {w}ᶜ) isOpen_compl_singleton + (fun x hx (h : x = w) => hwB₁ (h ▸ GM11.discBd_subset B₁ hx)) + obtain ⟨D, hD, hB₁D, -, hdiff, hbdZ, hkeep, hbdZ'⟩ := exists_disc_push_off hB₁ hE hsubE hZc + have hDZ : ∀ x ∈ D, x ∈ Z → x ∈ B₁ := fun x hx hxZ => by + by_contra hn + exact disjoint_left.mp hdiff ⟨hx, hn⟩ hxZ + set keep : Set ι := {j | ℓ j ∩ B₁ ⊆ {a j, b j} ∧ a j ∈ discBd B₁ ∧ (b j ∈ discBd B₁ ∨ b j ∈ X + ∧ b j ∉ B₁)} with hkeepdef + set s'' := s'.filter (· ∈ keep) with hs'' + set Y' : Set T := Y ∪ (ℓ i ∪ ⋃ j ∈ s' \ s'', ℓ j) with hY' + have hsplit : ∀ j ∈ s', j ∈ s'' ∨ j ∈ s' \ s'' := fun j hj => by + by_cases h : j ∈ s'' + · exact .inl h + · exact .inr (Finset.mem_sdiff.mpr ⟨hj, h⟩) + have hgone : ∀ j ∈ s' \ s'', discBd B₁ ∩ ℓ j ⊆ X := fun j hj => by + obtain ⟨h1, h2⟩ := Finset.mem_sdiff.mp hj + rcases hdich j h1 with h | h + · exact absurd (Finset.mem_filter.mpr ⟨h1, h⟩) h2 + · exact h + have hsub'' : ∀ {j}, j ∈ s'' → j ∈ s' := fun {j} hj => (Finset.mem_filter.mp hj).1 + have hY'c : IsClosed Y' := hY.union (hli.line.isCompact.isClosed.union + (((s' \ s'').finite_toSet).isClosed_biUnion fun j hj => + (hl j (hmem' (Finset.mem_sdiff.mp hj).1).1).line.isCompact.isClosed)) + have hcard : s''.card < n := by + have h1 : s''.card ≤ s'.card := Finset.card_filter_le _ _ + have h2 : s'.card = s.card - 1 := Finset.card_erase_of_mem hi + have h3 := Finset.card_pos.mpr ⟨i, hi⟩ + omega + have hD_bdY' : discBd D ∩ Y' ⊆ X := by + rintro x ⟨hx, h | h | h⟩ + · exact hb₁Y ⟨hbdZ' ⟨hx, .inl h⟩, h⟩ + · rcases hbdZ ⟨hx, hℓB₁ h⟩ with h2 | h2 + · exact hli.interY ⟨h, h2⟩ + · obtain ⟨j, hj, h3⟩ := mem_iUnion₂.mp h2 + exact hp i hi j (hmem' hj).1 (hmem' hj).2 ⟨h, h3⟩ + · obtain ⟨j, hj, h3⟩ := mem_iUnion₂.mp h + have hj' := (Finset.mem_sdiff.mp hj).1 + exact hgone j hj ⟨hbdZ' ⟨hx, hZj hj' h3⟩, h3⟩ + have hlines : ∀ j ∈ s'', IsOutLine X Y' D (ℓ j) (a j) (b j) := fun j hj => by + have hj' := hsub'' hj + obtain ⟨hjs, hij⟩ := hmem' hj' + have hlj := hl j hjs + obtain ⟨h1, h2, h3⟩ : j ∈ keep := (Finset.mem_filter.mp hj).2 + have hjZ := hZj hj' + refine ⟨hlj.line, hlj.ne, hlj.a_notX, hkeep ⟨h2, hjZ hlj.line.left_mem⟩, ?_, ?_, ?_, hlj.mid⟩ + · rcases h3 with h | ⟨h4, h5⟩ + · exact .inl (hkeep ⟨h, hjZ hlj.line.right_mem⟩) + · exact .inr ⟨h4, fun h6 => h5 (hDZ _ h6 (hjZ hlj.line.right_mem))⟩ + · exact fun x hx => h1 ⟨hx.1, hDZ x hx.2 (hjZ hx.1)⟩ + · rintro x ⟨hx, h | h | h⟩ + · exact hlj.interY ⟨hx, h⟩ + · exact hp i hi j hjs hij ⟨h, hx⟩ + · obtain ⟨k, hk, h4⟩ := mem_iUnion₂.mp h + obtain ⟨hk1, hk2⟩ := Finset.mem_sdiff.mp hk + have hjk : j ≠ k := fun e => hk2 (e ▸ hj) + exact hp j hjs k (hmem' hk1).1 hjk ⟨hx, h4⟩ + obtain ⟨B', hB', hDB', hYB', hbY', hbl⟩ := ih s''.card hcard s'' rfl D Y' hD hY'c + (hY₀Y.trans subset_union_left) + (disjoint_left.mpr fun x hx hxD => disjoint_left.mp hY₀B₁ hx (hDZ x hxD (.inl + (hY₀Y hx)))) hD_bdY' hlines + (fun j hj k hk => hp j (hmem' (hsub'' hj)).1 k (hmem' (hsub'' hk)).1) + refine ⟨B', hB', hBB₁.trans (hB₁D.trans hDB'), hYB', fun x hx => hbY' ⟨hx.1, .inl hx.2⟩, + fun j hj => ?_⟩ + by_cases hji : j = i + · subst hji + exact fun x hx => hbY' ⟨hx.1, .inr (.inl hx.2)⟩ + have hj' : j ∈ s' := Finset.mem_erase.mpr ⟨hji, hj⟩ + rcases hsplit j hj' with h | h + · exact hbl j h + · exact fun x hx => hbY' ⟨hx.1, .inr (.inr (mem_iUnion₂.mpr ⟨j, h, hx.2⟩))⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/TameLines.lean b/LeanPool/GraphMinor/GM07/TameLines.lean new file mode 100644 index 0000000000..49022538e3 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/TameLines.lean @@ -0,0 +1,699 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.TameDisc +public import LeanPool.GraphMinor.GM07.SplitForest +public import LeanPool.GraphMinor.GM07.JoinDiscs + +/-! +# How an edge leaves a disc around its end + +Let `R` be a star disc at an end of an edge, and let `γ` be a parametrization of the edge. The edge +leaves `R` once, and it does not come back, except at its other +end if that end is the same vertex. So the edge is cut by the boundaries of the discs around its +ends into three pieces, and the middle one is a line that the tools +of `GM07.TameDisc` can absorb. +-/ + +public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Function GraphMinor.Surface GraphMinor.GM11 + +local notation "I" => unitInterval + +variable {T : Type} [TopologicalSpace T] [T2Space T] {H : Drawing T} {f : Set T} {γ : I → T} + +/-- A connected part of the closure of an edge that holds an end and an inner point holds one of the +two ways from one to the other. -/ +theorem EdgeParam.arc_of_preconnected (h : EdgeParam H f γ) (hf : f ∈ H.E) {C : Set T} + (hC : IsPreconnected C) (hsub : C ⊆ range γ) (h0 : γ 0 ∈ C) {τ : I} + (hy : γ τ ∈ C) : γ '' Icc 0 τ ⊆ C ∨ γ '' Icc τ 1 ⊆ C := by + by_contra hn + push Not at hn + obtain ⟨hn1, hn2⟩ := hn + obtain ⟨_, ⟨a, ha, rfl⟩, haC⟩ := not_subset.mp hn1 + obtain ⟨_, ⟨b, hb, rfl⟩, hbC⟩ := not_subset.mp hn2 + have hat : a < τ := lt_of_le_of_ne ha.2 fun e => haC (e ▸ hy) + have htb : τ < b := lt_of_le_of_ne hb.1 fun e => hbC (e ▸ hy) + have hcl : ∀ u v : I, IsClosed (γ '' Icc u v) := fun u v => (isCompact_Icc.image h.cont).isClosed + have hcov : C ⊆ γ '' Icc a b ∪ (γ '' Icc 0 a ∪ γ '' Icc b 1) := fun x hx => by + obtain ⟨z, rfl⟩ := hsub hx + by_cases h1 : z ≤ a + · exact .inr (.inl ⟨z, ⟨unitInterval.nonneg z, h1⟩, rfl⟩) + by_cases h2 : b ≤ z + · exact .inr (.inr ⟨z, ⟨h2, unitInterval.le_one z⟩, rfl⟩) + · exact .inl ⟨z, ⟨le_of_not_ge h1, le_of_not_ge h2⟩, rfl⟩ + obtain ⟨z, hz, ⟨p, hp, rfl⟩, hz2⟩ := isPreconnected_closed_iff.mp hC _ _ (hcl a b) + ((hcl 0 a).union (hcl b 1)) hcov + ⟨_, hy, τ, ⟨hat.le, htb.le⟩, rfl⟩ ⟨_, h0, .inl ⟨0, ⟨le_rfl, unitInterval.nonneg a⟩, rfl⟩⟩ + have hpa : a < p := lt_of_le_of_ne hp.1 fun e => haC (e ▸ hz) + have hpb : p < b := lt_of_le_of_ne hp.2 fun e => hbC (e ▸ hz) + have hp0 : 0 < p := lt_of_le_of_lt (unitInterval.nonneg a) hpa + have hp1 : p < 1 := lt_of_lt_of_le hpb (unitInterval.le_one b) + have hq : ∃ q, γ q = γ p ∧ (q ≤ a ∨ b ≤ q) := by + rcases hz2 with ⟨q, hq, he⟩ | ⟨q, hq, he⟩ + · exact ⟨q, he, .inl hq.2⟩ + · exact ⟨q, he, .inr hq.1⟩ + obtain ⟨q, he, hqc⟩ := hq + have hqV := (h.pos_of_ne (y := q) (he ▸ h.not_V hf hp0 hp1)) + have := h.inj ⟨hqV.1, hqV.2⟩ ⟨hp0, hp1⟩ he + subst this + rcases hqc with h1 | h1 + · exact absurd h1 (not_le.mpr hpa) + · exact absurd h1 (not_le.mpr hpb) + +/-- The first time a path from inside a disc reaches its boundary. -/ +theorem exists_first_exit {R : Set T} {γ : I → T} (hc : Continuous γ) (hR : IsClosedDisc R) + (hint : IsOpen (discInt R)) (h0 : γ 0 ∈ discInt R) {z : I} (hz : γ z ∉ R) : + ∃ s, 0 < s ∧ s < z ∧ γ s ∈ discBd R ∧ ∀ τ < s, γ τ ∈ discInt R := by + have hA : IsClosed {τ | γ τ ∉ discInt R} := (hint.preimage hc).isClosed_compl + have hzA : z ∈ {τ | γ τ ∉ discInt R} := fun h => hz h.1 + obtain ⟨s, hs, hl⟩ := hA.isCompact.exists_isLeast ⟨z, hzA⟩ + have h0s : 0 < s := unitInterval.pos_iff_ne_zero.mpr fun e => hs (e ▸ h0) + have hpre : ∀ τ < s, γ τ ∈ discInt R := fun τ hτ => by + by_contra hn + exact absurd (hl hn) (not_le.mpr hτ) + have hsR : γ s ∈ R := by + have h1 : s ∈ closure (Iio s) := by + have hne : (Iio s).Nonempty := ⟨0, h0s⟩ + rw [closure_Iio' hne] + exact le_refl s + have h2 := image_closure_subset_closure_image hc ⟨s, h1, rfl⟩ + refine closure_minimal ?_ hR.isClosed h2 + rintro _ ⟨τ, hτ, rfl⟩ + exact (hpre τ hτ).1 + refine ⟨s, h0s, lt_of_le_of_ne (hl hzA) fun e => hz (e ▸ hsR), ?_, hpre⟩ + by_contra hn + exact hs ⟨hsR, hn⟩ + +/-- After it leaves a star disc at `γ 0`, an edge comes back only at the place `t`, where it reaches +the boundary from the other side, or not at all if its other end +is outside the disc. -/ +theorem EdgeParam.no_return (h : EdgeParam H f γ) (hf : f ∈ H.E) {R : Set T} + (hstar : ∀ y ∈ R ∩ range γ, ∃ C, IsPreconnected C ∧ C ⊆ range γ ∧ y ∈ C ∧ γ 0 ∈ C + ∧ C \ {y} ⊆ discInt R) + {s t : I} (hs : 0 < s) (hsb : γ s ∈ discBd R) (hend : γ 1 ∉ R ∨ t < 1 ∧ γ t ∈ discBd R) {τ : I} + (hsτ : s < τ) (hτt : τ < t) : γ τ ∉ R := by + intro hy + have hτ0 : 0 < τ := hs.trans hsτ + have hτ1 : τ < 1 := lt_of_lt_of_le hτt (unitInterval.le_one t) + have hbad : ∀ q, 0 < q → q < 1 → q ≠ τ → γ q ≠ γ τ := fun q h1 h2 h3 he => h3 + (h.inj ⟨h1, h2⟩ ⟨hτ0, hτ1⟩ he) + have hnotbd : ∀ x, x ∈ discInt R → x ∉ discBd R := fun x h1 => h1.2 + obtain ⟨C, hC, hsub, hyC, h0, hin⟩ := hstar _ ⟨hy, mem_range_self τ⟩ + have hs1 : s < 1 := hsτ.trans hτ1 + rcases h.arc_of_preconnected hf hC hsub h0 hyC with h1 | h1 + · exact hnotbd _ (hin ⟨h1 ⟨s, ⟨hs.le, hsτ.le⟩, rfl⟩, hbad s hs hs1 hsτ.ne⟩) hsb + · rcases hend with h2 | ⟨h2, h3⟩ + · have h4 : γ 1 ≠ γ τ := fun e => h.not_V hf hτ0 hτ1 (e ▸ h.mem1) + exact h2 (hin ⟨h1 ⟨1, ⟨hτ1.le, le_rfl⟩, rfl⟩, h4⟩).1 + · have ht0 := hτ0.trans hτt + exact hnotbd _ (hin ⟨h1 ⟨t, ⟨hτt.le, unitInterval.le_one t⟩, rfl⟩, hbad t ht0 h2 hτt.ne'⟩) h3 + +/-- A piece of an edge is a line. -/ +theorem EdgeParam.line_Icc (h : EdgeParam H f γ) (hf : f ∈ H.E) {s t : I} (hs : 0 < s) + (hst : s < t) : IsLineWithEnds (γ '' Icc s t) (γ s) (γ t) := by + have ha : IsArcMap (subArc γ s t) := by + refine ⟨h.cont.comp (continuous_lerpI _ _), ?_⟩ + intro x y he + have hm : ∀ z, lerpI s t z ∈ Icc s t := fun z => by + rw [← range_lerpI hst.le] + exact mem_range_self z + have hin : ∀ q ∈ Icc s t, q < 1 ∨ q = 1 := fun q _ => lt_or_eq_of_le (unitInterval.le_one q) + refine lerpI_injective hst.ne ?_ + replace he : γ (lerpI s t x) = γ (lerpI s t y) := he + have hx := hm x + have hy := hm y + have hs0 : ∀ q ∈ Icc s t, 0 < q := fun q hq => hs.trans_le hq.1 + rcases hin _ hx with h1 | h1 + · rcases hin _ hy with h2 | h2 + · exact h.inj ⟨hs0 _ hx, h1⟩ ⟨hs0 _ hy, h2⟩ he + · rw [h2] at he + exact absurd h.mem1 (he ▸ h.not_V hf (hs0 _ hx) h1) + · rcases hin _ hy with h2 | h2 + · rw [h1] at he + exact absurd h.mem1 (he.symm ▸ h.not_V hf (hs0 _ hy) h2) + · rw [h1, h2] + have := isLineWithEnds_range_of_arc ha + rwa [range_subArc _ hst.le, subArc_zero, subArc_one] at this + +/-- **A chord of a star disc along a curve.** If `R` is a star disc at a point `v` of the `O`-arc +`C`, and `C` is not inside `R`, then `R ∩ C` is a chord of `R` through `v`. -/ +theorem exists_star_chord {C R : Set T} {v z : T} (hC : IsOArc C) (hv : v ∈ C) + (hR : IsClosedDisc R) (hint : IsOpen (discInt R)) (hvR : v ∈ discInt R) (hz : z ∈ C) (hzR : z ∉ R) + (hstar : ∀ y ∈ R ∩ C, ∃ C', IsPreconnected C' ∧ C' ⊆ C ∧ y ∈ C' ∧ v ∈ C' + ∧ C' \ {y} ⊆ discInt R) : + ∃ F y₁ y₂, IsLineWithEnds F y₁ y₂ ∧ y₁ ≠ y₂ ∧ F ⊆ R ∧ F ∩ discBd R = {y₁, y₂} ∧ R ∩ C = F + ∧ v ∈ F := by + obtain ⟨ι, hιc, h0, h1, hi0, hi1, him⟩ := hC.exists_iota hv + obtain ⟨D, hDU, hDV⟩ := exists_loop_drawing hC hv + set γ : I → T := fun t => ι t with hγdef + have hvD : v ∈ D.V := hDV ▸ mem_singleton v + have hIoo : γ '' Ioo 0 1 = C \ {v} := by + ext x + constructor + · rintro ⟨t, ht, rfl⟩ + have h2 : (0 : ℝ) < t := ht.1 + have h3 : (t : ℝ) < 1 := ht.2 + refine ⟨him ▸ mem_image_of_mem ι ⟨h2.le, h3⟩, fun e => ?_⟩ + have h4 : ι t = ι 0 := by rw [h0]; exact e + exact h2.ne' (hi0 ⟨h2.le, h3⟩ ⟨le_rfl, one_pos⟩ h4) + · rintro ⟨hx, hxv⟩ + rw [← him] at hx + obtain ⟨r, hr, rfl⟩ := hx + have hr0 : 0 < r := lt_of_le_of_ne hr.1 fun e => hxv (by rw [← e]; exact h0) + exact ⟨⟨r, hr.1, hr.2.le⟩, ⟨hr0, hr.2⟩, rfl⟩ + have hγ : EdgeParam D (C \ {v}) γ := by + refine ⟨hιc.comp continuous_subtype_val, ?_, ?_, ?_, hIoo⟩ + · change ι 0 ∈ D.V + rwa [h0] + · change ι 1 ∈ D.V + rwa [h1] + · intro a ha b hb he + have ha0 : (0 : ℝ) ≤ a := a.2.1 + have hb0 : (0 : ℝ) ≤ b := b.2.1 + exact Subtype.ext (hi0 ⟨ha0, ha.2⟩ ⟨hb0, hb.2⟩ he) + have hf : C \ {v} ∈ D.E := by + have hpc : IsPathConnected (C \ {v}) := by + rw [← hIoo] + exact hγ.isPathConnected_Ioo zero_lt_one + have hE : D.U \ D.V = C \ {v} := by rw [hDU, hDV] + change C \ {v} ∈ arcComponentsIn (D.U \ D.V) + rw [hE] + exact ⟨hpc.nonempty, Subset.rfl, hpc, fun E h1 _ h3 => Subset.antisymm h1 h3⟩ + have hrange : range γ = C := by + apply Subset.antisymm + · rintro _ ⟨t, rfl⟩ + by_cases h2 : t = 1 + · subst h2 + change ι 1 ∈ C + rwa [h1] + · exact him ▸ mem_image_of_mem ι ⟨t.2.1, lt_of_le_of_ne t.2.2 fun e => h2 (Subtype.ext e)⟩ + · intro x hx + rw [← him] at hx + obtain ⟨r, hr, rfl⟩ := hx + exact ⟨⟨r, hr.1, hr.2.le⟩, rfl⟩ + have hv0 : γ 0 = v := h0 + have hv1 : γ 1 = v := h1 + obtain ⟨m, rfl⟩ : ∃ m, γ m = z := by + have : z ∈ range γ := hrange ▸ hz + exact this + have hmv : γ m ∉ D.V := fun h => by + rw [hDV] at h + exact hzR (h ▸ hvR.1) + obtain ⟨hm0, hm1⟩ := hγ.pos_of_ne hmv + obtain ⟨s, hs0, hsm, hsb, hspre⟩ := exists_first_exit hγ.cont hR hint (hv0.symm ▸ hvR) hzR + have hγ' := hγ.rev + have hσ : ∀ x : I, (γ ∘ unitInterval.symm) (unitInterval.symm x) = γ x := fun x => by simp + obtain ⟨t', ht0, htm, htb, htpre⟩ := exists_first_exit (z := unitInterval.symm m) hγ'.cont hR + hint (by simpa [hv1] using hvR) (by simpa using hzR) + set t := unitInterval.symm t' with ht + have hγt : γ t = (γ ∘ unitInterval.symm) t' := rfl + have hmt : m < t := by + have := unitInterval.symm_lt_symm.mpr htm + simpa [ht] using this + have ht1 : t < 1 := by + have := unitInterval.symm_lt_symm.mpr ht0 + simpa [ht] using this + have hs1 : s < 1 := hsm.trans hm1 + have hst : s < t := hsm.trans hmt + have hL₁ := hγ.line hf hs0 hs1 + have ht'1 : t' < 1 := htm.trans_le (unitInterval.le_one _) + have hL₂ := hγ'.line hf ht0 ht'1 + rw [hv0] at hL₁ + have hv' : (γ ∘ unitInterval.symm) 0 = v := by simpa using hv1 + rw [hv'] at hL₂ + have hL₂eq : (γ ∘ unitInterval.symm) '' Icc 0 t' = γ '' Icc t 1 := by + ext x + constructor + · rintro ⟨r, hr, rfl⟩ + refine ⟨unitInterval.symm r, ⟨?_, unitInterval.le_one _⟩, rfl⟩ + exact unitInterval.symm_le_symm.mpr hr.2 + · rintro ⟨r, hr, rfl⟩ + refine ⟨unitInterval.symm r, ⟨unitInterval.nonneg _, ?_⟩, by simp⟩ + have := unitInterval.symm_le_symm.mpr hr.1 + simpa [ht] using this + rw [hL₂eq] at hL₂ + have hmeet : γ '' Icc 0 s ∩ γ '' Icc t 1 = {v} := by + apply Subset.antisymm + · rintro _ ⟨⟨a, ha, rfl⟩, b, hb, he⟩ + have hat : a < b := lt_of_le_of_lt ha.2 (hst.trans_le hb.1) + by_cases ha0 : a = 0 + · rw [ha0]; exact hv0 + by_cases hb1 : b = 1 + · have h2 : 0 < a := unitInterval.pos_iff_ne_zero.mpr ha0 + rw [hb1] at he + exact absurd hγ.mem1 (he ▸ hγ.not_V hf h2 (ha.2.trans_lt hs1)) + · exact absurd (hγ.inj ⟨unitInterval.pos_iff_ne_zero.mpr ha0, ha.2.trans_lt hs1⟩ + ⟨lt_of_le_of_lt (unitInterval.nonneg a) hat, unitInterval.lt_one_iff_ne_one.mpr hb1⟩ + he.symm) hat.ne + · rintro x rfl + exact ⟨⟨0, ⟨le_rfl, hs0.le⟩, hv0⟩, 1, ⟨ht1.le, le_rfl⟩, hv1⟩ + have hsint : ∀ a ∈ Icc 0 s, γ a ∈ R := fun a ha => by + rcases ha.2.lt_or_eq with h | rfl + · exact (hspre a h).1 + · exact GM11.discBd_subset R hsb + have htb' : γ t ∈ discBd R := htb + have htint : ∀ a ∈ Icc t 1, γ a ∈ R := fun a ha => by + have h2 : unitInterval.symm a ≤ t' := by + have := unitInterval.symm_le_symm.mpr ha.1 + simpa [ht] using this + have h3 : γ a = (γ ∘ unitInterval.symm) (unitInterval.symm a) := by simp + rcases h2.lt_or_eq with h | h + · rw [h3] + exact (htpre _ h).1 + · rw [h3, h] + exact GM11.discBd_subset R htb + refine ⟨γ '' Icc 0 s ∪ γ '' Icc t 1, γ s, γ t, GM11.IsLineWithEnds.union hL₁ hL₂ hmeet, fun e + => hst.ne (hγ.inj ⟨hs0, hs1⟩ ⟨hs0.trans hst, ht1⟩ e), ?_, ?_, ?_, .inl ⟨0, ⟨le_rfl, hs0.le⟩, + hv0⟩⟩ + · exact union_subset (image_subset_iff.mpr hsint) (image_subset_iff.mpr htint) + · apply Subset.antisymm + · rintro x ⟨⟨a, ha, rfl⟩ | ⟨a, ha, rfl⟩, hb⟩ + · rcases ha.2.lt_or_eq with h | rfl + · exact absurd hb (hspre a h).2 + · exact .inl rfl + · rcases ha.1.lt_or_eq with h | rfl + · have h2 : unitInterval.symm a < t' := by + have := unitInterval.symm_lt_symm.mpr h + simpa [ht] using this + have h3 := htpre _ h2 + simp only [comp_apply, unitInterval.symm_symm] at h3 + exact absurd hb h3.2 + · exact .inr rfl + · rintro x (rfl | rfl) + · exact ⟨.inl ⟨s, ⟨hs0.le, le_rfl⟩, rfl⟩, hsb⟩ + · exact ⟨.inr ⟨t, ⟨le_rfl, ht1.le⟩, rfl⟩, htb⟩ + · apply Subset.antisymm + · rintro x ⟨hx, hxC⟩ + rw [← hrange] at hxC + obtain ⟨τ, rfl⟩ := hxC + by_cases h2 : τ ≤ s + · exact .inl ⟨τ, ⟨unitInterval.nonneg τ, h2⟩, rfl⟩ + by_cases h3 : t ≤ τ + · exact .inr ⟨τ, ⟨h3, unitInterval.le_one τ⟩, rfl⟩ + · exact absurd hx (hγ.no_return hf (fun y hy => by + obtain ⟨C', h4, h5, h6, h7, h8⟩ := hstar y ⟨hy.1, hrange ▸ hy.2⟩ + exact ⟨C', h4, hrange.symm ▸ h5, h6, hv0.symm ▸ h7, h8⟩) hs0 hsb (.inr ⟨ht1, + htb'⟩) (not_le.mp h2) (not_le.mp h3)) + · rintro x (⟨a, ha, rfl⟩ | ⟨a, ha, rfl⟩) + · exact ⟨hsint a ha, hrange ▸ mem_range_self a⟩ + · exact ⟨htint a ha, hrange ▸ mem_range_self a⟩ + +/-- Adding to a disc `B` a disc `R` that meets its boundary in a chord of `R`. -/ +theorem exists_half_union (hS : IsClosedSurface T) {B R F : Set T} {y₁ y₂ v : T} + (hB : IsClosedDisc B) (hR : IsClosedDisc R) (hF : IsLineWithEnds F y₁ y₂) (hne : y₁ ≠ y₂) + (hFR : F ⊆ R) + (hb : F ∩ discBd R = {y₁, y₂}) (hRB : R ∩ discBd B = F) (hv : v ∈ F) (hvR : v ∈ discInt R) : + IsClosedDisc (B ∪ R) ∧ discBd (B ∪ R) ⊆ discBd B ∪ discBd R ∧ Disjoint (discBd (B ∪ R)) + (discInt R) ∧ discBd B \ R ⊆ discBd (B ∪ R) ∧ discBd R \ B ⊆ discBd (B ∪ R) := by + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hfr := IsClosedDisc.frontier_eq_discBd hS hB + have hBc := hB.isClosed + have hFB : F ⊆ discBd B := hRB ▸ inter_subset_right + have hvB : v ∈ discBd B := hFB hv + have hint := hR.isOpen_discInt hman + have hintB := hB.isOpen_discInt hman + obtain ⟨Δ₁, Δ₂, A₁, A₂, l₁, l₂, hun, hin, d₁, d₂, hcup, hcap, b₁, b₂, p₁, p₂⟩ + := disc_split hR hFR hne hF hb + -- A point near `v` outside `B`, and one inside. + obtain ⟨p, hpR, hpB⟩ : ∃ p ∈ discInt R, p ∉ B := by + have h1 : v ∈ closure Bᶜ := by + have : v ∈ frontier B := hfr ▸ hvB + rw [frontier_eq_closure_inter_closure] at this + exact this.2 + obtain ⟨p, h2, h3⟩ := mem_closure_iff.mp h1 _ hint hvR + exact ⟨p, h2, h3⟩ + obtain ⟨q, hqR, hqB⟩ : ∃ q ∈ discInt R, q ∈ discInt B := by + obtain ⟨q, h2, h3⟩ := mem_closure_iff.mp (hB.subset_closure_discInt + (GM11.discBd_subset B hvB)) _ hint hvR + exact ⟨q, h2, h3⟩ + have hqIn : q ∈ interior B := interior_maximal (discInt_subset B) hintB hqB + have hside : ∀ {E : Set T}, IsPreconnected (E \ F) → E ⊆ R → E \ F ⊆ interior B ∨ E \ F ⊆ Bᶜ + := fun {E} h1 h2 => by + refine inside_or_outside h1 hBc (disjoint_left.mpr fun x hx hxf => ?_) + rw [hfr] at hxf + exact hx.2 (hRB ▸ ⟨h2 hx.1, hxf⟩) + wlog hpΔ : p ∈ Δ₁ generalizing Δ₁ Δ₂ A₁ A₂ + · have hp2 : p ∈ Δ₂ := by + have : p ∈ Δ₁ ∪ Δ₂ := hcup ▸ hpR.1 + exact this.resolve_left hpΔ + exact this Δ₂ Δ₁ A₂ A₁ l₂ l₁ (by rw [union_comm]; exact hun) + (by rw [inter_comm]; exact hin) d₂ d₁ (by rw [union_comm]; exact hcup) + (by rw [inter_comm]; exact hcap) b₂ b₁ p₂ p₁ hp2 + have hsub₁ : Δ₁ ⊆ R := hcup ▸ subset_union_left + have hsub₂ : Δ₂ ⊆ R := hcup ▸ subset_union_right + have hqF : q ∉ F := fun h => (hqB.2 (hFB h)) + have hs₁ : Δ₁ \ F ⊆ Bᶜ := by + rcases hside p₁ hsub₁ with h | h + · exact absurd (interior_subset (h ⟨hpΔ, fun hf => hpB (GM11.discBd_subset B (hFB hf))⟩)) hpB + · exact h + have hqΔ₂ : q ∈ Δ₂ := by + have : q ∈ Δ₁ ∪ Δ₂ := hcup ▸ hqR.1 + refine this.resolve_left fun h => hs₁ ⟨h, hqF⟩ hqB.1 + have hs₂ : Δ₂ \ F ⊆ interior B := by + rcases hside p₂ hsub₂ with h | h + · exact h + · exact absurd hqB.1 (h ⟨hqΔ₂, hqF⟩) + have hΔ₂B : Δ₂ ⊆ B := fun x hx => by + by_cases h : x ∈ F + · exact GM11.discBd_subset B (hFB h) + · exact interior_subset (hs₂ ⟨hx, h⟩) + have hFΔ₁ : F ⊆ discBd Δ₁ := b₁ ▸ subset_union_right + have hcapB : B ∩ Δ₁ = F := by + apply Subset.antisymm + · rintro x ⟨h1, h2⟩ + by_contra hn + exact hs₁ ⟨h2, hn⟩ h1 + · exact fun x hx => ⟨GM11.discBd_subset B (hFB hx), GM11.discBd_subset Δ₁ (hFΔ₁ hx)⟩ + obtain ⟨hd, hbd⟩ := disc_union B Δ₁ F y₁ y₂ hB d₁ hF hcapB hFB hFΔ₁ + have hBR : B ∪ R = B ∪ Δ₁ := by + rw [← hcup] + apply Subset.antisymm + · exact union_subset subset_union_left (union_subset subset_union_right + (hΔ₂B.trans subset_union_left)) + · exact union_subset_union_right _ subset_union_left + rw [hBR] + have hA₁ : A₁ ⊆ discBd R := hun ▸ subset_union_left + have hends : ∀ x ∈ F, x ∉ F \ {y₁, y₂} → x ∈ discBd R := fun x hx h => by + have h2 : x ∈ ({y₁, y₂} : Set T) := by + by_contra hn + exact h ⟨hx, hn⟩ + exact (hb.ge h2).2 + refine ⟨hd, ?_, ?_, ?_, ?_⟩ + · rw [hbd, b₁] + rintro x ⟨h | h | h, -⟩ + · exact .inl h + · exact .inr (hA₁ h) + · exact .inl (hFB h) + · refine disjoint_left.mpr fun x hx hxR => hxR.2 ?_ + rw [hbd, b₁] at hx + rcases hx with ⟨h | h | h, h2⟩ + · exact hends x (hRB ▸ ⟨hxR.1, h⟩) h2 + · exact hA₁ h + · exact hends x h h2 + · rintro x ⟨h1, h2⟩ + rw [hbd] + exact ⟨.inl h1, fun h => h2 (hFR h.1)⟩ + · rintro x ⟨h1, h2⟩ + rw [hbd, b₁] + have hxF : x ∉ F := fun h => h2 (GM11.discBd_subset B (hFB h)) + rw [← hun] at h1 + rcases h1 with h | h + · exact ⟨.inr (.inl h), fun h3 => hxF h3.1⟩ + · exact absurd (hΔ₂B (GM11.discBd_subset Δ₂ (b₂ ▸ .inl h))) h2 + +/-- **Adding half discs.** Let finitely many disjoint discs `R i` each meet the boundary of `B₀` in +a chord. Then `B₀` and the discs form one disc, and each point of the +boundary of a disc outside `B₀` is on its boundary. -/ +theorem exists_blob (hS : IsClosedSurface T) {B₀ : Set T} (hB₀ : IsClosedDisc B₀) {ι : Type*} {R F + : ι → Set T} {y₁ y₂ v : ι → T} (s : Finset ι) + (hR : ∀ i ∈ s, IsClosedDisc (R i)) (hF : ∀ i ∈ s, IsLineWithEnds (F i) (y₁ i) (y₂ i)) + (hne : ∀ i ∈ s, y₁ i ≠ y₂ i) (hFR : ∀ i ∈ s, F i ⊆ R i) + (hb : ∀ i ∈ s, F i ∩ discBd (R i) = {y₁ i, y₂ i}) (hRB : ∀ i ∈ s, R i ∩ discBd B₀ = F i) + (hv : ∀ i ∈ s, v i ∈ F i) (hvR : ∀ i ∈ s, v i ∈ discInt (R i)) + (hd : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → Disjoint (R i) (R j)) : + ∃ B, IsClosedDisc B ∧ B₀ ⊆ B ∧ (∀ i ∈ s, R i ⊆ B) ∧ B ⊆ B₀ ∪ ⋃ i ∈ s, R i + ∧ discBd B ⊆ discBd B₀ ∪ ⋃ i ∈ s, discBd (R i) ∧ (∀ i ∈ s, Disjoint (discBd B) (discInt + (R i))) ∧ + (∀ i ∈ s, discBd (R i) \ B₀ ⊆ discBd B) ∧ discBd B₀ \ (⋃ i ∈ s, R i) ⊆ discBd B := by + classical + induction s using Finset.induction_on with + | empty => exact ⟨B₀, hB₀, Subset.rfl, by simp, by simp, by simp, by simp, by simp, by simp⟩ + | insert i s his ih => + have hm : ∀ {j}, j ∈ s → j ∈ insert i s := fun {j} hj => Finset.mem_insert_of_mem hj + have hi := Finset.mem_insert_self i s + obtain ⟨B, hB, h1, h2, h3, h4, h5, h6, h7⟩ := ih (fun j hj => hR j (hm hj)) (fun j hj => hF j + (hm hj)) (fun j hj => hne j (hm hj)) (fun j hj => hFR j (hm hj)) (fun j hj => hb j (hm hj)) + (fun j hj => hRB j (hm hj)) (fun j hj => hv j (hm hj)) (fun j hj => hvR j (hm hj)) + (fun j hj k hk => hd j (hm hj) k (hm hk)) + have hdi : ∀ j ∈ s, Disjoint (R i) (R j) := fun j hj => hd i hi j (hm hj) fun e => his (e ▸ hj) + have hoff : ∀ x ∈ R i, x ∉ ⋃ j ∈ s, R j := fun x hx h => by + obtain ⟨j, hj, h8⟩ := mem_iUnion₂.mp h + exact disjoint_left.mp (hdi j hj) hx h8 + have hRBi : R i ∩ discBd B = F i := by + rw [← hRB i hi] + apply Subset.antisymm + · rintro x ⟨hx, hxb⟩ + rcases h4 hxb with h | h + · exact ⟨hx, h⟩ + · obtain ⟨j, hj, h8⟩ := mem_iUnion₂.mp h + exact absurd (GM11.discBd_subset _ h8) (disjoint_left.mp (hdi j hj) hx) + · rintro x ⟨hx, hxb⟩ + exact ⟨hx, h7 ⟨hxb, hoff x hx⟩⟩ + obtain ⟨a1, a2, a3, a4, a5⟩ := exists_half_union hS hB (hR i hi) (hF i hi) (hne i hi) (hFR i hi) + (hb i hi) hRBi (hv i hi) (hvR i hi) + have hsplit : ∀ {P : ι → Set T} {x : T}, x ∈ ⋃ j ∈ insert i s, P j → x ∈ P i ∨ x ∈ ⋃ j ∈ s, P j + := fun {P x} h => by + obtain ⟨j, hj, h8⟩ := mem_iUnion₂.mp h + rcases Finset.mem_insert.mp hj with rfl | hj + · exact .inl h8 + · exact .inr (mem_iUnion₂.mpr ⟨j, hj, h8⟩) + have hincl : ∀ {P : ι → Set T} {x : T}, x ∈ ⋃ j ∈ s, P j → x ∈ ⋃ j ∈ insert i s, P j + := fun {P x} h => by + obtain ⟨j, hj, h8⟩ := mem_iUnion₂.mp h + exact mem_iUnion₂.mpr ⟨j, hm hj, h8⟩ + refine ⟨B ∪ R i, a1, h1.trans subset_union_left, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro j hj + rcases Finset.mem_insert.mp hj with rfl | hj + · exact subset_union_right + · exact (h2 j hj).trans subset_union_left + · rintro x (hx | hx) + · rcases h3 hx with h | h + · exact .inl h + · exact .inr (hincl h) + · exact .inr (mem_iUnion₂.mpr ⟨i, hi, hx⟩) + · intro x hx + rcases a2 hx with h | h + · rcases h4 h with h' | h' + · exact .inl h' + · exact .inr (hincl h') + · exact .inr (mem_iUnion₂.mpr ⟨i, hi, h⟩) + · intro j hj + rcases Finset.mem_insert.mp hj with rfl | hj + · exact a3 + · refine disjoint_left.mpr fun x hx hxj => ?_ + rcases a2 hx with h | h + · exact disjoint_left.mp (h5 j hj) h hxj + · exact disjoint_left.mp (hdi j hj) (GM11.discBd_subset _ h) hxj.1 + · intro j hj x hx + rcases Finset.mem_insert.mp hj with rfl | hj + · refine a5 ⟨hx.1, fun h => ?_⟩ + rcases h3 h with h' | h' + · exact hx.2 h' + · exact hoff x (GM11.discBd_subset _ hx.1) h' + · refine a4 ⟨h6 j hj hx, fun h => ?_⟩ + exact disjoint_left.mp (hdi j hj) h (GM11.discBd_subset _ hx.1) + · rintro x ⟨hx, hn⟩ + refine a4 ⟨h7 ⟨hx, fun h => hn (hincl h)⟩, fun h => hn (mem_iUnion₂.mpr ⟨i, hi, h⟩)⟩ + +/-- A parent map that lowers a rank has no cycles, so each edge of it is a bridge. -/ +theorem not_reach_of_rank {N : Type} {par : N → Option N} {ρ : N → ℕ} (hρ : ∀ u v, par u = some v + → ρ v < ρ u) (E : Set N) (i : N) (hi : i ∉ E) : + ¬ Reach (fun u : N => (some u : Option N)) par E (some i) (par i) := by + -- The descendants of `i`. + let Dsc : N → Prop := Relation.ReflTransGen (fun y z => par z = some y) i + have hrank : ∀ {u : N}, Dsc u → ρ i ≤ ρ u := fun {u} h => by + induction h with + | refl => exact le_rfl + | tail _ hstep ih => exact ih.trans (hρ _ _ hstep).le + have hkey : ∀ x, Reach (fun u : N => (some u : Option N)) par E (some i) x → ∃ u, x = some u + ∧ Dsc u := fun x h => by + induction h with + | refl => exact ⟨i, rfl, .refl⟩ + | tail _ hstep ih => + obtain ⟨u, rfl, hu⟩ := ih + obtain ⟨j, hj, ⟨h1, h2⟩ | ⟨h1, h2⟩⟩ := hstep + · obtain rfl := Option.some.inj h1 + rcases Relation.ReflTransGen.cases_tail hu with h3 | ⟨z, hz, h4⟩ + · exact absurd (h3 ▸ hj) hi + · exact ⟨z, h2 ▸ h4, hz⟩ + · exact ⟨j, h1.symm, hu.tail h2⟩ + intro h + rcases hp : par i with _ | v + · obtain ⟨u, h1, -⟩ := hkey _ h + rw [hp] at h1 + exact absurd h1 (by simp) + · obtain ⟨u, h1, h2⟩ := hkey _ h + rw [hp] at h1 + obtain rfl := Option.some.inj h1 + exact absurd (hρ _ _ hp) (not_lt.mpr (hrank h2)) + +omit [T2Space T] in +/-- **A disc around a tree of discs and more lines.** On a sphere, take disjoint discs `c₀`, joined +to the root disc by lines `L`, along a parent map. Let `ℓ` be further lines +as in `exists_disc_absorbing`. Then a disc holds all of them, it misses `Y₀`, and its boundary meets +`Y` and the lines `ℓ` only in `X`. -/ +theorem exists_disc_of_tree (hS : IsClosedSurface T) (hsph : IsSphere T) {N : Type} [Finite N] {c₀ + : Option N → Set T} {L : N → Set T} {p q : N → T} {par : N → Option N} {ρ : N → ℕ} + (hd : ∀ n, IsClosedDisc (c₀ n)) (hdj : ∀ m n, m ≠ n → Disjoint (c₀ m) (c₀ n)) + (hρ : ∀ u v, par u = some v → ρ v < ρ u) (hL : ∀ u, IsLineWithEnds (L u) (p u) (q u)) + (hp : ∀ u, p u ∈ discBd (c₀ (some u))) (hq : ∀ u, q u ∈ discBd (c₀ (par u))) + (hLc : ∀ u n, L u ∩ c₀ n ⊆ {p u, q u}) (hLL : ∀ u v, u ≠ v → Disjoint (L u) (L v)) + {ι : Type*} (s : Finset ι) (ℓ : ι → Set T) (a b : ι → T) {X Y Y₀ : Set T} + (hY₀ : IsPreconnected Y₀) (hY₀n : Y₀.Nonempty) (hXY : Disjoint X Y₀) (hYc : IsClosed Y) + (hY₀Y : Y₀ ⊆ Y) + (hLY : ∀ u, Disjoint (L u) Y) (hLℓ : ∀ u, ∀ i ∈ s, Disjoint (L u) (ℓ i)) + (hcY₀ : ∀ n, Disjoint Y₀ (c₀ n)) (hbY : ∀ n, discBd (c₀ n) ∩ Y ⊆ X) + (hline : ∀ i ∈ s, IsLineWithEnds (ℓ i) (a i) (b i)) (hne : ∀ i ∈ s, a i ≠ b i) + (haX : ∀ i ∈ s, a i ∉ X) (ha : ∀ i ∈ s, ∃ n, a i ∈ discBd (c₀ n)) + (hb : ∀ i ∈ s, (∃ n, b i ∈ discBd (c₀ n)) ∨ b i ∈ X ∧ ∀ n, b i ∉ c₀ n) + (hin : ∀ i ∈ s, ∀ n, ℓ i ∩ c₀ n ⊆ {a i, b i}) (hinY : ∀ i ∈ s, ℓ i ∩ Y ⊆ X) + (hmid : ∀ i ∈ s, Disjoint (ℓ i \ {a i, b i}) X) (hpair : ∀ i ∈ s, ∀ j ∈ s, i ≠ j + → ℓ i ∩ ℓ j ⊆ X) : + ∃ B, IsClosedDisc B ∧ (∀ n, c₀ n ⊆ B ∧ discInt (c₀ n) ⊆ discInt B) ∧ (∀ u, L u ⊆ discInt B) + ∧ Disjoint Y₀ B ∧ discBd B ∩ Y ⊆ X ∧ ∀ i ∈ s, discBd B ∩ ℓ i ⊆ X := by + classical + have ht2 : T2Space T := hS.2.1 + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + set Z : Set T := Y ∪ ⋃ i ∈ s, ℓ i with hZ + have hZc : IsClosed Z := hYc.union (s.finite_toSet.isClosed_biUnion fun i hi => + (hline i hi).isCompact.isClosed) + have hℓZ : ∀ i ∈ s, ℓ i ⊆ Z := fun i hi x hx => .inr (mem_iUnion₂.mpr ⟨i, hi, hx⟩) + have hLZ : ∀ u, Disjoint (L u) Z := fun u => disjoint_union_right.mpr ⟨hLY u, by + refine disjoint_left.mpr fun x hx h => ?_ + obtain ⟨i, hi, h2⟩ := mem_iUnion₂.mp h + exact disjoint_left.mp (hLℓ u i hi) hx h2⟩ + obtain ⟨c, h1, h2, h3, h4, h5, h6, h7, h8⟩ := exists_forest_discs (V := Option N) (ι := N) hS (c₀ + := c₀) (L := L) (p := p) (q := q) (a := some) (b := par) (Z := Z) hd hdj hL hp hq hLc + (fun u v huv => hLL u v huv) hZc hLZ (fun E i hi => not_reach_of_rank hρ E i hi) + -- All discs are one. + have hone : ∀ n, c n = c none := by + have hrk : ∀ (k : ℕ) (u : N), ρ u = k → c (some u) = c none := by + intro k + induction k using Nat.strong_induction_on with + | _ k ih => + intro u hu + rw [(h4 u).2] + rcases hp' : par u with _ | v + · rfl + · exact ih (ρ v) (hu ▸ hρ u v hp') v rfl + intro n + cases n with + | none => rfl + | some u => exact hrk _ u rfl + set B := c none with hB + have hBd : IsClosedDisc B := h1 none + have hc₀ : ∀ n, c₀ n ⊆ B ∧ discInt (c₀ n) ⊆ discInt B := fun n => by + have := h5 n + rwa [hone n] at this + have hZB : ∀ x, x ∈ Z → x ∈ B → ∃ n, x ∈ c₀ n := fun x hx hxB => by + have h9 := h6 none ⟨hxB, hx⟩ + obtain ⟨n, hn⟩ := mem_iUnion.mp h9 + exact ⟨n, hn⟩ + have hbB : ∀ n, discBd (c₀ n) ∩ Z ⊆ discBd B := fun n => by + have := h7 n + rwa [hone n] at this + have hbB' : ∀ x, x ∈ discBd B → x ∈ Z → ∃ n, x ∈ discBd (c₀ n) := fun x hx hxZ => by + have h9 := h8 none ⟨hx, hxZ⟩ + obtain ⟨n, hn⟩ := mem_iUnion.mp h9 + exact ⟨n, hn⟩ + have hY₀B : Disjoint Y₀ B := disjoint_left.mpr fun x hx hxB => by + obtain ⟨n, hn⟩ := hZB x (.inl (hY₀Y hx)) hxB + exact disjoint_left.mp (hcY₀ n) hx hn + have hbdY : discBd B ∩ Y ⊆ X := by + rintro x ⟨hx, hy⟩ + obtain ⟨n, hn⟩ := hbB' x hx (.inl hy) + exact hbY n ⟨hn, hy⟩ + obtain ⟨B', hB', hBB', hYB', hbY', hbl⟩ := exists_disc_absorbing hS hsph ℓ a b hY₀ hY₀n hXY + s.card s rfl B Y hBd hYc hY₀Y hY₀B hbdY (fun i hi => by + have hl := hline i hi + refine ⟨hl, hne i hi, haX i hi, ?_, ?_, ?_, fun x hx => hinY i hi hx, hmid i hi⟩ + · obtain ⟨n, hn⟩ := ha i hi + exact hbB n ⟨hn, hℓZ i hi hl.left_mem⟩ + · rcases hb i hi with ⟨n, hn⟩ | ⟨h9, h10⟩ + · exact .inl (hbB n ⟨hn, hℓZ i hi hl.right_mem⟩) + · refine .inr ⟨h9, fun h11 => ?_⟩ + obtain ⟨n, hn⟩ := hZB _ (hℓZ i hi hl.right_mem) h11 + exact h10 n hn + · rintro x ⟨hx, hxB⟩ + obtain ⟨n, hn⟩ := hZB x (hℓZ i hi hx) hxB + exact hin i hi n ⟨hx, hn⟩) hpair + refine ⟨B', hB', fun n => ⟨(hc₀ n).1.trans hBB', (hc₀ n).2.trans (discInt_mono hman hBd hBB')⟩, + fun u => ?_, hYB', hbY', hbl⟩ + have := (h4 u).1 + rw [hone] at this + exact this.trans (discInt_mono hman hBd hBB') + +/-- **Cutting an edge at the discs around its ends.** Each end in `K` has a disc around it, and the +discs meet the edge only near those ends. Then the middle piece of the edge, +from `s` to `t`, misses all discs, except at its ends. -/ +theorem EdgeParam.exists_cut (h : EdgeParam H f γ) (hf : f ∈ H.E) {K : Set T} {R : T → Set T} + (hR : ∀ v ∈ K, IsClosedDisc (R v) ∧ v ∈ discInt (R v) ∧ IsOpen (discInt (R v))) + (hstar : ∀ v ∈ K, ∀ y ∈ R v ∩ range γ, ∃ C, IsPreconnected C ∧ C ⊆ range γ ∧ y ∈ C ∧ v ∈ C + ∧ C \ {y} ⊆ discInt (R v)) (h0 : γ 0 ∈ K) {m : I} (hm1 : m < 1) (hm : ∀ v ∈ K, γ m ∉ R v) + (hoff : γ 1 ∉ K → ∀ v ∈ K, γ 1 ∉ R v) (hends : ∀ v ∈ K, (R v ∩ range γ).Nonempty → v = γ 0 ∨ v + = γ 1) (hsep : γ 1 ≠ γ 0 → γ 1 ∈ K → γ 0 ∉ R (γ 1) ∧ γ 1 ∉ R (γ 0)) : + ∃ s t, 0 < s ∧ s < m ∧ m < t ∧ γ s ∈ discBd (R (γ 0)) ∧ (∀ τ < s, γ τ ∈ discInt (R (γ 0))) ∧ + ((γ 1 ∈ K ∧ t < 1 ∧ γ t ∈ discBd (R (γ 1)) ∧ ∀ τ, t < τ → γ τ ∈ discInt (R (γ 1))) ∨ γ 1 ∉ K + ∧ t = 1) ∧ ∀ v ∈ K, ∀ τ, s < τ → τ < t → γ τ ∉ R v := by + obtain ⟨hd₀, hm₀, ho₀⟩ := hR _ h0 + obtain ⟨s, hs0, hsm, hsb, hspre⟩ := exists_first_exit h.cont hd₀ ho₀ hm₀ (hm _ h0) + have hrev : ∀ x : I, (γ ∘ unitInterval.symm) (unitInterval.symm x) = γ x := fun x => by simp + have hrange : range (γ ∘ unitInterval.symm) = range γ := by + rw [range_comp, unitInterval.symm_bijective.surjective.range_eq, image_univ] + have hγ1 : (γ ∘ unitInterval.symm) 0 = γ 1 := by simp + have hγ0 : (γ ∘ unitInterval.symm) 1 = γ 0 := by simp + have hex : ∃ t, m < t ∧ ((γ 1 ∈ K ∧ t < 1 ∧ γ t ∈ discBd (R (γ 1)) ∧ ∀ τ, t < τ → γ τ ∈ discInt + (R (γ 1))) ∨ γ 1 ∉ K ∧ t = 1) := by + by_cases h1 : γ 1 ∈ K + · obtain ⟨hd₁, hm₁, ho₁⟩ := hR _ h1 + obtain ⟨t', ht0, htm, htb, htpre⟩ := exists_first_exit (z := unitInterval.symm m) h.rev.cont + hd₁ ho₁ + (by rwa [hγ1]) (by rw [hrev]; exact hm _ h1) + refine ⟨unitInterval.symm t', ?_, .inl ⟨h1, ?_, htb, fun τ hτ => ?_⟩⟩ + · have := unitInterval.symm_lt_symm.mpr htm + simpa using this + · have := unitInterval.symm_lt_symm.mpr ht0 + simpa using this + · have h3 : unitInterval.symm τ < t' := by + have := unitInterval.symm_lt_symm.mpr hτ + simpa using this + have := htpre _ h3 + rwa [hrev] at this + · exact ⟨1, hm1, .inr ⟨h1, rfl⟩⟩ + obtain ⟨t, hmt, hcase⟩ := hex + refine ⟨s, t, hs0, hsm, hmt, hsb, hspre, hcase, fun v hv τ hsτ hτt hy => ?_⟩ + have hst : s < t := hsm.trans hmt + have hrg : ((R v) ∩ range γ).Nonempty := ⟨_, hy, mem_range_self τ⟩ + have hgo : ∀ v ∈ K, ∀ y ∈ R v ∩ range (γ ∘ unitInterval.symm), ∃ C, IsPreconnected C ∧ C ⊆ range + (γ ∘ unitInterval.symm) ∧ y ∈ C ∧ v ∈ C ∧ C \ {y} ⊆ discInt (R v) := by + rw [hrange] + exact hstar + have hfirst : v = γ 0 → False := by + rintro rfl + refine h.no_return hf (hstar _ h0) hs0 hsb (t := t) ?_ hsτ hτt hy + rcases hcase with ⟨h1, h2, h3, -⟩ | ⟨h1, -⟩ + · by_cases he : γ 1 = γ 0 + · exact .inr ⟨h2, he ▸ h3⟩ + · exact .inl (hsep he h1).2 + · exact .inl (hoff h1 _ h0) + rcases hends v hv hrg with hv0 | hv1 + · exact hfirst hv0 + · subst hv1 + by_cases he : γ 1 = γ 0 + · exact hfirst he + rcases hcase with ⟨h1, h2, h3, -⟩ | ⟨h1, -⟩ + · have h4 : unitInterval.symm t < unitInterval.symm τ := unitInterval.symm_lt_symm.mpr hτt + have h5 : unitInterval.symm τ < unitInterval.symm s := unitInterval.symm_lt_symm.mpr hsτ + have h6 : 0 < unitInterval.symm t := by + have := unitInterval.symm_lt_symm.mpr h2 + simpa using this + have hg := hgo _ hv + rw [← hγ1] at hg h3 hy + refine h.rev.no_return hf hg h6 (by rwa [hrev]) (t := unitInterval.symm s) (.inl ?_) h4 h5 + (by rwa [hrev]) + rw [hγ0, hγ1] + exact (hsep he h1).1 + · exact h1 hv + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Taper.lean b/LeanPool/GraphMinor/GM07/Taper.lean new file mode 100644 index 0000000000..76b0d7db77 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Taper.lean @@ -0,0 +1,410 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.MoveCuff + +/-! +# Pushing a surface off a cuff + +Let `C` be a cuff of a surface and let `Z` be a closed set. In a collar of `C`, each point `(w, t)` +has a height `t`. Let +`d w` be at most the distance from `(w, 0)` to `Z`, so that `Z` has no point under the height `d w`. +The map that sends height +`t` to `max t ((d w + t) / 2)` leaves `Z` alone and lifts the cuff to height `d w / 2`, which is +positive off `Z`. It extends by +the identity to a one to one map `ρ` of the surface, homotopic to the identity (`exists_taper`). The +paper uses this in +"we may assume that `X ∩ bd(Σ') ⊆ V(G')`" in its proofs of (7.1) and (7.2), and for pushing a loop +off itself in (7.3). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface + +universe u + +local notation "𝕀" => unitInterval + +/-- A height function under a closed set of `Circle × 𝕀`, positive where the set misses the bottom. +-/ +theorem exists_gap {A : Set (Circle × 𝕀)} (hA : IsClosed A) : + ∃ d : Circle → ℝ, Continuous d ∧ (∀ w, 0 ≤ d w) ∧ (∀ w, d w ≤ 1) ∧ (∀ w, ∀ t : 𝕀, (w, t) ∈ A + → d w ≤ t) ∧ + ∀ w, d w = 0 → (w, (0 : 𝕀)) ∈ A := by + rcases A.eq_empty_or_nonempty with rfl | hne + · exact ⟨fun _ => 1, continuous_const, fun _ => zero_le_one, fun _ => le_rfl, + fun _ _ h => h.elim, fun _ h => absurd h one_ne_zero⟩ + have hcont : Continuous fun w : Circle => infDist (w, (0 : 𝕀)) A := + (continuous_infDist_pt A).comp (continuous_id.prodMk continuous_const) + refine ⟨fun w => min 1 (infDist (w, (0 : 𝕀)) A), continuous_const.min hcont, + fun w => le_min zero_le_one infDist_nonneg, + fun w => min_le_left _ _, fun w t h => ?_, fun w h => ?_⟩ + · refine (min_le_right _ _).trans ((infDist_le_dist_of_mem h).trans ?_) + rw [Prod.dist_eq, dist_self, max_eq_right dist_nonneg, Subtype.dist_eq] + simp [Real.dist_eq, abs_of_nonneg t.2.1] + · have h1 : infDist (w, (0 : 𝕀)) A = 0 := by + rcases min_choice 1 (infDist (w, (0 : 𝕀)) A) with h2 | h2 + · have h3 : min 1 (infDist (w, (0 : 𝕀)) A) = 0 := h + rw [h2] at h3 + exact absurd h3 one_ne_zero + · have h3 : min 1 (infDist (w, (0 : 𝕀)) A) = 0 := h + rwa [h2] at h3 + exact (hA.mem_iff_infDist_zero hne).mpr h1 + +/-- A map of heights that fixes the top extends a map of the collar to the surface, by the identity. +-/ +theorem exists_collar_glue {Y : Type u} [TopologicalSpace Y] [T2Space Y] {b : Circle × 𝕀 → Y} + (hbc : Continuous b) + (hbi : Function.Injective b) (hopen : IsOpen (range b \ b '' {x | x.2 + = 1})) {M : 𝕀 × Circle × 𝕀 → 𝕀} + (hM : Continuous M) (htop : ∀ p w, M (p, w, 1) = 1) : + ∃ c : 𝕀 × Y → Y, Continuous c ∧ (∀ p w t, c (p, b (w, t)) = b (w, M (p, w, t))) + ∧ ∀ p y, y ∉ range b → c (p, y) = y := by + classical + have hcpt : CompactSpace (Circle × 𝕀) := inferInstance + have hemb : IsClosedEmbedding b := hbc.isClosedEmbedding hbi + have : Nonempty (Circle × 𝕀) := ⟨(1, 0)⟩ + let J : Y → Circle × 𝕀 := Function.invFun b + have hJ : ∀ x, J (b x) = x := Function.leftInverse_invFun hbi + have hJc : ContinuousOn J (range b) := by + rw [continuousOn_iff_continuous_domRestrict] + have : (range b).domRestrict J = hemb.isEmbedding.toHomeomorph.symm := by + funext y + obtain ⟨y, x, rfl⟩ := y + change J (b x) = _ + rw [hJ] + exact (hemb.isEmbedding.toHomeomorph.symm_apply_apply x).symm + rw [this] + exact Homeomorph.continuous _ + let c : 𝕀 × Y → Y := fun q => if q.2 ∈ range b then b ((J q.2).1, M (q.1, J q.2)) else q.2 + have hR : IsClosed (range b) := hemb.isClosed_range + have hO : IsOpen (range b \ b '' {x | x.2 = 1}) := hopen + have hc1 : ContinuousOn c (univ ×ˢ range b) := by + have h1 : ContinuousOn (fun q : 𝕀 × Y => b ((J q.2).1, M (q.1, J q.2))) (univ ×ˢ range b) := by + refine hbc.comp_continuousOn ?_ + have h2 : ContinuousOn (fun q : 𝕀 × Y => J q.2) (univ ×ˢ range b) + := hJc.comp continuousOn_snd fun q hq => hq.2 + exact (continuous_fst.comp_continuousOn h2).prodMk (hM.comp_continuousOn + (continuousOn_fst.prodMk h2)) + exact h1.congr fun q hq => ite_eq_left hq.2 + have hc2 : ContinuousOn c (univ ×ˢ (range b \ b '' {x | x.2 = 1})ᶜ) := by + refine continuousOn_snd.congr ?_ + rintro ⟨p, y⟩ ⟨-, hy⟩ + change (if y ∈ range b then _ else _) = y + split_ifs with hyr + · obtain ⟨x, rfl⟩ := hyr + have h1 : x.2 = 1 := by + by_contra hne + exact hy ⟨mem_range_self x, fun ⟨x', hx', he⟩ => hne (hbi he ▸ hx')⟩ + obtain ⟨w, t⟩ := x + simp only at h1 + subst h1 + rw [hJ, htop] + · rfl + have hcov : (univ ×ˢ range b) ∪ (univ ×ˢ (range b \ b '' {x | x.2 = 1})ᶜ) = (univ : Set (𝕀 × Y)) + := by + ext ⟨p, y⟩ + by_cases hy : y ∈ range b \ b '' {x | x.2 = 1} + · simp [hy.1] + · simp [hy] + refine ⟨c, ?_, fun p w t => ?_, fun p y hy => ite_eq_right hy⟩ + · rw [← continuousOn_univ, ← hcov] + exact hc1.union_of_isClosed hc2 (isClosed_univ.prod hR) (isClosed_univ.prod hO.isClosed_compl) + · change (if b (w, t) ∈ range b then _ else _) = _ + rw [ite_eq_left (mem_range_self _), hJ] + +private theorem joined_in_collar_below_gap {Y : Type u} [TopologicalSpace Y] + {C Z : Set Y} {b : Circle × 𝕀 → Y} (φ : Circle ≃ₜ C) + (hbc : Continuous b) (hbi : Function.Injective b) (hb0 : ∀ w, b (w, 0) = (φ w : Y)) + {d : Circle → ℝ} (hd1 : ∀ w, d w ≤ 1) + (hdZ : ∀ w t, b (w, t) ∈ Z → d w ≤ (t : ℝ)) + (w : Circle) (t r : 𝕀) (ht0 : 0 < (t : ℝ)) (htd : (t : ℝ) < d w) + (hr : (r : ℝ) = d w / 2) : + JoinedIn (Zᶜ ∩ Cᶜ) (b (w, t)) (b (w, r)) := by + have hdw := ht0.trans htd + let c : ℝ → ℝ := fun u => (1 - u) * t + u * (d w / 2) + have hcI : ∀ u ∈ Icc (0 : ℝ) 1, c u ∈ Icc (0 : ℝ) 1 ∧ 0 < c u ∧ c u < d w := by + rintro u ⟨hu0, hu1⟩ + have h3 : 0 < c u := by + have : 0 < (1 - u) * t + u * (d w / 2) := by + rcases eq_or_lt_of_le hu0 with rfl | h + · simpa using ht0 + · have : 0 ≤ (1 - u) * t := mul_nonneg (by linarith) ht0.le + have : 0 < u * (d w / 2) := by positivity + linarith + exact this + have h4 : c u < d w := by + have h5 : (1 - u) * t ≤ (1 - u) * d w := mul_le_mul_of_nonneg_left htd.le (by linarith) + have : (1 - u) * t + u * (d w / 2) < d w := by + rcases eq_or_lt_of_le hu0 with rfl | h + · simpa using htd + · nlinarith + exact this + exact ⟨⟨h3.le, h4.le.trans (hd1 w)⟩, h3, h4⟩ + have hcc : Continuous c := by fun_prop + refine JoinedIn.ofLine (f := fun u => b (w, Set.projIcc 0 1 zero_le_one (c u))) ?_ ?_ ?_ ?_ + · exact (hbc.comp (by fun_prop)).continuousOn + · have : c 0 = t := by simp [c] + change b (w, Set.projIcc 0 1 zero_le_one (c 0)) = b (w, t) + rw [this] + congr 2 + exact Set.projIcc_val zero_le_one t + · have h3 : c 1 = d w / 2 := by simp [c] + change b (w, Set.projIcc 0 1 zero_le_one (c 1)) = _ + have h4 : Set.projIcc 0 1 zero_le_one (c 1) = r := by + apply Subtype.ext + rw [Set.projIcc_of_mem zero_le_one ⟨by rw [h3]; linarith, by rw [h3]; linarith [hd1 w]⟩ ] + change c 1 = (r : ℝ) + rw [hr, h3] + rw [h4] + · rintro _ ⟨u, hu, rfl⟩ + obtain ⟨h3, h4, h5⟩ := hcI u hu + have h6 : ((Set.projIcc 0 1 zero_le_one (c u) : 𝕀) : ℝ) = c u := by + rw [Set.projIcc_of_mem zero_le_one h3] + refine ⟨fun hz => ?_, fun hc' => ?_⟩ + · have := hdZ w _ hz + rw [h6] at this + linarith + · obtain ⟨w', he⟩ : ∃ w', b (w', 0) = b (w, Set.projIcc 0 1 zero_le_one (c u)) := + ⟨φ.symm ⟨_, hc'⟩, by rw [hb0, φ.apply_symm_apply]⟩ + have h7 := congrArg Prod.snd (hbi he) + have h8 : (0 : ℝ) = c u := by + have := congrArg Subtype.val h7 + rw [h6] at this + exact this + linarith + +/-- **Pushing off a cuff.** See the module docstring. The last two conclusions say that the homotopy +fixes `Z`, and that each point +near a point of the cuff off `Z` can be joined, off `Z` and off the cuff, to the image of the cuff. +-/ +theorem exists_taper_sides {Y : Type u} [TopologicalSpace Y] (hY : IsSurface Y) {C : Set Y} + (hC : IsCuff C) (φ : Circle ≃ₜ C) + {Z : Set Y} (hZ : IsClosed Z) : + ∃ H : 𝕀 × Y → Y, Continuous H ∧ (∀ y, H (0, y) = y) ∧ Function.Injective (fun y => H (1, y)) ∧ + (∀ z ∈ Z, H (1, z) = z) ∧ + (∀ y, H (1, y) ∈ Z → y ∈ Z) ∧ (∀ y, H (1, y) ∈ C → H (1, y) ∈ Z) ∧ (∀ p, ∀ z ∈ Z, H (p, z) + = z) ∧ + ∀ y ∈ C, y ∉ Z → ∃ N ∈ 𝓝 y, ∀ y' ∈ N, y' ∉ C → ∃ y'' ∈ C, JoinedIn (Zᶜ ∩ Cᶜ) y' (H (1, y'')) + := by + classical + have ht2 : T2Space Y := hY.2.1 + obtain ⟨b, hbc, hbi, -, hb0, hopen⟩ := exists_collar hY hC φ isOpen_univ (subset_univ _) + obtain ⟨d, hdc, hd0, hd1, hdZ, hd⟩ := exists_gap (hZ.preimage hbc) + let g : Circle × 𝕀 → ℝ := fun x => max x.2.1 ((d x.1 + x.2.1) / 2) + have hgc : Continuous g := by fun_prop + have hg01 : ∀ x, g x ∈ Icc (0 : ℝ) 1 := fun x => by + have h2 := x.2.2 + refine ⟨le_max_of_le_left h2.1, max_le h2.2 ?_⟩ + have h3 := hd1 x.1 + have h4 : (x.2.1 : ℝ) ≤ 1 := h2.2 + linarith + have hglow : ∀ x, x.2.1 ≤ g x ∧ (d x.1 + x.2.1) / 2 ≤ g x := fun x => ⟨le_max_left _ _, + le_max_right _ _⟩ + let M : 𝕀 × Circle × 𝕀 → 𝕀 := fun q => ⟨(1 - q.1.1) * q.2.2.1 + q.1.1 * g q.2, by + have h1 := q.1.2 + have h2 := q.2.2.2 + have h3 := hg01 q.2 + exact (convex_Icc (0 : ℝ) 1) h2 h3 (a := 1 - q.1.1) (b := q.1.1) (by linarith [h1.2]) h1.1 + (by ring)⟩ + have hMc : Continuous M := by + refine Continuous.subtype_mk ?_ _ + have : Continuous fun q : 𝕀 × Circle × 𝕀 => g q.2 := hgc.comp continuous_snd + fun_prop + have htop : ∀ p w, M (p, w, 1) = 1 := fun p w => by + apply Subtype.ext + have h1 : g (w, 1) = 1 := max_eq_left (by + have := hd1 w + change (d w + 1) / 2 ≤ 1 + linarith) + change (1 - p.1) * 1 + p.1 * g (w, 1) = 1 + rw [h1] + ring + obtain ⟨H, hH, h1, h2⟩ := exists_collar_glue hbc hbi hopen hMc htop + have hH1 : ∀ w t, H (1, b (w, t)) = b (w, ⟨g (w, t), hg01 _⟩) := fun w t => by + rw [h1] + congr 2 + apply Subtype.ext + change (1 - (1 : ℝ)) * t.1 + 1 * g (w, t) = g (w, t) + ring + have hfix : ∀ w t, b (w, t) ∈ Z → g (w, t) = t.1 := fun w t hz => by + have h3 : d w ≤ t := hdZ w t hz + exact max_eq_left (by linarith [(show d (w, t).1 ≤ t from h3)]) + have hgmono : ∀ w (t t' : 𝕀), g (w, t) = g (w, t') → t = t' := fun w t t' he => by + apply Subtype.ext + rcases le_total (t : ℝ) (d w) with h3 | h3 <;> rcases le_total (t' : ℝ) (d w) with h4 | h4 + · have h5 : g (w, t) = (d w + t) / 2 := max_eq_right (by + change (t : ℝ) ≤ (d w + t) / 2 + linarith) + have h6 : g (w, t') = (d w + t') / 2 := max_eq_right (by + change (t' : ℝ) ≤ (d w + t') / 2 + linarith) + rw [h5, h6] at he + linarith + · have h5 : g (w, t) = (d w + t) / 2 := max_eq_right (by + change (t : ℝ) ≤ (d w + t) / 2 + linarith) + have h6 : g (w, t') = t' := max_eq_left (by change (d w + t') / 2 ≤ (t' : ℝ); linarith) + rw [h5, h6] at he + linarith + · have h5 : g (w, t) = t := max_eq_left (by change (d w + t) / 2 ≤ (t : ℝ); linarith) + have h6 : g (w, t') = (d w + t') / 2 := max_eq_right (by + change (t' : ℝ) ≤ (d w + t') / 2 + linarith) + rw [h5, h6] at he + linarith + · have h5 : g (w, t) = t := max_eq_left (by change (d w + t) / 2 ≤ (t : ℝ); linarith) + have h6 : g (w, t') = t' := max_eq_left (by change (d w + t') / 2 ≤ (t' : ℝ); linarith) + rw [h5, h6] at he + exact he + refine ⟨H, hH, fun y => ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · by_cases hy : y ∈ range b + · obtain ⟨⟨w, t⟩, rfl⟩ := hy + rw [h1] + congr 2 + apply Subtype.ext + change (1 - (0 : ℝ)) * t.1 + 0 * g (w, t) = t.1 + ring + · exact h2 _ _ hy + · intro y y' he + change H (1, y) = H (1, y') at he + by_cases hy : y ∈ range b <;> by_cases hy' : y' ∈ range b + · obtain ⟨⟨w, t⟩, rfl⟩ := hy + obtain ⟨⟨w', t'⟩, rfl⟩ := hy' + rw [hH1, hH1] at he + have h3 := hbi he + obtain ⟨rfl, h4⟩ := Prod.mk.inj h3 + rw [hgmono w t t' (congrArg Subtype.val h4)] + · obtain ⟨⟨w, t⟩, rfl⟩ := hy + rw [hH1, h2 _ _ hy'] at he + exact absurd ⟨_, he⟩ hy' + · obtain ⟨⟨w, t⟩, rfl⟩ := hy' + rw [hH1, h2 _ _ hy] at he + exact absurd ⟨_, he.symm⟩ hy + · rwa [h2 _ _ hy, h2 _ _ hy'] at he + · intro z hz + by_cases hy : z ∈ range b + · obtain ⟨⟨w, t⟩, rfl⟩ := hy + rw [hH1] + congr 2 + exact Subtype.ext (hfix w t hz) + · exact h2 _ _ hy + · intro y hy + by_cases hyr : y ∈ range b + · obtain ⟨⟨w, t⟩, rfl⟩ := hyr + rw [hH1] at hy + have h3 : d w ≤ g (w, t) := hdZ w _ hy + have h4 : t.1 ≥ d w := by + by_contra hlt + have h5 : g (w, t) = (d w + t) / 2 := max_eq_right (by + change (t : ℝ) ≤ (d w + t) / 2 + linarith) + rw [h5] at h3 + linarith + have h5 : g (w, t) = t := max_eq_left (by change (d w + t) / 2 ≤ (t : ℝ); linarith) + have h6 : (⟨g (w, t), hg01 _⟩ : 𝕀) = t := Subtype.ext h5 + rwa [h6] at hy + · rwa [h2 _ _ hyr] at hy + · intro y hy + obtain ⟨w₀, hyb⟩ : ∃ w₀, H (1, y) = b (w₀, 0) := ⟨φ.symm ⟨_, hy⟩, by rw [hb0, + φ.apply_symm_apply]⟩ + by_cases hyr : y ∈ range b + · obtain ⟨⟨w, t⟩, rfl⟩ := hyr + rw [hH1] at hyb + have h3 := hbi hyb + obtain ⟨h4, h5⟩ := Prod.mk.inj h3 + have h6 : g (w, t) = 0 := congrArg Subtype.val h5 + have h7 := (hglow (w, t)).2 + rw [h6] at h7 + have h8 := hd0 w + have h9 : (0 : ℝ) ≤ t := t.2.1 + change (d w + t) / 2 ≤ 0 at h7 + have h10 : d w = 0 := by linarith + have h11 : (t : ℝ) = 0 := by linarith + have h12 := hd w h10 + have h13 : (⟨g (w, t), hg01 _⟩ : 𝕀) = 0 := Subtype.ext h6 + rw [hH1, h13] + exact h12 + · have h3 := h2 1 y hyr + rw [h3] at hyb + exact absurd ⟨_, hyb.symm⟩ hyr + · intro p z hz + by_cases hyr : z ∈ range b + · obtain ⟨⟨w, t⟩, rfl⟩ := hyr + rw [h1] + congr 2 + apply Subtype.ext + change (1 - p.1) * t.1 + p.1 * g (w, t) = t.1 + rw [hfix w t hz] + ring + · exact h2 _ _ hyr + · intro y hyC hyZ + obtain ⟨w₀, hw₀⟩ : ∃ w₀, b (w₀, 0) = y := ⟨φ.symm ⟨y, hyC⟩, by rw [hb0, φ.apply_symm_apply]⟩ + have hd0' : 0 < d w₀ := by + refine lt_of_le_of_ne (hd0 w₀) fun h => hyZ ?_ + have := hd w₀ h.symm + rwa [mem_preimage, hw₀] at this + have hemb : IsClosedEmbedding b := hbc.isClosedEmbedding hbi + let A : Set (Circle × 𝕀) := {x | x.2.1 < d x.1} + have hAo : IsOpen A := isOpen_lt (by fun_prop) (by fun_prop) + have hAt : A ∩ {x | x.2 ≠ 1} = A := by + refine inter_eq_left.mpr fun x hx h1' => ?_ + have h3 : (x.2 : ℝ) < d x.1 := hx + rw [show x.2 = 1 from h1'] at h3 + have h4 := hd1 x.1 + have h5 : (((1 : 𝕀) : ℝ)) = 1 := rfl + linarith + obtain ⟨V, hV, hVe⟩ := hemb.isInducing.isOpen_iff.mp hAo + have hsub : V ∩ (range b \ b '' {x | x.2 = 1}) ⊆ b '' A := by + rintro _ ⟨hv, ⟨x, rfl⟩, -⟩ + exact ⟨x, by rw [← hVe]; exact hv, rfl⟩ + refine ⟨V ∩ (range b \ b '' {x | x.2 = 1}), (hV.inter hopen).mem_nhds ⟨?_, ?_⟩, ?_⟩ + · have : (w₀, (0 : 𝕀)) ∈ A := hd0' + rw [← hVe] at this + rw [← hw₀] + exact this + · refine ⟨⟨(w₀, 0), hw₀⟩, ?_⟩ + rintro ⟨x, hx, he⟩ + rw [← hw₀] at he + have h3 := hbi he + rw [h3] at hx + exact zero_ne_one hx + · intro y' hy' hyC' + obtain ⟨⟨w, t⟩, htA, rfl⟩ := hsub hy' + have htd : (t : ℝ) < d w := htA + have ht0 : 0 < (t : ℝ) := by + refine lt_of_le_of_ne t.2.1 fun h => hyC' ?_ + have ht : t = 0 := Subtype.ext h.symm + rw [ht, hb0] + exact (φ w).2 + refine ⟨b (w, 0), by rw [hb0]; exact (φ w).2, ?_⟩ + have hdw : 0 < d w := ht0.trans htd + have hg0 : g (w, 0) = d w / 2 := by + have : max ((0 : 𝕀) : ℝ) ((d w + ((0 : 𝕀) : ℝ)) / 2) = d w / 2 := by + simp only [Icc.coe_zero, add_zero] + exact max_eq_right (by linarith) + exact this + rw [hH1] + exact joined_in_collar_below_gap φ hbc hbi hb0 hd1 hdZ w t _ ht0 htd hg0 + +/-- **Pushing off a cuff.** See the module docstring. -/ +theorem exists_taper {Y : Type u} [TopologicalSpace Y] (hY : IsSurface Y) {C : Set Y} + (hC : IsCuff C) (φ : Circle ≃ₜ C) + {Z : Set Y} (hZ : IsClosed Z) : + ∃ H : 𝕀 × Y → Y, Continuous H ∧ (∀ y, H (0, y) = y) ∧ Function.Injective (fun y => H (1, y)) ∧ + (∀ z ∈ Z, H (1, z) = z) ∧ + (∀ y, H (1, y) ∈ Z → y ∈ Z) ∧ (∀ y, H (1, y) ∈ C → H (1, y) ∈ Z) := by + obtain ⟨H, h1, h2, h3, h4, h5, h6, -⟩ := exists_taper_sides hY hC φ hZ + exact ⟨H, h1, h2, h3, h4, h5, h6⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/ThickForest.lean b/LeanPool/GraphMinor/GM07/ThickForest.lean new file mode 100644 index 0000000000..6ce77878ca --- /dev/null +++ b/LeanPool/GraphMinor/GM07/ThickForest.lean @@ -0,0 +1,1241 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.JoinDiscs +public import LeanPool.GraphMinor.GM07.Section5b +public import LeanPool.GraphMinor.GM19.RadialExists +public import LeanPool.GraphMinor.Surface.PushOff +public import LeanPool.GraphMinor.Surface.SurfacePull + +/-! +# Discs around a forest in a surface + +Graph Minors VII, (3.4), claim (1) (page 220), says that a thin neighbourhood of each component of a +forest `H` is a disc. This +file proves it. We add discs to the cuffs of `Σ`, to get a closed surface. Around each vertex of `H` +we take a star disc of the +drawing made of `H` and the cuffs. At a vertex in `bd(Σ)` we keep the half of the disc in `Σ` +(`exists_half`). Each edge of `H` now +leaves the star disc at its ends in one point, and between them it is a line that misses all these +discs (`exists_edge_piece`). So +`exists_forest_discs` applies. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 unitInterval + +variable {S T : Type} [TopologicalSpace S] [TopologicalSpace T] + +/-- A surface with its cuffs capped: the frontier of the surface is its boundary. -/ +theorem cap_frontier {j : S → T} {K : Set T} (hT : IsClosedSurface T) (hj : IsClosedEmbedding j) + (hK : IsClosed K) + (hu : range j ∪ K = univ) (hi : range j ∩ K = j '' bd S) : frontier (range j) = j '' bd S := by + have hoff : ∀ z, z ∉ bd S → j z ∈ interior (range j) := fun z hz => by + have h1 : j z ∉ K := fun h => by + have : j z ∈ j '' bd S := hi ▸ ⟨⟨z, rfl⟩, h⟩ + obtain ⟨z', hz', e⟩ := this + exact hz (hj.injective e ▸ hz') + refine interior_maximal (s := range j) ?_ hK.isOpen_compl h1 + intro x hx + have : x ∈ range j ∪ K := hu ▸ mem_univ x + exact this.resolve_right hx + have hon : ∀ z, z ∈ bd S → j z ∉ interior (range j) := fun z hz hin => by + have hO : IsOpen (j ⁻¹' interior (range j)) := isOpen_interior.preimage hj.continuous + let k : (j ⁻¹' interior (range j)) → T := fun x => j x.1 + have hk : IsOpenEmbedding k := by + refine ⟨hj.isEmbedding.comp IsEmbedding.subtypeVal, ?_⟩ + have : range k = interior (range j) := by + ext x + constructor + · rintro ⟨y, rfl⟩ + exact y.2 + · intro hx + obtain ⟨y, rfl⟩ := interior_subset hx + exact ⟨⟨y, hx⟩, rfl⟩ + rw [this] + exact isOpen_interior + have h1 : IsInteriorPoint (⟨z, hin⟩ : (j ⁻¹' interior (range j))) := + (isInteriorPoint_iff_of_isOpenEmbedding hk).mp (hT.2.2 _) + exact hz ((isInteriorPoint_sub hO).mp h1) + have hc : IsClosed (range j) := hj.isClosed_range + ext x + constructor + · rintro ⟨h1, h2⟩ + rw [hc.closure_eq] at h1 + obtain ⟨z, rfl⟩ := h1 + by_cases hz : z ∈ bd S + · exact ⟨z, hz, rfl⟩ + · exact (h2 (hoff z hz)).elim + · rintro ⟨z, hz, rfl⟩ + rw [frontier, hc.closure_eq] + exact ⟨⟨z, rfl⟩, hon z hz⟩ + +/-- A point of the boundary is a limit of interior points of the capped surface inside the surface, +and of points outside. -/ +theorem cap_limits {j : S → T} {K : Set T} (hS : IsSurface S) (hT : IsClosedSurface T) + (hj : IsClosedEmbedding j) (hK : IsClosed K) + (hu : range j ∪ K = univ) (hi : range j ∩ K = j '' bd S) {y : S} (hy : y ∈ bd S) : + j y ∈ closure (interior (range j)) ∧ j y ∈ closure (range j)ᶜ := by + have hf := cap_frontier hT hj hK hu hi + have hyf : j y ∈ frontier (range j) := hf ▸ ⟨y, hy, rfl⟩ + constructor + · have h1 : y ∈ closure (bd S)ᶜ := mem_closure_compl_bd (hS.2.2 y) + refine map_mem_closure hj.continuous h1 fun z hz => ?_ + by_contra hn + have : j z ∈ frontier (range j) := ⟨subset_closure ⟨z, rfl⟩, hn⟩ + rw [hf] at this + obtain ⟨z', hz', e⟩ := this + exact hz (hj.injective e ▸ hz') + · rw [closure_compl] + exact hyf.2 + +/-- **Half of a star disc.** A closed set `B` with frontier a chord of the star disc through its +centre. -/ +theorem exists_half (hT : IsClosedSurface T) {Γ : Drawing T} {y w : T} {R C A₁ A₂ B : Set T} + (h : IsStarDisc Γ y R) + (h₁ : IsLineWithEnds A₁ w y) (h₂ : IsLineWithEnds A₂ w y) (hC : C = A₁ ∪ A₂) (hm : A₁ ∩ A₂ + = {w, y}) (hw : w ∉ R) + (hCc : IsClosed C) (hCn : IsGammaNice Γ C) (hB : IsClosed B) (hf : frontier B ∩ R = C ∩ R) + (hin : y ∈ closure (interior B)) (hout : y ∈ closure Bᶜ) : + ∃ s t ℓ P E c c', IsLineWithEnds ℓ s t ∧ s ≠ t ∧ ℓ = C ∩ R ∧ IsClosedDisc P ∧ IsClosedDisc E + ∧ P ∪ E = R ∧ P ∩ E = ℓ ∧ + IsLineWithEnds c s t ∧ IsLineWithEnds c' s t ∧ c ∪ c' = discBd R ∧ c ∩ c' = {s, t} ∧ discBd P + = c ∪ ℓ ∧ discBd E = c' ∪ ℓ ∧ + ℓ ∩ discBd R = {s, t} ∧ y ∈ ℓ ∧ P ⊆ B ∧ Disjoint (E \ ℓ) B ∧ s ∈ A₁ ∧ t ∈ A₂ := by + have ht2 : T2Space T := hT.2.1 + obtain ⟨s, t, ρ₁, ρ₂, B₁, B₂, r₁, r₂, l₁, l₂, u₁, u₂, hl, hst, hF, hbd⟩ + := exists_chord hT h h₁ h₂ hC hm hw hCc hCn + have hyℓ : y ∈ ρ₁ ∪ ρ₂ := .inl r₁.right_mem + have hsub : ρ₁ ∪ ρ₂ ⊆ R := by rw [hF]; exact inter_subset_right + have hsA : s ∈ A₁ := u₁ ▸ .inl l₁.right_mem + have htA : t ∈ A₂ := u₂ ▸ .inl l₂.right_mem + obtain ⟨Δ₁, Δ₂, c₁, c₂, c1, c2, hu, hi, d₁, d₂, hU, hI, b₁, b₂, p₁, p₂⟩ + := disc_split h.disc hsub hst hl hbd + have hfr : frontier B ∩ R = ρ₁ ∪ ρ₂ := by rw [hf, hF] + rcases side_of_frontier hT h.disc hU hI p₁ p₂ hB hfr hyℓ h.mem hin hout with ⟨h3, h4⟩ | ⟨h3, h4⟩ + · exact ⟨s, t, _, Δ₁, Δ₂, c₁, c₂, hl, hst, hF, d₁, d₂, hU, hI, c1, c2, hu, hi, b₁, b₂, hbd, + hyℓ, h3, h4, hsA, htA⟩ + · exact ⟨s, t, _, Δ₂, Δ₁, c₂, c₁, hl, hst, hF, d₂, d₁, by rw [union_comm, hU], + by rw [inter_comm, hI], c2, c1, + by rw [union_comm, hu], by rw [inter_comm, hi], b₂, b₁, hbd, hyℓ, h3, h4, hsA, htA⟩ + +/-- **An edge between two star discs.** It is a ray in each disc, and a line between them. -/ +theorem exists_edge_piece (hT : IsClosedSurface T) {Γ : Drawing T} {u v : T} {Ru Rv L : Set T} + (hu : IsStarDisc Γ u Ru) + (hv : IsStarDisc Γ v Rv) (hdis : Disjoint Ru Rv) (hL : IsLineWithEnds L u v) (hLc : IsClosed L) + (hLn : IsGammaNice Γ L) : + ∃ p q M ρu ρv, IsLineWithEnds M p q ∧ L = ρu ∪ M ∪ ρv ∧ ρu = L ∩ Ru ∧ ρv = L ∩ Rv ∧ M ∩ Ru + = {p} ∧ M ∩ Rv = {q} ∧ + p ∈ discBd Ru ∧ q ∈ discBd Rv ∧ ρu \ {p} ⊆ discInt Ru ∧ ρv \ {q} ⊆ discInt Rv ∧ u ∉ M ∧ v ∉ M + := by + have ht2 : T2Space T := hT.2.1 + have huRv : u ∉ Rv := disjoint_left.mp hdis hu.mem.1 + obtain ⟨q, L₁, L₂, l1, l2, hun, hin, e₂, hqb, hqi, hqu, hqv⟩ := + exists_ray hT hv hL huRv hLc hLn (by simp) isClosed_empty (by simp) + have hqRv : q ∈ Rv := by + have : q ∈ L₂ := l2.left_mem + rw [e₂] at this + exact this.2 + have hqRu : q ∉ Ru := fun h => disjoint_left.mp hdis h hqRv + obtain ⟨p, N₁, N₂, n1, n2, hun', hin', e₃, hpb, hpi, hpq, hpu⟩ := + exists_ray hT hu l1.symm hqRu hLc hLn (by rw [hun]) l2.isCompact.isClosed + (by rw [hin]; exact fun x hx => .inl hx) + have hL₂Rv : L₂ ⊆ Rv := fun x hx => (e₂ ▸ hx : x ∈ L ∩ Rv).2 + have hN₁L₁ : N₁ ⊆ L₁ := hun' ▸ subset_union_left + have hN₂L₁ : N₂ ⊆ L₁ := hun' ▸ subset_union_right + have hN₂Ru : N₂ ⊆ Ru := fun x hx => (e₃ ▸ hx : x ∈ L₁ ∩ Ru).2 + have hL₂off : ∀ x ∈ L₂, x ∉ Ru := fun x hx h => disjoint_left.mp hdis h (hL₂Rv hx) + refine ⟨p, q, N₁, N₂, L₂, n1.symm, ?_, ?_, e₂, ?_, ?_, hpb, hqb, hpi, hqi, ?_, ?_⟩ + · rw [← hun, ← hun', union_comm N₂ N₁] + · ext x + constructor + · intro hx + exact ⟨hun ▸ .inl (hN₂L₁ hx), hN₂Ru hx⟩ + · rintro ⟨h1, h2⟩ + rw [← hun] at h1 + rcases h1 with h1 | h1 + · rw [e₃] + exact ⟨h1, h2⟩ + · exact (hL₂off x h1 h2).elim + · ext x + constructor + · rintro ⟨h1, h2⟩ + have : x ∈ N₁ ∩ N₂ := ⟨h1, by rw [e₃]; exact ⟨hN₁L₁ h1, h2⟩⟩ + rwa [hin'] at this + · rintro rfl + exact ⟨n1.right_mem, hN₂Ru n2.left_mem⟩ + · ext x + constructor + · rintro ⟨h1, h2⟩ + have : x ∈ L₁ ∩ L₂ := ⟨hN₁L₁ h1, by rw [e₂]; exact ⟨hun ▸ .inl (hN₁L₁ h1), h2⟩⟩ + rwa [hin] at this + · rintro rfl + exact ⟨n1.left_mem, hqRv⟩ + · intro h + have : u ∈ N₁ ∩ N₂ := ⟨h, n2.right_mem⟩ + rw [hin'] at this + exact hpu this.symm + · intro h + have : v ∈ L₁ ∩ L₂ := ⟨hN₁L₁ h, l2.right_mem⟩ + rw [hin] at this + exact hqv this.symm + +/-- A point `y` of a cuff, with a parameter `f` of the cuff that starts at `y`, and a piece `f [-ε, +ε]` of it around `y`. -/ +structure CuffMark (f : ℝ → S) (ε : ℝ) (y : S) : Prop where + cont : Continuous f + zero : f 0 = y + pos : 0 < ε + lt : ε < 1 + inj : InjOn f (Ioc (-Real.pi) Real.pi) + per : f (-Real.pi) = f Real.pi + onBd : ∀ t ∈ Icc (-Real.pi) Real.pi, f t ∈ bd S + rest : IsClosed (bd S \ f '' Icc (-Real.pi) Real.pi) + +private theorem cuff_image_eq_union_of_half_cuff_ranges + {S : Type} + {T : Type} + {j : S → T} + {f : ℝ → S} + {ε : ℝ} + (hpi : 3 < Real.pi) + (hε : 0 < ε) + (hε1 : ε < 1) + (hmap₁ : ∀ (u : ↑I), (1 - ↑u) * Real.pi ∈ Ioc (-Real.pi) Real.pi ∧ 0 ≤ (1 - ↑u) * Real.pi) + (hform₁ : ∀ θ ∈ Icc 0 Real.pi, ∃ u : I, (1 - ↑u) * Real.pi = θ) : + j '' f '' Icc (-Real.pi) Real.pi = range (fun u : I => j (f ((1 - ↑u) * Real.pi))) ∪ + range (fun u : I => j (f (-((1 - ↑u) * Real.pi)))) := by + ext z + constructor + · rintro ⟨_, ⟨θ, hθ, rfl⟩, rfl⟩ + rcases le_total 0 θ with h0 | h0 + · obtain ⟨u, hu⟩ := hform₁ θ ⟨h0, hθ.2⟩ + exact .inl ⟨u, by simp only [hu]⟩ + · obtain ⟨u, hu⟩ := hform₁ (-θ) ⟨by linarith, by linarith [hθ.1]⟩ + exact .inr ⟨u, by simp only [hu, neg_neg]⟩ + · rintro (⟨u, rfl⟩ | ⟨u, rfl⟩) + · have := hmap₁ u + exact ⟨_, ⟨_, ⟨by linarith [this.1.1], this.1.2⟩, rfl⟩, rfl⟩ + · have := hmap₁ u + exact ⟨_, ⟨_, ⟨by linarith [this.1.2], by linarith [this.2]⟩, rfl⟩, rfl⟩ + +private theorem half_cuff_ranges_intersect_at_endpoints + {S : Type} + {T : Type} + [TopologicalSpace T] + {j : S → T} + {y : S} + {f : ℝ → S} + (hg0₁ : (fun u : I => j (f ((1 - ↑u) * Real.pi))) 0 = j (f Real.pi)) + (hg1₁ : (fun u : I => j (f ((1 - ↑u) * Real.pi))) 1 = j y) + (hl₁ : IsLineWithEnds (range (fun u : I => j (f ((1 - ↑u) * Real.pi)))) (j (f Real.pi)) (j y)) + (hl₂ : IsLineWithEnds (range (fun u : I => j (f (-((1 - ↑u) * Real.pi))))) + (j (f Real.pi)) (j y)) + (hmeet : ∀ (s t : ↑I), (fun u : I => j (f ((1 - ↑u) * Real.pi))) s = + (fun u : I => j (f (-((1 - ↑u) * Real.pi)))) t → s = 0 ∧ t = 0 ∨ s = 1 ∧ t = 1) : + range (fun u : I => j (f ((1 - ↑u) * Real.pi))) ∩ + range (fun u : I => j (f (-((1 - ↑u) * Real.pi)))) = {j (f Real.pi), j y} := by + let g₁ := fun u : I => j (f ((1 - ↑u) * Real.pi)) + let g₂ := fun u : I => j (f (-((1 - ↑u) * Real.pi))) + ext z + constructor + · rintro ⟨⟨s, rfl⟩, ⟨t, ht⟩⟩ + rcases hmeet s t ht.symm with ⟨h1, -⟩ | ⟨h1, -⟩ + · exact .inl (by rw [h1, hg0₁]) + · exact .inr (by rw [h1, hg1₁]; rfl) + · rintro (rfl | rfl) + · exact ⟨hl₁.left_mem, hl₂.left_mem⟩ + · exact ⟨hl₁.right_mem, hl₂.right_mem⟩ + +private theorem vertex_half_disc_boundary_equals_cuff_interval + {S : Type} + {T : Type} + {j : S → T} + {f : ℝ → S} + {ε : ℝ} + (hpi : 3 < Real.pi) + (hε1 : ε < 1) + (R : Set T) + (ℓ : Set T) + (eℓ : ℓ = j '' f '' Icc (-Real.pi) Real.pi ∩ R) + (σ₁ : ℝ) + (σ₂ : ℝ) + (hσp₁ : 0 < σ₁) + (hσp₂ : 0 < σ₂) + (hin₁ : ∀ θ ∈ Icc 0 Real.pi, j (f θ) ∈ R ↔ θ ≤ σ₁) + (hin₂ : ∀ θ ∈ Icc 0 Real.pi, j (f (-θ)) ∈ R ↔ θ ≤ σ₂) + (hσε₁ : σ₁ < ε) + (hσε₂ : σ₂ < ε) : + ℓ = j '' f '' Icc (-σ₂) σ₁ := by + rw [eℓ] + ext z + constructor + · rintro ⟨⟨_, ⟨θ, hθ, rfl⟩, rfl⟩, h2⟩ + rcases le_total 0 θ with h0 | h0 + · exact ⟨_, ⟨θ, ⟨by linarith, (hin₁ θ ⟨h0, hθ.2⟩).mp h2⟩, rfl⟩, rfl⟩ + · have h3 : j (f (- -θ)) ∈ R := by rwa [neg_neg] + have := (hin₂ (-θ) ⟨by linarith, by linarith [hθ.1]⟩).mp h3 + exact ⟨_, ⟨θ, ⟨by linarith, by linarith⟩, rfl⟩, rfl⟩ + · rintro ⟨_, ⟨θ, hθ, rfl⟩, rfl⟩ + refine ⟨⟨_, ⟨θ, ⟨by linarith [hθ.1], by linarith [hθ.2]⟩, rfl⟩, rfl⟩, ?_⟩ + rcases le_total 0 θ with h0 | h0 + · exact (hin₁ θ ⟨h0, by linarith [hθ.2]⟩).mpr hθ.2 + · have := (hin₂ (-θ) ⟨by linarith, by linarith [hθ.1]⟩).mpr (by linarith [hθ.1]) + rwa [neg_neg] at this + +/-- **The half disc at a vertex on a cuff.** -/ +theorem exists_vertex_bd {j : S → T} {K : Set T} (hS : IsSurface S) (hT : IsClosedSurface T) + (hj : IsClosedEmbedding j) + (hK : IsClosed K) (hu : range j ∪ K = univ) (hi : range j ∩ K = j '' bd S) {Γ : Drawing T} {y : + S} {f : ℝ → S} {ε : ℝ} + (m : CuffMark f ε y) (hyV : j y ∈ Γ.V) {W : Set T} (hW : IsOpen W) (hyW : j y ∈ W) + (hoff : Disjoint W (j '' (bd S \ f '' Ioo (-ε) ε))) (hCn : IsGammaNice Γ (j '' (f '' Icc + (-Real.pi) Real.pi))) : + ∃ R P σ₁ σ₂, IsStarDisc Γ (j y) R ∧ R ⊆ W ∧ IsClosedDisc P ∧ P ⊆ R ∧ P ⊆ range j ∧ + (∀ z ∈ R, z ∈ range j → z ∈ P) ∧ + (∀ z ∈ discBd R, z ∈ range j → z ∉ K → z ∈ discBd P) ∧ (∀ z ∈ discInt R, z ∈ range j → z ∉ K + → z ∈ discInt P) ∧ + 0 < σ₁ ∧ σ₁ < ε ∧ 0 < σ₂ ∧ σ₂ < ε ∧ P ∩ K = j '' (f '' Icc (-σ₂) σ₁) ∧ j '' (f '' Icc + (-σ₂) σ₁) ⊆ discBd P ∧ + j '' (f '' Ioo (-σ₂) σ₁) ⊆ discInt R := by + have ht2 : T2Space T := hT.2.1 + have hpi : (3 : ℝ) < Real.pi := Real.pi_gt_three + have hε := m.pos + have hε1 := m.lt + have hyb : y ∈ bd S := m.zero ▸ m.onBd 0 ⟨by linarith, by linarith⟩ + obtain ⟨R, hR, hRW⟩ := exists_starDisc hT Γ hyV hW hyW + have hRoff : ∀ x, x ∈ bd S → j x ∈ R → x ∈ f '' Ioo (-ε) ε := fun x hx h => by + by_contra hn + exact disjoint_left.mp hoff (hRW h) ⟨x, ⟨hx, hn⟩, rfl⟩ + -- The two halves of the cuff, as arcs that end at `y`. + have hmap₁ : ∀ u : I, (1 - u.1) * Real.pi ∈ Ioc (-Real.pi) Real.pi ∧ 0 ≤ (1 - u.1) * Real.pi + := fun u => by + have h0 := u.2.1 + have h1 := u.2.2 + have h2 : 0 ≤ (1 - u.1) * Real.pi := mul_nonneg (by linarith) (by linarith) + exact ⟨⟨by linarith, by nlinarith⟩, h2⟩ + let g₁ : I → T := fun u => j (f ((1 - u.1) * Real.pi)) + let g₂ : I → T := fun u => j (f (-((1 - u.1) * Real.pi))) + have hc₁ : Continuous g₁ := hj.continuous.comp (m.cont.comp (by fun_prop)) + have hc₂ : Continuous g₂ := hj.continuous.comp (m.cont.comp (by fun_prop)) + have hinjR : ∀ {s t : ℝ}, s = t → (1 - s) * Real.pi = (1 - t) * Real.pi := fun h => by rw [h] + have hval : ∀ {s t : I}, (1 - s.1) * Real.pi = (1 - t.1) * Real.pi → s = t := fun {s t} h => by + have : 1 - s.1 = 1 - t.1 := mul_right_cancel₀ (by linarith) h + exact Subtype.ext (by linarith) + have hi₁ : Function.Injective g₁ := fun s t h => hval (m.inj (hmap₁ s).1 (hmap₁ t).1 + (hj.injective h)) + have hg0₁ : g₁ 0 = j (f Real.pi) := by simp [g₁] + have hg1₁ : g₁ 1 = j y := by simp [g₁, m.zero] + have hg0₂ : g₂ 0 = j (f Real.pi) := by simp [g₂, m.per] + have hg1₂ : g₂ 1 = j y := by simp [g₂, m.zero] + have hmap₂ : ∀ u : I, u ≠ 0 → -((1 - u.1) * Real.pi) ∈ Ioc (-Real.pi) Real.pi := fun u hu0 => by + have h0 : 0 < u.1 := unitInterval.pos_iff_ne_zero.mpr hu0 + have h1 := u.2.2 + have h2 := (hmap₁ u).2 + exact ⟨by nlinarith, by linarith⟩ + have hi₂ : Function.Injective g₂ := fun s t h => by + by_cases hs : s = 0 <;> by_cases ht : t = 0 + · rw [hs, ht] + · rw [hs, hg0₂] at h + have h3 := hj.injective h + have h4 := m.inj ⟨by linarith, le_rfl⟩ (hmap₂ t ht) h3 + have h5 := (hmap₁ t).2 + linarith + · rw [ht, hg0₂] at h + have h3 := hj.injective h + have h4 := m.inj (hmap₂ s hs) ⟨by linarith, le_rfl⟩ h3 + have h5 := (hmap₁ s).2 + linarith + · have h4 := m.inj (hmap₂ s hs) (hmap₂ t ht) (hj.injective h) + exact hval (by linarith) + have ha₁ : IsArcMap g₁ := ⟨hc₁, hi₁⟩ + have ha₂ : IsArcMap g₂ := ⟨hc₂, hi₂⟩ + have hl₁ : IsLineWithEnds (range g₁) (j (f Real.pi)) (j y) := by + have := ha₁.isLineWithEnds + rwa [hg0₁, hg1₁] at this + have hl₂ : IsLineWithEnds (range g₂) (j (f Real.pi)) (j y) := by + have := ha₂.isLineWithEnds + rwa [hg0₂, hg1₂] at this + have hform₁ : ∀ θ ∈ Icc (0 : ℝ) Real.pi, ∃ u : I, (1 - u.1) * Real.pi = θ := fun θ hθ => by + refine ⟨⟨1 - θ / Real.pi, ?_, ?_⟩, ?_⟩ + · have : θ / Real.pi ≤ 1 := (div_le_one (by linarith)).mpr hθ.2 + linarith + · have : 0 ≤ θ / Real.pi := div_nonneg hθ.1 (by linarith) + linarith + · field_simp + ring + have hC : j '' (f '' Icc (-Real.pi) Real.pi) = range g₁ ∪ range g₂ := by + exact cuff_image_eq_union_of_half_cuff_ranges (S := S) (T := T) (j := j) (f := f) (ε := ε) hpi + hε hε1 hmap₁ hform₁ + have hmeet : ∀ s t, g₁ s = g₂ t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := fun s t h => by + by_cases ht : t = 0 + · refine .inl ⟨?_, ht⟩ + rw [ht, hg0₂, ← hg0₁] at h + exact hi₁ h + · have h4 := m.inj (hmap₁ s).1 (hmap₂ t ht) (hj.injective h) + have h5 := (hmap₁ s).2 + have h6 := (hmap₁ t).2 + have h7 : (1 - s.1) * Real.pi = 0 := by linarith + have h8 : (1 - t.1) * Real.pi = 0 := by linarith + have h9 : ∀ u : I, (1 - u.1) * Real.pi = 0 → u = 1 := fun u hu => by + have := (mul_eq_zero.mp hu).resolve_right Real.pi_ne_zero + exact Subtype.ext (show (u : ℝ) = 1 by linarith) + exact .inr ⟨h9 s h7, h9 t h8⟩ + have hm : range g₁ ∩ range g₂ = {j (f Real.pi), j y} := by + exact half_cuff_ranges_intersect_at_endpoints (S := S) (T := T) (j := j) (y := y) (f := f) + hg0₁ hg1₁ hl₁ hl₂ hmeet + have hpiB : f Real.pi ∈ bd S := m.onBd _ ⟨by linarith, le_rfl⟩ + have hwR : j (f Real.pi) ∉ R := fun h => by + obtain ⟨t, ht, e⟩ := hRoff _ hpiB h + have := m.inj ⟨by linarith [ht.1], by linarith [ht.2]⟩ ⟨by linarith, le_rfl⟩ e + linarith [ht.2] + have hCc : IsClosed (j '' (f '' Icc (-Real.pi) Real.pi)) := + ((isCompact_Icc.image m.cont).image hj.continuous).isClosed + have hR₁ : IsStarDisc Γ (g₁ 1) R := hg1₁ ▸ hR + have hR₂ : IsStarDisc Γ (g₂ 1) R := hg1₂ ▸ hR + obtain ⟨τ₁, h0₁, h1₁, hT₁, hb₁, ha₁'⟩ := exists_ray_param hT hR₁ ha₁ + (by rwa [hg0₁]) hCc hCn hC ha₂.isLineWithEnds.isCompact.isClosed + (by rw [hm, hg0₁, hg1₁]) + obtain ⟨τ₂, h0₂, h1₂, hT₂, hb₂, ha₂'⟩ := exists_ray_param hT hR₂ ha₂ (by rwa [hg0₂]) hCc hCn + (by rw [hC, union_comm]) + ha₁.isLineWithEnds.isCompact.isClosed (by rw [inter_comm, hm, hg0₂, hg1₂]) + have hf : frontier (range j) ∩ R = j '' (f '' Icc (-Real.pi) Real.pi) ∩ R := by + rw [cap_frontier hT hj hK hu hi] + ext z + constructor + · rintro ⟨⟨x, hx, rfl⟩, h2⟩ + obtain ⟨t, ht, e⟩ := hRoff x hx h2 + exact ⟨⟨x, ⟨t, ⟨by linarith [ht.1], by linarith [ht.2]⟩, e⟩, rfl⟩, h2⟩ + · rintro ⟨⟨_, ⟨t, ht, rfl⟩, rfl⟩, h2⟩ + exact ⟨⟨_, m.onBd t ht, rfl⟩, h2⟩ + obtain ⟨hin, hout⟩ := cap_limits hS hT hj hK hu hi hyb + obtain ⟨s, t, ℓ, P, E, c, c', hl, hst, eℓ, dP, dE, hU, hI, lc, lc', huc, hic, bP, bE, hbd, hyℓ, + hPB, hEB, -, -⟩ := + exists_half hT hR hl₁ hl₂ hC hm hwR hCc hCn hj.isClosed_range hf hin hout + set σ₁ : ℝ := (1 - τ₁.1) * Real.pi with hσ₁ + set σ₂ : ℝ := (1 - τ₂.1) * Real.pi with hσ₂ + have hlt₁ : (τ₁ : ℝ) < 1 := h1₁ + have hlt₂ : (τ₂ : ℝ) < 1 := h1₂ + have hσp₁ : 0 < σ₁ := mul_pos (by linarith) (by linarith) + have hσp₂ : 0 < σ₂ := mul_pos (by linarith) (by linarith) + have hle : ∀ {a b : I}, (1 - a.1) * Real.pi ≤ (1 - b.1) * Real.pi ↔ b ≤ a := fun {a b} => by + constructor + · intro h + have := le_of_mul_le_mul_right h (by linarith : (0 : ℝ) < Real.pi) + exact Subtype.coe_le_coe.mp (by linarith) + · intro h + have h' : (b : ℝ) ≤ a := h + exact mul_le_mul_of_nonneg_right (by linarith) (by linarith) + have hlts : ∀ {a b : I}, (1 - a.1) * Real.pi < (1 - b.1) * Real.pi ↔ b < a := fun {a b} => by + rw [← not_le, ← not_le, hle] + have hin₁ : ∀ θ ∈ Icc (0 : ℝ) Real.pi, j (f θ) ∈ R ↔ θ ≤ σ₁ := fun θ hθ => by + obtain ⟨u, rfl⟩ := hform₁ θ hθ + exact (hT₁ u).trans hle.symm + have hin₂ : ∀ θ ∈ Icc (0 : ℝ) Real.pi, j (f (-θ)) ∈ R ↔ θ ≤ σ₂ := fun θ hθ => by + obtain ⟨u, rfl⟩ := hform₁ θ hθ + exact (hT₂ u).trans hle.symm + have hσε₁ : σ₁ < ε := by + have hmem : g₁ τ₁ ∈ R := (hT₁ τ₁).mpr le_rfl + obtain ⟨t, ht, e⟩ := hRoff _ (m.onBd _ ⟨by linarith [(hmap₁ τ₁).2], (hmap₁ τ₁).1.2⟩) hmem + have := m.inj ⟨by linarith [ht.1], by linarith [ht.2]⟩ (hmap₁ τ₁).1 e + linarith [ht.2] + have hσε₂ : σ₂ < ε := by + have hmem : g₂ τ₂ ∈ R := (hT₂ τ₂).mpr le_rfl + obtain ⟨t, ht, e⟩ := hRoff _ (m.onBd _ ⟨by linarith [(hmap₁ τ₂).1.2], by linarith [(hmap₁ + τ₂).2]⟩) hmem + have := m.inj ⟨by linarith [ht.1], by linarith [ht.2]⟩ (hmap₂ τ₂ h0₂.ne') e + linarith [ht.1] + have hℓ : ℓ = j '' (f '' Icc (-σ₂) σ₁) := by + exact vertex_half_disc_boundary_equals_cuff_interval (S := S) (T := T) (j := j) (f := f) (ε := + ε) hpi hε1 R ℓ eℓ σ₁ σ₂ hσp₁ hσp₂ hin₁ hin₂ hσε₁ hσε₂ + have hℓP : ℓ ⊆ P := fun x hx => (hI ▸ hx : x ∈ P ∩ E).1 + have hoffE : ∀ z ∈ E, z ∈ range j → z ∈ ℓ := fun z h1 h2 => by + by_contra h3 + exact disjoint_left.mp hEB ⟨h1, h3⟩ h2 + have hℓK : ℓ ⊆ K := fun z hz => by + have h1 : z ∈ j '' (f '' Icc (-Real.pi) Real.pi) ∩ R := eℓ ▸ hz + obtain ⟨_, ⟨θ, hθ, rfl⟩, rfl⟩ := h1.1 + have hjb : j (f θ) ∈ range j ∩ K := hi ▸ mem_image_of_mem j (m.onBd θ hθ) + exact hjb.2 + have hcbd : c ⊆ discBd R := huc ▸ subset_union_left + have hsplit : ∀ z ∈ discBd R, z ∈ range j → z ∉ K → z ∈ c := fun z h1 h2 h3 => by + have h4 : z ∈ c ∪ c' := huc ▸ h1 + refine h4.resolve_right fun h5 => h3 (hℓK (hoffE z ?_ h2)) + exact GM11.discBd_subset E (bE ▸ Or.inl h5) + have hRP : ∀ z ∈ R, z ∈ range j → z ∈ P := fun z h1 h2 => by + have h3 : z ∈ P ∪ E := hU ▸ h1 + rcases h3 with h3 | h3 + · exact h3 + · exact hℓP (hoffE z h3 h2) + refine ⟨R, P, σ₁, σ₂, hR, hRW, dP, fun x hx => hU ▸ Or.inl hx, hPB, hRP, fun z h1 h2 h3 => ?_, + fun z h1 h2 h3 => ?_, hσp₁, hσε₁, hσp₂, hσε₂, + ?_, ?_, ?_⟩ + · exact bP ▸ Or.inl (hsplit z h1 h2 h3) + · refine ⟨hRP z h1.1 h2, fun h4 => ?_⟩ + rw [bP] at h4 + rcases h4 with h4 | h4 + · exact h1.2 (hcbd h4) + · exact h3 (hℓK h4) + · rw [← hℓ] + ext z + constructor + · rintro ⟨h1, h2⟩ + have hzr : z ∈ range j ∩ K := ⟨hPB h1, h2⟩ + rw [hi] at hzr + obtain ⟨x, hx, rfl⟩ := hzr + have hxR : j x ∈ R := hU ▸ Or.inl h1 + obtain ⟨t, ht, e⟩ := hRoff x hx hxR + rw [eℓ] + exact ⟨⟨x, ⟨t, ⟨by linarith [ht.1], by linarith [ht.2]⟩, e⟩, rfl⟩, hxR⟩ + · exact fun h => ⟨hℓP h, hℓK h⟩ + · rw [← hℓ, bP] + exact subset_union_right + · rintro _ ⟨_, ⟨θ, hθ, rfl⟩, rfl⟩ + rcases le_total 0 θ with h0 | h0 + · obtain ⟨u, hu⟩ := hform₁ θ ⟨h0, by linarith [hθ.2]⟩ + have := ha₁' u (hlts.mp (by rw [hu]; exact hθ.2)) + simpa only [g₁, hu] using this + · obtain ⟨u, hu⟩ := hform₁ (-θ) ⟨by linarith, by linarith [hθ.1]⟩ + have := ha₂' u (hlts.mp (by rw [hu]; linarith [hθ.1])) + simpa only [g₂, hu, neg_neg] using this + +/-- The part of `bd(Σ)` off a piece of the cuff is closed. -/ +theorem CuffMark.isClosed_rest' {f : ℝ → S} {ε : ℝ} {y : S} [T2Space S] + (m : CuffMark f ε y) {c d : ℝ} (hc : -Real.pi ≤ c) (hd : d < Real.pi) + (hcd : c < d) : IsClosed (bd S \ f '' Ioo c d) := by + have hsub : ∀ {t}, t ∈ Ioo c d → t ∈ Ioc (-Real.pi) Real.pi := fun ht + => ⟨by linarith [ht.1], by linarith [ht.2]⟩ + have heq : bd S \ f '' Ioo c d = (bd S \ f '' Icc (-Real.pi) Real.pi) ∪ f '' Icc + (-Real.pi) c ∪ f '' Icc d Real.pi := by + ext x + constructor + · rintro ⟨h1, h2⟩ + by_cases h3 : x ∈ f '' Icc (-Real.pi) Real.pi + · obtain ⟨t, ht, rfl⟩ := h3 + rcases le_total t c with h4 | h4 + · exact .inl (.inr ⟨t, ⟨ht.1, h4⟩, rfl⟩) + · rcases le_total d t with h5 | h5 + · exact .inr ⟨t, ⟨h5, ht.2⟩, rfl⟩ + · rcases h4.eq_or_lt with h6 | h6 + · exact .inl (.inr ⟨t, ⟨ht.1, h6.ge⟩, rfl⟩) + · rcases h5.eq_or_lt with h7 | h7 + · exact .inr ⟨t, ⟨h7.ge, ht.2⟩, rfl⟩ + · exact (h2 ⟨t, ⟨h6, h7⟩, rfl⟩).elim + · exact .inl (.inl ⟨h1, h3⟩) + · rintro ((h | ⟨t, ht, rfl⟩) | ⟨t, ht, rfl⟩) + · refine ⟨h.1, ?_⟩ + rintro ⟨t, ht, rfl⟩ + exact h.2 ⟨t, ⟨(hsub ht).1.le, (hsub ht).2⟩, rfl⟩ + · refine ⟨m.onBd t ⟨ht.1, by linarith [ht.2, Real.pi_pos]⟩, ?_⟩ + rintro ⟨r, hr, e⟩ + rcases ht.1.eq_or_lt with h0 | h0 + · rw [← h0, m.per] at e + have := m.inj (hsub hr) ⟨by linarith [Real.pi_pos], le_rfl⟩ e + linarith [hr.2] + · have := m.inj (hsub hr) ⟨h0, by linarith [ht.2]⟩ e + linarith [hr.1, ht.2] + · refine ⟨m.onBd t ⟨by linarith [ht.1], ht.2⟩, ?_⟩ + rintro ⟨r, hr, e⟩ + have := m.inj (hsub hr) ⟨by linarith [ht.1], ht.2⟩ e + linarith [hr.2, ht.1] + rw [heq] + exact (m.rest.union (isCompact_Icc.image m.cont).isClosed).union (isCompact_Icc.image + m.cont).isClosed + +theorem CuffMark.isClosed_rest {f : ℝ → S} {ε : ℝ} {y : S} [T2Space S] + (m : CuffMark f ε y) : IsClosed (bd S \ f '' Ioo (-ε) ε) := + m.isClosed_rest' (by linarith [m.lt, Real.pi_gt_three]) (by linarith [m.lt, Real.pi_gt_three]) + (by linarith [m.pos]) + +/-- A forest has no loops. -/ +theorem forest_edge_line {H : Drawing S} (hf : IsGraphForest H.toGraph) {e : Set S} (he : e ∈ H.E) : + ∃ u v, u ≠ v ∧ u ∈ H.V ∧ v ∈ H.V ∧ closure e ∩ H.V = {u, v} ∧ IsLineWithEnds (closure e) u v + := by + rcases H.edge_cond e he with ⟨u, v, huv, hcap, hl⟩ | ⟨u, hcap, -⟩ + · have hu : u ∈ closure e ∩ H.V := by rw [hcap]; exact .inl rfl + have hv : v ∈ closure e ∩ H.V := by rw [hcap]; exact .inr rfl + exact ⟨u, v, huv, hu.2, hv.2, hcap, hl⟩ + · exfalso + have hu : u ∈ H.V := (hcap ▸ rfl : u ∈ closure e ∩ H.V).2 + have hl : H.toGraph.IsLink e u u := ⟨he, hu, hu, by simpa using hcap⟩ + have := hf u (.cons hl (.nil hu)) ⟨by simp [GraphWalk.support], by simp [GraphWalk.edges]⟩ + simp [GraphWalk.length, GraphWalk.edges] at this + +/-- A walk along edges in `E` gives a walk of the drawing. -/ +theorem exists_walk_of_reach {H : Drawing S} {a b : H.E → H.V} (hl : ∀ i, H.toGraph.IsLink i.1 + (a i).1 (b i).1) {E : Set H.E} + {x y : H.V} (h : Reach a b E x y) : ∃ W : GraphWalk H.toGraph x.1 y.1, ∀ e ∈ W.edges, ∃ k ∈ E, + k.1 = e := by + induction h using Relation.ReflTransGen.head_induction_on with + | refl => exact ⟨.nil y.2, by simp [GraphWalk.edges]⟩ + | @head x z hs _ ih => + obtain ⟨W, hW⟩ := ih + obtain ⟨k, hk, h1⟩ := hs + have hlink : H.toGraph.IsLink k.1 x.1 z.1 := by + rcases h1 with ⟨e1, e2⟩ | ⟨e1, e2⟩ + · rw [← e1, ← e2] + exact hl k + · rw [← e1, ← e2] + exact (hl k).symm + refine ⟨.cons hlink W, fun e he => ?_⟩ + simp only [GraphWalk.edges, List.mem_cons] at he + rcases he with rfl | he + · exact ⟨k, hk, rfl⟩ + · exact hW e he + +/-- In a forest, the ends of an edge are not joined by the other edges. -/ +theorem forest_no_reach {H : Drawing S} (hf : IsGraphForest H.toGraph) {a b : H.E → H.V} + (hl : ∀ i, H.toGraph.IsLink i.1 (a i).1 (b i).1) (hne : ∀ i, (a i).1 ≠ (b i).1) (E : Set H.E) + (i : H.E) (hi : i ∉ E) : + ¬ Reach a b E (a i) (b i) := by + classical + intro hr + obtain ⟨W, hW⟩ := exists_walk_of_reach hl hr + obtain ⟨W', hs, -, hed⟩ := GraphWalk.exists_isSimple W + let W₂ : GraphWalk H.toGraph (b i).1 (a i).1 := .cons (hl i).symm (.nil (a i).2) + have hs₂ : W₂.IsSimple := by + simp [W₂, GraphWalk.IsSimple, GraphWalk.support, (hne i).symm] + have hc := GraphWalk.isSimpleClosed_append hs hs₂ (fun x _ hx => by + simp only [W₂, GraphWalk.support, List.mem_cons, List.not_mem_nil, or_false] at hx + exact hx.symm) (fun e he hmem => by + simp only [W₂, GraphWalk.edges, List.mem_cons, List.not_mem_nil, or_false] at hmem + obtain ⟨k, hk, e1⟩ := hW e (hed e he) + exact hi ((Subtype.ext (e1.trans hmem) : k = i) ▸ hk)) + have := hf _ _ hc + rw [GraphWalk.length_append] at this + simp [W₂, GraphWalk.length, GraphWalk.edges] at this + +private theorem exists_thick_vertex_discs + {S : Type} + [TopologicalSpace S] + (hS : IsSurface S) + {H : Drawing S} + {f : S → ℝ → S} + {ε : S → ℝ} + (hm : ∀ y ∈ H.V ∩ bd S, CuffMark (f y) (ε y) y) + (T : Type) + [TopologicalSpace T] + (j : S → T) + (K : Set T) + (hT : IsClosedSurface T) + (hj : IsClosedEmbedding j) + (hK : IsClosed K) + (hu : range j ∪ K = univ) + (hi : range j ∩ K = j '' bd S) + (Γ : GM19.Drawing T) + (hHV : ∀ v ∈ H.V, j v ∈ Γ.V) + (hoffK : ∀ z ∉ K, z ∈ range j) + (hCnice : ∀ y ∈ H.V ∩ bd S, IsGammaNice Γ (j '' f y '' Icc (-Real.pi) Real.pi)) + (W : S → Set T) + (hWo : ∀ v ∈ H.V, IsOpen (W v)) + (hWm : ∀ v ∈ H.V, j v ∈ W v) + (hWboundary : ∀ v ∈ bd S, Disjoint (W v) (j '' (bd S \ f v '' Ioo (-ε v) (ε v)))) + (hWinterior : ∀ v ∉ bd S, Disjoint (W v) K) : + ∀ v : H.V, ∃ R P s₁ s₂, IsStarDisc Γ (j v.1) R ∧ R ⊆ W v.1 ∧ IsClosedDisc P ∧ P ⊆ R ∧ + P ⊆ range j ∧ (∀ z ∈ R, z ∈ range j → z ∈ P) ∧ + (∀ z ∈ discBd R, z ∈ range j → z ∉ K → z ∈ discBd P) ∧ + (∀ z ∈ discInt R, z ∈ range j → z ∉ K → z ∈ discInt P) ∧ + (v.1 ∈ bd S → 0 < s₁ ∧ s₁ < ε v.1 ∧ 0 < s₂ ∧ s₂ < ε v.1 ∧ + P ∩ K = j '' f v.1 '' Icc (-s₂) s₁ ∧ + j '' f v.1 '' Icc (-s₂) s₁ ⊆ discBd P ∧ j '' f v.1 '' Ioo (-s₂) s₁ ⊆ discInt R) ∧ + (v.1 ∉ bd S → P ∩ K = ∅) := by + classical + rintro ⟨v, hv⟩ + by_cases hb : v ∈ bd S + · have hoff := hWboundary v hb + obtain ⟨R, P, s₁, s₂, h1, h2, h3, h4, h5, h6, h7, h8, a1, a2, a3, a4, a5, a6, a7⟩ := + exists_vertex_bd hS hT hj hK hu hi (hm v ⟨hv, hb⟩) (hHV v hv) (hWo v hv) (hWm v hv) hoff + (hCnice v ⟨hv, hb⟩) + exact ⟨R, P, s₁, s₂, h1, h2, h3, h4, h5, h6, h7, h8, fun _ => ⟨a1, a2, a3, a4, a5, a6, a7⟩, + fun h => (h hb).elim⟩ + · obtain ⟨R, hR, hRW⟩ := exists_starDisc hT Γ (hHV v hv) (hWo v hv) (hWm v hv) + have hRK : ∀ z ∈ R, z ∉ K := fun z hz => disjoint_left.mp (hWinterior v hb) (hRW hz) + exact ⟨R, R, 0, 0, hR, hRW, hR.disc, subset_rfl, fun z hz => hoffK z (hRK z hz), + fun z hz _ => hz, fun z hz _ _ => hz, + fun z hz _ _ => hz, fun h => (hb h).elim, fun _ => by + ext z + simp only [mem_inter_iff, mem_empty_iff_false, iff_false, not_and] + exact fun hz => hRK z hz⟩ + +private theorem edge_middle_meets_vertex_discs_only_at_ends + {S : Type} + [TopologicalSpace S] + {H : Drawing S} + (T : Type) + (j : S → T) + (W : S → Set T) + (hWe : ∀ v ∈ H.V, ∀ e ∈ H.E, v ∉ closure e → Disjoint (W v) (j '' closure e)) + (R : ↑H.V → Set T) + (P : ↑H.V → Set T) + (hRW : ∀ (v : ↑H.V), R v ⊆ W ↑v) + (hPR : ∀ (v : ↑H.V), P v ⊆ R v) + (a : ↑H.E → ↑H.V) + (b : ↑H.E → ↑H.V) + (hcap : ∀ i : H.E, closure i.1 ∩ H.V = {(a i).1, (b i).1}) + (p : ↑H.E → T) + (q : ↑H.E → T) + (M : ↑H.E → Set T) + (hMa : ∀ (i : ↑H.E), M i ∩ R (a i) = {p i}) + (hMb : ∀ (i : ↑H.E), M i ∩ R (b i) = {q i}) + (hML : ∀ (i : ↑H.E), M i ⊆ j '' closure ↑i) : + ∀ (i : ↑H.E) (v : ↑H.V), M i ∩ P v ⊆ {p i, q i} := by + intro i v z hz + by_cases h1 : v = a i + · have : z ∈ M i ∩ R (a i) := ⟨hz.1, hPR _ (h1 ▸ hz.2)⟩ + rw [hMa i] at this + exact .inl this + by_cases h2 : v = b i + · have : z ∈ M i ∩ R (b i) := ⟨hz.1, hPR _ (h2 ▸ hz.2)⟩ + rw [hMb i] at this + exact .inr this + · have hv : v.1 ∉ closure i.1 := fun h => by + have : v.1 ∈ closure i.1 ∩ H.V := ⟨h, v.2⟩ + rw [hcap i] at this + rcases this with e | e + · exact h1 (Subtype.ext e) + · exact h2 (Subtype.ext e) + exact (disjoint_left.mp (hWe v.1 v.2 i.1 i.2 hv) (hRW v (hPR v hz.2)) (hML i hz.1)).elim + +private theorem forest_edge_closure_is_nice_in_capped_drawing + {S : Type} + [TopologicalSpace S] + {H : Drawing S} + [T2Space S] + (T : Type) + [TopologicalSpace T] + (j : S → T) + (hj : IsClosedEmbedding j) + (G₀ : Drawing S) + (hG₀U : G₀.U = H.U ∪ bd S) + (Γ : GM19.Drawing T) + (hΓU : Γ.U = j '' G₀.U) + (hbc : IsClosed (bd S)) + (hHV : ∀ v ∈ H.V, j v ∈ Γ.V) + (hprop' : ∀ x ∈ H.U, x ∈ bd S → x ∈ H.V) + (hcle : ∀ e ∈ H.E, closure e ⊆ e ∪ H.V) + (hclU : ∀ e ∈ H.E, closure e ⊆ H.U) + (hclc : ∀ e ∈ H.E, IsClosed (j '' closure e)) + (e : Set S) + (he : e ∈ H.E) : + IsGammaNice Γ (j '' closure e) := by + let Y₀ : Set S := H.V ∪ bd S ∪ ⋃ g ∈ H.E \ {e}, closure g + have hY₀ : IsClosed Y₀ := (H.finite_V.isClosed.union hbc).union + ((H.finite_edges.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure) + refine nice_of_cover (hclc e he) (hj.isClosedMap _ hY₀) ?_ ?_ ?_ + · rw [hΓU, hG₀U] + rintro _ ⟨x, hx | hx, rfl⟩ + · by_cases hxV : x ∈ H.V + · exact .inr ⟨x, .inl (.inl hxV), rfl⟩ + · obtain ⟨g, hg, hxg⟩ := H.exists_edge_of_mem hx hxV + by_cases hge : g = e + · exact .inl ⟨x, subset_closure (hge ▸ hxg), rfl⟩ + · exact .inr ⟨x, .inr (mem_iUnion₂.mpr ⟨g, ⟨hg, hge⟩, subset_closure hxg⟩), rfl⟩ + · exact .inr ⟨x, .inl (.inr hx), rfl⟩ + · rw [hΓU, hG₀U] + exact image_mono ((hclU e he).trans subset_union_left) + · rintro _ ⟨⟨x, hx, rfl⟩, ⟨x', hx', e'⟩⟩ + have hxx : x' = x := hj.injective e' + subst hxx + rcases hx' with (h1 | h1) | h1 + · exact hHV _ h1 + · exact hHV _ (hprop' _ (hclU e he hx) h1) + · obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h1 + rcases hcle e he hx with h2 | h2 + · rcases hcle g hg.1 hxg with h3 | h3 + · exact (hg.2 (H.edge_eq_of_mem hg.1 he h3 h2)).elim + · exact hHV _ h3 + · exact hHV _ h2 + +private theorem cuff_image_is_nice_in_capped_drawing + {S : Type} + [TopologicalSpace S] + {H : Drawing S} + {f : S → ℝ → S} + {ε : S → ℝ} + (hm : ∀ y ∈ H.V ∩ bd S, CuffMark (f y) (ε y) y) + (T : Type) + [TopologicalSpace T] + (j : S → T) + (hj : IsClosedEmbedding j) + [T2Space T] + (G₀ : Drawing S) + (hG₀U : G₀.U = H.U ∪ bd S) + (Γ : GM19.Drawing T) + (hΓU : Γ.U = j '' G₀.U) + (hHV : ∀ v ∈ H.V, j v ∈ Γ.V) + (hprop' : ∀ x ∈ H.U, x ∈ bd S → x ∈ H.V) : + ∀ y ∈ H.V ∩ bd S, IsGammaNice Γ (j '' f y '' Icc (-Real.pi) Real.pi) := by + intro y hy + have m := hm y hy + have hCc : IsClosed (j '' (f y '' Icc (-Real.pi) Real.pi)) := ((isCompact_Icc.image + m.cont).image hj.continuous).isClosed + have hCb : f y '' Icc (-Real.pi) Real.pi ⊆ bd S := by + rintro _ ⟨t, ht, rfl⟩ + exact m.onBd t ht + refine nice_of_cover hCc (hj.isClosedMap _ (H.isClosed_U.union m.rest)) ?_ ?_ ?_ + · rw [hΓU, hG₀U] + rintro _ ⟨x, hx | hx, rfl⟩ + · exact .inr ⟨x, .inl hx, rfl⟩ + · by_cases h1 : x ∈ f y '' Icc (-Real.pi) Real.pi + · exact .inl ⟨x, h1, rfl⟩ + · exact .inr ⟨x, .inr ⟨hx, h1⟩, rfl⟩ + · rw [hΓU, hG₀U] + exact image_mono (hCb.trans subset_union_right) + · rintro _ ⟨⟨x, hx, rfl⟩, ⟨x', hx', e'⟩⟩ + have hxx : x' = x := hj.injective e' + subst hxx + rcases hx' with h1 | h1 + · exact hHV _ (hprop' _ h1 (hCb hx)) + · exact (h1.2 hx).elim + +private theorem thick_forest_disc_contains_incident_edge + {S : Type} + [TopologicalSpace S] + {H : Drawing S} + (T : Type) + [TopologicalSpace T] + (j : S → T) + (R : ↑H.V → Set T) + (P : ↑H.V → Set T) + (hRP : ∀ (v : ↑H.V), ∀ z ∈ R v, z ∈ range j → z ∈ P v) + (a : ↑H.E → ↑H.V) + (b : ↑H.E → ↑H.V) + (hcap : ∀ i : H.E, closure i.1 ∩ H.V = {(a i).1, (b i).1}) + (M : ↑H.E → Set T) + (ρa : ↑H.E → Set T) + (ρb : ↑H.E → Set T) + (hLeq : ∀ (i : ↑H.E), j '' closure ↑i = ρa i ∪ M i ∪ ρb i) + (hρa : ∀ (i : ↑H.E), ρa i = j '' closure ↑i ∩ R (a i)) + (hρb : ∀ (i : ↑H.E), ρb i = j '' closure ↑i ∩ R (b i)) + (C : ↑H.V → Set T) + (hC4 : ∀ (i : ↑H.E), M i ⊆ discInt (C (a i)) ∧ C (a i) = C (b i)) + (hC5 : ∀ (v : ↑H.V), P v ⊆ C v ∧ discInt (P v) ⊆ discInt (C v)) : + ∀ (i : H.E) (u : H.V), u.1 ∈ closure i.1 → j '' closure i.1 ⊆ C u := by + intro i u hu z hz + have hzr : z ∈ range j := ⟨_, hz.choose_spec.2⟩ + have hab2 := (hC4 i).2 + have h2 : M i ⊆ C (a i) := fun w hw => ((hC4 i).1 hw).1 + have hbig : z ∈ C (a i) := by + rw [hLeq i] at hz + rcases hz with (h | h) | h + · rw [hρa i] at h + exact (hC5 _).1 (hRP _ _ h.2 hzr) + · exact h2 h + · rw [hρb i] at h + rw [hab2] + exact (hC5 _).1 (hRP _ _ h.2 hzr) + have : u.1 ∈ closure i.1 ∩ H.V := ⟨hu, u.2⟩ + rw [hcap i] at this + rcases this with e | e + · rwa [show u = a i from Subtype.ext e] + · rwa [show u = b i from Subtype.ext e, ← hab2] + +private theorem thick_forest_contains_interior_points_in_open_discs + {S : Type} + [TopologicalSpace S] + {H : Drawing S} + (T : Type) + [TopologicalSpace T] + (j : S → T) + (K : Set T) + (Γ : GM19.Drawing T) + (hKb : ∀ (x : S), j x ∈ K → x ∈ bd S) + (R : ↑H.V → Set T) + (P : ↑H.V → Set T) + (hR : ∀ (v : ↑H.V), IsStarDisc Γ (j ↑v) (R v)) + (hPint : ∀ (v : ↑H.V), ∀ z ∈ discInt (R v), z ∈ range j → z ∉ K → z ∈ discInt (P v)) + (a : ↑H.E → ↑H.V) + (b : ↑H.E → ↑H.V) + (p : ↑H.E → T) + (q : ↑H.E → T) + (M : ↑H.E → Set T) + (ρa : ↑H.E → Set T) + (ρb : ↑H.E → Set T) + (hLeq : ∀ (i : ↑H.E), j '' closure ↑i = ρa i ∪ M i ∪ ρb i) + (hρai : ∀ (i : ↑H.E), ρa i \ {p i} ⊆ discInt (R (a i))) + (hρbi : ∀ (i : ↑H.E), ρb i \ {q i} ⊆ discInt (R (b i))) + (hpM : ∀ (i : ↑H.E), p i ∈ M i) + (hqM : ∀ (i : ↑H.E), q i ∈ M i) + (C : ↑H.V → Set T) + (hC4 : ∀ (i : ↑H.E), M i ⊆ discInt (C (a i)) ∧ C (a i) = C (b i)) + (hC5 : ∀ (v : ↑H.V), P v ⊆ C v ∧ discInt (P v) ⊆ discInt (C v)) : + ∀ z ∈ H.U, z ∉ bd S → ∃ w, j z ∈ discInt (C w) := by + intro z hz hzb + have hzK : j z ∉ K := fun h => hzb (hKb z h) + have hmemP : ∀ w, j z ∈ discInt (R w) → j z ∈ discInt (C w) := fun w h => (hC5 w).2 + (hPint w _ h ⟨z, rfl⟩ hzK) + by_cases hzV : z ∈ H.V + · exact ⟨⟨z, hzV⟩, hmemP _ (hR ⟨z, hzV⟩).mem⟩ + · obtain ⟨e, he, hze⟩ := H.exists_edge_of_mem hz hzV + let i : H.E := ⟨e, he⟩ + have h1 : j z ∈ j '' closure i.1 := ⟨z, subset_closure hze, rfl⟩ + rw [hLeq i] at h1 + rcases h1 with (h | h) | h + · by_cases hp : j z = p i + · exact ⟨a i, (hC4 i).1 (hp ▸ hpM i)⟩ + · exact ⟨a i, hmemP _ (hρai i ⟨h, hp⟩)⟩ + · exact ⟨a i, (hC4 i).1 h⟩ + · by_cases hq : j z = q i + · exact ⟨a i, (hC4 i).1 (hq ▸ hqM i)⟩ + · exact ⟨b i, hmemP _ (hρbi i ⟨h, hq⟩)⟩ + +private theorem forest_thickening_pulls_back_from_capped_surface + {S : Type} + [TopologicalSpace S] + {H : Drawing S} + {f : S → ℝ → S} + {ε : S → ℝ} + (hm : ∀ y ∈ H.V ∩ bd S, CuffMark (f y) (ε y) y) + (T : Type) + [TopologicalSpace T] + (j : S → T) + (K : Set T) + (hj : IsClosedEmbedding j) + (hman : ∀ (x : T), IsManifoldPoint x) + (Γ : GM19.Drawing T) + (hbK : ∀ x ∈ bd S, j x ∈ K) + (hKb : ∀ (x : S), j x ∈ K → x ∈ bd S) + (hprop' : ∀ x ∈ H.U, x ∈ bd S → x ∈ H.V) + (R : ↑H.V → Set T) + (P : ↑H.V → Set T) + (s₁ : ↑H.V → ℝ) + (s₂ : ↑H.V → ℝ) + (hR : ∀ (v : ↑H.V), IsStarDisc Γ (j ↑v) (R v)) + (hRP : ∀ (v : ↑H.V), ∀ z ∈ R v, z ∈ range j → z ∈ P v) + (hPint : ∀ (v : ↑H.V), ∀ z ∈ discInt (R v), z ∈ range j → z ∉ K → z ∈ discInt (P v)) + (hPb : ∀ (v : ↑H.V), ↑v ∈ bd S → 0 < s₁ v ∧ s₁ v < ε ↑v ∧ 0 < s₂ v ∧ s₂ v < ε ↑v ∧ P v ∩ K = j + '' f ↑v '' Icc (-s₂ v) (s₁ v) ∧ j '' f ↑v '' Icc (-s₂ v) (s₁ v) ⊆ discBd (P v) ∧ j '' f ↑v + '' Ioo (-s₂ v) (s₁ v) ⊆ discInt (R v)) + (hPi : ∀ (v : ↑H.V), ↑v ∉ bd S → P v ∩ K = ∅) + (a : ↑H.E → ↑H.V) + (b : ↑H.E → ↑H.V) + (hlink : ∀ (i : ↑H.E), H.toGraph.IsLink ↑i ↑(a i) ↑(b i)) + (C : ↑H.V → Set T) + (hC1 : ∀ (v : ↑H.V), IsClosedDisc (C v)) + (hC2 : ∀ (u v : ↑H.V), C u = C v → Reach a b univ u v) + (hC3 : ∀ (u v : ↑H.V), C u ≠ C v → Disjoint (C u) (C v)) + (hC5 : ∀ (v : ↑H.V), P v ⊆ C v ∧ discInt (P v) ⊆ discInt (C v)) + (hC6 : ∀ (v : ↑H.V), C v ∩ K ⊆ ⋃ w, P w) + (hC7 : ∀ (v : ↑H.V), discBd (P v) ∩ K ⊆ discBd (C v)) + (hCr : ∀ (v : ↑H.V), C v ⊆ range j) + (hpre : ∀ (v : ↑H.V), IsClosedDisc (j ⁻¹' C v) ∧ discBd (j ⁻¹' C v) = j ⁻¹' discBd (C v)) + (hmeet : ∀ {u v : ↑H.V} {z : T}, z ∈ C u → z ∈ C v → C u = C v) + (hline : ∀ (i : H.E) (u : H.V), u.1 ∈ closure i.1 → j '' closure i.1 ⊆ C u) + (hint : ∀ z ∈ H.U, z ∉ bd S → ∃ w, j z ∈ discInt (C w)) : + ∃ (c : S → Set S) (σ₁ σ₂ : S → ℝ), (∀ v ∈ H.V, IsClosedDisc (c v)) ∧ + (∀ u ∈ H.V, ∀ v ∈ H.V, c u = c v → Nonempty (GraphWalk H.toGraph u v)) ∧ + (∀ u ∈ H.V, ∀ v ∈ H.V, c u ≠ c v → Disjoint (c u) (c v)) ∧ + (∀ e ∈ H.E, ∀ u ∈ H.V, u ∈ closure e → closure e ⊆ c u) ∧ (∀ v ∈ H.V, v ∈ c v) ∧ + (∀ v ∈ H.V, ∀ z ∈ H.U, z ∈ discBd (c v) → z ∈ H.V ∩ bd S) ∧ (∀ v ∈ H.V, IsOpen (discInt + (c v))) ∧ + (∀ y ∈ H.V ∩ bd S, 0 < σ₁ y ∧ σ₁ y < ε y ∧ 0 < σ₂ y ∧ σ₂ y < ε y ∧ f y '' Icc (-σ₂ y) + (σ₁ y) ⊆ discBd (c y) ∧ + ∃ O, IsOpen O ∧ f y '' Ioo (-σ₂ y) (σ₁ y) ⊆ O ∧ O ⊆ c y ∧ O \ bd S ⊆ discInt (c y)) ∧ + ∀ v ∈ H.V, c v ∩ bd S ⊆ ⋃ y ∈ H.V ∩ bd S, f y '' Icc (-σ₂ y) (σ₁ y) := by + classical + let c : S → Set S := fun v => if h : v ∈ H.V then j ⁻¹' C ⟨v, h⟩ else ∅ + have hc : ∀ v : H.V, c v.1 = j ⁻¹' C v := fun v => by simp [c, v.2] + let σ₁ : S → ℝ := fun v => if h : v ∈ H.V then s₁ ⟨v, h⟩ else 0 + let σ₂ : S → ℝ := fun v => if h : v ∈ H.V then s₂ ⟨v, h⟩ else 0 + have hs1 : ∀ v : H.V, σ₁ v.1 = s₁ v := fun v => by simp [σ₁, v.2] + have hs2 : ∀ v : H.V, σ₂ v.1 = s₂ v := fun v => by simp [σ₂, v.2] + have himg : ∀ {A B : Set T}, A ⊆ range j → B ⊆ range j → j ⁻¹' A = j ⁻¹' B → A = B + := fun {A B} hA hB h => by + rw [← image_preimage_eq_of_subset hA, ← image_preimage_eq_of_subset hB, h] + refine ⟨c, σ₁, σ₂, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro v hv + rw [hc ⟨v, hv⟩] + exact (hpre _).1 + · intro u hu v hv h + rw [hc ⟨u, hu⟩, hc ⟨v, hv⟩] at h + obtain ⟨W, -⟩ := exists_walk_of_reach hlink (hC2 ⟨u, hu⟩ ⟨v, hv⟩ (himg (hCr _) (hCr _) h)) + exact ⟨W⟩ + · intro u hu v hv h + rw [hc ⟨u, hu⟩, hc ⟨v, hv⟩] at h ⊢ + exact (hC3 ⟨u, hu⟩ ⟨v, hv⟩ fun e => h (by rw [e])).preimage j + · intro e he u hu hue x hx + rw [hc ⟨u, hu⟩] + exact hline ⟨e, he⟩ ⟨u, hu⟩ hue ⟨x, hx, rfl⟩ + · intro v hv + rw [hc ⟨v, hv⟩] + exact (hC5 _).1 (hRP ⟨v, hv⟩ _ (hR ⟨v, hv⟩).mem.1 ⟨v, rfl⟩) + · intro v hv z hz h + by_cases hzb : z ∈ bd S + · exact ⟨hprop' z hz hzb, hzb⟩ + · exfalso + rw [hc ⟨v, hv⟩, (hpre _).2] at h + obtain ⟨w, hw⟩ := hint z hz hzb + have h1 : C w = C ⟨v, hv⟩ := hmeet hw.1 (GM11.discBd_subset _ h) + exact (h1 ▸ hw).2 h + · intro v hv + have h1 : discInt (c v) = j ⁻¹' discInt (C ⟨v, hv⟩) := by + unfold discInt + rw [hc ⟨v, hv⟩, (hpre _).2] + rfl + rw [h1] + exact ((hC1 _).isOpen_discInt hman).preimage hj.continuous + · intro y hy + obtain ⟨a1, a2, a3, a4, a5, a6, a7⟩ := hPb ⟨y, hy.1⟩ hy.2 + rw [hs1 ⟨y, hy.1⟩, hs2 ⟨y, hy.1⟩] + refine ⟨a1, a2, a3, a4, ?_, j ⁻¹' discInt (R ⟨y, hy.1⟩), ((hR _).disc.isOpen_discInt + hman).preimage hj.continuous, ?_, ?_, ?_⟩ + · rintro x hx + rw [hc ⟨y, hy.1⟩, (hpre _).2] + have hxb : x ∈ bd S := by + obtain ⟨t, ht, rfl⟩ := hx + have h3 := hm y hy + exact h3.onBd t ⟨by linarith [ht.1, h3.lt, Real.pi_gt_three], by linarith [ht.2, h3.lt, + Real.pi_gt_three]⟩ + exact hC7 _ ⟨a6 ⟨x, hx, rfl⟩, hbK x hxb⟩ + · exact fun x hx => a7 ⟨x, hx, rfl⟩ + · intro x hx + rw [hc ⟨y, hy.1⟩] + exact (hC5 _).1 (hRP _ _ hx.1 ⟨x, rfl⟩) + · rintro x ⟨hx, hxb⟩ + have h1 : j x ∈ discInt (C ⟨y, hy.1⟩) := (hC5 _).2 (hPint _ _ hx ⟨x, rfl⟩ fun h => hxb + (hKb x h)) + refine ⟨?_, fun h => ?_⟩ + · rw [hc ⟨y, hy.1⟩] + exact h1.1 + · rw [hc ⟨y, hy.1⟩, (hpre _).2] at h + exact h1.2 h + · intro v hv x hx + rw [hc ⟨v, hv⟩] at hx + obtain ⟨w, hw⟩ := mem_iUnion.mp (hC6 _ ⟨hx.1, hbK x hx.2⟩) + by_cases hwb : w.1 ∈ bd S + · obtain ⟨a1, a2, a3, a4, a5, a6, a7⟩ := hPb w hwb + have h1 : j x ∈ P w ∩ K := ⟨hw, hbK x hx.2⟩ + rw [a5] at h1 + obtain ⟨x', hx', e⟩ := h1 + refine mem_iUnion₂.mpr ⟨w.1, ⟨w.2, hwb⟩, ?_⟩ + rw [hs1 w, hs2 w, ← hj.injective e] + exact hx' + · have h1 : j x ∈ P w ∩ K := ⟨hw, hbK x hx.2⟩ + rw [hPi w hwb] at h1 + exact h1.elim + +/-- **Thickening a forest.** Each vertex `v` of a forest `H` gets a closed disc `c v`. Two vertices +have the same disc if they are +in one component of `H`, and otherwise their discs are disjoint. The disc holds the component, which +meets its boundary only in +points of `bd(Σ)`. Each `y ∈ V(H) ∩ bd(Σ)` has a small piece of its cuff on the boundary of the +disc, and the disc is a neighbourhood of the +inside of this piece. There are no other points of `bd(Σ)` in the disc. -/ +theorem exists_forest_thick (hS : IsSurface S) {H : Drawing S} (hH : IsSurfaceForest H) {f : S → ℝ + → S} {ε : S → ℝ} + (hm : ∀ y ∈ H.V ∩ bd S, CuffMark (f y) (ε y) y) : + ∃ (c : S → Set S) (σ₁ σ₂ : S → ℝ), (∀ v ∈ H.V, IsClosedDisc (c v)) ∧ + (∀ u ∈ H.V, ∀ v ∈ H.V, c u = c v → Nonempty (GraphWalk H.toGraph u v)) ∧ + (∀ u ∈ H.V, ∀ v ∈ H.V, c u ≠ c v → Disjoint (c u) (c v)) ∧ + (∀ e ∈ H.E, ∀ u ∈ H.V, u ∈ closure e → closure e ⊆ c u) ∧ (∀ v ∈ H.V, v ∈ c v) ∧ + (∀ v ∈ H.V, ∀ z ∈ H.U, z ∈ discBd (c v) → z ∈ H.V ∩ bd S) ∧ (∀ v ∈ H.V, IsOpen (discInt + (c v))) ∧ + (∀ y ∈ H.V ∩ bd S, 0 < σ₁ y ∧ σ₁ y < ε y ∧ 0 < σ₂ y ∧ σ₂ y < ε y ∧ f y '' Icc (-σ₂ y) + (σ₁ y) ⊆ discBd (c y) ∧ + ∃ O, IsOpen O ∧ f y '' Ioo (-σ₂ y) (σ₁ y) ⊆ O ∧ O ⊆ c y ∧ O \ bd S ⊆ discInt (c y)) ∧ + ∀ v ∈ H.V, c v ∩ bd S ⊆ ⋃ y ∈ H.V ∩ bd S, f y '' Icc (-σ₂ y) (σ₁ y) := by + classical + obtain ⟨hprop, hfor⟩ := hH + have ht2S : T2Space S := hS.2.1 + have hcS : CompactSpace S := hS.1 + obtain ⟨T, tT, j, K, hT, hj, hK, hu, hi, -⟩ := exists_capAll S hS + have ht2 : T2Space T := hT.2.1 + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + obtain ⟨G₀, hG₀U, hG₀V, hG₀V'⟩ := exists_drawing_union_bd hS H hprop + obtain ⟨Γ, hΓU, hΓV⟩ := GM19.exists_drawing_image G₀ hj + have hbc : IsClosed (bd S) := (cuff_statement.{0} S hS).1 + have hHV : ∀ v ∈ H.V, j v ∈ Γ.V := fun v hv => hΓV ▸ ⟨v, hG₀V hv, rfl⟩ + have hbK : ∀ x, x ∈ bd S → j x ∈ K := fun x hx => by + have : j x ∈ range j ∩ K := hi ▸ ⟨x, hx, rfl⟩ + exact this.2 + have hKb : ∀ x, j x ∈ K → x ∈ bd S := fun x hx => by + have : j x ∈ j '' bd S := hi ▸ ⟨⟨x, rfl⟩, hx⟩ + obtain ⟨x', hx', e⟩ := this + exact hj.injective e ▸ hx' + have hoffK : ∀ z, z ∉ K → z ∈ range j := fun z hz => by + have : z ∈ range j ∪ K := hu ▸ mem_univ z + exact this.resolve_right hz + have hprop' : ∀ x ∈ H.U, x ∈ bd S → x ∈ H.V := fun x h1 h2 => hprop ⟨h2, h1⟩ + -- Edges of the forest. + have hcle : ∀ e ∈ H.E, closure e ⊆ e ∪ H.V := fun e he x hx => by + obtain ⟨γ, hγc, h0, h1, -, himg⟩ := exists_edge_param H he + have hc : closure e ⊆ range γ := by + refine closure_minimal (fun y hy => ?_) (isCompact_range hγc).isClosed + rw [← himg] at hy + obtain ⟨t, -, rfl⟩ := hy + exact ⟨t, rfl⟩ + obtain ⟨t, rfl⟩ := hc hx + by_cases h3 : t ∈ Ioo (0 : I) 1 + · exact .inl (himg ▸ mem_image_of_mem _ h3) + · have : t = 0 ∨ t = 1 := by + by_contra hn + push Not at hn + exact h3 ⟨unitInterval.pos_iff_ne_zero.mpr hn.1, unitInterval.lt_one_iff_ne_one.mpr hn.2⟩ + rcases this with rfl | rfl + · exact .inr h0 + · exact .inr h1 + have hclU : ∀ e ∈ H.E, closure e ⊆ H.U := fun e he => H.closure_subset_U he + have hfinV : Finite H.V := H.finite_V.to_subtype + have hfinE : Finite H.E := Set.Finite.to_subtype H.finite_edges + have hclc : ∀ e ∈ H.E, IsClosed (j '' closure e) := fun e _ => hj.isClosedMap _ isClosed_closure + have hnice : ∀ e ∈ H.E, IsGammaNice Γ (j '' closure e) := fun e he => by + exact forest_edge_closure_is_nice_in_capped_drawing (S := S) (H := H) T j hj G₀ hG₀U Γ hΓU hbc + hHV hprop' hcle hclU hclc e he + have hCnice : ∀ y ∈ H.V ∩ bd S, IsGammaNice Γ (j '' (f y '' Icc (-Real.pi) Real.pi)) := by + exact cuff_image_is_nice_in_capped_drawing (S := S) (H := H) (f := f) (ε := ε) hm T j hj G₀ + hG₀U Γ hΓU hHV hprop' + -- Small neighbourhoods of the vertices. + obtain ⟨O, hO, hOd⟩ := (H.finite_V.image j).t2_separation + let BB : S → Set T := fun v => j '' (H.V \ {v}) ∪ (⋃ e ∈ {e ∈ H.E | v ∉ closure e}, j '' closure + e) ∪ + (if v ∈ bd S then j '' (bd S \ f v '' Ioo (-ε v) (ε v)) else K) + have hBc : ∀ v ∈ H.V, IsClosed (BB v) := fun v hv => by + refine (((H.finite_V.subset sdiff_subset).image j).isClosed.union ?_).union ?_ + · have hfinite : {e ∈ H.E | v ∉ closure e}.Finite := + H.finite_edges.subset fun _ he => he.1 + exact hfinite.isClosed_biUnion fun e he => hclc e he.1 + · by_cases h : v ∈ bd S + · simp only [h, ite_true] + exact hj.isClosedMap _ (hm v ⟨hv, h⟩).isClosed_rest + · simp only [h, ite_false] + exact hK + have hvB : ∀ v ∈ H.V, j v ∉ BB v := fun v hv => by + rintro ((⟨x, hx, e⟩ | h) | h) + · exact hx.2 (hj.injective e) + · obtain ⟨g, hg, x, hx, e⟩ := mem_iUnion₂.mp h + exact hg.2 (hj.injective e ▸ hx) + · by_cases hb : v ∈ bd S + · simp only [hb, ite_true] at h + obtain ⟨x, hx, e⟩ := h + have m := hm v ⟨hv, hb⟩ + have : x = v := hj.injective e + subst this + exact hx.2 ⟨0, ⟨by linarith [m.pos], m.pos⟩, m.zero⟩ + · simp only [hb, ite_false] at h + exact hb (hKb v h) + let W : S → Set T := fun v => O (j v) \ BB v + have hWo : ∀ v ∈ H.V, IsOpen (W v) := fun v hv => (hO _).2.sdiff (hBc v hv) + have hWm : ∀ v ∈ H.V, j v ∈ W v := fun v hv => ⟨(hO _).1, hvB v hv⟩ + have hWO : ∀ u ∈ H.V, ∀ v ∈ H.V, u ≠ v → Disjoint (W u) (W v) := fun u hu v hv huv => + Disjoint.mono sdiff_subset sdiff_subset + (hOd ⟨u, hu, rfl⟩ ⟨v, hv, rfl⟩ fun e => huv (hj.injective e)) + have hWe : ∀ v ∈ H.V, ∀ e ∈ H.E, v ∉ closure e → Disjoint (W v) (j '' closure e) + := fun v _ e he hve => + disjoint_left.mpr fun x hx hxe => hx.2 (.inl (.inr (mem_iUnion₂.mpr ⟨e, ⟨he, hve⟩, hxe⟩))) + have hvd : ∀ v : H.V, ∃ R P s₁ s₂, IsStarDisc Γ (j v.1) R ∧ R ⊆ W v.1 ∧ IsClosedDisc P ∧ P ⊆ R + ∧ P ⊆ range j ∧ + (∀ z ∈ R, z ∈ range j → z ∈ P) ∧ (∀ z ∈ discBd R, z ∈ range j → z ∉ K → z ∈ discBd P) ∧ + (∀ z ∈ discInt R, z ∈ range j → z ∉ K → z ∈ discInt P) ∧ + (v.1 ∈ bd S → 0 < s₁ ∧ s₁ < ε v.1 ∧ 0 < s₂ ∧ s₂ < ε v.1 ∧ P ∩ K = j '' (f v.1 '' Icc + (-s₂) s₁) ∧ + j '' (f v.1 '' Icc (-s₂) s₁) ⊆ discBd P ∧ j '' (f v.1 '' Ioo (-s₂) s₁) ⊆ discInt R) ∧ + (v.1 ∉ bd S → P ∩ K = ∅) := by + exact exists_thick_vertex_discs (S := S) hS (H := H) (f := f) (ε := ε) hm T j K hT hj hK hu hi + Γ hHV hoffK hCnice W hWo hWm + (fun v hb => disjoint_left.mpr fun z hz hz' => hz.2 (.inr (by + simp only [hb, ite_true] + exact hz'))) + (fun v hb => disjoint_left.mpr fun z hz hz' => hz.2 (.inr (by + simp only [hb, ite_false] + exact hz'))) + choose R P s₁ s₂ hR hRW hPd hPR hPr hRP hPbd hPint hPb hPi using hvd + have hRdis : ∀ u v : H.V, u ≠ v → Disjoint (R u) (R v) := fun u v huv => + Disjoint.mono (hRW u) (hRW v) (hWO _ u.2 _ v.2 fun e => huv (Subtype.ext e)) + -- The edges between the discs. + choose a' b' hne hau hbu hcap hl using fun i : H.E => forest_edge_line hfor i.2 + let a : H.E → H.V := fun i => ⟨a' i, hau i⟩ + let b : H.E → H.V := fun i => ⟨b' i, hbu i⟩ + have hab : ∀ i, a i ≠ b i := fun i e => hne i (congrArg Subtype.val e) + have hlink : ∀ i, H.toGraph.IsLink i.1 (a i).1 (b i).1 := fun i => ⟨i.2, hau i, hbu i, hcap i⟩ + have hlT : ∀ i : H.E, IsLineWithEnds (j '' closure i.1) (j (a i).1) (j (b i).1) := fun i => + (hl i).map_of_embedding hj.isEmbedding + choose p q M ρa ρb hlM hLeq hρa hρb hMa hMb hpb hqb hρai hρbi hum hvm using fun i : H.E => + exists_edge_piece hT (hR (a i)) (hR (b i)) (hRdis _ _ (hab i)) (hlT i) (hclc _ i.2) + (hnice _ i.2) + have hML : ∀ i, M i ⊆ j '' closure i.1 := fun i z hz => by + rw [hLeq i] + exact .inl (.inr hz) + have hMe : ∀ i, M i ⊆ j '' i.1 := fun i z hz => by + obtain ⟨x, hx, rfl⟩ := hML i hz + rcases hcle i.1 i.2 hx with h | h + · exact ⟨x, h, rfl⟩ + · have : x ∈ closure i.1 ∩ H.V := ⟨hx, h⟩ + rw [hcap i] at this + rcases this with e | e + · have ha : j (a i).1 ∈ M i := by + rw [show (a i).1 = a' i from rfl, ← e] + exact hz + exact (hum i ha).elim + · have hb : j (b i).1 ∈ M i := by + rw [show (b i).1 = b' i from rfl, ← e] + exact hz + exact (hvm i hb).elim + have hMK : ∀ i, ∀ z ∈ M i, z ∉ K := fun i z hz hzK => by + obtain ⟨x, hx, rfl⟩ := hMe i hz + have h1 := i.2.2.1 hx + exact h1.2 (hprop' x h1.1 (hKb x hzK)) + have hMr : ∀ i, ∀ z ∈ M i, z ∈ range j := fun i z hz => hoffK z (hMK i z hz) + have hpM : ∀ i, p i ∈ M i := fun i => (hlM i).left_mem + have hqM : ∀ i, q i ∈ M i := fun i => (hlM i).right_mem + have hEdgeDiscs : ∀ (i : H.E) (v : H.V), M i ∩ P v ⊆ {p i, q i} := by + exact edge_middle_meets_vertex_discs_only_at_ends (S := S) (H := H) T j W hWe R P hRW hPR + a b hcap p q M hMa hMb hML + obtain ⟨C, hC1, hC2, hC3, hC4, hC5, hC6, hC7, hC8⟩ := exists_forest_discs hT (c₀ := P) (L := M) + (p := p) (q := q) (a := a) (b := b) + (Z := K) hPd (fun u v huv => Disjoint.mono (hPR u) (hPR v) (hRdis u v huv)) hlM + (fun i => hPbd _ _ (hpb i) (hMr i _ (hpM i)) (hMK i _ (hpM i))) + (fun i => hPbd _ _ (hqb i) (hMr i _ (hqM i)) (hMK i _ (hqM i))) + hEdgeDiscs + (fun i k hik => disjoint_left.mpr fun z h1 h2 => by + obtain ⟨x, hx, rfl⟩ := hMe i h1 + obtain ⟨x', hx', e⟩ := hMe k h2 + have hxx : x' = x := hj.injective e + subst hxx + exact hik (Subtype.ext (H.edge_eq_of_mem i.2 k.2 hx hx'))) + hK (fun i => disjoint_left.mpr fun z hz h => hMK i z hz h) + (fun E i hi => forest_no_reach hfor hlink hne E i hi) + have hCr : ∀ v, C v ⊆ range j := fun v z hz => by + by_cases hzK : z ∈ K + · obtain ⟨w, hw⟩ := mem_iUnion.mp (hC6 v ⟨hz, hzK⟩) + exact hPr w hw + · exact hoffK z hzK + have hne' : ∀ v : H.V, Nonempty S := fun v => ⟨v.1⟩ + have hpre : ∀ v, IsClosedDisc (j ⁻¹' C v) ∧ discBd (j ⁻¹' C v) = j ⁻¹' discBd (C v) := fun v => + haveI := hne' v + isClosedDisc_preimage hj (hC1 v) (hCr v) + have hmeet : ∀ {u v z}, z ∈ C u → z ∈ C v → C u = C v := fun {u v z} h1 h2 => by + by_contra hn + exact disjoint_left.mp (hC3 u v hn) h1 h2 + have hline : ∀ i : H.E, ∀ u : H.V, u.1 ∈ closure i.1 → j '' closure i.1 ⊆ C u := by + exact thick_forest_disc_contains_incident_edge (S := S) (H := H) T j R P hRP a b hcap M + ρa ρb hLeq hρa hρb C hC4 hC5 + have hint : ∀ z ∈ H.U, z ∉ bd S → ∃ w, j z ∈ discInt (C w) := by + exact thick_forest_contains_interior_points_in_open_discs (S := S) (H := H) T j K Γ hKb R P hR + hPint a b p q M ρa ρb hLeq hρai hρbi hpM hqM C hC4 hC5 + have hPulledBackDiscs : + ∃ (c : S → Set S) (σ₁ σ₂ : S → ℝ), (∀ v ∈ H.V, IsClosedDisc (c v)) ∧ + (∀ u ∈ H.V, ∀ v ∈ H.V, c u = c v → Nonempty (GraphWalk H.toGraph u v)) ∧ + (∀ u ∈ H.V, ∀ v ∈ H.V, c u ≠ c v → Disjoint (c u) (c v)) ∧ + (∀ e ∈ H.E, ∀ u ∈ H.V, u ∈ closure e → closure e ⊆ c u) ∧ (∀ v ∈ H.V, v ∈ c v) ∧ + (∀ v ∈ H.V, ∀ z ∈ H.U, z ∈ discBd (c v) → z ∈ H.V ∩ bd S) ∧ (∀ v ∈ H.V, IsOpen (discInt + (c v))) ∧ + (∀ y ∈ H.V ∩ bd S, 0 < σ₁ y ∧ σ₁ y < ε y ∧ 0 < σ₂ y ∧ σ₂ y < ε y ∧ f y '' Icc (-σ₂ y) + (σ₁ y) ⊆ discBd (c y) ∧ + ∃ O, IsOpen O ∧ f y '' Ioo (-σ₂ y) (σ₁ y) ⊆ O ∧ O ⊆ c y ∧ O \ bd S ⊆ discInt (c y)) ∧ + ∀ v ∈ H.V, c v ∩ bd S ⊆ ⋃ y ∈ H.V ∩ bd S, f y '' Icc (-σ₂ y) (σ₁ y) := by + exact forest_thickening_pulls_back_from_capped_surface (S := S) (H := H) (f := f) (ε := ε) hm + T j K hj hman Γ hbK hKb hprop' R P s₁ s₂ hR hRP hPint hPb hPi a b hlink C hC1 hC2 hC3 hC5 + hC6 hC7 hCr hpre hmeet hline hint + exact hPulledBackDiscs + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/TreeChart.lean b/LeanPool/GraphMinor/GM07/TreeChart.lean new file mode 100644 index 0000000000..2345dfed44 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/TreeChart.lean @@ -0,0 +1,233 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.CutConnected +public import LeanPool.GraphMinor.GM07.BdChart + +/-! +# A chart around the part of a cut surface over a tree + +Let `T` be a component of the forest along which `Σ` is cut, with a point on `bd(Σ)`. By +`isPreconnected_preimage_tree`, `φ⁻¹(T)` is a connected part of one cuff of `Σ'`. It is not the +whole cuff, because `bd(Σ)` has points near `T` that are not on `T`. So `φ⁻¹(T)` is an arc, and it +has a half rectangle around it (`exists_tree_chart`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Complex GraphMinor.Surface GraphMinor.GM11 + +variable {S S' : Type} [TopologicalSpace S] [TopologicalSpace S'] + +/-- Near a point `z` of `bd(Σ)` there are points of `bd(Σ)` outside any finite set. -/ +theorem exists_bd_near (hS : IsSurface S) {z : S} (hz : z ∈ bd S) {W F : Set S} (hW : IsOpen W) + (hzW : z ∈ W) (hF : F.Finite) : ∃ y ∈ W ∩ bd S, y ∉ F := by + obtain ⟨f, hf, h0, hi, -, hb, -⟩ := exists_cuffMark hS hz + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp (hW.preimage hf) 0 + (by rw [mem_preimage, h0]; exact hzW) + have hpi := Real.pi_pos + let r := min ε Real.pi + have hr : 0 < r := lt_min hε hpi + have hsub : Ioo 0 r ⊆ Ioc (-Real.pi) Real.pi := fun t ht => + ⟨by linarith [ht.1], by linarith [ht.2, min_le_right ε Real.pi]⟩ + obtain ⟨y, ⟨t, ht, rfl⟩, hy⟩ := ((Ioo_infinite hr).image (hi.mono hsub)).exists_notMem_finite hF + refine ⟨f t, ⟨hball ?_, hb t (Ioc_subset_Icc_self (hsub ht))⟩, hy⟩ + rw [mem_ball, Real.dist_eq, sub_zero, abs_of_pos ht.1] + exact lt_of_lt_of_le ht.2 (min_le_left _ _) + +/-- A connected subset of `bd(Σ)` meeting a closed part `C` of `bd(Σ)` with closed complement lies +in `C`. -/ +theorem subset_of_clopen_bd {A C : Set S} (hA : IsPreconnected A) (hAb : A ⊆ bd S) + (hC : IsClosed C) (hrest : IsClosed (bd S \ C)) {a : S} (haA : a ∈ A) (haC : a ∈ C) : A ⊆ C := by + rcases isPreconnected_iff_subset_of_disjoint_closed.mp hA C (bd S \ C) hC hrest (fun x hx => by + by_cases h : x ∈ C + · exact .inl h + · exact .inr ⟨hAb hx, h⟩) (by + ext x + simp only [mem_inter_iff, mem_sdiff, mem_empty_iff_false, iff_false] + tauto) with h | h + · exact h + · exact absurd haC (h haA).2 + +/-- **A chart around `φ⁻¹(T)`.** -/ +theorem exists_tree_chart (hS : IsSurface S) {L : Drawing S} {φ : S' → S} + (hJ : IsCutAlongGraph L S' φ) (hNo : NoArcs L) {T : Set S} (hT : IsPreconnected T) + (hTc : IsClosed T) (hrest : IsClosed (L.U \ T)) (hTU : T ⊆ L.U) + {z : S} (hzT : z ∈ T) (hzb : z ∈ bd S) {N : Set S} (hN : IsOpen N) (hTN : T ⊆ N) : + ∃ (χ : ℂ → S') (x₁ x₂ δ : ℝ), IsBdChart χ x₁ x₂ δ ∧ (∀ w ∈ Icc x₁ x₂ ×ℂ Icc 0 δ, φ (χ w) ∈ N) + ∧ ∀ a ∈ φ ⁻¹' T, ∃ x ∈ Ioo x₁ x₂, χ (x : ℂ) = a := by + classical + have hY := hJ.isSurface + have : CompactSpace S' := hY.1 + have : T2Space S' := hY.2.1 + have : T2Space S := hS.2.1 + have hcont := hJ.quotientMap.continuous + have hpi := Real.pi_pos + set A : Set S' := φ ⁻¹' T with hAdef + have hAb : A ⊆ bd S' := fun x hx => by + rw [← hJ.preimage_bd_union_U] + exact .inr (hTU hx) + have hAc : IsClosed A := hTc.preimage hcont + have hAp : IsPreconnected A := isPreconnected_preimage_tree hS hJ hNo hT hTc hrest + obtain ⟨a₀, ha₀⟩ := hJ.quotientMap.surjective z + have ha₀A : a₀ ∈ A := by rw [hAdef, mem_preimage, ha₀]; exact hzT + obtain ⟨f₀, hf₀, h00, -, -, hb₀, hr₀⟩ := exists_cuffMark hY (hAb ha₀A) + have hIcc : (0 : ℝ) ∈ Icc (-Real.pi) Real.pi := ⟨by linarith, by linarith⟩ + have hC₀c : IsClosed (f₀ '' Icc (-Real.pi) Real.pi) := (isCompact_Icc.image hf₀).isClosed + have ha₀C : a₀ ∈ f₀ '' Icc (-Real.pi) Real.pi := ⟨0, hIcc, h00⟩ + have hAC₀ := subset_of_clopen_bd hAp hAb hC₀c hr₀ ha₀A ha₀C + -- The arc is not the whole cuff. + obtain ⟨y₀, hy₀C, hy₀A⟩ : ∃ y₀ ∈ f₀ '' Icc (-Real.pi) Real.pi, y₀ ∉ A := by + by_contra hn + push Not at hn + have hE : IsClosed (φ '' (bd S' \ f₀ '' Icc (-Real.pi) Real.pi)) := hcont.isClosedMap _ hr₀ + have hW : IsOpen (φ '' (bd S' \ f₀ '' Icc (-Real.pi) Real.pi))ᶜ := hE.isOpen_compl + have hzW : z ∈ (φ '' (bd S' \ f₀ '' Icc (-Real.pi) Real.pi))ᶜ := by + rintro ⟨x, hx, he⟩ + exact hx.2 (hAC₀ (by rw [hAdef, mem_preimage, he]; exact hzT)) + obtain ⟨y, ⟨hyW, hyb⟩, hyV⟩ := exists_bd_near hS hzb hW hzW L.finite_V + have hyU : y ∉ L.U := fun h => hyV (hJ.isProper ⟨hyb, h⟩) + obtain ⟨x, rfl⟩ := hJ.quotientMap.surjective y + have hxb : x ∈ bd S' := by + rw [← hJ.preimage_bd_union_U] + exact .inl hyb + have hxC : x ∈ f₀ '' Icc (-Real.pi) Real.pi := by + by_contra h + exact hyW ⟨x, ⟨hxb, h⟩, rfl⟩ + exact hyU (hTU (hn x hxC)) + have hy₀b : y₀ ∈ bd S' := by + obtain ⟨t, ht, rfl⟩ := hy₀C + exact hb₀ t ht + obtain ⟨f, hf, hfπ, hfi, hfs, hfb, hfr⟩ := exists_cuffSeam hY hy₀b + have hC₀b : f₀ '' Icc (-Real.pi) Real.pi ⊆ bd S' := by + rintro _ ⟨t, ht, rfl⟩ + exact hb₀ t ht + have hC₀p : IsPreconnected (f₀ '' Icc (-Real.pi) Real.pi) := isPreconnected_Icc.image f₀ + hf₀.continuousOn + have hCc : IsClosed (f '' Icc (-Real.pi) Real.pi) := (isCompact_Icc.image hf).isClosed + have hπ : Real.pi ∈ Icc (-Real.pi) Real.pi := ⟨by linarith, le_rfl⟩ + have hAC : A ⊆ f '' Icc (-Real.pi) Real.pi := hAC₀.trans (subset_of_clopen_bd hC₀p hC₀b hCc hfr + hy₀C (show y₀ ∈ f '' Icc (-Real.pi) Real.pi from ⟨Real.pi, hπ, hfπ⟩)) + -- The parameters of the arc. + let I : Set ℝ := Icc (-Real.pi) Real.pi ∩ f ⁻¹' A + have hIc : IsCompact I := isCompact_Icc.inter_right (hAc.preimage hf) + have hIo : I ⊆ Ioo (-Real.pi) Real.pi := fun t ht => by + refine ⟨lt_of_le_of_ne ht.1.1 fun h => ?_, lt_of_le_of_ne ht.1.2 fun h => ?_⟩ + · have h2 : f t = y₀ := by rw [← h, hfs, hfπ] + exact hy₀A (h2 ▸ ht.2) + · have h2 : f t = y₀ := by rw [h, hfπ] + exact hy₀A (h2 ▸ ht.2) + have hIin : InjOn f I := hfi.mono (show I ⊆ Ioc (-Real.pi) Real.pi from fun t ht => ⟨(hIo ht).1, + (hIo ht).2.le⟩) + have hIp : IsPreconnected I := by + rw [isPreconnected_iff_subset_of_disjoint_closed] + intro u v hu hv hsub hd + have hUc : IsCompact (I ∩ u) := hIc.inter_right hu + have hVc : IsCompact (I ∩ v) := hIc.inter_right hv + rcases isPreconnected_iff_subset_of_disjoint_closed.mp hAp (f '' (I ∩ u)) (f '' (I ∩ v)) + (hUc.image hf).isClosed (hVc.image hf).isClosed (fun a ha => by + obtain ⟨t, ht, rfl⟩ := hAC ha + have htI : t ∈ I := ⟨ht, ha⟩ + rcases hsub htI with h | h + · exact .inl ⟨t, ⟨htI, h⟩, rfl⟩ + · exact .inr ⟨t, ⟨htI, h⟩, rfl⟩) (by + ext a + simp only [mem_inter_iff, mem_empty_iff_false, iff_false] + rintro ⟨-, ⟨t, ht, rfl⟩, ⟨t', ht', he⟩⟩ + have h1 : t' = t := hIin ht'.1 ht.1 he + have : t ∈ I ∩ (u ∩ v) := ⟨ht.1, ht.2, h1 ▸ ht'.2⟩ + rw [hd] at this + exact this) with h | h + · refine .inl fun t ht => ?_ + obtain ⟨t', ht', he⟩ := h ht.2 + rw [← hIin ht'.1 ht he] + exact ht'.2 + · refine .inr fun t ht => ?_ + obtain ⟨t', ht', he⟩ := h ht.2 + rw [← hIin ht'.1 ht he] + exact ht'.2 + have hINe : I.Nonempty := by + obtain ⟨t, ht, he⟩ := hAC ha₀A + exact ⟨t, ht, by rw [mem_preimage, he]; exact ha₀A⟩ + obtain ⟨c₀, hc₀, hc₀l⟩ := hIc.exists_isLeast hINe + obtain ⟨d₀, hd₀, hd₀l⟩ := hIc.exists_isGreatest hINe + have hsegI : Icc c₀ d₀ ⊆ I := hIp.Icc_subset hc₀ hd₀ + have hG : IsOpen ((φ ∘ f) ⁻¹' N) := hN.preimage (hcont.comp hf) + have hgN : ∀ t ∈ I, φ (f t) ∈ N := fun t ht => hTN ht.2 + obtain ⟨ε₁, hε₁, hb₁⟩ := Metric.isOpen_iff.mp hG c₀ (hgN _ hc₀) + obtain ⟨ε₂, hε₂, hb₂⟩ := Metric.isOpen_iff.mp hG d₀ (hgN _ hd₀) + have hc₀π := hIo hc₀ + have hd₀π := hIo hd₀ + have hcd₀ : c₀ ≤ d₀ := hc₀l hd₀ + let c := max (c₀ - ε₁ / 2) ((c₀ - Real.pi) / 2) + let d := min (d₀ + ε₂ / 2) ((d₀ + Real.pi) / 2) + have hc1 : c < c₀ := max_lt (by linarith) (by linarith [hc₀π.1]) + have hc2 : c₀ - ε₁ / 2 ≤ c := le_max_left _ _ + have hc3 : (c₀ - Real.pi) / 2 ≤ c := le_max_right _ _ + have hd1 : d₀ < d := lt_min (by linarith) (by linarith [hd₀π.2]) + have hd2 : d ≤ d₀ + ε₂ / 2 := min_le_left _ _ + have hd3 : d ≤ (d₀ + Real.pi) / 2 := min_le_right _ _ + have hcd : c < d := by linarith + let a := (c - Real.pi) / 2 + let b := (d + Real.pi) / 2 + have ha1 : -Real.pi < a := by simp only [a]; linarith [hc₀π.1] + have ha2 : a < c := by simp only [a]; linarith [hc₀π.1] + have hb1 : b < Real.pi := by simp only [b]; linarith [hd₀π.2] + have hb2 : d < b := by simp only [b]; linarith [hd₀π.2] + have hsub : Icc a b ⊆ Ioc (-Real.pi) Real.pi := fun t ht => + ⟨by linarith [ht.1], by linarith [ht.2]⟩ + have hrest' : IsClosed (bd S' \ f '' Ioo a b) := by + have he : bd S' \ f '' Ioo a b = (bd S' \ f '' Icc (-Real.pi) Real.pi) ∪ f '' (Icc + (-Real.pi) Real.pi \ Ioo a b) := by + ext x + constructor + · rintro ⟨h1, h2⟩ + by_cases h3 : x ∈ f '' Icc (-Real.pi) Real.pi + · obtain ⟨t, ht, rfl⟩ := h3 + exact .inr ⟨t, ⟨ht, fun h => h2 ⟨t, h, rfl⟩⟩, rfl⟩ + · exact .inl ⟨h1, h3⟩ + · rintro (h | ⟨t, ht, rfl⟩) + · exact ⟨h.1, fun h' => h.2 (image_mono + (Ioo_subset_Icc_self.trans (hsub.trans Ioc_subset_Icc_self)) h')⟩ + · refine ⟨hfb t ht.1, ?_⟩ + rintro ⟨t', ht', he⟩ + have ht'I : t' ∈ Ioc (-Real.pi) Real.pi := ⟨by linarith [ht'.1], by linarith [ht'.2]⟩ + by_cases h1 : t = -Real.pi + · rw [h1, hfs] at he + have := hfi ht'I ⟨by linarith, le_rfl⟩ he + linarith [ht'.2] + · have := hfi ht'I ⟨lt_of_le_of_ne ht.1.1 (Ne.symm h1), ht.1.2⟩ he + exact ht.2 (this ▸ ht') + rw [he] + exact hfr.union (((isCompact_Icc.diff isOpen_Ioo).image hf).isClosed) + have hZ : IsClosed (φ ⁻¹' Nᶜ) := hN.isClosed_compl.preimage hcont + have hZg : ∀ u ∈ Icc c d, f u ∉ φ ⁻¹' Nᶜ := fun u hu h => by + refine h ?_ + by_cases h1 : u < c₀ + · refine hb₁ ?_ + rw [mem_ball, Real.dist_eq, abs_lt] + constructor <;> linarith [hu.1] + · by_cases h2 : d₀ < u + · refine hb₂ ?_ + rw [mem_ball, Real.dist_eq, abs_lt] + constructor <;> linarith [hu.2] + · exact hgN u (hsegI ⟨not_lt.mp h1, not_lt.mp h2⟩) + obtain ⟨χ, x₁, x₂, δ, hχ, hz', hA⟩ := exists_bd_chart hY hf (by linarith : a < c) hcd hb2 + (hfi.mono hsub) (fun u hu => hfb u ⟨(hsub hu).1.le, (hsub hu).2⟩) hrest' hZ hZg + refine ⟨χ, x₁, x₂, δ, hχ, fun w hw => ?_, fun a' ha' => ?_⟩ + · by_contra h + exact hz' w hw h + · obtain ⟨t, ht, rfl⟩ := hAC ha' + have htI : t ∈ I := ⟨ht, ha'⟩ + exact hA t ⟨by linarith [hc₀l htI], by linarith [hd₀l htI]⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/TreeStep.lean b/LeanPool/GraphMinor/GM07/TreeStep.lean new file mode 100644 index 0000000000..d32f58bab0 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/TreeStep.lean @@ -0,0 +1,1094 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.TreeChart +public import LeanPool.GraphMinor.GM07.Reroute + +/-! +# Moving the edges at a root to one side of a tree + +This is the main step of (4.4) of Graph Minors VII. Let `T` be a component of the forest `L`, with +root `z` on `bd(Σ)`, and let `H` be a forest whose edges at `z` cross `T` near `z`. We want the +edges at `z` to leave `z` from one chosen point `l` of `φ⁻¹(z)`, without crossing `T`. + +Take the half rectangle around `φ⁻¹(T)` from `exists_tree_chart`. Each edge at `z` leaves the image +of this rectangle for the last time at a point on the top or the lateral sides of the rectangle. +Replace the edge up to that point by the straight segment in the rectangle from `l` to that point +(`exists_new_line`). The segments meet only at `l`, because they end on the top and lateral sides +(`ray_eq`). +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology Metric Complex GraphMinor.Surface GraphMinor.GM11 + +variable {S S' : Type} [TopologicalSpace S] [TopologicalSpace S'] + +/-- The straight segment from the point `x₀` of the bottom side to `w`. -/ +noncomputable def ray (x₀ : ℝ) (w : ℂ) (t : unitInterval) : ℂ := (x₀ : ℂ) + (t.1 : ℂ) * (w - x₀) + +theorem continuous_ray (x₀ : ℝ) (w : ℂ) : Continuous (ray x₀ w) := by + unfold ray + fun_prop + +theorem ray_zero (x₀ : ℝ) (w : ℂ) : ray x₀ w 0 = x₀ := by simp [ray] + +theorem ray_one (x₀ : ℝ) (w : ℂ) : ray x₀ w 1 = w := by simp [ray] + +theorem ray_re (x₀ : ℝ) (w : ℂ) (t : unitInterval) : + (ray x₀ w t).re = x₀ + t.1 * (w.re - x₀) := by + simp [ray] + +theorem ray_im (x₀ : ℝ) (w : ℂ) (t : unitInterval) : (ray x₀ w t).im = t.1 * w.im := by simp [ray] + +section Rect + +variable {x₀ x₁ x₂ δ : ℝ} {w w' : ℂ} + +theorem ray_mem (hx₀ : x₀ ∈ Ioo x₁ x₂) (hw : w ∈ Icc x₁ x₂ ×ℂ Icc 0 δ) + (t : unitInterval) : ray x₀ w t ∈ Icc x₁ x₂ ×ℂ Icc 0 δ := by + have h1 : x₁ ≤ w.re := hw.1.1 + have h2 : w.re ≤ x₂ := hw.1.2 + have h3 : 0 ≤ w.im := hw.2.1 + have h4 : w.im ≤ δ := hw.2.2 + have ht0 := t.2.1 + have ht1 := t.2.2 + refine ⟨⟨?_, ?_⟩, ⟨?_, ?_⟩⟩ + · rw [ray_re] + nlinarith [hx₀.1, hx₀.2] + · rw [ray_re] + nlinarith [hx₀.1, hx₀.2] + · rw [ray_im] + positivity + · rw [ray_im] + nlinarith + +theorem ray_mem_box (hx₀ : x₀ ∈ Ioo x₁ x₂) (hw : w ∈ Icc x₁ x₂ ×ℂ Icc 0 δ) + (him : 0 < w.im) {t : unitInterval} (ht : t.1 < 1) : ray x₀ w t ∈ Ioo x₁ x₂ ×ℂ Ico 0 δ := by + have h1 : x₁ ≤ w.re := hw.1.1 + have h2 : w.re ≤ x₂ := hw.1.2 + have h4 : w.im ≤ δ := hw.2.2 + have ht0 := t.2.1 + have hs : 0 < 1 - t.1 := by linarith + refine ⟨⟨?_, ?_⟩, ⟨?_, ?_⟩⟩ + · rw [ray_re] + nlinarith [hx₀.1, hx₀.2] + · rw [ray_re] + nlinarith [hx₀.1, hx₀.2] + · rw [ray_im] + positivity + · rw [ray_im] + nlinarith + +/-- **Two segments that end on the top and lateral sides do not meet off the bottom side, unless +they are the same.** The segment with the nearer point of the two would end at a point inside the +box. -/ +theorem ray_eq (hx₀ : x₀ ∈ Ioo x₁ x₂) (hw : w ∈ Icc x₁ x₂ ×ℂ Icc 0 δ) + (hw' : w' ∈ Icc x₁ x₂ ×ℂ Icc 0 δ) (him : 0 < w.im) (him' : 0 < w'.im) + (hB : w ∉ Ioo x₁ x₂ ×ℂ Ico 0 δ) (hB' : w' ∉ Ioo x₁ x₂ ×ℂ Ico 0 δ) + {t t' : unitInterval} (ht : 0 < t.1) (ht' : 0 < t'.1) (h : ray x₀ w t = ray x₀ w' t') : w = w' + := by + have key : ∀ {w w' : ℂ} {t t' : unitInterval}, w ∈ Icc x₁ x₂ ×ℂ Icc 0 δ → 0 < w.im + → w' ∉ Ioo x₁ x₂ ×ℂ Ico 0 δ → 0 < t.1 → 0 < t'.1 → ray x₀ w t = ray x₀ w' t' → t ≤ t' → w = w' + := by + intro w w' t t' hw him hB' ht ht' h hle + have hle' : t.1 ≤ t'.1 := hle + have hr : t'.1 * (w'.re - x₀) = t.1 * (w.re - x₀) := by + have := congrArg Complex.re h + rw [ray_re, ray_re] at this + linarith + have hi : t'.1 * w'.im = t.1 * w.im := by + have := congrArg Complex.im h + rw [ray_im, ray_im] at this + exact this.symm + let s : unitInterval := ⟨t.1 / t'.1, by positivity, (div_le_one ht').mpr hle'⟩ + have hs : s.1 * t'.1 = t.1 := by + change t.1 / t'.1 * t'.1 = t.1 + field_simp + have hw'r : ray x₀ w s = w' := by + apply Complex.ext + · rw [ray_re] + have : t'.1 * (x₀ + s.1 * (w.re - x₀)) = t'.1 * w'.re := by + calc t'.1 * (x₀ + s.1 * (w.re - x₀)) = t'.1 * x₀ + (s.1 * t'.1) * (w.re - x₀) := by ring + _ = t'.1 * x₀ + t.1 * (w.re - x₀) := by rw [hs] + _ = t'.1 * w'.re := by rw [← hr]; ring + exact mul_left_cancel₀ ht'.ne' this + · rw [ray_im] + have : t'.1 * (s.1 * w.im) = t'.1 * w'.im := by + calc t'.1 * (s.1 * w.im) = (s.1 * t'.1) * w.im := by ring + _ = t.1 * w.im := by rw [hs] + _ = t'.1 * w'.im := hi.symm + exact mul_left_cancel₀ ht'.ne' this + by_cases hs1 : s.1 < 1 + · exact absurd (hw'r ▸ ray_mem_box hx₀ hw him hs1) hB' + · have hs2 : s.1 = 1 := le_antisymm s.2.2 (not_lt.mp hs1) + have : s = 1 := Subtype.ext hs2 + rw [this, ray_one] at hw'r + exact hw'r + rcases le_total t t' with hle | hle + · exact key hw him hB' ht ht' h hle + · exact (key hw' him' hB ht' ht h.symm hle).symm + +end Rect + +/-- **The new line of an edge at the root.** The arc `c` runs from `z` to `y`. It leaves the image +`Y` of the rectangle for the last time at a point `φ (χ w)` on the top or lateral sides. The new +line is the segment to `w`, followed by the rest `R` of `c`. -/ +theorem exists_new_line {L : Drawing S} {φ : S' → S} [CompactSpace S'] [T2Space S] + (hJ : IsCutAlongGraph L S' φ) {χ : ℂ → S'} {x₀ x₁ x₂ δ : ℝ} (hχ : IsBdChart χ x₁ x₂ δ) + (hx₀ : x₀ ∈ Ioo x₁ x₂) {z y : S} + (hz : φ (χ x₀) = z) {c : Set S} (hc : IsLineWithEnds c z y) {Y W₀ N Q₁ Q₂ : Set S} (hY : Y + = φ '' (χ '' (Icc x₁ x₂ ×ℂ Icc 0 δ))) (hW₀ : IsOpen W₀) (hzW : z ∈ W₀) (hW₀Y : W₀ ⊆ Y) + (hyY : y ∉ Y) + (hcb : ∀ q ∈ c, q ≠ z → q ≠ y → q ∉ bd S) (hYU : ∀ q ∈ Y, q ∈ L.U → q ∈ W₀) + (hzU : z ∈ L.U ∪ bd S) (hN : Flat N) (hYN : Y ⊆ N) (hcQ : c = Q₁ ∪ Q₂) (hQ₁N : Q₁ ⊆ N) + (hQ₁p : IsPreconnected Q₁) (hzQ₁ : z ∈ Q₁) (hQ₂ : Disjoint Q₂ Y) : + ∃ (w : ℂ) (R : Set S), w ∈ Icc x₁ x₂ ×ℂ Icc 0 δ ∧ w ∉ Ioo x₁ x₂ ×ℂ Ico 0 δ ∧ 0 < w.im ∧ φ + (χ w) ∉ W₀ ∧ φ (χ w) ∈ c ∧ R ⊆ c ∧ c \ N ⊆ R ∧ R ∩ Y = {φ (χ w)} ∧ IsClosed R ∧ + IsLineWithEnds (range (fun t => φ (χ (ray x₀ w t))) ∪ R) z y ∧ ∃ κ l : Path z y, + (∀ u, κ u ∈ range (fun t => φ (χ (ray x₀ w t))) ∪ R) ∧ (∀ u, l u ∈ c) ∧ κ.Homotopic l := by + classical + obtain ⟨hx, hδ, hcont, hinj, hopen, hbdχ⟩ := hχ + have hYS := hJ.isSurface + have : T2Space S' := hYS.2.1 + have hφ := hJ.quotientMap.continuous + have hF : ∀ q, φ q ∈ bd S ∪ L.U ↔ q ∈ bd S' := fun q => by rw [← hJ.preimage_bd_union_U]; rfl + set Rc : Set ℂ := Icc x₁ x₂ ×ℂ Icc 0 δ with hRc + set B : Set ℂ := Ioo x₁ x₂ ×ℂ Ico 0 δ with hB + have hRcc : IsCompact Rc := isCompact_Icc.reProdIm isCompact_Icc + have hYc : IsClosed Y := by + rw [hY] + exact ((hRcc.image_of_continuousOn hcont).image hφ).isClosed + obtain ⟨f, hf0, hf1⟩ := id hc + let a : unitInterval → S := fun t => (f t).1 + have hac : Continuous a := by fun_prop + have hai : Function.Injective a := fun s t h => f.injective (Subtype.ext h) + have harc : IsArcMap a := ⟨hac, hai⟩ + have hr : range a = c := by + ext q + exact ⟨by rintro ⟨t, rfl⟩; exact (f t).2, fun hq => ⟨f.symm ⟨q, hq⟩, by simp [a]⟩⟩ + have ha0 : a 0 = z := hf0 + have ha1 : a 1 = y := hf1 + have hmemc : ∀ t, a t ∈ c := fun t => (f t).2 + have hSet : IsCompact (a ⁻¹' Y) := (hYc.preimage hac).isCompact + have hzY : z ∈ Y := hW₀Y hzW + obtain ⟨te, hte, htel⟩ := hSet.exists_isGreatest ⟨0, by rw [mem_preimage, ha0]; exact hzY⟩ + have hte1 : te.1 < 1 := by + refine lt_of_le_of_ne te.2.2 fun h => hyY ?_ + have : te = 1 := Subtype.ext h + rw [this, mem_preimage, ha1] at hte + exact hte + obtain ⟨t₀, ht₀, -, ht₀W⟩ := exists_initial hac hW₀ (show a 0 ∈ W₀ by rw [ha0]; exact hzW) + have hte0 : 0 < te.1 := lt_of_lt_of_le ht₀ (htel (hW₀Y (ht₀W t₀ le_rfl))) + obtain ⟨A, hA, hA0, hAf, hfA, hA1⟩ := exists_tail harc hte0 hte1 + -- A point of the tail in an open subset of `Y` cannot exist. + have hlast : ∀ O : Set S, IsOpen O → O ⊆ Y → a te ∉ O := fun O hO hOY hin => by + obtain ⟨s, hs0, -, hs⟩ := exists_initial hA.1 hO (show A 0 ∈ O by rw [hA0]; exact hin) + have hne : s ≠ 0 := fun h => by rw [h] at hs0; simp at hs0 + obtain ⟨s', hs', he⟩ := hAf s hne + have : a s' ∈ Y := hOY (he ▸ hs s le_rfl) + exact absurd (htel this) (not_le.mpr hs') + have htY : a te ∈ Y := hte + obtain ⟨_, ⟨w, hw, rfl⟩, hpe⟩ := hY ▸ htY + have hpW : φ (χ w) ∉ W₀ := fun h => hlast W₀ hW₀ hW₀Y (hpe ▸ h) + have hte0' : te ≠ 0 := fun h => by rw [h] at hte0; simp at hte0 + have hte1' : te ≠ 1 := fun h => by rw [h] at hte1; simp at hte1 + have hpb : a te ∉ bd S := hcb _ (hmemc te) (fun h => hte0' (hai (h.trans ha0.symm))) fun h + => hte1' (hai (h.trans ha1.symm)) + have hpU : φ (χ w) ∉ L.U := fun h => hpW (hYU _ (by rw [hY]; exact ⟨_, ⟨w, hw, rfl⟩, rfl⟩) h) + have hwim : w.im ≠ 0 := fun h => by + have h1 := (hbdχ w hw).mpr h + rcases (hF _).mpr h1 with h2 | h2 + · exact hpb (hpe ▸ h2) + · exact hpU h2 + have hwpos : 0 < w.im := lt_of_le_of_ne hw.2.1 (Ne.symm hwim) + -- Points of the rectangle off the bottom side are not over `bd(Σ) ∪ U(L)`. + have hoff : ∀ u ∈ Rc, u.im ≠ 0 → χ u ∉ bd S' := fun u hu h0 h => h0 ((hbdχ u hu).mp h) + have hwB : w ∉ B := by + intro hin + let Bp : Set ℂ := Ioo x₁ x₂ ×ℂ Ioo 0 δ + have hBpB : Bp ⊆ B := fun u hu => ⟨hu.1, Ioo_subset_Ico_self hu.2⟩ + have hBR : B ⊆ Rc := fun u hu => ⟨Ioo_subset_Icc_self hu.1, Ico_subset_Icc_self hu.2⟩ + have hsplit : χ '' Bp = χ '' B \ bd S' := by + ext q + constructor + · rintro ⟨u, hu, rfl⟩ + exact ⟨⟨u, hBpB hu, rfl⟩, hoff u (hBR (hBpB hu)) hu.2.1.ne'⟩ + · rintro ⟨⟨u, hu, rfl⟩, h2⟩ + refine ⟨u, ⟨hu.1, lt_of_le_of_ne hu.2.1 fun h0 => h2 ((hbdχ u (hBR hu)).mpr h0.symm), + hu.2.2⟩, rfl⟩ + have hopen' : IsOpen (χ '' Bp) := by + rw [hsplit] + exact hopen.sdiff (isClosed_bd S') + have hsub : χ '' Bp ⊆ φ ⁻¹' (bd S ∪ L.U)ᶜ := by + rintro _ ⟨u, hu, rfl⟩ h + exact hoff u (hBR (hBpB hu)) hu.2.1.ne' ((hF _).mp h) + have hO := GM19.isOpen_image_of_isCutMap hJ.toSet.isCutMap hsub hopen' + refine hlast _ hO ?_ ?_ + · rw [hY] + exact image_mono (image_mono fun u hu => hBR (hBpB hu)) + · rw [← hpe] + exact ⟨χ w, ⟨w, ⟨hin.1, hwpos, lt_of_le_of_ne hw.2.2 fun h => (hin.2.2.ne h)⟩, rfl⟩, rfl⟩ + -- The segment. + let b : unitInterval → S := fun t => φ (χ (ray x₀ w t)) + have hrm : ∀ t, ray x₀ w t ∈ Rc := ray_mem hx₀ hw + have hbc : Continuous b := hφ.comp (hcont.comp_continuous (continuous_ray x₀ w) hrm) + have hb0 : b 0 = z := by simp only [b, ray_zero, hz] + have hb1 : b 1 = a te := by simp only [b, ray_one, hpe] + have hrimpos : ∀ t : unitInterval, t ≠ 0 → (ray x₀ w t).im ≠ 0 := fun t ht => by + rw [ray_im] + exact mul_ne_zero (fun h => ht (Subtype.ext h)) hwim + have hbi : Function.Injective b := by + have hstep : ∀ s t : unitInterval, t ≠ 0 → b s = b t → s ≠ 0 → s = t := fun s t ht h hs => by + have h1 : χ (ray x₀ w t) ∉ bd S' := hoff _ (hrm t) (hrimpos t ht) + have h2 := hJ.interior_inj _ h1 _ h.symm + have h3 := hinj (hrm t) (hrm s) h2 + have h4 : t.1 * w.im = s.1 * w.im := by rw [← ray_im, ← ray_im, h3] + exact (Subtype.ext (mul_right_cancel₀ hwim h4)).symm + have hzoff : ∀ t : unitInterval, t ≠ 0 → b t ≠ z := fun t ht h => by + have h1 : χ (ray x₀ w t) ∉ bd S' := hoff _ (hrm t) (hrimpos t ht) + have h2 : φ (χ (ray x₀ w t)) ∈ bd S ∪ L.U := by + have : b t = z := h + simp only [b] at this + rw [this] + exact hzU.symm + exact h1 ((hF _).mp h2) + intro s t h + by_cases hs : s = 0 + · by_cases ht : t = 0 + · rw [hs, ht] + · exact absurd (by rw [← h, hs, hb0]) (hzoff t ht) + · by_cases ht : t = 0 + · exact absurd (by rw [h, ht, hb0]) (hzoff s hs) + · exact hstep s t ht h hs + have hbY : ∀ t, b t ∈ Y := fun t => by + rw [hY] + exact ⟨_, ⟨_, hrm t, rfl⟩, rfl⟩ + have hL₁ : IsLineWithEnds (range b) z (a te) := by + have := isLineWithEnds_range_of_arc (a := b) ⟨hbc, hbi⟩ + rwa [hb0, hb1] at this + have hL₂ : IsLineWithEnds (range A) (a te) y := by + have := isLineWithEnds_range_of_arc hA + rwa [hA0, hA1, ha1] at this + have hRY : range A ∩ Y = {a te} := by + ext q + constructor + · rintro ⟨⟨s, rfl⟩, h⟩ + by_cases hs : s = 0 + · rw [hs, hA0] + rfl + · obtain ⟨s', hs', he⟩ := hAf s hs + rw [he] at h + exact absurd (htel h) (not_le.mpr hs') + · rintro rfl + exact ⟨⟨0, hA0⟩, htY⟩ + have hRc' : range A ⊆ c := by + rintro _ ⟨s, rfl⟩ + by_cases hs : s = 0 + · rw [hs, hA0] + exact hmemc te + · obtain ⟨s', -, he⟩ := hAf s hs + rw [he] + exact hmemc s' + have hinter : range b ∩ range A = {a te} := by + ext q + constructor + · rintro ⟨⟨t, rfl⟩, h⟩ + have : b t ∈ range A ∩ Y := ⟨h, hbY t⟩ + rwa [hRY] at this + · rintro rfl + exact ⟨⟨1, hb1⟩, ⟨0, hA0⟩⟩ + -- The first part of the old edge lies in `Q₁`. + have hemb : Topology.IsInducing a := (hac.isClosedEmbedding hai).isInducing + have hpre : IsPreconnected (a ⁻¹' Q₁) := by + rw [← hemb.isPreconnected_image, image_preimage_eq_of_subset (by + rw [hr, hcQ] + exact subset_union_left)] + exact hQ₁p + have hteQ : a te ∈ Q₁ := by + have h1 : a te ∈ Q₁ ∪ Q₂ := hcQ ▸ hmemc te + rcases h1 with h | h + · exact h + · exact (disjoint_left.mp hQ₂ h htY).elim + have hIcc : Icc 0 te ⊆ a ⁻¹' Q₁ := hpre.Icc_subset (by rw [mem_preimage, ha0]; exact hzQ₁) hteQ + refine ⟨w, range A, hw, hwB, hwpos, hpW, hpe ▸ hmemc te, hRc', ?_, ?_, + (isCompact_range hA.1).isClosed, ?_, ?_⟩ + · rintro q ⟨hq, hqN⟩ + obtain ⟨s, rfl⟩ := hr.symm ▸ hq + by_cases hs : te ≤ s + · obtain ⟨s', hs'⟩ := hfA s hs + exact ⟨s', hs'⟩ + · exact absurd (hQ₁N (hIcc ⟨unitInterval.nonneg _, (not_le.mp hs).le⟩)) hqN + · rw [hRY, hpe] + · exact hL₁.union hL₂ hinter + · let pa : Path z y := ⟨⟨a, hac⟩, ha0, ha1⟩ + let κ₁ : Path z (a te) := ⟨⟨b, hbc⟩, hb0, hb1⟩ + let κ₂ : Path (a te) y := ⟨⟨A, hA.1⟩, hA0, hA1.trans ha1⟩ + let l₁ : Path z (a te) := (pa.subpath 0 te).cast (by simp [pa]) rfl + have hl₁ : ∀ u, l₁ u ∈ Q₁ := fun u => by + have h1 : (pa.subpath 0 te) u ∈ range (pa.subpath 0 te) := ⟨u, rfl⟩ + rw [Path.range_subpath] at h1 + obtain ⟨v, hv, he⟩ := h1 + rw [uIcc_of_le (show (0 : unitInterval) ≤ te from unitInterval.nonneg te)] at hv + have h2 : l₁ u = pa v := he.symm + rw [h2] + exact hIcc hv + refine ⟨κ₁.trans κ₂, l₁.trans κ₂, mem_trans (fun u => .inl ⟨u, rfl⟩) (fun u => .inr ⟨u, + rfl⟩), mem_trans (fun u => hcQ ▸ .inl (hl₁ u)) (fun u => hRc' ⟨u, rfl⟩), ?_⟩ + exact (hN κ₁ l₁ (fun u => hYN (hbY u)) fun u => hQ₁N (hl₁ u)).hcomp (Path.Homotopic.refl _) + +/-- The closed set `c` splits into a connected part `Q₁` in `N` that holds `z` (if it is not empty), +and a closed part `Q₂` off `T`. -/ +def SplitEdge (c N : Set S) (z : S) (T : Set S) : Prop := + ∃ Q₁ Q₂ : Set S, IsClosed Q₂ ∧ c = Q₁ ∪ Q₂ ∧ Q₁ ⊆ N ∧ IsPreconnected Q₁ ∧ (Q₁.Nonempty → z ∈ Q₁) + ∧ Disjoint Q₂ T + +/-- A change of `c` inside a closed set off `T`, away from `N`, keeps the split. -/ +theorem SplitEdge.change {c c' N Y Y' T : Set S} {z : S} (h : SplitEdge c N z T) + (hc' : IsClosed c') (hY : IsClosed Y) (hNY : Disjoint N Y') (hTY : Disjoint Y T) + (h1 : c' ⊆ c ∪ Y) (h2 : c \ Y' ⊆ c') : SplitEdge c' N z T := by + obtain ⟨Q₁, Q₂, hQ₂, hc, hN, hp, hz, hd⟩ := h + refine ⟨Q₁, c' ∩ (Q₂ ∪ Y), hc'.inter (hQ₂.union hY), Subset.antisymm (fun q hq => ?_) ?_, hN, + hp, hz, ?_⟩ + · rcases h1 hq with hq' | hq' + · rw [hc] at hq' + rcases hq' with h3 | h3 + · exact .inl h3 + · exact .inr ⟨hq, .inl h3⟩ + · exact .inr ⟨hq, .inr hq'⟩ + · refine union_subset (fun q hq => h2 ⟨hc ▸ .inl hq, fun hqY => disjoint_left.mp hNY + (hN hq) hqY⟩) inter_subset_left + · rw [disjoint_left] + rintro q ⟨-, h3 | h3⟩ hqT + · exact disjoint_left.mp hd h3 hqT + · exact disjoint_left.mp hTY h3 hqT + +/-- A line with ends `a` and `b` carries a path from `a` to `b`. -/ +theorem exists_path_of_line {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : ∃ p : Path a b, ∀ u, + p u ∈ L := by + obtain ⟨f, rfl, rfl⟩ := h + exact ⟨⟨⟨fun t => (f t).1, by fun_prop⟩, rfl, rfl⟩, fun u => (f u).2⟩ + +/-- Two edges meet only at vertices. -/ +theorem closure_inter_closure_subset {H : Drawing S} {e f : Set S} (he : e ∈ H.E) (hf : f ∈ H.E) + (hne : e ≠ f) : closure e ∩ closure f ⊆ H.V := by + rintro q ⟨h1, h2⟩ + by_contra hq + have h3 : q ∈ e := by rw [← H.closure_diff_V he]; exact ⟨h1, hq⟩ + have h4 : q ∈ f := by rw [← H.closure_diff_V hf]; exact ⟨h2, hq⟩ + exact hne (arcComponent_eq he hf h3 h4) + +private theorem incident_edge_has_rectangular_cut + {S : Type} + {S' : Type} + [TopologicalSpace S] + [TopologicalSpace S'] + {L : Drawing S} + {φ : S' → S} + (hJ : IsCutAlongGraph L S' φ) + {T : Set S} + {z : S} + (hzT : z ∈ T) + (hzb : z ∈ bd S) + {H : Drawing S} + (hH : IsSurfaceForest H) + {N : Set S} + (hfl : Flat N) + [CompactSpace S'] + [T2Space S] + (Q₁ : Set S → Set S) + (Q₂ : Set S → Set S) + (hQ : ∀ e ∈ H.E, IsClosed (Q₂ e) ∧ closure e = Q₁ e ∪ Q₂ e ∧ Q₁ e ⊆ N ∧ IsPreconnected (Q₁ e) + ∧ ((Q₁ e).Nonempty → z ∈ Q₁ e) ∧ Disjoint (Q₂ e) T) : + let Cbad : Set S := (⋃ e ∈ H.E, Q₂ e) ∪ L.U \ T ∪ H.V \ {z} + ∀ (χ : ℂ → S'), + ∀ (x₁ : ℝ), + ∀ (x₂ : ℝ), + ∀ (δ : ℝ), + (IsBdChart χ x₁ x₂ δ) → + let Rc : Set ℂ := Icc x₁ x₂ ×ℂ Icc 0 δ + let B : Set ℂ := Ioo x₁ x₂ ×ℂ Ico 0 δ + ∀ (x₀ : ℝ), + (x₀ ∈ Ioo x₁ x₂) → + (φ (χ ↑x₀) = z) → + let Y : Set S := φ '' χ '' Rc + (∀ q ∈ Y, q ∈ N ∧ q ∉ Cbad) → + let W₀ : Set S := (φ '' (χ '' B)ᶜ)ᶜ + (IsOpen W₀) → + (T ⊆ W₀) → + (W₀ ⊆ Y) → + (∀ q ∈ Y, q ∈ L.U → q ∈ W₀) → + (∀ e ∈ H.E, z ∈ closure e → z ∈ H.V) → + (∀ e ∈ H.E, Disjoint (Q₂ e) Y) → + ∀ (e : Set S), + (e ∈ H.E) → + (z ∈ closure e) → + ∃ w R y, closure e ∩ H.V = {z, y} ∧ w ∈ Rc ∧ w ∉ B ∧ 0 < w.im ∧ φ (χ w) ∉ W₀ ∧ φ (χ w) ∈ + closure e ∧ R ⊆ closure e ∧ closure e \ N ⊆ R ∧ R ∩ Y = {φ (χ w)} ∧ IsClosed R ∧ + IsLineWithEnds ((range fun t => φ (χ (ray x₀ w t))) ∪ R) z y ∧ ∃ κ l : Path z y, (∀ (u : + ↑unitInterval), κ u ∈ (range fun t => φ (χ (ray x₀ w t))) ∪ R) ∧ (∀ (u : ↑unitInterval), l u + ∈ closure e) ∧ κ.Homotopic l := by + intro Cbad χ x₁ x₂ δ hχ Rc B x₀ hx₀ hzx Y hYM W₀ hW₀ hTW hW₀Y hYU hzH hQY e he hz + obtain ⟨u, v, -, hcap, hline⟩ := edge_line_of_forest hH.2 he + have hzc : z ∈ ({u, v} : Set S) := by rw [← hcap]; exact ⟨hz, hzH e he hz⟩ + obtain ⟨y, hcap', hline'⟩ : ∃ y, closure e ∩ H.V = {z, y} ∧ IsLineWithEnds (closure e) z y := by + rcases hzc with rfl | h + · exact ⟨v, hcap, hline⟩ + · obtain rfl : z = v := h + exact ⟨u, by rw [hcap, pair_comm], hline.symm⟩ + obtain ⟨hclosed, hc, hN', hp, h0, hd⟩ := hQ e he + have hyV : y ∈ closure e ∩ H.V := by rw [hcap']; exact .inr rfl + have hne : y ≠ z := fun h => by + have hC := edge_line_of_forest hH.2 he + obtain ⟨u', v', huv, hcap'', -⟩ := hC + rw [hcap', h] at hcap'' + simp only [mem_singleton_iff, insert_eq_of_mem] at hcap'' + have h1 : u' ∈ ({z} : Set S) := by rw [hcap'']; exact .inl rfl + have h2 : v' ∈ ({z} : Set S) := by rw [hcap'']; exact .inr rfl + exact huv (h1.trans h2.symm) + have hyY : y ∉ Y := fun h => (hYM y h).2 (.inr ⟨hyV.2, hne⟩) + have hcb : ∀ q ∈ closure e, q ≠ z → q ≠ y → q ∉ bd S := fun q hq h1 h2 hb => by + have h3 : q ∈ closure e ∩ H.V := ⟨hq, hH.1 ⟨hb, H.closure_subset_U he hq⟩⟩ + rw [hcap'] at h3 + rcases h3 with h3 | h3 + · exact h1 h3 + · exact h2 h3 + have hne₁ : (Q₁ e).Nonempty := by + by_contra hn + rw [not_nonempty_iff_eq_empty] at hn + rw [hn, empty_union] at hc + exact disjoint_left.mp hd (hc ▸ hz) hzT + obtain ⟨w, R, h⟩ := exists_new_line hJ hχ hx₀ hzx hline' rfl hW₀ (hTW hzT) hW₀Y hyY hcb hYU + (.inr hzb) hfl (fun q hq => (hYM q hq).1) hc hN' hp (h0 hne₁) (hQY e he) + exact ⟨w, R, y, hcap', h⟩ + +private theorem rerouted_incident_edges_inter_only_at_vertices + {S : Type} + [TopologicalSpace S] + {z : S} + {H : Drawing S} + (Y : Set S) + (hzH : ∀ e ∈ H.E, z ∈ closure e → z ∈ H.V) + (R : Set S → Set S) + (b : Set S → ↑unitInterval → S) : + let G : Set S → Set S := fun e => range (b e) + (∀ e ∈ H.E, z ∈ closure e → G e ⊆ Y) → + (∀ (e : Set S), b e 0 = z) → + (∀ e ∈ H.E, z ∈ closure e → ∀ f ∈ H.E, z ∈ closure f → e ≠ f → ∀ (t t' : + ↑unitInterval), t ≠ 0 → t' ≠ 0 → b e t ≠ b f t') → + (∀ e ∈ H.E, z ∈ closure e → ∀ q ∈ R e, q ∈ Y → q = b e 1) → + ∀ (M : Set S → Set S), + (∀ (e : Set S), z ∈ closure e → M e = G e ∪ R e) → + (∀ e ∈ H.E, z ∈ closure e → R e ⊆ closure e) → + ∀ (e : Set S), + (e ∈ H.E) → + (z ∈ closure e) → + ∀ (f : Set S), + (f ∈ H.E) → + (z ∈ closure f) → + (e ≠ f) → + ∀ (q : S), + (q ∈ M e ∩ M f) → + q ∈ H.V := by + intro G hGY hb0 hsame hRY M hMs hRc' e he hz f hf hzf hef q hq + obtain ⟨h1, h2⟩ := hq + rw [hMs e hz] at h1 + rw [hMs f hzf] at h2 + have hzV := hzH e he hz + have hmix : ∀ e, e ∈ H.E → z ∈ closure e → ∀ f, f ∈ H.E → z ∈ closure f → e ≠ f → q ∈ G e + → q ∈ R f → q ∈ H.V := fun e he hz f hf hzf hef h1 h2 => by + obtain ⟨t, rfl⟩ := h1 + by_cases ht : t = 0 + · rw [ht, hb0] + exact hzV + · exact absurd (hRY f hf hzf _ h2 (hGY e he hz ⟨t, rfl⟩)) (hsame e he hz f hf hzf hef t 1 ht + one_ne_zero) + rcases h1 with h1 | h1 + · rcases h2 with h2 | h2 + · obtain ⟨t, rfl⟩ := h1 + obtain ⟨t', ht'⟩ := h2 + by_cases ht : t = 0 + · rw [ht, hb0] + exact hzV + · by_cases ht0 : t' = 0 + · rw [← ht', ht0, hb0] + exact hzV + · exact absurd ht'.symm (hsame e he hz f hf hzf hef t t' ht ht0) + · exact hmix e he hz f hf hzf hef h1 h2 + · rcases h2 with h2 | h2 + · exact hmix f hf hzf e he hz hef.symm h2 h1 + · exact closure_inter_closure_subset he hf hef ⟨hRc' e he hz h1, hRc' f hf hzf h2⟩ + +private theorem rerouted_and_unmoved_edges_inter_only_at_vertices + {S : Type} + [TopologicalSpace S] + {z : S} + {H : Drawing S} + (Y : Set S) + (R : Set S → Set S) + (G : Set S → Set S) + (hGY : ∀ e ∈ H.E, z ∈ closure e → G e ⊆ Y) + (M : Set S → Set S) + (hMs : ∀ (e : Set S), z ∈ closure e → M e = G e ∪ R e) + (hMn : ∀ (e : Set S), z ∉ closure e → M e = closure e) + (hRc' : ∀ e ∈ H.E, z ∈ closure e → R e ⊆ closure e) + (hoffY : ∀ e ∈ H.E, z ∉ closure e → ∀ q ∈ closure e, q ∉ Y) + (e : Set S) + (he : e ∈ H.E) + (hz : z ∈ closure e) + (f : Set S) + (hf : f ∈ H.E) + (hzf : z ∉ closure f) + (hef : e ≠ f) + (q : S) + (hq : q ∈ M e ∩ M f) : + q ∈ H.V := by + obtain ⟨h1, h2⟩ := hq + rw [hMs e hz] at h1 + rw [hMn f hzf] at h2 + rcases h1 with h1 | h1 + · exact absurd (hGY e he hz h1) (hoffY f hf hzf q h2) + · exact closure_inter_closure_subset he hf hef ⟨hRc' e he hz h1, h2⟩ + +private theorem root_set_in_open_neighbourhood + {S : Type} + {S' : Type} + [TopologicalSpace S'] + {φ : S' → S} + {T : Set S} + (χ : ℂ → S') + (x₁ : ℝ) + (x₂ : ℝ) + (δ : ℝ) + (hχ : IsBdChart χ x₁ x₂ δ) + (hA : ∀ a ∈ φ ⁻¹' T, ∃ x ∈ Ioo x₁ x₂, χ ↑x = a) : + let B : Set ℂ := Ioo x₁ x₂ ×ℂ Ico 0 δ + let W₀ : Set S := (φ '' (χ '' B)ᶜ)ᶜ + T ⊆ W₀ := by + intro B W₀ + rintro t ht ⟨x, hx, rfl⟩ + obtain ⟨r, hr, he⟩ := hA x ht + refine hx ⟨r, ?_, he⟩ + refine ⟨?_, ?_⟩ + · rw [mem_preimage, ofReal_re] + exact hr + · rw [mem_preimage, ofReal_im] + exact ⟨le_rfl, hχ.hδ⟩ + +private theorem rerouted_edge_subset_original_union_chart + {S : Type} + [TopologicalSpace S] + {z : S} + {H : Drawing S} + (Y : Set S) + (R : Set S → Set S) + (G : Set S → Set S) + (hGY : ∀ e ∈ H.E, z ∈ closure e → G e ⊆ Y) + (M : Set S → Set S) + (hMs : ∀ (e : Set S), z ∈ closure e → M e = G e ∪ R e) + (hMn : ∀ (e : Set S), z ∉ closure e → M e = closure e) + (hRc' : ∀ e ∈ H.E, z ∈ closure e → R e ⊆ closure e) + (e : Set S) + (he : e ∈ H.E) + (q : S) + (hq : q ∈ M e) : + q ∈ closure e ∪ Y := by + by_cases hz : z ∈ closure e + · rw [hMs e hz] at hq + rcases hq with h1 | h1 + · exact .inr (hGY e he hz h1) + · exact .inl (hRc' e he hz h1) + · rw [hMn e hz] at hq + exact .inl hq + +private theorem assemble_forest_root_step + {S : Type} + {S' : Type} + [TopologicalSpace S] + [TopologicalSpace S'] + {L : Drawing S} + {φ : S' → S} + (hJ : IsCutAlongGraph L S' φ) + {T : Set S} + (hTU : T ⊆ L.U) + {z : S} + (hzT : z ∈ T) + (hzb : z ∈ bd S) + {l₀ : S'} + {H : Drawing S} + {N : Set S} + (hV : ∀ v ∈ H.V, v ≠ z → v ∉ T) + [T2Space S'] + (hφ : Continuous φ) + (hFiff : ∀ (q : S'), φ q ∈ bd S ∪ L.U ↔ q ∈ bd S') + (hEfin : H.E.Finite) + (Q₁ : Set S → Set S) + (Q₂ : Set S → Set S) + (hQ : ∀ e ∈ H.E, IsClosed (Q₂ e) ∧ closure e = Q₁ e ∪ Q₂ e ∧ Q₁ e ⊆ N ∧ IsPreconnected (Q₁ e) + ∧ ((Q₁ e).Nonempty → z ∈ Q₁ e) ∧ Disjoint (Q₂ e) T) + (χ : ℂ → S') + (x₁ : ℝ) + (x₂ : ℝ) + (δ : ℝ) + (hχ : IsBdChart χ x₁ x₂ δ) : + let Rc : Set ℂ := Icc x₁ x₂ ×ℂ Icc 0 δ + ∀ (B : Set ℂ), + ∀ (x₀ : ℝ), + (χ ↑x₀ = l₀) → + ∀ (Y : Set S), + (IsClosed Y) → + ∀ (W₀ : Set S), + (T ⊆ W₀) → + (W₀ ⊆ Y) → + (∀ e ∈ H.E, z ∈ closure e → z ∈ H.V) → + (∀ e ∈ H.E, z ∉ closure e → closure e = Q₂ e) → + ∀ (w : Set S → ℂ), + ∀ (R : Set S → Set S), + ∀ (y : (e : Set S) → e ∈ H.E → z ∈ closure e → S), + (∀ (e : Set S) (a : e ∈ H.E) (a_1 : z ∈ closure e), closure e ∩ H.V = {z, y e a a_1} ∧ + w e ∈ Rc ∧ w e ∉ B ∧ 0 < (w e).im ∧ φ (χ (w e)) ∉ W₀ ∧ φ (χ (w e)) ∈ closure e ∧ R e ⊆ + closure e ∧ closure e \ N ⊆ R e ∧ R e ∩ Y = {φ (χ (w e))} ∧ IsClosed (R e) ∧ IsLineWithEnds + ((range fun t => φ (χ (ray x₀ (w e) t))) ∪ R e) z (y e a a_1) ∧ ∃ κ l : Path z (y e a a_1), + (∀ (u : ↑unitInterval), κ u ∈ (range fun t => φ (χ (ray x₀ (w e) t))) ∪ R e) ∧ (∀ (u : + ↑unitInterval), l u ∈ closure e) ∧ κ.Homotopic l) → + let b : Set S → ↑unitInterval → S := fun e t => φ (χ (ray x₀ (w e) t)) + let G : Set S → Set S := fun e => range (b e) + (∀ e ∈ H.E, z ∈ closure e → ∀ (t : ↑unitInterval), ray x₀ (w e) t ∈ Rc) → + (∀ e ∈ H.E, z ∈ closure e → ∀ (t : ↑unitInterval), t ≠ 0 → χ (ray x₀ (w e) t) ∉ bd + S') → + (∀ e ∈ H.E, z ∈ closure e → ∀ (t : ↑unitInterval), t ≠ 0 → b e t ∉ bd S ∪ L.U) → + (∀ (e : Set S), b e 0 = z) → + (∀ e ∈ H.E, z ∈ closure e → ∀ q ∈ R e, q ∈ Y → q = b e 1) → + ∀ (M : Set S → Set S), + (∀ (e : Set S), z ∈ closure e → M e = G e ∪ R e) → + (∀ (e : Set S), z ∉ closure e → M e = closure e) → + ∀ (P : Drawing S), + (P.V = H.V) → + (P.U = H.V ∪ ⋃ e ∈ H.E, M e) → + (IsSurfaceForest P) → + (ForestsHomotopic P H) → + (∀ e' ∈ P.E, ∃ e ∈ H.E, closure e' = M e) → + (Y ⊆ N) → + (∀ e ∈ H.E, M e ⊆ closure e ∪ Y) → + ∃ (P : Drawing S) (Y : Set S), IsClosed Y ∧ Y ⊆ N ∧ P.V = H.V ∧ IsSurfaceForest P ∧ + ForestsHomotopic P H ∧ P.U ∩ T ⊆ {z} ∧ (∀ e' ∈ P.E, ∃ e ∈ H.E, closure e' ⊆ closure e ∪ Y ∧ + closure e \ N ⊆ closure e') ∧ P.U ⊆ H.U ∪ Y ∧ ∀ z' ∈ φ ⁻¹' {z}, z' ≠ l₀ → z' ∉ closure (φ + ⁻¹' (P.U \ P.V)) := by + intro Rc B x₀ hxl Y hYc W₀ hTW hW₀Y hzH hnon w R y hP b G hrm hoffb hoffF hb0 hRY M hMs hMn P + hPV hPU hPf hPh hPe hYN hMY + classical + refine ⟨P, Y, hYc, hYN, hPV, hPf, hPh, ?_, ?_, ?_, ?_⟩ + · rintro q ⟨hq, hqT⟩ + rw [hPU] at hq + rcases hq with h | h + · by_contra hn + exact hV q h hn hqT + · obtain ⟨e, he, h⟩ := mem_iUnion₂.mp h + by_cases hz : z ∈ closure e + · rw [hMs e hz] at h + rcases h with ⟨t, rfl⟩ | h1 + · by_cases ht : t = 0 + · rw [ht, hb0] + rfl + · exact absurd (Or.inr (hTU hqT)) (hoffF e he hz t ht) + · have h2 := hRY e he hz q h1 (hW₀Y (hTW hqT)) + have h3 : φ (χ (w e)) ∉ W₀ := (hP e he hz).2.2.2.2.1 + have h4 : b e 1 = φ (χ (w e)) := by simp only [b, ray_one] + rw [h2, h4] at hqT + exact absurd (hTW hqT) h3 + · rw [hMn e hz, hnon e he hz] at h + exact absurd hqT (disjoint_left.mp (hQ e he).2.2.2.2.2 h) + · intro e' he' + obtain ⟨e, he, hc⟩ := hPe e' he' + refine ⟨e, he, hc ▸ hMY e he, fun q hq => ?_⟩ + rw [hc] + by_cases hz : z ∈ closure e + · rw [hMs e hz] + exact .inr ((hP e he hz).2.2.2.2.2.2.2.1 hq) + · rw [hMn e hz] + exact hq.1 + · rw [hPU] + refine union_subset (fun q hq => .inl (H.V_subset_U hq)) (iUnion₂_subset fun e he q hq => ?_) + rcases hMY e he hq with h | h + · exact .inl (H.closure_subset_U he h) + · exact .inr h + · intro z' hz' hne hin + have hz'' : φ z' = z := hz' + let C : Set S := ⋃ e ∈ H.E, if z ∈ closure e then R e else closure e + have hCcl : IsClosed C := hEfin.isClosed_biUnion fun e he => by + by_cases hz : z ∈ closure e + · rw [ite_eq_left hz] + exact (hP e he hz).2.2.2.2.2.2.2.2.2.1 + · rw [ite_eq_right hz] + exact isClosed_closure + let D : Set S' := ⋃ e ∈ {e ∈ H.E | z ∈ closure e}, χ '' range (ray x₀ (w e)) + have hDc : IsClosed D := (hEfin.subset (sep_subset _ _)).isClosed_biUnion fun e he => by + have h1 : IsCompact (range (ray x₀ (w e))) := isCompact_range (continuous_ray _ _) + have h2 : range (ray x₀ (w e)) ⊆ Rc := by + rintro _ ⟨t, rfl⟩ + exact hrm e he.1 he.2 t + exact (h1.image_of_continuousOn (hχ.cont.mono h2)).isClosed + have hsub : φ ⁻¹' (P.U \ P.V) ⊆ φ ⁻¹' C ∪ D := by + rintro q ⟨hq1, hq2⟩ + rw [hPU] at hq1 + rw [hPV] at hq2 + rcases hq1 with h | h + · exact absurd h hq2 + · obtain ⟨e, he, h⟩ := mem_iUnion₂.mp h + by_cases hz : z ∈ closure e + · rw [hMs e hz] at h + rcases h with ⟨t, ht⟩ | h1 + · by_cases ht0 : t = 0 + · rw [ht0, hb0] at ht + exact absurd (ht ▸ hzH e he hz) hq2 + · have h2 : q = χ (ray x₀ (w e) t) := (hJ.interior_inj _ (hoffb e he hz t ht0) _ + ht).symm + exact .inr (mem_iUnion₂.mpr ⟨e, ⟨he, hz⟩, _, ⟨t, rfl⟩, h2.symm⟩) + · refine .inl (mem_iUnion₂.mpr ⟨e, he, ?_⟩) + rw [ite_eq_left hz] + exact h1 + · refine .inl (mem_iUnion₂.mpr ⟨e, he, ?_⟩) + rw [ite_eq_right hz] + rw [hMn e hz] at h + exact h + have hcl := closure_minimal hsub ((hCcl.preimage hφ).union hDc) hin + rcases hcl with h | h + · obtain ⟨e, he, h⟩ := mem_iUnion₂.mp h + by_cases hz : z ∈ closure e + · rw [ite_eq_left hz] at h + have h1 : z ∈ R e := hz'' ▸ h + have h2 := hRY e he hz z h1 (hW₀Y (hTW hzT)) + have h3 : φ (χ (w e)) ∉ W₀ := (hP e he hz).2.2.2.2.1 + have h4 : b e 1 = φ (χ (w e)) := by simp only [b, ray_one] + rw [h4] at h2 + exact h3 (h2 ▸ hTW hzT) + · rw [ite_eq_right hz] at h + exact hz (hz'' ▸ h) + · obtain ⟨e, he, _, ⟨t, rfl⟩, h1⟩ := mem_iUnion₂.mp h + by_cases ht : t = 0 + · rw [ht, ray_zero, hxl] at h1 + exact hne h1.symm + · refine hoffb e he.1 he.2 t ht ?_ + rw [h1, ← hFiff, hz''] + exact .inl hzb + +private theorem distinct_incident_edges_have_distinct_cut_points + {S : Type} + {S' : Type} + [TopologicalSpace S] + {L : Drawing S} + {φ : S' → S} + {T : Set S} + {z : S} + (hzT : z ∈ T) + {H : Drawing S} + {N : Set S} + (Q₂ : Set S → Set S) : + let Cbad : Set S := (⋃ e ∈ H.E, Q₂ e) ∪ L.U \ T ∪ H.V \ {z} + ∀ (χ : ℂ → S'), + ∀ (Rc : Set ℂ), + ∀ (B : Set ℂ), + ∀ (x₀ : ℝ), + let Y : Set S := φ '' χ '' Rc + (∀ q ∈ Y, q ∈ N ∧ q ∉ Cbad) → + ∀ (W₀ : Set S), + (T ⊆ W₀) → + ∀ (w : Set S → ℂ), + ∀ (R : Set S → Set S), + ∀ (y : (e : Set S) → e ∈ H.E → z ∈ closure e → S), + (∀ (e : Set S) (a : e ∈ H.E) (a_1 : z ∈ closure e), closure e ∩ H.V = {z, y e a a_1} ∧ + w e ∈ Rc ∧ w e ∉ B ∧ 0 < (w e).im ∧ φ (χ (w e)) ∉ W₀ ∧ φ (χ (w e)) ∈ closure e ∧ R e ⊆ + closure e ∧ closure e \ N ⊆ R e ∧ R e ∩ Y = {φ (χ (w e))} ∧ IsClosed (R e) ∧ IsLineWithEnds + ((range fun t => φ (χ (ray x₀ (w e) t))) ∪ R e) z (y e a a_1) ∧ ∃ κ l : Path z (y e a a_1), + (∀ (u : ↑unitInterval), κ u ∈ (range fun t => φ (χ (ray x₀ (w e) t))) ∪ R e) ∧ (∀ (u : + ↑unitInterval), l u ∈ closure e) ∧ κ.Homotopic l) → + ∀ (e : Set S), + (e ∈ H.E) → + (z ∈ closure e) → + ∀ (f : Set S), + (f ∈ H.E) → + (z ∈ closure f) → + (e ≠ f) → + (w e = w f) → + False := by + intro Cbad χ Rc B x₀ Y hYM W₀ hTW w R y hP e he hz f hf hzf hef h + have hp := hP e he hz + have hq := hP f hf hzf + have h1 : φ (χ (w e)) ∈ closure e := hp.2.2.2.2.2.1 + have h2 : φ (χ (w e)) ∈ closure f := h ▸ hq.2.2.2.2.2.1 + have h3 := closure_inter_closure_subset he hf hef ⟨h1, h2⟩ + have h4 : φ (χ (w e)) ∈ Y := ⟨_, ⟨_, hp.2.1, rfl⟩, rfl⟩ + have h5 : φ (χ (w e)) ≠ z := fun h6 => hp.2.2.2.2.1 (h6 ▸ hTW hzT) + exact (hYM _ h4).2 (.inr ⟨h3, h5⟩) + +private theorem distinct_rerouting_rays_avoid_each_other + {S : Type} + {S' : Type} + [TopologicalSpace S] + [TopologicalSpace S'] + {L : Drawing S} + {φ : S' → S} + (hJ : IsCutAlongGraph L S' φ) + {z : S} + {H : Drawing S} + {N : Set S} + (χ : ℂ → S') + (x₁ : ℝ) + (x₂ : ℝ) + (δ : ℝ) + (hχ : IsBdChart χ x₁ x₂ δ) : + let Rc : Set ℂ := Icc x₁ x₂ ×ℂ Icc 0 δ + let B : Set ℂ := Ioo x₁ x₂ ×ℂ Ico 0 δ + ∀ (x₀ : ℝ), + (x₀ ∈ Ioo x₁ x₂) → + ∀ (Y : Set S), + ∀ (W₀ : Set S), + ∀ (w : Set S → ℂ), + ∀ (R : Set S → Set S), + ∀ (y : (e : Set S) → e ∈ H.E → z ∈ closure e → S), + (∀ (e : Set S) (a : e ∈ H.E) (a_1 : z ∈ closure e), closure e ∩ H.V = {z, y e a a_1} ∧ + w e ∈ Rc ∧ w e ∉ B ∧ 0 < (w e).im ∧ φ (χ (w e)) ∉ W₀ ∧ φ (χ (w e)) ∈ closure e ∧ R e ⊆ + closure e ∧ closure e \ N ⊆ R e ∧ R e ∩ Y = {φ (χ (w e))} ∧ IsClosed (R e) ∧ IsLineWithEnds + ((range fun t => φ (χ (ray x₀ (w e) t))) ∪ R e) z (y e a a_1) ∧ ∃ κ l : Path z (y e a a_1), + (∀ (u : ↑unitInterval), κ u ∈ (range fun t => φ (χ (ray x₀ (w e) t))) ∪ R e) ∧ (∀ (u : + ↑unitInterval), l u ∈ closure e) ∧ κ.Homotopic l) → + let b : Set S → ↑unitInterval → S := fun e t => φ (χ (ray x₀ (w e) t)) + (∀ e ∈ H.E, z ∈ closure e → ∀ (t : ↑unitInterval), ray x₀ (w e) t ∈ Rc) → + (∀ e ∈ H.E, z ∈ closure e → ∀ (t : ↑unitInterval), t ≠ 0 → χ (ray x₀ (w e) t) ∉ bd + S') → + (∀ e ∈ H.E, z ∈ closure e → ∀ f ∈ H.E, z ∈ closure f → e ≠ f → w e ≠ w f) → + ∀ e ∈ H.E, z ∈ closure e → ∀ f ∈ H.E, z ∈ closure f → e ≠ f → ∀ (t t' : ↑unitInterval), t ≠ 0 + → t' ≠ 0 → b e t ≠ b f t' := by + intro Rc B x₀ hx₀ Y W₀ w R y hP b hrm hoffb hwne e he hz f hf hzf hef t t' ht ht' h + have h1 := hJ.interior_inj _ (hoffb e he hz t ht) _ h + have h2 := hχ.inj (hrm e he hz t) (hrm f hf hzf t') h1 + have hp := hP e he hz + have hq := hP f hf hzf + exact hwne e he hz f hf hzf hef (ray_eq hx₀ hp.2.1 hq.2.1 hp.2.2.2.1 hq.2.2.2.1 hp.2.2.1 + hq.2.2.1 (unitInterval.pos_iff_ne_zero.mpr ht) (unitInterval.pos_iff_ne_zero.mpr ht') h2) + +/-- **The step of (4.4) at one root.** Let `T` be a component of the forest `L`, with the point `z` +on `bd(Σ)`, and let `N` be a flat open set around `T`. If the only vertex of `H` on `T` is `z`, and +the edges of `H` split as in `SplitEdge`, then we can change `H` inside `N` so that it meets `T` +only at `z`, and it leaves `z` only from the point `l₀` of the fibre of `z`. -/ +theorem exists_root_step (hS : IsSurface S) {L : Drawing S} {φ : S' → S} + (hJ : IsCutAlongGraph L S' φ) (hNo : NoArcs L) {T : Set S} (hT : IsPreconnected T) + (hTc : IsClosed T) (hrest : IsClosed (L.U \ T)) (hTU : T ⊆ L.U) + {z : S} (hzT : z ∈ T) (hzb : z ∈ bd S) {l₀ : S'} (hl₀ : φ l₀ = z) {H : Drawing S} + (hH : IsSurfaceForest H) {N : Set S} (hNo' : IsOpen N) (hfl : Flat N) (hTN : T ⊆ N) + (hV : ∀ v ∈ H.V, v ≠ z → v ∉ T) (hE : ∀ e ∈ H.E, SplitEdge (closure e) N z T) : + ∃ (P : Drawing S) (Y : Set S), IsClosed Y ∧ Y ⊆ N ∧ P.V = H.V ∧ IsSurfaceForest P + ∧ ForestsHomotopic P H ∧ P.U ∩ T ⊆ {z} ∧ (∀ e' ∈ P.E, ∃ e ∈ H.E, closure e' ⊆ closure e ∪ Y + ∧ closure e \ N ⊆ closure e') ∧ P.U ⊆ H.U ∪ Y ∧ + ∀ z' ∈ φ ⁻¹' {z}, z' ≠ l₀ → z' ∉ closure (φ ⁻¹' (P.U \ P.V)) := by + classical + have hY' := hJ.isSurface + have : CompactSpace S' := hY'.1 + have : T2Space S' := hY'.2.1 + have : T2Space S := hS.2.1 + have hφ := hJ.quotientMap.continuous + have hsurj := hJ.quotientMap.surjective + have hFiff : ∀ q, φ q ∈ bd S ∪ L.U ↔ q ∈ bd S' := fun q => by rw [← hJ.preimage_bd_union_U]; rfl + have hEfin : H.E.Finite := H.finite_edges + choose! Q₁ Q₂ hQ using hE + let Cbad : Set S := (⋃ e ∈ H.E, Q₂ e) ∪ (L.U \ T) ∪ (H.V \ {z}) + have hCc : IsClosed Cbad := ((hEfin.isClosed_biUnion fun e he => (hQ e he).1).union hrest).union + (H.finite_V.subset sdiff_subset).isClosed + have hTC : ∀ t ∈ T, t ∉ Cbad := fun t ht => by + rintro ((h | h) | h) + · obtain ⟨e, he, h⟩ := mem_iUnion₂.mp h + exact disjoint_left.mp (hQ e he).2.2.2.2.2 h ht + · exact h.2 ht + · exact hV t h.1 h.2 ht + obtain ⟨χ, x₁, x₂, δ, hχ, hmap, hA⟩ := exists_tree_chart hS hJ hNo hT hTc hrest hTU hzT hzb + (hNo'.inter hCc.isOpen_compl) fun t ht => ⟨hTN ht, hTC t ht⟩ + set Rc : Set ℂ := Icc x₁ x₂ ×ℂ Icc 0 δ with hRc + set B : Set ℂ := Ioo x₁ x₂ ×ℂ Ico 0 δ with hB + have hRcc : IsCompact Rc := isCompact_Icc.reProdIm isCompact_Icc + obtain ⟨x₀, hx₀, hxl⟩ := hA l₀ (by rw [mem_preimage, hl₀]; exact hzT) + have hzx : φ (χ x₀) = z := by rw [hxl, hl₀] + let Y : Set S := φ '' (χ '' Rc) + have hYc : IsClosed Y := ((hRcc.image_of_continuousOn hχ.cont).image hφ).isClosed + have hYM : ∀ q ∈ Y, q ∈ N ∧ q ∉ Cbad := by + rintro _ ⟨_, ⟨w, hw, rfl⟩, rfl⟩ + exact hmap w hw + have hBR : B ⊆ Rc := fun u hu => ⟨Ioo_subset_Icc_self hu.1, Ico_subset_Icc_self hu.2⟩ + let W₀ : Set S := (φ '' (χ '' B)ᶜ)ᶜ + have hW₀ : IsOpen W₀ := (hφ.isClosedMap _ hχ.isOpen.isClosed_compl).isOpen_compl + have hTW : T ⊆ W₀ := by + exact root_set_in_open_neighbourhood (S := S) (S' := S') (φ := φ) (T := T) χ x₁ x₂ δ hχ hA + have hW₀Y : W₀ ⊆ Y := fun q hq => by + obtain ⟨x, rfl⟩ := hsurj q + by_contra hn + refine hq ⟨x, fun hx => hn ?_, rfl⟩ + obtain ⟨u, hu, rfl⟩ := hx + exact ⟨_, ⟨u, hBR hu, rfl⟩, rfl⟩ + have hYU : ∀ q ∈ Y, q ∈ L.U → q ∈ W₀ := fun q hq hU => by + by_cases hqT : q ∈ T + · exact hTW hqT + · exact absurd (Or.inl (Or.inr ⟨hU, hqT⟩)) (hYM q hq).2 + have hzH : ∀ e ∈ H.E, z ∈ closure e → z ∈ H.V := fun e he hz => hH.1 ⟨hzb, H.closure_subset_U he + hz⟩ + -- An edge off `z` misses `Y`. + have hnon : ∀ e ∈ H.E, z ∉ closure e → closure e = Q₂ e := fun e he hz => by + obtain ⟨-, hc, -, -, h0, -⟩ := hQ e he + have h1 : Q₁ e = ∅ := by + by_contra hne + exact hz (hc ▸ .inl (h0 (nonempty_iff_ne_empty.mpr hne))) + rw [hc, h1, empty_union] + have hQY : ∀ e ∈ H.E, Disjoint (Q₂ e) Y := fun e he => by + rw [disjoint_left] + intro q h1 h2 + exact (hYM q h2).2 (.inl (.inl (mem_iUnion₂.mpr ⟨e, he, h1⟩))) + have hstar : ∀ e, e ∈ H.E → z ∈ closure e → ∃ (w : ℂ) (R : Set S) (y : S), closure e ∩ H.V + = {z, y} ∧ w ∈ Rc ∧ w ∉ B ∧ 0 < w.im ∧ φ (χ w) ∉ W₀ ∧ φ (χ w) ∈ closure e ∧ R ⊆ closure e + ∧ closure e \ N ⊆ R ∧ R ∩ Y = {φ (χ w)} ∧ IsClosed R ∧ + IsLineWithEnds (range (fun t => φ (χ (ray x₀ w t))) ∪ R) z y ∧ ∃ κ l : Path z y, + (∀ u, κ u ∈ range (fun t => φ (χ (ray x₀ w t))) ∪ R) ∧ (∀ u, l u ∈ closure e) + ∧ κ.Homotopic l := fun e he hz => by + exact incident_edge_has_rectangular_cut (S := S) (S' := S') (L := L) (φ := φ) hJ (T := T) (z + := z) hzT hzb (H := H) hH (N := N) hfl Q₁ Q₂ hQ χ x₁ x₂ δ hχ x₀ hx₀ hzx hYM + hW₀ hTW hW₀Y hYU hzH hQY e he hz + choose! w R y hP using hstar + let b : Set S → unitInterval → S := fun e t => φ (χ (ray x₀ (w e) t)) + let G : Set S → Set S := fun e => range (b e) + have hrm : ∀ e, e ∈ H.E → z ∈ closure e → ∀ t, ray x₀ (w e) t ∈ Rc := fun e he hz => ray_mem hx₀ + (hP e he hz).2.1 + have hGY : ∀ e, e ∈ H.E → z ∈ closure e → G e ⊆ Y := by + rintro e he hz _ ⟨t, rfl⟩ + exact ⟨_, ⟨_, hrm e he hz t, rfl⟩, rfl⟩ + have him : ∀ e, e ∈ H.E → z ∈ closure e → ∀ t : unitInterval, t ≠ 0 → (ray x₀ (w e) t).im ≠ 0 + := fun e he hz t ht => by + rw [ray_im] + exact mul_ne_zero (fun h => ht (Subtype.ext h)) (hP e he hz).2.2.2.1.ne' + have hoffb : ∀ e, e ∈ H.E → z ∈ closure e → ∀ t : unitInterval, t ≠ 0 → χ (ray x₀ + (w e) t) ∉ bd S' := fun e he hz t ht h => + him e he hz t ht ((hχ.bd _ (hrm e he hz t)).mp h) + have hoffF : ∀ e, e ∈ H.E → z ∈ closure e → ∀ t : unitInterval, t ≠ 0 → b e t ∉ bd S ∪ L.U + := fun e he hz t ht h => + hoffb e he hz t ht ((hFiff _).mp h) + have hb0 : ∀ e, b e 0 = z := fun e => by simp only [b, ray_zero, hzx] + -- Different edges at `z` end at different points of the rectangle. + have hwne : ∀ e, e ∈ H.E → z ∈ closure e → ∀ f, f ∈ H.E → z ∈ closure f → e ≠ f → w e ≠ w f + := fun e he hz f hf hzf hef h => by + exact distinct_incident_edges_have_distinct_cut_points (S := S) (S' := S') (L := L) (φ := φ) + (T := T) (z := z) hzT (H := H) (N := N) Q₂ χ Rc B x₀ hYM W₀ hTW w R y hP e he hz f hf + hzf hef h + have hsame : ∀ e, e ∈ H.E → z ∈ closure e → ∀ f, f ∈ H.E → z ∈ closure f → e ≠ f + → ∀ t t' : unitInterval, t ≠ 0 → t' ≠ 0 → b e t ≠ b f t' := by + exact distinct_rerouting_rays_avoid_each_other (S := S) (S' := S') (L := L) (φ := φ) hJ (z := + z) (H := H) (N := N) χ x₁ x₂ δ hχ x₀ hx₀ Y W₀ w R y hP hrm hoffb hwne + have hRY : ∀ e, e ∈ H.E → z ∈ closure e → ∀ q ∈ R e, q ∈ Y → q = b e 1 := fun e he hz q h1 h2 + => by + have h3 : q ∈ R e ∩ Y := ⟨h1, h2⟩ + rw [(hP e he hz).2.2.2.2.2.2.2.2.1] at h3 + have : b e 1 = φ (χ (w e)) := by simp only [b, ray_one] + rw [this] + exact h3 + let M : Set S → Set S := fun e => if z ∈ closure e then G e ∪ R e else closure e + have hMs : ∀ e, z ∈ closure e → M e = G e ∪ R e := fun e h => ite_eq_left h + have hMn : ∀ e, z ∉ closure e → M e = closure e := fun e h => ite_eq_right h + have hRc' : ∀ e, e ∈ H.E → z ∈ closure e → R e ⊆ closure e := fun e he hz => + (hP e he hz).2.2.2.2.2.2.1 + have hoffY : ∀ e, e ∈ H.E → z ∉ closure e → ∀ q ∈ closure e, q ∉ Y := fun e he hz q hq hY => by + rw [hnon e he hz] at hq + exact disjoint_left.mp (hQY e he) hq hY + have hmeet₁ : ∀ e, e ∈ H.E → z ∈ closure e → ∀ f, f ∈ H.E → z ∈ closure f → e ≠ f + → M e ∩ M f ⊆ H.V := fun e he hz f hf hzf hef q hq => by + exact rerouted_incident_edges_inter_only_at_vertices (S := S) (z := z) (H := H) Y hzH R b + hGY hb0 hsame hRY M hMs hRc' e he hz f hf hzf hef q hq + have hmeet₂ : ∀ e, e ∈ H.E → z ∈ closure e → ∀ f, f ∈ H.E → z ∉ closure f → e ≠ f + → M e ∩ M f ⊆ H.V := fun e he hz f hf hzf hef q hq => by + exact rerouted_and_unmoved_edges_inter_only_at_vertices (S := S) (z := z) (H := H) Y R G hGY M + hMs hMn hRc' hoffY e he hz f hf hzf hef q hq + obtain ⟨P, hPV, hPU, hPf, hPh, hPe, -⟩ := exists_reroute hH M (fun e a c hl => by + by_cases hz : z ∈ closure e + · have hp := hP e hl.1 hz + generalize y e hl.1 hz = y' at hp + rw [hMs e hz] + have h1 : ({a, c} : Set S) = {z, y'} := hl.2.2.2.symm.trans hp.1 + have hline := hp.2.2.2.2.2.2.2.2.2.2.1 + rcases pair_eq_pair_iff.mp h1 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hline + · exact hline.symm + · rw [hMn e hz] + obtain ⟨u, v, -, hcap, hline⟩ := edge_line_of_forest hH.2 hl.1 + have h1 := hl.2.2.2 + rw [hcap] at h1 + rcases pair_eq_pair_iff.mp h1 with ⟨h2, h3⟩ | ⟨h2, h3⟩ + · rw [← h2, ← h3] + exact hline + · rw [← h2, ← h3] + exact hline.symm) (fun e he q hq => by + by_cases hz : z ∈ closure e + · rw [hMs e hz] at hq + rcases hq.1 with h1 | h1 + · by_cases hqz : q = z + · rw [hqz] + exact hz + · exact absurd (Or.inr ⟨hq.2, hqz⟩) (hYM q (hGY e he hz h1)).2 + · exact hRc' e he hz h1 + · rw [hMn e hz] at hq + exact hq.1) (fun e he f hf hef => by + by_cases hz : z ∈ closure e + · by_cases hzf : z ∈ closure f + · exact hmeet₁ e he hz f hf hzf hef + · exact hmeet₂ e he hz f hf hzf hef + · by_cases hzf : z ∈ closure f + · rw [inter_comm] + exact hmeet₂ f hf hzf e he hz hef.symm + · rw [hMn e hz, hMn f hzf] + exact closure_inter_closure_subset he hf hef) (fun e he q hq => by + by_cases hz : z ∈ closure e + · rw [hMs e hz] at hq + rcases hq.1 with ⟨t, rfl⟩ | h1 + · by_cases ht : t = 0 + · rw [ht, hb0] + exact hzH e he hz + · exact absurd (Or.inl hq.2) (hoffF e he hz t ht) + · exact hH.1 ⟨hq.2, H.closure_subset_U he (hRc' e he hz h1)⟩ + · rw [hMn e hz] at hq + exact hH.1 ⟨hq.2, H.closure_subset_U he hq.1⟩) (fun e a c hl => by + by_cases hz : z ∈ closure e + · have hp := hP e hl.1 hz + generalize y e hl.1 hz = y' at hp + rw [hMs e hz] + obtain ⟨κ, l, h1, h2, h3⟩ := hp.2.2.2.2.2.2.2.2.2.2.2 + have h4 : ({a, c} : Set S) = {z, y'} := hl.2.2.2.symm.trans hp.1 + rcases pair_eq_pair_iff.mp h4 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨κ, l, h1, h2, h3⟩ + · refine ⟨κ.symm, l.symm, fun u => ?_, fun u => ?_, h3.symm₂⟩ + · exact h1 _ + · exact h2 _ + · rw [hMn e hz] + obtain ⟨u, v, -, hcap, hline⟩ := edge_line_of_forest hH.2 hl.1 + have h1 := hl.2.2.2 + rw [hcap] at h1 + have hline' : IsLineWithEnds (closure e) a c := by + rcases pair_eq_pair_iff.mp h1 with ⟨h2, h3⟩ | ⟨h2, h3⟩ + · rw [← h2, ← h3] + exact hline + · rw [← h2, ← h3] + exact hline.symm + obtain ⟨p, hp⟩ := exists_path_of_line hline' + exact ⟨p, p, hp, hp, Path.Homotopic.refl _⟩) + have hYN : Y ⊆ N := fun q hq => (hYM q hq).1 + have hMY : ∀ e ∈ H.E, M e ⊆ closure e ∪ Y := fun e he q hq => by + exact rerouted_edge_subset_original_union_chart (S := S) (z := z) (H := H) Y R G hGY M hMs hMn + hRc' e he q hq + exact assemble_forest_root_step (S := S) (S' := S') (L := L) (φ := φ) hJ (T := T) hTU (z := z) + hzT hzb (l₀ := l₀) (H := H) (N := N) hV hφ hFiff hEfin Q₁ Q₂ hQ χ x₁ x₂ δ hχ B x₀ hxl Y + hYc W₀ hTW hW₀Y hzH hnon w R y hP hrm hoffb hoffF hb0 hRY M hMs hMn P hPV hPU hPf hPh + hPe hYN hMY + + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM07/Whisker.lean b/LeanPool/GraphMinor/GM07/Whisker.lean new file mode 100644 index 0000000000..2e35f36628 --- /dev/null +++ b/LeanPool/GraphMinor/GM07/Whisker.lean @@ -0,0 +1,226 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.DiscPrune +import LeanPool.GraphMinor.GM11.Ties + +/-! +# Adding a line to a set that surrounds a cuff + +An `O`-arc of `X ∪ L`, where the line `L` meets `X` in one point, lies in `X`. So adding `L` to `X` +keeps `X` planar in each capped +surface, and a set that surrounds a cuff still surrounds it. The paper uses this without comment in +the proof of (7.3), when it says +that regions lie in `𝒜_{r-1}(C)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM07 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +local notation "𝕀" => unitInterval + +variable {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] + +/-- An `O`-arc in `X ∪ L` lies in `X`, when the line `L` meets the closed set `X` in at most one +point. -/ +theorem oArc_subset_of_whisker [T2Space S] {X L F : Set S} {x y : S} (hX : IsClosed X) + (hxX : x ∈ X) (hL : IsLineWithEnds L x y) + (hLX : L ∩ X ⊆ {x}) (hF : IsOArc F) (hs : F ⊆ X ∪ L) : F ⊆ X := by + intro z hz + by_contra hzX + have hLc : IsClosed L := by + obtain ⟨f, -, -⟩ := id hL + have h3 := isCompact_range (continuous_subtype_val.comp f.continuous) + rw [range_comp, f.surjective.range_eq, image_univ, Subtype.range_coe] at h3 + exact h3.isClosed + have hzL : z ∈ L := (hs hz).resolve_left hzX + have hnot : ¬ F ⊆ L := fun h => by + obtain ⟨f, -, -⟩ := id hL + exact not_isOArc_of_subset_line (L := L) ⟨f⟩ hF h + obtain ⟨w, hwF, hwL⟩ := not_subset.mp hnot + have hwX : w ∈ X := (hs hwF).resolve_right hwL + have hzw : z ≠ w := fun h => hzX (h ▸ hwX) + obtain ⟨A, B, hA, hB, hu, hi⟩ := hF.lines hz hwF hzw + have key : ∀ {A : Set S} {e₁ e₂ : S}, IsLineWithEnds A e₁ e₂ → e₁ = z → e₂ = w → A ⊆ F → x ∈ A + := by + intro A e₁ e₂ hA h1 h2 hAF + obtain ⟨f, h0, h1'⟩ := id hA + have hp : IsPreconnected A := by + have h3 := isPreconnected_range (continuous_subtype_val.comp f.continuous) + rwa [range_comp, f.surjective.range_eq, image_univ, Subtype.range_coe] at h3 + have hz' : z ∈ A := by + rw [← h1, ← h0] + exact (f 0).2 + have hw' : w ∈ A := by + rw [← h2, ← h1'] + exact (f 1).2 + obtain ⟨p, hpA, hpX, hpL⟩ := isPreconnected_closed_iff.mp hp X L hX hLc + (hAF.trans hs) ⟨w, hw', hwX⟩ ⟨z, hz', hzL⟩ + have : p = x := hLX ⟨hpL, hpX⟩ + exact this ▸ hpA + have h1 := key hA rfl rfl (hu ▸ subset_union_left) + have h2 := key hB rfl rfl (hu ▸ subset_union_right) + have h3 : x ∈ A ∩ B := ⟨h1, h2⟩ + rw [hi] at h3 + have hxL : x ∈ L := by + obtain ⟨f, h0, -⟩ := id hL + rw [← h0] + exact (f 0).2 + rcases h3 with rfl | rfl + · exact hzX hxX + · exact hwL hxL + +/-- Adding a line to a solid set that is planar in a capped surface keeps it planar there. -/ +theorem isPlanar_whisker (hS : IsSurface S) [ConnectedSpace S] {C X L : Set S} {x y : S} {j : S + → T} {D : Set T} + (hc : IsCappedCuff C T j D) (hX : IsSolid X) (hxX : x ∈ X) (hL : IsLineWithEnds L x y) + (hLX : L ∩ X ⊆ {x}) + (hp : IsPlanar (j '' X)) : IsPlanar (j '' (X ∪ L)) := by + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have : T2Space T := hc.isSurface.2.1 + have : ConnectedSpace T := hc.connectedSpace hS + have hsol : IsSolid (X ∪ L) := theorem_11_6_proof hS hX (isSolid_of_isLineWithEnds hS hL) + have hsolj : IsSolid (j '' (X ∪ L)) := isSolid_image_of_injOn hc.isEmbedding.continuous hsol + hc.isEmbedding.injective.injOn + refine (theorem_5_1_of_not_isSphere hc.isSurface (.inr (hc.image_ne_univ _)) hsolj).mpr fun F hF + hFs => ?_ + have hsubr : F ⊆ range j := hFs.trans (image_subset_range _ _) + have hF' : IsOArc (j ⁻¹' F) := IsOArc.pull_of_embedding hc.isEmbedding hF hsubr + have hs' : j ⁻¹' F ⊆ X ∪ L := fun z hz => by + obtain ⟨w, hw, he⟩ := hFs hz + rwa [← hc.isEmbedding.injective he] + have h1 := oArc_subset_of_whisker hX.2 hxX hL hLX hF' hs' + refine IsPlanar.mono hp fun z hz => ?_ + obtain ⟨w, rfl⟩ := hsubr hz + exact mem_image_of_mem j (h1 hz) + +/-- Adding a line to a set that surrounds a cuff keeps this. -/ +theorem surroundsCuff_whisker (hS : IsSurface S) [ConnectedSpace S] {C X L : Set S} {x y : S} + (hX : IsSolid X) (hxX : x ∈ X) + (hL : IsLineWithEnds L x y) (hLX : L ∩ X ⊆ {x}) (hs : SurroundsCuff X C) : SurroundsCuff + (X ∪ L) C := by + obtain ⟨hC, ⟨hc', ⟨T, tT, j, D, hc, hp⟩, -⟩, hn⟩ := hs + exact ⟨hC, isPlanarInCappedCuff_of_cap hS hc (isPlanar_whisker hS hc hX hxX hL hLX hp), + fun h => hn (IsPlanar.mono h subset_union_left)⟩ + +/-- Adding a line to a member of `𝒜_r(C)`. -/ +theorem IsScriptASet.whisker (hS : IsSurface S) [ConnectedSpace S] {G : Drawing S} {r r' : ℕ} {C X + L : Set S} {x y : S} + (hX : IsScriptASet G r C X) (hxX : x ∈ X) (hL : IsLineWithEnds L x y) (hLX : L ∩ X ⊆ {x}) + (hn : G.IsNormal L) + (hc : (G.V ∩ (X ∪ L)).ncard ≤ r') : IsScriptASet G r' C (X ∪ L) := by + obtain ⟨h1, h2, h3, h4, -⟩ := hX + have hLc : IsPreconnected L := by + obtain ⟨f, -, -⟩ := id hL + have h3 := isPreconnected_range (continuous_subtype_val.comp f.continuous) + rwa [range_comp, f.surjective.range_eq, image_univ, Subtype.range_coe] at h3 + have hxL : x ∈ L := by + obtain ⟨f, h0, -⟩ := id hL + rw [← h0] + exact (f 0).2 + refine ⟨theorem_11_6_proof hS h1 (isSolid_of_isLineWithEnds hS hL), + ⟨h2.1.mono subset_union_left, h2.2.union x hxX hxL hLc⟩, ?_, + surroundsCuff_whisker hS h1 hxX hL hLX h4, hc⟩ + rintro z ⟨hz | hz, hU⟩ + · exact h3 ⟨hz, hU⟩ + · exact hn ⟨hz, hU⟩ + +/-- A path from a closed set to a point off it gives a line from the closed set that meets it once. +-/ +theorem exists_whisker_line [T2Space S] {X Z : Set S} {x₀ y : S} (hX : IsClosed X) (hx₀ : x₀ ∈ X) + (hy : y ∉ X) + (hj : JoinedIn Z x₀ y) : + ∃ x ∈ X, ∃ L, L ⊆ Z ∧ IsLineWithEnds L x y ∧ L ∩ X ⊆ {x} := by + obtain ⟨γ, hγ⟩ := hj + have hT : IsCompact (γ ⁻¹' X) := (hX.preimage γ.continuous).isCompact + have hne : (γ ⁻¹' X).Nonempty := ⟨0, by simpa using hx₀⟩ + obtain ⟨t, ht, hmax⟩ := hT.exists_isMaxOn hne continuous_id.continuousOn + have hmax' : ∀ s, γ s ∈ X → s ≤ t := fun s hs => hmax hs + have ht1 : t ≠ 1 := fun h => hy (by + have := ht + rw [h] at this + simpa using this) + let σ : ℝ → S := fun u => γ (Set.projIcc 0 1 zero_le_one ((1 - u) * t + u)) + have hσ0 : σ 0 = γ t := by simp [σ] + have hσ1 : σ 1 = y := by simp [σ] + have hmem : ∀ u ∈ Icc (0 : ℝ) 1, (1 - u) * t + u ∈ Icc (0 : ℝ) 1 := fun u hu => by + have h1 := t.2 + constructor <;> nlinarith [hu.1, hu.2, h1.1, h1.2] + have hjoin : JoinedIn (Z ∩ (Xᶜ ∪ {γ t})) (γ t) y := by + refine JoinedIn.ofLine (f := σ) (by + exact (γ.continuous.comp (by fun_prop)).continuousOn) hσ0 hσ1 ?_ + rintro _ ⟨u, hu, rfl⟩ + refine ⟨hγ _, ?_⟩ + by_cases hx : σ u ∈ X + · refine .inr ?_ + have h1 := hmax' _ hx + have h2 : ((1 - u) * t + u) ≤ t := by + have : ((Set.projIcc 0 1 zero_le_one ((1 - u) * t + u) : 𝕀) : ℝ) ≤ t := h1 + rwa [Set.projIcc_of_mem zero_le_one (hmem u hu)] at this + have h3 : (t : ℝ) ≤ (1 - u) * t + u := by nlinarith [hu.1, t.2.2] + have h4 : Set.projIcc 0 1 zero_le_one ((1 - u) * t + u) = t := by + apply Subtype.ext + rw [Set.projIcc_of_mem zero_le_one (hmem u hu)] + exact le_antisymm h2 h3 + change γ _ = γ t + rw [h4] + · exact .inl hx + have hne' : γ t ≠ y := fun h => hy (h ▸ ht) + have hA : γ t ∈ Z ∩ (Xᶜ ∪ {γ t}) := ⟨hγ _, .inr rfl⟩ + have hB : y ∈ Z ∩ (Xᶜ ∪ {γ t}) := ⟨by simpa using hγ 1, .inl hy⟩ + rcases (joinedIn_iff_eq_or_exists_isLineWithEnds hA hB).mp hjoin with h | ⟨L, hLs, hl⟩ + · exact absurd h hne' + · refine ⟨γ t, ht, L, fun z hz => (hLs hz).1, hl, ?_⟩ + rintro z ⟨hzL, hzX⟩ + exact (hLs hzL).2.resolve_left fun h => h hzX + +/-- A region that meets `𝒜_r(C)` lies in it. -/ +theorem region_subset_scriptA (hS : IsSurface S) [ConnectedSpace S] {G : Drawing S} {r : ℕ} {C ρ : + Set S} (hρ : ρ ∈ G.R) + (hm : (ρ ∩ scriptA G r C).Nonempty) : ρ ⊆ scriptA G r C := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := hS.locallyConnected + obtain ⟨x, hxρ, X, hX, hxX⟩ := hm + intro y hy + by_cases hyX : y ∈ X + · exact ⟨X, hX, hyX⟩ + have harc : IsArcConnected ρ := + isArcConnected_of_isOpen_of_isConnected hS (region_isOpen hρ) ⟨region_nonempty hρ, + region_isPreconnected hρ⟩ + obtain ⟨x₁, hx₁, L, hL, hl, hLX⟩ := exists_whisker_line hX.1.2 hxX hyX + (isArcConnected_iff_joinedIn.mp harc x hxρ y hy) + have hoff : ∀ z ∈ L, z ∉ G.U := fun z hz hU => by + obtain ⟨w, -, hw⟩ := hρ + have h1 := connectedComponentIn_subset _ _ (hw ▸ hL hz) + exact h1.2 hU + have hcard : G.V ∩ (X ∪ L) = G.V ∩ X := by + ext z + refine ⟨?_, fun h => ⟨h.1, .inl h.2⟩⟩ + rintro ⟨hzV, hz | hz⟩ + · exact ⟨hzV, hz⟩ + · exact absurd (G.V_subset_U hzV) (hoff z hz) + have hs : IsScriptASet G r C (X ∪ L) := + IsScriptASet.whisker hS hX hx₁ hl hLX (fun z hz => absurd hz.2 (hoff z hz.1)) + (by + rw [hcard] + exact hX.2.2.2.2) + have hyL : y ∈ L := by + obtain ⟨f, -, h1⟩ := id hl + rw [← h1] + exact (f 1).2 + exact ⟨X ∪ L, hs, .inr hyL⟩ + +end GraphMinor.GM07 diff --git a/LeanPool/GraphMinor/GM09/ArcSides.lean b/LeanPool/GraphMinor/GM09/ArcSides.lean new file mode 100644 index 0000000000..d2ff00959a --- /dev/null +++ b/LeanPool/GraphMinor/GM09/ArcSides.lean @@ -0,0 +1,785 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscUnion +public import LeanPool.GraphMinor.Surface.PlaneDisc +public import LeanPool.GraphMinor.Surface.TriPath +public import LeanPool.GraphMinor.Surface.DiscFan +public import LeanPool.GraphMinor.Surface.ChartCells +public import LeanPool.GraphMinor.Surface.ArcTools +public import LeanPool.GraphMinor.Surface.SurfaceGraph +public import LeanPool.GraphMinor.GM11.Fan + +/-! +# The two sides of an arc in a closed disc + +Let `Q` be an arc in a closed disc `Δ` with ends on `bd(Δ)`. Unlike a cross-cut, `Q` may meet +`bd(Δ)` at other points, and it may even run along `bd(Δ)`. This happens in Graph Minors IX, (10.2), +since a path of a weakly-linked set may pass through vertices of `ΩBar`. + +The ends cut `bd(Δ)` into two open arcs `I₁, I₂`. We show that `Δ - Q` falls into two parts `Y₁, Y₂` +with no connected set meeting both, with `I₁ - Q ⊆ Y₁` and `I₂ - Q ⊆ Y₂` (`IsArcSides`). To prove +this we place `Δ` in the plane as the disc of radius `1/2`, and extend `Q` by two radial segments to +the circle of radius `1`. Then `Q` becomes a true cross-cut of the unit disc. + +`exists_hole_sides` is the case that we need in (10.2). A closed disc `D ⊆ Δ` has boundary `A ∪ A'`, +and two arcs `R ∪ A` and `R ∪ A'` have the same ends on `bd(Δ)`. Exactly one of `A, A'` has `D` on +the side of `I₂`. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Metric GraphMinor GraphMinor.Surface + +universe u + +/-- The radial segment from `p` to `2 p`. -/ +def outerSeg (p : ℂ) : Set ℂ := {z | ∃ t ∈ Icc (1 : ℝ) 2, z = (t : ℂ) * p} + +theorem isLineWithEnds_outerSeg {p : ℂ} (hp : p ≠ 0) : IsLineWithEnds (outerSeg p) p (2 * p) := by + let f : C(unitInterval, ℂ) := ⟨fun t => ((1 + (t : ℝ) : ℝ) : ℂ) * p, by fun_prop⟩ + have hinj : Injective f := by + intro s t hst + have h : ((1 + (s : ℝ) : ℝ) : ℂ) * p = ((1 + (t : ℝ) : ℝ) : ℂ) * p := hst + have h' := mul_right_cancel₀ hp h + have h'' : (1 + (s : ℝ) : ℝ) = 1 + (t : ℝ) := by exact_mod_cast h' + exact Subtype.ext (by linarith) + have hl := GraphMinor.GM11.isLineWithEnds_range f hinj + have hr : range f = outerSeg p := by + ext z + constructor + · rintro ⟨t, rfl⟩ + exact ⟨1 + (t : ℝ), ⟨by linarith [t.2.1], by linarith [t.2.2]⟩, rfl⟩ + · rintro ⟨t, ⟨h1, h2⟩, rfl⟩ + refine ⟨⟨t - 1, by linarith, by linarith⟩, ?_⟩ + change ((1 + (t - 1) : ℝ) : ℂ) * p = _ + congr 2 + ring + rw [hr] at hl + have h0 : f 0 = p := by + change ((1 + ((0 : unitInterval) : ℝ) : ℝ) : ℂ) * p = p + simp + have h1 : f 1 = 2 * p := by + change ((1 + ((1 : unitInterval) : ℝ) : ℝ) : ℂ) * p = 2 * p + norm_num + rwa [h0, h1] at hl + +theorem norm_of_mem_outerSeg {p z : ℂ} (hp : ‖p‖ = 1 / 2) (hz : z ∈ outerSeg p) : + 1 / 2 ≤ ‖z‖ ∧ ‖z‖ ≤ 1 := by + obtain ⟨t, ⟨h1, h2⟩, rfl⟩ := hz + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (by linarith), hp] + constructor <;> linarith + +theorem eq_of_mem_outerSeg_of_norm_le {p z : ℂ} (hp : ‖p‖ = 1 / 2) (hz : z ∈ outerSeg p) + (hn : ‖z‖ ≤ 1 / 2) : z = p := by + obtain ⟨t, ⟨h1, h2⟩, rfl⟩ := hz + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (by linarith), hp] at hn + have : t = 1 := by linarith + simp [this] + +theorem eq_of_mem_outerSeg_of_norm_eq {p z : ℂ} (hp : ‖p‖ = 1 / 2) (hz : z ∈ outerSeg p) + (hn : ‖z‖ = 1) : z = 2 * p := by + obtain ⟨t, ⟨h1, h2⟩, rfl⟩ := hz + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (by linarith), hp] at hn + have : t = 2 := by linarith + simp [this] + +theorem disjoint_outerSeg {p q : ℂ} (hp : ‖p‖ = 1 / 2) (hq : ‖q‖ = 1 / 2) (hpq : p ≠ q) : + Disjoint (outerSeg p) (outerSeg q) := by + rw [Set.disjoint_left] + rintro z ⟨t, ⟨h1, h2⟩, rfl⟩ ⟨s, ⟨h3, h4⟩, hs⟩ + have hn := congrArg norm hs + rw [norm_mul, norm_mul, Complex.norm_real, Complex.norm_real, Real.norm_eq_abs, Real.norm_eq_abs, + abs_of_nonneg (by linarith), abs_of_nonneg (by linarith), hp, hq] at hn + have hts : t = s := by linarith + subst hts + have ht0 : (t : ℂ) ≠ 0 := by + have : t ≠ 0 := by linarith + exact_mod_cast this + exact hpq (mul_left_cancel₀ ht0 hs) + +/-- `Q` extended by the radial segments at its ends. -/ +def extArc (p q : ℂ) (Q : Set ℂ) : Set ℂ := outerSeg p ∪ Q ∪ outerSeg q + +theorem isLineWithEnds_extArc {p q : ℂ} {Q : Set ℂ} (hQ : IsLineWithEnds Q p q) + (hQb : Q ⊆ closedBall 0 (1 / 2)) (hp : ‖p‖ = 1 / 2) (hq : ‖q‖ = 1 / 2) (hpq : p ≠ q) : + IsLineWithEnds (extArc p q Q) (2 * p) (2 * q) := by + have np : p ≠ 0 := by + intro h + rw [h, norm_zero] at hp + norm_num at hp + have nq : q ≠ 0 := by + intro h + rw [h, norm_zero] at hq + norm_num at hq + have h1 : outerSeg p ∩ Q = {p} := by + ext z + constructor + · rintro ⟨hz, hzQ⟩ + exact eq_of_mem_outerSeg_of_norm_le hp hz (by simpa using hQb hzQ) + · rintro rfl + exact ⟨(isLineWithEnds_outerSeg np).left_mem, hQ.left_mem⟩ + have h2 : (outerSeg p ∪ Q) ∩ outerSeg q = {q} := by + ext z + constructor + · rintro ⟨hz | hz, hzq⟩ + · exact (Set.disjoint_left.mp (disjoint_outerSeg hp hq hpq) hz hzq).elim + · exact eq_of_mem_outerSeg_of_norm_le hq hzq (by simpa using hQb hz) + · rintro rfl + exact ⟨Or.inr hQ.right_mem, (isLineWithEnds_outerSeg nq).left_mem⟩ + exact (((isLineWithEnds_outerSeg np).symm.union hQ h1).union (isLineWithEnds_outerSeg nq) h2) + +theorem extArc_inter_sphere {p q : ℂ} {Q : Set ℂ} (hQ : IsLineWithEnds Q p q) + (hQb : Q ⊆ closedBall 0 (1 / 2)) (hp : ‖p‖ = 1 / 2) (hq : ‖q‖ = 1 / 2) (hpq : p ≠ q) : + extArc p q Q ∩ sphere 0 1 = {2 * p, 2 * q} := by + have hl := isLineWithEnds_extArc hQ hQb hp hq hpq + ext z + simp only [mem_inter_iff, mem_sphere_zero_iff_norm, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨(hz | hz) | hz, hn⟩ + · exact Or.inl (eq_of_mem_outerSeg_of_norm_eq hp hz hn) + · have := hQb hz + simp only [mem_closedBall_zero_iff] at this + norm_num [hn] at this + · exact Or.inr (eq_of_mem_outerSeg_of_norm_eq hq hz hn) + · rintro (rfl | rfl) + · refine ⟨hl.left_mem, ?_⟩ + rw [norm_mul, hp] + norm_num + · refine ⟨hl.right_mem, ?_⟩ + rw [norm_mul, hq] + norm_num + +theorem extArc_subset_closedBall {p q : ℂ} {Q : Set ℂ} (hQb : Q ⊆ closedBall 0 (1 / 2)) + (hp : ‖p‖ = 1 / 2) (hq : ‖q‖ = 1 / 2) : extArc p q Q ⊆ closedBall 0 1 := by + rintro z ((hz | hz) | hz) + · exact mem_closedBall_zero_iff.mpr (norm_of_mem_outerSeg hp hz).2 + · have := hQb hz + simp only [mem_closedBall_zero_iff] at this ⊢ + linarith + · exact mem_closedBall_zero_iff.mpr (norm_of_mem_outerSeg hq hz).2 + +/-- The discs into which the extended arc cuts the unit disc. `T₁, T₂` are the two open arcs of the +unit circle. -/ +structure IsExtSplit (F T₁ T₂ E₁ E₂ : Set ℂ) : Prop where + disc₁ : IsClosedDisc E₁ + disc₂ : IsClosedDisc E₂ + cover : E₁ ∪ E₂ = closedBall 0 1 + inter : E₁ ∩ E₂ = F + bd₁ : discBd E₁ = T₁ ∪ F + bd₂ : discBd E₂ = T₂ ∪ F + conn : ∀ Z : Set ℂ, Z ⊆ closedBall 0 1 \ F → IsPreconnected Z → Z ⊆ E₁ ∨ Z ⊆ E₂ + +theorem IsExtSplit.symm {F T₁ T₂ E₁ E₂ : Set ℂ} (h : IsExtSplit F T₁ T₂ E₁ E₂) : + IsExtSplit F T₂ T₁ E₂ E₁ where + disc₁ := h.disc₂ + disc₂ := h.disc₁ + cover := by rw [Set.union_comm]; exact h.cover + inter := by rw [Set.inter_comm]; exact h.inter + bd₁ := h.bd₂ + bd₂ := h.bd₁ + conn := fun Z hZ hp => (h.conn Z hZ hp).symm + +theorem exists_isExtSplit {F : Set ℂ} {s t : ℂ} (hF : IsLineWithEnds F s t) + (hFb : F ⊆ closedBall 0 1) (hcap : F ∩ sphere 0 1 = {s, t}) (hst : s ≠ t) {T₁ T₂ : Set ℂ} + (hT₁ : IsPreconnected T₁) (hT₂ : IsPreconnected T₂) (hd : Disjoint T₁ T₂) + (hu : T₁ ∪ T₂ = sphere 0 1 \ {s, t}) : + ∃ E₁ E₂, IsExtSplit F T₁ T₂ E₁ E₂ := by + obtain ⟨hdisc, hbd⟩ := isClosedDisc_closedBall + obtain ⟨A₁, A₂, Δ₁, Δ₂, hne, hcomp, h₁, h₂, hU, hI, hb₁, hb₂, hcomp'⟩ := + disc_iArc (closedBall 0 1) F s t hdisc hFb hst hF (by rw [hbd]; exact hcap) + rw [hbd] at hcomp + set X := sphere (0 : ℂ) 1 \ {s, t} with hX + have hmem : ∀ C ∈ componentsIn X, C ⊆ X ∧ C.Nonempty ∧ ∀ Z : Set ℂ, Z ⊆ X → IsPreconnected Z → + (Z ∩ C).Nonempty → Z ⊆ C := by + rintro _ ⟨x, hx, rfl⟩ + refine ⟨connectedComponentIn_subset _ _, ⟨x, mem_connectedComponentIn hx⟩, ?_⟩ + rintro Z hZ hc ⟨z, hzZ, hzC⟩ + rw [connectedComponentIn_eq hzC] + exact hc.subset_connectedComponentIn hzZ hZ + have m₁ : A₁ ∈ componentsIn X := by rw [hcomp]; exact Or.inl rfl + have m₂ : A₂ ∈ componentsIn X := by rw [hcomp]; exact Or.inr rfl + have dA : Disjoint A₁ A₂ := by + rw [Set.disjoint_left] + intro x hx₁ hx₂ + apply hne + obtain ⟨u, hu', rfl⟩ := m₁ + obtain ⟨v, hv', rfl⟩ := m₂ + rw [connectedComponentIn_eq hx₁, connectedComponentIn_eq hx₂] + have cA : A₁ ∪ A₂ = X := by + apply Subset.antisymm (union_subset (hmem _ m₁).1 (hmem _ m₂).1) + intro x hx + have : connectedComponentIn X x ∈ ({A₁, A₂} : Set (Set ℂ)) := hcomp ▸ ⟨x, hx, rfl⟩ + rcases this with h | h + · exact Or.inl (h ▸ mem_connectedComponentIn hx) + · exact Or.inr (h ▸ mem_connectedComponentIn hx) + have hTX₁ : T₁ ⊆ X := hu ▸ subset_union_left + have hTX₂ : T₂ ⊆ X := hu ▸ subset_union_right + have side : ∀ T : Set ℂ, T ⊆ X → IsPreconnected T → T ⊆ A₁ ∨ T ⊆ A₂ := by + intro T hTX hT + by_cases hne₁ : (T ∩ A₁).Nonempty + · exact Or.inl ((hmem _ m₁).2.2 T hTX hT hne₁) + · refine Or.inr fun x hx => ?_ + rcases (cA ▸ hTX hx : x ∈ A₁ ∪ A₂) with h | h + · exact (hne₁ ⟨x, hx, h⟩).elim + · exact h + have hcomp2 : ∀ Z : Set ℂ, Z ⊆ closedBall 0 1 \ F → IsPreconnected Z → Z ⊆ Δ₁ ∨ Z ⊆ Δ₂ := by + intro Z hZ hZc + rcases Z.eq_empty_or_nonempty with rfl | ⟨z, hz⟩ + · exact Or.inl (empty_subset _) + have hz' : connectedComponentIn (closedBall 0 1 \ F) z ∈ + ({Δ₁ \ F, Δ₂ \ F} : Set (Set ℂ)) := hcomp' ▸ ⟨z, hZ hz, rfl⟩ + have hsub : Z ⊆ connectedComponentIn (closedBall 0 1 \ F) z := + hZc.subset_connectedComponentIn hz hZ + rcases hz' with h | h + · exact Or.inl fun x hx => (h ▸ hsub hx : x ∈ Δ₁ \ F).1 + · exact Or.inr fun x hx => (h ▸ hsub hx : x ∈ Δ₂ \ F).1 + have dT : ∀ x, x ∈ T₁ → x ∈ T₂ → False := fun x h h' => Set.disjoint_left.mp hd h h' + rcases side T₁ hTX₁ hT₁ with h₁₁ | h₁₂ + · rcases side T₂ hTX₂ hT₂ with h₂₁ | h₂₂ + · obtain ⟨x, hx⟩ := (hmem _ m₂).2.1 + have hxX := (hmem _ m₂).1 hx + rcases (hu ▸ hxX : x ∈ T₁ ∪ T₂) with h | h + · exact (Set.disjoint_left.mp dA (h₁₁ h) hx).elim + · exact (Set.disjoint_left.mp dA (h₂₁ h) hx).elim + · have e₁ : A₁ = T₁ := Subset.antisymm (fun x hx => by + rcases (hu ▸ (hmem _ m₁).1 hx : x ∈ T₁ ∪ T₂) with h | h + · exact h + · exact (Set.disjoint_left.mp dA hx (h₂₂ h)).elim) h₁₁ + have e₂ : A₂ = T₂ := Subset.antisymm (fun x hx => by + rcases (hu ▸ (hmem _ m₂).1 hx : x ∈ T₁ ∪ T₂) with h | h + · exact (Set.disjoint_left.mp dA (h₁₁ h) hx).elim + · exact h) h₂₂ + exact ⟨Δ₁, Δ₂, h₁, h₂, hU, hI, e₁ ▸ hb₁, e₂ ▸ hb₂, hcomp2⟩ + · rcases side T₂ hTX₂ hT₂ with h₂₁ | h₂₂ + · have e₂ : A₂ = T₁ := Subset.antisymm (fun x hx => by + rcases (hu ▸ (hmem _ m₂).1 hx : x ∈ T₁ ∪ T₂) with h | h + · exact h + · exact (Set.disjoint_left.mp dA (h₂₁ h) hx).elim) h₁₂ + have e₁ : A₁ = T₂ := Subset.antisymm (fun x hx => by + rcases (hu ▸ (hmem _ m₁).1 hx : x ∈ T₁ ∪ T₂) with h | h + · exact (Set.disjoint_left.mp dA hx (h₁₂ h)).elim + · exact h) h₂₁ + refine ⟨Δ₂, Δ₁, h₂, h₁, by rw [Set.union_comm]; exact hU, by rw [Set.inter_comm]; exact hI, + e₂ ▸ hb₂, e₁ ▸ hb₁, fun Z hZ hc => (hcomp2 Z hZ hc).symm⟩ + · obtain ⟨x, hx⟩ := (hmem _ m₁).2.1 + have hxX := (hmem _ m₁).1 hx + rcases (hu ▸ hxX : x ∈ T₁ ∪ T₂) with h | h + · exact (Set.disjoint_left.mp dA hx (h₁₂ h)).elim + · exact (Set.disjoint_left.mp dA hx (h₂₂ h)).elim + +theorem IsExtSplit.mem_side {F T₁ T₂ E₁ E₂ Q : Set ℂ} {p q c : ℂ} + (h : IsExtSplit F T₁ T₂ E₁ E₂) (hF : F = extArc p q Q) (hQb : Q ⊆ closedBall 0 (1 / 2)) + (hp : ‖p‖ = 1 / 2) (hq : ‖q‖ = 1 / 2) (hc : ‖c‖ = 1 / 2) (hcp : c ≠ p) (hcq : c ≠ q) + (hcQ : c ∉ Q) (hcT : 2 * c ∈ T₁) (hT : Disjoint T₁ F) : c ∈ E₁ := by + have nc : c ≠ 0 := by + intro h + rw [h, norm_zero] at hc + norm_num at hc + have hl := isLineWithEnds_outerSeg nc + have hZ : outerSeg c ⊆ closedBall 0 1 \ F := by + intro z hz + refine ⟨mem_closedBall_zero_iff.mpr (norm_of_mem_outerSeg hc hz).2, ?_⟩ + rw [hF] + rintro ((h' | h') | h') + · exact Set.disjoint_left.mp (disjoint_outerSeg hc hp hcp) hz h' + · have hn : ‖z‖ ≤ 1 / 2 := by simpa using hQb h' + exact hcQ (eq_of_mem_outerSeg_of_norm_le hc hz hn ▸ h') + · exact Set.disjoint_left.mp (disjoint_outerSeg hc hq hcq) hz h' + have hE₁ : 2 * c ∈ E₁ := by + have : 2 * c ∈ discBd E₁ := h.bd₁ ▸ Or.inl hcT + exact discBd_subset _ this + rcases h.conn _ hZ hl.isPreconnected_self with h' | h' + · exact h' hl.left_mem + · exfalso + have : 2 * c ∈ E₁ ∩ E₂ := ⟨hE₁, h' hl.right_mem⟩ + rw [h.inter] at this + exact Set.disjoint_left.mp hT hcT this + +/-- If `D` lies on the side `E°` of `R ∪ A` and on the side `E°'` of `R ∪ A'`, then the other two +sides share `T` and differ by `D`, which is impossible. -/ +theorem false_of_hole_on_same_side {D A A' Rp T E Eo E' Eo' : Set ℂ} {y y' : ℂ} + (hD : IsClosedDisc D) (hA : IsLineWithEnds A y y') (hbd : discBd D = A ∪ A') + (hAA' : A ∩ A' = {y, y'}) (hRD : Rp ∩ D = {y, y'}) + (hTD : Disjoint T D) + (hE : IsClosedDisc E) (hE' : IsClosedDisc E') + (hI : E ∩ Eo = Rp ∪ A) (hI' : E' ∩ Eo' = Rp ∪ A') + (hb : discBd E = T ∪ (Rp ∪ A)) (hb' : discBd E' = T ∪ (Rp ∪ A')) + (hs : D \ A ⊆ Eo) (hs' : D \ A' ⊆ Eo') : False := by + have hyA : y ∈ A := hA.left_mem + have hyA' : y ∈ A' := (hAA'.symm ▸ (Or.inl rfl : y ∈ ({y, y'} : Set ℂ)) : y ∈ A ∩ A').2 + have hzA' : y' ∈ A' := (hAA'.symm ▸ (Or.inr rfl : y' ∈ ({y, y'} : Set ℂ)) : y' ∈ A ∩ A').2 + have hzA : y' ∈ A := hA.right_mem + have hAD : A ⊆ D := fun x hx => discBd_subset D (hbd ▸ Or.inl hx) + have hA'D : A' ⊆ D := fun x hx => discBd_subset D (hbd ▸ Or.inr hx) + have hRA : ∀ x, x ∈ Rp → x ∈ D → x ∈ A ∧ x ∈ A' := by + intro x h h' + have : x ∈ Rp ∩ D := ⟨h, h'⟩ + rw [hRD] at this + rcases this with rfl | rfl + · exact ⟨hyA, hyA'⟩ + · exact ⟨hzA, hzA'⟩ + have hED : E ∩ D = A := by + apply Subset.antisymm + · rintro x ⟨hxE, hxD⟩ + by_contra hxA + have : x ∈ E ∩ Eo := ⟨hxE, hs ⟨hxD, hxA⟩⟩ + rw [hI] at this + rcases this with h | h + · exact hxA (hRA x h hxD).1 + · exact hxA h + · intro x hx + have : x ∈ E ∩ Eo := hI.symm ▸ Or.inr hx + exact ⟨this.1, hAD hx⟩ + have hAE : A ⊆ discBd E := fun x hx => hb ▸ Or.inr (Or.inr hx) + have hAbd : A ⊆ discBd D := fun x hx => hbd ▸ Or.inl hx + obtain ⟨hU, hbU⟩ := disc_union E D A y y' hE hD hA hED hAE hAbd + have hbU' : discBd (E ∪ D) = T ∪ (Rp ∪ A') := by + rw [hbU, hb, hbd] + ext x + simp only [mem_sdiff, mem_union, mem_insert_iff, mem_singleton_iff, not_and, not_not] + constructor + · rintro ⟨h, h'⟩ + by_cases hxA : x ∈ A + · have := h' hxA + rcases this with rfl | rfl + · exact Or.inr (Or.inr hyA') + · exact Or.inr (Or.inr hzA') + · tauto + · intro h + refine ⟨by tauto, fun hxA => ?_⟩ + rcases h with h | h | h + · exact (Set.disjoint_left.mp hTD h (hAD hxA)).elim + · have : x ∈ Rp ∩ D := ⟨h, hAD hxA⟩ + rw [hRD] at this + exact this + · have : x ∈ A ∩ A' := ⟨hxA, h⟩ + rw [hAA'] at this + exact this + have hG : IsOArc (T ∪ (Rp ∪ A')) := hb' ▸ hE'.isOArc_discBd + have heq : E ∪ D = E' := + (eq_closedInner_of_discBd hG hU hbU').trans (eq_closedInner_of_discBd hG hE' hb').symm + have hsub : D ⊆ A' := by + intro x hxD + by_contra hxA + have : x ∈ E' ∩ Eo' := ⟨heq ▸ Or.inr hxD, hs' ⟨hxD, hxA⟩⟩ + rw [hI'] at this + rcases this with h | h + · exact hxA (hRA x h hxD).2 + · exact hxA h + obtain ⟨x, hx₁, hx₂⟩ : (A \ {y, y'}).Nonempty := hA.nonempty_sdiff + exact hx₂ (hAA' ▸ ⟨hx₁, hsub (hAD hx₁)⟩) + +theorem isPreconnected_disc_sdiff {D A : Set ℂ} (hD : IsClosedDisc D) (hA : A ⊆ discBd D) : + IsPreconnected (D \ A) := by + refine hD.isPreconnected_discInt.subset_closure ?_ ?_ + · rintro x ⟨hx, hxb⟩ + exact ⟨hx, fun h => hxb (hA h)⟩ + · exact sdiff_subset.trans hD.subset_closure_discInt + +/-- The two sides of an arc `Q` in a closed disc `Δ`, where `I₁, I₂` are the open arcs of `bd(Δ)` +between the ends of `Q`. No connected set of `Δ - Q` meets both sides. -/ +structure IsArcSides {S : Type u} [TopologicalSpace S] (Δ Q I₁ I₂ Y₁ Y₂ : Set S) : Prop where + cover : Y₁ ∪ Y₂ = Δ \ Q + disj : Disjoint Y₁ Y₂ + conn : ∀ Z : Set S, Z ⊆ Δ \ Q → IsPreconnected Z → Z ⊆ Y₁ ∨ Z ⊆ Y₂ + left : I₁ \ Q ⊆ Y₁ + right : I₂ \ Q ⊆ Y₂ + +theorem IsLineWithEnds.image_of_injOn {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + [T2Space T] {L : Set S} {u v : S} (hL : IsLineWithEnds L u v) {f : S → T} + (hc : ContinuousOn f L) (hi : InjOn f L) : IsLineWithEnds (f '' L) (f u) (f v) := + hL.image_under_injOn hc hi + +/-- Sides of an arc read off from the sides of its image in the plane. -/ +theorem IsExtSplit.arcSides {S : Type u} [TopologicalSpace S] {Δ Q I₁ I₂ : Set S} {w : S → ℂ} + (hwc : ContinuousOn w Δ) (hwi : InjOn w Δ) (hwn : ∀ x ∈ Δ, ‖w x‖ ≤ 1 / 2) + (hQΔ : Q ⊆ Δ) (hIΔ₁ : I₁ ⊆ Δ) (hIΔ₂ : I₂ ⊆ Δ) + {p q : ℂ} {F T₁ T₂ E₁ E₂ : Set ℂ} (h : IsExtSplit F T₁ T₂ E₁ E₂) + (hF : F = extArc p q (w '' Q)) (hp : p ∈ w '' Q) (hq : q ∈ w '' Q) + (hp1 : ‖p‖ = 1 / 2) (hq1 : ‖q‖ = 1 / 2) + (hl : ∀ x ∈ I₁ \ Q, w x ∈ E₁) (hr : ∀ x ∈ I₂ \ Q, w x ∈ E₂) : + IsArcSides Δ Q I₁ I₂ {x ∈ Δ \ Q | w x ∈ E₁} {x ∈ Δ \ Q | w x ∈ E₂} := by + have hnF : ∀ x ∈ Δ \ Q, w x ∈ closedBall (0 : ℂ) 1 \ F := by + rintro x ⟨hx, hxQ⟩ + have hn := hwn x hx + refine ⟨mem_closedBall_zero_iff.mpr (by linarith), ?_⟩ + have hnQ : w x ∉ w '' Q := by + rintro ⟨y, hy, he⟩ + exact hxQ (hwi (hQΔ hy) hx he ▸ hy) + rw [hF] + rintro ((h' | h') | h') + · exact hnQ (eq_of_mem_outerSeg_of_norm_le hp1 h' hn ▸ hp) + · exact hnQ h' + · exact hnQ (eq_of_mem_outerSeg_of_norm_le hq1 h' hn ▸ hq) + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · apply Subset.antisymm + · rintro _ (⟨hx, _⟩ | ⟨hx, _⟩) <;> exact hx + · intro x hx + have := (hnF x hx).1 + rw [← h.cover] at this + rcases this with h' | h' + · exact Or.inl ⟨hx, h'⟩ + · exact Or.inr ⟨hx, h'⟩ + · rw [Set.disjoint_left] + rintro x ⟨hx, h₁⟩ ⟨-, h₂⟩ + have : w x ∈ E₁ ∩ E₂ := ⟨h₁, h₂⟩ + rw [h.inter] at this + exact (hnF x hx).2 this + · intro Z hZ hc + have hZ' : w '' Z ⊆ closedBall 0 1 \ F := by + rintro _ ⟨x, hx, rfl⟩ + exact hnF x (hZ hx) + rcases h.conn _ hZ' (hc.image _ (hwc.mono fun x hx => (hZ hx).1)) with h' | h' + · exact Or.inl fun x hx => ⟨hZ hx, h' (mem_image_of_mem w hx)⟩ + · exact Or.inr fun x hx => ⟨hZ hx, h' (mem_image_of_mem w hx)⟩ + · intro x hx + exact ⟨⟨hIΔ₁ hx.1, hx.2⟩, hl x hx⟩ + · intro x hx + exact ⟨⟨hIΔ₂ hx.1, hx.2⟩, hr x hx⟩ + +private theorem hole_sides_of_ext_splits {S : Type u} [TopologicalSpace S] + {Δ D R A A' I₁ I₂ : Set S} {a b y y' : S} {w : S → ℂ} {w' : ℂ → S} + (hD : IsClosedDisc D) (hDΔ : D ⊆ Δ) + (hA : IsLineWithEnds A y y') (hbd : discBd D = A ∪ A') (hAA' : A ∩ A' = {y, y'}) + (hRD : R ∩ D = {y, y'}) (hRΔ : R ⊆ Δ) (haR : a ∈ R) (hbR : b ∈ R) + (hwc : ContinuousOn w Δ) (hw'c : ContinuousOn w' (w '' Δ)) (hL : LeftInvOn w' w Δ) + (hwn : ∀ x ∈ Δ, ‖w x‖ ≤ 1 / 2) (hp : ‖w a‖ = 1 / 2) (hq : ‖w b‖ = 1 / 2) + {T₁ T₂ E₁ E₂ E₁' E₂' : Set ℂ} (hTu : T₁ ∪ T₂ = sphere 0 1 \ {2 * w a, 2 * w b}) + (hE : IsExtSplit (extArc (w a) (w b) (w '' (R ∪ A))) T₁ T₂ E₁ E₂) + (hE' : IsExtSplit (extArc (w a) (w b) (w '' (R ∪ A'))) T₁ T₂ E₁' E₂') + (hext : ∀ X : Set S, X ⊆ Δ → extArc (w a) (w b) (w '' (R ∪ X)) = + (outerSeg (w a) ∪ w '' R ∪ outerSeg (w b)) ∪ w '' X) + (sd₁ : IsArcSides Δ (R ∪ A) I₁ I₂ + {x ∈ Δ \ (R ∪ A) | w x ∈ E₁} {x ∈ Δ \ (R ∪ A) | w x ∈ E₂}) + (sd₂ : IsArcSides Δ (R ∪ A') I₁ I₂ + {x ∈ Δ \ (R ∪ A') | w x ∈ E₁'} {x ∈ Δ \ (R ∪ A') | w x ∈ E₂'}) : + ∃ Y₁ Y₂ Y₁' Y₂', IsArcSides Δ (R ∪ A) I₁ I₂ Y₁ Y₂ ∧ IsArcSides Δ (R ∪ A') I₁ I₂ Y₁' Y₂' ∧ + ((D \ A ⊆ Y₂ ∧ D \ A' ⊆ Y₁') ∨ (D \ A ⊆ Y₁ ∧ D \ A' ⊆ Y₂')) := by + let p := w a + let q := w b + have hwi := hL.injOn + have hAD : A ⊆ D := fun _ hx => discBd_subset D (hbd ▸ Or.inl hx) + have hA'D : A' ⊆ D := fun _ hx => discBd_subset D (hbd ▸ Or.inr hx) + obtain ⟨hDM, hDMb⟩ := hD.image (hwc.mono hDΔ) (hw'c.mono (image_mono hDΔ)) (hL.mono hDΔ) + set DM := w '' D + set Rp := outerSeg p ∪ w '' R ∪ outerSeg q + have hyD : y ∈ D := hAD hA.left_mem + have hy'D : y' ∈ D := hAD hA.right_mem + have hDMn : ∀ z ∈ DM, ‖z‖ ≤ 1 / 2 := by + rintro _ ⟨x, hx, rfl⟩ + exact hwn x (hDΔ hx) + have hRDM : Rp ∩ DM = {w y, w y'} := by + have hR' : ∀ u ∈ R, ∀ v ∈ D, w u = w v → u = v := fun u hu v hv e => + hwi (hRΔ hu) (hDΔ hv) e + have hmem : ∀ u, u ∈ R → w u ∈ DM → w u = w y ∨ w u = w y' := by + rintro u hu ⟨v, hv, he⟩ + have huv := hR' u hu v hv he.symm + have : u ∈ R ∩ D := ⟨hu, huv ▸ hv⟩ + rw [hRD] at this + rcases this with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + apply Subset.antisymm + · rintro z ⟨(((h' | ⟨u, hu, rfl⟩) | h')), hz⟩ + · have : z = p := eq_of_mem_outerSeg_of_norm_le hp h' (hDMn z hz) + subst this + exact hmem a haR hz + · exact hmem u hu hz + · have : z = q := eq_of_mem_outerSeg_of_norm_le hq h' (hDMn z hz) + subst this + exact hmem b hbR hz + · rintro z (rfl | rfl) + · have hyR : y ∈ R := ((hRD.symm ▸ (Or.inl rfl : y ∈ ({y, y'} : Set S))) : y ∈ R ∩ D).1 + exact ⟨Or.inl (Or.inr ⟨y, hyR, rfl⟩), y, hyD, rfl⟩ + · have hyR : y' ∈ R := ((hRD.symm ▸ (Or.inr rfl : y' ∈ ({y, y'} : Set S))) : y' ∈ R ∩ D).1 + exact ⟨Or.inl (Or.inr ⟨y', hyR, rfl⟩), y', hy'D, rfl⟩ + have hTD : ∀ T : Set ℂ, T ⊆ sphere 0 1 \ {2 * p, 2 * q} → Disjoint T DM := by + intro T hT + rw [Set.disjoint_left] + intro z hz hzD + have h1 := mem_sphere_zero_iff_norm.mp (hT hz).1 + have h2 := hDMn z hzD + norm_num [h1] at h2 + have hAA'm : w '' A ∩ w '' A' = {w y, w y'} := by + rw [← image_inter_on (fun x hx u hu e => hwi (hDΔ (hA'D hx)) (hDΔ (hAD hu)) e), hAA', + image_pair] + have hbm : discBd DM = w '' A ∪ w '' A' := by rw [hDMb, hbd, image_union] + have hF : extArc p q (w '' (R ∪ A)) = Rp ∪ w '' A := hext A (hAD.trans hDΔ) + have hF' : extArc p q (w '' (R ∪ A')) = Rp ∪ w '' A' := hext A' (hA'D.trans hDΔ) + have hlA : IsLineWithEnds (w '' A) (w y) (w y') := + IsLineWithEnds.image_of_injOn hA (hwc.mono (hAD.trans hDΔ)) (hwi.mono (hAD.trans hDΔ)) + have hsub : ∀ X : Set S, X ⊆ D → (∀ x ∈ D, x ∈ R → x ∈ X) → + ∀ x ∈ D \ X, w x ∈ closedBall (0 : ℂ) 1 \ (Rp ∪ w '' X) := by + rintro X hX hRX x ⟨hx, hxX⟩ + have hn := hwn x (hDΔ hx) + refine ⟨mem_closedBall_zero_iff.mpr (by linarith), ?_⟩ + have hm : w x ∈ DM := mem_image_of_mem w hx + rintro (h' | ⟨u, hu, he⟩) + · have : w x ∈ Rp ∩ DM := ⟨h', hm⟩ + rw [hRDM] at this + have hyX := hRX y hyD ((hRD.symm ▸ (Or.inl rfl : y ∈ ({y, y'} : Set S))) : y ∈ R ∩ D).1 + have hy'X := hRX y' hy'D ((hRD.symm ▸ (Or.inr rfl : y' ∈ ({y, y'} : Set S))) : y' ∈ R ∩ D).1 + rcases this with e | e + · exact hxX (hwi (hDΔ hx) (hDΔ hyD) e ▸ hyX) + · exact hxX (hwi (hDΔ hx) (hDΔ hy'D) e ▸ hy'X) + · exact hxX (hwi (hDΔ (hX hu)) (hDΔ hx) he ▸ hu) + have hRin : ∀ x ∈ D, x ∈ R → x ∈ A ∧ x ∈ A' := by + intro x hx hxR + have : x ∈ R ∩ D := ⟨hxR, hx⟩ + rw [hRD] at this + have e : A ∩ A' ⊇ {y, y'} := hAA'.ge + rcases this with rfl | rfl + · exact e (Or.inl rfl) + · exact e (Or.inr rfl) + have himg : ∀ X : Set S, X ⊆ D → w '' (D \ X) = DM \ w '' X := by + intro X hX + rw [image_sdiff_of_injOn (hwi.mono hDΔ) hX] + have hconn : ∀ X : Set S, X ⊆ discBd D → IsPreconnected (DM \ w '' X) := by + intro X hX + refine isPreconnected_disc_sdiff hDM ?_ + rw [hDMb] + exact image_mono hX + have hXA : A ⊆ discBd D := fun x hx => hbd ▸ Or.inl hx + have hXA' : A' ⊆ discBd D := fun x hx => hbd ▸ Or.inr hx + have side : ∀ (X : Set S) (F E₁ E₂ : Set ℂ) (T₁ T₂ : Set ℂ), X ⊆ discBd D → + (∀ x ∈ D, x ∈ R → x ∈ X) → F = Rp ∪ w '' X → IsExtSplit F T₁ T₂ E₁ E₂ → + (∀ x ∈ D \ X, w x ∈ E₁) ∨ (∀ x ∈ D \ X, w x ∈ E₂) := by + intro X F E₁ E₂ T₁ T₂ hX hRX hFe hS + have hXD : X ⊆ D := hX.trans (discBd_subset D) + have hZ : DM \ w '' X ⊆ closedBall 0 1 \ F := by + rw [hFe, ← himg X hXD] + rintro _ ⟨x, hx, rfl⟩ + exact hsub X hXD hRX x hx + rcases hS.conn _ hZ (hconn X hX) with h' | h' + · exact Or.inl fun x hx => h' (himg X hXD ▸ mem_image_of_mem w hx) + · exact Or.inr fun x hx => h' (himg X hXD ▸ mem_image_of_mem w hx) + rcases side A _ E₁ E₂ T₁ T₂ hXA (fun x h h' => (hRin x h h').1) hF hE with hs | hs <;> + rcases side A' _ E₁' E₂' T₁ T₂ hXA' (fun x h h' => (hRin x h h').2) hF' hE' with hs' | hs' + · exfalso + refine false_of_hole_on_same_side (T := T₂) (E := E₂) (Eo := E₁) (E' := E₂') (Eo' + := E₁') hDM hlA + hbm hAA'm hRDM (hTD T₂ (hTu ▸ subset_union_right)) hE.disc₂ hE'.disc₂ ?_ ?_ ?_ ?_ ?_ ?_ + · rw [Set.inter_comm, hE.inter, hF] + · rw [Set.inter_comm, hE'.inter, hF'] + · rw [hE.bd₂, hF] + · rw [hE'.bd₂, hF'] + · rw [← himg A (hXA.trans (discBd_subset D))] + rintro _ ⟨x, hx, rfl⟩ + exact hs x hx + · rw [← himg A' (hXA'.trans (discBd_subset D))] + rintro _ ⟨x, hx, rfl⟩ + exact hs' x hx + · refine ⟨_, _, _, _, sd₁, sd₂, Or.inr ⟨fun x hx => ?_, fun x hx => ?_⟩⟩ + · refine ⟨⟨hDΔ hx.1, fun h' => ?_⟩, hs x hx⟩ + rcases h' with h' | h' + · exact hx.2 (hRin x hx.1 h').1 + · exact hx.2 h' + · refine ⟨⟨hDΔ hx.1, fun h' => ?_⟩, hs' x hx⟩ + rcases h' with h' | h' + · exact hx.2 (hRin x hx.1 h').2 + · exact hx.2 h' + · refine ⟨_, _, _, _, sd₁, sd₂, Or.inl ⟨fun x hx => ?_, fun x hx => ?_⟩⟩ + · refine ⟨⟨hDΔ hx.1, fun h' => ?_⟩, hs x hx⟩ + rcases h' with h' | h' + · exact hx.2 (hRin x hx.1 h').1 + · exact hx.2 h' + · refine ⟨⟨hDΔ hx.1, fun h' => ?_⟩, hs' x hx⟩ + rcases h' with h' | h' + · exact hx.2 (hRin x hx.1 h').2 + · exact hx.2 h' + · exfalso + refine false_of_hole_on_same_side (T := T₁) (E := E₁) (Eo := E₂) (E' := E₁') (Eo' + := E₂') hDM hlA + hbm hAA'm hRDM (hTD T₁ (hTu ▸ subset_union_left)) hE.disc₁ hE'.disc₁ ?_ ?_ ?_ ?_ ?_ ?_ + · rw [hE.inter, hF] + · rw [hE'.inter, hF'] + · rw [hE.bd₁, hF] + · rw [hE'.bd₁, hF'] + · rw [← himg A (hXA.trans (discBd_subset D))] + rintro _ ⟨x, hx, rfl⟩ + exact hs x hx + · rw [← himg A' (hXA'.trans (discBd_subset D))] + rintro _ ⟨x, hx, rfl⟩ + exact hs' x hx + +/-- **The hole lies on one side.** `D ⊆ Δ` is a closed disc with boundary `A ∪ A'`, and `R ∪ A`, `R +∪ A'` are arcs with the same ends on `bd(Δ)`. Then `D - A` lies on the side of `I₂` of `R ∪ A` and +`D - A'` on the side of `I₁` of `R ∪ A'`, or the other way around. -/ +theorem exists_hole_sides {S : Type u} [TopologicalSpace S] + {Δ D R A A' I₁ I₂ : Set S} {a b y y' : S} + (hΔ : IsClosedDisc Δ) (hD : IsClosedDisc D) (hDΔ : D ⊆ Δ) + (hA : IsLineWithEnds A y y') (hbd : discBd D = A ∪ A') (hAA' : A ∩ A' = {y, y'}) + (hRD : R ∩ D = {y, y'}) (hRΔ : R ⊆ Δ) + (hQ : IsLineWithEnds (R ∪ A) a b) (hQ' : IsLineWithEnds (R ∪ A') a b) + (ha : a ∈ discBd Δ) (hb : b ∈ discBd Δ) (hab : a ≠ b) (haR : a ∈ R) (hbR : b ∈ R) + (hI₁ : IsPreconnected I₁) (hI₂ : IsPreconnected I₂) (hId : Disjoint I₁ I₂) + (hIu : I₁ ∪ I₂ = discBd Δ \ {a, b}) : + ∃ Y₁ Y₂ Y₁' Y₂', IsArcSides Δ (R ∪ A) I₁ I₂ Y₁ Y₂ ∧ IsArcSides Δ (R ∪ A') I₁ I₂ Y₁' Y₂' ∧ + ((D \ A ⊆ Y₂ ∧ D \ A' ⊆ Y₁') ∨ (D \ A ⊆ Y₁ ∧ D \ A' ⊆ Y₂')) := by + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + let w : S → ℂ := fun x => (1 / 2 : ℂ) * h x + let w' : ℂ → S := fun z => g (2 * z) + have hwc : ContinuousOn w Δ := continuousOn_const.mul c.hc + have hL : LeftInvOn w' w Δ := by + intro x hx + have : (2 : ℂ) * ((1 / 2 : ℂ) * h x) = h x := by ring + simp only [w', w, this] + exact c.gh hx + have hwi : InjOn w Δ := hL.injOn + have hwn : ∀ x ∈ Δ, ‖w x‖ ≤ 1 / 2 := by + intro x hx + have := mem_closedBall_zero_iff.mp (c.hm hx) + simp only [w, norm_mul] + norm_num + linarith + have hwb : ∀ x ∈ discBd Δ, ‖w x‖ = 1 / 2 := by + intro x hx + have : h x ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem h hx + simp only [w, norm_mul, mem_sphere_zero_iff_norm.mp this] + norm_num + have hw'c : ContinuousOn w' (w '' Δ) := by + refine c.gc.comp (by fun_prop) ?_ + rintro _ ⟨x, hx, rfl⟩ + have : (2 : ℂ) * ((1 / 2 : ℂ) * h x) = h x := by ring + simp only [w, this] + exact c.hm hx + have hbΔ : discBd Δ ⊆ Δ := discBd_subset Δ + have hAD : A ⊆ D := fun x hx => discBd_subset D (hbd ▸ Or.inl hx) + have hA'bd : ∀ x, x ∈ A' → x ∈ discBd D := fun x hx => hbd ▸ Or.inr hx + have hA'D : A' ⊆ D := fun x hx => discBd_subset D (hA'bd x hx) + set p := w a + set q := w b + have hp : ‖p‖ = 1 / 2 := hwb a ha + have hq : ‖q‖ = 1 / 2 := hwb b hb + have hpq : p ≠ q := fun e => hab (hwi (hbΔ ha) (hbΔ hb) e) + have hsmall : ∀ X : Set S, X ⊆ Δ → w '' X ⊆ closedBall 0 (1 / 2) := by + rintro X hX _ ⟨x, hx, rfl⟩ + exact mem_closedBall_zero_iff.mpr (hwn x (hX hx)) + have hQΔ : R ∪ A ⊆ Δ := union_subset hRΔ (hAD.trans hDΔ) + have hQ'Δ : R ∪ A' ⊆ Δ := union_subset hRΔ (hA'D.trans hDΔ) + have hlQ : IsLineWithEnds (w '' (R ∪ A)) p q := + IsLineWithEnds.image_of_injOn hQ (hwc.mono hQΔ) (hwi.mono hQΔ) + have hlQ' : IsLineWithEnds (w '' (R ∪ A')) p q := + IsLineWithEnds.image_of_injOn hQ' (hwc.mono hQ'Δ) (hwi.mono hQ'Δ) + let dbl : ℂ → ℂ := fun z => 2 * z + let T₁ := dbl '' (w '' I₁) + let T₂ := dbl '' (w '' I₂) + have hI₁Δ : I₁ ⊆ Δ := fun x hx => hbΔ ((hIu ▸ Or.inl hx : x ∈ discBd Δ \ {a, b}).1) + have hI₂Δ : I₂ ⊆ Δ := fun x hx => hbΔ ((hIu ▸ Or.inr hx : x ∈ discBd Δ \ {a, b}).1) + have hdb : Continuous dbl := by fun_prop + have hdbi : Injective dbl := fun u v e => mul_left_cancel₀ (two_ne_zero) e + have hT₁ : IsPreconnected T₁ := (hI₁.image _ (hwc.mono hI₁Δ)).image _ hdb.continuousOn + have hT₂ : IsPreconnected T₂ := (hI₂.image _ (hwc.mono hI₂Δ)).image _ hdb.continuousOn + have hTd : Disjoint T₁ T₂ := by + rw [Set.disjoint_left] + rintro _ ⟨_, ⟨x, hx, rfl⟩, rfl⟩ ⟨_, ⟨y₁, hy, rfl⟩, he⟩ + have := hwi (hI₂Δ hy) (hI₁Δ hx) (hdbi he) + exact Set.disjoint_left.mp hId hx (this ▸ hy) + have hTu : T₁ ∪ T₂ = sphere 0 1 \ {2 * p, 2 * q} := by + apply Subset.antisymm + · rintro _ (⟨_, ⟨x, hx, rfl⟩, rfl⟩ | ⟨_, ⟨x, hx, rfl⟩, rfl⟩) + · have hx' : x ∈ discBd Δ \ {a, b} := hIu ▸ Or.inl hx + refine ⟨?_, ?_⟩ + · rw [mem_sphere_zero_iff_norm] + simp only [dbl, norm_mul, hwb x hx'.1] + norm_num + · rintro (e | e) + · exact hx'.2 (Or.inl (hwi (hbΔ hx'.1) (hbΔ ha) (hdbi e))) + · exact hx'.2 (Or.inr (hwi (hbΔ hx'.1) (hbΔ hb) (hdbi e))) + · have hx' : x ∈ discBd Δ \ {a, b} := hIu ▸ Or.inr hx + refine ⟨?_, ?_⟩ + · rw [mem_sphere_zero_iff_norm] + simp only [dbl, norm_mul, hwb x hx'.1] + norm_num + · rintro (e | e) + · exact hx'.2 (Or.inl (hwi (hbΔ hx'.1) (hbΔ ha) (hdbi e))) + · exact hx'.2 (Or.inr (hwi (hbΔ hx'.1) (hbΔ hb) (hdbi e))) + · rintro z ⟨hz, hne⟩ + have : h (g z) = z := c.hg (sphere_subset_closedBall hz) + obtain ⟨x, hx, hxe⟩ : z ∈ h '' discBd Δ := c.bd ▸ hz + have hz2 : z = dbl (w x) := by + simp only [dbl, w, ← hxe] + ring + have hxne : x ∈ discBd Δ \ {a, b} := by + refine ⟨hx, ?_⟩ + rintro (rfl | rfl) + · exact hne (Or.inl hz2) + · exact hne (Or.inr hz2) + rw [← hIu] at hxne + rcases hxne with h' | h' + · exact Or.inl ⟨_, mem_image_of_mem w h', hz2.symm⟩ + · exact Or.inr ⟨_, mem_image_of_mem w h', hz2.symm⟩ + have hext : ∀ X : Set S, X ⊆ Δ → extArc p q (w '' (R ∪ X)) = + (outerSeg p ∪ w '' R ∪ outerSeg q) ∪ w '' X := by + intro X _ + simp only [extArc, image_union] + ext z + simp only [mem_union] + tauto + have hs₂ : ∀ X : Set S, IsLineWithEnds (w '' (R ∪ X)) p q → (R ∪ X) ⊆ Δ → + ∃ E₁ E₂, IsExtSplit (extArc p q (w '' (R ∪ X))) T₁ T₂ E₁ E₂ := by + intro X hl hX + refine exists_isExtSplit (isLineWithEnds_extArc hl (hsmall _ hX) hp hq hpq) + (extArc_subset_closedBall (hsmall _ hX) hp hq) + (extArc_inter_sphere hl (hsmall _ hX) hp hq hpq) ?_ hT₁ hT₂ hTd hTu + intro e + exact hpq (hdbi e) + obtain ⟨E₁, E₂, hE⟩ := hs₂ A hlQ hQΔ + obtain ⟨E₁', E₂', hE'⟩ := hs₂ A' hlQ' hQ'Δ + have hsides : ∀ (X E₁ E₂ : Set _), IsLineWithEnds (w '' (R ∪ X)) p q → (R ∪ X) ⊆ Δ → + IsExtSplit (extArc p q (w '' (R ∪ X))) T₁ T₂ E₁ E₂ → + IsArcSides Δ (R ∪ X) I₁ I₂ {x ∈ Δ \ (R ∪ X) | w x ∈ E₁} {x ∈ Δ \ (R ∪ X) | w x ∈ E₂} := by + intro X E₁ E₂ hl hX hS + have hsph : ∀ Y : Set S, Y ⊆ discBd Δ \ {a, b} → ∀ x ∈ Y, + ‖w x‖ = 1 / 2 ∧ w x ≠ p ∧ w x ≠ q ∧ dbl (w x) ∉ extArc p q (w '' (R ∪ X)) := by + intro Y hY x hx + have hx' := hY hx + have hnp : w x ≠ p := fun e => hx'.2 (Or.inl (hwi (hbΔ hx'.1) (hbΔ ha) e)) + have hnq : w x ≠ q := fun e => hx'.2 (Or.inr (hwi (hbΔ hx'.1) (hbΔ hb) e)) + refine ⟨hwb x hx'.1, hnp, hnq, fun hm => ?_⟩ + have hn : dbl (w x) ∈ sphere (0 : ℂ) 1 := by + rw [mem_sphere_zero_iff_norm] + simp only [dbl, norm_mul, hwb x hx'.1] + norm_num + have : dbl (w x) ∈ extArc p q (w '' (R ∪ X)) ∩ sphere 0 1 := ⟨hm, hn⟩ + rw [extArc_inter_sphere hl (hsmall _ hX) hp hq hpq] at this + rcases this with e | e + · exact hnp (hdbi e) + · exact hnq (hdbi e) + have hinQ : ∀ x, x ∉ R ∪ X → x ∈ Δ → w x ∉ w '' (R ∪ X) := by + rintro x hx hxΔ ⟨u, hu, he⟩ + exact hx (hwi (hX hu) hxΔ he ▸ hu) + have hdT : ∀ T : Set ℂ, T ⊆ sphere 0 1 \ {2 * p, 2 * q} → + Disjoint T (extArc p q (w '' (R ∪ X))) := by + intro T hT + rw [Set.disjoint_left] + intro z hz hm + have : z ∈ extArc p q (w '' (R ∪ X)) ∩ sphere 0 1 := ⟨hm, (hT hz).1⟩ + rw [extArc_inter_sphere hl (hsmall _ hX) hp hq hpq] at this + exact (hT hz).2 this + refine hS.arcSides hwc hwi hwn hX hI₁Δ hI₂Δ rfl + ⟨a, Or.inl haR, rfl⟩ ⟨b, Or.inl hbR, rfl⟩ hp hq ?_ ?_ + · rintro x ⟨hx, hxQ⟩ + obtain ⟨hn, hnp, hnq, -⟩ := hsph I₁ (hIu ▸ subset_union_left) x hx + exact hS.mem_side rfl (hsmall _ hX) hp hq hn hnp hnq (hinQ x hxQ (hI₁Δ hx)) + ⟨_, mem_image_of_mem w hx, rfl⟩ (hdT T₁ (hTu ▸ subset_union_left)) + · rintro x ⟨hx, hxQ⟩ + obtain ⟨hn, hnp, hnq, -⟩ := hsph I₂ (hIu ▸ subset_union_right) x hx + exact hS.symm.mem_side rfl (hsmall _ hX) hp hq hn hnp hnq (hinQ x hxQ (hI₂Δ hx)) + ⟨_, mem_image_of_mem w hx, rfl⟩ (hdT T₂ (hTu ▸ subset_union_right)) + have sd₁ := hsides A E₁ E₂ hlQ hQΔ hE + have sd₂ := hsides A' E₁' E₂' hlQ' hQ'Δ hE' + exact hole_sides_of_ext_splits hD hDΔ hA hbd hAA' hRD hRΔ haR hbR hwc hw'c hL hwn + hp hq hTu hE hE' hext sd₁ sd₂ + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Basic.lean b/LeanPool/GraphMinor/GM09/Basic.lean new file mode 100644 index 0000000000..a86d8f544d --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Basic.lean @@ -0,0 +1,1037 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM11.Walks +import Mathlib.Combinatorics.Graph.Lattice + +/-! +# Basic lemmas for Graph Minors IX + +This file develops the basic infrastructure for Graph Minors IX: +- Subgraph operations (`subgraphUnion`, `subgraphInter`, `subgraphSUnion`, `deleteVertices`) on + `Graph α β`, their vertex sets, edge sets, and monotonicity. +- Graph walks and paths (`IsGraphPathWithEnds`, `IsGraphPath`, `pathEnds`, `pathInternalVerts`), + subpaths of paths (`IsGraphPathWithEnds.exists_subpath`), concatenation of paths, and extraction + of a path from a walk (`GraphWalk.exists_isGraphPathWithEnds`). +- Connected subgraphs and connected components (`IsGraphConnected`, `IsGraphComponent`, + `graphComponents`) and `Catches`. +-/ + +public section + +namespace GraphMinor.GM09 + +open Set Graph GraphMinor.Surface GraphMinor.GM06 + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Subgraph operations (`subgraphUnion`, `subgraphInter`, `subgraphSUnion`, `deleteVertices`) -/ + +/-- The edgeless graph on the single vertex `v`. -/ +@[expose] def singleVertexSubgraph (G : Graph α β) (v : α) : Graph α β := + (G.induce {v}).restrict ∅ + +@[simp] +theorem vertexSet_singleVertexSubgraph (G : Graph α β) (v : α) : + V(singleVertexSubgraph G v) = {v} := rfl + +@[simp] +theorem edgeSet_singleVertexSubgraph (G : Graph α β) (v : α) : + E(singleVertexSubgraph G v) = ∅ := by simp [singleVertexSubgraph] + +theorem singleVertexSubgraph_le {G : Graph α β} {v : α} (hv : v ∈ V(G)) : + singleVertexSubgraph G v ≤ G := restrict_le.trans (G.induce_le (singleton_subset_iff.mpr hv)) + +/-- Delete a single edge `e` while keeping all vertices. -/ +@[expose] def deleteSingleEdge (G : Graph α β) (e : β) : Graph α β := + G.restrict (E(G) \ {e}) + +@[simp] +theorem vertexSet_deleteSingleEdge (G : Graph α β) (e : β) : + V(deleteSingleEdge G e) = V(G) := rfl + +@[simp] +theorem edgeSet_deleteSingleEdge (G : Graph α β) (e : β) : + E(deleteSingleEdge G e) = E(G) \ {e} := by + rw [deleteSingleEdge, edgeSet_restrict, inter_eq_right.mpr sdiff_subset] + +theorem deleteSingleEdge_le (G : Graph α β) (e : β) : + deleteSingleEdge G e ≤ G := restrict_le + +@[simp] +theorem vertexSet_subgraphUnion (G G₁ G₂ : Graph α β) : + V(subgraphUnion G G₁ G₂) = V(G₁) ∪ V(G₂) := rfl + +theorem edgeSet_subgraphUnion_subset (G G₁ G₂ : Graph α β) : + E(subgraphUnion G G₁ G₂) ⊆ E(G₁) ∪ E(G₂) := + inter_subset_right + +theorem subgraphUnion_le {G G₁ G₂ : Graph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) : + subgraphUnion G G₁ G₂ ≤ G := + restrict_le.trans (G.induce_le (union_subset h₁.vertexSet_mono h₂.vertexSet_mono)) + +@[simp] +theorem edgeSet_subgraphUnion {G G₁ G₂ : Graph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) : + E(subgraphUnion G G₁ G₂) = E(G₁) ∪ E(G₂) := by + unfold subgraphUnion + rw [edgeSet_restrict, inter_eq_right] + rintro e (he | he) + · obtain ⟨x, y, hxy⟩ := G₁.exists_isLink_of_mem_edgeSet he + exact ⟨x, y, hxy.mono h₁, Or.inl hxy.left_mem, Or.inl hxy.right_mem⟩ + · obtain ⟨x, y, hxy⟩ := G₂.exists_isLink_of_mem_edgeSet he + exact ⟨x, y, hxy.mono h₂, Or.inr hxy.left_mem, Or.inr hxy.right_mem⟩ + +theorem subgraphUnion_isLink {G G₁ G₂ : Graph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) {e : β} {x y : α} : + (subgraphUnion G G₁ G₂).IsLink e x y ↔ G₁.IsLink e x y ∨ G₂.IsLink e x y := by + rw [(subgraphUnion_le h₁ h₂).isLink_iff', edgeSet_subgraphUnion h₁ h₂] + constructor + · rintro ⟨hG, he | he⟩ + · exact Or.inl ((h₁.isLink_iff he).mpr hG) + · exact Or.inr ((h₂.isLink_iff he).mpr hG) + · rintro (h | h) + · exact ⟨h.mono h₁, Or.inl h.edge_mem⟩ + · exact ⟨h.mono h₂, Or.inr h.edge_mem⟩ + +theorem le_subgraphUnion_left {G G₁ G₂ : Graph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) : + G₁ ≤ subgraphUnion G G₁ G₂ := by + refine ⟨subset_union_left, fun e x y h => ?_⟩ + rw [subgraphUnion_isLink h₁ h₂] + exact Or.inl h + +theorem le_subgraphUnion_right {G G₁ G₂ : Graph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) : + G₂ ≤ subgraphUnion G G₁ G₂ := by + refine ⟨subset_union_right, fun e x y h => ?_⟩ + rw [subgraphUnion_isLink h₁ h₂] + exact Or.inr h + +theorem subgraphUnion_le_iff {G G₁ G₂ H : Graph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) (hH : H ≤ G) : + subgraphUnion G G₁ G₂ ≤ H ↔ G₁ ≤ H ∧ G₂ ≤ H := by + refine ⟨fun h => ⟨(le_subgraphUnion_left h₁ h₂).trans h, (le_subgraphUnion_right h₁ h₂).trans h⟩, + fun ⟨h₁H, h₂H⟩ => ?_⟩ + rw [(Compatible.of_le_le (subgraphUnion_le h₁ h₂) hH).le_iff, vertexSet_subgraphUnion, + edgeSet_subgraphUnion h₁ h₂] + exact ⟨union_subset h₁H.vertexSet_mono h₂H.vertexSet_mono, + union_subset h₁H.edgeSet_mono h₂H.edgeSet_mono⟩ + +theorem subgraphUnion_comm {G G₁ G₂ : Graph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) : + subgraphUnion G G₁ G₂ = subgraphUnion G G₂ G₁ := by + refine (Compatible.of_le_le (subgraphUnion_le h₁ h₂) (subgraphUnion_le h₂ h₁)).ext ?_ ?_ + · simp [union_comm] + · simp [edgeSet_subgraphUnion h₁ h₂, edgeSet_subgraphUnion h₂ h₁, union_comm] + +@[simp] +theorem vertexSet_subgraphInter (G G₁ G₂ : Graph α β) : + V(subgraphInter G G₁ G₂) = V(G₁) ∩ V(G₂) := rfl + +theorem subgraphInter_le {G G₁ G₂ : Graph α β} (h₁ : G₁ ≤ G) : + subgraphInter G G₁ G₂ ≤ G := + restrict_le.trans (G.induce_le (inter_subset_left.trans h₁.vertexSet_mono)) + +@[simp] +theorem edgeSet_subgraphInter {G G₁ G₂ : Graph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) : + E(subgraphInter G G₁ G₂) = E(G₁) ∩ E(G₂) := by + unfold subgraphInter + rw [edgeSet_restrict, inter_eq_right] + rintro e ⟨he₁, he₂⟩ + obtain ⟨x, y, hxy₁⟩ := G₁.exists_isLink_of_mem_edgeSet he₁ + have hxyG : G.IsLink e x y := hxy₁.mono h₁ + have hxy₂ : G₂.IsLink e x y := (h₂.isLink_iff he₂).mpr hxyG + exact ⟨x, y, hxyG, ⟨hxy₁.left_mem, hxy₂.left_mem⟩, ⟨hxy₁.right_mem, hxy₂.right_mem⟩⟩ + +theorem subgraphInter_isLink {G G₁ G₂ : Graph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) {e : β} {x y : α} : + (subgraphInter G G₁ G₂).IsLink e x y ↔ G₁.IsLink e x y ∧ G₂.IsLink e x y := by + rw [(subgraphInter_le h₁).isLink_iff', edgeSet_subgraphInter h₁ h₂] + constructor + · rintro ⟨hG, he₁, he₂⟩ + exact ⟨(h₁.isLink_iff he₁).mpr hG, (h₂.isLink_iff he₂).mpr hG⟩ + · rintro ⟨h₁e, h₂e⟩ + exact ⟨h₁e.mono h₁, h₁e.edge_mem, h₂e.edge_mem⟩ + +theorem subgraphInter_le_left {G G₁ G₂ : Graph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) : + subgraphInter G G₁ G₂ ≤ G₁ := by + refine ⟨inter_subset_left, fun e x y h => ?_⟩ + exact ((subgraphInter_isLink h₁ h₂).mp h).1 + +theorem subgraphInter_le_right {G G₁ G₂ : Graph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) : + subgraphInter G G₁ G₂ ≤ G₂ := by + refine ⟨inter_subset_right, fun e x y h => ?_⟩ + exact ((subgraphInter_isLink h₁ h₂).mp h).2 + +theorem le_subgraphInter {G G₁ G₂ H : Graph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) + (hH₁ : H ≤ G₁) (hH₂ : H ≤ G₂) : H ≤ subgraphInter G G₁ G₂ := by + refine ⟨subset_inter hH₁.vertexSet_mono hH₂.vertexSet_mono, fun e x y h => ?_⟩ + rw [subgraphInter_isLink h₁ h₂] + exact ⟨h.mono hH₁, h.mono hH₂⟩ + +theorem subgraphInter_comm {G G₁ G₂ : Graph α β} (h₁ : G₁ ≤ G) (h₂ : G₂ ≤ G) : + subgraphInter G G₁ G₂ = subgraphInter G G₂ G₁ := by + refine (Compatible.of_le_le (subgraphInter_le h₁) (subgraphInter_le h₂)).ext ?_ ?_ + · simp [inter_comm] + · simp [edgeSet_subgraphInter h₁ h₂, edgeSet_subgraphInter h₂ h₁, inter_comm] + +@[simp] +theorem vertexSet_subgraphSUnion (G : Graph α β) (P_set : Set (Graph α β)) : + V(subgraphSUnion G P_set) = ⋃ P ∈ P_set, V(P) := rfl + +theorem subgraphSUnion_le {G : Graph α β} {P_set : Set (Graph α β)} (hP : ∀ P ∈ P_set, P ≤ G) : + subgraphSUnion G P_set ≤ G := + restrict_le.trans (G.induce_le (iUnion₂_subset fun P hP_mem => (hP P hP_mem).vertexSet_mono)) + +@[simp] +theorem edgeSet_subgraphSUnion {G : Graph α β} {P_set : Set (Graph α β)} + (hP : ∀ P ∈ P_set, P ≤ G) : + E(subgraphSUnion G P_set) = ⋃ P ∈ P_set, E(P) := by + unfold subgraphSUnion + rw [edgeSet_restrict, inter_eq_right] + intro e he + obtain ⟨P, hP_mem, heP⟩ := mem_iUnion₂.mp he + obtain ⟨x, y, hxy⟩ := P.exists_isLink_of_mem_edgeSet heP + exact ⟨x, y, hxy.mono (hP P hP_mem), mem_iUnion₂.mpr ⟨P, hP_mem, hxy.left_mem⟩, + mem_iUnion₂.mpr ⟨P, hP_mem, hxy.right_mem⟩⟩ + +theorem le_subgraphSUnion {G P : Graph α β} {P_set : Set (Graph α β)} + (hP_set : ∀ Q ∈ P_set, Q ≤ G) (hP : P ∈ P_set) : + P ≤ subgraphSUnion G P_set := by + have hsub := subgraphSUnion_le hP_set + rw [(Compatible.of_le_le (hP_set P hP) hsub).le_iff, vertexSet_subgraphSUnion, + edgeSet_subgraphSUnion hP_set] + exact ⟨subset_iUnion₂ (s := fun Q _ => V(Q)) P hP, subset_iUnion₂ (s := fun Q _ => E(Q)) P hP⟩ + +theorem subgraphSUnion_mono {G : Graph α β} {P_set Q_set : Set (Graph α β)} + (hQ : ∀ Q ∈ Q_set, Q ≤ G) (hsub : P_set ⊆ Q_set) : + subgraphSUnion G P_set ≤ subgraphSUnion G Q_set := by + have hP : ∀ P ∈ P_set, P ≤ G := fun P hP => hQ P (hsub hP) + rw [(Compatible.of_le_le (subgraphSUnion_le hP) (subgraphSUnion_le hQ)).le_iff, + vertexSet_subgraphSUnion, vertexSet_subgraphSUnion, + edgeSet_subgraphSUnion hP, edgeSet_subgraphSUnion hQ] + exact ⟨biUnion_subset_biUnion_left hsub, biUnion_subset_biUnion_left hsub⟩ + +@[simp] +theorem vertexSet_deleteVertices (G : Graph α β) (X : Set α) : + V(deleteVertices G X) = V(G) \ X := rfl + +@[simp] +theorem deleteVertices_le (G : Graph α β) (X : Set α) : + deleteVertices G X ≤ G := G.induce_le sdiff_subset + +@[simp] +theorem deleteVertices_isLink (G : Graph α β) (X : Set α) {e : β} {x y : α} : + (deleteVertices G X).IsLink e x y ↔ G.IsLink e x y ∧ x ∉ X ∧ y ∉ X := by + simp only [deleteVertices, induce_isLink, mem_sdiff, and_congr_right_iff] + exact fun h => by simp [h.left_mem, h.right_mem] + +/-! ##Separations of graphs -/ + +theorem IsGraphSeparation.symm {G G₁ G₂ : Graph α β} (h : IsGraphSeparation G G₁ G₂) : + IsGraphSeparation G G₂ G₁ := + ⟨h.2.1, h.1, union_comm V(G₂) V(G₁) ▸ h.2.2.1, union_comm E(G₂) E(G₁) ▸ h.2.2.2.1, + h.2.2.2.2.symm⟩ + +theorem IsGraphSeparation.subgraphUnion_eq {G G₁ G₂ : Graph α β} (h : IsGraphSeparation G G₁ G₂) : + subgraphUnion G G₁ G₂ = G := by + refine (Compatible.of_le_le (subgraphUnion_le h.1 h.2.1) le_rfl).ext ?_ ?_ + · rw [vertexSet_subgraphUnion, h.2.2.1] + · rw [edgeSet_subgraphUnion h.1 h.2.1, h.2.2.2.1] + +theorem IsGraphSeparation.edgeSet_subgraphInter {G G₁ G₂ : Graph α β} + (h : IsGraphSeparation G G₁ G₂) : E(subgraphInter G G₁ G₂) = ∅ := by + rw [GM09.edgeSet_subgraphInter h.1 h.2.1, disjoint_iff_inter_eq_empty.mp h.2.2.2.2] + +/-! ## Walks and paths in `Graph α β` -/ + +/-- The subgraph of `G` formed by the vertices and edges of a walk `W` in `G`. -/ +def walkSubgraph {G : Graph α β} {a b : α} (W : GraphWalk G a b) : Graph α β := + (G.induce {x | x ∈ W.support}).restrict {e | e ∈ W.edges} + +theorem walkSubgraph_eq {G : Graph α β} {a b : α} (W : GraphWalk G a b) : + walkSubgraph W = (G.induce {x | x ∈ W.support}).restrict {e | e ∈ W.edges} := by + unfold walkSubgraph + rfl + +theorem walkSubgraph_le {G : Graph α β} {a b : α} (W : GraphWalk G a b) : + walkSubgraph W ≤ G := + restrict_le.trans (G.induce_le fun _ hx => W.mem_vertexSet_of_mem_support hx) + +@[simp] +theorem vertexSet_walkSubgraph {G : Graph α β} {a b : α} (W : GraphWalk G a b) : + V(walkSubgraph W) = {x | x ∈ W.support} := by rfl + +theorem walk_edges_subset_edgeSet {G : Graph α β} {a b : α} (W : GraphWalk G a b) : + ∀ e ∈ W.edges, e ∈ E(G) := by + induction W with + | nil _ => simp + | cons h _ ih => + intro e he + rcases List.mem_cons.mp he with rfl | he + · exact h.edge_mem + · exact ih e he + +theorem walk_isLink_mem_support {G : Graph α β} {a b : α} (W : GraphWalk G a b) + {e : β} (he : e ∈ W.edges) {x y : α} (hxy : G.IsLink e x y) : + x ∈ W.support ∧ y ∈ W.support := + ⟨W.left_mem_support_of_mem_edges he hxy, W.left_mem_support_of_mem_edges he hxy.symm⟩ + +@[simp] +theorem edgeSet_walkSubgraph {G : Graph α β} {a b : α} (W : GraphWalk G a b) : + E(walkSubgraph W) = {e | e ∈ W.edges} := by + unfold walkSubgraph + rw [edgeSet_restrict, inter_eq_right] + intro e he + obtain ⟨x, y, hxy⟩ := G.exists_isLink_of_mem_edgeSet (walk_edges_subset_edgeSet W e he) + have hm := walk_isLink_mem_support W he hxy + exact ⟨x, y, hxy, hm.1, hm.2⟩ + +theorem walkSubgraph_isLink {G : Graph α β} {a b : α} (W : GraphWalk G a b) + {e : β} {x y : α} : + (walkSubgraph W).IsLink e x y ↔ e ∈ W.edges ∧ G.IsLink e x y := by + rw [(walkSubgraph_le W).isLink_iff', edgeSet_walkSubgraph, mem_ofPred_eq, and_comm] + +theorem isSimple_of_append {G : Graph α β} {a x b : α} {W₁ : GraphWalk G a x} + {W₂ : GraphWalk G x b} (h : (W₁.append W₂).IsSimple) : + W₁.IsSimple ∧ W₂.IsSimple := + GraphWalk.simple_parts_of_append h + +/-- Every walk `W` in `G` transfers to a walk with the same support and edges in `walkSubgraph W`. +-/ +theorem exists_walk_walkSubgraph {G : Graph α β} {a b : α} (W : GraphWalk G a b) : + ∃ W' : GraphWalk (walkSubgraph W) a b, + W'.support = W.support ∧ W'.edges = W.edges := + W.exists_transfer + (fun _ _ _ he hl => (walkSubgraph_isLink W).mpr ⟨he, hl⟩) + (fun _ hx => hx) + +/-- If `W` is a simple walk in `G` from `a` to `b`, then `walkSubgraph W` is a path in `G` with +ends `a` and `b`. -/ +theorem isGraphPathWithEnds_walkSubgraph {G : Graph α β} {a b : α} {W : GraphWalk G a b} + (hW : W.IsSimple) : IsGraphPathWithEnds G (walkSubgraph W) a b := by + obtain ⟨W', hs, he⟩ := exists_walk_walkSubgraph W + refine ⟨walkSubgraph_le W, W', ?_, ?_, ?_⟩ + · unfold GraphWalk.IsSimple; rw [hs]; exact hW + · rw [vertexSet_walkSubgraph, hs] + · rw [edgeSet_walkSubgraph, he] + +/-- Every walk in `G` from `a` to `b` can be shortened to a simple walk whose support and edges +are subsets of the original walk's support and edges. -/ +theorem exists_isSimple_subwalk {G : Graph α β} {a b : α} (W : GraphWalk G a b) : + ∃ W' : GraphWalk G a b, W'.IsSimple ∧ + (∀ x ∈ W'.support, x ∈ W.support) ∧ (∀ e ∈ W'.edges, e ∈ W.edges) := by + induction W with + | @nil u h => + exact ⟨.nil h, List.nodup_singleton u, fun _ hx => hx, fun _ he => he⟩ + | @cons u v _ e h r ih => + obtain ⟨r', hr', hsupp, hedges⟩ := ih + by_cases hu : u ∈ r'.support + · obtain ⟨W₁, W₂, hsplit⟩ := r'.exists_append_of_mem hu + have hW₂_simple : W₂.IsSimple := (isSimple_of_append (hsplit ▸ hr')).2 + refine ⟨W₂, hW₂_simple, fun x hx => ?_, fun f hf => ?_⟩ + · apply List.mem_cons_of_mem u (hsupp x ?_) + rw [hsplit] + exact (GraphWalk.mem_support_append W₁ W₂).mpr (Or.inr hx) + · apply List.mem_cons_of_mem e (hedges f ?_) + rw [hsplit, GraphWalk.edges_append] + exact List.mem_append_right _ hf + · refine ⟨.cons h r', List.nodup_cons.mpr ⟨hu, hr'⟩, fun x hx => ?_, fun f hf => ?_⟩ + · rcases List.mem_cons.mp hx with rfl | hx + · exact List.mem_cons_self + · exact List.mem_cons_of_mem _ (hsupp x hx) + · rcases List.mem_cons.mp hf with rfl | hf + · exact List.mem_cons_self + · exact List.mem_cons_of_mem _ (hedges f hf) + +/-- Every walk `W` in `G` from `a` to `b` contains a path `P ≤ G` with ends `a` and `b` whose +vertices and edges lie in `W`. -/ +theorem exists_isGraphPathWithEnds_of_walk {G : Graph α β} {a b : α} (W : GraphWalk G a b) : + ∃ P : Graph α β, IsGraphPathWithEnds G P a b ∧ + V(P) ⊆ {x | x ∈ W.support} ∧ E(P) ⊆ {e | e ∈ W.edges} := by + obtain ⟨W', hW', hsupp, hedges⟩ := exists_isSimple_subwalk W + refine ⟨walkSubgraph W', isGraphPathWithEnds_walkSubgraph hW', ?_, ?_⟩ + · rw [vertexSet_walkSubgraph] + exact hsupp + · rw [edgeSet_walkSubgraph] + exact hedges + +theorem IsGraphPathWithEnds.le {G P : Graph α β} {a b : α} (h : IsGraphPathWithEnds G P a b) : + P ≤ G := h.1 + +theorem IsGraphPathWithEnds.left_mem {G P : Graph α β} {a b : α} + (h : IsGraphPathWithEnds G P a b) : a ∈ V(P) := by + obtain ⟨_, W, _, hV, _⟩ := h + rw [hV] + exact W.start_mem_support + +theorem IsGraphPathWithEnds.right_mem {G P : Graph α β} {a b : α} + (h : IsGraphPathWithEnds G P a b) : b ∈ V(P) := by + obtain ⟨_, W, _, hV, _⟩ := h + rw [hV] + exact W.end_mem_support + +theorem IsGraphPathWithEnds.symm {G P : Graph α β} {a b : α} + (h : IsGraphPathWithEnds G P a b) : IsGraphPathWithEnds G P b a := by + obtain ⟨hPG, W, hW, hV, hE⟩ := h + refine ⟨hPG, W.reverse, hW.reverse, ?_, ?_⟩ + · rw [hV] + ext x + simp [GraphWalk.support_reverse] + · rw [hE] + ext e + simp [GraphWalk.edges_reverse] + +theorem IsGraphPathWithEnds.mono {G H P : Graph α β} {a b : α} + (h : IsGraphPathWithEnds H P a b) (hHG : H ≤ G) : IsGraphPathWithEnds G P a b := + ⟨h.1.trans hHG, h.2⟩ + +theorem IsGraphPathWithEnds.of_le {G H P : Graph α β} {a b : α} + (h : IsGraphPathWithEnds G P a b) (hPH : P ≤ H) : IsGraphPathWithEnds H P a b := + ⟨hPH, h.2⟩ + +/-- If `P` is a path in `G` with ends `a, b` and `x ∈ V(P)`, then `P` splits into two subpaths +`P₁` (from `a` to `x`) and `P₂` (from `x` to `b`) with `P₁ ∪ P₂ = P`, `V(P₁) ∩ V(P₂) = {x}`, +and `E(P₁) ∩ E(P₂) = ∅`. -/ +theorem IsGraphPathWithEnds.exists_split_at {G P : Graph α β} {a b x : α} + (hP : IsGraphPathWithEnds G P a b) (hx : x ∈ V(P)) : + ∃ P₁ P₂ : Graph α β, + P₁ ≤ P ∧ P₂ ≤ P ∧ + IsGraphPathWithEnds P P₁ a x ∧ IsGraphPathWithEnds P P₂ x b ∧ + subgraphUnion P P₁ P₂ = P ∧ + V(P₁) ∩ V(P₂) = {x} ∧ Disjoint E(P₁) E(P₂) := by + obtain ⟨_, W, hW, hVP, hEP⟩ := hP + have hxW : x ∈ W.support := by rwa [hVP] at hx + obtain ⟨W₁, W₂, rfl⟩ := W.exists_append_of_mem hxW + have hsp := isSimple_of_append hW + let P₁ := walkSubgraph W₁ + let P₂ := walkSubgraph W₂ + have hP₁P : P₁ ≤ P := walkSubgraph_le W₁ + have hP₂P : P₂ ≤ P := walkSubgraph_le W₂ + have hP₁ : IsGraphPathWithEnds P P₁ a x := isGraphPathWithEnds_walkSubgraph hsp.1 + have hP₂ : IsGraphPathWithEnds P P₂ x b := isGraphPathWithEnds_walkSubgraph hsp.2 + have hnd_V : (W₁.support ++ W₂.support.tail).Nodup := by + have h' : (W₁.append W₂).support.Nodup := hW + rwa [GraphWalk.support_append] at h' + have hd_V := List.nodup_append.mp hnd_V + have hnd_E : (W₁.edges ++ W₂.edges).Nodup := by + have h' : (W₁.append W₂).edges.Nodup := hW.edges_nodup + rwa [GraphWalk.edges_append] at h' + have hd_E := List.nodup_append.mp hnd_E + refine ⟨P₁, P₂, hP₁P, hP₂P, hP₁, hP₂, ?_, ?_, ?_⟩ + · refine (Compatible.of_le_le (subgraphUnion_le hP₁P hP₂P) le_rfl).ext ?_ ?_ + · rw [vertexSet_subgraphUnion, vertexSet_walkSubgraph, vertexSet_walkSubgraph, hVP] + ext z + simp [GraphWalk.mem_support_append] + · rw [edgeSet_subgraphUnion hP₁P hP₂P, edgeSet_walkSubgraph, edgeSet_walkSubgraph, hEP] + ext e + simp [GraphWalk.edges_append] + · rw [vertexSet_walkSubgraph, vertexSet_walkSubgraph] + ext z + simp only [mem_inter_iff, mem_ofPred_eq, mem_singleton_iff] + constructor + · rintro ⟨hz₁, hz₂⟩ + rw [W₂.support_eq_cons] at hz₂ + rcases List.mem_cons.mp hz₂ with rfl | hz₂ + · rfl + · exact False.elim (hd_V.2.2 z hz₁ z hz₂ rfl) + · rintro rfl + exact ⟨W₁.end_mem_support, W₂.start_mem_support⟩ + · rw [edgeSet_walkSubgraph, edgeSet_walkSubgraph] + exact disjoint_left.mpr fun e he₁ he₂ => hd_E.2.2 e he₁ e he₂ rfl + +/-- Between any two vertices `u, v ∈ V(P)` of a path `P` in `G`, there is a subpath `Q ≤ P` with +ends `u` and `v`. -/ +theorem IsGraphPathWithEnds.exists_subpath {G P : Graph α β} {a b u v : α} + (hP : IsGraphPathWithEnds G P a b) (hu : u ∈ V(P)) (hv : v ∈ V(P)) : + ∃ Q : Graph α β, Q ≤ P ∧ IsGraphPathWithEnds P Q u v ∧ IsGraphPathWithEnds G Q u v := by + obtain ⟨P₁, P₂, hP₁P, hP₂P, hP₁, hP₂, hunion, _, _⟩ := hP.exists_split_at hu + have hv_union : v ∈ V(P₁) ∪ V(P₂) := by + rw [← vertexSet_subgraphUnion P P₁ P₂, hunion] + exact hv + rcases hv_union with hv₁ | hv₂ + · obtain ⟨Q₁, Q₂, _, hQ₂P₁, _, hQ₂, _, _, _⟩ := hP₁.exists_split_at hv₁ + have hQ₂P : Q₂ ≤ P := hQ₂P₁.trans hP₁P + have hQ₂' : IsGraphPathWithEnds P Q₂ u v := (hQ₂.mono hP₁P).symm + exact ⟨Q₂, hQ₂P, hQ₂', hQ₂'.mono hP.le⟩ + · obtain ⟨Q₁, Q₂, hQ₁P₂, _, hQ₁, _, _, _, _⟩ := hP₂.exists_split_at hv₂ + have hQ₁P : Q₁ ≤ P := hQ₁P₂.trans hP₂P + have hQ₁' : IsGraphPathWithEnds P Q₁ u v := hQ₁.mono hP₂P + exact ⟨Q₁, hQ₁P, hQ₁', hQ₁'.mono hP.le⟩ + +/-- If `P₁` is a path in `G` from `a` to `b` and `P₂` is a path in `G` from `b` to `c` with +`V(P₁) ∩ V(P₂) = {b}`, then `P₁ ∪ P₂` is a path in `G` from `a` to `c`. -/ +theorem IsGraphPathWithEnds.subgraphUnion {G P₁ P₂ : Graph α β} {a b c : α} + (h₁ : IsGraphPathWithEnds G P₁ a b) (h₂ : IsGraphPathWithEnds G P₂ b c) + (hV : V(P₁) ∩ V(P₂) = {b}) : + IsGraphPathWithEnds G (subgraphUnion G P₁ P₂) a c := by + obtain ⟨hP₁G, W₁, hW₁, hV₁, hE₁⟩ := h₁ + obtain ⟨hP₂G, W₂, hW₂, hV₂, hE₂⟩ := h₂ + have hl₁ := le_subgraphUnion_left hP₁G hP₂G + have hl₂ := le_subgraphUnion_right hP₁G hP₂G + obtain ⟨W₁', hs₁, he₁⟩ := W₁.exists_transfer (fun _ _ _ _ hl => hl.mono hl₁) + (fun _ hx => hl₁.vertexSet_mono (W₁.mem_vertexSet_of_mem_support hx)) + obtain ⟨W₂', hs₂, he₂⟩ := W₂.exists_transfer (fun _ _ _ _ hl => hl.mono hl₂) + (fun _ hx => hl₂.vertexSet_mono (W₂.mem_vertexSet_of_mem_support hx)) + refine ⟨subgraphUnion_le hP₁G hP₂G, W₁'.append W₂', ?_, ?_, ?_⟩ + · unfold GraphWalk.IsSimple + rw [GraphWalk.support_append, hs₁, hs₂] + refine List.nodup_append.mpr ⟨hW₁, List.Nodup.tail hW₂, fun x hx₁ y hy₂ hxy => ?_⟩ + subst hxy + have hxP₁ : x ∈ V(P₁) := by rw [hV₁]; exact hx₁ + have hxW₂ : x ∈ W₂.support := by + rw [W₂.support_eq_cons] + exact List.mem_cons_of_mem _ hy₂ + have hxP₂ : x ∈ V(P₂) := by rw [hV₂]; exact hxW₂ + have hxb : x = b := by + have : x ∈ V(P₁) ∩ V(P₂) := ⟨hxP₁, hxP₂⟩ + rwa [hV, mem_singleton_iff] at this + subst hxb + have hnd₂ : W₂.support.Nodup := hW₂ + rw [W₂.support_eq_cons] at hnd₂ + exact (List.nodup_cons.mp hnd₂).1 hy₂ + · rw [vertexSet_subgraphUnion, hV₁, hV₂] + ext x + simp [GraphWalk.mem_support_append, hs₁, hs₂] + · rw [edgeSet_subgraphUnion hP₁G hP₂G, hE₁, hE₂] + ext e + simp [GraphWalk.edges_append, he₁, he₂] + +/-! ## Connected subgraphs, components, and `Catches` -/ + +theorem exists_walk_up_of_le {G H : Graph α β} (h : H ≤ G) {u v : α} (W : GraphWalk H u v) : + ∃ W' : GraphWalk G u v, W'.support = W.support ∧ W'.edges = W.edges := + W.exists_transfer (fun _ _ _ _ hl => hl.mono h) + (fun _ hx => h.vertexSet_mono (W.mem_vertexSet_of_mem_support hx)) + +theorem exists_walk_down_of_le {G H : Graph α β} (h : H ≤ G) {u v : α} (W : GraphWalk G u v) + (hV : ∀ x ∈ W.support, x ∈ V(H)) (hE : ∀ e ∈ W.edges, e ∈ E(H)) : + ∃ W' : GraphWalk H u v, W'.support = W.support ∧ W'.edges = W.edges := + W.exists_transfer (fun _ _ _ he hl => (h.isLink_iff (hE _ he)).mpr hl) hV + +theorem isGraphConnected_subgraphUnion {G H₁ H₂ : Graph α β} (h₁G : H₁ ≤ G) (h₂G : H₂ ≤ G) + (h₁ : IsGraphConnected H₁) (h₂ : IsGraphConnected H₂) (hinter : (V(H₁) ∩ V(H₂)).Nonempty) : + IsGraphConnected (subgraphUnion G H₁ H₂) := by + obtain ⟨z, hz₁, hz₂⟩ := hinter + have hl₁ := le_subgraphUnion_left h₁G h₂G + have hl₂ := le_subgraphUnion_right h₁G h₂G + refine ⟨⟨z, Or.inl hz₁⟩, fun u hu v hv => ?_⟩ + have hu_walk : Nonempty (GraphWalk (subgraphUnion G H₁ H₂) u z) := by + rcases hu with hu₁ | hu₂ + · obtain ⟨W⟩ := h₁.2 u hu₁ z hz₁ + obtain ⟨W', _, _⟩ := exists_walk_up_of_le hl₁ W + exact ⟨W'⟩ + · obtain ⟨W⟩ := h₂.2 u hu₂ z hz₂ + obtain ⟨W', _, _⟩ := exists_walk_up_of_le hl₂ W + exact ⟨W'⟩ + have hv_walk : Nonempty (GraphWalk (subgraphUnion G H₁ H₂) z v) := by + rcases hv with hv₁ | hv₂ + · obtain ⟨W⟩ := h₁.2 z hz₁ v hv₁ + obtain ⟨W', _, _⟩ := exists_walk_up_of_le hl₁ W + exact ⟨W'⟩ + · obtain ⟨W⟩ := h₂.2 z hz₂ v hv₂ + obtain ⟨W', _, _⟩ := exists_walk_up_of_le hl₂ W + exact ⟨W'⟩ + obtain ⟨W₁⟩ := hu_walk + obtain ⟨W₂⟩ := hv_walk + exact ⟨W₁.append W₂⟩ + +/-- The induced subgraph of `G` on the vertices reachable from `v ∈ V(G)`. -/ +def reachableComponent (G : Graph α β) (v : α) : Graph α β := + G.induce {u ∈ V(G) | Nonempty (GraphWalk G v u)} + +theorem reachableComponent_le (G : Graph α β) (v : α) : + reachableComponent G v ≤ G := + G.induce_le fun _ hu => hu.1 + +@[simp] +theorem vertexSet_reachableComponent (G : Graph α β) (v : α) : + V(reachableComponent G v) = {u ∈ V(G) | Nonempty (GraphWalk G v u)} := by rfl + +theorem self_mem_reachableComponent {G : Graph α β} {v : α} (hv : v ∈ V(G)) : + v ∈ V(reachableComponent G v) := + ⟨hv, ⟨.nil hv⟩⟩ + +theorem walk_support_subset_reachableComponent {G : Graph α β} {v a b : α} + (ha : a ∈ V(reachableComponent G v)) (W : GraphWalk G a b) : + ∀ x ∈ W.support, x ∈ V(reachableComponent G v) := by + induction W with + | nil _ => + intro x hx + simp only [GraphWalk.support_nil, List.mem_singleton] at hx + exact hx ▸ ha + | @cons u w _ e h r ih => + have hw : w ∈ V(reachableComponent G v) := by + obtain ⟨_, ⟨W₀⟩⟩ := ha + exact ⟨h.right_mem, ⟨W₀.append (.cons h (.nil h.right_mem))⟩⟩ + intro x hx + rcases List.mem_cons.mp hx with rfl | hx + · exact ha + · exact ih hw x hx + +theorem walk_edges_subset_reachableComponent {G : Graph α β} {v a b : α} + (ha : a ∈ V(reachableComponent G v)) (W : GraphWalk G a b) : + ∀ e ∈ W.edges, e ∈ E(reachableComponent G v) := by + intro e he + obtain ⟨x, y, hxy⟩ := G.exists_isLink_of_mem_edgeSet (walk_edges_subset_edgeSet W e he) + have hm := walk_isLink_mem_support W he hxy + exact ⟨x, y, hxy, walk_support_subset_reachableComponent ha W x hm.1, + walk_support_subset_reachableComponent ha W y hm.2⟩ + +theorem isGraphConnected_reachableComponent {G : Graph α β} {v : α} (hv : v ∈ V(G)) : + IsGraphConnected (reachableComponent G v) := by + refine ⟨⟨v, self_mem_reachableComponent hv⟩, fun x hx y hy => ?_⟩ + obtain ⟨hxG, ⟨Wx⟩⟩ := hx + obtain ⟨hyG, ⟨Wy⟩⟩ := hy + let W := Wx.reverse.append Wy + obtain ⟨W', _, _⟩ := exists_walk_down_of_le (reachableComponent_le G v) W + (walk_support_subset_reachableComponent ⟨hxG, ⟨Wx⟩⟩ W) + (walk_edges_subset_reachableComponent ⟨hxG, ⟨Wx⟩⟩ W) + exact ⟨W'⟩ + +theorem isGraphComponent_reachableComponent {G : Graph α β} {v : α} (hv : v ∈ V(G)) : + IsGraphComponent (reachableComponent G v) G := by + refine ⟨reachableComponent_le G v, isGraphConnected_reachableComponent hv, + fun C' hle hC'G hconn => le_antisymm ?_ hle⟩ + have hvC' : v ∈ V(C') := hle.vertexSet_mono (self_mem_reachableComponent hv) + have hsubV : V(C') ⊆ V(reachableComponent G v) := by + intro u hu + obtain ⟨W⟩ := hconn.2 v hvC' u hu + obtain ⟨W', _, _⟩ := exists_walk_up_of_le hC'G W + exact ⟨hC'G.vertexSet_mono hu, ⟨W'⟩⟩ + rw [(Compatible.of_le_le hC'G (reachableComponent_le G v)).le_iff] + refine ⟨hsubV, fun e he => ?_⟩ + obtain ⟨x, y, hxy⟩ := C'.exists_isLink_of_mem_edgeSet he + exact ⟨x, y, hxy.mono hC'G, hsubV hxy.left_mem, hsubV hxy.right_mem⟩ + +theorem exists_graphComponent_of_mem {G : Graph α β} {v : α} (hv : v ∈ V(G)) : + ∃ C ∈ graphComponents G, v ∈ V(C) := + ⟨reachableComponent G v, isGraphComponent_reachableComponent hv, self_mem_reachableComponent hv⟩ + +theorem isGraphComponent_eq_of_mem_inter {G C₁ C₂ : Graph α β} + (h₁ : IsGraphComponent C₁ G) (h₂ : IsGraphComponent C₂ G) + (hinter : (V(C₁) ∩ V(C₂)).Nonempty) : C₁ = C₂ := by + have hconn := isGraphConnected_subgraphUnion h₁.1 h₂.1 h₁.2.1 h₂.2.1 hinter + have hunion_le : subgraphUnion G C₁ C₂ ≤ G := subgraphUnion_le h₁.1 h₂.1 + have h1 := h₁.2.2 (subgraphUnion G C₁ C₂) (le_subgraphUnion_left h₁.1 h₂.1) hunion_le hconn + have h2 := h₂.2.2 (subgraphUnion G C₁ C₂) (le_subgraphUnion_right h₁.1 h₂.1) hunion_le hconn + exact h1.symm.trans h2 + +theorem isGraphComponent_eq_reachableComponent {G C : Graph α β} (hC : IsGraphComponent C G) + {v : α} (hv : v ∈ V(C)) : C = reachableComponent G v := by + have hvG : v ∈ V(G) := hC.1.vertexSet_mono hv + exact isGraphComponent_eq_of_mem_inter hC (isGraphComponent_reachableComponent hvG) + ⟨v, hv, self_mem_reachableComponent hvG⟩ + +theorem isClosedSubgraph_of_isGraphComponent {G C : Graph α β} (hC : IsGraphComponent C G) : + C ≤c G := by + obtain ⟨v, hv⟩ := hC.2.1.1 + rw [isGraphComponent_eq_reachableComponent hC hv] + refine IsClosedSubgraph.mk' (reachableComponent_le G v) fun e x hinc hx => ?_ + obtain ⟨y, hxy⟩ := hinc + have hx' : x ∈ V(reachableComponent G v) := hx + obtain ⟨_, ⟨Wx⟩⟩ := hx + have hy : y ∈ V(reachableComponent G v) := + ⟨hxy.right_mem, ⟨Wx.append (.cons hxy (.nil hxy.right_mem))⟩⟩ + exact ⟨x, y, hxy, hx', hy⟩ + +theorem mem_graphComponent_iff_of_isLink {G C : Graph α β} (hC : IsGraphComponent C G) + {e : β} {x y : α} (hxy : G.IsLink e x y) : + x ∈ V(C) ↔ y ∈ V(C) := + (isClosedSubgraph_of_isGraphComponent hC).mem_iff_of_isLink hxy + +/-! ## Cyclic permutations (`CyclicPerm`) -/ + +namespace CyclicPerm + +variable {Ω : CyclicPerm α} + +theorem toFun_mem {x : α} (hx : x ∈ Ω.bar) : Ω x ∈ Ω.bar := + Ω.bijOn.mapsTo hx + +theorem iterate_mem (k : ℕ) {x : α} (hx : x ∈ Ω.bar) : (Ω.toFun^[k]) x ∈ Ω.bar := by + induction k with + | zero => exact hx + | succ k ih => + rw [Function.iterate_succ_apply'] + exact Ω.toFun_mem ih + +theorem injOn_iterate (k : ℕ) : Set.InjOn (Ω.toFun^[k]) Ω.bar := by + induction k with + | zero => exact Set.injOn_id Ω.bar + | succ k ih => + intro x hx y hy hxy + rw [Function.iterate_succ_apply', Function.iterate_succ_apply'] at hxy + exact ih hx hy (Ω.bijOn.injOn (Ω.iterate_mem k hx) (Ω.iterate_mem k hy) hxy) + +theorem exists_pos_period {x : α} (hx : x ∈ Ω.bar) : + ∃ n : ℕ, 1 ≤ n ∧ (Ω.toFun^[n]) x = x := by + obtain ⟨k, hk⟩ := Ω.single_orbit (Ω x) (Ω.toFun_mem hx) x hx + refine ⟨k + 1, Nat.succ_le_succ (Nat.zero_le k), ?_⟩ + rw [Function.iterate_succ_apply] + exact hk + +theorem FirstHitIn.unique {X : Set α} {x y₁ y₂ : α} + (h₁ : Ω.FirstHitIn X x y₁) (h₂ : Ω.FirstHitIn X x y₂) : y₁ = y₂ := by + rcases h₁ with ⟨k₁, hk₁, rfl, hy₁, hmin₁⟩ + rcases h₂ with ⟨k₂, hk₂, rfl, hy₂, hmin₂⟩ + rcases lt_trichotomy k₁ k₂ with hlt | rfl | hgt + · exact (hmin₂ k₁ hk₁ hlt hy₁).elim + · rfl + · exact (hmin₁ k₂ hk₂ hgt hy₂).elim + +theorem exists_firstHitIn {X : Set α} {x : α} (hx : x ∈ Ω.bar) + (hX : (Ω.bar ∩ X).Nonempty) : ∃ y, Ω.FirstHitIn X x y := by + classical + rcases hX with ⟨z, hzΩ, hzX⟩ + obtain ⟨k₀, hk₀⟩ := Ω.single_orbit (Ω x) (Ω.toFun_mem hx) z hzΩ + have hex : ∃ k : ℕ, 1 ≤ k ∧ (Ω.toFun^[k]) x ∈ X := by + refine ⟨k₀ + 1, Nat.succ_le_succ (Nat.zero_le k₀), ?_⟩ + rw [Function.iterate_succ_apply] + simpa [hk₀] using hzX + let k := Nat.find hex + have hk_spec := Nat.find_spec hex + refine ⟨(Ω.toFun^[k]) x, k, hk_spec.1, rfl, hk_spec.2, fun j hj1 hjlt hjX => ?_⟩ + exact Nat.find_min hex hjlt ⟨hj1, hjX⟩ + +theorem FirstHitIn.mem_bar {X : Set α} {x y : α} (hx : x ∈ Ω.bar) + (h : Ω.FirstHitIn X x y) : y ∈ Ω.bar := by + rcases h with ⟨k, _, rfl, _, _⟩ + exact Ω.iterate_mem k hx + +theorem FirstHitIn.mem_set {X : Set α} {x y : α} (h : Ω.FirstHitIn X x y) : y ∈ X := by + rcases h with ⟨_, _, _, hy, _⟩ + exact hy + +theorem isClockwise3_iff {v₁ v₂ v₃ : α} : + Ω.IsClockwise3 v₁ v₂ v₃ ↔ + v₁ ≠ v₂ ∧ v₁ ≠ v₃ ∧ v₂ ≠ v₃ ∧ + v₁ ∈ Ω.bar ∧ v₂ ∈ Ω.bar ∧ v₃ ∈ Ω.bar ∧ + Ω.FirstHitIn {v₁, v₂, v₃} v₁ v₂ ∧ + Ω.FirstHitIn {v₁, v₂, v₃} v₂ v₃ ∧ + Ω.FirstHitIn {v₁, v₂, v₃} v₃ v₁ := by + unfold IsClockwise3 IsClockwiseSeq + constructor + · rintro ⟨hnodup, hmem, hhit⟩ + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or, + List.nodup_nil, and_true] at hnodup + have hset : {v | v ∈ ([v₁, v₂, v₃] : List α)} = {v₁, v₂, v₃} := by + ext x; simp [Set.mem_insert_iff, Set.mem_singleton_iff] + have h0 : Ω.FirstHitIn {v₁, v₂, v₃} v₁ v₂ := by + have := hhit 0 (by simp) + rwa [hset] at this + have h1 : Ω.FirstHitIn {v₁, v₂, v₃} v₂ v₃ := by + have := hhit 1 (by simp) + rwa [hset] at this + have h2 : Ω.FirstHitIn {v₁, v₂, v₃} v₃ v₁ := by + have := hhit 2 (by simp) + rw [hset] at this + simpa using this + refine ⟨hnodup.1.1, hnodup.1.2, hnodup.2.1, + hmem v₁ (by simp), hmem v₂ (by simp), hmem v₃ (by simp), h0, h1, h2⟩ + · rintro ⟨h12, h13, h23, hv1, hv2, hv3, hhit0, hhit1, hhit2⟩ + have hset : {v | v ∈ ([v₁, v₂, v₃] : List α)} = {v₁, v₂, v₃} := by + ext x; simp [Set.mem_insert_iff, Set.mem_singleton_iff] + refine ⟨?_, ?_, ?_⟩ + · simp [h12, h13, h23] + · intro v hv + simp only [List.mem_cons, List.not_mem_nil, or_false] at hv + rcases hv with rfl | rfl | rfl <;> assumption + · intro i hi + simp only [List.length_cons, List.length_nil, Nat.reduceAdd] at hi + rw [hset] + rcases i with _ | _ | _ | i + · exact hhit0 + · exact hhit1 + · simpa using hhit2 + · omega + +theorem isClockwise3_rotate {v₁ v₂ v₃ : α} (h : Ω.IsClockwise3 v₁ v₂ v₃) : + Ω.IsClockwise3 v₂ v₃ v₁ := by + rw [isClockwise3_iff] at h ⊢ + rcases h with ⟨h12, h13, h23, hv1, hv2, hv3, hhit0, hhit1, hhit2⟩ + have hset : ({v₂, v₃, v₁} : Set α) = {v₁, v₂, v₃} := by + ext x; simp [or_comm, or_left_comm] + rw [hset] + exact ⟨h23, h12.symm, h13.symm, hv2, hv3, hv1, hhit1, hhit2, hhit0⟩ + +theorem not_firstHitIn_self {X : Set α} {x u : α} + (hx : x ∈ Ω.bar) (hu : u ∈ Ω.bar) (huX : u ∈ X) (hne : u ≠ x) : + ¬ Ω.FirstHitIn X x x := by + rintro ⟨k, hk1, hk_eq, _, hmin⟩ + obtain ⟨j, hj⟩ := Ω.single_orbit (Ω x) (Ω.toFun_mem hx) u hu + have hj_eq : (Ω.toFun^[j + 1]) x = u := by + rw [Function.iterate_succ_apply]; exact hj + have hmul : ∀ d : ℕ, (Ω.toFun^[k * d]) x = x := by + intro d + induction d with + | zero => rfl + | succ d ih => + rw [Nat.mul_succ, add_comm, Function.iterate_add_apply, ih, hk_eq] + have hrem : (Ω.toFun^[(j + 1) % k]) x = u := by + rw [← hj_eq] + conv_rhs => rw [← Nat.div_add_mod (j + 1) k, add_comm] + rw [Function.iterate_add_apply, hmul] + have hmod_lt : (j + 1) % k < k := Nat.mod_lt _ (Nat.zero_lt_of_lt hk1) + rcases Nat.eq_zero_or_pos ((j + 1) % k) with h0 | hpos + · rw [h0, Function.iterate_zero_apply] at hrem + exact hne hrem.symm + · exact hmin ((j + 1) % k) hpos hmod_lt (hrem ▸ huX) + +theorem FirstHitIn.inj_left {X : Set α} {x₁ x₂ z : α} + (hx₁ : x₁ ∈ Ω.bar) (hx₂ : x₂ ∈ Ω.bar) (hx₁X : x₁ ∈ X) (hx₂X : x₂ ∈ X) + (h₁ : Ω.FirstHitIn X x₁ z) (h₂ : Ω.FirstHitIn X x₂ z) : x₁ = x₂ := by + rcases h₁ with ⟨k₁, hk₁, rfl, _, hmin₁⟩ + rcases h₂ with ⟨k₂, hk₂, heq, _, hmin₂⟩ + rcases lt_trichotomy k₁ k₂ with hlt | rfl | hgt + · have hd_pos : 1 ≤ k₂ - k₁ := Nat.le_sub_of_add_le (by omega) + have hd_lt : k₂ - k₁ < k₂ := Nat.sub_lt (by omega) (by omega) + have hiter : (Ω.toFun^[k₁]) ((Ω.toFun^[k₂ - k₁]) x₂) = (Ω.toFun^[k₁]) x₁ := by + rw [← Function.iterate_add_apply, Nat.add_sub_of_le (le_of_lt hlt), heq] + have hmid := Ω.injOn_iterate k₁ (Ω.iterate_mem (k₂ - k₁) hx₂) hx₁ hiter + exact (hmin₂ (k₂ - k₁) hd_pos hd_lt (hmid ▸ hx₁X)).elim + · exact Ω.injOn_iterate k₁ hx₁ hx₂ heq.symm + · have hd_pos : 1 ≤ k₁ - k₂ := Nat.le_sub_of_add_le (by omega) + have hd_lt : k₁ - k₂ < k₁ := Nat.sub_lt (by omega) (by omega) + have hiter : (Ω.toFun^[k₂]) ((Ω.toFun^[k₁ - k₂]) x₁) = (Ω.toFun^[k₂]) x₂ := by + rw [← Function.iterate_add_apply, Nat.add_sub_of_le (le_of_lt hgt), ← heq] + have hmid := Ω.injOn_iterate k₂ (Ω.iterate_mem (k₁ - k₂) hx₁) hx₂ hiter + exact (hmin₁ (k₁ - k₂) hd_pos hd_lt (hmid ▸ hx₂X)).elim + +theorem isClockwise3_trichotomy {v₁ v₂ v₃ : α} + (hv₁ : v₁ ∈ Ω.bar) (hv₂ : v₂ ∈ Ω.bar) (hv₃ : v₃ ∈ Ω.bar) + (h12 : v₁ ≠ v₂) (h13 : v₁ ≠ v₃) (h23 : v₂ ≠ v₃) : + (Ω.IsClockwise3 v₁ v₂ v₃ ∧ ¬ Ω.IsClockwise3 v₁ v₃ v₂) ∨ + (Ω.IsClockwise3 v₁ v₃ v₂ ∧ ¬ Ω.IsClockwise3 v₁ v₂ v₃) := by + have hne1 : (Ω.bar ∩ ({v₁, v₂, v₃} : Set α)).Nonempty := ⟨v₁, hv₁, by simp⟩ + obtain ⟨y₁, hy₁⟩ := Ω.exists_firstHitIn hv₁ hne1 + obtain ⟨y₂, hy₂⟩ := Ω.exists_firstHitIn hv₂ hne1 + obtain ⟨y₃, hy₃⟩ := Ω.exists_firstHitIn hv₃ hne1 + have hy₁_ne : y₁ ≠ v₁ := fun h => + Ω.not_firstHitIn_self hv₁ hv₂ (by simp) h12.symm (h ▸ hy₁) + have hy₂_ne : y₂ ≠ v₂ := fun h => + Ω.not_firstHitIn_self hv₂ hv₃ (by simp) h23.symm (h ▸ hy₂) + have hy₃_ne : y₃ ≠ v₃ := fun h => + Ω.not_firstHitIn_self hv₃ hv₁ (by simp) h13 (h ▸ hy₃) + have hy₁_mem := hy₁.mem_set + simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hy₁_mem + rcases hy₁_mem with h | h | h + · exact (hy₁_ne h).elim + · rw [h] at hy₁ + have hy₃_mem := hy₃.mem_set + simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hy₃_mem + have hy₃_eq : y₃ = v₁ := by + rcases hy₃_mem with h3 | h3 | h3 + · exact h3 + · rw [h3] at hy₃ + exact (h13 (hy₁.inj_left hv₁ hv₃ (by simp) (by simp) hy₃)).elim + · exact (hy₃_ne h3).elim + rw [hy₃_eq] at hy₃ + have hy₂_mem := hy₂.mem_set + simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hy₂_mem + have hy₂_eq : y₂ = v₃ := by + rcases hy₂_mem with h2 | h2 | h2 + · rw [h2] at hy₂ + exact (h23 (hy₂.inj_left hv₂ hv₃ (by simp) (by simp) hy₃)).elim + · exact (hy₂_ne h2).elim + · exact h2 + rw [hy₂_eq] at hy₂ + left + refine ⟨isClockwise3_iff.2 ⟨h12, h13, h23, hv₁, hv₂, hv₃, hy₁, hy₂, hy₃⟩, ?_⟩ + rw [isClockwise3_iff] + rintro ⟨_, _, _, _, _, _, hhit0', _, _⟩ + have hset : ({v₁, v₃, v₂} : Set α) = {v₁, v₂, v₃} := by + ext x; simp [or_comm] + rw [hset] at hhit0' + exact h23 (hy₁.unique hhit0') + · rw [h] at hy₁ + have hy₂_mem := hy₂.mem_set + simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hy₂_mem + have hy₂_eq : y₂ = v₁ := by + rcases hy₂_mem with h2 | h2 | h2 + · exact h2 + · exact (hy₂_ne h2).elim + · rw [h2] at hy₂ + exact (h12 (hy₁.inj_left hv₁ hv₂ (by simp) (by simp) hy₂)).elim + rw [hy₂_eq] at hy₂ + have hy₃_mem := hy₃.mem_set + simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hy₃_mem + have hy₃_eq : y₃ = v₂ := by + rcases hy₃_mem with h3 | h3 | h3 + · rw [h3] at hy₃ + exact (h23 (hy₂.inj_left hv₂ hv₃ (by simp) (by simp) hy₃)).elim + · exact h3 + · exact (hy₃_ne h3).elim + rw [hy₃_eq] at hy₃ + right + have hset : ({v₁, v₃, v₂} : Set α) = {v₁, v₂, v₃} := by + ext x; simp [or_comm] + refine ⟨isClockwise3_iff.2 ⟨h13, h12, h23.symm, hv₁, hv₃, hv₂, ?_, ?_, ?_⟩, ?_⟩ + · rwa [hset] + · rwa [hset] + · rwa [hset] + · rw [isClockwise3_iff] + rintro ⟨_, _, _, _, _, _, hhit0', _, _⟩ + exact h23 (hhit0'.unique hy₁) + +theorem interval_subset_bar (v₁ v₂ : α) : Ω.interval v₁ v₂ ⊆ Ω.bar := + fun _ hv => hv.1.1 + +theorem not_mem_interval_left (v₁ v₂ : α) : v₁ ∉ Ω.interval v₁ v₂ := + fun hv => hv.1.2 (by simp) + +theorem not_mem_interval_right (v₁ v₂ : α) : v₂ ∉ Ω.interval v₁ v₂ := + fun hv => hv.1.2 (by simp) + +theorem disjoint_interval_swap (v₁ v₂ : α) : + Disjoint (Ω.interval v₁ v₂) (Ω.interval v₂ v₁) := by + rw [Set.disjoint_left] + intro v hv₁ hv₂ + have h1 := hv₁.2 + have h2 := isClockwise3_rotate (isClockwise3_rotate hv₂.2) + have htri := isClockwise3_trichotomy + (isClockwise3_iff.1 h1).2.2.2.1 + (isClockwise3_iff.1 h1).2.2.2.2.1 + (isClockwise3_iff.1 h1).2.2.2.2.2.1 + (isClockwise3_iff.1 h1).1 + (isClockwise3_iff.1 h1).2.1 + (isClockwise3_iff.1 h1).2.2.1 + rcases htri with ⟨_, hnot⟩ | ⟨_, hnot⟩ + · exact hnot h2 + · exact hnot h1 + +theorem mem_interval_or_interval_swap {v₁ v₂ v : α} + (hv₁ : v₁ ∈ Ω.bar) (hv₂ : v₂ ∈ Ω.bar) (hv : v ∈ Ω.bar) + (h12 : v₁ ≠ v₂) (hv1 : v ≠ v₁) (hv2 : v ≠ v₂) : + v ∈ Ω.interval v₁ v₂ ∨ v ∈ Ω.interval v₂ v₁ := by + rcases isClockwise3_trichotomy hv₁ hv hv₂ hv1.symm h12 hv2 with ⟨h1, _⟩ | ⟨h2, _⟩ + · left; exact ⟨⟨hv, by simp [hv1, hv2]⟩, h1⟩ + · right; exact ⟨⟨hv, by simp [hv1, hv2]⟩, isClockwise3_rotate h2⟩ + +theorem interval_union_interval_swap {v₁ v₂ : α} + (hv₁ : v₁ ∈ Ω.bar) (hv₂ : v₂ ∈ Ω.bar) (h12 : v₁ ≠ v₂) : + Ω.interval v₁ v₂ ∪ Ω.interval v₂ v₁ = Ω.bar \ {v₁, v₂} := by + ext v + constructor + · rintro (hv | hv) + · exact hv.1 + · refine ⟨hv.1.1, ?_⟩ + simp only [Set.mem_insert_iff, Set.mem_singleton_iff] + rintro (rfl | rfl) + · exact hv.1.2 (by simp) + · exact hv.1.2 (by simp) + · rintro ⟨hv, hne⟩ + simp only [Set.mem_insert_iff, Set.mem_singleton_iff, not_or] at hne + exact mem_interval_or_interval_swap hv₁ hv₂ hv h12 hne.1 hne.2 + +end CyclicPerm + +/-! ## Paths, `X → Y` paths, avoiding, and catching -/ + +theorem IsGraphPathWithEnds.vertexSet_finite {G P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) : V(P).Finite := by + classical + rcases hP with ⟨_, W, _, hV, _⟩ + rw [hV] + exact W.support.toFinset.finite_toSet.subset fun x hx => List.mem_toFinset.2 hx + +theorem IsGraphPathWithEnds.edgeSet_finite {G P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) : E(P).Finite := by + classical + rcases hP with ⟨_, W, _, _, hE⟩ + rw [hE] + exact W.edges.toFinset.finite_toSet.subset fun e he => List.mem_toFinset.2 he + +theorem le_deleteVertices {G H : Graph α β} {Z : Set α} (hHG : H ≤ G) + (hdisj : Disjoint V(H) Z) : H ≤ deleteVertices G Z := by + rw [(Compatible.of_le_le hHG (deleteVertices_le G Z)).le_iff] + refine ⟨subset_sdiff.mpr ⟨hHG.vertexSet_mono, hdisj⟩, fun e he => ?_⟩ + obtain ⟨x, y, hxy⟩ := H.exists_isLink_of_mem_edgeSet he + exact ⟨x, y, (deleteVertices_isLink G Z).mpr + ⟨hxy.mono hHG, disjoint_left.mp hdisj hxy.left_mem, disjoint_left.mp hdisj hxy.right_mem⟩⟩ + +theorem IsGraphPathWithEnds.le_deleteVertices {G P : Graph α β} {a b : α} {Z : Set α} + (hP : IsGraphPathWithEnds G P a b) (hav : Avoids P Z) : + P ≤ deleteVertices G Z := + GraphMinor.GM09.le_deleteVertices hP.1 hav.symm + +theorem IsGraphPathWithEnds.in_deleteVertices {G P : Graph α β} {a b : α} {Z : Set α} + (hP : IsGraphPathWithEnds G P a b) (hav : Avoids P Z) : + IsGraphPathWithEnds (deleteVertices G Z) P a b := + hP.of_le (hP.le_deleteVertices hav) + +/-- Any path `P` in `G` from `u ∈ X` to `v ∈ Y` contains an `X → Y` subpath `Q ≤ P`. -/ +theorem IsGraphPathWithEnds.exists_isFromToPathWithEnds {G P : Graph α β} {u v : α} + (hP : IsGraphPathWithEnds G P u v) {X Y : Set α} (hu : u ∈ X) (hv : v ∈ Y) : + ∃ x ∈ X, ∃ y ∈ Y, ∃ Q : Graph α β, + Q ≤ P ∧ IsFromToPathWithEnds G Q X Y x y := by + classical + have hind : ∀ (n : ℕ) {a b : α} {P₁ : Graph α β}, + IsGraphPathWithEnds G P₁ a b → P₁ ≤ P → V(P₁).ncard = n → a ∈ X → b ∈ Y → + ∃ x ∈ X, ∃ y ∈ Y, ∃ Q : Graph α β, + Q ≤ P ∧ IsFromToPathWithEnds G Q X Y x y := by + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro a b P₁ hP₁ hP₁P hcard ha hb + have hfin : V(P₁).Finite := hP₁.vertexSet_finite + by_cases hhitX : ∃ z ∈ V(P₁), z ∈ X ∧ z ≠ a + · rcases hhitX with ⟨z, hzP, hzX, hza⟩ + obtain ⟨Q₁, Q₂, hQ₁P₁, hQ₂P₁, _, hQ₂, _, hinter, _⟩ := hP₁.exists_split_at hzP + have ha_not_Q₂ : a ∉ V(Q₂) := by + intro haQ₂ + have ha_in : a ∈ V(Q₁) ∩ V(Q₂) := ⟨( ‹IsGraphPathWithEnds P₁ Q₁ a z› ).left_mem, haQ₂⟩ + rw [hinter, mem_singleton_iff] at ha_in + exact hza ha_in.symm + have hlt : V(Q₂).ncard < n := by + rw [← hcard] + exact Set.ncard_lt_ncard ⟨hQ₂P₁.vertexSet_mono, fun hsub => ha_not_Q₂ + (hsub hP₁.left_mem)⟩ hfin + exact ih V(Q₂).ncard hlt (hQ₂.mono hP₁.le) (hQ₂P₁.trans hP₁P) rfl hzX hb + · by_cases hhitY : ∃ z ∈ V(P₁), z ∈ Y ∧ z ≠ b + · rcases hhitY with ⟨z, hzP, hzY, hzb⟩ + obtain ⟨Q₁, Q₂, hQ₁P₁, _, hQ₁, hQ₂, _, hinter, _⟩ := hP₁.exists_split_at hzP + have hb_not_Q₁ : b ∉ V(Q₁) := by + intro hbQ₁ + have hb_in : b ∈ V(Q₁) ∩ V(Q₂) := ⟨hbQ₁, hQ₂.right_mem⟩ + rw [hinter, mem_singleton_iff] at hb_in + exact hzb hb_in.symm + have hlt : V(Q₁).ncard < n := by + rw [← hcard] + exact Set.ncard_lt_ncard ⟨hQ₁P₁.vertexSet_mono, fun hsub => hb_not_Q₁ + (hsub hP₁.right_mem)⟩ hfin + exact ih V(Q₁).ncard hlt (hQ₁.mono hP₁.le) (hQ₁P₁.trans hP₁P) rfl ha hzY + · refine ⟨a, ha, b, hb, P₁, hP₁P, hP₁, ?_, ?_⟩ + · ext z + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hzP, hzX⟩ => by_contra fun hne => hhitX ⟨z, hzP, hzX, hne⟩, + fun h => h ▸ ⟨hP₁.left_mem, ha⟩⟩ + · ext z + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hzP, hzY⟩ => by_contra fun hne => hhitY ⟨z, hzP, hzY, hne⟩, + fun h => h ▸ ⟨hP₁.right_mem, hb⟩⟩ + exact hind V(P).ncard hP le_rfl rfl hu hv + +/-- Every walk `W` in `G` from `u ∈ X` to `v ∈ Y` contains an `X → Y` path `Q ≤ walkSubgraph W`. -/ +theorem exists_isFromToPathWithEnds_of_walk {G : Graph α β} {u v : α} + (W : GraphWalk G u v) {X Y : Set α} (hu : u ∈ X) (hv : v ∈ Y) : + ∃ x ∈ X, ∃ y ∈ Y, ∃ Q : Graph α β, + Q ≤ walkSubgraph W ∧ + V(Q) ⊆ {z | z ∈ W.support} ∧ + IsFromToPathWithEnds G Q X Y x y := by + obtain ⟨W₀, hW₀, hsupp, hedges⟩ := exists_isSimple_subwalk W + have hle : walkSubgraph W₀ ≤ walkSubgraph W := by + rw [(Compatible.of_le_le (walkSubgraph_le W₀) (walkSubgraph_le W)).le_iff] + rw [vertexSet_walkSubgraph, vertexSet_walkSubgraph, edgeSet_walkSubgraph, edgeSet_walkSubgraph] + exact ⟨hsupp, hedges⟩ + obtain ⟨x, hx, y, hy, Q, hQP₀, hQ⟩ := + (isGraphPathWithEnds_walkSubgraph hW₀).exists_isFromToPathWithEnds hu hv + refine ⟨x, hx, y, hy, Q, hQP₀.trans hle, ?_, hQ⟩ + have hsub := (hQP₀.trans hle).vertexSet_mono + rwa [vertexSet_walkSubgraph] at hsub + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Bridge.lean b/LeanPool/GraphMinor/GM09/Bridge.lean new file mode 100644 index 0000000000..2959e98384 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Bridge.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Cited +public import LeanPool.GraphMinor.GM15.Cited +public import LeanPool.GraphMinor.GM16.Cited +import LeanPool.GraphMinor.GM09.Section7 +import LeanPool.GraphMinor.GM09.Section8 +import LeanPool.GraphMinor.GM09.Section9 +import LeanPool.GraphMinor.GM09.Section10 +import LeanPool.GraphMinor.GM09.Section10g +import LeanPool.GraphMinor.GM09.Section11d + +/-! +# Graph Minors IX: Bridge to Cited Statements in XIV, XV, and XVI + +This file proves the cited statements from *Graph Minors. IX. Disjoint crossed paths* +used in later papers: +- `GM14.GM09Theorem91Statement` ((9.1), cited in XIV) +- `GM14.GM09Theorem104Statement` ((10.4), cited in XIV) +- `GM15.GM09Theorem71Statement` ((7.1), cited in XV) +- `GM15.GM09Theorem81Statement` ((8.1), nonempty-boundary case cited in XV and XVI) +- `GM15.GM09Theorem1111Statement` ((11.11), cited in XV) +- `GM16.GM09Theorem105Statement` ((10.5), cited in XVI) +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +universe u v + +theorem gm14_theorem_9_1 : GM14.GM09Theorem91Statement.{u, v} := + fun _ _ _ _ _ hrural hcomp hcr hp => + theorem_9_1_proof hcomp hrural hcr hp + +theorem gm15_theorem_7_1 : GM15.GM09Theorem71Statement.{u, v} := + fun S _ _ _ _ hφ hτ₁ hτ₂ hcr hcard => + S.theorem_7_1_proof hφ hτ₁ hτ₂ hcr hcard + +theorem gm15_theorem_8_1 : GM15.GM09Theorem81Statement.{u, v} := + fun S k hne hvortex => + GraphMinor.GM09.theorem_8_1_proof S (Or.inl hne) k hvortex + +theorem gm14_theorem_10_4 : GM14.GM09Theorem104Statement.{u, v} := + fun _S_comp _S₀ _N _p _X _P_set hp2 hp3 _hrural hbreadth hX hcard hcomp hcr hp => + theorem_10_4_proof hp2 hp3 hbreadth hX hcard hcomp hcr hp + +theorem gm16_theorem_10_5 : GM16.GM09Theorem105Statement.{u, v} := + fun _ _ _ _ _ _ hrural hbreadth hX hpX hcomp hY => + theorem_10_5_proof hrural hbreadth hX hpX hcomp hY + +theorem gm15_theorem_11_11 : GM15.GM09Theorem1111Statement.{u, v} := + fun S p hp2 hp3 hno_crooked => theorem_11_11_proof S p hp2 hp3 hno_crooked + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/CircleCut.lean b/LeanPool/GraphMinor/GM09/CircleCut.lean new file mode 100644 index 0000000000..cb21d07bec --- /dev/null +++ b/LeanPool/GraphMinor/GM09/CircleCut.lean @@ -0,0 +1,377 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Lawns + +/-! +# Points on a circle in a list, and fences + +We list a finite set of points of an `O`-arc by their angle, which gives a cyclic permutation that +agrees with the arc. A fence of this permutation with both sides nonempty is cut by two points of +the arc into two arcs, one for each side. This is how we read the fences of the wall, for the park +of Graph Minors IX, page 68. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +universe u v + +variable {α : Type u} {β : Type v} + +theorem circle_exp_ne {s t : ℝ} (h₁ : s < t) (h₂ : t < s + 2 * Real.pi) : + Circle.exp s ≠ Circle.exp t := by + have hmem : s ∈ Ico s (s + 2 * Real.pi) := ⟨le_rfl, by linarith [Real.pi_pos]⟩ + exact fun h => h₁.ne + (Circle.exp_injOn_Ico (a := s) (b := s + 2 * Real.pi) (by simp) + hmem ⟨h₁.le, h₂⟩ h) + +theorem exists_angle_mem_Ico (u : ℝ) (z : Circle) : + ∃ t ∈ Ico u (u + 2 * Real.pi), Circle.exp t = z := + GraphMinor.Surface.exists_circleExp_mem_Ico u z + +/-- Finitely many points of an `O`-arc, listed in the order of their angles. -/ +theorem exists_sorted_list {C : Set EuclideanPlane} (φ : Circle ≃ₜ C) {K : Set α} (hK : K.Finite) + (hne : K.Nonempty) {ν : α → EuclideanPlane} (hinj : InjOn ν K) (hmem : ∀ v ∈ K, ν v ∈ C) : + ∃ (L : List α) (θ : α → ℝ), L.Nodup ∧ L ≠ [] ∧ {v | v ∈ L} = K ∧ IsValidAngle L θ ∧ + ∀ v ∈ K, (φ (Circle.exp (θ v))).1 = ν v := by + classical + let θ : α → ℝ := fun v => if h : ν v ∈ C then Complex.arg (φ.symm ⟨ν v, h⟩ : Circle) else 0 + have hexp : ∀ v ∈ K, (φ (Circle.exp (θ v))).1 = ν v := by + intro v hv + simp only [θ, hmem v hv, ↓reduceDIte, Circle.exp_arg, Homeomorph.apply_symm_apply] + have hrange : ∀ v ∈ K, -Real.pi < θ v ∧ θ v ≤ Real.pi := by + intro v hv + simp only [θ, hmem v hv, ↓reduceDIte] + exact ⟨Complex.neg_pi_lt_arg _, Complex.arg_le_pi _⟩ + have hθinj : InjOn θ K := fun u hu v hv h => hinj hu hv (by rw [← hexp u hu, ← hexp v hv, h]) + let r : α → α → Prop := fun u v => θ u ≤ θ v + have : DecidableRel r := Classical.decRel _ + have : Std.Total r := ⟨fun u v => le_total _ _⟩ + have : IsTrans α r := ⟨fun _ _ _ => le_trans⟩ + let L₀ := hK.toFinset.toList + let L := L₀.insertionSort r + have hmemL : ∀ v, v ∈ L ↔ v ∈ K := by + intro v + simp [L, L₀, List.mem_insertionSort] + have hnd : L.Nodup := (List.perm_insertionSort r L₀).nodup_iff.mpr (Finset.nodup_toList _) + have hpw : L.Pairwise r := List.pairwise_insertionSort r L₀ + have hL_ne : L ≠ [] := by + obtain ⟨v, hv⟩ := hne + intro h + have := (hmemL v).mpr hv + simp [h] at this + refine ⟨L, θ, hnd, hL_ne, by ext v; exact hmemL v, ⟨?_, ?_⟩, hexp⟩ + · intro i j hi hj hij + have hle : θ (L[i]'hi) ≤ θ (L[j]'hj) := List.pairwise_iff_getElem.mp hpw i j hi hj hij + refine lt_of_le_of_ne hle fun h => ?_ + have := hθinj ((hmemL _).mp (List.getElem_mem hi)) ((hmemL _).mp (List.getElem_mem hj)) h + have h₂ := (List.Nodup.getElem_inj_iff hnd).mp this + omega + · intro i hi + have h₁ := hrange _ ((hmemL _).mp (List.getElem_mem hi)) + have h₂ := hrange _ ((hmemL _).mp (List.getElem_mem (Nat.zero_lt_of_lt hi))) + linarith + +theorem exists_min_max_index (L : List α) (S : Set α) (hne : ∃ v ∈ S, v ∈ L) : + ∃ (i₀ i₁ : ℕ) (h₀ : i₀ < L.length) (h₁ : i₁ < L.length), i₀ ≤ i₁ ∧ L[i₀] ∈ S ∧ L[i₁] ∈ S ∧ + ∀ (i : ℕ) (hi : i < L.length), L[i] ∈ S → i₀ ≤ i ∧ i ≤ i₁ := by + classical + let I : Finset ℕ := (Finset.range L.length).filter fun i => ∃ h : i < L.length, L[i] ∈ S + have hI : I.Nonempty := by + obtain ⟨v, hv, hvL⟩ := hne + obtain ⟨i, hi, rfl⟩ := List.mem_iff_getElem.mp hvL + exact ⟨i, Finset.mem_filter.mpr ⟨Finset.mem_range.mpr hi, hi, hv⟩⟩ + have h₀ := Finset.min'_mem I hI + have h₁ := Finset.max'_mem I hI + obtain ⟨-, h₀', h₀S⟩ := Finset.mem_filter.mp h₀ + obtain ⟨-, h₁', h₁S⟩ := Finset.mem_filter.mp h₁ + refine ⟨I.min' hI, I.max' hI, h₀', h₁', Finset.min'_le _ _ h₁, h₀S, h₁S, fun i hi hS => ?_⟩ + have hm : i ∈ I := Finset.mem_filter.mpr ⟨Finset.mem_range.mpr hi, hi, hS⟩ + exact ⟨Finset.min'_le _ _ hm, Finset.le_max' _ _ hm⟩ + +/-- Angles for a block of consecutive list entries and for the rest of the list. -/ +theorem block_angles {L : List α} {θ : α → ℝ} (hθ : IsValidAngle L θ) {S T : Set α} + {i₀ i₁ : ℕ} {h₀ : i₀ < L.length} {h₁ : i₁ < L.length} (h01 : i₀ ≤ i₁) + (hS : ∀ (i : ℕ) (hi : i < L.length), L[i] ∈ S → i₀ ≤ i ∧ i ≤ i₁) + (hT : ∀ (j : ℕ) (hj : j < L.length), L[j] ∈ T → j < i₀ ∨ i₁ < j) + (hTne : ∃ v ∈ T, v ∈ L) : + ∃ u s₁ s₂ v s₃ s₄ : ℝ, u < s₁ ∧ s₁ ≤ s₂ ∧ s₂ < v ∧ v < s₃ ∧ s₃ ≤ s₄ ∧ s₄ < u + 2 * Real.pi ∧ + (∀ a ∈ S, a ∈ L → ∃ t ∈ Icc s₁ s₂, Circle.exp t = Circle.exp (θ a)) ∧ + (∀ b ∈ T, b ∈ L → ∃ t ∈ Icc s₃ s₄, Circle.exp t = Circle.exp (θ b)) := by + classical + have hpi := Real.pi_pos + have hmono : ∀ (i j : ℕ) (hi : i < L.length) (hj : j < L.length), i ≤ j → + θ L[i] ≤ θ L[j] := by + intro i j hi hj hij + rcases hij.eq_or_lt with rfl | h + · exact le_rfl + · exact (hθ.1 i j hi hj h).le + set s₁ := θ (L[i₀]'h₀) with hs₁ + set s₂ := θ (L[i₁]'h₁) with hs₂ + have h12 : s₁ ≤ s₂ := hmono _ _ h₀ h₁ h01 + have hpos : 0 < L.length := Nat.zero_lt_of_lt h₀ + have hrep : ∀ b ∈ T ∩ {v | v ∈ L}, ∃ t, s₂ < t ∧ t < s₁ + 2 * Real.pi ∧ + Circle.exp t = Circle.exp (θ b) := by + rintro b ⟨hb, hbL⟩ + obtain ⟨j, hj, rfl⟩ := List.mem_iff_getElem.mp hbL + rcases hT j hj hb with h | h + · refine ⟨θ L[j] + 2 * Real.pi, ?_, ?_, ?_⟩ + · have h₃ := hθ.2 i₁ h₁ + have h₄ := hmono 0 j hpos hj (Nat.zero_le _) + linarith + · have := hθ.1 j i₀ hj h₀ h + linarith + · exact Circle.exp_eq_exp.mpr ⟨1, by push_cast; ring⟩ + · refine ⟨θ L[j], hθ.1 _ _ h₁ hj h, ?_, rfl⟩ + have h₃ := hθ.2 j hj + have h₄ := hmono 0 i₀ hpos h₀ (Nat.zero_le _) + linarith + choose! τ hτ₁ hτ₂ hτ₃ using hrep + have hfin : (T ∩ {v | v ∈ L}).Finite := (List.finite_toSet L).subset inter_subset_right + obtain ⟨b₀, hb₀⟩ := hTne + have hne : (T ∩ {v | v ∈ L}).Nonempty := ⟨b₀, hb₀⟩ + obtain ⟨b₁, hb₁, hmin⟩ := exists_min_image _ τ hfin hne + obtain ⟨b₂, hb₂, hmax⟩ := exists_max_image _ τ hfin hne + have hb₁₂ := hmin b₂ hb₂ + have h₅ := hτ₁ b₁ hb₁ + have h₆ := hτ₂ b₂ hb₂ + refine ⟨(τ b₂ - 2 * Real.pi + s₁) / 2, s₁, s₂, (s₂ + τ b₁) / 2, τ b₁, τ b₂, by linarith, h12, + by linarith, by linarith, hb₁₂, by linarith, ?_, ?_⟩ + · intro a ha haL + obtain ⟨i, hi, rfl⟩ := List.mem_iff_getElem.mp haL + obtain ⟨h₇, h₈⟩ := hS i hi ha + exact ⟨θ L[i], ⟨hmono _ _ h₀ hi h₇, hmono _ _ hi h₁ h₈⟩, rfl⟩ + · intro b hb hbL + exact ⟨τ b, ⟨hmin b ⟨hb, hbL⟩, hmax b ⟨hb, hbL⟩⟩, hτ₃ b ⟨hb, hbL⟩⟩ + +/-- A fence of a listed cyclic permutation with both sides nonempty sits in two arcs of angles. -/ +theorem exists_fence_angles {L : List α} (hnd : L.Nodup) (hne : L ≠ []) {θ : α → ℝ} + (hθ : IsValidAngle L θ) {A B : Set α} (hF : (CyclicPerm.ofNodupList L hnd hne).IsFence A B) + (hA : A.Nonempty) (hB : B.Nonempty) : + ∃ u s₁ s₂ v s₃ s₄ : ℝ, u < s₁ ∧ s₁ ≤ s₂ ∧ s₂ < v ∧ v < s₃ ∧ s₃ ≤ s₄ ∧ s₄ < u + 2 * Real.pi ∧ + (∀ a ∈ A, ∃ t ∈ Icc s₁ s₂, Circle.exp t = Circle.exp (θ a)) ∧ + (∀ b ∈ B, ∃ t ∈ Icc s₃ s₄, Circle.exp t = Circle.exp (θ b)) := by + obtain ⟨hAb, hBb, hd, -, hno⟩ := hF + have hAL : ∀ a ∈ A, a ∈ L := fun a ha => hAb ha + have hBL : ∀ b ∈ B, b ∈ L := fun b hb => hBb hb + obtain ⟨a₀, ha₀⟩ := hA + obtain ⟨b₀, hb₀⟩ := hB + obtain ⟨i₀, i₁, h₀, h₁, h01, hi₀, hi₁, hSA⟩ := exists_min_max_index L A ⟨a₀, ha₀, hAL a₀ ha₀⟩ + have hnotA : ∀ (j : ℕ) (hj : j < L.length), L[j] ∈ B → j ≠ i₀ ∧ j ≠ i₁ := by + intro j hj hb + constructor + · rintro rfl + exact disjoint_left.mp hd hi₀ hb + · rintro rfl + exact disjoint_left.mp hd hi₁ hb + have hnoc : ∀ (p q r s : ℕ) (h₁ : p < q) (hq : q < L.length) (h₂ : r < s) (hs : s < L.length), + L[p] ∈ A → L[q] ∈ A → L[r] ∈ B → L[s] ∈ B → + ¬ ((p < r ∧ r < q ∧ q < s) ∨ (r < p ∧ p < s ∧ s < q)) := by + intro p q r s hpq hq hrs hs hp hq' hr hs' hc + have hne₁ : L[p] ≠ L[q] := fun h => by + have := (List.Nodup.getElem_inj_iff hnd).mp h + omega + have hne₂ : L[r] ≠ L[s] := fun h => by + have := (List.Nodup.getElem_inj_iff hnd).mp h + omega + exact hno _ hp _ hq' hne₁ _ hr _ hs' hne₂ + ((CyclicPerm.ofNodupList_crosses_iff L hnd hne hpq hq hrs hs).mpr hc) + by_cases hin : ∃ (j : ℕ) (hj : j < L.length), L[j] ∈ B ∧ i₀ < j ∧ j < i₁ + · obtain ⟨j, hj, hjB, hj₀, hj₁⟩ := hin + have hinside : ∀ (j' : ℕ) (hj' : j' < L.length), L[j'] ∈ B → i₀ < j' ∧ j' < i₁ := by + intro j' hj' hb + obtain ⟨h₂, h₃⟩ := hnotA j' hj' hb + by_contra hn + have hcases : j' < i₀ ∨ i₁ < j' := by omega + rcases hcases with h | h + · exact hnoc i₀ i₁ j' j (by omega) h₁ (by omega) hj hi₀ hi₁ hb hjB (Or.inr ⟨h, by omega, + by omega⟩) + · exact hnoc i₀ i₁ j j' (by omega) h₁ (by omega) hj' hi₀ hi₁ hjB hb (Or.inl ⟨by omega, + by omega, h⟩) + obtain ⟨j₀, j₁, h₂, h₃, h23, hj₀B, hj₁B, hSB⟩ := exists_min_max_index L B ⟨b₀, hb₀, hBL b₀ hb₀⟩ + have hblock : ∀ (i : ℕ) (hi : i < L.length), L[i] ∈ A → i < j₀ ∨ j₁ < i := by + intro i hi ha + have hne₁ : i ≠ j₀ := by + rintro rfl + exact disjoint_left.mp hd ha hj₀B + have hne₂ : i ≠ j₁ := by + rintro rfl + exact disjoint_left.mp hd ha hj₁B + by_contra hn + have h₄ := (hinside j₀ h₂ hj₀B).1 + have h₅ := hSA i hi ha + exact hnoc i₀ i j₀ j₁ (by omega) hi (by omega) h₃ hi₀ ha hj₀B hj₁B + (Or.inl ⟨by omega, by omega, by omega⟩) + obtain ⟨u, s₁, s₂, v, s₃, s₄, h₅, h₆, h₇, h₈, h₉, h₁₀, h₁₁, h₁₂⟩ := + block_angles (S := B) (T := A) hθ (h₀ := h₂) (h₁ := h₃) h23 hSB hblock + ⟨a₀, ha₀, hAL a₀ ha₀⟩ + refine ⟨v, s₃, s₄, u + 2 * Real.pi, s₁ + 2 * Real.pi, s₂ + 2 * Real.pi, by linarith, h₉, h₁₀, + by linarith, by linarith, by linarith, fun a ha => h₁₂ a ha (hAL a ha), fun b hb => ?_⟩ + obtain ⟨t, ⟨ht₁, ht₂⟩, ht⟩ := h₁₁ b hb (hBL b hb) + refine ⟨t + 2 * Real.pi, ⟨by linarith, by linarith⟩, ?_⟩ + rw [← ht] + exact Circle.exp_eq_exp.mpr ⟨1, by push_cast; ring⟩ + · push Not at hin + have hblock : ∀ (j : ℕ) (hj : j < L.length), L[j] ∈ B → j < i₀ ∨ i₁ < j := by + intro j hj hb + obtain ⟨h₂, h₃⟩ := hnotA j hj hb + by_contra hn + have h₄ := hin j hj hb (by omega) + omega + obtain ⟨u, s₁, s₂, v, s₃, s₄, h₅, h₆, h₇, h₈, h₉, h₁₀, h₁₁, h₁₂⟩ := + block_angles (S := A) (T := B) hθ (h₀ := h₀) (h₁ := h₁) h01 hSA hblock + ⟨b₀, hb₀, hBL b₀ hb₀⟩ + exact ⟨u, s₁, s₂, v, s₃, s₄, h₅, h₆, h₇, h₈, h₉, h₁₀, fun a ha => h₁₁ a ha (hAL a ha), + fun b hb => h₁₂ b hb (hBL b hb)⟩ + +/-- Two arcs of a circle in the plane, given by angles, with two cut points between them. -/ +structure IsCircleCut (C X Y : Set EuclideanPlane) (p q : EuclideanPlane) : Prop where + compact_X : IsCompact X + compact_Y : IsCompact Y + conn_X : IsConnected X + conn_Y : IsConnected Y + disj : Disjoint X Y + X_sub : X ⊆ C + Y_sub : Y ⊆ C + p_mem : p ∈ C + q_mem : q ∈ C + p_X : p ∉ X + p_Y : p ∉ Y + q_X : q ∉ X + q_Y : q ∉ Y + sep : ∀ J : Set EuclideanPlane, IsPreconnected J → J ⊆ C → p ∉ J → q ∉ J → + (J ∩ X).Nonempty → (J ∩ Y).Nonempty → False + +theorem exists_isCircleCut {C : Set EuclideanPlane} (φ : Circle ≃ₜ C) {u s₁ s₂ v s₃ s₄ : ℝ} + (h₁ : u < s₁) (h₂ : s₁ ≤ s₂) (h₃ : s₂ < v) (h₄ : v < s₃) (h₅ : s₃ ≤ s₄) + (h₆ : s₄ < u + 2 * Real.pi) : + IsCircleCut C ((fun t => (φ (Circle.exp t)).1) '' Icc s₁ s₂) + ((fun t => (φ (Circle.exp t)).1) '' Icc s₃ s₄) + (φ (Circle.exp v)).1 (φ (Circle.exp u)).1 := by + let f : ℝ → EuclideanPlane := fun t => (φ (Circle.exp t)).1 + have hf : Continuous f := continuous_subtype_val.comp (φ.continuous.comp Circle.exp.continuous) + have hinj : ∀ {s t : ℝ}, s < t → t < s + 2 * Real.pi → f s ≠ f t := by + intro s t hst hts h + exact circle_exp_ne hst hts (φ.injective (Subtype.ext h)) + have hmem : ∀ t, f t ∈ C := fun t => (φ _).2 + have hper : f (u + 2 * Real.pi) = f u := by + change (φ _).1 = (φ _).1 + congr 2 + exact Circle.exp_eq_exp.mpr ⟨1, by push_cast; ring⟩ + refine ⟨isCompact_Icc.image hf, isCompact_Icc.image hf, + (isConnected_Icc h₂).image _ hf.continuousOn, (isConnected_Icc h₅).image _ hf.continuousOn, + ?_, ?_, ?_, hmem _, hmem _, ?_, ?_, ?_, ?_, ?_⟩ + · rw [disjoint_left] + rintro _ ⟨s, ⟨hs₁, hs₂⟩, rfl⟩ ⟨t, ⟨ht₁, ht₂⟩, ht⟩ + exact hinj (s := s) (t := t) (by linarith) (by linarith) ht.symm + · rintro _ ⟨t, -, rfl⟩ + exact hmem t + · rintro _ ⟨t, -, rfl⟩ + exact hmem t + · rintro ⟨t, ⟨ht₁, ht₂⟩, ht⟩ + exact hinj (s := t) (t := v) (by linarith) (by linarith) ht + · rintro ⟨t, ⟨ht₁, ht₂⟩, ht⟩ + exact hinj (s := v) (t := t) (by linarith) (by linarith) ht.symm + · rintro ⟨t, ⟨ht₁, ht₂⟩, ht⟩ + exact hinj (s := u) (t := t) (by linarith) (by linarith) ht.symm + · rintro ⟨t, ⟨ht₁, ht₂⟩, ht⟩ + have hq : f t = f (u + 2 * Real.pi) := Eq.trans ht hper.symm + exact hinj (s := t) (t := u + 2 * Real.pi) (by linarith) (by linarith) hq + · intro J hJ hJC hp hq ⟨x, hxJ, hxX⟩ ⟨y, hyJ, hyY⟩ + have hT₁ : IsClosed (f '' Icc u v) := (isCompact_Icc.image hf).isClosed + have hT₂ : IsClosed (f '' Icc v (u + 2 * Real.pi)) := (isCompact_Icc.image hf).isClosed + have hsub : J ⊆ f '' Icc u v ∪ f '' Icc v (u + 2 * Real.pi) := by + intro w hw + obtain ⟨t, ⟨ht₁, ht₂⟩, ht⟩ := exists_angle_mem_Ico u (φ.symm ⟨w, hJC hw⟩) + have hwf : f t = w := by + change (φ _).1 = w + rw [ht, Homeomorph.apply_symm_apply] + rcases le_total t v with h | h + · exact Or.inl ⟨t, ⟨ht₁, h⟩, hwf⟩ + · exact Or.inr ⟨t, ⟨h, ht₂.le⟩, hwf⟩ + have hx₁ : x ∈ f '' Icc u v := by + obtain ⟨t, ⟨ht₁, ht₂⟩, ht⟩ := hxX + exact ⟨t, ⟨by linarith, by linarith⟩, ht⟩ + have hy₂ : y ∈ f '' Icc v (u + 2 * Real.pi) := by + obtain ⟨t, ⟨ht₁, ht₂⟩, ht⟩ := hyY + exact ⟨t, ⟨by linarith, by linarith⟩, ht⟩ + obtain ⟨w, hwJ, ⟨s, ⟨hs₁, hs₂⟩, hsw⟩, ⟨t, ⟨ht₁, ht₂⟩, htw⟩⟩ := + isPreconnected_closed_iff.mp hJ _ _ hT₁ hT₂ hsub ⟨x, hxJ, hx₁⟩ ⟨y, hyJ, hy₂⟩ + have ht : f t = f s := htw.trans hsw.symm + have hwJ' : f s ∈ J := hsw ▸ hwJ + have hsu : s ≠ u := by + rintro rfl + exact hq hwJ' + have hsv : s ≠ v := by + rintro rfl + exact hp hwJ' + have htv : t ≠ v := by + rintro rfl + have h' : f t ∈ J := ht.symm ▸ hwJ' + exact hp h' + have htu : t ≠ u + 2 * Real.pi := by + rintro rfl + have h' : f u ∈ J := (ht.symm.trans hper) ▸ hwJ' + exact hq h' + have hs₃ : u < s := lt_of_le_of_ne hs₁ (Ne.symm hsu) + have hs₄ : s < v := lt_of_le_of_ne hs₂ hsv + have ht₃ : v < t := lt_of_le_of_ne ht₁ (Ne.symm htv) + have ht₄ : t < u + 2 * Real.pi := lt_of_le_of_ne ht₂ htu + exact hinj (s := s) (t := t) (by linarith) (by linarith) ht.symm + +/-- The cyclic permutation of a finite set of vertices drawn in an `O`-arc. Its fences with both +sides nonempty are cut by two points of the arc. -/ +theorem exists_cyclicPerm_of_oArc {G : Graph α β} (Γ : GraphDrawing G EuclideanPlane) + {C : Set EuclideanPlane} (φ : Circle ≃ₜ C) {K : Set α} (hK : K ⊆ V(G)) (hfin : K.Finite) + (hmem : ∀ v ∈ K, vertexPt Γ v ∈ C) : + ∃ Ω : CyclicPerm α, Ω.bar = K ∧ DrawingAgreesWithOArcHomeo Γ Ω C φ ∧ + ∀ A B : Set α, Ω.IsFence A B → A.Nonempty → B.Nonempty → + ∃ X Y p q, IsCircleCut C X Y p q ∧ (∀ a ∈ A, vertexPt Γ a ∈ X) ∧ + (∀ b ∈ B, vertexPt Γ b ∈ Y) := by + classical + have hsing : ∀ v ∈ K, graphDrawingVertexSet Γ v = {vertexPt Γ v} := fun v hv => + vertexSet_eq_vertexPt Γ (hK hv) + rcases K.eq_empty_or_nonempty with rfl | hne + · refine ⟨⟨∅, id, finite_empty, ⟨fun _ h => h, injOn_empty _, fun _ h => (h : _).elim⟩, + fun _ h => h.elim⟩, rfl, ⟨fun v hv => hv.elim, fun v₁ _ _ h => ?_⟩, fun A B hF hA => ?_⟩ + · exact (CyclicPerm.isClockwise3_iff.mp h).2.2.2.1.elim + · obtain ⟨a, ha⟩ := hA + exact (hF.1 ha).elim + obtain ⟨L, θ, hnd, hLne, hset, hθ, hexp⟩ := exists_sorted_list φ hfin hne + (ν := vertexPt Γ) ((vertexPt_injOn Γ).mono hK) hmem + have hbar : (CyclicPerm.ofNodupList L hnd hLne).bar = K := hset + refine ⟨CyclicPerm.ofNodupList L hnd hLne, hbar, ?_, ?_⟩ + · refine drawingAgrees_of_angles (CyclicPerm.isOrbitList_ofNodupList L hnd hLne) hθ φ ?_ ?_ + · intro v hv + rw [hsing v (hbar ▸ hv), singleton_subset_iff] + exact hmem v (hbar ▸ hv) + · intro v hv + rw [hsing v (hbar ▸ hv), hexp v (hbar ▸ hv)] + rfl + · intro A B hF hA hB + obtain ⟨u, s₁, s₂, v, s₃, s₄, h₁, h₂, h₃, h₄, h₅, h₆, hAt, hBt⟩ := + exists_fence_angles hnd hLne hθ hF hA hB + refine ⟨_, _, _, _, exists_isCircleCut φ h₁ h₂ h₃ h₄ h₅ h₆, fun a ha => ?_, fun b hb => ?_⟩ + · obtain ⟨t, ht, hte⟩ := hAt a ha + refine ⟨t, ht, ?_⟩ + change (φ (Circle.exp t)).1 = _ + rw [hte] + exact hexp a (hbar ▸ hF.1 ha) + · obtain ⟨t, ht, hte⟩ := hBt b hb + refine ⟨t, ht, ?_⟩ + change (φ (Circle.exp t)).1 = _ + rw [hte] + exact hexp b (hbar ▸ hF.2.1 hb) + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/CliqueDiscs.lean b/LeanPool/GraphMinor/GM09/CliqueDiscs.lean new file mode 100644 index 0000000000..ad42038906 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/CliqueDiscs.lean @@ -0,0 +1,521 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Park +public import LeanPool.GraphMinor.GM09.DiscPlacement +public import LeanPool.GraphMinor.GM09.Section11c + +/-! +# The discs of the small cliques + +The proof of (11.11) of Graph Minors IX chooses a closed disc for each clique of at most three +vertices of a rural neighborhood, so that two discs meet only at common vertices. The paper states +this in one sentence. Here is the argument. + +We only need discs for a family of cliques in which no clique contains another. A triangle in the +family bounds a region of the drawing with nothing inside, and we put a smaller disc in that region +that touches the boundary only at the three vertices. Then we thicken the edges in the family to +thin discs, one after another. A vertex forming a clique by itself lies in no other clique of the +family, so a small disc next to it meets none of the others. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +universe u + +variable {α : Type u} {N : Neighborhood α (Sym2 α)} + +/-- The facts about a presentation that the choice of discs uses: the drawing meets the boundary of +`Δ` and the disc `Δ₀` only in the vertices it should, and the graph is simple. -/ +structure IsTidyPresentation (P : Presentation N) : Prop where + bd_U : ∀ x ∈ P.Γ.drawing.U, x ∈ subBd P.Δ → ∃ v ∈ N.Ω.bar, x = vertexPt P.Γ v + Δ₀_U : ∀ x ∈ P.Γ.drawing.U, x ∈ P.Δ₀ → ∃ v ∈ N.Ω₀.bar, x = vertexPt P.Γ v + Δ₀_bd : P.Δ₀ ∩ subBd P.Δ ⊆ P.Γ.drawing.U + simple : IsSimpleGraph N.G + +/-- A closed disc whose boundary is in the drawing and whose interior misses the drawing and `Δ₀`, +with exactly the vertices of `K` on its boundary. -/ +structure IsEmptyRegion (P : Presentation N) (K : Set α) (E : Set EuclideanPlane) : Prop where + disc : IsClosedDisc E + sub : E ⊆ P.Δ + bd_U : discBd E ⊆ P.Γ.drawing.U + bd_iff : ∀ v ∈ V(N.G), vertexPt P.Γ v ∈ discBd E ↔ v ∈ K + int_U : Disjoint (interior E) P.Γ.drawing.U + int_Δ₀ : Disjoint (interior E) P.Δ₀ + +/-- The family of cliques for which we want discs. -/ +structure IsCliqueFamily (P : Presentation N) (F : Set (Set α)) : Prop where + finite : F.Finite + clique : ∀ K ∈ F, IsLeThreeClique N.G K + nonempty : ∀ K ∈ F, K.Nonempty + antichain : ∀ K ∈ F, ∀ K' ∈ F, K ⊆ K' → K = K' + off₀ : ∀ v, {v} ∈ F → v ∉ N.Ω₀.bar + region : ∀ K ∈ F, K.ncard = 3 → ∃ E, IsEmptyRegion P K E + +/-- A closed disc for the clique `K`: it has the vertices of `K` on its boundary, and it meets `Δ₀` +and the boundary of `Δ` only in vertices of `K`. -/ +structure IsCliqueDisc (P : Presentation N) (K : Set α) (B : Set EuclideanPlane) : Prop where + disc : IsClosedDisc B + sub : B ⊆ P.Δ + bd : ∀ v ∈ K, vertexPt P.Γ v ∈ discBd B + inter₀ : B ∩ P.Δ₀ ⊆ vertexPt P.Γ '' (N.Ω₀.bar ∩ K) + inter_bd : B ∩ subBd P.Δ ⊆ vertexPt P.Γ '' (K ∩ N.Ω.bar) + +theorem isClosed_Δ₀ (P : Presentation N) : IsClosed P.Δ₀ := by + rcases P.agrees_Δ₀ with ⟨h, -⟩ | ⟨h, -⟩ + · rw [h] + exact isClosed_empty + · exact h.isCompact.isClosed + +namespace IsTidyPresentation + +variable {P : Presentation N} + +/-- A presentation of a simple rural neighborhood chosen by `Neighborhood.IsRural.exists_clean` is +tidy. -/ +theorem of_clean (hs : IsSimpleGraph N.G) + (h₁ : P.Γ.drawing.U ∩ subBd P.Δ = ⋃ v ∈ N.Ω.bar, graphDrawingVertexSet P.Γ v) + (h₂ : P.Δ₀ ∩ subBd P.Δ ⊆ ⋃ v ∈ N.Ω.bar, graphDrawingVertexSet P.Γ v) + (h₃ : P.Γ.drawing.U ∩ subBd P.Δ₀ ⊆ ⋃ v ∈ N.Ω₀.bar, graphDrawingVertexSet P.Γ v) : + IsTidyPresentation P := by + have hbar : ∀ {x : EuclideanPlane} {Ω : CyclicPerm α}, Ω.bar ⊆ V(N.G) → + x ∈ (⋃ v ∈ Ω.bar, graphDrawingVertexSet P.Γ v) → ∃ v ∈ Ω.bar, x = vertexPt P.Γ v := by + intro x Ω hs hx + obtain ⟨v, hv, hxv⟩ := mem_iUnion₂.mp hx + exact ⟨v, hv, (mem_vertexSet_iff P.Γ (hs hv)).mp hxv⟩ + refine ⟨fun x hx hb => hbar N.bar_subset (h₁ ▸ ⟨hx, hb⟩), fun x hx h₀ => ?_, ?_, hs⟩ + · refine hbar N.bar₀_subset (h₃ ⟨hx, ?_⟩) + rcases P.agrees_Δ₀ with ⟨h, -⟩ | ⟨h, -⟩ + · rw [h] at h₀ + exact h₀.elim + · have hni : x ∉ interior P.Δ₀ := (P.U_subset hx).2 + rw [interior_eq_discInt_plane h] at hni + rw [subBd_eq_discBd_plane h] + by_contra hb + exact hni ⟨h₀, hb⟩ + · intro x hx + obtain ⟨v, hv, rfl⟩ := hbar N.bar_subset (h₂ hx) + exact vertexPt_mem_U P.Γ (N.bar_subset hv) + +theorem mem_U {v : α} (hv : v ∈ V(N.G)) : vertexPt P.Γ v ∈ P.Γ.drawing.U := + P.Γ.drawing.V_subset_U (vertexPt_mem_V P.Γ hv) + +/-- A vertex of `K` drawn in `Δ₀` is in `ΩBar₀`. -/ +theorem pt_Δ₀ (T : IsTidyPresentation P) {K : Set α} (hK : K ⊆ V(N.G)) {x : EuclideanPlane} + (hx : x ∈ vertexPt P.Γ '' K) (h : x ∈ P.Δ₀) : x ∈ vertexPt P.Γ '' (N.Ω₀.bar ∩ K) := by + obtain ⟨v, hv, rfl⟩ := hx + obtain ⟨w, hw, he⟩ := T.Δ₀_U _ (mem_U (hK hv)) h + have := vertexPt_injOn P.Γ (hK hv) (N.bar₀_subset hw) he + subst this + exact ⟨v, ⟨hw, hv⟩, rfl⟩ + +/-- A vertex of `K` drawn in the boundary of `Δ` is in `ΩBar`. -/ +theorem pt_bd (T : IsTidyPresentation P) {K : Set α} (hK : K ⊆ V(N.G)) {x : EuclideanPlane} + (hx : x ∈ vertexPt P.Γ '' K) (h : x ∈ subBd P.Δ) : x ∈ vertexPt P.Γ '' (K ∩ N.Ω.bar) := by + obtain ⟨v, hv, rfl⟩ := hx + obtain ⟨w, hw, he⟩ := T.bd_U _ (mem_U (hK hv)) h + have := vertexPt_injOn P.Γ (hK hv) (N.bar_subset hw) he + subst this + exact ⟨v, ⟨hv, hw⟩, rfl⟩ + +/-- A point drawn for a vertex of both `K` and `K'` is drawn for a common vertex. -/ +theorem pt_inter {K K' : Set α} (hK : K ⊆ V(N.G)) (hK' : K' ⊆ V(N.G)) {x : EuclideanPlane} + (hx : x ∈ vertexPt P.Γ '' K) (hx' : x ∈ vertexPt P.Γ '' K') : + x ∈ vertexPt P.Γ '' (K ∩ K') := by + obtain ⟨v, hv, rfl⟩ := hx + obtain ⟨w, hw, he⟩ := hx' + have := vertexPt_injOn P.Γ (hK' hw) (hK hv) he + subst this + exact ⟨w, ⟨hv, hw⟩, rfl⟩ + +end IsTidyPresentation + +namespace IsEmptyRegion + +variable {P : Presentation N} {K K' : Set α} {E E' : Set EuclideanPlane} + +theorem isPreconnected_interior (R : IsEmptyRegion P K E) : IsPreconnected (interior E) := by + rw [interior_eq_discInt_plane R.disc] + exact R.disc.isPreconnected_discInt + +/-- A point of the region off its interior is on its boundary. -/ +theorem mem_bd (R : IsEmptyRegion P K E) {x : EuclideanPlane} (hx : x ∈ E) + (hi : x ∉ interior E) : x ∈ discBd E := by + rw [interior_eq_discInt_plane R.disc] at hi + by_contra hb + exact hi ⟨hx, hb⟩ + +/-- Two regions of different cliques have disjoint interiors. -/ +theorem interior_disjoint (R : IsEmptyRegion P K E) (R' : IsEmptyRegion P K' E') + (hK : K ⊆ V(N.G)) (hK' : K' ⊆ V(N.G)) (hne : K ≠ K') + (hbd : ∀ v ∈ K, vertexPt P.Γ v ∈ discBd E) (hbd' : ∀ v ∈ K', vertexPt P.Γ v ∈ discBd E') : + Disjoint (interior E) (interior E') := by + by_contra hmeet + obtain ⟨x, hx, hx'⟩ := not_disjoint_iff.mp hmeet + have h₁ : interior E ⊆ interior E' := by + rcases subset_interior_or_compl R'.disc R.isPreconnected_interior + (disjoint_of_subset_right R'.bd_U R.int_U) with h | h + · exact h + · exact (h hx (interior_subset hx')).elim + have h₂ : interior E' ⊆ interior E := by + rcases subset_interior_or_compl R.disc R'.isPreconnected_interior + (disjoint_of_subset_right R.bd_U R'.int_U) with h | h + · exact h + · exact (h hx' (interior_subset hx)).elim + have hEE : E = E' := by + rw [← closure_interior_of_isClosedDisc R.disc, ← closure_interior_of_isClosedDisc R'.disc, + Subset.antisymm h₁ h₂] + subst hEE + exact hne (Subset.antisymm (fun v hv => (R'.bd_iff v (hK hv)).mp (hbd v hv)) + (fun v hv => (R.bd_iff v (hK' hv)).mp (hbd' v hv))) + +/-- A smaller disc in an empty region, which touches the boundary of the region only in the vertices +of the clique. Any point of the smaller disc off the interior of the region is one of them. -/ +theorem exists_inscribed (R : IsEmptyRegion P K E) (hfin : K.Finite) + (hbd : ∀ v ∈ K, vertexPt P.Γ v ∈ discBd E) : + ∃ B ⊆ E, IsClosedDisc B ∧ (∀ v ∈ K, vertexPt P.Γ v ∈ discBd B) ∧ + ∀ x ∈ B, x ∉ interior E → x ∈ vertexPt P.Γ '' K := by + obtain ⟨B, hB, hd, hb, ht⟩ := exists_inscribed_disc R.disc (hfin.image (vertexPt P.Γ)) + (by rintro _ ⟨v, hv, rfl⟩; exact hbd v hv) + refine ⟨B, hB, hd, fun v hv => hb (mem_image_of_mem _ hv), fun x hx hi => ?_⟩ + rw [← ht] + exact ⟨hx, R.mem_bd (hB hx) hi⟩ + +end IsEmptyRegion + +variable {P : Presentation N} + +/-- Discs for the triangles of the family. -/ +theorem exists_triangle_discs (T : IsTidyPresentation P) {F : Set (Set α)} + (C : IsCliqueFamily P F) : + ∃ β : Set α → Set EuclideanPlane, + (∀ K ∈ F, K.ncard = 3 → IsCliqueDisc P K (β K) ∧ + β K ∩ P.Γ.drawing.U ⊆ vertexPt P.Γ '' K) ∧ + ∀ K ∈ F, ∀ K' ∈ F, K.ncard = 3 → K'.ncard = 3 → K ≠ K' → + β K ∩ β K' ⊆ vertexPt P.Γ '' (K ∩ K') := by + classical + have hKV : ∀ K ∈ F, K ⊆ V(N.G) := fun K hK => (C.clique K hK).1 + have hfin : ∀ K ∈ F, K.Finite := fun K hK => N.finite_V.subset (hKV K hK) + choose! E hE using C.region + have hbdE : ∀ K ∈ F, K.ncard = 3 → ∀ v ∈ K, vertexPt P.Γ v ∈ discBd (E K) := + fun K hK h3 v hv => ((hE K hK h3).bd_iff v (hKV K hK hv)).mpr hv + choose! β hβ using fun K (hK : K ∈ F) (h3 : K.ncard = 3) => + (hE K hK h3).exists_inscribed (hfin K hK) (hbdE K hK h3) + refine ⟨β, fun K hK h3 => ?_, fun K hK K' hK' h3 h3' hne x hx => ?_⟩ + · obtain ⟨hs, hd, hb, hp⟩ := hβ K hK h3 + have R := hE K hK h3 + refine ⟨⟨hd, hs.trans R.sub, hb, ?_, ?_⟩, ?_⟩ + · rintro x ⟨hx, h₀⟩ + exact T.pt_Δ₀ (hKV K hK) (hp x hx (disjoint_right.mp R.int_Δ₀ h₀)) h₀ + · rintro x ⟨hx, hbd⟩ + refine T.pt_bd (hKV K hK) (hp x hx fun hi => ?_) hbd + exact disjoint_left.mp (disjoint_interior_subBd P.Δ) (interior_mono R.sub hi) hbd + · rintro x ⟨hx, hU⟩ + exact hp x hx (disjoint_right.mp R.int_U hU) + · have R := hE K hK h3 + have R' := hE K' hK' h3' + obtain ⟨hs, -, -, hp⟩ := hβ K hK h3 + obtain ⟨hs', -, -, hp'⟩ := hβ K' hK' h3' + have hdis := R.interior_disjoint R' (hKV K hK) (hKV K' hK') hne (hbdE K hK h3) (hbdE K' hK' h3') + have hoff : ∀ {A A' : Set EuclideanPlane}, Disjoint (interior A) (interior A') → + IsClosedDisc A' → ∀ {y : EuclideanPlane}, y ∈ A' → y ∉ interior A := by + intro A A' hd hA y hy hi + have hcl : y ∈ closure (interior A') := by + rw [closure_interior_of_isClosedDisc hA] + exact hy + obtain ⟨z, hzo, hz⟩ := mem_closure_iff.mp hcl _ isOpen_interior hi + exact disjoint_left.mp hd hzo hz + exact IsTidyPresentation.pt_inter (hKV K hK) (hKV K' hK') + (hp x hx.1 (hoff hdis R'.disc (hs' hx.2))) (hp' x hx.2 (hoff hdis.symm R.disc (hs hx.1))) + +/-- Discs for the edges of the family, one after another. They meet the closed set `Y`, which meets +the drawing only in vertices, only in the ends of the edge. -/ +theorem exists_edge_discs (T : IsTidyPresentation P) (I : Finset (Set α)) + (hI : ∀ K ∈ I, IsLeThreeClique N.G K ∧ K.ncard = 2) {Y : Set EuclideanPlane} (hY : IsClosed Y) + (hYU : ∀ x ∈ Y, x ∈ P.Γ.drawing.U → x ∈ P.Γ.drawing.V) : + ∃ D : Set α → Set EuclideanPlane, + (∀ K ∈ I, IsCliqueDisc P K (D K) ∧ D K ∩ P.Γ.drawing.V ⊆ vertexPt P.Γ '' K ∧ + D K ∩ Y ⊆ vertexPt P.Γ '' K) ∧ + ∀ K ∈ I, ∀ K' ∈ I, K ≠ K' → D K ∩ D K' ⊆ vertexPt P.Γ '' (K ∩ K') := by + classical + have hpair : ∀ K ∈ I, ∃ a b, a ≠ b ∧ K = {a, b} := fun K hK => Set.ncard_eq_two.mp (hI K hK).2 + rcases isEmpty_or_nonempty α with hα | hα + · refine ⟨fun _ => ∅, fun K hk => ?_, fun K hk => ?_⟩ <;> + · obtain ⟨a, -⟩ := hpair K hk + exact hα.elim a + choose! a b hab hK using hpair + have hmemK : ∀ K ∈ I, a K ∈ K ∧ b K ∈ K := fun K hk => by + have h₁ : a K ∈ ({a K, b K} : Set α) := Or.inl rfl + have h₂ : b K ∈ ({a K, b K} : Set α) := Or.inr rfl + rw [← hK K hk] at h₁ h₂ + exact ⟨h₁, h₂⟩ + have hKV : ∀ K ∈ I, K ⊆ V(N.G) := fun K hk => (hI K hk).1.1 + have hlink : ∀ K ∈ I, N.G.IsLink s(a K, b K) (a K) (b K) := fun K hk => + (hI K hk).1.2.2 _ (hmemK K hk).1 _ (hmemK K hk).2 (hab K hk) + let e : Set α → Sym2 α := fun K => s(a K, b K) + let pa : Set α → EuclideanPlane := fun K => vertexPt P.Γ (a K) + let pb : Set α → EuclideanPlane := fun K => vertexPt P.Γ (b K) + let l : Set α → Set EuclideanPlane := fun K => closure (graphDrawingEdgeSet P.Γ (e K)) + let R : Set α → Set EuclideanPlane := fun K => + P.Δ₀ ∪ subBd P.Δ ∪ Y ∪ P.Γ.drawing.V ∪ + ⋃ f ∈ E(N.G) \ {e K}, closure (graphDrawingEdgeSet P.Γ f) + have hline : ∀ K ∈ I, IsLineWithEnds (l K) (pa K) (pb K) := fun K hk => + isLine_closure_of_isLink P.Γ (hlink K hk) (hab K hk) + have hpab : ∀ K ∈ I, pa K ≠ pb K := fun K hk h => + hab K hk (vertexPt_injOn P.Γ (hlink K hk).left_mem (hlink K hk).right_mem h) + have hRc : ∀ K ∈ I, IsClosed (R K) := fun K _ => by + refine ((((isClosed_Δ₀ P).union (isClosed_subBd P.Δ)).union hY).union + P.Γ.drawing.finite_V.isClosed).union ?_ + exact (N.finite_E.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure + have hopen : ∀ K ∈ I, ∀ x ∈ l K, x ∉ ({pa K, pb K} : Set EuclideanPlane) → + x ∈ graphDrawingEdgeSet P.Γ (e K) ∧ x ∉ P.Γ.drawing.V := by + intro K hk x hx hn + obtain ⟨hmem, hcap⟩ := closure_inter_V_of_isLink P.Γ (hlink K hk) + have hxV : x ∉ P.Γ.drawing.V := fun hV => by + have hm : x ∈ l K ∩ P.Γ.drawing.V := ⟨hx, hV⟩ + rw [show l K = closure (graphDrawingEdgeSet P.Γ s(a K, b K)) from rfl, hcap] at hm + exact hn hm + refine ⟨?_, hxV⟩ + rw [← P.Γ.drawing.closure_diff_V hmem] + exact ⟨hx, hxV⟩ + have hUe : ∀ K ∈ I, ∀ x ∈ graphDrawingEdgeSet P.Γ (e K), x ∈ P.Γ.drawing.U := fun K hk x hx => + ((graphDrawingEdgeSet_mem P.Γ (hlink K hk).edge_mem).2.1 hx).1 + have hmeet : ∀ K ∈ I, l K ∩ R K ⊆ {pa K, pb K} := by + rintro K hk x ⟨hx, hxR⟩ + by_contra hn + obtain ⟨hxe, hxV⟩ := hopen K hk x hx hn + have hxU := hUe K hk x hxe + rcases hxR with (((h | h) | h) | h) | h + · obtain ⟨v, hv, rfl⟩ := T.Δ₀_U x hxU h + exact hxV (vertexPt_mem_V P.Γ (N.bar₀_subset hv)) + · obtain ⟨v, hv, rfl⟩ := T.bd_U x hxU h + exact hxV (vertexPt_mem_V P.Γ (N.bar_subset hv)) + · exact hxV (hYU x h hxU) + · exact hxV h + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp h + have hmem := graphDrawingEdgeSet_mem P.Γ hf.1 + have hxf' : x ∈ graphDrawingEdgeSet P.Γ f := by + rw [← P.Γ.drawing.closure_diff_V hmem] + exact ⟨hxf, hxV⟩ + exact hf.2 (eq_of_mem_edgeSet P.Γ hf.1 (hlink K hk).edge_mem hxf' hxe) + have hene : ∀ K ∈ I, ∀ K' ∈ I, K ≠ K' → e K ≠ e K' := by + intro K hk K' hk' hne he + apply hne + rw [hK K hk, hK K' hk'] + rcases Sym2.eq_iff.mp he with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · rw [h₁, h₂] + · rw [h₁, h₂, pair_comm] + have hcross : ∀ K ∈ I, ∀ K' ∈ I, K ≠ K' → l K ⊆ R K' := by + intro K hk K' hk' hne x hx + exact Or.inr (mem_iUnion₂.mpr ⟨e K, ⟨(hlink K hk).edge_mem, hene K hk K' hk' hne⟩, hx⟩) + obtain ⟨D, hD, hp⟩ := exists_lenses I hline hpab hRc hmeet hcross + have hends : ∀ K ∈ I, ({pa K, pb K} : Set EuclideanPlane) ⊆ vertexPt P.Γ '' K := by + rintro K hk _ (rfl | rfl) + · exact mem_image_of_mem _ (hmemK K hk).1 + · exact mem_image_of_mem _ (hmemK K hk).2 + have hRsub : ∀ K ∈ I, ∀ S, S ⊆ R K → D K ∩ S ⊆ vertexPt P.Γ '' K := fun K hk S hS x hx => + hends K hk ((hD K hk).2.2.1 ⟨hx.1, hS hx.2⟩) + refine ⟨D, fun K hk => ?_, fun K hk K' hk' hne x hx => ?_⟩ + · obtain ⟨hdisc, hsub, -, hpa, hpb, hpc⟩ := hD K hk + have hin : D K ⊆ P.Δ := by + intro x hx + by_cases hxe : x ∈ ({pa K, pb K} : Set EuclideanPlane) + · rcases hxe with rfl | rfl + · exact (P.U_subset (IsTidyPresentation.mem_U (hlink K hk).left_mem)).1 + · exact (P.U_subset (IsTidyPresentation.mem_U (hlink K hk).right_mem)).1 + · have hdj : Disjoint (D K \ {pa K, pb K}) (discBd P.Δ) := by + rw [disjoint_left] + rintro y ⟨hy, hyn⟩ hyb + refine hyn ((hD K hk).2.2.1 ⟨hy, Or.inl (Or.inl (Or.inl (Or.inr ?_)))⟩) + rw [subBd_eq_discBd_plane P.isClosedDisc_Δ] + exact hyb + rcases subset_interior_or_compl P.isClosedDisc_Δ hpc hdj with h | h + · exact interior_subset (h ⟨hx, hxe⟩) + · exfalso + obtain ⟨y, hyl, hyn⟩ := (hline K hk).nonempty_sdiff + have hye := (hopen K hk y hyl hyn).1 + exact h ⟨hsub hyl, hyn⟩ (P.U_subset (hUe K hk y hye)).1 + refine ⟨⟨hdisc, hin, fun v hv => ?_, ?_, ?_⟩, ?_, ?_⟩ + · rw [hK K hk] at hv + rcases hv with rfl | rfl + · exact hpa + · exact hpb + · rintro x ⟨hx, h₀⟩ + exact T.pt_Δ₀ (hKV K hk) + (hRsub K hk _ (fun y hy => Or.inl (Or.inl (Or.inl (Or.inl hy)))) ⟨hx, h₀⟩) h₀ + · rintro x ⟨hx, hb⟩ + exact T.pt_bd (hKV K hk) + (hRsub K hk _ (fun y hy => Or.inl (Or.inl (Or.inl (Or.inr hy)))) ⟨hx, hb⟩) hb + · exact hRsub K hk _ fun y hy => Or.inl (Or.inr hy) + · exact hRsub K hk _ fun y hy => Or.inl (Or.inl (Or.inr hy)) + · have h := hp K hk K' hk' hne hx + exact IsTidyPresentation.pt_inter (hKV K hk) (hKV K' hk') (hends K hk h.1) (hends K' hk' h.2) + +/-- Discs for the vertices that form a clique by themselves. Each one is close to its vertex, so it +misses a closed set that misses the vertex. -/ +theorem exists_vertex_discs (T : IsTidyPresentation P) {A : Set α} (hfin : A.Finite) + (hAV : A ⊆ V(N.G)) (hA₀ : ∀ v ∈ A, v ∉ N.Ω₀.bar) {Z : Set EuclideanPlane} (hZ : IsClosed Z) + (hAZ : ∀ v ∈ A, vertexPt P.Γ v ∉ Z) : + ∃ s : α → Set EuclideanPlane, (∀ v ∈ A, IsCliqueDisc P {v} (s v) ∧ Disjoint (s v) Z) ∧ + ∀ v ∈ A, ∀ w ∈ A, v ≠ w → Disjoint (s v) (s w) := by + classical + obtain ⟨O, hO, hd⟩ := (hfin.image (vertexPt P.Γ)).t2_separation + have hoff : ∀ v ∈ A, vertexPt P.Γ v ∉ P.Δ₀ := by + intro v hv h + obtain ⟨w, hw, he⟩ := T.Δ₀_U _ (IsTidyPresentation.mem_U (hAV hv)) h + have := vertexPt_injOn P.Γ (hAV hv) (N.bar₀_subset hw) he + exact hA₀ v hv (this ▸ hw) + have hclosed : IsClosed (Z ∪ P.Δ₀) := hZ.union (isClosed_Δ₀ P) + have hex : ∀ v ∈ A, ∃ K ⊆ P.Δ, K ⊆ O (vertexPt P.Γ v) ∩ (Z ∪ P.Δ₀)ᶜ ∧ IsClosedDisc K ∧ + vertexPt P.Γ v ∈ discBd K ∧ K ∩ discBd P.Δ ⊆ {vertexPt P.Γ v} := fun v hv => + exists_small_disc_at P.isClosedDisc_Δ (P.U_subset (IsTidyPresentation.mem_U (hAV hv))).1 + ((hO _).2.inter hclosed.isOpen_compl) + ⟨(hO _).1, by rintro (h | h); exacts [hAZ v hv h, hoff v hv h]⟩ + rcases isEmpty_or_nonempty α with hα | hα + · refine ⟨fun _ => ∅, fun v => ?_, fun v => ?_⟩ <;> exact hα.elim v + choose! s hsub hW hdisc hb htouch using hex + refine ⟨s, fun v hv => ⟨⟨hdisc v hv, hsub v hv, ?_, ?_, ?_⟩, ?_⟩, fun v hv w hw hne => ?_⟩ + · intro w hw + rw [mem_singleton_iff.mp hw] + exact hb v hv + · rintro x ⟨hx, h₀⟩ + exact ((hW v hv hx).2 (Or.inr h₀)).elim + · rintro x ⟨hx, hbd⟩ + have hx' : x ∈ ({vertexPt P.Γ v} : Set _) := + htouch v hv ⟨hx, by rwa [subBd_eq_discBd_plane P.isClosedDisc_Δ] at hbd⟩ + rw [mem_singleton_iff] at hx' + subst hx' + exact T.pt_bd (K := {v}) (singleton_subset_iff.mpr (hAV hv)) (mem_image_of_mem _ rfl) hbd + · rw [disjoint_left] + exact fun x hx h => (hW v hv hx).2 (Or.inl h) + · have hne' : vertexPt P.Γ v ≠ vertexPt P.Γ w := fun h => + hne (vertexPt_injOn P.Γ (hAV hv) (hAV hw) h) + have := hd (mem_image_of_mem _ hv) (mem_image_of_mem _ hw) hne' + exact this.mono (fun x hx => (hW v hv hx).1) (fun x hx => (hW w hw hx).1) + +/-- The discs of the family, as in the proof of (11.11) of Graph Minors IX, page 76. -/ +theorem exists_clique_discs (T : IsTidyPresentation P) {F : Set (Set α)} + (C : IsCliqueFamily P F) : + ∃ β : Set α → Set EuclideanPlane, (∀ K ∈ F, IsCliqueDisc P K (β K)) ∧ + ∀ K ∈ F, ∀ K' ∈ F, K ≠ K' → β K ∩ β K' ⊆ vertexPt P.Γ '' (K ∩ K') := by + classical + have hKV : ∀ K ∈ F, K ⊆ V(N.G) := fun K hK => (C.clique K hK).1 + have hfin : ∀ K ∈ F, K.Finite := fun K hK => N.finite_V.subset (hKV K hK) + obtain ⟨β₃, h₃, hp₃⟩ := exists_triangle_discs T C + let Y : Set EuclideanPlane := ⋃ K ∈ {K ∈ F | K.ncard = 3}, β₃ K + have hYc : IsClosed Y := (C.finite.subset (sep_subset _ _)).isClosed_biUnion + fun K hK => (h₃ K hK.1 hK.2).1.disc.isCompact.isClosed + have hYU : ∀ x ∈ Y, x ∈ P.Γ.drawing.U → x ∈ P.Γ.drawing.V := by + intro x hx hU + obtain ⟨K, hK, hxK⟩ := mem_iUnion₂.mp hx + obtain ⟨v, hv, rfl⟩ := (h₃ K hK.1 hK.2).2 ⟨hxK, hU⟩ + exact vertexPt_mem_V P.Γ (hKV K hK.1 hv) + let I : Finset (Set α) := C.finite.toFinset.filter (fun K => K.ncard = 2) + have hI : ∀ {K}, K ∈ I ↔ K ∈ F ∧ K.ncard = 2 := by + intro K + simp [I] + obtain ⟨D, h₂, hp₂⟩ := exists_edge_discs T I (fun K hK => ⟨C.clique K (hI.mp hK).1, (hI.mp hK).2⟩) + hYc hYU + let Z : Set EuclideanPlane := Y ∪ ⋃ K ∈ I, D K + have hZc : IsClosed Z := hYc.union (I.finite_toSet.isClosed_biUnion + fun K hK => (h₂ K hK).1.disc.isCompact.isClosed) + let A : Set α := {v | {v} ∈ F} + have hAfin : A.Finite := by + refine (C.finite.biUnion hfin).subset fun v hv => mem_iUnion₂.mpr ⟨{v}, hv, rfl⟩ + have hAV : A ⊆ V(N.G) := fun v hv => hKV _ hv rfl + have hnot : ∀ v ∈ A, ∀ K ∈ F, K.ncard ≠ 1 → vertexPt P.Γ v ∈ vertexPt P.Γ '' K → False := by + intro v hv K hK hne hm + obtain ⟨w, hw, he⟩ := hm + have := vertexPt_injOn P.Γ (hKV K hK hw) (hAV hv) he + subst this + have hEq := C.antichain _ hv K hK (singleton_subset_iff.mpr hw) + exact hne (hEq ▸ ncard_singleton w) + have hAZ : ∀ v ∈ A, vertexPt P.Γ v ∉ Z := by + rintro v hv (h | h) + · obtain ⟨K, hK, hxK⟩ := mem_iUnion₂.mp h + exact hnot v hv K hK.1 (by rw [hK.2]; norm_num) + ((h₃ K hK.1 hK.2).2 ⟨hxK, IsTidyPresentation.mem_U (hAV hv)⟩) + · obtain ⟨K, hK, hxK⟩ := mem_iUnion₂.mp h + exact hnot v hv K (hI.mp hK).1 (by rw [(hI.mp hK).2]; norm_num) + ((h₂ K hK).2.1 ⟨hxK, vertexPt_mem_V P.Γ (hAV hv)⟩) + obtain ⟨s, h₁, hp₁⟩ := exists_vertex_discs T hAfin hAV (fun v hv => C.off₀ v hv) hZc hAZ + have hcases : ∀ K ∈ F, K.ncard = 3 ∨ K.ncard = 2 ∨ ∃ v, K = {v} := by + intro K hK + have h3 := (C.clique K hK).finite_ncard_le.2 + have h0 : K.ncard ≠ 0 := (ncard_ne_zero_of_mem (C.nonempty K hK).some_mem (hfin K hK)) + have : K.ncard = 3 ∨ K.ncard = 2 ∨ K.ncard = 1 := by omega + rcases this with h | h | h + · exact Or.inl h + · exact Or.inr (Or.inl h) + · exact Or.inr (Or.inr (ncard_eq_one.mp h)) + let β : Set α → Set EuclideanPlane := fun K => + if K.ncard = 3 then β₃ K else if K.ncard = 2 then D K else + if h : ∃ v, K = {v} then s h.choose else ∅ + have hβ₃ : ∀ {K : Set α}, K.ncard = 3 → β K = β₃ K := fun h => by simp [β, h] + have hβ₂ : ∀ {K : Set α}, K.ncard = 2 → β K = D K := fun h => by simp [β, h] + have hβ₁ : ∀ v : α, β {v} = s v := by + intro v + have h : ∃ w, ({v} : Set α) = {w} := ⟨v, rfl⟩ + have hc : h.choose = v := (singleton_injective h.choose_spec).symm + simp only [β, ncard_singleton, OfNat.one_ne_ofNat, ↓reduceIte, h, ↓reduceDIte, hc] + -- The discs of two different sizes meet as they should. + have h32 : ∀ K ∈ F, ∀ K' ∈ F, K.ncard = 3 → K'.ncard = 2 → + β₃ K ∩ D K' ⊆ vertexPt P.Γ '' (K ∩ K') := by + rintro K hK K' hK' h3 h2 x ⟨hx, hx'⟩ + have hk' : K' ∈ I := hI.mpr ⟨hK', h2⟩ + have hxK' := (h₂ K' hk').2.2 ⟨hx', mem_iUnion₂.mpr ⟨K, ⟨hK, h3⟩, hx⟩⟩ + obtain ⟨w, hw, rfl⟩ := id hxK' + exact IsTidyPresentation.pt_inter (hKV K hK) (hKV K' hK') + ((h₃ K hK h3).2 ⟨hx, IsTidyPresentation.mem_U (hKV K' hK' hw)⟩) hxK' + have h31 : ∀ K ∈ F, K.ncard = 3 → ∀ v ∈ A, Disjoint (β₃ K) (s v) := by + intro K hK h3 v hv + rw [disjoint_left] + exact fun x hx hs => disjoint_left.mp (h₁ v hv).2 hs + (Or.inl (mem_iUnion₂.mpr ⟨K, ⟨hK, h3⟩, hx⟩)) + have h21 : ∀ K ∈ F, K.ncard = 2 → ∀ v ∈ A, Disjoint (D K) (s v) := by + intro K hK h2 v hv + rw [disjoint_left] + exact fun x hx hs => disjoint_left.mp (h₁ v hv).2 hs + (Or.inr (mem_iUnion₂.mpr ⟨K, hI.mpr ⟨hK, h2⟩, hx⟩)) + refine ⟨β, fun K hK => ?_, fun K hK K' hK' hne x hx => ?_⟩ + · rcases hcases K hK with h | h | ⟨v, rfl⟩ + · rw [hβ₃ h] + exact (h₃ K hK h).1 + · rw [hβ₂ h] + exact (h₂ K (hI.mpr ⟨hK, h⟩)).1 + · rw [hβ₁] + exact (h₁ v hK).1 + · rcases hcases K hK with h | h | ⟨v, rfl⟩ <;> rcases hcases K' hK' with h' | h' | ⟨w, rfl⟩ + · rw [hβ₃ h, hβ₃ h'] at hx + exact hp₃ K hK K' hK' h h' hne hx + · rw [hβ₃ h, hβ₂ h'] at hx + exact h32 K hK K' hK' h h' hx + · rw [hβ₃ h, hβ₁] at hx + exact (disjoint_left.mp (h31 K hK h w hK') hx.1 hx.2).elim + · rw [hβ₂ h, hβ₃ h'] at hx + rw [inter_comm] + exact h32 K' hK' K hK h' h ⟨hx.2, hx.1⟩ + · rw [hβ₂ h, hβ₂ h'] at hx + exact hp₂ K (hI.mpr ⟨hK, h⟩) K' (hI.mpr ⟨hK', h'⟩) hne hx + · rw [hβ₂ h, hβ₁] at hx + exact (disjoint_left.mp (h21 K hK h w hK') hx.1 hx.2).elim + · rw [hβ₁, hβ₃ h'] at hx + exact (disjoint_left.mp (h31 K' hK' h' v hK) hx.2 hx.1).elim + · rw [hβ₁, hβ₂ h'] at hx + exact (disjoint_left.mp (h21 K' hK' h' v hK) hx.2 hx.1).elim + · rw [hβ₁, hβ₁] at hx + have hvw : v ≠ w := fun h => hne (by rw [h]) + exact (disjoint_left.mp (hp₁ v hK w hK' hvw) hx.1 hx.2).elim + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Defs.lean b/LeanPool/GraphMinor/GM09/Defs.lean new file mode 100644 index 0000000000..8dd2689abd --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Defs.lean @@ -0,0 +1,1097 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import LeanPool.GraphMinor.Surface.PlaneOrientation +public import LeanPool.GraphMinor.GM06.Defs + +/-! +# Definitions of Graph Minors IX + +This file formalizes the definitions of N. Robertson and P. D. Seymour, +*Graph Minors. IX. Disjoint crossed paths*, J. Combin. Theory Ser. B **49** (1990) 40–77. + +## Contents + +- **Section 1 (pages 40–42):** Cyclic permutations (`CyclicPerm`), restrictions (`Ω | X`), + `Ω`-clockwise sequences (`IsClockwiseSeq`), crossing pairs (`Crosses`), intervals `Ω(v₁, v₂)` + (`interval`), fences (`IsFence`), societies (`Society`), `Ω`-paths (`IsOmegaPath`), + fences for sets of `Ω`-paths (`IsFenceFor`), transactions (`IsTransaction`), peripheral paths + (`IsPeripheralIn`), crooked transactions (`IsCrookedTransaction`), neighborhoods (`Neighborhood`), + rural neighborhoods (`IsRural`), separations of societies (`IsSocietySeparation`), compositions + (`IsComposition`), and sophistication (`HasSophisticationLE`, `sophistication`). +- **Section 2 (pages 43–46):** Avoiding and catching (`Avoids`, `Catches`), `X → Y` paths + (`IsFromToPath`), `X' ⇒ Y'` with respect to `X, Y` (`RedirectsTo`), `k`-separations and internal + `k`-separations (`IsKSeparation`, `IsInternalKSeparation`, `IsKConnected`, + `IsInternallyKConnected`), crosses and tripods (`IsCross`, `IsTripod`), and rural societies + (`IsRuralSociety`). +- **Section 3 (pages 46–48):** Attachments `P` to `P_set` (`IsAttachment`), feet and legs (`IsFoot`, + `IsLeg`), switches (`IsSwitch`), exchangeable attachments (`IsExchangeableAttachment`), + overpasses (`IsOverpass`), and overpass attachments (`IsOverpassAttachment`). +- **Section 4 (pages 49–52):** Non-separating and separating `Ω`-paths (`IsNonSeparatingOmegaPath`, + `IsSeparatingOmegaPath`), Statement **S** (`StatementS`), `W(Q_set)` (`uncoveredSet`), + half-covered paths (`IsHalfCovered`), and `Ω`-paths in order (`AreInOrder`). +- **Section 6 (pages 55–58):** `U(P)`, `U(P_set)`, and `C(P_set)` (`peripheralIntervalSet`, + `transactionPeripheralUnion`, `coveredComponentUnion`). +- **Section 7 (pages 58–60):** Crosscap, leap, and doublecross transactions + (`IsCrosscapTransaction`, `IsLeapTransaction`, `IsDoublecrossTransaction`). +- **Section 8 (pages 60–62):** Linear decompositions of a society and their depth + (`HasLinearDecompositionOfDepthLE`). +- **Section 10 (pages 63–67):** Presentations `(Σ, Γ, Δ, Δ₀)` of a rural neighborhood + (`Presentation`), `s`-nests (`IsNest`), breadth `≥ s` (`HasBreadthGe`), and weakly-linked and + linked subsets of `ΩBar` (`IsWeaklyLinked`, `IsLinked`). +- **Section 11 (pages 67–77):** `Δ(P)` (`IsPathDisc`), prominences (`IsProminence`), lawns + (`IsLawn`), walls and internal/external/wall edges (`wallDisc`, `wall`, `IsInternalEdge`, + `IsExternalEdge`, `IsWallEdge`), triangles (`IsTriangle`), parks (`IsParkOf`, `IsPark`), + consolidations and their cores (`IsConsolidation`, `consolidationCore`), patterns of transactions + (`transactionPattern`), segregations of a society (`IsSocietySegregation`), arrangements in a + closed disc (`IsDiscArrangement`), and feasible segregations (`IsFeasibleSegregation`). +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM06 + +universe u v w + +/-! ## Section 1: Cyclic permutations, societies, transactions, and rural neighborhoods (pages +40–42) -/ + +/-- A cyclic permutation `Ω` of a finite set `ΩBar` (`bar`) +(Graph Minors IX, Section 1, page 41: "Let $\Omega$ be a cyclic permutation of the elements of some +finite set; we denote this set +by $\bar{\Omega}$. We denote the image under $\Omega$ of $x \in \bar{\Omega}$ by $\Omega(x)$"). -/ +structure CyclicPerm (α : Type u) where + /-- The underlying finite set `ΩBar`. -/ + bar : Set α + /-- The permutation map `Ω(x)`. -/ + toFun : α → α + /-- `ΩBar` is finite. -/ + finite_bar : bar.Finite + /-- `Ω` is a bijection from `ΩBar` to `ΩBar`. -/ + bijOn : BijOn toFun bar bar + /-- `Ω` acts transitively as a single cycle on `ΩBar`. -/ + single_orbit : ∀ x ∈ bar, ∀ y ∈ bar, ∃ k : ℕ, (toFun^[k]) x = y + +instance {α : Type u} : CoeFun (CyclicPerm α) (fun _ => α → α) := + ⟨CyclicPerm.toFun⟩ + +namespace CyclicPerm + +variable {α : Type u} (Ω : CyclicPerm α) + +/-- "If $V$ is a set, a cyclic permutation $\Omega$ is said to be *in* $V$ if $\bar{\Omega} +\subseteq V$" +(Graph Minors IX, Section 1, page 41). -/ +def InSet (V : Set α) : Prop := + Ω.bar ⊆ V + +/-- `y` is the first term of the sequence `Ω(x), Ω(Ω(x)), …` which belongs to `X` +(Graph Minors IX, Section 1, page 41). -/ +def FirstHitIn (X : Set α) (x y : α) : Prop := + ∃ k : ℕ, 1 ≤ k ∧ (Ω.toFun^[k]) x = y ∧ y ∈ X ∧ ∀ j : ℕ, 1 ≤ j → j < k → (Ω.toFun^[j]) x ∉ X + +/-- `Ω'` is the restriction `Ω | X` of `Ω` to `X ⊆ ΩBar` (Graph Minors IX, Section 1, page 41: +"If $X \subseteq \bar{\Omega}$, $\Omega$ induces a cyclic permutation $\Omega'$ of $X$ in the +natural way—that is, for $x \in X$ we define $\Omega'(x)$ to be the first term of the +sequence $\Omega(x)$, $\Omega(\Omega(x))$, ... which is in $X$. We define $\Omega \mid X = +\Omega'$"). -/ +def IsRestriction (X : Set α) (Ω' : CyclicPerm α) : Prop := + Ω'.bar = Ω.bar ∩ X ∧ ∀ x ∈ Ω'.bar, Ω.FirstHitIn Ω'.bar x (Ω' x) + +/-- "Let $v_1, ..., v_k \in \bar{\Omega}$ be distinct. We say that $(v_1, v_2, ..., v_k)$ is +$\Omega$-*clockwise* (or more briefly, *clockwise*, when the dependence on $\Omega$ is to be +understood) if $\Omega'(v_1) = v_2$, $\Omega'(v_2) = v_3$, ..., $\Omega'(v_k) = v_1$ where +$\Omega' = \Omega \mid X$" with `X = {v₁, …, v_k}` +(Graph Minors IX, Section 1, page 41). -/ +def IsClockwiseSeq (L : List α) : Prop := + L.Nodup ∧ (∀ v ∈ L, v ∈ Ω.bar) ∧ + ∀ (i : ℕ) (hi : i < L.length), + Ω.FirstHitIn {v | v ∈ L} (L[i]) (L[(i + 1) % L.length]'(Nat.mod_lt _ (Nat.zero_lt_of_lt hi))) + +/-- `(v₁, v₂, v₃)` is `Ω`-clockwise (Graph Minors IX, Section 1, page 41). -/ +def IsClockwise3 (v₁ v₂ v₃ : α) : Prop := + Ω.IsClockwiseSeq [v₁, v₂, v₃] + +/-- `(v₁, v₂, v₃, v₄)` is `Ω`-clockwise (Graph Minors IX, Section 1, page 41). -/ +def IsClockwise4 (v₁ v₂ v₃ v₄ : α) : Prop := + Ω.IsClockwiseSeq [v₁, v₂, v₃, v₄] + +/-- "If $v_1, v_2, v_3, v_4 \in \bar{\Omega}$ are distinct and one of $(v_1, v_2, v_3, v_4)$, +$(v_4, v_3, v_2, v_1)$ is clockwise, we say that $\{v_1, v_3\}$ *crosses* $\{v_2, v_4" +(Graph Minors IX, Section 1, page 41). -/ +def Crosses (v₁ v₃ v₂ v₄ : α) : Prop := + Ω.IsClockwiseSeq [v₁, v₂, v₃, v₄] ∨ Ω.IsClockwiseSeq [v₄, v₃, v₂, v₁] + +/-- `{v₁, v₃}` crosses `{v₂, v₄}` as 2-element sets (Graph Minors IX, Section 1, page 41). -/ +def CrossesSet (A B : Set α) : Prop := + ∃ v₁ v₃ v₂ v₄ : α, A = {v₁, v₃} ∧ B = {v₂, v₄} ∧ Ω.Crosses v₁ v₃ v₂ v₄ + +/-- "If $v_1, v_2 \in \bar{\Omega}$ are distinct, we define $$\Omega(v_1, v_2) = \{v \in +\bar{\Omega} - \{v_1, v_2\} : (v_1, v, v_2) \text{ is clockwise}" +(Graph Minors IX, Section 1, page 41). -/ +def interval (v₁ v₂ : α) : Set α := + {v ∈ Ω.bar \ {v₁, v₂} | Ω.IsClockwise3 v₁ v v₂} + +/-- "A fence of $\Omega$ is a pair $(A, B)$ of subsets of $\bar{\Omega}$ such that $A \cap B = +\emptyset$, $A \cup B = \bar{\Omega}$, and for distinct $a_1, a_2 \in A$ and distinct $b_1, +b_2 \in B$, $\{a_1, a_2\}$ does not cross $\{b_1, b_2" +(Graph Minors IX, Section 1, page 41). -/ +def IsFence (A B : Set α) : Prop := + A ⊆ Ω.bar ∧ B ⊆ Ω.bar ∧ Disjoint A B ∧ A ∪ B = Ω.bar ∧ + ∀ a₁ ∈ A, ∀ a₂ ∈ A, a₁ ≠ a₂ → ∀ b₁ ∈ B, ∀ b₂ ∈ B, b₁ ≠ b₂ → ¬ Ω.Crosses a₁ a₂ b₁ b₂ + +/-- The inverse map of `Ω` on `ΩBar` (and the identity outside `ΩBar`). -/ +noncomputable def invFunBar (Ω : CyclicPerm α) (x : α) : α := by + classical + exact if h : ∃ y ∈ Ω.bar, Ω.toFun y = x then Classical.choose h else x + +theorem invFunBar_mem {Ω : CyclicPerm α} {x : α} (hx : x ∈ Ω.bar) : + Ω.invFunBar x ∈ Ω.bar := by + classical + have h : ∃ y ∈ Ω.bar, Ω.toFun y = x := Ω.bijOn.surjOn hx + simp only [invFunBar, h, ↓reduceDIte] + exact (Classical.choose_spec h).1 + +theorem toFun_invFunBar {Ω : CyclicPerm α} {x : α} (hx : x ∈ Ω.bar) : + Ω.toFun (Ω.invFunBar x) = x := by + classical + have h : ∃ y ∈ Ω.bar, Ω.toFun y = x := Ω.bijOn.surjOn hx + simp only [invFunBar, h, ↓reduceDIte] + exact (Classical.choose_spec h).2 + +theorem invFunBar_toFun {Ω : CyclicPerm α} {z : α} (hz : z ∈ Ω.bar) : + Ω.invFunBar (Ω.toFun z) = z := by + classical + have h : ∃ y ∈ Ω.bar, Ω.toFun y = Ω.toFun z := ⟨z, hz, rfl⟩ + have hspec := Classical.choose_spec h + simp only [invFunBar, h, ↓reduceDIte] + exact Ω.bijOn.injOn hspec.1 hz hspec.2 + +/-- The reverse (inverse) cyclic permutation `Ω⁻¹` on the same set `ΩBar` +(Graph Minors IX, Section 1, page 41). -/ +noncomputable def reverse (Ω : CyclicPerm α) : CyclicPerm α where + bar := Ω.bar + toFun := Ω.invFunBar + finite_bar := Ω.finite_bar + bijOn := + ⟨fun _ hx => Ω.invFunBar_mem hx, + fun _ hx _ hy h => by rw [← Ω.toFun_invFunBar hx, ← Ω.toFun_invFunBar hy, h], + fun x hx => ⟨Ω.toFun x, Ω.bijOn.mapsTo hx, Ω.invFunBar_toFun hx⟩⟩ + single_orbit := by + intro x hx y hy + obtain ⟨k, hk⟩ := Ω.single_orbit y hy x hx + refine ⟨k, ?_⟩ + have hmem : ∀ (n : ℕ) {z : α}, z ∈ Ω.bar → (Ω.toFun^[n]) z ∈ Ω.bar := by + intro n + induction n with + | zero => intro z hz; exact hz + | succ m ihm => intro z hz; rw [Function.iterate_succ_apply']; exact Ω.bijOn.mapsTo (ihm hz) + have hinv : ∀ (n : ℕ) {z : α}, z ∈ Ω.bar → + (Ω.invFunBar^[n]) ((Ω.toFun^[n]) z) = z := by + intro n + induction n with + | zero => intro z _; rfl + | succ n ih => + intro z hz + rw [Function.iterate_succ_apply, Function.iterate_succ_apply', + Ω.invFunBar_toFun (hmem n hz)] + exact ih hz + rw [← hk] + exact hinv k hy + +noncomputable instance : Inv (CyclicPerm α) := ⟨CyclicPerm.reverse⟩ + +end CyclicPerm + +/-! ### Graph operations, subgraphs, paths, and separations (Section 1, pages 41–42) -/ + +/-- `P` is a path in `G` with ends `a` and `b`: `P ≤ G` and the vertices and edges of `P` are those +of a simple walk of `G` between `a` and `b` (Graph Minors IX, Section 1, page 41). -/ +def IsGraphPathWithEnds {α : Type u} {β : Type v} (G P : Graph α β) (a b : α) : Prop := + P ≤ G ∧ ∃ W : GraphWalk P a b, W.IsSimple ∧ + V(P) = {x | x ∈ W.support} ∧ E(P) = {e | e ∈ W.edges} + +/-- `P` is a path in `G` (Graph Minors IX, Section 1, page 41). -/ +def IsGraphPath {α : Type u} {β : Type v} (G P : Graph α β) : Prop := + ∃ a b : α, IsGraphPathWithEnds G P a b + +/-- `C` is a circuit in `G`: `C ≤ G` and the vertices and edges of `C` are those of a simple closed +walk of positive length in `G` (Graph Minors IX, Section 1, page 41). -/ +def IsGraphCircuit {α : Type u} {β : Type v} (G C : Graph α β) : Prop := + C ≤ G ∧ ∃ (u : α) (W : GraphWalk C u u), W.IsSimpleClosed ∧ 0 < W.length ∧ + V(C) = {x | x ∈ W.support} ∧ E(C) = {e | e ∈ W.edges} + +/-- The set of ends of a path `P` in `G` (Graph Minors IX, Section 1, page 41). -/ +def pathEnds {α : Type u} {β : Type v} (G P : Graph α β) : Set α := + {v : α | ∃ b : α, IsGraphPathWithEnds G P v b} + +/-- The internal vertices of a path `P` in `G` (Graph Minors IX, Section 1, page 41). -/ +def pathInternalVerts {α : Type u} {β : Type v} (G P : Graph α β) : Set α := + V(P) \ pathEnds G P + +/-- The union `G₁ ∪ G₂` of two subgraphs of a graph `G`, with vertex set `V(G₁) ∪ V(G₂)` and edge +set `E(G₁) ∪ E(G₂)` (Graph Minors IX, Section 1, page 41). -/ +def subgraphUnion {α : Type u} {β : Type v} (G G₁ G₂ : Graph α β) : Graph α β := + (G.induce (V(G₁) ∪ V(G₂))).restrict (E(G₁) ∪ E(G₂)) + +/-- The intersection `G₁ ∩ G₂` of two subgraphs of a graph `G`, with vertex set `V(G₁) ∩ V(G₂)` and +edge set `E(G₁) ∩ E(G₂)` (Graph Minors IX, Section 1, page 41). -/ +def subgraphInter {α : Type u} {β : Type v} (G G₁ G₂ : Graph α β) : Graph α β := + (G.induce (V(G₁) ∩ V(G₂))).restrict (E(G₁) ∩ E(G₂)) + +/-- The union `⋃ P_set` of a family `P_set` of subgraphs of `G` +(Graph Minors IX, Section 1, page 41). -/ +def subgraphSUnion {α : Type u} {β : Type v} (G : Graph α β) (P_set : Set (Graph α β)) : + Graph α β := + (G.induce (⋃ P ∈ P_set, V(P))).restrict (⋃ P ∈ P_set, E(P)) + +/-- `G \ X`, the subgraph obtained from `G` by deleting a set `X` of vertices and all incident +edges (Graph Minors IX, Section 2, page 43). -/ +def deleteVertices {α : Type u} {β : Type v} (G : Graph α β) (X : Set α) : Graph α β := + G.induce (V(G) \ X) + +/-- The point in `S` representing a vertex `v` in a graph drawing `Γ : GraphDrawing G S` (as a +singleton set `{x}` when `v ∈ V(G)` and `∅` otherwise). -/ +def graphDrawingVertexSet {α : Type u} {β : Type v} {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) (v : α) : Set S := + {x : S | ∃ hv : v ∈ V(G), (Γ.iso.vertexEquiv ⟨v, hv⟩).1 = x} + +/-- The edge arc in `S` representing an edge `e` in a graph drawing `Γ : GraphDrawing G S`. -/ +def graphDrawingEdgeSet {α : Type u} {β : Type v} {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) (e : β) : Set S := + ⋃ (he : e ∈ E(G)), (Γ.iso.edgeEquiv ⟨e, he⟩).1 + +/-- The underlying point set `U(Γ(P))` of a subgraph `P ≤ G` in a graph drawing `Γ`. -/ +def graphDrawingSubgraphU {α : Type u} {β : Type v} {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) (P : Graph α β) : Set S := + (⋃ v ∈ V(P), graphDrawingVertexSet Γ v) ∪ (⋃ e ∈ E(P), closure (graphDrawingEdgeSet Γ e)) + +/-- "A society is a pair $(G, \Omega)$ where $G$ is a graph and $\Omega$ is a cyclic permutation +in $V(G)$" +(Graph Minors IX, Section 1, page 41). Graphs in the paper are finite. -/ +structure Society (α : Type u) (β : Type v) where + /-- The underlying graph `G`. -/ + G : Graph α β + /-- The cyclic permutation `Ω` in `V(G)`. -/ + Ω : CyclicPerm α + /-- `V(G)` is finite. -/ + finite_V : V(G).Finite + /-- `E(G)` is finite. -/ + finite_E : E(G).Finite + /-- `ΩBar ⊆ V(G)`. -/ + bar_subset : Ω.bar ⊆ V(G) + +namespace Society + +variable {α : Type u} {β : Type v} (S : Society α β) + +/-- `P` is an `Ω`-path in `(G, Ω)` with ends `a, b` (Graph Minors IX, Section 1, page 41: +"If $(G, \Omega)$ is a society we say that $P$ is an $\Omega$-*path* if $P$ is a path in $G$ +with ends distinct and both in $\bar{\Omega}$"). -/ +def IsOmegaPathWithEnds (P : Graph α β) (a b : α) : Prop := + IsGraphPathWithEnds S.G P a b ∧ a ≠ b ∧ a ∈ S.Ω.bar ∧ b ∈ S.Ω.bar + +/-- `P` is an `Ω`-path in `(G, Ω)` (Graph Minors IX, Section 1, page 41). -/ +def IsOmegaPath (P : Graph α β) : Prop := + ∃ a b : α, S.IsOmegaPathWithEnds P a b + +/-- `P_set` is a set of mutually vertex-disjoint `Ω`-paths in `(G, Ω)` +(Graph Minors IX, Section 1, page 41). -/ +def IsDisjointOmegaPathSet (P_set : Set (Graph α β)) : Prop := + (∀ P ∈ P_set, S.IsOmegaPath P) ∧ P_set.Pairwise (fun P₁ P₂ => Disjoint V(P₁) V(P₂)) + +/-- "If $\mathcal{P}$ is a set of mutually vertex-disjoint $\Omega$-paths, we say that a fence +$(A, B)$ of $\Omega$ is a *fence for* $\mathcal{P}$ if each $P \in \mathcal{P}$ has one end +in $A$ and the other in $B$" +(Graph Minors IX, Section 1, page 41). -/ +def IsFenceFor (P_set : Set (Graph α β)) (A B : Set α) : Prop := + S.IsDisjointOmegaPathSet P_set ∧ S.Ω.IsFence A B ∧ + ∀ P ∈ P_set, ∃ a ∈ A, ∃ b ∈ B, S.IsOmegaPathWithEnds P a b + +/-- "and if there is a fence for $\mathcal{P}$ we say that $\mathcal{P}$ is a *transaction in* +$(G, \Omega)$" +(Graph Minors IX, Section 1, page 41). -/ +def IsTransaction (P_set : Set (Graph α β)) : Prop := + ∃ A B : Set α, S.IsFenceFor P_set A B + +/-- `V(P_set)`, "the set of all ends of all members of $\mathcal{P}$" +(Graph Minors IX, Section 1, page 41). -/ +def transactionEnds (P_set : Set (Graph α β)) : Set α := + {v : α | ∃ P ∈ P_set, ∃ b : α, S.IsOmegaPathWithEnds P v b} + +/-- `⋃ P_set`, "the subgraph of $G$ which is the union of all members of $\mathcal{P}$" +(Graph Minors IX, Section 1, page 41). -/ +def transactionUnion (P_set : Set (Graph α β)) : Graph α β := + subgraphSUnion S.G P_set + +/-- "Let $P \in \mathcal{P}$ have ends $a, b$. We say that $P$ is *peripheral in* $\mathcal{P}$ +if one of $\Omega(a, b) \cap V(\mathcal{P})$, $\Omega(b, a) \cap V(\mathcal{P})$ is empty" (Graph +Minors IX, Section 1, page 41). -/ +def IsPeripheralIn (P_set : Set (Graph α β)) (P : Graph α β) : Prop := + P ∈ P_set ∧ ∃ a b : α, S.IsOmegaPathWithEnds P a b ∧ + (Disjoint (S.Ω.interval a b) (S.transactionEnds P_set) ∨ + Disjoint (S.Ω.interval b a) (S.transactionEnds P_set)) + +/-- "A transaction with no peripheral members is said to be *crooked*" +(Graph Minors IX, Section 1, page 41). -/ +def IsCrookedTransaction (P_set : Set (Graph α β)) : Prop := + S.IsTransaction P_set ∧ ∀ P ∈ P_set, ¬ S.IsPeripheralIn P_set P + +/-- "A separation of a society $(G, \Omega)$ is a separation $(G_1, G_2)$ of $G$ such that +$\bar{\Omega} \subseteq V(G_2)$" +(Graph Minors IX, Section 1, page 42). -/ +def IsSocietySeparation (G₁ G₂ : Graph α β) : Prop := + IsGraphSeparation S.G G₁ G₂ ∧ S.Ω.bar ⊆ V(G₂) + +end Society + +/-- "We say that $(G, \Omega, \Omega_0)$ is a *neighborhood* if $G$ is a graph and $\Omega, +\Omega_0$ are both cyclic permutations in $V(G)$" (Graph Minors IX, Section 1, page 42). -/ +structure Neighborhood (α : Type u) (β : Type v) where + /-- The underlying graph `G`. -/ + G : Graph α β + /-- The outer cyclic permutation `Ω` in `V(G)`. -/ + Ω : CyclicPerm α + /-- The inner cyclic permutation `Ω₀` in `V(G)`. -/ + Ω₀ : CyclicPerm α + /-- `V(G)` is finite. -/ + finite_V : V(G).Finite + /-- `E(G)` is finite. -/ + finite_E : E(G).Finite + /-- `ΩBar ⊆ V(G)`. -/ + bar_subset : Ω.bar ⊆ V(G) + /-- `ΩBar₀ ⊆ V(G)`. -/ + bar₀_subset : Ω₀.bar ⊆ V(G) + +/-- A cyclic permutation `Ω` of a finite subset of an `O`-arc `C` agrees with a homeomorphism +`φ : Circle ≃ₜ C` (orienting `C`) under `ν : α → S` if the cyclic order of `Ω` on `ΩBar` matches the +circular order on `Circle` induced by `φ` (Graph Minors IX, Section 1, page 42). -/ +def AgreesWithOArcHomeo {S : Type w} [TopologicalSpace S] {α : Type u} + (ν : α → S) (Ω : CyclicPerm α) (C : Set S) (φ : Circle ≃ₜ C) : Prop := + (∀ v ∈ Ω.bar, ν v ∈ C) ∧ + ∀ v₁ v₂ v₃ : α, Ω.IsClockwise3 v₁ v₂ v₃ → + ∃ (t₁ t₂ t₃ : ℝ), t₁ < t₂ ∧ t₂ < t₃ ∧ t₃ < t₁ + 2 * Real.pi ∧ + (φ (Circle.exp t₁)).1 = ν v₁ ∧ + (φ (Circle.exp t₂)).1 = ν v₂ ∧ + (φ (Circle.exp t₃)).1 = ν v₃ + +/-- Clockwise agreement for a `GraphDrawing Γ` on an `O`-arc `C` via `φ : Circle ≃ₜ C`. -/ +def DrawingAgreesWithOArcHomeo {S : Type w} [TopologicalSpace S] {α : Type u} {β : Type v} + {G : Graph α β} (Γ : GraphDrawing G S) (Ω : CyclicPerm α) (C : Set S) + (φ : Circle ≃ₜ C) : Prop := + (∀ v ∈ Ω.bar, graphDrawingVertexSet Γ v ⊆ C) ∧ + ∀ v₁ v₂ v₃ : α, Ω.IsClockwise3 v₁ v₂ v₃ → + ∃ (t₁ t₂ t₃ : ℝ), t₁ < t₂ ∧ t₂ < t₃ ∧ t₃ < t₁ + 2 * Real.pi ∧ + (φ (Circle.exp t₁)).1 ∈ graphDrawingVertexSet Γ v₁ ∧ + (φ (Circle.exp t₂)).1 ∈ graphDrawingVertexSet Γ v₂ ∧ + (φ (Circle.exp t₃)).1 ∈ graphDrawingVertexSet Γ v₃ + +/-- "Let $\Sigma$ be a plane, with some orientation called “clockwise.” We say that a +neighborhood $(G, \Omega, \Omega_0)$ is *rural* if $G$ has a drawing $\Gamma$ in $\Sigma$ +without crossings (so $G$ is planar) and there are closed discs $\Delta_0 \subseteq \Delta +\subseteq \Sigma$, such that (i) the drawing $\Gamma$ uses no point of $\Sigma$ outside +$\Delta$, and none in the interior of $\Delta_0$, and (ii) for $v \in V(G)$, the point of +$\Sigma$ representing $v$ in the drawing $\Gamma$ lies in $bd(\Delta)$ (respectively, +$bd(\Delta_0)$) if and only if $v \in \bar{\Omega}$ (respectively, $v \in \bar{\Omega}_0$), +and the cyclic permutation of $\bar{\Omega}$ (respectively, $\bar{\Omega}_0$) obtained from +the clockwise orientation of $bd(\Delta)$ (respectively, $bd(\Delta_0)$) coincides (in the +natural sense) with $\Omega$ (respectively, $\Omega_0$)." +(Graph Minors IX, Section 1, page 42). -/ +def Neighborhood.IsRural {α : Type u} {β : Type v} (N : Neighborhood α β) : Prop := + ∃ (Γ : GraphDrawing N.G EuclideanPlane) (Δ Δ₀ : Set EuclideanPlane), + IsClosedDisc Δ ∧ Δ₀ ⊆ Δ ∧ Γ.drawing.U ⊆ Δ \ interior Δ₀ ∧ + (∀ v ∈ V(N.G), (graphDrawingVertexSet Γ v ⊆ subBd Δ ↔ v ∈ N.Ω.bar)) ∧ + (∀ v ∈ V(N.G), (graphDrawingVertexSet Γ v ⊆ subBd Δ₀ ↔ v ∈ N.Ω₀.bar)) ∧ + (∃ φ : Circle ≃ₜ subBd Δ, + IsClockwiseDiscHomeo Δ φ ∧ DrawingAgreesWithOArcHomeo Γ N.Ω (subBd Δ) φ) ∧ + ((Δ₀ = ∅ ∧ N.Ω₀.bar = ∅) ∨ + (IsClosedDisc Δ₀ ∧ + ∃ φ₀ : Circle ≃ₜ subBd Δ₀, + IsClockwiseDiscHomeo Δ₀ φ₀ ∧ DrawingAgreesWithOArcHomeo Γ N.Ω₀ (subBd Δ₀) φ₀)) + +/-- "Let $(G_1, G_2)$ be a separation of $(G, \Omega)$, and let $\Omega_1$ be a cyclic +permutation with $\bar{\Omega}_1 = V(G_1 \cap G_2)$. Then we say that $(G, \Omega)$ is the +*composition* of the society $(G_1, \Omega_1)$ with the neighborhood $(G_2, \Omega, +\Omega_1)$" (Graph Minors IX, Section 1, page 42). -/ +def Society.IsComposition {α : Type u} {β : Type v} (S S₁ : Society α β) (N : Neighborhood α β) : + Prop := + S.IsSocietySeparation S₁.G N.G ∧ + N.Ω = S.Ω ∧ N.Ω₀ = S₁.Ω ∧ S₁.Ω.bar = V(S₁.G) ∩ V(N.G) + +/-- A society `(G, Ω)` has sophistication `≤ p` if it is the composition of a society `(G₁, Ω₁)` +which has no transaction of cardinality `> p` with a rural neighborhood `(G₂, Ω, Ω₁)` +(Graph Minors IX, Section 1, page 42). -/ +def Society.HasSophisticationLE {α : Type u} {β : Type v} (S : Society α β) (p : ℕ) : Prop := + ∃ (S₁ : Society α β) (N : Neighborhood α β), + S.IsComposition S₁ N ∧ N.IsRural ∧ + ∀ P_set : Set (Graph α β), S₁.IsTransaction P_set → P_set.ncard ≤ p + +/-- "The *sophistication* of $(G, \Omega)$ is the minimum $p \ge 0$ such that $(G, \Omega)$ is +the composition of a society which has no transaction of cardinality $> p$ with a rural +neighborhood" +(Graph Minors IX, Section 1, page 42). -/ +noncomputable def Society.sophistication {α : Type u} {β : Type v} (S : Society α β) : ℕ := + sInf {p : ℕ | S.HasSophisticationLE p} + +/-! ## Section 2: Two Crossing Paths (pages 43–46) -/ + +/-- "If $P$ is a path in a graph $G$ and $Z \subseteq V(G)$ with $Z \cap V(P) = \emptyset$, we +say that $P$ *avoids* $Z$" (Graph Minors IX, Section 2, page 43). -/ +def Avoids {α : Type u} {β : Type v} (P : Graph α β) (Z : Set α) : Prop := + Disjoint Z V(P) + +/-- "We say that $Z$ *catches* $G$ if $Z \subseteq V(G)$ and $Z \cap V(G') \ne \emptyset$ for +every component $G'$ of $G$" (Graph Minors IX, Section 2, page 43). -/ +def Catches {α : Type u} {β : Type v} (Z : Set α) (G : Graph α β) : Prop := + Z ⊆ V(G) ∧ ∀ G' ∈ graphComponents G, (Z ∩ V(G')).Nonempty + +/-- "Let $G$ be a graph and let $X, Y \subseteq V(G)$. By an $X \to Y$ path in $G$ we mean a path +with initial vertex and no other in $X$, and with terminal vertex and no other in $Y$" +(Graph Minors IX, Section 2, page 44). -/ +def IsFromToPathWithEnds {α : Type u} {β : Type v} (G P : Graph α β) (X Y : Set α) + (x y : α) : Prop := + IsGraphPathWithEnds G P x y ∧ V(P) ∩ X = {x} ∧ V(P) ∩ Y = {y} + +/-- `P` is an `X → Y` path in `G` (Graph Minors IX, Section 2, page 44). -/ +def IsFromToPath {α : Type u} {β : Type v} (G P : Graph α β) (X Y : Set α) : Prop := + ∃ x y : α, IsFromToPathWithEnds G P X Y x y + +/-- "Let $X' \subseteq X$ and $Y' \subseteq Y$ be such that $|X'| = |Y'|$. We write $X' +\Rightarrow Y'$ (with respect to $X, Y$) if there are $|X'|$ mutually disjoint $X \to Y$ +paths of $G$ from $X'$ to $Y'$" +(Graph Minors IX, Section 2, page 44). -/ +def RedirectsTo {α : Type u} {β : Type v} (G : Graph α β) (X Y X' Y' : Set α) : Prop := + X' ⊆ X ∧ Y' ⊆ Y ∧ X'.ncard = Y'.ncard ∧ + ∃ P : Fin X'.ncard → Graph α β, + Pairwise (fun i j => Disjoint V(P i) V(P j)) ∧ + ∀ i : Fin X'.ncard, ∃ x ∈ X', ∃ y ∈ Y', IsFromToPathWithEnds G (P i) X Y x y + +/-- "Let $(G, \Omega)$ be a society, and let $(G_1, G_2)$ be a separation of $(G, \Omega)$. Let +$k \ge 0$ be an integer. We say that $(G_1, G_2)$ is a *$k$-separation* of $(G, \Omega)$ if +$|V(G_1 \cap G_2)| \le k$, and $V(G_2) \ne V(G)$" (Graph Minors IX, Section 2, page 44). -/ +def Society.IsKSeparation {α : Type u} {β : Type v} (S : Society α β) (k : ℕ) + (G₁ G₂ : Graph α β) : Prop := + S.IsSocietySeparation G₁ G₂ ∧ (V(G₁) ∩ V(G₂)).ncard ≤ k ∧ V(G₂) ≠ V(S.G) + +/-- "A $k$-separation is *internal* if $|V(G)| \ge |V(G_2)| + 2$" +(Graph Minors IX, Section 2, page 44). -/ +def Society.IsInternalKSeparation {α : Type u} {β : Type v} (S : Society α β) (k : ℕ) + (G₁ G₂ : Graph α β) : Prop := + S.IsKSeparation k G₁ G₂ ∧ V(G₂).ncard + 2 ≤ V(S.G).ncard + +/-- "We say that $(G, \Omega)$ is *$k$-connected* if it has no $k'$-separation for $k' < k$, and +*internally $k$-connected* if it has no internal $k'$-separation for $k' < k$" +(Graph Minors IX, Section 2, page 44). -/ +def Society.IsKConnected {α : Type u} {β : Type v} (S : Society α β) (k : ℕ) : Prop := + ∀ k' < k, ∀ G₁ G₂ : Graph α β, ¬ S.IsKSeparation k' G₁ G₂ + +/-- `(G, Ω)` is internally `k`-connected (Graph Minors IX, Section 2, page 44). -/ +def Society.IsInternallyKConnected {α : Type u} {β : Type v} (S : Society α β) (k : ℕ) : Prop := + ∀ k' < k, ∀ G₁ G₂ : Graph α β, ¬ S.IsInternalKSeparation k' G₁ G₂ + +/-- "Let $P_1, P_2$ be disjoint $\Omega$-paths in $(G, \Omega)$, where $P_i$ has ends $s_i, t_i$ +($i = 1, 2$). If $\{s_1, t_1\}$ crosses $\{s_2, t_2\}$, we say that $P_1$ *crosses* $P_2$, +and that $\{P_1, P_2\}$ is a *cross" (Graph Minors IX, Section 2, page 44). -/ +def Society.OmegaPathsCross {α : Type u} {β : Type v} (S : Society α β) + (P₁ P₂ : Graph α β) : Prop := + Disjoint V(P₁) V(P₂) ∧ + ∃ s₁ t₁ s₂ t₂ : α, + S.IsOmegaPathWithEnds P₁ s₁ t₁ ∧ + S.IsOmegaPathWithEnds P₂ s₂ t₂ ∧ + S.Ω.Crosses s₁ t₁ s₂ t₂ + +/-- `{P₁, P₂}` is a cross in `(G, Ω)` (Graph Minors IX, Section 2, page 44). -/ +def Society.IsCross {α : Type u} {β : Type v} (S : Society α β) (P₁ P₂ : Graph α β) : Prop := + S.OmegaPathsCross P₁ P₂ + +/-- "Now let $u, v$ be distinct vertices of $G$, and let $P_1, P_2, P_3$ all be paths between $u$ +and $v$, mutually disjoint except for $u$ and $v$. We say that $\{P_1, P_2, P_3\}$ is a +*tripod* in $(G, \Omega)$ if there is an internal vertex $s_i$ of $P_i$ ($i = 1, 2, 3$), and +there exist $t_1, t_2, t_3 \in \bar{\Omega}$ such that $\{s_1, s_2, s_3\} \Rightarrow \{t_1, +t_2, t_3\}$ with respect to $V(P_1 \cup P_2 \cup P_3), \bar{\Omega}$" +(Graph Minors IX, Section 2, page 44). -/ +def Society.IsTripod {α : Type u} {β : Type v} (S : Society α β) (P₁ P₂ P₃ : Graph α β) : Prop := + ∃ u v : α, u ≠ v ∧ + IsGraphPathWithEnds S.G P₁ u v ∧ + IsGraphPathWithEnds S.G P₂ u v ∧ + IsGraphPathWithEnds S.G P₃ u v ∧ + V(P₁) ∩ V(P₂) = {u, v} ∧ + V(P₁) ∩ V(P₃) = {u, v} ∧ + V(P₂) ∩ V(P₃) = {u, v} ∧ + ∃ s₁ ∈ V(P₁) \ {u, v}, ∃ s₂ ∈ V(P₂) \ {u, v}, ∃ s₃ ∈ V(P₃) \ {u, v}, + ∃ t₁ ∈ S.Ω.bar, ∃ t₂ ∈ S.Ω.bar, ∃ t₃ ∈ S.Ω.bar, + RedirectsTo S.G (V(P₁) ∪ V(P₂) ∪ V(P₃)) S.Ω.bar {s₁, s₂, s₃} {t₁, t₂, t₃} + +/-- "A society $(G, \Omega)$ is rural if $(G, \Omega, \Omega_0)$ is rural where $\bar{\Omega}_0 = +\emptyset$" +(Graph Minors IX, Section 2, page 45). -/ +def Society.IsRuralSociety {α : Type u} {β : Type v} (S : Society α β) : Prop := + ∃ (Ω₀ : CyclicPerm α) (h₀ : Ω₀.bar ⊆ V(S.G)), + Ω₀.bar = ∅ ∧ (Neighborhood.mk S.G S.Ω Ω₀ S.finite_V S.finite_E S.bar_subset h₀).IsRural + +/-! ## Section 3: Attachments (pages 46–48) -/ + +namespace Society + +variable {α : Type u} {β : Type v} (S : Society α β) + +/-- "Let $\mathscr{P}$ be a transaction in $(G, \Omega)$, and let $P$ be a $V(\bigcup +\mathscr{P}) \to (\bar{\Omega} - V(\mathscr{P}))$ path in $G$. We call $P$ an *attachment* +to $\mathscr{P}$. The common vertex of $\bigcup \mathscr{P}$ and $P$ is called the *foot* of +the attachment, while the member $P_1$ of $\mathscr{P}$ of which the foot is a vertex is +called the *leg" (Graph Minors IX, Section 3, page 46). -/ +def IsAttachmentWithEnds (P_set : Set (Graph α β)) (P : Graph α β) (b u : α) : Prop := + IsFromToPathWithEnds S.G P V(S.transactionUnion P_set) (S.Ω.bar \ S.transactionEnds P_set) b u + +/-- `P` is an attachment to `P_set` (Graph Minors IX, Section 3, page 46). -/ +def IsAttachment (P_set : Set (Graph α β)) (P : Graph α β) : Prop := + ∃ b u : α, S.IsAttachmentWithEnds P_set P b u + +/-- `b` is the foot of an attachment `P` to `P_set` (Graph Minors IX, Section 3, page 46). -/ +def IsFoot (P_set : Set (Graph α β)) (P : Graph α β) (b : α) : Prop := + ∃ u : α, S.IsAttachmentWithEnds P_set P b u + +/-- `L` is the leg of an attachment `P` to `P_set` (Graph Minors IX, Section 3, page 46). -/ +def IsLeg (P_set : Set (Graph α β)) (P L : Graph α β) : Prop := + L ∈ P_set ∧ ∃ b : α, S.IsFoot P_set P b ∧ b ∈ V(L) + +/-- "The union of $P$ with a subpath of $P_1$ from the foot to an end of $P_1$ is called a *switch" +(Graph Minors IX, Section 3, page 46). -/ +def IsSwitch (P_set : Set (Graph α β)) (P L L' : Graph α β) : Prop := + L ∈ P_set ∧ + ∃ b u a₁ b₁ : α, + S.IsAttachmentWithEnds P_set P b u ∧ + b ∈ V(L) ∧ + S.IsOmegaPathWithEnds L a₁ b₁ ∧ + ∃ Q : Graph α β, + (IsGraphPathWithEnds L Q b a₁ ∨ IsGraphPathWithEnds L Q b b₁) ∧ + L' = subgraphUnion S.G P Q + +/-- "If $\mathscr{P}$ is crooked, the attachment $P$ is *exchangeable* if there is a switch $S$ +such that $(\mathscr{P} - \{P_1\}) \cup \{S\}$ is a crooked transaction" (Graph Minors IX, Section +3, page 46). -/ +def IsExchangeableAttachment (P_set : Set (Graph α β)) (P : Graph α β) : Prop := + S.IsAttachment P_set P ∧ + ∃ L L' : Graph α β, S.IsSwitch P_set P L L' ∧ + S.IsCrookedTransaction ((P_set \ {L}) ∪ {L'}) + +/-- "Let $\mathscr{P}$ be a crooked transaction and let $P \in \mathscr{P}$. If $\mathscr{P} - +\{P\}$ has two peripheral members we say that $P$ is an *overpass* of $\mathscr{P}$" (Graph Minors +IX, Section 3, page 46). -/ +def IsOverpass (P_set : Set (Graph α β)) (P : Graph α β) : Prop := + S.IsCrookedTransaction P_set ∧ P ∈ P_set ∧ + ∃ P₁ ∈ P_set \ {P}, ∃ P₂ ∈ P_set \ {P}, + P₁ ≠ P₂ ∧ S.IsPeripheralIn (P_set \ {P}) P₁ ∧ S.IsPeripheralIn (P_set \ {P}) P₂ + +/-- "If $P$ is an attachment to $\mathscr{P}$ with leg an overpass of $\mathscr{P}$, we call it +an *overpass attachment" (Graph Minors IX, Section 3, page 47). -/ +def IsOverpassAttachment (P_set : Set (Graph α β)) (P : Graph α β) : Prop := + S.IsAttachment P_set P ∧ + ∃ L : Graph α β, S.IsLeg P_set P L ∧ S.IsOverpass P_set L + +/-! ## Section 4: Separating `Ω`-Paths (pages 49–52) -/ + +/-- "Let $(G, \Omega)$ be a society. An $\Omega$-path $P$ is *non-separating* if there is an +$\Omega$-path $P'$ such that $P'$ crosses $P$, and *separating* otherwise" (Graph Minors IX, Section +4, page 49). -/ +def IsNonSeparatingOmegaPath (P : Graph α β) : Prop := + S.IsOmegaPath P ∧ ∃ P' : Graph α β, S.OmegaPathsCross P' P + +/-- `P` is a separating `Ω`-path in `(G, Ω)` (Graph Minors IX, Section 4, page 49). -/ +def IsSeparatingOmegaPath (P : Graph α β) : Prop := + S.IsOmegaPath P ∧ ¬ ∃ P' : Graph α β, S.OmegaPathsCross P' P + +/-- Statement **S** of Graph Minors IX, Section 4 (page 49): +"{Q}$ is a transaction in a society $(G, \Omega)$, such that no member of $\mathscr{Q}$ has +an internal vertex in $\bar{\Omega}$. A crooked transaction $\mathscr{P}$ in $(G, \Omega)$ +is chosen with $|\mathscr{P}| \ge p$ (where $p \ge 2$ is some given integer), such that* (i) +*$\bigcup \mathscr{P} \cup \bigcup \mathscr{Q}$ is minimal* (ii) *subject to (i), +$|\mathscr{P}|$ is minimum,* *and $(A, B)$ is a fence for $\mathscr{P}$." -/ +structure StatementS (p : ℕ) (P_set Q_set : Set (Graph α β)) (A B : Set α) : Prop where + /-- `p ≥ 2`. -/ + two_le_p : 2 ≤ p + /-- `Q_set` is a transaction in `(G, Ω)`. -/ + isTransaction_Q : S.IsTransaction Q_set + /-- No member of `Q_set` has an internal vertex in `ΩBar`. -/ + no_internal_in_bar : ∀ Q ∈ Q_set, Disjoint (pathInternalVerts S.G Q) S.Ω.bar + /-- `P_set` is a crooked transaction in `(G, Ω)`. -/ + isCrooked_P : S.IsCrookedTransaction P_set + /-- `|P_set| ≥ p`. -/ + card_P_ge : p ≤ P_set.ncard + /-- (i) `⋃ P_set ∪ ⋃ Q_set` is minimal. -/ + minimal_union : ∀ P_set' : Set (Graph α β), + S.IsCrookedTransaction P_set' → p ≤ P_set'.ncard → + subgraphUnion S.G (S.transactionUnion P_set') (S.transactionUnion Q_set) ≤ + subgraphUnion S.G (S.transactionUnion P_set) (S.transactionUnion Q_set) → + subgraphUnion S.G (S.transactionUnion P_set') (S.transactionUnion Q_set) = + subgraphUnion S.G (S.transactionUnion P_set) (S.transactionUnion Q_set) + /-- (ii) Subject to (i), `|P_set|` is minimum. -/ + minimal_card : ∀ P_set' : Set (Graph α β), + S.IsCrookedTransaction P_set' → p ≤ P_set'.ncard → + subgraphUnion S.G (S.transactionUnion P_set') (S.transactionUnion Q_set) = + subgraphUnion S.G (S.transactionUnion P_set) (S.transactionUnion Q_set) → + P_set.ncard ≤ P_set'.ncard + /-- `(A, B)` is a fence for `P_set`. -/ + isFenceFor_P : S.IsFenceFor P_set A B + +/-- `W(Q_set)`, the set of vertices `v ∈ V(Q_set)` such that `v ∉ V(P_set)` and `Q ∩ ⋃ P_set` is +non-null, where `Q` is the member of `Q_set` with end `v` (Graph Minors IX, Section 4, +pages 49–50). -/ +def uncoveredSet (P_set Q_set : Set (Graph α β)) : Set α := + {v ∈ S.transactionEnds Q_set | v ∉ S.transactionEnds P_set ∧ + ∃ Q ∈ Q_set, v ∈ pathEnds S.G Q ∧ (V(Q) ∩ V(S.transactionUnion P_set)).Nonempty} + +/-- "If $v \in W(\mathscr{Q})$, we define the *attachment corresponding to $v$* to be the minimal +subpath of $\bigcup \mathscr{Q}$ between $v$ and $\bigcup \mathscr{P}$" (Graph Minors IX, Section 4, +page 50). -/ +def IsCorrespondingAttachment (P_set Q_set : Set (Graph α β)) (v : α) (P : Graph α β) : Prop := + v ∈ S.uncoveredSet P_set Q_set ∧ + ∃ Q ∈ Q_set, v ∈ pathEnds S.G Q ∧ P ≤ Q ∧ + ∃ b : α, S.IsAttachmentWithEnds P_set P b v + +/-- "If $Q$ satisfies (4.3) (iii) we say that $Q$ is *half-covered" (Graph Minors IX, Section 4, +page 50), where (4.3) (iii) states: "$Q$ meets exactly one member $P$ of $\mathscr{P}$, $P \cap Q$ +is a path, and $P, Q$ and $P +\cap Q$ have a common end, and the other end of $Q$ is not in $V(\mathscr{P})$." -/ +def IsHalfCovered (P_set : Set (Graph α β)) (Q : Graph α β) : Prop := + ∃ P ∈ P_set, + (V(P) ∩ V(Q)).Nonempty ∧ + (∀ P' ∈ P_set, (V(P') ∩ V(Q)).Nonempty → P' = P) ∧ + ∃ s t a b c : α, + S.IsOmegaPathWithEnds P s t ∧ + S.IsOmegaPathWithEnds Q a b ∧ + s = a ∧ b ∉ S.transactionEnds P_set ∧ + IsGraphPathWithEnds S.G (subgraphInter S.G P Q) s c + +/-- "Let $P_1, ..., P_k$ be mutually disjoint $\Omega$-paths. We say that $P_1, ..., P_k$ are *in +order* if there is a clockwise sequence $$ (a_k, a_{k-1}, ..., a_2, a_1, b_1, b_2, ..., +b_{k-1}, b_k), $$ where $P_i$ has ends $a_i, b_i$ ($1 \le i \le k$)" (Graph Minors IX, Section 4, +page 50). -/ +def AreInOrder (Q : List (Graph α β)) : Prop := + Q.Pairwise (fun P₁ P₂ => Disjoint V(P₁) V(P₂)) ∧ + ∃ (a b : List α) (ha : a.length = Q.length) (hb : b.length = Q.length), + (∀ (i : ℕ) (hi : i < Q.length), + S.IsOmegaPathWithEnds (Q[i]) (a[i]'(by omega)) (b[i]'(by omega))) ∧ + S.Ω.IsClockwiseSeq (a.reverse ++ b) + +/-! ## Section 6: The Main Theorem (pages 55–58) -/ + +/-- "Let $\mathcal{P}$ be a transaction in $(G, \Omega)$, with $|\mathcal{P}| \ge 2$. If $P \in +\mathcal{P}$ is peripheral and has ends $s, t$, we define $U(P) = \Omega(t, s)$, where +$\Omega(s, t) \cap V(\mathcal{P}) = \emptyset$." +(Graph Minors IX, Section 6, page 55). -/ +def peripheralIntervalSet (P_set : Set (Graph α β)) (P : Graph α β) : Set α := + ⋃ (s : α) (t : α) + (_ : S.IsOmegaPathWithEnds P s t ∧ Disjoint (S.Ω.interval s t) (S.transactionEnds P_set)), + S.Ω.interval t s + +/-- "If $\mathcal{P}$ is crooked, we define $U(\mathcal{P}) = \bar{\Omega}$, and otherwise we +define $U(\mathcal{P})$ to be the intersection of the sets $U(P)$, taken over all peripheral +$P \in \mathcal{P}$" +(Graph Minors IX, Section 6, page 55). -/ +def transactionPeripheralUnion (P_set : Set (Graph α β)) : Set α := + S.Ω.bar ∩ ⋂ P ∈ {P ∈ P_set | S.IsPeripheralIn P_set P}, S.peripheralIntervalSet P_set P + +/-- "We define $C(\mathcal{P})$ to be the set of all vertices $v$ of $G$ such that there is a +path in $G$ between $\{v\}$ and $U(\mathcal{P})$ which avoids every peripheral member of +$\mathcal{P}$" +(Graph Minors IX, Section 6, page 55). -/ +def coveredComponentUnion (P_set : Set (Graph α β)) : Set α := + {v ∈ V(S.G) | ∃ u ∈ S.transactionPeripheralUnion P_set, ∃ Q : Graph α β, + IsGraphPathWithEnds S.G Q v u ∧ + ∀ P ∈ P_set, S.IsPeripheralIn P_set P → Avoids Q V(P)} + +/-! ## Section 7: Some Special Transactions (pages 58–60) -/ + +/-- "Let $\mathcal{P}$ be a transaction. If there is a fence $(A, B)$ for $\mathcal{P}$, and an +enumeration $\mathcal{P} = \{P_1, \dots, P_p\}$, where $P_i$ has ends $a_i \in A$, $b_i \in +B$ ($1 \le i \le p$), such that $(a_p, a_{p-1}, \dots, a_1, b_1)$ is clockwise, and (i) $p +\ge 2$ and $(a_p, a_{p-1}, \dots, a_2, a_1, b_p, b_{p-1}, \dots, b_2, b_1)$ is clockwise, we +say $\mathcal{P}$ is a *crosscap" (Graph Minors IX, Section 7, page 59). -/ +def IsCrosscapTransaction (P_set : Set (Graph α β)) : Prop := + ∃ A B : Set α, S.IsFenceFor P_set A B ∧ + ∃ (p : ℕ) (_ : 2 ≤ p) (P : Fin p → Graph α β) (a b : Fin p → α), + Function.Injective P ∧ range P = P_set ∧ + (∀ i, a i ∈ A ∧ b i ∈ B ∧ S.IsOmegaPathWithEnds (P i) (a i) (b i)) ∧ + S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ (List.ofFn b).reverse) + +/-- "(ii) $p \ge 3$ and $(a_p, a_{p-1}, \dots, a_2, a_1, b_2, b_3, \dots, b_p, b_1)$ is +clockwise, we say $\mathcal{P}$ is a *leap" (Graph Minors IX, Section 7, page 59). -/ +def IsLeapTransaction (P_set : Set (Graph α β)) : Prop := + ∃ A B : Set α, S.IsFenceFor P_set A B ∧ + ∃ (p : ℕ) (hp : 3 ≤ p) (P : Fin p → Graph α β) (a b : Fin p → α), + Function.Injective P ∧ range P = P_set ∧ + (∀ i, a i ∈ A ∧ b i ∈ B ∧ S.IsOmegaPathWithEnds (P i) (a i) (b i)) ∧ + S.Ω.IsClockwiseSeq + ((List.ofFn a).reverse ++ + List.ofFn (fun i : Fin (p - 1) => b ⟨i.1 + 1, by omega⟩) ++ + [b ⟨0, by omega⟩]) + +/-- "(iii) $p \ge 4$ and $(a_p, a_{p-1}, \dots, a_2, a_1, b_2, b_1, b_3, b_4, \dots, b_{p-3}, +b_{p-2}, b_p, b_{p-1})$ is clockwise, we say $\mathcal{P}$ is a *doublecross" (Graph Minors IX, +Section 7, page 59). -/ +def IsDoublecrossTransaction (P_set : Set (Graph α β)) : Prop := + ∃ A B : Set α, S.IsFenceFor P_set A B ∧ + ∃ (p : ℕ) (hp : 4 ≤ p) (P : Fin p → Graph α β) (a b : Fin p → α), + Function.Injective P ∧ range P = P_set ∧ + (∀ i, a i ∈ A ∧ b i ∈ B ∧ S.IsOmegaPathWithEnds (P i) (a i) (b i)) ∧ + S.Ω.IsClockwiseSeq + ((List.ofFn a).reverse ++ + [b ⟨1, by omega⟩, b ⟨0, by omega⟩] ++ + List.ofFn (fun i : Fin (p - 4) => b ⟨i.1 + 2, by omega⟩) ++ + [b ⟨p - 1, by omega⟩, b ⟨p - 2, by omega⟩]) + +/-! ## Section 8: Societies with No Large Transaction (pages 60–62) -/ + +/-- "Let $(G, \Omega)$ be a society. A *linear decomposition* of $(G, \Omega)$ is an enumeration +$\{t_1, \dots, t_n\}$ of $\bar{\Omega}$ where $(t_1, \dots, t_n)$ is clockwise, together with a +family $(X_i: 1 \le i \le n)$ of subgraphs of $G$, with the following properties: +(i) $\bigcup(X_i: 1 \le i \le n) = G$ +(ii) for $1 \le i < i' \le n$, $E(X_i \cap X_{i'}) = \emptyset$ +(iii) for $1 \le i \le n$, $t_i \in V(X_i)$ +(iv) for $1 \le i \le i' \le i'' \le n$, $X_i \cap X_{i''} \subseteq X_{i'}$. +The *depth* of such a linear decomposition is +$$\max(|V(X_i \cap X_{i'})|: 1 \le i < i' \le n).$$" +(Graph Minors IX, Section 8, page 60). -/ +structure IsLinearDecomposition {n : ℕ} (t : Fin n → α) (X : Fin n → Graph α β) : Prop where + /-- `t` is injective. -/ + injective_t : Function.Injective t + /-- `{t₁, …, t_n} = ΩBar`. -/ + range_t : range t = S.Ω.bar + /-- `(t₁, …, t_n)` is `Ω`-clockwise. -/ + clockwise_t : S.Ω.IsClockwiseSeq (List.ofFn t) + /-- Each `X_i` is a subgraph of `G`. -/ + le_G : ∀ i : Fin n, X i ≤ S.G + /-- (i) `⋃ (X_i : 1 ≤ i ≤ n) = G`. -/ + union_eq : subgraphSUnion S.G (range X) = S.G + /-- (ii) For `1 ≤ i < i' ≤ n`, `E(X_i ∩ X_{i'}) = ∅`. -/ + edge_disjoint : ∀ i i' : Fin n, i < i' → Disjoint E(X i) E(X i') + /-- (iii) For `1 ≤ i ≤ n`, `t_i ∈ V(X_i)`. -/ + mem_vertexSet : ∀ i : Fin n, t i ∈ V(X i) + /-- (iv) For `1 ≤ i ≤ i' ≤ i'' ≤ n`, `X_i ∩ X_{i''} ⊆ X_{i'}`. -/ + inter_le : ∀ i i' i'' : Fin n, i ≤ i' → i' ≤ i'' → subgraphInter S.G (X i) (X i'') ≤ X i' + +/-- `(G, Ω)` has a linear decomposition of depth `≤ k` (Graph Minors IX, Section 8, page 60). -/ +def HasLinearDecompositionOfDepthLE (k : ℕ) : Prop := + ∃ (n : ℕ) (t : Fin n → α) (X : Fin n → Graph α β), + S.IsLinearDecomposition t X ∧ + ∀ i i' : Fin n, i < i' → (V(X i) ∩ V(X i')).ncard ≤ k + +end Society + +/-! ## Section 10: Exploiting a Rural Neighborhood (pages 63–67) -/ + +/-- A *presentation* `(Γ, Δ, Δ₀)` of a rural neighborhood `(G, Ω, Ω₀)` in the plane +(Graph Minors IX, Section 10, page 63). -/ +structure Presentation {α : Type u} {β : Type v} (N : Neighborhood α β) where + /-- The drawing `Γ` of `G` in `EuclideanPlane`. -/ + Γ : GraphDrawing N.G EuclideanPlane + /-- The outer closed disc `Δ ⊆ EuclideanPlane`. -/ + Δ : Set EuclideanPlane + /-- The inner closed disc `Δ₀ ⊆ Δ` (or `∅` when `ΩBar₀ = ∅`). -/ + Δ₀ : Set EuclideanPlane + /-- `Δ` is a closed disc. -/ + isClosedDisc_Δ : IsClosedDisc Δ + /-- `Δ₀ ⊆ Δ`. -/ + Δ₀_subset_Δ : Δ₀ ⊆ Δ + /-- `U(Γ) ⊆ Δ \ interior Δ₀`. -/ + U_subset : Γ.drawing.U ⊆ Δ \ interior Δ₀ + /-- `v ∈ ΩBar` if and only if `ν(v) ∈ bd(Δ)`. -/ + mem_bd_Δ_iff : ∀ v ∈ V(N.G), (graphDrawingVertexSet Γ v ⊆ subBd Δ ↔ v ∈ N.Ω.bar) + /-- `v ∈ ΩBar₀` if and only if `ν(v) ∈ bd(Δ₀)`. -/ + mem_bd_Δ₀_iff : ∀ v ∈ V(N.G), (graphDrawingVertexSet Γ v ⊆ subBd Δ₀ ↔ v ∈ N.Ω₀.bar) + /-- Clockwise orientation agreement on `bd(Δ)`. -/ + agrees_Δ : ∃ φ : Circle ≃ₜ subBd Δ, + IsClockwiseDiscHomeo Δ φ ∧ DrawingAgreesWithOArcHomeo Γ N.Ω (subBd Δ) φ + /-- `Δ₀` is either empty (when `ΩBar₀ = ∅`) or a closed disc with clockwise orientation agreement. + -/ + agrees_Δ₀ : (Δ₀ = ∅ ∧ N.Ω₀.bar = ∅) ∨ + (IsClosedDisc Δ₀ ∧ ∃ φ₀ : Circle ≃ₜ subBd Δ₀, + IsClockwiseDiscHomeo Δ₀ φ₀ ∧ DrawingAgreesWithOArcHomeo Γ N.Ω₀ (subBd Δ₀) φ₀) + +namespace Neighborhood + +variable {α : Type u} {β : Type v} (N : Neighborhood α β) + +/-- "For a fixed presentation and integer $s \ge 0$, an *$s$-nest* is a sequence $(C_1, \dots, +C_s)$ of circuits of $G$, mutually disjoint, such that $\Delta_0 \subseteq \Delta_1 +\subseteq \dots \subseteq \Delta_s \subseteq \Delta$, where $\Delta_i$ denotes the closed +disc in $\Sigma$ bounded by the image under $\Gamma$ of $C_i$ ($1 \le i \le s$)" +(Graph Minors IX, Section 10, page 63). -/ +def IsNest (P : Presentation N) {s : ℕ} (C : Fin s → Graph α β) : Prop := + (∀ i, IsGraphCircuit N.G (C i)) ∧ + Pairwise (fun i j => Disjoint V(C i) V(C j)) ∧ + ∃ D : Fin s → Set EuclideanPlane, + (∀ i, IsClosedDisc (D i) ∧ subBd (D i) = graphDrawingSubgraphU P.Γ (C i)) ∧ + (∀ i : Fin s, P.Δ₀ ⊆ D i ∧ D i ⊆ P.Δ) ∧ + (∀ i j : Fin s, i ≤ j → D i ⊆ D j) + +/-- "If there is an $s$-nest in some presentation of $(G, \Omega, \Omega_0)$, we say that $(G, +\Omega, \Omega_0)$ has *breadth* $\ge s$" (Graph Minors IX, Section 10, page 63). -/ +def HasBreadthGe (s : ℕ) : Prop := + ∃ (P : Presentation N) (C : Fin s → Graph α β), N.IsNest P C + +/-- "Again, let $(G, \Omega, \Omega_0)$ be a neighborhood. We say that $X \subseteq \bar{\Omega}$ +is *weakly-linked* if there are $|X|$ mutually disjoint $X \to \bar{\Omega}_0$ paths of $G$" (Graph +Minors IX, Section 10, page 63). -/ +def IsWeaklyLinked (X : Set α) : Prop := + X ⊆ N.Ω.bar ∧ ∃ P : Fin X.ncard → Graph α β, + (∀ i, IsFromToPath N.G (P i) X N.Ω₀.bar) ∧ + Pairwise (fun i j => Disjoint V(P i) V(P j)) + +/-- "and *linked* if these paths can be chosen such that each has only its initial vertex in +$\bar{\Omega}$" +(Graph Minors IX, Section 10, page 63). -/ +def IsLinked (X : Set α) : Prop := + X ⊆ N.Ω.bar ∧ ∃ P : Fin X.ncard → Graph α β, + (∀ i, ∃ x ∈ X, ∃ y ∈ N.Ω₀.bar, IsFromToPathWithEnds N.G (P i) N.Ω.bar N.Ω₀.bar x y) ∧ + Pairwise (fun i j => Disjoint V(P i) V(P j)) + +end Neighborhood + +/-! ## Section 11: Coping with Connectivity Failure (pages 67–77) -/ + +/-- A graph `G` is simple if it has no loops and no parallel edges +(Graph Minors IX, Section 11, page 67). -/ +def IsSimpleGraph {α : Type u} {β : Type v} (G : Graph α β) : Prop := + (∀ e ∈ E(G), ∀ v : α, ¬ G.IsLink e v v) ∧ + (∀ e₁ ∈ E(G), ∀ e₂ ∈ E(G), ∀ u v : α, G.IsLink e₁ u v → G.IsLink e₂ u v → e₁ = e₂) + +/-- `D = Δ(P)` for a presentation `P_pres = (Σ, Γ, Δ, Δ₀)` of a rural neighborhood `(G, Ω, Ω₀)` and +a path `P` of `G` with distinct ends in `ΩBar₀` and no internal vertex in `ΩBar₀`: `D ⊆ Δ` is a +closed +disc bounded by the image of `P` under `Γ` and a portion of `bd(Δ₀)` such that `Δ₀ ⊈ D` +(Graph Minors IX, Section 11, page 67). -/ +def IsPathDisc {α : Type u} {β : Type v} {N : Neighborhood α β} + (P_pres : Presentation N) (P : Graph α β) (D : Set EuclideanPlane) : Prop := + (∃ a b : α, IsGraphPathWithEnds N.G P a b ∧ a ≠ b ∧ a ∈ N.Ω₀.bar ∧ b ∈ N.Ω₀.bar ∧ + Disjoint (V(P) \ {a, b}) N.Ω₀.bar) ∧ + IsClosedDisc D ∧ D ⊆ P_pres.Δ ∧ ¬ (P_pres.Δ₀ ⊆ D) ∧ + graphDrawingSubgraphU P_pres.Γ P ⊆ subBd D ∧ + subBd D ⊆ graphDrawingSubgraphU P_pres.Γ P ∪ subBd P_pres.Δ₀ + +/-- "A *prominence* is a path $P$ of $G$ with the following properties: (i) the ends of $P$ are +distinct and are both in $\bar{\Omega}_0$ (ii) no internal vertex of $P$ is in +$\bar{\Omega}_0$ (iii) $P$ has at most two edges (iv) subject to (i), (ii), and (iii), +$\Delta(P)$ is maximal." +(Graph Minors IX, Section 11, page 67). -/ +def IsProminenceWithDisc {α : Type u} {β : Type v} {N : Neighborhood α β} + (P_pres : Presentation N) (P : Graph α β) (L : Set EuclideanPlane) : Prop := + IsPathDisc P_pres P L ∧ E(P).ncard ≤ 2 ∧ + ∀ (P' : Graph α β) (L' : Set EuclideanPlane), + IsPathDisc P_pres P' L' → E(P').ncard ≤ 2 → L ⊆ L' → L' = L + +/-- `P` is a prominence of `P_pres` (Graph Minors IX, Section 11, page 67). -/ +def IsProminence {α : Type u} {β : Type v} {N : Neighborhood α β} + (P_pres : Presentation N) (P : Graph α β) : Prop := + ∃ L : Set EuclideanPlane, IsProminenceWithDisc P_pres P L + +/-- "If $P$ is a prominence, $\Delta(P)$ is a *lawn" (Graph Minors IX, Section 11, page 67). -/ +def IsLawn {α : Type u} {β : Type v} {N : Neighborhood α β} + (P_pres : Presentation N) (L : Set EuclideanPlane) : Prop := + ∃ P : Graph α β, IsProminenceWithDisc P_pres P L + +/-- The union of `Δ₀` with all lawns of `P_pres` (Graph Minors IX, Section 11, page 67). -/ +def wallDisc {α : Type u} {β : Type v} {N : Neighborhood α β} + (P_pres : Presentation N) : Set EuclideanPlane := + P_pres.Δ₀ ∪ ⋃ L ∈ {L : Set EuclideanPlane | IsLawn P_pres L}, L + +/-- "It follows that the union of $\Delta_0$ with all lawns is a closed disc; we call its +boundary the *wall" (Graph Minors IX, Section 11, page 67). -/ +def wall {α : Type u} {β : Type v} {N : Neighborhood α β} + (P_pres : Presentation N) : Set EuclideanPlane := + subBd (wallDisc P_pres) + +/-- "Let $e \in E(G)$; we call it an *internal*, *external*, or *wall edge* if the arc which +represents $e$ in the drawing $\Gamma$ is a subset of the interior of the disc bounded by +the wall, the complement in $\Delta$ of this disc, or the wall itself, respectively" +(Graph Minors IX, Section 11, page 67). -/ +def IsInternalEdge {α : Type u} {β : Type v} {N : Neighborhood α β} + (P_pres : Presentation N) (e : β) : Prop := + e ∈ E(N.G) ∧ graphDrawingEdgeSet P_pres.Γ e ⊆ interior (wallDisc P_pres) + +/-- `e ∈ E(G)` is an external edge with respect to `P_pres` +(Graph Minors IX, Section 11, page 67). -/ +def IsExternalEdge {α : Type u} {β : Type v} {N : Neighborhood α β} + (P_pres : Presentation N) (e : β) : Prop := + e ∈ E(N.G) ∧ graphDrawingEdgeSet P_pres.Γ e ⊆ P_pres.Δ \ wallDisc P_pres + +/-- `e ∈ E(G)` is a wall edge with respect to `P_pres` +(Graph Minors IX, Section 11, page 67). -/ +def IsWallEdge {α : Type u} {β : Type v} {N : Neighborhood α β} + (P_pres : Presentation N) (e : β) : Prop := + e ∈ E(N.G) ∧ graphDrawingEdgeSet P_pres.Γ e ⊆ wall P_pres + +/-- "A triangle in $G$ is a circuit of length 3" (Graph Minors IX, Section 11, page 68). -/ +def IsTriangle {α : Type u} {β : Type v} (G T : Graph α β) : Prop := + IsGraphCircuit G T ∧ E(T).ncard = 3 + +/-- "The clockwise orientation of the wall provides a cyclic permutation $\Omega^*$ of the +vertices of $G$ drawn in it. Let $G^*$ be the subgraph of $G$ consisting of all vertices and +edges drawn in the closed disc bounded by the wall. Then $(G^*, \Omega^*, \Omega_0)$ is a +rural neighborhood, called the *park* of $(G, \Omega, \Omega_0)$ (under the presentation +$(\Sigma, \Gamma, \Delta, \Delta_0)$). Any rural neighborhood which can be constructed this +way is called a *park" (Graph Minors IX, Section 11, page 68). -/ +def IsParkOf {α : Type u} {β : Type v} {N : Neighborhood α β} + (P_pres : Presentation N) (N_star : Neighborhood α β) : Prop := + IsSimpleGraph N.G ∧ + N_star.Ω₀ = N.Ω₀ ∧ + V(N_star.G) = {v ∈ V(N.G) | graphDrawingVertexSet P_pres.Γ v ⊆ wallDisc P_pres} ∧ + E(N_star.G) = {e ∈ E(N.G) | graphDrawingEdgeSet P_pres.Γ e ⊆ wallDisc P_pres} ∧ + N_star.G ≤ N.G ∧ + N_star.Ω.bar = {v ∈ V(N.G) | graphDrawingVertexSet P_pres.Γ v ⊆ wall P_pres} ∧ + IsClosedDisc (wallDisc P_pres) ∧ + ∃ φ : Circle ≃ₜ wall P_pres, + IsClockwiseDiscHomeo (wallDisc P_pres) φ ∧ + DrawingAgreesWithOArcHomeo P_pres.Γ N_star.Ω (wall P_pres) φ + +/-- `N_star` is a park (Graph Minors IX, Section 11, page 68). -/ +def Neighborhood.IsPark {α : Type u} {β : Type v} (N_star : Neighborhood α β) : Prop := + ∃ (N : Neighborhood α β) (P_pres : Presentation N), IsParkOf P_pres N_star + +/-- "Let $(G, \Omega)$ be a society. A set $\mathcal{D}$ of separations of $(G, \Omega)$ is a +*consolidation* of $(G, \Omega)$ if (i) $|V(A \cap B)| \le 3$ for all $(A, B) \in +\mathcal{D}$ (ii) $A \subseteq B'$ for all distinct $(A, B), (A', B') \in \mathcal{D}$ (iii) +$\bigcup (A: (A, B) \in \mathcal{D}) = G$ (iv) for each $(A, B) \in \mathcal{D}$ and every +choice of distinct $u, v \in V(A \cap B)$ there is a path of $A$ with ends $u, v$ and with +no internal vertex in $B$." +(Graph Minors IX, Section 11, page 70). -/ +structure IsConsolidation {α : Type u} {β : Type v} (S : Society α β) + (D_set : Set (Graph α β × Graph α β)) : Prop where + /-- Every `(A, B) ∈ D_set` is a separation of `(G, Ω)`. -/ + isSocietySeparation : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D_set → S.IsSocietySeparation A B + /-- (i) `|V(A ∩ B)| ≤ 3` for all `(A, B) ∈ D_set`. -/ + order_le_three : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D_set → (V(A) ∩ V(B)).ncard ≤ 3 + /-- (ii) `A ⊆ B'` for all distinct `(A, B), (A', B') ∈ D_set`. -/ + left_le_right : ∀ ⦃A B A' B' : Graph α β⦄, (A, B) ∈ D_set → (A', B') ∈ D_set → + (A, B) ≠ (A', B') → A ≤ B' + /-- (iii) `⋃ (A : (A, B) ∈ D_set) = G`. -/ + union_eq : subgraphSUnion S.G (Prod.fst '' D_set) = S.G + /-- (iv) For each `(A, B) ∈ D_set` and distinct `u, v ∈ V(A ∩ B)`, there is a path of `A` with + ends `u, v` and with no internal vertex in `B`. -/ + exists_path : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D_set → + ∀ u ∈ V(A) ∩ V(B), ∀ v ∈ V(A) ∩ V(B), u ≠ v → + ∃ P : Graph α β, IsGraphPathWithEnds A P u v ∧ Disjoint (V(P) \ {u, v}) V(B) + +/-- "Let $\mathcal{D}$ be a consolidation of $(G, \Omega)$. Its *core* is the simple graph $C$ +with $V(C) = \bigcap (V(B): (A, B) \in \mathcal{D})$ in which distinct vertices $u, v$ are +adjacent if there exists $(A, B) \in \mathcal{D}$ with $u, v \in V(A \cap B)$" (Graph Minors IX, +Section 11, page 70). -/ +def consolidationCore {α : Type u} {β : Type v} (S : Society α β) + (D_set : Set (Graph α β × Graph α β)) : Graph α (Sym2 α) where + vertexSet := V(S.G) ∩ ⋂ p ∈ D_set, V(p.2) + edgeSet := {e : Sym2 α | ∃ u v : α, u ≠ v ∧ e = s(u, v) ∧ + u ∈ V(S.G) ∩ ⋂ p ∈ D_set, V(p.2) ∧ v ∈ V(S.G) ∩ ⋂ p ∈ D_set, V(p.2) ∧ + ∃ p ∈ D_set, u ∈ V(p.1) ∩ V(p.2) ∧ v ∈ V(p.1) ∩ V(p.2)} + IsLink e x y := x ≠ y ∧ e = s(x, y) ∧ + x ∈ V(S.G) ∩ ⋂ p ∈ D_set, V(p.2) ∧ y ∈ V(S.G) ∩ ⋂ p ∈ D_set, V(p.2) ∧ + ∃ p ∈ D_set, x ∈ V(p.1) ∩ V(p.2) ∧ y ∈ V(p.1) ∩ V(p.2) + isLink_symm _ _ := ⟨fun _ _ ⟨hxy, he, hx, hy, p, hp, hxp, hyp⟩ => + ⟨hxy.symm, he.trans (Sym2.eq_swap), hy, hx, p, hp, hyp, hxp⟩⟩ + eq_or_eq_of_isLink_of_isLink e x y z w h1 h2 := by + have heq : s(x, y) = s(z, w) := h1.2.1.symm.trans h2.2.1 + rcases Sym2.eq_iff.mp heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl rfl + · exact Or.inr rfl + edge_mem_iff_exists_isLink _ := ⟨fun ⟨u, v, h⟩ => ⟨u, v, h⟩, fun ⟨u, v, h⟩ => ⟨u, v, h⟩⟩ + left_mem_of_isLink _ _ _ h := h.2.2.1 + +/-- "The pattern of a transaction $\mathcal{P}$ in $(G, \Omega)$ is the set $\{X(P): P \in +\mathcal{P}\}$ where $X(P)$ denotes the set of ends of $P \in \mathcal{P}$" (Graph Minors IX, +Section 11, page 73). -/ +def Society.transactionPattern {α : Type u} {β : Type v} (S : Society α β) + (P_set : Set (Graph α β)) : Set (Set α) := + (fun P => pathEnds S.G P) '' P_set + +/-- "A segregation of a society $(G, \Omega)$ is a set $\{(A_0, \Omega_0), \dots, (A_k, +\Omega_k)\}$ of societies such that (i) $A_0 \cup \dots \cup A_k = G$ and $E(A_i \cap A_j) = +\emptyset$ for $0 \le i, j \le k$ with $i \neq j$ (ii) $V(A_i \cap A_j) \subseteq +\bar{\Omega}_i$ for $0 \le i, j \le k$ with $i \neq j$ (iii) $\bar{\Omega} \subseteq +\bar{\Omega}_0 \cup \dots \cup \bar{\Omega}_k$." +(Graph Minors IX, Section 11, page 74). -/ +structure IsSocietySegregation {α : Type u} {β : Type v} (S : Society α β) + {k : ℕ} (A₀ : Society α β) (A : Fin k → Society α β) : Prop where + /-- `A₀ ≤ G`. -/ + le_zero : A₀.G ≤ S.G + /-- `A_i ≤ G` for `1 ≤ i ≤ k`. -/ + le_succ : ∀ i : Fin k, (A i).G ≤ S.G + /-- (i) `V(A₀) ∪ ⋃_i V(A_i) = V(G)`. -/ + vertexSet_union : V(A₀.G) ∪ (⋃ i : Fin k, V((A i).G)) = V(S.G) + /-- (i) `E(A₀) ∪ ⋃_i E(A_i) = E(G)`. -/ + edgeSet_union : E(A₀.G) ∪ (⋃ i : Fin k, E((A i).G)) = E(S.G) + /-- (i) `E(A₀ ∩ A_i) = ∅` for `1 ≤ i ≤ k`. -/ + disjoint_zero : ∀ i : Fin k, Disjoint E(A₀.G) E((A i).G) + /-- (i) `E(A_i ∩ A_j) = ∅` for `1 ≤ i < j ≤ k`. -/ + disjoint_succ : Pairwise (fun i j : Fin k => Disjoint E((A i).G) E((A j).G)) + /-- (ii) `V(A₀ ∩ A_i) ⊆ ΩBar₀ ∩ ΩBar_i` for `1 ≤ i ≤ k`. -/ + inter_zero_subset : ∀ i : Fin k, V(A₀.G) ∩ V((A i).G) ⊆ A₀.Ω.bar ∩ (A i).Ω.bar + /-- (ii) `V(A_i ∩ A_j) ⊆ ΩBar_i ∩ ΩBar_j` for `1 ≤ i < j ≤ k`. -/ + inter_succ_subset : ∀ i j : Fin k, i ≠ j → V((A i).G) ∩ V((A j).G) ⊆ (A i).Ω.bar ∩ (A j).Ω.bar + /-- (iii) `ΩBar ⊆ ΩBar₀ ∪ ⋯ ∪ ΩBar_k`. -/ + bar_subset_union : S.Ω.bar ⊆ A₀.Ω.bar ∪ ⋃ i : Fin k, (A i).Ω.bar + +/-- "An arrangement of a segregation $\{(A_0, \Omega_0), \dots, (A_k, \Omega_k)\}$ of $(G, +\Omega)$ in a closed disc $\Delta$ is a function $\alpha$ with domain $$ \{(A_0, \Omega_0), +\dots, (A_k, \Omega_k)\} \cup \bar{\Omega}_0 \cup \dots \cup \bar{\Omega}_k $$ and with the +following properties: (i) for $0 \le i \le k$, $\alpha((A_i, \Omega_i))$ is a closed disc +$\Delta_i \subseteq \Delta$ and $\alpha(v) \in bd(\Delta_i)$ for each $v \in +\bar{\Omega}_i$, and $\alpha(v) \in bd(\Delta)$ for each $v \in \bar{\Omega}$ (ii) for $0 +\le i < j \le k$, if $x \in \Delta_i \cap \Delta_j$, then $x = \alpha(v)$ for some $v \in +\bar{\Omega}_i \cap \bar{\Omega}_j$, and for $0 \le i \le k$, if $x \in \Delta_i \cap +bd(\Delta)$ then $x = \alpha(v)$ for some $v \in \bar{\Omega}_i \cap \bar{\Omega}$ (iii) +$\alpha(u) \neq \alpha(v)$ for distinct $u, v \in \bar{\Omega}_0 \cup \dots \cup +\bar{\Omega}_k$ (iv) for $0 \le i \le k$, $\Omega_i$ is the cyclic permutation of +$\bar{\Omega}_i$ derived (under $\alpha^{-1}$) from the clockwise orientation of +$bd(\Delta_i)$, and $\Omega$ is the permutation derived from the clockwise orientation of +$bd(\Delta)$." +(Graph Minors IX, Section 11, page 74). -/ +structure IsDiscArrangement {α : Type u} {β : Type v} (S : Society α β) + {k : ℕ} (A₀ : Society α β) (A : Fin k → Society α β) + (Δ : Set EuclideanPlane) (α₀ : Set EuclideanPlane) (α_disc : Fin k → Set EuclideanPlane) + (α_pt : α → EuclideanPlane) : Prop where + /-- `Δ` is a closed disc in `EuclideanPlane`. -/ + isClosedDisc_Δ : IsClosedDisc Δ + /-- (i) `α((A₀, Ω₀))` is a closed disc `Δ₀ ⊆ Δ`. -/ + isClosedDisc_zero : IsClosedDisc α₀ ∧ α₀ ⊆ Δ + /-- (i) `α((A_i, Ω_i))` is a closed disc `Δ_i ⊆ Δ` for `1 ≤ i ≤ k`. -/ + isClosedDisc_succ : ∀ i : Fin k, IsClosedDisc (α_disc i) ∧ α_disc i ⊆ Δ + /-- (i) and (iv) for `(A₀, Ω₀)`: `α(v) ∈ bd(Δ₀)` for `v ∈ ΩBar₀`, and clockwise agreement. -/ + bd_zero : ∃ φ₀ : Circle ≃ₜ subBd α₀, + IsClockwiseDiscHomeo α₀ φ₀ ∧ AgreesWithOArcHomeo α_pt A₀.Ω (subBd α₀) φ₀ + /-- (i) and (iv) for `(A_i, Ω_i)`: `α(v) ∈ bd(Δ_i)` for `v ∈ ΩBar_i`, and clockwise agreement. -/ + bd_succ : ∀ i : Fin k, ∃ φ_i : Circle ≃ₜ subBd (α_disc i), + IsClockwiseDiscHomeo (α_disc i) φ_i ∧ + AgreesWithOArcHomeo α_pt (A i).Ω (subBd (α_disc i)) φ_i + /-- (i) and (iv) for `(G, Ω)`: `α(v) ∈ bd(Δ)` for `v ∈ ΩBar`, and clockwise agreement. -/ + bd_outer : ∃ φ : Circle ≃ₜ subBd Δ, + IsClockwiseDiscHomeo Δ φ ∧ AgreesWithOArcHomeo α_pt S.Ω (subBd Δ) φ + /-- (ii) Between `Δ₀` and `Δ_i`: `Δ₀ ∩ Δ_i ⊆ α '' (ΩBar₀ ∩ ΩBar_i)`. -/ + inter_zero : ∀ i : Fin k, α₀ ∩ α_disc i ⊆ α_pt '' (A₀.Ω.bar ∩ (A i).Ω.bar) + /-- (ii) Between `Δ_i` and `Δ_j` for `i ≠ j`: `Δ_i ∩ Δ_j ⊆ α '' (ΩBar_i ∩ ΩBar_j)`. -/ + inter_succ : ∀ i j : Fin k, i ≠ j → α_disc i ∩ α_disc j ⊆ α_pt '' ((A i).Ω.bar ∩ (A j).Ω.bar) + /-- (ii) Between `Δ₀` and `bd(Δ)`: `Δ₀ ∩ bd(Δ) ⊆ α '' (ΩBar₀ ∩ ΩBar)`. -/ + inter_bd_zero : α₀ ∩ subBd Δ ⊆ α_pt '' (A₀.Ω.bar ∩ S.Ω.bar) + /-- (ii) Between `Δ_i` and `bd(Δ)`: `Δ_i ∩ bd(Δ) ⊆ α '' (ΩBar_i ∩ ΩBar)`. -/ + inter_bd_succ : ∀ i : Fin k, α_disc i ∩ subBd Δ ⊆ α_pt '' ((A i).Ω.bar ∩ S.Ω.bar) + /-- (iii) `α(u) ≠ α(v)` for distinct `u, v ∈ ΩBar₀ ∪ ⋯ ∪ ΩBar_k`. -/ + injOn_pts : InjOn α_pt (A₀.Ω.bar ∪ ⋃ i : Fin k, (A i).Ω.bar) + +/-- "A segregation is *feasible* if there is an arrangement of it in some disc" +(Graph Minors IX, Section 11, page 74). -/ +def IsFeasibleSegregation {α : Type u} {β : Type v} (S : Society α β) + {k : ℕ} (A₀ : Society α β) (A : Fin k → Society α β) : Prop := + IsSocietySegregation S A₀ A ∧ + ∃ (Δ α₀ : Set EuclideanPlane) (α_disc : Fin k → Set EuclideanPlane) (α_pt : α → EuclideanPlane), + IsDiscArrangement S A₀ A Δ α₀ α_disc α_pt + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/DiscDrawing.lean b/LeanPool/GraphMinor/GM09/DiscDrawing.lean new file mode 100644 index 0000000000..601fbd3b57 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/DiscDrawing.lean @@ -0,0 +1,3217 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Basic +public import LeanPool.GraphMinor.Surface.Jordan +public import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.GM11.DrawingOps +import LeanPool.GraphMinor.GM11.ArcDrawings +import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! ## Module 2: `GraphDrawing` Transport, Gluing, and Atomic Constructors -/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Metric Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 + GraphMinor.GM11 + +universe u v w + +variable {α : Type u} {β : Type v} + +/-- Transport a drawing `D : Drawing S` whose point set `D.U` is compact along a continuous map +`f : S → S'` injective on `D.U`. -/ +theorem exists_transport_of_isCompact {S S' : Type*} [TopologicalSpace S] [Nonempty S] + [TopologicalSpace S'] [T2Space S'] + (D : Drawing S) (hUc : IsCompact D.U) {f : S → S'} (hf : Continuous f) (hinj : InjOn f D.U) : + ∃ D' : Drawing S', D'.U = f '' D.U ∧ D'.V = f '' D.V ∧ D'.E = image f '' D.E ∧ + ∀ e ∈ D.E, closure (f '' e) = f '' closure e := + GM11.exists_transportOn_of_isCompact D hUc hf.continuousOn hinj + +/-- If `Γ : GraphDrawing G S` has `(Γ.iso.vertexEquiv v).1 = ν v.1` for all `v : V(G)`, then +`Γ.drawing.V = ν '' V(G)`. -/ +theorem drawing_V_eq_image {S : Type*} [TopologicalSpace S] {G : Graph α β} + (Γ : GraphDrawing G S) {ν : α → S} + (hν : ∀ v : V(G), (Γ.iso.vertexEquiv v).1 = ν v.1) : + Γ.drawing.V = ν '' V(G) := by + ext y + constructor + · intro hy + let v := Γ.iso.vertexEquiv.symm ⟨y, hy⟩ + refine ⟨v.1, v.2, ?_⟩ + rw [← hν v, Γ.iso.vertexEquiv.apply_symm_apply] + · rintro ⟨x, hx, rfl⟩ + rw [← hν ⟨x, hx⟩] + exact (Γ.iso.vertexEquiv ⟨x, hx⟩).2 + +private theorem graphDrawingVertexSet_eq_singleton' {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) {v : α} (hv : v ∈ V(G)) : + graphDrawingVertexSet Γ v = {(Γ.iso.vertexEquiv ⟨v, hv⟩).1} := by + ext x + simp [graphDrawingVertexSet, hv, eq_comm] + +private theorem graphDrawingVertexSet_of_notMem {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) {v : α} (hv : v ∉ V(G)) : + graphDrawingVertexSet Γ v = ∅ := by + ext x + simp [graphDrawingVertexSet, hv] + +private theorem graphDrawingEdgeSet_eq' {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) {e : β} (he : e ∈ E(G)) : + graphDrawingEdgeSet Γ e = (Γ.iso.edgeEquiv ⟨e, he⟩).1 := by + ext x + simp [graphDrawingEdgeSet, he] + +private theorem graphDrawingEdgeSet_of_notMem {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) {e : β} (he : e ∉ E(G)) : + graphDrawingEdgeSet Γ e = ∅ := by + ext x + simp [graphDrawingEdgeSet, he] + +private theorem transportGraphDrawingImages {S S' : Type*} [TopologicalSpace S] [Nonempty S] + [TopologicalSpace S'] [T2Space S'] {G : Graph α β} + (Γ : GraphDrawing G S) (hUc : IsCompact Γ.drawing.U) + {f : S → S'} (hf : ContinuousOn f Γ.drawing.U) (hinj : InjOn f Γ.drawing.U) : + ∃ Γ' : GraphDrawing G S', + Γ'.drawing.U = f '' Γ.drawing.U ∧ + Γ'.drawing.V = f '' Γ.drawing.V ∧ + (∀ v : V(G), (Γ'.iso.vertexEquiv v).1 = f (Γ.iso.vertexEquiv v).1) ∧ + (∀ v, graphDrawingVertexSet Γ' v = f '' graphDrawingVertexSet Γ v) ∧ + (∀ e, graphDrawingEdgeSet Γ' e = f '' graphDrawingEdgeSet Γ e) ∧ + (∀ H, graphDrawingSubgraphU Γ' H = f '' graphDrawingSubgraphU Γ H) := by + obtain ⟨D', hU', hV', hE', hcl⟩ := GM11.exists_transportOn_of_isCompact Γ.drawing hUc hf hinj + have hinjV : InjOn f Γ.drawing.V := hinj.mono Γ.drawing.V_subset_U + have hinjE : InjOn (image f) Γ.drawing.E := by + intro e₁ he₁ e₂ he₂ heq + ext x + constructor + · intro hx₁ + have hfx : f x ∈ f '' e₂ := heq ▸ ⟨x, hx₁, rfl⟩ + obtain ⟨y, hy₂, hfy⟩ := hfx + have hxy : y = x := + hinj (Γ.drawing.closure_subset_U he₂ (subset_closure hy₂)) + (Γ.drawing.closure_subset_U he₁ (subset_closure hx₁)) hfy + exact hxy ▸ hy₂ + · intro hx₂ + have hfx : f x ∈ f '' e₁ := heq.symm ▸ ⟨x, hx₂, rfl⟩ + obtain ⟨y, hy₁, hfy⟩ := hfx + have hxy : y = x := + hinj (Γ.drawing.closure_subset_U he₁ (subset_closure hy₁)) + (Γ.drawing.closure_subset_U he₂ (subset_closure hx₂)) hfy + exact hxy ▸ hy₁ + let vFun : Γ.drawing.V → D'.V := fun x => ⟨f x.1, hV' ▸ ⟨x.1, x.2, rfl⟩⟩ + have hvFun_bij : Function.Bijective vFun := + ⟨fun x y h => Subtype.ext (hinjV x.2 y.2 (congrArg Subtype.val h)), + fun z => by + have hz : z.1 ∈ f '' Γ.drawing.V := hV' ▸ z.2 + obtain ⟨x, hx, hfx⟩ := hz + exact ⟨⟨x, hx⟩, Subtype.ext hfx⟩⟩ + let eFun : Γ.drawing.E → D'.E := fun e => ⟨f '' e.1, hE' ▸ ⟨e.1, e.2, rfl⟩⟩ + have heFun_bij : Function.Bijective eFun := + ⟨fun e₁ e₂ h => Subtype.ext (hinjE e₁.2 e₂.2 (congrArg Subtype.val h)), + fun a => by + have ha : a.1 ∈ image f '' Γ.drawing.E := hE' ▸ a.2 + obtain ⟨e, he, hfe⟩ := ha + exact ⟨⟨e, he⟩, Subtype.ext hfe⟩⟩ + let vEquiv : Γ.drawing.V ≃ D'.V := Equiv.ofBijective vFun hvFun_bij + let eEquiv : Γ.drawing.E ≃ D'.E := Equiv.ofBijective eFun heFun_bij + let iso' : Iso G D'.toGraph := + { vertexEquiv := Γ.iso.vertexEquiv.trans vEquiv + edgeEquiv := Γ.iso.edgeEquiv.trans eEquiv + isLink_iff := fun {e x y} => by + rw [Γ.iso.isLink_iff] + let e₀ := Γ.iso.edgeEquiv e + let x₀ := Γ.iso.vertexEquiv x + let y₀ := Γ.iso.vertexEquiv y + change Γ.drawing.toGraph.IsLink e₀.1 x₀.1 y₀.1 ↔ + D'.toGraph.IsLink (f '' e₀.1) (f x₀.1) (f y₀.1) + have he' : f '' e₀.1 ∈ D'.E := hE' ▸ ⟨e₀.1, e₀.2, rfl⟩ + have hx' : f x₀.1 ∈ D'.V := hV' ▸ ⟨x₀.1, x₀.2, rfl⟩ + have hy' : f y₀.1 ∈ D'.V := hV' ▸ ⟨y₀.1, y₀.2, rfl⟩ + have hcap : closure (f '' e₀.1) ∩ D'.V = f '' (closure e₀.1 ∩ Γ.drawing.V) := by + rw [hcl e₀.1 e₀.2, hV'] + exact (InjOn.image_inter hinj (Γ.drawing.closure_subset_U e₀.2) Γ.drawing.V_subset_U).symm + constructor + · rintro ⟨_, _, _, hc⟩ + refine ⟨he', hx', hy', ?_⟩ + rw [hcap, hc, image_pair] + · rintro ⟨_, _, _, hc'⟩ + refine ⟨e₀.2, x₀.2, y₀.2, ?_⟩ + rw [hcap, ← image_pair] at hc' + have hsub1 : closure e₀.1 ∩ Γ.drawing.V ⊆ Γ.drawing.U := + inter_subset_right.trans Γ.drawing.V_subset_U + have hsub2 : ({x₀.1, y₀.1} : Set S) ⊆ Γ.drawing.U := by + rintro z (rfl | rfl) + · exact Γ.drawing.V_subset_U x₀.2 + · exact Γ.drawing.V_subset_U y₀.2 + exact hinj.image_eq_image_iff hsub1 hsub2 |>.mp hc' } + let Γ' : GraphDrawing G S' := ⟨D', iso'⟩ + have hvert : ∀ v, graphDrawingVertexSet Γ' v = f '' graphDrawingVertexSet Γ v := by + intro v + by_cases hv : v ∈ V(G) + · rw [graphDrawingVertexSet_eq_singleton' Γ' hv, graphDrawingVertexSet_eq_singleton' Γ hv, + image_singleton] + rfl + · rw [graphDrawingVertexSet_of_notMem Γ' hv, graphDrawingVertexSet_of_notMem Γ hv, image_empty] + have hedge : ∀ e, graphDrawingEdgeSet Γ' e = f '' graphDrawingEdgeSet Γ e := by + intro e + by_cases he : e ∈ E(G) + · rw [graphDrawingEdgeSet_eq' Γ' he, graphDrawingEdgeSet_eq' Γ he] + rfl + · rw [graphDrawingEdgeSet_of_notMem Γ' he, graphDrawingEdgeSet_of_notMem Γ he, image_empty] + have hedge_cl : ∀ e, closure (graphDrawingEdgeSet Γ' e) = f '' closure (graphDrawingEdgeSet Γ e) + := by + intro e + by_cases he : e ∈ E(G) + · rw [graphDrawingEdgeSet_eq' Γ' he, graphDrawingEdgeSet_eq' Γ he] + exact hcl (Γ.iso.edgeEquiv ⟨e, he⟩).1 (Γ.iso.edgeEquiv ⟨e, he⟩).2 + · simp [graphDrawingEdgeSet_of_notMem Γ' he, graphDrawingEdgeSet_of_notMem Γ he] + refine ⟨Γ', hU', hV', fun _ => rfl, hvert, hedge, fun H => ?_⟩ + simp only [graphDrawingSubgraphU, image_union, image_iUnion, hvert, hedge_cl] + +/-- Transport a `GraphDrawing G S` with compact `U` along a continuous map `f : S → S'` injective on +`U`. -/ +theorem GraphDrawing.transport {S S' : Type*} [TopologicalSpace S] [Nonempty S] + [TopologicalSpace S'] [T2Space S'] {G : Graph α β} + (Γ : GraphDrawing G S) (hUc : IsCompact Γ.drawing.U) {ν : α → S} + (hν : ∀ v : V(G), (Γ.iso.vertexEquiv v).1 = ν v.1) + {f : S → S'} (hf : Continuous f) (hinj : InjOn f Γ.drawing.U) : + ∃ Γ' : GraphDrawing G S', + Γ'.drawing.U = f '' Γ.drawing.U ∧ + Γ'.drawing.V = f '' Γ.drawing.V ∧ + ∀ v : V(G), (Γ'.iso.vertexEquiv v).1 = f (ν v.1) := by + obtain ⟨Γ', hU, hV, hv, -, -, -⟩ := transportGraphDrawingImages Γ hUc hf.continuousOn hinj + exact ⟨Γ', hU, hV, fun v => (hv v).trans (congrArg f (hν v))⟩ + +/-- Glue two `GraphDrawing`s on `G₁, G₂ ≤ G` whose drawings meet only inside `ν '' (V(G₁) ∩ V(G₂))`. +-/ +theorem GraphDrawing.glue_edges {S : Type*} [TopologicalSpace S] {G G₁ G₂ : Graph α β} + (hG₁ : G₁ ≤ G) (hG₂ : G₂ ≤ G) + (hV_union : V(G₁) ∪ V(G₂) = V(G)) + (hE_union : E(G₁) ∪ E(G₂) = E(G)) + (hE_disj : Disjoint E(G₁) E(G₂)) + {ν : α → S} (hν_inj : InjOn ν V(G)) + (Γ₁ : GraphDrawing G₁ S) (Γ₂ : GraphDrawing G₂ S) + (hν₁ : ∀ v : V(G₁), (Γ₁.iso.vertexEquiv v).1 = ν v.1) + (hν₂ : ∀ v : V(G₂), (Γ₂.iso.vertexEquiv v).1 = ν v.1) + (hmeet : Γ₁.drawing.U ∩ Γ₂.drawing.U ⊆ ν '' (V(G₁) ∩ V(G₂))) : + ∃ Γ : GraphDrawing G S, + Γ.drawing.U = Γ₁.drawing.U ∪ Γ₂.drawing.U ∧ + (∀ v : V(G), (Γ.iso.vertexEquiv v).1 = ν v.1) ∧ + (∀ e, graphDrawingEdgeSet Γ e = + graphDrawingEdgeSet Γ₁ e ∪ graphDrawingEdgeSet Γ₂ e) := by + classical + have hV₁_eq : Γ₁.drawing.V = ν '' V(G₁) := drawing_V_eq_image Γ₁ hν₁ + have hV₂_eq : Γ₂.drawing.V = ν '' V(G₂) := drawing_V_eq_image Γ₂ hν₂ + have hmeet_V : Γ₁.drawing.U ∩ Γ₂.drawing.U ⊆ Γ₁.drawing.V ∩ Γ₂.drawing.V := by + refine hmeet.trans ?_ + rw [hV₁_eq, hV₂_eq] + exact image_inter_subset ν V(G₁) V(G₂) + let D := Γ₁.drawing.glue Γ₂.drawing hmeet_V + have hD_V : D.V = ν '' V(G) := by + change Γ₁.drawing.V ∪ Γ₂.drawing.V = _ + rw [hV₁_eq, hV₂_eq, ← image_union, hV_union] + have hD_E : D.E = Γ₁.drawing.E ∪ Γ₂.drawing.E := Drawing.glue_E hmeet_V + have hsub₁ : Γ₁.drawing.IsSubdrawing D := + ⟨subset_union_left, hD_E.symm ▸ subset_union_left⟩ + have hsub₂ : Γ₂.drawing.IsSubdrawing D := + ⟨subset_union_right, hD_E.symm ▸ subset_union_right⟩ + have hdisj_DE : Disjoint Γ₁.drawing.E Γ₂.drawing.E := by + rw [disjoint_left] + intro a ha₁ ha₂ + obtain ⟨z, hz⟩ := ha₁.1 + have hz₁ : z ∈ Γ₁.drawing.U \ Γ₁.drawing.V := ha₁.2.1 hz + have hz₂ : z ∈ Γ₂.drawing.U \ Γ₂.drawing.V := ha₂.2.1 hz + exact hz₁.2 (hmeet_V ⟨hz₁.1, hz₂.1⟩).1 + let vFun : V(G) → D.V := fun v => ⟨ν v.1, hD_V ▸ ⟨v.1, v.2, rfl⟩⟩ + have hvFun_bij : Function.Bijective vFun := + ⟨fun v₁ v₂ h => Subtype.ext (hν_inj v₁.2 v₂.2 (congrArg Subtype.val h)), + fun z => by + have hz : z.1 ∈ ν '' V(G) := hD_V ▸ z.2 + obtain ⟨x, hx, hnx⟩ := hz + exact ⟨⟨x, hx⟩, Subtype.ext hnx⟩⟩ + let vEquiv : V(G) ≃ D.V := Equiv.ofBijective vFun hvFun_bij + have hvEquiv_val : ∀ v : V(G), (vEquiv v).1 = ν v.1 := fun _ => rfl + have he₂_of_not_1 : ∀ e : E(G), e.1 ∉ E(G₁) → e.1 ∈ E(G₂) := fun e he₁ => by + have : e.1 ∈ E(G₁) ∪ E(G₂) := hE_union.symm ▸ e.2 + exact this.resolve_left he₁ + let eFun : E(G) → D.E := fun e => + if he₁ : e.1 ∈ E(G₁) then + ⟨(Γ₁.iso.edgeEquiv ⟨e.1, he₁⟩).1, hD_E ▸ Or.inl (Γ₁.iso.edgeEquiv ⟨e.1, he₁⟩).2⟩ + else + ⟨(Γ₂.iso.edgeEquiv ⟨e.1, he₂_of_not_1 e he₁⟩).1, + hD_E ▸ Or.inr (Γ₂.iso.edgeEquiv ⟨e.1, he₂_of_not_1 e he₁⟩).2⟩ + have heFun_bij : Function.Bijective eFun := by + refine ⟨fun e₁ e₂ heq => ?_, fun a => ?_⟩ + · have hval := congrArg Subtype.val heq + dsimp [eFun] at hval + split_ifs at hval with h1 h2 h2 + · have h := Γ₁.iso.edgeEquiv.injective (Subtype.ext hval) + have h' : e₁.1 = e₂.1 := congrArg (fun x : E(G₁) => x.1) h + exact Subtype.ext h' + · exfalso + have ha₁ : (Γ₁.iso.edgeEquiv ⟨e₁.1, h1⟩).1 ∈ Γ₁.drawing.E := + (Γ₁.iso.edgeEquiv ⟨e₁.1, h1⟩).2 + have ha₂ : (Γ₁.iso.edgeEquiv ⟨e₁.1, h1⟩).1 ∈ Γ₂.drawing.E := by + rw [hval] + exact (Γ₂.iso.edgeEquiv ⟨e₂.1, he₂_of_not_1 e₂ h2⟩).2 + exact disjoint_left.mp hdisj_DE ha₁ ha₂ + · exfalso + have ha₁ : (Γ₁.iso.edgeEquiv ⟨e₂.1, h2⟩).1 ∈ Γ₁.drawing.E := + (Γ₁.iso.edgeEquiv ⟨e₂.1, h2⟩).2 + have ha₂ : (Γ₁.iso.edgeEquiv ⟨e₂.1, h2⟩).1 ∈ Γ₂.drawing.E := by + rw [← hval] + exact (Γ₂.iso.edgeEquiv ⟨e₁.1, he₂_of_not_1 e₁ h1⟩).2 + exact disjoint_left.mp hdisj_DE ha₁ ha₂ + · have h := Γ₂.iso.edgeEquiv.injective (Subtype.ext hval) + have h' : e₁.1 = e₂.1 := congrArg (fun x : E(G₂) => x.1) h + exact Subtype.ext h' + · have ha_union : a.1 ∈ Γ₁.drawing.E ∪ Γ₂.drawing.E := hD_E ▸ a.2 + rcases ha_union with ha₁ | ha₂ + · let e₁ := Γ₁.iso.edgeEquiv.symm ⟨a.1, ha₁⟩ + have he₁_1 : e₁.1 ∈ E(G₁) := e₁.2 + refine ⟨⟨e₁.1, hG₁.edgeSet_mono he₁_1⟩, ?_⟩ + apply Subtype.ext + dsimp [eFun] + split_ifs + exact congrArg (fun x : Γ₁.drawing.E => x.1) + (Γ₁.iso.edgeEquiv.apply_symm_apply ⟨a.1, ha₁⟩) + · let e₂ := Γ₂.iso.edgeEquiv.symm ⟨a.1, ha₂⟩ + have he₂_not_1 : e₂.1 ∉ E(G₁) := disjoint_right.mp hE_disj e₂.2 + refine ⟨⟨e₂.1, hG₂.edgeSet_mono e₂.2⟩, ?_⟩ + apply Subtype.ext + dsimp [eFun] + split_ifs + exact congrArg (fun x : Γ₂.drawing.E => x.1) + (Γ₂.iso.edgeEquiv.apply_symm_apply ⟨a.1, ha₂⟩) + let eEquiv : E(G) ≃ D.E := Equiv.ofBijective eFun heFun_bij + have heEquiv_val : ∀ e : E(G), (eEquiv e).1 = (eFun e).1 := fun _ => rfl + let iso : Iso G D.toGraph := + { vertexEquiv := vEquiv + edgeEquiv := eEquiv + isLink_iff := fun {e x y} => by + change G.IsLink e.1 x.1 y.1 ↔ D.toGraph.IsLink (eEquiv e).1 (vEquiv x).1 (vEquiv y).1 + rw [heEquiv_val, hvEquiv_val, hvEquiv_val] + dsimp [eFun] + split_ifs with he₁ + · have ha₁ : (Γ₁.iso.edgeEquiv ⟨e.1, he₁⟩).1 ∈ Γ₁.drawing.E := + (Γ₁.iso.edgeEquiv ⟨e.1, he₁⟩).2 + rw [← hsub₁.isLink_iff ha₁] + constructor + · intro hlinkG + have hlink₁ : G₁.IsLink e.1 x.1 y.1 := (hG₁.isLink_iff he₁).mpr hlinkG + have hx₁ : x.1 ∈ V(G₁) := hlink₁.left_mem + have hy₁ : y.1 ∈ V(G₁) := hlink₁.right_mem + have hlinkD' := (Γ₁.iso.isLink_iff (e := ⟨e.1, he₁⟩) (x := ⟨x.1, hx₁⟩) + (y := ⟨y.1, hy₁⟩)).mp hlink₁ + change Γ₁.drawing.toGraph.IsLink (Γ₁.iso.edgeEquiv ⟨e.1, he₁⟩).1 + (Γ₁.iso.vertexEquiv ⟨x.1, hx₁⟩).1 (Γ₁.iso.vertexEquiv ⟨y.1, hy₁⟩).1 at hlinkD' + rwa [hν₁ ⟨x.1, hx₁⟩, hν₁ ⟨y.1, hy₁⟩] at hlinkD' + · intro hlinkD + have hxV₁ : ν x.1 ∈ Γ₁.drawing.V := hlinkD.2.1 + have hyV₁ : ν y.1 ∈ Γ₁.drawing.V := hlinkD.2.2.1 + rw [hV₁_eq] at hxV₁ hyV₁ + obtain ⟨x', hx'₁, hx'_eq⟩ := hxV₁ + obtain ⟨y', hy'₁, hy'_eq⟩ := hyV₁ + have hx_eq : x' = x.1 := hν_inj (hG₁.vertexSet_mono hx'₁) x.2 hx'_eq + have hy_eq : y' = y.1 := hν_inj (hG₁.vertexSet_mono hy'₁) y.2 hy'_eq + have hx₁ : x.1 ∈ V(G₁) := hx_eq ▸ hx'₁ + have hy₁ : y.1 ∈ V(G₁) := hy_eq ▸ hy'₁ + have hlinkD' : Γ₁.drawing.toGraph.IsLink (Γ₁.iso.edgeEquiv ⟨e.1, he₁⟩).1 + (Γ₁.iso.vertexEquiv ⟨x.1, hx₁⟩).1 (Γ₁.iso.vertexEquiv ⟨y.1, hy₁⟩).1 := by + rwa [hν₁ ⟨x.1, hx₁⟩, hν₁ ⟨y.1, hy₁⟩] + exact ((Γ₁.iso.isLink_iff (e := ⟨e.1, he₁⟩) (x := ⟨x.1, hx₁⟩) + (y := ⟨y.1, hy₁⟩)).mpr hlinkD').mono hG₁ + · have he₂ : e.1 ∈ E(G₂) := he₂_of_not_1 e he₁ + have ha₂ : (Γ₂.iso.edgeEquiv ⟨e.1, he₂⟩).1 ∈ Γ₂.drawing.E := + (Γ₂.iso.edgeEquiv ⟨e.1, he₂⟩).2 + rw [← hsub₂.isLink_iff ha₂] + constructor + · intro hlinkG + have hlink₂ : G₂.IsLink e.1 x.1 y.1 := (hG₂.isLink_iff he₂).mpr hlinkG + have hx₂ : x.1 ∈ V(G₂) := hlink₂.left_mem + have hy₂ : y.1 ∈ V(G₂) := hlink₂.right_mem + have hlinkD' := (Γ₂.iso.isLink_iff (e := ⟨e.1, he₂⟩) (x := ⟨x.1, hx₂⟩) + (y := ⟨y.1, hy₂⟩)).mp hlink₂ + change Γ₂.drawing.toGraph.IsLink (Γ₂.iso.edgeEquiv ⟨e.1, he₂⟩).1 + (Γ₂.iso.vertexEquiv ⟨x.1, hx₂⟩).1 (Γ₂.iso.vertexEquiv ⟨y.1, hy₂⟩).1 at hlinkD' + rwa [hν₂ ⟨x.1, hx₂⟩, hν₂ ⟨y.1, hy₂⟩] at hlinkD' + · intro hlinkD + have hxV₂ : ν x.1 ∈ Γ₂.drawing.V := hlinkD.2.1 + have hyV₂ : ν y.1 ∈ Γ₂.drawing.V := hlinkD.2.2.1 + rw [hV₂_eq] at hxV₂ hyV₂ + obtain ⟨x', hx'₂, hx'_eq⟩ := hxV₂ + obtain ⟨y', hy'₂, hy'_eq⟩ := hyV₂ + have hx_eq : x' = x.1 := hν_inj (hG₂.vertexSet_mono hx'₂) x.2 hx'_eq + have hy_eq : y' = y.1 := hν_inj (hG₂.vertexSet_mono hy'₂) y.2 hy'_eq + have hx₂ : x.1 ∈ V(G₂) := hx_eq ▸ hx'₂ + have hy₂ : y.1 ∈ V(G₂) := hy_eq ▸ hy'₂ + have hlinkD' : Γ₂.drawing.toGraph.IsLink (Γ₂.iso.edgeEquiv ⟨e.1, he₂⟩).1 + (Γ₂.iso.vertexEquiv ⟨x.1, hx₂⟩).1 (Γ₂.iso.vertexEquiv ⟨y.1, hy₂⟩).1 := by + rwa [hν₂ ⟨x.1, hx₂⟩, hν₂ ⟨y.1, hy₂⟩] + exact ((Γ₂.iso.isLink_iff (e := ⟨e.1, he₂⟩) (x := ⟨x.1, hx₂⟩) + (y := ⟨y.1, hy₂⟩)).mpr hlinkD').mono hG₂ } + refine ⟨⟨D, iso⟩, rfl, hvEquiv_val, fun e => ?_⟩ + ext x + simp only [graphDrawingEdgeSet, mem_iUnion, mem_union] + constructor + · rintro ⟨he, hx⟩ + have hx' : x ∈ (eFun ⟨e, he⟩).1 := hx + dsimp [eFun] at hx' + split_ifs at hx' with he₁ + · exact Or.inl ⟨he₁, hx'⟩ + · exact Or.inr ⟨he₂_of_not_1 ⟨e, he⟩ he₁, hx'⟩ + · rintro (⟨he₁, hx⟩ | ⟨he₂, hx⟩) + · refine ⟨hG₁.edgeSet_mono he₁, ?_⟩ + change x ∈ (eFun ⟨e, hG₁.edgeSet_mono he₁⟩).1 + dsimp [eFun] + rw [dite_eq_left_of_eq_true (eq_true he₁)] + exact hx + · have hn : e ∉ E(G₁) := disjoint_right.mp hE_disj he₂ + refine ⟨hG₂.edgeSet_mono he₂, ?_⟩ + change x ∈ (eFun ⟨e, hG₂.edgeSet_mono he₂⟩).1 + dsimp [eFun] + rw [dite_eq_right_of_eq_false (eq_false hn)] + exact hx + +/-- Gluing two drawings along common vertices. -/ +theorem GraphDrawing.glue {S : Type*} [TopologicalSpace S] {G G₁ G₂ : Graph α β} + (hG₁ : G₁ ≤ G) (hG₂ : G₂ ≤ G) + (hV_union : V(G₁) ∪ V(G₂) = V(G)) + (hE_union : E(G₁) ∪ E(G₂) = E(G)) + (hE_disj : Disjoint E(G₁) E(G₂)) + {ν : α → S} (hν_inj : InjOn ν V(G)) + (Γ₁ : GraphDrawing G₁ S) (Γ₂ : GraphDrawing G₂ S) + (hν₁ : ∀ v : V(G₁), (Γ₁.iso.vertexEquiv v).1 = ν v.1) + (hν₂ : ∀ v : V(G₂), (Γ₂.iso.vertexEquiv v).1 = ν v.1) + (hmeet : Γ₁.drawing.U ∩ Γ₂.drawing.U ⊆ ν '' (V(G₁) ∩ V(G₂))) : + ∃ Γ : GraphDrawing G S, + Γ.drawing.U = Γ₁.drawing.U ∪ Γ₂.drawing.U ∧ + ∀ v : V(G), (Γ.iso.vertexEquiv v).1 = ν v.1 := by + obtain ⟨Γ, h₁, h₂, -⟩ := GraphDrawing.glue_edges hG₁ hG₂ hV_union hE_union hE_disj hν_inj Γ₁ Γ₂ + hν₁ hν₂ hmeet + exact ⟨Γ, h₁, h₂⟩ + +/-- Construct a `GraphDrawing` for an edgeless finite graph `G` from an injection `ν` on `V(G)`. -/ +theorem GraphDrawing.of_edgeless {S : Type*} [TopologicalSpace S] [T1Space S] {G : Graph α β} + (hV_fin : V(G).Finite) (hE : E(G) = ∅) {ν : α → S} (hν_inj : InjOn ν V(G)) : + ∃ Γ : GraphDrawing G S, + Γ.drawing.U = ν '' V(G) ∧ + ∀ v : V(G), (Γ.iso.vertexEquiv v).1 = ν v.1 := by + let D := pointsDrawing (hV_fin.image ν) + have hD_E : D.E = ∅ := by + refine Subset.antisymm (fun C hC => ?_) (empty_subset _) + rcases hC with ⟨⟨x, hx⟩, hsub, -⟩ + exact (hsub hx).2 (hsub hx).1 + let vEquiv : V(G) ≃ D.V := Equiv.Set.imageOfInjOn ν V(G) hν_inj + have h_no_e : ∀ e : E(G), False := fun ⟨x, hx⟩ => by rw [hE] at hx; exact hx + have h_no_a : ∀ a : D.E, False := fun ⟨x, hx⟩ => by rw [hD_E] at hx; exact hx + let eEquiv : E(G) ≃ D.E := + { toFun := fun e => (h_no_e e).elim + invFun := fun a => (h_no_a a).elim + left_inv := fun e => (h_no_e e).elim + right_inv := fun a => (h_no_a a).elim } + let iso : Iso G D.toGraph := + { vertexEquiv := vEquiv + edgeEquiv := eEquiv + isLink_iff := fun {e _ _} => (h_no_e e).elim } + exact ⟨⟨D, iso⟩, rfl, fun _ => rfl⟩ + +/-- Construct a `GraphDrawing` for a single non-loop edge `e₀` between `u ≠ v` along a line `K`. -/ +theorem GraphDrawing.of_single_edge {S : Type*} [TopologicalSpace S] [T2Space S] {G : Graph α β} + {u v : α} {e₀ : β} (hV : V(G) = {u, v}) (hE : E(G) = {e₀}) (hlink : G.IsLink e₀ u v) + {ν : α → S} (hν_ne : ν u ≠ ν v) {K : Set S} (hK : IsLineWithEnds K (ν u) (ν v)) : + ∃ Γ : GraphDrawing G S, + Γ.drawing.U = K ∧ + ∀ w : V(G), (Γ.iso.vertexEquiv w).1 = ν w.1 := by + have huv : u ≠ v := fun h => hν_ne (congrArg ν h) + have hν_inj : InjOn ν V(G) := by + rw [hV] + rintro x (rfl | rfl) y (rfl | rfl) hxy + · rfl + · exact (hν_ne hxy).elim + · exact (hν_ne hxy.symm).elim + · rfl + let D := lineDrawing hK hν_ne + have hD_V : D.V = ν '' V(G) := by + change {ν u, ν v} = _ + rw [hV, image_pair] + have hD_E : D.E = {K \ {ν u, ν v}} := lineDrawing_E hK hν_ne + let vFun : V(G) → D.V := fun w => ⟨ν w.1, hD_V ▸ ⟨w.1, w.2, rfl⟩⟩ + have hvFun_bij : Function.Bijective vFun := + ⟨fun w₁ w₂ h => Subtype.ext (hν_inj w₁.2 w₂.2 (congrArg Subtype.val h)), + fun z => by + have hz : z.1 ∈ ν '' V(G) := hD_V ▸ z.2 + obtain ⟨x, hx, hnx⟩ := hz + exact ⟨⟨x, hx⟩, Subtype.ext hnx⟩⟩ + let vEquiv : V(G) ≃ D.V := Equiv.ofBijective vFun hvFun_bij + have hvEquiv_val : ∀ w : V(G), (vEquiv w).1 = ν w.1 := fun _ => rfl + let eEquiv : E(G) ≃ D.E := + { toFun := fun _ => ⟨K \ {ν u, ν v}, hD_E ▸ mem_singleton _⟩ + invFun := fun _ => ⟨e₀, hE ▸ mem_singleton e₀⟩ + left_inv := fun e => Subtype.ext (mem_singleton_iff.mp (hE ▸ e.2)).symm + right_inv := fun a => Subtype.ext (mem_singleton_iff.mp (hD_E ▸ a.2)).symm } + have hcl_inter : closure (K \ {ν u, ν v}) ∩ D.V = {ν u, ν v} := by + rw [closure_sdiff_pair hK] + exact inter_eq_right.mpr D.V_subset_U + let iso : Iso G D.toGraph := + { vertexEquiv := vEquiv + edgeEquiv := eEquiv + isLink_iff := fun {e x y} => by + change G.IsLink e.1 x.1 y.1 ↔ D.toGraph.IsLink (K \ {ν u, ν v}) (vEquiv x).1 (vEquiv y).1 + rw [hvEquiv_val, hvEquiv_val] + have he_eq : e.1 = e₀ := mem_singleton_iff.mp (hE ▸ e.2) + rw [he_eq] + constructor + · intro hxy_link + refine ⟨hD_E ▸ mem_singleton _, (vEquiv x).2, (vEquiv y).2, ?_⟩ + rw [hcl_inter] + rcases hxy_link.eq_and_eq_or_eq_and_eq hlink with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · exact pair_comm _ _ + · rintro ⟨_, _, _, hc⟩ + rw [hcl_inter] at hc + have hx_uv : x.1 = u ∨ x.1 = v := by simpa [hV] using x.2 + have hy_uv : y.1 = u ∨ y.1 = v := by simpa [hV] using y.2 + rcases hx_uv with hxu | hxv <;> rcases hy_uv with hyu | hyv + · exfalso + rw [hxu, hyu, pair_eq_singleton] at hc + have hνv : ν v ∈ ({ν u} : Set S) := hc ▸ by simp + exact hν_ne (mem_singleton_iff.mp hνv).symm + · exact hxu ▸ hyv ▸ hlink + · exact hxv ▸ hyu ▸ hlink.symm + · exfalso + rw [hxv, hyv, pair_eq_singleton] at hc + have hνu : ν u ∈ ({ν v} : Set S) := hc ▸ by simp + exact hν_ne (mem_singleton_iff.mp hνu) } + exact ⟨⟨D, iso⟩, rfl, hvEquiv_val⟩ + +/-- Construct a `GraphDrawing` for a single loop `e₀` at `u` along an `O`-arc `F` containing `ν u`. +-/ +theorem GraphDrawing.of_single_loop {S : Type*} [TopologicalSpace S] [T2Space S] {G : Graph α β} + {u : α} {e₀ : β} (hV : V(G) = {u}) (hE : E(G) = {e₀}) (hlink : G.IsLink e₀ u u) + {ν : α → S} {F : Set S} (hF : IsOArc F) (hνu : ν u ∈ F) : + ∃ Γ : GraphDrawing G S, + Γ.drawing.U = F ∧ + ∀ w : V(G), (Γ.iso.vertexEquiv w).1 = ν w.1 := by + obtain ⟨D, hDU, hDV⟩ := exists_loop_drawing hF hνu + obtain ⟨p, hp, h0, h2, hper, himg, hr⟩ := exists_oArc_par hF hνu + have hpos : (0 : ℝ) < 2 * Real.pi := Real.two_pi_pos + have hsd : F \ {ν u} = p '' Ioo 0 (2 * Real.pi) := by + ext y + constructor + · rintro ⟨hy, hya⟩ + rw [← himg] at hy + obtain ⟨s, hs, rfl⟩ := hy + refine ⟨s, ⟨lt_of_le_of_ne hs.1 fun h => hya ?_, hs.2⟩, rfl⟩ + rw [← h, h0] + exact mem_singleton (ν u) + · rintro ⟨s, hs, rfl⟩ + refine ⟨hr ⟨s, rfl⟩, fun h => ?_⟩ + obtain ⟨m, hm⟩ := hper s 0 (h.trans h0.symm) + rw [zero_add] at hm + have h₁ : (0 : ℝ) < m := by by_contra hc; push Not at hc; nlinarith [hs.1] + have h₂ : (m : ℝ) < 1 := by by_contra hc; push Not at hc; nlinarith [hs.2] + have h₃ : (0 : ℤ) < m := by exact_mod_cast h₁ + have h₄ : m < (1 : ℤ) := by exact_mod_cast h₂ + omega + have hpc : IsPathConnected (F \ {ν u}) := by + rw [hsd] + exact ((convex_Ioo _ _).isPathConnected (nonempty_Ioo.mpr hpos)).image hp + have hD_E : D.E = {F \ {ν u}} := by + change arcComponentsIn (D.U \ D.V) = _ + rw [hDU, hDV] + refine Subset.antisymm (fun C ⟨_, hsub, _, hmax⟩ => ?_) ?_ + · rw [mem_singleton_iff] + exact (hmax _ Subset.rfl hpc hsub).symm + · rw [singleton_subset_iff] + exact ⟨hpc.nonempty, Subset.rfl, hpc, fun C hC _ hsub => Subset.antisymm hC hsub⟩ + let vEquiv : V(G) ≃ D.V := + { toFun := fun _ => ⟨ν u, hDV ▸ mem_singleton (ν u)⟩ + invFun := fun _ => ⟨u, hV ▸ mem_singleton u⟩ + left_inv := fun w => Subtype.ext (mem_singleton_iff.mp (hV ▸ w.2)).symm + right_inv := fun z => Subtype.ext (mem_singleton_iff.mp (hDV ▸ z.2)).symm } + have hvEquiv_val : ∀ w : V(G), (vEquiv w).1 = ν w.1 := fun w => by + have hw : w.1 = u := mem_singleton_iff.mp (hV ▸ w.2) + simp [vEquiv, hw] + let eEquiv : E(G) ≃ D.E := + { toFun := fun _ => ⟨F \ {ν u}, hD_E ▸ mem_singleton _⟩ + invFun := fun _ => ⟨e₀, hE ▸ mem_singleton e₀⟩ + left_inv := fun e => Subtype.ext (mem_singleton_iff.mp (hE ▸ e.2)).symm + right_inv := fun a => Subtype.ext (mem_singleton_iff.mp (hD_E ▸ a.2)).symm } + have hcl_inter : closure (F \ {ν u}) ∩ D.V = {ν u} := by + have he_mem : F \ {ν u} ∈ D.E := hD_E ▸ mem_singleton _ + rcases D.edge_cond (F \ {ν u}) he_mem with ⟨a, b, hab, hc, _⟩ | ⟨a, hc, _⟩ + · exfalso + have ha_in : a ∈ closure (F \ {ν u}) ∩ D.V := hc ▸ by simp + have hb_in : b ∈ closure (F \ {ν u}) ∩ D.V := hc ▸ by simp + have ha : a = ν u := mem_singleton_iff.mp (hDV ▸ ha_in.2) + have hb : b = ν u := mem_singleton_iff.mp (hDV ▸ hb_in.2) + exact hab (ha.trans hb.symm) + · have ha_in : a ∈ closure (F \ {ν u}) ∩ D.V := hc ▸ by simp + have ha : a = ν u := mem_singleton_iff.mp (hDV ▸ ha_in.2) + exact ha ▸ hc + let iso : Iso G D.toGraph := + { vertexEquiv := vEquiv + edgeEquiv := eEquiv + isLink_iff := fun {e x y} => by + change G.IsLink e.1 x.1 y.1 ↔ D.toGraph.IsLink (F \ {ν u}) (vEquiv x).1 (vEquiv y).1 + have he_eq : e.1 = e₀ := mem_singleton_iff.mp (hE ▸ e.2) + have hx_eq : x.1 = u := mem_singleton_iff.mp (hV ▸ x.2) + have hy_eq : y.1 = u := mem_singleton_iff.mp (hV ▸ y.2) + rw [hvEquiv_val, hvEquiv_val, he_eq, hx_eq, hy_eq] + constructor + · intro _ + refine ⟨hD_E ▸ mem_singleton _, hDV ▸ mem_singleton _, hDV ▸ mem_singleton _, ?_⟩ + rw [pair_eq_singleton] + exact hcl_inter + · intro _ + exact hlink } + exact ⟨⟨D, iso⟩, hDU, hvEquiv_val⟩ + +/-! ### Module 3: Loop Circles in the Closed Unit Disc and Base Case Drawing -/ + +/-- A small circle in `ClosedUnitDisc` tangent to `UnitCircle` at `p ∈ sphere 0 1` of radius `ρ`. -/ +def loopCircle (p : ℂ) (ρ : ℝ) : Set ℂ := + range (fun w : Circle => (1 - (ρ : ℂ)) * p + (ρ : ℂ) * (w : ℂ)) + +theorem isOArc_loopCircle (p : ℂ) {ρ : ℝ} (hρ : 0 < ρ) : IsOArc (loopCircle p ρ) := by + let g : Circle → ℂ := fun w => (1 - (ρ : ℂ)) * p + (ρ : ℂ) * (w : ℂ) + have hg_cont : Continuous g := by fun_prop + have hg_inj : Function.Injective g := by + intro w₁ w₂ heq + have hmul : (ρ : ℂ) * (w₁ : ℂ) = (ρ : ℂ) * (w₂ : ℂ) := add_left_cancel heq + have hρ_ne : (ρ : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hρ.ne' + exact Subtype.ext (mul_left_cancel₀ hρ_ne hmul) + have hemb := hg_cont.isClosedEmbedding hg_inj + exact ⟨hemb.isEmbedding.toHomeomorph⟩ + +theorem mem_loopCircle_self {p : ℂ} (hp : p ∈ Metric.sphere (0 : ℂ) 1) (ρ : ℝ) : + p ∈ loopCircle p ρ := by + refine ⟨⟨p, hp⟩, ?_⟩ + change (1 - (ρ : ℂ)) * p + (ρ : ℂ) * p = p + ring + +private theorem normSq_loopCircle_pt (p w : ℂ) (ρ : ℝ) : + Complex.normSq ((1 - (ρ : ℂ)) * p + (ρ : ℂ) * w) = + (1 - ρ) * Complex.normSq p + ρ * Complex.normSq w - + ρ * (1 - ρ) * Complex.normSq (w - p) := by + simp only [Complex.normSq_apply, Complex.add_re, Complex.add_im, Complex.sub_re, Complex.sub_im, + Complex.mul_re, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, + Complex.one_re, Complex.one_im] + ring + +private theorem loopCircle_implicit_eq (p w : ℂ) (ρ : ℝ) : + let z := (1 - (ρ : ℂ)) * p + (ρ : ℂ) * w + Complex.normSq (z - p) + 2 * ρ * ((z.re - p.re) * p.re + (z.im - p.im) * p.im) = + ρ ^ 2 * (Complex.normSq w - Complex.normSq p) := by + intro z + change Complex.normSq (((1 - (ρ : ℂ)) * p + (ρ : ℂ) * w) - p) + + 2 * ρ * ((((1 - (ρ : ℂ)) * p + (ρ : ℂ) * w).re - p.re) * p.re + + (((1 - (ρ : ℂ)) * p + (ρ : ℂ) * w).im - p.im) * p.im) = + ρ ^ 2 * (Complex.normSq w - Complex.normSq p) + simp only [Complex.normSq_apply, Complex.add_re, Complex.add_im, Complex.sub_re, Complex.sub_im, + Complex.mul_re, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, + Complex.one_re, Complex.one_im] + ring + +theorem loopCircle_subset_closedBall {p : ℂ} (hp : p ∈ Metric.sphere (0 : ℂ) 1) + {ρ : ℝ} (hρ0 : 0 < ρ) (hρ1 : ρ < 1) : + loopCircle p ρ ⊆ Metric.closedBall (0 : ℂ) 1 := by + rintro z ⟨w, rfl⟩ + rw [Metric.mem_closedBall, dist_zero_right] + have hp_norm : ‖p‖ = 1 := by simpa using hp + have hw_norm : ‖(w : ℂ)‖ = 1 := by simp + calc + ‖(1 - (ρ : ℂ)) * p + (ρ : ℂ) * (w : ℂ)‖ + ≤ ‖(1 - (ρ : ℂ)) * p‖ + ‖(ρ : ℂ) * (w : ℂ)‖ := norm_add_le _ _ + _ = ‖(1 - (ρ : ℂ))‖ * ‖p‖ + ‖(ρ : ℂ)‖ * ‖(w : ℂ)‖ := by rw [norm_mul, norm_mul] + _ = |1 - ρ| * 1 + |ρ| * 1 := by + rw [hp_norm, hw_norm, ← Complex.ofReal_one, ← Complex.ofReal_sub, + Complex.norm_real, Complex.norm_real, Real.norm_eq_abs, Real.norm_eq_abs] + _ = (1 - ρ) + ρ := by + rw [abs_of_pos (by linarith), abs_of_pos hρ0, mul_one, mul_one] + _ = 1 := by ring + +theorem loopCircle_inter_sphere {p : ℂ} (hp : p ∈ Metric.sphere (0 : ℂ) 1) + {ρ : ℝ} (hρ0 : 0 < ρ) (hρ1 : ρ < 1) : + loopCircle p ρ ∩ Metric.sphere (0 : ℂ) 1 = {p} := by + refine Subset.antisymm (fun z ⟨⟨w, hw⟩, hz_sph⟩ => ?_) (singleton_subset_iff.mpr + ⟨mem_loopCircle_self hp ρ, hp⟩) + rw [mem_singleton_iff] + change (1 - (ρ : ℂ)) * p + (ρ : ℂ) * (w : ℂ) = z at hw + have hp_sq : Complex.normSq p = 1 := by + have hp1 : ‖p‖ = 1 := by simpa using hp + rw [Complex.normSq_eq_norm_sq, hp1, one_pow] + have hw_sq : Complex.normSq (w : ℂ) = 1 := by + have hw1 : ‖(w : ℂ)‖ = 1 := by simp + rw [Complex.normSq_eq_norm_sq, hw1, one_pow] + have hz_sq : Complex.normSq z = 1 := by + have hz1 : ‖z‖ = 1 := by simpa using hz_sph + rw [Complex.normSq_eq_norm_sq, hz1, one_pow] + have hId := normSq_loopCircle_pt p (w : ℂ) ρ + rw [hw, hp_sq, hw_sq, hz_sq] at hId + have hsub_zero : Complex.normSq ((w : ℂ) - p) = 0 := by + have hpos : 0 < ρ * (1 - ρ) := mul_pos hρ0 (by linarith) + nlinarith + have hwp : (w : ℂ) = p := sub_eq_zero.mp (Complex.normSq_eq_zero.mp hsub_zero) + rw [← hw, hwp] + ring + +theorem loopCircle_inter_loopCircle_same {p : ℂ} (hp : p ∈ Metric.sphere (0 : ℂ) 1) + {ρ₁ ρ₂ : ℝ} (hne : ρ₁ ≠ ρ₂) : + loopCircle p ρ₁ ∩ loopCircle p ρ₂ = {p} := by + refine Subset.antisymm (fun z ⟨⟨w₁, hw₁⟩, ⟨w₂, hw₂⟩⟩ => ?_) (singleton_subset_iff.mpr + ⟨mem_loopCircle_self hp ρ₁, mem_loopCircle_self hp ρ₂⟩) + rw [mem_singleton_iff] + change (1 - (ρ₁ : ℂ)) * p + (ρ₁ : ℂ) * (w₁ : ℂ) = z at hw₁ + change (1 - (ρ₂ : ℂ)) * p + (ρ₂ : ℂ) * (w₂ : ℂ) = z at hw₂ + have hp_sq : Complex.normSq p = 1 := by + have hp1 : ‖p‖ = 1 := by simpa using hp + rw [Complex.normSq_eq_norm_sq, hp1, one_pow] + have hw₁_sq : Complex.normSq (w₁ : ℂ) = 1 := by + have hw1 : ‖(w₁ : ℂ)‖ = 1 := by simp + rw [Complex.normSq_eq_norm_sq, hw1, one_pow] + have hw₂_sq : Complex.normSq (w₂ : ℂ) = 1 := by + have hw2 : ‖(w₂ : ℂ)‖ = 1 := by simp + rw [Complex.normSq_eq_norm_sq, hw2, one_pow] + have h1 := loopCircle_implicit_eq p (w₁ : ℂ) ρ₁ + dsimp only at h1 + rw [hw₁, hw₁_sq, hp_sq, sub_self, mul_zero] at h1 + have h2 := loopCircle_implicit_eq p (w₂ : ℂ) ρ₂ + dsimp only at h2 + rw [hw₂, hw₂_sq, hp_sq, sub_self, mul_zero] at h2 + have hdot : (z.re - p.re) * p.re + (z.im - p.im) * p.im = 0 := by + have hdiff : 2 * (ρ₁ - ρ₂) * ((z.re - p.re) * p.re + (z.im - p.im) * p.im) = 0 := by + linarith + rcases mul_eq_zero.mp hdiff with hρ | hd + · exfalso; apply hne; linarith + · exact hd + have hnorm_zero : Complex.normSq (z - p) = 0 := by + rw [hdot, mul_zero, add_zero] at h1 + exact h1 + exact sub_eq_zero.mp (Complex.normSq_eq_zero.mp hnorm_zero) + +theorem norm_sub_le_two_mul_of_mem_loopCircle {p z : ℂ} (hp : p ∈ Metric.sphere (0 : ℂ) 1) + {ρ : ℝ} (hρ : 0 < ρ) (hz : z ∈ loopCircle p ρ) : + ‖z - p‖ ≤ 2 * ρ := by + rcases hz with ⟨w, rfl⟩ + have hsub : (1 - (ρ : ℂ)) * p + (ρ : ℂ) * (w : ℂ) - p = (ρ : ℂ) * ((w : ℂ) - p) := by ring + rw [hsub, norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hρ] + have hp_norm : ‖p‖ = 1 := by simpa using hp + have hw_norm : ‖(w : ℂ)‖ = 1 := by simp + have hle : ‖(w : ℂ) - p‖ ≤ 2 := by + calc ‖(w : ℂ) - p‖ ≤ ‖(w : ℂ)‖ + ‖p‖ := norm_sub_le _ _ + _ = 2 := by rw [hw_norm, hp_norm]; norm_num + nlinarith + +theorem loopCircle_disjoint_of_dist {p q : ℂ} + (hp : p ∈ Metric.sphere (0 : ℂ) 1) (hq : q ∈ Metric.sphere (0 : ℂ) 1) + {ρ₁ ρ₂ : ℝ} (hρ₁ : 0 < ρ₁) (hρ₂ : 0 < ρ₂) (hdist : 2 * ρ₁ + 2 * ρ₂ < ‖p - q‖) : + loopCircle p ρ₁ ∩ loopCircle q ρ₂ = ∅ := by + refine Set.eq_empty_iff_forall_notMem.mpr fun z ⟨hz₁, hz₂⟩ => ?_ + have h1 := norm_sub_le_two_mul_of_mem_loopCircle hp hρ₁ hz₁ + have h2 := norm_sub_le_two_mul_of_mem_loopCircle hq hρ₂ hz₂ + have htri : ‖p - q‖ ≤ ‖z - p‖ + ‖z - q‖ := by + calc ‖p - q‖ = ‖(p - z) + (z - q)‖ := by congr 1; ring + _ ≤ ‖p - z‖ + ‖z - q‖ := norm_add_le _ _ + _ = ‖z - p‖ + ‖z - q‖ := by rw [norm_sub_rev] + linarith + +/-- For any finite set of vertices mapped injectively into `ℂ`, there exists `0 < δ < 1 / 4` +such that distinct vertices are at distance strictly greater than `4 * δ`. -/ +theorem exists_pos_delta_lt_dist {V : Set α} (hV : V.Finite) {ν : α → ℂ} (hν : InjOn ν V) : + ∃ δ : ℝ, 0 < δ ∧ δ < 1 / 4 ∧ ∀ u ∈ V, ∀ v ∈ V, u ≠ v → 4 * δ < ‖ν u - ν v‖ := by + have hP_fin : {p : α × α | p.1 ∈ V ∧ p.2 ∈ V ∧ p.1 ≠ p.2}.Finite := + (hV.prod hV).subset (fun _ hp => ⟨hp.1, hp.2.1⟩) + suffices ∀ P : Set (α × α), P.Finite → (∀ p ∈ P, p.1 ∈ V ∧ p.2 ∈ V ∧ p.1 ≠ p.2) → + ∃ δ : ℝ, 0 < δ ∧ δ < 1 / 4 ∧ ∀ p ∈ P, 4 * δ < ‖ν p.1 - ν p.2‖ by + obtain ⟨δ, hδ0, hδ1, hδ⟩ := this _ hP_fin (fun _ hp => hp) + exact ⟨δ, hδ0, hδ1, fun u hu v hv huv => hδ (u, v) ⟨hu, hv, huv⟩⟩ + intro P hP + refine Set.Finite.induction_on P hP ?_ ?_ + · intro _ + exact ⟨1 / 8, by norm_num, by norm_num, fun _ hp => False.elim hp⟩ + · intro a s _ _ ih hsub + obtain ⟨δ₀, hδ₀_pos, hδ₀_lt, hδ₀⟩ := ih (fun p hp => hsub p (mem_insert_of_mem a hp)) + have ha_mem := hsub a (mem_insert a s) + have hne : ν a.1 ≠ ν a.2 := fun heq => ha_mem.2.2 (hν ha_mem.1 ha_mem.2.1 heq) + have hnorm_pos : 0 < ‖ν a.1 - ν a.2‖ := norm_pos_iff.mpr (sub_ne_zero.mpr hne) + let δ := min δ₀ (‖ν a.1 - ν a.2‖ / 8) + refine ⟨δ, lt_min hδ₀_pos (by linarith), lt_of_le_of_lt (min_le_left _ _) hδ₀_lt, ?_⟩ + intro p hp + rcases mem_insert_iff.mp hp with rfl | hps + · have : δ ≤ ‖ν p.1 - ν p.2‖ / 8 := min_le_right _ _ + linarith + · have : δ ≤ δ₀ := min_le_left _ _ + linarith [hδ₀ p hps] + +theorem GraphDrawing.of_eq {S : Type*} [TopologicalSpace S] {G₁ G₂ : Graph α β} + (h : G₁ = G₂) (Γ : GraphDrawing G₁ S) {ν : α → S} + (hν : ∀ v : V(G₁), (Γ.iso.vertexEquiv v).1 = ν v.1) : + ∃ Γ' : GraphDrawing G₂ S, + Γ'.drawing = Γ.drawing ∧ + ∀ v : V(G₂), (Γ'.iso.vertexEquiv v).1 = ν v.1 := by + subst h + exact ⟨Γ, rfl, hν⟩ + +/-- Base case drawing construction: if `G` is a finite graph whose edges are all loops and `ν` +injectively maps `V(G)` into `sphere (0 : ℂ) 1`, then `G` admits a drawing in `closedBall (0 : ℂ) 1` +intersecting `sphere (0 : ℂ) 1` exactly at `ν '' V(G)`. -/ +theorem exists_drawing_of_loops_only {G : Graph α β} + (hV_fin : V(G).Finite) (hE_fin : E(G).Finite) + (hloops : ∀ e x y, G.IsLink e x y → x = y) + {ν : α → ℂ} (hν_inj : InjOn ν V(G)) (hν_sph : ∀ v ∈ V(G), ν v ∈ Metric.sphere (0 : ℂ) 1) : + ∃ Γ : GraphDrawing G ℂ, + Γ.drawing.U ⊆ Metric.closedBall (0 : ℂ) 1 ∧ + Γ.drawing.U ∩ Metric.sphere (0 : ℂ) 1 = ν '' V(G) ∧ + ∀ v : V(G), (Γ.iso.vertexEquiv v).1 = ν v.1 := by + obtain ⟨δ, hδ_pos, hδ_lt, hδ_dist⟩ := exists_pos_delta_lt_dist hV_fin hν_inj + let ρ : ℕ → ℝ := fun k => δ / ((k : ℝ) + 2) + have hρ_pos : ∀ k : ℕ, 0 < ρ k := fun k => div_pos hδ_pos (by positivity) + have hρ_lt_delta : ∀ k : ℕ, ρ k < δ := fun k => by + dsimp [ρ] + exact div_lt_self hδ_pos (by linarith : (1 : ℝ) < (k : ℝ) + 2) + have hρ_lt_one : ∀ k : ℕ, ρ k < 1 := fun k => by linarith [hρ_lt_delta k] + have hρ_inj : ∀ k₁ k₂ : ℕ, k₁ ≠ k₂ → ρ k₁ ≠ ρ k₂ := fun k₁ k₂ hne heq => by + dsimp [ρ] at heq + have h1 : (0 : ℝ) < (k₁ : ℝ) + 2 := by positivity + have h2 : (0 : ℝ) < (k₂ : ℝ) + 2 := by positivity + have hmul : δ * ((k₂ : ℝ) + 2) = δ * ((k₁ : ℝ) + 2) := (div_eq_div_iff h1.ne' h2.ne').mp heq + have hcast : (k₂ : ℝ) = (k₁ : ℝ) := by nlinarith + exact hne (Nat.cast_injective hcast.symm) + suffices ∀ (n : ℕ) (F : Set β), F ⊆ E(G) → F.ncard = n → + ∃ Γ : GraphDrawing (G.restrict F) ℂ, + ν '' V(G) ⊆ Γ.drawing.U ∧ + Γ.drawing.U ⊆ ν '' V(G) ∪ {z : ℂ | ∃ k < n, ∃ u ∈ V(G), z ∈ loopCircle (ν u) (ρ k)} ∧ + ∀ v : V(G.restrict F), (Γ.iso.vertexEquiv v).1 = ν v.1 by + obtain ⟨Γ₀, hU_sub₁, hU_sub₂, hν₀⟩ := this E(G).ncard E(G) Subset.rfl rfl + have hG_eq : G.restrict E(G) = G := by + refine le_antisymm restrict_le ⟨by simp, fun {e x y} hl => ?_⟩ + refine (restrict_le.isLink_iff ?_).mpr hl + rw [edgeSet_restrict, inter_self] + exact hl.edge_mem + obtain ⟨Γ, hD_eq, hν⟩ := GraphDrawing.of_eq hG_eq Γ₀ hν₀ + refine ⟨Γ, ?_, ?_, hν⟩ + · rw [hD_eq] + refine Subset.trans hU_sub₂ ?_ + refine union_subset ?_ ?_ + · rintro z ⟨v, hv, rfl⟩ + exact Metric.sphere_subset_closedBall (hν_sph v hv) + · rintro z ⟨k, _, u, hu, hzk⟩ + exact loopCircle_subset_closedBall (hν_sph u hu) (hρ_pos k) (hρ_lt_one k) hzk + · rw [hD_eq] + refine Subset.antisymm ?_ ?_ + · rintro z ⟨hzU, hzS⟩ + rcases hU_sub₂ hzU with hzV | ⟨k, _, u, hu, hzk⟩ + · exact hzV + · have hzu : z = ν u := mem_singleton_iff.mp + ((loopCircle_inter_sphere (hν_sph u hu) (hρ_pos k) (hρ_lt_one k)) ▸ ⟨hzk, hzS⟩) + exact ⟨u, hu, hzu.symm⟩ + · rintro z ⟨v, hv, rfl⟩ + exact ⟨hU_sub₁ ⟨v, hv, rfl⟩, hν_sph v hv⟩ + intro n + induction n with + | zero => + intro F hF hn + have hF_fin : F.Finite := hE_fin.subset hF + have hF_empty : F = ∅ := (ncard_eq_zero hF_fin).mp hn + have hE_empty : E(G.restrict F) = ∅ := by simp [edgeSet_restrict, hF_empty] + have hV_eq : V(G.restrict F) = V(G) := vertexSet_restrict G F + obtain ⟨Γ, hU, hν⟩ := GraphDrawing.of_edgeless + (hV_eq ▸ hV_fin) hE_empty (hV_eq ▸ hν_inj) + refine ⟨Γ, ?_, ?_, hν⟩ + · rw [hU, hV_eq] + · rw [hU, hV_eq] + exact subset_union_left + | succ n ih => + intro F hF hn + have hF_fin : F.Finite := hE_fin.subset hF + have hF_ne : F.Nonempty := (ncard_pos hF_fin).mp (by omega) + obtain ⟨e₀, he₀F⟩ := hF_ne + let F' := F \ {e₀} + have hF'_sub : F' ⊆ E(G) := Subset.trans sdiff_subset hF + have hF'_card : F'.ncard = n := by + change (F \ {e₀}).ncard = n + rw [ncard_sdiff_singleton_of_mem he₀F, hn] + omega + obtain ⟨Γ₁, hU₁_sub₁, hU₁_sub₂, hν₁⟩ := ih F' hF'_sub hF'_card + have he₀E : e₀ ∈ E(G) := hF he₀F + obtain ⟨u, v, hlink⟩ := exists_isLink_of_mem_edgeSet he₀E + have huv : u = v := hloops e₀ u v hlink + subst huv + have huV : u ∈ V(G) := hlink.left_mem + let H₂ : Graph α β := (G.induce {u}).restrict {e₀} + have hV₂ : V(H₂) = {u} := by simp [H₂] + have hE₂ : E(H₂) = {e₀} := by + ext e + simp only [H₂, edgeSet_restrict, mem_inter_iff, mem_singleton_iff, edgeSet_induce, + mem_ofPred_eq] + refine ⟨fun h => h.2, fun h => ?_⟩ + subst h + exact ⟨⟨u, u, hlink, rfl, rfl⟩, rfl⟩ + have hH₂_le_F : H₂ ≤ G.restrict F := + ⟨by simp [H₂, huV], fun {_ _ _} hl => ⟨hl.1 ▸ he₀F, hl.2.1⟩⟩ + have hlink₂ : H₂.IsLink e₀ u u := ⟨rfl, hlink, rfl, rfl⟩ + let K := loopCircle (ν u) (ρ n) + have hK_oArc : IsOArc K := isOArc_loopCircle (ν u) (hρ_pos n) + have hu_in_K : ν u ∈ K := mem_loopCircle_self (hν_sph u huV) (ρ n) + obtain ⟨Γ₂, hU₂, hν₂⟩ := GraphDrawing.of_single_loop hV₂ hE₂ hlink₂ hK_oArc hu_in_K + have hG₁_le : G.restrict F' ≤ G.restrict F := + ⟨by simp, fun {_ _ _} hl => ⟨sdiff_subset hl.1, hl.2⟩⟩ + have hV_union : V(G.restrict F') ∪ V(H₂) = V(G.restrict F) := by + rw [hV₂, vertexSet_restrict, vertexSet_restrict, union_eq_self_of_subset_right] + exact singleton_subset_iff.mpr huV + have hE_union : E(G.restrict F') ∪ E(H₂) = E(G.restrict F) := by + rw [hE₂, edgeSet_restrict, edgeSet_restrict] + ext e + simp only [mem_union, mem_inter_iff, mem_sdiff, mem_singleton_iff, F'] + constructor + · rintro (⟨heG, heF, _⟩ | rfl) + · exact ⟨heG, heF⟩ + · exact ⟨he₀E, he₀F⟩ + · rintro ⟨heG, heF⟩ + by_cases he : e = e₀ + · exact Or.inr he + · exact Or.inl ⟨heG, heF, he⟩ + have hE_disj : Disjoint E(G.restrict F') E(H₂) := by + rw [hE₂, edgeSet_restrict, disjoint_singleton_right] + simp [F'] + have hU_inter : Γ₁.drawing.U ∩ Γ₂.drawing.U ⊆ ν '' (V(G.restrict F') ∩ V(H₂)) := by + have hV_inter : V(G.restrict F') ∩ V(H₂) = {u} := by + rw [hV₂, vertexSet_restrict, inter_eq_right] + exact singleton_subset_iff.mpr huV + rw [hV_inter, image_singleton, hU₂] + rintro z ⟨hz₁, hz₂⟩ + rcases hU₁_sub₂ hz₁ with ⟨v, hv, rfl⟩ | ⟨k, hk_lt, v, hv, hzk⟩ + · have h_sph : ν v ∈ K ∩ Metric.sphere (0 : ℂ) 1 := ⟨hz₂, hν_sph v hv⟩ + rwa [loopCircle_inter_sphere (hν_sph u huV) (hρ_pos n) (hρ_lt_one n)] at h_sph + · by_cases hvu : v = u + · subst hvu + have h_inter : z ∈ loopCircle (ν v) (ρ k) ∩ K := ⟨hzk, hz₂⟩ + rwa [loopCircle_inter_loopCircle_same (hν_sph v hv) (hρ_inj k n (Nat.ne_of_lt hk_lt))] + at h_inter + · exfalso + have hdist : 2 * ρ k + 2 * ρ n < ‖ν v - ν u‖ := by + have h1 := hρ_lt_delta k + have h2 := hρ_lt_delta n + have h3 := hδ_dist v hv u huV hvu + linarith + have h_empty := loopCircle_disjoint_of_dist (hν_sph v hv) (hν_sph u huV) + (hρ_pos k) (hρ_pos n) hdist + have h_mem : z ∈ loopCircle (ν v) (ρ k) ∩ K := ⟨hzk, hz₂⟩ + rw [h_empty] at h_mem + exact h_mem + obtain ⟨Γ, hU_eq, hν_eq⟩ := GraphDrawing.glue hG₁_le hH₂_le_F hV_union hE_union hE_disj + (by rwa [vertexSet_restrict]) Γ₁ Γ₂ hν₁ hν₂ hU_inter + refine ⟨Γ, ?_, ?_, hν_eq⟩ + · rw [hU_eq] + exact Subset.trans hU₁_sub₁ subset_union_left + · rw [hU_eq, hU₂] + refine union_subset ?_ ?_ + · refine Subset.trans hU₁_sub₂ (union_subset subset_union_left ?_) + rintro z ⟨k, hk, v, hv, hzk⟩ + exact Or.inr ⟨k, Nat.lt_succ_of_lt hk, v, hv, hzk⟩ + · intro z hzK + exact Or.inr ⟨n, Nat.lt_succ_self n, u, huV, hzK⟩ + +/-! ### Module 4: Half-Disc Maps, Lens Arcs, and Angular Boundary Alignment -/ + +noncomputable section + +/-- The `k`-th subdivision point `-1 + 2 * k / (m - 1)` on `[-1, 1]`. -/ +def pathX (m k : ℕ) : ℝ := + -1 + 2 * (k : ℝ) / ((m : ℝ) - 1) + +theorem pathX_zero (m : ℕ) : pathX m 0 = -1 := by + simp [pathX] + +theorem pathX_pred {m : ℕ} (hm : 2 ≤ m) : pathX m (m - 1) = 1 := by + have hm1 : (0 : ℝ) < (m : ℝ) - 1 := by + have : (2 : ℝ) ≤ (m : ℝ) := Nat.ofNat_le_cast.mpr hm + linarith + dsimp [pathX] + rw [Nat.cast_sub (by omega : 1 ≤ m), Nat.cast_one, mul_div_cancel_right₀ _ hm1.ne'] + ring + +theorem pathX_strictMono {m : ℕ} (hm : 2 ≤ m) {j k : ℕ} (hjk : j < k) : + pathX m j < pathX m k := by + have hm1 : (0 : ℝ) < (m : ℝ) - 1 := by + have : (2 : ℝ) ≤ (m : ℝ) := Nat.ofNat_le_cast.mpr hm + linarith + have hlt : (j : ℝ) < (k : ℝ) := Nat.cast_lt.mpr hjk + dsimp [pathX] + have : 2 * (j : ℝ) / ((m : ℝ) - 1) < 2 * (k : ℝ) / ((m : ℝ) - 1) := + div_lt_div_of_pos_right (by linarith) hm1 + linarith + +theorem pathX_mem_Icc {m : ℕ} (hm : 2 ≤ m) {k : ℕ} (hk : k < m) : + pathX m k ∈ Icc (-1 : ℝ) 1 := by + refine ⟨?_, ?_⟩ + · rw [← pathX_zero m] + rcases Nat.eq_zero_or_pos k with rfl | hpos + · exact le_rfl + · exact (pathX_strictMono hm hpos).le + · rw [← pathX_pred hm] + rcases lt_or_eq_of_le (Nat.le_sub_one_of_lt hk) with hlt | rfl + · exact (pathX_strictMono hm hlt).le + · exact le_rfl + +/-- Polynomial vanishing on `[-1, 1]` precisely at `{pathX m 0, ..., pathX m (m - 1)}` +and bounded in `[0, 1]` on `[-1, 1]`. -/ +def pathPoly (m : ℕ) (x : ℝ) : ℝ := + ∏ k ∈ Finset.range m, ((x - pathX m k) / 2) ^ 2 + +theorem continuous_pathPoly (m : ℕ) : Continuous (pathPoly m) := by + unfold pathPoly + fun_prop + +theorem pathPoly_nonneg (m : ℕ) (x : ℝ) : 0 ≤ pathPoly m x := + Finset.prod_nonneg fun _ _ => sq_nonneg _ + +theorem pathPoly_le_one {m : ℕ} (hm : 2 ≤ m) {x : ℝ} (hx : x ∈ Icc (-1 : ℝ) 1) : + pathPoly m x ≤ 1 := by + have h_fac : ∀ k ∈ Finset.range m, ((x - pathX m k) / 2) ^ 2 ≤ 1 := fun k hk => by + have hk_lt : k < m := Finset.mem_range.mp hk + have hxk := pathX_mem_Icc hm hk_lt + have h1 : -1 ≤ (x - pathX m k) / 2 := by linarith [hx.1, hxk.2] + have h2 : (x - pathX m k) / 2 ≤ 1 := by linarith [hx.2, hxk.1] + nlinarith + suffices ∀ s : Finset ℕ, (∀ k ∈ s, ((x - pathX m k) / 2) ^ 2 ≤ 1) → + ∏ k ∈ s, ((x - pathX m k) / 2) ^ 2 ≤ 1 from this (Finset.range m) h_fac + intro s + refine Finset.induction_on s (by simp) fun a s ha ih hs => ?_ + rw [Finset.prod_insert ha] + have ha1 : ((x - pathX m a) / 2) ^ 2 ≤ 1 := hs a (Finset.mem_insert_self a s) + have ha0 : 0 ≤ ((x - pathX m a) / 2) ^ 2 := sq_nonneg _ + have hs1 : ∏ k ∈ s, ((x - pathX m k) / 2) ^ 2 ≤ 1 := + ih (fun k hk => hs k (Finset.mem_insert_of_mem hk)) + have hs0 : 0 ≤ ∏ k ∈ s, ((x - pathX m k) / 2) ^ 2 := + Finset.prod_nonneg fun _ _ => sq_nonneg _ + nlinarith + +theorem pathPoly_eq_zero_iff (m : ℕ) (x : ℝ) : + pathPoly m x = 0 ↔ ∃ k < m, x = pathX m k := by + simp only [pathPoly, Finset.prod_eq_zero_iff, Finset.mem_range, sq_eq_zero_iff, + div_eq_zero_iff, OfNat.ofNat_ne_zero, or_false, sub_eq_zero] + +theorem pathPoly_mul_sqrt_eq_zero_iff {m : ℕ} (hm : 2 ≤ m) {x : ℝ} (hx : x ∈ Icc (-1 : ℝ) 1) : + pathPoly m x * Real.sqrt (1 - x ^ 2) = 0 ↔ ∃ k < m, x = pathX m k := by + rw [mul_eq_zero, pathPoly_eq_zero_iff] + refine ⟨fun h => ?_, fun h => Or.inl h⟩ + rcases h with h | hsqrt + · exact h + · have hnonneg : 0 ≤ 1 - x ^ 2 := by nlinarith [hx.1, hx.2] + have h1 : 1 - x ^ 2 = 0 := (Real.sqrt_eq_zero hnonneg).mp hsqrt + have hx_eq : x = -1 ∨ x = 1 := by + have : (x + 1) * (x - 1) = 0 := by linarith + rcases mul_eq_zero.mp this with h2 | h2 + · exact Or.inl (by linarith) + · exact Or.inr (by linarith) + rcases hx_eq with rfl | rfl + · exact ⟨0, by omega, (pathX_zero m).symm⟩ + · exact ⟨m - 1, by omega, (pathX_pred hm).symm⟩ + +/-- Upper pinched half-disc map `F⁺`. -/ +def upperDiscMap (m : ℕ) (z : ℂ) : ℂ := + (z.re : ℂ) + + (((z.im + Real.sqrt (1 - z.re ^ 2)) / 2 + + pathPoly m z.re * (Real.sqrt (1 - z.re ^ 2) - z.im) / 4 : ℝ) : ℂ) * Complex.I + +/-- Lower pinched half-disc map `F⁻`. -/ +def lowerDiscMap (m : ℕ) (z : ℂ) : ℂ := + (z.re : ℂ) + + (((z.im - Real.sqrt (1 - z.re ^ 2)) / 2 - + pathPoly m z.re * (Real.sqrt (1 - z.re ^ 2) + z.im) / 4 : ℝ) : ℂ) * Complex.I + +@[simp] +theorem upperDiscMap_re (m : ℕ) (z : ℂ) : (upperDiscMap m z).re = z.re := by + simp [upperDiscMap] + +@[simp] +theorem upperDiscMap_im (m : ℕ) (z : ℂ) : + (upperDiscMap m z).im = + (z.im + Real.sqrt (1 - z.re ^ 2)) / 2 + + pathPoly m z.re * (Real.sqrt (1 - z.re ^ 2) - z.im) / 4 := by + simp [upperDiscMap] + +@[simp] +theorem lowerDiscMap_re (m : ℕ) (z : ℂ) : (lowerDiscMap m z).re = z.re := by + simp [lowerDiscMap] + +@[simp] +theorem lowerDiscMap_im (m : ℕ) (z : ℂ) : + (lowerDiscMap m z).im = + (z.im - Real.sqrt (1 - z.re ^ 2)) / 2 - + pathPoly m z.re * (Real.sqrt (1 - z.re ^ 2) + z.im) / 4 := by + simp [lowerDiscMap] + +theorem continuous_upperDiscMap (m : ℕ) : Continuous (upperDiscMap m) := by + have h1 : Continuous (pathPoly m) := continuous_pathPoly m + unfold upperDiscMap + fun_prop + +theorem continuous_lowerDiscMap (m : ℕ) : Continuous (lowerDiscMap m) := by + have h1 : Continuous (pathPoly m) := continuous_pathPoly m + unfold lowerDiscMap + fun_prop + +theorem mem_closedBall_unit_iff {z : ℂ} : + z ∈ Metric.closedBall (0 : ℂ) 1 ↔ + z.re ∈ Icc (-1 : ℝ) 1 ∧ + -Real.sqrt (1 - z.re ^ 2) ≤ z.im ∧ z.im ≤ Real.sqrt (1 - z.re ^ 2) := by + rw [Metric.mem_closedBall, dist_zero_right, ← sq_le_one_iff₀ (norm_nonneg z), + ← Complex.normSq_eq_norm_sq, Complex.normSq_apply] + constructor + · intro h + have hre : z.re ^ 2 ≤ 1 := by nlinarith [sq_nonneg z.im] + have him : z.im ^ 2 ≤ 1 - z.re ^ 2 := by linarith + have hx : z.re ∈ Icc (-1 : ℝ) 1 := ⟨by nlinarith, by nlinarith⟩ + have hsqrt : |z.im| ≤ Real.sqrt (1 - z.re ^ 2) := by + rw [← Real.sqrt_sq_eq_abs] + exact Real.sqrt_le_sqrt him + exact ⟨hx, (abs_le.mp hsqrt).1, (abs_le.mp hsqrt).2⟩ + · rintro ⟨hx, h1, h2⟩ + have hnonneg : 0 ≤ 1 - z.re ^ 2 := by nlinarith [hx.1, hx.2] + have habs : |z.im| ≤ Real.sqrt (1 - z.re ^ 2) := abs_le.mpr ⟨h1, h2⟩ + have hsq : z.im ^ 2 ≤ 1 - z.re ^ 2 := by + calc z.im ^ 2 = |z.im| ^ 2 := (sq_abs z.im).symm + _ ≤ (Real.sqrt (1 - z.re ^ 2)) ^ 2 := sq_le_sq.mpr (by rwa [abs_abs, abs_of_nonneg + (Real.sqrt_nonneg _)]) + _ = 1 - z.re ^ 2 := Real.sq_sqrt hnonneg + linarith + +theorem mem_sphere_unit_iff {z : ℂ} : + z ∈ Metric.sphere (0 : ℂ) 1 ↔ + z.re ∈ Icc (-1 : ℝ) 1 ∧ + (z.im = Real.sqrt (1 - z.re ^ 2) ∨ z.im = -Real.sqrt (1 - z.re ^ 2)) := by + rw [Metric.mem_sphere, dist_zero_right] + have hnorm_iff : ‖z‖ = 1 ↔ Complex.normSq z = 1 := by + rw [Complex.normSq_eq_norm_sq] + exact ⟨fun h => by rw [h, one_pow], fun h => by nlinarith [norm_nonneg z]⟩ + rw [hnorm_iff, Complex.normSq_apply] + constructor + · intro h + have hre : z.re ^ 2 ≤ 1 := by nlinarith [sq_nonneg z.im] + have hx : z.re ∈ Icc (-1 : ℝ) 1 := ⟨by nlinarith, by nlinarith⟩ + have hnonneg : 0 ≤ 1 - z.re ^ 2 := by nlinarith + have him : z.im ^ 2 = (Real.sqrt (1 - z.re ^ 2)) ^ 2 := by + rw [Real.sq_sqrt hnonneg] + linarith + exact ⟨hx, sq_eq_sq_iff_eq_or_eq_neg.mp him⟩ + · rintro ⟨hx, him | him⟩ + · have hnonneg : 0 ≤ 1 - z.re ^ 2 := by nlinarith [hx.1, hx.2] + have hsq : z.im ^ 2 = 1 - z.re ^ 2 := by rw [him, Real.sq_sqrt hnonneg] + linarith + · have hnonneg : 0 ≤ 1 - z.re ^ 2 := by nlinarith [hx.1, hx.2] + have hsq : z.im ^ 2 = 1 - z.re ^ 2 := by rw [him, neg_sq, Real.sq_sqrt hnonneg] + linarith + +theorem injOn_upperDiscMap {m : ℕ} (hm : 2 ≤ m) : + InjOn (upperDiscMap m) (Metric.closedBall (0 : ℂ) 1) := by + intro z₁ hz₁ z₂ _ heq + have hre : z₁.re = z₂.re := by simpa using congrArg Complex.re heq + have him := congrArg Complex.im heq + simp only [upperDiscMap_im, hre] at him + have hx₂ : z₂.re ∈ Icc (-1 : ℝ) 1 := hre ▸ (mem_closedBall_unit_iff.mp hz₁).1 + have hb1 : pathPoly m z₂.re ≤ 1 := pathPoly_le_one hm hx₂ + have him_eq : z₁.im = z₂.im := by nlinarith + exact Complex.ext hre him_eq + +theorem injOn_lowerDiscMap {m : ℕ} (hm : 2 ≤ m) : + InjOn (lowerDiscMap m) (Metric.closedBall (0 : ℂ) 1) := by + intro z₁ hz₁ z₂ _ heq + have hre : z₁.re = z₂.re := by simpa using congrArg Complex.re heq + have him := congrArg Complex.im heq + simp only [lowerDiscMap_im, hre] at him + have hx₂ : z₂.re ∈ Icc (-1 : ℝ) 1 := hre ▸ (mem_closedBall_unit_iff.mp hz₁).1 + have hb1 : pathPoly m z₂.re ≤ 1 := pathPoly_le_one hm hx₂ + have him_eq : z₁.im = z₂.im := by nlinarith + exact Complex.ext hre him_eq + +theorem upperDiscMap_im_ge {m : ℕ} (hm : 2 ≤ m) {z : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) 1) : + pathPoly m z.re * Real.sqrt (1 - z.re ^ 2) / 2 ≤ (upperDiscMap m z).im := by + obtain ⟨hx, h1, _⟩ := mem_closedBall_unit_iff.mp hz + have hb1 : pathPoly m z.re ≤ 1 := pathPoly_le_one hm hx + rw [upperDiscMap_im] + nlinarith + +theorem upperDiscMap_im_le {m : ℕ} (hm : 2 ≤ m) {z : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) 1) : + (upperDiscMap m z).im ≤ Real.sqrt (1 - z.re ^ 2) := by + obtain ⟨hx, _, h2⟩ := mem_closedBall_unit_iff.mp hz + have hb1 : pathPoly m z.re ≤ 1 := pathPoly_le_one hm hx + rw [upperDiscMap_im] + nlinarith + +theorem upperDiscMap_im_nonneg {m : ℕ} (hm : 2 ≤ m) {z : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) 1) : + 0 ≤ (upperDiscMap m z).im := by + have hge := upperDiscMap_im_ge hm hz + have hb0 : 0 ≤ pathPoly m z.re := pathPoly_nonneg m z.re + have hs0 : 0 ≤ Real.sqrt (1 - z.re ^ 2) := Real.sqrt_nonneg _ + nlinarith + +theorem upperDiscMap_mem_closedBall {m : ℕ} (hm : 2 ≤ m) {z : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) 1) : + upperDiscMap m z ∈ Metric.closedBall (0 : ℂ) 1 := by + rw [mem_closedBall_unit_iff, upperDiscMap_re] + refine ⟨(mem_closedBall_unit_iff.mp hz).1, ?_, upperDiscMap_im_le hm hz⟩ + have h0 := upperDiscMap_im_nonneg hm hz + have hs0 : 0 ≤ Real.sqrt (1 - z.re ^ 2) := Real.sqrt_nonneg _ + linarith + +theorem upperDiscMap_eq_self_of_mem_sphere {m : ℕ} {z : ℂ} + (hz : z ∈ Metric.sphere (0 : ℂ) 1) (him : 0 ≤ z.im) : + upperDiscMap m z = z := by + obtain ⟨_, h_eq | h_eq⟩ := mem_sphere_unit_iff.mp hz + · apply Complex.ext (upperDiscMap_re m z) + rw [upperDiscMap_im, h_eq] + ring + · have hs0 : 0 ≤ Real.sqrt (1 - z.re ^ 2) := Real.sqrt_nonneg _ + have h_zero : z.im = 0 := by linarith + have hs_zero : Real.sqrt (1 - z.re ^ 2) = 0 := by linarith + apply Complex.ext (upperDiscMap_re m z) + rw [upperDiscMap_im, h_zero, hs_zero] + ring + +theorem upperDiscMap_mem_sphere_iff {m : ℕ} (hm : 2 ≤ m) {z : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) 1) : + upperDiscMap m z ∈ Metric.sphere (0 : ℂ) 1 ↔ + z ∈ Metric.sphere (0 : ℂ) 1 ∧ 0 ≤ z.im := by + constructor + · intro h_sph + obtain ⟨hx, h1, h2⟩ := mem_closedBall_unit_iff.mp hz + have hb1 : pathPoly m z.re ≤ 1 := pathPoly_le_one hm hx + have h_im_nonneg : 0 ≤ (upperDiscMap m z).im := upperDiscMap_im_nonneg hm hz + obtain ⟨_, h_up | h_low⟩ := mem_sphere_unit_iff.mp h_sph + · rw [upperDiscMap_re, upperDiscMap_im] at h_up + have him_eq : z.im = Real.sqrt (1 - z.re ^ 2) := by nlinarith + exact ⟨mem_sphere_unit_iff.mpr ⟨hx, Or.inl him_eq⟩, + him_eq.symm ▸ Real.sqrt_nonneg _⟩ + · rw [upperDiscMap_re] at h_low + have hs0 : 0 ≤ Real.sqrt (1 - z.re ^ 2) := Real.sqrt_nonneg _ + have hs_zero : Real.sqrt (1 - z.re ^ 2) = 0 := by linarith + have him_eq : z.im = Real.sqrt (1 - z.re ^ 2) := by linarith + exact ⟨mem_sphere_unit_iff.mpr ⟨hx, Or.inl him_eq⟩, by linarith⟩ + · rintro ⟨h_sph, him⟩ + rwa [upperDiscMap_eq_self_of_mem_sphere h_sph him] + +theorem upperDiscMap_pathX (m : ℕ) {k : ℕ} (hk : k < m) : + upperDiscMap m ((pathX m k : ℂ) - (Real.sqrt (1 - (pathX m k) ^ 2) : ℂ) * Complex.I) = + (pathX m k : ℂ) := by + have hb : pathPoly m (pathX m k) = 0 := + (pathPoly_eq_zero_iff m (pathX m k)).mpr ⟨k, hk, rfl⟩ + apply Complex.ext + · simp [upperDiscMap] + · simp [upperDiscMap, hb] + +theorem lowerDiscMap_im_le {m : ℕ} (hm : 2 ≤ m) {z : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) 1) : + (lowerDiscMap m z).im ≤ -(pathPoly m z.re * Real.sqrt (1 - z.re ^ 2) / 2) := by + obtain ⟨hx, _, h2⟩ := mem_closedBall_unit_iff.mp hz + have hb1 : pathPoly m z.re ≤ 1 := pathPoly_le_one hm hx + rw [lowerDiscMap_im] + nlinarith + +theorem lowerDiscMap_im_ge {m : ℕ} (hm : 2 ≤ m) {z : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) 1) : + -Real.sqrt (1 - z.re ^ 2) ≤ (lowerDiscMap m z).im := by + obtain ⟨hx, h1, _⟩ := mem_closedBall_unit_iff.mp hz + have hb1 : pathPoly m z.re ≤ 1 := pathPoly_le_one hm hx + rw [lowerDiscMap_im] + nlinarith + +theorem lowerDiscMap_im_nonpos {m : ℕ} (hm : 2 ≤ m) {z : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) 1) : + (lowerDiscMap m z).im ≤ 0 := by + have hle := lowerDiscMap_im_le hm hz + have hb0 : 0 ≤ pathPoly m z.re := pathPoly_nonneg m z.re + have hs0 : 0 ≤ Real.sqrt (1 - z.re ^ 2) := Real.sqrt_nonneg _ + nlinarith + +theorem lowerDiscMap_mem_closedBall {m : ℕ} (hm : 2 ≤ m) {z : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) 1) : + lowerDiscMap m z ∈ Metric.closedBall (0 : ℂ) 1 := by + rw [mem_closedBall_unit_iff, lowerDiscMap_re] + refine ⟨(mem_closedBall_unit_iff.mp hz).1, lowerDiscMap_im_ge hm hz, ?_⟩ + have h0 := lowerDiscMap_im_nonpos hm hz + have hs0 : 0 ≤ Real.sqrt (1 - z.re ^ 2) := Real.sqrt_nonneg _ + linarith + +theorem lowerDiscMap_eq_self_of_mem_sphere {m : ℕ} {z : ℂ} + (hz : z ∈ Metric.sphere (0 : ℂ) 1) (him : z.im ≤ 0) : + lowerDiscMap m z = z := by + obtain ⟨_, h_eq | h_eq⟩ := mem_sphere_unit_iff.mp hz + · have hs0 : 0 ≤ Real.sqrt (1 - z.re ^ 2) := Real.sqrt_nonneg _ + have h_zero : z.im = 0 := by linarith + have hs_zero : Real.sqrt (1 - z.re ^ 2) = 0 := by linarith + apply Complex.ext (lowerDiscMap_re m z) + rw [lowerDiscMap_im, h_zero, hs_zero] + ring + · apply Complex.ext (lowerDiscMap_re m z) + rw [lowerDiscMap_im, h_eq] + ring + +theorem lowerDiscMap_mem_sphere_iff {m : ℕ} (hm : 2 ≤ m) {z : ℂ} + (hz : z ∈ Metric.closedBall (0 : ℂ) 1) : + lowerDiscMap m z ∈ Metric.sphere (0 : ℂ) 1 ↔ + z ∈ Metric.sphere (0 : ℂ) 1 ∧ z.im ≤ 0 := by + constructor + · intro h_sph + obtain ⟨hx, h1, h2⟩ := mem_closedBall_unit_iff.mp hz + have hb1 : pathPoly m z.re ≤ 1 := pathPoly_le_one hm hx + have h_im_nonpos : (lowerDiscMap m z).im ≤ 0 := lowerDiscMap_im_nonpos hm hz + obtain ⟨_, h_up | h_low⟩ := mem_sphere_unit_iff.mp h_sph + · rw [lowerDiscMap_re] at h_up + have hs0 : 0 ≤ Real.sqrt (1 - z.re ^ 2) := Real.sqrt_nonneg _ + have hs_zero : Real.sqrt (1 - z.re ^ 2) = 0 := by linarith + have him_eq : z.im = -Real.sqrt (1 - z.re ^ 2) := by linarith + exact ⟨mem_sphere_unit_iff.mpr ⟨hx, Or.inr him_eq⟩, by linarith⟩ + · rw [lowerDiscMap_re, lowerDiscMap_im] at h_low + have him_eq : z.im = -Real.sqrt (1 - z.re ^ 2) := by nlinarith + exact ⟨mem_sphere_unit_iff.mpr ⟨hx, Or.inr him_eq⟩, + by linarith [Real.sqrt_nonneg (1 - z.re ^ 2)]⟩ + · rintro ⟨h_sph, him⟩ + rwa [lowerDiscMap_eq_self_of_mem_sphere h_sph him] + +theorem lowerDiscMap_pathX (m : ℕ) {k : ℕ} (hk : k < m) : + lowerDiscMap m ((pathX m k : ℂ) + (Real.sqrt (1 - (pathX m k) ^ 2) : ℂ) * Complex.I) = + (pathX m k : ℂ) := by + have hb : pathPoly m (pathX m k) = 0 := + (pathPoly_eq_zero_iff m (pathX m k)).mpr ⟨k, hk, rfl⟩ + apply Complex.ext + · simp [lowerDiscMap] + · simp [lowerDiscMap, hb] + +theorem upperDiscMap_inter_lowerDiscMap {m : ℕ} (hm : 2 ≤ m) : + (upperDiscMap m '' Metric.closedBall (0 : ℂ) 1) ∩ + (lowerDiscMap m '' Metric.closedBall (0 : ℂ) 1) ⊆ + {w : ℂ | ∃ k < m, w = (pathX m k : ℂ)} := by + rintro w ⟨⟨z₁, hz₁, rfl⟩, ⟨z₂, hz₂, h₂⟩⟩ + have hge := upperDiscMap_im_ge hm hz₁ + have hle := lowerDiscMap_im_le hm hz₂ + have hre : z₂.re = z₁.re := by + have := congrArg Complex.re h₂ + simpa using this + have him : (lowerDiscMap m z₂).im = (upperDiscMap m z₁).im := congrArg Complex.im h₂ + rw [hre, him] at hle + have hmul_nonneg : 0 ≤ pathPoly m z₁.re * Real.sqrt (1 - z₁.re ^ 2) := + mul_nonneg (pathPoly_nonneg m z₁.re) (Real.sqrt_nonneg _) + have hmul_zero : pathPoly m z₁.re * Real.sqrt (1 - z₁.re ^ 2) = 0 := by linarith + have him_zero : (upperDiscMap m z₁).im = 0 := by linarith + have hx₁ : z₁.re ∈ Icc (-1 : ℝ) 1 := (mem_closedBall_unit_iff.mp hz₁).1 + obtain ⟨k, hk, hxk⟩ := (pathPoly_mul_sqrt_eq_zero_iff hm hx₁).mp hmul_zero + refine ⟨k, hk, Complex.ext ?_ ?_⟩ + · simp [hxk] + · simpa using him_zero + +/-- Curve for a lens arc connecting `(pathX m k, 0)` and `(pathX m (k + 1), 0)` +with vertical scale `c`. -/ +def lensCurve (m k : ℕ) (c : ℝ) (t : ℝ) : ℂ := + let x := (1 - t) * pathX m k + t * pathX m (k + 1) + (x : ℂ) + ((c * pathPoly m x * Real.sqrt (1 - x ^ 2) : ℝ) : ℂ) * Complex.I + +/-- Lens arc connecting `(pathX m k, 0)` and `(pathX m (k + 1), 0)`. -/ +def lensArc (m k : ℕ) (c : ℝ) : Set ℂ := + lensCurve m k c '' Icc 0 1 + +@[simp] +theorem lensCurve_re (m k : ℕ) (c t : ℝ) : + (lensCurve m k c t).re = (1 - t) * pathX m k + t * pathX m (k + 1) := by + simp [lensCurve] + +@[simp] +theorem lensCurve_im (m k : ℕ) (c t : ℝ) : + (lensCurve m k c t).im = + let x := (1 - t) * pathX m k + t * pathX m (k + 1) + c * pathPoly m x * Real.sqrt (1 - x ^ 2) := by + simp [lensCurve] + +theorem lensCurve_zero (m : ℕ) {k : ℕ} (hk : k < m) (c : ℝ) : + lensCurve m k c 0 = (pathX m k : ℂ) := by + have hb : pathPoly m (pathX m k) = 0 := + (pathPoly_eq_zero_iff m (pathX m k)).mpr ⟨k, hk, rfl⟩ + apply Complex.ext <;> simp [lensCurve, hb] + +theorem lensCurve_one (m : ℕ) {k : ℕ} (hk : k + 1 < m) (c : ℝ) : + lensCurve m k c 1 = (pathX m (k + 1) : ℂ) := by + have hb : pathPoly m (pathX m (k + 1)) = 0 := + (pathPoly_eq_zero_iff m (pathX m (k + 1))).mpr ⟨k + 1, hk, rfl⟩ + apply Complex.ext <;> simp [lensCurve, hb] + +theorem isLineWithEnds_lensArc {m k : ℕ} (hm : 2 ≤ m) (hk : k + 1 < m) (c : ℝ) : + IsLineWithEnds (lensArc m k c) (pathX m k : ℂ) (pathX m (k + 1) : ℂ) := by + have hcont : Continuous (lensCurve m k c) := by + have := continuous_pathPoly m + unfold lensCurve + fun_prop + have hinj : InjOn (lensCurve m k c) (Icc 0 1) := by + intro t₁ _ t₂ _ heq + have hre := congrArg Complex.re heq + simp only [lensCurve_re] at hre + have hlt : pathX m k < pathX m (k + 1) := pathX_strictMono hm (Nat.lt_succ_self k) + nlinarith + have hL := GraphMinor.GM11.isLine_of_injOn hcont zero_lt_one hinj + rwa [lensCurve_zero m (Nat.lt_of_succ_lt hk) c, lensCurve_one m hk c] at hL + +theorem mem_lensArc_props {m k : ℕ} (hm : 2 ≤ m) (hk : k + 1 < m) {c : ℝ} {w : ℂ} + (hw : w ∈ lensArc m k c) : + w.re ∈ Icc (pathX m k) (pathX m (k + 1)) ∧ + w.re ∈ Icc (-1 : ℝ) 1 ∧ + w.im = c * pathPoly m w.re * Real.sqrt (1 - w.re ^ 2) := by + rcases hw with ⟨t, ⟨ht0, ht1⟩, rfl⟩ + have hlt : pathX m k < pathX m (k + 1) := pathX_strictMono hm (Nat.lt_succ_self k) + have hxk := pathX_mem_Icc hm (Nat.lt_of_succ_lt hk) + have hxk1 := pathX_mem_Icc hm hk + have hre_k : pathX m k ≤ (lensCurve m k c t).re := by + rw [lensCurve_re]; nlinarith + have hre_k1 : (lensCurve m k c t).re ≤ pathX m (k + 1) := by + rw [lensCurve_re]; nlinarith + refine ⟨⟨hre_k, hre_k1⟩, ⟨by linarith [hxk.1], by linarith [hxk1.2]⟩, ?_⟩ + simp + +theorem eq_end_of_mem_lensArc_of_mul_eq_zero {m k : ℕ} (hm : 2 ≤ m) (hk : k + 1 < m) + {c : ℝ} {w : ℂ} (hw : w ∈ lensArc m k c) + (hz : pathPoly m w.re * Real.sqrt (1 - w.re ^ 2) = 0) : + w = (pathX m k : ℂ) ∨ w = (pathX m (k + 1) : ℂ) := by + obtain ⟨hre_Icc, hre_unit, him_eq⟩ := mem_lensArc_props hm hk hw + have him_zero : w.im = 0 := by linear_combination him_eq + c * hz + obtain ⟨j, hj, hxj⟩ := (pathPoly_mul_sqrt_eq_zero_iff hm hre_unit).mp hz + have hjk : j = k ∨ j = k + 1 := by + by_contra hne + push Not at hne + rcases lt_or_gt_of_ne hne.1 with hlt | hgt + · have : pathX m j < pathX m k := pathX_strictMono hm hlt + linarith [hre_Icc.1] + · have hgt' : k + 1 < j := Nat.lt_of_le_of_ne hgt hne.2.symm + have : pathX m (k + 1) < pathX m j := pathX_strictMono hm hgt' + linarith [hre_Icc.2] + rcases hjk with rfl | rfl + · left; exact Complex.ext (by simp [hxj]) (by simp [him_zero]) + · right; exact Complex.ext (by simp [hxj]) (by simp [him_zero]) + +theorem lensArc_subset_closedBall {m k : ℕ} (hm : 2 ≤ m) (hk : k + 1 < m) + {c : ℝ} (hc0 : 0 < c) (hc1 : c < 1 / 2) : + lensArc m k c ⊆ Metric.closedBall (0 : ℂ) 1 := by + intro w hw + obtain ⟨_, hre_unit, him_eq⟩ := mem_lensArc_props hm hk hw + rw [mem_closedBall_unit_iff] + have hb0 : 0 ≤ pathPoly m w.re := pathPoly_nonneg m w.re + have hb1 : pathPoly m w.re ≤ 1 := pathPoly_le_one hm hre_unit + have hs0 : 0 ≤ Real.sqrt (1 - w.re ^ 2) := Real.sqrt_nonneg _ + have him0 : 0 ≤ w.im := by rw [him_eq]; positivity + have him_le : w.im ≤ Real.sqrt (1 - w.re ^ 2) := by + have : c * pathPoly m w.re ≤ 1 := by nlinarith + rw [him_eq] + nlinarith + exact ⟨hre_unit, by linarith, him_le⟩ + +theorem lensArc_inter_sphere {m k : ℕ} (hm : 2 ≤ m) (hk : k + 1 < m) + {c : ℝ} (hc0 : 0 < c) (hc1 : c < 1 / 2) : + lensArc m k c ∩ Metric.sphere (0 : ℂ) 1 ⊆ + {(pathX m 0 : ℂ), (pathX m (m - 1) : ℂ)} := by + rintro w ⟨hw, h_sph⟩ + obtain ⟨_, hre_unit, him_eq⟩ := mem_lensArc_props hm hk hw + have hb0 : 0 ≤ pathPoly m w.re := pathPoly_nonneg m w.re + have hb1 : pathPoly m w.re ≤ 1 := pathPoly_le_one hm hre_unit + have hs0 : 0 ≤ Real.sqrt (1 - w.re ^ 2) := Real.sqrt_nonneg _ + have h_prod : c * pathPoly m w.re ≤ 1 / 2 := by nlinarith + have him_le : w.im ≤ (1 / 2) * Real.sqrt (1 - w.re ^ 2) := by + rw [him_eq]; nlinarith + have him0 : 0 ≤ w.im := by rw [him_eq]; positivity + obtain ⟨_, h_up | h_low⟩ := mem_sphere_unit_iff.mp h_sph + · have hs_zero : Real.sqrt (1 - w.re ^ 2) = 0 := by linarith + have him_zero : w.im = 0 := by linarith + have hnonneg : 0 ≤ 1 - w.re ^ 2 := by nlinarith [hre_unit.1, hre_unit.2] + have h1 : 1 - w.re ^ 2 = 0 := (Real.sqrt_eq_zero hnonneg).mp hs_zero + have hx_eq : w.re = -1 ∨ w.re = 1 := by + have : (w.re + 1) * (w.re - 1) = 0 := by linarith + rcases mul_eq_zero.mp this with h2 | h2 + · exact Or.inl (by linarith) + · exact Or.inr (by linarith) + rcases hx_eq with hre | hre + · left; exact Complex.ext (by simp [hre, pathX_zero]) (by simp [him_zero]) + · right; exact Complex.ext (by simp [hre, pathX_pred hm]) (by simp [him_zero]) + · have hs_zero : Real.sqrt (1 - w.re ^ 2) = 0 := by linarith + have him_zero : w.im = 0 := by linarith + have hnonneg : 0 ≤ 1 - w.re ^ 2 := by nlinarith [hre_unit.1, hre_unit.2] + have h1 : 1 - w.re ^ 2 = 0 := (Real.sqrt_eq_zero hnonneg).mp hs_zero + have hx_eq : w.re = -1 ∨ w.re = 1 := by + have : (w.re + 1) * (w.re - 1) = 0 := by linarith + rcases mul_eq_zero.mp this with h2 | h2 + · exact Or.inl (by linarith) + · exact Or.inr (by linarith) + rcases hx_eq with hre | hre + · left; exact Complex.ext (by simp [hre, pathX_zero]) (by simp [him_zero]) + · right; exact Complex.ext (by simp [hre, pathX_pred hm]) (by simp [him_zero]) + +theorem lensArc_inter_upperDiscMap {m k : ℕ} (hm : 2 ≤ m) (hk : k + 1 < m) + {c : ℝ} (hc1 : c < 1 / 2) : + (upperDiscMap m '' Metric.closedBall (0 : ℂ) 1) ∩ lensArc m k c ⊆ + {(pathX m k : ℂ), (pathX m (k + 1) : ℂ)} := by + rintro w ⟨⟨z, hz, hzw⟩, hw⟩ + obtain ⟨_, _, him_eq⟩ := mem_lensArc_props hm hk hw + have hre : z.re = w.re := by simpa using congrArg Complex.re hzw + have him : (upperDiscMap m z).im = w.im := congrArg Complex.im hzw + have hge := upperDiscMap_im_ge hm hz + rw [hre, him, him_eq] at hge + have hmul0 : 0 ≤ pathPoly m w.re * Real.sqrt (1 - w.re ^ 2) := + mul_nonneg (pathPoly_nonneg m w.re) (Real.sqrt_nonneg _) + have hmul_zero : pathPoly m w.re * Real.sqrt (1 - w.re ^ 2) = 0 := by nlinarith + exact eq_end_of_mem_lensArc_of_mul_eq_zero hm hk hw hmul_zero + +theorem lensArc_inter_lowerDiscMap {m k : ℕ} (hm : 2 ≤ m) (hk : k + 1 < m) + {c : ℝ} (hc0 : 0 < c) : + (lowerDiscMap m '' Metric.closedBall (0 : ℂ) 1) ∩ lensArc m k c ⊆ + {(pathX m k : ℂ), (pathX m (k + 1) : ℂ)} := by + rintro w ⟨⟨z, hz, hzw⟩, hw⟩ + obtain ⟨_, _, him_eq⟩ := mem_lensArc_props hm hk hw + have hre : z.re = w.re := by simpa using congrArg Complex.re hzw + have him : (lowerDiscMap m z).im = w.im := congrArg Complex.im hzw + have hle := lowerDiscMap_im_le hm hz + rw [hre, him, him_eq] at hle + have hmul0 : 0 ≤ pathPoly m w.re * Real.sqrt (1 - w.re ^ 2) := + mul_nonneg (pathPoly_nonneg m w.re) (Real.sqrt_nonneg _) + have hmul_zero : pathPoly m w.re * Real.sqrt (1 - w.re ^ 2) = 0 := by nlinarith + exact eq_end_of_mem_lensArc_of_mul_eq_zero hm hk hw hmul_zero + +theorem lensArc_inter_lensArc {m k₁ k₂ : ℕ} (hm : 2 ≤ m) + (hk₁ : k₁ + 1 < m) (hk₂ : k₂ + 1 < m) {c₁ c₂ : ℝ} (hne : c₁ ≠ c₂) : + lensArc m k₁ c₁ ∩ lensArc m k₂ c₂ ⊆ + {(pathX m k₂ : ℂ), (pathX m (k₂ + 1) : ℂ)} := by + rintro w ⟨hw₁, hw₂⟩ + obtain ⟨_, _, him₁⟩ := mem_lensArc_props hm hk₁ hw₁ + obtain ⟨_, _, him₂⟩ := mem_lensArc_props hm hk₂ hw₂ + have hdiff : (c₁ - c₂) * (pathPoly m w.re * Real.sqrt (1 - w.re ^ 2)) = 0 := by + linear_combination him₂ - him₁ + have hmul_zero : pathPoly m w.re * Real.sqrt (1 - w.re ^ 2) = 0 := + (mul_eq_zero.mp hdiff).resolve_left (sub_ne_zero.mpr hne) + exact eq_end_of_mem_lensArc_of_mul_eq_zero hm hk₂ hw₂ hmul_zero + +/-- Glue a finite set `E_P` of non-loop edges along lens arcs onto a base drawing `Γ_base`. -/ +theorem exists_drawing_gluing_lensArcs {G : Graph α β} {E_base E_P : Set β} {m : ℕ} + (hm : 2 ≤ m) (hE_fin : E(G).Finite) + (hE_union : E_base ∪ E_P = E(G)) (hE_disj : Disjoint E_base E_P) + {ν : α → ℂ} (hν_inj : InjOn ν V(G)) + (hEP_links : ∀ e ∈ E_P, ∃ u v : α, G.IsLink e u v ∧ + ∃ k : ℕ, k + 1 < m ∧ ν u = (pathX m k : ℂ) ∧ ν v = (pathX m (k + 1) : ℂ)) + (Γ_base : GraphDrawing (G.restrict E_base) ℂ) + (hU_base_sub : Γ_base.drawing.U ⊆ + (upperDiscMap m '' Metric.closedBall (0 : ℂ) 1) ∪ + (lowerDiscMap m '' Metric.closedBall (0 : ℂ) 1)) + (hν_base : ∀ v : V(G.restrict E_base), (Γ_base.iso.vertexEquiv v).1 = ν v.1) : + ∃ Γ : GraphDrawing G ℂ, + Γ_base.drawing.U ⊆ Γ.drawing.U ∧ + Γ.drawing.U ⊆ Γ_base.drawing.U ∪ + {w : ℂ | ∃ n : ℕ, ∃ k : ℕ, k + 1 < m ∧ + w ∈ lensArc m k (1 / (4 * ((n : ℝ) + 2)))} ∧ + ∀ v : V(G), (Γ.iso.vertexEquiv v).1 = ν v.1 := by + let c : ℕ → ℝ := fun n => 1 / (4 * ((n : ℝ) + 2)) + have hc_pos : ∀ n : ℕ, 0 < c n := fun n => by dsimp [c]; positivity + have hc_lt : ∀ n : ℕ, c n < 1 / 2 := fun n => by + dsimp [c] + have : (2 : ℝ) < 4 * ((n : ℝ) + 2) := by linarith + exact one_div_lt_one_div_of_lt (by norm_num) this + have hc_inj : ∀ n₁ n₂ : ℕ, n₁ ≠ n₂ → c n₁ ≠ c n₂ := fun n₁ n₂ hne heq => by + dsimp [c] at heq + have h1 : (0 : ℝ) < 4 * ((n₁ : ℝ) + 2) := by positivity + have h2 : (0 : ℝ) < 4 * ((n₂ : ℝ) + 2) := by positivity + have hmul : 1 * (4 * ((n₂ : ℝ) + 2)) = 1 * (4 * ((n₁ : ℝ) + 2)) := + (div_eq_div_iff h1.ne' h2.ne').mp heq + have hcast : (n₂ : ℝ) = (n₁ : ℝ) := by linarith + exact hne (Nat.cast_injective hcast.symm) + suffices ∀ (n : ℕ) (F : Set β), F ⊆ E_P → F.ncard = n → + ∃ Γ : GraphDrawing (G.restrict (E_base ∪ F)) ℂ, + Γ_base.drawing.U ⊆ Γ.drawing.U ∧ + Γ.drawing.U ⊆ Γ_base.drawing.U ∪ + {w : ℂ | ∃ j < n, ∃ k : ℕ, k + 1 < m ∧ w ∈ lensArc m k (c j)} ∧ + ∀ v : V(G.restrict (E_base ∪ F)), (Γ.iso.vertexEquiv v).1 = ν v.1 by + obtain ⟨Γ₀, hU₁, hU₂, hν₀⟩ := this E_P.ncard E_P Subset.rfl rfl + have hG_eq : G.restrict (E_base ∪ E_P) = G := by + rw [hE_union] + refine le_antisymm restrict_le ⟨by simp, fun {_ _ _} hl => ⟨hl.edge_mem, hl⟩⟩ + obtain ⟨Γ, hD_eq, hν⟩ := GraphDrawing.of_eq hG_eq Γ₀ hν₀ + refine ⟨Γ, hD_eq.symm ▸ hU₁, ?_, hν⟩ + rw [hD_eq] + refine Subset.trans hU₂ (union_subset subset_union_left ?_) + rintro w ⟨j, _, k, hk, hw⟩ + exact Or.inr ⟨j, k, hk, hw⟩ + intro n + induction n with + | zero => + intro F hF hn + have hF_fin : F.Finite := hE_fin.subset (Subset.trans hF (hE_union ▸ subset_union_right)) + have hF_empty : F = ∅ := (ncard_eq_zero hF_fin).mp hn + have hG_eq : G.restrict E_base = G.restrict (E_base ∪ F) := by simp [hF_empty] + obtain ⟨Γ, hD_eq, hν⟩ := GraphDrawing.of_eq hG_eq Γ_base hν_base + refine ⟨Γ, hD_eq.symm ▸ Subset.rfl, ?_, hν⟩ + rw [hD_eq] + exact subset_union_left + | succ n ih => + intro F hF hn + have hF_fin : F.Finite := hE_fin.subset (Subset.trans hF (hE_union ▸ subset_union_right)) + have hF_ne : F.Nonempty := (ncard_pos hF_fin).mp (by omega) + obtain ⟨e₀, he₀F⟩ := hF_ne + let F' := F \ {e₀} + have hF'_sub : F' ⊆ E_P := Subset.trans sdiff_subset hF + have hF'_card : F'.ncard = n := by + change (F \ {e₀}).ncard = n + rw [ncard_sdiff_singleton_of_mem he₀F, hn] + omega + obtain ⟨Γ₁, hU₁_sub₁, hU₁_sub₂, hν₁⟩ := ih F' hF'_sub hF'_card + have he₀_EP : e₀ ∈ E_P := hF he₀F + have he₀E : e₀ ∈ E(G) := hE_union ▸ Or.inr he₀_EP + obtain ⟨u, v, hlink, k, hk_lt, hu_eq, hv_eq⟩ := hEP_links e₀ he₀_EP + have huV : u ∈ V(G) := hlink.left_mem + have hvV : v ∈ V(G) := hlink.right_mem + have hν_ne : ν u ≠ ν v := by + have hlt : pathX m k < pathX m (k + 1) := pathX_strictMono hm (Nat.lt_succ_self k) + intro heq + rw [hu_eq, hv_eq] at heq + have := congrArg Complex.re heq + simp only [Complex.ofReal_re] at this + linarith + let K := lensArc m k (c n) + have hK_line : IsLineWithEnds K (ν u) (ν v) := by + rw [hu_eq, hv_eq] + exact isLineWithEnds_lensArc hm hk_lt (c n) + let H₂ : Graph α β := (G.induce {u, v}).restrict {e₀} + have hV₂ : V(H₂) = {u, v} := rfl + have hE₂ : E(H₂) = {e₀} := by + ext e + simp only [H₂, edgeSet_restrict, mem_inter_iff, mem_singleton_iff, edgeSet_induce, + mem_ofPred_eq] + refine ⟨fun h => h.2, fun h => ?_⟩ + subst h + exact ⟨⟨u, v, hlink, Or.inl rfl, Or.inr rfl⟩, rfl⟩ + have hlink₂ : H₂.IsLink e₀ u v := ⟨rfl, hlink, Or.inl rfl, Or.inr rfl⟩ + obtain ⟨Γ₂, hU₂, hν₂⟩ := GraphDrawing.of_single_edge hV₂ hE₂ hlink₂ hν_ne hK_line + have hG₁_le : G.restrict (E_base ∪ F') ≤ G.restrict (E_base ∪ F) := + ⟨by simp, fun {_ _ _} hl => ⟨hl.1.elim Or.inl (fun h => Or.inr (sdiff_subset h)), hl.2⟩⟩ + have hH₂_le : H₂ ≤ G.restrict (E_base ∪ F) := + ⟨by rw [hV₂, vertexSet_restrict]; rintro w (rfl | rfl) <;> assumption, + fun {_ _ _} hl => ⟨Or.inr (hl.1 ▸ he₀F), hl.2.1⟩⟩ + have hV_union : V(G.restrict (E_base ∪ F')) ∪ V(H₂) = V(G.restrict (E_base ∪ F)) := by + rw [hV₂, vertexSet_restrict, vertexSet_restrict, union_eq_self_of_subset_right] + rintro w (rfl | rfl) <;> assumption + have hE_union' : E(G.restrict (E_base ∪ F')) ∪ E(H₂) = E(G.restrict (E_base ∪ F)) := by + rw [hE₂, edgeSet_restrict, edgeSet_restrict] + ext e + simp only [mem_union, mem_inter_iff, mem_sdiff, mem_singleton_iff, F'] + constructor + · rintro (⟨heG, heB | ⟨heF, _⟩⟩ | rfl) + · exact ⟨heG, Or.inl heB⟩ + · exact ⟨heG, Or.inr heF⟩ + · exact ⟨he₀E, Or.inr he₀F⟩ + · rintro ⟨heG, heB | heF⟩ + · exact Or.inl ⟨heG, Or.inl heB⟩ + · by_cases he : e = e₀ + · exact Or.inr he + · exact Or.inl ⟨heG, Or.inr ⟨heF, he⟩⟩ + have hE_disj' : Disjoint E(G.restrict (E_base ∪ F')) E(H₂) := by + rw [hE₂, edgeSet_restrict, disjoint_singleton_right] + rintro ⟨_, heB | ⟨_, he_ne⟩⟩ + · exact disjoint_left.mp hE_disj heB he₀_EP + · exact he_ne rfl + have h_pair_eq : ({(pathX m k : ℂ), (pathX m (k + 1) : ℂ)} : Set ℂ) = {ν u, ν v} := by + rw [hu_eq, hv_eq] + have hU_inter : Γ₁.drawing.U ∩ Γ₂.drawing.U ⊆ + ν '' (V(G.restrict (E_base ∪ F')) ∩ V(H₂)) := by + have hV_inter : V(G.restrict (E_base ∪ F')) ∩ V(H₂) = {u, v} := by + rw [hV₂, vertexSet_restrict, inter_eq_right] + rintro w (rfl | rfl) <;> assumption + rw [hV_inter, image_pair, hU₂, ← h_pair_eq] + rintro w ⟨hw₁, hw₂⟩ + rcases hU₁_sub₂ hw₁ with hw_base | ⟨j, hj_lt, k', hk'_lt, hw_j⟩ + · rcases hU_base_sub hw_base with hw_up | hw_low + · exact lensArc_inter_upperDiscMap hm hk_lt (hc_lt n) ⟨hw_up, hw₂⟩ + · exact lensArc_inter_lowerDiscMap hm hk_lt (hc_pos n) ⟨hw_low, hw₂⟩ + · exact lensArc_inter_lensArc hm hk'_lt hk_lt (hc_inj j n (Nat.ne_of_lt hj_lt)) ⟨hw_j, hw₂⟩ + obtain ⟨Γ, hU_eq, hν_eq⟩ := GraphDrawing.glue hG₁_le hH₂_le hV_union hE_union' hE_disj' + (by rwa [vertexSet_restrict]) Γ₁ Γ₂ hν₁ hν₂ hU_inter + refine ⟨Γ, Subset.trans hU₁_sub₁ (hU_eq ▸ subset_union_left), ?_, hν_eq⟩ + rw [hU_eq, hU₂] + refine union_subset ?_ ?_ + · refine Subset.trans hU₁_sub₂ (union_subset subset_union_left ?_) + rintro w ⟨j, hj, k', hk', hw⟩ + exact Or.inr ⟨j, Nat.lt_succ_of_lt hj, k', hk', hw⟩ + · intro w hwK + exact Or.inr ⟨n, Nat.lt_succ_self n, k, hk_lt, hwK⟩ + +/-- Angular coordinate used by `discAngleMap` on `ℂ`. -/ +def discAngleTheta (θ_s θ_t : ℝ) (z : ℂ) : ℝ := + if 0 ≤ z.im then + θ_s + (θ_t - θ_s) * (Real.arccos (z.re / ‖z‖) / Real.pi) + else + θ_t + (θ_s + 2 * Real.pi - θ_t) * ((Real.pi - Real.arccos (z.re / ‖z‖)) / Real.pi) + +/-- Radial-angular homeomorphism of `ℂ` preserving norms and aligning the upper and lower +semicircles of `sphere (0 : ℂ) 1` with `[θ_s, θ_t]` and `[θ_t, θ_s + 2π]`. -/ +def discAngleMap (θ_s θ_t : ℝ) (z : ℂ) : ℂ := + (‖z‖ : ℂ) * (Circle.exp (discAngleTheta θ_s θ_t z) : ℂ) + +@[simp] +theorem norm_discAngleMap (θ_s θ_t : ℝ) (z : ℂ) : + ‖discAngleMap θ_s θ_t z‖ = ‖z‖ := by + simp [discAngleMap] + +@[simp] +theorem discAngleMap_zero (θ_s θ_t : ℝ) : + discAngleMap θ_s θ_t 0 = 0 := by + simp [discAngleMap] + +theorem discAngleMap_mem_closedBall_iff (θ_s θ_t : ℝ) (z : ℂ) : + discAngleMap θ_s θ_t z ∈ Metric.closedBall (0 : ℂ) 1 ↔ + z ∈ Metric.closedBall (0 : ℂ) 1 := by + simp [Metric.mem_closedBall, dist_zero_right] + +theorem discAngleMap_mem_sphere_iff (θ_s θ_t : ℝ) (z : ℂ) : + discAngleMap θ_s θ_t z ∈ Metric.sphere (0 : ℂ) 1 ↔ + z ∈ Metric.sphere (0 : ℂ) 1 := by + simp + +private theorem continuous_norm_mul_circle_exp {ψ : ℂ → ℝ} + (hψ : ∀ z : ℂ, z ≠ 0 → ContinuousAt ψ z) : + Continuous (fun z : ℂ => (‖z‖ : ℂ) * (Circle.exp (ψ z) : ℂ)) := by + rw [continuous_iff_continuousAt] + intro z + by_cases hz : z = 0 + · subst hz + rw [Metric.continuousAt_iff] + intro ε hε + refine ⟨ε, hε, fun {w} hw => ?_⟩ + simpa [dist_zero_right] using hw + · have h1 : ContinuousAt (fun w : ℂ => (‖w‖ : ℂ)) z := by fun_prop + have h_exp : Continuous (fun t : ℝ => (Circle.exp t : ℂ)) := by fun_prop + have h2 : ContinuousAt (fun w : ℂ => (Circle.exp (ψ w) : ℂ)) z := + h_exp.continuousAt.comp (hψ z hz) + exact h1.mul h2 + +theorem continuous_discAngleMap (θ_s θ_t : ℝ) : + Continuous (discAngleMap θ_s θ_t) := by + let φ₁ : ℂ → ℂ := fun z => + (‖z‖ : ℂ) * (Circle.exp (θ_s + (θ_t - θ_s) * (Real.arccos (z.re / ‖z‖) / Real.pi)) : ℂ) + let φ₂ : ℂ → ℂ := fun z => + (‖z‖ : ℂ) * (Circle.exp (θ_t + (θ_s + 2 * Real.pi - θ_t) * + ((Real.pi - Real.arccos (z.re / ‖z‖)) / Real.pi)) : ℂ) + have hφ₁ : Continuous φ₁ := continuous_norm_mul_circle_exp fun z hz => by + have : ‖z‖ ≠ 0 := norm_ne_zero_iff.mpr hz + fun_prop (disch := assumption) + have hφ₂ : Continuous φ₂ := continuous_norm_mul_circle_exp fun z hz => by + have : ‖z‖ ≠ 0 := norm_ne_zero_iff.mpr hz + fun_prop (disch := assumption) + have heq : discAngleMap θ_s θ_t = fun z : ℂ => if 0 ≤ z.im then φ₁ z else φ₂ z := by + ext z + dsimp [discAngleMap, discAngleTheta, φ₁, φ₂] + split_ifs <;> rfl + rw [heq] + refine Continuous.if_le hφ₁ hφ₂ continuous_const Complex.continuous_im fun z hz => ?_ + by_cases hz0 : z = 0 + · simp [φ₁, φ₂, hz0] + · have hz_eq : z = (z.re : ℂ) := Complex.ext rfl hz.symm + have hre_ne : z.re ≠ 0 := fun h => hz0 (Complex.ext h hz.symm) + have hnorm : ‖z‖ = |z.re| := by + conv_lhs => rw [hz_eq] + exact Complex.norm_real z.re + have hpi : Real.pi ≠ 0 := Real.pi_ne_zero + rcases lt_or_gt_of_ne hre_ne with hneg | hpos + · have hdiv : z.re / ‖z‖ = -1 := by + rw [hnorm, abs_of_neg hneg, div_neg_self hre_ne] + have harc : Real.arccos (z.re / ‖z‖) = Real.pi := by + rw [hdiv, Real.arccos_neg_one] + change (‖z‖ : ℂ) * (Circle.exp (θ_s + (θ_t - θ_s) * (Real.arccos + (z.re / ‖z‖) / Real.pi)) : ℂ) = + (‖z‖ : ℂ) * (Circle.exp (θ_t + (θ_s + 2 * Real.pi - θ_t) * + ((Real.pi - Real.arccos (z.re / ‖z‖)) / Real.pi)) : ℂ) + rw [harc, div_self hpi, mul_one, sub_self, zero_div, mul_zero, add_zero, + add_sub_cancel] + · have hdiv : z.re / ‖z‖ = 1 := by + rw [hnorm, abs_of_pos hpos, div_self hre_ne] + have harc : Real.arccos (z.re / ‖z‖) = 0 := by + rw [hdiv, Real.arccos_one] + have h_add : θ_t + (θ_s + 2 * Real.pi - θ_t) = θ_s + 2 * Real.pi := by ring + have h_exp : Circle.exp (θ_t + (θ_s + 2 * Real.pi - θ_t)) = Circle.exp θ_s := by + rw [h_add, Circle.exp_add, Circle.exp_two_pi, mul_one] + change (‖z‖ : ℂ) * (Circle.exp (θ_s + (θ_t - θ_s) * (Real.arccos + (z.re / ‖z‖) / Real.pi)) : ℂ) = + (‖z‖ : ℂ) * (Circle.exp (θ_t + (θ_s + 2 * Real.pi - θ_t) * + ((Real.pi - Real.arccos (z.re / ‖z‖)) / Real.pi)) : ℂ) + rw [harc, zero_div, mul_zero, add_zero, sub_zero, div_self hpi, mul_one, h_exp] + +theorem circle_exp_inj_of_abs_sub_lt {a b : ℝ} + (h_lt : |a - b| < 2 * Real.pi) (heq : Circle.exp a = Circle.exp b) : + a = b := by + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp heq + have hpi : 0 < 2 * Real.pi := Real.two_pi_pos + obtain ⟨h1, h2⟩ := abs_lt.mp h_lt + have hm1 : (-1 : ℝ) < (m : ℝ) := by nlinarith + have hm2 : (m : ℝ) < 1 := by nlinarith + have hm1' : (-1 : ℤ) < m := by exact_mod_cast hm1 + have hm2' : m < (1 : ℤ) := by exact_mod_cast hm2 + have hm0 : m = 0 := by omega + simpa [hm0] using hm + +theorem re_div_norm_mem_Icc (z : ℂ) : z.re / ‖z‖ ∈ Icc (-1 : ℝ) 1 := by + by_cases hz : z = 0 + · simp [hz] + · have hpos : 0 < ‖z‖ := norm_pos_iff.mpr hz + have habs : |z.re| ≤ ‖z‖ := Complex.abs_re_le_norm z + obtain ⟨h1, h2⟩ := abs_le.mp habs + exact ⟨(le_div_iff₀ hpos).mpr (by linarith), (div_le_iff₀ hpos).mpr (by linarith)⟩ + +theorem re_div_norm_mem_Ioo_of_im_ne_zero {z : ℂ} (him : z.im ≠ 0) : + z.re / ‖z‖ ∈ Ioo (-1 : ℝ) 1 := by + have hz : z ≠ 0 := fun h => him (by simp [h]) + have hpos : 0 < ‖z‖ := norm_pos_iff.mpr hz + have him_sq : 0 < z.im ^ 2 := sq_pos_of_ne_zero him + have hnorm_sq : z.re ^ 2 + z.im ^ 2 = ‖z‖ ^ 2 := by + rw [← Complex.normSq_eq_norm_sq, Complex.normSq_apply] + ring + have hre_sq : z.re ^ 2 < ‖z‖ ^ 2 := by linarith + have habs : |z.re| < ‖z‖ := by + rw [← Real.sqrt_sq_eq_abs, ← Real.sqrt_sq hpos.le] + exact Real.sqrt_lt_sqrt (sq_nonneg _) hre_sq + obtain ⟨h1, h2⟩ := abs_lt.mp habs + exact ⟨(lt_div_iff₀ hpos).mpr (by linarith), (div_lt_iff₀ hpos).mpr (by linarith)⟩ + +theorem discAngleTheta_bounds_of_im_nonneg {θ_s θ_t : ℝ} (h_lt : θ_s < θ_t) + {z : ℂ} (him : 0 ≤ z.im) : + θ_s ≤ discAngleTheta θ_s θ_t z ∧ discAngleTheta θ_s θ_t z ≤ θ_t := by + simp only [discAngleTheta, him, ↓reduceIte] + have hpi : 0 < Real.pi := Real.pi_pos + have harc0 : 0 ≤ Real.arccos (z.re / ‖z‖) := Real.arccos_nonneg _ + have harc1 : Real.arccos (z.re / ‖z‖) ≤ Real.pi := Real.arccos_le_pi _ + have hdiv0 : 0 ≤ Real.arccos (z.re / ‖z‖) / Real.pi := div_nonneg harc0 hpi.le + have hdiv1 : Real.arccos (z.re / ‖z‖) / Real.pi ≤ 1 := (div_le_one hpi).mpr harc1 + refine ⟨by nlinarith, by nlinarith⟩ + +theorem discAngleTheta_bounds_of_im_neg {θ_s θ_t : ℝ} + (h_span : θ_t < θ_s + 2 * Real.pi) {z : ℂ} (him : z.im < 0) : + θ_t < discAngleTheta θ_s θ_t z ∧ discAngleTheta θ_s θ_t z < θ_s + 2 * Real.pi := by + have hnot : ¬ 0 ≤ z.im := not_le.mpr him + simp only [discAngleTheta, hnot, ↓reduceIte] + have hpi : 0 < Real.pi := Real.pi_pos + obtain ⟨h1, h2⟩ := re_div_norm_mem_Ioo_of_im_ne_zero him.ne + have harc0 : 0 < Real.arccos (z.re / ‖z‖) := Real.arccos_pos.mpr h2 + have harc1 : Real.arccos (z.re / ‖z‖) < Real.pi := Real.arccos_lt_pi.mpr h1 + have hdiv0 : 0 < (Real.pi - Real.arccos (z.re / ‖z‖)) / Real.pi := + div_pos (by linarith) hpi + have hdiv1 : (Real.pi - Real.arccos (z.re / ‖z‖)) / Real.pi < 1 := + (div_lt_one hpi).mpr (by linarith) + refine ⟨by nlinarith, by nlinarith⟩ + +theorem injective_discAngleMap {θ_s θ_t : ℝ} + (h_lt : θ_s < θ_t) (h_span : θ_t < θ_s + 2 * Real.pi) : + Function.Injective (discAngleMap θ_s θ_t) := by + intro z₁ z₂ heq + have hnorm : ‖z₁‖ = ‖z₂‖ := by + simpa only [norm_discAngleMap] using congrArg norm heq + by_cases hz₁ : z₁ = 0 + · subst hz₁ + have hz₂ : ‖z₂‖ = 0 := by simpa using hnorm.symm + exact (norm_eq_zero.mp hz₂).symm + · have hpos₁ : 0 < ‖z₁‖ := norm_pos_iff.mpr hz₁ + have hne_c : (‖z₁‖ : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hpos₁.ne' + have hexp_c : (Circle.exp (discAngleTheta θ_s θ_t z₁) : ℂ) = + (Circle.exp (discAngleTheta θ_s θ_t z₂) : ℂ) := by + apply mul_left_cancel₀ hne_c + calc (‖z₁‖ : ℂ) * (Circle.exp (discAngleTheta θ_s θ_t z₁) : ℂ) + _ = discAngleMap θ_s θ_t z₁ := rfl + _ = discAngleMap θ_s θ_t z₂ := heq + _ = (‖z₁‖ : ℂ) * (Circle.exp (discAngleTheta θ_s θ_t z₂) : ℂ) := by + simp [discAngleMap, hnorm] + have hexp : Circle.exp (discAngleTheta θ_s θ_t z₁) = + Circle.exp (discAngleTheta θ_s θ_t z₂) := Subtype.ext hexp_c + have h_range : ∀ z : ℂ, + θ_s ≤ discAngleTheta θ_s θ_t z ∧ discAngleTheta θ_s θ_t z < θ_s + 2 * Real.pi := by + intro z + by_cases him : 0 ≤ z.im + · obtain ⟨b1, b2⟩ := discAngleTheta_bounds_of_im_nonneg h_lt him + exact ⟨b1, by linarith⟩ + · obtain ⟨b1, b2⟩ := discAngleTheta_bounds_of_im_neg h_span (lt_of_not_ge him) + exact ⟨by linarith, b2⟩ + have hθ_eq : discAngleTheta θ_s θ_t z₁ = discAngleTheta θ_s θ_t z₂ := by + apply circle_exp_inj_of_abs_sub_lt _ hexp + obtain ⟨l1, u1⟩ := h_range z₁ + obtain ⟨l2, u2⟩ := h_range z₂ + exact abs_lt.mpr ⟨by linarith, by linarith⟩ + have hpi : 0 < Real.pi := Real.pi_pos + have harc_eq : Real.arccos (z₁.re / ‖z₁‖) = Real.arccos (z₂.re / ‖z₂‖) := by + by_cases h1 : 0 ≤ z₁.im <;> by_cases h2 : 0 ≤ z₂.im + · simp only [discAngleTheta, h1, h2, ↓reduceIte] at hθ_eq + have hdiv : Real.arccos (z₁.re / ‖z₁‖) / Real.pi = + Real.arccos (z₂.re / ‖z₂‖) / Real.pi := by nlinarith + exact (div_left_inj₀ hpi.ne').mp hdiv + · exfalso + have b1 := (discAngleTheta_bounds_of_im_nonneg h_lt h1).2 + have b2 := (discAngleTheta_bounds_of_im_neg h_span (lt_of_not_ge h2)).1 + linarith + · exfalso + have b1 := (discAngleTheta_bounds_of_im_neg h_span (lt_of_not_ge h1)).1 + have b2 := (discAngleTheta_bounds_of_im_nonneg h_lt h2).2 + linarith + · simp only [discAngleTheta, h1, h2, ↓reduceIte] at hθ_eq + have hdiv : (Real.pi - Real.arccos (z₁.re / ‖z₁‖)) / Real.pi = + (Real.pi - Real.arccos (z₂.re / ‖z₂‖)) / Real.pi := by nlinarith + have hsub := (div_left_inj₀ hpi.ne').mp hdiv + linarith + have hdiv_eq : z₁.re / ‖z₁‖ = z₂.re / ‖z₂‖ := by + have hc1 := Real.cos_arccos (re_div_norm_mem_Icc z₁).1 (re_div_norm_mem_Icc z₁).2 + have hc2 := Real.cos_arccos (re_div_norm_mem_Icc z₂).1 (re_div_norm_mem_Icc z₂).2 + rw [← hc1, ← hc2, harc_eq] + have hre_eq : z₁.re = z₂.re := by + rw [← hnorm] at hdiv_eq + exact (div_left_inj₀ hpos₁.ne').mp hdiv_eq + have him_sq : z₁.im ^ 2 = z₂.im ^ 2 := by + have hsq1 : z₁.re ^ 2 + z₁.im ^ 2 = ‖z₁‖ ^ 2 := by + rw [← Complex.normSq_eq_norm_sq, Complex.normSq_apply]; ring + have hsq2 : z₂.re ^ 2 + z₂.im ^ 2 = ‖z₂‖ ^ 2 := by + rw [← Complex.normSq_eq_norm_sq, Complex.normSq_apply]; ring + rw [hre_eq, hnorm] at hsq1 + linarith + have him_eq : z₁.im = z₂.im := by + rcases sq_eq_sq_iff_eq_or_eq_neg.mp him_sq with h | h + · exact h + · by_cases h1 : 0 ≤ z₁.im <;> by_cases h2 : 0 ≤ z₂.im + · linarith + · exfalso + have b1 := (discAngleTheta_bounds_of_im_nonneg h_lt h1).2 + have b2 := (discAngleTheta_bounds_of_im_neg h_span (lt_of_not_ge h2)).1 + linarith + · exfalso + have b1 := (discAngleTheta_bounds_of_im_neg h_span (lt_of_not_ge h1)).1 + have b2 := (discAngleTheta_bounds_of_im_nonneg h_lt h2).2 + linarith + · linarith + exact Complex.ext hre_eq him_eq + +private theorem circle_exp_re (t : ℝ) : ((Circle.exp t : ℂ)).re = Real.cos t := by + simp [Circle.coe_exp] + +private theorem circle_exp_im (t : ℝ) : ((Circle.exp t : ℂ)).im = Real.sin t := by + simp [Circle.coe_exp] + +theorem circle_exp_arccos {x : ℝ} (hx : x ∈ Icc (-1 : ℝ) 1) : + (Circle.exp (Real.arccos x) : ℂ) = + (x : ℂ) + (Real.sqrt (1 - x ^ 2) : ℂ) * Complex.I := by + apply Complex.ext + · rw [circle_exp_re, Real.cos_arccos hx.1 hx.2] + simp + · rw [circle_exp_im, Real.sin_arccos] + simp + +theorem circle_exp_two_pi_sub_arccos {x : ℝ} (hx : x ∈ Icc (-1 : ℝ) 1) : + (Circle.exp (2 * Real.pi - Real.arccos x) : ℂ) = + (x : ℂ) - (Real.sqrt (1 - x ^ 2) : ℂ) * Complex.I := by + have h_sub : Circle.exp (2 * Real.pi - Real.arccos x) = Circle.exp (-Real.arccos x) := by + rw [sub_eq_add_neg, Circle.exp_add, Circle.exp_two_pi, one_mul] + rw [h_sub] + apply Complex.ext + · rw [circle_exp_re, Real.cos_neg, Real.cos_arccos hx.1 hx.2] + simp + · rw [circle_exp_im, Real.sin_neg, Real.sin_arccos] + simp + +theorem discAngleMap_one (θ_s θ_t : ℝ) : + discAngleMap θ_s θ_t 1 = (Circle.exp θ_s : ℂ) := by + simp [discAngleMap, discAngleTheta] + +theorem discAngleMap_neg_one (θ_s θ_t : ℝ) : + discAngleMap θ_s θ_t (-1) = (Circle.exp θ_t : ℂ) := by + simp [discAngleMap, discAngleTheta] + +theorem discAngleMap_upper_exp {θ_s θ_t θ : ℝ} + (h1 : θ_s < θ) (h2 : θ < θ_t) : + discAngleMap θ_s θ_t + (Circle.exp (2 * Real.pi + Real.pi * (θ - θ_s) / (θ_t - θ_s)) : ℂ) = + (Circle.exp θ : ℂ) := by + let u := Real.pi * (θ - θ_s) / (θ_t - θ_s) + have hpi : 0 < Real.pi := Real.pi_pos + have hdiff : 0 < θ_t - θ_s := by linarith + have hu0 : 0 < u := div_pos (mul_pos hpi (by linarith)) hdiff + have hu_pi : u < Real.pi := by + dsimp [u] + rw [div_lt_iff₀ hdiff] + nlinarith + have hexp_eq : Circle.exp (2 * Real.pi + u) = Circle.exp u := by + rw [Circle.exp_add, Circle.exp_two_pi, one_mul] + rw [hexp_eq] + let z : ℂ := (Circle.exp u : ℂ) + have hz_norm : ‖z‖ = 1 := Circle.norm_coe (Circle.exp u) + have hz_re : z.re = Real.cos u := circle_exp_re u + have hz_im : z.im = Real.sin u := circle_exp_im u + have him_pos : 0 ≤ z.im := by + rw [hz_im] + exact (Real.sin_pos_of_pos_of_lt_pi hu0 hu_pi).le + have harc : Real.arccos (z.re / ‖z‖) = u := by + rw [hz_norm, div_one, hz_re] + exact Real.arccos_cos hu0.le hu_pi.le + change (‖z‖ : ℂ) * (Circle.exp (discAngleTheta θ_s θ_t z) : ℂ) = (Circle.exp θ : ℂ) + rw [hz_norm, Complex.ofReal_one, one_mul] + congr 1 + simp only [discAngleTheta, him_pos, ↓reduceIte, harc] + congr 1 + dsimp [u] + field_simp [hpi.ne', hdiff.ne'] + ring + +theorem discAngleMap_lower_exp {θ_s θ_t θ : ℝ} + (h1 : θ_t < θ) (h2 : θ < θ_s + 2 * Real.pi) : + discAngleMap θ_s θ_t + (Circle.exp (Real.pi + Real.pi * (θ - θ_t) / (θ_s + 2 * Real.pi - θ_t)) : ℂ) = + (Circle.exp θ : ℂ) := by + let u := Real.pi * (θ - θ_t) / (θ_s + 2 * Real.pi - θ_t) + have hpi : 0 < Real.pi := Real.pi_pos + have hdiff : 0 < θ_s + 2 * Real.pi - θ_t := by linarith + have hu0 : 0 < u := div_pos (mul_pos hpi (by linarith)) hdiff + have hu_pi : u < Real.pi := by + dsimp [u] + rw [div_lt_iff₀ hdiff] + nlinarith + let z : ℂ := (Circle.exp (Real.pi + u) : ℂ) + have hz_norm : ‖z‖ = 1 := Circle.norm_coe (Circle.exp (Real.pi + u)) + have hz_re : z.re = Real.cos (Real.pi - u) := by + rw [circle_exp_re, add_comm Real.pi u, Real.cos_add_pi, Real.cos_pi_sub] + have hz_im : z.im = -Real.sin u := by + rw [circle_exp_im, add_comm Real.pi u, Real.sin_add_pi] + have him_neg : z.im < 0 := by + rw [hz_im] + linarith [Real.sin_pos_of_pos_of_lt_pi hu0 hu_pi] + have hnot : ¬ 0 ≤ z.im := not_le.mpr him_neg + have harc : Real.arccos (z.re / ‖z‖) = Real.pi - u := by + rw [hz_norm, div_one, hz_re] + exact Real.arccos_cos (by linarith) (by linarith) + change (‖z‖ : ℂ) * (Circle.exp (discAngleTheta θ_s θ_t z) : ℂ) = (Circle.exp θ : ℂ) + rw [hz_norm, Complex.ofReal_one, one_mul] + congr 1 + simp only [discAngleTheta, hnot, ↓reduceIte, harc] + congr 1 + dsimp [u] + field_simp [hpi.ne', hdiff.ne'] + ring + + +/-! ## Unit Circle Drawings and `ClosedUnitDisc` Boundary Homeomorphism -/ + +theorem subBd_closedUnitDisc_eq_unitCircle : + subBd ClosedUnitDisc = UnitCircle := by + have hclosed : IsClosed ClosedUnitDisc := Metric.isClosed_closedBall + have hcompl : Set.univ \ ClosedUnitDisc = ClosedUnitDiscᶜ := (compl_eq_univ_sdiff _).symm + rw [subBd, hclosed.closure_eq, hcompl, closure_compl, ← sdiff_eq] + unfold ClosedUnitDisc UnitCircle + rw [interior_closedBall (0 : EuclideanPlane) one_ne_zero] + exact Metric.closedBall_sdiff_ball + +/-- The complex unit circle as the boundary of the unit disc in the Euclidean plane. -/ +noncomputable def circleHomeomorphSubBdClosedUnitDisc : + Circle ≃ₜ subBd ClosedUnitDisc where + toFun z := ⟨complexPlane (z : ℂ), by + rw [subBd_closedUnitDisc_eq_unitCircle, UnitCircle, mem_sphere_zero_iff_norm, + LinearIsometryEquiv.norm_map, Circle.norm_coe]⟩ + invFun y := ⟨complexPlane.symm y.1, by + have hy : y.1 ∈ UnitCircle := subBd_closedUnitDisc_eq_unitCircle ▸ y.2 + rw [UnitCircle, mem_sphere_zero_iff_norm] at hy + change complexPlane.symm y.1 ∈ Metric.sphere (0 : ℂ) 1 + rw [mem_sphere_zero_iff_norm, LinearIsometryEquiv.norm_map, hy]⟩ + left_inv z := Subtype.ext (complexPlane.symm_apply_apply (z : ℂ)) + right_inv y := Subtype.ext (complexPlane.apply_symm_apply y.1) + continuous_toFun := by + refine Continuous.subtype_mk ?_ _ + exact complexPlane.continuous.comp continuous_subtype_val + continuous_invFun := by + refine Continuous.subtype_mk ?_ _ + exact complexPlane.symm.continuous.comp continuous_subtype_val + +theorem isClockwiseDiscHomeo_closedUnitDisc : + IsClockwiseDiscHomeo ClosedUnitDisc circleHomeomorphSubBdClosedUnitDisc := by + intro x hx + have hx_ball : complexPlane.symm x ∈ Metric.ball (0 : ℂ) 1 := by + have h1 : x ∈ Metric.ball (0 : EuclideanPlane) 1 := by + rwa [ClosedUnitDisc, interior_closedBall (0 : EuclideanPlane) one_ne_zero] at hx + rw [Metric.mem_ball, dist_zero_right] at h1 ⊢ + rwa [LinearIsometryEquiv.norm_map] + have hφ : (fun w : Circle => complexPlane.symm (circleHomeomorphSubBdClosedUnitDisc w).1) = + fun w : Circle => (w : ℂ) := by + funext w + exact complexPlane.symm_apply_apply (w : ℂ) + rw [hφ] + have hball := Surface.wind_eq_of_ball (Homeomorph.refl ℂ) (φ := fun w : Circle => (w : ℂ)) + continuous_subtype_val (fun _ => rfl) hx_ball (Metric.mem_ball_self zero_lt_one) + change 0 < Surface.wind (fun w : Circle => (w : ℂ)) + ((Homeomorph.refl ℂ) (complexPlane.symm x)) + rw [hball] + change 0 < GM19.turn (fun t => (Circle.exp t : ℂ) - 0) 0 (2 * Real.pi) + simp only [sub_zero] + rw [Surface.isAngle_exp.turn_eq (fun _ => Circle.coe_ne_zero _) 0 (2 * Real.pi)] + linarith [Real.pi_pos] + +theorem circle_exp_add_two_pi (t : ℝ) : + Circle.exp (t + 2 * Real.pi) = Circle.exp t := by + rw [Circle.exp_add, Circle.exp_two_pi, mul_one] + +theorem circle_exp_injOn_Ico : + Set.InjOn Circle.exp (Set.Ico 0 (2 * Real.pi)) := by + intro x hx y hy hxy + have hcos : Real.cos x = Real.cos y := by + have := congrArg Complex.re (congrArg Subtype.val hxy) + simpa [Circle.coe_exp] using this + have hsin : Real.sin x = Real.sin y := by + have := congrArg Complex.im (congrArg Subtype.val hxy) + simpa [Circle.coe_exp] using this + have hsin_neg : ∀ z : ℝ, Real.pi < z → z < 2 * Real.pi → Real.sin z < 0 := by + intro z hz1 hz2 + have hpos : 0 < Real.sin (z - Real.pi) := + Real.sin_pos_of_pos_of_lt_pi (by linarith) (by linarith) + rw [Real.sin_sub_pi] at hpos + linarith + rcases le_or_gt x Real.pi with hx_pi | hx_pi + · rcases le_or_gt y Real.pi with hy_pi | hy_pi + · exact Real.injOn_cos ⟨hx.1, hx_pi⟩ ⟨hy.1, hy_pi⟩ hcos + · exfalso + have h1 : 0 ≤ Real.sin x := Real.sin_nonneg_of_mem_Icc ⟨hx.1, hx_pi⟩ + have h2 : Real.sin y < 0 := hsin_neg y hy_pi hy.2 + linarith + · rcases le_or_gt y Real.pi with hy_pi | hy_pi + · exfalso + have h1 : Real.sin x < 0 := hsin_neg x hx_pi hx.2 + have h2 : 0 ≤ Real.sin y := Real.sin_nonneg_of_mem_Icc ⟨hy.1, hy_pi⟩ + linarith + · have hcos' : Real.cos (2 * Real.pi - x) = Real.cos (2 * Real.pi - y) := by + rw [Real.cos_two_pi_sub, Real.cos_two_pi_sub, hcos] + have hsub := Real.injOn_cos ⟨by linarith [hx.2], by linarith [hx_pi]⟩ + ⟨by linarith [hy.2], by linarith [hy_pi]⟩ hcos' + linarith + +/-! ## Subgraph Restrictions, Plane Closed Discs, and Radial Shrinking -/ + +theorem graphDrawingSubgraphU_subset_drawing_U {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) (H : Graph α β) : + graphDrawingSubgraphU Γ H ⊆ Γ.drawing.U := by + rintro x (hxV | hxE) + · obtain ⟨v, _, hv, rfl⟩ := mem_iUnion₂.mp hxV + exact Γ.drawing.V_subset_U (Γ.iso.vertexEquiv ⟨v, hv⟩).2 + · obtain ⟨e, _, hxe⟩ := mem_iUnion₂.mp hxE + by_cases he : e ∈ E(G) + · rw [graphDrawingEdgeSet_eq' Γ he] at hxe + exact Γ.drawing.closure_subset_U (Γ.iso.edgeEquiv ⟨e, he⟩).2 hxe + · rw [graphDrawingEdgeSet_of_notMem Γ he, closure_empty] at hxe + exact hxe.elim + +/-- Restrict a `GraphDrawing G S` to any subgraph `H ≤ G`. -/ +theorem GraphDrawing.ofSubgraph {S : Type w} [TopologicalSpace S] [T1Space S] + {G H : Graph α β} (Γ : GraphDrawing G S) (hH : H ≤ G) : + ∃ Γ' : GraphDrawing H S, + Γ'.drawing.U = graphDrawingSubgraphU Γ H ∧ + Γ'.drawing.U ⊆ Γ.drawing.U ∧ + Γ'.drawing.IsSubdrawing Γ.drawing ∧ + (∀ v : V(H), (Γ'.iso.vertexEquiv v).1 = + (Γ.iso.vertexEquiv ⟨v.1, hH.vertexSet_mono v.2⟩).1) ∧ + (∀ v ∈ V(H), graphDrawingVertexSet Γ' v = graphDrawingVertexSet Γ v) ∧ + (∀ e ∈ E(H), graphDrawingEdgeSet Γ' e = graphDrawingEdgeSet Γ e) ∧ + (∀ P ≤ H, graphDrawingSubgraphU Γ' P = graphDrawingSubgraphU Γ P) := by + classical + let V' : Set S := ⋃ v ∈ V(H), graphDrawingVertexSet Γ v + let E' : Set (Set S) := (fun e : E(H) => (Γ.iso.edgeEquiv ⟨e.1, hH.edgeSet_mono e.2⟩).1) '' univ + let D' : Drawing S := Γ.drawing.span V' E' + have hV'_sub : V' ⊆ Γ.drawing.V := by + rintro x hx + obtain ⟨v, hvH, hvG, rfl⟩ := mem_iUnion₂.mp hx + exact (Γ.iso.vertexEquiv ⟨v, hvG⟩).2 + have hE'_sub : E' ⊆ Γ.drawing.E := by + rintro a ⟨e, _, rfl⟩ + exact (Γ.iso.edgeEquiv ⟨e.1, hH.edgeSet_mono e.2⟩).2 + have hE'_inter : E' ∩ Γ.drawing.E = E' := inter_eq_left.mpr hE'_sub + have hspanV : Γ.drawing.spanV V' E' = V' := by + apply subset_antisymm + · rintro x (hxV | hxE) + · exact hxV.1 + · obtain ⟨a, ha, hxa, hxGV⟩ := mem_iUnion₂.mp hxE + rw [hE'_inter] at ha + obtain ⟨e, _, rfl⟩ := ha + have heG : e.1 ∈ E(G) := hH.edgeSet_mono e.2 + obtain ⟨u, w, hlH⟩ := H.exists_isLink_of_mem_edgeSet e.2 + have hlG : G.IsLink e.1 u w := hlH.mono hH + have huG : u ∈ V(G) := hlG.left_mem + have hwG : w ∈ V(G) := hlG.right_mem + have hlink := (Γ.iso.isLink_iff ⟨e.1, heG⟩ ⟨u, huG⟩ ⟨w, hwG⟩).mp hlG + have hx_ends : x ∈ ({(Γ.iso.vertexEquiv ⟨u, huG⟩).1, + (Γ.iso.vertexEquiv ⟨w, hwG⟩).1} : Set S) := by + rw [← hlink.2.2.2] + exact ⟨hxa, hxGV⟩ + rcases hx_ends with rfl | hxw + · exact mem_iUnion₂.mpr ⟨u, hlH.left_mem, huG, rfl⟩ + · rw [mem_singleton_iff] at hxw + subst hxw + exact mem_iUnion₂.mpr ⟨w, hlH.right_mem, hwG, rfl⟩ + · intro x hx + exact Or.inl ⟨hx, hV'_sub hx⟩ + have hD'_V : D'.V = V' := hspanV + have hD'_E : D'.E = E' := (Γ.drawing.span_E V' E').trans hE'_inter + have hD'_U : D'.U = graphDrawingSubgraphU Γ H := by + change Γ.drawing.spanV V' E' ∪ ⋃ a ∈ E' ∩ Γ.drawing.E, closure a = _ + rw [hspanV, hE'_inter] + congr 1 + ext x + simp only [mem_iUnion, E', image_univ, mem_range, exists_prop] + constructor + · rintro ⟨a, ⟨e, rfl⟩, hxa⟩ + refine ⟨e.1, e.2, ?_⟩ + rw [graphDrawingEdgeSet_eq' Γ (hH.edgeSet_mono e.2)] + exact hxa + · rintro ⟨e, heH, hxe⟩ + rw [graphDrawingEdgeSet_eq' Γ (hH.edgeSet_mono heH)] at hxe + exact ⟨_, ⟨⟨e, heH⟩, rfl⟩, hxe⟩ + have hsub : D'.IsSubdrawing Γ.drawing := + ⟨hD'_V ▸ hV'_sub, hD'_E ▸ hE'_sub⟩ + let vFun : V(H) → D'.V := fun v => + ⟨(Γ.iso.vertexEquiv ⟨v.1, hH.vertexSet_mono v.2⟩).1, + hD'_V ▸ mem_iUnion₂.mpr ⟨v.1, v.2, hH.vertexSet_mono v.2, rfl⟩⟩ + have hvFun_bij : Function.Bijective vFun := by + refine ⟨fun u v h => ?_, fun y => ?_⟩ + · have hval : (vFun u).1 = (vFun v).1 := congrArg Subtype.val h + have heq : Γ.iso.vertexEquiv ⟨u.1, hH.vertexSet_mono u.2⟩ = + Γ.iso.vertexEquiv ⟨v.1, hH.vertexSet_mono v.2⟩ := + Subtype.ext hval + have huv := Γ.iso.vertexEquiv.injective heq + exact Subtype.ext (Subtype.mk.inj huv) + · have hy : y.1 ∈ V' := hD'_V ▸ y.2 + obtain ⟨v, hvH, hvG, hvy⟩ := mem_iUnion₂.mp hy + exact ⟨⟨v, hvH⟩, Subtype.ext hvy⟩ + let eFun : E(H) → D'.E := fun e => + ⟨(Γ.iso.edgeEquiv ⟨e.1, hH.edgeSet_mono e.2⟩).1, + hD'_E ▸ ⟨e, mem_univ e, rfl⟩⟩ + have heFun_bij : Function.Bijective eFun := by + refine ⟨fun e₁ e₂ h => ?_, fun a => ?_⟩ + · have hval : (eFun e₁).1 = (eFun e₂).1 := congrArg Subtype.val h + have heq : Γ.iso.edgeEquiv ⟨e₁.1, hH.edgeSet_mono e₁.2⟩ = + Γ.iso.edgeEquiv ⟨e₂.1, hH.edgeSet_mono e₂.2⟩ := + Subtype.ext hval + have he₁₂ := Γ.iso.edgeEquiv.injective heq + exact Subtype.ext (Subtype.mk.inj he₁₂) + · have ha : a.1 ∈ E' := hD'_E ▸ a.2 + obtain ⟨e, _, hea⟩ := ha + exact ⟨e, Subtype.ext hea⟩ + let iso' : Iso H D'.toGraph := + { vertexEquiv := Equiv.ofBijective vFun hvFun_bij + edgeEquiv := Equiv.ofBijective eFun heFun_bij + isLink_iff := fun {e u v} => by + change H.IsLink e.1 u.1 v.1 ↔ + D'.toGraph.IsLink (eFun e).1 (vFun u).1 (vFun v).1 + rw [hsub.isLink_iff (eFun e).2] + rw [← Γ.iso.isLink_iff ⟨e.1, hH.edgeSet_mono e.2⟩ + ⟨u.1, hH.vertexSet_mono u.2⟩ ⟨v.1, hH.vertexSet_mono v.2⟩] + exact hH.isLink_iff e.2 } + let Γ' : GraphDrawing H S := ⟨D', iso'⟩ + have hvert : ∀ v ∈ V(H), graphDrawingVertexSet Γ' v = graphDrawingVertexSet Γ v := by + intro v hvH + have hvG : v ∈ V(G) := hH.vertexSet_mono hvH + rw [graphDrawingVertexSet_eq_singleton' Γ' hvH, graphDrawingVertexSet_eq_singleton' Γ hvG] + rfl + have hedge : ∀ e ∈ E(H), graphDrawingEdgeSet Γ' e = graphDrawingEdgeSet Γ e := by + intro e heH + have heG : e ∈ E(G) := hH.edgeSet_mono heH + rw [graphDrawingEdgeSet_eq' Γ' heH, graphDrawingEdgeSet_eq' Γ heG] + rfl + refine ⟨Γ', hD'_U, hD'_U ▸ graphDrawingSubgraphU_subset_drawing_U Γ H, hsub, + fun _ => rfl, hvert, hedge, fun P hPH => ?_⟩ + simp only [graphDrawingSubgraphU] + congr 1 + · ext x + simp only [mem_iUnion, exists_prop] + exact ⟨fun ⟨v, hvP, hx⟩ => ⟨v, hvP, hvert v (hPH.vertexSet_mono hvP) ▸ hx⟩, + fun ⟨v, hvP, hx⟩ => ⟨v, hvP, (hvert v (hPH.vertexSet_mono hvP)).symm ▸ hx⟩⟩ + · ext x + simp only [mem_iUnion, exists_prop] + exact ⟨fun ⟨e, heP, hx⟩ => ⟨e, heP, by rw [← hedge e (hPH.edgeSet_mono heP)]; exact hx⟩, + fun ⟨e, heP, hx⟩ => ⟨e, heP, by rw [hedge e (hPH.edgeSet_mono heP)]; exact hx⟩⟩ + +/-- Subgraph restriction of a rural neighborhood: if `N` is rural, `N'.G ≤ N.G`, +`N'.Ω.bar = N.Ω.bar ∩ V(N'.G)`, `N'.Ω₀.bar = N.Ω₀.bar ∩ V(N'.G)`, and clockwise triples in `N'.Ω` +and `N'.Ω₀` are clockwise in `N.Ω` and `N.Ω₀`, then `N'` is rural. -/ +theorem Neighborhood.IsRural.ofSubgraph {N N' : Neighborhood α β} + (hrural : N.IsRural) (hG : N'.G ≤ N.G) + (hbar : N'.Ω.bar = N.Ω.bar ∩ V(N'.G)) + (hcw : ∀ v₁ v₂ v₃ : α, N'.Ω.IsClockwise3 v₁ v₂ v₃ → N.Ω.IsClockwise3 v₁ v₂ v₃) + (hbar₀ : N'.Ω₀.bar = N.Ω₀.bar ∩ V(N'.G)) + (hcw₀ : ∀ v₁ v₂ v₃ : α, N'.Ω₀.IsClockwise3 v₁ v₂ v₃ → N.Ω₀.IsClockwise3 v₁ v₂ v₃) : + N'.IsRural := by + obtain ⟨Γ, Δ, Δ₀, hΔ, hΔ₀_sub, hU_sub, hbd, hbd₀, ⟨φ, hφ_cw, hagrees⟩, hinner⟩ := hrural + obtain ⟨Γ', hU'_eq, hU'_sub, _, _, hvert, _, _⟩ := GraphDrawing.ofSubgraph Γ hG + refine ⟨Γ', Δ, Δ₀, hΔ, hΔ₀_sub, hU'_sub.trans hU_sub, ?_, ?_, ⟨φ, hφ_cw, ?_⟩, ?_⟩ + · intro v hv + rw [hvert v hv, hbd v (hG.vertexSet_mono hv), hbar, mem_inter_iff, and_iff_left hv] + · intro v hv + rw [hvert v hv, hbd₀ v (hG.vertexSet_mono hv), hbar₀, mem_inter_iff, and_iff_left hv] + · refine ⟨fun v hv => ?_, fun v₁ v₂ v₃ h => ?_⟩ + · rw [hvert v (N'.bar_subset hv)] + exact hagrees.1 v (hbar ▸ hv).1 + · have hv₁ : v₁ ∈ V(N'.G) := N'.bar_subset (h.2.1 v₁ (by simp)) + have hv₂ : v₂ ∈ V(N'.G) := N'.bar_subset (h.2.1 v₂ (by simp)) + have hv₃ : v₃ ∈ V(N'.G) := N'.bar_subset (h.2.1 v₃ (by simp)) + rw [hvert v₁ hv₁, hvert v₂ hv₂, hvert v₃ hv₃] + exact hagrees.2 v₁ v₂ v₃ (hcw v₁ v₂ v₃ h) + · rcases hinner with ⟨hΔ₀_emp, hΩ₀_emp⟩ | ⟨hΔ₀_disc, φ₀, hφ₀_cw, hagrees₀⟩ + · left + refine ⟨hΔ₀_emp, ?_⟩ + rw [hbar₀, hΩ₀_emp, empty_inter] + · right + refine ⟨hΔ₀_disc, φ₀, hφ₀_cw, fun v hv => ?_, fun v₁ v₂ v₃ h => ?_⟩ + · rw [hvert v (N'.bar₀_subset hv)] + exact hagrees₀.1 v (hbar₀ ▸ hv).1 + · have hv₁ : v₁ ∈ V(N'.G) := N'.bar₀_subset (h.2.1 v₁ (by simp)) + have hv₂ : v₂ ∈ V(N'.G) := N'.bar₀_subset (h.2.1 v₂ (by simp)) + have hv₃ : v₃ ∈ V(N'.G) := N'.bar₀_subset (h.2.1 v₃ (by simp)) + rw [hvert v₁ hv₁, hvert v₂ hv₂, hvert v₃ hv₃] + exact hagrees₀.2 v₁ v₂ v₃ (hcw₀ v₁ v₂ v₃ h) + +/-- Transport a drawing `D : Drawing S` whose point set `D.U` is compact along a map `f : S → S'` +continuous and injective on `D.U`. -/ +theorem exists_transportOn_of_isCompact {S S' : Type*} [TopologicalSpace S] [Nonempty S] + [TopologicalSpace S'] [T2Space S'] + (D : Drawing S) (hUc : IsCompact D.U) {f : S → S'} (hf : ContinuousOn f D.U) + (hinj : InjOn f D.U) : + ∃ D' : Drawing S', D'.U = f '' D.U ∧ D'.V = f '' D.V ∧ D'.E = image f '' D.E ∧ + ∀ e ∈ D.E, closure (f '' e) = f '' closure e := + GM11.exists_transportOn_of_isCompact D hUc hf hinj + +/-- Transport a `GraphDrawing G S` with compact `U` along a map `f : S → S'` continuous and +injective on `U`. -/ +theorem GraphDrawing.transportOn {S S' : Type*} [TopologicalSpace S] [Nonempty S] + [TopologicalSpace S'] [T2Space S'] {G : Graph α β} + (Γ : GraphDrawing G S) (hUc : IsCompact Γ.drawing.U) + {f : S → S'} (hf : ContinuousOn f Γ.drawing.U) (hinj : InjOn f Γ.drawing.U) : + ∃ Γ' : GraphDrawing G S', + Γ'.drawing.U = f '' Γ.drawing.U ∧ + Γ'.drawing.V = f '' Γ.drawing.V ∧ + (∀ v : V(G), (Γ'.iso.vertexEquiv v).1 = f (Γ.iso.vertexEquiv v).1) ∧ + (∀ v, graphDrawingVertexSet Γ' v = f '' graphDrawingVertexSet Γ v) ∧ + (∀ e, graphDrawingEdgeSet Γ' e = f '' graphDrawingEdgeSet Γ e) ∧ + (∀ H, graphDrawingSubgraphU Γ' H = f '' graphDrawingSubgraphU Γ H) := + transportGraphDrawingImages Γ hUc hf hinj + +theorem isInteriorPoint_plane (x : EuclideanPlane) : IsInteriorPoint x := + Surface.isInteriorPoint_euclideanPlane x + +theorem isManifoldPoint_plane (x : EuclideanPlane) : IsManifoldPoint x := + (isInteriorPoint_plane x).isManifoldPoint + +theorem frontier_eq_discBd_plane {D : Set EuclideanPlane} (hD : IsClosedDisc D) : + frontier D = discBd D := + Surface.plane_disc_frontier hD + +theorem subBd_eq_discBd_plane {D : Set EuclideanPlane} (hD : IsClosedDisc D) : + subBd D = discBd D := + Surface.subBd_eq_discBd_euclideanPlane hD + +theorem interior_eq_discInt_plane {D : Set EuclideanPlane} (hD : IsClosedDisc D) : + interior D = discInt D := + Surface.interior_eq_discInt_euclideanPlane hD + +/-- Radial shrink factor on `ℂ` fixing a subset `F₀` of the unit circle and shrinking the rest +toward the origin. -/ +noncomputable def radialShrinkFactor (F₀ : Set ℂ) (z : ℂ) : ℝ := by + classical + exact if F₀.Nonempty then (1 / 8 : ℝ) * Metric.infDist z F₀ else (1 / 2 : ℝ) + +/-- Radial shrink map `z ↦ (1 - τ(z)) z` on `ℂ`. -/ +noncomputable def radialShrinkMap (F₀ : Set ℂ) (z : ℂ) : ℂ := + ((1 - radialShrinkFactor F₀ z : ℝ) : ℂ) * z + +theorem continuous_radialShrinkFactor (F₀ : Set ℂ) : + Continuous (radialShrinkFactor F₀) := by + classical + unfold radialShrinkFactor + split_ifs + · exact continuous_const.mul (Metric.continuous_infDist_pt F₀) + · exact continuous_const + +theorem continuous_radialShrinkMap (F₀ : Set ℂ) : + Continuous (radialShrinkMap F₀) := by + unfold radialShrinkMap + exact (Complex.continuous_ofReal.comp (continuous_const.sub (continuous_radialShrinkFactor + F₀))).mul + continuous_id + +theorem radialShrinkFactor_nonneg (F₀ : Set ℂ) (z : ℂ) : + 0 ≤ radialShrinkFactor F₀ z := by + by_cases hne : F₀.Nonempty <;> simp only [radialShrinkFactor, hne, ite_true, ite_false] + · exact mul_nonneg (by norm_num) Metric.infDist_nonneg + · norm_num + +theorem radialShrinkFactor_le_half {F₀ : Set ℂ} (hF₀ : F₀ ⊆ Metric.sphere (0 : ℂ) 1) + {z : ℂ} (hz : z ∈ Metric.closedBall (0 : ℂ) 1) : + radialShrinkFactor F₀ z ≤ 1 / 2 := by + by_cases hne : F₀.Nonempty <;> simp only [radialShrinkFactor, hne, ite_true, ite_false] + · rcases hne with ⟨w, hw⟩ + have hle : Metric.infDist z F₀ ≤ dist z w := Metric.infDist_le_dist_of_mem hw + have hzw : dist z w ≤ 2 := by + have hz0 : dist z 0 ≤ 1 := Metric.mem_closedBall.mp hz + have hw0 : dist w 0 = 1 := Metric.mem_sphere.mp (hF₀ hw) + calc dist z w ≤ dist z 0 + dist 0 w := dist_triangle z 0 w + _ = dist z 0 + dist w 0 := by rw [dist_comm 0 w] + _ ≤ 1 + 1 := by linarith + _ = 2 := by norm_num + linarith + · norm_num + +theorem abs_radialShrinkFactor_sub_le (F₀ : Set ℂ) (z w : ℂ) : + |radialShrinkFactor F₀ z - radialShrinkFactor F₀ w| ≤ (1 / 8 : ℝ) * dist z w := by + by_cases hne : F₀.Nonempty <;> simp only [radialShrinkFactor, hne, ite_true, ite_false] + · have hsub : (1 / 8 : ℝ) * Metric.infDist z F₀ - (1 / 8 : ℝ) * Metric.infDist w F₀ = + (1 / 8 : ℝ) * (Metric.infDist z F₀ - Metric.infDist w F₀) := by ring + have hdist : |Metric.infDist z F₀ - Metric.infDist w F₀| ≤ dist z w := by + rw [abs_sub_le_iff] + refine ⟨?_, ?_⟩ + · linarith [Metric.infDist_le_infDist_add_dist (x := z) (y := w) (s := F₀)] + · have h2 := Metric.infDist_le_infDist_add_dist (x := w) (y := z) (s := F₀) + rw [dist_comm] at h2 + linarith + rw [hsub, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 1 / 8)] + exact mul_le_mul_of_nonneg_left hdist (by norm_num) + · simp only [sub_self, abs_zero] + exact mul_nonneg (by norm_num) dist_nonneg + +theorem injOn_radialShrinkMap {F₀ : Set ℂ} (hF₀ : F₀ ⊆ Metric.sphere (0 : ℂ) 1) : + InjOn (radialShrinkMap F₀) (Metric.closedBall (0 : ℂ) 1) := by + intro z hz w hw heq + have hτz : radialShrinkFactor F₀ z ≤ 1 / 2 := radialShrinkFactor_le_half hF₀ hz + have hτz0 : 0 ≤ radialShrinkFactor F₀ z := radialShrinkFactor_nonneg F₀ z + have hlip : |radialShrinkFactor F₀ z - radialShrinkFactor F₀ w| ≤ (1 / 8 : ℝ) * ‖z - w‖ := by + simpa [dist_eq_norm] using abs_radialShrinkFactor_sub_le F₀ z w + have hw1 : ‖w‖ ≤ 1 := by simpa [Metric.mem_closedBall, dist_zero_right] using hw + have hid : z - w = ((radialShrinkFactor F₀ z : ℝ) : ℂ) * (z - w) + + ((radialShrinkFactor F₀ z - radialShrinkFactor F₀ w : ℝ) : ℂ) * w := by + have heq' : ((1 - radialShrinkFactor F₀ z : ℝ) : ℂ) * z = + ((1 - radialShrinkFactor F₀ w : ℝ) : ℂ) * w := heq + push_cast at heq' ⊢ + linear_combination heq' + have hnorm1 : ‖((radialShrinkFactor F₀ z : ℝ) : ℂ) * (z - w)‖ = + |radialShrinkFactor F₀ z| * ‖z - w‖ := by + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs] + have hnorm2 : ‖((radialShrinkFactor F₀ z - radialShrinkFactor F₀ w : ℝ) : ℂ) * w‖ = + |radialShrinkFactor F₀ z - radialShrinkFactor F₀ w| * ‖w‖ := by + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs] + have hnorm : ‖z - w‖ ≤ (5 / 8 : ℝ) * ‖z - w‖ := by + calc ‖z - w‖ + _ = ‖((radialShrinkFactor F₀ z : ℝ) : ℂ) * (z - w) + + ((radialShrinkFactor F₀ z - radialShrinkFactor F₀ w : ℝ) : ℂ) * w‖ := by + rw [← hid] + _ ≤ ‖((radialShrinkFactor F₀ z : ℝ) : ℂ) * (z - w)‖ + + ‖((radialShrinkFactor F₀ z - radialShrinkFactor F₀ w : ℝ) : ℂ) * w‖ := + norm_add_le _ _ + _ = |radialShrinkFactor F₀ z| * ‖z - w‖ + + |radialShrinkFactor F₀ z - radialShrinkFactor F₀ w| * ‖w‖ := by + rw [hnorm1, hnorm2] + _ ≤ (1 / 2 : ℝ) * ‖z - w‖ + ((1 / 8 : ℝ) * ‖z - w‖) * 1 := by + rw [abs_of_nonneg hτz0] + gcongr + _ = (5 / 8 : ℝ) * ‖z - w‖ := by ring + have hzero : ‖z - w‖ = 0 := by + have hnonneg : 0 ≤ ‖z - w‖ := norm_nonneg _ + linarith + exact sub_eq_zero.mp (norm_eq_zero.mp hzero) + +theorem radialShrinkMap_eq_self {F₀ : Set ℂ} {z : ℂ} (hz : z ∈ F₀) : + radialShrinkMap F₀ z = z := by + have hne : F₀.Nonempty := ⟨z, hz⟩ + have hdist : Metric.infDist z F₀ = 0 := Metric.infDist_zero_of_mem hz + simp [radialShrinkMap, radialShrinkFactor, hne, hdist] + +theorem radialShrinkMap_mem_ball {F₀ : Set ℂ} (hF₀ : F₀ ⊆ Metric.sphere (0 : ℂ) 1) + (hF₀_closed : IsClosed F₀) {z : ℂ} (hz : z ∈ Metric.closedBall (0 : ℂ) 1) (hzF : z ∉ F₀) : + radialShrinkMap F₀ z ∈ Metric.ball (0 : ℂ) 1 := by + have hτ_pos : 0 < radialShrinkFactor F₀ z := by + by_cases hne : F₀.Nonempty <;> simp only [radialShrinkFactor, hne, ite_true, ite_false] + · have hpos : 0 < Metric.infDist z F₀ := + (hF₀_closed.notMem_iff_infDist_pos hne).mp hzF + linarith + · norm_num + have hτ_le : radialShrinkFactor F₀ z ≤ 1 / 2 := radialShrinkFactor_le_half hF₀ hz + have hz1 : ‖z‖ ≤ 1 := by simpa [Metric.mem_closedBall, dist_zero_right] using hz + rw [Metric.mem_ball, dist_zero_right, radialShrinkMap, norm_mul, Complex.norm_real, + Real.norm_eq_abs, abs_of_pos (by linarith)] + nlinarith + +theorem radialShrinkMap_mem_closedBall {F₀ : Set ℂ} (hF₀ : F₀ ⊆ Metric.sphere (0 : ℂ) 1) + {z : ℂ} (hz : z ∈ Metric.closedBall (0 : ℂ) 1) : + radialShrinkMap F₀ z ∈ Metric.closedBall (0 : ℂ) 1 := by + have hτ_nonneg : 0 ≤ radialShrinkFactor F₀ z := radialShrinkFactor_nonneg F₀ z + have hτ_le : radialShrinkFactor F₀ z ≤ 1 / 2 := radialShrinkFactor_le_half hF₀ hz + have hz1 : ‖z‖ ≤ 1 := by simpa [Metric.mem_closedBall, dist_zero_right] using hz + rw [Metric.mem_closedBall, dist_zero_right, radialShrinkMap, norm_mul, Complex.norm_real, + Real.norm_eq_abs, abs_of_pos (by linarith)] + nlinarith + +/-- Interpolates from the identity to the radial shrink map, with time clamped to `[0, 1]`. -/ +noncomputable def radialShrinkHomotopy (F₀ : Set ℂ) (u : ℝ) (z : ℂ) : ℂ := + ((1 - max 0 (min u 1) * radialShrinkFactor F₀ z : ℝ) : ℂ) * z + +theorem continuous_radialShrinkHomotopy (F₀ : Set ℂ) : + Continuous (fun p : ℝ × ℂ => radialShrinkHomotopy F₀ p.1 p.2) := by + unfold radialShrinkHomotopy + have hcl : Continuous (fun p : ℝ × ℂ => max 0 (min p.1 1)) := + continuous_const.max (continuous_fst.min continuous_const) + have hτ : Continuous (fun p : ℝ × ℂ => radialShrinkFactor F₀ p.2) := + (continuous_radialShrinkFactor F₀).comp continuous_snd + exact (Complex.continuous_ofReal.comp (continuous_const.sub (hcl.mul hτ))).mul continuous_snd + +theorem radialShrinkHomotopy_zero (F₀ : Set ℂ) (z : ℂ) : + radialShrinkHomotopy F₀ 0 z = z := by + simp [radialShrinkHomotopy] + +theorem radialShrinkHomotopy_one (F₀ : Set ℂ) (z : ℂ) : + radialShrinkHomotopy F₀ 1 z = radialShrinkMap F₀ z := by + simp [radialShrinkHomotopy, radialShrinkMap] + +theorem radialShrinkHomotopy_mem_closedBall {F₀ : Set ℂ} (hF₀ : F₀ ⊆ Metric.sphere (0 : ℂ) 1) + (u : ℝ) {z : ℂ} (hz : z ∈ Metric.closedBall (0 : ℂ) 1) : + radialShrinkHomotopy F₀ u z ∈ Metric.closedBall (0 : ℂ) 1 := by + let c : ℝ := max 0 (min u 1) + have hc0 : 0 ≤ c := le_max_left 0 _ + have hc1 : c ≤ 1 := max_le zero_le_one (min_le_right u 1) + have hτ_nonneg : 0 ≤ radialShrinkFactor F₀ z := radialShrinkFactor_nonneg F₀ z + have hτ_le : radialShrinkFactor F₀ z ≤ 1 / 2 := radialShrinkFactor_le_half hF₀ hz + have hz1 : ‖z‖ ≤ 1 := by simpa [Metric.mem_closedBall, dist_zero_right] using hz + have hprod0 : 0 ≤ c * radialShrinkFactor F₀ z := mul_nonneg hc0 hτ_nonneg + have hprod_le : c * radialShrinkFactor F₀ z ≤ 1 / 2 := by nlinarith + rw [Metric.mem_closedBall, dist_zero_right] + change ‖((1 - c * radialShrinkFactor F₀ z : ℝ) : ℂ) * z‖ ≤ 1 + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_pos (by linarith)] + nlinarith + +theorem injOn_radialShrinkHomotopy {F₀ : Set ℂ} (hF₀ : F₀ ⊆ Metric.sphere (0 : ℂ) 1) (u : ℝ) : + InjOn (radialShrinkHomotopy F₀ u) (Metric.closedBall (0 : ℂ) 1) := by + intro z hz w hw heq + let c : ℝ := max 0 (min u 1) + have hc0 : 0 ≤ c := le_max_left 0 _ + have hc1 : c ≤ 1 := max_le zero_le_one (min_le_right u 1) + have hτz : c * radialShrinkFactor F₀ z ≤ 1 / 2 := by + nlinarith [radialShrinkFactor_le_half hF₀ hz, radialShrinkFactor_nonneg F₀ z] + have hτz0 : 0 ≤ c * radialShrinkFactor F₀ z := mul_nonneg hc0 (radialShrinkFactor_nonneg F₀ z) + have hlip : |c * radialShrinkFactor F₀ z - c * radialShrinkFactor F₀ w| ≤ + (1 / 8 : ℝ) * ‖z - w‖ := by + have h1 : |radialShrinkFactor F₀ z - radialShrinkFactor F₀ w| ≤ (1 / 8 : ℝ) * ‖z - w‖ := by + simpa [dist_eq_norm] using abs_radialShrinkFactor_sub_le F₀ z w + rw [← mul_sub, abs_mul, abs_of_nonneg hc0] + nlinarith [abs_nonneg (radialShrinkFactor F₀ z - radialShrinkFactor F₀ w)] + have hw1 : ‖w‖ ≤ 1 := by simpa [Metric.mem_closedBall, dist_zero_right] using hw + have hid : z - w = ((c * radialShrinkFactor F₀ z : ℝ) : ℂ) * (z - w) + + ((c * radialShrinkFactor F₀ z - c * radialShrinkFactor F₀ w : ℝ) : ℂ) * w := by + have heq' : ((1 - c * radialShrinkFactor F₀ z : ℝ) : ℂ) * z = + ((1 - c * radialShrinkFactor F₀ w : ℝ) : ℂ) * w := heq + push_cast at heq' ⊢ + linear_combination heq' + have hnorm1 : ‖((c * radialShrinkFactor F₀ z : ℝ) : ℂ) * (z - w)‖ = + |c * radialShrinkFactor F₀ z| * ‖z - w‖ := by + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs] + have hnorm2 : ‖((c * radialShrinkFactor F₀ z - c * radialShrinkFactor F₀ w : ℝ) : ℂ) * w‖ = + |c * radialShrinkFactor F₀ z - c * radialShrinkFactor F₀ w| * ‖w‖ := by + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs] + have hnorm : ‖z - w‖ ≤ (5 / 8 : ℝ) * ‖z - w‖ := by + calc ‖z - w‖ + _ = ‖((c * radialShrinkFactor F₀ z : ℝ) : ℂ) * (z - w) + + ((c * radialShrinkFactor F₀ z - c * radialShrinkFactor F₀ w : ℝ) : ℂ) * w‖ := by + rw [← hid] + _ ≤ ‖((c * radialShrinkFactor F₀ z : ℝ) : ℂ) * (z - w)‖ + + ‖((c * radialShrinkFactor F₀ z - c * radialShrinkFactor F₀ w : ℝ) : ℂ) * w‖ := + norm_add_le _ _ + _ = |c * radialShrinkFactor F₀ z| * ‖z - w‖ + + |c * radialShrinkFactor F₀ z - c * radialShrinkFactor F₀ w| * ‖w‖ := by + rw [hnorm1, hnorm2] + _ ≤ (1 / 2 : ℝ) * ‖z - w‖ + ((1 / 8 : ℝ) * ‖z - w‖) * 1 := by + rw [abs_of_nonneg hτz0] + gcongr + _ = (5 / 8 : ℝ) * ‖z - w‖ := by ring + have hzero : ‖z - w‖ = 0 := by + have hnonneg : 0 ≤ ‖z - w‖ := norm_nonneg _ + linarith + exact sub_eq_zero.mp (norm_eq_zero.mp hzero) + +/-- Given a closed disc `D` in a `T2Space` `S` and a closed subset `F ⊆ discBd D`, there is a +continuous injective self-map `Ψ : S → S` on `D` with a continuous left inverse `Ψ'` on `Ψ '' D` +that fixes `F` pointwise and sends `D \ F` into `D \ discBd D`, together with a homotopy `Ψ_hom` +through injective maps on `D` from `id` to `Ψ`. -/ +theorem exists_disc_shrink_map_with_homotopy {S : Type w} [TopologicalSpace S] [T2Space S] + [Nonempty S] + {D F : Set S} (hD : IsClosedDisc D) (hF_closed : IsClosed F) (hF_sub : F ⊆ discBd D) : + ∃ (Ψ Ψ' : S → S) (Ψ_hom : ℝ → S → S), + ContinuousOn Ψ D ∧ + ContinuousOn Ψ' (Ψ '' D) ∧ + LeftInvOn Ψ' Ψ D ∧ + InjOn Ψ D ∧ + Ψ '' D ⊆ D ∧ + (∀ x ∈ F, Ψ x = x) ∧ + (∀ x ∈ D \ F, Ψ x ∈ D \ discBd D) ∧ + ContinuousOn (fun p : ℝ × S => Ψ_hom p.1 p.2) (univ ×ˢ D) ∧ + (∀ x ∈ D, Ψ_hom 0 x = x) ∧ + (∀ x ∈ D, Ψ_hom 1 x = Ψ x) ∧ + (∀ u : ℝ, InjOn (Ψ_hom u) D) := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hFD : F ⊆ D := hF_sub.trans (Surface.discBd_subset D) + let F₀ : Set ℂ := h '' F + have hF₀_sphere : F₀ ⊆ Metric.sphere (0 : ℂ) 1 := by + rw [← c.bd] + exact image_mono hF_sub + have hF_compact : IsCompact F := hD.isCompact.of_isClosed_subset hF_closed hFD + have hF₀_closed : IsClosed F₀ := + (hF_compact.image_of_continuousOn (c.hc.mono hFD)).isClosed + let Ψ : S → S := fun x => g (radialShrinkMap F₀ (h x)) + let Ψ_hom : ℝ → S → S := fun u x => g (radialShrinkHomotopy F₀ u (h x)) + have hΦ_maps : MapsTo (radialShrinkMap F₀) (Metric.closedBall (0 : ℂ) 1) + (Metric.closedBall (0 : ℂ) 1) := + fun z hz => radialShrinkMap_mem_closedBall hF₀_sphere hz + have hΨ_cont : ContinuousOn Ψ D := by + refine c.gc.comp ((continuous_radialShrinkMap F₀).continuousOn.comp c.hc c.hm) ?_ + exact hΦ_maps.comp c.hm + have hΨ_inj : InjOn Ψ D := by + intro x hx y hy heq + have h₁ : radialShrinkMap F₀ (h x) = radialShrinkMap F₀ (h y) := + c.injOn (hΦ_maps (c.hm hx)) (hΦ_maps (c.hm hy)) heq + have h₂ : h x = h y := injOn_radialShrinkMap hF₀_sphere (c.hm hx) (c.hm hy) h₁ + exact c.gh.injOn hx hy h₂ + obtain ⟨Ψ', hΨ'_cont, hΨ'_left⟩ := exists_inv_of_compactOn hD.isCompact hΨ_cont hΨ_inj + refine ⟨Ψ, Ψ', Ψ_hom, hΨ_cont, hΨ'_cont, hΨ'_left, hΨ_inj, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + rw [← c.g_closedBall] + exact mem_image_of_mem g (hΦ_maps (c.hm hx)) + · intro x hx + have hx₀ : h x ∈ F₀ := mem_image_of_mem h hx + change g (radialShrinkMap F₀ (h x)) = x + rw [radialShrinkMap_eq_self hx₀, c.gh (hFD hx)] + · rintro x ⟨hxD, hxF⟩ + have hxhF₀ : h x ∉ F₀ := by + rintro ⟨y, hyF, hyx⟩ + exact hxF (c.gh.injOn hxD (hFD hyF) hyx.symm ▸ hyF) + have hball : radialShrinkMap F₀ (h x) ∈ Metric.ball (0 : ℂ) 1 := + radialShrinkMap_mem_ball hF₀_sphere hF₀_closed (c.hm hxD) hxhF₀ + have hmem : g (radialShrinkMap F₀ (h x)) ∈ g '' Metric.ball (0 : ℂ) 1 := + mem_image_of_mem g hball + obtain ⟨u1, u2⟩ := c.union_ball + exact ⟨u1 ▸ Or.inl hmem, disjoint_left.mp u2 hmem⟩ + · have hmap : MapsTo Prod.snd ((univ : Set ℝ) ×ˢ D) D := fun _ hp => hp.2 + have h1 : ContinuousOn (fun p : ℝ × S => radialShrinkHomotopy F₀ p.1 (h p.2)) (univ ×ˢ D) := + (continuous_radialShrinkHomotopy F₀).comp_continuousOn + (continuousOn_fst.prodMk (c.hc.comp continuousOn_snd hmap)) + refine c.gc.comp h1 ?_ + intro p hp + exact radialShrinkHomotopy_mem_closedBall hF₀_sphere p.1 (c.hm hp.2) + · intro x hx + change g (radialShrinkHomotopy F₀ 0 (h x)) = x + rw [radialShrinkHomotopy_zero, c.gh hx] + · intro x _ + change g (radialShrinkHomotopy F₀ 1 (h x)) = g (radialShrinkMap F₀ (h x)) + rw [radialShrinkHomotopy_one] + · intro u x hx y hy heq + have h₁ : radialShrinkHomotopy F₀ u (h x) = radialShrinkHomotopy F₀ u (h y) := + c.injOn (radialShrinkHomotopy_mem_closedBall hF₀_sphere u (c.hm hx)) + (radialShrinkHomotopy_mem_closedBall hF₀_sphere u (c.hm hy)) heq + have h₂ : h x = h y := injOn_radialShrinkHomotopy hF₀_sphere u (c.hm hx) (c.hm hy) h₁ + exact c.gh.injOn hx hy h₂ + +/-- Given a closed disc `D` in a `T2Space` `S` and a closed subset `F ⊆ discBd D`, there is a +continuous injective self-map `Ψ : S → S` on `D` with a continuous left inverse `Ψ'` on `Ψ '' D` +that fixes `F` pointwise and sends `D \ F` into `D \ discBd D`. -/ +theorem exists_disc_shrink_map {S : Type w} [TopologicalSpace S] [T2Space S] [Nonempty S] + {D F : Set S} (hD : IsClosedDisc D) (hF_closed : IsClosed F) (hF_sub : F ⊆ discBd D) : + ∃ Ψ Ψ' : S → S, + ContinuousOn Ψ D ∧ + ContinuousOn Ψ' (Ψ '' D) ∧ + LeftInvOn Ψ' Ψ D ∧ + InjOn Ψ D ∧ + Ψ '' D ⊆ D ∧ + (∀ x ∈ F, Ψ x = x) ∧ + (∀ x ∈ D \ F, Ψ x ∈ D \ discBd D) := by + obtain ⟨Ψ, Ψ', _, h1, h2, h3, h4, h5, h6, h7, _, _, _, _⟩ := + exists_disc_shrink_map_with_homotopy hD hF_closed hF_sub + exact ⟨Ψ, Ψ', h1, h2, h3, h4, h5, h6, h7⟩ + +theorem isClockwiseDiscHomeo_of_homotopy {D D₀ : Set EuclideanPlane} + (hD₀ : IsClosedDisc D₀) (hD₀_sub : D₀ ⊆ D) + {Ψ : EuclideanPlane → EuclideanPlane} + (hint_eq : interior (Ψ '' D₀) = Ψ '' interior D₀) + {C₀ C₀' : Set EuclideanPlane} (hC₀ : C₀ = subBd D₀) + (φ₀ : Circle ≃ₜ C₀) (φ₀' : Circle ≃ₜ C₀') + (hφ₀' : ∀ w : Circle, (φ₀' w).1 = Ψ (φ₀ w).1) + {Ψ_hom : ℝ → EuclideanPlane → EuclideanPlane} + (hΨ_hom_cont : ContinuousOn (fun p : ℝ × EuclideanPlane => Ψ_hom p.1 p.2) (univ ×ˢ D)) + (hΨ_hom_zero : ∀ x ∈ D, Ψ_hom 0 x = x) + (hΨ_hom_one : ∀ x ∈ D, Ψ_hom 1 x = Ψ x) + (hΨ_hom_inj : ∀ u : ℝ, InjOn (Ψ_hom u) D) + (hφ₀_cw : IsClockwiseDiscHomeo D₀ φ₀) : + IsClockwiseDiscHomeo (Ψ '' D₀) φ₀' := by + intro y hy + rw [hint_eq] at hy + obtain ⟨x₀, hx₀, rfl⟩ := hy + have hx₀_D : x₀ ∈ D := hD₀_sub (interior_subset hx₀) + have hφ₀_D : ∀ w : Circle, (φ₀ w).1 ∈ D := fun w => by + have hw : (φ₀ w).1 ∈ discBd D₀ := by + rw [← subBd_eq_discBd_plane hD₀, ← hC₀] + exact (φ₀ w).2 + exact hD₀_sub (Surface.discBd_subset D₀ hw) + have hφ₀_ne : ∀ w : Circle, (φ₀ w).1 ≠ x₀ := fun w heq => by + have hw : (φ₀ w).1 ∈ frontier D₀ := by + rw [← GM11.subBd_eq_frontier, ← hC₀] + exact (φ₀ w).2 + rw [heq] at hw + exact hw.2 hx₀ + let H : ℝ → ℝ → ℂ := fun u t => + complexPlane.symm (Ψ_hom u (φ₀ (Circle.exp t)).1) - complexPlane.symm (Ψ_hom u x₀) + have hH : Continuous fun q : ℝ × ℝ => H q.1 q.2 := by + have hc1 : Continuous fun q : ℝ × ℝ => Ψ_hom q.1 (φ₀ (Circle.exp q.2)).1 := + hΨ_hom_cont.comp_continuous + (continuous_fst.prodMk + (continuous_subtype_val.comp (φ₀.continuous.comp (Circle.exp.continuous.comp + continuous_snd)))) + (fun q => ⟨trivial, hφ₀_D _⟩) + have hc2 : Continuous fun q : ℝ × ℝ => Ψ_hom q.1 x₀ := + hΨ_hom_cont.comp_continuous (continuous_fst.prodMk continuous_const) + (fun _ => ⟨trivial, hx₀_D⟩) + exact (complexPlane.symm.continuous.comp hc1).sub (complexPlane.symm.continuous.comp hc2) + have hne : ∀ u t, H u t ≠ 0 := fun u t h => by + have h1 := complexPlane.symm.injective (sub_eq_zero.mp h) + have h2 := hΨ_hom_inj u (hφ₀_D _) hx₀_D h1 + exact hφ₀_ne (Circle.exp t) h2 + have hper : ∀ u, Function.Periodic (H u) (2 * Real.pi) := fun u t => by + simp only [H, circle_exp_add_two_pi] + have hv : ∀ t, ∃ t' ∈ Icc 0 (2 * Real.pi), ∀ u, H u t = H u t' := fun t => by + obtain ⟨t', ht', n, rfl⟩ := Surface.exists_mem_period t + exact ⟨_, ht', fun u => ((hper u).sub_zsmul_eq n).symm⟩ + have hhom := GM19.turn_eq_of_homotopy hH hne isCompact_Icc hv (s := 0) (t := 2 * Real.pi) + (fun u => by + have := hper u 0 + rw [zero_add] at this + exact this.symm) 0 1 + have hH0 : H 0 = fun t => complexPlane.symm (φ₀ (Circle.exp t)).1 - complexPlane.symm x₀ := by + funext t + simp only [H, hΨ_hom_zero _ (hφ₀_D _), hΨ_hom_zero x₀ hx₀_D] + have hH1 : H 1 = fun t => complexPlane.symm (φ₀' (Circle.exp t)).1 - complexPlane.symm (Ψ x₀) + := by + funext t + simp only [H, hΨ_hom_one _ (hφ₀_D _), hΨ_hom_one x₀ hx₀_D, hφ₀'] + have hpos : 0 < Surface.wind (fun w => complexPlane.symm (φ₀ w).1) (complexPlane.symm x₀) := + hφ₀_cw x₀ hx₀ + change 0 < GM19.turn (fun t => complexPlane.symm (φ₀' (Circle.exp t)).1 - complexPlane.symm + (Ψ x₀)) + 0 (2 * Real.pi) + rw [← hH1, ← hhom, hH0] + exact hpos + +/-- Transporting `AgreesWithOArcHomeo` along a map `Ψ` with a continuous left inverse on `C` +that fixes `α_pt v` for every `v ∈ Ω.bar`. -/ +theorem agreesWithOArcHomeo_of_image {S : Type w} [TopologicalSpace S] + {α_pt : α → S} {Ω : CyclicPerm α} {C C' : Set S} (φ : Circle ≃ₜ C) + {Ψ Ψ' : S → S} (hΨ_cont : ContinuousOn Ψ C) (hΨ'_cont : ContinuousOn Ψ' (Ψ '' C)) + (hΨ_left : LeftInvOn Ψ' Ψ C) (hC' : C' = Ψ '' C) + (hfix : ∀ v ∈ Ω.bar, Ψ (α_pt v) = α_pt v) + (hagrees : AgreesWithOArcHomeo α_pt Ω C φ) : + ∃ φ' : Circle ≃ₜ C', AgreesWithOArcHomeo α_pt Ω C' φ' := by + obtain ⟨e, he⟩ := exists_homeomorph_image hΨ_cont hΨ'_cont hΨ_left + let φ' : Circle ≃ₜ C' := (φ.trans e).trans (Homeomorph.setCongr hC'.symm) + have hφ'_val : ∀ z : Circle, (φ' z).1 = Ψ (φ z).1 := fun z => he (φ z) + refine ⟨φ', ?_, ?_⟩ + · intro v hv + rw [hC', ← hfix v hv] + exact mem_image_of_mem Ψ (hagrees.1 v hv) + · intro v₁ v₂ v₃ hcw + have hv₁ : v₁ ∈ Ω.bar := hcw.2.1 v₁ (by simp) + have hv₂ : v₂ ∈ Ω.bar := hcw.2.1 v₂ (by simp) + have hv₃ : v₃ ∈ Ω.bar := hcw.2.1 v₃ (by simp) + obtain ⟨t₁, t₂, t₃, hlt₁₂, hlt₂₃, hlt₃₁, he₁, he₂, he₃⟩ := hagrees.2 v₁ v₂ v₃ hcw + refine ⟨t₁, t₂, t₃, hlt₁₂, hlt₂₃, hlt₃₁, ?_, ?_, ?_⟩ + · rw [hφ'_val, he₁, hfix v₁ hv₁] + · rw [hφ'_val, he₂, hfix v₂ hv₂] + · rw [hφ'_val, he₃, hfix v₃ hv₃] + +/-- Transporting `DrawingAgreesWithOArcHomeo` along a map `Ψ` with a continuous left inverse on `C`. +-/ +theorem drawingAgreesWithOArcHomeo_of_image {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ Γ' : GraphDrawing G S) {Ω : CyclicPerm α} {C C' : Set S} (φ : Circle ≃ₜ C) + {Ψ Ψ' : S → S} (hΨ_cont : ContinuousOn Ψ C) (hΨ'_cont : ContinuousOn Ψ' (Ψ '' C)) + (hΨ_left : LeftInvOn Ψ' Ψ C) (hC' : C' = Ψ '' C) + (hvert : ∀ v ∈ Ω.bar, graphDrawingVertexSet Γ' v = Ψ '' graphDrawingVertexSet Γ v) + (hagrees : DrawingAgreesWithOArcHomeo Γ Ω C φ) : + ∃ φ' : Circle ≃ₜ C', + (∀ z : Circle, (φ' z).1 = Ψ (φ z).1) ∧ DrawingAgreesWithOArcHomeo Γ' Ω C' φ' := by + obtain ⟨e, he⟩ := exists_homeomorph_image hΨ_cont hΨ'_cont hΨ_left + let φ' : Circle ≃ₜ C' := (φ.trans e).trans (Homeomorph.setCongr hC'.symm) + have hφ'_val : ∀ z : Circle, (φ' z).1 = Ψ (φ z).1 := fun z => he (φ z) + refine ⟨φ', hφ'_val, ?_, ?_⟩ + · intro v hv + rw [hvert v hv, hC'] + exact image_mono (hagrees.1 v hv) + · intro v₁ v₂ v₃ hcw + have hv₁ : v₁ ∈ Ω.bar := hcw.2.1 v₁ (by simp) + have hv₂ : v₂ ∈ Ω.bar := hcw.2.1 v₂ (by simp) + have hv₃ : v₃ ∈ Ω.bar := hcw.2.1 v₃ (by simp) + obtain ⟨t₁, t₂, t₃, hlt₁₂, hlt₂₃, hlt₃₁, he₁, he₂, he₃⟩ := hagrees.2 v₁ v₂ v₃ hcw + refine ⟨t₁, t₂, t₃, hlt₁₂, hlt₂₃, hlt₃₁, ?_, ?_, ?_⟩ + · rw [hφ'_val, hvert v₁ hv₁] + exact mem_image_of_mem Ψ he₁ + · rw [hφ'_val, hvert v₂ hv₂] + exact mem_image_of_mem Ψ he₂ + · rw [hφ'_val, hvert v₃ hv₃] + exact mem_image_of_mem Ψ he₃ + +/-- Given a rural presentation `(Γ, Δ, Δ₀)` of `(G, Ω, Ω₀)` and any cyclic permutation `Ω'` +with `Ω'.bar ⊆ Ω.bar` whose clockwise triples are clockwise in `Ω`, radial shrinking produces a +clean rural presentation `(Γ', Δ, Δ₀')` of `(G, Ω', Ω₀)` where `Γ'.drawing.U` and `Δ₀'` meet +`subBd Δ` only inside `⋃ v ∈ Ω'.bar, graphDrawingVertexSet Γ' v`, via a continuous injective map +`Ψ : EuclideanPlane → EuclideanPlane` on `Δ` with continuous left inverse `Ψ'` on `Ψ '' Δ`. -/ +theorem exists_clean_presentation_of_restrict_outer + {G : Graph α β} {Ω Ω' Ω₀ : CyclicPerm α} + (hbar'G : Ω'.bar ⊆ V(G)) (hbar : Ω'.bar ⊆ Ω.bar) + (hcw : ∀ v₁ v₂ v₃ : α, Ω'.IsClockwise3 v₁ v₂ v₃ → Ω.IsClockwise3 v₁ v₂ v₃) + (Γ : GraphDrawing G EuclideanPlane) (Δ Δ₀ : Set EuclideanPlane) + (hΔ : IsClosedDisc Δ) (hΔ₀_sub : Δ₀ ⊆ Δ) (hU_sub : Γ.drawing.U ⊆ Δ \ interior Δ₀) + (hbd : ∀ v ∈ V(G), (graphDrawingVertexSet Γ v ⊆ subBd Δ ↔ v ∈ Ω.bar)) + (hbd₀ : ∀ v ∈ V(G), (graphDrawingVertexSet Γ v ⊆ subBd Δ₀ ↔ v ∈ Ω₀.bar)) + (φ : Circle ≃ₜ subBd Δ) (hagrees : DrawingAgreesWithOArcHomeo Γ Ω (subBd Δ) φ) + (hinner : (Δ₀ = ∅ ∧ Ω₀.bar = ∅) ∨ + (IsClosedDisc Δ₀ ∧ + ∃ φ₀ : Circle ≃ₜ subBd Δ₀, + IsClockwiseDiscHomeo Δ₀ φ₀ ∧ DrawingAgreesWithOArcHomeo Γ Ω₀ (subBd Δ₀) φ₀)) : + ∃ (Ψ Ψ' : EuclideanPlane → EuclideanPlane) + (Γ' : GraphDrawing G EuclideanPlane) (Δ₀' : Set EuclideanPlane), + ContinuousOn Ψ Δ ∧ + ContinuousOn Ψ' (Ψ '' Δ) ∧ + LeftInvOn Ψ' Ψ Δ ∧ + InjOn Ψ Δ ∧ + Ψ '' Δ ⊆ Δ ∧ + Δ₀' = Ψ '' Δ₀ ∧ + Δ₀' ⊆ Δ ∧ + Γ'.drawing.U = Ψ '' Γ.drawing.U ∧ + Γ'.drawing.U ⊆ Δ \ interior Δ₀' ∧ + (∀ v, graphDrawingVertexSet Γ' v = Ψ '' graphDrawingVertexSet Γ v) ∧ + (∀ v ∈ Ω'.bar, graphDrawingVertexSet Γ' v = graphDrawingVertexSet Γ v) ∧ + (∀ H, graphDrawingSubgraphU Γ' H = Ψ '' graphDrawingSubgraphU Γ H) ∧ + Γ'.drawing.U ∩ subBd Δ = (⋃ v ∈ Ω'.bar, graphDrawingVertexSet Γ' v) ∧ + Δ₀' ∩ subBd Δ ⊆ (⋃ v ∈ Ω'.bar, graphDrawingVertexSet Γ' v) ∧ + (∀ v ∈ V(G), (graphDrawingVertexSet Γ' v ⊆ subBd Δ ↔ v ∈ Ω'.bar)) ∧ + (∀ v ∈ V(G), (graphDrawingVertexSet Γ' v ⊆ subBd Δ₀' ↔ v ∈ Ω₀.bar)) ∧ + DrawingAgreesWithOArcHomeo Γ' Ω' (subBd Δ) φ ∧ + ((Δ₀' = ∅ ∧ Ω₀.bar = ∅) ∨ + (IsClosedDisc Δ₀' ∧ + ∃ φ₀' : Circle ≃ₜ subBd Δ₀', + IsClockwiseDiscHomeo Δ₀' φ₀' ∧ DrawingAgreesWithOArcHomeo Γ' Ω₀ (subBd Δ₀') φ₀')) := by + let F : Set EuclideanPlane := ⋃ v ∈ Ω'.bar, graphDrawingVertexSet Γ v + have hF_closed : IsClosed F := by + refine Ω'.finite_bar.isClosed_biUnion fun v hv => ?_ + rw [graphDrawingVertexSet_eq_singleton' Γ (hbar'G hv)] + exact isClosed_singleton + have hsubBd_Δ : subBd Δ = discBd Δ := subBd_eq_discBd_plane hΔ + have hF_sub : F ⊆ discBd Δ := by + rw [← hsubBd_Δ] + rintro x hx + obtain ⟨v, hv, hxv⟩ := mem_iUnion₂.mp hx + exact (hbd v (hbar'G hv)).mpr (hbar hv) hxv + obtain ⟨Ψ, Ψ', Ψ_hom, hΨ_cont, hΨ'_cont, hΨ_left, hΨ_inj, hΨ_sub, hΨ_fix, hΨ_int, + hΨ_hom_cont, hΨ_hom_zero, hΨ_hom_one, hΨ_hom_inj⟩ := + exists_disc_shrink_map_with_homotopy hΔ hF_closed hF_sub + have hU_Δ : Γ.drawing.U ⊆ Δ := hU_sub.trans sdiff_subset + have hUc : IsCompact Γ.drawing.U := + hΔ.isCompact.of_isClosed_subset Γ.drawing.isClosed_U hU_Δ + obtain ⟨Γ', hU'_eq, hV'_eq, hveq', hvert', hedge', hsubU'⟩ := + GraphDrawing.transportOn Γ hUc (hΨ_cont.mono hU_Δ) (hΨ_inj.mono hU_Δ) + have hvert_fix : ∀ v ∈ Ω'.bar, graphDrawingVertexSet Γ' v = graphDrawingVertexSet Γ v := by + intro v hv + rw [hvert' v] + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + have hyF : y ∈ F := mem_iUnion₂.mpr ⟨v, hv, hy⟩ + rw [hΨ_fix y hyF] + exact hy + · intro hx + have hxF : x ∈ F := mem_iUnion₂.mpr ⟨v, hv, hx⟩ + exact ⟨x, hx, hΨ_fix x hxF⟩ + have hF_eq : (⋃ v ∈ Ω'.bar, graphDrawingVertexSet Γ' v) = F := by + ext x + simp only [mem_iUnion, exists_prop, F] + exact ⟨fun ⟨v, hv, hx⟩ => ⟨v, hv, hvert_fix v hv ▸ hx⟩, + fun ⟨v, hv, hx⟩ => ⟨v, hv, (hvert_fix v hv).symm ▸ hx⟩⟩ + let Δ₀' : Set EuclideanPlane := Ψ '' Δ₀ + have hΔ₀'_sub : Δ₀' ⊆ Δ := (image_mono hΔ₀_sub).trans hΨ_sub + have hΔ₀_bd_int : + interior Δ₀' = Ψ '' interior Δ₀ ∧ subBd Δ₀' = Ψ '' subBd Δ₀ ∧ + ((Δ₀' = ∅ ∧ Ω₀.bar = ∅) ∨ + (IsClosedDisc Δ₀' ∧ + ∃ φ₀' : Circle ≃ₜ subBd Δ₀', + IsClockwiseDiscHomeo Δ₀' φ₀' ∧ DrawingAgreesWithOArcHomeo Γ' Ω₀ (subBd Δ₀') φ₀')) := by + rcases hinner with ⟨rfl, hΩ₀_emp⟩ | ⟨hΔ₀_disc, φ₀, hφ₀_cw, hagrees₀⟩ + · refine ⟨by simp [Δ₀'], by simp [Δ₀', subBd], Or.inl ⟨by simp [Δ₀'], hΩ₀_emp⟩⟩ + · have hΔ₀_cont : ContinuousOn Ψ Δ₀ := hΨ_cont.mono hΔ₀_sub + have hΔ₀'_cont : ContinuousOn Ψ' (Ψ '' Δ₀) := hΨ'_cont.mono (image_mono hΔ₀_sub) + have hΔ₀_left : LeftInvOn Ψ' Ψ Δ₀ := hΨ_left.mono hΔ₀_sub + obtain ⟨hΔ₀'_disc, hΔ₀'_bd⟩ := hΔ₀_disc.image hΔ₀_cont hΔ₀'_cont hΔ₀_left + have hbd₀_eq : subBd Δ₀' = Ψ '' subBd Δ₀ := by + rw [subBd_eq_discBd_plane hΔ₀'_disc, subBd_eq_discBd_plane hΔ₀_disc, hΔ₀'_bd] + have hint₀_eq : interior Δ₀' = Ψ '' interior Δ₀ := by + rw [interior_eq_discInt_plane hΔ₀'_disc, interior_eq_discInt_plane hΔ₀_disc] + change Δ₀' \ discBd Δ₀' = Ψ '' (Δ₀ \ discBd Δ₀) + rw [hΔ₀'_bd] + exact (InjOn.image_sdiff_subset (hΨ_inj.mono hΔ₀_sub) (Surface.discBd_subset Δ₀)).symm + have hbd₀_sub : subBd Δ₀ ⊆ Δ := + (subBd_eq_discBd_plane hΔ₀_disc ▸ Surface.discBd_subset Δ₀).trans hΔ₀_sub + obtain ⟨φ₀', hφ₀'_val, hagrees₀'⟩ := + drawingAgreesWithOArcHomeo_of_image Γ Γ' φ₀ (hΨ_cont.mono hbd₀_sub) + (hΨ'_cont.mono (image_mono hbd₀_sub)) (hΨ_left.mono hbd₀_sub) hbd₀_eq + (fun v _ => hvert' v) hagrees₀ + have hφ₀'_cw : IsClockwiseDiscHomeo Δ₀' φ₀' := + isClockwiseDiscHomeo_of_homotopy hΔ₀_disc hΔ₀_sub hint₀_eq rfl φ₀ φ₀' hφ₀'_val + hΨ_hom_cont hΨ_hom_zero hΨ_hom_one hΨ_hom_inj hφ₀_cw + exact ⟨hint₀_eq, hbd₀_eq, Or.inr ⟨hΔ₀'_disc, φ₀', hφ₀'_cw, hagrees₀'⟩⟩ + obtain ⟨hint₀_eq, hbd₀_eq, hinner'⟩ := hΔ₀_bd_int + have hU'_sub : Γ'.drawing.U ⊆ Δ \ interior Δ₀' := by + rw [hU'_eq, hint₀_eq] + rintro _ ⟨x, hxU, rfl⟩ + have hx := hU_sub hxU + refine ⟨hΨ_sub (mem_image_of_mem Ψ hx.1), ?_⟩ + rintro ⟨y, hy_int, hyx⟩ + have hyΔ : y ∈ Δ := hΔ₀_sub (interior_subset hy_int) + have hy_eq : y = x := hΨ_inj hyΔ hx.1 hyx + exact hx.2 (hy_eq ▸ hy_int) + have hΨ_mem_subBd_iff : ∀ x ∈ Δ, Ψ x ∈ subBd Δ ↔ x ∈ F := by + intro x hxΔ + constructor + · intro hΨx + by_contra hxF + have h := hΨ_int x ⟨hxΔ, hxF⟩ + rw [← hsubBd_Δ] at h + exact h.2 hΨx + · intro hxF + rw [hΨ_fix x hxF, hsubBd_Δ] + exact hF_sub hxF + have hU'_inter_bd : Γ'.drawing.U ∩ subBd Δ = ⋃ v ∈ Ω'.bar, graphDrawingVertexSet Γ' v := by + rw [hF_eq, hU'_eq] + apply subset_antisymm + · rintro _ ⟨⟨x, hxU, rfl⟩, hΨx⟩ + have hxF : x ∈ F := (hΨ_mem_subBd_iff x (hU_Δ hxU)).mp hΨx + rw [hΨ_fix x hxF] + exact hxF + · intro x hxF + obtain ⟨v, hv, hxv⟩ := mem_iUnion₂.mp hxF + have hxU : x ∈ Γ.drawing.U := + graphDrawingSubgraphU_subset_drawing_U Γ G (Or.inl (mem_iUnion₂.mpr ⟨v, hbar'G hv, hxv⟩)) + refine ⟨?_, hsubBd_Δ ▸ hF_sub hxF⟩ + rw [← hΨ_fix x hxF] + exact mem_image_of_mem Ψ hxU + have hΔ₀'_inter_bd : Δ₀' ∩ subBd Δ ⊆ ⋃ v ∈ Ω'.bar, graphDrawingVertexSet Γ' v := by + rw [hF_eq] + rintro _ ⟨⟨x, hxΔ₀, rfl⟩, hΨx⟩ + have hxF : x ∈ F := (hΨ_mem_subBd_iff x (hΔ₀_sub hxΔ₀)).mp hΨx + rw [hΨ_fix x hxF] + exact hxF + have hbd' : ∀ v ∈ V(G), (graphDrawingVertexSet Γ' v ⊆ subBd Δ ↔ v ∈ Ω'.bar) := by + intro v hv + constructor + · intro hsub + let x := (Γ.iso.vertexEquiv ⟨v, hv⟩).1 + have hxv : x ∈ graphDrawingVertexSet Γ v := ⟨hv, rfl⟩ + have hxΔ : x ∈ Δ := hU_Δ (Γ.drawing.V_subset_U (Γ.iso.vertexEquiv ⟨v, hv⟩).2) + have hΨx : Ψ x ∈ subBd Δ := hsub (hvert' v ▸ mem_image_of_mem Ψ hxv) + have hxF : x ∈ F := (hΨ_mem_subBd_iff x hxΔ).mp hΨx + obtain ⟨u, hu, hxu⟩ := mem_iUnion₂.mp hxF + rcases hxu with ⟨huG, hux⟩ + have heq : Γ.iso.vertexEquiv ⟨u, huG⟩ = Γ.iso.vertexEquiv ⟨v, hv⟩ := Subtype.ext hux + have huv : u = v := Subtype.mk.inj (Γ.iso.vertexEquiv.injective heq) + exact huv ▸ hu + · intro hv' + rw [hvert_fix v hv', hsubBd_Δ] + exact (subset_biUnion_of_mem (u := fun u => graphDrawingVertexSet Γ u) hv').trans hF_sub + have hbd₀' : ∀ v ∈ V(G), (graphDrawingVertexSet Γ' v ⊆ subBd Δ₀' ↔ v ∈ Ω₀.bar) := by + intro v hv + rw [← hbd₀ v hv, hvert' v, hbd₀_eq] + constructor + · intro hsub x hxv + have hxΔ : x ∈ Δ := hU_Δ (Γ.drawing.V_subset_U (by + rcases hxv with ⟨_, rfl⟩; exact (Γ.iso.vertexEquiv ⟨v, hv⟩).2)) + obtain ⟨y, hy_bd₀, hyx⟩ := hsub (mem_image_of_mem Ψ hxv) + have hyΔ : y ∈ Δ := by + rcases hinner with ⟨rfl, _⟩ | ⟨hΔ₀_disc, _⟩ + · simp [subBd] at hy_bd₀ + · exact hΔ₀_sub (Surface.discBd_subset Δ₀ (subBd_eq_discBd_plane hΔ₀_disc ▸ hy_bd₀)) + exact hΨ_inj hyΔ hxΔ hyx ▸ hy_bd₀ + · exact image_mono + have hagrees' : DrawingAgreesWithOArcHomeo Γ' Ω' (subBd Δ) φ := by + refine ⟨fun v hv => ?_, fun v₁ v₂ v₃ h => ?_⟩ + · rw [hvert_fix v hv] + exact hagrees.1 v (hbar hv) + · have hv₁ : v₁ ∈ Ω'.bar := h.2.1 v₁ (by simp) + have hv₂ : v₂ ∈ Ω'.bar := h.2.1 v₂ (by simp) + have hv₃ : v₃ ∈ Ω'.bar := h.2.1 v₃ (by simp) + rw [hvert_fix v₁ hv₁, hvert_fix v₂ hv₂, hvert_fix v₃ hv₃] + exact hagrees.2 v₁ v₂ v₃ (hcw v₁ v₂ v₃ h) + exact ⟨Ψ, Ψ', Γ', Δ₀', hΨ_cont, hΨ'_cont, hΨ_left, hΨ_inj, hΨ_sub, rfl, hΔ₀'_sub, + hU'_eq, hU'_sub, hvert', hvert_fix, hsubU', hU'_inter_bd, hΔ₀'_inter_bd, + hbd', hbd₀', hagrees', hinner'⟩ + +/-- Restricting the outer cyclic permutation `N.Ω` of a rural neighborhood `N` to any `N'.Ω` with +`N'.Ω.bar ⊆ N.Ω.bar` whose clockwise triples are clockwise in `N.Ω` preserves rurality. -/ +theorem Neighborhood.IsRural.restrict_outer {N N' : Neighborhood α β} + (hrural : N.IsRural) (hG : N'.G = N.G) (hΩ₀ : N'.Ω₀ = N.Ω₀) + (hbar : N'.Ω.bar ⊆ N.Ω.bar) + (hcw : ∀ v₁ v₂ v₃ : α, N'.Ω.IsClockwise3 v₁ v₂ v₃ → N.Ω.IsClockwise3 v₁ v₂ v₃) : + N'.IsRural := by + obtain ⟨Γ, Δ, Δ₀, hΔ, hΔ₀_sub, hU_sub, hbd, hbd₀, ⟨φ, hφ_cw, hagrees⟩, hinner⟩ := hrural + have hbar'G : N'.Ω.bar ⊆ V(N.G) := hG ▸ N'.bar_subset + obtain ⟨_, _, Γ', Δ₀', _, _, _, _, _, _, hΔ₀'_sub, _, hU'_sub, _, _, _, _, _, hbd', hbd₀', + hagrees', hinner'⟩ := + exists_clean_presentation_of_restrict_outer hbar'G hbar hcw Γ Δ Δ₀ + hΔ hΔ₀_sub hU_sub hbd hbd₀ φ hagrees hinner + cases N; cases N' + dsimp at hG hΩ₀ ⊢ + subst hG; subst hΩ₀ + exact ⟨Γ', Δ, Δ₀', hΔ, hΔ₀'_sub, hU'_sub, hbd', hbd₀', ⟨φ, hφ_cw, hagrees'⟩, hinner'⟩ + +/-- If `Γ` is a drawing of `G` and `α_pt v = (Γ.iso.vertexEquiv ⟨v, hv⟩).1` for all `v ∈ V(G)`, +then `DrawingAgreesWithOArcHomeo Γ Ω C φ` implies `AgreesWithOArcHomeo α_pt Ω C φ`. -/ +theorem agreesWithOArcHomeo_of_drawingAgreesWithOArcHomeo + {S : Type w} [TopologicalSpace S] {G : Graph α β} + (Γ : GraphDrawing G S) {Ω : CyclicPerm α} (hbar : Ω.bar ⊆ V(G)) + {C : Set S} {φ : Circle ≃ₜ C} {α_pt : α → S} + (hα : ∀ v (hv : v ∈ V(G)), α_pt v = (Γ.iso.vertexEquiv ⟨v, hv⟩).1) + (h : DrawingAgreesWithOArcHomeo Γ Ω C φ) : + AgreesWithOArcHomeo α_pt Ω C φ := by + refine ⟨fun v hv => ?_, fun v₁ v₂ v₃ hcw => ?_⟩ + · have hvG : v ∈ V(G) := hbar hv + have hsub := h.1 v hv + rw [graphDrawingVertexSet_eq_singleton' Γ hvG, singleton_subset_iff, ← hα v hvG] at hsub + exact hsub + · obtain ⟨t₁, t₂, t₃, ht₁₂, ht₂₃, ht₃₁, h₁, h₂, h₃⟩ := h.2 v₁ v₂ v₃ hcw + have hv₁ : v₁ ∈ V(G) := hbar (hcw.2.1 v₁ (by simp)) + have hv₂ : v₂ ∈ V(G) := hbar (hcw.2.1 v₂ (by simp)) + have hv₃ : v₃ ∈ V(G) := hbar (hcw.2.1 v₃ (by simp)) + rw [graphDrawingVertexSet_eq_singleton' Γ hv₁, mem_singleton_iff, ← hα v₁ hv₁] at h₁ + rw [graphDrawingVertexSet_eq_singleton' Γ hv₂, mem_singleton_iff, ← hα v₂ hv₂] at h₂ + rw [graphDrawingVertexSet_eq_singleton' Γ hv₃, mem_singleton_iff, ← hα v₃ hv₃] at h₃ + exact ⟨t₁, t₂, t₃, ht₁₂, ht₂₃, ht₃₁, h₁, h₂, h₃⟩ + +/-- A 3-cycle on three pairwise distinct elements `u₁, u₂, u₃`. -/ +private noncomputable def cyclicPermOfThree (u₁ u₂ u₃ : α) + (h₁₂ : u₁ ≠ u₂) (h₂₃ : u₂ ≠ u₃) (h₁₃ : u₁ ≠ u₃) : CyclicPerm α := by + classical + let f : α → α := fun x => if x = u₁ then u₂ else if x = u₂ then u₃ else u₁ + have hf₁ : f u₁ = u₂ := by simp [f] + have hf₂ : f u₂ = u₃ := by simp [f, h₁₂.symm] + have hf₃ : f u₃ = u₁ := by simp [f, h₁₃.symm, h₂₃.symm] + have hfin : ({u₁, u₂, u₃} : Set α).Finite := + ((finite_singleton u₃).insert u₂).insert u₁ + refine + { bar := {u₁, u₂, u₃} + toFun := f + finite_bar := hfin + bijOn := ⟨?_, ?_, ?_⟩ + single_orbit := ?_ } + · rintro x (rfl | rfl | rfl) <;> simp [hf₁, hf₂, hf₃] + · rintro x (rfl | rfl | rfl) y (rfl | rfl | rfl) hxy <;> + simp only [hf₁, hf₂, hf₃] at hxy + · rfl + · exact (h₂₃ hxy).elim + · exact (h₁₂ hxy.symm).elim + · exact (h₂₃ hxy.symm).elim + · rfl + · exact (h₁₃ hxy.symm).elim + · exact (h₁₂ hxy).elim + · exact (h₁₃ hxy).elim + · rfl + · rintro x (rfl | rfl | rfl) + · exact ⟨u₃, by simp, hf₃⟩ + · exact ⟨u₁, by simp, hf₁⟩ + · exact ⟨u₂, by simp, hf₂⟩ + · rintro x (rfl | rfl | rfl) y (rfl | rfl | rfl) + · exact ⟨0, rfl⟩ + · exact ⟨1, hf₁⟩ + · exact ⟨2, by simp [Function.iterate_succ_apply', hf₁, hf₂]⟩ + · exact ⟨2, by simp [Function.iterate_succ_apply', hf₂, hf₃]⟩ + · exact ⟨0, rfl⟩ + · exact ⟨1, hf₂⟩ + · exact ⟨1, hf₃⟩ + · exact ⟨2, by simp [Function.iterate_succ_apply', hf₃, hf₁]⟩ + · exact ⟨0, rfl⟩ + +private theorem isClockwise3_cyclicPermOfThree_iff {u₁ u₂ u₃ : α} + (h₁₂ : u₁ ≠ u₂) (h₂₃ : u₂ ≠ u₃) (h₁₃ : u₁ ≠ u₃) {v₁ v₂ v₃ : α} : + (cyclicPermOfThree u₁ u₂ u₃ h₁₂ h₂₃ h₁₃).IsClockwise3 v₁ v₂ v₃ → + (v₁ = u₁ ∧ v₂ = u₂ ∧ v₃ = u₃) ∨ + (v₁ = u₂ ∧ v₂ = u₃ ∧ v₃ = u₁) ∨ + (v₁ = u₃ ∧ v₂ = u₁ ∧ v₃ = u₂) := by + classical + let Ω := cyclicPermOfThree u₁ u₂ u₃ h₁₂ h₂₃ h₁₃ + have hf₁ : Ω.toFun u₁ = u₂ := by simp [Ω, cyclicPermOfThree] + have hf₂ : Ω.toFun u₂ = u₃ := by simp [Ω, cyclicPermOfThree, h₁₂.symm] + have hf₃ : Ω.toFun u₃ = u₁ := by simp [Ω, cyclicPermOfThree, h₁₃.symm, h₂₃.symm] + intro ⟨hnodup, hmem, hhit⟩ + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or] at hnodup + obtain ⟨⟨hv₁₂, hv₁₃⟩, hv₂₃, _⟩ := hnodup + have h1 : v₁ ∈ ({u₁, u₂, u₃} : Set α) := hmem v₁ (by simp) + have h2 : v₂ ∈ ({u₁, u₂, u₃} : Set α) := hmem v₂ (by simp) + have h3 : v₃ ∈ ({u₁, u₂, u₃} : Set α) := hmem v₃ (by simp) + have hfin : ({u₁, u₂, u₃} : Set α).Finite := + ((finite_singleton u₃).insert u₂).insert u₁ + have hbar_sub : ({u₁, u₂, u₃} : Set α) ⊆ {v | v ∈ [v₁, v₂, v₃]} := by + have hsub : ({v₁, v₂, v₃} : Set α) ⊆ {u₁, u₂, u₃} := by + rintro x (rfl | rfl | rfl) <;> assumption + have hcard₁ : ({v₁, v₂, v₃} : Set α).ncard = 3 := by + rw [ncard_insert_of_notMem (by simp [hv₁₂, hv₁₃]), + ncard_insert_of_notMem (by simp [hv₂₃]), ncard_singleton] + have hcard₂ : ({u₁, u₂, u₃} : Set α).ncard ≤ 3 := + (ncard_insert_le _ _).trans (Nat.add_le_add_right ((ncard_insert_le _ _).trans (by simp)) 1) + have heq := eq_of_subset_of_ncard_le hsub (hcard₂.trans hcard₁.symm.le) hfin + intro x hx + rw [← heq] at hx + simpa using hx + have hlen : 0 < [v₁, v₂, v₃].length := by simp + have h01 := hhit 0 hlen + obtain ⟨k, hk1, hkeq, _, hkmin⟩ := h01 + have hk_eq_1 : k = 1 := by + by_contra hne + have hlt : 1 < k := lt_of_le_of_ne hk1 (Ne.symm hne) + refine hkmin 1 le_rfl hlt (hbar_sub ?_) + exact Ω.bijOn.1 h1 + subst hk_eq_1 + change Ω.toFun v₁ = v₂ at hkeq + rcases h1 with rfl | rfl | rfl <;> rcases h2 with rfl | rfl | rfl <;> + rcases h3 with rfl | rfl | rfl <;> + try (exfalso; first | exact hv₁₂ rfl | exact hv₁₃ rfl | exact hv₂₃ rfl) + · exact Or.inl ⟨rfl, rfl, rfl⟩ + · rw [hf₁] at hkeq; exact (h₂₃ hkeq).elim + · rw [hf₂] at hkeq; exact (h₁₃ hkeq.symm).elim + · exact Or.inr (Or.inl ⟨rfl, rfl, rfl⟩) + · exact Or.inr (Or.inr ⟨rfl, rfl, rfl⟩) + · rw [hf₃] at hkeq; exact (h₁₂ hkeq).elim + +/-- For any subset `K ⊆ α` of cardinality `≤ 3` whose image under `α_pt` is injective and lies in +an `O`-arc `C` with homeomorphism `φ : Circle ≃ₜ C`, there exists a cyclic permutation `Ω_K` with +`Ω_K.bar = K` agreeing with `φ`. -/ +theorem exists_cyclicPerm_agreesWithOArcHomeo_of_ncard_le_three + {S : Type w} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) + (α_pt : α → S) {K : Set α} (hfin : K.Finite) (hle : K.ncard ≤ 3) + (hinj : InjOn α_pt K) (hK_C : ∀ v ∈ K, α_pt v ∈ C) : + ∃ Ω_K : CyclicPerm α, Ω_K.bar = K ∧ AgreesWithOArcHomeo α_pt Ω_K C φ := by + classical + have hcases : K.ncard = 0 ∨ K.ncard = 1 ∨ K.ncard = 2 ∨ K.ncard = 3 := by omega + rcases hcases with h0 | h1 | h2 | h3 + · have hK : K = ∅ := (ncard_eq_zero hfin).mp h0 + subst hK + refine ⟨⟨∅, id, finite_empty, bijOn_empty id, fun _ h => h.elim⟩, rfl, + ⟨fun _ h => h.elim, fun v₁ _ _ hcw => (hcw.2.1 v₁ (by simp)).elim⟩⟩ + · obtain ⟨a, rfl⟩ := ncard_eq_one.mp h1 + refine ⟨⟨{a}, id, finite_singleton a, bijOn_singleton.mpr rfl, fun x hx y hy => + ⟨0, by rw [mem_singleton_iff.mp hx, mem_singleton_iff.mp hy]; rfl⟩⟩, rfl, + ⟨fun v hv => hK_C v hv, fun v₁ v₂ v₃ ⟨hnodup, hmem, _⟩ => ?_⟩⟩ + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or] at hnodup + have hv₁ : v₁ = a := hmem v₁ (by simp) + have hv₂ : v₂ = a := hmem v₂ (by simp) + exact (hnodup.1.1 (hv₁.trans hv₂.symm)).elim + · obtain ⟨a, b, hab, rfl⟩ := ncard_eq_two.mp h2 + let f : α → α := fun x => if x = a then b else a + have hfa : f a = b := by simp [f] + have hfb : f b = a := by simp [f, hab.symm] + have hfin₂ : ({a, b} : Set α).Finite := (finite_singleton b).insert a + have hbij : BijOn f {a, b} {a, b} := by + refine ⟨?_, ?_, ?_⟩ + · rintro x (rfl | rfl) <;> simp [hfa, hfb] + · rintro x (rfl | rfl) y (rfl | rfl) hxy <;> + simp only [hfa, hfb] at hxy + · rfl + · exact (hab hxy.symm).elim + · exact (hab hxy).elim + · rfl + · rintro x (rfl | rfl) + · exact ⟨b, by simp, hfb⟩ + · exact ⟨a, by simp, hfa⟩ + have hcyc : ∀ x ∈ ({a, b} : Set α), ∀ y ∈ ({a, b} : Set α), ∃ k : ℕ, (f^[k]) x = y := by + rintro x (rfl | rfl) y (rfl | rfl) + · exact ⟨0, rfl⟩ + · exact ⟨1, hfa⟩ + · exact ⟨1, hfb⟩ + · exact ⟨0, rfl⟩ + let Ω₂ : CyclicPerm α := ⟨{a, b}, f, hfin₂, hbij, hcyc⟩ + refine ⟨Ω₂, rfl, ⟨fun v hv => hK_C v hv, fun v₁ v₂ v₃ ⟨hnodup, hmem, _⟩ => ?_⟩⟩ + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or] at hnodup + have hv₁ : v₁ ∈ ({a, b} : Set α) := hmem v₁ (by simp) + have hv₂ : v₂ ∈ ({a, b} : Set α) := hmem v₂ (by simp) + have hv₃ : v₃ ∈ ({a, b} : Set α) := hmem v₃ (by simp) + rcases hv₁ with rfl | rfl <;> rcases hv₂ with rfl | rfl <;> rcases hv₃ with rfl | rfl <;> + tauto + · obtain ⟨a, b, c, hab, hac, hbc, rfl⟩ := ncard_eq_three.mp h3 + let θ : α → ℝ := fun v => + if hv : v ∈ ({a, b, c} : Set α) then + Complex.arg ((φ.symm ⟨α_pt v, hK_C v hv⟩ : Circle) : ℂ) + else 0 + have hθ_exp : ∀ v (hv : v ∈ ({a, b, c} : Set α)), + (φ (Circle.exp (θ v))).1 = α_pt v := by + intro v hv + simp only [θ, hv, dite_true, Circle.exp_arg, Homeomorph.apply_symm_apply] + have hθ_gt : ∀ v (hv : v ∈ ({a, b, c} : Set α)), -Real.pi < θ v := by + intro v hv + simp only [θ, hv, dite_true] + exact Complex.neg_pi_lt_arg _ + have hθ_le : ∀ v (hv : v ∈ ({a, b, c} : Set α)), θ v ≤ Real.pi := by + intro v hv + simp only [θ, hv, dite_true] + exact Complex.arg_le_pi _ + have hθ_inj : ∀ u ∈ ({a, b, c} : Set α), ∀ v ∈ ({a, b, c} : Set α), + θ u = θ v → u = v := by + intro u hu v hv huv + have hexp : (φ (Circle.exp (θ u))).1 = (φ (Circle.exp (θ v))).1 := by rw [huv] + rw [hθ_exp u hu, hθ_exp v hv] at hexp + exact hinj hu hv hexp + have hwlog : ∀ u₁ u₂ u₃ : α, + ({u₁, u₂, u₃} : Set α) = {a, b, c} → + u₁ ≠ u₂ → u₂ ≠ u₃ → u₁ ≠ u₃ → + θ u₁ < θ u₂ → θ u₂ < θ u₃ → + ∃ Ω_K : CyclicPerm α, Ω_K.bar = {a, b, c} ∧ AgreesWithOArcHomeo α_pt Ω_K C φ := by + intro u₁ u₂ u₃ hset h₁₂ h₂₃ h₁₃ hlt₁₂ hlt₂₃ + have hu₁ : u₁ ∈ ({a, b, c} : Set α) := hset ▸ by simp + have hu₂ : u₂ ∈ ({a, b, c} : Set α) := hset ▸ by simp + have hu₃ : u₃ ∈ ({a, b, c} : Set α) := hset ▸ by simp + refine ⟨cyclicPermOfThree u₁ u₂ u₃ h₁₂ h₂₃ h₁₃, hset, + ⟨fun v hv => hK_C v (hset ▸ hv), fun v₁ v₂ v₃ hcw => ?_⟩⟩ + have hgt₁ := hθ_gt u₁ hu₁ + have hle₃ := hθ_le u₃ hu₃ + have hexp₂π : ∀ t : ℝ, Circle.exp (t + 2 * Real.pi) = Circle.exp t := + fun t => Circle.exp_add_two_pi t + rcases isClockwise3_cyclicPermOfThree_iff h₁₂ h₂₃ h₁₃ hcw with + ⟨h1, h2, h3⟩ | ⟨h1, h2, h3⟩ | ⟨h1, h2, h3⟩ <;> rw [h1, h2, h3] + · exact ⟨θ u₁, θ u₂, θ u₃, hlt₁₂, hlt₂₃, by linarith, + hθ_exp u₁ hu₁, hθ_exp u₂ hu₂, hθ_exp u₃ hu₃⟩ + · refine ⟨θ u₂, θ u₃, θ u₁ + 2 * Real.pi, hlt₂₃, by linarith, by linarith, + hθ_exp u₂ hu₂, hθ_exp u₃ hu₃, ?_⟩ + rw [hexp₂π, hθ_exp u₁ hu₁] + · refine ⟨θ u₃, θ u₁ + 2 * Real.pi, θ u₂ + 2 * Real.pi, by linarith, by linarith, by linarith, + hθ_exp u₃ hu₃, ?_, ?_⟩ + · rw [hexp₂π, hθ_exp u₁ hu₁] + · rw [hexp₂π, hθ_exp u₂ hu₂] + have ha : a ∈ ({a, b, c} : Set α) := by simp + have hb : b ∈ ({a, b, c} : Set α) := by simp + have hc : c ∈ ({a, b, c} : Set α) := by simp + have hθ_ab : θ a ≠ θ b := fun h => hab (hθ_inj a ha b hb h) + have hθ_ac : θ a ≠ θ c := fun h => hac (hθ_inj a ha c hc h) + have hθ_bc : θ b ≠ θ c := fun h => hbc (hθ_inj b hb c hc h) + rcases lt_or_gt_of_ne hθ_ab with hab' | hba' + · rcases lt_or_gt_of_ne hθ_bc with hbc' | hcb' + · exact hwlog a b c rfl hab hbc hac hab' hbc' + · rcases lt_or_gt_of_ne hθ_ac with hac' | hca' + · exact hwlog a c b (by ext; simp; tauto) hac hbc.symm hab hac' hcb' + · exact hwlog c a b (by ext; simp; tauto) hac.symm hab hbc.symm hca' hab' + · rcases lt_or_gt_of_ne hθ_ac with hac' | hca' + · exact hwlog b a c (by ext; simp; tauto) hab.symm hac hbc hba' hac' + · rcases lt_or_gt_of_ne hθ_bc with hbc' | hcb' + · exact hwlog b c a (by ext; simp; tauto) hbc hac.symm hab.symm hbc' hca' + · exact hwlog c b a (by ext; simp; tauto) hbc.symm hab.symm hac.symm hcb' hba' + +end + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/DiscPlacement.lean b/LeanPool/GraphMinor/GM09/DiscPlacement.lean new file mode 100644 index 0000000000..82f7fe48e4 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/DiscPlacement.lean @@ -0,0 +1,328 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.EarCompare +public import LeanPool.GraphMinor.GM09.RuralAdd + +/-! +# Placing small discs in a closed disc + +The last step of (11.11) of Graph Minors IX places a closed disc for each small clique of a rural +neighborhood, so that the discs meet only at common vertices. This file holds the plane facts that +step needs. + +A closed disc contains a smaller closed disc that meets its boundary in any given finite set +(`exists_inscribed_disc`). Each point of a closed disc lies on the boundary of an arbitrarily small +closed disc that meets the outer boundary at most there (`exists_small_disc_at`). Finitely many +lines can be thickened one after another to closed discs that meet only at common ends +(`exists_lenses`). +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Metric GraphMinor GraphMinor.Surface + +universe u + +/-- A point of the unit circle is not in the closed convex hull of a small ball and a finite subset +of the unit circle that misses it. -/ +theorem not_mem_closure_convexHull_of_sphere {F : Set ℂ} (hfin : F.Finite) (hF : F ⊆ sphere 0 1) + {x : ℂ} (hx : ‖x‖ = 1) (hxF : x ∉ F) : + x ∉ closure (convexHull ℝ (F ∪ closedBall 0 (1 / 2))) := by + set A : Set ℂ := F ∪ closedBall 0 (1 / 2) with hA + have hAc : IsCompact A := hfin.isCompact.union (isCompact_closedBall _ _) + have hAne : A.Nonempty := ⟨0, Or.inr (by simp)⟩ + have hlt : ∀ y ∈ A, inner ℝ x y < 1 := by + rintro y (hy | hy) + · have hy1 : ‖y‖ = 1 := by simpa using hF hy + refine lt_of_le_of_ne ?_ fun h => hxF ?_ + · have := real_inner_le_norm x y + rwa [hx, hy1, one_mul] at this + · rw [(inner_eq_one_iff_of_norm_eq_one hx hy1).mp h] + exact hy + · have hy1 : ‖y‖ ≤ 1 / 2 := by simpa using hy + have := real_inner_le_norm x y + rw [hx] at this + linarith + have hcf : Continuous fun y : ℂ => inner ℝ x y := continuous_const.inner continuous_id + obtain ⟨y₀, hy₀, hmax⟩ := hAc.exists_isMaxOn hAne hcf.continuousOn + have hsub : A ⊆ {y : ℂ | inner ℝ x y ≤ inner ℝ x y₀} := fun y hy => hmax hy + have hconv : Convex ℝ {y : ℂ | inner ℝ x y ≤ inner ℝ x y₀} := + convex_halfSpace_le (f := fun y => inner ℝ x y) + ⟨fun a b => inner_add_right _ _ _, fun c a => inner_smul_right _ _ _⟩ _ + have hcl : IsClosed {y : ℂ | inner ℝ x y ≤ inner ℝ x y₀} := + isClosed_le hcf continuous_const + intro h + have h' := closure_minimal (convexHull_min hsub hconv) hcl h + have h₁ : inner ℝ x x ≤ inner ℝ x y₀ := h' + have h₂ := hlt y₀ hy₀ + rw [real_inner_self_eq_norm_sq, hx] at h₁ + linarith + +/-- A finite subset of the unit circle is the trace on the circle of a closed disc in the unit +disc that has the finite set on its boundary. -/ +theorem exists_inscribed_disc_unit {F : Set ℂ} (hF : F.Finite) (hs : F ⊆ sphere 0 1) : + ∃ K ⊆ closedBall (0 : ℂ) 1, IsClosedDisc K ∧ F ⊆ discBd K ∧ K ∩ sphere 0 1 = F := by + set A : Set ℂ := F ∪ closedBall 0 (1 / 2) with hA + have hAb : A ⊆ closedBall 0 1 := by + refine union_subset (hs.trans sphere_subset_closedBall) + (closedBall_subset_closedBall (by norm_num)) + have hK : closure (convexHull ℝ A) ⊆ closedBall 0 1 := + closure_minimal (convexHull_min hAb (convex_closedBall 0 1)) isClosed_closedBall + have hbdd : Bornology.IsBounded (closure (convexHull ℝ A)) := isBounded_closedBall.subset hK + have hbig : closedBall (0 : ℂ) (1 / 2) ⊆ closure (convexHull ℝ A) := + (subset_union_right.trans (subset_convexHull ℝ A)).trans subset_closure + have hne : (interior (closure (convexHull ℝ A))).Nonempty := by + refine ⟨0, interior_mono hbig ?_⟩ + rw [interior_closedBall _ (by norm_num)] + simp + obtain ⟨hd, hbd⟩ := isClosedDisc_of_convex (convex_convexHull ℝ A).closure hne hbdd + isClosed_closure + have hmem : ∀ x ∈ F, x ∈ closure (convexHull ℝ A) := fun x hx => + subset_closure (subset_convexHull ℝ A (Or.inl hx)) + refine ⟨_, hK, hd, ?_, ?_⟩ + · intro x hx + rw [hbd, isClosed_closure.frontier_eq] + refine ⟨hmem x hx, fun hi => ?_⟩ + have h := interior_mono hK hi + rw [interior_closedBall _ (by norm_num)] at h + have h1 : ‖x‖ = 1 := by simpa using hs hx + simp [h1] at h + · ext x + constructor + · rintro ⟨hx, hxs⟩ + by_contra hxF + exact not_mem_closure_convexHull_of_sphere hF hs (by simpa using hxs) hxF hx + · intro hx + exact ⟨hmem x hx, hs hx⟩ + +/-- A finite subset of the boundary of a closed disc is the trace on that boundary of a closed disc +inside it that has the finite set on its own boundary. -/ +theorem exists_inscribed_disc {S : Type u} [TopologicalSpace S] {D F : Set S} (hD : IsClosedDisc D) + (hF : F.Finite) (hs : F ⊆ discBd D) : + ∃ K ⊆ D, IsClosedDisc K ∧ F ⊆ discBd K ∧ K ∩ discBd D = F := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hFD : F ⊆ D := hs.trans (Surface.discBd_subset D) + have himg : h '' F ⊆ sphere 0 1 := by + rw [← c.bd] + exact image_mono hs + obtain ⟨K, hK, hd, hb, ht⟩ := exists_inscribed_disc_unit (hF.image h) himg + obtain ⟨hd', hbd'⟩ := c.disc_g hK hd + refine ⟨g '' K, c.g_subset hK, hd', ?_, ?_⟩ + · rw [hbd'] + intro x hx + exact ⟨h x, hb (mem_image_of_mem h hx), c.gh (hFD hx)⟩ + · ext x + constructor + · rintro ⟨⟨z, hz, rfl⟩, hzb⟩ + have hzs : h (g z) ∈ sphere (0 : ℂ) 1 := by + rw [← c.bd] + exact mem_image_of_mem h hzb + rw [c.hg (hK hz)] at hzs + have hzm : z ∈ K ∩ sphere 0 1 := ⟨hz, hzs⟩ + rw [ht] at hzm + obtain ⟨y, hy, rfl⟩ := hzm + rwa [c.gh (hFD hy)] + · intro hx + exact ⟨⟨h x, Surface.discBd_subset K (hb (mem_image_of_mem h hx)), c.gh (hFD hx)⟩, hs hx⟩ + +/-- A closed round disc of positive radius in the complex plane is a closed disc. -/ +theorem isClosedDisc_closedBall_complex (c : ℂ) {r : ℝ} (hr : 0 < r) : + IsClosedDisc (closedBall c r) ∧ discBd (closedBall c r) = sphere c r := by + have h := isClosedDisc_of_convex (convex_closedBall c r) + (by + rw [interior_closedBall _ hr.ne'] + exact ⟨c, by simpa using hr⟩) isBounded_closedBall isClosed_closedBall + rw [frontier_closedBall _ hr.ne'] at h + exact h + +/-- Each point of the unit disc is on the boundary of a small round disc in the unit disc, which +meets the unit circle at most in that point. -/ +theorem exists_small_ball_at {p : ℂ} (hp : ‖p‖ ≤ 1) {ε : ℝ} (hε : 0 < ε) : + ∃ (c : ℂ) (r : ℝ), 0 < r ∧ closedBall c r ⊆ closedBall 0 1 ∧ closedBall c r ⊆ ball p ε ∧ + p ∈ sphere c r ∧ closedBall c r ∩ sphere 0 1 ⊆ {p} := by + have hnear : ∀ {c : ℂ} {r : ℝ}, 3 * r < ε → dist p c = r → closedBall c r ⊆ ball p ε := by + intro c r hr hd x hx + have h₁ : dist x c ≤ r := hx + have := dist_triangle x c p + rw [dist_comm c p, hd] at this + rw [mem_ball] + have hr0 : 0 ≤ r := hd ▸ dist_nonneg + linarith + rcases hp.lt_or_eq with hlt | heq + · set r : ℝ := min (ε / 4) ((1 - ‖p‖) / 4) with hr + have hr0 : 0 < r := lt_min (by linarith) (by linarith) + have hr1 : r ≤ ε / 4 := min_le_left _ _ + have hr2 : r ≤ (1 - ‖p‖) / 4 := min_le_right _ _ + have hdist : dist p (p + (r : ℂ)) = r := by + rw [dist_eq_norm] + simp [abs_of_pos hr0] + have hbound : ∀ x ∈ closedBall (p + (r : ℂ)) r, ‖x‖ < 1 := by + intro x hx + have h₁ : dist x (p + (r : ℂ)) ≤ r := hx + have h₂ : ‖x‖ ≤ dist x (p + (r : ℂ)) + ‖p + (r : ℂ)‖ := by + rw [dist_eq_norm] + simpa using norm_add_le (x - (p + (r : ℂ))) (p + (r : ℂ)) + have h₃ : ‖p + (r : ℂ)‖ ≤ ‖p‖ + r := by + refine (norm_add_le _ _).trans ?_ + simp [abs_of_pos hr0] + linarith + refine ⟨p + (r : ℂ), r, hr0, fun x hx => ?_, hnear (by linarith) hdist, hdist, ?_⟩ + · simpa using (hbound x hx).le + · rintro x ⟨hx, hxs⟩ + have h1 : ‖x‖ = 1 := by simpa using hxs + exact absurd h1 (hbound x hx).ne + · set r : ℝ := min (ε / 4) (1 / 2) with hr + have hr0 : 0 < r := lt_min (by linarith) (by norm_num) + have hr1 : r ≤ ε / 4 := min_le_left _ _ + have hr2 : r ≤ 1 / 2 := min_le_right _ _ + have hc : ‖(1 - r) • p‖ = 1 - r := by + rw [norm_smul, heq, mul_one, Real.norm_eq_abs, abs_of_pos (by linarith)] + have hdist : dist p ((1 - r) • p) = r := by + rw [dist_eq_norm] + have : p - (1 - r) • p = r • p := by + rw [sub_smul, one_smul] + abel + rw [this, norm_smul, heq, mul_one, Real.norm_eq_abs, abs_of_pos hr0] + refine ⟨(1 - r) • p, r, hr0, fun x hx => ?_, hnear (by linarith) hdist, hdist, ?_⟩ + · have h₁ : dist x ((1 - r) • p) ≤ r := hx + have h₂ : ‖x‖ ≤ dist x ((1 - r) • p) + ‖(1 - r) • p‖ := by + rw [dist_eq_norm] + simpa using norm_add_le (x - (1 - r) • p) ((1 - r) • p) + simp only [mem_closedBall, dist_zero_right] + linarith + · rintro x ⟨hx, hxs⟩ + have h1 : ‖x‖ = 1 := by simpa using hxs + have h₁ : ‖x - (1 - r) • p‖ ≤ r := by + have : dist x ((1 - r) • p) ≤ r := hx + rwa [dist_eq_norm] at this + have hsq : ‖x - (1 - r) • p‖ ^ 2 ≤ r ^ 2 := by + have := norm_nonneg (x - (1 - r) • p) + gcongr + rw [norm_sub_sq_real, h1, hc, inner_smul_right] at hsq + have hin : (1 : ℝ) ≤ inner ℝ x p := by + have hpos : 0 < 1 - r := by linarith + nlinarith + have hle := real_inner_le_norm x p + rw [h1, heq] at hle + have heq' : inner ℝ x p = (1 : ℝ) := le_antisymm (by linarith) hin + exact (inner_eq_one_iff_of_norm_eq_one h1 heq).mp heq' + +/-- Each point of a closed disc is on the boundary of a closed disc inside it, in a given +neighbourhood of the point, which meets the outer boundary at most in that point. -/ +theorem exists_small_disc_at {S : Type u} [TopologicalSpace S] {D W : Set S} (hD : IsClosedDisc D) + {a : S} (ha : a ∈ D) (hW : IsOpen W) (haW : a ∈ W) : + ∃ K ⊆ D, K ⊆ W ∧ IsClosedDisc K ∧ a ∈ discBd K ∧ K ∩ discBd D ⊆ {a} := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hp : h a ∈ closedBall (0 : ℂ) 1 := c.hm ha + have hcont : ContinuousWithinAt g (closedBall 0 1) (h a) := c.gc _ hp + have hnhds : g ⁻¹' W ∈ 𝓝[closedBall 0 1] h a := + hcont (hW.mem_nhds (by rw [c.gh ha]; exact haW)) + obtain ⟨ε, hε, hball⟩ := Metric.mem_nhdsWithin_iff.mp hnhds + obtain ⟨z, r, hr, hsub, hnear, hmem, htouch⟩ := exists_small_ball_at (by simpa using hp) hε + obtain ⟨hd, hbd⟩ := isClosedDisc_closedBall_complex z hr + obtain ⟨hd', hbd'⟩ := c.disc_g hsub hd + refine ⟨g '' closedBall z r, c.g_subset hsub, ?_, hd', ?_, ?_⟩ + · rintro _ ⟨y, hy, rfl⟩ + exact hball ⟨hnear hy, hsub hy⟩ + · rw [hbd', hbd] + exact ⟨h a, hmem, c.gh ha⟩ + · rintro _ ⟨⟨y, hy, rfl⟩, hyb⟩ + have hys : h (g y) ∈ sphere (0 : ℂ) 1 := by + rw [← c.bd] + exact mem_image_of_mem h hyb + rw [c.hg (hsub hy)] at hys + have := htouch ⟨hy, hys⟩ + rw [mem_singleton_iff] at this ⊢ + rw [this, c.gh ha] + +/-- A closed set which meets the boundary of a closed disc in a finite set misses a point of the +interior of the disc. -/ +theorem exists_interior_point_off {Δ Z : Set EuclideanPlane} (hΔ : IsClosedDisc Δ) (hZ : IsClosed Z) + (hfin : (Z ∩ discBd Δ).Finite) : ∃ a ∈ interior Δ, a ∉ Z := by + have hO := hΔ.isOArc_discBd + obtain ⟨p, q, -, hp, hq, -, hpq, -⟩ := hO.exists_three + have hinf : (discBd Δ).Infinite := hO.isPreconnected.infinite_of_nontrivial ⟨p, hp, q, hq, hpq⟩ + obtain ⟨b, hb, hbZ⟩ := (hinf.sdiff hfin).nonempty + have hbZ' : b ∉ Z := fun h => hbZ ⟨h, hb⟩ + have hcl : b ∈ closure (interior Δ) := by + rw [closure_interior_of_isClosedDisc hΔ] + exact Surface.discBd_subset Δ hb + obtain ⟨a, haZ, hai⟩ := mem_closure_iff.mp hcl Zᶜ hZ.isOpen_compl hbZ' + exact ⟨a, hai, haZ⟩ + +/-- Thicken finitely many lines to closed discs, one after another. Each disc meets its closed set +`R i` only in the ends of its line, and two of the discs meet only in common ends. -/ +theorem exists_lenses {ι : Type*} (I : Finset ι) {l R : ι → Set EuclideanPlane} + {a b : ι → EuclideanPlane} (hl : ∀ i ∈ I, IsLineWithEnds (l i) (a i) (b i)) + (hab : ∀ i ∈ I, a i ≠ b i) (hR : ∀ i ∈ I, IsClosed (R i)) + (hmeet : ∀ i ∈ I, l i ∩ R i ⊆ {a i, b i}) + (hcross : ∀ i ∈ I, ∀ j ∈ I, i ≠ j → l i ⊆ R j) : + ∃ D : ι → Set EuclideanPlane, (∀ i ∈ I, IsClosedDisc (D i) ∧ l i ⊆ D i ∧ + D i ∩ R i ⊆ {a i, b i} ∧ a i ∈ discBd (D i) ∧ b i ∈ discBd (D i) ∧ + IsPreconnected (D i \ {a i, b i})) ∧ + ∀ i ∈ I, ∀ j ∈ I, i ≠ j → D i ∩ D j ⊆ {a i, b i} ∩ {a j, b j} := by + classical + induction I using Finset.induction_on with + | empty => exact ⟨fun _ => ∅, by simp, by simp⟩ + | insert i I hi ih => + obtain ⟨D, hD, hp⟩ := ih (fun j hj => hl j (Finset.mem_insert_of_mem hj)) + (fun j hj => hab j (Finset.mem_insert_of_mem hj)) + (fun j hj => hR j (Finset.mem_insert_of_mem hj)) + (fun j hj => hmeet j (Finset.mem_insert_of_mem hj)) + (fun j hj k hk => hcross j (Finset.mem_insert_of_mem hj) k (Finset.mem_insert_of_mem hk)) + have hii := Finset.mem_insert_self i I + have hclosed : IsClosed (R i ∪ ⋃ j ∈ I, D j) := + (hR i hii).union (I.finite_toSet.isClosed_biUnion fun j hj => (hD j hj).1.isCompact.isClosed) + have hne : ∀ j ∈ I, i ≠ j := fun j hj h => hi (h ▸ hj) + have hlz : l i ∩ (R i ∪ ⋃ j ∈ I, D j) ⊆ {a i, b i} := by + rintro x ⟨hx, hx' | hx'⟩ + · exact hmeet i hii ⟨hx, hx'⟩ + · obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.mp hx' + have hin : x ∈ l i ∩ R j := ⟨hx, hcross i hii j (Finset.mem_insert_of_mem hj) (hne j hj) hx⟩ + have hend : x ∈ ({a j, b j} : Set _) := (hD j hj).2.2.1 ⟨hxj, hin.2⟩ + have hlj : l j ⊆ R i := hcross j (Finset.mem_insert_of_mem hj) i hii (hne j hj).symm + have hxl : x ∈ l j := by + rcases hend with rfl | rfl + · exact (hl j (Finset.mem_insert_of_mem hj)).left_mem + · exact (hl j (Finset.mem_insert_of_mem hj)).right_mem + exact hmeet i hii ⟨hx, hlj hxl⟩ + obtain ⟨L, -, hL, hsub, hdz, hau, hbu, hpc, -⟩ := + exists_plane_lens (hl i hii) (hab i hii) hclosed hlz + refine ⟨Function.update D i L, ?_, ?_⟩ + · intro j hj + rcases Finset.mem_insert.mp hj with rfl | hj' + · simp only [Function.update_self] + exact ⟨hL, hsub, fun x hx => hdz ⟨hx.1, Or.inl hx.2⟩, hau, hbu, hpc⟩ + · rw [Function.update_of_ne (hne j hj').symm] + exact hD j hj' + · have hcr : ∀ j ∈ I, L ∩ D j ⊆ {a i, b i} ∩ {a j, b j} := by + intro j hj x hx + have hend : x ∈ ({a i, b i} : Set _) := + hdz ⟨hx.1, Or.inr (mem_iUnion₂.mpr ⟨j, hj, hx.2⟩)⟩ + refine ⟨hend, (hD j hj).2.2.1 ⟨hx.2, ?_⟩⟩ + refine hcross i hii j (Finset.mem_insert_of_mem hj) (hne j hj) ?_ + rcases hend with rfl | rfl + · exact (hl i hii).left_mem + · exact (hl i hii).right_mem + intro j hj k hk hjk + rcases Finset.mem_insert.mp hj with rfl | hj' <;> + rcases Finset.mem_insert.mp hk with rfl | hk' + · exact (hjk rfl).elim + · rw [Function.update_self, Function.update_of_ne hjk.symm] + exact hcr k hk' + · rw [Function.update_of_ne hjk, Function.update_self, inter_comm, inter_comm {a j, b j}] + exact hcr j hj' + · rw [Function.update_of_ne (hne j hj').symm, Function.update_of_ne (hne k hk').symm] + exact hp j hj' k hk' hjk + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/EarCompare.lean b/LeanPool/GraphMinor/GM09/EarCompare.lean new file mode 100644 index 0000000000..c4bc0d5381 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/EarCompare.lean @@ -0,0 +1,525 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.EarDisc + +/-! +# Comparing two ears on a closed disc + +Fix a closed disc `Δ₀` in the plane. An ear is a line with both ends on the boundary of `Δ₀` and no +other point in `Δ₀`, and `EarData` records the disc it cuts off. Here we show that two ears with +disjoint open parts have nested discs, or discs that meet only in common ends. We also show what +happens with three lines from one point. These are the facts behind (11.1) of Graph Minors IX. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +/-- A connected set that misses the boundary of a closed disc lies inside it or outside it. -/ +theorem subset_interior_or_compl {W T : Set EuclideanPlane} (hW : IsClosedDisc W) + (hT : IsPreconnected T) (hd : Disjoint T (discBd W)) : T ⊆ interior W ∨ T ⊆ Wᶜ := by + refine IsPreconnected.subset_or_subset isOpen_interior hW.isCompact.isClosed.isOpen_compl + (disjoint_left.mpr fun x hx hx' => hx' (interior_subset hx)) (fun x hx => ?_) hT + by_cases hxW : x ∈ W + · left + rw [interior_eq_discInt_plane hW] + exact ⟨hxW, disjoint_left.mp hd hx⟩ + · exact Or.inr hxW + +/-- If the boundary of a closed disc lies in another closed disc, so does the whole disc. -/ +theorem subset_of_discBd_subset {W W' : Set EuclideanPlane} (hW : IsClosedDisc W) + (hW' : IsClosedDisc W') (h : discBd W' ⊆ W) : W' ⊆ W := by + have hc := isPreconnected_compl_of_isClosedDisc hW + have hd : Disjoint Wᶜ (discBd W') := disjoint_left.mpr fun x hx hx' => hx (h hx') + rcases subset_interior_or_compl hW' hc hd with hs | hs + · exfalso + have hu : W ∪ W' = univ := by + ext x + simp only [mem_union, mem_univ, iff_true] + by_cases hx : x ∈ W + · exact Or.inl hx + · exact Or.inr (interior_subset (hs hx)) + have hcpt : IsCompact (univ : Set EuclideanPlane) := hu ▸ hW.isCompact.union hW'.isCompact + have : NoncompactSpace EuclideanPlane := NormedSpace.noncompactSpace ℝ _ + exact noncompact_univ _ hcpt + · intro x hx + by_contra hn + exact hs hn hx + +/-- Two closed discs in the plane with the same boundary are equal. -/ +theorem eq_of_discBd_eq {W W' : Set EuclideanPlane} (hW : IsClosedDisc W) (hW' : IsClosedDisc W') + (h : discBd W = discBd W') : W = W' := + Subset.antisymm (subset_of_discBd_subset hW' hW (h ▸ Surface.discBd_subset W')) + (subset_of_discBd_subset hW hW' (h ▸ Surface.discBd_subset W)) + +theorem closure_interior_of_isClosedDisc {W : Set EuclideanPlane} (hW : IsClosedDisc W) : + closure (interior W) = W := by + refine Subset.antisymm (closure_minimal interior_subset hW.isCompact.isClosed) ?_ + rw [interior_eq_discInt_plane hW] + exact hW.subset_closure_discInt + +/-- A line with the same ends as two lines that meet only in those ends, and that lies in their +union, is one of the two lines. -/ +theorem line_eq_or_eq_of_subset_union {R T₁ T₂ : Set EuclideanPlane} + {m z : EuclideanPlane} (hR : IsLineWithEnds R m z) (h₁ : IsLineWithEnds T₁ m z) + (h₂ : IsLineWithEnds T₂ m z) (hi : T₁ ∩ T₂ = {m, z}) (hs : R ⊆ T₁ ∪ T₂) : + R = T₁ ∨ R = T₂ := by + have hRo := hR.isPreconnected_diff + have hsub : ∀ {T : Set EuclideanPlane}, IsLineWithEnds T m z → R \ {m, z} ⊆ T → R = T := by + intro T hT hRT + have hRs : R ⊆ T := by + intro w hw + by_cases hm : w ∈ ({m, z} : Set EuclideanPlane) + · rcases hm with rfl | rfl + · exact hT.left_mem + · exact hT.right_mem + · exact hRT ⟨hw, hm⟩ + exact hT.eq_of_subset (hR.isPreconnected_diff.subset_closure sdiff_subset + hR.subset_closure_diff) hRs hR.left_mem hR.right_mem + rw [isPreconnected_closed_iff] at hRo + by_cases hn₁ : ((R \ {m, z}) ∩ T₁).Nonempty + · by_cases hn₂ : ((R \ {m, z}) ∩ T₂).Nonempty + · exfalso + obtain ⟨w, hw, hw₁, hw₂⟩ := hRo T₁ T₂ h₁.isCompact.isClosed h₂.isCompact.isClosed + (fun w hw => hs hw.1) hn₁ hn₂ + exact hw.2 (hi ▸ ⟨hw₁, hw₂⟩) + · left + refine hsub h₁ fun w hw => (hs hw.1).resolve_right fun h => hn₂ ⟨w, hw, h⟩ + · right + refine hsub h₂ fun w hw => (hs hw.1).resolve_left fun h => hn₁ ⟨w, hw, h⟩ + +/-- The data of an ear on `Δ₀`: the line `c` with ends `a`, `b`, the disc `L` it cuts off, and the +parts `A`, `B` of the boundary of `Δ₀` under `L` and away from `L`. -/ +structure EarData (Δ₀ c L A B : Set EuclideanPlane) (a b : EuclideanPlane) : Prop where + disc₀ : IsClosedDisc Δ₀ + line : IsLineWithEnds c a b + ne : a ≠ b + left_mem : a ∈ discBd Δ₀ + right_mem : b ∈ discBd Δ₀ + inter_c : c ∩ Δ₀ ⊆ {a, b} + lineA : IsLineWithEnds A a b + lineB : IsLineWithEnds B a b + union : A ∪ B = discBd Δ₀ + inter : A ∩ B = {a, b} + disc : IsClosedDisc L + bdL : discBd L = A ∪ c + L_inter : L ∩ Δ₀ = A + discW : IsClosedDisc (Δ₀ ∪ L) + bdW : discBd (Δ₀ ∪ L) = B ∪ c + +/-- Every line with the right ends is an ear. -/ +theorem exists_earData {Δ₀ c : Set EuclideanPlane} {a b : EuclideanPlane} (h₀ : IsClosedDisc Δ₀) + (hc : IsLineWithEnds c a b) (hab : a ≠ b) (ha : a ∈ discBd Δ₀) (hb : b ∈ discBd Δ₀) + (hi : c ∩ Δ₀ ⊆ {a, b}) : ∃ L A B, EarData Δ₀ c L A B a b := by + obtain ⟨A, B, L, hA, hB, hu, hin, hL, hbL, hLi, hW, hbW⟩ := exists_ear_disc h₀ hc hab ha hb hi + exact ⟨L, A, B, ⟨h₀, hc, hab, ha, hb, hi, hA, hB, hu, hin, hL, hbL, hLi, hW, hbW⟩⟩ + +namespace EarData + +variable {Δ₀ c L A B c' L' A' B' : Set EuclideanPlane} {a b a' b' : EuclideanPlane} + +theorem c_subset_L (E : EarData Δ₀ c L A B a b) : c ⊆ L := + fun _ hx => Surface.discBd_subset L (E.bdL ▸ Or.inr hx) + +theorem A_subset_L (E : EarData Δ₀ c L A B a b) : A ⊆ L := + fun _ hx => Surface.discBd_subset L (E.bdL ▸ Or.inl hx) + +theorem A_subset (E : EarData Δ₀ c L A B a b) : A ⊆ discBd Δ₀ := E.union ▸ subset_union_left + +theorem B_subset (E : EarData Δ₀ c L A B a b) : B ⊆ discBd Δ₀ := E.union ▸ subset_union_right + +theorem left_mem_c (E : EarData Δ₀ c L A B a b) : a ∈ c := E.line.left_mem + +theorem right_mem_c (E : EarData Δ₀ c L A B a b) : b ∈ c := E.line.right_mem + +theorem disjoint_open (E : EarData Δ₀ c L A B a b) : Disjoint (c \ {a, b}) Δ₀ := + disjoint_left.mpr fun _ hx hx' => hx.2 (E.inter_c ⟨hx.1, hx'⟩) + +theorem isPreconnected_open (E : EarData Δ₀ c L A B a b) : IsPreconnected (c \ {a, b}) := + E.line.isPreconnected_diff + +theorem nonempty_open (E : EarData Δ₀ c L A B a b) : (c \ {a, b}).Nonempty := + E.line.nonempty_sdiff + +theorem c_subset_W (E : EarData Δ₀ c L A B a b) : c ⊆ Δ₀ ∪ L := + fun _ hx => Or.inr (E.c_subset_L hx) + +/-- The interior of the disc of an ear misses `Δ₀`. -/ +theorem disjoint_interior (E : EarData Δ₀ c L A B a b) : Disjoint (interior L) Δ₀ := by + rw [disjoint_left] + intro x hx hx₀ + have hxA : x ∈ A := E.L_inter ▸ ⟨interior_subset hx, hx₀⟩ + have hb : x ∈ discBd L := E.bdL ▸ Or.inl hxA + rw [interior_eq_discInt_plane E.disc] at hx + exact hx.2 hb + +/-- A point of `Δ₀ ∪ L` outside `Δ₀` is in `L`. -/ +theorem mem_L_of_mem_W (_E : EarData Δ₀ c L A B a b) {x : EuclideanPlane} (hx : x ∈ Δ₀ ∪ L) + (hn : x ∉ Δ₀) : x ∈ L := hx.resolve_left hn + +theorem L_subset_of_W_subset (E : EarData Δ₀ c L A B a b) {X : Set EuclideanPlane} + (hX : IsClosed X) (hs : Δ₀ ∪ L ⊆ Δ₀ ∪ X) : L ⊆ X := by + rw [← closure_interior_of_isClosedDisc E.disc] + refine closure_minimal (fun x hx => ?_) hX + exact (hs (Or.inr (interior_subset hx))).resolve_left (disjoint_left.mp E.disjoint_interior hx) + +/-- If the open part of a second ear lies in the disc of the first, so does the disc of the +second. -/ +theorem subset_of_open_subset (E : EarData Δ₀ c L A B a b) (E' : EarData Δ₀ c' L' A' B' a' b') + (h : c' \ {a', b'} ⊆ L) : L' ⊆ L := by + refine E'.L_subset_of_W_subset E.disc.isCompact.isClosed + (subset_of_discBd_subset E.discW E'.discW ?_) + rw [E'.bdW] + rintro x (hx | hx) + · exact Or.inl (Surface.discBd_subset _ (E'.B_subset hx)) + · by_cases hm : x ∈ ({a', b'} : Set EuclideanPlane) + · rcases hm with rfl | rfl + · exact Or.inl (Surface.discBd_subset _ E'.left_mem) + · exact Or.inl (Surface.discBd_subset _ E'.right_mem) + · exact Or.inr (h ⟨hx, hm⟩) + +/-- The open part of a second ear lies in the disc of the first or outside its union with `Δ₀`, +provided the two open parts are disjoint. -/ +theorem open_subset_or (E : EarData Δ₀ c L A B a b) (E' : EarData Δ₀ c' L' A' B' a' b') + (hd : Disjoint (c \ {a, b}) (c' \ {a', b'})) : + c' \ {a', b'} ⊆ L ∨ c' \ {a', b'} ⊆ (Δ₀ ∪ L)ᶜ := by + have hdb : Disjoint (c' \ {a', b'}) (discBd (Δ₀ ∪ L)) := by + rw [E.bdW, disjoint_left] + rintro x hx (hb | hc) + · exact disjoint_left.mp E'.disjoint_open hx (Surface.discBd_subset _ (E.B_subset hb)) + · by_cases hm : x ∈ ({a, b} : Set EuclideanPlane) + · refine disjoint_left.mp E'.disjoint_open hx ?_ + rcases hm with rfl | rfl + · exact Surface.discBd_subset _ E.left_mem + · exact Surface.discBd_subset _ E.right_mem + · exact disjoint_left.mp hd ⟨hc, hm⟩ hx + rcases subset_interior_or_compl E.discW E'.isPreconnected_open hdb with hs | hs + · left + intro x hx + exact (interior_subset (hs hx)).resolve_left (disjoint_left.mp E'.disjoint_open hx) + · exact Or.inr hs + +/-- Two ears with disjoint open parts have nested discs, or discs that meet in common ends. -/ +theorem nested_or_inter (E : EarData Δ₀ c L A B a b) (E' : EarData Δ₀ c' L' A' B' a' b') + (hd : Disjoint (c \ {a, b}) (c' \ {a', b'})) : + L' ⊆ L ∨ L ⊆ L' ∨ L ∩ L' ⊆ {a, b} ∩ {a', b'} := by + rcases E.open_subset_or E' hd with h₁ | h₁ + · exact Or.inl (E.subset_of_open_subset E' h₁) + rcases E'.open_subset_or E hd.symm with h₂ | h₂ + · exact Or.inr (Or.inl (E'.subset_of_open_subset E h₂)) + -- Each disc misses the interior of the other union. + have hout : ∀ {c₁ L₁ A₁ B₁ c₂ L₂ A₂ B₂ : Set EuclideanPlane} {a₁ b₁ a₂ b₂ : EuclideanPlane}, + EarData Δ₀ c₁ L₁ A₁ B₁ a₁ b₁ → EarData Δ₀ c₂ L₂ A₂ B₂ a₂ b₂ → + c₁ \ {a₁, b₁} ⊆ (Δ₀ ∪ L₂)ᶜ → c₂ \ {a₂, b₂} ⊆ (Δ₀ ∪ L₁)ᶜ → + interior L₁ ⊆ (Δ₀ ∪ L₂)ᶜ := by + intro c₁ L₁ A₁ B₁ c₂ L₂ A₂ B₂ a₁ b₁ a₂ b₂ E₁ E₂ h₁ h₂ + have hdb : Disjoint (interior L₁) (discBd (Δ₀ ∪ L₂)) := by + rw [E₂.bdW, disjoint_left] + intro x hx hb + have hxL : x ∈ L₁ := interior_subset hx + have hx₀ : x ∉ Δ₀ := disjoint_left.mp E₁.disjoint_interior hx + rcases hb with hb | hc + · exact hx₀ (Surface.discBd_subset _ (E₂.B_subset hb)) + · by_cases hm : x ∈ ({a₂, b₂} : Set EuclideanPlane) + · rcases hm with rfl | rfl + · exact hx₀ (Surface.discBd_subset _ E₂.left_mem) + · exact hx₀ (Surface.discBd_subset _ E₂.right_mem) + · exact h₂ ⟨hc, hm⟩ (Or.inr hxL) + have hconn : IsPreconnected (interior L₁) := by + rw [interior_eq_discInt_plane E₁.disc] + exact E₁.disc.isPreconnected_discInt + rcases subset_interior_or_compl E₂.discW hconn hdb with hs | hs + · exfalso + have hsub : L₁ ⊆ L₂ := E₁.L_subset_of_W_subset E₂.disc.isCompact.isClosed (by + apply union_subset_union_right Δ₀ ?_ |>.trans (Subset.refl _) + rw [← closure_interior_of_isClosedDisc E₁.disc] + refine closure_minimal (fun x hx => ?_) E₂.disc.isCompact.isClosed + exact (interior_subset (hs hx)).resolve_left (disjoint_left.mp E₁.disjoint_interior hx)) + obtain ⟨y, hy⟩ := E₁.nonempty_open + exact h₁ hy (Or.inr (hsub (E₁.c_subset_L hy.1))) + · exact hs + have hi₁ := hout E E' h₂ h₁ + have hi₂ := hout E' E h₁ h₂ + right + right + -- A point of both discs is on the boundary of both unions. + have hbd : ∀ {c₁ L₁ A₁ B₁ L₂ : Set EuclideanPlane} {a₁ b₁ : EuclideanPlane}, + EarData Δ₀ c₁ L₁ A₁ B₁ a₁ b₁ → IsClosedDisc L₂ → interior L₂ ⊆ (Δ₀ ∪ L₁)ᶜ → + ∀ x ∈ L₂, x ∈ Δ₀ ∪ L₁ → x ∈ B₁ ∪ c₁ := by + intro c₁ L₁ A₁ B₁ L₂ a₁ b₁ E₁ hL₂ hi x hx hxW + rw [← E₁.bdW] + by_contra hn + have hint : x ∈ interior (Δ₀ ∪ L₁) := by + rw [interior_eq_discInt_plane E₁.discW] + exact ⟨hxW, hn⟩ + rw [← closure_interior_of_isClosedDisc hL₂] at hx + obtain ⟨y, hyi, hyL⟩ := mem_closure_iff.mp hx _ isOpen_interior hint + exact hi hyL (interior_subset hyi) + rintro x ⟨hx, hx'⟩ + have h₁' := hbd E' E.disc hi₁ x hx (Or.inr hx') + have h₂' := hbd E E'.disc hi₂ x hx' (Or.inr hx) + by_cases hx₀ : x ∈ Δ₀ + · have ha₁ : x ∈ A := E.L_inter ▸ ⟨hx, hx₀⟩ + have ha₂ : x ∈ A' := E'.L_inter ▸ ⟨hx', hx₀⟩ + refine ⟨?_, ?_⟩ + · rcases h₂' with h | h + · exact E.inter ▸ ⟨ha₁, h⟩ + · exact E.inter_c ⟨h, hx₀⟩ + · rcases h₁' with h | h + · exact E'.inter ▸ ⟨ha₂, h⟩ + · exact E'.inter_c ⟨h, hx₀⟩ + · exfalso + have hc₁ : x ∈ c \ {a, b} := by + rcases h₂' with h | h + · exact (hx₀ (Surface.discBd_subset _ (E.B_subset h))).elim + · refine ⟨h, ?_⟩ + rintro (rfl | rfl) + · exact hx₀ (Surface.discBd_subset _ E.left_mem) + · exact hx₀ (Surface.discBd_subset _ E.right_mem) + have hc₂ : x ∈ c' \ {a', b'} := by + rcases h₁' with h | h + · exact (hx₀ (Surface.discBd_subset _ (E'.B_subset h))).elim + · refine ⟨h, ?_⟩ + rintro (rfl | rfl) + · exact hx₀ (Surface.discBd_subset _ E'.left_mem) + · exact hx₀ (Surface.discBd_subset _ E'.right_mem) + exact disjoint_left.mp hd hc₁ hc₂ + +/-- A closed disc bounded by the line of an ear and a line in the boundary of `Δ₀` with the same +ends is the disc `L` of the ear or the union of `L` with `Δ₀`. -/ +theorem eq_or_eq_of_discBd (E : EarData Δ₀ c L A B a b) {W T : Set EuclideanPlane} + (hW : IsClosedDisc W) (hT : IsLineWithEnds T a b) (hTs : T ⊆ discBd Δ₀) + (hb : discBd W = c ∪ T) : W = L ∨ W = Δ₀ ∪ L := by + have hTu : T ⊆ A ∪ B := E.union ▸ hTs + rcases line_eq_or_eq_of_subset_union hT E.lineA E.lineB E.inter hTu with rfl | rfl + · left + exact eq_of_discBd_eq hW E.disc (by rw [hb, E.bdL, union_comm]) + · right + exact eq_of_discBd_eq hW E.discW (by rw [hb, E.bdW, union_comm]) + +/-- If a closed disc contains `Δ₀`, and is bounded by the line of an ear and a line in the boundary +of `Δ₀`, then it is the union of `Δ₀` with the disc of the ear. -/ +theorem eq_W_of_discBd (E : EarData Δ₀ c L A B a b) {W T : Set EuclideanPlane} + (hW : IsClosedDisc W) (hT : IsLineWithEnds T a b) (hTs : T ⊆ discBd Δ₀) + (hb : discBd W = c ∪ T) (hsub : Δ₀ ⊆ W) : W = Δ₀ ∪ L := by + rcases E.eq_or_eq_of_discBd hW hT hTs hb with rfl | h + · exfalso + obtain ⟨x, hx, hn⟩ := E.lineB.nonempty_sdiff + have hxΔ : x ∈ Δ₀ := Surface.discBd_subset _ (E.B_subset hx) + have hxA : x ∈ A := E.L_inter ▸ ⟨hsub hxΔ, hxΔ⟩ + exact hn (E.inter ▸ ⟨hxA, hx⟩) + · exact h + +/-- A point of the boundary of `Δ₀` that is not an end of the ear, and is a limit of points outside +`Δ₀ ∪ L`, is on the side `B` of the boundary away from `L`. -/ +theorem mem_B_of_mem_closure (E : EarData Δ₀ c L A B a b) {z : EuclideanPlane} + (hz : z ∈ discBd Δ₀) (hza : z ≠ a) (hzb : z ≠ b) (hcl : z ∈ closure (Δ₀ ∪ L)ᶜ) : z ∈ B := by + by_contra hn + have hzΔ : z ∈ Δ₀ := Surface.discBd_subset _ hz + have hzA : z ∈ A := by + have : z ∈ A ∪ B := E.union ▸ hz + exact this.resolve_right hn + have hzc : z ∉ c := fun h => by + rcases E.inter_c ⟨h, hzΔ⟩ with h' | h' + · exact hza h' + · exact hzb h' + have hi : z ∈ interior (Δ₀ ∪ L) := by + rw [interior_eq_discInt_plane E.discW] + refine ⟨Or.inl hzΔ, ?_⟩ + rw [E.bdW] + rintro (h | h) + · exact hn h + · exact hzc h + obtain ⟨y, hyi, hy⟩ := mem_closure_iff.mp hcl _ isOpen_interior hi + exact hy (interior_subset hyi) + +/-- Three lines from a point `m` outside `Δ₀` to points `x`, `y`, `z` of its boundary. If the line +to `z` leaves the union of `Δ₀` with the disc of the ear through `x` and `y`, then the line to `y` +lies in the disc of the ear through `x` and `z`, or the line to `x` lies in the disc of the ear +through `y` and `z`. -/ +theorem leg_swap {ℓx ℓy ℓz L₁ A₁ B₁ L₂ A₂ B₂ L₃ A₃ B₃ : Set EuclideanPlane} + {m x y z : EuclideanPlane} (E₁ : EarData Δ₀ (ℓx ∪ ℓy) L₁ A₁ B₁ x y) + (E₂ : EarData Δ₀ (ℓx ∪ ℓz) L₂ A₂ B₂ x z) (E₃ : EarData Δ₀ (ℓy ∪ ℓz) L₃ A₃ B₃ y z) + (hx : IsLineWithEnds ℓx m x) (hy : IsLineWithEnds ℓy m y) (hz : IsLineWithEnds ℓz m z) + (hm : m ∉ Δ₀) (hzB : z ∈ B₁) (hzx : z ≠ x) (hzy : z ≠ y) + (hxy : ℓx ∩ ℓy = {m}) (hout : ℓz \ {m, z} ⊆ (Δ₀ ∪ L₁)ᶜ) : + ℓy \ {y} ⊆ L₂ ∨ ℓx \ {x} ⊆ L₃ := by + have hmz : m ≠ z := fun h => hm (h ▸ Surface.discBd_subset _ E₂.right_mem) + have hmbd : m ∈ discBd (Δ₀ ∪ L₁) := E₁.bdW ▸ Or.inr (Or.inl hx.left_mem) + have hzbd : z ∈ discBd (Δ₀ ∪ L₁) := E₁.bdW ▸ Or.inl hzB + have hi : ℓz ∩ (Δ₀ ∪ L₁) ⊆ {m, z} := by + rintro w ⟨hw, hw'⟩ + by_contra hn + exact hout ⟨hw, hn⟩ hw' + obtain ⟨R, R', L₄, hR, hR', hRu, hRi, hL₄, -, -, hW₄, hb₄⟩ := + exists_ear_disc E₁.discW hz hmz hmbd hzbd hi + obtain ⟨Bx, By, hBx, hBy, hBu, hBi⟩ := E₁.lineB.split hzB hzx hzy + have hsBx : Bx ⊆ Δ₀ := fun w hw => + Surface.discBd_subset _ (E₁.B_subset (hBu ▸ Or.inl hw)) + have hsBy : By ⊆ Δ₀ := fun w hw => + Surface.discBd_subset _ (E₁.B_subset (hBu ▸ Or.inr hw)) + have hmx : m ≠ x := fun h => hm (h ▸ Surface.discBd_subset _ E₁.left_mem) + have hmy : m ≠ y := fun h => hm (h ▸ Surface.discBd_subset _ E₁.right_mem) + have hx_not : ∀ w ∈ ℓx, w ∈ Δ₀ → w = x := by + intro w hw hw₀ + rcases E₁.inter_c ⟨Or.inl hw, hw₀⟩ with h | h + · exact h + · subst h + have : w ∈ ℓx ∩ ℓy := ⟨hw, hy.right_mem⟩ + rw [hxy] at this + exact (hmy this.symm).elim + have hy_not : ∀ w ∈ ℓy, w ∈ Δ₀ → w = y := by + intro w hw hw₀ + rcases E₁.inter_c ⟨Or.inr hw, hw₀⟩ with h | h + · subst h + have : w ∈ ℓx ∩ ℓy := ⟨hx.right_mem, hw⟩ + rw [hxy] at this + exact (hmx this.symm).elim + · exact h + have hxBx : ℓx ∩ Bx = {x} := by + ext w + constructor + · rintro ⟨h₁, h₂⟩ + exact hx_not w h₁ (hsBx h₂) + · rintro rfl + exact ⟨hx.right_mem, hBx.left_mem⟩ + have hyBy : ℓy ∩ By = {y} := by + ext w + constructor + · rintro ⟨h₁, h₂⟩ + exact hy_not w h₁ (hsBy h₂) + · rintro rfl + exact ⟨hy.right_mem, hBy.right_mem⟩ + have hTx : IsLineWithEnds (ℓx ∪ Bx) m z := hx.union hBx hxBx + have hTy : IsLineWithEnds (ℓy ∪ By) m z := hy.union hBy.symm hyBy + have hTi : (ℓx ∪ Bx) ∩ (ℓy ∪ By) = {m, z} := by + ext w + constructor + · rintro ⟨h₁ | h₁, h₂ | h₂⟩ + · have : w ∈ ℓx ∩ ℓy := ⟨h₁, h₂⟩ + rw [hxy] at this + exact Or.inl this + · exfalso + have hwx := hx_not w h₁ (hsBy h₂) + subst hwx + have : w ∈ Bx ∩ By := ⟨hBx.left_mem, h₂⟩ + rw [hBi] at this + exact hzx this.symm + · exfalso + have hwy := hy_not w h₂ (hsBx h₁) + subst hwy + have : w ∈ Bx ∩ By := ⟨h₁, hBy.right_mem⟩ + rw [hBi] at this + exact hzy this.symm + · have : w ∈ Bx ∩ By := ⟨h₁, h₂⟩ + rw [hBi] at this + exact Or.inr this + · rintro (rfl | rfl) + · exact ⟨Or.inl hx.left_mem, Or.inl hy.left_mem⟩ + · exact ⟨Or.inr hBx.right_mem, Or.inr hBy.left_mem⟩ + have hTu : (ℓx ∪ Bx) ∪ (ℓy ∪ By) = discBd (Δ₀ ∪ L₁) := by + rw [E₁.bdW, ← hBu] + ext w + simp only [mem_union] + tauto + have hW₁₄ : Δ₀ ∪ L₁ ⊆ (Δ₀ ∪ L₁) ∪ L₄ := subset_union_left + have hsTy : By ⊆ discBd Δ₀ := fun w hw => E₁.B_subset (hBu ▸ Or.inr hw) + have hsTx : Bx ⊆ discBd Δ₀ := fun w hw => E₁.B_subset (hBu ▸ Or.inl hw) + have hR'sub : R' ⊆ (ℓx ∪ Bx) ∪ (ℓy ∪ By) := by + rw [hTu, ← hRu] + exact subset_union_right + rcases line_eq_or_eq_of_subset_union hR' hTx hTy hTi hR'sub with rfl | rfl + · left + have hWeq := E₂.eq_W_of_discBd hW₄ hBx hsTx + (by rw [hb₄]; ext w; simp only [mem_union]; tauto) + (subset_union_left.trans hW₁₄) + intro w hw + have hwW : w ∈ Δ₀ ∪ L₂ := hWeq ▸ hW₁₄ (E₁.c_subset_W (Or.inr hw.1)) + exact hwW.resolve_left fun h => hw.2 (hy_not w hw.1 h) + · right + have hWeq := E₃.eq_W_of_discBd hW₄ hBy.symm hsTy + (by rw [hb₄]; ext w; simp only [mem_union]; tauto) + (subset_union_left.trans hW₁₄) + intro w hw + have hwW : w ∈ Δ₀ ∪ L₃ := hWeq ▸ hW₁₄ (E₁.c_subset_W (Or.inl hw.1)) + exact hwW.resolve_left fun h => hw.2 (hx_not w hw.1 h) + +/-- Three lines from a point `m` outside `Δ₀`. Either the line to `z` lies in the disc of the ear +through `x` and `y`, or that disc lies properly in the disc of one of the other two ears. -/ +theorem third_leg {ℓx ℓy ℓz L₁ A₁ B₁ L₂ A₂ B₂ L₃ A₃ B₃ : Set EuclideanPlane} + {m x y z : EuclideanPlane} (E₁ : EarData Δ₀ (ℓx ∪ ℓy) L₁ A₁ B₁ x y) + (E₂ : EarData Δ₀ (ℓx ∪ ℓz) L₂ A₂ B₂ x z) (E₃ : EarData Δ₀ (ℓy ∪ ℓz) L₃ A₃ B₃ y z) + (hx : IsLineWithEnds ℓx m x) (hy : IsLineWithEnds ℓy m y) (hz : IsLineWithEnds ℓz m z) + (hm : m ∉ Δ₀) (hzx : z ≠ x) (hzy : z ≠ y) (hxy : ℓx ∩ ℓy = {m}) (hxz : ℓx ∩ ℓz = {m}) + (hyz : ℓy ∩ ℓz = {m}) : + ℓz \ {m, z} ⊆ L₁ ∨ (L₁ ⊆ L₂ ∧ L₁ ≠ L₂) ∨ (L₁ ⊆ L₃ ∧ L₁ ≠ L₃) := by + have hzΔ : z ∈ Δ₀ := Surface.discBd_subset _ E₂.right_mem + have hz_not : ∀ w ∈ ℓz, w ∈ Δ₀ → w = z := by + intro w hw hw₀ + rcases E₂.inter_c ⟨Or.inr hw, hw₀⟩ with h | h + · subst h + have : w ∈ ℓx ∩ ℓz := ⟨hx.right_mem, hw⟩ + rw [hxz] at this + exact (hm (this ▸ hw₀)).elim + · exact h + have hd : Disjoint (ℓz \ {m, z}) (discBd (Δ₀ ∪ L₁)) := by + rw [E₁.bdW, disjoint_left] + rintro w ⟨hw, hn⟩ (h | h | h) + · exact hn (Or.inr (hz_not w hw (Surface.discBd_subset _ (E₁.B_subset h)))) + · have : w ∈ ℓx ∩ ℓz := ⟨h, hw⟩ + rw [hxz] at this + exact hn (Or.inl this) + · have : w ∈ ℓy ∩ ℓz := ⟨h, hw⟩ + rw [hyz] at this + exact hn (Or.inl this) + rcases subset_interior_or_compl E₁.discW hz.isPreconnected_diff hd with hs | hs + · left + intro w hw + refine (interior_subset (hs hw)).resolve_left fun h => hw.2 (Or.inr (hz_not w hw.1 h)) + right + have hzB : z ∈ B₁ := by + refine E₁.mem_B_of_mem_closure E₂.right_mem hzx hzy (closure_mono hs ?_) + exact (hz.subset_closure_diff hz.right_mem) + obtain ⟨t, ht⟩ := hz.nonempty_sdiff + have htL : t ∉ L₁ := fun h => hs ht (Or.inr h) + rcases E₁.leg_swap E₂ E₃ hx hy hz hm hzB hzx hzy hxy hs with h | h + · left + refine ⟨?_, fun heq => htL (heq ▸ E₂.c_subset_L (Or.inr ht.1))⟩ + refine E₂.subset_of_open_subset E₁ fun w hw => ?_ + rcases hw.1 with h' | h' + · exact E₂.c_subset_L (Or.inl h') + · exact h ⟨h', fun h'' => hw.2 (Or.inr h'')⟩ + · right + refine ⟨?_, fun heq => htL (heq ▸ E₃.c_subset_L (Or.inr ht.1))⟩ + refine E₃.subset_of_open_subset E₁ fun w hw => ?_ + rcases hw.1 with h' | h' + · exact h ⟨h', fun h'' => hw.2 (Or.inl h'')⟩ + · exact E₃.c_subset_L (Or.inl h') + +/-- Two ears with the same disc have the same line. -/ +theorem c_eq (E : EarData Δ₀ c L A B a b) (E' : EarData Δ₀ c' L A' B' a' b') : + c = c' := by + have key : ∀ {c₁ c₂ A₁ B₁ A₂ B₂ : Set EuclideanPlane} {a₁ b₁ a₂ b₂ : EuclideanPlane}, + EarData Δ₀ c₁ L A₁ B₁ a₁ b₁ → EarData Δ₀ c₂ L A₂ B₂ a₂ b₂ → c₂ ⊆ c₁ := by + intro c₁ c₂ A₁ B₁ A₂ B₂ a₁ b₁ a₂ b₂ E₁ E₂ + refine E₂.line.subset_closure_diff.trans (closure_minimal ?_ E₁.line.isCompact.isClosed) + intro x hx + have hb : x ∈ discBd L := E₂.bdL ▸ Or.inr hx.1 + rw [E₁.bdL] at hb + refine hb.resolve_left fun h => ?_ + exact disjoint_left.mp E₂.disjoint_open hx (Surface.discBd_subset _ (E₁.A_subset h)) + exact Subset.antisymm (key E' E) (key E E') + +end EarData + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/EarDisc.lean b/LeanPool/GraphMinor/GM09/EarDisc.lean new file mode 100644 index 0000000000..1c87e0c202 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/EarDisc.lean @@ -0,0 +1,447 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.RuralExtend +public import LeanPool.GraphMinor.Surface.SphereDisc +public import LeanPool.GraphMinor.Surface.DiscArcs +public import LeanPool.GraphMinor.Surface.DiscUnion +public import LeanPool.GraphMinor.Surface.PlaneDisc +public import LeanPool.GraphMinor.Surface.Crossing + +/-! +# Adding an ear to a disc in the plane + +A line outside a closed disc `D` with its two ends on the boundary of `D` cuts off one closed disc +`L` from the complement of `D`, on the side away from infinity. The union of `D` and `L` is again a +closed disc. This is the step behind "the union of $\Delta_0$ with all lawns is a closed disc" of +Graph +Minors IX, page 67, and behind the discs `Δ(P)` defined there. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 +open scoped unitInterval + +/-- The complement of a closed disc in the plane is connected. -/ +theorem isPreconnected_compl_of_isClosedDisc {W : Set EuclideanPlane} (hW : IsClosedDisc W) : + IsPreconnected Wᶜ := by + classical + have hF := hW.isOArc_discBd + obtain ⟨A, B, ⟨hne, hc, -, -⟩, hA, hB⟩ := jordan_curve_theorem.{0}.1 _ hF + have hcl : IsClosed W := hW.isCompact.isClosed + have hint : interior W = W \ discBd W := by + rw [interior_eq_discInt_plane hW] + rfl + have hF_cl : IsClosed (discBd W) := hF.isCompact.isClosed + obtain ⟨x, hx⟩ : (interior W).Nonempty := by + rw [hint] + exact hW.nonempty_discInt + have hxF : x ∈ univ \ discBd W := ⟨mem_univ _, (hint ▸ hx : x ∈ W \ discBd W).2⟩ + have hsame : connectedComponentIn (univ \ discBd W) x = interior W := by + apply Subset.antisymm + · refine isPreconnected_connectedComponentIn.subset_left_of_subset_union isOpen_interior + hcl.isOpen_compl ?_ ?_ ⟨x, mem_connectedComponentIn hxF, hx⟩ + · rw [disjoint_left] + exact fun y hy hy' => hy' (interior_subset hy) + · intro y hy + have hyF := connectedComponentIn_subset _ _ hy + by_cases hyW : y ∈ W + · exact Or.inl (hint ▸ ⟨hyW, hyF.2⟩) + · exact Or.inr hyW + · refine IsPreconnected.subset_connectedComponentIn ?_ hx ?_ + · rw [interior_eq_discInt_plane hW] + exact hW.isPreconnected_discInt + · intro y hy + exact ⟨mem_univ _, (hint ▸ hy : y ∈ W \ discBd W).2⟩ + have hmem : connectedComponentIn (univ \ discBd W) x ∈ componentsIn (univ \ discBd W) := + ⟨x, hxF, rfl⟩ + rw [hc, hsame] at hmem + have hbdd : Bornology.IsBounded (interior W) := hW.isCompact.isBounded.subset interior_subset + have hIA : interior W = A := by + rcases hmem with h | h + · exact h + · exact (hB (h ▸ hbdd)).elim + have hBmem : B ∈ componentsIn (univ \ discBd W) := by + rw [hc] + exact Or.inr rfl + obtain ⟨y, hyF, rfl⟩ := hBmem + have heq : Wᶜ = connectedComponentIn (univ \ discBd W) y := by + apply Subset.antisymm + · intro z hz + have hzF : z ∈ univ \ discBd W := ⟨mem_univ _, fun h => hz (Surface.discBd_subset _ h)⟩ + have hzm : connectedComponentIn (univ \ discBd W) z ∈ componentsIn (univ \ discBd W) := + ⟨z, hzF, rfl⟩ + rw [hc] at hzm + rcases hzm with h | h + · exfalso + have := mem_connectedComponentIn hzF + rw [h, ← hIA] at this + exact hz (interior_subset this) + · rw [← h] + exact mem_connectedComponentIn hzF + · intro z hz hzW + have hzF := connectedComponentIn_subset _ _ hz + have hzi : z ∈ interior W := hint ▸ ⟨hzW, hzF.2⟩ + rw [hIA, ← hsame.trans hIA] at hzi + apply hne + rw [← hsame.trans hIA, connectedComponentIn_eq hzi, ← connectedComponentIn_eq hz] + rw [heq] + exact isPreconnected_connectedComponentIn + +section Sphere + +local notation "SHat" => OnePoint EuclideanPlane + +private theorem coe_embedding : IsOpenEmbedding ((↑) : EuclideanPlane → SHat) := + OnePoint.isOpenEmbedding_coe + +/-- A closed disc of the sphere that misses infinity comes from a closed disc of the plane. -/ +private theorem exists_plane_disc {D₀ : Set SHat} (hD₀ : IsClosedDisc D₀) + (hinf : OnePoint.infty ∉ D₀) : + ∃ D : Set EuclideanPlane, (↑) '' D = D₀ ∧ IsClosedDisc D ∧ + discBd D₀ = (↑) '' discBd D := by + classical + let c : EuclideanPlane → SHat := (↑) + have hc : IsOpenEmbedding c := coe_embedding + let r : SHat → EuclideanPlane := invFun c + have hrc : ∀ x, r (c x) = x := leftInverse_invFun hc.injective + have hcr : ∀ p ∈ range c, c (r p) = p := by + rintro _ ⟨x, rfl⟩ + rw [hrc] + have hrcont : ContinuousOn r (range c) := by + rw [continuousOn_iff_continuous_domRestrict] + change Continuous fun y : range c => r y.1 + have : (fun y : range c => r y.1) = hc.isEmbedding.toHomeomorph.symm := by + funext y + obtain ⟨_, x, rfl⟩ := y + apply hc.isEmbedding.toHomeomorph.injective + rw [Homeomorph.apply_symm_apply] + exact Subtype.ext (hcr _ ⟨x, rfl⟩) + rw [this] + exact Homeomorph.continuous _ + have hD₀c : D₀ ⊆ range c := by + intro q hq + induction q using OnePoint.rec with + | infty => exact (hinf hq).elim + | coe x => exact ⟨x, rfl⟩ + obtain ⟨hD, hb⟩ := hD₀.image (hrcont.mono hD₀c) hc.continuous.continuousOn + (fun q hq => hcr q (hD₀c hq)) + have hback : c '' (r '' D₀) = D₀ := by + rw [image_image] + exact (image_congr fun q hq => hcr q (hD₀c hq)).trans (image_id' D₀) + refine ⟨r '' D₀, hback, hD, ?_⟩ + rw [hb, image_image] + exact ((image_congr fun q hq => hcr q (hD₀c (Surface.discBd_subset _ hq))).trans + (image_id' _)).symm + +/-- A closed disc of the plane gives a closed disc of the sphere. -/ +private theorem sphere_disc_image {D : Set EuclideanPlane} (hD : IsClosedDisc D) : + IsClosedDisc (((↑) : EuclideanPlane → SHat) '' D) ∧ + discBd (((↑) : EuclideanPlane → SHat) '' D) = (↑) '' discBd D := by + classical + let c : EuclideanPlane → SHat := (↑) + have hc : IsOpenEmbedding c := coe_embedding + let r : SHat → EuclideanPlane := invFun c + have hrc : ∀ x, r (c x) = x := leftInverse_invFun hc.injective + have hrcont : ContinuousOn r (c '' D) := by + have h : ContinuousOn c D := hc.continuous.continuousOn + rw [continuousOn_iff_continuous_domRestrict] + change Continuous fun y : c '' D => r y.1 + have hmap : (fun y : c '' D => r y.1) = fun y => (hc.isEmbedding.toHomeomorph.symm + ⟨y.1, image_subset_range c D y.2⟩ : EuclideanPlane) := by + funext y + obtain ⟨_, x, -, rfl⟩ := y + rw [hrc] + apply hc.injective + have := hc.isEmbedding.toHomeomorph.apply_symm_apply + ⟨c x, image_subset_range c D ⟨x, ‹_›, rfl⟩⟩ + exact (congrArg Subtype.val this).symm + rw [hmap] + exact (Homeomorph.continuous _).comp (by fun_prop) + exact hD.image hc.continuous.continuousOn hrcont fun x _ => hrc x + +/-- See `exists_ear_disc`. This form names the two open arcs of the boundary. -/ +private theorem ear_finish {D c L J J' : Set EuclideanPlane} {p q : EuclideanPlane} + (hD : IsClosedDisc D) (hpq : p ≠ q) (hJ : IsLineWithEnds (J ∪ {p, q}) p q) + (hJ' : IsLineWithEnds (J' ∪ {p, q}) p q) + (hJJ : Disjoint J J') (hu : J ∪ J' = discBd D \ {p, q}) (hp : p ∈ discBd D) + (hq : q ∈ discBd D) (hc : IsLineWithEnds c p q) (hcJ : Disjoint c J) (hL : IsClosedDisc L) + (hLb : discBd L = (J ∪ {p, q}) ∪ c) (hLD : L ∩ D = J ∪ {p, q}) : + ∃ A A' L : Set EuclideanPlane, IsLineWithEnds A p q ∧ IsLineWithEnds A' p q ∧ + A ∪ A' = discBd D ∧ A ∩ A' = {p, q} ∧ IsClosedDisc L ∧ discBd L = A ∪ c ∧ L ∩ D = A ∧ + IsClosedDisc (D ∪ L) ∧ discBd (D ∪ L) = A' ∪ c := by + have hAA : (J ∪ {p, q}) ∪ (J' ∪ {p, q}) = discBd D := by + rw [union_union_union_comm, hu, union_self, sdiff_union_of_subset] + rintro x (rfl | rfl) + · exact hp + · exact hq + have hinter : (J ∪ {p, q}) ∩ (J' ∪ {p, q}) = {p, q} := by + ext x + constructor + · rintro ⟨h | h, h' | h'⟩ + · exact (disjoint_left.mp hJJ h h').elim + · exact h' + · exact h + · exact h + · intro h + exact ⟨Or.inr h, Or.inr h⟩ + have hsubD : J ∪ {p, q} ⊆ discBd D := hAA ▸ subset_union_left + obtain ⟨h₁, h₂⟩ := disc_union.{0} D L (J ∪ {p, q}) p q hD hL hJ (by rw [inter_comm]; exact hLD) + hsubD (hLb ▸ subset_union_left) + refine ⟨J ∪ {p, q}, J' ∪ {p, q}, L, hJ, hJ', hAA, hinter, hL, hLb, hLD, h₁, ?_⟩ + rw [h₂, hLb] + have hne : ∀ {y}, y ∈ J → y ≠ p ∧ y ≠ q := by + intro y hy + have : y ∈ discBd D \ {p, q} := hu ▸ Or.inl hy + exact ⟨fun h => this.2 (Or.inl h), fun h => this.2 (Or.inr h)⟩ + ext x + constructor + · rintro ⟨hx, hn⟩ + have hxJ : x ∉ J := fun h => hn ⟨Or.inl h, fun h' => by + rcases h' with h' | h' + · exact (hne h).1 h' + · exact (hne h).2 h'⟩ + rcases hx with hx | hx | hx + · rw [← hAA] at hx + rcases hx with (h | h) | h + · exact (hxJ h).elim + · exact Or.inl (Or.inr h) + · exact Or.inl h + · rcases hx with h | h + · exact (hxJ h).elim + · exact Or.inl (Or.inr h) + · exact Or.inr hx + · intro hx + refine ⟨?_, ?_⟩ + · rcases hx with hx | hx + · exact Or.inl (hAA ▸ Or.inr hx) + · exact Or.inr (Or.inr hx) + · rintro ⟨h | h, hn⟩ + · rcases hx with (hx | hx) | hx + · exact disjoint_left.mp hJJ h hx + · exact hn hx + · exact disjoint_left.mp hcJ hx h + · exact hn h + +/-- A line with distinct ends on the boundary of a closed disc `D`, and otherwise outside `D`, cuts +off a closed disc `L` from the complement of `D`. The two ends split the boundary of `D` into lines +`A` and `A'`. The disc `L` is bounded by `A` and the line, it meets `D` exactly in `A`, and `D ∪ L` +is a closed disc bounded by `A'` and the line. -/ +theorem exists_ear_disc {D c : Set EuclideanPlane} {p q : EuclideanPlane} (hD : IsClosedDisc D) + (hc : IsLineWithEnds c p q) (hpq : p ≠ q) (hp : p ∈ discBd D) (hq : q ∈ discBd D) + (hcD : c ∩ D ⊆ {p, q}) : + ∃ A A' L : Set EuclideanPlane, IsLineWithEnds A p q ∧ IsLineWithEnds A' p q ∧ + A ∪ A' = discBd D ∧ A ∩ A' = {p, q} ∧ IsClosedDisc L ∧ discBd L = A ∪ c ∧ L ∩ D = A ∧ + IsClosedDisc (D ∪ L) ∧ discBd (D ∪ L) = A' ∪ c := by + classical + let ι : EuclideanPlane → SHat := (↑) + have hι : IsOpenEmbedding ι := coe_embedding + have hιinj : Injective ι := hι.injective + obtain ⟨hD₁, hD₁b⟩ := sphere_disc_image hD + have hF₁ := hD₁.isOArc_discBd + have hsub : ∀ {X : Set EuclideanPlane} {x : EuclideanPlane}, ι x ∈ ι '' X → x ∈ X := by + rintro X x ⟨y, hy, hyx⟩ + rwa [← hιinj hyx] + obtain ⟨E, hE, hEb, hcov, hmeet⟩ : ∃ E : Set SHat, IsClosedDisc E ∧ discBd E = ι '' discBd D ∧ + ι '' D ∪ E = univ ∧ ι '' D ∩ E = ι '' discBd D := by + obtain ⟨Δ₁, Δ₂, -, h₁, h₂, hb₁, hb₂, hc, hm, -, hu⟩ := + sphere_disc.{0} SHat ⟨Homeomorph.refl _⟩ _ hF₁ + rcases hu _ hD₁ rfl with h | h + · refine ⟨Δ₂, h₂, by rw [hb₂, hD₁b], by rw [h]; exact hc, by rw [h, hm, hD₁b]⟩ + · refine ⟨Δ₁, h₁, by rw [hb₁, hD₁b], by rw [h, union_comm]; exact hc, + by rw [h, inter_comm, hm, hD₁b]⟩ + have hcHat : IsLineWithEnds (ι '' c) (ι p) (ι q) := hc.map_of_embedding hι.isEmbedding + have hne : ι p ≠ ι q := fun h => hpq (hιinj h) + have hcE : ι '' c ⊆ E := by + rintro _ ⟨x, hx, rfl⟩ + by_cases hxD : x ∈ D + · have : x ∈ discBd D := by + rcases hcD ⟨hx, hxD⟩ with rfl | rfl + · exact hp + · exact hq + have h : ι x ∈ ι '' D ∩ E := hmeet ▸ mem_image_of_mem ι this + exact h.2 + · have h : ι x ∈ ι '' D ∪ E := hcov ▸ mem_univ _ + rcases h with h | h + · exact (hxD (hsub h)).elim + · exact h + have hcbd : ι '' c ∩ discBd E = {ι p, ι q} := by + rw [hEb] + ext y + constructor + · rintro ⟨⟨x, hx, rfl⟩, hy⟩ + rcases hcD ⟨hx, Surface.discBd_subset _ (hsub hy)⟩ with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + · rintro (rfl | rfl) + · exact ⟨mem_image_of_mem ι hc.left_mem, mem_image_of_mem ι hp⟩ + · exact ⟨mem_image_of_mem ι hc.right_mem, mem_image_of_mem ι hq⟩ + have hinf : OnePoint.infty ∈ E := by + have h : (OnePoint.infty : SHat) ∈ ι '' D ∪ E := hcov ▸ mem_univ _ + rcases h with ⟨x, -, hx⟩ | h + · exact (OnePoint.coe_ne_infty x hx).elim + · exact h + have hinfc : (OnePoint.infty : SHat) ∉ ι '' c := by + rintro ⟨x, -, hx⟩ + exact OnePoint.coe_ne_infty x hx + obtain ⟨φ⟩ := hD.isOArc_discBd + obtain ⟨I₁, I₂, hI₁, hI₂, hd, hu, -, -, hl₁, hl₂⟩ := exists_open_arcs φ hp hq hpq + have hne₁ : I₁.Nonempty := by + obtain ⟨x, hx, hxn⟩ := hl₁.nonempty_sdiff + rcases hx with h | h + · exact ⟨x, h⟩ + · exact (hxn h).elim + have hne₂ : I₂.Nonempty := by + obtain ⟨x, hx, hxn⟩ := hl₂.nonempty_sdiff + rcases hx with h | h + · exact ⟨x, h⟩ + · exact (hxn (by rw [pair_comm]; exact h)).elim + have hmem {y} (hy : y ∈ I₁ ∪ I₂) : y ≠ p ∧ y ≠ q := by + have hy' : y ∈ discBd D \ {p, q} := hu ▸ hy + exact ⟨fun h => hy'.2 (Or.inl h), fun h => hy'.2 (Or.inr h)⟩ + have hmem₁ {y} (hy : y ∈ I₁) := hmem (Or.inl hy) + have hmem₂ {y} (hy : y ∈ I₂) := hmem (Or.inr hy) + have hcl₁ : closure (ι '' I₁) ⊆ ι '' (I₁ ∪ {p, q}) := + closure_minimal (image_mono subset_union_left) (hl₁.isCompact.image hι.continuous).isClosed + have hcl₂ : closure (ι '' I₂) ⊆ ι '' (I₂ ∪ {p, q}) := + closure_minimal (image_mono subset_union_left) (hl₂.isCompact.image hι.continuous).isClosed + have hd₁ : Disjoint (closure (ι '' I₁)) (ι '' I₂) := by + rw [disjoint_left] + rintro _ h ⟨y, hy, rfl⟩ + rcases hsub (hcl₁ h) with h' | h' + · exact disjoint_left.mp hd h' hy + · rcases h' with h' | h' + · exact (hmem₂ hy).1 h' + · exact (hmem₂ hy).2 h' + have hd₂ : Disjoint (ι '' I₁) (closure (ι '' I₂)) := by + rw [disjoint_left] + rintro _ ⟨y, hy, rfl⟩ h + rcases hsub (hcl₂ h) with h' | h' + · exact disjoint_left.mp hd hy h' + · rcases h' with h' | h' + · exact (hmem₁ hy).1 h' + · exact (hmem₁ hy).2 h' + have hX : discBd E \ {ι p, ι q} = ι '' I₁ ∪ ι '' I₂ := by + rw [← image_union, hu, hEb] + ext y + constructor + · rintro ⟨⟨x, hx, rfl⟩, hn⟩ + exact ⟨x, ⟨hx, fun h => hn (by + rcases h with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl)⟩, rfl⟩ + · rintro ⟨x, ⟨hx, hn⟩, rfl⟩ + refine ⟨⟨x, hx, rfl⟩, fun h => hn ?_⟩ + rcases h with h | h + · exact Or.inl (hιinj h) + · exact Or.inr (hιinj h) + have hcomp := componentsIn_union_eq_pair (hI₁.image ι hι.continuous.continuousOn) + (hI₂.image ι hι.continuous.continuousOn) (hne₁.image ι) (hne₂.image ι) hd₁ hd₂ + -- The conclusion, given the side of the line away from infinity. + have key : ∀ (J J' : Set EuclideanPlane) (Δa Δb : Set SHat), IsLineWithEnds (J ∪ {p, q}) p q → + IsLineWithEnds (J' ∪ {p, q}) p q → Disjoint J J' → J ∪ J' = discBd D \ {p, q} → + IsClosedDisc Δa → discBd Δa = ι '' J ∪ ι '' c → ι '' J' ⊆ Δb → Δa ∩ Δb = ι '' c → Δa ⊆ E → + OnePoint.infty ∉ Δa → + ∃ A A' L : Set EuclideanPlane, IsLineWithEnds A p q ∧ IsLineWithEnds A' p q ∧ + A ∪ A' = discBd D ∧ A ∩ A' = {p, q} ∧ IsClosedDisc L ∧ discBd L = A ∪ c ∧ L ∩ D = A ∧ + IsClosedDisc (D ∪ L) ∧ discBd (D ∪ L) = A' ∪ c := by + intro J J' Δa Δb hJ hJ' hJJ hJu hΔa hΔab hJ'b hmt hsubE hinfa + obtain ⟨L, hLeq, hL, hLb⟩ := exists_plane_disc hΔa hinfa + have hJ_ne : ∀ {y}, y ∈ J → y ≠ p ∧ y ≠ q := by + intro y hy + have : y ∈ discBd D \ {p, q} := hJu ▸ Or.inl hy + exact ⟨fun h => this.2 (Or.inl h), fun h => this.2 (Or.inr h)⟩ + have hJ'_ne : ∀ {y}, y ∈ J' → y ≠ p ∧ y ≠ q := by + intro y hy + have : y ∈ discBd D \ {p, q} := hJu ▸ Or.inr hy + exact ⟨fun h => this.2 (Or.inl h), fun h => this.2 (Or.inr h)⟩ + have hcJ : Disjoint c J := by + rw [disjoint_left] + intro x hxc hxJ + have hxD : x ∈ D := by + have : x ∈ discBd D \ {p, q} := hJu ▸ Or.inl hxJ + exact Surface.discBd_subset _ this.1 + rcases hcD ⟨hxc, hxD⟩ with h | h + · exact (hJ_ne hxJ).1 h + · exact (hJ_ne hxJ).2 h + have hbL : discBd L = (J ∪ {p, q}) ∪ c := by + apply hι.injective.image_injective + rw [← hLb, hΔab, ← image_union] + congr 1 + ext x + constructor + · rintro (h | h) + · exact Or.inl (Or.inl h) + · exact Or.inr h + · rintro ((h | h) | h) + · exact Or.inl h + · rcases h with rfl | rfl + · exact Or.inr hc.left_mem + · exact Or.inr hc.right_mem + · exact Or.inr h + have hLD : L ∩ D = J ∪ {p, q} := by + ext x + constructor + · rintro ⟨hxL, hxD⟩ + have hxa : ι x ∈ Δa := hLeq ▸ mem_image_of_mem ι hxL + have hb : ι x ∈ ι '' discBd D := hmeet ▸ ⟨mem_image_of_mem ι hxD, hsubE hxa⟩ + have hxF := hsub hb + by_cases hxpq : x ∈ ({p, q} : Set EuclideanPlane) + · exact Or.inr hxpq + · have : x ∈ J ∪ J' := hJu ▸ ⟨hxF, hxpq⟩ + rcases this with h | h + · exact Or.inl h + · exfalso + have hm : ι x ∈ ι '' c := hmt ▸ ⟨hxa, hJ'b (mem_image_of_mem ι h)⟩ + exact hxpq (hcD ⟨hsub hm, hxD⟩) + · intro hx + have hbx : x ∈ discBd L := hbL ▸ Or.inl hx + refine ⟨Surface.discBd_subset _ hbx, ?_⟩ + rcases hx with h | h + · have : x ∈ discBd D \ {p, q} := hJu ▸ Or.inl h + exact Surface.discBd_subset _ this.1 + · rcases h with rfl | rfl + · exact Surface.discBd_subset _ hp + · exact Surface.discBd_subset _ hq + exact ear_finish hD hpq hJ hJ' hJJ hJu hp hq hc hcJ hL hbL hLD + obtain ⟨A₁, A₂, Δ₁, Δ₂, hA, hcm, h₁, h₂, hU, hI, hb₁, hb₂, -⟩ := + disc_iArc.{0} E _ _ _ hE hcE hne hcHat hcbd + rw [hX, hcomp] at hcm + have hsub₁ : Δ₁ ⊆ E := hU ▸ subset_union_left + have hsub₂ : Δ₂ ⊆ E := hU ▸ subset_union_right + have hA₁b : A₁ ⊆ Δ₁ := fun y hy => Surface.discBd_subset _ (hb₁ ▸ Or.inl hy) + have hA₂b : A₂ ⊆ Δ₂ := fun y hy => Surface.discBd_subset _ (hb₂ ▸ Or.inl hy) + have hl₂' := hl₂.symm + have hmemA₁ : A₁ ∈ ({ι '' I₁, ι '' I₂} : Set (Set SHat)) := hcm ▸ Or.inl rfl + have hmemA₂ : A₂ ∈ ({ι '' I₁, ι '' I₂} : Set (Set SHat)) := hcm ▸ Or.inr rfl + have hinf' : OnePoint.infty ∈ Δ₁ ∪ Δ₂ := hU ▸ hinf + have hu' : I₂ ∪ I₁ = discBd D \ {p, q} := by rw [union_comm]; exact hu + rcases hinf' with hin | hin + · have hn₂ : OnePoint.infty ∉ Δ₂ := fun h => hinfc (hI ▸ ⟨hin, h⟩) + rcases hmemA₁ with h | h <;> rcases hmemA₂ with h' | h' + · exact (hA (h.trans h'.symm)).elim + · exact key I₂ I₁ Δ₂ Δ₁ hl₂' hl₁ hd.symm hu' h₂ (by rw [hb₂, h']) (h ▸ hA₁b) + (by rw [inter_comm]; exact hI) hsub₂ hn₂ + · exact key I₁ I₂ Δ₂ Δ₁ hl₁ hl₂' hd hu h₂ (by rw [hb₂, h']) (h ▸ hA₁b) + (by rw [inter_comm]; exact hI) hsub₂ hn₂ + · exact (hA (h.trans h'.symm)).elim + · have hn₁ : OnePoint.infty ∉ Δ₁ := fun h => hinfc (hI ▸ ⟨h, hin⟩) + rcases hmemA₁ with h | h <;> rcases hmemA₂ with h' | h' + · exact (hA (h.trans h'.symm)).elim + · exact key I₁ I₂ Δ₁ Δ₂ hl₁ hl₂' hd hu h₁ (by rw [hb₁, h]) (h' ▸ hA₂b) hI hsub₁ hn₁ + · exact key I₂ I₁ Δ₁ Δ₂ hl₂' hl₁ hd.symm hu' h₁ (by rw [hb₁, h]) (h' ▸ hA₂b) hI hsub₁ hn₁ + · exact (hA (h.trans h'.symm)).elim + +end Sphere + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/EarUnion.lean b/LeanPool/GraphMinor/GM09/EarUnion.lean new file mode 100644 index 0000000000..0f0bbb259f --- /dev/null +++ b/LeanPool/GraphMinor/GM09/EarUnion.lean @@ -0,0 +1,225 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.EarCompare + +/-! +# The union of a closed disc with a family of ears + +A finite family of ears on `Δ₀` whose discs pairwise meet only in common ends. The union of `Δ₀` +with +their discs is a closed disc. Each ear line lies in its boundary, and that boundary lies in the +boundary of `Δ₀` together with the ear lines. This is the step "It follows that the union of +$\Delta_0$ +with all lawns is a closed disc" of Graph Minors IX, page 67. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +/-- A finite family of ears on `Δ₀` whose discs pairwise meet only in common ends. -/ +structure EarFamily {ι : Type*} (Δ₀ : Set EuclideanPlane) (I : Set ι) + (c L A B : ι → Set EuclideanPlane) (a b : ι → EuclideanPlane) : Prop where + finite : I.Finite + ear : ∀ i ∈ I, EarData Δ₀ (c i) (L i) (A i) (B i) (a i) (b i) + inter : ∀ i ∈ I, ∀ j ∈ I, i ≠ j → L i ∩ L j ⊆ {a i, b i} ∩ {a j, b j} + +namespace EarFamily + +variable {ι : Type*} {Δ₀ : Set EuclideanPlane} {I : Set ι} {c L A B : ι → Set EuclideanPlane} + {a b : ι → EuclideanPlane} + +theorem mono {J : Set ι} (F : EarFamily Δ₀ I c L A B a b) (h : J ⊆ I) : + EarFamily Δ₀ J c L A B a b := + ⟨F.finite.subset h, fun i hi => F.ear i (h hi), fun i hi j hj => F.inter i (h hi) j (h hj)⟩ + +theorem insert_step {J : Set ι} {i : ι} (F : EarFamily Δ₀ (insert i J) c L A B a b) (hi : i ∉ J) + (hd : IsClosedDisc (Δ₀ ∪ ⋃ j ∈ J, L j)) : + IsClosedDisc ((Δ₀ ∪ ⋃ j ∈ J, L j) ∪ L i) ∧ + discBd ((Δ₀ ∪ ⋃ j ∈ J, L j) ∪ L i) ⊆ discBd (Δ₀ ∪ ⋃ j ∈ J, L j) ∪ c i := by + have E := F.ear i (mem_insert i J) + have hJ : J.Finite := F.finite.subset (subset_insert i J) + have hYc : IsClosed (⋃ j ∈ J, L j) := + hJ.isClosed_biUnion fun j hj => (F.ear j (mem_insert_of_mem i hj)).disc.isCompact.isClosed + have hne : ∀ j ∈ J, i ≠ j := fun j hj h => hi (h ▸ hj) + have hends : ∀ {x}, x ∈ L i → x ∈ ⋃ j ∈ J, L j → x ∈ ({a i, b i} : Set EuclideanPlane) := by + intro x hx hxY + obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.mp hxY + exact (F.inter i (mem_insert i J) j (mem_insert_of_mem i hj) (hne j hj) ⟨hx, hxj⟩).1 + have hpq : ({a i, b i} : Set EuclideanPlane) ⊆ A i := by + rintro x (rfl | rfl) + · exact E.lineA.left_mem + · exact E.lineA.right_mem + have hAL : A i ⊆ L i := E.A_subset_L + have hinter : (Δ₀ ∪ ⋃ j ∈ J, L j) ∩ L i = A i := by + ext x + constructor + · rintro ⟨hx | hx, hxL⟩ + · exact E.L_inter ▸ ⟨hxL, hx⟩ + · exact hpq (hends hxL hx) + · intro hx + exact ⟨Or.inl (Surface.discBd_subset _ (E.A_subset hx)), hAL hx⟩ + have hopen : A i \ {a i, b i} ⊆ discBd (Δ₀ ∪ ⋃ j ∈ J, L j) := by + rintro x ⟨hx, hn⟩ + by_contra hb + have hxΔ : x ∈ Δ₀ := Surface.discBd_subset _ (E.A_subset hx) + have hxi : x ∈ interior (Δ₀ ∪ ⋃ j ∈ J, L j) := by + rw [interior_eq_discInt_plane hd] + exact ⟨Or.inl hxΔ, hb⟩ + have hxY : x ∉ ⋃ j ∈ J, L j := fun h => hn (hends (hAL hx) h) + have hxi₀ : x ∈ interior Δ₀ := by + refine mem_interior.mpr ⟨interior (Δ₀ ∪ ⋃ j ∈ J, L j) ∩ (⋃ j ∈ J, L j)ᶜ, ?_, + isOpen_interior.inter hYc.isOpen_compl, hxi, hxY⟩ + rintro y ⟨hy, hyn⟩ + exact (interior_subset hy).resolve_right hyn + rw [interior_eq_discInt_plane E.disc₀] at hxi₀ + exact hxi₀.2 (E.A_subset hx) + have hsub : A i ⊆ discBd (Δ₀ ∪ ⋃ j ∈ J, L j) := by + have hcl : IsClosed (discBd (Δ₀ ∪ ⋃ j ∈ J, L j)) := hd.isOArc_discBd.isCompact.isClosed + exact (E.lineA.subset_closure_diff).trans (closure_minimal hopen hcl) + obtain ⟨h₁, h₂⟩ := disc_union.{0} _ _ _ _ _ hd E.disc E.lineA hinter hsub + (fun x hx => E.bdL ▸ Or.inl hx) + refine ⟨h₁, ?_⟩ + rw [h₂] + rintro x ⟨hx | hx, hn⟩ + · exact Or.inl hx + · rw [E.bdL] at hx + rcases hx with hx | hx + · exact Or.inl (hsub hx) + · exact Or.inr hx + +/-- The union of `Δ₀` with the discs of a family of ears is a closed disc, and its boundary lies in +the boundary of `Δ₀` together with the ear lines. -/ +theorem isClosedDisc_union (F : EarFamily Δ₀ I c L A B a b) (h₀ : IsClosedDisc Δ₀) : + IsClosedDisc (Δ₀ ∪ ⋃ i ∈ I, L i) ∧ + discBd (Δ₀ ∪ ⋃ i ∈ I, L i) ⊆ discBd Δ₀ ∪ ⋃ i ∈ I, c i := by + classical + have key : ∀ J : Set ι, J.Finite → J ⊆ I → IsClosedDisc (Δ₀ ∪ ⋃ i ∈ J, L i) ∧ + discBd (Δ₀ ∪ ⋃ i ∈ J, L i) ⊆ discBd Δ₀ ∪ ⋃ i ∈ J, c i := by + intro J hJ + induction J, hJ using Set.Finite.induction_on with + | empty => + intro _ + simp [h₀] + | @insert i J hi _ ih => + intro hs + obtain ⟨hd, hb⟩ := ih ((subset_insert i J).trans hs) + have heq : (Δ₀ ∪ ⋃ j ∈ insert i J, L j) = (Δ₀ ∪ ⋃ j ∈ J, L j) ∪ L i := by + rw [biUnion_insert] + ext x + simp only [mem_union] + tauto + obtain ⟨h₁, h₂⟩ := (F.mono hs).insert_step hi hd + rw [heq] + refine ⟨h₁, h₂.trans ?_⟩ + rw [biUnion_insert] + rintro x (hx | hx) + · rcases hb hx with h | h + · exact Or.inl h + · exact Or.inr (Or.inr h) + · exact Or.inr (Or.inl hx) + exact key I F.finite Subset.rfl + +theorem L_subset_union {i : ι} (hi : i ∈ I) : L i ⊆ Δ₀ ∪ ⋃ j ∈ I, L j := + fun _ hx => Or.inr (mem_iUnion₂.mpr ⟨i, hi, hx⟩) + +/-- The other discs together with `Δ₀` form a closed set. -/ +theorem isClosed_others (F : EarFamily Δ₀ I c L A B a b) (h₀ : IsClosedDisc Δ₀) (i : ι) : + IsClosed (Δ₀ ∪ ⋃ j ∈ I \ {i}, L j) := + h₀.isCompact.isClosed.union ((F.finite.subset sdiff_subset).isClosed_biUnion fun _ hj => + (F.ear _ hj.1).disc.isCompact.isClosed) + +/-- A point of the open part of an ear line lies in no other disc and not in `Δ₀`. -/ +theorem not_mem_others (F : EarFamily Δ₀ I c L A B a b) {i : ι} (hi : i ∈ I) {x : EuclideanPlane} + (hx : x ∈ c i \ {a i, b i}) : x ∉ Δ₀ ∪ ⋃ j ∈ I \ {i}, L j := by + have E := F.ear i hi + rintro (h | h) + · exact disjoint_left.mp E.disjoint_open hx h + · obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.mp h + have hne : i ≠ j := fun h' => hj.2 h'.symm + exact hx.2 (F.inter i hi j hj.1 hne ⟨E.c_subset_L hx.1, hxj⟩).1 + +/-- Near a point away from `Δ₀` and the other discs, the union of all discs is the disc `L i`. -/ +theorem exists_nhds_subset (F : EarFamily Δ₀ I c L A B a b) (h₀ : IsClosedDisc Δ₀) {i : ι} + (_hi : i ∈ I) {x : EuclideanPlane} (hx : x ∉ Δ₀ ∪ ⋃ j ∈ I \ {i}, L j) : + ∃ N : Set EuclideanPlane, IsOpen N ∧ x ∈ N ∧ N ∩ (Δ₀ ∪ ⋃ j ∈ I, L j) ⊆ L i := by + refine ⟨(Δ₀ ∪ ⋃ j ∈ I \ {i}, L j)ᶜ, (F.isClosed_others h₀ i).isOpen_compl, hx, ?_⟩ + rintro y ⟨hy, hy' | hy'⟩ + · exact (hy (Or.inl hy')).elim + · obtain ⟨j, hj, hyj⟩ := mem_iUnion₂.mp hy' + by_cases hij : j = i + · exact hij ▸ hyj + · exact (hy (Or.inr (mem_iUnion₂.mpr ⟨j, ⟨hj, hij⟩, hyj⟩))).elim + +/-- Each ear line lies in the boundary of the union. -/ +theorem c_subset_discBd (F : EarFamily Δ₀ I c L A B a b) (h₀ : IsClosedDisc Δ₀) {i : ι} + (hi : i ∈ I) : c i ⊆ discBd (Δ₀ ∪ ⋃ j ∈ I, L j) := by + have E := F.ear i hi + obtain ⟨hd, -⟩ := F.isClosedDisc_union h₀ + have hopen : c i \ {a i, b i} ⊆ discBd (Δ₀ ∪ ⋃ j ∈ I, L j) := by + intro x hx + by_contra hb + obtain ⟨N, hN, hxN, hs⟩ := F.exists_nhds_subset h₀ hi (F.not_mem_others hi hx) + have hxW : x ∈ Δ₀ ∪ ⋃ j ∈ I, L j := L_subset_union hi (E.c_subset_L hx.1) + have hxi : x ∈ interior (Δ₀ ∪ ⋃ j ∈ I, L j) := by + rw [interior_eq_discInt_plane hd] + exact ⟨hxW, hb⟩ + have hxL : x ∈ interior (L i) := mem_interior.mpr + ⟨N ∩ interior (Δ₀ ∪ ⋃ j ∈ I, L j), fun y hy => hs ⟨hy.1, interior_subset hy.2⟩, + hN.inter isOpen_interior, hxN, hxi⟩ + rw [interior_eq_discInt_plane E.disc] at hxL + exact hxL.2 (E.bdL ▸ Or.inr hx.1) + exact E.line.subset_closure_diff.trans + (closure_minimal hopen hd.isOArc_discBd.isCompact.isClosed) + +/-- A point of a disc on the boundary of the union lies on the ear line. -/ +theorem L_inter_discBd_subset (F : EarFamily Δ₀ I c L A B a b) (h₀ : IsClosedDisc Δ₀) {i : ι} + (hi : i ∈ I) : L i ∩ discBd (Δ₀ ∪ ⋃ j ∈ I, L j) ⊆ c i := by + have E := F.ear i hi + obtain ⟨hd, -⟩ := F.isClosedDisc_union h₀ + have hnoint : ∀ {x}, x ∈ discBd (Δ₀ ∪ ⋃ j ∈ I, L j) → + x ∉ interior (Δ₀ ∪ ⋃ j ∈ I, L j) := by + intro x hx hxi + rw [interior_eq_discInt_plane hd] at hxi + exact hxi.2 hx + have hsW : Δ₀ ∪ L i ⊆ Δ₀ ∪ ⋃ j ∈ I, L j := + union_subset subset_union_left (L_subset_union hi) + rintro x ⟨hxL, hxb⟩ + by_contra hxc + have hbL : x ∈ discBd (L i) := by + by_contra hn + have : x ∈ interior (L i) := by + rw [interior_eq_discInt_plane E.disc] + exact ⟨hxL, hn⟩ + exact hnoint hxb (interior_mono (subset_union_right.trans hsW) this) + rw [E.bdL] at hbL + have hxA : x ∈ A i := hbL.resolve_right hxc + have hxB : x ∉ B i := by + intro h + have hm : x ∈ A i ∩ B i := ⟨hxA, h⟩ + rw [E.inter] at hm + rcases hm with rfl | rfl + · exact hxc E.left_mem_c + · exact hxc E.right_mem_c + have hint : x ∈ interior (Δ₀ ∪ L i) := by + rw [interior_eq_discInt_plane E.discW] + refine ⟨Or.inr hxL, ?_⟩ + rw [E.bdW] + rintro (h | h) + · exact hxB h + · exact hxc h + exact hnoint hxb (interior_mono hsW hint) + +end EarFamily + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/GraphCircuits.lean b/LeanPool/GraphMinor/GM09/GraphCircuits.lean new file mode 100644 index 0000000000..9993ef8bd3 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/GraphCircuits.lean @@ -0,0 +1,129 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Joining and splitting graph circuits + +Two paths with the same ends form a circuit when their interiors and edges are disjoint. +Two distinct vertices split a circuit into such paths. +-/ + +public section + +namespace GraphMinor.GM09 + +open Set Graph Surface + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## 1. Circuit Splitting and Joining on `Graph α β` -/ + +/-- Two internally disjoint and edge-disjoint paths in `G` with the same distinct ends `a, b` form a +circuit `subgraphUnion G P Q` in `G`. -/ +theorem isGraphCircuit_subgraphUnion {G P Q : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) (hQ : IsGraphPathWithEnds G Q a b) (hab : a ≠ b) + (hV : V(P) ∩ V(Q) = {a, b}) (hE : Disjoint E(P) E(Q)) : + IsGraphCircuit G (subgraphUnion G P Q) := by + obtain ⟨hPG, W₁, hW₁, hV₁, hE₁⟩ := hP + obtain ⟨hQG, W₂, hW₂, hV₂, hE₂⟩ := hQ + have hl := le_subgraphUnion_left hPG hQG + have hr := le_subgraphUnion_right hPG hQG + obtain ⟨X₁, hs₁, he₁⟩ := exists_walk_up_of_le hl W₁ + obtain ⟨X₂, hs₂, he₂⟩ := exists_walk_up_of_le hr W₂.reverse + have hmem₂ : ∀ x, x ∈ X₂.support ↔ x ∈ W₂.support := by + intro x + rw [hs₂, GraphWalk.support_reverse, List.mem_reverse] + have hmemE₂ : ∀ e, e ∈ X₂.edges ↔ e ∈ W₂.edges := by + intro e + rw [he₂, GraphWalk.edges_reverse, List.mem_reverse] + have hsc := GraphWalk.isSimpleClosed_append_of_lifts hW₁ hW₂ hs₁ hs₂ he₁ he₂ + (by simpa only [hV₁, hV₂] using hV) (by simpa only [hE₁, hE₂] using hE) + refine ⟨subgraphUnion_le hPG hQG, a, X₁.append X₂, hsc, ?_, ?_, ?_⟩ + · rw [GraphWalk.length_append] + have : X₁.length ≠ 0 := fun h => hab (GraphWalk.eq_of_length_eq_zero h) + omega + · rw [vertexSet_subgraphUnion, hV₁, hV₂] + ext x + simp only [mem_union, mem_ofPred_eq, GraphWalk.mem_support_append, hmem₂, hs₁] + · rw [edgeSet_subgraphUnion hPG hQG, hE₁, hE₂] + ext e + simp only [mem_union, mem_ofPred_eq, GraphWalk.edges_append, List.mem_append, hmemE₂, he₁] + +/-- Any circuit `C` in `G` and any two distinct vertices `a, b ∈ V(C)` decompose `C` into two +edge-disjoint paths `Q₁, Q₂` between `a` and `b` with `V(Q₁) ∩ V(Q₂) = {a, b}`, nonempty edge +sets, and `subgraphUnion G Q₁ Q₂ = C`. -/ +theorem IsGraphCircuit.exists_two_paths {G C : Graph α β} (hC : IsGraphCircuit G C) + {a b : α} (ha : a ∈ V(C)) (hb : b ∈ V(C)) (hab : a ≠ b) : + ∃ Q₁ Q₂ : Graph α β, + Q₁ ≤ C ∧ Q₂ ≤ C ∧ + IsGraphPathWithEnds G Q₁ a b ∧ IsGraphPathWithEnds G Q₂ a b ∧ + E(Q₁).Nonempty ∧ E(Q₂).Nonempty ∧ + V(Q₁) ∩ V(Q₂) = {a, b} ∧ Disjoint E(Q₁) E(Q₂) ∧ + subgraphUnion G Q₁ Q₂ = C := by + obtain ⟨hCG, u, W, ⟨hnd, hed⟩, -, hV, hE⟩ := hC + rw [hV] at ha hb + obtain ⟨R₁, R₂, hS₁, hS₂, htail, hedR, hmemRot, hmemE⟩ := + GraphWalk.exists_circuit_split W hnd hed ha hb hab + have hdisjT := List.nodup_append.mp htail + have hedD := List.nodup_append.mp hedR + let Q₁ := walkSubgraph R₁ + let Q₂ := walkSubgraph R₂.reverse + have hQ₁C : Q₁ ≤ C := walkSubgraph_le R₁ + have hQ₂C : Q₂ ≤ C := walkSubgraph_le R₂.reverse + have hQ₁_path : IsGraphPathWithEnds G Q₁ a b := + (isGraphPathWithEnds_walkSubgraph hS₁).mono hCG + have hQ₂_path : IsGraphPathWithEnds G Q₂ a b := + (isGraphPathWithEnds_walkSubgraph hS₂.reverse).mono hCG + have hE_ne : ∀ {x y : α} (R : GraphWalk C x y), x ≠ y → E(walkSubgraph R).Nonempty := by + intro x y R hxy + have hne : R.edges ≠ [] := by + intro h + have : R.length = 0 := by simp [GraphWalk.length, h] + exact hxy (GraphWalk.eq_of_length_eq_zero this) + obtain ⟨e, he⟩ := List.exists_mem_of_ne_nil _ hne + exact ⟨e, by rw [edgeSet_walkSubgraph]; exact he⟩ + refine ⟨Q₁, Q₂, hQ₁C, hQ₂C, hQ₁_path, hQ₂_path, hE_ne R₁ hab, hE_ne R₂.reverse hab, ?_, ?_, ?_⟩ + · rw [vertexSet_walkSubgraph, vertexSet_walkSubgraph] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.support_reverse, List.mem_reverse, + mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨h₁, h₂⟩ + rw [R₁.support_eq_cons] at h₁ + rw [R₂.support_eq_cons] at h₂ + rcases List.mem_cons.mp h₁ with h₁ | h₁ + · exact Or.inl h₁ + · rcases List.mem_cons.mp h₂ with h₂ | h₂ + · exact Or.inr h₂ + · exact (hdisjT.2.2 x h₁ x h₂ rfl).elim + · rintro (rfl | rfl) + · exact ⟨R₁.start_mem_support, R₂.end_mem_support⟩ + · exact ⟨R₁.end_mem_support, R₂.start_mem_support⟩ + · rw [edgeSet_walkSubgraph, edgeSet_walkSubgraph] + refine disjoint_left.mpr fun e he₁ he₂ => ?_ + simp only [mem_ofPred_eq, GraphWalk.edges_reverse, List.mem_reverse] at he₁ he₂ + exact hedD.2.2 e he₁ e he₂ rfl + · refine (Compatible.of_le_le (subgraphUnion_le (hQ₁C.trans hCG) (hQ₂C.trans hCG)) hCG).ext ?_ ?_ + · rw [vertexSet_subgraphUnion, vertexSet_walkSubgraph, vertexSet_walkSubgraph, hV] + ext x + simp only [mem_union, mem_ofPred_eq, GraphWalk.support_reverse, List.mem_reverse] + rw [← hmemRot x, GraphWalk.mem_support_append] + · rw [edgeSet_subgraphUnion (hQ₁C.trans hCG) (hQ₂C.trans hCG), edgeSet_walkSubgraph, + edgeSet_walkSubgraph, hE] + ext e + simp only [mem_union, mem_ofPred_eq, GraphWalk.edges_reverse, List.mem_reverse] + rw [← hmemE e, GraphWalk.edges_append, List.mem_append] + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Lawns.lean b/LeanPool/GraphMinor/GM09/Lawns.lean new file mode 100644 index 0000000000..5af9e5af71 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Lawns.lean @@ -0,0 +1,922 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Section11b +public import LeanPool.GraphMinor.GM09.EarUnion +public import LeanPool.GraphMinor.GM09.NestUncrossing + +/-! +# Lawns + +We fix a presentation of a simple rural neighborhood, with `Δ₀` a closed disc and with the drawing +meeting the boundary of `Δ₀` only in the vertices of `ΩBar₀`. Each short path with ends in `ΩBar₀` +is an +ear on `Δ₀`, and its disc is the disc `Δ(P)` of Graph Minors IX, page 67. We prove (11.1), that two +distinct lawns meet only in common ends. The paper omits this proof. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Drawings -/ + +section Drawing + +variable {G P : Graph α β} (Γ : GraphDrawing G EuclideanPlane) + +theorem graphDrawingEdgeSet_mem {e : β} (he : e ∈ E(G)) : graphDrawingEdgeSet Γ e ∈ Γ.drawing.E + := by + rw [graphDrawingEdgeSet_eq Γ he] + exact (Γ.iso.edgeEquiv ⟨e, he⟩).2 + +theorem eq_of_mem_edgeSet {e f : β} (he : e ∈ E(G)) (hf : f ∈ E(G)) {x : EuclideanPlane} + (hxe : x ∈ graphDrawingEdgeSet Γ e) (hxf : x ∈ graphDrawingEdgeSet Γ f) : e = f := by + have h := Γ.drawing.edge_eq_of_mem (graphDrawingEdgeSet_mem Γ he) (graphDrawingEdgeSet_mem Γ hf) + hxe hxf + rw [graphDrawingEdgeSet_eq Γ he, graphDrawingEdgeSet_eq Γ hf] at h + have h' := Γ.iso.edgeEquiv.injective (Subtype.ext h) + exact congrArg Subtype.val h' + +theorem edgeSet_disjoint_V {e : β} (he : e ∈ E(G)) {x : EuclideanPlane} + (hx : x ∈ graphDrawingEdgeSet Γ e) : x ∉ Γ.drawing.V := + ((graphDrawingEdgeSet_mem Γ he).2.1 hx).2 + +theorem vertexPt_mem_V {v : α} (hv : v ∈ V(G)) : vertexPt Γ v ∈ Γ.drawing.V := by + rw [← vertexEquiv_eq_vertexPt Γ ⟨v, hv⟩] + exact (Γ.iso.vertexEquiv ⟨v, hv⟩).2 + +theorem exists_vertexPt_of_mem_V {x : EuclideanPlane} (hx : x ∈ Γ.drawing.V) : + ∃ v ∈ V(G), x = vertexPt Γ v := by + let w := Γ.iso.vertexEquiv.symm ⟨x, hx⟩ + refine ⟨w.1, w.2, ?_⟩ + rw [← vertexEquiv_eq_vertexPt Γ w] + simp [w] + +theorem mem_vertexSet_iff {v : α} (hv : v ∈ V(G)) {x : EuclideanPlane} : + x ∈ graphDrawingVertexSet Γ v ↔ x = vertexPt Γ v := by + rw [vertexSet_eq_vertexPt Γ hv] + rfl + +/-- A point of the drawing of a subgraph is a vertex of the subgraph or lies on one of its open +edges. -/ +theorem mem_subgraphU_cases (hP : P ≤ G) {x : EuclideanPlane} (hx : x ∈ graphDrawingSubgraphU Γ P) : + (∃ v ∈ V(P), x = vertexPt Γ v) ∨ + (∃ e ∈ E(P), x ∈ graphDrawingEdgeSet Γ e ∧ x ∉ Γ.drawing.V) := by + rcases hx with hx | hx + · obtain ⟨v, hv, hxv⟩ := mem_iUnion₂.mp hx + exact Or.inl ⟨v, hv, (mem_vertexSet_iff Γ (hP.vertexSet_mono hv)).mp hxv⟩ + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + obtain ⟨a, b, hl⟩ := P.exists_isLink_of_mem_edgeSet he + have hlG := hl.mono hP + obtain ⟨hmem, hcap⟩ := closure_inter_V_of_isLink Γ hlG + by_cases hxV : x ∈ Γ.drawing.V + · left + have h : x ∈ closure (graphDrawingEdgeSet Γ e) ∩ Γ.drawing.V := ⟨hxe, hxV⟩ + rw [hcap] at h + rcases h with h | h + · exact ⟨a, hl.left_mem, h⟩ + · exact ⟨b, hl.right_mem, h⟩ + · right + refine ⟨e, he, ?_, hxV⟩ + rw [← Γ.drawing.closure_diff_V hmem] + exact ⟨hxe, hxV⟩ + +theorem subgraphU_subset_U (hP : P ≤ G) : graphDrawingSubgraphU Γ P ⊆ Γ.drawing.U := by + intro x hx + rcases mem_subgraphU_cases Γ hP hx with ⟨v, hv, rfl⟩ | ⟨e, he, hxe, -⟩ + · exact vertexPt_mem_U Γ (hP.vertexSet_mono hv) + · exact (graphDrawingEdgeSet_mem Γ (hP.edgeSet_mono he)).2.1 hxe |>.1 + +theorem vertexPt_mem_subgraphU {v : α} (hv : v ∈ V(P)) (hP : P ≤ G) : + vertexPt Γ v ∈ graphDrawingSubgraphU Γ P := + graphDrawingVertexSet_subset_subgraphU_of_mem Γ hv + ((mem_vertexSet_iff Γ (hP.vertexSet_mono hv)).mpr rfl) + +theorem mem_vertexSet_of_vertexPt_mem (hP : P ≤ G) {v : α} (hv : v ∈ V(G)) + (hx : vertexPt Γ v ∈ graphDrawingSubgraphU Γ P) : v ∈ V(P) := by + refine mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU Γ hP hv ?_ + rw [vertexSet_eq_vertexPt Γ hv, singleton_subset_iff] + exact hx + +/-- The closure of an edge with two different ends is a line between the images of its ends. -/ +theorem isLine_closure_of_isLink {e : β} {u w : α} (hl : G.IsLink e u w) (huw : u ≠ w) : + IsLineWithEnds (closure (graphDrawingEdgeSet Γ e)) (vertexPt Γ u) (vertexPt Γ w) := by + obtain ⟨hmem, hcap⟩ := closure_inter_V_of_isLink Γ hl + have hne : vertexPt Γ u ≠ vertexPt Γ w := fun h => + huw (vertexPt_injOn Γ hl.left_mem hl.right_mem h) + rcases Γ.drawing.edge_cond _ hmem with ⟨p, q, -, hc, hL⟩ | ⟨p, hc, -⟩ + · rw [hc] at hcap + have h₁ : vertexPt Γ u ∈ ({p, q} : Set EuclideanPlane) := hcap ▸ Or.inl rfl + have h₂ : vertexPt Γ w ∈ ({p, q} : Set EuclideanPlane) := hcap ▸ Or.inr rfl + rcases h₁ with h₁ | h₁ <;> rcases h₂ with h₂ | h₂ + · exact (hne (h₁.trans h₂.symm)).elim + · rw [h₁, show vertexPt Γ w = q from h₂] + exact hL + · rw [h₂, show vertexPt Γ u = q from h₁] + exact hL.symm + · exact (hne ((show vertexPt Γ u = q from h₁).trans (show vertexPt Γ w = q from h₂).symm)).elim + · rw [hc] at hcap + have h₁ : vertexPt Γ u ∈ ({p} : Set EuclideanPlane) := hcap ▸ Or.inl rfl + have h₂ : vertexPt Γ w ∈ ({p} : Set EuclideanPlane) := hcap ▸ Or.inr rfl + exact (hne (h₁.trans h₂.symm)).elim + +/-- The closures of two different edges at a vertex `m`, with different other ends, meet only in +the image of `m`. -/ +theorem closure_inter_closure {e f : β} {m x y : α} (he : G.IsLink e m x) (hf : G.IsLink f m y) + (hxy : x ≠ y) (hef : e ≠ f) : + closure (graphDrawingEdgeSet Γ e) ∩ closure (graphDrawingEdgeSet Γ f) = {vertexPt Γ m} := by + obtain ⟨hme, hce⟩ := closure_inter_V_of_isLink Γ he + obtain ⟨hmf, hcf⟩ := closure_inter_V_of_isLink Γ hf + ext w + constructor + · rintro ⟨h₁, h₂⟩ + by_cases hw : w ∈ Γ.drawing.V + · have h₃ : w ∈ closure (graphDrawingEdgeSet Γ e) ∩ Γ.drawing.V := ⟨h₁, hw⟩ + have h₄ : w ∈ closure (graphDrawingEdgeSet Γ f) ∩ Γ.drawing.V := ⟨h₂, hw⟩ + rw [hce] at h₃ + rw [hcf] at h₄ + rcases h₃ with h₃ | h₃ + · exact h₃ + · rcases h₄ with h₄ | h₄ + · exact h₄ + · exfalso + apply hxy + exact vertexPt_injOn Γ he.right_mem hf.right_mem + ((show w = vertexPt Γ x from h₃).symm.trans h₄) + · exfalso + apply hef + have h₃ : w ∈ graphDrawingEdgeSet Γ e := Γ.drawing.closure_diff_V hme ▸ ⟨h₁, hw⟩ + have h₄ : w ∈ graphDrawingEdgeSet Γ f := Γ.drawing.closure_diff_V hmf ▸ ⟨h₂, hw⟩ + exact eq_of_mem_edgeSet Γ he.edge_mem hf.edge_mem h₃ h₄ + · rintro rfl + have hm := (mem_vertexSet_iff Γ he.left_mem).mpr rfl + exact ⟨graphDrawingVertexSet_subset_closure_edge Γ he hm, + graphDrawingVertexSet_subset_closure_edge Γ hf hm⟩ + +theorem subgraphU_eq_of_one {e : β} {a b : α} (hV : V(P) = {a, b}) (hE : E(P) = {e}) + (hl : G.IsLink e a b) : graphDrawingSubgraphU Γ P = closure (graphDrawingEdgeSet Γ e) := by + apply Subset.antisymm + · rintro x (hx | hx) + · obtain ⟨v, hv, hxv⟩ := mem_iUnion₂.mp hx + rw [hV] at hv + rcases hv with rfl | rfl + · exact graphDrawingVertexSet_subset_closure_edge Γ hl hxv + · exact graphDrawingVertexSet_subset_closure_edge Γ hl.symm hxv + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + rw [hE] at hf + rw [show f = e from hf] at hxf + exact hxf + · intro x hx + refine Or.inr (mem_iUnion₂.mpr ⟨e, ?_, hx⟩) + rw [hE] + rfl + +theorem subgraphU_eq_of_two {e₁ e₂ : β} {a m b : α} (hV : V(P) = {a, m, b}) (hE : E(P) = {e₁, e₂}) + (hl₁ : G.IsLink e₁ m a) (hl₂ : G.IsLink e₂ m b) : graphDrawingSubgraphU Γ P = + closure (graphDrawingEdgeSet Γ e₁) ∪ closure (graphDrawingEdgeSet Γ e₂) := by + apply Subset.antisymm + · rintro x (hx | hx) + · obtain ⟨v, hv, hxv⟩ := mem_iUnion₂.mp hx + rw [hV] at hv + rcases hv with rfl | rfl | rfl + · exact Or.inl (graphDrawingVertexSet_subset_closure_edge Γ hl₁.symm hxv) + · exact Or.inl (graphDrawingVertexSet_subset_closure_edge Γ hl₁ hxv) + · exact Or.inr (graphDrawingVertexSet_subset_closure_edge Γ hl₂.symm hxv) + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + rw [hE] at hf + rcases hf with rfl | rfl + · exact Or.inl hxf + · exact Or.inr hxf + · rintro x (hx | hx) + · refine Or.inr (mem_iUnion₂.mpr ⟨e₁, ?_, hx⟩) + rw [hE] + exact Or.inl rfl + · refine Or.inr (mem_iUnion₂.mpr ⟨e₂, ?_, hx⟩) + rw [hE] + exact Or.inr rfl + +end Drawing + +/-! ## Short paths -/ + +/-- A path with distinct ends in `ΩBar₀`, no internal vertex in `ΩBar₀`, and at most two edges: +properties +(i), (ii) and (iii) of a prominence, Graph Minors IX, page 67. -/ +structure IsShortPath (N : Neighborhood α β) (P : Graph α β) (a b : α) : Prop where + path : IsGraphPathWithEnds N.G P a b + ne : a ≠ b + left_mem : a ∈ N.Ω₀.bar + right_mem : b ∈ N.Ω₀.bar + disj : Disjoint (V(P) \ {a, b}) N.Ω₀.bar + card : E(P).ncard ≤ 2 + +/-- A short path is a single edge between its ends, or it has a middle vertex outside `ΩBar₀`. -/ +theorem IsShortPath.cases {N : Neighborhood α β} {P : Graph α β} {a b : α} + (hS : IsShortPath N P a b) : + (V(P) = {a, b} ∧ ∃ e, E(P) = {e} ∧ N.G.IsLink e a b) ∨ + ∃ m, m ∉ N.Ω₀.bar ∧ m ≠ a ∧ m ≠ b ∧ V(P) = {a, m, b} ∧ ∃ e₁ e₂, e₁ ≠ e₂ ∧ + E(P) = {e₁, e₂} ∧ N.G.IsLink e₁ m a ∧ N.G.IsLink e₂ m b := by + classical + have hfinE : E(P).Finite := N.finite_E.subset hS.path.le.edgeSet_mono + by_cases hint : ∃ m, m ∈ V(P) ∧ m ≠ a ∧ m ≠ b + · obtain ⟨m, hmV, hma, hmb⟩ := hint + have hmi : m ∈ pathInternalVerts N.G P := by + rw [hS.path.pathInternalVerts_eq] + exact ⟨hmV, by rintro (h | h); exacts [hma h, hmb h]⟩ + obtain ⟨-, -, hV, e₁, he₁, e₂, he₂, hl₁, hl₂⟩ := path_of_internal_of_ncard_le_two hS.path + hS.card hmi + have hne : e₁ ≠ e₂ := by + rintro rfl + rcases hl₁.left_eq_or_eq hl₂ with h | h + · exact hma h.symm + · exact hS.ne h + right + have hmΩ : m ∉ N.Ω₀.bar := by + intro h + exact disjoint_left.mp hS.disj (by simpa only [hS.path.pathInternalVerts_eq] using hmi) h + refine ⟨m, hmΩ, hma, hmb, hV, e₁, e₂, hne, ?_, (hl₁.mono hS.path.le).symm, hl₂.mono hS.path.le⟩ + have hsub : ({e₁, e₂} : Set β) ⊆ E(P) := pair_subset he₁ he₂ + refine (Set.eq_of_subset_of_ncard_le hsub ?_ hfinE).symm + rw [ncard_pair hne] + exact hS.card + · left + push Not at hint + have hV : V(P) = {a, b} := by + apply Subset.antisymm + · intro m hm + by_cases h : m = a + · exact Or.inl h + · exact Or.inr (hint m hm h) + · exact pair_subset hS.path.left_mem hS.path.right_mem + refine ⟨hV, ?_⟩ + obtain ⟨hle, W, hW, hVW, hEW⟩ := hS.path + have hab := hS.ne + cases W with + | nil _ => exact (hab rfl).elim + | @cons _ w₁ _ e₁ hl₁ W₁ => + cases W₁ with + | nil _ => + refine ⟨e₁, ?_, hl₁.mono hle⟩ + rw [hEW] + ext f + simp [GraphWalk.edges_cons] + | @cons _ w₂ _ e₂ hl₂ W₂ => + exfalso + have hw₁ : w₁ ∈ V(P) := hl₂.left_mem + have hnd : (a :: w₁ :: W₂.support).Nodup := hW + have hb : b ∈ W₂.support := GraphWalk.end_mem_support W₂ + have hna : a ≠ w₁ := by + intro h + simp only [List.nodup_cons, List.mem_cons, not_or] at hnd + exact hnd.1.1 h + have hnb : w₁ ≠ b := by + intro h + simp only [List.nodup_cons, List.mem_cons, not_or] at hnd + exact hnd.2.1 (h ▸ hb) + exact hnb (hint w₁ hw₁ hna.symm) + +/-- The presentations used in Section 11: `Δ₀` is a closed disc, the drawing meets the boundary of +`Δ₀` only in the vertices of `ΩBar₀`, and the graph is simple. -/ +structure IsCleanPresentation {N : Neighborhood α β} (P : Presentation N) : Prop where + disc₀ : IsClosedDisc P.Δ₀ + clean : P.Γ.drawing.U ∩ subBd P.Δ₀ ⊆ ⋃ v ∈ N.Ω₀.bar, graphDrawingVertexSet P.Γ v + simple : IsSimpleGraph N.G + +/-- A line in an `O`-arc has a complementary line in the arc with the same ends. -/ +theorem exists_complement_line {X c : Set EuclideanPlane} {a b : EuclideanPlane} (hX : IsOArc X) + (hc : IsLineWithEnds c a b) (hab : a ≠ b) (hs : c ⊆ X) : + ∃ T, IsLineWithEnds T a b ∧ c ∩ T = {a, b} ∧ X = c ∪ T := by + obtain ⟨φ⟩ := hX + obtain ⟨I₁, I₂, -, -, hd, hu, -, -, hl₁, hl₂⟩ := + exists_open_arcs φ (hs hc.left_mem) (hs hc.right_mem) hab + have hinter : (I₁ ∪ {a, b}) ∩ (I₂ ∪ {a, b}) = {a, b} := by + ext x + constructor + · rintro ⟨h | h, h' | h'⟩ + · exact (disjoint_left.mp hd h h').elim + · exact h' + · exact h + · exact h + · intro h + exact ⟨Or.inr h, Or.inr h⟩ + have hXu : (I₁ ∪ {a, b}) ∪ (I₂ ∪ {a, b}) = X := by + rw [union_union_union_comm, hu, union_self, sdiff_union_of_subset + (pair_subset (hs hc.left_mem) (hs hc.right_mem))] + rcases line_eq_or_eq_of_subset_union hc hl₁ hl₂.symm hinter (hXu ▸ hs) with rfl | rfl + · exact ⟨I₂ ∪ {a, b}, hl₂.symm, hinter, hXu.symm⟩ + · refine ⟨I₁ ∪ {a, b}, hl₁, ?_, ?_⟩ + · rw [inter_comm] + exact hinter + · rw [union_comm] + exact hXu.symm + +namespace IsCleanPresentation + +variable {N : Neighborhood α β} {P_pres : Presentation N} (C : IsCleanPresentation P_pres) +include C + +theorem exists_bar_of_mem {x : EuclideanPlane} (hx : x ∈ P_pres.Γ.drawing.U) (hx₀ : x ∈ P_pres.Δ₀) : + ∃ v ∈ N.Ω₀.bar, x = vertexPt P_pres.Γ v := by + have hb : x ∈ subBd P_pres.Δ₀ := by + rw [subBd_eq_discBd_plane C.disc₀] + by_contra hn + have : x ∈ interior P_pres.Δ₀ := by + rw [interior_eq_discInt_plane C.disc₀] + exact ⟨hx₀, hn⟩ + exact (P_pres.U_subset hx).2 this + obtain ⟨v, hv, hxv⟩ := mem_iUnion₂.mp (C.clean ⟨hx, hb⟩) + exact ⟨v, hv, (mem_vertexSet_iff P_pres.Γ (N.bar₀_subset hv)).mp hxv⟩ + +omit C in +theorem vertexPt_mem_subBd {v : α} (hv : v ∈ N.Ω₀.bar) : + vertexPt P_pres.Γ v ∈ subBd P_pres.Δ₀ := by + have h := (P_pres.mem_bd_Δ₀_iff v (N.bar₀_subset hv)).mpr hv + exact h ((mem_vertexSet_iff P_pres.Γ (N.bar₀_subset hv)).mpr rfl) + +theorem vertexPt_mem_discBd {v : α} (hv : v ∈ N.Ω₀.bar) : + vertexPt P_pres.Γ v ∈ discBd P_pres.Δ₀ := by + rw [← subBd_eq_discBd_plane C.disc₀] + exact vertexPt_mem_subBd hv + +theorem vertexPt_not_mem {v : α} (hv : v ∈ V(N.G)) (hn : v ∉ N.Ω₀.bar) : + vertexPt P_pres.Γ v ∉ P_pres.Δ₀ := by + intro h + obtain ⟨w, hw, hx⟩ := C.exists_bar_of_mem (vertexPt_mem_U P_pres.Γ hv) h + rw [vertexPt_injOn P_pres.Γ hv (N.bar₀_subset hw) hx] at hn + exact hn hw + +/-- A short path is drawn as an ear on `Δ₀`. -/ +theorem exists_ear {P : Graph α β} {a b : α} (hS : IsShortPath N P a b) : + ∃ L A B, EarData P_pres.Δ₀ (graphDrawingSubgraphU P_pres.Γ P) L A B + (vertexPt P_pres.Γ a) (vertexPt P_pres.Γ b) := by + obtain ⟨hl, hne⟩ := isLineWithEnds_graphDrawingSubgraphU P_pres.Γ hS.path hS.ne + rw [vertexEquiv_eq_vertexPt, vertexEquiv_eq_vertexPt] at hl hne + refine exists_earData C.disc₀ hl hne (C.vertexPt_mem_discBd hS.left_mem) + (C.vertexPt_mem_discBd hS.right_mem) ?_ + rintro x ⟨hx, hx₀⟩ + obtain ⟨v, hv, rfl⟩ := C.exists_bar_of_mem (subgraphU_subset_U P_pres.Γ hS.path.le hx) hx₀ + have hvP := mem_vertexSet_of_vertexPt_mem P_pres.Γ hS.path.le (N.bar₀_subset hv) hx + by_contra hn + refine disjoint_left.mp hS.disj ⟨hvP, ?_⟩ hv + rintro (rfl | rfl) + · exact hn (Or.inl rfl) + · exact hn (Or.inr rfl) + +/-- The disc of an ear is a path disc. -/ +theorem isPathDisc_of_ear {P : Graph α β} {a b : α} (hS : IsShortPath N P a b) + {L A B : Set EuclideanPlane} (E : EarData P_pres.Δ₀ (graphDrawingSubgraphU P_pres.Γ P) L A B + (vertexPt P_pres.Γ a) (vertexPt P_pres.Γ b)) : IsPathDisc P_pres P L := by + have hcΔ : graphDrawingSubgraphU P_pres.Γ P ⊆ P_pres.Δ := fun x hx => + (P_pres.U_subset (subgraphU_subset_U P_pres.Γ hS.path.le hx)).1 + refine ⟨⟨a, b, hS.path, hS.ne, hS.left_mem, hS.right_mem, hS.disj⟩, E.disc, ?_, ?_, ?_, ?_⟩ + · refine subset_of_discBd_subset P_pres.isClosedDisc_Δ E.disc ?_ + rw [E.bdL] + exact union_subset (fun x hx => P_pres.Δ₀_subset_Δ (Surface.discBd_subset _ + (E.A_subset hx))) hcΔ + · intro hsub + obtain ⟨x, hx, hn⟩ := E.lineB.nonempty_sdiff + have hxΔ : x ∈ P_pres.Δ₀ := Surface.discBd_subset _ (E.B_subset hx) + exact hn (E.inter ▸ ⟨E.L_inter ▸ ⟨hsub hxΔ, hxΔ⟩, hx⟩) + · rw [subBd_eq_discBd_plane E.disc, E.bdL] + exact subset_union_right + · rw [subBd_eq_discBd_plane E.disc, E.bdL, subBd_eq_discBd_plane C.disc₀, union_comm] + exact union_subset_union_right _ E.A_subset + +/-- The path disc of a short path is the disc of its ear, so it is unique. -/ +theorem eq_of_isPathDisc {P : Graph α β} {a b : α} + {L A B D : Set EuclideanPlane} (E : EarData P_pres.Δ₀ (graphDrawingSubgraphU P_pres.Γ P) L A B + (vertexPt P_pres.Γ a) (vertexPt P_pres.Γ b)) (hD : IsPathDisc P_pres P D) : D = L := by + obtain ⟨-, hd, -, hn, hs₁, hs₂⟩ := hD + rw [subBd_eq_discBd_plane hd] at hs₁ hs₂ + rw [subBd_eq_discBd_plane C.disc₀] at hs₂ + obtain ⟨T, hT, hi, hX⟩ := exists_complement_line hd.isOArc_discBd E.line E.ne hs₁ + have hTs : T ⊆ discBd P_pres.Δ₀ := by + intro t ht + by_cases hm : t ∈ ({vertexPt P_pres.Γ a, vertexPt P_pres.Γ b} : Set EuclideanPlane) + · rcases hm with rfl | rfl + · exact E.left_mem + · exact E.right_mem + · have h₁ : t ∈ discBd D := hX ▸ Or.inr ht + exact (hs₂ h₁).resolve_left fun h => hm (hi ▸ ⟨h, ht⟩) + rcases E.eq_or_eq_of_discBd hd hT hTs hX with h | h + · exact h + · exact (hn (h ▸ subset_union_left)).elim + +/-- The path of a prominence is short, and its lawn is the disc of its ear. -/ +theorem exists_ear_of_prominence {P : Graph α β} {L : Set EuclideanPlane} + (hL : IsProminenceWithDisc P_pres P L) : + ∃ a b A B, IsShortPath N P a b ∧ + EarData P_pres.Δ₀ (graphDrawingSubgraphU P_pres.Γ P) L A B + (vertexPt P_pres.Γ a) (vertexPt P_pres.Γ b) := by + obtain ⟨a, b, hp, hab, ha, hb, hd⟩ := hL.1.1 + have hS : IsShortPath N P a b := ⟨hp, hab, ha, hb, hd, hL.2.1⟩ + obtain ⟨L', A, B, E⟩ := C.exists_ear hS + have heq : L = L' := C.eq_of_isPathDisc E hL.1 + exact ⟨a, b, A, B, hS, heq ▸ E⟩ + +/-- The two-edge path at `m` with ends `x` and `y` is short, and it is an ear. -/ +theorem exists_ear_two {e₁ e₂ : β} {m x y : α} (h₁ : N.G.IsLink e₁ m x) (h₂ : N.G.IsLink e₂ m y) + (hx : x ∈ N.Ω₀.bar) (hy : y ∈ N.Ω₀.bar) (hxy : x ≠ y) (hm : m ∉ N.Ω₀.bar) : + ∃ Q L A B, IsPathDisc P_pres Q L ∧ E(Q).ncard ≤ 2 ∧ + EarData P_pres.Δ₀ + (closure (graphDrawingEdgeSet P_pres.Γ e₁) ∪ closure (graphDrawingEdgeSet P_pres.Γ e₂)) + L A B (vertexPt P_pres.Γ x) (vertexPt P_pres.Γ y) := by + have hmx : m ≠ x := fun h => hm (h ▸ hx) + have hmy : m ≠ y := fun h => hm (h ▸ hy) + obtain ⟨hp, hV, hV', hE, hc⟩ := isGraphPathWithEnds_two_edges h₁.symm h₂ hmx.symm hmy hxy + have hS : IsShortPath N _ x y := ⟨hp, hxy, hx, hy, by + rw [hV'] + exact disjoint_singleton_left.mpr hm, hc⟩ + obtain ⟨L, A, B, E⟩ := C.exists_ear hS + refine ⟨_, L, A, B, C.isPathDisc_of_ear hS E, hc, ?_⟩ + rwa [subgraphU_eq_of_two P_pres.Γ hV hE h₁ h₂] at E + +omit C in +/-- Two short paths are equal, or they have a common middle vertex, or their open parts are +disjoint. -/ +theorem eq_or_middle_or_disjoint {P P' : Graph α β} {a b a' b' : α} (hS : IsShortPath N P a b) + (hS' : IsShortPath N P' a' b') : + P = P' ∨ (∃ m, m ∈ V(P) \ {a, b} ∧ m ∈ V(P') \ {a', b'}) ∨ + Disjoint (graphDrawingSubgraphU P_pres.Γ P \ {vertexPt P_pres.Γ a, vertexPt P_pres.Γ b}) + (graphDrawingSubgraphU P_pres.Γ P' \ {vertexPt P_pres.Γ a', vertexPt P_pres.Γ b'}) := by + by_contra hcon + push Not at hcon + obtain ⟨hne, hnm, hnd⟩ := hcon + obtain ⟨x, ⟨hx, hxn⟩, ⟨hx', hxn'⟩⟩ := not_disjoint_iff.mp hnd + have hG := hS.path.le + have hG' := hS'.path.le + rcases mem_subgraphU_cases P_pres.Γ hG hx with ⟨v, hv, rfl⟩ | ⟨e, he, hxe, hxV⟩ + · refine hnm v ⟨hv, ?_⟩ ⟨mem_vertexSet_of_vertexPt_mem P_pres.Γ hG' (hG.vertexSet_mono hv) hx', + ?_⟩ + · rintro (rfl | rfl) + · exact hxn (Or.inl rfl) + · exact hxn (Or.inr rfl) + · rintro (rfl | rfl) + · exact hxn' (Or.inl rfl) + · exact hxn' (Or.inr rfl) + · rcases mem_subgraphU_cases P_pres.Γ hG' hx' with ⟨v, hv, rfl⟩ | ⟨f, hf, hxf, -⟩ + · exact hxV (vertexPt_mem_V P_pres.Γ (hG'.vertexSet_mono hv)) + · have hef : e = f := + eq_of_mem_edgeSet P_pres.Γ (hG.edgeSet_mono he) (hG'.edgeSet_mono hf) hxe hxf + subst hef + -- An edge of a two-edge path has the middle vertex as an end, and this is not in `ΩBar₀`. + have hmid : ∀ {Q : Graph α β} {c d m : α}, IsShortPath N Q c d → m ∉ N.Ω₀.bar → + ∀ {g₁ g₂}, E(Q) = {g₁, g₂} → N.G.IsLink g₁ m c → N.G.IsLink g₂ m d → e ∈ E(Q) → + ∃ r ∈ N.Ω₀.bar, N.G.IsLink e m r := by + intro Q c d m hQ _ g₁ g₂ hE hl₁ hl₂ heQ + rw [hE] at heQ + rcases heQ with rfl | rfl + · exact ⟨c, hQ.left_mem, hl₁⟩ + · exact ⟨d, hQ.right_mem, hl₂⟩ + rcases hS.cases with ⟨hV, e₀, hE, hl⟩ | ⟨m, hm, hma, hmb, hV, e₁, e₂, -, hE, hl₁, hl₂⟩ + · have hee : e = e₀ := by + rw [hE] at he + exact he + subst hee + rcases hS'.cases with ⟨hV', e₀', hE', hl'⟩ | ⟨m, hm, hma, hmb, hV', e₁, e₂, -, hE', hl₁, + hl₂⟩ + · have hee : e = e₀' := by + rw [hE'] at hf + exact hf + subst hee + apply hne + refine le_antisymm ((Compatible.of_le_le hG hG').le_iff.mpr ⟨?_, by rw [hE, hE']⟩) + ((Compatible.of_le_le hG' hG).le_iff.mpr ⟨?_, by rw [hE, hE']⟩) + · rw [hV, hV'] + rcases hl.eq_and_eq_or_eq_and_eq hl' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Subset.rfl + · exact (pair_comm _ _).subset + · rw [hV, hV'] + rcases hl.eq_and_eq_or_eq_and_eq hl' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Subset.rfl + · exact (pair_comm _ _).subset + · obtain ⟨r, -, hr⟩ := hmid hS' hm hE' hl₁ hl₂ hf + rcases hr.left_eq_or_eq hl with h | h + · exact hm (h ▸ hS.left_mem) + · exact hm (h ▸ hS.right_mem) + · obtain ⟨r, -, hr⟩ := hmid hS hm hE hl₁ hl₂ he + have hmP : m ∈ V(P) \ {a, b} := ⟨by rw [hV]; exact Or.inr (Or.inl rfl), by + rintro (h | h); exacts [hma h, hmb h]⟩ + rcases hS'.cases with ⟨hV', e₀', hE', hl'⟩ | ⟨m', hm', hma', hmb', hV', e₁', e₂', -, hE', + hl₁', hl₂'⟩ + · have hee : e = e₀' := by + rw [hE'] at hf + exact hf + subst hee + rcases hr.left_eq_or_eq hl' with h | h + · exact hm (h ▸ hS'.left_mem) + · exact hm (h ▸ hS'.right_mem) + · obtain ⟨r', hr'b, hr'⟩ := hmid hS' hm' hE' hl₁' hl₂' hf + rcases hr.left_eq_or_eq hr' with h | h + · subst h + exact hnm m hmP ⟨by rw [hV']; exact Or.inr (Or.inl rfl), by + rintro (h | h); exacts [hma' h, hmb' h]⟩ + · exact hm (h ▸ hr'b) + +/-- Two prominences with a common middle vertex have the same lawn. -/ +theorem lawn_eq_of_common_middle {P P' : Graph α β} {a b a' b' m : α} {L L' A B A' B' : Set + EuclideanPlane} + (hL : IsProminenceWithDisc P_pres P L) (hL' : IsProminenceWithDisc P_pres P' L') + (hS : IsShortPath N P a b) (hS' : IsShortPath N P' a' b') + (E : EarData P_pres.Δ₀ (graphDrawingSubgraphU P_pres.Γ P) L A B + (vertexPt P_pres.Γ a) (vertexPt P_pres.Γ b)) + (E' : EarData P_pres.Δ₀ (graphDrawingSubgraphU P_pres.Γ P') L' A' B' + (vertexPt P_pres.Γ a') (vertexPt P_pres.Γ b')) + (hm : m ∈ V(P) \ {a, b}) (hm' : m ∈ V(P') \ {a', b'}) : L = L' := by + have hmn : m ∉ N.Ω₀.bar := disjoint_left.mp hS.disj hm + have hshape : ∀ {Q : Graph α β} {c d : α}, IsShortPath N Q c d → m ∈ V(Q) \ {c, d} → + ∃ e₁ e₂, V(Q) = {c, m, d} ∧ E(Q) = {e₁, e₂} ∧ N.G.IsLink e₁ m c ∧ N.G.IsLink e₂ m d := by + intro Q c d hQ hmQ + rcases hQ.cases with ⟨hV, -⟩ | ⟨m₀, -, -, -, hV, e₁, e₂, -, hE, hl₁, hl₂⟩ + · exact (hmQ.2 (hV ▸ hmQ.1)).elim + · have : m = m₀ := by + have hm₀ := hmQ.1 + rw [hV] at hm₀ + rcases hm₀ with h | h | h + · exact (hmQ.2 (Or.inl h)).elim + · exact h + · exact (hmQ.2 (Or.inr h)).elim + subst this + exact ⟨e₁, e₂, hV, hE, hl₁, hl₂⟩ + obtain ⟨e₁, e₂, hV, hE, hl₁, hl₂⟩ := hshape hS hm + obtain ⟨e₁', e₂', hV', hE', hl₁', hl₂'⟩ := hshape hS' hm' + have hmG : m ∈ V(N.G) := hl₁.left_mem + have hU := subgraphU_eq_of_two P_pres.Γ hV hE hl₁ hl₂ + have hU' := subgraphU_eq_of_two P_pres.Γ hV' hE' hl₁' hl₂' + have E₁ := E + rw [hU] at E₁ + have hmΔ := C.vertexPt_not_mem hmG hmn + have hline : ∀ {g : β} {z : α}, N.G.IsLink g m z → z ∈ N.Ω₀.bar → + IsLineWithEnds (closure (graphDrawingEdgeSet P_pres.Γ g)) (vertexPt P_pres.Γ m) + (vertexPt P_pres.Γ z) := fun h hz => + isLine_closure_of_isLink P_pres.Γ h fun e => hmn (e ▸ hz) + have hcL : ∀ {x}, x ∈ graphDrawingSubgraphU P_pres.Γ P → x ∈ L := fun hx => E.c_subset_L hx + have hab := hS.ne + have hma : m ≠ a := fun h => hmn (h ▸ hS.left_mem) + have hmb : m ≠ b := fun h => hmn (h ▸ hS.right_mem) + have hee : e₁ ≠ e₂ := by + rintro rfl + exact hab (hl₁.right_unique hl₂) + have key : ∀ {g : β} {z : α}, N.G.IsLink g m z → z ∈ N.Ω₀.bar → + closure (graphDrawingEdgeSet P_pres.Γ g) \ {vertexPt P_pres.Γ m, vertexPt P_pres.Γ z} ⊆ L + := by + intro g z hg hz + by_cases hza : z = a + · subst hza + have : g = e₁ := C.simple.2 g hg.edge_mem e₁ hl₁.edge_mem _ _ hg hl₁ + intro x hx + exact hcL (hU ▸ Or.inl (this ▸ hx.1)) + by_cases hzb : z = b + · subst hzb + have : g = e₂ := C.simple.2 g hg.edge_mem e₂ hl₂.edge_mem _ _ hg hl₂ + intro x hx + exact hcL (hU ▸ Or.inr (this ▸ hx.1)) + obtain ⟨Q₂, L₂, _, _, hQ₂, hc₂, E₂⟩ := + C.exists_ear_two hl₁ hg hS.left_mem hz (Ne.symm hza) hmn + obtain ⟨Q₃, L₃, _, _, hQ₃, hc₃, E₃⟩ := + C.exists_ear_two hl₂ hg hS.right_mem hz (Ne.symm hzb) hmn + have hmz : m ≠ z := fun h => hmn (h ▸ hz) + have he₁g : e₁ ≠ g := by + rintro rfl + exact hza (hl₁.right_unique hg).symm + have he₂g : e₂ ≠ g := by + rintro rfl + exact hzb (hl₂.right_unique hg).symm + rcases E₁.third_leg E₂ E₃ (hline hl₁ hS.left_mem) (hline hl₂ hS.right_mem) (hline hg hz) hmΔ + (fun h => hza (vertexPt_injOn P_pres.Γ hg.right_mem hl₁.right_mem h)) + (fun h => hzb (vertexPt_injOn P_pres.Γ hg.right_mem hl₂.right_mem h)) + (closure_inter_closure P_pres.Γ hl₁ hl₂ hab hee) + (closure_inter_closure P_pres.Γ hl₁ hg (Ne.symm hza) he₁g) + (closure_inter_closure P_pres.Γ hl₂ hg (Ne.symm hzb) he₂g) with h | ⟨h, hne⟩ | ⟨h, + hne⟩ + · exact h + · exact (hne (hL.2.2 Q₂ L₂ hQ₂ hc₂ h).symm).elim + · exact (hne (hL.2.2 Q₃ L₃ hQ₃ hc₃ h).symm).elim + have hsub : graphDrawingSubgraphU P_pres.Γ P' \ {vertexPt P_pres.Γ a', vertexPt P_pres.Γ b'} ⊆ L + := by + rintro x ⟨hx, hn⟩ + by_cases hxm : x = vertexPt P_pres.Γ m + · exact hcL (hxm ▸ vertexPt_mem_subgraphU P_pres.Γ hm.1 hS.path.le) + rw [hU'] at hx + rcases hx with hx | hx + · exact key hl₁' hS'.left_mem ⟨hx, by + rintro (h | h) + · exact hxm h + · exact hn (Or.inl h)⟩ + · exact key hl₂' hS'.right_mem ⟨hx, by + rintro (h | h) + · exact hxm h + · exact hn (Or.inr h)⟩ + exact hL'.2.2 P L hL.1 hL.2.1 (E.subset_of_open_subset E' hsub) + +/-- **Graph Minors IX, (11.1)**: "If $L, L'$ are distinct lawns then every element of $L \cap L'$ is +the image under $\Gamma$ +of a common end of the two corresponding prominences." -/ +theorem lawn_inter_subset {P P' : Graph α β} {L L' : Set EuclideanPlane} + (hL : IsProminenceWithDisc P_pres P L) (hL' : IsProminenceWithDisc P_pres P' L') (hne : L ≠ L') + {x : EuclideanPlane} (hx : x ∈ L ∩ L') : + ∃ v ∈ pathEnds N.G P ∩ pathEnds N.G P', x ∈ graphDrawingVertexSet P_pres.Γ v := by + obtain ⟨a, b, A, B, hS, E⟩ := C.exists_ear_of_prominence hL + obtain ⟨a', b', A', B', hS', E'⟩ := C.exists_ear_of_prominence hL' + rcases eq_or_middle_or_disjoint hS hS' with rfl | ⟨m, hm, hm'⟩ | hd + · exact (hne (C.eq_of_isPathDisc E hL'.1).symm).elim + · exact (hne (C.lawn_eq_of_common_middle hL hL' hS hS' E E' hm hm')).elim + rcases E.nested_or_inter E' hd with h | h | h + · exact (hne (hL'.2.2 P L hL.1 hL.2.1 h)).elim + · exact (hne (hL.2.2 P' L' hL'.1 hL'.2.1 h).symm).elim + obtain ⟨h₁, h₂⟩ := h hx + have hends : ∀ {Q : Graph α β} {c d : α}, IsShortPath N Q c d → + c ∈ pathEnds N.G Q ∧ d ∈ pathEnds N.G Q := fun hQ => by + rw [hQ.path.pathEnds_eq] + exact ⟨Or.inl rfl, Or.inr rfl⟩ + have hv : ∀ {c c' : α}, c ∈ N.Ω₀.bar → c' ∈ N.Ω₀.bar → x = vertexPt P_pres.Γ c → + x = vertexPt P_pres.Γ c' → c = c' := fun hc hc' h h' => + vertexPt_injOn P_pres.Γ (N.bar₀_subset hc) (N.bar₀_subset hc') (h.symm.trans h') + rcases h₁ with h₁ | h₁ <;> rcases h₂ with h₂ | h₂ + · have := hv hS.left_mem hS'.left_mem h₁ h₂ + subst this + exact ⟨a, ⟨(hends hS).1, (hends hS').1⟩, (mem_vertexSet_iff _ (N.bar₀_subset hS.left_mem)).mpr + h₁⟩ + · have := hv hS.left_mem hS'.right_mem h₁ h₂ + subst this + exact ⟨a, ⟨(hends hS).1, (hends hS').2⟩, (mem_vertexSet_iff _ (N.bar₀_subset hS.left_mem)).mpr + h₁⟩ + · have := hv hS.right_mem hS'.left_mem h₁ h₂ + subst this + exact ⟨b, ⟨(hends hS).2, (hends hS').1⟩, (mem_vertexSet_iff _ (N.bar₀_subset hS.right_mem)).mpr + h₁⟩ + · have := hv hS.right_mem hS'.right_mem h₁ h₂ + subst this + exact ⟨b, ⟨(hends hS).2, (hends hS').2⟩, (mem_vertexSet_iff _ (N.bar₀_subset hS.right_mem)).mpr + h₁⟩ + +omit C in +/-- A connected piece of `U(Γ)` off the vertices has connected drawing. -/ +theorem isPreconnected_edgeSet {e : β} (he : e ∈ E(N.G)) : + IsPreconnected (graphDrawingEdgeSet P_pres.Γ e) := + (graphDrawingEdgeSet_mem P_pres.Γ he).2.2.1.isConnected.isPreconnected + +omit C in +/-- A graph has only finitely many subgraphs. -/ +theorem finite_subgraphs : {Q : Graph α β | Q ≤ N.G}.Finite := by + classical + let f : Graph α β → Set α × Set β := fun Q => (V(Q), E(Q)) + have hinj : InjOn f {Q : Graph α β | Q ≤ N.G} := by + intro Q hQ Q' hQ' h + have h₁ : V(Q) = V(Q') := congrArg Prod.fst h + have h₂ : E(Q) = E(Q') := congrArg Prod.snd h + exact le_antisymm ((Compatible.of_le_le hQ hQ').le_iff.mpr ⟨h₁.subset, h₂.subset⟩) + ((Compatible.of_le_le hQ' hQ).le_iff.mpr ⟨h₁.symm.subset, h₂.symm.subset⟩) + refine Set.Finite.of_finite_image ?_ hinj + refine ((N.finite_V.finite_subsets).prod (N.finite_E.finite_subsets)).subset ?_ + rintro _ ⟨Q, hQ, rfl⟩ + exact ⟨hQ.vertexSet_mono, hQ.edgeSet_mono⟩ + +/-- There are only finitely many path discs of short paths. -/ +theorem finite_pathDiscs : + {D : Set EuclideanPlane | ∃ Q, IsPathDisc P_pres Q D ∧ E(Q).ncard ≤ 2}.Finite := by + have hfin := finite_subgraphs (N := N) + have hsub : {D : Set EuclideanPlane | ∃ Q, IsPathDisc P_pres Q D ∧ E(Q).ncard ≤ 2} ⊆ + ⋃ Q ∈ {Q : Graph α β | Q ≤ N.G}, {D | IsPathDisc P_pres Q D ∧ E(Q).ncard ≤ 2} := by + rintro D ⟨Q, hD, hc⟩ + obtain ⟨a, b, hp, -⟩ := hD.1 + exact mem_iUnion₂.mpr ⟨Q, hp.le, hD, hc⟩ + refine (hfin.biUnion fun Q _ => ?_).subset hsub + refine Set.Subsingleton.finite ?_ + rintro D ⟨hD, hc⟩ D' ⟨hD', -⟩ + obtain ⟨a, b, hp, hab, ha, hb, hd⟩ := hD.1 + have hS : IsShortPath N Q a b := ⟨hp, hab, ha, hb, hd, hc⟩ + obtain ⟨L, A, B, E⟩ := C.exists_ear hS + rw [C.eq_of_isPathDisc E hD, C.eq_of_isPathDisc E hD'] + +/-- Every path disc of a short path lies in a lawn. -/ +theorem exists_lawn_of_pathDisc {Q : Graph α β} {D : Set EuclideanPlane} + (hD : IsPathDisc P_pres Q D) (hc : E(Q).ncard ≤ 2) : + ∃ L, IsLawn P_pres L ∧ D ⊆ L := by + obtain ⟨L, hDL, hmax⟩ := C.finite_pathDiscs.exists_le_maximal (a := D) ⟨Q, hD, hc⟩ + obtain ⟨Q', hQ', hc'⟩ := hmax.1 + refine ⟨L, ⟨Q', hQ', hc', fun P' L' hL' hc'' hle => ?_⟩, hDL⟩ + exact le_antisymm (hmax.2 ⟨P', hL', hc''⟩ hle) hle + +theorem exists_lawn_of_short_path {Q : Graph α β} {a b : α} (hS : IsShortPath N Q a b) : + ∃ D L, IsPathDisc P_pres Q D ∧ IsLawn P_pres L ∧ D ⊆ L := by + obtain ⟨D, A, B, E⟩ := C.exists_ear hS + have hD := C.isPathDisc_of_ear hS E + obtain ⟨L, hL, hDL⟩ := C.exists_lawn_of_pathDisc hD hS.card + exact ⟨D, L, hD, hL, hDL⟩ + +/-- The lawns form a family of ears, indexed by themselves. -/ +theorem exists_earFamily : + ∃ (Q : {L // IsLawn P_pres L} → Graph α β) (a b : {L // IsLawn P_pres L} → α) + (A B : {L // IsLawn P_pres L} → Set EuclideanPlane), + EarFamily P_pres.Δ₀ univ (fun i => graphDrawingSubgraphU P_pres.Γ (Q i)) (fun i => i.1) A B + (fun i => vertexPt P_pres.Γ (a i)) (fun i => vertexPt P_pres.Γ (b i)) ∧ + ∀ i, IsProminenceWithDisc P_pres (Q i) i.1 ∧ IsShortPath N (Q i) (a i) (b i) := by + have h : ∀ i : {L // IsLawn P_pres L}, ∃ (Q : Graph α β) (a b : α) + (A B : Set EuclideanPlane), IsProminenceWithDisc P_pres Q i.1 ∧ IsShortPath N Q a b ∧ + EarData P_pres.Δ₀ (graphDrawingSubgraphU P_pres.Γ Q) i.1 A B + (vertexPt P_pres.Γ a) (vertexPt P_pres.Γ b) := by + intro i + obtain ⟨Q, hQ⟩ := i.2 + obtain ⟨a, b, A, B, hS, E⟩ := C.exists_ear_of_prominence hQ + exact ⟨Q, a, b, A, B, hQ, hS, E⟩ + choose Q a b A B h₁ h₂ h₃ using h + have hfin : (univ : Set {L // IsLawn P_pres L}).Finite := by + have hf : {L | IsLawn P_pres L}.Finite := C.finite_pathDiscs.subset fun L hL => by + obtain ⟨Q', hQ'⟩ := hL + exact ⟨Q', hQ'.1, hQ'.2.1⟩ + have : Finite {L // IsLawn P_pres L} := hf.to_subtype + exact toFinite _ + refine ⟨Q, a, b, A, B, ⟨hfin, fun i _ => h₃ i, ?_⟩, fun i => ⟨h₁ i, h₂ i⟩⟩ + intro i _ j _ hij x hx + have hne : i.1 ≠ j.1 := fun h => hij (Subtype.ext h) + obtain ⟨v, ⟨hv, hv'⟩, hxv⟩ := C.lawn_inter_subset (h₁ i) (h₁ j) hne hx + rw [(h₂ i).path.pathEnds_eq] at hv + rw [(h₂ j).path.pathEnds_eq] at hv' + have hG : v ∈ V(N.G) := by + rcases hv with rfl | rfl + · exact N.bar₀_subset (h₂ i).left_mem + · exact N.bar₀_subset (h₂ i).right_mem + have hxe := (mem_vertexSet_iff P_pres.Γ hG).mp hxv + refine ⟨?_, ?_⟩ + · rcases hv with rfl | rfl + · exact Or.inl hxe + · exact Or.inr hxe + · rcases hv' with h | h + · rw [h] at hxe + exact Or.inl hxe + · rw [h] at hxe + exact Or.inr hxe + +omit C in +theorem wallDisc_eq : + wallDisc P_pres = P_pres.Δ₀ ∪ ⋃ i ∈ (univ : Set {L // IsLawn P_pres L}), i.1 := by + unfold wallDisc + congr 1 + ext x + simp only [mem_iUnion, mem_ofPred_eq, exists_prop, mem_univ, true_and, Subtype.exists] + +theorem isClosedDisc_wallDisc : IsClosedDisc (wallDisc P_pres) := by + obtain ⟨Q, a, b, A, B, F, -⟩ := C.exists_earFamily + rw [wallDisc_eq] + exact (F.isClosedDisc_union C.disc₀).1 + +theorem wall_eq : wall P_pres = discBd (wallDisc P_pres) := + subBd_eq_discBd_plane C.isClosedDisc_wallDisc + +/-- A prominence is drawn in the wall, and its lawn meets the wall only in that drawing. -/ +theorem prominence_U_subset_wall {Q : Graph α β} {L : Set EuclideanPlane} + (hL : IsProminenceWithDisc P_pres Q L) : + graphDrawingSubgraphU P_pres.Γ Q ⊆ wall P_pres ∧ + L ∩ wall P_pres ⊆ graphDrawingSubgraphU P_pres.Γ Q := by + obtain ⟨Q₀, a, b, A, B, F, hF⟩ := C.exists_earFamily + obtain ⟨a', b', A', B', -, E⟩ := C.exists_ear_of_prominence hL + let i : {L // IsLawn P_pres L} := ⟨L, Q, hL⟩ + have hc : graphDrawingSubgraphU P_pres.Γ Q = graphDrawingSubgraphU P_pres.Γ (Q₀ i) := + E.c_eq (F.ear i (mem_univ i)) + rw [C.wall_eq, wallDisc_eq, hc] + exact ⟨F.c_subset_discBd C.disc₀ (mem_univ i), F.L_inter_discBd_subset C.disc₀ (mem_univ i)⟩ + +/-- The wall lies in the boundary of `Δ₀` together with the images of the prominences. -/ +theorem wall_subset : + wall P_pres ⊆ subBd P_pres.Δ₀ ∪ + ⋃ (P : Graph α β) (_ : IsProminence P_pres P), graphDrawingSubgraphU P_pres.Γ P := by + obtain ⟨Q₀, a, b, A, B, F, hF⟩ := C.exists_earFamily + rw [C.wall_eq, wallDisc_eq, subBd_eq_discBd_plane C.disc₀] + refine (F.isClosedDisc_union C.disc₀).2.trans (union_subset_union_right _ ?_) + refine iUnion₂_subset fun i _ => ?_ + exact subset_biUnion_of_mem (u := fun P => graphDrawingSubgraphU P_pres.Γ P) + (s := {P | IsProminence P_pres P}) ⟨i.1, (hF i).1⟩ |>.trans (by + intro x hx + obtain ⟨P, hP, hxP⟩ := mem_iUnion₂.mp hx + exact mem_iUnion₂.mpr ⟨P, hP, hxP⟩) + +/-- An open edge misses `Δ₀`. -/ +theorem edgeSet_disjoint {e : β} (he : e ∈ E(N.G)) {x : EuclideanPlane} + (hx : x ∈ graphDrawingEdgeSet P_pres.Γ e) : x ∉ P_pres.Δ₀ := by + intro h₀ + have hxU := (graphDrawingEdgeSet_mem P_pres.Γ he).2.1 hx |>.1 + obtain ⟨v, hv, rfl⟩ := C.exists_bar_of_mem hxU h₀ + exact edgeSet_disjoint_V P_pres.Γ he hx (vertexPt_mem_V P_pres.Γ (N.bar₀_subset hv)) + +omit C in +/-- An open edge that is not in a path `Q` misses the drawing of `Q`. -/ +theorem edgeSet_disjoint_subgraphU {e : β} {Q : Graph α β} (he : e ∈ E(N.G)) (hQ : Q ≤ N.G) + (heQ : e ∉ E(Q)) {x : EuclideanPlane} (hx : x ∈ graphDrawingEdgeSet P_pres.Γ e) : + x ∉ graphDrawingSubgraphU P_pres.Γ Q := by + intro hxQ + rcases mem_subgraphU_cases P_pres.Γ hQ hxQ with ⟨v, hv, rfl⟩ | ⟨f, hf, hxf, -⟩ + · exact edgeSet_disjoint_V P_pres.Γ he hx (vertexPt_mem_V P_pres.Γ (hQ.vertexSet_mono hv)) + · rw [eq_of_mem_edgeSet P_pres.Γ he (hQ.edgeSet_mono hf) hx hxf] at heQ + exact heQ hf + +/-- Every edge is internal, external, or a wall edge. -/ +theorem edge_trichotomy {e : β} (he : e ∈ E(N.G)) : + IsInternalEdge P_pres e ∨ IsExternalEdge P_pres e ∨ IsWallEdge P_pres e := by + by_cases hex : ∃ Q, IsProminence P_pres Q ∧ e ∈ E(Q) + · obtain ⟨Q, ⟨L, hL⟩, heQ⟩ := hex + right + right + exact ⟨he, (graphDrawingEdgeSet_subset_subgraphU_of_mem P_pres.Γ heQ).trans + (C.prominence_U_subset_wall hL).1⟩ + push Not at hex + have hd : Disjoint (graphDrawingEdgeSet P_pres.Γ e) (discBd (wallDisc P_pres)) := by + rw [disjoint_left, ← C.wall_eq] + intro x hx hxw + rcases C.wall_subset hxw with h | h + · refine C.edgeSet_disjoint he hx (subBd_subset_of_isClosed C.disc₀.isCompact.isClosed h) + · obtain ⟨Q, hQ, hxQ⟩ := mem_iUnion₂.mp h + obtain ⟨L, hL⟩ := id hQ + obtain ⟨a, b, hp, -⟩ := hL.1.1 + exact edgeSet_disjoint_subgraphU he hp.le (hex Q hQ) hx hxQ + rcases subset_interior_or_compl C.isClosedDisc_wallDisc (isPreconnected_edgeSet he) hd with h | h + · exact Or.inl ⟨he, h⟩ + · refine Or.inr (Or.inl ⟨he, fun x hx => ⟨?_, h hx⟩⟩) + exact (P_pres.U_subset ((graphDrawingEdgeSet_mem P_pres.Γ he).2.1 hx).1).1 + +/-- An internal edge at the middle vertex of a prominence is drawn in its lawn. -/ +theorem internal_edge_subset_lawn_of_middle {Q : Graph α β} {L : Set EuclideanPlane} {m : α} {e : β} + (hL : IsProminenceWithDisc P_pres Q L) (hm : m ∈ pathInternalVerts N.G Q) + (hi : IsInternalEdge P_pres e) (hinc : N.G.Inc e m) : + graphDrawingEdgeSet P_pres.Γ e ⊆ L := by + obtain ⟨Q₀, a, b, A, B, F, hF⟩ := C.exists_earFamily + obtain ⟨a', b', A', B', hS, E⟩ := C.exists_ear_of_prominence hL + by_cases heQ : e ∈ E(Q) + · exact (graphDrawingEdgeSet_subset_subgraphU_of_mem P_pres.Γ heQ).trans + (fun x hx => E.c_subset_L hx) + let i : {L // IsLawn P_pres L} := ⟨L, Q, hL⟩ + have hc : graphDrawingSubgraphU P_pres.Γ Q = graphDrawingSubgraphU P_pres.Γ (Q₀ i) := + E.c_eq (F.ear i (mem_univ i)) + have he := hi.1 + obtain ⟨w, hlink⟩ := hinc + have hmV : m ∈ V(Q) := by + rw [hS.path.pathInternalVerts_eq] at hm + exact hm.1 + have hmn : m ∉ ({a', b'} : Set α) := by + rw [hS.path.pathInternalVerts_eq] at hm + exact hm.2 + have hmbar : m ∉ N.Ω₀.bar := disjoint_left.mp hS.disj ⟨hmV, hmn⟩ + have hmG : m ∈ V(N.G) := hlink.left_mem + have hmΔ := C.vertexPt_not_mem hmG hmbar + have hmo : vertexPt P_pres.Γ m ∉ P_pres.Δ₀ ∪ ⋃ j ∈ (univ : Set {L // IsLawn P_pres L}) \ {i}, j.1 + := by + rintro (h | h) + · exact hmΔ h + · obtain ⟨j, hj, hmj⟩ := mem_iUnion₂.mp h + have hne : i ≠ j := fun h' => hj.2 h'.symm + have hx := (F.inter i (mem_univ i) j hj.1 hne ⟨E.c_subset_L + (vertexPt_mem_subgraphU P_pres.Γ hmV hS.path.le), hmj⟩).1 + have hmaP : vertexPt P_pres.Γ m ∈ P_pres.Δ₀ := by + have hEi := F.ear i (mem_univ i) + rcases hx with hx | hx + · exact (Surface.discBd_subset _ hEi.left_mem : _ ∈ P_pres.Δ₀) |> (hx ▸ ·) + · exact (Surface.discBd_subset _ hEi.right_mem : _ ∈ P_pres.Δ₀) |> (hx ▸ ·) + exact hmΔ hmaP + obtain ⟨N', hN', hmN, hsub⟩ := F.exists_nhds_subset C.disc₀ (mem_univ i) hmo + have hd : Disjoint (graphDrawingEdgeSet P_pres.Γ e) (discBd L) := by + rw [disjoint_left, E.bdL] + rintro x hx (h | h) + · exact C.edgeSet_disjoint he hx (Surface.discBd_subset _ (E.A_subset h)) + · exact edgeSet_disjoint_subgraphU he hS.path.le heQ hx h + rcases subset_interior_or_compl E.disc (isPreconnected_edgeSet he) hd with h | h + · exact h.trans interior_subset + · exfalso + have hcl : vertexPt P_pres.Γ m ∈ closure (graphDrawingEdgeSet P_pres.Γ e) := + graphDrawingVertexSet_subset_closure_edge P_pres.Γ hlink + ((mem_vertexSet_iff P_pres.Γ hmG).mpr rfl) + obtain ⟨y, hyN, hye⟩ := mem_closure_iff.mp hcl N' hN' hmN + have hyW : y ∈ P_pres.Δ₀ ∪ ⋃ j ∈ (univ : Set {L // IsLawn P_pres L}), j.1 := by + rw [← wallDisc_eq] + exact interior_subset (hi.2 hye) + exact h hye (hsub ⟨hyN, hyW⟩) + +/-- **The first half of pages 67 and 68 of Graph Minors IX**: a clean presentation of a simple rural +neighborhood is regular. -/ +theorem isRegularPresentation : IsRegularPresentation P_pres where + lawn_inter_subset_common_ends := fun _ _ _ _ hL hL' hne _ hx => C.lawn_inter_subset hL hL' hne hx + exists_lawn_of_short_path := fun _ _ _ hP hab ha hb hd hc => + C.exists_lawn_of_short_path ⟨hP, hab, ha, hb, hd, hc⟩ + isClosedDisc_wallDisc := C.isClosedDisc_wallDisc + edge_trichotomy := fun _ he => C.edge_trichotomy he + prominence_U_subset_wall := fun _ _ hL => C.prominence_U_subset_wall hL + wall_subset := C.wall_subset + internal_edge_subset_lawn_of_middle := fun _ _ _ _ hL hm hi hinc => + C.internal_edge_subset_lawn_of_middle hL hm hi hinc + +end IsCleanPresentation + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/NestEdgeCount.lean b/LeanPool/GraphMinor/GM09/NestEdgeCount.lean new file mode 100644 index 0000000000..e828515837 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/NestEdgeCount.lean @@ -0,0 +1,237 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Basic + +/-! +# Edge minimization for nest uncrossing + +These graph lemmas establish the three moves in the proof of Graph Minors III, (4.1), +pages 60–61. The drawing versions use the vertex and edge sets of the associated graphs. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Graph + +universe u v + +variable {α : Type u} {β : Type v} + +/-- If `C, D ≤ G` are vertex-disjoint subgraphs of `G`, then their edge sets are disjoint. -/ +theorem disjoint_edgeSet_of_disjoint_vertexSet {G C D : Graph α β} + (hC : C ≤ G) (hD : D ≤ G) (hV : Disjoint V(C) V(D)) : + Disjoint E(C) E(D) := by + refine disjoint_left.mpr fun e heC heD => ?_ + obtain ⟨x, y, hxyC⟩ := C.exists_isLink_of_mem_edgeSet heC + have hxyG : G.IsLink e x y := hxyC.mono hC + have hxyD : D.IsLink e x y := (hD.isLink_iff heD).mpr hxyG + exact disjoint_left.mp hV hxyC.left_mem hxyD.left_mem + +/-- The set of all edges in `C₁ ∪ ⋯ ∪ C_s ∪ P₁ ∪ ⋯ ∪ P_r`. -/ +def totalUnionEdgeSet {s r : ℕ} (C : Fin s → Graph α β) (P : Fin r → Graph α β) : Set β := + (⋃ j : Fin s, E(C j)) ∪ (⋃ i : Fin r, E(P i)) + +/-- The total number of edges `|E(C₁ ∪ ⋯ ∪ C_s ∪ P₁ ∪ ⋯ ∪ P_r)|` minimized in `(1)` of the proof of +Graph Minors III, (4.1) (page 60). -/ +noncomputable def totalUnionEdges {s r : ℕ} (C : Fin s → Graph α β) (P : Fin r → Graph α β) : ℕ := + (totalUnionEdgeSet C P).ncard + +theorem totalUnionEdgeSet_subset_edgeSet {s r : ℕ} {G : Graph α β} + {C : Fin s → Graph α β} {P : Fin r → Graph α β} + (hCG : ∀ j, C j ≤ G) (hPG : ∀ i, P i ≤ G) : + totalUnionEdgeSet C P ⊆ E(G) := + union_subset (iUnion_subset fun j => (hCG j).edgeSet_mono) + (iUnion_subset fun i => (hPG i).edgeSet_mono) + +theorem totalUnionEdgeSet_finite {s r : ℕ} {G : Graph α β} (hfin : E(G).Finite) + {C : Fin s → Graph α β} {P : Fin r → Graph α β} + (hCG : ∀ j, C j ≤ G) (hPG : ∀ i, P i ≤ G) : + (totalUnionEdgeSet C P).Finite := + hfin.subset (totalUnionEdgeSet_subset_edgeSet hCG hPG) + +/-- Condition `(1)` of the proof of Graph Minors III, (4.1) (page 60): +"Choose $C_1, \dots, C_s, P_1, \dots, P_r$ with $$ |E(C_1 \cup \cdots \cup C_s \cup P_1 \cup +\cdots \cup P_r)| \text{ minimum.}" -/ +theorem exists_min_totalUnionEdges {s r : ℕ} + (IsValidPair : (Fin s → Graph α β) → (Fin r → Graph α β) → Prop) + (hex : ∃ C₀ P₀, IsValidPair C₀ P₀) : + ∃ C P, IsValidPair C P ∧ + ∀ C' P', IsValidPair C' P' → totalUnionEdges C P ≤ totalUnionEdges C' P' := by + classical + obtain ⟨C₀, P₀, h₀⟩ := hex + have hne : {n : ℕ | ∃ C P, IsValidPair C P ∧ totalUnionEdges C P = n}.Nonempty := + ⟨totalUnionEdges C₀ P₀, C₀, P₀, h₀, rfl⟩ + obtain ⟨C, P, hCP, hmin⟩ := Nat.sInf_mem hne + refine ⟨C, P, hCP, fun C' P' h' => ?_⟩ + rw [hmin] + exact Nat.sInf_le ⟨C', P', h', rfl⟩ + +/-- **Move 1 (Boundary shortening move, GM03 (4.1) paragraph 2, page 60)**: +Replacing `P i` by a subpath `P'_i ≤ P i` that omits an edge `e ∈ E(P i)` not lying in any `E(C j)` +strictly decreases `totalUnionEdges C P`. -/ +theorem totalUnionEdges_lt_of_replace_subpath {s r : ℕ} [DecidableEq (Fin r)] {G : Graph α β} + (hfin : E(G).Finite) + {C : Fin s → Graph α β} {P : Fin r → Graph α β} + (hCG : ∀ j, C j ≤ G) (hPG : ∀ k, P k ≤ G) + (hP_disj : Pairwise (fun k₁ k₂ => Disjoint V(P k₁) V(P k₂))) + {i : Fin r} {P'_i : Graph α β} (hP'_le : P'_i ≤ P i) + {e : β} (he_Pi : e ∈ E(P i)) (he_not_P' : e ∉ E(P'_i)) + (he_not_C : ∀ j : Fin s, e ∉ E(C j)) : + totalUnionEdges C (Function.update P i P'_i) < totalUnionEdges C P := by + have hsub : totalUnionEdgeSet C (Function.update P i P'_i) ⊆ totalUnionEdgeSet C P := by + rintro f (hfC | hfP) + · exact Or.inl hfC + · obtain ⟨k, hfk⟩ := mem_iUnion.mp hfP + by_cases hki : k = i + · subst hki + rw [Function.update_self] at hfk + exact Or.inr (mem_iUnion.mpr ⟨k, hP'_le.edgeSet_mono hfk⟩) + · rw [Function.update_of_ne hki] at hfk + exact Or.inr (mem_iUnion.mpr ⟨k, hfk⟩) + have he_in : e ∈ totalUnionEdgeSet C P := + Or.inr (mem_iUnion.mpr ⟨i, he_Pi⟩) + have he_not_in : e ∉ totalUnionEdgeSet C (Function.update P i P'_i) := by + rintro (heC | heP) + · obtain ⟨j, hej⟩ := mem_iUnion.mp heC + exact he_not_C j hej + · obtain ⟨k, hek⟩ := mem_iUnion.mp heP + by_cases hki : k = i + · subst hki + rw [Function.update_self] at hek + exact he_not_P' hek + · rw [Function.update_of_ne hki] at hek + have hdisjE := disjoint_edgeSet_of_disjoint_vertexSet (hPG i) (hPG k) (hP_disj + (Ne.symm hki)) + exact disjoint_left.mp hdisjE he_Pi hek + exact Set.ncard_lt_ncard ⟨hsub, fun h => he_not_in (h he_in)⟩ + (totalUnionEdgeSet_finite hfin hCG hPG) + +/-- **Move 2 (Outer detour move, GM03 (4.1) paragraph 4, page 60)**: +If `P_sub ≤ P i` and `C j = Q₁ ∪ Q₂` where `Q₁, Q₂ ≤ C j` are edge-disjoint and `Q₂` contains an +edge `e₀` not in any `E(P k)`, then replacing `C j` by `subgraphUnion G P_sub Q₁` strictly decreases +`totalUnionEdges C P`. -/ +theorem totalUnionEdges_lt_of_replace_circuit {s r : ℕ} [DecidableEq (Fin s)] {G : Graph α β} + (hfin : E(G).Finite) + {C : Fin s → Graph α β} {P : Fin r → Graph α β} + (hCG : ∀ m, C m ≤ G) (hPG : ∀ k, P k ≤ G) + (hC_disj : Pairwise (fun m₁ m₂ => Disjoint V(C m₁) V(C m₂))) + {j : Fin s} {i : Fin r} {P_sub Q₁ Q₂ : Graph α β} + (hP_sub : P_sub ≤ P i) (hQ₁ : Q₁ ≤ C j) (hQ₂ : Q₂ ≤ C j) + (hQ_disj : Disjoint E(Q₁) E(Q₂)) + {e₀ : β} (he₀_Q₂ : e₀ ∈ E(Q₂)) (he₀_not_P : ∀ k : Fin r, e₀ ∉ E(P k)) : + totalUnionEdges (Function.update C j (subgraphUnion G P_sub Q₁)) P < + totalUnionEdges C P := by + have hP_sub_G : P_sub ≤ G := hP_sub.trans (hPG i) + have hQ₁_G : Q₁ ≤ G := hQ₁.trans (hCG j) + have he₀_Cj : e₀ ∈ E(C j) := hQ₂.edgeSet_mono he₀_Q₂ + have hsub : totalUnionEdgeSet (Function.update C j (subgraphUnion G P_sub Q₁)) P ⊆ + totalUnionEdgeSet C P := by + rintro f (hfC | hfP) + · obtain ⟨m, hfm⟩ := mem_iUnion.mp hfC + by_cases hmj : m = j + · subst hmj + rw [Function.update_self, edgeSet_subgraphUnion hP_sub_G hQ₁_G] at hfm + rcases hfm with hfm_P | hfm_Q₁ + · exact Or.inr (mem_iUnion.mpr ⟨i, hP_sub.edgeSet_mono hfm_P⟩) + · exact Or.inl (mem_iUnion.mpr ⟨m, hQ₁.edgeSet_mono hfm_Q₁⟩) + · rw [Function.update_of_ne hmj] at hfm + exact Or.inl (mem_iUnion.mpr ⟨m, hfm⟩) + · exact Or.inr hfP + have he₀_in : e₀ ∈ totalUnionEdgeSet C P := + Or.inl (mem_iUnion.mpr ⟨j, he₀_Cj⟩) + have he₀_not_in : + e₀ ∉ totalUnionEdgeSet (Function.update C j (subgraphUnion G P_sub Q₁)) P := by + rintro (heC | heP) + · obtain ⟨m, hem⟩ := mem_iUnion.mp heC + by_cases hmj : m = j + · subst hmj + rw [Function.update_self, edgeSet_subgraphUnion hP_sub_G hQ₁_G] at hem + rcases hem with hem_P | hem_Q₁ + · exact he₀_not_P i (hP_sub.edgeSet_mono hem_P) + · exact disjoint_left.mp hQ_disj hem_Q₁ he₀_Q₂ + · rw [Function.update_of_ne hmj] at hem + have hdisjE := disjoint_edgeSet_of_disjoint_vertexSet (hCG j) (hCG m) (hC_disj + (Ne.symm hmj)) + exact disjoint_left.mp hdisjE he₀_Cj hem + · obtain ⟨k, hek⟩ := mem_iUnion.mp heP + exact he₀_not_P k hek + exact Set.ncard_lt_ncard ⟨hsub, fun h => he₀_not_in (h he₀_in)⟩ + (totalUnionEdgeSet_finite hfin hCG hPG) + +/-- **Move 3 (Inner detour move, GM03 (4.1) paragraph 6, page 61)**: +If `P_sub ≤ P i`, `Q_k ≤ C j`, and `P'_i` is a rerouted path with `V(P'_i) ⊆ V(P i) ∪ V(Q_k)` and +`E(P'_i) ⊆ (E(P i) \ E(P_sub)) ∪ E(Q_k)`, where `V(Q_k)` is disjoint from `V(P i')` for all +`i' ≠ i`, and `e₁ ∈ E(P_sub)` lies in no `E(C m)`, then `Function.update P i P'_i` is pairwise +vertex-disjoint and strictly decreases `totalUnionEdges C P`. -/ +theorem totalUnionEdges_lt_of_reroute_path {s r : ℕ} [DecidableEq (Fin r)] {G : Graph α β} + (hfin : E(G).Finite) + {C : Fin s → Graph α β} {P : Fin r → Graph α β} + (hCG : ∀ m, C m ≤ G) (hPG : ∀ k, P k ≤ G) + (hP_disj : Pairwise (fun k₁ k₂ => Disjoint V(P k₁) V(P k₂))) + {j : Fin s} {i : Fin r} {P_sub Q_k P'_i : Graph α β} + (hP_sub : P_sub ≤ P i) (hQ_k : Q_k ≤ C j) + (hP'_V : V(P'_i) ⊆ V(P i) ∪ V(Q_k)) + (hP'_E : E(P'_i) ⊆ (E(P i) \ E(P_sub)) ∪ E(Q_k)) + (hQ_disj_other : ∀ i' : Fin r, i' ≠ i → Disjoint V(Q_k) V(P i')) + {e₁ : β} (he₁_sub : e₁ ∈ E(P_sub)) (he₁_not_C : ∀ m : Fin s, e₁ ∉ E(C m)) : + Pairwise (fun k₁ k₂ => Disjoint V(Function.update P i P'_i k₁) V(Function.update P i P'_i k₂)) ∧ + totalUnionEdges C (Function.update P i P'_i) < totalUnionEdges C P := by + refine ⟨?_, ?_⟩ + · intro k₁ k₂ hk₁₂ + by_cases hk₁ : k₁ = i + · subst hk₁ + have hk₂ : k₂ ≠ k₁ := hk₁₂.symm + rw [Function.update_self, Function.update_of_ne hk₂] + exact disjoint_of_subset_left hP'_V + (disjoint_union_left.mpr ⟨hP_disj hk₁₂, hQ_disj_other k₂ hk₂⟩) + · by_cases hk₂ : k₂ = i + · subst hk₂ + rw [Function.update_of_ne hk₁, Function.update_self] + exact disjoint_of_subset_right hP'_V + (disjoint_union_right.mpr ⟨hP_disj hk₁₂, (hQ_disj_other k₁ hk₁).symm⟩) + · rw [Function.update_of_ne hk₁, Function.update_of_ne hk₂] + exact hP_disj hk₁₂ + · have he₁_Pi : e₁ ∈ E(P i) := hP_sub.edgeSet_mono he₁_sub + have hsub : totalUnionEdgeSet C (Function.update P i P'_i) ⊆ totalUnionEdgeSet C P := by + rintro f (hfC | hfP) + · exact Or.inl hfC + · obtain ⟨k, hfk⟩ := mem_iUnion.mp hfP + by_cases hki : k = i + · subst hki + rw [Function.update_self] at hfk + rcases hP'_E hfk with ⟨hfPi, _⟩ | hfQ + · exact Or.inr (mem_iUnion.mpr ⟨k, hfPi⟩) + · exact Or.inl (mem_iUnion.mpr ⟨j, hQ_k.edgeSet_mono hfQ⟩) + · rw [Function.update_of_ne hki] at hfk + exact Or.inr (mem_iUnion.mpr ⟨k, hfk⟩) + have he₁_in : e₁ ∈ totalUnionEdgeSet C P := + Or.inr (mem_iUnion.mpr ⟨i, he₁_Pi⟩) + have he₁_not_in : e₁ ∉ totalUnionEdgeSet C (Function.update P i P'_i) := by + rintro (heC | heP) + · obtain ⟨m, hem⟩ := mem_iUnion.mp heC + exact he₁_not_C m hem + · obtain ⟨k, hek⟩ := mem_iUnion.mp heP + by_cases hki : k = i + · subst hki + rw [Function.update_self] at hek + rcases hP'_E hek with ⟨_, he_not_sub⟩ | heQ + · exact he_not_sub he₁_sub + · exact he₁_not_C j (hQ_k.edgeSet_mono heQ) + · rw [Function.update_of_ne hki] at hek + have hdisjE := disjoint_edgeSet_of_disjoint_vertexSet (hPG i) (hPG k) + (hP_disj (Ne.symm hki)) + exact disjoint_left.mp hdisjE he₁_Pi hek + exact Set.ncard_lt_ncard ⟨hsub, fun h => he₁_not_in (h he₁_in)⟩ + (totalUnionEdgeSet_finite hfin hCG hPG) + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/NestUncrossing.lean b/LeanPool/GraphMinor/GM09/NestUncrossing.lean new file mode 100644 index 0000000000..8ffeb65f04 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/NestUncrossing.lean @@ -0,0 +1,2462 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM09.Basic +public import LeanPool.GraphMinor.GM09.NestEdgeCount +public import LeanPool.GraphMinor.GM09.PlanarNests +public import LeanPool.GraphMinor.GM09.GraphCircuits +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section11b +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! +# The Nest-and-Paths Uncrossing Argument (Graph Minors III, Theorem (4.1)) + +This file formalizes the uncrossing argument from the proof of **Graph Minors III, Theorem (4.1)** +(pages 59–61), which is used both in **Graph Minors IX, (10.1)** (page 64: *"The proof of (10.1) is +very similar to the proof of [2, Theorem (4.1)], and we omit it."*) and in **Graph Minors XIV, +(9.5), Claim (3)** (page 46: *"By [1, theorem (4.1)], or rather by the proof of that theorem, we +deduce from (1) and (2) that (3)..."*). + +Following the proof of Graph Minors III, (4.1) step by step: +1. **Circuit splitting and joining (`IsGraphCircuit.exists_two_paths`, + `isGraphCircuit_subgraphUnion`)**: any circuit `C` and distinct vertices `v, v' ∈ V(C)` decompose + `C` into two edge-disjoint paths `Q₁, Q₂` between `v` and `v'` with `V(Q₁) ∩ V(Q₂) = {v, v'}` and + `Q₁ ∪ Q₂ = C`; conversely, two internally vertex-disjoint and edge-disjoint paths between `v` and + `v'` form a circuit. +2. **Walk and path intersection decomposition (`path_inter_isPath_or_exists_shorter_subpath`, + `exists_detour_of_inter_not_path`)**: + - If a path `P` starts at `a ∈ V(C)` and `C ∩ P` is not a path, then taking the first edge + `e ∈ E(P) \ E(C)` (whose left endpoint lies in `V(C)`) yields a shorter subpath `P' ≤ P` from + `V(C)` to the other end of `P` that avoids `e`. + - More generally, if `(V(C) ∩ V(P)).Nonempty` and `C ∩ P` is not a path, then there is a detour + subpath `P_sub ≤ P` between distinct vertices `v, v' ∈ V(C) ∩ V(P)` with + `V(P_sub) ∩ V(C) = {v, v'}`, `Disjoint E(P_sub) E(C)`, and a first edge `e ∈ E(P_sub)` incident + with `v ∈ V(C)`. +3. **Edge-count minimization (`totalUnionEdges`, `exists_min_totalUnionEdges`)**: among all valid + pairs `(C, P)` of an `s`-nest `C` and a family `P` of `r` vertex-disjoint paths, choose `(C, P)` + minimizing `|E(C₁ ∪ ⋯ ∪ C_s ∪ P₁ ∪ ⋯ ∪ P_r)|` (Condition `(1)`). +4. **Boundary shortening move (`totalUnionEdges_lt_of_replace_subpath`)**: replacing `P_i` by a + subpath `P'_i ≤ P_i` omitting an edge `e ∈ E(P_i)` incident with `V(C_j)` and not in `E(C_j)` + strictly decreases `totalUnionEdges C P`. +5. **Outer detour move (`totalUnionEdges_lt_of_replace_circuit`)**: replacing `C_j` by + `P_sub ∪ Q₁` when `P_sub ≤ P_i` is an outer detour between `v, v' ∈ V(C_j)` and `Q₂` has an edge + `e₀` not in `⋃_k E(P_k)` strictly decreases `totalUnionEdges C P`, establishing Property `(2)` + (`subpath_to_outer_no_edges_outside`). +6. **Inner detour move (`reroute_path_along_arc`, `disjoint_other_paths_of_no_escape_from_arc`, + `totalUnionEdges_lt_of_reroute_path`)**: when `P_sub ≤ P_i` is an inner detour between + `v, v' ∈ V(C_j)` and no path inside `C_j` avoiding `V(P_sub)` connects `V(Q_k)` to the + inner/outer + target, Property `(2)` implies `Disjoint V(Q_k) V(P_{i'})` for all `i' ≠ i`; rerouting `P_i` + through `Q_k` without `E(P_sub)` preserves pairwise vertex-disjointness of `P` and omits the + first + edge `e₁ ∈ E(P_sub)` (which lies in no `E(C_m)`), strictly decreasing `totalUnionEdges C P`. +7. **Master uncrossing theorem (`nest_uncrossing`, `theorem_10_1`)**: combining these steps proves + that at a minimum-edge configuration `(C, P)`, every intersection `P_i ∩ C_j` is a path. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Graph GraphMinor GraphMinor.Surface +open PlanarNests (exists_first_hit_split not_isLink_self_of_mem_edges_of_isSimple) + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## 2. Combinatorial Structure of `C ∩ P`: Prefix Paths, Shorter Subpaths, and Detours -/ + +/-- If `e` is an edge of `G` with an endpoint `u ∈ V(C j)`, `e ∉ E(C j)`, and `C` is a pairwise +vertex-disjoint family of subgraphs of `G`, then `e ∉ E(C m)` for all `m`. -/ +theorem not_mem_edgeSet_of_endpoint_mem_disjoint_family {s : ℕ} {G : Graph α β} + {C : Fin s → Graph α β} (hCG : ∀ m, C m ≤ G) + (hC_disj : Pairwise (fun m₁ m₂ => Disjoint V(C m₁) V(C m₂))) + {j : Fin s} {e : β} {u w : α} (hl : G.IsLink e u w) + (hu : u ∈ V(C j)) (he_not : e ∉ E(C j)) : + ∀ m : Fin s, e ∉ E(C m) := by + intro m hm + by_cases hmj : m = j + · exact he_not (hmj ▸ hm) + · have hCm_link : (C m).IsLink e u w := ((hCG m).isLink_iff hm).mpr hl + exact disjoint_left.mp (hC_disj hmj) hCm_link.left_mem hu + +private theorem inter_walk_nil_path {G C : Graph α β} (hCG : C ≤ G) + {a : α} (ha : a ∈ V(C)) (haG : a ∈ V(G)) : + IsGraphPathWithEnds G (subgraphInter G C (walkSubgraph (GraphWalk.nil haG))) a a := by + have heq : subgraphInter G C (walkSubgraph (GraphWalk.nil haG)) = + walkSubgraph (GraphWalk.nil haG) := by + refine (Compatible.of_le_le (subgraphInter_le hCG) (walkSubgraph_le _)).ext ?_ ?_ + · rw [vertexSet_subgraphInter, vertexSet_walkSubgraph] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.support_nil, List.mem_singleton] + exact ⟨fun h => h.2, fun h => ⟨h ▸ ha, h⟩⟩ + · rw [edgeSet_subgraphInter hCG (walkSubgraph_le _), edgeSet_walkSubgraph] + simp + rw [heq] + exact isGraphPathWithEnds_walkSubgraph (List.nodup_singleton a) + +private theorem inter_walk_cons_path {G C : Graph α β} (hCG : C ≤ G) + {a w b u : α} {e : β} {hl : G.IsLink e a w} {r : GraphWalk G w b} + (ha : a ∈ V(C)) (heC : e ∈ E(C)) (ha_not_r : a ∉ r.support) + (hpath_r : IsGraphPathWithEnds G (subgraphInter G C (walkSubgraph r)) w u) : + IsGraphPathWithEnds G (subgraphInter G C (walkSubgraph (GraphWalk.cons hl r))) a u := by + obtain ⟨hsub_r, W_r, hW_r_s, hV_r, hE_r⟩ := hpath_r + obtain ⟨W_r_G, hs_r, he_r⟩ := exists_walk_up_of_le hsub_r W_r + have ha_not_Wr : a ∉ W_r_G.support := by + intro ha_in + rw [hs_r] at ha_in + have ha_mem : a ∈ V(subgraphInter G C (walkSubgraph r)) := by + rw [hV_r]; exact ha_in + rw [vertexSet_subgraphInter, vertexSet_walkSubgraph] at ha_mem + exact ha_not_r ha_mem.2 + have hW_cons_s : (GraphWalk.cons hl W_r_G).IsSimple := + List.nodup_cons.mpr ⟨ha_not_Wr, by rw [hs_r]; exact hW_r_s⟩ + have heq : subgraphInter G C (walkSubgraph (GraphWalk.cons hl r)) = + walkSubgraph (GraphWalk.cons hl W_r_G) := by + refine (Compatible.of_le_le (subgraphInter_le hCG) (walkSubgraph_le _)).ext ?_ ?_ + · rw [vertexSet_subgraphInter, vertexSet_walkSubgraph, vertexSet_walkSubgraph] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.support_cons, List.mem_cons] + constructor + · rintro ⟨hxC, rfl | hxr⟩ + · exact Or.inl rfl + · right + rw [hs_r] + have hx_in : x ∈ V(subgraphInter G C (walkSubgraph r)) := by + rw [vertexSet_subgraphInter, vertexSet_walkSubgraph] + exact ⟨hxC, hxr⟩ + rwa [hV_r] at hx_in + · rintro (rfl | hxWr) + · exact ⟨ha, Or.inl rfl⟩ + · rw [hs_r] at hxWr + have hx_in : x ∈ V(subgraphInter G C (walkSubgraph r)) := by + rw [hV_r]; exact hxWr + rw [vertexSet_subgraphInter, vertexSet_walkSubgraph] at hx_in + exact ⟨hx_in.1, Or.inr hx_in.2⟩ + · rw [edgeSet_subgraphInter hCG (walkSubgraph_le _), edgeSet_walkSubgraph, + edgeSet_walkSubgraph] + ext f + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.edges_cons, List.mem_cons] + constructor + · rintro ⟨hfC, rfl | hfr⟩ + · exact Or.inl rfl + · right + rw [he_r] + have hf_in : f ∈ E(subgraphInter G C (walkSubgraph r)) := by + rw [edgeSet_subgraphInter hCG (walkSubgraph_le r), edgeSet_walkSubgraph] + exact ⟨hfC, hfr⟩ + rwa [hE_r] at hf_in + · rintro (rfl | hfWr) + · exact ⟨heC, Or.inl rfl⟩ + · rw [he_r] at hfWr + have hf_in : f ∈ E(subgraphInter G C (walkSubgraph r)) := by + rw [hE_r]; exact hfWr + rw [edgeSet_subgraphInter hCG (walkSubgraph_le r), edgeSet_walkSubgraph] at hf_in + exact ⟨hf_in.1, Or.inr hf_in.2⟩ + rw [heq] + exact isGraphPathWithEnds_walkSubgraph hW_cons_s + +private theorem inter_walk_first_vertex_path {G C : Graph α β} (hCG : C ≤ G) + {a w b : α} {e : β} {hl : G.IsLink e a w} {r : GraphWalk G w b} + (ha : a ∈ V(C)) (heC : e ∉ E(C)) (hhit' : ∀ x ∈ r.support, x ∉ V(C)) : + IsGraphPathWithEnds G (subgraphInter G C (walkSubgraph (GraphWalk.cons hl r))) a a := by + have haG : a ∈ V(G) := hl.left_mem + have heq : subgraphInter G C (walkSubgraph (GraphWalk.cons hl r)) = + walkSubgraph (GraphWalk.nil haG) := by + refine (Compatible.of_le_le (subgraphInter_le hCG) (walkSubgraph_le _)).ext ?_ ?_ + · rw [vertexSet_subgraphInter, vertexSet_walkSubgraph, vertexSet_walkSubgraph] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.support_cons, List.mem_cons, + GraphWalk.support_nil, List.not_mem_nil, or_false] + constructor + · rintro ⟨hxC, rfl | hxr⟩ + · rfl + · exact (hhit' x hxr hxC).elim + · rintro rfl + exact ⟨ha, Or.inl rfl⟩ + · rw [edgeSet_subgraphInter hCG (walkSubgraph_le _), edgeSet_walkSubgraph, + edgeSet_walkSubgraph] + ext f + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.edges_cons, List.mem_cons, + GraphWalk.edges_nil, List.not_mem_nil, iff_false, not_and] + rintro hfC (rfl | hfr) + · exact heC hfC + · obtain ⟨x, y, hxyC⟩ := C.exists_isLink_of_mem_edgeSet hfC + have hxyG : G.IsLink f x y := hxyC.mono hCG + have hx_r : x ∈ r.support := r.left_mem_support_of_mem_edges hfr hxyG + exact hhit' x hx_r hxyC.left_mem + rw [heq] + exact isGraphPathWithEnds_walkSubgraph (List.nodup_singleton a) + +/-- Along a simple walk `W` in `G` starting at `a ∈ V(C)` (where `C ≤ G`), either: +1. `subgraphInter G C (walkSubgraph W)` is a path in `G` from `a` to some `u ∈ V(C)`, or +2. there is a first edge `e ∈ W.edges \ E(C)` whose left endpoint `u` lies in `V(C)` and after + which `W` visits `V(C)` again at some vertex `v ∈ V(C)`, yielding a simple subwalk `W'` from `v` + to `b` that does not use `e`. -/ +theorem walk_inter_isPath_or_exists_shorter_subwalk {G C : Graph α β} (hCG : C ≤ G) + {a b : α} (W : GraphWalk G a b) (hW : W.IsSimple) (ha : a ∈ V(C)) : + (∃ u ∈ V(C), IsGraphPathWithEnds G (subgraphInter G C (walkSubgraph W)) a u) ∨ + (∃ u ∈ V(C), ∃ w : α, ∃ e ∈ W.edges, G.IsLink e u w ∧ e ∉ E(C) ∧ + ∃ v ∈ V(C), ∃ W' : GraphWalk G v b, W'.IsSimple ∧ + (∀ x ∈ W'.support, x ∈ W.support) ∧ + (∀ f ∈ W'.edges, f ∈ W.edges) ∧ e ∉ W'.edges) := by + induction W with + | @nil a haG => + left + refine ⟨a, ha, ?_⟩ + exact inter_walk_nil_path hCG ha haG + | @cons a w b e hl r ih => + have ha_not_r : a ∉ r.support := (List.nodup_cons.mp hW).1 + have hr_simple : r.IsSimple := (List.nodup_cons.mp hW).2 + have he_not_r : e ∉ r.edges := fun he_in => + ha_not_r (r.left_mem_support_of_mem_edges he_in hl) + by_cases heC : e ∈ E(C) + · have hlC : C.IsLink e a w := (hCG.isLink_iff heC).mpr hl + have hwC : w ∈ V(C) := hlC.right_mem + rcases ih hr_simple hwC with ⟨u, huC, hpath_r⟩ | + ⟨u, huC, w', e', he'r, hl', he'C, v, hvC, W', hW's, hW'V, hW'E, he'W'⟩ + · left + refine ⟨u, huC, ?_⟩ + exact inter_walk_cons_path hCG ha heC ha_not_r hpath_r + · right + exact ⟨u, huC, w', e', List.mem_cons_of_mem e he'r, hl', he'C, v, hvC, W', hW's, + fun x hx => List.mem_cons_of_mem a (hW'V x hx), + fun f hf => List.mem_cons_of_mem e (hW'E f hf), he'W'⟩ + · by_cases hhit : ∃ v ∈ r.support, v ∈ V(C) + · right + obtain ⟨v, hvr, hvC⟩ := hhit + obtain ⟨r₁, r₂, hsplit⟩ := r.exists_append_of_mem hvr + have hr₂_s : r₂.IsSimple := (isSimple_of_append (hsplit ▸ hr_simple)).2 + have hr₂_V : ∀ x ∈ r₂.support, x ∈ r.support := fun x hx => by + rw [hsplit, GraphWalk.mem_support_append] + exact Or.inr hx + have hr₂_E : ∀ f ∈ r₂.edges, f ∈ r.edges := fun f hf => by + rw [hsplit, GraphWalk.edges_append, List.mem_append] + exact Or.inr hf + refine ⟨a, ha, w, e, List.mem_cons_self, hl, heC, v, hvC, r₂, hr₂_s, + fun x hx => List.mem_cons_of_mem a (hr₂_V x hx), + fun f hf => List.mem_cons_of_mem e (hr₂_E f hf), + fun he_in => he_not_r (hr₂_E e he_in)⟩ + · left + have hhit' : ∀ x ∈ r.support, x ∉ V(C) := fun x hx hxC => hhit ⟨x, hx, hxC⟩ + refine ⟨a, ha, ?_⟩ + exact inter_walk_first_vertex_path hCG ha heC hhit' + +/-- Path version of `walk_inter_isPath_or_exists_shorter_subwalk` (Graph Minors III, (4.1), +paragraph 2, page 60): if `P` is a path in `G` from `a ∈ V(C)` to `b` and `C ∩ P` is not a path, +then taking the first edge `e` of `P` not in `C` yields a subpath `P' ≤ P` from some `v ∈ V(C)` to +`b` not using `e`, where `e` has an endpoint `u ∈ V(C)`. -/ +theorem path_inter_isPath_or_exists_shorter_subpath {G C P : Graph α β} (hCG : C ≤ G) + {a b : α} (hP : IsGraphPathWithEnds G P a b) (ha : a ∈ V(C)) : + (∃ u ∈ V(C), IsGraphPathWithEnds G (subgraphInter G C P) a u) ∨ + (∃ u ∈ V(C), ∃ w : α, ∃ e ∈ E(P), G.IsLink e u w ∧ e ∉ E(C) ∧ + ∃ v ∈ V(C), ∃ P' : Graph α β, P' ≤ P ∧ IsGraphPathWithEnds G P' v b ∧ e ∉ E(P')) := by + obtain ⟨hPG, W, hW, hVP, hEP⟩ := hP + obtain ⟨WG, hsG, heG⟩ := exists_walk_up_of_le hPG W + have hWG_s : WG.IsSimple := by unfold GraphWalk.IsSimple; rw [hsG]; exact hW + have hP_eq : P = walkSubgraph WG := by + refine (Compatible.of_le_le hPG (walkSubgraph_le WG)).ext ?_ ?_ + · rw [hVP, vertexSet_walkSubgraph, hsG] + · rw [hEP, edgeSet_walkSubgraph, heG] + rcases walk_inter_isPath_or_exists_shorter_subwalk hCG WG hWG_s ha with + ⟨u, huC, hpath⟩ | ⟨u, huC, w, e, heWG, hl, heC, v, hvC, W', hW's, hW'V, hW'E, heW'⟩ + · left + exact ⟨u, huC, hP_eq.symm ▸ hpath⟩ + · right + have heP : e ∈ E(P) := by rw [hEP, ← heG]; exact heWG + let P' := walkSubgraph W' + have hP'P : P' ≤ P := by + rw [hP_eq, (Compatible.of_le_le (walkSubgraph_le W') (walkSubgraph_le WG)).le_iff, + vertexSet_walkSubgraph, vertexSet_walkSubgraph, edgeSet_walkSubgraph, edgeSet_walkSubgraph] + exact ⟨hW'V, hW'E⟩ + exact ⟨u, huC, w, e, heP, hl, heC, v, hvC, P', hP'P, + isGraphPathWithEnds_walkSubgraph hW's, by rw [edgeSet_walkSubgraph]; exact heW'⟩ + +private theorem inter_or_detour_of_walk {G C : Graph α β} {v₀ b : α} (hCG : C ≤ G) + (W₂ : GraphWalk G v₀ b) (hv₀C : v₀ ∈ V(C)) (hW₂s : W₂.IsSimple) : + (∃ u ∈ V(C), IsGraphPathWithEnds G (subgraphInter G C (walkSubgraph W₂)) v₀ u) ∨ + ∃ v ∈ V(C), v ∈ W₂.support ∧ ∃ v' ∈ V(C), v' ∈ W₂.support ∧ v ≠ v' ∧ + ∃ P_sub : Graph α β, P_sub ≤ walkSubgraph W₂ ∧ IsGraphPathWithEnds G P_sub v v' ∧ + V(P_sub) ∩ V(C) = {v, v'} ∧ Disjoint E(P_sub) E(C) ∧ + ∃ e ∈ E(P_sub), ∃ w : α, G.IsLink e v w := by + induction W₂ with + | @nil a haG => + left + refine ⟨a, hv₀C, ?_⟩ + exact inter_walk_nil_path hCG hv₀C haG + | @cons a w b e hl r ih => + have ha_not_r : a ∉ r.support := (List.nodup_cons.mp hW₂s).1 + have hr_s : r.IsSimple := (List.nodup_cons.mp hW₂s).2 + by_cases heC : e ∈ E(C) + · have hlC : C.IsLink e a w := (hCG.isLink_iff heC).mpr hl + have hwC : w ∈ V(C) := hlC.right_mem + rcases ih hwC hr_s with ⟨u, huC, hpath_r⟩ | + ⟨v, hvC, hvr, v', hv'C, hv'r, hvv', P_sub, hP_sub_r, hP_sub_path, hVC, hEC, hex_e⟩ + · left + refine ⟨u, huC, ?_⟩ + exact inter_walk_cons_path hCG hv₀C heC ha_not_r hpath_r + · right + have hr_le : walkSubgraph r ≤ walkSubgraph (GraphWalk.cons hl r) := by + rw [(Compatible.of_le_le (walkSubgraph_le r) (walkSubgraph_le _)).le_iff, + vertexSet_walkSubgraph, vertexSet_walkSubgraph, + edgeSet_walkSubgraph, edgeSet_walkSubgraph] + exact ⟨fun x hx => List.mem_cons_of_mem a hx, fun f hf => List.mem_cons_of_mem e hf⟩ + exact ⟨v, hvC, List.mem_cons_of_mem a hvr, v', hv'C, List.mem_cons_of_mem a hv'r, + hvv', P_sub, hP_sub_r.trans hr_le, hP_sub_path, hVC, hEC, hex_e⟩ + · by_cases hhit : ∃ x ∈ r.support, x ∈ V(C) + · right + obtain ⟨v', hv'C, r₁, r₂, hsplit_r, hr₁_first⟩ := exists_first_hit_split r hhit + have hr₁_s : r₁.IsSimple := (isSimple_of_append (hsplit_r ▸ hr_s)).1 + have ha_not_r₁ : a ∉ r₁.support := fun ha_in => + ha_not_r (hsplit_r ▸ (GraphWalk.mem_support_append r₁ r₂).mpr (Or.inl ha_in)) + have hcons_r₁_s : (GraphWalk.cons hl r₁).IsSimple := + List.nodup_cons.mpr ⟨ha_not_r₁, hr₁_s⟩ + have hav' : a ≠ v' := fun h => ha_not_r₁ (h ▸ r₁.end_mem_support) + have hv'_r : v' ∈ r.support := + hsplit_r ▸ (GraphWalk.mem_support_append r₁ r₂).mpr (Or.inl r₁.end_mem_support) + let P_sub := walkSubgraph (GraphWalk.cons hl r₁) + have hP_sub_le : P_sub ≤ walkSubgraph (GraphWalk.cons hl r) := by + rw [(Compatible.of_le_le (walkSubgraph_le _) (walkSubgraph_le _)).le_iff, + vertexSet_walkSubgraph, vertexSet_walkSubgraph, + edgeSet_walkSubgraph, edgeSet_walkSubgraph] + refine ⟨fun x hx => ?_, fun f hf => ?_⟩ + · rcases List.mem_cons.mp hx with rfl | hx₁ + · exact List.mem_cons_self + · exact List.mem_cons_of_mem a + (hsplit_r ▸ (GraphWalk.mem_support_append r₁ r₂).mpr (Or.inl hx₁)) + · rcases List.mem_cons.mp hf with rfl | hf₁ + · exact List.mem_cons_self + · refine List.mem_cons_of_mem e ?_ + rw [hsplit_r, GraphWalk.edges_append, List.mem_append] + exact Or.inl hf₁ + have hr₁_no_edge : ∀ f ∈ r₁.edges, f ∉ E(C) := by + intro f hf₁ hfC + obtain ⟨x, y, hxyC⟩ := C.exists_isLink_of_mem_edgeSet hfC + have hxyG : G.IsLink f x y := hxyC.mono hCG + have hx_s : x ∈ r₁.support := r₁.left_mem_support_of_mem_edges hf₁ hxyG + have hy_s : y ∈ r₁.support := r₁.left_mem_support_of_mem_edges hf₁ hxyG.symm + have hxv' : x = v' := hr₁_first x hx_s hxyC.left_mem + have hyv' : y = v' := hr₁_first y hy_s hxyC.right_mem + subst hxv' hyv' + exact not_isLink_self_of_mem_edges_of_isSimple r₁ hr₁_s hf₁ hxyG + refine ⟨a, hv₀C, List.mem_cons_self, v', hv'C, List.mem_cons_of_mem a hv'_r, hav', + P_sub, hP_sub_le, isGraphPathWithEnds_walkSubgraph hcons_r₁_s, ?_, ?_, + ⟨e, by rw [edgeSet_walkSubgraph]; exact List.mem_cons_self, w, hl⟩⟩ + · rw [vertexSet_walkSubgraph] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.support_cons, List.mem_cons, + mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨rfl | hx₁, hxC⟩ + · exact Or.inl rfl + · exact Or.inr (hr₁_first x hx₁ hxC) + · rintro (rfl | rfl) + · exact ⟨Or.inl rfl, hv₀C⟩ + · exact ⟨Or.inr r₁.end_mem_support, hv'C⟩ + · rw [edgeSet_walkSubgraph] + refine disjoint_left.mpr fun f hf hfC => ?_ + rcases List.mem_cons.mp hf with rfl | hf₁ + · exact heC hfC + · exact hr₁_no_edge f hf₁ hfC + · left + have hhit' : ∀ x ∈ r.support, x ∉ V(C) := fun x hx hxC => hhit ⟨x, hx, hxC⟩ + refine ⟨a, hv₀C, ?_⟩ + exact inter_walk_first_vertex_path hCG hv₀C heC hhit' + +/-- If a path `P` in `G` meets `V(C)` (where `C ≤ G`), then either `subgraphInter G C P` is a path +in `G`, or there are distinct vertices `v, v' ∈ V(C) ∩ V(P)` and a detour subpath `P_sub ≤ P` +between `v` and `v'` such that `V(P_sub) ∩ V(C) = {v, v'}`, `Disjoint E(P_sub) E(C)`, and there is +an edge `e ∈ E(P_sub)` incident with `v`. -/ +theorem isGraphPath_inter_or_exists_detour {G C P : Graph α β} (hCG : C ≤ G) + {a b : α} (hP : IsGraphPathWithEnds G P a b) (hne : (V(C) ∩ V(P)).Nonempty) : + IsGraphPath G (subgraphInter G C P) ∨ + ∃ v ∈ V(C) ∩ V(P), ∃ v' ∈ V(C) ∩ V(P), v ≠ v' ∧ + ∃ P_sub : Graph α β, P_sub ≤ P ∧ IsGraphPathWithEnds G P_sub v v' ∧ + V(P_sub) ∩ V(C) = {v, v'} ∧ Disjoint E(P_sub) E(C) ∧ + ∃ e ∈ E(P_sub), ∃ w : α, G.IsLink e v w := by + obtain ⟨hPG, W, hW, hVP, hEP⟩ := hP + obtain ⟨WG, hsG, heG⟩ := exists_walk_up_of_le hPG W + have hWG_s : WG.IsSimple := by change WG.support.Nodup; rw [hsG]; exact hW + have hP_eq : P = walkSubgraph WG := by + refine (Compatible.of_le_le hPG (walkSubgraph_le WG)).ext ?_ ?_ + · rw [hVP, vertexSet_walkSubgraph, hsG] + · rw [hEP, edgeSet_walkSubgraph, heG] + have hne_W : ∃ x ∈ WG.support, x ∈ V(C) := by + obtain ⟨x, hxC, hxP⟩ := hne + rw [hVP, ← hsG] at hxP + exact ⟨x, hxP, hxC⟩ + obtain ⟨v₀, hv₀C, W₁, W₂, hsplit, hW₁_first⟩ := exists_first_hit_split WG hne_W + have hsp12 := isSimple_of_append (hsplit ▸ hWG_s) + have hW₁_no_edge : ∀ f ∈ W₁.edges, f ∉ E(C) := by + intro f hf hfC + obtain ⟨x, y, hxyC⟩ := C.exists_isLink_of_mem_edgeSet hfC + have hxyG : G.IsLink f x y := hxyC.mono hCG + have hx_supp : x ∈ W₁.support := W₁.left_mem_support_of_mem_edges hf hxyG + have hy_supp : y ∈ W₁.support := W₁.left_mem_support_of_mem_edges hf hxyG.symm + have hxv₀ : x = v₀ := hW₁_first x hx_supp hxyC.left_mem + have hyv₀ : y = v₀ := hW₁_first y hy_supp hxyC.right_mem + subst hxv₀ hyv₀ + exact not_isLink_self_of_mem_edges_of_isSimple W₁ hsp12.1 hf hxyG + have hinter_eq : subgraphInter G C P = subgraphInter G C (walkSubgraph W₂) := by + rw [hP_eq, hsplit] + refine (Compatible.of_le_le (subgraphInter_le hCG) (subgraphInter_le hCG)).ext ?_ ?_ + · rw [vertexSet_subgraphInter, vertexSet_subgraphInter, vertexSet_walkSubgraph, + vertexSet_walkSubgraph] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.mem_support_append] + constructor + · rintro ⟨hxC, hx₁ | hx₂⟩ + · rw [hW₁_first x hx₁ hxC] + exact ⟨hv₀C, W₂.start_mem_support⟩ + · exact ⟨hxC, hx₂⟩ + · rintro ⟨hxC, hx₂⟩ + exact ⟨hxC, Or.inr hx₂⟩ + · rw [edgeSet_subgraphInter hCG (walkSubgraph_le _), + edgeSet_subgraphInter hCG (walkSubgraph_le _), edgeSet_walkSubgraph, edgeSet_walkSubgraph] + ext f + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.edges_append, List.mem_append] + constructor + · rintro ⟨hfC, hf₁ | hf₂⟩ + · exact (hW₁_no_edge f hf₁ hfC).elim + · exact ⟨hfC, hf₂⟩ + · rintro ⟨hfC, hf₂⟩ + exact ⟨hfC, Or.inr hf₂⟩ + -- Now walk along `W₂` starting at `v₀ ∈ V(C)` until the first edge not in `E(C)` after which + -- `W₂` hits `V(C)` again. + suffices hW₂_claim : + (∃ u ∈ V(C), IsGraphPathWithEnds G (subgraphInter G C (walkSubgraph W₂)) v₀ u) ∨ + ∃ v ∈ V(C), v ∈ W₂.support ∧ ∃ v' ∈ V(C), v' ∈ W₂.support ∧ v ≠ v' ∧ + ∃ P_sub : Graph α β, P_sub ≤ walkSubgraph W₂ ∧ IsGraphPathWithEnds G P_sub v v' ∧ + V(P_sub) ∩ V(C) = {v, v'} ∧ Disjoint E(P_sub) E(C) ∧ + ∃ e ∈ E(P_sub), ∃ w : α, G.IsLink e v w by + rcases hW₂_claim with ⟨u, _, hpath⟩ | + ⟨v, hvC, hvW₂, v', hv'C, hv'W₂, hvv', P_sub, hP_sub_W₂, hP_sub_path, hVC, hEC, hex_e⟩ + · left + exact ⟨v₀, u, hinter_eq ▸ hpath⟩ + · right + have hvP : v ∈ V(P) := by + rw [hVP] + change v ∈ W.support + rw [← hsG, hsplit, GraphWalk.mem_support_append] + exact Or.inr hvW₂ + have hv'P : v' ∈ V(P) := by + rw [hVP] + change v' ∈ W.support + rw [← hsG, hsplit, GraphWalk.mem_support_append] + exact Or.inr hv'W₂ + have hW₂_le_P : walkSubgraph W₂ ≤ P := by + rw [hP_eq, hsplit, + (Compatible.of_le_le (walkSubgraph_le W₂) (walkSubgraph_le (W₁.append W₂))).le_iff, + vertexSet_walkSubgraph, vertexSet_walkSubgraph, + edgeSet_walkSubgraph, edgeSet_walkSubgraph] + refine ⟨fun x hx => ?_, fun e he => ?_⟩ + · change x ∈ (W₁.append W₂).support + rw [GraphWalk.mem_support_append] + exact Or.inr hx + · change e ∈ (W₁.append W₂).edges + rw [GraphWalk.edges_append, List.mem_append] + exact Or.inr he + exact ⟨v, ⟨hvC, hvP⟩, v', ⟨hv'C, hv'P⟩, hvv', P_sub, hP_sub_W₂.trans hW₂_le_P, + hP_sub_path, hVC, hEC, hex_e⟩ + exact inter_or_detour_of_walk hCG W₂ hv₀C hsp12.2 + +/-! ## 3. Rerouting a Path Along a Circuit Arc -/ + +/-- If `P` is a path in `G` from `a` to `b`, `W_sub` is a contiguous subwalk of `P` between `v` and +`v'`, and `Q` is a path in `G` between `v` and `v'`, then `(P \ E(W_sub)) ∪ Q` contains a path `P'` +in `G` from `a` to `b` with `V(P') ⊆ V(P) ∪ V(Q)` and `E(P') ⊆ (E(P) \ E(P_sub)) ∪ E(Q)`. -/ +theorem reroute_path_along_arc {G P P_sub Q : Graph α β} {a b v v' : α} + (hP_decomp : ∃ P₁ P₂ : Graph α β, + P₁ ≤ P ∧ P₂ ≤ P ∧ + IsGraphPathWithEnds G P₁ a v ∧ IsGraphPathWithEnds G P₂ v' b ∧ + Disjoint E(P₁) E(P_sub) ∧ Disjoint E(P₂) E(P_sub)) + (hQ : IsGraphPathWithEnds G Q v v') : + ∃ P' : Graph α β, + IsGraphPathWithEnds G P' a b ∧ + V(P') ⊆ V(P) ∪ V(Q) ∧ + E(P') ⊆ (E(P) \ E(P_sub)) ∪ E(Q) := by + obtain ⟨P₁, P₂, hP₁P, hP₂P, hP₁, hP₂, hdisj₁, hdisj₂⟩ := hP_decomp + obtain ⟨hP₁G, W₁, _, hV₁, hE₁⟩ := hP₁ + obtain ⟨hQG, WQ, _, hVQ, hEQ⟩ := hQ + obtain ⟨hP₂G, W₂, _, hV₂, hE₂⟩ := hP₂ + obtain ⟨W₁G, hs₁, he₁⟩ := exists_walk_up_of_le hP₁G W₁ + obtain ⟨WQG, hsQ, heQ⟩ := exists_walk_up_of_le hQG WQ + obtain ⟨W₂G, hs₂, he₂⟩ := exists_walk_up_of_le hP₂G W₂ + let W_all := W₁G.append (WQG.append W₂G) + obtain ⟨P', hP'_path, hP'V, hP'E⟩ := exists_isGraphPathWithEnds_of_walk W_all + refine ⟨P', hP'_path, ?_, ?_⟩ + · refine hP'V.trans fun x hx => ?_ + simp only [W_all, mem_ofPred_eq, GraphWalk.mem_support_append, hs₁, hsQ, hs₂] at hx + rcases hx with hx₁ | hxQ | hx₂ + · exact Or.inl (hP₁P.vertexSet_mono (by rw [hV₁]; exact hx₁)) + · exact Or.inr (by rw [hVQ]; exact hxQ) + · exact Or.inl (hP₂P.vertexSet_mono (by rw [hV₂]; exact hx₂)) + · refine hP'E.trans fun e he => ?_ + simp only [W_all, mem_ofPred_eq, GraphWalk.edges_append, List.mem_append, + he₁, heQ, he₂] at he + rcases he with he₁' | heQ' | he₂' + · have heP₁ : e ∈ E(P₁) := by rw [hE₁]; exact he₁' + exact Or.inl ⟨hP₁P.edgeSet_mono heP₁, disjoint_left.mp hdisj₁ heP₁⟩ + · exact Or.inr (by rw [hEQ]; exact heQ') + · have heP₂ : e ∈ E(P₂) := by rw [hE₂]; exact he₂' + exact Or.inl ⟨hP₂P.edgeSet_mono heP₂, disjoint_left.mp hdisj₂ heP₂⟩ + +/-! ## 4. From Circuit Intersections to Rerouting -/ + +/-- **Deduction from Property `(2)` (GM03 (4.1) paragraph 6, pages 60–61)**: +Suppose Property `(2)` holds at `j`: for every `i'` and every `v ∈ V(C j) ∩ V(P i')`, there is a +subpath `R ≤ P i'` from `v` to the target `Z` satisfying `InsidePred R`. If `Q_k ≤ C j` has the +property that no path `R` in `G` from `V(Q_k)` to `Z` avoiding `V(P_sub)` (where `P_sub ≤ P i`) +satisfies `InsidePred R`, then `V(Q_k)` is disjoint from `V(P i')` for every `i' ≠ i`. -/ +theorem disjoint_other_paths_of_no_escape_from_arc {r : ℕ} {G C_j Q_k P_sub : Graph α β} + {P : Fin r → Graph α β} {Z : Set α} {InsidePred : Graph α β → Prop} + (hQ_k : Q_k ≤ C_j) + {i : Fin r} (hP_sub : P_sub ≤ P i) + (hP_disj : Pairwise (fun k₁ k₂ => Disjoint V(P k₁) V(P k₂))) + (hProp2 : ∀ (i' : Fin r) (v : α), v ∈ V(C_j) ∩ V(P i') → + ∃ z ∈ Z, ∃ R : Graph α β, R ≤ P i' ∧ IsGraphPathWithEnds G R v z ∧ InsidePred R) + (hNoEscape : ¬ ∃ v ∈ V(Q_k), ∃ z ∈ Z, ∃ R : Graph α β, + IsGraphPathWithEnds G R v z ∧ Disjoint V(R) V(P_sub) ∧ InsidePred R) : + ∀ i' : Fin r, i' ≠ i → Disjoint V(Q_k) V(P i') := by + intro i' hi' + refine disjoint_left.mpr fun v hvQ hvPi' => ?_ + have hvCj : v ∈ V(C_j) := hQ_k.vertexSet_mono hvQ + obtain ⟨z, hzZ, R, hR_le, hR_path, hR_in⟩ := hProp2 i' v ⟨hvCj, hvPi'⟩ + have hdisj_R : Disjoint V(R) V(P_sub) := + disjoint_of_subset hR_le.vertexSet_mono hP_sub.vertexSet_mono (hP_disj hi') + exact hNoEscape ⟨v, hvQ, z, hzZ, R, hR_path, hdisj_R, hR_in⟩ + +/-- If `W₀` and `W` are simple walks in `G` with the same endpoints `a, b` and `W.edges ⊆ W₀.edges`, +then `W.support = W₀.support` and `W.edges = W₀.edges`. -/ +theorem eq_of_isSimple_subwalk_edges {G : Graph α β} {a b : α} + (W₀ W : GraphWalk G a b) (hW₀ : W₀.IsSimple) (hW : W.IsSimple) + (hedges : ∀ e ∈ W.edges, e ∈ W₀.edges) : + W.support = W₀.support ∧ W.edges = W₀.edges := by + induction W₀ with + | @nil a ha => + cases W with + | nil _ => exact ⟨rfl, rfl⟩ + | @cons _ w _ e hl r => + exact (List.not_mem_nil (hedges e List.mem_cons_self)).elim + | @cons a y b e₀ hl₀ r₀ ih => + have ha_not_r₀ : a ∉ r₀.support := (List.nodup_cons.mp hW₀).1 + have hr₀ : r₀.IsSimple := (List.nodup_cons.mp hW₀).2 + have hab : a ≠ b := fun h => ha_not_r₀ (h ▸ r₀.end_mem_support) + cases W with + | nil _ => exact (hab rfl).elim + | @cons _ w _ e hl r => + have ha_not_r : a ∉ r.support := (List.nodup_cons.mp hW).1 + have hr : r.IsSimple := (List.nodup_cons.mp hW).2 + have he_mem : e ∈ (GraphWalk.cons hl₀ r₀).edges := hedges e List.mem_cons_self + have he₀_mem : e₀ ∈ (GraphWalk.cons hl₀ r₀).edges := List.mem_cons_self + have he_eq : e = e₀ := + unique_inc_first hW₀ he_mem he₀_mem ⟨w, hl⟩ ⟨y, hl₀⟩ + subst he_eq + have hwy : w = y := by + rcases hl.right_eq_or_eq hl₀ with rfl | rfl + · exact (ha_not_r r.start_mem_support).elim + · rfl + subst hwy + have hr_edges : ∀ f ∈ r.edges, f ∈ r₀.edges := by + intro f hf + have hf_mem := hedges f (List.mem_cons_of_mem _ hf) + rcases List.mem_cons.mp hf_mem with rfl | hf_r₀ + · exact (ha_not_r (r.left_mem_support_of_mem_edges hf hl₀)).elim + · exact hf_r₀ + obtain ⟨hsupp, hed⟩ := ih r hr₀ hr hr_edges + exact ⟨congrArg (List.cons a) hsupp, congrArg (List.cons e) hed⟩ + +/-- If `W₁.append W₂` is a simple walk in `G` and `W` is a simple walk in `G` between `x, y ∈ +W₂.support` +with `W.edges ⊆ (W₁.append W₂).edges`, then `W.edges ⊆ W₂.edges`. -/ +theorem edges_subset_right_of_append {G : Graph α β} {a u b x y : α} + (W₁ : GraphWalk G a u) (W₂ : GraphWalk G u b) + (hW₁₂ : (W₁.append W₂).IsSimple) + (W : GraphWalk G x y) (hW : W.IsSimple) + (hx : x ∈ W₂.support) (hy : y ∈ W₂.support) + (hedges : ∀ e ∈ W.edges, e ∈ (W₁.append W₂).edges) : + ∀ e ∈ W.edges, e ∈ W₂.edges := by + induction W₁ with + | nil _ => exact hedges + | @cons a w u e₀ hl₀ r₁ ih => + have hcons : ((GraphWalk.cons hl₀ r₁).append W₂) = GraphWalk.cons hl₀ (r₁.append W₂) := rfl + rw [hcons] at hW₁₂ hedges + have ha_not : a ∉ (r₁.append W₂).support := (List.nodup_cons.mp hW₁₂).1 + have hr₁₂ : (r₁.append W₂).IsSimple := (List.nodup_cons.mp hW₁₂).2 + have hx_r₁₂ : x ∈ (r₁.append W₂).support := + (GraphWalk.mem_support_append r₁ W₂).mpr (Or.inr hx) + have hy_r₁₂ : y ∈ (r₁.append W₂).support := + (GraphWalk.mem_support_append r₁ W₂).mpr (Or.inr hy) + have hxa : x ≠ a := fun h => ha_not (h ▸ hx_r₁₂) + have hya : y ≠ a := fun h => ha_not (h ▸ hy_r₁₂) + have he₀_not_W : e₀ ∉ W.edges := by + intro he₀W + have haW : a ∈ W.support := W.left_mem_support_of_mem_edges he₀W hl₀ + obtain ⟨W_l, W_r, hsplit⟩ := W.exists_append_of_mem haW + have hnd_E : (W_l.edges ++ W_r.edges).Nodup := by + have h1 : W.edges.Nodup := hW.edges_nodup + rwa [hsplit, GraphWalk.edges_append] at h1 + have hd_E := List.nodup_append.mp hnd_E + have hex_l : ∃ e₁ ∈ W_l.edges, G.Inc e₁ a := by + have hrev : W_l.reverse.edges = W_l.edges.reverse := GraphWalk.edges_reverse W_l + cases hWl_rev : W_l.reverse with + | nil _ => + have hmem : x ∈ (W_l.reverse).support := by + rw [GraphWalk.support_reverse, List.mem_reverse] + exact W_l.start_mem_support + rw [hWl_rev] at hmem + exact (hxa (List.mem_singleton.mp hmem)).elim + | @cons _ z _ e₁ hl₁ r_l => + refine ⟨e₁, ?_, z, hl₁⟩ + have : e₁ ∈ W_l.reverse.edges := by rw [hWl_rev]; exact List.mem_cons_self + rwa [hrev, List.mem_reverse] at this + have hex_r : ∃ e₂ ∈ W_r.edges, G.Inc e₂ a := by + cases W_r with + | nil _ => exact (hya rfl).elim + | @cons _ z _ e₂ hl₂ r_r => exact ⟨e₂, List.mem_cons_self, z, hl₂⟩ + obtain ⟨e₁, he₁, hinc₁⟩ := hex_l + obtain ⟨e₂, he₂, hinc₂⟩ := hex_r + have he₁_in : e₁ ∈ (GraphWalk.cons hl₀ (r₁.append W₂)).edges := + hedges e₁ (by rw [hsplit, GraphWalk.edges_append, List.mem_append]; exact Or.inl he₁) + have he₂_in : e₂ ∈ (GraphWalk.cons hl₀ (r₁.append W₂)).edges := + hedges e₂ (by rw [hsplit, GraphWalk.edges_append, List.mem_append]; exact Or.inr he₂) + have he₁_eq : e₁ = e₀ := + unique_inc_first hW₁₂ he₁_in List.mem_cons_self hinc₁ ⟨w, hl₀⟩ + have he₂_eq : e₂ = e₀ := + unique_inc_first hW₁₂ he₂_in List.mem_cons_self hinc₂ ⟨w, hl₀⟩ + exact hd_E.2.2 e₀ (he₁_eq ▸ he₁) e₀ (he₂_eq ▸ he₂) rfl + refine ih W₂ hr₁₂ hx hy (fun e he => ?_) + rcases List.mem_cons.mp (hedges e he) with rfl | he' + · exact (he₀_not_W he).elim + · exact he' + +theorem isSimple_reverse_append {G : Graph α β} {a u b : α} + (W₁ : GraphWalk G a u) (W₂ : GraphWalk G u b) + (hW₁₂ : (W₁.append W₂).IsSimple) : + (W₂.reverse.append W₁.reverse).IsSimple := by + have hsp := isSimple_of_append hW₁₂ + have hnd : (W₁.support ++ W₂.support.tail).Nodup := by + have h' : (W₁.append W₂).support.Nodup := hW₁₂ + rwa [GraphWalk.support_append] at h' + have hd := List.nodup_append.mp hnd + unfold GraphWalk.IsSimple + rw [GraphWalk.support_append] + have h1 : W₂.reverse.support.Nodup := hsp.2.reverse + have h2 : W₁.reverse.support.Nodup := hsp.1.reverse + refine List.nodup_append.mpr ⟨h1, h2.tail, fun z hz₂ z' hz₁ hzz' => ?_⟩ + subst hzz' + rw [GraphWalk.support_reverse, List.mem_reverse] at hz₂ + have hz₁_full : z ∈ W₁.reverse.support := by + rw [W₁.reverse.support_eq_cons] + exact List.mem_cons_of_mem _ hz₁ + have hz₁_mem : z ∈ W₁.support := by + rwa [GraphWalk.support_reverse, List.mem_reverse] at hz₁_full + rw [W₂.support_eq_cons] at hz₂ + rcases List.mem_cons.mp hz₂ with rfl | hz₂_tail + · rw [W₁.reverse.support_eq_cons] at h2 + exact (List.nodup_cons.mp h2).1 hz₁ + · exact hd.2.2 z hz₁_mem z hz₂_tail rfl + +/-- If `W₁.append W₂` is a simple walk in `G` and `W` is a simple walk in `G` between `x, y ∈ +W₁.support` +with `W.edges ⊆ (W₁.append W₂).edges`, then `W.edges ⊆ W₁.edges`. -/ +theorem edges_subset_left_of_append {G : Graph α β} {a u b x y : α} + (W₁ : GraphWalk G a u) (W₂ : GraphWalk G u b) + (hW₁₂ : (W₁.append W₂).IsSimple) + (W : GraphWalk G x y) (hW : W.IsSimple) + (hx : x ∈ W₁.support) (hy : y ∈ W₁.support) + (hedges : ∀ e ∈ W.edges, e ∈ (W₁.append W₂).edges) : + ∀ e ∈ W.edges, e ∈ W₁.edges := by + have hrev := edges_subset_right_of_append W₂.reverse W₁.reverse + (isSimple_reverse_append W₁ W₂ hW₁₂) W hW + (by rw [GraphWalk.support_reverse, List.mem_reverse]; exact hx) + (by rw [GraphWalk.support_reverse, List.mem_reverse]; exact hy) + (fun e he => by + have he' := hedges e he + rw [GraphWalk.edges_append, List.mem_append] at he' ⊢ + rcases he' with h | h + · exact Or.inr (by rw [GraphWalk.edges_reverse, List.mem_reverse]; exact h) + · exact Or.inl (by rw [GraphWalk.edges_reverse, List.mem_reverse]; exact h)) + intro e he + have he' := hrev e he + rwa [GraphWalk.edges_reverse, List.mem_reverse] at he' + +/-- Two subpaths `Q₁, Q₂ ≤ P` of a path `P` in `G` with the same ends `v, v'` are equal. -/ +theorem eq_of_isGraphPathWithEnds_le {G P Q₁ Q₂ : Graph α β} {a b v v' : α} + (hP : IsGraphPathWithEnds G P a b) + (hQ₁ : IsGraphPathWithEnds G Q₁ v v') (hQ₁_le : Q₁ ≤ P) + (hQ₂ : IsGraphPathWithEnds G Q₂ v v') (hQ₂_le : Q₂ ≤ P) : + Q₁ = Q₂ := by + suffices h_eq_walk : ∀ {x y : α} (WP : GraphWalk G x y), WP.IsSimple → + ∀ {Q : Graph α β}, IsGraphPathWithEnds G Q v v' → + V(Q) ⊆ {z | z ∈ WP.support} → E(Q) ⊆ {e | e ∈ WP.edges} → + ∀ {Q' : Graph α β}, IsGraphPathWithEnds G Q' v v' → + V(Q') ⊆ {z | z ∈ WP.support} → E(Q') ⊆ {e | e ∈ WP.edges} → + Q = Q' by + rcases hP with ⟨hPG, W, hW, hVP, hEP⟩ + obtain ⟨WG, hsG, heG⟩ := exists_walk_up_of_le hPG W + have hWG : WG.IsSimple := by unfold GraphWalk.IsSimple; rw [hsG]; exact hW + refine h_eq_walk WG hWG hQ₁ ?_ ?_ hQ₂ ?_ ?_ + · intro z hz + have hzP : z ∈ V(P) := hQ₁_le.vertexSet_mono hz + rw [hVP] at hzP + change z ∈ WG.support + rwa [hsG] + · intro e he + have heP : e ∈ E(P) := hQ₁_le.edgeSet_mono he + rw [hEP] at heP + change e ∈ WG.edges + rwa [heG] + · intro z hz + have hzP : z ∈ V(P) := hQ₂_le.vertexSet_mono hz + rw [hVP] at hzP + change z ∈ WG.support + rwa [hsG] + · intro e he + have heP : e ∈ E(P) := hQ₂_le.edgeSet_mono he + rw [hEP] at heP + change e ∈ WG.edges + rwa [heG] + intro x y WP hWP Q hQ hVQ hEQ Q' hQ' hVQ' hEQ' + have hv_WP : v ∈ WP.support := hVQ hQ.left_mem + have hv'_WP : v' ∈ WP.support := hVQ hQ.right_mem + obtain ⟨W₁, W₂, rfl⟩ := WP.exists_append_of_mem hv_WP + rcases (GraphWalk.mem_support_append W₁ W₂).mp hv'_WP with hv'_1 | hv'_2 + · obtain ⟨A₁, A₂, hA⟩ := W₁.exists_append_of_mem hv'_1 + subst hA + have hsp1 := isSimple_of_append hWP + have hsp2 := isSimple_of_append hsp1.1 + have hA₂_rev : A₂.reverse.IsSimple := hsp2.2.reverse + have hsub_A₂ : ∀ {R : Graph α β}, IsGraphPathWithEnds G R v v' → + E(R) ⊆ {e | e ∈ ((A₁.append A₂).append W₂).edges} → R = walkSubgraph A₂.reverse := by + intro R hR hER + rcases hR with ⟨hRG, WR, hWR, hVR, hER_eq⟩ + obtain ⟨WRG, hsR, heR⟩ := exists_walk_up_of_le hRG WR + have hWRG : WRG.IsSimple := by unfold GraphWalk.IsSimple; rw [hsR]; exact hWR + have hed1 : ∀ e ∈ WRG.reverse.edges, e ∈ ((A₁.append A₂).append W₂).edges := by + intro e he + rw [GraphWalk.edges_reverse, List.mem_reverse, heR] at he + exact hER (by rw [hER_eq]; exact he) + have hed2 := edges_subset_left_of_append (A₁.append A₂) W₂ hWP + WRG.reverse hWRG.reverse + ((GraphWalk.mem_support_append A₁ A₂).mpr (Or.inr A₂.start_mem_support)) + ((GraphWalk.mem_support_append A₁ A₂).mpr (Or.inr A₂.end_mem_support)) hed1 + have hed3 := edges_subset_right_of_append A₁ A₂ hsp1.1 + WRG.reverse hWRG.reverse A₂.start_mem_support A₂.end_mem_support hed2 + have hed4 : ∀ e ∈ WRG.edges, e ∈ A₂.reverse.edges := by + intro e he + rw [GraphWalk.edges_reverse, List.mem_reverse] + exact hed3 e (by rw [GraphWalk.edges_reverse, List.mem_reverse]; exact he) + obtain ⟨hsupp_eq, hed_eq⟩ := eq_of_isSimple_subwalk_edges A₂.reverse WRG hA₂_rev hWRG hed4 + refine (Compatible.of_le_le hRG (walkSubgraph_le A₂.reverse)).ext ?_ ?_ + · rw [hVR, vertexSet_walkSubgraph, ← hsR, hsupp_eq] + · rw [hER_eq, edgeSet_walkSubgraph, ← heR, hed_eq] + exact (hsub_A₂ hQ hEQ).trans (hsub_A₂ hQ' hEQ').symm + · obtain ⟨B₁, B₂, hB⟩ := W₂.exists_append_of_mem hv'_2 + subst hB + have hsp1 := isSimple_of_append hWP + have hsp2 := isSimple_of_append hsp1.2 + have hB₁_s : B₁.IsSimple := hsp2.1 + have hsub_B₁ : ∀ {R : Graph α β}, IsGraphPathWithEnds G R v v' → + E(R) ⊆ {e | e ∈ (W₁.append (B₁.append B₂)).edges} → R = walkSubgraph B₁ := by + intro R hR hER + rcases hR with ⟨hRG, WR, hWR, hVR, hER_eq⟩ + obtain ⟨WRG, hsR, heR⟩ := exists_walk_up_of_le hRG WR + have hWRG : WRG.IsSimple := by unfold GraphWalk.IsSimple; rw [hsR]; exact hWR + have hed1 : ∀ e ∈ WRG.edges, e ∈ (W₁.append (B₁.append B₂)).edges := by + intro e he + exact hER (by rw [hER_eq, ← heR]; exact he) + have hed2 := edges_subset_right_of_append W₁ (B₁.append B₂) hWP WRG hWRG + ((GraphWalk.mem_support_append B₁ B₂).mpr (Or.inl B₁.start_mem_support)) + ((GraphWalk.mem_support_append B₁ B₂).mpr (Or.inl B₁.end_mem_support)) hed1 + have hed3 := edges_subset_left_of_append B₁ B₂ hsp1.2 WRG hWRG + B₁.start_mem_support B₁.end_mem_support hed2 + obtain ⟨hsupp_eq, hed_eq⟩ := eq_of_isSimple_subwalk_edges B₁ WRG hB₁_s hWRG hed3 + refine (Compatible.of_le_le hRG (walkSubgraph_le B₁)).ext ?_ ?_ + · rw [hVR, vertexSet_walkSubgraph, ← hsR, hsupp_eq] + · rw [hER_eq, edgeSet_walkSubgraph, ← heR, hed_eq] + exact (hsub_B₁ hQ hEQ).trans (hsub_B₁ hQ' hEQ').symm + +/-- If `P` is a family of pairwise vertex-disjoint paths in `G`, `P_sub ≤ P i` is a subpath between +`v ≠ v'`, and `Q` is a path in `G` between `v` and `v'` edge-disjoint from `P_sub`, then `Q` has an +edge not in `⋃ k, E(P k)`. -/ +theorem exists_edge_not_mem_iUnion_of_path {G : Graph α β} {r : ℕ} + {P : Fin r → Graph α β} (hP_le : ∀ k, P k ≤ G) + (hP_disj : Pairwise (fun i₁ i₂ => Disjoint V(P i₁) V(P i₂))) + {i : Fin r} {P_sub Q : Graph α β} {a b v v' : α} + (hP_i : IsGraphPathWithEnds G (P i) a b) + (hP_sub : IsGraphPathWithEnds G P_sub v v') (hP_sub_le : P_sub ≤ P i) + (hQ : IsGraphPathWithEnds G Q v v') (hvne : v ≠ v') + (hdisj_E : Disjoint E(P_sub) E(Q)) : + ∃ e₀ ∈ E(Q), e₀ ∉ ⋃ k, E(P k) := by + by_contra hall + push Not at hall + have hQ_copy := hQ + rcases hQ with ⟨hQG, W, hW_simple, hVQ, hEQ⟩ + obtain ⟨WG, hsG, heG⟩ := exists_walk_up_of_le hQG W + have hwalk : ∀ {x y : α} (W₀ : GraphWalk G x y), + x ∈ V(P i) → (∀ e ∈ W₀.edges, e ∈ ⋃ k, E(P k)) → + (∀ z ∈ W₀.support, z ∈ V(P i)) ∧ (∀ e ∈ W₀.edges, e ∈ E(P i)) := by + intro x y W₀ hx hedges + induction W₀ with + | nil _ => + refine ⟨fun z hz => ?_, fun e he => by simp [GraphWalk.edges] at he⟩ + rcases List.mem_singleton.mp hz with rfl + exact hx + | @cons u w y e hl r ih => + have he_mem : e ∈ ⋃ k, E(P k) := hedges e (List.mem_cons_self ..) + obtain ⟨k, hek⟩ := mem_iUnion.mp he_mem + obtain ⟨x₁, x₂, hx_link⟩ := (P k).exists_isLink_of_mem_edgeSet hek + have hx_linkG : G.IsLink e x₁ x₂ := hx_link.mono (hP_le k) + have hu_Pk : u ∈ V(P k) := by + rcases hl.left_eq_or_eq hx_linkG with rfl | rfl + · exact hx_link.left_mem + · exact hx_link.right_mem + have hki : k = i := by + by_contra hne + exact disjoint_left.mp (hP_disj hne) hu_Pk hx + subst hki + have hw_Pi : w ∈ V(P k) := by + rcases hl.right_eq_or_eq hx_linkG with rfl | rfl + · exact hx_link.left_mem + · exact hx_link.right_mem + obtain ⟨ih_V, ih_E⟩ := ih hw_Pi (fun f hf => hedges f (List.mem_cons_of_mem _ hf)) + refine ⟨fun z hz => ?_, fun f hf => ?_⟩ + · rcases List.mem_cons.mp hz with rfl | hz + · exact hx + · exact ih_V z hz + · rcases List.mem_cons.mp hf with rfl | hf + · exact hek + · exact ih_E f hf + have hv_Pi : v ∈ V(P i) := hP_sub_le.vertexSet_mono hP_sub.left_mem + obtain ⟨hV_sub, hE_sub⟩ := hwalk WG hv_Pi (fun e he => hall e (by rw [hEQ, ← heG]; exact he)) + have hQ_le : Q ≤ P i := by + rw [(Compatible.of_le_le hQG (hP_le i)).le_iff] + exact ⟨fun z hz => hV_sub z (by rw [hsG]; rwa [hVQ] at hz), + fun e he => hE_sub e (by rw [heG]; rwa [hEQ] at he)⟩ + have hQ_eq : Q = P_sub := + eq_of_isGraphPathWithEnds_le hP_i hQ_copy hQ_le hP_sub hP_sub_le + obtain ⟨e₁, he₁, -⟩ := IsGraphPathWithEnds.exists_inc_left_of_ne hQ_copy hvne + exact disjoint_left.mp hdisj_E (hQ_eq ▸ he₁) he₁ + +/-- Given a path `P` from `x` to `y` and a subpath `P_sub ≤ P` between `v` and `v'`, `P` decomposes +into `P₁`, `P_sub`, and `P₂` (in one of the two orientations of `{v, v'}`). -/ +theorem exists_decomp_of_isGraphPathWithEnds_le {G P P_sub : Graph α β} {x y v v' : α} + (hP : IsGraphPathWithEnds G P x y) (hP_sub : IsGraphPathWithEnds G P_sub v v') + (hP_sub_le : P_sub ≤ P) : + (∃ P₁ P₂ : Graph α β, P₁ ≤ P ∧ P₂ ≤ P ∧ + IsGraphPathWithEnds G P₁ x v ∧ IsGraphPathWithEnds G P₂ v' y ∧ + V(P₁) ∩ V(P_sub) = {v} ∧ Disjoint E(P₁) E(P_sub) ∧ Disjoint E(P₂) E(P_sub)) ∨ + (∃ P₁ P₂ : Graph α β, P₁ ≤ P ∧ P₂ ≤ P ∧ + IsGraphPathWithEnds G P₁ x v' ∧ IsGraphPathWithEnds G P₂ v y ∧ + V(P₁) ∩ V(P_sub) = {v'} ∧ Disjoint E(P₁) E(P_sub) ∧ Disjoint E(P₂) E(P_sub)) := by + have hvP : v ∈ V(P) := hP_sub_le.vertexSet_mono hP_sub.left_mem + have hv'P : v' ∈ V(P) := hP_sub_le.vertexSet_mono hP_sub.right_mem + obtain ⟨A, B, hAP, hBP, hA, hB, hAB_union, hAB_inter, hAB_disjE⟩ := hP.exists_split_at hvP + have hAG : IsGraphPathWithEnds G A x v := hA.mono hP.le + have hBG : IsGraphPathWithEnds G B v y := hB.mono hP.le + have hv'AB : v' ∈ V(A) ∪ V(B) := by + rw [← vertexSet_subgraphUnion P A B, hAB_union] + exact hv'P + rcases hv'AB with hv'A | hv'B + · right + obtain ⟨A₁, A₂, hA₁A, hA₂A, hA₁, hA₂, _, hA_inter, hA_disjE⟩ := hAG.exists_split_at hv'A + have hA₁G : IsGraphPathWithEnds G A₁ x v' := hA₁.mono hAG.le + have hA₂G : IsGraphPathWithEnds G A₂ v' v := hA₂.mono hAG.le + have hP_sub_eq : P_sub = A₂ := + eq_of_isGraphPathWithEnds_le hP hP_sub hP_sub_le hA₂G.symm (hA₂A.trans hAP) + refine ⟨A₁, B, hA₁A.trans hAP, hBP, hA₁G, hBG, ?_, ?_, ?_⟩ + · rw [hP_sub_eq, hA_inter] + · rw [hP_sub_eq]; exact hA_disjE + · rw [hP_sub_eq] + exact disjoint_of_subset_right hA₂A.edgeSet_mono hAB_disjE.symm + · left + obtain ⟨B₁, B₂, hB₁B, hB₂B, hB₁, hB₂, _, hB_inter, hB_disjE⟩ := hBG.exists_split_at hv'B + have hB₁G : IsGraphPathWithEnds G B₁ v v' := hB₁.mono hBG.le + have hB₂G : IsGraphPathWithEnds G B₂ v' y := hB₂.mono hBG.le + have hP_sub_eq : P_sub = B₁ := + eq_of_isGraphPathWithEnds_le hP hP_sub hP_sub_le hB₁G (hB₁B.trans hBP) + refine ⟨A, B₂, hAP, hB₂B.trans hBP, hAG, hB₂G, ?_, ?_, ?_⟩ + · apply subset_antisymm + · intro u ⟨huA, huP_sub⟩ + have huB : u ∈ V(B) := hB₁B.vertexSet_mono (hP_sub_eq ▸ huP_sub) + have huAB : u ∈ V(A) ∩ V(B) := ⟨huA, huB⟩ + rwa [hAB_inter] at huAB + · rintro u rfl + exact ⟨hAG.right_mem, hP_sub.left_mem⟩ + · rw [hP_sub_eq] + exact disjoint_of_subset_right hB₁B.edgeSet_mono hAB_disjE + · rw [hP_sub_eq]; exact hB_disjE.symm + +/-- Given a path `P` from `x` to `y` and a subpath `P_sub ≤ P` between `v` and `v'`, there is a +prefix subpath `R₁ ≤ P` from `x` to `v₁ ∈ {v, v'}` that meets `P_sub` only at `v₁`. -/ +theorem exists_prefix_disjoint_subpath {G P P_sub : Graph α β} {x y v v' : α} + (hP : IsGraphPathWithEnds G P x y) (hP_sub : IsGraphPathWithEnds G P_sub v v') + (hP_sub_le : P_sub ≤ P) : + ∃ v₁ : α, (v₁ = v ∨ v₁ = v') ∧ ∃ R₁ : Graph α β, + R₁ ≤ P ∧ IsGraphPathWithEnds G R₁ x v₁ ∧ V(R₁) ∩ V(P_sub) = {v₁} := by + rcases exists_decomp_of_isGraphPathWithEnds_le hP hP_sub hP_sub_le with + ⟨P₁, _, hP₁P, _, hP₁, _, hinter, _, _⟩ | ⟨P₁, _, hP₁P, _, hP₁, _, hinter, _, _⟩ + · exact ⟨v, Or.inl rfl, P₁, hP₁P, hP₁, hinter⟩ + · exact ⟨v', Or.inr rfl, P₁, hP₁P, hP₁, hinter⟩ + +/-- If `P ∩ C` is a path, `P_sub ≤ P` has ends `v, v' ∉ V(C)`, and a prefix `R₁ ≤ P` from `x` to +`v₁ ∈ {v, v'}` with `V(R₁) ∩ V(P_sub) = {v₁}` meets `V(C)`, then `Disjoint V(P_sub) V(C)`. -/ +theorem disjoint_detour_of_isGraphPath_inter {G P P_sub R₁ C : Graph α β} {x y v v' v₁ : α} + (hCG : C ≤ G) + (hP : IsGraphPathWithEnds G P x y) (hP_sub : IsGraphPathWithEnds G P_sub v v') + (hP_sub_le : P_sub ≤ P) (hv₁ : v₁ = v ∨ v₁ = v') + (hR₁_le : R₁ ≤ P) (hR₁ : IsGraphPathWithEnds G R₁ x v₁) + (hR₁_inter : V(R₁) ∩ V(P_sub) = {v₁}) + (hv_not : v ∉ V(C)) (hv'_not : v' ∉ V(C)) + (hinter : IsGraphPath G (subgraphInter G P C)) + (hR₁_meet : (V(R₁) ∩ V(C)).Nonempty) : + Disjoint V(P_sub) V(C) := by + by_contra hnd + obtain ⟨w₂, hw₂P_sub, hw₂C⟩ := not_disjoint_iff.mp hnd + obtain ⟨w₁, hw₁R₁, hw₁C⟩ := hR₁_meet + obtain ⟨S₁, hS₁_le, _, hS₁⟩ := hR₁.exists_subpath hw₁R₁ hR₁.right_mem + have hv₁_mem_P_sub : v₁ ∈ V(P_sub) := by + rcases hv₁ with rfl | rfl + · exact hP_sub.left_mem + · exact hP_sub.right_mem + have hP_sub_v₁ : ∃ v₂ : α, IsGraphPathWithEnds G P_sub v₁ v₂ := by + rcases hv₁ with rfl | rfl + · exact ⟨v', hP_sub⟩ + · exact ⟨v, hP_sub.symm⟩ + obtain ⟨v₂, hP_sub'⟩ := hP_sub_v₁ + obtain ⟨S₂, hS₂_le, _, hS₂⟩ := hP_sub'.exists_subpath hv₁_mem_P_sub hw₂P_sub + have hS_V_inter : V(S₁) ∩ V(S₂) = {v₁} := by + apply subset_antisymm + · intro u ⟨hu₁, hu₂⟩ + have hu : u ∈ V(R₁) ∩ V(P_sub) := ⟨hS₁_le.vertexSet_mono hu₁, hS₂_le.vertexSet_mono hu₂⟩ + rwa [hR₁_inter] at hu + · rintro u rfl + exact ⟨hS₁.right_mem, hS₂.left_mem⟩ + have hS : IsGraphPathWithEnds G (subgraphUnion G S₁ S₂) w₁ w₂ := + hS₁.subgraphUnion hS₂ hS_V_inter + have hS_le : subgraphUnion G S₁ S₂ ≤ P := + (subgraphUnion_le_iff hS₁.le hS₂.le hP.le).mpr ⟨hS₁_le.trans hR₁_le, hS₂_le.trans hP_sub_le⟩ + have hw₁_inter : w₁ ∈ V(subgraphInter G P C) := by + rw [vertexSet_subgraphInter] + exact ⟨hR₁_le.vertexSet_mono hw₁R₁, hw₁C⟩ + have hw₂_inter : w₂ ∈ V(subgraphInter G P C) := by + rw [vertexSet_subgraphInter] + exact ⟨hP_sub_le.vertexSet_mono hw₂P_sub, hw₂C⟩ + rcases hinter with ⟨p₀, q₀, hp₀q₀⟩ + obtain ⟨S', hS'_le, _, hS'⟩ := hp₀q₀.exists_subpath hw₁_inter hw₂_inter + have hS'_le_P : S' ≤ P := hS'_le.trans (subgraphInter_le_left hP.le hCG) + have hS_eq : subgraphUnion G S₁ S₂ = S' := + eq_of_isGraphPathWithEnds_le hP hS hS_le hS' hS'_le_P + have hv₁_in_S' : v₁ ∈ V(S') := by + rw [← hS_eq, vertexSet_subgraphUnion] + exact Or.inl hS₁.right_mem + have hv₁_in_inter : v₁ ∈ V(subgraphInter G P C) := hS'_le.vertexSet_mono hv₁_in_S' + rw [vertexSet_subgraphInter] at hv₁_in_inter + rcases hv₁ with rfl | rfl + · exact hv_not hv₁_in_inter.2 + · exact hv'_not hv₁_in_inter.2 + +/-! ## 5. Plane Closed Discs and `GraphDrawing` Bridge Lemmas -/ + +open Topology Metric + +private theorem IsLineWithEnds.isPreconnected_sdiff_left {L : Set EuclideanPlane} + {a b : EuclideanPlane} (h : IsLineWithEnds L a b) : IsPreconnected (L \ {a}) := by + obtain ⟨f, hf0, _⟩ := h + have hEq : L \ {a} = (fun t => (f t).1) '' Ioc (0 : unitInterval) 1 := by + ext x + constructor + · rintro ⟨hxL, hxa⟩ + obtain ⟨t, ht⟩ := f.surjective ⟨x, hxL⟩ + have hx' : (f t).1 = x := congrArg Subtype.val ht + refine ⟨t, ⟨lt_of_le_of_ne unitInterval.nonneg' ?_, unitInterval.le_one'⟩, hx'⟩ + rintro rfl + exact hxa (hx'.symm.trans hf0) + · rintro ⟨t, ⟨h0, _⟩, rfl⟩ + refine ⟨(f t).2, ?_⟩ + intro h' + have := f.injective (Subtype.ext (h'.trans hf0.symm)) + exact h0.ne this.symm + rw [hEq] + exact isPreconnected_Ioc.image _ (by fun_prop) + +private theorem IsLineWithEnds.isPreconnected {L : Set EuclideanPlane} {a b : EuclideanPlane} + (h : IsLineWithEnds L a b) : IsPreconnected L := + GraphMinor.Surface.IsLineWithEnds.isPreconnected h + +private theorem disc_mono_of_subset {Y D₁ D₂ : Set EuclideanPlane} + (hY : IsClosedDisc Y) (hD₁Y : D₁ ⊆ Y) (hD₂Y : D₂ ⊆ Y) + (hD₁ : IsClosedDisc D₁) (hD₂ : IsClosedDisc D₂) + (hbd : discBd D₁ ⊆ D₂) : D₁ ⊆ D₂ := by + obtain ⟨Δ, ⟨hΔD₂, hΔ_disc, hΔ_bd, -⟩, -⟩ := + disc_oArc D₂ (discBd D₁) hD₂ hbd hD₁.isOArc_discBd + obtain ⟨Δ', ⟨-, -, -, -⟩, huniq⟩ := + disc_oArc Y (discBd D₁) hY ((Surface.discBd_subset D₁).trans hD₁Y) hD₁.isOArc_discBd + have h1 : D₁ = Δ' := huniq D₁ hD₁Y hD₁ rfl + have h2 : Δ = Δ' := huniq Δ (hΔD₂.trans hD₂Y) hΔ_disc hΔ_bd + rw [h1, ← h2] + exact hΔD₂ + +/-- If `L` is an outer chord of a closed disc `D ⊆ Y` (with `L ∩ D = {s, t}`), then one of the two +arcs `A₁, A₂` of `discBd D` between `s` and `t` forms with `L` the boundary of a closed disc +`Δ_k ⊆ Y` containing `D`. -/ +private theorem outer_chord_disc_contains {Y D A₁ A₂ L : Set EuclideanPlane} {s t : EuclideanPlane} + (hY : IsClosedDisc Y) (hD : IsClosedDisc D) (hDY : D ⊆ Y) + (hA₁ : IsLineWithEnds A₁ s t) (hA₂ : IsLineWithEnds A₂ s t) (hL : IsLineWithEnds L s t) + (hA_inter : A₁ ∩ A₂ = {s, t}) (hA_union : A₁ ∪ A₂ = discBd D) + (hLY : L ⊆ Y) (hLD : L ∩ D = {s, t}) : + (∃ Δ₁ ⊆ Y, IsClosedDisc Δ₁ ∧ discBd Δ₁ = L ∪ A₁ ∧ D ⊆ Δ₁) ∨ + (∃ Δ₂ ⊆ Y, IsClosedDisc Δ₂ ∧ discBd Δ₂ = L ∪ A₂ ∧ D ⊆ Δ₂) := by + have hman : ∀ x : EuclideanPlane, IsManifoldPoint x := + fun x ↦ (Surface.isInteriorPoint_euclideanPlane x).isManifoldPoint + have hbdD : discBd D ⊆ D := Surface.discBd_subset D + have hA₁D : A₁ ⊆ discBd D := hA_union ▸ subset_union_left + have hA₂D : A₂ ⊆ discBd D := hA_union ▸ subset_union_right + have hs_in : s ∈ A₁ ∩ A₂ := by rw [hA_inter]; exact mem_insert s _ + have ht_in : t ∈ A₁ ∩ A₂ := by rw [hA_inter]; exact mem_insert_of_mem s rfl + have hs_L : s ∈ L := by + have : s ∈ L ∩ D := by rw [hLD]; exact mem_insert s _ + exact this.1 + have ht_L : t ∈ L := by + have : t ∈ L ∩ D := by rw [hLD]; exact mem_insert_of_mem s rfl + exact this.1 + have hLA₁_inter : L ∩ A₁ ⊆ {s, t} := by + intro x ⟨hxL, hxA₁⟩ + have : x ∈ L ∩ D := ⟨hxL, hbdD (hA₁D hxA₁)⟩ + rwa [hLD] at this + have hLA₂_inter : L ∩ A₂ ⊆ {s, t} := by + intro x ⟨hxL, hxA₂⟩ + have : x ∈ L ∩ D := ⟨hxL, hbdD (hA₂D hxA₂)⟩ + rwa [hLD] at this + have hO₁ : IsOArc (L ∪ A₁) := GraphMinor.GM14.isOArc_union hL hA₁ hLA₁_inter + have hO₂ : IsOArc (L ∪ A₂) := GraphMinor.GM14.isOArc_union hL hA₂ hLA₂_inter + have hLA₁_Y : L ∪ A₁ ⊆ Y := union_subset hLY ((hA₁D.trans hbdD).trans hDY) + have hLA₂_Y : L ∪ A₂ ⊆ Y := union_subset hLY ((hA₂D.trans hbdD).trans hDY) + obtain ⟨Δ₁, ⟨hΔ₁Y, hΔ₁, hΔ₁_bd, -⟩, -⟩ := disc_oArc Y (L ∪ A₁) hY hLA₁_Y hO₁ + obtain ⟨Δ₂, ⟨hΔ₂Y, hΔ₂, hΔ₂_bd, -⟩, hΔ₂_uniq⟩ := disc_oArc Y (L ∪ A₂) hY hLA₂_Y hO₂ + have hdisj : Disjoint (discInt D) (discBd Δ₁) := by + rw [hΔ₁_bd, disjoint_left] + rintro x ⟨hxD, hx_nbd⟩ (hxL | hxA₁) + · have hx_st : x ∈ ({s, t} : Set EuclideanPlane) := by + rw [← hLD]; exact ⟨hxL, hxD⟩ + rcases hx_st with rfl | rfl + · exact hx_nbd (hA₁D hs_in.1) + · exact hx_nbd (hA₁D ht_in.1) + · exact hx_nbd (hA₁D hxA₁) + rcases hΔ₁.side hman hD.isPreconnected_discInt hdisj with hin | hout + · left + refine ⟨Δ₁, hΔ₁Y, hΔ₁, hΔ₁_bd, ?_⟩ + exact hD.subset_closure_discInt.trans + (closure_minimal (hin.trans (discInt_subset Δ₁)) hΔ₁.isClosed) + · right + have hA₂_out : Disjoint (A₂ \ {s, t}) Δ₁ := by + rw [disjoint_left] + rintro x ⟨hxA₂, hx_nst⟩ hxΔ₁ + have hxD : x ∈ D := hbdD (hA₂D hxA₂) + have hx_not_bd₁ : x ∉ discBd Δ₁ := by + rw [hΔ₁_bd] + rintro (hxL | hxA₁) + · have : x ∈ L ∩ D := ⟨hxL, hxD⟩ + rw [hLD] at this + exact hx_nst this + · have : x ∈ A₁ ∩ A₂ := ⟨hxA₁, hxA₂⟩ + rw [hA_inter] at this + exact hx_nst this + have hx_int₁ : x ∈ discInt Δ₁ := ⟨hxΔ₁, hx_not_bd₁⟩ + have hx_cl : x ∈ closure (discInt D) := hD.subset_closure_discInt hxD + obtain ⟨w, hw₁, hwD⟩ := mem_closure_iff.mp hx_cl _ (hΔ₁.isOpen_discInt hman) hx_int₁ + exact disjoint_left.mp hout hwD hw₁.1 + have hinter : Δ₁ ∩ D = A₁ := by + apply subset_antisymm + · rintro x ⟨hxΔ₁, hxD⟩ + by_cases hx_bd : x ∈ discBd D + · rw [← hA_union] at hx_bd + rcases hx_bd with hxA₁ | hxA₂ + · exact hxA₁ + · by_cases hx_st : x ∈ ({s, t} : Set EuclideanPlane) + · rcases hx_st with rfl | rfl + · exact hs_in.1 + · exact ht_in.1 + · exact (disjoint_left.mp hA₂_out ⟨hxA₂, hx_st⟩ hxΔ₁).elim + · exact (disjoint_left.mp hout ⟨hxD, hx_bd⟩ hxΔ₁).elim + · intro x hxA₁ + exact ⟨(Surface.discBd_subset Δ₁) (hΔ₁_bd ▸ Or.inr hxA₁), hbdD (hA₁D hxA₁)⟩ + have hu := disc_union Δ₁ D A₁ s t hΔ₁ hD hA₁ hinter + (hΔ₁_bd ▸ subset_union_right) hA₁D + have hbd_union : discBd (Δ₁ ∪ D) = L ∪ A₂ := by + rw [hu.2, hΔ₁_bd, ← hA_union] + ext x + constructor + · rintro ⟨(hxL | hxA₁) | hxA₁ | hxA₂, hxn⟩ + · exact Or.inl hxL + · by_cases hx_st : x ∈ ({s, t} : Set EuclideanPlane) + · rcases hx_st with rfl | rfl + · exact Or.inl hs_L + · exact Or.inl ht_L + · exact (hxn ⟨hxA₁, hx_st⟩).elim + · by_cases hx_st : x ∈ ({s, t} : Set EuclideanPlane) + · rcases hx_st with rfl | rfl + · exact Or.inl hs_L + · exact Or.inl ht_L + · exact (hxn ⟨hxA₁, hx_st⟩).elim + · exact Or.inr hxA₂ + · rintro (hxL | hxA₂) + · refine ⟨Or.inl (Or.inl hxL), fun ⟨hxA₁, hx_nst⟩ => ?_⟩ + exact hx_nst (hLA₁_inter ⟨hxL, hxA₁⟩) + · refine ⟨Or.inr (Or.inr hxA₂), fun ⟨hxA₁, hx_nst⟩ => ?_⟩ + have : x ∈ A₁ ∩ A₂ := ⟨hxA₁, hxA₂⟩ + rw [hA_inter] at this + exact hx_nst this + have heq : Δ₁ ∪ D = Δ₂ := hΔ₂_uniq (Δ₁ ∪ D) (union_subset hΔ₁Y hDY) hu.1 hbd_union + exact ⟨Δ₂, hΔ₂Y, hΔ₂, hΔ₂_bd, heq ▸ subset_union_right⟩ + +/-- If `L ⊆ D` is an inner chord of a closed disc `D` (`L ∩ discBd D = {s, t}`) and `Δ₀ ⊆ D` is a +closed disc whose interior `discInt Δ₀` is disjoint from `L`, then for one of the two arcs `A₁, A₂` +of `discBd D` between `s` and `t`, every preconnected set `R ⊆ D \ L` meeting `A_k` is disjoint +from `Δ₀`. -/ +private theorem inner_chord_separates_from_core {D Δ₀ A₁ A₂ L : Set EuclideanPlane} + {s t : EuclideanPlane} + (hD : IsClosedDisc D) (hΔ₀ : IsClosedDisc Δ₀) (hΔ₀D : Δ₀ ⊆ D) + (hA₁ : IsLineWithEnds A₁ s t) (hA₂ : IsLineWithEnds A₂ s t) (hL : IsLineWithEnds L s t) + (hst : s ≠ t) + (hA_inter : A₁ ∩ A₂ = {s, t}) (hA_union : A₁ ∪ A₂ = discBd D) + (hLD : L ⊆ D) (hL_bd : L ∩ discBd D = {s, t}) + (hΔ₀_disj_L : Disjoint (discInt Δ₀) L) : + (∀ R : Set EuclideanPlane, IsPreconnected R → R ⊆ D \ L → + (R ∩ A₁).Nonempty → Disjoint R Δ₀) ∨ + (∀ R : Set EuclideanPlane, IsPreconnected R → R ⊆ D \ L → + (R ∩ A₂).Nonempty → Disjoint R Δ₀) := by + obtain ⟨B₁, B₂, Δ₁, Δ₂, _, hB_comp, hΔ₁, hΔ₂, hΔ_union, hΔ_inter, hΔ₁_bd, hΔ₂_bd, _⟩ := + disc_iArc D L s t hD hLD hst hL hL_bd + have hsub_or_sub : ∀ {C : Set EuclideanPlane}, IsPreconnected C → C ⊆ D \ L → + C ⊆ Δ₁ \ L ∨ C ⊆ Δ₂ \ L := by + intro C hC hCDL + by_contra hnot + obtain ⟨hnot₁, hnot₂⟩ := not_or.mp hnot + obtain ⟨x, hxC, hxn₁⟩ := not_subset.mp hnot₁ + obtain ⟨y, hyC, hyn₂⟩ := not_subset.mp hnot₂ + have hx₁_compl : x ∈ Δ₁ᶜ := fun hx₁ => hxn₁ ⟨hx₁, (hCDL hxC).2⟩ + have hy₂_compl : y ∈ Δ₂ᶜ := fun hy₂ => hyn₂ ⟨hy₂, (hCDL hyC).2⟩ + have hcov : C ⊆ Δ₂ᶜ ∪ Δ₁ᶜ := by + intro z hz + have hzDL := hCDL hz + by_cases hz₂ : z ∈ Δ₂ + · refine Or.inr fun hz₁ => hzDL.2 ?_ + rw [← hΔ_inter] + exact ⟨hz₁, hz₂⟩ + · exact Or.inl hz₂ + obtain ⟨z, hzC, hz₂, hz₁⟩ := hC Δ₂ᶜ Δ₁ᶜ hΔ₂.isClosed.isOpen_compl hΔ₁.isClosed.isOpen_compl + hcov ⟨y, hyC, hy₂_compl⟩ ⟨x, hxC, hx₁_compl⟩ + have hzD : z ∈ Δ₁ ∪ Δ₂ := hΔ_union ▸ (hCDL hzC).1 + rcases hzD with h | h + · exact hz₁ h + · exact hz₂ h + have hΔ₁₂_disj : Disjoint (Δ₁ \ L) (Δ₂ \ L) := by + rw [disjoint_left] + rintro x ⟨hx₁, hxn⟩ ⟨hx₂, _⟩ + exact hxn (hΔ_inter ▸ ⟨hx₁, hx₂⟩) + have hsub_of_meet₁ : ∀ {C : Set EuclideanPlane}, IsPreconnected C → C ⊆ D \ L → + (C ∩ (Δ₁ \ L)).Nonempty → C ⊆ Δ₁ \ L := by + intro C hC hCDL ⟨x, hxC, hx₁⟩ + rcases hsub_or_sub hC hCDL with h | h + · exact h + · exact (disjoint_left.mp hΔ₁₂_disj hx₁ (h hxC)).elim + have hsub_of_meet₂ : ∀ {C : Set EuclideanPlane}, IsPreconnected C → C ⊆ D \ L → + (C ∩ (Δ₂ \ L)).Nonempty → C ⊆ Δ₂ \ L := by + intro C hC hCDL ⟨x, hxC, hx₂⟩ + rcases hsub_or_sub hC hCDL with h | h + · exact (disjoint_left.mp hΔ₁₂_disj (h hxC) hx₂).elim + · exact h + have hB₁_mem : B₁ ∈ componentsIn (discBd D \ {s, t}) := by + rw [hB_comp]; exact mem_insert B₁ _ + have hB₂_mem : B₂ ∈ componentsIn (discBd D \ {s, t}) := by + rw [hB_comp]; exact mem_insert_of_mem B₁ rfl + obtain ⟨y₁, hy₁, hB₁_eq⟩ := hB₁_mem + obtain ⟨y₂, hy₂, hB₂_eq⟩ := hB₂_mem + have hB₁_ne : B₁.Nonempty := ⟨y₁, hB₁_eq ▸ mem_connectedComponentIn hy₁⟩ + have hB₂_ne : B₂.Nonempty := ⟨y₂, hB₂_eq ▸ mem_connectedComponentIn hy₂⟩ + have hB₁_sub : B₁ ⊆ discBd D \ {s, t} := hB₁_eq ▸ connectedComponentIn_subset _ _ + have hB₂_sub : B₂ ⊆ discBd D \ {s, t} := hB₂_eq ▸ connectedComponentIn_subset _ _ + have hB₁_in_Δ₁ : B₁ ⊆ Δ₁ \ L := by + intro x hxB₁ + have hx_bd := hB₁_sub hxB₁ + refine ⟨(Surface.discBd_subset Δ₁) (hΔ₁_bd ▸ Or.inl hxB₁), fun hxL => hx_bd.2 ?_⟩ + rw [← hL_bd] + exact ⟨hxL, hx_bd.1⟩ + have hB₂_in_Δ₂ : B₂ ⊆ Δ₂ \ L := by + intro x hxB₂ + have hx_bd := hB₂_sub hxB₂ + refine ⟨(Surface.discBd_subset Δ₂) (hΔ₂_bd ▸ Or.inl hxB₂), fun hxL => hx_bd.2 ?_⟩ + rw [← hL_bd] + exact ⟨hxL, hx_bd.1⟩ + have hC₁_sub : A₁ \ {s, t} ⊆ D \ L := by + rintro x ⟨hxA₁, hx_nst⟩ + have hx_bd : x ∈ discBd D := hA_union ▸ Or.inl hxA₁ + refine ⟨(Surface.discBd_subset D) hx_bd, fun hxL => hx_nst ?_⟩ + rw [← hL_bd] + exact ⟨hxL, hx_bd⟩ + have hC₂_sub : A₂ \ {s, t} ⊆ D \ L := by + rintro x ⟨hxA₂, hx_nst⟩ + have hx_bd : x ∈ discBd D := hA_union ▸ Or.inr hxA₂ + refine ⟨(Surface.discBd_subset D) hx_bd, fun hxL => hx_nst ?_⟩ + rw [← hL_bd] + exact ⟨hxL, hx_bd⟩ + have hbd_cov : discBd D \ {s, t} ⊆ (A₁ \ {s, t}) ∪ (A₂ \ {s, t}) := by + rintro x ⟨hx_bd, hx_nst⟩ + rw [← hA_union] at hx_bd + rcases hx_bd with h | h + · exact Or.inl ⟨h, hx_nst⟩ + · exact Or.inr ⟨h, hx_nst⟩ + have hA₁_side := hsub_or_sub (GraphMinor.GM14.IsLineWithEnds.isPreconnected_sdiff_pair hA₁) + hC₁_sub + have hA₂_side := hsub_or_sub (GraphMinor.GM14.IsLineWithEnds.isPreconnected_sdiff_pair hA₂) + hC₂_sub + have hA_one_each : + (A₁ \ {s, t} ⊆ Δ₁ \ L ∧ A₂ \ {s, t} ⊆ Δ₂ \ L) ∨ + (A₁ \ {s, t} ⊆ Δ₂ \ L ∧ A₂ \ {s, t} ⊆ Δ₁ \ L) := by + rcases hA₁_side with h1 | h1 <;> rcases hA₂_side with h2 | h2 + · exfalso + obtain ⟨b₂, hb₂⟩ := hB₂_ne + have hb₂_cov := hbd_cov (hB₂_sub hb₂) + have hb₂_in₁ : b₂ ∈ Δ₁ \ L := by + rcases hb₂_cov with h | h + · exact h1 h + · exact h2 h + exact disjoint_left.mp hΔ₁₂_disj hb₂_in₁ (hB₂_in_Δ₂ hb₂) + · exact Or.inl ⟨h1, h2⟩ + · exact Or.inr ⟨h1, h2⟩ + · exfalso + obtain ⟨b₁, hb₁⟩ := hB₁_ne + have hb₁_cov := hbd_cov (hB₁_sub hb₁) + have hb₁_in₂ : b₁ ∈ Δ₂ \ L := by + rcases hb₁_cov with h | h + · exact h1 h + · exact h2 h + exact disjoint_left.mp hΔ₁₂_disj (hB₁_in_Δ₁ hb₁) hb₁_in₂ + have hΔ₀_int_sub : discInt Δ₀ ⊆ D \ L := + subset_sdiff.mpr ⟨(discInt_subset Δ₀).trans hΔ₀D, hΔ₀_disj_L⟩ + have hs_L : s ∈ L := by + have : s ∈ L ∩ discBd D := by rw [hL_bd]; exact mem_insert s _ + exact this.1 + have ht_L : t ∈ L := by + have : t ∈ L ∩ discBd D := by rw [hL_bd]; exact mem_insert_of_mem s rfl + exact this.1 + rcases hsub_or_sub hΔ₀.isPreconnected_discInt hΔ₀_int_sub with hΔ₀_1 | hΔ₀_2 + · have hΔ₀_sub_Δ₁ : Δ₀ ⊆ Δ₁ := + hΔ₀.subset_closure_discInt.trans + (closure_minimal (hΔ₀_1.trans sdiff_subset) hΔ₁.isClosed) + have hdisj₂ : Disjoint (Δ₂ \ L) Δ₀ := + disjoint_of_subset_right hΔ₀_sub_Δ₁ + (disjoint_left.mpr fun x hx₂ hx₁ => hx₂.2 (hΔ_inter ▸ ⟨hx₁, hx₂.1⟩)) + rcases hA_one_each with ⟨_, hA₂_in₂⟩ | ⟨hA₁_in₂, _⟩ + · right + intro R hR hRDL ⟨x, hxR, hxA₂⟩ + have hx_nst : x ∉ ({s, t} : Set EuclideanPlane) := by + rintro (rfl | rfl) + · exact (hRDL hxR).2 hs_L + · exact (hRDL hxR).2 ht_L + have hR_sub : R ⊆ Δ₂ \ L := + hsub_of_meet₂ hR hRDL ⟨x, hxR, hA₂_in₂ ⟨hxA₂, hx_nst⟩⟩ + exact disjoint_of_subset_left hR_sub hdisj₂ + · left + intro R hR hRDL ⟨x, hxR, hxA₁⟩ + have hx_nst : x ∉ ({s, t} : Set EuclideanPlane) := by + rintro (rfl | rfl) + · exact (hRDL hxR).2 hs_L + · exact (hRDL hxR).2 ht_L + have hR_sub : R ⊆ Δ₂ \ L := + hsub_of_meet₂ hR hRDL ⟨x, hxR, hA₁_in₂ ⟨hxA₁, hx_nst⟩⟩ + exact disjoint_of_subset_left hR_sub hdisj₂ + · have hΔ₀_sub_Δ₂ : Δ₀ ⊆ Δ₂ := + hΔ₀.subset_closure_discInt.trans + (closure_minimal (hΔ₀_2.trans sdiff_subset) hΔ₂.isClosed) + have hdisj₁ : Disjoint (Δ₁ \ L) Δ₀ := + disjoint_of_subset_right hΔ₀_sub_Δ₂ + (disjoint_left.mpr fun x hx₁ hx₂ => hx₁.2 (hΔ_inter ▸ ⟨hx₁.1, hx₂⟩)) + rcases hA_one_each with ⟨hA₁_in₁, _⟩ | ⟨_, hA₂_in₁⟩ + · left + intro R hR hRDL ⟨x, hxR, hxA₁⟩ + have hx_nst : x ∉ ({s, t} : Set EuclideanPlane) := by + rintro (rfl | rfl) + · exact (hRDL hxR).2 hs_L + · exact (hRDL hxR).2 ht_L + have hR_sub : R ⊆ Δ₁ \ L := + hsub_of_meet₁ hR hRDL ⟨x, hxR, hA₁_in₁ ⟨hxA₁, hx_nst⟩⟩ + exact disjoint_of_subset_left hR_sub hdisj₁ + · right + intro R hR hRDL ⟨x, hxR, hxA₂⟩ + have hx_nst : x ∉ ({s, t} : Set EuclideanPlane) := by + rintro (rfl | rfl) + · exact (hRDL hxR).2 hs_L + · exact (hRDL hxR).2 ht_L + have hR_sub : R ⊆ Δ₁ \ L := + hsub_of_meet₁ hR hRDL ⟨x, hxR, hA₂_in₁ ⟨hxA₂, hx_nst⟩⟩ + exact disjoint_of_subset_left hR_sub hdisj₁ + +theorem graphDrawingSubgraphU_mono {G P₁ P₂ : Graph α β} + (Γ : GraphDrawing G EuclideanPlane) (hle : P₁ ≤ P₂) : + graphDrawingSubgraphU Γ P₁ ⊆ graphDrawingSubgraphU Γ P₂ := + union_subset_union (biUnion_mono hle.vertexSet_mono fun _ _ => Subset.rfl) + (biUnion_mono hle.edgeSet_mono fun _ _ => Subset.rfl) + +theorem graphDrawingSubgraphU_subset_U {G : Graph α β} + (Γ : GraphDrawing G EuclideanPlane) (P : Graph α β) : + graphDrawingSubgraphU Γ P ⊆ Γ.drawing.U := by + refine union_subset (iUnion₂_subset fun v _ x hx => ?_) (iUnion₂_subset fun e _ => ?_) + · rcases hx with ⟨hvG, rfl⟩ + exact Γ.drawing.V_subset_U (Γ.iso.vertexEquiv ⟨v, hvG⟩).2 + · by_cases heG : e ∈ E(G) + · rw [graphDrawingEdgeSet_eq Γ heG] + exact Γ.drawing.closure_subset_U (Γ.iso.edgeEquiv ⟨e, heG⟩).2 + · have hemp : graphDrawingEdgeSet Γ e = ∅ := by + ext x; simp [graphDrawingEdgeSet, heG] + rw [hemp, closure_empty] + exact empty_subset _ + +theorem graphDrawingSubgraphU_subgraphUnion {G P₁ P₂ : Graph α β} + (Γ : GraphDrawing G EuclideanPlane) (hP₁ : P₁ ≤ G) (hP₂ : P₂ ≤ G) : + graphDrawingSubgraphU Γ (subgraphUnion G P₁ P₂) = + graphDrawingSubgraphU Γ P₁ ∪ graphDrawingSubgraphU Γ P₂ := by + simp only [graphDrawingSubgraphU, vertexSet_subgraphUnion, edgeSet_subgraphUnion hP₁ hP₂, + biUnion_union] + ext x + simp only [mem_union] + tauto + +private theorem closure_inter_subset_V_drawing (Γ : Drawing EuclideanPlane) {e f : Set + EuclideanPlane} + (he : e ∈ Γ.E) (hf : f ∈ Γ.E) (hef : e ≠ f) : closure e ∩ closure f ⊆ Γ.V := by + rintro y ⟨h₁, h₂⟩ + by_contra hy + exact hef (Γ.edge_eq_of_mem he hf ((Γ.closure_diff_V he).subset ⟨h₁, hy⟩) + ((Γ.closure_diff_V hf).subset ⟨h₂, hy⟩)) + +theorem graphDrawingSubgraphU_inter_V {G P : Graph α β} + (Γ : GraphDrawing G EuclideanPlane) (hPG : P ≤ G) {x : EuclideanPlane} + (hxP : x ∈ graphDrawingSubgraphU Γ P) (hxV : x ∈ Γ.drawing.V) : + ∃ v ∈ V(P), x ∈ graphDrawingVertexSet Γ v := by + let v₀ := Γ.iso.vertexEquiv.symm ⟨x, hxV⟩ + have hv₀_eq : (Γ.iso.vertexEquiv v₀).1 = x := + congrArg Subtype.val (Γ.iso.vertexEquiv.apply_symm_apply ⟨x, hxV⟩) + have hx_mem : x ∈ graphDrawingVertexSet Γ v₀.1 := ⟨v₀.2, hv₀_eq⟩ + have hsub : graphDrawingVertexSet Γ v₀.1 ⊆ graphDrawingSubgraphU Γ P := by + rw [graphDrawingVertexSet_eq_singleton Γ v₀.2, hv₀_eq, singleton_subset_iff] + exact hxP + exact ⟨v₀.1, mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU Γ hPG v₀.2 hsub, hx_mem⟩ + +theorem graphDrawingSubgraphU_inter_of_disjoint_edgeSet {G P₁ P₂ : Graph α β} + (Γ : GraphDrawing G EuclideanPlane) (hP₁ : P₁ ≤ G) (hP₂ : P₂ ≤ G) + (hdisjE : Disjoint E(P₁) E(P₂)) : + graphDrawingSubgraphU Γ P₁ ∩ graphDrawingSubgraphU Γ P₂ = + ⋃ v ∈ V(P₁) ∩ V(P₂), graphDrawingVertexSet Γ v := by + apply subset_antisymm + · rintro x ⟨hx₁, hx₂⟩ + by_cases hxV : x ∈ Γ.drawing.V + · obtain ⟨v₁, hv₁P₁, hxv₁⟩ := graphDrawingSubgraphU_inter_V Γ hP₁ hx₁ hxV + obtain ⟨v₂, hv₂P₂, hxv₂⟩ := graphDrawingSubgraphU_inter_V Γ hP₂ hx₂ hxV + obtain rfl : v₁ = v₂ := graphDrawingVertexSet_inj Γ hxv₁ hxv₂ + exact mem_iUnion₂.mpr ⟨v₁, ⟨hv₁P₁, hv₂P₂⟩, hxv₁⟩ + · exfalso + have hnot_vert : ∀ {P : Graph α β}, x ∉ ⋃ v ∈ V(P), graphDrawingVertexSet Γ v := by + rintro P hx + obtain ⟨v, _, hvG, rfl⟩ := mem_iUnion₂.mp hx + exact hxV (Γ.iso.vertexEquiv ⟨v, hvG⟩).2 + have hx₁E : x ∈ ⋃ e ∈ E(P₁), closure (graphDrawingEdgeSet Γ e) := + hx₁.resolve_left hnot_vert + have hx₂E : x ∈ ⋃ e ∈ E(P₂), closure (graphDrawingEdgeSet Γ e) := + hx₂.resolve_left hnot_vert + obtain ⟨e₁, he₁, hxe₁⟩ := mem_iUnion₂.mp hx₁E + obtain ⟨e₂, he₂, hxe₂⟩ := mem_iUnion₂.mp hx₂E + have he₁G : e₁ ∈ E(G) := hP₁.edgeSet_mono he₁ + have he₂G : e₂ ∈ E(G) := hP₂.edgeSet_mono he₂ + rw [graphDrawingEdgeSet_eq Γ he₁G] at hxe₁ + rw [graphDrawingEdgeSet_eq Γ he₂G] at hxe₂ + have hne : (Γ.iso.edgeEquiv ⟨e₁, he₁G⟩).1 ≠ (Γ.iso.edgeEquiv ⟨e₂, he₂G⟩).1 := by + intro h + have heq : e₁ = e₂ := + congrArg Subtype.val (Γ.iso.edgeEquiv.injective (Subtype.ext h)) + exact disjoint_left.mp hdisjE he₁ (heq ▸ he₂) + exact hxV (closure_inter_subset_V_drawing Γ.drawing + (Γ.iso.edgeEquiv ⟨e₁, he₁G⟩).2 (Γ.iso.edgeEquiv ⟨e₂, he₂G⟩).2 hne ⟨hxe₁, hxe₂⟩) + · refine iUnion₂_subset fun v ⟨hv₁, hv₂⟩ x hx => + ⟨graphDrawingVertexSet_subset_subgraphU_of_mem Γ hv₁ hx, + graphDrawingVertexSet_subset_subgraphU_of_mem Γ hv₂ hx⟩ + +theorem nonempty_inter_vertexSet_of_nonempty_inter_subgraphU {G P₁ P₂ : Graph α β} + (Γ : GraphDrawing G EuclideanPlane) (hP₁ : P₁ ≤ G) (hP₂ : P₂ ≤ G) + (hne : (graphDrawingSubgraphU Γ P₁ ∩ graphDrawingSubgraphU Γ P₂).Nonempty) : + (V(P₁) ∩ V(P₂)).Nonempty := by + obtain ⟨x, hx₁, hx₂⟩ := hne + by_cases hxV : x ∈ Γ.drawing.V + · obtain ⟨v₁, hv₁P₁, hxv₁⟩ := graphDrawingSubgraphU_inter_V Γ hP₁ hx₁ hxV + obtain ⟨v₂, hv₂P₂, hxv₂⟩ := graphDrawingSubgraphU_inter_V Γ hP₂ hx₂ hxV + obtain rfl : v₁ = v₂ := graphDrawingVertexSet_inj Γ hxv₁ hxv₂ + exact ⟨v₁, hv₁P₁, hv₂P₂⟩ + · have hnot_vert : ∀ {P : Graph α β}, x ∉ ⋃ v ∈ V(P), graphDrawingVertexSet Γ v := by + rintro P hx + obtain ⟨v, _, hvG, rfl⟩ := mem_iUnion₂.mp hx + exact hxV (Γ.iso.vertexEquiv ⟨v, hvG⟩).2 + obtain ⟨e₁, he₁, hxe₁⟩ := mem_iUnion₂.mp (hx₁.resolve_left hnot_vert) + obtain ⟨e₂, he₂, hxe₂⟩ := mem_iUnion₂.mp (hx₂.resolve_left hnot_vert) + have he₁G : e₁ ∈ E(G) := hP₁.edgeSet_mono he₁ + have he₂G : e₂ ∈ E(G) := hP₂.edgeSet_mono he₂ + rw [graphDrawingEdgeSet_eq Γ he₁G] at hxe₁ + rw [graphDrawingEdgeSet_eq Γ he₂G] at hxe₂ + by_cases heq : e₁ = e₂ + · subst heq + obtain ⟨u₁, v₁, hl₁⟩ := P₁.exists_isLink_of_mem_edgeSet he₁ + obtain ⟨u₂, v₂, hl₂⟩ := P₂.exists_isLink_of_mem_edgeSet he₂ + rcases G.eq_or_eq_of_isLink_of_isLink (hl₂.mono hP₂) (hl₁.mono hP₁) with rfl | rfl + · exact ⟨u₂, hl₁.left_mem, hl₂.left_mem⟩ + · exact ⟨u₂, hl₁.right_mem, hl₂.left_mem⟩ + · have hne_e : (Γ.iso.edgeEquiv ⟨e₁, he₁G⟩).1 ≠ (Γ.iso.edgeEquiv ⟨e₂, he₂G⟩).1 := fun h => + heq (congrArg Subtype.val (Γ.iso.edgeEquiv.injective (Subtype.ext h))) + exact (hxV (closure_inter_subset_V_drawing Γ.drawing + (Γ.iso.edgeEquiv ⟨e₁, he₁G⟩).2 (Γ.iso.edgeEquiv ⟨e₂, he₂G⟩).2 hne_e ⟨hxe₁, hxe₂⟩)).elim + +theorem disjoint_subgraphU_of_disjoint_vertexSet {G P₁ P₂ : Graph α β} + (Γ : GraphDrawing G EuclideanPlane) (hP₁ : P₁ ≤ G) (hP₂ : P₂ ≤ G) + (hdisj : Disjoint V(P₁) V(P₂)) : + Disjoint (graphDrawingSubgraphU Γ P₁) (graphDrawingSubgraphU Γ P₂) := by + rw [disjoint_iff_inter_eq_empty] + by_contra hne + obtain ⟨v, hv₁, hv₂⟩ := nonempty_inter_vertexSet_of_nonempty_inter_subgraphU Γ hP₁ hP₂ + (nonempty_iff_ne_empty.mpr hne) + exact disjoint_left.mp hdisj hv₁ hv₂ + +private def mapWalkGraphDrawing {G : Graph α β} (Γ : GraphDrawing G EuclideanPlane) : + ∀ {u v : α} (W : GraphWalk G u v), + GraphWalk Γ.drawing.toGraph + (Γ.iso.vertexEquiv ⟨u, W.mem_vertexSet_of_mem_support W.start_mem_support⟩).1 + (Γ.iso.vertexEquiv ⟨v, W.mem_vertexSet_of_mem_support W.end_mem_support⟩).1 + | _, _, .nil hv => .nil (Γ.iso.vertexEquiv ⟨_, hv⟩).2 + | _, _, .cons hlink r => + .cons ((Γ.iso.isLink_iff ⟨_, hlink.edge_mem⟩ ⟨_, hlink.left_mem⟩ ⟨_, hlink.right_mem⟩).mp hlink) + (mapWalkGraphDrawing Γ r) + +private theorem mem_support_mapWalkGraphDrawing {G : Graph α β} + (Γ : GraphDrawing G EuclideanPlane) {u v : α} (W : GraphWalk G u v) (x : EuclideanPlane) : + x ∈ (mapWalkGraphDrawing Γ W).support ↔ + ∃ w ∈ W.support, x ∈ graphDrawingVertexSet Γ w := by + induction W with + | @nil u hv => + simp only [mapWalkGraphDrawing, GraphWalk.support, List.mem_singleton, + graphDrawingVertexSet_eq_singleton Γ hv, mem_singleton_iff, exists_eq_left] + | @cons u y v e hlink r ih => + simp only [mapWalkGraphDrawing, GraphWalk.support, List.mem_cons, ih] + constructor + · rintro (rfl | ⟨w, hw, hxw⟩) + · exact ⟨u, Or.inl rfl, ⟨hlink.left_mem, rfl⟩⟩ + · exact ⟨w, Or.inr hw, hxw⟩ + · rintro ⟨w, rfl | hw, hxw⟩ + · rw [graphDrawingVertexSet_eq_singleton Γ hlink.left_mem, mem_singleton_iff] at hxw + exact Or.inl hxw + · exact Or.inr ⟨w, hw, hxw⟩ + +private theorem mem_edges_mapWalkGraphDrawing {G : Graph α β} + (Γ : GraphDrawing G EuclideanPlane) {u v : α} (W : GraphWalk G u v) + (f : Set EuclideanPlane) : + f ∈ (mapWalkGraphDrawing Γ W).edges ↔ + ∃ e ∈ W.edges, f = graphDrawingEdgeSet Γ e := by + induction W with + | nil _ => + simp [mapWalkGraphDrawing, GraphWalk.edges] + | @cons u y v e hlink r ih => + simp only [mapWalkGraphDrawing, GraphWalk.edges, List.mem_cons, ih, + ← graphDrawingEdgeSet_eq Γ hlink.edge_mem] + constructor + · rintro (rfl | ⟨e', he', rfl⟩) + · exact ⟨e, Or.inl rfl, rfl⟩ + · exact ⟨e', Or.inr he', rfl⟩ + · rintro ⟨e', rfl | he', rfl⟩ + · exact Or.inl rfl + · exact Or.inr ⟨e', he', rfl⟩ + +private theorem isSimple_mapWalkGraphDrawing {G : Graph α β} + (Γ : GraphDrawing G EuclideanPlane) {u v : α} {W : GraphWalk G u v} + (hW : W.IsSimple) : (mapWalkGraphDrawing Γ W).IsSimple := by + induction W with + | nil _ => + exact List.nodup_singleton _ + | @cons u y v e hlink r ih => + obtain ⟨hu_not, hr⟩ := List.nodup_cons.mp hW + refine List.nodup_cons.mpr ⟨fun hmem => ?_, ih hr⟩ + obtain ⟨w, hw, hxw⟩ := (mem_support_mapWalkGraphDrawing Γ r _).mp hmem + have huw : u = w := graphDrawingVertexSet_inj Γ ⟨hlink.left_mem, rfl⟩ hxw + exact hu_not (huw ▸ hw) + +theorem isLineWithEnds_graphDrawingSubgraphU {G P : Graph α β} + (Γ : GraphDrawing G EuclideanPlane) {u v : α} + (hP : IsGraphPathWithEnds G P u v) (huv : u ≠ v) : + have huG : u ∈ V(G) := hP.le.vertexSet_mono hP.left_mem + have hvG : v ∈ V(G) := hP.le.vertexSet_mono hP.right_mem + IsLineWithEnds (graphDrawingSubgraphU Γ P) + (Γ.iso.vertexEquiv ⟨u, huG⟩).1 (Γ.iso.vertexEquiv ⟨v, hvG⟩).1 ∧ + (Γ.iso.vertexEquiv ⟨u, huG⟩).1 ≠ (Γ.iso.vertexEquiv ⟨v, hvG⟩).1 := by + have huG : u ∈ V(G) := hP.le.vertexSet_mono hP.left_mem + have hvG : v ∈ V(G) := hP.le.vertexSet_mono hP.right_mem + have hne : (Γ.iso.vertexEquiv ⟨u, huG⟩).1 ≠ (Γ.iso.vertexEquiv ⟨v, hvG⟩).1 := fun h => + huv (congrArg Subtype.val (Γ.iso.vertexEquiv.injective (Subtype.ext h))) + rcases hP with ⟨hPG, W, hW, hVP, hEP⟩ + obtain ⟨W_G, hs_G, he_G⟩ := exists_walk_up_of_le hPG W + have hW_G_simple : W_G.IsSimple := by + change W_G.support.Nodup + rw [hs_G] + exact hW + have hline := GraphMinor.GM14.walk_isLine Γ.drawing (mapWalkGraphDrawing Γ W_G) + (isSimple_mapWalkGraphDrawing Γ hW_G_simple) hne + have hset_eq : ({x | x ∈ (mapWalkGraphDrawing Γ W_G).support} ∪ + ⋃ f ∈ {f | f ∈ (mapWalkGraphDrawing Γ W_G).edges}, closure f) = + graphDrawingSubgraphU Γ P := by + ext x + simp only [graphDrawingSubgraphU, mem_union, mem_ofPred_eq, mem_support_mapWalkGraphDrawing, + mem_iUnion, mem_edges_mapWalkGraphDrawing, hs_G, he_G, hVP, hEP] + constructor + · rintro (⟨w, hw, hxw⟩ | ⟨f, ⟨e, he, rfl⟩, hxf⟩) + · exact Or.inl ⟨w, hw, hxw⟩ + · exact Or.inr ⟨e, he, hxf⟩ + · rintro (⟨w, hw, hxw⟩ | ⟨e, he, hxe⟩) + · exact Or.inl ⟨w, hw, hxw⟩ + · exact Or.inr ⟨_, ⟨e, he, rfl⟩, hxe⟩ + rw [hset_eq] at hline + exact ⟨hline, hne⟩ + +theorem isPreconnected_graphDrawingSubgraphU {G P : Graph α β} + (Γ : GraphDrawing G EuclideanPlane) {u v : α} + (hP : IsGraphPathWithEnds G P u v) : + IsPreconnected (graphDrawingSubgraphU Γ P) := by + by_cases huv : u = v + · subst huv + have huG : u ∈ V(G) := hP.le.vertexSet_mono hP.left_mem + rcases hP with ⟨_, W, hW, hVP, hEP⟩ + cases W with + | nil _ => + have hVP' : V(P) = {u} := by + rw [hVP]; ext x; simp [GraphWalk.support] + have hEP' : E(P) = ∅ := by + rw [hEP]; ext e; simp [GraphWalk.edges] + have heq : graphDrawingSubgraphU Γ P = {(Γ.iso.vertexEquiv ⟨u, huG⟩).1} := by + simp [graphDrawingSubgraphU, hVP', hEP', graphDrawingVertexSet_eq_singleton Γ huG] + rw [heq] + exact isPreconnected_singleton + | cons _ r => + exact ((List.nodup_cons.mp hW).1 r.end_mem_support).elim + · exact IsLineWithEnds.isPreconnected (isLineWithEnds_graphDrawingSubgraphU Γ hP huv).1 + +theorem nonempty_inter_of_path_from_bar_to_disc {N : Neighborhood α β} + (P_pres : Presentation N) {C R : Graph α β} {D : Set EuclideanPlane} {x z : α} + (hCG : C ≤ N.G) (hD : IsClosedDisc D) (hD_sub : D ⊆ P_pres.Δ) + (hD_bd : subBd D = graphDrawingSubgraphU P_pres.Γ C) + (hR : IsGraphPathWithEnds N.G R x z) (hx : x ∈ N.Ω.bar) + (hz : (P_pres.Γ.iso.vertexEquiv ⟨z, hR.le.vertexSet_mono hR.right_mem⟩).1 ∈ D) : + (V(R) ∩ V(C)).Nonempty := by + have hxG : x ∈ V(N.G) := hR.le.vertexSet_mono hR.left_mem + have hzG : z ∈ V(N.G) := hR.le.vertexSet_mono hR.right_mem + set px := (P_pres.Γ.iso.vertexEquiv ⟨x, hxG⟩).1 + set pz := (P_pres.Γ.iso.vertexEquiv ⟨z, hzG⟩).1 + have hpx_bd : px ∈ subBd P_pres.Δ := + (P_pres.mem_bd_Δ_iff x hxG).mpr hx ⟨hxG, rfl⟩ + rw [GraphMinor.GM11.subBd_eq_frontier] at hpx_bd + have hpx_not_int : px ∉ interior P_pres.Δ := hpx_bd.2 + have hpx_R : px ∈ graphDrawingSubgraphU P_pres.Γ R := + graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hR.left_mem ⟨hxG, rfl⟩ + have hpz_R : pz ∈ graphDrawingSubgraphU P_pres.Γ R := + graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hR.right_mem ⟨hzG, rfl⟩ + have hnot_disj : ¬ Disjoint (graphDrawingSubgraphU P_pres.Γ R) (frontier D) := by + intro hdisj + rcases GraphMinor.GM14.subset_or_disjoint_of_frontier hD.isClosed + (isPreconnected_graphDrawingSubgraphU P_pres.Γ hR) hdisj with hin | hout + · have hpx_fr : px ∈ frontier D := + ⟨subset_closure (hin hpx_R), fun hi => hpx_not_int (interior_mono hD_sub hi)⟩ + exact disjoint_left.mp hdisj hpx_R hpx_fr + · exact disjoint_left.mp hout hpz_R hz + rw [← GraphMinor.GM11.subBd_eq_frontier, hD_bd] at hnot_disj + exact nonempty_inter_vertexSet_of_nonempty_inter_subgraphU P_pres.Γ hR.le hCG + (not_disjoint_iff_nonempty_inter.mp hnot_disj) + +private theorem detour_dichotomy {G C P_sub : Graph α β} + (Γ : GraphDrawing G EuclideanPlane) {D : Set EuclideanPlane} {v v' : α} + (hCG : C ≤ G) (hD : IsClosedDisc D) + (hD_bd : subBd D = graphDrawingSubgraphU Γ C) + (hP_sub : IsGraphPathWithEnds G P_sub v v') (hvv' : v ≠ v') + (hVC : V(P_sub) ∩ V(C) = {v, v'}) (hEC : Disjoint E(P_sub) E(C)) : + have hvG : v ∈ V(G) := hP_sub.le.vertexSet_mono hP_sub.left_mem + have hv'G : v' ∈ V(G) := hP_sub.le.vertexSet_mono hP_sub.right_mem + let s_pt := (Γ.iso.vertexEquiv ⟨v, hvG⟩).1 + let t_pt := (Γ.iso.vertexEquiv ⟨v', hv'G⟩).1 + IsLineWithEnds (graphDrawingSubgraphU Γ P_sub) s_pt t_pt ∧ + s_pt ≠ t_pt ∧ + graphDrawingSubgraphU Γ P_sub ∩ discBd D = {s_pt, t_pt} ∧ + (graphDrawingSubgraphU Γ P_sub ∩ D = {s_pt, t_pt} ∨ + graphDrawingSubgraphU Γ P_sub ⊆ D) := by + have hvG : v ∈ V(G) := hP_sub.le.vertexSet_mono hP_sub.left_mem + have hv'G : v' ∈ V(G) := hP_sub.le.vertexSet_mono hP_sub.right_mem + set s_pt := (Γ.iso.vertexEquiv ⟨v, hvG⟩).1 + set t_pt := (Γ.iso.vertexEquiv ⟨v', hv'G⟩).1 + obtain ⟨hline, hne⟩ := isLineWithEnds_graphDrawingSubgraphU Γ hP_sub hvv' + have hbd_inter : graphDrawingSubgraphU Γ P_sub ∩ discBd D = {s_pt, t_pt} := by + rw [← Surface.subBd_eq_discBd_euclideanPlane hD, hD_bd, + graphDrawingSubgraphU_inter_of_disjoint_edgeSet Γ hP_sub.le hCG hEC, hVC, + biUnion_insert, biUnion_singleton, + graphDrawingVertexSet_eq_singleton Γ hvG, graphDrawingVertexSet_eq_singleton Γ hv'G, + singleton_union] + refine ⟨hline, hne, hbd_inter, ?_⟩ + have hpre : IsPreconnected (graphDrawingSubgraphU Γ P_sub \ {s_pt, t_pt}) := + GraphMinor.GM14.IsLineWithEnds.isPreconnected_sdiff_pair hline + have hdisj_fr : Disjoint (graphDrawingSubgraphU Γ P_sub \ {s_pt, t_pt}) (frontier D) := by + rw [Surface.plane_disc_frontier hD, disjoint_left] + rintro x ⟨hxP, hx_nst⟩ hx_bd + exact hx_nst (hbd_inter ▸ ⟨hxP, hx_bd⟩) + have hs_in : s_pt ∈ graphDrawingSubgraphU Γ P_sub ∩ discBd D := by + rw [hbd_inter]; exact mem_insert s_pt _ + have ht_in : t_pt ∈ graphDrawingSubgraphU Γ P_sub ∩ discBd D := by + rw [hbd_inter]; exact mem_insert_of_mem s_pt rfl + rcases GraphMinor.GM14.subset_or_disjoint_of_frontier hD.isClosed hpre hdisj_fr with hin | hout + · right + intro x hx + by_cases hx_st : x ∈ ({s_pt, t_pt} : Set EuclideanPlane) + · rcases hx_st with rfl | rfl + · exact Surface.discBd_subset D hs_in.2 + · exact Surface.discBd_subset D ht_in.2 + · exact hin ⟨hx, hx_st⟩ + · left + apply subset_antisymm + · rintro x ⟨hxP, hxD⟩ + by_contra hx_nst + exact disjoint_left.mp hout ⟨hxP, hx_nst⟩ hxD + · rintro x (rfl | rfl) + · exact ⟨hs_in.1, Surface.discBd_subset D hs_in.2⟩ + · exact ⟨ht_in.1, Surface.discBd_subset D ht_in.2⟩ + +theorem circuit_two_arcs_drawing {G C : Graph α β} + (Γ : GraphDrawing G EuclideanPlane) {D : Set EuclideanPlane} {v v' : α} + (hC : IsGraphCircuit G C) (hD : IsClosedDisc D) + (hD_bd : subBd D = graphDrawingSubgraphU Γ C) + (hvC : v ∈ V(C)) (hv'C : v' ∈ V(C)) (hvv' : v ≠ v') : + have hvG : v ∈ V(G) := hC.1.vertexSet_mono hvC + have hv'G : v' ∈ V(G) := hC.1.vertexSet_mono hv'C + let s_pt := (Γ.iso.vertexEquiv ⟨v, hvG⟩).1 + let t_pt := (Γ.iso.vertexEquiv ⟨v', hv'G⟩).1 + ∃ Q₁ Q₂ : Graph α β, + Q₁ ≤ C ∧ Q₂ ≤ C ∧ + IsGraphPathWithEnds G Q₁ v v' ∧ IsGraphPathWithEnds G Q₂ v v' ∧ + V(Q₁) ∩ V(Q₂) = {v, v'} ∧ Disjoint E(Q₁) E(Q₂) ∧ + subgraphUnion G Q₁ Q₂ = C ∧ + IsLineWithEnds (graphDrawingSubgraphU Γ Q₁) s_pt t_pt ∧ + IsLineWithEnds (graphDrawingSubgraphU Γ Q₂) s_pt t_pt ∧ + graphDrawingSubgraphU Γ Q₁ ∩ graphDrawingSubgraphU Γ Q₂ = {s_pt, t_pt} ∧ + graphDrawingSubgraphU Γ Q₁ ∪ graphDrawingSubgraphU Γ Q₂ = discBd D := by + have hvG : v ∈ V(G) := hC.1.vertexSet_mono hvC + have hv'G : v' ∈ V(G) := hC.1.vertexSet_mono hv'C + set s_pt := (Γ.iso.vertexEquiv ⟨v, hvG⟩).1 + set t_pt := (Γ.iso.vertexEquiv ⟨v', hv'G⟩).1 + obtain ⟨Q₁, Q₂, hQ₁C, hQ₂C, hQ₁, hQ₂, _, _, hV, hE, hunion⟩ := + hC.exists_two_paths hvC hv'C hvv' + obtain ⟨hline₁, _⟩ := isLineWithEnds_graphDrawingSubgraphU Γ hQ₁ hvv' + obtain ⟨hline₂, _⟩ := isLineWithEnds_graphDrawingSubgraphU Γ hQ₂ hvv' + have hinter : graphDrawingSubgraphU Γ Q₁ ∩ graphDrawingSubgraphU Γ Q₂ = {s_pt, t_pt} := by + rw [graphDrawingSubgraphU_inter_of_disjoint_edgeSet Γ hQ₁.le hQ₂.le hE, hV, + biUnion_insert, biUnion_singleton, + graphDrawingVertexSet_eq_singleton Γ hvG, graphDrawingVertexSet_eq_singleton Γ hv'G, + singleton_union] + have hunion_U : graphDrawingSubgraphU Γ Q₁ ∪ graphDrawingSubgraphU Γ Q₂ = discBd D := by + rw [← graphDrawingSubgraphU_subgraphUnion Γ hQ₁.le hQ₂.le, hunion, ← hD_bd, + Surface.subBd_eq_discBd_euclideanPlane hD] + exact ⟨Q₁, Q₂, hQ₁C, hQ₂C, hQ₁, hQ₂, hV, hE, hunion, hline₁, hline₂, hinter, hunion_U⟩ + +private theorem move2_replace_with_arc {N : Neighborhood α β} (P_pres : Presentation N) + {s : ℕ} {X : Set α} + {C : Fin s → Graph α β} {P : Fin X.ncard → Graph α β} + {D : Fin s → Set EuclideanPlane} + (hC_circ : ∀ m, IsGraphCircuit N.G (C m)) + (hC_disj : Pairwise (fun m₁ m₂ => Disjoint V(C m₁) V(C m₂))) + (hD_disc : ∀ m, IsClosedDisc (D m) ∧ subBd (D m) = graphDrawingSubgraphU P_pres.Γ (C m)) + (hD_bounds : ∀ m, P_pres.Δ₀ ⊆ D m ∧ D m ⊆ P_pres.Δ) + (hD_mono : ∀ m₁ m₂, m₁ ≤ m₂ → D m₁ ⊆ D m₂) + (hP_path : ∀ k, IsFromToPath N.G (P k) X N.Ω₀.bar) + (hP_disj : Pairwise (fun k₁ k₂ => Disjoint V(P k₁) V(P k₂))) + {j : Fin s} {i' : Fin X.ncard} {P_sub Q_keep Q_drop : Graph α β} {v v' : α} + {Δ_keep : Set EuclideanPlane} + (hP_sub_le : P_sub ≤ P i') + (hP_sub : IsGraphPathWithEnds N.G P_sub v v') (hvv' : v ≠ v') + (hVC : V(P_sub) ∩ V(C j) = {v, v'}) (hEC : Disjoint E(P_sub) E(C j)) + (hQ_keepC : Q_keep ≤ C j) (hQ_dropC : Q_drop ≤ C j) + (hQ_keep : IsGraphPathWithEnds N.G Q_keep v v') + (hQ_drop : IsGraphPathWithEnds N.G Q_drop v v') + (hQ_disjE : Disjoint E(Q_keep) E(Q_drop)) + (hΔ_keep_Y : Δ_keep ⊆ P_pres.Δ) (hΔ_keep : IsClosedDisc Δ_keep) + (hΔ_keep_bd : discBd Δ_keep = + graphDrawingSubgraphU P_pres.Γ P_sub ∪ graphDrawingSubgraphU P_pres.Γ Q_keep) + (hDj_sub : D j ⊆ Δ_keep) + (hP_sub_disj_C : ∀ m : Fin s, m ≠ j → Disjoint V(P_sub) V(C m)) + (hP_sub_in_D : ∀ m : Fin s, j < m → graphDrawingSubgraphU P_pres.Γ P_sub ⊆ D m) : + ∃ C' : Fin s → Graph α β, + N.IsNest P_pres C' ∧ + totalUnionEdges C' P < totalUnionEdges C P := by + classical + let C_new := subgraphUnion N.G P_sub Q_keep + let C' := Function.update C j C_new + let D' := Function.update D j Δ_keep + have hVP_Q : V(P_sub) ∩ V(Q_keep) = {v, v'} := by + apply subset_antisymm + · intro u ⟨huP, huQ⟩ + have : u ∈ V(P_sub) ∩ V(C j) := ⟨huP, hQ_keepC.vertexSet_mono huQ⟩ + rwa [hVC] at this + · rintro u (rfl | rfl) + · exact ⟨hP_sub.left_mem, hQ_keep.left_mem⟩ + · exact ⟨hP_sub.right_mem, hQ_keep.right_mem⟩ + have hEP_Q : Disjoint E(P_sub) E(Q_keep) := + disjoint_of_subset_right hQ_keepC.edgeSet_mono hEC + have hC_new_circ : IsGraphCircuit N.G C_new := + isGraphCircuit_subgraphUnion hP_sub hQ_keep hvv' hVP_Q hEP_Q + have hC'_nest : N.IsNest P_pres C' := by + refine ⟨?_, ?_, D', ?_, ?_, ?_⟩ + · intro m + by_cases hmj : m = j + · subst hmj; simp only [C', Function.update_self]; exact hC_new_circ + · simp only [C', Function.update_of_ne hmj]; exact hC_circ m + · intro m₁ m₂ hm₁₂ + by_cases hm₁ : m₁ = j + · subst hm₁ + have hm₂ : m₂ ≠ m₁ := hm₁₂.symm + simp only [C', Function.update_self, Function.update_of_ne hm₂] + have hsub : V(C_new) ⊆ V(P_sub) ∪ V(C m₁) := + union_subset_union Subset.rfl hQ_keepC.vertexSet_mono + exact disjoint_of_subset_left hsub + (disjoint_union_left.mpr ⟨hP_sub_disj_C m₂ hm₂, hC_disj hm₁₂⟩) + · by_cases hm₂ : m₂ = j + · subst hm₂ + simp only [C', Function.update_of_ne hm₁, Function.update_self] + have hsub : V(C_new) ⊆ V(P_sub) ∪ V(C m₂) := + union_subset_union Subset.rfl hQ_keepC.vertexSet_mono + exact disjoint_of_subset_right hsub + (disjoint_union_right.mpr ⟨(hP_sub_disj_C m₁ hm₁).symm, hC_disj hm₁₂⟩) + · simp only [C', Function.update_of_ne hm₁, Function.update_of_ne hm₂] + exact hC_disj hm₁₂ + · intro m + by_cases hmj : m = j + · subst hmj + simp only [D', C', C_new, Function.update_self] + refine ⟨hΔ_keep, ?_⟩ + rw [Surface.subBd_eq_discBd_euclideanPlane hΔ_keep, hΔ_keep_bd, + graphDrawingSubgraphU_subgraphUnion P_pres.Γ hP_sub.le hQ_keep.le] + · simp only [D', C', Function.update_of_ne hmj] + exact hD_disc m + · intro m + by_cases hmj : m = j + · subst hmj + simp only [D', Function.update_self] + exact ⟨(hD_bounds m).1.trans hDj_sub, hΔ_keep_Y⟩ + · simp only [D', Function.update_of_ne hmj] + exact hD_bounds m + · intro m₁ m₂ hm₁₂ + by_cases hm₁ : m₁ = j + · subst hm₁ + by_cases hm₂ : m₂ = m₁ + · subst hm₂; exact Subset.rfl + · simp only [D', Function.update_self, Function.update_of_ne hm₂] + have hlt : m₁ < m₂ := lt_of_le_of_ne hm₁₂ (Ne.symm hm₂) + refine disc_mono_of_subset P_pres.isClosedDisc_Δ hΔ_keep_Y (hD_bounds m₂).2 + hΔ_keep (hD_disc m₂).1 ?_ + rw [hΔ_keep_bd] + refine union_subset (hP_sub_in_D m₂ hlt) ?_ + have hQ_sub : graphDrawingSubgraphU P_pres.Γ Q_keep ⊆ D m₁ := by + refine (graphDrawingSubgraphU_mono P_pres.Γ hQ_keepC).trans ?_ + rw [← (hD_disc m₁).2, Surface.subBd_eq_discBd_euclideanPlane (hD_disc m₁).1] + exact Surface.discBd_subset (D m₁) + exact hQ_sub.trans (hD_mono m₁ m₂ hm₁₂) + · by_cases hm₂ : m₂ = j + · subst hm₂ + simp only [D', Function.update_of_ne hm₁, Function.update_self] + exact (hD_mono m₁ m₂ hm₁₂).trans hDj_sub + · simp only [D', Function.update_of_ne hm₁, Function.update_of_ne hm₂] + exact hD_mono m₁ m₂ hm₁₂ + have hPG : ∀ k, P k ≤ N.G := fun k => by + obtain ⟨_, _, hft⟩ := hP_path k + exact hft.1.le + have hCG : ∀ m, C m ≤ N.G := fun m => (hC_circ m).1 + obtain ⟨x, y, hPi'_ft⟩ := hP_path i' + obtain ⟨e₀, he₀_drop, he₀_not_P⟩ := + exists_edge_not_mem_iUnion_of_path hPG hP_disj hPi'_ft.1 hP_sub hP_sub_le hQ_drop hvv' + (disjoint_of_subset_right hQ_dropC.edgeSet_mono hEC) + have hlt := totalUnionEdges_lt_of_replace_circuit N.finite_E hCG hPG hC_disj + hP_sub_le hQ_keepC hQ_dropC hQ_disjE he₀_drop + (fun k hek => he₀_not_P (mem_iUnion.mpr ⟨k, hek⟩)) + exact ⟨C', hC'_nest, hlt⟩ + +private theorem move2_outer_detour {N : Neighborhood α β} (P_pres : Presentation N) + {s : ℕ} {X : Set α} (hX_sub : X ⊆ N.Ω.bar) + {C : Fin s → Graph α β} {P : Fin X.ncard → Graph α β} + {D : Fin s → Set EuclideanPlane} + (hC_circ : ∀ m, IsGraphCircuit N.G (C m)) + (hC_disj : Pairwise (fun m₁ m₂ => Disjoint V(C m₁) V(C m₂))) + (hD_disc : ∀ m, IsClosedDisc (D m) ∧ subBd (D m) = graphDrawingSubgraphU P_pres.Γ (C m)) + (hD_bounds : ∀ m, P_pres.Δ₀ ⊆ D m ∧ D m ⊆ P_pres.Δ) + (hD_mono : ∀ m₁ m₂, m₁ ≤ m₂ → D m₁ ⊆ D m₂) + (hP_path : ∀ k, IsFromToPath N.G (P k) X N.Ω₀.bar) + (hP_disj : Pairwise (fun k₁ k₂ => Disjoint V(P k₁) V(P k₂))) + {j : Fin s} + (hafter : ∀ j' : Fin s, j < j' → ∀ k : Fin X.ncard, + IsGraphPath N.G (subgraphInter N.G (P k) (C j'))) + {i' : Fin X.ncard} {P_sub : Graph α β} {v v' : α} + (hP_sub_le : P_sub ≤ P i') + (hP_sub : IsGraphPathWithEnds N.G P_sub v v') (hvv' : v ≠ v') + (hVC : V(P_sub) ∩ V(C j) = {v, v'}) (hEC : Disjoint E(P_sub) E(C j)) + (houter : graphDrawingSubgraphU P_pres.Γ P_sub ∩ D j = + {(P_pres.Γ.iso.vertexEquiv ⟨v, hP_sub.le.vertexSet_mono hP_sub.left_mem⟩).1, + (P_pres.Γ.iso.vertexEquiv ⟨v', hP_sub.le.vertexSet_mono hP_sub.right_mem⟩).1}) : + ∃ C' : Fin s → Graph α β, + N.IsNest P_pres C' ∧ + totalUnionEdges C' P < totalUnionEdges C P := by + have hvC : v ∈ V(C j) := by + have : v ∈ V(P_sub) ∩ V(C j) := by rw [hVC]; exact mem_insert v _ + exact this.2 + have hv'C : v' ∈ V(C j) := by + have : v' ∈ V(P_sub) ∩ V(C j) := by rw [hVC]; exact mem_insert_of_mem v rfl + exact this.2 + have hvG : v ∈ V(N.G) := hP_sub.le.vertexSet_mono hP_sub.left_mem + have hv'G : v' ∈ V(N.G) := hP_sub.le.vertexSet_mono hP_sub.right_mem + set s_pt := (P_pres.Γ.iso.vertexEquiv ⟨v, hvG⟩).1 + set t_pt := (P_pres.Γ.iso.vertexEquiv ⟨v', hv'G⟩).1 + have hs_Dj : s_pt ∈ D j := by + have : s_pt ∈ graphDrawingSubgraphU P_pres.Γ P_sub ∩ D j := by + rw [houter]; exact mem_insert s_pt _ + exact this.2 + have ht_Dj : t_pt ∈ D j := by + have : t_pt ∈ graphDrawingSubgraphU P_pres.Γ P_sub ∩ D j := by + rw [houter]; exact mem_insert_of_mem s_pt rfl + exact this.2 + have hP_sub_disj_C : ∀ m : Fin s, m ≠ j → Disjoint V(P_sub) V(C m) := by + intro m hmj + rcases lt_or_gt_of_ne hmj with hlt | hgt + · refine disjoint_left.mpr fun w hwP hwCm => ?_ + have hwG : w ∈ V(N.G) := hP_sub.le.vertexSet_mono hwP + let pw := (P_pres.Γ.iso.vertexEquiv ⟨w, hwG⟩).1 + have hpw_P : pw ∈ graphDrawingSubgraphU P_pres.Γ P_sub := + graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hwP ⟨hwG, rfl⟩ + have hpw_Cm : pw ∈ graphDrawingSubgraphU P_pres.Γ (C m) := + graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hwCm ⟨hwG, rfl⟩ + rw [← (hD_disc m).2, Surface.subBd_eq_discBd_euclideanPlane (hD_disc m).1] at hpw_Cm + have hpw_Dj : pw ∈ D j := + hD_mono m j (le_of_lt hlt) (Surface.discBd_subset (D m) hpw_Cm) + have hpw_st : pw ∈ ({s_pt, t_pt} : Set EuclideanPlane) := + houter ▸ ⟨hpw_P, hpw_Dj⟩ + have hw_Cj : w ∈ V(C j) := by + rcases hpw_st with h | h + · have : w = v := congrArg Subtype.val (P_pres.Γ.iso.vertexEquiv.injective (Subtype.ext h)) + exact this ▸ hvC + · have : w = v' := congrArg Subtype.val (P_pres.Γ.iso.vertexEquiv.injective (Subtype.ext h)) + exact this ▸ hv'C + exact disjoint_left.mp (hC_disj hmj) hwCm hw_Cj + · obtain ⟨x, y, hPi'_ft, hxX, _⟩ := hP_path i' + have hx_bar : x ∈ N.Ω.bar := hX_sub (by + have : x ∈ V(P i') ∩ X := by rw [hxX]; exact mem_singleton x + exact this.2) + obtain ⟨v₁, hv₁_eq, R₁, hR₁_le, hR₁, hR₁_inter⟩ := + exists_prefix_disjoint_subpath hPi'_ft hP_sub hP_sub_le + have hv₁_Dm : (P_pres.Γ.iso.vertexEquiv ⟨v₁, hR₁.le.vertexSet_mono hR₁.right_mem⟩).1 ∈ D m + := by + have hv₁_Dj : (P_pres.Γ.iso.vertexEquiv ⟨v₁, hR₁.le.vertexSet_mono hR₁.right_mem⟩).1 ∈ D j + := by + rcases hv₁_eq with rfl | rfl + · exact hs_Dj + · exact ht_Dj + exact hD_mono j m (le_of_lt hgt) hv₁_Dj + have hR₁_meet : (V(R₁) ∩ V(C m)).Nonempty := + nonempty_inter_of_path_from_bar_to_disc P_pres (hC_circ m).1 (hD_disc m).1 + (hD_bounds m).2 (hD_disc m).2 hR₁ hx_bar hv₁_Dm + have hv_not : v ∉ V(C m) := disjoint_left.mp (hC_disj hmj.symm) hvC + have hv'_not : v' ∉ V(C m) := disjoint_left.mp (hC_disj hmj.symm) hv'C + exact disjoint_detour_of_isGraphPath_inter (hC_circ m).1 hPi'_ft hP_sub hP_sub_le hv₁_eq + hR₁_le hR₁ hR₁_inter hv_not hv'_not (hafter m hgt i') hR₁_meet + have hP_sub_in_D : ∀ m : Fin s, j < m → graphDrawingSubgraphU P_pres.Γ P_sub ⊆ D m := by + intro m hjm + have hdisj_U := disjoint_subgraphU_of_disjoint_vertexSet P_pres.Γ hP_sub.le (hC_circ m).1 + (hP_sub_disj_C m (ne_of_gt hjm)) + rw [← (hD_disc m).2, GraphMinor.GM11.subBd_eq_frontier] at hdisj_U + rcases GraphMinor.GM14.subset_or_disjoint_of_frontier (hD_disc m).1.isClosed + (isPreconnected_graphDrawingSubgraphU P_pres.Γ hP_sub) hdisj_U with hin | hout + · exact hin + · exfalso + have hs_P : s_pt ∈ graphDrawingSubgraphU P_pres.Γ P_sub := + graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hP_sub.left_mem ⟨hvG, rfl⟩ + exact disjoint_left.mp hout hs_P (hD_mono j m (le_of_lt hjm) hs_Dj) + obtain ⟨hline_P, _, _, _⟩ := + detour_dichotomy P_pres.Γ (hC_circ j).1 (hD_disc j).1 (hD_disc j).2 hP_sub hvv' hVC hEC + obtain ⟨Q₁, Q₂, hQ₁C, hQ₂C, hQ₁, hQ₂, _, hQ_E, _, hline₁, hline₂, hQ_inter_U, hQ_union_U⟩ := + circuit_two_arcs_drawing P_pres.Γ (hC_circ j) (hD_disc j).1 (hD_disc j).2 hvC hv'C hvv' + have hP_sub_Y : graphDrawingSubgraphU P_pres.Γ P_sub ⊆ P_pres.Δ := + (graphDrawingSubgraphU_subset_U P_pres.Γ P_sub).trans (P_pres.U_subset.trans sdiff_subset) + rcases outer_chord_disc_contains P_pres.isClosedDisc_Δ (hD_disc j).1 (hD_bounds j).2 + hline₁ hline₂ hline_P hQ_inter_U hQ_union_U hP_sub_Y houter with + ⟨Δ₁, hΔ₁Y, hΔ₁, hΔ₁_bd, hDj_Δ₁⟩ | ⟨Δ₂, hΔ₂Y, hΔ₂, hΔ₂_bd, hDj_Δ₂⟩ + · exact move2_replace_with_arc P_pres hC_circ hC_disj hD_disc hD_bounds hD_mono hP_path hP_disj + hP_sub_le hP_sub hvv' hVC hEC hQ₁C hQ₂C hQ₁ hQ₂ hQ_E hΔ₁Y hΔ₁ hΔ₁_bd hDj_Δ₁ + hP_sub_disj_C hP_sub_in_D + · exact move2_replace_with_arc P_pres hC_circ hC_disj hD_disc hD_bounds hD_mono hP_path hP_disj + hP_sub_le hP_sub hvv' hVC hEC hQ₂C hQ₁C hQ₂ hQ₁ hQ_E.symm hΔ₂Y hΔ₂ hΔ₂_bd hDj_Δ₂ + hP_sub_disj_C hP_sub_in_D + +theorem isClosedDisc_Δ₀_and_mem_of_mem_bar₀ {N : Neighborhood α β} + (P_pres : Presentation N) {y : α} (hy : y ∈ N.Ω₀.bar) : + have hyG : y ∈ V(N.G) := N.bar₀_subset hy + IsClosedDisc P_pres.Δ₀ ∧ + (P_pres.Γ.iso.vertexEquiv ⟨y, hyG⟩).1 ∈ P_pres.Δ₀ := by + have hyG : y ∈ V(N.G) := N.bar₀_subset hy + rcases P_pres.agrees_Δ₀ with ⟨_, hbar_emp⟩ | ⟨hΔ₀_disc, _⟩ + · exact (Set.notMem_empty y (hbar_emp ▸ hy)).elim + · refine ⟨hΔ₀_disc, ?_⟩ + have hpy_bd : (P_pres.Γ.iso.vertexEquiv ⟨y, hyG⟩).1 ∈ subBd P_pres.Δ₀ := + (P_pres.mem_bd_Δ₀_iff y hyG).mpr hy ⟨hyG, rfl⟩ + rw [Surface.subBd_eq_discBd_euclideanPlane hΔ₀_disc] at hpy_bd + exact Surface.discBd_subset P_pres.Δ₀ hpy_bd + +private theorem prop2_inner_walk {N : Neighborhood α β} (P_pres : Presentation N) + {C_j P_i' : Graph α β} {D_j : Set EuclideanPlane} {y : α} + (hC : IsGraphCircuit N.G C_j) (hD : IsClosedDisc D_j) + (hD_bd : subBd D_j = graphDrawingSubgraphU P_pres.Γ C_j) + (hΔ₀_sub : P_pres.Δ₀ ⊆ D_j) (hy : y ∈ N.Ω₀.bar) + (hdetour_in : ∀ {u u' : α} {P_sub : Graph α β}, + P_sub ≤ P_i' → IsGraphPathWithEnds N.G P_sub u u' → u ≠ u' → + V(P_sub) ∩ V(C_j) = {u, u'} → Disjoint E(P_sub) E(C_j) → + graphDrawingSubgraphU P_pres.Γ P_sub ⊆ D_j) : + ∀ (n : ℕ) {v : α} (W : GraphWalk N.G v y), + W.length = n → W.IsSimple → v ∈ V(C_j) → walkSubgraph W ≤ P_i' → + graphDrawingSubgraphU P_pres.Γ (walkSubgraph W) ⊆ D_j := by + have hyG : y ∈ V(N.G) := N.bar₀_subset hy + obtain ⟨_, hpy_Δ₀⟩ := isClosedDisc_Δ₀_and_mem_of_mem_bar₀ P_pres hy + have hpy_Dj : (P_pres.Γ.iso.vertexEquiv ⟨y, hyG⟩).1 ∈ D_j := hΔ₀_sub hpy_Δ₀ + have hCj_Dj : graphDrawingSubgraphU P_pres.Γ C_j ⊆ D_j := by + rw [← hD_bd, Surface.subBd_eq_discBd_euclideanPlane hD] + exact Surface.discBd_subset D_j + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro v W hlen hW_s hvC hW_le + cases W with + | @nil v hvG => + refine union_subset (iUnion₂_subset fun u hu => ?_) (iUnion₂_subset fun e he => ?_) + · rw [vertexSet_walkSubgraph, mem_ofPred_eq, GraphWalk.support_nil, + List.mem_singleton] at hu + subst hu + exact (graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hvC).trans hCj_Dj + · rw [edgeSet_walkSubgraph, mem_ofPred_eq, GraphWalk.edges_nil] at he + exact (List.not_mem_nil he).elim + | @cons v w _ e hl r => + have hv_not_r : v ∉ r.support := (List.nodup_cons.mp hW_s).1 + have hr_s : r.IsSimple := (List.nodup_cons.mp hW_s).2 + have hr_le_cons : walkSubgraph r ≤ walkSubgraph (GraphWalk.cons hl r) := by + rw [(Compatible.of_le_le (walkSubgraph_le r) (walkSubgraph_le _)).le_iff, + vertexSet_walkSubgraph, vertexSet_walkSubgraph, + edgeSet_walkSubgraph, edgeSet_walkSubgraph] + exact ⟨fun x hx => List.mem_cons_of_mem v hx, fun f hf => List.mem_cons_of_mem e hf⟩ + by_cases heC : e ∈ E(C_j) + · have hlC : C_j.IsLink e v w := (hC.1.isLink_iff heC).mpr hl + have hwC : w ∈ V(C_j) := hlC.right_mem + have hlt : r.length < n := by + rw [← hlen, GraphWalk.length_cons] + omega + have hr_Dj := ih r.length hlt r rfl hr_s hwC (hr_le_cons.trans hW_le) + refine union_subset (iUnion₂_subset fun u hu => ?_) (iUnion₂_subset fun f hf => ?_) + · rw [vertexSet_walkSubgraph, mem_ofPred_eq, GraphWalk.support_cons, + List.mem_cons] at hu + rcases hu with rfl | hur + · exact (graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hvC).trans hCj_Dj + · have hu_W : u ∈ V(walkSubgraph r) := by + rw [vertexSet_walkSubgraph]; exact hur + exact (graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hu_W).trans hr_Dj + · rw [edgeSet_walkSubgraph, mem_ofPred_eq, GraphWalk.edges_cons, + List.mem_cons] at hf + rcases hf with rfl | hfr + · intro x hx + exact hCj_Dj (Or.inr (mem_iUnion₂.mpr ⟨f, heC, hx⟩)) + · intro x hx + have hf_W : f ∈ E(walkSubgraph r) := by + rw [edgeSet_walkSubgraph]; exact hfr + exact hr_Dj (Or.inr (mem_iUnion₂.mpr ⟨f, hf_W, hx⟩)) + · by_cases hhit : ∃ x ∈ r.support, x ∈ V(C_j) + · obtain ⟨v', hv'C, r₁, r₂, hsplit_r, hr₁_first⟩ := exists_first_hit_split r hhit + have hr₁_s : r₁.IsSimple := (isSimple_of_append (hsplit_r ▸ hr_s)).1 + have hr₂_s : r₂.IsSimple := (isSimple_of_append (hsplit_r ▸ hr_s)).2 + have hv_not_r₁ : v ∉ r₁.support := fun hv_in => + hv_not_r (hsplit_r ▸ (GraphWalk.mem_support_append r₁ r₂).mpr (Or.inl hv_in)) + have hcons_r₁_s : (GraphWalk.cons hl r₁).IsSimple := + List.nodup_cons.mpr ⟨hv_not_r₁, hr₁_s⟩ + have hvv' : v ≠ v' := fun h => hv_not_r₁ (h ▸ r₁.end_mem_support) + let P_sub := walkSubgraph (GraphWalk.cons hl r₁) + have hP_sub_le : P_sub ≤ walkSubgraph (GraphWalk.cons hl r) := by + rw [(Compatible.of_le_le (walkSubgraph_le _) (walkSubgraph_le _)).le_iff, + vertexSet_walkSubgraph, vertexSet_walkSubgraph, + edgeSet_walkSubgraph, edgeSet_walkSubgraph] + refine ⟨fun x hx => ?_, fun f hf => ?_⟩ + · rcases List.mem_cons.mp hx with rfl | hx₁ + · exact List.mem_cons_self + · exact List.mem_cons_of_mem v + (hsplit_r ▸ (GraphWalk.mem_support_append r₁ r₂).mpr (Or.inl hx₁)) + · rcases List.mem_cons.mp hf with rfl | hf₁ + · exact List.mem_cons_self + · refine List.mem_cons_of_mem e ?_ + rw [hsplit_r, GraphWalk.edges_append, List.mem_append] + exact Or.inl hf₁ + have hr₁_no_edge : ∀ f ∈ r₁.edges, f ∉ E(C_j) := by + intro f hf₁ hfC + obtain ⟨x, z, hxzC⟩ := C_j.exists_isLink_of_mem_edgeSet hfC + have hxzG : N.G.IsLink f x z := hxzC.mono hC.1 + have hx_s : x ∈ r₁.support := r₁.left_mem_support_of_mem_edges hf₁ hxzG + have hz_s : z ∈ r₁.support := r₁.left_mem_support_of_mem_edges hf₁ hxzG.symm + have hxv' : x = v' := hr₁_first x hx_s hxzC.left_mem + have hzv' : z = v' := hr₁_first z hz_s hxzC.right_mem + subst hxv' hzv' + exact not_isLink_self_of_mem_edges_of_isSimple r₁ hr₁_s hf₁ hxzG + have hVC_sub : V(P_sub) ∩ V(C_j) = {v, v'} := by + rw [vertexSet_walkSubgraph] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.support_cons, List.mem_cons, + mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨rfl | hx₁, hxC⟩ + · exact Or.inl rfl + · exact Or.inr (hr₁_first x hx₁ hxC) + · rintro (rfl | rfl) + · exact ⟨Or.inl rfl, hvC⟩ + · exact ⟨Or.inr r₁.end_mem_support, hv'C⟩ + have hEC_sub : Disjoint E(P_sub) E(C_j) := by + rw [edgeSet_walkSubgraph] + refine disjoint_left.mpr fun f hf hfC => ?_ + rcases List.mem_cons.mp hf with rfl | hf₁ + · exact heC hfC + · exact hr₁_no_edge f hf₁ hfC + have hP_sub_Dj : graphDrawingSubgraphU P_pres.Γ P_sub ⊆ D_j := + hdetour_in (hP_sub_le.trans hW_le) (isGraphPathWithEnds_walkSubgraph hcons_r₁_s) + hvv' hVC_sub hEC_sub + have hr₂_le : walkSubgraph r₂ ≤ walkSubgraph (GraphWalk.cons hl r) := by + rw [(Compatible.of_le_le (walkSubgraph_le _) (walkSubgraph_le _)).le_iff, + vertexSet_walkSubgraph, vertexSet_walkSubgraph, + edgeSet_walkSubgraph, edgeSet_walkSubgraph] + refine ⟨fun x hx => List.mem_cons_of_mem v ?_, fun f hf => List.mem_cons_of_mem e ?_⟩ + · rw [hsplit_r, GraphWalk.mem_support_append] + exact Or.inr hx + · rw [hsplit_r, GraphWalk.edges_append, List.mem_append] + exact Or.inr hf + have hlt₂ : r₂.length < n := by + rw [← hlen, GraphWalk.length_cons, hsplit_r, GraphWalk.length_append] + omega + have hr₂_Dj := ih r₂.length hlt₂ r₂ rfl hr₂_s hv'C (hr₂_le.trans hW_le) + refine union_subset (iUnion₂_subset fun u hu => ?_) (iUnion₂_subset fun f hf => ?_) + · rw [vertexSet_walkSubgraph, mem_ofPred_eq, GraphWalk.support_cons, List.mem_cons, + hsplit_r, GraphWalk.mem_support_append] at hu + rcases hu with rfl | hu₁ | hu₂ + · have hu_sub : u ∈ V(P_sub) := by + rw [vertexSet_walkSubgraph]; exact List.mem_cons_self + exact (graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hu_sub).trans hP_sub_Dj + · have hu_sub : u ∈ V(P_sub) := by + rw [vertexSet_walkSubgraph]; exact List.mem_cons_of_mem v hu₁ + exact (graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hu_sub).trans hP_sub_Dj + · have hu_r₂ : u ∈ V(walkSubgraph r₂) := by + rw [vertexSet_walkSubgraph]; exact hu₂ + exact (graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hu_r₂).trans hr₂_Dj + · rw [edgeSet_walkSubgraph, mem_ofPred_eq, GraphWalk.edges_cons, List.mem_cons, + hsplit_r, GraphWalk.edges_append, List.mem_append] at hf + rcases hf with rfl | hf₁ | hf₂ + · intro x hx + have hf_sub : f ∈ E(P_sub) := by + rw [edgeSet_walkSubgraph]; exact List.mem_cons_self + exact hP_sub_Dj (Or.inr (mem_iUnion₂.mpr ⟨f, hf_sub, hx⟩)) + · intro x hx + have hf_sub : f ∈ E(P_sub) := by + rw [edgeSet_walkSubgraph]; exact List.mem_cons_of_mem e hf₁ + exact hP_sub_Dj (Or.inr (mem_iUnion₂.mpr ⟨f, hf_sub, hx⟩)) + · intro x hx + have hf_r₂ : f ∈ E(walkSubgraph r₂) := by + rw [edgeSet_walkSubgraph]; exact hf₂ + exact hr₂_Dj (Or.inr (mem_iUnion₂.mpr ⟨f, hf_r₂, hx⟩)) + · have hhit' : ∀ x ∈ r.support, x ∉ V(C_j) := fun x hx hxC => hhit ⟨x, hx, hxC⟩ + let R := walkSubgraph (GraphWalk.cons hl r) + have hR_path : IsGraphPathWithEnds N.G R v y := isGraphPathWithEnds_walkSubgraph hW_s + have hvy : v ≠ y := fun h => hhit' y r.end_mem_support (h ▸ hvC) + have hVC_R : V(R) ∩ V(C_j) = {v} := by + rw [vertexSet_walkSubgraph] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.support_cons, List.mem_cons, + mem_singleton_iff] + constructor + · rintro ⟨rfl | hxr, hxC⟩ + · rfl + · exact (hhit' x hxr hxC).elim + · rintro rfl + exact ⟨Or.inl rfl, hvC⟩ + have hEC_R : Disjoint E(R) E(C_j) := by + rw [edgeSet_walkSubgraph] + refine disjoint_left.mpr fun f hf hfC => ?_ + rcases List.mem_cons.mp hf with rfl | hfr + · exact heC hfC + · obtain ⟨x, z, hxzC⟩ := C_j.exists_isLink_of_mem_edgeSet hfC + have hxzG : N.G.IsLink f x z := hxzC.mono hC.1 + have hx_r : x ∈ r.support := r.left_mem_support_of_mem_edges hfr hxzG + exact hhit' x hx_r hxzC.left_mem + have hvG : v ∈ V(N.G) := hl.left_mem + set pv := (P_pres.Γ.iso.vertexEquiv ⟨v, hvG⟩).1 + set py := (P_pres.Γ.iso.vertexEquiv ⟨y, hyG⟩).1 + obtain ⟨hline_R, hpvy_ne⟩ := isLineWithEnds_graphDrawingSubgraphU P_pres.Γ hR_path hvy + have hbd_inter : graphDrawingSubgraphU P_pres.Γ R ∩ discBd D_j = {pv} := by + rw [← Surface.subBd_eq_discBd_euclideanPlane hD, hD_bd, + graphDrawingSubgraphU_inter_of_disjoint_edgeSet P_pres.Γ hR_path.le hC.1 hEC_R, + hVC_R, biUnion_singleton, graphDrawingVertexSet_eq_singleton P_pres.Γ hvG] + have hpre_R : IsPreconnected (graphDrawingSubgraphU P_pres.Γ R \ {pv}) := + IsLineWithEnds.isPreconnected_sdiff_left hline_R + have hdisj_fr : Disjoint (graphDrawingSubgraphU P_pres.Γ R \ {pv}) (frontier D_j) := by + rw [Surface.plane_disc_frontier hD, disjoint_left] + rintro x ⟨hxR, hx_npv⟩ hx_bd + exact hx_npv (hbd_inter ▸ ⟨hxR, hx_bd⟩) + rcases GraphMinor.GM14.subset_or_disjoint_of_frontier hD.isClosed hpre_R hdisj_fr with + hin | hout + · intro x hx + by_cases hxpv : x = pv + · subst hxpv + have hpv_in : pv ∈ graphDrawingSubgraphU P_pres.Γ R ∩ discBd D_j := by + rw [hbd_inter]; exact mem_singleton pv + exact Surface.discBd_subset D_j hpv_in.2 + · exact hin ⟨hx, hxpv⟩ + · exfalso + have hpy_R : py ∈ graphDrawingSubgraphU P_pres.Γ R := + graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hR_path.right_mem ⟨hyG, rfl⟩ + exact disjoint_left.mp hout ⟨hpy_R, hpvy_ne.symm⟩ hpy_Dj + +private theorem prop2_inner_subpath {N : Neighborhood α β} (P_pres : Presentation N) + {C_j P_i' : Graph α β} {D_j : Set EuclideanPlane} {x y v : α} + (hC : IsGraphCircuit N.G C_j) (hD : IsClosedDisc D_j) + (hD_bd : subBd D_j = graphDrawingSubgraphU P_pres.Γ C_j) + (hΔ₀_sub : P_pres.Δ₀ ⊆ D_j) + (hPi' : IsGraphPathWithEnds N.G P_i' x y) (hy : y ∈ N.Ω₀.bar) + (hdetour_in : ∀ {u u' : α} {P_sub : Graph α β}, + P_sub ≤ P_i' → IsGraphPathWithEnds N.G P_sub u u' → u ≠ u' → + V(P_sub) ∩ V(C_j) = {u, u'} → Disjoint E(P_sub) E(C_j) → + graphDrawingSubgraphU P_pres.Γ P_sub ⊆ D_j) + (hvC : v ∈ V(C_j)) (hvP : v ∈ V(P_i')) : + ∃ R : Graph α β, R ≤ P_i' ∧ IsGraphPathWithEnds N.G R v y ∧ + graphDrawingSubgraphU P_pres.Γ R ⊆ D_j := by + obtain ⟨R, hR_le, _, hR⟩ := hPi'.exists_subpath hvP hPi'.right_mem + refine ⟨R, hR_le, hR, ?_⟩ + rcases hR with ⟨hRG, W, hW_s, hVR, hER⟩ + obtain ⟨WG, hsG, heG⟩ := exists_walk_up_of_le hRG W + have hWG_s : WG.IsSimple := by change WG.support.Nodup; rw [hsG]; exact hW_s + have hR_eq : R = walkSubgraph WG := by + refine (Compatible.of_le_le hRG (walkSubgraph_le WG)).ext ?_ ?_ + · rw [hVR, vertexSet_walkSubgraph, hsG] + · rw [hER, edgeSet_walkSubgraph, heG] + rw [hR_eq] + exact prop2_inner_walk P_pres hC hD hD_bd hΔ₀_sub hy hdetour_in WG.length WG rfl hWG_s hvC + (hR_eq ▸ hR_le) + +private theorem move3_reroute_with_arc {N : Neighborhood α β} (P_pres : Presentation N) + {s : ℕ} {X : Set α} + {C : Fin s → Graph α β} {P : Fin X.ncard → Graph α β} + {D : Fin s → Set EuclideanPlane} + (hC_circ : ∀ m, IsGraphCircuit N.G (C m)) + (hC_disj : Pairwise (fun m₁ m₂ => Disjoint V(C m₁) V(C m₂))) + (hD_disc : ∀ m, IsClosedDisc (D m) ∧ subBd (D m) = graphDrawingSubgraphU P_pres.Γ (C m)) + (hD_bounds : ∀ m, P_pres.Δ₀ ⊆ D m ∧ D m ⊆ P_pres.Δ) + (hP_path : ∀ k, IsFromToPath N.G (P k) X N.Ω₀.bar) + (hP_disj : Pairwise (fun k₁ k₂ => Disjoint V(P k₁) V(P k₂))) + {j : Fin s} {i : Fin X.ncard} + (hdetour_in : ∀ {k : Fin X.ncard} {u u' : α} {P_sub : Graph α β}, + P_sub ≤ P k → IsGraphPathWithEnds N.G P_sub u u' → u ≠ u' → + V(P_sub) ∩ V(C j) = {u, u'} → Disjoint E(P_sub) E(C j) → + graphDrawingSubgraphU P_pres.Γ P_sub ⊆ D j) + {P_sub Q_k : Graph α β} {v v' w₁ : α} {e₁ : β} + (hvC : v ∈ V(C j)) + (hP_sub_le : P_sub ≤ P i) + (hP_sub : IsGraphPathWithEnds N.G P_sub v v') + (hEC : Disjoint E(P_sub) E(C j)) + (he₁_sub : e₁ ∈ E(P_sub)) (hl₁ : N.G.IsLink e₁ v w₁) + (hQ_kC : Q_k ≤ C j) (hQ_k : IsGraphPathWithEnds N.G Q_k v v') + (hno_escape : ∀ R_set : Set EuclideanPlane, IsPreconnected R_set → + R_set ⊆ D j \ graphDrawingSubgraphU P_pres.Γ P_sub → + (R_set ∩ graphDrawingSubgraphU P_pres.Γ Q_k).Nonempty → + Disjoint R_set P_pres.Δ₀) : + ∃ P' : Fin X.ncard → Graph α β, + ((∀ k, IsFromToPath N.G (P' k) X N.Ω₀.bar) ∧ + Pairwise (fun k₁ k₂ => Disjoint V(P' k₁) V(P' k₂))) ∧ + totalUnionEdges C P' < totalUnionEdges C P := by + classical + have hQ_disj_other : ∀ i' : Fin X.ncard, i' ≠ i → Disjoint V(Q_k) V(P i') := by + intro i' hi' + refine disjoint_left.mpr fun u huQ huPi' => ?_ + obtain ⟨x', y', hPi'_ft, _, hy'_eq⟩ := hP_path i' + have hy' : y' ∈ N.Ω₀.bar := by + have : y' ∈ V(P i') ∩ N.Ω₀.bar := by rw [hy'_eq]; exact mem_singleton y' + exact this.2 + obtain ⟨R, hR_le, hR, hR_Dj⟩ := + prop2_inner_subpath P_pres (hC_circ j) (hD_disc j).1 (hD_disc j).2 (hD_bounds j).1 + hPi'_ft hy' hdetour_in (hQ_kC.vertexSet_mono huQ) huPi' + have hdisj_RP : Disjoint V(R) V(P_sub) := + disjoint_of_subset hR_le.vertexSet_mono hP_sub_le.vertexSet_mono (hP_disj hi') + have hdisj_U : Disjoint (graphDrawingSubgraphU P_pres.Γ R) + (graphDrawingSubgraphU P_pres.Γ P_sub) := + disjoint_subgraphU_of_disjoint_vertexSet P_pres.Γ hR.le hP_sub.le hdisj_RP + have hR_sdiff : graphDrawingSubgraphU P_pres.Γ R ⊆ D j \ graphDrawingSubgraphU P_pres.Γ P_sub := + subset_sdiff.mpr ⟨hR_Dj, hdisj_U⟩ + have huG : u ∈ V(N.G) := hR.le.vertexSet_mono hR.left_mem + let pu := (P_pres.Γ.iso.vertexEquiv ⟨u, huG⟩).1 + have hpu_R : pu ∈ graphDrawingSubgraphU P_pres.Γ R := + graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hR.left_mem ⟨huG, rfl⟩ + have hpu_Q : pu ∈ graphDrawingSubgraphU P_pres.Γ Q_k := + graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ huQ ⟨huG, rfl⟩ + have hdisj_Δ₀ := hno_escape (graphDrawingSubgraphU P_pres.Γ R) + (isPreconnected_graphDrawingSubgraphU P_pres.Γ hR) hR_sdiff ⟨pu, hpu_R, hpu_Q⟩ + obtain ⟨_, hpy'_Δ₀⟩ := isClosedDisc_Δ₀_and_mem_of_mem_bar₀ P_pres hy' + have hy'G : y' ∈ V(N.G) := N.bar₀_subset hy' + have hpy'_R : (P_pres.Γ.iso.vertexEquiv ⟨y', hy'G⟩).1 ∈ graphDrawingSubgraphU P_pres.Γ R := + graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hR.right_mem ⟨hy'G, rfl⟩ + exact disjoint_left.mp hdisj_Δ₀ hpy'_R hpy'_Δ₀ + obtain ⟨x_i, y_i, hPi_ft, hx_i_eq, hy_i_eq⟩ := hP_path i + have hx_i : x_i ∈ X := by + have : x_i ∈ V(P i) ∩ X := by rw [hx_i_eq]; exact mem_singleton x_i + exact this.2 + have hy_i : y_i ∈ N.Ω₀.bar := by + have : y_i ∈ V(P i) ∩ N.Ω₀.bar := by rw [hy_i_eq]; exact mem_singleton y_i + exact this.2 + have hex_raw : ∃ P_raw : Graph α β, + IsGraphPathWithEnds N.G P_raw x_i y_i ∧ + V(P_raw) ⊆ V(P i) ∪ V(Q_k) ∧ + E(P_raw) ⊆ (E(P i) \ E(P_sub)) ∪ E(Q_k) := by + rcases exists_decomp_of_isGraphPathWithEnds_le hPi_ft hP_sub hP_sub_le with + ⟨P₁, P₂, hP₁P, hP₂P, hP₁, hP₂, _, hE₁, hE₂⟩ | + ⟨P₁, P₂, hP₁P, hP₂P, hP₁, hP₂, _, hE₁, hE₂⟩ + · exact reroute_path_along_arc ⟨P₁, P₂, hP₁P, hP₂P, hP₁, hP₂, hE₁, hE₂⟩ hQ_k + · exact reroute_path_along_arc ⟨P₁, P₂, hP₁P, hP₂P, hP₁, hP₂, hE₁, hE₂⟩ + hQ_k.symm + obtain ⟨P_raw, hP_raw, hP_raw_V, hP_raw_E⟩ := hex_raw + obtain ⟨x_new, _, y_new, _, P'_i, hP'_i_le, hP'_i_ft⟩ := + hP_raw.exists_isFromToPathWithEnds hx_i hy_i + have hP'_V : V(P'_i) ⊆ V(P i) ∪ V(Q_k) := hP'_i_le.vertexSet_mono.trans hP_raw_V + have hP'_E : E(P'_i) ⊆ (E(P i) \ E(P_sub)) ∪ E(Q_k) := hP'_i_le.edgeSet_mono.trans hP_raw_E + have hCG : ∀ m, C m ≤ N.G := fun m => (hC_circ m).1 + have hPG : ∀ k, P k ≤ N.G := fun k => by + obtain ⟨_, _, hft⟩ := hP_path k + exact hft.1.le + have he₁_not_Cj : e₁ ∉ E(C j) := disjoint_left.mp hEC he₁_sub + have he₁_not_C : ∀ m : Fin s, e₁ ∉ E(C m) := + not_mem_edgeSet_of_endpoint_mem_disjoint_family hCG hC_disj hl₁ hvC he₁_not_Cj + obtain ⟨hP'_disj, hlt⟩ := totalUnionEdges_lt_of_reroute_path N.finite_E hCG hPG hP_disj + hP_sub_le hQ_kC hP'_V hP'_E hQ_disj_other he₁_sub he₁_not_C + refine ⟨Function.update P i P'_i, ⟨?_, hP'_disj⟩, hlt⟩ + intro k + by_cases hki : k = i + · subst hki + rw [Function.update_self] + exact ⟨x_new, y_new, hP'_i_ft⟩ + · rw [Function.update_of_ne hki] + exact hP_path k + +private theorem theorem_10_1_step {N : Neighborhood α β} (P_pres : Presentation N) {s : ℕ} + {X : Set α} (hX_sub : X ⊆ N.Ω.bar) + (C : Fin s → Graph α β) (P : Fin X.ncard → Graph α β) + (hC_nest : N.IsNest P_pres C) + (hP_valid : (∀ i, IsFromToPath N.G (P i) X N.Ω₀.bar) ∧ + Pairwise (fun i₁ i₂ => Disjoint V(P i₁) V(P i₂))) + (j : Fin s) (i : Fin X.ncard) + (hafter : ∀ (j' : Fin s), j < j' → ∀ i' : Fin X.ncard, + IsGraphPath N.G (subgraphInter N.G (P i') (C j'))) + (hnot_path : ¬ IsGraphPath N.G (subgraphInter N.G (P i) (C j))) : + ∃ (C' : Fin s → Graph α β) (P' : Fin X.ncard → Graph α β), + N.IsNest P_pres C' ∧ + ((∀ i, IsFromToPath N.G (P' i) X N.Ω₀.bar) ∧ + Pairwise (fun i₁ i₂ => Disjoint V(P' i₁) V(P' i₂))) ∧ + totalUnionEdges C' P' < totalUnionEdges C P := by + obtain ⟨hC_circ, hC_disj, D, hD_disc, hD_bounds, hD_mono⟩ := hC_nest + obtain ⟨hP_path, hP_disj⟩ := hP_valid + by_cases h_outer : ∃ (i' : Fin X.ncard) (v v' : α) (P_sub : Graph α β) + (hP_sub : IsGraphPathWithEnds N.G P_sub v v'), + P_sub ≤ P i' ∧ v ≠ v' ∧ V(P_sub) ∩ V(C j) = {v, v'} ∧ Disjoint E(P_sub) E(C j) ∧ + graphDrawingSubgraphU P_pres.Γ P_sub ∩ D j = + {(P_pres.Γ.iso.vertexEquiv ⟨v, hP_sub.le.vertexSet_mono hP_sub.left_mem⟩).1, + (P_pres.Γ.iso.vertexEquiv ⟨v', hP_sub.le.vertexSet_mono hP_sub.right_mem⟩).1} + · obtain ⟨i', v, v', P_sub, hP_sub, hP_sub_le, hvv', hVC, hEC, houter⟩ := h_outer + obtain ⟨C', hC'_nest, hlt⟩ := + move2_outer_detour P_pres hX_sub hC_circ hC_disj hD_disc hD_bounds hD_mono hP_path hP_disj + hafter hP_sub_le hP_sub hvv' hVC hEC houter + exact ⟨C', P, hC'_nest, ⟨hP_path, hP_disj⟩, hlt⟩ + · have hdetour_in : ∀ {k : Fin X.ncard} {u u' : α} {P_sub : Graph α β}, + P_sub ≤ P k → IsGraphPathWithEnds N.G P_sub u u' → u ≠ u' → + V(P_sub) ∩ V(C j) = {u, u'} → Disjoint E(P_sub) E(C j) → + graphDrawingSubgraphU P_pres.Γ P_sub ⊆ D j := by + intro k u u' P_sub hP_sub_le hP_sub huu' hVC hEC + obtain ⟨_, _, _, h_or⟩ := + detour_dichotomy P_pres.Γ (hC_circ j).1 (hD_disc j).1 (hD_disc j).2 hP_sub huu' hVC hEC + rcases h_or with houter | hinner + · exact (h_outer ⟨k, u, u', P_sub, hP_sub, hP_sub_le, huu', hVC, hEC, houter⟩).elim + · exact hinner + obtain ⟨x_i, y_i, hPi_ft, hx_i_eq, hy_i_eq⟩ := hP_path i + have hx_i : x_i ∈ X := by + have : x_i ∈ V(P i) ∩ X := by rw [hx_i_eq]; exact mem_singleton x_i + exact this.2 + have hy_i : y_i ∈ N.Ω₀.bar := by + have : y_i ∈ V(P i) ∩ N.Ω₀.bar := by rw [hy_i_eq]; exact mem_singleton y_i + exact this.2 + obtain ⟨hΔ₀_disc, hpy_i_Δ₀⟩ := isClosedDisc_Δ₀_and_mem_of_mem_bar₀ P_pres hy_i + have hpy_i_Dj : + (P_pres.Γ.iso.vertexEquiv ⟨y_i, hPi_ft.le.vertexSet_mono hPi_ft.right_mem⟩).1 ∈ D j := + (hD_bounds j).1 hpy_i_Δ₀ + have hne_inter : (V(C j) ∩ V(P i)).Nonempty := by + rw [inter_comm] + exact nonempty_inter_of_path_from_bar_to_disc P_pres (hC_circ j).1 (hD_disc j).1 + (hD_bounds j).2 (hD_disc j).2 hPi_ft (hX_sub hx_i) hpy_i_Dj + rcases isGraphPath_inter_or_exists_detour (hC_circ j).1 hPi_ft hne_inter with + hpath | ⟨v, ⟨hvC, _⟩, v', ⟨hv'C, _⟩, hvv', P_sub, hP_sub_le, hP_sub, hVC, hEC, + e₁, he₁_sub, w₁, hl₁⟩ + · exfalso + rw [subgraphInter_comm (hC_circ j).1 hPi_ft.le] at hpath + exact hnot_path hpath + · obtain ⟨hline_P, hst_ne, hbd_inter, _⟩ := + detour_dichotomy P_pres.Γ (hC_circ j).1 (hD_disc j).1 (hD_disc j).2 hP_sub hvv' hVC hEC + have hP_sub_Dj : graphDrawingSubgraphU P_pres.Γ P_sub ⊆ D j := + hdetour_in hP_sub_le hP_sub hvv' hVC hEC + obtain ⟨Q₁, Q₂, hQ₁C, hQ₂C, hQ₁, hQ₂, _, _, _, hline₁, hline₂, hQ_inter_U, hQ_union_U⟩ := + circuit_two_arcs_drawing P_pres.Γ (hC_circ j) (hD_disc j).1 (hD_disc j).2 hvC hv'C hvv' + have hΔ₀_disj_L : Disjoint (discInt P_pres.Δ₀) (graphDrawingSubgraphU P_pres.Γ P_sub) := by + rw [← Surface.interior_eq_discInt_euclideanPlane hΔ₀_disc, disjoint_left] + intro x hx_int hxP + exact ((P_pres.U_subset (graphDrawingSubgraphU_subset_U P_pres.Γ P_sub hxP)).2 hx_int).elim + rcases inner_chord_separates_from_core (hD_disc j).1 hΔ₀_disc (hD_bounds j).1 + hline₁ hline₂ hline_P hst_ne hQ_inter_U hQ_union_U hP_sub_Dj hbd_inter hΔ₀_disj_L with + hno₁ | hno₂ + · obtain ⟨P', hP'_valid, hlt⟩ := + move3_reroute_with_arc P_pres hC_circ hC_disj hD_disc hD_bounds hP_path hP_disj + hdetour_in hvC hP_sub_le hP_sub hEC he₁_sub hl₁ hQ₁C hQ₁ hno₁ + exact ⟨C, P', ⟨hC_circ, hC_disj, D, hD_disc, hD_bounds, hD_mono⟩, hP'_valid, hlt⟩ + · obtain ⟨P', hP'_valid, hlt⟩ := + move3_reroute_with_arc P_pres hC_circ hC_disj hD_disc hD_bounds hP_path hP_disj + hdetour_in hvC hP_sub_le hP_sub hEC he₁_sub hl₁ hQ₂C hQ₂ hno₂ + exact ⟨C, P', ⟨hC_circ, hC_disj, D, hD_disc, hD_bounds, hD_mono⟩, hP'_valid, hlt⟩ + +/-! ## 6. Master Uncrossing Theorem (GM03 (4.1) / GM09 (10.1) / GM14 (9.5)) -/ + +/-- **Master Uncrossing Theorem (Proof of Graph Minors III, Theorem (4.1), pages 60–61)**: +Given any notion `IsValidNest C` of an `s`-nest of circuits in `G` and `IsValidPaths C P` of `r` +vertex-disjoint paths in `G` such that: +- there exists at least one valid pair `(C₀, P₀)`, and +- whenever `(C, P)` is a valid pair for which `subgraphInter G (P i) (C j)` is not a path in `G` for + some `i, j`, selecting the smallest index `j` where `subgraphInter G (P i) (C j)` fails to be a + path for some `i` allows either Move 1 (boundary shortening), Move 2 (outer detour replacement of + `C_j`), or Move 3 (inner detour rerouting of `P_i` using Property `(2)`), producing a valid pair + `(C', P')` with strictly fewer edges in the union `totalUnionEdges C' P' < totalUnionEdges C P`, +there exists a valid pair `(C, P)` such that `subgraphInter G (P i) (C j)` is a path in `G` for all +`i : Fin r` and `j : Fin s`. -/ +theorem nest_uncrossing {s r : ℕ} (G : Graph α β) + (IsValidNest : (Fin s → Graph α β) → Prop) + (IsValidPaths : (Fin s → Graph α β) → (Fin r → Graph α β) → Prop) + (hex : ∃ C₀ P₀, IsValidNest C₀ ∧ IsValidPaths C₀ P₀) + (hstep : ∀ C P, IsValidNest C → IsValidPaths C P → + (∀ (j : Fin s) (i : Fin r), + (∀ (j' : Fin s), j' < j → ∀ i' : Fin r, IsGraphPath G (subgraphInter G (P i') (C j'))) → + ¬ IsGraphPath G (subgraphInter G (P i) (C j)) → + ∃ C' P', IsValidNest C' ∧ IsValidPaths C' P' ∧ + totalUnionEdges C' P' < totalUnionEdges C P)) : + ∃ C P, IsValidNest C ∧ IsValidPaths C P ∧ + ∀ (i : Fin r) (j : Fin s), IsGraphPath G (subgraphInter G (P i) (C j)) := by + classical + obtain ⟨C, P, ⟨hC, hP⟩, hmin⟩ := + exists_min_totalUnionEdges (fun C P => IsValidNest C ∧ IsValidPaths C P) hex + refine ⟨C, P, hC, hP, ?_⟩ + by_contra hnot_all + push Not at hnot_all + have hex_j : ∃ n : ℕ, ∃ (hn : n < s) (i : Fin r), + ¬ IsGraphPath G (subgraphInter G (P i) (C ⟨n, hn⟩)) := by + obtain ⟨i, j, hij⟩ := hnot_all + exact ⟨j.1, j.2, i, hij⟩ + let n₀ := Nat.find hex_j + obtain ⟨hn₀, i₀, hi₀⟩ := Nat.find_spec hex_j + let j₀ : Fin s := ⟨n₀, hn₀⟩ + have hprev : ∀ (j' : Fin s), j' < j₀ → ∀ i' : Fin r, + IsGraphPath G (subgraphInter G (P i') (C j')) := by + intro j' hj' i' + by_contra hnot' + exact Nat.find_min hex_j hj' ⟨j'.2, i', hnot'⟩ + obtain ⟨C', P', hC', hP', hlt⟩ := hstep C P hC hP j₀ i₀ hprev hi₀ + exact Nat.lt_irrefl _ (lt_of_lt_of_le hlt (hmin C' P' ⟨hC', hP'⟩)) + +/-- Dual-index version of `nest_uncrossing` selecting the **largest** circuit index `j : Fin s` +where `subgraphInter G (P i) (C j)` fails to be a path (used when `C (s - 1)` is the outermost +circuit and `C 0` is the innermost circuit, as in `Neighborhood.IsNest`). -/ +theorem nest_uncrossing_of_gt {s r : ℕ} (G : Graph α β) + (IsValidNest : (Fin s → Graph α β) → Prop) + (IsValidPaths : (Fin s → Graph α β) → (Fin r → Graph α β) → Prop) + (hex : ∃ C₀ P₀, IsValidNest C₀ ∧ IsValidPaths C₀ P₀) + (hstep : ∀ C P, IsValidNest C → IsValidPaths C P → + (∀ (j : Fin s) (i : Fin r), + (∀ (j' : Fin s), j < j' → ∀ i' : Fin r, IsGraphPath G (subgraphInter G (P i') (C j'))) → + ¬ IsGraphPath G (subgraphInter G (P i) (C j)) → + ∃ C' P', IsValidNest C' ∧ IsValidPaths C' P' ∧ + totalUnionEdges C' P' < totalUnionEdges C P)) : + ∃ C P, IsValidNest C ∧ IsValidPaths C P ∧ + ∀ (i : Fin r) (j : Fin s), IsGraphPath G (subgraphInter G (P i) (C j)) := by + classical + obtain ⟨C, P, ⟨hC, hP⟩, hmin⟩ := + exists_min_totalUnionEdges (fun C P => IsValidNest C ∧ IsValidPaths C P) hex + refine ⟨C, P, hC, hP, ?_⟩ + by_contra hnot_all + push Not at hnot_all + have hex_k : ∃ k : ℕ, ∃ (hk : k < s) (i : Fin r), + ¬ IsGraphPath G (subgraphInter G (P i) (C ⟨s - 1 - k, by omega⟩)) := by + obtain ⟨i, j, hij⟩ := hnot_all + refine ⟨s - 1 - j.1, by omega, i, ?_⟩ + have hj_eq : (⟨s - 1 - (s - 1 - j.1), by omega⟩ : Fin s) = j := + Fin.ext (by dsimp; omega) + rwa [hj_eq] + let k₀ := Nat.find hex_k + obtain ⟨hk₀, i₀, hi₀⟩ := Nat.find_spec hex_k + let j₀ : Fin s := ⟨s - 1 - k₀, by omega⟩ + have hafter : ∀ (j' : Fin s), j₀ < j' → ∀ i' : Fin r, + IsGraphPath G (subgraphInter G (P i') (C j')) := by + intro j' hj' i' + by_contra hnot' + have hj'_lt : s - 1 - j'.1 < k₀ := by + change s - 1 - k₀ < j'.1 at hj' + omega + have hj'_eq : (⟨s - 1 - (s - 1 - j'.1), by omega⟩ : Fin s) = j' := + Fin.ext (by dsimp; omega) + exact Nat.find_min hex_k hj'_lt ⟨by omega, i', hj'_eq.symm ▸ hnot'⟩ + obtain ⟨C', P', hC', hP', hlt⟩ := hstep C P hC hP j₀ i₀ hafter hi₀ + exact Nat.lt_irrefl _ (lt_of_lt_of_le hlt (hmin C' P' ⟨hC', hP'⟩)) + +/-- **Graph Minors IX, (10.1)** (page 64): +"Let $(G, \Omega, \Omega_0)$ be a rural neighborhood and let $(\Sigma, \Gamma, \Delta, \Delta_0)$ be +a presentation with an $s$-nest. Let $X \subseteq \bar{\Omega}$ be weakly-linked, with $|X| = r$. +Then we may choose an $s$-nest $(C_1, \dots, C_s)$ and disjoint paths $P_1, \dots, P_r$ of $G$ each +with one end in $X$ and the other in $\bar{\Omega}_0$, such that for $1 \le i \le r$ and +$1 \le j \le s$, $P_i \cap C_j$ is a path." -/ +theorem theorem_10_1_proof {N : Neighborhood α β} (P_pres : Presentation N) {s : ℕ} + (h_nest : ∃ C₀ : Fin s → Graph α β, N.IsNest P_pres C₀) + {X : Set α} (hX : N.IsWeaklyLinked X) : + ∃ (C : Fin s → Graph α β) (P : Fin X.ncard → Graph α β), + N.IsNest P_pres C ∧ + (∀ i, IsFromToPath N.G (P i) X N.Ω₀.bar) ∧ + Pairwise (fun i₁ i₂ => Disjoint V(P i₁) V(P i₂)) ∧ + ∀ (i : Fin X.ncard) (j : Fin s), IsGraphPath N.G (subgraphInter N.G (P i) (C j)) := by + obtain ⟨C₀, hC₀⟩ := h_nest + obtain ⟨hX_sub, P₀, hP₀_path, hP₀_disj⟩ := hX + obtain ⟨C, P, hC, ⟨hP_path, hP_disj⟩, hinter⟩ := + nest_uncrossing_of_gt N.G (N.IsNest P_pres) + (fun _ P => (∀ i, IsFromToPath N.G (P i) X N.Ω₀.bar) ∧ + Pairwise (fun i₁ i₂ => Disjoint V(P i₁) V(P i₂))) + ⟨C₀, P₀, hC₀, hP₀_path, hP₀_disj⟩ + (theorem_10_1_step P_pres hX_sub) + exact ⟨C, P, hC, hP_path, hP_disj, hinter⟩ + +export Neighborhood (IsNest HasBreadthGe IsWeaklyLinked IsLinked) + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Park.lean b/LeanPool/GraphMinor/GM09/Park.lean new file mode 100644 index 0000000000..d869bf0ee1 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Park.lean @@ -0,0 +1,808 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.CircleCut + +/-! +# The park of a clean presentation + +We build the park `(G*, Ω*, Ω₀)` of Graph Minors IX, page 68, and prove the two facts about it that +the proof of (11.4) uses. The first is the fence `(A, B)` of `Ω₀` and the set `Z` that the paper +states with the remark "it follows easily". The second is that a path of `G*` between the two +boundaries is drawn in one lawn. We also show that the part outside the wall is rural. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- A short path has a vertex joined to all the others by edges of the path: its middle vertex, or +one end if it has a single edge. The other vertices are in `ΩBar₀`. -/ +theorem IsShortPath.exists_rep {N : Neighborhood α β} {P : Graph α β} {a b : α} + (hS : IsShortPath N P a b) : + ∃ r ∈ V(P), ∀ v ∈ V(P), v ≠ r → v ∈ N.Ω₀.bar ∧ ∃ e ∈ E(P), N.G.IsLink e r v := by + rcases hS.cases with ⟨hV, e, hE, hl⟩ | ⟨m, -, -, -, hV, e₁, e₂, -, hE, hl₁, hl₂⟩ + · refine ⟨a, hS.path.left_mem, fun v hv hne => ?_⟩ + rw [hV] at hv + rcases hv with rfl | rfl + · exact (hne rfl).elim + · exact ⟨hS.right_mem, e, by rw [hE]; rfl, hl⟩ + · refine ⟨m, by rw [hV]; exact Or.inr (Or.inl rfl), fun v hv hne => ?_⟩ + rw [hV] at hv + rcases hv with rfl | rfl | rfl + · exact ⟨hS.left_mem, e₁, by rw [hE]; exact Or.inl rfl, hl₁⟩ + · exact (hne rfl).elim + · exact ⟨hS.right_mem, e₂, by rw [hE]; exact Or.inr rfl, hl₂⟩ + +/-- A compact connected set `K` outside the interior of `Δ₀`, joining a vertex `v` to a vertex `r` +of the wall. It meets the wall only in `r`, and the rest of it lies in a lawn with `r` as chosen +vertex. -/ +structure IsChord {N : Neighborhood α β} (P_pres : Presentation N) + (r : {L // IsLawn P_pres L} → α) (K : Set EuclideanPlane) (v r' : α) : Prop where + compact : IsCompact K + conn : IsConnected K + mem_v : vertexPt P_pres.Γ v ∈ K + mem_r : vertexPt P_pres.Γ r' ∈ K + avoid : K ⊆ (interior P_pres.Δ₀)ᶜ + wall_eq : ∀ y ∈ K, y ∈ wall P_pres → y = vertexPt P_pres.Γ r' + off : ∀ y ∈ K, y ∉ wall P_pres → ∃ i : {L // IsLawn P_pres L}, y ∈ i.1 ∧ r i = r' + +namespace IsCleanPresentation + +variable {N : Neighborhood α β} {P_pres : Presentation N} (C : IsCleanPresentation P_pres) +include C + +omit C in +theorem not_mem_wall_of_interior {x : EuclideanPlane} (hx : x ∈ interior (wallDisc P_pres)) : + x ∉ wall P_pres := fun h => + disjoint_left.mp (disjoint_interior_subBd (wallDisc P_pres)) hx h + +omit C in +theorem Δ₀_subset_wallDisc : P_pres.Δ₀ ⊆ wallDisc P_pres := subset_union_left + +omit C in +theorem interior_Δ₀_disjoint_wall {x : EuclideanPlane} (hx : x ∈ interior P_pres.Δ₀) : + x ∉ wall P_pres := + not_mem_wall_of_interior (interior_mono Δ₀_subset_wallDisc hx) + +omit C in +theorem vertexSet_subset_iff {v : α} (hv : v ∈ V(N.G)) {X : Set EuclideanPlane} : + graphDrawingVertexSet P_pres.Γ v ⊆ X ↔ vertexPt P_pres.Γ v ∈ X := by + rw [vertexSet_eq_vertexPt P_pres.Γ hv, singleton_subset_iff] + +/-- A vertex drawn in `bd(L)` is in the prominence, or it is in `ΩBar₀` and off the wall. -/ +theorem mem_bd_lawn_cases {Q : Graph α β} {L : Set EuclideanPlane} + (hL : IsProminenceWithDisc P_pres Q L) {v : α} (hv : v ∈ V(N.G)) + (hb : vertexPt P_pres.Γ v ∈ discBd L) : + v ∈ V(Q) ∨ (v ∈ N.Ω₀.bar ∧ vertexPt P_pres.Γ v ∉ wall P_pres) := by + obtain ⟨a, b, A, B, hS, E⟩ := C.exists_ear_of_prominence hL + by_cases hc : vertexPt P_pres.Γ v ∈ graphDrawingSubgraphU P_pres.Γ Q + · exact Or.inl (mem_vertexSet_of_vertexPt_mem P_pres.Γ hS.path.le hv hc) + right + rw [E.bdL] at hb + have hA : vertexPt P_pres.Γ v ∈ A := hb.resolve_right hc + obtain ⟨w, hw, hx⟩ := C.exists_bar_of_mem (vertexPt_mem_U P_pres.Γ hv) + (Surface.discBd_subset _ (E.A_subset hA)) + have hvw : v = w := vertexPt_injOn P_pres.Γ hv (N.bar₀_subset hw) hx + subst hvw + exact ⟨hw, fun h => hc ((C.prominence_U_subset_wall hL).2 ⟨E.A_subset_L hA, h⟩)⟩ + +/-- A vertex of `ΩBar₀` off the wall lies in a lawn. -/ +theorem exists_lawn_of_off_wall {v : α} (hv : v ∈ N.Ω₀.bar) + (hw : vertexPt P_pres.Γ v ∉ wall P_pres) : + ∃ L, IsLawn P_pres L ∧ vertexPt P_pres.Γ v ∈ L := by + obtain ⟨Q, a, b, A, B, F, hF⟩ := C.exists_earFamily + by_contra hn + push Not at hn + have hv₀ : vertexPt P_pres.Γ v ∈ P_pres.Δ₀ := + subBd_subset_of_isClosed C.disc₀.isCompact.isClosed (IsCleanPresentation.vertexPt_mem_subBd hv) + have hY : IsClosed (⋃ i ∈ (univ : Set {L // IsLawn P_pres L}), i.1) := + F.finite.isClosed_biUnion fun i hi => (F.ear i hi).disc.isCompact.isClosed + have hvY : vertexPt P_pres.Γ v ∉ ⋃ i ∈ (univ : Set {L // IsLawn P_pres L}), i.1 := by + intro h + obtain ⟨i, -, hi⟩ := mem_iUnion₂.mp h + exact hn i.1 i.2 hi + have hint : vertexPt P_pres.Γ v ∈ interior (wallDisc P_pres) := by + rw [interior_eq_discInt_plane C.isClosedDisc_wallDisc] + exact ⟨Δ₀_subset_wallDisc hv₀, fun h => hw (C.wall_eq ▸ h)⟩ + have hi₀ : vertexPt P_pres.Γ v ∈ interior P_pres.Δ₀ := by + refine mem_interior.mpr ⟨interior (wallDisc P_pres) ∩ (⋃ i ∈ (univ : Set {L // IsLawn P_pres + L}), i.1)ᶜ, + ?_, isOpen_interior.inter hY.isOpen_compl, hint, hvY⟩ + rintro y ⟨hy, hyn⟩ + have hy' := interior_subset hy + rw [wallDisc_eq] at hy' + exact hy'.resolve_right hyn + exact (P_pres.U_subset (vertexPt_mem_U P_pres.Γ (N.bar₀_subset hv))).2 hi₀ + +/-- A point off the wall lies in at most one lawn. -/ +theorem lawn_eq_of_off_wall {Q Q' : Graph α β} {L L' : Set EuclideanPlane} + (hL : IsProminenceWithDisc P_pres Q L) (hL' : IsProminenceWithDisc P_pres Q' L') + {x : EuclideanPlane} (hx : x ∈ L) (hx' : x ∈ L') (hw : x ∉ wall P_pres) : L = L' := by + by_contra hne + obtain ⟨v, ⟨hv, -⟩, hxv⟩ := C.lawn_inter_subset hL hL' hne ⟨hx, hx'⟩ + obtain ⟨a, b, A, B, hS, E⟩ := C.exists_ear_of_prominence hL + rw [hS.path.pathEnds_eq] at hv + have hvV : v ∈ V(Q) := by + rcases hv with rfl | rfl + · exact hS.path.left_mem + · exact hS.path.right_mem + exact hw ((C.prominence_U_subset_wall hL).1 + (graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hvV hxv)) + +/-- A wall vertex or a vertex of `ΩBar₀` off the wall has a chord. -/ +theorem exists_chord_of_lawn {r : {L // IsLawn P_pres L} → α} {Q : Graph α β} + {i : {L // IsLawn P_pres L}} (hL : IsProminenceWithDisc P_pres Q i.1) (hr : r i ∈ V(Q)) {v : α} + (hv : v ∈ N.Ω₀.bar) (hw : vertexPt P_pres.Γ v ∉ wall P_pres) + (hvi : vertexPt P_pres.Γ v ∈ i.1) : + ∃ K, IsChord P_pres r K v (r i) := by + obtain ⟨a, b, A, B, hS, E⟩ := C.exists_ear_of_prominence hL + have hv₀ : vertexPt P_pres.Γ v ∈ P_pres.Δ₀ := + subBd_subset_of_isClosed C.disc₀.isCompact.isClosed (IsCleanPresentation.vertexPt_mem_subBd hv) + have hvA : vertexPt P_pres.Γ v ∈ A := E.L_inter ▸ ⟨hvi, hv₀⟩ + have hvb : vertexPt P_pres.Γ v ∈ discBd i.1 := E.bdL ▸ Or.inl hvA + have hrU : vertexPt P_pres.Γ (r i) ∈ graphDrawingSubgraphU P_pres.Γ Q := + vertexPt_mem_subgraphU P_pres.Γ hr hS.path.le + have hrb : vertexPt P_pres.Γ (r i) ∈ discBd i.1 := E.bdL ▸ Or.inr hrU + have hne : vertexPt P_pres.Γ v ≠ vertexPt P_pres.Γ (r i) := fun h => + hw (h ▸ (C.prominence_U_subset_wall hL).1 hrU) + obtain ⟨F, hF, hFs, hFb⟩ := Surface.exists_chord E.disc hvb hrb hne + refine ⟨F, hF.isCompact, ?_, hF.left_mem, hF.right_mem, ?_, ?_, ?_⟩ + · exact ⟨⟨_, hF.left_mem⟩, hF.isPreconnected_diff.subset_closure sdiff_subset + hF.subset_closure_diff⟩ + · intro y hy hyi + have hyL := hFs hy + have hyΔ : y ∈ P_pres.Δ₀ := interior_subset hyi + have hyA : y ∈ A := E.L_inter ▸ ⟨hyL, hyΔ⟩ + rw [interior_eq_discInt_plane C.disc₀] at hyi + exact hyi.2 (E.A_subset hyA) + · intro y hy hyw + have hyc := (C.prominence_U_subset_wall hL).2 ⟨hFs hy, hyw⟩ + have hyb : y ∈ F ∩ discBd i.1 := ⟨hy, E.bdL ▸ Or.inr hyc⟩ + rw [hFb] at hyb + rcases hyb with h | h + · exact (hw (h ▸ hyw)).elim + · exact h + · intro y hy _ + exact ⟨i, hFs hy, rfl⟩ + +omit C in +/-- The chord of a wall vertex is just that vertex. -/ +theorem exists_chord_of_wall (r : {L // IsLawn P_pres L} → α) {v : α} + (_hv : v ∈ N.Ω₀.bar) (hw : vertexPt P_pres.Γ v ∈ wall P_pres) : + IsChord P_pres r {vertexPt P_pres.Γ v} v v := by + refine ⟨isCompact_singleton, isConnected_singleton, rfl, rfl, ?_, fun y hy _ => hy, ?_⟩ + · rintro y rfl hi + exact interior_Δ₀_disjoint_wall hi hw + · rintro y rfl hn + exact (hn hw).elim + +theorem chord_disjoint {r : {L // IsLawn P_pres L} → α} {K K' : Set EuclideanPlane} {v v' s s' : α} + (hF : ∀ i : {L // IsLawn P_pres L}, ∃ Q, IsProminenceWithDisc P_pres Q i.1) + (h : IsChord P_pres r K v s) (h' : IsChord P_pres r K' v' s') (hne : s ≠ s') + (hinj : vertexPt P_pres.Γ s ≠ vertexPt P_pres.Γ s') : Disjoint K K' := by + rw [disjoint_left] + intro y hy hy' + by_cases hw : y ∈ wall P_pres + · exact hinj ((h.wall_eq y hy hw).symm.trans (h'.wall_eq y hy' hw)) + · obtain ⟨i, hyi, hri⟩ := h.off y hy hw + obtain ⟨j, hyj, hrj⟩ := h'.off y hy' hw + obtain ⟨Q, hQ⟩ := hF i + obtain ⟨Q', hQ'⟩ := hF j + have hij : i = j := Subtype.ext (C.lawn_eq_of_off_wall hQ hQ' hyi hyj hw) + exact hne (hri.symm.trans ((congrArg r hij).trans hrj)) + +omit C in +private theorem ncard_union_le_two {A B : Set α} (hA : A.Subsingleton) (hB : B.Subsingleton) : + (A ∪ B).ncard ≤ 2 := by + let := hA.finite.to_subtype + let := hB.finite.to_subtype + have ha := Set.ncard_le_one_iff_subsingleton.mpr hA + have hb := Set.ncard_le_one_iff_subsingleton.mpr hB + have hu := Set.ncard_union_le A B + omega + +omit C in +private theorem edge_meets_wall_cut {X Y : Set EuclideanPlane} {p q : EuclideanPlane} + (cut : IsCircleCut (wall P_pres) X Y p q) {e : β} {r v : α} (hl : N.G.IsLink e r v) + (hsubw : closure (graphDrawingEdgeSet P_pres.Γ e) ⊆ wall P_pres) + (hlabel : (vertexPt P_pres.Γ r ∈ X ∧ vertexPt P_pres.Γ v ∈ Y) ∨ + (vertexPt P_pres.Γ r ∈ Y ∧ vertexPt P_pres.Γ v ∈ X)) + (hp : p ∉ P_pres.Γ.drawing.V) (hq : q ∉ P_pres.Γ.drawing.V) : + p ∈ graphDrawingEdgeSet P_pres.Γ e ∨ q ∈ graphDrawingEdgeSet P_pres.Γ e := by + have hrmem := graphDrawingVertexSet_subset_closure_edge P_pres.Γ hl + ((mem_vertexSet_iff P_pres.Γ hl.left_mem).mpr rfl) + have hvmem := graphDrawingVertexSet_subset_closure_edge P_pres.Γ hl.symm + ((mem_vertexSet_iff P_pres.Γ hl.right_mem).mpr rfl) + have hcon : IsPreconnected (closure (graphDrawingEdgeSet P_pres.Γ e)) := + (isPreconnected_edgeSet hl.edge_mem).closure + have hin : p ∈ closure (graphDrawingEdgeSet P_pres.Γ e) ∨ + q ∈ closure (graphDrawingEdgeSet P_pres.Γ e) := by + by_contra hn + push Not at hn + rcases hlabel with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact cut.sep _ hcon hsubw hn.1 hn.2 ⟨_, hrmem, h₁⟩ ⟨_, hvmem, h₂⟩ + · exact cut.sep _ hcon hsubw hn.1 hn.2 ⟨_, hvmem, h₂⟩ ⟨_, hrmem, h₁⟩ + have hmemE := graphDrawingEdgeSet_mem P_pres.Γ hl.edge_mem + rcases hin with h | h + · left + rw [← P_pres.Γ.drawing.closure_diff_V hmemE] + exact ⟨h, hp⟩ + · right + rw [← P_pres.Γ.drawing.closure_diff_V hmemE] + exact ⟨h, hq⟩ + +/-- The fence `(A, B)` of `Ω₀` and the set `Z` of Graph Minors IX, page 68, when both sides of the +fence of `Ω*` are nonempty. -/ +theorem exists_fence_and_Z_of_cut {Ωs : CyclicPerm α} {As Bs : Set α} + (hbar : ∀ v ∈ V(N.G), v ∈ Ωs.bar ↔ vertexPt P_pres.Γ v ∈ wall P_pres) + (hdisj : Disjoint As Bs) (hun : As ∪ Bs = Ωs.bar) + {X Y : Set EuclideanPlane} {p q : EuclideanPlane} (cut : IsCircleCut (wall P_pres) X Y p q) + (hX : ∀ a ∈ As, vertexPt P_pres.Γ a ∈ X) (hY : ∀ b ∈ Bs, vertexPt P_pres.Γ b ∈ Y) : + ∃ A B Z : Set α, N.Ω₀.IsFence A B ∧ Z ⊆ N.Ω₀.bar ∧ Z.ncard ≤ 2 ∧ + As ∩ N.Ω₀.bar ⊆ A ∧ Bs ∩ N.Ω₀.bar ⊆ B ∧ + ∀ L, IsLawn P_pres L → + {v ∈ V(N.G) | graphDrawingVertexSet P_pres.Γ v ⊆ subBd L} ⊆ A ∪ As ∪ Z ∨ + {v ∈ V(N.G) | graphDrawingVertexSet P_pres.Γ v ⊆ subBd L} ⊆ B ∪ Bs ∪ Z := by + classical + obtain ⟨Q, a, b, Af, Bf, F, hF⟩ := C.exists_earFamily + have hrep := fun i => (hF i).2.exists_rep + choose r hr₁ hr₂ using hrep + have hprom : ∀ i : {L // IsLawn P_pres L}, ∃ Q, IsProminenceWithDisc P_pres Q i.1 := + fun i => ⟨Q i, (hF i).1⟩ + have hUw : ∀ i, graphDrawingSubgraphU P_pres.Γ (Q i) ⊆ wall P_pres := fun i => + (C.prominence_U_subset_wall (hF i).1).1 + have hleG : ∀ i, Q i ≤ N.G := fun i => (hF i).2.path.le + have hVG : ∀ i, ∀ v ∈ V(Q i), v ∈ V(N.G) := fun i v hv => (hleG i).vertexSet_mono hv + have hwall : ∀ i, ∀ v ∈ V(Q i), vertexPt P_pres.Γ v ∈ wall P_pres := fun i v hv => + hUw i (vertexPt_mem_subgraphU P_pres.Γ hv (hleG i)) + have hsplit : ∀ v ∈ V(N.G), vertexPt P_pres.Γ v ∈ wall P_pres → v ∈ As ∨ v ∈ Bs := by + intro v hv hw + have : v ∈ As ∪ Bs := hun ▸ (hbar v hv).mpr hw + exact this + have hrs : ∀ i, r i ∈ As ∨ r i ∈ Bs := fun i => + hsplit _ (hVG i _ (hr₁ i)) (hwall i _ (hr₁ i)) + let inS : Set α → Set α := fun S => {v | v ∈ N.Ω₀.bar ∧ + ((vertexPt P_pres.Γ v ∈ wall P_pres ∧ v ∈ S) ∨ + (vertexPt P_pres.Γ v ∉ wall P_pres ∧ ∃ i, vertexPt P_pres.Γ v ∈ i.1 ∧ r i ∈ S))} + have hchord : ∀ S, ∀ v ∈ inS S, ∃ K s, IsChord P_pres r K v s ∧ s ∈ S := by + rintro S v ⟨hv, ⟨hw, hS⟩ | ⟨hw, i, hi, hS⟩⟩ + · exact ⟨_, v, exists_chord_of_wall r hv hw, hS⟩ + · obtain ⟨K, hK⟩ := C.exists_chord_of_lawn (hF i).1 (hr₁ i) hv hw hi + exact ⟨K, r i, hK, hS⟩ + have hABd : Disjoint (inS As) (inS Bs) := by + rw [disjoint_left] + rintro v ⟨hv, ⟨hw, hS⟩ | ⟨hw, i, hi, hS⟩⟩ ⟨-, ⟨hw', hS'⟩ | ⟨hw', i', hi', hS'⟩⟩ + · exact disjoint_left.mp hdisj hS hS' + · exact hw' hw + · exact hw hw' + · have : i = i' := Subtype.ext (C.lawn_eq_of_off_wall (hF i).1 (hF i').1 hi hi' hw) + subst this + exact disjoint_left.mp hdisj hS hS' + have hABu : inS As ∪ inS Bs = N.Ω₀.bar := by + apply Subset.antisymm + · rintro v (h | h) + · exact h.1 + · exact h.1 + · intro v hv + by_cases hw : vertexPt P_pres.Γ v ∈ wall P_pres + · rcases hsplit v (N.bar₀_subset hv) hw with h | h + · exact Or.inl ⟨hv, Or.inl ⟨hw, h⟩⟩ + · exact Or.inr ⟨hv, Or.inl ⟨hw, h⟩⟩ + · obtain ⟨L, hL, hvL⟩ := C.exists_lawn_of_off_wall hv hw + rcases hrs ⟨L, hL⟩ with h | h + · exact Or.inl ⟨hv, Or.inr ⟨hw, ⟨L, hL⟩, hvL, h⟩⟩ + · exact Or.inr ⟨hv, Or.inr ⟨hw, ⟨L, hL⟩, hvL, h⟩⟩ + have hsep : ∀ s t, s ∈ As → t ∈ Bs → s ≠ t ∧ vertexPt P_pres.Γ s ≠ vertexPt P_pres.Γ t := by + intro s t hs ht + refine ⟨fun h => disjoint_left.mp hdisj hs (h ▸ ht), fun h => ?_⟩ + exact disjoint_left.mp cut.disj (hX s hs) (h ▸ hY t ht) + have hag₀ : ∃ φ₀ : Circle ≃ₜ subBd P_pres.Δ₀, DrawingAgreesWithOArcHomeo P_pres.Γ N.Ω₀ + (subBd P_pres.Δ₀) φ₀ := by + rcases P_pres.agrees_Δ₀ with ⟨h, -⟩ | ⟨-, φ₀, _, h⟩ + · exfalso + obtain ⟨x, hx⟩ := C.disc₀.nonempty_discInt + rw [h] at hx + exact hx.1 + · exact ⟨φ₀, h⟩ + obtain ⟨φ₀, hφ₀⟩ := hag₀ + have hfence : N.Ω₀.IsFence (inS As) (inS Bs) := by + refine ⟨fun v h => h.1, fun v h => h.1, hABd, hABu, ?_⟩ + intro a₁ ha₁ a₂ ha₂ _ b₁ hb₁ b₂ hb₂ _ hcr + obtain ⟨K₁, s₁, hK₁, hs₁⟩ := hchord As a₁ ha₁ + obtain ⟨K₂, s₂, hK₂, hs₂⟩ := hchord As a₂ ha₂ + obtain ⟨K₃, s₃, hK₃, hs₃⟩ := hchord Bs b₁ hb₁ + obtain ⟨K₄, s₄, hK₄, hs₄⟩ := hchord Bs b₂ hb₂ + have hconn : ∀ {Z K W : Set EuclideanPlane} {s₁ s₂ : EuclideanPlane}, + IsConnected Z → IsConnected K → IsConnected W → s₁ ∈ Z → s₁ ∈ K → s₂ ∈ Z → s₂ ∈ W → + IsConnected (Z ∪ K ∪ W) := by + intro Z K W s₁ s₂ hZ hK hW h₁ h₂ h₃ h₄ + exact (hZ.union ⟨s₁, h₁, h₂⟩ hK).union ⟨s₂, Or.inl h₃, h₄⟩ hW + have hXav : X ⊆ (interior P_pres.Δ₀)ᶜ := fun y hy hi => + interior_Δ₀_disjoint_wall hi (cut.X_sub hy) + have hYav : Y ⊆ (interior P_pres.Δ₀)ᶜ := fun y hy hi => + interior_Δ₀_disjoint_wall hi (cut.Y_sub hy) + have hch : ∀ {K : Set EuclideanPlane} {v s : α} {Z' : Set EuclideanPlane}, + IsChord P_pres r K v s → Z' ⊆ wall P_pres → vertexPt P_pres.Γ s ∉ Z' → Disjoint K Z' := by + intro K v s Z' hK hZ' hs + rw [disjoint_left] + intro y hy hy' + exact hs (hK.wall_eq y hy (hZ' hy') ▸ hy') + obtain ⟨y, h₁, h₂⟩ := nonempty_inter_of_crosses_on_inner_bd C.disc₀ hφ₀ hcr + ((mem_vertexSet_iff P_pres.Γ (N.bar₀_subset ha₁.1)).mpr rfl) + ((mem_vertexSet_iff P_pres.Γ (N.bar₀_subset ha₂.1)).mpr rfl) + ((mem_vertexSet_iff P_pres.Γ (N.bar₀_subset hb₁.1)).mpr rfl) + ((mem_vertexSet_iff P_pres.Γ (N.bar₀_subset hb₂.1)).mpr rfl) + ((cut.compact_X.union hK₁.compact).union hK₂.compact) + ((cut.compact_Y.union hK₃.compact).union hK₄.compact) + (hconn cut.conn_X hK₁.conn hK₂.conn (hX _ hs₁) hK₁.mem_r (hX _ hs₂) hK₂.mem_r) + (hconn cut.conn_Y hK₃.conn hK₄.conn (hY _ hs₃) hK₃.mem_r (hY _ hs₄) hK₄.mem_r) + (union_subset (union_subset hXav hK₁.avoid) hK₂.avoid) + (union_subset (union_subset hYav hK₃.avoid) hK₄.avoid) + (Or.inl (Or.inr hK₁.mem_v)) (Or.inr hK₂.mem_v) + (Or.inl (Or.inr hK₃.mem_v)) (Or.inr hK₄.mem_v) + have hdXY := cut.disj + have hA_not : ∀ {K : Set EuclideanPlane} {v s : α}, IsChord P_pres r K v s → s ∈ As → + Disjoint K Y := fun hK hs => hch hK cut.Y_sub fun h => + disjoint_left.mp hdXY (hX _ hs) h + have hB_not : ∀ {K : Set EuclideanPlane} {v s : α}, IsChord P_pres r K v s → s ∈ Bs → + Disjoint K X := fun hK hs => hch hK cut.X_sub fun h => + disjoint_left.mp hdXY h (hY _ hs) + have hcc : ∀ {K K' : Set EuclideanPlane} {v v' s s' : α}, IsChord P_pres r K v s → + IsChord P_pres r K' v' s' → s ∈ As → s' ∈ Bs → Disjoint K K' := fun hK hK' hs hs' => + C.chord_disjoint hprom hK hK' (hsep _ _ hs hs').1 (hsep _ _ hs hs').2 + rcases h₁ with (h₁ | h₁) | h₁ <;> rcases h₂ with (h₂ | h₂) | h₂ + · exact disjoint_left.mp hdXY h₁ h₂ + · exact disjoint_left.mp (hB_not hK₃ hs₃) h₂ h₁ + · exact disjoint_left.mp (hB_not hK₄ hs₄) h₂ h₁ + · exact disjoint_left.mp (hA_not hK₁ hs₁) h₁ h₂ + · exact disjoint_left.mp (hcc hK₁ hK₃ hs₁ hs₃) h₁ h₂ + · exact disjoint_left.mp (hcc hK₁ hK₄ hs₁ hs₄) h₁ h₂ + · exact disjoint_left.mp (hA_not hK₂ hs₂) h₁ h₂ + · exact disjoint_left.mp (hcc hK₂ hK₃ hs₂ hs₃) h₁ h₂ + · exact disjoint_left.mp (hcc hK₂ hK₄ hs₂ hs₄) h₁ h₂ + -- The set `Z`: the ends of the wall edges through the two cut points. + let Zw : EuclideanPlane → Set α := fun w => {z | z ∈ N.Ω₀.bar ∧ ∃ e i, e ∈ E(Q i) ∧ + w ∈ graphDrawingEdgeSet P_pres.Γ e ∧ N.G.IsLink e (r i) z} + have hnotV : ∀ w ∈ wall P_pres, w ∉ X → w ∉ Y → w ∉ P_pres.Γ.drawing.V := by + intro w hw hwX hwY hV + obtain ⟨v, hv, rfl⟩ := exists_vertexPt_of_mem_V P_pres.Γ hV + rcases hsplit v hv hw with h | h + · exact hwX (hX v h) + · exact hwY (hY v h) + have hsub : ∀ w ∈ wall P_pres, w ∉ X → w ∉ Y → (Zw w).Subsingleton := by + rintro w hw hwX hwY z ⟨-, e, i, he, hwe, hl⟩ z' ⟨-, e', i', he', hwe', hl'⟩ + have hee : e = e' := eq_of_mem_edgeSet P_pres.Γ hl.edge_mem hl'.edge_mem hwe hwe' + subst hee + have hwi : w ∈ i.1 := by + obtain ⟨c₁, c₂, A', B', hS, E⟩ := C.exists_ear_of_prominence (hF i).1 + exact E.c_subset_L (graphDrawingEdgeSet_subset_subgraphU_of_mem P_pres.Γ he hwe) + have hwi' : w ∈ i'.1 := by + obtain ⟨c₁, c₂, A', B', hS, E⟩ := C.exists_ear_of_prominence (hF i').1 + exact E.c_subset_L (graphDrawingEdgeSet_subset_subgraphU_of_mem P_pres.Γ he' hwe') + have hii : i = i' := by + apply Subtype.ext + by_contra hne + obtain ⟨v, ⟨hv, -⟩, hxv⟩ := C.lawn_inter_subset (hF i).1 (hF i').1 hne ⟨hwi, hwi'⟩ + rw [(hF i).2.path.pathEnds_eq] at hv + have hvG : v ∈ V(N.G) := by + rcases hv with rfl | rfl + · exact N.bar₀_subset (hF i).2.left_mem + · exact N.bar₀_subset (hF i).2.right_mem + rw [mem_vertexSet_iff P_pres.Γ hvG] at hxv + exact hnotV w hw hwX hwY (hxv ▸ vertexPt_mem_V P_pres.Γ hvG) + subst hii + exact hl.right_unique hl' + have hZcard := ncard_union_le_two (hsub p cut.p_mem cut.p_X cut.p_Y) + (hsub q cut.q_mem cut.q_X cut.q_Y) + -- A vertex of the prominence with the other label is in `Z`. + have hodd : ∀ i, ∀ v ∈ V(Q i), v ≠ r i → + (((r i ∈ As ∧ v ∈ Bs) ∨ (r i ∈ Bs ∧ v ∈ As)) → v ∈ Zw p ∪ Zw q) := by + intro i v hv hne hlabel + obtain ⟨hvb, e, heQ, hl⟩ := hr₂ i v hv hne + have hsubw : closure (graphDrawingEdgeSet P_pres.Γ e) ⊆ wall P_pres := by + intro x hx + exact hUw i (Or.inr (mem_iUnion₂.mpr ⟨e, heQ, hx⟩)) + obtain h | h := edge_meets_wall_cut cut hl hsubw + (hlabel.imp (fun h => ⟨hX _ h.1, hY _ h.2⟩) fun h => ⟨hY _ h.1, hX _ h.2⟩) + (hnotV p cut.p_mem cut.p_X cut.p_Y) (hnotV q cut.q_mem cut.q_X cut.q_Y) + · exact Or.inl ⟨hvb, e, i, heQ, h, hl⟩ + · exact Or.inr ⟨hvb, e, i, heQ, h, hl⟩ + refine ⟨inS As, inS Bs, Zw p ∪ Zw q, hfence, ?_, hZcard, ?_, ?_, ?_⟩ + · rintro z (h | h) + · exact h.1 + · exact h.1 + · rintro v ⟨hv, hv₀⟩ + refine ⟨hv₀, Or.inl ⟨?_, hv⟩⟩ + exact cut.X_sub (hX v hv) + · rintro v ⟨hv, hv₀⟩ + refine ⟨hv₀, Or.inl ⟨?_, hv⟩⟩ + exact cut.Y_sub (hY v hv) + · intro L hL + let i : {L // IsLawn P_pres L} := ⟨L, hL⟩ + have hmem : ∀ {S T : Set α}, r i ∈ S → + (∀ v ∈ V(Q i), v ≠ r i → v ∈ T → v ∈ Zw p ∪ Zw q) → + (∀ v ∈ V(Q i), v ∈ S ∨ v ∈ T) → + {v ∈ V(N.G) | graphDrawingVertexSet P_pres.Γ v ⊆ subBd L} ⊆ inS S ∪ S ∪ (Zw p ∪ Zw q) := by + rintro S T hrS hT hST v ⟨hv, hsubv⟩ + have hd := (hF i).1.1.2.1 + have hb : vertexPt P_pres.Γ v ∈ discBd L := by + rw [← subBd_eq_discBd_plane hd] + exact (vertexSet_subset_iff hv).mp hsubv + rcases C.mem_bd_lawn_cases (hF i).1 hv hb with h | ⟨h₁, h₂⟩ + · rcases hST v h with h' | h' + · exact Or.inl (Or.inr h') + · by_cases hne : v = r i + · exact Or.inl (Or.inr (hne ▸ hrS)) + · exact Or.inr (hT v h hne h') + · exact Or.inl (Or.inl ⟨h₁, Or.inr ⟨h₂, i, Surface.discBd_subset _ hb, hrS⟩⟩) + have hVsplit : ∀ v ∈ V(Q i), v ∈ As ∨ v ∈ Bs := fun v hv => hsplit v (hVG i v hv) (hwall i v hv) + rcases hrs i with h | h + · left + exact hmem h (fun v hv hne hb => hodd i v hv hne (Or.inl ⟨h, hb⟩)) hVsplit + · right + exact hmem h (fun v hv hne ha => hodd i v hv hne (Or.inr ⟨h, ha⟩)) + (fun v hv => (hVsplit v hv).symm) + +/-- A vertex drawn in the boundary of a lawn is in `ΩBar₀` or on the wall. -/ +theorem bd_lawn_cases {L : Set EuclideanPlane} (hL : IsLawn P_pres L) {v : α} + (hv : v ∈ V(N.G)) (hb : graphDrawingVertexSet P_pres.Γ v ⊆ subBd L) : + v ∈ N.Ω₀.bar ∨ vertexPt P_pres.Γ v ∈ wall P_pres := by + obtain ⟨Q, hQ⟩ := hL + have hb' : vertexPt P_pres.Γ v ∈ discBd L := by + rw [← subBd_eq_discBd_plane hQ.1.2.1] + exact (vertexSet_subset_iff hv).mp hb + rcases C.mem_bd_lawn_cases hQ hv hb' with h | h + · right + obtain ⟨a, b, A, B, hS, E⟩ := C.exists_ear_of_prominence hQ + exact (C.prominence_U_subset_wall hQ).1 (vertexPt_mem_subgraphU P_pres.Γ h hS.path.le) + · exact Or.inl h.1 + +/-- The fence `(A, B)` of `Ω₀` and the set `Z` of Graph Minors IX, page 68. -/ +theorem exists_fence_and_Z {N_star : Neighborhood α β} (hpark : IsParkOf P_pres N_star) + (hcut : ∀ A B : Set α, N_star.Ω.IsFence A B → A.Nonempty → B.Nonempty → + ∃ X Y p q, IsCircleCut (wall P_pres) X Y p q ∧ (∀ a ∈ A, vertexPt P_pres.Γ a ∈ X) ∧ + (∀ b ∈ B, vertexPt P_pres.Γ b ∈ Y)) + ⦃As Bs : Set α⦄ (hF : N_star.Ω.IsFence As Bs) : + ∃ A B Z : Set α, N_star.Ω₀.IsFence A B ∧ Z ⊆ N_star.Ω₀.bar ∧ Z.ncard ≤ 2 ∧ + As ∩ N_star.Ω₀.bar ⊆ A ∧ Bs ∩ N_star.Ω₀.bar ⊆ B ∧ + ∀ L, IsLawn P_pres L → + {v ∈ V(N_star.G) | graphDrawingVertexSet P_pres.Γ v ⊆ subBd L} ⊆ A ∪ As ∪ Z ∨ + {v ∈ V(N_star.G) | graphDrawingVertexSet P_pres.Γ v ⊆ subBd L} ⊆ B ∪ Bs ∪ Z := by + rw [hpark.2.1] + have hVs : ∀ v ∈ V(N_star.G), v ∈ V(N.G) := fun v hv => hpark.2.2.2.2.1.vertexSet_mono hv + have hbar : ∀ v ∈ V(N.G), v ∈ N_star.Ω.bar ↔ vertexPt P_pres.Γ v ∈ wall P_pres := by + intro v hv + rw [hpark.2.2.2.2.2.1] + exact ⟨fun h => (vertexSet_subset_iff hv).mp h.2, fun h => ⟨hv, + (vertexSet_subset_iff hv).mpr h⟩⟩ + obtain ⟨-, -, hd, hun, -⟩ := id hF + have hsplit : ∀ v ∈ V(N.G), vertexPt P_pres.Γ v ∈ wall P_pres → v ∈ As ∨ v ∈ Bs := by + intro v hv hw + have : v ∈ As ∪ Bs := hun ▸ (hbar v hv).mpr hw + exact this + rcases As.eq_empty_or_nonempty with rfl | hA + · refine ⟨∅, N.Ω₀.bar, ∅, ⟨empty_subset _, Subset.rfl, Set.empty_disjoint _, empty_union _, + fun _ h => h.elim⟩, empty_subset _, by simp, by simp, inter_subset_right, fun L hL + => Or.inr ?_⟩ + rintro v ⟨hv, hb⟩ + rcases C.bd_lawn_cases hL (hVs v hv) hb with h | h + · exact Or.inl (Or.inl h) + · rcases hsplit v (hVs v hv) h with h' | h' + · exact h'.elim + · exact Or.inl (Or.inr h') + rcases Bs.eq_empty_or_nonempty with rfl | hB + · refine ⟨N.Ω₀.bar, ∅, ∅, ⟨Subset.rfl, empty_subset _, Set.disjoint_empty _, union_empty _, + fun _ _ _ _ _ _ h => h.elim⟩, empty_subset _, by simp, inter_subset_right, by simp, + fun L hL => Or.inl ?_⟩ + rintro v ⟨hv, hb⟩ + rcases C.bd_lawn_cases hL (hVs v hv) hb with h | h + · exact Or.inl (Or.inl h) + · rcases hsplit v (hVs v hv) h with h' | h' + · exact Or.inl (Or.inr h') + · exact h'.elim + obtain ⟨X, Y, p, q, cut, hX, hY⟩ := hcut As Bs hF hA hB + obtain ⟨A, B, Z, h₁, h₂, h₃, h₄, h₅, h₆⟩ := C.exists_fence_and_Z_of_cut hbar hd hun cut hX hY + refine ⟨A, B, Z, h₁, h₂, h₃, h₄, h₅, fun L hL => ?_⟩ + rcases h₆ L hL with h | h + · exact Or.inl (fun v hv => h ⟨hVs v hv.1, hv.2⟩) + · exact Or.inr (fun v hv => h ⟨hVs v hv.1, hv.2⟩) + +/-- A path of `G*` is drawn in the union of `Δ₀` with the lawns. -/ +theorem subgraphU_subset_wallDisc {N_star : Neighborhood α β} (hpark : IsParkOf P_pres N_star) + {P : Graph α β} (hP : P ≤ N_star.G) : + graphDrawingSubgraphU P_pres.Γ P ⊆ wallDisc P_pres := by + have hle : N_star.G ≤ N.G := hpark.2.2.2.2.1 + rintro x (hx | hx) + · obtain ⟨v, hv, hxv⟩ := mem_iUnion₂.mp hx + have hv' := hP.vertexSet_mono hv + rw [hpark.2.2.1] at hv' + exact hv'.2 hxv + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + have he' := hP.edgeSet_mono he + rw [hpark.2.2.2.1] at he' + exact closure_minimal he'.2 C.isClosedDisc_wallDisc.isCompact.isClosed hxe + +/-- A path of `G*` with distinct ends in `ΩBar₀ ∪ ΩBar*`, and no internal vertex there, is drawn in +one +lawn, so both of its ends are drawn in the boundary of that lawn. -/ +theorem exists_lawn_of_park_path {N_star : Neighborhood α β} (hpark : IsParkOf P_pres N_star) + ⦃P' : Graph α β⦄ ⦃x y : α⦄ (hP : IsGraphPathWithEnds N_star.G P' x y) (hxy : x ≠ y) + (hx : x ∈ N_star.Ω₀.bar ∪ N_star.Ω.bar) (hy : y ∈ N_star.Ω₀.bar ∪ N_star.Ω.bar) + (hd : Disjoint (V(P') \ {x, y}) (N_star.Ω₀.bar ∪ N_star.Ω.bar)) : + ∃ L, IsLawn P_pres L ∧ graphDrawingVertexSet P_pres.Γ x ⊆ subBd L ∧ + graphDrawingVertexSet P_pres.Γ y ⊆ subBd L := by + have hle : N_star.G ≤ N.G := hpark.2.2.2.2.1 + have hP' := hP.mono hle + have hbar : ∀ v ∈ V(N.G), v ∈ N_star.Ω.bar ↔ vertexPt P_pres.Γ v ∈ wall P_pres := by + intro v hv + rw [hpark.2.2.2.2.2.1] + exact ⟨fun h => (vertexSet_subset_iff hv).mp h.2, fun h => ⟨hv, + (vertexSet_subset_iff hv).mpr h⟩⟩ + have hΩ₀ := hpark.2.1 + obtain ⟨hl, hne⟩ := isLineWithEnds_graphDrawingSubgraphU P_pres.Γ hP' hxy + rw [vertexEquiv_eq_vertexPt, vertexEquiv_eq_vertexPt] at hl hne + have hxG : x ∈ V(N.G) := hP'.le.vertexSet_mono hP'.left_mem + have hyG : y ∈ V(N.G) := hP'.le.vertexSet_mono hP'.right_mem + have hconv : ∀ {L : Set EuclideanPlane} {v : α}, IsClosedDisc L → v ∈ V(N.G) → + vertexPt P_pres.Γ v ∈ discBd L → graphDrawingVertexSet P_pres.Γ v ⊆ subBd L := by + intro L v hL hv h + rw [vertexSet_subset_iff hv, subBd_eq_discBd_plane hL] + exact h + set T := graphDrawingSubgraphU P_pres.Γ P' \ {vertexPt P_pres.Γ x, vertexPt P_pres.Γ y} with hT + have hT₀ : ∀ t ∈ T, t ∉ P_pres.Δ₀ := by + intro t ht ht₀ + obtain ⟨v, hv, rfl⟩ := C.exists_bar_of_mem (subgraphU_subset_U P_pres.Γ hP'.le ht.1) ht₀ + have hvP := mem_vertexSet_of_vertexPt_mem P_pres.Γ hP'.le (N.bar₀_subset hv) ht.1 + refine disjoint_left.mp hd ⟨hvP, ?_⟩ (Or.inl (hΩ₀ ▸ hv)) + rintro (rfl | rfl) + · exact ht.2 (Or.inl rfl) + · exact ht.2 (Or.inr rfl) + by_cases hcase : ∃ t ∈ T, t ∈ wall P_pres + · obtain ⟨t, ht, htw⟩ := hcase + have hnt : ∀ v ∈ V(P'), vertexPt P_pres.Γ v ∈ wall P_pres → v = x ∨ v = y := by + intro v hv hw + by_contra hn + push Not at hn + exact disjoint_left.mp hd ⟨hv, by rintro (h | h); exacts [hn.1 h, hn.2 h]⟩ + (Or.inr ((hbar v (hP'.le.vertexSet_mono hv)).mpr hw)) + rcases mem_subgraphU_cases P_pres.Γ hP'.le ht.1 with ⟨v, hv, rfl⟩ | ⟨e, he, hte, htV⟩ + · rcases hnt v hv htw with rfl | rfl + · exact (ht.2 (Or.inl rfl)).elim + · exact (ht.2 (Or.inr rfl)).elim + rcases C.wall_subset htw with h | h + · exact (hT₀ t ht (subBd_subset_of_isClosed C.disc₀.isCompact.isClosed h)).elim + obtain ⟨Q, ⟨L, hL⟩, htQ⟩ := mem_iUnion₂.mp h + obtain ⟨a, b, A, B, hS, E⟩ := C.exists_ear_of_prominence hL + rcases mem_subgraphU_cases P_pres.Γ hS.path.le htQ with ⟨v, hv, rfl⟩ | ⟨f, hf, htf, -⟩ + · exact (htV (vertexPt_mem_V P_pres.Γ (hS.path.le.vertexSet_mono hv))).elim + have hef : e = f := eq_of_mem_edgeSet P_pres.Γ (hP'.le.edgeSet_mono he) + (hS.path.le.edgeSet_mono hf) hte htf + subst hef + obtain ⟨u, w, hlP⟩ := P'.exists_isLink_of_mem_edgeSet he + have hlG := hlP.mono hP'.le + have hlQ : Q.IsLink e u w := (hS.path.le.isLink_iff hf).mpr hlG + have huw : u ≠ w := by + rintro rfl + exact C.simple.1 e hlG.edge_mem u hlG + have hUw := (C.prominence_U_subset_wall hL).1 + have hu := hnt u hlP.left_mem (hUw (vertexPt_mem_subgraphU P_pres.Γ hlQ.left_mem hS.path.le)) + have hw := hnt w hlP.right_mem (hUw (vertexPt_mem_subgraphU P_pres.Γ hlQ.right_mem hS.path.le)) + have hbd : ∀ v ∈ V(Q), v ∈ V(N.G) → graphDrawingVertexSet P_pres.Γ v ⊆ subBd L := by + intro v hv hvG + refine hconv hL.1.2.1 hvG ?_ + exact E.bdL ▸ Or.inr (vertexPt_mem_subgraphU P_pres.Γ hv hS.path.le) + refine ⟨L, ⟨Q, hL⟩, ?_⟩ + rcases hu with rfl | rfl <;> rcases hw with rfl | rfl + · exact (huw rfl).elim + · exact ⟨hbd _ hlQ.left_mem hxG, hbd _ hlQ.right_mem hyG⟩ + · exact ⟨hbd _ hlQ.right_mem hxG, hbd _ hlQ.left_mem hyG⟩ + · exact (huw rfl).elim + · push Not at hcase + obtain ⟨t, ht⟩ : T.Nonempty := hl.nonempty_sdiff + have htW : t ∈ wallDisc P_pres := C.subgraphU_subset_wallDisc hpark hP.le ht.1 + have htL : ∃ L, IsLawn P_pres L ∧ t ∈ L := by + rcases htW with h | h + · exact (hT₀ t ht h).elim + · obtain ⟨L, hL, htL⟩ := mem_iUnion₂.mp h + exact ⟨L, hL, htL⟩ + obtain ⟨L, hL, htL⟩ := htL + obtain ⟨Q, hQ⟩ := id hL + obtain ⟨a, b, A, B, hS, E⟩ := C.exists_ear_of_prominence hQ + have hdT : Disjoint T (discBd L) := by + rw [disjoint_left, E.bdL] + rintro y' hy' (h | h) + · exact hT₀ y' hy' (Surface.discBd_subset _ (E.A_subset h)) + · exact hcase y' hy' ((C.prominence_U_subset_wall hQ).1 h) + have hsubL : T ⊆ L := by + rcases subset_interior_or_compl E.disc hl.isPreconnected_diff hdT with h | h + · exact h.trans interior_subset + · exact (h ht htL).elim + have hcl : graphDrawingSubgraphU P_pres.Γ P' ⊆ L := + hl.subset_closure_diff.trans (closure_minimal hsubL E.disc.isCompact.isClosed) + have hend : ∀ {v : α}, v ∈ V(P') → v ∈ N_star.Ω₀.bar ∪ N_star.Ω.bar → + graphDrawingVertexSet P_pres.Γ v ⊆ subBd L := by + intro v hv hb + have hvG := hP'.le.vertexSet_mono hv + have hvL := hcl (vertexPt_mem_subgraphU P_pres.Γ hv hP'.le) + refine hconv E.disc hvG ?_ + rcases hb with h | h + · have hv₀ : vertexPt P_pres.Γ v ∈ P_pres.Δ₀ := + subBd_subset_of_isClosed C.disc₀.isCompact.isClosed + (IsCleanPresentation.vertexPt_mem_subBd (hΩ₀ ▸ h)) + exact E.bdL ▸ Or.inl (E.L_inter ▸ ⟨hvL, hv₀⟩) + · exact E.bdL ▸ Or.inr ((C.prominence_U_subset_wall hQ).2 ⟨hvL, (hbar v hvG).mp h⟩) + exact ⟨L, hL, hend hP'.left_mem hx, hend hP'.right_mem hy⟩ + +/-- The park of a clean presentation exists. It is a regular park, and the neighborhood outside the +wall is rural. -/ +theorem exists_regular_park : + ∃ (N_star : Neighborhood α β) (hreg : IsRegularParkOf P_pres N_star), + (outerParkNeighborhood P_pres hreg.isParkOf).IsRural := by + classical + have hdW := C.isClosedDisc_wallDisc + obtain ⟨φ, hφ_cw⟩ := exists_isClockwiseDiscHomeo hdW + let Vs : Set α := {v ∈ V(N.G) | graphDrawingVertexSet P_pres.Γ v ⊆ wallDisc P_pres} + let Es : Set β := {e ∈ E(N.G) | graphDrawingEdgeSet P_pres.Γ e ⊆ wallDisc P_pres} + let K : Set α := {v ∈ V(N.G) | graphDrawingVertexSet P_pres.Γ v ⊆ wall P_pres} + have hwW : wall P_pres ⊆ wallDisc P_pres := + subBd_subset_of_isClosed hdW.isCompact.isClosed + have hKV : K ⊆ Vs := fun v hv => ⟨hv.1, hv.2.trans hwW⟩ + obtain ⟨Ωs, hbar, hag, hcut⟩ := exists_cyclicPerm_of_oArc P_pres.Γ φ (K := K) + (fun v hv => hv.1) (N.finite_V.subset fun v hv => hv.1) + (fun v hv => (vertexSet_subset_iff hv.1).mp hv.2) + let Gs : Graph α β := (N.G.induce Vs).restrict Es + have hle : Gs ≤ N.G := restrict_le.trans (N.G.induce_le fun _ hv => hv.1) + have hends : ∀ {e : β} {u w : α}, e ∈ Es → N.G.IsLink e u w → u ∈ Vs := by + intro e u w he hl + refine ⟨hl.left_mem, (graphDrawingVertexSet_subset_closure_edge P_pres.Γ hl).trans ?_⟩ + exact closure_minimal he.2 hdW.isCompact.isClosed + have hE : E(Gs) = Es := by + change E((N.G.induce Vs).restrict Es) = Es + rw [edgeSet_restrict, inter_eq_right] + intro e he + obtain ⟨u, w, hl⟩ := N.G.exists_isLink_of_mem_edgeSet he.1 + exact ⟨u, w, hl, hends he hl, hends he hl.symm⟩ + have hV₀ : N.Ω₀.bar ⊆ Vs := by + intro v hv + refine ⟨N.bar₀_subset hv, (vertexSet_subset_iff (N.bar₀_subset hv)).mpr ?_⟩ + exact Δ₀_subset_wallDisc (subBd_subset_of_isClosed C.disc₀.isCompact.isClosed + (IsCleanPresentation.vertexPt_mem_subBd hv)) + let N_star : Neighborhood α β := + { G := Gs + Ω := Ωs + Ω₀ := N.Ω₀ + finite_V := N.finite_V.subset hle.vertexSet_mono + finite_E := N.finite_E.subset hle.edgeSet_mono + bar_subset := hbar ▸ hKV + bar₀_subset := hV₀ } + have hpark : IsParkOf P_pres N_star := + ⟨C.simple, rfl, rfl, hE, hle, hbar, hdW, φ, hφ_cw, hag⟩ + have hreg : IsRegularParkOf P_pres N_star := + { isRegularPresentation := C.isRegularPresentation + isParkOf := hpark + exists_fence_and_Z := C.exists_fence_and_Z hpark hcut + exists_lawn_of_park_path := C.exists_lawn_of_park_path hpark } + refine ⟨N_star, hreg, ?_⟩ + have hint : ∀ x, x ∈ wall P_pres → x ∉ interior (wallDisc P_pres) := fun x hx hi => + not_mem_wall_of_interior hi hx + have hwΔ : wall P_pres ⊆ P_pres.Δ := hwW.trans (wallDisc_subset_Δ P_pres) + obtain ⟨P', -, -, -, -⟩ := Presentation.exists_of_le (N' := outerParkNeighborhood P_pres hpark) + P_pres (outerParkGraph_le P_pres) (Δ' := P_pres.Δ) (Δ₀' := wallDisc P_pres) + P_pres.isClosedDisc_Δ (wallDisc_subset_Δ P_pres) (by + intro x hx + change x ∈ graphDrawingSubgraphU P_pres.Γ (outerParkGraph P_pres) at hx + rcases mem_subgraphU_cases P_pres.Γ (outerParkGraph_le P_pres) hx with ⟨v, hv, rfl⟩ | ⟨e, he, + hxe, -⟩ + · have hvG := (outerParkGraph_le P_pres).vertexSet_mono hv + have h := (vertexSet_subset_iff hvG).mp (hv : v ∈ outerParkVerts P_pres).2 + rcases h with h | h + · exact ⟨hwΔ h, hint _ h⟩ + · exact ⟨h.1, fun hi => h.2 (interior_subset hi)⟩ + · have he' : e ∈ outerParkEdges P_pres := by + rw [← edgeSet_outerParkGraph] + exact he + rcases he'.2 with h | h + · exact ⟨hwΔ (h.2 hxe), hint _ (h.2 hxe)⟩ + · exact ⟨(h.2 hxe).1, fun hi => (h.2 hxe).2 (interior_subset hi)⟩) + (fun v hv => P_pres.mem_bd_Δ_iff v hv.1) + (fun v hv => by + change _ ↔ v ∈ Ωs.bar + rw [hbar] + exact ⟨fun h => ⟨hv.1, h⟩, fun h => h.2⟩) + P_pres.agrees_Δ (Or.inr ⟨hdW, φ, hφ_cw, hag⟩) + exact ⟨P'.Γ, P'.Δ, P'.Δ₀, P'.isClosedDisc_Δ, P'.Δ₀_subset_Δ, P'.U_subset, P'.mem_bd_Δ_iff, + P'.mem_bd_Δ₀_iff, P'.agrees_Δ, P'.agrees_Δ₀⟩ + +end IsCleanPresentation + +/-- If the two sides of a composition have no common vertex, every triangle lies on one side. -/ +theorem triangle_le_of_disjoint {G H₁ H₂ T : Graph α β} (hsep : IsGraphSeparation G H₁ H₂) + (hd : V(H₁) ∩ V(H₂) = ∅) (hT : IsTriangle G T) : T ≤ H₁ ∨ T ≤ H₂ := by + obtain ⟨v₁, v₂, v₃, e₁, e₂, e₃, -, -, -, -, -, -, hVT, hET, hl₁, hl₂, hl₃⟩ := + hT.exists_verts_and_edges + have hle : T ≤ G := hT.1.1 + have hl₁' := hl₁.mono hle + have hl₂' := hl₂.mono hle + have hl₃' := hl₃.mono hle + have hside : ∀ {e : β} {u w : α}, G.IsLink e u w → + (H₁.IsLink e u w ∨ H₂.IsLink e u w) := by + intro e u w hl + have he : e ∈ E(H₁) ∪ E(H₂) := hsep.2.2.2.1 ▸ hl.edge_mem + rcases he with h | h + · exact Or.inl ((hsep.1.isLink_iff h).mpr hl) + · exact Or.inr ((hsep.2.1.isLink_iff h).mpr hl) + have hno : ∀ {v : α}, v ∈ V(H₁) → v ∈ V(H₂) → False := fun h₁ h₂ => + Set.eq_empty_iff_forall_notMem.mp hd _ ⟨h₁, h₂⟩ + have hle_of : ∀ H : Graph α β, H ≤ G → H.IsLink e₁ v₂ v₃ → H.IsLink e₂ v₁ v₃ → + H.IsLink e₃ v₁ v₂ → T ≤ H := by + intro H hH h₁ h₂ h₃ + rw [(Compatible.of_le_le hle hH).le_iff] + constructor + · rw [hVT] + rintro v (rfl | rfl | rfl) + exacts [h₂.left_mem, h₁.left_mem, h₁.right_mem] + · rw [hET] + rintro e (rfl | rfl | rfl) + exacts [h₁.edge_mem, h₂.edge_mem, h₃.edge_mem] + rcases hside hl₁' with h₁ | h₁ <;> rcases hside hl₂' with h₂ | h₂ <;> + rcases hside hl₃' with h₃ | h₃ + · exact Or.inl (hle_of _ hsep.1 h₁ h₂ h₃) + · exact (hno h₂.left_mem h₃.left_mem).elim + · exact (hno h₁.right_mem h₂.right_mem).elim + · exact (hno h₁.left_mem h₃.right_mem).elim + · exact (hno h₂.right_mem h₁.right_mem).elim + · exact (hno h₂.right_mem h₁.right_mem).elim + · exact (hno h₃.left_mem h₂.left_mem).elim + · exact Or.inr (hle_of _ hsep.2.1 h₁ h₂ h₃) + +/-- **Graph Minors IX, (11.5)** (pages 69–70): +"Let $G$ be simple, and let $(G, \Omega)$ have sophistication $\le p$. Then there is a +society $(G_1, \Omega_1)$ and a rural neighborhood $(G_2, \Omega, \Omega_1)$ such that* (i) +$G_1, G_2 \subseteq G$, $G_1 \cup G_2 = G$ *and* $V(G_1 \cap G_2) = \bar{\Omega}_1$, (ii) +$(G_1, \Omega_1)$ *has no transaction of cardinality* $> p + 2$ (iii) *for every triangle +$T$ of $G$, either $T \subseteq G_1$ or $T \subseteq G_2$." -/ +theorem theorem_11_5_proof (S : Society α β) (hsimple : IsSimpleGraph S.G) {p : ℕ} + (hsoph : S.HasSophisticationLE p) : + ∃ (S₁ : Society α β) (N₂ : Neighborhood α β), + N₂.IsRural ∧ + N₂.Ω = S.Ω ∧ + N₂.Ω₀ = S₁.Ω ∧ + S₁.G ≤ S.G ∧ + N₂.G ≤ S.G ∧ + subgraphUnion S.G S₁.G N₂.G = S.G ∧ + V(subgraphInter S.G S₁.G N₂.G) = S₁.Ω.bar ∧ + (∀ Q_set : Set (Graph α β), S₁.IsTransaction Q_set → Q_set.ncard ≤ p + 2) ∧ + (∀ T : Graph α β, IsTriangle S.G T → T ≤ S₁.G ∨ T ≤ N₂.G) := by + obtain ⟨H₁, H₂, hcomp, hH₂_rural, hH₁_no⟩ := hsoph + have hsep := hcomp.1.1 + obtain ⟨P, -, -, hclean⟩ := hH₂_rural.exists_clean + rcases P.agrees_Δ₀ with ⟨-, hemp⟩ | ⟨hd, -⟩ + · have hbar : H₁.Ω.bar = ∅ := by rw [← hcomp.2.2.1]; exact hemp + have hV : V(H₁.G) ∩ V(H₂.G) = ∅ := by rw [← hcomp.2.2.2, hbar] + refine ⟨H₁, H₂, hH₂_rural, hcomp.2.1, hcomp.2.2.1, hsep.1, hsep.2.1, ?_, ?_, + fun Q hQ => (hH₁_no Q hQ).trans (Nat.le_add_right _ _), + fun T hT => triangle_le_of_disjoint hsep hV hT⟩ + · exact (Compatible.of_le_le (subgraphUnion_le hsep.1 hsep.2.1) le_rfl).ext + (by rw [vertexSet_subgraphUnion, hsep.2.2.1]) + (by rw [edgeSet_subgraphUnion hsep.1 hsep.2.1, hsep.2.2.2.1]) + · change V(H₁.G) ∩ V(H₂.G) = H₁.Ω.bar + rw [hV, hbar] + · have C : IsCleanPresentation P := ⟨hd, hclean, hsimple.mono hsep.2.1⟩ + obtain ⟨N_star, hreg, hrural⟩ := C.exists_regular_park + exact composition_of_regular_park S hsimple hcomp hH₁_no hreg hrural + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/PlanarNests.lean b/LeanPool/GraphMinor/GM09/PlanarNests.lean new file mode 100644 index 0000000000..af548ae771 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/PlanarNests.lean @@ -0,0 +1,2031 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.NestEdgeCount +public import LeanPool.GraphMinor.GM12.Section2DiscChordSplit +public import LeanPool.GraphMinor.GM14.Section6a + +/-! +# Planar Nests and Disjoint Paths Uncrossing (Graph Minors III, Theorem (4.1)) + +This file formalizes the nest-and-paths uncrossing argument from the proof of +**Graph Minors III, Theorem (4.1)** (pages 59–61), which is used both in +**Graph Minors IX, (10.1)** (page 64) and in **Graph Minors XIV, (9.5), Claim (3)** (page 46: +*"By [1, theorem (4.1)], or rather by the proof of that theorem, we deduce from (1) and (2) that +(3) There are circuits $C_1, \dots, C_{\beta+1}$ as in (1), and paths $P_1, \dots, P_\beta$ as in +(2), such that $C_i \cap P_j$ is a path for $1 \le i \le \beta + 1$ and $1 \le j \le \beta$."*). + +We work over drawings `H : Drawing S` in a closed surface `S` inside a closed disc `Δ_out`, proving: +1. Subdrawing intersection `Drawing.inf H A B` and its point-set identity + `(Drawing.inf H A B).U = A.U ∩ B.U`. +2. Detour decomposition (`path_inf_isPath_or_exists_detour`): for a path `P` in `H` meeting a + circuit `C` of `H`, either `Drawing.inf H C P` is a path of `H`, or the walk of `P` splits as + `W₁.append (W_sub.append W₂)` where `P_sub = walkDrawing H W_sub` is a detour path between + distinct vertices `v, v' ∈ C.V ∩ P.V` with `P_sub.V ∩ C.V = {v, v'}` and + `Disjoint P_sub.E C.E`. +3. Suffix inside-disc dichotomy (`walk_subset_disc_or_exists_outer_detour`): if no outer detour + on `C_j` occurs along `P_i`, then for every `v ∈ (C_j).V ∩ (P_i).V`, the suffix of `P_i` from + `v` to its inner endpoint lies inside `Δ_j`. +4. Outer detour circuit replacement (Move 2, using `isSlope_discIns` and `no_circuit_in_path`) and + inner detour path rerouting (Move 3, using `disc_split_with_boundary_arcs`). +5. Complete closed-disc nest-and-paths uncrossing theorem (`planar_nest_uncrossing`). +-/ + +@[expose] public section + +namespace GraphMinor.GM09.PlanarNests + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM12 +open GraphMinor.GM14 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-! ## 1. Intersection of Subdrawings `Drawing.inf` -/ + +/-- The intersection `Drawing.inf H A B` of two subdrawings `A, B` of `H`. -/ +noncomputable def Drawing.inf (H A B : Drawing S) : Drawing S := + H.span (A.V ∩ B.V) (A.E ∩ B.E) + +theorem Drawing.inf_isSubdrawing (H A B : Drawing S) : (Drawing.inf H A B).IsSubdrawing H := + H.span_isSubdrawing _ _ + +theorem Drawing.inf_V {H A B : Drawing S} (hA : A.IsSubdrawing H) (hB : B.IsSubdrawing H) : + (Drawing.inf H A B).V = A.V ∩ B.V := by + apply subset_antisymm + · rintro x (⟨hx, _⟩ | hx) + · exact hx + · obtain ⟨e, ⟨⟨heA, heB⟩, _⟩, hxe, hxV⟩ := mem_iUnion₂.mp hx + have hxA : x ∈ closure e ∩ A.V := by rw [hA.closure_inter_V heA]; exact ⟨hxe, hxV⟩ + have hxB : x ∈ closure e ∩ B.V := by rw [hB.closure_inter_V heB]; exact ⟨hxe, hxV⟩ + exact ⟨hxA.2, hxB.2⟩ + · intro x hx + exact Or.inl ⟨hx, hA.1 hx.1⟩ + +theorem Drawing.inf_E {H A B : Drawing S} (hA : A.IsSubdrawing H) : + (Drawing.inf H A B).E = A.E ∩ B.E := by + rw [Drawing.inf, H.span_E] + exact inter_eq_left.mpr (inter_subset_left.trans hA.2) + +theorem Drawing.inf_isSubdrawing_left {H A B : Drawing S} (hA : A.IsSubdrawing H) + (hB : B.IsSubdrawing H) : (Drawing.inf H A B).IsSubdrawing A := + ⟨by rw [Drawing.inf_V hA hB]; exact inter_subset_left, + by rw [Drawing.inf_E hA]; exact inter_subset_left⟩ + +theorem Drawing.inf_isSubdrawing_right {H A B : Drawing S} (hA : A.IsSubdrawing H) + (hB : B.IsSubdrawing H) : (Drawing.inf H A B).IsSubdrawing B := + ⟨by rw [Drawing.inf_V hA hB]; exact inter_subset_right, + by rw [Drawing.inf_E hA]; exact inter_subset_right⟩ + +theorem Drawing.inf_U {H A B : Drawing S} (hA : A.IsSubdrawing H) (hB : B.IsSubdrawing H) : + (Drawing.inf H A B).U = A.U ∩ B.U := by + apply subset_antisymm + · exact subset_inter (Drawing.inf_isSubdrawing_left hA hB).U_subset + (Drawing.inf_isSubdrawing_right hA hB).U_subset + · rintro x ⟨hxA, hxB⟩ + rw [Drawing.U_eq, Drawing.inf_V hA hB, Drawing.inf_E hA] + by_cases hxV : x ∈ H.V + · have hxAV : x ∈ A.V := by + by_contra hxAV + obtain ⟨e, heA, hxe⟩ := A.exists_edge_of_mem hxA hxAV + exact ((hA.2 heA).2.1 hxe).2 hxV + have hxBV : x ∈ B.V := by + by_contra hxBV + obtain ⟨e, heB, hxe⟩ := B.exists_edge_of_mem hxB hxBV + exact ((hB.2 heB).2.1 hxe).2 hxV + exact Or.inl ⟨hxAV, hxBV⟩ + · obtain ⟨e₁, he₁, hxe₁⟩ := A.exists_edge_of_mem hxA (fun h => hxV (hA.1 h)) + obtain ⟨e₂, he₂, hxe₂⟩ := B.exists_edge_of_mem hxB (fun h => hxV (hB.1 h)) + have heq : e₁ = e₂ := H.edge_eq_of_mem (hA.2 he₁) (hB.2 he₂) hxe₁ hxe₂ + exact Or.inr (mem_iUnion₂.mpr ⟨e₁, ⟨he₁, heq ▸ he₂⟩, subset_closure hxe₁⟩) + +theorem Drawing.inf_comm {H A B : Drawing S} (hA : A.IsSubdrawing H) (hB : B.IsSubdrawing H) : + Drawing.inf H A B = Drawing.inf H B A := by + apply Drawing.ext_of_V_E + · rw [Drawing.inf_V hA hB, Drawing.inf_V hB hA, inter_comm] + · rw [Drawing.inf_E hA, Drawing.inf_E hB, inter_comm] + +theorem Drawing.sup_U {H A B : Drawing S} (hA : A.IsSubdrawing H) (hB : B.IsSubdrawing H) : + (H.sup A B).U = A.U ∪ B.U := + Surface.Drawing.sup_U hA hB + +/-- A subdrawing `D` is a path if `D.IsPathBetween u v` for some `u, v`. -/ +def IsDrawingPath (D : Drawing S) : Prop := + ∃ u v : S, D.IsPathBetween u v + +omit [T2Space S] in +theorem Drawing.IsPathBetween.symm {D : Drawing S} {u v : S} (h : D.IsPathBetween u v) : + D.IsPathBetween v u := by + obtain ⟨W, hW, hV, hE⟩ := h + refine ⟨W.reverse, hW.reverse, ?_, ?_⟩ + · rw [hV]; ext x; simp [GraphWalk.support_reverse] + · rw [hE]; ext e; simp [GraphWalk.edges_reverse] + +theorem Drawing.IsPathBetween.isPreconnected_U {D : Drawing S} {u v : S} + (h : D.IsPathBetween u v) : IsPreconnected D.U := by + by_cases huv : u = v + · subst huv + obtain ⟨W, hW, hV, hE⟩ := h + have hlen : W.length = 0 := hW.length_eq_zero + have hedges : W.edges = [] := List.length_eq_zero_iff.mp hlen + have hsupp : W.support = [u] := by + cases W with + | nil _ => rfl + | cons _ _ => simp at hedges + have hDU : D.U = {u} := by + rw [D.U_eq, hV, hE, hsupp, hedges] + simp + rw [hDU] + exact isPreconnected_singleton + · obtain ⟨f, _, _⟩ := GM14.isLine_of_isPathBetween h huv + have hEq : D.U = (fun t : unitInterval => (f t).1) '' univ := by + ext x + exact ⟨fun hx => ⟨f.symm ⟨x, hx⟩, trivial, by simp⟩, fun ⟨t, _, ht⟩ => ht ▸ (f t).2⟩ + rw [hEq] + exact isPreconnected_univ.image _ (continuous_subtype_val.comp f.continuous).continuousOn + +theorem IsDrawingPath.isPreconnected_U {D : Drawing S} (h : IsDrawingPath D) : + IsPreconnected D.U := by + obtain ⟨u, v, huv⟩ := h + exact Drawing.IsPathBetween.isPreconnected_U huv + +/-! ## 2. Walk Splitting, Detour Decomposition, and Suffix Dichotomy -/ + +/-- Every walk `W` meeting a vertex set `X` splits at the first vertex `v ∈ X` into a prefix `W₁` +(meeting `X` only at its last vertex `v`) and a suffix `W₂` starting at `v`. -/ +theorem exists_first_hit_split {α β : Type*} {G : Graph α β} {a b : α} (W : GraphWalk G a b) + {X : Set α} (hne : ∃ x ∈ W.support, x ∈ X) : + ∃ v ∈ X, ∃ (W₁ : GraphWalk G a v) (W₂ : GraphWalk G v b), + W = W₁.append W₂ ∧ ∀ x ∈ W₁.support, x ∈ X → x = v := by + induction W with + | @nil a h => + obtain ⟨x, hx, hxX⟩ := hne + have hxa : x = a := List.mem_singleton.mp hx + exact ⟨a, hxa ▸ hxX, .nil h, .nil h, rfl, fun y hy _ => List.mem_singleton.mp hy⟩ + | @cons a w b e hl r ih => + by_cases haX : a ∈ X + · exact ⟨a, haX, .nil hl.left_mem, .cons hl r, rfl, fun y hy _ => List.mem_singleton.mp hy⟩ + · have hne_r : ∃ x ∈ r.support, x ∈ X := by + obtain ⟨x, hx, hxX⟩ := hne + rcases List.mem_cons.mp hx with rfl | hxr + · exact (haX hxX).elim + · exact ⟨x, hxr, hxX⟩ + obtain ⟨v, hvX, W₁, W₂, rfl, hfirst⟩ := ih hne_r + refine ⟨v, hvX, .cons hl W₁, W₂, rfl, fun x hx hxX => ?_⟩ + rcases List.mem_cons.mp hx with rfl | hx₁ + · exact (haX hxX).elim + · exact hfirst x hx₁ hxX + +/-- In a simple walk `W`, no edge in `W.edges` can be a loop `G.IsLink f z z`. -/ +theorem not_isLink_self_of_mem_edges_of_isSimple {α β : Type*} {G : Graph α β} {a b z : α} + {f : β} (W : GraphWalk G a b) (hW : W.IsSimple) (hf : f ∈ W.edges) (hl : G.IsLink f z z) : + False := by + induction W with + | nil _ => simp at hf + | @cons u v _ e₀ hl₀ r₀ ih => + rcases List.mem_cons.mp hf with rfl | hfr₀ + · have huz : u = z := by rcases hl₀.left_eq_or_eq hl with h | h <;> exact h + have hvz : v = z := by rcases hl₀.symm.left_eq_or_eq hl with h | h <;> exact h + have huv : u = v := huz.trans hvz.symm + exact (List.nodup_cons.mp hW).1 (huv ▸ r₀.start_mem_support) + · exact ih (List.nodup_cons.mp hW).2 hfr₀ + +/-- If a simple walk `W` in `H` starts at `v₀ ∈ C.V`, then either `Drawing.inf H C (walkDrawing H +W)` +is a path from `v₀` to some `u ∈ C.V`, or `W` decomposes as `W_pre.append (W_sub.append W_post)` +where `P_sub = walkDrawing H W_sub` is a detour path between distinct `v, v' ∈ C.V` with +`P_sub.V ∩ C.V = {v, v'}`, `Disjoint P_sub.E C.E`, and its first edge incident with `v`. -/ +theorem walk_inf_isPath_or_exists_detour {H C : Drawing S} (hC : C.IsSubdrawing H) + {v₀ b : S} (W : GraphWalk H.toGraph v₀ b) (hWs : W.IsSimple) (hv₀ : v₀ ∈ C.V) : + (∃ u ∈ C.V, (Drawing.inf H C (walkDrawing H W)).IsPathBetween v₀ u) ∨ + ∃ v ∈ C.V, ∃ v' ∈ C.V, v ≠ v' ∧ + ∃ (W_pre : GraphWalk H.toGraph v₀ v) (W_sub : GraphWalk H.toGraph v v') + (W_post : GraphWalk H.toGraph v' b), + W = W_pre.append (W_sub.append W_post) ∧ + (walkDrawing H W_sub).V ∩ C.V = {v, v'} ∧ + Disjoint (walkDrawing H W_sub).E C.E ∧ + ∃ e ∈ (walkDrawing H W_sub).E, ∃ w : S, H.toGraph.IsLink e v w := by + induction W with + | @nil a haH => + left + refine ⟨a, hv₀, ?_⟩ + have heq : Drawing.inf H C (walkDrawing H (GraphWalk.nil haH)) = + walkDrawing H (GraphWalk.nil haH) := by + apply Drawing.ext_of_V_E + · rw [Drawing.inf_V hC (walkDrawing_isSubdrawing H _), walkDrawing_V] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.support_nil, List.mem_singleton] + exact ⟨fun h => h.2, fun h => ⟨h ▸ hv₀, h⟩⟩ + · rw [Drawing.inf_E hC, walkDrawing_E] + simp + rw [heq] + exact walkDrawing_isPathBetween H (List.nodup_singleton a) + | @cons a w b e hl r ih => + have ha_not_r : a ∉ r.support := (List.nodup_cons.mp hWs).1 + have hr_s : r.IsSimple := (List.nodup_cons.mp hWs).2 + by_cases heC : e ∈ C.E + · have hlC : C.toGraph.IsLink e a w := (hC.isLink_iff heC).mpr hl + have hwC : w ∈ C.V := hlC.2.2.1 + rcases ih hr_s hwC with ⟨u, huC, hpath_r⟩ | + ⟨v, hvC, v', hv'C, hvv', W_pre, W_sub, W_post, hr_eq, hVC, hEC, hex_e⟩ + · left + refine ⟨u, huC, ?_⟩ + obtain ⟨W_r, hW_r_s, hV_r, hE_r⟩ := hpath_r + have hsub_r := Drawing.inf_isSubdrawing H C (walkDrawing H r) + obtain ⟨W_r_H, hs_r, he_r⟩ := hsub_r.exists_walk_up W_r + have ha_not_Wr : a ∉ W_r_H.support := by + intro ha_in + rw [hs_r] at ha_in + have ha_mem : a ∈ (Drawing.inf H C (walkDrawing H r)).V := by rw [hV_r]; exact ha_in + rw [Drawing.inf_V hC (walkDrawing_isSubdrawing H r), walkDrawing_V] at ha_mem + exact ha_not_r ha_mem.2 + have hW_r_H_s : W_r_H.IsSimple := by + change W_r_H.support.Nodup + rw [hs_r] + exact hW_r_s + have hW_cons_s : (GraphWalk.cons hl W_r_H).IsSimple := + List.nodup_cons.mpr ⟨ha_not_Wr, hW_r_H_s⟩ + have heq : Drawing.inf H C (walkDrawing H (GraphWalk.cons hl r)) = + walkDrawing H (GraphWalk.cons hl W_r_H) := by + apply Drawing.ext_of_V_E + · rw [Drawing.inf_V hC (walkDrawing_isSubdrawing H _), walkDrawing_V, walkDrawing_V] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.support_cons, List.mem_cons] + constructor + · rintro ⟨hxC, rfl | hxr⟩ + · exact Or.inl rfl + · right + rw [hs_r] + have hx_in : x ∈ (Drawing.inf H C (walkDrawing H r)).V := by + rw [Drawing.inf_V hC (walkDrawing_isSubdrawing H r), walkDrawing_V] + exact ⟨hxC, hxr⟩ + rwa [hV_r] at hx_in + · rintro (rfl | hxWr) + · exact ⟨hv₀, Or.inl rfl⟩ + · rw [hs_r] at hxWr + have hx_in : x ∈ (Drawing.inf H C (walkDrawing H r)).V := by rw [hV_r]; exact hxWr + rw [Drawing.inf_V hC (walkDrawing_isSubdrawing H r), walkDrawing_V] at hx_in + exact ⟨hx_in.1, Or.inr hx_in.2⟩ + · rw [Drawing.inf_E hC, walkDrawing_E, walkDrawing_E] + ext f + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.edges_cons, List.mem_cons] + constructor + · rintro ⟨hfC, rfl | hfr⟩ + · exact Or.inl rfl + · right + rw [he_r] + have hf_in : f ∈ (Drawing.inf H C (walkDrawing H r)).E := by + rw [Drawing.inf_E hC, walkDrawing_E] + exact ⟨hfC, hfr⟩ + rwa [hE_r] at hf_in + · rintro (rfl | hfWr) + · exact ⟨heC, Or.inl rfl⟩ + · rw [he_r] at hfWr + have hf_in : f ∈ (Drawing.inf H C (walkDrawing H r)).E := by rw [hE_r]; exact hfWr + rw [Drawing.inf_E hC, walkDrawing_E] at hf_in + exact ⟨hf_in.1, Or.inr hf_in.2⟩ + rw [heq] + exact walkDrawing_isPathBetween H hW_cons_s + · right + refine ⟨v, hvC, v', hv'C, hvv', .cons hl W_pre, W_sub, W_post, ?_, hVC, hEC, hex_e⟩ + rw [hr_eq]; rfl + · by_cases hhit : ∃ x ∈ r.support, x ∈ C.V + · right + obtain ⟨v', hv'C, r₁, r₂, hsplit_r, hr₁_first⟩ := exists_first_hit_split r hhit + have hr₁_s : r₁.IsSimple := (isSimple_of_append (hsplit_r ▸ hr_s)).1 + have ha_not_r₁ : a ∉ r₁.support := fun ha_in => + ha_not_r (hsplit_r ▸ (GraphWalk.mem_support_append r₁ r₂).mpr (Or.inl ha_in)) + have hav' : a ≠ v' := fun h => ha_not_r₁ (h ▸ r₁.end_mem_support) + let W_sub := GraphWalk.cons hl r₁ + have hr₁_no_edge : ∀ f ∈ r₁.edges, f ∉ C.E := by + intro f hf₁ hfC + obtain ⟨x, y, hxyH⟩ := (H.toGraph.edge_mem_iff_exists_isLink f).mp (hC.2 hfC) + have hxyC : C.toGraph.IsLink f x y := (hC.isLink_iff hfC).mpr hxyH + have hx_s : x ∈ r₁.support := r₁.left_mem_support_of_mem_edges hf₁ hxyH + have hy_s : y ∈ r₁.support := r₁.left_mem_support_of_mem_edges hf₁ hxyH.symm + have hxv' : x = v' := hr₁_first x hx_s hxyC.2.1 + have hyv' : y = v' := hr₁_first y hy_s hxyC.2.2.1 + subst hxv' hyv' + exact not_isLink_self_of_mem_edges_of_isSimple r₁ hr₁_s hf₁ hxyH + refine ⟨a, hv₀, v', hv'C, hav', .nil hl.left_mem, W_sub, r₂, ?_, ?_, ?_, + ⟨e, by rw [walkDrawing_E]; exact List.mem_cons_self, w, hl⟩⟩ + · rw [hsplit_r]; rfl + · rw [walkDrawing_V] + ext x + simp only [W_sub, mem_inter_iff, mem_ofPred_eq, GraphWalk.support_cons, List.mem_cons, + mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨rfl | hx₁, hxC⟩ + · exact Or.inl rfl + · exact Or.inr (hr₁_first x hx₁ hxC) + · rintro (rfl | rfl) + · exact ⟨Or.inl rfl, hv₀⟩ + · exact ⟨Or.inr r₁.end_mem_support, hv'C⟩ + · rw [walkDrawing_E] + refine disjoint_left.mpr fun f hf hfC => ?_ + rcases List.mem_cons.mp hf with rfl | hf₁ + · exact heC hfC + · exact hr₁_no_edge f hf₁ hfC + · left + have hhit' : ∀ x ∈ r.support, x ∉ C.V := fun x hx hxC => hhit ⟨x, hx, hxC⟩ + refine ⟨a, hv₀, ?_⟩ + have haH : a ∈ V(H.toGraph) := hl.left_mem + have heq : Drawing.inf H C (walkDrawing H (GraphWalk.cons hl r)) = + walkDrawing H (GraphWalk.nil haH) := by + apply Drawing.ext_of_V_E + · rw [Drawing.inf_V hC (walkDrawing_isSubdrawing H _), walkDrawing_V, walkDrawing_V] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.support_cons, List.mem_cons, + GraphWalk.support_nil, List.not_mem_nil, or_false] + constructor + · rintro ⟨hxC, rfl | hxr⟩ + · rfl + · exact (hhit' x hxr hxC).elim + · rintro rfl + exact ⟨hv₀, Or.inl rfl⟩ + · rw [Drawing.inf_E hC, walkDrawing_E, walkDrawing_E] + ext f + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.edges_cons, List.mem_cons, + GraphWalk.edges_nil, List.not_mem_nil, iff_false, not_and] + rintro hfC (rfl | hfr) + · exact heC hfC + · obtain ⟨x, y, hxyH⟩ := (H.toGraph.edge_mem_iff_exists_isLink f).mp (hC.2 hfC) + have hxyC : C.toGraph.IsLink f x y := (hC.isLink_iff hfC).mpr hxyH + have hx_r : x ∈ r.support := r.left_mem_support_of_mem_edges hfr hxyH + exact hhit' x hx_r hxyC.2.1 + rw [heq] + exact walkDrawing_isPathBetween H (List.nodup_singleton a) + +/-- For any path `P` in `H` between `a` and `b` meeting `C.V`, either `Drawing.inf H C P` is a path, +or the simple walk `W` of `P` in `H` decomposes as `W₁.append (W_sub.append W₂)` where +`P_sub = walkDrawing H W_sub` is a detour path between distinct `v, v' ∈ C.V ∩ P.V`. -/ +theorem path_inf_isPath_or_exists_detour {H C P : Drawing S} (hC : C.IsSubdrawing H) + (hP_sub : P.IsSubdrawing H) {a b : S} (hP : P.IsPathBetween a b) (hne : (C.V ∩ P.V).Nonempty) : + IsDrawingPath (Drawing.inf H C P) ∨ + ∃ v ∈ C.V ∩ P.V, ∃ v' ∈ C.V ∩ P.V, v ≠ v' ∧ + ∃ (W₁ : GraphWalk H.toGraph a v) (W_sub : GraphWalk H.toGraph v v') + (W₂ : GraphWalk H.toGraph v' b), + (W₁.append (W_sub.append W₂)).IsSimple ∧ + P = walkDrawing H (W₁.append (W_sub.append W₂)) ∧ + (walkDrawing H W_sub).V ∩ C.V = {v, v'} ∧ + Disjoint (walkDrawing H W_sub).E C.E ∧ + ∃ e ∈ (walkDrawing H W_sub).E, ∃ w : S, H.toGraph.IsLink e v w := by + obtain ⟨W₀, hW₀s, hVP, hEP⟩ := hP + obtain ⟨W, hsW, heW⟩ := hP_sub.exists_walk_up W₀ + have hWs : W.IsSimple := by change W.support.Nodup; rw [hsW]; exact hW₀s + have hP_eq : P = walkDrawing H W := by + apply Drawing.ext_of_V_E + · rw [hVP, walkDrawing_V, hsW] + · rw [hEP, walkDrawing_E, heW] + have hne_W : ∃ x ∈ W.support, x ∈ C.V := by + obtain ⟨x, hxC, hxP⟩ := hne + rw [hVP, ← hsW] at hxP + exact ⟨x, hxP, hxC⟩ + obtain ⟨v₀, hv₀C, W_init, W_rem, hsplit, hW_init_first⟩ := exists_first_hit_split W hne_W + have hsp_init_rem := isSimple_of_append (hsplit ▸ hWs) + have hW_init_no_edge : ∀ f ∈ W_init.edges, f ∉ C.E := by + intro f hf hfC + obtain ⟨x, y, hxyH⟩ := (H.toGraph.edge_mem_iff_exists_isLink f).mp (hC.2 hfC) + have hxyC : C.toGraph.IsLink f x y := (hC.isLink_iff hfC).mpr hxyH + have hx_s : x ∈ W_init.support := W_init.left_mem_support_of_mem_edges hf hxyH + have hy_s : y ∈ W_init.support := W_init.left_mem_support_of_mem_edges hf hxyH.symm + have hxv₀ : x = v₀ := hW_init_first x hx_s hxyC.2.1 + have hyv₀ : y = v₀ := hW_init_first y hy_s hxyC.2.2.1 + subst hxv₀ hyv₀ + exact not_isLink_self_of_mem_edges_of_isSimple W_init hsp_init_rem.1 hf hxyH + have hinf_eq : Drawing.inf H C P = Drawing.inf H C (walkDrawing H W_rem) := by + rw [hP_eq, hsplit] + apply Drawing.ext_of_V_E + · rw [Drawing.inf_V hC (walkDrawing_isSubdrawing H _), + Drawing.inf_V hC (walkDrawing_isSubdrawing H _), walkDrawing_V, walkDrawing_V] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.mem_support_append] + constructor + · rintro ⟨hxC, hx₁ | hx₂⟩ + · rw [hW_init_first x hx₁ hxC] + exact ⟨hv₀C, W_rem.start_mem_support⟩ + · exact ⟨hxC, hx₂⟩ + · rintro ⟨hxC, hx₂⟩ + exact ⟨hxC, Or.inr hx₂⟩ + · rw [Drawing.inf_E hC, Drawing.inf_E hC, walkDrawing_E, walkDrawing_E] + ext f + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.edges_append, List.mem_append] + constructor + · rintro ⟨hfC, hf₁ | hf₂⟩ + · exact (hW_init_no_edge f hf₁ hfC).elim + · exact ⟨hfC, hf₂⟩ + · rintro ⟨hfC, hf₂⟩ + exact ⟨hfC, Or.inr hf₂⟩ + rcases walk_inf_isPath_or_exists_detour hC W_rem hsp_init_rem.2 hv₀C with + ⟨u, _, hpath⟩ | + ⟨v, hvC, v', hv'C, hvv', W_pre, W_sub, W_post, hrem_eq, hVC, hEC, hex_e⟩ + · left + exact ⟨v₀, u, hinf_eq ▸ hpath⟩ + · right + have hW_all : W = (W_init.append W_pre).append (W_sub.append W_post) := by + rw [hsplit, hrem_eq] + clear * - + induction W_init with + | nil _ => rfl + | cons _ _ ih => simp [GraphWalk.append, ih] + have hvP : v ∈ P.V := by + rw [hP_eq, hW_all, walkDrawing_V, mem_ofPred_eq, GraphWalk.mem_support_append] + exact Or.inl (W_init.append W_pre).end_mem_support + have hv'P : v' ∈ P.V := by + rw [hP_eq, hW_all, walkDrawing_V, mem_ofPred_eq, GraphWalk.mem_support_append] + exact Or.inr ((GraphWalk.mem_support_append W_sub W_post).mpr (Or.inl W_sub.end_mem_support)) + exact ⟨v, ⟨hvC, hvP⟩, v', ⟨hv'C, hv'P⟩, hvv', W_init.append W_pre, W_sub, W_post, + hW_all ▸ hWs, hW_all ▸ hP_eq, hVC, hEC, hex_e⟩ + +/-! ## 3. Suffix Inside-Disc Dichotomy and Walk Rerouting -/ + +theorem GraphWalk.append_assoc {α β : Type*} {G : Graph α β} {a b c d : α} + (W₁ : GraphWalk G a b) (W₂ : GraphWalk G b c) (W₃ : GraphWalk G c d) : + (W₁.append W₂).append W₃ = W₁.append (W₂.append W₃) := by + induction W₁ with + | nil _ => rfl + | cons _ _ ih => simp [GraphWalk.append, ih] + +theorem walkDrawing_append_U (H : Drawing S) {a b c : S} + (W₁ : GraphWalk H.toGraph a b) (W₂ : GraphWalk H.toGraph b c) : + (walkDrawing H (W₁.append W₂)).U = (walkDrawing H W₁).U ∪ (walkDrawing H W₂).U := + GraphWalk.drawing_U_append H W₁ W₂ + +omit [T2Space S] in +/-- For a line `L` with ends `a ≠ b`, `L \ {a}` is preconnected and contains `b`. -/ +theorem IsLineWithEnds.isPreconnected_diff_left {L : Set S} {a b : S} + (hL : IsLineWithEnds L a b) (hab : a ≠ b) : + IsPreconnected (L \ {a}) ∧ b ∈ L \ {a} := by + obtain ⟨f, hf0, hf1⟩ := hL + have hb : b ∈ L \ {a} := ⟨hf1 ▸ (f 1).2, fun h => hab (mem_singleton_iff.mp h).symm⟩ + refine ⟨?_, hb⟩ + have hEq : L \ {a} = (fun t : ℝ => (f (projIcc 0 1 zero_le_one t)).1) '' Ioc (0 : ℝ) 1 := by + ext x + constructor + · rintro ⟨hxL, hxa⟩ + let t : unitInterval := f.symm ⟨x, hxL⟩ + have ht : (f t).1 = x := congrArg Subtype.val (f.apply_symm_apply ⟨x, hxL⟩) + have ht0 : (0 : ℝ) < t.1 := by + refine lt_of_le_of_ne t.2.1 fun h0 => hxa ?_ + have ht_eq : t = 0 := Subtype.ext h0.symm + exact mem_singleton_iff.mpr (ht.symm.trans (ht_eq ▸ hf0)) + refine ⟨t.1, ⟨ht0, t.2.2⟩, ?_⟩ + have hp : projIcc (0 : ℝ) 1 zero_le_one t.1 = t := projIcc_of_mem zero_le_one t.2 + simp [hp, ht] + · rintro ⟨t, ⟨ht0, ht1⟩, rfl⟩ + have hp : projIcc (0 : ℝ) 1 zero_le_one t = ⟨t, ht0.le, ht1⟩ := + projIcc_of_mem zero_le_one ⟨ht0.le, ht1⟩ + refine ⟨(f _).2, fun hxa => ?_⟩ + have heq : f (projIcc 0 1 zero_le_one t) = f 0 := + Subtype.ext ((mem_singleton_iff.mp hxa).trans hf0.symm) + have hinj := f.injective heq + rw [hp] at hinj + exact ht0.ne (congrArg Subtype.val hinj).symm + rw [hEq] + have hcont : Continuous (fun t : ℝ => (f (projIcc 0 1 zero_le_one t)).1) := + continuous_subtype_val.comp (f.continuous.comp continuous_projIcc) + exact (convex_Ioc (0 : ℝ) 1).isPreconnected.image _ hcont.continuousOn + +/-- If a simple walk `W` from `v ∈ C.V` to `b ∈ Δ \ C.U` meets `C.V` only at `v` and is +edge-disjoint from `C.E`, then `(walkDrawing H W).U ⊆ Δ`. -/ +private theorem tail_subset_disc_of_inter_eq_singleton {H C : Drawing S} {Δ : Set S} + (hC : C.IsSubdrawing H) (hΔ : IsClosed Δ) (hfr : frontier Δ = C.U) + {v b : S} (W : GraphWalk H.toGraph v b) (hWs : W.IsSimple) + (hvC : v ∈ C.V) (hb : b ∈ Δ \ C.U) + (hVC : (walkDrawing H W).V ∩ C.V = {v}) (hEC : Disjoint (walkDrawing H W).E C.E) : + (walkDrawing H W).U ⊆ Δ := by + let P := walkDrawing H W + have hPs : P.IsSubdrawing H := walkDrawing_isSubdrawing H W + have hP_path : P.IsPathBetween v b := walkDrawing_isPathBetween H hWs + have hvCU : v ∈ C.U := C.V_subset_U hvC + have hvb : v ≠ b := fun h => hb.2 (h ▸ hvCU) + have hL : IsLineWithEnds P.U v b := GM14.isLine_of_isPathBetween hP_path hvb + obtain ⟨hpre, hb_in⟩ := IsLineWithEnds.isPreconnected_diff_left hL hvb + have hU_inter : P.U ∩ C.U = {v} := by + rw [GM14.U_inter_of_disjoint hPs hC hEC, hVC] + have hdis_fr : Disjoint (P.U \ {v}) (frontier Δ) := by + rw [hfr] + refine disjoint_left.mpr fun x hx hxC => hx.2 ?_ + have : x ∈ P.U ∩ C.U := ⟨hx.1, hxC⟩ + rwa [hU_inter] at this + have hsub : P.U \ {v} ⊆ Δ := by + rcases GM14.subset_or_disjoint_of_frontier hΔ hpre hdis_fr with hsub | hdis + · exact hsub + · exact (disjoint_left.mp hdis hb_in hb.1).elim + intro x hx + by_cases hxv : x = v + · subst hxv + exact hΔ.frontier_subset (hfr.symm ▸ hvCU) + · exact hsub ⟨hx, hxv⟩ + +/-- For any simple walk `W` in `H` from `v ∈ C.V` to `b ∈ Δ \ C.U` (where `Δ` is closed with +`frontier Δ = C.U`), either `(walkDrawing H W).U ⊆ Δ`, or `W` decomposes as +`W_pre.append (W_sub.append W_post)` where `P_sub = walkDrawing H W_sub` is an outer detour on `C` +(`¬ P_sub.U ⊆ Δ`). -/ +theorem walk_subset_disc_or_exists_outer_detour {H C : Drawing S} {Δ : Set S} + (hC : C.IsSubdrawing H) (hΔ : IsClosed Δ) (hfr : frontier Δ = C.U) + {v b : S} (W : GraphWalk H.toGraph v b) (hWs : W.IsSimple) + (hv : v ∈ C.V) (hb : b ∈ Δ \ C.U) : + (walkDrawing H W).U ⊆ Δ ∨ + ∃ u₁ ∈ C.V, ∃ u₂ ∈ C.V, u₁ ≠ u₂ ∧ + ∃ (W_pre : GraphWalk H.toGraph v u₁) (W_sub : GraphWalk H.toGraph u₁ u₂) + (W_post : GraphWalk H.toGraph u₂ b), + W = W_pre.append (W_sub.append W_post) ∧ + (walkDrawing H W_sub).V ∩ C.V = {u₁, u₂} ∧ + Disjoint (walkDrawing H W_sub).E C.E ∧ + ¬ (walkDrawing H W_sub).U ⊆ Δ := by + suffices hlen : ∀ n : ℕ, ∀ {v : S} (W : GraphWalk H.toGraph v b), W.length = n → + W.IsSimple → v ∈ C.V → + (walkDrawing H W).U ⊆ Δ ∨ + ∃ u₁ ∈ C.V, ∃ u₂ ∈ C.V, u₁ ≠ u₂ ∧ + ∃ (W_pre : GraphWalk H.toGraph v u₁) (W_sub : GraphWalk H.toGraph u₁ u₂) + (W_post : GraphWalk H.toGraph u₂ b), + W = W_pre.append (W_sub.append W_post) ∧ + (walkDrawing H W_sub).V ∩ C.V = {u₁, u₂} ∧ + Disjoint (walkDrawing H W_sub).E C.E ∧ + ¬ (walkDrawing H W_sub).U ⊆ Δ from + hlen W.length W rfl hWs hv + intro n + induction n using Nat.strong_induction_on with + | _ n ih => + intro a W hn hWs hv + cases W with + | nil _ => + exact (hb.2 (C.V_subset_U hv)).elim + | @cons a w b e hl r => + have ha_not_r : a ∉ r.support := (List.nodup_cons.mp hWs).1 + have hr_s : r.IsSimple := (List.nodup_cons.mp hWs).2 + have hr_lt : r.length < n := by rw [← hn, GraphWalk.length_cons]; omega + by_cases heC : e ∈ C.E + · have hlC : C.toGraph.IsLink e a w := (hC.isLink_iff heC).mpr hl + have hwC : w ∈ C.V := hlC.2.2.1 + rcases ih r.length hr_lt r rfl hr_s hwC with hr_in | + ⟨u₁, hu₁C, u₂, hu₂C, hu12, W_pre, W_sub, W_post, hr_eq, hVC, hEC, hnot_in⟩ + · left + have hcons_eq : GraphWalk.cons hl r = + (GraphWalk.cons hl (.nil hl.right_mem)).append r := rfl + rw [hcons_eq, walkDrawing_append_U] + refine union_subset ?_ hr_in + have he_sub : (walkDrawing H (GraphWalk.cons hl (.nil hl.right_mem))).U ⊆ C.U := by + intro x hx + rw [mem_walkDrawing_U] at hx + rcases hx with hxV | ⟨f, hf, hxf⟩ + · simp only [GraphWalk.support_cons, GraphWalk.support_nil, List.mem_cons, + List.not_mem_nil, or_false] at hxV + rcases hxV with rfl | rfl + · exact C.V_subset_U hv + · exact C.V_subset_U hwC + · simp only [GraphWalk.edges_cons, GraphWalk.edges_nil, List.mem_singleton] at hf + subst hf + exact C.closure_subset_U heC hxf + exact he_sub.trans (hfr ▸ hΔ.frontier_subset) + · right + refine ⟨u₁, hu₁C, u₂, hu₂C, hu12, .cons hl W_pre, W_sub, W_post, ?_, hVC, hEC, hnot_in⟩ + rw [hr_eq]; rfl + · by_cases hhit : ∃ x ∈ r.support, x ∈ C.V + · obtain ⟨v', hv'C, r₁, r₂, hsplit_r, hr₁_first⟩ := exists_first_hit_split r hhit + have hr₁_s : r₁.IsSimple := (isSimple_of_append (hsplit_r ▸ hr_s)).1 + have hr₂_s : r₂.IsSimple := (isSimple_of_append (hsplit_r ▸ hr_s)).2 + have ha_not_r₁ : a ∉ r₁.support := fun ha_in => + ha_not_r (hsplit_r ▸ (GraphWalk.mem_support_append r₁ r₂).mpr (Or.inl ha_in)) + have hav' : a ≠ v' := fun h => ha_not_r₁ (h ▸ r₁.end_mem_support) + let W_sub := GraphWalk.cons hl r₁ + have hr₁_no_edge : ∀ f ∈ r₁.edges, f ∉ C.E := by + intro f hf₁ hfC + obtain ⟨x, y, hxyH⟩ := (H.toGraph.edge_mem_iff_exists_isLink f).mp (hC.2 hfC) + have hxyC : C.toGraph.IsLink f x y := (hC.isLink_iff hfC).mpr hxyH + have hx_s : x ∈ r₁.support := r₁.left_mem_support_of_mem_edges hf₁ hxyH + have hy_s : y ∈ r₁.support := r₁.left_mem_support_of_mem_edges hf₁ hxyH.symm + have hxv' : x = v' := hr₁_first x hx_s hxyC.2.1 + have hyv' : y = v' := hr₁_first y hy_s hxyC.2.2.1 + subst hxv' hyv' + exact not_isLink_self_of_mem_edges_of_isSimple r₁ hr₁_s hf₁ hxyH + have hVC : (walkDrawing H W_sub).V ∩ C.V = {a, v'} := by + rw [walkDrawing_V] + ext x + simp only [W_sub, mem_inter_iff, mem_ofPred_eq, GraphWalk.support_cons, List.mem_cons, + mem_insert_iff] + constructor + · rintro ⟨rfl | hx₁, hxC⟩ + · exact Or.inl rfl + · exact Or.inr (hr₁_first x hx₁ hxC) + · rintro (rfl | rfl) + · exact ⟨Or.inl rfl, hv⟩ + · exact ⟨Or.inr r₁.end_mem_support, hv'C⟩ + have hEC : Disjoint (walkDrawing H W_sub).E C.E := by + rw [walkDrawing_E] + refine disjoint_left.mpr fun f hf hfC => ?_ + rcases List.mem_cons.mp hf with rfl | hf₁ + · exact heC hfC + · exact hr₁_no_edge f hf₁ hfC + by_cases hsub_in : (walkDrawing H W_sub).U ⊆ Δ + · have hr₂_lt : r₂.length < n := by + rw [← hn, GraphWalk.length_cons, hsplit_r, GraphWalk.length_append] + omega + rcases ih r₂.length hr₂_lt r₂ rfl hr₂_s hv'C with hr₂_in | + ⟨u₁, hu₁C, u₂, hu₂C, hu12, W_pre, W_sub', W_post, hr₂_eq, hVC', hEC', hnot_in'⟩ + · left + have hcons_eq : GraphWalk.cons hl r = W_sub.append r₂ := by rw [hsplit_r]; rfl + rw [hcons_eq, walkDrawing_append_U] + exact union_subset hsub_in hr₂_in + · right + refine ⟨u₁, hu₁C, u₂, hu₂C, hu12, W_sub.append W_pre, W_sub', W_post, ?_, + hVC', hEC', hnot_in'⟩ + have hcons_eq : GraphWalk.cons hl r = W_sub.append r₂ := by rw [hsplit_r]; rfl + rw [hcons_eq, hr₂_eq, GraphWalk.append_assoc] + · right + refine ⟨a, hv, v', hv'C, hav', .nil hl.left_mem, W_sub, r₂, ?_, hVC, hEC, hsub_in⟩ + rw [hsplit_r]; rfl + · left + have hhit' : ∀ x ∈ r.support, x ∉ C.V := fun x hx hxC => hhit ⟨x, hx, hxC⟩ + have hVC : (walkDrawing H (GraphWalk.cons hl r)).V ∩ C.V = {a} := by + rw [walkDrawing_V] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.support_cons, List.mem_cons] + constructor + · rintro ⟨rfl | hxr, hxC⟩ + · rfl + · exact (hhit' x hxr hxC).elim + · rintro rfl + exact ⟨Or.inl rfl, hv⟩ + have hEC : Disjoint (walkDrawing H (GraphWalk.cons hl r)).E C.E := by + rw [walkDrawing_E] + refine disjoint_left.mpr fun f hf hfC => ?_ + rcases List.mem_cons.mp hf with rfl | hfr + · exact heC hfC + · obtain ⟨x, y, hxyH⟩ := (H.toGraph.edge_mem_iff_exists_isLink f).mp (hC.2 hfC) + have hxyC : C.toGraph.IsLink f x y := (hC.isLink_iff hfC).mpr hxyH + have hx_r : x ∈ r.support := r.left_mem_support_of_mem_edges hfr hxyH + exact hhit' x hx_r hxyC.2.1 + exact tail_subset_disc_of_inter_eq_singleton hC hΔ hfr (GraphWalk.cons hl r) hWs hv hb + hVC hEC + +/-- Rerouting a path `P = walkDrawing H (W₁.append (W_sub.append W₂))` by replacing `W_sub` with a +path `Q` in `H` between `v` and `v'` produces a path `P'` in `H` between `a` and `b` with +`P'.V ⊆ P.V ∪ Q.V` and `P'.E ⊆ (P.E \ (walkDrawing H W_sub).E) ∪ Q.E`. -/ +theorem reroute_drawing_path {H P Q : Drawing S} {a b v v' : S} + {W₁ : GraphWalk H.toGraph a v} {W_sub : GraphWalk H.toGraph v v'} + {W₂ : GraphWalk H.toGraph v' b} + (hWs : (W₁.append (W_sub.append W₂)).IsSimple) + (hP_eq : P = walkDrawing H (W₁.append (W_sub.append W₂))) + (hQs : Q.IsSubdrawing H) (hQ : Q.IsPathBetween v v') : + ∃ P' : Drawing S, P'.IsSubdrawing H ∧ P'.IsPathBetween a b ∧ + P'.V ⊆ P.V ∪ Q.V ∧ P'.E ⊆ (P.E \ (walkDrawing H W_sub).E) ∪ Q.E := by + obtain ⟨WQ₀, _, hVQ, hEQ⟩ := hQ + obtain ⟨WQ, hsQ, heQ⟩ := hQs.exists_walk_up WQ₀ + let W_all := W₁.append (WQ.append W₂) + obtain ⟨W', hW's, hsupp, hedges⟩ := exists_isSimple_subwalk W_all + let P' := walkDrawing H W' + have hnd_edges : (W₁.edges ++ (W_sub.edges ++ W₂.edges)).Nodup := by + have h := hWs.edges_nodup + rwa [GraphWalk.edges_append, GraphWalk.edges_append] at h + have hd₁ := List.nodup_append.mp hnd_edges + have hd₂ := List.nodup_append.mp hd₁.2.1 + refine ⟨P', walkDrawing_isSubdrawing H W', walkDrawing_isPathBetween H hW's, ?_, ?_⟩ + · intro x hx + rw [walkDrawing_V, mem_ofPred_eq] at hx + have hx_all := hsupp x hx + simp only [W_all, GraphWalk.mem_support_append] at hx_all + rcases hx_all with hx₁ | hxQ | hx₂ + · left + rw [hP_eq, walkDrawing_V, mem_ofPred_eq, GraphWalk.mem_support_append] + exact Or.inl hx₁ + · right + rw [hVQ, mem_ofPred_eq, ← hsQ] + exact hxQ + · left + rw [hP_eq, walkDrawing_V, mem_ofPred_eq, GraphWalk.mem_support_append, + GraphWalk.mem_support_append] + exact Or.inr (Or.inr hx₂) + · intro e he + rw [walkDrawing_E, mem_ofPred_eq] at he + have he_all := hedges e he + simp only [W_all, GraphWalk.edges_append, List.mem_append] at he_all + rcases he_all with he₁ | heQ' | he₂ + · left + refine ⟨?_, ?_⟩ + · rw [hP_eq, walkDrawing_E, mem_ofPred_eq, GraphWalk.edges_append, List.mem_append] + exact Or.inl he₁ + · rw [walkDrawing_E, mem_ofPred_eq] + exact fun hsub => hd₁.2.2 e he₁ e (List.mem_append_left _ hsub) rfl + · right + rw [hEQ, mem_ofPred_eq, ← heQ] + exact heQ' + · left + refine ⟨?_, ?_⟩ + · rw [hP_eq, walkDrawing_E, mem_ofPred_eq, GraphWalk.edges_append, GraphWalk.edges_append, + List.mem_append, List.mem_append] + exact Or.inr (Or.inr he₂) + · rw [walkDrawing_E, mem_ofPred_eq] + exact fun hsub => hd₂.2.2 e hsub e he₂ rfl + +/-! ## 4. Total Union Edge Count and Strict-Decrease Moves -/ + +/-- The set of all edges in `C₁ ∪ ⋯ ∪ C_s ∪ P₁ ∪ ⋯ ∪ P_r`. -/ +def totalDrawingEdgeSet {s r : ℕ} (C : Fin s → Drawing S) (P : Fin r → Drawing S) : Set (Set S) := + (⋃ j : Fin s, (C j).E) ∪ (⋃ i : Fin r, (P i).E) + +/-- The total number of edges `|E(C₁ ∪ ⋯ ∪ C_s ∪ P₁ ∪ ⋯ ∪ P_r)|` minimized in `(1)` of the proof of +Graph Minors III, (4.1) (page 60). -/ +noncomputable def totalDrawingEdges {s r : ℕ} (C : Fin s → Drawing S) (P : Fin r → Drawing S) : + ℕ := + (totalDrawingEdgeSet C P).ncard + +omit [T2Space S] in +theorem totalDrawingEdgeSet_finite {s r : ℕ} {H : Drawing S} + {C : Fin s → Drawing S} {P : Fin r → Drawing S} + (hCH : ∀ j, (C j).IsSubdrawing H) (hPH : ∀ i, (P i).IsSubdrawing H) : + (totalDrawingEdgeSet C P).Finite := by + refine H.finite_edges.subset ?_ + exact union_subset (iUnion_subset fun j => (hCH j).2) (iUnion_subset fun i => (hPH i).2) + +omit [T2Space S] in +/-- Condition `(1)` of the proof of Graph Minors III, (4.1) (page 60): +choose `C₁, …, C_s, P₁, …, P_r` with `|E(C₁ ∪ ⋯ ∪ C_s ∪ P₁ ∪ ⋯ ∪ P_r)|` minimum. -/ +theorem exists_min_totalDrawingEdges {s r : ℕ} + (IsValidPair : (Fin s → Drawing S) → (Fin r → Drawing S) → Prop) + (hex : ∃ C₀ P₀, IsValidPair C₀ P₀) : + ∃ C P, IsValidPair C P ∧ + ∀ C' P', IsValidPair C' P' → totalDrawingEdges C P ≤ totalDrawingEdges C' P' := by + classical + obtain ⟨C₀, P₀, h₀⟩ := hex + have hne : {n : ℕ | ∃ C P, IsValidPair C P ∧ totalDrawingEdges C P = n}.Nonempty := + ⟨totalDrawingEdges C₀ P₀, C₀, P₀, h₀, rfl⟩ + obtain ⟨C, P, hCP, hmin⟩ := Nat.sInf_mem hne + refine ⟨C, P, hCP, fun C' P' h' => ?_⟩ + rw [hmin] + exact Nat.sInf_le ⟨C', P', h', rfl⟩ + +omit [T2Space S] in +theorem disjoint_E_of_disjoint_V {H A B : Drawing S} (hA : A.IsSubdrawing H) + (hB : B.IsSubdrawing H) (hV : Disjoint A.V B.V) : Disjoint A.E B.E := by + exact disjoint_edgeSet_of_disjoint_vertexSet hA.toGraph_le hB.toGraph_le hV + +/-- **Move 2 (Outer detour circuit replacement, GM03 (4.1) paragraph 4, page 60)**: +Replacing `C j` by `H.sup P_sub Q₁` when `Q₂` has an edge `e₀` not in `⋃ k, (P k).E` strictly +decreases `totalDrawingEdges C P`. -/ +theorem totalDrawingEdges_lt_of_replace_circuit {s r : ℕ} [DecidableEq (Fin s)] {H : Drawing S} + {C : Fin s → Drawing S} {P : Fin r → Drawing S} + (hCH : ∀ m, (C m).IsSubdrawing H) (hPH : ∀ k, (P k).IsSubdrawing H) + (hC_disj : Pairwise (fun m₁ m₂ => Disjoint (C m₁).V (C m₂).V)) + {j : Fin s} {i : Fin r} {P_sub Q₁ Q₂ : Drawing S} + (hP_sub : P_sub.IsSubdrawing (P i)) (hQ₁ : Q₁.IsSubdrawing (C j)) + (hQ₂ : Q₂.IsSubdrawing (C j)) (hQ_disj : Disjoint Q₁.E Q₂.E) + {e₀ : Set S} (he₀_Q₂ : e₀ ∈ Q₂.E) (he₀_not_P : ∀ k : Fin r, e₀ ∉ (P k).E) : + totalDrawingEdges (Function.update C j (H.sup P_sub Q₁)) P < totalDrawingEdges C P := by + have hP := hP_sub.trans (hPH i) + have hQ := hQ₁.trans (hCH j) + have hUnion : (H.sup P_sub Q₁).toGraph = subgraphUnion H.toGraph P_sub.toGraph Q₁.toGraph := by + refine (Compatible.of_le_le (H.sup_isSubdrawing P_sub Q₁).toGraph_le + (subgraphUnion_le hP.toGraph_le hQ.toGraph_le)).ext ?_ ?_ + · exact Drawing.sup_V hP hQ + · change (H.sup P_sub Q₁).E = E(subgraphUnion H.toGraph P_sub.toGraph Q₁.toGraph) + rw [edgeSet_subgraphUnion hP.toGraph_le hQ.toGraph_le] + exact Drawing.sup_E hP hQ + change totalUnionEdges (Drawing.toGraph ∘ Function.update C j (H.sup P_sub Q₁)) + (Drawing.toGraph ∘ P) < totalUnionEdges (Drawing.toGraph ∘ C) (Drawing.toGraph ∘ P) + rw [Function.comp_update, hUnion] + exact totalUnionEdges_lt_of_replace_circuit H.finite_edges (fun m => (hCH m).toGraph_le) + (fun k => (hPH k).toGraph_le) hC_disj hP_sub.toGraph_le hQ₁.toGraph_le + hQ₂.toGraph_le hQ_disj he₀_Q₂ he₀_not_P + +omit [T2Space S] in +/-- **Move 3 (Inner detour path rerouting, GM03 (4.1) paragraph 6, page 61)**: +Rerouting `P i` along `Q_k ≤ C j` while omitting `P_sub.E` preserves pairwise vertex-disjointness +and strictly decreases `totalDrawingEdges C P`. -/ +theorem totalDrawingEdges_lt_of_reroute_path {s r : ℕ} [DecidableEq (Fin r)] {H : Drawing S} + {C : Fin s → Drawing S} {P : Fin r → Drawing S} + (hCH : ∀ m, (C m).IsSubdrawing H) (hPH : ∀ k, (P k).IsSubdrawing H) + (hP_disj : Pairwise (fun k₁ k₂ => Disjoint (P k₁).V (P k₂).V)) + {j : Fin s} {i : Fin r} {P_sub Q_k P'_i : Drawing S} + (hP_sub : P_sub.IsSubdrawing (P i)) (hQ_k : Q_k.IsSubdrawing (C j)) + (hP'_V : P'_i.V ⊆ (P i).V ∪ Q_k.V) + (hP'_E : P'_i.E ⊆ ((P i).E \ P_sub.E) ∪ Q_k.E) + (hQ_disj_other : ∀ i' : Fin r, i' ≠ i → Disjoint Q_k.V (P i').V) + {e₁ : Set S} (he₁_sub : e₁ ∈ P_sub.E) (he₁_not_C : ∀ m : Fin s, e₁ ∉ (C m).E) : + Pairwise (fun k₁ k₂ => Disjoint (Function.update P i P'_i k₁).V (Function.update P i P'_i + k₂).V) ∧ + totalDrawingEdges C (Function.update P i P'_i) < totalDrawingEdges C P := by + let C' := Drawing.toGraph ∘ C + let P' := Drawing.toGraph ∘ P + have hMoves := totalUnionEdges_lt_of_reroute_path (C := C') (P := P') H.finite_edges + (fun m => (hCH m).toGraph_le) (fun k => (hPH k).toGraph_le) hP_disj + hP_sub.toGraph_le hQ_k.toGraph_le (P'_i := P'_i.toGraph) + hP'_V hP'_E hQ_disj_other he₁_sub he₁_not_C + have hUpdate : Drawing.toGraph ∘ Function.update P i P'_i = Function.update P' i P'_i.toGraph := + Function.comp_update _ _ _ _ + change Pairwise (fun k₁ k₂ => Disjoint + V((Drawing.toGraph ∘ Function.update P i P'_i) k₁) + V((Drawing.toGraph ∘ Function.update P i P'_i) k₂)) ∧ + totalUnionEdges C' (Drawing.toGraph ∘ Function.update P i P'_i) < totalUnionEdges C' P' + rw [hUpdate] + exact hMoves + +/-! ## 5. Closed-Disc Nest Uncrossing (Graph Minors III, Theorem (4.1)) -/ + +omit [T2Space S] in +theorem frontier_inter_subset_frontier_of_subset {A B : Set S} (hAB : A ⊆ B) : + A ∩ frontier B ⊆ frontier A := fun _ ⟨hxA, hxB⟩ => + ⟨subset_closure hxA, fun hx_int => hxB.2 (interior_mono hAB hx_int)⟩ + +/-- If `W₁.append W₂` is a simple walk in `H` where `W₁` ends at `v` and `W₂` starts at `v`, then +`(walkDrawing H W₁).U ∩ (walkDrawing H W₂).U = {v}`. -/ +theorem walkDrawing_append_U_inter {H : Drawing S} {a v b : S} + (W₁ : GraphWalk H.toGraph a v) (W₂ : GraphWalk H.toGraph v b) + (hWs : (W₁.append W₂).IsSimple) : + (walkDrawing H W₁).U ∩ (walkDrawing H W₂).U = {v} := by + have hnd_V : (W₁.support ++ W₂.support.tail).Nodup := by + have h := hWs + rwa [GraphWalk.IsSimple, GraphWalk.support_append] at h + have hd_V := List.nodup_append.mp hnd_V + have hnd_E : (W₁.edges ++ W₂.edges).Nodup := by + have h := hWs.edges_nodup + rwa [GraphWalk.edges_append] at h + have hd_E := List.nodup_append.mp hnd_E + have hdisjE : Disjoint (walkDrawing H W₁).E (walkDrawing H W₂).E := by + rw [walkDrawing_E, walkDrawing_E] + exact disjoint_left.mpr fun e he₁ he₂ => hd_E.2.2 e he₁ e he₂ rfl + rw [GM14.U_inter_of_disjoint (walkDrawing_isSubdrawing H W₁) (walkDrawing_isSubdrawing H W₂) + hdisjE, walkDrawing_V, walkDrawing_V] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, mem_singleton_iff] + constructor + · rintro ⟨hx₁, hx₂⟩ + rw [W₂.support_eq_cons] at hx₂ + rcases List.mem_cons.mp hx₂ with rfl | hx₂_tail + · rfl + · exact (hd_V.2.2 x hx₁ x hx₂_tail rfl).elim + · rintro rfl + exact ⟨W₁.end_mem_support, W₂.start_mem_support⟩ + +/-- If `W = W₁.append W₂` is a simple walk in `H` with `W₁ : GraphWalk H.toGraph a v`, +`Drawing.inf H C (walkDrawing H W)` is a path in `H`, `(walkDrawing H W₁).U` meets `C.U`, and +`v ∉ C.U`, then `Disjoint (walkDrawing H W₂).U C.U`. -/ +theorem disjoint_tail_of_inf_isPath {H C : Drawing S} (hC : C.IsSubdrawing H) + {a v b : S} (W₁ : GraphWalk H.toGraph a v) (W₂ : GraphWalk H.toGraph v b) + (hWs : (W₁.append W₂).IsSimple) + (hinf : IsDrawingPath (Drawing.inf H C (walkDrawing H (W₁.append W₂)))) + (hmeet₁ : ((walkDrawing H W₁).U ∩ C.U).Nonempty) + (hv_not : v ∉ C.U) : + Disjoint (walkDrawing H W₂).U C.U := by + let P₁ := walkDrawing H W₁ + let P₂ := walkDrawing H W₂ + let P := walkDrawing H (W₁.append W₂) + let I := Drawing.inf H C P + have hI_U : I.U = C.U ∩ P.U := Drawing.inf_U hC (walkDrawing_isSubdrawing H _) + have hP_U : P.U = P₁.U ∪ P₂.U := walkDrawing_append_U H W₁ W₂ + have hP12_inter : P₁.U ∩ P₂.U = {v} := walkDrawing_append_U_inter W₁ W₂ hWs + have hI_pre : IsPreconnected I.U := hinf.isPreconnected_U + by_contra hnot_disj + obtain ⟨y, hy₂, hyC⟩ := not_disjoint_iff.mp hnot_disj + obtain ⟨x, hx₁, hxC⟩ := hmeet₁ + have hxI : x ∈ I.U := by + rw [hI_U, hP_U] + exact ⟨hxC, Or.inl hx₁⟩ + have hyI : y ∈ I.U := by + rw [hI_U, hP_U] + exact ⟨hyC, Or.inr hy₂⟩ + have hI_sub : I.U ⊆ P₁.U ∪ P₂.U := by + rw [hI_U, hP_U] + exact inter_subset_right + obtain ⟨z, hzI, hz₁, hz₂⟩ := + isPreconnected_closed_iff.mp hI_pre P₁.U P₂.U P₁.isClosed_U P₂.isClosed_U hI_sub + ⟨x, hxI, hx₁⟩ ⟨y, hyI, hy₂⟩ + have hzv : z = v := by + have : z ∈ P₁.U ∩ P₂.U := ⟨hz₁, hz₂⟩ + rwa [hP12_inter, mem_singleton_iff] at this + subst hzv + rw [hI_U] at hzI + exact hv_not hzI.1 + +/-- If `P : Fin r → Drawing S` is a family of pairwise vertex-disjoint paths in `H`, +`P_sub.IsSubdrawing (P i)`, `Q.IsSubdrawing H` is a path between `v` and `v'` with `v ∈ (P i).V`, +and `(H.sup P_sub Q).IsCircuit`, then `Q` has an edge `e₀ ∈ Q.E` not belonging to `(P m).E` for any +`m : Fin r`. -/ +theorem exists_edge_not_in_paths_of_theta {r : ℕ} {H : Drawing S} {P : Fin r → Drawing S} + (hPH : ∀ m, (P m).IsSubdrawing H) + (hP_path : ∀ m, ∃ a b, (P m).IsPathBetween a b) + (hP_disj : Pairwise (fun m₁ m₂ => Disjoint (P m₁).V (P m₂).V)) + {i : Fin r} {P_sub Q : Drawing S} {v v' : S} (hvv' : v ≠ v') + (hP_sub : P_sub.IsSubdrawing (P i)) (hQ_H : Q.IsSubdrawing H) + (hQ_path : Q.IsPathBetween v v') (hv_Pi : v ∈ (P i).V) + (hcirc : (H.sup P_sub Q).IsCircuit) : + ∃ e₀ ∈ Q.E, ∀ m : Fin r, e₀ ∉ (P m).E := by + by_contra hall + push Not at hall + have hwalk_in_Pi : ∀ {x y : S} (W : GraphWalk H.toGraph x y), + x ∈ (P i).V → (∀ e ∈ W.edges, ∃ m : Fin r, e ∈ (P m).E) → + (∀ z ∈ W.support, z ∈ (P i).V) ∧ (∀ e ∈ W.edges, e ∈ (P i).E) := by + intro x y W hx hed + induction W with + | @nil u _ => + exact ⟨fun z hz => (List.mem_singleton.mp hz) ▸ hx, fun e he => (List.not_mem_nil he).elim⟩ + | @cons u w _ e hl r ih => + obtain ⟨m, hem⟩ := hed e List.mem_cons_self + have hl_m : (P m).toGraph.IsLink e u w := ((hPH m).isLink_iff hem).mpr hl + have hu_m : u ∈ (P m).V := hl_m.2.1 + have hmi : m = i := by + by_contra hne + exact disjoint_left.mp (hP_disj hne) hu_m hx + subst m + have hw_i : w ∈ (P i).V := hl_m.2.2.1 + obtain ⟨hsupp, hedges⟩ := ih hw_i (fun f hf => hed f (List.mem_cons_of_mem _ hf)) + refine ⟨fun z hz => ?_, fun f hf => ?_⟩ + · rcases List.mem_cons.mp hz with rfl | hzr + · exact hx + · exact hsupp z hzr + · rcases List.mem_cons.mp hf with rfl | hfr + · exact hem + · exact hedges f hfr + obtain ⟨WQ₀, _, hVQ, hEQ⟩ := hQ_path + obtain ⟨WQ, hsQ, heQ⟩ := hQ_H.exists_walk_up WQ₀ + have hed_WQ : ∀ e ∈ WQ.edges, ∃ m : Fin r, e ∈ (P m).E := by + intro e he + have he_Q : e ∈ Q.E := by rw [hEQ, mem_ofPred_eq, ← heQ]; exact he + exact hall e he_Q + obtain ⟨hsupp_Pi, hedges_Pi⟩ := hwalk_in_Pi WQ hv_Pi hed_WQ + have hQ_sub_Pi : Q.IsSubdrawing (P i) := by + refine ⟨fun z hz => ?_, fun e he => ?_⟩ + · rw [hVQ, mem_ofPred_eq, ← hsQ] at hz + exact hsupp_Pi z hz + · rw [hEQ, mem_ofPred_eq, ← heQ] at he + exact hedges_Pi e he + have hsup_U : (H.sup P_sub Q).U ⊆ (P i).U := by + rw [Drawing.sup_U (hP_sub.trans (hPH i)) hQ_H] + exact union_subset hP_sub.U_subset hQ_sub_Pi.U_subset + obtain ⟨a_i, b_i, hPi_path⟩ := hP_path i + have hab_ne : a_i ≠ b_i := by + rintro rfl + obtain ⟨W₀, hW₀, hPV₀, _⟩ := hPi_path + have hlen : W₀.length = 0 := hW₀.length_eq_zero + have hsupp₀ : W₀.support = [a_i] := by + cases W₀ with + | nil _ => rfl + | cons _ _ => simp [GraphWalk.length] at hlen + have hv'_Pi : v' ∈ (P i).V := hQ_sub_Pi.1 (by rw [hVQ]; exact WQ₀.end_mem_support) + rw [hPV₀, hsupp₀] at hv_Pi hv'_Pi + exact hvv' ((List.mem_singleton.mp hv_Pi).trans (List.mem_singleton.mp hv'_Pi).symm) + exact GM14.no_circuit_in_path hPi_path hab_ne hcirc hsup_U + +/-- If `A₀, A₁, A₂` form a theta graph between `a ≠ b` in a closed surface `S`, and `Δ₀, Δ₁, Δ₂` are +closed discs with `frontier Δ₀ = A₁ ∪ A₂`, `frontier Δ₁ = A₂ ∪ A₀`, `frontier Δ₂ = A₀ ∪ A₁` such +that `¬ A₀ ⊆ Δ₀` and `¬ A₁ ⊆ Δ₁`, then `Δ₀ ∩ Δ₁ = A₂`, `Disjoint (A₀ \ {a, b}) Δ₀`, +`Disjoint (A₁ \ {a, b}) Δ₁`, and `Δ₀ ∪ Δ₁` is a closed disc with `discBd (Δ₀ ∪ Δ₁) = discBd Δ₂`. -/ +theorem theta_inner_chord_split (hS : IsClosedSurface S) {A₀ A₁ A₂ Δ₀ Δ₁ Δ₂ : Set S} {a b : S} + (l₀ : IsLineWithEnds A₀ a b) (l₁ : IsLineWithEnds A₁ a b) (l₂ : IsLineWithEnds A₂ a b) + (i₀₁ : A₀ ∩ A₁ = {a, b}) (i₁₂ : A₁ ∩ A₂ = {a, b}) (i₂₀ : A₂ ∩ A₀ = {a, b}) + (d₀ : IsClosedDisc Δ₀) (d₁ : IsClosedDisc Δ₁) (d₂ : IsClosedDisc Δ₂) + (f₀ : frontier Δ₀ = A₁ ∪ A₂) (f₁ : frontier Δ₁ = A₂ ∪ A₀) (f₂ : frontier Δ₂ = A₀ ∪ A₁) + (h₀ : ¬ A₀ ⊆ Δ₀) (h₁ : ¬ A₁ ⊆ Δ₁) : + IsClosedDisc (Δ₀ ∪ Δ₁) ∧ discBd (Δ₀ ∪ Δ₁) = discBd Δ₂ ∧ + Δ₀ ∩ Δ₁ = A₂ ∧ Disjoint (A₀ \ {a, b}) Δ₀ ∧ Disjoint (A₁ \ {a, b}) Δ₁ := by + obtain ⟨dU, hbd, hcap, out₀, out₁⟩ := + GM11.theta_glue_discs hS l₀ l₁ l₂ i₀₁ i₁₂ i₂₀ d₀ d₁ f₀ f₁ h₀ h₁ + exact ⟨dU, hbd.trans (f₂.symm.trans (GM11.IsClosedDisc.frontier_eq_discBd hS d₂)), + hcap, out₀, out₁⟩ + +theorem discIns_mono {Δ_out : Set S} (hΔ_out : IsClosedDisc Δ_out) {C₁ C₂ : Drawing S} + (hC₁ : C₁.IsCircuit) (hC₁_U : C₁.U ⊆ Δ_out) + (hC₂ : C₂.IsCircuit) (hC₂_U : C₂.U ⊆ Δ_out) + (hsub : C₁.U ⊆ GM14.discIns Δ_out C₂) : + GM14.discIns Δ_out C₁ ⊆ GM14.discIns Δ_out C₂ := by + obtain ⟨_, huniq₁⟩ := GM14.discIns_spec hΔ_out hC₁ hC₁_U + obtain ⟨⟨h2, hdisc₂, _⟩, _⟩ := GM14.discIns_spec hΔ_out hC₂ hC₂_U + obtain ⟨D, ⟨hD₂, dD, bD, -⟩, -⟩ := + disc_oArc (GM14.discIns Δ_out C₂) C₁.U hdisc₂ hsub (GM14.isOArc_of_isCircuit hC₁) + have heq : D = GM14.discIns Δ_out C₁ := huniq₁ D (hD₂.trans h2) dD bD + exact heq ▸ hD₂ + +omit [T2Space S] in +/-- **Move 1 (Boundary shortening move, GM03 (4.1) paragraph 2, page 60)**: +Replacing `P i` by a subdrawing `P'_i` of `P i` that omits an edge `e ∈ (P i).E` not belonging to +any `(C m).E` preserves pairwise vertex-disjointness and strictly decreases `totalDrawingEdges C P`. +-/ +theorem totalDrawingEdges_lt_of_replace_subpath {s r : ℕ} [DecidableEq (Fin r)] {H : Drawing S} + {C : Fin s → Drawing S} {P : Fin r → Drawing S} + (hCH : ∀ m, (C m).IsSubdrawing H) (hPH : ∀ k, (P k).IsSubdrawing H) + (hP_disj : Pairwise (fun k₁ k₂ => Disjoint (P k₁).V (P k₂).V)) + {i : Fin r} {P'_i : Drawing S} (hP'_sub : P'_i.IsSubdrawing (P i)) + {e : Set S} (he_Pi : e ∈ (P i).E) (he_not_P' : e ∉ P'_i.E) + (he_not_C : ∀ m : Fin s, e ∉ (C m).E) : + Pairwise (fun k₁ k₂ => Disjoint (Function.update P i P'_i k₁).V (Function.update P i P'_i + k₂).V) ∧ + totalDrawingEdges C (Function.update P i P'_i) < totalDrawingEdges C P := by + refine ⟨?_, ?_⟩ + · intro k₁ k₂ hk₁₂ + by_cases hk₁ : k₁ = i + · subst hk₁ + rw [Function.update_self, Function.update_of_ne hk₁₂.symm] + exact disjoint_of_subset_left hP'_sub.1 (hP_disj hk₁₂) + · by_cases hk₂ : k₂ = i + · subst hk₂ + rw [Function.update_of_ne hk₁, Function.update_self] + exact disjoint_of_subset_right hP'_sub.1 (hP_disj hk₁₂) + · rw [Function.update_of_ne hk₁, Function.update_of_ne hk₂] + exact hP_disj hk₁₂ + · change totalUnionEdges (Drawing.toGraph ∘ C) (Drawing.toGraph ∘ Function.update P i P'_i) < + totalUnionEdges (Drawing.toGraph ∘ C) (Drawing.toGraph ∘ P) + rw [Function.comp_update] + exact totalUnionEdges_lt_of_replace_subpath H.finite_edges (fun m => (hCH m).toGraph_le) + (fun k => (hPH k).toGraph_le) hP_disj hP'_sub.toGraph_le he_Pi he_not_P' he_not_C + +/-- If `P` is a path in `H` from `a ∈ C.V` to `b` and `Drawing.inf H C P` is not a path, then there +is a subdrawing `P' ≤ P` which is a path from some `v ∈ C.V` to `b` and omits an edge `e ∈ P.E \ +C.E` +incident with some `u ∈ C.V`. -/ +theorem exists_shorter_subpath_of_not_isDrawingPath_inf {H C P : Drawing S} + (hC : C.IsSubdrawing H) (hP : P.IsSubdrawing H) + {a b : S} (hP_path : P.IsPathBetween a b) (ha : a ∈ C.V) + (hnot : ¬ IsDrawingPath (Drawing.inf H C P)) : + ∃ u ∈ C.V, ∃ v ∈ C.V, ∃ e ∈ P.E, e ∉ C.E ∧ (∃ w : S, H.toGraph.IsLink e u w) ∧ + ∃ P' : Drawing S, P'.IsSubdrawing P ∧ P'.IsPathBetween v b ∧ e ∉ P'.E := by + have haP : a ∈ P.V := by + obtain ⟨W₀, _, hVP, _⟩ := hP_path + rw [hVP]; exact W₀.start_mem_support + rcases path_inf_isPath_or_exists_detour hC hP hP_path ⟨a, ha, haP⟩ with + hpath | ⟨u, ⟨huC, _⟩, v, ⟨hvC, _⟩, _, W₁, W_sub, W₂, hWs, hP_eq, _, hEC, e, he_sub, w, hl⟩ + · exact (hnot hpath).elim + · have hsp1 := isSimple_of_append hWs + have hsp2 := isSimple_of_append hsp1.2 + have hnd_E : (W₁.edges ++ (W_sub.edges ++ W₂.edges)).Nodup := by + have h := hWs.edges_nodup + rwa [GraphWalk.edges_append, GraphWalk.edges_append] at h + have hd₁ := List.nodup_append.mp hnd_E + have hd₂ := List.nodup_append.mp hd₁.2.1 + let P' := walkDrawing H W₂ + have hP'_sub : P'.IsSubdrawing P := by + rw [hP_eq] + refine ⟨fun x hx => ?_, fun f hf => ?_⟩ + · rw [walkDrawing_V, mem_ofPred_eq] at hx ⊢ + rw [GraphWalk.mem_support_append, GraphWalk.mem_support_append] + exact Or.inr (Or.inr hx) + · rw [walkDrawing_E, mem_ofPred_eq] at hf ⊢ + rw [GraphWalk.edges_append, GraphWalk.edges_append, + List.mem_append, List.mem_append] + exact Or.inr (Or.inr hf) + have he_P : e ∈ P.E := by + rw [walkDrawing_E, mem_ofPred_eq] at he_sub + rw [hP_eq, walkDrawing_E, mem_ofPred_eq, GraphWalk.edges_append, + GraphWalk.edges_append, List.mem_append, List.mem_append] + exact Or.inr (Or.inl he_sub) + have heC : e ∉ C.E := disjoint_left.mp hEC he_sub + have he_not_P' : e ∉ P'.E := by + rw [walkDrawing_E, mem_ofPred_eq] at he_sub ⊢ + exact fun he_W₂ => hd₂.2.2 e he_sub e he_W₂ rfl + exact ⟨u, huC, v, hvC, e, he_P, heC, ⟨w, hl⟩, P', hP'_sub, + walkDrawing_isPathBetween H hsp2.2, he_not_P'⟩ + +/-- A nested sequence `C : Fin s → Drawing S` of `s` pairwise vertex-disjoint circuits of `H` in a +closed disc `Δ_out`, indexed from inner (`C 0 = C_in`) to outer (`C (s - 1) = C_out`). -/ +def IsDiscNest {s : ℕ} (H : Drawing S) (Δ_out : Set S) (C_in C_out : Drawing S) + (C : Fin s → Drawing S) : Prop := + (∀ j : Fin s, (C j).IsSubdrawing H ∧ (C j).IsCircuit ∧ (C j).U ⊆ Δ_out) ∧ + Pairwise (fun j₁ j₂ : Fin s => Disjoint (C j₁).V (C j₂).V) ∧ + Monotone (fun j : Fin s => GM14.discIns Δ_out (C j)) ∧ + (∀ hs : 0 < s, C ⟨0, hs⟩ = C_in ∧ C ⟨s - 1, Nat.sub_lt hs zero_lt_one⟩ = C_out) + +/-- A family `P : Fin r → Drawing S` of `r` pairwise vertex-disjoint paths of `H` in `Δ_out`, each +between `C_in.V` and `C_out.V`. -/ +def IsDiscPaths {r : ℕ} (H : Drawing S) (Δ_out : Set S) (C_in C_out : Drawing S) + (P : Fin r → Drawing S) : Prop := + (∀ i : Fin r, (P i).IsSubdrawing H ∧ (P i).U ⊆ Δ_out ∧ + ∃ a ∈ C_in.V, ∃ b ∈ C_out.V, (P i).IsPathBetween a b) ∧ + Pairwise (fun i₁ i₂ : Fin r => Disjoint (P i₁).V (P i₂).V) + +theorem IsDiscNest.disc_props {s : ℕ} {H : Drawing S} {Δ_out : Set S} {C_in C_out : Drawing S} + {C : Fin s → Drawing S} (hS : IsClosedSurface S) (hΔ_out : IsClosedDisc Δ_out) + (hC : IsDiscNest H Δ_out C_in C_out C) (m : Fin s) : + GM14.discIns Δ_out (C m) ⊆ Δ_out ∧ + IsClosedDisc (GM14.discIns Δ_out (C m)) ∧ + discBd (GM14.discIns Δ_out (C m)) = (C m).U ∧ + frontier (GM14.discIns Δ_out (C m)) = (C m).U ∧ + IsClosed (GM14.discIns Δ_out (C m)) ∧ + (C m).U ⊆ GM14.discIns Δ_out (C m) := by + obtain ⟨⟨hsub, hdisc, hbd⟩, _⟩ := GM14.discIns_spec hΔ_out (hC.1 m).2.1 (hC.1 m).2.2 + have hfr : frontier (GM14.discIns Δ_out (C m)) = (C m).U := + (GM14.IsClosedDisc.frontier_eq_discBd hS hdisc).trans hbd + have hcl : IsClosed (GM14.discIns Δ_out (C m)) := hdisc.isCompact.isClosed + exact ⟨hsub, hdisc, hbd, hfr, hcl, hfr ▸ hcl.frontier_subset⟩ + +omit [T2Space S] in +theorem IsDiscNest.disjoint_U {s : ℕ} {H : Drawing S} {Δ_out : Set S} {C_in C_out : Drawing S} + {C : Fin s → Drawing S} (hC : IsDiscNest H Δ_out C_in C_out C) + {m₁ m₂ : Fin s} (hne : m₁ ≠ m₂) : + Disjoint (C m₁).E (C m₂).E ∧ Disjoint (C m₁).U (C m₂).U := by + have hE := disjoint_E_of_disjoint_V (hC.1 m₁).1 (hC.1 m₂).1 (hC.2.1 hne) + refine ⟨hE, ?_⟩ + rw [Set.disjoint_iff_inter_eq_empty, GM14.U_inter_of_disjoint (hC.1 m₁).1 (hC.1 m₂).1 hE, + ← Set.disjoint_iff_inter_eq_empty] + exact hC.2.1 hne + +theorem IsDiscNest.discIns_subset_diff {s : ℕ} {H : Drawing S} {Δ_out : Set S} + {C_in C_out : Drawing S} {C : Fin s → Drawing S} + (hS : IsClosedSurface S) (hΔ_out : IsClosedDisc Δ_out) + (hC : IsDiscNest H Δ_out C_in C_out C) {m₁ m₂ : Fin s} (hlt : m₁ < m₂) : + Disjoint (GM14.discIns Δ_out (C m₁)) (C m₂).U ∧ + GM14.discIns Δ_out (C m₁) ⊆ GM14.discIns Δ_out (C m₂) \ (C m₂).U := by + have hp₁ := hC.disc_props hS hΔ_out m₁ + have hp₂ := hC.disc_props hS hΔ_out m₂ + have hsub : GM14.discIns Δ_out (C m₁) ⊆ GM14.discIns Δ_out (C m₂) := hC.2.2.1 hlt.le + have hdisj_U := (hC.disjoint_U hlt.ne).2 + have hdisj : Disjoint (GM14.discIns Δ_out (C m₁)) (C m₂).U := by + refine disjoint_left.mpr fun x hx₁ hx₂ => ?_ + have hx_fr₂ : x ∈ frontier (GM14.discIns Δ_out (C m₂)) := hp₂.2.2.2.1.symm ▸ hx₂ + have hx_fr₁ : x ∈ frontier (GM14.discIns Δ_out (C m₁)) := + frontier_inter_subset_frontier_of_subset hsub ⟨hx₁, hx_fr₂⟩ + rw [hp₁.2.2.2.1] at hx_fr₁ + exact disjoint_left.mp hdisj_U hx_fr₁ hx₂ + exact ⟨hdisj, fun x hx => ⟨hsub hx, disjoint_left.mp hdisj hx⟩⟩ + +theorem IsDiscNest.discIns_last_eq {s : ℕ} {H : Drawing S} {Δ_out : Set S} + {C_in C_out : Drawing S} {C : Fin s → Drawing S} (hs : 0 < s) + (hΔ_out : IsClosedDisc Δ_out) (hbd_out : discBd Δ_out = C_out.U) + (hC : IsDiscNest H Δ_out C_in C_out C) : + GM14.discIns Δ_out (C ⟨s - 1, Nat.sub_lt hs zero_lt_one⟩) = Δ_out := by + let m_last : Fin s := ⟨s - 1, Nat.sub_lt hs zero_lt_one⟩ + obtain ⟨_, huniq⟩ := GM14.discIns_spec hΔ_out (hC.1 m_last).2.1 (hC.1 m_last).2.2 + refine (huniq Δ_out Subset.rfl hΔ_out ?_).symm + rw [(hC.2.2.2 hs).2, hbd_out] + +/-- **Move 1 step**: if `Drawing.inf H (C 0) (P i)` or `Drawing.inf H (C (s - 1)) (P i)` is not a +path, shortening `P i` produces a valid path family `P'` with strictly fewer total edges. -/ +theorem move1_step {s r : ℕ} {H : Drawing S} {Δ_out : Set S} + {C_in C_out : Drawing S} {C : Fin s → Drawing S} {P : Fin r → Drawing S} + (hs : 0 < s) (hC : IsDiscNest H Δ_out C_in C_out C) + (hP : IsDiscPaths H Δ_out C_in C_out P) {i : Fin r} + (hnot : ¬ IsDrawingPath (Drawing.inf H (C ⟨0, hs⟩) (P i)) ∨ + ¬ IsDrawingPath (Drawing.inf H (C ⟨s - 1, Nat.sub_lt hs zero_lt_one⟩) (P i))) : + ∃ P' : Fin r → Drawing S, + IsDiscPaths H Δ_out C_in C_out P' ∧ totalDrawingEdges C P' < totalDrawingEdges C P := by + obtain ⟨hPi_H, hPi_U, a, ha, b, hb, hPi_path⟩ := hP.1 i + obtain ⟨hC0_eq, hCs_eq⟩ := hC.2.2.2 hs + rcases hnot with hnot0 | hnots + · have ha0 : a ∈ (C ⟨0, hs⟩).V := hC0_eq.symm ▸ ha + obtain ⟨u, huC, v, hvC, e, he_Pi, he_not_C0, ⟨w, hl⟩, P'_i, hP'_sub, hP'_path, he_not_P'⟩ := + exists_shorter_subpath_of_not_isDrawingPath_inf (hC.1 ⟨0, hs⟩).1 hPi_H hPi_path ha0 hnot0 + have he_not_C : ∀ m : Fin s, e ∉ (C m).E := by + intro m hem + by_cases hm0 : m = ⟨0, hs⟩ + · exact he_not_C0 (hm0 ▸ hem) + · have hlm : (C m).toGraph.IsLink e u w := ((hC.1 m).1.isLink_iff hem).mpr hl + exact disjoint_left.mp (hC.2.1 hm0) hlm.2.1 huC + obtain ⟨hdisj', hlt⟩ := + totalDrawingEdges_lt_of_replace_subpath (fun m => (hC.1 m).1) (fun k => (hP.1 k).1) + hP.2 hP'_sub he_Pi he_not_P' he_not_C + refine ⟨Function.update P i P'_i, ⟨fun k => ?_, hdisj'⟩, hlt⟩ + by_cases hki : k = i + · subst hki + rw [Function.update_self] + exact ⟨hP'_sub.trans hPi_H, hP'_sub.U_subset.trans hPi_U, v, hC0_eq ▸ hvC, b, hb, hP'_path⟩ + · rw [Function.update_of_ne hki] + exact hP.1 k + · let m_last : Fin s := ⟨s - 1, Nat.sub_lt hs zero_lt_one⟩ + have hbs : b ∈ (C m_last).V := hCs_eq.symm ▸ hb + obtain ⟨u, huC, v, hvC, e, he_Pi, he_not_Cs, ⟨w, hl⟩, P'_i, hP'_sub, hP'_path, he_not_P'⟩ := + exists_shorter_subpath_of_not_isDrawingPath_inf (hC.1 m_last).1 hPi_H + (Drawing.IsPathBetween.symm hPi_path) hbs hnots + have he_not_C : ∀ m : Fin s, e ∉ (C m).E := by + intro m hem + by_cases hms : m = m_last + · exact he_not_Cs (hms ▸ hem) + · have hlm : (C m).toGraph.IsLink e u w := ((hC.1 m).1.isLink_iff hem).mpr hl + exact disjoint_left.mp (hC.2.1 hms) hlm.2.1 huC + obtain ⟨hdisj', hlt⟩ := + totalDrawingEdges_lt_of_replace_subpath (fun m => (hC.1 m).1) (fun k => (hP.1 k).1) + hP.2 hP'_sub he_Pi he_not_P' he_not_C + refine ⟨Function.update P i P'_i, ⟨fun k => ?_, hdisj'⟩, hlt⟩ + by_cases hki : k = i + · subst hki + rw [Function.update_self] + exact ⟨hP'_sub.trans hPi_H, hP'_sub.U_subset.trans hPi_U, a, ha, v, hCs_eq ▸ hvC, + Drawing.IsPathBetween.symm hP'_path⟩ + · rw [Function.update_of_ne hki] + exact hP.1 k + +private theorem replace_nest_circuit_of_outer_detour + {s r : ℕ} (hS : IsClosedSurface S) {H P_sub : Drawing S} {Δ_out : Set S} + (hΔ_out : IsClosedDisc Δ_out) {C_in C_out : Drawing S} + {C : Fin s → Drawing S} {P : Fin r → Drawing S} + (hC : IsDiscNest H Δ_out C_in C_out C) (hP : IsDiscPaths H Δ_out C_in C_out P) + {j : Fin s} (hj0 : 0 < j.1) (hj1 : j.1 + 1 < s) {i : Fin r} {v v' : S} + (hvv' : v ≠ v') (hP_sub_Pi : P_sub.IsSubdrawing (P i)) + (hv_Pi : v ∈ (P i).V) + (hP_sub_in_next : P_sub.U ⊆ GM14.discIns Δ_out (C ⟨j.1 + 1, hj1⟩)) + (hdisj_sub_other_C : ∀ m : Fin s, m ≠ j → Disjoint P_sub.V (C m).V) : + ∀ (Q_k Q_other : Drawing S), + Q_k.IsSubdrawing (C j) → Q_other.IsSubdrawing (C j) → + Q_other.IsPathBetween v v' → Disjoint Q_k.E Q_other.E → + (H.sup P_sub Q_k).IsCircuit → (H.sup P_sub Q_other).IsCircuit → + GM14.discIns Δ_out (C j) ⊆ GM14.discIns Δ_out (H.sup P_sub Q_k) → + IsDiscNest H Δ_out C_in C_out (Function.update C j (H.sup P_sub Q_k)) ∧ + (∀ m : Fin s, GM14.discIns Δ_out (C m) ⊆ + GM14.discIns Δ_out (Function.update C j (H.sup P_sub Q_k) m)) ∧ + totalDrawingEdges (Function.update C j (H.sup P_sub Q_k)) P < totalDrawingEdges C P := by + let j_next : Fin s := ⟨j.1 + 1, hj1⟩ + have hj_lt_next : j < j_next := by change j.1 < j.1 + 1; omega + have hp_j := hC.disc_props hS hΔ_out j + have hp_next := hC.disc_props hS hΔ_out j_next + have hP_sub_H := hP_sub_Pi.trans (hP.1 i).1 + intro Q_k Q_other hQk_s hQo_s hQo_path hQ_disjE hcirc_k hcirc_o hsub_j + let C'_j := H.sup P_sub Q_k + have hQk_H : Q_k.IsSubdrawing H := hQk_s.trans (hC.1 j).1 + have hQo_H : Q_other.IsSubdrawing H := hQo_s.trans (hC.1 j).1 + have hC'_H : C'_j.IsSubdrawing H := H.sup_isSubdrawing P_sub Q_k + have hC'_U_next : C'_j.U ⊆ GM14.discIns Δ_out (C j_next) := by + rw [Drawing.sup_U hP_sub_H hQk_H] + refine union_subset hP_sub_in_next ?_ + exact hQk_s.U_subset.trans (hp_j.2.2.2.2.2.trans (hC.2.2.1 hj_lt_next.le)) + have hC'_U_out : C'_j.U ⊆ Δ_out := hC'_U_next.trans hp_next.1 + have hsub_next : GM14.discIns Δ_out C'_j ⊆ GM14.discIns Δ_out (C j_next) := + discIns_mono hΔ_out hcirc_k hC'_U_out (hC.1 j_next).2.1 (hC.1 j_next).2.2 hC'_U_next + obtain ⟨e₀, he₀_Qo, he₀_not_P⟩ := + exists_edge_not_in_paths_of_theta (fun m => (hP.1 m).1) + (fun m => by obtain ⟨a, _, b, _, hp⟩ := (hP.1 m).2.2; exact ⟨a, b, hp⟩) + hP.2 hvv' hP_sub_Pi hQo_H hQo_path hv_Pi hcirc_o + have hlt_edges := + totalDrawingEdges_lt_of_replace_circuit (fun m => (hC.1 m).1) (fun m => (hP.1 m).1) + hC.2.1 hP_sub_Pi hQk_s hQo_s hQ_disjE he₀_Qo he₀_not_P + refine ⟨⟨?_, ?_, ?_, ?_⟩, ?_, hlt_edges⟩ + · intro m + by_cases hmj : m = j + · subst hmj + rw [Function.update_self] + exact ⟨hC'_H, hcirc_k, hC'_U_out⟩ + · rw [Function.update_of_ne hmj] + exact hC.1 m + · intro m₁ m₂ hm₁₂ + by_cases hm₁ : m₁ = j + · subst hm₁ + have hm₂ : m₂ ≠ m₁ := hm₁₂.symm + rw [Function.update_self, Function.update_of_ne hm₂, H.sup_V hP_sub_H hQk_H] + exact disjoint_union_left.mpr + ⟨hdisj_sub_other_C m₂ hm₂, disjoint_of_subset_left hQk_s.1 (hC.2.1 hm₁₂)⟩ + · by_cases hm₂ : m₂ = j + · subst hm₂ + rw [Function.update_of_ne hm₁, Function.update_self, H.sup_V hP_sub_H hQk_H] + exact disjoint_union_right.mpr + ⟨(hdisj_sub_other_C m₁ hm₁).symm, disjoint_of_subset_right hQk_s.1 (hC.2.1 hm₁₂)⟩ + · rw [Function.update_of_ne hm₁, Function.update_of_ne hm₂] + exact hC.2.1 hm₁₂ + · intro m₁ m₂ hm₁₂ + dsimp only + by_cases hm₁ : m₁ = j + · subst hm₁ + rw [Function.update_self] + by_cases hm₂ : m₂ = m₁ + · subst hm₂; rw [Function.update_self] + · rw [Function.update_of_ne hm₂] + have hnext_le_m₂ : j_next ≤ m₂ := by + change m₁.1 + 1 ≤ m₂.1 + have : m₁ < m₂ := lt_of_le_of_ne hm₁₂ (Ne.symm hm₂) + exact this + exact hsub_next.trans (hC.2.2.1 hnext_le_m₂) + · rw [Function.update_of_ne hm₁] + by_cases hm₂ : m₂ = j + · subst hm₂ + rw [Function.update_self] + exact (hC.2.2.1 hm₁₂).trans hsub_j + · rw [Function.update_of_ne hm₂] + exact hC.2.2.1 hm₁₂ + · intro hs' + have h0_ne_j : (⟨0, hs'⟩ : Fin s) ≠ j := fun h => by + have := congrArg Fin.val h; dsimp at this; omega + have hlast_ne_j : (⟨s - 1, Nat.sub_lt hs' zero_lt_one⟩ : Fin s) ≠ j := fun h => by + have := congrArg Fin.val h; dsimp at this; omega + rw [Function.update_of_ne h0_ne_j, Function.update_of_ne hlast_ne_j] + exact hC.2.2.2 hs' + · intro m + by_cases hmj : m = j + · subst hmj; rw [Function.update_self]; exact hsub_j + · rw [Function.update_of_ne hmj] + +private theorem detour_replacement_circuits {H C P : Drawing S} {v v' : S} + (hC : C.IsCircuit) (hCH : C.IsSubdrawing H) (hPH : P.IsSubdrawing H) + (hP : P.IsPathBetween v v') (hvC : v ∈ C.V) (hv'C : v' ∈ C.V) (hvv' : v ≠ v') + (hVC : P.V ∩ C.V = {v, v'}) (hEC : Disjoint P.E C.E) : + ∃ Q₁ Q₂ : Drawing S, Q₁.IsPathBetween v v' ∧ Q₂.IsPathBetween v v' ∧ + Q₁.IsSubdrawing C ∧ Q₂.IsSubdrawing C ∧ Q₁.IsSubdrawing H ∧ Q₂.IsSubdrawing H ∧ + Q₁.V ∩ Q₂.V = {v, v'} ∧ Disjoint Q₁.E Q₂.E ∧ C.U = Q₁.U ∪ Q₂.U ∧ + P.V ∩ Q₁.V = {v, v'} ∧ Q₂.V ∩ P.V = {v, v'} ∧ + Disjoint P.E Q₁.E ∧ Disjoint Q₂.E P.E ∧ + (H.sup P Q₁).IsCircuit ∧ (H.sup P Q₂).IsCircuit := by + obtain ⟨Q₁, Q₂, hp₁, hp₂, hs₁, hs₂, _, _, hV, hE, hsup⟩ := hC.exists_two_paths hvC hv'C hvv' + have hEnds {Q : Drawing S} (hQ : Q.IsPathBetween v v') : ({v, v'} : Set S) ⊆ Q.V := by + obtain ⟨W, _, hW, _⟩ := hQ + rw [hW] + rintro z (rfl | rfl) + · exact W.start_mem_support + · exact W.end_mem_support + have hMeet {Q : Drawing S} (hQ : Q.IsPathBetween v v') (hs : Q.IsSubdrawing C) : + P.V ∩ Q.V = {v, v'} := by + refine subset_antisymm ?_ (subset_inter (hEnds hP) (hEnds hQ)) + rw [← hVC] + exact fun _ hx ↦ ⟨hx.1, hs.1 hx.2⟩ + have hV₁ := hMeet hp₁ hs₁ + have hV₂ := hMeet hp₂ hs₂ + have hE₁ := disjoint_of_subset_right hs₁.2 hEC + have hE₂ := disjoint_of_subset_right hs₂.2 hEC + have hH₁ := hs₁.trans hCH + have hH₂ := hs₂.trans hCH + refine ⟨Q₁, Q₂, hp₁, hp₂, hs₁, hs₂, hH₁, hH₂, hV, hE, ?_, hV₁, + (inter_comm _ _).trans hV₂, hE₁, hE₂.symm, ?_, ?_⟩ + · rw [← hsup, Drawing.sup_U hs₁ hs₂] + · exact Drawing.isCircuit_sup hP hp₁ hPH hH₁ hvv' hV₁ hE₁ + · exact Drawing.isCircuit_sup hP hp₂ hPH hH₂ hvv' hV₂ hE₂ + +/-- **Move 2 step (Outer detour replacement, GM03 (4.1) paragraph 4, page 60)**: +When `0 < j.1`, `j.1 + 1 < s`, `Drawing.inf H (C ⟨j.1 + 1, _⟩) (P i)` is a path, and `P i` +(oriented from `b_i ∈ C_out.V` to `a_i ∈ C_in.V`) has an outer detour `W_sub` on `C j` +(`¬ (walkDrawing H W_sub).U ⊆ discIns Δ_out (C j)`), replacing `C j` by one of `H.sup P_sub Q₁` or +`H.sup P_sub Q₂` preserves `IsDiscNest` and strictly decreases `totalDrawingEdges`. -/ +theorem move2_outer_detour {s r : ℕ} (hS : IsClosedSurface S) + {H : Drawing S} {Δ_out : Set S} (hΔ_out : IsClosedDisc Δ_out) + {C_in C_out : Drawing S} (_hbd_out : discBd Δ_out = C_out.U) + {C : Fin s → Drawing S} {P : Fin r → Drawing S} + (hs : 0 < s) (hC : IsDiscNest H Δ_out C_in C_out C) + (hP : IsDiscPaths H Δ_out C_in C_out P) + {j : Fin s} (hj0 : 0 < j.1) (hj1 : j.1 + 1 < s) {i : Fin r} + (hinf_next : IsDrawingPath (Drawing.inf H (C ⟨j.1 + 1, hj1⟩) (P i))) + {a_i b_i v v' : S} (hb_i : b_i ∈ C_out.V) + {W : GraphWalk H.toGraph b_i a_i} (hWs : W.IsSimple) (hPi_eq : P i = walkDrawing H W) + (hvC : v ∈ (C j).V) (hv'C : v' ∈ (C j).V) (hvv' : v ≠ v') + {W₁ : GraphWalk H.toGraph b_i v} {W_sub : GraphWalk H.toGraph v v'} + {W₂ : GraphWalk H.toGraph v' a_i} (hW_eq : W = W₁.append (W_sub.append W₂)) + (hVC : (walkDrawing H W_sub).V ∩ (C j).V = {v, v'}) + (hEC : Disjoint (walkDrawing H W_sub).E (C j).E) + (hnot_in : ¬ (walkDrawing H W_sub).U ⊆ GM14.discIns Δ_out (C j)) : + ∃ C' : Fin s → Drawing S, + IsDiscNest H Δ_out C_in C_out C' ∧ + (∀ m : Fin s, GM14.discIns Δ_out (C m) ⊆ GM14.discIns Δ_out (C' m)) ∧ + totalDrawingEdges C' P < totalDrawingEdges C P := by + let j_prev : Fin s := ⟨j.1 - 1, by omega⟩ + let j_next : Fin s := ⟨j.1 + 1, hj1⟩ + let m_last : Fin s := ⟨s - 1, Nat.sub_lt hs zero_lt_one⟩ + have hj_lt_next : j < j_next := by change j.1 < j.1 + 1; omega + have hprev_lt_j : j_prev < j := by change j.1 - 1 < j.1; omega + let P_sub := walkDrawing H W_sub + have hsp1 := isSimple_of_append (hW_eq ▸ hWs) + have hsp2 := isSimple_of_append hsp1.2 + have hP_sub_path : P_sub.IsPathBetween v v' := walkDrawing_isPathBetween H hsp2.1 + have hP_sub_Pi : P_sub.IsSubdrawing (P i) := by + rw [hPi_eq, hW_eq] + refine ⟨fun x hx => ?_, fun e he => ?_⟩ + · rw [walkDrawing_V, mem_ofPred_eq] at hx ⊢ + rw [GraphWalk.mem_support_append, GraphWalk.mem_support_append] + exact Or.inr (Or.inl hx) + · rw [walkDrawing_E, mem_ofPred_eq] at he ⊢ + rw [GraphWalk.edges_append, GraphWalk.edges_append, List.mem_append, List.mem_append] + exact Or.inr (Or.inl he) + have hP_sub_H : P_sub.IsSubdrawing H := walkDrawing_isSubdrawing H W_sub + have hp_j := hC.disc_props hS hΔ_out j + have hp_next := hC.disc_props hS hΔ_out j_next + have hsub_j_next := (hC.discIns_subset_diff hS hΔ_out hj_lt_next).2 + have hv_in_next : v ∈ GM14.discIns Δ_out (C j_next) \ (C j_next).U := + hsub_j_next (hp_j.2.2.2.2.2 ((C j).V_subset_U hvC)) + have hmeet₁ : ((walkDrawing H W₁).U ∩ (C j_next).U).Nonempty := by + have hb_W₁ : b_i ∈ (walkDrawing H W₁).U := + (walkDrawing H W₁).V_subset_U (by rw [walkDrawing_V]; exact W₁.start_mem_support) + have hv_W₁ : v ∈ (walkDrawing H W₁).U := + (walkDrawing H W₁).V_subset_U (by rw [walkDrawing_V]; exact W₁.end_mem_support) + have hb_last : b_i ∈ (C m_last).U := (hC.2.2.2 hs).2.symm ▸ C_out.V_subset_U hb_i + by_cases hnext_last : j_next = m_last + · exact ⟨b_i, hb_W₁, hnext_last.symm ▸ hb_last⟩ + · have hnext_lt_last : j_next < m_last := + lt_of_le_of_ne (by change j.1 + 1 ≤ s - 1; omega) hnext_last + have hdisj_last := (hC.discIns_subset_diff hS hΔ_out hnext_lt_last).1 + have hb_not_next : b_i ∉ GM14.discIns Δ_out (C j_next) := + fun hb_in => disjoint_left.mp hdisj_last hb_in hb_last + by_contra h_empty + rw [Set.not_nonempty_iff_eq_empty, ← Set.disjoint_iff_inter_eq_empty, + ← hp_next.2.2.2.1] at h_empty + have hpre₁ := Drawing.IsPathBetween.isPreconnected_U (walkDrawing_isPathBetween H hsp1.1) + rcases GM14.subset_or_disjoint_of_frontier hp_next.2.2.2.2.1 hpre₁ h_empty with hsub | hdis + · exact hb_not_next (hsub hb_W₁) + · exact disjoint_left.mp hdis hv_W₁ hv_in_next.1 + have hinf_next' : + IsDrawingPath (Drawing.inf H (C j_next) (walkDrawing H (W₁.append (W_sub.append W₂)))) := by + rwa [← hW_eq, ← hPi_eq] + have hdisj_rest_next : Disjoint (walkDrawing H (W_sub.append W₂)).U (C j_next).U := + disjoint_tail_of_inf_isPath (hC.1 j_next).1 W₁ (W_sub.append W₂) (hW_eq ▸ hWs) + hinf_next' hmeet₁ hv_in_next.2 + have hdisj_sub_next : Disjoint P_sub.U (C j_next).U := by + refine disjoint_of_subset_left ?_ hdisj_rest_next + rw [walkDrawing_append_U] + exact subset_union_left + have hP_sub_in_next : P_sub.U ⊆ GM14.discIns Δ_out (C j_next) \ (C j_next).U := by + have hdis_fr : Disjoint P_sub.U (frontier (GM14.discIns Δ_out (C j_next))) := by + rw [hp_next.2.2.2.1] + exact hdisj_sub_next + have hv_sub : v ∈ P_sub.U := P_sub.V_subset_U (by rw [walkDrawing_V]; exact + W_sub.start_mem_support) + rcases GM14.subset_or_disjoint_of_frontier hp_next.2.2.2.2.1 + (Drawing.IsPathBetween.isPreconnected_U hP_sub_path) hdis_fr with hsub | hdis + · exact fun x hx => ⟨hsub hx, disjoint_left.mp hdisj_sub_next hx⟩ + · exact (disjoint_left.mp hdis hv_sub hv_in_next.1).elim + have hP_sub_out_j : Disjoint (P_sub.U \ {v, v'}) (GM14.discIns Δ_out (C j)) := by + have hU_inter_j : P_sub.U ∩ (C j).U = {v, v'} := by + rw [GM14.U_inter_of_disjoint hP_sub_H (hC.1 j).1 hEC, hVC] + have hdis_fr : Disjoint (P_sub.U \ {v, v'}) (frontier (GM14.discIns Δ_out (C j))) := by + rw [hp_j.2.2.2.1, disjoint_left] + intro x hx hxC + have : x ∈ P_sub.U ∩ (C j).U := ⟨hx.1, hxC⟩ + rw [hU_inter_j] at this + exact hx.2 this + have hL_sub := GM14.isLine_of_isPathBetween hP_sub_path hvv' + refine (GM14.subset_or_disjoint_of_frontier hp_j.2.2.2.2.1 + (GM14.IsLineWithEnds.isPreconnected_sdiff_pair hL_sub) hdis_fr).resolve_left ?_ + intro hsub + refine hnot_in fun x hx => ?_ + by_cases hxvv' : x ∈ ({v, v'} : Set S) + · rcases hxvv' with rfl | rfl + · exact hp_j.2.2.2.2.2 ((C j).V_subset_U hvC) + · exact hp_j.2.2.2.2.2 ((C j).V_subset_U hv'C) + · exact hsub ⟨hx, hxvv'⟩ + have hdisj_sub_other_C : ∀ m : Fin s, m ≠ j → Disjoint P_sub.V (C m).V := by + intro m hmj + rcases lt_or_gt_of_ne hmj with hlt | hgt + · have hm_in_j := (hC.discIns_subset_diff hS hΔ_out hlt).2 + have hp_m := hC.disc_props hS hΔ_out m + refine disjoint_left.mpr fun x hx_sub hx_m => ?_ + have hx_in_j : x ∈ GM14.discIns Δ_out (C j) \ (C j).U := + hm_in_j (hp_m.2.2.2.2.2 ((C m).V_subset_U hx_m)) + have hx_not_vv' : x ∉ ({v, v'} : Set S) := by + rintro (rfl | rfl) + · exact hx_in_j.2 ((C j).V_subset_U hvC) + · exact hx_in_j.2 ((C j).V_subset_U hv'C) + exact disjoint_left.mp hP_sub_out_j ⟨P_sub.V_subset_U hx_sub, hx_not_vv'⟩ hx_in_j.1 + · have hnext_le_m : j_next ≤ m := by change j.1 + 1 ≤ m.1; exact hgt + refine disjoint_left.mpr fun x hx_sub hx_m => ?_ + have hx_next := hP_sub_in_next (P_sub.V_subset_U hx_sub) + have hx_mU : x ∈ (C m).U := (C m).V_subset_U hx_m + by_cases hnext_m : j_next = m + · exact hx_next.2 (hnext_m ▸ hx_mU) + · have hnext_lt_m : j_next < m := lt_of_le_of_ne hnext_le_m hnext_m + exact disjoint_left.mp (hC.discIns_subset_diff hS hΔ_out hnext_lt_m).1 hx_next.1 hx_mU + obtain ⟨Q₁, Q₂, hQ₁_path, hQ₂_path, hQ₁s, hQ₂s, hQ₁_H, hQ₂_H, hQ_V, hQ_E, + hCj_U_eq, hV_01, hV_20, hE_01, hE_20, hcirc₁, hcirc₂⟩ := + detour_replacement_circuits (hC.1 j).2.1 (hC.1 j).1 hP_sub_H hP_sub_path hvC hv'C hvv' + hVC hEC + have hv_Pi : v ∈ (P i).V := hP_sub_Pi.1 (by rw [walkDrawing_V]; exact W_sub.start_mem_support) + have hU₁_out : (H.sup P_sub Q₁).U ⊆ Δ_out := by + rw [Drawing.sup_U hP_sub_H hQ₁_H] + exact union_subset (hP_sub_Pi.U_subset.trans (hP.1 i).2.1) (hQ₁s.U_subset.trans (hC.1 j).2.2) + have hU₂_out : (H.sup P_sub Q₂).U ⊆ Δ_out := by + rw [Drawing.sup_U hP_sub_H hQ₂_H] + exact union_subset (hP_sub_Pi.U_subset.trans (hP.1 i).2.1) (hQ₂s.U_subset.trans (hC.1 j).2.2) + have hreplace := replace_nest_circuit_of_outer_detour + hS hΔ_out hC hP hj0 hj1 hvv' hP_sub_Pi hv_Pi + (hP_sub_in_next.trans sdiff_subset) hdisj_sub_other_C + obtain ⟨⟨sub_c₂, d_c₂, b_c₂⟩, _⟩ := GM14.discIns_spec hΔ_out hcirc₂ hU₂_out + obtain ⟨⟨sub_c₁, d_c₁, b_c₁⟩, uniq_c₁⟩ := GM14.discIns_spec hΔ_out hcirc₁ hU₁_out + have f_c₂ : frontier (GM14.discIns Δ_out (H.sup P_sub Q₂)) = Q₂.U ∪ P_sub.U := by + rw [GM14.IsClosedDisc.frontier_eq_discBd hS d_c₂, b_c₂, Drawing.sup_U hP_sub_H hQ₂_H, + union_comm] + have f_c₁ : frontier (GM14.discIns Δ_out (H.sup P_sub Q₁)) = P_sub.U ∪ Q₁.U := by + rw [GM14.IsClosedDisc.frontier_eq_discBd hS d_c₁, b_c₁, Drawing.sup_U hP_sub_H hQ₁_H] + by_cases h₁ : Q₁.U ⊆ GM14.discIns Δ_out (H.sup P_sub Q₂) + · have hCj_sub : (C j).U ⊆ GM14.discIns Δ_out (H.sup P_sub Q₂) := by + rw [hCj_U_eq] + refine union_subset h₁ ?_ + have hbd_sub : Q₂.U ∪ P_sub.U ⊆ GM14.discIns Δ_out (H.sup P_sub Q₂) := + f_c₂ ▸ d_c₂.isCompact.isClosed.frontier_subset + exact subset_union_left.trans hbd_sub + have hsub_j := discIns_mono hΔ_out (hC.1 j).2.1 (hC.1 j).2.2 hcirc₂ hU₂_out hCj_sub + exact ⟨Function.update C j (H.sup P_sub Q₂), + hreplace Q₂ Q₁ hQ₂s hQ₁s hQ₁_path hQ_E.symm hcirc₂ hcirc₁ hsub_j⟩ + by_cases h₂ : Q₂.U ⊆ GM14.discIns Δ_out (H.sup P_sub Q₁) + · have hCj_sub : (C j).U ⊆ GM14.discIns Δ_out (H.sup P_sub Q₁) := by + rw [hCj_U_eq] + refine union_subset ?_ h₂ + have hbd_sub : P_sub.U ∪ Q₁.U ⊆ GM14.discIns Δ_out (H.sup P_sub Q₁) := + f_c₁ ▸ d_c₁.isCompact.isClosed.frontier_subset + exact subset_union_right.trans hbd_sub + have hsub_j := discIns_mono hΔ_out (hC.1 j).2.1 (hC.1 j).2.2 hcirc₁ hU₁_out hCj_sub + exact ⟨Function.update C j (H.sup P_sub Q₁), + hreplace Q₁ Q₂ hQ₁s hQ₂s hQ₂_path hQ_E hcirc₁ hcirc₂ hsub_j⟩ + exfalso + obtain ⟨dU, hbdU, hneU⟩ := + GM14.theta_disc_union hS + (GM14.isLine_of_isPathBetween hP_sub_path hvv') + (GM14.isLine_of_isPathBetween hQ₁_path hvv') + (GM14.isLine_of_isPathBetween hQ₂_path hvv') + (by rw [GM14.U_inter_of_disjoint hP_sub_H hQ₁_H hE_01, hV_01]) + (by rw [GM14.U_inter_of_disjoint hQ₁_H hQ₂_H hQ_E, hQ_V]) + (by rw [GM14.U_inter_of_disjoint hQ₂_H hP_sub_H hE_20, hV_20]) + hp_j.2.1 d_c₂ d_c₁ + (hp_j.2.2.2.1.trans hCj_U_eq) f_c₂ f_c₁ + hnot_in h₁ h₂ + have heq := uniq_c₁ _ (union_subset hp_j.1 sub_c₂) dU (hbdU.trans b_c₁) + exact hneU heq + +/-- Property `(2)` of Graph Minors III, (4.1) (page 60): +When `0 < j.1`, `j.1 + 1 < s`, and `Drawing.inf H (C ⟨j.1 + 1, _⟩) (P i')` is a path for every `i'`, +either Move 2 applies to some `P i'` (strictly decreasing `totalDrawingEdges`), or for every +`i' : Fin r` and every `u ∈ (C j).V ∩ (P i').V`, there is a subdrawing `R ≤ P i'` which is a path +from `u` to some `a' ∈ C_in.V` with `R.U ⊆ discIns Δ_out (C j)`. -/ +theorem exists_inner_subpath_or_outer_detour {s r : ℕ} + (hS : IsClosedSurface S) {H : Drawing S} {Δ_out : Set S} (hΔ_out : IsClosedDisc Δ_out) + {C_in C_out : Drawing S} (hbd_out : discBd Δ_out = C_out.U) + {C : Fin s → Drawing S} {P : Fin r → Drawing S} + (hs : 0 < s) (hC : IsDiscNest H Δ_out C_in C_out C) + (hP : IsDiscPaths H Δ_out C_in C_out P) + {j : Fin s} (hj0 : 0 < j.1) (hj1 : j.1 + 1 < s) + (hinf_next : ∀ i' : Fin r, IsDrawingPath (Drawing.inf H (C ⟨j.1 + 1, hj1⟩) (P i'))) : + (∃ C' : Fin s → Drawing S, + IsDiscNest H Δ_out C_in C_out C' ∧ + (∀ m : Fin s, GM14.discIns Δ_out (C m) ⊆ GM14.discIns Δ_out (C' m)) ∧ + totalDrawingEdges C' P < totalDrawingEdges C P) ∨ + (∀ (i' : Fin r) (u : S), u ∈ (C j).V ∩ (P i').V → + ∃ a' ∈ C_in.V, ∃ R : Drawing S, + R.IsSubdrawing (P i') ∧ R.IsPathBetween u a' ∧ R.U ⊆ GM14.discIns Δ_out (C j)) := by + by_contra hnot + push Not at hnot + obtain ⟨hno_C', i', u, ⟨huC, huP⟩, hno_R⟩ := hnot + obtain ⟨hPi'_H, _, a', ha', b', hb', hPi'_path⟩ := hP.1 i' + have hPi'_symm : (P i').IsPathBetween b' a' := Drawing.IsPathBetween.symm hPi'_path + obtain ⟨W₀, hW₀s, hVP, hEP⟩ := hPi'_symm + obtain ⟨W, hsW, heW⟩ := hPi'_H.exists_walk_up W₀ + have hWs : W.IsSimple := by change W.support.Nodup; rw [hsW]; exact hW₀s + have hPi'_eq : P i' = walkDrawing H W := by + apply Drawing.ext_of_V_E + · rw [hVP, walkDrawing_V, hsW] + · rw [hEP, walkDrawing_E, heW] + have hu_supp : u ∈ W.support := by + rw [hVP, mem_ofPred_eq, ← hsW] at huP + exact huP + obtain ⟨W_pre, W_suf, hW_split⟩ := W.exists_append_of_mem hu_supp + have hsp := isSimple_of_append (hW_split ▸ hWs) + have hp_j := hC.disc_props hS hΔ_out j + have h0_lt_j : (⟨0, hs⟩ : Fin s) < j := hj0 + have hp_0 := hC.disc_props hS hΔ_out ⟨0, hs⟩ + have ha'_0 : a' ∈ (C ⟨0, hs⟩).U := (hC.2.2.2 hs).1.symm ▸ C_in.V_subset_U ha' + have ha'_in_j : a' ∈ GM14.discIns Δ_out (C j) \ (C j).U := + (hC.discIns_subset_diff hS hΔ_out h0_lt_j).2 (hp_0.2.2.2.2.2 ha'_0) + rcases walk_subset_disc_or_exists_outer_detour (hC.1 j).1 hp_j.2.2.2.2.1 hp_j.2.2.2.1 + W_suf hsp.2 huC ha'_in_j with hsub_in | + ⟨v, hvC, v', hv'C, hvv', W_pre', W_sub, W_post, hWsuf_eq, hVC, hEC, hnot_in⟩ + · let R := walkDrawing H W_suf + have hR_sub : R.IsSubdrawing (P i') := by + rw [hPi'_eq, hW_split] + refine ⟨fun x hx => ?_, fun e he => ?_⟩ + · rw [walkDrawing_V, mem_ofPred_eq] at hx ⊢ + rw [GraphWalk.mem_support_append] + exact Or.inr hx + · rw [walkDrawing_E, mem_ofPred_eq] at he ⊢ + rw [GraphWalk.edges_append, List.mem_append] + exact Or.inr he + exact hno_R a' ha' R hR_sub (walkDrawing_isPathBetween H hsp.2) hsub_in + · have hW_eq : W = (W_pre.append W_pre').append (W_sub.append W_post) := by + rw [GraphWalk.append_assoc, ← hWsuf_eq, ← hW_split] + obtain ⟨C', hC', hmono, hlt⟩ := + move2_outer_detour hS hΔ_out hbd_out hs hC hP hj0 hj1 (hinf_next i') hb' hWs hPi'_eq + hvC hv'C hvv' hW_eq hVC hEC hnot_in + exact not_lt_of_ge (hno_C' C' hC' hmono) hlt + +theorem walkDrawing_reverse (H : Drawing S) {a b : S} (W : GraphWalk H.toGraph a b) : + walkDrawing H W.reverse = walkDrawing H W := by + apply Drawing.ext_of_V_E + · rw [walkDrawing_V, walkDrawing_V]; ext x; simp [GraphWalk.support_reverse] + · rw [walkDrawing_E, walkDrawing_E]; ext e; simp [GraphWalk.edges_reverse] + +private theorem walk_append_nil {α β : Type*} {G : Graph α β} {u v : α} + (W : GraphWalk G u v) (hv : v ∈ V(G)) : W.append (.nil hv) = W := by + induction W with + | nil _ => rfl + | cons h r ih => exact congrArg (GraphWalk.cons h) (ih hv) + +private theorem walk_append_assoc {α β : Type*} {G : Graph α β} {u v w z : α} + (W₁ : GraphWalk G u v) (W₂ : GraphWalk G v w) (W₃ : GraphWalk G w z) : + (W₁.append W₂).append W₃ = W₁.append (W₂.append W₃) := by + induction W₁ with + | nil _ => rfl + | cons h r ih => exact congrArg (GraphWalk.cons h) (ih W₂) + +private theorem walk_reverse_append {α β : Type*} {G : Graph α β} {u v w : α} + (W₁ : GraphWalk G u v) (W₂ : GraphWalk G v w) : + (W₁.append W₂).reverse = W₂.reverse.append W₁.reverse := by + induction W₁ with + | nil hv => exact (walk_append_nil W₂.reverse hv).symm + | cons h r ih => + change (r.append W₂).reverse.append (.cons h.symm (.nil h.left_mem)) = + W₂.reverse.append (r.reverse.append (.cons h.symm (.nil h.left_mem))) + rw [ih, walk_append_assoc] + +private theorem not_arc_subset_chord_discIns (hS : IsClosedSurface S) + {H C Q₁ Q₂ P_sub : Drawing S} {Δ_out : Set S} (hΔ_out : IsClosedDisc Δ_out) + {v v' : S} (hvv' : v ≠ v') + (hCH : C.IsSubdrawing H) (hC : C.IsCircuit) (hCU : C.U ⊆ Δ_out) + (hQ₂_H : Q₂.IsSubdrawing H) + (hCj_U : C.U = Q₁.U ∪ Q₂.U) + (hP_sub_H : P_sub.IsSubdrawing H) (hP_sub_path : P_sub.IsPathBetween v v') + (hVC : P_sub.V ∩ C.V = {v, v'}) (hEC : Disjoint P_sub.E C.E) + (hcirc₂ : (H.sup P_sub Q₂).IsCircuit) + (hU₂_in : (H.sup P_sub Q₂).U ⊆ GM14.discIns Δ_out C) : + ¬ Q₁.U ⊆ GM14.discIns Δ_out (H.sup P_sub Q₂) := by + intro hQ₁_in + obtain ⟨⟨hD₀_out, hD₀_disc, hD₀_bd⟩, _⟩ := GM14.discIns_spec hΔ_out hC hCU + have hU₂_out : (H.sup P_sub Q₂).U ⊆ Δ_out := hU₂_in.trans hD₀_out + obtain ⟨⟨_, hD₁_disc, hD₁_bd⟩, _⟩ := GM14.discIns_spec hΔ_out hcirc₂ hU₂_out + have hf₀ : frontier (GM14.discIns Δ_out C) = C.U := + (GM14.IsClosedDisc.frontier_eq_discBd hS hD₀_disc).trans hD₀_bd + have hf₁ : frontier (GM14.discIns Δ_out (H.sup P_sub Q₂)) = P_sub.U ∪ Q₂.U := by + rw [GM14.IsClosedDisc.frontier_eq_discBd hS hD₁_disc, hD₁_bd, Drawing.sup_U hP_sub_H hQ₂_H] + have hQ₂_in : Q₂.U ⊆ GM14.discIns Δ_out (H.sup P_sub Q₂) := + subset_union_right.trans (hf₁ ▸ hD₁_disc.isCompact.isClosed.frontier_subset) + have hCU_in : C.U ⊆ GM14.discIns Δ_out (H.sup P_sub Q₂) := + hCj_U ▸ union_subset hQ₁_in hQ₂_in + have hD₀_le_D₁ := discIns_mono hΔ_out hC hCU hcirc₂ hU₂_out hCU_in + have hD₁_le_D₀ := discIns_mono hΔ_out hcirc₂ hU₂_out hC hCU hU₂_in + have hD_eq : GM14.discIns Δ_out (H.sup P_sub Q₂) = GM14.discIns Δ_out C := + Subset.antisymm hD₁_le_D₀ hD₀_le_D₁ + have hP_sub_CU : P_sub.U ⊆ C.U := by + have : P_sub.U ⊆ frontier (GM14.discIns Δ_out (H.sup P_sub Q₂)) := + hf₁.symm ▸ subset_union_left + rwa [hD_eq, hf₀] at this + have hU_inter : P_sub.U ∩ C.U = {v, v'} := by + rw [GM14.U_inter_of_disjoint hP_sub_H hCH hEC, hVC] + obtain ⟨φ, hφ0, hφ1⟩ := GM14.isLine_of_isPathBetween hP_sub_path hvv' + let t_mid : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have hx_in : (φ t_mid).1 ∈ P_sub.U ∩ C.U := ⟨(φ t_mid).2, hP_sub_CU (φ t_mid).2⟩ + rw [hU_inter] at hx_in + rcases hx_in with h_eq | h_eq + · have ht : t_mid = 0 := φ.injective (Subtype.ext (h_eq.trans hφ0.symm)) + exact absurd (congrArg Subtype.val ht) (by norm_num [t_mid]) + · have ht : t_mid = 1 := φ.injective (Subtype.ext (h_eq.trans hφ1.symm)) + exact absurd (congrArg Subtype.val ht) (by norm_num [t_mid]) + +private theorem reroute_path_across_inner_detour {s r : ℕ} + {H : Drawing S} {Δ_out : Set S} {C_in C_out : Drawing S} + {C : Fin s → Drawing S} {P : Fin r → Drawing S} + (hC : IsDiscNest H Δ_out C_in C_out C) (hP : IsDiscPaths H Δ_out C_in C_out P) + {j : Fin s} {i : Fin r} {a_i b_i v v' w₁ : S} {e₁ : Set S} + (ha_i : a_i ∈ C_in.V) (hb_i : b_i ∈ C_out.V) + (hvC : v ∈ (C j).V) (hvP : v ∈ (P i).V) (hv'P : v' ∈ (P i).V) + {W₁ : GraphWalk H.toGraph a_i v} {W_sub : GraphWalk H.toGraph v v'} + {W₂ : GraphWalk H.toGraph v' b_i} + (hWs : (W₁.append (W_sub.append W₂)).IsSimple) + (hPi_eq : P i = walkDrawing H (W₁.append (W_sub.append W₂))) + (hP_sub_Pi : (walkDrawing H W_sub).IsSubdrawing (P i)) + (hEC : Disjoint (walkDrawing H W_sub).E (C j).E) + (he₁_sub : e₁ ∈ (walkDrawing H W_sub).E) (hl₁ : H.toGraph.IsLink e₁ v w₁) + (hno_outer : ∀ i' : Fin r, ∀ u ∈ (C j).V ∩ (P i').V, + ∃ a' ∈ C_in.V, ∃ R : Drawing S, + R.IsSubdrawing (P i') ∧ R.IsPathBetween u a' ∧ R.U ⊆ GM14.discIns Δ_out (C j)) : + let P_sub := walkDrawing H W_sub + let D₀ := GM14.discIns Δ_out (C j) + ∀ (Q_k : Drawing S) (D_in D_other : Set S), + Q_k.IsSubdrawing (C j) → Q_k.IsPathBetween v v' → + IsClosed D_in → IsClosed D_other → D_in ∪ D_other = D₀ → D_in ∩ D_other = P_sub.U → + C_in.U ⊆ D_in → Disjoint (Q_k.U \ {v, v'}) D_in → + ∃ P' : Fin r → Drawing S, + IsDiscPaths H Δ_out C_in C_out P' ∧ totalDrawingEdges C P' < totalDrawingEdges C P := by + intro P_sub D₀ + have hPi_H := (hP.1 i).1 + have hPi_U := (hP.1 i).2.1 + intro Q_k D_in D_other hQk_s hQk_path hcl_in hcl_other hU_D hI_D hCin_in hout_Qk + have hQk_H : Q_k.IsSubdrawing H := hQk_s.trans (hC.1 j).1 + have hQk_disj_other : ∀ i' : Fin r, i' ≠ i → Disjoint Q_k.V (P i').V := by + intro i' hi' + refine disjoint_left.mpr fun u hu_Qk hu_Pi' => ?_ + obtain ⟨a', ha', R, hR_sub, hR_path, hR_D₀⟩ := + hno_outer i' u ⟨hQk_s.1 hu_Qk, hu_Pi'⟩ + have hR_H : R.IsSubdrawing H := hR_sub.trans (hP.1 i').1 + have hdisj_Pi'_Pi : Disjoint (P i').U (P i).U := by + have hE_disj := disjoint_E_of_disjoint_V (hP.1 i').1 hPi_H (hP.2 hi') + rw [Set.disjoint_iff_inter_eq_empty, + GM14.U_inter_of_disjoint (hP.1 i').1 hPi_H hE_disj, ← Set.disjoint_iff_inter_eq_empty] + exact hP.2 hi' + have hdisj_R_sub : Disjoint R.U P_sub.U := + disjoint_of_subset hR_sub.U_subset hP_sub_Pi.U_subset hdisj_Pi'_Pi + have hR_union : R.U ⊆ D_in ∪ D_other := hU_D.symm ▸ hR_D₀ + have ha'_R : a' ∈ R.U := R.V_subset_U + (by obtain ⟨W₀, _, hV₀, _⟩ := hR_path; rw [hV₀]; exact W₀.end_mem_support) + have hu_R : u ∈ R.U := R.V_subset_U + (by obtain ⟨W₀, _, hV₀, _⟩ := hR_path; rw [hV₀]; exact W₀.start_mem_support) + have ha'_Din : a' ∈ D_in := hCin_in (C_in.V_subset_U ha') + have hu_Din : u ∈ D_in := by + by_contra hu_not_in + have hu_other : u ∈ D_other := (hR_union hu_R).resolve_left hu_not_in + obtain ⟨z, hz_R, hz_in, hz_other⟩ := + isPreconnected_closed_iff.mp (Drawing.IsPathBetween.isPreconnected_U hR_path) + D_in D_other hcl_in hcl_other hR_union ⟨a', ha'_R, ha'_Din⟩ ⟨u, hu_R, hu_other⟩ + have hz_P : z ∈ P_sub.U := by rw [← hI_D]; exact ⟨hz_in, hz_other⟩ + exact disjoint_left.mp hdisj_R_sub hz_R hz_P + have hu_not_vv' : u ∉ ({v, v'} : Set S) := by + rintro (rfl | rfl) + · exact disjoint_left.mp (hP.2 hi') hu_Pi' hvP + · exact disjoint_left.mp (hP.2 hi') hu_Pi' hv'P + exact disjoint_left.mp hout_Qk ⟨Q_k.V_subset_U hu_Qk, hu_not_vv'⟩ hu_Din + obtain ⟨P'_i, hP'_H, hP'_path, hP'_V, hP'_E⟩ := + reroute_drawing_path hWs hPi_eq hQk_H hQk_path + have he₁_not_C : ∀ m : Fin s, e₁ ∉ (C m).E := by + intro m hem + by_cases hmj : m = j + · exact disjoint_left.mp hEC he₁_sub (hmj ▸ hem) + · have hlm : (C m).toGraph.IsLink e₁ v w₁ := ((hC.1 m).1.isLink_iff hem).mpr hl₁ + exact disjoint_left.mp (hC.2.1 hmj) hlm.2.1 hvC + obtain ⟨hdisj_P', hlt_edges⟩ := + totalDrawingEdges_lt_of_reroute_path (fun m => (hC.1 m).1) (fun m => (hP.1 m).1) + hP.2 hP_sub_Pi hQk_s hP'_V hP'_E hQk_disj_other he₁_sub he₁_not_C + have hP'_U : P'_i.U ⊆ Δ_out := by + intro x hx + rw [P'_i.U_eq, mem_union, mem_iUnion₂] at hx + rcases hx with hxV | ⟨e, he, hxe⟩ + · rcases hP'_V hxV with hx_Pi | hx_Qk + · exact hPi_U ((P i).V_subset_U hx_Pi) + · exact (hC.1 j).2.2 ((C j).V_subset_U (hQk_s.1 hx_Qk)) + · rcases hP'_E he with ⟨he_Pi, _⟩ | he_Qk + · exact hPi_U ((P i).closure_subset_U he_Pi hxe) + · exact (hC.1 j).2.2 ((C j).closure_subset_U (hQk_s.2 he_Qk) hxe) + refine ⟨Function.update P i P'_i, ⟨fun k => ?_, hdisj_P'⟩, hlt_edges⟩ + by_cases hki : k = i + · subst hki + rw [Function.update_self] + exact ⟨hP'_H, hP'_U, a_i, ha_i, b_i, hb_i, hP'_path⟩ + · rw [Function.update_of_ne hki] + exact hP.1 k + +/-- **Combined Move 2 / Move 3 step (GM03 (4.1) paragraphs 4–6, pages 60–61)**: +When `0 < j.1`, `j.1 + 1 < s`, `Drawing.inf H (C 0) (P i')` and `Drawing.inf H (C ⟨j.1 + 1, _⟩) (P +i')` +are paths for all `i'`, and `Drawing.inf H (C j) (P i)` is not a path, either Move 2 replaces `C j` +or Move 3 reroutes `P i`, strictly decreasing `totalDrawingEdges`. -/ +theorem move2_or_move3_step {s r : ℕ} + (hS : IsClosedSurface S) {H : Drawing S} {Δ_out : Set S} (hΔ_out : IsClosedDisc Δ_out) + {C_in C_out : Drawing S} (hbd_out : discBd Δ_out = C_out.U) + {C : Fin s → Drawing S} {P : Fin r → Drawing S} + (hs : 0 < s) (hC : IsDiscNest H Δ_out C_in C_out C) + (hP : IsDiscPaths H Δ_out C_in C_out P) + {j : Fin s} (hj0 : 0 < j.1) (hj1 : j.1 + 1 < s) + (hinf_in : ∀ i' : Fin r, IsDrawingPath (Drawing.inf H (C ⟨0, hs⟩) (P i'))) + (hinf_next : ∀ i' : Fin r, IsDrawingPath (Drawing.inf H (C ⟨j.1 + 1, hj1⟩) (P i'))) + {i : Fin r} (hnot_path : ¬ IsDrawingPath (Drawing.inf H (C j) (P i))) : + ∃ (C' : Fin s → Drawing S) (P' : Fin r → Drawing S), + IsDiscNest H Δ_out C_in C_out C' ∧ + (∀ m : Fin s, GM14.discIns Δ_out (C m) ⊆ GM14.discIns Δ_out (C' m)) ∧ + IsDiscPaths H Δ_out C_in C_out P' ∧ + totalDrawingEdges C' P' < totalDrawingEdges C P := by + rcases exists_inner_subpath_or_outer_detour hS hΔ_out hbd_out hs hC hP hj0 hj1 hinf_next with + ⟨C', hC', hmono, hlt⟩ | hno_outer + · exact ⟨C', P, hC', hmono, hP, hlt⟩ + obtain ⟨hPi_H, hPi_U, a_i, ha_i, b_i, hb_i, hPi_path⟩ := hP.1 i + have hp_j := hC.disc_props hS hΔ_out j + have hp_0 := hC.disc_props hS hΔ_out ⟨0, hs⟩ + let m_last : Fin s := ⟨s - 1, Nat.sub_lt hs zero_lt_one⟩ + have h0_lt_j : (⟨0, hs⟩ : Fin s) < j := hj0 + have hj_lt_last : j < m_last := by change j.1 < s - 1; omega + have ha_0 : a_i ∈ (C ⟨0, hs⟩).U := (hC.2.2.2 hs).1.symm ▸ C_in.V_subset_U ha_i + have ha_in_j : a_i ∈ GM14.discIns Δ_out (C j) \ (C j).U := + (hC.discIns_subset_diff hS hΔ_out h0_lt_j).2 (hp_0.2.2.2.2.2 ha_0) + have hb_last : b_i ∈ (C m_last).U := (hC.2.2.2 hs).2.symm ▸ C_out.V_subset_U hb_i + have hb_not_j : b_i ∉ GM14.discIns Δ_out (C j) := + fun hb_in => disjoint_left.mp (hC.discIns_subset_diff hS hΔ_out hj_lt_last).1 hb_in hb_last + have hne_V : ((C j).V ∩ (P i).V).Nonempty := by + have ha_Pi : a_i ∈ (P i).U := (P i).V_subset_U + (by obtain ⟨W₀, _, hV₀, _⟩ := hPi_path; rw [hV₀]; exact W₀.start_mem_support) + have hb_Pi : b_i ∈ (P i).U := (P i).V_subset_U + (by obtain ⟨W₀, _, hV₀, _⟩ := hPi_path; rw [hV₀]; exact W₀.end_mem_support) + have hne_U : ((Drawing.inf H (C j) (P i)).U).Nonempty := by + rw [Drawing.inf_U (hC.1 j).1 hPi_H, inter_comm] + by_contra h_empty + rw [Set.not_nonempty_iff_eq_empty, ← Set.disjoint_iff_inter_eq_empty, + ← hp_j.2.2.2.1] at h_empty + rcases GM14.subset_or_disjoint_of_frontier hp_j.2.2.2.2.1 + (Drawing.IsPathBetween.isPreconnected_U hPi_path) h_empty with hsub | hdis + · exact hb_not_j (hsub hb_Pi) + · exact disjoint_left.mp hdis ha_Pi ha_in_j.1 + obtain ⟨x, hx⟩ := hne_U + rcases hx with hxV | ⟨_, ⟨e, rfl⟩, _, ⟨he, rfl⟩, _⟩ + · change x ∈ (Drawing.inf H (C j) (P i)).V at hxV + rw [Drawing.inf_V (hC.1 j).1 hPi_H] at hxV + exact ⟨x, hxV⟩ + · obtain ⟨u, w, hlu⟩ := (H.toGraph.edge_mem_iff_exists_isLink e).mp he.2 + exact ⟨u, (((hC.1 j).1.isLink_iff he.1.1).mpr hlu).2.1, + ((hPi_H.isLink_iff he.1.2).mpr hlu).2.1⟩ + rcases path_inf_isPath_or_exists_detour (hC.1 j).1 hPi_H hPi_path hne_V with + hpath | ⟨v, ⟨hvC, hvP⟩, v', ⟨hv'C, hv'P⟩, hvv', W₁, W_sub, W₂, hWs, hPi_eq, hVC, hEC, + e₁, he₁_sub, w₁, hl₁⟩ + · exact (hnot_path hpath).elim + let P_sub := walkDrawing H W_sub + by_cases hP_sub_in_j : P_sub.U ⊆ GM14.discIns Δ_out (C j) + · have hsp1 := isSimple_of_append hWs + have hsp2 := isSimple_of_append hsp1.2 + have hP_sub_path : P_sub.IsPathBetween v v' := walkDrawing_isPathBetween H hsp2.1 + have hP_sub_H : P_sub.IsSubdrawing H := walkDrawing_isSubdrawing H W_sub + have hP_sub_Pi : P_sub.IsSubdrawing (P i) := by + rw [hPi_eq] + refine ⟨fun x hx => ?_, fun e he => ?_⟩ + · rw [walkDrawing_V, mem_ofPred_eq] at hx ⊢ + rw [GraphWalk.mem_support_append, GraphWalk.mem_support_append] + exact Or.inr (Or.inl hx) + · rw [walkDrawing_E, mem_ofPred_eq] at he ⊢ + rw [GraphWalk.edges_append, GraphWalk.edges_append, List.mem_append, List.mem_append] + exact Or.inr (Or.inl he) + have hmeet_0 : ((walkDrawing H W₁).U ∩ (C ⟨0, hs⟩).U).Nonempty := + ⟨a_i, (walkDrawing H W₁).V_subset_U (by rw [walkDrawing_V]; exact W₁.start_mem_support), ha_0⟩ + have hv_not_0 : v ∉ (C ⟨0, hs⟩).U := + disjoint_right.mp (hC.disjoint_U h0_lt_j.ne).2 ((C j).V_subset_U hvC) + have hdisj_rest_0 : Disjoint (walkDrawing H (W_sub.append W₂)).U (C ⟨0, hs⟩).U := + disjoint_tail_of_inf_isPath (hC.1 ⟨0, hs⟩).1 W₁ (W_sub.append W₂) hWs + (hPi_eq ▸ hinf_in i) hmeet_0 hv_not_0 + have hdisj_sub_Cin : Disjoint P_sub.U C_in.U := by + rw [← (hC.2.2.2 hs).1] + refine disjoint_of_subset_left ?_ hdisj_rest_0 + rw [walkDrawing_append_U] + exact subset_union_left + obtain ⟨Q₁, Q₂, hQ₁_path, hQ₂_path, hQ₁s, hQ₂s, hQ₁_H, hQ₂_H, hQ_V, hQ_E, + hCj_U_eq, hV_01, hV_20, hE_01, hE_20, hcirc₁, hcirc₂⟩ := + detour_replacement_circuits (hC.1 j).2.1 (hC.1 j).1 hP_sub_H hP_sub_path hvC hv'C hvv' + hVC hEC + have hU₁_in_j : (H.sup P_sub Q₁).U ⊆ GM14.discIns Δ_out (C j) := by + rw [Drawing.sup_U hP_sub_H hQ₁_H] + exact union_subset hP_sub_in_j (hQ₁s.U_subset.trans hp_j.2.2.2.2.2) + have hU₂_in_j : (H.sup P_sub Q₂).U ⊆ GM14.discIns Δ_out (C j) := by + rw [Drawing.sup_U hP_sub_H hQ₂_H] + exact union_subset hP_sub_in_j (hQ₂s.U_subset.trans hp_j.2.2.2.2.2) + let D₁ := GM14.discIns Δ_out (H.sup P_sub Q₂) + let D₂ := GM14.discIns Δ_out (H.sup P_sub Q₁) + let D₀ := GM14.discIns Δ_out (C j) + have hU₁_out : (H.sup P_sub Q₁).U ⊆ Δ_out := hU₁_in_j.trans hp_j.1 + have hU₂_out : (H.sup P_sub Q₂).U ⊆ Δ_out := hU₂_in_j.trans hp_j.1 + obtain ⟨⟨sub_D₁, d_D₁, b_D₁⟩, _⟩ := GM14.discIns_spec hΔ_out hcirc₂ hU₂_out + obtain ⟨⟨sub_D₂, d_D₂, b_D₂⟩, _⟩ := GM14.discIns_spec hΔ_out hcirc₁ hU₁_out + obtain ⟨_, uniq_D₀⟩ := GM14.discIns_spec hΔ_out (hC.1 j).2.1 (hC.1 j).2.2 + have f_D₁ : frontier D₁ = Q₂.U ∪ P_sub.U := by + rw [GM14.IsClosedDisc.frontier_eq_discBd hS d_D₁, b_D₁, Drawing.sup_U hP_sub_H hQ₂_H, + union_comm] + have f_D₂ : frontier D₂ = P_sub.U ∪ Q₁.U := by + rw [GM14.IsClosedDisc.frontier_eq_discBd hS d_D₂, b_D₂, Drawing.sup_U hP_sub_H hQ₁_H] + have hnot_Q₁_D₁ : ¬ Q₁.U ⊆ D₁ := + not_arc_subset_chord_discIns hS hΔ_out hvv' (hC.1 j).1 (hC.1 j).2.1 (hC.1 j).2.2 + hQ₂_H hCj_U_eq hP_sub_H hP_sub_path hVC hEC hcirc₂ hU₂_in_j + have hnot_Q₂_D₂ : ¬ Q₂.U ⊆ D₂ := + not_arc_subset_chord_discIns hS hΔ_out hvv' (hC.1 j).1 (hC.1 j).2.1 (hC.1 j).2.2 + hQ₁_H (by rw [hCj_U_eq, union_comm]) hP_sub_H hP_sub_path hVC hEC hcirc₁ hU₁_in_j + obtain ⟨dU, hbdU, hcap_D, out_Q₁, out_Q₂⟩ := + theta_inner_chord_split hS + (GM14.isLine_of_isPathBetween hQ₁_path hvv') + (GM14.isLine_of_isPathBetween hQ₂_path hvv') + (GM14.isLine_of_isPathBetween hP_sub_path hvv') + (by rw [GM14.U_inter_of_disjoint hQ₁_H hQ₂_H hQ_E, hQ_V]) + (by rw [GM14.U_inter_of_disjoint hQ₂_H hP_sub_H hE_20, hV_20]) + (by rw [GM14.U_inter_of_disjoint hP_sub_H hQ₁_H hE_01, hV_01]) + d_D₁ d_D₂ hp_j.2.1 + f_D₁ f_D₂ (hp_j.2.2.2.1.trans hCj_U_eq) + hnot_Q₁_D₁ hnot_Q₂_D₂ + have hD_union : D₁ ∪ D₂ = D₀ := + uniq_D₀ (D₁ ∪ D₂) (union_subset sub_D₁ sub_D₂) dU (hbdU.trans hp_j.2.2.1) + have hCin_sub_D₀ : C_in.U ⊆ D₁ ∪ D₂ := by + rw [hD_union, ← (hC.2.2.2 hs).1] + exact hp_0.2.2.2.2.2.trans (hC.2.2.1 h0_lt_j.le) + have hCin_pre : IsPreconnected C_in.U := by + rw [← (hC.2.2.2 hs).1] + obtain ⟨φ⟩ := GM14.isOArc_of_isCircuit (hC.1 ⟨0, hs⟩).2.1 + have h_eq : (C ⟨0, hs⟩).U = range (Subtype.val ∘ φ) := by + ext x; constructor + · intro hx; exact ⟨φ.symm ⟨x, hx⟩, congrArg Subtype.val (φ.apply_symm_apply ⟨x, hx⟩)⟩ + · rintro ⟨t, rfl⟩; exact (φ t).2 + rw [h_eq] + exact isPreconnected_range (continuous_subtype_val.comp φ.continuous) + have hCin_side : C_in.U ⊆ D₁ ∨ C_in.U ⊆ D₂ := by + by_contra hnot_side + rw [not_or, Set.not_subset, Set.not_subset] at hnot_side + obtain ⟨⟨x₁, hx₁_in, hx₁_not₁⟩, ⟨x₂, hx₂_in, hx₂_not₂⟩⟩ := hnot_side + have hx₁_D₂ : x₁ ∈ D₂ := (hCin_sub_D₀ hx₁_in).resolve_left hx₁_not₁ + have hx₂_D₁ : x₂ ∈ D₁ := (hCin_sub_D₀ hx₂_in).resolve_right hx₂_not₂ + obtain ⟨z, hz_in, hz_D₁, hz_D₂⟩ := + isPreconnected_closed_iff.mp hCin_pre D₁ D₂ d_D₁.isCompact.isClosed d_D₂.isCompact.isClosed + hCin_sub_D₀ ⟨x₂, hx₂_in, hx₂_D₁⟩ ⟨x₁, hx₁_in, hx₁_D₂⟩ + have hz_P : z ∈ P_sub.U := by + rw [← hcap_D] + exact ⟨hz_D₁, hz_D₂⟩ + exact disjoint_left.mp hdisj_sub_Cin hz_P hz_in + have hreroute := reroute_path_across_inner_detour hC hP ha_i hb_i hvC hvP hv'P + hWs hPi_eq hP_sub_Pi hEC he₁_sub hl₁ hno_outer + rcases hCin_side with hCin_1 | hCin_2 + · obtain ⟨P', hP', hlt⟩ := + hreroute Q₁ D₁ D₂ hQ₁s hQ₁_path d_D₁.isCompact.isClosed d_D₂.isCompact.isClosed + hD_union hcap_D hCin_1 out_Q₁ + exact ⟨C, P', hC, fun _ => Subset.rfl, hP', hlt⟩ + · obtain ⟨P', hP', hlt⟩ := + hreroute Q₂ D₂ D₁ hQ₂s hQ₂_path d_D₂.isCompact.isClosed d_D₁.isCompact.isClosed + (by rw [union_comm, hD_union]) (by rw [inter_comm, hcap_D]) hCin_2 out_Q₂ + exact ⟨C, P', hC, fun _ => Subset.rfl, hP', hlt⟩ + · let W := W₁.append (W_sub.append W₂) + let W_rev := W₂.reverse.append (W_sub.reverse.append W₁.reverse) + have hW_rev_eq : W.reverse = W_rev := by + simp only [W, W_rev, walk_reverse_append, walk_append_assoc] + have hW_rev_s : W_rev.IsSimple := hW_rev_eq ▸ hWs.reverse + have hPi_rev_eq : P i = walkDrawing H W_rev := by + rw [← hW_rev_eq, walkDrawing_reverse, ← hPi_eq] + have hVC_rev : (walkDrawing H W_sub.reverse).V ∩ (C j).V = {v', v} := by + rw [walkDrawing_reverse, hVC, Set.pair_comm] + have hEC_rev : Disjoint (walkDrawing H W_sub.reverse).E (C j).E := by + rw [walkDrawing_reverse] + exact hEC + have hnot_in_rev : ¬ (walkDrawing H W_sub.reverse).U ⊆ GM14.discIns Δ_out (C j) := by + rw [walkDrawing_reverse] + exact hP_sub_in_j + obtain ⟨C', hC', hmono, hlt⟩ := + move2_outer_detour hS hΔ_out hbd_out hs hC hP hj0 hj1 (hinf_next i) hb_i hW_rev_s + hPi_rev_eq hv'C hvC hvv'.symm rfl hVC_rev hEC_rev hnot_in_rev + exact ⟨C', P, hC', hmono, hP, hlt⟩ + +/-- Monotonicity refinement of `planar_nest_uncrossing`: uncrossing only enlarges the closed discs +`discIns Δ_out (C j)` bounded by the circuits of the nest. -/ +theorem planar_nest_uncrossing_mono {s r : ℕ} (hS : IsClosedSurface S) + {H : Drawing S} {Δ_out : Set S} (hΔ_out : IsClosedDisc Δ_out) + {C_in C_out : Drawing S} (hbd_out : discBd Δ_out = C_out.U) + (C₀ : Fin s → Drawing S) (hC₀ : IsDiscNest H Δ_out C_in C_out C₀) + (hex_P : ∃ P₀ : Fin r → Drawing S, IsDiscPaths H Δ_out C_in C_out P₀) : + ∃ (C : Fin s → Drawing S) (P : Fin r → Drawing S), + IsDiscNest H Δ_out C_in C_out C ∧ + (∀ j : Fin s, GM14.discIns Δ_out (C₀ j) ⊆ GM14.discIns Δ_out (C j)) ∧ + IsDiscPaths H Δ_out C_in C_out P ∧ + ∀ (j : Fin s) (i : Fin r), IsDrawingPath (Drawing.inf H (C j) (P i)) := by + classical + obtain ⟨P₀, hP₀⟩ := hex_P + obtain ⟨C, P, ⟨hC, hmono, hP⟩, hmin⟩ := + exists_min_totalDrawingEdges + (fun C P => IsDiscNest H Δ_out C_in C_out C ∧ + (∀ j : Fin s, GM14.discIns Δ_out (C₀ j) ⊆ GM14.discIns Δ_out (C j)) ∧ + IsDiscPaths H Δ_out C_in C_out P) + ⟨C₀, P₀, hC₀, fun _ => Subset.rfl, hP₀⟩ + refine ⟨C, P, hC, hmono, hP, ?_⟩ + by_contra hnot_all + push Not at hnot_all + obtain ⟨j_bad, i_bad, hbad⟩ := hnot_all + have hs : 0 < s := Nat.zero_lt_of_lt j_bad.2 + by_cases h_end : ∃ i : Fin r, + ¬ IsDrawingPath (Drawing.inf H (C ⟨0, hs⟩) (P i)) ∨ + ¬ IsDrawingPath (Drawing.inf H (C ⟨s - 1, Nat.sub_lt hs zero_lt_one⟩) (P i)) + · obtain ⟨i, hi⟩ := h_end + obtain ⟨P', hP', hlt⟩ := move1_step hs hC hP hi + exact Nat.lt_irrefl _ (lt_of_lt_of_le hlt (hmin C P' ⟨hC, hmono, hP'⟩)) + · push Not at h_end + have hex_k : ∃ k : ℕ, ∃ (hk : k < s) (i : Fin r), + ¬ IsDrawingPath (Drawing.inf H (C ⟨s - 1 - k, by omega⟩) (P i)) := by + refine ⟨s - 1 - j_bad.1, by omega, i_bad, ?_⟩ + have hj_eq : (⟨s - 1 - (s - 1 - j_bad.1), by omega⟩ : Fin s) = j_bad := + Fin.ext (by dsimp; omega) + rwa [hj_eq] + let k₀ := Nat.find hex_k + obtain ⟨hk₀, i₀, hi₀⟩ := Nat.find_spec hex_k + let j₀ : Fin s := ⟨s - 1 - k₀, by omega⟩ + have hj₀_val : j₀.1 = s - 1 - k₀ := rfl + have hi₀' : ¬ IsDrawingPath (Drawing.inf H (C j₀) (P i₀)) := hi₀ + have hj₀_0 : 0 < j₀.1 := by + refine Nat.pos_of_ne_zero fun h0 => ?_ + have hj_eq : j₀ = ⟨0, hs⟩ := Fin.ext h0 + exact (hj_eq ▸ hi₀') (h_end i₀).1 + have hj₀_1 : j₀.1 + 1 < s := by + have hne : j₀.1 ≠ s - 1 := fun hlast => by + have hj_eq : j₀ = ⟨s - 1, Nat.sub_lt hs zero_lt_one⟩ := Fin.ext hlast + exact (hj_eq ▸ hi₀') (h_end i₀).2 + omega + have hinf_next : ∀ i' : Fin r, + IsDrawingPath (Drawing.inf H (C ⟨j₀.1 + 1, hj₀_1⟩) (P i')) := by + intro i' + by_contra hnot_next + have hk_lt : s - 1 - (j₀.1 + 1) < k₀ := by omega + have hj_eq : + (⟨s - 1 - (s - 1 - (j₀.1 + 1)), by omega⟩ : Fin s) = ⟨j₀.1 + 1, hj₀_1⟩ := + Fin.ext (by dsimp; omega) + exact Nat.find_min hex_k hk_lt ⟨by omega, i', hj_eq.symm ▸ hnot_next⟩ + obtain ⟨C', P', hC', hmono', hP', hlt⟩ := + move2_or_move3_step hS hΔ_out hbd_out hs hC hP hj₀_0 hj₀_1 + (fun i' => (h_end i').1) hinf_next hi₀ + exact Nat.lt_irrefl _ (lt_of_lt_of_le hlt + (hmin C' P' ⟨hC', fun j => (hmono j).trans (hmono' j), hP'⟩)) + +/-- **Closed-Disc Nest-and-Paths Uncrossing Theorem (Graph Minors III, Theorem (4.1), pages 60–61; +Graph Minors XIV, (9.5) Claim (3), page 46)**: +Given a closed disc `Δ_out` in a closed surface `S` with boundary circuit `C_out`, an inner circuit +`C_in`, an initial `s`-nest `C₀` of circuits of `H` in `Δ_out` from `C_in` to `C_out`, and an +initial family `P₀` of `r` pairwise vertex-disjoint paths of `H` in `Δ_out` between `C_in.V` and +`C_out.V`, there exist an `s`-nest `C` and a family `P` of `r` pairwise vertex-disjoint paths such +that `Drawing.inf H (C j) (P i)` is a path for all `j : Fin s` and `i : Fin r`. -/ +theorem planar_nest_uncrossing {s r : ℕ} (hS : IsClosedSurface S) + {H : Drawing S} {Δ_out : Set S} (hΔ_out : IsClosedDisc Δ_out) + {C_in C_out : Drawing S} (hbd_out : discBd Δ_out = C_out.U) + (hex_C : ∃ C₀ : Fin s → Drawing S, IsDiscNest H Δ_out C_in C_out C₀) + (hex_P : ∃ P₀ : Fin r → Drawing S, IsDiscPaths H Δ_out C_in C_out P₀) : + ∃ (C : Fin s → Drawing S) (P : Fin r → Drawing S), + IsDiscNest H Δ_out C_in C_out C ∧ + IsDiscPaths H Δ_out C_in C_out P ∧ + ∀ (j : Fin s) (i : Fin r), IsDrawingPath (Drawing.inf H (C j) (P i)) := by + obtain ⟨C₀, hC₀⟩ := hex_C + obtain ⟨C, P, hC, _, hP, hinf⟩ := planar_nest_uncrossing_mono hS hΔ_out hbd_out C₀ hC₀ hex_P + exact ⟨C, P, hC, hP, hinf⟩ + +end GraphMinor.GM09.PlanarNests diff --git a/LeanPool/GraphMinor/GM09/Restriction.lean b/LeanPool/GraphMinor/GM09/Restriction.lean new file mode 100644 index 0000000000..9f36a456a2 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Restriction.lean @@ -0,0 +1,227 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section5a + +/-! +# Restriction of a cyclic permutation + +`Ω | X` keeps the order of `Ω` on `ΩBar ∩ X`. This file proves that first hits, clockwise lists, +crosses and intervals pass to the restriction, and that the restriction exists. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 + +universe u v + +variable {α : Type u} {β : Type v} + +namespace CyclicPerm + +variable {Ω : CyclicPerm α} + +theorem IsRestriction.bar_subset {X : Set α} {Ω' : CyclicPerm α} + (h : Ω.IsRestriction X Ω') : Ω'.bar ⊆ Ω.bar := + h.1 ▸ inter_subset_left + +/-- Ifevery step of `Ω'` is the first hit in `Ω'.bar` along `Ω`, then any +first hit in `Y ⊆ Ω'.bar` along `Ω'` is also the first hit in `Y` along `Ω`. -/ +theorem firstHitIn_of_forall_firstHitIn {Ω' : CyclicPerm α} + (hhit : ∀ x ∈ Ω'.bar, Ω.FirstHitIn Ω'.bar x (Ω' x)) + {Y : Set α} (hY : Y ⊆ Ω'.bar) {x y : α} (hx : x ∈ Ω'.bar) + (h : Ω'.FirstHitIn Y x y) : Ω.FirstHitIn Y x y := by + rcases h with ⟨m, hm1, hm_eq, hyY, hm_min⟩ + have hind : ∀ (n : ℕ) {z : α}, 1 ≤ n → z ∈ Ω'.bar → + (∀ i, 1 ≤ i → i < n → (Ω'.toFun^[i]) z ∉ Y) → + ∃ k : ℕ, 1 ≤ k ∧ (Ω.toFun^[k]) z = (Ω'.toFun^[n]) z ∧ + ∀ j, 1 ≤ j → j < k → (Ω.toFun^[j]) z ∉ Y := by + intro n + induction n with + | zero => intro _ hn; omega + | succ n ih => + intro z _ hz hno + obtain ⟨k₁, hk₁_pos, hk₁_eq, _, hk₁_min⟩ := hhit z hz + rcases Nat.eq_zero_or_pos n with rfl | hn_pos + · refine ⟨k₁, hk₁_pos, by simpa using hk₁_eq, fun j hj1 hjlt hjY => ?_⟩ + exact hk₁_min j hj1 hjlt (hY hjY) + · have hz' : Ω' z ∈ Ω'.bar := Ω'.toFun_mem hz + have hno' : ∀ i, 1 ≤ i → i < n → (Ω'.toFun^[i]) (Ω' z) ∉ Y := by + intro i hi1 hilt + rw [← Function.iterate_succ_apply] + exact hno (i + 1) (by omega) (by omega) + obtain ⟨k₂, hk₂_pos, hk₂_eq, hk₂_min⟩ := ih hn_pos hz' hno' + refine ⟨k₁ + k₂, by omega, ?_, ?_⟩ + · rw [add_comm, Function.iterate_add_apply, hk₁_eq, hk₂_eq, + ← Function.iterate_succ_apply] + · intro j hj1 hjlt hjY + rcases lt_trichotomy j k₁ with hlt | rfl | hgt + · exact hk₁_min j hj1 hlt (hY hjY) + · have h1 : (Ω'.toFun^[1]) z ∈ Y := by simpa [hk₁_eq] using hjY + exact hno 1 le_rfl (by omega) h1 + · have hj_eq : (Ω.toFun^[j]) z = (Ω.toFun^[j - k₁]) (Ω' z) := by + rw [← hk₁_eq, ← Function.iterate_add_apply, Nat.sub_add_cancel (le_of_lt hgt)] + rw [hj_eq] at hjY + exact hk₂_min (j - k₁) (by omega) (by omega) hjY + obtain ⟨k, hk1, hk_eq, hk_min⟩ := hind m hm1 hx hm_min + exact ⟨k, hk1, hk_eq.trans hm_eq, hyY, hk_min⟩ + +theorem IsRestriction.firstHitIn_iff {X : Set α} {Ω' : CyclicPerm α} + (h : Ω.IsRestriction X Ω') {Y : Set α} (hY : Y ⊆ Ω'.bar) {x y : α} (hx : x ∈ Ω'.bar) : + Ω'.FirstHitIn Y x y ↔ Ω.FirstHitIn Y x y := by + refine ⟨firstHitIn_of_forall_firstHitIn h.2 hY hx, fun hΩ => ?_⟩ + have hyY : y ∈ Y := hΩ.mem_set + have hne : (Ω'.bar ∩ Y).Nonempty := ⟨y, hY hyY, hyY⟩ + obtain ⟨y', hy'⟩ := Ω'.exists_firstHitIn hx hne + have hΩ' : Ω.FirstHitIn Y x y' := + firstHitIn_of_forall_firstHitIn h.2 hY hx hy' + rwa [hΩ.unique hΩ'] + +theorem IsRestriction.isClockwiseSeq_iff {X : Set α} {Ω' : CyclicPerm α} + (h : Ω.IsRestriction X Ω') {L : List α} : + Ω'.IsClockwiseSeq L ↔ {v | v ∈ L} ⊆ Ω'.bar ∧ Ω.IsClockwiseSeq L := by + unfold IsClockwiseSeq + constructor + · rintro ⟨hnodup, hsub, hhit⟩ + have hsub' : {v | v ∈ L} ⊆ Ω'.bar := fun v hv => hsub v hv + refine ⟨hsub', hnodup, fun v hv => h.bar_subset (hsub v hv), fun i hi => ?_⟩ + exact (h.firstHitIn_iff hsub' (hsub _ (List.getElem_mem hi))).mp (hhit i hi) + · rintro ⟨hsub, hnodup, _, hhit⟩ + refine ⟨hnodup, fun v hv => hsub hv, fun i hi => ?_⟩ + exact (h.firstHitIn_iff hsub (hsub (List.getElem_mem hi))).mpr (hhit i hi) + +theorem IsRestriction.isClockwise3_iff {X : Set α} {Ω' : CyclicPerm α} + (h : Ω.IsRestriction X Ω') {x y z : α} : + Ω'.IsClockwise3 x y z ↔ x ∈ Ω'.bar ∧ y ∈ Ω'.bar ∧ z ∈ Ω'.bar ∧ Ω.IsClockwise3 x y z := by + unfold IsClockwise3 + rw [h.isClockwiseSeq_iff] + have hset : {v | v ∈ ([x, y, z] : List α)} ⊆ Ω'.bar ↔ x ∈ Ω'.bar ∧ y ∈ Ω'.bar ∧ z ∈ Ω'.bar := by + constructor + · intro hs + exact ⟨hs (by simp), hs (by simp), hs (by simp)⟩ + · rintro ⟨hx, hy, hz⟩ v hv + simp only [mem_ofPred_eq, List.mem_cons, List.not_mem_nil, or_false] at hv + rcases hv with rfl | rfl | rfl <;> assumption + rw [hset] + tauto + +theorem IsRestriction.isClockwise4_iff {X : Set α} {Ω' : CyclicPerm α} + (h : Ω.IsRestriction X Ω') {v₁ v₂ v₃ v₄ : α} : + Ω'.IsClockwise4 v₁ v₂ v₃ v₄ ↔ + v₁ ∈ Ω'.bar ∧ v₂ ∈ Ω'.bar ∧ v₃ ∈ Ω'.bar ∧ v₄ ∈ Ω'.bar ∧ Ω.IsClockwise4 v₁ v₂ v₃ v₄ := by + unfold IsClockwise4 + rw [h.isClockwiseSeq_iff] + have hset : {v | v ∈ ([v₁, v₂, v₃, v₄] : List α)} ⊆ Ω'.bar ↔ + v₁ ∈ Ω'.bar ∧ v₂ ∈ Ω'.bar ∧ v₃ ∈ Ω'.bar ∧ v₄ ∈ Ω'.bar := by + constructor + · intro hs + exact ⟨hs (by simp), hs (by simp), hs (by simp), hs (by simp)⟩ + · rintro ⟨h1, h2, h3, h4⟩ v hv + simp only [mem_ofPred_eq, List.mem_cons, List.not_mem_nil, or_false] at hv + rcases hv with rfl | rfl | rfl | rfl <;> assumption + rw [hset] + tauto + +theorem IsRestriction.crosses_iff {X : Set α} {Ω' : CyclicPerm α} + (h : Ω.IsRestriction X Ω') {s₁ t₁ s₂ t₂ : α} : + Ω'.Crosses s₁ t₁ s₂ t₂ ↔ + s₁ ∈ Ω'.bar ∧ t₁ ∈ Ω'.bar ∧ s₂ ∈ Ω'.bar ∧ t₂ ∈ Ω'.bar ∧ Ω.Crosses s₁ t₁ s₂ t₂ := by + change (Ω'.IsClockwise4 s₁ s₂ t₁ t₂ ∨ Ω'.IsClockwise4 t₂ t₁ s₂ s₁) ↔ + s₁ ∈ Ω'.bar ∧ t₁ ∈ Ω'.bar ∧ s₂ ∈ Ω'.bar ∧ t₂ ∈ Ω'.bar ∧ + (Ω.IsClockwise4 s₁ s₂ t₁ t₂ ∨ Ω.IsClockwise4 t₂ t₁ s₂ s₁) + rw [h.isClockwise4_iff, h.isClockwise4_iff] + tauto + +theorem IsRestriction.interval_eq {X : Set α} {Ω' : CyclicPerm α} + (h : Ω.IsRestriction X Ω') {a b : α} (ha : a ∈ Ω'.bar) (hb : b ∈ Ω'.bar) : + Ω'.interval a b = Ω.interval a b ∩ Ω'.bar := by + ext v + simp only [interval, mem_ofPred_eq, mem_inter_iff, h.isClockwise3_iff] + constructor + · rintro ⟨⟨hv, hne⟩, _, _, _, hcw⟩ + exact ⟨⟨⟨h.bar_subset hv, hne⟩, hcw⟩, hv⟩ + · rintro ⟨⟨⟨_, hne⟩, hcw⟩, hv⟩ + exact ⟨⟨hv, hne⟩, ha, hv, hb, hcw⟩ + +/-- Existence of a restriction `Ω | X` for any cyclic permutation `Ω` and set `X`. -/ +theorem exists_isRestriction (Ω : CyclicPerm α) (X : Set α) : + ∃ Ω' : CyclicPerm α, Ω.IsRestriction X Ω' := by + classical + let W := Ω.bar ∩ X + let nextW (x : α) : α := + if hx : x ∈ W then (Ω.exists_firstHitIn hx.1 ⟨x, hx.1, hx⟩).choose else x + have hnext_spec : ∀ {x : α}, x ∈ W → Ω.FirstHitIn W x (nextW x) := by + intro x hx + simp only [nextW, hx, ↓reduceDIte] + exact (Ω.exists_firstHitIn hx.1 ⟨x, hx.1, hx⟩).choose_spec + have hnext_mem : ∀ {x : α}, x ∈ W → nextW x ∈ W := fun hx => + CyclicPerm.FirstHitIn.mem_set (hnext_spec hx) + have hiter_mem : ∀ (m : ℕ) {x : α}, x ∈ W → (nextW^[m]) x ∈ W := by + intro m + induction m with + | zero => intro x hx; exact hx + | succ m ih => + intro x hx + rw [Function.iterate_succ_apply'] + exact hnext_mem (ih hx) + have hnext_inj : Set.InjOn nextW W := by + intro x₁ hx₁ x₂ hx₂ heq + have h₁ := hnext_spec hx₁ + have h₂ := hnext_spec hx₂ + rw [heq] at h₁ + exact CyclicPerm.FirstHitIn.inj_left hx₁.1 hx₂.1 hx₁ hx₂ h₁ h₂ + have hreach_aux : ∀ (K : ℕ) {x z : α}, x ∈ W → z ∈ W → (Ω.toFun^[K]) x = z → + ∃ m : ℕ, (nextW^[m]) x = z := by + intro K + induction K using Nat.strong_induction_on with + | ind K ih => + intro x z hx hz hK + rcases Nat.eq_zero_or_pos K with rfl | hK_pos + · exact ⟨0, hK⟩ + · obtain ⟨k₁, hk₁_pos, hk₁_eq, _, hk₁_min⟩ := hnext_spec hx + have hk₁_le : k₁ ≤ K := by + by_contra hgt + exact hk₁_min K hK_pos (by omega) (hK ▸ hz) + have hrem : (Ω.toFun^[K - k₁]) (nextW x) = z := by + have hiter : (Ω.toFun^[k₁]) ((Ω.toFun^[K - k₁]) (nextW x)) = (Ω.toFun^[k₁]) z := by + rw [← hk₁_eq] + simp only [← Function.iterate_add_apply] + rw [Nat.sub_add_cancel hk₁_le, Function.iterate_add_apply, hK] + exact Ω.injOn_iterate k₁ (Ω.iterate_mem (K - k₁) (hnext_mem hx).1) hz.1 hiter + obtain ⟨m, hm⟩ := ih (K - k₁) (by omega) (hnext_mem hx) hz hrem + refine ⟨m + 1, ?_⟩ + rw [Function.iterate_succ_apply, hm] + have horb : ∀ x ∈ W, ∀ y ∈ W, ∃ k : ℕ, (nextW^[k]) x = y := by + intro x hx y hy + obtain ⟨K, hK⟩ := Ω.single_orbit x hx.1 y hy.1 + exact hreach_aux K hx hy hK + have hsurj : Set.SurjOn nextW W W := by + intro y hy + obtain ⟨k, hk⟩ := horb (nextW y) (hnext_mem hy) y hy + refine ⟨(nextW^[k]) y, hiter_mem k hy, ?_⟩ + have hstep : nextW ((nextW^[k]) y) = (nextW^[k + 1]) y := + (Function.iterate_succ_apply' nextW k y).symm + rw [hstep, Function.iterate_succ_apply, hk] + refine ⟨{ + bar := W + toFun := nextW + finite_bar := Ω.finite_bar.subset inter_subset_left + bijOn := ⟨fun _ hx => hnext_mem hx, hnext_inj, hsurj⟩ + single_orbit := horb + }, rfl, fun x hx => hnext_spec hx⟩ + +end CyclicPerm + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/RuralAdd.lean b/LeanPool/GraphMinor/GM09/RuralAdd.lean new file mode 100644 index 0000000000..6303b927e8 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/RuralAdd.lean @@ -0,0 +1,623 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.RuralClean +public import LeanPool.GraphMinor.Surface.EdgeLens +public import LeanPool.GraphMinor.Surface.ArcTools +public import LeanPool.GraphMinor.Surface.ChartCells +public import LeanPool.GraphMinor.Surface.SurfacePull +public import LeanPool.GraphMinor.Surface.Jordan +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Free curves near a drawing + +Here we find room for one more edge in a clean presentation. Beside an edge there is a thin disc +that meets the rest of the drawing only in the ends of the edge (`exists_edge_lens`, which works in +a closed surface, so we use it in the sphere and come back to the plane). This gives a second line +parallel to the edge, and, at any vertex that is not on the inner disc, an `O`-arc that meets the +drawing only in that vertex. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 +open scoped unitInterval + +universe u v + +variable {α : Type u} {β : Type v} + +/-- The sphere is a closed surface. -/ +theorem isClosedSurface_sphere : IsClosedSurface (OnePoint EuclideanPlane) := by + refine ⟨inferInstance, inferInstance, fun x => ?_⟩ + obtain ⟨h, hh⟩ := exists_homeomorph_onePoint x + obtain ⟨k, hk⟩ := exists_homeomorph_onePoint ((0 : EuclideanPlane) : OnePoint EuclideanPlane) + let g := h.trans k.symm + have hgx : g x = ((0 : EuclideanPlane) : OnePoint EuclideanPlane) := by + simp only [g, Homeomorph.trans_apply, hh, ← hk, Homeomorph.symm_apply_apply] + have hemb : IsOpenEmbedding ((↑) : EuclideanPlane → OnePoint EuclideanPlane) := + OnePoint.isOpenEmbedding_coe + let U₀ : Set (OnePoint EuclideanPlane) := (↑) '' OpenUnitDisc + have hopen : IsOpen OpenUnitDisc := Metric.isOpen_ball + refine ⟨g ⁻¹' U₀, (hemb.isOpenMap _ hopen).preimage g.continuous, ?_, ?_⟩ + · rw [mem_preimage, hgx] + exact ⟨0, Metric.mem_ball_self one_pos, rfl⟩ + · exact ⟨(g.sets rfl).trans (hemb.isEmbedding.homeomorphImage OpenUnitDisc).symm⟩ + +/-- A thin disc around a line of the plane, which meets the closed set `Z` only in the ends of the +line, with a second line with the same ends that lies in the disc and misses the first. -/ +theorem exists_plane_lens {L Z : Set EuclideanPlane} {u v : EuclideanPlane} + (hL : IsLineWithEnds L u v) (huv : u ≠ v) (hZ : IsClosed Z) (hLZ : L ∩ Z ⊆ {u, v}) : + ∃ D K : Set EuclideanPlane, IsClosedDisc D ∧ L ⊆ D ∧ D ∩ Z ⊆ {u, v} ∧ u ∈ discBd D ∧ + v ∈ discBd D ∧ IsPreconnected (D \ {u, v}) ∧ IsLineWithEnds K u v ∧ K ⊆ D ∧ + Disjoint (K \ {u, v}) L := by + classical + let c : EuclideanPlane → OnePoint EuclideanPlane := (↑) + have hc : IsOpenEmbedding c := OnePoint.isOpenEmbedding_coe + let r : OnePoint EuclideanPlane → EuclideanPlane := invFun c + have hrc : ∀ x, r (c x) = x := leftInverse_invFun hc.injective + have hcr : ∀ p ∈ range c, c (r p) = p := by + rintro _ ⟨x, rfl⟩ + rw [hrc] + have hrcont : ContinuousOn r (range c) := by + rw [continuousOn_iff_continuous_domRestrict] + change Continuous fun y : range c => r y.1 + have : (fun y : range c => r y.1) = hc.isEmbedding.toHomeomorph.symm := by + funext y + obtain ⟨_, x, rfl⟩ := y + apply hc.isEmbedding.toHomeomorph.injective + rw [Homeomorph.apply_symm_apply] + exact Subtype.ext (hcr _ ⟨x, rfl⟩) + rw [this] + exact Homeomorph.continuous _ + have hL' : IsLineWithEnds (c '' L) (c u) (c v) := hL.map_of_embedding hc.isEmbedding + have hne : c u ≠ c v := fun h => huv (hc.injective h) + let Z' : Set (OnePoint EuclideanPlane) := c '' Z ∪ {OnePoint.infty} + have hZ' : IsClosed Z' := by + rw [← isOpen_compl_iff] + have : Z'ᶜ = c '' Zᶜ := by + ext p + induction p using OnePoint.rec with + | infty => + constructor + · intro h + exact (h (Or.inr rfl)).elim + · rintro ⟨x, -, hx⟩ + exact (OnePoint.coe_ne_infty x hx).elim + | coe x => + constructor + · intro h + exact ⟨x, fun hz => h (Or.inl ⟨x, hz, rfl⟩), rfl⟩ + · rintro ⟨y, hy, hxy⟩ (⟨z, hz, hzx⟩ | h) + · obtain rfl := hc.injective (hzx.trans hxy.symm) + exact hy hz + · exact (OnePoint.coe_ne_infty x h).elim + rw [this] + exact hc.isOpenMap _ hZ.isOpen_compl + have hLZ' : c '' L ∩ Z' ⊆ {c u, c v} := by + rintro _ ⟨⟨x, hx, rfl⟩, ⟨y, hy, hxy⟩ | h⟩ + · obtain rfl := hc.injective hxy + rcases hLZ ⟨hx, hy⟩ with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + · exact (OnePoint.coe_ne_infty x h).elim + obtain ⟨D₀, A, B, hD₀, hLD₀, hD₀Z, hub, hvb, -, hDe, hAc, hBc, -, -, hAL, hBL, hLA, hLB, + ⟨p, hpD, hpA⟩, -⟩ := exists_edge_lens isClosedSurface_sphere hL' hne hZ' hLZ' + have hD₀c : D₀ ⊆ range c := by + intro q hq + induction q using OnePoint.rec with + | infty => + have := hD₀Z ⟨hq, Or.inr rfl⟩ + rcases this with h | h + · exact (OnePoint.coe_ne_infty _ h.symm).elim + · exact (OnePoint.coe_ne_infty _ (mem_singleton_iff.mp h).symm).elim + | coe x => exact ⟨x, rfl⟩ + have hrD := hrcont.mono hD₀c + have hcD : ContinuousOn c (r '' D₀) := hc.continuous.continuousOn + have hleft : LeftInvOn c r D₀ := fun q hq => hcr q (hD₀c hq) + obtain ⟨hD, hDb⟩ := hD₀.image hrD hcD hleft + have hLA' : c '' L \ {c u, c v} ⊆ closure A ∩ closure B := fun x hx => ⟨hLA hx.1, hLB hx.1⟩ + have hdiffc := hL'.isPreconnected_diff + have hcl := hL'.subset_closure_diff + have hnonempty : (c '' L \ {c u, c v}).Nonempty := by + by_contra h + rw [not_nonempty_iff_eq_empty] at h + rw [h, closure_empty] at hcl + exact hcl hL'.left_mem + have hAL₀ : IsPreconnected (A ∪ (c '' L \ {c u, c v})) := + hAc.subset_closure subset_union_left (union_subset subset_closure fun x hx => hLA hx.1) + have hBL₀ : IsPreconnected (B ∪ (c '' L \ {c u, c v})) := + hBc.subset_closure subset_union_left (union_subset subset_closure fun x hx => hLB hx.1) + have hun : IsPreconnected ((A ∪ (c '' L \ {c u, c v})) ∪ (B ∪ (c '' L \ {c u, c v}))) := by + obtain ⟨w, hw⟩ := hnonempty + exact IsPreconnected.union w (Or.inr hw) (Or.inr hw) hAL₀ hBL₀ + have hset : (A ∪ (c '' L \ {c u, c v})) ∪ (B ∪ (c '' L \ {c u, c v})) = D₀ \ {c u, c v} := by + have huL : c u ∈ c '' L := hL'.left_mem + have hvL : c v ∈ c '' L := hL'.right_mem + ext x + constructor + · rintro ((h | h) | (h | h)) + · refine ⟨hDe ▸ Or.inl (Or.inl h), ?_⟩ + rintro (rfl | rfl) + · exact disjoint_left.mp hAL h huL + · exact disjoint_left.mp hAL h hvL + · exact ⟨hDe ▸ Or.inr h.1, h.2⟩ + · refine ⟨hDe ▸ Or.inl (Or.inr h), ?_⟩ + rintro (rfl | rfl) + · exact disjoint_left.mp hBL h huL + · exact disjoint_left.mp hBL h hvL + · exact ⟨hDe ▸ Or.inr h.1, h.2⟩ + · rintro ⟨hx, hn⟩ + rw [hDe] at hx + rcases hx with (h | h) | h + · exact Or.inl (Or.inl h) + · exact Or.inr (Or.inl h) + · exact Or.inl (Or.inr ⟨h, hn⟩) + rw [hset] at hun + have hru : r (c u) = u := hrc u + have hrv : r (c v) = v := hrc v + have himg : r '' (D₀ \ {c u, c v}) = r '' D₀ \ {u, v} := by + ext x + constructor + · rintro ⟨q, ⟨hq, hn⟩, rfl⟩ + refine ⟨⟨q, hq, rfl⟩, ?_⟩ + rintro (h | h) + · exact hn (Or.inl (by rw [← hcr q (hD₀c hq), h])) + · exact hn (Or.inr (by rw [← hcr q (hD₀c hq), h]; rfl)) + · rintro ⟨⟨q, hq, rfl⟩, hn⟩ + refine ⟨q, ⟨hq, ?_⟩, rfl⟩ + rintro (rfl | rfl) + · exact hn (Or.inl hru) + · exact hn (Or.inr hrv) + have hprange : range p ⊆ range c := hpD.trans hD₀c + have hγ : Continuous fun t : I => r (p t) := by + refine hrcont.comp_continuous p.continuous fun t => hprange ⟨t, rfl⟩ + obtain ⟨e, hec, hei, he0, he1, her⟩ := exists_arc_of_path hγ (by + simp only [Path.source, Path.target, hru, hrv] + exact huv) + simp only [Path.source, hru] at he0 + simp only [Path.target, hrv] at he1 + have hK : IsLineWithEnds (range e) u v := by + have := IsArcMap.isLineWithEnds (⟨hec, hei⟩ : IsArcMap e) + rwa [he0, he1] at this + refine ⟨r '' D₀, range e, hD, ?_, ?_, ?_, ?_, ?_, hK, ?_, ?_⟩ + · intro x hx + exact ⟨c x, hLD₀ ⟨x, hx, rfl⟩, hrc x⟩ + · rintro _ ⟨⟨q, hq, rfl⟩, hz⟩ + have hq' : q ∈ Z' := Or.inl ⟨_, hz, hcr q (hD₀c hq)⟩ + rcases hD₀Z ⟨hq, hq'⟩ with rfl | rfl + · exact Or.inl hru + · exact Or.inr hrv + · rw [hDb] + exact ⟨c u, hub, hru⟩ + · rw [hDb] + exact ⟨c v, hvb, hrv⟩ + · rw [← himg] + exact hun.image r (hrD.mono sdiff_subset) + · intro x hx + obtain ⟨t, rfl⟩ := her hx + exact ⟨p t, hpD ⟨t, rfl⟩, rfl⟩ + · rw [disjoint_left] + rintro x ⟨hx, hn⟩ hxL + obtain ⟨t, rfl⟩ := her hx + have ht0 : t ≠ 0 := fun h => hn (Or.inl (by change r (p t) = u; rw [h, Path.source]; exact hru)) + have ht1 : t ≠ 1 := fun h => hn (Or.inr (by change r (p t) = v; rw [h, Path.target]; exact hrv)) + have hA := hpA t (unitInterval.pos_iff_ne_zero.mpr ht0) (unitInterval.lt_one_iff_ne_one.mpr ht1) + refine disjoint_left.mp hAL hA ⟨_, hxL, ?_⟩ + exact hcr _ (hprange ⟨t, rfl⟩) + +/-- In a disc, at any point `x`, there is an `O`-arc through `x` as close to `x` as we like which +otherwise stays off the boundary of the disc. -/ +theorem exists_oArc_in_disc {S : Type*} [TopologicalSpace S] [T2Space S] {D W : Set S} + (hD : IsClosedDisc D) {x : S} (hx : x ∈ D) (hW : IsOpen W) (hxW : x ∈ W) : + ∃ F : Set S, IsOArc F ∧ x ∈ F ∧ F ⊆ D ∩ W ∧ F \ {x} ⊆ D \ discBd D := by + obtain ⟨h, g, cc⟩ := hD.exists_isChart + let w : ℂ := h x + have hw : w ∈ Metric.closedBall (0 : ℂ) 1 := cc.hm hx + have hgw : g w = x := cc.gh hx + obtain ⟨ε, hε, hball⟩ : ∃ ε > 0, ∀ z ∈ Metric.closedBall (0 : ℂ) 1, dist z w < ε → g z ∈ W := by + have := (cc.gc w hw).preimage_mem_nhdsWithin (hW.mem_nhds (hgw ▸ hxW)) + obtain ⟨ε, hε, hsub⟩ := Metric.mem_nhdsWithin_iff.mp this + exact ⟨ε, hε, fun z hz hd => hsub ⟨hd, hz⟩⟩ + obtain ⟨F₀, hF₀, hwF, hsubB, hsph, hnear⟩ : ∃ F₀ : Set ℂ, IsOArc F₀ ∧ w ∈ F₀ ∧ + F₀ ⊆ Metric.closedBall (0 : ℂ) 1 ∧ F₀ ∩ Metric.sphere (0 : ℂ) 1 ⊆ {w} ∧ + ∀ z ∈ F₀, dist z w < ε := by + by_cases hw1 : ‖w‖ = 1 + · have hws : w ∈ Metric.sphere (0 : ℂ) 1 := mem_sphere_zero_iff_norm.mpr hw1 + let ρ : ℝ := min (ε / 3) (1 / 2) + have hρ : 0 < ρ := lt_min (by linarith) (by norm_num) + have hρ1 : ρ < 1 := lt_of_le_of_lt (min_le_right _ _) (by norm_num) + have hρε : ρ ≤ ε / 3 := min_le_left _ _ + refine ⟨loopCircle w ρ, isOArc_loopCircle w hρ, mem_loopCircle_self hws ρ, + loopCircle_subset_closedBall hws hρ hρ1, ?_, ?_⟩ + · rw [loopCircle_inter_sphere hws hρ hρ1] + · rintro _ ⟨c, rfl⟩ + have heq : (1 - (ρ : ℂ)) * w + (ρ : ℂ) * (c : ℂ) - w = (ρ : ℂ) * ((c : ℂ) - w) := by ring + rw [dist_eq_norm] + simp only [heq, norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hρ] + have : ‖(c : ℂ) - w‖ ≤ 2 := by + calc ‖(c : ℂ) - w‖ ≤ ‖(c : ℂ)‖ + ‖w‖ := norm_sub_le _ _ + _ = 2 := by rw [Circle.norm_coe, hw1]; norm_num + nlinarith + · have hlt : ‖w‖ < 1 := lt_of_le_of_ne (mem_closedBall_zero_iff.mp hw) hw1 + let ρ : ℝ := min (ε / 3) ((1 - ‖w‖) / 3) + have hρ : 0 < ρ := lt_min (by linarith) (by linarith) + have hρ1 : ρ ≤ (1 - ‖w‖) / 3 := min_le_right _ _ + have hρε : ρ ≤ ε / 3 := min_le_left _ _ + let m : Circle → ℂ := fun c => w + (ρ : ℂ) + (ρ : ℂ) * (c : ℂ) + have hmc : Continuous m := by fun_prop + have hmi : Injective m := by + intro c c' hcc + have h₁ : (ρ : ℂ) * (c : ℂ) = (ρ : ℂ) * (c' : ℂ) := add_left_cancel hcc + have h₂ : (ρ : ℂ) ≠ 0 := by exact_mod_cast hρ.ne' + exact Circle.ext (mul_left_cancel₀ h₂ h₁) + have hmn : ∀ c, ‖m c - w‖ ≤ 2 * ρ := by + intro c + have heq : m c - w = (ρ : ℂ) + (ρ : ℂ) * (c : ℂ) := by simp only [m]; ring + rw [heq] + calc ‖(ρ : ℂ) + (ρ : ℂ) * (c : ℂ)‖ ≤ ‖(ρ : ℂ)‖ + ‖(ρ : ℂ) * (c : ℂ)‖ := norm_add_le _ _ + _ = 2 * ρ := by + simp only [norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hρ, + Circle.norm_coe] + ring + have hmb : ∀ c, ‖m c‖ < 1 := by + intro c + have h₁ : ‖m c‖ ≤ ‖m c - w‖ + ‖w‖ := by + simpa using norm_add_le (m c - w) w + linarith [hmn c] + have hw0 : ∃ c : Circle, m c = w := by + refine ⟨Circle.exp Real.pi, ?_⟩ + simp only [m, Circle.coe_exp, Complex.exp_pi_mul_I] + ring + obtain ⟨c₀, hc₀⟩ := hw0 + refine ⟨range m, ⟨(hmc.isClosedEmbedding hmi).isEmbedding.toHomeomorph⟩, ⟨c₀, hc₀⟩, ?_, ?_, + ?_⟩ + · rintro _ ⟨c, rfl⟩ + exact mem_closedBall_zero_iff.mpr (hmb c).le + · rintro _ ⟨⟨c, rfl⟩, hs⟩ + exact absurd (mem_sphere_zero_iff_norm.mp hs) (hmb c).ne + · rintro _ ⟨c, rfl⟩ + rw [dist_eq_norm] + linarith [hmn c] + obtain ⟨ψ⟩ := hF₀ + have hgF : ContinuousOn g F₀ := cc.gc.mono hsubB + have hinj : InjOn g F₀ := cc.hg.injOn.mono hsubB + let m : Circle → S := fun c => g (ψ c).1 + have hmc : Continuous m := + hgF.comp_continuous (continuous_subtype_val.comp ψ.continuous) fun c => (ψ c).2 + have hmi : Injective m := fun c c' hcc => + ψ.injective (Subtype.ext (hinj (ψ c).2 (ψ c').2 hcc)) + have hrange : range m = g '' F₀ := by + ext y + constructor + · rintro ⟨c, rfl⟩ + exact ⟨_, (ψ c).2, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + exact ⟨ψ.symm ⟨z, hz⟩, by simp [m]⟩ + refine ⟨g '' F₀, ?_, ⟨w, hwF, hgw⟩, ?_, ?_⟩ + · rw [← hrange] + exact ⟨(hmc.isClosedEmbedding hmi).isEmbedding.toHomeomorph⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact ⟨cc.gm (hsubB hz), hball z (hsubB hz) (hnear z hz)⟩ + · rintro _ ⟨⟨z, hz, rfl⟩, hne⟩ + refine ⟨cc.gm (hsubB hz), fun hb => hne ?_⟩ + have hzs : z ∈ Metric.sphere (0 : ℂ) 1 := by + rw [← cc.bd] + exact ⟨g z, hb, cc.hg (hsubB hz)⟩ + rw [mem_singleton_iff.mp (hsph ⟨hz, hzs⟩)] + exact hgw + +/-- The boundary of a closed set in the plane. -/ +theorem subBd_eq_of_isClosed {S : Type*} [TopologicalSpace S] {X : Set S} (h : IsClosed X) : + subBd X = X \ interior X := by + rw [subBd, h.closure_eq, ← compl_eq_univ_sdiff, closure_compl] + rfl + +/-- A connected set off both boundaries that meets the region between them stays in it. -/ +theorem subset_region_of_isPreconnected {X X₀ T : Set EuclideanPlane} (hX : IsClosed X) + (hX₀ : IsClosed X₀) (hT : IsPreconnected T) (hb : Disjoint T (subBd X ∪ subBd X₀)) {y : + EuclideanPlane} + (hy : y ∈ T) (hyr : y ∈ interior X \ X₀) : T ⊆ interior X \ X₀ := by + have hY : IsOpen (interior X \ X₀) := isOpen_interior.sdiff hX₀ + have hW : IsOpen (Xᶜ ∪ interior X₀) := hX.isOpen_compl.union isOpen_interior + refine hT.subset_left_of_subset_union hY hW ?_ ?_ ⟨y, hy, hyr⟩ + · rw [disjoint_left] + rintro x ⟨hx, hx₀⟩ (h | h) + · exact h (interior_subset hx) + · exact hx₀ (interior_subset h) + · intro x hx + have hn : x ∉ subBd X ∪ subBd X₀ := disjoint_left.mp hb hx + rw [subBd_eq_of_isClosed hX, subBd_eq_of_isClosed hX₀] at hn + by_cases h₁ : x ∈ X + · have h₂ : x ∈ interior X := by + by_contra h + exact hn (Or.inl ⟨h₁, h⟩) + by_cases h₃ : x ∈ X₀ + · have h₄ : x ∈ interior X₀ := by + by_contra h + exact hn (Or.inr ⟨h₃, h⟩) + exact Or.inr (Or.inr h₄) + · exact Or.inl ⟨h₂, h₃⟩ + · exact Or.inr (Or.inl h₁) + +/-- The region between the boundaries misses both boundaries. -/ +theorem disjoint_region_subBd {X X₀ : Set EuclideanPlane} (hX : IsClosed X) (hX₀ : IsClosed X₀) : + Disjoint (interior X \ X₀) (subBd X ∪ subBd X₀) := by + rw [subBd_eq_of_isClosed hX, subBd_eq_of_isClosed hX₀, disjoint_left] + rintro x ⟨hx, hx₀⟩ (h | h) + · exact h.2 hx + · exact hx₀ h.1 + +section Region + +variable {D : Drawing EuclideanPlane} {X X₀ : Set EuclideanPlane} + +theorem exists_edge_of_mem' {x : EuclideanPlane} (hx : x ∈ D.U) (hxV : x ∉ D.V) : + ∃ e ∈ D.E, x ∈ e := by + have hxF : x ∈ D.U \ D.V := ⟨hx, hxV⟩ + exact ⟨pathComponentIn (D.U \ D.V) x, + GraphMinor.Surface.mem_arcComponentsIn_of_mem hxF, mem_pathComponentIn_self hxF⟩ + +/-- Beside a part `L` of an edge there is a thin disc whose part off the ends of `L` lies in the +region between the two boundaries, and in it a line with the ends of `L` that is off the drawing. -/ +theorem exists_lens_of_subline (hX : IsClosed X) (hX₀ : IsClosed X₀) + (hU : D.U ⊆ X \ interior X₀) (hclean : D.U ∩ (subBd X ∪ subBd X₀) ⊆ D.V) + {e : Set EuclideanPlane} (he : e ∈ D.E) {L : Set EuclideanPlane} {a b : EuclideanPlane} + (hL : IsLineWithEnds L a b) (hab : a ≠ b) (hLe : L \ {a, b} ⊆ e) + (hrest : IsClosed (closure e \ (L \ {a, b}))) : + ∃ B K : Set EuclideanPlane, IsClosedDisc B ∧ a ∈ discBd B ∧ b ∈ discBd B ∧ + B \ {a, b} ⊆ interior X \ X₀ ∧ IsLineWithEnds K a b ∧ K ⊆ B ∧ Disjoint (K \ {a, b}) D.U := by + classical + have heV : e ⊆ D.U \ D.V := he.2.1 + let Zb : Set EuclideanPlane := subBd X ∪ subBd X₀ + have hZbc : IsClosed Zb := (isClosed_subBd X).union (isClosed_subBd X₀) + let Z : Set EuclideanPlane := + (D.V ∪ ⋃ f ∈ D.E \ {e}, closure f) ∪ (closure e \ (L \ {a, b})) ∪ Zb + have hZ : IsClosed Z := ((D.finite_V.isClosed.union ((D.finite_edges.subset + sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure)).union hrest).union hZbc + have hoff : ∀ x ∈ L \ {a, b}, x ∉ Z := by + intro x hx hxZ + have hxe := hLe hx + have hxU := (heV hxe).1 + have hxV := (heV hxe).2 + rcases hxZ with ((h | h) | h) | h + · exact hxV h + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp h + have hxf' : x ∈ f := D.closure_diff_V hf.1 ▸ ⟨hxf, hxV⟩ + have hu : IsPathConnected (f ∪ e) := hf.1.2.2.1.union he.2.2.1 ⟨x, hxf', hxe⟩ + have h₁ := hf.1.2.2.2 (f ∪ e) (union_subset hf.1.2.1 he.2.1) hu subset_union_left + have h₂ := he.2.2.2 (f ∪ e) (union_subset hf.1.2.1 he.2.1) hu subset_union_right + exact hf.2 (h₁.symm.trans h₂) + · exact h.2 hx + · exact hxV (hclean ⟨hxU, h⟩) + have hLZ : L ∩ Z ⊆ {a, b} := by + rintro x ⟨hxL, hxZ⟩ + by_contra hn + exact hoff x ⟨hxL, hn⟩ hxZ + have hUZ : D.U ⊆ Z ∪ (L \ {a, b}) := by + intro x hx + by_cases hxV : x ∈ D.V + · exact Or.inl (Or.inl (Or.inl (Or.inl hxV))) + obtain ⟨f, hf, hxf⟩ := exists_edge_of_mem' hx hxV + by_cases hfe : f = e + · by_cases hxL : x ∈ L \ {a, b} + · exact Or.inr hxL + · exact Or.inl (Or.inl (Or.inr ⟨subset_closure (hfe ▸ hxf), hxL⟩)) + · exact Or.inl (Or.inl (Or.inl (Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfe⟩, subset_closure hxf⟩)))) + obtain ⟨B, K, hB, hLB, hBZ, haB, hbB, hconn, hK, hKB, hKL⟩ := exists_plane_lens hL hab hZ hLZ + have hL₀ : (L \ {a, b}).Nonempty := hL.nonempty_sdiff + obtain ⟨y, hy⟩ := hL₀ + have hyr : y ∈ interior X \ X₀ := by + have hyU := (heV (hLe hy)).1 + have hyV := (heV (hLe hy)).2 + have hyb : y ∉ Zb := fun h => hyV (hclean ⟨hyU, h⟩) + have hyX := hU hyU + change y ∉ subBd X ∪ subBd X₀ at hyb + rw [subBd_eq_of_isClosed hX, subBd_eq_of_isClosed hX₀] at hyb + refine ⟨by_contra fun h => hyb (Or.inl ⟨hyX.1, h⟩), fun h => hyb (Or.inr ⟨h, hyX.2⟩)⟩ + have hreg : B \ {a, b} ⊆ interior X \ X₀ := by + refine subset_region_of_isPreconnected hX hX₀ hconn ?_ ⟨hLB hy.1, hy.2⟩ hyr + rw [disjoint_left] + rintro x ⟨hxB, hxn⟩ hxb + exact hxn (hBZ ⟨hxB, Or.inr hxb⟩) + refine ⟨B, K, hB, haB, hbB, hreg, hK, hKB, ?_⟩ + rw [disjoint_left] + rintro x ⟨hxK, hxn⟩ hxU + rcases hUZ hxU with h | h + · exact hxn (hBZ ⟨hKB hxK, h⟩) + · exact disjoint_left.mp hKL ⟨hxK, hxn⟩ h.1 + +/-- A line that is off the drawing except at its ends, and lies in the region between the two +boundaries, gives an `O`-arc at its first end with the same properties. -/ +theorem exists_oArc_of_line (hX : IsClosed X) (hX₀ : IsClosed X₀) + {K : Set EuclideanPlane} {a b : EuclideanPlane} (hK : IsLineWithEnds K a b) + (hKr : K \ {a, b} ⊆ interior X \ X₀) (hKU : Disjoint (K \ {a, b}) D.U) : + ∃ F : Set EuclideanPlane, IsOArc F ∧ a ∈ F ∧ F \ {a} ⊆ interior X \ X₀ ∧ + Disjoint (F \ {a}) D.U := by + classical + have hK₀ : (K \ {a, b}).Nonempty := hK.nonempty_sdiff + obtain ⟨z, hz⟩ := hK₀ + have hza : z ≠ a := fun h => hz.2 (Or.inl h) + have hzb : z ≠ b := fun h => hz.2 (Or.inr h) + obtain ⟨K₁, K₂, hK₁, hK₂, hu, hi⟩ := hK.split hz.1 hza hzb + let Z : Set EuclideanPlane := D.U ∪ (subBd X ∪ subBd X₀) + have hZ : IsClosed Z := D.isClosed_U.union ((isClosed_subBd X).union (isClosed_subBd X₀)) + have hoff : ∀ x ∈ K \ {a, b}, x ∉ Z := by + rintro x hx (h | h) + · exact disjoint_left.mp hKU hx h + · exact disjoint_left.mp (disjoint_region_subBd hX hX₀) (hKr hx) h + have hKsub : K₁ ⊆ K := hu ▸ subset_union_left + have hbK₁ : ∀ x ∈ K₁, x = b → x = z := by + rintro x hx rfl + have : x ∈ K₁ ∩ K₂ := ⟨hx, hK₂.right_mem⟩ + rw [hi] at this + exact this + have hK₁Z : K₁ ∩ Z ⊆ {a, z} := by + rintro x ⟨hx, hxZ⟩ + by_contra hn + have hxa : x ≠ a := fun h => hn (Or.inl h) + have hxz : x ≠ z := fun h => hn (Or.inr h) + have hxb : x ≠ b := fun h => hxz (hbK₁ x hx h) + exact hoff x ⟨hKsub hx, by rintro (h | h) <;> simp_all⟩ hxZ + obtain ⟨B, -, hB, hK₁B, hBZ, haB, hzB, hconn, -⟩ := + exists_plane_lens hK₁ (Ne.symm hza) hZ hK₁Z + have hK₁₀ : (K₁ \ {a, z}).Nonempty := hK₁.nonempty_sdiff + obtain ⟨y, hy⟩ := hK₁₀ + have hyb : y ≠ b := fun h => hy.2 (Or.inr (hbK₁ y hy.1 h)) + have hyr : y ∈ interior X \ X₀ := + hKr ⟨hKsub hy.1, by + rintro (h | h) + · exact hy.2 (Or.inl h) + · exact hyb h⟩ + have hreg : B \ {a, z} ⊆ interior X \ X₀ := by + refine subset_region_of_isPreconnected hX hX₀ hconn ?_ ⟨hK₁B hy.1, hy.2⟩ hyr + rw [disjoint_left] + rintro x ⟨hxB, hxn⟩ hxb + exact hxn (hBZ ⟨hxB, Or.inr hxb⟩) + obtain ⟨F, hF, haF, hFs, hFb⟩ := exists_oArc_in_disc hB (Surface.discBd_subset _ haB) + (isOpen_compl_singleton (x := z)) (show a ∈ ({z} : Set EuclideanPlane)ᶜ from Ne.symm hza) + have hmem : ∀ p ∈ F \ {a}, p ∈ B \ {a, z} := by + intro p hp + refine ⟨(hFs hp.1).1, ?_⟩ + rintro (h | h) + · exact hp.2 h + · exact (hFs hp.1).2 h + refine ⟨F, hF, haF, fun p hp => hreg (hmem p hp), ?_⟩ + rw [disjoint_left] + intro p hp hpU + exact (hmem p hp).2 (hBZ ⟨(hmem p hp).1, Or.inl hpU⟩) + +/-- A line parallel to an edge with two ends, off the drawing and in the region between the +boundaries. -/ +theorem exists_parallel_line (hX : IsClosed X) (hX₀ : IsClosed X₀) + (hU : D.U ⊆ X \ interior X₀) (hclean : D.U ∩ (subBd X ∪ subBd X₀) ⊆ D.V) + {e : Set EuclideanPlane} (he : e ∈ D.E) {a b : EuclideanPlane} (hab : a ≠ b) + (hcap : closure e ∩ D.V = {a, b}) : + ∃ K : Set EuclideanPlane, IsLineWithEnds K a b ∧ K \ {a, b} ⊆ interior X \ X₀ ∧ + Disjoint (K \ {a, b}) D.U := by + classical + have hline : IsLineWithEnds (closure e) a b := by + rcases D.edge_cond e he with ⟨u, v, -, hc, hL⟩ | ⟨u, hc, -⟩ + · have hpair : ({u, v} : Set EuclideanPlane) = {a, b} := hc.symm.trans hcap + have hau : a ∈ ({u, v} : Set EuclideanPlane) := hpair ▸ Or.inl rfl + have hbu : b ∈ ({u, v} : Set EuclideanPlane) := hpair ▸ Or.inr rfl + rcases hau with rfl | rfl + · rcases hbu with rfl | rfl + · exact (hab rfl).elim + · exact hL + · rcases hbu with rfl | rfl + · exact hL.symm + · exact (hab rfl).elim + · have ha : a ∈ ({u} : Set EuclideanPlane) := hc ▸ hcap ▸ Or.inl rfl + have hb : b ∈ ({u} : Set EuclideanPlane) := hc ▸ hcap ▸ Or.inr rfl + exact (hab (ha.trans hb.symm)).elim + have hLe : closure e \ {a, b} ⊆ e := by + rw [← hcap] + rintro x ⟨hx, hn⟩ + exact D.closure_diff_V he ▸ ⟨hx, fun hV => hn ⟨hx, hV⟩⟩ + have hrest : IsClosed (closure e \ (closure e \ {a, b})) := by + rw [sdiff_sdiff_right_self] + exact isClosed_closure.inter ((finite_singleton b).insert a).isClosed + obtain ⟨B, K, -, -, -, hreg, hK, hKB, hKU⟩ := + exists_lens_of_subline hX hX₀ hU hclean he hline hab hLe hrest + exact ⟨K, hK, fun x hx => hreg ⟨hKB hx.1, hx.2⟩, hKU⟩ + +/-- At any vertex that lies on an edge there is an `O`-arc off the drawing and in the region. -/ +theorem exists_oArc_of_edge (hX : IsClosed X) (hX₀ : IsClosed X₀) + (hU : D.U ⊆ X \ interior X₀) (hclean : D.U ∩ (subBd X ∪ subBd X₀) ⊆ D.V) + {e : Set EuclideanPlane} (he : e ∈ D.E) {a : EuclideanPlane} (ha : a ∈ closure e ∩ D.V) : + ∃ F : Set EuclideanPlane, IsOArc F ∧ a ∈ F ∧ F \ {a} ⊆ interior X \ X₀ ∧ + Disjoint (F \ {a}) D.U := by + classical + rcases D.edge_cond e he with ⟨u, v, huv, hc, hL⟩ | ⟨u, hc, ⟨φ⟩⟩ + · have haV : a ∈ ({u, v} : Set EuclideanPlane) := hc ▸ ha + rcases haV with rfl | rfl + · obtain ⟨K, hK, hr, hd⟩ := exists_parallel_line hX hX₀ hU hclean he huv hc + exact exists_oArc_of_line hX hX₀ hK hr hd + · have hc' : closure e ∩ D.V = {a, u} := by rw [hc, pair_comm] + obtain ⟨K, hK, hr, hd⟩ := exists_parallel_line hX hX₀ hU hclean he (Ne.symm huv) hc' + exact exists_oArc_of_line hX hX₀ hK hr hd + · have hau : a = u := by + have : a ∈ ({u} : Set EuclideanPlane) := hc ▸ ha + exact this + subst hau + obtain ⟨b, hb⟩ := he.1 + have hbV := (he.2.1 hb).2 + have hab : a ≠ b := fun h => hbV (h ▸ ha.2) + obtain ⟨I₁, I₂, -, -, hd, hun, -, -, hl₁, hl₂⟩ := exists_open_arcs φ ha.1 + (subset_closure hb) hab + have hI₁ : I₁ ⊆ closure e \ {a, b} := hun ▸ subset_union_left + have hI₂ : I₂ ⊆ closure e \ {a, b} := hun ▸ subset_union_right + have hL₀ : (I₁ ∪ {a, b}) \ {a, b} = I₁ := by + ext x + constructor + · rintro ⟨h | h, hn⟩ + · exact h + · exact (hn h).elim + · intro h + exact ⟨Or.inl h, (hI₁ h).2⟩ + have hrest : IsClosed (closure e \ I₁) := by + have : closure e \ I₁ = I₂ ∪ {a, b} := by + ext x + constructor + · rintro ⟨hx, hn⟩ + by_cases hxab : x ∈ ({a, b} : Set EuclideanPlane) + · exact Or.inr hxab + · have : x ∈ I₁ ∪ I₂ := hun ▸ ⟨hx, hxab⟩ + exact Or.inl (this.resolve_left hn) + · rintro (h | rfl | rfl) + · exact ⟨(hI₂ h).1, fun h' => disjoint_left.mp hd h' h⟩ + · exact ⟨ha.1, fun h' => (hI₁ h').2 (Or.inl rfl)⟩ + · exact ⟨subset_closure hb, fun h' => (hI₁ h').2 (Or.inr rfl)⟩ + rw [this] + exact hl₂.isCompact.isClosed + have hLe : (I₁ ∪ {a, b}) \ {a, b} ⊆ e := by + rw [hL₀] + intro x hx + refine D.closure_diff_V he ▸ ⟨(hI₁ hx).1, fun hV => (hI₁ hx).2 (Or.inl ?_)⟩ + exact (hc ▸ (⟨(hI₁ hx).1, hV⟩ : x ∈ closure e ∩ D.V) : x ∈ ({a} : Set EuclideanPlane)) + obtain ⟨B, K, -, -, -, hreg, hK, hKB, hKU⟩ := + exists_lens_of_subline hX hX₀ hU hclean he hl₁ hab hLe (by rwa [hL₀]) + exact exists_oArc_of_line hX hX₀ hK (fun x hx => hreg ⟨hKB hx.1, hx.2⟩) hKU + +/-- At a vertex with no edge, in `X` and off `X₀`, there is an `O`-arc off the drawing and in the +region. -/ +theorem exists_oArc_of_isolated (hX : IsClosedDisc X) (hX₀ : IsClosed X₀) {a : EuclideanPlane} + (haX : a ∈ X) (haX₀ : a ∉ X₀) (hno : ∀ e ∈ D.E, a ∉ closure e) : + ∃ F : Set EuclideanPlane, IsOArc F ∧ a ∈ F ∧ F \ {a} ⊆ interior X \ X₀ ∧ + Disjoint (F \ {a}) D.U := by + classical + let R : Set EuclideanPlane := (D.V \ {a}) ∪ (⋃ e ∈ D.E, closure e) ∪ X₀ + have hR : IsClosed R := (((D.finite_V.subset sdiff_subset).isClosed.union + (D.finite_edges.isClosed_biUnion fun _ _ => isClosed_closure))).union hX₀ + have haR : a ∉ R := by + rintro ((h | h) | h) + · exact h.2 rfl + · obtain ⟨e, he, hae⟩ := mem_iUnion₂.mp h + exact hno e he hae + · exact haX₀ h + obtain ⟨F, hF, haF, hs, hb⟩ := exists_oArc_in_disc hX haX hR.isOpen_compl haR + refine ⟨F, hF, haF, fun p hp => ⟨?_, fun h => (hs hp.1).2 (Or.inr h)⟩, ?_⟩ + · rw [interior_eq_discInt_plane hX] + exact hb hp + · rw [disjoint_left] + intro p hp hpU + refine (hs hp.1).2 ?_ + by_cases hpV : p ∈ D.V + · exact Or.inl (Or.inl ⟨hpV, hp.2⟩) + · obtain ⟨e, he, hpe⟩ := exists_edge_of_mem' hpU hpV + exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨e, he, subset_closure hpe⟩)) + +end Region + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/RuralClean.lean b/LeanPool/GraphMinor/GM09/RuralClean.lean new file mode 100644 index 0000000000..b8e42cbac8 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/RuralClean.lean @@ -0,0 +1,245 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Section10g + +/-! +# Clean presentations and small additions to a rural neighborhood + +The proof of (6.1) removes a few edges or a vertex and must add them back to a rural neighborhood. +For that we first put a presentation in a clean form, where the drawing meets `bd(Δ)` and +`bd(Δ₀)` only in the vertices of `ΩBar` and `ΩBar₀`. Then the new edge or vertex is drawn in free +space +with `GraphDrawing.glue`. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- A rural neighborhood has a presentation that meets the two boundaries only in their vertices. -/ +theorem Neighborhood.IsRural.exists_clean {N : Neighborhood α β} (h : N.IsRural) : + ∃ P : Presentation N, + P.Γ.drawing.U ∩ subBd P.Δ = (⋃ v ∈ N.Ω.bar, graphDrawingVertexSet P.Γ v) ∧ + P.Δ₀ ∩ subBd P.Δ ⊆ (⋃ v ∈ N.Ω.bar, graphDrawingVertexSet P.Γ v) ∧ + P.Γ.drawing.U ∩ subBd P.Δ₀ ⊆ (⋃ v ∈ N.Ω₀.bar, graphDrawingVertexSet P.Γ v) := by + obtain ⟨Γ, Δ, Δ₀, hΔ, hsub, hU, hbd, hbd₀, ⟨φ, hφ_cw, hag⟩, hinner⟩ := h + obtain ⟨-, -, Γ', Δ₀', -, -, -, -, -, -, hΔ₀', -, hU', -, -, -, hinterU, hinterΔ₀, hbd', hbd₀', + hag', hinner'⟩ := exists_clean_presentation_of_restrict_outer N.bar_subset Subset.rfl + (fun _ _ _ h => h) Γ Δ Δ₀ hΔ hsub hU hbd hbd₀ φ hag hinner + rcases hinner' with ⟨rfl, hemp⟩ | ⟨hd, φ₀, hφ₀_cw, hag₀⟩ + · refine ⟨⟨Γ', Δ, ∅, hΔ, hΔ₀', hU', hbd', hbd₀', ⟨φ, hφ_cw, hag'⟩, Or.inl ⟨rfl, hemp⟩⟩, + hinterU, hinterΔ₀, ?_⟩ + simp [subBd] + have hpt : ∀ v ∈ N.Ω₀.bar, ∃ q, graphDrawingVertexSet Γ' v = {q} := fun v hv => + ⟨_, graphDrawingVertexSet_eq_singleton Γ' (N.bar₀_subset hv)⟩ + let F : Set EuclideanPlane := ⋃ v ∈ N.Ω₀.bar, graphDrawingVertexSet Γ' v + have hFc : IsClosed F := N.Ω₀.finite_bar.isClosed_biUnion fun v hv => by + obtain ⟨q, hq⟩ := hpt v hv + rw [hq] + exact isClosed_singleton + have hbdeq : subBd Δ₀' = discBd Δ₀' := subBd_eq_discBd_plane hd + have hFb : F ⊆ discBd Δ₀' := by + rw [← hbdeq] + exact iUnion₂_subset fun v hv => (hbd₀' v (N.bar₀_subset hv)).mpr hv + obtain ⟨Ψ, Ψ', Ψ_hom, hc, hc', hl, hinj, hsub', hfix, hint, + hΨ_hom_cont, hΨ_hom_zero, hΨ_hom_one, hΨ_hom_inj⟩ := + exists_disc_shrink_map_with_homotopy hd hFc hFb + obtain ⟨hd', hbd'eq⟩ := hd.image hc hc' hl + let Δ₁ : Set EuclideanPlane := Ψ '' Δ₀' + have hbd₁ : subBd Δ₁ = Ψ '' discBd Δ₀' := by + rw [subBd_eq_discBd_plane hd', hbd'eq] + have hint₁_eq : interior Δ₁ = Ψ '' interior Δ₀' := by + rw [interior_eq_discInt_plane hd', interior_eq_discInt_plane hd] + change Δ₁ \ discBd Δ₁ = Ψ '' (Δ₀' \ discBd Δ₀') + rw [hbd'eq] + exact (InjOn.image_sdiff_subset hinj (Surface.discBd_subset Δ₀')).symm + have hintmono : interior Δ₁ ⊆ interior Δ₀' := interior_mono hsub' + have hUbd : Γ'.drawing.U ∩ subBd Δ₁ ⊆ F := by + rintro p ⟨hpU, hp⟩ + rw [hbd₁] at hp + obtain ⟨x, hx, rfl⟩ := hp + by_cases hxF : x ∈ F + · rw [hfix x hxF] + exact hxF + · have := hint x ⟨Surface.discBd_subset _ hx, hxF⟩ + refine absurd ?_ (hU' hpU).2 + rw [interior_eq_discInt_plane hd] + exact this + have hvfix : ∀ v ∈ N.Ω₀.bar, Ψ '' graphDrawingVertexSet Γ' v = graphDrawingVertexSet Γ' v := by + intro v hv + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + rw [hfix y (mem_iUnion₂.mpr ⟨v, hv, hy⟩)] + exact hy + · intro hx + exact ⟨x, hx, hfix x (mem_iUnion₂.mpr ⟨v, hv, hx⟩)⟩ + have hbd₀₁ : ∀ v ∈ V(N.G), (graphDrawingVertexSet Γ' v ⊆ subBd Δ₁ ↔ v ∈ N.Ω₀.bar) := by + intro v hv + constructor + · intro hs + rw [graphDrawingVertexSet_eq_singleton Γ' hv, singleton_subset_iff] at hs + have hq : (Γ'.iso.vertexEquiv ⟨v, hv⟩).1 ∈ graphDrawingVertexSet Γ' v := by + rw [graphDrawingVertexSet_eq_singleton Γ' hv] + rfl + have hqU : (Γ'.iso.vertexEquiv ⟨v, hv⟩).1 ∈ Γ'.drawing.U := + Γ'.drawing.V_subset_U (Γ'.iso.vertexEquiv ⟨v, hv⟩).2 + obtain ⟨u, hu, hxu⟩ := mem_iUnion₂.mp (hUbd ⟨hqU, hs⟩) + exact (graphDrawingVertexSet_inj Γ' hq hxu) ▸ hu + · intro hvb x hx + rw [hbd₁] + have : x ∈ Ψ '' graphDrawingVertexSet Γ' v := (hvfix v hvb).symm ▸ hx + obtain ⟨y, hy, rfl⟩ := this + refine ⟨y, ?_, rfl⟩ + rw [← hbdeq] + exact (hbd₀' v hv).mpr hvb hy + have hbdsub : subBd Δ₀' ⊆ Δ₀' := hbdeq ▸ Surface.discBd_subset _ + obtain ⟨φ₁, hφ₁_val, hag₁⟩ := drawingAgreesWithOArcHomeo_of_image (C' := subBd Δ₁) Γ' Γ' φ₀ + (hc.mono hbdsub) + (hc'.mono (image_mono hbdsub)) (hl.mono hbdsub) (by rw [hbd₁, hbdeq]) + (fun v hv => (hvfix v hv).symm) hag₀ + have hφ₁_cw : IsClockwiseDiscHomeo Δ₁ φ₁ := + isClockwiseDiscHomeo_of_homotopy hd Subset.rfl hint₁_eq rfl φ₀ φ₁ hφ₁_val + hΨ_hom_cont hΨ_hom_zero hΨ_hom_one hΨ_hom_inj hφ₀_cw + refine ⟨⟨Γ', Δ, Δ₁, hΔ, hsub'.trans hΔ₀', fun x hx => ⟨(hU' hx).1, + fun hi => (hU' hx).2 (hintmono hi)⟩, + hbd', hbd₀₁, ⟨φ, hφ_cw, hag'⟩, Or.inr ⟨hd', φ₁, hφ₁_cw, hag₁⟩⟩, hinterU, ?_, hUbd⟩ + exact (inter_subset_inter_left _ hsub').trans hinterΔ₀ + +/-- The point of a vertex in a drawing in the plane. -/ +noncomputable def vertexPt {G : Graph α β} (Γ : GraphDrawing G EuclideanPlane) (v : α) : + EuclideanPlane := by + classical + exact if h : v ∈ V(G) then (Γ.iso.vertexEquiv ⟨v, h⟩).1 else 0 + +theorem vertexSet_eq_vertexPt {G : Graph α β} (Γ : GraphDrawing G EuclideanPlane) {v : α} + (h : v ∈ V(G)) : graphDrawingVertexSet Γ v = {vertexPt Γ v} := by + rw [graphDrawingVertexSet_eq_singleton Γ h] + simp only [vertexPt, h, ↓reduceDIte] + +theorem vertexEquiv_eq_vertexPt {G : Graph α β} (Γ : GraphDrawing G EuclideanPlane) (v : V(G)) : + (Γ.iso.vertexEquiv v).1 = vertexPt Γ v.1 := by + simp only [vertexPt, v.2, ↓reduceDIte] + +theorem vertexPt_injOn {G : Graph α β} (Γ : GraphDrawing G EuclideanPlane) : + InjOn (vertexPt Γ) V(G) := by + intro u hu w hw e + refine graphDrawingVertexSet_inj Γ (x := vertexPt Γ u) ?_ ?_ + · rw [vertexSet_eq_vertexPt Γ hu] + rfl + · rw [vertexSet_eq_vertexPt Γ hw, e] + rfl + +theorem vertexPt_mem_U {G : Graph α β} (Γ : GraphDrawing G EuclideanPlane) {v : α} + (h : v ∈ V(G)) : vertexPt Γ v ∈ Γ.drawing.U := by + rw [← vertexEquiv_eq_vertexPt Γ ⟨v, h⟩] + exact Γ.drawing.V_subset_U (Γ.iso.vertexEquiv ⟨v, h⟩).2 + +/-- Angles that increase along an orbit list of `Ω` show that a drawing agrees with `Ω`. -/ +theorem drawingAgrees_of_angles {S : Type*} [TopologicalSpace S] {G : Graph α β} + {Γ : GraphDrawing G S} {Ω : CyclicPerm α} {L : List α} (hL : Ω.IsOrbitList L) {θ : α → ℝ} + (hθ : IsValidAngle L θ) {C : Set S} (φ : Circle ≃ₜ C) + (hC : ∀ v ∈ Ω.bar, graphDrawingVertexSet Γ v ⊆ C) + (h : ∀ v ∈ Ω.bar, (φ (Circle.exp (θ v))).1 ∈ graphDrawingVertexSet Γ v) : + DrawingAgreesWithOArcHomeo Γ Ω C φ := + ⟨hC, fun _ _ _ hcw => exists_angles_of_isClockwise3 hL hθ (T := graphDrawingVertexSet Γ) + (f := fun t => (φ (Circle.exp t)).1) (fun t => by simp only [circle_exp_add_two_pi]) h hcw⟩ + +/-- The set of vertices of an edgeless drawing of `ΩBar` on the boundary of the unit disc. -/ +theorem exists_edgeless_presentation (Ω : CyclicPerm α) {G : Graph α β} (hV : V(G) = Ω.bar) + (hE : E(G) = ∅) : + ∃ Γ : GraphDrawing G EuclideanPlane, ∃ φ : Circle ≃ₜ subBd ClosedUnitDisc, + IsClockwiseDiscHomeo ClosedUnitDisc φ ∧ + Γ.drawing.U ⊆ subBd ClosedUnitDisc ∧ DrawingAgreesWithOArcHomeo Γ Ω (subBd ClosedUnitDisc) φ + := by + have hfin : V(G).Finite := hV ▸ Ω.finite_bar + let φ := circleHomeomorphSubBdClosedUnitDisc + rcases Ω.bar.eq_empty_or_nonempty with he | ⟨w, hw⟩ + · have hinj : InjOn (fun _ : α => (0 : EuclideanPlane)) V(G) := by + rw [hV, he] + exact injOn_empty _ + obtain ⟨Γ, hU, -⟩ := GraphDrawing.of_edgeless hfin hE hinj + refine ⟨Γ, φ, isClockwiseDiscHomeo_closedUnitDisc, + by rw [hU, hV, he, image_empty]; exact empty_subset _, + fun v hv => (he ▸ hv : v ∈ (∅ : Set α)).elim, fun v₁ _ _ h => ?_⟩ + have hv : v₁ ∈ Ω.bar := (Ω.isClockwise3_iff.mp h).2.2.2.1 + exact (he ▸ hv : v₁ ∈ (∅ : Set α)).elim + obtain ⟨L, hL⟩ := Ω.exists_isOrbitList_of_mem hw + obtain ⟨θ, hθ⟩ := hL.exists_isValidAngle + let ν : α → EuclideanPlane := fun v => (φ (Circle.exp (θ v))).1 + have hinj : InjOn ν V(G) := by + rw [hV] + intro u hu v hv huv + exact injOn_circle_exp_of_isValidAngle hL hθ hu hv + (congrArg Circle.coeHom (φ.injective (Subtype.ext huv))) + obtain ⟨Γ, hU, hν⟩ := GraphDrawing.of_edgeless hfin hE hinj + have hset : ∀ v ∈ Ω.bar, graphDrawingVertexSet Γ v = {ν v} := fun v hv => by + rw [graphDrawingVertexSet_eq_singleton Γ (hV ▸ hv), hν ⟨v, hV ▸ hv⟩] + refine ⟨Γ, φ, isClockwiseDiscHomeo_closedUnitDisc, ?_, drawingAgrees_of_angles hL hθ φ ?_ ?_⟩ + · rw [hU] + rintro _ ⟨v, -, rfl⟩ + exact (φ _).2 + · intro v hv + rw [hset v hv, singleton_subset_iff] + exact (φ _).2 + · intro v hv + rw [hset v hv] + rfl + +namespace Society + +variable (S : Society α β) + +/-- If every transaction has at most `k` members then the sophistication is at most `k`, by the +composition of `(G, Ω)` with the rural neighborhood that has only the vertices of `ΩBar`. -/ +theorem hasSophisticationLE_of_forall_le {k : ℕ} + (h : ∀ P_set : Set (Graph α β), S.IsTransaction P_set → P_set.ncard ≤ k) : + S.HasSophisticationLE k := by + let H : Graph α β := (S.G.induce S.Ω.bar).restrict ∅ + have hV : V(H) = S.Ω.bar := by simp [H] + have hE : E(H) = ∅ := by simp [H] + have hle : H ≤ S.G := (Graph.restrict_le).trans (S.G.induce_le S.bar_subset) + let N : Neighborhood α β := + ⟨H, S.Ω, S.Ω, hV ▸ S.Ω.finite_bar, by rw [hE]; exact finite_empty, hV.ge, hV.ge⟩ + refine ⟨S, N, ⟨⟨⟨le_rfl, hle, ?_, ?_, ?_⟩, hV.ge⟩, rfl, rfl, ?_⟩, ?_, h⟩ + · rw [hV] + exact union_eq_left.mpr S.bar_subset + · rw [hE, union_empty] + · rw [hE] + exact disjoint_bot_right + · rw [hV] + exact (inter_eq_right.mpr S.bar_subset).symm + obtain ⟨Γ, φ, hφ_cw, hU, hag⟩ := exists_edgeless_presentation S.Ω hV hE + have hdisc : IsClosedDisc ClosedUnitDisc := ⟨Homeomorph.refl ClosedUnitDisc⟩ + have hiff : ∀ v ∈ V(N.G), (graphDrawingVertexSet Γ v ⊆ subBd ClosedUnitDisc ↔ v ∈ S.Ω.bar) := by + intro v hv + refine ⟨fun _ => hV ▸ hv, fun _ x hx => hU ?_⟩ + rw [graphDrawingVertexSet_eq_singleton Γ hv] at hx + rw [hx] + exact Γ.drawing.V_subset_U (Γ.iso.vertexEquiv ⟨v, hv⟩).2 + refine ⟨Γ, ClosedUnitDisc, ClosedUnitDisc, hdisc, Subset.rfl, ?_, hiff, hiff, ⟨φ, hφ_cw, hag⟩, + Or.inr ⟨hdisc, φ, hφ_cw, hag⟩⟩ + intro x hx + have hb := hU hx + refine ⟨hdisc.isCompact.isClosed.closure_subset hb.1, fun hi => ?_⟩ + have hc : closure (univ \ ClosedUnitDisc) = (interior ClosedUnitDisc)ᶜ := by + rw [← compl_eq_univ_sdiff, closure_compl] + exact (hc ▸ hb.2 : x ∈ (interior ClosedUnitDisc)ᶜ) hi + +end Society + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/RuralExtend.lean b/LeanPool/GraphMinor/GM09/RuralExtend.lean new file mode 100644 index 0000000000..b1f54eff6e --- /dev/null +++ b/LeanPool/GraphMinor/GM09/RuralExtend.lean @@ -0,0 +1,546 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.RuralAdd + +/-! +# Adding an edge or a vertex to a rural neighborhood + +The proof of (6.1) deletes an edge or a vertex from a counterexample, and uses that the smaller +society has small sophistication. To go back we must add the edge or the vertex to the rural +neighborhood of a composition. Here we do so in the four cases that arise: an edge parallel to an +edge of the neighborhood, a loop at a vertex off the inner disc, an edge joining two consecutive +vertices of `ΩBar`, and a new isolated vertex of `ΩBar`. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- The edge of a drawing that represents a link has the two vertices as the ends of its closure. -/ +theorem closure_inter_V_of_isLink {G : Graph α β} (Γ : GraphDrawing G EuclideanPlane) {f : β} + {u w : α} (hl : G.IsLink f u w) : + graphDrawingEdgeSet Γ f ∈ Γ.drawing.E ∧ + closure (graphDrawingEdgeSet Γ f) ∩ Γ.drawing.V = {vertexPt Γ u, vertexPt Γ w} := by + have he : f ∈ E(G) := hl.edge_mem + have hu : u ∈ V(G) := hl.left_mem + have hw : w ∈ V(G) := hl.right_mem + have hlink := (Γ.iso.isLink_iff ⟨f, he⟩ ⟨u, hu⟩ ⟨w, hw⟩).mp hl + rw [graphDrawingEdgeSet_eq Γ he] + refine ⟨(Γ.iso.edgeEquiv ⟨f, he⟩).2, ?_⟩ + rw [← vertexEquiv_eq_vertexPt Γ ⟨u, hu⟩, ← vertexEquiv_eq_vertexPt Γ ⟨w, hw⟩] + exact hlink.2.2.2 + +namespace Neighborhood + +/-- Adding one edge, drawn as `C`, to a neighborhood with a presentation. -/ +theorem isRural_add_edge {N N' : Neighborhood α β} (P : Presentation N) (hΩ : N'.Ω = N.Ω) + (hΩ₀ : N'.Ω₀ = N.Ω₀) (hle : N.G ≤ N'.G) (hV : V(N'.G) = V(N.G)) {e : β} {u w : α} + (hE : E(N'.G) = insert e E(N.G)) (he : e ∉ E(N.G)) (hl : N'.G.IsLink e u w) + {C : Set EuclideanPlane} + (hC : (u ≠ w ∧ IsLineWithEnds C (vertexPt P.Γ u) (vertexPt P.Γ w)) ∨ + (u = w ∧ IsOArc C ∧ vertexPt P.Γ u ∈ C)) + (hCs : C ⊆ P.Δ \ interior P.Δ₀) (hmeet : P.Γ.drawing.U ∩ C ⊆ {vertexPt P.Γ u, vertexPt P.Γ w}) : + N'.IsRural := by + classical + let Γ := P.Γ + let ν := vertexPt Γ + let H : Graph α β := (N'.G.induce {u, w}).restrict {e} + have huV : u ∈ V(N'.G) := hl.left_mem + have hwV : w ∈ V(N'.G) := hl.right_mem + have hVH : V(H) = {u, w} := by simp [H] + have hEH : E(H) = {e} := by + ext f + simp only [H, edgeSet_restrict, mem_inter_iff, mem_singleton_iff, edgeSet_induce, + mem_ofPred_eq] + refine ⟨fun h => h.2, fun h => ?_⟩ + subst h + exact ⟨⟨u, w, hl, Or.inl rfl, Or.inr rfl⟩, rfl⟩ + have hHle : H ≤ N'.G := Graph.restrict_le.trans (N'.G.induce_le (pair_subset huV hwV)) + have hlH : H.IsLink e u w := ⟨rfl, hl, Or.inl rfl, Or.inr rfl⟩ + have hH : ∃ ΓH : GraphDrawing H EuclideanPlane, ΓH.drawing.U = C ∧ + ∀ x : V(H), (ΓH.iso.vertexEquiv x).1 = ν x.1 := by + rcases hC with ⟨hne, hK⟩ | ⟨rfl, hF, hm⟩ + · have hνne : ν u ≠ ν w := fun h => hne (vertexPt_injOn Γ (hV ▸ huV) (hV ▸ hwV) h) + exact GraphDrawing.of_single_edge hVH hEH hlH hνne hK + · have hVH' : V(H) = {u} := by rw [hVH, pair_eq_singleton] + exact GraphDrawing.of_single_loop hVH' hEH hlH hF hm + obtain ⟨ΓH, hUH, hνH⟩ := hH + have hinj : InjOn ν V(N'.G) := hV ▸ vertexPt_injOn Γ + obtain ⟨Γ', hU', hν'⟩ := GraphDrawing.glue hle hHle + (by rw [hV, hVH, union_eq_left]; exact pair_subset (hV ▸ huV) (hV ▸ hwV)) + (by rw [hEH, hE, union_singleton]) + (by rw [hEH]; exact disjoint_singleton_right.mpr he) + hinj Γ ΓH (fun x => vertexEquiv_eq_vertexPt Γ x) hνH (by + rw [hUH, hVH] + rintro x hx + rcases hmeet hx with h | h + · exact ⟨u, ⟨hV ▸ huV, Or.inl rfl⟩, h.symm⟩ + · exact ⟨w, ⟨hV ▸ hwV, Or.inr rfl⟩, (mem_singleton_iff.mp h).symm⟩) + have hset : ∀ x, graphDrawingVertexSet Γ' x = graphDrawingVertexSet Γ x := by + intro x + by_cases hx : x ∈ V(N.G) + · rw [graphDrawingVertexSet_eq_singleton Γ' (hV ▸ hx), hν' ⟨x, hV ▸ hx⟩, + vertexSet_eq_vertexPt Γ hx] + · ext y + constructor + · rintro ⟨h, -⟩ + exact (hx (hV ▸ h)).elim + · rintro ⟨h, -⟩ + exact (hx h).elim + have hag := P.agrees_Δ + have hag₀ := P.agrees_Δ₀ + obtain ⟨φ, hφ_cw, hφ⟩ := hag + unfold IsRural + rw [hΩ, hΩ₀] + refine ⟨Γ', P.Δ, P.Δ₀, P.isClosedDisc_Δ, P.Δ₀_subset_Δ, ?_, ?_, ?_, + ⟨φ, hφ_cw, hφ.congr fun v _ => hset v⟩, ?_⟩ + · rw [hU', hUH] + exact union_subset P.U_subset hCs + · intro v hv + rw [hset v] + exact P.mem_bd_Δ_iff v (hV ▸ hv) + · intro v hv + rw [hset v] + exact P.mem_bd_Δ₀_iff v (hV ▸ hv) + · rcases hag₀ with h | ⟨hd, φ₀, hφ₀_cw, h⟩ + · exact Or.inl h + · exact Or.inr ⟨hd, φ₀, hφ₀_cw, h.congr fun v _ => hset v⟩ + +theorem isClosed_Δ₀ {N : Neighborhood α β} (P : Presentation N) : IsClosed P.Δ₀ := by + rcases P.agrees_Δ₀ with ⟨h, -⟩ | ⟨h, -⟩ + · rw [h] + exact isClosed_empty + · exact h.isCompact.isClosed + +theorem region_subset {X X₀ : Set EuclideanPlane} (_hX₀ : X₀ ⊆ X) : + interior X \ X₀ ⊆ X \ interior X₀ := fun _ hx => + ⟨interior_subset hx.1, fun h => hx.2 (interior_subset h)⟩ + +private theorem curve_subset {N : Neighborhood α β} (P : Presentation N) {C : Set EuclideanPlane} + {s : Set EuclideanPlane} (hs : s ⊆ P.Γ.drawing.U) (hC : C \ s ⊆ interior P.Δ \ P.Δ₀) : + C ⊆ P.Δ \ interior P.Δ₀ := by + intro x hx + by_cases h : x ∈ s + · exact P.U_subset (hs h) + · exact region_subset P.Δ₀_subset_Δ (hC ⟨hx, h⟩) + +private theorem curve_meet {U C s : Set EuclideanPlane} (h : Disjoint (C \ s) U) : U ∩ C ⊆ s := by + rintro x ⟨hxU, hxC⟩ + by_contra hn + exact disjoint_left.mp h ⟨hxC, hn⟩ hxU + +private theorem clean_inter {N : Neighborhood α β} (P : Presentation N) + (hc₁ : P.Γ.drawing.U ∩ subBd P.Δ = (⋃ v ∈ N.Ω.bar, graphDrawingVertexSet P.Γ v)) + (hc₃ : P.Γ.drawing.U ∩ subBd P.Δ₀ ⊆ (⋃ v ∈ N.Ω₀.bar, graphDrawingVertexSet P.Γ v)) : + P.Γ.drawing.U ∩ (subBd P.Δ ∪ subBd P.Δ₀) ⊆ P.Γ.drawing.V := by + have key : ∀ (Y : Set α), Y ⊆ V(N.G) → ∀ x ∈ ⋃ v ∈ Y, graphDrawingVertexSet P.Γ v, + x ∈ P.Γ.drawing.V := by + intro Y hY x hx + obtain ⟨v, hv, hxv⟩ := mem_iUnion₂.mp hx + rw [graphDrawingVertexSet_eq_singleton P.Γ (hY hv)] at hxv + rw [hxv] + exact (P.Γ.iso.vertexEquiv ⟨v, hY hv⟩).2 + rintro x ⟨hxU, h | h⟩ + · exact key _ N.bar_subset x (hc₁ ▸ ⟨hxU, h⟩) + · exact key _ N.bar₀_subset x (hc₃ ⟨hxU, h⟩) + +/-- A rural neighborhood stays rural when we add an edge parallel to one of its edges with two +different ends. -/ +theorem IsRural.add_parallel {N N' : Neighborhood α β} (hr : N.IsRural) (hΩ : N'.Ω = N.Ω) + (hΩ₀ : N'.Ω₀ = N.Ω₀) (hle : N.G ≤ N'.G) (hV : V(N'.G) = V(N.G)) {e f : β} {u w : α} + (hE : E(N'.G) = insert e E(N.G)) (he : e ∉ E(N.G)) (hl : N'.G.IsLink e u w) + (hf : N.G.IsLink f u w) (huw : u ≠ w) : N'.IsRural := by + obtain ⟨P, hc₁, -, hc₃⟩ := hr.exists_clean + obtain ⟨hfE, hcap⟩ := closure_inter_V_of_isLink P.Γ hf + have hne : vertexPt P.Γ u ≠ vertexPt P.Γ w := fun h => + huw (vertexPt_injOn P.Γ hf.left_mem hf.right_mem h) + obtain ⟨K, hK, hr', hd⟩ := exists_parallel_line P.isClosedDisc_Δ.isCompact.isClosed + (isClosed_Δ₀ P) + P.U_subset (clean_inter P hc₁ hc₃) hfE hne hcap + refine isRural_add_edge P hΩ hΩ₀ hle hV hE he hl (Or.inl ⟨huw, hK⟩) + (curve_subset P (pair_subset (vertexPt_mem_U P.Γ hf.left_mem) + (vertexPt_mem_U P.Γ hf.right_mem)) hr') (curve_meet hd) + +/-- A rural neighborhood stays rural when we add a loop at a vertex that is not in `ΩBar₀`. -/ +theorem IsRural.add_loop {N N' : Neighborhood α β} (hr : N.IsRural) (hΩ : N'.Ω = N.Ω) + (hΩ₀ : N'.Ω₀ = N.Ω₀) (hle : N.G ≤ N'.G) (hV : V(N'.G) = V(N.G)) {e : β} {v : α} + (hE : E(N'.G) = insert e E(N.G)) (he : e ∉ E(N.G)) (hl : N'.G.IsLink e v v) + (hvV : v ∈ V(N.G)) (hv₀ : v ∉ N.Ω₀.bar) : N'.IsRural := by + classical + obtain ⟨P, hc₁, -, hc₃⟩ := hr.exists_clean + have hXc := P.isClosedDisc_Δ.isCompact.isClosed + have hX₀c := isClosed_Δ₀ P + have hclean := clean_inter P hc₁ hc₃ + have hvU := vertexPt_mem_U P.Γ hvV + have hF : ∃ F : Set EuclideanPlane, IsOArc F ∧ vertexPt P.Γ v ∈ F ∧ + F \ {vertexPt P.Γ v} ⊆ interior P.Δ \ P.Δ₀ ∧ + Disjoint (F \ {vertexPt P.Γ v}) P.Γ.drawing.U := by + by_cases hex : ∃ f w, N.G.IsLink f v w + · obtain ⟨f, w, hf⟩ := hex + obtain ⟨hfE, hcap⟩ := closure_inter_V_of_isLink P.Γ hf + have ha : vertexPt P.Γ v ∈ closure (graphDrawingEdgeSet P.Γ f) ∩ P.Γ.drawing.V := + hcap ▸ Or.inl rfl + exact exists_oArc_of_edge hXc hX₀c P.U_subset hclean hfE ha + · have hno : ∀ e' ∈ P.Γ.drawing.E, vertexPt P.Γ v ∉ closure e' := by + intro e' he' hae + let g := P.Γ.iso.edgeEquiv.symm ⟨e', he'⟩ + have hge : graphDrawingEdgeSet P.Γ g.1 = e' := by + rw [graphDrawingEdgeSet_eq P.Γ g.2] + simp [g] + obtain ⟨x, y, hg⟩ := N.G.exists_isLink_of_mem_edgeSet g.2 + obtain ⟨-, hcap⟩ := closure_inter_V_of_isLink P.Γ hg + rw [hge] at hcap + have hmem : vertexPt P.Γ v ∈ ({vertexPt P.Γ x, vertexPt P.Γ y} : Set EuclideanPlane) := + hcap ▸ ⟨hae, by rw [← vertexEquiv_eq_vertexPt P.Γ ⟨v, hvV⟩]; exact + (P.Γ.iso.vertexEquiv _).2⟩ + rcases hmem with h | h + · obtain rfl := vertexPt_injOn P.Γ hvV hg.left_mem h + exact hex ⟨_, _, hg⟩ + · obtain rfl := vertexPt_injOn P.Γ hvV hg.right_mem h + exact hex ⟨_, _, hg.symm⟩ + have hoff : vertexPt P.Γ v ∉ P.Δ₀ := by + intro h + have hb : vertexPt P.Γ v ∈ subBd P.Δ₀ := by + rw [subBd_eq_of_isClosed hX₀c] + exact ⟨h, (P.U_subset hvU).2⟩ + apply hv₀ + refine (P.mem_bd_Δ₀_iff v hvV).mp ?_ + rw [vertexSet_eq_vertexPt P.Γ hvV] + exact singleton_subset_iff.mpr hb + exact exists_oArc_of_isolated P.isClosedDisc_Δ hX₀c (P.U_subset hvU).1 hoff hno + obtain ⟨F, hF, ha, hr', hd⟩ := hF + refine isRural_add_edge P hΩ hΩ₀ hle hV hE he hl (Or.inr ⟨rfl, hF, ha⟩) + (curve_subset P (singleton_subset_iff.mpr hvU) hr') ?_ + rw [pair_eq_singleton] + exact curve_meet hd + +/-- A rural neighborhood stays rural when we add an edge joining two vertices that are consecutive +in `Ω`. The new edge runs along `bd(Δ)`. -/ +theorem IsRural.add_boundary_edge {N N' : Neighborhood α β} (hr : N.IsRural) (hΩ : N'.Ω = N.Ω) + (hΩ₀ : N'.Ω₀ = N.Ω₀) (hle : N.G ≤ N'.G) (hV : V(N'.G) = V(N.G)) {e : β} {u w : α} + (hE : E(N'.G) = insert e E(N.G)) (he : e ∉ E(N.G)) (hl : N'.G.IsLink e u w) + (hu : u ∈ N.Ω.bar) (hw : w ∈ N.Ω.bar) (huw : u ≠ w) (hgap : N.Ω.interval u w = ∅) : + N'.IsRural := by + classical + obtain ⟨P, hc₁, -, -⟩ := hr.exists_clean + obtain ⟨φ, _, hφ⟩ := P.agrees_Δ + have huG := N.bar_subset hu + have hwG := N.bar_subset hw + have hne : vertexPt P.Γ u ≠ vertexPt P.Γ w := fun h => huw (vertexPt_injOn P.Γ huG hwG h) + have hmem : ∀ x ∈ N.Ω.bar, vertexPt P.Γ x ∈ subBd P.Δ := fun x hx => + hφ.1 x hx (by rw [vertexSet_eq_vertexPt P.Γ (N.bar_subset hx)]; rfl) + obtain ⟨I₁, I₂, -, -, hd, hun, -, hsnd, hl₁, -⟩ := exists_open_arcs φ (hmem u hu) (hmem w hw) hne + have hI₁ : I₁ ⊆ subBd P.Δ \ {vertexPt P.Γ u, vertexPt P.Γ w} := hun ▸ subset_union_left + refine isRural_add_edge P hΩ hΩ₀ hle hV hE he hl (Or.inl ⟨huw, hl₁⟩) ?_ ?_ + · have hb : subBd P.Δ ⊆ P.Δ \ interior P.Δ₀ := by + rw [subBd_eq_of_isClosed P.isClosedDisc_Δ.isCompact.isClosed] + exact fun x hx => ⟨hx.1, fun h => hx.2 (interior_mono P.Δ₀_subset_Δ h)⟩ + rintro x (h | rfl | rfl) + · exact hb (hI₁ h).1 + · exact hb (hmem u hu) + · exact hb (hmem w hw) + · rintro x ⟨hxU, h | h⟩ + · exfalso + obtain ⟨z, hz, hxz⟩ := mem_iUnion₂.mp (hc₁ ▸ ⟨hxU, (hI₁ h).1⟩ : + x ∈ ⋃ v ∈ N.Ω.bar, graphDrawingVertexSet P.Γ v) + rw [vertexSet_eq_vertexPt P.Γ (N.bar_subset hz)] at hxz + obtain rfl : x = vertexPt P.Γ z := hxz + have hzu : z ≠ u := fun h' => (hI₁ h).2 (Or.inl (by rw [h'])) + have hzw : z ≠ w := fun h' => (hI₁ h).2 (Or.inr (by rw [h']; rfl)) + have hcw : z ∈ N.Ω.interval w u := by + rcases N.Ω.mem_interval_or_interval_swap hu hw hz huw hzu hzw with h' | h' + · rw [hgap] at h' + exact h'.elim + · exact h' + obtain ⟨t₁, t₂, t₃, h₁₂, h₂₃, h₃₁, m₁, m₂, m₃⟩ := hφ.2 _ _ _ hcw.2 + rw [vertexSet_eq_vertexPt P.Γ hwG] at m₁ + rw [vertexSet_eq_vertexPt P.Γ (N.bar_subset hz)] at m₂ + rw [vertexSet_eq_vertexPt P.Γ huG] at m₃ + have := hsnd t₁ t₂ t₃ h₁₂ h₂₃ h₃₁ m₁ m₃ + rw [show (φ (Circle.exp t₂)).1 = vertexPt P.Γ z from m₂] at this + exact disjoint_left.mp hd h this + · exact h + +/-- Given a cyclic permutation of a finite set with `v` in it, and points in an `O`-arc for the +other elements in the order of `Ω`, there are valid angles for all of `ΩBar` that give those points, +and the angle of `v` gives a point different from them. -/ +theorem exists_angles_with_gap {S : Type*} [TopologicalSpace S] {C : Set S} (φ : Circle ≃ₜ C) + {Ω : CyclicPerm α} {v : α} (hv : v ∈ Ω.bar) {ν : α → S} (hinj : InjOn ν (Ω.bar \ {v})) + (hmem : ∀ w ∈ Ω.bar \ {v}, ν w ∈ C) + (hag : ∀ v₁ v₂ v₃ : α, Ω.IsClockwise3 v₁ v₂ v₃ → v₁ ≠ v → v₂ ≠ v → v₃ ≠ v → + ∃ t₁ t₂ t₃ : ℝ, t₁ < t₂ ∧ t₂ < t₃ ∧ t₃ < t₁ + 2 * Real.pi ∧ + (φ (Circle.exp t₁)).1 = ν v₁ ∧ (φ (Circle.exp t₂)).1 = ν v₂ ∧ + (φ (Circle.exp t₃)).1 = ν v₃) : + ∃ (L : List α) (θ : α → ℝ), Ω.IsOrbitList L ∧ IsValidAngle L θ ∧ + (∀ w ∈ Ω.bar \ {v}, (φ (Circle.exp (θ w))).1 = ν w) ∧ + ∀ w ∈ Ω.bar \ {v}, (φ (Circle.exp (θ v))).1 ≠ ν w := by + classical + have hpi := Real.pi_pos + obtain ⟨L, hL, hL0⟩ := Ω.exists_isOrbitList_starting_at hv + have hbar : ∀ i (hi : i < L.length), L[i]'hi ∈ Ω.bar := fun i hi => by + rw [← hL.2.2.1] + exact List.getElem_mem hi + have hpos : 0 < L.length := List.length_pos_of_ne_nil hL.2.1 + have hne0 : ∀ i (hi : i < L.length), 0 < i → L[i]'hi ≠ v := by + intro i hi h0 h + have h₂ : L[i]'hi = L[0]'hpos := h.trans (hL0 hpos).symm + have := (List.Nodup.getElem_inj_iff hL.1).mp h₂ + omega + have hmemL : ∀ w ∈ Ω.bar \ {v}, ∃ i, ∃ hi : i < L.length, 0 < i ∧ L[i]'hi = w := by + rintro w ⟨hw, hne⟩ + rw [← hL.2.2.1] at hw + obtain ⟨i, hi, rfl⟩ := List.mem_iff_getElem.mp hw + refine ⟨i, hi, Nat.pos_of_ne_zero fun h => hne ?_, rfl⟩ + subst h + exact hL0 hi + by_cases hone : L.length = 1 + · refine ⟨L, 0, hL, ⟨fun i j hi hj hij => by omega, fun i hi => by simpa using hpi⟩, ?_, ?_⟩ + · intro w hw + obtain ⟨i, hi, h0, -⟩ := hmemL w hw + omega + · intro w hw + obtain ⟨i, hi, h0, -⟩ := hmemL w hw + omega + have h1 : 1 < L.length := by omega + let w₀ := L[1]'h1 + have hw₀ : w₀ ∈ Ω.bar \ {v} := ⟨hbar 1 h1, hne0 1 h1 one_pos⟩ + let pt' : α → Circle := fun w => if h : ν w ∈ C then φ.symm ⟨ν w, h⟩ else 1 + have hpt' : ∀ w ∈ Ω.bar \ {v}, (φ (pt' w)).1 = ν w := by + intro w hw + simp only [pt', hmem w hw, ↓reduceDIte, Homeomorph.apply_symm_apply] + obtain ⟨t₀, -, ht₀⟩ := exists_mem_Ico_circleExp 0 (pt' w₀) + choose s hsI hse using fun w => exists_mem_Ico_circleExp t₀ (pt' w) + have hsv : ∀ w ∈ Ω.bar \ {v}, (φ (Circle.exp (s w))).1 = ν w := fun w hw => by + rw [hse w, hpt' w hw] + have huniq : ∀ w ∈ Ω.bar \ {v}, ∀ t ∈ Ico t₀ (t₀ + 2 * Real.pi), + (φ (Circle.exp t)).1 = ν w → t = s w := by + intro w hw t ht h + refine eq_of_circleExp_eq ht (hsI w) ?_ + apply φ.injective + exact Subtype.ext (h.trans (hsv w hw).symm) + have hs₀ : s w₀ = t₀ := (huniq w₀ hw₀ t₀ ⟨le_rfl, by linarith⟩ (by rw [ht₀, hpt' w₀ hw₀])).symm + have hidx : ∀ i (hi : i < L.length), 0 < i → L[i]'hi ∈ Ω.bar \ {v} := fun i hi h => + ⟨hbar i hi, hne0 i hi h⟩ + have hmono : ∀ i j (hi : i < L.length) (hj : j < L.length), 0 < i → i < j → + s (L[i]'hi) < s (L[j]'hj) := by + intro i j hi hj h0 hij + rcases Nat.lt_or_ge 1 i with h1i | hi1 + · have hin := Ω.isOrbitList_mem_interval_of_lt hL h1i hij hj + obtain ⟨t₁, t₂, t₃, h₁₂, h₂₃, h₃₁, m₁, m₂, m₃⟩ := + hag _ _ _ hin.2 (hne0 1 h1 one_pos) (hne0 i hi h0) (hne0 j hj (by omega)) + have hexp : Circle.exp t₁ = Circle.exp t₀ := by + apply φ.injective + apply Subtype.ext + rw [m₁, ht₀, hpt' _ hw₀] + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp hexp + have hshift : ∀ t : ℝ, Circle.exp (t - m * (2 * Real.pi)) = Circle.exp t := fun t => + Circle.exp_eq_exp.mpr ⟨-m, by push_cast; ring⟩ + have e₂ : s (L[i]'hi) = t₂ - m * (2 * Real.pi) := + (huniq _ (hidx i hi h0) _ ⟨by linarith, by linarith⟩ (by rw [hshift, m₂])).symm + have e₃ : s (L[j]'hj) = t₃ - m * (2 * Real.pi) := + (huniq _ (hidx j hj (by omega)) _ ⟨by linarith, by linarith⟩ (by rw [hshift, m₃])).symm + rw [e₂, e₃] + linarith + · obtain rfl : i = 1 := by omega + have hge := (hsI (L[j]'hj)).1 + change s w₀ < _ + rw [hs₀] + refine lt_of_le_of_ne hge fun h => ?_ + have hν : ν w₀ = ν (L[j]'hj) := by + rw [← hsv _ hw₀, ← hsv _ (hidx j hj (by omega)), hs₀, ← h] + have := (List.Nodup.getElem_inj_iff hL.1).mp (hinj hw₀ (hidx j hj (by omega)) hν) + omega + let last := L[L.length - 1]'(by omega) + have hle : ∀ i (hi : i < L.length), 0 < i → s (L[i]'hi) ≤ s last := by + intro i hi h0 + rcases Nat.lt_or_ge i (L.length - 1) with h | h + · exact (hmono i _ hi (by omega) h0 h).le + · obtain rfl : i = L.length - 1 := by omega + exact le_rfl + have hlast := (hsI last).2 + let θv : ℝ := (s last - 2 * Real.pi + t₀) / 2 + have hθ1 : θv < t₀ := by simp only [θv]; linarith + have hθ2 : s last < θv + 2 * Real.pi := by simp only [θv]; linarith + have hθ3 : t₀ ≤ θv + 2 * Real.pi := by + have := (hsI last).1 + simp only [θv] + linarith + have hθ4 : θv + 2 * Real.pi < t₀ + 2 * Real.pi := by linarith + let θ : α → ℝ := fun w => if w = v then θv else s w + have hθs : ∀ i (hi : i < L.length), 0 < i → θ (L[i]'hi) = s (L[i]'hi) := fun i hi h => by + simp only [θ, hne0 i hi h, ↓reduceIte] + have hθv : θ v = θv := by simp [θ] + have hθL0 : θ (L[0]'hpos) = θv := by rw [hL0 hpos, hθv] + refine ⟨L, θ, hL, ⟨fun i j hi hj hij => ?_, fun i hi => ?_⟩, ?_, ?_⟩ + · rcases Nat.eq_zero_or_pos i with rfl | h0 + · rw [hθL0, hθs j hj (by omega)] + exact lt_of_lt_of_le hθ1 (hsI _).1 + · rw [hθs i hi h0, hθs j hj (by omega)] + exact hmono i j hi hj h0 hij + · rcases Nat.eq_zero_or_pos i with rfl | h0 + · linarith + · rw [hθs i hi h0, hθL0] + exact lt_of_le_of_lt (hle i hi h0) hθ2 + · intro w hw + have hwv : w ≠ v := hw.2 + simp only [θ, hwv, ↓reduceIte] + exact hsv w hw + · intro w hw he + rw [hθv] at he + have hexp : Circle.exp (θv + 2 * Real.pi) = Circle.exp θv := by + simp only [circle_exp_add_two_pi] + obtain ⟨i, hi, h0, rfl⟩ := hmemL w hw + have e := huniq _ hw (θv + 2 * Real.pi) ⟨hθ3, hθ4⟩ (by rw [hexp]; exact he) + have := hle i hi h0 + linarith + +/-- A rural neighborhood stays rural when we add a new isolated vertex to `ΩBar`. It goes on +`bd(Δ)` in the gap between its two neighbours in `Ω`. -/ +theorem IsRural.add_boundary_vertex {N N' : Neighborhood α β} (hr : N.IsRural) + (hΩ₀ : N'.Ω₀ = N.Ω₀) (hle : N.G ≤ N'.G) {v : α} (hvN : v ∉ V(N.G)) + (hV : V(N'.G) = insert v V(N.G)) (hE : E(N'.G) = E(N.G)) (hvb : v ∈ N'.Ω.bar) + (hbar : N.Ω.bar = N'.Ω.bar \ {v}) + (hcw : ∀ v₁ v₂ v₃ : α, N'.Ω.IsClockwise3 v₁ v₂ v₃ → v₁ ≠ v → v₂ ≠ v → v₃ ≠ v → + N.Ω.IsClockwise3 v₁ v₂ v₃) : N'.IsRural := by + classical + obtain ⟨P, hc₁, hc₂, -⟩ := hr.exists_clean + obtain ⟨φ, hφ_cw, hφ⟩ := P.agrees_Δ + have hXc := P.isClosedDisc_Δ.isCompact.isClosed + let Γ := P.Γ + let ν₀ := vertexPt Γ + have hsub : N'.Ω.bar \ {v} ⊆ V(N.G) := hbar ▸ N.bar_subset + have hset₀ : ∀ {w}, w ∈ N'.Ω.bar \ {v} → graphDrawingVertexSet Γ w = {ν₀ w} := fun h => + vertexSet_eq_vertexPt Γ (hsub h) + obtain ⟨L, θ, hL, hθ, hνθ, hgap⟩ := exists_angles_with_gap φ hvb (ν := ν₀) + ((vertexPt_injOn Γ).mono hsub) + (fun w hw => hφ.1 w (hbar ▸ hw) (by rw [hset₀ hw]; rfl)) + (fun v₁ v₂ v₃ h h₁ h₂ h₃ => by + have hm := CyclicPerm.isClockwise3_iff.mp h + have hm₁ : v₁ ∈ N'.Ω.bar \ {v} := ⟨hm.2.2.2.1, h₁⟩ + have hm₂ : v₂ ∈ N'.Ω.bar \ {v} := ⟨hm.2.2.2.2.1, h₂⟩ + have hm₃ : v₃ ∈ N'.Ω.bar \ {v} := ⟨hm.2.2.2.2.2.1, h₃⟩ + obtain ⟨t₁, t₂, t₃, a, b, c, m₁, m₂, m₃⟩ := hφ.2 _ _ _ (hcw _ _ _ h h₁ h₂ h₃) + rw [hset₀ hm₁] at m₁ + rw [hset₀ hm₂] at m₂ + rw [hset₀ hm₃] at m₃ + exact ⟨t₁, t₂, t₃, a, b, c, m₁, m₂, m₃⟩) + let x : EuclideanPlane := (φ (Circle.exp (θ v))).1 + have hxb : x ∈ subBd P.Δ := (φ _).2 + have hnot : ∀ y ∈ ⋃ w ∈ N.Ω.bar, graphDrawingVertexSet P.Γ w, y ≠ x := by + rintro y hy rfl + obtain ⟨w, hw, hyw⟩ := mem_iUnion₂.mp hy + rw [hbar] at hw + rw [show P.Γ = Γ from rfl, hset₀ hw] at hyw + exact hgap w hw hyw + have hxU : x ∉ Γ.drawing.U := fun h => hnot x (hc₁ ▸ ⟨h, hxb⟩) rfl + have hxΔ₀ : x ∉ P.Δ₀ := fun h => hnot x (hc₂ ⟨h, hxb⟩) rfl + let ν : α → EuclideanPlane := update ν₀ v x + have hνv : ν v = x := update_self _ _ _ + have hνo : ∀ w, w ≠ v → ν w = ν₀ w := fun w h => update_of_ne h _ _ + let H : Graph α β := (N'.G.induce {v}).restrict ∅ + have hvV : v ∈ V(N'.G) := hV ▸ mem_insert _ _ + have hVH : V(H) = {v} := by simp [H] + have hEH : E(H) = ∅ := by simp [H] + have hHle : H ≤ N'.G := Graph.restrict_le.trans (N'.G.induce_le (singleton_subset_iff.mpr hvV)) + obtain ⟨ΓH, hUH, hνH⟩ := GraphDrawing.of_edgeless (ν := ν) (by rw [hVH]; exact finite_singleton v) + hEH (by rw [hVH]; exact injOn_singleton _ _) + have hUH' : ΓH.drawing.U = {x} := by rw [hUH, hVH, image_singleton, hνv] + have hne : ∀ w ∈ V(N.G), w ≠ v := fun w hw h => hvN (h ▸ hw) + have hinj : InjOn ν V(N'.G) := by + rw [hV] + rintro a (rfl | ha) b (rfl | hb) hab + · rfl + · rw [hνv, hνo b (hne b hb)] at hab + exact (hxU (hab ▸ vertexPt_mem_U Γ hb)).elim + · rw [hνv, hνo a (hne a ha)] at hab + exact (hxU (hab ▸ vertexPt_mem_U Γ ha)).elim + · rw [hνo a (hne a ha), hνo b (hne b hb)] at hab + exact vertexPt_injOn Γ ha hb hab + obtain ⟨Γ', hU', hν'⟩ := GraphDrawing.glue (ν := ν) hle hHle + (by rw [hV, hVH, union_comm, ← insert_eq]) + (by rw [hEH, hE, union_empty]) (by rw [hEH]; exact disjoint_bot_right) + hinj Γ ΓH + (fun w => by rw [hνo w.1 (hne w.1 w.2)]; exact vertexEquiv_eq_vertexPt Γ w) hνH (by + rw [hUH'] + rintro _ ⟨hu, rfl⟩ + exact (hxU hu).elim) + have hsetO : ∀ w, w ≠ v → graphDrawingVertexSet Γ' w = graphDrawingVertexSet Γ w := by + intro w hw + by_cases hx : w ∈ V(N.G) + · have hx' : w ∈ V(N'.G) := hV ▸ mem_insert_of_mem _ hx + rw [graphDrawingVertexSet_eq_singleton Γ' hx', hν' ⟨w, hx'⟩, vertexSet_eq_vertexPt Γ hx] + exact congrArg _ (hνo w hw) + · ext y + constructor + · rintro ⟨h, -⟩ + rcases (hV ▸ h : w ∈ insert v V(N.G)) with h' | h' + · exact (hw h').elim + · exact (hx h').elim + · rintro ⟨h, -⟩ + exact (hx h).elim + have hsetV : graphDrawingVertexSet Γ' v = {x} := by + rw [graphDrawingVertexSet_eq_singleton Γ' hvV, hν' ⟨v, hvV⟩] + exact congrArg _ hνv + have hX₀ : ∀ y, y ∈ subBd P.Δ₀ → y ∈ P.Δ₀ := fun y hy => by + rw [subBd_eq_of_isClosed (isClosed_Δ₀ P)] at hy + exact hy.1 + have hag₀ := P.agrees_Δ₀ + unfold IsRural + rw [hΩ₀] + have hv₀ : v ∉ N.Ω₀.bar := fun h => hvN (N.bar₀_subset h) + refine ⟨Γ', P.Δ, P.Δ₀, P.isClosedDisc_Δ, P.Δ₀_subset_Δ, ?_, ?_, ?_, + ⟨φ, hφ_cw, drawingAgrees_of_angles hL hθ φ ?_ ?_⟩, ?_⟩ + · rw [hU', hUH'] + refine union_subset P.U_subset (singleton_subset_iff.mpr ?_) + rw [subBd_eq_of_isClosed hXc] at hxb + exact ⟨hxb.1, fun h => hxΔ₀ (interior_subset h)⟩ + · intro w hw + rcases eq_or_ne w v with rfl | hne' + · rw [hsetV] + exact ⟨fun _ => hvb, fun _ => singleton_subset_iff.mpr hxb⟩ + · have hwN : w ∈ V(N.G) := (hV ▸ hw : w ∈ insert v V(N.G)).resolve_left hne' + rw [hsetO w hne', P.mem_bd_Δ_iff w hwN, hbar] + exact ⟨fun h => h.1, fun h => ⟨h, hne'⟩⟩ + · intro w hw + rcases eq_or_ne w v with rfl | hne' + · rw [hsetV, singleton_subset_iff] + exact ⟨fun h => (hxΔ₀ (hX₀ _ h)).elim, fun h => (hv₀ h).elim⟩ + · have hwN : w ∈ V(N.G) := (hV ▸ hw : w ∈ insert v V(N.G)).resolve_left hne' + rw [hsetO w hne'] + exact P.mem_bd_Δ₀_iff w hwN + · intro w hw + rcases eq_or_ne w v with rfl | hne' + · rw [hsetV] + exact singleton_subset_iff.mpr hxb + · rw [hsetO w hne'] + exact hφ.1 w (hbar ▸ ⟨hw, hne'⟩) + · intro w hw + rcases eq_or_ne w v with rfl | hne' + · rw [hsetV] + rfl + · have hw' : w ∈ N'.Ω.bar \ {v} := ⟨hw, hne'⟩ + rw [hsetO w hne', hset₀ hw'] + exact hνθ w hw' + · have hcong : ∀ w ∈ N.Ω₀.bar, graphDrawingVertexSet Γ' w = graphDrawingVertexSet Γ w := + fun w hw => hsetO w (fun h => hv₀ (h ▸ hw)) + rcases hag₀ with h | ⟨hd, φ₀, hφ₀_cw, h⟩ + · exact Or.inl h + · exact Or.inr ⟨hd, φ₀, hφ₀_cw, h.congr hcong⟩ + +end Neighborhood + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section10.lean b/LeanPool/GraphMinor/GM09/Section10.lean new file mode 100644 index 0000000000..d5baa281c3 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section10.lean @@ -0,0 +1,435 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2a +import LeanPool.GraphMinor.GM09.Section2d +import LeanPool.GraphMinor.GM09.Section2e +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section3c +import LeanPool.GraphMinor.GM09.Section4a +import LeanPool.GraphMinor.GM09.Section4c +import LeanPool.GraphMinor.GM09.Section5a +import LeanPool.GraphMinor.GM09.Section5b +import LeanPool.GraphMinor.GM09.Section6 +import LeanPool.GraphMinor.GM09.Section7 +import LeanPool.GraphMinor.GM09.Section8 +import LeanPool.GraphMinor.GM09.Section9 +import LeanPool.GraphMinor.GM09.Section11b +import LeanPool.GraphMinor.GM09.NestUncrossing +import LeanPool.GraphMinor.GM06.Section2Dual +import LeanPool.GraphMinor.GM06.Section3Dual +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.Surface.Crossing +import Mathlib.Data.Set.Card + +/-! +# Graph Minors IX, Section 10: Rural Neighborhoods of Large Breadth ((10.2)–(10.5)) + +This file formalizes (10.2), (10.3), (10.4), and (10.5) from Section 10 of +N. Robertson and P. D. Seymour, *Graph Minors. IX. Disjoint crossed paths*, +J. Combin. Theory Ser. B **49** (1990) 40–77 (pages 64–67). +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 + +universe u v w + +variable {α : Type u} {β : Type v} + +/-- In a nest `C : Fin m → Graph α β` of `N`, any circuit `C j` with `j < k` is vertex-disjoint +from `N.Ω.bar`. -/ +theorem disjoint_vertexSet_bar_of_isNest_lt {N : Neighborhood α β} {P_pres : Presentation N} + {m : ℕ} {C : Fin m → Graph α β} (hC : N.IsNest P_pres C) {j k : Fin m} (hjk : j < k) : + Disjoint V(C j) N.Ω.bar := by + obtain ⟨hC_cir, hC_disj, D, hD_disc, hD_sub, hD_mono⟩ := hC + rw [disjoint_left] + intro v hvCj hv_bar + have hvN : v ∈ V(N.G) := N.bar_subset hv_bar + have hv_bdΔ : graphDrawingVertexSet P_pres.Γ v ⊆ subBd P_pres.Δ := + (P_pres.mem_bd_Δ_iff v hvN).mpr hv_bar + have hv_Dj : graphDrawingVertexSet P_pres.Γ v ⊆ D j := by + refine (graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hvCj).trans ?_ + rw [← (hD_disc j).2] + exact subBd_subset_of_isClosed (isClosed_of_isClosedDisc (hD_disc j).1) + have hv_Dk : graphDrawingVertexSet P_pres.Γ v ⊆ D k := + hv_Dj.trans (hD_mono j k (le_of_lt hjk)) + have hv_bdDk : graphDrawingVertexSet P_pres.Γ v ⊆ graphDrawingSubgraphU P_pres.Γ (C k) := by + rw [← (hD_disc k).2] + exact (subset_inter hv_Dk hv_bdΔ).trans (inter_subBd_subset_subBd (hD_sub k).2) + have hvCk : v ∈ V(C k) := + mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU P_pres.Γ (hC_cir k).1 hvN hv_bdDk + exact disjoint_left.mp (hC_disj (ne_of_lt hjk)) hvCj hvCk + +/-- Every walk in `N.G` from `x ∈ N.Ω.bar` to `y ∈ N.Ω₀.bar` meets every circuit `C j` of a nest `C` +in `N`. -/ +theorem exists_mem_support_circuit_of_isNest {N : Neighborhood α β} {P_pres : Presentation N} + {m : ℕ} {C : Fin m → Graph α β} (hC : N.IsNest P_pres C) (j : Fin m) + {x y : α} (W : GraphWalk N.G x y) (hx : x ∈ N.Ω.bar) (hy : y ∈ N.Ω₀.bar) : + ∃ v ∈ W.support, v ∈ V(C j) := by + by_cases hxC : x ∈ V(C j) + · exact ⟨x, W.start_mem_support, hxC⟩ + · obtain ⟨hC_cir, _, D, hD_disc, hD_sub, _⟩ := hC + have hxN : x ∈ V(N.G) := N.bar_subset hx + have hyN : y ∈ V(N.G) := N.bar₀_subset hy + have hxc : graphDrawingVertexSet P_pres.Γ x ⊆ (D j)ᶜ := by + intro p hp hpD + have hp_sub : graphDrawingVertexSet P_pres.Γ x ⊆ {p} := by + rw [graphDrawingVertexSet_eq_singleton P_pres.Γ hxN] at hp ⊢ + rw [mem_singleton_iff.mp hp] + have hp_bdΔ : p ∈ subBd P_pres.Δ := (P_pres.mem_bd_Δ_iff x hxN).mpr hx hp + have hp_bdDj : p ∈ graphDrawingSubgraphU P_pres.Γ (C j) := by + rw [← (hD_disc j).2] + exact inter_subBd_subset_subBd (hD_sub j).2 ⟨hpD, hp_bdΔ⟩ + have hv_sub : graphDrawingVertexSet P_pres.Γ x ⊆ graphDrawingSubgraphU P_pres.Γ (C j) := + hp_sub.trans (singleton_subset_iff.mpr hp_bdDj) + exact hxC (mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU P_pres.Γ + (hC_cir j).1 hxN hv_sub) + have hyD : graphDrawingVertexSet P_pres.Γ y ⊆ D j := by + refine ((P_pres.mem_bd_Δ₀_iff y hyN).mpr hy).trans ?_ + refine inter_subset_left.trans ?_ + rw [← (isClosed_of_isClosedDisc (hD_disc j).1).closure_eq] + exact closure_mono (hD_sub j).1 + exact exists_mem_support_of_subBd_eq_subgraphU P_pres.Γ (hC_cir j).1 (hD_disc j).2 W hxc hyD + +/-- In a composition `S_comp.IsComposition S₀ N` with `Y ⊆ V(S₀.G)`, every path `R` in `S_comp.G` +from `S_comp.Ω.bar` to `Y` meets every circuit `C j` of a nest `C` in `N`. -/ +theorem nonempty_inter_circuit_of_isFromToPath_comp {S_comp S₀ : Society α β} + {N : Neighborhood α β} {Y : Set α} (hcomp : S_comp.IsComposition S₀ N) (hY : Y ⊆ V(S₀.G)) + {P_pres : Presentation N} {m : ℕ} {C : Fin m → Graph α β} (hC : N.IsNest P_pres C) + (j : Fin m) {R : Graph α β} (hR : IsFromToPath S_comp.G R S_comp.Ω.bar Y) : + (V(R) ∩ V(C j)).Nonempty := by + obtain ⟨x₀, y₀, hR_ends⟩ := hR + have hx₀ : x₀ ∈ S_comp.Ω.bar := hR_ends.left_mem_X + have hy₀ : y₀ ∈ Y := hR_ends.right_mem_Y + obtain ⟨x', hx'x₀, v₀, hv₀S₀, Q, hQR, hQ_ends⟩ := + hR_ends.1.exists_isFromToPathWithEnds (X := {x₀}) (Y := V(S₀.G)) (mem_singleton x₀) (hY hy₀) + rw [mem_singleton_iff] at hx'x₀ + subst x' + have hQ_p : IsGraphPathWithEnds S_comp.G Q x₀ v₀ := hQ_ends.1 + have hEQ_N : E(Q) ⊆ E(N.G) := by + intro e heQ + have he_comp : e ∈ E(S_comp.G) := hQ_p.le.edgeSet_mono heQ + rw [← hcomp.1.1.2.2.2.1] at he_comp + rcases he_comp with heS₀ | heN + · exfalso + obtain ⟨a, b, habS₀⟩ := S₀.G.exists_isLink_of_mem_edgeSet heS₀ + obtain ⟨a', b', habQ⟩ := Q.exists_isLink_of_mem_edgeSet heQ + have ha'S₀ : a' ∈ V(S₀.G) := by + rcases (habQ.mono hQ_p.le).left_eq_or_eq (habS₀.mono hcomp.1.1.1) with rfl | rfl + · exact habS₀.left_mem + · exact habS₀.right_mem + have hb'S₀ : b' ∈ V(S₀.G) := by + rcases (habQ.symm.mono hQ_p.le).left_eq_or_eq (habS₀.mono hcomp.1.1.1) with rfl | rfl + · exact habS₀.left_mem + · exact habS₀.right_mem + have ha'v₀ : a' = v₀ := by + have : a' ∈ V(Q) ∩ V(S₀.G) := ⟨habQ.left_mem, ha'S₀⟩ + rwa [hQ_ends.2.2, mem_singleton_iff] at this + have hb'v₀ : b' = v₀ := by + have : b' ∈ V(Q) ∩ V(S₀.G) := ⟨habQ.right_mem, hb'S₀⟩ + rwa [hQ_ends.2.2, mem_singleton_iff] at this + subst a' b' + exact hQ_p.not_isLoopAt heQ v₀ (habQ.mono hQ_p.le) + · exact heN + have hx₀_bar : x₀ ∈ N.Ω.bar := hcomp.2.1.symm ▸ hx₀ + have hVQ_N : V(Q) ⊆ V(N.G) := by + intro z hzQ + rcases eq_or_ne z x₀ with rfl | hzx₀ + · exact N.bar_subset hx₀_bar + · have hne : x₀ ≠ v₀ := by + rintro rfl + obtain ⟨Q₁, Q₂, _, _, hQ₁, hQ₂, _, hinter, _⟩ := hQ_p.exists_split_at hzQ + have hx₀_in : x₀ ∈ V(Q₁) ∩ V(Q₂) := ⟨hQ₁.left_mem, hQ₂.right_mem⟩ + rw [hinter, mem_singleton_iff] at hx₀_in + exact hzx₀ hx₀_in.symm + obtain ⟨e, heQ, w, hzw⟩ := hQ_p.exists_inc_of_mem_of_ne hne hzQ + obtain ⟨a, b, habN⟩ := N.G.exists_isLink_of_mem_edgeSet (hEQ_N heQ) + rcases (hzw.mono hQ_p.le).left_eq_or_eq (habN.mono hcomp.1.1.2.1) with rfl | rfl + · exact habN.left_mem + · exact habN.right_mem + have hQ_N : Q ≤ N.G := + (Compatible.of_le_le hQ_p.le hcomp.1.1.2.1).le_iff.mpr ⟨hVQ_N, hEQ_N⟩ + have hQ_pathN : IsGraphPathWithEnds N.G Q x₀ v₀ := hQ_p.of_le hQ_N + obtain ⟨_, W_Q, _, hVQ, _⟩ := hQ_pathN + obtain ⟨WN, hsN, _⟩ := exists_walk_up_of_le hQ_N W_Q + have hv₀_bar₀ : v₀ ∈ N.Ω₀.bar := by + rw [hcomp.2.2.1, hcomp.2.2.2] + exact ⟨hv₀S₀, hVQ_N hQ_p.right_mem⟩ + obtain ⟨v, hvWN, hvCj⟩ := exists_mem_support_circuit_of_isNest hC j WN hx₀_bar hv₀_bar₀ + rw [hsN] at hvWN + have hvQ : v ∈ V(Q) := by rw [hVQ]; exact hvWN + exact ⟨v, hQR.vertexSet_mono hvQ, hvCj⟩ + +/-- If `C` is a circuit in `G` and `(V(C) ∩ Z).ncard ≤ 1`, then any two vertices `u, v ∈ V(C) \ Z` +are joined by a path `Q ≤ C` avoiding `Z`. -/ +theorem exists_path_in_circuit_avoiding_of_ncard_le_one {G C : Graph α β} + (hC : IsGraphCircuit G C) {Z : Set α} (hZ : (V(C) ∩ Z).ncard ≤ 1) + {u v : α} (huC : u ∈ V(C)) (hvC : v ∈ V(C)) (huZ : u ∉ Z) (hvZ : v ∉ Z) : + ∃ Q : Graph α β, Q ≤ C ∧ IsGraphPathWithEnds G Q u v ∧ Disjoint V(Q) Z := by + classical + by_cases huv : u = v + · subst huv + let W₀ : GraphWalk C u u := .nil huC + have hW₀_s : W₀.IsSimple := by simp [W₀, GraphWalk.IsSimple] + refine ⟨walkSubgraph W₀, walkSubgraph_le W₀, + (isGraphPathWithEnds_walkSubgraph hW₀_s).mono hC.1, ?_⟩ + rw [vertexSet_walkSubgraph] + simp [W₀, huZ] + · obtain ⟨Q₁, Q₂, hQ₁C, hQ₂C, hQ₁_p, hQ₂_p, _, _, hVQ_inter, _, _⟩ := + hC.exists_two_paths huC hvC huv + by_cases hdisj₁ : Disjoint V(Q₁) Z + · exact ⟨Q₁, hQ₁C, hQ₁_p, hdisj₁⟩ + · refine ⟨Q₂, hQ₂C, hQ₂_p, ?_⟩ + by_contra hdisj₂ + rw [not_disjoint_iff_nonempty_inter] at hdisj₁ hdisj₂ + obtain ⟨z₁, hz₁Q₁, hz₁Z⟩ := hdisj₁ + obtain ⟨z₂, hz₂Q₂, hz₂Z⟩ := hdisj₂ + have hz₁_not_Q₂ : z₁ ∉ V(Q₂) := by + intro hz₁Q₂ + have : z₁ ∈ V(Q₁) ∩ V(Q₂) := ⟨hz₁Q₁, hz₁Q₂⟩ + rw [hVQ_inter] at this + rcases this with rfl | rfl + · exact huZ hz₁Z + · exact hvZ hz₁Z + have hz₁₂ : z₁ ≠ z₂ := fun h => hz₁_not_Q₂ (h ▸ hz₂Q₂) + have hVC_fin : V(C).Finite := by + obtain ⟨_, _, W, _, _, hVC, _⟩ := hC + rw [hVC] + exact W.support.toFinset.finite_toSet.subset fun x hx => List.mem_toFinset.mpr hx + have hsub : ({z₁, z₂} : Set α) ⊆ V(C) ∩ Z := by + rintro x (rfl | rfl) + · exact ⟨hQ₁C.vertexSet_mono hz₁Q₁, hz₁Z⟩ + · exact ⟨hQ₂C.vertexSet_mono hz₂Q₂, hz₂Z⟩ + have hcard := ncard_le_ncard hsub (hVC_fin.inter_of_left Z) + rw [ncard_pair hz₁₂] at hcard + omega + +/-- Pigeonhole principle for `r` pairwise disjoint sets `A i`: if `Z` is finite with `Z.ncard < r`, +then some `A i` is disjoint from `Z`. -/ +theorem exists_disjoint_of_pairwise_disjoint_of_ncard_lt {r : ℕ} {A : Fin r → Set α} + (hdisj : Pairwise (fun i j => Disjoint (A i) (A j))) {Z : Set α} (hZ : Z.Finite) + (hcard : Z.ncard < r) : + ∃ i : Fin r, Disjoint (A i) Z := by + induction r generalizing Z with + | zero => omega + | succ r ih => + by_cases h0 : Disjoint (A 0) Z + · exact ⟨0, h0⟩ + · rw [not_disjoint_iff_nonempty_inter] at h0 + have hpos : 1 ≤ (Z ∩ A 0).ncard := (ncard_pos (hZ.inter_of_left _)).mpr + (by rwa [inter_comm]) + have h_add := ncard_inter_add_ncard_sdiff_eq_ncard Z (A 0) hZ + have hcard' : (Z \ A 0).ncard < r := by omega + have hdisj' : Pairwise (fun i j : Fin r => Disjoint (A i.succ) (A j.succ)) := + fun i j hij => hdisj (Fin.succ_inj.ne.mpr hij) + obtain ⟨i, hi⟩ := ih hdisj' hZ.sdiff hcard' + refine ⟨i.succ, disjoint_left.mpr fun x hxA hxZ => ?_⟩ + have hx_not_0 : x ∉ A 0 := + disjoint_left.mp (hdisj (Fin.succ_ne_zero i)) hxA + exact disjoint_left.mp hi hxA ⟨hxZ, hx_not_0⟩ + +/-- Pigeonhole principle for `s` pairwise disjoint sets `A j`: if `Z` is finite with +`Z.ncard < 2 * s`, then some `A j` meets `Z` in at most 1 element. -/ +theorem exists_ncard_inter_le_one_of_pairwise_disjoint {s : ℕ} {A : Fin s → Set α} + (hdisj : Pairwise (fun i j => Disjoint (A i) (A j))) {Z : Set α} (hZ : Z.Finite) + (hcard : Z.ncard < 2 * s) : + ∃ j : Fin s, (A j ∩ Z).ncard ≤ 1 := by + induction s generalizing Z with + | zero => omega + | succ s ih => + by_cases h0 : (A 0 ∩ Z).ncard ≤ 1 + · exact ⟨0, h0⟩ + · have hge2 : 2 ≤ (Z ∩ A 0).ncard := by rw [inter_comm]; omega + have h_add := ncard_inter_add_ncard_sdiff_eq_ncard Z (A 0) hZ + have hcard' : (Z \ A 0).ncard < 2 * s := by omega + have hdisj' : Pairwise (fun i j : Fin s => Disjoint (A i.succ) (A j.succ)) := + fun i j hij => hdisj (Fin.succ_inj.ne.mpr hij) + obtain ⟨j, hj⟩ := ih hdisj' hZ.sdiff hcard' + refine ⟨j.succ, ?_⟩ + have heq : A j.succ ∩ Z = A j.succ ∩ (Z \ A 0) := by + ext x + simp only [mem_inter_iff, mem_sdiff] + exact ⟨fun ⟨hxA, hxZ⟩ => ⟨hxA, hxZ, disjoint_left.mp (hdisj (Fin.succ_ne_zero j)) hxA⟩, + fun ⟨hxA, hxZ, _⟩ => ⟨hxA, hxZ⟩⟩ + rwa [heq] + +/-! ## 2. Proof of (10.5) (pages 66–67) -/ + +/-- **Graph Minors IX, (10.5)** (page 66): +"Let $p \ge 0$ and let $(G, \Omega, \Omega_0)$ be a rural neighborhood of breadth +$\ge \frac{1}{2} p + 1$. Let $X \subseteq \bar{\Omega}$ be linked, with $|X| \ge p$. Let +$(G \cup G_0, \Omega)$ be the composition of some society $(G_0, \Omega_0)$ with $(G, \Omega, +\Omega_0)$, +and let $Y \subseteq V(G_0)$. Then either there are $p$ mutually disjoint paths of $G \cup G_0$ from +$X$ to $Y$, each with only its initial vertex in $\bar{\Omega}$, or there exists +$W \subseteq V(G \cup G_0)$ with $|W| < p$ and $W \cap \bar{\Omega} = \emptyset$ such that every +path of +$G \cup G_0$ from $\bar{\Omega}$ to $Y$ has a vertex in $W$." -/ +theorem theorem_10_5_proof {S_comp S₀ : Society α β} {N : Neighborhood α β} + {p : ℕ} {X Y : Set α} + (_hrural : N.IsRural) (hbreadth : N.HasBreadthGe ((p + 1) / 2 + 1)) + (hX : N.IsLinked X) (hpX : p ≤ X.ncard) + (hcomp : S_comp.IsComposition S₀ N) (hY : Y ⊆ V(S₀.G)) : + (∃ P : Fin p → Graph α β, + (∀ i, ∃ x ∈ X, ∃ y ∈ Y, IsFromToPathWithEnds S_comp.G (P i) S_comp.Ω.bar Y x y) ∧ + Pairwise (fun i j => Disjoint V(P i) V(P j))) ∨ + (∃ W ⊆ V(S_comp.G), W.ncard < p ∧ Disjoint W S_comp.Ω.bar ∧ + ∀ P : Graph α β, IsFromToPath S_comp.G P S_comp.Ω.bar Y → (V(P) ∩ W).Nonempty) := by + let s := (p + 1) / 2 + obtain ⟨P_pres, C', hC'⟩ := hbreadth + let C : Fin s → Graph α β := fun j => C' ⟨j.1, by omega⟩ + have hC_disj_bar : ∀ j : Fin s, Disjoint V(C j) S_comp.Ω.bar := by + intro j + rw [← hcomp.2.1] + exact disjoint_vertexSet_bar_of_isNest_lt hC' (k := ⟨s, Nat.lt_succ_self s⟩) j.2 + have hC_disj : Pairwise (fun i j : Fin s => Disjoint V(C i) V(C j)) := + fun i j hij => hC'.2.1 (by intro h; exact hij (Fin.ext (Fin.mk.inj h))) + let G' := deleteVertices S_comp.G (S_comp.Ω.bar \ X) + have hG'_le : G' ≤ S_comp.G := deleteVertices_le S_comp.G (S_comp.Ω.bar \ X) + have hG'_fin : Finite V(G') := S_comp.finite_V.subset hG'_le.vertexSet_mono + have hX_Nbar : X ⊆ N.Ω.bar := hX.1 + have hX_bar : X ⊆ S_comp.Ω.bar := hcomp.2.1 ▸ hX_Nbar + have hX_G' : X ⊆ V(G') := fun x hx => + ⟨S_comp.bar_subset (hX_bar hx), fun ⟨_, hx_not_X⟩ => hx_not_X hx⟩ + have hYG'_G' : Y ∩ V(G') ⊆ V(G') := inter_subset_right + rcases exists_fromToPaths_or_graphSeparation hX_G' hYG'_G' p with + ⟨Q, hQ_disj, hQ_path⟩ | ⟨G₁, G₂, hsep, _, hX_G₁, hY_G₂, hZ_lt⟩ + · left + refine ⟨Q, fun i => ?_, hQ_disj⟩ + obtain ⟨x, y, hQi_ends⟩ := hQ_path i + have hxX : x ∈ X := hQi_ends.left_mem_X + have hyY : y ∈ Y := hQi_ends.right_mem_Y.1 + obtain ⟨hQi_p, hQi_X, hQi_Y⟩ := hQi_ends + refine ⟨x, hxX, y, hyY, ⟨hQi_p.mono hG'_le, ?_, ?_⟩⟩ + · ext z + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hzQ, hz_bar⟩ => ?_, fun hzx => + hzx ▸ ⟨hQi_p.left_mem, hX_bar hxX⟩⟩ + have hz_X : z ∈ X := by + by_contra hz_not_X + exact (hQi_p.le.vertexSet_mono hzQ).2 ⟨hz_bar, hz_not_X⟩ + have : z ∈ V(Q i) ∩ X := ⟨hzQ, hz_X⟩ + rwa [hQi_X, mem_singleton_iff] at this + · ext z + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hzQ, hzY⟩ => ?_, fun hzy => + hzy ▸ ⟨hQi_p.right_mem, hyY⟩⟩ + have : z ∈ V(Q i) ∩ (Y ∩ V(G')) := ⟨hzQ, hzY, hQi_p.le.vertexSet_mono hzQ⟩ + rwa [hQi_Y, mem_singleton_iff] at this + · right + let Z := V(G₁) ∩ V(G₂) + have hZ_sub_G' : Z ⊆ V(G') := inter_subset_left.trans hsep.1.vertexSet_mono + have hZ_sub : Z ⊆ V(S_comp.G) := hZ_sub_G'.trans hG'_le.vertexSet_mono + have hZ_fin : Z.Finite := S_comp.finite_V.subset hZ_sub + let W := Z \ S_comp.Ω.bar + refine ⟨W, sdiff_subset.trans hZ_sub, + lt_of_le_of_lt (ncard_le_ncard sdiff_subset hZ_fin) hZ_lt, + disjoint_sdiff_left, fun R hR => ?_⟩ + by_contra hRW_empty + rw [not_nonempty_iff_eq_empty] at hRW_empty + -- Step 1: Pick a linked path P₁ in N.G avoiding Z. + obtain ⟨_, P_link, hPlink_ends, hPlink_disj⟩ := hX + have hZ_lt_r : Z.ncard < X.ncard := lt_of_lt_of_le hZ_lt hpX + obtain ⟨i₀, hPi₀_disj⟩ := + exists_disjoint_of_pairwise_disjoint_of_ncard_lt hPlink_disj hZ_fin hZ_lt_r + obtain ⟨x₁, hx₁X, y₁, hy₁₀, hP₁_ends⟩ := hPlink_ends i₀ + let P₁ := P_link i₀ + -- Step 2: Pick a circuit C j₀ of the nest meeting Z in at most 1 vertex. + have hp_le_2s : p ≤ 2 * s := by dsimp [s]; omega + have hZ_lt_2s : Z.ncard < 2 * s := lt_of_lt_of_le hZ_lt hp_le_2s + obtain ⟨j₀, hj₀⟩ := + exists_ncard_inter_le_one_of_pairwise_disjoint hC_disj hZ_fin hZ_lt_2s + let j₀' : Fin (s + 1) := ⟨j₀.1, by omega⟩ + -- Step 3: P₁ meets C j₀ at some u₁. + obtain ⟨hP₁_N, W_P₁, _, hVP₁, _⟩ := hP₁_ends.1 + obtain ⟨WN_P₁, hs_P₁, _⟩ := exists_walk_up_of_le hP₁_N W_P₁ + obtain ⟨u₁, hu₁_supp, hu₁_C⟩ := + exists_mem_support_circuit_of_isNest hC' j₀' WN_P₁ (hX_Nbar hx₁X) hy₁₀ + have hu₁_P₁ : u₁ ∈ V(P₁) := by rw [hVP₁, ← hs_P₁]; exact hu₁_supp + have hu₁_not_Z : u₁ ∉ Z := disjoint_left.mp hPi₀_disj hu₁_P₁ + -- Step 4: R meets C j₀ at some v, and the subpath P₂ of R from v to y_R avoids Ω.bar and Z. + have hRC_ne := nonempty_inter_circuit_of_isFromToPath_comp hcomp hY hC' j₀' hR + obtain ⟨v, hvR, hvC⟩ := hRC_ne + obtain ⟨x₀, y₀, hR_ends⟩ := hR + have hx₀_bar : x₀ ∈ S_comp.Ω.bar := hR_ends.left_mem_X + have hy₀Y : y₀ ∈ Y := hR_ends.right_mem_Y + obtain ⟨hR_path, hR_bar, _⟩ := hR_ends + obtain ⟨R₁, R₂, hR₁_le, hR₂_le, hR₁_path, hR₂_path, _, hVR₁₂_inter, _⟩ := + hR_path.exists_split_at hvR + have hv_ne_x₀ : v ≠ x₀ := by + rintro rfl + exact disjoint_left.mp (hC_disj_bar j₀) hvC hx₀_bar + have hR₂_disj_bar : Disjoint V(R₂) S_comp.Ω.bar := by + rw [disjoint_left] + intro z hzR₂ hz_bar + have hz_x₀ : z = x₀ := by + have : z ∈ V(R) ∩ S_comp.Ω.bar := ⟨hR₂_le.vertexSet_mono hzR₂, hz_bar⟩ + rwa [hR_bar, mem_singleton_iff] at this + subst hz_x₀ + have : z ∈ V(R₁) ∩ V(R₂) := ⟨hR₁_path.left_mem, hzR₂⟩ + rw [hVR₁₂_inter, mem_singleton_iff] at this + exact hv_ne_x₀ this.symm + have hR₂_disj_Z : Disjoint V(R₂) Z := by + rw [disjoint_left] + intro z hzR₂ hzZ + have hzW : z ∈ W := ⟨hzZ, disjoint_left.mp hR₂_disj_bar hzR₂⟩ + have : z ∈ V(R) ∩ W := ⟨hR₂_le.vertexSet_mono hzR₂, hzW⟩ + rw [hRW_empty] at this + exact this + have hv_not_Z : v ∉ Z := disjoint_left.mp hR₂_disj_Z hR₂_path.left_mem + -- Step 5: C j₀ contains a path Q_C from u₁ to v avoiding Z. + obtain ⟨Q_C, hQC_le, hQC_path, hQC_disj_Z⟩ := + exists_path_in_circuit_avoiding_of_ncard_le_one (hC'.1 j₀') hj₀ hu₁_C hvC hu₁_not_Z hv_not_Z + -- Step 6: P₁, Q_C, and R₂ all lie in G', giving a walk in G' from x₁ ∈ X to y₀ ∈ Y ∩ V(G') + -- that avoids Z = V(G₁) ∩ V(G₂), contradicting that (G₁, G₂) separates X from Y ∩ V(G'). + have hP₁_G' : P₁ ≤ G' := by + refine le_deleteVertices (hP₁_N.trans hcomp.1.1.2.1) ?_ + rw [disjoint_left] + intro z hzP₁ ⟨hz_bar, hz_not_X⟩ + have : z ∈ V(P₁) ∩ N.Ω.bar := ⟨hzP₁, hcomp.2.1 ▸ hz_bar⟩ + rw [hP₁_ends.2.1, mem_singleton_iff] at this + exact hz_not_X (this ▸ hx₁X) + have hQC_G' : Q_C ≤ G' := by + refine le_deleteVertices (hQC_le.trans ((hC'.1 j₀').1.trans hcomp.1.1.2.1)) ?_ + exact disjoint_of_subset hQC_le.vertexSet_mono sdiff_subset (hC_disj_bar j₀) + have hR₂_G' : R₂ ≤ G' := + le_deleteVertices (hR₂_le.trans hR_path.1) + (disjoint_of_subset_right sdiff_subset hR₂_disj_bar) + obtain ⟨P₁_a, _, hP₁a_le, _, hP₁a_path, _, _, _, _⟩ := hP₁_ends.1.exists_split_at hu₁_P₁ + obtain ⟨_, W_1, _, hV1, _⟩ := hP₁a_path + obtain ⟨W_1G', hs1, _⟩ := exists_walk_up_of_le (hP₁a_le.trans hP₁_G') W_1 + obtain ⟨_, W_C, _, hVC, _⟩ := hQC_path + obtain ⟨W_CG', hsC, _⟩ := exists_walk_up_of_le hQC_G' W_C + have hy₀_R₂ : y₀ ∈ V(R₂) := hR₂_path.right_mem + obtain ⟨_, W_2, _, hV2, _⟩ := hR₂_path + obtain ⟨W_2G', hs2, _⟩ := exists_walk_up_of_le hR₂_G' W_2 + let W_total : GraphWalk G' x₁ y₀ := (W_1G'.append W_CG').append W_2G' + have hx₁_G₁ : x₁ ∈ V(G₁) := hX_G₁ hx₁X + have hy₀_G₂ : y₀ ∈ V(G₂) := hY_G₂ ⟨hy₀Y, hR₂_G'.vertexSet_mono hy₀_R₂⟩ + obtain ⟨z, hz_supp, hz_Z⟩ := exists_mem_inter_of_graphWalk hsep W_total hx₁_G₁ hy₀_G₂ + rw [GraphWalk.mem_support_append, GraphWalk.mem_support_append] at hz_supp + rcases hz_supp with (hz1 | hzC) | hz2 + · rw [hs1] at hz1 + have hz_P₁ : z ∈ V(P₁) := hP₁a_le.vertexSet_mono (by rw [hV1]; exact hz1) + exact disjoint_left.mp hPi₀_disj hz_P₁ hz_Z + · rw [hsC] at hzC + have hz_QC : z ∈ V(Q_C) := by rw [hVC]; exact hzC + exact disjoint_left.mp hQC_disj_Z hz_QC hz_Z + · rw [hs2] at hz2 + have hz_R₂ : z ∈ V(R₂) := by rw [hV2]; exact hz2 + exact disjoint_left.mp hR₂_disj_Z hz_R₂ hz_Z + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section10b.lean b/LeanPool/GraphMinor/GM09/Section10b.lean new file mode 100644 index 0000000000..1f526d5e6f --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section10b.lean @@ -0,0 +1,970 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Section10 +public import LeanPool.GraphMinor.GM09.Basic +public import LeanPool.GraphMinor.GM09.Section2a +public import LeanPool.GraphMinor.GM09.Section2d +public import LeanPool.GraphMinor.GM09.Section2e +public import LeanPool.GraphMinor.GM09.Section3a +public import LeanPool.GraphMinor.GM09.Section3c +public import LeanPool.GraphMinor.GM09.Section4a +public import LeanPool.GraphMinor.GM09.Section4c +public import LeanPool.GraphMinor.GM09.Section5a +public import LeanPool.GraphMinor.GM09.Section5b +public import LeanPool.GraphMinor.GM09.Section6 +public import LeanPool.GraphMinor.GM09.Section7 +public import LeanPool.GraphMinor.GM09.Section8 +public import LeanPool.GraphMinor.GM09.Section9 +public import LeanPool.GraphMinor.GM09.Section11b +public import LeanPool.GraphMinor.GM09.NestUncrossing +public import LeanPool.GraphMinor.GM06.Section2Dual +public import LeanPool.GraphMinor.GM06.Section3Dual +public import LeanPool.GraphMinor.Surface.InvarianceOfDomain +public import LeanPool.GraphMinor.Surface.Crossing +public import Mathlib.Data.Set.Card + +/-! +# Graph Minors IX, (5.2) for paths with internal vertices in `ΩBar` + +(5.2) asks that the paths `Q_i` have no internal vertex in `ΩBar`. The proof of (10.3) uses (5.2) +for the paths of (10.2), and those may have such vertices. To drop the condition we add to each +vertex of `ΩBar` a new pendant vertex, and let +the new vertices carry the cyclic order (`Society.spiked`). Paths, crosses and crooked transactions +pass between the two societies. The new vertices have degree one, so no path has one as an internal +vertex. +-/ + +@[expose] public section + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 + +universe u v + +variable {α : Type u} {β : Type v} + +namespace GraphMinor.GM09 + +/-- Left injection `α → α ⊕ α` for original vertices. -/ +abbrev inlV (x : α) : α ⊕ α := Sum.inl x + +/-- Right injection `α → α ⊕ α` for pendant spike vertices. -/ +abbrev inrV (x : α) : α ⊕ α := Sum.inr x + +/-- Left injection `β → β ⊕ α` for original edges. -/ +abbrev inlE (e : β) : β ⊕ α := Sum.inl e + +/-- Right injection `α → β ⊕ α` for pendant spike edges. -/ +abbrev inrE (x : α) : β ⊕ α := Sum.inr x + +theorem inlV_injective : Function.Injective (inlV : α → α ⊕ α) := Sum.inl_injective +theorem inrV_injective : Function.Injective (inrV : α → α ⊕ α) := Sum.inr_injective +theorem inlE_injective : Function.Injective (inlE : β → β ⊕ α) := Sum.inl_injective +theorem inrE_injective : Function.Injective (inrE : α → β ⊕ α) := Sum.inr_injective + +/-- Push a `CyclicPerm α` forward along `inrV : α → α ⊕ α`. -/ +def CyclicPerm.mapInr (Ω : CyclicPerm α) : CyclicPerm (α ⊕ α) where + bar := inrV '' Ω.bar + toFun := Sum.elim inlV (inrV ∘ Ω.toFun) + finite_bar := Ω.finite_bar.image inrV + bijOn := by + refine ⟨?_, ?_, ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + exact ⟨Ω.toFun x, Ω.bijOn.mapsTo hx, rfl⟩ + · rintro _ ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩ hxy + exact congrArg inrV (Ω.bijOn.injOn hx hy (Sum.inr.inj hxy)) + · rintro _ ⟨y, hy, rfl⟩ + obtain ⟨x, hx, rfl⟩ := Ω.bijOn.surjOn hy + exact ⟨inrV x, ⟨x, hx, rfl⟩, rfl⟩ + single_orbit := by + rintro _ ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩ + obtain ⟨k, hk⟩ := Ω.single_orbit x hx y hy + refine ⟨k, ?_⟩ + have h_iter : ∀ n : ℕ, ((Sum.elim inlV (inrV ∘ Ω.toFun))^[n]) (inrV x) = + inrV ((Ω.toFun^[n]) x) := by + intro n + induction n with + | zero => rfl + | succ n ih => + rw [Function.iterate_succ_apply', Function.iterate_succ_apply', ih] + rfl + rw [h_iter k, hk] + +theorem CyclicPerm.mapInr_iterate (Ω : CyclicPerm α) (n : ℕ) (x : α) : + ((Ω.mapInr.toFun)^[n]) (inrV x) = inrV ((Ω.toFun^[n]) x) := by + induction n with + | zero => rfl + | succ n ih => + rw [Function.iterate_succ_apply', Function.iterate_succ_apply', ih] + rfl + +theorem CyclicPerm.mapInr_firstHitIn_iff (Ω : CyclicPerm α) (X : Set α) (x y : α) : + Ω.mapInr.FirstHitIn (inrV '' X) (inrV x) (inrV y) ↔ Ω.FirstHitIn X x y := by + dsimp [CyclicPerm.FirstHitIn] + refine exists_congr fun k => and_congr_right fun _ => ?_ + rw [Ω.mapInr_iterate k x, inrV_injective.eq_iff, inrV_injective.mem_set_image] + refine and_congr_right fun _ => and_congr_right fun _ => forall_congr' fun j => ?_ + rw [Ω.mapInr_iterate j x, inrV_injective.mem_set_image] + +theorem CyclicPerm.mapInr_isClockwiseSeq_iff (Ω : CyclicPerm α) (L : List α) : + Ω.mapInr.IsClockwiseSeq (L.map inrV) ↔ Ω.IsClockwiseSeq L := by + dsimp [CyclicPerm.IsClockwiseSeq] + rw [List.nodup_map_iff inrV_injective] + refine and_congr_right fun _ => ?_ + have hmem : (∀ v ∈ L.map inrV, v ∈ Ω.mapInr.bar) ↔ ∀ v ∈ L, v ∈ Ω.bar := by + simp [CyclicPerm.mapInr] + rw [hmem] + refine and_congr_right fun _ => ?_ + simp only [List.length_map, List.getElem_map] + have hset : {v | v ∈ L.map inrV} = inrV '' {v | v ∈ L} := by + ext z; simp + refine forall_congr' fun i => forall_congr' fun hi => ?_ + rw [hset, Ω.mapInr_firstHitIn_iff] + +theorem CyclicPerm.mapInr_crosses_iff (Ω : CyclicPerm α) (v₁ v₃ v₂ v₄ : α) : + Ω.mapInr.Crosses (inrV v₁) (inrV v₃) (inrV v₂) (inrV v₄) ↔ + Ω.Crosses v₁ v₃ v₂ v₄ := by + dsimp [CyclicPerm.Crosses] + have h1 : [inrV v₁, inrV v₂, inrV v₃, inrV v₄] = [v₁, v₂, v₃, v₄].map inrV := rfl + have h2 : [inrV v₄, inrV v₃, inrV v₂, inrV v₁] = [v₄, v₃, v₂, v₁].map inrV := rfl + rw [h1, h2, Ω.mapInr_isClockwiseSeq_iff, Ω.mapInr_isClockwiseSeq_iff] + +theorem CyclicPerm.mapInr_interval (Ω : CyclicPerm α) (v₁ v₂ : α) : + Ω.mapInr.interval (inrV v₁) (inrV v₂) = inrV '' Ω.interval v₁ v₂ := by + ext z + rcases z with u | v + · simp [CyclicPerm.interval, CyclicPerm.IsClockwise3, CyclicPerm.IsClockwiseSeq, + CyclicPerm.mapInr] + · simp only [CyclicPerm.interval, mem_ofPred_eq, CyclicPerm.IsClockwise3, + inrV_injective.mem_set_image] + have h : [inrV v₁, inrV v, inrV v₂] = [v₁, v, v₂].map inrV := rfl + rw [h, Ω.mapInr_isClockwiseSeq_iff] + refine and_congr_left fun _ => ?_ + simp [CyclicPerm.mapInr] + +theorem CyclicPerm.mapInr_isFence_iff (Ω : CyclicPerm α) {A B : Set α} : + Ω.mapInr.IsFence (inrV '' A) (inrV '' B) ↔ Ω.IsFence A B := by + refine ⟨fun ⟨hA, hB, hdisj, hunion, hno_cr⟩ => ?_, fun ⟨hA, hB, hdisj, hunion, hno_cr⟩ => ?_⟩ + · refine ⟨image_subset_image_iff inrV_injective |>.mp hA, + image_subset_image_iff inrV_injective |>.mp hB, + disjoint_of_subset (subset_preimage_image inrV A) (subset_preimage_image inrV B) + (hdisj.preimage inrV), ?_, ?_⟩ + · apply inrV_injective.image_injective + rw [image_union, hunion] + rfl + · intro a₁ ha₁ a₂ ha₂ ha12 b₁ hb₁ b₂ hb₂ hb12 hcr + exact hno_cr (inrV a₁) (mem_image_of_mem inrV ha₁) (inrV a₂) (mem_image_of_mem inrV ha₂) + (inrV_injective.ne ha12) (inrV b₁) (mem_image_of_mem inrV hb₁) + (inrV b₂) (mem_image_of_mem inrV hb₂) (inrV_injective.ne hb12) + ((Ω.mapInr_crosses_iff a₁ a₂ b₁ b₂).mpr hcr) + · refine ⟨image_mono hA, image_mono hB, Set.disjoint_image_of_injective inrV_injective hdisj, + by rw [← image_union, hunion]; rfl, ?_⟩ + rintro _ ⟨a₁, ha₁, rfl⟩ _ ⟨a₂, ha₂, rfl⟩ ha12 _ ⟨b₁, hb₁, rfl⟩ _ ⟨b₂, hb₂, rfl⟩ hb12 hcr + exact hno_cr a₁ ha₁ a₂ ha₂ (fun h => ha12 (congrArg inrV h)) + b₁ hb₁ b₂ hb₂ (fun h => hb12 (congrArg inrV h)) + ((Ω.mapInr_crosses_iff a₁ a₂ b₁ b₂).mp hcr) + +/-- Link relation for the pendant-spike graph `spikeGraph H X`. -/ +inductive SpikeIsLink (H : Graph α β) (X : Set α) : (β ⊕ α) → (α ⊕ α) → (α ⊕ α) → Prop + | inl {e : β} {x y : α} : H.IsLink e x y → SpikeIsLink H X (inlE e) (inlV x) (inlV y) + | inr_lr {x : α} : x ∈ X ∩ V(H) → SpikeIsLink H X (inrE x) (inlV x) (inrV x) + | inr_rl {x : α} : x ∈ X ∩ V(H) → SpikeIsLink H X (inrE x) (inrV x) (inlV x) + +/-- The pendant-spike extension of a graph `H : Graph α β` along a subset `X ⊆ V(H)`: +adds a pendant vertex `inrV x` and pendant edge `inrE x` linking `inlV x` and `inrV x` +for each `x ∈ X ∩ V(H)`. -/ +def spikeGraph (H : Graph α β) (X : Set α) : Graph (α ⊕ α) (β ⊕ α) where + vertexSet := (inlV '' V(H)) ∪ (inrV '' (X ∩ V(H))) + edgeSet := (inlE '' E(H)) ∪ (inrE '' (X ∩ V(H))) + IsLink := SpikeIsLink H X + isLink_symm _ _ := ⟨fun _ _ h => by + rcases h with ⟨hlink⟩ | ⟨hx⟩ | ⟨hx⟩ + · exact .inl hlink.symm + · exact .inr_rl hx + · exact .inr_lr hx⟩ + eq_or_eq_of_isLink_of_isLink _ _ _ _ _ h1 h2 := by + rcases h1 with ⟨hlink₁⟩ | ⟨hx₁⟩ | ⟨hx₁⟩ <;> rcases h2 with ⟨hlink₂⟩ | ⟨hx₂⟩ | ⟨hx₂⟩ + · rcases hlink₁.left_eq_or_eq hlink₂ with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + · exact Or.inl rfl + · exact Or.inr rfl + · exact Or.inr rfl + · exact Or.inl rfl + edge_mem_iff_exists_isLink e := by + constructor + · rintro (⟨e₀, he₀, rfl⟩ | ⟨x, hx, rfl⟩) + · obtain ⟨u, v, huv⟩ := H.exists_isLink_of_mem_edgeSet he₀ + exact ⟨inlV u, inlV v, .inl huv⟩ + · exact ⟨inlV x, inrV x, .inr_lr hx⟩ + · rintro ⟨_, _, ⟨hlink⟩ | ⟨hx⟩ | ⟨hx⟩⟩ + · exact Or.inl ⟨_, hlink.edge_mem, rfl⟩ + · exact Or.inr ⟨_, hx, rfl⟩ + · exact Or.inr ⟨_, hx, rfl⟩ + left_mem_of_isLink _ _ _ h := by + rcases h with ⟨hlink⟩ | ⟨hx⟩ | ⟨hx⟩ + · exact Or.inl ⟨_, hlink.left_mem, rfl⟩ + · exact Or.inl ⟨_, hx.2, rfl⟩ + · exact Or.inr ⟨_, hx, rfl⟩ + +theorem spikeGraph_isLink_inrV_left {G : Graph α β} {B : Set α} {e : β ⊕ α} {a : α} {w : α ⊕ α} + (hl : (spikeGraph G B).IsLink e (inrV a) w) : + a ∈ B ∩ V(G) ∧ e = inrE a ∧ w = inlV a := by + rcases hl with _ | _ | ⟨ha⟩ + exact ⟨ha, rfl, rfl⟩ + +theorem spikeGraph_isLink_inlV_left {G : Graph α β} {B : Set α} {e : β ⊕ α} {u : α} {w : α ⊕ α} + (hl : (spikeGraph G B).IsLink e (inlV u) w) : + (∃ e₀ v, e = inlE e₀ ∧ w = inlV v ∧ G.IsLink e₀ u v) ∨ + (u ∈ B ∩ V(G) ∧ e = inrE u ∧ w = inrV u) := by + rcases hl with ⟨hlink⟩ | ⟨hu⟩ | _ + · exact Or.inl ⟨_, _, rfl, rfl, hlink⟩ + · exact Or.inr ⟨hu, rfl, rfl⟩ + +theorem spikeGraph_le {H G : Graph α β} {X Y : Set α} (hHG : H ≤ G) (hXY : X ∩ V(H) ⊆ Y ∩ V(G)) : + spikeGraph H X ≤ spikeGraph G Y where + vertexSet_mono := union_subset_union (image_mono hHG.vertexSet_mono) (image_mono hXY) + isLink_mono _ _ _ h := by + rcases h with ⟨hlink⟩ | ⟨hx⟩ | ⟨hx⟩ + · exact .inl (hlink.mono hHG) + · exact .inr_lr (hXY hx) + · exact .inr_rl (hXY hx) + +/-- The spiked society obtained by attaching a pendant spike to each vertex in `S.Ω.bar`. -/ +def Society.spiked (S : Society α β) : Society (α ⊕ α) (β ⊕ α) where + G := spikeGraph S.G S.Ω.bar + Ω := S.Ω.mapInr + finite_V := (S.finite_V.image inlV).union ((S.Ω.finite_bar.inter_of_left _).image inrV) + finite_E := (S.finite_E.image inlE).union ((S.Ω.finite_bar.inter_of_left _).image inrE) + bar_subset := by + rintro _ ⟨x, hx, rfl⟩ + exact Or.inr ⟨x, ⟨hx, S.bar_subset hx⟩, rfl⟩ + +theorem walk_start_mem_V {G : Graph α β} {u v : α} (W : GraphWalk G u v) : u ∈ V(G) := + W.mem_vertexSet_of_mem_support W.start_mem_support + +theorem walk_end_mem_V {G : Graph α β} {u v : α} (W : GraphWalk G u v) : v ∈ V(G) := + W.mem_vertexSet_of_mem_support W.end_mem_support + +/-- Map a walk `W : GraphWalk H u v` into `spikeGraph H X` on the `inlV` vertices. -/ +def mapSpikeInl {H : Graph α β} (X : Set α) : + ∀ {u v : α}, GraphWalk H u v → GraphWalk (spikeGraph H X) (inlV u) (inlV v) + | _, _, .nil hu => .nil (Or.inl ⟨_, hu, rfl⟩) + | _, _, .cons hl rest => .cons (.inl hl) (mapSpikeInl X rest) + +@[simp] +theorem support_mapSpikeInl {H : Graph α β} (X : Set α) {u v : α} (W : GraphWalk H u v) : + (mapSpikeInl X W).support = W.support.map inlV := by + induction W with + | nil _ => rfl + | cons _ rest ih => + change inlV _ :: (mapSpikeInl X rest).support = inlV _ :: rest.support.map inlV + rw [ih] + +@[simp] +theorem edges_mapSpikeInl {H : Graph α β} (X : Set α) {u v : α} (W : GraphWalk H u v) : + (mapSpikeInl X W).edges = W.edges.map inlE := by + induction W with + | nil _ => rfl + | cons _ rest ih => + change inlE _ :: (mapSpikeInl X rest).edges = inlE _ :: rest.edges.map inlE + rw [ih] + +/-- Extend a walk `W : GraphWalk P a b` with `a, b ∈ V(P)` by the two pendant spikes at `a` and `b`. +-/ +def spikePathWalk {P : Graph α β} {a b : α} (W : GraphWalk P a b) : + GraphWalk (spikeGraph P {a, b}) (inrV a) (inrV b) := + have ha : a ∈ ({a, b} : Set α) ∩ V(P) := ⟨Or.inl rfl, walk_start_mem_V W⟩ + have hb : b ∈ ({a, b} : Set α) ∩ V(P) := ⟨Or.inr rfl, walk_end_mem_V W⟩ + GraphWalk.cons (.inr_rl ha) + ((mapSpikeInl {a, b} W).append + (GraphWalk.cons (.inr_lr hb) (GraphWalk.nil (Or.inr ⟨b, hb, rfl⟩)))) + +theorem support_spikePathWalk {P : Graph α β} {a b : α} (W : GraphWalk P a b) : + (spikePathWalk W).support = inrV a :: (W.support.map inlV ++ [inrV b]) := by + dsimp [spikePathWalk] + change inrV a :: ((mapSpikeInl {a, b} W).append _).support = _ + rw [GraphWalk.support_append, support_mapSpikeInl] + rfl + +theorem edges_spikePathWalk {P : Graph α β} {a b : α} (W : GraphWalk P a b) : + (spikePathWalk W).edges = inrE a :: (W.edges.map inlE ++ [inrE b]) := by + dsimp [spikePathWalk] + change inrE a :: ((mapSpikeInl {a, b} W).append _).edges = _ + rw [GraphWalk.edges_append, edges_mapSpikeInl] + rfl + +theorem isSimple_spikePathWalk {P : Graph α β} {a b : α} (W : GraphWalk P a b) + (hW : W.IsSimple) (hab : a ≠ b) : + (spikePathWalk W).IsSimple := by + rw [GraphWalk.IsSimple, support_spikePathWalk, List.nodup_cons] + refine ⟨?_, ?_⟩ + · simp only [List.mem_append, List.mem_map, Sum.inl_ne_inr, and_false, exists_false, + List.mem_singleton, inrV_injective.eq_iff, false_or] + exact hab + · rw [List.nodup_append] + refine ⟨(List.nodup_map_iff inlV_injective).mpr hW, List.nodup_singleton _, ?_⟩ + intro x hx y hy hxy + rcases List.mem_map.mp hx with ⟨u, _, rfl⟩ + rw [List.mem_singleton] at hy + subst hy + exact Sum.inl_ne_inr hxy + +theorem isOmegaPathWithEnds_spikeGraph (S : Society α β) {P : Graph α β} {a b : α} + (hP : S.IsOmegaPathWithEnds P a b) : + (Society.spiked S).IsOmegaPathWithEnds (spikeGraph P {a, b}) (inrV a) (inrV b) ∧ + Disjoint (pathInternalVerts (Society.spiked S).G (spikeGraph P {a, b})) + (Society.spiked S).Ω.bar := by + obtain ⟨⟨hP_le, W, hW_s, hVP, hEP⟩, hab, ha_bar, hb_bar⟩ := hP + have hle_spiked : spikeGraph P {a, b} ≤ (Society.spiked S).G := by + refine spikeGraph_le hP_le ?_ + rintro x ⟨rfl | rfl, hxP⟩ + · exact ⟨ha_bar, hP_le.vertexSet_mono hxP⟩ + · exact ⟨hb_bar, hP_le.vertexSet_mono hxP⟩ + have hpath : IsGraphPathWithEnds (Society.spiked S).G (spikeGraph P {a, b}) (inrV a) (inrV b) + := by + refine ⟨hle_spiked, spikePathWalk W, isSimple_spikePathWalk W hW_s hab, ?_, ?_⟩ + · ext z + rw [support_spikePathWalk] + simp only [mem_ofPred_eq, List.mem_cons, List.mem_append, List.mem_map, List.not_mem_nil, + or_false] + rcases z with u | v + · simp [spikeGraph, hVP] + · simp only [spikeGraph, mem_union, mem_image, inrV_injective.mem_set_image, + inrV_injective.eq_iff] + constructor + · rintro (⟨x, _, h_eq⟩ | ⟨rfl | rfl, _⟩) + · exact (Sum.inl_ne_inr h_eq).elim + · exact Or.inl rfl + · exact Or.inr (Or.inr rfl) + · rintro (rfl | ⟨x, _, h_eq⟩ | rfl) + · exact Or.inr ⟨Or.inl rfl, walk_start_mem_V W⟩ + · exact (Sum.inl_ne_inr h_eq).elim + · exact Or.inr ⟨Or.inr rfl, walk_end_mem_V W⟩ + · ext e + rw [edges_spikePathWalk] + simp only [mem_ofPred_eq, List.mem_cons, List.mem_append, List.mem_map, List.not_mem_nil, + or_false] + rcases e with e₀ | v + · simp [spikeGraph, hEP] + · simp only [spikeGraph, mem_union, mem_image, inrE_injective.mem_set_image, + inrE_injective.eq_iff] + constructor + · rintro (⟨x, _, h_eq⟩ | ⟨rfl | rfl, _⟩) + · exact (Sum.inl_ne_inr h_eq).elim + · exact Or.inl rfl + · exact Or.inr (Or.inr rfl) + · rintro (rfl | ⟨x, _, h_eq⟩ | rfl) + · exact Or.inr ⟨Or.inl rfl, walk_start_mem_V W⟩ + · exact (Sum.inl_ne_inr h_eq).elim + · exact Or.inr ⟨Or.inr rfl, walk_end_mem_V W⟩ + have h_omega : (Society.spiked S).IsOmegaPathWithEnds (spikeGraph P {a, b}) (inrV a) (inrV b) := + ⟨hpath, inrV_injective.ne hab, mem_image_of_mem inrV ha_bar, mem_image_of_mem inrV hb_bar⟩ + refine ⟨h_omega, ?_⟩ + rw [disjoint_left] + rintro z ⟨hz_V, hz_not_end⟩ ⟨x, _, rfl⟩ + rw [hpath.pathEnds_eq] at hz_not_end + rcases hz_V with ⟨u, _, h_eq⟩ | ⟨u, ⟨rfl | rfl, _⟩, h_eq⟩ + · exact Sum.inl_ne_inr h_eq + · exact hz_not_end (Or.inl h_eq.symm) + · exact hz_not_end (Or.inr (mem_singleton_iff.mpr h_eq.symm)) + +/-- Every simple walk in `spikeGraph G B` from `inlV u` to `inrV b` projects to a simple walk in `G` +from `u` to `b` followed by the spike edge `inrE b`. -/ +theorem exists_unspike_walk_of_simple_aux {G : Graph α β} {B : Set α} + {z w : α ⊕ α} (W : GraphWalk (spikeGraph G B) z w) : + ∀ (u b : α), z = inlV u → w = inrV b → W.IsSimple → + ∃ W₀ : GraphWalk G u b, W₀.IsSimple ∧ + W.support = W₀.support.map inlV ++ [inrV b] ∧ + W.edges = W₀.edges.map inlE ++ [inrE b] := by + induction W with + | nil _ => + intro u b hz hw _ + exact (Sum.inl_ne_inr (hz.symm.trans hw)).elim + | cons hl rest ih => + intro u b hz hw hW_s + subst hz hw + have hcons_s : inlV u ∉ rest.support ∧ rest.IsSimple := by + rwa [GraphWalk.IsSimple, GraphWalk.support_cons, List.nodup_cons] at hW_s + rcases spikeGraph_isLink_inlV_left hl with ⟨e₀, v, rfl, rfl, hlink⟩ | ⟨hu, rfl, rfl⟩ + · obtain ⟨W₀', hW₀'_s, hsupp, hedges⟩ := ih v b rfl rfl hcons_s.2 + refine ⟨.cons hlink W₀', ?_, ?_, ?_⟩ + · rw [GraphWalk.IsSimple, GraphWalk.support_cons, List.nodup_cons] + refine ⟨fun hu_mem => hcons_s.1 ?_, hW₀'_s⟩ + rw [hsupp, List.mem_append] + exact Or.inl (List.mem_map_of_mem hu_mem) + · change inlV u :: rest.support = (u :: W₀'.support).map inlV ++ [inrV b] + rw [hsupp, List.map_cons, List.cons_append] + · change inlE e₀ :: rest.edges = (e₀ :: W₀'.edges).map inlE ++ [inrE b] + rw [hedges, List.map_cons, List.cons_append] + · rcases rest with _ | ⟨hl₂, rest₂⟩ + · refine ⟨.nil hu.2, by simp [GraphWalk.IsSimple, GraphWalk.support_nil], rfl, rfl⟩ + · exfalso + obtain ⟨_, _, rfl⟩ := spikeGraph_isLink_inrV_left hl₂ + exact hcons_s.1 (List.mem_cons_of_mem _ rest₂.start_mem_support) + +/-- Every simple walk in `spikeGraph G B` from `inrV a` to `inrV b` (`a ≠ b`) is `spikePathWalk W₀` +on support and edges for some simple walk `W₀ : GraphWalk G a b`. -/ +theorem exists_unspike_walk_of_simple {G : Graph α β} {B : Set α} {a b : α} + (W : GraphWalk (spikeGraph G B) (inrV a) (inrV b)) (hW_s : W.IsSimple) (hab : a ≠ b) : + ∃ W₀ : GraphWalk G a b, W₀.IsSimple ∧ + W.support = inrV a :: (W₀.support.map inlV ++ [inrV b]) ∧ + W.edges = inrE a :: (W₀.edges.map inlE ++ [inrE b]) := by + rcases W with _ | ⟨hl₁, rest⟩ + · exact (hab rfl).elim + · have hcons_s : inrV a ∉ rest.support ∧ rest.IsSimple := by + rwa [GraphWalk.IsSimple, GraphWalk.support_cons, List.nodup_cons] at hW_s + obtain ⟨_, rfl, rfl⟩ := spikeGraph_isLink_inrV_left hl₁ + obtain ⟨W₀, hW₀_s, hsupp, hedges⟩ := exists_unspike_walk_of_simple_aux rest a b rfl rfl + hcons_s.2 + exact ⟨W₀, hW₀_s, congrArg (List.cons (inrV a)) hsupp, congrArg (List.cons (inrE a)) hedges⟩ + +/-- Project a subgraph `K ≤ spikeGraph G B` back to a subgraph of `G`. -/ +def unspikeGraph (G : Graph α β) (K : Graph (α ⊕ α) (β ⊕ α)) : Graph α β := + (G.induce (inlV ⁻¹' V(K))).restrict (inlE ⁻¹' E(K)) + +/-- Every `Ω`-path `K` in `Society.spiked S` with ends `inrV a, inrV b` comes from an `Ω`-path `P₀` +in `S` with ends `a, b` such that `V(K) = (inlV '' V(P₀)) ∪ {inrV a, inrV b}` and +`P₀ = unspikeGraph S.G K`. -/ +theorem isOmegaPathWithEnds_unspikeGraph (S : Society α β) {K : Graph (α ⊕ α) (β ⊕ α)} {a b : α} + (hK : (Society.spiked S).IsOmegaPathWithEnds K (inrV a) (inrV b)) : + S.IsOmegaPathWithEnds (unspikeGraph S.G K) a b ∧ + V(K) = (inlV '' V(unspikeGraph S.G K)) ∪ {inrV a, inrV b} := by + obtain ⟨⟨hK_le, W_K, hWK_s, hVK, hEK⟩, hab_inr, ha_bar_inr, hb_bar_inr⟩ := hK + have hab : a ≠ b := fun h => hab_inr (congrArg inrV h) + have ha_bar : a ∈ S.Ω.bar := (inrV_injective.mem_set_image).mp ha_bar_inr + have hb_bar : b ∈ S.Ω.bar := (inrV_injective.mem_set_image).mp hb_bar_inr + have hK_le' : K ≤ spikeGraph S.G S.Ω.bar := hK_le + obtain ⟨W_sp, hs_sp, he_sp⟩ := exists_walk_up_of_le hK_le' W_K + have hWsp_s : W_sp.IsSimple := by rw [GraphWalk.IsSimple, hs_sp]; exact hWK_s + obtain ⟨W₀, hW₀_s, hsupp, hedges⟩ := exists_unspike_walk_of_simple W_sp hWsp_s hab + have hVK_eq : V(K) = (inlV '' {u | u ∈ W₀.support}) ∪ {inrV a, inrV b} := by + ext z + rw [hVK, mem_ofPred_eq, ← hs_sp, hsupp] + simp only [List.mem_cons, List.mem_append, List.mem_map, List.not_mem_nil, + or_false, mem_union, mem_image, mem_insert_iff, mem_singleton_iff, mem_ofPred_eq] + exact or_left_comm + have hEK_eq : E(K) = (inlE '' {e | e ∈ W₀.edges}) ∪ {inrE a, inrE b} := by + ext e + rw [hEK, mem_ofPred_eq, ← he_sp, hedges] + simp only [List.mem_cons, List.mem_append, List.mem_map, List.not_mem_nil, + or_false, mem_union, mem_image, mem_insert_iff, mem_singleton_iff, mem_ofPred_eq] + exact or_left_comm + have hpre_V : inlV ⁻¹' V(K) = {u | u ∈ W₀.support} := by + ext u + simp only [mem_preimage, hVK_eq, mem_union, inlV_injective.mem_set_image, mem_insert_iff, + mem_singleton_iff, Sum.inl_ne_inr, or_false, mem_ofPred_eq] + have hpre_E : inlE ⁻¹' E(K) = {e | e ∈ W₀.edges} := by + ext e + simp only [mem_preimage, hEK_eq, mem_union, inlE_injective.mem_set_image, mem_insert_iff, + mem_singleton_iff, Sum.inl_ne_inr, or_false, mem_ofPred_eq] + have hP₀_eq : unspikeGraph S.G K = walkSubgraph W₀ := by + rw [walkSubgraph_eq] + dsimp [unspikeGraph] + rw [hpre_V, hpre_E] + have hP₀_path : IsGraphPathWithEnds S.G (unspikeGraph S.G K) a b := by + rw [hP₀_eq] + exact isGraphPathWithEnds_walkSubgraph hW₀_s + refine ⟨⟨hP₀_path, hab, ha_bar, hb_bar⟩, ?_⟩ + rw [hP₀_eq, vertexSet_walkSubgraph, hVK_eq] + +/-- Canonical spike of an `Ω`-path `P` in `S` along its ends `pathEnds S.G P`. -/ +def spikeOmegaPath (S : Society α β) (P : Graph α β) : Graph (α ⊕ α) (β ⊕ α) := + spikeGraph P (pathEnds S.G P) + +theorem spikeOmegaPath_eq (S : Society α β) {P : Graph α β} {a b : α} + (hP : S.IsOmegaPathWithEnds P a b) : + spikeOmegaPath S P = spikeGraph P {a, b} := by + dsimp [spikeOmegaPath] + rw [hP.1.pathEnds_eq] + +theorem vertexSet_spikeGraph_of_ends (S : Society α β) {P : Graph α β} {a b : α} + (hP : S.IsOmegaPathWithEnds P a b) : + V(spikeGraph P {a, b}) = (inlV '' V(P)) ∪ {inrV a, inrV b} := by + have ha : a ∈ V(P) := hP.1.left_mem + have hb : b ∈ V(P) := hP.1.right_mem + have h_inter : ({a, b} : Set α) ∩ V(P) = {a, b} := + inter_eq_left.mpr (by rintro x (rfl | rfl) <;> assumption) + dsimp [spikeGraph] + rw [h_inter, image_pair] + +theorem disjoint_spikeGraph_iff (S : Society α β) {P₁ P₂ : Graph α β} {a₁ b₁ a₂ b₂ : α} + (hP₁ : S.IsOmegaPathWithEnds P₁ a₁ b₁) (hP₂ : S.IsOmegaPathWithEnds P₂ a₂ b₂) : + Disjoint V(spikeGraph P₁ {a₁, b₁}) V(spikeGraph P₂ {a₂, b₂}) ↔ Disjoint V(P₁) V(P₂) := by + rw [vertexSet_spikeGraph_of_ends S hP₁, vertexSet_spikeGraph_of_ends S hP₂] + constructor + · intro hdisj + rw [disjoint_left] at hdisj ⊢ + intro u hu₁ hu₂ + exact hdisj (Or.inl ⟨u, hu₁, rfl⟩) (Or.inl ⟨u, hu₂, rfl⟩) + · intro hdisj + have ha₁ : a₁ ∈ V(P₁) := hP₁.1.left_mem + have hb₁ : b₁ ∈ V(P₁) := hP₁.1.right_mem + have ha₂ : a₂ ∈ V(P₂) := hP₂.1.left_mem + have hb₂ : b₂ ∈ V(P₂) := hP₂.1.right_mem + rw [disjoint_left] at hdisj ⊢ + rintro z (⟨u, hu₁, rfl⟩ | rfl | rfl) (⟨v, hu₂, h_eq⟩ | h_eq | h_eq) + · exact hdisj hu₁ (inlV_injective h_eq ▸ hu₂) + · exact Sum.inl_ne_inr h_eq + · exact Sum.inl_ne_inr h_eq + · exact Sum.inl_ne_inr h_eq + · exact hdisj ha₁ (inrV_injective h_eq ▸ ha₂) + · exact hdisj ha₁ (inrV_injective h_eq ▸ hb₂) + · exact Sum.inl_ne_inr h_eq + · exact hdisj hb₁ (inrV_injective h_eq ▸ ha₂) + · exact hdisj hb₁ (inrV_injective h_eq ▸ hb₂) + +theorem isSeparatingOmegaPath_spikeGraph (S : Society α β) {P : Graph α β} {a b : α} + (hP : S.IsOmegaPathWithEnds P a b) (hsep : S.IsSeparatingOmegaPath P) : + (Society.spiked S).IsSeparatingOmegaPath (spikeGraph P {a, b}) := by + have hP' := (isOmegaPathWithEnds_spikeGraph S hP).1 + refine ⟨⟨inrV a, inrV b, hP'⟩, ?_⟩ + rintro ⟨K, hdisj, s₁', t₁', s₂', t₂', hK_ends, hP''_ends, hcr'⟩ + rcases hK_ends.2.2.1 with ⟨s₁, hs₁_bar, rfl⟩ + rcases hK_ends.2.2.2 with ⟨t₁, ht₁_bar, rfl⟩ + obtain ⟨hP₀_ends, hVK_eq⟩ := isOmegaPathWithEnds_unspikeGraph S hK_ends + have hdisj₀ : Disjoint V(unspikeGraph S.G K) V(P) := by + rw [disjoint_left] at hdisj ⊢ + intro u hu₁ hu₂ + exact hdisj (by rw [hVK_eq]; exact Or.inl ⟨u, hu₁, rfl⟩) (Or.inl ⟨u, hu₂, rfl⟩) + rcases hP''_ends.ends_eq (Society.spiked S) hP' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hsep.2 ⟨unspikeGraph S.G K, hdisj₀, s₁, t₁, a, b, hP₀_ends, hP, + (S.Ω.mapInr_crosses_iff s₁ t₁ a b).mp hcr'⟩ + · exact hsep.2 ⟨unspikeGraph S.G K, hdisj₀, s₁, t₁, b, a, hP₀_ends, hP.symm S, + (S.Ω.mapInr_crosses_iff s₁ t₁ b a).mp hcr'⟩ + +theorem isFenceFor_spikeOmegaPath (S : Society α β) {P_set : Set (Graph α β)} {A B : Set α} + (hfence : S.IsFenceFor P_set A B) : + (Society.spiked S).IsFenceFor (spikeOmegaPath S '' P_set) (inrV '' A) (inrV '' B) ∧ + InjOn (spikeOmegaPath S) P_set ∧ + (Society.spiked S).transactionEnds (spikeOmegaPath S '' P_set) = + inrV '' S.transactionEnds P_set := by + obtain ⟨⟨hpaths, hdisj⟩, hAB, hends⟩ := hfence + have hinj : InjOn (spikeOmegaPath S) P_set := by + intro P₁ hP₁ P₂ hP₂ h_eq + by_contra hne + obtain ⟨a₁, _, b₁, _, hP₁_ab⟩ := hends P₁ hP₁ + obtain ⟨a₂, _, b₂, _, hP₂_ab⟩ := hends P₂ hP₂ + have hdisj' := (disjoint_spikeGraph_iff S hP₁_ab hP₂_ab).mpr (hdisj hP₁ hP₂ hne) + rw [← spikeOmegaPath_eq S hP₁_ab, ← spikeOmegaPath_eq S hP₂_ab, h_eq] at hdisj' + have hmem : inlV a₂ ∈ V(spikeOmegaPath S P₂) := by + rw [spikeOmegaPath_eq S hP₂_ab, vertexSet_spikeGraph_of_ends S hP₂_ab] + exact Or.inl ⟨a₂, hP₂_ab.1.left_mem, rfl⟩ + exact disjoint_left.mp hdisj' hmem hmem + have hfence' : (Society.spiked S).IsFenceFor (spikeOmegaPath S '' P_set) (inrV '' A) (inrV '' B) + := by + refine ⟨⟨?_, ?_⟩, (S.Ω.mapInr_isFence_iff).mpr hAB, ?_⟩ + · rintro _ ⟨P, hP, rfl⟩ + obtain ⟨a, _, b, _, hP_ab⟩ := hends P hP + rw [spikeOmegaPath_eq S hP_ab] + exact ⟨inrV a, inrV b, (isOmegaPathWithEnds_spikeGraph S hP_ab).1⟩ + · rintro _ ⟨P₁, hP₁, rfl⟩ _ ⟨P₂, hP₂, rfl⟩ hne + obtain ⟨a₁, _, b₁, _, hP₁_ab⟩ := hends P₁ hP₁ + obtain ⟨a₂, _, b₂, _, hP₂_ab⟩ := hends P₂ hP₂ + rw [spikeOmegaPath_eq S hP₁_ab, spikeOmegaPath_eq S hP₂_ab] + exact (disjoint_spikeGraph_iff S hP₁_ab hP₂_ab).mpr + (hdisj hP₁ hP₂ fun h => hne (congrArg (spikeOmegaPath S) h)) + · rintro _ ⟨P, hP, rfl⟩ + obtain ⟨a, ha, b, hb, hP_ab⟩ := hends P hP + rw [spikeOmegaPath_eq S hP_ab] + exact ⟨inrV a, mem_image_of_mem inrV ha, inrV b, mem_image_of_mem inrV hb, + (isOmegaPathWithEnds_spikeGraph S hP_ab).1⟩ + refine ⟨hfence', hinj, ?_⟩ + ext z + constructor + · rintro ⟨_, ⟨P, hP, rfl⟩, w, hP'_zw⟩ + obtain ⟨a, _, b, _, hP_ab⟩ := hends P hP + have hP'_ab : (Society.spiked S).IsOmegaPathWithEnds (spikeOmegaPath S P) (inrV a) (inrV b) + := by + rw [spikeOmegaPath_eq S hP_ab] + exact (isOmegaPathWithEnds_spikeGraph S hP_ab).1 + rcases hP'_ab.ends_eq (Society.spiked S) hP'_zw with ⟨rfl, _⟩ | ⟨rfl, _⟩ + · exact ⟨a, ⟨P, hP, b, hP_ab⟩, rfl⟩ + · exact ⟨b, ⟨P, hP, a, hP_ab.symm S⟩, rfl⟩ + · rintro ⟨a, ⟨P, hP, b, hP_ab⟩, rfl⟩ + refine ⟨spikeOmegaPath S P, mem_image_of_mem _ hP, inrV b, ?_⟩ + rw [spikeOmegaPath_eq S hP_ab] + exact (isOmegaPathWithEnds_spikeGraph S hP_ab).1 + +theorem isCrookedTransaction_spikeOmegaPath (S : Society α β) {P_set : Set (Graph α β)} + (hcr : S.IsCrookedTransaction P_set) : + (Society.spiked S).IsCrookedTransaction (spikeOmegaPath S '' P_set) ∧ + (spikeOmegaPath S '' P_set).ncard = P_set.ncard := by + obtain ⟨⟨A, B, hfence⟩, hno_periph⟩ := hcr + obtain ⟨hfence', hinj, hW_eq⟩ := isFenceFor_spikeOmegaPath S hfence + refine ⟨⟨⟨inrV '' A, inrV '' B, hfence'⟩, ?_⟩, hinj.ncard_image⟩ + rintro _ ⟨P, hP, rfl⟩ ⟨_, a', b', hP'_ab', hdisj_or⟩ + obtain ⟨a, _, b, _, hP_ab⟩ := hfence.2.2 P hP + have hP'_ab : (Society.spiked S).IsOmegaPathWithEnds (spikeOmegaPath S P) (inrV a) (inrV b) := by + rw [spikeOmegaPath_eq S hP_ab] + exact (isOmegaPathWithEnds_spikeGraph S hP_ab).1 + rcases hP'_ab.ends_eq (Society.spiked S) hP'_ab' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · apply hno_periph P hP ⟨hP, a, b, hP_ab, ?_⟩ + change Disjoint (S.Ω.mapInr.interval (inrV a) (inrV b)) _ ∨ + Disjoint (S.Ω.mapInr.interval (inrV b) (inrV a)) _ at hdisj_or + rw [S.Ω.mapInr_interval, S.Ω.mapInr_interval, hW_eq, + Set.disjoint_image_iff inrV_injective, Set.disjoint_image_iff inrV_injective] at hdisj_or + exact hdisj_or + · apply hno_periph P hP ⟨hP, b, a, hP_ab.symm S, ?_⟩ + change Disjoint (S.Ω.mapInr.interval (inrV b) (inrV a)) _ ∨ + Disjoint (S.Ω.mapInr.interval (inrV a) (inrV b)) _ at hdisj_or + rw [S.Ω.mapInr_interval, S.Ω.mapInr_interval, hW_eq, + Set.disjoint_image_iff inrV_injective, Set.disjoint_image_iff inrV_injective] at hdisj_or + exact hdisj_or + +theorem isCrookedTransaction_unspikeGraph (S : Society α β) + {P_set' : Set (Graph (α ⊕ α) (β ⊕ α))} + (hcr' : (Society.spiked S).IsCrookedTransaction P_set') : + S.IsCrookedTransaction (unspikeGraph S.G '' P_set') ∧ + (unspikeGraph S.G '' P_set').ncard = P_set'.ncard ∧ + (Society.spiked S).transactionEnds P_set' = + inrV '' S.transactionEnds (unspikeGraph S.G '' P_set') := by + obtain ⟨⟨A', B', ⟨hpaths', hdisj'⟩, hAB', hends'⟩, hno_periph'⟩ := hcr' + let A := inrV ⁻¹' A' + let B := inrV ⁻¹' B' + have hA'_eq : inrV '' A = A' := + image_preimage_eq_of_subset (hAB'.1.trans (image_subset_range inrV S.Ω.bar)) + have hB'_eq : inrV '' B = B' := + image_preimage_eq_of_subset (hAB'.2.1.trans (image_subset_range inrV S.Ω.bar)) + have hAB : S.Ω.IsFence A B := by + apply (S.Ω.mapInr_isFence_iff).mp + rwa [hA'_eq, hB'_eq] + have hdisj₀ : ∀ K₁ ∈ P_set', ∀ K₂ ∈ P_set', K₁ ≠ K₂ → + Disjoint V(unspikeGraph S.G K₁) V(unspikeGraph S.G K₂) := by + intro K₁ hK₁ K₂ hK₂ hne + obtain ⟨a₁', _, b₁', _, hK₁_ab'⟩ := hends' K₁ hK₁ + obtain ⟨a₂', _, b₂', _, hK₂_ab'⟩ := hends' K₂ hK₂ + rcases hK₁_ab'.2.2.1 with ⟨a₁, _, rfl⟩ + rcases hK₁_ab'.2.2.2 with ⟨b₁, _, rfl⟩ + rcases hK₂_ab'.2.2.1 with ⟨a₂, _, rfl⟩ + rcases hK₂_ab'.2.2.2 with ⟨b₂, _, rfl⟩ + obtain ⟨_, hVK₁⟩ := isOmegaPathWithEnds_unspikeGraph S hK₁_ab' + obtain ⟨_, hVK₂⟩ := isOmegaPathWithEnds_unspikeGraph S hK₂_ab' + have hd : Disjoint V(K₁) V(K₂) := hdisj' hK₁ hK₂ hne + rw [disjoint_left] at hd ⊢ + intro u hu₁ hu₂ + exact hd (by rw [hVK₁]; exact Or.inl ⟨u, hu₁, rfl⟩) (by rw [hVK₂]; exact Or.inl ⟨u, hu₂, rfl⟩) + have hinj : InjOn (unspikeGraph S.G) P_set' := by + intro K₁ hK₁ K₂ hK₂ h_eq + by_contra hne + obtain ⟨a₁', _, b₁', _, hK₁_ab'⟩ := hends' K₁ hK₁ + rcases hK₁_ab'.2.2.1 with ⟨a₁, _, rfl⟩ + rcases hK₁_ab'.2.2.2 with ⟨b₁, _, rfl⟩ + obtain ⟨hP₁_ab, _⟩ := isOmegaPathWithEnds_unspikeGraph S hK₁_ab' + have hmem : a₁ ∈ V(unspikeGraph S.G K₁) := hP₁_ab.1.left_mem + exact disjoint_left.mp (hdisj₀ K₁ hK₁ K₂ hK₂ hne) hmem (h_eq ▸ hmem) + have hfence : S.IsFenceFor (unspikeGraph S.G '' P_set') A B := by + refine ⟨⟨?_, ?_⟩, hAB, ?_⟩ + · rintro _ ⟨K, hK, rfl⟩ + obtain ⟨a', _, b', _, hK_ab'⟩ := hends' K hK + rcases hK_ab'.2.2.1 with ⟨a, _, rfl⟩ + rcases hK_ab'.2.2.2 with ⟨b, _, rfl⟩ + exact ⟨a, b, (isOmegaPathWithEnds_unspikeGraph S hK_ab').1⟩ + · rintro _ ⟨K₁, hK₁, rfl⟩ _ ⟨K₂, hK₂, rfl⟩ hne + exact hdisj₀ K₁ hK₁ K₂ hK₂ fun h => hne (congrArg (unspikeGraph S.G) h) + · rintro _ ⟨K, hK, rfl⟩ + obtain ⟨a', ha', b', hb', hK_ab'⟩ := hends' K hK + rcases hK_ab'.2.2.1 with ⟨a, _, rfl⟩ + rcases hK_ab'.2.2.2 with ⟨b, _, rfl⟩ + exact ⟨a, ha', b, hb', (isOmegaPathWithEnds_unspikeGraph S hK_ab').1⟩ + have hW_eq : (Society.spiked S).transactionEnds P_set' = + inrV '' S.transactionEnds (unspikeGraph S.G '' P_set') := by + ext z + constructor + · rintro ⟨K, hK, w, hK_zw⟩ + rcases hK_zw.2.2.1 with ⟨a, _, rfl⟩ + rcases hK_zw.2.2.2 with ⟨b, _, rfl⟩ + exact ⟨a, ⟨unspikeGraph S.G K, mem_image_of_mem _ hK, b, + (isOmegaPathWithEnds_unspikeGraph S hK_zw).1⟩, rfl⟩ + · rintro ⟨a, ⟨_, ⟨K, hK, rfl⟩, b, hP₀_ab⟩, rfl⟩ + obtain ⟨a', _, b', _, hK_ab'⟩ := hends' K hK + rcases hK_ab'.2.2.1 with ⟨a₀, _, rfl⟩ + rcases hK_ab'.2.2.2 with ⟨b₀, _, rfl⟩ + have hP₀_ab₀ := (isOmegaPathWithEnds_unspikeGraph S hK_ab').1 + rcases hP₀_ab₀.ends_eq S hP₀_ab with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨K, hK, inrV b, hK_ab'⟩ + · exact ⟨K, hK, inrV b, hK_ab'.symm (Society.spiked S)⟩ + refine ⟨⟨⟨A, B, hfence⟩, ?_⟩, hinj.ncard_image, hW_eq⟩ + rintro _ ⟨K, hK, rfl⟩ ⟨_, a, b, hP₀_ab, hdisj_or⟩ + obtain ⟨a', _, b', _, hK_ab'⟩ := hends' K hK + rcases hK_ab'.2.2.1 with ⟨a₀, _, rfl⟩ + rcases hK_ab'.2.2.2 with ⟨b₀, _, rfl⟩ + have hP₀_ab₀ := (isOmegaPathWithEnds_unspikeGraph S hK_ab').1 + rcases hP₀_ab₀.ends_eq S hP₀_ab with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · apply hno_periph' K hK ⟨hK, inrV a, inrV b, hK_ab', ?_⟩ + change Disjoint (S.Ω.mapInr.interval (inrV a) (inrV b)) _ ∨ + Disjoint (S.Ω.mapInr.interval (inrV b) (inrV a)) _ + rw [S.Ω.mapInr_interval, S.Ω.mapInr_interval, hW_eq, + Set.disjoint_image_iff inrV_injective, Set.disjoint_image_iff inrV_injective] + exact hdisj_or + · apply hno_periph' K hK ⟨hK, inrV a, inrV b, hK_ab'.symm (Society.spiked S), ?_⟩ + change Disjoint (S.Ω.mapInr.interval (inrV a) (inrV b)) _ ∨ + Disjoint (S.Ω.mapInr.interval (inrV b) (inrV a)) _ + rw [S.Ω.mapInr_interval, S.Ω.mapInr_interval, hW_eq, + Set.disjoint_image_iff inrV_injective, Set.disjoint_image_iff inrV_injective] + exact hdisj_or + +/-- Variant of `spikeGraph` with additional isolated pendant vertices `inrV z` for `z ∈ Z ∩ V(H)` +(used to include `inrV (a m), inrV (b m)` in `V(G₂')` without duplicating their spike edges). -/ +def spikeGraphWithVerts (H : Graph α β) (X Z : Set α) : Graph (α ⊕ α) (β ⊕ α) where + vertexSet := (inlV '' V(H)) ∪ (inrV '' ((X ∪ Z) ∩ V(H))) + edgeSet := (inlE '' E(H)) ∪ (inrE '' (X ∩ V(H))) + IsLink := SpikeIsLink H X + isLink_symm := (spikeGraph H X).isLink_symm + eq_or_eq_of_isLink_of_isLink := (spikeGraph H X).eq_or_eq_of_isLink_of_isLink + edge_mem_iff_exists_isLink := (spikeGraph H X).edge_mem_iff_exists_isLink + left_mem_of_isLink _ _ _ h := by + rcases h with ⟨hlink⟩ | ⟨hx⟩ | ⟨hx⟩ + · exact Or.inl ⟨_, hlink.left_mem, rfl⟩ + · exact Or.inl ⟨_, hx.2, rfl⟩ + · exact Or.inr ⟨_, ⟨Or.inl hx.1, hx.2⟩, rfl⟩ + +/-- Lift a transaction and a separation at a distinguished path to the spiked society. -/ +theorem Society.spikeTransactionAndSeparation (S : Society α β) {n p : ℕ} + {Q : Fin n → Graph α β} {a b : Fin n → α} (m : Fin n) + (hex_cr : ∃ P₀ : Set (Graph α β), S.IsCrookedTransaction P₀ ∧ p ≤ P₀.ncard) + (hinj_Q : Function.Injective Q) (htr_Q : S.IsTransaction (range Q)) + (hsep_Q : ∀ i, S.IsSeparatingOmegaPath (Q i)) + (hends_Q : ∀ i, S.IsOmegaPathWithEnds (Q i) (a i) (b i)) + (hcw : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) + {G₁ G₂ : Graph α β} (hsep_G : IsGraphSeparation S.G G₁ G₂) + (hinter_G : V(G₁) ∩ V(G₂) = V(Q m)) + (hint_G₁ : S.Ω.interval (a m) (b m) ⊆ V(G₁)) + (hint_G₂ : S.Ω.interval (b m) (a m) ⊆ V(G₂)) : + let S' := Society.spiked S + let Q' : Fin n → Graph (α ⊕ α) (β ⊕ α) := fun i => spikeOmegaPath S (Q i) + let a' : Fin n → α ⊕ α := inrV ∘ a + let b' : Fin n → α ⊕ α := inrV ∘ b + let X₁ := {a m, b m} ∪ S.Ω.interval (a m) (b m) + let X₂ := S.Ω.interval (b m) (a m) + let G₁' := spikeGraph G₁ X₁ + let G₂' := spikeGraphWithVerts G₂ X₂ {a m, b m} + (∃ P₀' : Set (Graph (α ⊕ α) (β ⊕ α)), + S'.IsCrookedTransaction P₀' ∧ p ≤ P₀'.ncard) ∧ + Function.Injective Q' ∧ S'.IsTransaction (range Q') ∧ + (∀ i, S'.IsSeparatingOmegaPath (Q' i)) ∧ + (∀ i, Disjoint (pathInternalVerts S'.G (Q' i)) S'.Ω.bar) ∧ + (∀ i, S'.IsOmegaPathWithEnds (Q' i) (a' i) (b' i)) ∧ + S'.Ω.IsClockwiseSeq ((List.ofFn a').reverse ++ List.ofFn b') ∧ + IsGraphSeparation S'.G G₁' G₂' ∧ V(G₁') ∩ V(G₂') = V(Q' m) ∧ + S'.Ω.interval (a' m) (b' m) ⊆ V(G₁') ∧ S'.Ω.interval (b' m) (a' m) ⊆ V(G₂') ∧ + (Q m ≤ G₁ → Q' m ≤ G₁') := by + intro S' Q' a' b' X₁ X₂ G₁' G₂' + have : Finite V(S'.G) := S'.finite_V + have : Finite E(S'.G) := S'.finite_E + obtain ⟨P₀, hcr_P₀, hp_P₀⟩ := hex_cr + obtain ⟨hcr_P₀', hcard_P₀'⟩ := isCrookedTransaction_spikeOmegaPath S hcr_P₀ + have hex_cr' : ∃ P₀' : Set (Graph (α ⊕ α) (β ⊕ α)), + S'.IsCrookedTransaction P₀' ∧ p ≤ P₀'.ncard := + ⟨spikeOmegaPath S '' P₀, hcr_P₀', hcard_P₀' ▸ hp_P₀⟩ + have hQ'_eq : ∀ i, Q' i = spikeGraph (Q i) {a i, b i} := + fun i => spikeOmegaPath_eq S (hends_Q i) + obtain ⟨A_Q, B_Q, hfence_Q⟩ := htr_Q + obtain ⟨hfence_Q', hinj_Q_on, _⟩ := isFenceFor_spikeOmegaPath S hfence_Q + have hrange_Q' : range Q' = spikeOmegaPath S '' range Q := + range_comp (spikeOmegaPath S) Q + have hinj_Q' : Function.Injective Q' := + fun i j hij => hinj_Q (hinj_Q_on (mem_range_self i) (mem_range_self j) hij) + have htr_Q' : S'.IsTransaction (range Q') := by + rw [hrange_Q'] + exact ⟨inrV '' A_Q, inrV '' B_Q, hfence_Q'⟩ + have hsep_Q' : ∀ i : Fin n, S'.IsSeparatingOmegaPath (Q' i) := by + intro i + rw [hQ'_eq i] + exact isSeparatingOmegaPath_spikeGraph S (hends_Q i) (hsep_Q i) + have hno_int' : ∀ i : Fin n, Disjoint (pathInternalVerts S'.G (Q' i)) S'.Ω.bar := by + intro i + rw [hQ'_eq i] + exact (isOmegaPathWithEnds_spikeGraph S (hends_Q i)).2 + have hends_Q' : ∀ i : Fin n, S'.IsOmegaPathWithEnds (Q' i) (a' i) (b' i) := by + intro i + rw [hQ'_eq i] + exact (isOmegaPathWithEnds_spikeGraph S (hends_Q i)).1 + have hcw' : S'.Ω.IsClockwiseSeq ((List.ofFn a').reverse ++ List.ofFn b') := by + have h_list : (List.ofFn a').reverse ++ List.ofFn b' = + ((List.ofFn a).reverse ++ List.ofFn b).map inrV := by + rw [List.map_append, List.map_reverse, List.map_ofFn, List.map_ofFn] + rw [h_list] + exact (S.Ω.mapInr_isClockwiseSeq_iff _).mpr hcw + have hm_ends := hends_Q m + have ha_m_Qm : a m ∈ V(Q m) := hm_ends.1.left_mem + have hb_m_Qm : b m ∈ V(Q m) := hm_ends.1.right_mem + have ha_m_G₁ : a m ∈ V(G₁) := (hinter_G ▸ ha_m_Qm : a m ∈ V(G₁) ∩ V(G₂)).1 + have hb_m_G₁ : b m ∈ V(G₁) := (hinter_G ▸ hb_m_Qm : b m ∈ V(G₁) ∩ V(G₂)).1 + have ha_m_G₂ : a m ∈ V(G₂) := (hinter_G ▸ ha_m_Qm : a m ∈ V(G₁) ∩ V(G₂)).2 + have hb_m_G₂ : b m ∈ V(G₂) := (hinter_G ▸ hb_m_Qm : b m ∈ V(G₁) ∩ V(G₂)).2 + have hfence_m : S.Ω.IsFence X₁ X₂ := + S.Ω.isFence_interval_compl hm_ends.2.2.1 hm_ends.2.2.2 hm_ends.2.1 + have hX₁_sub_G₁ : X₁ ⊆ V(G₁) := by + rintro x ((rfl | rfl) | hx) + · exact ha_m_G₁ + · exact hb_m_G₁ + · exact hint_G₁ hx + have hX₁_inter : X₁ ∩ V(G₁) = X₁ := inter_eq_left.mpr hX₁_sub_G₁ + have hX₂_inter : X₂ ∩ V(G₂) = X₂ := inter_eq_left.mpr hint_G₂ + have hX₂Z_inter : (X₂ ∪ {a m, b m}) ∩ V(G₂) = X₂ ∪ {a m, b m} := by + refine inter_eq_left.mpr ?_ + rintro x (hx | rfl | rfl) + · exact hint_G₂ hx + · exact ha_m_G₂ + · exact hb_m_G₂ + have hbar_inter : S.Ω.bar ∩ V(S.G) = S.Ω.bar := inter_eq_left.mpr S.bar_subset + have hG₁'_le : G₁' ≤ S'.G := + spikeGraph_le hsep_G.1 (by rw [hX₁_inter, hbar_inter]; exact hfence_m.1) + have hG₂'_le : G₂' ≤ S'.G := by + refine ⟨union_subset_union (image_mono hsep_G.2.1.vertexSet_mono) (image_mono ?_), ?_⟩ + · rw [hX₂Z_inter, hbar_inter] + rintro x (hx | rfl | rfl) + · exact hfence_m.2.1 hx + · exact hm_ends.2.2.1 + · exact hm_ends.2.2.2 + · intro e x y h + rcases h with ⟨hlink⟩ | ⟨hx⟩ | ⟨hx⟩ + · exact .inl (hlink.mono hsep_G.2.1) + · exact .inr_lr ⟨hfence_m.2.1 hx.1, hsep_G.2.1.vertexSet_mono hx.2⟩ + · exact .inr_rl ⟨hfence_m.2.1 hx.1, hsep_G.2.1.vertexSet_mono hx.2⟩ + have hsep_G' : IsGraphSeparation S'.G G₁' G₂' := by + refine ⟨hG₁'_le, hG₂'_le, ?_, ?_, ?_⟩ + · change ((inlV '' V(G₁)) ∪ (inrV '' (X₁ ∩ V(G₁)))) ∪ + ((inlV '' V(G₂)) ∪ (inrV '' ((X₂ ∪ {a m, b m}) ∩ V(G₂)))) = + (inlV '' V(S.G)) ∪ (inrV '' (S.Ω.bar ∩ V(S.G))) + rw [hX₁_inter, hX₂Z_inter, hbar_inter, union_union_union_comm, ← image_union, ← image_union, + hsep_G.2.2.1] + congr 2 + apply Subset.antisymm + · rintro x (hx₁ | hx₂ | rfl | rfl) + · exact hfence_m.1 hx₁ + · exact hfence_m.2.1 hx₂ + · exact hm_ends.2.2.1 + · exact hm_ends.2.2.2 + · intro x hx + rw [← hfence_m.2.2.2.1] at hx + rcases hx with hx₁ | hx₂ + · exact Or.inl hx₁ + · exact Or.inr (Or.inl hx₂) + · change ((inlE '' E(G₁)) ∪ (inrE '' (X₁ ∩ V(G₁)))) ∪ + ((inlE '' E(G₂)) ∪ (inrE '' (X₂ ∩ V(G₂)))) = + (inlE '' E(S.G)) ∪ (inrE '' (S.Ω.bar ∩ V(S.G))) + rw [hX₁_inter, hX₂_inter, hbar_inter, union_union_union_comm, ← image_union, ← image_union, + hsep_G.2.2.2.1, hfence_m.2.2.2.1] + · change Disjoint ((inlE '' E(G₁)) ∪ (inrE '' (X₁ ∩ V(G₁)))) + ((inlE '' E(G₂)) ∪ (inrE '' (X₂ ∩ V(G₂)))) + rw [hX₁_inter, hX₂_inter] + rw [disjoint_left] + rintro e (⟨e₁, he₁, rfl⟩ | ⟨x₁, hx₁, rfl⟩) (⟨e₂, he₂, h_eq⟩ | ⟨x₂, hx₂, h_eq⟩) + · exact disjoint_left.mp hsep_G.2.2.2.2 he₁ (inlE_injective h_eq ▸ he₂) + · exact Sum.inl_ne_inr h_eq.symm + · exact Sum.inl_ne_inr h_eq + · exact disjoint_left.mp hfence_m.2.2.1 hx₁ (inrE_injective h_eq ▸ hx₂) + have hinter_G' : V(G₁') ∩ V(G₂') = V(Q' m) := by + rw [hQ'_eq m, vertexSet_spikeGraph_of_ends S hm_ends] + change ((inlV '' V(G₁)) ∪ (inrV '' (X₁ ∩ V(G₁)))) ∩ + ((inlV '' V(G₂)) ∪ (inrV '' ((X₂ ∪ {a m, b m}) ∩ V(G₂)))) = + (inlV '' V(Q m)) ∪ {inrV (a m), inrV (b m)} + rw [hX₁_inter, hX₂Z_inter] + ext z + rcases z with u | v + · simp only [mem_inter_iff, mem_union, inlV_injective.mem_set_image, mem_image, + Sum.inr_ne_inl, and_false, exists_false, or_false, mem_insert_iff, mem_singleton_iff, + Sum.inl_ne_inr] + rw [← mem_inter_iff, hinter_G] + · simp only [mem_inter_iff, mem_union, inrV_injective.mem_set_image, mem_image, + Sum.inl_ne_inr, and_false, exists_false, false_or, mem_insert_iff, mem_singleton_iff, + inrV_injective.eq_iff] + constructor + · rintro ⟨hv₁ | hv₁, hv₂ | hv₂⟩ + · exact hv₁ + · exact hv₁ + · exact (disjoint_left.mp hfence_m.2.2.1 (Or.inr hv₁) hv₂).elim + · exact hv₂ + · rintro (rfl | rfl) + · exact ⟨Or.inl (Or.inl rfl), Or.inr (Or.inl rfl)⟩ + · exact ⟨Or.inl (Or.inr rfl), Or.inr (Or.inr rfl)⟩ + have hint_G₁' : S'.Ω.interval (a' m) (b' m) ⊆ V(G₁') := by + change S.Ω.mapInr.interval (inrV (a m)) (inrV (b m)) ⊆ + (inlV '' V(G₁)) ∪ (inrV '' (X₁ ∩ V(G₁))) + rw [S.Ω.mapInr_interval, hX₁_inter] + exact subset_union_of_subset_right (image_mono subset_union_right) _ + have hint_G₂' : S'.Ω.interval (b' m) (a' m) ⊆ V(G₂') := by + change S.Ω.mapInr.interval (inrV (b m)) (inrV (a m)) ⊆ + (inlV '' V(G₂)) ∪ (inrV '' ((X₂ ∪ {a m, b m}) ∩ V(G₂))) + rw [S.Ω.mapInr_interval, hX₂Z_inter] + exact subset_union_of_subset_right (image_mono subset_union_left) _ + refine ⟨hex_cr', hinj_Q', htr_Q', hsep_Q', hno_int', hends_Q', hcw', hsep_G', hinter_G', + hint_G₁', hint_G₂', fun hQ_le => ?_⟩ + rw [hQ'_eq m] + refine spikeGraph_le hQ_le ?_ + rintro x ⟨rfl | rfl, _⟩ + · exact ⟨Or.inl (Or.inl rfl), ha_m_G₁⟩ + · exact ⟨Or.inl (Or.inr rfl), hb_m_G₁⟩ + +/-- **(5.2) without `hno_int`**: deduced from `Society.theorem_5_2_proof` applied to `Society.spiked +S`. -/ +theorem Society.theorem_5_2_without_no_internal (S : Society α β) {p : ℕ} (hp2 : 2 ≤ p) + (hp3 : p ≠ 3) + (hex_cr : ∃ P₀ : Set (Graph α β), S.IsCrookedTransaction P₀ ∧ p ≤ P₀.ncard) + {Q : Fin (p + 4) → Graph α β} {a b : Fin (p + 4) → α} + (hinj_Q : Function.Injective Q) + (htr_Q : S.IsTransaction (range Q)) + (hsep_Q : ∀ i : Fin (p + 4), S.IsSeparatingOmegaPath (Q i)) + (hends_Q : ∀ i : Fin (p + 4), S.IsOmegaPathWithEnds (Q i) (a i) (b i)) + (hcw : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) + {G₁ G₂ : Graph α β} (hsep_G : IsGraphSeparation S.G G₁ G₂) + (hinter_G : V(G₁) ∩ V(G₂) = V(Q ⟨p + 3, by omega⟩)) + (hint_G₁ : S.Ω.interval (a ⟨p + 3, by omega⟩) (b ⟨p + 3, by omega⟩) ⊆ V(G₁)) + (hint_G₂ : S.Ω.interval (b ⟨p + 3, by omega⟩) (a ⟨p + 3, by omega⟩) ⊆ V(G₂)) : + (∃ P₁ P₂ : Graph α β, S.OmegaPathsCross P₁ P₂ ∧ + Disjoint V(P₁) V(G₂) ∧ Disjoint V(P₂) V(G₂)) ∨ + (∃ P_set : Set (Graph α β), S.IsCrookedTransaction P_set ∧ P_set.ncard = p ∧ + Disjoint (S.Ω.interval (a ⟨0, by omega⟩) (b ⟨0, by omega⟩)) (S.transactionEnds P_set)) := by + let S' := Society.spiked S + have : Finite V(S'.G) := S'.finite_V + have : Finite E(S'.G) := S'.finite_E + let m : Fin (p + 4) := ⟨p + 3, by omega⟩ + let Q' : Fin (p + 4) → Graph (α ⊕ α) (β ⊕ α) := fun i => spikeOmegaPath S (Q i) + let a' : Fin (p + 4) → α ⊕ α := inrV ∘ a + let b' : Fin (p + 4) → α ⊕ α := inrV ∘ b + let G₁' := spikeGraph G₁ ({a m, b m} ∪ S.Ω.interval (a m) (b m)) + let G₂' := spikeGraphWithVerts G₂ (S.Ω.interval (b m) (a m)) {a m, b m} + obtain ⟨hex_cr', hinj_Q', htr_Q', hsep_Q', hno_int', hends_Q', hcw', hsep_G', hinter_G', + hint_G₁', hint_G₂', -⟩ := + S.spikeTransactionAndSeparation m hex_cr hinj_Q htr_Q hsep_Q hends_Q hcw + hsep_G hinter_G hint_G₁ hint_G₂ + rcases S'.theorem_5_2_proof hp2 hp3 hex_cr' hinj_Q' htr_Q' hsep_Q' hno_int' hends_Q' hcw' + hsep_G' hinter_G' hint_G₁' hint_G₂' with + ⟨K₁, K₂, ⟨hdisj_K12, s₁', t₁', s₂', t₂', hK₁_ends, hK₂_ends, hcr_K12⟩, hd_K₁, hd_K₂⟩ | + ⟨P_set', hcr_P', hcard_P', hdisj_P'⟩ + · left + rcases hK₁_ends.2.2.1 with ⟨s₁, _, rfl⟩ + rcases hK₁_ends.2.2.2 with ⟨t₁, _, rfl⟩ + rcases hK₂_ends.2.2.1 with ⟨s₂, _, rfl⟩ + rcases hK₂_ends.2.2.2 with ⟨t₂, _, rfl⟩ + obtain ⟨hP₁_ends, hVK₁⟩ := isOmegaPathWithEnds_unspikeGraph S hK₁_ends + obtain ⟨hP₂_ends, hVK₂⟩ := isOmegaPathWithEnds_unspikeGraph S hK₂_ends + refine ⟨unspikeGraph S.G K₁, unspikeGraph S.G K₂, ⟨?_, s₁, t₁, s₂, t₂, hP₁_ends, hP₂_ends, + (S.Ω.mapInr_crosses_iff s₁ t₁ s₂ t₂).mp hcr_K12⟩, ?_, ?_⟩ + · rw [disjoint_left] at hdisj_K12 ⊢ + intro u hu₁ hu₂ + exact hdisj_K12 (by rw [hVK₁]; exact Or.inl ⟨u, hu₁, rfl⟩) + (by rw [hVK₂]; exact Or.inl ⟨u, hu₂, rfl⟩) + · rw [disjoint_left] at hd_K₁ ⊢ + intro u hu₁ hu₂ + exact hd_K₁ (by rw [hVK₁]; exact Or.inl ⟨u, hu₁, rfl⟩) (Or.inl ⟨u, hu₂, rfl⟩) + · rw [disjoint_left] at hd_K₂ ⊢ + intro u hu₁ hu₂ + exact hd_K₂ (by rw [hVK₂]; exact Or.inl ⟨u, hu₁, rfl⟩) (Or.inl ⟨u, hu₂, rfl⟩) + · right + obtain ⟨hcr_P, hcard_P, hW_eq⟩ := isCrookedTransaction_unspikeGraph S hcr_P' + refine ⟨unspikeGraph S.G '' P_set', hcr_P, hcard_P.trans hcard_P', ?_⟩ + let i₀ : Fin (p + 4) := ⟨0, by omega⟩ + change Disjoint (S.Ω.mapInr.interval (inrV (a i₀)) (inrV (b i₀))) _ at hdisj_P' + rwa [S.Ω.mapInr_interval, hW_eq, Set.disjoint_image_iff inrV_injective] at hdisj_P' + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section10c.lean b/LeanPool/GraphMinor/GM09/Section10c.lean new file mode 100644 index 0000000000..ceff6df6bc --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section10c.lean @@ -0,0 +1,468 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Section10b +public import LeanPool.GraphMinor.GM09.ArcSides + +/-! +# Graph Minors IX, (10.2): tools + +A separation of a drawn graph from the two sides of an arc, and the two open arcs of an `O`-arc +between two of its points. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- The open edge `e` has no point in `V(Γ)`. -/ +theorem graphDrawingEdgeSet_subset_sdiff_V {G : Graph α β} (Γ : GraphDrawing G EuclideanPlane) + {e : β} (he : e ∈ E(G)) : graphDrawingEdgeSet Γ e ⊆ Γ.drawing.U \ Γ.drawing.V := by + rw [graphDrawingEdgeSet_eq Γ he] + exact (Γ.iso.edgeEquiv ⟨e, he⟩).2.2.1 + +/-- The open edge `e` lies off the drawing of any subgraph that does not contain `e`. -/ +theorem disjoint_graphDrawingEdgeSet_subgraphU {G Q : Graph α β} (Γ : GraphDrawing G EuclideanPlane) + (hQ : Q ≤ G) {e : β} (he : e ∈ E(G)) (heQ : e ∉ E(Q)) : + Disjoint (graphDrawingEdgeSet Γ e) (graphDrawingSubgraphU Γ Q) := by + rw [Set.disjoint_left] + intro x hxe hxU + have hP := singleEdgeSubgraph_le G e + have hd : Disjoint E(Q) E(singleEdgeSubgraph G e) := by + rw [edgeSet_singleEdgeSubgraph he, Set.disjoint_singleton_right] + exact heQ + have hmem : x ∈ graphDrawingSubgraphU Γ Q ∩ graphDrawingSubgraphU Γ (singleEdgeSubgraph G e) := + ⟨hxU, graphDrawingEdgeSet_subset_subgraphU_of_mem Γ + (by rw [edgeSet_singleEdgeSubgraph he]; rfl) hxe⟩ + rw [graphDrawingSubgraphU_inter_of_disjoint_edgeSet Γ hQ hP hd] at hmem + obtain ⟨v, ⟨hv, -⟩, hxv⟩ := mem_iUnion₂.mp hmem + rw [graphDrawingVertexSet_eq_singleton Γ (hQ.vertexSet_mono hv)] at hxv + exact (graphDrawingEdgeSet_subset_sdiff_V Γ he hxe).2 + (hxv ▸ (Γ.iso.vertexEquiv ⟨v, hQ.vertexSet_mono hv⟩).2) + +theorem isPreconnected_graphDrawingEdgeSet {G : Graph α β} (Γ : GraphDrawing G EuclideanPlane) + {e : β} (he : e ∈ E(G)) : IsPreconnected (graphDrawingEdgeSet Γ e) := by + rw [graphDrawingEdgeSet_eq Γ he] + exact (Γ.iso.edgeEquiv ⟨e, he⟩).2.2.2.1.isConnected.isPreconnected + +/-- A drawn vertex outside `Q` is off the drawing of `Q`. -/ +theorem disjoint_graphDrawingVertexSet_subgraphU {G Q : Graph α β} + (Γ : GraphDrawing G EuclideanPlane) (hQ : Q ≤ G) {v : α} (hv : v ∈ V(G)) (hvQ : v ∉ V(Q)) : + Disjoint (graphDrawingVertexSet Γ v) (graphDrawingSubgraphU Γ Q) := by + rw [Set.disjoint_left] + intro x hx hxU + rw [graphDrawingVertexSet_eq_singleton Γ hv] at hx + have hxV : x ∈ Γ.drawing.V := hx ▸ (Γ.iso.vertexEquiv ⟨v, hv⟩).2 + obtain ⟨w, hw, hxw⟩ := graphDrawingSubgraphU_inter_V Γ hQ hxU hxV + have : v = w := graphDrawingVertexSet_inj Γ + (by rw [graphDrawingVertexSet_eq_singleton Γ hv]; exact hx) hxw + exact hvQ (this ▸ hw) + +/-- A separation of a drawn graph from the two sides of a subgraph drawn as an arc. -/ +theorem exists_separation_of_sides {G Q : Graph α β} (Γ : GraphDrawing G EuclideanPlane) + {Δ Y₁ Y₂ I₁ I₂ : Set EuclideanPlane} (hU : Γ.drawing.U ⊆ Δ) (hQ : Q ≤ G) + (hs : IsArcSides Δ (graphDrawingSubgraphU Γ Q) I₁ I₂ Y₁ Y₂) : + ∃ G₁ G₂ : Graph α β, IsGraphSeparation G G₁ G₂ ∧ V(G₁) ∩ V(G₂) = V(Q) ∧ Q ≤ G₁ ∧ + (∀ v ∈ V(G), graphDrawingVertexSet Γ v ⊆ Y₁ → v ∈ V(G₁)) ∧ + (∀ v ∈ V(G), graphDrawingVertexSet Γ v ⊆ Y₂ → v ∈ V(G₂)) ∧ + (∀ v ∈ V(G₁), v ∈ V(Q) ∨ graphDrawingVertexSet Γ v ⊆ Y₁) ∧ + (∀ v ∈ V(G₂), v ∈ V(Q) ∨ graphDrawingVertexSet Γ v ⊆ Y₂) ∧ + (∀ e ∈ E(G₁), e ∈ E(Q) ∨ graphDrawingEdgeSet Γ e ⊆ Y₁) ∧ + (∀ e ∈ E(G₂), graphDrawingEdgeSet Γ e ⊆ Y₂) := by + classical + have hVU : ∀ v ∈ V(G), graphDrawingVertexSet Γ v ⊆ Δ := by + intro v hv + rw [graphDrawingVertexSet_eq_singleton Γ hv, singleton_subset_iff] + exact hU (Γ.drawing.V_subset_U (Γ.iso.vertexEquiv ⟨v, hv⟩).2) + have hEU : ∀ e ∈ E(G), graphDrawingEdgeSet Γ e ⊆ Δ := fun e he => + (graphDrawingEdgeSet_subset_sdiff_V Γ he).trans (sdiff_subset.trans hU) + have hVside : ∀ v ∈ V(G), v ∉ V(Q) → + graphDrawingVertexSet Γ v ⊆ Y₁ ∨ graphDrawingVertexSet Γ v ⊆ Y₂ := by + intro v hv hvQ + refine hs.conn _ (fun x hx => ⟨hVU v hv hx, Set.disjoint_left.mp + (disjoint_graphDrawingVertexSet_subgraphU Γ hQ hv hvQ) hx⟩) ?_ + rw [graphDrawingVertexSet_eq_singleton Γ hv] + exact isPreconnected_singleton + have hEsub : ∀ e ∈ E(G), e ∉ E(Q) → graphDrawingEdgeSet Γ e ⊆ Δ \ graphDrawingSubgraphU Γ Q := + fun e he heQ x hx => ⟨hEU e he hx, Set.disjoint_left.mp + (disjoint_graphDrawingEdgeSet_subgraphU Γ hQ he heQ) hx⟩ + have hEside : ∀ e ∈ E(G), e ∉ E(Q) → + graphDrawingEdgeSet Γ e ⊆ Y₁ ∨ graphDrawingEdgeSet Γ e ⊆ Y₂ := fun e he heQ => + hs.conn _ (hEsub e he heQ) (isPreconnected_graphDrawingEdgeSet Γ he) + have hne : ∀ {X : Set EuclideanPlane}, X.Nonempty → X ⊆ Y₁ → X ⊆ Y₂ → False := by + rintro X ⟨x, hx⟩ h₁ h₂ + exact Set.disjoint_left.mp hs.disj (h₁ hx) (h₂ hx) + have hend : ∀ {e : β} {x y : α}, G.IsLink e x y → e ∉ E(Q) → x ∉ V(Q) → + (∀ {Y Y' : Set EuclideanPlane}, (Y = Y₁ ∧ Y' = Y₂ ∨ Y = Y₂ ∧ Y' = Y₁) → + graphDrawingEdgeSet Γ e ⊆ Y → graphDrawingVertexSet Γ x ⊆ Y) := by + intro e x y hl heQ hxQ Y Y' hY hsub + have hxG := hl.left_mem + have he := hl.edge_mem + have hcl := graphDrawingVertexSet_subset_closure_edge Γ hl + have hp : IsPreconnected (graphDrawingEdgeSet Γ e ∪ graphDrawingVertexSet Γ x) := + (isPreconnected_graphDrawingEdgeSet Γ he).subset_closure subset_union_left + (union_subset subset_closure hcl) + have hZ : graphDrawingEdgeSet Γ e ∪ graphDrawingVertexSet Γ x ⊆ + Δ \ graphDrawingSubgraphU Γ Q := by + refine union_subset (hEsub e he heQ) fun z hz => ⟨hVU x hxG hz, Set.disjoint_left.mp + (disjoint_graphDrawingVertexSet_subgraphU Γ hQ hxG hxQ) hz⟩ + rcases hs.conn _ hZ hp with h' | h' <;> rcases hY with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact subset_union_right.trans h' + · exact (hne (graphDrawingEdgeSet_nonempty Γ he) (subset_union_left.trans h') hsub).elim + · exact (hne (graphDrawingEdgeSet_nonempty Γ he) hsub (subset_union_left.trans h')).elim + · exact subset_union_right.trans h' + let V₁ : Set α := {v ∈ V(G) | v ∈ V(Q) ∨ graphDrawingVertexSet Γ v ⊆ Y₁} + let V₂ : Set α := {v ∈ V(G) | v ∈ V(Q) ∨ graphDrawingVertexSet Γ v ⊆ Y₂} + let E₁ : Set β := {e | e ∈ E(Q) ∨ graphDrawingEdgeSet Γ e ⊆ Y₁} + let E₂ : Set β := {e | e ∉ E(Q) ∧ graphDrawingEdgeSet Γ e ⊆ Y₂} + have hV₁ : V₁ ⊆ V(G) := fun v hv => hv.1 + have hV₂ : V₂ ⊆ V(G) := fun v hv => hv.1 + let G₁ := (G.induce V₁).restrict E₁ + let G₂ := (G.induce V₂).restrict E₂ + have hG₁ : G₁ ≤ G := restrict_le.trans (G.induce_le hV₁) + have hG₂ : G₂ ≤ G := restrict_le.trans (G.induce_le hV₂) + have hVG₁ : V(G₁) = V₁ := rfl + have hVG₂ : V(G₂) = V₂ := rfl + have hend₁ : ∀ e ∈ E₁, e ∈ E(G) → ∀ x y, G.IsLink e x y → x ∈ V₁ ∧ y ∈ V₁ := by + intro e he₁ heG x y hl + by_cases heQ : e ∈ E(Q) + · obtain ⟨u, v, huv⟩ := Q.exists_isLink_of_mem_edgeSet heQ + have hmem : ∀ z, z = u ∨ z = v → z ∈ V(Q) := by + rintro z (rfl | rfl) + · exact huv.left_mem + · exact huv.right_mem + exact ⟨⟨hl.left_mem, Or.inl (hmem x (hl.left_eq_or_eq (huv.mono hQ)))⟩, + ⟨hl.right_mem, Or.inl (hmem y (hl.symm.left_eq_or_eq (huv.mono hQ)))⟩⟩ + · have hsub : graphDrawingEdgeSet Γ e ⊆ Y₁ := he₁.resolve_left heQ + refine ⟨⟨hl.left_mem, ?_⟩, ⟨hl.right_mem, ?_⟩⟩ + · by_cases hx : x ∈ V(Q) + · exact Or.inl hx + · exact Or.inr (hend hl heQ hx (Or.inl ⟨rfl, rfl⟩) hsub) + · by_cases hx : y ∈ V(Q) + · exact Or.inl hx + · exact Or.inr (hend hl.symm heQ hx (Or.inl ⟨rfl, rfl⟩) hsub) + have hend₂ : ∀ e ∈ E₂, e ∈ E(G) → ∀ x y, G.IsLink e x y → x ∈ V₂ ∧ y ∈ V₂ := by + rintro e ⟨heQ, hsub⟩ heG x y hl + refine ⟨⟨hl.left_mem, ?_⟩, ⟨hl.right_mem, ?_⟩⟩ + · by_cases hx : x ∈ V(Q) + · exact Or.inl hx + · exact Or.inr (hend hl heQ hx (Or.inr ⟨rfl, rfl⟩) hsub) + · by_cases hx : y ∈ V(Q) + · exact Or.inl hx + · exact Or.inr (hend hl.symm heQ hx (Or.inr ⟨rfl, rfl⟩) hsub) + have hEG₁ : E(G₁) = E(G) ∩ E₁ := by + apply Subset.antisymm + · intro e he + exact ⟨hG₁.edgeSet_mono he, he.2⟩ + · rintro e ⟨heG, he⟩ + obtain ⟨x, y, hl⟩ := G.exists_isLink_of_mem_edgeSet heG + obtain ⟨h₁, h₂⟩ := hend₁ e he heG x y hl + exact ⟨by rw [edgeSet_induce]; exact ⟨x, y, hl, h₁, h₂⟩, he⟩ + have hEG₂ : E(G₂) = E(G) ∩ E₂ := by + apply Subset.antisymm + · intro e he + exact ⟨hG₂.edgeSet_mono he, he.2⟩ + · rintro e ⟨heG, he⟩ + obtain ⟨x, y, hl⟩ := G.exists_isLink_of_mem_edgeSet heG + obtain ⟨h₁, h₂⟩ := hend₂ e he heG x y hl + exact ⟨by rw [edgeSet_induce]; exact ⟨x, y, hl, h₁, h₂⟩, he⟩ + refine ⟨G₁, G₂, ⟨hG₁, hG₂, ?_, ?_, ?_⟩, ?_, ?_, ?_, ?_, fun v hv => hv.2, fun v hv => hv.2, + fun e he => he.2, fun e he => he.2.2⟩ + · rw [hVG₁, hVG₂] + apply Subset.antisymm (union_subset hV₁ hV₂) + intro v hv + by_cases hvQ : v ∈ V(Q) + · exact Or.inl ⟨hv, Or.inl hvQ⟩ + · rcases hVside v hv hvQ with h' | h' + · exact Or.inl ⟨hv, Or.inr h'⟩ + · exact Or.inr ⟨hv, Or.inr h'⟩ + · rw [hEG₁, hEG₂] + apply Subset.antisymm (union_subset inter_subset_left inter_subset_left) + intro e he + by_cases heQ : e ∈ E(Q) + · exact Or.inl ⟨he, Or.inl heQ⟩ + · rcases hEside e he heQ with h' | h' + · exact Or.inl ⟨he, Or.inr h'⟩ + · exact Or.inr ⟨he, heQ, h'⟩ + · rw [hEG₁, hEG₂, Set.disjoint_left] + rintro e ⟨heG, he₁⟩ ⟨-, heQ, h₂⟩ + exact hne (graphDrawingEdgeSet_nonempty Γ heG) (he₁.resolve_left heQ) h₂ + · rw [hVG₁, hVG₂] + apply Subset.antisymm + · rintro v ⟨⟨hv, h₁⟩, ⟨-, h₂⟩⟩ + by_contra hvQ + exact hne (graphDrawingVertexSet_nonempty Γ hv) (h₁.resolve_left hvQ) (h₂.resolve_left hvQ) + · intro v hv + exact ⟨⟨hQ.vertexSet_mono hv, Or.inl hv⟩, ⟨hQ.vertexSet_mono hv, Or.inl hv⟩⟩ + · rw [(Compatible.of_le_le hQ hG₁).le_iff, hVG₁, hEG₁] + exact ⟨fun v hv => ⟨hQ.vertexSet_mono hv, Or.inl hv⟩, + fun e he => ⟨hQ.edgeSet_mono he, Or.inl he⟩⟩ + · exact fun v hv h => ⟨hv, Or.inr h⟩ + · exact fun v hv h => ⟨hv, Or.inr h⟩ + +theorem eq_of_circleExp_eq {c x y : ℝ} (hx : x ∈ Ico c (c + 2 * Real.pi)) + (hy : y ∈ Ico c (c + 2 * Real.pi)) (h : Circle.exp x = Circle.exp y) : x = y := + Circle.exp_injOn_Ico (a := c) (b := c + 2 * Real.pi) (by simp) hx hy h + +theorem exists_mem_Ico_circleExp (c : ℝ) (z : Circle) : + ∃ t ∈ Ico c (c + 2 * Real.pi), Circle.exp t = z := + GraphMinor.Surface.exists_circleExp_mem_Ico c z + +/-- The two open arcs of an `O`-arc `C` between two distinct points `a, b`, read off from a +parametrisation `φ`. A point between `a` and `b` in the sense of `φ` lies in `I₁`, and a point +between `b` and `a` lies in `I₂`. -/ +theorem exists_open_arcs {C : Set EuclideanPlane} (φ : Circle ≃ₜ C) {a b : EuclideanPlane} + (ha : a ∈ C) (hb : b ∈ C) (hab : a ≠ b) : + ∃ I₁ I₂ : Set EuclideanPlane, IsPreconnected I₁ ∧ IsPreconnected I₂ ∧ Disjoint I₁ I₂ ∧ + I₁ ∪ I₂ = C \ {a, b} ∧ + (∀ t₁ t₂ t₃ : ℝ, t₁ < t₂ → t₂ < t₃ → t₃ < t₁ + 2 * Real.pi → + (φ (Circle.exp t₁)).1 = a → (φ (Circle.exp t₃)).1 = b → (φ (Circle.exp t₂)).1 ∈ I₁) ∧ + (∀ t₁ t₂ t₃ : ℝ, t₁ < t₂ → t₂ < t₃ → t₃ < t₁ + 2 * Real.pi → + (φ (Circle.exp t₁)).1 = b → (φ (Circle.exp t₃)).1 = a → (φ (Circle.exp t₂)).1 ∈ I₂) ∧ + IsLineWithEnds (I₁ ∪ {a, b}) a b ∧ IsLineWithEnds (I₂ ∪ {a, b}) b a := by + have hpi := Real.pi_pos + let f : ℝ → EuclideanPlane := fun t => (φ (Circle.exp t)).1 + have hf : Continuous f := + continuous_subtype_val.comp (φ.continuous.comp Circle.exp.continuous) + have hf_exp : ∀ {s t : ℝ}, f s = f t → Circle.exp s = Circle.exp t := fun h => + φ.injective (Subtype.ext h) + obtain ⟨ta, -, hta⟩ := exists_mem_Ico_circleExp 0 (φ.symm ⟨a, ha⟩) + obtain ⟨tb, htb, htb'⟩ := exists_mem_Ico_circleExp ta (φ.symm ⟨b, hb⟩) + have hfa : f ta = a := by simp [f, hta] + have hfb : f tb = b := by simp [f, htb'] + have hab' : ta ≠ tb := fun e => hab (by rw [← hfa, ← hfb, e]) + have htb1 : ta < tb := lt_of_le_of_ne htb.1 hab' + have hfa2 : f (ta + 2 * Real.pi) = a := by + simp only [f, Circle.exp_add_two_pi] + exact hfa + have shift : ∀ {t u : ℝ}, Circle.exp t = Circle.exp u → ∃ m : ℤ, t = u + m * (2 * Real.pi) ∧ + ∀ s : ℝ, f (s - m * (2 * Real.pi)) = f s := by + intro t u h + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h + refine ⟨m, hm, fun s => ?_⟩ + have : Circle.exp (s - m * (2 * Real.pi)) = Circle.exp s := + Circle.exp_eq_exp.mpr ⟨-m, by push_cast; ring⟩ + simp only [f, this] + have key : ∀ s₀ s₁ : ℝ, s₀ < s₁ → s₁ < s₀ + 2 * Real.pi → + IsLineWithEnds (f '' Ioo s₀ s₁ ∪ {f s₀, f s₁}) (f s₀) (f s₁) := by + intro s₀ s₁ h₀ h₁ + let e : unitInterval → EuclideanPlane := fun s => f (s₀ + s * (s₁ - s₀)) + have hpos : 0 < s₁ - s₀ := by linarith + have hmem : ∀ s : unitInterval, s₀ + s * (s₁ - s₀) ∈ Ico s₀ (s₀ + 2 * Real.pi) := by + intro s + have h₂ := s.2.1 + have h₃ := s.2.2 + have h₄ : (s : ℝ) * (s₁ - s₀) ≤ 1 * (s₁ - s₀) := by gcongr + constructor <;> nlinarith + have hearc : IsArcMap e := by + refine ⟨hf.comp (by fun_prop), fun s u h => ?_⟩ + have := eq_of_circleExp_eq (hmem s) (hmem u) (hf_exp h) + have h' : (s : ℝ) * (s₁ - s₀) = u * (s₁ - s₀) := by linarith + exact Subtype.ext (mul_right_cancel₀ hpos.ne' h') + have hline := hearc.isLineWithEnds + have he₀ : e 0 = f s₀ := by simp [e] + have he₁ : e 1 = f s₁ := by simp [e] + rw [he₀, he₁] at hline + have hrange : range e = f '' Ioo s₀ s₁ ∪ {f s₀, f s₁} := by + ext x + constructor + · rintro ⟨s, rfl⟩ + by_cases h₂ : (s : ℝ) = 0 + · exact Or.inr (Or.inl (by simp [e, h₂])) + by_cases h₃ : (s : ℝ) = 1 + · exact Or.inr (Or.inr (by simp [e, h₃])) + have hs₀ : 0 < (s : ℝ) := lt_of_le_of_ne s.2.1 (Ne.symm h₂) + have hs₁ : (s : ℝ) < 1 := lt_of_le_of_ne s.2.2 h₃ + refine Or.inl ⟨_, ⟨?_, ?_⟩, rfl⟩ <;> nlinarith + · rintro (⟨t, ht, rfl⟩ | (rfl | rfl)) + · have hs : (t - s₀) / (s₁ - s₀) ∈ Icc (0 : ℝ) 1 := by + constructor + · exact div_nonneg (by linarith [ht.1]) hpos.le + · rw [div_le_one hpos] + linarith [ht.2] + refine ⟨⟨_, hs⟩, ?_⟩ + simp only [e] + congr 1 + field_simp + ring + · exact ⟨0, he₀⟩ + · exact ⟨1, he₁⟩ + rwa [hrange] at hline + refine ⟨f '' Ioo ta tb, f '' Ioo tb (ta + 2 * Real.pi), isPreconnected_Ioo.image _ + hf.continuousOn, + isPreconnected_Ioo.image _ hf.continuousOn, ?_, ?_, ?_, ?_, ?_⟩ + · rw [Set.disjoint_left] + rintro _ ⟨s, hs, rfl⟩ ⟨t, ht, he⟩ + have := eq_of_circleExp_eq (c := ta) ⟨ht.1.trans' htb1 |>.le, ht.2⟩ + ⟨hs.1.le, hs.2.trans htb.2⟩ (hf_exp he) + linarith [hs.2, ht.1] + · apply Subset.antisymm + · have hne : ∀ t ∈ Ico ta (ta + 2 * Real.pi), t ≠ ta → t ≠ tb → f t ≠ a ∧ f t ≠ b := by + intro t ht h₁ h₂ + constructor + · intro e + exact h₁ (eq_of_circleExp_eq ht ⟨le_rfl, by linarith⟩ (hf_exp (e.trans hfa.symm))) + · intro e + exact h₂ (eq_of_circleExp_eq ht htb (hf_exp (e.trans hfb.symm))) + rintro _ (⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩) + · have h := hne t ⟨ht.1.le, ht.2.trans htb.2⟩ ht.1.ne' ht.2.ne + refine ⟨(φ _).2, ?_⟩ + rintro (e | e) + · exact h.1 e + · exact h.2 e + · have h := hne t ⟨(htb1.trans ht.1).le, ht.2⟩ (htb1.trans ht.1).ne' ht.1.ne' + refine ⟨(φ _).2, ?_⟩ + rintro (e | e) + · exact h.1 e + · exact h.2 e + · rintro x ⟨hx, hne⟩ + obtain ⟨t, ht, hte⟩ := exists_mem_Ico_circleExp ta (φ.symm ⟨x, hx⟩) + have hfx : f t = x := by simp [f, hte] + have h1 : t ≠ ta := fun e => hne (Or.inl (by rw [← hfx, e, hfa])) + have h2 : t ≠ tb := fun e => hne (Or.inr (show x = b by rw [← hfx, e, hfb])) + rcases lt_or_gt_of_ne h2 with h | h + · exact Or.inl ⟨t, ⟨lt_of_le_of_ne ht.1 h1.symm, h⟩, hfx⟩ + · exact Or.inr ⟨t, ⟨h, ht.2⟩, hfx⟩ + · intro t₁ t₂ t₃ h₁₂ h₂₃ h₃₁ ea eb + obtain ⟨m, hm, hs⟩ := shift (t := t₁) (u := ta) (hf_exp (ea.trans hfa.symm)) + refine ⟨t₂ - m * (2 * Real.pi), ?_, hs t₂⟩ + have hb2 : Circle.exp (t₃ - m * (2 * Real.pi)) = Circle.exp tb := + hf_exp ((hs t₃).trans (eb.trans hfb.symm)) + have h3 : t₃ - m * (2 * Real.pi) = tb := + eq_of_circleExp_eq (c := ta) ⟨by linarith, by linarith⟩ htb hb2 + exact ⟨by linarith, by linarith⟩ + · intro t₁ t₂ t₃ h₁₂ h₂₃ h₃₁ eb ea + obtain ⟨m, hm, hs⟩ := shift (t := t₁) (u := tb) (hf_exp (eb.trans hfb.symm)) + refine ⟨t₂ - m * (2 * Real.pi), ?_, hs t₂⟩ + have hb2 : Circle.exp (t₃ - m * (2 * Real.pi)) = Circle.exp (ta + 2 * Real.pi) := + hf_exp ((hs t₃).trans (ea.trans hfa2.symm)) + have h3 : t₃ - m * (2 * Real.pi) = ta + 2 * Real.pi := + eq_of_circleExp_eq (c := tb) ⟨by linarith, by linarith⟩ + ⟨by linarith [htb.2], by linarith⟩ hb2 + exact ⟨by linarith, by linarith⟩ + · refine ⟨?_, ?_⟩ + · have := key ta tb htb1 (by linarith [htb.2]) + rwa [hfa, hfb] at this + · have := key tb (ta + 2 * Real.pi) (by linarith [htb.2]) (by linarith) + rwa [hfb, hfa2, pair_comm b a] at this + +theorem IsGraphPathWithEnds.eq_of_same_ends {G P : Graph α β} {a : α} + (h : IsGraphPathWithEnds G P a a) : V(P) = {a} ∧ E(P) = ∅ := by + obtain ⟨-, W, hW, hV, hE⟩ := h + cases W with + | nil _ => + exact ⟨by rw [hV]; ext x; simp, by rw [hE]; ext x; simp⟩ + | cons hl rest => + exfalso + have hnd : (rest.support).Nodup ∧ a ∉ rest.support := by + have : (a :: rest.support).Nodup := hW + rw [List.nodup_cons] at this + exact ⟨this.2, this.1⟩ + exact hnd.2 rest.end_mem_support + +/-- The drawing of a path `R` from `a ∈ ΩBar` that meets a circuit `C` only at its last vertex `y` +meets the closed disc of `C` only at `y`. -/ +theorem subgraphU_inter_disc {N : Neighborhood α β} (P_pres : Presentation N) {C R : Graph α β} + {D : Set EuclideanPlane} {a y : α} (hCG : C ≤ N.G) (hD : IsClosedDisc D) + (hDΔ : D ⊆ P_pres.Δ) (hbd : subBd D = graphDrawingSubgraphU P_pres.Γ C) + (ha : a ∈ N.Ω.bar) (hR : IsGraphPathWithEnds N.G R a y) (hV : V(R) ∩ V(C) = {y}) : + graphDrawingSubgraphU P_pres.Γ R ∩ D = graphDrawingVertexSet P_pres.Γ y := by + set Γ := P_pres.Γ + have hyG : y ∈ V(N.G) := hR.le.vertexSet_mono hR.right_mem + have hyR : y ∈ V(R) := hR.right_mem + have hyC : y ∈ V(C) := (hV.symm ▸ mem_singleton y : y ∈ V(R) ∩ V(C)).2 + have hsub : graphDrawingVertexSet Γ y ⊆ graphDrawingSubgraphU Γ R ∩ D := by + intro x hx + refine ⟨graphDrawingVertexSet_subset_subgraphU_of_mem Γ hyR hx, ?_⟩ + have : x ∈ subBd D := hbd ▸ graphDrawingVertexSet_subset_subgraphU_of_mem Γ hyC hx + rw [subBd_eq_discBd_plane hD] at this + exact Surface.discBd_subset D this + apply Subset.antisymm _ hsub + have hE : Disjoint E(R) E(C) := by + rw [Set.disjoint_left] + intro e heR heC + obtain ⟨u, v, huv⟩ := R.exists_isLink_of_mem_edgeSet heR + obtain ⟨u', v', huv'⟩ := C.exists_isLink_of_mem_edgeSet heC + have hG := huv.mono hR.le + have hG' := huv'.mono hCG + have hmem : ∀ z, z = u' ∨ z = v' → z ∈ V(C) := by + rintro z (rfl | rfl) + · exact huv'.left_mem + · exact huv'.right_mem + have h₁ : u ∈ V(R) ∩ V(C) := ⟨huv.left_mem, hmem u (hG.left_eq_or_eq hG')⟩ + have h₂ : v ∈ V(R) ∩ V(C) := ⟨huv.right_mem, hmem v (hG.symm.left_eq_or_eq hG')⟩ + rw [hV] at h₁ h₂ + have e₁ : u = y := h₁ + have e₂ : v = y := h₂ + subst e₁ + subst e₂ + exact hR.not_isLoopAt heR _ hG + have hinter : graphDrawingSubgraphU Γ R ∩ graphDrawingSubgraphU Γ C = + graphDrawingVertexSet Γ y := by + rw [graphDrawingSubgraphU_inter_of_disjoint_edgeSet Γ hR.le hCG hE, hV] + simp + have hfr : frontier D = graphDrawingSubgraphU Γ C := by + rw [frontier_eq_discBd_plane hD, ← subBd_eq_discBd_plane hD, hbd] + by_cases hay : a = y + · subst hay + obtain ⟨hVR, hER⟩ := hR.eq_of_same_ends + rintro x ⟨hx | hx, -⟩ + · obtain ⟨v, hv, hxv⟩ := mem_iUnion₂.mp hx + rw [hVR] at hv + exact (show v = a from hv) ▸ hxv + · obtain ⟨e, he, -⟩ := mem_iUnion₂.mp hx + rw [hER] at he + exact he.elim + have hay' : (Γ.iso.vertexEquiv ⟨a, hR.le.vertexSet_mono hR.left_mem⟩).1 ≠ + (Γ.iso.vertexEquiv ⟨y, hyG⟩).1 := (isLineWithEnds_graphDrawingSubgraphU Γ hR hay).2 + have hl := (isLineWithEnds_graphDrawingSubgraphU Γ hR hay).1 + set pa := (Γ.iso.vertexEquiv ⟨a, hR.le.vertexSet_mono hR.left_mem⟩).1 + set py := (Γ.iso.vertexEquiv ⟨y, hyG⟩).1 + have hy_set : graphDrawingVertexSet Γ y = {py} := graphDrawingVertexSet_eq_singleton Γ hyG + rw [hy_set] at hinter ⊢ + have hZ : IsPreconnected (graphDrawingSubgraphU Γ R \ {py}) := hl.isPreconnected_diff_right + rintro x ⟨hxR, hxD⟩ + by_contra hxy + have hxne : x ≠ py := hxy + have hpa_R : pa ∈ graphDrawingSubgraphU Γ R := hl.left_mem + have hpa_bd : pa ∈ subBd P_pres.Δ := by + have := (P_pres.mem_bd_Δ_iff a (hR.le.vertexSet_mono hR.left_mem)).mpr ha + rw [graphDrawingVertexSet_eq_singleton Γ (hR.le.vertexSet_mono hR.left_mem)] at this + exact this rfl + have hpa_D : pa ∉ D := by + intro hm + have hnf : pa ∉ frontier D := by + rw [hfr] + intro h + have : pa ∈ graphDrawingSubgraphU Γ R ∩ graphDrawingSubgraphU Γ C := ⟨hpa_R, h⟩ + rw [hinter] at this + exact hay' this + have hint : pa ∈ interior D := by + by_contra h + exact hnf ⟨subset_closure hm, h⟩ + have hint' : pa ∈ interior P_pres.Δ := interior_mono hDΔ hint + rw [subBd_eq_discBd_plane P_pres.isClosedDisc_Δ, ← frontier_eq_discBd_plane + P_pres.isClosedDisc_Δ] + at hpa_bd + exact hpa_bd.2 hint' + obtain ⟨z, ⟨hzR, hzne⟩, hzf⟩ := inter_frontier_nonempty_of_isPreconnected hZ + (U := D) ⟨x, ⟨hxR, hxne⟩, hxD⟩ ⟨pa, ⟨hpa_R, hay'⟩, hpa_D⟩ + rw [hfr] at hzf + have : z ∈ graphDrawingSubgraphU Γ R ∩ graphDrawingSubgraphU Γ C := ⟨hzR, hzf⟩ + rw [hinter] at this + exact hzne this + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section10d.lean b/LeanPool/GraphMinor/GM09/Section10d.lean new file mode 100644 index 0000000000..869187c7c3 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section10d.lean @@ -0,0 +1,658 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Section10c +public import LeanPool.GraphMinor.GM09.Section4b + +/-! +# Graph Minors IX, (10.2) + +The paths `Q_i` of (10.2). The paper takes `Q_i` to run along `C_i`, with `C_1` the innermost +circuit of the nest. With that numbering `Q_s` runs around `C_s` and crosses the paths that lead +`Q_1` to `C_1`. So we let `Q_i` run along `C_{s+1-i}`: the path with the smallest interval runs +along the outermost circuit. + +`IsGraphPath` paths may pass through `ΩBar`, so we use the sides of an arc from `ArcSides.lean`, in +place of a cross-cut. The word "clockwise" in the choice of the arc of the circuit is replaced by a +condition on sides: we take the arc for which the disc of the circuit lies on the side of `Ω(b_i, +a_i)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +universe u v + +variable {α : Type u} {β : Type v} + +theorem CyclicPerm.getElem_ofFn_left {s : ℕ} (a b : Fin s → α) (k : Fin s) + (hk : s - 1 - k.1 < ((List.ofFn a).reverse ++ List.ofFn b).length) : + ((List.ofFn a).reverse ++ List.ofFn b)[s - 1 - k.1]'hk = a k := by + have hk' := k.2 + have h₁ : s - 1 - k.1 < (List.ofFn a).reverse.length := by simp; omega + rw [List.getElem_append_left h₁, List.getElem_reverse] + simp only [List.getElem_ofFn, List.length_ofFn] + congr 1 + ext + simp + omega + +theorem CyclicPerm.getElem_ofFn_right {s : ℕ} (a b : Fin s → α) (k : Fin s) + (hk : s + k.1 < ((List.ofFn a).reverse ++ List.ofFn b).length) : + ((List.ofFn a).reverse ++ List.ofFn b)[s + k.1]'hk = b k := by + rw [List.getElem_append_right (by simp)] + simp only [List.getElem_ofFn, List.length_reverse, List.length_ofFn] + congr 1 + ext + simp + +/-- The facts on a clockwise list `(a_s, …, a_1, b_1, …, b_s)` that we use. -/ +theorem CyclicPerm.isClockwise3_of_ofFn {Ω : CyclicPerm α} {s : ℕ} {a b : Fin s → α} + (h : Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) : + (∀ i j : Fin s, i < j → Ω.IsClockwise3 (b i) (a j) (a i) ∧ Ω.IsClockwise3 (b i) (b j) (a i)) ∧ + Injective a ∧ Injective b ∧ (∀ i j, a i ≠ b j) ∧ (∀ i, a i ∈ Ω.bar) ∧ ∀ i, b i ∈ Ω.bar := by + set L := (List.ofFn a).reverse ++ List.ofFn b with hL + have hlen : L.length = s + s := by simp [hL] + have ha : ∀ (k : Fin s) (hk : s - 1 - k.1 < L.length), L[s - 1 - k.1]'hk = a k := + fun k hk => CyclicPerm.getElem_ofFn_left a b k hk + have hb : ∀ (k : Fin s) (hk : s + k.1 < L.length), L[s + k.1]'hk = b k := + fun k hk => CyclicPerm.getElem_ofFn_right a b k hk + have hnd := h.1 + refine ⟨fun i j hij => ?_, ?_, ?_, ?_, ?_, ?_⟩ + · have hi := i.2 + have hj := j.2 + have hij' : i.1 < j.1 := hij + have h₁ := Ω.mem_interval_of_lt h (i₁ := s - 1 - j.1) (i₂ := s - 1 - i.1) (i₃ := s + i.1) + (by omega) (by omega) (by omega) + have h₂ := Ω.mem_interval_of_lt h (i₁ := s - 1 - i.1) (i₂ := s + i.1) (i₃ := s + j.1) + (by omega) (by omega) (by omega) + rw [ha j, ha i, hb i] at h₁ + rw [ha i, hb i, hb j] at h₂ + exact ⟨Ω.isClockwise3_rotate (Ω.isClockwise3_rotate h₁.2), Ω.isClockwise3_rotate h₂.2⟩ + · intro i j e + have hi := i.2 + have hj := j.2 + have := (List.Nodup.getElem_inj_iff hnd (i := s - 1 - i.1) (j := s - 1 - j.1) + (hi := by omega) (hj := by omega)).mp (by rw [ha i, ha j, e]) + exact Fin.ext (by omega) + · intro i j e + have hi := i.2 + have hj := j.2 + have := (List.Nodup.getElem_inj_iff hnd (i := s + i.1) (j := s + j.1) + (hi := by omega) (hj := by omega)).mp (by rw [hb i, hb j, e]) + exact Fin.ext (by omega) + · intro i j e + have hi := i.2 + have hj := j.2 + have := (List.Nodup.getElem_inj_iff hnd (i := s - 1 - i.1) (j := s + j.1) + (hi := by omega) (hj := by omega)).mp (by rw [ha i, hb j, e]) + omega + · intro i + have hi := i.2 + exact h.2.1 _ (ha i (by omega) ▸ List.getElem_mem (by omega)) + · intro i + have hi := i.2 + exact h.2.1 _ (hb i (by omega) ▸ List.getElem_mem (by omega)) + +/-- The arcs and the sides of a detour along a circuit, for (10.2). `Ra, Rb` are paths from `a, b` +to the circuit. -/ +theorem exists_detour {N : Neighborhood α β} (P_pres : Presentation N) {C Ra Rb : Graph α β} + {D I₁ I₂ : Set EuclideanPlane} {a b y y' : α} {pa pb : EuclideanPlane} + (hC : IsGraphCircuit N.G C) (hD : IsClosedDisc D) (hDΔ : D ⊆ P_pres.Δ) + (hbd : subBd D = graphDrawingSubgraphU P_pres.Γ C) + (ha : a ∈ N.Ω.bar) (hb : b ∈ N.Ω.bar) + (hRa : IsGraphPathWithEnds N.G Ra a y) (hRb : IsGraphPathWithEnds N.G Rb b y') + (hVa : V(Ra) ∩ V(C) = {y}) (hVb : V(Rb) ∩ V(C) = {y'}) (hd : Disjoint V(Ra) V(Rb)) (hab : a ≠ b) + (hpa : graphDrawingVertexSet P_pres.Γ a = {pa}) (hpb : graphDrawingVertexSet P_pres.Γ b = {pb}) + (hI₁ : IsPreconnected I₁) (hI₂ : IsPreconnected I₂) (hId : Disjoint I₁ I₂) + (hIu : I₁ ∪ I₂ = discBd P_pres.Δ \ {pa, pb}) : + ∃ (A A' Q Q' : Graph α β) (Y₁ Y₂ Y₁' Y₂' : Set EuclideanPlane), + V(A) ⊆ V(C) ∧ V(A) ∩ V(A') = {y, y'} ∧ subgraphUnion N.G A A' = C ∧ + A ≤ C ∧ A' ≤ C ∧ IsGraphPathWithEnds N.G A y y' ∧ IsGraphPathWithEnds N.G A' y y' ∧ + graphDrawingSubgraphU P_pres.Γ A ∩ graphDrawingSubgraphU P_pres.Γ A' = + graphDrawingVertexSet P_pres.Γ y ∪ graphDrawingVertexSet P_pres.Γ y' ∧ + IsGraphPathWithEnds N.G Q a b ∧ V(Q) = V(Ra) ∪ V(A) ∪ V(Rb) ∧ + IsGraphPathWithEnds N.G Q' a b ∧ V(Q') = V(Ra) ∪ V(A') ∪ V(Rb) ∧ + graphDrawingSubgraphU P_pres.Γ A ⊆ graphDrawingSubgraphU P_pres.Γ Q ∧ + graphDrawingSubgraphU P_pres.Γ Q' = + graphDrawingSubgraphU P_pres.Γ Ra ∪ graphDrawingSubgraphU P_pres.Γ A' ∪ + graphDrawingSubgraphU P_pres.Γ Rb ∧ + IsArcSides P_pres.Δ (graphDrawingSubgraphU P_pres.Γ Q) I₁ I₂ Y₁ Y₂ ∧ + IsArcSides P_pres.Δ (graphDrawingSubgraphU P_pres.Γ Q') I₁ I₂ Y₁' Y₂' ∧ + D \ graphDrawingSubgraphU P_pres.Γ A ⊆ Y₂ ∧ D \ graphDrawingSubgraphU P_pres.Γ A' ⊆ Y₁' := by + set Γ := P_pres.Γ + have hyC : y ∈ V(C) := (hVa.symm ▸ mem_singleton y : y ∈ V(Ra) ∩ V(C)).2 + have hy'C : y' ∈ V(C) := (hVb.symm ▸ mem_singleton y' : y' ∈ V(Rb) ∩ V(C)).2 + have hyy' : y ≠ y' := fun e => Set.disjoint_left.mp hd hRa.right_mem (e ▸ hRb.right_mem) + have hdisc : subBd D = graphDrawingSubgraphU Γ C := hbd + obtain ⟨Q₁, Q₂, hQ₁C, hQ₂C, hQ₁, hQ₂, hV, hE, hunion, hl₁, hl₂, hinter, hcov⟩ := + circuit_two_arcs_drawing Γ hC hD hdisc hyC hy'C hyy' + have hyG := hC.1.vertexSet_mono hyC + have hy'G := hC.1.vertexSet_mono hy'C + set py := (Γ.iso.vertexEquiv ⟨y, hyG⟩).1 + set py' := (Γ.iso.vertexEquiv ⟨y', hy'G⟩).1 + have hsy : graphDrawingVertexSet Γ y = {py} := graphDrawingVertexSet_eq_singleton Γ hyG + have hsy' : graphDrawingVertexSet Γ y' = {py'} := graphDrawingVertexSet_eq_singleton Γ hy'G + have h₁ := subgraphU_inter_disc P_pres hC.1 hD hDΔ hbd ha hRa hVa + have h₂ := subgraphU_inter_disc P_pres hC.1 hD hDΔ hbd hb hRb hVb + set R := graphDrawingSubgraphU Γ Ra ∪ graphDrawingSubgraphU Γ Rb with hRdef + have hRD : R ∩ D = {py, py'} := by + rw [hRdef, union_inter_distrib_right, h₁, h₂, hsy, hsy'] + rfl + have hUΔ : ∀ X : Graph α β, graphDrawingSubgraphU Γ X ⊆ P_pres.Δ := fun X => + (graphDrawingSubgraphU_subset_U Γ X).trans (P_pres.U_subset.trans sdiff_subset) + have hRΔ : R ⊆ P_pres.Δ := union_subset (hUΔ _) (hUΔ _) + have hpaG : a ∈ V(N.G) := N.bar_subset ha + have hpbG : b ∈ V(N.G) := N.bar_subset hb + have hpa' : pa = (Γ.iso.vertexEquiv ⟨a, hpaG⟩).1 := by + have := graphDrawingVertexSet_eq_singleton Γ hpaG + rw [hpa] at this + exact singleton_injective this + have hpb' : pb = (Γ.iso.vertexEquiv ⟨b, hpbG⟩).1 := by + have := graphDrawingVertexSet_eq_singleton Γ hpbG + rw [hpb] at this + exact singleton_injective this + have hne : pa ≠ pb := by + rw [hpa', hpb'] + exact fun e => hab (congrArg Subtype.val (Γ.iso.vertexEquiv.injective (Subtype.ext e))) + have hRb' := hRb.symm + have mk : ∀ X : Graph α β, X ≤ C → IsGraphPathWithEnds N.G X y y' → + ∃ Q : Graph α β, IsGraphPathWithEnds N.G Q a b ∧ V(Q) = V(Ra) ∪ V(X) ∪ V(Rb) ∧ + graphDrawingSubgraphU Γ Q = R ∪ graphDrawingSubgraphU Γ X := by + intro X hXC hX + have hV₁ : V(Ra) ∩ V(X) = {y} := by + apply Subset.antisymm + · rintro z ⟨h, h'⟩ + have : z ∈ V(Ra) ∩ V(C) := ⟨h, hXC.vertexSet_mono h'⟩ + rwa [hVa] at this + · rintro _ rfl + exact ⟨hRa.right_mem, hX.left_mem⟩ + have hp₁ := hRa.subgraphUnion hX hV₁ + have hV₂ : V(subgraphUnion N.G Ra X) ∩ V(Rb) = {y'} := by + rw [vertexSet_subgraphUnion] + apply Subset.antisymm + · rintro z ⟨h | h, h'⟩ + · exact (Set.disjoint_left.mp hd h h').elim + · have : z ∈ V(Rb) ∩ V(C) := ⟨h', hXC.vertexSet_mono h⟩ + rwa [hVb] at this + · rintro _ rfl + exact ⟨Or.inr hX.right_mem, hRb.right_mem⟩ + refine ⟨_, hp₁.subgraphUnion hRb' hV₂, ?_, ?_⟩ + · rw [vertexSet_subgraphUnion, vertexSet_subgraphUnion] + · rw [graphDrawingSubgraphU_subgraphUnion Γ hp₁.le hRb.le, + graphDrawingSubgraphU_subgraphUnion Γ hRa.le hX.le, hRdef] + ext z + simp only [mem_union] + tauto + obtain ⟨Q, hQ, hVQ, hUQ⟩ := mk Q₁ hQ₁C hQ₁ + obtain ⟨Q', hQ', hVQ', hUQ'⟩ := mk Q₂ hQ₂C hQ₂ + have hline : ∀ {Z : Graph α β}, IsGraphPathWithEnds N.G Z a b → + IsLineWithEnds (graphDrawingSubgraphU Γ Z) pa pb := by + intro Z hZ + have := (isLineWithEnds_graphDrawingSubgraphU Γ hZ hab).1 + rwa [← hpa', ← hpb'] at this + have hL := hline hQ + have hL' := hline hQ' + rw [hUQ] at hL + rw [hUQ'] at hL' + have hpaU : pa ∈ graphDrawingSubgraphU Γ Ra := by + have := graphDrawingVertexSet_subset_subgraphU_of_mem Γ hRa.left_mem + rw [hpa] at this + exact this rfl + have hpbU : pb ∈ graphDrawingSubgraphU Γ Rb := by + have := graphDrawingVertexSet_subset_subgraphU_of_mem Γ hRb.left_mem + rw [hpb] at this + exact this rfl + have hbdp : ∀ {v : α}, v ∈ N.Ω.bar → ∀ {p : EuclideanPlane}, graphDrawingVertexSet Γ v = {p} → + p ∈ discBd P_pres.Δ := by + intro v hv p hp + have := (P_pres.mem_bd_Δ_iff v (N.bar_subset hv)).mpr hv + rw [hp, singleton_subset_iff, subBd_eq_discBd_plane P_pres.isClosedDisc_Δ] at this + exact this + obtain ⟨Y₁, Y₂, Y₁', Y₂', hs, hs', hor⟩ := exists_hole_sides (y := py) (y' := py') (R := R) + P_pres.isClosedDisc_Δ hD hDΔ hl₁ + (by rw [hcov]) hinter hRD hRΔ hL hL' (hbdp ha hpa) (hbdp hb hpb) hne + (Or.inl hpaU) (Or.inr hpbU) hI₁ hI₂ hId hIu + have hle₁ : Q₁ ≤ N.G := hQ₁.le + have hle₂ : Q₂ ≤ N.G := hQ₂.le + have hun' : subgraphUnion N.G Q₂ Q₁ = C := by + rw [subgraphUnion_comm hle₂ hle₁] + exact hunion + rw [← hUQ] at hs + rw [← hUQ'] at hs' + have hR1 : ∀ X, graphDrawingSubgraphU Γ X ⊆ R ∪ graphDrawingSubgraphU Γ X := + fun _ => subset_union_right + have hexp : ∀ X : Graph α β, R ∪ graphDrawingSubgraphU Γ X = + graphDrawingSubgraphU Γ Ra ∪ graphDrawingSubgraphU Γ X ∪ graphDrawingSubgraphU Γ Rb := by + intro X + ext z + simp only [hRdef, mem_union] + tauto + rcases hor with ⟨h₂', h₁'⟩ | ⟨h₁', h₂'⟩ + · refine ⟨Q₁, Q₂, Q, Q', Y₁, Y₂, Y₁', Y₂', hQ₁C.vertexSet_mono, hV, hunion, hQ₁C, hQ₂C, hQ₁, + hQ₂, ?_, hQ, hVQ, + hQ', hVQ', hUQ ▸ hR1 _, hUQ'.trans (hexp _), hs, hs', h₂', h₁'⟩ + rw [hinter, hsy, hsy'] + rfl + · refine ⟨Q₂, Q₁, Q', Q, Y₁', Y₂', Y₁, Y₂, hQ₂C.vertexSet_mono, ?_, hun', hQ₂C, hQ₁C, hQ₂, hQ₁, + ?_, hQ', hVQ', + hQ, hVQ, hUQ' ▸ hR1 _, hUQ.trans (hexp _), hs', hs, h₂', h₁'⟩ + · rw [Set.inter_comm] + exact hV + · rw [Set.inter_comm, hinter, hsy, hsy'] + rfl + +private theorem pairDisjointOfNestedCircuits + {N : Neighborhood α β} (P_pres : Presentation N) (s : ℕ) (a b : Fin s → α) + (ha_bar : ∀ (i : Fin s), a i ∈ N.Ω.bar) (hb_bar : ∀ (i : Fin s), b i ∈ N.Ω.bar) + (C : Fin s → Graph α β) + (hcir : ∀ (i : Fin s), IsGraphCircuit N.G (C i)) + (hdisjC : Pairwise fun i j => Disjoint V(C i) V(C j)) (D : Fin s → Set EuclideanPlane) + (hDs : ∀ (i : Fin s), P_pres.Δ₀ ⊆ D i ∧ D i ⊆ P_pres.Δ) + (hDm : ∀ (i j : Fin s), i ≤ j → D i ⊆ D j) + (hDd : ∀ (i : Fin s), IsClosedDisc (D i) ∧ subBd (D i) = graphDrawingSubgraphU (P_pres.Γ) (C + i)) + (hpt : ∀ v ∈ V(N.G), ∃ p, graphDrawingVertexSet (P_pres.Γ) v = {p}) (i : Fin s) {y : α} + {Ra : Graph α β} (hRa : IsGraphPathWithEnds N.G Ra (a i) y) (hVa : V(Ra) ∩ V(C (i.rev)) = {y}) + {y' : α} {Rb : Graph α β} (hRb : IsGraphPathWithEnds N.G Rb (b i) y') + (hVb : V(Rb) ∩ V(C (i.rev)) = {y'}) (m : Fin s) (hm : m < (i.rev)) : + Disjoint (V(Ra) ∪ V(Rb)) V(C m) := by + classical + let Γ := P_pres.Γ + let k := i.rev + have hmk : D m ⊆ D k := hDm m k hm.le + have hne : m ≠ k := hm.ne + have hoffC : ∀ {R : Graph α β} {u w : α}, IsGraphPathWithEnds N.G R u w → u ∈ N.Ω.bar → + V(R) ∩ V(C k) = {w} → Disjoint V(R) V(C m) := by + intro R u w hR hu hRV + rw [Set.disjoint_left] + intro v hvR hvC + have hvG := hR.le.vertexSet_mono hvR + have hint := subgraphU_inter_disc P_pres (hcir k).1 (hDd k).1 (hDs k).2 (hDd k).2 hu hR hRV + obtain ⟨p, hp⟩ := hpt v hvG + have hpm : p ∈ graphDrawingVertexSet Γ v := hp ▸ mem_singleton p + have hpD : p ∈ D m := by + have h₁ := graphDrawingVertexSet_subset_subgraphU_of_mem Γ hvC hpm + rw [← (hDd m).2, subBd_eq_discBd_plane (hDd m).1] at h₁ + exact Surface.discBd_subset _ h₁ + have : p ∈ graphDrawingSubgraphU Γ R ∩ D k := + ⟨graphDrawingVertexSet_subset_subgraphU_of_mem Γ hvR hpm, hmk hpD⟩ + rw [hint] at this + have hvw : v = w := graphDrawingVertexSet_inj Γ hpm this + subst hvw + have : v ∈ V(R) ∩ V(C k) := by rw [hRV]; rfl + exact Set.disjoint_left.mp (hdisjC hne) hvC this.2 + rw [Set.disjoint_union_left] + exact ⟨hoffC hRa (ha_bar i) hVa, hoffC hRb (hb_bar i) hVb⟩ + +private theorem pathDisjointOfDetour + {N : Neighborhood α β} (P_pres : Presentation N) (s : ℕ) (a b : Fin s → α) + (C : Fin s → Graph α β) (P : Fin (range a ∪ range b).ncard → Graph α β) + (hPd : Pairwise fun i₁ i₂ => Disjoint V(P i₁) V(P i₂)) + (hPC : ∀ (i : Fin (range a ∪ range b).ncard) (j : Fin s), IsGraphPath N.G (subgraphInter N.G + (P i) (C j))) + (st tm : Fin (range a ∪ range b).ncard → α) + (hst : ∀ (i : Fin (range a ∪ range b).ncard), IsFromToPathWithEnds N.G (P i) (range a ∪ range + b) N.Ω₀.bar (st i) (tm i)) + (hst_V : ∀ (i : Fin (range a ∪ range b).ncard), st i ∈ V(P i)) + (idx : α → Fin (range a ∪ range b).ncard) (hcir : ∀ (i : Fin s), IsGraphCircuit N.G (C i)) + (D : Fin s → Set EuclideanPlane) + (hpt : ∀ v ∈ V(N.G), ∃ p, graphDrawingVertexSet (P_pres.Γ) v = {p}) (i : Fin s) {y : α} + {Ra : Graph α β} (hRaP : Ra ≤ P (idx (a i))) (hRa : IsGraphPathWithEnds N.G Ra (a i) y) + {y' : α} {Rb : Graph α β} (hRbP : Rb ≤ P (idx (b i))) + (hRb : IsGraphPathWithEnds N.G Rb (b i) y') (hd : Disjoint V(Ra) V(Rb)) + (I₁ I₂ : Set EuclideanPlane) + (hmem₂ : ∀ c ∈ N.Ω.interval (b i) (a i), ∀ (p : EuclideanPlane), graphDrawingVertexSet + (P_pres.Γ) c = {p} → p ∈ I₂) + {A A' Q' : Graph α β} (Y₁' Y₂' : Set EuclideanPlane) (hAC : V(A) ⊆ V(C (i.rev))) + (hun : subgraphUnion N.G A A' = C (i.rev)) (hAle : A ≤ C (i.rev)) (hA'le : A' ≤ C (i.rev)) + (hApath : IsGraphPathWithEnds N.G A y y') (hA'path : IsGraphPathWithEnds N.G A' y y') + (hUAA' : graphDrawingSubgraphU P_pres.Γ A ∩ graphDrawingSubgraphU P_pres.Γ + A' = graphDrawingVertexSet P_pres.Γ y ∪ graphDrawingVertexSet P_pres.Γ + y') + (hUQ' : graphDrawingSubgraphU P_pres.Γ Q' = graphDrawingSubgraphU P_pres.Γ + Ra ∪ graphDrawingSubgraphU P_pres.Γ A' ∪ graphDrawingSubgraphU + P_pres.Γ Rb) + (hs' : IsArcSides P_pres.Δ (graphDrawingSubgraphU P_pres.Γ Q') I₁ I₂ Y₁' Y₂') + (hDA' : D (i.rev) \ graphDrawingSubgraphU P_pres.Γ A' ⊆ Y₁') + (hUU : (P_pres.Γ).drawing.U ⊆ P_pres.Δ) + (hUD : graphDrawingSubgraphU (P_pres.Γ) (C (i.rev)) ⊆ D (i.rev)) + (t : Fin (range a ∪ range b).ncard) (ht₁ : t ≠ idx (a i)) (ht₂ : t ≠ idx (b i)) + (hstt : st t ∈ N.Ω.interval (b i) (a i)) : + Disjoint V(P t) V(A) := by + classical + let Γ := P_pres.Γ + let k := i.rev + rw [Set.disjoint_left] + intro v hvT hvA + have hTle : P t ≤ N.G := (hst t).1.le + have hAG : A ≤ N.G := hApath.le + have hA'G : A' ≤ N.G := hA'path.le + have hdT₁ : Disjoint V(P t) V(Ra) := + (hPd ht₁).mono_right hRaP.vertexSet_mono + have hdT₂ : Disjoint V(P t) V(Rb) := + (hPd ht₂).mono_right hRbP.vertexSet_mono + have hy'R : y' ∈ V(Rb) := hRb.right_mem + have hyR : y ∈ V(Ra) := hRa.right_mem + have hne_y : ∀ w ∈ V(P t), w ≠ y ∧ w ≠ y' := fun w hw => + ⟨fun e => Set.disjoint_left.mp hdT₁ hw (e ▸ hyR), + fun e => Set.disjoint_left.mp hdT₂ hw (e ▸ hy'R)⟩ + have hyy' : y ≠ y' := fun e => Set.disjoint_left.mp hd hyR (e ▸ hy'R) + obtain ⟨u₀, v₀, hI⟩ := hPC t k + set I := subgraphInter N.G (P t) (C k) with hIdef + have hIT : I ≤ P t := subgraphInter_le_left hTle (hcir k).1 + have hIC : I ≤ C k := subgraphInter_le_right hTle (hcir k).1 + have hZ := isPreconnected_graphDrawingSubgraphU Γ hI + have hsplit : graphDrawingSubgraphU Γ I ⊆ graphDrawingSubgraphU Γ A ∪ + graphDrawingSubgraphU Γ A' := by + rw [← graphDrawingSubgraphU_subgraphUnion Γ hAG hA'G, hun] + exact graphDrawingSubgraphU_mono Γ hIC + have hvI : v ∈ V(I) := by + rw [hIdef, vertexSet_subgraphInter] + exact ⟨hvT, hAC hvA⟩ + have hvG := hTle.vertexSet_mono hvT + obtain ⟨pv, hpv⟩ := hpt v hvG + have hpv' : pv ∈ graphDrawingVertexSet Γ v := hpv ▸ mem_singleton pv + have hnot : ∀ w ∈ V(A'), w ∉ V(P t) := by + intro w hwA' hwT + have hwI : w ∈ V(I) := by + rw [hIdef, vertexSet_subgraphInter] + exact ⟨hwT, hA'le.vertexSet_mono hwA'⟩ + have hwG := hTle.vertexSet_mono hwT + obtain ⟨pw, hpw⟩ := hpt w hwG + have hpw' : pw ∈ graphDrawingVertexSet Γ w := hpw ▸ mem_singleton pw + have hcl : ∀ {B : Graph α β} {c e : α}, IsGraphPathWithEnds N.G B c e → c ≠ e → + IsClosed (graphDrawingSubgraphU Γ B) := fun hB hne => + (isLineWithEnds_graphDrawingSubgraphU Γ hB hne).1.isCompact.isClosed + obtain ⟨x, hxZ, hx₁, hx₂⟩ := isPreconnected_closed_iff.mp hZ _ _ (hcl hApath hyy') + (hcl hA'path hyy') hsplit + ⟨pv, graphDrawingVertexSet_subset_subgraphU_of_mem Γ hvI hpv', + graphDrawingVertexSet_subset_subgraphU_of_mem Γ hvA hpv'⟩ + ⟨pw, graphDrawingVertexSet_subset_subgraphU_of_mem Γ hwI hpw', + graphDrawingVertexSet_subset_subgraphU_of_mem Γ hwA' hpw'⟩ + have hx : x ∈ graphDrawingSubgraphU Γ A ∩ graphDrawingSubgraphU Γ A' := ⟨hx₁, hx₂⟩ + rw [hUAA'] at hx + have hin : ∀ q ∈ V(N.G), x ∈ graphDrawingVertexSet Γ q → q ∈ V(P t) := by + intro q hq hxq + refine hIT.vertexSet_mono (mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU Γ + (hIT.trans hTle) hq ?_) + obtain ⟨p', hp'⟩ := hpt q hq + rw [hp', singleton_subset_iff] + rw [hp'] at hxq + exact (show x = p' from hxq) ▸ hxZ + rcases hx with hx | hx + · exact Set.disjoint_left.mp hdT₁ (hin y (hRa.le.vertexSet_mono hyR) hx) hyR + · exact Set.disjoint_left.mp hdT₂ (hin y' (hRb.le.vertexSet_mono hy'R) hx) hy'R + have hdA' : Disjoint V(P t) V(A') := Set.disjoint_left.mpr fun w hw hw' => hnot w hw' hw + have hTsub : graphDrawingSubgraphU Γ (P t) ⊆ + P_pres.Δ \ graphDrawingSubgraphU Γ Q' := by + intro x hx + refine ⟨hUU (graphDrawingSubgraphU_subset_U Γ _ hx), ?_⟩ + rw [hUQ'] + rintro ((h' | h') | h') + · exact Set.disjoint_left.mp (disjoint_subgraphU_of_disjoint_vertexSet Γ hTle hRa.le hdT₁) + hx h' + · exact Set.disjoint_left.mp (disjoint_subgraphU_of_disjoint_vertexSet Γ hTle hA'G hdA') + hx h' + · exact Set.disjoint_left.mp (disjoint_subgraphU_of_disjoint_vertexSet Γ hTle hRb.le hdT₂) + hx h' + have hTc := isPreconnected_graphDrawingSubgraphU Γ (hst t).1 + have hstG : st t ∈ V(N.G) := hTle.vertexSet_mono (hst_V t) + obtain ⟨ps, hps⟩ := hpt (st t) hstG + have hps' : ps ∈ graphDrawingVertexSet Γ (st t) := hps ▸ mem_singleton ps + have hpsU : ps ∈ graphDrawingSubgraphU Γ (P t) := + graphDrawingVertexSet_subset_subgraphU_of_mem Γ (hst_V t) hps' + have hpvU : pv ∈ graphDrawingSubgraphU Γ (P t) := + graphDrawingVertexSet_subset_subgraphU_of_mem Γ hvT hpv' + have hsY : ps ∈ Y₂' := hs'.right ⟨hmem₂ _ hstt ps hps, (hTsub hpsU).2⟩ + have hvNotA' : pv ∉ graphDrawingSubgraphU Γ A' := fun hm => + hnot v (mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU Γ hA'G hvG + (by rw [hpv, singleton_subset_iff]; exact hm)) hvT + have hvA_U : pv ∈ graphDrawingSubgraphU Γ A := + graphDrawingVertexSet_subset_subgraphU_of_mem Γ hvA hpv' + have hvD : pv ∈ D k := hUD (graphDrawingSubgraphU_mono Γ hAle hvA_U) + have hvY : pv ∈ Y₁' := hDA' ⟨hvD, hvNotA'⟩ + rcases hs'.conn _ hTsub hTc with h' | h' + · exact Set.disjoint_left.mp hs'.disj (h' hpsU) hsY + · exact Set.disjoint_left.mp hs'.disj hvY (h' hpvU) + +private theorem initialSegmentMeeting {G R Z : Graph α β} {u v z : α} + (hR : IsGraphPathWithEnds G R u v) (hzR : z ∈ V(R)) (hzZ : z ∈ V(Z)) : + ∃ y : α, ∃ R' : Graph α β, R' ≤ R ∧ IsGraphPathWithEnds G R' u y ∧ + V(R') ∩ V(Z) = {y} := by + obtain ⟨T, hTR, _, hT⟩ := hR.exists_subpath hR.left_mem hzR + obtain ⟨x, hx, y, _, R', hR'T, hR'⟩ := + hT.exists_isFromToPathWithEnds (X := {u}) (Y := V(Z)) (mem_singleton u) hzZ + have hxu : x = u := hx + subst hxu + exact ⟨y, R', hR'T.trans hTR, hR'.1, hR'.2.2⟩ + +/-- **Graph Minors IX, (10.2)** (page 64), with the numbering of the circuits corrected as in the +module docstring: +"Let $(G, \Omega, \Omega_0)$ be a rural neighborhood of breadth $\ge s$, and let $\{a_1, a_2, +\dots, a_s, b_1, b_2, \dots, b_s\} \subseteq \bar{\Omega}$ be weakly-linked, where $(a_s, +a_{s-1}, \dots, a_1, b_1, b_2, \dots, b_s)$ is clockwise. Then there is a transaction +$\{Q_1, \dots, Q_s\}$ in $(G, \Omega)$ such that $Q_i$ has ends $a_i, b_i$ and $Q_i$ meets +every path from $\Omega(a_i, b_i)$ to $\Omega(b_i, a_i) \cup \bar{\Omega}_0$ $(1 \le i \le +s)$." +That `Q_i` meets every such path we state with a separation with `V(G₁ ∩ G₂) = V(Q_i)`. -/ +theorem theorem_10_2_proof {N : Neighborhood α β} (P_pres : Presentation N) {s : ℕ} + (h_nest : ∃ C₀ : Fin s → Graph α β, N.IsNest P_pres C₀) {a b : Fin s → α} + (hX : N.IsWeaklyLinked (range a ∪ range b)) + (hcw : N.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) : + ∃ Q : Fin s → Graph α β, (∀ i, IsGraphPathWithEnds N.G (Q i) (a i) (b i)) ∧ + Pairwise (fun i j => Disjoint V(Q i) V(Q j)) ∧ + ∀ i, ∃ G₁ G₂ : Graph α β, IsGraphSeparation N.G G₁ G₂ ∧ V(G₁) ∩ V(G₂) = V(Q i) ∧ + Q i ≤ G₁ ∧ N.Ω.interval (a i) (b i) ⊆ V(G₁) ∧ N.Ω.interval (b i) (a i) ⊆ V(G₂) ∧ + N.Ω₀.bar ⊆ V(G₂) := by + classical + by_cases hs0 : s = 0 + · subst hs0 + exact ⟨fun i => i.elim0, fun i => i.elim0, fun i => i.elim0, fun i => i.elim0⟩ + obtain ⟨hclock, hinj_a, hinj_b, hab, ha_bar, hb_bar⟩ := CyclicPerm.isClockwise3_of_ofFn hcw + set X := range a ∪ range b with hXdef + have hX_fin : X.Finite := (finite_range a).union (finite_range b) + obtain ⟨C, P, hC, hP, hPd, hPC⟩ := theorem_10_1_proof P_pres h_nest hX + choose st tm hst using hP + have hst_X : ∀ i, st i ∈ X := fun i => (hst i).left_mem_X + have hst_V : ∀ i, st i ∈ V(P i) := fun i => (hst i).1.left_mem + have hsurj : ∀ x ∈ X, ∃ i, st i = x := by + let f : Fin X.ncard → X := fun i => ⟨st i, hst_X i⟩ + have finj : Injective f := by + intro i j e + by_contra hne + have e' : st i = st j := congrArg Subtype.val e + exact Set.disjoint_left.mp (hPd hne) (hst_V i) (e' ▸ hst_V j) + have : Finite X := hX_fin + have hcard : Nat.card X ≤ Nat.card (Fin X.ncard) := by + rw [Nat.card_coe_set_eq, Nat.card_fin] + intro x hx + obtain ⟨i, hi⟩ := (Function.Injective.bijective_of_nat_card_le finj hcard).2 ⟨x, hx⟩ + exact ⟨i, congrArg Subtype.val hi⟩ + have : Nonempty (Fin X.ncard) := by + have hm : a ⟨0, Nat.pos_of_ne_zero hs0⟩ ∈ X := Or.inl (mem_range_self _) + exact ⟨⟨0, (ncard_pos hX_fin).mpr ⟨_, hm⟩⟩⟩ + choose! idx hidx using hsurj + have ha_X : ∀ i, a i ∈ X := fun i => Or.inl (mem_range_self i) + have hb_X : ∀ i, b i ∈ X := fun i => Or.inr (mem_range_self i) + have hidx_inj : ∀ {x y}, x ∈ X → y ∈ X → x ≠ y → idx x ≠ idx y := by + intro x y hx hy hne e + exact hne ((hidx x hx).symm.trans ((congrArg st e).trans (hidx y hy))) + have hPpath : ∀ x ∈ X, IsGraphPathWithEnds N.G (P (idx x)) x (tm (idx x)) := by + intro x hx + have := (hst (idx x)).1 + rwa [hidx x hx] at this + obtain ⟨hcir, hdisjC, D, hDd, hDs, hDm⟩ := hC + obtain ⟨φ, _, hagree⟩ := P_pres.agrees_Δ + set Γ := P_pres.Γ + have hpt : ∀ v, v ∈ V(N.G) → ∃ p, graphDrawingVertexSet Γ v = {p} := fun v hv => + ⟨_, graphDrawingVertexSet_eq_singleton Γ hv⟩ + have key : ∀ i, ∃ Ra Rb A Q : Graph α β, IsGraphPathWithEnds N.G Q (a i) (b i) ∧ + V(Q) = V(Ra) ∪ V(A) ∪ V(Rb) ∧ V(Ra) ⊆ V(P (idx (a i))) ∧ V(Rb) ⊆ V(P (idx (b i))) ∧ + V(A) ⊆ V(C (Fin.rev i)) ∧ + (∀ m, m < Fin.rev i → Disjoint (V(Ra) ∪ V(Rb)) V(C m)) ∧ + (∀ t, t ≠ idx (a i) → t ≠ idx (b i) → st t ∈ N.Ω.interval (b i) (a i) → + Disjoint V(P t) V(A)) ∧ + ∃ G₁ G₂ : Graph α β, IsGraphSeparation N.G G₁ G₂ ∧ V(G₁) ∩ V(G₂) = V(Q) ∧ + Q ≤ G₁ ∧ N.Ω.interval (a i) (b i) ⊆ V(G₁) ∧ N.Ω.interval (b i) (a i) ⊆ V(G₂) ∧ + N.Ω₀.bar ⊆ V(G₂) := by + intro i + set k := Fin.rev i + have hPa := hPpath (a i) (ha_X i) + have hPb := hPpath (b i) (hb_X i) + have hnonempty : ∀ x, (V(P x) ∩ V(C k)).Nonempty := by + intro x + obtain ⟨u, v, h⟩ := hPC x k + exact ⟨u, by simpa [vertexSet_subgraphInter] using h.left_mem⟩ + obtain ⟨z, hzP, hzC⟩ := hnonempty (idx (a i)) + obtain ⟨z', hzP', hzC'⟩ := hnonempty (idx (b i)) + obtain ⟨y, Ra, hRaP, hRa, hVa⟩ := initialSegmentMeeting (Z := C k) hPa hzP hzC + obtain ⟨y', Rb, hRbP, hRb, hVb⟩ := initialSegmentMeeting (Z := C k) hPb hzP' hzC' + have hne_idx : idx (a i) ≠ idx (b i) := hidx_inj (ha_X i) (hb_X i) (hab i i) + have hd : Disjoint V(Ra) V(Rb) := + (hPd hne_idx).mono hRaP.vertexSet_mono hRbP.vertexSet_mono + obtain ⟨pa, hpa⟩ := hpt (a i) (N.bar_subset (ha_bar i)) + obtain ⟨pb, hpb⟩ := hpt (b i) (N.bar_subset (hb_bar i)) + have hbdp : ∀ {v : α}, v ∈ N.Ω.bar → ∀ {p : EuclideanPlane}, + graphDrawingVertexSet Γ v = {p} → p ∈ subBd P_pres.Δ := by + intro v hv p hp + have := (P_pres.mem_bd_Δ_iff v (N.bar_subset hv)).mpr hv + rwa [hp, singleton_subset_iff] at this + have hpab : pa ≠ pb := by + intro e + exact hab i i (graphDrawingVertexSet_inj Γ (hpa ▸ mem_singleton pa) + (hpb ▸ (e ▸ mem_singleton pb))) + obtain ⟨I₁, I₂, hI₁, hI₂, hId, hIu, hfst, hsnd, -, -⟩ := + exists_open_arcs φ (hbdp (ha_bar i) hpa) (hbdp (hb_bar i) hpb) hpab + have hbdeq : subBd P_pres.Δ = discBd P_pres.Δ := subBd_eq_discBd_plane P_pres.isClosedDisc_Δ + rw [hbdeq] at hIu + have hmem₁ : ∀ c ∈ N.Ω.interval (a i) (b i), ∀ p, graphDrawingVertexSet Γ c = {p} → p ∈ I₁ := by + intro c hc p hp + obtain ⟨t₁, t₂, t₃, h₁₂, h₂₃, h₃₁, e₁, e₂, e₃⟩ := hagree.2 _ _ _ hc.2 + rw [hpa] at e₁ + rw [hpb] at e₃ + rw [hp] at e₂ + have := hfst t₁ t₂ t₃ h₁₂ h₂₃ h₃₁ e₁ e₃ + rwa [show (φ (Circle.exp t₂)).1 = p from e₂] at this + have hmem₂ : ∀ c ∈ N.Ω.interval (b i) (a i), ∀ p, graphDrawingVertexSet Γ c = {p} → p ∈ I₂ := by + intro c hc p hp + obtain ⟨t₁, t₂, t₃, h₁₂, h₂₃, h₃₁, e₁, e₂, e₃⟩ := hagree.2 _ _ _ hc.2 + rw [hpb] at e₁ + rw [hpa] at e₃ + rw [hp] at e₂ + have := hsnd t₁ t₂ t₃ h₁₂ h₂₃ h₃₁ e₁ e₃ + rwa [show (φ (Circle.exp t₂)).1 = p from e₂] at this + obtain ⟨A, A', Q, Q', Y₁, Y₂, Y₁', Y₂', hAC, hVAA', hun, hAle, hA'le, hApath, hA'path, hUAA', + hQ, + hVQ, hQ', hVQ', hUAQ, hUQ', hs, hs', hDA, hDA'⟩ := + exists_detour P_pres (hcir k) (hDd k).1 (hDs k).2 (hDd k).2 (ha_bar i) (hb_bar i) hRa hRb hVa + hVb hd (hab i i) hpa hpb hI₁ hI₂ hId hIu + have hyA : y ∈ V(A) := hApath.left_mem + have hUU : Γ.drawing.U ⊆ P_pres.Δ := P_pres.U_subset.trans sdiff_subset + have hUD : graphDrawingSubgraphU Γ (C k) ⊆ (D k) := by + rw [← (hDd k).2, subBd_eq_discBd_plane (hDd k).1] + exact Surface.discBd_subset _ + obtain ⟨G₁, G₂, hsep, hinter, hQG₁, hY₁, hY₂, -⟩ := exists_separation_of_sides Γ hUU hQ.le hs + have hQV₂ : V(Q) ⊆ V(G₂) := fun v hv => (hinter.symm ▸ hv : v ∈ V(G₁) ∩ V(G₂)).2 + have hQV₁ : V(Q) ⊆ V(G₁) := hQG₁.vertexSet_mono + have hoff : ∀ v ∈ V(N.G), v ∉ V(Q) → ∀ p, graphDrawingVertexSet Γ v = {p} → + p ∉ graphDrawingSubgraphU Γ Q := by + intro v hv hvQ p hp hm + exact Set.disjoint_left.mp (disjoint_graphDrawingVertexSet_subgraphU Γ hQ.le hv hvQ) + (hp ▸ mem_singleton p) hm + refine ⟨Ra, Rb, A, Q, hQ, hVQ, hRaP.vertexSet_mono, hRbP.vertexSet_mono, hAC, ?_, ?_, G₁, G₂, + hsep, hinter, hQG₁, ?_, ?_, ?_⟩ + · intro m hm + exact pairDisjointOfNestedCircuits P_pres s a b ha_bar hb_bar C hcir hdisjC D hDs hDm + hDd hpt i hRa hVa hRb hVb m hm + · intro t ht₁ ht₂ hstt + exact pathDisjointOfDetour P_pres s a b C P hPd hPC st tm hst hst_V idx hcir D hpt i hRaP + hRa hRbP hRb hd I₁ I₂ hmem₂ Y₁' Y₂' hAC hun hAle hA'le hApath hA'path hUAA' hUQ' hs' hDA' + hUU hUD t ht₁ ht₂ hstt + · intro c hc + by_cases hcQ : c ∈ V(Q) + · exact hQV₁ hcQ + · have hcG := N.bar_subset hc.1.1 + obtain ⟨p, hp⟩ := hpt c hcG + refine hY₁ c hcG ?_ + rw [hp, singleton_subset_iff] + exact hs.left ⟨hmem₁ c hc p hp, hoff c hcG hcQ p hp⟩ + · intro c hc + by_cases hcQ : c ∈ V(Q) + · exact hQV₂ hcQ + · have hcG := N.bar_subset hc.1.1 + obtain ⟨p, hp⟩ := hpt c hcG + refine hY₂ c hcG ?_ + rw [hp, singleton_subset_iff] + exact hs.right ⟨hmem₂ c hc p hp, hoff c hcG hcQ p hp⟩ + · intro c hc + by_cases hcQ : c ∈ V(Q) + · exact hQV₂ hcQ + · have hcG := N.bar₀_subset hc + obtain ⟨p, hp⟩ := hpt c hcG + refine hY₂ c hcG ?_ + rw [hp, singleton_subset_iff] + have hpΔ₀ : p ∈ P_pres.Δ₀ := by + have := (isClosedDisc_Δ₀_and_mem_of_mem_bar₀ P_pres hc).2 + have e := graphDrawingVertexSet_eq_singleton Γ hcG + rw [hp] at e + rwa [← singleton_injective e] at this + exact hDA ⟨(hDs k).1 hpΔ₀, fun hm => hoff c hcG hcQ p hp (hUAQ hm)⟩ + choose Ra Rb A Q hQ hVQ hRaP hRbP hAC hout hfar hsep using key + refine ⟨Q, hQ, ?_, hsep⟩ + have hlt : ∀ i j : Fin s, i < j → Disjoint V(Q i) V(Q j) := by + intro i j hij + have hrev : Fin.rev j < Fin.rev i := Fin.rev_lt_rev.mpr hij + have hrevne : Fin.rev j ≠ Fin.rev i := hrev.ne + have hPdisj : ∀ x y, x ∈ X → y ∈ X → x ≠ y → Disjoint V(P (idx x)) V(P (idx y)) := + fun x y hx hy hne => hPd (hidx_inj hx hy hne) + have haa : a i ≠ a j := fun e => hij.ne (hinj_a e) + have hbb : b i ≠ b j := fun e => hij.ne (hinj_b e) + obtain ⟨hc₁, hc₂⟩ := hclock i j hij + have hfar₁ : Disjoint V(P (idx (a j))) V(A i) := by + refine hfar i _ (hidx_inj (ha_X j) (ha_X i) haa.symm) (hidx_inj (ha_X j) (hb_X i) + (hab j i)) ?_ + rw [hidx _ (ha_X j)] + refine ⟨⟨ha_bar j, ?_⟩, hc₁⟩ + rintro (e | e) + · exact hab j i e + · exact haa (e : a j = a i).symm + have hfar₂ : Disjoint V(P (idx (b j))) V(A i) := by + refine hfar i _ (hidx_inj (hb_X j) (ha_X i) (hab i j).symm) (hidx_inj (hb_X j) + (hb_X i) hbb.symm) ?_ + rw [hidx _ (hb_X j)] + refine ⟨⟨hb_bar j, ?_⟩, hc₂⟩ + rintro (e | e) + · exact hbb e.symm + · exact hab i j (e : b j = a i).symm + rw [hVQ i, hVQ j] + have hout' := hout i _ hrev + rw [Set.disjoint_union_left] at hout' + rw [Set.disjoint_left] + rintro v ((h₁ | h₁) | h₁) ((h₂ | h₂) | h₂) + · exact Set.disjoint_left.mp (hPdisj _ _ (ha_X i) (ha_X j) haa) (hRaP i h₁) (hRaP j h₂) + · exact Set.disjoint_left.mp hout'.1 h₁ (hAC j h₂) + · exact Set.disjoint_left.mp (hPdisj _ _ (ha_X i) (hb_X j) (hab i j)) (hRaP i h₁) (hRbP j h₂) + · exact Set.disjoint_left.mp hfar₁ (hRaP j h₂) h₁ + · exact Set.disjoint_left.mp (hdisjC hrevne) (hAC j h₂) (hAC i h₁) + · exact Set.disjoint_left.mp hfar₂ (hRbP j h₂) h₁ + · exact Set.disjoint_left.mp (hPdisj _ _ (hb_X i) (ha_X j) (hab j i).symm) + (hRbP i h₁) (hRaP j h₂) + · exact Set.disjoint_left.mp hout'.2 h₁ (hAC j h₂) + · exact Set.disjoint_left.mp (hPdisj _ _ (hb_X i) (hb_X j) hbb) (hRbP i h₁) (hRbP j h₂) + intro i j hij + rcases lt_or_gt_of_ne hij with h | h + · exact hlt i j h + · exact (hlt j i h).symm + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section10e.lean b/LeanPool/GraphMinor/GM09/Section10e.lean new file mode 100644 index 0000000000..b42b9dcabd --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section10e.lean @@ -0,0 +1,442 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Section10d +public import LeanPool.GraphMinor.GM09.Section6 +public import LeanPool.GraphMinor.GM09.Section7 + +/-! +# Graph Minors IX, (10.3) + +We delete the points of `ΩBar - X` one at a time. The proof of the paper changes the neighborhood at +each step. We keep the presentation of `(G, Ω, Ω₀)` and work with restrictions of `Ω`, since (10.2) +applied to `Ω` gives a separation of `G` that is good for every restriction. + +(5.2) is used for paths that may have internal vertices in `ΩBar`: this is +`Society.theorem_5_2_without_no_internal`. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- A path with a separation at it is separating. -/ +theorem Society.isSeparatingOmegaPath_of_separation (S : Society α β) {Q H₁ H₂ : Graph α β} + {a b : α} (hQ : S.IsOmegaPathWithEnds Q a b) (hsep : IsGraphSeparation S.G H₁ H₂) + (hV : V(H₁) ∩ V(H₂) = V(Q)) (h₁ : S.Ω.interval a b ⊆ V(H₁)) + (h₂ : S.Ω.interval b a ⊆ V(H₂)) : S.IsSeparatingOmegaPath Q := by + refine ⟨⟨a, b, hQ⟩, ?_⟩ + rintro ⟨P', hdisj, v₁, v₃, v₂, v₄, hP₁, hP₂, hcr⟩ + have hav : Disjoint V(P') (V(H₁) ∩ V(H₂)) := hV ▸ hdisj + have hpair : ({v₂, v₄} : Set α) = {a, b} := hP₂.1.pair_ends_eq hQ.1 + have hcr' : (v₁ ∈ S.Ω.interval a b ∧ v₃ ∈ S.Ω.interval b a) ∨ + (v₃ ∈ S.Ω.interval a b ∧ v₁ ∈ S.Ω.interval b a) := by + have hsym : S.Ω.Crosses v₂ v₄ v₁ v₃ := hcr.symm + rcases (Set.pair_eq_pair_iff.mp hpair) with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact S.Ω.crosses_iff_interval.mp hsym + · rcases S.Ω.crosses_iff_interval.mp hsym with h | h + · exact Or.inr ⟨h.2, h.1⟩ + · exact Or.inl ⟨h.2, h.1⟩ + have hc := hP₁.1.isGraphConnected + rcases hcr' with ⟨hu, hw⟩ | ⟨hu, hw⟩ + · have := connected_subset_right_of_avoids_inter hsep hP₁.1.le hc hav ⟨v₃, hP₁.1.right_mem, h₂ hw⟩ + exact (this hP₁.1.left_mem).2 (h₁ hu) + · have := connected_subset_right_of_avoids_inter hsep hP₁.1.le hc hav ⟨v₁, hP₁.1.left_mem, h₂ hw⟩ + exact (this hP₁.1.right_mem).2 (h₁ hu) + +theorem Neighborhood.IsWeaklyLinked.mono {N : Neighborhood α β} {X Z : Set α} + (hX : N.IsWeaklyLinked X) (hZ : Z ⊆ X) : N.IsWeaklyLinked Z := by + classical + obtain ⟨hXb, P, hP, hd⟩ := hX + have hX_fin : X.Finite := N.Ω.finite_bar.subset hXb + have hZ_fin : Z.Finite := hX_fin.subset hZ + choose st tm hst using hP + have hst_X : ∀ i, st i ∈ X := fun i => (hst i).left_mem_X + have hst_V : ∀ i, st i ∈ V(P i) := fun i => (hst i).1.left_mem + let f : Fin X.ncard → X := fun i => ⟨st i, hst_X i⟩ + have finj : Injective f := by + intro i j e + by_contra hne + have e' : st i = st j := congrArg Subtype.val e + exact Set.disjoint_left.mp (hd hne) (hst_V i) (e' ▸ hst_V j) + have : Finite X := hX_fin + have hcard : Nat.card X ≤ Nat.card (Fin X.ncard) := by + rw [Nat.card_coe_set_eq, Nat.card_fin] + have hf := (Function.Injective.bijective_of_nat_card_le finj hcard).2 + have : Finite Z := hZ_fin + have e : Fin Z.ncard ≃ Z := (Finite.equivFinOfCardEq (Nat.card_coe_set_eq Z)).symm + choose idx hidx using fun z : Z => hf ⟨z.1, hZ z.2⟩ + have hidx' : ∀ z : Z, st (idx z) = z.1 := fun z => congrArg Subtype.val (hidx z) + refine ⟨hZ.trans hXb, fun i => P (idx (e i)), fun i => ?_, fun i j hij => ?_⟩ + · refine ⟨st (idx (e i)), tm (idx (e i)), (hst _).1, ?_, (hst _).2.2⟩ + have h := (hst (idx (e i))).2.1 + apply Subset.antisymm + · rintro v ⟨hv, hvZ⟩ + have : v ∈ V(P (idx (e i))) ∩ X := ⟨hv, hZ hvZ⟩ + rwa [h] at this + · rintro _ rfl + exact ⟨hst_V _, by rw [hidx']; exact (e i).2⟩ + · refine hd fun h => hij ?_ + have : e i = e j := by + apply Subtype.ext + rw [← hidx', ← hidx', h] + exact e.injective this + +/-- A sublist of a clockwise list is clockwise. -/ +theorem CyclicPerm.IsClockwiseSeq.sublist {Ω : CyclicPerm α} {L M : List α} + (h : Ω.IsClockwiseSeq L) (hs : M.Sublist L) : Ω.IsClockwiseSeq M := by + obtain ⟨f, hf⟩ := List.sublist_iff_exists_fin_orderEmbedding_get_eq.mp hs + refine CyclicPerm.IsClockwiseSeq.of_isBoundedSubseq h (lo := 0) (hi := L.length) + ⟨Nat.zero_le _, fun i => if hi : i < M.length then (f ⟨i, hi⟩).1 else 0, ?_, ?_⟩ + · intro i hi + simp only [hi, ↓reduceDIte] + refine ⟨(f ⟨i, hi⟩).2, Nat.zero_le _, (f ⟨i, hi⟩).2, ?_⟩ + exact hf ⟨i, hi⟩ + · intro i j hij hj + have hi : i < M.length := hij.trans hj + simp only [hi, hj, ↓reduceDIte] + exact f.strictMono (show (⟨i, hi⟩ : Fin M.length) < ⟨j, hj⟩ from hij) + +/-- A fence of `Ω` with the `a_i` on one side and the `b_i` on the other. -/ +theorem CyclicPerm.exists_isFence_of_ofFn {Ω : CyclicPerm α} {s : ℕ} {a b : Fin (s + 2) → α} + (h : Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) : + ∃ A B : Set α, Ω.IsFence A B ∧ (∀ i, a i ∈ A) ∧ ∀ i, b i ∈ B := by + obtain ⟨hclock, hinj_a, hinj_b, hab, ha_bar, hb_bar⟩ := CyclicPerm.isClockwise3_of_ofFn h + set l : Fin (s + 2) := Fin.last (s + 1) + set z : Fin (s + 2) := 0 + have hzl : z < l := by simp [z, l, Fin.lt_def] + have hne : a l ≠ a z := fun e => hzl.ne (hinj_a e).symm + refine ⟨_, _, Ω.isFence_interval_compl (ha_bar l) (ha_bar z) hne, fun i => ?_, fun i => ?_⟩ + · by_cases hi0 : i = z + · subst hi0 + exact Or.inl (Or.inr rfl) + by_cases hil : i = l + · subst hil + exact Or.inl (Or.inl rfl) + have h1 : z.1 < i.1 := by + have : i.1 ≠ 0 := fun e => hi0 (Fin.ext e) + simp only [z, Fin.val_zero] + omega + have h2 : i.1 < l.1 := by + have : i.1 ≠ s + 1 := fun e => hil (Fin.ext e) + have := i.2 + simp only [l, Fin.val_last] + omega + have hi := i.2 + have hl := l.2 + have hm := Ω.mem_interval_of_lt h (i₁ := s + 2 - 1 - l.1) (i₂ := s + 2 - 1 - i.1) + (i₃ := s + 2 - 1 - z.1) (by omega) (by omega) (by simp; omega) + rw [CyclicPerm.getElem_ofFn_left a b l, CyclicPerm.getElem_ofFn_left a b i, + CyclicPerm.getElem_ofFn_left a b z] at hm + exact Or.inr hm + · have hi := i.2 + have hl := l.2 + have hzv : z.1 = 0 := rfl + have hlv : l.1 = s + 1 := rfl + have hm := Ω.mem_interval_of_lt h (i₁ := s + 2 - 1 - l.1) (i₂ := s + 2 - 1 - z.1) + (i₃ := s + 2 + i.1) (by omega) (by omega) (by simp; omega) + rw [CyclicPerm.getElem_ofFn_left a b l, CyclicPerm.getElem_ofFn_left a b z, + CyclicPerm.getElem_ofFn_right a b i] at hm + exact Ω.mem_interval_rotate_left hm + +/-- A list of known length is a list of values of a function on `Fin`. -/ +theorem List.exists_ofFn_eq {s : ℕ} (l : List α) (hl : l.length = s) : + ∃ f : Fin s → α, List.ofFn f = l := by + subst hl + exact ⟨fun i => l[i], List.ofFn_getElem⟩ + +/-- Elements `a_i`, `b_i` of `X` such that `(a_s, …, a_1, x, b_1, …, b_s)` is clockwise. -/ +theorem CyclicPerm.exists_ofFn_around {Ω : CyclicPerm α} {X : Set α} {x : α} {s : ℕ} + (hX : X ⊆ Ω.bar) (hx : x ∈ Ω.bar) (hxX : x ∉ X) (hcard : 2 * s ≤ X.ncard) : + ∃ a b : Fin s → α, (∀ i, a i ∈ X) ∧ (∀ i, b i ∈ X) ∧ + Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ x :: List.ofFn b) := by + have hWb : insert x X ⊆ Ω.bar := insert_subset hx hX + obtain ⟨L, hlen, hset, h0, hcw⟩ := + Ω.exists_isClockwiseSeq_of_subset_bar hWb (mem_insert x X) + have hXfin : X.Finite := Ω.finite_bar.subset hX + rw [ncard_insert_of_notMem hxX hXfin] at hlen + obtain - | ⟨x', T⟩ := L + · simp at hlen + obtain rfl : x' = x := h0 (by simp) + have hT : T.length = X.ncard := by simpa using hlen + have hTX : ∀ y ∈ T, y ∈ X := by + intro y hy + have hyW : y ∈ insert x' X := by + rw [← hset] + exact List.mem_cons_of_mem _ hy + rcases hyW with rfl | h + · exact absurd hy (List.nodup_cons.mp hcw.1).1 + · exact h + set T₁ := T.take s + set R := T.drop s + have hTeq : T = T₁ ++ R := (List.take_append_drop s T).symm + have hRlen : R.length = T.length - s := List.length_drop .. + set T₃ := R.drop (R.length - s) + have hT₃ : T₃.length = s := by + rw [List.length_drop] + omega + have hT₁ : T₁.length = s := by + rw [List.length_take] + omega + have hcw₁ : Ω.IsClockwiseSeq (R ++ x' :: T₁) := by + have h : Ω.IsClockwiseSeq ((x' :: T₁) ++ R) := by + rw [List.cons_append, ← hTeq] + exact hcw + exact h.append_comm + have hcw₂ : Ω.IsClockwiseSeq (T₃ ++ x' :: T₁) := + hcw₁.sublist ((List.drop_sublist _ R).append_right _) + obtain ⟨a, ha⟩ := List.exists_ofFn_eq T₃.reverse (by simpa using hT₃) + obtain ⟨b, hb⟩ := List.exists_ofFn_eq T₁ hT₁ + refine ⟨a, b, fun i => ?_, fun i => ?_, ?_⟩ + · have : a i ∈ List.ofFn a := (List.mem_ofFn' _ _).mpr ⟨i, rfl⟩ + rw [ha, List.mem_reverse] at this + exact hTX _ ((List.drop_sublist _ R).subset this |> (List.drop_sublist s T).subset) + · have : b i ∈ List.ofFn b := (List.mem_ofFn' _ _).mpr ⟨i, rfl⟩ + rw [hb] at this + exact hTX _ ((List.take_sublist s T).subset this) + · rw [ha, hb, List.reverse_reverse] + exact hcw₂ + +/-- The separation of `G ∪ G₀` given by a separation of `G` with `ΩBar₀` on the second side. -/ +theorem Society.IsComposition.isGraphSeparation_union {S_comp S₀ : Society α β} + {N : Neighborhood α β} (hcomp : S_comp.IsComposition S₀ N) {G₁ G₂ : Graph α β} + (hsep : IsGraphSeparation N.G G₁ G₂) (hbar : N.Ω₀.bar ⊆ V(G₂)) : + IsGraphSeparation S_comp.G G₁ (subgraphUnion S_comp.G G₂ S₀.G) ∧ + V(G₁) ∩ V(subgraphUnion S_comp.G G₂ S₀.G) = V(G₁) ∩ V(G₂) := by + obtain ⟨⟨hs, -⟩, -, hΩ₀, hbarS⟩ := hcomp + have hNG : N.G ≤ S_comp.G := hs.2.1 + have h₀ : S₀.G ≤ S_comp.G := hs.1 + have h₁ : G₁ ≤ S_comp.G := hsep.1.trans hNG + have h₂ : G₂ ≤ S_comp.G := hsep.2.1.trans hNG + refine ⟨⟨h₁, subgraphUnion_le h₂ h₀, ?_, ?_, ?_⟩, ?_⟩ + · rw [vertexSet_subgraphUnion, ← union_assoc, hsep.2.2.1, union_comm, hs.2.2.1] + · rw [edgeSet_subgraphUnion h₂ h₀, ← union_assoc, hsep.2.2.2.1, union_comm, hs.2.2.2.1] + · rw [edgeSet_subgraphUnion h₂ h₀, disjoint_union_right] + exact ⟨hsep.2.2.2.2, (hs.2.2.2.2.mono_right hsep.1.edgeSet_mono).symm⟩ + · rw [vertexSet_subgraphUnion] + apply Subset.antisymm + · rintro v ⟨hv₁, hv | hv⟩ + · exact ⟨hv₁, hv⟩ + · refine ⟨hv₁, hbar ?_⟩ + rw [hΩ₀, hbarS] + exact ⟨hv, hsep.1.vertexSet_mono hv₁⟩ + · exact fun v hv => ⟨hv.1, Or.inl hv.2⟩ + +/-- A subgraph that misses the second side of a separation lies in the first side. -/ +theorem IsGraphSeparation.le_left_of_disjoint {G H₁ H₂ P : Graph α β} + (hsep : IsGraphSeparation G H₁ H₂) (hP : P ≤ G) (hd : Disjoint V(P) V(H₂)) : P ≤ H₁ := by + refine ((Compatible.of_le_le hP hsep.1).le_iff).mpr ⟨fun v hv => ?_, fun e he => ?_⟩ + · have : v ∈ V(H₁) ∪ V(H₂) := by + rw [hsep.2.2.1] + exact hP.vertexSet_mono hv + exact this.resolve_right (Set.disjoint_left.mp hd hv) + · have : e ∈ E(H₁) ∪ E(H₂) := by + rw [hsep.2.2.2.1] + exact hP.edgeSet_mono he + refine this.resolve_right fun he₂ => ?_ + obtain ⟨x, y, hl⟩ : ∃ x y, P.IsLink e x y := exists_isLink_of_mem_edgeSet he + obtain ⟨u, w, hl₂⟩ : ∃ u w, H₂.IsLink e u w := exists_isLink_of_mem_edgeSet he₂ + have hG := hl.mono hP + rcases hG.left_eq_or_eq (hl₂.mono hsep.2.1) with e' | e' + · exact Set.disjoint_left.mp hd hl.left_mem (e' ▸ hl₂.left_mem) + · exact Set.disjoint_left.mp hd hl.left_mem (e' ▸ hl₂.right_mem) + +theorem CyclicPerm.mem_interval_of_around {Ω : CyclicPerm α} {s : ℕ} {a b : Fin (s + 1) → α} + {x : α} (h : Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ x :: List.ofFn b)) : + x ∈ Ω.interval (a 0) (b 0) := by + have hm := Ω.mem_interval_of_lt h (i₁ := s) (i₂ := s + 1) (i₃ := s + 2) (by omega) (by omega) + (by simp) + have e₁ : ((List.ofFn a).reverse ++ x :: List.ofFn b)[s]'(by simp) = a 0 := by + rw [List.getElem_append_left (by simp), List.getElem_reverse] + simp + have e₂ : ((List.ofFn a).reverse ++ x :: List.ofFn b)[s + 1]'(by simp) = x := by + rw [List.getElem_append_right (by simp)] + simp + have e₃ : ((List.ofFn a).reverse ++ x :: List.ofFn b)[s + 2]'(by simp) = b 0 := by + rw [List.getElem_append_right (by simp)] + simp + rwa [e₁, e₂, e₃] at hm + +/-- A separating family in a rural neighborhood gives a transaction in the restricted society. -/ +theorem exists_restricted_separating_transaction + {S_comp S₀ : Society α β} {N : Neighborhood α β} {s : ℕ} {Y : Set α} + (hcomp : S_comp.IsComposition S₀ N) (hY : Y ⊆ S_comp.Ω.bar) + (P_pres : Presentation N) (hNest : ∃ C : Fin (s + 2) → Graph α β, N.IsNest P_pres C) + {a b : Fin (s + 2) → α} (ha : ∀ i, a i ∈ Y) (hb : ∀ i, b i ∈ Y) + (hW : N.IsWeaklyLinked (range a ∪ range b)) + (hL₀ : N.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) : + let S' := S_comp.restrictOmega Y hY + ∃ Q : Fin (s + 2) → Graph α β, Injective Q ∧ + S'.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b) ∧ + (∀ i, S'.IsOmegaPathWithEnds (Q i) (a i) (b i)) ∧ S'.IsTransaction (range Q) ∧ + (∀ i, S'.IsSeparatingOmegaPath (Q i)) ∧ + (∀ i, S'.Ω.interval (a i) (b i) ⊆ S_comp.Ω.interval (a i) (b i) ∧ + S'.Ω.interval (b i) (a i) ⊆ S_comp.Ω.interval (b i) (a i)) ∧ + ∀ i, ∃ G₁ G₂ : Graph α β, IsGraphSeparation N.G G₁ G₂ ∧ V(G₁) ∩ V(G₂) = V(Q i) ∧ + Q i ≤ G₁ ∧ N.Ω.interval (a i) (b i) ⊆ V(G₁) ∧ N.Ω.interval (b i) (a i) ⊆ V(G₂) ∧ + N.Ω₀.bar ⊆ V(G₂) := by + classical + have hΩ : N.Ω = S_comp.Ω := hcomp.2.1 + have hNG : N.G ≤ S_comp.G := hcomp.1.1.2.1 + obtain ⟨Q, hQ, hQd, hQs⟩ := theorem_10_2_proof P_pres hNest hW hL₀ + obtain ⟨-, -, -, hab, -, -⟩ := CyclicPerm.isClockwise3_of_ofFn hL₀ + let S' := S_comp.restrictOmega Y hY + have hR := S_comp.Ω.isRestriction_restrict hY + have hbarS' : S'.Ω.bar = Y := S_comp.Ω.restrict_bar hY + have hcw' : S'.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b) := by + refine hR.isClockwiseSeq_iff.mpr ⟨?_, hΩ ▸ hL₀⟩ + change _ ⊆ S'.Ω.bar + rw [hbarS'] + rintro v hv + simp only [mem_ofPred_eq, List.mem_append, List.mem_reverse, List.mem_ofFn'] at hv + rcases hv with ⟨i, rfl⟩ | ⟨i, rfl⟩ + · exact ha i + · exact hb i + have hendsQ : ∀ i, S'.IsOmegaPathWithEnds (Q i) (a i) (b i) := fun i => + (S_comp.isOmegaPathWithEnds_restrictOmega_iff hY).mpr + ⟨⟨(hQ i).mono hNG, hab i i, hY (ha i), hY (hb i)⟩, ha i, hb i⟩ + have hinj : Function.Injective Q := by + intro i j e + by_contra hne + exact Set.disjoint_left.mp (hQd hne) (hQ i).left_mem (e ▸ (hQ i).left_mem) + have htr : S'.IsTransaction (range Q) := by + obtain ⟨A, B, hf, hA, hB⟩ := CyclicPerm.exists_isFence_of_ofFn (s := s) hcw' + refine ⟨A, B, ⟨?_, ?_⟩, hf, ?_⟩ + · rintro _ ⟨i, rfl⟩ + exact ⟨_, _, hendsQ i⟩ + · rintro _ ⟨i, rfl⟩ _ ⟨j, rfl⟩ hne + exact hQd fun e => hne (congrArg Q e) + · rintro _ ⟨i, rfl⟩ + exact ⟨_, hA i, _, hB i, hendsQ i⟩ + have hint : ∀ i, S'.Ω.interval (a i) (b i) ⊆ S_comp.Ω.interval (a i) (b i) ∧ + S'.Ω.interval (b i) (a i) ⊆ S_comp.Ω.interval (b i) (a i) := fun i => + ⟨(S_comp.Ω.interval_restrict hY _ _ (ha i) (hb i)).subset.trans inter_subset_left, + (S_comp.Ω.interval_restrict hY _ _ (hb i) (ha i)).subset.trans inter_subset_left⟩ + have hsep_Q : ∀ i, S'.IsSeparatingOmegaPath (Q i) := by + intro i + obtain ⟨G₁, G₂, hsep, hinter, -, h₁, h₂, h₀⟩ := hQs i + obtain ⟨hs2, hV2⟩ := hcomp.isGraphSeparation_union hsep h₀ + exact S'.isSeparatingOmegaPath_of_separation (hendsQ i) hs2 (hV2.trans hinter) + ((hint i).1.trans (hΩ ▸ h₁)) ((hint i).2.trans ((hΩ ▸ h₂).trans subset_union_left)) + exact ⟨Q, hinj, hcw', hendsQ, htr, hsep_Q, hint, hQs⟩ + +/-- One step of (10.3): the vertex `x` of `Y - X` can be taken off the ends. -/ +theorem theorem_10_3_step {S_comp S₀ : Society α β} {N : Neighborhood α β} {p : ℕ} {X Y : Set α} + (hp2 : 2 ≤ p) (hp3 : p ≠ 3) (hrural : N.IsRural) (hbreadth : N.HasBreadthGe (p + 4)) + (hX : N.IsWeaklyLinked X) (hcard : 2 * p + 8 ≤ X.ncard) (hcomp : S_comp.IsComposition S₀ N) + (hXY : X ⊆ Y) (hY : Y ⊆ S_comp.Ω.bar) {x : α} (hxY : x ∈ Y) (hxX : x ∉ X) + {P₀ : Set (Graph α β)} (hP₀ : S_comp.IsCrookedTransaction P₀) (hp : p ≤ P₀.ncard) + (hends : S_comp.transactionEnds P₀ ⊆ Y) : + ∃ P' : Set (Graph α β), S_comp.IsCrookedTransaction P' ∧ p ≤ P'.ncard ∧ + S_comp.transactionEnds P' ⊆ Y \ {x} := by + classical + obtain ⟨P_pres, C, hC⟩ := hbreadth + have hΩ : N.Ω = S_comp.Ω := hcomp.2.1 + have hXb : X ⊆ N.Ω.bar := hX.1 + obtain ⟨a, b, ha, hb, hL⟩ := CyclicPerm.exists_ofFn_around (s := p + 4) hXb + (hΩ ▸ hY hxY : x ∈ N.Ω.bar) hxX (by omega) + have hL₀ : N.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b) := + hL.sublist (List.Sublist.append_left (List.sublist_cons_self _ _) _) + have hW : N.IsWeaklyLinked (range a ∪ range b) := hX.mono <| by + rintro _ (⟨i, rfl⟩ | ⟨i, rfl⟩) + · exact ha i + · exact hb i + let S' := S_comp.restrictOmega Y hY + have hbarS' : S'.Ω.bar = Y := S_comp.Ω.restrict_bar hY + obtain ⟨Q, hinj, hcw', hendsQ, htr, hsep_Q, hint, hQs⟩ := + exists_restricted_separating_transaction (s := p + 2) hcomp hY P_pres ⟨C, hC⟩ + (fun i => hXY (ha i)) (fun i => hXY (hb i)) hW hL₀ + let t : Fin (p + 4) := ⟨p + 3, by omega⟩ + obtain ⟨G₁, G₂, hsep, hinter, -, h₁, h₂, h₀⟩ := hQs t + obtain ⟨hs2, hV2⟩ := hcomp.isGraphSeparation_union hsep h₀ + have hs2' : IsGraphSeparation S_comp.G G₁ (subgraphUnion S_comp.G G₂ S₀.G) := hs2 + rcases S'.theorem_5_2_without_no_internal hp2 hp3 + ⟨P₀, (S_comp.isCrookedTransaction_restrictOmega_iff hY).mpr ⟨hP₀, hends⟩, hp⟩ hinj htr hsep_Q + hendsQ hcw' hs2 (hV2.trans hinter) ((hint t).1.trans (hΩ ▸ h₁)) + ((hint t).2.trans ((hΩ ▸ h₂).trans subset_union_left)) with + ⟨P₁, P₂, ⟨hdisj, s₁, t₁, s₂, t₂, hP₁, hP₂, hc⟩, hd₁, hd₂⟩ | ⟨P', hcr, hcard', hdis⟩ + · exfalso + have hlift : ∀ {R : Graph α β} {u w : α}, S'.IsOmegaPathWithEnds R u w → + Disjoint V(R) V(subgraphUnion S_comp.G G₂ S₀.G) → + u ≠ w → u ∈ N.Ω.bar → w ∈ N.Ω.bar → + ({ G := N.G, Ω := N.Ω, finite_V := N.finite_V, finite_E := N.finite_E, + bar_subset := N.bar_subset } : Society α β).IsOmegaPathWithEnds R u w := by + intro R u w hR hd hne hu hw + have hle : R ≤ G₁ := IsGraphSeparation.le_left_of_disjoint hs2' hR.1.le hd + exact ⟨hR.1.of_le (hle.trans hsep.1), hne, hu, hw⟩ + have hYN : ∀ {v}, v ∈ S'.Ω.bar → v ∈ N.Ω.bar := fun {v} hv => by + rw [hbarS'] at hv + exact hΩ ▸ hY hv + exact not_omegaPathsCross_of_isRural hrural ⟨hdisj, s₁, t₁, s₂, t₂, + hlift hP₁ hd₁ hP₁.2.1 (hYN hP₁.2.2.1) (hYN hP₁.2.2.2), + hlift hP₂ hd₂ hP₂.2.1 (hYN hP₂.2.2.1) (hYN hP₂.2.2.2), + show N.Ω.Crosses s₁ t₁ s₂ t₂ by + rw [hΩ] + exact ((S_comp.Ω.crosses_restrict_iff hY).mp hc).2.2.2.2⟩ + · obtain ⟨hcS, hsub⟩ := (S_comp.isCrookedTransaction_restrictOmega_iff hY).mp hcr + refine ⟨P', hcS, hcard'.ge, fun v hv => ⟨hsub hv, ?_⟩⟩ + rintro rfl + have hx : v ∈ S_comp.Ω.interval (a 0) (b 0) := hΩ ▸ CyclicPerm.mem_interval_of_around hL + have hx' : v ∈ S'.Ω.interval (a ⟨0, by omega⟩) (b ⟨0, by omega⟩) := by + change v ∈ (S_comp.Ω.restrict Y hY).interval _ _ + rw [S_comp.Ω.interval_restrict hY _ _ (hXY (ha _)) (hXY (hb _))] + exact ⟨hx, hxY⟩ + refine Set.disjoint_left.mp hdis hx' ?_ + rwa [S_comp.transactionEnds_restrictOmega_eq hY hsub] + +/-- **Graph Minors IX, (10.3)** (page 64): +"Let $p \ge 2$ with $p \ne 3$. Let $(G, \Omega, \Omega_0)$ be a rural neighborhood of breadth +$\ge p + 4$, and let $X \subseteq \bar{\Omega}$ be weakly-linked, with $|X| \ge 2p + 8$." -/ +theorem theorem_10_3_proof {S_comp S₀ : Society α β} {N : Neighborhood α β} {p : ℕ} {X : Set α} + (hp2 : 2 ≤ p) (hp3 : p ≠ 3) (hrural : N.IsRural) (hbreadth : N.HasBreadthGe (p + 4)) + (hX : N.IsWeaklyLinked X) (hcard : 2 * p + 8 ≤ X.ncard) (hcomp : S_comp.IsComposition S₀ N) + {P₀ : Set (Graph α β)} (hP₀ : S_comp.IsCrookedTransaction P₀) (hp : p ≤ P₀.ncard) : + ∃ P' : Set (Graph α β), S_comp.IsCrookedTransaction P' ∧ p ≤ P'.ncard ∧ + S_comp.transactionEnds P' ⊆ X := by + have hΩ : N.Ω = S_comp.Ω := hcomp.2.1 + have hXb : X ⊆ S_comp.Ω.bar := hΩ ▸ hX.1 + have hfin : S_comp.Ω.bar.Finite := S_comp.Ω.finite_bar + have key : ∀ (n : ℕ) (Y : Set α), (Y \ X).ncard = n → X ⊆ Y → Y ⊆ S_comp.Ω.bar → + ∀ P₁ : Set (Graph α β), S_comp.IsCrookedTransaction P₁ → p ≤ P₁.ncard → + S_comp.transactionEnds P₁ ⊆ Y → + ∃ P' : Set (Graph α β), S_comp.IsCrookedTransaction P' ∧ p ≤ P'.ncard ∧ + S_comp.transactionEnds P' ⊆ X := by + intro n + induction n with + | zero => + intro Y hn _ hY P₁ hP₁ hp₁ hends + have hYX : Y \ X = ∅ := (ncard_eq_zero (hfin.subset (sdiff_subset.trans hY))).mp hn + exact ⟨P₁, hP₁, hp₁, hends.trans (sdiff_eq_empty.mp hYX)⟩ + | succ n ih => + intro Y hn hXY hY P₁ hP₁ hp₁ hends + obtain ⟨x, hxY, hxX⟩ : (Y \ X).Nonempty := by + rw [← Set.ncard_pos (hfin.subset (sdiff_subset.trans hY))] + omega + obtain ⟨P₂, hP₂, hp₂, hends₂⟩ := theorem_10_3_step hp2 hp3 hrural hbreadth hX hcard hcomp hXY + hY hxY hxX hP₁ hp₁ hends + refine ih (Y \ {x}) ?_ (fun v hv => ⟨hXY hv, fun e => hxX (e ▸ hv)⟩) + (sdiff_subset.trans hY) P₂ hP₂ hp₂ hends₂ + have hsets : (Y \ {x}) \ X = (Y \ X) \ {x} := by + ext v + simp only [mem_sdiff, mem_singleton_iff] + tauto + rw [hsets, ncard_sdiff_singleton_of_mem (show x ∈ Y \ X from ⟨hxY, hxX⟩), hn] + rfl + exact key _ _ rfl hXb Subset.rfl P₀ hP₀ hp fun v hv => by + obtain ⟨P, hP, b, hb⟩ := hv + exact hb.2.2.1 + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section10f.lean b/LeanPool/GraphMinor/GM09/Section10f.lean new file mode 100644 index 0000000000..68b0c1c94c --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section10f.lean @@ -0,0 +1,268 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Section10e +public import LeanPool.GraphMinor.GM09.Section9 +import LeanPool.GraphMinor.GM16.CircleListing +import LeanPool.GraphMinor.GM16.CyclicOrderTransport + +/-! +# Graph Minors IX, (10.4): tools + +This file has the three tools that (10.4) needs. + +* A crooked transaction stays crooked when its paths are extended and the crossings of its ends do + not change: `Society.isCrookedTransaction_image`. +* The finite set of vertices of a circuit has a cyclic order that agrees with its drawing: + `exists_cyclicPerm_agrees_of_injOn`. +* A disc bounded by a circuit splits the drawn graph: `exists_separation_of_disc`. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + GraphMinor.GM16 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- If each path of a crooked transaction is replaced by a path with new ends, the new paths are +disjoint, and crossings of the ends do not change, then the new set is a crooked transaction. -/ +theorem Society.isCrookedTransaction_image {S₁ S : Society α β} {T : Set (Graph α β)} + (hT : S₁.IsCrookedTransaction T) {ψ : α → α} {f : Graph α β → Graph α β} + (hends : ∀ P ∈ T, ∀ a b, S₁.IsOmegaPathWithEnds P a b → + S.IsOmegaPathWithEnds (f P) (ψ a) (ψ b)) + (hd : ∀ P ∈ T, ∀ P' ∈ T, P ≠ P' → Disjoint V(f P) V(f P')) + (hinj : InjOn ψ (S₁.transactionEnds T)) + (hcr : ∀ a ∈ S₁.transactionEnds T, ∀ b ∈ S₁.transactionEnds T, ∀ c ∈ S₁.transactionEnds T, + ∀ d ∈ S₁.transactionEnds T, a ≠ b → a ≠ c → a ≠ d → b ≠ c → b ≠ d → c ≠ d → + (S₁.Ω.Crosses a b c d ↔ S.Ω.Crosses (ψ a) (ψ b) (ψ c) (ψ d))) : + S.IsCrookedTransaction (f '' T) := by + set W := S₁.transactionEnds T + obtain ⟨A₀, B₀, hdis, hfe, hab⟩ := hT.1 + have hψW : ∀ a ∈ W, ψ a ∈ S.transactionEnds (f '' T) := by + rintro a ⟨P, hP, b, hPab⟩ + exact ⟨f P, mem_image_of_mem f hP, ψ b, hends P hP a b hPab⟩ + have hW_sub : ψ '' W ⊆ S.Ω.bar := + image_subset_iff.mpr fun a ha => S.transactionEnds_subset_bar _ (hψW a ha) + have hWb : W ⊆ S₁.Ω.bar := S₁.transactionEnds_subset_bar T + set Y := ψ '' W + have hbarY : (S.Ω.restrict Y hW_sub).bar = Y := S.Ω.restrict_bar hW_sub + have hfence' : (S.Ω.restrict Y hW_sub).IsFence (ψ '' (W ∩ A₀)) (ψ '' (W ∩ B₀)) := by + have hA' : ψ '' (W ∩ A₀) ⊆ Y := image_mono inter_subset_left + have hB' : ψ '' (W ∩ B₀) ⊆ Y := image_mono inter_subset_left + have hdAB : Disjoint A₀ B₀ := hfe.2.2.1 + refine ⟨hbarY.symm ▸ hA', hbarY.symm ▸ hB', ?_, ?_, ?_⟩ + · rw [Set.disjoint_left] + rintro _ ⟨a, ⟨haW, haA⟩, rfl⟩ ⟨b, ⟨hbW, hbB⟩, e⟩ + exact Set.disjoint_left.mp hdAB haA (hinj haW hbW e.symm ▸ hbB) + · rw [hbarY, ← image_union, ← inter_union_distrib_left] + have : W ⊆ A₀ ∪ B₀ := by + rw [hfe.2.2.2.1] + exact hWb + rw [inter_eq_left.mpr this] + · rintro _ ⟨a₁, ⟨ha₁, hA₁⟩, rfl⟩ _ ⟨a₂, ⟨ha₂, hA₂⟩, rfl⟩ hne _ ⟨b₁, ⟨hb₁, hB₁⟩, rfl⟩ + _ ⟨b₂, ⟨hb₂, hB₂⟩, rfl⟩ hne' hc + have hc' := ((S.Ω.crosses_restrict_iff hW_sub).mp hc).2.2.2.2 + have hna : a₁ ≠ a₂ := fun e => hne (congrArg ψ e) + have hnb : b₁ ≠ b₂ := fun e => hne' (congrArg ψ e) + have hdist : ∀ {x y}, x ∈ A₀ → y ∈ B₀ → x ≠ y := fun hx hy e => + Set.disjoint_left.mp hdAB hx (e ▸ hy) + exact hfe.2.2.2.2 a₁ hA₁ a₂ hA₂ hna b₁ hB₁ b₂ hB₂ hnb + ((hcr a₁ ha₁ a₂ ha₂ b₁ hb₁ b₂ hb₂ hna (hdist hA₁ hB₁) (hdist hA₁ hB₂) (hdist hA₂ hB₁) + (hdist hA₂ hB₂) hnb).mpr hc') + obtain ⟨A, B, hfence, hA, hB⟩ := S.Ω.exists_isFence_of_restrict hW_sub hfence' + refine ⟨⟨A, B, ⟨?_, ?_⟩, hfence, ?_⟩, ?_⟩ + · rintro _ ⟨P, hP, rfl⟩ + obtain ⟨a, -, b, -, hPab⟩ := hab P hP + exact ⟨_, _, hends P hP a b hPab⟩ + · rintro _ ⟨P, hP, rfl⟩ _ ⟨P', hP', rfl⟩ hne + exact hd P hP P' hP' fun e => hne (congrArg f e) + · rintro _ ⟨P, hP, rfl⟩ + obtain ⟨a, haA, b, hbB, hPab⟩ := hab P hP + exact ⟨ψ a, hA ⟨a, ⟨⟨P, hP, b, hPab⟩, haA⟩, rfl⟩, ψ b, + hB ⟨b, ⟨⟨P, hP, a, IsOmegaPathWithEnds.symm S₁ hPab⟩, hbB⟩, rfl⟩, hends P hP a b hPab⟩ + · rintro _ ⟨P, hP, rfl⟩ ⟨-, a', b', hP', hdisj⟩ + obtain ⟨a, -, b, -, hPab⟩ := hab P hP + have haW : a ∈ W := ⟨P, hP, b, hPab⟩ + have hbW : b ∈ W := ⟨P, hP, a, IsOmegaPathWithEnds.symm S₁ hPab⟩ + have hnot : ¬ (Disjoint (S₁.Ω.interval a b) W ∨ Disjoint (S₁.Ω.interval b a) W) := fun h => + hT.2 P hP ⟨hP, a, b, hPab, h⟩ + push Not at hnot + obtain ⟨hn₁, hn₂⟩ := hnot + obtain ⟨c, hc, hcW⟩ := Set.not_disjoint_iff.mp hn₁ + obtain ⟨d, hd', hdW⟩ := Set.not_disjoint_iff.mp hn₂ + have hab_ne : a ≠ b := hPab.2.1 + have hne_c : c ≠ a ∧ c ≠ b := by + refine ⟨fun e => hc.1.2 (Or.inl e), fun e => hc.1.2 (Or.inr e)⟩ + have hne_d : d ≠ b ∧ d ≠ a := by + refine ⟨fun e => hd'.1.2 (Or.inl e), fun e => hd'.1.2 (Or.inr e)⟩ + have hcd : c ≠ d := fun e => + Set.disjoint_right.mp (S₁.Ω.isFence_interval_compl (hWb haW) (hWb hbW) hab_ne).2.2.1 (e ▸ hd') + (Or.inr hc) + have hcross : S₁.Ω.Crosses a b c d := S₁.Ω.crosses_iff_interval.mpr (Or.inl ⟨hc, hd'⟩) + have hcross' := (hcr a haW b hbW c hcW d hdW hab_ne hne_c.1.symm hne_d.2.symm hne_c.2.symm + hne_d.1.symm hcd).mp hcross + have hboth : (S.Ω.interval (ψ a) (ψ b) ∩ S.transactionEnds (f '' T)).Nonempty ∧ + (S.Ω.interval (ψ b) (ψ a) ∩ S.transactionEnds (f '' T)).Nonempty := by + rcases S.Ω.crosses_iff_interval.mp hcross' with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact ⟨⟨_, h₁, hψW c hcW⟩, ⟨_, h₂, hψW d hdW⟩⟩ + · exact ⟨⟨_, h₁, hψW d hdW⟩, ⟨_, h₂, hψW c hcW⟩⟩ + have hbad : ∀ {u w : α}, (S.Ω.interval u w ∩ S.transactionEnds (f '' T)).Nonempty → + ¬ Disjoint (S.Ω.interval u w) (S.transactionEnds (f '' T)) := + fun ⟨x, h₁, h₂⟩ h => Set.disjoint_left.mp h h₁ h₂ + rcases IsOmegaPathWithEnds.ends_eq S (hends P hP a b hPab) hP' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rcases hdisj with h | h + · exact hbad hboth.1 h + · exact hbad hboth.2 h + · rcases hdisj with h | h + · exact hbad hboth.2 h + · exact hbad hboth.1 h + +/-- A finite set of vertices with distinct points on a circle has a cyclic order that agrees with a +given parametrization of the circle. -/ +theorem exists_cyclicPerm_agrees_of_injOn {S : Type*} [TopologicalSpace S] {F : Set S} + (φ : Circle ≃ₜ F) (ν : α → S) {Y : Set α} (hY : Y.Finite) (hNe : Y.Nonempty) + (hinj : InjOn ν Y) (hYF : ∀ v ∈ Y, ν v ∈ F) : + ∃ Ω : CyclicPerm α, Ω.bar = Y ∧ AgreesWithOArcHomeo ν Ω F φ := + GM16.exists_cyclicPerm_from_circle φ ν hY hNe hinj hYF + +/-- A closed disc whose boundary is the drawing of `K` splits the drawn graph at `V(K)`. -/ +theorem exists_separation_of_disc {G K : Graph α β} (Γ : GraphDrawing G EuclideanPlane) + {Δ D : Set EuclideanPlane} (hΔ : IsClosed Δ) (hU : Γ.drawing.U ⊆ Δ) (hK : K ≤ G) + (hD : IsClosedDisc D) (hDΔ : D ⊆ Δ) (hbd : subBd D = graphDrawingSubgraphU Γ K) : + ∃ H₁ H₂ : Graph α β, IsGraphSeparation G H₁ H₂ ∧ V(H₁) ∩ V(H₂) = V(K) ∧ K ≤ H₁ ∧ + (∀ v ∈ V(G), graphDrawingVertexSet Γ v ⊆ D \ subBd D → v ∈ V(H₁)) ∧ + (∀ v ∈ V(G), graphDrawingVertexSet Γ v ⊆ Δ \ D → v ∈ V(H₂)) ∧ + graphDrawingSubgraphU Γ H₁ ⊆ D ∧ graphDrawingSubgraphU Γ H₂ ⊆ Δ \ interior D := by + have hfr : frontier D = subBd D := by + rw [frontier_eq_discBd_plane hD, subBd_eq_discBd_plane hD] + have hcl : IsClosed D := isClosed_of_isClosedDisc hD + have hint : D \ subBd D = interior D := by + rw [← hfr, hcl.frontier_eq, sdiff_sdiff_cancel_left interior_subset] + have hsides : IsArcSides Δ (graphDrawingSubgraphU Γ K) ∅ ∅ (D \ subBd D) (Δ \ D) := by + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · rw [← hbd] + ext x + constructor + · rintro (⟨h₁, h₂⟩ | ⟨h₁, h₂⟩) + · exact ⟨hDΔ h₁, h₂⟩ + · exact ⟨h₁, fun h => h₂ (subBd_subset_of_isClosed hcl h)⟩ + · rintro ⟨h₁, h₂⟩ + by_cases hx : x ∈ D + · exact Or.inl ⟨hx, h₂⟩ + · exact Or.inr ⟨h₁, hx⟩ + · rw [Set.disjoint_left] + rintro x ⟨h₁, -⟩ ⟨-, h₂⟩ + exact h₂ h₁ + · intro Z hZ hc + have hopen₁ : IsOpen (D \ subBd D) := by + rw [hint] + exact isOpen_interior + have hdisj : Disjoint (D \ subBd D) Dᶜ := Set.disjoint_left.mpr fun x h₁ h₂ => h₂ h₁.1 + have hcov : Z ⊆ (D \ subBd D) ∪ Dᶜ := by + intro x hx + by_cases hxD : x ∈ D + · refine Or.inl ⟨hxD, fun h => (hZ hx).2 ?_⟩ + rwa [← hbd] + · exact Or.inr hxD + rcases hc.subset_or_subset hopen₁ hcl.isOpen_compl hdisj hcov with h | h + · left + rw [hbd] at h ⊢ + exact h + · right + exact fun x hx => ⟨(hZ hx).1, h hx⟩ + · simp + · simp + obtain ⟨H₁, H₂, hsep, hcut, hKH₁, hY₁, hY₂, hV₁, hV₂, hE₁, hE₂⟩ := + exists_separation_of_sides Γ hU hK hsides + have hKD : graphDrawingSubgraphU Γ K ⊆ D := by + rw [← hbd] + exact subBd_subset_of_isClosed hcl + have hΔ_cl : IsClosed Δ := hΔ + refine ⟨H₁, H₂, hsep, hcut, hKH₁, hY₁, hY₂, ?_, ?_⟩ + · rintro x (hx | hx) + · obtain ⟨v, hv, hxv⟩ := mem_iUnion₂.mp hx + rcases hV₁ v hv with h | h + · exact hKD (graphDrawingVertexSet_subset_subgraphU_of_mem Γ h hxv) + · exact (h hxv).1 + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + rcases hE₁ e he with h | h + · exact hKD (Or.inr (mem_iUnion₂.mpr ⟨e, h, hxe⟩)) + · exact closure_minimal (h.trans sdiff_subset) hcl hxe + · have hint' : Disjoint (interior D) (graphDrawingSubgraphU Γ K) := by + rw [← hbd, ← hint] + exact Set.disjoint_left.mpr fun x h₁ h₂ => h₁.2 h₂ + have hKΔ : graphDrawingSubgraphU Γ K ⊆ Δ := hKD.trans hDΔ + have hnot : ∀ {x}, x ∈ graphDrawingSubgraphU Γ K → x ∈ Δ \ interior D := fun hx => + ⟨hKΔ hx, fun h => Set.disjoint_left.mp hint' h hx⟩ + rintro x (hx | hx) + · obtain ⟨v, hv, hxv⟩ := mem_iUnion₂.mp hx + rcases hV₂ v hv with h | h + · exact hnot (graphDrawingVertexSet_subset_subgraphU_of_mem Γ h hxv) + · exact ⟨(h hxv).1, fun hi => (h hxv).2 (interior_subset hi)⟩ + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + have hsub := hE₂ e he + refine ⟨closure_minimal (hsub.trans sdiff_subset) hΔ_cl hxe, fun hi => ?_⟩ + have : closure (graphDrawingEdgeSet Γ e) ⊆ (interior D)ᶜ := + closure_minimal (fun y hy hyi => (hsub hy).2 (interior_subset hyi)) + isOpen_interior.isClosed_compl + exact this hxe hi + +/-- A path whose only vertex in the cut is its last vertex, and whose first vertex is on the second +side, lies in the second side. -/ +theorem IsGraphPathWithEnds.le_right_of_inter_subset {G H₁ H₂ R : Graph α β} {a z : α} + (hsep : IsGraphSeparation G H₁ H₂) (hR : IsGraphPathWithEnds G R a z) + (hV : V(R) ∩ (V(H₁) ∩ V(H₂)) ⊆ {z}) (ha : a ∈ V(H₂)) (hz : z ∈ V(H₂)) : R ≤ H₂ := by + have hvert : ∀ w ∈ V(R), w ∈ V(H₂) := by + intro w hw + by_cases hwz : w = z + · exact hwz ▸ hz + obtain ⟨R₁, R₂, hR₁, -, hp₁, hp₂, -, hVi, -⟩ := hR.exists_split_at hw + have hzR₁ : z ∉ V(R₁) := fun h => by + have : z ∈ V(R₁) ∩ V(R₂) := ⟨h, hp₂.right_mem⟩ + rw [hVi] at this + exact hwz this.symm + have hle : R₁ ≤ G := hR₁.trans hR.le + have hav : Disjoint V(R₁) (V(H₁) ∩ V(H₂)) := by + rw [Set.disjoint_left] + intro x hx hxc + have := hV ⟨hR₁.vertexSet_mono hx, hxc⟩ + exact hzR₁ ((show x = z from this) ▸ hx) + have := Society.connected_subset_right_of_avoids_inter hsep hle hp₁.isGraphConnected hav + ⟨a, hp₁.left_mem, ha⟩ + exact (this hp₁.right_mem).1 + refine (Compatible.of_le_le hR.le hsep.2.1).le_iff.mpr ⟨hvert, fun e he => ?_⟩ + obtain ⟨u, w, hl⟩ : ∃ u w, R.IsLink e u w := exists_isLink_of_mem_edgeSet he + have hG : e ∈ E(H₁) ∪ E(H₂) := by + rw [hsep.2.2.2.1] + exact hR.le.edgeSet_mono he + refine hG.resolve_left fun he₁ => ?_ + obtain ⟨x, y, hl₁⟩ : ∃ x y, H₁.IsLink e x y := exists_isLink_of_mem_edgeSet he₁ + have hl₁' := hl₁.mono hsep.1 + have hlG := hl.mono hR.le + have hu₁ : u ∈ V(H₁) := by + rcases hlG.left_eq_or_eq hl₁' with e' | e' + · exact e' ▸ hl₁.left_mem + · exact e' ▸ hl₁.right_mem + have hw₁ : w ∈ V(H₁) := by + rcases hlG.symm.left_eq_or_eq hl₁' with e' | e' + · exact e' ▸ hl₁.left_mem + · exact e' ▸ hl₁.right_mem + have hu : u = z := hV ⟨hl.left_mem, hu₁, hvert u hl.left_mem⟩ + have hw : w = z := hV ⟨hl.right_mem, hw₁, hvert w hl.right_mem⟩ + subst hu + subst hw + exact hR.not_isLoopAt he _ (hl.mono hR.le) + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section10g.lean b/LeanPool/GraphMinor/GM09/Section10g.lean new file mode 100644 index 0000000000..e3ed084e35 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section10g.lean @@ -0,0 +1,852 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Section10f + +/-! +# Graph Minors IX, (10.4) + +We follow the proof of the paper. We first delete edges at `ΩBar` and apply (10.1), so that the nest +misses `ΩBar` and each linking path meets `ΩBar` only at its first vertex. The last circuit `K` of +the +nest bounds a disc `D`. The drawing of `G` splits at `K` into the part `H₁` in `D` and the part +`H₂` outside. We apply (9.1) and (10.3) to the part in `D`, and then extend the paths we get along +the linking paths. + +The paper says that the extended paths form a crooked transaction but gives no reason. Their ends +cross if and only if the old ends cross, by `crosses_outer_iff_crosses_inner_of_disjoint_paths` +applied to the rural neighborhood `(H₂, Ω, Ω₁)`. Then `Society.isCrookedTransaction_image` applies. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- Agreement with a circle depends only on where the vertices of `ΩBar` are drawn. -/ +theorem DrawingAgreesWithOArcHomeo.congr {G G' : Graph α β} {Γ : GraphDrawing G EuclideanPlane} + {Γ' : GraphDrawing G' EuclideanPlane} {Ω : CyclicPerm α} {F : Set EuclideanPlane} + {φ : Circle ≃ₜ F} (h : DrawingAgreesWithOArcHomeo Γ Ω F φ) + (hv : ∀ v ∈ Ω.bar, graphDrawingVertexSet Γ' v = graphDrawingVertexSet Γ v) : + DrawingAgreesWithOArcHomeo Γ' Ω F φ := by + refine ⟨fun v hv' => ?_, fun v₁ v₂ v₃ hc => ?_⟩ + · rw [hv v hv'] + exact h.1 v hv' + · have hm := CyclicPerm.isClockwise3_iff.mp hc + rw [hv v₁ hm.2.2.2.1, hv v₂ hm.2.2.2.2.1, hv v₃ hm.2.2.2.2.2.1] + exact h.2 _ _ _ hc + +/-- A presentation of a neighborhood whose graph is a subgraph of `G`, read off from a presentation +with graph `G`. -/ +theorem Presentation.exists_of_le {N N' : Neighborhood α β} (P_pres : Presentation N) + (hG : N'.G ≤ N.G) {Δ' Δ₀' : Set EuclideanPlane} (hΔ' : IsClosedDisc Δ') (hsub : Δ₀' ⊆ Δ') + (hU : graphDrawingSubgraphU P_pres.Γ N'.G ⊆ Δ' \ interior Δ₀') + (hbd : ∀ v ∈ V(N'.G), (graphDrawingVertexSet P_pres.Γ v ⊆ subBd Δ' ↔ v ∈ N'.Ω.bar)) + (hbd₀ : ∀ v ∈ V(N'.G), (graphDrawingVertexSet P_pres.Γ v ⊆ subBd Δ₀' ↔ v ∈ N'.Ω₀.bar)) + (hag : ∃ φ : Circle ≃ₜ subBd Δ', + IsClockwiseDiscHomeo Δ' φ ∧ DrawingAgreesWithOArcHomeo P_pres.Γ N'.Ω (subBd Δ') φ) + (hag₀ : (Δ₀' = ∅ ∧ N'.Ω₀.bar = ∅) ∨ (IsClosedDisc Δ₀' ∧ ∃ φ₀ : Circle ≃ₜ subBd Δ₀', + IsClockwiseDiscHomeo Δ₀' φ₀ ∧ DrawingAgreesWithOArcHomeo P_pres.Γ N'.Ω₀ (subBd Δ₀') φ₀)) : + ∃ P' : Presentation N', P'.Δ = Δ' ∧ P'.Δ₀ = Δ₀' ∧ + (∀ v ∈ V(N'.G), graphDrawingVertexSet P'.Γ v = graphDrawingVertexSet P_pres.Γ v) ∧ + ∀ R ≤ N'.G, graphDrawingSubgraphU P'.Γ R = graphDrawingSubgraphU P_pres.Γ R := by + obtain ⟨Γ', hU'_eq, -, -, -, hvert, -, hsubg⟩ := GraphDrawing.ofSubgraph P_pres.Γ hG + obtain ⟨φ, hφ_cw, hφ⟩ := hag + refine ⟨⟨Γ', Δ', Δ₀', hΔ', hsub, hU'_eq ▸ hU, fun v hv => ?_, fun v hv => ?_, + ⟨φ, hφ_cw, ?_⟩, ?_⟩, rfl, rfl, hvert, hsubg⟩ + · rw [hvert v hv] + exact hbd v hv + · rw [hvert v hv] + exact hbd₀ v hv + · exact hφ.congr fun v hv => hvert v (N'.bar_subset hv) + · rcases hag₀ with h | ⟨h, φ₀, hφ₀_cw, hφ₀⟩ + · exact Or.inl h + · exact Or.inr ⟨h, φ₀, hφ₀_cw, hφ₀.congr fun v hv => hvert v (N'.bar₀_subset hv)⟩ + +/-- With two circuits in a nest, no vertex is on both boundaries. -/ +theorem disjoint_bar_bar₀_of_isNest {N : Neighborhood α β} {P_pres : Presentation N} {m : ℕ} + {C : Fin m → Graph α β} (hC : N.IsNest P_pres C) (hm : 2 ≤ m) : + Disjoint N.Ω.bar N.Ω₀.bar := by + rw [Set.disjoint_left] + intro v hv hv₀ + have hlt : (⟨0, by omega⟩ : Fin m) < ⟨1, by omega⟩ := by simp [Fin.lt_def] + have hdis := disjoint_vertexSet_bar_of_isNest_lt hC hlt + obtain ⟨hcir, -, D, hDd, hDs, -⟩ := hC + set j : Fin m := ⟨0, by omega⟩ + have hvG := N.bar_subset hv + have hbdΔ := (P_pres.mem_bd_Δ_iff v hvG).mpr hv + have hD : graphDrawingVertexSet P_pres.Γ v ⊆ D j := by + rw [graphDrawingVertexSet_eq_singleton P_pres.Γ hvG, singleton_subset_iff] + exact (hDs j).1 (isClosedDisc_Δ₀_and_mem_of_mem_bar₀ P_pres hv₀).2 + have hbdD : graphDrawingVertexSet P_pres.Γ v ⊆ graphDrawingSubgraphU P_pres.Γ (C j) := by + rw [← (hDd j).2] + exact (subset_inter hD hbdΔ).trans (inter_subBd_subset_subBd (hDs j).2) + exact Set.disjoint_left.mp hdis + (mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU P_pres.Γ (hcir j).1 hvG hbdD) hv + +/-- A circuit has an edge. -/ +theorem IsGraphCircuit.edgeSet_nonempty {G C : Graph α β} (hC : IsGraphCircuit G C) : + E(C).Nonempty := by + obtain ⟨-, u, W, -, hlen, -, -⟩ := hC + cases W with + | nil _ => simp at hlen + | cons hlink rest => exact ⟨_, hlink.edge_mem⟩ + +/-- The nest and the linking paths of the proof of (10.4). The nest misses `ΩBar` and each path +meets +`ΩBar` only in its first vertex. -/ +theorem exists_clean_paths_of_nest {N : Neighborhood α β} (P_pres : Presentation N) + {n : ℕ} (hn : 1 ≤ n) + {C' : Fin (n + 1) → Graph α β} (hC' : N.IsNest P_pres C') {X : Set α} (hX : N.IsLinked X) : + ∃ (C : Fin n → Graph α β) (P : Fin X.ncard → Graph α β) (x t : Fin X.ncard → α), + N.IsNest P_pres C ∧ (∀ j, Disjoint V(C j) N.Ω.bar) ∧ + (∀ i, IsFromToPathWithEnds N.G (P i) X N.Ω₀.bar (x i) (t i) ∧ V(P i) ∩ N.Ω.bar = {x i}) ∧ + Pairwise (fun i j => Disjoint V(P i) V(P j)) ∧ + ∀ i j, ∃ I, IsGraphPath N.G I ∧ I ≤ P i ∧ I ≤ C j ∧ V(I) = V(P i) ∩ V(C j) := by + classical + obtain ⟨hXb, P₀, hP₀, hd₀⟩ := hX + have hd_bar := disjoint_bar_bar₀_of_isNest hC' (by omega) + choose x₀ hx₀ y₀ hy₀ hP₀' using hP₀ + have hPV : ∀ i, V(P₀ i) ∩ N.Ω.bar = {x₀ i} := fun i => (hP₀' i).2.1 + let F : Set β := {e | ∀ a b, N.G.IsLink e a b → a ∉ N.Ω.bar ∧ b ∉ N.Ω.bar} ∪ ⋃ i, E(P₀ i) + let G' := N.G.restrict F + have hG' : G' ≤ N.G := Graph.restrict_le + have hVG' : V(G') = V(N.G) := rfl + have hEG' : E(G') = E(N.G) ∩ F := rfl + let N' : Neighborhood α β := + { G := G', Ω := N.Ω, Ω₀ := N.Ω₀, finite_V := N.finite_V, + finite_E := N.finite_E.subset hG'.edgeSet_mono, bar_subset := N.bar_subset, + bar₀_subset := N.bar₀_subset } + obtain ⟨P', hPΔ, hPΔ₀, hPv, hPU⟩ := Presentation.exists_of_le (N' := N') P_pres hG' + P_pres.isClosedDisc_Δ P_pres.Δ₀_subset_Δ + ((graphDrawingSubgraphU_subset_U P_pres.Γ _).trans P_pres.U_subset) P_pres.mem_bd_Δ_iff + P_pres.mem_bd_Δ₀_iff P_pres.agrees_Δ P_pres.agrees_Δ₀ + let C₀ : Fin n → Graph α β := fun j => C' j.castSucc + have hC₀d : ∀ j, Disjoint V(C₀ j) N.Ω.bar := fun j => + disjoint_vertexSet_bar_of_isNest_lt hC' (Fin.castSucc_lt_last j) + have hC₀G : ∀ j, C₀ j ≤ N.G := fun j => (hC'.1 _).1 + have hC₀le : ∀ j, C₀ j ≤ G' := by + intro j + refine (Compatible.of_le_le (hC₀G j) hG').le_iff.mpr + ⟨(hC₀G j).vertexSet_mono, fun e he => ⟨(hC₀G j).edgeSet_mono he, Or.inl ?_⟩⟩ + intro a b hab + obtain ⟨u, w, hl⟩ : ∃ u w, (C₀ j).IsLink e u w := exists_isLink_of_mem_edgeSet he + have hlG := hl.mono (hC₀G j) + have hm : ∀ {z}, z = u ∨ z = w → z ∈ V(C₀ j) := by + rintro z (rfl | rfl) + · exact hl.left_mem + · exact hl.right_mem + exact ⟨Set.disjoint_left.mp (hC₀d j) (hm (hab.left_eq_or_eq hlG)), + Set.disjoint_left.mp (hC₀d j) (hm (hab.symm.left_eq_or_eq hlG))⟩ + have hP₀le : ∀ i, P₀ i ≤ G' := by + intro i + refine (Compatible.of_le_le (hP₀' i).1.le hG').le_iff.mpr + ⟨(hP₀' i).1.le.vertexSet_mono, fun e he => + ⟨(hP₀' i).1.le.edgeSet_mono he, Or.inr (mem_iUnion.mpr ⟨i, he⟩)⟩⟩ + have hnest : N'.IsNest P' C₀ := by + obtain ⟨hcir, hdisj, D, hDd, hDs, hDm⟩ := hC' + refine ⟨fun j => ⟨hC₀le j, (hcir _).2⟩, fun i j hij => hdisj fun e => hij + (Fin.castSucc_injective _ e), fun j => D j.castSucc, fun j => ⟨(hDd _).1, ?_⟩, fun j => ?_, + fun i j hij => hDm _ _ (Fin.castSucc_le_castSucc_iff.mpr hij)⟩ + · rw [hPU _ (hC₀le j)] + exact (hDd _).2 + · rw [hPΔ, hPΔ₀] + exact hDs _ + have hweak : N'.IsWeaklyLinked X := by + refine ⟨hXb, P₀, fun i => ⟨x₀ i, y₀ i, (hP₀' i).1.of_le (hP₀le i), ?_, (hP₀' i).2.2⟩, hd₀⟩ + apply Subset.antisymm + · rintro v ⟨hv, hvX⟩ + have : v ∈ V(P₀ i) ∩ N.Ω.bar := ⟨hv, hXb hvX⟩ + rwa [hPV] at this + · rintro _ rfl + exact ⟨(hP₀' i).1.left_mem, hx₀ i⟩ + obtain ⟨C, P, hC, hP, hPd, hPC⟩ := theorem_10_1_proof P' ⟨C₀, hnest⟩ hweak + choose x t hP₁ using hP + have hin : ∀ {e v w}, G'.IsLink e v w → v ∈ N.Ω.bar → + ∃ i, e ∈ E(P₀ i) ∧ v = x₀ i ∧ (P₀ i).Inc e v := by + intro e v w hl hv + have he : e ∈ F := (show e ∈ E(G') from hl.edge_mem).2 + rcases he with he | he + · exact absurd hv (he v w (hl.mono hG')).1 + · obtain ⟨i, hi⟩ := mem_iUnion.mp he + obtain ⟨a, b, hab⟩ : ∃ a b, (P₀ i).IsLink e a b := exists_isLink_of_mem_edgeSet hi + have hlG := hl.mono hG' + have hvP : v ∈ V(P₀ i) ∧ (P₀ i).Inc e v := by + rcases hlG.left_eq_or_eq (hab.mono (hP₀' i).1.le) with rfl | rfl + · exact ⟨hab.left_mem, ⟨_, hab⟩⟩ + · exact ⟨hab.right_mem, ⟨_, hab.symm⟩⟩ + have : v ∈ V(P₀ i) ∩ N.Ω.bar := ⟨hvP.1, hv⟩ + rw [hPV] at this + exact ⟨i, hi, this, hvP.2⟩ + have huniq : ∀ {e₁ e₂ v w₁ w₂}, G'.IsLink e₁ v w₁ → G'.IsLink e₂ v w₂ → v ∈ N.Ω.bar → + e₁ = e₂ := by + intro e₁ e₂ v w₁ w₂ h₁ h₂ hv + obtain ⟨i₁, he₁, hx₁, hi₁⟩ := hin h₁ hv + obtain ⟨i₂, he₂, hx₂, hi₂⟩ := hin h₂ hv + have hi : i₁ = i₂ := by + by_contra hne + have hm₂ : v ∈ V(P₀ i₂) := hx₂ ▸ (hP₀' i₂).1.left_mem + have hm₁ : v ∈ V(P₀ i₁) := hx₁ ▸ (hP₀' i₁).1.left_mem + exact Set.disjoint_left.mp (hd₀ hne) hm₁ hm₂ + subst hi + rw [hx₁] at hi₁ hi₂ + exact (hP₀' i₁).1.inc_left_unique he₁ he₂ hi₁ hi₂ + have hCbar : ∀ j, Disjoint V(C j) N.Ω.bar := by + intro j + rw [Set.disjoint_left] + intro v hv hvb + have hc := hC.1 j + by_cases h : ∃ v' ∈ V(C j), v ≠ v' + · obtain ⟨v', hv', hne⟩ := h + obtain ⟨Q₁, Q₂, -, -, hQ₁, hQ₂, -, -, -, hE, -⟩ := hc.exists_two_paths hv hv' hne + obtain ⟨e₁, he₁, w₁, hl₁⟩ := hQ₁.exists_inc_of_mem_of_ne hne hQ₁.left_mem + obtain ⟨e₂, he₂, w₂, hl₂⟩ := hQ₂.exists_inc_of_mem_of_ne hne hQ₂.left_mem + have e' := huniq (hl₁.mono hQ₁.le) (hl₂.mono hQ₂.le) hvb + exact Set.disjoint_left.mp hE he₁ (e' ▸ he₂) + · push Not at h + obtain ⟨e, he⟩ := hc.edgeSet_nonempty + obtain ⟨u, w, hl⟩ : ∃ u w, (C j).IsLink e u w := exists_isLink_of_mem_edgeSet he + obtain rfl := (h u hl.left_mem).symm + obtain rfl := (h w hl.right_mem).symm + obtain ⟨i, hi, -, -⟩ := hin (hl.mono hc.1) hvb + exact (hP₀' i).1.not_isLoopAt hi _ ((hl.mono hc.1).mono hG') + have hPbar : ∀ i, V(P i) ∩ N.Ω.bar = {x i} := by + intro i + obtain ⟨hpath, hVX, hV₀⟩ := hP₁ i + have hxX : x i ∈ X := (hVX.symm ▸ mem_singleton _ : x i ∈ V(P i) ∩ X).2 + have ht₀ : t i ∈ N.Ω₀.bar := (hV₀.symm ▸ mem_singleton _ : t i ∈ V(P i) ∩ N'.Ω₀.bar).2 + apply Subset.antisymm + · rintro w ⟨hw, hwb⟩ + by_contra hne + have hne' : x i ≠ w := fun e => hne e.symm + have hwt : w ≠ t i := fun e => + Set.disjoint_left.mp hd_bar hwb (e.symm ▸ ht₀) + obtain ⟨Q₁, Q₂, hQ₁, hQ₂, hp₁, hp₂, -, -, hE⟩ := hpath.exists_split_at hw + obtain ⟨e₁, he₁, w₁, hl₁⟩ := hp₁.exists_inc_of_mem_of_ne hne' hp₁.right_mem + obtain ⟨e₂, he₂, w₂, hl₂⟩ := hp₂.exists_inc_of_mem_of_ne hwt hp₂.left_mem + have hle₁ : Q₁ ≤ G' := hQ₁.trans hpath.le + have hle₂ : Q₂ ≤ G' := hQ₂.trans hpath.le + have e' := huniq (hl₁.mono hle₁) (hl₂.mono hle₂) hwb + exact Set.disjoint_left.mp hE he₁ (e' ▸ he₂) + · rintro _ rfl + exact ⟨hpath.left_mem, hXb hxX⟩ + refine ⟨C, P, x, t, ?_, hCbar, fun i => ⟨?_, hPbar i⟩, hPd, fun i j => ?_⟩ + · obtain ⟨hcir, hdisj, D, hDd, hDs, hDm⟩ := hC + refine ⟨fun j => ⟨(hcir j).1.trans hG', (hcir j).2⟩, hdisj, D, fun j => ⟨(hDd j).1, ?_⟩, + fun j => ?_, hDm⟩ + · rw [← hPU _ (hcir j).1] + exact (hDd j).2 + · rw [← hPΔ, ← hPΔ₀] + exact hDs j + · obtain ⟨hpath, hVX, hV₀⟩ := hP₁ i + exact ⟨hpath.mono hG', hVX, hV₀⟩ + · obtain ⟨u, w, hI⟩ := hPC i j + have hle₁ : P i ≤ G' := (hP₁ i).1.le + have hle₂ : C j ≤ G' := (hC.1 j).1 + exact ⟨_, ⟨u, w, hI.mono hG'⟩, subgraphInter_le_left hle₁ hle₂, + subgraphInter_le_right hle₁ hle₂, + vertexSet_subgraphInter _ _ _⟩ + +/-- The clean nest used in the proof of Graph Minors IX (10.4). -/ +theorem exists_clean_paths {N : Neighborhood α β} (P_pres : Presentation N) {p : ℕ} + {C' : Fin (p + 5) → Graph α β} (hC' : N.IsNest P_pres C') {X : Set α} (hX : N.IsLinked X) : + ∃ (C : Fin (p + 4) → Graph α β) (P : Fin X.ncard → Graph α β) (x t : Fin X.ncard → α), + N.IsNest P_pres C ∧ (∀ j, Disjoint V(C j) N.Ω.bar) ∧ + (∀ i, IsFromToPathWithEnds N.G (P i) X N.Ω₀.bar (x i) (t i) ∧ V(P i) ∩ N.Ω.bar = {x i}) ∧ + Pairwise (fun i j => Disjoint V(P i) V(P j)) ∧ + ∀ i j, ∃ I, IsGraphPath N.G I ∧ I ≤ P i ∧ I ≤ C j ∧ V(I) = V(P i) ∩ V(C j) := + exists_clean_paths_of_nest P_pres (n := p + 4) (by omega) hC' hX + +/-- The union of a path with a path at each end. -/ +theorem exists_extended_path {G P A B : Graph α β} {a b a' b' : α} + (hP : IsGraphPathWithEnds G P a b) (hA : IsGraphPathWithEnds G A a' a) + (hB : IsGraphPathWithEnds G B b' b) (hAP : V(A) ∩ V(P) = {a}) (hBP : V(B) ∩ V(P) = {b}) + (hAB : Disjoint V(A) V(B)) : + ∃ Q, IsGraphPathWithEnds G Q a' b' ∧ V(Q) = V(A) ∪ V(P) ∪ V(B) := by + have h₁ := hP.subgraphUnion hB.symm (by rw [inter_comm]; exact hBP) + have hV₁ : V(A) ∩ V(subgraphUnion G P B) = {a} := by + rw [vertexSet_subgraphUnion, inter_union_distrib_left, hAP, hAB.inter_eq, union_empty] + refine ⟨_, hA.subgraphUnion h₁ hV₁, ?_⟩ + rw [vertexSet_subgraphUnion, vertexSet_subgraphUnion, union_assoc] + +/-- Every circuit in a nest lies on the inner side of the last circuit. -/ +theorem nestedCircuitsOnInnerSide + {N : Neighborhood α β} (Γ : GraphDrawing N.G EuclideanPlane) + {m : ℕ} {C : Fin m → Graph α β} {D : Fin m → Set EuclideanPlane} {last : Fin m} + (hcir : ∀ j, IsGraphCircuit N.G (C j)) + (hdisj : Pairwise fun i j => Disjoint V(C i) V(C j)) + (hDd : ∀ j, IsClosedDisc (D j) ∧ subBd (D j) = graphDrawingSubgraphU Γ (C j)) + (hDm : ∀ (i j : Fin m), i ≤ j → D i ⊆ D j) (hlast : ∀ j : Fin m, j ≤ last) + {H₁ H₂ : Graph α β} (hsep : IsGraphSeparation N.G H₁ H₂) + (hcut : V(H₁) ∩ V(H₂) = V(C last)) (hKH₁ : C last ≤ H₁) + (hY₁ : ∀ v ∈ V(N.G), graphDrawingVertexSet Γ v ⊆ D last \ subBd (D last) → v ∈ V(H₁)) + (hpt : ∀ v ∈ V(N.G), ∃ q, graphDrawingVertexSet Γ v = {q}) + (hbdK : ∀ v ∈ V(N.G), graphDrawingVertexSet Γ v ⊆ subBd (D last) ↔ v ∈ V(C last)) + (j : Fin m) : C j ≤ H₁ := by + classical + by_cases hj : j = last + · subst hj + exact hKH₁ + refine IsGraphSeparation.le_left_of_disjoint hsep (hcir j).1 (Set.disjoint_left.mpr ?_) + intro v hv hv₂ + have hvG := (hcir j).1.vertexSet_mono hv + have hnK : v ∉ V(C last) := fun h => Set.disjoint_left.mp (hdisj hj) hv h + have hv₁ : v ∈ V(H₁) := by + obtain ⟨q, hq⟩ := hpt v hvG + refine hY₁ v hvG ?_ + have hqm : q ∈ graphDrawingVertexSet Γ v := hq ▸ mem_singleton q + have hjle : j ≤ last := hlast j + have hqD : q ∈ D last := by + refine hDm j last hjle (subBd_subset_of_isClosed (isClosed_of_isClosedDisc (hDd j).1) ?_) + rw [(hDd j).2] + exact graphDrawingVertexSet_subset_subgraphU_of_mem Γ hv hqm + rw [hq, singleton_subset_iff] + refine ⟨hqD, fun hb => hnK ((hbdK v hvG).mp ?_)⟩ + rw [hq, singleton_subset_iff] + exact hb + exact hnK (hcut ▸ ⟨hv₁, hv₂⟩) + +private theorem splitPathAtInnerCircuit {G H₁ H₂ K P I : Graph α β} + (hsep : IsGraphSeparation G H₁ H₂) (hcut : V(H₁) ∩ V(H₂) = V(K)) (hKH₁ : K ≤ H₁) + {x t : α} (hP : IsGraphPathWithEnds G P x t) (hI : IsGraphPath G I) + (hIP : I ≤ P) (hIK : I ≤ K) (hVI : V(I) = V(P) ∩ V(K)) + (hx : x ∈ V(H₂)) (ht : t ∈ V(H₁)) : + ∃ (y : α) (R W : Graph α β), y ∈ V(K) ∧ + IsGraphPathWithEnds H₂ R x y ∧ V(R) ⊆ V(P) ∧ V(R) ∩ V(K) = {y} ∧ + IsGraphPathWithEnds H₁ W y t ∧ V(W) ⊆ V(P) := by + classical + obtain ⟨u, w, hIp⟩ := hI + have hne : (V(P) ∩ V(K)).Nonempty := ⟨u, hVI ▸ hIp.left_mem⟩ + have hne' := hne + obtain ⟨y, hy, R, -, hRP, -, hRp, -, -, -, -, hRd⟩ := + hP.exists_first_split_at_mem hne + obtain ⟨z, hz, T, -, hTP, -, hTp, -, -, -, -, hTd⟩ := + hP.symm.exists_first_split_at_mem hne' + have hinter : ∀ {Q : Graph α β} {q : α}, q ∈ V(Q) → q ∈ V(K) → + Disjoint (V(Q) \ {q}) V(K) → V(Q) ∩ V(K) = {q} := by + intro Q q hq hqK hd + apply Subset.antisymm + · rintro v ⟨hv, hvK⟩ + by_contra hne + exact Set.disjoint_left.mp hd ⟨hv, hne⟩ hvK + · rintro _ rfl + exact ⟨hq, hqK⟩ + have hRV := hinter hRp.right_mem hy.2 hRd + have hTV := hinter hTp.right_mem hz.2 hTd + have hRN : IsGraphPathWithEnds G R x y := hRp.mono hP.le + have hTN : IsGraphPathWithEnds G T t z := hTp.mono hP.le + have hRH₂ : R ≤ H₂ := hRN.le_right_of_inter_subset hsep + (by rw [hcut, hRV]) hx (hcut.symm ▸ hy.2 : y ∈ V(H₁) ∩ V(H₂)).2 + have hTH₁ : T ≤ H₁ := hTN.le_right_of_inter_subset (IsGraphSeparation.symm hsep) + (by rw [inter_comm V(H₂), hcut, hTV]) ht (hKH₁.vertexSet_mono hz.2) + have hyI : y ∈ V(I) := hVI ▸ hy + have hzI : z ∈ V(I) := hVI ▸ hz + obtain ⟨M, hMI, hMp, -⟩ := hIp.exists_subpath hyI hzI + have hMH₁ : IsGraphPathWithEnds H₁ M y z := hMp.mono (hIK.trans hKH₁) + have hTH : IsGraphPathWithEnds H₁ T z t := (hTN.of_le hTH₁).symm + have hMT : V(M) ∩ V(T) = {z} := by + apply Subset.antisymm + · rintro v ⟨hv, hvT⟩ + have : v ∈ V(T) ∩ V(K) := ⟨hvT, (hMI.trans hIK).vertexSet_mono hv⟩ + rwa [hTV] at this + · rintro _ rfl + exact ⟨hMp.right_mem, hTp.right_mem⟩ + refine ⟨y, R, _, hy.2, hRN.of_le hRH₂, hRP.vertexSet_mono, hRV, hMH₁.subgraphUnion hTH hMT, ?_⟩ + rw [vertexSet_subgraphUnion] + exact union_subset (hMI.trans hIP).vertexSet_mono hTP.vertexSet_mono + +private theorem weakLinkingAlongOuterPaths {N₁ : Neighborhood α β} {n : ℕ} + {P R W : Fin n → Graph α β} {y t : Fin n → α} (hYcard : (range y).ncard = n) + (hybar : ∀ i, y i ∈ N₁.Ω.bar) + (hW : ∀ i, IsGraphPathWithEnds N₁.G (W i) (y i) (t i)) + (hPd : Pairwise fun i j => Disjoint V(P i) V(P j)) + (hWP : ∀ i, V(W i) ⊆ V(P i)) (hRP : ∀ i, V(R i) ⊆ V(P i)) + (hyR : ∀ i, y i ∈ V(R i)) (htbar : ∀ i, V(P i) ∩ N₁.Ω₀.bar = {t i}) : + N₁.IsWeaklyLinked (range y) := by + classical + refine ⟨by rintro _ ⟨i, rfl⟩; exact hybar i, + fun j => W (Fin.cast hYcard j), fun j => ?_, fun i j hij => ?_⟩ + · set i := Fin.cast hYcard j + refine ⟨y i, t i, hW i, ?_, ?_⟩ + · apply Subset.antisymm + · rintro v ⟨hv, ⟨k, rfl⟩⟩ + by_cases hik : i = k + · subst hik + rfl + · exact (Set.disjoint_left.mp (hPd hik) (hWP i hv) (hRP k (hyR k))).elim + · rintro _ rfl + exact ⟨(hW i).left_mem, mem_range_self i⟩ + · apply Subset.antisymm + · rintro v ⟨hv, hv₀⟩ + have : v ∈ V(P i) ∩ N₁.Ω₀.bar := ⟨hWP i hv, hv₀⟩ + rwa [htbar i] at this + · rintro _ rfl + have : t i ∈ V(P i) ∩ N₁.Ω₀.bar := (htbar i).symm ▸ mem_singleton _ + exact ⟨(hW i).right_mem, this.2⟩ + · refine (hPd fun e => hij ?_).mono (hWP _) (hWP _) + exact Fin.cast_injective hYcard e + +/-- Extend a crooked transaction through a rural neighborhood along disjoint paths. +The extended transaction has the original cardinality and ends in the prescribed boundary set. -/ +theorem extend_crooked_transaction_across_neighborhood + {S_comp S₁ : Society α β} {N₂ : Neighborhood α β} {K : Graph α β} {X : Set α} + (hXpos : 0 < X.ncard) (hInner : S₁.G ≤ S_comp.G) (hOuter : N₂.G ≤ S_comp.G) + (hcutU : V(N₂.G) ∩ V(S₁.G) = V(K)) (hΩ : N₂.Ω = S_comp.Ω) (hΩ₀ : N₂.Ω₀ = S₁.Ω) + (hrural₂ : N₂.IsRural) (hbarH₂ : S_comp.Ω.bar ⊆ V(N₂.G)) + (hKbar : Disjoint V(K) S_comp.Ω.bar) + {R : Fin X.ncard → Graph α β} {x y : Fin X.ncard → α} + (hR : ∀ i, IsGraphPathWithEnds N₂.G (R i) (x i) (y i)) + (hRK : ∀ i, V(R i) ∩ V(K) = {y i}) + (hy_inj : Injective y) (hx_inj : Injective x) + (hRd : ∀ {i j}, i ≠ j → Disjoint V(R i) V(R j)) + (hybar : ∀ i, y i ∈ S₁.Ω.bar) (hxb : ∀ i, x i ∈ S_comp.Ω.bar) + (hxX : ∀ i, x i ∈ X) (hRbar : ∀ i, V(R i) ∩ S_comp.Ω.bar = {x i}) + {T : Set (Graph α β)} (hT : S₁.IsCrookedTransaction T) + (hTends : S₁.transactionEnds T ⊆ range y) : + ∃ P' : Set (Graph α β), S_comp.IsCrookedTransaction P' ∧ P'.ncard = T.ncard ∧ + S_comp.transactionEnds P' ⊆ X ∧ + ∀ Q ∈ P', Disjoint (pathInternalVerts S_comp.G Q) S_comp.Ω.bar := by + classical + have hyR (i : Fin X.ncard) : y i ∈ V(R i) := (hR i).right_mem + have hne_idx : Nonempty (Fin X.ncard) := ⟨⟨0, hXpos⟩⟩ + let ψ : α → α := fun v => x (invFun y v) + have hψ : ∀ i, ψ (y i) = x i := fun i => congrArg x (leftInverse_invFun hy_inj i) + have hS₁T : ∀ Q ∈ T, Q ≤ S₁.G := by + intro Q hQ + obtain ⟨A, B, hf⟩ := hT.1 + obtain ⟨a, -, b, -, hQp⟩ := hf.2.2 Q hQ + exact hQp.1.le + have hRS : ∀ {i v}, v ∈ V(R i) → v ∈ V(S₁.G) → v = y i := by + intro i v hv hv₁ + have : v ∈ V(R i) ∩ V(K) := ⟨hv, hcutU ▸ ⟨(hR i).le.vertexSet_mono hv, hv₁⟩⟩ + rwa [hRK] at this + have hRSN : ∀ i, IsGraphPathWithEnds S_comp.G (R i) (x i) (y i) := fun i => + (hR i).mono hOuter + have hRV : ∀ {Q : Graph α β} {i}, Q ≤ S₁.G → y i ∈ V(Q) → V(R i) ∩ V(Q) = {y i} := by + intro Q i hQ hyQ + apply Subset.antisymm + · rintro v ⟨hv, hvQ⟩ + exact hRS hv (hQ.vertexSet_mono hvQ) + · rintro _ rfl + exact ⟨hyR i, hyQ⟩ + have hTY : ∀ {Q a b}, Q ∈ T → S₁.IsOmegaPathWithEnds Q a b → ∃ i j, a = y i ∧ b = y j ∧ i ≠ j + := by + intro Q a b hQ hab + obtain ⟨i, rfl⟩ := hTends ⟨Q, hQ, b, hab⟩ + obtain ⟨j, rfl⟩ := hTends ⟨Q, hQ, _, Society.IsOmegaPathWithEnds.symm S₁ hab⟩ + exact ⟨i, j, rfl, rfl, fun e => hab.2.1 (congrArg y e)⟩ + have hex : ∀ Q ∈ T, ∃ Qe : Graph α β, ∀ i j, S₁.IsOmegaPathWithEnds Q (y i) (y j) → + IsGraphPathWithEnds S_comp.G Qe (x i) (x j) ∧ V(Qe) = V(R i) ∪ V(Q) ∪ V(R j) := by + intro Q hQ + obtain ⟨A, B, hf⟩ := hT.1 + obtain ⟨a, -, b, -, hQp⟩ := hf.2.2 Q hQ + obtain ⟨i₀, j₀, rfl, rfl, hne⟩ := hTY hQ hQp + have hQS : Q ≤ S₁.G := hS₁T Q hQ + have hpS : IsGraphPathWithEnds S_comp.G Q (y i₀) (y j₀) := + hQp.1.mono hInner + obtain ⟨Qe, hQe, hVQ⟩ := exists_extended_path hpS (hRSN i₀) (hRSN j₀) + (hRV hQS hQp.1.left_mem) (hRV hQS hQp.1.right_mem) (hRd hne) + refine ⟨Qe, fun i j hij => ?_⟩ + rcases Society.IsOmegaPathWithEnds.ends_eq S₁ hQp hij with ⟨e₁, e₂⟩ | ⟨e₁, e₂⟩ + · obtain rfl := hy_inj e₁ + obtain rfl := hy_inj e₂ + exact ⟨hQe, hVQ⟩ + · obtain rfl := hy_inj e₁ + obtain rfl := hy_inj e₂ + refine ⟨hQe.symm, ?_⟩ + rw [hVQ] + ext v + simp only [mem_union] + tauto + choose! f hf using hex + have hTdisj : ∀ {Q Q'}, Q ∈ T → Q' ∈ T → Q ≠ Q' → Disjoint V(Q) V(Q') := by + intro Q Q' hQ hQ' hne + obtain ⟨A, B, hfence⟩ := hT.1 + exact hfence.1.2 hQ hQ' hne + have hendsT : ∀ Q ∈ T, ∀ i j, S₁.IsOmegaPathWithEnds Q (y i) (y j) → + S_comp.IsOmegaPathWithEnds (f Q) (x i) (x j) := fun Q hQ i j hij => + ⟨(hf Q hQ i j hij).1, fun e => hij.2.1 (congrArg y (hx_inj e)), hxb i, hxb j⟩ + have hRQ : ∀ {Q Q' i j}, Q ∈ T → Q' ∈ T → Q ≠ Q' → S₁.IsOmegaPathWithEnds Q (y i) (y j) → + Disjoint V(R i) V(Q') := by + intro Q Q' i j hQ hQ' hne hij + rw [Set.disjoint_left] + intro v hv hvQ + have e := hRS hv ((hS₁T Q' hQ').vertexSet_mono hvQ) + subst e + exact Set.disjoint_left.mp (hTdisj hQ hQ' hne) hij.1.left_mem hvQ + have hd : ∀ Q ∈ T, ∀ Q' ∈ T, Q ≠ Q' → Disjoint V(f Q) V(f Q') := by + intro Q hQ Q' hQ' hne + obtain ⟨A, B, hfence⟩ := hT.1 + obtain ⟨a, -, b, -, hQp⟩ := hfence.2.2 Q hQ + obtain ⟨a', -, b', -, hQ'p⟩ := hfence.2.2 Q' hQ' + obtain ⟨i, j, rfl, rfl, -⟩ := hTY hQ hQp + obtain ⟨i', j', rfl, rfl, -⟩ := hTY hQ' hQ'p + rw [(hf Q hQ i j hQp).2, (hf Q' hQ' i' j' hQ'p).2] + have hdQ := hTdisj hQ hQ' hne + have h₁ := hRQ hQ hQ' hne hQp + have h₂ := hRQ hQ hQ' hne (Society.IsOmegaPathWithEnds.symm S₁ hQp) + have h₃ := hRQ hQ' hQ hne.symm hQ'p + have h₄ := hRQ hQ' hQ hne.symm (Society.IsOmegaPathWithEnds.symm S₁ hQ'p) + have hne' : ∀ {u w}, y u ∈ V(Q) → y w ∈ V(Q') → u ≠ w := by + rintro u w hu hw rfl + exact Set.disjoint_left.mp hdQ hu hw + have hu₁ := hQp.1.left_mem + have hu₂ := hQp.1.right_mem + have hw₁ := hQ'p.1.left_mem + have hw₂ := hQ'p.1.right_mem + rw [Set.disjoint_left] + rintro v ((h | h) | h) ((h' | h') | h') + · exact Set.disjoint_left.mp (hRd (hne' hu₁ hw₁)) h h' + · exact Set.disjoint_left.mp h₁ h h' + · exact Set.disjoint_left.mp (hRd (hne' hu₁ hw₂)) h h' + · exact Set.disjoint_left.mp h₃ h' h + · exact Set.disjoint_left.mp hdQ h h' + · exact Set.disjoint_left.mp h₄ h' h + · exact Set.disjoint_left.mp (hRd (hne' hu₂ hw₁)) h h' + · exact Set.disjoint_left.mp h₂ h h' + · exact Set.disjoint_left.mp (hRd (hne' hu₂ hw₂)) h h' + have hcrook : S_comp.IsCrookedTransaction (f '' T) := by + refine Society.isCrookedTransaction_image (ψ := ψ) hT ?_ hd ?_ ?_ + · intro Q hQ a b hab + obtain ⟨i, j, rfl, rfl, -⟩ := hTY hQ hab + rw [hψ, hψ] + exact hendsT Q hQ i j hab + · intro a ha b hb e + obtain ⟨i, rfl⟩ := hTends ha + obtain ⟨j, rfl⟩ := hTends hb + rw [hψ, hψ] at e + exact congrArg y (hx_inj e) + · intro a ha b hb c hc d' hd' h12 h13 h14 h23 h24 h34 + obtain ⟨i₁, rfl⟩ := hTends ha + obtain ⟨i₂, rfl⟩ := hTends hb + obtain ⟨i₃, rfl⟩ := hTends hc + obtain ⟨i₄, rfl⟩ := hTends hd' + have hne : ∀ {u w}, y u ≠ y w → u ≠ w := fun h e => h (congrArg y e) + have hN : ∀ k, x k ∈ N₂.Ω.bar := fun k => hΩ.symm ▸ hxb k + have hO : ∀ k, y k ∈ N₂.Ω₀.bar := fun k => hΩ₀.symm ▸ hybar k + have h := crosses_outer_iff_crosses_inner_of_disjoint_paths hrural₂ (hR i₁) (hN i₁) (hO i₁) + (hR i₃) (hN i₃) (hO i₃) (hR i₂) (hN i₂) (hO i₂) (hR i₄) (hN i₄) (hO i₄) + (hRd (hne h13)) (hRd (hne h12)) (hRd (hne h14)) (hRd (hne h23.symm)) (hRd (hne h34)) + (hRd (hne h24)) + rw [hψ, hψ, hψ, hψ] + rw [hΩ, hΩ₀] at h + exact h.symm + have hnonempty : ∀ Q ∈ T, V(f Q).Nonempty := by + intro Q hQ + obtain ⟨A, B, hfence⟩ := hT.1 + obtain ⟨a, -, b, -, hQp⟩ := hfence.2.2 Q hQ + obtain ⟨i, j, rfl, rfl, -⟩ := hTY hQ hQp + exact ⟨_, (hf Q hQ i j hQp).1.left_mem⟩ + have hinjf : InjOn f T := by + intro Q hQ Q' hQ' e + by_contra hne + obtain ⟨v, hv⟩ := hnonempty Q hQ + exact Set.disjoint_left.mp (hd Q hQ Q' hQ' hne) hv (e ▸ hv) + refine ⟨f '' T, hcrook, ?_, ?_, ?_⟩ + · exact hinjf.ncard_image + · rintro v ⟨_, ⟨Q, hQ, rfl⟩, b, hvb⟩ + obtain ⟨A, B, hfence⟩ := hT.1 + obtain ⟨a', -, b', -, hQp⟩ := hfence.2.2 Q hQ + obtain ⟨i, j, rfl, rfl, -⟩ := hTY hQ hQp + rcases Society.IsOmegaPathWithEnds.ends_eq S_comp (hendsT Q hQ i j hQp) hvb with ⟨e, -⟩ | ⟨e, -⟩ + · exact e ▸ hxX i + · exact e ▸ hxX j + · rintro _ ⟨Q, hQ, rfl⟩ + rw [Set.disjoint_left] + rintro v ⟨hv, hvE⟩ hvb + obtain ⟨A, B, hfence⟩ := hT.1 + obtain ⟨a', -, b', -, hQp⟩ := hfence.2.2 Q hQ + obtain ⟨i, j, rfl, rfl, -⟩ := hTY hQ hQp + obtain ⟨hpath, hVe⟩ := hf Q hQ i j hQp + have hend : ∀ {k}, v ∈ V(R k) → v = x k := fun hk => + mem_singleton_iff.mp (hRbar _ ▸ ⟨hk, hvb⟩) + rw [hVe] at hv + rcases hv with (h | h) | h + · exact hvE ⟨_, hend h ▸ hpath⟩ + · have hK : v ∈ V(N₂.G) ∩ V(S₁.G) := ⟨hbarH₂ hvb, (hS₁T Q hQ).vertexSet_mono h⟩ + rw [hcutU] at hK + exact Set.disjoint_left.mp hKbar hK hvb + · exact hvE ⟨_, hend h ▸ hpath.symm⟩ + +/-- Cut a presentation at a nested circuit, keeping its inner and outer boundaries on +their respective sides. -/ +theorem Presentation.separate_at_circuit {N : Neighborhood α β} (P_pres : Presentation N) + {m : ℕ} (C : Fin m → Graph α β) (D : Fin m → Set EuclideanPlane) (last : Fin m) + (hCircuit : IsGraphCircuit N.G (C last)) (hDisc : IsClosedDisc (D last)) + (hBoundary : subBd (D last) = graphDrawingSubgraphU P_pres.Γ (C last)) + (hInner : P_pres.Δ₀ ⊆ D last) (hOuter : D last ⊆ P_pres.Δ) + (hDisjoint : Disjoint V(C last) N.Ω.bar) : + let Γ := P_pres.Γ + (∀ v ∈ V(N.G), graphDrawingVertexSet Γ v ⊆ subBd (D last) ↔ v ∈ V(C last)) ∧ + ∃ H₁ H₂ : Graph α β, IsGraphSeparation N.G H₁ H₂ ∧ + V(H₁) ∩ V(H₂) = V(C last) ∧ C last ≤ H₁ ∧ + (∀ v ∈ V(N.G), graphDrawingVertexSet Γ v ⊆ D last \ subBd (D last) → v ∈ V(H₁)) ∧ + graphDrawingSubgraphU Γ H₁ ⊆ D last ∧ + graphDrawingSubgraphU Γ H₂ ⊆ P_pres.Δ \ interior (D last) ∧ + N.Ω.bar ⊆ V(H₂) ∧ N.Ω₀.bar ⊆ V(H₁) := by + let Γ := P_pres.Γ + have hKG := hCircuit.1 + have hUΔ : Γ.drawing.U ⊆ P_pres.Δ := P_pres.U_subset.trans sdiff_subset + obtain ⟨H₁, H₂, hsep, hcut, hKH₁, hY₁, hY₂, hUH₁, hUH₂⟩ := exists_separation_of_disc Γ + (isClosed_of_isClosedDisc P_pres.isClosedDisc_Δ) hUΔ hKG hDisc hOuter hBoundary + have hpt : ∀ v ∈ V(N.G), ∃ q, graphDrawingVertexSet Γ v = {q} := fun v hv => + ⟨_, graphDrawingVertexSet_eq_singleton Γ hv⟩ + have hbdK : ∀ v ∈ V(N.G), (graphDrawingVertexSet Γ v ⊆ subBd (D last) ↔ v ∈ V(C last)) := by + intro v hv + rw [hBoundary] + exact ⟨mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU Γ hKG hv, + graphDrawingVertexSet_subset_subgraphU_of_mem Γ⟩ + have hbarH₂ : N.Ω.bar ⊆ V(H₂) := by + intro v hv + have hvG := N.bar_subset hv + obtain ⟨q, hq⟩ := hpt v hvG + refine hY₂ v hvG ?_ + rw [hq, singleton_subset_iff] + have hb := (P_pres.mem_bd_Δ_iff v hvG).mpr hv + have hqm : q ∈ graphDrawingVertexSet Γ v := hq ▸ mem_singleton q + refine ⟨subBd_subset_of_isClosed (isClosed_of_isClosedDisc P_pres.isClosedDisc_Δ) (hb hqm), + fun hqD => ?_⟩ + have : graphDrawingVertexSet Γ v ⊆ subBd (D last) := by + rw [hq, singleton_subset_iff] + refine inter_subBd_subset_subBd hOuter ⟨hqD, hb hqm⟩ + exact Set.disjoint_left.mp hDisjoint ((hbdK v hvG).mp this) hv + have hbar₀H₁ : N.Ω₀.bar ⊆ V(H₁) := by + intro v hv + have hvG := N.bar₀_subset hv + by_cases hvK : v ∈ V(C last) + · exact hKH₁.vertexSet_mono hvK + obtain ⟨q, hq⟩ := hpt v hvG + refine hY₁ v hvG ?_ + rw [hq, singleton_subset_iff] + have hq' := singleton_injective (hq.symm.trans (graphDrawingVertexSet_eq_singleton Γ hvG)) + refine ⟨hInner (hq' ▸ (isClosedDisc_Δ₀_and_mem_of_mem_bar₀ P_pres hv).2), + fun hb => hvK ?_⟩ + exact (hbdK v hvG).mp (by rw [hq, singleton_subset_iff]; exact hb) + exact ⟨hbdK, H₁, H₂, hsep, hcut, hKH₁, hY₁, hUH₁, hUH₂, hbarH₂, hbar₀H₁⟩ + +/-- The last circuit of a nest cuts a rural composition into two rural neighborhoods and +an intermediate society. The initial nest remains available on the inner side. -/ +theorem exists_nested_neighborhood_composition {S_comp S₀ : Society α β} + {N : Neighborhood α β} {m : ℕ} (P_pres : Presentation N) (C : Fin m → Graph α β) + (D : Fin m → Set EuclideanPlane) (last : Fin m) (hlast : ∀ j, j ≤ last) + (hcir : ∀ j, IsGraphCircuit N.G (C j)) + (hdisj : Pairwise fun i j => Disjoint V(C i) V(C j)) + (hDd : ∀ j, IsClosedDisc (D j) ∧ subBd (D j) = graphDrawingSubgraphU P_pres.Γ (C j)) + (hDs : ∀ j, P_pres.Δ₀ ⊆ D j ∧ D j ⊆ P_pres.Δ) + (hDm : ∀ i j, i ≤ j → D i ⊆ D j) + (hDisjoint : Disjoint V(C last) N.Ω.bar) (hcomp : S_comp.IsComposition S₀ N) : + ∃ (N₁ N₂ : Neighborhood α β) (P₁ : Presentation N₁) (S₁ : Society α β), + IsGraphSeparation N.G N₁.G N₂.G ∧ V(N₁.G) ∩ V(N₂.G) = V(C last) ∧ + C last ≤ N₁.G ∧ N₁.Ω.bar = V(C last) ∧ + N.Ω.bar ⊆ V(N₂.G) ∧ N.Ω₀.bar ⊆ V(N₁.G) ∧ + N₁.IsRural ∧ N₂.IsRural ∧ N₁.IsNest P₁ C ∧ + S₁.G ≤ S_comp.G ∧ V(N₂.G) ∩ V(S₁.G) = V(C last) ∧ + S₁.IsComposition S₀ N₁ ∧ S_comp.IsComposition S₁ N₂ := by + classical + have hΩ : N.Ω = S_comp.Ω := hcomp.2.1 + have hNG : N.G ≤ S_comp.G := hcomp.1.1.2.1 + let Γ := P_pres.Γ + have hKG : C last ≤ N.G := (hcir last).1 + obtain ⟨hbdK, H₁, H₂, hsep, hcut, hKH₁, hY₁, hUH₁, hUH₂, hbarH₂, hbar₀H₁⟩ := + P_pres.separate_at_circuit C D last (hcir last) (hDd last).1 (hDd last).2 + (hDs last).1 (hDs last).2 hDisjoint + have hpt : ∀ v ∈ V(N.G), ∃ q, graphDrawingVertexSet Γ v = {q} := fun v hv => + ⟨_, graphDrawingVertexSet_eq_singleton Γ hv⟩ + have hK₂ : V(C last) ⊆ V(H₂) := fun v hv => (hcut.symm ▸ hv : v ∈ V(H₁) ∩ V(H₂)).2 + have hCH₁ : ∀ j, C j ≤ H₁ := by + intro j + exact nestedCircuitsOnInnerSide Γ hcir hdisj hDd hDm hlast + hsep hcut hKH₁ hY₁ hpt hbdK j + have hKne : V(C last).Nonempty := by + obtain ⟨e, he⟩ := (hcir last).edgeSet_nonempty + obtain ⟨u, w, hl⟩ : ∃ u w, (C last).IsLink e u w := exists_isLink_of_mem_edgeSet he + exact ⟨u, hl.left_mem⟩ + have hKfin : V(C last).Finite := N.finite_V.subset hKG.vertexSet_mono + obtain ⟨φ, hφ_cw⟩ := exists_isClockwiseDiscHomeo (hDd last).1 + let ν : α → EuclideanPlane := fun v => + if h : v ∈ V(N.G) then (Γ.iso.vertexEquiv ⟨v, h⟩).1 else 0 + have hν : ∀ v (h : v ∈ V(N.G)), graphDrawingVertexSet Γ v = {ν v} := by + intro v h + rw [graphDrawingVertexSet_eq_singleton Γ h] + simp only [ν, h, ↓reduceDIte] + obtain ⟨Ω₁, hΩ₁, hagK⟩ := exists_cyclicPerm_agrees_of_injOn φ ν hKfin hKne + (fun u hu w hw e => graphDrawingVertexSet_inj Γ (x := ν u) + (by rw [hν u (hKG.vertexSet_mono hu)]; rfl) + (by rw [hν w (hKG.vertexSet_mono hw), e]; rfl)) + (fun v hv => by + have := (hbdK v (hKG.vertexSet_mono hv)).mpr hv + rw [hν v (hKG.vertexSet_mono hv), singleton_subset_iff] at this + exact this) + have hbarK : ∀ {v}, v ∈ Ω₁.bar → v ∈ V(N.G) := fun hv => + hKG.vertexSet_mono (hΩ₁ ▸ hv) + have hag : DrawingAgreesWithOArcHomeo Γ Ω₁ (subBd (D last)) φ := by + refine ⟨fun v hv => ?_, fun v₁ v₂ v₃ hc => ?_⟩ + · rw [hν v (hbarK hv), singleton_subset_iff] + exact hagK.1 v hv + · have hm := CyclicPerm.isClockwise3_iff.mp hc + obtain ⟨t₁, t₂, t₃, h₁, h₂, h₃, e₁, e₂, e₃⟩ := hagK.2 v₁ v₂ v₃ hc + refine ⟨t₁, t₂, t₃, h₁, h₂, h₃, ?_, ?_, ?_⟩ + · rw [hν v₁ (hbarK hm.2.2.2.1), e₁] + rfl + · rw [hν v₂ (hbarK hm.2.2.2.2.1), e₂] + rfl + · rw [hν v₃ (hbarK hm.2.2.2.2.2.1), e₃] + rfl + let N₁ : Neighborhood α β := + { G := H₁, Ω := Ω₁, Ω₀ := N.Ω₀, finite_V := N.finite_V.subset hsep.1.vertexSet_mono, + finite_E := N.finite_E.subset hsep.1.edgeSet_mono, + bar_subset := hΩ₁.subset.trans hKH₁.vertexSet_mono, bar₀_subset := hbar₀H₁ } + let N₂ : Neighborhood α β := + { G := H₂, Ω := N.Ω, Ω₀ := Ω₁, finite_V := N.finite_V.subset hsep.2.1.vertexSet_mono, + finite_E := N.finite_E.subset hsep.2.1.edgeSet_mono, bar_subset := hbarH₂, + bar₀_subset := hΩ₁.subset.trans hK₂ } + have hbdΩ₁ : ∀ G' : Graph α β, G' ≤ N.G → ∀ v ∈ V(G'), + (graphDrawingVertexSet Γ v ⊆ subBd (D last) ↔ v ∈ Ω₁.bar) := by + intro G' hG' v hv + rw [hΩ₁] + exact hbdK v (hG'.vertexSet_mono hv) + obtain ⟨P₁, hP₁Δ, hP₁Δ₀, -, hP₁U⟩ := Presentation.exists_of_le (N' := N₁) P_pres hsep.1 + (hDd last).1 (hDs last).1 + (fun q hq => ⟨hUH₁ hq, (P_pres.U_subset (graphDrawingSubgraphU_subset_U Γ _ hq)).2⟩) + (hbdΩ₁ H₁ hsep.1) (fun v hv => P_pres.mem_bd_Δ₀_iff v (hsep.1.vertexSet_mono hv)) + ⟨φ, hφ_cw, hag⟩ P_pres.agrees_Δ₀ + obtain ⟨P₂, -, -, -, -⟩ := Presentation.exists_of_le (N' := N₂) P_pres hsep.2.1 + P_pres.isClosedDisc_Δ (hDs last).2 hUH₂ + (fun v hv => P_pres.mem_bd_Δ_iff v (hsep.2.1.vertexSet_mono hv)) + (hbdΩ₁ H₂ hsep.2.1) P_pres.agrees_Δ (Or.inr ⟨(hDd last).1, φ, hφ_cw, hag⟩) + have hrural₁ : N₁.IsRural := ⟨P₁.Γ, P₁.Δ, P₁.Δ₀, P₁.isClosedDisc_Δ, P₁.Δ₀_subset_Δ, P₁.U_subset, + P₁.mem_bd_Δ_iff, P₁.mem_bd_Δ₀_iff, P₁.agrees_Δ, P₁.agrees_Δ₀⟩ + have hrural₂ : N₂.IsRural := ⟨P₂.Γ, P₂.Δ, P₂.Δ₀, P₂.isClosedDisc_Δ, P₂.Δ₀_subset_Δ, P₂.U_subset, + P₂.mem_bd_Δ_iff, P₂.mem_bd_Δ₀_iff, P₂.agrees_Δ, P₂.agrees_Δ₀⟩ + have hnest₁ : N₁.IsNest P₁ C := by + refine ⟨fun j => ⟨hCH₁ j, (hcir j).2⟩, hdisj, D, fun j => ⟨(hDd j).1, ?_⟩, fun j => ?_, hDm⟩ + · rw [hP₁U _ (hCH₁ j)] + exact (hDd j).2 + · rw [hP₁Δ, hP₁Δ₀] + exact ⟨(hDs j).1, hDm j last (hlast j)⟩ + have hH₁S : H₁ ≤ S_comp.G := hsep.1.trans hNG + obtain ⟨hsU, hVU⟩ := hcomp.isGraphSeparation_union (IsGraphSeparation.symm hsep) hbar₀H₁ + have hsU' : IsGraphSeparation S_comp.G H₂ (subgraphUnion S_comp.G H₁ S₀.G) := hsU + have hS₀S : S₀.G ≤ S_comp.G := hcomp.1.1.1 + let S₁ : Society α β := + { G := subgraphUnion S_comp.G H₁ S₀.G, Ω := Ω₁, + finite_V := S_comp.finite_V.subset (subgraphUnion_le hH₁S hS₀S).vertexSet_mono, + finite_E := S_comp.finite_E.subset (subgraphUnion_le hH₁S hS₀S).edgeSet_mono, + bar_subset := fun v hv => Or.inl (hKH₁.vertexSet_mono (hΩ₁ ▸ hv)) } + have hcutU : V(H₂) ∩ V(S₁.G) = V(C last) := by + rw [show V(H₂) ∩ V(S₁.G) = V(H₂) ∩ V(H₁) from hVU, inter_comm, hcut] + have hcomp₂ : S_comp.IsComposition S₁ N₂ := by + refine ⟨⟨IsGraphSeparation.symm hsU', hΩ ▸ hbarH₂⟩, hΩ, rfl, ?_⟩ + change Ω₁.bar = V(S₁.G) ∩ V(H₂) + rw [hΩ₁, inter_comm, hcutU] + have hcomp₁ : S₁.IsComposition S₀ N₁ := by + obtain ⟨⟨hs₀, -⟩, -, hΩ₀, hbar₀⟩ := hcomp + have hUle₀ : S₀.G ≤ S₁.G := le_subgraphUnion_right hH₁S hS₀S + have hUle₁ : H₁ ≤ S₁.G := le_subgraphUnion_left hH₁S hS₀S + refine ⟨⟨⟨hUle₀, hUle₁, ?_, ?_, ?_⟩, ?_⟩, rfl, hΩ₀, ?_⟩ + · change V(S₀.G) ∪ V(H₁) = V(H₁) ∪ V(S₀.G) + exact union_comm _ _ + · rw [show E(S₁.G) = E(H₁) ∪ E(S₀.G) from edgeSet_subgraphUnion hH₁S hS₀S] + exact union_comm _ _ + · exact hs₀.2.2.2.2.mono_right hsep.1.edgeSet_mono + · change Ω₁.bar ⊆ V(H₁) + exact hΩ₁.subset.trans hKH₁.vertexSet_mono + · change S₀.Ω.bar = V(S₀.G) ∩ V(H₁) + apply Subset.antisymm + · intro v hv + refine ⟨S₀.bar_subset hv, hbar₀H₁ ?_⟩ + rw [hΩ₀] + exact hv + · rintro v ⟨hv₀, hv₁⟩ + rw [hbar₀] + exact ⟨hv₀, hsep.1.vertexSet_mono hv₁⟩ + exact ⟨N₁, N₂, P₁, S₁, hsep, hcut, hKH₁, hΩ₁, hbarH₂, hbar₀H₁, hrural₁, hrural₂, + hnest₁, subgraphUnion_le hH₁S hS₀S, hcutU, hcomp₁, hcomp₂⟩ + +/-- **Graph Minors IX, (10.4)** (page 65): +"Let $p \ge 2$ with $p \ne 3$. Let $(G, \Omega, \Omega_0)$ be a rural neighborhood of breadth +$\ge p + 5$, and let $X \subseteq \bar{\Omega}$ be linked with $|X| \ge 2p + 8$." -/ +theorem theorem_10_4_proof {S_comp S₀ : Society α β} {N : Neighborhood α β} {p : ℕ} {X : Set α} + (hp2 : 2 ≤ p) (hp3 : p ≠ 3) (hbreadth : N.HasBreadthGe (p + 5)) + (hX : N.IsLinked X) (hcard : 2 * p + 8 ≤ X.ncard) (hcomp : S_comp.IsComposition S₀ N) + {P₀ : Set (Graph α β)} (hP₀ : S_comp.IsCrookedTransaction P₀) (hp : p ≤ P₀.ncard) : + ∃ P' : Set (Graph α β), S_comp.IsCrookedTransaction P' ∧ p ≤ P'.ncard ∧ + S_comp.transactionEnds P' ⊆ X ∧ + ∀ P ∈ P', Disjoint (pathInternalVerts S_comp.G P) S_comp.Ω.bar := by + classical + obtain ⟨P_pres, C', hC'⟩ := hbreadth + obtain ⟨C, P, x, t, hC, hCbar, hP, hPd, hI⟩ := exists_clean_paths P_pres hC' hX + have hΩ : N.Ω = S_comp.Ω := hcomp.2.1 + have hNG : N.G ≤ S_comp.G := hcomp.1.1.2.1 + let last : Fin (p + 4) := ⟨p + 3, by omega⟩ + obtain ⟨hcir, hdisj, D, hDd, hDs, hDm⟩ := hC + obtain ⟨N₁, N₂, P₁, S₁, hsep, hcut, hKH₁, hΩ₁, hbarH₂, hbar₀H₁, hrural₁, hrural₂, + hnest₁, hS₁S, hcutU, hcomp₁, hcomp₂⟩ := + exists_nested_neighborhood_composition P_pres C D last (fun j => Fin.mk_le_mk.mpr (by omega)) + hcir hdisj hDd hDs hDm (hCbar last) hcomp + let H₁ := N₁.G + let H₂ := N₂.G + have hsplit : ∀ i, ∃ (y : α) (R W : Graph α β), y ∈ V(C last) ∧ + IsGraphPathWithEnds H₂ R (x i) y ∧ V(R) ⊆ V(P i) ∧ V(R) ∩ V(C last) = {y} ∧ + IsGraphPathWithEnds H₁ W y (t i) ∧ V(W) ⊆ V(P i) := by + intro i + obtain ⟨I, hIp, hIP, hIK, hVI⟩ := hI i last + exact splitPathAtInnerCircuit hsep hcut hKH₁ (hP i).1.1 hIp hIP hIK hVI + (hbarH₂ ((hP i).2.symm ▸ (mem_singleton _ : x i ∈ {x i})).2) + (hbar₀H₁ ((hP i).1.2.2.symm ▸ (mem_singleton _ : t i ∈ {t i})).2) + choose y R W hyK hR hRP hRK hW hWP using hsplit + have hyR : ∀ i, y i ∈ V(R i) := fun i => (hR i).right_mem + have hy_inj : Injective y := by + intro i j e + by_contra hne + exact Set.disjoint_left.mp (hPd hne) (hRP i (hyR i)) (e ▸ hRP j (hyR j)) + have hx_inj : Injective x := by + intro i j e + by_contra hne + exact Set.disjoint_left.mp (hPd hne) (hP i).1.1.left_mem (e ▸ (hP j).1.1.left_mem) + have hRd : ∀ {i j}, i ≠ j → Disjoint V(R i) V(R j) := fun hne => + (hPd hne).mono (hRP _) (hRP _) + have hYcard : (range y).ncard = X.ncard := by + rw [← image_univ, ncard_image_of_injective _ hy_inj, ncard_univ, Nat.card_fin] + have hΩ₀ : N₁.Ω₀ = N.Ω₀ := hcomp₁.2.2.1.trans hcomp.2.2.1.symm + have hweak : N₁.IsWeaklyLinked (range y) := by + exact weakLinkingAlongOuterPaths (N₁ := N₁) hYcard + (fun i => hΩ₁.symm ▸ hyK i) hW hPd hWP hRP hyR (fun i => hΩ₀.symm ▸ (hP i).1.2.2) + obtain ⟨T₀, hT₀, hpT₀⟩ := theorem_9_1_proof hcomp₂ hrural₂ hP₀ hp + obtain ⟨T, hT, hpT, hTends⟩ := theorem_10_3_proof hp2 hp3 hrural₁ ⟨P₁, C, hnest₁⟩ hweak + (by rw [hYcard]; exact hcard) hcomp₁ hT₀ hpT₀ + have hxb : ∀ i, x i ∈ S_comp.Ω.bar := by + intro i + have hx : x i ∈ V(P i) ∩ N.Ω.bar := (hP i).2.symm ▸ mem_singleton _ + exact hΩ ▸ hx.2 + have hxX : ∀ i, x i ∈ X := fun i => + ((hP i).1.2.1.symm ▸ mem_singleton _ : x i ∈ V(P i) ∩ X).2 + have hRbar : ∀ i, V(R i) ∩ S_comp.Ω.bar = {x i} := by + intro i + apply Subset.antisymm + · intro v hv + have hmem : v ∈ V(P i) ∩ N.Ω.bar := ⟨hRP i hv.1, hΩ ▸ hv.2⟩ + rwa [(hP i).2] at hmem + · rintro _ rfl + exact ⟨(hR i).left_mem, hxb i⟩ + obtain ⟨T', hT', hsize, hends, hinternal⟩ := + extend_crooked_transaction_across_neighborhood (N₂ := N₂) (K := C last) (by omega) + hS₁S (hsep.2.1.trans hNG) hcutU hcomp₂.2.1 hcomp₂.2.2.1 + hrural₂ (fun v hv => hbarH₂ (hΩ ▸ hv)) (hΩ ▸ hCbar last) + hR hRK hy_inj hx_inj hRd (fun i => hcomp₁.2.1 ▸ (hΩ₁.symm ▸ hyK i)) + hxb hxX hRbar hT hTends + exact ⟨T', hT', hsize.symm ▸ hpT, hends, hinternal⟩ + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section11a.lean b/LeanPool/GraphMinor/GM09/Section11a.lean new file mode 100644 index 0000000000..9fa7a63eef --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section11a.lean @@ -0,0 +1,979 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2d +import LeanPool.GraphMinor.GM09.Section3a + +/-! +# Graph Minors IX, Section 11 (Part 1): Consolidations and Their Cores ((11.6)–(11.10)) + +This file formalizes (11.6), (11.7), (11.8), (11.9), and (11.10) from Section 11 of +N. Robertson and P. D. Seymour, *Graph Minors. IX. Disjoint crossed paths*, +J. Combin. Theory Ser. B **49** (1990) 40–77 (pages 70–73). +-/ + +@[expose] public section + +namespace GraphMinor.GM09 +open Set Graph GraphMinor.Surface GraphMinor.GM06 +universe u v w +variable {α : Type u} {β : Type v} {γ : Type w} + +/-! ## Helper definitions and lemmas for (11.6) -/ + +/-- The single-edge subgraph `A_e` of `G` consisting of `e` and its ends. -/ +def singleEdgeSubgraph (G : Graph α β) (e : β) : Graph α β := (G.induce {u : α | G.Inc e + u}).restrict {e} +@[simp] theorem vertexSet_singleEdgeSubgraph (G : Graph α β) (e : β) : + V(singleEdgeSubgraph G e) = {u : α | G.Inc e u} := rfl +theorem singleEdgeSubgraph_le (G : Graph α β) (e : β) : singleEdgeSubgraph G e ≤ G := + restrict_le.trans (G.induce_le fun _ hu => hu.vertex_mem) +theorem vertexSet_singleEdgeSubgraph_eq_pair {G : Graph α β} {e : β} {x y : α} + (hxy : G.IsLink e x y) : V(singleEdgeSubgraph G e) = {x, y} := by + ext u; simp only [vertexSet_singleEdgeSubgraph, mem_ofPred_eq, mem_insert_iff, mem_singleton_iff] + exact ⟨fun ⟨_, huw⟩ => G.eq_or_eq_of_isLink_of_isLink huw hxy, + by rintro (rfl | rfl); exacts [⟨y, hxy⟩, ⟨x, hxy.symm⟩]⟩ +@[simp] theorem edgeSet_singleEdgeSubgraph {G : Graph α β} {e : β} (he : e ∈ E(G)) : + E(singleEdgeSubgraph G e) = {e} := by + unfold singleEdgeSubgraph; rw [edgeSet_restrict, inter_eq_right, singleton_subset_iff] + obtain ⟨x, y, hxy⟩ := G.exists_isLink_of_mem_edgeSet he; exact ⟨x, y, hxy, ⟨y, hxy⟩, ⟨x, + hxy.symm⟩⟩ +theorem singleEdgeSubgraph_isLink {G : Graph α β} {e f : β} {x y : α} : + (singleEdgeSubgraph G e).IsLink f x y ↔ f = e ∧ G.IsLink e x y := by + rw [(singleEdgeSubgraph_le G e).isLink_iff'] + refine ⟨fun ⟨hlink, hf⟩ => ?_, fun ⟨rfl, hlink⟩ => ?_⟩ + · obtain rfl : f = e := mem_singleton_iff.mp hf.2; exact ⟨rfl, hlink⟩ + · rw [edgeSet_singleEdgeSubgraph hlink.edge_mem]; exact ⟨hlink, rfl⟩ + +theorem isGraphPathWithEnds_singleEdgeSubgraph {G : Graph α β} {e : β} {u v : α} + (huv : u ≠ v) (hlink : G.IsLink e u v) : + IsGraphPathWithEnds (singleEdgeSubgraph G e) (singleEdgeSubgraph G e) u v := by + have hlink_A := singleEdgeSubgraph_isLink.mpr ⟨rfl, hlink⟩ + let W : GraphWalk (singleEdgeSubgraph G e) u v := .cons hlink_A (.nil hlink_A.right_mem) + refine ⟨le_rfl, W, by unfold GraphWalk.IsSimple; simp [W, huv], ?_, ?_⟩ + · rw [vertexSet_singleEdgeSubgraph_eq_pair hlink]; ext z; simp [W] + · rw [edgeSet_singleEdgeSubgraph hlink.edge_mem]; ext f; simp [W] + +/-- **Graph Minors IX, (11.6)** (page 70): +"Every society has a consolidation." -/ +theorem theorem_11_6_proof (S : Society α β) : ∃ D_set : Set (Graph α β × Graph α β), + IsConsolidation S D_set := by + let D_V := (fun v => (singleVertexSubgraph S.G v, S.G)) '' V(S.G) + let D_E := (fun e => (singleEdgeSubgraph S.G e, deleteSingleEdge S.G e)) '' E(S.G) + let D_set := D_V ∪ D_E + have hA_le : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D_set → A ≤ S.G := by + rintro A B (⟨v, hv, hpair⟩ | ⟨e, _, hpair⟩) <;> obtain ⟨rfl, rfl⟩ := Prod.mk.inj hpair + · exact singleVertexSubgraph_le hv + · exact singleEdgeSubgraph_le S.G e + refine ⟨D_set, ⟨?_, ?_, ?_, ?_, ?_⟩⟩ + · rintro A B (⟨v, hv, hpair⟩ | ⟨e, he, hpair⟩) <;> obtain ⟨rfl, rfl⟩ := Prod.mk.inj hpair + · refine ⟨⟨singleVertexSubgraph_le hv, le_rfl, ?_, by simp, ?_⟩, S.bar_subset⟩ + · rw [vertexSet_singleVertexSubgraph, singleton_union, insert_eq_of_mem hv] + · rw [edgeSet_singleVertexSubgraph]; exact empty_disjoint _ + · refine ⟨⟨singleEdgeSubgraph_le S.G e, deleteSingleEdge_le S.G e, ?_, ?_, ?_⟩, S.bar_subset⟩ + · rw [vertexSet_deleteSingleEdge, union_eq_right.mpr (singleEdgeSubgraph_le S.G + e).vertexSet_mono] + · rw [edgeSet_singleEdgeSubgraph he, edgeSet_deleteSingleEdge, + union_sdiff_cancel (singleton_subset_iff.mpr he)] + · rw [edgeSet_singleEdgeSubgraph he, edgeSet_deleteSingleEdge]; exact disjoint_sdiff_right + · rintro A B (⟨v, _, hpair⟩ | ⟨e, he, hpair⟩) <;> obtain ⟨rfl, rfl⟩ := Prod.mk.inj hpair + · exact (ncard_le_ncard inter_subset_left (finite_singleton v)).trans (by simp) + · obtain ⟨x, y, hxy⟩ := S.G.exists_isLink_of_mem_edgeSet he + have hsub : V(singleEdgeSubgraph S.G e) ∩ V(deleteSingleEdge S.G e) ⊆ {x, y} := by + rw [vertexSet_singleEdgeSubgraph_eq_pair hxy]; exact inter_subset_left + exact (ncard_le_ncard hsub ((finite_singleton y).insert x)).trans + ((ncard_insert_le x {y}).trans (by simp)) + · rintro A B A' B' hAB hA'B' hne + have hAG : A ≤ S.G := hA_le hAB + rcases hA'B' with ⟨v', _, hpair'⟩ | ⟨e', he', hpair'⟩ <;> obtain ⟨rfl, rfl⟩ + := Prod.mk.inj hpair' + · exact hAG + · rw [(Compatible.of_le_le hAG (deleteSingleEdge_le S.G e')).le_iff, + vertexSet_deleteSingleEdge, edgeSet_deleteSingleEdge] + refine ⟨hAG.vertexSet_mono, ?_⟩ + rcases hAB with ⟨v, _, hpair⟩ | ⟨e, he, hpair⟩ <;> obtain ⟨rfl, rfl⟩ := Prod.mk.inj hpair + · simp + · rw [edgeSet_singleEdgeSubgraph he, singleton_subset_iff]; exact ⟨he, fun h => hne (h ▸ rfl)⟩ + · have hP : ∀ P ∈ Prod.fst '' D_set, P ≤ S.G := by rintro P ⟨⟨A, B⟩, hAB, rfl⟩; exact hA_le hAB + refine (Compatible.of_le_le (subgraphSUnion_le hP) le_rfl).ext + (subset_antisymm (subgraphSUnion_le hP).vertexSet_mono fun v hv => ?_) + (subset_antisymm (subgraphSUnion_le hP).edgeSet_mono fun e he => ?_) + · rw [vertexSet_subgraphSUnion, mem_iUnion₂] + exact ⟨singleVertexSubgraph S.G v, ⟨(singleVertexSubgraph S.G v, S.G), Or.inl ⟨v, hv, rfl⟩, + rfl⟩, by simp⟩ + · rw [edgeSet_subgraphSUnion hP, mem_iUnion₂] + exact ⟨singleEdgeSubgraph S.G e, + ⟨(singleEdgeSubgraph S.G e, deleteSingleEdge S.G e), Or.inr ⟨e, he, rfl⟩, rfl⟩, by simp + [he]⟩ + · rintro A B (⟨v, _, hpair⟩ | ⟨e, he, hpair⟩) u hu w hw huw <;> obtain ⟨rfl, rfl⟩ + := Prod.mk.inj hpair + · exact (huw ((mem_singleton_iff.mp hu.1).trans (mem_singleton_iff.mp hw.1).symm)).elim + · obtain ⟨x, y, hxy⟩ := S.G.exists_isLink_of_mem_edgeSet he + have hV_eq := vertexSet_singleEdgeSubgraph_eq_pair hxy + have hu_xy : u = x ∨ u = y := by + have h := hu.1; rwa [hV_eq, mem_insert_iff, mem_singleton_iff] at h + have hw_xy : w = x ∨ w = y := by + have h := hw.1; rwa [hV_eq, mem_insert_iff, mem_singleton_iff] at h + have hlink_uw : S.G.IsLink e u w := by + rcases hu_xy with rfl | rfl <;> rcases hw_xy with rfl | rfl + · exact (huw rfl).elim + · exact hxy + · exact hxy.symm + · exact (huw rfl).elim + refine ⟨singleEdgeSubgraph S.G e, isGraphPathWithEnds_singleEdgeSubgraph huw hlink_uw, ?_⟩ + rw [vertexSet_singleEdgeSubgraph_eq_pair hlink_uw, Set.sdiff_self]; exact empty_disjoint _ + +/-! ## (11.7) and properties of `consolidationBInter` and `consolidationCore` -/ + +/-- The subgraph intersection `⋂ (B : (A, B) ∈ D_set)` inside `S.G`. -/ +def consolidationBInter (S : Society α β) (D_set : Set (Graph α β × Graph α β)) : Graph α β := + (S.G.induce (V(S.G) ∩ ⋂ p ∈ D_set, V(p.2))).restrict (E(S.G) ∩ ⋂ p ∈ D_set, E(p.2)) +@[simp] theorem vertexSet_consolidationBInter (S : Society α β) (D_set : Set + (Graph α β × Graph α β)) : + V(consolidationBInter S D_set) = V(S.G) ∩ ⋂ p ∈ D_set, V(p.2) := rfl +theorem consolidationBInter_le (S : Society α β) (D_set : Set (Graph α β × Graph α β)) : + consolidationBInter S D_set ≤ S.G := restrict_le.trans (S.G.induce_le inter_subset_left) +theorem IsConsolidation.left_le {S : Society α β} {D_set : Set (Graph α β × Graph α β)} + (hD : IsConsolidation S D_set) {A B : Graph α β} (hAB : (A, B) ∈ D_set) : + A ≤ S.G := (hD.isSocietySeparation hAB).1.1 +theorem IsConsolidation.right_le {S : Society α β} {D_set : Set (Graph α β × Graph α β)} + (hD : IsConsolidation S D_set) {A B : Graph α β} (hAB : (A, B) ∈ D_set) : + B ≤ S.G := (hD.isSocietySeparation hAB).1.2.1 +theorem IsConsolidation.forall_fst_le {S : Society α β} {D_set : Set (Graph α β × Graph α β)} + (hD : IsConsolidation S D_set) : ∀ P ∈ Prod.fst '' D_set, P ≤ S.G := by + rintro P ⟨⟨A, B⟩, hAB, rfl⟩; exact hD.left_le hAB +theorem IsConsolidation.exists_mem_of_mem_edgeSet {S : Society α β} + {D_set : Set (Graph α β × Graph α β)} (hD : IsConsolidation S D_set) {e : β} (he : e ∈ E(S.G)) : + ∃ A B : Graph α β, (A, B) ∈ D_set ∧ e ∈ E(A) := by + have he' : e ∈ E(subgraphSUnion S.G (Prod.fst '' D_set)) := by rwa [hD.union_eq] + rw [edgeSet_subgraphSUnion hD.forall_fst_le, mem_iUnion₂] at he' + rcases he' with ⟨A, ⟨⟨A', B'⟩, hAB, rfl⟩, heA⟩; exact ⟨A', B', hAB, heA⟩ +theorem IsConsolidation.exists_mem_of_mem_vertexSet {S : Society α β} + {D_set : Set (Graph α β × Graph α β)} (hD : IsConsolidation S D_set) {v : α} (hv : v ∈ V(S.G)) : + ∃ A B : Graph α β, (A, B) ∈ D_set ∧ v ∈ V(A) := by + have hv' : v ∈ V(subgraphSUnion S.G (Prod.fst '' D_set)) := by rwa [hD.union_eq] + rw [vertexSet_subgraphSUnion, mem_iUnion₂] at hv' + rcases hv' with ⟨A, ⟨⟨A', B'⟩, hAB, rfl⟩, hvA⟩; exact ⟨A', B', hAB, hvA⟩ + +/-- **Graph Minors IX, (11.7)** (page 70): +"If $\mathcal{D}$ is a consolidation of $(G, \Omega)$ and $C = \bigcap (B: (A, B) \in +\mathcal{D})$ then $E(C) = \emptyset$, $\bar{\Omega} \subseteq V(C)$, $A \cap B \subseteq C$ +for every $(A, B) \in \mathcal{D}$ and $A_1 \cap A_2 \subseteq C$ for every two distinct +separations $(A_1, B_1), (A_2, B_2) \in \mathcal{D}$." -/ +theorem theorem_11_7_proof {S : Society α β} {D_set : Set (Graph α β × Graph α β)} + (hD : IsConsolidation S D_set) : + let C := consolidationBInter S D_set + E(C) = ∅ ∧ S.Ω.bar ⊆ V(C) ∧ (∀ ⦃A B : Graph α β⦄, (A, B) ∈ D_set → subgraphInter S.G A B ≤ C) ∧ + (∀ ⦃A₁ B₁ A₂ B₂ : Graph α β⦄, + (A₁, B₁) ∈ D_set → (A₂, B₂) ∈ D_set → (A₁, B₁) ≠ (A₂, B₂) → subgraphInter S.G A₁ A₂ ≤ C) := by + intro C; have hC_le : C ≤ S.G := consolidationBInter_le S D_set + have hEC : E(C) = ∅ := eq_empty_iff_forall_notMem.mpr fun e heC => by + obtain ⟨A, B, hAB, heA⟩ := hD.exists_mem_of_mem_edgeSet heC.2.1 + exact disjoint_left.mp (hD.isSocietySeparation hAB).1.2.2.2.2 heA (mem_iInter₂.mp heC.2.2 (A, + B) hAB) + have hΩC : S.Ω.bar ⊆ V(C) := + subset_inter S.bar_subset (subset_iInter₂_iff.mpr fun ⟨_, _⟩ hAB => + (hD.isSocietySeparation hAB).2) + have hAB_le : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D_set → subgraphInter S.G A B ≤ C := by + intro A B hAB; have hsep : IsGraphSeparation S.G A B := (hD.isSocietySeparation hAB).1 + rw [(Compatible.of_le_le (subgraphInter_le hsep.1) hC_le).le_iff] + refine ⟨subset_inter (inter_subset_left.trans hsep.1.vertexSet_mono) ?_, ?_⟩ + · rw [subset_iInter₂_iff]; rintro ⟨A', B'⟩ hA'B' v ⟨hvA, hvB⟩ + by_cases heq : (A, B) = (A', B') + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj heq; exact hvB + · exact (hD.left_le_right hAB hA'B' heq).vertexSet_mono hvA + · rw [IsGraphSeparation.edgeSet_subgraphInter hsep]; exact empty_subset _ + refine ⟨hEC, hΩC, hAB_le, fun A₁ B₁ A₂ B₂ h1 h2 hne => ?_⟩ + have hA₁G := hD.left_le h1; have hA₂G := hD.left_le h2 + exact (le_subgraphInter hA₁G (hD.right_le h1) (subgraphInter_le_left hA₁G hA₂G) + ((subgraphInter_le_right hA₁G hA₂G).trans (hD.left_le_right h2 h1 hne.symm))).trans (hAB_le h1) + +/-! ## Properties of `consolidationCore` and `consolidationCoreSociety` -/ +@[simp] theorem vertexSet_consolidationCore (S : Society α β) (D_set : Set + (Graph α β × Graph α β)) : + V(consolidationCore S D_set) = V(S.G) ∩ ⋂ p ∈ D_set, V(p.2) := rfl +@[simp] theorem consolidationCore_isLink (S : Society α β) (D_set : Set (Graph α β × Graph α β)) + {e : Sym2 α} {x y : α} : (consolidationCore S D_set).IsLink e x y ↔ + x ≠ y ∧ e = s(x, y) ∧ x ∈ V(consolidationCore S D_set) ∧ y ∈ V(consolidationCore S D_set) ∧ + ∃ p ∈ D_set, x ∈ V(p.1) ∩ V(p.2) ∧ y ∈ V(p.1) ∩ V(p.2) := Iff.rfl +theorem vertexSet_consolidationCore_subset (S : Society α β) (D_set : Set (Graph α β × Graph α β)) : + V(consolidationCore S D_set) ⊆ V(S.G) := inter_subset_left +theorem vertexSet_consolidationCore_subset_right {S : Society α β} + {D_set : Set (Graph α β × Graph α β)} {A B : Graph α β} (hAB : (A, B) ∈ D_set) : + V(consolidationCore S D_set) ⊆ V(B) := fun _ hv => mem_iInter₂.mp hv.2 (A, B) hAB +theorem IsConsolidation.bar_subset_consolidationCore {S : Society α β} + {D_set : Set (Graph α β × Graph α β)} (hD : IsConsolidation S D_set) : + S.Ω.bar ⊆ V(consolidationCore S D_set) := (theorem_11_7_proof hD).2.1 +theorem IsConsolidation.inter_subset_consolidationCore {S : Society α β} + {D_set : Set (Graph α β × Graph α β)} (hD : IsConsolidation S D_set) {A B : Graph α β} (hAB : + (A, B) ∈ D_set) : + V(A) ∩ V(B) ⊆ V(consolidationCore S D_set) := ((theorem_11_7_proof hD).2.2.1 hAB).vertexSet_mono +theorem IsConsolidation.left_inter_left_subset_consolidationCore {S : Society α β} + {D_set : Set (Graph α β × Graph α β)} (hD : IsConsolidation S D_set) + {A₁ B₁ A₂ B₂ : Graph α β} (h1 : (A₁, B₁) ∈ D_set) (h2 : (A₂, B₂) ∈ D_set) (hne : (A₁, B₁) ≠ + (A₂, B₂)) : + V(A₁) ∩ V(A₂) ⊆ V(consolidationCore S D_set) := ((theorem_11_7_proof hD).2.2.2 h1 h2 + hne).vertexSet_mono +theorem IsConsolidation.disjoint_edges_of_ne {S : Society α β} + {D_set : Set (Graph α β × Graph α β)} (hD : IsConsolidation S D_set) + {A₁ B₁ A₂ B₂ : Graph α β} (h1 : (A₁, B₁) ∈ D_set) (h2 : (A₂, B₂) ∈ D_set) + (hne : (A₁, B₁) ≠ (A₂, B₂)) : Disjoint E(A₁) E(A₂) := by + have hE := ((theorem_11_7_proof hD).2.2.2 h1 h2 hne).edgeSet_mono + rw [(theorem_11_7_proof hD).1, edgeSet_subgraphInter (hD.left_le h1) (hD.left_le h2), + subset_empty_iff] at hE + exact disjoint_iff_inter_eq_empty.mpr hE +theorem IsConsolidation.consolidationCore_isLink_of_mem_inter {S : Society α β} + {D_set : Set (Graph α β × Graph α β)} (hD : IsConsolidation S D_set) + {A B : Graph α β} (hAB : (A, B) ∈ D_set) {u v : α} + (hu : u ∈ V(A) ∩ V(B)) (hv : v ∈ V(A) ∩ V(B)) (huv : u ≠ v) : (consolidationCore S + D_set).IsLink s(u, v) u v := + ⟨huv, rfl, hD.inter_subset_consolidationCore hAB hu, + hD.inter_subset_consolidationCore hAB hv, (A, B), hAB, hu, hv⟩ +theorem finite_vertexSet_consolidationCore (S : Society α β) (D_set : Set (Graph α β × Graph α β)) : + V(consolidationCore S D_set).Finite := S.finite_V.subset (vertexSet_consolidationCore_subset S + D_set) +theorem finite_edgeSet_consolidationCore (S : Society α β) (D_set : Set (Graph α β × Graph α β)) : + E(consolidationCore S D_set).Finite := by + have hsub : E(consolidationCore S D_set) ⊆ (fun p : α × α => s(p.1, p.2)) '' (V(S.G) ×ˢ V(S.G)) + := by + rintro e ⟨u, v, _, rfl, hu, hv, _⟩; exact ⟨(u, v), ⟨hu.1, hv.1⟩, rfl⟩ + exact ((S.finite_V.prod S.finite_V).image _).subset hsub + +/-- The core society `(C, Ω)` of a consolidation `D_set` of `S = (G, Ω)`. -/ +def consolidationCoreSociety (S : Society α β) + (D_set : Set (Graph α β × Graph α β)) (hD : IsConsolidation S D_set) : Society α (Sym2 α) := + ⟨consolidationCore S D_set, S.Ω, finite_vertexSet_consolidationCore S D_set, + finite_edgeSet_consolidationCore S D_set, hD.bar_subset_consolidationCore⟩ +@[simp] theorem consolidationCoreSociety_G (S : Society α β) + (D_set : Set (Graph α β × Graph α β)) (hD : IsConsolidation S D_set) : + (consolidationCoreSociety S D_set hD).G = consolidationCore S D_set := rfl +@[simp] theorem consolidationCoreSociety_Ω (S : Society α β) + (D_set : Set (Graph α β × Graph α β)) (hD : IsConsolidation S D_set) : + (consolidationCoreSociety S D_set hD).Ω = S.Ω := rfl + +/-! ## (11.8): Partitioning a consolidation along a separation of its core -/ + +/-- **Graph Minors IX, (11.8)** (pages 70–71): +"Let $\mathcal{D}$ be a consolidation of $(G, \Omega)$ with core $C$. Let $C_1, C_2 \subseteq +C$ with $C_1 \cup C_2 = C$ and $\bar{\Omega} \subseteq V(C_2)$. Let $\mathcal{D} = +\mathcal{D}_1 \cup \mathcal{D}_2$, where $\mathcal{D}_1 \cap \mathcal{D}_2 = \emptyset$ and +$V(A \cap B) \subseteq V(C_i)$ for $i = 1, 2$ and all $(A, B) \in \mathcal{D}_i$. Let $C^*$ +be the graph with $V(C^*) = V(C_1 \cap C_2)$ and $E(C^*) = \emptyset$. Let* $$G_i = C^* \cup +\bigcup (A: (A, B) \in \mathcal{D}_i) \qquad (i = 1, 2).$$ ... *Then $(G_1, G_2)$ is a +separation of $(G, \Omega)$, $G_1 \cap G_2 = C^*$, $V(G_1) \cap V(C) = V(C_1)$, and $V(G_2) +\cap V(C) = V(C_2)$." -/ +theorem theorem_11_8_proof {S : Society α β} {D_set D₁ D₂ : Set (Graph α β × Graph α β)} + (hD : IsConsolidation S D_set) {C₁ C₂ : Graph α (Sym2 α)} + (hC₁ : C₁ ≤ consolidationCore S D_set) (hC₂ : C₂ ≤ consolidationCore S D_set) + (_hC_union : subgraphUnion (consolidationCore S D_set) C₁ C₂ = consolidationCore S D_set) + (hΩ : S.Ω.bar ⊆ V(C₂)) (hD_union : D₁ ∪ D₂ = D_set) (hD_disj : Disjoint D₁ D₂) + (hD₁ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₁ → V(A) ∩ V(B) ⊆ V(C₁)) + (hD₂ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₂ → V(A) ∩ V(B) ⊆ V(C₂)) : + let C := consolidationCore S D_set + let C_star : Graph α β := (S.G.induce (V(C₁) ∩ V(C₂))).restrict ∅ + let G₁ : Graph α β := subgraphUnion S.G C_star (subgraphSUnion S.G (Prod.fst '' D₁)) + let G₂ : Graph α β := subgraphUnion S.G C_star (subgraphSUnion S.G (Prod.fst '' D₂)) + S.IsSocietySeparation G₁ G₂ ∧ subgraphInter S.G G₁ G₂ = C_star ∧ + V(G₁) ∩ V(C) = V(C₁) ∧ V(G₂) ∩ V(C) = V(C₂) := by + intro C C_star G₁ G₂ + have hD₁_sub : D₁ ⊆ D_set := hD_union ▸ subset_union_left + have hD₂_sub : D₂ ⊆ D_set := hD_union ▸ subset_union_right + have hC_star_le : C_star ≤ S.G := restrict_le.trans (S.G.induce_le + (inter_subset_left.trans (hC₁.vertexSet_mono.trans (vertexSet_consolidationCore_subset S + D_set)))) + have hE_C_star : E(C_star) = ∅ := by simp [C_star] + have hU₁_all : ∀ P ∈ Prod.fst '' D₁, P ≤ S.G := fun P hP => hD.forall_fst_le P + (image_mono hD₁_sub hP) + have hU₂_all : ∀ P ∈ Prod.fst '' D₂, P ≤ S.G := fun P hP => hD.forall_fst_le P + (image_mono hD₂_sub hP) + have hU₁_le := subgraphSUnion_le hU₁_all; have hU₂_le := subgraphSUnion_le hU₂_all + have hG₁_le := subgraphUnion_le hC_star_le hU₁_le; have hG₂_le := subgraphUnion_le hC_star_le + hU₂_le + have hV_union : V(G₁) ∪ V(G₂) = V(S.G) := by + refine subset_antisymm (union_subset hG₁_le.vertexSet_mono hG₂_le.vertexSet_mono) fun v hv => ?_ + obtain ⟨A, B, hAB, hvA⟩ := hD.exists_mem_of_mem_vertexSet hv + rcases (hD_union ▸ hAB : (A, B) ∈ D₁ ∪ D₂) with h1 | h2 + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨A, ⟨(A, B), h1, rfl⟩, hvA⟩)) + · exact Or.inr (Or.inr (mem_iUnion₂.mpr ⟨A, ⟨(A, B), h2, rfl⟩, hvA⟩)) + have hE_G₁ : E(G₁) = ⋃ P ∈ Prod.fst '' D₁, E(P) := by + rw [edgeSet_subgraphUnion hC_star_le hU₁_le, hE_C_star, empty_union, + edgeSet_subgraphSUnion hU₁_all] + have hE_G₂ : E(G₂) = ⋃ P ∈ Prod.fst '' D₂, E(P) := by + rw [edgeSet_subgraphUnion hC_star_le hU₂_le, hE_C_star, empty_union, + edgeSet_subgraphSUnion hU₂_all] + have hE_union : E(G₁) ∪ E(G₂) = E(S.G) := by + refine subset_antisymm (union_subset hG₁_le.edgeSet_mono hG₂_le.edgeSet_mono) fun e he => ?_ + obtain ⟨A, B, hAB, heA⟩ := hD.exists_mem_of_mem_edgeSet he + rcases (hD_union ▸ hAB : (A, B) ∈ D₁ ∪ D₂) with h1 | h2 + · left; rw [hE_G₁, mem_iUnion₂]; exact ⟨A, ⟨(A, B), h1, rfl⟩, heA⟩ + · right; rw [hE_G₂, mem_iUnion₂]; exact ⟨A, ⟨(A, B), h2, rfl⟩, heA⟩ + have hV_inter : V(G₁) ∩ V(G₂) = V(C_star) := by + refine subset_antisymm ?_ (subset_inter subset_union_left subset_union_left) + rintro v ⟨hv_star | hvU₁, hv_star | hvU₂⟩ + · exact hv_star + · exact hv_star + · exact hv_star + · obtain ⟨A₁, ⟨⟨A₁', B₁⟩, h1, rfl⟩, hvA₁⟩ := mem_iUnion₂.mp hvU₁ + obtain ⟨A₂, ⟨⟨A₂', B₂⟩, h2, rfl⟩, hvA₂⟩ := mem_iUnion₂.mp hvU₂ + have hne : (A₁', B₁) ≠ (A₂', B₂) := fun heq => disjoint_left.mp hD_disj h1 (heq ▸ h2) + exact ⟨hD₁ h1 ⟨hvA₁, (hD.left_le_right (hD₂_sub h2) (hD₁_sub h1) hne.symm).vertexSet_mono + hvA₂⟩, + hD₂ h2 ⟨hvA₂, (hD.left_le_right (hD₁_sub h1) (hD₂_sub h2) hne).vertexSet_mono hvA₁⟩⟩ + have hE_disj : Disjoint E(G₁) E(G₂) := by + rw [hE_G₁, hE_G₂, disjoint_left]; intro e he₁ he₂ + obtain ⟨A₁, ⟨⟨A₁', B₁⟩, h1, rfl⟩, heA₁⟩ := mem_iUnion₂.mp he₁ + obtain ⟨A₂, ⟨⟨A₂', B₂⟩, h2, rfl⟩, heA₂⟩ := mem_iUnion₂.mp he₂ + have hne : (A₁', B₁) ≠ (A₂', B₂) := fun heq => disjoint_left.mp hD_disj h1 (heq ▸ h2) + exact disjoint_left.mp (hD.disjoint_edges_of_ne (hD₁_sub h1) (hD₂_sub h2) hne) heA₁ heA₂ + have hG_inter : subgraphInter S.G G₁ G₂ = C_star := by + refine (Compatible.of_le_le (subgraphInter_le hG₁_le) hC_star_le).ext ?_ ?_ + · rw [vertexSet_subgraphInter, hV_inter] + · rw [edgeSet_subgraphInter hG₁_le hG₂_le, disjoint_iff_inter_eq_empty.mp hE_disj, hE_C_star] + have hX₁_sub : V(G₁) ∩ V(C) ⊆ V(C₁) := by + rintro v ⟨hv_star | hvU₁, hvC⟩ + · exact hv_star.1 + · obtain ⟨A, ⟨⟨A', B⟩, h1, rfl⟩, hvA⟩ := mem_iUnion₂.mp hvU₁ + exact hD₁ h1 ⟨hvA, vertexSet_consolidationCore_subset_right (hD₁_sub h1) hvC⟩ + have hX₂_sub : V(G₂) ∩ V(C) ⊆ V(C₂) := by + rintro v ⟨hv_star | hvU₂, hvC⟩ + · exact hv_star.2 + · obtain ⟨A, ⟨⟨A', B⟩, h2, rfl⟩, hvA⟩ := mem_iUnion₂.mp hvU₂ + exact hD₂ h2 ⟨hvA, vertexSet_consolidationCore_subset_right (hD₂_sub h2) hvC⟩ + have hX₁_eq : V(G₁) ∩ V(C) = V(C₁) := by + refine subset_antisymm hX₁_sub fun v hvC₁ => ?_ + have hvC : v ∈ V(C) := hC₁.vertexSet_mono hvC₁ + rcases (hV_union ▸ vertexSet_consolidationCore_subset S D_set hvC : v ∈ V(G₁) ∪ V(G₂)) with + hvG₁ | hvG₂ + · exact ⟨hvG₁, hvC⟩ + · have hv_star : v ∈ V(C_star) := ⟨hvC₁, hX₂_sub ⟨hvG₂, hvC⟩⟩ + rw [← hV_inter] at hv_star; exact ⟨hv_star.1, hvC⟩ + have hX₂_eq : V(G₂) ∩ V(C) = V(C₂) := by + refine subset_antisymm hX₂_sub fun v hvC₂ => ?_ + have hvC : v ∈ V(C) := hC₂.vertexSet_mono hvC₂ + rcases (hV_union ▸ vertexSet_consolidationCore_subset S D_set hvC : v ∈ V(G₁) ∪ V(G₂)) with + hvG₁ | hvG₂ + · have hv_star : v ∈ V(C_star) := ⟨hX₁_sub ⟨hvG₁, hvC⟩, hvC₂⟩ + rw [← hV_inter] at hv_star; exact ⟨hv_star.2, hvC⟩ + · exact ⟨hvG₂, hvC⟩ + exact ⟨⟨⟨hG₁_le, hG₂_le, hV_union, hE_union, hE_disj⟩, hΩ.trans (hX₂_eq ▸ inter_subset_left)⟩, + hG_inter, hX₁_eq, hX₂_eq⟩ + +/-! ## Minimal `k`-separations of societies -/ + +/-- If a society `S` has a `k`-separation, it has a `k`-separation `(C₁, C₂)` minimizing `|V(C₁)|` +and, subject to that, minimizing `|E(C₁)|`. -/ +theorem exists_minimal_kSeparation {S : Society α γ} {k : ℕ} (hex : ∃ C₁ C₂ : Graph α γ, + S.IsKSeparation k C₁ C₂) : + ∃ C₁ C₂ : Graph α γ, S.IsKSeparation k C₁ C₂ ∧ + (∀ C₁' C₂' : Graph α γ, S.IsKSeparation k C₁' C₂' → V(C₁).ncard ≤ V(C₁').ncard) ∧ + (∀ C₁' C₂' : Graph α γ, S.IsKSeparation k C₁' C₂' → + V(C₁').ncard = V(C₁).ncard → E(C₁).ncard ≤ E(C₁').ncard) := by + classical + let N_E := E(S.G).ncard + 1 + have hex_wt : ∃ m : ℕ, ∃ C₁ C₂ : Graph α γ, S.IsKSeparation k C₁ C₂ + ∧ V(C₁).ncard * N_E + E(C₁).ncard = m := by + rcases hex with ⟨C₁, C₂, hsep⟩; exact ⟨V(C₁).ncard * N_E + E(C₁).ncard, C₁, C₂, hsep, rfl⟩ + obtain ⟨C₁, C₂, hsep, hm₀⟩ := Nat.find_spec hex_wt + have hmin_wt : ∀ C₁' C₂' : Graph α γ, S.IsKSeparation k C₁' C₂' → + V(C₁).ncard * N_E + E(C₁).ncard ≤ V(C₁').ncard * N_E + E(C₁').ncard := by + intro C₁' C₂' hsep'; rw [hm₀]; exact Nat.find_le ⟨C₁', C₂', hsep', rfl⟩ + refine ⟨C₁, C₂, hsep, ?_, fun C₁' C₂' hsep' hV_eq => ?_⟩ + · intro C₁' C₂' hsep'; by_contra! hlt + have hlt' : V(C₁').ncard + 1 ≤ V(C₁).ncard := hlt + have hE_lt : E(C₁').ncard < N_E := Nat.lt_succ_of_le (ncard_le_ncard hsep'.1.1.1.edgeSet_mono + S.finite_E) + have h1 : V(C₁').ncard * N_E + E(C₁').ncard < (V(C₁').ncard + 1) * N_E := by + rw [Nat.add_one_mul]; omega + have h2 : (V(C₁').ncard + 1) * N_E ≤ V(C₁).ncard * N_E := Nat.mul_le_mul_right N_E hlt' + have h3 := hmin_wt C₁' C₂' hsep'; omega + · have h3 := hmin_wt C₁' C₂' hsep'; rw [hV_eq] at h3; omega + +/-- In a `k`-separation `(C₁, C₂)` of `S` minimizing `|E(C₁)|` for its `|V(C₁)|`, no edge of `C₁` +has both ends in `V(C₂)`. -/ +theorem minimal_kSeparation_no_edge_in_right {S : Society α γ} {k : ℕ} + {C₁ C₂ : Graph α γ} (hsep : S.IsKSeparation k C₁ C₂) + (hminE : ∀ C₁' C₂' : Graph α γ, S.IsKSeparation k C₁' C₂' → + V(C₁').ncard = V(C₁).ncard → E(C₁).ncard ≤ E(C₁').ncard) + {e : γ} {x y : α} (hlink : C₁.IsLink e x y) (hx : x ∈ V(C₂)) (hy : y ∈ V(C₂)) : False := by + have hC₁_le : C₁ ≤ S.G := hsep.1.1.1; have hC₂_le : C₂ ≤ S.G := hsep.1.1.2.1 + let C₁' : Graph α γ := C₁.restrict (E(C₁) \ {e}) + let C₂' : Graph α γ := (S.G.induce V(C₂)).restrict (E(C₂) ∪ {e}) + have hC₁'_le : C₁' ≤ S.G := restrict_le.trans hC₁_le + have hC₂'_le : C₂' ≤ S.G := restrict_le.trans (S.G.induce_le hC₂_le.vertexSet_mono) + have hE₁' : E(C₁') = E(C₁) \ {e} := by + change E(C₁.restrict (E(C₁) \ {e})) = E(C₁) \ {e}; rw [edgeSet_restrict, inter_eq_right]; exact + sdiff_subset + have hE₂' : E(C₂') = E(C₂) ∪ {e} := by + change E((S.G.induce V(C₂)).restrict (E(C₂) ∪ {e})) = E(C₂) ∪ {e} + rw [edgeSet_restrict, inter_eq_right]; rintro f (hf | rfl) + · obtain ⟨u, v, huv⟩ := C₂.exists_isLink_of_mem_edgeSet hf + exact ⟨u, v, huv.mono hC₂_le, huv.left_mem, huv.right_mem⟩ + · exact ⟨x, y, hlink.mono hC₁_le, hx, hy⟩ + have he_C₁ : e ∈ E(C₁) := hlink.edge_mem + have hE_union' : E(C₁') ∪ E(C₂') = E(S.G) := by + rw [hE₁', hE₂']; ext f; simp only [mem_union, mem_sdiff, mem_singleton_iff] + refine ⟨?_, fun hfG => ?_⟩ + · rintro (⟨hf₁, _⟩ | hf₂ | rfl) + · exact hC₁_le.edgeSet_mono hf₁ + · exact hC₂_le.edgeSet_mono hf₂ + · exact hC₁_le.edgeSet_mono he_C₁ + · by_cases hfe : f = e + · exact Or.inr (Or.inr hfe) + · rcases (hsep.1.1.2.2.2.1.symm ▸ hfG : f ∈ E(C₁) ∪ E(C₂)) with hf₁ | hf₂ + · exact Or.inl ⟨hf₁, hfe⟩ + · exact Or.inr (Or.inl hf₂) + have hE_disj' : Disjoint E(C₁') E(C₂') := by + rw [hE₁', hE₂', disjoint_left]; rintro f ⟨hf₁, hfe⟩ (hf₂ | rfl) + · exact disjoint_left.mp hsep.1.1.2.2.2.2 hf₁ hf₂ + · exact hfe rfl + have hsep' : S.IsKSeparation k C₁' C₂' := + ⟨⟨⟨hC₁'_le, hC₂'_le, hsep.1.1.2.2.1, hE_union', hE_disj'⟩, hsep.1.2⟩, hsep.2.1, hsep.2.2⟩ + have hle_E := hminE C₁' C₂' hsep' rfl + have hlt_E : E(C₁').ncard < E(C₁).ncard := by + rw [hE₁']; exact ncard_lt_ncard ⟨sdiff_subset, fun hsub => (hsub he_C₁).2 rfl⟩ + (S.finite_E.subset hC₁_le.edgeSet_mono) + omega + +/-- In a `k`-separation `(C₁, C₂)` of `S` minimizing `|V(C₁)|`, every pair of distinct vertices +`u, v ∈ V(C₁) ∩ V(C₂)` is joined by a path in `C₁` with no internal vertex in `V(C₂)`. -/ +theorem minimal_kSeparation_exists_path {S : Society α γ} {k : ℕ} + {C₁ C₂ : Graph α γ} (hsep : S.IsKSeparation k C₁ C₂) + (hminV : ∀ C₁' C₂' : Graph α γ, S.IsKSeparation k C₁' C₂' → V(C₁).ncard ≤ V(C₁').ncard) + {u v : α} (hu : u ∈ V(C₁) ∩ V(C₂)) (hv : v ∈ V(C₁) ∩ V(C₂)) : + ∃ P : Graph α γ, IsGraphPathWithEnds C₁ P u v ∧ Disjoint (V(P) \ {u, v}) V(C₂) := by + have hC₁_le : C₁ ≤ S.G := hsep.1.1.1; have hC₂_le : C₂ ≤ S.G := hsep.1.1.2.1 + have hdiff_ne : (V(C₁) \ V(C₂)).Nonempty := by + by_contra h_empty; rw [not_nonempty_iff_eq_empty, Set.sdiff_eq_empty] at h_empty + exact hsep.2.2 ((union_eq_right.mpr h_empty).symm.trans hsep.1.1.2.2.1) + obtain ⟨w₀, hw₀⟩ := hdiff_ne + let H := deleteVertices C₁ V(C₂); have hw₀H : w₀ ∈ V(H) := hw₀ + let K₀ := reachableComponent H w₀; let U₀ := V(K₀) + have hU₀_sub : U₀ ⊆ V(C₁) \ V(C₂) := (reachableComponent_le H w₀).vertexSet_mono + let N₀ := {z ∈ V(C₁) ∩ V(C₂) | ∃ x ∈ U₀, C₁.Adj x z} + let E₁_star := {e ∈ E(C₁) | ∃ x ∈ U₀, C₁.Inc e x}; let E₂_star := E(S.G) \ E₁_star + let C₁_star := (S.G.induce (U₀ ∪ N₀)).restrict E₁_star + let C₂_star := (S.G.induce (V(S.G) \ U₀)).restrict E₂_star + have hV₁_star_sub_C₁ : U₀ ∪ N₀ ⊆ V(C₁) := union_subset (hU₀_sub.trans sdiff_subset) (fun _ hz + => hz.1.1) + have hC₁_star_le : C₁_star ≤ S.G := + restrict_le.trans (S.G.induce_le (hV₁_star_sub_C₁.trans hC₁_le.vertexSet_mono)) + have hC₂_star_le : C₂_star ≤ S.G := restrict_le.trans (S.G.induce_le sdiff_subset) + have hE₁_star_eq : E(C₁_star) = E₁_star := by + change E((S.G.induce (U₀ ∪ N₀)).restrict E₁_star) = E₁_star + rw [edgeSet_restrict, inter_eq_right]; rintro e ⟨heC₁, x, hxU₀, y, hlink⟩ + refine ⟨x, y, hlink.mono hC₁_le, Or.inl hxU₀, ?_⟩ + by_cases hyC₂ : y ∈ V(C₂) + · exact Or.inr ⟨⟨hlink.right_mem, hyC₂⟩, x, hxU₀, e, hlink⟩ + · left + have hlinkH : H.IsLink e x y := (deleteVertices_isLink C₁ V(C₂)).mpr ⟨hlink, + (hU₀_sub hxU₀).2, hyC₂⟩ + exact (mem_graphComponent_iff_of_isLink (isGraphComponent_reachableComponent hw₀H) hlinkH).mp + hxU₀ + have hE₂_star_eq : E(C₂_star) = E₂_star := by + change E((S.G.induce (V(S.G) \ U₀)).restrict E₂_star) = E₂_star + rw [edgeSet_restrict, inter_eq_right]; rintro e ⟨heG, he_not⟩ + obtain ⟨x, y, hxy⟩ := S.G.exists_isLink_of_mem_edgeSet heG + have hnot_U₀ : ∀ z, S.G.Inc e z → z ∉ U₀ := by + rintro z ⟨w, hzw⟩ hzU₀ + have he_not_C₂ : e ∉ E(C₂) := fun heC₂ => (hU₀_sub hzU₀).2 ((hC₂_le.isLink_iff heC₂).mpr + hzw).left_mem + have heC₁ : e ∈ E(C₁) := (hsep.1.1.2.2.2.1.symm ▸ heG).resolve_right he_not_C₂ + exact he_not ⟨heC₁, z, hzU₀, w, (hC₁_le.isLink_iff heC₁).mpr hzw⟩ + exact ⟨x, y, hxy, ⟨hxy.left_mem, hnot_U₀ x ⟨y, hxy⟩⟩, ⟨hxy.right_mem, hnot_U₀ y ⟨x, hxy.symm⟩⟩⟩ + have hV_star_union : V(C₁_star) ∪ V(C₂_star) = V(S.G) := by + refine subset_antisymm (union_subset hC₁_star_le.vertexSet_mono hC₂_star_le.vertexSet_mono) fun + z hzG => ?_ + by_cases hzU₀ : z ∈ U₀; exacts [Or.inl (Or.inl hzU₀), Or.inr ⟨hzG, hzU₀⟩] + have hE_star_union : E(C₁_star) ∪ E(C₂_star) = E(S.G) := by + rw [hE₁_star_eq, hE₂_star_eq]; exact union_sdiff_cancel fun e he => hC₁_le.edgeSet_mono he.1 + have hE_star_disj : Disjoint E(C₁_star) E(C₂_star) := by + rw [hE₁_star_eq, hE₂_star_eq]; exact disjoint_sdiff_right + have hΩ_star : S.Ω.bar ⊆ V(C₂_star) := + fun z hzΩ => ⟨S.bar_subset hzΩ, fun hzU₀ => (hU₀_sub hzU₀).2 (hsep.1.2 hzΩ)⟩ + have hV_star_inter : V(C₁_star) ∩ V(C₂_star) = N₀ := by + ext z; simp only [C₁_star, C₂_star, mem_inter_iff] + exact ⟨fun ⟨hz_or, _, hz_not_U₀⟩ => hz_or.resolve_left hz_not_U₀, + fun hzN₀ => ⟨Or.inr hzN₀, hC₁_le.vertexSet_mono hzN₀.1.1, fun hzU₀ => + (hU₀_sub hzU₀).2 hzN₀.1.2⟩⟩ + have hcard_star : (V(C₁_star) ∩ V(C₂_star)).ncard ≤ k := by + rw [hV_star_inter] + exact (ncard_le_ncard (s := N₀) (fun _ hz => hz.1) + (S.finite_V.subset (inter_subset_left.trans hC₁_le.vertexSet_mono))).trans hsep.2.1 + have hV₂_star_ne : V(C₂_star) ≠ V(S.G) := fun heq => + (heq.symm ▸ hC₁_le.vertexSet_mono hw₀.1 : w₀ ∈ V(C₂_star)).2 (self_mem_reachableComponent hw₀H) + have hsep_star : S.IsKSeparation k C₁_star C₂_star := + ⟨⟨⟨hC₁_star_le, hC₂_star_le, hV_star_union, hE_star_union, hE_star_disj⟩, hΩ_star⟩, hcard_star, + hV₂_star_ne⟩ + have hV₁_eq : V(C₁_star) = V(C₁) := eq_of_subset_of_ncard_le hV₁_star_sub_C₁ + (hminV C₁_star C₂_star hsep_star) + (S.finite_V.subset hC₁_le.vertexSet_mono) + obtain ⟨x_u, hx_u, e_u, he_u⟩ := ((hV₁_eq ▸ hu.1).resolve_left fun h => (hU₀_sub h).2 hu.2).2 + obtain ⟨x_v, hx_v, e_v, he_v⟩ := ((hV₁_eq ▸ hv.1).resolve_left fun h => (hU₀_sub h).2 hv.2).2 + obtain ⟨W_K⟩ := (isGraphConnected_reachableComponent hw₀H).2 x_u hx_u x_v hx_v + obtain ⟨W_mid, hs_mid, _⟩ := + exists_walk_up_of_le ((reachableComponent_le H w₀).trans (deleteVertices_le C₁ V(C₂))) W_K + let W_full : GraphWalk C₁ u v := + (GraphWalk.cons he_u.symm W_mid).append (GraphWalk.cons he_v (GraphWalk.nil hv.1)) + obtain ⟨P, hP, hVP_sub, _⟩ := exists_isGraphPathWithEnds_of_walk W_full + refine ⟨P, hP, disjoint_left.mpr fun z ⟨hzP, hz_not_uv⟩ hzC₂ => ?_⟩ + rcases (GraphWalk.mem_support_append (GraphWalk.cons he_u.symm W_mid) + (GraphWalk.cons he_v (GraphWalk.nil hv.1))).mp (hVP_sub hzP) with hz1 | hz2 + · rcases List.mem_cons.mp hz1 with rfl | hz_mid + · exact hz_not_uv (by simp) + · rw [hs_mid] at hz_mid; exact (hU₀_sub (W_K.mem_vertexSet_of_mem_support hz_mid)).2 hzC₂ + · simp only [GraphWalk.support_cons, GraphWalk.support_nil, List.mem_cons, List.not_mem_nil, + or_false] at hz2 + rcases hz2 with rfl | rfl; exacts [(hU₀_sub hx_v).2 hzC₂, hz_not_uv (by simp)] + +/-! ## (11.9): Minimality of core implies 4-connectivity -/ + +/-- Walk-lifting helper for (11.9) Claim (1). -/ +private theorem lift_walk_claim_1 {S : Society α β} {D_set D₁ D₂ : Set (Graph α β × Graph α β)} + (hD : IsConsolidation S D_set) {C₁ C₂ : Graph α (Sym2 α)} (hC₁ : C₁ ≤ consolidationCore S D_set) + (hno_edge : ∀ e x y, C₁.IsLink e x y → x ∈ V(C₂) → y ∈ V(C₂) → False) (hD_union : D₁ ∪ D₂ + = D_set) + (hD₂ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₂ → V(A) ∩ V(B) ⊆ V(C₂)) {G₁ G₂ : Graph α β} + (hC₁_sub_G₁ : V(C₁) ⊆ V(G₁)) + (hA_le_G₁ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₁ → A ≤ G₁) + (hinter_sub_C : V(G₁) ∩ V(G₂) ⊆ V(consolidationCore S D_set)) + (hdiff_sub : V(C₁) \ V(C₂) ⊆ V(G₁) \ V(G₂)) {u v a b : α} (W_C : GraphWalk C₁ a b) + (hsupp : ∀ z ∈ W_C.support, z ∈ (V(C₁) \ V(C₂)) ∪ {u, v}) : + ∃ W_G : GraphWalk G₁ a b, ∀ z ∈ W_G.support, z ∈ (V(G₁) \ V(G₂)) ∪ {u, v} := by + induction W_C with + | @nil x hx => + refine ⟨.nil (hC₁_sub_G₁ hx), fun z hz => ?_⟩ + simp only [GraphWalk.support_nil, List.mem_singleton] at hz; subst hz + exact (hsupp z (by simp)).imp_left fun h => hdiff_sub h + | @cons x y z e hlink W_rest ih => + have hx_in := (hsupp x (by simp)).imp_left fun h => hdiff_sub h + have hy_in := (hsupp y (List.mem_cons_of_mem _ W_rest.start_mem_support)).imp_left fun h + => hdiff_sub h + obtain ⟨W_rest_G, hW_rest_G⟩ := ih fun w hw => hsupp w (List.mem_cons_of_mem _ hw) + obtain ⟨hxy, _, _, _, ⟨A, B⟩, hAB, hx_AB, hy_AB⟩ := hlink.mono hC₁ + have hAB_D₁ : (A, B) ∈ D₁ := (hD_union.symm ▸ hAB).resolve_right fun hAB₂ => + hno_edge e x y hlink (hD₂ hAB₂ hx_AB) (hD₂ hAB₂ hy_AB) + have hAG₁ : A ≤ G₁ := hA_le_G₁ hAB_D₁ + obtain ⟨P_xy, ⟨hP_xy_A, W_xy, _, hVP_xy, _⟩, hdisj_xy⟩ := hD.exists_path hAB x hx_AB y hy_AB hxy + obtain ⟨W_xy_G, hs_xy, _⟩ := exists_walk_up_of_le (hP_xy_A.trans hAG₁) W_xy + refine ⟨W_xy_G.append W_rest_G, fun w hw => ?_⟩ + rcases (GraphWalk.mem_support_append W_xy_G W_rest_G).mp hw with hw_xy | hw_rest + · rw [hs_xy] at hw_xy; have hwP : w ∈ V(P_xy) := by rw [hVP_xy]; exact hw_xy + by_cases hw_end : w ∈ ({x, y} : Set α) + · rcases hw_end with rfl | rfl; exacts [hx_in, hy_in] + · left; have hwG₁ : w ∈ V(G₁) := (hP_xy_A.trans hAG₁).vertexSet_mono hwP + exact ⟨hwG₁, fun hwG₂ => disjoint_left.mp hdisj_xy ⟨hwP, hw_end⟩ + (vertexSet_consolidationCore_subset_right hAB (hinter_sub_C ⟨hwG₁, hwG₂⟩))⟩ + · exact hW_rest_G w hw_rest + +/-- **Graph Minors IX, (11.9)** (page 71): +"Let $\mathcal{D}$ be a consolidation of $(G, \Omega)$ chosen so that its core $C$ has as few +vertices as possible. Then $(C, \Omega)$ is 4-connected." -/ +theorem theorem_11_9_proof (S : Society α β) (D_set : Set (Graph α β × Graph α β)) + (hD : IsConsolidation S D_set) + (hmin : ∀ D' : Set (Graph α β × Graph α β), IsConsolidation S D' → + V(consolidationCore S D_set).ncard ≤ V(consolidationCore S D').ncard) : + (consolidationCoreSociety S D_set hD).IsKConnected 4 := by + classical + let CS := consolidationCoreSociety S D_set hD; let C := consolidationCore S D_set + intro k' hk' C₁₀ C₂₀ hsep₀ + obtain ⟨C₁, C₂, hsep, hminV, hminE⟩ := + exists_minimal_kSeparation (k := 3) ⟨C₁₀, C₂₀, hsep₀.1, hsep₀.2.1.trans (by omega), hsep₀.2.2⟩ + have hC₁_le : C₁ ≤ C := hsep.1.1.1; have hC₂_le : C₂ ≤ C := hsep.1.1.2.1 + let D₁ : Set (Graph α β × Graph α β) := {p ∈ D_set | V(p.1) ∩ V(p.2) ⊆ V(C₁)} + let D₂ : Set (Graph α β × Graph α β) := D_set \ D₁ + have hD_union : D₁ ∪ D₂ = D_set := union_sdiff_cancel (fun _ hp => hp.1) + have hD_disj : Disjoint D₁ D₂ := disjoint_sdiff_right + have hD₁_sub_C₁ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₁ → V(A) ∩ V(B) ⊆ V(C₁) := fun _ _ hp => hp.2 + have hD₂_sub_C₂ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₂ → V(A) ∩ V(B) ⊆ V(C₂) := by + intro A B ⟨hAB, hnot₁⟩ + rcases not_subset.mp (fun h => hnot₁ ⟨hAB, h⟩) with ⟨v, hvAB, hv_not_C₁⟩ + have hvC : v ∈ V(C) := hD.inter_subset_consolidationCore hAB hvAB + have hvC₂ : v ∈ V(C₂) := (hsep.1.1.2.2.1 ▸ hvC).resolve_left hv_not_C₁ + intro w hwAB; by_cases hwv : w = v + · exact hwv ▸ hvC₂ + · have hlink_C : C.IsLink s(v, w) v w := + hD.consolidationCore_isLink_of_mem_inter hAB hvAB hwAB (Ne.symm hwv) + rcases (hsep.1.1.2.2.2.1.symm ▸ hlink_C.edge_mem : s(v, w) ∈ E(C₁) ∪ E(C₂)) with he₁ | he₂ + · exact (hv_not_C₁ ((hC₁_le.isLink_iff he₁).mpr hlink_C).left_mem).elim + · exact ((hC₂_le.isLink_iff he₂).mpr hlink_C).right_mem + let C_star : Graph α β := (S.G.induce (V(C₁) ∩ V(C₂))).restrict ∅ + let G₁ : Graph α β := subgraphUnion S.G C_star (subgraphSUnion S.G (Prod.fst '' D₁)) + let G₂ : Graph α β := subgraphUnion S.G C_star (subgraphSUnion S.G (Prod.fst '' D₂)) + obtain ⟨hsep_G, hG_inter, hX₁_eq, hX₂_eq⟩ := + theorem_11_8_proof hD hC₁_le hC₂_le (IsGraphSeparation.subgraphUnion_eq hsep.1.1) + hsep.1.2 hD_union hD_disj hD₁_sub_C₁ hD₂_sub_C₂ + have hV_G_inter : V(G₁) ∩ V(G₂) = V(C₁) ∩ V(C₂) := by + rw [← vertexSet_subgraphInter S.G G₁ G₂, hG_inter]; rfl + have hC_star_le : C_star ≤ S.G := restrict_le.trans (S.G.induce_le + (inter_subset_left.trans (hC₁_le.vertexSet_mono.trans (vertexSet_consolidationCore_subset S + D_set)))) + have hU₁_all : ∀ P ∈ Prod.fst '' D₁, P ≤ S.G := fun P hP => + hD.forall_fst_le P (image_mono (s := D₁) (fun _ hp => hp.1) hP) + have hU₂_all : ∀ P ∈ Prod.fst '' D₂, P ≤ S.G := fun P hP => hD.forall_fst_le P + (image_mono sdiff_subset hP) + have hU₁_le := subgraphSUnion_le hU₁_all; have hU₂_le := subgraphSUnion_le hU₂_all + have hA_le_G₁ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₁ → A ≤ G₁ := fun A B hAB => + (le_subgraphSUnion hU₁_all ⟨(A, B), hAB, rfl⟩).trans (le_subgraphUnion_right hC_star_le hU₁_le) + have hA_le_G₂ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₂ → A ≤ G₂ := fun A B hAB => + (le_subgraphSUnion hU₂_all ⟨(A, B), hAB, rfl⟩).trans (le_subgraphUnion_right hC_star_le hU₂_le) + have hclaim1 : ∀ u ∈ V(G₁) ∩ V(G₂), ∀ v ∈ V(G₁) ∩ V(G₂), u ≠ v → + ∃ P : Graph α β, IsGraphPathWithEnds G₁ P u v ∧ Disjoint (V(P) \ {u, v}) V(G₂) := by + intro u hu v hv _ + obtain ⟨P_C, ⟨hP_C_le, W_C, _, hVP_C, _⟩, hdisj_C⟩ := + minimal_kSeparation_exists_path hsep hminV (hV_G_inter ▸ hu) (hV_G_inter ▸ hv) + obtain ⟨W_C₁, hs_C₁, _⟩ := exists_walk_up_of_le hP_C_le W_C + have hC₁_sub_G₁ : V(C₁) ⊆ V(G₁) := hX₁_eq ▸ inter_subset_left + have hinter_sub_C : V(G₁) ∩ V(G₂) ⊆ V(C) := hV_G_inter ▸ inter_subset_left.trans + hC₁_le.vertexSet_mono + have hdiff_sub : V(C₁) \ V(C₂) ⊆ V(G₁) \ V(G₂) := fun z ⟨hzC₁, hz_not_C₂⟩ => + ⟨hC₁_sub_G₁ hzC₁, fun hzG₂ => hz_not_C₂ (hX₂_eq ▸ ⟨hzG₂, hC₁_le.vertexSet_mono hzC₁⟩)⟩ + have hsupp_C₁ : ∀ z ∈ W_C₁.support, z ∈ (V(C₁) \ V(C₂)) ∪ {u, v} := by + intro z hz; rw [hs_C₁] at hz; have hzP : z ∈ V(P_C) := by rw [hVP_C]; exact hz + by_cases hz_uv : z ∈ ({u, v} : Set α) + · exact Or.inr hz_uv + · exact Or.inl ⟨hP_C_le.vertexSet_mono hzP, fun hzC₂ => disjoint_left.mp hdisj_C ⟨hzP, + hz_uv⟩ hzC₂⟩ + obtain ⟨W_G, hW_G⟩ := lift_walk_claim_1 hD hC₁_le + (fun e x y hl hx hy => minimal_kSeparation_no_edge_in_right hsep hminE hl hx hy) + hD_union hD₂_sub_C₂ hC₁_sub_G₁ hA_le_G₁ hinter_sub_C hdiff_sub W_C₁ hsupp_C₁ + obtain ⟨P, hP, hVP_sub, _⟩ := exists_isGraphPathWithEnds_of_walk W_G + refine ⟨P, hP, disjoint_left.mpr fun z ⟨hzP, hz_not_uv⟩ hzG₂ => ?_⟩ + rcases hW_G z (hVP_sub hzP) with ⟨_, hz_not_G₂⟩ | hz_uv; exacts [hz_not_G₂ hzG₂, hz_not_uv + hz_uv] + have hG₁_le_B₂ : ∀ ⦃A₂ B₂ : Graph α β⦄, (A₂, B₂) ∈ D₂ → G₁ ≤ B₂ := by + intro A₂ B₂ hAB₂; have hB₂_le : B₂ ≤ S.G := hD.right_le hAB₂.1 + rw [subgraphUnion_le_iff hC_star_le hU₁_le hB₂_le]; refine ⟨?_, ?_⟩ + · rw [(Compatible.of_le_le hC_star_le hB₂_le).le_iff] + exact ⟨(inter_subset_left.trans hC₁_le.vertexSet_mono).trans + (vertexSet_consolidationCore_subset_right hAB₂.1), by simp [C_star]⟩ + · rw [(Compatible.of_le_le hU₁_le hB₂_le).le_iff, vertexSet_subgraphSUnion, + edgeSet_subgraphSUnion hU₁_all] + refine ⟨iUnion₂_subset ?_, iUnion₂_subset ?_⟩ <;> + · rintro A ⟨⟨A₁, B₁⟩, hAB₁, rfl⟩ + have hne : (A₁, B₁) ≠ (A₂, B₂) := fun heq => disjoint_left.mp hD_disj hAB₁ (heq ▸ hAB₂) + first + | exact (hD.left_le_right hAB₁.1 hAB₂.1 hne).vertexSet_mono + | exact (hD.left_le_right hAB₁.1 hAB₂.1 hne).edgeSet_mono + let D' : Set (Graph α β × Graph α β) := D₂ ∪ {(G₁, G₂)} + have hD'_all : ∀ P ∈ Prod.fst '' D', P ≤ S.G := by + rintro P ⟨⟨A, B⟩, hAB₂ | hG₁₂, rfl⟩ + · exact hD.left_le hAB₂.1 + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj (mem_singleton_iff.mp hG₁₂); exact hsep_G.1.1 + have hD' : IsConsolidation S D' := by + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · rintro A B (hAB₂ | hG₁₂) + · exact hD.isSocietySeparation hAB₂.1 + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj (mem_singleton_iff.mp hG₁₂); exact hsep_G + · rintro A B (hAB₂ | hG₁₂) + · exact hD.order_le_three hAB₂.1 + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj (mem_singleton_iff.mp hG₁₂); rw [hV_G_inter]; exact + hsep.2.1 + · rintro A B A' B' (h1 | h1) (h2 | h2) hne + · exact hD.left_le_right h1.1 h2.1 hne + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj (mem_singleton_iff.mp h2); exact hA_le_G₂ h1 + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj (mem_singleton_iff.mp h1); exact hG₁_le_B₂ h2 + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj (mem_singleton_iff.mp h1) + obtain ⟨rfl, rfl⟩ := Prod.mk.inj (mem_singleton_iff.mp h2); exact (hne rfl).elim + · refine (Compatible.of_le_le (subgraphSUnion_le hD'_all) le_rfl).ext + (subset_antisymm (subgraphSUnion_le hD'_all).vertexSet_mono fun v hv => ?_) + (subset_antisymm (subgraphSUnion_le hD'_all).edgeSet_mono fun e he => ?_) + · rw [vertexSet_subgraphSUnion, mem_iUnion₂] + rcases (hsep_G.1.2.2.1.symm ▸ hv : v ∈ V(G₁) ∪ V(G₂)) with hvG₁ | (hv_star | hvU₂) + · exact ⟨G₁, ⟨(G₁, G₂), Or.inr rfl, rfl⟩, hvG₁⟩ + · exact ⟨G₁, ⟨(G₁, G₂), Or.inr rfl, rfl⟩, Or.inl hv_star⟩ + · obtain ⟨A, ⟨⟨A', B'⟩, hAB₂, rfl⟩, hvA⟩ := mem_iUnion₂.mp hvU₂ + exact ⟨A', ⟨(A', B'), Or.inl hAB₂, rfl⟩, hvA⟩ + · rw [edgeSet_subgraphSUnion hD'_all, mem_iUnion₂] + rcases (hsep_G.1.2.2.2.1.symm ▸ he : e ∈ E(G₁) ∪ E(G₂)) with heG₁ | heG₂ + · exact ⟨G₁, ⟨(G₁, G₂), Or.inr rfl, rfl⟩, heG₁⟩ + · rw [edgeSet_subgraphUnion hC_star_le hU₂_le, edgeSet_subgraphSUnion hU₂_all] at heG₂ + rcases heG₂ with he_star | heU₂ + · simp [C_star] at he_star + · obtain ⟨A, ⟨⟨A', B'⟩, hAB₂, rfl⟩, heA⟩ := mem_iUnion₂.mp heU₂ + exact ⟨A', ⟨(A', B'), Or.inl hAB₂, rfl⟩, heA⟩ + · rintro A B (hAB₂ | hG₁₂) + · exact hD.exists_path hAB₂.1 + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj (mem_singleton_iff.mp hG₁₂); exact hclaim1 + let C' := consolidationCore S D' + have hC'_sub_C : V(C') ⊆ V(C) := by + intro v hvC' + rcases (vertexSet_consolidationCore_subset_right (Or.inr (mem_singleton (G₁, G₂))) hvC' : + v ∈ V(C_star) ∪ ⋃ P ∈ Prod.fst '' D₂, V(P)) with hv_star | hvU₂ + · exact hC₁_le.vertexSet_mono hv_star.1 + · obtain ⟨A, ⟨⟨A', B'⟩, hAB₂, rfl⟩, hvA⟩ := mem_iUnion₂.mp hvU₂ + exact hD.inter_subset_consolidationCore hAB₂.1 ⟨hvA, vertexSet_consolidationCore_subset_right + (Or.inl hAB₂) hvC'⟩ + have hdiff_ne : (V(C₁) \ V(C₂)).Nonempty := by + by_contra h_empty; rw [not_nonempty_iff_eq_empty, Set.sdiff_eq_empty] at h_empty + exact hsep.2.2 ((union_eq_right.mpr h_empty).symm.trans hsep.1.1.2.2.1) + obtain ⟨v₀, hv₀C₁, hv₀_not_C₂⟩ := hdiff_ne; have hv₀C : v₀ ∈ V(C) := hC₁_le.vertexSet_mono hv₀C₁ + have hv₀_not_C' : v₀ ∉ V(C') := fun hv₀C' => hv₀_not_C₂ (hX₂_eq ▸ + ⟨vertexSet_consolidationCore_subset_right + (Or.inr (mem_singleton (G₁, G₂))) hv₀C', hv₀C⟩) + have hlt_card : V(consolidationCore S D').ncard < V(consolidationCore S D_set).ncard := + ncard_lt_ncard ⟨hC'_sub_C, fun hsub => hv₀_not_C' (hsub hv₀C)⟩ + (finite_vertexSet_consolidationCore S D_set) + have hge_card := hmin D' hD'; omega + +/-! ## (11.10): Transactions and patterns in a society and its consolidation core -/ + +/-- If `P` is a jump in `S.G` with distinct ends `a, b ∈ V(consolidationCore S D_set)` and no +internal vertex in `V(consolidationCore S D_set)`, then `a` and `b` are adjacent in +`consolidationCore S D_set`. -/ +theorem consolidationCore_isLink_of_jump {S : Society α β} + {D_set : Set (Graph α β × Graph α β)} (hD : IsConsolidation S D_set) {P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds S.G P a b) (hab : a ≠ b) + (ha : a ∈ V(consolidationCore S D_set)) (hb : b ∈ V(consolidationCore S D_set)) + (hjump : Disjoint (V(P) \ {a, b}) V(consolidationCore S D_set)) : + (consolidationCore S D_set).IsLink s(a, b) a b := by + rcases hP with ⟨hPG, W, hW, hVP, _⟩ + cases W with + | nil _ => exact (hab rfl).elim + | @cons _ w _ e₁ hlink₁ W_rest => + obtain ⟨A, B, hAB, he₁A⟩ := hD.exists_mem_of_mem_edgeSet (hlink₁.mono hPG).edge_mem + have hlink₁A : A.IsLink e₁ a w := ((hD.left_le hAB).isLink_iff he₁A).mpr (hlink₁.mono hPG) + have haB : a ∈ V(B) := vertexSet_consolidationCore_subset_right hAB ha + have hbB : b ∈ V(B) := vertexSet_consolidationCore_subset_right hAB hb + have hbA : b ∈ V(A) := by + by_contra hb_not_A + obtain ⟨W_rest_G, hs_rest, _⟩ := exists_walk_up_of_le hPG W_rest + obtain ⟨z, hzW, hz_AB⟩ := + exists_mem_inter_of_graphWalk (hD.isSocietySeparation hAB).1 W_rest_G hlink₁A.right_mem hbB + rw [hs_rest] at hzW + have hzP : z ∈ V(P) := by rw [hVP]; exact List.mem_cons_of_mem _ hzW + have hz_ne_a : z ≠ a := fun h => (List.nodup_cons.mp hW).1 (h ▸ hzW) + have hz_ne_b : z ≠ b := fun h => hb_not_A (h ▸ hz_AB.1) + exact disjoint_left.mp hjump ⟨hzP, by simp [hz_ne_a, hz_ne_b]⟩ + (hD.inter_subset_consolidationCore hAB hz_AB) + exact hD.consolidationCore_isLink_of_mem_inter hAB ⟨hlink₁A.left_mem, haB⟩ ⟨hbA, hbB⟩ hab + +/-- Every path `P` in `S.G` with ends `a, b ∈ V(consolidationCore S D_set)` induces a path `Q` in +`consolidationCore S D_set` with ends `a, b` and `V(Q) ⊆ V(P) ∩ V(consolidationCore S D_set)`. -/ +theorem exists_core_path_of_path {S : Society α β} + {D_set : Set (Graph α β × Graph α β)} (hD : IsConsolidation S D_set) {P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds S.G P a b) + (ha : a ∈ V(consolidationCore S D_set)) (hb : b ∈ V(consolidationCore S D_set)) : ∃ Q : Graph α + (Sym2 α), + IsGraphPathWithEnds (consolidationCore S D_set) Q a b ∧ V(Q) ⊆ V(P) ∩ V(consolidationCore S + D_set) := by + classical + let C := consolidationCore S D_set + have hwalk : ∀ (n : ℕ) {a' b' : α} {P' : Graph α β}, + IsGraphPathWithEnds S.G P' a' b' → V(P').ncard = n → a' ∈ V(C) → b' ∈ V(C) → + ∃ W_C : GraphWalk C a' b', ∀ z ∈ W_C.support, z ∈ V(P') ∩ V(C) := by + intro n; induction n using Nat.strong_induction_on with + | ind n ih => + intro a' b' P' hP' hcard ha' hb' + by_cases hab' : a' = b' + · subst hab'; refine ⟨.nil ha', fun z hz => ?_⟩ + simp only [GraphWalk.support_nil, List.mem_singleton] at hz; exact hz ▸ ⟨hP'.left_mem, ha'⟩ + · by_cases hhit : ∃ z ∈ V(P') \ {a', b'}, z ∈ V(C) + · rcases hhit with ⟨z, ⟨hzP', hz_not_ab⟩, hzC⟩ + simp only [mem_insert_iff, mem_singleton_iff, not_or] at hz_not_ab + obtain ⟨P₁, P₂, hP₁, hP₂, hpath₁, hpath₂, _, hinter, _⟩ := hP'.exists_split_at hzP' + have hfin : V(P').Finite := hP'.vertexSet_finite + have hb_not_P₁ : b' ∉ V(P₁) := fun hb₁ => + hz_not_ab.2 (mem_singleton_iff.mp (hinter ▸ ⟨hb₁, hpath₂.right_mem⟩)).symm + have ha_not_P₂ : a' ∉ V(P₂) := fun ha₂ => + hz_not_ab.1 (mem_singleton_iff.mp (hinter ▸ ⟨hpath₁.left_mem, ha₂⟩)).symm + have hlt₁ : V(P₁).ncard < n := hcard ▸ + ncard_lt_ncard ⟨hP₁.vertexSet_mono, fun hsub => hb_not_P₁ (hsub hP'.right_mem)⟩ hfin + have hlt₂ : V(P₂).ncard < n := hcard ▸ + ncard_lt_ncard ⟨hP₂.vertexSet_mono, fun hsub => ha_not_P₂ (hsub hP'.left_mem)⟩ hfin + obtain ⟨W₁, hW₁⟩ := ih V(P₁).ncard hlt₁ (hpath₁.mono hP'.le) rfl ha' hzC + obtain ⟨W₂, hW₂⟩ := ih V(P₂).ncard hlt₂ (hpath₂.mono hP'.le) rfl hzC hb' + refine ⟨W₁.append W₂, fun w hw => ?_⟩ + rcases (GraphWalk.mem_support_append W₁ W₂).mp hw with hw₁ | hw₂ + · exact ⟨hP₁.vertexSet_mono (hW₁ w hw₁).1, (hW₁ w hw₁).2⟩ + · exact ⟨hP₂.vertexSet_mono (hW₂ w hw₂).1, (hW₂ w hw₂).2⟩ + · have hjump : Disjoint (V(P') \ {a', b'}) V(C) := disjoint_left.mpr fun z hz1 hz2 + => hhit ⟨z, hz1, hz2⟩ + refine ⟨.cons (consolidationCore_isLink_of_jump hD hP' hab' ha' hb' hjump) (.nil hb'), + fun z hz => ?_⟩ + simp only [GraphWalk.support_cons, GraphWalk.support_nil, List.mem_cons, + List.not_mem_nil, or_false] at hz + rcases hz with rfl | rfl; exacts [⟨hP'.left_mem, ha'⟩, ⟨hP'.right_mem, hb'⟩] + obtain ⟨W_C, hW_C⟩ := hwalk V(P).ncard hP rfl ha hb + obtain ⟨Q, hQ, hVQ, _⟩ := exists_isGraphPathWithEnds_of_walk W_C + exact ⟨Q, hQ, fun z hz => hW_C z (hVQ hz)⟩ + +/-- Four-element cardinality bound: if `u₁ ≠ v₁`, `u₂ ≠ v₂`, and `Disjoint {u₁, v₁} {u₂, v₂}`, then +`{u₁, v₁, u₂, v₂}` cannot be contained in any finite set `X` with `X.ncard ≤ 3`. -/ +private theorem not_subset_of_ncard_le_three {u₁ v₁ u₂ v₂ : α} {X : Set α} + (hfin : X.Finite) (hcard : X.ncard ≤ 3) (h1 : u₁ ≠ v₁) (h2 : u₂ ≠ v₂) + (hdisj : Disjoint ({u₁, v₁} : Set α) {u₂, v₂}) + (hu₁ : u₁ ∈ X) (hv₁ : v₁ ∈ X) (hu₂ : u₂ ∈ X) (hv₂ : v₂ ∈ X) : False := by + let S2 : Set α := {u₂, v₂}; let S3 : Set α := insert v₁ S2; let S4 : Set α := insert u₁ S3 + have hv₁_not_S2 : v₁ ∉ S2 := fun hv => disjoint_left.mp hdisj (by simp) hv + have hu₁_not_S3 : u₁ ∉ S3 := by + simp only [S3, S2, mem_insert_iff, mem_singleton_iff, not_or] + refine ⟨h1, ?_, ?_⟩ <;> (rintro rfl; exact disjoint_left.mp hdisj (Or.inl rfl) (by simp)) + have hS3_card : S3.ncard = 3 := by + rw [ncard_insert_of_notMem hv₁_not_S2 ((finite_singleton v₂).insert u₂), ncard_pair h2] + have hS4_card : S4.ncard = 4 := by + rw [ncard_insert_of_notMem hu₁_not_S3 (((finite_singleton v₂).insert u₂).insert v₁), hS3_card] + have hS4_sub : S4 ⊆ X := by rintro z (rfl | rfl | rfl | rfl) <;> assumption + have hle : S4.ncard ≤ X.ncard := ncard_le_ncard hS4_sub hfin; omega + +/-- Every transaction in `(consolidationCoreSociety S D_set hD)` lifts to a transaction in `S` with +the same pattern. -/ +theorem exists_transaction_of_core_transaction {S : Society α β} + {D_set : Set (Graph α β × Graph α β)} (hD : IsConsolidation S D_set) {Q_set : Set (Graph α + (Sym2 α))} + (hQ_trans : (consolidationCoreSociety S D_set hD).IsTransaction Q_set) : + ∃ P_set : Set (Graph α β), S.IsTransaction P_set ∧ S.transactionPattern P_set = + (consolidationCoreSociety S D_set hD).transactionPattern Q_set := by + classical + let CS := consolidationCoreSociety S D_set hD; let C := consolidationCore S D_set + have hex_jump : ∀ e : Sym2 α, e ∈ E(C) → ∃ (p : Graph α β × Graph α β) (J : Graph α β), p ∈ D_set + ∧ J ≤ p.1 ∧ + (∀ x y : α, C.IsLink e x y → x ∈ V(p.1) ∩ V(p.2) ∧ y ∈ V(p.1) ∩ V(p.2) ∧ + IsGraphPathWithEnds S.G J x y ∧ V(J) ∩ V(C) = {x, y}) := by + rintro e ⟨u, v, huv, rfl, huC, hvC, p, hp, hu_p, hv_p⟩ + obtain ⟨J, hJ, hdisj⟩ := hD.exists_path hp u hu_p v hv_p huv + have hJG : IsGraphPathWithEnds S.G J u v := hJ.mono (hD.left_le hp) + have hJC : V(J) ∩ V(C) = {u, v} := by + ext z; simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff] + refine ⟨fun ⟨hzJ, hzC⟩ => by_contra fun h_not_uv => + disjoint_left.mp hdisj ⟨hzJ, h_not_uv⟩ (vertexSet_consolidationCore_subset_right hp hzC), + ?_⟩ + rintro (rfl | rfl); exacts [⟨hJ.left_mem, huC⟩, ⟨hJ.right_mem, hvC⟩] + refine ⟨p, J, hp, hJ.le, fun x y hlink => ?_⟩ + rcases Sym2.eq_iff.mp hlink.2.1.symm with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨hu_p, hv_p, hJG, hJC⟩ + · exact ⟨hv_p, hu_p, hJG.symm, by rw [hJC, pair_comm]⟩ + choose p_of J_of hp_of hJ_le hJ_spec using fun (e : E(C)) => hex_jump e.1 e.2 + have hJ_disj : ∀ (e₁ e₂ : E(C)) {x₁ y₁ x₂ y₂ : α}, C.IsLink e₁.1 x₁ y₁ → C.IsLink e₂.1 x₂ y₂ → + Disjoint ({x₁, y₁} : Set α) {x₂, y₂} → Disjoint V(J_of e₁) V(J_of e₂) := by + intro e₁ e₂ x₁ y₁ x₂ y₂ hl₁ hl₂ hdisj_ends + obtain ⟨hx₁_p, hy₁_p, _, hJ₁_C⟩ := hJ_spec e₁ x₁ y₁ hl₁ + obtain ⟨hx₂_p, hy₂_p, _, hJ₂_C⟩ := hJ_spec e₂ x₂ y₂ hl₂ + have hp_ne : p_of e₁ ≠ p_of e₂ := fun heq => not_subset_of_ncard_le_three + (S.finite_V.subset (inter_subset_left.trans (hD.left_le (hp_of e₁)).vertexSet_mono)) + (hD.order_le_three (hp_of e₁)) hl₁.1 hl₂.1 hdisj_ends hx₁_p hy₁_p (heq ▸ hx₂_p) + (heq ▸ hy₂_p) + have hA_inter_C := hD.left_inter_left_subset_consolidationCore (hp_of e₁) (hp_of e₂) hp_ne + refine disjoint_left.mpr fun z hz₁ hz₂ => ?_ + have hzC : z ∈ V(C) := hA_inter_C ⟨(hJ_le e₁).vertexSet_mono hz₁, (hJ_le e₂).vertexSet_mono hz₂⟩ + have hz_ends₁ : z ∈ ({x₁, y₁} : Set α) := hJ₁_C ▸ ⟨hz₁, hzC⟩ + have hz_ends₂ : z ∈ ({x₂, y₂} : Set α) := hJ₂_C ▸ ⟨hz₂, hzC⟩ + exact disjoint_left.mp hdisj_ends hz_ends₁ hz_ends₂ + have hlift_walk : ∀ {a b : α} (W : GraphWalk C a b), ∃ W_G : GraphWalk S.G a b, ∀ z ∈ W_G.support, + z ∈ {x | x ∈ W.support} ∪ ⋃ (e : E(C)) (_ : e.1 ∈ W.edges), V(J_of e) := by + intro a b W; induction W with + | @nil u hu => + refine ⟨.nil (vertexSet_consolidationCore_subset S D_set hu), fun z hz => ?_⟩ + simp only [GraphWalk.support_nil, List.mem_singleton] at hz; exact Or.inl (by simp [hz]) + | @cons x y z e hlink W_rest ih => + obtain ⟨W_rest_G, hW_rest_G⟩ := ih; let e_sub : E(C) := ⟨e, hlink.edge_mem⟩ + obtain ⟨_, _, ⟨hJ_G, W_J, _, hVJ, _⟩, _⟩ := hJ_spec e_sub x y hlink + obtain ⟨W_J_G, hs_J, _⟩ := exists_walk_up_of_le hJ_G W_J + refine ⟨W_J_G.append W_rest_G, fun w hw => ?_⟩ + rcases (GraphWalk.mem_support_append W_J_G W_rest_G).mp hw with hw_J | hw_rest + · right + rw [hs_J] at hw_J + exact mem_iUnion₂.mpr ⟨e_sub, List.mem_cons_self, by rw [hVJ]; exact hw_J⟩ + · rcases hW_rest_G w hw_rest with hw_supp | hw_edges + · exact Or.inl (List.mem_cons_of_mem _ hw_supp) + · right; obtain ⟨e', he', hwJ'⟩ := mem_iUnion₂.mp hw_edges + exact mem_iUnion₂.mpr ⟨e', List.mem_cons_of_mem _ he', hwJ'⟩ + rcases hQ_trans with ⟨A_f, B_f, hQ_disj, hfence, hQ_ends⟩ + have hex_P : ∀ Q : Graph α (Sym2 α), Q ∈ Q_set → ∃ P : Graph α β, + (∃ a ∈ A_f, ∃ b ∈ B_f, CS.IsOmegaPathWithEnds Q a b ∧ S.IsOmegaPathWithEnds P a b) ∧ + pathEnds S.G P = pathEnds C Q ∧ V(P) ⊆ V(Q) ∪ ⋃ (e : E(C)) (_ : e.1 ∈ E(Q)), V(J_of e) := by + intro Q hQ_in; obtain ⟨a, haA, b, hbB, hQ_ab⟩ := hQ_ends Q hQ_in + have hQ_path_C : IsGraphPathWithEnds C Q a b := hQ_ab.1; rcases hQ_ab.1 with ⟨hQC, W_Q, _, hVQ, + hEQ⟩ + obtain ⟨W_C, hs_C, he_C⟩ := exists_walk_up_of_le (show Q ≤ C from hQC) W_Q + obtain ⟨W_G, hW_G⟩ := hlift_walk W_C; obtain ⟨P, hP, hVP, _⟩ := + exists_isGraphPathWithEnds_of_walk W_G + refine ⟨P, ⟨a, haA, b, hbB, hQ_ab, ⟨hP, hQ_ab.2⟩⟩, by rw [hP.pathEnds_eq, + hQ_path_C.pathEnds_eq], fun z hz => ?_⟩ + rcases hW_G z (hVP hz) with hz_supp | hz_edges + · left; rw [hVQ, mem_ofPred_eq, ← hs_C]; exact hz_supp + · right; obtain ⟨e, heW, hzJ⟩ := mem_iUnion₂.mp hz_edges + rw [he_C] at heW; exact mem_iUnion₂.mpr ⟨e, by rw [hEQ]; exact heW, hzJ⟩ + choose g_map hg_ends hg_pattern hg_sub using fun (Q : Q_set) => hex_P Q.1 Q.2; let P_set : Set + (Graph α β) := range g_map + have hdisj_envelopes : ∀ (Q₁ Q₂ : Q_set), Q₁ ≠ Q₂ → + Disjoint (V(Q₁.1) ∪ ⋃ (e : E(C)) (_ : e.1 ∈ E(Q₁.1)), V(J_of e)) + (V(Q₂.1) ∪ ⋃ (e : E(C)) (_ : e.1 ∈ E(Q₂.1)), V(J_of e)) := by + intro Q₁ Q₂ hne; have hVQ_disj : Disjoint V(Q₁.1) V(Q₂.1) := hQ_disj.2 Q₁.2 Q₂.2 + (Subtype.ext_iff.not.mp hne) + obtain ⟨_, _, _, _, hQ₁_ab, _⟩ := hg_ends Q₁; obtain ⟨_, _, _, _, hQ₂_ab, _⟩ := hg_ends Q₂ + have hQ₁C : Q₁.1 ≤ C := hQ₁_ab.1.le; have hQ₂C : Q₂.1 ≤ C := hQ₂_ab.1.le + rw [disjoint_union_left, disjoint_union_right, disjoint_union_right] + refine ⟨⟨hVQ_disj, disjoint_iUnion₂_right.mpr fun e₂ he₂ => ?_⟩, + ⟨disjoint_iUnion₂_left.mpr fun e₁ he₁ => ?_, + disjoint_iUnion₂_left.mpr fun e₁ he₁ => disjoint_iUnion₂_right.mpr fun e₂ he₂ => ?_⟩⟩ + · obtain ⟨x₂, y₂, hxy₂⟩ := Q₂.1.exists_isLink_of_mem_edgeSet he₂ + obtain ⟨_, _, _, hJ₂_C⟩ := hJ_spec e₂ x₂ y₂ (hxy₂.mono hQ₂C) + refine disjoint_left.mpr fun z hzQ₁ hzJ₂ => disjoint_left.mp hVQ_disj hzQ₁ ?_ + rcases (hJ₂_C ▸ ⟨hzJ₂, hQ₁C.vertexSet_mono hzQ₁⟩ : z ∈ ({x₂, y₂} : Set α)) with rfl | rfl + · exact hxy₂.left_mem + · exact hxy₂.right_mem + · obtain ⟨x₁, y₁, hxy₁⟩ := Q₁.1.exists_isLink_of_mem_edgeSet he₁ + obtain ⟨_, _, _, hJ₁_C⟩ := hJ_spec e₁ x₁ y₁ (hxy₁.mono hQ₁C) + refine disjoint_left.mpr fun z hzJ₁ hzQ₂ => disjoint_left.mp hVQ_disj ?_ hzQ₂ + rcases (hJ₁_C ▸ ⟨hzJ₁, hQ₂C.vertexSet_mono hzQ₂⟩ : z ∈ ({x₁, y₁} : Set α)) with rfl | rfl + · exact hxy₁.left_mem + · exact hxy₁.right_mem + · obtain ⟨x₁, y₁, hxy₁⟩ := Q₁.1.exists_isLink_of_mem_edgeSet he₁ + obtain ⟨x₂, y₂, hxy₂⟩ := Q₂.1.exists_isLink_of_mem_edgeSet he₂ + exact hJ_disj e₁ e₂ (hxy₁.mono hQ₁C) (hxy₂.mono hQ₂C) (hVQ_disj.mono + (by rintro z (rfl | rfl); exacts [hxy₁.left_mem, hxy₁.right_mem]) + (by rintro z (rfl | rfl); exacts [hxy₂.left_mem, hxy₂.right_mem])) + refine ⟨P_set, ⟨A_f, B_f, ⟨?_, ?_⟩, hfence, ?_⟩, ?_⟩ + · rintro P ⟨Q, rfl⟩; obtain ⟨a, _, b, _, _, hP_ab⟩ := hg_ends Q; exact ⟨a, b, hP_ab⟩ + · rintro P₁ ⟨Q₁, rfl⟩ P₂ ⟨Q₂, rfl⟩ hne + exact (hdisj_envelopes Q₁ Q₂ (fun h => hne (congrArg g_map h))).mono (hg_sub Q₁) (hg_sub Q₂) + · rintro P ⟨Q, rfl⟩; obtain ⟨a, haA, b, hbB, _, hP_ab⟩ := hg_ends Q; exact ⟨a, haA, b, hbB, hP_ab⟩ + · ext X; simp only [Society.transactionPattern, P_set, mem_image, mem_range, exists_exists_eq_and] + exact ⟨by rintro ⟨Q, rfl⟩; exact ⟨Q.1, Q.2, (hg_pattern Q).symm⟩, + by rintro ⟨Q, hQ, rfl⟩; exact ⟨⟨Q, hQ⟩, hg_pattern ⟨Q, hQ⟩⟩⟩ + +/-- **Graph Minors IX, (11.10)** (page 73): +"Let $C$ be the core of a consolidation $\mathcal{D}$ of $(G, \Omega)$. For any $\Pi$, there +is a transaction in $(G, \Omega)$ with pattern $\Pi$ if and only if there is such a +transaction in $(C, \Omega)$." -/ +theorem theorem_11_10_proof (S : Society α β) (D_set : Set (Graph α β × Graph α β)) + (hD : IsConsolidation S D_set) + (P_pat : Set (Set α)) : + (∃ P_set : Set (Graph α β), S.IsTransaction P_set ∧ S.transactionPattern P_set = P_pat) ↔ + (∃ Q_set : Set (Graph α (Sym2 α)), (consolidationCoreSociety S D_set hD).IsTransaction Q_set ∧ + (consolidationCoreSociety S D_set hD).transactionPattern Q_set = P_pat) := by + classical + let CS := consolidationCoreSociety S D_set hD; let C := consolidationCore S D_set; constructor + · rintro ⟨P_set, ⟨A_f, B_f, hP_disj, hfence, hP_ends⟩, rfl⟩ + have hex_Q : ∀ P : P_set, ∃ Q : Graph α (Sym2 α), + (∃ a ∈ A_f, ∃ b ∈ B_f, S.IsOmegaPathWithEnds P.1 a b ∧ CS.IsOmegaPathWithEnds Q a b) ∧ + pathEnds C Q = pathEnds S.G P.1 ∧ V(Q) ⊆ V(P.1) := by + intro P; obtain ⟨a, haA, b, hbB, hP_ab⟩ := hP_ends P.1 P.2 + obtain ⟨Q, hQ, hVQ⟩ := exists_core_path_of_path hD hP_ab.1 + (hD.bar_subset_consolidationCore hP_ab.2.2.1) (hD.bar_subset_consolidationCore hP_ab.2.2.2) + exact ⟨Q, ⟨a, haA, b, hbB, hP_ab, ⟨hQ, hP_ab.2⟩⟩, by rw [hQ.pathEnds_eq, hP_ab.1.pathEnds_eq], + hVQ.trans inter_subset_left⟩ + choose f_map hf_ends hf_pattern hf_sub using hex_Q; let Q_set : Set (Graph α (Sym2 α)) + := range f_map + refine ⟨Q_set, ⟨A_f, B_f, ⟨?_, ?_⟩, hfence, ?_⟩, ?_⟩ + · rintro Q ⟨P, rfl⟩; obtain ⟨a, _, b, _, _, hQ_ab⟩ := hf_ends P; exact ⟨a, b, hQ_ab⟩ + · rintro Q₁ ⟨P₁, rfl⟩ Q₂ ⟨P₂, rfl⟩ hne + exact (hP_disj.2 P₁.2 P₂.2 (fun h => hne (congrArg f_map (Subtype.ext h)))).mono (hf_sub P₁) + (hf_sub P₂) + · rintro Q ⟨P, rfl⟩; obtain ⟨a, haA, b, hbB, _, hQ_ab⟩ := hf_ends P; exact ⟨a, haA, b, hbB, + hQ_ab⟩ + · ext X; simp only [Society.transactionPattern, Q_set, mem_image, mem_range, + exists_exists_eq_and] + exact ⟨by rintro ⟨P, rfl⟩; exact ⟨P.1, P.2, (hf_pattern P).symm⟩, + by rintro ⟨P, hP, rfl⟩; exact ⟨⟨P, hP⟩, hf_pattern ⟨P, hP⟩⟩⟩ + · rintro ⟨Q_set, hQ_trans, rfl⟩; exact exists_transaction_of_core_transaction hD hQ_trans + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section11b.lean b/LeanPool/GraphMinor/GM09/Section11b.lean new file mode 100644 index 0000000000..646a66e82a --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section11b.lean @@ -0,0 +1,1619 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM09.Section11a +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2d +import LeanPool.GraphMinor.GM09.Section3a + +/-! +# Graph Minors IX, Section 11 (Part 2): Prominences, Lawns, the Wall, and Parks ((11.1)–(11.5)) + +This file formalizes (11.1), (11.2), (11.3), (11.4), and (11.5) from Section 11 of +N. Robertson and P. D. Seymour, *Graph Minors. IX. Disjoint crossed paths*, +J. Combin. Theory Ser. B **49** (1990) 40–77 (pages 67–70). +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM06 + +universe u v w + +variable {α : Type u} {β : Type v} + +/-! ## Basic topological and drawing lemmas -/ + +theorem isClosed_subBd {S : Type w} [TopologicalSpace S] (X : Set S) : + IsClosed (subBd X) := + isClosed_closure.inter isClosed_closure + +theorem subBd_subset_of_isClosed {S : Type w} [TopologicalSpace S] {X : Set S} + (hX : IsClosed X) : subBd X ⊆ X := by + intro x hx + rw [← hX.closure_eq] + exact hx.1 + +theorem disjoint_interior_subBd {S : Type w} [TopologicalSpace S] (X : Set S) : + Disjoint (interior X) (subBd X) := by + rw [disjoint_left] + intro x hx_int hx_bd + have hx_compl : x ∈ (interior X)ᶜ := by + rw [← closure_compl, compl_eq_univ_sdiff] + exact hx_bd.2 + exact hx_compl hx_int + +theorem isCompact_of_isClosedDisc {S : Type w} [TopologicalSpace S] {Δ : Set S} + (hΔ : IsClosedDisc Δ) : IsCompact Δ := by + obtain ⟨e⟩ := hΔ + have h1 : CompactSpace ClosedUnitDisc := + isCompact_iff_compactSpace.mp + (Metric.isCompact_of_isClosed_isBounded Metric.isClosed_closedBall + Metric.isBounded_closedBall) + have h2 : CompactSpace Δ := e.compactSpace + exact isCompact_iff_compactSpace.mpr h2 + +theorem isClosed_of_isClosedDisc {S : Type w} [TopologicalSpace S] [T2Space S] {Δ : Set S} + (hΔ : IsClosedDisc Δ) : IsClosed Δ := + (isCompact_of_isClosedDisc hΔ).isClosed + +theorem IsSimpleGraph.mono {G H : Graph α β} (hG : IsSimpleGraph G) (hHG : H ≤ G) : + IsSimpleGraph H := + ⟨fun e he v hl => hG.1 e (hHG.edgeSet_mono he) v (hl.mono hHG), + fun e₁ he₁ e₂ he₂ u v hl₁ hl₂ => + hG.2 e₁ (hHG.edgeSet_mono he₁) e₂ (hHG.edgeSet_mono he₂) u v (hl₁.mono hHG) (hl₂.mono hHG)⟩ + +theorem IsSimpleGraph.ne_of_isLink {G : Graph α β} (hG : IsSimpleGraph G) + {e : β} {u v : α} (hl : G.IsLink e u v) : u ≠ v := by + rintro rfl + exact hG.1 e hl.edge_mem u hl + +theorem graphDrawingVertexSet_eq_singleton {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) {v : α} (hv : v ∈ V(G)) : + graphDrawingVertexSet Γ v = {(Γ.iso.vertexEquiv ⟨v, hv⟩).1} := by + ext x + simp [graphDrawingVertexSet, hv, eq_comm] + +theorem graphDrawingVertexSet_nonempty {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) {v : α} (hv : v ∈ V(G)) : + (graphDrawingVertexSet Γ v).Nonempty := by + rw [graphDrawingVertexSet_eq_singleton Γ hv] + exact singleton_nonempty _ + +theorem graphDrawingVertexSet_inj {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) {u v : α} {x : S} + (hu : x ∈ graphDrawingVertexSet Γ u) (hv : x ∈ graphDrawingVertexSet Γ v) : + u = v := by + rcases hu with ⟨huG, rfl⟩ + rcases hv with ⟨hvG, hveq⟩ + have hsub : Γ.iso.vertexEquiv ⟨v, hvG⟩ = Γ.iso.vertexEquiv ⟨u, huG⟩ := + Subtype.ext hveq + exact congrArg Subtype.val (Γ.iso.vertexEquiv.injective hsub).symm + +theorem graphDrawingEdgeSet_eq {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) {e : β} (he : e ∈ E(G)) : + graphDrawingEdgeSet Γ e = (Γ.iso.edgeEquiv ⟨e, he⟩).1 := by + ext x + simp [graphDrawingEdgeSet, he] + +theorem graphDrawingEdgeSet_nonempty {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) {e : β} (he : e ∈ E(G)) : + (graphDrawingEdgeSet Γ e).Nonempty := by + rw [graphDrawingEdgeSet_eq Γ he] + have hmem : (Γ.iso.edgeEquiv ⟨e, he⟩).1 ∈ Γ.drawing.E := (Γ.iso.edgeEquiv ⟨e, he⟩).2 + rcases hmem with ⟨hnonempty, _, _⟩ + exact hnonempty + +theorem graphDrawingVertexSet_subset_closure_edge {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) {e : β} {u v : α} (hl : G.IsLink e u v) : + graphDrawingVertexSet Γ u ⊆ closure (graphDrawingEdgeSet Γ e) := by + have hu : u ∈ V(G) := hl.left_mem + have hv : v ∈ V(G) := hl.right_mem + have he : e ∈ E(G) := hl.edge_mem + rw [graphDrawingVertexSet_eq_singleton Γ hu, graphDrawingEdgeSet_eq Γ he, singleton_subset_iff] + have hlink := (Γ.iso.isLink_iff ⟨e, he⟩ ⟨u, hu⟩ ⟨v, hv⟩).mp hl + have hmem : (Γ.iso.vertexEquiv ⟨u, hu⟩).1 ∈ + ({(Γ.iso.vertexEquiv ⟨u, hu⟩).1, (Γ.iso.vertexEquiv ⟨v, hv⟩).1} : Set S) := + mem_insert _ _ + rw [← hlink.2.2.2] at hmem + exact hmem.1 + +theorem graphDrawingVertexSet_subset_subgraphU_of_mem {S : Type w} [TopologicalSpace S] + {G P : Graph α β} (Γ : GraphDrawing G S) {v : α} (hv : v ∈ V(P)) : + graphDrawingVertexSet Γ v ⊆ graphDrawingSubgraphU Γ P := + (subset_biUnion_of_mem (u := fun u => graphDrawingVertexSet Γ u) hv).trans subset_union_left + +theorem graphDrawingEdgeSet_subset_subgraphU_of_mem {S : Type w} [TopologicalSpace S] + {G P : Graph α β} (Γ : GraphDrawing G S) {e : β} (he : e ∈ E(P)) : + graphDrawingEdgeSet Γ e ⊆ graphDrawingSubgraphU Γ P := + subset_closure.trans + ((subset_biUnion_of_mem (u := fun f => closure (graphDrawingEdgeSet Γ f)) he).trans + subset_union_right) + +theorem mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU {S : Type w} [TopologicalSpace S] + {G P : Graph α β} (Γ : GraphDrawing G S) (hPG : P ≤ G) {v : α} (hv : v ∈ V(G)) + (hsub : graphDrawingVertexSet Γ v ⊆ graphDrawingSubgraphU Γ P) : + v ∈ V(P) := by + let x := (Γ.iso.vertexEquiv ⟨v, hv⟩).1 + have hx_v : x ∈ graphDrawingVertexSet Γ v := ⟨hv, rfl⟩ + have hx_V : x ∈ Γ.drawing.V := (Γ.iso.vertexEquiv ⟨v, hv⟩).2 + rcases hsub hx_v with hx_vert | hx_edge + · obtain ⟨u, huP, hxu⟩ := mem_iUnion₂.mp hx_vert + exact (graphDrawingVertexSet_inj Γ hx_v hxu) ▸ huP + · obtain ⟨e, heP, hxe⟩ := mem_iUnion₂.mp hx_edge + obtain ⟨a, b, habP⟩ := P.exists_isLink_of_mem_edgeSet heP + have habG : G.IsLink e a b := habP.mono hPG + have haG : a ∈ V(G) := habG.left_mem + have hbG : b ∈ V(G) := habG.right_mem + have heG : e ∈ E(G) := habG.edge_mem + rw [graphDrawingEdgeSet_eq Γ heG] at hxe + have hlink := (Γ.iso.isLink_iff ⟨e, heG⟩ ⟨a, haG⟩ ⟨b, hbG⟩).mp habG + have hx_inter : x ∈ closure (Γ.iso.edgeEquiv ⟨e, heG⟩).1 ∩ Γ.drawing.V := ⟨hxe, hx_V⟩ + rw [hlink.2.2.2] at hx_inter + rcases hx_inter with hx_a | hx_b + · have hva : v = a := graphDrawingVertexSet_inj Γ hx_v ⟨haG, hx_a.symm⟩ + exact hva ▸ habP.left_mem + · have hvb : v = b := graphDrawingVertexSet_inj Γ hx_v ⟨hbG, Set.mem_singleton_iff.mp hx_b ▸ + rfl⟩ + exact hvb ▸ habP.right_mem + +/-! ## Regular presentations and parks (Section 11, pages 67–68) -/ + +/-- Plane-topological properties of a presentation `P_pres = (Σ, Γ, Δ, Δ₀)` of a simple rural +neighborhood `(G, Ω, Ω₀)` used in Section 11 (pages 67–68): +- `(11.1)`: the intersection of two distinct lawns consists of images of common ends of the two + corresponding prominences; +- existence of path discs `Δ(P)` and containing lawns for paths `P` of length `≤ 2` with distinct + ends in `ΩBar₀` and no internal vertex in `ΩBar₀`; +- `wallDisc P_pres` is a closed disc; +- every edge of `G` is internal, external, or a wall edge; +- every prominence `P` with lawn `L` is drawn in `wall P_pres` with `L ∩ wall P_pres ⊆ Γ(P)`, and + `wall P_pres` is contained in `bd(Δ₀)` together with the images of all prominences; +- any internal edge incident with the middle vertex of a prominence `P₁` is drawn in its lawn `L₁`. +-/ +structure IsRegularPresentation {N : Neighborhood α β} (P_pres : Presentation N) : Prop where + /-- (11.1): every element of `L ∩ L'` for distinct lawns `L, L'` is the image under `Γ` of a + common end of the two corresponding prominences. -/ + lawn_inter_subset_common_ends : + ∀ ⦃P P' : Graph α β⦄ ⦃L L' : Set EuclideanPlane⦄, + IsProminenceWithDisc P_pres P L → + IsProminenceWithDisc P_pres P' L' → + L ≠ L' → + ∀ ⦃x : EuclideanPlane⦄, x ∈ L ∩ L' → + ∃ v ∈ pathEnds N.G P ∩ pathEnds N.G P', x ∈ graphDrawingVertexSet P_pres.Γ v + /-- Every path `P` of `G` with distinct ends in `ΩBar₀`, no internal vertex in `ΩBar₀`, and at + most + two edges has a path disc `Δ(P)` contained in some lawn `L`. -/ + exists_lawn_of_short_path : + ∀ ⦃P : Graph α β⦄ ⦃a b : α⦄, + IsGraphPathWithEnds N.G P a b → + a ≠ b → a ∈ N.Ω₀.bar → b ∈ N.Ω₀.bar → + Disjoint (V(P) \ {a, b}) N.Ω₀.bar → + E(P).ncard ≤ 2 → + ∃ D L : Set EuclideanPlane, IsPathDisc P_pres P D ∧ IsLawn P_pres L ∧ D ⊆ L + /-- The union `wallDisc P_pres` of `Δ₀` with all lawns is a closed disc. -/ + isClosedDisc_wallDisc : IsClosedDisc (wallDisc P_pres) + /-- Every edge of `G` is internal, external, or a wall edge. -/ + edge_trichotomy : + ∀ e ∈ E(N.G), IsInternalEdge P_pres e ∨ IsExternalEdge P_pres e ∨ IsWallEdge P_pres e + /-- Every prominence `P` with lawn `L` is drawn in the wall, and `L ∩ wall` is contained in the + drawing of `P`. -/ + prominence_U_subset_wall : + ∀ ⦃P : Graph α β⦄ ⦃L : Set EuclideanPlane⦄, + IsProminenceWithDisc P_pres P L → + graphDrawingSubgraphU P_pres.Γ P ⊆ wall P_pres ∧ + L ∩ wall P_pres ⊆ graphDrawingSubgraphU P_pres.Γ P + /-- Every point of the wall lies either in `bd(Δ₀)` or in the drawing of some prominence. -/ + wall_subset : + wall P_pres ⊆ subBd P_pres.Δ₀ ∪ + ⋃ (P : Graph α β) (_ : IsProminence P_pres P), graphDrawingSubgraphU P_pres.Γ P + /-- Any internal edge incident with an internal (middle) vertex of a prominence `P₁` is drawn in + its lawn `L₁`. -/ + internal_edge_subset_lawn_of_middle : + ∀ ⦃P₁ : Graph α β⦄ ⦃L₁ : Set EuclideanPlane⦄ ⦃v₁ : α⦄ ⦃e : β⦄, + IsProminenceWithDisc P_pres P₁ L₁ → + v₁ ∈ pathInternalVerts N.G P₁ → + IsInternalEdge P_pres e → + N.G.Inc e v₁ → + graphDrawingEdgeSet P_pres.Γ e ⊆ L₁ + +/-- Plane-topological properties of a park `N_star = (G*, Ω*, Ω₀)` of `N` under `P_pres` used in +(11.4) (pages 68–69). -/ +structure IsRegularParkOf {N : Neighborhood α β} + (P_pres : Presentation N) (N_star : Neighborhood α β) : Prop where + /-- `P_pres` is a regular presentation. -/ + isRegularPresentation : IsRegularPresentation P_pres + /-- `N_star` is the park of `N` under `P_pres`. -/ + isParkOf : IsParkOf P_pres N_star + /-- For any fence `(A*, B*)` of `Ω*`, there exist a fence `(A, B)` of `Ω₀` and `Z ⊆ ΩBar₀` with + `|Z| ≤ 2` satisfying conditions (i)–(iii) on page 68. -/ + exists_fence_and_Z : + ∀ ⦃A_star B_star : Set α⦄, + N_star.Ω.IsFence A_star B_star → + ∃ A B Z : Set α, + N_star.Ω₀.IsFence A B ∧ + Z ⊆ N_star.Ω₀.bar ∧ + Z.ncard ≤ 2 ∧ + A_star ∩ N_star.Ω₀.bar ⊆ A ∧ + B_star ∩ N_star.Ω₀.bar ⊆ B ∧ + ∀ L : Set EuclideanPlane, IsLawn P_pres L → + {v ∈ V(N_star.G) | graphDrawingVertexSet P_pres.Γ v ⊆ subBd L} ⊆ A ∪ A_star ∪ Z ∨ + {v ∈ V(N_star.G) | graphDrawingVertexSet P_pres.Γ v ⊆ subBd L} ⊆ B ∪ B_star ∪ Z + /-- Any path `P'` of `G*` with distinct ends in `ΩBar₀ ∪ ΩBar*` and no internal vertex in `ΩBar₀ ∪ + ΩBar*` + is drawn completely in some lawn `L`, so both of its ends are drawn in `bd(L)`. -/ + exists_lawn_of_park_path : + ∀ ⦃P' : Graph α β⦄ ⦃x y : α⦄, + IsGraphPathWithEnds N_star.G P' x y → + x ≠ y → + x ∈ N_star.Ω₀.bar ∪ N_star.Ω.bar → + y ∈ N_star.Ω₀.bar ∪ N_star.Ω.bar → + Disjoint (V(P') \ {x, y}) (N_star.Ω₀.bar ∪ N_star.Ω.bar) → + ∃ L : Set EuclideanPlane, IsLawn P_pres L ∧ + graphDrawingVertexSet P_pres.Γ x ⊆ subBd L ∧ + graphDrawingVertexSet P_pres.Γ y ⊆ subBd L + +/-- `N_star` is a regular park if it is the park of some rural neighborhood `N` under a regular +presentation `P_pres`. -/ +def Neighborhood.IsRegularPark (N_star : Neighborhood α β) : Prop := + ∃ (N : Neighborhood α β) (P_pres : Presentation N), IsRegularParkOf P_pres N_star + +/-! ## Helper lemmas on prominences, short paths, and triangles -/ + +theorem lawn_subset_wallDisc {N : Neighborhood α β} {P_pres : Presentation N} + {L : Set EuclideanPlane} (hL : IsLawn P_pres L) : + L ⊆ wallDisc P_pres := + (subset_biUnion_of_mem (u := fun X : Set EuclideanPlane => X) hL).trans subset_union_right + +theorem wallDisc_subset_Δ {N : Neighborhood α β} (P_pres : Presentation N) : + wallDisc P_pres ⊆ P_pres.Δ := by + refine union_subset P_pres.Δ₀_subset_Δ (iUnion₂_subset ?_) + rintro L ⟨P, hPL⟩ + exact hPL.1.2.2.1 + +theorem wall_subset_wallDisc {N : Neighborhood α β} {P_pres : Presentation N} + (hreg : IsRegularPresentation P_pres) : + wall P_pres ⊆ wallDisc P_pres := + subBd_subset_of_isClosed (isClosed_of_isClosedDisc hreg.isClosedDisc_wallDisc) + +theorem not_isWallEdge_of_isExternalEdge {N : Neighborhood α β} {P_pres : Presentation N} + (hreg : IsRegularPresentation P_pres) {e : β} + (he_ext : IsExternalEdge P_pres e) (he_wall : IsWallEdge P_pres e) : False := by + obtain ⟨x, hx⟩ := graphDrawingEdgeSet_nonempty P_pres.Γ he_ext.1 + exact (he_ext.2 hx).2 (wall_subset_wallDisc hreg (he_wall.2 hx)) + +theorem not_isInternalEdge_of_isExternalEdge {N : Neighborhood α β} {P_pres : Presentation N} + {e : β} (he_int : IsInternalEdge P_pres e) (he_ext : IsExternalEdge P_pres e) : False := by + obtain ⟨x, hx⟩ := graphDrawingEdgeSet_nonempty P_pres.Γ he_int.1 + exact (he_ext.2 hx).2 (interior_subset (he_int.2 hx)) + +theorem not_isInternalEdge_of_isWallEdge {N : Neighborhood α β} {P_pres : Presentation N} + {e : β} (he_int : IsInternalEdge P_pres e) (he_wall : IsWallEdge P_pres e) : False := by + obtain ⟨x, hx⟩ := graphDrawingEdgeSet_nonempty P_pres.Γ he_int.1 + exact disjoint_left.mp (disjoint_interior_subBd (wallDisc P_pres)) (he_int.2 hx) (he_wall.2 hx) + +theorem short_path_U_subset_wallDisc {N : Neighborhood α β} {P_pres : Presentation N} + (hreg : IsRegularPresentation P_pres) {P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds N.G P a b) (hab : a ≠ b) + (ha : a ∈ N.Ω₀.bar) (hb : b ∈ N.Ω₀.bar) + (hdisj : Disjoint (V(P) \ {a, b}) N.Ω₀.bar) (hcard : E(P).ncard ≤ 2) : + graphDrawingSubgraphU P_pres.Γ P ⊆ wallDisc P_pres := by + obtain ⟨D, L, hD, hL, hDL⟩ := hreg.exists_lawn_of_short_path hP hab ha hb hdisj hcard + exact hD.2.2.2.2.1.trans + ((subBd_subset_of_isClosed (isClosed_of_isClosedDisc hD.2.1)).trans + (hDL.trans (lawn_subset_wallDisc hL))) + +theorem short_path_not_isExternalEdge {N : Neighborhood α β} {P_pres : Presentation N} + (hreg : IsRegularPresentation P_pres) {P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds N.G P a b) (hab : a ≠ b) + (ha : a ∈ N.Ω₀.bar) (hb : b ∈ N.Ω₀.bar) + (hdisj : Disjoint (V(P) \ {a, b}) N.Ω₀.bar) (hcard : E(P).ncard ≤ 2) + {e : β} (heP : e ∈ E(P)) (he_ext : IsExternalEdge P_pres e) : False := by + have hsub := (graphDrawingEdgeSet_subset_subgraphU_of_mem P_pres.Γ heP).trans + (short_path_U_subset_wallDisc hreg hP hab ha hb hdisj hcard) + obtain ⟨x, hx⟩ := graphDrawingEdgeSet_nonempty P_pres.Γ he_ext.1 + exact (he_ext.2 hx).2 (hsub hx) + +theorem exists_prominence_middle_of_mem_wall_of_not_mem_bar₀ + {N : Neighborhood α β} {P_pres : Presentation N} + (hreg : IsRegularPresentation P_pres) {v : α} (hv : v ∈ V(N.G)) + (hv_wall : graphDrawingVertexSet P_pres.Γ v ⊆ wall P_pres) (hv_not_bar₀ : v ∉ N.Ω₀.bar) : + ∃ P₁ : Graph α β, IsProminence P_pres P₁ ∧ v ∈ pathInternalVerts N.G P₁ := by + let x := (P_pres.Γ.iso.vertexEquiv ⟨v, hv⟩).1 + have hxv : x ∈ graphDrawingVertexSet P_pres.Γ v := ⟨hv, rfl⟩ + have hwall_sub := hreg.wall_subset (hv_wall hxv) + rcases hwall_sub with hx_bd₀ | hx_prom + · exfalso + apply hv_not_bar₀ + rw [← P_pres.mem_bd_Δ₀_iff v hv, graphDrawingVertexSet_eq_singleton P_pres.Γ hv, + singleton_subset_iff] + exact hx_bd₀ + · obtain ⟨P₁, hP₁, hxP₁⟩ := mem_iUnion₂.mp hx_prom + obtain ⟨L₁, hP₁L₁⟩ := hP₁ + obtain ⟨a, b, hP₁_path, _, ha_bar, hb_bar, _⟩ := hP₁L₁.1.1 + have hv_sub : graphDrawingVertexSet P_pres.Γ v ⊆ graphDrawingSubgraphU P_pres.Γ P₁ := by + rw [graphDrawingVertexSet_eq_singleton P_pres.Γ hv, singleton_subset_iff] + exact hxP₁ + have hvP₁ : v ∈ V(P₁) := + mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU P_pres.Γ hP₁_path.le hv hv_sub + refine ⟨P₁, ⟨L₁, hP₁L₁⟩, ?_⟩ + rw [hP₁_path.pathInternalVerts_eq] + refine ⟨hvP₁, ?_⟩ + rintro (rfl | rfl) + · exact hv_not_bar₀ ha_bar + · exact hv_not_bar₀ hb_bar + +/-- If `v₁` is an internal vertex of a path `P₁` with `E(P₁).ncard ≤ 2`, then `P₁` has length 2 +with middle vertex `v₁`, ends `a, b`, `V(P₁) = {a, v₁, b}`, and two edges joining `v₁` to `a` and +`b`. -/ +theorem path_of_internal_of_ncard_le_two {G P₁ : Graph α β} {a b v₁ : α} + (hP₁ : IsGraphPathWithEnds G P₁ a b) (hcard : E(P₁).ncard ≤ 2) + (hv₁ : v₁ ∈ pathInternalVerts G P₁) : + v₁ ≠ a ∧ v₁ ≠ b ∧ V(P₁) = {a, v₁, b} ∧ + ∃ e₁ ∈ E(P₁), ∃ e₂ ∈ E(P₁), P₁.IsLink e₁ a v₁ ∧ P₁.IsLink e₂ v₁ b := by + classical + rw [hP₁.pathInternalVerts_eq] at hv₁ + rcases hv₁ with ⟨hv₁P, hv₁_not_ab⟩ + have hv₁a : v₁ ≠ a := fun h => hv₁_not_ab (Or.inl h) + have hv₁b : v₁ ≠ b := fun h => hv₁_not_ab (Or.inr h) + rcases hP₁ with ⟨_, W, hW, hVP₁, hEP₁⟩ + cases W with + | nil _ => + rw [hVP₁] at hv₁P + simp only [GraphWalk.support_nil, mem_ofPred_eq, List.mem_singleton] at hv₁P + exact (hv₁a hv₁P).elim + | @cons _ w₁ _ e₁ hl₁ W₁ => + cases W₁ with + | nil _ => + rw [hVP₁] at hv₁P + simp only [GraphWalk.support_cons, GraphWalk.support_nil, mem_ofPred_eq, + List.mem_cons, List.not_mem_nil, or_false] at hv₁P + rcases hv₁P with rfl | rfl + · exact (hv₁a rfl).elim + · exact (hv₁b rfl).elim + | @cons _ w₂ _ e₂ hl₂ W₂ => + cases W₂ with + | nil _ => + have hv₁_eq : v₁ = w₁ := by + rw [hVP₁] at hv₁P + simp only [GraphWalk.support_cons, GraphWalk.support_nil, mem_ofPred_eq, + List.mem_cons, List.not_mem_nil, or_false] at hv₁P + rcases hv₁P with rfl | rfl | rfl + · exact (hv₁a rfl).elim + · rfl + · exact (hv₁b rfl).elim + subst hv₁_eq + refine ⟨hv₁a, hv₁b, ?_, e₁, ?_, e₂, ?_, hl₁, hl₂⟩ + · rw [hVP₁] + ext z + simp [GraphWalk.support_cons, GraphWalk.support_nil] + · rw [hEP₁] + simp [GraphWalk.edges_cons] + · rw [hEP₁] + simp [GraphWalk.edges_cons] + | @cons _ w₃ _ e₃ hl₃ W₃ => + exfalso + have hnd_E : ([e₁, e₂, e₃] ++ W₃.edges).Nodup := hW.edges_nodup + have hnd₃ : ([e₁, e₂, e₃] : List β).Nodup := (List.nodup_append.mp hnd_E).1 + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or, + not_false_eq_true, List.nodup_nil, and_true] at hnd₃ + rcases hnd₃ with ⟨⟨he₁₂, he₁₃⟩, he₂₃⟩ + have hsub : ({e₁, e₂, e₃} : Set β) ⊆ E(P₁) := by + rw [hEP₁] + rintro f (rfl | rfl | rfl) <;> simp [GraphWalk.edges_cons] + have hfin : E(P₁).Finite := by + rw [hEP₁] + exact (GraphWalk.cons hl₁ (GraphWalk.cons hl₂ (GraphWalk.cons hl₃ + W₃))).edges.toFinset.finite_toSet.subset + fun f hf => List.mem_toFinset.mpr hf + have h3 : ({e₁, e₂, e₃} : Set β).ncard = 3 := by + rw [ncard_insert_of_notMem, ncard_pair he₂₃] + simp [he₁₂, he₁₃] + have hle := ncard_le_ncard hsub hfin + omega + +/-- Construct the 2-edge path in `G` formed by two incident edges `e₁` (linking `a` and `v`) and +`e₂` (linking `v` and `b`) with `a, v, b` pairwise distinct. -/ +theorem isGraphPathWithEnds_two_edges {G : Graph α β} {e₁ e₂ : β} {a v b : α} + (hl₁ : G.IsLink e₁ a v) (hl₂ : G.IsLink e₂ v b) + (hav : a ≠ v) (hvb : v ≠ b) (hab : a ≠ b) : + IsGraphPathWithEnds G (subgraphUnion G (singleEdgeSubgraph G e₁) (singleEdgeSubgraph G e₂)) a b + ∧ + V(subgraphUnion G (singleEdgeSubgraph G e₁) (singleEdgeSubgraph G e₂)) = {a, v, b} ∧ + V(subgraphUnion G (singleEdgeSubgraph G e₁) (singleEdgeSubgraph G e₂)) \ {a, b} = {v} ∧ + E(subgraphUnion G (singleEdgeSubgraph G e₁) (singleEdgeSubgraph G e₂)) = {e₁, e₂} ∧ + E(subgraphUnion G (singleEdgeSubgraph G e₁) (singleEdgeSubgraph G e₂)).ncard ≤ 2 := by + have hP₁ : IsGraphPathWithEnds G (singleEdgeSubgraph G e₁) a v := + (isGraphPathWithEnds_singleEdgeSubgraph hav hl₁).mono (singleEdgeSubgraph_le G e₁) + have hP₂ : IsGraphPathWithEnds G (singleEdgeSubgraph G e₂) v b := + (isGraphPathWithEnds_singleEdgeSubgraph hvb hl₂).mono (singleEdgeSubgraph_le G e₂) + have hV₁ : V(singleEdgeSubgraph G e₁) = {a, v} := vertexSet_singleEdgeSubgraph_eq_pair hl₁ + have hV₂ : V(singleEdgeSubgraph G e₂) = {v, b} := vertexSet_singleEdgeSubgraph_eq_pair hl₂ + have hinter : V(singleEdgeSubgraph G e₁) ∩ V(singleEdgeSubgraph G e₂) = {v} := by + rw [hV₁, hV₂] + ext z + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨h₁, h₂⟩ + rcases h₁ with rfl | rfl + · rcases h₂ with h | h + · exact (hav h).elim + · exact (hab h).elim + · rfl + · rintro rfl + exact ⟨Or.inr rfl, Or.inl rfl⟩ + have hpath : IsGraphPathWithEnds G + (subgraphUnion G (singleEdgeSubgraph G e₁) (singleEdgeSubgraph G e₂)) a b := + hP₁.subgraphUnion hP₂ hinter + have hVP : V(subgraphUnion G (singleEdgeSubgraph G e₁) (singleEdgeSubgraph G e₂)) = {a, v, b} + := by + rw [vertexSet_subgraphUnion, hV₁, hV₂] + ext z + simp only [mem_union, mem_insert_iff, mem_singleton_iff] + tauto + have hVP_diff : + V(subgraphUnion G (singleEdgeSubgraph G e₁) (singleEdgeSubgraph G e₂)) \ {a, b} = {v} := by + rw [hVP] + ext z + simp only [mem_sdiff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨h₁, hnot⟩ + rcases h₁ with rfl | rfl | rfl + · exact (hnot (Or.inl rfl)).elim + · rfl + · exact (hnot (Or.inr rfl)).elim + · rintro rfl + exact ⟨Or.inr (Or.inl rfl), by rintro (h | h); exacts [hav h.symm, hvb h]⟩ + have hEP : E(subgraphUnion G (singleEdgeSubgraph G e₁) (singleEdgeSubgraph G e₂)) = {e₁, e₂} := by + rw [edgeSet_subgraphUnion (singleEdgeSubgraph_le G e₁) (singleEdgeSubgraph_le G e₂), + edgeSet_singleEdgeSubgraph hl₁.edge_mem, edgeSet_singleEdgeSubgraph hl₂.edge_mem] + ext f + simp [or_comm] + have hcard : E(subgraphUnion G (singleEdgeSubgraph G e₁) (singleEdgeSubgraph G e₂)).ncard ≤ 2 + := by + rw [hEP] + exact (ncard_insert_le e₁ {e₂}).trans (by simp) + exact ⟨hpath, hVP, hVP_diff, hEP, hcard⟩ + +/-! ## Proof of (11.1) and (11.2) -/ + +/-- **Graph Minors IX, (11.1)** (page 67): +"If $L, L'$ are distinct lawns then every element of $L \cap L'$ is the image under $\Gamma$ +of a common end of the two corresponding prominences." -/ +theorem theorem_11_1_proof {N : Neighborhood α β} {P_pres : Presentation N} + (hreg : IsRegularPresentation P_pres) + {P P' : Graph α β} {L L' : Set EuclideanPlane} + (hL : IsProminenceWithDisc P_pres P L) + (hL' : IsProminenceWithDisc P_pres P' L') + (hne : L ≠ L') {x : EuclideanPlane} (hx : x ∈ L ∩ L') : + ∃ v ∈ pathEnds N.G P ∩ pathEnds N.G P', x ∈ graphDrawingVertexSet P_pres.Γ v := + hreg.lawn_inter_subset_common_ends hL hL' hne hx + +/-- Helper for (11.2): if `e` is an external edge linking `v₁` and `v₂`, `v₁` is drawn in the wall, +and `v₁ ∉ ΩBar₀`, then `v₂ ∉ ΩBar₀`. -/ +private theorem not_mem_bar₀_of_external_link_wall + {N : Neighborhood α β} {P_pres : Presentation N} + (hreg : IsRegularPresentation P_pres) (hsimple : IsSimpleGraph N.G) + {e : β} {v₁ v₂ : α} (he : IsExternalEdge P_pres e) (hl : N.G.IsLink e v₁ v₂) + (hv₁_wall : graphDrawingVertexSet P_pres.Γ v₁ ⊆ wall P_pres) + (hv₁_not_bar₀ : v₁ ∉ N.Ω₀.bar) : + v₂ ∉ N.Ω₀.bar := by + have hv₁₂ : v₁ ≠ v₂ := hsimple.ne_of_isLink hl + -- Choose a prominence `P₁` whose middle vertex is `v₁`. + obtain ⟨P₁, ⟨L₁, hP₁L₁⟩, hv₁_mid⟩ := + exists_prominence_middle_of_mem_wall_of_not_mem_bar₀ hreg hl.left_mem hv₁_wall hv₁_not_bar₀ + obtain ⟨a, b, hP₁_path, _, ha_bar, _, _⟩ := hP₁L₁.1.1 + obtain ⟨hv₁a, _, _, e₁, he₁P₁, _, _, hl₁_P₁, _⟩ := + path_of_internal_of_ncard_le_two hP₁_path hP₁L₁.2.1 hv₁_mid + have hl₁ : N.G.IsLink e₁ a v₁ := hl₁_P₁.mono hP₁_path.le + -- Every edge of `P₁` is a wall edge, hence distinct from the external edge `e`. + have hP₁_wall : ∀ f ∈ E(P₁), IsWallEdge P_pres f := fun f hf => + ⟨hP₁_path.le.edgeSet_mono hf, + (graphDrawingEdgeSet_subset_subgraphU_of_mem P_pres.Γ hf).trans + (hreg.prominence_U_subset_wall hP₁L₁).1⟩ + -- Since `N.G` is simple and `e` is not a wall edge, `v₂` is not an end of `P₁`. + have hv₂a : v₂ ≠ a := by + rintro rfl + have he_eq : e = e₁ := hsimple.2 e he.1 e₁ hl₁.edge_mem v₁ v₂ hl hl₁.symm + exact not_isWallEdge_of_isExternalEdge hreg he (he_eq ▸ hP₁_wall e₁ he₁P₁) + -- Let `P'` be the 2-edge path formed by `e₁` and `e`. + obtain ⟨hP'_path, _, hVP'_diff, hEP', hP'_card⟩ := + isGraphPathWithEnds_two_edges hl₁ hl hv₁a.symm hv₁₂ hv₂a.symm + intro hv₂_bar₀ + have hdisj' : Disjoint (V(subgraphUnion N.G (singleEdgeSubgraph N.G e₁) + (singleEdgeSubgraph N.G e)) \ {a, v₂}) + N.Ω₀.bar := by + rw [hVP'_diff, disjoint_singleton_left] + exact hv₁_not_bar₀ + have he_in_P' : e ∈ E(subgraphUnion N.G (singleEdgeSubgraph N.G e₁) (singleEdgeSubgraph N.G e)) + := by + rw [hEP'] + exact mem_insert_of_mem _ (mem_singleton e) + exact short_path_not_isExternalEdge hreg hP'_path hv₂a.symm ha_bar hv₂_bar₀ hdisj' hP'_card + he_in_P' he + +/-- **Graph Minors IX, (11.2)** (pages 67–68): +"If $e$ is an external edge of $G$ with both ends drawn in the wall, then its ends are both +middle vertices of prominences." -/ +theorem theorem_11_2_proof {N : Neighborhood α β} {P_pres : Presentation N} + (hreg : IsRegularPresentation P_pres) (hsimple : IsSimpleGraph N.G) + {e : β} {u v : α} (he : IsExternalEdge P_pres e) (hl : N.G.IsLink e u v) + (hu_wall : graphDrawingVertexSet P_pres.Γ u ⊆ wall P_pres) + (hv_wall : graphDrawingVertexSet P_pres.Γ v ⊆ wall P_pres) : + (∃ P₁ : Graph α β, IsProminence P_pres P₁ ∧ u ∈ pathInternalVerts N.G P₁) ∧ + (∃ P₂ : Graph α β, IsProminence P_pres P₂ ∧ v ∈ pathInternalVerts N.G P₂) := by + have huv : u ≠ v := hsimple.ne_of_isLink hl + -- Let `P` be the 1-edge path formed by `e`. Not both ends of `P` are in `ΩBar₀`. + have hnot_both : ¬ (u ∈ N.Ω₀.bar ∧ v ∈ N.Ω₀.bar) := by + rintro ⟨hu_bar, hv_bar⟩ + have hP : IsGraphPathWithEnds N.G (singleEdgeSubgraph N.G e) u v := + (isGraphPathWithEnds_singleEdgeSubgraph huv hl).mono (singleEdgeSubgraph_le N.G e) + have hdisj : Disjoint (V(singleEdgeSubgraph N.G e) \ {u, v}) N.Ω₀.bar := by + rw [vertexSet_singleEdgeSubgraph_eq_pair hl, sdiff_self] + exact empty_disjoint _ + have hcard : E(singleEdgeSubgraph N.G e).ncard ≤ 2 := by + rw [edgeSet_singleEdgeSubgraph he.1] + simp + have heP : e ∈ E(singleEdgeSubgraph N.G e) := by + rw [edgeSet_singleEdgeSubgraph he.1] + exact mem_singleton e + exact short_path_not_isExternalEdge hreg hP huv hu_bar hv_bar hdisj hcard heP he + have hu_not_bar₀ : u ∉ N.Ω₀.bar := by + by_contra hu_bar + have hv_not_bar₀ : v ∉ N.Ω₀.bar := fun hv_bar => hnot_both ⟨hu_bar, hv_bar⟩ + exact not_mem_bar₀_of_external_link_wall hreg hsimple he hl.symm hv_wall hv_not_bar₀ hu_bar + have hv_not_bar₀ : v ∉ N.Ω₀.bar := + not_mem_bar₀_of_external_link_wall hreg hsimple he hl hu_wall hu_not_bar₀ + exact ⟨exists_prominence_middle_of_mem_wall_of_not_mem_bar₀ hreg hl.left_mem hu_wall hu_not_bar₀, + exists_prominence_middle_of_mem_wall_of_not_mem_bar₀ hreg hl.right_mem hv_wall hv_not_bar₀⟩ + +/-! ## Triangles and Proof of (11.3) -/ + +/-- Every triangle `T` in `G` has 3 distinct vertices `{x₁, x₂, x₃}` and 3 distinct edges +`{f₁, f₂, f₃}` linking `(x₂, x₃)`, `(x₁, x₃)`, and `(x₁, x₂)` respectively. -/ +theorem IsTriangle.exists_verts_and_edges {G T : Graph α β} (hT : IsTriangle G T) : + ∃ x₁ x₂ x₃ : α, ∃ f₁ f₂ f₃ : β, + x₁ ≠ x₂ ∧ x₂ ≠ x₃ ∧ x₁ ≠ x₃ ∧ + f₁ ≠ f₂ ∧ f₂ ≠ f₃ ∧ f₁ ≠ f₃ ∧ + V(T) = {x₁, x₂, x₃} ∧ E(T) = {f₁, f₂, f₃} ∧ + T.IsLink f₁ x₂ x₃ ∧ T.IsLink f₂ x₁ x₃ ∧ T.IsLink f₃ x₁ x₂ := by + classical + rcases hT with ⟨⟨_, x₁, W, hW_closed, hW_pos, hVT, hET⟩, hcard⟩ + have hfinE : E(T).Finite := by + rw [hET] + exact W.edges.toFinset.finite_toSet.subset fun e he => List.mem_toFinset.mpr he + cases W with + | nil _ => + simp [GraphWalk.length] at hW_pos + | @cons _ x₂ _ f₃ hl₃ W₁ => + cases W₁ with + | nil _ => + exfalso + have hET_eq : E(T) = {f₃} := by + rw [hET]; ext e; simp [GraphWalk.edges_cons, GraphWalk.edges_nil] + rw [hET_eq, ncard_singleton] at hcard + omega + | @cons _ x₃ _ f₁ hl₁ W₂ => + cases W₂ with + | nil _ => + exfalso + have hET_eq : E(T) = {f₃, f₁} := by + rw [hET]; ext e; simp [GraphWalk.edges_cons, GraphWalk.edges_nil] + have hle : E(T).ncard ≤ 2 := by + rw [hET_eq] + exact (ncard_insert_le f₃ {f₁}).trans (by simp) + omega + | @cons _ x₄ _ f₂ hl₂ W₃ => + cases W₃ with + | nil _ => + have hnd_V : ([x₂, x₃, x₁] : List α).Nodup := hW_closed.1 + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or, + not_false_eq_true, List.nodup_nil, and_true] at hnd_V + rcases hnd_V with ⟨⟨hx₂₃, hx₂₁⟩, hx₃₁⟩ + have hnd_E : ([f₃, f₁, f₂] : List β).Nodup := hW_closed.2 + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or, + not_false_eq_true, List.nodup_nil, and_true] at hnd_E + rcases hnd_E with ⟨⟨hf₃₁, hf₃₂⟩, hf₁₂⟩ + have hET_eq : E(T) = {f₁, f₂, f₃} := by + rw [hET]; ext e + simp only [GraphWalk.edges_cons, GraphWalk.edges_nil, mem_ofPred_eq, + List.mem_cons, List.not_mem_nil, or_false, mem_insert_iff, mem_singleton_iff] + tauto + refine ⟨x₁, x₂, x₃, f₁, f₂, f₃, Ne.symm hx₂₁, hx₂₃, Ne.symm hx₃₁, + hf₁₂, Ne.symm hf₃₂, Ne.symm hf₃₁, ?_, hET_eq, hl₁, hl₂.symm, hl₃⟩ + rw [hVT] + ext z + simp only [GraphWalk.support_cons, GraphWalk.support_nil, mem_ofPred_eq, + List.mem_cons, List.not_mem_nil, or_false, mem_insert_iff, mem_singleton_iff] + tauto + | @cons _ x₅ _ f₄ hl₄ W₄ => + exfalso + have hnd_E : ([f₃, f₁, f₂, f₄] ++ W₄.edges).Nodup := hW_closed.2 + have hnd₄ : ([f₃, f₁, f₂, f₄] : List β).Nodup := (List.nodup_append.mp hnd_E).1 + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or, + not_false_eq_true, List.nodup_nil, and_true] at hnd₄ + rcases hnd₄ with ⟨⟨hf₃₁, hf₃₂, hf₃₄⟩, ⟨hf₁₂, hf₁₄⟩, hf₂₄⟩ + have hsub : ({f₃, f₁, f₂, f₄} : Set β) ⊆ E(T) := by + rw [hET] + rintro e (rfl | rfl | rfl | rfl) <;> simp [GraphWalk.edges_cons] + have h4 : ({f₃, f₁, f₂, f₄} : Set β).ncard = 4 := by + rw [ncard_insert_of_notMem, ncard_insert_of_notMem, ncard_pair hf₂₄] + · simp [hf₁₂, hf₁₄] + · simp [hf₃₁, hf₃₂, hf₃₄] + have hle := ncard_le_ncard hsub hfinE + omega + +/-- Given a triangle `T` in `G` and two distinct edges `e₂, e₃ ∈ E(T)`, we can label the vertices +`v₁, v₂, v₃` and the third edge `e₁` of `T` so that `e₃` links `v₁, v₂`, `e₂` links `v₁, v₃`, and +`e₁` links `v₂, v₃`. -/ +theorem IsTriangle.exists_verts_of_two_edges {G T : Graph α β} (hT : IsTriangle G T) + {e₂ e₃ : β} (he₂ : e₂ ∈ E(T)) (he₃ : e₃ ∈ E(T)) (he₂₃ : e₂ ≠ e₃) : + ∃ v₁ v₂ v₃ : α, ∃ e₁ : β, + v₁ ≠ v₂ ∧ v₂ ≠ v₃ ∧ v₁ ≠ v₃ ∧ + e₁ ≠ e₂ ∧ e₂ ≠ e₃ ∧ e₁ ≠ e₃ ∧ + V(T) = {v₁, v₂, v₃} ∧ E(T) = {e₁, e₂, e₃} ∧ + T.IsLink e₁ v₂ v₃ ∧ T.IsLink e₂ v₁ v₃ ∧ T.IsLink e₃ v₁ v₂ := by + obtain ⟨x₁, x₂, x₃, f₁, f₂, f₃, hx₁₂, hx₂₃, hx₁₃, hf₁₂, hf₂₃, hf₁₃, hVT, hET, hl₁, hl₂, hl₃⟩ := + hT.exists_verts_and_edges + have he₂_mem : e₂ = f₁ ∨ e₂ = f₂ ∨ e₂ = f₃ := by + rwa [hET, mem_insert_iff, mem_insert_iff, mem_singleton_iff] at he₂ + have he₃_mem : e₃ = f₁ ∨ e₃ = f₂ ∨ e₃ = f₃ := by + rwa [hET, mem_insert_iff, mem_insert_iff, mem_singleton_iff] at he₃ + rcases he₂_mem with rfl | rfl | rfl <;> rcases he₃_mem with rfl | rfl | rfl + · exact (he₂₃ rfl).elim + · refine ⟨x₃, x₁, x₂, f₃, hx₁₃.symm, hx₁₂, hx₂₃.symm, hf₁₃.symm, hf₁₂, hf₂₃.symm, + ?_, ?_, hl₃, hl₁.symm, hl₂.symm⟩ + · rw [hVT]; ext z; simp; tauto + · rw [hET]; ext e; simp; tauto + · refine ⟨x₂, x₁, x₃, f₂, hx₁₂.symm, hx₁₃, hx₂₃, hf₁₂.symm, hf₁₃, hf₂₃, + ?_, ?_, hl₂, hl₁, hl₃.symm⟩ + · rw [hVT]; ext z; simp; tauto + · rw [hET]; ext e; simp; tauto + · refine ⟨x₃, x₂, x₁, f₃, hx₂₃.symm, hx₁₂.symm, hx₁₃.symm, hf₂₃.symm, hf₁₂.symm, hf₁₃.symm, + ?_, ?_, hl₃.symm, hl₂.symm, hl₁.symm⟩ + · rw [hVT]; ext z; simp; tauto + · rw [hET]; ext e; simp; tauto + · exact (he₂₃ rfl).elim + · refine ⟨x₁, x₂, x₃, f₁, hx₁₂, hx₂₃, hx₁₃, hf₁₂, hf₂₃, hf₁₃, hVT, hET, hl₁, hl₂, hl₃⟩ + · refine ⟨x₂, x₃, x₁, f₂, hx₂₃, hx₁₃.symm, hx₁₂.symm, hf₂₃, hf₁₃.symm, hf₁₂.symm, + ?_, ?_, hl₂.symm, hl₃.symm, hl₁⟩ + · rw [hVT]; ext z; simp; tauto + · rw [hET]; ext e; simp; tauto + · refine ⟨x₁, x₃, x₂, f₁, hx₁₃, hx₂₃.symm, hx₁₂, hf₁₃, hf₂₃.symm, hf₁₂, + ?_, ?_, hl₁.symm, hl₃, hl₂⟩ + · rw [hVT]; ext z; simp; tauto + · rw [hET]; ext e; simp; tauto + · exact (he₂₃ rfl).elim + +/-- Any vertex `w` drawn in `closure (wallDisc P_pres)` and incident with an external edge is drawn +in the wall. -/ +private theorem mem_wall_of_mem_closure_wallDisc_of_inc_external + {N : Neighborhood α β} {P_pres : Presentation N} {w : α} {f : β} + (hw_cl : graphDrawingVertexSet P_pres.Γ w ⊆ closure (wallDisc P_pres)) + (hf : IsExternalEdge P_pres f) (hinc : N.G.Inc f w) : + graphDrawingVertexSet P_pres.Γ w ⊆ wall P_pres := by + obtain ⟨u, hl⟩ := hinc + have hw_ext : graphDrawingVertexSet P_pres.Γ w ⊆ closure (Set.univ \ wallDisc P_pres) := + (graphDrawingVertexSet_subset_closure_edge P_pres.Γ hl).trans + (closure_mono (hf.2.trans fun _ hx => ⟨trivial, hx.2⟩)) + exact subset_inter hw_cl hw_ext + +/-- Any vertex `w` incident with both an internal edge and an external edge is drawn in the wall. -/ +private theorem mem_wall_of_inc_internal_of_inc_external + {N : Neighborhood α β} {P_pres : Presentation N} {w : α} {interiorSeamEdge e_ext : β} + (he_int : IsInternalEdge P_pres interiorSeamEdge) (hinc_int : N.G.Inc interiorSeamEdge w) + (he_ext : IsExternalEdge P_pres e_ext) (hinc_ext : N.G.Inc e_ext w) : + graphDrawingVertexSet P_pres.Γ w ⊆ wall P_pres := by + obtain ⟨u, hl⟩ := hinc_int + have hw_cl : graphDrawingVertexSet P_pres.Γ w ⊆ closure (wallDisc P_pres) := + (graphDrawingVertexSet_subset_closure_edge P_pres.Γ hl).trans + (closure_mono (he_int.2.trans interior_subset)) + exact mem_wall_of_mem_closure_wallDisc_of_inc_external hw_cl he_ext hinc_ext + +/-- If `u` is the middle vertex of a prominence `P₁` and `e₂` is an internal edge linking `u` to a +vertex `w ∈ V(P₁)` in a simple graph `N.G`, we get a contradiction. -/ +private theorem false_of_prominence_middle_internal_link + {N : Neighborhood α β} {P_pres : Presentation N} + (hreg : IsRegularPresentation P_pres) (hsimple : IsSimpleGraph N.G) + {P₁ : Graph α β} {L₁ : Set EuclideanPlane} (hP₁L₁ : IsProminenceWithDisc P_pres P₁ L₁) + {u w : α} {e₂ : β} (hu_mid : u ∈ pathInternalVerts N.G P₁) + (hl₂ : N.G.IsLink e₂ u w) (he₂ : IsInternalEdge P_pres e₂) (hwP₁ : w ∈ V(P₁)) : False := by + obtain ⟨a, b, hP₁_path, _, _, _, _⟩ := hP₁L₁.1.1 + obtain ⟨_, _, hVP₁, f₁, hf₁P₁, f₂, hf₂P₁, hlf₁, hlf₂⟩ := + path_of_internal_of_ncard_le_two hP₁_path hP₁L₁.2.1 hu_mid + have huw : u ≠ w := hsimple.ne_of_isLink hl₂ + rw [hVP₁, mem_insert_iff, mem_insert_iff, mem_singleton_iff] at hwP₁ + have hex_f : ∃ f ∈ E(P₁), N.G.IsLink f u w := by + rcases hwP₁ with rfl | rfl | rfl + · exact ⟨f₁, hf₁P₁, hlf₁.symm.mono hP₁_path.le⟩ + · exact (huw rfl).elim + · exact ⟨f₂, hf₂P₁, hlf₂.mono hP₁_path.le⟩ + obtain ⟨f, hfP₁, hlf⟩ := hex_f + have he₂_eq : e₂ = f := hsimple.2 e₂ he₂.1 f (hP₁_path.le.edgeSet_mono hfP₁) u w hl₂ hlf + have hf_wall : IsWallEdge P_pres f := + ⟨hP₁_path.le.edgeSet_mono hfP₁, + (graphDrawingEdgeSet_subset_subgraphU_of_mem P_pres.Γ hfP₁).trans + (hreg.prominence_U_subset_wall hP₁L₁).1⟩ + exact not_isInternalEdge_of_isWallEdge he₂ (he₂_eq ▸ hf_wall) + +/-- **Graph Minors IX, (11.3)** (page 68): +"No triangle in $G$ has an internal edge and an external edge." -/ +theorem theorem_11_3_proof {N : Neighborhood α β} {P_pres : Presentation N} + (hreg : IsRegularPresentation P_pres) (hsimple : IsSimpleGraph N.G) + {T : Graph α β} (hT : IsTriangle N.G T) + {e₂ e₃ : β} (he₂T : e₂ ∈ E(T)) (he₃T : e₃ ∈ E(T)) + (he₂ : IsInternalEdge P_pres e₂) (he₃ : IsExternalEdge P_pres e₃) : False := by + have he₂₃ : e₂ ≠ e₃ := fun h => not_isInternalEdge_of_isExternalEdge he₂ (h ▸ he₃) + obtain ⟨v₁, v₂, v₃, e₁, hv₁₂, hv₂₃, hv₁₃, _, _, _, _, _, hl₁T, hl₂T, hl₃T⟩ := + hT.exists_verts_of_two_edges he₂T he₃T he₂₃ + have hl₁ : N.G.IsLink e₁ v₂ v₃ := hl₁T.mono hT.1.1 + have hl₂ : N.G.IsLink e₂ v₁ v₃ := hl₂T.mono hT.1.1 + have hl₃ : N.G.IsLink e₃ v₁ v₂ := hl₃T.mono hT.1.1 + -- `v₁` is incident with both the internal edge `e₂` and the external edge `e₃`, so `v₁` is in the + -- wall. + have hv₁_wall : graphDrawingVertexSet P_pres.Γ v₁ ⊆ wall P_pres := + mem_wall_of_inc_internal_of_inc_external he₂ ⟨v₃, hl₂⟩ he₃ ⟨v₂, hl₃⟩ + by_cases hv₂_wall : graphDrawingVertexSet P_pres.Γ v₂ ⊆ wall P_pres + · -- Case 1: Both ends `v₁, v₂` of `e₃` are drawn in the wall. + obtain ⟨⟨P₁, ⟨L₁, hP₁L₁⟩, hv₁_mid⟩, ⟨P₂, ⟨L₂, hP₂L₂⟩, hv₂_mid⟩⟩ := + theorem_11_2_proof hreg hsimple he₃ hl₃ hv₁_wall hv₂_wall + have he₂_L₁ : graphDrawingEdgeSet P_pres.Γ e₂ ⊆ L₁ := + hreg.internal_edge_subset_lawn_of_middle hP₁L₁ hv₁_mid he₂ ⟨v₃, hl₂⟩ + have hv₃_L₁ : graphDrawingVertexSet P_pres.Γ v₃ ⊆ L₁ := + (graphDrawingVertexSet_subset_closure_edge P_pres.Γ hl₂.symm).trans + ((closure_mono he₂_L₁).trans (isClosed_of_isClosedDisc hP₁L₁.1.2.1).closure_eq.subset) + have hv₃_P₁ : v₃ ∈ V(P₁) := by + rcases hreg.edge_trichotomy e₁ hl₁.edge_mem with he₁_int | he₁_ext | he₁_wall + · -- If `e₁` is internal, `v₃` is also drawn in `L₂`; since `L₁ ≠ L₂`, `v₃` is a common end. + have he₁_L₂ : graphDrawingEdgeSet P_pres.Γ e₁ ⊆ L₂ := + hreg.internal_edge_subset_lawn_of_middle hP₂L₂ hv₂_mid he₁_int ⟨v₃, hl₁⟩ + have hv₃_L₂ : graphDrawingVertexSet P_pres.Γ v₃ ⊆ L₂ := + (graphDrawingVertexSet_subset_closure_edge P_pres.Γ hl₁.symm).trans + ((closure_mono he₁_L₂).trans (isClosed_of_isClosedDisc hP₂L₂.1.2.1).closure_eq.subset) + have hL₁₂ : L₁ ≠ L₂ := by + intro hL_eq + obtain ⟨a₂, b₂, hP₂_path, _, ha₂_bar, hb₂_bar, _⟩ := hP₂L₂.1.1 + obtain ⟨_, _, hVP₂, _, _, _, _, _, _⟩ := + path_of_internal_of_ncard_le_two hP₂_path hP₂L₂.2.1 hv₂_mid + obtain ⟨a₁, b₁, hP₁_path, _, _, _, hdisj₁⟩ := hP₁L₁.1.1 + rw [hP₁_path.pathInternalVerts_eq] at hv₁_mid + have hv₁_not_bar₀ : v₁ ∉ N.Ω₀.bar := disjoint_left.mp hdisj₁ hv₁_mid + have hv₁_L₁ : graphDrawingVertexSet P_pres.Γ v₁ ⊆ L₁ := + (graphDrawingVertexSet_subset_closure_edge P_pres.Γ hl₂).trans + ((closure_mono he₂_L₁).trans (isClosed_of_isClosedDisc hP₁L₁.1.2.1).closure_eq.subset) + have hv₁_U₂ : graphDrawingVertexSet P_pres.Γ v₁ ⊆ graphDrawingSubgraphU P_pres.Γ P₂ := + (subset_inter (hL_eq ▸ hv₁_L₁) hv₁_wall).trans (hreg.prominence_U_subset_wall hP₂L₂).2 + have hv₁P₂ : v₁ ∈ V(P₂) := + mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU P_pres.Γ hP₂_path.le + hl₂.left_mem hv₁_U₂ + rw [hVP₂, mem_insert_iff, mem_insert_iff, mem_singleton_iff] at hv₁P₂ + rcases hv₁P₂ with rfl | rfl | rfl + · exact hv₁_not_bar₀ ha₂_bar + · exact hv₁₂ rfl + · exact hv₁_not_bar₀ hb₂_bar + let x₃ := (P_pres.Γ.iso.vertexEquiv ⟨v₃, hl₂.right_mem⟩).1 + have hx₃ : x₃ ∈ graphDrawingVertexSet P_pres.Γ v₃ := ⟨hl₂.right_mem, rfl⟩ + obtain ⟨u, hu_ends, hx₃_u⟩ := + theorem_11_1_proof hreg hP₁L₁ hP₂L₂ hL₁₂ ⟨hv₃_L₁ hx₃, hv₃_L₂ hx₃⟩ + have hv₃_eq : v₃ = u := graphDrawingVertexSet_inj P_pres.Γ hx₃ hx₃_u + obtain ⟨a₁, b₁, hP₁_path, _, _, _, _⟩ := hP₁L₁.1.1 + have hu_P₁ : u ∈ V(P₁) := by + have hu_P₁' := hu_ends.1 + rw [hP₁_path.pathEnds_eq] at hu_P₁' + rcases hu_P₁' with rfl | rfl + · exact hP₁_path.left_mem + · exact hP₁_path.right_mem + exact hv₃_eq ▸ hu_P₁ + · -- If `e₁` is external, `v₃` is drawn in the wall, hence in `L₁ ∩ wall ⊆ Γ(P₁)`. + have hv₃_wall : graphDrawingVertexSet P_pres.Γ v₃ ⊆ wall P_pres := + mem_wall_of_inc_internal_of_inc_external he₂ ⟨v₁, hl₂.symm⟩ he₁_ext ⟨v₂, hl₁.symm⟩ + obtain ⟨a₁, b₁, hP₁_path, _, _, _, _⟩ := hP₁L₁.1.1 + exact mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU P_pres.Γ hP₁_path.le + hl₂.right_mem + ((subset_inter hv₃_L₁ hv₃_wall).trans (hreg.prominence_U_subset_wall hP₁L₁).2) + · -- If `e₁` is a wall edge, `v₃` is drawn in the wall, hence in `L₁ ∩ wall ⊆ Γ(P₁)`. + have hv₃_wall : graphDrawingVertexSet P_pres.Γ v₃ ⊆ wall P_pres := + (graphDrawingVertexSet_subset_closure_edge P_pres.Γ hl₁.symm).trans + ((closure_mono he₁_wall.2).trans (isClosed_subBd _).closure_eq.subset) + obtain ⟨a₁, b₁, hP₁_path, _, _, _, _⟩ := hP₁L₁.1.1 + exact mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU P_pres.Γ hP₁_path.le + hl₂.right_mem + ((subset_inter hv₃_L₁ hv₃_wall).trans (hreg.prominence_U_subset_wall hP₁L₁).2) + exact false_of_prominence_middle_internal_link hreg hsimple hP₁L₁ hv₁_mid hl₂ he₂ hv₃_P₁ + · -- Case 2: `v₂` is not drawn in the wall. + -- Then `e₁` must also be external (otherwise `v₂` would lie in `closure wallDisc` and hence in + -- `wall`). + have he₁ : IsExternalEdge P_pres e₁ := by + rcases hreg.edge_trichotomy e₁ hl₁.edge_mem with he₁_int | he₁_ext | he₁_wall + · exfalso + exact hv₂_wall + (mem_wall_of_inc_internal_of_inc_external he₁_int ⟨v₃, hl₁⟩ he₃ ⟨v₁, hl₃.symm⟩) + · exact he₁_ext + · exfalso + have hv₂_cl : graphDrawingVertexSet P_pres.Γ v₂ ⊆ closure (wallDisc P_pres) := + (graphDrawingVertexSet_subset_closure_edge P_pres.Γ hl₁).trans + (closure_mono (he₁_wall.2.trans (wall_subset_wallDisc hreg))) + exact hv₂_wall (mem_wall_of_mem_closure_wallDisc_of_inc_external hv₂_cl he₃ ⟨v₁, hl₃.symm⟩) + -- Since `e₂` is internal and `e₁` is external, `v₃` is drawn in the wall. + have hv₃_wall : graphDrawingVertexSet P_pres.Γ v₃ ⊆ wall P_pres := + mem_wall_of_inc_internal_of_inc_external he₂ ⟨v₁, hl₂.symm⟩ he₁ ⟨v₂, hl₁.symm⟩ + -- Also `v₂ ∉ ΩBar₀` since `v₂` is not drawn in the wall. + have hv₂_not_bar₀ : v₂ ∉ N.Ω₀.bar := by + intro hv₂_bar₀ + have hv₂_bd₀ : graphDrawingVertexSet P_pres.Γ v₂ ⊆ subBd P_pres.Δ₀ := + (P_pres.mem_bd_Δ₀_iff v₂ hl₃.right_mem).mpr hv₂_bar₀ + have hv₂_cl : graphDrawingVertexSet P_pres.Γ v₂ ⊆ closure (wallDisc P_pres) := + hv₂_bd₀.trans (inter_subset_left.trans (closure_mono subset_union_left)) + exact hv₂_wall (mem_wall_of_mem_closure_wallDisc_of_inc_external hv₂_cl he₃ ⟨v₁, hl₃.symm⟩) + -- Consider the 2-edge path `T \ e₂` formed by `e₃` and `e₁`; not both `v₁, v₃` are in `ΩBar₀`. + obtain ⟨hP_path, _, hVP_diff, hEP, hP_card⟩ := + isGraphPathWithEnds_two_edges hl₃ hl₁ hv₁₂ hv₂₃ hv₁₃ + have hnot_both : ¬ (v₁ ∈ N.Ω₀.bar ∧ v₃ ∈ N.Ω₀.bar) := by + rintro ⟨hv₁_bar, hv₃_bar⟩ + have hdisj : Disjoint (V(subgraphUnion N.G (singleEdgeSubgraph N.G e₃) + (singleEdgeSubgraph N.G e₁)) \ {v₁, v₃}) + N.Ω₀.bar := by + rw [hVP_diff, disjoint_singleton_left] + exact hv₂_not_bar₀ + have he₃_in : e₃ ∈ E(subgraphUnion N.G (singleEdgeSubgraph N.G e₃) + (singleEdgeSubgraph N.G e₁)) := by + rw [hEP] + exact mem_insert e₃ {e₁} + exact short_path_not_isExternalEdge hreg hP_path hv₁₃ hv₁_bar hv₃_bar hdisj hP_card he₃_in he₃ + by_cases hv₁_bar₀ : v₁ ∈ N.Ω₀.bar + · -- `v₃ ∉ ΩBar₀`, so `v₃` is the middle vertex of a prominence `P₃`. + have hv₃_not_bar₀ : v₃ ∉ N.Ω₀.bar := fun hv₃_bar₀ => hnot_both ⟨hv₁_bar₀, hv₃_bar₀⟩ + obtain ⟨P₃, ⟨L₃, hP₃L₃⟩, hv₃_mid⟩ := + exists_prominence_middle_of_mem_wall_of_not_mem_bar₀ hreg hl₂.right_mem hv₃_wall + hv₃_not_bar₀ + have he₂_L₃ : graphDrawingEdgeSet P_pres.Γ e₂ ⊆ L₃ := + hreg.internal_edge_subset_lawn_of_middle hP₃L₃ hv₃_mid he₂ ⟨v₁, hl₂.symm⟩ + have hv₁_L₃ : graphDrawingVertexSet P_pres.Γ v₁ ⊆ L₃ := + (graphDrawingVertexSet_subset_closure_edge P_pres.Γ hl₂).trans + ((closure_mono he₂_L₃).trans (isClosed_of_isClosedDisc hP₃L₃.1.2.1).closure_eq.subset) + obtain ⟨a₃, b₃, hP₃_path, _, _, _, _⟩ := hP₃L₃.1.1 + have hv₁_P₃ : v₁ ∈ V(P₃) := + mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU P_pres.Γ hP₃_path.le hl₂.left_mem + ((subset_inter hv₁_L₃ hv₁_wall).trans (hreg.prominence_U_subset_wall hP₃L₃).2) + exact false_of_prominence_middle_internal_link hreg hsimple hP₃L₃ hv₃_mid hl₂.symm he₂ hv₁_P₃ + · -- `v₁ ∉ ΩBar₀`, so `v₁` is the middle vertex of a prominence `P₁`. + obtain ⟨P₁, ⟨L₁, hP₁L₁⟩, hv₁_mid⟩ := + exists_prominence_middle_of_mem_wall_of_not_mem_bar₀ hreg hl₂.left_mem hv₁_wall hv₁_bar₀ + have he₂_L₁ : graphDrawingEdgeSet P_pres.Γ e₂ ⊆ L₁ := + hreg.internal_edge_subset_lawn_of_middle hP₁L₁ hv₁_mid he₂ ⟨v₃, hl₂⟩ + have hv₃_L₁ : graphDrawingVertexSet P_pres.Γ v₃ ⊆ L₁ := + (graphDrawingVertexSet_subset_closure_edge P_pres.Γ hl₂.symm).trans + ((closure_mono he₂_L₁).trans (isClosed_of_isClosedDisc hP₁L₁.1.2.1).closure_eq.subset) + obtain ⟨a₁, b₁, hP₁_path, _, _, _, _⟩ := hP₁L₁.1.1 + have hv₃_P₁ : v₃ ∈ V(P₁) := + mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU P_pres.Γ hP₁_path.le hl₂.right_mem + ((subset_inter hv₃_L₁ hv₃_wall).trans (hreg.prominence_U_subset_wall hP₁L₁).2) + exact false_of_prominence_middle_internal_link hreg hsimple hP₁L₁ hv₁_mid hl₂ he₂ hv₃_P₁ + +/-! ## Proof of (11.4) -/ + +/-- If `(G₁, G₂)` is a separation of `G` and `W` is a simple walk in `G` from `a` to `b` with no +internal vertex in `V(G₁) ∩ V(G₂)`, then `W` lies entirely in `G₁` or entirely in `G₂`. -/ +private theorem walk_subset_or_subset_of_isGraphSeparation {G G₁ G₂ : Graph α β} + (hsep : IsGraphSeparation G G₁ G₂) {a b : α} (W : GraphWalk G a b) (hW : W.IsSimple) + (hint : ∀ z ∈ W.support, z ≠ a → z ≠ b → z ∉ V(G₁) ∩ V(G₂)) : + ((∀ v ∈ W.support, v ∈ V(G₁)) ∧ (∀ e ∈ W.edges, e ∈ E(G₁))) ∨ + ((∀ v ∈ W.support, v ∈ V(G₂)) ∧ (∀ e ∈ W.edges, e ∈ E(G₂))) := by + induction W with + | @nil u hu => + have hu_union : u ∈ V(G₁) ∪ V(G₂) := by + rw [hsep.2.2.1] + exact hu + rcases hu_union with hu₁ | hu₂ + · left + exact ⟨by intro v hv; simp only [GraphWalk.support_nil, List.mem_singleton] at hv; exact hv ▸ + hu₁, + by simp⟩ + · right + exact ⟨by intro v hv; simp only [GraphWalk.support_nil, List.mem_singleton] at hv; exact hv ▸ + hu₂, + by simp⟩ + | @cons u w b e hl W' ih => + cases W' with + | nil _ => + have he_union : e ∈ E(G₁) ∪ E(G₂) := by + rw [hsep.2.2.2.1] + exact hl.edge_mem + rcases he_union with he₁ | he₂ + · left + have hl₁ : G₁.IsLink e u w := (hsep.1.isLink_iff he₁).mpr hl + refine ⟨?_, ?_⟩ + · intro v hv + simp only [GraphWalk.support_cons, GraphWalk.support_nil, List.mem_cons, + List.not_mem_nil, or_false] at hv + rcases hv with rfl | rfl + · exact hl₁.left_mem + · exact hl₁.right_mem + · intro f hf + simp only [GraphWalk.edges_cons, GraphWalk.edges_nil, List.mem_singleton] at hf + exact hf ▸ he₁ + · right + have hl₂ : G₂.IsLink e u w := (hsep.2.1.isLink_iff he₂).mpr hl + refine ⟨?_, ?_⟩ + · intro v hv + simp only [GraphWalk.support_cons, GraphWalk.support_nil, List.mem_cons, + List.not_mem_nil, or_false] at hv + rcases hv with rfl | rfl + · exact hl₂.left_mem + · exact hl₂.right_mem + · intro f hf + simp only [GraphWalk.edges_cons, GraphWalk.edges_nil, List.mem_singleton] at hf + exact hf ▸ he₂ + | @cons _ u' _ e' hl' W'' => + have hnd : (u :: w :: W''.support).Nodup := hW + obtain ⟨hu_not, hW'⟩ := List.nodup_cons.mp hnd + obtain ⟨hw_not_W'', _⟩ := List.nodup_cons.mp hW' + have hwu : w ≠ u := fun h => hu_not (h ▸ List.mem_cons_self) + have hwb : w ≠ b := fun h => hw_not_W'' (h ▸ W''.end_mem_support) + have hw_not_inter : w ∉ V(G₁) ∩ V(G₂) := + hint w (List.mem_cons_of_mem u List.mem_cons_self) hwu hwb + have hint' : ∀ z ∈ (GraphWalk.cons hl' W'').support, z ≠ w → z ≠ b → z ∉ V(G₁) ∩ V(G₂) := by + intro z hz hzw hzb + exact hint z (List.mem_cons_of_mem u hz) (fun hzu => hu_not (hzu ▸ hz)) hzb + rcases ih hW' hint' with ⟨hV₁, hE₁⟩ | ⟨hV₂, hE₂⟩ + · left + have hw₁ : w ∈ V(G₁) := hV₁ w List.mem_cons_self + have hw_not_₂ : w ∉ V(G₂) := fun hw₂ => hw_not_inter ⟨hw₁, hw₂⟩ + have he₁ : e ∈ E(G₁) := by + have he_union : e ∈ E(G₁) ∪ E(G₂) := by rw [hsep.2.2.2.1]; exact hl.edge_mem + rcases he_union with he₁ | he₂ + · exact he₁ + · exact (hw_not_₂ ((hsep.2.1.isLink_iff he₂).mpr hl).right_mem).elim + have hu₁ : u ∈ V(G₁) := ((hsep.1.isLink_iff he₁).mpr hl).left_mem + refine ⟨?_, ?_⟩ + · intro v hv + rcases List.mem_cons.mp hv with rfl | hv' + · exact hu₁ + · exact hV₁ v hv' + · intro f hf + rcases List.mem_cons.mp hf with rfl | hf' + · exact he₁ + · exact hE₁ f hf' + · right + have hw₂ : w ∈ V(G₂) := hV₂ w List.mem_cons_self + have hw_not_₁ : w ∉ V(G₁) := fun hw₁ => hw_not_inter ⟨hw₁, hw₂⟩ + have he₂ : e ∈ E(G₂) := by + have he_union : e ∈ E(G₁) ∪ E(G₂) := by rw [hsep.2.2.2.1]; exact hl.edge_mem + rcases he_union with he₁ | he₂ + · exact (hw_not_₁ ((hsep.1.isLink_iff he₁).mpr hl).right_mem).elim + · exact he₂ + have hu₂ : u ∈ V(G₂) := ((hsep.2.1.isLink_iff he₂).mpr hl).left_mem + refine ⟨?_, ?_⟩ + · intro v hv + rcases List.mem_cons.mp hv with rfl | hv' + · exact hu₂ + · exact hV₂ v hv' + · intro f hf + rcases List.mem_cons.mp hf with rfl | hf' + · exact he₂ + · exact hE₂ f hf' + +/-- If `(G₁, G₂)` is a separation of `G` and `P` is a path in `G` with ends `x, y` and no internal +vertex in `V(G₁) ∩ V(G₂)`, then `P ≤ G₁` or `P ≤ G₂`. -/ +theorem le_or_le_of_isGraphPathWithEnds {G G₁ G₂ P : Graph α β} + (hsep : IsGraphSeparation G G₁ G₂) {x y : α} (hP : IsGraphPathWithEnds G P x y) + (hdisj : Disjoint (V(P) \ {x, y}) (V(G₁) ∩ V(G₂))) : + P ≤ G₁ ∨ P ≤ G₂ := by + rcases hP with ⟨hPG, W, hW, hVP, hEP⟩ + obtain ⟨W_G, hs, he⟩ := exists_walk_up_of_le hPG W + have hW_G : W_G.IsSimple := by unfold GraphWalk.IsSimple; rw [hs]; exact hW + have hint : ∀ z ∈ W_G.support, z ≠ x → z ≠ y → z ∉ V(G₁) ∩ V(G₂) := by + intro z hz hzx hzy + rw [hs] at hz + have hzP : z ∈ V(P) \ {x, y} := by + rw [hVP] + exact ⟨hz, by simp [hzx, hzy]⟩ + exact disjoint_left.mp hdisj hzP + rcases walk_subset_or_subset_of_isGraphSeparation hsep W_G hW_G hint with ⟨hV₁, hE₁⟩ | ⟨hV₂, hE₂⟩ + · left + rw [(Compatible.of_le_le hPG hsep.1).le_iff, hVP, hEP] + exact ⟨fun v hv => hV₁ v (hs.symm ▸ hv), fun f hf => hE₁ f (he.symm ▸ hf)⟩ + · right + rw [(Compatible.of_le_le hPG hsep.2.1).le_iff, hVP, hEP] + exact ⟨fun v hv => hV₂ v (hs.symm ▸ hv), fun f hf => hE₂ f (he.symm ▸ hf)⟩ + +/-- **Graph Minors IX, (11.4)** (pages 68–69): +"If $(G_0 \cup G^*, \Omega^*)$ is the composition of a park $(G^*, \Omega^*, \Omega_0)$ with +a society $(G_0, \Omega_0)$, and $(G_0, \Omega_0)$ has no transaction of cardinality $> p$, +then $(G_0 \cup G^*, \Omega^*)$ has no transaction of cardinality $> p + 2$." -/ +theorem theorem_11_4_proof {S S₀ : Society α β} {N_star : Neighborhood α β} {p : ℕ} + (hpark : N_star.IsRegularPark) + (hcomp : S.IsComposition S₀ N_star) + (hno : ∀ Q_set : Set (Graph α β), S₀.IsTransaction Q_set → Q_set.ncard ≤ p) + {P_set : Set (Graph α β)} (hP_set : S.IsTransaction P_set) : + P_set.ncard ≤ p + 2 := by + obtain ⟨N, P_pres, hreg⟩ := hpark + obtain ⟨⟨hsep, hbar_sub⟩, hΩ_eq, hΩ₀_eq, hbar₀_inter⟩ := hcomp + obtain ⟨A_star, B_star, hdisj_P_set, hfence_star, hends_P_set⟩ := hP_set + have hfence_star' : N_star.Ω.IsFence A_star B_star := hΩ_eq.symm ▸ hfence_star + obtain ⟨A, B, Z, hfence₀, hZ_sub, hZ_card, hA_sub, hB_sub, hlawn⟩ := + hreg.exists_fence_and_Z hfence_star' + have hfence_S₀ : S₀.Ω.IsFence A B := hΩ₀_eq ▸ hfence₀ + have hAB_disj : Disjoint (A ∪ A_star) (B ∪ B_star) := by + rw [disjoint_union_left, disjoint_union_right, disjoint_union_right] + refine ⟨⟨hfence₀.2.2.1, ?_⟩, ⟨?_, hfence_star.2.2.1⟩⟩ + · rw [disjoint_left] + intro z hzA hzB_star + exact disjoint_left.mp hfence₀.2.2.1 hzA (hB_sub ⟨hzB_star, hfence₀.1 hzA⟩) + · rw [disjoint_left] + intro z hzA_star hzB + exact disjoint_left.mp hfence₀.2.2.1 (hA_sub ⟨hzA_star, hfence₀.2.1 hzB⟩) hzB + -- Prove the paper's subpath claim: every path `P` of `S.G` from `A ∪ A*` to `B ∪ B*` avoiding `Z` + -- contains a subpath `P' ≤ P` in `G₀` from `A` to `B`. + have hclaim : ∀ P : Graph α β, ∀ u ∈ A ∪ A_star, ∀ v ∈ B ∪ B_star, + IsGraphPathWithEnds S.G P u v → Disjoint V(P) Z → + ∃ P' ≤ P, ∃ x ∈ A, ∃ y ∈ B, S₀.IsOmegaPathWithEnds P' x y := by + intro P u hu v hv hP hPZ + obtain ⟨x, hx, y, hy, P', hP'P, hP'_ft, hx_inter, hy_inter⟩ := + hP.exists_isFromToPathWithEnds hu hv + have hxy : x ≠ y := fun h => disjoint_left.mp hAB_disj hx (h ▸ hy) + have hP'Z : Disjoint V(P') Z := Disjoint.mono_left hP'P.vertexSet_mono hPZ + -- No internal vertex of `P'` is in `A ∪ A* ∪ B ∪ B* = ΩBar₀ ∪ ΩBar*`. + have hdisj_int_all : Disjoint (V(P') \ {x, y}) (N_star.Ω₀.bar ∪ N_star.Ω.bar) := by + rw [disjoint_left] + rintro z ⟨hzP', hzx⟩ (hz_bar₀ | hz_bar) + · rw [← hfence₀.2.2.2.1] at hz_bar₀ + rcases hz_bar₀ with hzA | hzB + · have hz_eq : z = x := by + have hz_in : z ∈ V(P') ∩ (A ∪ A_star) := ⟨hzP', Or.inl hzA⟩ + rwa [hx_inter, mem_singleton_iff] at hz_in + exact hzx (Or.inl hz_eq) + · have hz_eq : z = y := by + have hz_in : z ∈ V(P') ∩ (B ∪ B_star) := ⟨hzP', Or.inl hzB⟩ + rwa [hy_inter, mem_singleton_iff] at hz_in + exact hzx (Or.inr hz_eq) + · rw [← hfence_star'.2.2.2.1] at hz_bar + rcases hz_bar with hzA_star | hzB_star + · have hz_eq : z = x := by + have hz_in : z ∈ V(P') ∩ (A ∪ A_star) := ⟨hzP', Or.inr hzA_star⟩ + rwa [hx_inter, mem_singleton_iff] at hz_in + exact hzx (Or.inl hz_eq) + · have hz_eq : z = y := by + have hz_in : z ∈ V(P') ∩ (B ∪ B_star) := ⟨hzP', Or.inr hzB_star⟩ + rwa [hy_inter, mem_singleton_iff] at hz_in + exact hzx (Or.inr hz_eq) + have hdisj_int_inter : Disjoint (V(P') \ {x, y}) (V(S₀.G) ∩ V(N_star.G)) := by + rw [← hbar₀_inter, ← hΩ₀_eq] + exact hdisj_int_all.mono_right subset_union_left + rcases le_or_le_of_isGraphPathWithEnds hsep hP'_ft hdisj_int_inter with hP'_G₀ | hP'_star + · -- `P' ≤ S₀.G`: its ends `x, y` lie in `A` and `B`. + have hx_G₀ : x ∈ V(S₀.G) := hP'_G₀.vertexSet_mono hP'_ft.left_mem + have hy_G₀ : y ∈ V(S₀.G) := hP'_G₀.vertexSet_mono hP'_ft.right_mem + have hx_A : x ∈ A := by + rcases hx with hxA | hxA_star + · exact hxA + · apply hA_sub + refine ⟨hxA_star, ?_⟩ + rw [hΩ₀_eq, hbar₀_inter] + exact ⟨hx_G₀, hbar_sub (hfence_star.1 hxA_star)⟩ + have hy_B : y ∈ B := by + rcases hy with hyB | hyB_star + · exact hyB + · apply hB_sub + refine ⟨hyB_star, ?_⟩ + rw [hΩ₀_eq, hbar₀_inter] + exact ⟨hy_G₀, hbar_sub (hfence_star.2.1 hyB_star)⟩ + exact ⟨P', hP'P, x, hx_A, y, hy_B, hP'_ft.of_le hP'_G₀, hxy, + hfence_S₀.1 hx_A, hfence_S₀.2.1 hy_B⟩ + · -- `P' ≤ N_star.G`: `P'` is drawn in some lawn `L`, contradicting (iii). + exfalso + have hx_bars : x ∈ N_star.Ω₀.bar ∪ N_star.Ω.bar := by + rcases hx with hxA | hxA_star + · exact Or.inl (hfence₀.1 hxA) + · exact Or.inr (hfence_star'.1 hxA_star) + have hy_bars : y ∈ N_star.Ω₀.bar ∪ N_star.Ω.bar := by + rcases hy with hyB | hyB_star + · exact Or.inl (hfence₀.2.1 hyB) + · exact Or.inr (hfence_star'.2.1 hyB_star) + obtain ⟨L, hL, hx_bdL, hy_bdL⟩ := + hreg.exists_lawn_of_park_path (hP'_ft.of_le hP'_star) hxy hx_bars hy_bars hdisj_int_all + have hx_Vstar : x ∈ V(N_star.G) := hP'_star.vertexSet_mono hP'_ft.left_mem + have hy_Vstar : y ∈ V(N_star.G) := hP'_star.vertexSet_mono hP'_ft.right_mem + have hx_not_Z : x ∉ Z := disjoint_left.mp hP'Z hP'_ft.left_mem + have hy_not_Z : y ∉ Z := disjoint_left.mp hP'Z hP'_ft.right_mem + rcases hlawn L hL with hL_A | hL_B + · have hy_in : y ∈ A ∪ A_star ∪ Z := hL_A ⟨hy_Vstar, hy_bdL⟩ + rcases hy_in with hy_AA | hy_Z + · exact disjoint_left.mp hAB_disj hy_AA hy + · exact hy_not_Z hy_Z + · have hx_in : x ∈ B ∪ B_star ∪ Z := hL_B ⟨hx_Vstar, hx_bdL⟩ + rcases hx_in with hx_BB | hx_Z + · exact disjoint_left.mp hAB_disj hx hx_BB + · exact hx_not_Z hx_Z + -- Restrict `P_set` to `P_set₀ := {P ∈ P_set | Disjoint V(P) Z}`. + let P_set₀ : Set (Graph α β) := {P ∈ P_set | Disjoint V(P) Z} + let P_hit : Set (Graph α β) := {P ∈ P_set | ¬ Disjoint V(P) Z} + have hZ_fin : Z.Finite := N_star.Ω₀.finite_bar.subset hZ_sub + -- `P_hit.ncard ≤ Z.ncard ≤ 2` since members of `P_set` are pairwise vertex-disjoint. + have hhit_le : P_hit.ncard ≤ Z.ncard := by + rcases P_hit.eq_empty_or_nonempty with h_empty | ⟨P₀, hP₀⟩ + · rw [h_empty, ncard_empty] + exact Nat.zero_le _ + · have hex_z : ∀ P : P_hit, ∃ z ∈ Z, z ∈ V(P.1) := by + rintro ⟨P, _, hnot_disj⟩ + obtain ⟨z, hzP, hzZ⟩ := not_disjoint_iff.mp hnot_disj + exact ⟨z, hzZ, hzP⟩ + choose z_of hz_Z hz_V using hex_z + classical + let g : Graph α β → α := fun P => if h : P ∈ P_hit then z_of ⟨P, h⟩ else z_of ⟨P₀, hP₀⟩ + have hmaps : MapsTo g P_hit Z := by + intro P hP + simp only [g, hP, ↓reduceDIte] + exact hz_Z ⟨P, hP⟩ + have hinj : InjOn g P_hit := by + intro P₁ hP₁ P₂ hP₂ heq + simp only [g, hP₁, hP₂, ↓reduceDIte] at heq + by_contra hne + have hdisj₁₂ := hdisj_P_set.2 hP₁.1 hP₂.1 hne + exact disjoint_left.mp hdisj₁₂ (hz_V ⟨P₁, hP₁⟩) (heq ▸ hz_V ⟨P₂, hP₂⟩) + exact ncard_le_ncard_of_injOn g hmaps hinj hZ_fin + -- For each `P ∈ P_set₀`, choose a subpath `P' ≤ P` in `G₀` from `A` to `B`. + have hex_sub : ∀ P : P_set₀, ∃ P' ≤ P.1, ∃ x ∈ A, ∃ y ∈ B, S₀.IsOmegaPathWithEnds P' x y := by + rintro ⟨P, hP_in, hPZ⟩ + obtain ⟨u, huA, v, hvB, hP_omega⟩ := hends_P_set P hP_in + exact hclaim P u (Or.inr huA) v (Or.inr hvB) hP_omega.1 hPZ + choose sub_of hsub_le x_of hx_A y_of hy_B hsub_omega using hex_sub + classical + let φ : Graph α β → Graph α β := fun P => if h : P ∈ P_set₀ then sub_of ⟨P, h⟩ else P + let P_set' : Set (Graph α β) := φ '' P_set₀ + have hφ_inj : InjOn φ P_set₀ := by + intro P₁ hP₁ P₂ hP₂ heq + simp only [φ, hP₁, hP₂, ↓reduceDIte] at heq + by_contra hne + have hdisj₁₂ := hdisj_P_set.2 hP₁.1 hP₂.1 hne + have hx₁ : x_of ⟨P₁, hP₁⟩ ∈ V(P₁) := + (hsub_le ⟨P₁, hP₁⟩).vertexSet_mono (hsub_omega ⟨P₁, hP₁⟩).1.left_mem + have hx₂ : x_of ⟨P₁, hP₁⟩ ∈ V(P₂) := by + have hmem : x_of ⟨P₁, hP₁⟩ ∈ V(sub_of ⟨P₂, hP₂⟩) := + heq ▸ (hsub_omega ⟨P₁, hP₁⟩).1.left_mem + exact (hsub_le ⟨P₂, hP₂⟩).vertexSet_mono hmem + exact disjoint_left.mp hdisj₁₂ hx₁ hx₂ + have hP_set'_trans : S₀.IsTransaction P_set' := by + refine ⟨A, B, ⟨?_, ?_⟩, hfence_S₀, ?_⟩ + · rintro Q ⟨P, hP, rfl⟩ + simp only [φ, hP, ↓reduceDIte] + exact ⟨x_of ⟨P, hP⟩, y_of ⟨P, hP⟩, hsub_omega ⟨P, hP⟩⟩ + · rintro Q₁ ⟨P₁, hP₁, rfl⟩ Q₂ ⟨P₂, hP₂, rfl⟩ hne + have hP₁₂ : P₁ ≠ P₂ := fun h => hne (congrArg φ h) + have hdisj₁₂ := hdisj_P_set.2 hP₁.1 hP₂.1 hP₁₂ + simp only [φ, hP₁, hP₂, ↓reduceDIte] + exact Disjoint.mono (hsub_le ⟨P₁, hP₁⟩).vertexSet_mono (hsub_le ⟨P₂, + hP₂⟩).vertexSet_mono hdisj₁₂ + · rintro Q ⟨P, hP, rfl⟩ + simp only [φ, hP, ↓reduceDIte] + exact ⟨x_of ⟨P, hP⟩, hx_A ⟨P, hP⟩, y_of ⟨P, hP⟩, hy_B ⟨P, hP⟩, hsub_omega ⟨P, hP⟩⟩ + have hcard_P_set₀ : P_set₀.ncard ≤ p := by + rw [← hφ_inj.ncard_image] + exact hno P_set' hP_set'_trans + have hP_union : P_set = P_set₀ ∪ P_hit := by + ext P + simp only [P_set₀, P_hit, mem_union, mem_sep_iff] + exact ⟨fun h => by by_cases hd : Disjoint V(P) Z; exacts [Or.inl ⟨h, hd⟩, Or.inr ⟨h, hd⟩], + by rintro (⟨h, _⟩ | ⟨h, _⟩) <;> exact h⟩ + calc + P_set.ncard = (P_set₀ ∪ P_hit).ncard := by rw [← hP_union] + _ ≤ P_set₀.ncard + P_hit.ncard := ncard_union_le P_set₀ P_hit + _ ≤ p + 2 := Nat.add_le_add hcard_P_set₀ (hhit_le.trans hZ_card) + +/-! ## Outer park neighborhood and Proof of (11.5) -/ + +/-- The vertices of `N.G` drawn in the wall or in the complement in `Δ` of `wallDisc P_pres` +(Graph Minors IX, Section 11, page 69). -/ +def outerParkVerts {N : Neighborhood α β} (P_pres : Presentation N) : Set α := + {v ∈ V(N.G) | graphDrawingVertexSet P_pres.Γ v ⊆ wall P_pres ∪ (P_pres.Δ \ wallDisc P_pres)} + +/-- The wall edges and external edges of `N.G` with respect to `P_pres` +(Graph Minors IX, Section 11, page 69). -/ +def outerParkEdges {N : Neighborhood α β} (P_pres : Presentation N) : Set β := + {e ∈ E(N.G) | IsWallEdge P_pres e ∨ IsExternalEdge P_pres e} + +/-- The subgraph `G₂` of `N.G` consisting of `outerParkVerts P_pres` and `outerParkEdges P_pres` +(Graph Minors IX, Section 11, page 69). -/ +def outerParkGraph {N : Neighborhood α β} (P_pres : Presentation N) : Graph α β := + (N.G.induce (outerParkVerts P_pres)).restrict (outerParkEdges P_pres) + +@[simp] +theorem vertexSet_outerParkGraph {N : Neighborhood α β} (P_pres : Presentation N) : + V(outerParkGraph P_pres) = outerParkVerts P_pres := rfl + +theorem outerParkGraph_le {N : Neighborhood α β} (P_pres : Presentation N) : + outerParkGraph P_pres ≤ N.G := + restrict_le.trans (N.G.induce_le fun _ hv => hv.1) + +theorem mem_outerParkVerts_of_inc_outerParkEdges {N : Neighborhood α β} (P_pres : Presentation N) + {e : β} (he : e ∈ outerParkEdges P_pres) {u : α} (hinc : N.G.Inc e u) : + u ∈ outerParkVerts P_pres := by + refine ⟨hinc.vertex_mem, ?_⟩ + obtain ⟨v, hl⟩ := hinc + rcases he.2 with he_wall | he_ext + · have hu_wall : graphDrawingVertexSet P_pres.Γ u ⊆ wall P_pres := + (graphDrawingVertexSet_subset_closure_edge P_pres.Γ hl).trans + ((closure_mono he_wall.2).trans (isClosed_subBd _).closure_eq.subset) + exact hu_wall.trans subset_union_left + · intro x hx + have hx_cl : x ∈ closure (P_pres.Δ \ wallDisc P_pres) := + (graphDrawingVertexSet_subset_closure_edge P_pres.Γ hl).trans (closure_mono he_ext.2) hx + have hx_Δ : x ∈ P_pres.Δ := by + have hcl_Δ : closure (P_pres.Δ \ wallDisc P_pres) ⊆ P_pres.Δ := + (closure_mono sdiff_subset).trans (isClosed_of_isClosedDisc + P_pres.isClosedDisc_Δ).closure_eq.subset + exact hcl_Δ hx_cl + by_cases hx_wd : x ∈ wallDisc P_pres + · left + have hsub_compl : P_pres.Δ \ wallDisc P_pres ⊆ Set.univ \ wallDisc P_pres := + fun _ hy => ⟨trivial, hy.2⟩ + exact ⟨subset_closure hx_wd, closure_mono hsub_compl hx_cl⟩ + · right + exact ⟨hx_Δ, hx_wd⟩ + +@[simp] +theorem edgeSet_outerParkGraph {N : Neighborhood α β} (P_pres : Presentation N) : + E(outerParkGraph P_pres) = outerParkEdges P_pres := by + unfold outerParkGraph + rw [edgeSet_restrict, inter_eq_right] + intro e he + obtain ⟨u, v, hl⟩ := N.G.exists_isLink_of_mem_edgeSet he.1 + exact ⟨u, v, hl, mem_outerParkVerts_of_inc_outerParkEdges P_pres he ⟨v, hl⟩, + mem_outerParkVerts_of_inc_outerParkEdges P_pres he ⟨u, hl.symm⟩⟩ + +theorem bar_subset_outerParkVerts {N : Neighborhood α β} (P_pres : Presentation N) : + N.Ω.bar ⊆ outerParkVerts P_pres := by + intro v hv_bar + have hvG : v ∈ V(N.G) := N.bar_subset hv_bar + refine ⟨hvG, ?_⟩ + have hv_bd : graphDrawingVertexSet P_pres.Γ v ⊆ subBd P_pres.Δ := + (P_pres.mem_bd_Δ_iff v hvG).mpr hv_bar + intro x hx + have hx_bd : x ∈ subBd P_pres.Δ := hv_bd hx + have hx_Δ : x ∈ P_pres.Δ := subBd_subset_of_isClosed (isClosed_of_isClosedDisc + P_pres.isClosedDisc_Δ) hx_bd + by_cases hx_wd : x ∈ wallDisc P_pres + · left + have hcompl : Set.univ \ P_pres.Δ ⊆ Set.univ \ wallDisc P_pres := + sdiff_subset_sdiff_right (wallDisc_subset_Δ P_pres) + exact ⟨subset_closure hx_wd, closure_mono hcompl hx_bd.2⟩ + · right + exact ⟨hx_Δ, hx_wd⟩ + +/-- The outer neighborhood `(G₂, Ω, Ω*)` of `N` with respect to a park `N_star` under `P_pres` +(Graph Minors IX, Section 11, page 69). -/ +def outerParkNeighborhood {N N_star : Neighborhood α β} (P_pres : Presentation N) + (hpark : IsParkOf P_pres N_star) : Neighborhood α β where + G := outerParkGraph P_pres + Ω := N.Ω + Ω₀ := N_star.Ω + finite_V := N.finite_V.subset (outerParkGraph_le P_pres).vertexSet_mono + finite_E := N.finite_E.subset (outerParkGraph_le P_pres).edgeSet_mono + bar_subset := bar_subset_outerParkVerts P_pres + bar₀_subset := by + rw [vertexSet_outerParkGraph, hpark.2.2.2.2.2.1] + intro v hv + exact ⟨hv.1, hv.2.trans subset_union_left⟩ + +/-- Any short path (`≤ 2` edges) of `N.G` with distinct ends in `ΩBar₀` and no internal vertex in +`ΩBar₀` is a subgraph of the park `N_star.G`. -/ +private theorem short_path_le_park {N N_star : Neighborhood α β} {P_pres : Presentation N} + (hreg : IsRegularPresentation P_pres) (hpark : IsParkOf P_pres N_star) + {P : Graph α β} {a b : α} (hP : IsGraphPathWithEnds N.G P a b) + (hab : a ≠ b) (ha : a ∈ N.Ω₀.bar) (hb : b ∈ N.Ω₀.bar) + (hdisj : Disjoint (V(P) \ {a, b}) N.Ω₀.bar) (hcard : E(P).ncard ≤ 2) : + P ≤ N_star.G := by + have hU_sub := short_path_U_subset_wallDisc hreg hP hab ha hb hdisj hcard + rw [(Compatible.of_le_le hP.le hpark.2.2.2.2.1).le_iff, hpark.2.2.1, hpark.2.2.2.1] + refine ⟨fun v hv => ⟨hP.le.vertexSet_mono hv, ?_⟩, fun e he => ⟨hP.le.edgeSet_mono he, ?_⟩⟩ + · exact (graphDrawingVertexSet_subset_subgraphU_of_mem P_pres.Γ hv).trans hU_sub + · exact (graphDrawingEdgeSet_subset_subgraphU_of_mem P_pres.Γ he).trans hU_sub + +private theorem triangle_in_park_or_exterior (S : Society α β) (hsimple : IsSimpleGraph S.G) + {H₁ : Society α β} {H₂ : Neighborhood α β} (composition : S.IsComposition H₁ H₂) + {P_pres : Presentation H₂} {N_star : Neighborhood α β} + (hreg : IsRegularPresentation P_pres) (hpark : IsParkOf P_pres N_star) + {G₁ : Graph α β} (hG₁_le_G : G₁ ≤ S.G) (hH₁_le_G₁ : H₁.G ≤ G₁) + (hGstar_le_G₁ : N_star.G ≤ G₁) : + let N₂ := outerParkNeighborhood P_pres hpark + ∀ T : Graph α β, IsTriangle S.G T → T ≤ G₁ ∨ T ≤ N₂.G := by + intro N₂ + obtain ⟨⟨hsep_H, _⟩, _, hΩ₀_H₂, hbar₀_inter⟩ := composition + have hsimple_H₂ : IsSimpleGraph H₂.G := hsimple.mono hsep_H.2.1 + have hN₂_le_G : N₂.G ≤ S.G := (outerParkGraph_le P_pres).trans hsep_H.2.1 + intro T hT + obtain ⟨v₁, v₂, v₃, e₁, e₂, e₃, hv₁₂, hv₂₃, hv₁₃, _, _, _, hVT, hET, hl₁T, hl₂T, hl₃T⟩ := + hT.exists_verts_and_edges + -- Every vertex of `T` is incident with an edge of `T`. + have hV_of_E : ∀ H : Graph α β, H ≤ S.G → E(T) ⊆ E(H) → T ≤ H := by + intro H hHG hEH + rw [(Compatible.of_le_le hT.1.1 hHG).le_iff] + refine ⟨?_, hEH⟩ + rw [hVT] + have hl₁H : H.IsLink e₁ v₂ v₃ := (hHG.isLink_iff (hEH (by rw [hET]; simp))).mpr + (hl₁T.mono hT.1.1) + have hl₂H : H.IsLink e₂ v₁ v₃ := (hHG.isLink_iff (hEH (by rw [hET]; simp))).mpr + (hl₂T.mono hT.1.1) + rintro v (rfl | rfl | rfl) + · exact hl₂H.left_mem + · exact hl₁H.left_mem + · exact hl₁H.right_mem + by_cases hT_H₂ : T ≤ H₂.G + · -- Case 1: `T ≤ H₂.G`. By (11.3), `T` cannot have both an internal edge and an external edge. + have hT_H₂' : IsTriangle H₂.G T := ⟨⟨hT_H₂, hT.1.2⟩, hT.2⟩ + by_cases hex_int : ∃ e ∈ E(T), IsInternalEdge P_pres e + · left + obtain ⟨interiorSeamEdge, he_int_T, he_int⟩ := hex_int + apply hV_of_E G₁ hG₁_le_G + intro e heT + have heH₂ : e ∈ E(H₂.G) := hT_H₂.edgeSet_mono heT + have he_Gstar : e ∈ E(N_star.G) := by + rw [hpark.2.2.2.1] + refine ⟨heH₂, ?_⟩ + rcases hreg.edge_trichotomy e heH₂ with h_int | h_ext | h_wall + · exact h_int.2.trans interior_subset + · exact (theorem_11_3_proof hreg hsimple_H₂ hT_H₂' he_int_T heT he_int h_ext).elim + · exact h_wall.2.trans (wall_subset_wallDisc hreg) + exact hGstar_le_G₁.edgeSet_mono he_Gstar + · right + push Not at hex_int + apply hV_of_E N₂.G hN₂_le_G + intro e heT + have heH₂ : e ∈ E(H₂.G) := hT_H₂.edgeSet_mono heT + change e ∈ E(outerParkGraph P_pres) + rw [edgeSet_outerParkGraph] + refine ⟨heH₂, ?_⟩ + rcases hreg.edge_trichotomy e heH₂ with h_int | h_ext | h_wall + · exact (hex_int e heT h_int).elim + · exact Or.inr h_ext + · exact Or.inl h_wall + · -- Case 2: `¬ (T ≤ H₂.G)`. Then some edge of `T` is in `E(H₁.G)`, and `T ≤ G₁`. + left + have hex_E₁ : ∃ e ∈ E(T), e ∈ E(H₁.G) := by + by_contra! hnot_E₁ + apply hT_H₂ + apply hV_of_E H₂.G hsep_H.2.1 + intro e heT + have he_union : e ∈ E(H₁.G) ∪ E(H₂.G) := by + rw [hsep_H.2.2.2.1] + exact hT.1.1.edgeSet_mono heT + exact he_union.resolve_left (hnot_E₁ e heT) + -- Helper: any single edge `f ∈ E(H₂.G)` with both ends in `V(H₁.G)` belongs to `E(N_star.G)`. + have hsingle_in_Gstar : ∀ f u w, H₂.G.IsLink f u w → u ∈ V(H₁.G) → w ∈ V(H₁.G) → + f ∈ E(N_star.G) := by + intro f u w hlf hu₁ hw₁ + have huw : u ≠ w := hsimple_H₂.ne_of_isLink hlf + have hu_bar₀ : u ∈ H₂.Ω₀.bar := by + rw [hΩ₀_H₂, hbar₀_inter]; exact ⟨hu₁, hlf.left_mem⟩ + have hw_bar₀ : w ∈ H₂.Ω₀.bar := by + rw [hΩ₀_H₂, hbar₀_inter]; exact ⟨hw₁, hlf.right_mem⟩ + have hP : IsGraphPathWithEnds H₂.G (singleEdgeSubgraph H₂.G f) u w := + (isGraphPathWithEnds_singleEdgeSubgraph huw hlf).mono (singleEdgeSubgraph_le H₂.G f) + have hdisj : Disjoint (V(singleEdgeSubgraph H₂.G f) \ {u, w}) H₂.Ω₀.bar := by + rw [vertexSet_singleEdgeSubgraph_eq_pair hlf, sdiff_self] + exact empty_disjoint _ + have hcard : E(singleEdgeSubgraph H₂.G f).ncard ≤ 2 := by + rw [edgeSet_singleEdgeSubgraph hlf.edge_mem]; simp + have hle_Gstar := short_path_le_park hreg hpark hP huw hu_bar₀ hw_bar₀ hdisj hcard + apply hle_Gstar.edgeSet_mono + rw [edgeSet_singleEdgeSubgraph hlf.edge_mem] + exact mem_singleton f + -- Helper: if one edge `f₃` of `T` (linking `u₁, u₂`) is in `E(H₁.G)` and the other two edges + -- `f₁` (linking `u₂, u₃`) and `f₂` (linking `u₁, u₃`) are in `E(T)`, then `f₁, f₂ ∈ E(G₁)`. + have htwo_other_edges : ∀ u₁ u₂ u₃ : α, ∀ f₁ f₂ f₃ : β, + u₁ ≠ u₂ → u₂ ≠ u₃ → u₁ ≠ u₃ → + S.G.IsLink f₁ u₂ u₃ → S.G.IsLink f₂ u₁ u₃ → S.G.IsLink f₃ u₁ u₂ → + f₃ ∈ E(H₁.G) → f₁ ∈ E(G₁) ∧ f₂ ∈ E(G₁) := by + intro u₁ u₂ u₃ f₁ f₂ f₃ hu₁₂ hu₂₃ hu₁₃ hlf₁ hlf₂ hlf₃ hf₃_H₁ + have hlf₃_H₁ : H₁.G.IsLink f₃ u₁ u₂ := (hsep_H.1.isLink_iff hf₃_H₁).mpr hlf₃ + have hu₁_H₁ : u₁ ∈ V(H₁.G) := hlf₃_H₁.left_mem + have hu₂_H₁ : u₂ ∈ V(H₁.G) := hlf₃_H₁.right_mem + have hf₁_union : f₁ ∈ E(H₁.G) ∪ E(H₂.G) := by rw [hsep_H.2.2.2.1]; exact hlf₁.edge_mem + have hf₂_union : f₂ ∈ E(H₁.G) ∪ E(H₂.G) := by rw [hsep_H.2.2.2.1]; exact hlf₂.edge_mem + rcases hf₁_union with hf₁_H₁ | hf₁_H₂ <;> rcases hf₂_union with hf₂_H₁ | hf₂_H₂ + · exact ⟨hH₁_le_G₁.edgeSet_mono hf₁_H₁, hH₁_le_G₁.edgeSet_mono hf₂_H₁⟩ + · have hu₃_H₁ : u₃ ∈ V(H₁.G) := ((hsep_H.1.isLink_iff hf₁_H₁).mpr hlf₁).right_mem + have hlf₂_H₂ : H₂.G.IsLink f₂ u₁ u₃ := (hsep_H.2.1.isLink_iff hf₂_H₂).mpr hlf₂ + exact ⟨hH₁_le_G₁.edgeSet_mono hf₁_H₁, + hGstar_le_G₁.edgeSet_mono (hsingle_in_Gstar f₂ u₁ u₃ hlf₂_H₂ hu₁_H₁ hu₃_H₁)⟩ + · have hu₃_H₁ : u₃ ∈ V(H₁.G) := ((hsep_H.1.isLink_iff hf₂_H₁).mpr hlf₂).right_mem + have hlf₁_H₂ : H₂.G.IsLink f₁ u₂ u₃ := (hsep_H.2.1.isLink_iff hf₁_H₂).mpr hlf₁ + exact ⟨hGstar_le_G₁.edgeSet_mono (hsingle_in_Gstar f₁ u₂ u₃ hlf₁_H₂ hu₂_H₁ hu₃_H₁), + hH₁_le_G₁.edgeSet_mono hf₂_H₁⟩ + · have hlf₁_H₂ : H₂.G.IsLink f₁ u₂ u₃ := (hsep_H.2.1.isLink_iff hf₁_H₂).mpr hlf₁ + have hlf₂_H₂ : H₂.G.IsLink f₂ u₁ u₃ := (hsep_H.2.1.isLink_iff hf₂_H₂).mpr hlf₂ + by_cases hu₃_bar₀ : u₃ ∈ H₂.Ω₀.bar + · have hu₃_H₁ : u₃ ∈ V(H₁.G) := by + rw [hΩ₀_H₂, hbar₀_inter] at hu₃_bar₀; exact hu₃_bar₀.1 + exact ⟨hGstar_le_G₁.edgeSet_mono (hsingle_in_Gstar f₁ u₂ u₃ hlf₁_H₂ hu₂_H₁ hu₃_H₁), + hGstar_le_G₁.edgeSet_mono (hsingle_in_Gstar f₂ u₁ u₃ hlf₂_H₂ hu₁_H₁ hu₃_H₁)⟩ + · -- `f₂` and `f₁` form a 2-edge path `P` in `H₂.G` with ends `u₁, u₂ ∈ ΩBar₀` and middle + -- `u₃ ∉ ΩBar₀`. + have hu₁_bar₀ : u₁ ∈ H₂.Ω₀.bar := by + rw [hΩ₀_H₂, hbar₀_inter]; exact ⟨hu₁_H₁, hlf₂_H₂.left_mem⟩ + have hu₂_bar₀ : u₂ ∈ H₂.Ω₀.bar := by + rw [hΩ₀_H₂, hbar₀_inter]; exact ⟨hu₂_H₁, hlf₁_H₂.left_mem⟩ + obtain ⟨hP_path, _, hVP_diff, hEP, hP_card⟩ := + isGraphPathWithEnds_two_edges hlf₂_H₂ hlf₁_H₂.symm hu₁₃ hu₂₃.symm hu₁₂ + have hdisj : Disjoint (V(subgraphUnion H₂.G (singleEdgeSubgraph H₂.G f₂) + (singleEdgeSubgraph H₂.G f₁)) \ {u₁, u₂}) + H₂.Ω₀.bar := by + rw [hVP_diff, disjoint_singleton_left]; exact hu₃_bar₀ + have hle_Gstar := short_path_le_park hreg hpark hP_path hu₁₂ hu₁_bar₀ hu₂_bar₀ hdisj + hP_card + have hf₁_Gstar : f₁ ∈ E(N_star.G) := + hle_Gstar.edgeSet_mono (by rw [hEP]; exact mem_insert_of_mem _ (mem_singleton f₁)) + have hf₂_Gstar : f₂ ∈ E(N_star.G) := + hle_Gstar.edgeSet_mono (by rw [hEP]; exact mem_insert f₂ {f₁}) + exact ⟨hGstar_le_G₁.edgeSet_mono hf₁_Gstar, hGstar_le_G₁.edgeSet_mono hf₂_Gstar⟩ + apply hV_of_E G₁ hG₁_le_G + have hl₁ : S.G.IsLink e₁ v₂ v₃ := hl₁T.mono hT.1.1 + have hl₂ : S.G.IsLink e₂ v₁ v₃ := hl₂T.mono hT.1.1 + have hl₃ : S.G.IsLink e₃ v₁ v₂ := hl₃T.mono hT.1.1 + obtain ⟨e, heT, he_H₁⟩ := hex_E₁ + rw [hET] at heT ⊢ + rcases heT with h_eq | h_eq | h_eq + · subst e + have h23 := htwo_other_edges v₂ v₃ v₁ e₂ e₃ e₁ hv₂₃ hv₁₃.symm hv₁₂.symm hl₂.symm hl₃.symm hl₁ + he_H₁ + rintro f (rfl | rfl | rfl) + · exact hH₁_le_G₁.edgeSet_mono he_H₁ + · exact h23.1 + · exact h23.2 + · subst e + have h13 := htwo_other_edges v₁ v₃ v₂ e₁ e₃ e₂ hv₁₃ hv₂₃.symm hv₁₂ hl₁.symm hl₃ hl₂ he_H₁ + rintro f (rfl | rfl | rfl) + · exact h13.1 + · exact hH₁_le_G₁.edgeSet_mono he_H₁ + · exact h13.2 + · subst e + have h12 := htwo_other_edges v₁ v₂ v₃ e₁ e₂ e₃ hv₁₂ hv₂₃ hv₁₃ hl₁ hl₂ hl₃ he_H₁ + rintro f (rfl | rfl | rfl) + · exact h12.1 + · exact h12.2 + · exact hH₁_le_G₁.edgeSet_mono he_H₁ + +/-- The argument of (11.5) of Graph Minors IX (pages 69-70), given a regular park of the rural part +`H₂` of a composition of `S`: the new society is the old one together with the park, and the new +rural neighborhood is the part of `H₂` outside the wall. -/ +theorem composition_of_regular_park (S : Society α β) (hsimple : IsSimpleGraph S.G) {p : ℕ} + {H₁ : Society α β} {H₂ : Neighborhood α β} (hcomp : S.IsComposition H₁ H₂) + (hH₁_no : ∀ P_set : Set (Graph α β), H₁.IsTransaction P_set → P_set.ncard ≤ p) + {P_pres : Presentation H₂} {N_star : Neighborhood α β} + (hreg_park : IsRegularParkOf P_pres N_star) + (hN₂_rural : (outerParkNeighborhood P_pres hreg_park.isParkOf).IsRural) : + ∃ (S₁ : Society α β) (N₂ : Neighborhood α β), + N₂.IsRural ∧ + N₂.Ω = S.Ω ∧ + N₂.Ω₀ = S₁.Ω ∧ + S₁.G ≤ S.G ∧ + N₂.G ≤ S.G ∧ + subgraphUnion S.G S₁.G N₂.G = S.G ∧ + V(subgraphInter S.G S₁.G N₂.G) = S₁.Ω.bar ∧ + (∀ Q_set : Set (Graph α β), S₁.IsTransaction Q_set → Q_set.ncard ≤ p + 2) ∧ + (∀ T : Graph α β, IsTriangle S.G T → T ≤ S₁.G ∨ T ≤ N₂.G) := by + have composition := hcomp + obtain ⟨⟨hsep_H, hbar_H₂⟩, hΩ_H₂, hΩ₀_H₂, hbar₀_inter⟩ := hcomp + have hreg : IsRegularPresentation P_pres := hreg_park.isRegularPresentation + have hpark : IsParkOf P_pres N_star := hreg_park.isParkOf + have hGstar_le_H₂ : N_star.G ≤ H₂.G := hpark.2.2.2.2.1 + have hGstar_le_G : N_star.G ≤ S.G := hGstar_le_H₂.trans hsep_H.2.1 + -- Construct `S₁ = (H₁ ∪ G*, Ω*)` and `N₂ = outerParkNeighborhood P_pres hpark`. + let G₁ : Graph α β := subgraphUnion S.G H₁.G N_star.G + have hG₁_le_G : G₁ ≤ S.G := subgraphUnion_le hsep_H.1 hGstar_le_G + have hH₁_le_G₁ : H₁.G ≤ G₁ := le_subgraphUnion_left hsep_H.1 hGstar_le_G + have hGstar_le_G₁ : N_star.G ≤ G₁ := le_subgraphUnion_right hsep_H.1 hGstar_le_G + let S₁ : Society α β := { + G := G₁ + Ω := N_star.Ω + finite_V := S.finite_V.subset hG₁_le_G.vertexSet_mono + finite_E := S.finite_E.subset hG₁_le_G.edgeSet_mono + bar_subset := N_star.bar_subset.trans hGstar_le_G₁.vertexSet_mono + } + let N₂ : Neighborhood α β := outerParkNeighborhood P_pres hpark + have hN₂_le_H₂ : N₂.G ≤ H₂.G := outerParkGraph_le P_pres + have hN₂_le_G : N₂.G ≤ S.G := hN₂_le_H₂.trans hsep_H.2.1 + -- Show that `H₂.Ω₀.bar ⊆ V(N_star.G)`. + have hbar₀_sub_Gstar : H₂.Ω₀.bar ⊆ V(N_star.G) := by + intro v hv_bar₀ + have hvH₂ : v ∈ V(H₂.G) := H₂.bar₀_subset hv_bar₀ + rw [hpark.2.2.1] + refine ⟨hvH₂, ?_⟩ + have hv_bd₀ : graphDrawingVertexSet P_pres.Γ v ⊆ subBd P_pres.Δ₀ := + (P_pres.mem_bd_Δ₀_iff v hvH₂).mpr hv_bar₀ + have hbd₀_sub : subBd P_pres.Δ₀ ⊆ P_pres.Δ₀ := by + rcases P_pres.agrees_Δ₀ with ⟨hΔ₀_empty, _⟩ | ⟨hΔ₀_disc, _⟩ + · rw [hΔ₀_empty, subBd, closure_empty, empty_inter] + · exact subBd_subset_of_isClosed (isClosed_of_isClosedDisc hΔ₀_disc) + exact hv_bd₀.trans (hbd₀_sub.trans subset_union_left) + -- Show that `S₁` is the composition of `H₁` with the park `N_star`. + have hcomp_S₁ : S₁.IsComposition H₁ N_star := by + refine ⟨⟨⟨hH₁_le_G₁, hGstar_le_G₁, rfl, ?_, ?_⟩, N_star.bar_subset⟩, + rfl, hpark.2.1.trans hΩ₀_H₂, ?_⟩ + · exact (edgeSet_subgraphUnion hsep_H.1 hGstar_le_G).symm + · exact hsep_H.2.2.2.2.mono_right hGstar_le_H₂.edgeSet_mono + · refine subset_antisymm ?_ ?_ + · intro v hv_bar + refine ⟨H₁.bar_subset hv_bar, hbar₀_sub_Gstar (hΩ₀_H₂.symm ▸ hv_bar)⟩ + · intro v ⟨hvH₁, hvGstar⟩ + rw [hbar₀_inter] + exact ⟨hvH₁, hGstar_le_H₂.vertexSet_mono hvGstar⟩ + -- Show `G* ∪ G₂ = H₂`. + have hV_Gstar_union_G₂ : V(N_star.G) ∪ V(N₂.G) = V(H₂.G) := by + refine subset_antisymm (union_subset hGstar_le_H₂.vertexSet_mono hN₂_le_H₂.vertexSet_mono) ?_ + intro v hvH₂ + let x := (P_pres.Γ.iso.vertexEquiv ⟨v, hvH₂⟩).1 + have hxv : graphDrawingVertexSet P_pres.Γ v = {x} := graphDrawingVertexSet_eq_singleton + P_pres.Γ hvH₂ + by_cases hx_wd : x ∈ wallDisc P_pres + · left + rw [hpark.2.2.1] + exact ⟨hvH₂, by rw [hxv, singleton_subset_iff]; exact hx_wd⟩ + · right + change v ∈ outerParkVerts P_pres + have hx_V : x ∈ P_pres.Γ.drawing.V := (P_pres.Γ.iso.vertexEquiv ⟨v, hvH₂⟩).2 + have hx_U : x ∈ P_pres.Γ.drawing.U := P_pres.Γ.drawing.V_subset_U hx_V + have hx_Δ : x ∈ P_pres.Δ := (P_pres.U_subset hx_U).1 + exact ⟨hvH₂, by rw [hxv, singleton_subset_iff]; exact Or.inr ⟨hx_Δ, hx_wd⟩⟩ + have hE_Gstar_union_G₂ : E(N_star.G) ∪ E(N₂.G) = E(H₂.G) := by + refine subset_antisymm (union_subset hGstar_le_H₂.edgeSet_mono hN₂_le_H₂.edgeSet_mono) ?_ + intro e heH₂ + rcases hreg.edge_trichotomy e heH₂ with he_int | he_ext | he_wall + · left + rw [hpark.2.2.2.1] + exact ⟨heH₂, he_int.2.trans interior_subset⟩ + · right + change e ∈ E(outerParkGraph P_pres) + rw [edgeSet_outerParkGraph] + exact ⟨heH₂, Or.inr he_ext⟩ + · right + change e ∈ E(outerParkGraph P_pres) + rw [edgeSet_outerParkGraph] + exact ⟨heH₂, Or.inl he_wall⟩ + refine ⟨S₁, N₂, hN₂_rural, hΩ_H₂, rfl, hG₁_le_G, hN₂_le_G, ?_, ?_, ?_, ?_⟩ + · -- (i.a) `G₁ ∪ G₂ = G` + refine (Compatible.of_le_le (subgraphUnion_le hG₁_le_G hN₂_le_G) le_rfl).ext ?_ ?_ + · rw [vertexSet_subgraphUnion, show V(S₁.G) = V(H₁.G) ∪ V(N_star.G) from rfl, + union_assoc, hV_Gstar_union_G₂, hsep_H.2.2.1] + · rw [edgeSet_subgraphUnion hG₁_le_G hN₂_le_G, + show E(S₁.G) = E(H₁.G) ∪ E(N_star.G) from edgeSet_subgraphUnion hsep_H.1 hGstar_le_G, + union_assoc, hE_Gstar_union_G₂, hsep_H.2.2.2.1] + · -- (i.b) `V(G₁ ∩ G₂) = ΩBar₁` + change (V(H₁.G) ∪ V(N_star.G)) ∩ outerParkVerts P_pres = N_star.Ω.bar + have hGstar_inter : V(N_star.G) ∩ outerParkVerts P_pres = N_star.Ω.bar := by + rw [hpark.2.2.1, hpark.2.2.2.2.2.1] + ext v + simp only [outerParkVerts, mem_inter_iff, mem_sep_iff] + constructor + · rintro ⟨⟨hvH₂, hv_wd⟩, _, hv_out⟩ + refine ⟨hvH₂, fun x hx => ?_⟩ + rcases hv_out hx with hx_wall | ⟨_, hx_not_wd⟩ + · exact hx_wall + · exact (hx_not_wd (hv_wd hx)).elim + · rintro ⟨hvH₂, hv_wall⟩ + exact ⟨⟨hvH₂, hv_wall.trans (wall_subset_wallDisc hreg)⟩, + hvH₂, hv_wall.trans subset_union_left⟩ + have hH₁_inter : V(H₁.G) ∩ outerParkVerts P_pres ⊆ V(N_star.G) ∩ outerParkVerts P_pres := by + rintro v ⟨hvH₁, hv_out⟩ + have hv_bar₀ : v ∈ H₂.Ω₀.bar := by + rw [hΩ₀_H₂, hbar₀_inter] + exact ⟨hvH₁, hv_out.1⟩ + exact ⟨hbar₀_sub_Gstar hv_bar₀, hv_out⟩ + rw [union_inter_distrib_right, union_eq_right.mpr hH₁_inter, hGstar_inter] + · -- (ii) `(G₁, Ω₁)` has no transaction of cardinality `> p + 2`, by (11.4). + intro Q_set hQ_set + exact theorem_11_4_proof ⟨H₂, P_pres, hreg_park⟩ hcomp_S₁ hH₁_no hQ_set + · exact triangle_in_park_or_exterior S hsimple composition hreg hpark + hG₁_le_G hH₁_le_G₁ hGstar_le_G₁ + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section11c.lean b/LeanPool/GraphMinor/GM09/Section11c.lean new file mode 100644 index 0000000000..b383f9b103 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section11c.lean @@ -0,0 +1,758 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM09.Section11a +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section3a + +/-! +# Graph Minors IX, Section 11 (Part 3): Feasible Segregations and the Claims of (11.11) + +This file formalizes Claims (1)–(5) of (11.11) from Section 11 of +N. Robertson and P. D. Seymour, *Graph Minors. IX. Disjoint crossed paths*, +J. Combin. Theory Ser. B **49** (1990) 40–77 (pages 74–77). The proof of (11.11) itself is in +`Section11d.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 +open Set Graph GraphMinor.Surface GraphMinor.GM06 +universe u v w +variable {α : Type u} {β : Type v} {γ : Type w} + +/-! ## Finiteness of consolidations and existence of a minimal consolidation -/ + +/-- The set of subgraphs of `S.G` is finite. -/ +theorem Society.finite_subgraphs (S : Society α β) : {H : Graph α β | H ≤ S.G}.Finite := by + let f : Graph α β → Set α × Set β := fun H => (V(H), E(H)) + have hsub : f '' {H : Graph α β | H ≤ S.G} ⊆ V(S.G).powerset ×ˢ E(S.G).powerset := by + rintro _ ⟨H, hH, rfl⟩; exact ⟨hH.vertexSet_mono, hH.edgeSet_mono⟩ + exact ((S.finite_V.powerset.prod S.finite_E.powerset).subset hsub).of_finite_image + fun H₁ h₁ H₂ h₂ heq => (Compatible.of_le_le h₁ h₂).ext (Prod.mk.inj heq).1 (Prod.mk.inj heq).2 + +/-- Every consolidation of a society `S` is a finite set of separations. -/ +theorem IsConsolidation.finite {S : Society α β} {D_set : Set (Graph α β × Graph α β)} + (hD : IsConsolidation S D_set) : D_set.Finite := + (S.finite_subgraphs.prod S.finite_subgraphs).subset fun ⟨_, _⟩ hAB => ⟨hD.left_le hAB, + hD.right_le hAB⟩ + +/-- By (11.6), every society `S` has a consolidation `D_set` such that its core has as few vertices +as possible, and subject to that `|D_set|` is minimum (Graph Minors IX, (11.11), page 74). -/ +theorem exists_minimal_consolidation (S : Society α β) : + ∃ D_set : Set (Graph α β × Graph α β), + IsConsolidation S D_set ∧ + (∀ D_set' : Set (Graph α β × Graph α β), IsConsolidation S D_set' → + V(consolidationCore S D_set).ncard ≤ V(consolidationCore S D_set').ncard) ∧ + (∀ D_set' : Set (Graph α β × Graph α β), IsConsolidation S D_set' → + V(consolidationCore S D_set').ncard = V(consolidationCore S D_set).ncard → + D_set.ncard ≤ D_set'.ncard) := by + classical + have hex₁ : ∃ n : ℕ, ∃ D_set : Set (Graph α β × Graph α β), + IsConsolidation S D_set ∧ V(consolidationCore S D_set).ncard = n := by + obtain ⟨D₀, hD₀⟩ := theorem_11_6_proof S; exact ⟨_, D₀, hD₀, rfl⟩ + let n₀ := Nat.find hex₁ + have hn₀_spec : ∃ D_set : Set (Graph α β × Graph α β), + IsConsolidation S D_set ∧ V(consolidationCore S D_set).ncard = n₀ := Nat.find_spec hex₁ + have hex₂ : ∃ m : ℕ, ∃ D_set : Set (Graph α β × Graph α β), + IsConsolidation S D_set ∧ V(consolidationCore S D_set).ncard = n₀ ∧ D_set.ncard = m := by + obtain ⟨D₁, hD₁, hn₁⟩ := hn₀_spec; exact ⟨_, D₁, hD₁, hn₁, rfl⟩ + let m₀ := Nat.find hex₂ + obtain ⟨D_set, hD, hn_eq, hm_eq⟩ := Nat.find_spec hex₂ + refine ⟨D_set, hD, fun D_set' hD' => ?_, fun D_set' hD' hn' => ?_⟩ + · rw [hn_eq]; exact Nat.find_min' hex₁ ⟨D_set', hD', rfl⟩ + · rw [hm_eq]; exact Nat.find_min' hex₂ ⟨D_set', hD', hn'.trans hn_eq, rfl⟩ + +/-! ## Claim (1) of (11.11) -/ + +/-- **Graph Minors IX, (11.11), Claim (1)** (pages 74–75): +"If $(A, B), (A', B') \in \mathcal{D}$ are distinct then $V(A \cap B) \not\subseteq V(A')$." -/ +theorem lemma_11_11_claim_1 {S : Society α β} {D_set : Set (Graph α β × Graph α β)} + (hD : IsConsolidation S D_set) + (hmin_card : ∀ D_set' : Set (Graph α β × Graph α β), IsConsolidation S D_set' → + V(consolidationCore S D_set').ncard = V(consolidationCore S D_set).ncard → + D_set.ncard ≤ D_set'.ncard) + {A B A' B' : Graph α β} (hAB : (A, B) ∈ D_set) (hA'B' : (A', B') ∈ D_set) + (hne : (A, B) ≠ (A', B')) : ¬ (V(A) ∩ V(B) ⊆ V(A')) := by + intro hsub + let A_star : Graph α β := subgraphUnion S.G A A' + let B_star : Graph α β := subgraphInter S.G B B' + let D_rest : Set (Graph α β × Graph α β) := D_set \ {(A, B), (A', B')} + let D_set' : Set (Graph α β × Graph α β) := insert (A_star, B_star) D_rest + have hA_le : A ≤ S.G := hD.left_le hAB + have hB_le : B ≤ S.G := hD.right_le hAB + have hA'_le : A' ≤ S.G := hD.left_le hA'B' + have hB'_le : B' ≤ S.G := hD.right_le hA'B' + have hA_le_B' : A ≤ B' := hD.left_le_right hAB hA'B' hne + have hA'_le_B : A' ≤ B := hD.left_le_right hA'B' hAB hne.symm + have hA_star_le : A_star ≤ S.G := subgraphUnion_le hA_le hA'_le + have hB_star_le : B_star ≤ S.G := subgraphInter_le hB_le + have hV_inter_star : V(A_star) ∩ V(B_star) = V(A') ∩ V(B') := by + ext v; simp only [A_star, B_star, vertexSet_subgraphUnion, vertexSet_subgraphInter, + mem_inter_iff, mem_union] + refine ⟨fun ⟨hvAA', hvB, hvB'⟩ => ⟨?_, hvB'⟩, + fun ⟨hvA', hvB'⟩ => ⟨Or.inr hvA', hA'_le_B.vertexSet_mono hvA', hvB'⟩⟩ + rcases hvAA' with hvA | hvA' + · exact hsub ⟨hvA, hvB⟩ + · exact hvA' + have hsep_star : S.IsSocietySeparation A_star B_star := by + have hsep := (hD.isSocietySeparation hAB).1 + have hsep' := (hD.isSocietySeparation hA'B').1 + refine ⟨⟨hA_star_le, hB_star_le, ?_, ?_, ?_⟩, + subset_inter (hD.isSocietySeparation hAB).2 (hD.isSocietySeparation hA'B').2⟩ + · refine subset_antisymm (union_subset hA_star_le.vertexSet_mono hB_star_le.vertexSet_mono) fun + v hv => ?_ + have hv1 : v ∈ V(A) ∪ V(B) := hsep.2.2.1 ▸ hv + have hv2 : v ∈ V(A') ∪ V(B') := hsep'.2.2.1 ▸ hv + rcases hv1 with hvA | hvB + · exact Or.inl (Or.inl hvA) + · rcases hv2 with hvA' | hvB' + · exact Or.inl (Or.inr hvA') + · exact Or.inr ⟨hvB, hvB'⟩ + · rw [edgeSet_subgraphUnion hA_le hA'_le, edgeSet_subgraphInter hB_le hB'_le] + refine subset_antisymm (union_subset (union_subset hA_le.edgeSet_mono hA'_le.edgeSet_mono) + (inter_subset_left.trans hB_le.edgeSet_mono)) fun e he => ?_ + have he1 : e ∈ E(A) ∪ E(B) := hsep.2.2.2.1 ▸ he + have he2 : e ∈ E(A') ∪ E(B') := hsep'.2.2.2.1 ▸ he + rcases he1 with heA | heB + · exact Or.inl (Or.inl heA) + · rcases he2 with heA' | heB' + · exact Or.inl (Or.inr heA') + · exact Or.inr ⟨heB, heB'⟩ + · rw [edgeSet_subgraphUnion hA_le hA'_le, edgeSet_subgraphInter hB_le hB'_le, + disjoint_union_left] + exact ⟨hsep.2.2.2.2.mono_right inter_subset_left, hsep'.2.2.2.2.mono_right inter_subset_right⟩ + have hD' : IsConsolidation S D_set' := by + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · rintro X Y (h_eq | ⟨hXY, _⟩) + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj h_eq; exact hsep_star + · exact hD.isSocietySeparation hXY + · rintro X Y (h_eq | ⟨hXY, _⟩) + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj h_eq; rw [hV_inter_star]; exact hD.order_le_three hA'B' + · exact hD.order_le_three hXY + · rintro X₁ Y₁ X₂ Y₂ (h1 | ⟨h1_in, h1_not⟩) (h2 | ⟨h2_in, h2_not⟩) hne12 + · exact (hne12 (h1.trans h2.symm)).elim + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj h1 + rw [mem_insert_iff, mem_singleton_iff, not_or] at h2_not + exact (subgraphUnion_le_iff hA_le hA'_le (hD.right_le h2_in)).mpr + ⟨hD.left_le_right hAB h2_in (Ne.symm h2_not.1), hD.left_le_right hA'B' h2_in + (Ne.symm h2_not.2)⟩ + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj h2 + rw [mem_insert_iff, mem_singleton_iff, not_or] at h1_not + exact le_subgraphInter hB_le hB'_le + (hD.left_le_right h1_in hAB h1_not.1) (hD.left_le_right h1_in hA'B' h1_not.2) + · exact hD.left_le_right h1_in h2_in hne12 + · have hP' : ∀ P ∈ Prod.fst '' D_set', P ≤ S.G := by + rintro P ⟨⟨X, Y⟩, h_eq | ⟨hXY, _⟩, rfl⟩ + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj h_eq; exact hA_star_le + · exact hD.left_le hXY + refine (Compatible.of_le_le (subgraphSUnion_le hP') le_rfl).ext + (subset_antisymm (subgraphSUnion_le hP').vertexSet_mono fun v hv => ?_) + (subset_antisymm (subgraphSUnion_le hP').edgeSet_mono fun e he => ?_) + · obtain ⟨X, Y, hXY, hvX⟩ := hD.exists_mem_of_mem_vertexSet hv + rw [vertexSet_subgraphSUnion, mem_iUnion₂] + by_cases h_pair : (X, Y) ∈ ({(A, B), (A', B')} : Set (Graph α β × Graph α β)) + · refine ⟨A_star, ⟨(A_star, B_star), Or.inl rfl, rfl⟩, ?_⟩ + rcases h_pair with h_eq | h_eq <;> obtain ⟨rfl, rfl⟩ := Prod.mk.inj h_eq + · exact Or.inl hvX + · exact Or.inr hvX + · exact ⟨X, ⟨(X, Y), Or.inr ⟨hXY, h_pair⟩, rfl⟩, hvX⟩ + · obtain ⟨X, Y, hXY, heX⟩ := hD.exists_mem_of_mem_edgeSet he + rw [edgeSet_subgraphSUnion hP', mem_iUnion₂] + by_cases h_pair : (X, Y) ∈ ({(A, B), (A', B')} : Set (Graph α β × Graph α β)) + · refine ⟨A_star, ⟨(A_star, B_star), Or.inl rfl, rfl⟩, ?_⟩ + rw [edgeSet_subgraphUnion hA_le hA'_le] + rcases h_pair with h_eq | h_eq <;> obtain ⟨rfl, rfl⟩ := Prod.mk.inj h_eq + · exact Or.inl heX + · exact Or.inr heX + · exact ⟨X, ⟨(X, Y), Or.inr ⟨hXY, h_pair⟩, rfl⟩, heX⟩ + · rintro X Y (h_eq | ⟨hXY, _⟩) u hu v hv huv + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj h_eq + rw [hV_inter_star] at hu hv + obtain ⟨P, hP, hdisj⟩ := hD.exists_path hA'B' u hu v hv huv + exact ⟨P, hP.mono (le_subgraphUnion_right hA_le hA'_le), hdisj.mono_right + inter_subset_right⟩ + · exact hD.exists_path hXY u hu v hv huv + have hV_core_eq : V(consolidationCore S D_set') = V(consolidationCore S D_set) := by + ext v; simp only [vertexSet_consolidationCore, mem_inter_iff, mem_iInter, and_congr_right_iff] + intro _ + constructor + · intro h pair hXY + obtain ⟨X, Y⟩ := pair + by_cases h_pair : (X, Y) ∈ ({(A, B), (A', B')} : Set (Graph α β × Graph α β)) + · have hv_star : v ∈ V(B) ∩ V(B') := h (A_star, B_star) (Or.inl rfl) + rcases h_pair with h_eq | h_eq <;> obtain ⟨rfl, rfl⟩ := Prod.mk.inj h_eq + · exact hv_star.1 + · exact hv_star.2 + · exact h (X, Y) (Or.inr ⟨hXY, h_pair⟩) + · intro h pair hXY' + obtain ⟨X, Y⟩ := pair + rcases hXY' with h_eq | ⟨hXY, _⟩ + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj h_eq; exact ⟨h (A, B) hAB, h (A', B') hA'B'⟩ + · exact h (X, Y) hXY + have hle_card : D_set.ncard ≤ D_set'.ncard := hmin_card D_set' hD' (by rw [hV_core_eq]) + have hfin_rest : D_rest.Finite := hD.finite.subset sdiff_subset + have hD_eq : D_set = insert (A, B) (insert (A', B') D_rest) := by + ext p; simp only [D_rest, mem_insert_iff, mem_sdiff, mem_singleton_iff] + refine ⟨fun hp => ?_, ?_⟩ + · by_cases h1 : p = (A, B) + · exact Or.inl h1 + · by_cases h2 : p = (A', B') + · exact Or.inr (Or.inl h2) + · exact Or.inr (Or.inr ⟨hp, not_or.mpr ⟨h1, h2⟩⟩) + · rintro (rfl | rfl | ⟨hp, _⟩) <;> assumption + have hnot1 : (A', B') ∉ D_rest := fun h => h.2 (Or.inr rfl) + have hnot2 : (A, B) ∉ insert (A', B') D_rest := by + rw [mem_insert_iff, not_or]; exact ⟨hne, fun h => h.2 (Or.inl rfl)⟩ + have hcard_D : D_set.ncard = D_rest.ncard + 2 := by + conv_lhs => rw [hD_eq] + rw [ncard_insert_of_notMem hnot2 (hfin_rest.insert (A', B')), + ncard_insert_of_notMem hnot1 hfin_rest] + have hcard_D' : D_set'.ncard ≤ D_rest.ncard + 1 := ncard_insert_le (A_star, B_star) D_rest + omega + +/-- By Claim (1), distinct members of a minimal consolidation have distinct boundary sets +`V(A) ∩ V(B)`. -/ +theorem eq_of_inter_eq_of_minimal_consolidation {S : Society α β} {D_set : Set + (Graph α β × Graph α β)} + (hD : IsConsolidation S D_set) + (hmin_card : ∀ D_set' : Set (Graph α β × Graph α β), IsConsolidation S D_set' → + V(consolidationCore S D_set').ncard = V(consolidationCore S D_set).ncard → + D_set.ncard ≤ D_set'.ncard) + {A B A' B' : Graph α β} (hAB : (A, B) ∈ D_set) (hA'B' : (A', B') ∈ D_set) + (heq : V(A) ∩ V(B) = V(A') ∩ V(B')) : (A, B) = (A', B') := by + by_contra hne + exact lemma_11_11_claim_1 hD hmin_card hAB hA'B' hne (heq ▸ inter_subset_left) + +/-! ## Pattern invariance of transaction cardinality and crookedness -/ + +/-- For any transaction `P_set` in a society `S`, the map `P ↦ pathEnds S.G P` is injective on +`P_set`, +so `(S.transactionPattern P_set).ncard = P_set.ncard`. -/ +theorem ncard_transactionPattern_eq {S : Society α β} {P_set : Set (Graph α β)} + (hP : S.IsTransaction P_set) : (S.transactionPattern P_set).ncard = P_set.ncard := by + rcases hP with ⟨A_f, B_f, hdisj, _, hends⟩ + refine Set.InjOn.ncard_image fun P₁ h₁ P₂ h₂ heq => by_contra fun hne => ?_ + obtain ⟨a₁, _, b₁, _, hP₁_ab⟩ := hends P₁ h₁ + obtain ⟨a₂, _, b₂, _, hP₂_ab⟩ := hends P₂ h₂ + have ha₁_ends : a₁ ∈ pathEnds S.G P₂ := by + rw [← heq, hP₁_ab.1.pathEnds_eq]; exact Or.inl rfl + rw [hP₂_ab.1.pathEnds_eq] at ha₁_ends + have ha₁_P₂ : a₁ ∈ V(P₂) := by + rcases ha₁_ends with rfl | rfl + · exact hP₂_ab.1.left_mem + · exact hP₂_ab.1.right_mem + exact disjoint_left.mp (hdisj.2 h₁ h₂ hne) hP₁_ab.1.left_mem ha₁_P₂ + +/-- For any transaction `P_set` in `S`, `S.transactionEnds P_set = ⋃₀ (S.transactionPattern P_set)`. +-/ +theorem transactionEnds_eq_sUnion_transactionPattern {S : Society α β} {P_set : Set (Graph α β)} + (hP : S.IsTransaction P_set) : S.transactionEnds P_set = ⋃₀ (S.transactionPattern P_set) := by + rcases hP with ⟨A_f, B_f, _, _, hends⟩ + ext v; simp only [Society.transactionEnds, Society.transactionPattern, mem_ofPred_eq, mem_sUnion, + mem_image, exists_exists_and_eq_and] + refine ⟨fun ⟨P, hP_in, b, hP_ab⟩ => ⟨P, hP_in, ?_⟩, fun ⟨P, hP_in, hv⟩ => ?_⟩ + · rw [hP_ab.1.pathEnds_eq]; exact Or.inl rfl + · obtain ⟨a, _, b, _, hP_ab⟩ := hends P hP_in + rw [hP_ab.1.pathEnds_eq, mem_insert_iff, mem_singleton_iff] at hv + rcases hv with rfl | rfl + · exact ⟨P, hP_in, b, hP_ab⟩ + · exact ⟨P, hP_in, a, hP_ab.1.symm, hP_ab.2.1.symm, hP_ab.2.2.2, hP_ab.2.2.1⟩ + +/-- Whether a transaction `P_set` is crooked depends only on `S.Ω` and `S.transactionPattern P_set`. +-/ +theorem isCrookedTransaction_iff_of_transactionPattern_eq {S₁ : Society α β} {S₂ : Society α γ} + (hΩ : S₁.Ω = S₂.Ω) {P₁ : Set (Graph α β)} {P₂ : Set (Graph α γ)} + (hT₁ : S₁.IsTransaction P₁) (hT₂ : S₂.IsTransaction P₂) + (hpat : S₁.transactionPattern P₁ = S₂.transactionPattern P₂) : + S₁.IsCrookedTransaction P₁ ↔ S₂.IsCrookedTransaction P₂ := by + have hends_eq : S₁.transactionEnds P₁ = S₂.transactionEnds P₂ := by + rw [transactionEnds_eq_sUnion_transactionPattern hT₁, + transactionEnds_eq_sUnion_transactionPattern hT₂, hpat] + refine ⟨fun ⟨_, hno₁⟩ => ⟨hT₂, fun Q hQ ⟨_, a, b, hQ_ab, hdisj⟩ => ?_⟩, + fun ⟨_, hno₂⟩ => ⟨hT₁, fun P hP ⟨_, a, b, hP_ab, hdisj⟩ => ?_⟩⟩ + · have h_in_pat : pathEnds S₂.G Q ∈ S₁.transactionPattern P₁ := by + rw [hpat]; exact ⟨Q, hQ, rfl⟩ + obtain ⟨P, hP, hends_P⟩ := h_in_pat + dsimp only at hends_P + rcases hT₁ with ⟨A_f, B_f, _, _, hends₁⟩ + obtain ⟨a', _, b', _, hP_a'b'⟩ := hends₁ P hP + have hpair : ({a', b'} : Set α) = {a, b} := by + rw [← hP_a'b'.1.pathEnds_eq, hends_P, hQ_ab.1.pathEnds_eq] + have ha_in : a ∈ ({a', b'} : Set α) := hpair.symm ▸ Or.inl rfl + have hb_in : b ∈ ({a', b'} : Set α) := hpair.symm ▸ Or.inr rfl + have hP_ab : S₁.IsOmegaPathWithEnds P a b := by + rcases ha_in with rfl | rfl <;> rcases hb_in with rfl | rfl + · exact (hQ_ab.2.1 rfl).elim + · exact hP_a'b' + · exact ⟨hP_a'b'.1.symm, hP_a'b'.2.1.symm, hP_a'b'.2.2.2, hP_a'b'.2.2.1⟩ + · exact (hQ_ab.2.1 rfl).elim + exact hno₁ P hP ⟨hP, a, b, hP_ab, by rwa [hΩ, hends_eq]⟩ + · have h_in_pat : pathEnds S₁.G P ∈ S₂.transactionPattern P₂ := by + rw [← hpat]; exact ⟨P, hP, rfl⟩ + obtain ⟨Q, hQ, hends_Q⟩ := h_in_pat + dsimp only at hends_Q + rcases hT₂ with ⟨A_f, B_f, _, _, hends₂⟩ + obtain ⟨a', _, b', _, hQ_a'b'⟩ := hends₂ Q hQ + have hpair : ({a', b'} : Set α) = {a, b} := by + rw [← hQ_a'b'.1.pathEnds_eq, hends_Q, hP_ab.1.pathEnds_eq] + have ha_in : a ∈ ({a', b'} : Set α) := hpair.symm ▸ Or.inl rfl + have hb_in : b ∈ ({a', b'} : Set α) := hpair.symm ▸ Or.inr rfl + have hQ_ab : S₂.IsOmegaPathWithEnds Q a b := by + rcases ha_in with rfl | rfl <;> rcases hb_in with rfl | rfl + · exact (hP_ab.2.1 rfl).elim + · exact hQ_a'b' + · exact ⟨hQ_a'b'.1.symm, hQ_a'b'.2.1.symm, hQ_a'b'.2.2.2, hQ_a'b'.2.2.1⟩ + · exact (hP_ab.2.1 rfl).elim + exact hno₂ Q hQ ⟨hQ, a, b, hQ_ab, by rwa [← hΩ, ← hends_eq]⟩ + +/-- By (11.10), if `(G, Ω)` has no crooked transaction of cardinality `p`, then its consolidation +core `(C, Ω)` also has no crooked transaction of cardinality `p` (Graph Minors IX, (11.11), page +75). -/ +theorem no_crooked_transaction_consolidationCoreSociety {S : Society α β} + {D_set : Set (Graph α β × Graph α β)} (hD : IsConsolidation S D_set) {p : ℕ} + (hno_crooked : ∀ P_set : Set (Graph α β), S.IsCrookedTransaction P_set → P_set.ncard ≠ p) : + ∀ Q_set : Set (Graph α (Sym2 α)), + (consolidationCoreSociety S D_set hD).IsCrookedTransaction Q_set → Q_set.ncard ≠ p := by + intro Q_set hQ_crooked hcard + obtain ⟨P_set, hP_trans, hpat⟩ := exists_transaction_of_core_transaction hD hQ_crooked.1 + have hP_crooked : S.IsCrookedTransaction P_set := + (isCrookedTransaction_iff_of_transactionPattern_eq + (consolidationCoreSociety_Ω S D_set hD).symm hP_trans hQ_crooked.1 hpat).mpr hQ_crooked + have hcard_P : P_set.ncard = p := by + rw [← ncard_transactionPattern_eq hP_trans, hpat, ncard_transactionPattern_eq hQ_crooked.1, + hcard] + exact hno_crooked P_set hP_crooked hcard_P + +/-! ## Partitioning `D_set` into `D₁` and `D₂` and Claims (2)–(5) of (11.11) -/ + +/-- A subset `K ⊆ V(G)` of a simple graph `G : Graph α (Sym2 α)` is a `≤ 3`-clique if `|K| ≤ 3` and +every two distinct vertices of `K` are adjacent in `G` (Graph Minors IX, (11.11), page 76). -/ +def IsLeThreeClique (G : Graph α (Sym2 α)) (K : Set α) : Prop := + K ⊆ V(G) ∧ K.encard ≤ 3 ∧ ∀ u ∈ K, ∀ v ∈ K, u ≠ v → G.IsLink s(u, v) u v + +/-- A clique of size at most three is finite and has natural cardinality at most three. -/ +theorem IsLeThreeClique.finite_ncard_le {G : Graph α (Sym2 α)} {K : Set α} + (h : IsLeThreeClique G K) : K.Finite ∧ K.ncard ≤ 3 := + Set.encard_le_coe_iff_finite_ncard_le.mp h.2.1 + +/-- A 3-element clique `{x, y, z}` in `C : Graph α (Sym2 α)` forms a triangle `T ≤ C` with +`IsTriangle C T` and `V(T) = {x, y, z}`. -/ +theorem exists_triangle_of_three_clique {C : Graph α (Sym2 α)} {x y z : α} + (hxy : x ≠ y) (hyz : y ≠ z) (hzx : z ≠ x) + (hl_xy : C.IsLink s(x, y) x y) (hl_yz : C.IsLink s(y, z) y z) (hl_zx : C.IsLink s(z, x) z x) : + ∃ T : Graph α (Sym2 α), IsTriangle C T ∧ V(T) = {x, y, z} ∧ + T.IsLink s(x, y) x y ∧ T.IsLink s(y, z) y z ∧ T.IsLink s(z, x) z x := by + let T : Graph α (Sym2 α) := (C.induce {x, y, z}).restrict {s(x, y), s(y, z), s(z, x)} + have hTC : T ≤ C := restrict_le.trans (C.induce_le (by + rintro w (rfl | rfl | rfl); exacts [hl_xy.left_mem, hl_yz.left_mem, hl_zx.left_mem])) + have hl_xy_T : T.IsLink s(x, y) x y := + (hTC.isLink_iff (by refine ⟨⟨x, y, hl_xy, by simp, by simp⟩, by simp⟩)).mpr hl_xy + have hl_yz_T : T.IsLink s(y, z) y z := + (hTC.isLink_iff (by refine ⟨⟨y, z, hl_yz, by simp, by simp⟩, by simp⟩)).mpr hl_yz + have hl_zx_T : T.IsLink s(z, x) z x := + (hTC.isLink_iff (by refine ⟨⟨z, x, hl_zx, by simp, by simp⟩, by simp⟩)).mpr hl_zx + let W : GraphWalk T x x := .cons hl_xy_T (.cons hl_yz_T (.cons hl_zx_T (.nil hl_xy_T.left_mem))) + have hne_e12 : (s(x, y) : Sym2 α) ≠ s(y, z) := by + intro h; rcases Sym2.eq_iff.mp h with ⟨h1, _⟩ | ⟨h1, _⟩ + · exact hxy h1 + · exact hzx.symm h1 + have hne_e13 : (s(x, y) : Sym2 α) ≠ s(z, x) := by + intro h; rcases Sym2.eq_iff.mp h with ⟨h1, _⟩ | ⟨_, h2⟩ + · exact hzx.symm h1 + · exact hyz h2 + have hne_e23 : (s(y, z) : Sym2 α) ≠ s(z, x) := by + intro h; rcases Sym2.eq_iff.mp h with ⟨h1, _⟩ | ⟨h1, _⟩ + · exact hyz h1 + · exact hxy.symm h1 + have hET : E(T) = {s(x, y), s(y, z), s(z, x)} := by + ext e; simp only [mem_insert_iff, mem_singleton_iff] + refine ⟨fun he => he.2, ?_⟩ + rintro (rfl | rfl | rfl) + · exact hl_xy_T.edge_mem + · exact hl_yz_T.edge_mem + · exact hl_zx_T.edge_mem + have hcard_E : E(T).ncard = 3 := by + rw [hET, ncard_insert_of_notMem (by simp [hne_e12, hne_e13]) ((finite_singleton _).insert _), + ncard_pair hne_e23] + refine ⟨T, ⟨⟨hTC, x, W, ?_, by simp [W], ?_, ?_⟩, hcard_E⟩, rfl, hl_xy_T, hl_yz_T, hl_zx_T⟩ + · refine ⟨?_, ?_⟩ + · simp [W, hyz, hzx, hxy.symm] + · simp [W, hne_e12, hne_e13, hne_e23] + · ext w; simp only [T, vertexSet_restrict, vertexSet_induce, mem_insert_iff, mem_singleton_iff, + mem_ofPred_eq, W, GraphWalk.support_cons, GraphWalk.support_nil, List.mem_cons, + List.not_mem_nil, or_false] + tauto + · rw [hET]; ext e; simp [W] + +/-- Every finite set `X` with `X.ncard ≤ 3` is either empty, a singleton, a pair of distinct +elements, or a triple of pairwise distinct elements. -/ +theorem eq_empty_or_singleton_or_pair_or_triple_of_ncard_le_three {X : Set α} + (hfin : X.Finite) (hcard : X.ncard ≤ 3) : + X = ∅ ∨ (∃ x, X = {x}) ∨ (∃ x y, x ≠ y ∧ X = {x, y}) ∨ + (∃ x y z, x ≠ y ∧ y ≠ z ∧ z ≠ x ∧ X = {x, y, z}) := by + rcases X.eq_empty_or_nonempty with rfl | ⟨x, hx⟩ + · exact Or.inl rfl + rcases (X \ {x}).eq_empty_or_nonempty with h1 | ⟨y, hy, hyx⟩ + · right; left; refine ⟨x, subset_antisymm (fun w hw => ?_) (singleton_subset_iff.mpr hx)⟩ + by_contra hwx; exact h1.subset ⟨hw, hwx⟩ + have hxy : x ≠ y := Ne.symm (mem_singleton_iff.not.mp hyx) + rcases (X \ {x, y}).eq_empty_or_nonempty with h2 | ⟨z, hz, hz_xy⟩ + · right; right; left; refine ⟨x, y, hxy, subset_antisymm (fun w hw => ?_) ?_⟩ + · by_contra hw_xy; exact h2.subset ⟨hw, hw_xy⟩ + · rintro w (rfl | rfl) <;> assumption + rw [mem_insert_iff, mem_singleton_iff, not_or] at hz_xy + rcases (X \ {x, y, z}).eq_empty_or_nonempty with h3 | ⟨w, hw, hw_xyz⟩ + · right; right; right + refine ⟨x, y, z, hxy, Ne.symm hz_xy.2, hz_xy.1, subset_antisymm (fun u hu => ?_) ?_⟩ + · by_contra hu_xyz; exact h3.subset ⟨hu, hu_xyz⟩ + · rintro u (rfl | rfl | rfl) <;> assumption + exfalso + rw [mem_insert_iff, mem_insert_iff, mem_singleton_iff, not_or, not_or] at hw_xyz + have hsub4 : ({x, y, z, w} : Set α) ⊆ X := by rintro u (rfl | rfl | rfl | rfl) <;> assumption + have hcard4 : ({x, y, z, w} : Set α).ncard = 4 := by + rw [ncard_insert_of_notMem (by simp [hxy, Ne.symm hz_xy.1, Ne.symm hw_xyz.1]) + (((finite_singleton w).insert z).insert y), + ncard_insert_of_notMem (by simp [Ne.symm hz_xy.2, Ne.symm hw_xyz.2.1]) + ((finite_singleton w).insert z), ncard_pair (Ne.symm hw_xyz.2.2)] + have hle := ncard_le_ncard hsub4 hfin; omega + +/-- If `C₁, C₂ ≤ C` satisfy `C₁ ∪ C₂ = C` and every triangle of `C` is in `C₁` or `C₂`, then every +`≤ 3`-clique `K` of `C` is a `≤ 3`-clique in `C₁` or in `C₂` (Graph Minors IX, (11.11), page 75). -/ +theorem isLeThreeClique_left_or_right {C C₁ C₂ : Graph α (Sym2 α)} + (hC₁ : C₁ ≤ C) (hC₂ : C₂ ≤ C) (hC_union : subgraphUnion C C₁ C₂ = C) + (htri : ∀ T : Graph α (Sym2 α), IsTriangle C T → T ≤ C₁ ∨ T ≤ C₂) + {K : Set α} (hK : IsLeThreeClique C K) : + IsLeThreeClique C₁ K ∨ IsLeThreeClique C₂ K := by + have hV_union : V(C₁) ∪ V(C₂) = V(C) := by + have h := congrArg Graph.vertexSet hC_union; rwa [vertexSet_subgraphUnion] at h + obtain ⟨hfin, hcard⟩ := hK.finite_ncard_le + rcases eq_empty_or_singleton_or_pair_or_triple_of_ncard_le_three hfin hcard with + rfl | ⟨x, rfl⟩ | ⟨x, y, hxy, rfl⟩ | ⟨x, y, z, hxy, hyz, hzx, rfl⟩ + · exact Or.inl ⟨empty_subset _, by simp, fun _ hu => hu.elim⟩ + · have hxC : x ∈ V(C₁) ∪ V(C₂) := hV_union.symm ▸ hK.1 (mem_singleton x) + rcases hxC with hx₁ | hx₂ + · exact Or.inl ⟨singleton_subset_iff.mpr hx₁, hK.2.1, fun u hu v hv huv => + (huv ((mem_singleton_iff.mp hu).trans (mem_singleton_iff.mp hv).symm)).elim⟩ + · exact Or.inr ⟨singleton_subset_iff.mpr hx₂, hK.2.1, fun u hu v hv huv => + (huv ((mem_singleton_iff.mp hu).trans (mem_singleton_iff.mp hv).symm)).elim⟩ + · have hl_xy : C.IsLink s(x, y) x y := hK.2.2 x (Or.inl rfl) y (Or.inr rfl) hxy + have hl_union : (subgraphUnion C C₁ C₂).IsLink s(x, y) x y := hC_union.symm ▸ hl_xy + rcases (subgraphUnion_isLink hC₁ hC₂).mp hl_union with hl₁ | hl₂ + · left; refine ⟨by rintro u (rfl | rfl); exacts [hl₁.left_mem, hl₁.right_mem], hK.2.1, ?_⟩ + rintro u (rfl | rfl) v (rfl | rfl) huv + exacts [(huv rfl).elim, hl₁, Sym2.eq_swap ▸ hl₁.symm, (huv rfl).elim] + · right; refine ⟨by rintro u (rfl | rfl); exacts [hl₂.left_mem, hl₂.right_mem], hK.2.1, ?_⟩ + rintro u (rfl | rfl) v (rfl | rfl) huv + exacts [(huv rfl).elim, hl₂, Sym2.eq_swap ▸ hl₂.symm, (huv rfl).elim] + · have hl_xy : C.IsLink s(x, y) x y := hK.2.2 x (by simp) y (by simp) hxy + have hl_yz : C.IsLink s(y, z) y z := hK.2.2 y (by simp) z (by simp) hyz + have hl_zx : C.IsLink s(z, x) z x := hK.2.2 z (by simp) x (by simp) hzx + obtain ⟨T, hT_tri, hVT, hl_xy_T, hl_yz_T, hl_zx_T⟩ := + exists_triangle_of_three_clique hxy hyz hzx hl_xy hl_yz hl_zx + rcases htri T hT_tri with hT₁ | hT₂ + · left; refine ⟨hVT ▸ hT₁.vertexSet_mono, hK.2.1, ?_⟩ + rintro u (rfl | rfl | rfl) v (rfl | rfl | rfl) huv + exacts [(huv rfl).elim, hl_xy_T.mono hT₁, Sym2.eq_swap ▸ (hl_zx_T.mono hT₁).symm, + Sym2.eq_swap ▸ (hl_xy_T.mono hT₁).symm, (huv rfl).elim, hl_yz_T.mono hT₁, + hl_zx_T.mono hT₁, Sym2.eq_swap ▸ (hl_yz_T.mono hT₁).symm, (huv rfl).elim] + · right; refine ⟨hVT ▸ hT₂.vertexSet_mono, hK.2.1, ?_⟩ + rintro u (rfl | rfl | rfl) v (rfl | rfl | rfl) huv + exacts [(huv rfl).elim, hl_xy_T.mono hT₂, Sym2.eq_swap ▸ (hl_zx_T.mono hT₂).symm, + Sym2.eq_swap ▸ (hl_xy_T.mono hT₂).symm, (huv rfl).elim, hl_yz_T.mono hT₂, + hl_zx_T.mono hT₂, Sym2.eq_swap ▸ (hl_yz_T.mono hT₂).symm, (huv rfl).elim] + +/-- **Graph Minors IX, (11.11), Claim (2)** (page 75): +"$(A_0, B_0)$ is a separation of $(G, \Omega)$, and $V(A_0 \cap B_0) = \bar{\Omega}_0$, and +$V(B_0 \cap C) = V(C_2)$." -/ +theorem lemma_11_11_claim_2 {S : Society α β} {D_set D₁ D₂ : Set (Graph α β × Graph α β)} + (hD : IsConsolidation S D_set) {C₁ C₂ : Graph α (Sym2 α)} {Ω₀ : CyclicPerm α} + (hC₁ : C₁ ≤ consolidationCore S D_set) (hC₂ : C₂ ≤ consolidationCore S D_set) + (hC_union : subgraphUnion (consolidationCore S D_set) C₁ C₂ = consolidationCore S D_set) + (hΩ : S.Ω.bar ⊆ V(C₂)) (hΩ₀ : V(C₁) ∩ V(C₂) = Ω₀.bar) + (hD_union : D₁ ∪ D₂ = D_set) (hD_disj : Disjoint D₁ D₂) + (hD₁ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₁ → V(A) ∩ V(B) ⊆ V(C₁)) + (hD₂ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₂ → V(A) ∩ V(B) ⊆ V(C₂)) : + let C := consolidationCore S D_set + let C_star : Graph α β := (S.G.induce (V(C₁) ∩ V(C₂))).restrict ∅ + let A₀ : Graph α β := subgraphUnion S.G C_star (subgraphSUnion S.G (Prod.fst '' D₁)) + let B₀ : Graph α β := subgraphUnion S.G C_star (subgraphSUnion S.G (Prod.fst '' D₂)) + S.IsSocietySeparation A₀ B₀ ∧ V(subgraphInter S.G A₀ B₀) = Ω₀.bar ∧ + V(A₀) ∩ V(C) = V(C₁) ∧ V(B₀) ∩ V(C) = V(C₂) := by + intro C C_star A₀ B₀ + obtain ⟨hsep, hinter, hA₀C, hB₀C⟩ := + theorem_11_8_proof hD hC₁ hC₂ hC_union hΩ hD_union hD_disj hD₁ hD₂ + refine ⟨hsep, ?_, hA₀C, hB₀C⟩ + rw [hinter]; exact hΩ₀ + +/-- **Graph Minors IX, (11.11), Claim (3)** (pages 75–76): +"`D'₁` is a consolidation of `(A₀, Ω₀)`." -/ +theorem lemma_11_11_claim_3 {S : Society α β} {D_set D₁ D₂ : Set (Graph α β × Graph α β)} + (hD : IsConsolidation S D_set) {C₁ C₂ : Graph α (Sym2 α)} {Ω₀ : CyclicPerm α} + (hC₁ : C₁ ≤ consolidationCore S D_set) (hC₂ : C₂ ≤ consolidationCore S D_set) + (hC_union : subgraphUnion (consolidationCore S D_set) C₁ C₂ = consolidationCore S D_set) + (hΩ : S.Ω.bar ⊆ V(C₂)) (hΩ₀ : V(C₁) ∩ V(C₂) = Ω₀.bar) + (hD_union : D₁ ∪ D₂ = D_set) (hD_disj : Disjoint D₁ D₂) + (hD₁ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₁ → V(A) ∩ V(B) ⊆ V(C₁)) + (hD₂ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₂ → V(A) ∩ V(B) ⊆ V(C₂)) : + let C_star : Graph α β := (S.G.induce (V(C₁) ∩ V(C₂))).restrict ∅ + let A₀ : Graph α β := subgraphUnion S.G C_star (subgraphSUnion S.G (Prod.fst '' D₁)) + have hA₀_le : A₀ ≤ S.G := + (lemma_11_11_claim_2 hD hC₁ hC₂ hC_union hΩ hΩ₀ hD_union hD_disj hD₁ hD₂).1.1.1 + let S₀ : Society α β := ⟨A₀, Ω₀, S.finite_V.subset hA₀_le.vertexSet_mono, + S.finite_E.subset hA₀_le.edgeSet_mono, hΩ₀ ▸ subset_union_left⟩ + let D'₁ : Set (Graph α β × Graph α β) := + (fun p => (p.1, subgraphInter S.G A₀ p.2)) '' D₁ ∪ + (fun v => (singleVertexSubgraph A₀ v, A₀)) '' V(C_star) + IsConsolidation S₀ D'₁ := by + intro C_star A₀ hA₀_le S₀ D'₁ + have hD₁_sub : D₁ ⊆ D_set := hD_union ▸ subset_union_left + have hC_star_le_G : C_star ≤ S.G := restrict_le.trans (S.G.induce_le + (inter_subset_left.trans (hC₁.vertexSet_mono.trans (vertexSet_consolidationCore_subset S + D_set)))) + have hU₁_all : ∀ P ∈ Prod.fst '' D₁, P ≤ S.G := fun P hP => hD.forall_fst_le P + (image_mono hD₁_sub hP) + have hU₁_le_G : subgraphSUnion S.G (Prod.fst '' D₁) ≤ S.G := subgraphSUnion_le hU₁_all + have hC_star_le_A₀ : C_star ≤ A₀ := le_subgraphUnion_left hC_star_le_G hU₁_le_G + have hU₁_le_A₀ : subgraphSUnion S.G (Prod.fst '' D₁) ≤ A₀ := le_subgraphUnion_right hC_star_le_G + hU₁_le_G + have hA_le_A₀ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₁ → A ≤ A₀ := fun A B hAB => + (le_subgraphSUnion hU₁_all ⟨(A, B), hAB, rfl⟩).trans hU₁_le_A₀ + have hC_star_sub_B : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D_set → V(C_star) ⊆ V(B) := fun A B hAB => + (inter_subset_left.trans hC₁.vertexSet_mono).trans (vertexSet_consolidationCore_subset_right + hAB) + have hsep_D₁ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₁ → + S₀.IsSocietySeparation A (subgraphInter S.G A₀ B) := by + intro A B hAB + have hAB_D : (A, B) ∈ D_set := hD₁_sub hAB + have hsep := (hD.isSocietySeparation hAB_D).1 + have hA_A₀ : A ≤ A₀ := hA_le_A₀ hAB + have hB_le : B ≤ S.G := hD.right_le hAB_D + have hB'_A₀ : subgraphInter S.G A₀ B ≤ A₀ := subgraphInter_le_left hA₀_le hB_le + refine ⟨⟨hA_A₀, hB'_A₀, ?_, ?_, ?_⟩, ?_⟩ + · refine subset_antisymm (union_subset hA_A₀.vertexSet_mono hB'_A₀.vertexSet_mono) fun v hv + => ?_ + have hvG : v ∈ V(A) ∪ V(B) := hsep.2.2.1 ▸ hA₀_le.vertexSet_mono hv + rcases hvG with hvA | hvB + · exact Or.inl hvA + · exact Or.inr ⟨hv, hvB⟩ + · rw [edgeSet_subgraphInter hA₀_le hB_le] + refine subset_antisymm (union_subset hA_A₀.edgeSet_mono inter_subset_left) fun e he => ?_ + have heG : e ∈ E(A) ∪ E(B) := hsep.2.2.2.1 ▸ hA₀_le.edgeSet_mono he + rcases heG with heA | heB + · exact Or.inl heA + · exact Or.inr ⟨he, heB⟩ + · rw [edgeSet_subgraphInter hA₀_le hB_le] + exact hsep.2.2.2.2.mono_right inter_subset_right + · change Ω₀.bar ⊆ V(A₀) ∩ V(B) + rw [← hΩ₀]; exact subset_inter subset_union_left (hC_star_sub_B hAB_D) + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · rintro X Y (⟨⟨A, B⟩, hAB, hpair⟩ | ⟨v, hv, hpair⟩) <;> obtain ⟨rfl, rfl⟩ := Prod.mk.inj hpair + · exact hsep_D₁ hAB + · have hv_A₀ : v ∈ V(A₀) := Or.inl hv + refine ⟨⟨singleVertexSubgraph_le hv_A₀, le_rfl, ?_, by simp [S₀], ?_⟩, S₀.bar_subset⟩ + · rw [vertexSet_singleVertexSubgraph, singleton_union, insert_eq_of_mem hv_A₀] + · rw [edgeSet_singleVertexSubgraph]; exact empty_disjoint _ + · rintro X Y (⟨⟨A, B⟩, hAB, hpair⟩ | ⟨v, _, hpair⟩) <;> obtain ⟨rfl, rfl⟩ := Prod.mk.inj hpair + · have hV_eq : V(A) ∩ V(subgraphInter S.G A₀ B) = V(A) ∩ V(B) := by + ext u; simp only [vertexSet_subgraphInter, mem_inter_iff] + exact ⟨fun ⟨huA, _, huB⟩ => ⟨huA, huB⟩, fun ⟨huA, huB⟩ => ⟨huA, + (hA_le_A₀ hAB).vertexSet_mono huA, huB⟩⟩ + rw [hV_eq]; exact hD.order_le_three (hD₁_sub hAB) + · exact (ncard_le_ncard inter_subset_left (finite_singleton v)).trans (by simp) + · rintro X₁ Y₁ X₂ Y₂ h1 h2 hne + rcases h2 with ⟨⟨A₂, B₂⟩, hA₂B₂, hpair₂⟩ | ⟨v₂, _, hpair₂⟩ <;> obtain ⟨rfl, rfl⟩ + := Prod.mk.inj hpair₂ + · have hB'₂_le : subgraphInter S.G A₀ B₂ ≤ A₀ := subgraphInter_le_left hA₀_le (hD.right_le + (hD₁_sub hA₂B₂)) + rcases h1 with ⟨⟨A₁, B₁⟩, hA₁B₁, hpair₁⟩ | ⟨v₁, hv₁, hpair₁⟩ <;> obtain ⟨rfl, rfl⟩ + := Prod.mk.inj hpair₁ + · have hne12 : (A₁, B₁) ≠ (A₂, B₂) := fun heq => hne (by rw [heq]) + have hA₁_B₂ : A₁ ≤ B₂ := hD.left_le_right (hD₁_sub hA₁B₁) (hD₁_sub hA₂B₂) hne12 + exact le_subgraphInter hA₀_le (hD.right_le (hD₁_sub hA₂B₂)) (hA_le_A₀ hA₁B₁) hA₁_B₂ + · have hv₁_A₀ : v₁ ∈ V(A₀) := Or.inl hv₁ + rw [(Compatible.of_le_le (singleVertexSubgraph_le hv₁_A₀) hB'₂_le).le_iff] + refine ⟨singleton_subset_iff.mpr ⟨hv₁_A₀, hC_star_sub_B (hD₁_sub hA₂B₂) hv₁⟩, ?_⟩ + rw [edgeSet_singleVertexSubgraph]; exact empty_subset _ + · rcases h1 with ⟨⟨A₁, B₁⟩, hA₁B₁, hpair₁⟩ | ⟨v₁, hv₁, hpair₁⟩ <;> obtain ⟨rfl, rfl⟩ + := Prod.mk.inj hpair₁ + · exact hA_le_A₀ hA₁B₁ + · exact singleVertexSubgraph_le (Or.inl hv₁) + · have hP' : ∀ P ∈ Prod.fst '' D'₁, P ≤ A₀ := by + rintro P ⟨⟨X, Y⟩, ⟨⟨A, B⟩, hAB, hpair⟩ | ⟨v, hv, hpair⟩, rfl⟩ <;> + obtain ⟨rfl, rfl⟩ := Prod.mk.inj hpair + · exact hA_le_A₀ hAB + · exact singleVertexSubgraph_le (Or.inl hv) + refine (Compatible.of_le_le (subgraphSUnion_le hP') le_rfl).ext + (subset_antisymm (subgraphSUnion_le hP').vertexSet_mono fun v hv => ?_) + (subset_antisymm (subgraphSUnion_le hP').edgeSet_mono fun e he => ?_) + · rw [vertexSet_subgraphSUnion, mem_iUnion₂] + rcases hv with hv_star | hv_U₁ + · exact ⟨singleVertexSubgraph A₀ v, + ⟨(singleVertexSubgraph A₀ v, A₀), Or.inr ⟨v, hv_star, rfl⟩, rfl⟩, by simp⟩ + · obtain ⟨A, ⟨⟨A', B'⟩, hAB, rfl⟩, hvA⟩ := mem_iUnion₂.mp hv_U₁ + exact ⟨A', ⟨(A', subgraphInter S.G A₀ B'), Or.inl ⟨(A', B'), hAB, rfl⟩, rfl⟩, hvA⟩ + · rw [edgeSet_subgraphSUnion hP', mem_iUnion₂] + have he' : e ∈ E(subgraphSUnion S.G (Prod.fst '' D₁)) := by + have hE_A₀ : E(A₀) = E(C_star) ∪ E(subgraphSUnion S.G (Prod.fst '' D₁)) := + edgeSet_subgraphUnion hC_star_le_G hU₁_le_G + have hE_star : E(C_star) = ∅ := by simp [C_star] + rwa [hE_A₀, hE_star, empty_union] at he + rw [edgeSet_subgraphSUnion hU₁_all, mem_iUnion₂] at he' + obtain ⟨A, ⟨⟨A', B'⟩, hAB, rfl⟩, heA⟩ := he' + exact ⟨A', ⟨(A', subgraphInter S.G A₀ B'), Or.inl ⟨(A', B'), hAB, rfl⟩, rfl⟩, heA⟩ + · rintro X Y (⟨⟨A, B⟩, hAB, hpair⟩ | ⟨v, _, hpair⟩) u hu w hw huw <;> + obtain ⟨rfl, rfl⟩ := Prod.mk.inj hpair + · obtain ⟨P, hP, hdisj⟩ := hD.exists_path (hD₁_sub hAB) u ⟨hu.1, hu.2.2⟩ w ⟨hw.1, hw.2.2⟩ huw + exact ⟨P, hP, hdisj.mono_right inter_subset_right⟩ + · exact (huw ((mem_singleton_iff.mp hu.1).trans (mem_singleton_iff.mp hw.1).symm)).elim + +/-- **Graph Minors IX, (11.11), Claim (4)** (page 76): +"$(A_0, \Omega_0)$ has no transaction of cardinality $> 3p + 9$." -/ +theorem lemma_11_11_claim_4 {S : Society α β} {D_set D₁ D₂ : Set (Graph α β × Graph α β)} + (hD : IsConsolidation S D_set) {S₁ : Society α (Sym2 α)} {C₂ : Graph α (Sym2 α)} + (hC₁ : S₁.G ≤ consolidationCore S D_set) (hC₂ : C₂ ≤ consolidationCore S D_set) + (hC_union : subgraphUnion (consolidationCore S D_set) S₁.G C₂ = consolidationCore S D_set) + (hΩ : S.Ω.bar ⊆ V(C₂)) (hΩ₀ : V(S₁.G) ∩ V(C₂) = S₁.Ω.bar) + (hD_union : D₁ ∪ D₂ = D_set) (hD_disj : Disjoint D₁ D₂) + (hD₁_clique : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₁ → IsLeThreeClique S₁.G (V(A) ∩ V(B))) + (hD₂ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₂ → V(A) ∩ V(B) ⊆ V(C₂)) + {q : ℕ} (hno_large_C₁ : ∀ Q_set : Set (Graph α (Sym2 α)), S₁.IsTransaction Q_set → Q_set.ncard + ≤ q) : + let C_star : Graph α β := (S.G.induce (V(S₁.G) ∩ V(C₂))).restrict ∅ + let A₀ : Graph α β := subgraphUnion S.G C_star (subgraphSUnion S.G (Prod.fst '' D₁)) + have hA₀_le : A₀ ≤ S.G := + (lemma_11_11_claim_2 hD hC₁ hC₂ hC_union hΩ hΩ₀ hD_union hD_disj + (fun _ _ h => (hD₁_clique h).1) hD₂).1.1.1 + let S₀ : Society α β := ⟨A₀, S₁.Ω, S.finite_V.subset hA₀_le.vertexSet_mono, + S.finite_E.subset hA₀_le.edgeSet_mono, hΩ₀ ▸ subset_union_left⟩ + ∀ P_set : Set (Graph α β), S₀.IsTransaction P_set → P_set.ncard ≤ q := by + intro C_star A₀ hA₀_le S₀ P_set hP_trans + have hD₁ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₁ → V(A) ∩ V(B) ⊆ V(S₁.G) := fun _ _ h => + (hD₁_clique h).1 + let D'₁ : Set (Graph α β × Graph α β) := + (fun q => (q.1, subgraphInter S.G A₀ q.2)) '' D₁ ∪ + (fun v => (singleVertexSubgraph A₀ v, A₀)) '' V(C_star) + have hD'₁ : IsConsolidation S₀ D'₁ := + lemma_11_11_claim_3 hD hC₁ hC₂ hC_union hΩ hΩ₀ hD_union hD_disj hD₁ hD₂ + let C' := consolidationCore S₀ D'₁ + have hC'_le_C₁ : C' ≤ S₁.G := by + refine ⟨fun v hv => ?_, fun e x y hlink => ?_⟩ + · rcases hv.1 with hv_star | hv_U₁ + · exact hv_star.1 + · obtain ⟨A, ⟨⟨A', B'⟩, hAB, rfl⟩, hvA⟩ := mem_iUnion₂.mp hv_U₁ + have hvB' : v ∈ V(subgraphInter S.G A₀ B') := + mem_iInter₂.mp hv.2 (A', subgraphInter S.G A₀ B') (Or.inl ⟨(A', B'), hAB, rfl⟩) + exact hD₁ hAB ⟨hvA, hvB'.2⟩ + · rcases hlink with ⟨hxy, rfl, _, _, ⟨X, Y⟩, hq, hxq, hyq⟩ + rcases hq with ⟨⟨A, B⟩, hAB, hpair⟩ | ⟨v, _, hpair⟩ <;> obtain ⟨rfl, rfl⟩ := Prod.mk.inj hpair + · exact (hD₁_clique hAB).2.2 x ⟨hxq.1, hxq.2.2⟩ y ⟨hyq.1, hyq.2.2⟩ hxy + · exact (hxy ((mem_singleton_iff.mp hxq.1).trans (mem_singleton_iff.mp hyq.1).symm)).elim + obtain ⟨Q_set, hQ_trans, hpat⟩ := (theorem_11_10_proof S₀ D'₁ hD'₁ (S₀.transactionPattern + P_set)).mp + ⟨P_set, hP_trans, rfl⟩ + have hQ_trans_S₁ : S₁.IsTransaction Q_set := by + rcases hQ_trans with ⟨A_f, B_f, ⟨hQ_paths, hQ_disj⟩, hfence, hQ_ends⟩ + refine ⟨A_f, B_f, ⟨fun Q hQ => ?_, hQ_disj⟩, hfence, fun Q hQ => ?_⟩ + · obtain ⟨a, b, hQ_ab⟩ := hQ_paths Q hQ + exact ⟨a, b, hQ_ab.1.mono hC'_le_C₁, hQ_ab.2⟩ + · obtain ⟨a, haA, b, hbB, hQ_ab⟩ := hQ_ends Q hQ + exact ⟨a, haA, b, hbB, hQ_ab.1.mono hC'_le_C₁, hQ_ab.2⟩ + rw [← ncard_transactionPattern_eq hP_trans, ← hpat, ncard_transactionPattern_eq hQ_trans] + exact hno_large_C₁ Q_set hQ_trans_S₁ + +/-- **Graph Minors IX, (11.11), Claim (5)** (pages 76–77): +"{(A_0, \Omega_0), (A_1, \Omega_1), \dots, (A_k, \Omega_k)\}$ is a segregation of $(G, \Omega)$." -/ +theorem lemma_11_11_claim_5 {S : Society α β} {D_set D₁ D₂ : Set (Graph α β × Graph α β)} + (hD : IsConsolidation S D_set) {C₁ C₂ : Graph α (Sym2 α)} {Ω₀ : CyclicPerm α} + (hC₁ : C₁ ≤ consolidationCore S D_set) (hC₂ : C₂ ≤ consolidationCore S D_set) + (hC_union : subgraphUnion (consolidationCore S D_set) C₁ C₂ = consolidationCore S D_set) + (hΩ : S.Ω.bar ⊆ V(C₂)) (hΩ₀ : V(C₁) ∩ V(C₂) = Ω₀.bar) + (hD_union : D₁ ∪ D₂ = D_set) (hD_disj : Disjoint D₁ D₂) + (hD₁ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₁ → V(A) ∩ V(B) ⊆ V(C₁)) + (hD₂ : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₂ → V(A) ∩ V(B) ⊆ V(C₂)) + {k : ℕ} {p_idx : Fin k → Graph α β × Graph α β} (hp_inj : Function.Injective p_idx) + (hp_range : range p_idx = D₂) {S₀ : Society α β} {S_fam : Fin k → Society α β} + (hS₀_G : S₀.G = subgraphUnion S.G ((S.G.induce (V(C₁) ∩ V(C₂))).restrict ∅) + (subgraphSUnion S.G (Prod.fst '' D₁))) + (hS₀_Ω : S₀.Ω = Ω₀) + (hS_fam_G : ∀ i : Fin k, (S_fam i).G = (p_idx i).1) + (hS_fam_bar : ∀ i : Fin k, (S_fam i).Ω.bar = V((p_idx i).1) ∩ V((p_idx i).2)) : + IsSocietySegregation S S₀ S_fam := by + let C_star : Graph α β := (S.G.induce (V(C₁) ∩ V(C₂))).restrict ∅ + let A₀ : Graph α β := subgraphUnion S.G C_star (subgraphSUnion S.G (Prod.fst '' D₁)) + let B₀ : Graph α β := subgraphUnion S.G C_star (subgraphSUnion S.G (Prod.fst '' D₂)) + have hD₁_sub : D₁ ⊆ D_set := hD_union ▸ subset_union_left + have hD₂_sub : D₂ ⊆ D_set := hD_union ▸ subset_union_right + have hp_mem_D₂ : ∀ i : Fin k, p_idx i ∈ D₂ := fun i => hp_range ▸ mem_range_self i + have hp_mem_D : ∀ i : Fin k, p_idx i ∈ D_set := fun i => hD₂_sub (hp_mem_D₂ i) + obtain ⟨hsep₀, _, _, _⟩ := + lemma_11_11_claim_2 hD hC₁ hC₂ hC_union hΩ hΩ₀ hD_union hD_disj hD₁ hD₂ + have hC_star_le_G : C_star ≤ S.G := restrict_le.trans (S.G.induce_le + (inter_subset_left.trans (hC₁.vertexSet_mono.trans (vertexSet_consolidationCore_subset S + D_set)))) + have hU₁_all : ∀ P ∈ Prod.fst '' D₁, P ≤ S.G := fun P hP => hD.forall_fst_le P + (image_mono hD₁_sub hP) + have hU₁_le_G : subgraphSUnion S.G (Prod.fst '' D₁) ≤ S.G := subgraphSUnion_le hU₁_all + refine ⟨hS₀_G ▸ hsep₀.1.1, fun i => hS_fam_G i ▸ hD.left_le (hp_mem_D i), ?_, ?_, ?_, ?_, ?_, + ?_, ?_⟩ + · refine subset_antisymm (union_subset (hS₀_G ▸ hsep₀.1.1.vertexSet_mono) + (iUnion_subset fun i => (hS_fam_G i ▸ hD.left_le (hp_mem_D i)).vertexSet_mono)) fun v hv => ?_ + obtain ⟨A, B, hAB, hvA⟩ := hD.exists_mem_of_mem_vertexSet hv + rcases (hD_union ▸ hAB : (A, B) ∈ D₁ ∪ D₂) with h1 | h2 + · left; rw [hS₀_G]; exact Or.inr (mem_iUnion₂.mpr ⟨A, ⟨(A, B), h1, rfl⟩, hvA⟩) + · right; rw [← hp_range] at h2; obtain ⟨i, hi⟩ := h2 + exact mem_iUnion.mpr ⟨i, by rw [hS_fam_G, hi]; exact hvA⟩ + · refine subset_antisymm (union_subset (hS₀_G ▸ hsep₀.1.1.edgeSet_mono) + (iUnion_subset fun i => (hS_fam_G i ▸ hD.left_le (hp_mem_D i)).edgeSet_mono)) fun e he => ?_ + obtain ⟨A, B, hAB, heA⟩ := hD.exists_mem_of_mem_edgeSet he + rcases (hD_union ▸ hAB : (A, B) ∈ D₁ ∪ D₂) with h1 | h2 + · left; rw [hS₀_G, edgeSet_subgraphUnion hC_star_le_G hU₁_le_G, edgeSet_subgraphSUnion hU₁_all] + exact Or.inr (mem_iUnion₂.mpr ⟨A, ⟨(A, B), h1, rfl⟩, heA⟩) + · right; rw [← hp_range] at h2; obtain ⟨i, hi⟩ := h2 + exact mem_iUnion.mpr ⟨i, by rw [hS_fam_G, hi]; exact heA⟩ + · intro i + rw [hS₀_G, hS_fam_G, edgeSet_subgraphUnion hC_star_le_G hU₁_le_G, + edgeSet_subgraphSUnion hU₁_all] + have hE_star : E(C_star) = ∅ := by simp [C_star] + rw [hE_star, empty_union, disjoint_iUnion₂_left] + rintro A ⟨⟨A', B'⟩, h1, rfl⟩ + have hne : (A', B') ≠ p_idx i := fun heq => disjoint_left.mp hD_disj h1 (heq ▸ hp_mem_D₂ i) + exact hD.disjoint_edges_of_ne (hD₁_sub h1) (hp_mem_D i) hne + · intro i j hij + rw [hS_fam_G i, hS_fam_G j] + exact hD.disjoint_edges_of_ne (hp_mem_D i) (hp_mem_D j) fun heq => hij (hp_inj heq) + · intro j v ⟨hv₀, hvj⟩ + rw [hS₀_G] at hv₀; rw [hS_fam_G j] at hvj; rw [hS₀_Ω, hS_fam_bar j, ← hΩ₀] + have hj_D : (p_idx j) ∈ D_set := hp_mem_D j + rcases hv₀ with hv_star | hv_U₁ + · exact ⟨hv_star, hvj, + (inter_subset_left.trans hC₁.vertexSet_mono).trans + (vertexSet_consolidationCore_subset_right hj_D) hv_star⟩ + · obtain ⟨A, ⟨⟨A', B'⟩, h1, rfl⟩, hvA'⟩ := mem_iUnion₂.mp hv_U₁ + have hne : (A', B') ≠ p_idx j := fun heq => disjoint_left.mp hD_disj h1 (heq ▸ hp_mem_D₂ j) + have hvB' : v ∈ V(B') := (hD.left_le_right hj_D (hD₁_sub h1) hne.symm).vertexSet_mono hvj + have hvBj : v ∈ V((p_idx j).2) := (hD.left_le_right (hD₁_sub h1) hj_D hne).vertexSet_mono hvA' + exact ⟨⟨hD₁ h1 ⟨hvA', hvB'⟩, hD₂ (hp_mem_D₂ j) ⟨hvj, hvBj⟩⟩, hvj, hvBj⟩ + · intro i j hij v ⟨hvi, hvj⟩ + rw [hS_fam_G i] at hvi; rw [hS_fam_G j] at hvj; rw [hS_fam_bar i, hS_fam_bar j] + have hne : p_idx i ≠ p_idx j := fun heq => hij (hp_inj heq) + exact ⟨⟨hvi, (hD.left_le_right (hp_mem_D j) (hp_mem_D i) hne.symm).vertexSet_mono hvj⟩, + ⟨hvj, (hD.left_le_right (hp_mem_D i) (hp_mem_D j) hne).vertexSet_mono hvi⟩⟩ + · intro v hvΩ + have hvB₀ : v ∈ V(B₀) := hsep₀.2 hvΩ + rcases hvB₀ with hv_star | hv_U₂ + · left; rw [hS₀_Ω, ← hΩ₀]; exact hv_star + · right; obtain ⟨A, ⟨p, hp₂, rfl⟩, hvA⟩ := mem_iUnion₂.mp hv_U₂ + rw [← hp_range] at hp₂; obtain ⟨i, rfl⟩ := hp₂ + exact mem_iUnion.mpr ⟨i, by + rw [hS_fam_bar i]; exact ⟨hvA, (hD.isSocietySeparation (hp_mem_D i)).2 hvΩ⟩⟩ + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section11d.lean b/LeanPool/GraphMinor/GM09/Section11d.lean new file mode 100644 index 0000000000..8952b6ca75 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section11d.lean @@ -0,0 +1,803 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.CliqueDiscs +public import LeanPool.GraphMinor.GM09.Section6c +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.GM09.Section3a + +/-! +# Graph Minors IX, (11.11) + +This file ends the proof of (11.11). Take a consolidation with smallest core. The core `(C, Ω)` is +4-connected and simple, so (6.1) and (11.5) split it into a society `(C₁, Ω₀)` with no large +transaction and a rural neighborhood `(C₂, Ω, Ω₀)`. The rest of the proof needs a closed disc for +each small clique of `C₂` that is not a clique of `C₁`. + +The paper says that a triangle of `C₂` "bounds a region of the drawing". This needs care, since the +triangle could go around `Δ₀`. In that case 4-connectivity shows that `ΩBar₀` is a set of at most +three +vertices of the triangle, and all of `C₁` lies in `C₂`. We then replace `Ω₀` by the empty cyclic +permutation and `C₁` by the empty graph, and choose `Δ₀` last. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- A set with at most three vertices that separates `A` from `B`, with `ΩBar` in `B`, in a +4-connected +society has `V(A) ⊆ V(B)`. The two sides may share edges. -/ +theorem Society.vertexSet_subset_of_isFourConnected {CS : Society α β} (hc : CS.IsKConnected 4) + {A B : Graph α β} (hA : A ≤ CS.G) (hB : B ≤ CS.G) (hV : V(A) ∪ V(B) = V(CS.G)) + (hE : E(A) ∪ E(B) = E(CS.G)) (hcard : (V(A) ∩ V(B)).ncard ≤ 3) (hΩ : CS.Ω.bar ⊆ V(B)) : + V(A) ⊆ V(B) := by + by_contra hn + have hne : V(B) ≠ V(CS.G) := fun h => hn (h ▸ hA.vertexSet_mono) + let A' : Graph α β := A.restrict (E(A) \ E(B)) + have hV' : V(A') = V(A) := rfl + have hE' : E(A') = E(A) \ E(B) := by + change E(A.restrict _) = _ + rw [edgeSet_restrict, inter_eq_right] + exact sdiff_subset + refine hc 3 (by omega) A' B ⟨⟨⟨restrict_le.trans hA, hB, ?_, ?_, ?_⟩, hΩ⟩, ?_, hne⟩ + · rw [hV', hV] + · rw [hE', sdiff_union_self, hE] + · rw [hE'] + exact disjoint_sdiff_left + · rw [hV'] + exact hcard + +/-- The `(6.1) + (11.5)` split of a core `CS = (C, Ω)` into a society `S₁ = (C₁, Ω₀)` and a rural +neighborhood `N₂ = (C₂, Ω, Ω₀)` with properties (i)–(iii) on page 75 of Graph Minors IX, with `q` in +place of `3p + 9`. -/ +structure CoreRuralDecomposition (q : ℕ) (CS : Society α (Sym2 α)) + (S₁ : Society α (Sym2 α)) (N₂ : Neighborhood α (Sym2 α)) : Prop where + /-- (i) `C₁ ⊆ C`. -/ + C₁_le : S₁.G ≤ CS.G + /-- (i) `C₂ ⊆ C`. -/ + C₂_le : N₂.G ≤ CS.G + /-- (i) `C₁ ∪ C₂ = C`. -/ + union_eq : subgraphUnion CS.G S₁.G N₂.G = CS.G + /-- `N₂.Ω = Ω`. -/ + Ω_eq : N₂.Ω = CS.Ω + /-- `N₂.Ω₀ = Ω₀`. -/ + Ω₀_eq : N₂.Ω₀ = S₁.Ω + /-- (i) `V(C₁ ∩ C₂) = ΩBar₀`. -/ + inter_eq_bar₀ : V(S₁.G) ∩ V(N₂.G) = S₁.Ω.bar + /-- `(C₂, Ω, Ω₀)` is a rural neighborhood. -/ + isRural : N₂.IsRural + /-- (ii) `(C₁, Ω₀)` has no transaction of cardinality `> q`. -/ + no_large_transaction : ∀ Q_set : Set (Graph α (Sym2 α)), + S₁.IsTransaction Q_set → Q_set.ncard ≤ q + /-- (iii) For every triangle `T` of `C`, either `T ⊆ C₁` or `T ⊆ C₂`. -/ + triangle_in_left_or_right : ∀ T : Graph α (Sym2 α), + IsTriangle CS.G T → T ≤ S₁.G ∨ T ≤ N₂.G + +namespace CoreRuralDecomposition + +variable {q : ℕ} {CS : Society α (Sym2 α)} {S₁ : Society α (Sym2 α)} {N₂ : Neighborhood α (Sym2 α)} + +theorem vertexSet_union (D : CoreRuralDecomposition q CS S₁ N₂) : + V(S₁.G) ∪ V(N₂.G) = V(CS.G) := by + have h := congrArg Graph.vertexSet D.union_eq + rwa [vertexSet_subgraphUnion] at h + +theorem edgeSet_union (D : CoreRuralDecomposition q CS S₁ N₂) : + E(S₁.G) ∪ E(N₂.G) = E(CS.G) := by + have h := congrArg Graph.edgeSet D.union_eq + rwa [edgeSet_subgraphUnion D.C₁_le D.C₂_le] at h + +end CoreRuralDecomposition + +/-- The drawing of a triangle is the union of the closures of its three edges. -/ +theorem subgraphU_eq_of_triangle {G T : Graph α β} (Γ : GraphDrawing G EuclideanPlane) (hT : T ≤ G) + {x y z : α} {e₁ e₂ e₃ : β} (hV : V(T) = {x, y, z}) (hE : E(T) = {e₁, e₂, e₃}) + (h₁ : G.IsLink e₁ x y) (h₂ : G.IsLink e₂ y z) : + graphDrawingSubgraphU Γ T = closure (graphDrawingEdgeSet Γ e₁) ∪ + closure (graphDrawingEdgeSet Γ e₂) ∪ closure (graphDrawingEdgeSet Γ e₃) := by + have hv₁ := (closure_inter_V_of_isLink Γ h₁).2 + have hv₂ := (closure_inter_V_of_isLink Γ h₂).2 + have hmem : ∀ {w : α} {e : β} {S : Set EuclideanPlane}, + closure (graphDrawingEdgeSet Γ e) ∩ Γ.drawing.V = S → vertexPt Γ w ∈ S → w ∈ V(G) → + vertexPt Γ w ∈ closure (graphDrawingEdgeSet Γ e) := by + intro w e S hS hw _ + have h : vertexPt Γ w ∈ closure (graphDrawingEdgeSet Γ e) ∩ Γ.drawing.V := by + rw [hS] + exact hw + exact h.1 + apply Subset.antisymm + · intro p hp + rcases mem_subgraphU_cases Γ hT hp with ⟨v, hv, rfl⟩ | ⟨e, he, hpe, -⟩ + · rw [hV] at hv + rcases hv with rfl | rfl | rfl + · exact Or.inl (Or.inl (hmem hv₁ (Or.inl rfl) h₁.left_mem)) + · exact Or.inl (Or.inl (hmem hv₁ (Or.inr rfl) h₁.right_mem)) + · exact Or.inl (Or.inr (hmem hv₂ (Or.inr rfl) h₂.right_mem)) + · rw [hE] at he + rcases he with rfl | rfl | rfl + · exact Or.inl (Or.inl (subset_closure hpe)) + · exact Or.inl (Or.inr (subset_closure hpe)) + · exact Or.inr (subset_closure hpe) + · have hin : ∀ e ∈ E(T), closure (graphDrawingEdgeSet Γ e) ⊆ graphDrawingSubgraphU Γ T := + fun e he p hp => Or.inr (mem_iUnion₂.mpr ⟨e, he, hp⟩) + refine union_subset (union_subset (hin _ ?_) (hin _ ?_)) (hin _ ?_) <;> rw [hE] <;> simp + +variable {N : Neighborhood α (Sym2 α)} + +/-- A triangle of a simple neighborhood is drawn as an `O`-arc. We give the three edges as `s(x, +y)`, +`s(y, z)` and `s(z, x)`. -/ +theorem isOArc_triangle (P : Presentation N) (_hs : IsSimpleGraph N.G) {x y z : α} + (hxy : x ≠ y) (hyz : y ≠ z) (hzx : z ≠ x) + (h₁ : N.G.IsLink s(x, y) x y) (h₂ : N.G.IsLink s(y, z) y z) (h₃ : N.G.IsLink s(z, x) z x) : + IsOArc (closure (graphDrawingEdgeSet P.Γ s(x, y)) ∪ closure (graphDrawingEdgeSet P.Γ s(y, z)) ∪ + closure (graphDrawingEdgeSet P.Γ s(z, x))) := by + have hne₁₂ : s(x, y) ≠ s(y, z) := by + intro h + rcases Sym2.eq_iff.mp h with ⟨h, -⟩ | ⟨h, -⟩ + · exact hxy h + · exact hzx h.symm + have hne₂₃ : s(y, z) ≠ s(z, x) := by + intro h + rcases Sym2.eq_iff.mp h with ⟨h, -⟩ | ⟨h, -⟩ + · exact hyz h + · exact hxy h.symm + have hne₃₁ : s(z, x) ≠ s(x, y) := by + intro h + rcases Sym2.eq_iff.mp h with ⟨h, -⟩ | ⟨h, -⟩ + · exact hzx h + · exact hyz h.symm + have hi₁₂ := closure_inter_closure P.Γ h₁.symm h₂ hzx.symm hne₁₂ + have hi₁₃ := closure_inter_closure P.Γ h₁ h₃.symm hyz hne₃₁.symm + have hi₂₃ := closure_inter_closure P.Γ h₂.symm h₃ hxy.symm hne₂₃ + have hl₁ := isLine_closure_of_isLink P.Γ h₁ hxy + have hl₂ := isLine_closure_of_isLink P.Γ h₂ hyz + have hl₃ := isLine_closure_of_isLink P.Γ h₃ hzx + refine GraphMinor.GM14.isOArc_union (hl₁.union hl₂ hi₁₂) hl₃.symm ?_ + rintro p ⟨hp | hp, hp₃⟩ + · have h : p ∈ closure (graphDrawingEdgeSet P.Γ s(x, y)) ∩ + closure (graphDrawingEdgeSet P.Γ s(z, x)) := ⟨hp, hp₃⟩ + rw [hi₁₃] at h + exact Or.inl h + · have h : p ∈ closure (graphDrawingEdgeSet P.Γ s(y, z)) ∩ + closure (graphDrawingEdgeSet P.Γ s(z, x)) := ⟨hp, hp₃⟩ + rw [hi₂₃] at h + exact Or.inr h + +/-- A point of a drawing is a vertex or it lies on an edge. -/ +theorem mem_U_cases {G : Graph α β} (Γ : GraphDrawing G EuclideanPlane) {x : EuclideanPlane} + (hx : x ∈ Γ.drawing.U) : + (∃ v ∈ V(G), x = vertexPt Γ v) ∨ + (∃ e ∈ E(G), x ∈ graphDrawingEdgeSet Γ e ∧ x ∉ Γ.drawing.V) := by + by_cases hV : x ∈ Γ.drawing.V + · exact Or.inl (exists_vertexPt_of_mem_V Γ hV) + · obtain ⟨f, hf, hxf⟩ := exists_edge_of_mem' hx hV + let e := Γ.iso.edgeEquiv.symm ⟨f, hf⟩ + refine Or.inr ⟨e.1, e.2, ?_, hV⟩ + rw [graphDrawingEdgeSet_eq Γ e.2] + simpa [e] using hxf + +/-- **The triangles of the rural part bound empty regions.** Let `(C₁, Ω₀)` and `(C₂, Ω, Ω₀)` split +the 4-connected simple society `CS`. Let `K` be a set of three pairwise adjacent vertices of `C₂`. +If `Δ₀` is empty or `ΩBar₀` is not a clique of `C₂`, the triangle bounds a closed disc in `Δ` whose +interior misses the drawing and `Δ₀`. The separation given by the disc has order three, so +4-connectivity leaves nothing on the side away from `ΩBar`. -/ +theorem exists_emptyRegion {q : ℕ} {CS S₁ : Society α (Sym2 α)} + (D : CoreRuralDecomposition q CS S₁ N) (hc : CS.IsKConnected 4) (hs : IsSimpleGraph N.G) + (P : Presentation N) (hΔ₀ : P.Δ₀ = ∅ ∨ ¬ IsLeThreeClique N.G N.Ω₀.bar) {K : Set α} + (hK : IsLeThreeClique N.G K) (h3 : K.ncard = 3) : ∃ E, IsEmptyRegion P K E := by + classical + obtain ⟨x, y, z, hxy, hxz, hyz, rfl⟩ := Set.ncard_eq_three.mp h3 + have hx : x ∈ ({x, y, z} : Set α) := Or.inl rfl + have hy : y ∈ ({x, y, z} : Set α) := Or.inr (Or.inl rfl) + have hz : z ∈ ({x, y, z} : Set α) := Or.inr (Or.inr rfl) + have hl₁ := hK.2.2 x hx y hy hxy + have hl₂ := hK.2.2 y hy z hz hyz + have hl₃ := hK.2.2 z hz x hx hxz.symm + obtain ⟨T, hT, hVT, hl₁T, hl₂T, hl₃T⟩ := + exists_triangle_of_three_clique hxy hyz hxz.symm hl₁ hl₂ hl₃ + have hTle : T ≤ N.G := hT.1.1 + have hO := isOArc_triangle P hs hxy hyz hxz.symm hl₁ hl₂ hl₃ + have hET : E(T) = {s(x, y), s(y, z), s(z, x)} := by + symm + refine Set.eq_of_subset_of_ncard_le ?_ ?_ (N.finite_E.subset hTle.edgeSet_mono) + · rintro e (rfl | rfl | rfl) + exacts [hl₁T.edge_mem, hl₂T.edge_mem, hl₃T.edge_mem] + · rw [hT.2] + refine (Set.ncard_eq_three.mpr ⟨s(x, y), s(y, z), s(z, x), ?_, ?_, ?_, rfl⟩).ge + · intro h + rcases Sym2.eq_iff.mp h with ⟨h, -⟩ | ⟨h, -⟩ + · exact hxy h + · exact hxz h + · intro h + rcases Sym2.eq_iff.mp h with ⟨h, -⟩ | ⟨-, h⟩ + · exact hxz h + · exact hyz h + · intro h + rcases Sym2.eq_iff.mp h with ⟨h, -⟩ | ⟨h, -⟩ + · exact hyz h + · exact hxy h.symm + have hU := subgraphU_eq_of_triangle P.Γ hTle hVT hET hl₁ hl₂ + rw [← hU] at hO + have hUsub : graphDrawingSubgraphU P.Γ T ⊆ P.Γ.drawing.U := subgraphU_subset_U P.Γ hTle + obtain ⟨E₀, ⟨hsub, hd, hb, -⟩, -⟩ := disc_oArc P.Δ _ P.isClosedDisc_Δ + (hUsub.trans fun p hp => (P.U_subset hp).1) hO + have hsubBd : subBd E₀ = graphDrawingSubgraphU P.Γ T := by + rw [subBd_eq_discBd_plane hd, hb] + obtain ⟨H₁, H₂, hsep, hVi, hTH, hin, hout, hU₁, hU₂⟩ := exists_separation_of_disc P.Γ + P.isClosedDisc_Δ.isCompact.isClosed (fun p hp => (P.U_subset hp).1) hTle hd hsub hsubBd + have hH₁C := hsep.1.trans D.C₂_le + have hH₂C := hsep.2.1.trans D.C₂_le + have hbdi : Disjoint (interior E₀) (discBd E₀) := by + rw [interior_eq_discInt_plane hd, disjoint_left] + exact fun p hp h => hp.2 h + have hbdiff : ∀ {p : EuclideanPlane}, p ∈ E₀ → p ∉ interior E₀ → + p ∈ graphDrawingSubgraphU P.Γ T := by + intro p hp hi + rw [interior_eq_discInt_plane hd] at hi + rw [← hb] + by_contra h + exact hi ⟨hp, h⟩ + have hptK : ∀ {v : α}, v ∈ V(N.G) → vertexPt P.Γ v ∈ graphDrawingSubgraphU P.Γ T → + v ∈ ({x, y, z} : Set α) := fun hv h => hVT ▸ mem_vertexSet_of_vertexPt_mem P.Γ hTle hv h + have hH₂int : ∀ {v : α}, v ∈ V(H₂) → vertexPt P.Γ v ∉ interior E₀ := fun hv => + (hU₂ (vertexPt_mem_subgraphU P.Γ hv hsep.2.1)).2 + have hH₁E : ∀ {v : α}, v ∈ V(H₁) → vertexPt P.Γ v ∈ E₀ := fun hv => + hU₁ (vertexPt_mem_subgraphU P.Γ hv hsep.1) + have hKH₂ : ({x, y, z} : Set α) ⊆ V(H₂) := by + rw [← hVT, ← hVi] + exact inter_subset_right + have hN : ∀ {v : α}, v ∈ V(H₁) ∪ V(H₂) → v ∈ V(N.G) := fun hv => hsep.2.2.1 ▸ hv + have hbar : CS.Ω.bar ⊆ V(H₂) := by + intro v hv + have hv' : v ∈ N.Ω.bar := D.Ω_eq ▸ hv + have hvN := N.bar_subset hv' + have hvb : vertexPt P.Γ v ∈ subBd P.Δ := + (IsCleanPresentation.vertexSet_subset_iff hvN).mp ((P.mem_bd_Δ_iff v hvN).mpr hv') + by_cases hvE : vertexPt P.Γ v ∈ E₀ + · refine hKH₂ (hptK hvN (hbdiff hvE fun hi => ?_)) + exact disjoint_left.mp (disjoint_interior_subBd P.Δ) (interior_mono hsub hi) hvb + · refine hout v hvN ?_ + rw [vertexSet_eq_vertexPt P.Γ hvN, singleton_subset_iff] + exact ⟨(P.U_subset (IsTidyPresentation.mem_U hvN)).1, hvE⟩ + have hbar₀ : ∀ {v : α}, v ∈ V(S₁.G) → v ∈ V(N.G) → v ∈ N.Ω₀.bar := fun h₁ h₂ => by + rw [D.Ω₀_eq, ← D.inter_eq_bar₀] + exact ⟨h₁, h₂⟩ + have hpt₀ : ∀ {v : α}, v ∈ N.Ω₀.bar → vertexPt P.Γ v ∈ P.Δ₀ := fun hv => + subBd_subset_of_isClosed (isClosed_Δ₀ P) ((IsCleanPresentation.vertexSet_subset_iff + (N.bar₀_subset hv)).mp ((P.mem_bd_Δ₀_iff _ (N.bar₀_subset hv)).mpr hv)) + have hcard : ∀ {W : Set α}, W ⊆ {x, y, z} → W.ncard ≤ 3 := fun hW => + (Set.ncard_le_ncard hW (N.finite_V.subset hK.1)).trans h3.le + -- `Δ₀` lies on one side of the triangle. + have hside : Disjoint (interior E₀) P.Δ₀ := by + have hdis : P.Δ₀ = ∅ ∨ (IsClosedDisc P.Δ₀) := by + rcases P.agrees_Δ₀ with ⟨h, -⟩ | ⟨h, -⟩ + · exact Or.inl h + · exact Or.inr h + rcases hdis with h₀ | h₀ + · rw [h₀] + exact disjoint_empty _ + have hdj : Disjoint (interior P.Δ₀) (discBd E₀) := by + rw [hb, disjoint_left] + exact fun p hp hp' => (P.U_subset (hUsub hp')).2 hp + have hpre : IsPreconnected (interior P.Δ₀) := by + rw [interior_eq_discInt_plane h₀] + exact h₀.isPreconnected_discInt + rcases subset_interior_or_compl hd hpre hdj with hin₀ | hout₀ + · exfalso + have hsub₀ : P.Δ₀ ⊆ E₀ := by + rw [← closure_interior_of_isClosedDisc h₀] + exact closure_minimal (hin₀.trans interior_subset) hd.isCompact.isClosed + let A : Graph α (Sym2 α) := subgraphUnion CS.G S₁.G H₁ + have hAle : A ≤ CS.G := subgraphUnion_le D.C₁_le hH₁C + have hkey : ∀ {v : α}, v ∈ V(S₁.G) → v ∈ V(H₂) → v ∈ ({x, y, z} : Set α) := by + intro v h₁ h₂ + have hvN := hN (Or.inr h₂) + exact hptK hvN (hbdiff (hsub₀ (hpt₀ (hbar₀ h₁ hvN))) (hH₂int h₂)) + have hinter : V(A) ∩ V(H₂) ⊆ {x, y, z} := by + rintro v ⟨h₁ | h₁, h₂⟩ + · exact hkey h₁ h₂ + · rw [← hVT, ← hVi] + exact ⟨h₁, h₂⟩ + have hsubV := CS.vertexSet_subset_of_isFourConnected hc hAle hH₂C + (by + rw [vertexSet_subgraphUnion, union_assoc, hsep.2.2.1, D.vertexSet_union]) + (by + rw [edgeSet_subgraphUnion D.C₁_le hH₁C, union_assoc, hsep.2.2.2.1, D.edgeSet_union]) + (hcard hinter) hbar + have hsubK : N.Ω₀.bar ⊆ {x, y, z} := by + intro v hv + have hv₁ : v ∈ V(S₁.G) := S₁.bar_subset (D.Ω₀_eq ▸ hv) + exact hkey hv₁ (hsubV (Or.inl hv₁)) + refine hΔ₀.elim (fun h => ?_) fun hn => + hn ⟨hsubK.trans hK.1, (encard_mono hsubK).trans hK.2.1, ?_⟩ + · have hne := h₀.nonempty_discInt.mono (discInt_subset _) + rw [h] at hne + exact hne.ne_empty rfl + · exact fun u hu w hw huw => hK.2.2 u (hsubK hu) w (hsubK hw) huw + · rw [disjoint_left] + intro p hp hp₀ + have hcl : p ∈ closure (interior P.Δ₀) := by + rw [closure_interior_of_isClosedDisc h₀] + exact hp₀ + obtain ⟨w, hwo, hw⟩ := mem_closure_iff.mp hcl _ isOpen_interior hp + exact hout₀ hw (interior_subset hwo) + -- So the side of the disc is empty. + have hkey : ∀ {v : α}, v ∈ V(H₁) → v ∈ V(S₁.G) → v ∈ ({x, y, z} : Set α) := by + intro v h₁ h₂ + have hvN := hN (Or.inl h₁) + exact hptK hvN (hbdiff (hH₁E h₁) (disjoint_right.mp hside (hpt₀ (hbar₀ h₂ hvN)))) + let B : Graph α (Sym2 α) := subgraphUnion CS.G S₁.G H₂ + have hBle : B ≤ CS.G := subgraphUnion_le D.C₁_le hH₂C + have hinter : V(H₁) ∩ V(B) ⊆ {x, y, z} := by + rintro v ⟨h₁, h₂ | h₂⟩ + · exact hkey h₁ h₂ + · rw [← hVT, ← hVi] + exact ⟨h₁, h₂⟩ + have hsubV := CS.vertexSet_subset_of_isFourConnected hc hH₁C hBle + (by + rw [vertexSet_subgraphUnion, union_left_comm, hsep.2.2.1, D.vertexSet_union]) + (by + rw [edgeSet_subgraphUnion D.C₁_le hH₂C, union_left_comm, hsep.2.2.2.1, D.edgeSet_union]) + (hcard hinter) (hbar.trans subset_union_right) + have hH₁K : V(H₁) ⊆ {x, y, z} := fun v hv => hinter ⟨hv, hsubV hv⟩ + have hintU : Disjoint (interior E₀) P.Γ.drawing.U := by + rw [disjoint_left] + intro p hp hpU + have hnot : p ∉ graphDrawingSubgraphU P.Γ T := by + rw [← hb] + exact disjoint_left.mp hbdi hp + rcases mem_U_cases P.Γ hpU with ⟨v, hv, rfl⟩ | ⟨e, he, hpe, hpV⟩ + · have hv₁ : v ∈ V(H₁) := by + refine hin v hv ?_ + rw [vertexSet_eq_vertexPt P.Γ hv, singleton_subset_iff, subBd_eq_discBd_plane hd] + rw [interior_eq_discInt_plane hd] at hp + exact hp + exact hnot (vertexPt_mem_subgraphU P.Γ (hVT ▸ hH₁K hv₁) hTle) + · have hEu : e ∈ E(H₁) ∪ E(H₂) := hsep.2.2.2.1 ▸ he + rcases hEu with he₁ | he₂ + · obtain ⟨u, w, hl⟩ := H₁.exists_isLink_of_mem_edgeSet he₁ + have hlN := hl.mono hsep.1 + have huw : u ≠ w := hs.ne_of_isLink hlN + have hlK := hK.2.2 u (hH₁K hl.left_mem) w (hH₁K hl.right_mem) huw + have hee : e = s(u, w) := hs.2 e hlN.edge_mem _ hlK.edge_mem u w hlN hlK + have heT : e ∈ E(T) := by + rw [hET, hee] + have hu := hH₁K hl.left_mem + have hw := hH₁K hl.right_mem + rcases hu with rfl | rfl | rfl <;> rcases hw with rfl | rfl | rfl <;> + first + | exact (huw rfl).elim + | simp [Sym2.eq_swap] + exact hnot (Or.inr (mem_iUnion₂.mpr ⟨e, heT, subset_closure hpe⟩)) + · exact (hU₂ (Or.inr (mem_iUnion₂.mpr ⟨e, he₂, subset_closure hpe⟩))).2 hp + refine ⟨E₀, hd, hsub, hb ▸ hUsub, fun v hv => ⟨fun h => hptK hv (hb ▸ h), fun h => ?_⟩, hintU, + hside⟩ + rw [hb] + exact vertexPt_mem_subgraphU P.Γ (hVT ▸ h) hTle + +/-- The cyclic permutation of the empty set. -/ +def emptyCyclicPerm : CyclicPerm α where + bar := ∅ + toFun := id + finite_bar := finite_empty + bijOn := bijOn_empty id + single_orbit := fun _ hx => hx.elim + +instance : Nonempty (CyclicPerm α) := ⟨emptyCyclicPerm⟩ + +/-- The core of a consolidation is a simple graph. -/ +theorem isSimpleGraph_consolidationCore (S : Society α β) (D_set : Set (Graph α β × Graph α β)) : + IsSimpleGraph (consolidationCore S D_set) := + ⟨fun _ _ _ h => h.1 rfl, fun _ _ _ _ _ _ h₁ h₂ => h₁.2.1.trans h₂.2.1.symm⟩ + +/-- A society with empty `ΩBar` has no nonempty transaction. -/ +theorem Society.eq_empty_of_isTransaction {S : Society α β} (hbar : S.Ω.bar = ∅) + {Q : Set (Graph α β)} (hQ : S.IsTransaction Q) : Q = ∅ := by + obtain ⟨A, B, -, hF, hP⟩ := hQ + rw [eq_empty_iff_forall_notMem] + intro R hR + obtain ⟨a, ha, -⟩ := hP R hR + have := hF.1 ha + rw [hbar] at this + exact this + +/-- If the rural part of a split is all of `C`, we may drop `C₁` and `Ω₀`: the core is a rural +neighborhood `N'` with empty `Ω₀` and `Δ₀`, and the society left over is the empty graph. -/ +theorem exists_core_decomposition_of_eq {CS : Society α (Sym2 α)} (hs : IsSimpleGraph CS.G) + {N₂ : Neighborhood α (Sym2 α)} (hr : N₂.IsRural) (hEq : N₂.G = CS.G) (hΩ : N₂.Ω = CS.Ω) + (q : ℕ) : + ∃ (S₁ : Society α (Sym2 α)) (N' : Neighborhood α (Sym2 α)) (P : Presentation N'), + CoreRuralDecomposition q CS S₁ N' ∧ IsTidyPresentation P ∧ P.Δ₀ = ∅ ∧ + S₁.Ω.bar = ∅ := by + obtain ⟨P, h₁, -, -⟩ := hr.exists_clean + have hC₂ : N₂.G ≤ CS.G := hEq.le + have hsN := hs.mono hC₂ + let N' : Neighborhood α (Sym2 α) := + { N₂ with + Ω₀ := emptyCyclicPerm + bar₀_subset := empty_subset _ } + let S' : Society α (Sym2 α) := + { G := ⊥ + Ω := emptyCyclicPerm + finite_V := finite_empty + finite_E := finite_empty + bar_subset := empty_subset _ } + have hb : subBd (∅ : Set EuclideanPlane) = ∅ := by simp [subBd] + have hbd₀ : ∀ v ∈ V(N'.G), graphDrawingVertexSet P.Γ v ⊆ subBd ∅ ↔ v ∈ N'.Ω₀.bar := by + intro v hv + constructor + · intro h + have hm : vertexPt P.Γ v ∈ graphDrawingVertexSet P.Γ v := + (mem_vertexSet_iff P.Γ hv).mpr rfl + have := h hm + rw [hb] at this + exact this.elim + · intro h + exact (h : v ∈ (∅ : Set α)).elim + let P' : Presentation N' := + ⟨P.Γ, P.Δ, ∅, P.isClosedDisc_Δ, empty_subset _, + fun x hx => ⟨(P.U_subset hx).1, by simp⟩, P.mem_bd_Δ_iff, hbd₀, P.agrees_Δ, + Or.inl ⟨rfl, rfl⟩⟩ + have hle : (⊥ : Graph α (Sym2 α)) ≤ CS.G := bot_le + refine ⟨S', N', P', ⟨hle, hC₂, ?_, hΩ, rfl, ?_, ?_, ?_, ?_⟩, ?_, rfl, rfl⟩ + · refine (Compatible.of_le_le (subgraphUnion_le hle hC₂) le_rfl).ext ?_ ?_ + · rw [vertexSet_subgraphUnion] + rw [vertexSet_bot, empty_union, hEq] + · rw [edgeSet_subgraphUnion hle hC₂] + rw [edgeSet_bot, empty_union, hEq] + · change V(⊥) ∩ V(N₂.G) = ∅ + rw [vertexSet_bot, empty_inter] + · exact ⟨P'.Γ, P'.Δ, P'.Δ₀, P'.isClosedDisc_Δ, P'.Δ₀_subset_Δ, P'.U_subset, P'.mem_bd_Δ_iff, + P'.mem_bd_Δ₀_iff, P'.agrees_Δ, P'.agrees_Δ₀⟩ + · intro Q hQ + rw [Society.eq_empty_of_isTransaction (S := S') rfl hQ] + simp + · intro T hT + right + change T ≤ N₂.G + rw [hEq] + exact hT.1.1 + · refine IsTidyPresentation.of_clean (P := P') hsN h₁ ?_ ?_ + · change (∅ : Set EuclideanPlane) ∩ _ ⊆ _ + rw [empty_inter] + exact empty_subset _ + · change _ ∩ subBd ∅ ⊆ _ + rw [hb, inter_empty] + exact empty_subset _ + +/-- The split of a 4-connected simple society of bounded sophistication, with a tidy presentation of +the rural part. Either `Δ₀` is empty, or `ΩBar₀` is not a clique of the rural part, so that no +triangle +goes around `Δ₀`. In the first case, `ΩBar₀` had at most three vertices, forming a clique of `C₂`. +Then +all of `C₁` lies in `C₂` by 4-connectivity, and we drop `C₁` and `Ω₀`. -/ +theorem exists_core_decomposition {CS : Society α (Sym2 α)} (hc : CS.IsKConnected 4) + (hs : IsSimpleGraph CS.G) {p : ℕ} (hsoph : CS.HasSophisticationLE p) : + ∃ (S₁ : Society α (Sym2 α)) (N₂ : Neighborhood α (Sym2 α)) (P : Presentation N₂), + CoreRuralDecomposition (p + 2) CS S₁ N₂ ∧ IsTidyPresentation P ∧ + (P.Δ₀ = ∅ ∨ ¬ IsLeThreeClique N₂.G N₂.Ω₀.bar) := by + obtain ⟨S₁, N₂, hr, hΩ, hΩ₀, hC₁, hC₂, hun, hint, hno, htri⟩ := theorem_11_5_proof CS hs hsoph + have D : CoreRuralDecomposition (p + 2) CS S₁ N₂ := ⟨hC₁, hC₂, hun, hΩ, hΩ₀, hint, hr, hno, htri⟩ + have hsN := hs.mono hC₂ + by_cases hcl : IsLeThreeClique N₂.G N₂.Ω₀.bar + · have hVsub : V(S₁.G) ⊆ V(N₂.G) := CS.vertexSet_subset_of_isFourConnected hc hC₁ hC₂ + D.vertexSet_union D.edgeSet_union + (by rw [D.inter_eq_bar₀, ← hΩ₀]; exact hcl.finite_ncard_le.2) + (hΩ ▸ N₂.bar_subset) + have hbar : ∀ v ∈ V(S₁.G), v ∈ N₂.Ω₀.bar := by + intro v hv + rw [hΩ₀, ← D.inter_eq_bar₀] + exact ⟨hv, hVsub hv⟩ + have hEsub : E(S₁.G) ⊆ E(N₂.G) := by + intro e he + obtain ⟨u, w, hl⟩ := S₁.G.exists_isLink_of_mem_edgeSet he + have hlC := hl.mono hC₁ + have huw := hs.ne_of_isLink hlC + have hlN := hcl.2.2 u (hbar u hl.left_mem) w (hbar w hl.right_mem) huw + have hlN' := hlN.mono hC₂ + have hee : e = s(u, w) := hs.2 e hlC.edge_mem _ hlN'.edge_mem u w hlC hlN' + rw [hee] + exact hlN.edge_mem + have hEq : N₂.G = CS.G := by + refine (Compatible.of_le_le hC₂ le_rfl).ext ?_ ?_ + · rw [← D.vertexSet_union, union_eq_right.mpr hVsub] + · rw [← D.edgeSet_union, union_eq_right.mpr hEsub] + obtain ⟨S', N', P', D', hT', h₀, -⟩ := exists_core_decomposition_of_eq hs hr hEq hΩ (p + 2) + exact ⟨S', N', P', D', hT', Or.inl h₀⟩ + · obtain ⟨P, h₁, h₂, h₃⟩ := hr.exists_clean + exact ⟨S₁, N₂, P, D, IsTidyPresentation.of_clean hsN h₁ h₂ h₃, Or.inr hcl⟩ + +/-- Clockwise agreement of a drawing gives clockwise agreement of its vertex map. -/ +theorem agreesWith_of_drawing {G : Graph α β} {Γ : GraphDrawing G EuclideanPlane} {Ω : CyclicPerm α} + {C : Set EuclideanPlane} {φ : Circle ≃ₜ C} (hbar : Ω.bar ⊆ V(G)) + (h : DrawingAgreesWithOArcHomeo Γ Ω C φ) : AgreesWithOArcHomeo (vertexPt Γ) Ω C φ := by + refine ⟨fun v hv => h.1 v hv ((mem_vertexSet_iff Γ (hbar hv)).mpr rfl), fun v₁ v₂ v₃ hc => ?_⟩ + obtain ⟨t₁, t₂, t₃, h₁, h₂, h₃, m₁, m₂, m₃⟩ := h.2 v₁ v₂ v₃ hc + have hm : ∀ v ∈ [v₁, v₂, v₃], v ∈ V(G) := fun v hv => hbar (hc.2.1 v hv) + exact ⟨t₁, t₂, t₃, h₁, h₂, h₃, (mem_vertexSet_iff Γ (hm v₁ (by simp))).mp m₁, + (mem_vertexSet_iff Γ (hm v₂ (by simp))).mp m₂, (mem_vertexSet_iff Γ (hm v₃ (by simp))).mp m₃⟩ + +/-- The discs, points and cyclic permutations for the family `F` that the last part of the proof of +(11.11) of Graph Minors IX uses (page 76). -/ +def RuralCliqueDiscSelection (N₂ : Neighborhood α (Sym2 α)) (F : Set (Set α)) : Prop := + ∃ (Δ Δ₀ : Set EuclideanPlane) (α_pt : α → EuclideanPlane) + (β_disc : Set α → Set EuclideanPlane) (Ω_clique : Set α → CyclicPerm α), + IsClosedDisc Δ ∧ + (IsClosedDisc Δ₀ ∧ Δ₀ ⊆ Δ) ∧ + (∃ φ : Circle ≃ₜ subBd Δ, + IsClockwiseDiscHomeo Δ φ ∧ AgreesWithOArcHomeo α_pt N₂.Ω (subBd Δ) φ) ∧ + (∃ φ₀ : Circle ≃ₜ subBd Δ₀, + IsClockwiseDiscHomeo Δ₀ φ₀ ∧ AgreesWithOArcHomeo α_pt N₂.Ω₀ (subBd Δ₀) φ₀) ∧ + (Δ₀ ∩ subBd Δ ⊆ α_pt '' (N₂.Ω₀.bar ∩ N₂.Ω.bar)) ∧ + InjOn α_pt V(N₂.G) ∧ + (∀ K ∈ F, IsClosedDisc (β_disc K) ∧ β_disc K ⊆ Δ) ∧ + (∀ K ∈ F, (Ω_clique K).bar = K) ∧ + (∀ K ∈ F, ∃ φ_K : Circle ≃ₜ subBd (β_disc K), + IsClockwiseDiscHomeo (β_disc K) φ_K ∧ + AgreesWithOArcHomeo α_pt (Ω_clique K) (subBd (β_disc K)) φ_K) ∧ + (∀ K ∈ F, Δ₀ ∩ β_disc K ⊆ α_pt '' (N₂.Ω₀.bar ∩ K)) ∧ + (∀ K ∈ F, β_disc K ∩ subBd Δ ⊆ α_pt '' (K ∩ N₂.Ω.bar)) ∧ + (∀ K ∈ F, ∀ K' ∈ F, K ≠ K' → β_disc K ∩ β_disc K' ⊆ α_pt '' (K ∩ K')) + +/-- The boundary of a closed disc as an `O`-arc, in the form the arrangements use. -/ +theorem nonempty_homeomorph_subBd {D : Set EuclideanPlane} (hD : IsClosedDisc D) : + Nonempty (Circle ≃ₜ subBd D) := by + rw [subBd_eq_discBd_plane hD] + exact hD.isOArc_discBd + +/-- The selection of discs. If `Δ₀` is empty, we choose a new `Δ₀` last, away from the other discs. +-/ +theorem exists_selection {P : Presentation N} (T : IsTidyPresentation P) {F : Set (Set α)} + (C : IsCliqueFamily P F) : RuralCliqueDiscSelection N F := by + classical + obtain ⟨β, hβ, hp⟩ := exists_clique_discs T C + have hKV : ∀ K ∈ F, K ⊆ V(N.G) := fun K hK => (C.clique K hK).1 + have hfin : ∀ K ∈ F, K.Finite := fun K hK => N.finite_V.subset (hKV K hK) + have hΩex : ∀ K ∈ F, ∃ Ω : CyclicPerm α, Ω.bar = K ∧ ∃ φ : Circle ≃ₜ subBd (β K), + IsClockwiseDiscHomeo (β K) φ ∧ + AgreesWithOArcHomeo (vertexPt P.Γ) Ω (subBd (β K)) φ := by + intro K hK + have B := hβ K hK + obtain ⟨φ, hφ_cw⟩ := exists_isClockwiseDiscHomeo B.disc + obtain ⟨Ω, hbar, hag, -⟩ := exists_cyclicPerm_of_oArc P.Γ φ (hKV K hK) (hfin K hK) + (fun v hv => by + rw [subBd_eq_discBd_plane B.disc] + exact B.bd v hv) + exact ⟨Ω, hbar, φ, hφ_cw, agreesWith_of_drawing (hbar ▸ hKV K hK) hag⟩ + choose! Ω hΩ hag using hΩex + obtain ⟨φ, hφ_cw, hφ⟩ := P.agrees_Δ + have hΔ₀ex : ∃ Δ₀ : Set EuclideanPlane, (IsClosedDisc Δ₀ ∧ Δ₀ ⊆ P.Δ) ∧ + (∃ φ₀ : Circle ≃ₜ subBd Δ₀, + IsClockwiseDiscHomeo Δ₀ φ₀ ∧ AgreesWithOArcHomeo (vertexPt P.Γ) N.Ω₀ (subBd Δ₀) φ₀) ∧ + Δ₀ ∩ subBd P.Δ ⊆ vertexPt P.Γ '' (N.Ω₀.bar ∩ N.Ω.bar) ∧ + ∀ K ∈ F, Δ₀ ∩ β K ⊆ vertexPt P.Γ '' (N.Ω₀.bar ∩ K) := by + rcases P.agrees_Δ₀ with ⟨-, hemp⟩ | ⟨hd, φ₀, hφ₀_cw, hag₀⟩ + · let Z : Set EuclideanPlane := ⋃ K ∈ F, β K + have hZ : IsClosed Z := C.finite.isClosed_biUnion fun K hK => + (hβ K hK).disc.isCompact.isClosed + have hZf : (Z ∩ discBd P.Δ).Finite := by + refine ((C.finite.biUnion hfin).image (vertexPt P.Γ)).subset ?_ + rintro x ⟨hx, hxb⟩ + obtain ⟨K, hK, hxK⟩ := mem_iUnion₂.mp hx + rw [← subBd_eq_discBd_plane P.isClosedDisc_Δ] at hxb + obtain ⟨v, hv, rfl⟩ := (hβ K hK).inter_bd ⟨hxK, hxb⟩ + exact mem_image_of_mem _ (mem_iUnion₂.mpr ⟨K, hK, hv.1⟩) + obtain ⟨a, ha, haZ⟩ := exists_interior_point_off P.isClosedDisc_Δ hZ hZf + obtain ⟨B, hBs, hBW, hBd, -, -⟩ := exists_small_disc_at P.isClosedDisc_Δ (interior_subset ha) + (isOpen_interior.inter hZ.isOpen_compl) ⟨ha, haZ⟩ + obtain ⟨φ₀, hφ₀_cw⟩ := exists_isClockwiseDiscHomeo hBd + refine ⟨B, ⟨hBd, hBs⟩, ⟨φ₀, hφ₀_cw, fun v hv => ?_, fun v₁ v₂ v₃ hc => ?_⟩, ?_, + fun K hK => ?_⟩ + · rw [hemp] at hv + exact hv.elim + · have := hc.2.1 v₁ (by simp) + rw [hemp] at this + exact this.elim + · rintro x ⟨hx, hxb⟩ + exact (disjoint_left.mp (disjoint_interior_subBd P.Δ) (hBW hx).1 hxb).elim + · rintro x ⟨hx, hxK⟩ + exact ((hBW hx).2 (mem_iUnion₂.mpr ⟨K, hK, hxK⟩)).elim + · refine ⟨P.Δ₀, ⟨hd, P.Δ₀_subset_Δ⟩, ⟨φ₀, hφ₀_cw, agreesWith_of_drawing N.bar₀_subset hag₀⟩, + ?_, fun K hK x hx => (hβ K hK).inter₀ ⟨hx.2, hx.1⟩⟩ + rintro x ⟨hx₀, hxb⟩ + obtain ⟨v, hv, rfl⟩ := T.bd_U x (T.Δ₀_bd ⟨hx₀, hxb⟩) hxb + exact T.pt_Δ₀ N.bar_subset (mem_image_of_mem _ hv) hx₀ + obtain ⟨Δ₀, h₀, h₁, h₂, h₃⟩ := hΔ₀ex + exact ⟨P.Δ, Δ₀, vertexPt P.Γ, β, Ω, P.isClosedDisc_Δ, h₀, + ⟨φ, hφ_cw, agreesWith_of_drawing N.bar_subset hφ⟩, h₁, h₂, vertexPt_injOn P.Γ, + fun K hK => ⟨(hβ K hK).disc, (hβ K hK).sub⟩, hΩ, hag, h₃, fun K hK => (hβ K hK).inter_bd, hp⟩ + +/-- The last part of the proof of (11.11) of Graph Minors IX. A consolidation with least core and +a split of its core give a feasible segregation. -/ +theorem exists_feasible_of_core_decomposition (S : Society α β) + {D_set : Set (Graph α β × Graph α β)} (hD : IsConsolidation S D_set) + (hmin_card : ∀ D_set' : Set (Graph α β × Graph α β), IsConsolidation S D_set' → + V(consolidationCore S D_set').ncard = V(consolidationCore S D_set).ncard → + D_set.ncard ≤ D_set'.ncard) + (hCS_conn : (consolidationCoreSociety S D_set hD).IsKConnected 4) + (hsimple : IsSimpleGraph (consolidationCoreSociety S D_set hD).G) {q : ℕ} + {S₁ : Society α (Sym2 α)} {N₂ : Neighborhood α (Sym2 α)} {P : Presentation N₂} + (hdecomp : CoreRuralDecomposition q (consolidationCoreSociety S D_set hD) S₁ N₂) + (hT : IsTidyPresentation P) (hΔ₀c : P.Δ₀ = ∅ ∨ ¬ IsLeThreeClique N₂.G N₂.Ω₀.bar) : + ∃ (k : ℕ) (S₀ : Society α β) (S_fam : Fin k → Society α β), + IsFeasibleSegregation S S₀ S_fam ∧ S₀.Ω = S₁.Ω ∧ + (∀ i : Fin k, (S_fam i).Ω.bar.ncard ≤ 3) ∧ + (∀ P_set : Set (Graph α β), S₀.IsTransaction P_set → P_set.ncard ≤ q) := by + classical + let CS := consolidationCoreSociety S D_set hD + have hK_all : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D_set → + IsLeThreeClique S₁.G (V(A) ∩ V(B)) ∨ IsLeThreeClique N₂.G (V(A) ∩ V(B)) := by + intro A B hAB + have hfin_AB : (V(A) ∩ V(B)).Finite := + S.finite_V.subset (inter_subset_left.trans (hD.left_le hAB).vertexSet_mono) + have hclique_C : IsLeThreeClique CS.G (V(A) ∩ V(B)) := + ⟨hD.inter_subset_consolidationCore hAB, + Set.encard_le_coe_iff_finite_ncard_le.mpr ⟨hfin_AB, hD.order_le_three hAB⟩, + fun u hu v hv huv => hD.consolidationCore_isLink_of_mem_inter hAB hu hv huv⟩ + exact isLeThreeClique_left_or_right hdecomp.C₁_le hdecomp.C₂_le hdecomp.union_eq + hdecomp.triangle_in_left_or_right hclique_C + let D₁ : Set (Graph α β × Graph α β) := {q ∈ D_set | IsLeThreeClique S₁.G (V(q.1) ∩ V(q.2))} + let D₂ : Set (Graph α β × Graph α β) := D_set \ D₁ + have hD_union : D₁ ∪ D₂ = D_set := union_sdiff_cancel (fun _ h => h.1) + have hD_disj : Disjoint D₁ D₂ := disjoint_sdiff_right + have hD₁_clique : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₁ → IsLeThreeClique S₁.G (V(A) ∩ V(B)) := + fun _ _ h => h.2 + have hD₂_clique : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₂ → IsLeThreeClique N₂.G (V(A) ∩ V(B)) := by + intro A B ⟨hAB, hnot₁⟩ + rcases hK_all hAB with h1 | h2 + · exact (hnot₁ ⟨hAB, h1⟩).elim + · exact h2 + have hD₁_sub : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₁ → V(A) ∩ V(B) ⊆ V(S₁.G) := + fun _ _ h => (hD₁_clique h).1 + have hD₂_sub : ∀ ⦃A B : Graph α β⦄, (A, B) ∈ D₂ → V(A) ∩ V(B) ⊆ V(N₂.G) := + fun _ _ h => (hD₂_clique h).1 + have hΩ_sub_C₂ : S.Ω.bar ⊆ V(N₂.G) := hdecomp.Ω_eq ▸ N₂.bar_subset + let C_star : Graph α β := (S.G.induce (V(S₁.G) ∩ V(N₂.G))).restrict ∅ + let A₀ : Graph α β := subgraphUnion S.G C_star (subgraphSUnion S.G (Prod.fst '' D₁)) + have hA₀_le : A₀ ≤ S.G := + (lemma_11_11_claim_2 hD hdecomp.C₁_le hdecomp.C₂_le hdecomp.union_eq hΩ_sub_C₂ + hdecomp.inter_eq_bar₀ hD_union hD_disj hD₁_sub hD₂_sub).1.1.1 + let S₀ : Society α β := ⟨A₀, S₁.Ω, S.finite_V.subset hA₀_le.vertexSet_mono, + S.finite_E.subset hA₀_le.edgeSet_mono, hdecomp.inter_eq_bar₀ ▸ subset_union_left⟩ + have hno_large_S₀ : ∀ P_set : Set (Graph α β), S₀.IsTransaction P_set → P_set.ncard ≤ q := + lemma_11_11_claim_4 hD hdecomp.C₁_le hdecomp.C₂_le hdecomp.union_eq hΩ_sub_C₂ + hdecomp.inter_eq_bar₀ hD_union hD_disj hD₁_clique hD₂_sub hdecomp.no_large_transaction + have hfin_D₂ : D₂.Finite := hD.finite.subset sdiff_subset + let e_D₂ : Fin hfin_D₂.toFinset.card ≃ hfin_D₂.toFinset := hfin_D₂.toFinset.equivFin.symm + let k := hfin_D₂.toFinset.card + let p_idx : Fin k → Graph α β × Graph α β := fun i => (e_D₂ i).1 + have hp_inj : Function.Injective p_idx := Subtype.val_injective.comp e_D₂.injective + have hp_mem_D₂ : ∀ i : Fin k, p_idx i ∈ D₂ := fun i => hfin_D₂.mem_toFinset.mp (e_D₂ i).2 + have hp_range : range p_idx = D₂ := by + ext q; simp only [p_idx, mem_range] + exact ⟨by rintro ⟨i, rfl⟩; exact hp_mem_D₂ i, + fun hq => ⟨e_D₂.symm ⟨q, hfin_D₂.mem_toFinset.mpr hq⟩, by simp⟩⟩ + have hp_clique : ∀ i : Fin k, IsLeThreeClique N₂.G (V((p_idx i).1) ∩ V((p_idx i).2)) := + fun i => hD₂_clique (hp_mem_D₂ i) + have hp_mem_D : ∀ i : Fin k, p_idx i ∈ D_set := fun i => (hp_mem_D₂ i).1 + let F : Set (Set α) := (fun q : Graph α β × Graph α β => V(q.1) ∩ V(q.2)) '' D₂ + have hC : IsCliqueFamily P F := by + refine ⟨hfin_D₂.image _, ?_, ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨⟨A, B⟩, h, rfl⟩ + exact hD₂_clique h + · rintro _ ⟨⟨A, B⟩, h, rfl⟩ + by_contra hn + rw [not_nonempty_iff_eq_empty] at hn + refine h.2 ⟨h.1, ?_⟩ + have hn' : V(A) ∩ V(B) = ∅ := hn + change IsLeThreeClique S₁.G (V(A) ∩ V(B)) + rw [hn'] + exact ⟨empty_subset _, by simp, fun _ hu => hu.elim⟩ + · rintro _ ⟨⟨A, B⟩, h, rfl⟩ _ ⟨⟨A', B'⟩, h', rfl⟩ hsub + by_contra hne + refine lemma_11_11_claim_1 hD hmin_card h.1 h'.1 ?_ (hsub.trans inter_subset_left) + intro heq + obtain ⟨rfl, rfl⟩ := Prod.mk.inj heq + exact hne rfl + · rintro v ⟨⟨A, B⟩, h, heq⟩ hv₀ + refine h.2 ⟨h.1, ?_⟩ + have heq' : V(A) ∩ V(B) = {v} := heq + change IsLeThreeClique S₁.G (V(A) ∩ V(B)) + rw [heq'] + exact ⟨singleton_subset_iff.mpr (S₁.bar_subset (hdecomp.Ω₀_eq ▸ hv₀)), by simp, + fun u hu w hw hne => (hne (hu.trans hw.symm)).elim⟩ + · rintro _ ⟨⟨A, B⟩, h, rfl⟩ h3 + exact exists_emptyRegion hdecomp hCS_conn (hsimple.mono hdecomp.C₂_le) P hΔ₀c + (hD₂_clique h) h3 + obtain ⟨Δ, Δ₀, α_pt, β_disc, Ω_clique, hΔ, hΔ₀, hbd_Δ, hbd_Δ₀, hinter_bd_Δ₀, hinj_α, hβ_disc, + hbar_clique, hbd_β, hinter_Δ₀, hinter_bd_Δ, hinter_β⟩ := exists_selection hT hC + have hF : ∀ i : Fin k, V((p_idx i).1) ∩ V((p_idx i).2) ∈ F := fun i => + mem_image_of_mem _ (hp_mem_D₂ i) + let S_fam : Fin k → Society α β := fun i => + { G := (p_idx i).1 + Ω := Ω_clique (V((p_idx i).1) ∩ V((p_idx i).2)) + finite_V := S.finite_V.subset (hD.left_le (hp_mem_D i)).vertexSet_mono + finite_E := S.finite_E.subset (hD.left_le (hp_mem_D i)).edgeSet_mono + bar_subset := by rw [hbar_clique _ (hF i)]; exact inter_subset_left } + have hseg : IsSocietySegregation S S₀ S_fam := + lemma_11_11_claim_5 hD hdecomp.C₁_le hdecomp.C₂_le hdecomp.union_eq hΩ_sub_C₂ + hdecomp.inter_eq_bar₀ hD_union hD_disj hD₁_sub hD₂_sub hp_inj hp_range rfl rfl + (fun _ => rfl) (fun i => hbar_clique _ (hF i)) + have hN₂_Ω : N₂.Ω = S.Ω := hdecomp.Ω_eq + have hN₂_Ω₀ : N₂.Ω₀ = S₁.Ω := hdecomp.Ω₀_eq + have harr : IsDiscArrangement S S₀ S_fam Δ Δ₀ + (fun i => β_disc (V((p_idx i).1) ∩ V((p_idx i).2))) α_pt := by + refine ⟨hΔ, hΔ₀, fun i => hβ_disc _ (hF i), ?_, fun i => hbd_β _ (hF i), + ?_, fun i => ?_, fun i j hij => ?_, ?_, fun i => ?_, ?_⟩ + · change ∃ φ₀ : Circle ≃ₜ subBd Δ₀, + IsClockwiseDiscHomeo Δ₀ φ₀ ∧ AgreesWithOArcHomeo α_pt S₁.Ω (subBd Δ₀) φ₀ + rwa [← hN₂_Ω₀] + · rwa [← hN₂_Ω] + · change Δ₀ ∩ β_disc (V((p_idx i).1) ∩ V((p_idx i).2)) ⊆ + α_pt '' (S₁.Ω.bar ∩ (Ω_clique (V((p_idx i).1) ∩ V((p_idx i).2))).bar) + rw [← hN₂_Ω₀, hbar_clique _ (hF i)] + exact hinter_Δ₀ _ (hF i) + · change β_disc (V((p_idx i).1) ∩ V((p_idx i).2)) ∩ + β_disc (V((p_idx j).1) ∩ V((p_idx j).2)) ⊆ + α_pt '' ((Ω_clique (V((p_idx i).1) ∩ V((p_idx i).2))).bar ∩ + (Ω_clique (V((p_idx j).1) ∩ V((p_idx j).2))).bar) + rw [hbar_clique _ (hF i), hbar_clique _ (hF j)] + have hK_ne : V((p_idx i).1) ∩ V((p_idx i).2) ≠ V((p_idx j).1) ∩ V((p_idx j).2) := + fun heq => hij (hp_inj (eq_of_inter_eq_of_minimal_consolidation hD hmin_card + (hp_mem_D i) (hp_mem_D j) heq)) + exact hinter_β _ (hF i) _ (hF j) hK_ne + · change Δ₀ ∩ subBd Δ ⊆ α_pt '' (S₁.Ω.bar ∩ S.Ω.bar) + rwa [← hN₂_Ω₀, ← hN₂_Ω] + · change β_disc (V((p_idx i).1) ∩ V((p_idx i).2)) ∩ subBd Δ ⊆ + α_pt '' ((Ω_clique (V((p_idx i).1) ∩ V((p_idx i).2))).bar ∩ S.Ω.bar) + rw [hbar_clique _ (hF i), ← hN₂_Ω] + exact hinter_bd_Δ _ (hF i) + · refine hinj_α.mono (union_subset ?_ (iUnion_subset fun i => ?_)) + · change S₁.Ω.bar ⊆ V(N₂.G) + rw [← hN₂_Ω₀]; exact N₂.bar₀_subset + · change (Ω_clique (V((p_idx i).1) ∩ V((p_idx i).2))).bar ⊆ V(N₂.G) + rw [hbar_clique _ (hF i)]; exact (hp_clique i).1 + refine ⟨k, S₀, S_fam, ⟨hseg, Δ, Δ₀, _, α_pt, harr⟩, rfl, fun i => ?_, hno_large_S₀⟩ + change (Ω_clique (V((p_idx i).1) ∩ V((p_idx i).2))).bar.ncard ≤ 3 + rw [hbar_clique _ (hF i)] + exact (hp_clique i).finite_ncard_le.2 + +/-- **Graph Minors IX, (11.11)** (pages 74–77): +"Let $p \ge 2$, with $p \neq 3$. Let $(G, \Omega)$ be a society with no crooked transaction +of cardinality $p$. Then there is a feasible segregation $\{(A_0, \Omega_0), \dots, (A_k, +\Omega_k)\}$ of $(G, \Omega)$ such that $|\bar{\Omega}_1|, \dots, |\bar{\Omega}_k| \le 3$ +and $(A_0, \Omega_0)$ has no transaction of cardinality $> 3p + 9$." -/ +theorem theorem_11_11_proof (S : Society α β) (p : ℕ) (hp2 : 2 ≤ p) (hp3 : p ≠ 3) + (hno_crooked : ∀ P_set : Set (Graph α β), S.IsCrookedTransaction P_set → P_set.ncard ≠ p) : + ∃ (k : ℕ) (S₀ : Society α β) (S_fam : Fin k → Society α β), + IsFeasibleSegregation S S₀ S_fam ∧ + (∀ i : Fin k, (S_fam i).Ω.bar.ncard ≤ 3) ∧ + (∀ P_set : Set (Graph α β), S₀.IsTransaction P_set → P_set.ncard ≤ 3 * p + 9) := by + classical + obtain ⟨D_set, hD, hmin_core, hmin_card⟩ := exists_minimal_consolidation S + let CS := consolidationCoreSociety S D_set hD + have hCS_conn : CS.IsKConnected 4 := theorem_11_9_proof S D_set hD hmin_core + have hCS_no_crooked : ∀ Q_set : Set (Graph α (Sym2 α)), + CS.IsCrookedTransaction Q_set → Q_set.ncard ≠ p := + no_crooked_transaction_consolidationCoreSociety hD hno_crooked + have hsimple : IsSimpleGraph CS.G := isSimpleGraph_consolidationCore S D_set + have hsoph : CS.HasSophisticationLE (3 * p + 7) := + (Society.theorem_6_1_proof hp2 hp3 (fun k' hk' => hCS_conn k' (by omega)) + (fun k' hk' G₁ G₂ h => hCS_conn k' hk' G₁ G₂ h.1) hCS_no_crooked).1 + obtain ⟨S₁, N₂, P, hdecomp, hT, hΔ₀c⟩ := exists_core_decomposition hCS_conn hsimple hsoph + obtain ⟨k, S₀, S_fam, hF, -, hbar, hno⟩ := + exists_feasible_of_core_decomposition S hD hmin_card hCS_conn hsimple hdecomp hT hΔ₀c + exact ⟨k, S₀, S_fam, hF, hbar, hno⟩ + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section2a.lean b/LeanPool/GraphMinor/GM09/Section2a.lean new file mode 100644 index 0000000000..b92a6f1ef1 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section2a.lean @@ -0,0 +1,926 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM09.Basic + +/-! +# Graph Minors IX, Section 2 (Part 1): Lemma (2.1) + +This file formalizes (2.1) and its claim (1) from Section 2 of +N. Robertson and P. D. Seymour, *Graph Minors. IX. Disjoint crossed paths*, +J. Combin. Theory Ser. B **49** (1990) 40–77 (pages 43–44). +-/ + +public section + +namespace GraphMinor.GM09 + +open Set Graph GraphMinor.Surface GraphMinor.GM06 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- If `Z` catches `H` and `C` is a connected subgraph of `G` with `V(C) ∩ V(H) ≠ ∅`, then `Z` +catches `H ∪ C`. -/ +private theorem catches_subgraphUnion_of_connected {G H C : Graph α β} {Z : Set α} + (hHG : H ≤ G) (hCG : C ≤ G) (hZ : Catches Z H) (hC_conn : IsGraphConnected C) + (hinter : (V(C) ∩ V(H)).Nonempty) : + Catches Z (subgraphUnion G H C) := by + refine ⟨hZ.1.trans (subset_union_left (t := V(C))), fun D hD => ?_⟩ + have hHD_or : (V(D) ∩ V(H)).Nonempty ∨ Disjoint V(D) V(H) := by + by_cases h : (V(D) ∩ V(H)).Nonempty + · exact Or.inl h + · exact Or.inr (not_nonempty_iff_eq_empty.mp h |> disjoint_iff_inter_eq_empty.mpr) + have hH_le : H ≤ subgraphUnion G H C := le_subgraphUnion_left hHG hCG + have hC_le : C ≤ subgraphUnion G H C := le_subgraphUnion_right hHG hCG + rcases hinter with ⟨w, hwC, hwH⟩ + obtain ⟨H₀, hH₀_comp, hwH₀⟩ := exists_graphComponent_of_mem hwH + obtain ⟨z₀, hz₀Z, hz₀H₀⟩ := hZ.2 H₀ hH₀_comp + obtain ⟨D', hD'_comp, hwD'⟩ := exists_graphComponent_of_mem (hH_le.vertexSet_mono hwH) + have hC_sub_D' : C ≤ D' := + hD'_comp.2.2 (subgraphUnion (subgraphUnion G H C) D' C) + (le_subgraphUnion_left hD'_comp.1 hC_le) + (subgraphUnion_le hD'_comp.1 hC_le) + (isGraphConnected_subgraphUnion hD'_comp.1 hC_le hD'_comp.2.1 hC_conn ⟨w, hwD', hwC⟩) + |>.symm ▸ le_subgraphUnion_right hD'_comp.1 hC_le + rcases hHD_or with ⟨x, hxD, hxH⟩ | hdisj + · obtain ⟨H₁, hH₁_comp, hxH₁⟩ := exists_graphComponent_of_mem hxH + obtain ⟨z₁, hz₁Z, hz₁H₁⟩ := hZ.2 H₁ hH₁_comp + have hH₁_sub_D : H₁ ≤ D := + hD.2.2 (subgraphUnion (subgraphUnion G H C) D H₁) + (le_subgraphUnion_left hD.1 (hH₁_comp.1.trans hH_le)) + (subgraphUnion_le hD.1 (hH₁_comp.1.trans hH_le)) + (isGraphConnected_subgraphUnion hD.1 (hH₁_comp.1.trans hH_le) hD.2.1 hH₁_comp.2.1 + ⟨x, hxD, hxH₁⟩) + |>.symm ▸ le_subgraphUnion_right hD.1 (hH₁_comp.1.trans hH_le) + exact ⟨z₁, hz₁Z, hH₁_sub_D.vertexSet_mono hz₁H₁⟩ + · obtain ⟨y, hyD⟩ := hD.2.1.1 + have hy_union : y ∈ V(H) ∪ V(C) := hD.1.vertexSet_mono hyD + rcases hy_union with hyH | hyC + · exact (disjoint_left.mp hdisj hyD hyH).elim + · have hDD' : D = D' := + isGraphComponent_eq_of_mem_inter hD hD'_comp ⟨y, hyD, hC_sub_D'.vertexSet_mono hyC⟩ + subst hDD' + have hH₀_sub_D : H₀ ≤ D := + hD.2.2 (subgraphUnion (subgraphUnion G H C) D H₀) + (le_subgraphUnion_left hD.1 (hH₀_comp.1.trans hH_le)) + (subgraphUnion_le hD.1 (hH₀_comp.1.trans hH_le)) + (isGraphConnected_subgraphUnion hD.1 (hH₀_comp.1.trans hH_le) hD.2.1 hH₀_comp.2.1 + ⟨w, hwD', hwH₀⟩) + |>.symm ▸ le_subgraphUnion_right hD.1 (hH₀_comp.1.trans hH_le) + exact ⟨z₀, hz₀Z, hH₀_sub_D.vertexSet_mono hz₀H₀⟩ + +/-- **Graph Minors IX, (2.1), Claim (1)** (page 44): +"Let $X \subseteq V(K)$ be the set of all vertices of $K$ which are adjacent in $G$ to some +vertex of $H$. We observe, from the maximality of $H$, that (1) *Every path of $K$ between +$s$ and $t$ passes through every vertex of $X$." -/ +theorem lemma_2_1_claim_1 {G H P : Graph α β} {Z : Set α} {s t x : α} + (hHG : H ≤ G) (hZ : Catches Z H) + (hmax : ∀ H' : Graph α β, H ≤ H' → H' ≤ G → Catches Z H' → + (∃ Q : Graph α β, IsGraphPathWithEnds G Q s t ∧ Avoids Q V(H')) → H' = H) + (hPK : IsGraphPathWithEnds (deleteVertices G V(H)) P s t) + (hxK : x ∈ V(deleteVertices G V(H))) + (hadj : ∃ h ∈ V(H), G.Adj x h) : + x ∈ V(P) := by + by_contra hxP + rcases hadj with ⟨h, hhH, e, hexh⟩ + let E_x := G.induce {x, h} + have hEx_le : E_x ≤ G := G.induce_le (by + intro u hu + rcases hu with rfl | rfl + · exact hxK.1 + · exact hHG.vertexSet_mono hhH) + have hEx_link : E_x.IsLink e x h := by + rw [induce_isLink] + exact ⟨hexh, by simp, by simp⟩ + have hEx_conn : IsGraphConnected E_x := by + refine ⟨⟨x, by simp [E_x]⟩, fun u hu v hv => ?_⟩ + simp only [E_x] at hu hv + rcases hu with rfl | rfl <;> rcases hv with rfl | rfl + · exact ⟨.nil (by simp [E_x])⟩ + · exact ⟨.cons hEx_link (.nil (by simp [E_x]))⟩ + · exact ⟨.cons hEx_link.symm (.nil (by simp [E_x]))⟩ + · exact ⟨.nil (by simp [E_x])⟩ + have hinter : (V(E_x) ∩ V(H)).Nonempty := ⟨h, by simp [E_x], hhH⟩ + have hcatch' : Catches Z (subgraphUnion G H E_x) := + catches_subgraphUnion_of_connected hHG hEx_le hZ hEx_conn hinter + have hP_G : IsGraphPathWithEnds G P s t := hPK.mono (deleteVertices_le G V(H)) + have hav' : Avoids P V(subgraphUnion G H E_x) := by + rw [Avoids, vertexSet_subgraphUnion, disjoint_union_left] + refine ⟨?_, ?_⟩ + · rw [disjoint_left] + intro u huH huP + exact (hPK.1.vertexSet_mono huP).2 huH + · rw [disjoint_left] + intro u huEx huP + simp only [E_x] at huEx + rcases huEx with rfl | rfl + · exact hxP huP + · exact (hPK.1.vertexSet_mono huP).2 hhH + have heq := hmax (subgraphUnion G H E_x) (le_subgraphUnion_left hHG hEx_le) + (subgraphUnion_le hHG hEx_le) hcatch' ⟨P, hP_G, hav'⟩ + have hxH : x ∈ V(H) := by + rw [← heq, vertexSet_subgraphUnion] + right + simp [E_x] + exact hxK.2 hxH + +/-- If `P` is a path in `K` from `s` to `t`, `a, c ∈ V(P)` are distinct, `P` splits into +`P_sa` (from `s` to `a`), `P_ac` (from `a` to `c`), and `P_ct` (from `c` to `t`), and `R` is a +path in `K` from `a` to `c` with `V(R) ∩ V(P) = {a, c}`, then `P_sa ∪ R ∪ P_ct` is a path in `K` +from `s` to `t` whose intersection with `V(P)` is `V(P_sa) ∪ V(P_ct)` (hence disjoint from +`V(P_ac) \ {a, c}`). -/ +theorem exists_detour_path {K P P_sa P_ac P_ct R : Graph α β} {s t a c : α} + (hPK : IsGraphPathWithEnds K P s t) + (hP_sa_le : P_sa ≤ P) (hP_ac_le : P_ac ≤ P) (hP_ct_le : P_ct ≤ P) + (hpath_sa : IsGraphPathWithEnds P P_sa s a) + (hpath_ac : IsGraphPathWithEnds P P_ac a c) + (hpath_ct : IsGraphPathWithEnds P P_ct c t) + (hinter_sa : V(P_sa) ∩ V(P_ac) = {a}) + (hinter_ct : V(P_ac) ∩ V(P_ct) = {c}) + (hdisj_sact : Disjoint V(P_sa) V(P_ct)) + (hRK : IsGraphPathWithEnds K R a c) + (hRP : V(R) ∩ V(P) = {a, c}) : + ∃ Q : Graph α β, + IsGraphPathWithEnds K Q s t ∧ + Disjoint (V(P_ac) \ {a, c}) V(Q) := by + have hP_saK : IsGraphPathWithEnds K P_sa s a := hpath_sa.mono hPK.le + have hP_ctK : IsGraphPathWithEnds K P_ct c t := hpath_ct.mono hPK.le + have hV_saR : V(P_sa) ∩ V(R) = {a} := by + ext z + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hz₁, hzR⟩ + have hz_ac : z = a ∨ z = c := by + have : z ∈ V(R) ∩ V(P) := ⟨hzR, hP_sa_le.vertexSet_mono hz₁⟩ + rwa [hRP, mem_insert_iff, mem_singleton_iff] at this + rcases hz_ac with rfl | rfl + · rfl + · exact (disjoint_left.mp hdisj_sact hz₁ hpath_ct.left_mem).elim + · rintro rfl + exact ⟨hpath_sa.right_mem, hRK.left_mem⟩ + have hP_saR : IsGraphPathWithEnds K (subgraphUnion K P_sa R) s c := + hP_saK.subgraphUnion hRK hV_saR + have hV_saR_ct : V(subgraphUnion K P_sa R) ∩ V(P_ct) = {c} := by + ext z + simp only [vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hz₁ | hzR, hz₃⟩ + · exact (disjoint_left.mp hdisj_sact hz₁ hz₃).elim + · have hz_ac : z = a ∨ z = c := by + have : z ∈ V(R) ∩ V(P) := ⟨hzR, hP_ct_le.vertexSet_mono hz₃⟩ + rwa [hRP, mem_insert_iff, mem_singleton_iff] at this + rcases hz_ac with rfl | rfl + · exact (disjoint_left.mp hdisj_sact hpath_sa.right_mem hz₃).elim + · rfl + · rintro rfl + exact ⟨Or.inr hRK.right_mem, hpath_ct.left_mem⟩ + refine ⟨subgraphUnion K (subgraphUnion K P_sa R) P_ct, + hP_saR.subgraphUnion hP_ctK hV_saR_ct, ?_⟩ + rw [disjoint_left] + rintro z ⟨hz_ac, hz_not_ac⟩ hzQ + simp only [vertexSet_subgraphUnion, mem_union] at hzQ + rcases hzQ with (hz_sa | hzR) | hz_ct + · have : z ∈ V(P_sa) ∩ V(P_ac) := ⟨hz_sa, hz_ac⟩ + rw [hinter_sa, mem_singleton_iff] at this + exact hz_not_ac (by simp [this]) + · have : z ∈ V(R) ∩ V(P) := ⟨hzR, hP_ac_le.vertexSet_mono hz_ac⟩ + rw [hRP] at this + exact hz_not_ac this + · have : z ∈ V(P_ac) ∩ V(P_ct) := ⟨hz_ac, hz_ct⟩ + rw [hinter_ct, mem_singleton_iff] at this + exact hz_not_ac (by simp [this]) + +/-- Given distinct `u, v ∈ V(P)` on a path `P` in `K` from `s` to `t`, `P` splits into three +subpaths `P_sa` (from `s` to `a`), `P_ac` (from `a` to `c`), and `P_ct` (from `c` to `t`) where +`{a, c} = {u, v}`. -/ +theorem exists_three_way_split {K P : Graph α β} {s t u v : α} + (hPK : IsGraphPathWithEnds K P s t) + (huP : u ∈ V(P)) (hvP : v ∈ V(P)) (huv : u ≠ v) : + ∃ a c : α, ({a, c} : Set α) = {u, v} ∧ a ≠ c ∧ + ∃ P_sa P_ac P_ct : Graph α β, + P_sa ≤ P ∧ P_ac ≤ P ∧ P_ct ≤ P ∧ + IsGraphPathWithEnds P P_sa s a ∧ + IsGraphPathWithEnds P P_ac a c ∧ + IsGraphPathWithEnds P P_ct c t ∧ + V(P_sa) ∩ V(P_ac) = {a} ∧ + V(P_ac) ∩ V(P_ct) = {c} ∧ + Disjoint V(P_sa) V(P_ct) ∧ + V(P_sa) ∪ V(P_ac) ∪ V(P_ct) = V(P) ∧ + E(P_sa) ∪ E(P_ac) ∪ E(P_ct) = E(P) ∧ + Disjoint E(P_sa) E(P_ac) ∧ + Disjoint E(P_ac) E(P_ct) ∧ + Disjoint E(P_sa) E(P_ct) := by + obtain ⟨P_su, P_ut, hP_su, hP_ut, hpath_su, hpath_ut, hunion_u, hinter_u, hdisjE_u⟩ := + hPK.exists_split_at huP + have hv_u : v ∈ V(P_su) ∪ V(P_ut) := by + rw [← vertexSet_subgraphUnion P P_su P_ut, hunion_u]; exact hvP + rcases hv_u with hv_su | hv_ut + · -- `v ∈ V(P_su)`: split `P_su` at `v` into `P_sv, P_vu`! + obtain ⟨P_sv, P_vu, hP_sv, hP_vu, hpath_sv, hpath_vu, hunion_v, hinter_v, hdisjE_v⟩ := + hpath_su.exists_split_at hv_su + refine ⟨v, u, by ext x; simp [or_comm], huv.symm, + P_sv, P_vu, P_ut, hP_sv.trans hP_su, hP_vu.trans hP_su, hP_ut, + hpath_sv.mono hP_su, hpath_vu.mono hP_su, hpath_ut, hinter_v, ?_, ?_, ?_, ?_, + hdisjE_v, ?_, ?_⟩ + · ext z + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hz_vu, hz_ut⟩ => by + have : z ∈ V(P_su) ∩ V(P_ut) := ⟨hP_vu.vertexSet_mono hz_vu, hz_ut⟩ + rwa [hinter_u, mem_singleton_iff] at this, + fun h => h ▸ ⟨hpath_vu.right_mem, hpath_ut.left_mem⟩⟩ + · rw [disjoint_left] + intro z hz_sv hz_ut + have hz_u : z = u := by + have : z ∈ V(P_su) ∩ V(P_ut) := ⟨hP_sv.vertexSet_mono hz_sv, hz_ut⟩ + rwa [hinter_u, mem_singleton_iff] at this + subst hz_u + have : z ∈ V(P_sv) ∩ V(P_vu) := ⟨hz_sv, hpath_vu.right_mem⟩ + rw [hinter_v, mem_singleton_iff] at this + exact huv this + · have hV1 : V(P_sv) ∪ V(P_vu) = V(P_su) := by + rw [← vertexSet_subgraphUnion P_su P_sv P_vu, hunion_v] + have hV2 : V(P_su) ∪ V(P_ut) = V(P) := by + rw [← vertexSet_subgraphUnion P P_su P_ut, hunion_u] + rw [hV1, hV2] + · have hE1 : E(P_sv) ∪ E(P_vu) = E(P_su) := by + rw [← edgeSet_subgraphUnion hP_sv hP_vu, hunion_v] + have hE2 : E(P_su) ∪ E(P_ut) = E(P) := by + rw [← edgeSet_subgraphUnion hP_su hP_ut, hunion_u] + rw [hE1, hE2] + · exact hdisjE_u.mono_left hP_vu.edgeSet_mono + · exact hdisjE_u.mono_left hP_sv.edgeSet_mono + · -- `v ∈ V(P_ut)`: split `P_ut` at `v` into `P_uv, P_vt`! + obtain ⟨P_uv, P_vt, hP_uv, hP_vt, hpath_uv, hpath_vt, hunion_v, hinter_v, hdisjE_v⟩ := + hpath_ut.exists_split_at hv_ut + refine ⟨u, v, rfl, huv, + P_su, P_uv, P_vt, hP_su, hP_uv.trans hP_ut, hP_vt.trans hP_ut, + hpath_su, hpath_uv.mono hP_ut, hpath_vt.mono hP_ut, ?_, hinter_v, ?_, ?_, ?_, + ?_, hdisjE_v, ?_⟩ + · ext z + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hz_su, hz_uv⟩ => by + have : z ∈ V(P_su) ∩ V(P_ut) := ⟨hz_su, hP_uv.vertexSet_mono hz_uv⟩ + rwa [hinter_u, mem_singleton_iff] at this, + fun h => h ▸ ⟨hpath_su.right_mem, hpath_uv.left_mem⟩⟩ + · rw [disjoint_left] + intro z hz_su hz_vt + have hz_u : z = u := by + have : z ∈ V(P_su) ∩ V(P_ut) := ⟨hz_su, hP_vt.vertexSet_mono hz_vt⟩ + rwa [hinter_u, mem_singleton_iff] at this + subst hz_u + have : z ∈ V(P_uv) ∩ V(P_vt) := ⟨hpath_uv.left_mem, hz_vt⟩ + rw [hinter_v, mem_singleton_iff] at this + exact huv this + · have hV1 : V(P_uv) ∪ V(P_vt) = V(P_ut) := by + rw [← vertexSet_subgraphUnion P_ut P_uv P_vt, hunion_v] + have hV2 : V(P_su) ∪ V(P_ut) = V(P) := by + rw [← vertexSet_subgraphUnion P P_su P_ut, hunion_u] + rw [union_assoc, hV1, hV2] + · have hE1 : E(P_uv) ∪ E(P_vt) = E(P_ut) := by + rw [← edgeSet_subgraphUnion hP_uv hP_vt, hunion_v] + have hE2 : E(P_su) ∪ E(P_ut) = E(P) := by + rw [← edgeSet_subgraphUnion hP_su hP_ut, hunion_u] + rw [union_assoc, hE1, hE2] + · exact hdisjE_u.mono_right hP_uv.edgeSet_mono + · exact hdisjE_u.mono_right hP_vt.edgeSet_mono + +/-- Given a subset `V₂ ⊆ V(K)` and `a, c ∈ V₂` with `a ≠ c`, such that: +- `s, t ∈ V(K) \ (V₂ \ {a, c})`, +- `V₂ ≠ {a, c}`, +- no vertex of `V₂ \ {a, c}` is adjacent in `G` to any vertex outside `V₂`, +- `G₂ = K.induce V₂` and `G₁ = (G.induce (V(G) \ (V₂ \ {a, c}))).restrict (E(G) \ E(G₂))`, +- `E(P) ∩ E(G₂) ≠ ∅` and `{a, c} ⊆ V(P)` with any edge of `G₁ ∩ G₂` empty, +then `(G₁, G₂)` is a separation of `G` satisfying all conclusions of `(2.1)`. -/ +theorem exists_separation_of_isolated_subset {G H P : Graph α β} {s t a c : α} + (hHG : H ≤ G) + (hPK : IsGraphPathWithEnds (deleteVertices G V(H)) P s t) + (hac : a ≠ c) (haP : a ∈ V(P)) (hcP : c ∈ V(P)) + (V₂ : Set α) (hV₂_sub : V₂ ⊆ V(deleteVertices G V(H))) + (haV₂ : a ∈ V₂) (hcV₂ : c ∈ V₂) + (hs_not : s ∉ V₂ \ {a, c}) (ht_not : t ∉ V₂ \ {a, c}) + (hV₂_ne : V₂ ≠ {a, c}) + (hno_out : ∀ x ∈ V₂ \ {a, c}, ∀ y : α, G.Adj x y → y ∈ V₂) + (hEP_inter : (E(P) ∩ E((deleteVertices G V(H)).induce V₂)).Nonempty) : + ∃ G₁ G₂ : Graph α β, + IsGraphSeparation G G₁ G₂ ∧ + {s, t} ⊆ V(G₁) ∧ + (V(G₁) ∩ V(G₂)).ncard = 2 ∧ + (E(P) ∩ E(G₂)).Nonempty ∧ + subgraphInter G G₁ G₂ ≤ P ∧ + H ≤ G₁ ∧ + V(G₁) ≠ V(G) := by + let K := deleteVertices G V(H) + have hKG : K ≤ G := deleteVertices_le G V(H) + have hPG : P ≤ G := hPK.1.trans hKG + let G₂ : Graph α β := K.induce V₂ + have hG₂K : G₂ ≤ K := K.induce_le hV₂_sub + have hG₂G : G₂ ≤ G := hG₂K.trans hKG + have hVG₂ : V(G₂) = V₂ := rfl + let G₁ : Graph α β := (G.induce (V(G) \ (V₂ \ {a, c}))).restrict (E(G) \ E(G₂)) + have hG₁G : G₁ ≤ G := restrict_le.trans (G.induce_le sdiff_subset) + have hVG₁ : V(G₁) = V(G) \ (V₂ \ {a, c}) := rfl + have hEG₁ : E(G₁) = E(G) \ E(G₂) := by + change E(G.induce (V(G) \ (V₂ \ {a, c}))) ∩ (E(G) \ E(G₂)) = E(G) \ E(G₂) + rw [inter_eq_right] + rintro e ⟨heG, he_not_G₂⟩ + obtain ⟨x, y, hxy⟩ := G.exists_isLink_of_mem_edgeSet heG + refine ⟨x, y, hxy, ⟨hxy.left_mem, ?_⟩, ⟨hxy.right_mem, ?_⟩⟩ + · intro hx_in + have hyV₂ : y ∈ V₂ := hno_out x hx_in y hxy.adj + have hxV₂ : x ∈ V₂ := hx_in.1 + have hxyK : K.IsLink e x y := by + rw [deleteVertices_isLink] + exact ⟨hxy, (hV₂_sub hxV₂).2, (hV₂_sub hyV₂).2⟩ + have hxyG₂ : G₂.IsLink e x y := by + rw [induce_isLink] + exact ⟨hxyK, hxV₂, hyV₂⟩ + exact he_not_G₂ hxyG₂.edge_mem + · intro hy_in + have hxV₂ : x ∈ V₂ := hno_out y hy_in x hxy.symm.adj + have hyV₂ : y ∈ V₂ := hy_in.1 + have hxyK : K.IsLink e x y := by + rw [deleteVertices_isLink] + exact ⟨hxy, (hV₂_sub hxV₂).2, (hV₂_sub hyV₂).2⟩ + have hxyG₂ : G₂.IsLink e x y := by + rw [induce_isLink] + exact ⟨hxyK, hxV₂, hyV₂⟩ + exact he_not_G₂ hxyG₂.edge_mem + have hV_inter : V(G₁) ∩ V(G₂) = {a, c} := by + rw [hVG₁, hVG₂] + ext z + simp only [mem_inter_iff, mem_sdiff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨⟨_, hz_not⟩, hzV₂⟩ + by_contra hne + exact hz_not ⟨hzV₂, hne⟩ + · rintro (rfl | rfl) + · exact ⟨⟨(hV₂_sub haV₂).1, fun h => h.2 (Or.inl rfl)⟩, haV₂⟩ + · exact ⟨⟨(hV₂_sub hcV₂).1, fun h => h.2 (Or.inr rfl)⟩, hcV₂⟩ + refine ⟨G₁, G₂, ?_, ?_, ?_, hEP_inter, ?_, ?_, ?_⟩ + · -- `IsGraphSeparation G G₁ G₂` + refine ⟨hG₁G, hG₂G, ?_, ?_, hEG₁ ▸ disjoint_sdiff_self_left⟩ + · rw [hVG₁, hVG₂] + ext z + simp only [mem_union, mem_sdiff] + exact ⟨fun h => h.elim (fun h1 => h1.1) (fun h2 => (hV₂_sub h2).1), + fun hzG => by_cases (fun hzV₂ : z ∈ V₂ => Or.inr hzV₂) + (fun hzV₂ => Or.inl ⟨hzG, fun h => hzV₂ h.1⟩)⟩ + · rw [hEG₁] + exact sdiff_union_of_subset hG₂G.edgeSet_mono + · -- `{s, t} ⊆ V(G₁)` + intro z hz + rw [hVG₁] + rcases hz with rfl | rfl + · exact ⟨(hPK.1.vertexSet_mono hPK.left_mem).1, hs_not⟩ + · exact ⟨(hPK.1.vertexSet_mono hPK.right_mem).1, ht_not⟩ + · -- `(V(G₁) ∩ V(G₂)).ncard = 2` + rw [hV_inter] + exact Set.ncard_pair hac + · -- `subgraphInter G G₁ G₂ ≤ P` + rw [(Compatible.of_le_le (subgraphInter_le hG₁G) hPG).le_iff] + rw [vertexSet_subgraphInter, hV_inter, edgeSet_subgraphInter hG₁G hG₂G, hEG₁, + sdiff_inter_self] + refine ⟨?_, empty_subset _⟩ + intro z hz + rcases hz with rfl | rfl + · exact haP + · exact hcP + · -- `H ≤ G₁` + rw [(Compatible.of_le_le hHG hG₁G).le_iff, hVG₁, hEG₁] + refine ⟨fun z hzH => ⟨hHG.vertexSet_mono hzH, fun hzV₂ => (hV₂_sub hzV₂.1).2 hzH⟩, + fun e heH => ⟨hHG.edgeSet_mono heH, fun heG₂ => ?_⟩⟩ + obtain ⟨x, y, hxyH⟩ := H.exists_isLink_of_mem_edgeSet heH + obtain ⟨x', y', hxyG₂⟩ := G₂.exists_isLink_of_mem_edgeSet heG₂ + have heq := (hxyH.mono hHG).left_eq_or_eq (hxyG₂.mono hG₂G) + rcases heq with rfl | rfl + · exact (hG₂K.vertexSet_mono hxyG₂.left_mem).2 hxyH.left_mem + · exact (hG₂K.vertexSet_mono hxyG₂.right_mem).2 hxyH.left_mem + · -- `V(G₁) ≠ V(G)` + intro heq + have hssub : {a, c} ⊂ V₂ := + ⟨fun z hz => by rcases hz with rfl | rfl <;> assumption, + fun h => hV₂_ne (Subset.antisymm h (fun z hz => by rcases hz with rfl | rfl + <;> assumption))⟩ + obtain ⟨w, hwV₂, hw_not_ac⟩ := exists_of_ssubset hssub + have hwG : w ∈ V(G) := (hV₂_sub hwV₂).1 + rw [← heq, hVG₁] at hwG + exact hwG.2 ⟨hwV₂, hw_not_ac⟩ + +/-- If `K = deleteVertices G V(H)` and `P` is a path in `K` from `s` to `t`, and `R` is a path in +`K` between distinct `u, v ∈ V(P)` with `V(R) ∩ V(P) = {u, v}`, then no internal vertex of the +subpath of `P` between `u` and `v` is adjacent in `G` to `V(H)` (by `lemma_2_1_claim_1` applied +to the detour path `Q`). -/ +theorem no_X_in_open_interval_of_detour {G H P P_sa P_ac P_ct R : Graph α β} + {Z : Set α} {s t a c : α} + (hHG : H ≤ G) (hZ : Catches Z H) + (hmax : ∀ H' : Graph α β, H ≤ H' → H' ≤ G → Catches Z H' → + (∃ Q : Graph α β, IsGraphPathWithEnds G Q s t ∧ Avoids Q V(H')) → H' = H) + (hPK : IsGraphPathWithEnds (deleteVertices G V(H)) P s t) + (hP_sa_le : P_sa ≤ P) (hP_ac_le : P_ac ≤ P) (hP_ct_le : P_ct ≤ P) + (hpath_sa : IsGraphPathWithEnds P P_sa s a) + (hpath_ac : IsGraphPathWithEnds P P_ac a c) + (hpath_ct : IsGraphPathWithEnds P P_ct c t) + (hinter_sa : V(P_sa) ∩ V(P_ac) = {a}) + (hinter_ct : V(P_ac) ∩ V(P_ct) = {c}) + (hdisj_sact : Disjoint V(P_sa) V(P_ct)) + (hRK : IsGraphPathWithEnds (deleteVertices G V(H)) R a c) + (hRP : V(R) ∩ V(P) = {a, c}) + {x : α} (hx : x ∈ V(P_ac) \ {a, c}) : + ¬ ∃ h ∈ V(H), G.Adj x h := by + intro hadj + obtain ⟨Q, hQK, hdisjQ⟩ := exists_detour_path hPK hP_sa_le hP_ac_le hP_ct_le + hpath_sa hpath_ac hpath_ct hinter_sa hinter_ct hdisj_sact hRK hRP + have hxK : x ∈ V(deleteVertices G V(H)) := + hPK.1.vertexSet_mono (hP_ac_le.vertexSet_mono hx.1) + have hxQ : x ∈ V(Q) := lemma_2_1_claim_1 hHG hZ hmax hQK hxK hadj + exact disjoint_left.mp hdisjQ hx hxQ + +/-- Every path `P_ac` between distinct vertices `a ≠ c` has at least one edge. -/ +theorem nonempty_edgeSet_of_isGraphPathWithEnds_ne {G P : Graph α β} {a c : α} + (hP : IsGraphPathWithEnds G P a c) (hac : a ≠ c) : E(P).Nonempty := by + rcases hP with ⟨_, W, _, _, hE⟩ + rw [hE] + cases W with + | nil _ => exact (hac rfl).elim + | cons h _ => exact ⟨_, List.mem_cons_self⟩ + +private theorem trim_path_from_left {Q : Graph α β} {s t : α} {Y : Set α} : + ∀ (n : ℕ) (a₀ : α) (P_sa₀ P_a₀u : Graph α β), + a₀ ∈ Y → P_sa₀ ≤ Q → P_a₀u ≤ Q → + IsGraphPathWithEnds Q P_sa₀ s a₀ → + IsGraphPathWithEnds Q P_a₀u a₀ t → + V(P_sa₀) ∩ V(P_a₀u) = {a₀} → + V(P_sa₀) ∪ V(P_a₀u) = V(Q) → + V(P_a₀u).ncard = n → + ∃ a ∈ Y, ∃ P_sa P_au : Graph α β, + P_sa ≤ Q ∧ P_au ≤ Q ∧ + IsGraphPathWithEnds Q P_sa s a ∧ + IsGraphPathWithEnds Q P_au a t ∧ + V(P_sa) ∩ V(P_au) = {a} ∧ + V(P_sa) ∪ V(P_au) = V(Q) ∧ + Disjoint (V(P_au) \ {a}) Y := by + classical + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro a₀ P_sa₀ P_a₀u ha₀Y hP_sa₀ hP_a₀u hpath_sa₀ hpath_a₀u hinter_a₀ hunion_a₀ hcard + by_cases hhit : ∃ y ∈ V(P_a₀u) \ {a₀}, y ∈ Y + · rcases hhit with ⟨y, ⟨hy_in, hy_ne⟩, hyY⟩ + simp only [mem_singleton_iff] at hy_ne + obtain ⟨P_a₀y, P_yu, hP_a₀y, hP_yu, hpath_a₀y, hpath_yu, hunion_y, hinter_y, _⟩ := + hpath_a₀u.exists_split_at hy_in + have ha₀_not_yu : a₀ ∉ V(P_yu) := by + intro ha₀_yu + have : a₀ ∈ V(P_a₀y) ∩ V(P_yu) := ⟨hpath_a₀y.left_mem, ha₀_yu⟩ + rw [hinter_y, mem_singleton_iff] at this + exact hy_ne this.symm + have hlt : V(P_yu).ncard < n := by + rw [← hcard] + exact Set.ncard_lt_ncard + ⟨hP_yu.vertexSet_mono, fun hsub => ha₀_not_yu (hsub hpath_a₀u.left_mem)⟩ + hpath_a₀u.vertexSet_finite + have hV_sa₀_a₀y : V(P_sa₀) ∩ V(P_a₀y) = {a₀} := by + ext z + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hz₁, hz₂⟩ => by + have : z ∈ V(P_sa₀) ∩ V(P_a₀u) := ⟨hz₁, hP_a₀y.vertexSet_mono hz₂⟩ + rwa [hinter_a₀, mem_singleton_iff] at this, + fun h => h ▸ ⟨hpath_sa₀.right_mem, hpath_a₀y.left_mem⟩⟩ + have hpath_sy : IsGraphPathWithEnds Q (subgraphUnion Q P_sa₀ P_a₀y) s y := + hpath_sa₀.subgraphUnion (hpath_a₀y.mono hP_a₀u) hV_sa₀_a₀y + have hinter_sy : V(subgraphUnion Q P_sa₀ P_a₀y) ∩ V(P_yu) = {y} := by + ext z + simp only [vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hz₁ | hz₂, hz₃⟩ + · have hz_a₀ : z = a₀ := by + have : z ∈ V(P_sa₀) ∩ V(P_a₀u) := ⟨hz₁, hP_yu.vertexSet_mono hz₃⟩ + rwa [hinter_a₀, mem_singleton_iff] at this + subst hz_a₀ + exact (ha₀_not_yu hz₃).elim + · have : z ∈ V(P_a₀y) ∩ V(P_yu) := ⟨hz₂, hz₃⟩ + rwa [hinter_y, mem_singleton_iff] at this + · rintro rfl + exact ⟨Or.inr hpath_a₀y.right_mem, hpath_yu.left_mem⟩ + have hunion_sy : V(subgraphUnion Q P_sa₀ P_a₀y) ∪ V(P_yu) = V(Q) := by + rw [vertexSet_subgraphUnion, union_assoc, + ← vertexSet_subgraphUnion P_a₀u P_a₀y P_yu, hunion_y, hunion_a₀] + exact ih V(P_yu).ncard hlt y (subgraphUnion Q P_sa₀ P_a₀y) P_yu hyY + (subgraphUnion_le hP_sa₀ (hP_a₀y.trans hP_a₀u)) (hP_yu.trans hP_a₀u) + hpath_sy (hpath_yu.mono hP_a₀u) hinter_sy hunion_sy rfl + · refine ⟨a₀, ha₀Y, P_sa₀, P_a₀u, hP_sa₀, hP_a₀u, hpath_sa₀, hpath_a₀u, hinter_a₀, + hunion_a₀, ?_⟩ + rw [disjoint_left] + exact fun y hy hyY => hhit ⟨y, hy, hyY⟩ + +/-- If `P` is a path in `K` from `s` to `t`, `Y ⊆ V(P)` with `s, t ∈ Y`, and `u, v ∈ V(P)` are +distinct vertices such that for every three-way split `P = P_su ∪ P_uv ∪ P_vt` between `{u, v}`, +`Disjoint (V(P_uv) \ {u, v}) Y`, then there exist `a, c ∈ Y` with `a ≠ c` and a three-way split +`P = P_sa ∪ P_ac ∪ P_ct` such that `u, v ∈ V(P_ac)` and `Disjoint (V(P_ac) \ {a, c}) Y`. -/ +theorem exists_minimal_Y_interval_containing_pair {K P : Graph α β} {s t u v : α} {Y : Set α} + (hPK : IsGraphPathWithEnds K P s t) + (hsY : s ∈ Y) (htY : t ∈ Y) + (huP : u ∈ V(P)) (hvP : v ∈ V(P)) (huv : u ≠ v) + (hno_Y_between : ∀ u' v' : α, ({u', v'} : Set α) = {u, v} → + ∀ P_su P_uv P_vt : Graph α β, + P_su ≤ P → P_uv ≤ P → P_vt ≤ P → + IsGraphPathWithEnds P P_su s u' → + IsGraphPathWithEnds P P_uv u' v' → + IsGraphPathWithEnds P P_vt v' t → + V(P_su) ∩ V(P_uv) = {u'} → + V(P_uv) ∩ V(P_vt) = {v'} → + Disjoint V(P_su) V(P_vt) → + Disjoint (V(P_uv) \ {u', v'}) Y) : + ∃ a ∈ Y, ∃ c ∈ Y, a ≠ c ∧ + ∃ P_sa P_ac P_ct : Graph α β, + P_sa ≤ P ∧ P_ac ≤ P ∧ P_ct ≤ P ∧ + IsGraphPathWithEnds P P_sa s a ∧ + IsGraphPathWithEnds P P_ac a c ∧ + IsGraphPathWithEnds P P_ct c t ∧ + V(P_sa) ∩ V(P_ac) = {a} ∧ + V(P_ac) ∩ V(P_ct) = {c} ∧ + Disjoint V(P_sa) V(P_ct) ∧ + V(P_sa) ∪ V(P_ac) ∪ V(P_ct) = V(P) ∧ + u ∈ V(P_ac) ∧ v ∈ V(P_ac) ∧ + Disjoint (V(P_ac) \ {a, c}) Y := by + classical + -- First obtain the three-way split of `P` at `u` and `v`: + obtain ⟨u', v', huv_eq, huv'_ne, P_su, P_uv, P_vt, + hP_su, hP_uv, hP_vt, hpath_su, hpath_uv, hpath_vt, + hinter_su, hinter_vt, hdisj_suvt, hV_union_suvt, _, _, _, _⟩ := + exists_three_way_split hPK huP hvP huv + have hdisj_uv_Y : Disjoint (V(P_uv) \ {u', v'}) Y := + hno_Y_between u' v' huv_eq P_su P_uv P_vt hP_su hP_uv hP_vt + hpath_su hpath_uv hpath_vt hinter_su hinter_vt hdisj_suvt + obtain ⟨P_ss, P_su', hP_ss, hP_su', hpath_ss, hpath_su', hunion_ss, hinter_ss, _⟩ := + hpath_su.exists_split_at hpath_su.left_mem + have hV_ss : V(P_ss) ∪ V(P_su') = V(P_su) := by + rw [← vertexSet_subgraphUnion P_su P_ss P_su', hunion_ss] + obtain ⟨a, haY, P_sa, P_au, hP_sa, hP_au, hpath_sa, hpath_au, hinter_au, hunion_au, hdisj_au⟩ := + trim_path_from_left V(P_su').ncard s P_ss P_su' hsY hP_ss hP_su' + hpath_ss hpath_su' hinter_ss hV_ss rfl + obtain ⟨P_vt', P_tt, hP_vt', hP_tt, hpath_vt', hpath_tt, hunion_tt, hinter_tt, _⟩ := + hpath_vt.exists_split_at hpath_vt.right_mem + have hV_tt : V(P_vt') ∪ V(P_tt) = V(P_vt) := by + rw [← vertexSet_subgraphUnion P_vt P_vt' P_tt, hunion_tt] + obtain ⟨c, hcY, P_ct, P_vc, hP_ct, hP_vc, hpath_tc, hpath_cv, hinter_cv, hunion_cv, hdisj_vc⟩ := + trim_path_from_left V(P_vt').ncard t P_tt P_vt' htY hP_tt hP_vt' + hpath_tt.symm hpath_vt'.symm (inter_comm _ _ ▸ hinter_tt) + (union_comm _ _ ▸ hV_tt) rfl + have hpath_vc := hpath_cv.symm + have hpath_ct := hpath_tc.symm + have hinter_vc : V(P_vc) ∩ V(P_ct) = {c} := inter_comm _ _ ▸ hinter_cv + have hunion_vc : V(P_vc) ∪ V(P_ct) = V(P_vt) := union_comm _ _ ▸ hunion_cv + -- Now combine `P_ac := P_au ∪ P_uv ∪ P_vc`! + have hP_auP : P_au ≤ P := hP_au.trans hP_su + have hP_vcP : P_vc ≤ P := hP_vc.trans hP_vt + have hV_au_uv : V(P_au) ∩ V(P_uv) = {u'} := by + ext z + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hz₁, hz₂⟩ => by + have : z ∈ V(P_su) ∩ V(P_uv) := ⟨hP_au.vertexSet_mono hz₁, hz₂⟩ + rwa [hinter_su, mem_singleton_iff] at this, + fun h => h ▸ ⟨hpath_au.right_mem, hpath_uv.left_mem⟩⟩ + have hpath_av : IsGraphPathWithEnds P (subgraphUnion P P_au P_uv) a v' := + (hpath_au.mono hP_su).subgraphUnion hpath_uv hV_au_uv + have hV_av_vc : V(subgraphUnion P P_au P_uv) ∩ V(P_vc) = {v'} := by + ext z + simp only [vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hz₁ | hz₂, hz₃⟩ + · exact (disjoint_left.mp hdisj_suvt (hP_au.vertexSet_mono hz₁) + (hP_vc.vertexSet_mono hz₃)).elim + · have : z ∈ V(P_uv) ∩ V(P_vt) := ⟨hz₂, hP_vc.vertexSet_mono hz₃⟩ + rwa [hinter_vt, mem_singleton_iff] at this + · rintro rfl + exact ⟨Or.inr hpath_uv.right_mem, hpath_vc.left_mem⟩ + let P_ac := subgraphUnion P (subgraphUnion P P_au P_uv) P_vc + have hP_acP : P_ac ≤ P := subgraphUnion_le (subgraphUnion_le hP_auP hP_uv) hP_vcP + have hpath_ac : IsGraphPathWithEnds P P_ac a c := + hpath_av.subgraphUnion (hpath_vc.mono hP_vt) hV_av_vc + have hac_ne : a ≠ c := by + intro hac_eq + have ha_su : a ∈ V(P_su) := hP_au.vertexSet_mono hpath_au.left_mem + have hc_vt : c ∈ V(P_vt) := hP_vc.vertexSet_mono hpath_vc.right_mem + exact disjoint_left.mp hdisj_suvt ha_su (hac_eq ▸ hc_vt) + refine ⟨a, haY, c, hcY, hac_ne, P_sa, P_ac, P_ct, + hP_sa.trans hP_su, hP_acP, hP_ct.trans hP_vt, + hpath_sa.mono hP_su, hpath_ac, hpath_ct.mono hP_vt, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · -- `V(P_sa) ∩ V(P_ac) = {a}` + ext z + simp only [P_ac, vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hz_sa, (hz_au | hz_uv) | hz_vc⟩ + · have : z ∈ V(P_sa) ∩ V(P_au) := ⟨hz_sa, hz_au⟩ + rwa [hinter_au, mem_singleton_iff] at this + · have hz_u' : z = u' := by + have : z ∈ V(P_su) ∩ V(P_uv) := ⟨hP_sa.vertexSet_mono hz_sa, hz_uv⟩ + rwa [hinter_su, mem_singleton_iff] at this + subst hz_u' + have : z ∈ V(P_sa) ∩ V(P_au) := ⟨hz_sa, hpath_au.right_mem⟩ + rwa [hinter_au, mem_singleton_iff] at this + · exact (disjoint_left.mp hdisj_suvt (hP_sa.vertexSet_mono hz_sa) + (hP_vc.vertexSet_mono hz_vc)).elim + · rintro rfl + exact ⟨hpath_sa.right_mem, Or.inl (Or.inl hpath_au.left_mem)⟩ + · -- `V(P_ac) ∩ V(P_ct) = {c}` + ext z + simp only [P_ac, vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨(hz_au | hz_uv) | hz_vc, hz_ct⟩ + · exact (disjoint_left.mp hdisj_suvt (hP_au.vertexSet_mono hz_au) + (hP_ct.vertexSet_mono hz_ct)).elim + · have hz_v' : z = v' := by + have : z ∈ V(P_uv) ∩ V(P_vt) := ⟨hz_uv, hP_ct.vertexSet_mono hz_ct⟩ + rwa [hinter_vt, mem_singleton_iff] at this + subst hz_v' + have : z ∈ V(P_vc) ∩ V(P_ct) := ⟨hpath_vc.left_mem, hz_ct⟩ + rwa [hinter_vc, mem_singleton_iff] at this + · have : z ∈ V(P_vc) ∩ V(P_ct) := ⟨hz_vc, hz_ct⟩ + rwa [hinter_vc, mem_singleton_iff] at this + · rintro rfl + exact ⟨Or.inr hpath_vc.right_mem, hpath_ct.left_mem⟩ + · -- `Disjoint V(P_sa) V(P_ct)` + exact hdisj_suvt.mono hP_sa.vertexSet_mono hP_ct.vertexSet_mono + · -- `V(P_sa) ∪ V(P_ac) ∪ V(P_ct) = V(P)` + change V(P_sa) ∪ (V(P_au) ∪ V(P_uv) ∪ V(P_vc)) ∪ V(P_ct) = V(P) + have : V(P_sa) ∪ (V(P_au) ∪ V(P_uv) ∪ V(P_vc)) ∪ V(P_ct) = + (V(P_sa) ∪ V(P_au)) ∪ V(P_uv) ∪ (V(P_vc) ∪ V(P_ct)) := by + ext z; simp [or_assoc] + rw [this, hunion_au, hunion_vc, hV_union_suvt] + · -- `u ∈ V(P_ac)` + have hu_in : u ∈ ({u', v'} : Set α) := by rw [huv_eq]; simp + simp only [P_ac, vertexSet_subgraphUnion, mem_union] + rcases hu_in with rfl | rfl + · exact Or.inl (Or.inr hpath_uv.left_mem) + · exact Or.inl (Or.inr hpath_uv.right_mem) + · -- `v ∈ V(P_ac)` + have hv_in : v ∈ ({u', v'} : Set α) := by rw [huv_eq]; simp + simp only [P_ac, vertexSet_subgraphUnion, mem_union] + rcases hv_in with rfl | rfl + · exact Or.inl (Or.inr hpath_uv.left_mem) + · exact Or.inl (Or.inr hpath_uv.right_mem) + · -- `Disjoint (V(P_ac) \ {a, c}) Y` + rw [disjoint_left] + rintro z ⟨hz_ac, hz_not_ac⟩ hzY + simp only [mem_insert_iff, mem_singleton_iff, not_or] at hz_not_ac + simp only [P_ac, vertexSet_subgraphUnion, mem_union] at hz_ac + rcases hz_ac with (hz_au | hz_uv) | hz_vc + · exact disjoint_left.mp hdisj_au ⟨hz_au, hz_not_ac.1⟩ hzY + · by_cases hzu : z = u' + · subst hzu + exact disjoint_left.mp hdisj_au ⟨hpath_au.right_mem, hz_not_ac.1⟩ hzY + · by_cases hzv : z = v' + · subst hzv + exact disjoint_left.mp hdisj_vc ⟨hpath_vc.left_mem, hz_not_ac.2⟩ hzY + · exact disjoint_left.mp hdisj_uv_Y ⟨hz_uv, by simp [hzu, hzv]⟩ hzY + · exact disjoint_left.mp hdisj_vc ⟨hz_vc, hz_not_ac.2⟩ hzY + +private theorem trim_path_around_vertex {P : Graph α β} {s t u : α} {Y : Set α} : + ∀ (n : ℕ) (a₀ c₀ : α) (P_sa₀ P_ac₀ P_c₀t : Graph α β), + a₀ ∈ Y → c₀ ∈ Y → a₀ ≠ c₀ → + P_sa₀ ≤ P → P_ac₀ ≤ P → P_c₀t ≤ P → + IsGraphPathWithEnds P P_sa₀ s a₀ → + IsGraphPathWithEnds P P_ac₀ a₀ c₀ → + IsGraphPathWithEnds P P_c₀t c₀ t → + V(P_sa₀) ∩ V(P_ac₀) = {a₀} → + V(P_ac₀) ∩ V(P_c₀t) = {c₀} → + Disjoint V(P_sa₀) V(P_c₀t) → + V(P_sa₀) ∪ V(P_ac₀) ∪ V(P_c₀t) = V(P) → + u ∈ V(P_ac₀) → + V(P_ac₀).ncard = n → + ∃ a ∈ Y, ∃ c ∈ Y, a ≠ c ∧ + ∃ P_sa P_ac P_ct : Graph α β, + P_sa ≤ P ∧ P_ac ≤ P ∧ P_ct ≤ P ∧ + IsGraphPathWithEnds P P_sa s a ∧ + IsGraphPathWithEnds P P_ac a c ∧ + IsGraphPathWithEnds P P_ct c t ∧ + V(P_sa) ∩ V(P_ac) = {a} ∧ + V(P_ac) ∩ V(P_ct) = {c} ∧ + Disjoint V(P_sa) V(P_ct) ∧ + V(P_sa) ∪ V(P_ac) ∪ V(P_ct) = V(P) ∧ + u ∈ V(P_ac) ∧ + Disjoint (V(P_ac) \ {a, c}) Y := by + classical + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro a₀ c₀ P_sa₀ P_ac₀ P_c₀t ha₀Y hc₀Y ha₀c₀ hP_sa₀ hP_ac₀ hP_c₀t + hpath_sa₀ hpath_ac₀ hpath_c₀t hinter_sa₀ hinter_c₀t hdisj_sa₀c₀t hunion_sa₀c₀t hu_ac₀ hcard + by_cases hhit : ∃ y ∈ V(P_ac₀) \ {a₀, c₀}, y ∈ Y + · rcases hhit with ⟨y, ⟨hy_in, hy_ne⟩, hyY⟩ + simp only [mem_insert_iff, mem_singleton_iff, not_or] at hy_ne + obtain ⟨P_a₀y, P_yc₀, hP_a₀y, hP_yc₀, hpath_a₀y, hpath_yc₀, hunion_y, hinter_y, _⟩ := + hpath_ac₀.exists_split_at hy_in + have hV_y : V(P_a₀y) ∪ V(P_yc₀) = V(P_ac₀) := by + rw [← vertexSet_subgraphUnion P_ac₀ P_a₀y P_yc₀, hunion_y] + have ha₀_not_yc₀ : a₀ ∉ V(P_yc₀) := by + intro h + have : a₀ ∈ V(P_a₀y) ∩ V(P_yc₀) := ⟨hpath_a₀y.left_mem, h⟩ + rw [hinter_y, mem_singleton_iff] at this + exact hy_ne.1 this.symm + have hc₀_not_a₀y : c₀ ∉ V(P_a₀y) := by + intro h + have : c₀ ∈ V(P_a₀y) ∩ V(P_yc₀) := ⟨h, hpath_yc₀.right_mem⟩ + rw [hinter_y, mem_singleton_iff] at this + exact hy_ne.2 this.symm + have hu_split : u ∈ V(P_a₀y) ∪ V(P_yc₀) := by + rw [hV_y]; exact hu_ac₀ + rcases hu_split with hu_a₀y | hu_yc₀ + · -- `u ∈ V(P_a₀y)`: replace `c₀` by `y`! + have hlt : V(P_a₀y).ncard < n := by + rw [← hcard] + exact Set.ncard_lt_ncard + ⟨hP_a₀y.vertexSet_mono, fun hsub => hc₀_not_a₀y (hsub hpath_ac₀.right_mem)⟩ + hpath_ac₀.vertexSet_finite + have hV_yc₀_c₀t : V(P_yc₀) ∩ V(P_c₀t) = {c₀} := by + ext z + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hz₁, hz₂⟩ => by + have : z ∈ V(P_ac₀) ∩ V(P_c₀t) := ⟨hP_yc₀.vertexSet_mono hz₁, hz₂⟩ + rwa [hinter_c₀t, mem_singleton_iff] at this, + fun h => h ▸ ⟨hpath_yc₀.right_mem, hpath_c₀t.left_mem⟩⟩ + have hpath_yt : IsGraphPathWithEnds P (subgraphUnion P P_yc₀ P_c₀t) y t := + (hpath_yc₀.mono hP_ac₀).subgraphUnion hpath_c₀t hV_yc₀_c₀t + have hinter_sa₀_a₀y : V(P_sa₀) ∩ V(P_a₀y) = {a₀} := by + ext z + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hz₁, hz₂⟩ => by + have : z ∈ V(P_sa₀) ∩ V(P_ac₀) := ⟨hz₁, hP_a₀y.vertexSet_mono hz₂⟩ + rwa [hinter_sa₀, mem_singleton_iff] at this, + fun h => h ▸ ⟨hpath_sa₀.right_mem, hpath_a₀y.left_mem⟩⟩ + have hinter_a₀y_yt : V(P_a₀y) ∩ V(subgraphUnion P P_yc₀ P_c₀t) = {y} := by + ext z + simp only [vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hz₁, hz₂ | hz₃⟩ + · have : z ∈ V(P_a₀y) ∩ V(P_yc₀) := ⟨hz₁, hz₂⟩ + rwa [hinter_y, mem_singleton_iff] at this + · have hz_c₀ : z = c₀ := by + have : z ∈ V(P_ac₀) ∩ V(P_c₀t) := ⟨hP_a₀y.vertexSet_mono hz₁, hz₃⟩ + rwa [hinter_c₀t, mem_singleton_iff] at this + subst hz_c₀ + exact (hc₀_not_a₀y hz₁).elim + · rintro rfl + exact ⟨hpath_a₀y.right_mem, Or.inl hpath_yc₀.left_mem⟩ + have hdisj_sa₀_yt : Disjoint V(P_sa₀) V(subgraphUnion P P_yc₀ P_c₀t) := by + rw [vertexSet_subgraphUnion, disjoint_union_right] + refine ⟨?_, hdisj_sa₀c₀t⟩ + rw [disjoint_left] + intro z hz₁ hz₂ + have hz_a₀ : z = a₀ := by + have : z ∈ V(P_sa₀) ∩ V(P_ac₀) := ⟨hz₁, hP_yc₀.vertexSet_mono hz₂⟩ + rwa [hinter_sa₀, mem_singleton_iff] at this + subst hz_a₀ + exact ha₀_not_yc₀ hz₂ + have hunion_new : V(P_sa₀) ∪ V(P_a₀y) ∪ V(subgraphUnion P P_yc₀ P_c₀t) = V(P) := by + rw [vertexSet_subgraphUnion] + have : V(P_sa₀) ∪ V(P_a₀y) ∪ (V(P_yc₀) ∪ V(P_c₀t)) = + V(P_sa₀) ∪ (V(P_a₀y) ∪ V(P_yc₀)) ∪ V(P_c₀t) := by + ext z; simp [or_assoc] + rw [this, hV_y, hunion_sa₀c₀t] + exact ih V(P_a₀y).ncard hlt a₀ y P_sa₀ P_a₀y (subgraphUnion P P_yc₀ P_c₀t) + ha₀Y hyY (Ne.symm hy_ne.1) hP_sa₀ (hP_a₀y.trans hP_ac₀) + (subgraphUnion_le (hP_yc₀.trans hP_ac₀) hP_c₀t) + hpath_sa₀ (hpath_a₀y.mono hP_ac₀) hpath_yt + hinter_sa₀_a₀y hinter_a₀y_yt hdisj_sa₀_yt hunion_new hu_a₀y rfl + · -- `u ∈ V(P_yc₀)`: replace `a₀` by `y`! + have hlt : V(P_yc₀).ncard < n := by + rw [← hcard] + exact Set.ncard_lt_ncard + ⟨hP_yc₀.vertexSet_mono, fun hsub => ha₀_not_yc₀ (hsub hpath_ac₀.left_mem)⟩ + hpath_ac₀.vertexSet_finite + have hV_sa₀_a₀y : V(P_sa₀) ∩ V(P_a₀y) = {a₀} := by + ext z + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hz₁, hz₂⟩ => by + have : z ∈ V(P_sa₀) ∩ V(P_ac₀) := ⟨hz₁, hP_a₀y.vertexSet_mono hz₂⟩ + rwa [hinter_sa₀, mem_singleton_iff] at this, + fun h => h ▸ ⟨hpath_sa₀.right_mem, hpath_a₀y.left_mem⟩⟩ + have hpath_sy : IsGraphPathWithEnds P (subgraphUnion P P_sa₀ P_a₀y) s y := + hpath_sa₀.subgraphUnion (hpath_a₀y.mono hP_ac₀) hV_sa₀_a₀y + have hinter_sy_yc₀ : V(subgraphUnion P P_sa₀ P_a₀y) ∩ V(P_yc₀) = {y} := by + ext z + simp only [vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hz₁ | hz₂, hz₃⟩ + · have hz_a₀ : z = a₀ := by + have : z ∈ V(P_sa₀) ∩ V(P_ac₀) := ⟨hz₁, hP_yc₀.vertexSet_mono hz₃⟩ + rwa [hinter_sa₀, mem_singleton_iff] at this + subst hz_a₀ + exact (ha₀_not_yc₀ hz₃).elim + · have : z ∈ V(P_a₀y) ∩ V(P_yc₀) := ⟨hz₂, hz₃⟩ + rwa [hinter_y, mem_singleton_iff] at this + · rintro rfl + exact ⟨Or.inr hpath_a₀y.right_mem, hpath_yc₀.left_mem⟩ + have hinter_yc₀_c₀t : V(P_yc₀) ∩ V(P_c₀t) = {c₀} := by + ext z + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hz₁, hz₂⟩ => by + have : z ∈ V(P_ac₀) ∩ V(P_c₀t) := ⟨hP_yc₀.vertexSet_mono hz₁, hz₂⟩ + rwa [hinter_c₀t, mem_singleton_iff] at this, + fun h => h ▸ ⟨hpath_yc₀.right_mem, hpath_c₀t.left_mem⟩⟩ + have hdisj_sy_c₀t : Disjoint V(subgraphUnion P P_sa₀ P_a₀y) V(P_c₀t) := by + rw [vertexSet_subgraphUnion, disjoint_union_left] + refine ⟨hdisj_sa₀c₀t, ?_⟩ + rw [disjoint_left] + intro z hz₁ hz₂ + have hz_c₀ : z = c₀ := by + have : z ∈ V(P_ac₀) ∩ V(P_c₀t) := ⟨hP_a₀y.vertexSet_mono hz₁, hz₂⟩ + rwa [hinter_c₀t, mem_singleton_iff] at this + subst hz_c₀ + exact hc₀_not_a₀y hz₁ + have hunion_new : V(subgraphUnion P P_sa₀ P_a₀y) ∪ V(P_yc₀) ∪ V(P_c₀t) = V(P) := by + rw [vertexSet_subgraphUnion] + have : (V(P_sa₀) ∪ V(P_a₀y)) ∪ V(P_yc₀) ∪ V(P_c₀t) = + V(P_sa₀) ∪ (V(P_a₀y) ∪ V(P_yc₀)) ∪ V(P_c₀t) := by + ext z; simp [or_assoc] + rw [this, hV_y, hunion_sa₀c₀t] + exact ih V(P_yc₀).ncard hlt y c₀ (subgraphUnion P P_sa₀ P_a₀y) P_yc₀ P_c₀t + hyY hc₀Y hy_ne.2 + (subgraphUnion_le hP_sa₀ (hP_a₀y.trans hP_ac₀)) (hP_yc₀.trans hP_ac₀) hP_c₀t + hpath_sy (hpath_yc₀.mono hP_ac₀) hpath_c₀t + hinter_sy_yc₀ hinter_yc₀_c₀t hdisj_sy_c₀t hunion_new hu_yc₀ rfl + · refine ⟨a₀, ha₀Y, c₀, hc₀Y, ha₀c₀, P_sa₀, P_ac₀, P_c₀t, + hP_sa₀, hP_ac₀, hP_c₀t, hpath_sa₀, hpath_ac₀, hpath_c₀t, + hinter_sa₀, hinter_c₀t, hdisj_sa₀c₀t, hunion_sa₀c₀t, hu_ac₀, ?_⟩ + rw [disjoint_left] + exact fun y hy hyY => hhit ⟨y, hy, hyY⟩ + +/-- If `P` is a path in `K` from `s` to `t`, `Y ⊆ V(P)` with `s, t ∈ Y` and `s ≠ t`, and `u ∈ V(P)`, +then there exist `a, c ∈ Y` with `a ≠ c` and a three-way split `P = P_sa ∪ P_ac ∪ P_ct` such that +`u ∈ V(P_ac)` and `Disjoint (V(P_ac) \ {a, c}) Y`. -/ +theorem exists_minimal_Y_interval_containing_single {K P : Graph α β} {s t u : α} {Y : Set α} + (hPK : IsGraphPathWithEnds K P s t) + (hst : s ≠ t) (hsY : s ∈ Y) (htY : t ∈ Y) (huP : u ∈ V(P)) : + ∃ a ∈ Y, ∃ c ∈ Y, a ≠ c ∧ + ∃ P_sa P_ac P_ct : Graph α β, + P_sa ≤ P ∧ P_ac ≤ P ∧ P_ct ≤ P ∧ + IsGraphPathWithEnds P P_sa s a ∧ + IsGraphPathWithEnds P P_ac a c ∧ + IsGraphPathWithEnds P P_ct c t ∧ + V(P_sa) ∩ V(P_ac) = {a} ∧ + V(P_ac) ∩ V(P_ct) = {c} ∧ + Disjoint V(P_sa) V(P_ct) ∧ + V(P_sa) ∪ V(P_ac) ∪ V(P_ct) = V(P) ∧ + u ∈ V(P_ac) ∧ + Disjoint (V(P_ac) \ {a, c}) Y := by + classical + obtain ⟨s', t', hst_eq, hst'_ne, P_ss, P_st, P_tt, + hP_ss, hP_st, hP_tt, hpath_ss, hpath_st, hpath_tt, + hinter_ss, hinter_tt, hdisj_sstt, hV_union, _, _, _, _⟩ := + exists_three_way_split hPK hPK.left_mem hPK.right_mem hst + -- From `exists_three_way_split` at `s, t`, `s' = s` and `t' = t`! + have hs'_eq : s' = s := by + have hs_in : s = s' ∨ s = t' := by + have : s ∈ ({s', t'} : Set α) := by rw [hst_eq]; simp + simpa using this + rcases hs_in with h | h + · exact h.symm + · rw [← h] at hpath_tt + exact (disjoint_left.mp hdisj_sstt hpath_ss.left_mem hpath_tt.left_mem).elim + have ht'_eq : t' = t := by + have ht_in : t = s' ∨ t = t' := by + have : t ∈ ({s', t'} : Set α) := by rw [hst_eq]; simp + simpa using this + rcases ht_in with h | h + · exact (hst (hs'_eq.symm.trans h.symm)).elim + · exact h.symm + rw [hs'_eq] at hpath_ss hpath_st hinter_ss + rw [ht'_eq] at hpath_st hpath_tt hinter_tt + have hu_st : u ∈ V(P_st) := by + have hu_in : u ∈ V(P_ss) ∪ V(P_st) ∪ V(P_tt) := by rw [hV_union]; exact huP + rcases hu_in with (hu_ss | hu_st) | hu_tt + · rcases hpath_ss with ⟨_, W_ss, hW_ss, hV_ss, _⟩ + have hlen0 := hW_ss.length_eq_zero + cases W_ss with + | nil _ => + rw [hV_ss] at hu_ss + simp only [GraphWalk.support_nil, List.mem_singleton] at hu_ss + rw [hu_ss] + exact hpath_st.left_mem + | cons _ _ => simp at hlen0 + · exact hu_st + · rcases hpath_tt with ⟨_, W_tt, hW_tt, hV_tt, _⟩ + have hlen0 := hW_tt.length_eq_zero + cases W_tt with + | nil _ => + rw [hV_tt] at hu_tt + simp only [GraphWalk.support_nil, List.mem_singleton] at hu_tt + rw [hu_tt] + exact hpath_st.right_mem + | cons _ _ => simp at hlen0 + exact trim_path_around_vertex V(P_st).ncard s t P_ss P_st P_tt hsY htY hst + hP_ss hP_st hP_tt hpath_ss hpath_st hpath_tt hinter_ss hinter_tt hdisj_sstt hV_union hu_st rfl + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section2b.lean b/LeanPool/GraphMinor/GM09/Section2b.lean new file mode 100644 index 0000000000..ff57d26119 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section2b.lean @@ -0,0 +1,779 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2a + +/-! +# Graph Minors IX, Section 2 (Part 2): Completion of (2.1) + +This file completes the proof of (2.1) from Section 2 of +N. Robertson and P. D. Seymour, *Graph Minors. IX. Disjoint crossed paths*, +J. Combin. Theory Ser. B **49** (1990) 40–77 (pages 43–44). +-/ + +public section + +namespace GraphMinor.GM09 + +open Set Graph GraphMinor.Surface GraphMinor.GM06 + +universe u v + +variable {α : Type u} {β : Type v} + +private theorem detour_excludes_marked_vertex + {K P P_sa P_ac P_ct R : Graph α β} {s t a c u v : α} + (hPK : IsGraphPathWithEnds K P s t) + (hP_sa_le : P_sa ≤ P) (hP_ac_le : P_ac ≤ P) (hP_ct_le : P_ct ≤ P) + (hpath_sa : IsGraphPathWithEnds P P_sa s a) + (hpath_ac : IsGraphPathWithEnds P P_ac a c) + (hpath_ct : IsGraphPathWithEnds P P_ct c t) + (hinter_sa : V(P_sa) ∩ V(P_ac) = {a}) + (hinter_ct : V(P_ac) ∩ V(P_ct) = {c}) + (hdisj_sact : Disjoint V(P_sa) V(P_ct)) + (hforced : ∀ Q : Graph α β, IsGraphPathWithEnds K Q s t → a ∈ V(Q)) + (hv_sa : v ∈ V(P_sa)) (hu_ac : u ∈ V(P_ac)) + (hva_ne : v ≠ a) (hau_ne : a ≠ u) + (hRK : IsGraphPathWithEnds K R u v) (hRP : V(R) ∩ V(P) = {u, v}) : False := by + obtain ⟨P_sv, P_va, hP_sv, hP_va, hpath_sv, hpath_va, _, hinter_v, _⟩ := + hpath_sa.exists_split_at hv_sa + obtain ⟨P_au, P_uc, hP_au, hP_uc, hpath_au, hpath_uc, _, hinter_u, _⟩ := + hpath_ac.exists_split_at hu_ac + have hV_va_au : V(P_va) ∩ V(P_au) = {a} := by + ext z + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hz₁, hz₂⟩ => by + have : z ∈ V(P_sa) ∩ V(P_ac) := ⟨hP_va.vertexSet_mono hz₁, hP_au.vertexSet_mono hz₂⟩ + rwa [hinter_sa, mem_singleton_iff] at this, + fun h => h ▸ ⟨hpath_va.right_mem, hpath_au.left_mem⟩⟩ + have hpath_vu : IsGraphPathWithEnds P (subgraphUnion P P_va P_au) v u := + (hpath_va.mono hP_sa_le).subgraphUnion (hpath_au.mono hP_ac_le) hV_va_au + have hV_uc_ct : V(P_uc) ∩ V(P_ct) = {c} := by + ext z + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hz₁, hz₂⟩ => by + have : z ∈ V(P_ac) ∩ V(P_ct) := ⟨hP_uc.vertexSet_mono hz₁, hz₂⟩ + rwa [hinter_ct, mem_singleton_iff] at this, + fun h => h ▸ ⟨hpath_uc.right_mem, hpath_ct.left_mem⟩⟩ + have hpath_ut : IsGraphPathWithEnds P (subgraphUnion P P_uc P_ct) u t := + (hpath_uc.mono hP_ac_le).subgraphUnion hpath_ct hV_uc_ct + have hinter_sv_vu : V(P_sv) ∩ V(subgraphUnion P P_va P_au) = {v} := by + ext z + simp only [vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hz₁, hz₂ | hz₃⟩ + · have : z ∈ V(P_sv) ∩ V(P_va) := ⟨hz₁, hz₂⟩ + rwa [hinter_v, mem_singleton_iff] at this + · have hz_a : z = a := by + have : z ∈ V(P_sa) ∩ V(P_ac) := ⟨hP_sv.vertexSet_mono hz₁, hP_au.vertexSet_mono hz₃⟩ + rwa [hinter_sa, mem_singleton_iff] at this + subst hz_a + have : z ∈ V(P_sv) ∩ V(P_va) := ⟨hz₁, hpath_va.right_mem⟩ + rwa [hinter_v, mem_singleton_iff] at this + · rintro rfl + exact ⟨hpath_sv.right_mem, Or.inl hpath_va.left_mem⟩ + have hinter_vu_ut : V(subgraphUnion P P_va P_au) ∩ V(subgraphUnion P P_uc P_ct) = {u} := by + ext z + simp only [vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hz₁ | hz₂, hz₃ | hz₄⟩ + · have hz_a : z = a := by + have : z ∈ V(P_sa) ∩ V(P_ac) := ⟨hP_va.vertexSet_mono hz₁, hP_uc.vertexSet_mono hz₃⟩ + rwa [hinter_sa, mem_singleton_iff] at this + subst hz_a + have : z ∈ V(P_au) ∩ V(P_uc) := ⟨hpath_au.left_mem, hz₃⟩ + rwa [hinter_u, mem_singleton_iff] at this + · exact (disjoint_left.mp hdisj_sact (hP_va.vertexSet_mono hz₁) hz₄).elim + · have : z ∈ V(P_au) ∩ V(P_uc) := ⟨hz₂, hz₃⟩ + rwa [hinter_u, mem_singleton_iff] at this + · have hz_c : z = c := by + have : z ∈ V(P_ac) ∩ V(P_ct) := ⟨hP_au.vertexSet_mono hz₂, hz₄⟩ + rwa [hinter_ct, mem_singleton_iff] at this + subst hz_c + have : z ∈ V(P_au) ∩ V(P_uc) := ⟨hz₂, hpath_uc.right_mem⟩ + rwa [hinter_u, mem_singleton_iff] at this + · rintro rfl + exact ⟨Or.inr hpath_au.right_mem, Or.inl hpath_uc.left_mem⟩ + have hdisj_sv_ut : Disjoint V(P_sv) V(subgraphUnion P P_uc P_ct) := by + rw [vertexSet_subgraphUnion, disjoint_union_right] + refine ⟨?_, hdisj_sact.mono_left hP_sv.vertexSet_mono⟩ + rw [disjoint_left] + intro z hz₁ hz₂ + have hz_a : z = a := by + have : z ∈ V(P_sa) ∩ V(P_ac) := ⟨hP_sv.vertexSet_mono hz₁, hP_uc.vertexSet_mono hz₂⟩ + rwa [hinter_sa, mem_singleton_iff] at this + subst hz_a + have ha_v : z = v := by + have : z ∈ V(P_sv) ∩ V(P_va) := ⟨hz₁, hpath_va.right_mem⟩ + rwa [hinter_v, mem_singleton_iff] at this + exact hva_ne ha_v.symm + obtain ⟨Q, hQK, hdisjQ⟩ := exists_detour_path hPK + (hP_sv.trans hP_sa_le) + (subgraphUnion_le (hP_va.trans hP_sa_le) (hP_au.trans hP_ac_le)) + (subgraphUnion_le (hP_uc.trans hP_ac_le) hP_ct_le) + (hpath_sv.mono hP_sa_le) hpath_vu hpath_ut + hinter_sv_vu hinter_vu_ut hdisj_sv_ut hRK.symm + (by rw [hRP]; ext z; simp [or_comm]) + have ha_in_vu : a ∈ V(subgraphUnion P P_va P_au) \ {v, u} := + ⟨Or.inl hpath_va.right_mem, by simp [hva_ne.symm, hau_ne]⟩ + exact disjoint_left.mp hdisjQ ha_in_vu (hforced Q hQK) + +/-- Given a three-way split `P = P_sa ∪ P_ac ∪ P_ct` at `a, c ∈ X ∪ {s, t}` with +`Disjoint (V(P_ac) \ {a, c}) (X ∪ {s, t})`, let `W` be the set of vertices in `V(K) \ V(P)` that +are in a component `C` of `K \ V(P)` having a neighbor in `V(P_ac) \ {a, c}`. Then no vertex of +`(V(P_ac) ∪ W) \ {a, c}` is adjacent in `G` to any vertex outside `V(P_ac) ∪ W`. -/ +theorem no_out_of_open_interval_and_components {G H P P_sa P_ac P_ct : Graph α β} + {Z : Set α} {s t a c : α} + (hHG : H ≤ G) (hZ : Catches Z H) + (hmax : ∀ H' : Graph α β, H ≤ H' → H' ≤ G → Catches Z H' → + (∃ Q : Graph α β, IsGraphPathWithEnds G Q s t ∧ Avoids Q V(H')) → H' = H) + (hPK : IsGraphPathWithEnds (deleteVertices G V(H)) P s t) + (ha_mem : a ∈ {x ∈ V(deleteVertices G V(H)) | ∃ h ∈ V(H), G.Adj x h} ∪ {s, t}) + (hc_mem : c ∈ {x ∈ V(deleteVertices G V(H)) | ∃ h ∈ V(H), G.Adj x h} ∪ {s, t}) + (hP_sa_le : P_sa ≤ P) (hP_ac_le : P_ac ≤ P) (hP_ct_le : P_ct ≤ P) + (hpath_sa : IsGraphPathWithEnds P P_sa s a) + (hpath_ac : IsGraphPathWithEnds P P_ac a c) + (hpath_ct : IsGraphPathWithEnds P P_ct c t) + (hinter_sa : V(P_sa) ∩ V(P_ac) = {a}) + (hinter_ct : V(P_ac) ∩ V(P_ct) = {c}) + (hdisj_sact : Disjoint V(P_sa) V(P_ct)) + (hV_union : V(P_sa) ∪ V(P_ac) ∪ V(P_ct) = V(P)) + (hdisj_X : Disjoint (V(P_ac) \ {a, c}) + ({x ∈ V(deleteVertices G V(H)) | ∃ h ∈ V(H), G.Adj x h} ∪ {s, t})) : + let K := deleteVertices G V(H) + let W := {y ∈ V(deleteVertices K V(P)) | + ∃ w ∈ V(P_ac) \ {a, c}, ∃ z ∈ V(reachableComponent (deleteVertices K V(P)) y), K.Adj w z} + ∀ x ∈ (V(P_ac) ∪ W) \ {a, c}, ∀ y : α, G.Adj x y → y ∈ V(P_ac) ∪ W := by + intro K W x ⟨hx_in, hx_not_ac⟩ y hxy_adj + have hKG : K ≤ G := deleteVertices_le G V(H) + have hX_sub_Q : ∀ Q : Graph α β, IsGraphPathWithEnds K Q s t → + {x ∈ V(K) | ∃ h ∈ V(H), G.Adj x h} ⊆ V(Q) := + fun Q hQK z ⟨hzK, hadj⟩ => lemma_2_1_claim_1 hHG hZ hmax hQK hzK hadj + have hX_sub_P : {x ∈ V(K) | ∃ h ∈ V(H), G.Adj x h} ⊆ V(P) := hX_sub_Q P hPK + have hno_cross_path : ∀ u ∈ V(P_ac) \ {a, c}, ∀ v ∈ V(P) \ V(P_ac), + ∀ R : Graph α β, IsGraphPathWithEnds K R u v → V(R) ∩ V(P) ≠ {u, v} := by + intro u ⟨hu_ac, hu_not_ac⟩ v ⟨hvP, hv_not_ac⟩ R hRK hRP + have hv_in : v ∈ V(P_sa) ∪ V(P_ct) := by + have : v ∈ V(P_sa) ∪ V(P_ac) ∪ V(P_ct) := hV_union.symm ▸ hvP + rcases this with (hv_sa | hv_ac) | hv_ct + · exact Or.inl hv_sa + · exact (hv_not_ac hv_ac).elim + · exact Or.inr hv_ct + rcases hv_in with hv_sa | hv_ct + · apply detour_excludes_marked_vertex hPK hP_sa_le hP_ac_le hP_ct_le + hpath_sa hpath_ac hpath_ct hinter_sa hinter_ct hdisj_sact ?_ hv_sa hu_ac ?_ ?_ hRK hRP + · intro Q hQK + rcases ha_mem with haX | (rfl | rfl) + · exact hX_sub_Q Q hQK haX + · exact hQK.left_mem + · exact hQK.right_mem + · exact fun h => hv_not_ac (h ▸ hpath_ac.left_mem) + · exact fun h => hu_not_ac (by simp [h.symm]) + · apply detour_excludes_marked_vertex hPK.symm hP_ct_le hP_ac_le hP_sa_le + hpath_ct.symm hpath_ac.symm hpath_sa.symm (by rw [inter_comm, hinter_ct]) + (by rw [inter_comm, hinter_sa]) hdisj_sact.symm ?_ hv_ct hu_ac ?_ ?_ hRK hRP + · intro Q hQK + rcases hc_mem with hcX | (rfl | rfl) + · exact hX_sub_Q Q hQK.symm hcX + · exact hQK.right_mem + · exact hQK.left_mem + · exact fun h => hv_not_ac (h ▸ hpath_ac.right_mem) + · exact fun h => hu_not_ac (by simp [h.symm]) + rcases hxy_adj with ⟨e, hxy⟩ + rcases hx_in with hx_ac | hx_W + · have hxP : x ∈ V(P) := hP_ac_le.vertexSet_mono hx_ac + have hxK : x ∈ V(K) := hPK.1.vertexSet_mono hxP + have hy_not_H : y ∉ V(H) := by + intro hyH + have hxX : x ∈ {z ∈ V(K) | ∃ h ∈ V(H), G.Adj z h} := ⟨hxK, y, hyH, ⟨e, hxy⟩⟩ + exact disjoint_left.mp hdisj_X ⟨hx_ac, hx_not_ac⟩ (Or.inl hxX) + have hyK : y ∈ V(K) := ⟨hxy.right_mem, hy_not_H⟩ + have hxyK : K.IsLink e x y := (deleteVertices_isLink G V(H)).mpr ⟨hxy, hxK.2, hy_not_H⟩ + by_cases hyP : y ∈ V(P) + · left + by_contra hy_not_ac + have hxy_ne : x ≠ y := fun h => hy_not_ac (h ▸ hx_ac) + let W_xy : GraphWalk K x y := .cons hxyK (.nil hyK) + have hW_xy : W_xy.IsSimple := by + simp [GraphWalk.IsSimple, W_xy, hxy_ne] + have hRK : IsGraphPathWithEnds K (walkSubgraph W_xy) x y := + isGraphPathWithEnds_walkSubgraph hW_xy + have hRP : V(walkSubgraph W_xy) ∩ V(P) = {x, y} := by + ext z + simp only [vertexSet_walkSubgraph, W_xy, GraphWalk.support_cons, GraphWalk.support_nil, + List.mem_cons, List.not_mem_nil, or_false, mem_inter_iff, mem_ofPred_eq, + mem_insert_iff, mem_singleton_iff] + exact ⟨fun h => h.1, fun h => ⟨h, h.elim (fun h1 => h1 ▸ hxP) (fun h2 => h2 ▸ hyP)⟩⟩ + exact hno_cross_path x ⟨hx_ac, hx_not_ac⟩ y ⟨hyP, hy_not_ac⟩ (walkSubgraph W_xy) hRK hRP + · have hy_KP : y ∈ V(deleteVertices K V(P)) := ⟨hyK, hyP⟩ + right + exact ⟨hy_KP, x, ⟨hx_ac, hx_not_ac⟩, y, self_mem_reachableComponent hy_KP, ⟨e, hxyK⟩⟩ + · rcases hx_W with ⟨hx_KP, w, hw_ac, z, hz_reach, ⟨ewz, hewz⟩⟩ + have hxK : x ∈ V(K) := hx_KP.1 + have hx_not_P : x ∉ V(P) := hx_KP.2 + have hy_not_H : y ∉ V(H) := by + intro hyH + have hxX : x ∈ {u ∈ V(K) | ∃ h ∈ V(H), G.Adj u h} := ⟨hxK, y, hyH, ⟨e, hxy⟩⟩ + exact hx_not_P (hX_sub_P hxX) + have hyK : y ∈ V(K) := ⟨hxy.right_mem, hy_not_H⟩ + have hxyK : K.IsLink e x y := (deleteVertices_isLink G V(H)).mpr ⟨hxy, hxK.2, hy_not_H⟩ + by_cases hyP : y ∈ V(P) + · left + by_contra hy_not_ac + rw [vertexSet_reachableComponent] at hz_reach + obtain ⟨_, ⟨W_xz⟩⟩ := hz_reach + obtain ⟨W_zxK, hs_zx, _⟩ := + exists_walk_up_of_le (deleteVertices_le K V(P)) W_xz.reverse + let W_wy : GraphWalk K w y := + .cons hewz (W_zxK.append (.cons hxyK (.nil hyK))) + obtain ⟨R, hRK, hR_subV, _⟩ := exists_isGraphPathWithEnds_of_walk W_wy + have hRP : V(R) ∩ V(P) = {w, y} := by + ext u + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨huR, huP⟩ + have huW := hR_subV huR + simp only [W_wy, GraphWalk.support_cons, GraphWalk.mem_support_append, + GraphWalk.support_nil, List.mem_cons, List.not_mem_nil, or_false, hs_zx] at huW + rcases huW with rfl | hu_xz | rfl | rfl + · exact Or.inl rfl + · have hu_not_P : u ∉ V(P) := + (W_xz.reverse.mem_vertexSet_of_mem_support hu_xz).2 + exact (hu_not_P huP).elim + · exact (hx_not_P huP).elim + · exact Or.inr rfl + · rintro (rfl | rfl) + · exact ⟨hRK.left_mem, hP_ac_le.vertexSet_mono hw_ac.1⟩ + · exact ⟨hRK.right_mem, hyP⟩ + exact hno_cross_path w hw_ac y ⟨hyP, hy_not_ac⟩ R hRK hRP + · right + have hy_KP : y ∈ V(deleteVertices K V(P)) := ⟨hyK, hyP⟩ + have hxy_KP : (deleteVertices K V(P)).IsLink e x y := + (deleteVertices_isLink K V(P)).mpr ⟨hxyK, hx_not_P, hyP⟩ + have hcomp_eq : reachableComponent (deleteVertices K V(P)) y = + reachableComponent (deleteVertices K V(P)) x := by + refine isGraphComponent_eq_of_mem_inter + (isGraphComponent_reachableComponent hy_KP) + (isGraphComponent_reachableComponent hx_KP) + ⟨y, self_mem_reachableComponent hy_KP, ?_⟩ + exact (mem_graphComponent_iff_of_isLink + (isGraphComponent_reachableComponent hx_KP) hxy_KP).mp + (self_mem_reachableComponent hx_KP) + exact ⟨hy_KP, w, hw_ac, z, hcomp_eq.symm ▸ hz_reach, ⟨ewz, hewz⟩⟩ + +private theorem separation_of_path_interval {G H P : Graph α β} + {Z : Set α} {s t : α} + (hHG : H ≤ G) (hZ : Catches Z H) + (hmax : ∀ H' : Graph α β, H ≤ H' → H' ≤ G → Catches Z H' → + (∃ Q : Graph α β, IsGraphPathWithEnds G Q s t ∧ Avoids Q V(H')) → H' = H) + (hPK : IsGraphPathWithEnds (deleteVertices G V(H)) P s t) : + let K := deleteVertices G V(H) + let X : Set α := {x ∈ V(K) | ∃ h ∈ V(H), G.Adj x h} + let Y : Set α := X ∪ {s, t} + ∀ a ∈ Y, ∀ c ∈ Y, a ≠ c → + ∀ P_sa P_ac P_ct : Graph α β, + P_sa ≤ P → P_ac ≤ P → P_ct ≤ P → + IsGraphPathWithEnds P P_sa s a → + IsGraphPathWithEnds P P_ac a c → + IsGraphPathWithEnds P P_ct c t → + V(P_sa) ∩ V(P_ac) = {a} → + V(P_ac) ∩ V(P_ct) = {c} → + Disjoint V(P_sa) V(P_ct) → + V(P_sa) ∪ V(P_ac) ∪ V(P_ct) = V(P) → + Disjoint (V(P_ac) \ {a, c}) Y → + let W := {y ∈ V(deleteVertices K V(P)) | + ∃ w ∈ V(P_ac) \ {a, c}, ∃ z ∈ V(reachableComponent (deleteVertices K V(P)) y), K.Adj w z} + V(P_ac) ∪ W ≠ {a, c} → + ∃ G₁ G₂ : Graph α β, + IsGraphSeparation G G₁ G₂ ∧ + {s, t} ⊆ V(G₁) ∧ + (V(G₁) ∩ V(G₂)).ncard = 2 ∧ + (E(P) ∩ E(G₂)).Nonempty ∧ + subgraphInter G G₁ G₂ ≤ P ∧ + H ≤ G₁ ∧ + V(G₁) ≠ V(G) := by + intro K X Y + have hsY : s ∈ Y := Or.inr (Or.inl rfl) + have htY : t ∈ Y := Or.inr (Or.inr rfl) + intro a haY c hcY hac P_sa P_ac P_ct hP_sa hP_ac hP_ct hpath_sa hpath_ac hpath_ct + hinter_sa hinter_ct hdisj_sact hV_union hdisj_Y W hne_ac + have haP : a ∈ V(P) := hP_ac.vertexSet_mono hpath_ac.left_mem + have hcP : c ∈ V(P) := hP_ac.vertexSet_mono hpath_ac.right_mem + have hV₂_sub : V(P_ac) ∪ W ⊆ V(K) := by + rintro z (hz_ac | hz_W) + · exact hPK.1.vertexSet_mono (hP_ac.vertexSet_mono hz_ac) + · exact hz_W.1.1 + have haV₂ : a ∈ V(P_ac) ∪ W := Or.inl hpath_ac.left_mem + have hcV₂ : c ∈ V(P_ac) ∪ W := Or.inl hpath_ac.right_mem + have hs_not : s ∉ (V(P_ac) ∪ W) \ {a, c} := by + rintro ⟨hs_ac | hs_W, hs_ne⟩ + · exact disjoint_left.mp hdisj_Y ⟨hs_ac, hs_ne⟩ hsY + · exact hs_W.1.2 hPK.left_mem + have ht_not : t ∉ (V(P_ac) ∪ W) \ {a, c} := by + rintro ⟨ht_ac | ht_W, ht_ne⟩ + · exact disjoint_left.mp hdisj_Y ⟨ht_ac, ht_ne⟩ htY + · exact ht_W.1.2 hPK.right_mem + have hno_out : ∀ x ∈ (V(P_ac) ∪ W) \ {a, c}, ∀ y : α, G.Adj x y → y ∈ V(P_ac) ∪ W := + no_out_of_open_interval_and_components hHG hZ hmax hPK haY hcY + hP_sa hP_ac hP_ct hpath_sa hpath_ac hpath_ct hinter_sa hinter_ct hdisj_sact hV_union hdisj_Y + have hEP_inter : (E(P) ∩ E(K.induce (V(P_ac) ∪ W))).Nonempty := by + obtain ⟨e₀, he₀⟩ := nonempty_edgeSet_of_isGraphPathWithEnds_ne hpath_ac hac + obtain ⟨x₀, y₀, hx₀y₀⟩ := P_ac.exists_isLink_of_mem_edgeSet he₀ + have hx₀y₀P : P.IsLink e₀ x₀ y₀ := hx₀y₀.mono hP_ac + have hx₀y₀K : K.IsLink e₀ x₀ y₀ := hx₀y₀P.mono hPK.1 + have hx₀y₀_ind : (K.induce (V(P_ac) ∪ W)).IsLink e₀ x₀ y₀ := by + rw [induce_isLink] + exact ⟨hx₀y₀K, Or.inl hx₀y₀.left_mem, Or.inl hx₀y₀.right_mem⟩ + exact ⟨e₀, hx₀y₀P.edge_mem, hx₀y₀_ind.edge_mem⟩ + exact exists_separation_of_isolated_subset hHG hPK hac haP hcP (V(P_ac) ∪ W) + hV₂_sub haV₂ hcV₂ hs_not ht_not hne_ac hno_out hEP_inter + +private theorem separation_of_path_interval_and_component {G H P C : Graph α β} + {Z : Set α} {s t y₀ : α} + (hHG : H ≤ G) (hZ : Catches Z H) + (hmax : ∀ H' : Graph α β, H ≤ H' → H' ≤ G → Catches Z H' → + (∃ Q : Graph α β, IsGraphPathWithEnds G Q s t ∧ Avoids Q V(H')) → H' = H) + (hPK : IsGraphPathWithEnds (deleteVertices G V(H)) P s t) + (hC_comp : IsGraphComponent C (deleteVertices (deleteVertices G V(H)) V(P))) + (hy₀C : y₀ ∈ V(C)) (hy₀_not_P : y₀ ∉ V(P)) : + let K := deleteVertices G V(H) + let X : Set α := {x ∈ V(K) | ∃ h ∈ V(H), G.Adj x h} + let Y : Set α := X ∪ {s, t} + ∀ a ∈ Y, ∀ c ∈ Y, a ≠ c → + ∀ P_sa P_ac P_ct : Graph α β, + P_sa ≤ P → P_ac ≤ P → P_ct ≤ P → + IsGraphPathWithEnds P P_sa s a → + IsGraphPathWithEnds P P_ac a c → + IsGraphPathWithEnds P P_ct c t → + V(P_sa) ∩ V(P_ac) = {a} → + V(P_ac) ∩ V(P_ct) = {c} → + Disjoint V(P_sa) V(P_ct) → + V(P_sa) ∪ V(P_ac) ∪ V(P_ct) = V(P) → + Disjoint (V(P_ac) \ {a, c}) Y → + (∀ z ∈ V(C), ∀ w ∈ V(P), K.Adj z w → w ∈ V(P_ac)) → + ∃ G₁ G₂ : Graph α β, + IsGraphSeparation G G₁ G₂ ∧ + {s, t} ⊆ V(G₁) ∧ + (V(G₁) ∩ V(G₂)).ncard = 2 ∧ + (E(P) ∩ E(G₂)).Nonempty ∧ + subgraphInter G G₁ G₂ ≤ P ∧ + H ≤ G₁ ∧ + V(G₁) ≠ V(G) := by + intro K X Y + have hsY : s ∈ Y := Or.inr (Or.inl rfl) + have htY : t ∈ Y := Or.inr (Or.inr rfl) + have hX_sub_Q : ∀ Q : Graph α β, IsGraphPathWithEnds K Q s t → X ⊆ V(Q) := + fun Q hQK z ⟨hzK, hadj⟩ => lemma_2_1_claim_1 hHG hZ hmax hQK hzK hadj + intro a haY c hcY hac P_sa P_ac P_ct hP_sa hP_ac hP_ct hpath_sa hpath_ac hpath_ct + hinter_sa hinter_ct hdisj_sact hV_union hdisj_Y hC_nb_in_ac + let W := {y ∈ V(deleteVertices K V(P)) | + ∃ w ∈ V(P_ac) \ {a, c}, ∃ z ∈ V(reachableComponent (deleteVertices K V(P)) y), K.Adj w z} + let V₂ := V(C) ∪ (V(P_ac) ∪ W) + have haP : a ∈ V(P) := hP_ac.vertexSet_mono hpath_ac.left_mem + have hcP : c ∈ V(P) := hP_ac.vertexSet_mono hpath_ac.right_mem + have hV₂_sub : V₂ ⊆ V(K) := by + rintro z (hzC | hz_ac | hz_W) + · exact (hC_comp.1.vertexSet_mono hzC).1 + · exact hPK.1.vertexSet_mono (hP_ac.vertexSet_mono hz_ac) + · exact hz_W.1.1 + have haV₂ : a ∈ V₂ := Or.inr (Or.inl hpath_ac.left_mem) + have hcV₂ : c ∈ V₂ := Or.inr (Or.inl hpath_ac.right_mem) + have hs_not : s ∉ V₂ \ {a, c} := by + rintro ⟨hsC | hs_ac | hs_W, hs_ne⟩ + · exact (hC_comp.1.vertexSet_mono hsC).2 hPK.left_mem + · exact disjoint_left.mp hdisj_Y ⟨hs_ac, hs_ne⟩ hsY + · exact hs_W.1.2 hPK.left_mem + have ht_not : t ∉ V₂ \ {a, c} := by + rintro ⟨htC | ht_ac | ht_W, ht_ne⟩ + · exact (hC_comp.1.vertexSet_mono htC).2 hPK.right_mem + · exact disjoint_left.mp hdisj_Y ⟨ht_ac, ht_ne⟩ htY + · exact ht_W.1.2 hPK.right_mem + have hV₂_ne : V₂ ≠ {a, c} := by + intro hV₂_eq + have hy₀_ac : y₀ ∈ ({a, c} : Set α) := hV₂_eq ▸ Or.inl hy₀C + rcases hy₀_ac with rfl | rfl + · exact hy₀_not_P haP + · exact hy₀_not_P hcP + have hno_out_acW : ∀ x ∈ (V(P_ac) ∪ W) \ {a, c}, ∀ y : α, G.Adj x y → y ∈ V(P_ac) ∪ W := + no_out_of_open_interval_and_components hHG hZ hmax hPK haY hcY + hP_sa hP_ac hP_ct hpath_sa hpath_ac hpath_ct hinter_sa hinter_ct hdisj_sact hV_union hdisj_Y + have hno_out : ∀ x ∈ V₂ \ {a, c}, ∀ y : α, G.Adj x y → y ∈ V₂ := by + rintro x ⟨hxC | hx_acW, hx_not_ac⟩ y hxy_adj + · rcases hxy_adj with ⟨e, hxy⟩ + have hx_KP : x ∈ V(deleteVertices K V(P)) := hC_comp.1.vertexSet_mono hxC + have hy_not_H : y ∉ V(H) := by + intro hyH + have hxX : x ∈ X := ⟨hx_KP.1, y, hyH, ⟨e, hxy⟩⟩ + exact hx_KP.2 (hX_sub_Q P hPK hxX) + have hyK : y ∈ V(K) := ⟨hxy.right_mem, hy_not_H⟩ + have hxyK : K.IsLink e x y := (deleteVertices_isLink G V(H)).mpr ⟨hxy, hx_KP.1.2, hy_not_H⟩ + by_cases hyP : y ∈ V(P) + · exact Or.inr (Or.inl (hC_nb_in_ac x hxC y hyP ⟨e, hxyK⟩)) + · left + have hxy_KP : (deleteVertices K V(P)).IsLink e x y := + (deleteVertices_isLink K V(P)).mpr ⟨hxyK, hx_KP.2, hyP⟩ + exact (mem_graphComponent_iff_of_isLink hC_comp hxy_KP).mp hxC + · exact Or.inr (hno_out_acW x ⟨hx_acW, hx_not_ac⟩ y hxy_adj) + have hEP_inter : (E(P) ∩ E(K.induce V₂)).Nonempty := by + obtain ⟨e₀, he₀⟩ := nonempty_edgeSet_of_isGraphPathWithEnds_ne hpath_ac hac + obtain ⟨x₀, y₀', hx₀y₀⟩ := P_ac.exists_isLink_of_mem_edgeSet he₀ + have hx₀y₀P : P.IsLink e₀ x₀ y₀' := hx₀y₀.mono hP_ac + have hx₀y₀K : K.IsLink e₀ x₀ y₀' := hx₀y₀P.mono hPK.1 + have hx₀y₀_ind : (K.induce V₂).IsLink e₀ x₀ y₀' := by + rw [induce_isLink] + exact ⟨hx₀y₀K, Or.inr (Or.inl hx₀y₀.left_mem), Or.inr (Or.inl hx₀y₀.right_mem)⟩ + exact ⟨e₀, hx₀y₀P.edge_mem, hx₀y₀_ind.edge_mem⟩ + exact exists_separation_of_isolated_subset hHG hPK hac haP hcP V₂ + hV₂_sub haV₂ hcV₂ hs_not ht_not hV₂_ne hno_out hEP_inter + +private theorem separation_of_missing_edge {G H P : Graph α β} {Z : Set α} {s t : α} + (hG_loopless : ∀ x : α, ¬ G.Adj x x) + (hG_simple : ∀ e₁ e₂ x y, G.IsLink e₁ x y → G.IsLink e₂ x y → e₁ = e₂) + (hHG : H ≤ G) (hZ : Catches Z H) + (hmax : ∀ H' : Graph α β, H ≤ H' → H' ≤ G → Catches Z H' → + (∃ Q : Graph α β, IsGraphPathWithEnds G Q s t ∧ Avoids Q V(H')) → H' = H) + (hPK : IsGraphPathWithEnds (deleteVertices G V(H)) P s t) + (hPK_eq : P ≠ deleteVertices G V(H)) (hVP_eq : V(P) = V(deleteVertices G V(H))) : + ∃ G₁ G₂ : Graph α β, + IsGraphSeparation G G₁ G₂ ∧ + {s, t} ⊆ V(G₁) ∧ + (V(G₁) ∩ V(G₂)).ncard = 2 ∧ + (E(P) ∩ E(G₂)).Nonempty ∧ + subgraphInter G G₁ G₂ ≤ P ∧ + H ≤ G₁ ∧ + V(G₁) ≠ V(G) := by + classical + let K := deleteVertices G V(H) + have hKG : K ≤ G := deleteVertices_le G V(H) + let X : Set α := {x ∈ V(K) | ∃ h ∈ V(H), G.Adj x h} + let Y : Set α := X ∪ {s, t} + have hsY : s ∈ Y := Or.inr (Or.inl rfl) + have htY : t ∈ Y := Or.inr (Or.inr rfl) + have hX_sub_Q : ∀ Q : Graph α β, IsGraphPathWithEnds K Q s t → X ⊆ V(Q) := + fun Q hQK z ⟨hzK, hadj⟩ => lemma_2_1_claim_1 hHG hZ hmax hQK hzK hadj + have hY_sub_Q : ∀ Q : Graph α β, IsGraphPathWithEnds K Q s t → Y ⊆ V(Q) := by + intro Q hQK z hzY + rcases hzY with hzX | (rfl | rfl) + · exact hX_sub_Q Q hQK hzX + · exact hQK.left_mem + · exact hQK.right_mem + have hEP_ne : E(P) ≠ E(K) := fun hE => + hPK_eq ((Compatible.of_le_le hPK.1 le_rfl).ext hVP_eq hE) + have hssub : E(P) ⊂ E(K) := ⟨hPK.1.edgeSet_mono, fun h => hEP_ne (Subset.antisymm + hPK.1.edgeSet_mono h)⟩ + obtain ⟨e₀, he₀K, he₀_not_P⟩ := exists_of_ssubset hssub + obtain ⟨u, v, huvK⟩ := K.exists_isLink_of_mem_edgeSet he₀K + have huP : u ∈ V(P) := hVP_eq.symm ▸ huvK.left_mem + have hvP : v ∈ V(P) := hVP_eq.symm ▸ huvK.right_mem + have huv_ne : u ≠ v := fun h => hG_loopless u (h ▸ (huvK.mono hKG).adj) + -- Let `R` be the 1-edge path `walkSubgraph (.cons huvK (.nil huvK.right_mem))` in `K`. + let W_uv : GraphWalk K u v := .cons huvK (.nil huvK.right_mem) + have hW_uv : W_uv.IsSimple := by simp [GraphWalk.IsSimple, W_uv, huv_ne] + have hRK : IsGraphPathWithEnds K (walkSubgraph W_uv) u v := + isGraphPathWithEnds_walkSubgraph hW_uv + have hRP : V(walkSubgraph W_uv) ∩ V(P) = {u, v} := by + ext z + simp only [vertexSet_walkSubgraph, W_uv, GraphWalk.support_cons, GraphWalk.support_nil, + List.mem_cons, List.not_mem_nil, or_false, mem_inter_iff, mem_ofPred_eq, + mem_insert_iff, mem_singleton_iff] + exact ⟨fun h => h.1, fun h => ⟨h, h.elim (fun h1 => h1 ▸ huP) (fun h2 => h2 ▸ hvP)⟩⟩ + have hno_Y : ∀ u' v' : α, ({u', v'} : Set α) = {u, v} → + ∀ P_su P_uv P_vt : Graph α β, + P_su ≤ P → P_uv ≤ P → P_vt ≤ P → + IsGraphPathWithEnds P P_su s u' → + IsGraphPathWithEnds P P_uv u' v' → + IsGraphPathWithEnds P P_vt v' t → + V(P_su) ∩ V(P_uv) = {u'} → + V(P_uv) ∩ V(P_vt) = {v'} → + Disjoint V(P_su) V(P_vt) → + Disjoint (V(P_uv) \ {u', v'}) Y := by + intro u' v' huv_eq P_su P_uv P_vt hP_su hP_uv hP_vt hpath_su hpath_uv hpath_vt + hinter_su hinter_vt hdisj_suvt + have hRK' : IsGraphPathWithEnds K (walkSubgraph W_uv) u' v' := by + have hu'_in : u' = u ∨ u' = v := by + have : u' ∈ ({u, v} : Set α) := huv_eq ▸ by simp + simpa using this + have hv'_in : v' = u ∨ v' = v := by + have : v' ∈ ({u, v} : Set α) := huv_eq ▸ by simp + simpa using this + rcases hu'_in with hu' | hu' <;> rcases hv'_in with hv' | hv' + · rw [hu', hv'] at huv_eq + have : v = u := by + have : v ∈ ({u, u} : Set α) := huv_eq ▸ by simp + simpa using this + exact (huv_ne this.symm).elim + · rw [hu', hv']; exact hRK + · rw [hu', hv']; exact hRK.symm + · rw [hu', hv'] at huv_eq + have : u = v := by + have : u ∈ ({v, v} : Set α) := huv_eq ▸ by simp + simpa using this + exact (huv_ne this).elim + obtain ⟨Q, hQK, hdisjQ⟩ := exists_detour_path hPK hP_su hP_uv hP_vt + hpath_su hpath_uv hpath_vt hinter_su hinter_vt hdisj_suvt hRK' (huv_eq ▸ hRP) + exact hdisjQ.mono_right (hY_sub_Q Q hQK) + obtain ⟨a, haY, c, hcY, hac, P_sa, P_ac, P_ct, + hP_sa, hP_ac, hP_ct, hpath_sa, hpath_ac, hpath_ct, + hinter_sa, hinter_ct, hdisj_sact, hV_union, hu_ac, hv_ac, hdisj_Y⟩ := + exists_minimal_Y_interval_containing_pair hPK hsY htY huP hvP huv_ne hno_Y + -- Now we check if `V(P_ac) = {a, c}`. If `V(P_ac) = {a, c}`, then `{u, v} ⊆ {a, c}`, so + -- `e₀` links `a` and `c` in `G`, while `P_ac` also has an edge `e₁ ∈ E(P_ac) ⊆ E(P)` linking + -- `a` and `c` in `G`, contradicting `hG_simple` and `e₀ ∉ E(P)`! + have hVP_ac_ne : V(P_ac) ≠ {a, c} := by + intro hVP_ac_eq + have hu_in_ac : u = a ∨ u = c := by + have : u ∈ ({a, c} : Set α) := hVP_ac_eq ▸ hu_ac + simpa using this + have hv_in_ac : v = a ∨ v = c := by + have : v ∈ ({a, c} : Set α) := hVP_ac_eq ▸ hv_ac + simpa using this + obtain ⟨e₁, he₁⟩ := nonempty_edgeSet_of_isGraphPathWithEnds_ne hpath_ac hac + obtain ⟨x₁, y₁, hx₁y₁⟩ := P_ac.exists_isLink_of_mem_edgeSet he₁ + have hx₁_in : x₁ = a ∨ x₁ = c := by + have : x₁ ∈ ({a, c} : Set α) := hVP_ac_eq ▸ hx₁y₁.left_mem + simpa using this + have hy₁_in : y₁ = a ∨ y₁ = c := by + have : y₁ ∈ ({a, c} : Set α) := hVP_ac_eq ▸ hx₁y₁.right_mem + simpa using this + have hx₁y₁_ne : x₁ ≠ y₁ := fun h => + hG_loopless x₁ (h ▸ ((hx₁y₁.mono hP_ac).mono (hPK.1.trans hKG)).adj) + have he₁_ac : G.IsLink e₁ a c := by + have hG₁ := (hx₁y₁.mono hP_ac).mono (hPK.1.trans hKG) + rcases hx₁_in with rfl | rfl <;> rcases hy₁_in with rfl | rfl + · exact (hx₁y₁_ne rfl).elim + · exact hG₁ + · exact hG₁.symm + · exact (hx₁y₁_ne rfl).elim + have he₀_ac : G.IsLink e₀ a c := by + have hG₀ := huvK.mono hKG + rcases hu_in_ac with rfl | rfl <;> rcases hv_in_ac with rfl | rfl + · exact (huv_ne rfl).elim + · exact hG₀ + · exact hG₀.symm + · exact (huv_ne rfl).elim + have he₀_eq_e₁ : e₀ = e₁ := hG_simple e₀ e₁ a c he₀_ac he₁_ac + exact he₀_not_P (he₀_eq_e₁ ▸ hP_ac.edgeSet_mono he₁) + refine separation_of_path_interval hHG hZ hmax hPK a haY c hcY hac P_sa P_ac P_ct + hP_sa hP_ac hP_ct hpath_sa hpath_ac hpath_ct hinter_sa hinter_ct hdisj_sact hV_union hdisj_Y ?_ + intro hVW_eq + apply hVP_ac_ne + refine Subset.antisymm (fun z hz => hVW_eq ▸ Or.inl hz) ?_ + rintro z (rfl | rfl) + · exact hpath_ac.left_mem + · exact hpath_ac.right_mem + +/-- **Graph Minors IX, (2.1)** (page 43): +"Let $G$ be a simple graph and let $Z \subseteq V(G)$. Let $s, t \in V(G)$ be distinct and +such that there is a path between $s$ and $t$ avoiding $Z$. Choose a subgraph $H$ of $G$ +maximal such that $Z$ catches $H$, and there is a path of $G$ between $s$ and $t$ avoiding +$V(H)$. Let $K = G \setminus V(H)$, and let $P$ be a path of $K$ between $s$ and $t$. Then +either $P = K$, or there is a separation $(G_1, G_2)$ of $G$ with $\{s, t\} \subseteq +V(G_1)$, $|V(G_1 \cap G_2)| = 2$, $E(P \cap G_2) \ne \emptyset$ (and hence $G_1 \cap G_2 +\subseteq P$), $H \subseteq G_1$, and $V(G_1) \ne V(G)$." -/ +theorem theorem_2_1_proof {G H P : Graph α β} {Z : Set α} {s t : α} + (hG_loopless : ∀ x : α, ¬ G.Adj x x) + (hG_simple : ∀ e₁ e₂ x y, G.IsLink e₁ x y → G.IsLink e₂ x y → e₁ = e₂) + (hst : s ≠ t) + (hHG : H ≤ G) (hZ : Catches Z H) + (hmax : ∀ H' : Graph α β, H ≤ H' → H' ≤ G → Catches Z H' → + (∃ Q : Graph α β, IsGraphPathWithEnds G Q s t ∧ Avoids Q V(H')) → H' = H) + (hPK : IsGraphPathWithEnds (deleteVertices G V(H)) P s t) : + P = deleteVertices G V(H) ∨ + ∃ G₁ G₂ : Graph α β, + IsGraphSeparation G G₁ G₂ ∧ + {s, t} ⊆ V(G₁) ∧ + (V(G₁) ∩ V(G₂)).ncard = 2 ∧ + (E(P) ∩ E(G₂)).Nonempty ∧ + subgraphInter G G₁ G₂ ≤ P ∧ + H ≤ G₁ ∧ + V(G₁) ≠ V(G) := by + classical + let K := deleteVertices G V(H) + let X : Set α := {x ∈ V(K) | ∃ h ∈ V(H), G.Adj x h} + let Y : Set α := X ∪ {s, t} + have hsY : s ∈ Y := Or.inr (Or.inl rfl) + have htY : t ∈ Y := Or.inr (Or.inr rfl) + have hX_sub_Q : ∀ Q : Graph α β, IsGraphPathWithEnds K Q s t → X ⊆ V(Q) := + fun Q hQK z ⟨hzK, hadj⟩ => lemma_2_1_claim_1 hHG hZ hmax hQK hzK hadj + have hY_sub_Q : ∀ Q : Graph α β, IsGraphPathWithEnds K Q s t → Y ⊆ V(Q) := by + intro Q hQK z hzY + rcases hzY with hzX | (rfl | rfl) + · exact hX_sub_Q Q hQK hzX + · exact hQK.left_mem + · exact hQK.right_mem + -- Helper: given any three-way split `P = P_sa ∪ P_ac ∪ P_ct` at `a, c ∈ Y` with `a ≠ c` and + -- `Disjoint (V(P_ac) \ {a, c}) Y`, let `W(a, c)` be the union of components of `K \ V(P)` with a + -- neighbor in `V(P_ac) \ {a, c}`; if `V(P_ac) ∪ W(a, c) ≠ {a, c}`, then we get the desired + -- separation `(G₁, G₂)`! + by_cases hPK_eq : P = K + · exact Or.inl hPK_eq + · right + -- Suppose `P ≠ K`. Since `P ≤ K`, either `V(P) ≠ V(K)` or `V(P) = V(K)` and `E(P) ≠ E(K)`. + by_cases hVP_eq : V(P) = V(K) + · exact separation_of_missing_edge hG_loopless hG_simple hHG hZ hmax hPK hPK_eq hVP_eq + · -- Case 2: `V(P) ≠ V(K)`. Let `y₀ ∈ V(K) \ V(P)` and let `C` be the component of `K \ V(P)` + -- containing `y₀`. + have hssub : V(P) ⊂ V(K) := + ⟨hPK.1.vertexSet_mono, fun h => hVP_eq (Subset.antisymm hPK.1.vertexSet_mono h)⟩ + obtain ⟨y₀, hy₀K, hy₀_not_P⟩ := exists_of_ssubset hssub + have hy₀_KP : y₀ ∈ V(deleteVertices K V(P)) := ⟨hy₀K, hy₀_not_P⟩ + let C := reachableComponent (deleteVertices K V(P)) y₀ + have hC_comp : IsGraphComponent C (deleteVertices K V(P)) := + isGraphComponent_reachableComponent hy₀_KP + have hy₀C : y₀ ∈ V(C) := self_mem_reachableComponent hy₀_KP + have hsep_of_C_in_ac := + separation_of_path_interval_and_component hHG hZ hmax hPK hC_comp hy₀C hy₀_not_P + -- Now let `N_C = {w ∈ V(P) | ∃ z ∈ V(C), K.Adj z w}` be the set of neighbors of `V(C)` in + -- `V(P)`. + -- Either `N_C` has at least two distinct vertices `u ≠ v`, or `N_C ⊆ {u}` for some `u ∈ + -- V(P)`. + by_cases htwo_nb : ∃ u ∈ V(P), ∃ v ∈ V(P), u ≠ v ∧ + (∃ z₁ ∈ V(C), K.Adj z₁ u) ∧ (∃ z₂ ∈ V(C), K.Adj z₂ v) + · obtain ⟨u, huP, v, hvP, huv_ne, ⟨z₁, hz₁C, ⟨e₁, hz₁u⟩⟩, ⟨z₂, hz₂C, ⟨e₂, hz₂v⟩⟩⟩ := htwo_nb + -- First construct a path `R` in `K` from `u` to `v` with `V(R) ∩ V(P) = {u, v}`: + have hpath_through_C : ∀ w₁ ∈ V(P), ∀ w₂ ∈ V(P), w₁ ≠ w₂ → + (∃ z ∈ V(C), K.Adj z w₁) → (∃ z ∈ V(C), K.Adj z w₂) → + ∃ R : Graph α β, IsGraphPathWithEnds K R w₁ w₂ ∧ V(R) ∩ V(P) = {w₁, w₂} := by + intro w₁ hw₁P w₂ hw₂P hw₁₂ ⟨x₁, hx₁C, ⟨ex₁, hex₁⟩⟩ ⟨x₂, hx₂C, ⟨ex₂, hex₂⟩⟩ + have hx₁_reach : x₁ ∈ V(reachableComponent (deleteVertices K V(P)) y₀) := hx₁C + have hx₂_reach : x₂ ∈ V(reachableComponent (deleteVertices K V(P)) y₀) := hx₂C + rw [vertexSet_reachableComponent] at hx₁_reach hx₂_reach + obtain ⟨_, ⟨W₁⟩⟩ := hx₁_reach + obtain ⟨_, ⟨W₂⟩⟩ := hx₂_reach + let W₁₂ : GraphWalk (deleteVertices K V(P)) x₁ x₂ := W₁.reverse.append W₂ + obtain ⟨W₁₂K, hs₁₂, _⟩ := exists_walk_up_of_le (deleteVertices_le K V(P)) W₁₂ + have hw₂K : w₂ ∈ V(K) := hPK.1.vertexSet_mono hw₂P + let W_full : GraphWalk K w₁ w₂ := + .cons hex₁.symm (W₁₂K.append (.cons hex₂ (.nil hw₂K))) + obtain ⟨R, hRK, hR_subV, _⟩ := exists_isGraphPathWithEnds_of_walk W_full + refine ⟨R, hRK, ?_⟩ + ext z + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨hzR, hzP⟩ + have hzW := hR_subV hzR + simp only [W_full, GraphWalk.support_cons, GraphWalk.mem_support_append, + GraphWalk.support_nil, List.mem_cons, List.not_mem_nil, or_false, hs₁₂] at hzW + rcases hzW with rfl | hz₁₂ | rfl | rfl + · exact Or.inl rfl + · exact ((W₁₂.mem_vertexSet_of_mem_support hz₁₂).2 hzP).elim + · exact ((hC_comp.1.vertexSet_mono hx₂C).2 hzP).elim + · exact Or.inr rfl + · rintro (rfl | rfl) + · exact ⟨hRK.left_mem, hw₁P⟩ + · exact ⟨hRK.right_mem, hw₂P⟩ + obtain ⟨R_uv, hRK_uv, hRP_uv⟩ := + hpath_through_C u huP v hvP huv_ne ⟨z₁, hz₁C, ⟨e₁, hz₁u⟩⟩ ⟨z₂, hz₂C, ⟨e₂, hz₂v⟩⟩ + have hno_Y : ∀ u' v' : α, ({u', v'} : Set α) = {u, v} → + ∀ P_su P_uv P_vt : Graph α β, + P_su ≤ P → P_uv ≤ P → P_vt ≤ P → + IsGraphPathWithEnds P P_su s u' → + IsGraphPathWithEnds P P_uv u' v' → + IsGraphPathWithEnds P P_vt v' t → + V(P_su) ∩ V(P_uv) = {u'} → + V(P_uv) ∩ V(P_vt) = {v'} → + Disjoint V(P_su) V(P_vt) → + Disjoint (V(P_uv) \ {u', v'}) Y := by + intro u' v' huv_eq P_su P_uv P_vt hP_su hP_uv hP_vt hpath_su hpath_uv hpath_vt + hinter_su hinter_vt hdisj_suvt + have hRK' : IsGraphPathWithEnds K R_uv u' v' := by + have hu'_in : u' = u ∨ u' = v := by + have : u' ∈ ({u, v} : Set α) := huv_eq ▸ by simp + simpa using this + have hv'_in : v' = u ∨ v' = v := by + have : v' ∈ ({u, v} : Set α) := huv_eq ▸ by simp + simpa using this + rcases hu'_in with hu' | hu' <;> rcases hv'_in with hv' | hv' + · rw [hu', hv'] at huv_eq + have : v = u := by + have : v ∈ ({u, u} : Set α) := huv_eq ▸ by simp + simpa using this + exact (huv_ne this.symm).elim + · rw [hu', hv']; exact hRK_uv + · rw [hu', hv']; exact hRK_uv.symm + · rw [hu', hv'] at huv_eq + have : u = v := by + have : u ∈ ({v, v} : Set α) := huv_eq ▸ by simp + simpa using this + exact (huv_ne this).elim + obtain ⟨Q, hQK, hdisjQ⟩ := exists_detour_path hPK hP_su hP_uv hP_vt + hpath_su hpath_uv hpath_vt hinter_su hinter_vt hdisj_suvt hRK' (huv_eq ▸ hRP_uv) + exact hdisjQ.mono_right (hY_sub_Q Q hQK) + obtain ⟨a, haY, c, hcY, hac, P_sa, P_ac, P_ct, + hP_sa, hP_ac, hP_ct, hpath_sa, hpath_ac, hpath_ct, + hinter_sa, hinter_ct, hdisj_sact, hV_union, hu_ac, hv_ac, hdisj_Y⟩ := + exists_minimal_Y_interval_containing_pair hPK hsY htY huP hvP huv_ne hno_Y + refine hsep_of_C_in_ac a haY c hcY hac P_sa P_ac P_ct + hP_sa hP_ac hP_ct hpath_sa hpath_ac hpath_ct hinter_sa hinter_ct hdisj_sact hV_union + hdisj_Y ?_ + intro z hzC w hwP hzw + by_contra hw_not_ac + have hw_in : w ∈ V(P_sa) ∪ V(P_ct) := by + have : w ∈ V(P_sa) ∪ V(P_ac) ∪ V(P_ct) := hV_union.symm ▸ hwP + rcases this with (hw_sa | hw_ac) | hw_ct + · exact Or.inl hw_sa + · exact (hw_not_ac hw_ac).elim + · exact Or.inr hw_ct + rcases hw_in with hw_sa | hw_ct + · -- `w ∈ V(P_sa)` and `w ∉ V(P_ac)`, so `w ≠ a`. + -- Since `u ≠ v`, at least one of `u, v` is `≠ a`. Call it `u₀ ∈ V(P_ac) \ {a}`! + have hex_u₀ : ∃ u₀ ∈ V(P_ac), u₀ ≠ a ∧ ∃ z₀ ∈ V(C), K.Adj z₀ u₀ := by + by_cases hua : u = a + · exact ⟨v, hv_ac, fun hva => huv_ne (hua.trans hva.symm), z₂, hz₂C, ⟨e₂, hz₂v⟩⟩ + · exact ⟨u, hu_ac, hua, z₁, hz₁C, ⟨e₁, hz₁u⟩⟩ + obtain ⟨u₀, hu₀_ac, hu₀_ne_a, z₀, hz₀C, hz₀u₀⟩ := hex_u₀ + have hu₀P : u₀ ∈ V(P) := hP_ac.vertexSet_mono hu₀_ac + have hwa_ne : w ≠ a := fun h => hw_not_ac (h ▸ hpath_ac.left_mem) + have hwu₀_ne : w ≠ u₀ := fun h => hw_not_ac (h ▸ hu₀_ac) + obtain ⟨R, hRK, hRP⟩ := + hpath_through_C w hwP u₀ hu₀P hwu₀_ne ⟨z, hzC, hzw⟩ ⟨z₀, hz₀C, hz₀u₀⟩ + exact detour_excludes_marked_vertex hPK hP_sa hP_ac hP_ct hpath_sa hpath_ac hpath_ct + hinter_sa hinter_ct hdisj_sact (fun Q hQK => hY_sub_Q Q hQK haY) + hw_sa hu₀_ac hwa_ne hu₀_ne_a.symm hRK.symm (by rw [hRP, pair_comm]) + · -- `w ∈ V(P_ct)` and `w ∉ V(P_ac)`, so `w ≠ c`. + have hex_u₀ : ∃ u₀ ∈ V(P_ac), u₀ ≠ c ∧ ∃ z₀ ∈ V(C), K.Adj z₀ u₀ := by + by_cases huc : u = c + · exact ⟨v, hv_ac, fun hvc => huv_ne (huc.trans hvc.symm), z₂, hz₂C, ⟨e₂, hz₂v⟩⟩ + · exact ⟨u, hu_ac, huc, z₁, hz₁C, ⟨e₁, hz₁u⟩⟩ + obtain ⟨u₀, hu₀_ac, hu₀_ne_c, z₀, hz₀C, hz₀u₀⟩ := hex_u₀ + have hu₀P : u₀ ∈ V(P) := hP_ac.vertexSet_mono hu₀_ac + have hwc_ne : w ≠ c := fun h => hw_not_ac (h ▸ hpath_ac.right_mem) + have hu₀w_ne : u₀ ≠ w := fun h => hw_not_ac (h ▸ hu₀_ac) + obtain ⟨R, hRK, hRP⟩ := + hpath_through_C u₀ hu₀P w hwP hu₀w_ne ⟨z₀, hz₀C, hz₀u₀⟩ ⟨z, hzC, hzw⟩ + exact detour_excludes_marked_vertex hPK.symm hP_ct hP_ac hP_sa + hpath_ct.symm hpath_ac.symm hpath_sa.symm (by rw [inter_comm, hinter_ct]) + (by rw [inter_comm, hinter_sa]) hdisj_sact.symm + (fun Q hQK => hY_sub_Q Q hQK.symm hcY) + hw_ct hu₀_ac hwc_ne hu₀_ne_c.symm hRK hRP + · -- `C` has at most one neighbor in `V(P)`. + have hex_u : ∃ u ∈ V(P), ∀ z ∈ V(C), ∀ w ∈ V(P), K.Adj z w → w = u := by + by_cases hone : ∃ u ∈ V(P), ∃ z ∈ V(C), K.Adj z u + · obtain ⟨u, huP, z₁, hz₁C, hz₁u⟩ := hone + refine ⟨u, huP, fun z₂ hz₂C w hwP hzw => ?_⟩ + by_contra hwu + exact htwo_nb ⟨u, huP, w, hwP, Ne.symm hwu, ⟨z₁, hz₁C, hz₁u⟩, ⟨z₂, hz₂C, hzw⟩⟩ + · refine ⟨s, hPK.left_mem, fun z hzC w hwP hzw => ?_⟩ + exact (hone ⟨w, hwP, z, hzC, hzw⟩).elim + obtain ⟨u, huP, hC_nb_eq_u⟩ := hex_u + obtain ⟨a, haY, c, hcY, hac, P_sa, P_ac, P_ct, + hP_sa, hP_ac, hP_ct, hpath_sa, hpath_ac, hpath_ct, + hinter_sa, hinter_ct, hdisj_sact, hV_union, hu_ac, hdisj_Y⟩ := + exists_minimal_Y_interval_containing_single hPK hst hsY htY huP + refine hsep_of_C_in_ac a haY c hcY hac P_sa P_ac P_ct + hP_sa hP_ac hP_ct hpath_sa hpath_ac hpath_ct hinter_sa hinter_ct hdisj_sact hV_union + hdisj_Y ?_ + intro z hzC w hwP hzw + rw [hC_nb_eq_u z hzC w hwP hzw] + exact hu_ac + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section2c.lean b/LeanPool/GraphMinor/GM09/Section2c.lean new file mode 100644 index 0000000000..4e81bd72f1 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section2c.lean @@ -0,0 +1,647 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM09.Basic + +/-! +# Graph Minors IX, Section 2 (Part 3): Disjoint `X → Y` Paths and Lemma (2.2) + +This file formalizes Lemma (2.2) from Section 2 of +N. Robertson and P. D. Seymour, *Graph Minors. IX. Disjoint crossed paths*, +J. Combin. Theory Ser. B **49** (1990) 40–77 (page 44), proving that a family of mutually +disjoint `X → Y` paths witnessing `X' ⇒ Y'` can be extended to size `k` when `k` mutually +disjoint `X → Y` paths exist, via an augmenting path argument. +-/ + +public section + +namespace GraphMinor.GM09 + +open Set Graph Surface + +universe u v + +variable {α : Type u} {β : Type v} + +theorem IsFromToPathWithEnds.left_mem_X {G P : Graph α β} {X Y : Set α} {x y : α} + (h : IsFromToPathWithEnds G P X Y x y) : x ∈ X := by + have hx : x ∈ V(P) ∩ X := by rw [h.2.1]; exact rfl + exact hx.2 + +theorem IsFromToPathWithEnds.right_mem_Y {G P : Graph α β} {X Y : Set α} {x y : α} + (h : IsFromToPathWithEnds G P X Y x y) : y ∈ Y := by + have hy : y ∈ V(P) ∩ Y := by rw [h.2.2]; exact rfl + exact hy.2 + +theorem IsFromToPathWithEnds.eq_left_of_mem_X {G P : Graph α β} {X Y : Set α} {x y z : α} + (h : IsFromToPathWithEnds G P X Y x y) (hzP : z ∈ V(P)) (hzX : z ∈ X) : z = x := by + have : z ∈ V(P) ∩ X := ⟨hzP, hzX⟩ + rwa [h.2.1, mem_singleton_iff] at this + +theorem IsFromToPathWithEnds.eq_right_of_mem_Y {G P : Graph α β} {X Y : Set α} {x y z : α} + (h : IsFromToPathWithEnds G P X Y x y) (hzP : z ∈ V(P)) (hzY : z ∈ Y) : z = y := by + have : z ∈ V(P) ∩ Y := ⟨hzP, hzY⟩ + rwa [h.2.2, mem_singleton_iff] at this + +/-- If `P : Fin r → Graph α β` is a family of `r` mutually disjoint `X → Y` paths with starts +`x : Fin r → α` and ends `y : Fin r → α`, then `x` and `y` are injective, `(range x).ncard = r`, +`(range y).ncard = r`, and `RedirectsTo G X Y (range x) (range y)` holds. -/ +theorem redirectsTo_of_disjoint_fromToPaths {G : Graph α β} {X Y : Set α} {r : ℕ} + {P : Fin r → Graph α β} {x y : Fin r → α} + (hdisj : Pairwise (fun i j => Disjoint V(P i) V(P j))) + (hP : ∀ i : Fin r, IsFromToPathWithEnds G (P i) X Y (x i) (y i)) : + Function.Injective x ∧ Function.Injective y ∧ + (range x).ncard = r ∧ (range y).ncard = r ∧ + RedirectsTo G X Y (range x) (range y) := by + have hx_inj : Function.Injective x := by + intro i j hij + by_contra hne + exact disjoint_left.mp (hdisj hne) (hP i).1.left_mem (hij ▸ (hP j).1.left_mem) + have hy_inj : Function.Injective y := by + intro i j hij + by_contra hne + exact disjoint_left.mp (hdisj hne) (hP i).1.right_mem (hij ▸ (hP j).1.right_mem) + have hx_card : (range x).ncard = r := by + rw [ncard_range_of_injective hx_inj, Nat.card_fin] + have hy_card : (range y).ncard = r := by + rw [ncard_range_of_injective hy_inj, Nat.card_fin] + refine ⟨hx_inj, hy_inj, hx_card, hy_card, ?_⟩ + refine ⟨?_, ?_, hx_card.trans hy_card.symm, ?_⟩ + · rintro _ ⟨i, rfl⟩; exact (hP i).left_mem_X + · rintro _ ⟨i, rfl⟩; exact (hP i).right_mem_Y + · refine ⟨fun i => P (Fin.cast hx_card i), + fun i j hij => hdisj (fun h => hij (Fin.cast_injective hx_card h)), + fun i => ⟨x (Fin.cast hx_card i), mem_range_self _, + y (Fin.cast hx_card i), mem_range_self _, hP (Fin.cast hx_card i)⟩⟩ + +/-- Conversely, if `RedirectsTo G X Y X' Y'` holds with `X'.Finite`, `Y'.Finite`, and `X'.ncard = +r`, +there exist `P : Fin r → Graph α β` and `x, y : Fin r → α` with `range x = X'` and `range y = Y'`. +-/ +theorem exists_indexed_of_redirectsTo {G : Graph α β} {X Y X' Y' : Set α} {r : ℕ} + (hX'_fin : X'.Finite) (hY'_fin : Y'.Finite) + (hred : RedirectsTo G X Y X' Y') (hr : X'.ncard = r) : + ∃ (P : Fin r → Graph α β) (x y : Fin r → α), + Pairwise (fun i j => Disjoint V(P i) V(P j)) ∧ + (∀ i : Fin r, IsFromToPathWithEnds G (P i) X Y (x i) (y i)) ∧ + range x = X' ∧ range y = Y' := by + classical + rcases hred with ⟨hX', hY', hcard_eq, P₀, hdisj₀, hP₀⟩ + let P : Fin r → Graph α β := fun i => P₀ (Fin.cast hr.symm i) + have hdisj : Pairwise (fun i j => Disjoint V(P i) V(P j)) := + fun i j hij => hdisj₀ (fun h => hij (Fin.cast_injective hr.symm h)) + have hP_ex : ∀ i : Fin r, ∃ xi ∈ X', ∃ yi ∈ Y', IsFromToPathWithEnds G (P i) X Y xi yi := + fun i => hP₀ (Fin.cast hr.symm i) + choose x hx y hy hP using hP_ex + obtain ⟨hx_inj, hy_inj, hx_card, hy_card, _⟩ := redirectsTo_of_disjoint_fromToPaths hdisj hP + have hx_range_sub : range x ⊆ X' := by rintro _ ⟨i, rfl⟩; exact hx i + have hy_range_sub : range y ⊆ Y' := by rintro _ ⟨i, rfl⟩; exact hy i + have hx_eq : range x = X' := + eq_of_subset_of_ncard_le hx_range_sub (by omega) hX'_fin + have hy_eq : range y = Y' := + eq_of_subset_of_ncard_le hy_range_sub (by omega) hY'_fin + exact ⟨P, x, y, hdisj, hP, hx_eq, hy_eq⟩ + +/-- Given `r < k`, a family `P : Fin r → Graph α β` of `r` mutually disjoint `X → Y` paths with ends +`x i` and `y i`, and a family `Q : Fin k → Graph α β` of `k` mutually disjoint `X → Y` paths with +ends `a j` and `b j`, there exists an index `j₀ : Fin k` such that `a j₀ ∉ range x`, and any such +`Q j₀` is disjoint from `range x`. -/ +theorem exists_unmatched_start {G : Graph α β} {X Y : Set α} {r k : ℕ} (hrk : r < k) + {P : Fin r → Graph α β} {x y : Fin r → α} + (hdisjP : Pairwise (fun i j => Disjoint V(P i) V(P j))) + (hP : ∀ i : Fin r, IsFromToPathWithEnds G (P i) X Y (x i) (y i)) + {Q : Fin k → Graph α β} {a b : Fin k → α} + (hdisjQ : Pairwise (fun i j => Disjoint V(Q i) V(Q j))) + (hQ : ∀ j : Fin k, IsFromToPathWithEnds G (Q j) X Y (a j) (b j)) : + ∃ j₀ : Fin k, a j₀ ∉ range x ∧ Disjoint V(Q j₀) (range x) := by + obtain ⟨hx_inj, _, hx_card, _, _⟩ := redirectsTo_of_disjoint_fromToPaths hdisjP hP + obtain ⟨ha_inj, _, ha_card, _, _⟩ := redirectsTo_of_disjoint_fromToPaths hdisjQ hQ + have hnot_sub : ¬ range a ⊆ range x := by + intro hsub + have hle := ncard_le_ncard hsub (finite_range x) + omega + obtain ⟨_, ⟨j₀, rfl⟩, hj₀_not⟩ := not_subset.mp hnot_sub + refine ⟨j₀, hj₀_not, disjoint_left.mpr fun z hzQ ⟨i, hi⟩ => ?_⟩ + subst hi + have hza : x i = a j₀ := (hQ j₀).eq_left_of_mem_X hzQ (hP i).left_mem_X + exact hj₀_not ⟨i, hza⟩ + +/-- If `P` is a path in `G` from `u` to `v` and `V(P)` meets a set `S`, then there is a last vertex +`z ∈ V(P) ∩ S` along `P` (closest to `v`), so the subpath `P₂` of `P` from `z` to `v` satisfies +`V(P₂) ∩ S = {z}` and `(u ∈ V(P₂) → z = u)`. -/ +theorem IsGraphPathWithEnds.exists_last_hit {G P : Graph α β} {u v : α} + (hP : IsGraphPathWithEnds G P u v) {S : Set α} (hne : (V(P) ∩ S).Nonempty) : + ∃ z ∈ V(P) ∩ S, ∃ P₂ : Graph α β, + P₂ ≤ P ∧ IsGraphPathWithEnds P P₂ z v ∧ V(P₂) ∩ S = {z} ∧ (u ∈ V(P₂) → z = u) := by + classical + have hind : ∀ (n : ℕ) {a : α} {Q : Graph α β}, + Q ≤ P → IsGraphPathWithEnds P Q a v → V(Q).ncard = n → (V(Q) ∩ S).Nonempty → + ∃ z ∈ V(Q) ∩ S, ∃ Q₂ : Graph α β, + Q₂ ≤ Q ∧ IsGraphPathWithEnds Q Q₂ z v ∧ V(Q₂) ∩ S = {z} ∧ (a ∈ V(Q₂) → z = a) := by + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro a Q hQP hQ hcard ⟨w, hwQ, hwS⟩ + by_cases hhit : ∃ w' ∈ V(Q) ∩ S, w' ≠ a + · obtain ⟨w', ⟨hw'Q, hw'S⟩, hw'a⟩ := hhit + obtain ⟨Q₁, Q₂, _, hQ₂Q, hQ₁, hQ₂, _, hinter, _⟩ := hQ.exists_split_at hw'Q + have ha_not_Q₂ : a ∉ V(Q₂) := by + intro haQ₂ + have : a ∈ V(Q₁) ∩ V(Q₂) := ⟨hQ₁.left_mem, haQ₂⟩ + rw [hinter, mem_singleton_iff] at this + exact hw'a this.symm + have hlt : V(Q₂).ncard < n := by + rw [← hcard] + exact ncard_lt_ncard ⟨hQ₂Q.vertexSet_mono, fun h => ha_not_Q₂ (h hQ.left_mem)⟩ + hQ.vertexSet_finite + obtain ⟨z, ⟨hzQ₂, hzS⟩, R₂, hR₂Q₂, hR₂, hR₂S, _⟩ := + ih V(Q₂).ncard hlt (hQ₂Q.trans hQP) (hQ₂.mono hQP) rfl ⟨w', hQ₂.left_mem, hw'S⟩ + exact ⟨z, ⟨hQ₂Q.vertexSet_mono hzQ₂, hzS⟩, R₂, hR₂Q₂.trans hQ₂Q, hR₂.mono hQ₂Q, hR₂S, + fun haR₂ => (ha_not_Q₂ (hR₂Q₂.vertexSet_mono haR₂)).elim⟩ + · have haS : a ∈ S := by + by_contra ha_not_S + exact hhit ⟨w, ⟨hwQ, hwS⟩, fun h => ha_not_S (h ▸ hwS)⟩ + refine ⟨a, ⟨hQ.left_mem, haS⟩, Q, le_rfl, hQ.of_le le_rfl, ?_, fun _ => rfl⟩ + ext x + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hxQ, hxS⟩ => by_contra fun hne => hhit ⟨x, ⟨hxQ, hxS⟩, hne⟩, + fun h => h ▸ ⟨hQ.left_mem, haS⟩⟩ + exact hind V(P).ncard le_rfl (hP.of_le le_rfl) rfl hne + +/-- Similarly, if `P` is a path in `G` from `u` to `v` and `V(P)` meets a set `S`, then there is a +first vertex `z ∈ V(P) ∩ S` along `P` (closest to `u`), so the subpath `P₁` of `P` from `u` to `z` +satisfies `V(P₁) ∩ S = {z}` and `(v ∈ V(P₁) → z = v)`. -/ +theorem IsGraphPathWithEnds.exists_first_hit {G P : Graph α β} {u v : α} + (hP : IsGraphPathWithEnds G P u v) {S : Set α} (hne : (V(P) ∩ S).Nonempty) : + ∃ z ∈ V(P) ∩ S, ∃ P₁ : Graph α β, + P₁ ≤ P ∧ IsGraphPathWithEnds P P₁ u z ∧ V(P₁) ∩ S = {z} ∧ (v ∈ V(P₁) → z = v) := by + obtain ⟨z, hz, P₁, hP₁, hpath₁, hS, hv⟩ := hP.symm.exists_last_hit hne + exact ⟨z, hz, P₁, hP₁, hpath₁.symm, hS, hv⟩ + +/-- If `Q` is an `X → Y` path with ends `u, v` and `z ∈ V(Q) \ {u}`, then the subpath `Q₂` of `Q` +from `z` to `v` satisfies `Disjoint V(Q₂) X` and `V(Q₂) ∩ Y = {v}`. -/ +theorem IsFromToPathWithEnds.exists_suffix_disjoint_X {G Q : Graph α β} {X Y : Set α} {u v z : α} + (hQ : IsFromToPathWithEnds G Q X Y u v) (hz : z ∈ V(Q)) (hzu : z ≠ u) : + ∃ Q₂ : Graph α β, Q₂ ≤ Q ∧ IsGraphPathWithEnds G Q₂ z v ∧ + Disjoint V(Q₂) X ∧ V(Q₂) ∩ Y = {v} := by + obtain ⟨Q₁, Q₂, _, hQ₂Q, hQ₁, hQ₂, _, hinter, _⟩ := hQ.1.exists_split_at hz + refine ⟨Q₂, hQ₂Q, hQ₂.mono hQ.1.le, ?_, ?_⟩ + · rw [disjoint_left] + intro w hwQ₂ hwX + have hwu : w = u := hQ.eq_left_of_mem_X (hQ₂Q.vertexSet_mono hwQ₂) hwX + subst hwu + have : w ∈ V(Q₁) ∩ V(Q₂) := ⟨hQ₁.left_mem, hwQ₂⟩ + rw [hinter, mem_singleton_iff] at this + exact hzu this.symm + · ext w + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hwQ₂, hwY⟩ => hQ.eq_right_of_mem_Y (hQ₂Q.vertexSet_mono hwQ₂) hwY, + fun h => h ▸ ⟨hQ₂.right_mem, hQ.right_mem_Y⟩⟩ + +/-- If `P` is an `X → Y` path with ends `u, v` and `z ∈ V(P) \ {v}`, then the subpath `P₁` of `P` +from `u` to `z` satisfies `V(P₁) ∩ X = {u}` and `Disjoint V(P₁) Y`. -/ +theorem IsFromToPathWithEnds.exists_prefix_disjoint_Y {G P : Graph α β} {X Y : Set α} {u v z : α} + (hP : IsFromToPathWithEnds G P X Y u v) (hz : z ∈ V(P)) (hzv : z ≠ v) : + ∃ P₁ : Graph α β, P₁ ≤ P ∧ IsGraphPathWithEnds G P₁ u z ∧ + V(P₁) ∩ X = {u} ∧ Disjoint V(P₁) Y := by + obtain ⟨P₁, P₂, hP₁P, _, hP₁, hP₂, _, hinter, _⟩ := hP.1.exists_split_at hz + refine ⟨P₁, hP₁P, hP₁.mono hP.1.le, ?_, ?_⟩ + · ext w + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hwP₁, hwX⟩ => hP.eq_left_of_mem_X (hP₁P.vertexSet_mono hwP₁) hwX, + fun h => h ▸ ⟨hP₁.left_mem, hP.left_mem_X⟩⟩ + · rw [disjoint_left] + intro w hwP₁ hwY + have hwv : w = v := hP.eq_right_of_mem_Y (hP₁P.vertexSet_mono hwP₁) hwY + subst hwv + have : w ∈ V(P₁) ∩ V(P₂) := ⟨hwP₁, hP₂.right_mem⟩ + rw [hinter, mem_singleton_iff] at this + exact hzv this.symm + +/-- If `P₁` is a path in `G` from `u ∈ X` to `z` with `V(P₁) ∩ X = {u}` and `Disjoint V(P₁) Y`, +and `Q₂` is a path in `G` from `z` to `v ∈ Y` with `Disjoint V(Q₂) X` and `V(Q₂) ∩ Y = {v}`, +and `V(P₁) ∩ V(Q₂) = {z}`, then `subgraphUnion G P₁ Q₂` is an `X → Y` path in `G` from `u` to `v`. +-/ +theorem isFromToPathWithEnds_subgraphUnion_at {G P₁ Q₂ : Graph α β} {X Y : Set α} {u z v : α} + (hP₁ : IsGraphPathWithEnds G P₁ u z) (hP₁X : V(P₁) ∩ X = {u}) (hP₁Y : Disjoint V(P₁) Y) + (hQ₂ : IsGraphPathWithEnds G Q₂ z v) (hQ₂X : Disjoint V(Q₂) X) (hQ₂Y : V(Q₂) ∩ Y = {v}) + (hinter : V(P₁) ∩ V(Q₂) = {z}) : + IsFromToPathWithEnds G (subgraphUnion G P₁ Q₂) X Y u v := by + refine ⟨hP₁.subgraphUnion hQ₂ hinter, ?_, ?_⟩ + · rw [vertexSet_subgraphUnion, union_inter_distrib_right, hP₁X, + disjoint_iff_inter_eq_empty.mp hQ₂X, union_empty] + · rw [vertexSet_subgraphUnion, union_inter_distrib_right, + disjoint_iff_inter_eq_empty.mp hP₁Y, hQ₂Y, empty_union] + +/-- If `Q₁` is a path in `G` from `a` to `z`, `P : Fin r → Graph α β` is a pairwise vertex-disjoint +family of subgraphs of `G`, `z ∈ V(P i₀)`, and `E(Q₁) ⊆ ⋃ i : Fin r, E(P i)`, then `a ∈ V(P i₀)`. -/ +theorem left_mem_of_edgeSet_subset_iUnion_disjoint {G Q₁ : Graph α β} {a z : α} {r : ℕ} + {P : Fin r → Graph α β} {i₀ : Fin r} + (hQ₁ : IsGraphPathWithEnds G Q₁ a z) + (hdisjP : Pairwise (fun i₁ i₂ => Disjoint V(P i₁) V(P i₂))) + (hP_le : ∀ i : Fin r, P i ≤ G) + (hzi₀ : z ∈ V(P i₀)) + (hE_sub : E(Q₁) ⊆ ⋃ i : Fin r, E(P i)) : + a ∈ V(P i₀) := by + rcases hQ₁ with ⟨hQ₁G, W, _, _, hEQ₁⟩ + have hwalk : ∀ {u v : α} (W' : GraphWalk Q₁ u v), + (∀ e ∈ W'.edges, e ∈ E(Q₁)) → v ∈ V(P i₀) → u ∈ V(P i₀) := by + intro u v W' + induction W' with + | nil _ => exact fun _ hv => hv + | @cons u w v e huw rest ih => + intro hE hv + have hw : w ∈ V(P i₀) := + ih (fun f hf => hE f (List.mem_cons_of_mem _ hf)) hv + have he_in : e ∈ ⋃ i : Fin r, E(P i) := hE_sub (hE e List.mem_cons_self) + obtain ⟨i₁, hei₁⟩ := mem_iUnion.mp he_in + obtain ⟨x₁, y₁, hx₁y₁⟩ := (P i₁).exists_isLink_of_mem_edgeSet hei₁ + have heq := (huw.mono hQ₁G).left_eq_or_eq (hx₁y₁.mono (hP_le i₁)) + have hw_i₁ : w ∈ V(P i₁) := by + have symm_eq := (huw.symm.mono hQ₁G).left_eq_or_eq (hx₁y₁.mono (hP_le i₁)) + rcases symm_eq with rfl | rfl + · exact hx₁y₁.left_mem + · exact hx₁y₁.right_mem + have hi₁_eq : i₁ = i₀ := by + by_contra hne + exact disjoint_left.mp (hdisjP hne) hw_i₁ hw + subst hi₁_eq + rcases heq with rfl | rfl + · exact hx₁y₁.left_mem + · exact hx₁y₁.right_mem + exact hwalk W (fun e he => by rw [hEQ₁]; exact he) hzi₀ + +private theorem replace_with_disjoint_path {G : Graph α β} {X Y : Set α} {r k : ℕ} + (hrk : r ≤ k) + {P : Fin r → Graph α β} {x y : Fin r → α} + (hdisjP : Pairwise (fun i j => Disjoint V(P i) V(P j))) + (hP : ∀ i, IsFromToPathWithEnds G (P i) X Y (x i) (y i)) + {Q : Fin k → Graph α β} {a b : Fin k → α} + (hdisjQ : Pairwise (fun i j => Disjoint V(Q i) V(Q j))) + (hQ : ∀ j, IsFromToPathWithEnds G (Q j) X Y (a j) (b j)) {i₁ : Fin r} + (hi₁_disj : Disjoint V(P i₁) (⋃ j : Fin k, V(Q j))) : + ∃ (Q₁ : Fin k → Graph α β) (a₁ b₁ : Fin k → α), + Pairwise (fun i j => Disjoint V(Q₁ i) V(Q₁ j)) ∧ + (∀ j, IsFromToPathWithEnds G (Q₁ j) X Y (a₁ j) (b₁ j)) ∧ + (r - (range x ∩ range a₁).ncard) + + ((⋃ j : Fin k, E(Q₁ j)) \ (⋃ i : Fin r, E(P i))).ncard < + (r - (range x ∩ range a).ncard) + + ((⋃ j : Fin k, E(Q j)) \ (⋃ i : Fin r, E(P i))).ncard ∧ + ¬ range y ⊆ range b := by + classical + have hdiff_fin : ((⋃ j : Fin k, E(Q j)) \ (⋃ i : Fin r, E(P i))).Finite := + (finite_iUnion fun j => (hQ j).1.edgeSet_finite).sdiff + have hx₁_not_a : x i₁ ∉ range a := by + rintro ⟨j, hj⟩ + exact disjoint_left.mp hi₁_disj (hP i₁).1.left_mem + (mem_iUnion.mpr ⟨j, hj ▸ (hQ j).1.left_mem⟩) + have hnot_y_sub_b : ¬ range y ⊆ range b := by + intro hy_sub_b + obtain ⟨j, hj⟩ := hy_sub_b (mem_range_self i₁) + exact disjoint_left.mp hi₁_disj (hP i₁).1.right_mem + (mem_iUnion.mpr ⟨j, hj ▸ (hQ j).1.right_mem⟩) + obtain ⟨hx_inj, hy_inj, hx_card, hy_card, _⟩ := redirectsTo_of_disjoint_fromToPaths hdisjP hP + obtain ⟨ha_inj, hb_inj, ha_card, hb_card, _⟩ := redirectsTo_of_disjoint_fromToPaths hdisjQ hQ + have hnot_a_sub_x : ¬ range a ⊆ range x := by + intro ha_sub_x + have hssub : range a ⊂ range x := + ⟨ha_sub_x, fun h => hx₁_not_a (h (mem_range_self i₁))⟩ + have hlt := ncard_lt_ncard hssub (finite_range x) + omega + obtain ⟨_, ⟨j₀, rfl⟩, ha_not_x⟩ := not_subset.mp hnot_a_sub_x + let Q₁ : Fin k → Graph α β := Function.update Q j₀ (P i₁) + let a₁ : Fin k → α := Function.update a j₀ (x i₁) + let b₁ : Fin k → α := Function.update b j₀ (y i₁) + have hdisjQ₁ : Pairwise (fun j₁ j₂ => Disjoint V(Q₁ j₁) V(Q₁ j₂)) := by + intro j₁ j₂ hne + by_cases hj₁ : j₁ = j₀ <;> by_cases hj₂ : j₂ = j₀ + · exact (hne (hj₁.trans hj₂.symm)).elim + · subst hj₁ + simp only [Q₁, Function.update_self, Function.update_of_ne hj₂] + exact hi₁_disj.mono_right (subset_iUnion (fun j => V(Q j)) j₂) + · subst hj₂ + simp only [Q₁, Function.update_self, Function.update_of_ne hj₁] + exact (hi₁_disj.mono_right (subset_iUnion (fun j => V(Q j)) j₁)).symm + · simp only [Q₁, Function.update_of_ne hj₁, Function.update_of_ne hj₂] + exact hdisjQ hne + have hQ₁ : ∀ j : Fin k, IsFromToPathWithEnds G (Q₁ j) X Y (a₁ j) (b₁ j) := by + intro j + by_cases hj : j = j₀ + · subst hj; simp [Q₁, a₁, b₁, hP i₁] + · simp [Q₁, a₁, b₁, hj, hQ j] + have hrange_inter_eq : range x ∩ range a₁ = insert (x i₁) (range x ∩ range a) := by + ext w + simp only [mem_inter_iff, mem_range, mem_insert_iff] + constructor + · rintro ⟨⟨i, rfl⟩, ⟨j, hj⟩⟩ + by_cases hj₀ : j = j₀ + · subst hj₀; simp only [a₁, Function.update_self] at hj + exact Or.inl hj.symm + · simp only [a₁, Function.update_of_ne hj₀] at hj + exact Or.inr ⟨⟨i, rfl⟩, ⟨j, hj⟩⟩ + · rintro (rfl | ⟨⟨i, rfl⟩, ⟨j, hj⟩⟩) + · exact ⟨⟨i₁, rfl⟩, ⟨j₀, by simp [a₁]⟩⟩ + · have hj₀ : j ≠ j₀ := fun h => ha_not_x ⟨i, h ▸ hj.symm⟩ + exact ⟨⟨i, rfl⟩, ⟨j, by simp [a₁, hj₀, hj]⟩⟩ + have hx₁_not_inter : x i₁ ∉ range x ∩ range a := fun h => hx₁_not_a h.2 + have hcard_inter : (range x ∩ range a₁).ncard = (range x ∩ range a).ncard + 1 := by + rw [hrange_inter_eq] + exact ncard_insert_of_notMem hx₁_not_inter ((finite_range x).subset inter_subset_left) + have hcard_lt_r : (range x ∩ range a).ncard < r := by + have hlt_x : (range x ∩ range a).ncard < (range x).ncard := + ncard_lt_ncard + ⟨inter_subset_left, fun h => hx₁_not_a (h (mem_range_self i₁)).2⟩ + (finite_range x) + omega + have hE_sub : (⋃ j : Fin k, E(Q₁ j)) \ (⋃ i : Fin r, E(P i)) ⊆ + (⋃ j : Fin k, E(Q j)) \ (⋃ i : Fin r, E(P i)) := by + rintro e ⟨he_in, he_not_P⟩ + obtain ⟨j, hej⟩ := mem_iUnion.mp he_in + by_cases hj : j = j₀ + · subst hj + simp only [Q₁, Function.update_self] at hej + exact (he_not_P (mem_iUnion.mpr ⟨i₁, hej⟩)).elim + · simp only [Q₁, Function.update_of_ne hj] at hej + exact ⟨mem_iUnion.mpr ⟨j, hej⟩, he_not_P⟩ + have hE_le : ((⋃ j : Fin k, E(Q₁ j)) \ (⋃ i : Fin r, E(P i))).ncard ≤ + ((⋃ j : Fin k, E(Q j)) \ (⋃ i : Fin r, E(P i))).ncard := + ncard_le_ncard hE_sub hdiff_fin + have hlt : (r - (range x ∩ range a₁).ncard) + + ((⋃ j : Fin k, E(Q₁ j)) \ (⋃ i : Fin r, E(P i))).ncard < + (r - (range x ∩ range a).ncard) + + ((⋃ j : Fin k, E(Q j)) \ (⋃ i : Fin r, E(P i))).ncard := by + omega + exact ⟨Q₁, a₁, b₁, hdisjQ₁, hQ₁, hlt, hnot_y_sub_b⟩ + +/-- Given `r ≤ k`, a family `P : Fin r → Graph α β` of `r` mutually disjoint `X → Y` paths with ends +`x i` and `y i` in `G`, and a family `Q : Fin k → Graph α β` of `k` mutually disjoint `X → Y` paths +with ends `a j` and `b j` in `G`, there exists a family `Q' : Fin k → Graph α β` of `k` mutually +disjoint `X → Y` paths with ends `a' j` and `b' j` in `G` such that `range x ⊆ range a'` and +(when every `P i` meets `⋃ j, V(Q j)`, for example, when `range y ⊆ range b`) `b' = b`. -/ +theorem exists_replace_starts_disjoint_fromToPaths {G : Graph α β} {X Y : Set α} {r k : ℕ} + (hrk : r ≤ k) + {P : Fin r → Graph α β} {x y : Fin r → α} + (hdisjP : Pairwise (fun i j => Disjoint V(P i) V(P j))) + (hP : ∀ i : Fin r, IsFromToPathWithEnds G (P i) X Y (x i) (y i)) + {Q : Fin k → Graph α β} {a b : Fin k → α} + (hdisjQ : Pairwise (fun i j => Disjoint V(Q i) V(Q j))) + (hQ : ∀ j : Fin k, IsFromToPathWithEnds G (Q j) X Y (a j) (b j)) : + ∃ (Q' : Fin k → Graph α β) (a' b' : Fin k → α), + Pairwise (fun i j => Disjoint V(Q' i) V(Q' j)) ∧ + (∀ j : Fin k, IsFromToPathWithEnds G (Q' j) X Y (a' j) (b' j)) ∧ + range x ⊆ range a' ∧ + (range y ⊆ range b → b' = b) := by + classical + -- Induct on `m = (r - (range x ∩ range a).ncard) + ((⋃ j : Fin k, E(Q j)) \ (⋃ i : Fin r, E(P + -- i))).ncard`. + have hind : ∀ (m : ℕ) (Q : Fin k → Graph α β) (a b : Fin k → α), + Pairwise (fun i j => Disjoint V(Q i) V(Q j)) → + (∀ j : Fin k, IsFromToPathWithEnds G (Q j) X Y (a j) (b j)) → + (r - (range x ∩ range a).ncard) + + ((⋃ j : Fin k, E(Q j)) \ (⋃ i : Fin r, E(P i))).ncard = m → + ∃ (Q' : Fin k → Graph α β) (a' b' : Fin k → α), + Pairwise (fun i j => Disjoint V(Q' i) V(Q' j)) ∧ + (∀ j : Fin k, IsFromToPathWithEnds G (Q' j) X Y (a' j) (b' j)) ∧ + range x ⊆ range a' ∧ + (range y ⊆ range b → b' = b) := by + intro m + induction m using Nat.strong_induction_on with + | ind m ih => + intro Q a b hdisjQ hQ hm + have hEQ_fin : (⋃ j : Fin k, E(Q j)).Finite := + finite_iUnion fun j => (hQ j).1.edgeSet_finite + have hdiff_fin : ((⋃ j : Fin k, E(Q j)) \ (⋃ i : Fin r, E(P i))).Finite := + hEQ_fin.sdiff + by_cases hsub : range x ⊆ range a + · exact ⟨Q, a, b, hdisjQ, hQ, hsub, fun _ => rfl⟩ + · obtain ⟨_, ⟨i₀, rfl⟩, hx_not_a⟩ := not_subset.mp hsub + -- Either some `P i₁` is completely disjoint from `⋃ j : Fin k, V(Q j)`, OR every `P i` + -- meets `⋃ j, V(Q j)`: + by_cases hfreeP : ∃ i₁ : Fin r, Disjoint V(P i₁) (⋃ j : Fin k, V(Q j)) + · obtain ⟨i₁, hi₁_disj⟩ := hfreeP + obtain ⟨Q₁, a₁, b₁, hdisjQ₁, hQ₁, hlt, hnot_y_sub_b⟩ := + replace_with_disjoint_path hrk hdisjP hP hdisjQ hQ hi₁_disj + obtain ⟨Q', a', b', hdisjQ', hQ', hsub', _⟩ := + ih _ (hm ▸ hlt) Q₁ a₁ b₁ hdisjQ₁ hQ₁ rfl + exact ⟨Q', a', b', hdisjQ', hQ', hsub', fun hy => (hnot_y_sub_b hy).elim⟩ + · -- Every `P i` meets `⋃ j : Fin k, V(Q j)`. + -- In particular, `P i₀` meets `⋃ j : Fin k, V(Q j)`. + have hne_i₀ : (V(P i₀) ∩ (⋃ j : Fin k, V(Q j))).Nonempty := by + by_contra hemp + rw [not_nonempty_iff_eq_empty, ← disjoint_iff_inter_eq_empty] at hemp + exact hfreeP ⟨i₀, hemp⟩ + -- Let `z` be the FIRST vertex of `P i₀` in `⋃ j : Fin k, V(Q j)`, and `P₁` the subpath of + -- `P i₀` from `x i₀` to `z`. + obtain ⟨z, ⟨hzP, hzUQ⟩, P₁, hP₁_le, hP₁_path, hP₁_inter, hy_z⟩ := + (hP i₀).1.exists_first_hit hne_i₀ + obtain ⟨j₀, hzj₀⟩ := mem_iUnion.mp hzUQ + have hza_ne : z ≠ a j₀ := by + intro hza + have hzx : z = x i₀ := (hP i₀).eq_left_of_mem_X hzP (hza ▸ (hQ j₀).left_mem_X) + exact hx_not_a ⟨j₀, hza.symm.trans hzx⟩ + obtain ⟨Q_pref, Q_suff, hQ_pref_le, hQ_suff_le, hpath_Q_pref, hpath_Q_suff, + hQ_union, hinter_Q, hdisj_EQ⟩ := (hQ j₀).1.exists_split_at hzj₀ + let R := subgraphUnion G P₁ Q_suff + have hP₁G : IsGraphPathWithEnds G P₁ (x i₀) z := hP₁_path.mono (hP i₀).1.le + have hQ_suffG : IsGraphPathWithEnds G Q_suff z (b j₀) := hpath_Q_suff.mono (hQ j₀).1.le + have hinter_P₁_Qsuff : V(P₁) ∩ V(Q_suff) = {z} := by + ext w + simp only [mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨hw₁, hw₂⟩ => by + have : w ∈ V(P₁) ∩ (⋃ j : Fin k, V(Q j)) := + ⟨hw₁, mem_iUnion.mpr ⟨j₀, hQ_suff_le.vertexSet_mono hw₂⟩⟩ + rwa [hP₁_inter, mem_singleton_iff] at this, + fun h => h ▸ ⟨hP₁_path.right_mem, hpath_Q_suff.left_mem⟩⟩ + have hR_path : IsGraphPathWithEnds G R (x i₀) (b j₀) := + hP₁G.subgraphUnion hQ_suffG hinter_P₁_Qsuff + have hR_X : V(R) ∩ X = {x i₀} := by + rw [vertexSet_subgraphUnion, union_inter_distrib_right] + ext w + simp only [mem_union, mem_inter_iff, mem_singleton_iff] + constructor + · rintro (⟨hw₁, hwX⟩ | ⟨hw₂, hwX⟩) + · exact (hP i₀).eq_left_of_mem_X (hP₁_le.vertexSet_mono hw₁) hwX + · have hwa : w = a j₀ := (hQ j₀).eq_left_of_mem_X (hQ_suff_le.vertexSet_mono hw₂) hwX + have : a j₀ ∈ V(Q_pref) ∩ V(Q_suff) := ⟨hpath_Q_pref.left_mem, hwa ▸ hw₂⟩ + rw [hinter_Q, mem_singleton_iff] at this + exact (hza_ne this.symm).elim + · rintro rfl + exact Or.inl ⟨hP₁_path.left_mem, (hP i₀).left_mem_X⟩ + have hR_Y : V(R) ∩ Y = {b j₀} := by + rw [vertexSet_subgraphUnion, union_inter_distrib_right] + ext w + simp only [mem_union, mem_inter_iff, mem_singleton_iff] + constructor + · rintro (⟨hw₁, hwY⟩ | ⟨hw₂, hwY⟩) + · have hwy : w = y i₀ := (hP i₀).eq_right_of_mem_Y (hP₁_le.vertexSet_mono hw₁) hwY + have hzy : z = y i₀ := hy_z (hwy ▸ hw₁) + have hzb : z = b j₀ := (hQ j₀).eq_right_of_mem_Y hzj₀ (hzy ▸ (hP i₀).right_mem_Y) + exact hwy.trans (hzy.symm.trans hzb) + · exact (hQ j₀).eq_right_of_mem_Y (hQ_suff_le.vertexSet_mono hw₂) hwY + · rintro rfl + exact Or.inr ⟨hpath_Q_suff.right_mem, (hQ j₀).right_mem_Y⟩ + have hR_fromTo : IsFromToPathWithEnds G R X Y (x i₀) (b j₀) := ⟨hR_path, hR_X, hR_Y⟩ + let Q₁ : Fin k → Graph α β := Function.update Q j₀ R + let a₁ : Fin k → α := Function.update a j₀ (x i₀) + have hdisj_R_other : ∀ j : Fin k, j ≠ j₀ → Disjoint V(R) V(Q j) := by + intro j hj + rw [vertexSet_subgraphUnion, disjoint_union_left] + refine ⟨disjoint_left.mpr fun w hw₁ hwQ => ?_, + (hdisjQ (Ne.symm hj)).mono_left hQ_suff_le.vertexSet_mono⟩ + have hw_inter : w ∈ V(P₁) ∩ (⋃ j' : Fin k, V(Q j')) := + ⟨hw₁, mem_iUnion.mpr ⟨j, hwQ⟩⟩ + rw [hP₁_inter, mem_singleton_iff] at hw_inter + subst hw_inter + exact disjoint_left.mp (hdisjQ (Ne.symm hj)) hzj₀ hwQ + have hdisjQ₁ : Pairwise (fun j₁ j₂ => Disjoint V(Q₁ j₁) V(Q₁ j₂)) := by + intro j₁ j₂ hne + by_cases hj₁ : j₁ = j₀ <;> by_cases hj₂ : j₂ = j₀ + · exact (hne (hj₁.trans hj₂.symm)).elim + · subst hj₁ + simp only [Q₁, Function.update_self, Function.update_of_ne hj₂] + exact hdisj_R_other j₂ hj₂ + · subst hj₂ + simp only [Q₁, Function.update_self, Function.update_of_ne hj₁] + exact (hdisj_R_other j₁ hj₁).symm + · simp only [Q₁, Function.update_of_ne hj₁, Function.update_of_ne hj₂] + exact hdisjQ hne + have hQ₁ : ∀ j : Fin k, IsFromToPathWithEnds G (Q₁ j) X Y (a₁ j) (b j) := by + intro j + by_cases hj : j = j₀ + · subst hj; simp [Q₁, a₁, hR_fromTo] + · simp [Q₁, a₁, hj, hQ j] + -- Show `(range x ∩ range a).ncard ≤ (range x ∩ range a₁).ncard`. + have hsub_insert : insert (x i₀) ((range x ∩ range a) \ {a j₀}) ⊆ range x ∩ range a₁ := by + rintro w (rfl | ⟨⟨⟨i, rfl⟩, ⟨j, hj⟩⟩, hne_aj₀⟩) + · exact ⟨⟨i₀, rfl⟩, ⟨j₀, by simp [a₁]⟩⟩ + · have hj_ne : j ≠ j₀ := fun h => hne_aj₀ (by rw [mem_singleton_iff, ← hj, h]) + exact ⟨⟨i, rfl⟩, ⟨j, by simp [a₁, hj_ne, hj]⟩⟩ + have hx₀_not_diff : x i₀ ∉ (range x ∩ range a) \ {a j₀} := + fun h => hx_not_a h.1.2 + have hfin_inter : (range x ∩ range a).Finite := (finite_range x).subset inter_subset_left + have hfin_inter₁ : (range x ∩ range a₁).Finite := (finite_range x).subset + inter_subset_left + have hcard_inter_le : (range x ∩ range a).ncard ≤ (range x ∩ range a₁).ncard := by + have h1 : (insert (x i₀) ((range x ∩ range a) \ {a j₀})).ncard ≤ + (range x ∩ range a₁).ncard := + ncard_le_ncard hsub_insert hfin_inter₁ + rw [ncard_insert_of_notMem hx₀_not_diff hfin_inter.sdiff] at h1 + have h2 : (range x ∩ range a).ncard ≤ + (insert (a j₀) ((range x ∩ range a) \ {a j₀})).ncard := + ncard_le_ncard (subset_insert_sdiff_singleton (a j₀) _) + (hfin_inter.sdiff.insert (a j₀)) + have h3 := ncard_insert_le (a j₀) ((range x ∩ range a) \ {a j₀}) + omega + -- Show `((⋃ j, E(Q₁ j)) \ (⋃ i, E(P i))).ncard < ((⋃ j, E(Q j)) \ (⋃ i, E(P i))).ncard`. + have hE_sub : (⋃ j : Fin k, E(Q₁ j)) \ (⋃ i : Fin r, E(P i)) ⊆ + (⋃ j : Fin k, E(Q j)) \ (⋃ i : Fin r, E(P i)) := by + rintro e ⟨he_in, he_not_P⟩ + obtain ⟨j, hej⟩ := mem_iUnion.mp he_in + by_cases hj : j = j₀ + · subst hj + simp only [Q₁, Function.update_self, R] at hej + rw [edgeSet_subgraphUnion hP₁G.le hQ_suffG.le, mem_union] at hej + rcases hej with heP₁ | heQsuff + · exact (he_not_P (mem_iUnion.mpr ⟨i₀, hP₁_le.edgeSet_mono heP₁⟩)).elim + · exact ⟨mem_iUnion.mpr ⟨j, hQ_suff_le.edgeSet_mono heQsuff⟩, he_not_P⟩ + · simp only [Q₁, Function.update_of_ne hj] at hej + exact ⟨mem_iUnion.mpr ⟨j, hej⟩, he_not_P⟩ + have hnot_Qpref_sub : ¬ E(Q_pref) ⊆ ⋃ i : Fin r, E(P i) := by + intro hsub_pref + have ha_in_Pi₀ : a j₀ ∈ V(P i₀) := + left_mem_of_edgeSet_subset_iUnion_disjoint + (hpath_Q_pref.mono (hQ j₀).1.le) hdisjP (fun i => (hP i).1.le) hzP hsub_pref + have ha_eq_xi₀ : a j₀ = x i₀ := + (hP i₀).eq_left_of_mem_X ha_in_Pi₀ (hQ j₀).left_mem_X + exact hx_not_a ⟨j₀, ha_eq_xi₀⟩ + obtain ⟨e₀, he₀_pref, he₀_not_P⟩ := not_subset.mp hnot_Qpref_sub + have he₀_in_old : e₀ ∈ (⋃ j : Fin k, E(Q j)) \ (⋃ i : Fin r, E(P i)) := + ⟨mem_iUnion.mpr ⟨j₀, hQ_pref_le.edgeSet_mono he₀_pref⟩, he₀_not_P⟩ + have he₀_not_new : e₀ ∉ (⋃ j : Fin k, E(Q₁ j)) \ (⋃ i : Fin r, E(P i)) := by + rintro ⟨he₀_Q₁, _⟩ + obtain ⟨j, he₀_j⟩ := mem_iUnion.mp he₀_Q₁ + by_cases hj : j = j₀ + · subst hj + simp only [Q₁, Function.update_self, R] at he₀_j + rw [edgeSet_subgraphUnion hP₁G.le hQ_suffG.le, mem_union] at he₀_j + rcases he₀_j with he₀_P₁ | he₀_Qsuff + · exact he₀_not_P (mem_iUnion.mpr ⟨i₀, hP₁_le.edgeSet_mono he₀_P₁⟩) + · exact disjoint_left.mp hdisj_EQ he₀_pref he₀_Qsuff + · simp only [Q₁, Function.update_of_ne hj] at he₀_j + obtain ⟨u₀, v₀, huv₀⟩ := (Q j₀).exists_isLink_of_mem_edgeSet + (hQ_pref_le.edgeSet_mono he₀_pref) + obtain ⟨u₁, v₁, huv₁⟩ := (Q j).exists_isLink_of_mem_edgeSet he₀_j + have heq := (huv₀.mono (hQ j₀).1.le).left_eq_or_eq (huv₁.mono (hQ j).1.le) + have hu₀_in_j : u₀ ∈ V(Q j) := by + rcases heq with rfl | rfl + · exact huv₁.left_mem + · exact huv₁.right_mem + exact disjoint_left.mp (hdisjQ (Ne.symm hj)) huv₀.left_mem hu₀_in_j + have hE_lt : ((⋃ j : Fin k, E(Q₁ j)) \ (⋃ i : Fin r, E(P i))).ncard < + ((⋃ j : Fin k, E(Q j)) \ (⋃ i : Fin r, E(P i))).ncard := + ncard_lt_ncard ⟨hE_sub, fun h => he₀_not_new (h he₀_in_old)⟩ hdiff_fin + have hlt : (r - (range x ∩ range a₁).ncard) + + ((⋃ j : Fin k, E(Q₁ j)) \ (⋃ i : Fin r, E(P i))).ncard < m := by + omega + obtain ⟨Q', a', b', hdisjQ', hQ', hsub', hb'⟩ := + ih _ hlt Q₁ a₁ b hdisjQ₁ hQ₁ rfl + exact ⟨Q', a', b', hdisjQ', hQ', hsub', hb'⟩ + exact hind _ Q a b hdisjQ hQ rfl + +/-- Given a path `P` from `x` to `y` that is an `X → Y` path in `G`, the same subgraph `P` viewed +in reverse is a `Y → X` path in `G` from `y` to `x`. -/ +theorem IsFromToPathWithEnds.symm {G P : Graph α β} {X Y : Set α} {x y : α} + (h : IsFromToPathWithEnds G P X Y x y) : + IsFromToPathWithEnds G P Y X y x := + ⟨h.1.symm, h.2.2, h.2.1⟩ + +/-- **Graph Minors IX, (2.2)** (page 44): +"Let $G$ be a graph and let $X, Y \subseteq V(G)$. Let $k \ge 0$ be an integer such that there are +$k$ mutually disjoint $X \to Y$ paths. Let $X' \subseteq X$, $Y' \subseteq Y$ be such that +$|X'| = |Y'| \le k$ and such that $X' \Rightarrow Y'$ with respect to $X, Y$. Then there exist +$X'' \subseteq X$ and $Y'' \subseteq Y$ such that $X' \subseteq X''$, $Y' \subseteq Y''$, +$|X''| = |Y''| = k$ and $X'' \Rightarrow Y''$ with respect to $X, Y$." -/ +theorem theorem_2_2_proof {G : Graph α β} [Finite V(G)] {X Y X' Y' : Set α} {k : ℕ} + (hX : X ⊆ V(G)) (hY : Y ⊆ V(G)) + (hk : ∃ Q : Fin k → Graph α β, Pairwise (fun i j => Disjoint V(Q i) V(Q j)) ∧ + ∀ i : Fin k, IsFromToPath G (Q i) X Y) + (hX' : X' ⊆ X) (hY' : Y' ⊆ Y) (_hcard : X'.ncard = Y'.ncard) (hle : X'.ncard ≤ k) + (hred : RedirectsTo G X Y X' Y') : + ∃ X'' Y'' : Set α, X'' ⊆ X ∧ Y'' ⊆ Y ∧ X' ⊆ X'' ∧ Y' ⊆ Y'' ∧ + X''.ncard = k ∧ Y''.ncard = k ∧ RedirectsTo G X Y X'' Y'' := by + classical + have hVG_fin : V(G).Finite := toFinite V(G) + have hX'_fin : X'.Finite := hVG_fin.subset (hX'.trans hX) + have hY'_fin : Y'.Finite := hVG_fin.subset (hY'.trans hY) + obtain ⟨P, x, y, hdisjP, hP, hx_eq, hy_eq⟩ := + exists_indexed_of_redirectsTo hX'_fin hY'_fin hred rfl + obtain ⟨Q, hdisjQ, hQ_ex⟩ := hk + choose a b hQ using hQ_ex + -- Pass 1: replace initial vertices so that `X' = range x ⊆ range a₁`. + obtain ⟨Q₁, a₁, b₁, hdisjQ₁, hQ₁, hsub_x, _⟩ := + exists_replace_starts_disjoint_fromToPaths hle hdisjP hP hdisjQ hQ + -- Pass 2: reverse `X` and `Y` and replace initial vertices of the reversed paths so that + -- `Y' = range y ⊆ range b₂`, while keeping `a₂ = a₁` (since `range x ⊆ range a₁`). + have hP_symm : ∀ i : Fin X'.ncard, IsFromToPathWithEnds G (P i) Y X (y i) (x i) := + fun i => (hP i).symm + have hQ₁_symm : ∀ j : Fin k, IsFromToPathWithEnds G (Q₁ j) Y X (b₁ j) (a₁ j) := + fun j => (hQ₁ j).symm + obtain ⟨Q₂, b₂, a₂, hdisjQ₂, hQ₂_symm, hsub_y, ha₂_eq⟩ := + exists_replace_starts_disjoint_fromToPaths hle hdisjP hP_symm hdisjQ₁ hQ₁_symm + have hQ₂ : ∀ j : Fin k, IsFromToPathWithEnds G (Q₂ j) X Y (a₂ j) (b₂ j) := + fun j => (hQ₂_symm j).symm + obtain ⟨_, _, ha₂_card, hb₂_card, hred₂⟩ := + redirectsTo_of_disjoint_fromToPaths hdisjQ₂ hQ₂ + refine ⟨range a₂, range b₂, hred₂.1, hred₂.2.1, ?_, ?_, ha₂_card, hb₂_card, hred₂⟩ + · rw [← hx_eq, ha₂_eq hsub_x]; exact hsub_x + · rwa [← hy_eq] + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section2d.lean b/LeanPool/GraphMinor/GM09/Section2d.lean new file mode 100644 index 0000000000..639c504140 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section2d.lean @@ -0,0 +1,1069 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Section2c +import LeanPool.GraphMinor.Menger.SimpleGraph + +/-! +# Graph Minors IX, Section 2 (Part 4): Menger's Theorem for Graphs and Lemma (2.3) + +This file formalizes Lemma (2.3) from Section 2 of +N. Robertson and P. D. Seymour, *Graph Minors. IX. Disjoint crossed paths*, +J. Combin. Theory Ser. B **49** (1990) 40–77 (pages 44–45): +if `{P₁, P₂, P₃}` is a tripod in a society `(G, Ω)`, then either `(G, Ω)` has a cross, or there is +an internal 3-separation `(G₁, G₂)` of `(G, Ω)` with `P₁ ∪ P₂ ∪ P₃ ⊆ G₁`. +-/ + +public section + +namespace GraphMinor.GM09 + +open Set Graph GraphMinor.Surface GraphMinor.GM06 + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Menger's Theorem for `Graph α β` -/ + +/-- Every walk `W : GraphWalk G u v` in `G` with `u ∈ V(G₁)` and `v ∈ V(G₂)` for a separation +`(G₁, G₂)` of `G` contains a vertex in `V(G₁) ∩ V(G₂)`. -/ +theorem exists_mem_inter_of_graphWalk {G G₁ G₂ : Graph α β} + (hsep : IsGraphSeparation G G₁ G₂) {u v : α} (W : GraphWalk G u v) + (hu : u ∈ V(G₁)) (hv : v ∈ V(G₂)) : + ∃ z ∈ W.support, z ∈ V(G₁) ∩ V(G₂) := by + induction W with + | @nil u _ => + exact ⟨u, by simp [GraphWalk.support], hu, hv⟩ + | @cons u w v e hlink rest ih => + by_cases hw₁ : w ∈ V(G₁) + · obtain ⟨z, hz, hz_mem⟩ := ih hw₁ hv + exact ⟨z, List.mem_cons_of_mem _ hz, hz_mem⟩ + · have he : e ∈ E(G₁) ∪ E(G₂) := by + rw [hsep.2.2.2.1] + exact hlink.edge_mem + rcases he with he₁ | he₂ + · have hlink₁ : G₁.IsLink e u w := (hsep.1.isLink_iff he₁).mpr hlink + exact (hw₁ hlink₁.right_mem).elim + · have hlink₂ : G₂.IsLink e u w := (hsep.2.1.isLink_iff he₂).mpr hlink + exact ⟨u, by simp [GraphWalk.support], hu, hlink₂.left_mem⟩ + +/-- Every path `P` in `G` from `x ∈ X` to `y ∈ Y` meets `V(G₁) ∩ V(G₂)` whenever `(G₁, G₂)` is a +separation of `G` with `X ⊆ V(G₁)` and `Y ⊆ V(G₂)`. -/ +theorem exists_mem_inter_of_isGraphPathWithEnds {G G₁ G₂ P : Graph α β} + (hsep : IsGraphSeparation G G₁ G₂) {x y : α} (hP : IsGraphPathWithEnds G P x y) + (hx : x ∈ V(G₁)) (hy : y ∈ V(G₂)) : + ∃ z ∈ V(P), z ∈ V(G₁) ∩ V(G₂) := by + rcases hP with ⟨hPG, W, _, hVP, _⟩ + obtain ⟨W_G, hs, _⟩ := W.exists_transfer (fun _ _ _ _ hl => hl.mono hPG) + (fun _ hz => hPG.vertexSet_mono (W.mem_vertexSet_of_mem_support hz)) + obtain ⟨z, hzW, hz_inter⟩ := exists_mem_inter_of_graphWalk hsep W_G hx hy + rw [hs] at hzW + exact ⟨z, by rw [hVP]; exact hzW, hz_inter⟩ + +/-- If `(G₁, G₂)` is a separation of `G` with `X ⊆ V(G₁)` and `Y ⊆ V(G₂)`, and there are `k` +mutually disjoint paths in `G` from `X` to `Y`, then `k ≤ (V(G₁) ∩ V(G₂)).ncard`. -/ +theorem ncard_inter_ge_of_disjoint_paths {G G₁ G₂ : Graph α β} [Finite V(G)] + (hsep : IsGraphSeparation G G₁ G₂) {X Y : Set α} (hX : X ⊆ V(G₁)) (hY : Y ⊆ V(G₂)) + {k : ℕ} {P : Fin k → Graph α β} {x y : Fin k → α} + (hdisj : Pairwise (fun i j => Disjoint V(P i) V(P j))) + (hP : ∀ i : Fin k, IsGraphPathWithEnds G (P i) (x i) (y i) ∧ x i ∈ X ∧ y i ∈ Y) : + k ≤ (V(G₁) ∩ V(G₂)).ncard := by + have hex : ∀ i : Fin k, ∃ z ∈ V(P i), z ∈ V(G₁) ∩ V(G₂) := fun i => + exists_mem_inter_of_isGraphPathWithEnds hsep (hP i).1 (hX (hP i).2.1) (hY (hP i).2.2) + choose z hzP hz_inter using hex + have hz_inj : Function.Injective z := by + intro i j hij + by_contra hne + exact disjoint_left.mp (hdisj hne) (hzP i) (hij ▸ hzP j) + have hsub : range z ⊆ V(G₁) ∩ V(G₂) := by rintro _ ⟨i, rfl⟩; exact hz_inter i + have hfin : (V(G₁) ∩ V(G₂)).Finite := + (toFinite V(G)).subset (inter_subset_left.trans hsep.1.vertexSet_mono) + have hle := ncard_le_ncard hsub hfin + rwa [ncard_range_of_injective hz_inj, Nat.card_fin] at hle + +/-- The vertices of `G` reachable from `X` by walks in `G` avoiding `S`. -/ +private def reachableWalkAvoiding (G : Graph α β) (X S : Set α) : Set α := + {v ∈ V(G) | ∃ x ∈ X, ∃ W : GraphWalk G x v, ∀ z ∈ W.support, z ∉ S} + +/-- From a vertex separator `S ⊆ V(G)` between `X` and `Y` in `G`, construct a separation +`(G₁, G₂)` of `G` with `G₁ = G.induce V(G₁)`, `X ⊆ V(G₁)`, `Y ⊆ V(G₂)`, and `V(G₁) ∩ V(G₂) = S`. -/ +theorem exists_graphSeparation_of_vertexSeparator {G : Graph α β} {X Y S : Set α} + (hX : X ⊆ V(G)) (hY : Y ⊆ V(G)) (hS : S ⊆ V(G)) + (hsep_walk : ∀ x ∈ X, ∀ y ∈ Y, ∀ W : GraphWalk G x y, ∃ z ∈ W.support, z ∈ S) : + ∃ G₁ G₂ : Graph α β, + IsGraphSeparation G G₁ G₂ ∧ + G₁ = G.induce V(G₁) ∧ + X ⊆ V(G₁) ∧ + Y ⊆ V(G₂) ∧ + V(G₁) ∩ V(G₂) = S := by + let R := reachableWalkAvoiding G X S + have hR_sub : R ⊆ V(G) \ S := by + rintro v ⟨hvG, x, _, W, hW⟩ + exact ⟨hvG, hW v W.end_mem_support⟩ + let V₁ : Set α := R ∪ S + let V₂ : Set α := V(G) \ R + have hV₁_sub : V₁ ⊆ V(G) := union_subset (hR_sub.trans sdiff_subset) hS + have hV₂_sub : V₂ ⊆ V(G) := sdiff_subset + let G₁ : Graph α β := G.induce V₁ + let G₂ : Graph α β := (G.induce V₂).restrict (E(G) \ E(G₁)) + have hG₁_le : G₁ ≤ G := G.induce_le hV₁_sub + have hG₂_le : G₂ ≤ G := restrict_le.trans (G.induce_le hV₂_sub) + have hV₁_eq : V(G₁) = V₁ := rfl + have hV₂_eq : V(G₂) = V₂ := rfl + have hE₂_eq : E(G₂) = E(G) \ E(G₁) := by + change E((G.induce V₂).restrict (E(G) \ E(G₁))) = E(G) \ E(G₁) + rw [edgeSet_restrict, inter_eq_right] + rintro e ⟨heG, he_not_G₁⟩ + obtain ⟨u, v, huv⟩ := G.exists_isLink_of_mem_edgeSet heG + refine ⟨u, v, huv, ⟨huv.left_mem, fun huR => he_not_G₁ ?_⟩, + ⟨huv.right_mem, fun hvR => he_not_G₁ ?_⟩⟩ + · refine ⟨u, v, huv, Or.inl huR, ?_⟩ + by_cases hvS : v ∈ S + · exact Or.inr hvS + · obtain ⟨_, x, hxX, W, hW⟩ := huR + refine Or.inl ⟨huv.right_mem, x, hxX, W.append (.cons huv (.nil huv.right_mem)), ?_⟩ + intro z hz + rw [GraphWalk.mem_support_append] at hz + rcases hz with hzW | hz_v + · exact hW z hzW + · simp only [GraphWalk.support, List.mem_cons, List.not_mem_nil, or_false] at hz_v + rcases hz_v with rfl | rfl + · exact hW z W.end_mem_support + · exact hvS + · refine ⟨u, v, huv, ?_, Or.inl hvR⟩ + by_cases huS : u ∈ S + · exact Or.inr huS + · obtain ⟨_, x, hxX, W, hW⟩ := hvR + refine Or.inl ⟨huv.left_mem, x, hxX, W.append (.cons huv.symm (.nil huv.left_mem)), ?_⟩ + intro z hz + rw [GraphWalk.mem_support_append] at hz + rcases hz with hzW | hz_u + · exact hW z hzW + · simp only [GraphWalk.support, List.mem_cons, List.not_mem_nil, or_false] at hz_u + rcases hz_u with rfl | rfl + · exact hW z W.end_mem_support + · exact huS + refine ⟨G₁, G₂, ⟨hG₁_le, hG₂_le, ?_, ?_, ?_⟩, rfl, ?_, ?_, ?_⟩ + · ext v + simp only [hV₁_eq, hV₂_eq, V₁, V₂, mem_union, mem_sdiff] + constructor + · rintro ((hvR | hvS) | ⟨hvG, _⟩) + · exact hvR.1 + · exact hS hvS + · exact hvG + · intro hvG + by_cases hvR : v ∈ R + · exact Or.inl (Or.inl hvR) + · exact Or.inr ⟨hvG, hvR⟩ + · rw [hE₂_eq, union_sdiff_cancel hG₁_le.edgeSet_mono] + · rw [hE₂_eq] + exact disjoint_sdiff_right + · intro x hxX + by_cases hxS : x ∈ S + · exact Or.inr hxS + · refine Or.inl ⟨hX hxX, x, hxX, .nil (hX hxX), fun z hz => ?_⟩ + simp only [GraphWalk.support, List.mem_singleton] at hz + exact hz ▸ hxS + · intro y hyY + refine ⟨hY hyY, ?_⟩ + rintro ⟨_, x, hxX, W, hW⟩ + obtain ⟨z, hzW, hzS⟩ := hsep_walk x hxX y hyY W + exact hW z hzW hzS + · ext v + simp only [hV₁_eq, hV₂_eq, V₁, V₂, mem_inter_iff, mem_union, mem_sdiff] + constructor + · rintro ⟨hvR | hvS, _, hv_not_R⟩ + · exact (hv_not_R hvR).elim + · exact hvS + · intro hvS + exact ⟨Or.inr hvS, hS hvS, fun hvR => (hR_sub hvR).2 hvS⟩ + +/-- **Menger's Theorem for `Graph α β`**: +For any finite graph `G`, subsets `X, Y ⊆ V(G)`, and `k : ℕ`, either there exist `k` mutually +disjoint `X → Y` paths in `G`, or there exists a separation `(G₁, G₂)` of `G` with +`G₁ = G.induce V(G₁)`, `X ⊆ V(G₁)`, `Y ⊆ V(G₂)`, and `(V(G₁) ∩ V(G₂)).ncard < k`. -/ +theorem exists_fromToPaths_or_graphSeparation {G : Graph α β} [Finite V(G)] + {X Y : Set α} (hX : X ⊆ V(G)) (hY : Y ⊆ V(G)) (k : ℕ) : + (∃ Q : Fin k → Graph α β, + Pairwise (fun i j => Disjoint V(Q i) V(Q j)) ∧ + ∀ i : Fin k, IsFromToPath G (Q i) X Y) ∨ + (∃ G₁ G₂ : Graph α β, + IsGraphSeparation G G₁ G₂ ∧ + G₁ = G.induce V(G₁) ∧ + X ⊆ V(G₁) ∧ + Y ⊆ V(G₂) ∧ + (V(G₁) ∩ V(G₂)).ncard < k) := by + classical + let K : SimpleGraph ↥V(G) := { + Adj u v := u ≠ v ∧ ∃ e : β, G.IsLink e u.1 v.1 + symm := ⟨fun _ _ ⟨hne, e, he⟩ => ⟨hne.symm, e, he.symm⟩⟩ + loopless := ⟨fun _ h => h.1 rfl⟩ + } + let X₀ : Set ↥V(G) := {u : ↥V(G) | u.1 ∈ X} + let Y₀ : Set ↥V(G) := {u : ↥V(G) | u.1 ∈ Y} + by_cases hM : ∀ S₀ : Set ↥V(G), + (∀ P : PathFromTo K X₀ Y₀, ∃ x ∈ P.walk.support, x ∈ S₀) → k ≤ S₀.ncard + · left + obtain ⟨P₀, hP₀_disj⟩ := + GraphMinor.Menger.exists_disjointPaths K X₀ Y₀ inferInstance k hM + -- Lift any `SimpleGraph.Walk` in `K` to a `GraphWalk` in `G` with the same vertex support. + have hlift_walk : ∀ {u v : ↥V(G)} (w : K.Walk u v), + ∃ W : GraphWalk G u.1 v.1, W.support = w.support.map Subtype.val := by + intro u v w + induction w with + | @nil u => + exact ⟨.nil u.2, rfl⟩ + | @cons u u' v hadj rest ih => + obtain ⟨_, e, he⟩ := hadj + obtain ⟨W', hW'⟩ := ih + exact ⟨.cons he W', by simp [GraphWalk.support, hW']⟩ + have hpath_ex : ∀ i : Fin k, ∃ Q_i : Graph α β, + V(Q_i) ⊆ Subtype.val '' {u : ↥V(G) | u ∈ (P₀ i).walk.support} ∧ + IsFromToPath G Q_i X Y := by + intro i + obtain ⟨W_i, hW_i_supp⟩ := hlift_walk (P₀ i).walk + have hW_i_simple : W_i.IsSimple := by + unfold GraphWalk.IsSimple + rw [hW_i_supp] + exact (P₀ i).isPath.support_nodup.map Subtype.val_injective + have hP_i : IsGraphPathWithEnds G (walkSubgraph W_i) (P₀ i).first.1 (P₀ i).last.1 := + isGraphPathWithEnds_walkSubgraph hW_i_simple + obtain ⟨x_i, _, y_i, _, Q_i, hQ_i_le, hQ_i⟩ := + hP_i.exists_isFromToPathWithEnds (P₀ i).first_mem (P₀ i).last_mem + refine ⟨Q_i, ?_, x_i, y_i, hQ_i⟩ + intro z hz + have hzW : z ∈ V(walkSubgraph W_i) := hQ_i_le.vertexSet_mono hz + rw [vertexSet_walkSubgraph, mem_ofPred_eq, hW_i_supp, List.mem_map] at hzW + rcases hzW with ⟨u, hu, rfl⟩ + exact ⟨u, hu, rfl⟩ + choose Q hQ_sub hQ using hpath_ex + refine ⟨Q, fun i j hij => disjoint_left.mpr fun z hzi hzj => ?_, hQ⟩ + obtain ⟨ui, hui, rfl⟩ := hQ_sub i hzi + obtain ⟨uj, huj, huj_eq⟩ := hQ_sub j hzj + have hu_eq : ui = uj := Subtype.val_injective huj_eq.symm + exact disjoint_left.mp (hP₀_disj hij) hui (hu_eq ▸ huj) + · right + push Not at hM + obtain ⟨S₀, hS₀_sep, hS₀_lt⟩ := hM + let S : Set α := Subtype.val '' S₀ + have hS_sub : S ⊆ V(G) := by rintro _ ⟨u, _, rfl⟩; exact u.2 + have hS_card : S.ncard < k := by + rwa [ncard_image_of_injective S₀ Subtype.val_injective] + -- Every `GraphWalk G x y` projects to a `K.Walk` with support contained in `W.support`. + have hproj_walk : ∀ {x y : α} (W : GraphWalk G x y), + ∃ (hx : x ∈ V(G)) (hy : y ∈ V(G)) (w : K.Walk ⟨x, hx⟩ ⟨y, hy⟩), + ∀ u ∈ w.support, u.1 ∈ W.support := by + intro x y W + induction W with + | @nil x hx => + refine ⟨hx, hx, .nil, fun u hu => ?_⟩ + simp only [SimpleGraph.Walk.support_nil, List.mem_singleton] at hu + subst hu + exact List.mem_cons_self + | @cons x x' y e hlink rest ih => + obtain ⟨hx', hy, w', hw'⟩ := ih + have hx : x ∈ V(G) := hlink.left_mem + by_cases hxx' : (⟨x, hx⟩ : ↥V(G)) = ⟨x', hx'⟩ + · refine ⟨hx, hy, w'.copy hxx'.symm rfl, fun u hu => ?_⟩ + rw [SimpleGraph.Walk.support_copy] at hu + exact List.mem_cons_of_mem _ (hw' u hu) + · have hadj : K.Adj ⟨x, hx⟩ ⟨x', hx'⟩ := ⟨hxx', e, hlink⟩ + refine ⟨hx, hy, .cons hadj w', fun u hu => ?_⟩ + rw [SimpleGraph.Walk.support_cons, List.mem_cons] at hu + rcases hu with rfl | hu' + · exact List.mem_cons_self + · exact List.mem_cons_of_mem _ (hw' u hu') + have hsep_walk : ∀ x ∈ X, ∀ y ∈ Y, ∀ W : GraphWalk G x y, ∃ z ∈ W.support, z ∈ S := by + intro x hxX y hyY W + obtain ⟨hxG, hyG, w, hw⟩ := hproj_walk W + let p : PathFromTo K X₀ Y₀ := + ⟨⟨x, hxG⟩, ⟨y, hyG⟩, w.bypass, w.bypass_isPath, hxX, hyY⟩ + obtain ⟨u, hu_supp, hu_S₀⟩ := hS₀_sep p + exact ⟨u.1, hw u (w.support_bypass_subset_support hu_supp), u, hu_S₀, rfl⟩ + obtain ⟨G₁, G₂, hsep, hG₁_ind, hX₁, hY₂, hinter⟩ := + exists_graphSeparation_of_vertexSeparator hX hY hS_sub hsep_walk + exact ⟨G₁, G₂, hsep, hG₁_ind, hX₁, hY₂, hinter ▸ hS_card⟩ + +/-! ## Four Distinct Elements in a Cyclic Permutation -/ + +namespace CyclicPerm + +variable {Ω : CyclicPerm α} + +theorem isClockwise4_iff {v₁ v₂ v₃ v₄ : α} : + Ω.IsClockwiseSeq [v₁, v₂, v₃, v₄] ↔ + v₁ ≠ v₂ ∧ v₁ ≠ v₃ ∧ v₁ ≠ v₄ ∧ v₂ ≠ v₃ ∧ v₂ ≠ v₄ ∧ v₃ ≠ v₄ ∧ + v₁ ∈ Ω.bar ∧ v₂ ∈ Ω.bar ∧ v₃ ∈ Ω.bar ∧ v₄ ∈ Ω.bar ∧ + Ω.FirstHitIn {v₁, v₂, v₃, v₄} v₁ v₂ ∧ + Ω.FirstHitIn {v₁, v₂, v₃, v₄} v₂ v₃ ∧ + Ω.FirstHitIn {v₁, v₂, v₃, v₄} v₃ v₄ ∧ + Ω.FirstHitIn {v₁, v₂, v₃, v₄} v₄ v₁ := by + unfold IsClockwiseSeq + have hset : {v | v ∈ ([v₁, v₂, v₃, v₄] : List α)} = {v₁, v₂, v₃, v₄} := by + ext x; simp [Set.mem_insert_iff, Set.mem_singleton_iff] + constructor + · rintro ⟨hnodup, hmem, hhit⟩ + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or, + List.nodup_nil, and_true] at hnodup + have h0 : Ω.FirstHitIn {v₁, v₂, v₃, v₄} v₁ v₂ := by + have := hhit 0 (by simp); rwa [hset] at this + have h1 : Ω.FirstHitIn {v₁, v₂, v₃, v₄} v₂ v₃ := by + have := hhit 1 (by simp); rwa [hset] at this + have h2 : Ω.FirstHitIn {v₁, v₂, v₃, v₄} v₃ v₄ := by + have := hhit 2 (by simp); rwa [hset] at this + have h3 : Ω.FirstHitIn {v₁, v₂, v₃, v₄} v₄ v₁ := by + have := hhit 3 (by simp); rw [hset] at this; simpa using this + exact ⟨hnodup.1.1, hnodup.1.2.1, hnodup.1.2.2, hnodup.2.1.1, hnodup.2.1.2, hnodup.2.2.1, + hmem v₁ (by simp), hmem v₂ (by simp), hmem v₃ (by simp), hmem v₄ (by simp), + h0, h1, h2, h3⟩ + · rintro ⟨h12, h13, h14, h23, h24, h34, hv1, hv2, hv3, hv4, h0, h1, h2, h3⟩ + refine ⟨?_, ?_, ?_⟩ + · simp [h12, h13, h14, h23, h24, h34] + · intro v hv + simp only [List.mem_cons, List.not_mem_nil, or_false] at hv + rcases hv with rfl | rfl | rfl | rfl <;> assumption + · intro i hi + simp only [List.length_cons, List.length_nil, Nat.reduceAdd] at hi + rw [hset] + rcases i with _ | _ | _ | _ | i + · exact h0 + · exact h1 + · exact h2 + · simpa using h3 + · omega + +theorem isClockwise4_rotate {v₁ v₂ v₃ v₄ : α} (h : Ω.IsClockwiseSeq [v₁, v₂, v₃, v₄]) : + Ω.IsClockwiseSeq [v₂, v₃, v₄, v₁] := by + rw [isClockwise4_iff] at h ⊢ + rcases h with ⟨h12, h13, h14, h23, h24, h34, hv1, hv2, hv3, hv4, h0, h1, h2, h3⟩ + have hset : ({v₂, v₃, v₄, v₁} : Set α) = {v₁, v₂, v₃, v₄} := by + ext x; simp [or_comm, or_left_comm] + rw [hset] + exact ⟨h23, h24, h12.symm, h34, h13.symm, h14.symm, hv2, hv3, hv4, hv1, h1, h2, h3, h0⟩ + +theorem not_firstHitIn_two_cycle {X : Set α} {a b c : α} + (ha : a ∈ Ω.bar) (hc : c ∈ Ω.bar) (haX : a ∈ X) (hcX : c ∈ X) + (hca : c ≠ a) (hcb : c ≠ b) + (h₁ : Ω.FirstHitIn X a b) (h₂ : Ω.FirstHitIn X b a) : False := by + rcases h₁ with ⟨k₁, hk₁, rfl, _, hmin₁⟩ + rcases h₂ with ⟨k₂, hk₂, heq₂, _, hmin₂⟩ + have hself : Ω.FirstHitIn (X \ {(Ω.toFun^[k₁]) a}) a a := by + refine ⟨k₁ + k₂, by omega, ?_, ⟨haX, fun h => ?_⟩, fun j hj1 hjlt hj_in => ?_⟩ + · rw [add_comm, Function.iterate_add_apply, heq₂] + · rw [mem_singleton_iff] at h + exact Ω.not_firstHitIn_self ha hc hcX hca + ⟨k₁, hk₁, h.symm, haX, hmin₁⟩ + · rcases lt_trichotomy j k₁ with hlt | rfl | hgt + · exact hmin₁ j hj1 hlt hj_in.1 + · exact hj_in.2 rfl + · have hd1 : 1 ≤ j - k₁ := by omega + have hd2 : j - k₁ < k₂ := by omega + have heq_j : (Ω.toFun^[j - k₁]) ((Ω.toFun^[k₁]) a) = (Ω.toFun^[j]) a := by + rw [← Function.iterate_add_apply, Nat.sub_add_cancel (le_of_lt hgt)] + exact hmin₂ (j - k₁) hd1 hd2 (heq_j ▸ hj_in.1) + have hcb' : c ∈ X \ {(Ω.toFun^[k₁]) a} := ⟨hcX, by simpa using hcb⟩ + exact Ω.not_firstHitIn_self ha hc hcb' hca hself + +theorem isClockwise4_of_firstHitIn_two {v₁ a b c : α} + (hv₁ : v₁ ∈ Ω.bar) (ha : a ∈ Ω.bar) (hb : b ∈ Ω.bar) (hc : c ∈ Ω.bar) + (h1a : v₁ ≠ a) (h1b : v₁ ≠ b) (h1c : v₁ ≠ c) (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) + (hhit1 : Ω.FirstHitIn {v₁, a, b, c} v₁ a) + (hhit2 : Ω.FirstHitIn {v₁, a, b, c} a b) : + Ω.IsClockwiseSeq [v₁, a, b, c] := by + have hne : (Ω.bar ∩ {v₁, a, b, c}).Nonempty := ⟨v₁, hv₁, by simp⟩ + obtain ⟨yb, hyb⟩ := Ω.exists_firstHitIn hb hne + obtain ⟨yc, hyc⟩ := Ω.exists_firstHitIn hc hne + have hyc_eq : yc = v₁ := by + have hmem := hyc.mem_set + simp only [mem_insert_iff, mem_singleton_iff] at hmem + rcases hmem with h | h | h | h + · exact h + · rw [h] at hyc + exact (h1c (hhit1.inj_left hv₁ hc (by simp) (by simp) hyc)).elim + · rw [h] at hyc + exact (hac (hhit2.inj_left ha hc (by simp) (by simp) hyc)).elim + · rw [h] at hyc + exact (Ω.not_firstHitIn_self hc hv₁ (by simp) h1c hyc).elim + rw [hyc_eq] at hyc + have hyb_eq : yb = c := by + have hmem := hyb.mem_set + simp only [mem_insert_iff, mem_singleton_iff] at hmem + rcases hmem with h | h | h | h + · rw [h] at hyb + exact (hbc (hyb.inj_left hb hc (by simp) (by simp) hyc)).elim + · rw [h] at hyb + exact (h1b (hhit1.inj_left hv₁ hb (by simp) (by simp) hyb)).elim + · rw [h] at hyb + exact (Ω.not_firstHitIn_self hb hv₁ (by simp) h1b hyb).elim + · exact h + rw [hyb_eq] at hyb + exact isClockwise4_iff.mpr ⟨h1a, h1b, h1c, hab, hac, hbc, hv₁, ha, hb, hc, hhit1, hhit2, hyb, hyc⟩ + +/-- For any four distinct elements `w₁, w₂, w₃, w₄ ∈ Ω.bar`, one of the three pairings crosses: +`{w₁, w₄}` crosses `{w₂, w₃}`, or `{w₁, w₂}` crosses `{w₃, w₄}`, or `{w₁, w₃}` crosses `{w₂, w₄}`. +-/ +theorem crosses_of_four_distinct {w₁ w₂ w₃ w₄ : α} + (hw₁ : w₁ ∈ Ω.bar) (hw₂ : w₂ ∈ Ω.bar) (hw₃ : w₃ ∈ Ω.bar) (hw₄ : w₄ ∈ Ω.bar) + (h12 : w₁ ≠ w₂) (h13 : w₁ ≠ w₃) (h14 : w₁ ≠ w₄) + (h23 : w₂ ≠ w₃) (h24 : w₂ ≠ w₄) (h34 : w₃ ≠ w₄) : + Ω.Crosses w₁ w₄ w₂ w₃ ∨ Ω.Crosses w₁ w₂ w₃ w₄ ∨ Ω.Crosses w₁ w₃ w₂ w₄ := by + let X : Set α := {w₁, w₂, w₃, w₄} + have hne : (Ω.bar ∩ X).Nonempty := ⟨w₁, hw₁, by simp [X]⟩ + obtain ⟨y₁, hy₁⟩ := Ω.exists_firstHitIn hw₁ hne + have hy₁_ne : y₁ ≠ w₁ := fun h => + Ω.not_firstHitIn_self hw₁ hw₂ (by simp [X]) h12.symm (h ▸ hy₁) + have hy₁_mem := hy₁.mem_set + simp only [X, mem_insert_iff, mem_singleton_iff] at hy₁_mem + rcases hy₁_mem with h1 | h1 | h1 | h1 + · exact (hy₁_ne h1).elim + · rw [h1] at hy₁ + obtain ⟨y₂, hy₂⟩ := Ω.exists_firstHitIn hw₂ hne + have hy₂_ne2 : y₂ ≠ w₂ := fun h => + Ω.not_firstHitIn_self hw₂ hw₁ (by simp [X]) h12 (h ▸ hy₂) + have hy₂_ne1 : y₂ ≠ w₁ := fun h => + Ω.not_firstHitIn_two_cycle hw₁ hw₃ (by simp [X]) (by simp [X]) h13.symm h23.symm hy₁ (h ▸ hy₂) + have hy₂_mem := hy₂.mem_set + simp only [X, mem_insert_iff, mem_singleton_iff] at hy₂_mem + rcases hy₂_mem with h2 | h2 | h2 | h2 + · exact (hy₂_ne1 h2).elim + · exact (hy₂_ne2 h2).elim + · rw [h2] at hy₂ + right; right; left + exact isClockwise4_of_firstHitIn_two hw₁ hw₂ hw₃ hw₄ h12 h13 h14 h23 h24 h34 hy₁ hy₂ + · rw [h2] at hy₂ + left; left + have hset : ({w₁, w₂, w₄, w₃} : Set α) = X := by ext x; simp [X, or_comm] + exact isClockwise4_of_firstHitIn_two hw₁ hw₂ hw₄ hw₃ h12 h14 h13 h24 h23 h34.symm + (hset.symm ▸ hy₁) (hset.symm ▸ hy₂) + · rw [h1] at hy₁ + obtain ⟨y₃, hy₃⟩ := Ω.exists_firstHitIn hw₃ hne + have hy₃_ne3 : y₃ ≠ w₃ := fun h => + Ω.not_firstHitIn_self hw₃ hw₁ (by simp [X]) h13 (h ▸ hy₃) + have hy₃_ne1 : y₃ ≠ w₁ := fun h => + Ω.not_firstHitIn_two_cycle hw₁ hw₂ (by simp [X]) (by simp [X]) h12.symm h23 hy₁ (h ▸ hy₃) + have hy₃_mem := hy₃.mem_set + simp only [X, mem_insert_iff, mem_singleton_iff] at hy₃_mem + rcases hy₃_mem with h3 | h3 | h3 | h3 + · exact (hy₃_ne1 h3).elim + · rw [h3] at hy₃ + right; left; left + have hset : ({w₁, w₃, w₂, w₄} : Set α) = X := by ext x; simp [X, or_left_comm] + exact isClockwise4_of_firstHitIn_two hw₁ hw₃ hw₂ hw₄ h13 h12 h14 h23.symm h34 h24 + (hset.symm ▸ hy₁) (hset.symm ▸ hy₃) + · exact (hy₃_ne3 h3).elim + · rw [h3] at hy₃ + left; right + have hset : ({w₁, w₃, w₄, w₂} : Set α) = X := by ext x; simp [X, or_comm, or_left_comm] + exact isClockwise4_rotate (isClockwise4_of_firstHitIn_two hw₁ hw₃ hw₄ hw₂ + h13 h14 h12 h34 h23.symm h24.symm (hset.symm ▸ hy₁) (hset.symm ▸ hy₃)) + · rw [h1] at hy₁ + obtain ⟨y₄, hy₄⟩ := Ω.exists_firstHitIn hw₄ hne + have hy₄_ne4 : y₄ ≠ w₄ := fun h => + Ω.not_firstHitIn_self hw₄ hw₁ (by simp [X]) h14 (h ▸ hy₄) + have hy₄_ne1 : y₄ ≠ w₁ := fun h => + Ω.not_firstHitIn_two_cycle hw₁ hw₂ (by simp [X]) (by simp [X]) h12.symm h24 hy₁ (h ▸ hy₄) + have hy₄_mem := hy₄.mem_set + simp only [X, mem_insert_iff, mem_singleton_iff] at hy₄_mem + rcases hy₄_mem with h4 | h4 | h4 | h4 + · exact (hy₄_ne1 h4).elim + · rw [h4] at hy₄ + right; left; right + have hset : ({w₁, w₄, w₂, w₃} : Set α) = X := by ext x; simp [X, or_comm, or_left_comm] + exact isClockwise4_rotate (isClockwise4_of_firstHitIn_two hw₁ hw₄ hw₂ hw₃ + h14 h12 h13 h24.symm h34.symm h23 (hset.symm ▸ hy₁) (hset.symm ▸ hy₄)) + · rw [h4] at hy₄ + right; right; right + have hset : ({w₁, w₄, w₃, w₂} : Set α) = X := by ext x; simp [X, or_comm, or_left_comm] + exact isClockwise4_rotate (isClockwise4_of_firstHitIn_two hw₁ hw₄ hw₃ hw₂ + h14 h13 h12 h34.symm h24.symm h23.symm (hset.symm ▸ hy₁) (hset.symm ▸ hy₄)) + · exact (hy₄_ne4 h4).elim + +theorem Crosses.ne_ends {a₁ b₁ a₂ b₂ : α} (h : Ω.Crosses a₁ b₁ a₂ b₂) : + a₁ ≠ b₁ ∧ a₂ ≠ b₂ := by + rcases h with h1 | h2 + · obtain ⟨_, h1b, _, _, h2b, _⟩ := isClockwise4_iff.mp h1 + exact ⟨h1b, h2b⟩ + · obtain ⟨_, h2b, _, _, h1b, _⟩ := isClockwise4_iff.mp h2 + exact ⟨h1b.symm, h2b.symm⟩ + +end CyclicPerm + +/-! ## Proof of Lemma (2.3) (pages 44–45) -/ + +theorem IsGraphPathWithEnds.exists_walk_in {G P : Graph α β} {a b : α} {U : Set α} + (hP : IsGraphPathWithEnds G P a b) (hU : V(P) ⊆ U) : + ∃ W : GraphWalk G a b, {x | x ∈ W.support} ⊆ U := by + rcases hP with ⟨hPG, W, _, hVP, _⟩ + obtain ⟨W_G, hs, _⟩ := W.exists_transfer (fun _ _ _ _ hl => hl.mono hPG) + (fun _ hx => hPG.vertexSet_mono (W.mem_vertexSet_of_mem_support hx)) + refine ⟨W_G, fun x hx => hU ?_⟩ + rw [hVP, mem_ofPred_eq, ← hs] + exact hx + +theorem exists_walk_in_trans {G : Graph α β} {a b c : α} {U : Set α} + (h₁ : ∃ W : GraphWalk G a b, {x | x ∈ W.support} ⊆ U) + (h₂ : ∃ W : GraphWalk G b c, {x | x ∈ W.support} ⊆ U) : + ∃ W : GraphWalk G a c, {x | x ∈ W.support} ⊆ U := by + obtain ⟨W₁, hW₁⟩ := h₁ + obtain ⟨W₂, hW₂⟩ := h₂ + refine ⟨W₁.append W₂, fun x hx => ?_⟩ + rw [mem_ofPred_eq, GraphWalk.mem_support_append] at hx + exact hx.elim (fun h => hW₁ h) (fun h => hW₂ h) + +theorem Society.exists_isCross_of_disjoint_walks (S : Society α β) + {a₁ b₁ a₂ b₂ : α} {U₁ U₂ : Set α} + (ha₁ : a₁ ∈ S.Ω.bar) (hb₁ : b₁ ∈ S.Ω.bar) (ha₂ : a₂ ∈ S.Ω.bar) (hb₂ : b₂ ∈ S.Ω.bar) + (hcross : S.Ω.Crosses a₁ b₁ a₂ b₂) + (hdisj : Disjoint U₁ U₂) + (hW₁ : ∃ W : GraphWalk S.G a₁ b₁, {x | x ∈ W.support} ⊆ U₁) + (hW₂ : ∃ W : GraphWalk S.G a₂ b₂, {x | x ∈ W.support} ⊆ U₂) : + ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂ := by + obtain ⟨hab₁, hab₂⟩ := hcross.ne_ends + obtain ⟨W₁, hU₁⟩ := hW₁ + obtain ⟨W₂, hU₂⟩ := hW₂ + obtain ⟨Q₁, hQ₁, hV₁, _⟩ := exists_isGraphPathWithEnds_of_walk W₁ + obtain ⟨Q₂, hQ₂, hV₂, _⟩ := exists_isGraphPathWithEnds_of_walk W₂ + exact ⟨Q₁, Q₂, hdisj.mono (hV₁.trans hU₁) (hV₂.trans hU₂), + a₁, b₁, a₂, b₂, ⟨hQ₁, hab₁, ha₁, hb₁⟩, ⟨hQ₂, hab₂, ha₂, hb₂⟩, hcross⟩ + +/-- Helper for Case B and Case C of the tripod-with-4-paths cross construction: +given `P₁_v` (from `s₁` to `v` in `V(P₁) \ {u}`), `L_u` (from `u` to `s₄` in `V(P₁) \ {v}`), +with `Disjoint V(P₁_v) V(L_u)`, and `P_A` (from `u` to `v` with internal vertex `s_A`), +`P_B` (from `u` to `v` with internal vertex `s_B`), and disjoint `X → ΩBar` paths `R₁, R_A, R_B, R₄` +from `s₁, s_A, s_B, s₄` to `w₁, w_A, w_B, w₄`, there exist disjoint walks in `S.G` between +`(w₁, w_A)` and `(w_B, w₄)`. -/ +private theorem exists_disjoint_walks_pairBC {G P₁ P_A P_B P₁_v L_u R₁ R_A R_B R₄ : Graph α β} + {X Y : Set α} {u v s₁ s_A s_B s₄ w₁ w_A w_B w₄ : α} + (hP₁_v_le : V(P₁_v) ⊆ V(P₁) \ {u}) + (hL_u_le : V(L_u) ⊆ V(P₁) \ {v}) + (hdisj_P₁ : Disjoint V(P₁_v) V(L_u)) + (hP₁_v : IsGraphPathWithEnds G P₁_v s₁ v) + (hL_u : IsGraphPathWithEnds G L_u u s₄) + (hP_A : IsGraphPathWithEnds G P_A u v) + (hP_B : IsGraphPathWithEnds G P_B u v) + (hinter_1A : V(P₁) ∩ V(P_A) = {u, v}) + (hinter_1B : V(P₁) ∩ V(P_B) = {u, v}) + (hinter_AB : V(P_A) ∩ V(P_B) = {u, v}) + (hs_A : s_A ∈ V(P_A) \ {u, v}) + (hs_B : s_B ∈ V(P_B) \ {u, v}) + (hX_sub : V(P₁) ∪ V(P_A) ∪ V(P_B) ⊆ X) + (hs₁_X : s₁ ∈ V(P₁) \ {u, v}) + (hs₄_X : s₄ ∈ V(L_u)) + (hR₁ : IsFromToPathWithEnds G R₁ X Y s₁ w₁) + (hR_A : IsFromToPathWithEnds G R_A X Y s_A w_A) + (hR_B : IsFromToPathWithEnds G R_B X Y s_B w_B) + (hR₄ : IsFromToPathWithEnds G R₄ X Y s₄ w₄) + (hdisj_1B : Disjoint V(R₁) V(R_B)) + (hdisj_14 : Disjoint V(R₁) V(R₄)) + (hdisj_AB : Disjoint V(R_A) V(R_B)) + (hdisj_A4 : Disjoint V(R_A) V(R₄)) : + ∃ U₁ U₂ : Set α, Disjoint U₁ U₂ ∧ + (∃ W₁ : GraphWalk G w₁ w_A, {x | x ∈ W₁.support} ⊆ U₁) ∧ + (∃ W₂ : GraphWalk G w_B w₄, {x | x ∈ W₂.support} ⊆ U₂) := by + obtain ⟨PA_u, PA_v, hPA_u_le, hPA_v_le, hPA_u, hPA_v, _, hinter_PA, _⟩ := + hP_A.exists_split_at hs_A.1 + obtain ⟨PB_u, PB_v, hPB_u_le, hPB_v_le, hPB_u, hPB_v, _, hinter_PB, _⟩ := + hP_B.exists_split_at hs_B.1 + have hu_not_PAv : u ∉ V(PA_v) := by + intro hu_in + have : u ∈ V(PA_u) ∩ V(PA_v) := ⟨hPA_u.left_mem, hu_in⟩ + rw [hinter_PA, mem_singleton_iff] at this + exact hs_A.2 (by simp [this]) + have hv_not_PBu : v ∉ V(PB_u) := by + intro hv_in + have : v ∈ V(PB_u) ∩ V(PB_v) := ⟨hv_in, hPB_v.right_mem⟩ + rw [hinter_PB, mem_singleton_iff] at this + exact hs_B.2 (by simp [this]) + let U₁ : Set α := V(R₁) ∪ V(P₁_v) ∪ V(PA_v) ∪ V(R_A) + let U₂ : Set α := V(R_B) ∪ V(PB_u) ∪ V(L_u) ∪ V(R₄) + have hwalk₁ : ∃ W₁ : GraphWalk G w₁ w_A, {x | x ∈ W₁.support} ⊆ U₁ := + exists_walk_in_trans + (exists_walk_in_trans + (hR₁.1.symm.exists_walk_in (subset_union_left.trans (subset_union_left.trans + subset_union_left))) + (hP₁_v.exists_walk_in (subset_union_right.trans (subset_union_left.trans + subset_union_left)))) + (exists_walk_in_trans + ((hPA_v.mono hP_A.le).symm.exists_walk_in (subset_union_right.trans subset_union_left)) + (hR_A.1.exists_walk_in subset_union_right)) + have hwalk₂ : ∃ W₂ : GraphWalk G w_B w₄, {x | x ∈ W₂.support} ⊆ U₂ := + exists_walk_in_trans + (exists_walk_in_trans + (hR_B.1.symm.exists_walk_in (subset_union_left.trans (subset_union_left.trans + subset_union_left))) + ((hPB_u.mono hP_B.le).symm.exists_walk_in (subset_union_right.trans + (subset_union_left.trans subset_union_left)))) + (exists_walk_in_trans + (hL_u.exists_walk_in (subset_union_right.trans subset_union_left)) + (hR₄.1.exists_walk_in subset_union_right)) + refine ⟨U₁, U₂, disjoint_left.mpr fun z hz₁ hz₂ => ?_, hwalk₁, hwalk₂⟩ + -- Every vertex `z ∈ U₁` is either in `V(R₁) \ {s₁}`, `V(R_A) \ {s_A}`, or `V(P₁_v) ∪ V(PA_v)`. + have hz₁_cases : z ∈ V(R₁) ∧ z ∉ X ∨ z ∈ V(R_A) ∧ z ∉ X ∨ z ∈ V(P₁_v) ∨ z ∈ V(PA_v) := by + rcases hz₁ with ((hzR₁ | hzP₁v) | hzPAv) | hzRA + · by_cases hzX : z ∈ X + · have hzs₁ : z = s₁ := hR₁.eq_left_of_mem_X hzR₁ hzX + exact Or.inr (Or.inr (Or.inl (hzs₁ ▸ hP₁_v.left_mem))) + · exact Or.inl ⟨hzR₁, hzX⟩ + · exact Or.inr (Or.inr (Or.inl hzP₁v)) + · exact Or.inr (Or.inr (Or.inr hzPAv)) + · by_cases hzX : z ∈ X + · have hzsA : z = s_A := hR_A.eq_left_of_mem_X hzRA hzX + exact Or.inr (Or.inr (Or.inr (hzsA ▸ hPA_v.left_mem))) + · exact Or.inr (Or.inl ⟨hzRA, hzX⟩) + have hz₂_cases : z ∈ V(R_B) ∧ z ∉ X ∨ z ∈ V(R₄) ∧ z ∉ X ∨ z ∈ V(PB_u) ∨ z ∈ V(L_u) := by + rcases hz₂ with ((hzRB | hzPBu) | hzLu) | hzR₄ + · by_cases hzX : z ∈ X + · have hzsB : z = s_B := hR_B.eq_left_of_mem_X hzRB hzX + exact Or.inr (Or.inr (Or.inl (hzsB ▸ hPB_u.right_mem))) + · exact Or.inl ⟨hzRB, hzX⟩ + · exact Or.inr (Or.inr (Or.inl hzPBu)) + · exact Or.inr (Or.inr (Or.inr hzLu)) + · by_cases hzX : z ∈ X + · have hzs₄ : z = s₄ := hR₄.eq_left_of_mem_X hzR₄ hzX + exact Or.inr (Or.inr (Or.inr (hzs₄ ▸ hs₄_X))) + · exact Or.inr (Or.inl ⟨hzR₄, hzX⟩) + rcases hz₁_cases with ⟨hzR₁, hz_not_X⟩ | ⟨hzRA, hz_not_X⟩ | hzP₁v | hzPAv <;> + rcases hz₂_cases with ⟨hzRB, hz_not_X₂⟩ | ⟨hzR₄, hz_not_X₂⟩ | hzPBu | hzLu + · exact disjoint_left.mp hdisj_1B hzR₁ hzRB + · exact disjoint_left.mp hdisj_14 hzR₁ hzR₄ + · exact hz_not_X (hX_sub (Or.inr (hPB_u_le.vertexSet_mono hzPBu))) + · exact hz_not_X (hX_sub (Or.inl (Or.inl (hL_u_le hzLu).1))) + · exact disjoint_left.mp hdisj_AB hzRA hzRB + · exact disjoint_left.mp hdisj_A4 hzRA hzR₄ + · exact hz_not_X (hX_sub (Or.inr (hPB_u_le.vertexSet_mono hzPBu))) + · exact hz_not_X (hX_sub (Or.inl (Or.inl (hL_u_le hzLu).1))) + · exact hz_not_X₂ (hX_sub (Or.inl (Or.inl (hP₁_v_le hzP₁v).1))) + · exact hz_not_X₂ (hX_sub (Or.inl (Or.inl (hP₁_v_le hzP₁v).1))) + · have hz_inter : z ∈ V(P₁) ∩ V(P_B) := ⟨(hP₁_v_le hzP₁v).1, hPB_u_le.vertexSet_mono hzPBu⟩ + rw [hinter_1B, mem_insert_iff, mem_singleton_iff] at hz_inter + rcases hz_inter with rfl | rfl + · exact (hP₁_v_le hzP₁v).2 (by simp) + · exact hv_not_PBu hzPBu + · exact disjoint_left.mp hdisj_P₁ hzP₁v hzLu + · exact hz_not_X₂ (hX_sub (Or.inl (Or.inr (hPA_v_le.vertexSet_mono hzPAv)))) + · exact hz_not_X₂ (hX_sub (Or.inl (Or.inr (hPA_v_le.vertexSet_mono hzPAv)))) + · have hz_inter : z ∈ V(P_A) ∩ V(P_B) := + ⟨hPA_v_le.vertexSet_mono hzPAv, hPB_u_le.vertexSet_mono hzPBu⟩ + rw [hinter_AB, mem_insert_iff, mem_singleton_iff] at hz_inter + rcases hz_inter with rfl | rfl + · exact hu_not_PAv hzPAv + · exact hv_not_PBu hzPBu + · have hz_inter : z ∈ V(P₁) ∩ V(P_A) := ⟨(hL_u_le hzLu).1, hPA_v_le.vertexSet_mono hzPAv⟩ + rw [hinter_1A, mem_insert_iff, mem_singleton_iff] at hz_inter + rcases hz_inter with rfl | rfl + · exact hu_not_PAv hzPAv + · exact (hL_u_le hzLu).2 (by simp) + +/-- Helper for Case A of the tripod-with-4-paths cross construction: +given `L_mid` (from `s₄` to `s₁` in `V(P₁) \ {v}`), `P₂` (from `u` to `v` with internal vertex +`s₂`), `P₃` (from `u` to `v` with internal vertex `s₃`), and disjoint `X → ΩBar` paths `R₁, R₂, R₃, +R₄` +from `s₁, s₂, s₃, s₄` to `w₁, w₂, w₃, w₄`, there exist disjoint walks in `G` between +`(w₁, w₄)` and `(w₂, w₃)`. -/ +private theorem exists_disjoint_walks_pairA {G P₁ P₂ P₃ L_mid R₁ R₂ R₃ R₄ : Graph α β} + {X Y : Set α} {u v s₁ s₂ s₃ s₄ w₁ w₂ w₃ w₄ : α} + (hL_mid_le : V(L_mid) ⊆ V(P₁) \ {v}) + (hL_mid : IsGraphPathWithEnds G L_mid s₄ s₁) + (hP₂ : IsGraphPathWithEnds G P₂ u v) + (hP₃ : IsGraphPathWithEnds G P₃ u v) + (hinter_12 : V(P₁) ∩ V(P₂) = {u, v}) + (hinter_13 : V(P₁) ∩ V(P₃) = {u, v}) + (hs₂ : s₂ ∈ V(P₂) \ {u, v}) + (hs₃ : s₃ ∈ V(P₃) \ {u, v}) + (hX_sub : V(P₁) ∪ V(P₂) ∪ V(P₃) ⊆ X) + (hR₁ : IsFromToPathWithEnds G R₁ X Y s₁ w₁) + (hR₂ : IsFromToPathWithEnds G R₂ X Y s₂ w₂) + (hR₃ : IsFromToPathWithEnds G R₃ X Y s₃ w₃) + (hR₄ : IsFromToPathWithEnds G R₄ X Y s₄ w₄) + (hdisj_12 : Disjoint V(R₁) V(R₂)) + (hdisj_13 : Disjoint V(R₁) V(R₃)) + (hdisj_24 : Disjoint V(R₂) V(R₄)) + (hdisj_34 : Disjoint V(R₃) V(R₄)) : + ∃ U₁ U₂ : Set α, Disjoint U₁ U₂ ∧ + (∃ W₁ : GraphWalk G w₁ w₄, {x | x ∈ W₁.support} ⊆ U₁) ∧ + (∃ W₂ : GraphWalk G w₂ w₃, {x | x ∈ W₂.support} ⊆ U₂) := by + obtain ⟨P₂_u, P₂_v, _, hP₂_v_le, hP₂_u, hP₂_v, _, hinter_P₂, _⟩ := + hP₂.exists_split_at hs₂.1 + obtain ⟨P₃_u, P₃_v, _, hP₃_v_le, hP₃_u, hP₃_v, _, hinter_P₃, _⟩ := + hP₃.exists_split_at hs₃.1 + have hu_not_P₂v : u ∉ V(P₂_v) := by + intro hu_in + have : u ∈ V(P₂_u) ∩ V(P₂_v) := ⟨hP₂_u.left_mem, hu_in⟩ + rw [hinter_P₂, mem_singleton_iff] at this + exact hs₂.2 (by simp [this]) + have hu_not_P₃v : u ∉ V(P₃_v) := by + intro hu_in + have : u ∈ V(P₃_u) ∩ V(P₃_v) := ⟨hP₃_u.left_mem, hu_in⟩ + rw [hinter_P₃, mem_singleton_iff] at this + exact hs₃.2 (by simp [this]) + let U₁ : Set α := V(R₁) ∪ V(L_mid) ∪ V(R₄) + let U₂ : Set α := V(R₂) ∪ V(P₂_v) ∪ V(P₃_v) ∪ V(R₃) + have hwalk₁ : ∃ W₁ : GraphWalk G w₁ w₄, {x | x ∈ W₁.support} ⊆ U₁ := + exists_walk_in_trans + (exists_walk_in_trans + (hR₁.1.symm.exists_walk_in (subset_union_left.trans subset_union_left)) + (hL_mid.symm.exists_walk_in (subset_union_right.trans subset_union_left))) + (hR₄.1.exists_walk_in subset_union_right) + have hwalk₂ : ∃ W₂ : GraphWalk G w₂ w₃, {x | x ∈ W₂.support} ⊆ U₂ := + exists_walk_in_trans + (exists_walk_in_trans + (hR₂.1.symm.exists_walk_in (subset_union_left.trans (subset_union_left.trans + subset_union_left))) + ((hP₂_v.mono hP₂.le).exists_walk_in (subset_union_right.trans + (subset_union_left.trans subset_union_left)))) + (exists_walk_in_trans + ((hP₃_v.mono hP₃.le).symm.exists_walk_in (subset_union_right.trans subset_union_left)) + (hR₃.1.exists_walk_in subset_union_right)) + refine ⟨U₁, U₂, disjoint_left.mpr fun z hz₁ hz₂ => ?_, hwalk₁, hwalk₂⟩ + have hz₁_cases : z ∈ V(R₁) ∧ z ∉ X ∨ z ∈ V(R₄) ∧ z ∉ X ∨ z ∈ V(L_mid) := by + rcases hz₁ with (hzR₁ | hzL) | hzR₄ + · by_cases hzX : z ∈ X + · have hzs₁ : z = s₁ := hR₁.eq_left_of_mem_X hzR₁ hzX + exact Or.inr (Or.inr (hzs₁ ▸ hL_mid.right_mem)) + · exact Or.inl ⟨hzR₁, hzX⟩ + · exact Or.inr (Or.inr hzL) + · by_cases hzX : z ∈ X + · have hzs₄ : z = s₄ := hR₄.eq_left_of_mem_X hzR₄ hzX + exact Or.inr (Or.inr (hzs₄ ▸ hL_mid.left_mem)) + · exact Or.inr (Or.inl ⟨hzR₄, hzX⟩) + have hz₂_cases : z ∈ V(R₂) ∧ z ∉ X ∨ z ∈ V(R₃) ∧ z ∉ X ∨ z ∈ V(P₂_v) ∨ z ∈ V(P₃_v) := by + rcases hz₂ with ((hzR₂ | hzP₂v) | hzP₃v) | hzR₃ + · by_cases hzX : z ∈ X + · have hzs₂ : z = s₂ := hR₂.eq_left_of_mem_X hzR₂ hzX + exact Or.inr (Or.inr (Or.inl (hzs₂ ▸ hP₂_v.left_mem))) + · exact Or.inl ⟨hzR₂, hzX⟩ + · exact Or.inr (Or.inr (Or.inl hzP₂v)) + · exact Or.inr (Or.inr (Or.inr hzP₃v)) + · by_cases hzX : z ∈ X + · have hzs₃ : z = s₃ := hR₃.eq_left_of_mem_X hzR₃ hzX + exact Or.inr (Or.inr (Or.inr (hzs₃ ▸ hP₃_v.left_mem))) + · exact Or.inr (Or.inl ⟨hzR₃, hzX⟩) + rcases hz₁_cases with ⟨hzR₁, hz_not_X⟩ | ⟨hzR₄, hz_not_X⟩ | hzL <;> + rcases hz₂_cases with ⟨hzR₂, hz_not_X₂⟩ | ⟨hzR₃, hz_not_X₂⟩ | hzP₂v | hzP₃v + · exact disjoint_left.mp hdisj_12 hzR₁ hzR₂ + · exact disjoint_left.mp hdisj_13 hzR₁ hzR₃ + · exact hz_not_X (hX_sub (Or.inl (Or.inr (hP₂_v_le.vertexSet_mono hzP₂v)))) + · exact hz_not_X (hX_sub (Or.inr (hP₃_v_le.vertexSet_mono hzP₃v))) + · exact disjoint_left.mp hdisj_24.symm hzR₄ hzR₂ + · exact disjoint_left.mp hdisj_34.symm hzR₄ hzR₃ + · exact hz_not_X (hX_sub (Or.inl (Or.inr (hP₂_v_le.vertexSet_mono hzP₂v)))) + · exact hz_not_X (hX_sub (Or.inr (hP₃_v_le.vertexSet_mono hzP₃v))) + · exact hz_not_X₂ (hX_sub (Or.inl (Or.inl (hL_mid_le hzL).1))) + · exact hz_not_X₂ (hX_sub (Or.inl (Or.inl (hL_mid_le hzL).1))) + · have hz_inter : z ∈ V(P₁) ∩ V(P₂) := ⟨(hL_mid_le hzL).1, hP₂_v_le.vertexSet_mono hzP₂v⟩ + rw [hinter_12, mem_insert_iff, mem_singleton_iff] at hz_inter + rcases hz_inter with rfl | rfl + · exact hu_not_P₂v hzP₂v + · exact (hL_mid_le hzL).2 (by simp) + · have hz_inter : z ∈ V(P₁) ∩ V(P₃) := ⟨(hL_mid_le hzL).1, hP₃_v_le.vertexSet_mono hzP₃v⟩ + rw [hinter_13, mem_insert_iff, mem_singleton_iff] at hz_inter + rcases hz_inter with rfl | rfl + · exact hu_not_P₃v hzP₃v + · exact (hL_mid_le hzL).2 (by simp) + +/-- Cross construction when `s₄ ∈ V(P₁_u) \ {s₁}` along the split `(P₁_u, P₁_v)` of `P₁` at `s₁`. -/ +private theorem exists_cross_of_four_fromTo_in_prefix (S : Society α β) + {P₁ P₂ P₃ P₁_u P₁_v R₁ R₂ R₃ R₄ : Graph α β} {X : Set α} + {u v s₁ s₂ s₃ s₄ w₁ w₂ w₃ w₄ : α} + (hP₁ : IsGraphPathWithEnds S.G P₁ u v) + (hP₂ : IsGraphPathWithEnds S.G P₂ u v) + (hP₃ : IsGraphPathWithEnds S.G P₃ u v) + (hinter_12 : V(P₁) ∩ V(P₂) = {u, v}) + (hinter_13 : V(P₁) ∩ V(P₃) = {u, v}) + (hinter_23 : V(P₂) ∩ V(P₃) = {u, v}) + (hs₁ : s₁ ∈ V(P₁) \ {u, v}) + (hs₂ : s₂ ∈ V(P₂) \ {u, v}) + (hs₃ : s₃ ∈ V(P₃) \ {u, v}) + (hX_sub : V(P₁) ∪ V(P₂) ∪ V(P₃) ⊆ X) + (hP₁_u_le : P₁_u ≤ P₁) (hP₁_v_le : P₁_v ≤ P₁) + (hP₁_u : IsGraphPathWithEnds P₁ P₁_u u s₁) + (hP₁_v : IsGraphPathWithEnds P₁ P₁_v s₁ v) + (hinter_P₁ : V(P₁_u) ∩ V(P₁_v) = {s₁}) + (hs₄ : s₄ ∈ V(P₁_u) \ {s₁}) + (hR₁ : IsFromToPathWithEnds S.G R₁ X S.Ω.bar s₁ w₁) + (hR₂ : IsFromToPathWithEnds S.G R₂ X S.Ω.bar s₂ w₂) + (hR₃ : IsFromToPathWithEnds S.G R₃ X S.Ω.bar s₃ w₃) + (hR₄ : IsFromToPathWithEnds S.G R₄ X S.Ω.bar s₄ w₄) + (hdisj_12 : Disjoint V(R₁) V(R₂)) + (hdisj_13 : Disjoint V(R₁) V(R₃)) + (hdisj_14 : Disjoint V(R₁) V(R₄)) + (hdisj_23 : Disjoint V(R₂) V(R₃)) + (hdisj_24 : Disjoint V(R₂) V(R₄)) + (hdisj_34 : Disjoint V(R₃) V(R₄)) : + ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂ := by + obtain ⟨L_u, L_mid, hLu_le, hLmid_le, hLu, hLmid, _, hinter_L, _⟩ := + hP₁_u.exists_split_at hs₄.1 + have hv_not_P₁u : v ∉ V(P₁_u) := by + intro hv_in + have : v ∈ V(P₁_u) ∩ V(P₁_v) := ⟨hv_in, hP₁_v.right_mem⟩ + rw [hinter_P₁, mem_singleton_iff] at this + exact hs₁.2 (by simp [this]) + have hu_not_P₁v : u ∉ V(P₁_v) := by + intro hu_in + have : u ∈ V(P₁_u) ∩ V(P₁_v) := ⟨hP₁_u.left_mem, hu_in⟩ + rw [hinter_P₁, mem_singleton_iff] at this + exact hs₁.2 (by simp [this]) + have hs₁_not_Lu : s₁ ∉ V(L_u) := by + intro hs₁_in + have : s₁ ∈ V(L_u) ∩ V(L_mid) := ⟨hs₁_in, hLmid.right_mem⟩ + rw [hinter_L, mem_singleton_iff] at this + exact hs₄.2 (by simp [this.symm]) + have hdisj_P₁v_Lu : Disjoint V(P₁_v) V(L_u) := by + rw [disjoint_left] + intro z hzv hzu + have : z ∈ V(P₁_u) ∩ V(P₁_v) := ⟨hLu_le.vertexSet_mono hzu, hzv⟩ + rw [hinter_P₁, mem_singleton_iff] at this + exact hs₁_not_Lu (this ▸ hzu) + have hP₁v_sub : V(P₁_v) ⊆ V(P₁) \ {u} := + fun z hz => ⟨hP₁_v_le.vertexSet_mono hz, fun h => hu_not_P₁v (mem_singleton_iff.mp h ▸ hz)⟩ + have hLu_sub : V(L_u) ⊆ V(P₁) \ {v} := + fun z hz => ⟨(hLu_le.trans hP₁_u_le).vertexSet_mono hz, + fun h => hv_not_P₁u (mem_singleton_iff.mp h ▸ hLu_le.vertexSet_mono hz)⟩ + have hLmid_sub : V(L_mid) ⊆ V(P₁) \ {v} := + fun z hz => ⟨(hLmid_le.trans hP₁_u_le).vertexSet_mono hz, + fun h => hv_not_P₁u (mem_singleton_iff.mp h ▸ hLmid_le.vertexSet_mono hz)⟩ + have hw1 : w₁ ∈ S.Ω.bar := hR₁.right_mem_Y + have hw2 : w₂ ∈ S.Ω.bar := hR₂.right_mem_Y + have hw3 : w₃ ∈ S.Ω.bar := hR₃.right_mem_Y + have hw4 : w₄ ∈ S.Ω.bar := hR₄.right_mem_Y + have hw12 : w₁ ≠ w₂ := fun h => disjoint_left.mp hdisj_12 hR₁.1.right_mem (h ▸ hR₂.1.right_mem) + have hw13 : w₁ ≠ w₃ := fun h => disjoint_left.mp hdisj_13 hR₁.1.right_mem (h ▸ hR₃.1.right_mem) + have hw14 : w₁ ≠ w₄ := fun h => disjoint_left.mp hdisj_14 hR₁.1.right_mem (h ▸ hR₄.1.right_mem) + have hw23 : w₂ ≠ w₃ := fun h => disjoint_left.mp hdisj_23 hR₂.1.right_mem (h ▸ hR₃.1.right_mem) + have hw24 : w₂ ≠ w₄ := fun h => disjoint_left.mp hdisj_24 hR₂.1.right_mem (h ▸ hR₄.1.right_mem) + have hw34 : w₃ ≠ w₄ := fun h => disjoint_left.mp hdisj_34 hR₃.1.right_mem (h ▸ hR₄.1.right_mem) + rcases S.Ω.crosses_of_four_distinct hw1 hw2 hw3 hw4 hw12 hw13 hw14 hw23 hw24 hw34 with + hcA | hcB | hcC + · obtain ⟨U₁, U₂, hdisjU, hW₁, hW₂⟩ := + exists_disjoint_walks_pairA hLmid_sub (hLmid.mono (hP₁_u_le.trans hP₁.le)) hP₂ hP₃ + hinter_12 hinter_13 hs₂ hs₃ hX_sub hR₁ hR₂ hR₃ hR₄ + hdisj_12 hdisj_13 hdisj_24 hdisj_34 + exact S.exists_isCross_of_disjoint_walks hw1 hw4 hw2 hw3 hcA hdisjU hW₁ hW₂ + · obtain ⟨U₁, U₂, hdisjU, hW₁, hW₂⟩ := + exists_disjoint_walks_pairBC hP₁v_sub hLu_sub hdisj_P₁v_Lu + (hP₁_v.mono hP₁.le) (hLu.mono (hP₁_u_le.trans hP₁.le)) hP₂ hP₃ + hinter_12 hinter_13 hinter_23 hs₂ hs₃ hX_sub hs₁ hLu.right_mem + hR₁ hR₂ hR₃ hR₄ hdisj_13 hdisj_14 hdisj_23 hdisj_24 + exact S.exists_isCross_of_disjoint_walks hw1 hw2 hw3 hw4 hcB hdisjU hW₁ hW₂ + · have hX_sub' : V(P₁) ∪ V(P₃) ∪ V(P₂) ⊆ X := by + intro z hz + rcases hz with (hz1 | hz3) | hz2 + · exact hX_sub (Or.inl (Or.inl hz1)) + · exact hX_sub (Or.inr hz3) + · exact hX_sub (Or.inl (Or.inr hz2)) + obtain ⟨U₁, U₂, hdisjU, hW₁, hW₂⟩ := + exists_disjoint_walks_pairBC hP₁v_sub hLu_sub hdisj_P₁v_Lu + (hP₁_v.mono hP₁.le) (hLu.mono (hP₁_u_le.trans hP₁.le)) hP₃ hP₂ + hinter_13 hinter_12 (inter_comm V(P₃) V(P₂) ▸ hinter_23) hs₃ hs₂ hX_sub' hs₁ hLu.right_mem + hR₁ hR₃ hR₂ hR₄ hdisj_12 hdisj_14 hdisj_23.symm hdisj_34 + exact S.exists_isCross_of_disjoint_walks hw1 hw3 hw2 hw4 hcC hdisjU hW₁ hW₂ + +/-- Cross construction when `s₄ ∈ V(P₁) \ {s₁}`. -/ +private theorem exists_cross_of_four_fromTo_in_P₁ (S : Society α β) + {P₁ P₂ P₃ R₁ R₂ R₃ R₄ : Graph α β} {X : Set α} + {u v s₁ s₂ s₃ s₄ w₁ w₂ w₃ w₄ : α} + (hP₁ : IsGraphPathWithEnds S.G P₁ u v) + (hP₂ : IsGraphPathWithEnds S.G P₂ u v) + (hP₃ : IsGraphPathWithEnds S.G P₃ u v) + (hinter_12 : V(P₁) ∩ V(P₂) = {u, v}) + (hinter_13 : V(P₁) ∩ V(P₃) = {u, v}) + (hinter_23 : V(P₂) ∩ V(P₃) = {u, v}) + (hs₁ : s₁ ∈ V(P₁) \ {u, v}) + (hs₂ : s₂ ∈ V(P₂) \ {u, v}) + (hs₃ : s₃ ∈ V(P₃) \ {u, v}) + (hX_sub : V(P₁) ∪ V(P₂) ∪ V(P₃) ⊆ X) + (hs₄ : s₄ ∈ V(P₁) \ {s₁}) + (hR₁ : IsFromToPathWithEnds S.G R₁ X S.Ω.bar s₁ w₁) + (hR₂ : IsFromToPathWithEnds S.G R₂ X S.Ω.bar s₂ w₂) + (hR₃ : IsFromToPathWithEnds S.G R₃ X S.Ω.bar s₃ w₃) + (hR₄ : IsFromToPathWithEnds S.G R₄ X S.Ω.bar s₄ w₄) + (hdisj_12 : Disjoint V(R₁) V(R₂)) + (hdisj_13 : Disjoint V(R₁) V(R₃)) + (hdisj_14 : Disjoint V(R₁) V(R₄)) + (hdisj_23 : Disjoint V(R₂) V(R₃)) + (hdisj_24 : Disjoint V(R₂) V(R₄)) + (hdisj_34 : Disjoint V(R₃) V(R₄)) : + ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂ := by + obtain ⟨P₁_u, P₁_v, hP₁_u_le, hP₁_v_le, hP₁_u, hP₁_v, hP₁_union, hinter_P₁, _⟩ := + hP₁.exists_split_at hs₁.1 + have hs₄_union : s₄ ∈ V(P₁_u) ∪ V(P₁_v) := by + rw [← vertexSet_subgraphUnion P₁ P₁_u P₁_v, hP₁_union] + exact hs₄.1 + rcases hs₄_union with hs₄_u | hs₄_v + · exact exists_cross_of_four_fromTo_in_prefix S hP₁ hP₂ hP₃ hinter_12 hinter_13 hinter_23 + hs₁ hs₂ hs₃ hX_sub hP₁_u_le hP₁_v_le hP₁_u hP₁_v hinter_P₁ ⟨hs₄_u, hs₄.2⟩ + hR₁ hR₂ hR₃ hR₄ hdisj_12 hdisj_13 hdisj_14 hdisj_23 hdisj_24 hdisj_34 + · -- Swap `u` and `v` using `.symm`. + have hvu : ({v, u} : Set α) = {u, v} := pair_comm v u + exact exists_cross_of_four_fromTo_in_prefix S hP₁.symm hP₂.symm hP₃.symm + (hvu ▸ hinter_12) (hvu ▸ hinter_13) (hvu ▸ hinter_23) + (hvu ▸ hs₁) (hvu ▸ hs₂) (hvu ▸ hs₃) hX_sub + hP₁_v_le hP₁_u_le hP₁_v.symm hP₁_u.symm + (inter_comm V(P₁_v) V(P₁_u) ▸ hinter_P₁) ⟨hs₄_v, hs₄.2⟩ + hR₁ hR₂ hR₃ hR₄ hdisj_12 hdisj_13 hdisj_14 hdisj_23 hdisj_24 hdisj_34 + +/-- **Graph Minors IX, (2.3)** (pages 44–45): +"Suppose that $\{P_1, P_2, P_3\}$ is a tripod in $(G, \Omega)$. Then either $(G, \Omega)$ ... has a +cross, or there is an internal 3-separation $(G_1, G_2)$ of $(G, \Omega)$ with +$P_1 \cup P_2 \cup P_3 \subseteq G_1$." -/ +theorem theorem_2_3_proof (S : Society α β) {P₁ P₂ P₃ : Graph α β} + (htripod : S.IsTripod P₁ P₂ P₃) : + (∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) ∨ + (∃ G₁ G₂ : Graph α β, S.IsInternalKSeparation 3 G₁ G₂ ∧ + subgraphUnion S.G (subgraphUnion S.G P₁ P₂) P₃ ≤ G₁) := by + classical + have : Finite V(S.G) := S.finite_V.to_subtype + rcases htripod with ⟨u, v, huv, hP₁, hP₂, hP₃, hinter_12, hinter_13, hinter_23, + s₁, hs₁, s₂, hs₂, s₃, hs₃, t₁, _, t₂, _, t₃, _, hred₃⟩ + let X : Set α := V(P₁) ∪ V(P₂) ∪ V(P₃) + have hX_sub_G : X ⊆ V(S.G) := + union_subset (union_subset hP₁.le.vertexSet_mono hP₂.le.vertexSet_mono) hP₃.le.vertexSet_mono + have hs12 : s₁ ≠ s₂ := by + intro h + have : s₁ ∈ V(P₁) ∩ V(P₂) := ⟨hs₁.1, h ▸ hs₂.1⟩ + rw [hinter_12] at this + exact hs₁.2 this + have hs13 : s₁ ≠ s₃ := by + intro h + have : s₁ ∈ V(P₁) ∩ V(P₃) := ⟨hs₁.1, h ▸ hs₃.1⟩ + rw [hinter_13] at this + exact hs₁.2 this + have hs23 : s₂ ≠ s₃ := by + intro h + have : s₂ ∈ V(P₂) ∩ V(P₃) := ⟨hs₂.1, h ▸ hs₃.1⟩ + rw [hinter_23] at this + exact hs₂.2 this + have hcard_s : ({s₁, s₂, s₃} : Set α).ncard = 3 := by + rw [ncard_insert_of_notMem (by simp [hs12, hs13]), ncard_pair hs23] + -- Apply Menger's theorem with `k = 4` between `X = V(P₁) ∪ V(P₂) ∪ V(P₃)` and `S.Ω.bar`. + rcases exists_fromToPaths_or_graphSeparation hX_sub_G S.bar_subset 4 with hpaths4 | hsep3 + · -- Case 1: There exist 4 mutually disjoint `X → ΩBar` paths in `S.G`. + left + obtain ⟨X'', Y'', hX''_X, hY''_bar, hs_sub_X'', _, hX''_card, hY''_card, hred₄⟩ := + theorem_2_2_proof hX_sub_G S.bar_subset hpaths4 hred₃.1 hred₃.2.1 hred₃.2.2.1 + (by omega) hred₃ + have hX''_fin : X''.Finite := S.finite_V.subset (hX''_X.trans hX_sub_G) + have hY''_fin : Y''.Finite := S.finite_V.subset (hY''_bar.trans S.bar_subset) + obtain ⟨Q, x, y, hdisjQ, hQ, hx_range, _⟩ := + exists_indexed_of_redirectsTo hX''_fin hY''_fin hred₄ hX''_card + obtain ⟨hx_inj, _, _, _, _⟩ := redirectsTo_of_disjoint_fromToPaths hdisjQ hQ + have hs₁_in : s₁ ∈ range x := hx_range ▸ hs_sub_X'' (by simp) + have hs₂_in : s₂ ∈ range x := hx_range ▸ hs_sub_X'' (by simp) + have hs₃_in : s₃ ∈ range x := hx_range ▸ hs_sub_X'' (by simp) + obtain ⟨i₁, hi₁⟩ := hs₁_in + obtain ⟨i₂, hi₂⟩ := hs₂_in + obtain ⟨i₃, hi₃⟩ := hs₃_in + have hi12 : i₁ ≠ i₂ := fun h => hs12 (hi₁ ▸ hi₂ ▸ congrArg x h) + have hi13 : i₁ ≠ i₃ := fun h => hs13 (hi₁ ▸ hi₃ ▸ congrArg x h) + have hi23 : i₂ ≠ i₃ := fun h => hs23 (hi₂ ▸ hi₃ ▸ congrArg x h) + have hex_i₄ : ∃ i₄ : Fin 4, i₄ ≠ i₁ ∧ i₄ ≠ i₂ ∧ i₄ ≠ i₃ := by + have hcard3 : ({i₁, i₂, i₃} : Finset (Fin 4)).card ≤ 3 := by + calc ({i₁, i₂, i₃} : Finset (Fin 4)).card + _ ≤ ({i₂, i₃} : Finset (Fin 4)).card + 1 := Finset.card_insert_le _ _ + _ ≤ ({i₃} : Finset (Fin 4)).card + 1 + 1 := by gcongr; exact Finset.card_insert_le _ _ + _ = 3 := by simp + have hlt : ({i₁, i₂, i₃} : Finset (Fin 4)).card < (Finset.univ : Finset (Fin 4)).card := by + simp; omega + obtain ⟨i₄, _, hi₄_not⟩ := Finset.exists_mem_notMem_of_card_lt_card hlt + simp only [Finset.mem_insert, Finset.mem_singleton, not_or] at hi₄_not + exact ⟨i₄, hi₄_not.1, hi₄_not.2.1, hi₄_not.2.2⟩ + obtain ⟨i₄, hi41, hi42, hi43⟩ := hex_i₄ + have hs₄_not : x i₄ ∉ ({s₁, s₂, s₃} : Set α) := by + simp only [mem_insert_iff, mem_singleton_iff, not_or] + exact ⟨fun h => hi41 (hx_inj (h.trans hi₁.symm)), + fun h => hi42 (hx_inj (h.trans hi₂.symm)), + fun h => hi43 (hx_inj (h.trans hi₃.symm))⟩ + have hs₄_X : x i₄ ∈ X := (hQ i₄).left_mem_X + have hR₁ : IsFromToPathWithEnds S.G (Q i₁) X S.Ω.bar s₁ (y i₁) := hi₁ ▸ hQ i₁ + have hR₂ : IsFromToPathWithEnds S.G (Q i₂) X S.Ω.bar s₂ (y i₂) := hi₂ ▸ hQ i₂ + have hR₃ : IsFromToPathWithEnds S.G (Q i₃) X S.Ω.bar s₃ (y i₃) := hi₃ ▸ hQ i₃ + have hR₄ : IsFromToPathWithEnds S.G (Q i₄) X S.Ω.bar (x i₄) (y i₄) := hQ i₄ + rcases hs₄_X with (hs₄_P₁ | hs₄_P₂) | hs₄_P₃ + · exact exists_cross_of_four_fromTo_in_P₁ S hP₁ hP₂ hP₃ hinter_12 hinter_13 hinter_23 + hs₁ hs₂ hs₃ subset_rfl + ⟨hs₄_P₁, fun h => hs₄_not (by simp [mem_singleton_iff.mp h])⟩ + hR₁ hR₂ hR₃ hR₄ + (hdisjQ hi12) (hdisjQ hi13) (hdisjQ hi41.symm) + (hdisjQ hi23) (hdisjQ hi42.symm) (hdisjQ hi43.symm) + · have hX_213 : V(P₂) ∪ V(P₁) ∪ V(P₃) ⊆ X := by + intro z hz + rcases hz with (hz2 | hz1) | hz3 + · exact Or.inl (Or.inr hz2) + · exact Or.inl (Or.inl hz1) + · exact Or.inr hz3 + exact exists_cross_of_four_fromTo_in_P₁ S hP₂ hP₁ hP₃ + (inter_comm V(P₂) V(P₁) ▸ hinter_12) hinter_23 hinter_13 + hs₂ hs₁ hs₃ hX_213 + ⟨hs₄_P₂, fun h => hs₄_not (by simp [mem_singleton_iff.mp h])⟩ + hR₂ hR₁ hR₃ hR₄ + (hdisjQ hi12.symm) (hdisjQ hi23) (hdisjQ hi42.symm) + (hdisjQ hi13) (hdisjQ hi41.symm) (hdisjQ hi43.symm) + · have hX_312 : V(P₃) ∪ V(P₁) ∪ V(P₂) ⊆ X := by + intro z hz + rcases hz with (hz3 | hz1) | hz2 + · exact Or.inr hz3 + · exact Or.inl (Or.inl hz1) + · exact Or.inl (Or.inr hz2) + exact exists_cross_of_four_fromTo_in_P₁ S hP₃ hP₁ hP₂ + (inter_comm V(P₃) V(P₁) ▸ hinter_13) (inter_comm V(P₃) V(P₂) ▸ hinter_23) hinter_12 + hs₃ hs₁ hs₂ hX_312 + ⟨hs₄_P₃, fun h => hs₄_not (by simp [mem_singleton_iff.mp h])⟩ + hR₃ hR₁ hR₂ hR₄ + (hdisjQ hi13.symm) (hdisjQ hi23.symm) (hdisjQ hi43.symm) + (hdisjQ hi12) (hdisjQ hi41.symm) (hdisjQ hi42.symm) + · -- Case 2: There is a separation `(G₁, G₂)` of `S` with `X ⊆ V(G₁)` and `|V(G₁ ∩ G₂)| ≤ 3`. + right + obtain ⟨G₁, G₂, hsep, hG₁_ind, hX_G₁, hbar_G₂, hinter_lt⟩ := hsep3 + have h5_sub : ({u, v, s₁, s₂, s₃} : Set α) ⊆ V(G₁) := by + rintro z (rfl | rfl | rfl | rfl | rfl) + · exact hX_G₁ (Or.inl (Or.inl hP₁.left_mem)) + · exact hX_G₁ (Or.inl (Or.inl hP₁.right_mem)) + · exact hX_G₁ (Or.inl (Or.inl hs₁.1)) + · exact hX_G₁ (Or.inl (Or.inr hs₂.1)) + · exact hX_G₁ (Or.inr hs₃.1) + have h5_card : ({u, v, s₁, s₂, s₃} : Set α).ncard = 5 := by + have hu_not : u ∉ ({v, s₁, s₂, s₃} : Set α) := by + simp only [mem_insert_iff, mem_singleton_iff, not_or] + exact ⟨huv, fun h => hs₁.2 (by simp [h.symm]), + fun h => hs₂.2 (by simp [h.symm]), fun h => hs₃.2 (by simp [h.symm])⟩ + have hv_not : v ∉ ({s₁, s₂, s₃} : Set α) := by + simp only [mem_insert_iff, mem_singleton_iff, not_or] + exact ⟨fun h => hs₁.2 (by simp [h.symm]), + fun h => hs₂.2 (by simp [h.symm]), fun h => hs₃.2 (by simp [h.symm])⟩ + rw [ncard_insert_of_notMem hu_not, ncard_insert_of_notMem hv_not, hcard_s] + have hV₁_ge_5 : 5 ≤ V(G₁).ncard := by + rw [← h5_card] + exact ncard_le_ncard h5_sub (S.finite_V.subset hsep.1.vertexSet_mono) + have hfin₁ : V(G₁).Finite := S.finite_V.subset hsep.1.vertexSet_mono + have hfin₂ : V(G₂).Finite := S.finite_V.subset hsep.2.1.vertexSet_mono + have hunion_inter := ncard_union_add_ncard_inter V(G₁) V(G₂) hfin₁ hfin₂ + rw [hsep.2.2.1] at hunion_inter + have hV₂_add_2 : V(G₂).ncard + 2 ≤ V(S.G).ncard := by omega + have hV₂_ne : V(G₂) ≠ V(S.G) := by + intro heq + rw [heq] at hV₂_add_2 + omega + have hint_sep : S.IsInternalKSeparation 3 G₁ G₂ := + ⟨⟨⟨hsep, hbar_G₂⟩, by omega, hV₂_ne⟩, hV₂_add_2⟩ + have hle_G₁ : ∀ {H : Graph α β}, H ≤ S.G → V(H) ⊆ V(G₁) → H ≤ G₁ := by + intro H hHG hVH + rw [hG₁_ind] + refine ⟨hVH, fun e x y hxy => ?_⟩ + rw [induce_isLink] + exact ⟨hxy.mono hHG, hVH hxy.left_mem, hVH hxy.right_mem⟩ + have h12_le : subgraphUnion S.G P₁ P₂ ≤ S.G := subgraphUnion_le hP₁.le hP₂.le + have h123_le : subgraphUnion S.G (subgraphUnion S.G P₁ P₂) P₃ ≤ S.G := + subgraphUnion_le h12_le hP₃.le + refine ⟨G₁, G₂, hint_sep, hle_G₁ h123_le ?_⟩ + rw [vertexSet_subgraphUnion, vertexSet_subgraphUnion] + exact hX_G₁ + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section2e.lean b/LeanPool/GraphMinor/GM09/Section2e.lean new file mode 100644 index 0000000000..ef13c7688c --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section2e.lean @@ -0,0 +1,5716 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM09.Basic +public import LeanPool.GraphMinor.GM09.DiscDrawing +import LeanPool.GraphMinor.GM09.Section2a +import LeanPool.GraphMinor.GM09.Section2b +import LeanPool.GraphMinor.GM09.Section2c +import LeanPool.GraphMinor.GM09.Section2d +import LeanPool.GraphMinor.GM09.Section3a + +/-! +# Graph Minors IX, Section 2 (Part 5): Proof of (2.4) + +This file formalizes Theorem (2.4) from Section 2 of +N. Robertson and P. D. Seymour, *Graph Minors. IX. Disjoint crossed paths*, +J. Combin. Theory Ser. B **49** (1990) 40–77 (pages 45–46): +every 3-connected society `(G, Ω)` with no cross or tripod is rural. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Metric Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 + GraphMinor.GM11 + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Subpaths Indexed by Support Positions and Cyclic Permutations from Nodup Lists -/ + +theorem nodup_getElem_inj {L : List α} (hnd : L.Nodup) {i j : ℕ} + (hi : i < L.length) (hj : j < L.length) (h : L[i] = L[j]) : i = j := by + induction L generalizing i j with + | nil => exact (Nat.not_lt_zero i hi).elim + | cons a L' ih => + obtain ⟨ha, hnd'⟩ := List.nodup_cons.mp hnd + cases i with + | zero => + cases j with + | zero => rfl + | succ j' => + simp only [List.length_cons, Nat.add_lt_add_iff_right] at hj + simp only [List.getElem_cons_zero, List.getElem_cons_succ] at h + exact (ha (h ▸ List.getElem_mem hj)).elim + | succ i' => + simp only [List.length_cons, Nat.add_lt_add_iff_right] at hi + cases j with + | zero => + simp only [List.getElem_cons_succ, List.getElem_cons_zero] at h + exact (ha (h.symm ▸ List.getElem_mem hi)).elim + | succ j' => + simp only [List.length_cons, Nat.add_lt_add_iff_right] at hj + simp only [List.getElem_cons_succ] at h + exact congrArg (· + 1) (ih hnd' hi hj h) + +theorem walkSubgraph_cons_tail_le {G : Graph α β} {u w v : α} {e : β} + (hlink : G.IsLink e u w) (W' : GraphWalk G w v) : + walkSubgraph W' ≤ walkSubgraph (.cons hlink W') := by + rw [(Compatible.of_le_le (walkSubgraph_le W') (walkSubgraph_le (.cons hlink W'))).le_iff] + refine ⟨fun x hx => ?_, fun f hf => ?_⟩ + · rw [vertexSet_walkSubgraph] at hx ⊢ + exact List.mem_cons_of_mem u hx + · rw [edgeSet_walkSubgraph] at hf ⊢ + exact List.mem_cons_of_mem e hf + +theorem support_getElem_zero {G : Graph α β} {u v : α} (W : GraphWalk G u v) + (h0 : 0 < W.support.length) : W.support[0]'h0 = u := by + cases W <;> rfl + +/-- For any simple walk `W : GraphWalk G u v` and indices `i ≤ j < W.support.length`, there is a +subpath `Q ≤ walkSubgraph W` from `W.support[i]` to `W.support[j]` whose vertex set consists of +`W.support[k]` for `i ≤ k ≤ j`. -/ +theorem exists_subpath_of_support_indices {G : Graph α β} {u v : α} + {W : GraphWalk G u v} (hW : W.IsSimple) {i j : ℕ} + (hij : i ≤ j) (hj : j < W.support.length) : + ∃ Q : Graph α β, Q ≤ walkSubgraph W ∧ + IsGraphPathWithEnds G Q (W.support[i]'(Nat.lt_of_le_of_lt hij hj)) (W.support[j]'hj) ∧ + V(Q) = {x | ∃ (k : ℕ) (hk : k < W.support.length), i ≤ k ∧ k ≤ j ∧ W.support[k]'hk = x} := by + induction W generalizing i j with + | @nil u hu => + simp only [GraphWalk.support_nil, List.length_singleton] at hj + have hi0 : i = 0 := by omega + have hj0 : j = 0 := by omega + subst hi0 hj0 + refine ⟨walkSubgraph (.nil hu), le_rfl, + isGraphPathWithEnds_walkSubgraph (by simp [GraphWalk.IsSimple]), ?_⟩ + ext x + simp only [vertexSet_walkSubgraph, GraphWalk.support_nil, List.mem_singleton, mem_ofPred_eq, + List.length_singleton] + constructor + · rintro rfl + exact ⟨0, by omega, le_rfl, le_rfl, rfl⟩ + · rintro ⟨k, hk, _, _, rfl⟩ + have hk0 : k = 0 := by omega + subst hk0 + rfl + | @cons u w v e hlink W' ih => + have hnd : (u :: W'.support).Nodup := hW + obtain ⟨hu_not, hW'⟩ := List.nodup_cons.mp hnd + have htail_le : walkSubgraph W' ≤ walkSubgraph (.cons hlink W') := + walkSubgraph_cons_tail_le hlink W' + cases i with + | zero => + cases j with + | zero => + let W₀ : GraphWalk G u u := .nil hlink.left_mem + have hW₀_le : walkSubgraph W₀ ≤ walkSubgraph (.cons hlink W') := by + rw [(Compatible.of_le_le (walkSubgraph_le W₀) (walkSubgraph_le (.cons hlink W'))).le_iff] + refine ⟨fun x hx => ?_, fun f hf => ?_⟩ + · rw [vertexSet_walkSubgraph] at hx ⊢ + simp only [W₀, GraphWalk.support_nil, List.mem_singleton] at hx + subst hx + exact List.mem_cons_self + · rw [edgeSet_walkSubgraph] at hf + simp [W₀] at hf + refine ⟨walkSubgraph W₀, hW₀_le, + isGraphPathWithEnds_walkSubgraph (by simp [W₀, GraphWalk.IsSimple]), ?_⟩ + ext x + simp only [vertexSet_walkSubgraph, W₀, GraphWalk.support_nil, List.mem_singleton, + mem_ofPred_eq, GraphWalk.support_cons, List.length_cons] + constructor + · rintro rfl + exact ⟨0, by omega, le_rfl, le_rfl, rfl⟩ + · rintro ⟨k, _, _, hk0, rfl⟩ + have hk_eq : k = 0 := by omega + subst hk_eq + rfl + | succ j' => + have hj' : j' < W'.support.length := by + simp only [GraphWalk.support_cons, List.length_cons] at hj + omega + obtain ⟨Q', hQ'_le, hQ'_path, hVQ'⟩ := ih hW' (Nat.zero_le j') hj' + have hw_mem : w ∈ W'.support := W'.start_mem_support + have huw_ne : u ≠ w := fun h => hu_not (h ▸ hw_mem) + let W₁ : GraphWalk G u w := .cons hlink (.nil hlink.right_mem) + have hW₁_simple : W₁.IsSimple := by simp [W₁, GraphWalk.IsSimple, huw_ne] + let Q₁ := walkSubgraph W₁ + have hQ₁_le : Q₁ ≤ walkSubgraph (.cons hlink W') := by + rw [(Compatible.of_le_le (walkSubgraph_le W₁) (walkSubgraph_le (.cons hlink W'))).le_iff] + refine ⟨fun x hx => ?_, fun f hf => ?_⟩ + · rw [vertexSet_walkSubgraph] at hx ⊢ + simp only [W₁, GraphWalk.support_cons, GraphWalk.support_nil, List.mem_cons, + List.not_mem_nil, or_false] at hx + rcases hx with rfl | rfl + · exact List.mem_cons_self + · exact List.mem_cons_of_mem u hw_mem + · rw [edgeSet_walkSubgraph] at hf ⊢ + simp only [W₁, GraphWalk.edges_cons, GraphWalk.edges_nil, List.mem_singleton] at hf + subst hf + exact List.mem_cons_self + have hQ₁_path : IsGraphPathWithEnds G Q₁ u w := isGraphPathWithEnds_walkSubgraph hW₁_simple + have hw_eq0 : W'.support[0]'(Nat.zero_lt_of_lt hj') = w := + support_getElem_zero W' (Nat.zero_lt_of_lt hj') + have hQ'_path' : IsGraphPathWithEnds G Q' w (W'.support[j']'hj') := by + simpa [hw_eq0] using hQ'_path + have hinter : V(Q₁) ∩ V(Q') = {w} := by + ext x + simp only [Q₁, vertexSet_walkSubgraph, W₁, GraphWalk.support_cons, GraphWalk.support_nil, + List.mem_cons, List.not_mem_nil, or_false, mem_inter_iff, mem_ofPred_eq, + mem_singleton_iff] + constructor + · rintro ⟨rfl | rfl, hxQ'⟩ + · have hxW' : x ∈ W'.support := by + have := hQ'_le.vertexSet_mono hxQ' + rwa [vertexSet_walkSubgraph] at this + exact (hu_not hxW').elim + · rfl + · rintro rfl + exact ⟨Or.inr rfl, hQ'_path'.left_mem⟩ + refine ⟨subgraphUnion G Q₁ Q', + (subgraphUnion_le_iff (hQ₁_le.trans (walkSubgraph_le _)) + ((hQ'_le.trans htail_le).trans (walkSubgraph_le _)) (walkSubgraph_le _)).mpr + ⟨hQ₁_le, hQ'_le.trans htail_le⟩, + hQ₁_path.subgraphUnion hQ'_path' hinter, ?_⟩ + ext x + rw [vertexSet_subgraphUnion, hVQ'] + simp only [Q₁, vertexSet_walkSubgraph, W₁, GraphWalk.support_cons, GraphWalk.support_nil, + List.mem_cons, List.not_mem_nil, or_false, mem_union, mem_ofPred_eq, List.length_cons] + constructor + · rintro ((rfl | rfl) | ⟨k', hk', _, hk'j', rfl⟩) + · exact ⟨0, by omega, le_rfl, by omega, rfl⟩ + · refine ⟨1, by omega, by omega, by omega, ?_⟩ + simpa using hw_eq0 + · exact ⟨k' + 1, by omega, by omega, by omega, rfl⟩ + · rintro ⟨k, hk, _, hkj, rfl⟩ + cases k with + | zero => exact Or.inl (Or.inl rfl) + | succ k' => + exact Or.inr ⟨k', by omega, Nat.zero_le k', by omega, rfl⟩ + | succ i' => + cases j with + | zero => omega + | succ j' => + have hi'j' : i' ≤ j' := by omega + have hj' : j' < W'.support.length := by + simp only [GraphWalk.support_cons, List.length_cons] at hj + omega + obtain ⟨Q', hQ'_le, hQ'_path, hVQ'⟩ := ih hW' hi'j' hj' + refine ⟨Q', hQ'_le.trans htail_le, hQ'_path, ?_⟩ + ext x + rw [hVQ'] + simp only [GraphWalk.support_cons, List.length_cons, mem_ofPred_eq] + constructor + · rintro ⟨k', hk', hi'k', hk'j', rfl⟩ + exact ⟨k' + 1, by omega, by omega, by omega, rfl⟩ + · rintro ⟨k, hk, hik, hkj, rfl⟩ + cases k with + | zero => omega + | succ k' => + exact ⟨k', by omega, by omega, by omega, rfl⟩ + +namespace CyclicPerm + +/-- For `x ∈ L`, the unique index `i < L.length` such that `L[i] = x`. -/ +noncomputable def indexOfMem (L : List α) {x : α} (hx : x ∈ L) : ℕ := + Classical.choose (List.mem_iff_getElem.mp hx) + +theorem indexOfMem_lt (L : List α) {x : α} (hx : x ∈ L) : + indexOfMem L hx < L.length := + (Classical.choose_spec (List.mem_iff_getElem.mp hx)).1 + +theorem getElem_indexOfMem (L : List α) {x : α} (hx : x ∈ L) : + L[indexOfMem L hx]'(indexOfMem_lt L hx) = x := + (Classical.choose_spec (List.mem_iff_getElem.mp hx)).2 + +theorem indexOfMem_getElem {L : List α} (hnd : L.Nodup) {i : ℕ} (hi : i < L.length) : + indexOfMem L (List.getElem_mem hi) = i := + nodup_getElem_inj hnd (indexOfMem_lt L _) hi (getElem_indexOfMem L _) + +/-- Underlying map of `ofNodupList`. -/ +noncomputable def ofNodupListFun (L : List α) (hne : L ≠ []) (x : α) : α := by + classical + exact if hx : x ∈ L then + L[(indexOfMem L hx + 1) % L.length]'(Nat.mod_lt _ (List.length_pos_of_ne_nil hne)) + else x + +theorem ofNodupListFun_of_mem (L : List α) (hne : L ≠ []) {x : α} (hx : x ∈ L) : + ofNodupListFun L hne x = + L[(indexOfMem L hx + 1) % L.length]'(Nat.mod_lt _ (List.length_pos_of_ne_nil hne)) := by + classical + simp [ofNodupListFun, hx] + +theorem ofNodupListFun_getElem (L : List α) (hnd : L.Nodup) (hne : L ≠ []) + {i : ℕ} (hi : i < L.length) : + ofNodupListFun L hne (L[i]'hi) = + L[(i + 1) % L.length]'(Nat.mod_lt _ (List.length_pos_of_ne_nil hne)) := by + rw [ofNodupListFun_of_mem L hne (List.getElem_mem hi)] + congr 1 + rw [indexOfMem_getElem hnd hi] + +theorem ofNodupListFun_iterate_getElem (L : List α) (hnd : L.Nodup) (hne : L ≠ []) + (m : ℕ) {i : ℕ} (hi : i < L.length) : + ((ofNodupListFun L hne)^[m]) (L[i]'hi) = + L[(i + m) % L.length]'(Nat.mod_lt _ (List.length_pos_of_ne_nil hne)) := by + induction m with + | zero => + simp only [Function.iterate_zero_apply, Nat.add_zero] + congr 1 + exact (Nat.mod_eq_of_lt hi).symm + | succ m ih => + rw [Function.iterate_succ_apply', ih, + ofNodupListFun_getElem L hnd hne (Nat.mod_lt _ (List.length_pos_of_ne_nil hne))] + congr 1 + rw [Nat.mod_add_mod, Nat.add_assoc] + +/-- The cyclic permutation defined by a non-empty duplicate-free list `L`. -/ +noncomputable def ofNodupList (L : List α) (hnd : L.Nodup) (hne : L ≠ []) : CyclicPerm α where + bar := {x | x ∈ L} + toFun := ofNodupListFun L hne + finite_bar := by + classical + exact L.toFinset.finite_toSet.subset fun x hx => List.mem_toFinset.mpr hx + bijOn := by + have hpos : 0 < L.length := List.length_pos_of_ne_nil hne + refine ⟨fun x hx => ?_, fun x hx y hy hxy => ?_, fun y hy => ?_⟩ + · simp only [mem_ofPred_eq] at hx ⊢ + rw [ofNodupListFun_of_mem L hne hx] + exact List.getElem_mem _ + · simp only [mem_ofPred_eq] at hx hy + rw [← getElem_indexOfMem L hx, ← getElem_indexOfMem L hy] at hxy ⊢ + rw [ofNodupListFun_getElem L hnd hne (indexOfMem_lt L hx), + ofNodupListFun_getElem L hnd hne (indexOfMem_lt L hy)] at hxy + have hmod := nodup_getElem_inj hnd (Nat.mod_lt _ hpos) (Nat.mod_lt _ hpos) hxy + have hi := indexOfMem_lt L hx + have hj := indexOfMem_lt L hy + have hij : indexOfMem L hx = indexOfMem L hy := by + by_cases h1 : indexOfMem L hx + 1 = L.length <;> + by_cases h2 : indexOfMem L hy + 1 = L.length + · omega + · have hm1 : (indexOfMem L hx + 1) % L.length = 0 := by rw [h1, Nat.mod_self] + have hm2 : (indexOfMem L hy + 1) % L.length = indexOfMem L hy + 1 := + Nat.mod_eq_of_lt (by omega) + omega + · have hm1 : (indexOfMem L hx + 1) % L.length = indexOfMem L hx + 1 := + Nat.mod_eq_of_lt (by omega) + have hm2 : (indexOfMem L hy + 1) % L.length = 0 := by rw [h2, Nat.mod_self] + omega + · have hm1 : (indexOfMem L hx + 1) % L.length = indexOfMem L hx + 1 := + Nat.mod_eq_of_lt (by omega) + have hm2 : (indexOfMem L hy + 1) % L.length = indexOfMem L hy + 1 := + Nat.mod_eq_of_lt (by omega) + omega + congr 1 + · simp only [mem_ofPred_eq] at hy + have hj : indexOfMem L hy < L.length := indexOfMem_lt L hy + let i := (indexOfMem L hy + L.length - 1) % L.length + have hi : i < L.length := Nat.mod_lt _ hpos + refine ⟨L[i]'hi, List.getElem_mem hi, ?_⟩ + rw [ofNodupListFun_getElem L hnd hne hi, ← getElem_indexOfMem L hy] + congr 1 + dsimp [i] + rw [Nat.mod_add_mod] + have hsum : indexOfMem L hy + L.length - 1 + 1 = indexOfMem L hy + L.length := by omega + rw [hsum, Nat.add_mod_right, Nat.mod_eq_of_lt hj] + single_orbit := by + intro x hx y hy + simp only [mem_ofPred_eq] at hx hy + have hi : indexOfMem L hx < L.length := indexOfMem_lt L hx + have hj : indexOfMem L hy < L.length := indexOfMem_lt L hy + let k := indexOfMem L hy + L.length - indexOfMem L hx + refine ⟨k, ?_⟩ + have hx_eq : L[indexOfMem L hx]'hi = x := getElem_indexOfMem L hx + have hy_eq : L[indexOfMem L hy]'hj = y := getElem_indexOfMem L hy + calc ((ofNodupListFun L hne)^[k]) x + _ = ((ofNodupListFun L hne)^[k]) (L[indexOfMem L hx]'hi) := by rw [hx_eq] + _ = L[(indexOfMem L hx + k) % L.length]'(Nat.mod_lt _ (List.length_pos_of_ne_nil hne)) := + ofNodupListFun_iterate_getElem L hnd hne k hi + _ = L[indexOfMem L hy]'hj := by + congr 1 + have hsum : indexOfMem L hx + k = indexOfMem L hy + L.length := by omega + rw [hsum, Nat.add_mod_right, Nat.mod_eq_of_lt hj] + _ = y := hy_eq + +@[simp] +theorem ofNodupList_bar (L : List α) (hnd : L.Nodup) (hne : L ≠ []) : + (ofNodupList L hnd hne).bar = {x | x ∈ L} := rfl + +theorem ofNodupList_toFun_getElem (L : List α) (hnd : L.Nodup) (hne : L ≠ []) + {i : ℕ} (hi : i < L.length) : + (ofNodupList L hnd hne).toFun (L[i]'hi) = + L[(i + 1) % L.length]'(Nat.mod_lt _ (List.length_pos_of_ne_nil hne)) := + ofNodupListFun_getElem L hnd hne hi + +theorem ofNodupList_iterate_getElem (L : List α) (hnd : L.Nodup) (hne : L ≠ []) + (m : ℕ) {i : ℕ} (hi : i < L.length) : + ((ofNodupList L hnd hne).toFun^[m]) (L[i]'hi) = + L[(i + m) % L.length]'(Nat.mod_lt _ (List.length_pos_of_ne_nil hne)) := + ofNodupListFun_iterate_getElem L hnd hne m hi + +/-- In `ofNodupList L hnd hne`, if `i < j < k < L.length`, then `L[j]` lies in the open interval +`interval (L[i]) (L[k])`. -/ +theorem ofNodupList_mem_interval_of_lt (L : List α) (hnd : L.Nodup) (hne : L ≠ []) + {i j k : ℕ} (hij : i < j) (hjk : j < k) (hk : k < L.length) : + (L[j]'(Nat.lt_trans hjk hk)) ∈ + (ofNodupList L hnd hne).interval (L[i]'(Nat.lt_trans (Nat.lt_trans hij hjk) hk)) (L[k]'hk) + := by + have hi : i < L.length := Nat.lt_trans (Nat.lt_trans hij hjk) hk + have hj : j < L.length := Nat.lt_trans hjk hk + have hpos : 0 < L.length := List.length_pos_of_ne_nil hne + have hne_ik : L[i]'hi ≠ L[k]'hk := fun h => by have := nodup_getElem_inj hnd hi hk h; omega + have hne_ji : L[j]'hj ≠ L[i]'hi := fun h => by have := nodup_getElem_inj hnd hj hi h; omega + have hne_jk : L[j]'hj ≠ L[k]'hk := fun h => by have := nodup_getElem_inj hnd hj hk h; omega + rw [(ofNodupList L hnd hne).mem_interval_iff_firstHitIn + (List.getElem_mem hi) (List.getElem_mem hk) (List.getElem_mem hj) hne_ik hne_ji hne_jk] + refine ⟨j - i, by omega, ?_, by simp, fun d hd1 hdj hd_in => ?_⟩ + · rw [ofNodupList_iterate_getElem L hnd hne (j - i) hi] + congr 1 + have hsum : i + (j - i) = j := by omega + rw [hsum, Nat.mod_eq_of_lt hj] + · rw [ofNodupList_iterate_getElem L hnd hne d hi] at hd_in + have hmod_eq : (i + d) % L.length = i + d := Nat.mod_eq_of_lt (by omega) + simp only [mem_insert_iff, mem_singleton_iff] at hd_in + rcases hd_in with h | h | h + · have := nodup_getElem_inj hnd (Nat.mod_lt _ hpos) hi h; omega + · have := nodup_getElem_inj hnd (Nat.mod_lt _ hpos) hj h; omega + · have := nodup_getElem_inj hnd (Nat.mod_lt _ hpos) hk h; omega + +/-- In `ofNodupList L hnd hne`, for `i < k < L.length` and `j < L.length` with `j < i ∨ k < j`, +`L[j]` lies in the open interval `interval (L[k]) (L[i])`. -/ +theorem ofNodupList_mem_interval_swap_of_lt_or_gt (L : List α) (hnd : L.Nodup) (hne : L ≠ []) + {i j k : ℕ} (hik : i < k) (hk : k < L.length) (hj : j < L.length) + (hj_out : j < i ∨ k < j) : + (L[j]'hj) ∈ (ofNodupList L hnd hne).interval (L[k]'hk) (L[i]'(Nat.lt_trans hik hk)) := by + rcases hj_out with hji | hkj + · have h_in := ofNodupList_mem_interval_of_lt L hnd hne hji hik hk + exact (ofNodupList L hnd hne).mem_interval_rotate_right h_in + · have h_in := ofNodupList_mem_interval_of_lt L hnd hne hik hkj hj + exact (ofNodupList L hnd hne).mem_interval_rotate_left h_in + +/-- Exact interval characterization in `ofNodupList L hnd hne` for `i < k < L.length`. -/ +theorem ofNodupList_mem_interval_iff (L : List α) (hnd : L.Nodup) (hne : L ≠ []) + {i j k : ℕ} (hik : i < k) (hk : k < L.length) (hj : j < L.length) : + (L[j]'hj) ∈ (ofNodupList L hnd hne).interval (L[i]'(Nat.lt_trans hik hk)) (L[k]'hk) ↔ + i < j ∧ j < k := by + have hi : i < L.length := Nat.lt_trans hik hk + constructor + · intro h_in + have hne_ji : j ≠ i := fun h => by + subst h + exact (ofNodupList L hnd hne).not_mem_interval_left (L[j]'hj) (L[k]'hk) h_in + have hne_jk : j ≠ k := fun h => by + subst h + exact (ofNodupList L hnd hne).not_mem_interval_right (L[i]'hi) (L[j]'hj) h_in + by_contra hnot + have hj_out : j < i ∨ k < j := by omega + have h_swap := ofNodupList_mem_interval_swap_of_lt_or_gt L hnd hne hik hk hj hj_out + exact disjoint_left.mp ((ofNodupList L hnd hne).disjoint_interval_swap (L[i]'hi) (L[k]'hk)) + h_in h_swap + · rintro ⟨hij, hjk⟩ + exact ofNodupList_mem_interval_of_lt L hnd hne hij hjk hk + +/-- Exact reverse-interval characterization in `ofNodupList L hnd hne` for `i < k < L.length`. -/ +theorem ofNodupList_mem_interval_swap_iff (L : List α) (hnd : L.Nodup) (hne : L ≠ []) + {i j k : ℕ} (hik : i < k) (hk : k < L.length) (hj : j < L.length) : + (L[j]'hj) ∈ (ofNodupList L hnd hne).interval (L[k]'hk) (L[i]'(Nat.lt_trans hik hk)) ↔ + j < i ∨ k < j := by + have hi : i < L.length := Nat.lt_trans hik hk + constructor + · intro h_in + have hne_ji : j ≠ i := fun h => by + subst h + exact (ofNodupList L hnd hne).not_mem_interval_right (L[k]'hk) (L[j]'hj) h_in + have hne_jk : j ≠ k := fun h => by + subst h + exact (ofNodupList L hnd hne).not_mem_interval_left (L[j]'hj) (L[i]'hi) h_in + by_contra hnot + have hj_mid : i < j ∧ j < k := by omega + have h_mid := ofNodupList_mem_interval_of_lt L hnd hne hj_mid.1 hj_mid.2 hk + exact disjoint_left.mp ((ofNodupList L hnd hne).disjoint_interval_swap (L[i]'hi) (L[k]'hk)) + h_mid h_in + · intro hj_out + exact ofNodupList_mem_interval_swap_of_lt_or_gt L hnd hne hik hk hj hj_out + +/-- Crossing characterization in `ofNodupList L hnd hne` for ordered endpoint pairs `i₁ < j₁` and +`i₂ < j₂`. -/ +theorem ofNodupList_crosses_iff (L : List α) (hnd : L.Nodup) (hne : L ≠ []) + {i₁ j₁ i₂ j₂ : ℕ} (h1 : i₁ < j₁) (hj₁ : j₁ < L.length) + (h2 : i₂ < j₂) (hj₂ : j₂ < L.length) : + (ofNodupList L hnd hne).Crosses + (L[i₁]'(Nat.lt_trans h1 hj₁)) (L[j₁]'hj₁) + (L[i₂]'(Nat.lt_trans h2 hj₂)) (L[j₂]'hj₂) ↔ + (i₁ < i₂ ∧ i₂ < j₁ ∧ j₁ < j₂) ∨ (i₂ < i₁ ∧ i₁ < j₂ ∧ j₂ < j₁) := by + have hi₂ : i₂ < L.length := Nat.lt_trans h2 hj₂ + rw [(ofNodupList L hnd hne).crosses_iff_interval, + ofNodupList_mem_interval_iff L hnd hne h1 hj₁ hi₂, + ofNodupList_mem_interval_swap_iff L hnd hne h1 hj₁ hj₂, + ofNodupList_mem_interval_iff L hnd hne h1 hj₁ hj₂, + ofNodupList_mem_interval_swap_iff L hnd hne h1 hj₁ hi₂] + omega + +/-- Any non-empty prefix `L₁` of `L = L₁ ++ L₂` is clockwise in `ofNodupList (L₁ ++ L₂) hnd hne`. -/ +theorem ofNodupList_isClockwiseSeq_prefix {L₁ L₂ : List α} + (hnd : (L₁ ++ L₂).Nodup) (hne₁ : L₁ ≠ []) : + (ofNodupList (L₁ ++ L₂) hnd (List.append_ne_nil_of_left_ne_nil hne₁ L₂)).IsClockwiseSeq L₁ := by + have hne : L₁ ++ L₂ ≠ [] := List.append_ne_nil_of_left_ne_nil hne₁ L₂ + have hpos₁ : 0 < L₁.length := List.length_pos_of_ne_nil hne₁ + have hpos : 0 < (L₁ ++ L₂).length := List.length_pos_of_ne_nil hne + have hle : L₁.length ≤ (L₁ ++ L₂).length := by simp + obtain ⟨hnd₁, _, _⟩ := List.nodup_append.mp hnd + refine ⟨hnd₁, fun v hv => List.mem_append_left L₂ hv, fun i hi => ?_⟩ + have hiL : i < (L₁ ++ L₂).length := Nat.lt_of_lt_of_le hi hle + have hget_i : L₁[i]'hi = (L₁ ++ L₂)[i]'hiL := (List.getElem_append_left hi).symm + by_cases hi_last : i + 1 < L₁.length + · have hi1L : i + 1 < (L₁ ++ L₂).length := Nat.lt_of_lt_of_le hi_last hle + have hmod₁ : (i + 1) % L₁.length = i + 1 := Nat.mod_eq_of_lt hi_last + refine ⟨1, le_rfl, ?_, List.getElem_mem _, fun j hj1 hjlt => by omega⟩ + rw [hget_i, Function.iterate_one, ofNodupList_toFun_getElem (L₁ ++ L₂) hnd hne hiL] + trans (L₁ ++ L₂)[i + 1]'hi1L + · congr 1 + exact Nat.mod_eq_of_lt hi1L + · trans L₁[i + 1]'hi_last + · exact List.getElem_append_left hi_last + · congr 1 + exact hmod₁.symm + · have hi_eq : i + 1 = L₁.length := by omega + have hmod₁ : (i + 1) % L₁.length = 0 := by rw [hi_eq, Nat.mod_self] + let m := (L₁ ++ L₂).length - i + have hm1 : 1 ≤ m := by omega + refine ⟨m, hm1, ?_, List.getElem_mem _, fun j hj1 hjlt hj_in => ?_⟩ + · rw [hget_i, ofNodupList_iterate_getElem (L₁ ++ L₂) hnd hne m hiL] + have hsum : (i + m) % (L₁ ++ L₂).length = 0 := by + have : i + m = (L₁ ++ L₂).length := by omega + rw [this, Nat.mod_self] + trans (L₁ ++ L₂)[0]'hpos + · congr 1 + · trans L₁[0]'hpos₁ + · exact List.getElem_append_left hpos₁ + · congr 1 + exact hmod₁.symm + · rw [hget_i, ofNodupList_iterate_getElem (L₁ ++ L₂) hnd hne j hiL] at hj_in + simp only [mem_ofPred_eq] at hj_in + obtain ⟨k, hk, hk_eq⟩ := List.mem_iff_getElem.mp hj_in + have hkL : k < (L₁ ++ L₂).length := Nat.lt_of_lt_of_le hk hle + have hk_eqL : (L₁ ++ L₂)[k]'hkL = (L₁ ++ L₂)[(i + j) % (L₁ ++ L₂).length]'(Nat.mod_lt _ hpos) + := by + trans L₁[k]'hk + · exact List.getElem_append_left hk + · exact hk_eq + have hidx := nodup_getElem_inj hnd hkL (Nat.mod_lt _ hpos) hk_eqL + have hmod_ij : (i + j) % (L₁ ++ L₂).length = i + j := Nat.mod_eq_of_lt (by omega) + omega + +/-! ## Listing `Ω.interval s t` and Splitting `Ω` Along a Path `P` -/ + +theorem exists_hitStep (Ω : CyclicPerm α) {s t : α} (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) : + ∃ k : ℕ, 1 ≤ k ∧ (Ω.toFun^[k]) s = t ∧ ∀ j : ℕ, 1 ≤ j → j < k → (Ω.toFun^[j]) s ≠ t := by + have hne : (Ω.bar ∩ ({t} : Set α)).Nonempty := ⟨t, ht, mem_singleton t⟩ + obtain ⟨y, k, hk1, hky, hy_in, hmin⟩ := Ω.exists_firstHitIn hs hne + rw [mem_singleton_iff] at hy_in + subst hy_in + exact ⟨k, hk1, hky, fun j hj1 hjk hj_eq => hmin j hj1 hjk (mem_singleton_iff.mpr hj_eq)⟩ + +/-- The positive step count `k ≥ 1` at which `Ω` first hits `t` starting from `s`. -/ +noncomputable def hitStep (Ω : CyclicPerm α) {s t : α} (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) : ℕ := + Classical.choose (exists_hitStep Ω hs ht) + +theorem hitStep_ge_one (Ω : CyclicPerm α) {s t : α} (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) : + 1 ≤ Ω.hitStep hs ht := + (Classical.choose_spec (exists_hitStep Ω hs ht)).1 + +theorem iterate_hitStep (Ω : CyclicPerm α) {s t : α} (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) : + (Ω.toFun^[Ω.hitStep hs ht]) s = t := + (Classical.choose_spec (exists_hitStep Ω hs ht)).2.1 + +theorem iterate_ne_of_lt_hitStep (Ω : CyclicPerm α) {s t : α} (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) + {j : ℕ} (hj1 : 1 ≤ j) (hjk : j < Ω.hitStep hs ht) : + (Ω.toFun^[j]) s ≠ t := + (Classical.choose_spec (exists_hitStep Ω hs ht)).2.2 j hj1 hjk + +theorem iterate_ne_self_of_lt_hitStep (Ω : CyclicPerm α) {s t : α} + (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) (hst : s ≠ t) + {d : ℕ} (hd1 : 1 ≤ d) (hdk : d < Ω.hitStep hs ht) : + (Ω.toFun^[d]) s ≠ s := by + intro heq + have hmul : ∀ q : ℕ, (Ω.toFun^[d * q]) s = s := by + intro q + induction q with + | zero => rfl + | succ q ih => + rw [Nat.mul_succ, add_comm, Function.iterate_add_apply, ih, heq] + have hrem : (Ω.toFun^[(Ω.hitStep hs ht) % d]) s = t := by + trans (Ω.toFun^[Ω.hitStep hs ht]) s + · conv_rhs => rw [← Nat.div_add_mod (Ω.hitStep hs ht) d, add_comm] + rw [Function.iterate_add_apply, hmul] + · exact Ω.iterate_hitStep hs ht + have hmod_lt : (Ω.hitStep hs ht) % d < d := Nat.mod_lt _ (by omega) + rcases Nat.eq_zero_or_pos ((Ω.hitStep hs ht) % d) with h0 | hpos + · rw [h0, Function.iterate_zero_apply] at hrem + exact hst hrem + · exact Ω.iterate_ne_of_lt_hitStep hs ht hpos (by omega) hrem + +theorem iterate_inj_le_hitStep (Ω : CyclicPerm α) {s t : α} + (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) (hst : s ≠ t) + {i j : ℕ} (hi : i ≤ Ω.hitStep hs ht) (hj : j ≤ Ω.hitStep hs ht) + (heq : (Ω.toFun^[i]) s = (Ω.toFun^[j]) s) : i = j := by + rcases lt_trichotomy i j with hlt | rfl | hgt + · exfalso + have hiter : (Ω.toFun^[i]) ((Ω.toFun^[j - i]) s) = (Ω.toFun^[i]) s := by + rw [← Function.iterate_add_apply, Nat.add_sub_of_le (le_of_lt hlt), heq] + have hsub_eq : (Ω.toFun^[j - i]) s = s := + Ω.injOn_iterate i (Ω.iterate_mem (j - i) hs) hs hiter + by_cases hji_eq : j - i = Ω.hitStep hs ht + · rw [hji_eq, Ω.iterate_hitStep hs ht] at hsub_eq + exact hst hsub_eq.symm + · exact Ω.iterate_ne_self_of_lt_hitStep hs ht hst (by omega) (by omega) hsub_eq + · rfl + · exfalso + have hiter : (Ω.toFun^[j]) ((Ω.toFun^[i - j]) s) = (Ω.toFun^[j]) s := by + rw [← Function.iterate_add_apply, Nat.add_sub_of_le (le_of_lt hgt), ← heq] + have hsub_eq : (Ω.toFun^[i - j]) s = s := + Ω.injOn_iterate j (Ω.iterate_mem (i - j) hs) hs hiter + by_cases hij_eq : i - j = Ω.hitStep hs ht + · rw [hij_eq, Ω.iterate_hitStep hs ht] at hsub_eq + exact hst hsub_eq.symm + · exact Ω.iterate_ne_self_of_lt_hitStep hs ht hst (by omega) (by omega) hsub_eq + +/-- For `0 ≤ j₁ < j₂ < j₃ ≤ hitStep Ω hs ht`, `(Ω.toFun^[j₂]) s` lies in the open interval +`Ω.interval ((Ω.toFun^[j₁]) s) ((Ω.toFun^[j₃]) s)`. -/ +theorem iterate_mem_interval_of_lt_hitStep (Ω : CyclicPerm α) {s t : α} + (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) (hst : s ≠ t) + {j₁ j₂ j₃ : ℕ} (h12 : j₁ < j₂) (h23 : j₂ < j₃) (h3 : j₃ ≤ Ω.hitStep hs ht) : + ((Ω.toFun^[j₂]) s) ∈ Ω.interval ((Ω.toFun^[j₁]) s) ((Ω.toFun^[j₃]) s) := by + have h1 : j₁ ≤ Ω.hitStep hs ht := by omega + have h2 : j₂ ≤ Ω.hitStep hs ht := by omega + have hne13 : (Ω.toFun^[j₁]) s ≠ (Ω.toFun^[j₃]) s := fun h => by + have := Ω.iterate_inj_le_hitStep hs ht hst h1 h3 h; omega + have hne21 : (Ω.toFun^[j₂]) s ≠ (Ω.toFun^[j₁]) s := fun h => by + have := Ω.iterate_inj_le_hitStep hs ht hst h2 h1 h; omega + have hne23 : (Ω.toFun^[j₂]) s ≠ (Ω.toFun^[j₃]) s := fun h => by + have := Ω.iterate_inj_le_hitStep hs ht hst h2 h3 h; omega + rw [Ω.mem_interval_iff_firstHitIn + (Ω.iterate_mem j₁ hs) (Ω.iterate_mem j₃ hs) (Ω.iterate_mem j₂ hs) hne13 hne21 hne23] + refine ⟨j₂ - j₁, by omega, ?_, by simp, fun d hd1 hdj hd_in => ?_⟩ + · rw [← Function.iterate_add_apply, Nat.sub_add_cancel (by omega)] + · rw [← Function.iterate_add_apply] at hd_in + have hdj_le : d + j₁ ≤ Ω.hitStep hs ht := by omega + simp only [mem_insert_iff, mem_singleton_iff] at hd_in + rcases hd_in with h | h | h + · have := Ω.iterate_inj_le_hitStep hs ht hst hdj_le h1 h; omega + · have := Ω.iterate_inj_le_hitStep hs ht hst hdj_le h2 h; omega + · have := Ω.iterate_inj_le_hitStep hs ht hst hdj_le h3 h; omega + +/-- The list of elements of `Ω.interval s t` in clockwise order from `s` to `t`. -/ +noncomputable def intervalList (Ω : CyclicPerm α) {s t : α} + (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) : List α := + (List.range (Ω.hitStep hs ht - 1)).map (fun i => (Ω.toFun^[i + 1]) s) + +@[simp] +theorem length_intervalList (Ω : CyclicPerm α) {s t : α} (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) : + (Ω.intervalList hs ht).length = Ω.hitStep hs ht - 1 := by + simp [intervalList] + +theorem getElem_intervalList (Ω : CyclicPerm α) {s t : α} (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) + {i : ℕ} (hi : i < (Ω.intervalList hs ht).length) : + (Ω.intervalList hs ht)[i]'hi = (Ω.toFun^[i + 1]) s := by + simp [intervalList] + +theorem nodup_intervalList (Ω : CyclicPerm α) {s t : α} + (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) (hst : s ≠ t) : + (Ω.intervalList hs ht).Nodup := by + rw [List.Nodup, List.pairwise_iff_getElem] + intro i j hi hj hij heq + rw [getElem_intervalList, getElem_intervalList] at heq + rw [length_intervalList] at hi hj + have := Ω.iterate_inj_le_hitStep hs ht hst (by omega) (by omega) heq + omega + +theorem mem_intervalList_iff (Ω : CyclicPerm α) {s t : α} + (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) (hst : s ≠ t) (x : α) : + x ∈ Ω.intervalList hs ht ↔ x ∈ Ω.interval s t := by + constructor + · intro hx + obtain ⟨i, hi, rfl⟩ := List.mem_iff_getElem.mp hx + rw [getElem_intervalList] + rw [length_intervalList] at hi + have hmem := Ω.iterate_mem_interval_of_lt_hitStep hs ht hst + (Nat.zero_lt_succ i) (by omega) (le_rfl) + simpa [Ω.iterate_hitStep hs ht] using hmem + · intro hx + have hx_bar : x ∈ Ω.bar := hx.1.1 + have hxs : x ≠ s := fun h => hx.1.2 (by simp [h]) + have hxt : x ≠ t := fun h => hx.1.2 (by simp [h]) + have hhit : Ω.FirstHitIn {s, x, t} s x := + (Ω.mem_interval_iff_firstHitIn hs ht hx_bar hst hxs hxt).mp hx + rcases hhit with ⟨j, hj1, rfl, _, hmin⟩ + have hjk : j < Ω.hitStep hs ht := by + by_contra hge + rcases eq_or_lt_of_le (Nat.le_of_not_lt hge) with heq | hgt + · rw [← heq, Ω.iterate_hitStep hs ht] at hxt + exact hxt rfl + · exact hmin (Ω.hitStep hs ht) (Ω.hitStep_ge_one hs ht) hgt + (by simp [Ω.iterate_hitStep hs ht]) + rw [List.mem_iff_getElem] + refine ⟨j - 1, ?_, ?_⟩ + · rw [length_intervalList]; omega + · rw [getElem_intervalList, Nat.sub_add_cancel hj1] + +/-- For `a < b < (Ω.intervalList hs ht).length`, `{t, L_W[a]}` crosses `{s, L_W[b]}` in `Ω`. -/ +theorem crosses_t_s_intervalList_of_lt (Ω : CyclicPerm α) {s t : α} + (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) (hst : s ≠ t) + {a b : ℕ} (hab : a < b) (hb : b < (Ω.intervalList hs ht).length) : + Ω.Crosses t ((Ω.intervalList hs ht)[a]'(Nat.lt_trans hab hb)) + s ((Ω.intervalList hs ht)[b]'hb) := by + have ha : a < (Ω.intervalList hs ht).length := Nat.lt_trans hab hb + rw [getElem_intervalList, getElem_intervalList] + rw [length_intervalList] at ha hb + have ha_in_sb : (Ω.toFun^[a + 1]) s ∈ Ω.interval s ((Ω.toFun^[b + 1]) s) := + Ω.iterate_mem_interval_of_lt_hitStep hs ht hst (j₁ := 0) (j₂ := a + 1) (j₃ := b + 1) + (Nat.zero_lt_succ a) (by omega) (by omega) + have hb_in_st : (Ω.toFun^[b + 1]) s ∈ Ω.interval s t := by + have h := Ω.iterate_mem_interval_of_lt_hitStep hs ht hst + (j₁ := 0) (j₂ := b + 1) (j₃ := Ω.hitStep hs ht) (Nat.zero_lt_succ b) (by omega) (le_rfl) + rwa [Function.iterate_zero_apply, Ω.iterate_hitStep hs ht] at h + exact (Ω.crosses_iff_interval.mpr (Or.inr ⟨ha_in_sb, Ω.mem_interval_rotate_left hb_in_st⟩)).symm + +/-- For `a < b < c < (Ω.intervalList hs ht).length`, `{t, L_W[b]}` crosses `{L_W[a], L_W[c]}` in +`Ω`. -/ +theorem crosses_t_intervalList_of_lt (Ω : CyclicPerm α) {s t : α} + (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) (hst : s ≠ t) + {a b c : ℕ} (hab : a < b) (hbc : b < c) (hc : c < (Ω.intervalList hs ht).length) : + Ω.Crosses t ((Ω.intervalList hs ht)[b]'(Nat.lt_trans hbc hc)) + ((Ω.intervalList hs ht)[a]'(Nat.lt_trans (Nat.lt_trans hab hbc) hc)) + ((Ω.intervalList hs ht)[c]'hc) := by + have ha : a < (Ω.intervalList hs ht).length := Nat.lt_trans (Nat.lt_trans hab hbc) hc + have hb : b < (Ω.intervalList hs ht).length := Nat.lt_trans hbc hc + rw [getElem_intervalList, getElem_intervalList, getElem_intervalList] + rw [length_intervalList] at ha hb hc + have hb_in_ac : (Ω.toFun^[b + 1]) s ∈ Ω.interval ((Ω.toFun^[a + 1]) s) ((Ω.toFun^[c + 1]) s) := + Ω.iterate_mem_interval_of_lt_hitStep hs ht hst (j₁ := a + 1) (j₂ := b + 1) (j₃ := c + 1) + (by omega) (by omega) (by omega) + have hc_in_at : (Ω.toFun^[c + 1]) s ∈ Ω.interval ((Ω.toFun^[a + 1]) s) t := by + have h := Ω.iterate_mem_interval_of_lt_hitStep hs ht hst + (j₁ := a + 1) (j₂ := c + 1) (j₃ := Ω.hitStep hs ht) (by omega) (by omega) (le_rfl) + rwa [Ω.iterate_hitStep hs ht] at h + exact (Ω.crosses_iff_interval.mpr (Or.inr ⟨hb_in_ac, Ω.mem_interval_rotate_left hc_in_at⟩)).symm + +/-- For `a < b < c < d < (Ω.intervalList hs ht).length`, `{L_W[a], L_W[c]}` crosses +`{L_W[b], L_W[d]}` in `Ω`. -/ +theorem crosses_intervalList_of_lt (Ω : CyclicPerm α) {s t : α} + (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) (hst : s ≠ t) + {a b c d : ℕ} (hab : a < b) (hbc : b < c) (hcd : c < d) + (hd : d < (Ω.intervalList hs ht).length) : + Ω.Crosses + ((Ω.intervalList hs ht)[a]'(by omega)) + ((Ω.intervalList hs ht)[c]'(by omega)) + ((Ω.intervalList hs ht)[b]'(by omega)) + ((Ω.intervalList hs ht)[d]'hd) := by + have hd' : d < Ω.hitStep hs ht - 1 := by rwa [length_intervalList] at hd + rw [getElem_intervalList, getElem_intervalList, getElem_intervalList, getElem_intervalList] + have hb_in_ac : (Ω.toFun^[b + 1]) s ∈ Ω.interval ((Ω.toFun^[a + 1]) s) ((Ω.toFun^[c + 1]) s) := + Ω.iterate_mem_interval_of_lt_hitStep hs ht hst (by omega) (by omega) (by omega) + have hc_in_ad : (Ω.toFun^[c + 1]) s ∈ Ω.interval ((Ω.toFun^[a + 1]) s) ((Ω.toFun^[d + 1]) s) := + Ω.iterate_mem_interval_of_lt_hitStep hs ht hst (by omega) (by omega) (by omega) + have hd_in_ca : (Ω.toFun^[d + 1]) s ∈ Ω.interval ((Ω.toFun^[c + 1]) s) ((Ω.toFun^[a + 1]) s) := + Ω.mem_interval_rotate_left hc_in_ad + exact Ω.crosses_iff_interval.mpr (Or.inl ⟨hb_in_ac, hd_in_ca⟩) + +end CyclicPerm + +/-! ## Splitting `G \ V(P)` into `H₁` and `H₂` Along an Induced Path `P` -/ + +/-- For a subgraph `P` of `G` and a vertex set `W`, `splitSide G P W` is the union of those +components of `G \ V(P)` of which some vertex belongs to `W` +(Graph Minors IX, (2.4), page 45: "For $i = 1, 2$, let $H_i$ be the union of those components of +$G \setminus V(P)$ of which some vertex is in $W_i$"). -/ +def splitSide (G P : Graph α β) (W : Set α) : Graph α β := + (deleteVertices G V(P)).induce + {v ∈ V(deleteVertices G V(P)) | (W ∩ V(reachableComponent (deleteVertices G V(P)) v)).Nonempty} + +@[simp] +theorem vertexSet_splitSide (G P : Graph α β) (W : Set α) : + V(splitSide G P W) = + {v ∈ V(deleteVertices G V(P)) | (W ∩ V(reachableComponent (deleteVertices G V(P)) + v)).Nonempty} := + rfl + +theorem splitSide_le_deleteVertices (G P : Graph α β) (W : Set α) : + splitSide G P W ≤ deleteVertices G V(P) := + (deleteVertices G V(P)).induce_le fun _ hv => hv.1 + +theorem splitSide_le (G P : Graph α β) (W : Set α) : + splitSide G P W ≤ G := + (splitSide_le_deleteVertices G P W).trans (deleteVertices_le G V(P)) + +theorem disjoint_vertexSet_splitSide_P (G P : Graph α β) (W : Set α) : + Disjoint V(splitSide G P W) V(P) := by + rw [disjoint_left] + intro v hv hvP + exact hv.1.2 hvP + +theorem mem_vertexSet_splitSide_of_mem_W {G P : Graph α β} {W : Set α} {w : α} + (hwG : w ∈ V(G)) (hwP : w ∉ V(P)) (hwW : w ∈ W) : + w ∈ V(splitSide G P W) := by + have hw_del : w ∈ V(deleteVertices G V(P)) := ⟨hwG, hwP⟩ + exact ⟨hw_del, ⟨w, hwW, self_mem_reachableComponent hw_del⟩⟩ + +theorem isClosedSubgraph_splitSide_deleteVertices (G P : Graph α β) (W : Set α) : + splitSide G P W ≤c deleteVertices G V(P) := by + refine IsClosedSubgraph.mk' (splitSide_le_deleteVertices G P W) fun e x hinc hx => ?_ + obtain ⟨y, hxy⟩ := hinc + have hx_del : x ∈ V(deleteVertices G V(P)) := hx.1 + have hy_del : y ∈ V(deleteVertices G V(P)) := hxy.right_mem + have hcomp_eq : reachableComponent (deleteVertices G V(P)) x = + reachableComponent (deleteVertices G V(P)) y := by + refine isGraphComponent_eq_of_mem_inter + (isGraphComponent_reachableComponent hx_del) + (isGraphComponent_reachableComponent hy_del) + ⟨y, ?_, self_mem_reachableComponent hy_del⟩ + exact (mem_graphComponent_iff_of_isLink + (isGraphComponent_reachableComponent hx_del) hxy).mp (self_mem_reachableComponent hx_del) + have hy_in : y ∈ V(splitSide G P W) := ⟨hy_del, hcomp_eq ▸ hx.2⟩ + exact ⟨x, y, hxy, hx, hy_in⟩ + +theorem mem_splitSide_iff_of_deleteVertices_isLink {G P : Graph α β} {W : Set α} + {e : β} {x y : α} (hxy : (deleteVertices G V(P)).IsLink e x y) : + x ∈ V(splitSide G P W) ↔ y ∈ V(splitSide G P W) := + (isClosedSubgraph_splitSide_deleteVertices G P W).mem_iff_of_isLink hxy + +/-- Every vertex `v ∈ V(splitSide G P W)` has a walk in `splitSide G P W` to some vertex `w ∈ W`. -/ +theorem exists_walk_in_splitSide_to_W {G P : Graph α β} {W : Set α} {v : α} + (hv : v ∈ V(splitSide G P W)) : + ∃ w ∈ W ∩ V(splitSide G P W), Nonempty (GraphWalk (splitSide G P W) v w) := by + rcases hv with ⟨hv_del, w, hwW, hw_reach⟩ + have hcomp_v := isGraphComponent_reachableComponent hv_del + have hle_split : reachableComponent (deleteVertices G V(P)) v ≤ splitSide G P W := by + have hsubV : V(reachableComponent (deleteVertices G V(P)) v) ⊆ V(splitSide G P W) := by + intro u hu + have hu_del : u ∈ V(deleteVertices G V(P)) := (reachableComponent_le _ _).vertexSet_mono hu + have hcomp_eq : reachableComponent (deleteVertices G V(P)) u = + reachableComponent (deleteVertices G V(P)) v := + isGraphComponent_eq_of_mem_inter (isGraphComponent_reachableComponent hu_del) hcomp_v + ⟨u, self_mem_reachableComponent hu_del, hu⟩ + exact ⟨hu_del, hcomp_eq.symm ▸ ⟨w, hwW, hw_reach⟩⟩ + rw [(Compatible.of_le_le (reachableComponent_le _ _) (splitSide_le_deleteVertices G P + W)).le_iff] + refine ⟨hsubV, fun e he => ?_⟩ + obtain ⟨x, y, hxy⟩ := (reachableComponent (deleteVertices G V(P)) + v).exists_isLink_of_mem_edgeSet he + exact ⟨x, y, hxy.mono (reachableComponent_le _ _), hsubV hxy.left_mem, hsubV hxy.right_mem⟩ + obtain ⟨W_vw⟩ := hcomp_v.2.1.2 v (self_mem_reachableComponent hv_del) w hw_reach + obtain ⟨W_vw', _, _⟩ := exists_walk_up_of_le hle_split W_vw + exact ⟨w, ⟨hwW, hle_split.vertexSet_mono hw_reach⟩, ⟨W_vw'⟩⟩ + +/-- **Graph Minors IX, (2.4)** (page 45): +"Put $W_1 = \Omega(s, t)$ and $W_2 = \Omega(t, s)$. For $i = 1, 2$, let $H_i$ be the union of those +components of $G \setminus V(P)$ of which some vertex is in $W_i$. Then +$H_1 \cup H_2 = G \setminus V(P)$ since $Z$ catches $G \setminus V(P)$." -/ +theorem lemma_2_4_H1_union_H2 (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hcatch : Catches (S.Ω.bar \ {s, t}) (deleteVertices S.G V(P))) : + subgraphUnion (deleteVertices S.G V(P)) + (splitSide S.G P (S.Ω.interval s t)) + (splitSide S.G P (S.Ω.interval t s)) = deleteVertices S.G V(P) := by + let K := deleteVertices S.G V(P) + let H₁ := splitSide S.G P (S.Ω.interval s t) + let H₂ := splitSide S.G P (S.Ω.interval t s) + have h₁ : H₁ ≤ K := splitSide_le_deleteVertices S.G P (S.Ω.interval s t) + have h₂ : H₂ ≤ K := splitSide_le_deleteVertices S.G P (S.Ω.interval t s) + have hV_eq : V(H₁) ∪ V(H₂) = V(K) := by + refine Subset.antisymm (union_subset h₁.vertexSet_mono h₂.vertexSet_mono) fun v hv => ?_ + obtain ⟨z, hzZ, hzv⟩ := hcatch.2 (reachableComponent K v) (isGraphComponent_reachableComponent + hv) + rw [ ← S.Ω.interval_union_interval_swap hs ht hst] at hzZ + rcases hzZ with hz1 | hz2 + · exact Or.inl ⟨hv, ⟨z, hz1, hzv⟩⟩ + · exact Or.inr ⟨hv, ⟨z, hz2, hzv⟩⟩ + refine (Compatible.of_le_le (subgraphUnion_le h₁ h₂) le_rfl).ext ?_ ?_ + · rw [vertexSet_subgraphUnion, hV_eq] + · rw [edgeSet_subgraphUnion h₁ h₂] + refine Subset.antisymm (union_subset h₁.edgeSet_mono h₂.edgeSet_mono) fun e he => ?_ + obtain ⟨x, y, hxy⟩ := K.exists_isLink_of_mem_edgeSet he + have hx_in : x ∈ V(H₁) ∪ V(H₂) := hV_eq.symm ▸ hxy.left_mem + rcases hx_in with hx₁ | hx₂ + · have hy₁ : y ∈ V(H₁) := (mem_splitSide_iff_of_deleteVertices_isLink hxy).mp hx₁ + exact Or.inl ⟨x, y, hxy, hx₁, hy₁⟩ + · have hy₂ : y ∈ V(H₂) := (mem_splitSide_iff_of_deleteVertices_isLink hxy).mp hx₂ + exact Or.inr ⟨x, y, hxy, hx₂, hy₂⟩ + +/-- **Graph Minors IX, (2.4)** (page 45): +"Moreover, $H_1 \cap H_2$ is null, since $(G, \Omega)$ has no cross." -/ +theorem lemma_2_4_H1_disjoint_H2 (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) : + Disjoint V(splitSide S.G P (S.Ω.interval s t)) V(splitSide S.G P (S.Ω.interval t s)) ∧ + Disjoint E(splitSide S.G P (S.Ω.interval s t)) E(splitSide S.G P (S.Ω.interval t s)) := by + have hdisjV : + Disjoint V(splitSide S.G P (S.Ω.interval s t)) V(splitSide S.G P (S.Ω.interval t s)) := by + rw [disjoint_left] + intro v hv₁ hv₂ + rcases hv₁ with ⟨hv_del, w₁, hw₁_int, hw₁_reach⟩ + rcases hv₂ with ⟨_, w₂, hw₂_int, hw₂_reach⟩ + have hcomp := isGraphComponent_reachableComponent hv_del + obtain ⟨W_12⟩ := hcomp.2.1.2 w₁ hw₁_reach w₂ hw₂_reach + obtain ⟨W_K, hs_K, _⟩ := exists_walk_up_of_le (reachableComponent_le _ _) W_12 + obtain ⟨W_G, hs_G, _⟩ := exists_walk_up_of_le (deleteVertices_le S.G V(P)) W_K + obtain ⟨Q, hQ, hVQ, _⟩ := exists_isGraphPathWithEnds_of_walk W_G + have hdisj_PQ : Disjoint V(P) V(Q) := by + rw [disjoint_right] + intro u huQ huP + have hu_supp : u ∈ W_12.support := by + have := hVQ huQ + rwa [mem_ofPred_eq, hs_G, hs_K] at this + have hu_del : u ∈ V(deleteVertices S.G V(P)) := + (reachableComponent_le _ _).vertexSet_mono (W_12.mem_vertexSet_of_mem_support hu_supp) + exact hu_del.2 huP + have hcross_ends : S.Ω.Crosses s t w₁ w₂ := + S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hw₁_int, hw₂_int⟩) + have hw₁_ne_w₂ : w₁ ≠ w₂ := hcross_ends.ne_ends.2 + exact hnocross ⟨P, Q, hdisj_PQ, s, t, w₁, w₂, + ⟨hP, hst, hs, ht⟩, ⟨hQ, hw₁_ne_w₂, hw₁_int.1.1, hw₂_int.1.1⟩, hcross_ends⟩ + refine ⟨hdisjV, disjoint_left.mpr fun e he₁ he₂ => ?_⟩ + obtain ⟨x, _, hxy₁⟩ := (splitSide S.G P (S.Ω.interval s t)).exists_isLink_of_mem_edgeSet he₁ + have hxy₂ := ((splitSide_le S.G P (S.Ω.interval t s)).isLink_iff he₂).mpr + (hxy₁.mono (splitSide_le S.G P (S.Ω.interval s t))) + exact disjoint_left.mp hdisjV hxy₁.left_mem hxy₂.left_mem + +/-- No edge of `S.G` has one endpoint in `V(H₁)` and the other in `V(H₂)` when `(G, Ω)` has no +cross. -/ +theorem no_link_between_splitSides (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) + {e : β} {x y : α} (hxy : S.G.IsLink e x y) + (hx : x ∈ V(splitSide S.G P (S.Ω.interval s t))) + (hy : y ∈ V(splitSide S.G P (S.Ω.interval t s))) : False := by + have hxy_del : (deleteVertices S.G V(P)).IsLink e x y := + (deleteVertices_isLink S.G V(P)).mpr ⟨hxy, hx.1.2, hy.1.2⟩ + have hy₁ : y ∈ V(splitSide S.G P (S.Ω.interval s t)) := + (mem_splitSide_iff_of_deleteVertices_isLink hxy_del).mp hx + exact disjoint_left.mp (lemma_2_4_H1_disjoint_H2 S hs ht hst hP hnocross).1 hy₁ hy + +/-! ## Construction of `(G₁, Ω₁)` and Basic Structural Properties -/ + +/-- Canonical simple walk of `P` from `t` to `s` for a path `P` in `G` with ends `s, t`. -/ +noncomputable def pathWalkTS {G P : Graph α β} {s t : α} + (hP : IsGraphPathWithEnds G P s t) : GraphWalk P t s := + Classical.choose hP.symm.2 + +theorem isSimple_pathWalkTS {G P : Graph α β} {s t : α} + (hP : IsGraphPathWithEnds G P s t) : (pathWalkTS hP).IsSimple := + (Classical.choose_spec hP.symm.2).1 + +theorem vertexSet_eq_support_pathWalkTS {G P : Graph α β} {s t : α} + (hP : IsGraphPathWithEnds G P s t) : + V(P) = {x | x ∈ (pathWalkTS hP).support} := + (Classical.choose_spec hP.symm.2).2.1 + +theorem edgeSet_eq_edges_pathWalkTS {G P : Graph α β} {s t : α} + (hP : IsGraphPathWithEnds G P s t) : + E(P) = {e | e ∈ (pathWalkTS hP).edges} := + (Classical.choose_spec hP.symm.2).2.2 + +theorem walkSubgraph_pathWalkTS {G P : Graph α β} {s t : α} + (hP : IsGraphPathWithEnds G P s t) : + walkSubgraph (pathWalkTS hP) = P := by + refine (Compatible.of_le_le (walkSubgraph_le (pathWalkTS hP)) le_rfl).ext ?_ ?_ + · rw [vertexSet_walkSubgraph, vertexSet_eq_support_pathWalkTS] + · rw [edgeSet_walkSubgraph, edgeSet_eq_edges_pathWalkTS] + +theorem support_getElem_last {G : Graph α β} {u v : α} (W : GraphWalk G u v) : + W.support[W.support.length - 1]'(by cases W <;> simp) = v := by + induction W with + | nil _ => rfl + | @cons u w v e hlink W' ih => + have hpos : 0 < W'.support.length := by cases W' <;> simp + have hidx : (u :: W'.support).length - 1 = (W'.support.length - 1) + 1 := by + simp only [List.length_cons] + omega + trans (u :: W'.support)[(W'.support.length - 1) + 1]'(by simp; omega) + · congr 1 + · simpa using ih + +/-- The concatenated clockwise list `(pathWalkTS hP).support ++ S.Ω.intervalList hs ht` +defining `Ω₁`. -/ +noncomputable def splitList (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hP : IsGraphPathWithEnds S.G P s t) : List α := + (pathWalkTS hP).support ++ S.Ω.intervalList hs ht + +theorem splitList_ne_nil (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hP : IsGraphPathWithEnds S.G P s t) : + splitList S hs ht hP ≠ [] := by + apply List.append_ne_nil_of_left_ne_nil + cases pathWalkTS hP <;> simp + +theorem nodup_splitList (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) : + (splitList S hs ht hP).Nodup := by + rw [splitList, List.nodup_append] + refine ⟨isSimple_pathWalkTS hP, S.Ω.nodup_intervalList hs ht hst, fun x hx y hy hxy => ?_⟩ + subst hxy + have hxP : x ∈ V(P) := by rw [vertexSet_eq_support_pathWalkTS hP]; exact hx + have hxW : x ∈ S.Ω.interval s t := (S.Ω.mem_intervalList_iff hs ht hst x).mp hy + exact disjoint_left.mp hP_bar ⟨hxP, hxW.1.2⟩ hxW.1.1 + +/-- The cyclic permutation `Ω₁` on `W₁ ∪ V(P)` from `(2.4)` (page 45). -/ +noncomputable def splitCyclicPerm (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) : CyclicPerm α := + CyclicPerm.ofNodupList (splitList S hs ht hP) + (nodup_splitList S hs ht hst hP hP_bar) (splitList_ne_nil S hs ht hP) + +@[simp] +theorem splitCyclicPerm_bar (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) : + (splitCyclicPerm S hs ht hst hP hP_bar).bar = S.Ω.interval s t ∪ V(P) := by + ext x + simp only [splitCyclicPerm, CyclicPerm.ofNodupList_bar, splitList, List.mem_append, + S.Ω.mem_intervalList_iff hs ht hst, vertexSet_eq_support_pathWalkTS hP, mem_union, + mem_ofPred_eq, or_comm] + +theorem splitCyclicPerm_isClockwiseSeq_pathWalkTS (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) : + (splitCyclicPerm S hs ht hst hP hP_bar).IsClockwiseSeq (pathWalkTS hP).support := + CyclicPerm.ofNodupList_isClockwiseSeq_prefix + (nodup_splitList S hs ht hst hP hP_bar) + (by cases pathWalkTS hP <;> simp) + +/-- The graph `G₁ = (G \ E(P)) \ V(H₂)` from `(2.4)` (page 45). -/ +def splitGraph (S : Society α β) (P : Graph α β) (s t : α) : Graph α β := + deleteVertices (S.G.restrict (E(S.G) \ E(P))) V(splitSide S.G P (S.Ω.interval t s)) + +theorem splitGraph_le (S : Society α β) (P : Graph α β) (s t : α) : + splitGraph S P s t ≤ S.G := + (deleteVertices_le _ _).trans restrict_le + +@[simp] +theorem vertexSet_splitGraph (S : Society α β) (P : Graph α β) (s t : α) : + V(splitGraph S P s t) = V(S.G) \ V(splitSide S.G P (S.Ω.interval t s)) := + rfl + +theorem splitGraph_isLink_iff (S : Society α β) (P : Graph α β) (s t : α) {e : β} {x y : α} : + (splitGraph S P s t).IsLink e x y ↔ + S.G.IsLink e x y ∧ e ∉ E(P) ∧ + x ∉ V(splitSide S.G P (S.Ω.interval t s)) ∧ + y ∉ V(splitSide S.G P (S.Ω.interval t s)) := by + unfold splitGraph + rw [deleteVertices_isLink, restrict_isLink, mem_sdiff] + refine ⟨fun ⟨⟨⟨_, heP⟩, hxy⟩, hx, hy⟩ => ⟨hxy, heP, hx, hy⟩, + fun ⟨hxy, heP, hx, hy⟩ => ⟨⟨⟨hxy.edge_mem, heP⟩, hxy⟩, hx, hy⟩⟩ + +theorem edgeSet_splitGraph_subset (S : Society α β) (P : Graph α β) (s t : α) : + E(splitGraph S P s t) ⊆ E(S.G) \ E(P) := by + intro e he + obtain ⟨x, y, hxy⟩ := (splitGraph S P s t).exists_isLink_of_mem_edgeSet he + rw [splitGraph_isLink_iff] at hxy + exact ⟨hxy.1.edge_mem, hxy.2.1⟩ + +/-- The society `(G₁, Ω₁)` from `(2.4)` (page 45). -/ +noncomputable def splitSociety (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) : Society α β where + G := splitGraph S P s t + Ω := splitCyclicPerm S hs ht hst hP hP_bar + bar_subset := by + rw [splitCyclicPerm_bar, vertexSet_splitGraph] + rintro x (hxW₁ | hxP) + · refine ⟨S.bar_subset hxW₁.1.1, fun hxH₂ => ?_⟩ + have hxH₁ : x ∈ V(splitSide S.G P (S.Ω.interval s t)) := + mem_vertexSet_splitSide_of_mem_W (S.bar_subset hxW₁.1.1) + (fun hxP => disjoint_left.mp hP_bar ⟨hxP, hxW₁.1.2⟩ hxW₁.1.1) hxW₁ + exact disjoint_left.mp (lemma_2_4_H1_disjoint_H2 S hs ht hst hP hnocross).1 hxH₁ hxH₂ + · exact ⟨hP.1.vertexSet_mono hxP, fun hxH₂ => hxH₂.1.2 hxP⟩ + finite_V := S.finite_V.subset (splitGraph_le S P s t).vertexSet_mono + finite_E := S.finite_E.subset (splitGraph_le S P s t).edgeSet_mono + +theorem vertexSet_splitGraph_eq_union (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hcatch : Catches (S.Ω.bar \ {s, t}) (deleteVertices S.G V(P))) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) : + V(splitGraph S P s t) = V(P) ∪ V(splitSide S.G P (S.Ω.interval s t)) := by + have hunion := congrArg Graph.vertexSet (lemma_2_4_H1_union_H2 S hs ht hst hcatch) + change V(splitSide S.G P (S.Ω.interval s t)) ∪ V(splitSide S.G P (S.Ω.interval t s)) = + V(S.G) \ V(P) at hunion + have hdisj := (lemma_2_4_H1_disjoint_H2 S hs ht hst hP hnocross).1 + ext x + simp only [vertexSet_splitGraph, mem_sdiff, mem_union] + constructor + · rintro ⟨hxG, hx_not_H₂⟩ + by_cases hxP : x ∈ V(P) + · exact Or.inl hxP + · have hx_in : x ∈ V(splitSide S.G P (S.Ω.interval s t)) ∪ + V(splitSide S.G P (S.Ω.interval t s)) := by + rw [hunion] + exact ⟨hxG, hxP⟩ + exact Or.inr (hx_in.resolve_right hx_not_H₂) + · rintro (hxP | hxH₁) + · exact ⟨hP.1.vertexSet_mono hxP, fun hxH₂ => hxH₂.1.2 hxP⟩ + · exact ⟨hxH₁.1.1, disjoint_left.mp hdisj hxH₁⟩ + +theorem deleteVertices_splitGraph_eq_splitSide (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hcatch : Catches (S.Ω.bar \ {s, t}) (deleteVertices S.G V(P))) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) : + deleteVertices (splitGraph S P s t) V(P) = splitSide S.G P (S.Ω.interval s t) := by + have hle1 : deleteVertices (splitGraph S P s t) V(P) ≤ S.G := + (deleteVertices_le _ _).trans (splitGraph_le S P s t) + have hle2 : splitSide S.G P (S.Ω.interval s t) ≤ S.G := + splitSide_le S.G P (S.Ω.interval s t) + have hV_eq : V(deleteVertices (splitGraph S P s t) V(P)) = + V(splitSide S.G P (S.Ω.interval s t)) := by + change V(splitGraph S P s t) \ V(P) = V(splitSide S.G P (S.Ω.interval s t)) + rw [vertexSet_splitGraph_eq_union S hs ht hst hP hcatch hnocross] + ext x + simp only [mem_sdiff, mem_union] + exact ⟨fun ⟨hx, hx_not_P⟩ => hx.resolve_left hx_not_P, + fun hxH₁ => ⟨Or.inr hxH₁, hxH₁.1.2⟩⟩ + have hdisj := (lemma_2_4_H1_disjoint_H2 S hs ht hst hP hnocross).1 + refine (Compatible.of_le_le hle1 hle2).ext hV_eq ?_ + ext e + constructor + · intro he + obtain ⟨x, y, hxy⟩ := (deleteVertices (splitGraph S P s t) V(P)).exists_isLink_of_mem_edgeSet he + have hxH₁ : x ∈ V(splitSide S.G P (S.Ω.interval s t)) := hV_eq ▸ hxy.left_mem + have hyH₁ : y ∈ V(splitSide S.G P (S.Ω.interval s t)) := hV_eq ▸ hxy.right_mem + rw [deleteVertices_isLink, splitGraph_isLink_iff] at hxy + have hxy_del : (deleteVertices S.G V(P)).IsLink e x y := + (deleteVertices_isLink S.G V(P)).mpr ⟨hxy.1.1, hxy.2.1, hxy.2.2⟩ + exact ⟨x, y, hxy_del, hxH₁, hyH₁⟩ + · intro he + obtain ⟨x, y, hxy⟩ := (splitSide S.G P (S.Ω.interval s t)).exists_isLink_of_mem_edgeSet he + have hxH₁ : x ∈ V(splitSide S.G P (S.Ω.interval s t)) := hxy.left_mem + have hyH₁ : y ∈ V(splitSide S.G P (S.Ω.interval s t)) := hxy.right_mem + have hxyG : S.G.IsLink e x y := hxy.mono hle2 + have he_not_P : e ∉ E(P) := by + intro heP + obtain ⟨u, v, huvP⟩ := P.exists_isLink_of_mem_edgeSet heP + rcases hxyG.left_eq_or_eq (huvP.mono hP.1) with rfl | rfl + · exact hxH₁.1.2 huvP.left_mem + · exact hxH₁.1.2 huvP.right_mem + have hxy_split : (splitGraph S P s t).IsLink e x y := + (splitGraph_isLink_iff S P s t).mpr + ⟨hxyG, he_not_P, disjoint_left.mp hdisj hxH₁, disjoint_left.mp hdisj hyH₁⟩ + exact ((deleteVertices_isLink (splitGraph S P s t) V(P)).mpr + ⟨hxy_split, hxH₁.1.2, hyH₁.1.2⟩).edge_mem + +/-- **Graph Minors IX, (2.4)** (page 45): +"$(G_1, \Omega_1)$, $(G_2, \Omega_2)$ are 3-connected societies, both with fewer edges than $(G, +\Omega)$." +(Part 1: `|E(G₁)| < |E(G)|`.) -/ +theorem lemma_2_4_edgeSet_ncard_lt (S : Society α β) {P : Graph α β} {s t : α} + (hst : s ≠ t) (hP : IsGraphPathWithEnds S.G P s t) : + E(splitGraph S P s t).ncard < E(S.G).ncard := by + obtain ⟨e₀, he₀P⟩ := nonempty_edgeSet_of_isGraphPathWithEnds_ne hP hst + have he₀G : e₀ ∈ E(S.G) := hP.1.edgeSet_mono he₀P + have he₀_not : e₀ ∉ E(splitGraph S P s t) := + fun h => (edgeSet_splitGraph_subset S P s t h).2 he₀P + exact ncard_lt_ncard + ⟨(splitGraph_le S P s t).edgeSet_mono, fun h => he₀_not (h he₀G)⟩ S.finite_E + +/-- **Graph Minors IX, (2.4)** (page 45): +"Then $(G_1, \Omega_1)$, $(G_2, \Omega_2)$ are 3-connected societies, both with fewer edges than +$(G, \Omega)$." (Part 2: `(G₁, Ω₁)` is 3-connected.) -/ +theorem lemma_2_4_isKConnected_three (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + (_hcatch : Catches (S.Ω.bar \ {s, t}) (deleteVertices S.G V(P))) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) + (hconn : S.IsKConnected 3) : + (splitSociety S hs ht hst hP hP_bar hnocross).IsKConnected 3 := by + rintro k hk3 A₁ A₂ ⟨⟨hsep, hbar_A₂⟩, hcard_lt, hVA₂_ne⟩ + let G₁ := splitGraph S P s t + let H₂ := splitSide S.G P (S.Ω.interval t s) + have hA₁G : A₁ ≤ S.G := hsep.1.trans (splitGraph_le S P s t) + have hA₂G : A₂ ≤ S.G := hsep.2.1.trans (splitGraph_le S P s t) + have hbar₁ : S.Ω.interval s t ∪ V(P) ⊆ V(A₂) := by + rw [← splitCyclicPerm_bar S hs ht hst hP hP_bar] + exact hbar_A₂ + have hVP_A₂ : V(P) ⊆ V(A₂) := subset_union_right.trans hbar₁ + have hW₁_A₂ : S.Ω.interval s t ⊆ V(A₂) := subset_union_left.trans hbar₁ + have hdisj_A₁_H₂ : Disjoint V(A₁) V(H₂) := by + rw [disjoint_left] + intro x hxA₁ hxH₂ + exact (hsep.1.vertexSet_mono hxA₁).2 hxH₂ + let A₂' : Graph α β := (S.G.induce (V(A₂) ∪ V(H₂))).restrict (E(S.G) \ E(A₁)) + have hVA₂_H₂_sub : V(A₂) ∪ V(H₂) ⊆ V(S.G) := + union_subset hA₂G.vertexSet_mono (splitSide_le S.G P (S.Ω.interval t s)).vertexSet_mono + have hA₂'G : A₂' ≤ S.G := restrict_le.trans (S.G.induce_le hVA₂_H₂_sub) + have hVA₂' : V(A₂') = V(A₂) ∪ V(H₂) := rfl + have hsep_S : IsGraphSeparation S.G A₁ A₂' := by + refine ⟨hA₁G, hA₂'G, ?_, ?_, ?_⟩ + · change V(A₁) ∪ (V(A₂) ∪ V(H₂)) = V(S.G) + rw [← union_assoc, hsep.2.2.1] + change (V(S.G) \ V(H₂)) ∪ V(H₂) = V(S.G) + rw [sdiff_union_self, + union_eq_self_of_subset_right (splitSide_le S.G P (S.Ω.interval t s)).vertexSet_mono] + · refine Subset.antisymm (union_subset hA₁G.edgeSet_mono hA₂'G.edgeSet_mono) fun e heG => ?_ + by_cases heA₁ : e ∈ E(A₁) + · exact Or.inl heA₁ + · right + obtain ⟨x, y, hxyG⟩ := S.G.exists_isLink_of_mem_edgeSet heG + have hxy_in : x ∈ V(A₂) ∪ V(H₂) ∧ y ∈ V(A₂) ∪ V(H₂) := by + by_cases heP : e ∈ E(P) + · obtain ⟨u, v, huvP⟩ := P.exists_isLink_of_mem_edgeSet heP + have hxP : x ∈ V(P) := by + rcases hxyG.left_eq_or_eq (huvP.mono hP.1) with rfl | rfl + · exact huvP.left_mem + · exact huvP.right_mem + have hyP : y ∈ V(P) := by + rcases hxyG.symm.left_eq_or_eq (huvP.mono hP.1) with rfl | rfl + · exact huvP.left_mem + · exact huvP.right_mem + exact ⟨Or.inl (hVP_A₂ hxP), Or.inl (hVP_A₂ hyP)⟩ + · by_cases hxH₂ : x ∈ V(H₂) + · refine ⟨Or.inr hxH₂, ?_⟩ + by_cases hyP : y ∈ V(P) + · exact Or.inl (hVP_A₂ hyP) + · have hxy_del : (deleteVertices S.G V(P)).IsLink e x y := + (deleteVertices_isLink S.G V(P)).mpr ⟨hxyG, hxH₂.1.2, hyP⟩ + exact Or.inr ((mem_splitSide_iff_of_deleteVertices_isLink hxy_del).mp hxH₂) + · by_cases hyH₂ : y ∈ V(H₂) + · refine ⟨?_, Or.inr hyH₂⟩ + by_cases hxP : x ∈ V(P) + · exact Or.inl (hVP_A₂ hxP) + · have hyx_del : (deleteVertices S.G V(P)).IsLink e y x := + (deleteVertices_isLink S.G V(P)).mpr ⟨hxyG.symm, hyH₂.1.2, hxP⟩ + exact Or.inr ((mem_splitSide_iff_of_deleteVertices_isLink hyx_del).mp hyH₂) + · have hxy_G₁ : G₁.IsLink e x y := + (splitGraph_isLink_iff S P s t).mpr ⟨hxyG, heP, hxH₂, hyH₂⟩ + have he_A₁₂ : e ∈ E(A₁) ∪ E(A₂) := hsep.2.2.2.1 ▸ hxy_G₁.edge_mem + have heA₂ : e ∈ E(A₂) := he_A₁₂.resolve_left heA₁ + have hxy_A₂ : A₂.IsLink e x y := (hsep.2.1.isLink_iff heA₂).mpr hxy_G₁ + exact ⟨Or.inl hxy_A₂.left_mem, Or.inl hxy_A₂.right_mem⟩ + exact ⟨⟨x, y, hxyG, hxy_in.1, hxy_in.2⟩, heG, heA₁⟩ + · rw [disjoint_left] + intro e heA₁ heA₂' + exact heA₂'.2.2 heA₁ + have hbar_A₂' : S.Ω.bar ⊆ V(A₂') := by + intro z hz + rw [hVA₂'] + by_cases hzs : z = s + · subst hzs; exact Or.inl (hVP_A₂ hP.left_mem) + · by_cases hzt : z = t + · subst hzt; exact Or.inl (hVP_A₂ hP.right_mem) + · rcases S.Ω.mem_interval_or_interval_swap hs ht hz hst hzs hzt with hz1 | hz2 + · exact Or.inl (hW₁_A₂ hz1) + · right + exact mem_vertexSet_splitSide_of_mem_W (S.bar_subset hz) + (fun hzP => disjoint_left.mp hP_bar ⟨hzP, by simp [hzs, hzt]⟩ hz) hz2 + have hinter_eq : V(A₁) ∩ V(A₂') = V(A₁) ∩ V(A₂) := by + rw [hVA₂', inter_union_distrib_left, disjoint_iff_inter_eq_empty.mp hdisj_A₁_H₂, union_empty] + have hVA₂'_ne : V(A₂') ≠ V(S.G) := by + intro heq + apply hVA₂_ne + refine Subset.antisymm hsep.2.1.vertexSet_mono fun x hxG₁ => ?_ + have hx_in : x ∈ V(A₂) ∪ V(H₂) := by + rw [← hVA₂', heq] + exact hxG₁.1 + exact hx_in.resolve_right hxG₁.2 + exact hconn k hk3 A₁ A₂' ⟨⟨hsep_S, hbar_A₂'⟩, hinter_eq ▸ hcard_lt, hVA₂'_ne⟩ + +/-! ## Shrinking Crosses and Indexing `splitList` -/ + +/-- If `{a₁, b₁}` crosses `{a₂, b₂}` in `Ω` and `z ∈ Ω.bar \ {a₁, b₁, a₂, b₂}`, then either +`{a₁, z}` crosses `{a₂, b₂}` or `{z, b₁}` crosses `{a₂, b₂}`. -/ +theorem CyclicPerm.crosses_split_at (Ω : CyclicPerm α) {a₁ b₁ a₂ b₂ z : α} + (hcross : Ω.Crosses a₁ b₁ a₂ b₂) (hz_bar : z ∈ Ω.bar) + (hza₁ : z ≠ a₁) (hzb₁ : z ≠ b₁) (hza₂ : z ≠ a₂) (hzb₂ : z ≠ b₂) : + Ω.Crosses a₁ z a₂ b₂ ∨ Ω.Crosses z b₁ a₂ b₂ := by + have hsplit : ∀ {u v : α}, Ω.Crosses u v a₂ b₂ → z ∈ Ω.interval u v → + Ω.Crosses u z a₂ b₂ ∨ Ω.Crosses z v a₂ b₂ := by + intro u v hc hz_uv + have hv_zu : v ∈ Ω.interval z u := Ω.mem_interval_rotate_left hz_uv + have hu_vz : u ∈ Ω.interval v z := Ω.mem_interval_rotate_right hz_uv + have hsub_zu : Ω.interval v u ⊆ Ω.interval z u := Ω.interval_subset_interval_right hv_zu + have hsub_vz : Ω.interval v u ⊆ Ω.interval v z := Ω.interval_subset_interval_left hu_vz + have hunion := Ω.interval_eq_union_of_mem hz_uv + rw [Ω.crosses_iff_interval] at hc + rcases hc with ⟨hx_uv, hy_vu⟩ | ⟨hy_uv, hx_vu⟩ + · rw [hunion] at hx_uv + rcases hx_uv with (hx_uz | hxz) | hx_zv + · exact Or.inl (Ω.crosses_iff_interval.mpr (Or.inl ⟨hx_uz, hsub_zu hy_vu⟩)) + · rw [mem_singleton_iff] at hxz + exact (hza₂ hxz.symm).elim + · exact Or.inr (Ω.crosses_iff_interval.mpr (Or.inl ⟨hx_zv, hsub_vz hy_vu⟩)) + · rw [hunion] at hy_uv + rcases hy_uv with (hy_uz | hyz) | hy_zv + · exact Or.inl (Ω.crosses_iff_interval.mpr (Or.inr ⟨hy_uz, hsub_zu hx_vu⟩)) + · rw [mem_singleton_iff] at hyz + exact (hzb₂ hyz.symm).elim + · exact Or.inr (Ω.crosses_iff_interval.mpr (Or.inr ⟨hy_zv, hsub_vz hx_vu⟩)) + have ha₁_bar : a₁ ∈ Ω.bar := by + rcases Ω.crosses_iff_interval.mp hcross with ⟨h, _⟩ | ⟨h, _⟩ <;> + exact (Ω.isClockwise3_iff.mp h.2).2.2.2.1 + have hb₁_bar : b₁ ∈ Ω.bar := by + rcases Ω.crosses_iff_interval.mp hcross with ⟨h, _⟩ | ⟨h, _⟩ <;> + exact (Ω.isClockwise3_iff.mp h.2).2.2.2.2.2.1 + rcases Ω.mem_interval_or_interval_swap ha₁_bar hb₁_bar hz_bar hcross.ne_ends.1 hza₁ hzb₁ with + hz_ab | hz_ba + · exact hsplit hcross hz_ab + · rcases hsplit hcross.swap_left hz_ba with h1 | h2 + · exact Or.inr h1.swap_left + · exact Or.inl h2.swap_left + +/-- Any path `Q₁` in `S'.G` from `a₁` to `b₁` whose ends cross `{a₂, b₂}` (with `a₂, b₂ ∉ V(Q₁)`) +contains a subpath `Q₁' ≤ Q₁` with ends `a₁', b₁' ∈ S'.Ω.bar` that still cross `{a₂, b₂}` and has +`V(Q₁') ∩ S'.Ω.bar = {a₁', b₁'}`. -/ +theorem Society.exists_subpath_crosses_disjoint_bar (S' : Society α β) + {Q₁ : Graph α β} {a₁ b₁ a₂ b₂ : α} + (hQ₁ : IsGraphPathWithEnds S'.G Q₁ a₁ b₁) + (ha₂_not : a₂ ∉ V(Q₁)) (hb₂_not : b₂ ∉ V(Q₁)) + (hcross : S'.Ω.Crosses a₁ b₁ a₂ b₂) : + ∃ Q₁' : Graph α β, ∃ a₁' b₁' : α, + Q₁' ≤ Q₁ ∧ + IsGraphPathWithEnds S'.G Q₁' a₁' b₁' ∧ + V(Q₁') ∩ S'.Ω.bar = {a₁', b₁'} ∧ + S'.Ω.Crosses a₁' b₁' a₂ b₂ := by + classical + have hind : ∀ (n : ℕ) {P : Graph α β} {u v : α}, + P ≤ Q₁ → IsGraphPathWithEnds S'.G P u v → V(P).ncard = n → + S'.Ω.Crosses u v a₂ b₂ → + ∃ Q₁' : Graph α β, ∃ a₁' b₁' : α, + Q₁' ≤ P ∧ + IsGraphPathWithEnds S'.G Q₁' a₁' b₁' ∧ + V(Q₁') ∩ S'.Ω.bar = {a₁', b₁'} ∧ + S'.Ω.Crosses a₁' b₁' a₂ b₂ := by + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro P u v hPQ₁ hP hcard hc + by_cases hhit : ∃ z ∈ V(P) ∩ S'.Ω.bar, z ≠ u ∧ z ≠ v + · obtain ⟨z, ⟨hzP, hz_bar⟩, hzu, hzv⟩ := hhit + have hza₂ : z ≠ a₂ := fun h => ha₂_not (h ▸ hPQ₁.vertexSet_mono hzP) + have hzb₂ : z ≠ b₂ := fun h => hb₂_not (h ▸ hPQ₁.vertexSet_mono hzP) + obtain ⟨P₁, P₂, hP₁P, hP₂P, hpath₁, hpath₂, _, hinter, _⟩ := hP.exists_split_at hzP + have hv_not_P₁ : v ∉ V(P₁) := by + intro hv₁ + have : v ∈ V(P₁) ∩ V(P₂) := ⟨hv₁, hpath₂.right_mem⟩ + rw [hinter, mem_singleton_iff] at this + exact hzv this.symm + have hu_not_P₂ : u ∉ V(P₂) := by + intro hu₂ + have : u ∈ V(P₁) ∩ V(P₂) := ⟨hpath₁.left_mem, hu₂⟩ + rw [hinter, mem_singleton_iff] at this + exact hzu this.symm + have hlt₁ : V(P₁).ncard < n := by + rw [← hcard] + exact ncard_lt_ncard ⟨hP₁P.vertexSet_mono, fun h => hv_not_P₁ (h hP.right_mem)⟩ + hP.vertexSet_finite + have hlt₂ : V(P₂).ncard < n := by + rw [← hcard] + exact ncard_lt_ncard ⟨hP₂P.vertexSet_mono, fun h => hu_not_P₂ (h hP.left_mem)⟩ + hP.vertexSet_finite + rcases S'.Ω.crosses_split_at hc hz_bar hzu hzv hza₂ hzb₂ with hc₁ | hc₂ + · obtain ⟨Q', a', b', hQ'P₁, hQ', hQ'_bar, hc'⟩ := + ih V(P₁).ncard hlt₁ (hP₁P.trans hPQ₁) (hpath₁.mono hP.le) rfl hc₁ + exact ⟨Q', a', b', hQ'P₁.trans hP₁P, hQ', hQ'_bar, hc'⟩ + · obtain ⟨Q', a', b', hQ'P₂, hQ', hQ'_bar, hc'⟩ := + ih V(P₂).ncard hlt₂ (hP₂P.trans hPQ₁) (hpath₂.mono hP.le) rfl hc₂ + exact ⟨Q', a', b', hQ'P₂.trans hP₂P, hQ', hQ'_bar, hc'⟩ + · have hu_bar : u ∈ S'.Ω.bar := by + rcases S'.Ω.crosses_iff_interval.mp hc with ⟨h, _⟩ | ⟨h, _⟩ <;> + exact (S'.Ω.isClockwise3_iff.mp h.2).2.2.2.1 + have hv_bar : v ∈ S'.Ω.bar := by + rcases S'.Ω.crosses_iff_interval.mp hc with ⟨h, _⟩ | ⟨h, _⟩ <;> + exact (S'.Ω.isClockwise3_iff.mp h.2).2.2.2.2.2.1 + refine ⟨P, u, v, le_rfl, hP, ?_, hc⟩ + ext z + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨hzP, hz_bar⟩ + by_contra! hne + exact hhit ⟨z, ⟨hzP, hz_bar⟩, hne.1, hne.2⟩ + · rintro (rfl | rfl) + · exact ⟨hP.left_mem, hu_bar⟩ + · exact ⟨hP.right_mem, hv_bar⟩ + exact hind V(Q₁).ncard le_rfl hQ₁ rfl hcross + +/-- If a society `S'` has a cross, then it has a reduced cross `(P₁, P₂)` where neither `P₁` nor +`P₂` has any internal vertex in `S'.Ω.bar`. -/ +theorem Society.exists_reduced_cross_of_isCross (S' : Society α β) {Q₁ Q₂ : Graph α β} + (hcross : S'.IsCross Q₁ Q₂) : + ∃ P₁ P₂ : Graph α β, ∃ s₁ t₁ s₂ t₂ : α, + Disjoint V(P₁) V(P₂) ∧ + IsGraphPathWithEnds S'.G P₁ s₁ t₁ ∧ + IsGraphPathWithEnds S'.G P₂ s₂ t₂ ∧ + V(P₁) ∩ S'.Ω.bar = {s₁, t₁} ∧ + V(P₂) ∩ S'.Ω.bar = {s₂, t₂} ∧ + S'.Ω.Crosses s₁ t₁ s₂ t₂ := by + rcases hcross with ⟨hdisj, a₁, b₁, a₂, b₂, hQ₁, hQ₂, hc⟩ + have ha₂_not : a₂ ∉ V(Q₁) := fun h => disjoint_left.mp hdisj h hQ₂.1.left_mem + have hb₂_not : b₂ ∉ V(Q₁) := fun h => disjoint_left.mp hdisj h hQ₂.1.right_mem + obtain ⟨P₁, s₁, t₁, hP₁Q₁, hP₁, hP₁_bar, hc₁⟩ := + S'.exists_subpath_crosses_disjoint_bar hQ₁.1 ha₂_not hb₂_not hc + have hdisj₁ : Disjoint V(P₁) V(Q₂) := hdisj.mono_left hP₁Q₁.vertexSet_mono + have hs₁_not : s₁ ∉ V(Q₂) := fun h => disjoint_left.mp hdisj₁ hP₁.left_mem h + have ht₁_not : t₁ ∉ V(Q₂) := fun h => disjoint_left.mp hdisj₁ hP₁.right_mem h + obtain ⟨P₂, s₂, t₂, hP₂Q₂, hP₂, hP₂_bar, hc₂⟩ := + S'.exists_subpath_crosses_disjoint_bar hQ₂.1 hs₁_not ht₁_not hc₁.symm + exact ⟨P₁, P₂, s₁, t₁, s₂, t₂, hdisj₁.mono_right hP₂Q₂.vertexSet_mono, + hP₁, hP₂, hP₁_bar, hP₂_bar, hc₂.symm⟩ + +/-- In a society `S' = (G', ofNodupList L hnd hne)`, any cross yields a reduced cross with +ordered indices `0 ≤ i₁ < i₂ < j₁ < j₂ < L.length`. -/ +theorem exists_ordered_reduced_cross_of_ofNodupList {G' : Graph α β} {L : List α} + (hnd : L.Nodup) (hne : L ≠ []) + {S' : Society α β} (hG' : S'.G = G') (hΩ' : S'.Ω = CyclicPerm.ofNodupList L hnd hne) + {Q₁ Q₂ : Graph α β} (hcross : S'.IsCross Q₁ Q₂) : + ∃ P₁ P₂ : Graph α β, ∃ i₁ j₁ i₂ j₂ : ℕ, + ∃ (hi₁ : i₁ < L.length) (hj₁ : j₁ < L.length) + (hi₂ : i₂ < L.length) (hj₂ : j₂ < L.length), + i₁ < i₂ ∧ i₂ < j₁ ∧ j₁ < j₂ ∧ + Disjoint V(P₁) V(P₂) ∧ + IsGraphPathWithEnds G' P₁ (L[i₁]'hi₁) (L[j₁]'hj₁) ∧ + IsGraphPathWithEnds G' P₂ (L[i₂]'hi₂) (L[j₂]'hj₂) ∧ + V(P₁) ∩ {x | x ∈ L} = {L[i₁]'hi₁, L[j₁]'hj₁} ∧ + V(P₂) ∩ {x | x ∈ L} = {L[i₂]'hi₂, L[j₂]'hj₂} := by + obtain ⟨P₁, P₂, s₁, t₁, s₂, t₂, hdisj, hP₁, hP₂, hP₁_bar, hP₂_bar, hc⟩ := + S'.exists_reduced_cross_of_isCross hcross + rw [hG'] at hP₁ hP₂ + have hbar_eq : S'.Ω.bar = {x | x ∈ L} := by rw [hΩ', CyclicPerm.ofNodupList_bar] + rw [hbar_eq] at hP₁_bar hP₂_bar + have hs₁L : s₁ ∈ L := by + have : s₁ ∈ V(P₁) ∩ {x | x ∈ L} := by rw [hP₁_bar]; simp + exact this.2 + have ht₁L : t₁ ∈ L := by + have : t₁ ∈ V(P₁) ∩ {x | x ∈ L} := by rw [hP₁_bar]; simp + exact this.2 + have hs₂L : s₂ ∈ L := by + have : s₂ ∈ V(P₂) ∩ {x | x ∈ L} := by rw [hP₂_bar]; simp + exact this.2 + have ht₂L : t₂ ∈ L := by + have : t₂ ∈ V(P₂) ∩ {x | x ∈ L} := by rw [hP₂_bar]; simp + exact this.2 + obtain ⟨a₁, ha₁, rfl⟩ := List.mem_iff_getElem.mp hs₁L + obtain ⟨b₁, hb₁, rfl⟩ := List.mem_iff_getElem.mp ht₁L + obtain ⟨a₂, ha₂, rfl⟩ := List.mem_iff_getElem.mp hs₂L + obtain ⟨b₂, hb₂, rfl⟩ := List.mem_iff_getElem.mp ht₂L + have hab₁_ne : a₁ ≠ b₁ := fun h => by subst h; exact hc.ne_ends.1 rfl + have hab₂_ne : a₂ ≠ b₂ := fun h => by subst h; exact hc.ne_ends.2 rfl + -- First orient `P₁` so `i₁ < j₁`, and `P₂` so `i₂ < j₂`. + have horient₁ : ∃ i₁ j₁ : ℕ, ∃ (hi₁ : i₁ < L.length) (hj₁ : j₁ < L.length), + i₁ < j₁ ∧ + IsGraphPathWithEnds G' P₁ (L[i₁]'hi₁) (L[j₁]'hj₁) ∧ + V(P₁) ∩ {x | x ∈ L} = {L[i₁]'hi₁, L[j₁]'hj₁} ∧ + S'.Ω.Crosses (L[i₁]'hi₁) (L[j₁]'hj₁) (L[a₂]'ha₂) (L[b₂]'hb₂) := by + rcases lt_or_gt_of_ne hab₁_ne with hlt | hgt + · exact ⟨a₁, b₁, ha₁, hb₁, hlt, hP₁, hP₁_bar, hc⟩ + · exact ⟨b₁, a₁, hb₁, ha₁, hgt, hP₁.symm, by rw [pair_comm]; exact hP₁_bar, hc.swap_left⟩ + obtain ⟨i₁, j₁, hi₁, hj₁, hij₁, hP₁', hP₁_bar', hc'⟩ := horient₁ + have horient₂ : ∃ i₂ j₂ : ℕ, ∃ (hi₂ : i₂ < L.length) (hj₂ : j₂ < L.length), + i₂ < j₂ ∧ + IsGraphPathWithEnds G' P₂ (L[i₂]'hi₂) (L[j₂]'hj₂) ∧ + V(P₂) ∩ {x | x ∈ L} = {L[i₂]'hi₂, L[j₂]'hj₂} ∧ + S'.Ω.Crosses (L[i₁]'hi₁) (L[j₁]'hj₁) (L[i₂]'hi₂) (L[j₂]'hj₂) := by + rcases lt_or_gt_of_ne hab₂_ne with hlt | hgt + · exact ⟨a₂, b₂, ha₂, hb₂, hlt, hP₂, hP₂_bar, hc'⟩ + · exact ⟨b₂, a₂, hb₂, ha₂, hgt, hP₂.symm, by rw [pair_comm]; exact hP₂_bar, hc'.swap_right⟩ + obtain ⟨i₂, j₂, hi₂, hj₂, hij₂, hP₂', hP₂_bar', hc''⟩ := horient₂ + rw [hΩ', CyclicPerm.ofNodupList_crosses_iff L hnd hne hij₁ hj₁ hij₂ hj₂] at hc'' + rcases hc'' with ⟨h1, h2, h3⟩ | ⟨h1, h2, h3⟩ + · exact ⟨P₁, P₂, i₁, j₁, i₂, j₂, hi₁, hj₁, hi₂, hj₂, + h1, h2, h3, hdisj, hP₁', hP₂', hP₁_bar', hP₂_bar'⟩ + · exact ⟨P₂, P₁, i₂, j₂, i₁, j₁, hi₂, hj₂, hi₁, hj₁, + h1, h2, h3, hdisj.symm, hP₂', hP₁', hP₂_bar', hP₁_bar'⟩ + +theorem two_le_length_support_pathWalkTS {G P : Graph α β} {s t : α} + (hst : s ≠ t) (hP : IsGraphPathWithEnds G P s t) : + 2 ≤ (pathWalkTS hP).support.length := by + rcases hW : pathWalkTS hP with _ | ⟨hlink, W'⟩ + · exact (hst.symm (by rfl)).elim + · cases W' <;> simp + +theorem length_splitList (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hP : IsGraphPathWithEnds S.G P s t) : + (splitList S hs ht hP).length = + (pathWalkTS hP).support.length + (S.Ω.intervalList hs ht).length := by + simp [splitList] + +theorem getElem_splitList_of_lt (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hP : IsGraphPathWithEnds S.G P s t) + {i : ℕ} (hi : i < (pathWalkTS hP).support.length) : + (splitList S hs ht hP)[i]'(by rw [length_splitList]; omega) = + (pathWalkTS hP).support[i]'hi := by + simp [splitList, List.getElem_append_left hi] + +theorem getElem_splitList_of_le (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hP : IsGraphPathWithEnds S.G P s t) + {i : ℕ} (hmi : (pathWalkTS hP).support.length ≤ i) + (hi : i < (splitList S hs ht hP).length) : + (splitList S hs ht hP)[i]'hi = + (S.Ω.intervalList hs ht)[i - (pathWalkTS hP).support.length]'(by + rw [length_splitList] at hi; omega) := by + simp [splitList, List.getElem_append_right hmi] + +theorem getElem_splitList_zero (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hP : IsGraphPathWithEnds S.G P s t) : + (splitList S hs ht hP)[0]'(by + rw [length_splitList] + have : 0 < (pathWalkTS hP).support.length := by cases pathWalkTS hP <;> simp + omega) = t := by + have hpos : 0 < (pathWalkTS hP).support.length := by cases pathWalkTS hP <;> simp + rw [getElem_splitList_of_lt S hs ht hP hpos, support_getElem_zero] + +theorem getElem_splitList_pred (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hP : IsGraphPathWithEnds S.G P s t) : + (splitList S hs ht hP)[(pathWalkTS hP).support.length - 1]'(by + rw [length_splitList] + have : 0 < (pathWalkTS hP).support.length := by cases pathWalkTS hP <;> simp + omega) = s := by + have hpos : 0 < (pathWalkTS hP).support.length := by cases pathWalkTS hP <;> simp + have hlt : (pathWalkTS hP).support.length - 1 < (pathWalkTS hP).support.length := by omega + rw [getElem_splitList_of_lt S hs ht hP hlt, support_getElem_last] + +theorem getElem_splitList_mem_P_iff (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {i : ℕ} (hi : i < (splitList S hs ht hP).length) : + (splitList S hs ht hP)[i]'hi ∈ V(P) ↔ i < (pathWalkTS hP).support.length := by + constructor + · intro hxP + rw [vertexSet_eq_support_pathWalkTS hP, mem_ofPred_eq, List.mem_iff_getElem] at hxP + obtain ⟨k, hk, heq⟩ := hxP + have hkl : k < (splitList S hs ht hP).length := by rw [length_splitList]; omega + have heq' : (splitList S hs ht hP)[k]'hkl = (splitList S hs ht hP)[i]'hi := by + rw [getElem_splitList_of_lt S hs ht hP hk, heq] + have hik := nodup_getElem_inj (nodup_splitList S hs ht hst hP hP_bar) hkl hi heq' + omega + · intro hlt + rw [getElem_splitList_of_lt S hs ht hP hlt, vertexSet_eq_support_pathWalkTS hP] + exact List.getElem_mem hlt + +theorem getElem_splitList_mem_W1_iff (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {i : ℕ} (hi : i < (splitList S hs ht hP).length) : + (splitList S hs ht hP)[i]'hi ∈ S.Ω.interval s t ↔ + (pathWalkTS hP).support.length ≤ i := by + constructor + · intro hxW + have hxL := (S.Ω.mem_intervalList_iff hs ht hst _).mpr hxW + obtain ⟨k, hk, heq⟩ := List.mem_iff_getElem.mp hxL + have hkl : (pathWalkTS hP).support.length + k < (splitList S hs ht hP).length := by + rw [length_splitList]; omega + have heq' : (splitList S hs ht hP)[(pathWalkTS hP).support.length + k]'hkl = + (splitList S hs ht hP)[i]'hi := by + rw [getElem_splitList_of_le S hs ht hP (by omega) hkl] + simpa using heq + have hik := nodup_getElem_inj (nodup_splitList S hs ht hst hP hP_bar) hkl hi heq' + omega + · intro hmi + rw [getElem_splitList_of_le S hs ht hP hmi hi] + exact (S.Ω.mem_intervalList_iff hs ht hst _).mp (List.getElem_mem _) + +theorem exists_subpath_P_of_splitList_indices (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) + (hP : IsGraphPathWithEnds S.G P s t) + {i j : ℕ} (hij : i ≤ j) (hj : j < (pathWalkTS hP).support.length) : + ∃ Q ≤ P, + IsGraphPathWithEnds S.G Q + ((splitList S hs ht hP)[i]'(by rw [length_splitList]; omega)) + ((splitList S hs ht hP)[j]'(by rw [length_splitList]; omega)) ∧ + V(Q) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + i ≤ k ∧ k ≤ j ∧ x = (splitList S hs ht hP)[k]'(by rw [length_splitList]; omega)} := by + obtain ⟨Q, hQW, hQ, hVQ⟩ := + exists_subpath_of_support_indices (isSimple_pathWalkTS hP) hij hj + rw [walkSubgraph_pathWalkTS hP] at hQW + refine ⟨Q, hQW, ?_, ?_⟩ + · rw [getElem_splitList_of_lt S hs ht hP (by omega), getElem_splitList_of_lt S hs ht hP hj] + exact hQ.mono hP.le + · ext x + rw [hVQ] + simp only [mem_ofPred_eq] + refine ⟨fun ⟨k, hk, hik, hkj, hxk⟩ => ⟨k, hk, hik, hkj, ?_⟩, + fun ⟨k, hk, hik, hkj, hxk⟩ => ⟨k, hk, hik, hkj, ?_⟩⟩ + · rw [getElem_splitList_of_lt S hs ht hP hk, hxk] + · rw [← getElem_splitList_of_lt S hs ht hP hk, hxk] + +/-- Because `P` is an induced subgraph of `S.G` and `splitGraph` deletes `E(P)`, no edge of +`splitGraph S P s t` has both endpoints in `V(P)`. -/ +theorem not_isLink_splitGraph_of_mem_P (S : Society α β) {P : Graph α β} (s t : α) + (hP_ind : P ≤i S.G) {e : β} {x y : α} + (hlink : (splitGraph S P s t).IsLink e x y) (hx : x ∈ V(P)) (hy : y ∈ V(P)) : + False := by + rw [splitGraph_isLink_iff] at hlink + exact hlink.2.1 (hP_ind.isLink_of_mem_mem hlink.1 hx hy).edge_mem + +/-- Every path `Q` in `splitGraph S P s t` between distinct vertices `u ≠ v` contains a vertex +in `V(splitSide S.G P (S.Ω.interval s t))` (outside `V(P)`). -/ +theorem exists_vertex_in_splitSide_of_path_in_splitGraph (S : Society α β) {P : Graph α β} + {s t : α} (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) (hP_ind : P ≤i S.G) + (hcatch : Catches (S.Ω.bar \ {s, t}) (deleteVertices S.G V(P))) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) + {Q : Graph α β} {u v : α} (hQ : IsGraphPathWithEnds (splitGraph S P s t) Q u v) + (huv : u ≠ v) : + ∃ x ∈ V(Q), x ∈ V(splitSide S.G P (S.Ω.interval s t)) := by + by_contra! hsub + have hVQ_P : V(Q) ⊆ V(P) := by + intro x hxQ + have hxG₁ : x ∈ V(splitGraph S P s t) := hQ.1.vertexSet_mono hxQ + rw [vertexSet_splitGraph_eq_union S hs ht hst hP hcatch hnocross] at hxG₁ + exact hxG₁.resolve_right (hsub x hxQ) + obtain ⟨W, _, _, _⟩ := hQ.2 + cases W with + | nil _ => exact huv rfl + | @cons u w v e hlink W' => + have huP : u ∈ V(P) := hVQ_P hlink.left_mem + have hwP : w ∈ V(P) := hVQ_P hlink.right_mem + exact not_isLink_splitGraph_of_mem_P S s t hP_ind (hlink.mono hQ.1) huP hwP + +/-- Given a set `X` containing a vertex `u₀ ∈ V(splitSide S.G P (S.Ω.interval s t))`, there is +an `X → W₁` path `P₃` in `splitSide S.G P (S.Ω.interval s t)` ending at `(splitList S hs ht hP)[k]` +with `m ≤ k`, disjoint from `V(P)` and meeting `S.Ω.bar` and `splitList` only at `L[k]`. -/ +theorem exists_fromToPath_in_splitSide (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) + {X : Set α} {u₀ : α} (hu₀X : u₀ ∈ X) + (hu₀H₁ : u₀ ∈ V(splitSide S.G P (S.Ω.interval s t))) : + ∃ u ∈ X, ∃ k : ℕ, ∃ hk : k < (splitList S hs ht hP).length, + ∃ P₃ ≤ splitSide S.G P (S.Ω.interval s t), + (pathWalkTS hP).support.length ≤ k ∧ + Disjoint V(P₃) V(P) ∧ + IsFromToPathWithEnds (splitGraph S P s t) P₃ X (S.Ω.interval s t) u + ((splitList S hs ht hP)[k]'hk) ∧ + V(P₃) ∩ {x | x ∈ splitList S hs ht hP} = {(splitList S hs ht hP)[k]'hk} ∧ + V(P₃) ∩ S.Ω.bar = {(splitList S hs ht hP)[k]'hk} := by + let H₁ := splitSide S.G P (S.Ω.interval s t) + obtain ⟨w₀, ⟨hw₀W₁, _⟩, ⟨W⟩⟩ := exists_walk_in_splitSide_to_W hu₀H₁ + obtain ⟨u, huX, w, hwW₁, P₃, hP₃W, _, hP₃_ft⟩ := + exists_isFromToPathWithEnds_of_walk W hu₀X hw₀W₁ + have hP₃H₁ : P₃ ≤ H₁ := hP₃W.trans (walkSubgraph_le W) + have hdisj_P : Disjoint V(P₃) V(P) := by + rw [disjoint_left] + intro x hxP₃ + exact (hP₃H₁.vertexSet_mono hxP₃).1.2 + have hH₁_le_G₁ : H₁ ≤ splitGraph S P s t := by + have hdisj_H₁_H₂ := (lemma_2_4_H1_disjoint_H2 S hs ht hst hP hnocross).1 + refine (Compatible.of_le_le (splitSide_le S.G P (S.Ω.interval s t)) + (splitGraph_le S P s t)).le_iff.mpr ⟨?_, ?_⟩ + · intro x hxH₁ + exact ⟨hxH₁.1.1, disjoint_left.mp hdisj_H₁_H₂ hxH₁⟩ + · intro e heH₁ + obtain ⟨x, y, hxy⟩ := H₁.exists_isLink_of_mem_edgeSet heH₁ + have hxH₁ := hxy.left_mem + have hyH₁ := hxy.right_mem + have hxyG : S.G.IsLink e x y := hxy.mono (splitSide_le S.G P (S.Ω.interval s t)) + have he_not_P : e ∉ E(P) := by + intro heP + obtain ⟨a, b, habP⟩ := P.exists_isLink_of_mem_edgeSet heP + have habG : S.G.IsLink e a b := habP.mono hP.1 + rcases hxyG.eq_and_eq_or_eq_and_eq habG with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hxH₁.1.2 habP.left_mem + · exact hxH₁.1.2 habP.right_mem + have hxyG₁ : (splitGraph S P s t).IsLink e x y := by + rw [splitGraph_isLink_iff] + exact ⟨hxyG, he_not_P, disjoint_left.mp hdisj_H₁_H₂ hxH₁, + disjoint_left.mp hdisj_H₁_H₂ hyH₁⟩ + exact hxyG₁.edge_mem + have hwL : w ∈ S.Ω.intervalList hs ht := (S.Ω.mem_intervalList_iff hs ht hst w).mpr hwW₁ + obtain ⟨idx, hidx, hwk⟩ := List.mem_iff_getElem.mp hwL + let k := (pathWalkTS hP).support.length + idx + have hk : k < (splitList S hs ht hP).length := by + rw [length_splitList]; omega + have hmk : (pathWalkTS hP).support.length ≤ k := by omega + have hLk : (splitList S hs ht hP)[k]'hk = w := by + rw [getElem_splitList_of_le S hs ht hP hmk hk] + simpa [k] using hwk + have hP₃_G₁ : IsFromToPathWithEnds (splitGraph S P s t) P₃ X (S.Ω.interval s t) u w := + ⟨hP₃_ft.1.mono hH₁_le_G₁, hP₃_ft.2⟩ + have hP₃_L : V(P₃) ∩ {x | x ∈ splitList S hs ht hP} = {w} := by + ext x + simp only [mem_inter_iff, mem_ofPred_eq, mem_singleton_iff] + constructor + · rintro ⟨hxP₃, hxL⟩ + rw [splitList, List.mem_append, S.Ω.mem_intervalList_iff hs ht hst] at hxL + rcases hxL with hxP | hxW₁ + · have hxP' : x ∈ V(P) := by rw [vertexSet_eq_support_pathWalkTS hP]; exact hxP + exact (disjoint_left.mp hdisj_P hxP₃ hxP').elim + · have hx_in : x ∈ V(P₃) ∩ S.Ω.interval s t := ⟨hxP₃, hxW₁⟩ + rwa [hP₃_ft.2.2, mem_singleton_iff] at hx_in + · rintro rfl + exact ⟨hP₃_ft.1.right_mem, List.mem_append_right _ hwL⟩ + have hP₃_bar : V(P₃) ∩ S.Ω.bar = {w} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hxP₃, hx_bar⟩ + have hxH₁ : x ∈ V(H₁) := hP₃H₁.vertexSet_mono hxP₃ + have hxs : x ≠ s := fun h => hxH₁.1.2 (h ▸ hP.left_mem) + have hxt : x ≠ t := fun h => hxH₁.1.2 (h ▸ hP.right_mem) + rcases S.Ω.mem_interval_or_interval_swap hs ht hx_bar hst hxs hxt with hxW₁ | hxW₂ + · have hx_in : x ∈ V(P₃) ∩ S.Ω.interval s t := ⟨hxP₃, hxW₁⟩ + rwa [hP₃_ft.2.2, mem_singleton_iff] at hx_in + · have hxH₂ : x ∈ V(splitSide S.G P (S.Ω.interval t s)) := + mem_vertexSet_splitSide_of_mem_W (S.bar_subset hx_bar) hxH₁.1.2 hxW₂ + exact (disjoint_left.mp (lemma_2_4_H1_disjoint_H2 S hs ht hst hP hnocross).1 + hxH₁ hxH₂).elim + · rintro rfl + exact ⟨hP₃_ft.1.right_mem, hwW₁.1.1⟩ + refine ⟨u, huX, k, hk, P₃, hP₃H₁, hmk, hdisj_P, ?_, ?_, ?_⟩ + · rwa [hLk] + · rwa [hLk] + · rwa [hLk] + +theorem subpath_P_subset_splitList (S : Society α β) {P Q : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hP : IsGraphPathWithEnds S.G P s t) + {a b : ℕ} + (hVQ : V(Q) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + a ≤ k ∧ k ≤ b ∧ x = (splitList S hs ht hP)[k]'(by rw [length_splitList]; omega)}) : + V(Q) ⊆ {x | x ∈ splitList S hs ht hP} := by + intro x hx + rw [hVQ, mem_ofPred_eq] at hx + obtain ⟨k, hk, _, _, rfl⟩ := hx + exact List.getElem_mem _ + +theorem mem_subpath_P_iff (S : Society α β) {P Q : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {a b : ℕ} (hb : b < (pathWalkTS hP).support.length) + (hVQ : V(Q) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + a ≤ k ∧ k ≤ b ∧ x = (splitList S hs ht hP)[k]'(by rw [length_splitList]; omega)}) + {idx : ℕ} (hidx : idx < (splitList S hs ht hP).length) : + (splitList S hs ht hP)[idx]'hidx ∈ V(Q) ↔ a ≤ idx ∧ idx ≤ b := by + rw [hVQ, mem_ofPred_eq] + constructor + · rintro ⟨k, hk, hak, hkb, heq⟩ + have hkl : k < (splitList S hs ht hP).length := by rw [length_splitList]; omega + have hik := nodup_getElem_inj (nodup_splitList S hs ht hst hP hP_bar) hidx hkl heq + omega + · rintro ⟨ha, hb'⟩ + exact ⟨idx, by omega, ha, hb', rfl⟩ + +theorem disjoint_subpath_P_of_inter_pair (S : Society α β) {P Q : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {a b i j : ℕ} (hb : b < (pathWalkTS hP).support.length) + (hi : i < (splitList S hs ht hP).length) (hj : j < (splitList S hs ht hP).length) + (hVQ : V(Q) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + a ≤ k ∧ k ≤ b ∧ x = (splitList S hs ht hP)[k]'(by rw [length_splitList]; omega)}) + {A : Set α} + (hA : A ∩ {x | x ∈ splitList S hs ht hP} = + {(splitList S hs ht hP)[i]'hi, (splitList S hs ht hP)[j]'hj}) + (hni : ¬ (a ≤ i ∧ i ≤ b)) (hnj : ¬ (a ≤ j ∧ j ≤ b)) : + Disjoint A V(Q) := by + rw [disjoint_left] + intro x hxA hxQ + have hxL : x ∈ {y | y ∈ splitList S hs ht hP} := + subpath_P_subset_splitList S hs ht hP hVQ hxQ + have hx_pair : x ∈ A ∩ {y | y ∈ splitList S hs ht hP} := ⟨hxA, hxL⟩ + rw [hA, mem_insert_iff, mem_singleton_iff] at hx_pair + rcases hx_pair with rfl | rfl + · exact hni ((mem_subpath_P_iff S hs ht hst hP hP_bar hb hVQ hi).mp hxQ) + · exact hnj ((mem_subpath_P_iff S hs ht hst hP hP_bar hb hVQ hj).mp hxQ) + +theorem inter_subpath_P_eq_left_of_inter_pair (S : Society α β) {P Q : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {a b i j : ℕ} (hb : b < (pathWalkTS hP).support.length) + (hi : i < (splitList S hs ht hP).length) (hj : j < (splitList S hs ht hP).length) + (hVQ : V(Q) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + a ≤ k ∧ k ≤ b ∧ x = (splitList S hs ht hP)[k]'(by rw [length_splitList]; omega)}) + {A : Set α} + (hA : A ∩ {x | x ∈ splitList S hs ht hP} = + {(splitList S hs ht hP)[i]'hi, (splitList S hs ht hP)[j]'hj}) + (hi_in : a ≤ i ∧ i ≤ b) (hnj : ¬ (a ≤ j ∧ j ≤ b)) : + V(Q) ∩ A = {(splitList S hs ht hP)[i]'hi} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hxQ, hxA⟩ + have hxL : x ∈ {y | y ∈ splitList S hs ht hP} := + subpath_P_subset_splitList S hs ht hP hVQ hxQ + have hx_pair : x ∈ A ∩ {y | y ∈ splitList S hs ht hP} := ⟨hxA, hxL⟩ + rw [hA, mem_insert_iff, mem_singleton_iff] at hx_pair + rcases hx_pair with rfl | rfl + · rfl + · exact (hnj ((mem_subpath_P_iff S hs ht hst hP hP_bar hb hVQ hj).mp hxQ)).elim + · rintro rfl + have hiA : (splitList S hs ht hP)[i]'hi ∈ A ∩ {y | y ∈ splitList S hs ht hP} := by + rw [hA]; simp + exact ⟨(mem_subpath_P_iff S hs ht hst hP hP_bar hb hVQ hi).mpr hi_in, hiA.1⟩ + +theorem disjoint_subpath_P_subpath_P (S : Society α β) {P Q₁ Q₂ : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {a₁ b₁ a₂ b₂ : ℕ} + (hb₂ : b₂ < (pathWalkTS hP).support.length) (hlt : b₁ < a₂) + (hVQ₁ : V(Q₁) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + a₁ ≤ k ∧ k ≤ b₁ ∧ x = (splitList S hs ht hP)[k]'(by rw [length_splitList]; omega)}) + (hVQ₂ : V(Q₂) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + a₂ ≤ k ∧ k ≤ b₂ ∧ x = (splitList S hs ht hP)[k]'(by rw [length_splitList]; omega)}) : + Disjoint V(Q₁) V(Q₂) := by + rw [disjoint_left] + intro x hx₁ hx₂ + rw [hVQ₁, mem_ofPred_eq] at hx₁ + obtain ⟨k, hk, _, hkb₁, rfl⟩ := hx₁ + have hkl : k < (splitList S hs ht hP).length := by rw [length_splitList]; omega + have hk₂ := (mem_subpath_P_iff S hs ht hst hP hP_bar hb₂ hVQ₂ hkl).mp hx₂ + omega + +/-- Case `r ≥ 2` of `(2.4)` (`lemma_2_4_no_cross`): no reduced cross `(P₁, P₂)` in `(G₁, Ω₁)` +with indices `0 ≤ i₁ < i₂ < j₁ < j₂ < L.length` can have `m ≤ j₁` (at least two endpoints +in `W₁`). -/ +theorem no_reduced_cross_of_two_in_W1 (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) + {P₁ P₂ : Graph α β} {i₁ j₁ i₂ j₂ : ℕ} + (hi₁ : i₁ < (splitList S hs ht hP).length) + (hj₁ : j₁ < (splitList S hs ht hP).length) + (hi₂ : i₂ < (splitList S hs ht hP).length) + (hj₂ : j₂ < (splitList S hs ht hP).length) + (h12 : i₁ < i₂) (h21 : i₂ < j₁) (h12' : j₁ < j₂) + (hdisj : Disjoint V(P₁) V(P₂)) + (hP₁ : IsGraphPathWithEnds (splitGraph S P s t) P₁ + ((splitList S hs ht hP)[i₁]'hi₁) ((splitList S hs ht hP)[j₁]'hj₁)) + (hP₂ : IsGraphPathWithEnds (splitGraph S P s t) P₂ + ((splitList S hs ht hP)[i₂]'hi₂) ((splitList S hs ht hP)[j₂]'hj₂)) + (hP₁_L : V(P₁) ∩ {x | x ∈ splitList S hs ht hP} = + {(splitList S hs ht hP)[i₁]'hi₁, (splitList S hs ht hP)[j₁]'hj₁}) + (hP₂_L : V(P₂) ∩ {x | x ∈ splitList S hs ht hP} = + {(splitList S hs ht hP)[i₂]'hi₂, (splitList S hs ht hP)[j₂]'hj₂}) + (hmj₁ : (pathWalkTS hP).support.length ≤ j₁) : + False := by + let m := (pathWalkTS hP).support.length + have hm2 : 2 ≤ m := two_le_length_support_pathWalkTS hst hP + have hP₁G : IsGraphPathWithEnds S.G P₁ + ((splitList S hs ht hP)[i₁]'hi₁) ((splitList S hs ht hP)[j₁]'hj₁) := + hP₁.mono (splitGraph_le S P s t) + have hP₂G : IsGraphPathWithEnds S.G P₂ + ((splitList S hs ht hP)[i₂]'hi₂) ((splitList S hs ht hP)[j₂]'hj₂) := + hP₂.mono (splitGraph_le S P s t) + by_cases hmi₁ : m ≤ i₁ + · -- Subcase 1a: all 4 endpoints in `W₁`. + have hc : S.Ω.Crosses + ((splitList S hs ht hP)[i₁]'hi₁) ((splitList S hs ht hP)[j₁]'hj₁) + ((splitList S hs ht hP)[i₂]'hi₂) ((splitList S hs ht hP)[j₂]'hj₂) := by + rw [getElem_splitList_of_le S hs ht hP hmi₁ hi₁, + getElem_splitList_of_le S hs ht hP hmj₁ hj₁, + getElem_splitList_of_le S hs ht hP (by omega) hi₂, + getElem_splitList_of_le S hs ht hP (by omega) hj₂] + exact S.Ω.crosses_intervalList_of_lt hs ht hst (by omega) (by omega) (by omega) + (by rw [length_splitList] at hj₂; omega) + have hbar₁ : (splitList S hs ht hP)[i₁]'hi₁ ∈ S.Ω.bar := + ((getElem_splitList_mem_W1_iff S hs ht hst hP hP_bar hi₁).mpr hmi₁).1.1 + have hbar₁' : (splitList S hs ht hP)[j₁]'hj₁ ∈ S.Ω.bar := + ((getElem_splitList_mem_W1_iff S hs ht hst hP hP_bar hj₁).mpr hmj₁).1.1 + have hbar₂ : (splitList S hs ht hP)[i₂]'hi₂ ∈ S.Ω.bar := + ((getElem_splitList_mem_W1_iff S hs ht hst hP hP_bar hi₂).mpr (by omega)).1.1 + have hbar₂' : (splitList S hs ht hP)[j₂]'hj₂ ∈ S.Ω.bar := + ((getElem_splitList_mem_W1_iff S hs ht hst hP hP_bar hj₂).mpr (by omega)).1.1 + exact hnocross ⟨P₁, P₂, hdisj, _, _, _, _, + ⟨hP₁G, hc.ne_ends.1, hbar₁, hbar₁'⟩, ⟨hP₂G, hc.ne_ends.2, hbar₂, hbar₂'⟩, hc⟩ + · have hmi₁' : i₁ < m := Nat.lt_of_not_ge hmi₁ + obtain ⟨Q₀, _, hQ₀, hVQ₀⟩ := + exists_subpath_P_of_splitList_indices S hs ht hP (Nat.zero_le i₁) hmi₁' + have hQ₀_P₁ : V(Q₀) ∩ V(P₁) = {(splitList S hs ht hP)[i₁]'hi₁} := + inter_subpath_P_eq_left_of_inter_pair S hs ht hst hP hP_bar hmi₁' hi₁ hj₁ hVQ₀ hP₁_L + ⟨Nat.zero_le i₁, le_rfl⟩ (by omega) + have hR₁_path : IsGraphPathWithEnds S.G (subgraphUnion S.G Q₀ P₁) t + ((splitList S hs ht hP)[j₁]'hj₁) := by + have h := hQ₀.subgraphUnion hP₁G hQ₀_P₁ + rwa [getElem_splitList_zero S hs ht hP] at h + have hdisj_P₂_Q₀ : Disjoint V(P₂) V(Q₀) := + disjoint_subpath_P_of_inter_pair S hs ht hst hP hP_bar hmi₁' hi₂ hj₂ hVQ₀ hP₂_L + (by omega) (by omega) + have hbar₁' : (splitList S hs ht hP)[j₁]'hj₁ ∈ S.Ω.bar := + ((getElem_splitList_mem_W1_iff S hs ht hst hP hP_bar hj₁).mpr hmj₁).1.1 + have hbar₂' : (splitList S hs ht hP)[j₂]'hj₂ ∈ S.Ω.bar := + ((getElem_splitList_mem_W1_iff S hs ht hst hP hP_bar hj₂).mpr (by omega)).1.1 + by_cases hmi₂ : m ≤ i₂ + · -- Subcase 1b: `i₁ < m ≤ i₂ < j₁ < j₂`. + have hdisj_R₁_P₂ : Disjoint V(subgraphUnion S.G Q₀ P₁) V(P₂) := by + rw [vertexSet_subgraphUnion] + exact Disjoint.union_left hdisj_P₂_Q₀.symm hdisj + have hc : S.Ω.Crosses t ((splitList S hs ht hP)[j₁]'hj₁) + ((splitList S hs ht hP)[i₂]'hi₂) ((splitList S hs ht hP)[j₂]'hj₂) := by + rw [getElem_splitList_of_le S hs ht hP hmj₁ hj₁, + getElem_splitList_of_le S hs ht hP hmi₂ hi₂, + getElem_splitList_of_le S hs ht hP (by omega) hj₂] + exact S.Ω.crosses_t_intervalList_of_lt hs ht hst (by omega) (by omega) + (by rw [length_splitList] at hj₂; omega) + have hbar₂ : (splitList S hs ht hP)[i₂]'hi₂ ∈ S.Ω.bar := + ((getElem_splitList_mem_W1_iff S hs ht hst hP hP_bar hi₂).mpr hmi₂).1.1 + exact hnocross ⟨subgraphUnion S.G Q₀ P₁, P₂, hdisj_R₁_P₂, _, _, _, _, + ⟨hR₁_path, hc.ne_ends.1, ht, hbar₁'⟩, ⟨hP₂G, hc.ne_ends.2, hbar₂, hbar₂'⟩, hc⟩ + · -- Subcase 1c: `i₁ < i₂ < m ≤ j₁ < j₂`. + have hmi₂' : i₂ < m := Nat.lt_of_not_ge hmi₂ + have hm_pred : m - 1 < m := by omega + obtain ⟨Q₁, _, hQ₁, hVQ₁⟩ := + exists_subpath_P_of_splitList_indices S hs ht hP (by omega : i₂ ≤ m - 1) hm_pred + have hQ₁_P₂ : V(Q₁) ∩ V(P₂) = {(splitList S hs ht hP)[i₂]'hi₂} := + inter_subpath_P_eq_left_of_inter_pair S hs ht hst hP hP_bar hm_pred hi₂ hj₂ hVQ₁ hP₂_L + ⟨le_rfl, by omega⟩ (by omega) + have hR₂_path : IsGraphPathWithEnds S.G (subgraphUnion S.G Q₁ P₂) s + ((splitList S hs ht hP)[j₂]'hj₂) := by + have h := (hQ₁.symm).subgraphUnion hP₂G hQ₁_P₂ + rwa [getElem_splitList_pred S hs ht hP] at h + have hdisj_P₁_Q₁ : Disjoint V(P₁) V(Q₁) := + disjoint_subpath_P_of_inter_pair S hs ht hst hP hP_bar hm_pred hi₁ hj₁ hVQ₁ hP₁_L + (by omega) (by omega) + have hdisj_Q₀_Q₁ : Disjoint V(Q₀) V(Q₁) := + disjoint_subpath_P_subpath_P S hs ht hst hP hP_bar hm_pred h12 hVQ₀ hVQ₁ + have hdisj_R₁_R₂ : Disjoint V(subgraphUnion S.G Q₀ P₁) V(subgraphUnion S.G Q₁ P₂) := by + rw [vertexSet_subgraphUnion, vertexSet_subgraphUnion] + exact Disjoint.union_left (Disjoint.union_right hdisj_Q₀_Q₁ hdisj_P₂_Q₀.symm) + (Disjoint.union_right hdisj_P₁_Q₁ hdisj) + have hc : S.Ω.Crosses t ((splitList S hs ht hP)[j₁]'hj₁) + s ((splitList S hs ht hP)[j₂]'hj₂) := by + rw [getElem_splitList_of_le S hs ht hP hmj₁ hj₁, + getElem_splitList_of_le S hs ht hP (by omega) hj₂] + exact S.Ω.crosses_t_s_intervalList_of_lt hs ht hst (by omega) + (by rw [length_splitList] at hj₂; omega) + exact hnocross ⟨subgraphUnion S.G Q₀ P₁, subgraphUnion S.G Q₁ P₂, hdisj_R₁_R₂, _, _, _, _, + ⟨hR₁_path, hc.ne_ends.1, ht, hbar₁'⟩, ⟨hR₂_path, hc.ne_ends.2, hs, hbar₂'⟩, hc⟩ + +theorem inter_left_of_split {P P_a P_b : Graph α β} {A : Set α} {a b u : α} + (hPa : P_a ≤ P) (hinter : V(P_a) ∩ V(P_b) = {u}) + (ha : a ∈ V(P_a)) (hb : b ∈ V(P_b)) (hub : u ≠ b) + (hPA : V(P) ∩ A = {a, b}) : + V(P_a) ∩ A = {a} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hxPa, hxA⟩ + have hx_in : x ∈ V(P) ∩ A := ⟨hPa.vertexSet_mono hxPa, hxA⟩ + rw [hPA, mem_insert_iff, mem_singleton_iff] at hx_in + rcases hx_in with hxa | hxb + · exact hxa + · subst hxb + have hb_in : x ∈ V(P_a) ∩ V(P_b) := ⟨hxPa, hb⟩ + rw [hinter, mem_singleton_iff] at hb_in + exact (hub hb_in.symm).elim + · rintro rfl + have ha_in : x ∈ V(P) ∩ A := by rw [hPA]; simp + exact ⟨ha, ha_in.2⟩ + +theorem inter_right_of_split {P P_a P_b : Graph α β} {A : Set α} {a b u : α} + (hPb : P_b ≤ P) (hinter : V(P_a) ∩ V(P_b) = {u}) + (ha : a ∈ V(P_a)) (hb : b ∈ V(P_b)) (hua : u ≠ a) + (hPA : V(P) ∩ A = {a, b}) : + V(P_b) ∩ A = {b} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hxPb, hxA⟩ + have hx_in : x ∈ V(P) ∩ A := ⟨hPb.vertexSet_mono hxPb, hxA⟩ + rw [hPA, mem_insert_iff, mem_singleton_iff] at hx_in + rcases hx_in with hxa | hxb + · subst hxa + have ha_in : x ∈ V(P_a) ∩ V(P_b) := ⟨ha, hxPb⟩ + rw [hinter, mem_singleton_iff] at ha_in + exact (hua ha_in.symm).elim + · exact hxb + · rintro rfl + have hb_in : x ∈ V(P) ∩ A := by rw [hPA]; simp + exact ⟨hb, hb_in.2⟩ + +/-- Three pairwise vertex-disjoint `X → Y` paths `R₁, R₂, R₃` in `G` from distinct `s₁, s₂, s₃ ∈ X` +to `t₁, t₂, t₃ ∈ Y` witness `RedirectsTo G X Y {s₁, s₂, s₃} {t₁, t₂, t₃}`. -/ +theorem redirectsTo_of_three_disjoint_paths {α : Type u} {β : Type v} + {G R₁ R₂ R₃ : Graph α β} {X Y : Set α} + {s₁ s₂ s₃ t₁ t₂ t₃ : α} + (hs₁ : s₁ ∈ X) (hs₂ : s₂ ∈ X) (hs₃ : s₃ ∈ X) + (ht₁ : t₁ ∈ Y) (ht₂ : t₂ ∈ Y) (ht₃ : t₃ ∈ Y) + (hs12 : s₁ ≠ s₂) (hs13 : s₁ ≠ s₃) (hs23 : s₂ ≠ s₃) + (hR₁ : IsFromToPathWithEnds G R₁ X Y s₁ t₁) + (hR₂ : IsFromToPathWithEnds G R₂ X Y s₂ t₂) + (hR₃ : IsFromToPathWithEnds G R₃ X Y s₃ t₃) + (hd12 : Disjoint V(R₁) V(R₂)) + (hd13 : Disjoint V(R₁) V(R₃)) + (hd23 : Disjoint V(R₂) V(R₃)) : + RedirectsTo G X Y {s₁, s₂, s₃} {t₁, t₂, t₃} := by + classical + have ht12 : t₁ ≠ t₂ := fun h => disjoint_left.mp hd12 hR₁.1.right_mem (h ▸ hR₂.1.right_mem) + have ht13 : t₁ ≠ t₃ := fun h => disjoint_left.mp hd13 hR₁.1.right_mem (h ▸ hR₃.1.right_mem) + have ht23 : t₂ ≠ t₃ := fun h => disjoint_left.mp hd23 hR₂.1.right_mem (h ▸ hR₃.1.right_mem) + have hX'_sub : ({s₁, s₂, s₃} : Set α) ⊆ X := by + rintro x (rfl | rfl | rfl) <;> assumption + have hY'_sub : ({t₁, t₂, t₃} : Set α) ⊆ Y := by + rintro x (rfl | rfl | rfl) <;> assumption + have hcard_s : ({s₁, s₂, s₃} : Set α).ncard = 3 := by + rw [ncard_insert_of_notMem (by simp [hs12, hs13]) ((finite_singleton s₃).insert s₂), + ncard_insert_of_notMem (by simp [hs23]) (finite_singleton s₃), ncard_singleton] + have hcard_t : ({t₁, t₂, t₃} : Set α).ncard = 3 := by + rw [ncard_insert_of_notMem (by simp [ht12, ht13]) ((finite_singleton t₃).insert t₂), + ncard_insert_of_notMem (by simp [ht23]) (finite_singleton t₃), ncard_singleton] + refine ⟨hX'_sub, hY'_sub, hcard_s.trans hcard_t.symm, ?_⟩ + let P_fam : Fin ({s₁, s₂, s₃} : Set α).ncard → Graph α β := + fun i => if i.1 = 0 then R₁ else if i.1 = 1 then R₂ else R₃ + refine ⟨P_fam, ?_, ?_⟩ + · intro i j hij + have hi : i.1 < 3 := hcard_s ▸ i.2 + have hj : j.1 < 3 := hcard_s ▸ j.2 + have hij' : i.1 ≠ j.1 := Fin.val_ne_of_ne hij + rcases ( by omega : i.1 = 0 ∨ i.1 = 1 ∨ i.1 = 2 ) with hi0 | hi1 | hi2 <;> + rcases ( by omega : j.1 = 0 ∨ j.1 = 1 ∨ j.1 = 2 ) with hj0 | hj1 | hj2 <;> + try omega + · simp [P_fam, hi0, hj1, hd12] + · simp [P_fam, hi0, hj2, hd13] + · simp [P_fam, hi1, hj0, hd12.symm] + · simp [P_fam, hi1, hj2, hd23] + · simp [P_fam, hi2, hj0, hd13.symm] + · simp [P_fam, hi2, hj1, hd23.symm] + · intro i + have hi : i.1 < 3 := hcard_s ▸ i.2 + rcases ( by omega : i.1 = 0 ∨ i.1 = 1 ∨ i.1 = 2 ) with hi0 | hi1 | hi2 + · exact ⟨s₁, by simp, t₁, by simp, by simp [P_fam, hi0, hR₁]⟩ + · exact ⟨s₂, by simp, t₂, by simp, by simp [P_fam, hi1, hR₂]⟩ + · exact ⟨s₃, by simp, t₃, by simp, by simp [P_fam, hi2, hR₃]⟩ + +theorem disjoint_subpath_P_of_inter_singleton (S : Society α β) {P Q : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {a b i : ℕ} (hb : b < (pathWalkTS hP).support.length) + (hi : i < (splitList S hs ht hP).length) + (hVQ : V(Q) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + a ≤ k ∧ k ≤ b ∧ x = (splitList S hs ht hP)[k]'(by rw [length_splitList]; omega)}) + {A : Set α} + (hA : A ∩ {x | x ∈ splitList S hs ht hP} = {(splitList S hs ht hP)[i]'hi}) + (hni : ¬ (a ≤ i ∧ i ≤ b)) : + Disjoint A V(Q) := by + rw [disjoint_left] + intro x hxA hxQ + have hxL : x ∈ {y | y ∈ splitList S hs ht hP} := + subpath_P_subset_splitList S hs ht hP hVQ hxQ + have hx_in : x ∈ A ∩ {y | y ∈ splitList S hs ht hP} := ⟨hxA, hxL⟩ + rw [hA, mem_singleton_iff] at hx_in + subst hx_in + exact hni ((mem_subpath_P_iff S hs ht hst hP hP_bar hb hVQ hi).mp hxQ) + +theorem inter_subpath_P_eq_of_inter_singleton (S : Society α β) {P Q : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {a b i : ℕ} (hb : b < (pathWalkTS hP).support.length) + (hi : i < (splitList S hs ht hP).length) + (hVQ : V(Q) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + a ≤ k ∧ k ≤ b ∧ x = (splitList S hs ht hP)[k]'(by rw [length_splitList]; omega)}) + {A : Set α} + (hA : A ∩ {x | x ∈ splitList S hs ht hP} = {(splitList S hs ht hP)[i]'hi}) + (hi_in : a ≤ i ∧ i ≤ b) : + V(Q) ∩ A = {(splitList S hs ht hP)[i]'hi} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hxQ, hxA⟩ + have hxL : x ∈ {y | y ∈ splitList S hs ht hP} := + subpath_P_subset_splitList S hs ht hP hVQ hxQ + have hx_in : x ∈ A ∩ {y | y ∈ splitList S hs ht hP} := ⟨hxA, hxL⟩ + rwa [hA, mem_singleton_iff] at hx_in + · rintro rfl + have hiA : (splitList S hs ht hP)[i]'hi ∈ A ∩ {y | y ∈ splitList S hs ht hP} := by + rw [hA]; simp + exact ⟨(mem_subpath_P_iff S hs ht hst hP hP_bar hb hVQ hi).mpr hi_in, hiA.1⟩ + +theorem inter_subpath_P_subpath_P_eq_singleton (S : Society α β) {P Q₁ Q₂ : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {a b c : ℕ} (hab : a ≤ b) (hbc : b ≤ c) (hc : c < (pathWalkTS hP).support.length) + (hVQ₁ : V(Q₁) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + a ≤ k ∧ k ≤ b ∧ x = (splitList S hs ht hP)[k]'(by rw [length_splitList]; omega)}) + (hVQ₂ : V(Q₂) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + b ≤ k ∧ k ≤ c ∧ x = (splitList S hs ht hP)[k]'(by rw [length_splitList]; omega)}) : + V(Q₁) ∩ V(Q₂) = + {(splitList S hs ht hP)[b]'(by rw [length_splitList]; omega)} := by + have hbL : b < (splitList S hs ht hP).length := by rw [length_splitList]; omega + ext x + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hx₁, hx₂⟩ + rw [hVQ₁, mem_ofPred_eq] at hx₁ + obtain ⟨k, hk, hak, hkb, rfl⟩ := hx₁ + have hkL : k < (splitList S hs ht hP).length := by rw [length_splitList]; omega + have hk₂ := (mem_subpath_P_iff S hs ht hst hP hP_bar hc hVQ₂ hkL).mp hx₂ + have hkeq : k = b := by omega + subst hkeq + rfl + · rintro rfl + exact ⟨(mem_subpath_P_iff S hs ht hst hP hP_bar (by omega) hVQ₁ hbL).mpr ⟨hab, le_rfl⟩, + (mem_subpath_P_iff S hs ht hst hP hP_bar hc hVQ₂ hbL).mpr ⟨le_rfl, hbc⟩⟩ + +theorem subpath_P_inter_bar_eq_t (S : Society α β) {P Q : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {i : ℕ} (hi : i < (pathWalkTS hP).support.length - 1) + (hQ_le : Q ≤ P) + (hVQ : V(Q) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + 0 ≤ k ∧ k ≤ i ∧ x = (splitList S hs ht hP)[k]'(by rw [length_splitList]; omega)}) : + V(Q) ∩ S.Ω.bar = {t} := by + have hm2 : 2 ≤ (pathWalkTS hP).support.length := two_le_length_support_pathWalkTS hst hP + have hi' : i < (pathWalkTS hP).support.length := by omega + ext x + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hxQ, hx_bar⟩ + have hxP : x ∈ V(P) := hQ_le.vertexSet_mono hxQ + by_cases hxt : x = t + · exact hxt + · by_cases hxs : x = s + · subst hxs + have hs_eq := (getElem_splitList_pred S hs ht hP).symm + have hpredL : (pathWalkTS hP).support.length - 1 < (splitList S hs ht hP).length := by + rw [length_splitList]; omega + rw [hs_eq] at hxQ + have hmem := (mem_subpath_P_iff S hs ht hst hP hP_bar hi' hVQ hpredL).mp hxQ + omega + · exact (disjoint_left.mp hP_bar ⟨hxP, by simp [hxs, hxt]⟩ hx_bar).elim + · rintro rfl + have h0L : 0 < (splitList S hs ht hP).length := by rw [length_splitList]; omega + have htQ : x ∈ V(Q) := by + rw [← getElem_splitList_zero S hs ht hP] + exact (mem_subpath_P_iff S hs ht hst hP hP_bar hi' hVQ h0L).mpr ⟨le_rfl, Nat.zero_le i⟩ + exact ⟨htQ, ht⟩ + +theorem subpath_P_inter_bar_eq_s (S : Society α β) {P Q : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {j : ℕ} (hj0 : 0 < j) (hj : j ≤ (pathWalkTS hP).support.length - 1) + (hQ_le : Q ≤ P) + (hVQ : V(Q) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + j ≤ k ∧ k ≤ (pathWalkTS hP).support.length - 1 ∧ + x = (splitList S hs ht hP)[k]'(by rw [length_splitList]; omega)}) : + V(Q) ∩ S.Ω.bar = {s} := by + have hm2 : 2 ≤ (pathWalkTS hP).support.length := two_le_length_support_pathWalkTS hst hP + have hpred : (pathWalkTS hP).support.length - 1 < (pathWalkTS hP).support.length := by omega + ext x + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hxQ, hx_bar⟩ + have hxP : x ∈ V(P) := hQ_le.vertexSet_mono hxQ + by_cases hxs : x = s + · exact hxs + · by_cases hxt : x = t + · subst hxt + have ht_eq := (getElem_splitList_zero S hs ht hP).symm + have h0L : 0 < (splitList S hs ht hP).length := by rw [length_splitList]; omega + rw [ht_eq] at hxQ + have hmem := (mem_subpath_P_iff S hs ht hst hP hP_bar hpred hVQ h0L).mp hxQ + omega + · exact (disjoint_left.mp hP_bar ⟨hxP, by simp [hxs, hxt]⟩ hx_bar).elim + · rintro rfl + have hpredL : (pathWalkTS hP).support.length - 1 < (splitList S hs ht hP).length := by + rw [length_splitList]; omega + have hsQ : x ∈ V(Q) := by + rw [← getElem_splitList_pred S hs ht hP] + exact (mem_subpath_P_iff S hs ht hst hP hP_bar hpred hVQ hpredL).mpr ⟨hj, le_rfl⟩ + exact ⟨hsQ, hs⟩ + +theorem vertexSet_splitGraph_inter_bar_subset_splitList (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) : + V(splitGraph S P s t) ∩ S.Ω.bar ⊆ {x | x ∈ splitList S hs ht hP} := by + rintro x ⟨hxG₁, hx_bar⟩ + rw [vertexSet_splitGraph, mem_sdiff] at hxG₁ + rw [mem_ofPred_eq, splitList, List.mem_append, S.Ω.mem_intervalList_iff hs ht hst] + by_cases hxP : x ∈ V(P) + · left + rwa [vertexSet_eq_support_pathWalkTS hP, mem_ofPred_eq] at hxP + · have hxs : x ≠ s := fun h => hxP (h ▸ hP.left_mem) + have hxt : x ≠ t := fun h => hxP (h ▸ hP.right_mem) + rcases S.Ω.mem_interval_or_interval_swap hs ht hx_bar hst hxs hxt with hxW₁ | hxW₂ + · exact Or.inr hxW₁ + · exact (hxG₁.2 (mem_vertexSet_splitSide_of_mem_W hxG₁.1 hxP hxW₂)).elim + +private theorem no_reduced_cross_of_disjoint_spur (S : Society α β) + {P P₁ P₂ P₃ P₁_a P₁_b : Graph α β} {s t u : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) + {i₁ j₁ i₂ j₂ k : ℕ} : + let m := (pathWalkTS hP).support.length + let L := splitList S hs ht hP + (hi₁ : i₁ < L.length) → (hj₁ : j₁ < L.length) → + (hi₂ : i₂ < L.length) → (hj₂ : j₂ < L.length) → (hk : k < L.length) → + i₁ < i₂ → i₂ < j₁ → j₁ < m → m ≤ j₂ → m ≤ k → + (hP₁ : P₁ ≤ splitGraph S P s t) → + IsGraphPathWithEnds (splitGraph S P s t) P₂ (L[i₂]'hi₂) (L[j₂]'hj₂) → + IsGraphPathWithEnds P₁ P₁_a (L[i₁]'hi₁) u → + IsGraphPathWithEnds P₁ P₁_b u (L[j₁]'hj₁) → + P₁_a ≤ P₁ → P₁_b ≤ P₁ → + IsGraphPathWithEnds (splitGraph S P s t) P₃ u (L[k]'hk) → + V(P₃) ∩ V(P₁) = {u} → + V(P₂) ∩ {x | x ∈ L} = {L[i₂]'hi₂, L[j₂]'hj₂} → + V(P₃) ∩ {x | x ∈ L} = {L[k]'hk} → + V(P₁_a) ∩ {x | x ∈ L} = {L[i₁]'hi₁} → + V(P₁_b) ∩ {x | x ∈ L} = {L[j₁]'hj₁} → + Disjoint V(P₁) V(P₂) → Disjoint V(P₃) V(P₂) → False := by + intro m L hi₁ hj₁ hi₂ hj₂ hk h12 h21 hj₁m hmj₂ hmk hP₁ hP₂ hP₁a_path hP₁b_path + hP₁a_le hP₁b_le hP₃_path hP₃_inter hP₂_L hP₃_L hP₁a_L hP₁b_L hdisj hdisj_P₃_P₂ + have hkj₂_ne : k ≠ j₂ := by + intro h + subst h + exact disjoint_left.mp hdisj_P₃_P₂ hP₃_path.right_mem hP₂.right_mem + have hP₁a_P₃ : V(P₁_a) ∩ V(P₃) = {u} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hxPa, hxP₃⟩ => ?_, fun h => h ▸ ⟨hP₁a_path.right_mem, hP₃_path.left_mem⟩⟩ + have hx_in : x ∈ V(P₃) ∩ V(P₁) := ⟨hxP₃, hP₁a_le.vertexSet_mono hxPa⟩ + rwa [hP₃_inter, mem_singleton_iff] at hx_in + have hP₁b_P₃ : V(P₁_b) ∩ V(P₃) = {u} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hxPb, hxP₃⟩ => ?_, fun h => h ▸ ⟨hP₁b_path.left_mem, hP₃_path.left_mem⟩⟩ + have hx_in : x ∈ V(P₃) ∩ V(P₁) := ⟨hxP₃, hP₁b_le.vertexSet_mono hxPb⟩ + rwa [hP₃_inter, mem_singleton_iff] at hx_in + rcases lt_or_gt_of_ne hkj₂_ne with hkj₂ | hj₂k + · let P₁' := subgraphUnion (splitGraph S P s t) P₁_a P₃ + have hP₁'_path : IsGraphPathWithEnds (splitGraph S P s t) P₁' (L[i₁]'hi₁) (L[k]'hk) := + (hP₁a_path.mono hP₁).subgraphUnion hP₃_path hP₁a_P₃ + have hdisj' : Disjoint V(P₁') V(P₂) := by + rw [vertexSet_subgraphUnion] + exact Disjoint.union_left (hdisj.mono_left hP₁a_le.vertexSet_mono) hdisj_P₃_P₂ + have hP₁'_L : V(P₁') ∩ {x | x ∈ L} = {L[i₁]'hi₁, L[k]'hk} := by + rw [vertexSet_subgraphUnion, union_inter_distrib_right, hP₁a_L, hP₃_L] + ext x + simp [L, or_comm] + exact no_reduced_cross_of_two_in_W1 S hs ht hst hP hP_bar hnocross + hi₁ hk hi₂ hj₂ h12 (by omega) hkj₂ hdisj' hP₁'_path hP₂ hP₁'_L hP₂_L hmk + · let P₁'' := subgraphUnion (splitGraph S P s t) P₁_b P₃ + have hP₁''_path : IsGraphPathWithEnds (splitGraph S P s t) P₁'' (L[j₁]'hj₁) (L[k]'hk) := + (hP₁b_path.mono hP₁).symm.subgraphUnion hP₃_path hP₁b_P₃ + have hdisj'' : Disjoint V(P₂) V(P₁'') := by + rw [vertexSet_subgraphUnion] + exact Disjoint.union_right (hdisj.symm.mono_right hP₁b_le.vertexSet_mono) hdisj_P₃_P₂.symm + have hP₁''_L : V(P₁'') ∩ {x | x ∈ L} = {L[j₁]'hj₁, L[k]'hk} := by + rw [vertexSet_subgraphUnion, union_inter_distrib_right, hP₁b_L, hP₃_L] + ext x + simp [L, or_comm] + exact no_reduced_cross_of_two_in_W1 S hs ht hst hP hP_bar hnocross + hi₂ hj₂ hj₁ hk h21 (by omega) hj₂k hdisj'' hP₂ hP₁''_path hP₂_L hP₁''_L hmj₂ + +private theorem theta_paths_of_split_cross (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {P₁ P₂ P₁_a P₁_b P₂' P₃' Q_i₁_i₂ Q_i₂_j₁ : Graph α β} {u v : α} + {i₁ j₁ i₂ j₂ : ℕ} + (hi₁ : i₁ < (splitList S hs ht hP).length) (hj₁ : j₁ < (splitList S hs ht hP).length) + (hi₂ : i₂ < (splitList S hs ht hP).length) (hj₂ : j₂ < (splitList S hs ht hP).length) + (h12 : i₁ < i₂) (h21 : i₂ < j₁) + (hj₁m : j₁ < (pathWalkTS hP).support.length) + (hmj₂ : (pathWalkTS hP).support.length ≤ j₂) + (hdisj : Disjoint V(P₁) V(P₂)) + (hinter_P₁ : V(P₁_a) ∩ V(P₁_b) = {u}) + (hP₁a_le : P₁_a ≤ P₁) (hP₁b_le : P₁_b ≤ P₁) (hP₂'_le : P₂' ≤ P₂) + (hQ12_le : Q_i₁_i₂ ≤ P) (hQ21_le : Q_i₂_j₁ ≤ P) + (hdisj_P₃'_P : Disjoint V(P₃') V(P)) + (hP₃'_ft : IsFromToPathWithEnds S.G P₃' V(P₁) V(P₂) u v) : + let L := splitList S hs ht hP + (V(P₁_a) ∩ {x | x ∈ L} = {L[i₁]'hi₁}) → + (V(P₁_b) ∩ {x | x ∈ L} = {L[j₁]'hj₁}) → + (V(P₂) ∩ {x | x ∈ L} = {L[i₂]'hi₂, L[j₂]'hj₂}) → + IsGraphPathWithEnds S.G P₁_a (L[i₁]'hi₁) u → + IsGraphPathWithEnds S.G P₁_b u (L[j₁]'hj₁) → + IsGraphPathWithEnds S.G P₂' (L[i₂]'hi₂) v → + IsGraphPathWithEnds S.G Q_i₁_i₂ (L[i₁]'hi₁) (L[i₂]'hi₂) → + IsGraphPathWithEnds S.G Q_i₂_j₁ (L[i₂]'hi₂) (L[j₁]'hj₁) → + (V(Q_i₁_i₂) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + i₁ ≤ k ∧ k ≤ i₂ ∧ x = L[k]'(by dsimp [L]; rw [length_splitList]; omega)}) → + (V(Q_i₂_j₁) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + i₂ ≤ k ∧ k ≤ j₁ ∧ x = L[k]'(by dsimp [L]; rw [length_splitList]; omega)}) → + let T₁ := subgraphUnion S.G P₁_a Q_i₁_i₂ + let T₂ := subgraphUnion S.G P₁_b Q_i₂_j₁ + let T₃ := subgraphUnion S.G P₃' P₂' + IsGraphPathWithEnds S.G T₁ u (L[i₂]'hi₂) ∧ + IsGraphPathWithEnds S.G T₂ u (L[i₂]'hi₂) ∧ + IsGraphPathWithEnds S.G T₃ u (L[i₂]'hi₂) ∧ + V(T₁) ∩ V(T₂) = {u, L[i₂]'hi₂} ∧ V(T₁) ∩ V(T₃) = {u, L[i₂]'hi₂} ∧ + V(T₂) ∩ V(T₃) = {u, L[i₂]'hi₂} := by + intro L hP₁a_L hP₁b_L hP₂_L hP₁a_path hP₁b_path hP₂'_path hQ12_path hQ21_path + hVQ12 hVQ21 T₁ T₂ T₃ + have hP₁a_Q12 : V(P₁_a) ∩ V(Q_i₁_i₂) = {L[i₁]'hi₁} := by + rw [inter_comm] + exact inter_subpath_P_eq_of_inter_singleton S hs ht hst hP hP_bar (by omega) hi₁ hVQ12 + hP₁a_L ⟨le_rfl, by omega⟩ + have hP₁b_Q21 : V(P₁_b) ∩ V(Q_i₂_j₁) = {L[j₁]'hj₁} := by + rw [inter_comm] + exact inter_subpath_P_eq_of_inter_singleton S hs ht hst hP hP_bar hj₁m hj₁ hVQ21 + hP₁b_L ⟨by omega, le_rfl⟩ + have hP₃'_P₂' : V(P₃') ∩ V(P₂') = {v} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hxP₃', hxP₂'⟩ => ?_, fun h => h ▸ ⟨hP₃'_ft.1.right_mem, hP₂'_path.right_mem⟩⟩ + have hx_in : x ∈ V(P₃') ∩ V(P₂) := ⟨hxP₃', hP₂'_le.vertexSet_mono hxP₂'⟩ + rwa [hP₃'_ft.2.2, mem_singleton_iff] at hx_in + have hT₁_path : IsGraphPathWithEnds S.G T₁ u (L[i₂]'hi₂) := + hP₁a_path.symm.subgraphUnion hQ12_path hP₁a_Q12 + have hT₂_path : IsGraphPathWithEnds S.G T₂ u (L[i₂]'hi₂) := + hP₁b_path.subgraphUnion hQ21_path.symm hP₁b_Q21 + have hT₃_path : IsGraphPathWithEnds S.G T₃ u (L[i₂]'hi₂) := + hP₃'_ft.1.subgraphUnion hP₂'_path.symm hP₃'_P₂' + -- Disjointness facts for the components of `T₁, T₂, T₃`. + have hdisj_P₁a_Q21 : Disjoint V(P₁_a) V(Q_i₂_j₁) := + disjoint_subpath_P_of_inter_singleton S hs ht hst hP hP_bar hj₁m hi₁ hVQ21 hP₁a_L (by omega) + have hdisj_P₁b_Q12 : Disjoint V(P₁_b) V(Q_i₁_i₂) := + disjoint_subpath_P_of_inter_singleton S hs ht hst hP hP_bar (by omega) hj₁ hVQ12 hP₁b_L + (by omega) + have hQ12_Q21 : V(Q_i₁_i₂) ∩ V(Q_i₂_j₁) = {L[i₂]'hi₂} := + inter_subpath_P_subpath_P_eq_singleton S hs ht hst hP hP_bar (by omega) (by omega) hj₁m + hVQ12 hVQ21 + have hP₁a_P₃' : V(P₁_a) ∩ V(P₃') = {u} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hxPa, hxP₃'⟩ => ?_, fun h => h ▸ ⟨hP₁a_path.right_mem, hP₃'_ft.1.left_mem⟩⟩ + have hx_in : x ∈ V(P₃') ∩ V(P₁) := ⟨hxP₃', hP₁a_le.vertexSet_mono hxPa⟩ + rwa [hP₃'_ft.2.1, mem_singleton_iff] at hx_in + have hP₁b_P₃' : V(P₁_b) ∩ V(P₃') = {u} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hxPb, hxP₃'⟩ => ?_, fun h => h ▸ ⟨hP₁b_path.left_mem, hP₃'_ft.1.left_mem⟩⟩ + have hx_in : x ∈ V(P₃') ∩ V(P₁) := ⟨hxP₃', hP₁b_le.vertexSet_mono hxPb⟩ + rwa [hP₃'_ft.2.1, mem_singleton_iff] at hx_in + have hQ12_P₂' : V(Q_i₁_i₂) ∩ V(P₂') = {L[i₂]'hi₂} := by + have hQ12_P₂ : V(Q_i₁_i₂) ∩ V(P₂) = {L[i₂]'hi₂} := + inter_subpath_P_eq_left_of_inter_pair S hs ht hst hP hP_bar (by omega) hi₂ hj₂ hVQ12 hP₂_L + ⟨by omega, le_rfl⟩ (by omega) + ext x + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hxQ, hxP₂'⟩ => ?_, fun h => h ▸ ⟨hQ12_path.right_mem, hP₂'_path.left_mem⟩⟩ + have hx_in : x ∈ V(Q_i₁_i₂) ∩ V(P₂) := ⟨hxQ, hP₂'_le.vertexSet_mono hxP₂'⟩ + rwa [hQ12_P₂, mem_singleton_iff] at hx_in + have hQ21_P₂' : V(Q_i₂_j₁) ∩ V(P₂') = {L[i₂]'hi₂} := by + have hQ21_P₂ : V(Q_i₂_j₁) ∩ V(P₂) = {L[i₂]'hi₂} := + inter_subpath_P_eq_left_of_inter_pair S hs ht hst hP hP_bar hj₁m hi₂ hj₂ hVQ21 hP₂_L + ⟨le_rfl, by omega⟩ (by omega) + ext x + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hxQ, hxP₂'⟩ => ?_, fun h => h ▸ ⟨hQ21_path.left_mem, hP₂'_path.left_mem⟩⟩ + have hx_in : x ∈ V(Q_i₂_j₁) ∩ V(P₂) := ⟨hxQ, hP₂'_le.vertexSet_mono hxP₂'⟩ + rwa [hQ21_P₂, mem_singleton_iff] at hx_in + have hinter_T12 : V(T₁) ∩ V(T₂) = {u, L[i₂]'hi₂} := by + simp only [T₁, T₂, vertexSet_subgraphUnion, union_inter_distrib_right, + inter_union_distrib_left, hinter_P₁, Set.disjoint_iff_inter_eq_empty.mp hdisj_P₁a_Q21, + Set.disjoint_iff_inter_eq_empty.mp hdisj_P₁b_Q12.symm, hQ12_Q21, union_empty, empty_union] + rfl + have hinter_T13 : V(T₁) ∩ V(T₃) = {u, L[i₂]'hi₂} := by + have hPaP₂ : Disjoint V(P₁_a) V(P₂') := hdisj.mono + hP₁a_le.vertexSet_mono hP₂'_le.vertexSet_mono + have hQP₃ : Disjoint V(Q_i₁_i₂) V(P₃') := hdisj_P₃'_P.symm.mono_left hQ12_le.vertexSet_mono + simp only [T₁, T₃, vertexSet_subgraphUnion, union_inter_distrib_right, + inter_union_distrib_left, hP₁a_P₃', Set.disjoint_iff_inter_eq_empty.mp hPaP₂, + Set.disjoint_iff_inter_eq_empty.mp hQP₃, hQ12_P₂', union_empty, empty_union] + rfl + have hinter_T23 : V(T₂) ∩ V(T₃) = {u, L[i₂]'hi₂} := by + have hPbP₂ : Disjoint V(P₁_b) V(P₂') := hdisj.mono + hP₁b_le.vertexSet_mono hP₂'_le.vertexSet_mono + have hQP₃ : Disjoint V(Q_i₂_j₁) V(P₃') := hdisj_P₃'_P.symm.mono_left hQ21_le.vertexSet_mono + simp only [T₂, T₃, vertexSet_subgraphUnion, union_inter_distrib_right, + inter_union_distrib_left, hP₁b_P₃', Set.disjoint_iff_inter_eq_empty.mp hPbP₂, + Set.disjoint_iff_inter_eq_empty.mp hQP₃, hQ21_P₂', union_empty, empty_union] + rfl + exact ⟨hT₁_path, hT₂_path, hT₃_path, hinter_T12, hinter_T13, hinter_T23⟩ + +/-- Case `r = 1` of `(2.4)` (`lemma_2_4_no_cross`): no reduced cross `(P₁, P₂)` in `(G₁, Ω₁)` +with indices `0 ≤ i₁ < i₂ < j₁ < j₂ < L.length` can have `j₁ < m ≤ j₂`. -/ +theorem no_reduced_cross_of_one_in_W1 (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) (hP_ind : P ≤i S.G) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + (hcatch : Catches (S.Ω.bar \ {s, t}) (deleteVertices S.G V(P))) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) + (hnotripod : ¬ ∃ T₁ T₂ T₃ : Graph α β, S.IsTripod T₁ T₂ T₃) + {P₁ P₂ : Graph α β} {i₁ j₁ i₂ j₂ : ℕ} + (hi₁ : i₁ < (splitList S hs ht hP).length) + (hj₁ : j₁ < (splitList S hs ht hP).length) + (hi₂ : i₂ < (splitList S hs ht hP).length) + (hj₂ : j₂ < (splitList S hs ht hP).length) + (h12 : i₁ < i₂) (h21 : i₂ < j₁) + (hdisj : Disjoint V(P₁) V(P₂)) + (hP₁ : IsGraphPathWithEnds (splitGraph S P s t) P₁ + ((splitList S hs ht hP)[i₁]'hi₁) ((splitList S hs ht hP)[j₁]'hj₁)) + (hP₂ : IsGraphPathWithEnds (splitGraph S P s t) P₂ + ((splitList S hs ht hP)[i₂]'hi₂) ((splitList S hs ht hP)[j₂]'hj₂)) + (hP₁_L : V(P₁) ∩ {x | x ∈ splitList S hs ht hP} = + {(splitList S hs ht hP)[i₁]'hi₁, (splitList S hs ht hP)[j₁]'hj₁}) + (hP₂_L : V(P₂) ∩ {x | x ∈ splitList S hs ht hP} = + {(splitList S hs ht hP)[i₂]'hi₂, (splitList S hs ht hP)[j₂]'hj₂}) + (hj₁m : j₁ < (pathWalkTS hP).support.length) + (hmj₂ : (pathWalkTS hP).support.length ≤ j₂) : + False := by + let m := (pathWalkTS hP).support.length + let L := splitList S hs ht hP + have hnd := nodup_splitList S hs ht hst hP hP_bar + have hij₁_ne : L[i₁]'hi₁ ≠ L[j₁]'hj₁ := fun h => by + have := nodup_getElem_inj hnd hi₁ hj₁ h; omega + obtain ⟨u₀, hu₀P₁, hu₀H₁⟩ := + exists_vertex_in_splitSide_of_path_in_splitGraph S hs ht hst hP hP_ind hcatch hnocross + hP₁ hij₁_ne + obtain ⟨u, huP₁, k, hk, P₃, hP₃H₁, hmk, hdisj_P₃_P, hP₃_ft, hP₃_L, _⟩ := + exists_fromToPath_in_splitSide S hs ht hst hP hnocross hu₀P₁ hu₀H₁ + have hu_not_P : u ∉ V(P) := disjoint_left.mp hdisj_P₃_P hP₃_ft.1.left_mem + have hi₁P : L[i₁]'hi₁ ∈ V(P) := + (getElem_splitList_mem_P_iff S hs ht hst hP hP_bar hi₁).mpr (by omega) + have hj₁P : L[j₁]'hj₁ ∈ V(P) := + (getElem_splitList_mem_P_iff S hs ht hst hP hP_bar hj₁).mpr hj₁m + have hi₂P : L[i₂]'hi₂ ∈ V(P) := + (getElem_splitList_mem_P_iff S hs ht hst hP hP_bar hi₂).mpr (by omega) + have hu_ne_i₁ : u ≠ L[i₁]'hi₁ := fun h => hu_not_P (h ▸ hi₁P) + have hu_ne_j₁ : u ≠ L[j₁]'hj₁ := fun h => hu_not_P (h ▸ hj₁P) + obtain ⟨P₁_a, P₁_b, hP₁a_le, hP₁b_le, hP₁a_path, hP₁b_path, hunion_P₁, hinter_P₁, _⟩ := + hP₁.exists_split_at huP₁ + have hP₁a_V : V(P₁_a) ∪ V(P₁_b) = V(P₁) := by + rw [← vertexSet_subgraphUnion P₁ P₁_a P₁_b, hunion_P₁] + have hP₁a_L : V(P₁_a) ∩ {x | x ∈ L} = {L[i₁]'hi₁} := + inter_left_of_split hP₁a_le hinter_P₁ hP₁a_path.left_mem hP₁b_path.right_mem hu_ne_j₁ hP₁_L + have hP₁b_L : V(P₁_b) ∩ {x | x ∈ L} = {L[j₁]'hj₁} := + inter_right_of_split hP₁b_le hinter_P₁ hP₁a_path.left_mem hP₁b_path.right_mem hu_ne_i₁ hP₁_L + by_cases hdisj_P₃_P₂ : Disjoint V(P₃) V(P₂) + · exact no_reduced_cross_of_disjoint_spur S hs ht hst hP hP_bar hnocross + hi₁ hj₁ hi₂ hj₂ hk h12 h21 hj₁m hmj₂ hmk hP₁.le hP₂ hP₁a_path hP₁b_path + hP₁a_le hP₁b_le hP₃_ft.1 hP₃_ft.2.1 hP₂_L hP₃_L hP₁a_L hP₁b_L hdisj hdisj_P₃_P₂ + · -- Subcase 2b: `P₃` meets `P₂`; construct a tripod in `(G, Ω)`. + rw [not_disjoint_iff] at hdisj_P₃_P₂ + obtain ⟨z₀, hz₀P₃, hz₀P₂⟩ := hdisj_P₃_P₂ + obtain ⟨P₃_a, _, hP₃a_le, _, hP₃a_path, _, _, _, _⟩ := hP₃_ft.1.exists_split_at hz₀P₃ + obtain ⟨u', hu'P₁, v, hvP₂, P₃', hP₃'_le_a, hP₃'_ft⟩ := + (hP₃a_path.mono (hP₃_ft.1.le.trans (splitGraph_le S P s t))).exists_isFromToPathWithEnds + huP₁ hz₀P₂ + have hP₃'_le : P₃' ≤ P₃ := hP₃'_le_a.trans hP₃a_le + have hu'_eq : u = u' := by + have : u' ∈ V(P₃) ∩ V(P₁) := ⟨hP₃'_le.vertexSet_mono hP₃'_ft.1.left_mem, hu'P₁⟩ + rw [hP₃_ft.2.1, mem_singleton_iff] at this + exact this.symm + subst hu'_eq + have hdisj_P₃'_P : Disjoint V(P₃') V(P) := + hdisj_P₃_P.mono_left hP₃'_le.vertexSet_mono + have hv_not_P : v ∉ V(P) := disjoint_left.mp hdisj_P₃'_P hP₃'_ft.1.right_mem + have hv_ne_i₂ : v ≠ L[i₂]'hi₂ := fun h => hv_not_P (h ▸ hi₂P) + have hP₁G : IsGraphPathWithEnds S.G P₁ (L[i₁]'hi₁) (L[j₁]'hj₁) := + hP₁.mono (splitGraph_le S P s t) + have hP₂G : IsGraphPathWithEnds S.G P₂ (L[i₂]'hi₂) (L[j₂]'hj₂) := + hP₂.mono (splitGraph_le S P s t) + obtain ⟨P₂', P₂'', hP₂'_le, hP₂''_le, hP₂'_path, hP₂''_path, hunion_P₂, hinter_P₂, _⟩ := + hP₂G.exists_split_at hvP₂ + have hP₂_V : V(P₂') ∪ V(P₂'') = V(P₂) := by + rw [← vertexSet_subgraphUnion P₂ P₂' P₂'', hunion_P₂] + have hP₂''_L : V(P₂'') ∩ {x | x ∈ L} = {L[j₂]'hj₂} := + inter_right_of_split hP₂''_le hinter_P₂ hP₂'_path.left_mem hP₂''_path.right_mem hv_ne_i₂ hP₂_L + -- Four subpaths of `P` along `[0, i₁]`, `[i₁, i₂]`, `[i₂, j₁]`, `[j₁, m - 1]`. + have hm2 : 2 ≤ m := two_le_length_support_pathWalkTS hst hP + have hm_pred : m - 1 < m := by omega + obtain ⟨Q_0_i₁, hQ0_le, hQ0_path, hVQ0⟩ := + exists_subpath_P_of_splitList_indices S hs ht hP (Nat.zero_le i₁) (by omega) + obtain ⟨Q_i₁_i₂, hQ12_le, hQ12_path, hVQ12⟩ := + exists_subpath_P_of_splitList_indices S hs ht hP (by omega : i₁ ≤ i₂) (by omega) + obtain ⟨Q_i₂_j₁, hQ21_le, hQ21_path, hVQ21⟩ := + exists_subpath_P_of_splitList_indices S hs ht hP (by omega : i₂ ≤ j₁) hj₁m + obtain ⟨Q_j₁_m, hQjm_le, hQjm_path, hVQjm⟩ := + exists_subpath_P_of_splitList_indices S hs ht hP (by omega : j₁ ≤ m - 1) hm_pred + -- Build the three theta paths `T₁, T₂, T₃` between `u` and `L[i₂]`. + let T₁ := subgraphUnion S.G P₁_a Q_i₁_i₂ + let T₂ := subgraphUnion S.G P₁_b Q_i₂_j₁ + let T₃ := subgraphUnion S.G P₃' P₂' + obtain ⟨hT₁_path, hT₂_path, hT₃_path, hinter_T12, hinter_T13, hinter_T23⟩ := + theta_paths_of_split_cross S hs ht hst hP hP_bar hi₁ hj₁ hi₂ hj₂ h12 h21 hj₁m hmj₂ + hdisj hinter_P₁ hP₁a_le hP₁b_le hP₂'_le hQ12_le hQ21_le hdisj_P₃'_P hP₃'_ft + hP₁a_L hP₁b_L hP₂_L (hP₁a_path.mono hP₁G.le) (hP₁b_path.mono hP₁G.le) + (hP₂'_path.mono hP₂G.le) hQ12_path hQ21_path hVQ12 hVQ21 + have hu_ne_i₂ : u ≠ L[i₂]'hi₂ := fun h => hu_not_P (h ▸ hi₂P) + -- Internal vertices `L[i₁] ∈ V(T₁) \ {u, L[i₂]}`, `L[j₁] ∈ V(T₂) \ {u, L[i₂]}`, + -- `v ∈ V(T₃) \ {u, L[i₂]}`. + have hs₁_int : L[i₁]'hi₁ ∈ V(T₁) \ {u, L[i₂]'hi₂} := by + refine ⟨Or.inl hP₁a_path.left_mem, ?_⟩ + simp only [mem_insert_iff, mem_singleton_iff, not_or] + exact ⟨hu_ne_i₁.symm, fun h => by have := nodup_getElem_inj hnd hi₁ hi₂ h; omega⟩ + have hs₂_int : L[j₁]'hj₁ ∈ V(T₂) \ {u, L[i₂]'hi₂} := by + refine ⟨Or.inl hP₁b_path.right_mem, ?_⟩ + simp only [mem_insert_iff, mem_singleton_iff, not_or] + exact ⟨hu_ne_j₁.symm, fun h => by have := nodup_getElem_inj hnd hj₁ hi₂ h; omega⟩ + have hs₃_int : v ∈ V(T₃) \ {u, L[i₂]'hi₂} := by + refine ⟨Or.inl hP₃'_ft.1.right_mem, ?_⟩ + simp only [mem_insert_iff, mem_singleton_iff, not_or] + exact ⟨fun h => disjoint_left.mp hdisj huP₁ (h ▸ hvP₂), hv_ne_i₂⟩ + -- Three legs `Q_0_i₁` (`L[i₁] → t`), `Q_j₁_m` (`L[j₁] → s`), `P₂''` (`v → L[j₂]`). + let X_T := V(T₁) ∪ V(T₂) ∪ V(T₃) + have hR₁_path : IsGraphPathWithEnds S.G Q_0_i₁ (L[i₁]'hi₁) t := by + have h := hQ0_path.symm + rwa [getElem_splitList_zero S hs ht hP] at h + have hR₂_path : IsGraphPathWithEnds S.G Q_j₁_m (L[j₁]'hj₁) s := by + have h := hQjm_path + rwa [getElem_splitList_pred S hs ht hP] at h + have hR₃_path : IsGraphPathWithEnds S.G P₂'' v (L[j₂]'hj₂) := + hP₂''_path.mono hP₂G.le + have hQ0_bar : V(Q_0_i₁) ∩ S.Ω.bar = {t} := + subpath_P_inter_bar_eq_t S hs ht hst hP hP_bar (by omega) hQ0_le hVQ0 + have hQjm_bar : V(Q_j₁_m) ∩ S.Ω.bar = {s} := + subpath_P_inter_bar_eq_s S hs ht hst hP hP_bar (by omega) (by omega) hQjm_le hVQjm + have hj₂_bar : L[j₂]'hj₂ ∈ S.Ω.bar := + ((getElem_splitList_mem_W1_iff S hs ht hst hP hP_bar hj₂).mpr hmj₂).1.1 + have hP₂''_bar : V(P₂'') ∩ S.Ω.bar = {L[j₂]'hj₂} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hxP₂'', hx_bar⟩ => ?_, fun h => h ▸ ⟨hP₂''_path.right_mem, hj₂_bar⟩⟩ + have hxG₁ : x ∈ V(splitGraph S P s t) := + hP₂.le.vertexSet_mono (hP₂''_le.vertexSet_mono hxP₂'') + have hxL : x ∈ {y | y ∈ L} := + vertexSet_splitGraph_inter_bar_subset_splitList S hs ht hst hP ⟨hxG₁, hx_bar⟩ + have hx_in : x ∈ V(P₂'') ∩ {y | y ∈ L} := ⟨hxP₂'', hxL⟩ + rwa [hP₂''_L, mem_singleton_iff] at hx_in + -- Intersections of `Q_0_i₁`, `Q_j₁_m`, `P₂''` with `X_T`. + have hQ0_P₁a : V(Q_0_i₁) ∩ V(P₁_a) = {L[i₁]'hi₁} := + inter_subpath_P_eq_of_inter_singleton S hs ht hst hP hP_bar (by omega) hi₁ hVQ0 + hP₁a_L ⟨Nat.zero_le i₁, le_rfl⟩ + have hQ0_Q12 : V(Q_0_i₁) ∩ V(Q_i₁_i₂) = {L[i₁]'hi₁} := + inter_subpath_P_subpath_P_eq_singleton S hs ht hst hP hP_bar (Nat.zero_le i₁) + (by omega) (by omega) hVQ0 hVQ12 + have hdisj_Q0_P₁b : Disjoint V(P₁_b) V(Q_0_i₁) := + disjoint_subpath_P_of_inter_singleton S hs ht hst hP hP_bar (by omega) hj₁ hVQ0 hP₁b_L + (by omega) + have hdisj_Q0_Q21 : Disjoint V(Q_0_i₁) V(Q_i₂_j₁) := + disjoint_subpath_P_subpath_P S hs ht hst hP hP_bar hj₁m h12 hVQ0 hVQ21 + have hdisj_Q0_P₂ : Disjoint V(P₂) V(Q_0_i₁) := + disjoint_subpath_P_of_inter_pair S hs ht hst hP hP_bar (by omega) hi₂ hj₂ hVQ0 hP₂_L + (by omega) (by omega) + have hQ0_XT : V(Q_0_i₁) ∩ X_T = {L[i₁]'hi₁} := by + have hQ0P₃ : Disjoint V(Q_0_i₁) V(P₃') := hdisj_P₃'_P.symm.mono_left hQ0_le.vertexSet_mono + have hQ0P₂ : Disjoint V(Q_0_i₁) V(P₂') := hdisj_Q0_P₂.symm.mono_right hP₂'_le.vertexSet_mono + simp [X_T, T₁, T₂, T₃, vertexSet_subgraphUnion, inter_union_distrib_left, hQ0_P₁a, hQ0_Q12, + Set.disjoint_iff_inter_eq_empty.mp hdisj_Q0_P₁b.symm, + Set.disjoint_iff_inter_eq_empty.mp hdisj_Q0_Q21, + Set.disjoint_iff_inter_eq_empty.mp hQ0P₃, Set.disjoint_iff_inter_eq_empty.mp hQ0P₂] + have hdisj_Qjm_P₁a : Disjoint V(P₁_a) V(Q_j₁_m) := + disjoint_subpath_P_of_inter_singleton S hs ht hst hP hP_bar hm_pred hi₁ hVQjm hP₁a_L + (by omega) + have hdisj_Qjm_Q12 : Disjoint V(Q_i₁_i₂) V(Q_j₁_m) := + disjoint_subpath_P_subpath_P S hs ht hst hP hP_bar hm_pred h21 hVQ12 hVQjm + have hQjm_P₁b : V(Q_j₁_m) ∩ V(P₁_b) = {L[j₁]'hj₁} := + inter_subpath_P_eq_of_inter_singleton S hs ht hst hP hP_bar hm_pred hj₁ hVQjm hP₁b_L + ⟨le_rfl, by omega⟩ + have hQ21_Qjm : V(Q_i₂_j₁) ∩ V(Q_j₁_m) = {L[j₁]'hj₁} := + inter_subpath_P_subpath_P_eq_singleton S hs ht hst hP hP_bar (by omega) (by omega) hm_pred + hVQ21 hVQjm + have hdisj_Qjm_P₂ : Disjoint V(P₂) V(Q_j₁_m) := + disjoint_subpath_P_of_inter_pair S hs ht hst hP hP_bar hm_pred hi₂ hj₂ hVQjm hP₂_L + (by omega) (by omega) + have hQjm_XT : V(Q_j₁_m) ∩ X_T = {L[j₁]'hj₁} := by + have hQjmP₃ : Disjoint V(Q_j₁_m) V(P₃') := hdisj_P₃'_P.symm.mono_left hQjm_le.vertexSet_mono + have hQjmP₂ : Disjoint V(Q_j₁_m) V(P₂') := hdisj_Qjm_P₂.symm.mono_right hP₂'_le.vertexSet_mono + simp [X_T, T₁, T₂, T₃, vertexSet_subgraphUnion, inter_union_distrib_left, hQjm_P₁b, + (inter_comm V(Q_j₁_m) V(Q_i₂_j₁)).trans hQ21_Qjm, + Set.disjoint_iff_inter_eq_empty.mp hdisj_Qjm_P₁a.symm, + Set.disjoint_iff_inter_eq_empty.mp hdisj_Qjm_Q12.symm, + Set.disjoint_iff_inter_eq_empty.mp hQjmP₃, Set.disjoint_iff_inter_eq_empty.mp hQjmP₂] + have hdisj_P₂''_Q12 : Disjoint V(P₂'') V(Q_i₁_i₂) := + disjoint_subpath_P_of_inter_singleton S hs ht hst hP hP_bar (by omega) hj₂ hVQ12 hP₂''_L + (by omega) + have hdisj_P₂''_Q21 : Disjoint V(P₂'') V(Q_i₂_j₁) := + disjoint_subpath_P_of_inter_singleton S hs ht hst hP hP_bar hj₁m hj₂ hVQ21 hP₂''_L + (by omega) + have hP₂''_XT : V(P₂'') ∩ X_T = {v} := by + have hPa : Disjoint V(P₂'') V(P₁_a) := hdisj.symm.mono + hP₂''_le.vertexSet_mono hP₁a_le.vertexSet_mono + have hPb : Disjoint V(P₂'') V(P₁_b) := hdisj.symm.mono + hP₂''_le.vertexSet_mono hP₁b_le.vertexSet_mono + have hP₃ : V(P₂'') ∩ V(P₃') = {v} := by + apply subset_antisymm + · rintro x ⟨hx, hx'⟩ + exact hP₃'_ft.2.2.subset ⟨hx', hP₂''_le.vertexSet_mono hx⟩ + · rintro _ rfl + exact ⟨hP₂''_path.left_mem, hP₃'_ft.1.right_mem⟩ + simp [X_T, T₁, T₂, T₃, vertexSet_subgraphUnion, inter_union_distrib_left, hP₃, + (inter_comm V(P₂'') V(P₂')).trans hinter_P₂, + Set.disjoint_iff_inter_eq_empty.mp hPa, Set.disjoint_iff_inter_eq_empty.mp hPb, + Set.disjoint_iff_inter_eq_empty.mp hdisj_P₂''_Q12, + Set.disjoint_iff_inter_eq_empty.mp hdisj_P₂''_Q21] + have hd_R12 : Disjoint V(Q_0_i₁) V(Q_j₁_m) := + disjoint_subpath_P_subpath_P S hs ht hst hP hP_bar hm_pred (by omega) hVQ0 hVQjm + have hd_R13 : Disjoint V(Q_0_i₁) V(P₂'') := + hdisj_Q0_P₂.symm.mono_right hP₂''_le.vertexSet_mono + have hd_R23 : Disjoint V(Q_j₁_m) V(P₂'') := + hdisj_Qjm_P₂.symm.mono_right hP₂''_le.vertexSet_mono + have hs12_ne : L[i₁]'hi₁ ≠ L[j₁]'hj₁ := hij₁_ne + have hs13_ne : L[i₁]'hi₁ ≠ v := fun h => hv_not_P (h ▸ hi₁P) + have hs23_ne : L[j₁]'hj₁ ≠ v := fun h => hv_not_P (h ▸ hj₁P) + have hred : RedirectsTo S.G X_T S.Ω.bar {L[i₁]'hi₁, L[j₁]'hj₁, v} {t, s, L[j₂]'hj₂} := + redirectsTo_of_three_disjoint_paths + (Or.inl (Or.inl hs₁_int.1)) (Or.inl (Or.inr hs₂_int.1)) (Or.inr hs₃_int.1) + ht hs hj₂_bar hs12_ne hs13_ne hs23_ne + ⟨hR₁_path, hQ0_XT, hQ0_bar⟩ ⟨hR₂_path, hQjm_XT, hQjm_bar⟩ ⟨hR₃_path, hP₂''_XT, hP₂''_bar⟩ + hd_R12 hd_R13 hd_R23 + exact hnotripod ⟨T₁, T₂, T₃, u, L[i₂]'hi₂, hu_ne_i₂, hT₁_path, hT₂_path, hT₃_path, + hinter_T12, hinter_T13, hinter_T23, + L[i₁]'hi₁, hs₁_int, L[j₁]'hj₁, hs₂_int, v, hs₃_int, + t, ht, s, hs, L[j₂]'hj₂, hj₂_bar, hred⟩ + +/-- Case `r = 0` of `(2.4)` (`lemma_2_4_no_cross`): no reduced cross `(P₁, P₂)` in `(G₁, Ω₁)` +with indices `0 ≤ i₁ < i₂ < j₁ < j₂ < L.length` can have `j₂ < m`. -/ +theorem no_reduced_cross_of_zero_in_W1 (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) (hP_ind : P ≤i S.G) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + (hcatch : Catches (S.Ω.bar \ {s, t}) (deleteVertices S.G V(P))) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) + (hnotripod : ¬ ∃ T₁ T₂ T₃ : Graph α β, S.IsTripod T₁ T₂ T₃) + {P₁ P₂ : Graph α β} {i₁ j₁ i₂ j₂ : ℕ} + (hi₁ : i₁ < (splitList S hs ht hP).length) + (hj₁ : j₁ < (splitList S hs ht hP).length) + (hi₂ : i₂ < (splitList S hs ht hP).length) + (hj₂ : j₂ < (splitList S hs ht hP).length) + (h12 : i₁ < i₂) (h21 : i₂ < j₁) (h12' : j₁ < j₂) + (hdisj : Disjoint V(P₁) V(P₂)) + (hP₁ : IsGraphPathWithEnds (splitGraph S P s t) P₁ + ((splitList S hs ht hP)[i₁]'hi₁) ((splitList S hs ht hP)[j₁]'hj₁)) + (hP₂ : IsGraphPathWithEnds (splitGraph S P s t) P₂ + ((splitList S hs ht hP)[i₂]'hi₂) ((splitList S hs ht hP)[j₂]'hj₂)) + (hP₁_L : V(P₁) ∩ {x | x ∈ splitList S hs ht hP} = + {(splitList S hs ht hP)[i₁]'hi₁, (splitList S hs ht hP)[j₁]'hj₁}) + (hP₂_L : V(P₂) ∩ {x | x ∈ splitList S hs ht hP} = + {(splitList S hs ht hP)[i₂]'hi₂, (splitList S hs ht hP)[j₂]'hj₂}) + (hj₂m : j₂ < (pathWalkTS hP).support.length) : + False := by + let L := splitList S hs ht hP + have hnd := nodup_splitList S hs ht hst hP hP_bar + have hij₁_ne : L[i₁]'hi₁ ≠ L[j₁]'hj₁ := fun h => by + have := nodup_getElem_inj hnd hi₁ hj₁ h; omega + obtain ⟨u₀, hu₀P₁, hu₀H₁⟩ := + exists_vertex_in_splitSide_of_path_in_splitGraph S hs ht hst hP hP_ind hcatch hnocross + hP₁ hij₁_ne + obtain ⟨u, hu_union, k, hk, P₃, _, hmk, hdisj_P₃_P, hP₃_ft, hP₃_L, _⟩ := + exists_fromToPath_in_splitSide S hs ht hst hP hnocross + (X := V(P₁) ∪ V(P₂)) (Or.inl hu₀P₁) hu₀H₁ + have hu_not_P : u ∉ V(P) := disjoint_left.mp hdisj_P₃_P hP₃_ft.1.left_mem + rcases hu_union with huP₁ | huP₂ + · -- `u ∈ V(P₁)`: replace `L[i₁]` by `L[k]` (using `P₁_b ∪ P₃`) and contradict + -- `no_reduced_cross_of_one_in_W1`. + have hi₁P : L[i₁]'hi₁ ∈ V(P) := + (getElem_splitList_mem_P_iff S hs ht hst hP hP_bar hi₁).mpr (by omega) + have hu_ne_i₁ : u ≠ L[i₁]'hi₁ := fun h => hu_not_P (h ▸ hi₁P) + obtain ⟨P₁_a, P₁_b, _, hP₁b_le, hP₁a_path, hP₁b_path, _, hinter_P₁, _⟩ := + hP₁.exists_split_at huP₁ + have hP₁b_L : V(P₁_b) ∩ {x | x ∈ L} = {L[j₁]'hj₁} := + inter_right_of_split hP₁b_le hinter_P₁ hP₁a_path.left_mem hP₁b_path.right_mem hu_ne_i₁ hP₁_L + have hP₁b_P₃ : V(P₁_b) ∩ V(P₃) = {u} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hxPb, hxP₃⟩ => ?_, fun h => h ▸ ⟨hP₁b_path.left_mem, hP₃_ft.1.left_mem⟩⟩ + have hx_in : x ∈ V(P₃) ∩ (V(P₁) ∪ V(P₂)) := ⟨hxP₃, Or.inl (hP₁b_le.vertexSet_mono hxPb)⟩ + rwa [hP₃_ft.2.1, mem_singleton_iff] at hx_in + have hdisj_P₃_P₂ : Disjoint V(P₃) V(P₂) := by + rw [disjoint_left] + intro x hxP₃ hxP₂ + have hx_in : x ∈ V(P₃) ∩ (V(P₁) ∪ V(P₂)) := ⟨hxP₃, Or.inr hxP₂⟩ + rw [hP₃_ft.2.1, mem_singleton_iff] at hx_in + subst hx_in + exact disjoint_left.mp hdisj huP₁ hxP₂ + let P₁' := subgraphUnion (splitGraph S P s t) P₁_b P₃ + have hP₁'_path : IsGraphPathWithEnds (splitGraph S P s t) P₁' (L[j₁]'hj₁) (L[k]'hk) := + (hP₁b_path.mono hP₁.le).symm.subgraphUnion hP₃_ft.1 hP₁b_P₃ + have hdisj' : Disjoint V(P₂) V(P₁') := by + rw [vertexSet_subgraphUnion] + exact Disjoint.union_right (hdisj.symm.mono_right hP₁b_le.vertexSet_mono) hdisj_P₃_P₂.symm + have hP₁'_L : V(P₁') ∩ {x | x ∈ L} = {L[j₁]'hj₁, L[k]'hk} := by + rw [vertexSet_subgraphUnion, union_inter_distrib_right, hP₁b_L, hP₃_L] + ext x + simp [L, or_comm] + exact no_reduced_cross_of_one_in_W1 S hs ht hst hP hP_ind hP_bar hcatch hnocross hnotripod + hi₂ hj₂ hj₁ hk h21 h12' hdisj' hP₂ hP₁'_path hP₂_L hP₁'_L hj₂m hmk + · -- `u ∈ V(P₂)`: replace `L[j₂]` by `L[k]` and contradict `no_reduced_cross_of_one_in_W1`. + have hj₂P : L[j₂]'hj₂ ∈ V(P) := + (getElem_splitList_mem_P_iff S hs ht hst hP hP_bar hj₂).mpr hj₂m + have hu_ne_j₂ : u ≠ L[j₂]'hj₂ := fun h => hu_not_P (h ▸ hj₂P) + obtain ⟨P₂_a, P₂_b, hP₂a_le, _, hP₂a_path, hP₂b_path, _, hinter_P₂, _⟩ := + hP₂.exists_split_at huP₂ + have hP₂a_L : V(P₂_a) ∩ {x | x ∈ L} = {L[i₂]'hi₂} := + inter_left_of_split hP₂a_le hinter_P₂ hP₂a_path.left_mem hP₂b_path.right_mem hu_ne_j₂ hP₂_L + have hP₂a_P₃ : V(P₂_a) ∩ V(P₃) = {u} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hxPa, hxP₃⟩ => ?_, fun h => h ▸ ⟨hP₂a_path.right_mem, hP₃_ft.1.left_mem⟩⟩ + have hx_in : x ∈ V(P₃) ∩ (V(P₁) ∪ V(P₂)) := ⟨hxP₃, Or.inr (hP₂a_le.vertexSet_mono hxPa)⟩ + rwa [hP₃_ft.2.1, mem_singleton_iff] at hx_in + have hdisj_P₁_P₃ : Disjoint V(P₁) V(P₃) := by + rw [disjoint_left] + intro x hxP₁ hxP₃ + have hx_in : x ∈ V(P₃) ∩ (V(P₁) ∪ V(P₂)) := ⟨hxP₃, Or.inl hxP₁⟩ + rw [hP₃_ft.2.1, mem_singleton_iff] at hx_in + subst hx_in + exact disjoint_left.mp hdisj hxP₁ huP₂ + let P₂' := subgraphUnion (splitGraph S P s t) P₂_a P₃ + have hP₂'_path : IsGraphPathWithEnds (splitGraph S P s t) P₂' (L[i₂]'hi₂) (L[k]'hk) := + (hP₂a_path.mono hP₂.le).subgraphUnion hP₃_ft.1 hP₂a_P₃ + have hdisj' : Disjoint V(P₁) V(P₂') := by + rw [vertexSet_subgraphUnion] + exact Disjoint.union_right (hdisj.mono_right hP₂a_le.vertexSet_mono) hdisj_P₁_P₃ + have hP₂'_L : V(P₂') ∩ {x | x ∈ L} = {L[i₂]'hi₂, L[k]'hk} := by + rw [vertexSet_subgraphUnion, union_inter_distrib_right, hP₂a_L, hP₃_L] + ext x + simp [L, or_comm] + exact no_reduced_cross_of_one_in_W1 S hs ht hst hP hP_ind hP_bar hcatch hnocross hnotripod + hi₁ hj₁ hi₂ hk h12 h21 hdisj' hP₁ hP₂'_path hP₁_L hP₂'_L (by omega) hmk + +/-- **Graph Minors IX, (2.4)** (page 46): +"We claim also that $(G_1, \Omega_1)$ has no cross." -/ +theorem lemma_2_4_no_cross (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) (hP_ind : P ≤i S.G) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + (hcatch : Catches (S.Ω.bar \ {s, t}) (deleteVertices S.G V(P))) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) + (hnotripod : ¬ ∃ T₁ T₂ T₃ : Graph α β, S.IsTripod T₁ T₂ T₃) : + ¬ ∃ Q₁ Q₂ : Graph α β, (splitSociety S hs ht hst hP hP_bar hnocross).IsCross Q₁ Q₂ := by + rintro ⟨Q₁, Q₂, hcross⟩ + obtain ⟨P₁, P₂, i₁, j₁, i₂, j₂, hi₁, hj₁, hi₂, hj₂, + h12, h21, h12', hdisj, hP₁, hP₂, hP₁_L, hP₂_L⟩ := + exists_ordered_reduced_cross_of_ofNodupList + (nodup_splitList S hs ht hst hP hP_bar) (splitList_ne_nil S hs ht hP) + rfl rfl hcross + let m := (pathWalkTS hP).support.length + by_cases hmj₁ : m ≤ j₁ + · exact no_reduced_cross_of_two_in_W1 S hs ht hst hP hP_bar hnocross + hi₁ hj₁ hi₂ hj₂ h12 h21 h12' hdisj hP₁ hP₂ hP₁_L hP₂_L hmj₁ + · by_cases hmj₂ : m ≤ j₂ + · exact no_reduced_cross_of_one_in_W1 S hs ht hst hP hP_ind hP_bar hcatch hnocross hnotripod + hi₁ hj₁ hi₂ hj₂ h12 h21 hdisj hP₁ hP₂ hP₁_L hP₂_L (Nat.lt_of_not_ge hmj₁) hmj₂ + · exact no_reduced_cross_of_zero_in_W1 S hs ht hst hP hP_ind hP_bar hcatch hnocross hnotripod + hi₁ hj₁ hi₂ hj₂ h12 h21 h12' hdisj hP₁ hP₂ hP₁_L hP₂_L (Nat.lt_of_not_ge hmj₂) + +/-! ## Showing `(G₁, Ω₁)` Has No Tripod (`lemma_2_4_no_tripod`) -/ + +/-- Every walk `W` in `G` from `a ∈ V(A₁)` to `b ∈ V(A₂)` across a separation `(A₁, A₂)` of `G` +contains a vertex of `V(A₁) ∩ V(A₂)`. -/ +theorem exists_mem_inter_of_isGraphSeparation_of_walk {G A₁ A₂ : Graph α β} + (hsep : IsGraphSeparation G A₁ A₂) {a b : α} (W : GraphWalk G a b) + (ha : a ∈ V(A₁)) (hb : b ∈ V(A₂)) : + ∃ v ∈ W.support, v ∈ V(A₁) ∩ V(A₂) := by + induction W with + | @nil a _ => exact ⟨a, by simp, ha, hb⟩ + | @cons a w b e hlink W' ih => + have he : e ∈ E(A₁) ∪ E(A₂) := hsep.2.2.2.1 ▸ hlink.edge_mem + rcases he with he₁ | he₂ + · have hw : w ∈ V(A₁) := ((hsep.1.isLink_iff he₁).mpr hlink).right_mem + obtain ⟨v, hvW', hv⟩ := ih hw hb + exact ⟨v, List.mem_cons_of_mem a hvW', hv⟩ + · have ha₂ : a ∈ V(A₂) := ((hsep.2.1.isLink_iff he₂).mpr hlink).left_mem + exact ⟨a, by simp, ha, ha₂⟩ + +theorem exists_mem_inter_of_isGraphSeparation_of_path {G A₁ A₂ Q : Graph α β} + (hsep : IsGraphSeparation G A₁ A₂) {a b : α} (hQ : IsGraphPathWithEnds G Q a b) + (ha : a ∈ V(A₁)) (hb : b ∈ V(A₂)) : + ∃ v ∈ V(Q), v ∈ V(A₁) ∩ V(A₂) := by + obtain ⟨W, _, hV, _⟩ := hQ.2 + obtain ⟨W', hsupp, _⟩ := exists_walk_up_of_le hQ.1 W + obtain ⟨v, hvW', hv⟩ := exists_mem_inter_of_isGraphSeparation_of_walk hsep W' ha hb + refine ⟨v, ?_, hv⟩ + rw [hV, mem_ofPred_eq, ← hsupp] + exact hvW' + +/-- Given a separation `(A₁, A₂)` of `G` with `X ⊆ V(A₁)`, `Y ⊆ V(A₂)`, `V(A₂).Finite`, and +`(V(A₁) ∩ V(A₂)).ncard ≤ 3`, and three pairwise disjoint `X → Y` paths `Q₁, Q₂, Q₃` in `G` from +`s₁, s₂, s₃ ∈ X` to `t₁, t₂, t₃ ∈ Y`, every vertex of `V(A₁) ∩ V(A₂)` lies in +`V(Q₁) ∪ V(Q₂) ∪ V(Q₃)`, and every vertex of `X ∩ Y` lies in `{t₁, t₂, t₃}`. -/ +theorem sep_subset_and_inter_subset_of_three_legs {α : Type u} {β : Type v} + {G A₁ A₂ Q₁ Q₂ Q₃ : Graph α β} {X Y : Set α} {s₁ s₂ s₃ t₁ t₂ t₃ : α} + (hsep : IsGraphSeparation G A₁ A₂) (hfin : V(A₂).Finite) + (hX_A₁ : X ⊆ V(A₁)) (hY_A₂ : Y ⊆ V(A₂)) + (hcard_le : (V(A₁) ∩ V(A₂)).ncard ≤ 3) + (hQ₁ : IsFromToPathWithEnds G Q₁ X Y s₁ t₁) + (hQ₂ : IsFromToPathWithEnds G Q₂ X Y s₂ t₂) + (hQ₃ : IsFromToPathWithEnds G Q₃ X Y s₃ t₃) + (hd12 : Disjoint V(Q₁) V(Q₂)) + (hd13 : Disjoint V(Q₁) V(Q₃)) + (hd23 : Disjoint V(Q₂) V(Q₃)) : + V(A₁) ∩ V(A₂) ⊆ V(Q₁) ∪ V(Q₂) ∪ V(Q₃) ∧ + X ∩ Y ⊆ {t₁, t₂, t₃} := by + obtain ⟨v₁, hv₁Q, hv₁S⟩ := exists_mem_inter_of_isGraphSeparation_of_path hsep hQ₁.1 + (hX_A₁ hQ₁.left_mem_X) (hY_A₂ hQ₁.right_mem_Y) + obtain ⟨v₂, hv₂Q, hv₂S⟩ := exists_mem_inter_of_isGraphSeparation_of_path hsep hQ₂.1 + (hX_A₁ hQ₂.left_mem_X) (hY_A₂ hQ₂.right_mem_Y) + obtain ⟨v₃, hv₃Q, hv₃S⟩ := exists_mem_inter_of_isGraphSeparation_of_path hsep hQ₃.1 + (hX_A₁ hQ₃.left_mem_X) (hY_A₂ hQ₃.right_mem_Y) + have hv12 : v₁ ≠ v₂ := fun h => disjoint_left.mp hd12 hv₁Q (h ▸ hv₂Q) + have hv13 : v₁ ≠ v₃ := fun h => disjoint_left.mp hd13 hv₁Q (h ▸ hv₃Q) + have hv23 : v₂ ≠ v₃ := fun h => disjoint_left.mp hd23 hv₂Q (h ▸ hv₃Q) + have hsub : ({v₁, v₂, v₃} : Set α) ⊆ V(A₁) ∩ V(A₂) := by + rintro x (rfl | rfl | rfl) <;> assumption + have hcard3 : ({v₁, v₂, v₃} : Set α).ncard = 3 := by + rw [ncard_insert_of_notMem (by simp [hv12, hv13]) ((finite_singleton v₃).insert v₂), + ncard_insert_of_notMem (by simp [hv23]) (finite_singleton v₃), ncard_singleton] + have hfin_inter : (V(A₁) ∩ V(A₂)).Finite := hfin.subset inter_subset_right + have heq : ({v₁, v₂, v₃} : Set α) = V(A₁) ∩ V(A₂) := + eq_of_subset_of_ncard_le hsub (by omega) hfin_inter + have hS_sub : V(A₁) ∩ V(A₂) ⊆ V(Q₁) ∪ V(Q₂) ∪ V(Q₃) := by + rw [← heq] + rintro x (rfl | rfl | rfl) + · exact Or.inl (Or.inl hv₁Q) + · exact Or.inl (Or.inr hv₂Q) + · exact Or.inr hv₃Q + refine ⟨hS_sub, fun x ⟨hxX, hxY⟩ => ?_⟩ + have hxS : x ∈ V(A₁) ∩ V(A₂) := ⟨hX_A₁ hxX, hY_A₂ hxY⟩ + rcases hS_sub hxS with (hx₁ | hx₂) | hx₃ + · have hx_t₁ : x ∈ V(Q₁) ∩ Y := ⟨hx₁, hxY⟩ + rw [hQ₁.2.2, mem_singleton_iff] at hx_t₁ + simp [hx_t₁] + · have hx_t₂ : x ∈ V(Q₂) ∩ Y := ⟨hx₂, hxY⟩ + rw [hQ₂.2.2, mem_singleton_iff] at hx_t₂ + simp [hx_t₂] + · have hx_t₃ : x ∈ V(Q₃) ∩ Y := ⟨hx₃, hxY⟩ + rw [hQ₃.2.2, mem_singleton_iff] at hx_t₃ + simp [hx_t₃] + +/-- Replacing one leg `Q₁` at a vertex `z ∈ V(Q₁)` by a path `P_W'` from `z` to `w₁ ∈ Y` that meets +`V(Q₁) ∪ V(Q₂) ∪ V(Q₃)` only at `z`, meets `Y` only at `w₁`, and meets `X` only within `{z}` +produces a new `X → Y` leg `Q₁'` from `s₁` to `w₁` disjoint from `Q₂` and `Q₃`. -/ +theorem replace_leg_by_path {G Q₁ Q₂ Q₃ P_W' : Graph α β} {X Y : Set α} + {s₁ t₁ z w₁ : α} + (hQ₁ : IsFromToPathWithEnds G Q₁ X Y s₁ t₁) + (hd12 : Disjoint V(Q₁) V(Q₂)) (hd13 : Disjoint V(Q₁) V(Q₃)) + (hzQ₁ : z ∈ V(Q₁)) + (hPW'_path : IsGraphPathWithEnds G P_W' z w₁) + (hPW'_Q : V(P_W') ∩ (V(Q₁) ∪ V(Q₂) ∪ V(Q₃)) = {z}) + (hPW'_X : V(P_W') ∩ X ⊆ {z}) + (hPW'_Y : V(P_W') ∩ Y = {w₁}) : + IsFromToPathWithEnds G (subgraphUnion G (Classical.choose (hQ₁.1.exists_split_at hzQ₁)) P_W') + X Y s₁ w₁ ∧ + Disjoint V(subgraphUnion G (Classical.choose (hQ₁.1.exists_split_at hzQ₁)) P_W') V(Q₂) ∧ + Disjoint V(subgraphUnion G (Classical.choose (hQ₁.1.exists_split_at hzQ₁)) P_W') V(Q₃) := by + let Q₁_a := Classical.choose (hQ₁.1.exists_split_at hzQ₁) + obtain ⟨Q₁_b, hQ₁a_le, hQ₁b_le, hQ₁a_path, hQ₁b_path, _, hinter_Q₁, _⟩ := + Classical.choose_spec (hQ₁.1.exists_split_at hzQ₁) + have hQ₁a_PW' : V(Q₁_a) ∩ V(P_W') = {z} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hxQa, hxPW'⟩ => ?_, fun h => h ▸ ⟨hQ₁a_path.right_mem, hPW'_path.left_mem⟩⟩ + have hx_in : x ∈ V(P_W') ∩ (V(Q₁) ∪ V(Q₂) ∪ V(Q₃)) := + ⟨hxPW', Or.inl (Or.inl (hQ₁a_le.vertexSet_mono hxQa))⟩ + rwa [hPW'_Q, mem_singleton_iff] at hx_in + have hQ₁'_path : IsGraphPathWithEnds G (subgraphUnion G Q₁_a P_W') s₁ w₁ := + (hQ₁a_path.mono hQ₁.1.le).subgraphUnion hPW'_path hQ₁a_PW' + have hQ₁'_X : V(subgraphUnion G Q₁_a P_W') ∩ X = {s₁} := by + ext x + simp only [vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hxQa | hxPW', hxX⟩ + · have hx_in : x ∈ V(Q₁) ∩ X := ⟨hQ₁a_le.vertexSet_mono hxQa, hxX⟩ + rwa [hQ₁.2.1, mem_singleton_iff] at hx_in + · have hxz : x = z := mem_singleton_iff.mp (hPW'_X ⟨hxPW', hxX⟩) + subst hxz + have hx_in : x ∈ V(Q₁) ∩ X := ⟨hzQ₁, hxX⟩ + rwa [hQ₁.2.1, mem_singleton_iff] at hx_in + · rintro rfl + exact ⟨Or.inl hQ₁a_path.left_mem, hQ₁.left_mem_X⟩ + have hQ₁'_Y : V(subgraphUnion G Q₁_a P_W') ∩ Y = {w₁} := by + ext x + simp only [vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hxQa | hxPW', hxY⟩ + · have hxt₁ : x = t₁ := by + have hx_in : x ∈ V(Q₁) ∩ Y := ⟨hQ₁a_le.vertexSet_mono hxQa, hxY⟩ + rwa [hQ₁.2.2, mem_singleton_iff] at hx_in + subst hxt₁ + have hxz : x = z := by + have hx_in : x ∈ V(Q₁_a) ∩ V(Q₁_b) := ⟨hxQa, hQ₁b_path.right_mem⟩ + rwa [hinter_Q₁, mem_singleton_iff] at hx_in + subst hxz + have hx_in : x ∈ V(P_W') ∩ Y := ⟨hPW'_path.left_mem, hxY⟩ + rwa [hPW'_Y, mem_singleton_iff] at hx_in + · have hx_in : x ∈ V(P_W') ∩ Y := ⟨hxPW', hxY⟩ + rwa [hPW'_Y, mem_singleton_iff] at hx_in + · rintro rfl + have hw₁Y : x ∈ V(P_W') ∩ Y := by rw [hPW'_Y]; simp + exact ⟨Or.inr hPW'_path.right_mem, hw₁Y.2⟩ + have hdisj_PW'_Q₂ : Disjoint V(P_W') V(Q₂) := by + rw [disjoint_left] + intro x hxPW' hxQ₂ + have hx_in : x ∈ V(P_W') ∩ (V(Q₁) ∪ V(Q₂) ∪ V(Q₃)) := ⟨hxPW', Or.inl (Or.inr hxQ₂)⟩ + rw [hPW'_Q, mem_singleton_iff] at hx_in + subst hx_in + exact disjoint_left.mp hd12 hzQ₁ hxQ₂ + have hdisj_PW'_Q₃ : Disjoint V(P_W') V(Q₃) := by + rw [disjoint_left] + intro x hxPW' hxQ₃ + have hx_in : x ∈ V(P_W') ∩ (V(Q₁) ∪ V(Q₂) ∪ V(Q₃)) := ⟨hxPW', Or.inr hxQ₃⟩ + rw [hPW'_Q, mem_singleton_iff] at hx_in + subst hx_in + exact disjoint_left.mp hd13 hzQ₁ hxQ₃ + refine ⟨⟨hQ₁'_path, hQ₁'_X, hQ₁'_Y⟩, ?_, ?_⟩ + · rw [vertexSet_subgraphUnion] + exact Disjoint.union_left (hd12.mono_left hQ₁a_le.vertexSet_mono) hdisj_PW'_Q₂ + · rw [vertexSet_subgraphUnion] + exact Disjoint.union_left (hd13.mono_left hQ₁a_le.vertexSet_mono) hdisj_PW'_Q₃ + +theorem leg_in_W1_isFromToPathWithEnds (S : Society α β) {P Q : Graph α β} {s t s_q : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {X : Set α} {k : ℕ} (hk : k < (splitList S hs ht hP).length) + (hmk : (pathWalkTS hP).support.length ≤ k) + (hQ : IsFromToPathWithEnds (splitGraph S P s t) Q X + {x | x ∈ splitList S hs ht hP} s_q ((splitList S hs ht hP)[k]'hk)) : + (splitList S hs ht hP)[k]'hk ∈ S.Ω.bar ∧ + IsFromToPathWithEnds S.G Q X S.Ω.bar s_q ((splitList S hs ht hP)[k]'hk) := by + have hk_bar : (splitList S hs ht hP)[k]'hk ∈ S.Ω.bar := + ((getElem_splitList_mem_W1_iff S hs ht hst hP hP_bar hk).mpr hmk).1.1 + refine ⟨hk_bar, hQ.1.mono (splitGraph_le S P s t), hQ.2.1, ?_⟩ + ext x + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hxQ, hx_bar⟩ => ?_, fun h => h ▸ ⟨hQ.1.right_mem, hk_bar⟩⟩ + have hxG₁ : x ∈ V(splitGraph S P s t) := hQ.1.le.vertexSet_mono hxQ + have hxL : x ∈ {y | y ∈ splitList S hs ht hP} := + vertexSet_splitGraph_inter_bar_subset_splitList S hs ht hst hP ⟨hxG₁, hx_bar⟩ + have hx_in : x ∈ V(Q) ∩ {y | y ∈ splitList S hs ht hP} := ⟨hxQ, hxL⟩ + rwa [hQ.2.2, mem_singleton_iff] at hx_in + +theorem extend_leg_left_to_t (S : Society α β) {P Q_a : Graph α β} {s t s_a : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {X : Set α} {k_a k_b k_c : ℕ} + (hka : k_a < (splitList S hs ht hP).length) + (hkb : k_b < (splitList S hs ht hP).length) + (hkc : k_c < (splitList S hs ht hP).length) + (hab : k_a < k_b) (hac : k_a < k_c) + (hka_pred : k_a < (pathWalkTS hP).support.length - 1) + (hQa : IsFromToPathWithEnds (splitGraph S P s t) Q_a X + {x | x ∈ splitList S hs ht hP} s_a ((splitList S hs ht hP)[k_a]'hka)) + (hX_L : X ∩ {x | x ∈ splitList S hs ht hP} ⊆ + {(splitList S hs ht hP)[k_a]'hka, (splitList S hs ht hP)[k_b]'hkb, + (splitList S hs ht hP)[k_c]'hkc}) + {Q_0_ka : Graph α β} (hQ0_le : Q_0_ka ≤ P) + (hQ0_path : IsGraphPathWithEnds S.G Q_0_ka + ((splitList S hs ht hP)[0]'(by + rw [length_splitList] + have := two_le_length_support_pathWalkTS hst hP; omega)) + ((splitList S hs ht hP)[k_a]'hka)) + (hVQ0 : V(Q_0_ka) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + 0 ≤ k ∧ k ≤ k_a ∧ x = (splitList S hs ht hP)[k]'(by rw [length_splitList]; omega)}) : + IsFromToPathWithEnds S.G (subgraphUnion S.G Q_a Q_0_ka) X S.Ω.bar s_a t := by + have hm2 : 2 ≤ (pathWalkTS hP).support.length := two_le_length_support_pathWalkTS hst hP + have hka_m : k_a < (pathWalkTS hP).support.length := by omega + have hQa_Q0 : V(Q_a) ∩ V(Q_0_ka) = {(splitList S hs ht hP)[k_a]'hka} := by + rw [inter_comm] + exact inter_subpath_P_eq_of_inter_singleton S hs ht hst hP hP_bar hka_m hka hVQ0 + hQa.2.2 ⟨Nat.zero_le k_a, le_rfl⟩ + have hRa_path : IsGraphPathWithEnds S.G (subgraphUnion S.G Q_a Q_0_ka) s_a t := by + have h := (hQa.1.mono (splitGraph_le S P s t)).subgraphUnion hQ0_path.symm hQa_Q0 + rwa [getElem_splitList_zero S hs ht hP] at h + have hQ0_bar : V(Q_0_ka) ∩ S.Ω.bar = {t} := + subpath_P_inter_bar_eq_t S hs ht hst hP hP_bar hka_pred hQ0_le hVQ0 + have hRa_X : V(subgraphUnion S.G Q_a Q_0_ka) ∩ X = {s_a} := by + ext x + simp only [vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hxQa | hxQ0, hxX⟩ + · have hx_in : x ∈ V(Q_a) ∩ X := ⟨hxQa, hxX⟩ + rwa [hQa.2.1, mem_singleton_iff] at hx_in + · have hxL : x ∈ {y | y ∈ splitList S hs ht hP} := + subpath_P_subset_splitList S hs ht hP hVQ0 hxQ0 + have hx_three := hX_L ⟨hxX, hxL⟩ + simp only [mem_insert_iff, mem_singleton_iff] at hx_three + rcases hx_three with rfl | rfl | rfl + · have hx_in : (splitList S hs ht hP)[k_a]'hka ∈ V(Q_a) ∩ X := ⟨hQa.1.right_mem, hxX⟩ + rwa [hQa.2.1, mem_singleton_iff] at hx_in + · have hmem := (mem_subpath_P_iff S hs ht hst hP hP_bar hka_m hVQ0 hkb).mp hxQ0 + omega + · have hmem := (mem_subpath_P_iff S hs ht hst hP hP_bar hka_m hVQ0 hkc).mp hxQ0 + omega + · rintro rfl + exact ⟨Or.inl hQa.1.left_mem, hQa.left_mem_X⟩ + have hRa_bar : V(subgraphUnion S.G Q_a Q_0_ka) ∩ S.Ω.bar = {t} := by + ext x + simp only [vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hxQa | hxQ0, hx_bar⟩ + · have hxG₁ : x ∈ V(splitGraph S P s t) := hQa.1.le.vertexSet_mono hxQa + have hxL : x ∈ {y | y ∈ splitList S hs ht hP} := + vertexSet_splitGraph_inter_bar_subset_splitList S hs ht hst hP ⟨hxG₁, hx_bar⟩ + have hx_in : x ∈ V(Q_a) ∩ {y | y ∈ splitList S hs ht hP} := ⟨hxQa, hxL⟩ + rw [hQa.2.2, mem_singleton_iff] at hx_in + subst hx_in + have hxQ0' : (splitList S hs ht hP)[k_a]'hka ∈ V(Q_0_ka) ∩ S.Ω.bar := + ⟨hQ0_path.right_mem, hx_bar⟩ + rwa [hQ0_bar, mem_singleton_iff] at hxQ0' + · have hx_in : x ∈ V(Q_0_ka) ∩ S.Ω.bar := ⟨hxQ0, hx_bar⟩ + rwa [hQ0_bar, mem_singleton_iff] at hx_in + · rintro rfl + have ht_in : x ∈ V(Q_0_ka) ∩ S.Ω.bar := by rw [hQ0_bar]; simp + exact ⟨Or.inr ht_in.1, ht_in.2⟩ + exact ⟨hRa_path, hRa_X, hRa_bar⟩ + +theorem extend_leg_right_to_s (S : Society α β) {P Q_b : Graph α β} {s t s_b : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {X : Set α} {k_a k_b k_c : ℕ} + (hka : k_a < (splitList S hs ht hP).length) + (hkb : k_b < (splitList S hs ht hP).length) + (hkc : k_c < (splitList S hs ht hP).length) + (hab : k_a < k_b) + (hkb_pred : k_b ≤ (pathWalkTS hP).support.length - 1) + (hQb : IsFromToPathWithEnds (splitGraph S P s t) Q_b X + {x | x ∈ splitList S hs ht hP} s_b ((splitList S hs ht hP)[k_b]'hkb)) + (hX_L : X ∩ {x | x ∈ splitList S hs ht hP} ⊆ + {(splitList S hs ht hP)[k_a]'hka, (splitList S hs ht hP)[k_b]'hkb, + (splitList S hs ht hP)[k_c]'hkc}) + (hmkc : (pathWalkTS hP).support.length ≤ k_c) + {Q_kb_m : Graph α β} (hQbm_le : Q_kb_m ≤ P) + (hQbm_path : IsGraphPathWithEnds S.G Q_kb_m + ((splitList S hs ht hP)[k_b]'hkb) + ((splitList S hs ht hP)[(pathWalkTS hP).support.length - 1]'(by + rw [length_splitList] + have := two_le_length_support_pathWalkTS hst hP; omega))) + (hVQbm : V(Q_kb_m) = {x | ∃ k : ℕ, ∃ hk : k < (pathWalkTS hP).support.length, + k_b ≤ k ∧ k ≤ (pathWalkTS hP).support.length - 1 ∧ + x = (splitList S hs ht hP)[k]'(by rw [length_splitList]; omega)}) : + IsFromToPathWithEnds S.G (subgraphUnion S.G Q_b Q_kb_m) X S.Ω.bar s_b s := by + have hm2 : 2 ≤ (pathWalkTS hP).support.length := two_le_length_support_pathWalkTS hst hP + have hpred : (pathWalkTS hP).support.length - 1 < (pathWalkTS hP).support.length := by omega + have hQb_Qbm : V(Q_b) ∩ V(Q_kb_m) = {(splitList S hs ht hP)[k_b]'hkb} := by + rw [inter_comm] + exact inter_subpath_P_eq_of_inter_singleton S hs ht hst hP hP_bar hpred hkb hVQbm + hQb.2.2 ⟨le_rfl, hkb_pred⟩ + have hRb_path : IsGraphPathWithEnds S.G (subgraphUnion S.G Q_b Q_kb_m) s_b s := by + have h := (hQb.1.mono (splitGraph_le S P s t)).subgraphUnion hQbm_path hQb_Qbm + rwa [getElem_splitList_pred S hs ht hP] at h + have hQbm_bar : V(Q_kb_m) ∩ S.Ω.bar = {s} := + subpath_P_inter_bar_eq_s S hs ht hst hP hP_bar (by omega) hkb_pred hQbm_le hVQbm + have hRb_X : V(subgraphUnion S.G Q_b Q_kb_m) ∩ X = {s_b} := by + ext x + simp only [vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hxQb | hxQbm, hxX⟩ + · have hx_in : x ∈ V(Q_b) ∩ X := ⟨hxQb, hxX⟩ + rwa [hQb.2.1, mem_singleton_iff] at hx_in + · have hxL : x ∈ {y | y ∈ splitList S hs ht hP} := + subpath_P_subset_splitList S hs ht hP hVQbm hxQbm + have hx_three := hX_L ⟨hxX, hxL⟩ + simp only [mem_insert_iff, mem_singleton_iff] at hx_three + rcases hx_three with rfl | rfl | rfl + · have hmem := (mem_subpath_P_iff S hs ht hst hP hP_bar hpred hVQbm hka).mp hxQbm + omega + · have hx_in : (splitList S hs ht hP)[k_b]'hkb ∈ V(Q_b) ∩ X := ⟨hQb.1.right_mem, hxX⟩ + rwa [hQb.2.1, mem_singleton_iff] at hx_in + · have hmem := (mem_subpath_P_iff S hs ht hst hP hP_bar hpred hVQbm hkc).mp hxQbm + omega + · rintro rfl + exact ⟨Or.inl hQb.1.left_mem, hQb.left_mem_X⟩ + have hRb_bar : V(subgraphUnion S.G Q_b Q_kb_m) ∩ S.Ω.bar = {s} := by + ext x + simp only [vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hxQb | hxQbm, hx_bar⟩ + · have hxG₁ : x ∈ V(splitGraph S P s t) := hQb.1.le.vertexSet_mono hxQb + have hxL : x ∈ {y | y ∈ splitList S hs ht hP} := + vertexSet_splitGraph_inter_bar_subset_splitList S hs ht hst hP ⟨hxG₁, hx_bar⟩ + have hx_in : x ∈ V(Q_b) ∩ {y | y ∈ splitList S hs ht hP} := ⟨hxQb, hxL⟩ + rw [hQb.2.2, mem_singleton_iff] at hx_in + subst hx_in + have hxQbm' : (splitList S hs ht hP)[k_b]'hkb ∈ V(Q_kb_m) ∩ S.Ω.bar := + ⟨hQbm_path.left_mem, hx_bar⟩ + rwa [hQbm_bar, mem_singleton_iff] at hxQbm' + · have hx_in : x ∈ V(Q_kb_m) ∩ S.Ω.bar := ⟨hxQbm, hx_bar⟩ + rwa [hQbm_bar, mem_singleton_iff] at hx_in + · rintro rfl + have hs_in : x ∈ V(Q_kb_m) ∩ S.Ω.bar := by rw [hQbm_bar]; simp + exact ⟨Or.inr hs_in.1, hs_in.2⟩ + exact ⟨hRb_path, hRb_X, hRb_bar⟩ + +theorem redirectsTo_bar_of_sorted_legs (S : Society α β) {P Q_a Q_b Q_c : Graph α β} + {s t s_a s_b s_c : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {X : Set α} (hsa : s_a ∈ X) (hsb : s_b ∈ X) (hsc : s_c ∈ X) + (hsab : s_a ≠ s_b) (hsac : s_a ≠ s_c) (hsbc : s_b ≠ s_c) + {k_a k_b k_c : ℕ} + (hka : k_a < (splitList S hs ht hP).length) + (hkb : k_b < (splitList S hs ht hP).length) + (hkc : k_c < (splitList S hs ht hP).length) + (hab : k_a < k_b) + (hmkc : (pathWalkTS hP).support.length ≤ k_c) + (hQa : IsFromToPathWithEnds (splitGraph S P s t) Q_a X + {x | x ∈ splitList S hs ht hP} s_a ((splitList S hs ht hP)[k_a]'hka)) + (hQb : IsFromToPathWithEnds (splitGraph S P s t) Q_b X + {x | x ∈ splitList S hs ht hP} s_b ((splitList S hs ht hP)[k_b]'hkb)) + (hQc : IsFromToPathWithEnds (splitGraph S P s t) Q_c X + {x | x ∈ splitList S hs ht hP} s_c ((splitList S hs ht hP)[k_c]'hkc)) + (hd_ab : Disjoint V(Q_a) V(Q_b)) + (hd_ac : Disjoint V(Q_a) V(Q_c)) + (hd_bc : Disjoint V(Q_b) V(Q_c)) + (hX_L : X ∩ {x | x ∈ splitList S hs ht hP} ⊆ + {(splitList S hs ht hP)[k_a]'hka, (splitList S hs ht hP)[k_b]'hkb, + (splitList S hs ht hP)[k_c]'hkc}) : + ∃ t₁' ∈ S.Ω.bar, ∃ t₂' ∈ S.Ω.bar, ∃ t₃' ∈ S.Ω.bar, + RedirectsTo S.G X S.Ω.bar {s_a, s_b, s_c} {t₁', t₂', t₃'} := by + let m := (pathWalkTS hP).support.length + have hm2 : 2 ≤ m := two_le_length_support_pathWalkTS hst hP + obtain ⟨hkc_bar, hRc⟩ := + leg_in_W1_isFromToPathWithEnds S hs ht hst hP hP_bar hkc hmkc hQc + by_cases hka_pred : k_a < m - 1 + · have hka_m : k_a < m := by omega + obtain ⟨Q_0_ka, hQ0_le, hQ0_path, hVQ0⟩ := + exists_subpath_P_of_splitList_indices S hs ht hP (Nat.zero_le k_a) hka_m + have hRa := extend_leg_left_to_t S hs ht hst hP hP_bar hka hkb hkc hab (by omega) + hka_pred hQa hX_L hQ0_le hQ0_path hVQ0 + have hd_Qb_Q0 : Disjoint V(Q_b) V(Q_0_ka) := + disjoint_subpath_P_of_inter_singleton S hs ht hst hP hP_bar hka_m hkb hVQ0 hQb.2.2 (by omega) + have hd_Qc_Q0 : Disjoint V(Q_c) V(Q_0_ka) := + disjoint_subpath_P_of_inter_singleton S hs ht hst hP hP_bar hka_m hkc hVQ0 hQc.2.2 (by omega) + have hd_Ra_Qc : Disjoint V(subgraphUnion S.G Q_a Q_0_ka) V(Q_c) := by + rw [vertexSet_subgraphUnion] + exact Disjoint.union_left hd_ac hd_Qc_Q0.symm + by_cases hmkb : m ≤ k_b + · obtain ⟨hkb_bar, hRb⟩ := + leg_in_W1_isFromToPathWithEnds S hs ht hst hP hP_bar hkb hmkb hQb + have hd_Ra_Qb : Disjoint V(subgraphUnion S.G Q_a Q_0_ka) V(Q_b) := by + rw [vertexSet_subgraphUnion] + exact Disjoint.union_left hd_ab hd_Qb_Q0.symm + exact ⟨t, ht, _, hkb_bar, _, hkc_bar, + redirectsTo_of_three_disjoint_paths hsa hsb hsc ht hkb_bar hkc_bar + hsab hsac hsbc hRa hRb hRc hd_Ra_Qb hd_Ra_Qc hd_bc⟩ + · have hkb_pred : k_b ≤ m - 1 := by omega + have hpred : m - 1 < m := by omega + obtain ⟨Q_kb_m, hQbm_le, hQbm_path, hVQbm⟩ := + exists_subpath_P_of_splitList_indices S hs ht hP hkb_pred hpred + have hRb := extend_leg_right_to_s S hs ht hst hP hP_bar hka hkb hkc hab hkb_pred + hQb hX_L hmkc hQbm_le hQbm_path hVQbm + have hd_Qa_Qbm : Disjoint V(Q_a) V(Q_kb_m) := + disjoint_subpath_P_of_inter_singleton S hs ht hst hP hP_bar hpred hka hVQbm hQa.2.2 + (by omega) + have hd_Qc_Qbm : Disjoint V(Q_c) V(Q_kb_m) := + disjoint_subpath_P_of_inter_singleton S hs ht hst hP hP_bar hpred hkc hVQbm hQc.2.2 + (by omega) + have hd_Q0_Qbm : Disjoint V(Q_0_ka) V(Q_kb_m) := + disjoint_subpath_P_subpath_P S hs ht hst hP hP_bar hpred hab hVQ0 hVQbm + have hd_Ra_Rb : + Disjoint V(subgraphUnion S.G Q_a Q_0_ka) V(subgraphUnion S.G Q_b Q_kb_m) := by + rw [vertexSet_subgraphUnion, vertexSet_subgraphUnion] + exact Disjoint.union_left (Disjoint.union_right hd_ab hd_Qa_Qbm) + (Disjoint.union_right hd_Qb_Q0.symm hd_Q0_Qbm) + have hd_Rb_Qc : Disjoint V(subgraphUnion S.G Q_b Q_kb_m) V(Q_c) := by + rw [vertexSet_subgraphUnion] + exact Disjoint.union_left hd_bc hd_Qc_Qbm.symm + exact ⟨t, ht, s, hs, _, hkc_bar, + redirectsTo_of_three_disjoint_paths hsa hsb hsc ht hs hkc_bar + hsab hsac hsbc hRa hRb hRc hd_Ra_Rb hd_Ra_Qc hd_Rb_Qc⟩ + · -- `m - 1 ≤ k_a < k_b < k_c`, so `m ≤ k_b` and either `k_a = m - 1` (`L[k_a] = s`) or `m ≤ k_a`. + have hmkb : m ≤ k_b := by omega + obtain ⟨hkb_bar, hRb⟩ := + leg_in_W1_isFromToPathWithEnds S hs ht hst hP hP_bar hkb hmkb hQb + have hka_bar_and_Ra : + (splitList S hs ht hP)[k_a]'hka ∈ S.Ω.bar ∧ + IsFromToPathWithEnds S.G Q_a X S.Ω.bar s_a ((splitList S hs ht hP)[k_a]'hka) := by + by_cases hmka : m ≤ k_a + · exact leg_in_W1_isFromToPathWithEnds S hs ht hst hP hP_bar hka hmka hQa + · have hka_eq : k_a = m - 1 := by omega + have hLka_s : (splitList S hs ht hP)[k_a]'hka = s := by + subst hka_eq + exact getElem_splitList_pred S hs ht hP + have hka_bar : (splitList S hs ht hP)[k_a]'hka ∈ S.Ω.bar := by + rw [hLka_s] + exact hs + refine ⟨hka_bar, hQa.1.mono (splitGraph_le S P s t), hQa.2.1, ?_⟩ + ext x + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hxQa, hx_bar⟩ => ?_, fun h => h ▸ ⟨hQa.1.right_mem, hka_bar⟩⟩ + have hxG₁ : x ∈ V(splitGraph S P s t) := hQa.1.le.vertexSet_mono hxQa + have hxL : x ∈ {y | y ∈ splitList S hs ht hP} := + vertexSet_splitGraph_inter_bar_subset_splitList S hs ht hst hP ⟨hxG₁, hx_bar⟩ + have hx_in : x ∈ V(Q_a) ∩ {y | y ∈ splitList S hs ht hP} := ⟨hxQa, hxL⟩ + rwa [hQa.2.2, mem_singleton_iff] at hx_in + exact ⟨_, hka_bar_and_Ra.1, _, hkb_bar, _, hkc_bar, + redirectsTo_of_three_disjoint_paths hsa hsb hsc hka_bar_and_Ra.1 hkb_bar hkc_bar + hsab hsac hsbc hka_bar_and_Ra.2 hRb hRc hd_ab hd_ac hd_bc⟩ + +theorem redirectsTo_bar_of_one_leg_in_W1 (S : Society α β) {P Q_a Q_b Q_c : Graph α β} + {s t s_a s_b s_c : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {X : Set α} (hsa : s_a ∈ X) (hsb : s_b ∈ X) (hsc : s_c ∈ X) + (hsab : s_a ≠ s_b) (hsac : s_a ≠ s_c) (hsbc : s_b ≠ s_c) + {k_a k_b k_c : ℕ} + (hka : k_a < (splitList S hs ht hP).length) + (hkb : k_b < (splitList S hs ht hP).length) + (hkc : k_c < (splitList S hs ht hP).length) + (hmkc : (pathWalkTS hP).support.length ≤ k_c) + (hQa : IsFromToPathWithEnds (splitGraph S P s t) Q_a X + {x | x ∈ splitList S hs ht hP} s_a ((splitList S hs ht hP)[k_a]'hka)) + (hQb : IsFromToPathWithEnds (splitGraph S P s t) Q_b X + {x | x ∈ splitList S hs ht hP} s_b ((splitList S hs ht hP)[k_b]'hkb)) + (hQc : IsFromToPathWithEnds (splitGraph S P s t) Q_c X + {x | x ∈ splitList S hs ht hP} s_c ((splitList S hs ht hP)[k_c]'hkc)) + (hd_ab : Disjoint V(Q_a) V(Q_b)) + (hd_ac : Disjoint V(Q_a) V(Q_c)) + (hd_bc : Disjoint V(Q_b) V(Q_c)) + (hX_L : X ∩ {x | x ∈ splitList S hs ht hP} ⊆ + {(splitList S hs ht hP)[k_a]'hka, (splitList S hs ht hP)[k_b]'hkb, + (splitList S hs ht hP)[k_c]'hkc}) : + ∃ t₁' ∈ S.Ω.bar, ∃ t₂' ∈ S.Ω.bar, ∃ t₃' ∈ S.Ω.bar, + RedirectsTo S.G X S.Ω.bar {s_a, s_b, s_c} {t₁', t₂', t₃'} := by + have hkab_ne : k_a ≠ k_b := by + intro h + subst h + exact disjoint_left.mp hd_ab hQa.1.right_mem hQb.1.right_mem + rcases lt_or_gt_of_ne hkab_ne with hab | hba + · exact redirectsTo_bar_of_sorted_legs S hs ht hst hP hP_bar hsa hsb hsc hsab hsac hsbc + hka hkb hkc hab hmkc hQa hQb hQc hd_ab hd_ac hd_bc hX_L + · have hX_L' : X ∩ {x | x ∈ splitList S hs ht hP} ⊆ + {(splitList S hs ht hP)[k_b]'hkb, (splitList S hs ht hP)[k_a]'hka, + (splitList S hs ht hP)[k_c]'hkc} := by + intro x hx + rcases hX_L hx with rfl | rfl | rfl <;> simp + obtain ⟨t₁', ht₁', t₂', ht₂', t₃', ht₃', hred⟩ := + redirectsTo_bar_of_sorted_legs S hs ht hst hP hP_bar hsb hsa hsc hsab.symm hsbc hsac + hkb hka hkc hba hmkc hQb hQa hQc hd_ab.symm hd_bc hd_ac hX_L' + have hset_eq : ({s_b, s_a, s_c} : Set α) = {s_a, s_b, s_c} := by + ext x; simp [or_left_comm] + rw [hset_eq] at hred + exact ⟨t₁', ht₁', t₂', ht₂', t₃', ht₃', hred⟩ + +/-- **Graph Minors IX, (2.4)** (page 46): +"Suppose that $\{P_1, P_2, P_3\}$ is a tripod in $(G_1, \Omega_1)$... Thus $(G_1, \Omega_1)$ has no +tripod." -/ +theorem lemma_2_4_no_tripod (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) (hP_ind : P ≤i S.G) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + (hcatch : Catches (S.Ω.bar \ {s, t}) (deleteVertices S.G V(P))) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) + (hnotripod : ¬ ∃ T₁ T₂ T₃ : Graph α β, S.IsTripod T₁ T₂ T₃) : + ¬ ∃ T₁ T₂ T₃ : Graph α β, + (splitSociety S hs ht hst hP hP_bar hnocross).IsTripod T₁ T₂ T₃ := by + classical + let S₁ := splitSociety S hs ht hst hP hP_bar hnocross + let L := splitList S hs ht hP + rintro ⟨T₁, T₂, T₃, htripod⟩ + have hnocross₁ : ¬ ∃ Q₁ Q₂ : Graph α β, S₁.IsCross Q₁ Q₂ := + lemma_2_4_no_cross S hs ht hst hP hP_ind hP_bar hcatch hnocross hnotripod + obtain ⟨A₁, A₂, hsep_int, hT_le_A₁⟩ := + (theorem_2_3_proof S₁ htripod).resolve_left hnocross₁ + rcases htripod with ⟨u, v, huv, hT₁, hT₂, hT₃, hinter_12, hinter_13, hinter_23, + s₁, hs₁, s₂, hs₂, s₃, hs₃, t₁₀, _, t₂₀, _, t₃₀, _, hred₃⟩ + let X : Set α := V(T₁) ∪ V(T₂) ∪ V(T₃) + have hX_A₁ : X ⊆ V(A₁) := by + have hV := hT_le_A₁.vertexSet_mono + rwa [vertexSet_subgraphUnion, vertexSet_subgraphUnion] at hV + have hs12 : s₁ ≠ s₂ := by + intro h + have : s₁ ∈ V(T₁) ∩ V(T₂) := ⟨hs₁.1, h ▸ hs₂.1⟩ + rw [hinter_12] at this + exact hs₁.2 this + have hs13 : s₁ ≠ s₃ := by + intro h + have : s₁ ∈ V(T₁) ∩ V(T₃) := ⟨hs₁.1, h ▸ hs₃.1⟩ + rw [hinter_13] at this + exact hs₁.2 this + have hs23 : s₂ ≠ s₃ := by + intro h + have : s₂ ∈ V(T₂) ∩ V(T₃) := ⟨hs₂.1, h ▸ hs₃.1⟩ + rw [hinter_23] at this + exact hs₂.2 this + have hcard_s : ({s₁, s₂, s₃} : Set α).ncard = 3 := by + rw [ncard_insert_of_notMem (by simp [hs12, hs13]) ((finite_singleton s₃).insert s₂), + ncard_insert_of_notMem (by simp [hs23]) (finite_singleton s₃), ncard_singleton] + have hX'_fin : ({s₁, s₂, s₃} : Set α).Finite := + ((finite_singleton s₃).insert s₂).insert s₁ + have hY'_fin : ({t₁₀, t₂₀, t₃₀} : Set α).Finite := + ((finite_singleton t₃₀).insert t₂₀).insert t₁₀ + obtain ⟨Q_fam, x_fn, y_fn, hdisjQ, hQ_fam, hx_range, _⟩ := + exists_indexed_of_redirectsTo hX'_fin hY'_fin hred₃ hcard_s + obtain ⟨hx_inj, _, _, _, _⟩ := redirectsTo_of_disjoint_fromToPaths hdisjQ hQ_fam + obtain ⟨i₁, hi₁⟩ : s₁ ∈ range x_fn := hx_range ▸ by simp + obtain ⟨i₂, hi₂⟩ : s₂ ∈ range x_fn := hx_range ▸ by simp + obtain ⟨i₃, hi₃⟩ : s₃ ∈ range x_fn := hx_range ▸ by simp + have hi12 : i₁ ≠ i₂ := fun h => hs12 (hi₁ ▸ hi₂ ▸ congrArg x_fn h) + have hi13 : i₁ ≠ i₃ := fun h => hs13 (hi₁ ▸ hi₃ ▸ congrArg x_fn h) + have hi23 : i₂ ≠ i₃ := fun h => hs23 (hi₂ ▸ hi₃ ▸ congrArg x_fn h) + let Q₁ := Q_fam i₁ + let Q₂ := Q_fam i₂ + let Q₃ := Q_fam i₃ + have hbar₁_eq : S₁.Ω.bar = {x | x ∈ L} := by + change (splitCyclicPerm S hs ht hst hP hP_bar).bar = {x | x ∈ L} + rw [splitCyclicPerm, CyclicPerm.ofNodupList_bar] + have hQ₁ : IsFromToPathWithEnds (splitGraph S P s t) Q₁ X {x | x ∈ L} s₁ (y_fn i₁) := by + have h := hi₁ ▸ hQ_fam i₁ + rwa [hbar₁_eq] at h + have hQ₂ : IsFromToPathWithEnds (splitGraph S P s t) Q₂ X {x | x ∈ L} s₂ (y_fn i₂) := by + have h := hi₂ ▸ hQ_fam i₂ + rwa [hbar₁_eq] at h + have hQ₃ : IsFromToPathWithEnds (splitGraph S P s t) Q₃ X {x | x ∈ L} s₃ (y_fn i₃) := by + have h := hi₃ ▸ hQ_fam i₃ + rwa [hbar₁_eq] at h + have hd12 : Disjoint V(Q₁) V(Q₂) := hdisjQ hi12 + have hd13 : Disjoint V(Q₁) V(Q₃) := hdisjQ hi13 + have hd23 : Disjoint V(Q₂) V(Q₃) := hdisjQ hi23 + obtain ⟨k₁, hk₁, hy₁⟩ := List.mem_iff_getElem.mp hQ₁.right_mem_Y + obtain ⟨k₂, hk₂, hy₂⟩ := List.mem_iff_getElem.mp hQ₂.right_mem_Y + obtain ⟨k₃, hk₃, hy₃⟩ := List.mem_iff_getElem.mp hQ₃.right_mem_Y + have hQ₁' : IsFromToPathWithEnds (splitGraph S P s t) Q₁ X {x | x ∈ L} s₁ (L[k₁]'hk₁) := + hy₁ ▸ hQ₁ + have hQ₂' : IsFromToPathWithEnds (splitGraph S P s t) Q₂ X {x | x ∈ L} s₂ (L[k₂]'hk₂) := + hy₂ ▸ hQ₂ + have hQ₃' : IsFromToPathWithEnds (splitGraph S P s t) Q₃ X {x | x ∈ L} s₃ (L[k₃]'hk₃) := + hy₃ ▸ hQ₃ + -- Use the internal 3-separation `(A₁, A₂)` to find a path `P_W'` in `H₁` from `V(Q₁) ∪ V(Q₂) ∪ + -- V(Q₃)` to `W₁`. + have hsep_G₁ : IsGraphSeparation (splitGraph S P s t) A₁ A₂ := hsep_int.1.1.1 + have hL_A₂ : {x | x ∈ L} ⊆ V(A₂) := hbar₁_eq ▸ hsep_int.1.1.2 + have hfin_A₂ : V(A₂).Finite := S₁.finite_V.subset hsep_G₁.2.1.vertexSet_mono + have hS_and_XL := sep_subset_and_inter_subset_of_three_legs hsep_G₁ hfin_A₂ hX_A₁ hL_A₂ + hsep_int.1.2.1 hQ₁' hQ₂' hQ₃' hd12 hd13 hd23 + have hex_u₀ : ∃ u₀ ∈ V(splitGraph S P s t), u₀ ∉ V(A₂) := by + by_contra! hsub + have heq : V(A₂) = V(S₁.G) := Subset.antisymm hsep_G₁.2.1.vertexSet_mono hsub + exact hsep_int.1.2.2 heq + obtain ⟨u₀, hu₀G₁, hu₀_not_A₂⟩ := hex_u₀ + have hu₀A₁ : u₀ ∈ V(A₁) := by + have hu₀_union : u₀ ∈ V(A₁) ∪ V(A₂) := hsep_G₁.2.2.1 ▸ hu₀G₁ + exact hu₀_union.resolve_right hu₀_not_A₂ + have hu₀H₁ : u₀ ∈ V(splitSide S.G P (S.Ω.interval s t)) := by + rw [vertexSet_splitGraph_eq_union S hs ht hst hP hcatch hnocross] at hu₀G₁ + refine hu₀G₁.resolve_left fun hu₀P => hu₀_not_A₂ (hL_A₂ ?_) + change u₀ ∈ splitList S hs ht hP + rw [splitList, List.mem_append] + left + rwa [vertexSet_eq_support_pathWalkTS hP, mem_ofPred_eq] at hu₀P + obtain ⟨v_A, hv_A, k, hk, P_W, _, hmk, _, hPW_ft, hPW_L, _⟩ := + exists_fromToPath_in_splitSide S hs ht hst hP hnocross hu₀A₁ hu₀H₁ + have hv_A_S : v_A ∈ V(A₁) ∩ V(A₂) := by + obtain ⟨v', hv'PW, hv'S⟩ := exists_mem_inter_of_isGraphSeparation_of_path hsep_G₁ hPW_ft.1 + hv_A (hL_A₂ (List.getElem_mem hk)) + have hv'_in : v' ∈ V(P_W) ∩ V(A₁) := ⟨hv'PW, hv'S.1⟩ + rw [hPW_ft.2.1, mem_singleton_iff] at hv'_in + exact hv'_in ▸ hv'S + have hv_A_Q : v_A ∈ V(Q₁) ∪ V(Q₂) ∪ V(Q₃) := hS_and_XL.1 hv_A_S + obtain ⟨z, hzQ, w₁', hw₁'L, P_W', hPW'_le, hPW'_ft⟩ := + hPW_ft.1.exists_isFromToPathWithEnds (X := V(Q₁) ∪ V(Q₂) ∪ V(Q₃)) (Y := {x | x ∈ L}) + hv_A_Q (List.getElem_mem hk) + have hw₁'_eq : w₁' = L[k]'hk := by + have : w₁' ∈ V(P_W) ∩ {x | x ∈ L} := ⟨hPW'_le.vertexSet_mono hPW'_ft.1.right_mem, hw₁'L⟩ + rwa [hPW_L, mem_singleton_iff] at this + subst hw₁'_eq + have hPW'_X : V(P_W') ∩ X ⊆ {z} := by + rintro x ⟨hxPW', hxX⟩ + have hx_vA : x ∈ V(P_W) ∩ V(A₁) := ⟨hPW'_le.vertexSet_mono hxPW', hX_A₁ hxX⟩ + rw [hPW_ft.2.1, mem_singleton_iff] at hx_vA + subst hx_vA + have hv_in : x ∈ V(P_W') ∩ (V(Q₁) ∪ V(Q₂) ∪ V(Q₃)) := ⟨hxPW', hv_A_Q⟩ + rwa [hPW'_ft.2.1, mem_singleton_iff] at hv_in + have hs₁X : s₁ ∈ X := Or.inl (Or.inl hs₁.1) + have hs₂X : s₂ ∈ X := Or.inl (Or.inr hs₂.1) + have hs₃X : s₃ ∈ X := Or.inr hs₃.1 + have hT₁G : IsGraphPathWithEnds S.G T₁ u v := hT₁.mono (splitGraph_le S P s t) + have hT₂G : IsGraphPathWithEnds S.G T₂ u v := hT₂.mono (splitGraph_le S P s t) + have hT₃G : IsGraphPathWithEnds S.G T₃ u v := hT₃.mono (splitGraph_le S P s t) + rcases hzQ with (hzQ₁ | hzQ₂) | hzQ₃ + · obtain ⟨hQ₁_new, hd_12_new, hd_13_new⟩ := + replace_leg_by_path hQ₁' hd12 hd13 hzQ₁ hPW'_ft.1 hPW'_ft.2.1 hPW'_X hPW'_ft.2.2 + have ⟨_, hX_L_new⟩ := sep_subset_and_inter_subset_of_three_legs hsep_G₁ hfin_A₂ hX_A₁ hL_A₂ + hsep_int.1.2.1 hQ₂' hQ₃' hQ₁_new hd23 hd_12_new.symm hd_13_new.symm + obtain ⟨t₁', ht₁', t₂', ht₂', t₃', ht₃', hred⟩ := + redirectsTo_bar_of_one_leg_in_W1 S hs ht hst hP hP_bar hs₂X hs₃X hs₁X + hs23 hs12.symm hs13.symm hk₂ hk₃ hk hmk hQ₂' hQ₃' hQ₁_new + hd23 hd_12_new.symm hd_13_new.symm hX_L_new + have hset_eq : ({s₂, s₃, s₁} : Set α) = {s₁, s₂, s₃} := by + ext x; simp [or_comm, or_left_comm] + rw [hset_eq] at hred + exact hnotripod ⟨T₁, T₂, T₃, u, v, huv, hT₁G, hT₂G, hT₃G, + hinter_12, hinter_13, hinter_23, s₁, hs₁, s₂, hs₂, s₃, hs₃, + t₁', ht₁', t₂', ht₂', t₃', ht₃', hred⟩ + · have hPW'_Q2 : V(P_W') ∩ (V(Q₂) ∪ V(Q₁) ∪ V(Q₃)) = {z} := by + rw [union_comm V(Q₂) V(Q₁)] + exact hPW'_ft.2.1 + obtain ⟨hQ₂_new, hd_21_new, hd_23_new⟩ := + replace_leg_by_path hQ₂' hd12.symm hd23 hzQ₂ hPW'_ft.1 hPW'_Q2 hPW'_X hPW'_ft.2.2 + have ⟨_, hX_L_new⟩ := sep_subset_and_inter_subset_of_three_legs hsep_G₁ hfin_A₂ hX_A₁ hL_A₂ + hsep_int.1.2.1 hQ₁' hQ₃' hQ₂_new hd13 hd_21_new.symm hd_23_new.symm + obtain ⟨t₁', ht₁', t₂', ht₂', t₃', ht₃', hred⟩ := + redirectsTo_bar_of_one_leg_in_W1 S hs ht hst hP hP_bar hs₁X hs₃X hs₂X + hs13 hs12 hs23.symm hk₁ hk₃ hk hmk hQ₁' hQ₃' hQ₂_new + hd13 hd_21_new.symm hd_23_new.symm hX_L_new + have hset_eq : ({s₁, s₃, s₂} : Set α) = {s₁, s₂, s₃} := by + ext x; simp [or_comm] + rw [hset_eq] at hred + exact hnotripod ⟨T₁, T₂, T₃, u, v, huv, hT₁G, hT₂G, hT₃G, + hinter_12, hinter_13, hinter_23, s₁, hs₁, s₂, hs₂, s₃, hs₃, + t₁', ht₁', t₂', ht₂', t₃', ht₃', hred⟩ + · have hPW'_Q3 : V(P_W') ∩ (V(Q₃) ∪ V(Q₁) ∪ V(Q₂)) = {z} := by + have hunion_eq : V(Q₃) ∪ V(Q₁) ∪ V(Q₂) = V(Q₁) ∪ V(Q₂) ∪ V(Q₃) := by + ext x; simp [mem_union, or_comm, or_left_comm, or_assoc] + rw [hunion_eq] + exact hPW'_ft.2.1 + obtain ⟨hQ₃_new, hd_31_new, hd_32_new⟩ := + replace_leg_by_path hQ₃' hd13.symm hd23.symm hzQ₃ hPW'_ft.1 hPW'_Q3 hPW'_X hPW'_ft.2.2 + have ⟨_, hX_L_new⟩ := sep_subset_and_inter_subset_of_three_legs hsep_G₁ hfin_A₂ hX_A₁ hL_A₂ + hsep_int.1.2.1 hQ₁' hQ₂' hQ₃_new hd12 hd_31_new.symm hd_32_new.symm + obtain ⟨t₁', ht₁', t₂', ht₂', t₃', ht₃', hred⟩ := + redirectsTo_bar_of_one_leg_in_W1 S hs ht hst hP hP_bar hs₁X hs₂X hs₃X + hs12 hs13 hs23 hk₁ hk₂ hk hmk hQ₁' hQ₂' hQ₃_new + hd12 hd_31_new.symm hd_32_new.symm hX_L_new + exact hnotripod ⟨T₁, T₂, T₃, u, v, huv, hT₁G, hT₂G, hT₃G, + hinter_12, hinter_13, hinter_23, s₁, hs₁, s₂, hs₂, s₃, hs₃, + t₁', ht₁', t₂', ht₂', t₃', ht₃', hred⟩ + +/-! ## Applying `(2.1)` and the Induction on `|E(G)|` for `(2.4)` -/ + +/-- Trim a walk between distinct society boundary vertices to its first new boundary vertex. -/ +private theorem exists_path_avoiding_bar_diff_of_walk (S : Society α β) {s t₀ : α} + (hs : s ∈ S.Ω.bar) (ht₀ : t₀ ∈ S.Ω.bar) (hst₀ : t₀ ≠ s) (W₀ : GraphWalk S.G s t₀) : + ∃ s ∈ S.Ω.bar, ∃ t ∈ S.Ω.bar, s ≠ t ∧ + ∃ Q₀ : Graph α β, IsGraphPathWithEnds S.G Q₀ s t ∧ Avoids Q₀ (S.Ω.bar \ {s, t}) := by + have hst₀' : s ≠ t₀ := hst₀.symm + obtain ⟨W, hW_simple, _, _⟩ := exists_isSimple_subwalk W₀ + cases W with + | nil _ => exact (hst₀' rfl).elim + | @cons s w t₀ e hlink W' => + have hnd : (s :: W'.support).Nodup := hW_simple + obtain ⟨hs_not_W', _⟩ := List.nodup_cons.mp hnd + have ht₀_bar_diff : t₀ ∈ S.Ω.bar \ {s} := ⟨ht₀, fun h => hst₀ (mem_singleton_iff.mp h)⟩ + obtain ⟨w', hw'w, t, ht_diff, Q', _, hVQ'_sub, hQ'_ft⟩ := + exists_isFromToPathWithEnds_of_walk W' (X := {w}) (Y := S.Ω.bar \ {s}) rfl ht₀_bar_diff + rw [mem_singleton_iff] at hw'w + subst hw'w + have hs_not_Q' : s ∉ V(Q') := fun hsQ' => hs_not_W' (hVQ'_sub hsQ') + let W_sw : GraphWalk S.G s w' := .cons hlink (.nil hlink.right_mem) + have hsw_ne : s ≠ w' := fun h => hs_not_W' (h ▸ W'.start_mem_support) + have hW_sw_simple : W_sw.IsSimple := by simp [GraphWalk.IsSimple, W_sw, hsw_ne] + have hP_sw : IsGraphPathWithEnds S.G (walkSubgraph W_sw) s w' := + isGraphPathWithEnds_walkSubgraph hW_sw_simple + have hsw_Q' : V(walkSubgraph W_sw) ∩ V(Q') = {w'} := by + ext x + simp only [vertexSet_walkSubgraph, W_sw, GraphWalk.support_cons, GraphWalk.support_nil, + List.mem_cons, List.not_mem_nil, or_false, mem_inter_iff, mem_ofPred_eq, + mem_singleton_iff] + refine ⟨fun ⟨hx_sw, hxQ'⟩ => hx_sw.resolve_left fun hxs => hs_not_Q' (hxs ▸ hxQ'), ?_⟩ + rintro rfl + exact ⟨Or.inr rfl, hQ'_ft.1.left_mem⟩ + let Q₀ := subgraphUnion S.G (walkSubgraph W_sw) Q' + have hQ₀_path : IsGraphPathWithEnds S.G Q₀ s t := + hP_sw.subgraphUnion hQ'_ft.1 hsw_Q' + refine ⟨s, hs, t, ht_diff.1, Ne.symm ht_diff.2, Q₀, hQ₀_path, ?_⟩ + rw [Avoids, disjoint_left] + rintro x ⟨hx_bar, hx_ne⟩ hxQ₀ + simp only [mem_insert_iff, mem_singleton_iff, not_or] at hx_ne + rw [vertexSet_subgraphUnion] at hxQ₀ + rcases hxQ₀ with hx_sw | hxQ' + · simp only [vertexSet_walkSubgraph, W_sw, GraphWalk.support_cons, GraphWalk.support_nil, + List.mem_cons, List.not_mem_nil, or_false, mem_ofPred_eq] at hx_sw + rcases hx_sw with rfl | rfl + · exact hx_ne.1 rfl + · have hw_in : x ∈ V(Q') ∩ (S.Ω.bar \ {s}) := ⟨hQ'_ft.1.left_mem, hx_bar, hx_ne.1⟩ + rw [hQ'_ft.2.2, mem_singleton_iff] at hw_in + exact hx_ne.2 hw_in + · have hx_in : x ∈ V(Q') ∩ (S.Ω.bar \ {s}) := ⟨hxQ', hx_bar, hx_ne.1⟩ + rw [hQ'_ft.2.2, mem_singleton_iff] at hx_in + exact hx_ne.2 hx_in + +/-- In a society `S` whose graph `S.G` is connected and has `2 ≤ S.Ω.bar.ncard`, there exist +distinct `s, t ∈ S.Ω.bar` and an `(s, t)`-path `Q₀` in `S.G` avoiding `S.Ω.bar \ {s, t}`. -/ +theorem exists_path_avoiding_bar_diff (S : Society α β) + (hconn_G : IsGraphConnected S.G) (hbar2 : 2 ≤ S.Ω.bar.ncard) : + ∃ s ∈ S.Ω.bar, ∃ t ∈ S.Ω.bar, s ≠ t ∧ + ∃ Q₀ : Graph α β, IsGraphPathWithEnds S.G Q₀ s t ∧ Avoids Q₀ (S.Ω.bar \ {s, t}) := by + obtain ⟨s, hs⟩ := nonempty_of_ncard_ne_zero (by omega : S.Ω.bar.ncard ≠ 0) + obtain ⟨t₀, ht₀, hst₀⟩ := exists_ne_of_one_lt_ncard (by omega : 1 < S.Ω.bar.ncard) s + obtain ⟨W₀⟩ := hconn_G.2 s (S.bar_subset hs) t₀ (S.bar_subset ht₀) + exact exists_path_avoiding_bar_diff_of_walk S hs ht₀ hst₀ W₀ + +private theorem induced_catches_path_from_path (S : Society α β) + (hconn : S.IsKConnected 3) + (hG_loopless : ∀ x : α, ¬ S.G.Adj x x) + (hG_simple : ∀ e₁ e₂ x y, S.G.IsLink e₁ x y → S.G.IsLink e₂ x y → e₁ = e₂) + {s t : α} (hst : s ≠ t) {Q₀ : Graph α β} + (hQ₀ : IsGraphPathWithEnds S.G Q₀ s t) (hQ₀_av : Avoids Q₀ (S.Ω.bar \ {s, t})) : + ∃ P : Graph α β, + IsGraphPathWithEnds S.G P s t ∧ P ≤i S.G ∧ + Disjoint (V(P) \ {s, t}) S.Ω.bar ∧ + Catches (S.Ω.bar \ {s, t}) (deleteVertices S.G V(P)) := by + classical + let Z := S.Ω.bar \ {s, t} + have hZ_sub : Z ⊆ V(S.G) := sdiff_subset.trans S.bar_subset + let Good (H : Graph α β) : Prop := + H ≤ S.G ∧ Catches Z H ∧ ∃ Q : Graph α β, IsGraphPathWithEnds S.G Q s t ∧ Avoids Q V(H) + have hGood₀ : Good (S.G.induce Z) := by + refine ⟨S.G.induce_le hZ_sub, ⟨subset_rfl, fun C hC => ?_⟩, Q₀, hQ₀, hQ₀_av⟩ + obtain ⟨v, hvC⟩ := hC.2.1.1 + exact ⟨v, hC.1.vertexSet_mono hvC, hvC⟩ + have hex_max : ∀ (n : ℕ) {H : Graph α β}, Good H → + (V(S.G).ncard + E(S.G).ncard) - (V(H).ncard + E(H).ncard) = n → + ∃ H_m : Graph α β, Good H_m ∧ + ∀ H' : Graph α β, H_m ≤ H' → H' ≤ S.G → Catches Z H' → + (∃ Q : Graph α β, IsGraphPathWithEnds S.G Q s t ∧ Avoids Q V(H')) → H' = H_m := by + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro H hGood hmeas + by_cases hmax : ∀ H' : Graph α β, H ≤ H' → H' ≤ S.G → Catches Z H' → + (∃ Q : Graph α β, IsGraphPathWithEnds S.G Q s t ∧ Avoids Q V(H')) → H' = H + · exact ⟨H, hGood, hmax⟩ + · push Not at hmax + obtain ⟨H', hHH', hH'G, hZ', hQ', hne⟩ := hmax + have hV_le : V(H).ncard ≤ V(H').ncard := + ncard_le_ncard hHH'.vertexSet_mono (S.finite_V.subset hH'G.vertexSet_mono) + have hE_le : E(H).ncard ≤ E(H').ncard := + ncard_le_ncard hHH'.edgeSet_mono (S.finite_E.subset hH'G.edgeSet_mono) + have hV_top : V(H').ncard ≤ V(S.G).ncard := + ncard_le_ncard hH'G.vertexSet_mono S.finite_V + have hE_top : E(H').ncard ≤ E(S.G).ncard := + ncard_le_ncard hH'G.edgeSet_mono S.finite_E + have hlt_sum : V(H).ncard + E(H).ncard < V(H').ncard + E(H').ncard := by + by_cases hV_eq : V(H) = V(H') + · have hE_ne : E(H) ≠ E(H') := fun hE_eq => + hne ((Compatible.of_le_le le_rfl hHH').ext hV_eq.symm hE_eq.symm) + have hE_lt : E(H).ncard < E(H').ncard := + ncard_lt_ncard ⟨hHH'.edgeSet_mono, fun h => hE_ne (Subset.antisymm hHH'.edgeSet_mono + h)⟩ + (S.finite_E.subset hH'G.edgeSet_mono) + omega + · have hV_lt : V(H).ncard < V(H').ncard := + ncard_lt_ncard ⟨hHH'.vertexSet_mono, fun h => hV_eq (Subset.antisymm + hHH'.vertexSet_mono h)⟩ + (S.finite_V.subset hH'G.vertexSet_mono) + omega + exact ih ((V(S.G).ncard + E(S.G).ncard) - (V(H').ncard + E(H').ncard)) + (by omega) ⟨hH'G, hZ', hQ'⟩ rfl + obtain ⟨H, ⟨hHG, hZH, P, hP, hP_av⟩, hmax⟩ := hex_max _ hGood₀ rfl + have hPK : IsGraphPathWithEnds (deleteVertices S.G V(H)) P s t := + hP.in_deleteVertices hP_av + rcases theorem_2_1_proof hG_loopless hG_simple hst hHG hZH hmax hPK with hP_eq | hsep2 + · have hP_ind : P ≤i S.G := by + rw [hP_eq] + exact ⟨deleteVertices_le S.G V(H), fun e x y hxy hx hy => + (deleteVertices_isLink S.G V(H)).mpr ⟨hxy, hx.2, hy.2⟩⟩ + have hVP : V(P) = V(S.G) \ V(H) := by rw [hP_eq]; rfl + have hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar := by + rw [disjoint_left] + rintro x ⟨hxP, hx_st⟩ hx_bar + have hxZ : x ∈ Z := ⟨hx_bar, hx_st⟩ + exact disjoint_left.mp hP_av (hZH.1 hxZ) hxP + have hH_le_delP : H ≤ deleteVertices S.G V(P) := + le_deleteVertices hHG (by rw [hVP]; exact disjoint_sdiff_right) + have hV_delP : V(deleteVertices S.G V(P)) = V(H) := by + ext x + simp only [vertexSet_deleteVertices, hVP, mem_sdiff] + exact ⟨fun ⟨hxG, hx_not⟩ => by_contra fun hxH => hx_not ⟨hxG, hxH⟩, + fun hxH => ⟨hHG.vertexSet_mono hxH, fun ⟨_, hx_not⟩ => hx_not hxH⟩⟩ + have hcatch_delP : Catches Z (deleteVertices S.G V(P)) := by + refine ⟨hV_delP.symm ▸ hZH.1, fun C hC => ?_⟩ + obtain ⟨v, hvC⟩ := hC.2.1.1 + have hv_delP : v ∈ V(deleteVertices S.G V(P)) := hC.1.vertexSet_mono hvC + have hvH : v ∈ V(H) := hV_delP ▸ hv_delP + obtain ⟨z, hzZ, hzv⟩ := hZH.2 (reachableComponent H v) (isGraphComponent_reachableComponent + hvH) + have hC_eq : C = reachableComponent (deleteVertices S.G V(P)) v := + isGraphComponent_eq_reachableComponent hC hvC + refine ⟨z, hzZ, ?_⟩ + rw [hC_eq, vertexSet_reachableComponent] + rw [vertexSet_reachableComponent] at hzv + rcases hzv with ⟨hzH, ⟨W⟩⟩ + obtain ⟨W', _, _⟩ := exists_walk_up_of_le hH_le_delP W + exact ⟨hH_le_delP.vertexSet_mono hzH, ⟨W'⟩⟩ + exact ⟨P, hP, hP_ind, hP_bar, hcatch_delP⟩ + · obtain ⟨G₁, G₂, hsep, hst_G₁, hcard2, _, _, hHG₁, hVG₁_ne⟩ := hsep2 + have hbar_G₁ : S.Ω.bar ⊆ V(G₁) := by + intro x hx_bar + by_cases hx_st : x ∈ ({s, t} : Set α) + · exact hst_G₁ hx_st + · exact hHG₁.vertexSet_mono (hZH.1 ⟨hx_bar, hx_st⟩) + have hsep_S : S.IsKSeparation 2 G₂ G₁ := + ⟨⟨IsGraphSeparation.symm hsep, hbar_G₁⟩, by rw [inter_comm, hcard2], hVG₁_ne⟩ + exact (hconn 2 (by omega) G₂ G₁ hsep_S).elim + +/-- **Graph Minors IX, (2.4)** (page 45): +"We may choose distinct $s, t \in \bar{\Omega}$ such that there is a path between $s$ and $t$ +avoiding $Z$, where $Z = \bar{\Omega} - \{s, t\}$. We apply (2.1), and deduce that there is a path +$P$ joining $s$ and $t$ such that $P$ is an induced subgraph of $G$ and $Z$ catches +$G \setminus V(P)$. In particular, no internal vertex of $P$ is in $\bar{\Omega}$." -/ +theorem exists_induced_catches_path_of_three_connected (S : Society α β) + (hconn : S.IsKConnected 3) + (hconn_G : IsGraphConnected S.G) + (hG_loopless : ∀ x : α, ¬ S.G.Adj x x) + (hG_simple : ∀ e₁ e₂ x y, S.G.IsLink e₁ x y → S.G.IsLink e₂ x y → e₁ = e₂) + (hbar3 : 3 ≤ S.Ω.bar.ncard) : + ∃ s ∈ S.Ω.bar, ∃ t ∈ S.Ω.bar, s ≠ t ∧ + ∃ P : Graph α β, + IsGraphPathWithEnds S.G P s t ∧ + P ≤i S.G ∧ + Disjoint (V(P) \ {s, t}) S.Ω.bar ∧ + Catches (S.Ω.bar \ {s, t}) (deleteVertices S.G V(P)) := by + classical + obtain ⟨s, hs, t, ht, hst, Q₀, hQ₀, hQ₀_av⟩ := + exists_path_avoiding_bar_diff S hconn_G (by omega) + exact ⟨s, hs, t, ht, hst, induced_catches_path_from_path S hconn hG_loopless hG_simple + hst hQ₀ hQ₀_av⟩ + +/-! ## Module 1: Walk Uniqueness on a Path, Simple Reduction, and 3-Connected Base Lemmas -/ + +/-- Any simple walk `W₂` from `u` to `v` in a graph `P` whose vertices and edges are those of a +simple walk `W₁ : GraphWalk P u v` has the same support as `W₁`. -/ +theorem support_eq_of_isSimple_of_subset {P : Graph α β} {u v : α} + (W₁ W₂ : GraphWalk P u v) (h₁ : W₁.IsSimple) (h₂ : W₂.IsSimple) + (hE : ∀ e ∈ W₂.edges, e ∈ W₁.edges) : + W₂.support = W₁.support := by + induction W₁ with + | @nil u hu => + have hlen : W₂.length = 0 := h₂.length_eq_zero + cases W₂ with + | nil _ => rfl + | cons _ _ => simp at hlen + | @cons u w v e hlink₁ W₁' ih => + have hnd₁ : (u :: W₁'.support).Nodup := h₁ + obtain ⟨hu_not₁, h₁'⟩ := List.nodup_cons.mp hnd₁ + cases W₂ with + | nil _ => + exact (hu_not₁ W₁'.end_mem_support).elim + | @cons u w' v f hlink₂ W₂' => + have hnd₂ : (u :: W₂'.support).Nodup := h₂ + obtain ⟨hu_not₂, h₂'⟩ := List.nodup_cons.mp hnd₂ + have hf_in : f ∈ e :: W₁'.edges := hE f (by simp) + have hf_eq : f = e := by + rcases List.mem_cons.mp hf_in with rfl | hf' + · rfl + · exfalso + exact hu_not₁ (W₁'.left_mem_support_of_mem_edges hf' hlink₂) + have hw'_eq : w' = w := by + have hlink₂' : P.IsLink e u w' := hf_eq ▸ hlink₂ + rcases hlink₂'.eq_and_eq_or_eq_and_eq hlink₁ with ⟨_, rfl⟩ | ⟨rfl, _⟩ + · rfl + · exact (hu_not₁ W₁'.start_mem_support).elim + subst hw'_eq + have hE' : ∀ g ∈ W₂'.edges, g ∈ W₁'.edges := by + intro g hg + have hg_in : g ∈ e :: W₁'.edges := hE g (by simp [hg]) + rcases List.mem_cons.mp hg_in with rfl | hg' + · exfalso + exact hu_not₂ (W₂'.left_mem_support_of_mem_edges hg hlink₁) + · exact hg' + simp [ih W₂' h₁' h₂' hE'] + +theorem support_pathWalkTS_symm {G P : Graph α β} {s t : α} + (hP : IsGraphPathWithEnds G P s t) : + (pathWalkTS hP.symm).support = (pathWalkTS hP).support.reverse := by + have h₁ : (pathWalkTS hP).reverse.IsSimple := (isSimple_pathWalkTS hP).reverse + have h₂ : (pathWalkTS hP.symm).IsSimple := isSimple_pathWalkTS hP.symm + have hE : ∀ e ∈ (pathWalkTS hP.symm).edges, e ∈ (pathWalkTS hP).reverse.edges := by + intro e he + rw [GraphWalk.edges_reverse, List.mem_reverse] + have heP : e ∈ E(P) := by rw [edgeSet_eq_edges_pathWalkTS hP.symm]; exact he + rwa [edgeSet_eq_edges_pathWalkTS hP] at heP + rw [← GraphWalk.support_reverse] + exact support_eq_of_isSimple_of_subset (pathWalkTS hP).reverse (pathWalkTS hP.symm) h₁ h₂ hE + +/-- Every edge of a walk `W` links consecutive vertices `W.support[k]` and `W.support[k+1]`. -/ +theorem exists_consecutive_of_mem_edges {G : Graph α β} {u v : α} + (W : GraphWalk G u v) {e : β} (he : e ∈ W.edges) : + ∃ (k : ℕ) (hk : k + 1 < W.support.length), + G.IsLink e (W.support[k]'(Nat.lt_trans (Nat.lt_succ_self k) hk)) (W.support[k + 1]'hk) := by + induction W with + | nil _ => simp at he + | @cons u w v f hlink W' ih => + rcases List.mem_cons.mp he with rfl | he' + · refine ⟨0, by cases W' <;> simp, ?_⟩ + have h1 : (u :: W'.support)[1]'(by cases W' <;> simp) = w := by + cases W' <;> rfl + simpa [h1] using hlink + · obtain ⟨k, hk, hlink_k⟩ := ih he' + refine ⟨k + 1, by simp; omega, ?_⟩ + simpa using hlink_k + +/-- If two vertices are adjacent in `P` (`IsGraphPathWithEnds G P s t`), they are consecutive +vertices along `(pathWalkTS hP).support`. -/ +theorem exists_support_index_of_adj_pathWalkTS {G P : Graph α β} {s t x y : α} + (hP : IsGraphPathWithEnds G P s t) (hadj : P.Adj x y) : + ∃ (k : ℕ) (hk : k + 1 < (pathWalkTS hP).support.length), + ({x, y} : Set α) = + {(pathWalkTS hP).support[k]'(Nat.lt_trans (Nat.lt_succ_self k) hk), + (pathWalkTS hP).support[k + 1]'hk} := by + obtain ⟨e, hxy⟩ := hadj + have he : e ∈ (pathWalkTS hP).edges := by + have heP : e ∈ E(P) := hxy.edge_mem + rwa [edgeSet_eq_edges_pathWalkTS hP] at heP + obtain ⟨k, hk, hlink_k⟩ := exists_consecutive_of_mem_edges (pathWalkTS hP) he + refine ⟨k, hk, ?_⟩ + rcases hxy.eq_and_eq_or_eq_and_eq hlink_k with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · exact pair_comm _ _ + +/-- In a 3-connected society `S` with `E(S.G) = ∅`, every vertex of `S.G` is in `S.Ω.bar`. -/ +theorem vertexSet_eq_bar_of_edgeSet_eq_empty (S : Society α β) + (hconn : S.IsKConnected 3) (hE : E(S.G) = ∅) : + V(S.G) = S.Ω.bar := by + refine Subset.antisymm (fun v hvG => ?_) S.bar_subset + by_contra hv_not_bar + let G₁ := (S.G.induce {v}).restrict ∅ + let G₂ := deleteVertices S.G {v} + have hG₁_le : G₁ ≤ S.G := restrict_le.trans (S.G.induce_le (singleton_subset_iff.mpr hvG)) + have hG₂_le : G₂ ≤ S.G := deleteVertices_le S.G {v} + have hV_union : V(G₁) ∪ V(G₂) = V(S.G) := by + ext x + simp only [G₁, G₂, vertexSet_restrict, vertexSet_induce, vertexSet_deleteVertices, + mem_union, mem_singleton_iff, mem_sdiff] + exact ⟨fun h => h.elim (fun hxv => hxv ▸ hvG) And.left, + fun hxG => by_cases (fun hxv : x = v => Or.inl hxv) (fun hxv => Or.inr ⟨hxG, hxv⟩)⟩ + have hE_union : E(G₁) ∪ E(G₂) = E(S.G) := by + refine Subset.antisymm (union_subset hG₁_le.edgeSet_mono hG₂_le.edgeSet_mono) ?_ + rw [hE] + exact empty_subset _ + have hE_disj : Disjoint E(G₁) E(G₂) := by + have : E(G₁) = ∅ := by simp [G₁] + rw [this] + exact disjoint_bot_left + have hbar_G₂ : S.Ω.bar ⊆ V(G₂) := by + intro x hx_bar + exact ⟨S.bar_subset hx_bar, fun hxv => hv_not_bar (mem_singleton_iff.mp hxv ▸ hx_bar)⟩ + have hinter_empty : V(G₁) ∩ V(G₂) = ∅ := by + ext x + simp [G₁, G₂] + have hcard0 : (V(G₁) ∩ V(G₂)).ncard ≤ 0 := by + rw [hinter_empty, ncard_empty] + have hVG₂_ne : V(G₂) ≠ V(S.G) := by + intro heq + have hvG₂ : v ∈ V(G₂) := heq.symm ▸ hvG + exact hvG₂.2 (mem_singleton v) + have hsep : S.IsKSeparation 0 G₁ G₂ := + ⟨⟨⟨hG₁_le, hG₂_le, hV_union, hE_union, hE_disj⟩, hbar_G₂⟩, hcard0, hVG₂_ne⟩ + exact hconn 0 (by omega) G₁ G₂ hsep + +/-- In a 3-connected loopless society `S` with `E(S.G).Nonempty`, there exist distinct +`s, t ∈ S.Ω.bar` and an `(s, t)`-path `Q₀` in `S.G` avoiding `S.Ω.bar \ {s, t}`. -/ +theorem exists_path_avoiding_bar_diff_of_three_connected (S : Society α β) + (hconn : S.IsKConnected 3) + (hG_loopless : ∀ x : α, ¬ S.G.Adj x x) + (hE : E(S.G).Nonempty) : + ∃ s ∈ S.Ω.bar, ∃ t ∈ S.Ω.bar, s ≠ t ∧ + ∃ Q₀ : Graph α β, IsGraphPathWithEnds S.G Q₀ s t ∧ Avoids Q₀ (S.Ω.bar \ {s, t}) := by + obtain ⟨e₀, he₀⟩ := hE + obtain ⟨u, v, huv_link⟩ := S.G.exists_isLink_of_mem_edgeSet he₀ + have huv_ne : u ≠ v := fun h => hG_loopless u ⟨e₀, h ▸ huv_link⟩ + let C₀ := reachableComponent S.G u + have huC₀ : u ∈ V(C₀) := self_mem_reachableComponent huv_link.left_mem + have hvC₀ : v ∈ V(C₀) := by + rw [vertexSet_reachableComponent] + exact ⟨huv_link.right_mem, ⟨.cons huv_link (.nil huv_link.right_mem)⟩⟩ + have hex_walk : ∃ s ∈ S.Ω.bar, ∃ t₀ ∈ S.Ω.bar, s ≠ t₀ ∧ Nonempty (GraphWalk S.G s t₀) := by + by_cases hsub_bar : V(C₀) ⊆ S.Ω.bar + · exact ⟨u, hsub_bar huC₀, v, hsub_bar hvC₀, huv_ne, + ⟨.cons huv_link (.nil huv_link.right_mem)⟩⟩ + · obtain ⟨w₀, hw₀C₀, hw₀_not_bar⟩ := not_subset.mp hsub_bar + have hcard2 : 2 ≤ (V(C₀) ∩ S.Ω.bar).ncard := by + by_contra hlt2 + let G₁ := C₀ + let G₂ := (S.G.induce ((V(S.G) \ V(C₀)) ∪ S.Ω.bar)).restrict (E(S.G) \ E(C₀)) + have hC₀_comp : IsGraphComponent C₀ S.G := + isGraphComponent_reachableComponent huv_link.left_mem + have hG₁_le : G₁ ≤ S.G := hC₀_comp.1 + have hG₂_le : G₂ ≤ S.G := + restrict_le.trans (S.G.induce_le (union_subset sdiff_subset S.bar_subset)) + have hV_union : V(G₁) ∪ V(G₂) = V(S.G) := by + ext x + simp only [G₁, G₂, vertexSet_restrict, vertexSet_induce, mem_union, mem_sdiff] + exact ⟨fun h => h.elim (fun hx => hG₁_le.vertexSet_mono hx) + (fun h2 => h2.elim And.left (fun hx => S.bar_subset hx)), + fun hxG => by_cases (fun hxC : x ∈ V(C₀) => Or.inl hxC) + (fun hxC => Or.inr (Or.inl ⟨hxG, hxC⟩))⟩ + have hE_G₂ : E(G₂) = E(S.G) \ E(C₀) := by + unfold G₂ + rw [edgeSet_restrict, inter_eq_right] + rintro e ⟨heG, he_not_C₀⟩ + obtain ⟨x, y, hxy⟩ := S.G.exists_isLink_of_mem_edgeSet heG + have hx_not_C₀ : x ∉ V(C₀) := by + intro hxC₀ + have hC₀_closed : C₀ ≤c S.G := isClosedSubgraph_of_isGraphComponent hC₀_comp + have hyC₀ : y ∈ V(C₀) := (mem_graphComponent_iff_of_isLink hC₀_comp hxy).mp hxC₀ + have hxy_C₀ : C₀.IsLink e x y := + hC₀_closed.isInducedSubgraph.isLink_of_mem_mem hxy hxC₀ hyC₀ + exact he_not_C₀ hxy_C₀.edge_mem + have hy_not_C₀ : y ∉ V(C₀) := fun hyC₀ => + hx_not_C₀ ((mem_graphComponent_iff_of_isLink hC₀_comp hxy).mpr hyC₀) + exact ⟨x, y, hxy, Or.inl ⟨hxy.left_mem, hx_not_C₀⟩, Or.inl ⟨hxy.right_mem, hy_not_C₀⟩⟩ + have hE_union : E(G₁) ∪ E(G₂) = E(S.G) := by + rw [hE_G₂] + ext e + simp only [mem_union, mem_sdiff] + exact ⟨fun h => h.elim (fun he => hG₁_le.edgeSet_mono he) And.left, + fun he => by_cases (fun he1 : e ∈ E(G₁) => Or.inl he1) (fun he1 => Or.inr ⟨he, he1⟩)⟩ + have hE_disj : Disjoint E(G₁) E(G₂) := by + rw [hE_G₂] + exact disjoint_sdiff_right + have hbar_G₂ : S.Ω.bar ⊆ V(G₂) := fun x hx => Or.inr hx + have hinter_eq : V(G₁) ∩ V(G₂) = V(C₀) ∩ S.Ω.bar := by + ext x + simp only [G₁, G₂, vertexSet_restrict, vertexSet_induce, mem_inter_iff, mem_union, + mem_sdiff] + exact ⟨fun ⟨hxC, h⟩ => ⟨hxC, h.resolve_left fun ⟨_, hx_not⟩ => hx_not hxC⟩, + fun ⟨hxC, hx_bar⟩ => ⟨hxC, Or.inr hx_bar⟩⟩ + have hVG₂_ne : V(G₂) ≠ V(S.G) := by + intro heq + have hw₀G₂ : w₀ ∈ V(G₂) := heq.symm ▸ hG₁_le.vertexSet_mono hw₀C₀ + rcases hw₀G₂ with ⟨_, hw₀_not⟩ | hw₀_bar + · exact hw₀_not hw₀C₀ + · exact hw₀_not_bar hw₀_bar + have hsep : S.IsKSeparation 1 G₁ G₂ := + ⟨⟨⟨hG₁_le, hG₂_le, hV_union, hE_union, hE_disj⟩, hbar_G₂⟩, + by rw [hinter_eq]; omega, hVG₂_ne⟩ + exact hconn 1 (by omega) G₁ G₂ hsep + obtain ⟨s, hs_in⟩ := nonempty_of_ncard_ne_zero (by omega : (V(C₀) ∩ S.Ω.bar).ncard ≠ 0) + obtain ⟨t₀, ht₀_in, hst₀⟩ := exists_ne_of_one_lt_ncard (by omega : 1 < + (V(C₀) ∩ S.Ω.bar).ncard) s + obtain ⟨W_C₀⟩ := (isGraphConnected_reachableComponent huv_link.left_mem).2 s hs_in.1 t₀ + ht₀_in.1 + obtain ⟨W₀, _, _⟩ := exists_walk_up_of_le (reachableComponent_le S.G u) W_C₀ + exact ⟨s, hs_in.2, t₀, ht₀_in.2, hst₀.symm, ⟨W₀⟩⟩ + obtain ⟨s, hs, t₀, ht₀, hst₀', ⟨W₀⟩⟩ := hex_walk + exact exists_path_avoiding_bar_diff_of_walk S hs ht₀ hst₀'.symm W₀ + +theorem exists_induced_catches_path_of_three_connected_nonempty (S : Society α β) + (hconn : S.IsKConnected 3) + (hG_loopless : ∀ x : α, ¬ S.G.Adj x x) + (hG_simple : ∀ e₁ e₂ x y, S.G.IsLink e₁ x y → S.G.IsLink e₂ x y → e₁ = e₂) + (hE : E(S.G).Nonempty) : + ∃ s ∈ S.Ω.bar, ∃ t ∈ S.Ω.bar, s ≠ t ∧ + ∃ P : Graph α β, + IsGraphPathWithEnds S.G P s t ∧ + P ≤i S.G ∧ + Disjoint (V(P) \ {s, t}) S.Ω.bar ∧ + Catches (S.Ω.bar \ {s, t}) (deleteVertices S.G V(P)) := by + classical + obtain ⟨s, hs, t, ht, hst, Q₀, hQ₀, hQ₀_av⟩ := + exists_path_avoiding_bar_diff_of_three_connected S hconn hG_loopless hE + exact ⟨s, hs, t, ht, hst, induced_catches_path_from_path S hconn hG_loopless hG_simple + hst hQ₀ hQ₀_av⟩ + +theorem RedirectsTo.mono {G H : Graph α β} (hle : H ≤ G) {X Y X' Y' : Set α} + (h : RedirectsTo H X Y X' Y') : RedirectsTo G X Y X' Y' := by + rcases h with ⟨hX', hY', hcard, P, hdisj, hP⟩ + exact ⟨hX', hY', hcard, P, hdisj, fun i => + let ⟨x, hx, y, hy, hft⟩ := hP i + ⟨x, hx, y, hy, hft.1.mono hle, hft.2⟩⟩ + +theorem isCross_mono_of_le {S₀ S : Society α β} (hle : S₀.G ≤ S.G) (hΩ : S₀.Ω = S.Ω) + {Q₁ Q₂ : Graph α β} (h : S₀.IsCross Q₁ Q₂) : S.IsCross Q₁ Q₂ := by + rcases h with ⟨hdisj, s₁, t₁, s₂, t₂, ⟨hP₁, hne₁, hs₁, ht₁⟩, ⟨hP₂, hne₂, hs₂, ht₂⟩, hcross⟩ + rw [hΩ] at hs₁ ht₁ hs₂ ht₂ hcross + exact ⟨hdisj, s₁, t₁, s₂, t₂, ⟨hP₁.mono hle, hne₁, hs₁, ht₁⟩, + ⟨hP₂.mono hle, hne₂, hs₂, ht₂⟩, hcross⟩ + +theorem isTripod_mono_of_le {S₀ S : Society α β} (hle : S₀.G ≤ S.G) (hΩ : S₀.Ω = S.Ω) + {T₁ T₂ T₃ : Graph α β} (h : S₀.IsTripod T₁ T₂ T₃) : S.IsTripod T₁ T₂ T₃ := by + rcases h with ⟨u, v, huv, h₁, h₂, h₃, hi12, hi13, hi23, + s₁, hs₁, s₂, hs₂, s₃, hs₃, t₁, ht₁, t₂, ht₂, t₃, ht₃, hred⟩ + rw [hΩ] at ht₁ ht₂ ht₃ hred + exact ⟨u, v, huv, h₁.mono hle, h₂.mono hle, h₃.mono hle, hi12, hi13, hi23, + s₁, hs₁, s₂, hs₂, s₃, hs₃, t₁, ht₁, t₂, ht₂, t₃, ht₃, hred.mono hle⟩ + +/-- Deleting a loop or a parallel duplicate edge `e₀` preserves `IsKConnected k`. -/ +theorem isKConnected_restrict_sdiff_singleton (S : Society α β) (k : ℕ) + (hconn : S.IsKConnected k) {e₀ : β} {u v : α} + (he₀_link : S.G.IsLink e₀ u v) + (hred : u = v ∨ ∃ e₁ : β, e₁ ≠ e₀ ∧ S.G.IsLink e₁ u v) : + (Society.mk (S.G.restrict (E(S.G) \ {e₀})) S.Ω S.finite_V + (S.finite_E.subset restrict_le.edgeSet_mono) S.bar_subset).IsKConnected k := by + let S' : Society α β := ⟨S.G.restrict (E(S.G) \ {e₀}), S.Ω, S.finite_V, + S.finite_E.subset restrict_le.edgeSet_mono, S.bar_subset⟩ + have hE_S' : E(S'.G) = E(S.G) \ {e₀} := by + change E(S.G.restrict (E(S.G) \ {e₀})) = _ + rw [edgeSet_restrict, inter_eq_right] + exact sdiff_subset + intro k' hk' G₁ G₂ hsep + rcases hsep with ⟨⟨⟨hG₁_le, hG₂_le, hV_union, hE_union, hE_disj⟩, hbar_G₂⟩, hcard, hVG₂_ne⟩ + have hG₁_G : G₁ ≤ S.G := hG₁_le.trans restrict_le + have hG₂_G : G₂ ≤ S.G := hG₂_le.trans restrict_le + have he₀_not_S' : e₀ ∉ E(S'.G) := by + rw [hE_S'] + exact fun h => h.2 (mem_singleton e₀) + have he₀_not_G₁ : e₀ ∉ E(G₁) := fun h => he₀_not_S' (hG₁_le.edgeSet_mono h) + have he₀_not_G₂ : e₀ ∉ E(G₂) := fun h => he₀_not_S' (hG₂_le.edgeSet_mono h) + have huv_side : (u ∈ V(G₁) ∧ v ∈ V(G₁)) ∨ (u ∈ V(G₂) ∧ v ∈ V(G₂)) := by + rcases hred with rfl | ⟨e₁, he₁_ne, he₁_link⟩ + · have hu_in : u ∈ V(G₁) ∪ V(G₂) := by rw [hV_union]; exact he₀_link.left_mem + rcases hu_in with hu₁ | hu₂ + · exact Or.inl ⟨hu₁, hu₁⟩ + · exact Or.inr ⟨hu₂, hu₂⟩ + · have he₁_S' : e₁ ∈ E(S'.G) := by + rw [hE_S'] + exact ⟨he₁_link.edge_mem, fun h => he₁_ne (mem_singleton_iff.mp h)⟩ + have he₁_link' : S'.G.IsLink e₁ u v := (restrict_le.isLink_iff he₁_S').mpr he₁_link + have he₁_union : e₁ ∈ E(G₁) ∪ E(G₂) := hE_union.symm ▸ he₁_S' + rcases he₁_union with he₁_1 | he₁_2 + · have hl1 : G₁.IsLink e₁ u v := (hG₁_le.isLink_iff he₁_1).mpr he₁_link' + exact Or.inl ⟨hl1.left_mem, hl1.right_mem⟩ + · have hl2 : G₂.IsLink e₁ u v := (hG₂_le.isLink_iff he₁_2).mpr he₁_link' + exact Or.inr ⟨hl2.left_mem, hl2.right_mem⟩ + rcases huv_side with ⟨hu₁, hv₁⟩ | ⟨hu₂, hv₂⟩ + · let G₁' := (S.G.induce V(G₁)).restrict (insert e₀ E(G₁)) + have hG₁'_le : G₁' ≤ S.G := restrict_le.trans (S.G.induce_le hG₁_G.vertexSet_mono) + have hE_G₁' : E(G₁') = insert e₀ E(G₁) := by + unfold G₁' + rw [edgeSet_restrict, inter_eq_right] + rintro e (rfl | he₁) + · exact ⟨u, v, he₀_link, hu₁, hv₁⟩ + · obtain ⟨x, y, hxy⟩ := G₁.exists_isLink_of_mem_edgeSet he₁ + exact ⟨x, y, hxy.mono hG₁_G, hxy.left_mem, hxy.right_mem⟩ + have hE_union' : E(G₁') ∪ E(G₂) = E(S.G) := by + rw [hE_G₁', insert_union, hE_union, hE_S', insert_sdiff_singleton, + insert_eq_of_mem he₀_link.edge_mem] + have hE_disj' : Disjoint E(G₁') E(G₂) := by + rw [hE_G₁', disjoint_insert_left] + exact ⟨he₀_not_G₂, hE_disj⟩ + have hsep' : S.IsKSeparation k' G₁' G₂ := + ⟨⟨⟨hG₁'_le, hG₂_G, hV_union, hE_union', hE_disj'⟩, hbar_G₂⟩, hcard, hVG₂_ne⟩ + exact hconn k' hk' G₁' G₂ hsep' + · let G₂' := (S.G.induce V(G₂)).restrict (insert e₀ E(G₂)) + have hG₂'_le : G₂' ≤ S.G := restrict_le.trans (S.G.induce_le hG₂_G.vertexSet_mono) + have hE_G₂' : E(G₂') = insert e₀ E(G₂) := by + unfold G₂' + rw [edgeSet_restrict, inter_eq_right] + rintro e (rfl | he₂) + · exact ⟨u, v, he₀_link, hu₂, hv₂⟩ + · obtain ⟨x, y, hxy⟩ := G₂.exists_isLink_of_mem_edgeSet he₂ + exact ⟨x, y, hxy.mono hG₂_G, hxy.left_mem, hxy.right_mem⟩ + have hE_union' : E(G₁) ∪ E(G₂') = E(S.G) := by + rw [hE_G₂', union_insert, hE_union, hE_S', insert_sdiff_singleton, + insert_eq_of_mem he₀_link.edge_mem] + have hE_disj' : Disjoint E(G₁) E(G₂') := by + rw [hE_G₂', disjoint_insert_right] + exact ⟨he₀_not_G₁, hE_disj⟩ + have hsep' : S.IsKSeparation k' G₁ G₂' := + ⟨⟨⟨hG₁_G, hG₂'_le, hV_union, hE_union', hE_disj'⟩, hbar_G₂⟩, hcard, hVG₂_ne⟩ + exact hconn k' hk' G₁ G₂' hsep' + +/-- Every 3-connected society `S` with no cross or tripod admits a simple spanning reduction `S₀` +preserving 3-connectivity, no-cross, no-tripod, and non-loop adjacency. -/ +theorem exists_simple_reduction (S : Society α β) + (hconn : S.IsKConnected 3) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) + (hnotripod : ¬ ∃ T₁ T₂ T₃ : Graph α β, S.IsTripod T₁ T₂ T₃) : + ∃ S₀ : Society α β, + S₀.G ≤ S.G ∧ + V(S₀.G) = V(S.G) ∧ + S₀.Ω = S.Ω ∧ + S₀.IsKConnected 3 ∧ + (¬ ∃ Q₁ Q₂ : Graph α β, S₀.IsCross Q₁ Q₂) ∧ + (¬ ∃ T₁ T₂ T₃ : Graph α β, S₀.IsTripod T₁ T₂ T₃) ∧ + (∀ x : α, ¬ S₀.G.Adj x x) ∧ + (∀ e₁ e₂ x y, S₀.G.IsLink e₁ x y → S₀.G.IsLink e₂ x y → e₁ = e₂) ∧ + (∀ e x y, S.G.IsLink e x y → x = y ∨ S₀.G.Adj x y) := by + suffices h : ∀ (n : ℕ) (S' : Society α β), E(S'.G).ncard = n → + S'.IsKConnected 3 → + (¬ ∃ Q₁ Q₂ : Graph α β, S'.IsCross Q₁ Q₂) → + (¬ ∃ T₁ T₂ T₃ : Graph α β, S'.IsTripod T₁ T₂ T₃) → + ∃ S₀ : Society α β, + S₀.G ≤ S'.G ∧ + V(S₀.G) = V(S'.G) ∧ + S₀.Ω = S'.Ω ∧ + S₀.IsKConnected 3 ∧ + (¬ ∃ Q₁ Q₂ : Graph α β, S₀.IsCross Q₁ Q₂) ∧ + (¬ ∃ T₁ T₂ T₃ : Graph α β, S₀.IsTripod T₁ T₂ T₃) ∧ + (∀ x : α, ¬ S₀.G.Adj x x) ∧ + (∀ e₁ e₂ x y, S₀.G.IsLink e₁ x y → S₀.G.IsLink e₂ x y → e₁ = e₂) ∧ + (∀ e x y, S'.G.IsLink e x y → x = y ∨ S₀.G.Adj x y) from + h E(S.G).ncard S rfl hconn hnocross hnotripod + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro S' hn hconn' hnocross' hnotripod' + by_cases hG_loopless : ∀ x : α, ¬ S'.G.Adj x x + · by_cases hG_simple : ∀ e₁ e₂ x y, S'.G.IsLink e₁ x y → S'.G.IsLink e₂ x y → e₁ = e₂ + · exact ⟨S', le_rfl, rfl, rfl, hconn', hnocross', hnotripod', hG_loopless, hG_simple, + fun e x y hxy => Or.inr ⟨e, hxy⟩⟩ + · push Not at hG_simple + obtain ⟨e₀, e₁, u, v, he₀, he₁, hne⟩ := hG_simple + let S₁ : Society α β := ⟨S'.G.restrict (E(S'.G) \ {e₀}), S'.Ω, S'.finite_V, + S'.finite_E.subset restrict_le.edgeSet_mono, S'.bar_subset⟩ + have hE_S₁ : E(S₁.G) = E(S'.G) \ {e₀} := by + change E(S'.G.restrict (E(S'.G) \ {e₀})) = _ + rw [edgeSet_restrict, inter_eq_right] + exact sdiff_subset + have hlt : E(S₁.G).ncard < n := by + rw [← hn, hE_S₁] + exact ncard_lt_ncard ⟨sdiff_subset, fun h => (h he₀.edge_mem).2 (mem_singleton e₀)⟩ + S'.finite_E + have hconn₁ : S₁.IsKConnected 3 := + isKConnected_restrict_sdiff_singleton S' 3 hconn' he₀ (Or.inr ⟨e₁, hne.symm, he₁⟩) + have hnocross₁ : ¬ ∃ Q₁ Q₂ : Graph α β, S₁.IsCross Q₁ Q₂ := + fun ⟨Q₁, Q₂, hc⟩ => hnocross' ⟨Q₁, Q₂, isCross_mono_of_le (S₀ := S₁) (S + := S') restrict_le rfl hc⟩ + have hnotripod₁ : ¬ ∃ T₁ T₂ T₃ : Graph α β, S₁.IsTripod T₁ T₂ T₃ := + fun ⟨T₁, T₂, T₃, ht⟩ => hnotripod' ⟨T₁, T₂, T₃, isTripod_mono_of_le (S₀ := S₁) (S + := S') restrict_le rfl ht⟩ + obtain ⟨S₀, hle₀, hV₀, hΩ₀, hc₀, hnc₀, hnt₀, hloop₀, hsimp₀, hadj₀⟩ := + ih _ hlt S₁ rfl hconn₁ hnocross₁ hnotripod₁ + refine ⟨S₀, hle₀.trans restrict_le, hV₀, hΩ₀, hc₀, hnc₀, hnt₀, hloop₀, hsimp₀, ?_⟩ + intro e x y hxy + by_cases hee₀ : e = e₀ + · subst hee₀ + have he₁_S₁ : S₁.G.IsLink e₁ u v := by + refine (restrict_le.isLink_iff ?_).mpr he₁ + rw [hE_S₁] + exact ⟨he₁.edge_mem, fun h => hne.symm (mem_singleton_iff.mp h)⟩ + rcases hxy.eq_and_eq_or_eq_and_eq he₀ with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hadj₀ e₁ x y he₁_S₁ + · exact hadj₀ e₁ x y he₁_S₁.symm + · have he_S₁ : S₁.G.IsLink e x y := by + refine (restrict_le.isLink_iff ?_).mpr hxy + rw [hE_S₁] + exact ⟨hxy.edge_mem, hee₀⟩ + exact hadj₀ e x y he_S₁ + · push Not at hG_loopless + obtain ⟨u, e₀, he₀⟩ := hG_loopless + let S₁ : Society α β := ⟨S'.G.restrict (E(S'.G) \ {e₀}), S'.Ω, S'.finite_V, + S'.finite_E.subset restrict_le.edgeSet_mono, S'.bar_subset⟩ + have hE_S₁ : E(S₁.G) = E(S'.G) \ {e₀} := by + change E(S'.G.restrict (E(S'.G) \ {e₀})) = _ + rw [edgeSet_restrict, inter_eq_right] + exact sdiff_subset + have hlt : E(S₁.G).ncard < n := by + rw [← hn, hE_S₁] + exact ncard_lt_ncard ⟨sdiff_subset, fun h => (h he₀.edge_mem).2 (mem_singleton e₀)⟩ + S'.finite_E + have hconn₁ : S₁.IsKConnected 3 := + isKConnected_restrict_sdiff_singleton S' 3 hconn' he₀ (Or.inl rfl) + have hnocross₁ : ¬ ∃ Q₁ Q₂ : Graph α β, S₁.IsCross Q₁ Q₂ := + fun ⟨Q₁, Q₂, hc⟩ => hnocross' ⟨Q₁, Q₂, isCross_mono_of_le (S₀ := S₁) (S + := S') restrict_le rfl hc⟩ + have hnotripod₁ : ¬ ∃ T₁ T₂ T₃ : Graph α β, S₁.IsTripod T₁ T₂ T₃ := + fun ⟨T₁, T₂, T₃, ht⟩ => hnotripod' ⟨T₁, T₂, T₃, isTripod_mono_of_le (S₀ := S₁) (S + := S') restrict_le rfl ht⟩ + obtain ⟨S₀, hle₀, hV₀, hΩ₀, hc₀, hnc₀, hnt₀, hloop₀, hsimp₀, hadj₀⟩ := + ih _ hlt S₁ rfl hconn₁ hnocross₁ hnotripod₁ + refine ⟨S₀, hle₀.trans restrict_le, hV₀, hΩ₀, hc₀, hnc₀, hnt₀, hloop₀, hsimp₀, ?_⟩ + intro e x y hxy + by_cases hee₀ : e = e₀ + · subst hee₀ + rcases hxy.eq_and_eq_or_eq_and_eq he₀ with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl rfl + · exact Or.inl rfl + · have he_S₁ : S₁.G.IsLink e x y := by + refine (restrict_le.isLink_iff ?_).mpr hxy + rw [hE_S₁] + exact ⟨hxy.edge_mem, hee₀⟩ + exact hadj₀ e x y he_S₁ + + + +theorem iterate_toFun_eq_getElem_of_next {Ω : CyclicPerm α} {L : List α} + (hL_next : ∀ (i : ℕ) (hi : i < L.length), + Ω.toFun (L[i]'hi) = L[(i + 1) % L.length]'(Nat.mod_lt _ (Nat.zero_lt_of_lt hi))) + {i₀ : ℕ} (hi₀ : i₀ < L.length) (d : ℕ) : + (Ω.toFun^[d]) (L[i₀]'hi₀) = + L[(i₀ + d) % L.length]'(Nat.mod_lt _ (Nat.zero_lt_of_lt hi₀)) := by + have hpos : 0 < L.length := Nat.zero_lt_of_lt hi₀ + induction d with + | zero => + simp only [Function.iterate_zero_apply, Nat.add_zero] + congr 1 + exact (Nat.mod_eq_of_lt hi₀).symm + | succ d ih => + rw [Function.iterate_succ_apply', ih, hL_next _ (Nat.mod_lt _ hpos)] + congr 1 + rw [Nat.mod_add_mod, Nat.add_assoc] + +noncomputable section + +open Classical in +/-- Shift an angle assignment `θ` on `L` by adding `2π` to vertices appearing before `i₀`, +so that angles become strictly increasing along the `Ω`-orbit starting at `L[i₀]`. -/ +def shiftedAngle (L : List α) (θ : α → ℝ) (i₀ : ℕ) (v : α) : ℝ := + if hv : v ∈ L then + if CyclicPerm.indexOfMem L hv < i₀ then θ v + 2 * Real.pi else θ v + else 0 + +open Classical in +theorem circle_exp_shiftedAngle (L : List α) (θ : α → ℝ) (i₀ : ℕ) + {v : α} (hv : v ∈ L) : + Circle.exp (shiftedAngle L θ i₀ v) = Circle.exp (θ v) := by + simp only [shiftedAngle, hv, ↓reduceDIte] + split_ifs + · rw [Circle.exp_add, Circle.exp_two_pi, mul_one] + · rfl + +open Classical in +theorem shiftedAngle_getElem_self {L : List α} (hnd : L.Nodup) (θ : α → ℝ) + {i₀ : ℕ} (hi₀ : i₀ < L.length) : + shiftedAngle L θ i₀ (L[i₀]'hi₀) = θ (L[i₀]'hi₀) := by + have hmem : L[i₀]'hi₀ ∈ L := List.getElem_mem hi₀ + simp only [shiftedAngle, hmem, ↓reduceDIte, CyclicPerm.indexOfMem_getElem hnd hi₀, + Nat.lt_irrefl, ↓reduceIte] + +private theorem mod_eq_sub_of_le_of_lt {n k : ℕ} (h1 : n ≤ k) (h2 : k < 2 * n) : + k % n = k - n := by + have heq : k = n + (k - n) := by omega + conv_lhs => rw [heq] + rw [Nat.add_mod_left, Nat.mod_eq_of_lt (by omega)] + +open Classical in +theorem shiftedAngle_iterate_strictMono {Ω : CyclicPerm α} {L : List α} + (hnd : L.Nodup) + (hL_next : ∀ (i : ℕ) (hi : i < L.length), + Ω.toFun (L[i]'hi) = L[(i + 1) % L.length]'(Nat.mod_lt _ (Nat.zero_lt_of_lt hi))) + {θ : α → ℝ} + (hθ_mono : ∀ i j (hi : i < L.length) (hj : j < L.length), + i < j → θ (L[i]'hi) < θ (L[j]'hj)) + (hθ_span : ∀ i (hi : i < L.length), + θ (L[i]'hi) < θ (L[0]'(Nat.zero_lt_of_lt hi)) + 2 * Real.pi) + {i₀ : ℕ} (hi₀ : i₀ < L.length) {d₁ d₂ : ℕ} + (hd₁₂ : d₁ < d₂) (hd₂ : d₂ < L.length) : + shiftedAngle L θ i₀ ((Ω.toFun^[d₁]) (L[i₀]'hi₀)) < + shiftedAngle L θ i₀ ((Ω.toFun^[d₂]) (L[i₀]'hi₀)) := by + have hpos : 0 < L.length := Nat.zero_lt_of_lt hi₀ + rw [iterate_toFun_eq_getElem_of_next hL_next hi₀ d₁, + iterate_toFun_eq_getElem_of_next hL_next hi₀ d₂] + have hm₁ : (i₀ + d₁) % L.length < L.length := Nat.mod_lt _ hpos + have hm₂ : (i₀ + d₂) % L.length < L.length := Nat.mod_lt _ hpos + have hmem₁ : L[(i₀ + d₁) % L.length]'hm₁ ∈ L := List.getElem_mem hm₁ + have hmem₂ : L[(i₀ + d₂) % L.length]'hm₂ ∈ L := List.getElem_mem hm₂ + simp only [shiftedAngle, hmem₁, hmem₂, ↓reduceDIte, + CyclicPerm.indexOfMem_getElem hnd hm₁, CyclicPerm.indexOfMem_getElem hnd hm₂] + by_cases h1 : i₀ + d₁ < L.length <;> by_cases h2 : i₀ + d₂ < L.length + · have hmod₁ : (i₀ + d₁) % L.length = i₀ + d₁ := Nat.mod_eq_of_lt h1 + have hmod₂ : (i₀ + d₂) % L.length = i₀ + d₂ := Nat.mod_eq_of_lt h2 + have hn₁ : ¬ (i₀ + d₁) % L.length < i₀ := by omega + have hn₂ : ¬ (i₀ + d₂) % L.length < i₀ := by omega + simp only [hn₁, hn₂, ↓reduceIte] + exact hθ_mono _ _ hm₁ hm₂ (by omega) + · have hmod₁ : (i₀ + d₁) % L.length = i₀ + d₁ := Nat.mod_eq_of_lt h1 + have hmod₂ : (i₀ + d₂) % L.length = i₀ + d₂ - L.length := + mod_eq_sub_of_le_of_lt (by omega) (by omega) + have hn₁ : ¬ (i₀ + d₁) % L.length < i₀ := by omega + have hp₂ : (i₀ + d₂) % L.length < i₀ := by omega + simp only [hn₁, hp₂, ↓reduceIte] + have h_sp := hθ_span ((i₀ + d₁) % L.length) hm₁ + by_cases h0 : (i₀ + d₂) % L.length = 0 + · have h_eq : θ (L[0]'hpos) = θ (L[(i₀ + d₂) % L.length]'hm₂) := by congr 2; exact h0.symm + linarith + · have h_gt0 : 0 < (i₀ + d₂) % L.length := Nat.pos_of_ne_zero h0 + have h_m0 := hθ_mono 0 ((i₀ + d₂) % L.length) hpos hm₂ h_gt0 + linarith + · omega + · have hmod₁ : (i₀ + d₁) % L.length = i₀ + d₁ - L.length := + mod_eq_sub_of_le_of_lt (by omega) (by omega) + have hmod₂ : (i₀ + d₂) % L.length = i₀ + d₂ - L.length := + mod_eq_sub_of_le_of_lt (by omega) (by omega) + have hp₁ : (i₀ + d₁) % L.length < i₀ := by omega + have hp₂ : (i₀ + d₂) % L.length < i₀ := by omega + simp only [hp₁, hp₂, ↓reduceIte] + have h_lt := hθ_mono _ _ hm₁ hm₂ (by omega) + linarith + +open Classical in +theorem shiftedAngle_iterate_lt_span {Ω : CyclicPerm α} {L : List α} + (hnd : L.Nodup) + (hL_next : ∀ (i : ℕ) (hi : i < L.length), + Ω.toFun (L[i]'hi) = L[(i + 1) % L.length]'(Nat.mod_lt _ (Nat.zero_lt_of_lt hi))) + {θ : α → ℝ} + (hθ_mono : ∀ i j (hi : i < L.length) (hj : j < L.length), + i < j → θ (L[i]'hi) < θ (L[j]'hj)) + (hθ_span : ∀ i (hi : i < L.length), + θ (L[i]'hi) < θ (L[0]'(Nat.zero_lt_of_lt hi)) + 2 * Real.pi) + {i₀ : ℕ} (hi₀ : i₀ < L.length) {d : ℕ} (hd : d < L.length) : + shiftedAngle L θ i₀ ((Ω.toFun^[d]) (L[i₀]'hi₀)) < + shiftedAngle L θ i₀ (L[i₀]'hi₀) + 2 * Real.pi := by + have hpos : 0 < L.length := Nat.zero_lt_of_lt hi₀ + rw [shiftedAngle_getElem_self hnd θ hi₀, iterate_toFun_eq_getElem_of_next hL_next hi₀ d] + have hm : (i₀ + d) % L.length < L.length := Nat.mod_lt _ hpos + have hmem : L[(i₀ + d) % L.length]'hm ∈ L := List.getElem_mem hm + simp only [shiftedAngle, hmem, ↓reduceDIte, CyclicPerm.indexOfMem_getElem hnd hm] + by_cases h1 : i₀ + d < L.length + · have hmod : (i₀ + d) % L.length = i₀ + d := Nat.mod_eq_of_lt h1 + have hn : ¬ (i₀ + d) % L.length < i₀ := by omega + simp only [hn, ↓reduceIte] + have h_sp := hθ_span ((i₀ + d) % L.length) hm + by_cases hi0 : i₀ = 0 + · have h_eq : θ (L[0]'hpos) = θ (L[i₀]'hi₀) := by congr 2; exact hi0.symm + linarith + · have h_gt0 := hθ_mono 0 i₀ hpos hi₀ (Nat.pos_of_ne_zero hi0) + linarith + · have hmod : (i₀ + d) % L.length = i₀ + d - L.length := + mod_eq_sub_of_le_of_lt (by omega) (by omega) + have hp : (i₀ + d) % L.length < i₀ := by omega + simp only [hp, ↓reduceIte] + have h_lt := hθ_mono _ i₀ hm hi₀ (by omega) + linarith + +/-- A nodup list `L` enumerating `Ω.bar` in `Ω.toFun`-orbit order. -/ +def CyclicPerm.IsOrbitList (Ω : CyclicPerm α) (L : List α) : Prop := + L.Nodup ∧ L ≠ [] ∧ {v | v ∈ L} = Ω.bar ∧ + ∀ (i : ℕ) (hi : i < L.length), + Ω.toFun (L[i]'hi) = L[(i + 1) % L.length]'(Nat.mod_lt _ (Nat.zero_lt_of_lt hi)) + +theorem CyclicPerm.isOrbitList_ofNodupList (L : List α) (hnd : L.Nodup) (hne : L ≠ []) : + (CyclicPerm.ofNodupList L hnd hne).IsOrbitList L := + ⟨hnd, hne, rfl, fun _ hi => CyclicPerm.ofNodupList_toFun_getElem L hnd hne hi⟩ + +theorem isOrbitList_splitList (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) : + (splitCyclicPerm S hs ht hst hP hP_bar).IsOrbitList (splitList S hs ht hP) := + CyclicPerm.isOrbitList_ofNodupList _ _ _ + +theorem CyclicPerm.exists_isOrbitList_starting_at (Ω : CyclicPerm α) {w₀ : α} (hw₀ : w₀ ∈ Ω.bar) : + ∃ L : List α, Ω.IsOrbitList L ∧ ∀ h : 0 < L.length, L[0]'h = w₀ := by + let K := Ω.hitStep hw₀ hw₀ + have hK1 : 1 ≤ K := Ω.hitStep_ge_one hw₀ hw₀ + have hK_eq : (Ω.toFun^[K]) w₀ = w₀ := Ω.iterate_hitStep hw₀ hw₀ + have hK_min : ∀ j : ℕ, 1 ≤ j → j < K → (Ω.toFun^[j]) w₀ ≠ w₀ := + fun j hj1 hjK => Ω.iterate_ne_of_lt_hitStep hw₀ hw₀ hj1 hjK + let L : List α := (List.range K).map (fun i => (Ω.toFun^[i]) w₀) + have hlen : L.length = K := by simp [L] + have hget : ∀ (i : ℕ) (hi : i < L.length), L[i]'hi = (Ω.toFun^[i]) w₀ := by + intro i _; simp [L] + have hnd : L.Nodup := by + rw [List.Nodup, List.pairwise_iff_getElem] + intro i j hi hj hij heq + rw [hget i hi, hget j hj] at heq + rw [hlen] at hi hj + have hiter : (Ω.toFun^[i]) ((Ω.toFun^[j - i]) w₀) = (Ω.toFun^[i]) w₀ := by + rw [← Function.iterate_add_apply, Nat.add_sub_of_le (le_of_lt hij), heq] + have hsub := Ω.injOn_iterate i (Ω.iterate_mem (j - i) hw₀) hw₀ hiter + exact (hK_min (j - i) (by omega) (by omega) hsub).elim + have hne : L ≠ [] := List.ne_nil_of_length_pos (by omega) + have hbar : {v | v ∈ L} = Ω.bar := by + ext v + simp only [mem_ofPred_eq, List.mem_iff_getElem, hlen] + constructor + · rintro ⟨i, hi, rfl⟩ + rw [hget i (by omega)] + exact Ω.iterate_mem i hw₀ + · intro hv + obtain ⟨m, rfl⟩ := Ω.single_orbit w₀ hw₀ v hv + have hmul : ∀ q : ℕ, (Ω.toFun^[K * q]) w₀ = w₀ := by + intro q + induction q with + | zero => rfl + | succ q ih => rw [Nat.mul_succ, add_comm, Function.iterate_add_apply, ih, hK_eq] + refine ⟨m % K, Nat.mod_lt _ (by omega), ?_⟩ + rw [hget (m % K) (by rw [hlen]; exact Nat.mod_lt _ (by omega))] + conv_rhs => rw [← Nat.div_add_mod m K, add_comm] + rw [Function.iterate_add_apply, hmul] + have hnext : ∀ (i : ℕ) (hi : i < L.length), + Ω.toFun (L[i]'hi) = L[(i + 1) % L.length]'(Nat.mod_lt _ (Nat.zero_lt_of_lt hi)) := by + intro i hi + have hiK : i < K := hlen ▸ hi + rw [hget i hi, hget ((i + 1) % L.length) (Nat.mod_lt _ (Nat.zero_lt_of_lt hi)), + ← Function.iterate_succ_apply' Ω.toFun i w₀, hlen] + by_cases h1 : i + 1 < K + · rw [Nat.mod_eq_of_lt h1] + · have hi_eq : i + 1 = K := by omega + rw [hi_eq, Nat.mod_self, Function.iterate_zero_apply] + change (Ω.toFun^[i + 1]) w₀ = w₀ + rw [hi_eq, hK_eq] + exact ⟨L, ⟨hnd, hne, hbar, hnext⟩, fun h => hget 0 h⟩ + +theorem CyclicPerm.exists_isOrbitList_of_mem (Ω : CyclicPerm α) {w₀ : α} (hw₀ : w₀ ∈ Ω.bar) : + ∃ L : List α, Ω.IsOrbitList L := + (Ω.exists_isOrbitList_starting_at hw₀).imp fun _ h => h.1 + +/-- An angle assignment `θ : α → ℝ` is valid on `L` if it is strictly increasing along `L` +and spans strictly less than `2π`. -/ +def IsValidAngle (L : List α) (θ : α → ℝ) : Prop := + (∀ i j (hi : i < L.length) (hj : j < L.length), i < j → θ (L[i]'hi) < θ (L[j]'hj)) ∧ + (∀ i (hi : i < L.length), θ (L[i]'hi) < θ (L[0]'(Nat.zero_lt_of_lt hi)) + 2 * Real.pi) + +theorem injOn_circle_exp_of_isValidAngle {Ω : CyclicPerm α} {L : List α} + (hL : Ω.IsOrbitList L) {θ : α → ℝ} (hθ : IsValidAngle L θ) : + InjOn (fun v => (Circle.exp (θ v) : ℂ)) Ω.bar := by + intro u hu v hv heq + rw [← hL.2.2.1, mem_ofPred_eq, List.mem_iff_getElem] at hu hv + obtain ⟨i, hi, rfl⟩ := hu + obtain ⟨j, hj, rfl⟩ := hv + have hexp : Circle.exp (θ (L[i]'hi)) = Circle.exp (θ (L[j]'hj)) := Subtype.ext heq + have hpos : 0 < L.length := Nat.zero_lt_of_lt hi + have hge0 : ∀ k (hk : k < L.length), θ (L[0]'hpos) ≤ θ (L[k]'hk) := fun k hk => by + rcases Nat.eq_zero_or_pos k with rfl | hpos_k + · exact le_rfl + · exact (hθ.1 0 k hpos hk hpos_k).le + have hθ_eq : θ (L[i]'hi) = θ (L[j]'hj) := by + apply circle_exp_inj_of_abs_sub_lt _ hexp + exact abs_lt.mpr ⟨by linarith [hge0 i hi, hθ.2 j hj], by linarith [hge0 j hj, hθ.2 i hi]⟩ + rcases lt_trichotomy i j with hij | rfl | hji + · linarith [hθ.1 i j hi hj hij] + · rfl + · linarith [hθ.1 j i hj hi hji] + +theorem hitStep_add_hitStep_le_length {Ω : CyclicPerm α} {L : List α} + (hL : Ω.IsOrbitList L) {s t : α} (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) (hst : s ≠ t) : + Ω.hitStep hs ht + Ω.hitStep ht hs ≤ L.length := by + have hsL : s ∈ L := by rwa [← hL.2.2.1] at hs + let i₀ := CyclicPerm.indexOfMem L hsL + have hi₀ : i₀ < L.length := CyclicPerm.indexOfMem_lt L hsL + have hpos : 0 < L.length := Nat.zero_lt_of_lt hi₀ + have hLi₀ : L[i₀]'hi₀ = s := CyclicPerm.getElem_indexOfMem L hsL + have hiter_len : (Ω.toFun^[L.length]) s = s := by + rw [← hLi₀, iterate_toFun_eq_getElem_of_next hL.2.2.2 hi₀ L.length] + congr 1 + rw [Nat.add_mod_right, Nat.mod_eq_of_lt hi₀] + have hk₁_lt : Ω.hitStep hs ht < L.length := by + by_contra hge + rcases eq_or_lt_of_le (Nat.le_of_not_lt hge) with heq | hgt + · have : t = s := by rw [← Ω.iterate_hitStep hs ht, ← heq, hiter_len] + exact hst this.symm + · exact Ω.iterate_ne_self_of_lt_hitStep hs ht hst hpos hgt hiter_len + by_contra hgt + have hrem_pos : 1 ≤ L.length - Ω.hitStep hs ht := by omega + have hrem_lt : L.length - Ω.hitStep hs ht < Ω.hitStep ht hs := by omega + have hrem_eq : (Ω.toFun^[L.length - Ω.hitStep hs ht]) t = s := by + calc (Ω.toFun^[L.length - Ω.hitStep hs ht]) t + _ = (Ω.toFun^[L.length - Ω.hitStep hs ht]) ((Ω.toFun^[Ω.hitStep hs ht]) s) := by + rw [Ω.iterate_hitStep hs ht] + _ = s := by + rw [← Function.iterate_add_apply, Nat.sub_add_cancel (by omega), hiter_len] + exact Ω.iterate_ne_of_lt_hitStep ht hs hrem_pos hrem_lt hrem_eq + +open Classical in +/-- Angle assignment on `splitList S hs ht hP` for the upper half-disc society `S₁`. -/ +def upperSplitAngle {G P : Graph α β} {s t : α} + (hP : IsGraphPathWithEnds G P s t) (θ' : α → ℝ) (v : α) : ℝ := + let L_P := (pathWalkTS hP).support + let m := L_P.length + if hv : v ∈ L_P then + 2 * Real.pi - Real.arccos (pathX m (CyclicPerm.indexOfMem L_P hv)) + else + 2 * Real.pi + Real.pi * (θ' v - θ' s) / (θ' t - θ' s) + +open Classical in +/-- Angle assignment on `splitList S ht hs hP.symm` for the lower half-disc society `S₂`. -/ +def lowerSplitAngle {G P : Graph α β} {s t : α} + (hP : IsGraphPathWithEnds G P s t) (θ' : α → ℝ) (v : α) : ℝ := + let L_P := (pathWalkTS hP).support + let m := L_P.length + if hv : v ∈ L_P then + Real.arccos (pathX m (CyclicPerm.indexOfMem L_P hv)) + else + Real.pi + Real.pi * (θ' v - θ' t) / (θ' s + 2 * Real.pi - θ' t) + +open Classical in +theorem upperSplitAngle_of_mem_P {G P : Graph α β} {s t : α} + (hP : IsGraphPathWithEnds G P s t) (θ' : α → ℝ) {k : ℕ} + (hk : k < (pathWalkTS hP).support.length) : + upperSplitAngle hP θ' ((pathWalkTS hP).support[k]'hk) = + 2 * Real.pi - Real.arccos (pathX (pathWalkTS hP).support.length k) := by + have hmem : (pathWalkTS hP).support[k]'hk ∈ (pathWalkTS hP).support := List.getElem_mem hk + simp only [upperSplitAngle, hmem, ↓reduceDIte, + CyclicPerm.indexOfMem_getElem (isSimple_pathWalkTS hP) hk] + +open Classical in +theorem upperSplitAngle_of_not_mem_P {G P : Graph α β} {s t : α} + (hP : IsGraphPathWithEnds G P s t) (θ' : α → ℝ) {v : α} + (hv : v ∉ V(P)) : + upperSplitAngle hP θ' v = + 2 * Real.pi + Real.pi * (θ' v - θ' s) / (θ' t - θ' s) := by + have hv_not : v ∉ (pathWalkTS hP).support := fun h => + hv (by rw [vertexSet_eq_support_pathWalkTS hP]; exact h) + simp [upperSplitAngle, hv_not] + +open Classical in +theorem lowerSplitAngle_of_mem_P {G P : Graph α β} {s t : α} + (hP : IsGraphPathWithEnds G P s t) (θ' : α → ℝ) {k : ℕ} + (hk : k < (pathWalkTS hP).support.length) : + lowerSplitAngle hP θ' ((pathWalkTS hP).support[k]'hk) = + Real.arccos (pathX (pathWalkTS hP).support.length k) := by + have hmem : (pathWalkTS hP).support[k]'hk ∈ (pathWalkTS hP).support := List.getElem_mem hk + simp only [lowerSplitAngle, hmem, ↓reduceDIte, + CyclicPerm.indexOfMem_getElem (isSimple_pathWalkTS hP) hk] + +open Classical in +theorem lowerSplitAngle_of_not_mem_P {G P : Graph α β} {s t : α} + (hP : IsGraphPathWithEnds G P s t) (θ' : α → ℝ) {v : α} + (hv : v ∉ V(P)) : + lowerSplitAngle hP θ' v = + Real.pi + Real.pi * (θ' v - θ' t) / (θ' s + 2 * Real.pi - θ' t) := by + have hv_not : v ∉ (pathWalkTS hP).support := fun h => + hv (by rw [vertexSet_eq_support_pathWalkTS hP]; exact h) + simp [lowerSplitAngle, hv_not] + +theorem arccos_pathX_strictAnti {m : ℕ} (hm : 2 ≤ m) {i j : ℕ} (hij : i < j) (hj : j < m) : + Real.arccos (pathX m j) < Real.arccos (pathX m i) := + Real.strictAntiOn_arccos (pathX_mem_Icc hm (Nat.lt_trans hij hj)) (pathX_mem_Icc hm hj) + (pathX_strictMono hm hij) + +theorem isValidAngle_upperSplitAngle (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {θ' : α → ℝ} + (h_st : θ' s < θ' t) + (h_W1_bounds : ∀ a (ha : a < (S.Ω.intervalList hs ht).length), + θ' s < θ' ((S.Ω.intervalList hs ht)[a]'ha) ∧ + θ' ((S.Ω.intervalList hs ht)[a]'ha) < θ' t) + (h_W1_mono : ∀ a₁ a₂ (ha₁ : a₁ < (S.Ω.intervalList hs ht).length) + (ha₂ : a₂ < (S.Ω.intervalList hs ht).length), + a₁ < a₂ → θ' ((S.Ω.intervalList hs ht)[a₁]'ha₁) < θ' ((S.Ω.intervalList hs ht)[a₂]'ha₂)) : + IsValidAngle (splitList S hs ht hP) (upperSplitAngle hP θ') := by + let L₁ := splitList S hs ht hP + let m := (pathWalkTS hP).support.length + have hm : 2 ≤ m := two_le_length_support_pathWalkTS hst hP + have hpi : 0 < Real.pi := Real.pi_pos + have hdiff : 0 < θ' t - θ' s := by linarith + have h_val_lt : ∀ i (hi : i < m), + upperSplitAngle hP θ' (L₁[i]'(by rw [length_splitList]; omega)) = + 2 * Real.pi - Real.arccos (pathX m i) := by + intro i hi + rw [getElem_splitList_of_lt S hs ht hP hi, upperSplitAngle_of_mem_P hP θ' hi] + have h_val_ge : ∀ i (hmi : m ≤ i) (hi : i < L₁.length), + upperSplitAngle hP θ' (L₁[i]'hi) = + 2 * Real.pi + Real.pi * + (θ' ((S.Ω.intervalList hs ht)[i - m]'(by rw [length_splitList] at hi; omega)) - θ' s) / + (θ' t - θ' s) := by + intro i hmi hi + have hnotP : L₁[i]'hi ∉ V(P) := by + rw [getElem_splitList_mem_P_iff S hs ht hst hP hP_bar hi] + omega + rw [upperSplitAngle_of_not_mem_P hP θ' hnotP, getElem_splitList_of_le S hs ht hP hmi hi] + have h_0_val : upperSplitAngle hP θ' (L₁[0]'(by rw [length_splitList]; omega)) = Real.pi := by + rw [h_val_lt 0 (by omega), pathX_zero, Real.arccos_neg_one] + ring + refine ⟨fun i j hi hj hij => ?_, fun i hi => ?_⟩ + · by_cases him : i < m <;> by_cases hjm : j < m + · rw [h_val_lt i him, h_val_lt j hjm] + linarith [arccos_pathX_strictAnti hm hij hjm] + · rw [h_val_lt i him, h_val_ge j (by omega) hj] + have harc : 0 ≤ Real.arccos (pathX m i) := Real.arccos_nonneg _ + have hb := (h_W1_bounds (j - m) (by rw [length_splitList] at hj; omega)).1 + have hj' : j - m < (S.Ω.intervalList hs ht).length := by + rw [length_splitList] at hj + omega + have hpos : 0 < Real.pi * (θ' ((S.Ω.intervalList hs ht)[j - m]'hj') - θ' s) / + (θ' t - θ' s) := + div_pos (mul_pos hpi (by linarith)) hdiff + linarith + · omega + · rw [h_val_ge i (by omega) hi, h_val_ge j (by omega) hj] + have hmono := h_W1_mono (i - m) (j - m) + (by rw [length_splitList] at hi; omega) (by rw [length_splitList] at hj; omega) (by omega) + have hlt_div : + Real.pi * (θ' ((S.Ω.intervalList hs ht)[i - m]'(by rw [length_splitList] at hi; omega)) - + θ' s) / (θ' t - θ' s) < + Real.pi * (θ' ((S.Ω.intervalList hs ht)[j - m]'(by rw [length_splitList] at hj; omega)) - + θ' s) / (θ' t - θ' s) := + div_lt_div_of_pos_right (mul_lt_mul_of_pos_left (by linarith) hpi) hdiff + linarith + · rw [h_0_val] + by_cases him : i < m + · rw [h_val_lt i him] + have harc : 0 ≤ Real.arccos (pathX m i) := Real.arccos_nonneg _ + linarith + · rw [h_val_ge i (by omega) hi] + have hb := (h_W1_bounds (i - m) (by rw [length_splitList] at hi; omega)).2 + have hlt_pi : + Real.pi * (θ' ((S.Ω.intervalList hs ht)[i - m]'(by rw [length_splitList] at hi; omega)) - + θ' s) / (θ' t - θ' s) < Real.pi := by + rw [div_lt_iff₀ hdiff] + nlinarith + linarith + +theorem isValidAngle_lowerSplitAngle (S : Society α β) {P : Graph α β} {s t : α} + (hs : s ∈ S.Ω.bar) (ht : t ∈ S.Ω.bar) (hst : s ≠ t) + (hP : IsGraphPathWithEnds S.G P s t) + (hP_bar : Disjoint (V(P) \ {s, t}) S.Ω.bar) + {θ' : α → ℝ} + (h_span : θ' t < θ' s + 2 * Real.pi) + (h_W2_bounds : ∀ b (hb : b < (S.Ω.intervalList ht hs).length), + θ' t < θ' ((S.Ω.intervalList ht hs)[b]'hb) ∧ + θ' ((S.Ω.intervalList ht hs)[b]'hb) < θ' s + 2 * Real.pi) + (h_W2_mono : ∀ b₁ b₂ (hb₁ : b₁ < (S.Ω.intervalList ht hs).length) + (hb₂ : b₂ < (S.Ω.intervalList ht hs).length), + b₁ < b₂ → θ' ((S.Ω.intervalList ht hs)[b₁]'hb₁) < θ' ((S.Ω.intervalList ht hs)[b₂]'hb₂)) : + IsValidAngle (splitList S ht hs hP.symm) (lowerSplitAngle hP θ') := by + let L₂ := splitList S ht hs hP.symm + let m := (pathWalkTS hP).support.length + have hm : 2 ≤ m := two_le_length_support_pathWalkTS hst hP + have hlen_symm : (pathWalkTS hP.symm).support.length = m := by + rw [support_pathWalkTS_symm hP, List.length_reverse] + have hP_bar₂ : Disjoint (V(P) \ {t, s}) S.Ω.bar := by rw [pair_comm]; exact hP_bar + have hpi : 0 < Real.pi := Real.pi_pos + have hdiff : 0 < θ' s + 2 * Real.pi - θ' t := by linarith + have h_val_lt : ∀ i (hi : i < m), + lowerSplitAngle hP θ' (L₂[i]'(by rw [length_splitList, hlen_symm]; omega)) = + Real.arccos (pathX m (m - 1 - i)) := by + intro i hi + have hi_symm : i < (pathWalkTS hP.symm).support.length := hlen_symm ▸ hi + have h_elem : L₂[i]'(by rw [length_splitList, hlen_symm]; omega) = + (pathWalkTS hP).support[m - 1 - i]'(by omega) := by + rw [getElem_splitList_of_lt S ht hs hP.symm hi_symm] + simp only [support_pathWalkTS_symm hP, List.getElem_reverse] + rfl + rw [h_elem, lowerSplitAngle_of_mem_P hP θ' (by omega)] + have h_val_ge : ∀ i (hmi : m ≤ i) (hi : i < L₂.length), + lowerSplitAngle hP θ' (L₂[i]'hi) = + Real.pi + Real.pi * + (θ' ((S.Ω.intervalList ht hs)[i - m]'(by rw [length_splitList, hlen_symm] at hi; omega)) + - θ' t) / + (θ' s + 2 * Real.pi - θ' t) := by + intro i hmi hi + have hmi_symm : (pathWalkTS hP.symm).support.length ≤ i := hlen_symm ▸ hmi + have hnotP : L₂[i]'hi ∉ V(P) := by + rw [getElem_splitList_mem_P_iff S ht hs hst.symm hP.symm hP_bar₂ hi, hlen_symm] + omega + rw [lowerSplitAngle_of_not_mem_P hP θ' hnotP, getElem_splitList_of_le S ht hs hP.symm hmi_symm + hi] + congr 6 + rw [hlen_symm] + have h_0_val : lowerSplitAngle hP θ' (L₂[0]'(by rw [length_splitList, hlen_symm]; omega)) = 0 + := by + rw [h_val_lt 0 (by omega), Nat.sub_zero, pathX_pred hm, Real.arccos_one] + refine ⟨fun i j hi hj hij => ?_, fun i hi => ?_⟩ + · by_cases him : i < m <;> by_cases hjm : j < m + · rw [h_val_lt i him, h_val_lt j hjm] + exact arccos_pathX_strictAnti hm (by omega) (by omega) + · rw [h_val_lt i him, h_val_ge j (by omega) hj] + have harc : Real.arccos (pathX m (m - 1 - i)) ≤ Real.pi := Real.arccos_le_pi _ + have hb := (h_W2_bounds (j - m) (by rw [length_splitList, hlen_symm] at hj; omega)).1 + have hj' : j - m < (S.Ω.intervalList ht hs).length := by + rw [length_splitList, hlen_symm] at hj + omega + have hpos : 0 < Real.pi * (θ' ((S.Ω.intervalList ht hs)[j - m]'hj') - θ' t) / + (θ' s + 2 * Real.pi - θ' t) := + div_pos (mul_pos hpi (by linarith)) hdiff + linarith + · omega + · rw [h_val_ge i (by omega) hi, h_val_ge j (by omega) hj] + have hmono := h_W2_mono (i - m) (j - m) + (by rw [length_splitList, hlen_symm] at hi; omega) + (by rw [length_splitList, hlen_symm] at hj; omega) (by omega) + have hi' : i - m < (S.Ω.intervalList ht hs).length := by + rw [length_splitList, hlen_symm] at hi + omega + have hj' : j - m < (S.Ω.intervalList ht hs).length := by + rw [length_splitList, hlen_symm] at hj + omega + have hlt_div : + Real.pi * (θ' ((S.Ω.intervalList ht hs)[i - m]'hi') - θ' t) / + (θ' s + 2 * Real.pi - θ' t) < + Real.pi * (θ' ((S.Ω.intervalList ht hs)[j - m]'hj') - θ' t) / + (θ' s + 2 * Real.pi - θ' t) := + div_lt_div_of_pos_right (mul_lt_mul_of_pos_left (by linarith) hpi) hdiff + linarith + · rw [h_0_val] + by_cases him : i < m + · rw [h_val_lt i him] + have harc : Real.arccos (pathX m (m - 1 - i)) ≤ Real.pi := Real.arccos_le_pi _ + linarith + · rw [h_val_ge i (by omega) hi] + have hb := (h_W2_bounds (i - m) (by rw [length_splitList, hlen_symm] at hi; omega)).2 + have hi' : i - m < (S.Ω.intervalList ht hs).length := by + rw [length_splitList, hlen_symm] at hi + omega + have hlt_pi : Real.pi * (θ' ((S.Ω.intervalList ht hs)[i - m]'hi') - θ' t) / + (θ' s + 2 * Real.pi - θ' t) < Real.pi := by + rw [div_lt_iff₀ hdiff] + nlinarith + linarith + +open Classical in +theorem shiftedAngle_intervalList_props {Ω : CyclicPerm α} {L : List α} + (hL : Ω.IsOrbitList L) {θ : α → ℝ} (hθ : IsValidAngle L θ) + {s t : α} (hs : s ∈ Ω.bar) (ht : t ∈ Ω.bar) (hst : s ≠ t) : + let hsL : s ∈ L := by rwa [← hL.2.2.1] at hs + let i₀ := CyclicPerm.indexOfMem L hsL + let θ' := shiftedAngle L θ i₀ + θ' s < θ' t ∧ + θ' t < θ' s + 2 * Real.pi ∧ + (∀ a (ha : a < (Ω.intervalList hs ht).length), + θ' s < θ' ((Ω.intervalList hs ht)[a]'ha) ∧ + θ' ((Ω.intervalList hs ht)[a]'ha) < θ' t) ∧ + (∀ a₁ a₂ (ha₁ : a₁ < (Ω.intervalList hs ht).length) + (ha₂ : a₂ < (Ω.intervalList hs ht).length), + a₁ < a₂ → θ' ((Ω.intervalList hs ht)[a₁]'ha₁) < θ' ((Ω.intervalList hs ht)[a₂]'ha₂)) ∧ + (∀ b (hb : b < (Ω.intervalList ht hs).length), + θ' t < θ' ((Ω.intervalList ht hs)[b]'hb) ∧ + θ' ((Ω.intervalList ht hs)[b]'hb) < θ' s + 2 * Real.pi) ∧ + (∀ b₁ b₂ (hb₁ : b₁ < (Ω.intervalList ht hs).length) + (hb₂ : b₂ < (Ω.intervalList ht hs).length), + b₁ < b₂ → θ' ((Ω.intervalList ht hs)[b₁]'hb₁) < θ' ((Ω.intervalList ht hs)[b₂]'hb₂)) := by + intro hsL i₀ θ' + have hi₀ : i₀ < L.length := CyclicPerm.indexOfMem_lt L hsL + have hLi₀ : L[i₀]'hi₀ = s := CyclicPerm.getElem_indexOfMem L hsL + have hsum_le : Ω.hitStep hs ht + Ω.hitStep ht hs ≤ L.length := + hitStep_add_hitStep_le_length hL hs ht hst + have hk₁_ge : 1 ≤ Ω.hitStep hs ht := Ω.hitStep_ge_one hs ht + have hk₂_ge : 1 ≤ Ω.hitStep ht hs := Ω.hitStep_ge_one ht hs + have h_mono : ∀ {d₁ d₂ : ℕ}, d₁ < d₂ → d₂ < L.length → + θ' ((Ω.toFun^[d₁]) s) < θ' ((Ω.toFun^[d₂]) s) := by + intro d₁ d₂ hd₁₂ hd₂ + rw [← hLi₀] + exact shiftedAngle_iterate_strictMono hL.1 hL.2.2.2 hθ.1 hθ.2 hi₀ hd₁₂ hd₂ + have h_span : ∀ {d : ℕ}, d < L.length → θ' ((Ω.toFun^[d]) s) < θ' s + 2 * Real.pi := by + intro d hd + conv_lhs => rw [← hLi₀] + conv_rhs => rw [← hLi₀] + exact shiftedAngle_iterate_lt_span hL.1 hL.2.2.2 hθ.1 hθ.2 hi₀ hd + have ht_iter : (Ω.toFun^[Ω.hitStep hs ht]) s = t := Ω.iterate_hitStep hs ht + have hW1_iter : ∀ a (ha : a < (Ω.intervalList hs ht).length), + (Ω.intervalList hs ht)[a]'ha = (Ω.toFun^[a + 1]) s := + fun a ha => Ω.getElem_intervalList hs ht ha + have hW2_iter : ∀ b (hb : b < (Ω.intervalList ht hs).length), + (Ω.intervalList ht hs)[b]'hb = (Ω.toFun^[b + 1 + Ω.hitStep hs ht]) s := by + intro b hb + rw [Ω.getElem_intervalList ht hs hb, + Function.iterate_add_apply Ω.toFun (b + 1) (Ω.hitStep hs ht) s, ht_iter] + refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [← Function.iterate_zero_apply Ω.toFun s, ← ht_iter] + exact h_mono (by omega) (by omega) + · rw [← ht_iter] + exact h_span (by omega) + · intro a ha + have ha_len : a < Ω.hitStep hs ht - 1 := by rwa [Ω.length_intervalList] at ha + rw [hW1_iter a ha] + refine ⟨?_, ?_⟩ + · conv_lhs => rw [← Function.iterate_zero_apply Ω.toFun s] + exact h_mono (by omega) (by omega) + · rw [← ht_iter] + exact h_mono (by omega) (by omega) + · intro a₁ a₂ ha₁ ha₂ ha₁₂ + have ha₂_len : a₂ < Ω.hitStep hs ht - 1 := by rwa [Ω.length_intervalList] at ha₂ + rw [hW1_iter a₁ ha₁, hW1_iter a₂ ha₂] + exact h_mono (by omega) (by omega) + · intro b hb + have hb_len : b < Ω.hitStep ht hs - 1 := by rwa [Ω.length_intervalList] at hb + rw [hW2_iter b hb] + refine ⟨?_, h_span (by omega)⟩ + conv_lhs => rw [← ht_iter] + exact h_mono (by omega) (by omega) + · intro b₁ b₂ hb₁ hb₂ hb₁₂ + have hb₂_len : b₂ < Ω.hitStep ht hs - 1 := by rwa [Ω.length_intervalList] at hb₂ + rw [hW2_iter b₁ hb₁, hW2_iter b₂ hb₂] + exact h_mono (by omega) (by omega) + +/-- `S₀` is a simple spanning reduction of `S`. -/ +def IsSimpleReduction (S₀ S : Society α β) : Prop := + S₀.G ≤ S.G ∧ + V(S₀.G) = V(S.G) ∧ + S₀.Ω = S.Ω ∧ + S₀.IsKConnected 3 ∧ + (¬ ∃ Q₁ Q₂ : Graph α β, S₀.IsCross Q₁ Q₂) ∧ + (¬ ∃ T₁ T₂ T₃ : Graph α β, S₀.IsTripod T₁ T₂ T₃) ∧ + (∀ x : α, ¬ S₀.G.Adj x x) ∧ + (∀ e₁ e₂ x y, S₀.G.IsLink e₁ x y → S₀.G.IsLink e₂ x y → e₁ = e₂) ∧ + (∀ e x y, S.G.IsLink e x y → x = y ∨ S₀.G.Adj x y) + +theorem exists_isSimpleReduction (S : Society α β) + (hconn : S.IsKConnected 3) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) + (hnotripod : ¬ ∃ T₁ T₂ T₃ : Graph α β, S.IsTripod T₁ T₂ T₃) : + ∃ S₀ : Society α β, IsSimpleReduction S₀ S := + exists_simple_reduction S hconn hnocross hnotripod + +theorem exists_split_simple_reductions {S₀ S : Society α β} + (hred : IsSimpleReduction S₀ S) + {s t : α} (hs : s ∈ S₀.Ω.bar) (ht : t ∈ S₀.Ω.bar) (hst : s ≠ t) + {P : Graph α β} (hP : IsGraphPathWithEnds S₀.G P s t) (hP_ind : P ≤i S₀.G) + (hP_bar : Disjoint (V(P) \ {s, t}) S₀.Ω.bar) + (hcatch : Catches (S₀.Ω.bar \ {s, t}) (deleteVertices S₀.G V(P))) : + let hP_bar₂ : Disjoint (V(P) \ {t, s}) S₀.Ω.bar := by rw [pair_comm]; exact hP_bar + let S₀₁ := splitSociety S₀ hs ht hst hP hP_bar hred.2.2.2.2.1 + let S₀₂ := splitSociety S₀ ht hs hst.symm hP.symm hP_bar₂ hred.2.2.2.2.1 + ∃ (E_base E_P : Set β) (S₁ S₂ : Society α β), + IsSimpleReduction S₀₁ S₁ ∧ + IsSimpleReduction S₀₂ S₂ ∧ + S₁.G ≤ S.G.restrict E_base ∧ + S₂.G ≤ S.G.restrict E_base ∧ + V(S₁.G) ∪ V(S₂.G) = V(S.G.restrict E_base) ∧ + V(S₁.G) ∩ V(S₂.G) = V(P) ∧ + E(S₁.G) ∪ E(S₂.G) = E(S.G.restrict E_base) ∧ + Disjoint E(S₁.G) E(S₂.G) ∧ + E_base ∪ E_P = E(S.G) ∧ + Disjoint E_base E_P ∧ + (∀ e ∈ E_P, ∃ u v : α, S.G.IsLink e u v ∧ P.Adj u v) := by + intro hP_bar₂ S₀₁ S₀₂ + have hcatch₂ : Catches (S₀.Ω.bar \ {t, s}) (deleteVertices S₀.G V(P)) := by + rw [pair_comm]; exact hcatch + rcases hred with ⟨hG₀_le, hV₀_eq, hΩ₀_eq, hconn₀, hnc₀, hnt₀, hloop₀, hsimp₀, hadj₀⟩ + let H₁ := splitSide S₀.G P (S₀.Ω.interval s t) + let H₂ := splitSide S₀.G P (S₀.Ω.interval t s) + have hV_S₀₁ : V(S₀₁.G) = V(P) ∪ V(H₁) := + vertexSet_splitGraph_eq_union S₀ hs ht hst hP hcatch hnc₀ + have hV_S₀₂ : V(S₀₂.G) = V(P) ∪ V(H₂) := + vertexSet_splitGraph_eq_union S₀ ht hs hst.symm hP.symm hcatch₂ hnc₀ + have hdisj_H : Disjoint V(H₁) V(H₂) := (lemma_2_4_H1_disjoint_H2 S₀ hs ht hst hP hnc₀).1 + have hdisj_P_H₁ : Disjoint V(P) V(H₁) := (disjoint_vertexSet_splitSide_P S₀.G P _).symm + have hdisj_P_H₂ : Disjoint V(P) V(H₂) := (disjoint_vertexSet_splitSide_P S₀.G P _).symm + have hV_union₀ : V(S₀₁.G) ∪ V(S₀₂.G) = V(S.G) := by + rw [hV_S₀₁, hV_S₀₂, ← hV₀_eq, ← union_union_distrib_left] + have hunion_H := congrArg Graph.vertexSet (lemma_2_4_H1_union_H2 S₀ hs ht hst hcatch) + change V(H₁) ∪ V(H₂) = V(S₀.G) \ V(P) at hunion_H + rw [hunion_H] + exact union_sdiff_cancel hP.1.vertexSet_mono + have hV_inter₀ : V(S₀₁.G) ∩ V(S₀₂.G) = V(P) := by + rw [hV_S₀₁, hV_S₀₂, ← union_inter_distrib_left, + Set.disjoint_iff_inter_eq_empty.mp hdisj_H, union_empty] + let E_P : Set β := {e ∈ E(S.G) | ∃ u ∈ V(P), ∃ v ∈ V(P), u ≠ v ∧ S.G.IsLink e u v} + let E₁ : Set β := {e ∈ E(S.G) \ E_P | ∃ u ∈ V(S₀₁.G), ∃ v ∈ V(S₀₁.G), S.G.IsLink e u v} + let E₂ : Set β := {e ∈ E(S.G) \ (E_P ∪ E₁) | ∃ u ∈ V(S₀₂.G), ∃ v ∈ V(S₀₂.G), S.G.IsLink e u v} + let E_base : Set β := E₁ ∪ E₂ + have hE₁_sub : E₁ ⊆ E(S.G) := fun _ he => he.1.1 + have hE₂_sub : E₂ ⊆ E(S.G) := fun _ he => he.1.1 + have hEP_sub : E_P ⊆ E(S.G) := fun _ he => he.1 + let G₁ := (S.G.induce V(S₀₁.G)).restrict E₁ + let G₂ := (S.G.induce V(S₀₂.G)).restrict E₂ + have hV_G₁ : V(G₁) = V(S₀₁.G) := rfl + have hV_G₂ : V(G₂) = V(S₀₂.G) := rfl + have hE_G₁ : E(G₁) = E₁ := by + change E((S.G.induce V(S₀₁.G)).restrict E₁) = E₁ + rw [edgeSet_restrict, inter_eq_right] + rintro e ⟨_, u, hu, v, hv, huv⟩ + exact ⟨u, v, huv, hu, hv⟩ + have hE_G₂ : E(G₂) = E₂ := by + change E((S.G.induce V(S₀₂.G)).restrict E₂) = E₂ + rw [edgeSet_restrict, inter_eq_right] + rintro e ⟨_, u, hu, v, hv, huv⟩ + exact ⟨u, v, huv, hu, hv⟩ + have hS₀₁_le_G₁ : S₀₁.G ≤ G₁ := by + refine ⟨le_rfl, fun {e x y} hlink => ?_⟩ + have hlink₀ : S₀.G.IsLink e x y := hlink.mono (splitGraph_le S₀ P s t) + have hlinkG : S.G.IsLink e x y := hlink₀.mono hG₀_le + have hx₁ : x ∈ V(S₀₁.G) := hlink.left_mem + have hy₁ : y ∈ V(S₀₁.G) := hlink.right_mem + have hnot_EP : e ∉ E_P := by + rintro ⟨_, u, huP, v, hvP, _, huv⟩ + rcases hlinkG.eq_and_eq_or_eq_and_eq huv with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact not_isLink_splitGraph_of_mem_P S₀ s t hP_ind hlink huP hvP + · exact not_isLink_splitGraph_of_mem_P S₀ s t hP_ind hlink hvP huP + have he₁ : e ∈ E₁ := ⟨⟨hlinkG.edge_mem, hnot_EP⟩, x, hx₁, y, hy₁, hlinkG⟩ + exact ⟨he₁, hlinkG, hx₁, hy₁⟩ + have hS₀₂_le_G₂ : S₀₂.G ≤ G₂ := by + refine ⟨le_rfl, fun {e x y} hlink => ?_⟩ + have hlink₀ : S₀.G.IsLink e x y := hlink.mono (splitGraph_le S₀ P t s) + have hlinkG : S.G.IsLink e x y := hlink₀.mono hG₀_le + have hx₂ : x ∈ V(S₀₂.G) := hlink.left_mem + have hy₂ : y ∈ V(S₀₂.G) := hlink.right_mem + have hnot_both_P : ¬ (x ∈ V(P) ∧ y ∈ V(P)) := fun ⟨hxP, hyP⟩ => + not_isLink_splitGraph_of_mem_P S₀ t s hP_ind hlink hxP hyP + have hnot_EP : e ∉ E_P := by + rintro ⟨_, u, huP, v, hvP, _, huv⟩ + rcases hlinkG.eq_and_eq_or_eq_and_eq huv with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hnot_both_P ⟨huP, hvP⟩ + · exact hnot_both_P ⟨hvP, huP⟩ + have hnot_E₁ : e ∉ E₁ := by + rintro ⟨_, u, hu₁, v, hv₁, huv⟩ + rcases hlinkG.eq_and_eq_or_eq_and_eq huv with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · have hxP : x ∈ V(P) := hV_inter₀ ▸ ⟨hu₁, hx₂⟩ + have hyP : y ∈ V(P) := hV_inter₀ ▸ ⟨hv₁, hy₂⟩ + exact hnot_both_P ⟨hxP, hyP⟩ + · have hxP : x ∈ V(P) := hV_inter₀ ▸ ⟨hv₁, hx₂⟩ + have hyP : y ∈ V(P) := hV_inter₀ ▸ ⟨hu₁, hy₂⟩ + exact hnot_both_P ⟨hxP, hyP⟩ + have he₂ : e ∈ E₂ := ⟨⟨hlinkG.edge_mem, fun h => h.elim hnot_EP hnot_E₁⟩, x, hx₂, y, hy₂, + hlinkG⟩ + exact ⟨he₂, hlinkG, hx₂, hy₂⟩ + have hG₁_le_S : G₁ ≤ S.G := + restrict_le.trans (S.G.induce_le (hV₀_eq ▸ (splitGraph_le S₀ P s t).vertexSet_mono)) + have hG₂_le_S : G₂ ≤ S.G := + restrict_le.trans (S.G.induce_le (hV₀_eq ▸ (splitGraph_le S₀ P t s).vertexSet_mono)) + let S₁ : Society α β := ⟨G₁, S₀₁.Ω, S.finite_V.subset hG₁_le_S.vertexSet_mono, + S.finite_E.subset hG₁_le_S.edgeSet_mono, S₀₁.bar_subset⟩ + let S₂ : Society α β := ⟨G₂, S₀₂.Ω, S.finite_V.subset hG₂_le_S.vertexSet_mono, + S.finite_E.subset hG₂_le_S.edgeSet_mono, S₀₂.bar_subset⟩ + have hred₁ : IsSimpleReduction S₀₁ S₁ := by + refine ⟨hS₀₁_le_G₁, rfl, rfl, + lemma_2_4_isKConnected_three S₀ hs ht hst hP hP_bar hcatch hnc₀ hconn₀, + lemma_2_4_no_cross S₀ hs ht hst hP hP_ind hP_bar hcatch hnc₀ hnt₀, + lemma_2_4_no_tripod S₀ hs ht hst hP hP_ind hP_bar hcatch hnc₀ hnt₀, + fun x hx => hloop₀ x (hx.mono (splitGraph_le S₀ P s t)), + fun e₁ e₂ x y h1 h2 => + hsimp₀ e₁ e₂ x y (h1.mono (splitGraph_le S₀ P s t)) (h2.mono (splitGraph_le S₀ P s t)), + fun e x y hlink => ?_⟩ + by_cases hxy : x = y + · exact Or.inl hxy + · right + have hlinkG : S.G.IsLink e x y := hlink.2.1 + have hx₁ : x ∈ V(S₀₁.G) := hlink.2.2.1 + have hy₁ : y ∈ V(S₀₁.G) := hlink.2.2.2 + have he_not_EP : e ∉ E_P := hlink.1.1.2 + obtain ⟨e₀, he₀⟩ := (hadj₀ e x y hlinkG).resolve_left hxy + have he₀_not_P : e₀ ∉ E(P) := by + intro he₀P + obtain ⟨u, v, huvP⟩ := P.exists_isLink_of_mem_edgeSet he₀P + rcases he₀.eq_and_eq_or_eq_and_eq (huvP.mono hP.1) with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact he_not_EP ⟨hlinkG.edge_mem, x, huvP.left_mem, y, huvP.right_mem, hxy, hlinkG⟩ + · exact he_not_EP ⟨hlinkG.edge_mem, x, huvP.right_mem, y, huvP.left_mem, hxy, hlinkG⟩ + exact ⟨e₀, (splitGraph_isLink_iff S₀ P s t).mpr ⟨he₀, he₀_not_P, hx₁.2, hy₁.2⟩⟩ + have hred₂ : IsSimpleReduction S₀₂ S₂ := by + refine ⟨hS₀₂_le_G₂, rfl, rfl, + lemma_2_4_isKConnected_three S₀ ht hs hst.symm hP.symm hP_bar₂ hcatch₂ hnc₀ hconn₀, + lemma_2_4_no_cross S₀ ht hs hst.symm hP.symm hP_ind hP_bar₂ hcatch₂ hnc₀ hnt₀, + lemma_2_4_no_tripod S₀ ht hs hst.symm hP.symm hP_ind hP_bar₂ hcatch₂ hnc₀ hnt₀, + fun x hx => hloop₀ x (hx.mono (splitGraph_le S₀ P t s)), + fun e₁ e₂ x y h1 h2 => + hsimp₀ e₁ e₂ x y (h1.mono (splitGraph_le S₀ P t s)) (h2.mono (splitGraph_le S₀ P t s)), + fun e x y hlink => ?_⟩ + by_cases hxy : x = y + · exact Or.inl hxy + · right + have hlinkG : S.G.IsLink e x y := hlink.2.1 + have hx₂ : x ∈ V(S₀₂.G) := hlink.2.2.1 + have hy₂ : y ∈ V(S₀₂.G) := hlink.2.2.2 + have he_not_EP : e ∉ E_P := fun h => hlink.1.1.2 (Or.inl h) + obtain ⟨e₀, he₀⟩ := (hadj₀ e x y hlinkG).resolve_left hxy + have he₀_not_P : e₀ ∉ E(P) := by + intro he₀P + obtain ⟨u, v, huvP⟩ := P.exists_isLink_of_mem_edgeSet he₀P + rcases he₀.eq_and_eq_or_eq_and_eq (huvP.mono hP.1) with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact he_not_EP ⟨hlinkG.edge_mem, x, huvP.left_mem, y, huvP.right_mem, hxy, hlinkG⟩ + · exact he_not_EP ⟨hlinkG.edge_mem, x, huvP.right_mem, y, huvP.left_mem, hxy, hlinkG⟩ + exact ⟨e₀, (splitGraph_isLink_iff S₀ P t s).mpr ⟨he₀, he₀_not_P, hx₂.2, hy₂.2⟩⟩ + have hE_union_all : E_base ∪ E_P = E(S.G) := by + refine Subset.antisymm (union_subset (union_subset hE₁_sub hE₂_sub) hEP_sub) fun e he => ?_ + by_cases heP : e ∈ E_P + · exact Or.inr heP + · left + by_cases he₁ : e ∈ E₁ + · exact Or.inl he₁ + · right + obtain ⟨x, y, hxy⟩ := S.G.exists_isLink_of_mem_edgeSet he + refine ⟨⟨he, fun h => h.elim heP he₁⟩, x, ?_, y, ?_, hxy⟩ + · have hx_in : x ∈ V(S₀₁.G) ∪ V(S₀₂.G) := hV_union₀.symm ▸ hxy.left_mem + rcases hx_in with hx₁ | hx₂ + · by_cases hy₁ : y ∈ V(S₀₁.G) + · exact (he₁ ⟨⟨he, heP⟩, x, hx₁, y, hy₁, hxy⟩).elim + · have hy_in : y ∈ V(S₀₁.G) ∪ V(S₀₂.G) := hV_union₀.symm ▸ hxy.right_mem + have hy₂ : y ∈ V(S₀₂.G) := hy_in.resolve_left hy₁ + have hyH₂ : y ∈ V(H₂) := (hV_S₀₂ ▸ hy₂).resolve_left fun hyP => hy₁ + (hV_S₀₁ ▸ Or.inl hyP) + rcases hV_S₀₁ ▸ hx₁ with hxP | hxH₁ + · exact hV_S₀₂ ▸ Or.inl hxP + · have hne : x ≠ y := fun h => disjoint_left.mp hdisj_H hxH₁ (h ▸ hyH₂) + obtain ⟨e₀, he₀⟩ := (hadj₀ e x y hxy).resolve_left hne + exact (no_link_between_splitSides S₀ hs ht hst hP hnc₀ he₀ hxH₁ hyH₂).elim + · exact hx₂ + · have hy_in : y ∈ V(S₀₁.G) ∪ V(S₀₂.G) := hV_union₀.symm ▸ hxy.right_mem + rcases hy_in with hy₁ | hy₂ + · by_cases hx₁ : x ∈ V(S₀₁.G) + · exact (he₁ ⟨⟨he, heP⟩, x, hx₁, y, hy₁, hxy⟩).elim + · have hx_in : x ∈ V(S₀₁.G) ∪ V(S₀₂.G) := hV_union₀.symm ▸ hxy.left_mem + have hx₂ : x ∈ V(S₀₂.G) := hx_in.resolve_left hx₁ + have hxH₂ : x ∈ V(H₂) := (hV_S₀₂ ▸ hx₂).resolve_left fun hxP => hx₁ + (hV_S₀₁ ▸ Or.inl hxP) + rcases hV_S₀₁ ▸ hy₁ with hyP | hyH₁ + · exact hV_S₀₂ ▸ Or.inl hyP + · have hne : x ≠ y := fun h => disjoint_left.mp hdisj_H (h ▸ hyH₁) hxH₂ + obtain ⟨e₀, he₀⟩ := (hadj₀ e x y hxy).resolve_left hne + exact (no_link_between_splitSides S₀ hs ht hst hP hnc₀ he₀.symm hyH₁ hxH₂).elim + · exact hy₂ + refine ⟨E_base, E_P, S₁, S₂, hred₁, hred₂, ?_, ?_, ?_, hV_inter₀, ?_, ?_, hE_union_all, ?_, ?_⟩ + · exact ⟨by rw [vertexSet_restrict]; exact hG₁_le_S.vertexSet_mono, + fun {_ _ _} hl => ⟨Or.inl hl.1, hl.2.1⟩⟩ + · exact ⟨by rw [vertexSet_restrict]; exact hG₂_le_S.vertexSet_mono, + fun {_ _ _} hl => ⟨Or.inr hl.1, hl.2.1⟩⟩ + · rw [vertexSet_restrict] + exact hV_union₀ + · change E(G₁) ∪ E(G₂) = E(S.G.restrict (E₁ ∪ E₂)) + rw [hE_G₁, hE_G₂, edgeSet_restrict, inter_eq_right.mpr (union_subset hE₁_sub hE₂_sub)] + · change Disjoint E(G₁) E(G₂) + rw [hE_G₁, hE_G₂, disjoint_left] + exact fun _ he₁ he₂ => he₂.1.2 (Or.inr he₁) + · rw [disjoint_left] + rintro e (he₁ | he₂) heP + · exact he₁.1.2 heP + · exact he₂.1.2 (Or.inl heP) + · rintro e ⟨_, u, huP, v, hvP, huv_ne, huv_link⟩ + obtain ⟨e₀, he₀⟩ := (hadj₀ e u v huv_link).resolve_left huv_ne + exact ⟨u, v, huv_link, e₀, hP_ind.isLink_of_mem_mem he₀ huP hvP⟩ + +theorem upperDiscMap_exp_upperSplitAngle_of_mem_P {G P : Graph α β} {s t : α} + (hst : s ≠ t) (hP : IsGraphPathWithEnds G P s t) (θ' : α → ℝ) {k : ℕ} + (hk : k < (pathWalkTS hP).support.length) : + upperDiscMap (pathWalkTS hP).support.length + (Circle.exp (upperSplitAngle hP θ' ((pathWalkTS hP).support[k]'hk)) : ℂ) = + (pathX (pathWalkTS hP).support.length k : ℂ) := by + let m := (pathWalkTS hP).support.length + have hm : 2 ≤ m := two_le_length_support_pathWalkTS hst hP + rw [upperSplitAngle_of_mem_P hP θ' hk, circle_exp_two_pi_sub_arccos (pathX_mem_Icc hm hk)] + exact upperDiscMap_pathX m hk + +theorem lowerDiscMap_exp_lowerSplitAngle_of_mem_P {G P : Graph α β} {s t : α} + (hst : s ≠ t) (hP : IsGraphPathWithEnds G P s t) (θ' : α → ℝ) {k : ℕ} + (hk : k < (pathWalkTS hP).support.length) : + lowerDiscMap (pathWalkTS hP).support.length + (Circle.exp (lowerSplitAngle hP θ' ((pathWalkTS hP).support[k]'hk)) : ℂ) = + (pathX (pathWalkTS hP).support.length k : ℂ) := by + let m := (pathWalkTS hP).support.length + have hm : 2 ≤ m := two_le_length_support_pathWalkTS hst hP + rw [lowerSplitAngle_of_mem_P hP θ' hk, circle_exp_arccos (pathX_mem_Icc hm hk)] + exact lowerDiscMap_pathX m hk + +theorem upperDiscMap_exp_upperSplitAngle_of_not_mem_P {G P : Graph α β} {s t : α} + (hP : IsGraphPathWithEnds G P s t) {θ' : α → ℝ} {v : α} + (hv_not_P : v ∉ V(P)) (h1 : θ' s < θ' v) (h2 : θ' v < θ' t) : + upperDiscMap (pathWalkTS hP).support.length + (Circle.exp (upperSplitAngle hP θ' v) : ℂ) = + (Circle.exp (2 * Real.pi + Real.pi * (θ' v - θ' s) / (θ' t - θ' s)) : ℂ) := by + rw [upperSplitAngle_of_not_mem_P hP θ' hv_not_P] + let u := Real.pi * (θ' v - θ' s) / (θ' t - θ' s) + have hpi : 0 < Real.pi := Real.pi_pos + have hdiff : 0 < θ' t - θ' s := by linarith + have hu0 : 0 < u := div_pos (mul_pos hpi (by linarith)) hdiff + have hu_pi : u < Real.pi := by + dsimp [u] + rw [div_lt_iff₀ hdiff] + nlinarith + have hexp_eq : Circle.exp (2 * Real.pi + u) = Circle.exp u := by + rw [Circle.exp_add, Circle.exp_two_pi, one_mul] + have him : 0 ≤ ((Circle.exp (2 * Real.pi + u) : ℂ)).im := by + rw [hexp_eq] + simp only [Circle.coe_exp, Complex.exp_ofReal_mul_I_im] + exact (Real.sin_pos_of_pos_of_lt_pi hu0 hu_pi).le + exact upperDiscMap_eq_self_of_mem_sphere (Circle.exp _).2 him + +theorem lowerDiscMap_exp_lowerSplitAngle_of_not_mem_P {G P : Graph α β} {s t : α} + (hP : IsGraphPathWithEnds G P s t) {θ' : α → ℝ} {v : α} + (hv_not_P : v ∉ V(P)) (h1 : θ' t < θ' v) (h2 : θ' v < θ' s + 2 * Real.pi) : + lowerDiscMap (pathWalkTS hP).support.length + (Circle.exp (lowerSplitAngle hP θ' v) : ℂ) = + (Circle.exp (Real.pi + Real.pi * (θ' v - θ' t) / (θ' s + 2 * Real.pi - θ' t)) : ℂ) := by + rw [lowerSplitAngle_of_not_mem_P hP θ' hv_not_P] + let u := Real.pi * (θ' v - θ' t) / (θ' s + 2 * Real.pi - θ' t) + have hpi : 0 < Real.pi := Real.pi_pos + have hdiff : 0 < θ' s + 2 * Real.pi - θ' t := by linarith + have hu0 : 0 < u := div_pos (mul_pos hpi (by linarith)) hdiff + have hu_pi : u < Real.pi := by + dsimp [u] + rw [div_lt_iff₀ hdiff] + nlinarith + have him : ((Circle.exp (Real.pi + u) : ℂ)).im ≤ 0 := by + simp only [Circle.coe_exp, Complex.exp_ofReal_mul_I_im] + rw [add_comm Real.pi u, Real.sin_add_pi] + linarith [Real.sin_pos_of_pos_of_lt_pi hu0 hu_pi] + exact lowerDiscMap_eq_self_of_mem_sphere (Circle.exp _).2 him + +open Classical in +private theorem glue_drawings_along_path {S S₀ S₁ S₂ : Society α β} {s t : α} + {P : Graph α β} (hP₀ : IsGraphPathWithEnds S₀.G P s t) (hm : 2 ≤ (pathWalkTS + hP₀).support.length) + {E_base E_P : Set β} + (hS₁_le_base : S₁.G ≤ S.G.restrict E_base) (hS₂_le_base : S₂.G ≤ S.G.restrict E_base) + (hV_union_base : V(S₁.G) ∪ V(S₂.G) = V(S.G.restrict E_base)) + (hV_inter_P : V(S₁.G) ∩ V(S₂.G) = V(P)) + (hE_union_base : E(S₁.G) ∪ E(S₂.G) = E(S.G.restrict E_base)) + (hE_disj_base : Disjoint E(S₁.G) E(S₂.G)) (hE_union_all : E_base ∪ E_P = E(S.G)) + (hE_disj_all : Disjoint E_base E_P) + (hEP_adj : ∀ e ∈ E_P, ∃ u v : α, S.G.IsLink e u v ∧ P.Adj u v) + {ν₁ ν₂ : α → ℂ} {Γ₁ : GraphDrawing S₁.G ℂ} {Γ₂ : GraphDrawing S₂.G ℂ} + (hν₁_inj : InjOn ν₁ V(S₁.G)) (hν₂_inj : InjOn ν₂ V(S₂.G)) + (hU₁_ball : Γ₁.drawing.U ⊆ Metric.closedBall (0 : ℂ) 1) + (hU₂_ball : Γ₂.drawing.U ⊆ Metric.closedBall (0 : ℂ) 1) + (hν₁_eq : ∀ v : V(S₁.G), (Γ₁.iso.vertexEquiv v).1 = ν₁ v.1) + (hν₂_eq : ∀ v : V(S₂.G), (Γ₂.iso.vertexEquiv v).1 = ν₂ v.1) : + let L_P := (pathWalkTS hP₀).support + let m := L_P.length + (∀ k (hk : k < m), upperDiscMap m (ν₁ (L_P[k]'hk)) = (pathX m k : ℂ)) → + (∀ v ∈ V(P), upperDiscMap m (ν₁ v) = lowerDiscMap m (ν₂ v)) → + ∃ (ν_mid : α → ℂ) (Γ_mid : GraphDrawing S.G ℂ), + (∀ v ∈ V(S₁.G), ν_mid v = upperDiscMap m (ν₁ v)) ∧ + (∀ v ∈ V(S₂.G), ν_mid v = lowerDiscMap m (ν₂ v)) ∧ + InjOn ν_mid V(S.G) ∧ Γ_mid.drawing.U ⊆ Metric.closedBall (0 : ℂ) 1 ∧ + Γ_mid.drawing.U ⊆ (upperDiscMap m '' Γ₁.drawing.U ∪ lowerDiscMap m '' Γ₂.drawing.U) ∪ + {w : ℂ | ∃ j k : ℕ, k + 1 < m ∧ w ∈ lensArc m k (1 / (4 * ((j : ℝ) + 2)))} ∧ + ∀ v : V(S.G), (Γ_mid.iso.vertexEquiv v).1 = ν_mid v.1 := by + intro L_P m hP_val₁ hP_agree + obtain ⟨Γ₁', hU₁', hV₁', hν₁'_eq⟩ := + GraphDrawing.transport Γ₁ + ((isCompact_closedBall (0 : ℂ) 1).of_isClosed_subset Γ₁.drawing.isClosed_U hU₁_ball) + hν₁_eq (continuous_upperDiscMap m) (injOn_upperDiscMap hm |>.mono hU₁_ball) + obtain ⟨Γ₂', hU₂', hV₂', hν₂'_eq⟩ := + GraphDrawing.transport Γ₂ + ((isCompact_closedBall (0 : ℂ) 1).of_isClosed_subset Γ₂.drawing.isClosed_U hU₂_ball) + hν₂_eq (continuous_lowerDiscMap m) (injOn_lowerDiscMap hm |>.mono hU₂_ball) + let ν_mid (v : α) : ℂ := + if v ∈ V(S₁.G) then upperDiscMap m (ν₁ v) else lowerDiscMap m (ν₂ v) + have hν_mid_1 : ∀ v ∈ V(S₁.G), ν_mid v = upperDiscMap m (ν₁ v) := + fun v hv => by simp [ν_mid, hv] + have hν_mid_2 : ∀ v ∈ V(S₂.G), ν_mid v = lowerDiscMap m (ν₂ v) := by + intro v hv₂ + dsimp [ν_mid] + split_ifs with hv₁ + · exact hP_agree v (hV_inter_P ▸ ⟨hv₁, hv₂⟩) + · rfl + have hν₁_in_ball : ∀ v ∈ V(S₁.G), ν₁ v ∈ Metric.closedBall (0 : ℂ) 1 := by + intro v hv + have : ν₁ v ∈ Γ₁.drawing.V := by + rw [← hν₁_eq ⟨v, hv⟩]; exact (Γ₁.iso.vertexEquiv ⟨v, hv⟩).2 + exact hU₁_ball (Γ₁.drawing.V_subset_U this) + have hν₂_in_ball : ∀ v ∈ V(S₂.G), ν₂ v ∈ Metric.closedBall (0 : ℂ) 1 := by + intro v hv + have : ν₂ v ∈ Γ₂.drawing.V := by + rw [← hν₂_eq ⟨v, hv⟩]; exact (Γ₂.iso.vertexEquiv ⟨v, hv⟩).2 + exact hU₂_ball (Γ₂.drawing.V_subset_U this) + have hU_inter_P : + (upperDiscMap m '' Metric.closedBall (0 : ℂ) 1) ∩ + (lowerDiscMap m '' Metric.closedBall (0 : ℂ) 1) ⊆ + ν_mid '' V(P) := by + intro w hw + obtain ⟨k, hk, rfl⟩ := upperDiscMap_inter_lowerDiscMap hm hw + have hkP : L_P[k]'hk ∈ V(P) := by + rw [vertexSet_eq_support_pathWalkTS hP₀]; exact List.getElem_mem hk + have hk₁ : L_P[k]'hk ∈ V(S₁.G) := by + have : V(P) ⊆ V(S₁.G) := hV_inter_P ▸ inter_subset_left + exact this hkP + refine ⟨L_P[k]'hk, hkP, ?_⟩ + rw [hν_mid_1 _ hk₁, hP_val₁ k hk] + have hν_mid_inj : InjOn ν_mid V(S.G) := by + have hV_S_eq : V(S.G) = V(S₁.G) ∪ V(S₂.G) := by + have := hV_union_base.symm + rwa [vertexSet_restrict] at this + intro u hu v hv heq + rw [hV_S_eq] at hu hv + rcases hu with hu₁ | hu₂ <;> rcases hv with hv₁ | hv₂ + · rw [hν_mid_1 u hu₁, hν_mid_1 v hv₁] at heq + exact hν₁_inj hu₁ hv₁ (injOn_upperDiscMap hm (hν₁_in_ball u hu₁) (hν₁_in_ball v hv₁) heq) + · have hw_in : ν_mid u ∈ + (upperDiscMap m '' Metric.closedBall (0 : ℂ) 1) ∩ + (lowerDiscMap m '' Metric.closedBall (0 : ℂ) 1) := by + refine ⟨?_, ?_⟩ + · rw [hν_mid_1 u hu₁]; exact ⟨ν₁ u, hν₁_in_ball u hu₁, rfl⟩ + · rw [heq, hν_mid_2 v hv₂]; exact ⟨ν₂ v, hν₂_in_ball v hv₂, rfl⟩ + obtain ⟨p, hpP, hp_eq⟩ := hU_inter_P hw_in + have hp₁ : p ∈ V(S₁.G) := (hV_inter_P ▸ inter_subset_left) hpP + have hp₂ : p ∈ V(S₂.G) := (hV_inter_P ▸ inter_subset_right) hpP + have hup : u = p := by + have heq1 : upperDiscMap m (ν₁ p) = upperDiscMap m (ν₁ u) := by + rw [← hν_mid_1 p hp₁, ← hν_mid_1 u hu₁, hp_eq] + exact (hν₁_inj hp₁ hu₁ + (injOn_upperDiscMap hm (hν₁_in_ball p hp₁) (hν₁_in_ball u hu₁) heq1)).symm + have hvp : v = p := by + have heq2 : lowerDiscMap m (ν₂ p) = lowerDiscMap m (ν₂ v) := by + rw [← hν_mid_2 p hp₂, ← hν_mid_2 v hv₂, hp_eq, heq] + exact (hν₂_inj hp₂ hv₂ + (injOn_lowerDiscMap hm (hν₂_in_ball p hp₂) (hν₂_in_ball v hv₂) heq2)).symm + exact hup.trans hvp.symm + · have hw_in : ν_mid v ∈ + (upperDiscMap m '' Metric.closedBall (0 : ℂ) 1) ∩ + (lowerDiscMap m '' Metric.closedBall (0 : ℂ) 1) := by + refine ⟨?_, ?_⟩ + · rw [hν_mid_1 v hv₁]; exact ⟨ν₁ v, hν₁_in_ball v hv₁, rfl⟩ + · rw [← heq, hν_mid_2 u hu₂]; exact ⟨ν₂ u, hν₂_in_ball u hu₂, rfl⟩ + obtain ⟨p, hpP, hp_eq⟩ := hU_inter_P hw_in + have hp₁ : p ∈ V(S₁.G) := (hV_inter_P ▸ inter_subset_left) hpP + have hp₂ : p ∈ V(S₂.G) := (hV_inter_P ▸ inter_subset_right) hpP + have hvp : v = p := by + have heq1 : upperDiscMap m (ν₁ p) = upperDiscMap m (ν₁ v) := by + rw [← hν_mid_1 p hp₁, ← hν_mid_1 v hv₁, hp_eq] + exact (hν₁_inj hp₁ hv₁ + (injOn_upperDiscMap hm (hν₁_in_ball p hp₁) (hν₁_in_ball v hv₁) heq1)).symm + have hup : u = p := by + have heq2 : lowerDiscMap m (ν₂ p) = lowerDiscMap m (ν₂ u) := by + rw [← hν_mid_2 p hp₂, ← hν_mid_2 u hu₂, hp_eq, ← heq] + exact (hν₂_inj hp₂ hu₂ + (injOn_lowerDiscMap hm (hν₂_in_ball p hp₂) (hν₂_in_ball u hu₂) heq2)).symm + exact hup.trans hvp.symm + · rw [hν_mid_2 u hu₂, hν_mid_2 v hv₂] at heq + exact hν₂_inj hu₂ hv₂ (injOn_lowerDiscMap hm (hν₂_in_ball u hu₂) (hν₂_in_ball v hv₂) heq) + have hmeet_base : Γ₁'.drawing.U ∩ Γ₂'.drawing.U ⊆ ν_mid '' (V(S₁.G) ∩ V(S₂.G)) := by + rw [hU₁', hU₂', hV_inter_P] + exact (inter_subset_inter (image_mono hU₁_ball) (image_mono hU₂_ball)).trans hU_inter_P + obtain ⟨Γ_base, hU_base, hν_base⟩ := + GraphDrawing.glue hS₁_le_base hS₂_le_base hV_union_base hE_union_base hE_disj_base + (by rw [vertexSet_restrict]; exact hν_mid_inj) Γ₁' Γ₂' + (fun v => (hν₁'_eq v).trans (hν_mid_1 v.1 v.2).symm) + (fun v => (hν₂'_eq v).trans (hν_mid_2 v.1 v.2).symm) + hmeet_base + have hU_base_sub : Γ_base.drawing.U ⊆ + (upperDiscMap m '' Metric.closedBall (0 : ℂ) 1) ∪ + (lowerDiscMap m '' Metric.closedBall (0 : ℂ) 1) := by + rw [hU_base, hU₁', hU₂'] + exact union_subset_union (image_mono hU₁_ball) (image_mono hU₂_ball) + have hEP_links : ∀ e ∈ E_P, ∃ u v : α, S.G.IsLink e u v ∧ + ∃ k : ℕ, k + 1 < m ∧ ν_mid u = (pathX m k : ℂ) ∧ ν_mid v = (pathX m (k + 1) : ℂ) := by + intro e heP + obtain ⟨u, v, huv_link, huv_adj⟩ := hEP_adj e heP + obtain ⟨k, hk, hpair⟩ := exists_support_index_of_adj_pathWalkTS hP₀ huv_adj + have hk0 : k < m := Nat.lt_trans (Nat.lt_succ_self k) hk + have hkP0 : L_P[k]'hk0 ∈ V(P) := by + rw [vertexSet_eq_support_pathWalkTS hP₀]; exact List.getElem_mem hk0 + have hkP1 : L_P[k + 1]'hk ∈ V(P) := by + rw [vertexSet_eq_support_pathWalkTS hP₀]; exact List.getElem_mem hk + have hk1_0 : L_P[k]'hk0 ∈ V(S₁.G) := (hV_inter_P ▸ inter_subset_left) hkP0 + have hk1_1 : L_P[k + 1]'hk ∈ V(S₁.G) := (hV_inter_P ▸ inter_subset_left) hkP1 + have hval0 : ν_mid (L_P[k]'hk0) = (pathX m k : ℂ) := by + rw [hν_mid_1 _ hk1_0, hP_val₁ k hk0] + have hval1 : ν_mid (L_P[k + 1]'hk) = (pathX m (k + 1) : ℂ) := by + rw [hν_mid_1 _ hk1_1, hP_val₁ (k + 1) hk] + have hu_in : u ∈ ({L_P[k]'hk0, L_P[k + 1]'hk} : Set α) := hpair ▸ by simp + have hv_in : v ∈ ({L_P[k]'hk0, L_P[k + 1]'hk} : Set α) := hpair ▸ by simp + have hLP0_in : L_P[k]'hk0 ∈ ({u, v} : Set α) := by + rw [hpair]; exact Or.inl rfl + have hLP1_in : L_P[k + 1]'hk ∈ ({u, v} : Set α) := by + rw [hpair]; exact Or.inr (mem_singleton _) + have hne_LP : L_P[k]'hk0 ≠ L_P[k + 1]'hk := fun heq => by + have := (List.Nodup.getElem_inj_iff (isSimple_pathWalkTS hP₀)).mp heq + omega + rcases hu_in with rfl | rfl <;> rcases hv_in with rfl | rfl + · exfalso + rcases hLP1_in with h1 | h1 + · exact hne_LP h1.symm + · exact hne_LP (mem_singleton_iff.mp h1).symm + · exact ⟨_, _, huv_link, k, hk, hval0, hval1⟩ + · exact ⟨_, _, huv_link.symm, k, hk, hval0, hval1⟩ + · exfalso + rcases hLP0_in with h0 | h0 + · exact hne_LP h0 + · exact hne_LP (mem_singleton_iff.mp h0) + obtain ⟨Γ_mid, hU_mid_sub₁, hU_mid_sub₂, hν_mid_eq⟩ := + exists_drawing_gluing_lensArcs hm S.finite_E hE_union_all hE_disj_all + hν_mid_inj hEP_links Γ_base hU_base_sub hν_base + have hU_mid_ball : Γ_mid.drawing.U ⊆ Metric.closedBall (0 : ℂ) 1 := by + refine hU_mid_sub₂.trans (union_subset ?_ ?_) + · refine hU_base_sub.trans (union_subset ?_ ?_) + · rintro w ⟨z, hz, rfl⟩; exact upperDiscMap_mem_closedBall hm hz + · rintro w ⟨z, hz, rfl⟩; exact lowerDiscMap_mem_closedBall hm hz + · rintro w ⟨j, k, hk, hw⟩ + have hc0 : (0 : ℝ) < 1 / (4 * ((j : ℝ) + 2)) := by positivity + have hc1 : 1 / (4 * ((j : ℝ) + 2)) < (1 : ℝ) / 2 := by + have : (2 : ℝ) < 4 * ((j : ℝ) + 2) := by linarith + exact one_div_lt_one_div_of_lt (by norm_num) this + exact lensArc_subset_closedBall hm hk hc0 hc1 hw + have hcover := hU_mid_sub₂ + rw [hU_base, hU₁', hU₂'] at hcover + exact ⟨ν_mid, Γ_mid, hν_mid_1, hν_mid_2, hν_mid_inj, hU_mid_ball, hcover, hν_mid_eq⟩ + +private theorem glued_drawing_meets_sphere {S S₀ S₁ S₂ : Society α β} {s t : α} + (hΩ : S₀.Ω = S.Ω) (hs₀ : s ∈ S₀.Ω.bar) (ht₀ : t ∈ S₀.Ω.bar) (hst : s ≠ t) + {P : Graph α β} (hP₀ : IsGraphPathWithEnds S₀.G P s t) + {ν₁ ν₂ ν_mid : α → ℂ} {Γ₁ : GraphDrawing S₁.G ℂ} {Γ₂ : GraphDrawing S₂.G ℂ} + {Γ_mid : GraphDrawing S.G ℂ} + (hU₁_ball : Γ₁.drawing.U ⊆ Metric.closedBall (0 : ℂ) 1) + (hU₂_ball : Γ₂.drawing.U ⊆ Metric.closedBall (0 : ℂ) 1) + (hU₁_sph : Γ₁.drawing.U ∩ Metric.sphere (0 : ℂ) 1 = ν₁ '' S₁.Ω.bar) + (hU₂_sph : Γ₂.drawing.U ∩ Metric.sphere (0 : ℂ) 1 = ν₂ '' S₂.Ω.bar) + (hbar₁_eq : S₁.Ω.bar = S₀.Ω.interval s t ∪ V(P)) + (hbar₂_eq : S₂.Ω.bar = S₀.Ω.interval t s ∪ V(P)) + (hν_mid_eq : ∀ v : V(S.G), (Γ_mid.iso.vertexEquiv v).1 = ν_mid v.1) + (hν_mid_s : ν_mid s = 1) (hν_mid_t : ν_mid t = -1) + (hθ₁ : ∀ v ∈ S₀.Ω.interval s t, ν_mid v ∈ Metric.sphere (0 : ℂ) 1) + (hθ₂ : ∀ v ∈ S₀.Ω.interval t s, ν_mid v ∈ Metric.sphere (0 : ℂ) 1) : + let L_P := (pathWalkTS hP₀).support + let m := L_P.length + 2 ≤ m → + (∀ v ∈ V(S₁.G), ν_mid v = upperDiscMap m (ν₁ v)) → + (∀ v ∈ V(S₂.G), ν_mid v = lowerDiscMap m (ν₂ v)) → + (∀ k (hk : k < m), upperDiscMap m (ν₁ (L_P[k]'hk)) = (pathX m k : ℂ)) → + (∀ k (hk : k < m), lowerDiscMap m (ν₂ (L_P[k]'hk)) = (pathX m k : ℂ)) → + Γ_mid.drawing.U ⊆ (upperDiscMap m '' Γ₁.drawing.U ∪ lowerDiscMap m '' Γ₂.drawing.U) ∪ + {w : ℂ | ∃ j k : ℕ, k + 1 < m ∧ w ∈ lensArc m k (1 / (4 * ((j : ℝ) + 2)))} → + Γ_mid.drawing.U ∩ Metric.sphere (0 : ℂ) 1 = ν_mid '' S.Ω.bar := by + intro L_P m hm hν_mid_1 hν_mid_2 hP_val₁ hP_val₂ hU_mid_cover + refine Subset.antisymm ?_ ?_ + · rintro w ⟨hwU, hwS⟩ + rcases hU_mid_cover hwU with hw_base | ⟨j, k, hk, hw_lens⟩ + · rcases hw_base with hw₁' | hw₂' + · obtain ⟨z, hzU₁, rfl⟩ := hw₁' + have hz_sph : z ∈ Metric.sphere (0 : ℂ) 1 := + ((upperDiscMap_mem_sphere_iff hm (hU₁_ball hzU₁)).mp hwS).1 + have hz_bar₁ : z ∈ ν₁ '' S₁.Ω.bar := hU₁_sph ▸ ⟨hzU₁, hz_sph⟩ + obtain ⟨v, hv_bar₁, rfl⟩ := hz_bar₁ + have hv₁ : v ∈ V(S₁.G) := S₁.bar_subset hv_bar₁ + rw [← hν_mid_1 v hv₁] at hwS ⊢ + rcases hbar₁_eq ▸ hv_bar₁ with hvW1 | hvP + · exact ⟨v, hΩ ▸ hvW1.1.1, rfl⟩ + · have hv_LP : v ∈ L_P := by + change v ∈ {x | x ∈ (pathWalkTS hP₀).support} + rwa [← vertexSet_eq_support_pathWalkTS hP₀] + obtain ⟨k, hk, rfl⟩ := List.mem_iff_getElem.mp hv_LP + rw [hν_mid_1 _ hv₁, hP_val₁ k hk] at hwS + have hnorm1 : |pathX m k| = 1 := by + simpa [Complex.norm_real] using hwS + have hxk_Icc := pathX_mem_Icc hm hk + have hk_end : k = 0 ∨ k = m - 1 := by + rcases eq_or_eq_neg_of_abs_eq hnorm1 with h1 | h1 + · right + by_contra hne + have : pathX m k < pathX m (m - 1) := pathX_strictMono hm (by omega) + rw [pathX_pred hm] at this + linarith + · left + by_contra hne + have : pathX m 0 < pathX m k := pathX_strictMono hm (by omega) + rw [pathX_zero] at this + linarith + rcases hk_end with rfl | rfl + · have ht_LP : L_P[0]'hk = t := support_getElem_zero (pathWalkTS hP₀) hk + rw [ht_LP] + exact ⟨t, hΩ ▸ ht₀, rfl⟩ + · have hs_LP : L_P[m - 1]'hk = s := support_getElem_last (pathWalkTS hP₀) + rw [hs_LP] + exact ⟨s, hΩ ▸ hs₀, rfl⟩ + · obtain ⟨z, hzU₂, rfl⟩ := hw₂' + have hz_sph : z ∈ Metric.sphere (0 : ℂ) 1 := + ((lowerDiscMap_mem_sphere_iff hm (hU₂_ball hzU₂)).mp hwS).1 + have hz_bar₂ : z ∈ ν₂ '' S₂.Ω.bar := hU₂_sph ▸ ⟨hzU₂, hz_sph⟩ + obtain ⟨v, hv_bar₂, rfl⟩ := hz_bar₂ + have hv₂ : v ∈ V(S₂.G) := S₂.bar_subset hv_bar₂ + rw [← hν_mid_2 v hv₂] at hwS ⊢ + rcases hbar₂_eq ▸ hv_bar₂ with hvW2 | hvP + · exact ⟨v, hΩ ▸ hvW2.1.1, rfl⟩ + · have hv_LP : v ∈ L_P := by + change v ∈ {x | x ∈ (pathWalkTS hP₀).support} + rwa [← vertexSet_eq_support_pathWalkTS hP₀] + obtain ⟨k, hk, rfl⟩ := List.mem_iff_getElem.mp hv_LP + rw [hν_mid_2 _ hv₂, hP_val₂ k hk] at hwS + have hnorm1 : |pathX m k| = 1 := by + simpa [Complex.norm_real] using hwS + have hk_end : k = 0 ∨ k = m - 1 := by + rcases eq_or_eq_neg_of_abs_eq hnorm1 with h1 | h1 + · right + by_contra hne + have : pathX m k < pathX m (m - 1) := pathX_strictMono hm (by omega) + rw [pathX_pred hm] at this + linarith + · left + by_contra hne + have : pathX m 0 < pathX m k := pathX_strictMono hm (by omega) + rw [pathX_zero] at this + linarith + rcases hk_end with rfl | rfl + · have ht_LP : L_P[0]'hk = t := support_getElem_zero (pathWalkTS hP₀) hk + rw [ht_LP] + exact ⟨t, hΩ ▸ ht₀, rfl⟩ + · have hs_LP : L_P[m - 1]'hk = s := support_getElem_last (pathWalkTS hP₀) + rw [hs_LP] + exact ⟨s, hΩ ▸ hs₀, rfl⟩ + · have hc0 : (0 : ℝ) < 1 / (4 * ((j : ℝ) + 2)) := by positivity + have hc1 : 1 / (4 * ((j : ℝ) + 2)) < (1 : ℝ) / 2 := by + have : (2 : ℝ) < 4 * ((j : ℝ) + 2) := by linarith + exact one_div_lt_one_div_of_lt (by norm_num) this + rcases lensArc_inter_sphere hm hk hc0 hc1 ⟨hw_lens, hwS⟩ with rfl | rfl + · rw [pathX_zero]; exact ⟨t, hΩ ▸ ht₀, by simpa using hν_mid_t⟩ + · rw [pathX_pred hm]; exact ⟨s, hΩ ▸ hs₀, by simpa using hν_mid_s⟩ + · rintro w ⟨v, hv_bar, rfl⟩ + have hvG : v ∈ V(S.G) := S.bar_subset hv_bar + have hvU : ν_mid v ∈ Γ_mid.drawing.U := by + rw [← hν_mid_eq ⟨v, hvG⟩] + exact Γ_mid.drawing.V_subset_U (Γ_mid.iso.vertexEquiv ⟨v, hvG⟩).2 + refine ⟨hvU, ?_⟩ + have hv_bar₀ : v ∈ S₀.Ω.bar := hΩ.symm ▸ hv_bar + by_cases hvs : v = s + · subst hvs; rw [hν_mid_s]; simp + · by_cases hvt : v = t + · subst hvt; rw [hν_mid_t]; simp + · rcases S₀.Ω.mem_interval_or_interval_swap hs₀ ht₀ hv_bar₀ hst hvs hvt with hv1 | hv2 + · exact hθ₁ v hv1 + · exact hθ₂ v hv2 + +open Classical in +theorem exists_disc_drawing_of_isSimpleReduction : + ∀ (n : ℕ) (S₀ S : Society α β), + IsSimpleReduction S₀ S → + E(S₀.G).ncard = n → + ∀ (L : List α), S.Ω.IsOrbitList L → + ∀ (θ : α → ℝ), IsValidAngle L θ → + ∃ (ν : α → ℂ) (Γ : GraphDrawing S.G ℂ), + InjOn ν V(S.G) ∧ + (∀ v ∈ S.Ω.bar, ν v = (Circle.exp (θ v) : ℂ)) ∧ + Γ.drawing.U ⊆ Metric.closedBall (0 : ℂ) 1 ∧ + Γ.drawing.U ∩ Metric.sphere (0 : ℂ) 1 = ν '' S.Ω.bar ∧ + ∀ v : V(S.G), (Γ.iso.vertexEquiv v).1 = ν v.1 := by + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro S₀ S hred hn L hL θ hθ + by_cases hE₀ : E(S₀.G).Nonempty + · obtain ⟨s, hs₀, t, ht₀, hst, P, hP₀, hP_ind₀, hP_bar₀, hcatch₀⟩ := + exists_induced_catches_path_of_three_connected_nonempty S₀ + hred.2.2.2.1 hred.2.2.2.2.2.2.1 hred.2.2.2.2.2.2.2.1 hE₀ + have hP_bar₂₀ : Disjoint (V(P) \ {t, s}) S₀.Ω.bar := by rw [pair_comm]; exact hP_bar₀ + let S₀₁ := splitSociety S₀ hs₀ ht₀ hst hP₀ hP_bar₀ hred.2.2.2.2.1 + let S₀₂ := splitSociety S₀ ht₀ hs₀ hst.symm hP₀.symm hP_bar₂₀ hred.2.2.2.2.1 + obtain ⟨E_base, E_P, S₁, S₂, hred₁, hred₂, hS₁_le_base, hS₂_le_base, + hV_union_base, hV_inter_P, hE_union_base, hE_disj_base, + hE_union_all, hE_disj_all, hEP_adj⟩ := + exists_split_simple_reductions hred hs₀ ht₀ hst hP₀ hP_ind₀ hP_bar₀ hcatch₀ + have hlt₁ : E(S₀₁.G).ncard < n := by + rw [← hn] + exact lemma_2_4_edgeSet_ncard_lt S₀ hst hP₀ + have hlt₂ : E(S₀₂.G).ncard < n := by + rw [← hn] + exact lemma_2_4_edgeSet_ncard_lt S₀ hst.symm hP₀.symm + have hL₀ : S₀.Ω.IsOrbitList L := hred.2.2.1 ▸ hL + have hsL : s ∈ L := by rwa [← hL₀.2.2.1] at hs₀ + let i₀ := CyclicPerm.indexOfMem L hsL + let θ' := shiftedAngle L θ i₀ + obtain ⟨h_st, h_span, h_W1_bounds, h_W1_mono, h_W2_bounds, h_W2_mono⟩ := + shiftedAngle_intervalList_props hL₀ hθ hs₀ ht₀ hst + let L₁ := splitList S₀ hs₀ ht₀ hP₀ + let L₂ := splitList S₀ ht₀ hs₀ hP₀.symm + let θ₁ := upperSplitAngle hP₀ θ' + let θ₂ := lowerSplitAngle hP₀ θ' + have hL₁ : S₁.Ω.IsOrbitList L₁ := hred₁.2.2.1 ▸ isOrbitList_splitList S₀ hs₀ ht₀ hst hP₀ + hP_bar₀ + have hL₂ : S₂.Ω.IsOrbitList L₂ := + hred₂.2.2.1 ▸ isOrbitList_splitList S₀ ht₀ hs₀ hst.symm hP₀.symm hP_bar₂₀ + have hθ₁ : IsValidAngle L₁ θ₁ := + isValidAngle_upperSplitAngle S₀ hs₀ ht₀ hst hP₀ hP_bar₀ h_st h_W1_bounds h_W1_mono + have hθ₂ : IsValidAngle L₂ θ₂ := + isValidAngle_lowerSplitAngle S₀ hs₀ ht₀ hst hP₀ hP_bar₀ h_span h_W2_bounds h_W2_mono + obtain ⟨ν₁, Γ₁, hν₁_inj, hν₁_bar, hU₁_ball, hU₁_sph, hν₁_eq⟩ := + ih _ hlt₁ S₀₁ S₁ hred₁ rfl L₁ hL₁ θ₁ hθ₁ + obtain ⟨ν₂, Γ₂, hν₂_inj, hν₂_bar, hU₂_ball, hU₂_sph, hν₂_eq⟩ := + ih _ hlt₂ S₀₂ S₂ hred₂ rfl L₂ hL₂ θ₂ hθ₂ + let L_P := (pathWalkTS hP₀).support + let m := L_P.length + have hm : 2 ≤ m := two_le_length_support_pathWalkTS hst hP₀ + have hbar₁_eq : S₁.Ω.bar = S₀.Ω.interval s t ∪ V(P) := by + rw [← hred₁.2.2.1]; exact splitCyclicPerm_bar S₀ hs₀ ht₀ hst hP₀ hP_bar₀ + have hbar₂_eq : S₂.Ω.bar = S₀.Ω.interval t s ∪ V(P) := by + rw [← hred₂.2.2.1]; exact splitCyclicPerm_bar S₀ ht₀ hs₀ hst.symm hP₀.symm hP_bar₂₀ + have hP_val₁ : ∀ k (hk : k < m), + upperDiscMap m (ν₁ (L_P[k]'hk)) = (pathX m k : ℂ) := by + intro k hk + have hvP : L_P[k]'hk ∈ V(P) := by + rw [vertexSet_eq_support_pathWalkTS hP₀]; exact List.getElem_mem hk + rw [hν₁_bar _ (hbar₁_eq ▸ Or.inr hvP)] + exact upperDiscMap_exp_upperSplitAngle_of_mem_P hst hP₀ θ' hk + have hP_val₂ : ∀ k (hk : k < m), + lowerDiscMap m (ν₂ (L_P[k]'hk)) = (pathX m k : ℂ) := by + intro k hk + have hvP : L_P[k]'hk ∈ V(P) := by + rw [vertexSet_eq_support_pathWalkTS hP₀]; exact List.getElem_mem hk + rw [hν₂_bar _ (hbar₂_eq ▸ Or.inr hvP)] + exact lowerDiscMap_exp_lowerSplitAngle_of_mem_P hst hP₀ θ' hk + have hP_agree : ∀ v ∈ V(P), upperDiscMap m (ν₁ v) = lowerDiscMap m (ν₂ v) := by + intro v hvP + have hv_LP : v ∈ L_P := by + change v ∈ {x | x ∈ (pathWalkTS hP₀).support} + rwa [← vertexSet_eq_support_pathWalkTS hP₀] + obtain ⟨k, hk, rfl⟩ := List.mem_iff_getElem.mp hv_LP + rw [hP_val₁ k hk, hP_val₂ k hk] + obtain ⟨ν_mid, Γ_mid, hν_mid_1, hν_mid_2, hν_mid_inj, hU_mid_ball, + hU_mid_cover, hν_mid_eq⟩ := + glue_drawings_along_path hP₀ hm hS₁_le_base hS₂_le_base hV_union_base hV_inter_P + hE_union_base hE_disj_base hE_union_all hE_disj_all hEP_adj + hν₁_inj hν₂_inj hU₁_ball hU₂_ball hν₁_eq hν₂_eq hP_val₁ hP_agree + have hν_mid_s : ν_mid s = 1 := by + have hpos : 0 < m := by omega + have hs_LP : L_P[m - 1]'(by omega) = s := support_getElem_last (pathWalkTS hP₀) + have hsP : s ∈ V(P) := hP₀.left_mem + have hs₁ : s ∈ V(S₁.G) := (hV_inter_P ▸ inter_subset_left) hsP + rw [hν_mid_1 s hs₁] + change upperDiscMap m (ν₁ s) = 1 + rw [← hs_LP, hP_val₁ (m - 1) (by omega), pathX_pred hm] + simp + have hν_mid_t : ν_mid t = -1 := by + have hpos : 0 < m := by omega + have ht_LP : L_P[0]'hpos = t := support_getElem_zero (pathWalkTS hP₀) hpos + have htP : t ∈ V(P) := hP₀.right_mem + have ht₁ : t ∈ V(S₁.G) := (hV_inter_P ▸ inter_subset_left) htP + rw [hν_mid_1 t ht₁] + change upperDiscMap m (ν₁ t) = -1 + rw [← ht_LP, hP_val₁ 0 hpos, pathX_zero] + simp + have hν_mid_W1 : ∀ v ∈ S₀.Ω.interval s t, + ν_mid v = (Circle.exp (2 * Real.pi + Real.pi * (θ' v - θ' s) / (θ' t - θ' s)) : ℂ) := by + intro v hvW1 + have hv_bar₁ : v ∈ S₁.Ω.bar := hbar₁_eq ▸ Or.inl hvW1 + have hv₁ : v ∈ V(S₁.G) := S₁.bar_subset hv_bar₁ + have hv_not_P : v ∉ V(P) := fun hvP => + disjoint_left.mp hP_bar₀ ⟨hvP, hvW1.1.2⟩ hvW1.1.1 + have hv_LW1 : v ∈ S₀.Ω.intervalList hs₀ ht₀ := + (S₀.Ω.mem_intervalList_iff hs₀ ht₀ hst v).mpr hvW1 + obtain ⟨a, ha, rfl⟩ := List.mem_iff_getElem.mp hv_LW1 + obtain ⟨hb1, hb2⟩ := h_W1_bounds a ha + rw [hν_mid_1 _ hv₁, hν₁_bar _ hv_bar₁] + exact upperDiscMap_exp_upperSplitAngle_of_not_mem_P hP₀ hv_not_P hb1 hb2 + have hν_mid_W2 : ∀ v ∈ S₀.Ω.interval t s, + ν_mid v = (Circle.exp (Real.pi + Real.pi * (θ' v - θ' t) / (θ' s + 2 * Real.pi - θ' t)) : + ℂ) := by + intro v hvW2 + have hv_bar₂ : v ∈ S₂.Ω.bar := hbar₂_eq ▸ Or.inl hvW2 + have hv₂ : v ∈ V(S₂.G) := S₂.bar_subset hv_bar₂ + have hv_not_P : v ∉ V(P) := fun hvP => + disjoint_left.mp hP_bar₂₀ ⟨hvP, hvW2.1.2⟩ hvW2.1.1 + have hv_LW2 : v ∈ S₀.Ω.intervalList ht₀ hs₀ := + (S₀.Ω.mem_intervalList_iff ht₀ hs₀ hst.symm v).mpr hvW2 + obtain ⟨b, hb, rfl⟩ := List.mem_iff_getElem.mp hv_LW2 + obtain ⟨hb1, hb2⟩ := h_W2_bounds b hb + rw [hν_mid_2 _ hv₂, hν₂_bar _ hv_bar₂] + exact lowerDiscMap_exp_lowerSplitAngle_of_not_mem_P hP₀ hv_not_P hb1 hb2 + have hU_mid_sph := glued_drawing_meets_sphere hred.2.2.1 hs₀ ht₀ hst hP₀ + hU₁_ball hU₂_ball hU₁_sph hU₂_sph hbar₁_eq hbar₂_eq hν_mid_eq hν_mid_s hν_mid_t + (fun v hv => (hν_mid_W1 v hv).symm ▸ (Circle.exp _).2) + (fun v hv => (hν_mid_W2 v hv).symm ▸ (Circle.exp _).2) + hm hν_mid_1 hν_mid_2 hP_val₁ hP_val₂ hU_mid_cover + let Φ := discAngleMap (θ' s) (θ' t) + have hΦ_inj : Function.Injective Φ := injective_discAngleMap h_st h_span + obtain ⟨Γ, hU_Γ, _, hν_Γ⟩ := + GraphDrawing.transport Γ_mid + ((isCompact_closedBall (0 : ℂ) 1).of_isClosed_subset Γ_mid.drawing.isClosed_U hU_mid_ball) + hν_mid_eq (continuous_discAngleMap (θ' s) (θ' t)) hΦ_inj.injOn + let ν (v : α) : ℂ := Φ (ν_mid v) + refine ⟨ν, Γ, hΦ_inj.injOn.comp hν_mid_inj (mapsTo_univ _ _), ?_, ?_, ?_, hν_Γ⟩ + · intro v hv_bar + have hvL : v ∈ L := by rwa [← hL.2.2.1] at hv_bar + have hexp_θ' : (Circle.exp (θ' v) : ℂ) = (Circle.exp (θ v) : ℂ) := + congrArg Subtype.val (circle_exp_shiftedAngle L θ i₀ hvL) + rw [← hexp_θ'] + have hv_bar₀ : v ∈ S₀.Ω.bar := hred.2.2.1.symm ▸ hv_bar + by_cases hvs : v = s + · subst hvs + change discAngleMap (θ' v) (θ' t) (ν_mid v) = (Circle.exp (θ' v) : ℂ) + rw [hν_mid_s, discAngleMap_one] + · by_cases hvt : v = t + · subst hvt + change discAngleMap (θ' s) (θ' v) (ν_mid v) = (Circle.exp (θ' v) : ℂ) + rw [hν_mid_t, discAngleMap_neg_one] + · rcases S₀.Ω.mem_interval_or_interval_swap hs₀ ht₀ hv_bar₀ hst hvs hvt with hv1 | hv2 + · have hv_LW1 : v ∈ S₀.Ω.intervalList hs₀ ht₀ := + (S₀.Ω.mem_intervalList_iff hs₀ ht₀ hst v).mpr hv1 + obtain ⟨a, ha, rfl⟩ := List.mem_iff_getElem.mp hv_LW1 + obtain ⟨hb1, hb2⟩ := h_W1_bounds a ha + change discAngleMap (θ' s) (θ' t) (ν_mid _) = _ + rw [hν_mid_W1 _ hv1] + exact discAngleMap_upper_exp hb1 hb2 + · have hv_LW2 : v ∈ S₀.Ω.intervalList ht₀ hs₀ := + (S₀.Ω.mem_intervalList_iff ht₀ hs₀ hst.symm v).mpr hv2 + obtain ⟨b, hb, rfl⟩ := List.mem_iff_getElem.mp hv_LW2 + obtain ⟨hb1, hb2⟩ := h_W2_bounds b hb + change discAngleMap (θ' s) (θ' t) (ν_mid _) = _ + rw [hν_mid_W2 _ hv2] + exact discAngleMap_lower_exp hb1 hb2 + · rw [hU_Γ] + rintro w ⟨z, hz, rfl⟩ + exact (discAngleMap_mem_closedBall_iff (θ' s) (θ' t) z).mpr (hU_mid_ball hz) + · rw [hU_Γ] + ext w + simp only [mem_inter_iff, mem_image] + constructor + · rintro ⟨⟨z, hzU, rfl⟩, hwS⟩ + have hzS : z ∈ Metric.sphere (0 : ℂ) 1 := + (discAngleMap_mem_sphere_iff (θ' s) (θ' t) z).mp hwS + have hz_in : z ∈ ν_mid '' S.Ω.bar := hU_mid_sph ▸ ⟨hzU, hzS⟩ + obtain ⟨v, hv_bar, rfl⟩ := hz_in + exact ⟨v, hv_bar, rfl⟩ + · rintro ⟨v, hv_bar, rfl⟩ + have hz_in : ν_mid v ∈ Γ_mid.drawing.U ∩ Metric.sphere (0 : ℂ) 1 := + hU_mid_sph.symm ▸ ⟨v, hv_bar, rfl⟩ + exact ⟨⟨ν_mid v, hz_in.1, rfl⟩, + (discAngleMap_mem_sphere_iff (θ' s) (θ' t) (ν_mid v)).mpr hz_in.2⟩ + · have hE₀_empty : E(S₀.G) = ∅ := Set.not_nonempty_iff_eq_empty.mp hE₀ + have hV_eq : V(S.G) = S.Ω.bar := by + rw [← hred.2.1, ← hred.2.2.1] + exact vertexSet_eq_bar_of_edgeSet_eq_empty S₀ hred.2.2.2.1 hE₀_empty + have hloops : ∀ e x y, S.G.IsLink e x y → x = y := by + intro e x y hlink + rcases hred.2.2.2.2.2.2.2.2 e x y hlink with rfl | ⟨f, hf⟩ + · rfl + · have hfE : f ∈ E(S₀.G) := hf.edge_mem + rw [hE₀_empty] at hfE + exact hfE.elim + let ν (v : α) : ℂ := (Circle.exp (θ v) : ℂ) + have hν_inj : InjOn ν V(S.G) := hV_eq ▸ injOn_circle_exp_of_isValidAngle hL hθ + have hν_sph : ∀ v ∈ V(S.G), ν v ∈ Metric.sphere (0 : ℂ) 1 := fun v _ => (Circle.exp _).2 + obtain ⟨Γ, hU_ball, hU_sph, hν_eq⟩ := + exists_drawing_of_loops_only S.finite_V S.finite_E hloops hν_inj hν_sph + exact ⟨ν, Γ, hν_inj, fun _ _ => rfl, hU_ball, hV_eq ▸ hU_sph, hν_eq⟩ + +theorem CyclicPerm.isOrbitList_mem_interval_of_lt {Ω : CyclicPerm α} {L : List α} + (hL : Ω.IsOrbitList L) {i j k : ℕ} (hij : i < j) (hjk : j < k) (hk : k < L.length) : + (L[j]'(Nat.lt_trans hjk hk)) ∈ + Ω.interval (L[i]'(Nat.lt_trans (Nat.lt_trans hij hjk) hk)) (L[k]'hk) := by + have hi : i < L.length := Nat.lt_trans (Nat.lt_trans hij hjk) hk + have hj : j < L.length := Nat.lt_trans hjk hk + have hi_bar : L[i]'hi ∈ Ω.bar := hL.2.2.1 ▸ List.getElem_mem hi + have hj_bar : L[j]'hj ∈ Ω.bar := hL.2.2.1 ▸ List.getElem_mem hj + have hk_bar : L[k]'hk ∈ Ω.bar := hL.2.2.1 ▸ List.getElem_mem hk + have hne_ik : L[i]'hi ≠ L[k]'hk := fun h => by + have := (List.Nodup.getElem_inj_iff hL.1).mp h; omega + have hne_ji : L[j]'hj ≠ L[i]'hi := fun h => by + have := (List.Nodup.getElem_inj_iff hL.1).mp h; omega + have hne_jk : L[j]'hj ≠ L[k]'hk := fun h => by + have := (List.Nodup.getElem_inj_iff hL.1).mp h; omega + rw [Ω.mem_interval_iff_firstHitIn hi_bar hk_bar hj_bar hne_ik hne_ji hne_jk] + refine ⟨j - i, by omega, ?_, by simp, ?_⟩ + · rw [iterate_toFun_eq_getElem_of_next hL.2.2.2 hi (j - i)] + congr 1; rw [Nat.mod_eq_of_lt (by omega)]; omega + · intro m hm1 hmj hmem + have hm_lt : i + m < L.length := by omega + have h_eq : (Ω.toFun^[m]) (L[i]'hi) = L[i + m]'hm_lt := by + rw [iterate_toFun_eq_getElem_of_next hL.2.2.2 hi m] + congr 1; exact Nat.mod_eq_of_lt hm_lt + rw [h_eq] at hmem + rcases hmem with h1 | h2 | h3 + · have := (List.Nodup.getElem_inj_iff hL.1).mp h1; omega + · have := (List.Nodup.getElem_inj_iff hL.1).mp h2; omega + · have := (List.Nodup.getElem_inj_iff hL.1).mp (mem_singleton_iff.mp h3); omega + +/-- An orbit list has valid angles, spaced evenly around the circle. -/ +theorem CyclicPerm.IsOrbitList.exists_isValidAngle {Ω : CyclicPerm α} {L : List α} + (hL : Ω.IsOrbitList L) : ∃ θ : α → ℝ, IsValidAngle L θ := by + classical + have hpos : 0 < L.length := List.length_pos_of_ne_nil hL.2.1 + have hpos_real : (0 : ℝ) < (L.length : ℝ) := Nat.cast_pos.mpr hpos + let θ (v : α) : ℝ := + if hv : v ∈ L then 2 * Real.pi * (CyclicPerm.indexOfMem L hv : ℝ) / (L.length : ℝ) else 0 + have hθ_get : ∀ i (hi : i < L.length), + θ (L[i]'hi) = 2 * Real.pi * (i : ℝ) / (L.length : ℝ) := by + intro i hi + have hmem : L[i]'hi ∈ L := List.getElem_mem hi + simp only [θ, hmem, ↓reduceDIte] + rw [CyclicPerm.indexOfMem_getElem hL.1 hi] + have hθ : IsValidAngle L θ := by + refine ⟨?_, ?_⟩ + · intro i j hi hj hij + rw [hθ_get i hi, hθ_get j hj] + have hij_real : (i : ℝ) < (j : ℝ) := Nat.cast_lt.mpr hij + gcongr + · intro i hi + have h0_eq : θ (L[0]'(Nat.zero_lt_of_lt hi)) = 0 := by + rw [hθ_get 0 (Nat.zero_lt_of_lt hi)] + simp + rw [h0_eq, hθ_get i hi, zero_add] + have hi_real : (i : ℝ) < (L.length : ℝ) := Nat.cast_lt.mpr hi + calc + 2 * Real.pi * (i : ℝ) / (L.length : ℝ) < 2 * Real.pi * (L.length : ℝ) / (L.length : ℝ) := by + gcongr + _ = 2 * Real.pi := mul_div_cancel_right₀ _ (ne_of_gt hpos_real) + exact ⟨θ, hθ⟩ + +/-- If angles increase along an orbit list of `Ω` and span less than one turn, then a clockwise +triple of `Ω` has increasing angles within one turn. -/ +theorem exists_angles_of_isClockwise3 {Ω : CyclicPerm α} {L : List α} + (hL : Ω.IsOrbitList L) {θ : α → ℝ} (hθ : IsValidAngle L θ) {X : Type*} {f : ℝ → X} + (hf : ∀ t, f (t + 2 * Real.pi) = f t) {T : α → Set X} (hT : ∀ v ∈ Ω.bar, f (θ v) ∈ T v) + {v₁ v₂ v₃ : α} (hcw : Ω.IsClockwise3 v₁ v₂ v₃) : + ∃ t₁ t₂ t₃ : ℝ, t₁ < t₂ ∧ t₂ < t₃ ∧ t₃ < t₁ + 2 * Real.pi ∧ + f t₁ ∈ T v₁ ∧ f t₂ ∈ T v₂ ∧ f t₃ ∈ T v₃ := by + obtain ⟨h12, h13, h23, hv₁, hv₂, hv₃, _⟩ := Ω.isClockwise3_iff.mp hcw + have hv₁L : v₁ ∈ L := by rwa [← hL.2.2.1] at hv₁ + have hv₂L : v₂ ∈ L := by rwa [← hL.2.2.1] at hv₂ + have hv₃L : v₃ ∈ L := by rwa [← hL.2.2.1] at hv₃ + obtain ⟨i₁, hi₁, rfl⟩ := List.mem_iff_getElem.mp hv₁L + obtain ⟨i₂, hi₂, rfl⟩ := List.mem_iff_getElem.mp hv₂L + obtain ⟨i₃, hi₃, rfl⟩ := List.mem_iff_getElem.mp hv₃L + have hne12 : i₁ ≠ i₂ := fun h => h12 (by subst h; rfl) + have hne13 : i₁ ≠ i₃ := fun h => h13 (by subst h; rfl) + have hne23 : i₂ ≠ i₃ := fun h => h23 (by subst h; rfl) + have h_in' : L[i₂]'hi₂ ∈ Ω.interval (L[i₁]'hi₁) (L[i₃]'hi₃) := + ⟨⟨hv₂, by simp [h12.symm, h23]⟩, hcw⟩ + have hnot_132 : ¬ (i₁ < i₃ ∧ i₃ < i₂) := by + rintro ⟨h_a, h_b⟩ + have h_in := Ω.isOrbitList_mem_interval_of_lt hL h_a h_b hi₂ + exact disjoint_left.mp (Ω.disjoint_interval_swap (L[i₁]'hi₁) (L[i₂]'hi₂)) + h_in (Ω.mem_interval_rotate_left h_in') + have hnot_321 : ¬ (i₃ < i₂ ∧ i₂ < i₁) := by + rintro ⟨h_a, h_b⟩ + have h_in := Ω.isOrbitList_mem_interval_of_lt hL h_a h_b hi₁ + exact disjoint_left.mp (Ω.disjoint_interval_swap (L[i₃]'hi₃) (L[i₁]'hi₁)) + h_in h_in' + have hnot_213 : ¬ (i₂ < i₁ ∧ i₁ < i₃) := by + rintro ⟨h_a, h_b⟩ + have h_in := Ω.isOrbitList_mem_interval_of_lt hL h_a h_b hi₃ + exact disjoint_left.mp (Ω.disjoint_interval_swap (L[i₂]'hi₂) (L[i₃]'hi₃)) + h_in (Ω.mem_interval_rotate_right h_in') + have hcases : (i₁ < i₂ ∧ i₂ < i₃) ∨ (i₂ < i₃ ∧ i₃ < i₁) ∨ (i₃ < i₁ ∧ i₁ < i₂) := by + omega + have hθ_ge : ∀ i (hi : i < L.length), θ (L[0]'(by omega)) ≤ θ (L[i]'hi) := by + intro i hi + rcases Nat.eq_zero_or_pos i with rfl | hpos + · exact le_rfl + · exact le_of_lt (hθ.1 0 i (by omega) hi hpos) + have hφ_mem : ∀ i (hi : i < L.length), f (θ (L[i]'hi)) ∈ T (L[i]'hi) := fun i hi => + hT _ (by rw [← hL.2.2.1]; exact List.getElem_mem hi) + rcases hcases with ⟨ha, hb⟩ | ⟨ha, hb⟩ | ⟨ha, hb⟩ + · refine ⟨θ (L[i₁]'hi₁), θ (L[i₂]'hi₂), θ (L[i₃]'hi₃), + hθ.1 i₁ i₂ hi₁ hi₂ ha, hθ.1 i₂ i₃ hi₂ hi₃ hb, ?_, + hφ_mem i₁ hi₁, hφ_mem i₂ hi₂, hφ_mem i₃ hi₃⟩ + linarith [hθ_ge i₁ hi₁, hθ.2 i₃ hi₃] + · refine ⟨θ (L[i₁]'hi₁), θ (L[i₂]'hi₂) + 2 * Real.pi, θ (L[i₃]'hi₃) + 2 * Real.pi, + by linarith [hθ.2 i₁ hi₁, hθ_ge i₂ hi₂], + by linarith [hθ.1 i₂ i₃ hi₂ hi₃ ha], + by linarith [hθ.1 i₃ i₁ hi₃ hi₁ hb], + hφ_mem i₁ hi₁, ?_, ?_⟩ + · rw [hf]; exact hφ_mem i₂ hi₂ + · rw [hf]; exact hφ_mem i₃ hi₃ + · refine ⟨θ (L[i₁]'hi₁), θ (L[i₂]'hi₂), θ (L[i₃]'hi₃) + 2 * Real.pi, + hθ.1 i₁ i₂ hi₁ hi₂ hb, + by linarith [hθ.2 i₂ hi₂, hθ_ge i₃ hi₃], + by linarith [hθ.1 i₃ i₁ hi₃ hi₁ ha], + hφ_mem i₁ hi₁, hφ_mem i₂ hi₂, ?_⟩ + rw [hf]; exact hφ_mem i₃ hi₃ + +/-- Transport a complex unit-disc drawing `(ν, Γ)` with valid boundary angles to `ClosedUnitDisc`, +proving `S.IsRuralSociety`. -/ +theorem isRuralSociety_of_complex_disc_drawing (S : Society α β) + {L : List α} (hL : S.Ω.IsOrbitList L) {θ : α → ℝ} (hθ : IsValidAngle L θ) + {ν : α → ℂ} {Γ : GraphDrawing S.G ℂ} + (hν_inj : InjOn ν V(S.G)) + (hν_bar : ∀ v ∈ S.Ω.bar, ν v = (Circle.exp (θ v) : ℂ)) + (hU_ball : Γ.drawing.U ⊆ Metric.closedBall (0 : ℂ) 1) + (hU_sph : Γ.drawing.U ∩ Metric.sphere (0 : ℂ) 1 = ν '' S.Ω.bar) + (hν_eq : ∀ v : V(S.G), (Γ.iso.vertexEquiv v).1 = ν v.1) : + S.IsRuralSociety := by + let Ω₀ : CyclicPerm α := { + bar := ∅ + toFun := id + finite_bar := finite_empty + bijOn := bijOn_empty id + single_orbit := fun _ hx => hx.elim + } + refine ⟨Ω₀, empty_subset _, rfl, ?_⟩ + obtain ⟨Γ_E, hU_E, _, hν_E⟩ := + GraphDrawing.transport Γ + ((isCompact_closedBall (0 : ℂ) 1).of_isClosed_subset Γ.drawing.isClosed_U hU_ball) + hν_eq complexPlane.continuous complexPlane.injective.injOn + have hdisc : IsClosedDisc ClosedUnitDisc := ⟨Homeomorph.refl ClosedUnitDisc⟩ + have hvertex_eq : ∀ v (hv : v ∈ V(S.G)), + graphDrawingVertexSet Γ_E v = {complexPlane (ν v)} := by + intro v hv + ext x + simp only [graphDrawingVertexSet, mem_ofPred_eq, mem_singleton_iff] + exact ⟨fun ⟨hv', hx⟩ => hx.symm.trans (hν_E ⟨v, hv'⟩), + fun hx => ⟨hv, (hν_E ⟨v, hv⟩).trans hx.symm⟩⟩ + have hbd_iff : ∀ v ∈ V(S.G), + (graphDrawingVertexSet Γ_E v ⊆ subBd ClosedUnitDisc ↔ v ∈ S.Ω.bar) := by + intro v hv + rw [hvertex_eq v hv, singleton_subset_iff, subBd_closedUnitDisc_eq_unitCircle, + UnitCircle, mem_sphere_zero_iff_norm, LinearIsometryEquiv.norm_map, + ← mem_sphere_zero_iff_norm] + have hvU : ν v ∈ Γ.drawing.U := by + rw [← hν_eq ⟨v, hv⟩] + exact Γ.drawing.V_subset_U (Γ.iso.vertexEquiv ⟨v, hv⟩).2 + constructor + · intro hvS + have h_in : ν v ∈ ν '' S.Ω.bar := hU_sph ▸ ⟨hvU, hvS⟩ + obtain ⟨w, hw_bar, hw_eq⟩ := h_in + have heq : w = v := hν_inj (S.bar_subset hw_bar) hv hw_eq + exact heq ▸ hw_bar + · intro hv_bar + have h_in : ν v ∈ Γ.drawing.U ∩ Metric.sphere (0 : ℂ) 1 := + hU_sph.symm ▸ ⟨v, hv_bar, rfl⟩ + exact h_in.2 + refine ⟨Γ_E, ClosedUnitDisc, ∅, hdisc, empty_subset _, ?_, hbd_iff, ?_, + ⟨circleHomeomorphSubBdClosedUnitDisc, isClockwiseDiscHomeo_closedUnitDisc, ?_⟩, Or.inl ⟨rfl, + rfl⟩⟩ + · rw [interior_empty, sdiff_empty, hU_E] + rintro x ⟨z, hz, rfl⟩ + have hz_ball := hU_ball hz + rw [mem_closedBall_zero_iff] at hz_ball + change complexPlane z ∈ Metric.closedBall (0 : EuclideanPlane) 1 + rwa [mem_closedBall_zero_iff, LinearIsometryEquiv.norm_map] + · intro v hv + rw [hvertex_eq v hv, singleton_subset_iff] + simp [subBd, Ω₀] + · refine ⟨fun v hv_bar => (hbd_iff v (S.bar_subset hv_bar)).mpr hv_bar, ?_⟩ + intro v₁ v₂ v₃ hcw + refine exists_angles_of_isClockwise3 hL hθ (T := graphDrawingVertexSet Γ_E) + (f := fun t => (circleHomeomorphSubBdClosedUnitDisc (Circle.exp t)).1) + (fun t => by simp only [circle_exp_add_two_pi]) (fun v h_bar => ?_) hcw + rw [hvertex_eq _ (S.bar_subset h_bar), mem_singleton_iff, hν_bar _ h_bar] + rfl + +open Classical in +/-- **Graph Minors IX, (2.4)** (pages 45–46): +"Let $(G, \Omega)$ be a 3-connected society with no cross or tripod. Then $(G, \Omega)$ is rural." +-/ +theorem theorem_2_4_proof (S : Society α β) + (hconn : S.IsKConnected 3) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) + (hnotripod : ¬ ∃ T₁ T₂ T₃ : Graph α β, S.IsTripod T₁ T₂ T₃) : + S.IsRuralSociety := by + obtain ⟨S₀, hred⟩ := exists_isSimpleReduction S hconn hnocross hnotripod + rcases S.Ω.bar.eq_empty_or_nonempty with hbar_empty | ⟨w₀, hw₀⟩ + · have hbar₀_empty : S₀.Ω.bar = ∅ := by rw [hred.2.2.1, hbar_empty] + have hV₀_empty : V(S₀.G) = ∅ := by + by_contra hne + obtain ⟨v, hv⟩ := Set.nonempty_iff_ne_empty.mpr hne + let G₁ := S₀.G.induce ∅ + let G₂ := S₀.G + have hsep : IsGraphSeparation S₀.G G₁ G₂ := by + refine ⟨S₀.G.induce_le (empty_subset _), le_rfl, ?_, ?_, ?_⟩ + · simp [G₁, G₂] + · have hE₁ : E(G₁) = ∅ := by + ext e + simp only [G₁, edgeSet_induce, mem_ofPred_eq, mem_empty_iff_false, iff_false] + rintro ⟨x, _, _, hx, _⟩ + exact hx + rw [hE₁, empty_union] + · have hE₁ : E(G₁) = ∅ := by + ext e + simp only [G₁, edgeSet_induce, mem_ofPred_eq, mem_empty_iff_false, iff_false] + rintro ⟨x, _, _, hx, _⟩ + exact hx + rw [hE₁] + exact disjoint_bot_left + have hsep_S : S₀.IsKSeparation 0 G₂ G₁ := by + refine ⟨⟨IsGraphSeparation.symm hsep, ?_⟩, ?_, ?_⟩ + · rw [hbar₀_empty]; exact empty_subset _ + · simp [G₁, G₂] + · intro heq + have hv₁ : v ∈ V(G₁) := heq.symm ▸ hv + exact hv₁ + exact hred.2.2.2.1 0 (by omega) G₂ G₁ hsep_S + have hV_empty : V(S.G) = ∅ := hred.2.1.symm.trans hV₀_empty + have hE_empty : E(S.G) = ∅ := by + ext e + simp only [mem_empty_iff_false, iff_false] + intro he + obtain ⟨u, _, hlink⟩ := exists_isLink_of_mem_edgeSet he + have hu : u ∈ V(S.G) := hlink.left_mem + rw [hV_empty] at hu + exact hu + let Ω₀ : CyclicPerm α := { + bar := ∅ + toFun := id + finite_bar := finite_empty + bijOn := bijOn_empty id + single_orbit := fun _ hx => hx.elim + } + refine ⟨Ω₀, empty_subset _, rfl, ?_⟩ + have hinj₀ : InjOn (fun _ : α => (0 : EuclideanPlane)) V(S.G) := by + rw [hV_empty]; exact injOn_empty _ + obtain ⟨Γ, hU_eq, _⟩ := GraphDrawing.of_edgeless S.finite_V hE_empty hinj₀ + have hU_empty : Γ.drawing.U = ∅ := by rw [hU_eq, hV_empty, image_empty] + have hdisc : IsClosedDisc ClosedUnitDisc := ⟨Homeomorph.refl ClosedUnitDisc⟩ + refine ⟨Γ, ClosedUnitDisc, ∅, hdisc, empty_subset _, ?_, ?_, ?_, + ⟨circleHomeomorphSubBdClosedUnitDisc, isClockwiseDiscHomeo_closedUnitDisc, ?_⟩, Or.inl ⟨rfl, + rfl⟩⟩ + · rw [hU_empty]; exact empty_subset _ + · intro v hv; rw [hV_empty] at hv; exact hv.elim + · intro v hv; rw [hV_empty] at hv; exact hv.elim + · refine ⟨fun v hv => (hbar_empty ▸ hv).elim, fun v₁ _ _ hcw => ?_⟩ + have hv₁ : v₁ ∈ S.Ω.bar := (S.Ω.isClockwise3_iff.mp hcw).2.2.2.1 + rw [hbar_empty] at hv₁ + exact hv₁.elim + · obtain ⟨L, hL⟩ := S.Ω.exists_isOrbitList_of_mem hw₀ + obtain ⟨θ, hθ⟩ := hL.exists_isValidAngle + obtain ⟨ν, Γ, hν_inj, hν_bar, hU_ball, hU_sph, hν_eq⟩ := + exists_disc_drawing_of_isSimpleReduction E(S₀.G).ncard S₀ S hred rfl L hL θ hθ + exact isRuralSociety_of_complex_disc_drawing S hL hθ hν_inj hν_bar hU_ball hU_sph hν_eq + +/-- Dot-notation alias for `theorem_2_4_proof`. -/ +theorem Society.theorem_2_4_proof (S : Society α β) + (hconn : S.IsKConnected 3) + (hnocross : ¬ ∃ Q₁ Q₂ : Graph α β, S.IsCross Q₁ Q₂) + (hnotripod : ¬ ∃ T₁ T₂ T₃ : Graph α β, S.IsTripod T₁ T₂ T₃) : + S.IsRuralSociety := + GraphMinor.GM09.theorem_2_4_proof S hconn hnocross hnotripod + +end + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section3a.lean b/LeanPool/GraphMinor/GM09/Section3a.lean new file mode 100644 index 0000000000..21a2880d2e --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section3a.lean @@ -0,0 +1,1085 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2a +import LeanPool.GraphMinor.GM09.Section2d + +/-! +# Graph Minors IX, Section 3 (Part 1): Path Ends, Interval Calculus, (3.1), and (3.4) + +This file establishes: +- uniqueness of endpoints of paths (`IsGraphPathWithEnds.ends_eq`) and characterization of + `pathEnds` and `pathInternalVerts`, +- interval characterizations of `FirstHitIn`, `IsClockwise4`, `Crosses`, and `IsFence`, +- Graph Minors IX, (3.1) (`theorem_3_1`, page 47): any crooked transaction has at most one overpass, +- Graph Minors IX, (3.4) (`theorem_3_4`, page 48): any crooked transaction of cardinality `≥ p` + (with `p ≥ 2, p ≠ 3`) contains a crooked transaction of cardinality `p`. +-/ + +public section + +namespace GraphMinor.GM09 + +open Set Graph GraphMinor GraphMinor.Surface + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Uniqueness of endpoints of a path -/ + +theorem unique_inc_first {G : Graph α β} {a b : α} + {W : GraphWalk G a b} (hW : W.IsSimple) {e₁ e₂ : β} + (he₁ : e₁ ∈ W.edges) (he₂ : e₂ ∈ W.edges) + (hinc₁ : G.Inc e₁ a) (hinc₂ : G.Inc e₂ a) : e₁ = e₂ := by + cases W with + | nil _ => + simp [GraphWalk.edges] at he₁ + | @cons _ y _ e hxy W' => + have hnodup : (a :: W'.support).Nodup := hW + have hx_not_in : a ∉ W'.support := (List.nodup_cons.mp hnodup).1 + have hnot_tail : ∀ e' ∈ W'.edges, ¬ G.Inc e' a := by + intro e' he' ⟨w, hlink⟩ + exact hx_not_in (W'.left_mem_support_of_mem_edges he' hlink) + simp only [GraphWalk.edges, List.mem_cons] at he₁ he₂ + have h₁ : e₁ = e := he₁.resolve_right fun h => (hnot_tail e₁ h hinc₁).elim + have h₂ : e₂ = e := he₂.resolve_right fun h => (hnot_tail e₂ h hinc₂).elim + exact h₁.trans h₂.symm + +theorem IsGraphPathWithEnds.exists_inc_left_of_ne {G P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) (hab : a ≠ b) : + ∃ e ∈ E(P), P.Inc e a := by + rcases hP with ⟨_, W, _, _, hEP⟩ + cases W with + | nil _ => exact (hab rfl).elim + | @cons x y z e hxy W' => + refine ⟨e, ?_, y, hxy⟩ + rw [hEP, mem_ofPred_eq] + exact List.mem_cons_self + +theorem IsGraphPathWithEnds.left_eq_or_right_eq {G P : Graph α β} {a₁ b₁ a₂ b₂ : α} + (h₁ : IsGraphPathWithEnds G P a₁ b₁) (h₂ : IsGraphPathWithEnds G P a₂ b₂) : + a₂ = a₁ ∨ a₂ = b₁ := by + by_contra! hne + rcases hne with ⟨hne₁, hne₂⟩ + obtain ⟨Q₁, Q₂, hQ₁P, hQ₂P, hQ₁, hQ₂, _, _, hdisjE⟩ := h₁.exists_split_at h₂.left_mem + obtain ⟨e₁, he₁, hinc₁⟩ := hQ₁.symm.exists_inc_left_of_ne hne₁ + obtain ⟨e₂, he₂, hinc₂⟩ := hQ₂.exists_inc_left_of_ne hne₂ + have he₁P : e₁ ∈ E(P) := hQ₁P.edgeSet_mono he₁ + have he₂P : e₂ ∈ E(P) := hQ₂P.edgeSet_mono he₂ + have hinc₁P : P.Inc e₁ a₂ := hinc₁.mono hQ₁P + have hinc₂P : P.Inc e₂ a₂ := hinc₂.mono hQ₂P + rcases h₂ with ⟨_, W₂, hW₂, _, hEP₂⟩ + rw [hEP₂, mem_ofPred_eq] at he₁P he₂P + have heq : e₁ = e₂ := unique_inc_first hW₂ he₁P he₂P hinc₁P hinc₂P + exact disjoint_left.mp hdisjE he₁ (heq ▸ he₂) + +theorem IsGraphPathWithEnds.ends_eq {G P : Graph α β} {a₁ b₁ a₂ b₂ : α} + (h₁ : IsGraphPathWithEnds G P a₁ b₁) (h₂ : IsGraphPathWithEnds G P a₂ b₂) : + (a₂ = a₁ ∧ b₂ = b₁) ∨ (a₂ = b₁ ∧ b₂ = a₁) := by + have ha₂ := h₁.left_eq_or_right_eq h₂ + have hb₂ := h₁.left_eq_or_right_eq h₂.symm + have ha₁ := h₂.left_eq_or_right_eq h₁ + have hb₁ := h₂.left_eq_or_right_eq h₁.symm + rcases ha₂ with rfl | rfl + · rcases hb₂ with rfl | rfl + · rcases hb₁ with h | h + · exact Or.inl ⟨rfl, h.symm⟩ + · exact Or.inl ⟨rfl, h.symm⟩ + · exact Or.inl ⟨rfl, rfl⟩ + · rcases hb₂ with rfl | rfl + · exact Or.inr ⟨rfl, rfl⟩ + · rcases ha₁ with h | h + · exact Or.inr ⟨rfl, h.symm⟩ + · exact Or.inr ⟨rfl, h.symm⟩ + +theorem IsGraphPathWithEnds.pair_ends_eq {G P : Graph α β} {a₁ b₁ a₂ b₂ : α} + (h₁ : IsGraphPathWithEnds G P a₁ b₁) (h₂ : IsGraphPathWithEnds G P a₂ b₂) : + ({a₁, b₁} : Set α) = {a₂, b₂} := by + rcases h₁.ends_eq h₂ with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · exact pair_comm _ _ + +theorem IsGraphPathWithEnds.pathEnds_eq {G P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) : pathEnds G P = {a, b} := by + ext v + simp only [pathEnds, mem_ofPred_eq, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨b', hv⟩ + exact hP.left_eq_or_right_eq hv + · rintro (rfl | rfl) + · exact ⟨b, hP⟩ + · exact ⟨a, hP.symm⟩ + +theorem IsGraphPathWithEnds.pathInternalVerts_eq {G P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) : pathInternalVerts G P = V(P) \ {a, b} := by + rw [pathInternalVerts, hP.pathEnds_eq] + +namespace Society + +theorem IsOmegaPathWithEnds.symm (S : Society α β) {P : Graph α β} {a b : α} + (hP : S.IsOmegaPathWithEnds P a b) : S.IsOmegaPathWithEnds P b a := + ⟨hP.1.symm, hP.2.1.symm, hP.2.2.2, hP.2.2.1⟩ + +theorem IsOmegaPathWithEnds.ends_eq (S : Society α β) {P : Graph α β} {a₁ b₁ a₂ b₂ : α} + (h₁ : S.IsOmegaPathWithEnds P a₁ b₁) (h₂ : S.IsOmegaPathWithEnds P a₂ b₂) : + (a₂ = a₁ ∧ b₂ = b₁) ∨ (a₂ = b₁ ∧ b₂ = a₁) := + h₁.1.ends_eq h₂.1 + +theorem IsOmegaPathWithEnds.ends_eq_of_mem_disjoint (S : Society α β) + {P : Graph α β} {A B : Set α} (hAB : Disjoint A B) + {a₁ b₁ a₂ b₂ : α} (_ha₁ : a₁ ∈ A) (hb₁ : b₁ ∈ B) (ha₂ : a₂ ∈ A) + (h₁ : S.IsOmegaPathWithEnds P a₁ b₁) (h₂ : S.IsOmegaPathWithEnds P a₂ b₂) : + a₂ = a₁ ∧ b₂ = b₁ := by + rcases h₁.ends_eq S h₂ with h | ⟨rfl, _⟩ + · exact h + · exact (disjoint_left.mp hAB ha₂ hb₁).elim + +theorem IsOmegaPathWithEnds.mem_transactionEnds_left (S : Society α β) + {P_set : Set (Graph α β)} {P : Graph α β} {a b : α} + (hP_in : P ∈ P_set) (hP : S.IsOmegaPathWithEnds P a b) : + a ∈ S.transactionEnds P_set := + ⟨P, hP_in, b, hP⟩ + +theorem IsOmegaPathWithEnds.mem_transactionEnds_right (S : Society α β) + {P_set : Set (Graph α β)} {P : Graph α β} {a b : α} + (hP_in : P ∈ P_set) (hP : S.IsOmegaPathWithEnds P a b) : + b ∈ S.transactionEnds P_set := + ⟨P, hP_in, a, hP.symm S⟩ + +theorem IsOmegaPathWithEnds.isPeripheralIn_iff (S : Society α β) + {P_set : Set (Graph α β)} {P : Graph α β} {a b : α} + (hP_in : P ∈ P_set) (hP : S.IsOmegaPathWithEnds P a b) : + S.IsPeripheralIn P_set P ↔ + Disjoint (S.Ω.interval a b) (S.transactionEnds P_set) ∨ + Disjoint (S.Ω.interval b a) (S.transactionEnds P_set) := by + constructor + · rintro ⟨_, a', b', hP', hdisj⟩ + rcases hP.ends_eq S hP' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hdisj + · exact hdisj.symm + · intro hdisj + exact ⟨hP_in, a, b, hP, hdisj⟩ + +theorem transactionEnds_subset_bar (S : Society α β) (P_set : Set (Graph α β)) : + S.transactionEnds P_set ⊆ S.Ω.bar := by + rintro v ⟨P, _, b, hP⟩ + exact hP.2.2.1 + +theorem transactionEnds_insert (S : Society α β) (P_set : Set (Graph α β)) + {P : Graph α β} {a b : α} (hP : S.IsOmegaPathWithEnds P a b) : + S.transactionEnds (P_set ∪ {P}) = S.transactionEnds P_set ∪ {a, b} := by + ext v + simp only [transactionEnds, mem_union, mem_singleton_iff, mem_ofPred_eq, mem_insert_iff] + constructor + · rintro ⟨Q, hQ | rfl, c, hQc⟩ + · exact Or.inl ⟨Q, hQ, c, hQc⟩ + · exact Or.inr (hP.1.left_eq_or_right_eq hQc.1) + · rintro (⟨Q, hQ, c, hQc⟩ | rfl | rfl) + · exact ⟨Q, Or.inl hQ, c, hQc⟩ + · exact ⟨P, Or.inr rfl, b, hP⟩ + · exact ⟨P, Or.inr rfl, a, hP.symm S⟩ + +theorem transactionEnds_diff_singleton (S : Society α β) {P_set : Set (Graph α β)} + (hdisj : S.IsDisjointOmegaPathSet P_set) {P : Graph α β} {a b : α} + (hP_in : P ∈ P_set) (hP : S.IsOmegaPathWithEnds P a b) : + S.transactionEnds (P_set \ {P}) = S.transactionEnds P_set \ {a, b} := by + ext v + simp only [transactionEnds, mem_ofPred_eq, mem_sdiff, mem_singleton_iff, mem_insert_iff, not_or] + constructor + · rintro ⟨Q, ⟨hQ_in, hQP⟩, c, hQc⟩ + have hvQ : v ∈ V(Q) := hQc.1.left_mem + have hdisj_QP : Disjoint V(Q) V(P) := hdisj.2 hQ_in hP_in hQP + refine ⟨⟨Q, hQ_in, c, hQc⟩, ?_, ?_⟩ + · intro rfl; exact disjoint_left.mp hdisj_QP hvQ hP.1.left_mem + · intro rfl; exact disjoint_left.mp hdisj_QP hvQ hP.1.right_mem + · rintro ⟨⟨Q, hQ_in, c, hQc⟩, hva, hvb⟩ + refine ⟨Q, ⟨hQ_in, ?_⟩, c, hQc⟩ + rintro rfl + rcases hP.1.left_eq_or_right_eq hQc.1 with rfl | rfl + · exact hva rfl + · exact hvb rfl + +end Society + +/-! ## Interval characterizations of `IsClockwise3`, `FirstHitIn`, `IsClockwise4`, `Crosses`, and +`IsFence` -/ + +namespace CyclicPerm + +variable (Ω : CyclicPerm α) + +theorem isClockwise3_iff_firstHitIn {v₁ v₂ v₃ : α} + (hv₁ : v₁ ∈ Ω.bar) (hv₂ : v₂ ∈ Ω.bar) (hv₃ : v₃ ∈ Ω.bar) + (h12 : v₁ ≠ v₂) (h13 : v₁ ≠ v₃) (h23 : v₂ ≠ v₃) : + Ω.IsClockwise3 v₁ v₂ v₃ ↔ Ω.FirstHitIn {v₁, v₂, v₃} v₁ v₂ := by + constructor + · intro h + exact (Ω.isClockwise3_iff.mp h).2.2.2.2.2.2.1 + · intro hhit + rcases Ω.isClockwise3_trichotomy hv₁ hv₂ hv₃ h12 h13 h23 with ⟨h, _⟩ | ⟨h, _⟩ + · exact h + · have hhit' := (Ω.isClockwise3_iff.mp h).2.2.2.2.2.2.1 + have hset : ({v₁, v₃, v₂} : Set α) = {v₁, v₂, v₃} := by ext x; simp [or_comm] + rw [hset] at hhit' + exact (h23 (hhit.unique hhit')).elim + +theorem mem_interval_iff_firstHitIn {v₁ v₂ v : α} + (hv₁ : v₁ ∈ Ω.bar) (hv₂ : v₂ ∈ Ω.bar) (hv : v ∈ Ω.bar) + (h12 : v₁ ≠ v₂) (hv1 : v ≠ v₁) (hv2 : v ≠ v₂) : + v ∈ Ω.interval v₁ v₂ ↔ Ω.FirstHitIn {v₁, v, v₂} v₁ v := by + rw [interval, mem_sep_iff, Ω.isClockwise3_iff_firstHitIn hv₁ hv hv₂ hv1.symm h12 hv2] + exact ⟨fun h => h.2, fun h => ⟨⟨hv, by simp [hv1, hv2]⟩, h⟩⟩ + +theorem firstHitIn_iff_disjoint_interval {W : Set α} (hW : W ⊆ Ω.bar) + {x y : α} (hx : x ∈ W) (hy : y ∈ W) (hxy : x ≠ y) : + Ω.FirstHitIn W x y ↔ Disjoint (Ω.interval x y) W := by + have hx_bar : x ∈ Ω.bar := hW hx + have hy_bar : y ∈ Ω.bar := hW hy + constructor + · rintro ⟨k, hk1, rfl, _, hmin⟩ + rw [disjoint_left] + intro z hz hzW + have hzx : z ≠ x := fun h => hz.1.2 (by simp [h]) + have hzy : z ≠ (Ω.toFun^[k]) x := fun h => hz.1.2 (by simp [h]) + have hhit_z : Ω.FirstHitIn {x, z, (Ω.toFun^[k]) x} x z := + (Ω.mem_interval_iff_firstHitIn hx_bar hy_bar hz.1.1 hxy hzx hzy).mp hz + rcases hhit_z with ⟨j, hj1, rfl, _, hmin_z⟩ + rcases lt_trichotomy j k with hlt | rfl | hgt + · exact hmin j hj1 hlt hzW + · exact hzy rfl + · exact hmin_z k hk1 hgt (by simp) + · intro hdisj + have hne : (Ω.bar ∩ W).Nonempty := ⟨x, hx_bar, hx⟩ + obtain ⟨z, hhit⟩ := Ω.exists_firstHitIn hx_bar hne + have hzW : z ∈ W := hhit.mem_set + have hzx : z ≠ x := fun h => Ω.not_firstHitIn_self hx_bar hy_bar hy hxy.symm (h ▸ hhit) + by_cases hzy : z = y + · exact hzy ▸ hhit + · exfalso + rcases hhit with ⟨j, hj1, rfl, _, hmin⟩ + have hhit3 : Ω.FirstHitIn {x, (Ω.toFun^[j]) x, y} x ((Ω.toFun^[j]) x) := by + refine ⟨j, hj1, rfl, by simp, fun i hi1 hij hi_in => ?_⟩ + refine hmin i hi1 hij ?_ + simp only [mem_insert_iff, mem_singleton_iff] at hi_in + rcases hi_in with heq | heq | heq + · rw [heq]; exact hx + · rw [heq]; exact hzW + · rw [heq]; exact hy + have hz_int : (Ω.toFun^[j]) x ∈ Ω.interval x y := + (Ω.mem_interval_iff_firstHitIn hx_bar hy_bar (hW hzW) hxy hzx hzy).mpr hhit3 + exact disjoint_left.mp hdisj hz_int hzW + +theorem isClockwise4_iff_interval {v₁ v₂ v₃ v₄ : α} : + Ω.IsClockwise4 v₁ v₂ v₃ v₄ ↔ v₂ ∈ Ω.interval v₁ v₃ ∧ v₄ ∈ Ω.interval v₃ v₁ := by + constructor + · intro h + obtain ⟨h12, h13, h14, h23, h24, h34, hv₁, hv₂, hv₃, hv₄, hhit0, _, hhit2, _⟩ := + Ω.isClockwise4_iff.mp h + have h2_int : v₂ ∈ Ω.interval v₁ v₃ := by + rw [Ω.mem_interval_iff_firstHitIn hv₁ hv₃ hv₂ h13 h12.symm h23] + rcases hhit0 with ⟨k, hk1, rfl, _, hmin⟩ + refine ⟨k, hk1, rfl, by simp, fun j hj1 hjk hj_in => hmin j hj1 hjk ?_⟩ + simp only [mem_insert_iff, mem_singleton_iff] at hj_in ⊢ + rcases hj_in with h | h | h + · exact Or.inl h + · exact Or.inr (Or.inl h) + · exact Or.inr (Or.inr (Or.inl h)) + have h4_int : v₄ ∈ Ω.interval v₃ v₁ := by + rw [Ω.mem_interval_iff_firstHitIn hv₃ hv₁ hv₄ h13.symm h34.symm h14.symm] + rcases hhit2 with ⟨k, hk1, rfl, _, hmin⟩ + refine ⟨k, hk1, rfl, by simp, fun j hj1 hjk hj_in => hmin j hj1 hjk ?_⟩ + simp only [mem_insert_iff, mem_singleton_iff] at hj_in ⊢ + rcases hj_in with h | h | h + · exact Or.inr (Or.inr (Or.inl h)) + · exact Or.inr (Or.inr (Or.inr h)) + · exact Or.inl h + exact ⟨h2_int, h4_int⟩ + · rintro ⟨hv₂_int, hv₄_int⟩ + have hv₁ : v₁ ∈ Ω.bar := (Ω.isClockwise3_iff.mp hv₂_int.2).2.2.2.1 + have hv₂ : v₂ ∈ Ω.bar := hv₂_int.1.1 + have hv₃ : v₃ ∈ Ω.bar := (Ω.isClockwise3_iff.mp hv₂_int.2).2.2.2.2.2.1 + have hv₄ : v₄ ∈ Ω.bar := hv₄_int.1.1 + have h12 : v₁ ≠ v₂ := fun h => hv₂_int.1.2 (by simp [h]) + have h13 : v₁ ≠ v₃ := (Ω.isClockwise3_iff.mp hv₂_int.2).2.1 + have h23 : v₂ ≠ v₃ := fun h => hv₂_int.1.2 (by simp [h]) + have h34 : v₃ ≠ v₄ := fun h => hv₄_int.1.2 (by simp [h]) + have h14 : v₁ ≠ v₄ := fun h => hv₄_int.1.2 (by simp [h]) + have h24 : v₂ ≠ v₄ := fun h => + disjoint_left.mp (Ω.disjoint_interval_swap v₁ v₃) hv₂_int (h ▸ hv₄_int) + have hSub : ({v₁, v₂, v₃, v₄} : Set α) ⊆ Ω.bar := by + rintro x (rfl | rfl | rfl | rfl) <;> assumption + have hhit_12_3 : Ω.FirstHitIn {v₁, v₂, v₃} v₁ v₂ := + (Ω.isClockwise3_iff.mp hv₂_int.2).2.2.2.2.2.2.1 + have hhit_23_1 : Ω.FirstHitIn {v₂, v₃, v₁} v₂ v₃ := by + have hset : ({v₂, v₃, v₁} : Set α) = {v₁, v₂, v₃} := by ext x; simp [or_comm, or_left_comm] + rw [hset] + exact (Ω.isClockwise3_iff.mp hv₂_int.2).2.2.2.2.2.2.2.1 + have hhit_34_1 : Ω.FirstHitIn {v₃, v₄, v₁} v₃ v₄ := + (Ω.isClockwise3_iff.mp hv₄_int.2).2.2.2.2.2.2.1 + have hhit_41_3 : Ω.FirstHitIn {v₄, v₁, v₃} v₄ v₁ := by + have hset : ({v₄, v₁, v₃} : Set α) = {v₃, v₄, v₁} := by ext x; simp [or_comm, or_left_comm] + rw [hset] + exact (Ω.isClockwise3_iff.mp hv₄_int.2).2.2.2.2.2.2.2.1 + -- For any `a, b, c` with `FirstHitIn {a, b, c} a b`, the first hit from `a` in `{a, b, c, d}` + -- cannot be `c`. + have hnot_third : ∀ {a b c : α} {S : Set α}, + ({a, b, c} : Set α) ⊆ S → b ≠ c → + Ω.FirstHitIn {a, b, c} a b → ¬ Ω.FirstHitIn S a c := by + intro a b c S hsub hbc ⟨k₁, hk₁, heq₁, _, hmin₁⟩ ⟨k₂, hk₂, heq₂, _, hmin₂⟩ + rcases lt_trichotomy k₁ k₂ with hlt | rfl | hgt + · exact hmin₂ k₁ hk₁ hlt (hsub (by simp [heq₁])) + · exact hbc (heq₁.symm.trans heq₂) + · exact hmin₁ k₂ hk₂ hgt (by simp [heq₂]) + have h1_not_3 : ¬ Ω.FirstHitIn {v₁, v₂, v₃, v₄} v₁ v₃ := + hnot_third (by intro x hx; simp only [mem_insert_iff, mem_singleton_iff] at hx ⊢; tauto) + h23 hhit_12_3 + have h2_not_1 : ¬ Ω.FirstHitIn {v₁, v₂, v₃, v₄} v₂ v₁ := + hnot_third (by intro x hx; simp only [mem_insert_iff, mem_singleton_iff] at hx ⊢; tauto) + h13.symm hhit_23_1 + have h3_not_1 : ¬ Ω.FirstHitIn {v₁, v₂, v₃, v₄} v₃ v₁ := + hnot_third (by intro x hx; simp only [mem_insert_iff, mem_singleton_iff] at hx ⊢; tauto) + h14.symm hhit_34_1 + have h4_not_3 : ¬ Ω.FirstHitIn {v₁, v₂, v₃, v₄} v₄ v₃ := + hnot_third (by intro x hx; simp only [mem_insert_iff, mem_singleton_iff] at hx ⊢; tauto) + h13 hhit_41_3 + -- Also `v₁ ∈ Ω.interval v₄ v₃`, so `FirstHitIn {v₄, v₁, v₃} v₁ v₃`, meaning `v₁` hits `v₃` + -- before `v₄`. + have hhit_13_4 : Ω.FirstHitIn {v₁, v₃, v₄} v₁ v₃ := by + have hset : ({v₁, v₃, v₄} : Set α) = {v₃, v₄, v₁} := by ext x; simp [or_comm, or_left_comm] + rw [hset] + exact (Ω.isClockwise3_iff.mp hv₄_int.2).2.2.2.2.2.2.2.2 + have h1_not_4 : ¬ Ω.FirstHitIn {v₁, v₂, v₃, v₄} v₁ v₄ := + hnot_third (by intro x hx; simp only [mem_insert_iff, mem_singleton_iff] at hx ⊢; tauto) + h34 hhit_13_4 + have hhit_31_2 : Ω.FirstHitIn {v₃, v₁, v₂} v₃ v₁ := by + have hset : ({v₃, v₁, v₂} : Set α) = {v₁, v₂, v₃} := by ext x; simp [or_comm, or_left_comm] + rw [hset] + exact (Ω.isClockwise3_iff.mp hv₂_int.2).2.2.2.2.2.2.2.2 + have h3_not_2 : ¬ Ω.FirstHitIn {v₁, v₂, v₃, v₄} v₃ v₂ := + hnot_third (by intro x hx; simp only [mem_insert_iff, mem_singleton_iff] at hx ⊢; tauto) + h12 hhit_31_2 + have hne4 : (Ω.bar ∩ ({v₁, v₂, v₃, v₄} : Set α)).Nonempty := ⟨v₁, hv₁, by simp⟩ + obtain ⟨y₁, hy₁⟩ := Ω.exists_firstHitIn hv₁ hne4 + obtain ⟨y₂, hy₂⟩ := Ω.exists_firstHitIn hv₂ hne4 + obtain ⟨y₃, hy₃⟩ := Ω.exists_firstHitIn hv₃ hne4 + obtain ⟨y₄, hy₄⟩ := Ω.exists_firstHitIn hv₄ hne4 + have hy₁_ne : y₁ ≠ v₁ := fun h => Ω.not_firstHitIn_self hv₁ hv₂ (by simp) h12.symm (h ▸ hy₁) + have hy₂_ne : y₂ ≠ v₂ := fun h => Ω.not_firstHitIn_self hv₂ hv₃ (by simp) h23.symm (h ▸ hy₂) + have hy₃_ne : y₃ ≠ v₃ := fun h => Ω.not_firstHitIn_self hv₃ hv₄ (by simp) h34.symm (h ▸ hy₃) + have hy₄_ne : y₄ ≠ v₄ := fun h => Ω.not_firstHitIn_self hv₄ hv₁ (by simp) h14 (h ▸ hy₄) + have hy₁_eq : y₁ = v₂ := by + rcases hy₁.mem_set with rfl | rfl | rfl | rfl + · exact (hy₁_ne rfl).elim + · rfl + · exact (h1_not_3 hy₁).elim + · exact (h1_not_4 hy₁).elim + rw [hy₁_eq] at hy₁ + have hy₃_eq : y₃ = v₄ := by + rcases hy₃.mem_set with rfl | rfl | rfl | rfl + · exact (h3_not_1 hy₃).elim + · exact (h3_not_2 hy₃).elim + · exact (hy₃_ne rfl).elim + · rfl + rw [hy₃_eq] at hy₃ + have hy₂_eq : y₂ = v₃ := by + rcases hy₂.mem_set with rfl | rfl | rfl | rfl + · exact (h2_not_1 hy₂).elim + · exact (hy₂_ne rfl).elim + · rfl + · exact (h23 (hy₂.inj_left hv₂ hv₃ (by simp) (by simp) hy₃)).elim + rw [hy₂_eq] at hy₂ + have hy₄_eq : y₄ = v₁ := by + rcases hy₄.mem_set with rfl | rfl | rfl | rfl + · rfl + · exact (h14 (hy₁.inj_left hv₁ hv₄ (by simp) (by simp) hy₄)).elim + · exact (h4_not_3 hy₄).elim + · exact (hy₄_ne rfl).elim + rw [hy₄_eq] at hy₄ + exact Ω.isClockwise4_iff.mpr + ⟨h12, h13, h14, h23, h24, h34, hv₁, hv₂, hv₃, hv₄, hy₁, hy₂, hy₃, hy₄⟩ + +theorem crosses_iff_interval {a₁ b₁ a₂ b₂ : α} : + Ω.Crosses a₁ b₁ a₂ b₂ ↔ + (a₂ ∈ Ω.interval a₁ b₁ ∧ b₂ ∈ Ω.interval b₁ a₁) ∨ + (b₂ ∈ Ω.interval a₁ b₁ ∧ a₂ ∈ Ω.interval b₁ a₁) := by + change (Ω.IsClockwise4 a₁ a₂ b₁ b₂ ∨ Ω.IsClockwise4 b₂ b₁ a₂ a₁) ↔ _ + have hrot : Ω.IsClockwise4 b₂ b₁ a₂ a₁ ↔ Ω.IsClockwise4 a₁ b₂ b₁ a₂ := + ⟨fun h => Ω.isClockwise4_rotate (Ω.isClockwise4_rotate (Ω.isClockwise4_rotate h)), + fun h => Ω.isClockwise4_rotate h⟩ + rw [hrot, Ω.isClockwise4_iff_interval, Ω.isClockwise4_iff_interval] + +theorem Crosses.symm {a₁ b₁ a₂ b₂ : α} (h : Ω.Crosses a₁ b₁ a₂ b₂) : + Ω.Crosses a₂ b₂ a₁ b₁ := by + rcases h with h | h + · exact Or.inr (Ω.isClockwise4_rotate (Ω.isClockwise4_rotate h)) + · exact Or.inl (Ω.isClockwise4_rotate (Ω.isClockwise4_rotate h)) + +theorem Crosses.swap_left {a₁ b₁ a₂ b₂ : α} (h : Ω.Crosses a₁ b₁ a₂ b₂) : + Ω.Crosses b₁ a₁ a₂ b₂ := by + rw [Ω.crosses_iff_interval] at h ⊢ + exact h.elim (fun ⟨h1, h2⟩ => Or.inr ⟨h2, h1⟩) (fun ⟨h1, h2⟩ => Or.inl ⟨h2, h1⟩) + +theorem Crosses.swap_right {a₁ b₁ a₂ b₂ : α} (h : Ω.Crosses a₁ b₁ a₂ b₂) : + Ω.Crosses a₁ b₁ b₂ a₂ := + (h.symm.swap_left).symm + +theorem mem_interval_rotate_left {x y z : α} (h : y ∈ Ω.interval x z) : + z ∈ Ω.interval y x := by + refine ⟨⟨(Ω.isClockwise3_iff.mp h.2).2.2.2.2.2.1, ?_⟩, Ω.isClockwise3_rotate h.2⟩ + simp only [mem_insert_iff, mem_singleton_iff, not_or] + exact ⟨(Ω.isClockwise3_iff.mp h.2).2.2.1.symm, (Ω.isClockwise3_iff.mp h.2).2.1.symm⟩ + +theorem mem_interval_rotate_right {x y z : α} (h : y ∈ Ω.interval x z) : + x ∈ Ω.interval z y := + Ω.mem_interval_rotate_left (Ω.mem_interval_rotate_left h) + +theorem interval_subset_interval_left {x y z : α} (hy : y ∈ Ω.interval x z) : + Ω.interval x y ⊆ Ω.interval x z := by + intro w hw + have hz_yx : z ∈ Ω.interval y x := Ω.mem_interval_rotate_left hy + have hcw4 : Ω.IsClockwise4 x w y z := Ω.isClockwise4_iff_interval.mpr ⟨hw, hz_yx⟩ + have hcw4' : Ω.IsClockwise4 w y z x := Ω.isClockwise4_rotate hcw4 + exact Ω.mem_interval_rotate_left (Ω.isClockwise4_iff_interval.mp hcw4').2 + +theorem interval_subset_interval_right {x y z : α} (hy : y ∈ Ω.interval x z) : + Ω.interval y z ⊆ Ω.interval x z := by + intro w hw + have hx_zy : x ∈ Ω.interval z y := Ω.mem_interval_rotate_right hy + have hcw4 : Ω.IsClockwise4 y w z x := Ω.isClockwise4_iff_interval.mpr ⟨hw, hx_zy⟩ + have hcw4' : Ω.IsClockwise4 w z x y := Ω.isClockwise4_rotate hcw4 + exact Ω.mem_interval_rotate_right (Ω.isClockwise4_iff_interval.mp hcw4').1 + +theorem mem_interval_right_of_mem_interval_left {x y z w : α} + (hy : y ∈ Ω.interval x z) (hw : w ∈ Ω.interval x y) : + y ∈ Ω.interval w z := by + have hz_yx : z ∈ Ω.interval y x := Ω.mem_interval_rotate_left hy + have hcw4 : Ω.IsClockwise4 x w y z := Ω.isClockwise4_iff_interval.mpr ⟨hw, hz_yx⟩ + exact (Ω.isClockwise4_iff_interval.mp (Ω.isClockwise4_rotate hcw4)).1 + +theorem mem_interval_left_of_mem_interval_right {x y z w : α} + (hy : y ∈ Ω.interval x z) (hw : w ∈ Ω.interval y z) : + y ∈ Ω.interval x w := by + have hx_zy : x ∈ Ω.interval z y := Ω.mem_interval_rotate_right hy + have hcw4 : Ω.IsClockwise4 y w z x := Ω.isClockwise4_iff_interval.mpr ⟨hw, hx_zy⟩ + exact (Ω.isClockwise4_iff_interval.mp (Ω.isClockwise4_rotate (Ω.isClockwise4_rotate + (Ω.isClockwise4_rotate hcw4)))).1 + +theorem interval_eq_union_of_mem {x y z : α} (hy : y ∈ Ω.interval x z) : + Ω.interval x z = Ω.interval x y ∪ {y} ∪ Ω.interval y z := by + ext w + simp only [mem_union, mem_singleton_iff] + constructor + · intro hw + by_cases hwy : w = y + · exact Or.inl (Or.inr hwy) + · have hx_bar : x ∈ Ω.bar := (Ω.isClockwise3_iff.mp hy.2).2.2.2.1 + have hy_bar : y ∈ Ω.bar := hy.1.1 + have hxy : x ≠ y := fun h => hy.1.2 (by simp [h]) + have hwx : w ≠ x := fun h => hw.1.2 (by simp [h]) + rcases Ω.mem_interval_or_interval_swap hx_bar hy_bar hw.1.1 hxy hwx hwy with hw_xy | hw_yx + · exact Or.inl (Or.inl hw_xy) + · exact Or.inr (Ω.mem_interval_right_of_mem_interval_left hw (Ω.mem_interval_rotate_right + hw_yx)) + · rintro ((hw | rfl) | hw) + · exact Ω.interval_subset_interval_left hy hw + · exact hy + · exact Ω.interval_subset_interval_right hy hw + +theorem disjoint_interval_of_not_mem {x₁ y₁ x₂ y₂ : α} + (hx₁ : x₁ ∈ Ω.bar) (hx₂ : x₂ ∈ Ω.bar) (hx12 : x₁ ≠ x₂) + (h₁ : x₁ ∉ Ω.interval x₂ y₂) (h₂ : x₂ ∉ Ω.interval x₁ y₁) : + Disjoint (Ω.interval x₁ y₁) (Ω.interval x₂ y₂) := by + rw [disjoint_left] + intro z hz₁ hz₂ + have hz_bar : z ∈ Ω.bar := hz₁.1.1 + have hzx₁ : z ≠ x₁ := fun h => hz₁.1.2 (by simp [h]) + have hzx₂ : z ≠ x₂ := fun h => hz₂.1.2 (by simp [h]) + have hx₂_not_x₁z : x₂ ∉ Ω.interval x₁ z := + fun h => h₂ (Ω.interval_subset_interval_left hz₁ h) + have hx₂_zx₁ : x₂ ∈ Ω.interval z x₁ := + (Ω.mem_interval_or_interval_swap hx₁ hz_bar hx₂ hzx₁.symm hx12.symm hzx₂.symm).resolve_left + hx₂_not_x₁z + have hx₁_x₂z : x₁ ∈ Ω.interval x₂ z := Ω.mem_interval_rotate_left hx₂_zx₁ + exact h₁ (Ω.interval_subset_interval_left hz₂ hx₁_x₂z) + +theorem isFence_interval_compl {x y : α} (hx : x ∈ Ω.bar) (hy : y ∈ Ω.bar) (hxy : x ≠ y) : + Ω.IsFence ({x, y} ∪ Ω.interval x y) (Ω.interval y x) := by + have hsubA : {x, y} ∪ Ω.interval x y ⊆ Ω.bar := by + rintro z ((rfl | rfl) | hz) + · exact hx + · exact hy + · exact hz.1.1 + have hsubB : Ω.interval y x ⊆ Ω.bar := Ω.interval_subset_bar y x + have hdisj : Disjoint ({x, y} ∪ Ω.interval x y) (Ω.interval y x) := by + rw [disjoint_union_left] + refine ⟨disjoint_left.mpr ?_, Ω.disjoint_interval_swap x y⟩ + rintro z (rfl | rfl) hz + · exact Ω.not_mem_interval_right y z hz + · exact Ω.not_mem_interval_left z x hz + have hunion : ({x, y} ∪ Ω.interval x y) ∪ Ω.interval y x = Ω.bar := by + rw [union_assoc, Ω.interval_union_interval_swap hx hy hxy, union_sdiff_cancel] + rintro z (rfl | rfl) <;> assumption + refine ⟨hsubA, hsubB, hdisj, hunion, fun a₁ ha₁ a₂ ha₂ _ b₁ hb₁ b₂ hb₂ hb12 hcross => ?_⟩ + have hcross' : Ω.Crosses b₁ b₂ a₁ a₂ := hcross.symm + rw [Ω.crosses_iff_interval] at hcross' + have hb₁_bar : b₁ ∈ Ω.bar := hb₁.1.1 + have hb₂_bar : b₂ ∈ Ω.bar := hb₂.1.1 + have hby₁ : y ≠ b₁ := fun h => hb₁.1.2 (by simp [h.symm]) + have hby₂ : y ≠ b₂ := fun h => hb₂.1.2 (by simp [h.symm]) + rcases Ω.mem_interval_or_interval_swap hy hb₂_bar hb₁_bar hby₂ hby₁.symm hb12 with hb₁_yb₂ | + hb₁_b₂y + · have hb₂_b₁x : b₂ ∈ Ω.interval b₁ x := Ω.mem_interval_right_of_mem_interval_left hb₂ hb₁_yb₂ + have hsub : Ω.interval b₁ b₂ ⊆ Ω.interval y x := + (Ω.interval_subset_interval_left hb₂_b₁x).trans (Ω.interval_subset_interval_right hb₁) + rcases hcross' with ⟨ha₁_in, _⟩ | ⟨ha₂_in, _⟩ + · exact disjoint_left.mp hdisj ha₁ (hsub ha₁_in) + · exact disjoint_left.mp hdisj ha₂ (hsub ha₂_in) + · have hb₂_yb₁ : b₂ ∈ Ω.interval y b₁ := Ω.mem_interval_rotate_right hb₁_b₂y + have hb₁_b₂x : b₁ ∈ Ω.interval b₂ x := Ω.mem_interval_right_of_mem_interval_left hb₁ hb₂_yb₁ + have hsub : Ω.interval b₂ b₁ ⊆ Ω.interval y x := + (Ω.interval_subset_interval_left hb₁_b₂x).trans (Ω.interval_subset_interval_right hb₂) + rcases hcross' with ⟨_, ha₂_in⟩ | ⟨_, ha₁_in⟩ + · exact disjoint_left.mp hdisj ha₂ (hsub ha₂_in) + · exact disjoint_left.mp hdisj ha₁ (hsub ha₁_in) + +theorem IsFence.symm {A B : Set α} (h : Ω.IsFence A B) : Ω.IsFence B A := + ⟨h.2.1, h.1, h.2.2.1.symm, union_comm B A ▸ h.2.2.2.1, + fun b₁ hb₁ b₂ hb₂ hb12 a₁ ha₁ a₂ ha₂ ha12 hc => + h.2.2.2.2 a₁ ha₁ a₂ ha₂ ha12 b₁ hb₁ b₂ hb₂ hb12 hc.symm⟩ + +theorem unique_empty_interval_AB_of_isFence {A B W : Set α} + (hfence : Ω.IsFence A B) (hW : W ⊆ Ω.bar) + {a₁ a₂ b₁ b₂ : α} (ha₁ : a₁ ∈ A ∩ W) (hb₁ : b₁ ∈ B ∩ W) + (ha₂ : a₂ ∈ A ∩ W) (hb₂ : b₂ ∈ B ∩ W) + (hdisj₁ : Disjoint (Ω.interval a₁ b₁) W) + (hdisj₂ : Disjoint (Ω.interval a₂ b₂) W) : + a₁ = a₂ ∧ b₁ = b₂ := by + have ha_eq : a₁ = a₂ := by + by_contra ha_ne + have ha₂_not : a₂ ∉ Ω.interval a₁ b₁ := disjoint_right.mp hdisj₁ ha₂.2 + have ha₁_not : a₁ ∉ Ω.interval a₂ b₂ := disjoint_right.mp hdisj₂ ha₁.2 + have hab₁ : a₁ ≠ b₁ := fun h => disjoint_left.mp hfence.2.2.1 ha₁.1 (h ▸ hb₁.1) + have hab₂ : a₂ ≠ b₂ := fun h => disjoint_left.mp hfence.2.2.1 ha₂.1 (h ▸ hb₂.1) + have ha₂b₁ : a₂ ≠ b₁ := fun h => disjoint_left.mp hfence.2.2.1 ha₂.1 (h ▸ hb₁.1) + have ha₁b₂ : a₁ ≠ b₂ := fun h => disjoint_left.mp hfence.2.2.1 ha₁.1 (h ▸ hb₂.1) + have ha₂_b₁a₁ : a₂ ∈ Ω.interval b₁ a₁ := + (Ω.mem_interval_or_interval_swap (hW ha₁.2) (hW hb₁.2) (hW ha₂.2) hab₁ + (Ne.symm ha_ne) ha₂b₁).resolve_left ha₂_not + have ha₁_b₂a₂ : a₁ ∈ Ω.interval b₂ a₂ := + (Ω.mem_interval_or_interval_swap (hW ha₂.2) (hW hb₂.2) (hW ha₁.2) hab₂ ha_ne + ha₁b₂).resolve_left ha₁_not + have hb₁_a₁a₂ : b₁ ∈ Ω.interval a₁ a₂ := Ω.mem_interval_rotate_right ha₂_b₁a₁ + have hb₂_a₂a₁ : b₂ ∈ Ω.interval a₂ a₁ := Ω.mem_interval_rotate_right ha₁_b₂a₂ + by_cases hb_eq : b₁ = b₂ + · exact disjoint_left.mp (Ω.disjoint_interval_swap a₁ a₂) hb₁_a₁a₂ (hb_eq ▸ hb₂_a₂a₁) + · exact hfence.2.2.2.2 a₁ ha₁.1 a₂ ha₂.1 ha_ne b₁ hb₁.1 b₂ hb₂.1 hb_eq + (Ω.crosses_iff_interval.mpr (Or.inl ⟨hb₁_a₁a₂, hb₂_a₂a₁⟩)) + subst ha_eq + refine ⟨rfl, ?_⟩ + by_contra hb_ne + have hab₁ : a₁ ≠ b₁ := fun h => disjoint_left.mp hfence.2.2.1 ha₁.1 (h ▸ hb₁.1) + have hab₂ : a₁ ≠ b₂ := fun h => disjoint_left.mp hfence.2.2.1 ha₁.1 (h ▸ hb₂.1) + rcases Ω.mem_interval_or_interval_swap (hW ha₁.2) (hW hb₁.2) (hW hb₂.2) hab₁ hab₂.symm + (Ne.symm hb_ne) with + hb₂_in | hb₂_in + · exact disjoint_left.mp hdisj₁ hb₂_in hb₂.2 + · exact disjoint_left.mp hdisj₂ (Ω.mem_interval_rotate_right hb₂_in) hb₁.2 + +theorem exists_empty_interval_AB_of_subset_union {A B W : Set α} + (_hW_bar : W ⊆ Ω.bar) (hW_AB : W ⊆ A ∪ B) + (ha₀ : (A ∩ W).Nonempty) (hb₀ : (B ∩ W).Nonempty) : + ∃ a' ∈ A ∩ W, ∃ b ∈ B ∩ W, Disjoint (Ω.interval a' b) W := by + classical + have hind : ∀ (n : ℕ) {a' b : α}, + a' ∈ A ∩ W → b ∈ B ∩ W → (Ω.interval a' b).ncard = n → + ∃ a₁ ∈ A ∩ W, ∃ b₁ ∈ B ∩ W, Disjoint (Ω.interval a₁ b₁) W := by + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro a' b ha' hb hcard + by_cases hdisj : Disjoint (Ω.interval a' b) W + · exact ⟨a', ha', b, hb, hdisj⟩ + · rw [not_disjoint_iff] at hdisj + rcases hdisj with ⟨z, hz_int, hzW⟩ + have hfin : (Ω.interval a' b).Finite := Ω.finite_bar.subset (Ω.interval_subset_bar a' b) + rcases hW_AB hzW with hzA | hzB + · have hsub : Ω.interval z b ⊂ Ω.interval a' b := + ⟨Ω.interval_subset_interval_right hz_int, + fun h => Ω.not_mem_interval_left z b (h hz_int)⟩ + have hlt : (Ω.interval z b).ncard < n := hcard ▸ ncard_lt_ncard hsub hfin + exact ih _ hlt ⟨hzA, hzW⟩ hb rfl + · have hsub : Ω.interval a' z ⊂ Ω.interval a' b := + ⟨Ω.interval_subset_interval_left hz_int, + fun h => Ω.not_mem_interval_right a' z (h hz_int)⟩ + have hlt : (Ω.interval a' z).ncard < n := hcard ▸ ncard_lt_ncard hsub hfin + exact ih _ hlt ha' ⟨hzB, hzW⟩ rfl + rcases ha₀ with ⟨a₀, ha₀⟩ + rcases hb₀ with ⟨b₀, hb₀⟩ + exact hind (Ω.interval a₀ b₀).ncard ha₀ hb₀ rfl + +theorem mem_interval_of_mem_A_of_disjoint_AB {A B W : Set α} + (hfence : Ω.IsFence A B) (hW : W ⊆ Ω.bar) + {a' b x y : α} (ha' : a' ∈ A ∩ W) (hb : b ∈ B ∩ W) + (hdisj : Disjoint (Ω.interval a' b) W) + (hx : x ∈ A ∩ W) (hxa' : x ≠ a') (hy : y ∈ B ∩ W) : + a' ∈ Ω.interval x y ∧ y ∈ Ω.interval a' x := by + have hab : a' ≠ b := fun h => disjoint_left.mp hfence.2.2.1 ha'.1 (h ▸ hb.1) + have hxb : x ≠ b := fun h => disjoint_left.mp hfence.2.2.1 hx.1 (h ▸ hb.1) + have hx_not : x ∉ Ω.interval a' b := disjoint_right.mp hdisj hx.2 + have hx_ba' : x ∈ Ω.interval b a' := + (Ω.mem_interval_or_interval_swap (hW ha'.2) (hW hb.2) (hW hx.2) hab hxa' hxb).resolve_left + hx_not + have hb_a'x : b ∈ Ω.interval a' x := Ω.mem_interval_rotate_right hx_ba' + have hy_a'x : y ∈ Ω.interval a' x := by + by_cases hyb : y = b + · exact hyb ▸ hb_a'x + · have hy_not_xa' : y ∉ Ω.interval x a' := fun hy_xa' => + hfence.2.2.2.2 a' ha'.1 x hx.1 hxa'.symm b hb.1 y hy.1 (Ne.symm hyb) + (Ω.crosses_iff_interval.mpr (Or.inl ⟨hb_a'x, hy_xa'⟩)) + have hya' : y ≠ a' := fun h => disjoint_left.mp hfence.2.2.1 ha'.1 (h ▸ hy.1) + have hyx : y ≠ x := fun h => disjoint_left.mp hfence.2.2.1 hx.1 (h ▸ hy.1) + exact (Ω.mem_interval_or_interval_swap (hW ha'.2) (hW hx.2) (hW hy.2) hxa'.symm hya' + hyx).resolve_right hy_not_xa' + exact ⟨Ω.mem_interval_rotate_right hy_a'x, hy_a'x⟩ + +theorem mem_interval_of_mem_B_of_disjoint_AB {A B W : Set α} + (hfence : Ω.IsFence A B) (hW : W ⊆ Ω.bar) + {a' b x y : α} (ha' : a' ∈ A ∩ W) (hb : b ∈ B ∩ W) + (hdisj : Disjoint (Ω.interval a' b) W) + (hx : x ∈ A ∩ W) (hy : y ∈ B ∩ W) (hyb : y ≠ b) : + b ∈ Ω.interval x y ∧ x ∈ Ω.interval y b := by + have hab : a' ≠ b := fun h => disjoint_left.mp hfence.2.2.1 ha'.1 (h ▸ hb.1) + have hya' : y ≠ a' := fun h => disjoint_left.mp hfence.2.2.1 ha'.1 (h ▸ hy.1) + have hy_not : y ∉ Ω.interval a' b := disjoint_right.mp hdisj hy.2 + have hy_ba' : y ∈ Ω.interval b a' := + (Ω.mem_interval_or_interval_swap (hW ha'.2) (hW hb.2) (hW hy.2) hab hya' hyb).resolve_left + hy_not + have ha'_yb : a' ∈ Ω.interval y b := Ω.mem_interval_rotate_left hy_ba' + have hx_yb : x ∈ Ω.interval y b := by + by_cases hxa' : x = a' + · exact hxa' ▸ ha'_yb + · have hx_not_by : x ∉ Ω.interval b y := fun hx_by => + hfence.symm.2.2.2.2 y hy.1 b hb.1 hyb a' ha'.1 x hx.1 (Ne.symm hxa') + (Ω.crosses_iff_interval.mpr (Or.inl ⟨ha'_yb, hx_by⟩)) + have hxy : x ≠ y := fun h => disjoint_left.mp hfence.2.2.1 hx.1 (h ▸ hy.1) + have hxb : x ≠ b := fun h => disjoint_left.mp hfence.2.2.1 hx.1 (h ▸ hb.1) + exact (Ω.mem_interval_or_interval_swap (hW hy.2) (hW hb.2) (hW hx.2) hyb hxy + hxb).resolve_right hx_not_by + exact ⟨Ω.mem_interval_rotate_left hx_yb, hx_yb⟩ + +theorem interval_subset_of_disjoint_AB {A B W : Set α} + (hfence : Ω.IsFence A B) (hW : W ⊆ Ω.bar) + {a' b x y : α} (ha' : a' ∈ A ∩ W) (hb : b ∈ B ∩ W) + (hdisj : Disjoint (Ω.interval a' b) W) + (hx : x ∈ A ∩ W) (hy : y ∈ B ∩ W) : + Ω.interval a' b ⊆ Ω.interval x y := by + have h₁ : Ω.interval a' b ⊆ Ω.interval x b := by + by_cases hxa' : x = a' + · exact hxa' ▸ Subset.rfl + · exact Ω.interval_subset_interval_right + (Ω.mem_interval_of_mem_A_of_disjoint_AB hfence hW ha' hb hdisj hx hxa' hb).1 + have h₂ : Ω.interval x b ⊆ Ω.interval x y := by + by_cases hyb : y = b + · exact hyb ▸ Subset.rfl + · exact Ω.interval_subset_interval_left + (Ω.mem_interval_of_mem_B_of_disjoint_AB hfence hW ha' hb hdisj hx hy hyb).1 + exact h₁.trans h₂ + +end CyclicPerm + +/-! ## Proof of (3.1) and (3.4) (pages 47–48) -/ + +namespace Society + +theorem not_omegaPathsCross_of_isPeripheralIn (S : Society α β) + {P_set : Set (Graph α β)} {P Q : Graph α β} + (hP : S.IsPeripheralIn P_set P) (hQ : Q ∈ P_set) : + ¬ S.OmegaPathsCross Q P := by + rcases hP with ⟨hP_in, a, b, hP_ends, hdisj_int⟩ + rintro ⟨_, s₂, t₂, s₁, t₁, hQ_ends, hP_ends', hcross⟩ + have hs₂_in : s₂ ∈ S.transactionEnds P_set := hQ_ends.mem_transactionEnds_left S hQ + have ht₂_in : t₂ ∈ S.transactionEnds P_set := hQ_ends.mem_transactionEnds_right S hQ + have hcross' : S.Ω.Crosses a b s₂ t₂ := by + rcases hP_ends.ends_eq S hP_ends' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hcross.symm + · exact hcross.symm.swap_left + rw [S.Ω.crosses_iff_interval] at hcross' + rcases hdisj_int with hdisj_ab | hdisj_ba + · rcases hcross' with ⟨h1, _⟩ | ⟨h1, _⟩ + · exact disjoint_left.mp hdisj_ab h1 hs₂_in + · exact disjoint_left.mp hdisj_ab h1 ht₂_in + · rcases hcross' with ⟨_, h2⟩ | ⟨_, h2⟩ + · exact disjoint_left.mp hdisj_ba h2 ht₂_in + · exact disjoint_left.mp hdisj_ba h2 hs₂_in + +/-- Any member `R ∈ P_set \ {P}` that is peripheral in `P_set \ {P}` (where `P_set` is a crooked +transaction with fence `(A, B)`, `P` has ends `a₁ ∈ A, b₁ ∈ B`, and `R` has ends `x ∈ A, y ∈ B`) +satisfies: if `Disjoint (S.Ω.interval x y) (S.transactionEnds (P_set \ {P}))`, then exactly one of +`a₁, b₁` lies in `S.Ω.interval x y`. -/ +theorem mem_interval_of_peripheral_diff_singleton (S : Society α β) + {P_set : Set (Graph α β)} {A B : Set α} + (hfence : S.IsFenceFor P_set A B) + (hcrooked : S.IsCrookedTransaction P_set) + {P R : Graph α β} {a₁ b₁ x y : α} + (hP_in : P ∈ P_set) (hR_in : R ∈ P_set \ {P}) + (ha₁ : a₁ ∈ A) (hb₁ : b₁ ∈ B) (hP_ends : S.IsOmegaPathWithEnds P a₁ b₁) + (hx : x ∈ A) (hy : y ∈ B) (hR_ends : S.IsOmegaPathWithEnds R x y) + (hdisj_xy : Disjoint (S.Ω.interval x y) (S.transactionEnds (P_set \ {P}))) : + (a₁ ∈ S.Ω.interval x y ∧ b₁ ∉ S.Ω.interval x y) ∨ + (b₁ ∈ S.Ω.interval x y ∧ a₁ ∉ S.Ω.interval x y) := by + have hnot_periph_R : ¬ S.IsPeripheralIn P_set R := hcrooked.2 R hR_in.1 + have hnot_disj_R : ¬ Disjoint (S.Ω.interval x y) (S.transactionEnds P_set) := + fun h => hnot_periph_R ⟨hR_in.1, x, y, hR_ends, Or.inl h⟩ + rw [S.transactionEnds_diff_singleton hfence.1 hP_in hP_ends] at hdisj_xy + have ha₁_or_hb₁ : a₁ ∈ S.Ω.interval x y ∨ b₁ ∈ S.Ω.interval x y := by + rw [not_disjoint_iff] at hnot_disj_R + rcases hnot_disj_R with ⟨z, hz_xy, hz_W⟩ + by_cases hz_ab : z ∈ ({a₁, b₁} : Set α) + · rcases hz_ab with rfl | rfl + · exact Or.inl hz_xy + · exact Or.inr hz_xy + · exact (disjoint_left.mp hdisj_xy hz_xy ⟨hz_W, hz_ab⟩).elim + have hnot_both : ¬ (a₁ ∈ S.Ω.interval x y ∧ b₁ ∈ S.Ω.interval x y) := by + rintro ⟨ha₁_xy, hb₁_xy⟩ + have hdisj_PR : Disjoint V(P) V(R) := hfence.1.2 hP_in hR_in.1 (Ne.symm hR_in.2) + have hxa₁ : x ≠ a₁ := fun h => disjoint_left.mp hdisj_PR hP_ends.1.left_mem + (h ▸ hR_ends.1.left_mem) + have hyb₁ : y ≠ b₁ := fun h => disjoint_left.mp hdisj_PR hP_ends.1.right_mem + (h ▸ hR_ends.1.right_mem) + have hy_a₁x : y ∈ S.Ω.interval a₁ x := S.Ω.mem_interval_rotate_left ha₁_xy + have hb₁_not_xa₁ : b₁ ∉ S.Ω.interval x a₁ := fun hb₁_xa₁ => + hfence.2.1.2.2.2.2 x hx a₁ ha₁ hxa₁ b₁ hb₁ y hy hyb₁.symm + (S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hb₁_xa₁, hy_a₁x⟩)) + have hxb₁ : x ≠ b₁ := fun h => disjoint_left.mp hfence.2.1.2.2.1 hx (h ▸ hb₁) + have ha₁b₁ : a₁ ≠ b₁ := hP_ends.2.1 + have hb₁_a₁x : b₁ ∈ S.Ω.interval a₁ x := + (S.Ω.mem_interval_or_interval_swap hR_ends.2.2.1 hP_ends.2.2.1 hP_ends.2.2.2 + hxa₁ hxb₁.symm ha₁b₁.symm).resolve_left hb₁_not_xa₁ + have ha₁_xb₁ : a₁ ∈ S.Ω.interval x b₁ := S.Ω.mem_interval_rotate_right hb₁_a₁x + have hsub : S.Ω.interval a₁ b₁ ⊆ S.Ω.interval x y := + (S.Ω.interval_subset_interval_right ha₁_xb₁).trans (S.Ω.interval_subset_interval_left hb₁_xy) + have hdisj_a₁b₁ : Disjoint (S.Ω.interval a₁ b₁) (S.transactionEnds P_set) := by + rw [disjoint_left] + intro z hz hzW + have hza₁ : z ≠ a₁ := fun h => hz.1.2 (by simp [h]) + have hzb₁ : z ≠ b₁ := fun h => hz.1.2 (by simp [h]) + exact disjoint_left.mp hdisj_xy (hsub hz) ⟨hzW, by simp [hza₁, hzb₁]⟩ + exact hcrooked.2 P hP_in ⟨hP_in, a₁, b₁, hP_ends, Or.inl hdisj_a₁b₁⟩ + rcases ha₁_or_hb₁ with ha₁_in | hb₁_in + · exact Or.inl ⟨ha₁_in, fun hb₁_in => hnot_both ⟨ha₁_in, hb₁_in⟩⟩ + · exact Or.inr ⟨hb₁_in, fun ha₁_in => hnot_both ⟨ha₁_in, hb₁_in⟩⟩ + +/-- Every overpass of a crooked transaction `P_set` crosses every other member of `P_set`. -/ +theorem omegaPathsCross_of_isOverpass (S : Society α β) + {P_set : Set (Graph α β)} {P Q : Graph α β} + (hover : S.IsOverpass P_set P) (hQ : Q ∈ P_set \ {P}) : + S.OmegaPathsCross P Q := by + rcases hover with ⟨hcrooked, hP_in, R₁, hR₁_in, R₂, hR₂_in, hR12, hper₁, hper₂⟩ + obtain ⟨A, B, hfence⟩ := hcrooked.1 + obtain ⟨a₁, ha₁, b₁, hb₁, hP_ends⟩ := hfence.2.2 P hP_in + obtain ⟨a_Q, ha_Q, b_Q, hb_Q, hQ_ends⟩ := hfence.2.2 Q hQ.1 + obtain ⟨x₁, hx₁, y₁, hy₁, hR₁_ends⟩ := hfence.2.2 R₁ hR₁_in.1 + obtain ⟨x₂, hx₂, y₂, hy₂, hR₂_ends⟩ := hfence.2.2 R₂ hR₂_in.1 + let W' := S.transactionEnds (P_set \ {P}) + have hW'_bar : W' ⊆ S.Ω.bar := S.transactionEnds_subset_bar (P_set \ {P}) + have hx₁W' : x₁ ∈ A ∩ W' := ⟨hx₁, hR₁_ends.mem_transactionEnds_left S hR₁_in⟩ + have hy₁W' : y₁ ∈ B ∩ W' := ⟨hy₁, hR₁_ends.mem_transactionEnds_right S hR₁_in⟩ + have hx₂W' : x₂ ∈ A ∩ W' := ⟨hx₂, hR₂_ends.mem_transactionEnds_left S hR₂_in⟩ + have hy₂W' : y₂ ∈ B ∩ W' := ⟨hy₂, hR₂_ends.mem_transactionEnds_right S hR₂_in⟩ + have haQW' : a_Q ∈ A ∩ W' := ⟨ha_Q, hQ_ends.mem_transactionEnds_left S hQ⟩ + have hbQW' : b_Q ∈ B ∩ W' := ⟨hb_Q, hQ_ends.mem_transactionEnds_right S hQ⟩ + have hper₁' := (hR₁_ends.isPeripheralIn_iff S hR₁_in).mp hper₁ + have hper₂' := (hR₂_ends.isPeripheralIn_iff S hR₂_in).mp hper₂ + have hdisj_R12 : Disjoint V(R₁) V(R₂) := hfence.1.2 hR₁_in.1 hR₂_in.1 hR12 + have hx12 : x₁ ≠ x₂ := fun h => disjoint_left.mp hdisj_R12 hR₁_ends.1.left_mem + (h ▸ hR₂_ends.1.left_mem) + have hy12 : y₁ ≠ y₂ := fun h => disjoint_left.mp hdisj_R12 hR₁_ends.1.right_mem + (h ▸ hR₂_ends.1.right_mem) + -- `R₁` and `R₂` cannot both have `Disjoint (interval x_i y_i) W'` or both `Disjoint (interval y_i + -- x_i) W'`. + have h_one_each : + (Disjoint (S.Ω.interval x₁ y₁) W' ∧ Disjoint (S.Ω.interval y₂ x₂) W') ∨ + (Disjoint (S.Ω.interval y₁ x₁) W' ∧ Disjoint (S.Ω.interval x₂ y₂) W') := by + rcases hper₁' with hd₁ | hd₁ <;> rcases hper₂' with hd₂ | hd₂ + · exfalso + exact hx12 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1 hW'_bar hx₁W' hy₁W' hx₂W' + hy₂W' hd₁ hd₂).1 + · exact Or.inl ⟨hd₁, hd₂⟩ + · exact Or.inr ⟨hd₁, hd₂⟩ + · exfalso + exact hy12 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1.symm hW'_bar hy₁W' hx₁W' hy₂W' + hx₂W' hd₁ hd₂).1 + -- Helper for when `Disjoint (interval u₁ v₁) W'` and `Disjoint (interval v₂ u₂) W'`. + have hcross_of_pair : ∀ {u₁ v₁ u₂ v₂ : α} {M₁ M₂ : Graph α β}, + M₁ ∈ P_set \ {P} → M₂ ∈ P_set \ {P} → M₁ ≠ M₂ → + u₁ ∈ A ∩ W' → v₁ ∈ B ∩ W' → S.IsOmegaPathWithEnds M₁ u₁ v₁ → + u₂ ∈ A ∩ W' → v₂ ∈ B ∩ W' → S.IsOmegaPathWithEnds M₂ u₂ v₂ → + Disjoint (S.Ω.interval u₁ v₁) W' → Disjoint (S.Ω.interval v₂ u₂) W' → + S.Ω.Crosses a₁ b₁ a_Q b_Q := by + intro u₁ v₁ u₂ v₂ M₁ M₂ hM₁ hM₂ hM12 hu₁ hv₁ hM₁_ends hu₂ hv₂ hM₂_ends hd₁ hd₂ + have hsub₁ : S.Ω.interval u₁ v₁ ⊆ S.Ω.interval a_Q b_Q := + S.Ω.interval_subset_of_disjoint_AB hfence.2.1 hW'_bar hu₁ hv₁ hd₁ haQW' hbQW' + have hsub₂ : S.Ω.interval v₂ u₂ ⊆ S.Ω.interval b_Q a_Q := + S.Ω.interval_subset_of_disjoint_AB hfence.2.1.symm hW'_bar hv₂ hu₂ hd₂ hbQW' haQW' + have h_ab_1 := S.mem_interval_of_peripheral_diff_singleton hfence hcrooked + hP_in hM₁ ha₁ hb₁ hP_ends hu₁.1 hv₁.1 hM₁_ends hd₁ + have hfence_BA : S.IsFenceFor P_set B A := + ⟨hfence.1, hfence.2.1.symm, fun R hR => by + obtain ⟨a, ha, b, hb, hR_e⟩ := hfence.2.2 R hR + exact ⟨b, hb, a, ha, hR_e.symm S⟩⟩ + have h_ab_2 := S.mem_interval_of_peripheral_diff_singleton hfence_BA hcrooked + hP_in hM₂ hb₁ ha₁ (hP_ends.symm S) hv₂.1 hu₂.1 (hM₂_ends.symm S) hd₂ + have hdisj_int : Disjoint (S.Ω.interval u₁ v₁) (S.Ω.interval v₂ u₂) := + (S.Ω.disjoint_interval_swap a_Q b_Q).mono hsub₁ hsub₂ + apply CyclicPerm.Crosses.symm + rw [S.Ω.crosses_iff_interval] + rcases h_ab_1 with ⟨ha₁_1, _⟩ | ⟨hb₁_1, _⟩ + · rcases h_ab_2 with ⟨hb₁_2, _⟩ | ⟨ha₁_2, _⟩ + · exact Or.inl ⟨hsub₁ ha₁_1, hsub₂ hb₁_2⟩ + · exact (disjoint_left.mp hdisj_int ha₁_1 ha₁_2).elim + · rcases h_ab_2 with ⟨hb₁_2, _⟩ | ⟨ha₁_2, _⟩ + · exact (disjoint_left.mp hdisj_int hb₁_1 hb₁_2).elim + · exact Or.inr ⟨hsub₁ hb₁_1, hsub₂ ha₁_2⟩ + refine ⟨hfence.1.2 hP_in hQ.1 (Ne.symm hQ.2), a₁, b₁, a_Q, b_Q, hP_ends, hQ_ends, ?_⟩ + rcases h_one_each with ⟨hd₁, hd₂⟩ | ⟨hd₁, hd₂⟩ + · exact hcross_of_pair hR₁_in hR₂_in hR12 hx₁W' hy₁W' hR₁_ends hx₂W' hy₂W' hR₂_ends hd₁ hd₂ + · exact hcross_of_pair hR₂_in hR₁_in hR12.symm hx₂W' hy₂W' hR₂_ends hx₁W' hy₁W' hR₁_ends hd₂ hd₁ + +/-- **Graph Minors IX, (3.1)** (page 47): +"Any crooked transaction has at most one overpass." -/ +theorem theorem_3_1_proof (S : Society α β) {P_set : Set (Graph α β)} + (_hcrooked : S.IsCrookedTransaction P_set) + {P₁ P₂ : Graph α β} (h₁ : S.IsOverpass P_set P₁) (h₂ : S.IsOverpass P_set P₂) : + P₁ = P₂ := by + by_contra hne + rcases h₁ with ⟨_, _, Q₁, hQ₁_in, Q₂, hQ₂_in, hQ12, hper₁, hper₂⟩ + by_cases hP₂Q₁ : P₂ = Q₁ + · have hP₂Q₂ : P₂ ≠ Q₂ := fun h => hQ12 (hP₂Q₁.symm.trans h) + have hcross : S.OmegaPathsCross P₂ Q₂ := + S.omegaPathsCross_of_isOverpass h₂ ⟨hQ₂_in.1, hP₂Q₂.symm⟩ + exact S.not_omegaPathsCross_of_isPeripheralIn hper₂ ⟨h₂.2.1, Ne.symm hne⟩ hcross + · have hcross : S.OmegaPathsCross P₂ Q₁ := + S.omegaPathsCross_of_isOverpass h₂ ⟨hQ₁_in.1, Ne.symm hP₂Q₁⟩ + exact S.not_omegaPathsCross_of_isPeripheralIn hper₁ ⟨h₂.2.1, Ne.symm hne⟩ hcross + +/-- Every crooked transaction is nonempty or has cardinality 0; if nonempty, any crooked transaction +has cardinality `≥ 2`, and contains a 2-element crooked transaction `{P₁, P₂}` (a cross). -/ +theorem exists_crooked_pair_of_nonempty (S : Society α β) + {P_set : Set (Graph α β)} (hcrooked : S.IsCrookedTransaction P_set) + (hne : P_set.Nonempty) : + ∃ P₁ ∈ P_set, ∃ P₂ ∈ P_set, P₁ ≠ P₂ ∧ S.IsCrookedTransaction {P₁, P₂} := by + rcases hne with ⟨P₀, hP₀⟩ + obtain ⟨A, B, hfence⟩ := hcrooked.1 + let W := S.transactionEnds P_set + have hW_bar : W ⊆ S.Ω.bar := S.transactionEnds_subset_bar P_set + have hW_AB : W ⊆ A ∪ B := hfence.2.1.2.2.2.1 ▸ hW_bar + obtain ⟨a₀, ha₀, b₀, hb₀, hP₀_ends⟩ := hfence.2.2 P₀ hP₀ + have ha_ne : (A ∩ W).Nonempty := ⟨a₀, ha₀, hP₀_ends.mem_transactionEnds_left S hP₀⟩ + have hb_ne : (B ∩ W).Nonempty := ⟨b₀, hb₀, hP₀_ends.mem_transactionEnds_right S hP₀⟩ + obtain ⟨a', ha'W, b, hbW, hdisj_a'b⟩ := + S.Ω.exists_empty_interval_AB_of_subset_union hW_bar hW_AB ha_ne hb_ne + obtain ⟨P₁, hP₁_in, c₁, hc₁⟩ := ha'W.2 + obtain ⟨a₁, ha₁, b₁, hb₁, hP₁_ends_raw⟩ := hfence.2.2 P₁ hP₁_in + have ha₁_eq : a₁ = a' := by + rcases hP₁_ends_raw.ends_eq S hc₁ with ⟨h, _⟩ | ⟨h, _⟩ + · exact h.symm + · exact (disjoint_left.mp hfence.2.1.2.2.1 ha'W.1 (h ▸ hb₁)).elim + have hP₁_ends : S.IsOmegaPathWithEnds P₁ a' b₁ := ha₁_eq ▸ hP₁_ends_raw + obtain ⟨P₂, hP₂_in, c₂, hc₂⟩ := hbW.2 + obtain ⟨a₂, ha₂, b₂, hb₂, hP₂_ends_raw⟩ := hfence.2.2 P₂ hP₂_in + have hb₂_eq : b₂ = b := by + rcases hP₂_ends_raw.ends_eq S hc₂ with ⟨h, _⟩ | ⟨h, _⟩ + · exact (disjoint_left.mp hfence.2.1.2.2.1 (h ▸ ha₂) hbW.1).elim + · exact h.symm + have hP₂_ends : S.IsOmegaPathWithEnds P₂ a₂ b := hb₂_eq ▸ hP₂_ends_raw + have hP12 : P₁ ≠ P₂ := by + intro hPP + obtain ⟨heq_a, heq_b⟩ := hP₁_ends.ends_eq_of_mem_disjoint S hfence.2.1.2.2.1 ha'W.1 hb₁ ha₂ + (hPP ▸ hP₂_ends) + exact hcrooked.2 P₁ hP₁_in ⟨hP₁_in, a', b, heq_b ▸ hP₁_ends, Or.inl hdisj_a'b⟩ + have hdisj_12 : Disjoint V(P₁) V(P₂) := hfence.1.2 hP₁_in hP₂_in hP12 + have ha2a' : a₂ ≠ a' := fun h => disjoint_left.mp hdisj_12 hP₁_ends.1.left_mem + (h ▸ hP₂_ends.1.left_mem) + have hb1b : b₁ ≠ b := fun h => disjoint_left.mp hdisj_12 hP₁_ends.1.right_mem + (h ▸ hP₂_ends.1.right_mem) + have ha'_a₂b : a' ∈ S.Ω.interval a₂ b := + (S.Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.2.1 hW_bar ha'W hbW hdisj_a'b + ⟨ha₂, hP₂_ends.mem_transactionEnds_left S hP₂_in⟩ ha2a' hbW).1 + have ha'_a₂b₁ : a' ∈ S.Ω.interval a₂ b₁ := + (S.Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.2.1 hW_bar ha'W hbW hdisj_a'b + ⟨ha₂, hP₂_ends.mem_transactionEnds_left S hP₂_in⟩ ha2a' + ⟨hb₁, hP₁_ends.mem_transactionEnds_right S hP₁_in⟩).1 + have hb_a'b₁ : b ∈ S.Ω.interval a' b₁ := + (S.Ω.mem_interval_of_mem_B_of_disjoint_AB hfence.2.1 hW_bar ha'W hbW hdisj_a'b + ha'W ⟨hb₁, hP₁_ends.mem_transactionEnds_right S hP₁_in⟩ hb1b).1 + have hb₁_ba₂ : b₁ ∈ S.Ω.interval b a₂ := + S.Ω.mem_interval_rotate_left (S.Ω.interval_subset_interval_right ha'_a₂b₁ hb_a'b₁) + have hcross : S.Ω.Crosses a₂ b a' b₁ := + S.Ω.crosses_iff_interval.mpr (Or.inl ⟨ha'_a₂b, hb₁_ba₂⟩) + refine ⟨P₁, hP₁_in, P₂, hP₂_in, hP12, ⟨A, B, ⟨?_, ?_⟩, hfence.2.1, ?_⟩, ?_⟩ + · rintro Q (rfl | rfl) + · exact hfence.1.1 Q hP₁_in + · exact hfence.1.1 Q hP₂_in + · rintro Q₁ (rfl | rfl) Q₂ (rfl | rfl) hne' + · exact (hne' rfl).elim + · exact hdisj_12 + · exact hdisj_12.symm + · exact (hne' rfl).elim + · rintro Q (rfl | rfl) + · exact ⟨a', ha'W.1, b₁, hb₁, hP₁_ends⟩ + · exact ⟨a₂, ha₂, b, hbW.1, hP₂_ends⟩ + · rintro Q (rfl | rfl) hper + · exact S.not_omegaPathsCross_of_isPeripheralIn hper (by simp) + ⟨hdisj_12.symm, a₂, b, a', b₁, hP₂_ends, hP₁_ends, hcross⟩ + · exact S.not_omegaPathsCross_of_isPeripheralIn hper (by simp) + ⟨hdisj_12, a', b₁, a₂, b, hP₁_ends, hP₂_ends, hcross.symm⟩ + +/-- Every crooked transaction of cardinality `≥ 5` contains a crooked transaction of cardinality +`|P_set| - 1`. -/ +theorem exists_crooked_diff_singleton_of_ncard_ge_five (S : Society α β) + {P_set : Set (Graph α β)} (hcrooked : S.IsCrookedTransaction P_set) + (hcard : 5 ≤ P_set.ncard) : + ∃ P ∈ P_set, S.IsCrookedTransaction (P_set \ {P}) := by + classical + have hfin_P : P_set.Finite := by + by_contra hinf + have h0 := Set.Infinite.ncard hinf + omega + have hne : P_set.Nonempty := (ncard_pos hfin_P).mp (by omega) + rcases hne with ⟨P₀, hP₀⟩ + obtain ⟨A, B, hfence⟩ := hcrooked.1 + let W := S.transactionEnds P_set + have hW_bar : W ⊆ S.Ω.bar := S.transactionEnds_subset_bar P_set + have hW_AB : W ⊆ A ∪ B := hfence.2.1.2.2.2.1 ▸ hW_bar + obtain ⟨a₀, ha₀, b₀, hb₀, hP₀_ends⟩ := hfence.2.2 P₀ hP₀ + have ha_ne : (A ∩ W).Nonempty := ⟨a₀, ha₀, hP₀_ends.mem_transactionEnds_left S hP₀⟩ + have hb_ne : (B ∩ W).Nonempty := ⟨b₀, hb₀, hP₀_ends.mem_transactionEnds_right S hP₀⟩ + obtain ⟨a', ha'W, b, hbW, hdisj_a'b⟩ := + S.Ω.exists_empty_interval_AB_of_subset_union hW_bar hW_AB ha_ne hb_ne + obtain ⟨b', hb'W, a, haW, hdisj_b'a⟩ := + S.Ω.exists_empty_interval_AB_of_subset_union hW_bar (union_comm A B ▸ hW_AB) hb_ne ha_ne + obtain ⟨P_a', hPa'_in, _, hPa'_c⟩ := ha'W.2 + obtain ⟨P_b, hPb_in, _, hPb_c⟩ := hbW.2 + obtain ⟨P_b', hPb'_in, _, hPb'_c⟩ := hb'W.2 + obtain ⟨P_a, hPa_in, _, hPa_c⟩ := haW.2 + have hcard4 : ({P_a', P_b, P_b', P_a} : Set (Graph α β)).ncard ≤ 4 := by + calc ({P_a', P_b, P_b', P_a} : Set (Graph α β)).ncard + _ ≤ ({P_b, P_b', P_a} : Set (Graph α β)).ncard + 1 := ncard_insert_le _ _ + _ ≤ ({P_b', P_a} : Set (Graph α β)).ncard + 1 + 1 := by gcongr; exact ncard_insert_le _ _ + _ ≤ ({P_a} : Set (Graph α β)).ncard + 1 + 1 + 1 := by gcongr; exact ncard_insert_le _ _ + _ = 4 := by simp + have hnot_sub : ¬ P_set ⊆ {P_a', P_b, P_b', P_a} := by + intro hsub + have hle := ncard_le_ncard hsub + omega + obtain ⟨P, hP_in, hP_not_in⟩ := not_subset.mp hnot_sub + simp only [mem_insert_iff, mem_singleton_iff, not_or] at hP_not_in + rcases hP_not_in with ⟨hP_ne_a', hP_ne_b, hP_ne_b', hP_ne_a⟩ + obtain ⟨a_P, ha_P, b_P, hb_P, hP_ends⟩ := hfence.2.2 P hP_in + have ha'V : a' ∈ V(P_a') := hPa'_c.1.left_mem + have hbV : b ∈ V(P_b) := hPb_c.1.left_mem + have hb'V : b' ∈ V(P_b') := hPb'_c.1.left_mem + have haV : a ∈ V(P_a) := hPa_c.1.left_mem + have ha'_not_P : a' ∉ ({a_P, b_P} : Set α) := by + rintro (rfl | rfl) + · exact disjoint_left.mp (hfence.1.2 hP_in hPa'_in hP_ne_a') hP_ends.1.left_mem ha'V + · exact disjoint_left.mp (hfence.1.2 hP_in hPa'_in hP_ne_a') hP_ends.1.right_mem ha'V + have hb_not_P : b ∉ ({a_P, b_P} : Set α) := by + rintro (rfl | rfl) + · exact disjoint_left.mp (hfence.1.2 hP_in hPb_in hP_ne_b) hP_ends.1.left_mem hbV + · exact disjoint_left.mp (hfence.1.2 hP_in hPb_in hP_ne_b) hP_ends.1.right_mem hbV + have hb'_not_P : b' ∉ ({a_P, b_P} : Set α) := by + rintro (rfl | rfl) + · exact disjoint_left.mp (hfence.1.2 hP_in hPb'_in hP_ne_b') hP_ends.1.left_mem hb'V + · exact disjoint_left.mp (hfence.1.2 hP_in hPb'_in hP_ne_b') hP_ends.1.right_mem hb'V + have ha_not_P : a ∉ ({a_P, b_P} : Set α) := by + rintro (rfl | rfl) + · exact disjoint_left.mp (hfence.1.2 hP_in hPa_in hP_ne_a) hP_ends.1.left_mem haV + · exact disjoint_left.mp (hfence.1.2 hP_in hPa_in hP_ne_a) hP_ends.1.right_mem haV + let W' := S.transactionEnds (P_set \ {P}) + have hW'_eq : W' = W \ {a_P, b_P} := S.transactionEnds_diff_singleton hfence.1 hP_in hP_ends + have ha'W' : a' ∈ W' := hW'_eq ▸ ⟨ha'W.2, ha'_not_P⟩ + have hbW' : b ∈ W' := hW'_eq ▸ ⟨hbW.2, hb_not_P⟩ + have hb'W' : b' ∈ W' := hW'_eq ▸ ⟨hb'W.2, hb'_not_P⟩ + have haW' : a ∈ W' := hW'_eq ▸ ⟨haW.2, ha_not_P⟩ + refine ⟨P, hP_in, ⟨A, B, ⟨fun R hR => hfence.1.1 R hR.1, hfence.1.2.mono sdiff_subset⟩, + hfence.2.1, fun R hR => hfence.2.2 R hR.1⟩, ?_⟩ + intro R hR hper + obtain ⟨x, hx, y, hy, hR_ends⟩ := hfence.2.2 R hR.1 + have hxW : x ∈ A ∩ W := ⟨hx, hR_ends.mem_transactionEnds_left S hR.1⟩ + have hyW : y ∈ B ∩ W := ⟨hy, hR_ends.mem_transactionEnds_right S hR.1⟩ + rcases (hR_ends.isPeripheralIn_iff S hR).mp hper with hd_xy | hd_yx + · by_cases hxa' : x = a' + · subst hxa' + have hyb : y ≠ b := fun h => by + subst h + exact hcrooked.2 R hR.1 ⟨hR.1, x, y, hR_ends, Or.inl hdisj_a'b⟩ + have hb_xy := (S.Ω.mem_interval_of_mem_B_of_disjoint_AB hfence.2.1 hW_bar ha'W hbW hdisj_a'b + hxW hyW hyb).1 + exact disjoint_left.mp hd_xy hb_xy hbW' + · have ha'_xy := (S.Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.2.1 hW_bar ha'W hbW hdisj_a'b + hxW hxa' hyW).1 + exact disjoint_left.mp hd_xy ha'_xy ha'W' + · by_cases hyb' : y = b' + · subst hyb' + have hxa : x ≠ a := fun h => by + subst h + exact hcrooked.2 R hR.1 ⟨hR.1, x, y, hR_ends, Or.inr hdisj_b'a⟩ + have ha_yx := (S.Ω.mem_interval_of_mem_B_of_disjoint_AB hfence.2.1.symm hW_bar hb'W haW + hdisj_b'a hyW hxW hxa).1 + exact disjoint_left.mp hd_yx ha_yx haW' + · have hb'_yx := (S.Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.2.1.symm hW_bar hb'W haW + hdisj_b'a hyW hyb' hxW).1 + exact disjoint_left.mp hd_yx hb'_yx hb'W' + +/-- **Graph Minors IX, (3.4)** (page 48): +"Let $p \ge 2$ be an integer, with $p \ne 3$. If $\mathscr{P}$ is a crooked transaction of +cardinality $\ge p$ then some subset of $\mathscr{P}$ is a crooked transaction of cardinality $p$." +-/ +theorem theorem_3_4_proof (S : Society α β) {p : ℕ} (hp2 : 2 ≤ p) (hp3 : p ≠ 3) + {P_set : Set (Graph α β)} (hcrooked : S.IsCrookedTransaction P_set) + (hcard : p ≤ P_set.ncard) : + ∃ P_set' ⊆ P_set, P_set'.ncard = p ∧ S.IsCrookedTransaction P_set' := by + classical + have hfin_all : P_set.Finite := by + by_contra hinf + have h0 := Set.Infinite.ncard hinf + omega + rcases eq_or_lt_of_le hp2 with rfl | hp_gt2 + · obtain ⟨P₁, hP₁, P₂, hP₂, h12, hcr12⟩ := + S.exists_crooked_pair_of_nonempty hcrooked ((ncard_pos hfin_all).mp (by omega)) + refine ⟨{P₁, P₂}, ?_, ncard_pair h12, hcr12⟩ + rintro Q (rfl | rfl) <;> assumption + · have hp4 : 4 ≤ p := by omega + have hind : ∀ (d : ℕ) {T : Set (Graph α β)}, + T ⊆ P_set → S.IsCrookedTransaction T → T.ncard = p + d → + ∃ P_set' ⊆ P_set, P_set'.ncard = p ∧ S.IsCrookedTransaction P_set' := by + intro d + induction d with + | zero => + intro T hT hcrT hcardT + exact ⟨T, hT, by omega, hcrT⟩ + | succ d ih => + intro T hT hcrT hcardT + have hT_fin : T.Finite := hfin_all.subset hT + obtain ⟨P, hPT, hcr_diff⟩ := + S.exists_crooked_diff_singleton_of_ncard_ge_five hcrT (by omega) + have hcard_diff : (T \ {P}).ncard = p + d := by + rw [ncard_sdiff_singleton_of_mem hPT] + omega + exact ih (sdiff_subset.trans hT) hcr_diff hcard_diff + exact hind (P_set.ncard - p) Subset.rfl hcrooked (by omega) + +end Society + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section3b.lean b/LeanPool/GraphMinor/GM09/Section3b.lean new file mode 100644 index 0000000000..3916f7a7a8 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section3b.lean @@ -0,0 +1,1239 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2a +import LeanPool.GraphMinor.GM09.Section2d +import LeanPool.GraphMinor.GM09.Section3a + +/-! +# Graph Minors IX, Section 3 (Part 2): Attachments, Switches, and (3.2) + +This file establishes: +- basic properties of attachments (`IsAttachmentWithEnds`, `IsAttachment`), feet (`IsFoot`), + legs (`IsLeg`), and switches (`IsSwitch`), +- Graph Minors IX, (3.2) (`lemma_3_2_claim_1`, `lemma_3_2_claim_2`, `lemma_3_2_claim_3`, + `theorem_3_2`, pages 47–48): every attachment to a crooked transaction that is not exchangeable + is an overpass attachment. +-/ + +public section + +namespace GraphMinor.GM09 + +open Set Graph GraphMinor GraphMinor.Surface + +universe u v + +variable {α : Type u} {β : Type v} + +namespace Society + +/-! ## Attachments, legs, and switches -/ + +theorem IsAttachmentWithEnds.foot_mem_transactionUnion (S : Society α β) + {P_set : Set (Graph α β)} {P : Graph α β} {b u : α} + (h : S.IsAttachmentWithEnds P_set P b u) : + b ∈ V(S.transactionUnion P_set) := by + have hb : b ∈ V(P) ∩ V(S.transactionUnion P_set) := h.2.1.symm ▸ mem_singleton b + exact hb.2 + +theorem IsAttachmentWithEnds.end_mem_bar_diff (S : Society α β) + {P_set : Set (Graph α β)} {P : Graph α β} {b u : α} + (h : S.IsAttachmentWithEnds P_set P b u) : + u ∈ S.Ω.bar \ S.transactionEnds P_set := by + have hu : u ∈ V(P) ∩ (S.Ω.bar \ S.transactionEnds P_set) := h.2.2.symm ▸ mem_singleton u + exact hu.2 + +theorem IsAttachmentWithEnds.end_mem_bar (S : Society α β) + {P_set : Set (Graph α β)} {P : Graph α β} {b u : α} + (h : S.IsAttachmentWithEnds P_set P b u) : + u ∈ S.Ω.bar := + (h.end_mem_bar_diff S).1 + +theorem IsAttachmentWithEnds.end_not_mem_transactionEnds (S : Society α β) + {P_set : Set (Graph α β)} {P : Graph α β} {b u : α} + (h : S.IsAttachmentWithEnds P_set P b u) : + u ∉ S.transactionEnds P_set := + (h.end_mem_bar_diff S).2 + +theorem IsAttachmentWithEnds.exists_leg (S : Society α β) + {P_set : Set (Graph α β)} {P : Graph α β} {b u : α} + (h : S.IsAttachmentWithEnds P_set P b u) : + ∃ L ∈ P_set, b ∈ V(L) := by + have hb : b ∈ V(S.transactionUnion P_set) := h.foot_mem_transactionUnion S + change b ∈ ⋃ L ∈ P_set, V(L) at hb + simpa using hb + +theorem IsAttachmentWithEnds.leg_unique (S : Society α β) + {P_set : Set (Graph α β)} (hdisj : S.IsDisjointOmegaPathSet P_set) + {_P L₁ L₂ : Graph α β} {b : α} + (hL₁ : L₁ ∈ P_set) (hb₁ : b ∈ V(L₁)) + (hL₂ : L₂ ∈ P_set) (hb₂ : b ∈ V(L₂)) : + L₁ = L₂ := by + by_contra hne + exact disjoint_left.mp (hdisj.2 hL₁ hL₂ hne) hb₁ hb₂ + +theorem IsAttachmentWithEnds.inter_leg_eq_singleton (S : Society α β) + {P_set : Set (Graph α β)} {P L : Graph α β} {b u : α} + (h : S.IsAttachmentWithEnds P_set P b u) (hL : L ∈ P_set) (hbL : b ∈ V(L)) : + V(P) ∩ V(L) = {b} := by + apply Subset.antisymm + · intro x ⟨hxP, hxL⟩ + have hxU : x ∈ V(S.transactionUnion P_set) := by + change x ∈ ⋃ R ∈ P_set, V(R) + exact mem_iUnion₂.mpr ⟨L, hL, hxL⟩ + have hx_inter : x ∈ V(P) ∩ V(S.transactionUnion P_set) := ⟨hxP, hxU⟩ + rwa [h.2.1] at hx_inter + · rintro x rfl + exact ⟨h.1.left_mem, hbL⟩ + +theorem IsAttachmentWithEnds.disjoint_of_ne_leg (S : Society α β) + {P_set : Set (Graph α β)} (hdisj : S.IsDisjointOmegaPathSet P_set) + {P L R : Graph α β} {b u : α} + (h : S.IsAttachmentWithEnds P_set P b u) + (hL : L ∈ P_set) (hbL : b ∈ V(L)) + (hR : R ∈ P_set) (hne : R ≠ L) : + Disjoint V(P) V(R) := by + rw [disjoint_left] + intro x hxP hxR + have hxU : x ∈ V(S.transactionUnion P_set) := by + change x ∈ ⋃ M ∈ P_set, V(M) + exact mem_iUnion₂.mpr ⟨R, hR, hxR⟩ + have hxb : x = b := by + have hx_inter : x ∈ V(P) ∩ V(S.transactionUnion P_set) := ⟨hxP, hxU⟩ + rwa [h.2.1, mem_singleton_iff] at hx_inter + subst hxb + exact disjoint_left.mp (hdisj.2 hR hL hne) hxR hbL + +/-- If `P` is an attachment to `P_set` with foot `b ∈ V(L)` (`L ∈ P_set`) and outer end `u`, and +`Q ≤ L` is a subpath of `L` from `b` to an end `e` of `L`, then `subgraphUnion S.G P Q` is an +`Ω`-path with ends `u` and `e`. -/ +theorem IsAttachmentWithEnds.isOmegaPathWithEnds_subgraphUnion (S : Society α β) + {P_set : Set (Graph α β)} {P L Q : Graph α β} {b u a₁ b₁ e : α} + (h : S.IsAttachmentWithEnds P_set P b u) + (hL : L ∈ P_set) (hbL : b ∈ V(L)) + (hL_ends : S.IsOmegaPathWithEnds L a₁ b₁) + (hQ : IsGraphPathWithEnds L Q b e) + (he : e = a₁ ∨ e = b₁) : + S.IsOmegaPathWithEnds (subgraphUnion S.G P Q) u e := by + have hinter : V(P) ∩ V(Q) = {b} := by + apply Subset.antisymm + · intro x ⟨hxP, hxQ⟩ + have hxL : x ∈ V(L) := hQ.le.vertexSet_mono hxQ + have hx_inter : x ∈ V(P) ∩ V(L) := ⟨hxP, hxL⟩ + rwa [h.inter_leg_eq_singleton S hL hbL] at hx_inter + · rintro x rfl + exact ⟨h.1.left_mem, hQ.left_mem⟩ + have hpath : IsGraphPathWithEnds S.G (subgraphUnion S.G P Q) u e := + h.1.symm.subgraphUnion (hQ.mono hL_ends.1.le) hinter + have he_mem : e ∈ S.transactionEnds P_set := by + rcases he with rfl | rfl + · exact hL_ends.mem_transactionEnds_left S hL + · exact hL_ends.mem_transactionEnds_right S hL + have he_bar : e ∈ S.Ω.bar := S.transactionEnds_subset_bar P_set he_mem + have hue : u ≠ e := fun h_eq => h.end_not_mem_transactionEnds S (h_eq ▸ he_mem) + exact ⟨hpath, hue, h.end_mem_bar S, he_bar⟩ + +theorem IsAttachmentWithEnds.disjoint_subgraphUnion_of_ne_leg (S : Society α β) + {P_set : Set (Graph α β)} (hdisj : S.IsDisjointOmegaPathSet P_set) + {P L Q R : Graph α β} {b u : α} + (h : S.IsAttachmentWithEnds P_set P b u) + (hL : L ∈ P_set) (hbL : b ∈ V(L)) (hQL : Q ≤ L) + (hR : R ∈ P_set) (hne : R ≠ L) : + Disjoint V(subgraphUnion S.G P Q) V(R) := by + rw [vertexSet_subgraphUnion, disjoint_union_left] + exact ⟨h.disjoint_of_ne_leg S hdisj hL hbL hR hne, + (hdisj.2 hL hR hne.symm).mono_left hQL.vertexSet_mono⟩ + +theorem IsAttachmentWithEnds.subgraphUnion_not_mem_sdiff (S : Society α β) + {P_set : Set (Graph α β)} (hdisj : S.IsDisjointOmegaPathSet P_set) + {P L Q : Graph α β} {b u : α} + (h : S.IsAttachmentWithEnds P_set P b u) + (hL : L ∈ P_set) (hbL : b ∈ V(L)) : + subgraphUnion S.G P Q ∉ P_set \ {L} := by + rintro ⟨h_in, hne⟩ + have hd := h.disjoint_of_ne_leg S hdisj hL hbL h_in hne + exact disjoint_left.mp hd h.1.left_mem (Or.inl h.1.left_mem) + +theorem IsAttachmentWithEnds.isDisjointOmegaPathSet_switch (S : Society α β) + {P_set : Set (Graph α β)} (hdisj : S.IsDisjointOmegaPathSet P_set) + {P L Q : Graph α β} {b u a₁ b₁ e : α} + (h : S.IsAttachmentWithEnds P_set P b u) + (hL : L ∈ P_set) (hbL : b ∈ V(L)) + (hL_ends : S.IsOmegaPathWithEnds L a₁ b₁) + (hQ : IsGraphPathWithEnds L Q b e) + (he : e = a₁ ∨ e = b₁) : + S.IsDisjointOmegaPathSet ((P_set \ {L}) ∪ {subgraphUnion S.G P Q}) := by + let L' := subgraphUnion S.G P Q + have hL'_ends : S.IsOmegaPathWithEnds L' u e := + h.isOmegaPathWithEnds_subgraphUnion S hL hbL hL_ends hQ he + refine ⟨?_, ?_⟩ + · rintro R (hR | rfl) + · exact hdisj.1 R hR.1 + · exact ⟨u, e, hL'_ends⟩ + · rintro R₁ (hR₁ | rfl) R₂ (hR₂ | rfl) hne + · exact hdisj.2 hR₁.1 hR₂.1 hne + · exact (h.disjoint_subgraphUnion_of_ne_leg S hdisj hL hbL hQ.le hR₁.1 hR₁.2).symm + · exact h.disjoint_subgraphUnion_of_ne_leg S hdisj hL hbL hQ.le hR₂.1 hR₂.2 + · exact (hne rfl).elim + +theorem IsAttachmentWithEnds.transactionEnds_switch (S : Society α β) + {P_set : Set (Graph α β)} {P L Q : Graph α β} {b u a₁ b₁ e : α} + (h : S.IsAttachmentWithEnds P_set P b u) + (hL : L ∈ P_set) (hbL : b ∈ V(L)) + (hL_ends : S.IsOmegaPathWithEnds L a₁ b₁) + (hQ : IsGraphPathWithEnds L Q b e) + (he : e = a₁ ∨ e = b₁) : + S.transactionEnds ((P_set \ {L}) ∪ {subgraphUnion S.G P Q}) = + S.transactionEnds (P_set \ {L}) ∪ {u, e} := by + let L' := subgraphUnion S.G P Q + have hL'_ends : S.IsOmegaPathWithEnds L' u e := + h.isOmegaPathWithEnds_subgraphUnion S hL hbL hL_ends hQ he + ext x + simp only [transactionEnds, mem_ofPred_eq, mem_union, mem_singleton_iff, mem_insert_iff] + constructor + · rintro ⟨R, hR | rfl, y, hR_ends⟩ + · exact Or.inl ⟨R, hR, y, hR_ends⟩ + · rcases hL'_ends.ends_eq S hR_ends with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inr (Or.inl rfl) + · exact Or.inr (Or.inr rfl) + · rintro (⟨R, hR, y, hR_ends⟩ | rfl | rfl) + · exact ⟨R, Or.inl hR, y, hR_ends⟩ + · exact ⟨L', Or.inr rfl, e, hL'_ends⟩ + · exact ⟨L', Or.inr rfl, u, hL'_ends.symm S⟩ + +theorem IsFenceFor.transactionEnds_eq_union (S : Society α β) + {P_set : Set (Graph α β)} {A B : Set α} + (_hfence : S.IsFenceFor P_set A B) + {L : Graph α β} {a₁ b₁ : α} (hL : L ∈ P_set) + (hL_ends : S.IsOmegaPathWithEnds L a₁ b₁) : + S.transactionEnds P_set = S.transactionEnds (P_set \ {L}) ∪ {a₁, b₁} := by + ext x + simp only [transactionEnds, mem_ofPred_eq, mem_union, mem_sdiff, mem_singleton_iff, + mem_insert_iff] + constructor + · rintro ⟨R, hR, y, hR_ends⟩ + by_cases hRL : R = L + · subst hRL + rcases hL_ends.ends_eq S hR_ends with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inr (Or.inl rfl) + · exact Or.inr (Or.inr rfl) + · exact Or.inl ⟨R, ⟨hR, hRL⟩, y, hR_ends⟩ + · rintro (⟨R, ⟨hR, _⟩, y, hR_ends⟩ | rfl | rfl) + · exact ⟨R, hR, y, hR_ends⟩ + · exact ⟨L, hL, b₁, hL_ends⟩ + · exact ⟨L, hL, a₁, hL_ends.symm S⟩ + +theorem IsFenceFor.not_mem_transactionEnds_diff_left (S : Society α β) + {P_set : Set (Graph α β)} {A B : Set α} + (hfence : S.IsFenceFor P_set A B) + {L : Graph α β} {a₁ b₁ : α} (hL : L ∈ P_set) + (hL_ends : S.IsOmegaPathWithEnds L a₁ b₁) : + a₁ ∉ S.transactionEnds (P_set \ {L}) := by + rintro ⟨R, ⟨hR, hne⟩, y, hR_ends⟩ + exact disjoint_left.mp (hfence.1.2 hL hR (Ne.symm hne)) hL_ends.1.left_mem hR_ends.1.left_mem + +theorem IsFenceFor.not_mem_transactionEnds_diff_right (S : Society α β) + {P_set : Set (Graph α β)} {A B : Set α} + (hfence : S.IsFenceFor P_set A B) + {L : Graph α β} {a₁ b₁ : α} (hL : L ∈ P_set) + (hL_ends : S.IsOmegaPathWithEnds L a₁ b₁) : + b₁ ∉ S.transactionEnds (P_set \ {L}) := by + rintro ⟨R, ⟨hR, hne⟩, y, hR_ends⟩ + exact disjoint_left.mp (hfence.1.2 hL hR (Ne.symm hne)) hL_ends.1.right_mem hR_ends.1.left_mem + +/-! ## Interval-fence helpers for switches in (3.2) -/ + +/-- If `W ⊆ S.Ω.bar` is partitioned into `A ∩ W` and `B ∩ W` by a fence `(A, B)` of `S.Ω`, and +`x₀ ∈ A ∩ W` satisfies `Disjoint (S.Ω.interval b' x₀) W` for some `b' ∈ B ∩ W`, then the interval +fence `(S.Ω.interval x₀ b, {b, x₀} ∪ S.Ω.interval b x₀)` (where `Disjoint (S.Ω.interval a' b) W`) +separates `(A ∩ W) \ {x₀}` from `(B ∩ W) ∪ {x₀}`. -/ +theorem exists_fence_separating_of_disjoint_BA {Ω : CyclicPerm α} {A B W : Set α} + (hfence : Ω.IsFence A B) (hW : W ⊆ Ω.bar) + {a' b b' x₀ : α} (ha' : a' ∈ A ∩ W) (hb : b ∈ B ∩ W) + (hb' : b' ∈ B ∩ W) (hx₀ : x₀ ∈ A ∩ W) + (hdisj_ab : Disjoint (Ω.interval a' b) W) + (hdisj_bx : Disjoint (Ω.interval b' x₀) W) : + ∃ A' B' : Set α, Ω.IsFence A' B' ∧ + (A ∩ W) \ {x₀} ⊆ A' ∧ (B ∩ W) ∪ {x₀} ⊆ B' := by + have hb_bar : b ∈ Ω.bar := hW hb.2 + have hx₀_bar : x₀ ∈ Ω.bar := hW hx₀.2 + have hbx₀ : b ≠ x₀ := fun h => disjoint_left.mp hfence.2.2.1 hx₀.1 (h ▸ hb.1) + refine ⟨Ω.interval x₀ b, {b, x₀} ∪ Ω.interval b x₀, + (Ω.isFence_interval_compl hb_bar hx₀_bar hbx₀).symm, ?_, ?_⟩ + · intro x ⟨hxA, hx_ne⟩ + exact Ω.mem_interval_rotate_left + (Ω.mem_interval_of_mem_B_of_disjoint_AB hfence.symm hW hb' hx₀ hdisj_bx hb hxA hx_ne).1 + · rintro y (hyB | rfl) + · by_cases hyb : y = b + · exact Or.inl (Or.inl hyb) + · exact Or.inr (Ω.mem_interval_rotate_left + (Ω.mem_interval_of_mem_B_of_disjoint_AB hfence hW ha' hb hdisj_ab hx₀ hyB hyb).1) + · exact Or.inl (Or.inr rfl) + +/-- Dual version: if `x₀ ∈ A ∩ W` satisfies `Disjoint (Ω.interval x₀ b) W` for some `b ∈ B ∩ W`, +then the interval fence `(Ω.interval b' x₀, {x₀, b'} ∪ Ω.interval x₀ b')` separates +`(A ∩ W) \ {x₀}` from `(B ∩ W) ∪ {x₀}`. -/ +theorem exists_fence_separating_of_disjoint_AB {Ω : CyclicPerm α} {A B W : Set α} + (hfence : Ω.IsFence A B) (hW : W ⊆ Ω.bar) + {a b b' x₀ : α} (ha : a ∈ A ∩ W) (hb : b ∈ B ∩ W) + (hb' : b' ∈ B ∩ W) (hx₀ : x₀ ∈ A ∩ W) + (hdisj_ba : Disjoint (Ω.interval b' a) W) + (hdisj_xb : Disjoint (Ω.interval x₀ b) W) : + ∃ A' B' : Set α, Ω.IsFence A' B' ∧ + (A ∩ W) \ {x₀} ⊆ A' ∧ (B ∩ W) ∪ {x₀} ⊆ B' := by + have hb'_bar : b' ∈ Ω.bar := hW hb'.2 + have hx₀_bar : x₀ ∈ Ω.bar := hW hx₀.2 + have hx₀b' : x₀ ≠ b' := fun h => disjoint_left.mp hfence.2.2.1 hx₀.1 (h ▸ hb'.1) + refine ⟨Ω.interval b' x₀, {x₀, b'} ∪ Ω.interval x₀ b', + (Ω.isFence_interval_compl hx₀_bar hb'_bar hx₀b').symm, ?_, ?_⟩ + · intro x ⟨hxA, hx_ne⟩ + exact Ω.mem_interval_rotate_right + (Ω.mem_interval_of_mem_A_of_disjoint_AB hfence hW hx₀ hb hdisj_xb hxA hx_ne hb').1 + · rintro y (hyB | rfl) + · by_cases hyb' : y = b' + · exact Or.inl (Or.inr hyb') + · exact Or.inr (Ω.mem_interval_rotate_right + (Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.symm hW hb' ha hdisj_ba hyB hyb' hx₀).1) + · exact Or.inl (Or.inl rfl) + +/-! ## Proof of (3.2) -/ + +/-- **Graph Minors IX, (3.2), Claim (1)** (page 47): +"Either $u^- = b_1$, or $a_1 = a'$ and there exists $P_2 \in \mathscr{P} - \{P_1\}$ with ends +$a_1^+, a_1^-$. In either case $a_1^- \ne u$." + +Expressed in terms of intervals of `S.Ω` and `W = V(P_set) ∪ {u}`, when `u ∈ A` and `(u, a₁, b₁)` +is clockwise (`a₁ ∈ S.Ω.interval u b₁`): +either `Disjoint (S.Ω.interval b₁ u) W`, or `Disjoint (S.Ω.interval a₁ b) W` and there exists +`P₂ ∈ P_set \ {P₁}` peripheral in `P_set \ {P₁}` with ends `a₂ ∈ A`, `b₂ ∈ B` such that +`a₁ ∈ S.Ω.interval a₂ b₂` and `Disjoint (S.Ω.interval a₂ b₂) (W \ {a₁})`. In either case +`¬ Disjoint (S.Ω.interval u a₁) W`. -/ +theorem lemma_3_2_claim_1 (S : Society α β) + {P_set : Set (Graph α β)} {A B : Set α} + (hcrooked : S.IsCrookedTransaction P_set) + (hfence : S.IsFenceFor P_set A B) + {P P₁ Q_b : Graph α β} {v u a₁ b₁ : α} + (hatt : S.IsAttachmentWithEnds P_set P v u) + (hnot_exch : ¬ S.IsExchangeableAttachment P_set P) + (hP₁ : P₁ ∈ P_set) (hvP₁ : v ∈ V(P₁)) + (hP₁_ends : S.IsOmegaPathWithEnds P₁ a₁ b₁) + (ha₁ : a₁ ∈ A) (hb₁ : b₁ ∈ B) (huA : u ∈ A) + (hcw : a₁ ∈ S.Ω.interval u b₁) + (hQ_b : IsGraphPathWithEnds P₁ Q_b v b₁) : + let W := S.transactionEnds P_set ∪ {u} + (Disjoint (S.Ω.interval b₁ u) W ∨ + ∃ P₂ ∈ P_set \ {P₁}, S.IsPeripheralIn (P_set \ {P₁}) P₂ ∧ + ∃ a₂ ∈ A, ∃ b₂ ∈ B, S.IsOmegaPathWithEnds P₂ a₂ b₂ ∧ + a₁ ∈ S.Ω.interval a₂ b₂ ∧ Disjoint (S.Ω.interval a₂ b₂) (W \ {a₁})) ∧ + ¬ Disjoint (S.Ω.interval u a₁) W := by + intro W + let T_sw := subgraphUnion S.G P Q_b + let T_set := (P_set \ {P₁}) ∪ {T_sw} + have hT_ends : S.IsOmegaPathWithEnds T_sw u b₁ := + hatt.isOmegaPathWithEnds_subgraphUnion S hP₁ hvP₁ hP₁_ends hQ_b (Or.inr rfl) + have hT_disj : S.IsDisjointOmegaPathSet T_set := + hatt.isDisjointOmegaPathSet_switch S hfence.1 hP₁ hvP₁ hP₁_ends hQ_b (Or.inr rfl) + have hT_fence : S.IsFenceFor T_set A B := by + refine ⟨hT_disj, hfence.2.1, ?_⟩ + rintro R (hR | rfl) + · exact hfence.2.2 R hR.1 + · exact ⟨u, huA, b₁, hb₁, hT_ends⟩ + have hT_not_crooked : ¬ S.IsCrookedTransaction T_set := fun hcr => + hnot_exch ⟨⟨v, u, hatt⟩, P₁, T_sw, + ⟨hP₁, v, u, a₁, b₁, hatt, hvP₁, hP₁_ends, Q_b, Or.inr hQ_b, rfl⟩, hcr⟩ + have hW_eq : S.transactionEnds T_set = W \ {a₁} := by + rw [hatt.transactionEnds_switch S hP₁ hvP₁ hP₁_ends hQ_b (Or.inr rfl)] + have hP_eq := hfence.transactionEnds_eq_union S hP₁ hP₁_ends + have ha₁_not_W' := hfence.not_mem_transactionEnds_diff_left S hP₁ hP₁_ends + have hua₁ : u ≠ a₁ := fun h => (hatt.end_not_mem_transactionEnds S) + (h ▸ hP₁_ends.mem_transactionEnds_left S hP₁) + have ha₁b₁ : a₁ ≠ b₁ := hP₁_ends.2.1 + ext x + simp only [W, hP_eq, mem_union, mem_insert_iff, mem_singleton_iff, mem_sdiff] + constructor + · rintro (hx | rfl | rfl) + · exact ⟨Or.inl (Or.inl hx), fun h => ha₁_not_W' (h ▸ hx)⟩ + · exact ⟨Or.inr rfl, hua₁⟩ + · exact ⟨Or.inl (Or.inr (Or.inr rfl)), ha₁b₁.symm⟩ + · rintro ⟨(hx | rfl | rfl) | rfl, hne⟩ + · exact Or.inl hx + · exact (hne rfl).elim + · exact Or.inr (Or.inr rfl) + · exact Or.inr (Or.inl rfl) + have hPW_eq : S.transactionEnds P_set = W \ {u} := by + ext x + simp only [W, mem_union, mem_singleton_iff, mem_sdiff] + exact ⟨fun hx => ⟨Or.inl hx, fun h => (hatt.end_not_mem_transactionEnds S) (h ▸ hx)⟩, + fun ⟨hx, hne⟩ => hx.resolve_right hne⟩ + -- Since `T_set` is a transaction and not crooked, it has a peripheral member `M`. + have hex_per : ∃ M ∈ T_set, S.IsPeripheralIn T_set M := by + by_contra! hno + exact hT_not_crooked ⟨⟨A, B, hT_fence⟩, hno⟩ + -- First note that `S.Ω.interval u a₁` cannot be disjoint from `W` if `S.Ω.interval b₁ u` is, + -- nor if some `a₂ ∈ W` lies in `S.Ω.interval u a₁`. + have hub₁_split : S.Ω.interval u b₁ = S.Ω.interval u a₁ ∪ {a₁} ∪ S.Ω.interval a₁ b₁ := + S.Ω.interval_eq_union_of_mem hcw + have hb₁a₁_split : S.Ω.interval b₁ a₁ = S.Ω.interval b₁ u ∪ {u} ∪ S.Ω.interval u a₁ := + S.Ω.interval_eq_union_of_mem (S.Ω.mem_interval_rotate_right hcw) + rcases hex_per with ⟨M, hM_in, hM_per⟩ + rcases hM_in with hM_diff | rfl + · -- `M = P₂ ∈ P_set \ {P₁}` is peripheral in `T_set`. + obtain ⟨a₂, ha₂, b₂, hb₂, hP₂_ends⟩ := hfence.2.2 M hM_diff.1 + have hM_per' := (hP₂_ends.isPeripheralIn_iff S (Or.inl hM_diff)).mp hM_per + rw [hW_eq] at hM_per' + have hW'_sub : S.transactionEnds (P_set \ {P₁}) ⊆ W \ {a₁} := by + rw [← hW_eq, hatt.transactionEnds_switch S hP₁ hvP₁ hP₁_ends hQ_b (Or.inr rfl)] + exact subset_union_left + have hM_per_diff : S.IsPeripheralIn (P_set \ {P₁}) M := by + refine ⟨hM_diff, a₂, b₂, hP₂_ends, ?_⟩ + rcases hM_per' with hd | hd + · exact Or.inl (hd.mono_right hW'_sub) + · exact Or.inr (hd.mono_right hW'_sub) + -- `M` is not peripheral in `P_set`, so its `W \ {a₁}`-disjoint interval must contain `a₁`. + have hnot_per_P : ¬ S.IsPeripheralIn P_set M := hcrooked.2 M hM_diff.1 + rcases hM_per' with hd_ab | hd_ba + · have ha₁_in : a₁ ∈ S.Ω.interval a₂ b₂ := by + by_contra ha₁_not + apply hnot_per_P + refine ⟨hM_diff.1, a₂, b₂, hP₂_ends, Or.inl ?_⟩ + rw [hPW_eq, disjoint_left] + intro z hz ⟨hzW, _⟩ + have hza₁ : z ≠ a₁ := fun h => ha₁_not (h ▸ hz) + exact disjoint_left.mp hd_ab hz ⟨hzW, hza₁⟩ + have ha₂_in_ua₁ : a₂ ∈ S.Ω.interval u a₁ := by + have hu_not : u ∉ S.Ω.interval a₂ b₂ := + fun hu_in => disjoint_left.mp hd_ab hu_in + ⟨Or.inr rfl, fun h => (hatt.end_not_mem_transactionEnds S) + (h ▸ hP₁_ends.mem_transactionEnds_left S hP₁)⟩ + have hua₂ : u ≠ a₂ := fun h => (hatt.end_not_mem_transactionEnds S) + (h ▸ hP₂_ends.mem_transactionEnds_left S hM_diff.1) + have hub₂ : u ≠ b₂ := fun h => (hatt.end_not_mem_transactionEnds S) + (h ▸ hP₂_ends.mem_transactionEnds_right S hM_diff.1) + have hu_b₂a₂ : u ∈ S.Ω.interval b₂ a₂ := + (S.Ω.mem_interval_or_interval_swap hP₂_ends.2.2.1 hP₂_ends.2.2.2 (hatt.end_mem_bar S) + hP₂_ends.2.1 hua₂ hub₂).resolve_left hu_not + have hcw4 : S.Ω.IsClockwise4 a₂ a₁ b₂ u := S.Ω.isClockwise4_iff_interval.mpr ⟨ha₁_in, + hu_b₂a₂⟩ + exact (S.Ω.isClockwise4_iff_interval.mp (S.Ω.isClockwise4_rotate hcw4)).2 + have hnot_ua₁ : ¬ Disjoint (S.Ω.interval u a₁) W := fun hd => + disjoint_left.mp hd ha₂_in_ua₁ (Or.inl (hP₂_ends.mem_transactionEnds_left S hM_diff.1)) + exact ⟨Or.inr ⟨M, hM_diff, hM_per_diff, a₂, ha₂, b₂, hb₂, hP₂_ends, ha₁_in, hd_ab⟩, hnot_ua₁⟩ + · -- Can `a₁ ∈ S.Ω.interval b₂ a₂` with `Disjoint (S.Ω.interval b₂ a₂) (W \ {a₁})`? + -- No: then `u, b₁ ∉ S.Ω.interval b₂ a₂`, so `b₂, a₂` would separate `a₁` from `u, b₁`, + -- forcing `a₁ ∈ S.Ω.interval b₁ u`, contradicting `a₁ ∈ S.Ω.interval u b₁`! + exfalso + have ha₁_in : a₁ ∈ S.Ω.interval b₂ a₂ := by + by_contra ha₁_not + apply hnot_per_P + refine ⟨hM_diff.1, a₂, b₂, hP₂_ends, Or.inr ?_⟩ + rw [hPW_eq, disjoint_left] + intro z hz ⟨hzW, _⟩ + have hza₁ : z ≠ a₁ := fun h => ha₁_not (h ▸ hz) + exact disjoint_left.mp hd_ba hz ⟨hzW, hza₁⟩ + have ha₁_b₂a₁_sub : S.Ω.interval b₂ a₁ ⊆ S.Ω.interval b₂ a₂ := + S.Ω.interval_subset_interval_left ha₁_in + have hd_b₂a₁ : Disjoint (S.Ω.interval b₂ a₁) W := by + rw [disjoint_left] + intro z hz hzW + have hza₁ : z ≠ a₁ := fun h => S.Ω.not_mem_interval_right b₂ a₁ (h ▸ hz) + exact disjoint_left.mp hd_ba (ha₁_b₂a₁_sub hz) ⟨hzW, hza₁⟩ + have hW_bar : W ⊆ S.Ω.bar := union_subset (S.transactionEnds_subset_bar P_set) + (singleton_subset_iff.mpr (hatt.end_mem_bar S)) + have hb₂W : b₂ ∈ B ∩ W := ⟨hb₂, Or.inl (hP₂_ends.mem_transactionEnds_right S hM_diff.1)⟩ + have ha₁W : a₁ ∈ A ∩ W := ⟨ha₁, Or.inl (hP₁_ends.mem_transactionEnds_left S hP₁)⟩ + have hb₁W : b₁ ∈ B ∩ W := ⟨hb₁, Or.inl (hP₁_ends.mem_transactionEnds_right S hP₁)⟩ + have huW : u ∈ A ∩ W := ⟨huA, Or.inr rfl⟩ + have hua₁ : u ≠ a₁ := fun h => (hatt.end_not_mem_transactionEnds S) + (h ▸ hP₁_ends.mem_transactionEnds_left S hP₁) + have ha₁_b₁u : a₁ ∈ S.Ω.interval b₁ u := + (S.Ω.mem_interval_of_mem_B_of_disjoint_AB hfence.2.1.symm hW_bar hb₂W ha₁W hd_b₂a₁ + hb₁W huW hua₁).1 + exact disjoint_left.mp (S.Ω.disjoint_interval_swap u b₁) hcw ha₁_b₁u + · -- `M = T_sw` is peripheral in `T_set`. + have hT_per := (hT_ends.isPeripheralIn_iff S (Or.inr rfl)).mp hM_per + rw [hW_eq] at hT_per + rcases hT_per with hd_ub₁ | hd_b₁u + · -- `Disjoint (S.Ω.interval u b₁) (W \ {a₁})` implies `Disjoint (S.Ω.interval a₁ b₁) (W \ + -- {u})`, + -- so `P₁` is peripheral in `P_set`, contradiction. + exfalso + have hd_a₁b₁ : Disjoint (S.Ω.interval a₁ b₁) (S.transactionEnds P_set) := by + rw [hPW_eq, disjoint_left] + intro z hz ⟨hzW, _⟩ + have hza₁ : z ≠ a₁ := fun h => S.Ω.not_mem_interval_left a₁ b₁ (h ▸ hz) + have hz_ub₁ : z ∈ S.Ω.interval u b₁ := S.Ω.interval_subset_interval_right hcw hz + exact disjoint_left.mp hd_ub₁ hz_ub₁ ⟨hzW, hza₁⟩ + exact hcrooked.2 P₁ hP₁ ⟨hP₁, a₁, b₁, hP₁_ends, Or.inl hd_a₁b₁⟩ + · -- `Disjoint (S.Ω.interval b₁ u) (W \ {a₁})`: since `a₁ ∉ S.Ω.interval b₁ u`, this gives + -- `Disjoint (S.Ω.interval b₁ u) W`. + have hd_b₁u_W : Disjoint (S.Ω.interval b₁ u) W := by + rw [disjoint_left] + intro z hz hzW + have hza₁ : z ≠ a₁ := fun h => + disjoint_left.mp (S.Ω.disjoint_interval_swap u b₁) hcw (h ▸ hz) + exact disjoint_left.mp hd_b₁u hz ⟨hzW, hza₁⟩ + have hnot_ua₁ : ¬ Disjoint (S.Ω.interval u a₁) W := by + intro hd_ua₁ + have hd_b₁a₁ : Disjoint (S.Ω.interval b₁ a₁) (S.transactionEnds P_set) := by + rw [hPW_eq, hb₁a₁_split, disjoint_left] + rintro z ((hz | rfl) | hz) ⟨hzW, hzu⟩ + · exact disjoint_left.mp hd_b₁u_W hz hzW + · exact hzu rfl + · exact disjoint_left.mp hd_ua₁ hz hzW + exact hcrooked.2 P₁ hP₁ ⟨hP₁, a₁, b₁, hP₁_ends, Or.inr hd_b₁a₁⟩ + exact ⟨Or.inl hd_b₁u_W, hnot_ua₁⟩ + +/-- **Graph Minors IX, (3.2), Claim (2)** (page 48): +"Either `a ≠ u` or `b = b₁`." + +Expressed in terms of intervals of `S.Ω` and `W = V(P_set) ∪ {u}`: if `Disjoint (S.Ω.interval b' u) +W` +for some `b' ∈ B ∩ W` (`a = u`), then `Disjoint (S.Ω.interval a' b₁) W` (`b = b₁`), which is +impossible since `|B ∩ W| ≥ 2`. -/ +theorem lemma_3_2_claim_2 (S : Society α β) + {P_set : Set (Graph α β)} {A B : Set α} + (hcrooked : S.IsCrookedTransaction P_set) + (hfence : S.IsFenceFor P_set A B) + {P P₁ Q_a : Graph α β} {v u a₁ b₁ : α} + (hatt : S.IsAttachmentWithEnds P_set P v u) + (hnot_exch : ¬ S.IsExchangeableAttachment P_set P) + (hP₁ : P₁ ∈ P_set) (hvP₁ : v ∈ V(P₁)) + (hP₁_ends : S.IsOmegaPathWithEnds P₁ a₁ b₁) + (ha₁ : a₁ ∈ A) (hb₁ : b₁ ∈ B) (huA : u ∈ A) + (hcw : a₁ ∈ S.Ω.interval u b₁) + (hQ_a : IsGraphPathWithEnds P₁ Q_a v a₁) : + let W := S.transactionEnds P_set ∪ {u} + ¬ Disjoint (S.Ω.interval b₁ u) W := by + intro W hd_b₁u + let S_sw := subgraphUnion S.G P Q_a + let S_set := (P_set \ {P₁}) ∪ {S_sw} + have hS_ends : S.IsOmegaPathWithEnds S_sw u a₁ := + hatt.isOmegaPathWithEnds_subgraphUnion S hP₁ hvP₁ hP₁_ends hQ_a (Or.inl rfl) + have hS_disj : S.IsDisjointOmegaPathSet S_set := + hatt.isDisjointOmegaPathSet_switch S hfence.1 hP₁ hvP₁ hP₁_ends hQ_a (Or.inl rfl) + have hW_bar : W ⊆ S.Ω.bar := union_subset (S.transactionEnds_subset_bar P_set) + (singleton_subset_iff.mpr (hatt.end_mem_bar S)) + have hW_AB : W ⊆ A ∪ B := hfence.2.1.2.2.2.1 ▸ hW_bar + have ha₁W : a₁ ∈ A ∩ W := ⟨ha₁, Or.inl (hP₁_ends.mem_transactionEnds_left S hP₁)⟩ + have hb₁W : b₁ ∈ B ∩ W := ⟨hb₁, Or.inl (hP₁_ends.mem_transactionEnds_right S hP₁)⟩ + have huW : u ∈ A ∩ W := ⟨huA, Or.inr rfl⟩ + obtain ⟨a', ha'W, b, hbW, hdisj_a'b⟩ := + S.Ω.exists_empty_interval_AB_of_subset_union hW_bar hW_AB ⟨a₁, ha₁W⟩ ⟨b₁, hb₁W⟩ + obtain ⟨A', B', hfence_A'B', hsubA', hsubB'⟩ := + exists_fence_separating_of_disjoint_BA hfence.2.1 hW_bar ha'W hbW hb₁W huW hdisj_a'b hd_b₁u + have hS_fence : S.IsFenceFor S_set A' B' := by + refine ⟨hS_disj, hfence_A'B', ?_⟩ + rintro R (hR | rfl) + · obtain ⟨a_R, ha_R, b_R, hb_R, hR_ends⟩ := hfence.2.2 R hR.1 + have ha_R_W : a_R ∈ A ∩ W := ⟨ha_R, Or.inl (hR_ends.mem_transactionEnds_left S hR.1)⟩ + have hb_R_W : b_R ∈ B ∩ W := ⟨hb_R, Or.inl (hR_ends.mem_transactionEnds_right S hR.1)⟩ + have ha_R_ne_u : a_R ≠ u := + fun h => (hatt.end_not_mem_transactionEnds S) (h ▸ hR_ends.mem_transactionEnds_left S hR.1) + exact ⟨a_R, hsubA' ⟨ha_R_W, ha_R_ne_u⟩, b_R, hsubB' (Or.inl hb_R_W), hR_ends⟩ + · have ha₁_ne_u : a₁ ≠ u := + fun h => (hatt.end_not_mem_transactionEnds S) (h ▸ hP₁_ends.mem_transactionEnds_left S hP₁) + exact ⟨a₁, hsubA' ⟨ha₁W, ha₁_ne_u⟩, u, hsubB' (Or.inr rfl), hS_ends.symm S⟩ + have hS_not_crooked : ¬ S.IsCrookedTransaction S_set := fun hcr => + hnot_exch ⟨⟨v, u, hatt⟩, P₁, S_sw, + ⟨hP₁, v, u, a₁, b₁, hatt, hvP₁, hP₁_ends, Q_a, Or.inl hQ_a, rfl⟩, hcr⟩ + -- Since `P_set` is crooked and `P₁ ∈ P_set`, there is at least one other member `P₀ ∈ P_set \ + -- {P₁}`. + obtain ⟨P_x, hPx_in, P_y, hPy_in, hPxy, _⟩ := S.exists_crooked_pair_of_nonempty hcrooked ⟨P₁, hP₁⟩ + have hex_other : ∃ P₀ ∈ P_set \ {P₁}, True := by + by_cases h1 : P_x = P₁ + · exact ⟨P_y, ⟨hPy_in, h1 ▸ hPxy.symm⟩, trivial⟩ + · exact ⟨P_x, ⟨hPx_in, h1⟩, trivial⟩ + obtain ⟨P₀, hP₀_diff, _⟩ := hex_other + obtain ⟨a₀, ha₀, b₀, hb₀, hP₀_ends⟩ := hfence.2.2 P₀ hP₀_diff.1 + have hb₀W : b₀ ∈ B ∩ W := ⟨hb₀, Or.inl (hP₀_ends.mem_transactionEnds_right S hP₀_diff.1)⟩ + have hb₀_ne_b₁ : b₀ ≠ b₁ := fun h => + disjoint_left.mp (hfence.1.2 hP₀_diff.1 hP₁ hP₀_diff.2) + hP₀_ends.1.right_mem (h ▸ hP₁_ends.1.right_mem) + -- Notice `b ≠ b₁`: if `b = b₁`, then `Disjoint (interval a' b₁) W` and `Disjoint (interval b₁ u) + -- W` + -- give `b₁ ∈ interval a' b₀` and `b₁ ∈ interval b₀ a'`, contradiction. + have hb_ne_b₁ : b ≠ b₁ := by + intro h_eq + have h1 : b₁ ∈ S.Ω.interval a' b₀ := + (S.Ω.mem_interval_of_mem_B_of_disjoint_AB hfence.2.1 hW_bar ha'W hb₁W (h_eq ▸ hdisj_a'b) + ha'W hb₀W hb₀_ne_b₁).1 + have h2 : b₁ ∈ S.Ω.interval b₀ a' := + (S.Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.2.1.symm hW_bar hb₁W huW hd_b₁u + hb₀W hb₀_ne_b₁ ha'W).1 + exact disjoint_left.mp (S.Ω.disjoint_interval_swap a' b₀) h1 h2 + -- Yet `S_set` is not crooked, so some member `M ∈ S_set` is peripheral in `S_set`. + have hex_per : ∃ M ∈ S_set, S.IsPeripheralIn S_set M := by + by_contra! hno + exact hS_not_crooked ⟨⟨A', B', hS_fence⟩, hno⟩ + have hSW_eq : S.transactionEnds S_set = W \ {b₁} := by + rw [hatt.transactionEnds_switch S hP₁ hvP₁ hP₁_ends hQ_a (Or.inl rfl)] + have hP_eq := hfence.transactionEnds_eq_union S hP₁ hP₁_ends + have hb₁_not_W' := hfence.not_mem_transactionEnds_diff_right S hP₁ hP₁_ends + have hub₁ : u ≠ b₁ := fun h => (hatt.end_not_mem_transactionEnds S) + (h ▸ hP₁_ends.mem_transactionEnds_right S hP₁) + have ha₁b₁ : a₁ ≠ b₁ := hP₁_ends.2.1 + ext x + simp only [W, hP_eq, mem_union, mem_insert_iff, mem_singleton_iff, mem_sdiff] + constructor + · rintro (hx | rfl | rfl) + · exact ⟨Or.inl (Or.inl hx), fun h => hb₁_not_W' (h ▸ hx)⟩ + · exact ⟨Or.inr rfl, hub₁⟩ + · exact ⟨Or.inl (Or.inr (Or.inl rfl)), ha₁b₁⟩ + · rintro ⟨(hx | rfl | rfl) | rfl, hne⟩ + · exact Or.inl hx + · exact Or.inr (Or.inr rfl) + · exact (hne rfl).elim + · exact Or.inr (Or.inl rfl) + have hPW_eq : S.transactionEnds P_set = W \ {u} := by + ext x + simp only [W, mem_union, mem_singleton_iff, mem_sdiff] + exact ⟨fun hx => ⟨Or.inl hx, fun h => (hatt.end_not_mem_transactionEnds S) (h ▸ hx)⟩, + fun ⟨hx, hne⟩ => hx.resolve_right hne⟩ + rcases hex_per with ⟨M, hM_in, hM_per⟩ + rcases hM_in with hM_diff | rfl + · -- `M = P₃ ∈ P_set \ {P₁}` is peripheral in `S_set`. + obtain ⟨a₃, ha₃, b₃, hb₃, hP₃_ends⟩ := hfence.2.2 M hM_diff.1 + have hM_per' := (hP₃_ends.isPeripheralIn_iff S (Or.inl hM_diff)).mp hM_per + rw [hSW_eq] at hM_per' + have hnot_per_P : ¬ S.IsPeripheralIn P_set M := hcrooked.2 M hM_diff.1 + have ha₃W : a₃ ∈ A ∩ W := ⟨ha₃, Or.inl (hP₃_ends.mem_transactionEnds_left S hM_diff.1)⟩ + have hb₃W : b₃ ∈ B ∩ W := ⟨hb₃, Or.inl (hP₃_ends.mem_transactionEnds_right S hM_diff.1)⟩ + rcases hM_per' with hd_ab | hd_ba + · have hb₁_in : b₁ ∈ S.Ω.interval a₃ b₃ := by + by_contra hb₁_not + apply hnot_per_P + refine ⟨hM_diff.1, a₃, b₃, hP₃_ends, Or.inl ?_⟩ + rw [hPW_eq, disjoint_left] + intro z hz ⟨hzW, _⟩ + have hzb₁ : z ≠ b₁ := fun h => hb₁_not (h ▸ hz) + exact disjoint_left.mp hd_ab hz ⟨hzW, hzb₁⟩ + have hd_a₃b₁ : Disjoint (S.Ω.interval a₃ b₁) W := by + rw [disjoint_left] + intro z hz hzW + have hzb₁ : z ≠ b₁ := fun h => S.Ω.not_mem_interval_right a₃ b₁ (h ▸ hz) + exact disjoint_left.mp hd_ab (S.Ω.interval_subset_interval_left hb₁_in hz) ⟨hzW, hzb₁⟩ + have hb_eq : b = b₁ := + (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1 hW_bar ha'W hbW ha₃W hb₁W + hdisj_a'b hd_a₃b₁).2 + exact hb_ne_b₁ hb_eq + · have hb₁_in : b₁ ∈ S.Ω.interval b₃ a₃ := by + by_contra hb₁_not + apply hnot_per_P + refine ⟨hM_diff.1, a₃, b₃, hP₃_ends, Or.inr ?_⟩ + rw [hPW_eq, disjoint_left] + intro z hz ⟨hzW, _⟩ + have hzb₁ : z ≠ b₁ := fun h => hb₁_not (h ▸ hz) + exact disjoint_left.mp hd_ba hz ⟨hzW, hzb₁⟩ + have hd_b₁a₃ : Disjoint (S.Ω.interval b₁ a₃) W := by + rw [disjoint_left] + intro z hz hzW + have hzb₁ : z ≠ b₁ := fun h => S.Ω.not_mem_interval_left b₁ a₃ (h ▸ hz) + exact disjoint_left.mp hd_ba (S.Ω.interval_subset_interval_right hb₁_in hz) ⟨hzW, hzb₁⟩ + have hu_eq : u = a₃ := + (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1.symm hW_bar hb₁W huW hb₁W ha₃W + hd_b₁u hd_b₁a₃).2 + exact (hatt.end_not_mem_transactionEnds S) (hu_eq ▸ hP₃_ends.mem_transactionEnds_left S + hM_diff.1) + · -- `M = S_sw` is peripheral in `S_set`. + have hS_per := (hS_ends.isPeripheralIn_iff S (Or.inr rfl)).mp hM_per + rw [hSW_eq] at hS_per + rcases hS_per with hd_ua₁ | hd_a₁u + · -- `Disjoint (S.Ω.interval u a₁) (W \ {b₁})`: since `b₁ ∉ S.Ω.interval u a₁`, this gives + -- `Disjoint (S.Ω.interval u a₁) W`, contradicting Claim (1). + have hd_ua₁_W : Disjoint (S.Ω.interval u a₁) W := by + rw [disjoint_left] + intro z hz hzW + have hzb₁ : z ≠ b₁ := fun h => by + have hb₁_a₁u : b₁ ∈ S.Ω.interval a₁ u := S.Ω.mem_interval_rotate_left hcw + exact disjoint_left.mp (S.Ω.disjoint_interval_swap u a₁) hz (h ▸ hb₁_a₁u) + exact disjoint_left.mp hd_ua₁ hz ⟨hzW, hzb₁⟩ + have hb₁a₁_split : S.Ω.interval b₁ a₁ = S.Ω.interval b₁ u ∪ {u} ∪ S.Ω.interval u a₁ := + S.Ω.interval_eq_union_of_mem (S.Ω.mem_interval_rotate_right hcw) + have hd_b₁a₁ : Disjoint (S.Ω.interval b₁ a₁) (S.transactionEnds P_set) := by + rw [hPW_eq, hb₁a₁_split, disjoint_left] + rintro z ((hz | rfl) | hz) ⟨hzW, hzu⟩ + · exact disjoint_left.mp hd_b₁u hz hzW + · exact hzu rfl + · exact disjoint_left.mp hd_ua₁_W hz hzW + exact hcrooked.2 P₁ hP₁ ⟨hP₁, a₁, b₁, hP₁_ends, Or.inr hd_b₁a₁⟩ + · -- `Disjoint (S.Ω.interval a₁ u) (W \ {b₁})`: yet `b₀ ∈ B ∩ W \ {b₁}` lies in `S.Ω.interval a₁ + -- u`! + have hb₁_b₀a₁ : b₁ ∈ S.Ω.interval b₀ a₁ := + (S.Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.2.1.symm hW_bar hb₁W huW hd_b₁u + hb₀W hb₀_ne_b₁ ha₁W).1 + have hb₀_a₁b₁ : b₀ ∈ S.Ω.interval a₁ b₁ := S.Ω.mem_interval_rotate_right hb₁_b₀a₁ + have hb₁_a₁u : b₁ ∈ S.Ω.interval a₁ u := S.Ω.mem_interval_rotate_left hcw + have hb₀_a₁u : b₀ ∈ S.Ω.interval a₁ u := + S.Ω.interval_subset_interval_left hb₁_a₁u hb₀_a₁b₁ + exact disjoint_left.mp hd_a₁u hb₀_a₁u ⟨ hb₀W.2, hb₀_ne_b₁⟩ + +/-- **Graph Minors IX, (3.2), Claim (3)** (page 48): +"Either $a' \ne a_1$ or there exists $P_3 \in \mathscr{P} - \{P_1\}$ with ends $b_1^+, b_1^-$." -/ +theorem lemma_3_2_claim_3 (S : Society α β) + {P_set : Set (Graph α β)} {A B : Set α} + (_hcrooked : S.IsCrookedTransaction P_set) + (hfence : S.IsFenceFor P_set A B) + {P P₁ P₂ Q_a : Graph α β} {v u a₁ b₁ a₂ b₂ : α} + (hatt : S.IsAttachmentWithEnds P_set P v u) + (hnot_exch : ¬ S.IsExchangeableAttachment P_set P) + (hP₁ : P₁ ∈ P_set) (hvP₁ : v ∈ V(P₁)) + (hP₁_ends : S.IsOmegaPathWithEnds P₁ a₁ b₁) + (ha₁ : a₁ ∈ A) (hb₁ : b₁ ∈ B) (huA : u ∈ A) + (hQ_a : IsGraphPathWithEnds P₁ Q_a v a₁) + (hP₂ : P₂ ∈ P_set \ {P₁}) + (hP₂_ends : S.IsOmegaPathWithEnds P₂ a₂ b₂) + (_ha₂ : a₂ ∈ A) (hb₂ : b₂ ∈ B) + (ha₁_in_P₂ : a₁ ∈ S.Ω.interval a₂ b₂) + (hd_P₂ : Disjoint (S.Ω.interval a₂ b₂) ((S.transactionEnds P_set ∪ {u}) \ {a₁})) : + ∃ P₃ ∈ P_set \ {P₁}, P₃ ≠ P₂ ∧ S.IsPeripheralIn (P_set \ {P₁}) P₃ := by + let W := S.transactionEnds P_set ∪ {u} + let S_sw := subgraphUnion S.G P Q_a + let S_set := (P_set \ {P₁}) ∪ {S_sw} + have hS_ends : S.IsOmegaPathWithEnds S_sw u a₁ := + hatt.isOmegaPathWithEnds_subgraphUnion S hP₁ hvP₁ hP₁_ends hQ_a (Or.inl rfl) + have hS_disj : S.IsDisjointOmegaPathSet S_set := + hatt.isDisjointOmegaPathSet_switch S hfence.1 hP₁ hvP₁ hP₁_ends hQ_a (Or.inl rfl) + have hW_bar : W ⊆ S.Ω.bar := union_subset (S.transactionEnds_subset_bar P_set) + (singleton_subset_iff.mpr (hatt.end_mem_bar S)) + have hW_AB : W ⊆ A ∪ B := hfence.2.1.2.2.2.1 ▸ hW_bar + have ha₁W : a₁ ∈ A ∩ W := ⟨ha₁, Or.inl (hP₁_ends.mem_transactionEnds_left S hP₁)⟩ + have hb₁W : b₁ ∈ B ∩ W := ⟨hb₁, Or.inl (hP₁_ends.mem_transactionEnds_right S hP₁)⟩ + have hb₂W : b₂ ∈ B ∩ W := ⟨hb₂, Or.inl (hP₂_ends.mem_transactionEnds_right S hP₂.1)⟩ + have hd_a₁b₂ : Disjoint (S.Ω.interval a₁ b₂) W := by + rw [disjoint_left] + intro z hz hzW + have hza₁ : z ≠ a₁ := fun h => S.Ω.not_mem_interval_left a₁ b₂ (h ▸ hz) + exact disjoint_left.mp hd_P₂ (S.Ω.interval_subset_interval_right ha₁_in_P₂ hz) ⟨hzW, hza₁⟩ + obtain ⟨b', hb'W, a, haW, hdisj_b'a⟩ := + S.Ω.exists_empty_interval_AB_of_subset_union hW_bar (union_comm A B ▸ hW_AB) ⟨b₁, hb₁W⟩ ⟨a₁, + ha₁W⟩ + obtain ⟨A', B', hfence_A'B', hsubA', hsubB'⟩ := + exists_fence_separating_of_disjoint_AB hfence.2.1 hW_bar haW hb₂W hb'W ha₁W hdisj_b'a hd_a₁b₂ + have hS_fence : S.IsFenceFor S_set A' B' := by + refine ⟨hS_disj, hfence_A'B', ?_⟩ + rintro R (hR | rfl) + · obtain ⟨a_R, ha_R, b_R, hb_R, hR_ends⟩ := hfence.2.2 R hR.1 + have ha_R_W : a_R ∈ A ∩ W := ⟨ha_R, Or.inl (hR_ends.mem_transactionEnds_left S hR.1)⟩ + have hb_R_W : b_R ∈ B ∩ W := ⟨hb_R, Or.inl (hR_ends.mem_transactionEnds_right S hR.1)⟩ + have ha_R_ne_a₁ : a_R ≠ a₁ := fun h => + disjoint_left.mp (hfence.1.2 hR.1 hP₁ hR.2) + hR_ends.1.left_mem (h ▸ hP₁_ends.1.left_mem) + exact ⟨a_R, hsubA' ⟨ha_R_W, ha_R_ne_a₁⟩, b_R, hsubB' (Or.inl hb_R_W), hR_ends⟩ + · have hua₁ : u ≠ a₁ := + fun h => (hatt.end_not_mem_transactionEnds S) (h ▸ hP₁_ends.mem_transactionEnds_left S hP₁) + exact ⟨u, hsubA' ⟨⟨huA, Or.inr rfl⟩, hua₁⟩, a₁, hsubB' (Or.inr rfl), hS_ends⟩ + have hS_not_crooked : ¬ S.IsCrookedTransaction S_set := fun hcr => + hnot_exch ⟨⟨v, u, hatt⟩, P₁, S_sw, + ⟨hP₁, v, u, a₁, b₁, hatt, hvP₁, hP₁_ends, Q_a, Or.inl hQ_a, rfl⟩, hcr⟩ + have hex_per : ∃ M ∈ S_set, S.IsPeripheralIn S_set M := by + by_contra! hno + exact hS_not_crooked ⟨⟨A', B', hS_fence⟩, hno⟩ + have hSW_eq : S.transactionEnds S_set = W \ {b₁} := by + rw [hatt.transactionEnds_switch S hP₁ hvP₁ hP₁_ends hQ_a (Or.inl rfl)] + have hP_eq := hfence.transactionEnds_eq_union S hP₁ hP₁_ends + have hb₁_not_W' := hfence.not_mem_transactionEnds_diff_right S hP₁ hP₁_ends + have hub₁ : u ≠ b₁ := fun h => (hatt.end_not_mem_transactionEnds S) + (h ▸ hP₁_ends.mem_transactionEnds_right S hP₁) + have ha₁b₁ : a₁ ≠ b₁ := hP₁_ends.2.1 + ext x + simp only [W, hP_eq, mem_union, mem_insert_iff, mem_singleton_iff, mem_sdiff] + constructor + · rintro (hx | rfl | rfl) + · exact ⟨Or.inl (Or.inl hx), fun h => hb₁_not_W' (h ▸ hx)⟩ + · exact ⟨Or.inr rfl, hub₁⟩ + · exact ⟨Or.inl (Or.inr (Or.inl rfl)), ha₁b₁⟩ + · rintro ⟨(hx | rfl | rfl) | rfl, hne⟩ + · exact Or.inl hx + · exact Or.inr (Or.inr rfl) + · exact (hne rfl).elim + · exact Or.inr (Or.inl rfl) + -- Notice `u ∈ S.Ω.interval b₂ a₂`, so `(a₂, a₁, b₂, u)` is clockwise, which implies + -- `b₂ ∈ S.Ω.interval a₁ u` and `a₂ ∈ S.Ω.interval u a₁`. + have hu_not_a₂b₂ : u ∉ S.Ω.interval a₂ b₂ := fun hu_in => + disjoint_left.mp hd_P₂ hu_in + ⟨Or.inr rfl, fun h => (hatt.end_not_mem_transactionEnds S) (h ▸ + hP₁_ends.mem_transactionEnds_left S hP₁)⟩ + have hua₂ : u ≠ a₂ := fun h => (hatt.end_not_mem_transactionEnds S) + (h ▸ hP₂_ends.mem_transactionEnds_left S hP₂.1) + have hub₂ : u ≠ b₂ := fun h => (hatt.end_not_mem_transactionEnds S) + (h ▸ hP₂_ends.mem_transactionEnds_right S hP₂.1) + have hu_b₂a₂ : u ∈ S.Ω.interval b₂ a₂ := + (S.Ω.mem_interval_or_interval_swap hP₂_ends.2.2.1 hP₂_ends.2.2.2 (hatt.end_mem_bar S) + hP₂_ends.2.1 hua₂ hub₂).resolve_left hu_not_a₂b₂ + have hcw4 : S.Ω.IsClockwise4 a₂ a₁ b₂ u := + S.Ω.isClockwise4_iff_interval.mpr ⟨ha₁_in_P₂, hu_b₂a₂⟩ + have h_b₂_a₂ := S.Ω.isClockwise4_iff_interval.mp (S.Ω.isClockwise4_rotate hcw4) + have ha₂_in_SW : a₂ ∈ W \ {b₁} := + ⟨Or.inl (hP₂_ends.mem_transactionEnds_left S hP₂.1), + fun h => disjoint_left.mp (hfence.1.2 hP₂.1 hP₁ hP₂.2) + hP₂_ends.1.left_mem (h ▸ hP₁_ends.1.right_mem)⟩ + have hb₂_in_SW : b₂ ∈ W \ {b₁} := + ⟨Or.inl (hP₂_ends.mem_transactionEnds_right S hP₂.1), + fun h => disjoint_left.mp (hfence.1.2 hP₂.1 hP₁ hP₂.2) + hP₂_ends.1.right_mem (h ▸ hP₁_ends.1.right_mem)⟩ + rcases hex_per with ⟨M, hM_in, hM_per⟩ + rcases hM_in with hM_diff | rfl + · -- `M = P₃ ∈ P_set \ {P₁}` is peripheral in `S_set`. + obtain ⟨a₃, _ha₃, b₃, _hb₃, hP₃_ends⟩ := hfence.2.2 M hM_diff.1 + have hM_per' := (hP₃_ends.isPeripheralIn_iff S (Or.inl hM_diff)).mp hM_per + rw [hSW_eq] at hM_per' + have hW'_sub : S.transactionEnds (P_set \ {P₁}) ⊆ W \ {b₁} := by + rw [← hSW_eq, hatt.transactionEnds_switch S hP₁ hvP₁ hP₁_ends hQ_a (Or.inl rfl)] + exact subset_union_left + have hM_per_diff : S.IsPeripheralIn (P_set \ {P₁}) M := by + refine ⟨hM_diff, a₃, b₃, hP₃_ends, ?_⟩ + rcases hM_per' with hd | hd + · exact Or.inl (hd.mono_right hW'_sub) + · exact Or.inr (hd.mono_right hW'_sub) + have hne : M ≠ P₂ := by + rintro rfl + have hM_per'' := (hP₂_ends.isPeripheralIn_iff S (Or.inl hP₂)).mp hM_per + rw [hSW_eq] at hM_per'' + rcases hM_per'' with hd_ab | hd_ba + · exact disjoint_left.mp hd_ab ha₁_in_P₂ + ⟨Or.inl (hP₁_ends.mem_transactionEnds_left S hP₁), hP₁_ends.2.1⟩ + · exact disjoint_left.mp hd_ba hu_b₂a₂ + ⟨Or.inr rfl, fun h => (hatt.end_not_mem_transactionEnds S) (h ▸ + hP₁_ends.mem_transactionEnds_right S hP₁)⟩ + exact ⟨M, hM_diff, hne, hM_per_diff⟩ + · -- `M = S_sw` cannot be peripheral in `S_set` since `a₂ ∈ interval u a₁` and `b₂ ∈ interval a₁ + -- u`. + exfalso + have hS_per := (hS_ends.isPeripheralIn_iff S (Or.inr rfl)).mp hM_per + rw [hSW_eq] at hS_per + rcases hS_per with hd_ua₁ | hd_a₁u + · exact disjoint_left.mp hd_ua₁ h_b₂_a₂.2 ha₂_in_SW + · exact disjoint_left.mp hd_a₁u h_b₂_a₂.1 hb₂_in_SW + +private theorem replace_endpoint_set {D : Set α} {a b u : α} + (ha : a ∉ D) (hab : a ≠ b) (hua : u ≠ a) : + D ∪ {u, b} = ((D ∪ {a, b}) ∪ {u}) \ {a} := by + ext x + simp only [mem_union, mem_insert_iff, mem_singleton_iff, mem_sdiff] + constructor + · rintro (hx | rfl | rfl) + · exact ⟨Or.inl (Or.inl hx), fun h => ha (h ▸ hx)⟩ + · exact ⟨Or.inr rfl, hua⟩ + · exact ⟨Or.inl (Or.inr (Or.inr rfl)), hab.symm⟩ + · rintro ⟨(hx | rfl | rfl) | rfl, hne⟩ + · exact Or.inl hx + · exact (hne rfl).elim + · exact Or.inr (Or.inr rfl) + · exact Or.inr (Or.inl rfl) + +private theorem switched_path_cannot_be_peripheral_mirror (S : Society α β) + {P_set : Set (Graph α β)} {A B : Set α} {P₁ S_sw : Graph α β} {u a₁ b₁ : α} + (hcrooked : S.IsCrookedTransaction P_set) (hfence : S.IsFenceFor P_set A B) + (hP₁ : P₁ ∈ P_set) (hP₁_ends : S.IsOmegaPathWithEnds P₁ a₁ b₁) + (hu_not : u ∉ S.transactionEnds P_set) (hcw : a₁ ∈ S.Ω.interval b₁ u) + (hS_ends : S.IsOmegaPathWithEnds S_sw u a₁) : + let W := S.transactionEnds P_set ∪ {u} + let S_set := (P_set \ {P₁}) ∪ {S_sw} + S.IsDisjointOmegaPathSet S_set → (¬ S.IsCrookedTransaction S_set) → + S.transactionEnds S_set = W \ {b₁} → S.transactionEnds P_set = W \ {u} → + W ⊆ S.Ω.bar → W ⊆ A ∪ B → a₁ ∈ A ∩ W → b₁ ∈ B ∩ W → u ∈ A ∩ W → + (Disjoint (S.Ω.interval u b₁) (W \ {a₁}) ∨ Disjoint (S.Ω.interval b₁ u) (W \ {a₁})) → + False := by + intro W S_set hS_disj hS_not_crooked hSW_eq hPW_eq hW_bar hW_AB ha₁W hb₁W huW hT_per + rcases hT_per with hd_ub₁ | hd_b₁u + · -- `Disjoint (S.Ω.interval u b₁) (W \ {a₁})` gives `Disjoint (S.Ω.interval u b₁) W` + -- (since `a₁ ∉ S.Ω.interval u b₁`). + have hd_ub₁_W : Disjoint (S.Ω.interval u b₁) W := by + rw [disjoint_left] + intro z hz hzW + have hza₁ : z ≠ a₁ := fun h => + disjoint_left.mp (S.Ω.disjoint_interval_swap b₁ u) hcw (h ▸ hz) + exact disjoint_left.mp hd_ub₁ hz ⟨hzW, hza₁⟩ + obtain ⟨b', hb'W, a, haW, hdisj_b'a⟩ := + S.Ω.exists_empty_interval_AB_of_subset_union hW_bar (union_comm A B ▸ hW_AB) ⟨b₁, hb₁W⟩ ⟨a₁, + ha₁W⟩ + obtain ⟨A', B', hfence_A'B', hsubA', hsubB'⟩ := + exists_fence_separating_of_disjoint_AB hfence.2.1 hW_bar haW hb₁W hb'W huW hdisj_b'a hd_ub₁_W + have hS_fence : S.IsFenceFor S_set A' B' := by + refine ⟨hS_disj, hfence_A'B', ?_⟩ + rintro R (hR | rfl) + · obtain ⟨a_R, ha_R, b_R, hb_R, hR_ends⟩ := hfence.2.2 R hR.1 + have ha_R_W : a_R ∈ A ∩ W := ⟨ha_R, Or.inl (hR_ends.mem_transactionEnds_left S hR.1)⟩ + have hb_R_W : b_R ∈ B ∩ W := ⟨hb_R, Or.inl (hR_ends.mem_transactionEnds_right S hR.1)⟩ + have ha_R_ne_u : a_R ≠ u := + fun h => hu_not (h ▸ hR_ends.mem_transactionEnds_left S hR.1) + exact ⟨a_R, hsubA' ⟨ha_R_W, ha_R_ne_u⟩, b_R, hsubB' (Or.inl hb_R_W), hR_ends⟩ + · have ha₁_ne_u : a₁ ≠ u := + fun h => hu_not (h ▸ hP₁_ends.mem_transactionEnds_left S hP₁) + exact ⟨a₁, hsubA' ⟨ha₁W, ha₁_ne_u⟩, u, hsubB' (Or.inr rfl), hS_ends.symm S⟩ + obtain ⟨P_x, hPx_in, P_y, hPy_in, hPxy, _⟩ := S.exists_crooked_pair_of_nonempty hcrooked ⟨P₁, + hP₁⟩ + have hex_other : ∃ P₀ ∈ P_set \ {P₁}, True := by + by_cases h1 : P_x = P₁ + · exact ⟨P_y, ⟨hPy_in, h1 ▸ hPxy.symm⟩, trivial⟩ + · exact ⟨P_x, ⟨hPx_in, h1⟩, trivial⟩ + obtain ⟨P₀, hP₀_diff, _⟩ := hex_other + obtain ⟨a₀, _ha₀, b₀, hb₀, hP₀_ends⟩ := hfence.2.2 P₀ hP₀_diff.1 + have hb₀W : b₀ ∈ B ∩ W := ⟨hb₀, Or.inl (hP₀_ends.mem_transactionEnds_right S hP₀_diff.1)⟩ + have hb₀_ne_b₁ : b₀ ≠ b₁ := fun h => + disjoint_left.mp (hfence.1.2 hP₀_diff.1 hP₁ hP₀_diff.2) + hP₀_ends.1.right_mem (h ▸ hP₁_ends.1.right_mem) + have hb'_ne_b₁ : b' ≠ b₁ := by + intro h_eq + have h1 : b₁ ∈ S.Ω.interval b₀ a := + (S.Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.2.1.symm hW_bar hb₁W haW (h_eq ▸ hdisj_b'a) + hb₀W hb₀_ne_b₁ haW).1 + have h2 : b₁ ∈ S.Ω.interval a b₀ := + (S.Ω.mem_interval_of_mem_B_of_disjoint_AB hfence.2.1 hW_bar huW hb₁W hd_ub₁_W + haW hb₀W hb₀_ne_b₁).1 + exact disjoint_left.mp (S.Ω.disjoint_interval_swap b₀ a) h1 h2 + have hex_per_S : ∃ M' ∈ S_set, S.IsPeripheralIn S_set M' := by + by_contra! hno + exact hS_not_crooked ⟨⟨A', B', hS_fence⟩, hno⟩ + rcases hex_per_S with ⟨M', hM'_in, hM'_per⟩ + rcases hM'_in with hM'_diff | rfl + · obtain ⟨a₃, ha₃, b₃, hb₃, hP₃_ends⟩ := hfence.2.2 M' hM'_diff.1 + have hM'_per' := (hP₃_ends.isPeripheralIn_iff S (Or.inl hM'_diff)).mp hM'_per + rw [hSW_eq] at hM'_per' + have hnot_per_P : ¬ S.IsPeripheralIn P_set M' := hcrooked.2 M' hM'_diff.1 + have ha₃W : a₃ ∈ A ∩ W := ⟨ha₃, Or.inl (hP₃_ends.mem_transactionEnds_left S hM'_diff.1)⟩ + rcases hM'_per' with hd_ab' | hd_ba' + · have hb₁_in : b₁ ∈ S.Ω.interval a₃ b₃ := by + by_contra hb₁_not + apply hnot_per_P + refine ⟨hM'_diff.1, a₃, b₃, hP₃_ends, Or.inl ?_⟩ + rw [hPW_eq, disjoint_left] + intro z hz ⟨hzW, _⟩ + have hzb₁ : z ≠ b₁ := fun h => hb₁_not (h ▸ hz) + exact disjoint_left.mp hd_ab' hz ⟨hzW, hzb₁⟩ + have hd_a₃b₁ : Disjoint (S.Ω.interval a₃ b₁) W := by + rw [disjoint_left] + intro z hz hzW + have hzb₁ : z ≠ b₁ := fun h => S.Ω.not_mem_interval_right a₃ b₁ (h ▸ hz) + exact disjoint_left.mp hd_ab' (S.Ω.interval_subset_interval_left hb₁_in hz) ⟨hzW, hzb₁⟩ + have hu_eq : u = a₃ := + (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1 hW_bar huW hb₁W ha₃W hb₁W + hd_ub₁_W hd_a₃b₁).1 + exact hu_not (hu_eq ▸ hP₃_ends.mem_transactionEnds_left S hM'_diff.1) + · have hb₁_in : b₁ ∈ S.Ω.interval b₃ a₃ := by + by_contra hb₁_not + apply hnot_per_P + refine ⟨hM'_diff.1, a₃, b₃, hP₃_ends, Or.inr ?_⟩ + rw [hPW_eq, disjoint_left] + intro z hz ⟨hzW, _⟩ + have hzb₁ : z ≠ b₁ := fun h => hb₁_not (h ▸ hz) + exact disjoint_left.mp hd_ba' hz ⟨hzW, hzb₁⟩ + have hd_b₁a₃ : Disjoint (S.Ω.interval b₁ a₃) W := by + rw [disjoint_left] + intro z hz hzW + have hzb₁ : z ≠ b₁ := fun h => S.Ω.not_mem_interval_left b₁ a₃ (h ▸ hz) + exact disjoint_left.mp hd_ba' (S.Ω.interval_subset_interval_right hb₁_in hz) ⟨hzW, hzb₁⟩ + have hb'_eq : b' = b₁ := + (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1.symm hW_bar hb'W haW hb₁W ha₃W + hdisj_b'a hd_b₁a₃).1 + exact hb'_ne_b₁ hb'_eq + · have hS_per := (hS_ends.isPeripheralIn_iff S (Or.inr rfl)).mp hM'_per + rw [hSW_eq] at hS_per + rcases hS_per with hd_ua₁ | hd_a₁u + · have hb₁_a₁b₀ : b₁ ∈ S.Ω.interval a₁ b₀ := + (S.Ω.mem_interval_of_mem_B_of_disjoint_AB hfence.2.1 hW_bar huW hb₁W hd_ub₁_W + ha₁W hb₀W hb₀_ne_b₁).1 + have hb₀_b₁a₁ : b₀ ∈ S.Ω.interval b₁ a₁ := S.Ω.mem_interval_rotate_left hb₁_a₁b₀ + have hb₁_ua₁ : b₁ ∈ S.Ω.interval u a₁ := S.Ω.mem_interval_rotate_right hcw + have hb₀_ua₁ : b₀ ∈ S.Ω.interval u a₁ := + S.Ω.interval_subset_interval_right hb₁_ua₁ hb₀_b₁a₁ + exact disjoint_left.mp hd_ua₁ hb₀_ua₁ ⟨hb₀W.2, hb₀_ne_b₁⟩ + · have hd_a₁u_W : Disjoint (S.Ω.interval a₁ u) W := by + rw [disjoint_left] + intro z hz hzW + have hzb₁ : z ≠ b₁ := fun h => by + have hb₁_ua₁ : b₁ ∈ S.Ω.interval u a₁ := S.Ω.mem_interval_rotate_right hcw + exact disjoint_left.mp (S.Ω.disjoint_interval_swap a₁ u) hz (h ▸ hb₁_ua₁) + exact disjoint_left.mp hd_a₁u hz ⟨hzW, hzb₁⟩ + have ha₁b₁_split : S.Ω.interval a₁ b₁ = S.Ω.interval a₁ u ∪ {u} ∪ S.Ω.interval u b₁ := + S.Ω.interval_eq_union_of_mem (S.Ω.mem_interval_rotate_left hcw) + have hd_a₁b₁ : Disjoint (S.Ω.interval a₁ b₁) (S.transactionEnds P_set) := by + rw [hPW_eq, ha₁b₁_split, disjoint_left] + rintro z ((hz | rfl) | hz) ⟨hzW, hzu⟩ + · exact disjoint_left.mp hd_a₁u_W hz hzW + · exact hzu rfl + · exact disjoint_left.mp hd_ub₁_W hz hzW + exact hcrooked.2 P₁ hP₁ ⟨hP₁, a₁, b₁, hP₁_ends, Or.inl hd_a₁b₁⟩ + · -- `Disjoint (S.Ω.interval b₁ u) (W \ {a₁})` implies `Disjoint (S.Ω.interval b₁ a₁) (W \ {u})`. + have hd_b₁a₁ : Disjoint (S.Ω.interval b₁ a₁) (S.transactionEnds P_set) := by + rw [hPW_eq, disjoint_left] + intro z hz ⟨hzW, _⟩ + have hza₁ : z ≠ a₁ := fun h => S.Ω.not_mem_interval_right b₁ a₁ (h ▸ hz) + have hz_b₁u : z ∈ S.Ω.interval b₁ u := S.Ω.interval_subset_interval_left hcw hz + exact disjoint_left.mp hd_b₁u hz_b₁u ⟨hzW, hza₁⟩ + exact hcrooked.2 P₁ hP₁ ⟨hP₁, a₁, b₁, hP₁_ends, Or.inr hd_b₁a₁⟩ + +/-- Mirror version of Claims (1)–(3) when `u ∈ A` and `(b₁, a₁, u)` is clockwise +(`a₁ ∈ S.Ω.interval b₁ u`). -/ +theorem isOverpass_of_u_in_A_mirror (S : Society α β) + {P_set : Set (Graph α β)} {A B : Set α} + (hcrooked : S.IsCrookedTransaction P_set) + (hfence : S.IsFenceFor P_set A B) + {P P₁ Q_a Q_b : Graph α β} {v u a₁ b₁ : α} + (hatt : S.IsAttachmentWithEnds P_set P v u) + (hnot_exch : ¬ S.IsExchangeableAttachment P_set P) + (hP₁ : P₁ ∈ P_set) (hvP₁ : v ∈ V(P₁)) + (hP₁_ends : S.IsOmegaPathWithEnds P₁ a₁ b₁) + (ha₁ : a₁ ∈ A) (hb₁ : b₁ ∈ B) (huA : u ∈ A) + (hcw : a₁ ∈ S.Ω.interval b₁ u) + (hQ_a : IsGraphPathWithEnds P₁ Q_a v a₁) + (hQ_b : IsGraphPathWithEnds P₁ Q_b v b₁) : + S.IsOverpass P_set P₁ := by + let W := S.transactionEnds P_set ∪ {u} + let T_sw := subgraphUnion S.G P Q_b + let T_set := (P_set \ {P₁}) ∪ {T_sw} + let S_sw := subgraphUnion S.G P Q_a + let S_set := (P_set \ {P₁}) ∪ {S_sw} + have hT_ends : S.IsOmegaPathWithEnds T_sw u b₁ := + hatt.isOmegaPathWithEnds_subgraphUnion S hP₁ hvP₁ hP₁_ends hQ_b (Or.inr rfl) + have hT_disj : S.IsDisjointOmegaPathSet T_set := + hatt.isDisjointOmegaPathSet_switch S hfence.1 hP₁ hvP₁ hP₁_ends hQ_b (Or.inr rfl) + have hT_fence : S.IsFenceFor T_set A B := by + refine ⟨hT_disj, hfence.2.1, ?_⟩ + rintro R (hR | rfl) + · exact hfence.2.2 R hR.1 + · exact ⟨u, huA, b₁, hb₁, hT_ends⟩ + have hT_not_crooked : ¬ S.IsCrookedTransaction T_set := fun hcr => + hnot_exch ⟨⟨v, u, hatt⟩, P₁, T_sw, + ⟨hP₁, v, u, a₁, b₁, hatt, hvP₁, hP₁_ends, Q_b, Or.inr hQ_b, rfl⟩, hcr⟩ + have hS_ends : S.IsOmegaPathWithEnds S_sw u a₁ := + hatt.isOmegaPathWithEnds_subgraphUnion S hP₁ hvP₁ hP₁_ends hQ_a (Or.inl rfl) + have hS_disj : S.IsDisjointOmegaPathSet S_set := + hatt.isDisjointOmegaPathSet_switch S hfence.1 hP₁ hvP₁ hP₁_ends hQ_a (Or.inl rfl) + have hS_not_crooked : ¬ S.IsCrookedTransaction S_set := fun hcr => + hnot_exch ⟨⟨v, u, hatt⟩, P₁, S_sw, + ⟨hP₁, v, u, a₁, b₁, hatt, hvP₁, hP₁_ends, Q_a, Or.inl hQ_a, rfl⟩, hcr⟩ + have hTW_eq : S.transactionEnds T_set = W \ {a₁} := by + rw [hatt.transactionEnds_switch S hP₁ hvP₁ hP₁_ends hQ_b (Or.inr rfl), + show W = _ from congrArg (fun X => X ∪ {u}) (hfence.transactionEnds_eq_union S hP₁ hP₁_ends)] + exact replace_endpoint_set (hfence.not_mem_transactionEnds_diff_left S hP₁ hP₁_ends) + hP₁_ends.2.1 + (fun h => (hatt.end_not_mem_transactionEnds S) (h ▸ hP₁_ends.mem_transactionEnds_left S hP₁)) + have hSW_eq : S.transactionEnds S_set = W \ {b₁} := by + rw [hatt.transactionEnds_switch S hP₁ hvP₁ hP₁_ends hQ_a (Or.inl rfl), + show W = _ from congrArg (fun X => X ∪ {u}) (hfence.transactionEnds_eq_union S hP₁ hP₁_ends)] + rw [show ({a₁, b₁} : Set α) = {b₁, a₁} from pair_comm _ _] + exact replace_endpoint_set (hfence.not_mem_transactionEnds_diff_right S hP₁ hP₁_ends) + hP₁_ends.2.1.symm + (fun h => (hatt.end_not_mem_transactionEnds S) (h ▸ hP₁_ends.mem_transactionEnds_right S hP₁)) + have hPW_eq : S.transactionEnds P_set = W \ {u} := by + ext x + simp only [W, mem_union, mem_singleton_iff, mem_sdiff] + exact ⟨fun hx => ⟨Or.inl hx, fun h => (hatt.end_not_mem_transactionEnds S) (h ▸ hx)⟩, + fun ⟨hx, hne⟩ => hx.resolve_right hne⟩ + have hW_bar : W ⊆ S.Ω.bar := union_subset (S.transactionEnds_subset_bar P_set) + (singleton_subset_iff.mpr (hatt.end_mem_bar S)) + have hW_AB : W ⊆ A ∪ B := hfence.2.1.2.2.2.1 ▸ hW_bar + have ha₁W : a₁ ∈ A ∩ W := ⟨ha₁, Or.inl (hP₁_ends.mem_transactionEnds_left S hP₁)⟩ + have hb₁W : b₁ ∈ B ∩ W := ⟨hb₁, Or.inl (hP₁_ends.mem_transactionEnds_right S hP₁)⟩ + have huW : u ∈ A ∩ W := ⟨huA, Or.inr rfl⟩ + have hex_per_T : ∃ M ∈ T_set, S.IsPeripheralIn T_set M := by + by_contra! hno + exact hT_not_crooked ⟨⟨A, B, hT_fence⟩, hno⟩ + rcases hex_per_T with ⟨M, hM_in, hM_per⟩ + rcases hM_in with hM_diff | rfl + · -- `M = P₂ ∈ P_set \ {P₁}` is peripheral in `T_set`. + obtain ⟨a₂, ha₂, b₂, hb₂, hP₂_ends⟩ := hfence.2.2 M hM_diff.1 + have hM_per' := (hP₂_ends.isPeripheralIn_iff S (Or.inl hM_diff)).mp hM_per + rw [hTW_eq] at hM_per' + have hW'_sub_T : S.transactionEnds (P_set \ {P₁}) ⊆ W \ {a₁} := by + rw [← hTW_eq, hatt.transactionEnds_switch S hP₁ hvP₁ hP₁_ends hQ_b (Or.inr rfl)] + exact subset_union_left + have hM_per_diff : S.IsPeripheralIn (P_set \ {P₁}) M := by + refine ⟨hM_diff, a₂, b₂, hP₂_ends, ?_⟩ + rcases hM_per' with hd | hd + · exact Or.inl (hd.mono_right hW'_sub_T) + · exact Or.inr (hd.mono_right hW'_sub_T) + have hnot_per_P : ¬ S.IsPeripheralIn P_set M := hcrooked.2 M hM_diff.1 + rcases hM_per' with hd_ab | hd_ba + · -- `a₁ ∈ S.Ω.interval a₂ b₂` and `Disjoint (S.Ω.interval a₂ b₂) (W \ {a₁})` + -- contradicts `a₁ ∈ S.Ω.interval b₁ u`. + exfalso + have ha₁_in : a₁ ∈ S.Ω.interval a₂ b₂ := by + by_contra ha₁_not + apply hnot_per_P + refine ⟨hM_diff.1, a₂, b₂, hP₂_ends, Or.inl ?_⟩ + rw [hPW_eq, disjoint_left] + intro z hz ⟨hzW, _⟩ + have hza₁ : z ≠ a₁ := fun h => ha₁_not (h ▸ hz) + exact disjoint_left.mp hd_ab hz ⟨hzW, hza₁⟩ + have hd_a₁b₂ : Disjoint (S.Ω.interval a₁ b₂) W := by + rw [disjoint_left] + intro z hz hzW + have hza₁ : z ≠ a₁ := fun h => S.Ω.not_mem_interval_left a₁ b₂ (h ▸ hz) + exact disjoint_left.mp hd_ab (S.Ω.interval_subset_interval_right ha₁_in hz) ⟨hzW, hza₁⟩ + have hb₂W : b₂ ∈ B ∩ W := ⟨hb₂, Or.inl (hP₂_ends.mem_transactionEnds_right S hM_diff.1)⟩ + have hua₁ : u ≠ a₁ := fun h => (hatt.end_not_mem_transactionEnds S) + (h ▸ hP₁_ends.mem_transactionEnds_left S hP₁) + have ha₁_ub₁ : a₁ ∈ S.Ω.interval u b₁ := + (S.Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.2.1 hW_bar ha₁W hb₂W hd_a₁b₂ + huW hua₁ hb₁W).1 + exact disjoint_left.mp (S.Ω.disjoint_interval_swap u b₁) ha₁_ub₁ hcw + · -- `a₁ ∈ S.Ω.interval b₂ a₂` and `Disjoint (S.Ω.interval b₂ a₂) (W \ {a₁})`. + have ha₁_in : a₁ ∈ S.Ω.interval b₂ a₂ := by + by_contra ha₁_not + apply hnot_per_P + refine ⟨hM_diff.1, a₂, b₂, hP₂_ends, Or.inr ?_⟩ + rw [hPW_eq, disjoint_left] + intro z hz ⟨hzW, _⟩ + have hza₁ : z ≠ a₁ := fun h => ha₁_not (h ▸ hz) + exact disjoint_left.mp hd_ba hz ⟨hzW, hza₁⟩ + have hd_b₂a₁ : Disjoint (S.Ω.interval b₂ a₁) W := by + rw [disjoint_left] + intro z hz hzW + have hza₁ : z ≠ a₁ := fun h => S.Ω.not_mem_interval_right b₂ a₁ (h ▸ hz) + exact disjoint_left.mp hd_ba (S.Ω.interval_subset_interval_left ha₁_in hz) ⟨hzW, hza₁⟩ + have hb₂W : b₂ ∈ B ∩ W := ⟨hb₂, Or.inl (hP₂_ends.mem_transactionEnds_right S hM_diff.1)⟩ + obtain ⟨a', ha'W, b, hbW, hdisj_a'b⟩ := + S.Ω.exists_empty_interval_AB_of_subset_union hW_bar hW_AB ⟨a₁, ha₁W⟩ ⟨b₁, hb₁W⟩ + obtain ⟨A', B', hfence_A'B', hsubA', hsubB'⟩ := + exists_fence_separating_of_disjoint_BA hfence.2.1 hW_bar ha'W hbW hb₂W ha₁W hdisj_a'b + hd_b₂a₁ + have hS_fence : S.IsFenceFor S_set A' B' := by + refine ⟨hS_disj, hfence_A'B', ?_⟩ + rintro R (hR | rfl) + · obtain ⟨a_R, ha_R, b_R, hb_R, hR_ends⟩ := hfence.2.2 R hR.1 + have ha_R_W : a_R ∈ A ∩ W := ⟨ha_R, Or.inl (hR_ends.mem_transactionEnds_left S hR.1)⟩ + have hb_R_W : b_R ∈ B ∩ W := ⟨hb_R, Or.inl (hR_ends.mem_transactionEnds_right S hR.1)⟩ + have ha_R_ne_a₁ : a_R ≠ a₁ := fun h => + disjoint_left.mp (hfence.1.2 hR.1 hP₁ hR.2) + hR_ends.1.left_mem (h ▸ hP₁_ends.1.left_mem) + exact ⟨a_R, hsubA' ⟨ha_R_W, ha_R_ne_a₁⟩, b_R, hsubB' (Or.inl hb_R_W), hR_ends⟩ + · have hua₁ : u ≠ a₁ := + fun h => (hatt.end_not_mem_transactionEnds S) (h ▸ hP₁_ends.mem_transactionEnds_left S + hP₁) + exact ⟨u, hsubA' ⟨huW, hua₁⟩, a₁, hsubB' (Or.inr rfl), hS_ends⟩ + have hex_per_S : ∃ M' ∈ S_set, S.IsPeripheralIn S_set M' := by + by_contra! hno + exact hS_not_crooked ⟨⟨A', B', hS_fence⟩, hno⟩ + have hu_not_b₂a₂ : u ∉ S.Ω.interval b₂ a₂ := fun hu_in => + disjoint_left.mp hd_ba hu_in + ⟨Or.inr rfl, fun h => (hatt.end_not_mem_transactionEnds S) (h ▸ + hP₁_ends.mem_transactionEnds_left S hP₁)⟩ + have hua₂ : u ≠ a₂ := fun h => (hatt.end_not_mem_transactionEnds S) + (h ▸ hP₂_ends.mem_transactionEnds_left S hM_diff.1) + have hub₂ : u ≠ b₂ := fun h => (hatt.end_not_mem_transactionEnds S) + (h ▸ hP₂_ends.mem_transactionEnds_right S hM_diff.1) + have hu_a₂b₂ : u ∈ S.Ω.interval a₂ b₂ := + (S.Ω.mem_interval_or_interval_swap hP₂_ends.2.2.2 hP₂_ends.2.2.1 (hatt.end_mem_bar S) + hP₂_ends.2.1.symm hub₂ hua₂).resolve_left hu_not_b₂a₂ + have hcw4 : S.Ω.IsClockwise4 b₂ a₁ a₂ u := + S.Ω.isClockwise4_iff_interval.mpr ⟨ha₁_in, hu_a₂b₂⟩ + have h_a₂_b₂ := S.Ω.isClockwise4_iff_interval.mp (S.Ω.isClockwise4_rotate hcw4) + have ha₂_in_SW : a₂ ∈ W \ {b₁} := + ⟨Or.inl (hP₂_ends.mem_transactionEnds_left S hM_diff.1), + fun h => disjoint_left.mp (hfence.1.2 hM_diff.1 hP₁ hM_diff.2) + hP₂_ends.1.left_mem (h ▸ hP₁_ends.1.right_mem)⟩ + have hb₂_in_SW : b₂ ∈ W \ {b₁} := + ⟨Or.inl (hP₂_ends.mem_transactionEnds_right S hM_diff.1), + fun h => disjoint_left.mp (hfence.1.2 hM_diff.1 hP₁ hM_diff.2) + hP₂_ends.1.right_mem (h ▸ hP₁_ends.1.right_mem)⟩ + rcases hex_per_S with ⟨M', hM'_in, hM'_per⟩ + rcases hM'_in with hM'_diff | rfl + · obtain ⟨a₃, _ha₃, b₃, _hb₃, hP₃_ends⟩ := hfence.2.2 M' hM'_diff.1 + have hM'_per' := (hP₃_ends.isPeripheralIn_iff S (Or.inl hM'_diff)).mp hM'_per + rw [hSW_eq] at hM'_per' + have hW'_sub_S : S.transactionEnds (P_set \ {P₁}) ⊆ W \ {b₁} := by + rw [← hSW_eq, hatt.transactionEnds_switch S hP₁ hvP₁ hP₁_ends hQ_a (Or.inl rfl)] + exact subset_union_left + have hM'_per_diff : S.IsPeripheralIn (P_set \ {P₁}) M' := by + refine ⟨hM'_diff, a₃, b₃, hP₃_ends, ?_⟩ + rcases hM'_per' with hd | hd + · exact Or.inl (hd.mono_right hW'_sub_S) + · exact Or.inr (hd.mono_right hW'_sub_S) + have hne : M' ≠ M := by + rintro rfl + have hM'_per'' := (hP₂_ends.isPeripheralIn_iff S (Or.inl hM_diff)).mp hM'_per + rw [hSW_eq] at hM'_per'' + rcases hM'_per'' with hd_ab' | hd_ba' + · exact disjoint_left.mp hd_ab' hu_a₂b₂ + ⟨Or.inr rfl, fun h => (hatt.end_not_mem_transactionEnds S) + (h ▸ hP₁_ends.mem_transactionEnds_right S hP₁)⟩ + · exact disjoint_left.mp hd_ba' ha₁_in + ⟨Or.inl (hP₁_ends.mem_transactionEnds_left S hP₁), hP₁_ends.2.1⟩ + exact ⟨hcrooked, hP₁, M, hM_diff, M', hM'_diff, hne.symm, hM_per_diff, hM'_per_diff⟩ + · exfalso + have hS_per := (hS_ends.isPeripheralIn_iff S (Or.inr rfl)).mp hM'_per + rw [hSW_eq] at hS_per + rcases hS_per with hd_ua₁ | hd_a₁u + · exact disjoint_left.mp hd_ua₁ h_a₂_b₂.2 hb₂_in_SW + · exact disjoint_left.mp hd_a₁u h_a₂_b₂.1 ha₂_in_SW + · -- `M = T_sw` is peripheral in `T_set`. + exfalso + have hT_per := (hT_ends.isPeripheralIn_iff S (Or.inr rfl)).mp hM_per + rw [hTW_eq] at hT_per + exact switched_path_cannot_be_peripheral_mirror S hcrooked hfence hP₁ hP₁_ends + (hatt.end_not_mem_transactionEnds S) hcw hS_ends hS_disj hS_not_crooked + hSW_eq hPW_eq hW_bar hW_AB ha₁W hb₁W huW hT_per + +/-- Core case of (3.2) when `u ∈ A`. -/ +theorem isOverpass_of_u_in_A (S : Society α β) + {P_set : Set (Graph α β)} {A B : Set α} + (hcrooked : S.IsCrookedTransaction P_set) + (hfence : S.IsFenceFor P_set A B) + {P P₁ : Graph α β} {v u a₁ b₁ : α} + (hatt : S.IsAttachmentWithEnds P_set P v u) + (hnot_exch : ¬ S.IsExchangeableAttachment P_set P) + (hP₁ : P₁ ∈ P_set) (hvP₁ : v ∈ V(P₁)) + (hP₁_ends : S.IsOmegaPathWithEnds P₁ a₁ b₁) + (ha₁ : a₁ ∈ A) (hb₁ : b₁ ∈ B) (huA : u ∈ A) : + S.IsOverpass P_set P₁ := by + obtain ⟨Q_a', Q_b, _, _, hQ_a', hQ_b, _, _, _⟩ := hP₁_ends.1.exists_split_at hvP₁ + have hQ_a : IsGraphPathWithEnds P₁ Q_a' v a₁ := hQ_a'.symm + have hua₁ : u ≠ a₁ := fun h => (hatt.end_not_mem_transactionEnds S) + (h ▸ hP₁_ends.mem_transactionEnds_left S hP₁) + have hub₁ : u ≠ b₁ := fun h => (hatt.end_not_mem_transactionEnds S) + (h ▸ hP₁_ends.mem_transactionEnds_right S hP₁) + rcases S.Ω.mem_interval_or_interval_swap (hatt.end_mem_bar S) hP₁_ends.2.2.2 hP₁_ends.2.2.1 + hub₁ hua₁.symm hP₁_ends.2.1 with hcw | hcw + · -- `(u, a₁, b₁)` is clockwise. + have h1 := S.lemma_3_2_claim_1 hcrooked hfence hatt hnot_exch hP₁ hvP₁ hP₁_ends + ha₁ hb₁ huA hcw hQ_b + have h2 := S.lemma_3_2_claim_2 hcrooked hfence hatt hnot_exch hP₁ hvP₁ hP₁_ends + ha₁ hb₁ huA hcw hQ_a + obtain ⟨P₂, hP₂_in, hP₂_per, a₂, ha₂, b₂, hb₂, hP₂_ends, ha₁_in_P₂, hd_P₂⟩ := + h1.1.resolve_left h2 + obtain ⟨P₃, hP₃_in, hP32, hP₃_per⟩ := + S.lemma_3_2_claim_3 hcrooked hfence hatt hnot_exch hP₁ hvP₁ hP₁_ends + ha₁ hb₁ huA hQ_a hP₂_in hP₂_ends ha₂ hb₂ ha₁_in_P₂ hd_P₂ + exact ⟨hcrooked, hP₁, P₂, hP₂_in, P₃, hP₃_in, hP32.symm, hP₂_per, hP₃_per⟩ + · -- `(b₁, a₁, u)` is clockwise. + exact S.isOverpass_of_u_in_A_mirror hcrooked hfence hatt hnot_exch hP₁ hvP₁ hP₁_ends + ha₁ hb₁ huA hcw hQ_a hQ_b + +/-- **Graph Minors IX, (3.2)** (page 47): +"Every attachment to a crooked transaction that is not exchangeable is an overpass attachment." -/ +theorem theorem_3_2_proof (S : Society α β) + {P_set : Set (Graph α β)} {P : Graph α β} + (hcrooked : S.IsCrookedTransaction P_set) + (hatt : S.IsAttachment P_set P) + (hnot_exch : ¬ S.IsExchangeableAttachment P_set P) : + S.IsOverpassAttachment P_set P := by + rcases hatt with ⟨v, u, hatt_vu⟩ + obtain ⟨P₁, hP₁_in, hvP₁⟩ := hatt_vu.exists_leg S + refine ⟨⟨v, u, hatt_vu⟩, P₁, ⟨hP₁_in, v, ⟨u, hatt_vu⟩, hvP₁⟩, ?_⟩ + obtain ⟨A, B, hfence⟩ := hcrooked.1 + obtain ⟨a₁, ha₁, b₁, hb₁, hP₁_ends⟩ := hfence.2.2 P₁ hP₁_in + have hu_AB : u ∈ A ∪ B := hfence.2.1.2.2.2.1 ▸ (hatt_vu.end_mem_bar S) + rcases hu_AB with huA | huB + · exact S.isOverpass_of_u_in_A hcrooked hfence hatt_vu hnot_exch hP₁_in hvP₁ hP₁_ends ha₁ hb₁ huA + · have hfence_BA : S.IsFenceFor P_set B A := + ⟨hfence.1, hfence.2.1.symm, fun R hR => by + obtain ⟨a, ha, b, hb, hR_e⟩ := hfence.2.2 R hR + exact ⟨b, hb, a, ha, hR_e.symm S⟩⟩ + exact S.isOverpass_of_u_in_A hcrooked hfence_BA hatt_vu hnot_exch hP₁_in hvP₁ + (hP₁_ends.symm S) hb₁ ha₁ huB + +end Society + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section3c.lean b/LeanPool/GraphMinor/GM09/Section3c.lean new file mode 100644 index 0000000000..1df9cf9038 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section3c.lean @@ -0,0 +1,1043 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2a +import LeanPool.GraphMinor.GM09.Section2d +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section3b +import Mathlib.Data.Set.Card + +/-! +# Graph Minors IX, Section 3 (Part 3): Two-Point Path Splitting and (3.3) + +This file establishes: +- absence of loop edges in paths (`IsGraphPathWithEnds.not_isLoopAt`) and edge-disjointness of + paths meeting at a single vertex (`disjoint_edgeSet_of_inter_singleton`), +- splitting a path `L` at two distinct vertices `b, b' ∈ V(L)` into two disjoint end-subpaths + `Q₁, Q₂` and the middle subpath `M` between `b` and `b'` (`exists_two_point_split`), +- Graph Minors IX, (3.3) (`theorem_3_3`, page 48): if `P` and `P'` are disjoint non-exchangeable + attachments to a crooked transaction `P_set`, then they have a common leg `P₁` which is an + overpass of `P_set`, and replacing `P₁` by the two disjoint switches of `P` and `P'` yields a + crooked transaction `P_set'` of cardinality `|P_set| + 1` with no edge of `P₁` between the two + feet in `⋃ P_set'`. +-/ + +public section + +namespace GraphMinor.GM09 + +open Set Graph GraphMinor GraphMinor.Surface + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Loop-freeness of paths and two-point path splitting -/ + +private theorem walk_not_isLoopAt_of_isSimple {G : Graph α β} {a b : α} + {W : GraphWalk G a b} (hW : W.IsSimple) {e : β} (he : e ∈ W.edges) (z : α) : + ¬ G.IsLink e z z := by + induction W with + | nil _ => simp [GraphWalk.edges] at he + | @cons u w _ f hfu W' ih => + have hnodup : (u :: W'.support).Nodup := hW + have hu_not_in : u ∉ W'.support := (List.nodup_cons.mp hnodup).1 + have hW'_simple : W'.IsSimple := (List.nodup_cons.mp hnodup).2 + simp only [GraphWalk.edges, List.mem_cons] at he + rcases he with rfl | he' + · intro hloop + have huz : u = z := (hfu.left_eq_or_eq hloop).elim id id + have hwz : w = z := (hfu.symm.left_eq_or_eq hloop).elim id id + exact hu_not_in (huz.trans hwz.symm ▸ W'.start_mem_support) + · exact ih hW'_simple he' + +theorem IsGraphPathWithEnds.not_isLoopAt {G R : Graph α β} {a b : α} + (hR : IsGraphPathWithEnds G R a b) {e : β} (he : e ∈ E(R)) (z : α) : + ¬ G.IsLink e z z := by + rcases hR with ⟨hRG, W, hW, _, hER⟩ + rw [hER, mem_ofPred_eq] at he + intro hloop + exact walk_not_isLoopAt_of_isSimple hW he z ((hRG.isLink_iff (hER ▸ he)).mpr hloop) + +theorem disjoint_edgeSet_of_inter_singleton {G R P : Graph α β} {a b z : α} + (hR : IsGraphPathWithEnds G R a b) (hPG : P ≤ G) + (hinter : V(R) ∩ V(P) ⊆ {z}) : + Disjoint E(R) E(P) := by + rw [disjoint_left] + intro e heR heP + obtain ⟨x, y, hxyR⟩ := R.exists_isLink_of_mem_edgeSet heR + have hxyG : G.IsLink e x y := hxyR.mono hR.le + have hxyP : P.IsLink e x y := (hPG.isLink_iff heP).mpr hxyG + have hxz : x = z := mem_singleton_iff.mp (hinter ⟨hxyR.left_mem, hxyP.left_mem⟩) + have hyz : y = z := mem_singleton_iff.mp (hinter ⟨hxyR.right_mem, hxyP.right_mem⟩) + rw [hxz, hyz] at hxyG + exact hR.not_isLoopAt heR z hxyG + +/-- If `L` is a path in `G` with ends `a₁, b₁` and `b, b' ∈ V(L)` are distinct, then `L` splits into +three subpaths `Q₁, M, Q₂ ≤ L` such that `M` is the subpath of `L` between `b` and `b'`, `Q₁` and +`Q₂` are vertex-disjoint subpaths from `b, b'` to opposite ends of `L`, and `M` is edge-disjoint +from both `Q₁` and `Q₂`. -/ +theorem IsGraphPathWithEnds.exists_two_point_split {G L : Graph α β} {a₁ b₁ b b' : α} + (hL : IsGraphPathWithEnds G L a₁ b₁) + (hb : b ∈ V(L)) (hb' : b' ∈ V(L)) (hne : b ≠ b') : + ∃ Q₁ Q₂ M : Graph α β, + Q₁ ≤ L ∧ Q₂ ≤ L ∧ M ≤ L ∧ + IsGraphPathWithEnds L M b b' ∧ + ((IsGraphPathWithEnds L Q₁ b a₁ ∧ IsGraphPathWithEnds L Q₂ b' b₁) ∨ + (IsGraphPathWithEnds L Q₁ b b₁ ∧ IsGraphPathWithEnds L Q₂ b' a₁)) ∧ + Disjoint V(Q₁) V(Q₂) ∧ + Disjoint E(M) E(Q₁) ∧ Disjoint E(M) E(Q₂) := by + obtain ⟨L₁, L₂, hL₁L, hL₂L, hL₁, hL₂, hunion, hinter, hdisjE⟩ := hL.exists_split_at hb + have hb'_union : b' ∈ V(L₁) ∪ V(L₂) := by + rw [← vertexSet_subgraphUnion L L₁ L₂, hunion] + exact hb' + rcases hb'_union with hb'₁ | hb'₂ + · -- `b' ∈ V(L₁)`: split `L₁` at `b'`. + obtain ⟨Q₂', M', hQ₂'L₁, hM'L₁, hQ₂', hM', _, hinter₁, hdisjE₁⟩ := hL₁.exists_split_at hb'₁ + have hQ₂L : Q₂' ≤ L := hQ₂'L₁.trans hL₁L + have hML : M' ≤ L := hM'L₁.trans hL₁L + refine ⟨L₂, Q₂', M', hL₂L, hQ₂L, hML, + (hM'.mono hL₁L).symm, Or.inr ⟨hL₂, (hQ₂'.mono hL₁L).symm⟩, ?_, ?_, hdisjE₁.symm⟩ + · rw [disjoint_left] + intro z hzL₂ hzQ₂' + have hz_inter : z ∈ V(L₁) ∩ V(L₂) := ⟨hQ₂'L₁.vertexSet_mono hzQ₂', hzL₂⟩ + rw [hinter, mem_singleton_iff] at hz_inter + subst hz_inter + have hz_inter₁ : z ∈ V(Q₂') ∩ V(M') := ⟨hzQ₂', hM'.right_mem⟩ + rw [hinter₁, mem_singleton_iff] at hz_inter₁ + exact hne hz_inter₁ + · exact hdisjE.mono_left hM'L₁.edgeSet_mono + · -- `b' ∈ V(L₂)`: split `L₂` at `b'`. + obtain ⟨M', Q₂', hM'L₂, hQ₂'L₂, hM', hQ₂', _, hinter₂, hdisjE₂⟩ := hL₂.exists_split_at hb'₂ + have hML : M' ≤ L := hM'L₂.trans hL₂L + have hQ₂L : Q₂' ≤ L := hQ₂'L₂.trans hL₂L + refine ⟨L₁, Q₂', M', hL₁L, hQ₂L, hML, + hM'.mono hL₂L, Or.inl ⟨hL₁.symm, hQ₂'.mono hL₂L⟩, ?_, ?_, hdisjE₂⟩ + · rw [disjoint_left] + intro z hzL₁ hzQ₂' + have hz_inter : z ∈ V(L₁) ∩ V(L₂) := ⟨hzL₁, hQ₂'L₂.vertexSet_mono hzQ₂'⟩ + rw [hinter, mem_singleton_iff] at hz_inter + subst hz_inter + have hz_inter₂ : z ∈ V(M') ∩ V(Q₂') := ⟨hM'.left_mem, hzQ₂'⟩ + rw [hinter₂, mem_singleton_iff] at hz_inter₂ + exact hne hz_inter₂ + · exact hdisjE.symm.mono_left hM'L₂.edgeSet_mono + +namespace Society + +/-- Every set of mutually vertex-disjoint `Ω`-paths in a society `S` is finite. -/ +theorem IsDisjointOmegaPathSet.finite (S : Society α β) + {P_set : Set (Graph α β)} (h : S.IsDisjointOmegaPathSet P_set) : + P_set.Finite := by + have hex : ∀ P : P_set, ∃ a : S.Ω.bar, (a : α) ∈ V(P.1) := by + intro ⟨P, hP⟩ + obtain ⟨a, _, hP_ends⟩ := h.1 P hP + exact ⟨⟨a, hP_ends.2.2.1⟩, hP_ends.1.left_mem⟩ + choose f hf using hex + have hinj : Function.Injective f := by + intro ⟨P₁, hP₁⟩ ⟨P₂, hP₂⟩ heq + by_contra hne + have hne' : P₁ ≠ P₂ := fun h_eq => hne (Subtype.ext h_eq) + exact disjoint_left.mp (h.2 hP₁ hP₂ hne') (hf ⟨P₁, hP₁⟩) ( congrArg Subtype.val heq ▸ hf ⟨P₂, + hP₂⟩) + have : Finite S.Ω.bar := S.Ω.finite_bar.to_subtype + have : Finite P_set := Finite.of_injective f hinj + exact Set.toFinite P_set + +/-! ## Four-arc decomposition around an overpass and crookedness of switches -/ + +/-- Given a fence `(A, B)` of `Ω` and `W' ⊆ Ω.bar` with empty-interval boundary pairs +`(a'_0, b_0) ∈ (A ∩ W') × (B ∩ W')` and `(b'_0, a_0) ∈ (B ∩ W') × (A ∩ W')`, let +`G₁ := Ω.interval a'_0 b_0`, `G₂ := Ω.interval b'_0 a_0`, +`A_arc := ({a'_0} ∪ Ω.interval b'_0 a'_0) \ G₂`, and +`B_arc := ({b'_0} ∪ Ω.interval a'_0 b'_0) \ G₁`. +Then `A ∩ W' ⊆ A_arc`, `B ∩ W' ⊆ B_arc`, and `Ω.bar = A_arc ∪ G₁ ∪ B_arc ∪ G₂` as a pairwise +disjoint union. -/ +theorem four_arc_partition {Ω : CyclicPerm α} {A B W' : Set α} + (hfence : Ω.IsFence A B) (hW' : W' ⊆ Ω.bar) + {a_0 a'_0 b_0 b'_0 : α} + (ha_0 : a_0 ∈ A ∩ W') (ha'_0 : a'_0 ∈ A ∩ W') + (hb_0 : b_0 ∈ B ∩ W') (hb'_0 : b'_0 ∈ B ∩ W') + (hd_ab : Disjoint (Ω.interval a'_0 b_0) W') + (hd_ba : Disjoint (Ω.interval b'_0 a_0) W') : + let G₁ := Ω.interval a'_0 b_0 + let G₂ := Ω.interval b'_0 a_0 + let A_arc := ({a'_0} ∪ Ω.interval b'_0 a'_0) \ G₂ + let B_arc := ({b'_0} ∪ Ω.interval a'_0 b'_0) \ G₁ + A ∩ W' ⊆ A_arc ∧ B ∩ W' ⊆ B_arc ∧ + G₂ ⊆ Ω.interval b'_0 a'_0 ∧ G₁ ⊆ Ω.interval a'_0 b'_0 ∧ + Disjoint ({a'_0} ∪ Ω.interval b'_0 a'_0) ({b'_0} ∪ Ω.interval a'_0 b'_0) ∧ + (∀ z ∈ Ω.bar, z ∉ G₁ → z ∉ G₂ → z ∈ A_arc ∨ z ∈ B_arc) := by + intro G₁ G₂ A_arc B_arc + have ha'_0_bar : a'_0 ∈ Ω.bar := hW' ha'_0.2 + have hb'_0_bar : b'_0 ∈ Ω.bar := hW' hb'_0.2 + have ha'_ne_b' : a'_0 ≠ b'_0 := + fun h => disjoint_left.mp hfence.2.2.1 ha'_0.1 (h ▸ hb'_0.1) + have hA_sub_P₁ : A ∩ W' ⊆ {a'_0} ∪ Ω.interval b'_0 a'_0 := by + intro x hx + by_cases hxa' : x = a'_0 + · exact Or.inl hxa' + · exact Or.inr (Ω.mem_interval_rotate_right + (Ω.mem_interval_of_mem_A_of_disjoint_AB hfence hW' ha'_0 hb_0 hd_ab hx hxa' hb'_0).1) + have hB_sub_P₂ : B ∩ W' ⊆ {b'_0} ∪ Ω.interval a'_0 b'_0 := by + intro y hy + by_cases hyb' : y = b'_0 + · exact Or.inl hyb' + · exact Or.inr (Ω.mem_interval_rotate_right + (Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.symm hW' hb'_0 ha_0 hd_ba hy hyb' ha'_0).1) + have hA_sub : A ∩ W' ⊆ A_arc := + fun x hx => ⟨hA_sub_P₁ hx, disjoint_right.mp hd_ba hx.2⟩ + have hB_sub : B ∩ W' ⊆ B_arc := + fun y hy => ⟨hB_sub_P₂ hy, disjoint_right.mp hd_ab hy.2⟩ + have hG₂_sub : G₂ ⊆ Ω.interval b'_0 a'_0 := by + change Ω.interval b'_0 a_0 ⊆ Ω.interval b'_0 a'_0 + rcases hA_sub_P₁ ha_0 with h_eq | ha_0_in + · rw [mem_singleton_iff.mp h_eq] + · exact Ω.interval_subset_interval_left ha_0_in + have hG₁_sub : G₁ ⊆ Ω.interval a'_0 b'_0 := by + change Ω.interval a'_0 b_0 ⊆ Ω.interval a'_0 b'_0 + rcases hB_sub_P₂ hb_0 with h_eq | hb_0_in + · rw [mem_singleton_iff.mp h_eq] + · exact Ω.interval_subset_interval_left hb_0_in + have hdisj_P : Disjoint ({a'_0} ∪ Ω.interval b'_0 a'_0) ({b'_0} ∪ Ω.interval a'_0 b'_0) := by + rw [disjoint_left] + rintro z (hz₁ | hz₁) (hz₂ | hz₂) + · exact ha'_ne_b' ((mem_singleton_iff.mp hz₁).symm.trans (mem_singleton_iff.mp hz₂)) + · exact Ω.not_mem_interval_left a'_0 b'_0 (mem_singleton_iff.mp hz₁ ▸ hz₂) + · exact Ω.not_mem_interval_left b'_0 a'_0 (mem_singleton_iff.mp hz₂ ▸ hz₁) + · exact disjoint_left.mp (Ω.disjoint_interval_swap b'_0 a'_0) hz₁ hz₂ + refine ⟨hA_sub, hB_sub, hG₂_sub, hG₁_sub, hdisj_P, fun z hz_bar hz_not_G₁ hz_not_G₂ => ?_⟩ + by_cases hza' : z = a'_0 + · exact Or.inl ⟨Or.inl hza', hz_not_G₂⟩ + · by_cases hzb' : z = b'_0 + · exact Or.inr ⟨Or.inl hzb', hz_not_G₁⟩ + · rcases Ω.mem_interval_or_interval_swap hb'_0_bar ha'_0_bar hz_bar ha'_ne_b'.symm hzb' hza' + with hz₁ | hz₂ + · exact Or.inl ⟨Or.inr hz₁, hz_not_G₂⟩ + · exact Or.inr ⟨Or.inr hz₂, hz_not_G₁⟩ + +/-- Interval fence cutting `G₁ = Ω.interval a'_0 b_0` at `x₁ ∈ G₁`: +`A_f := Ω.interval b'_0 x₁` and `B_f := {b'_0, x₁} ∪ Ω.interval x₁ b'_0` satisfy +`A_arc ∪ G₂ ⊆ A_f` and `B_arc ∪ {x₁} ⊆ B_f`. -/ +theorem fence_cut_G₁ {Ω : CyclicPerm α} {A B W' : Set α} + (hfence : Ω.IsFence A B) (hW' : W' ⊆ Ω.bar) + {a_0 a'_0 b_0 b'_0 x₁ : α} + (ha_0 : a_0 ∈ A ∩ W') (ha'_0 : a'_0 ∈ A ∩ W') + (hb_0 : b_0 ∈ B ∩ W') (hb'_0 : b'_0 ∈ B ∩ W') + (hd_ab : Disjoint (Ω.interval a'_0 b_0) W') + (hd_ba : Disjoint (Ω.interval b'_0 a_0) W') + (hx₁ : x₁ ∈ Ω.interval a'_0 b_0) : + let G₁ := Ω.interval a'_0 b_0 + let G₂ := Ω.interval b'_0 a_0 + let A_arc := ({a'_0} ∪ Ω.interval b'_0 a'_0) \ G₂ + let B_arc := ({b'_0} ∪ Ω.interval a'_0 b'_0) \ G₁ + ∃ A_f B_f : Set α, Ω.IsFence A_f B_f ∧ + A_arc ⊆ A_f ∧ G₂ ⊆ A_f ∧ B_arc ⊆ B_f ∧ x₁ ∈ B_f := by + intro G₁ G₂ A_arc B_arc + obtain ⟨_, _, hG₂_sub, hG₁_sub, _, _⟩ := + four_arc_partition hfence hW' ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + have hb'_0_bar : b'_0 ∈ Ω.bar := hW' hb'_0.2 + have hx₁_bar : x₁ ∈ Ω.bar := hx₁.1.1 + have hx₁_a'b' : x₁ ∈ Ω.interval a'_0 b'_0 := hG₁_sub hx₁ + have hx₁_ne_b' : x₁ ≠ b'_0 := fun h => Ω.not_mem_interval_right a'_0 b'_0 (h ▸ hx₁_a'b') + have ha'_in_b'x₁ : a'_0 ∈ Ω.interval b'_0 x₁ := Ω.mem_interval_rotate_right hx₁_a'b' + have hP₁_sub : {a'_0} ∪ Ω.interval b'_0 a'_0 ⊆ Ω.interval b'_0 x₁ := by + rintro z (rfl | hz) + · exact ha'_in_b'x₁ + · exact Ω.interval_subset_interval_left ha'_in_b'x₁ hz + refine ⟨Ω.interval b'_0 x₁, {b'_0, x₁} ∪ Ω.interval x₁ b'_0, + pair_comm x₁ b'_0 ▸ (Ω.isFence_interval_compl hx₁_bar hb'_0_bar hx₁_ne_b').symm, + sdiff_subset.trans hP₁_sub, hG₂_sub.trans (subset_union_right.trans hP₁_sub), ?_, + Or.inl (Or.inr rfl)⟩ + rintro y ⟨rfl | hy_in, hy_not_G₁⟩ + · exact Or.inl (Or.inl rfl) + · rw [Ω.interval_eq_union_of_mem hx₁_a'b'] at hy_in + rcases hy_in with (hy_a'x₁ | rfl) | hy_x₁b' + · exact (hy_not_G₁ (Ω.interval_subset_interval_left hx₁ hy_a'x₁)).elim + · exact Or.inl (Or.inr rfl) + · exact Or.inr hy_x₁b' + +/-- Interval fence for `u, u' ∈ A_arc` (where `u ∉ W'`): +`A_f := {a_0, a'_0} ∪ Ω.interval a_0 a'_0` and `B_f := Ω.interval a'_0 a_0` satisfy +`A_arc = A_f` and `B_arc ∪ G₁ ∪ G₂ ⊆ B_f`. -/ +theorem fence_cut_A_arc {Ω : CyclicPerm α} {A B W' : Set α} + (hfence : Ω.IsFence A B) (hW' : W' ⊆ Ω.bar) + {a_0 a'_0 b_0 b'_0 u : α} + (ha_0 : a_0 ∈ A ∩ W') (ha'_0 : a'_0 ∈ A ∩ W') + (hb_0 : b_0 ∈ B ∩ W') (hb'_0 : b'_0 ∈ B ∩ W') + (hd_ab : Disjoint (Ω.interval a'_0 b_0) W') + (hd_ba : Disjoint (Ω.interval b'_0 a_0) W') + (hu_in : u ∈ ({a'_0} ∪ Ω.interval b'_0 a'_0) \ Ω.interval b'_0 a_0) + (hu_not_W' : u ∉ W') : + let G₁ := Ω.interval a'_0 b_0 + let G₂ := Ω.interval b'_0 a_0 + let A_arc := ({a'_0} ∪ Ω.interval b'_0 a'_0) \ G₂ + let B_arc := ({b'_0} ∪ Ω.interval a'_0 b'_0) \ G₁ + ∃ A_f B_f : Set α, Ω.IsFence A_f B_f ∧ + A_arc ⊆ A_f ∧ B_arc ⊆ B_f ∧ G₁ ⊆ B_f ∧ G₂ ⊆ B_f := by + intro G₁ G₂ A_arc B_arc + obtain ⟨hA_sub, _, _, _, hdisj_P, _⟩ := + four_arc_partition hfence hW' ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + have ha_0_bar : a_0 ∈ Ω.bar := hW' ha_0.2 + have ha'_0_bar : a'_0 ∈ Ω.bar := hW' ha'_0.2 + have ha_0_in_P₁ : a_0 ∈ {a'_0} ∪ Ω.interval b'_0 a'_0 := (hA_sub ha_0).1 + have ha_0_ne_a'_0 : a_0 ≠ a'_0 := by + intro h_eq + rcases hu_in.1 with rfl | hu_int + · exact hu_not_W' ha'_0.2 + · exact hu_in.2 (h_eq.symm ▸ hu_int) + have ha_0_b'a' : a_0 ∈ Ω.interval b'_0 a'_0 := + ha_0_in_P₁.resolve_left ha_0_ne_a'_0 + have hP₁_split : Ω.interval b'_0 a'_0 = G₂ ∪ {a_0} ∪ Ω.interval a_0 a'_0 := + Ω.interval_eq_union_of_mem ha_0_b'a' + let A_f := {a_0, a'_0} ∪ Ω.interval a_0 a'_0 + let B_f := Ω.interval a'_0 a_0 + have hfence_f : Ω.IsFence A_f B_f := + Ω.isFence_interval_compl ha_0_bar ha'_0_bar ha_0_ne_a'_0 + have hA_arc_eq : A_arc ⊆ A_f := by + rintro z ⟨rfl | hz_in, hz_not_G₂⟩ + · exact Or.inl (Or.inr rfl) + · rw [hP₁_split] at hz_in + rcases hz_in with (hz_G₂ | rfl) | hz_a0a' + · exact (hz_not_G₂ hz_G₂).elim + · exact Or.inl (Or.inl rfl) + · exact Or.inr hz_a0a' + have hA_f_sub_A_arc : A_f ⊆ A_arc := by + have hdisj_G₂_a0a' : Disjoint G₂ (Ω.interval a_0 a'_0) := + (Ω.disjoint_interval_swap a'_0 a_0).mono_left + (Ω.interval_subset_interval_right (Ω.mem_interval_rotate_right ha_0_b'a')) + rintro z ((rfl | rfl) | hz_in) + · exact hA_sub ha_0 + · exact hA_sub ha'_0 + · exact ⟨Or.inr (Ω.interval_subset_interval_right ha_0_b'a' hz_in), + disjoint_right.mp hdisj_G₂_a0a' hz_in⟩ + have hsub_Bf : ∀ {S_set : Set α}, S_set ⊆ Ω.bar → Disjoint S_set A_arc → S_set ⊆ B_f := by + intro S_set hS_bar hS_disj z hz + have hz_union : z ∈ A_f ∪ B_f := hfence_f.2.2.2.1.symm ▸ hS_bar hz + exact hz_union.resolve_left fun hzA => disjoint_left.mp hS_disj hz (hA_f_sub_A_arc hzA) + have hB_arc_sub : B_arc ⊆ B_f := by + apply hsub_Bf + · rintro z ⟨rfl | hz, _⟩ + · exact hW' hb'_0.2 + · exact hz.1.1 + · exact hdisj_P.symm.mono sdiff_subset sdiff_subset + have hG₁_sub : G₁ ⊆ B_f := by + apply hsub_Bf (Ω.interval_subset_bar a'_0 b_0) + obtain ⟨_, _, _, hG₁_sub_P₂, _, _⟩ := + four_arc_partition hfence hW' ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + exact hdisj_P.symm.mono (hG₁_sub_P₂.trans subset_union_right) sdiff_subset + have hG₂_sub : G₂ ⊆ B_f := + hsub_Bf (Ω.interval_subset_bar b'_0 a_0) disjoint_sdiff_self_right + exact ⟨A_f, B_f, hfence_f, hA_arc_eq, hB_arc_sub, hG₁_sub, hG₂_sub⟩ + +/-- Dual of `fence_cut_G₁`: cutting `G₁ = Ω.interval a'_0 b_0` at `x₁ ∈ G₁` so that `x₁ ∈ A_f`: +`A_f := {a_0, x₁} ∪ Ω.interval a_0 x₁` and `B_f := Ω.interval x₁ a_0` satisfy +`A_arc ∪ {x₁} ⊆ A_f` and `B_arc ∪ G₂ ⊆ B_f`. -/ +theorem fence_cut_G₁_dual {Ω : CyclicPerm α} {A B W' : Set α} + (hfence : Ω.IsFence A B) (hW' : W' ⊆ Ω.bar) + {a_0 a'_0 b_0 b'_0 x₁ : α} + (ha_0 : a_0 ∈ A ∩ W') (ha'_0 : a'_0 ∈ A ∩ W') + (hb_0 : b_0 ∈ B ∩ W') (hb'_0 : b'_0 ∈ B ∩ W') + (hd_ab : Disjoint (Ω.interval a'_0 b_0) W') + (hd_ba : Disjoint (Ω.interval b'_0 a_0) W') + (hx₁ : x₁ ∈ Ω.interval a'_0 b_0) : + let G₁ := Ω.interval a'_0 b_0 + let G₂ := Ω.interval b'_0 a_0 + let A_arc := ({a'_0} ∪ Ω.interval b'_0 a'_0) \ G₂ + let B_arc := ({b'_0} ∪ Ω.interval a'_0 b'_0) \ G₁ + ∃ A_f B_f : Set α, Ω.IsFence A_f B_f ∧ + A_arc ⊆ A_f ∧ x₁ ∈ A_f ∧ B_arc ⊆ B_f ∧ G₂ ⊆ B_f := by + intro G₁ G₂ A_arc B_arc + obtain ⟨_, hB_sub, _, hG₁_sub_P₂, hdisj_P, _⟩ := + four_arc_partition hfence hW' ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + have ha_0_bar : a_0 ∈ Ω.bar := hW' ha_0.2 + have hx₁_bar : x₁ ∈ Ω.bar := hx₁.1.1 + have ha'_0_in_a0b0 : a'_0 ∈ {a_0} ∪ Ω.interval a_0 b_0 := by + by_cases h_eq : a'_0 = a_0 + · exact Or.inl h_eq + · exact Or.inr (Ω.mem_interval_rotate_left + (Ω.mem_interval_of_mem_B_of_disjoint_AB hfence.symm hW' hb'_0 ha_0 hd_ba + hb_0 ha'_0 h_eq).1) + have hG₁_sub_a0b0 : Ω.interval a'_0 b_0 ⊆ Ω.interval a_0 b_0 := by + rcases ha'_0_in_a0b0 with h_eq | ha'_in + · rw [mem_singleton_iff.mp h_eq] + · exact Ω.interval_subset_interval_right ha'_in + have hx₁_a0b0 : x₁ ∈ Ω.interval a_0 b_0 := hG₁_sub_a0b0 hx₁ + have ha_0_ne_x₁ : a_0 ≠ x₁ := fun h => Ω.not_mem_interval_left a_0 b_0 (h ▸ hx₁_a0b0) + have hb_0_in_x₁a0 : b_0 ∈ Ω.interval x₁ a_0 := Ω.mem_interval_rotate_left hx₁_a0b0 + have hQ₂_sub : {b_0} ∪ Ω.interval b_0 a_0 ⊆ Ω.interval x₁ a_0 := by + rintro z (rfl | hz) + · exact hb_0_in_x₁a0 + · exact Ω.interval_subset_interval_right hb_0_in_x₁a0 hz + have hb'_0_in_b0a0 : b'_0 ∈ {b_0} ∪ Ω.interval b_0 a_0 := by + by_cases h_eq : b'_0 = b_0 + · exact Or.inl h_eq + · exact Or.inr (Ω.mem_interval_rotate_left + (Ω.mem_interval_of_mem_B_of_disjoint_AB hfence hW' ha'_0 hb_0 hd_ab + ha_0 hb'_0 h_eq).1) + have hG₂_sub_b0a0 : Ω.interval b'_0 a_0 ⊆ Ω.interval b_0 a_0 := by + rcases hb'_0_in_b0a0 with h_eq | hb'_in + · rw [mem_singleton_iff.mp h_eq] + · exact Ω.interval_subset_interval_right hb'_in + have hB_arc_sub_Q₂ : B_arc ⊆ {b_0} ∪ Ω.interval b_0 a_0 := by + rintro z ⟨rfl | hz_in, hz_not_G₁⟩ + · exact hb'_0_in_b0a0 + · have hb_0_in_P₂ : b_0 ∈ {b'_0} ∪ Ω.interval a'_0 b'_0 := (hB_sub hb_0).1 + rcases hb_0_in_P₂ with h_eq | hb_0_in + · rw [← mem_singleton_iff.mp h_eq] at hz_in + exact (hz_not_G₁ hz_in).elim + · rw [Ω.interval_eq_union_of_mem hb_0_in] at hz_in + rcases hz_in with (hz_G₁ | rfl) | hz_b0b' + · exact (hz_not_G₁ hz_G₁).elim + · exact Or.inl rfl + · rcases hb'_0_in_b0a0 with h_eq | hb'_in + · exact (Ω.not_mem_interval_right a'_0 b'_0 (h_eq ▸ hb_0_in)).elim + · exact Or.inr (Ω.interval_subset_interval_left hb'_in hz_b0b') + have hfence_f : Ω.IsFence ({a_0, x₁} ∪ Ω.interval a_0 x₁) (Ω.interval x₁ a_0) := + Ω.isFence_interval_compl ha_0_bar hx₁_bar ha_0_ne_x₁ + have hA_arc_sub_Af : A_arc ⊆ {a_0, x₁} ∪ Ω.interval a_0 x₁ := by + rintro z ⟨hz_P₁, hz_not_G₂⟩ + have hz_bar : z ∈ Ω.bar := by + rcases hz_P₁ with rfl | hz + · exact hW' ha'_0.2 + · exact hz.1.1 + have hz_union : z ∈ ({a_0, x₁} ∪ Ω.interval a_0 x₁) ∪ Ω.interval x₁ a_0 := + hfence_f.2.2.2.1.symm ▸ hz_bar + refine hz_union.resolve_right fun hz_Bf => ?_ + rw [Ω.interval_eq_union_of_mem hb_0_in_x₁a0] at hz_Bf + rcases hz_Bf with (hz_x₁b0 | rfl) | hz_b0a0 + · have hz_G₁ : z ∈ Ω.interval a'_0 b_0 := Ω.interval_subset_interval_right hx₁ hz_x₁b0 + exact disjoint_left.mp hdisj_P hz_P₁ (Or.inr (hG₁_sub_P₂ hz_G₁)) + · exact disjoint_left.mp hdisj_P hz_P₁ (hB_sub hb_0).1 + · rcases hb'_0_in_b0a0 with h_eq | hb'_in + · rw [← mem_singleton_iff.mp h_eq] at hz_b0a0 + exact hz_not_G₂ hz_b0a0 + · rw [Ω.interval_eq_union_of_mem hb'_in] at hz_b0a0 + rcases hz_b0a0 with (hz_b0b' | rfl) | hz_G₂ + · have hb_0_in_P₂ : b_0 ∈ {b'_0} ∪ Ω.interval a'_0 b'_0 := (hB_sub hb_0).1 + have hb_0_a'b' : b_0 ∈ Ω.interval a'_0 b'_0 := + hb_0_in_P₂.resolve_left fun h => Ω.not_mem_interval_left b_0 a_0 (h ▸ hb'_in) + exact disjoint_left.mp hdisj_P hz_P₁ + (Or.inr (Ω.interval_subset_interval_right hb_0_a'b' hz_b0b')) + · exact disjoint_left.mp hdisj_P hz_P₁ (Or.inl rfl) + · exact hz_not_G₂ hz_G₂ + exact ⟨{a_0, x₁} ∪ Ω.interval a_0 x₁, Ω.interval x₁ a_0, hfence_f, + hA_arc_sub_Af, Or.inl (Or.inr rfl), hB_arc_sub_Q₂.trans hQ₂_sub, + hG₂_sub_b0a0.trans (subset_union_right.trans hQ₂_sub)⟩ + +private theorem fence_for_two_switches_of_first_nonmember {Ω : CyclicPerm α} {A B W' : Set α} + (hfence : Ω.IsFence A B) (hW' : W' ⊆ Ω.bar) + {a_0 a'_0 b_0 b'_0 x₁ x₂ u u' : α} + (ha_0 : a_0 ∈ A ∩ W') (ha'_0 : a'_0 ∈ A ∩ W') + (hb_0 : b_0 ∈ B ∩ W') (hb'_0 : b'_0 ∈ B ∩ W') + (hd_ab : Disjoint (Ω.interval a'_0 b_0) W') + (hd_ba : Disjoint (Ω.interval b'_0 a_0) W') + (hx₁ : x₁ ∈ Ω.interval a'_0 b_0) + (hx₂ : x₂ ∈ Ω.interval b'_0 a_0) + (hu_bar : u ∈ Ω.bar) (hu_not_W' : u ∉ W') + (hu_not_G₁ : u ∉ Ω.interval a'_0 b_0) (hu_not_G₂ : u ∉ Ω.interval b'_0 a_0) + (hu'_bar : u' ∈ Ω.bar) + (hu'_not_G₁ : u' ∉ Ω.interval a'_0 b_0) (hu'_not_G₂ : u' ∉ Ω.interval b'_0 a_0) : + ∃ A_f B_f : Set α, Ω.IsFence A_f B_f ∧ + A ∩ W' ⊆ A_f ∧ B ∩ W' ⊆ B_f ∧ + ((u ∈ A_f ∧ x₁ ∈ B_f) ∨ (x₁ ∈ A_f ∧ u ∈ B_f)) ∧ + ((u' ∈ A_f ∧ x₂ ∈ B_f) ∨ (x₂ ∈ A_f ∧ u' ∈ B_f)) := by + obtain ⟨hA_sub, hB_sub, _, _, _, hpart⟩ := + four_arc_partition hfence hW' ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + have hu_AB := hpart u hu_bar hu_not_G₁ hu_not_G₂ + have hu'_AB := hpart u' hu'_bar hu'_not_G₁ hu'_not_G₂ + rcases hu_AB with huA | huB <;> rcases hu'_AB with hu'A | hu'B + · -- `u ∈ A_arc` and `u' ∈ A_arc`: use `fence_cut_A_arc`. + obtain ⟨A_f, B_f, hff, hAf, hBf, hG₁f, hG₂f⟩ := + fence_cut_A_arc hfence hW' ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba huA hu_not_W' + exact ⟨A_f, B_f, hff, hA_sub.trans hAf, hB_sub.trans hBf, + Or.inl ⟨hAf huA, hG₁f hx₁⟩, Or.inl ⟨hAf hu'A, hG₂f hx₂⟩⟩ + · -- `u ∈ A_arc` and `u' ∈ B_arc`: use `fence_cut_G₁`. + obtain ⟨A_f, B_f, hff, hAf, hG₂f, hBf, hx₁f⟩ := + fence_cut_G₁ hfence hW' ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba hx₁ + exact ⟨A_f, B_f, hff, hA_sub.trans hAf, hB_sub.trans hBf, + Or.inl ⟨hAf huA, hx₁f⟩, Or.inr ⟨hG₂f hx₂, hBf hu'B⟩⟩ + · obtain ⟨A_f, B_f, hff, hAf, hx₁f, hBf, hG₂f⟩ := + fence_cut_G₁_dual hfence hW' ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba hx₁ + exact ⟨A_f, B_f, hff, hA_sub.trans hAf, hB_sub.trans hBf, + Or.inr ⟨hx₁f, hBf huB⟩, Or.inl ⟨hAf hu'A, hG₂f hx₂⟩⟩ + · -- `u ∈ B_arc` and `u' ∈ B_arc`: use `fence_cut_A_arc` on `(B, A)`. + obtain ⟨B_f, A_f, hff, hBf, hAf, hG₂f, hG₁f⟩ := + fence_cut_A_arc hfence.symm hW' hb_0 hb'_0 ha_0 ha'_0 hd_ba hd_ab huB hu_not_W' + exact ⟨A_f, B_f, hff.symm, hA_sub.trans hAf, hB_sub.trans hBf, + Or.inr ⟨hG₁f hx₁, hBf huB⟩, Or.inr ⟨hG₂f hx₂, hBf hu'B⟩⟩ + +/-- Combining the four interval fences: for any `x₁ ∈ G₁`, `x₂ ∈ G₂`, and `u, u' ∈ A_arc ∪ B_arc` +with `u, u' ∉ W'`, there is a fence `(A_f, B_f)` of `Ω` such that `A ∩ W' ⊆ A_f`, `B ∩ W' ⊆ B_f`, +`u` and `x₁` lie on opposite sides of `(A_f, B_f)`, and `u'` and `x₂` lie on opposite sides of +`(A_f, B_f)`. -/ +theorem exists_fence_for_two_switches {Ω : CyclicPerm α} {A B W' : Set α} + (hfence : Ω.IsFence A B) (hW' : W' ⊆ Ω.bar) + {a_0 a'_0 b_0 b'_0 x₁ x₂ u u' : α} + (ha_0 : a_0 ∈ A ∩ W') (ha'_0 : a'_0 ∈ A ∩ W') + (hb_0 : b_0 ∈ B ∩ W') (hb'_0 : b'_0 ∈ B ∩ W') + (hd_ab : Disjoint (Ω.interval a'_0 b_0) W') + (hd_ba : Disjoint (Ω.interval b'_0 a_0) W') + (hx₁ : x₁ ∈ Ω.interval a'_0 b_0) + (hx₂ : x₂ ∈ Ω.interval b'_0 a_0) + (hu_bar : u ∈ Ω.bar) (hu_not_W' : u ∉ W') + (hu_not_G₁ : u ∉ Ω.interval a'_0 b_0) (hu_not_G₂ : u ∉ Ω.interval b'_0 a_0) + (hu'_bar : u' ∈ Ω.bar) (_hu'_not_W' : u' ∉ W') + (hu'_not_G₁ : u' ∉ Ω.interval a'_0 b_0) (hu'_not_G₂ : u' ∉ Ω.interval b'_0 a_0) : + ∃ A_f B_f : Set α, Ω.IsFence A_f B_f ∧ + A ∩ W' ⊆ A_f ∧ B ∩ W' ⊆ B_f ∧ + ((u ∈ A_f ∧ x₁ ∈ B_f) ∨ (x₁ ∈ A_f ∧ u ∈ B_f)) ∧ + ((u' ∈ A_f ∧ x₂ ∈ B_f) ∨ (x₂ ∈ A_f ∧ u' ∈ B_f)) := by + exact fence_for_two_switches_of_first_nonmember hfence hW' ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + hx₁ hx₂ hu_bar hu_not_W' hu_not_G₁ hu_not_G₂ hu'_bar hu'_not_G₁ hu'_not_G₂ + +/-- If `x₁ ∈ G₁ = S.Ω.interval a'_0 b_0` and `u ∈ S.Ω.bar \ (G₁ ∪ {a'_0, b_0})`, then +`b_0 ∈ S.Ω.interval x₁ u` and `a'_0 ∈ S.Ω.interval u x₁`. -/ +theorem mem_interval_of_mem_gap_and_not_mem {Ω : CyclicPerm α} + {a'_0 b_0 x₁ u : α} + (ha'_0 : a'_0 ∈ Ω.bar) (hb_0 : b_0 ∈ Ω.bar) (hab : a'_0 ≠ b_0) + (hx₁ : x₁ ∈ Ω.interval a'_0 b_0) + (hu_bar : u ∈ Ω.bar) (hua' : u ≠ a'_0) (hub : u ≠ b_0) + (hu_not : u ∉ Ω.interval a'_0 b_0) : + b_0 ∈ Ω.interval x₁ u ∧ a'_0 ∈ Ω.interval u x₁ := by + have hu_ba : u ∈ Ω.interval b_0 a'_0 := + (Ω.mem_interval_or_interval_swap ha'_0 hb_0 hu_bar hab hua' hub).resolve_left hu_not + have hcw4 : Ω.IsClockwise4 a'_0 x₁ b_0 u := + Ω.isClockwise4_iff_interval.mpr ⟨hx₁, hu_ba⟩ + exact Ω.isClockwise4_iff_interval.mp (Ω.isClockwise4_rotate hcw4) + +/-- Any non-exchangeable attachment `P` to a crooked transaction `P_set` with leg `P₁` (an overpass +of `P_set`) has its outer end `u` outside both gap intervals `G₁ = S.Ω.interval a'_0 b_0` and +`G₂ = S.Ω.interval b'_0 a_0`. -/ +theorem end_not_mem_gaps_of_not_exchangeable (S : Society α β) + {P_set : Set (Graph α β)} {A B : Set α} + (_hcrooked : S.IsCrookedTransaction P_set) + (hfence : S.IsFenceFor P_set A B) + {P P₁ : Graph α β} {v u e₁ e₂ a_0 a'_0 b_0 b'_0 : α} + (hatt : S.IsAttachmentWithEnds P_set P v u) + (hnot_exch : ¬ S.IsExchangeableAttachment P_set P) + (hP₁ : P₁ ∈ P_set) (hvP₁ : v ∈ V(P₁)) + (hP₁_ends : S.IsOmegaPathWithEnds P₁ e₁ e₂) + (W' : Set α) (hW'_def : W' = S.transactionEnds (P_set \ {P₁})) + (ha_0 : a_0 ∈ A ∩ W') (ha'_0 : a'_0 ∈ A ∩ W') + (hb_0 : b_0 ∈ B ∩ W') (hb'_0 : b'_0 ∈ B ∩ W') + (hd_ab : Disjoint (S.Ω.interval a'_0 b_0) W') + (hd_ba : Disjoint (S.Ω.interval b'_0 a_0) W') + (he₁ : e₁ ∈ S.Ω.interval a'_0 b_0) + (he₂ : e₂ ∈ S.Ω.interval b'_0 a_0) : + u ∉ S.Ω.interval a'_0 b_0 ∧ u ∉ S.Ω.interval b'_0 a_0 := by + have hW'_bar : W' ⊆ S.Ω.bar := hW'_def ▸ S.transactionEnds_subset_bar (P_set \ {P₁}) + obtain ⟨Q_1', Q_2, _, _, hQ_1', hQ_2, _, _, _⟩ := hP₁_ends.1.exists_split_at hvP₁ + have hQ_1 : IsGraphPathWithEnds P₁ Q_1' v e₁ := hQ_1'.symm + -- Helper: if a switch `L'` of `P` with end `e ∈ {e₁, e₂}` has one of `{u, e}` in `G₁` and the + -- other in `G₂`, then `(P_set \ {P₁}) ∪ {L'}` is a crooked transaction, contradicting + -- `hnot_exch`. + have hnot_both_gaps : ∀ {Q : Graph α β} {e x₁ x₂ : α}, + (IsGraphPathWithEnds P₁ Q v e₁ ∧ e = e₁ ∨ IsGraphPathWithEnds P₁ Q v e₂ ∧ e = e₂) → + ({u, e} : Set α) = {x₁, x₂} → + x₁ ∈ S.Ω.interval a'_0 b_0 → x₂ ∈ S.Ω.interval b'_0 a_0 → False := by + intro Q e x₁ x₂ hQe hpair hx₁ hx₂ + have hQ : IsGraphPathWithEnds P₁ Q v e := by + rcases hQe with ⟨h, rfl⟩ | ⟨h, rfl⟩ <;> exact h + have he_or : e = e₁ ∨ e = e₂ := by + rcases hQe with ⟨_, rfl⟩ | ⟨_, rfl⟩ + · exact Or.inl rfl + · exact Or.inr rfl + let L' := subgraphUnion S.G P Q + let P_set' := (P_set \ {P₁}) ∪ {L'} + have hL'_ends_ue : S.IsOmegaPathWithEnds L' u e := + hatt.isOmegaPathWithEnds_subgraphUnion S hP₁ hvP₁ hP₁_ends hQ he_or + have hL'_ends : S.IsOmegaPathWithEnds L' x₂ x₁ := by + have hx₂_in : x₂ ∈ ({u, e} : Set α) := by rw [hpair]; simp + have hx₁_in : x₁ ∈ ({u, e} : Set α) := by rw [hpair]; simp + obtain ⟨_, _, _, hG₁_sub, hdisj_P, _⟩ := + four_arc_partition hfence.2.1 hW'_bar ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + obtain ⟨_, _, hG₂_sub, _, _, _⟩ := + four_arc_partition hfence.2.1 hW'_bar ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + have hx12 : x₁ ≠ x₂ := fun h => + disjoint_left.mp hdisj_P (Or.inr (hG₂_sub hx₂)) (h ▸ Or.inr (hG₁_sub hx₁)) + rcases hx₂_in with rfl | rfl <;> rcases hx₁_in with rfl | rfl + · exact (hx12 rfl).elim + · exact hL'_ends_ue + · exact hL'_ends_ue.symm S + · exact (hx12 rfl).elim + obtain ⟨A_f, B_f, hff, hAf, hG₂f, hBf, hx₁f⟩ := + fence_cut_G₁ hfence.2.1 hW'_bar ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba hx₁ + obtain ⟨hA_sub, hB_sub, _, _, _, _⟩ := + four_arc_partition hfence.2.1 hW'_bar ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + have hdisj' : S.IsDisjointOmegaPathSet P_set' := + hatt.isDisjointOmegaPathSet_switch S hfence.1 hP₁ hvP₁ hP₁_ends hQ he_or + have hfence' : S.IsFenceFor P_set' A_f B_f := by + refine ⟨hdisj', hff, ?_⟩ + rintro R (hR | rfl) + · obtain ⟨a_R, ha_R, b_R, hb_R, hR_ends⟩ := hfence.2.2 R hR.1 + have ha_R_W' : a_R ∈ A ∩ W' := ⟨ha_R, hW'_def ▸ hR_ends.mem_transactionEnds_left S hR⟩ + have hb_R_W' : b_R ∈ B ∩ W' := ⟨hb_R, hW'_def ▸ hR_ends.mem_transactionEnds_right S hR⟩ + exact ⟨a_R, hAf (hA_sub ha_R_W'), b_R, hBf (hB_sub hb_R_W'), hR_ends⟩ + · exact ⟨x₂, hG₂f hx₂, x₁, hx₁f, hL'_ends⟩ + have hW'_sub_ends : W' ⊆ S.transactionEnds P_set' := by + rw [hW'_def, hatt.transactionEnds_switch S hP₁ hvP₁ hP₁_ends hQ he_or] + exact subset_union_left + have hx₁_mem_ends : x₁ ∈ S.transactionEnds P_set' := + hL'_ends.mem_transactionEnds_right S (Or.inr rfl) + have hx₂_mem_ends : x₂ ∈ S.transactionEnds P_set' := + hL'_ends.mem_transactionEnds_left S (Or.inr rfl) + have hcr' : S.IsCrookedTransaction P_set' := by + refine ⟨⟨A_f, B_f, hfence'⟩, ?_⟩ + rintro R (hR | rfl) hper + · obtain ⟨a_R, ha_R, b_R, hb_R, hR_ends⟩ := hfence.2.2 R hR.1 + have ha_R_W' : a_R ∈ A ∩ W' := ⟨ha_R, hW'_def ▸ hR_ends.mem_transactionEnds_left S hR⟩ + have hb_R_W' : b_R ∈ B ∩ W' := ⟨hb_R, hW'_def ▸ hR_ends.mem_transactionEnds_right S hR⟩ + have hper' := (hR_ends.isPeripheralIn_iff S (Or.inl hR)).mp hper + rcases hper' with hd₁ | hd₂ + · have hsub₁ := S.Ω.interval_subset_of_disjoint_AB hfence.2.1 hW'_bar + ha'_0 hb_0 hd_ab ha_R_W' hb_R_W' + exact disjoint_left.mp hd₁ (hsub₁ hx₁) hx₁_mem_ends + · have hsub₂ := S.Ω.interval_subset_of_disjoint_AB hfence.2.1.symm hW'_bar + hb'_0 ha_0 hd_ba hb_R_W' ha_R_W' + exact disjoint_left.mp hd₂ (hsub₂ hx₂) hx₂_mem_ends + · have hper' := (hL'_ends.isPeripheralIn_iff S (Or.inr rfl)).mp hper + obtain ⟨_, _, hG₂_sub, hG₁_sub, hdisj_P, _⟩ := + four_arc_partition hfence.2.1 hW'_bar ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + have hx₂_not_G₁ : x₂ ∉ S.Ω.interval a'_0 b_0 := fun h => + disjoint_left.mp hdisj_P (Or.inr (hG₂_sub hx₂)) (Or.inr (hG₁_sub h)) + have hx₂_ne_a' : x₂ ≠ a'_0 := fun h => + S.Ω.not_mem_interval_right b'_0 a'_0 (h ▸ hG₂_sub hx₂) + have hx₂_ne_b : x₂ ≠ b_0 := fun h => + disjoint_right.mp hd_ba hb_0.2 (h ▸ hx₂) + have ha'_ne_b : a'_0 ≠ b_0 := fun h => + disjoint_left.mp hfence.2.1.2.2.1 ha'_0.1 (h ▸ hb_0.1) + have h_in := mem_interval_of_mem_gap_and_not_mem + (hW'_bar ha'_0.2) (hW'_bar hb_0.2) ha'_ne_b hx₁ hx₂.1.1 hx₂_ne_a' hx₂_ne_b hx₂_not_G₁ + rcases hper' with hd₁ | hd₂ + · exact disjoint_left.mp hd₁ h_in.2 (hW'_sub_ends ha'_0.2) + · exact disjoint_left.mp hd₂ h_in.1 (hW'_sub_ends hb_0.2) + have hsw : S.IsSwitch P_set P P₁ L' := by + refine ⟨hP₁, v, u, e₁, e₂, hatt, hvP₁, hP₁_ends, Q, ?_, rfl⟩ + rcases hQe with ⟨h, _⟩ | ⟨h, _⟩ + · exact Or.inl h + · exact Or.inr h + exact hnot_exch ⟨⟨v, u, hatt⟩, P₁, L', hsw, hcr'⟩ + refine ⟨fun hu_G₁ => ?_, fun hu_G₂ => ?_⟩ + · exact hnot_both_gaps (Or.inr ⟨hQ_2, rfl⟩) rfl hu_G₁ he₂ + · exact hnot_both_gaps (Or.inl ⟨hQ_1, rfl⟩) (pair_comm u e₁) he₁ hu_G₂ + +private theorem exists_overpass_gaps (S : Society α β) + {P_set : Set (Graph α β)} {P₁ : Graph α β} {A B : Set α} + (hcrooked : S.IsCrookedTransaction P_set) (hfence : S.IsFenceFor P_set A B) + (hP₁_in : P₁ ∈ P_set) (hover : S.IsOverpass P_set P₁) : + let W' := S.transactionEnds (P_set \ {P₁}) + ∃ a₀ ∈ A ∩ W', ∃ a'₀ ∈ A ∩ W', ∃ b₀ ∈ B ∩ W', ∃ b'₀ ∈ B ∩ W', + Disjoint (S.Ω.interval a'₀ b₀) W' ∧ Disjoint (S.Ω.interval b'₀ a₀) W' ∧ + ∃ e₁ e₂, S.IsOmegaPathWithEnds P₁ e₁ e₂ ∧ + e₁ ∈ S.Ω.interval a'₀ b₀ ∧ e₂ ∈ S.Ω.interval b'₀ a₀ := by + obtain ⟨a₁_raw, ha₁_raw, b₁_raw, hb₁_raw, hP₁_ends_raw⟩ := hfence.2.2 P₁ hP₁_in + rcases hover with ⟨_, _, R₁, hR₁_in, R₂, hR₂_in, hR12, hper₁, hper₂⟩ + obtain ⟨x₁, hx₁, y₁, hy₁, hR₁_ends⟩ := hfence.2.2 R₁ hR₁_in.1 + obtain ⟨x₂, hx₂, y₂, hy₂, hR₂_ends⟩ := hfence.2.2 R₂ hR₂_in.1 + let W' := S.transactionEnds (P_set \ {P₁}) + have hW'_bar : W' ⊆ S.Ω.bar := S.transactionEnds_subset_bar (P_set \ {P₁}) + have hx₁W' : x₁ ∈ A ∩ W' := ⟨hx₁, hR₁_ends.mem_transactionEnds_left S hR₁_in⟩ + have hy₁W' : y₁ ∈ B ∩ W' := ⟨hy₁, hR₁_ends.mem_transactionEnds_right S hR₁_in⟩ + have hx₂W' : x₂ ∈ A ∩ W' := ⟨hx₂, hR₂_ends.mem_transactionEnds_left S hR₂_in⟩ + have hy₂W' : y₂ ∈ B ∩ W' := ⟨hy₂, hR₂_ends.mem_transactionEnds_right S hR₂_in⟩ + have hper₁' := (hR₁_ends.isPeripheralIn_iff S hR₁_in).mp hper₁ + have hper₂' := (hR₂_ends.isPeripheralIn_iff S hR₂_in).mp hper₂ + have hdisj_R12 : Disjoint V(R₁) V(R₂) := hfence.1.2 hR₁_in.1 hR₂_in.1 hR12 + have hx12 : x₁ ≠ x₂ := fun h => disjoint_left.mp hdisj_R12 hR₁_ends.1.left_mem + (h ▸ hR₂_ends.1.left_mem) + have hy12 : y₁ ≠ y₂ := fun h => disjoint_left.mp hdisj_R12 hR₁_ends.1.right_mem + (h ▸ hR₂_ends.1.right_mem) + have hex_boundary : + ∃ a_0 ∈ A ∩ W', ∃ a'_0 ∈ A ∩ W', ∃ b_0 ∈ B ∩ W', ∃ b'_0 ∈ B ∩ W', + Disjoint (S.Ω.interval a'_0 b_0) W' ∧ Disjoint (S.Ω.interval b'_0 a_0) W' := by + rcases hper₁' with hd₁ | hd₁ <;> rcases hper₂' with hd₂ | hd₂ + · exfalso + exact hx12 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1 hW'_bar hx₁W' hy₁W' hx₂W' + hy₂W' hd₁ hd₂).1 + · exact ⟨x₂, hx₂W', x₁, hx₁W', y₁, hy₁W', y₂, hy₂W', hd₁, hd₂⟩ + · exact ⟨x₁, hx₁W', x₂, hx₂W', y₂, hy₂W', y₁, hy₁W', hd₂, hd₁⟩ + · exfalso + exact hy12 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1.symm hW'_bar hy₁W' hx₁W' hy₂W' + hx₂W' hd₁ hd₂).1 + obtain ⟨a_0, ha_0, a'_0, ha'_0, b_0, hb_0, b'_0, hb'_0, hd_ab, hd_ba⟩ := hex_boundary + -- One end `e₁` of `P₁` lies in `G₁ = S.Ω.interval a'_0 b_0` and the other `e₂` lies in + -- `G₂ = S.Ω.interval b'_0 a_0`. + have hR_ab : ∃ R_ab ∈ P_set \ {P₁}, S.IsOmegaPathWithEnds R_ab a'_0 b_0 := by + rcases hper₁' with hd₁ | hd₁ + · obtain ⟨rfl, rfl⟩ := S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1 hW'_bar + ha'_0 hb_0 hx₁W' hy₁W' hd_ab hd₁ + exact ⟨R₁, hR₁_in, hR₁_ends⟩ + · rcases hper₂' with hd₂ | hd₂ + · obtain ⟨rfl, rfl⟩ := S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1 hW'_bar + ha'_0 hb_0 hx₂W' hy₂W' hd_ab hd₂ + exact ⟨R₂, hR₂_in, hR₂_ends⟩ + · exfalso + exact hy12 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1.symm hW'_bar + hy₁W' hx₁W' hy₂W' hx₂W' hd₁ hd₂).1 + have hR_ba : ∃ R_ba ∈ P_set \ {P₁}, S.IsOmegaPathWithEnds R_ba a_0 b'_0 := by + rcases hper₁' with hd₁ | hd₁ + · rcases hper₂' with hd₂ | hd₂ + · exfalso + exact hx12 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1 hW'_bar + hx₁W' hy₁W' hx₂W' hy₂W' hd₁ hd₂).1 + · obtain ⟨rfl, rfl⟩ := S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1.symm hW'_bar + hb'_0 ha_0 hy₂W' hx₂W' hd_ba hd₂ + exact ⟨R₂, hR₂_in, hR₂_ends⟩ + · obtain ⟨rfl, rfl⟩ := S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1.symm hW'_bar + hb'_0 ha_0 hy₁W' hx₁W' hd_ba hd₁ + exact ⟨R₁, hR₁_in, hR₁_ends⟩ + obtain ⟨R_ab, hR_ab_in, hR_ab_ends⟩ := hR_ab + obtain ⟨R_ba, hR_ba_in, hR_ba_ends⟩ := hR_ba + have h_e_G₁ := S.mem_interval_of_peripheral_diff_singleton hfence hcrooked hP₁_in hR_ab_in + ha₁_raw hb₁_raw hP₁_ends_raw ha'_0.1 hb_0.1 hR_ab_ends hd_ab + have hfence_BA : S.IsFenceFor P_set B A := + ⟨hfence.1, hfence.2.1.symm, fun R hR => by + obtain ⟨a, ha, b_e, hb_e, hR_e⟩ := hfence.2.2 R hR + exact ⟨b_e, hb_e, a, ha, hR_e.symm S⟩⟩ + have h_e_G₂ := S.mem_interval_of_peripheral_diff_singleton hfence_BA hcrooked hP₁_in hR_ba_in + hb₁_raw ha₁_raw (hP₁_ends_raw.symm S) hb'_0.1 ha_0.1 (hR_ba_ends.symm S) hd_ba + obtain ⟨_, _, hG₂_sub, hG₁_sub, hdisj_P, _⟩ := + four_arc_partition hfence.2.1 hW'_bar ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + have hdisj_G₁G₂ : Disjoint (S.Ω.interval a'_0 b_0) (S.Ω.interval b'_0 a_0) := + hdisj_P.symm.mono (hG₁_sub.trans subset_union_right) (hG₂_sub.trans subset_union_right) + have hex_ends : ∃ e₁ e₂ : α, + S.IsOmegaPathWithEnds P₁ e₁ e₂ ∧ + e₁ ∈ S.Ω.interval a'_0 b_0 ∧ e₂ ∈ S.Ω.interval b'_0 a_0 := by + rcases h_e_G₁ with ⟨ha₁_G₁, _⟩ | ⟨hb₁_G₁, _⟩ <;> + rcases h_e_G₂ with ⟨hb₁_G₂, _⟩ | ⟨ha₁_G₂, _⟩ + · exact ⟨a₁_raw, b₁_raw, hP₁_ends_raw, ha₁_G₁, hb₁_G₂⟩ + · exact (disjoint_left.mp hdisj_G₁G₂ ha₁_G₁ ha₁_G₂).elim + · exact (disjoint_left.mp hdisj_G₁G₂ hb₁_G₁ hb₁_G₂).elim + · exact ⟨b₁_raw, a₁_raw, hP₁_ends_raw.symm S, hb₁_G₁, ha₁_G₂⟩ + obtain ⟨e₁, e₂, hP₁_ends, he₁_G₁, he₂_G₂⟩ := hex_ends + exact ⟨a_0, ha_0, a'_0, ha'_0, b_0, hb_0, b'_0, hb'_0, hd_ab, hd_ba, e₁, e₂, + hP₁_ends, he₁_G₁, he₂_G₂⟩ + +/-- Replacing one path by two disjoint switches across its gaps preserves crookedness. -/ +theorem crookedTransaction_of_two_switches (S : Society α β) + {P_set : Set (Graph α β)} {P₁ L₁ L₂ : Graph α β} {A B : Set α} + {a_0 a'_0 b_0 b'_0 e₁ e₂ u₁ u₂ : α} + (hfence : S.IsFenceFor P_set A B) + (ha_0 : a_0 ∈ A ∩ S.transactionEnds (P_set \ {P₁})) + (ha'_0 : a'_0 ∈ A ∩ S.transactionEnds (P_set \ {P₁})) + (hb_0 : b_0 ∈ B ∩ S.transactionEnds (P_set \ {P₁})) + (hb'_0 : b'_0 ∈ B ∩ S.transactionEnds (P_set \ {P₁})) + (hd_ab : Disjoint (S.Ω.interval a'_0 b_0) (S.transactionEnds (P_set \ {P₁}))) + (hd_ba : Disjoint (S.Ω.interval b'_0 a_0) (S.transactionEnds (P_set \ {P₁}))) + (he₁_G₁ : e₁ ∈ S.Ω.interval a'_0 b_0) (he₂_G₂ : e₂ ∈ S.Ω.interval b'_0 a_0) + (hdisj_L12 : Disjoint V(L₁) V(L₂)) + (hdisj_LR : ∀ R ∈ P_set \ {P₁}, Disjoint V(L₁) V(R) ∧ Disjoint V(L₂) V(R)) + (hL₁_ends : S.IsOmegaPathWithEnds L₁ u₁ e₁) + (hL₂_ends : S.IsOmegaPathWithEnds L₂ u₂ e₂) + (hu₁_bar : u₁ ∈ S.Ω.bar) (hu₁_not_W' : u₁ ∉ S.transactionEnds (P_set \ {P₁})) + (hu₁_G₁ : u₁ ∉ S.Ω.interval a'_0 b_0) (hu₁_G₂ : u₁ ∉ S.Ω.interval b'_0 a_0) + (hu₂_bar : u₂ ∈ S.Ω.bar) (hu₂_not_W' : u₂ ∉ S.transactionEnds (P_set \ {P₁})) + (hu₂_G₁ : u₂ ∉ S.Ω.interval a'_0 b_0) (hu₂_G₂ : u₂ ∉ S.Ω.interval b'_0 a_0) : + S.IsCrookedTransaction ((P_set \ {P₁}) ∪ {L₁, L₂}) := by + let W' := S.transactionEnds (P_set \ {P₁}) + have hW'_bar : W' ⊆ S.Ω.bar := S.transactionEnds_subset_bar (P_set \ {P₁}) + let P_set'' := (P_set \ {P₁}) ∪ {L₁, L₂} + obtain ⟨A_f, B_f, hff, hAf, hBf, h_u₁e₁, h_u₂e₂⟩ := + fence_for_two_switches_of_first_nonmember hfence.2.1 hW'_bar ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + he₁_G₁ he₂_G₂ hu₁_bar hu₁_not_W' hu₁_G₁ hu₁_G₂ hu₂_bar hu₂_G₁ hu₂_G₂ + have hdisj'' : S.IsDisjointOmegaPathSet P_set'' := by + refine ⟨?_, ?_⟩ + · rintro R (hR | rfl | rfl) + · exact hfence.1.1 R hR.1 + · exact ⟨u₁, e₁, hL₁_ends⟩ + · exact ⟨u₂, e₂, hL₂_ends⟩ + · rintro M₁ (hM₁ | rfl | rfl) M₂ (hM₂ | rfl | rfl) hne + · exact hfence.1.2 hM₁.1 hM₂.1 hne + · exact (hdisj_LR M₁ hM₁).1.symm + · exact (hdisj_LR M₁ hM₁).2.symm + · exact (hdisj_LR M₂ hM₂).1 + · exact (hne rfl).elim + · exact hdisj_L12 + · exact (hdisj_LR M₂ hM₂).2 + · exact hdisj_L12.symm + · exact (hne rfl).elim + have hfence'' : S.IsFenceFor P_set'' A_f B_f := by + refine ⟨hdisj'', hff, ?_⟩ + rintro R (hR | rfl | rfl) + · obtain ⟨a_R, ha_R, b_R, hb_R, hR_ends⟩ := hfence.2.2 R hR.1 + have ha_R_W' : a_R ∈ A ∩ W' := ⟨ha_R, hR_ends.mem_transactionEnds_left S hR⟩ + have hb_R_W' : b_R ∈ B ∩ W' := ⟨hb_R, hR_ends.mem_transactionEnds_right S hR⟩ + exact ⟨a_R, hAf ha_R_W', b_R, hBf hb_R_W', hR_ends⟩ + · rcases h_u₁e₁ with ⟨hu₁A, he₁B⟩ | ⟨he₁A, hu₁B⟩ + · exact ⟨u₁, hu₁A, e₁, he₁B, hL₁_ends⟩ + · exact ⟨e₁, he₁A, u₁, hu₁B, hL₁_ends.symm S⟩ + · rcases h_u₂e₂ with ⟨hu₂A, he₂B⟩ | ⟨he₂A, hu₂B⟩ + · exact ⟨u₂, hu₂A, e₂, he₂B, hL₂_ends⟩ + · exact ⟨e₂, he₂A, u₂, hu₂B, hL₂_ends.symm S⟩ + have hW'_sub_ends : W' ⊆ S.transactionEnds P_set'' := + fun z ⟨R, hR, y, hR_e⟩ => ⟨R, Or.inl hR, y, hR_e⟩ + have he₁_mem_ends : e₁ ∈ S.transactionEnds P_set'' := + hL₁_ends.mem_transactionEnds_right S (Or.inr (Or.inl rfl)) + have he₂_mem_ends : e₂ ∈ S.transactionEnds P_set'' := + hL₂_ends.mem_transactionEnds_right S (Or.inr (Or.inr rfl)) + refine ⟨⟨A_f, B_f, hfence''⟩, ?_⟩ + rintro R (hR | rfl | rfl) hper + · obtain ⟨a_R, ha_R, b_R, hb_R, hR_ends⟩ := hfence.2.2 R hR.1 + have ha_R_W' : a_R ∈ A ∩ W' := ⟨ha_R, hR_ends.mem_transactionEnds_left S hR⟩ + have hb_R_W' : b_R ∈ B ∩ W' := ⟨hb_R, hR_ends.mem_transactionEnds_right S hR⟩ + have hper' := (hR_ends.isPeripheralIn_iff S (Or.inl hR)).mp hper + rcases hper' with hd₁ | hd₂ + · have hsub₁ := S.Ω.interval_subset_of_disjoint_AB hfence.2.1 hW'_bar + ha'_0 hb_0 hd_ab ha_R_W' hb_R_W' + exact disjoint_left.mp hd₁ (hsub₁ he₁_G₁) he₁_mem_ends + · have hsub₂ := S.Ω.interval_subset_of_disjoint_AB hfence.2.1.symm hW'_bar + hb'_0 ha_0 hd_ba hb_R_W' ha_R_W' + exact disjoint_left.mp hd₂ (hsub₂ he₂_G₂) he₂_mem_ends + · have hper' := (hL₁_ends.isPeripheralIn_iff S (Or.inr (Or.inl rfl))).mp hper + have ha'_ne_b : a'_0 ≠ b_0 := fun h => + disjoint_left.mp hfence.2.1.2.2.1 ha'_0.1 (h ▸ hb_0.1) + have hu₁_ne_a' : u₁ ≠ a'_0 := fun h => hu₁_not_W' (h ▸ ha'_0.2) + have hu₁_ne_b : u₁ ≠ b_0 := fun h => hu₁_not_W' (h ▸ hb_0.2) + have h_in := mem_interval_of_mem_gap_and_not_mem + (hW'_bar ha'_0.2) (hW'_bar hb_0.2) ha'_ne_b he₁_G₁ hu₁_bar hu₁_ne_a' hu₁_ne_b hu₁_G₁ + rcases hper' with hd₁ | hd₂ + · exact disjoint_left.mp hd₁ h_in.2 (hW'_sub_ends ha'_0.2) + · exact disjoint_left.mp hd₂ h_in.1 (hW'_sub_ends hb_0.2) + · have hper' := (hL₂_ends.isPeripheralIn_iff S (Or.inr (Or.inr rfl))).mp hper + have hb'_ne_a : b'_0 ≠ a_0 := fun h => + disjoint_left.mp hfence.2.1.2.2.1 ha_0.1 (h ▸ hb'_0.1) + have hu₂_ne_b' : u₂ ≠ b'_0 := fun h => hu₂_not_W' (h ▸ hb'_0.2) + have hu₂_ne_a : u₂ ≠ a_0 := fun h => hu₂_not_W' (h ▸ ha_0.2) + have h_in := mem_interval_of_mem_gap_and_not_mem + (hW'_bar hb'_0.2) (hW'_bar ha_0.2) hb'_ne_a he₂_G₂ hu₂_bar hu₂_ne_b' hu₂_ne_a hu₂_G₂ + rcases hper' with hd₁ | hd₂ + · exact disjoint_left.mp hd₁ h_in.2 (hW'_sub_ends hb'_0.2) + · exact disjoint_left.mp hd₂ h_in.1 (hW'_sub_ends ha_0.2) + +/-- **Graph Minors IX, (3.3)** (page 48): +"Let $\mathscr{P}$ be a crooked transaction in $(G, \Omega)$. If $P$ and $P'$ are both +non-exchangeable attachments to $\mathscr{P}$ and $P, P'$ are disjoint, then there is a +crooked transaction $\mathscr{P}'$ with $|\mathscr{P}'| = |\mathscr{P}| + 1$ and* $$ \bigcup +\mathscr{P}' \subseteq \bigcup \mathscr{P} \cup (P \cup P'). $$ *Moreover, the two +attachments have a common leg, which is an overpass of $\mathscr{P}$, and no edge of this +leg between the two feet is in $\bigcup \mathscr{P}'$." -/ +theorem theorem_3_3_proof (S : Society α β) + {P_set : Set (Graph α β)} {P P' : Graph α β} + (hcrooked : S.IsCrookedTransaction P_set) + (hatt : S.IsAttachment P_set P) + (hnot_exch : ¬ S.IsExchangeableAttachment P_set P) + (hatt' : S.IsAttachment P_set P') + (hnot_exch' : ¬ S.IsExchangeableAttachment P_set P') + (hdisj_PP' : Disjoint V(P) V(P')) : + ∃ P₁ ∈ P_set, + S.IsOverpass P_set P₁ ∧ + S.IsLeg P_set P P₁ ∧ + S.IsLeg P_set P' P₁ ∧ + ∃ b b' : α, + S.IsFoot P_set P b ∧ b ∈ V(P₁) ∧ + S.IsFoot P_set P' b' ∧ b' ∈ V(P₁) ∧ + ∃ M : Graph α β, + M ≤ P₁ ∧ IsGraphPathWithEnds P₁ M b b' ∧ + ∃ P_set' : Set (Graph α β), + S.IsCrookedTransaction P_set' ∧ + P_set'.ncard = P_set.ncard + 1 ∧ + S.transactionUnion P_set' ≤ + subgraphUnion S.G (S.transactionUnion P_set) (subgraphUnion S.G P P') ∧ + Disjoint E(M) E(S.transactionUnion P_set') := by + -- By (3.2) and (3.1), `P` and `P'` have a common leg `P₁` which is an overpass of `P_set`. + obtain ⟨_, P₁, hleg, hover⟩ := S.theorem_3_2_proof hcrooked hatt hnot_exch + obtain ⟨_, P₁', hleg', hover'⟩ := S.theorem_3_2_proof hcrooked hatt' hnot_exch' + have hP₁_eq : P₁' = P₁ := S.theorem_3_1_proof hcrooked hover' hover + rw [hP₁_eq] at hleg' + rcases hleg with ⟨hP₁_in, b, ⟨u, hatt_bu⟩, hbP₁⟩ + rcases hleg' with ⟨_, b', ⟨u', hatt'_b'u'⟩, hb'P₁⟩ + have hbb' : b ≠ b' := + fun h => disjoint_left.mp hdisj_PP' hatt_bu.1.left_mem (h ▸ hatt'_b'u'.1.left_mem) + refine ⟨P₁, hP₁_in, hover, + ⟨hP₁_in, b, ⟨u, hatt_bu⟩, hbP₁⟩, + ⟨hP₁_in, b', ⟨u', hatt'_b'u'⟩, hb'P₁⟩, + b, b', ⟨u, hatt_bu⟩, hbP₁, ⟨u', hatt'_b'u'⟩, hb'P₁, ?_⟩ + -- Unpack the fence `(A, B)` for `P_set` and the two peripheral members of `P_set \ {P₁}`. + obtain ⟨A, B, hfence⟩ := hcrooked.1 + let W' := S.transactionEnds (P_set \ {P₁}) + obtain ⟨a_0, ha_0, a'_0, ha'_0, b_0, hb_0, b'_0, hb'_0, hd_ab, hd_ba, e₁, e₂, + hP₁_ends, he₁_G₁, he₂_G₂⟩ := + exists_overpass_gaps S hcrooked hfence hP₁_in hover + -- By `end_not_mem_gaps_of_not_exchangeable`, neither `u` nor `u'` lies in `G₁ ∪ G₂`. + have hu_gaps := S.end_not_mem_gaps_of_not_exchangeable hcrooked hfence hatt_bu hnot_exch + hP₁_in hbP₁ hP₁_ends W' rfl ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba he₁_G₁ he₂_G₂ + have hu'_gaps := S.end_not_mem_gaps_of_not_exchangeable hcrooked hfence hatt'_b'u' hnot_exch' + hP₁_in hb'P₁ hP₁_ends W' rfl ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba he₁_G₁ he₂_G₂ + -- Split `P₁` at `b` and `b'`. + obtain ⟨Q₁, Q₂, M, hQ₁P₁, hQ₂P₁, hMP₁, hM_path, hQ_ends_or, hdisj_Q12, hdisj_MQ₁, hdisj_MQ₂⟩ := + hP₁_ends.1.exists_two_point_split hbP₁ hb'P₁ hbb' + refine ⟨M, hMP₁, hM_path, ?_⟩ + let S_sw := subgraphUnion S.G P Q₁ + let T_sw := subgraphUnion S.G P' Q₂ + let P_set' := (P_set \ {P₁}) ∪ {S_sw, T_sw} + have hdisj_ST : Disjoint V(S_sw) V(T_sw) := by + rw [vertexSet_subgraphUnion, vertexSet_subgraphUnion, + disjoint_union_left, disjoint_union_right, disjoint_union_right] + refine ⟨⟨hdisj_PP', ?_⟩, ⟨?_, hdisj_Q12⟩⟩ + · rw [disjoint_left] + intro z hzP hzQ₂ + have hzb : z = b := by + have hz_inter : z ∈ V(P) ∩ V(P₁) := ⟨hzP, hQ₂P₁.vertexSet_mono hzQ₂⟩ + rwa [hatt_bu.inter_leg_eq_singleton S hP₁_in hbP₁, mem_singleton_iff] at hz_inter + rw [hzb] at hzQ₂ + have hbQ₁ : b ∈ V(Q₁) := by + rcases hQ_ends_or with ⟨h1, _⟩ | ⟨h1, _⟩ <;> exact h1.left_mem + exact disjoint_left.mp hdisj_Q12 hbQ₁ hzQ₂ + · rw [disjoint_left] + intro z hzQ₁ hzP' + have hzb' : z = b' := by + have hz_inter : z ∈ V(P') ∩ V(P₁) := ⟨hzP', hQ₁P₁.vertexSet_mono hzQ₁⟩ + rwa [hatt'_b'u'.inter_leg_eq_singleton S hP₁_in hb'P₁, mem_singleton_iff] at hz_inter + rw [hzb'] at hzQ₁ + have hb'Q₂ : b' ∈ V(Q₂) := by + rcases hQ_ends_or with ⟨_, h2⟩ | ⟨_, h2⟩ <;> exact h2.left_mem + exact disjoint_left.mp hdisj_Q12 hzQ₁ hb'Q₂ + -- Helper that proves `P_set'` is a crooked transaction once we know which switch ends at `e₁` and + -- which ends at `e₂`. + have hcrooked_P_set' : S.IsCrookedTransaction P_set' := by + have hu_not_W' : u ∉ W' := fun huW' => + hatt_bu.end_not_mem_transactionEnds S (by + rw [hfence.transactionEnds_eq_union S hP₁_in hP₁_ends] + exact Or.inl huW') + have hu'_not_W' : u' ∉ W' := fun hu'W' => + hatt'_b'u'.end_not_mem_transactionEnds S (by + rw [hfence.transactionEnds_eq_union S hP₁_in hP₁_ends] + exact Or.inl hu'W') + have hdisj_ST_R : ∀ R ∈ P_set \ {P₁}, Disjoint V(S_sw) V(R) ∧ Disjoint V(T_sw) V(R) := + fun R hR => + ⟨hatt_bu.disjoint_subgraphUnion_of_ne_leg S hfence.1 hP₁_in hbP₁ hQ₁P₁ hR.1 hR.2, + hatt'_b'u'.disjoint_subgraphUnion_of_ne_leg S hfence.1 hP₁_in hb'P₁ hQ₂P₁ hR.1 hR.2⟩ + rcases hQ_ends_or with ⟨hQ₁_e₁, hQ₂_e₂⟩ | ⟨hQ₁_e₂, hQ₂_e₁⟩ + · have hS_ends : S.IsOmegaPathWithEnds S_sw u e₁ := + hatt_bu.isOmegaPathWithEnds_subgraphUnion S hP₁_in hbP₁ hP₁_ends hQ₁_e₁ (Or.inl rfl) + have hT_ends : S.IsOmegaPathWithEnds T_sw u' e₂ := + hatt'_b'u'.isOmegaPathWithEnds_subgraphUnion S hP₁_in hb'P₁ hP₁_ends hQ₂_e₂ (Or.inr rfl) + exact crookedTransaction_of_two_switches S hfence ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + he₁_G₁ he₂_G₂ hdisj_ST hdisj_ST_R hS_ends hT_ends + (hatt_bu.end_mem_bar S) hu_not_W' hu_gaps.1 hu_gaps.2 + (hatt'_b'u'.end_mem_bar S) hu'_not_W' hu'_gaps.1 hu'_gaps.2 + · have hS_ends : S.IsOmegaPathWithEnds S_sw u e₂ := + hatt_bu.isOmegaPathWithEnds_subgraphUnion S hP₁_in hbP₁ hP₁_ends hQ₁_e₂ (Or.inr rfl) + have hT_ends : S.IsOmegaPathWithEnds T_sw u' e₁ := + hatt'_b'u'.isOmegaPathWithEnds_subgraphUnion S hP₁_in hb'P₁ hP₁_ends hQ₂_e₁ (Or.inl rfl) + have hpair : ({S_sw, T_sw} : Set (Graph α β)) = {T_sw, S_sw} := pair_comm S_sw T_sw + have hset_eq : P_set' = (P_set \ {P₁}) ∪ {T_sw, S_sw} := by rw [← hpair] + rw [hset_eq] + exact crookedTransaction_of_two_switches S hfence ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + he₁_G₁ he₂_G₂ hdisj_ST.symm (fun R hR => ⟨(hdisj_ST_R R hR).2, (hdisj_ST_R R hR).1⟩) + hT_ends hS_ends + (hatt'_b'u'.end_mem_bar S) hu'_not_W' hu'_gaps.1 hu'_gaps.2 + (hatt_bu.end_mem_bar S) hu_not_W' hu_gaps.1 hu_gaps.2 + -- Prove `P_set'.ncard = P_set.ncard + 1`, `⋃ P_set' ≤ ⋃ P_set ∪ (P ∪ P')`, and edge disjointness. + have hS_not_diff : S_sw ∉ P_set \ {P₁} := + IsAttachmentWithEnds.subgraphUnion_not_mem_sdiff S hfence.1 hatt_bu hP₁_in hbP₁ + have hT_not_diff : T_sw ∉ P_set \ {P₁} := + IsAttachmentWithEnds.subgraphUnion_not_mem_sdiff S hfence.1 hatt'_b'u' hP₁_in hb'P₁ + have hST_ne : S_sw ≠ T_sw := fun h_eq => + disjoint_left.mp hdisj_ST (Or.inl hatt_bu.1.left_mem) (h_eq ▸ Or.inl hatt_bu.1.left_mem) + have hfin_P : P_set.Finite := hfence.1.finite S + have hfin_diff : (P_set \ {P₁}).Finite := hfin_P.sdiff + have hcard_eq : P_set'.ncard = P_set.ncard + 1 := by + have hset_eq : P_set' = insert S_sw (insert T_sw (P_set \ {P₁})) := by + ext R + simp [P_set', or_comm, or_left_comm] + rw [hset_eq, + ncard_insert_of_notMem (by simp [hST_ne, hS_not_diff]) (hfin_diff.insert T_sw), + ncard_insert_of_notMem hT_not_diff hfin_diff, + ncard_sdiff_singleton_add_one hP₁_in hfin_P] + have hP_le : P ≤ S.G := hatt_bu.1.le + have hP'_le : P' ≤ S.G := hatt'_b'u'.1.le + have hP₁_le : P₁ ≤ S.G := hP₁_ends.1.le + have hQ₁_le : Q₁ ≤ S.G := hQ₁P₁.trans hP₁_le + have hQ₂_le : Q₂ ≤ S.G := hQ₂P₁.trans hP₁_le + have hS_le : S_sw ≤ S.G := subgraphUnion_le hP_le hQ₁_le + have hT_le : T_sw ≤ S.G := subgraphUnion_le hP'_le hQ₂_le + have hP_set_le : ∀ R ∈ P_set, R ≤ S.G := fun R hR => by + obtain ⟨_, _, h⟩ := hfence.1.1 R hR + exact h.1.le + have hP_set'_le : ∀ R ∈ P_set', R ≤ S.G := by + rintro R (hR | rfl | rfl) + · exact hP_set_le R hR.1 + · exact hS_le + · exact hT_le + have hunion_le : + S.transactionUnion P_set' ≤ + subgraphUnion S.G (S.transactionUnion P_set) (subgraphUnion S.G P P') := by + have hU₁_le : S.transactionUnion P_set ≤ S.G := subgraphSUnion_le hP_set_le + have hU₂_le : subgraphUnion S.G P P' ≤ S.G := subgraphUnion_le hP_le hP'_le + have hRHS_le : subgraphUnion S.G (S.transactionUnion P_set) (subgraphUnion S.G P P') ≤ S.G := + subgraphUnion_le hU₁_le hU₂_le + have hLHS_le : S.transactionUnion P_set' ≤ S.G := subgraphSUnion_le hP_set'_le + rw [(Compatible.of_le_le hLHS_le hRHS_le).le_iff] + constructor + · intro x hx + change x ∈ ⋃ R ∈ P_set', V(R) at hx + rw [mem_iUnion₂] at hx + rcases hx with ⟨R, hR | rfl | rfl, hxR⟩ + · exact Or.inl (mem_iUnion₂.mpr ⟨R, hR.1, hxR⟩) + · rcases hxR with hxP | hxQ₁ + · exact Or.inr (Or.inl hxP) + · exact Or.inl (mem_iUnion₂.mpr ⟨P₁, hP₁_in, hQ₁P₁.vertexSet_mono hxQ₁⟩) + · rcases hxR with hxP' | hxQ₂ + · exact Or.inr (Or.inr hxP') + · exact Or.inl (mem_iUnion₂.mpr ⟨P₁, hP₁_in, hQ₂P₁.vertexSet_mono hxQ₂⟩) + · rw [show E(S.transactionUnion P_set') = ⋃ R ∈ P_set', E(R) from + edgeSet_subgraphSUnion hP_set'_le, + edgeSet_subgraphUnion hU₁_le hU₂_le, + show E(S.transactionUnion P_set) = ⋃ R ∈ P_set, E(R) from + edgeSet_subgraphSUnion hP_set_le, + edgeSet_subgraphUnion hP_le hP'_le] + intro e he + rw [mem_iUnion₂] at he + rcases he with ⟨R, hR | rfl | rfl, heR⟩ + · exact Or.inl (mem_iUnion₂.mpr ⟨R, hR.1, heR⟩) + · rw [edgeSet_subgraphUnion hP_le hQ₁_le] at heR + rcases heR with heP | heQ₁ + · exact Or.inr (Or.inl heP) + · exact Or.inl (mem_iUnion₂.mpr ⟨P₁, hP₁_in, hQ₁P₁.edgeSet_mono heQ₁⟩) + · rw [edgeSet_subgraphUnion hP'_le hQ₂_le] at heR + rcases heR with heP' | heQ₂ + · exact Or.inr (Or.inr heP') + · exact Or.inl (mem_iUnion₂.mpr ⟨P₁, hP₁_in, hQ₂P₁.edgeSet_mono heQ₂⟩) + have hdisj_EM : Disjoint E(M) E(S.transactionUnion P_set') := by + rw [show E(S.transactionUnion P_set') = ⋃ R ∈ P_set', E(R) from + edgeSet_subgraphSUnion hP_set'_le] + rw [disjoint_iUnion₂_right] + rintro R (hR | rfl | rfl) + · rw [disjoint_left] + intro e heM heR + obtain ⟨x, y, hxyM⟩ := M.exists_isLink_of_mem_edgeSet heM + obtain ⟨u_R, v_R, huvR⟩ := R.exists_isLink_of_mem_edgeSet heR + have hxyG : S.G.IsLink e x y := hxyM.mono (hMP₁.trans hP₁_le) + have huvG : S.G.IsLink e u_R v_R := huvR.mono (hP_set_le R hR.1) + have hne_P₁R : P₁ ≠ R := fun h => hR.2 h.symm + rcases hxyG.left_eq_or_eq huvG with rfl | rfl + · exact disjoint_left.mp (hfence.1.2 hP₁_in hR.1 hne_P₁R) + (hMP₁.vertexSet_mono hxyM.left_mem) huvR.left_mem + · exact disjoint_left.mp (hfence.1.2 hP₁_in hR.1 hne_P₁R) + (hMP₁.vertexSet_mono hxyM.left_mem) huvR.right_mem + · rw [edgeSet_subgraphUnion hP_le hQ₁_le, disjoint_union_right] + refine ⟨disjoint_edgeSet_of_inter_singleton (z := b) (hM_path.mono hP₁_le) hP_le ?_, + hdisj_MQ₁⟩ + rw [← hatt_bu.inter_leg_eq_singleton S hP₁_in hbP₁, inter_comm V(P) V(P₁)] + exact inter_subset_inter_left _ hMP₁.vertexSet_mono + · rw [edgeSet_subgraphUnion hP'_le hQ₂_le, disjoint_union_right] + refine ⟨disjoint_edgeSet_of_inter_singleton (z := b') (hM_path.mono hP₁_le) hP'_le ?_, + hdisj_MQ₂⟩ + rw [← hatt'_b'u'.inter_leg_eq_singleton S hP₁_in hb'P₁, inter_comm V(P') V(P₁)] + exact inter_subset_inter_left _ hMP₁.vertexSet_mono + exact ⟨P_set', hcrooked_P_set', hcard_eq, hunion_le, hdisj_EM⟩ + +end Society + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section4a.lean b/LeanPool/GraphMinor/GM09/Section4a.lean new file mode 100644 index 0000000000..fcc667918c --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section4a.lean @@ -0,0 +1,1312 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM09.Section3c +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2a +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section3b +import Mathlib.Data.Set.Card + +/-! +# Graph Minors IX, Section 4 (Part 1): Separating Paths and (4.1)–(4.3) + +This file formalizes (4.1), (4.2), and (4.3) from Section 4 of +N. Robertson and P. D. Seymour, *Graph Minors. IX. Disjoint crossed paths*, +J. Combin. Theory Ser. B **49** (1990) 40–77 (pages 49–50). +-/ + +public section + +namespace GraphMinor.GM09 + +open Set Graph GraphMinor GraphMinor.Surface + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Subpath equality when ends match -/ + +private theorem walk_support_edges_sub_of_isSimple_left {G G₁ G₂ : Graph α β} {a b s : α} + {W : GraphWalk G a b} {W₁ : GraphWalk G₁ a s} {W₂ : GraphWalk G₂ a s} + (hl₁ : ∀ ⦃e x y⦄, G₁.IsLink e x y → G.IsLink e x y) + (hl₂ : ∀ ⦃e x y⦄, G₂.IsLink e x y → G.IsLink e x y) + (hW : W.IsSimple) (hW₁ : W₁.IsSimple) (hW₂ : W₂.IsSimple) + (he₁ : ∀ e ∈ W₁.edges, e ∈ W.edges) + (he₂ : ∀ e ∈ W₂.edges, e ∈ W.edges) : + (∀ x ∈ W₁.support, x ∈ W₂.support) ∧ (∀ e ∈ W₁.edges, e ∈ W₂.edges) := by + induction W with + | nil _ => + cases W₁ with + | nil _ => + refine ⟨fun x hx => ?_, fun e he => by simp [GraphWalk.edges] at he⟩ + simp only [GraphWalk.support_nil, List.mem_singleton] at hx + exact hx ▸ W₂.start_mem_support + | @cons _ _ _ e _ _ => + exact (List.not_mem_nil (he₁ e List.mem_cons_self)).elim + | @cons u y w e hxy W_tail ih => + have hnodup : (u :: W_tail.support).Nodup := hW + have ha_not_tail : u ∉ W_tail.support := (List.nodup_cons.mp hnodup).1 + have hW_tail_simple : W_tail.IsSimple := (List.nodup_cons.mp hnodup).2 + have hay : u ≠ y := fun h => ha_not_tail (h ▸ W_tail.start_mem_support) + cases W₁ with + | nil _ => + refine ⟨fun x hx => ?_, fun f hf => by simp [GraphWalk.edges] at hf⟩ + simp only [GraphWalk.support_nil, List.mem_singleton] at hx + exact hx ▸ W₂.start_mem_support + | @cons _ y₁ _ e₁ hxy₁ W₁_tail => + have hnodup₁ : (u :: W₁_tail.support).Nodup := hW₁ + have ha_not_tail₁ : u ∉ W₁_tail.support := (List.nodup_cons.mp hnodup₁).1 + have hW₁_tail_simple : W₁_tail.IsSimple := (List.nodup_cons.mp hnodup₁).2 + have hus : u ≠ s := fun h => ha_not_tail₁ (h ▸ W₁_tail.end_mem_support) + cases W₂ with + | nil _ => exact (hus rfl).elim + | @cons _ y₂ _ e₂ hxy₂ W₂_tail => + have hnodup₂ : (u :: W₂_tail.support).Nodup := hW₂ + have hW₂_tail_simple : W₂_tail.IsSimple := (List.nodup_cons.mp hnodup₂).2 + have hxy₁G : G.IsLink e₁ u y₁ := hl₁ hxy₁ + have hxy₂G : G.IsLink e₂ u y₂ := hl₂ hxy₂ + have he₁_eq : e = e₁ := by + rcases List.mem_cons.mp (he₁ e₁ List.mem_cons_self) with rfl | he_t + · rfl + · exact (ha_not_tail (W_tail.left_mem_support_of_mem_edges he_t hxy₁G)).elim + subst he₁_eq + have hy₁_eq : y = y₁ := by + rcases hxy.symm.left_eq_or_eq hxy₁G with rfl | rfl + · exact (hay rfl).elim + · rfl + subst hy₁_eq + have he₂_eq : e = e₂ := by + rcases List.mem_cons.mp (he₂ e₂ List.mem_cons_self) with rfl | he_t + · rfl + · exact (ha_not_tail (W_tail.left_mem_support_of_mem_edges he_t hxy₂G)).elim + subst he₂_eq + have hy₂_eq : y = y₂ := by + rcases hxy.symm.left_eq_or_eq hxy₂G with rfl | rfl + · exact (hay rfl).elim + · rfl + subst hy₂_eq + have he₁_tail : ∀ f ∈ W₁_tail.edges, f ∈ W_tail.edges := by + intro f hf + have hnodup_edges₁ : (e :: W₁_tail.edges).Nodup := hW₁.edges_nodup + have he_not_tail₁ : e ∉ W₁_tail.edges := (List.nodup_cons.mp hnodup_edges₁).1 + rcases List.mem_cons.mp (he₁ f (List.mem_cons_of_mem e hf)) with rfl | hf_t + · exact (he_not_tail₁ hf).elim + · exact hf_t + have he₂_tail : ∀ f ∈ W₂_tail.edges, f ∈ W_tail.edges := by + intro f hf + have hnodup_edges₂ : (e :: W₂_tail.edges).Nodup := hW₂.edges_nodup + have he_not_tail₂ : e ∉ W₂_tail.edges := (List.nodup_cons.mp hnodup_edges₂).1 + rcases List.mem_cons.mp (he₂ f (List.mem_cons_of_mem e hf)) with rfl | hf_t + · exact (he_not_tail₂ hf).elim + · exact hf_t + obtain ⟨ih_V, ih_E⟩ := ih hW_tail_simple hW₁_tail_simple hW₂_tail_simple he₁_tail he₂_tail + refine ⟨?_, ?_⟩ + · intro x hx + rcases List.mem_cons.mp hx with rfl | hx_tail + · exact List.mem_cons_self + · exact List.mem_cons_of_mem u (ih_V x hx_tail) + · intro f hf + rcases List.mem_cons.mp hf with rfl | hf_tail + · exact List.mem_cons_self + · exact List.mem_cons_of_mem e (ih_E f hf_tail) + +/-- If `H ≤ Q` and both `H` and `Q` are paths in `G` with the same ends `a, b`, then `H = Q`. -/ +theorem IsGraphPathWithEnds.eq_of_le_of_same_ends {G Q H : Graph α β} {a b : α} + (hQ : IsGraphPathWithEnds G Q a b) (hH : IsGraphPathWithEnds G H a b) + (hHQ : H ≤ Q) : H = Q := by + rcases hQ with ⟨hQG, W, hW, hVQ, hEQ⟩ + rcases hH with ⟨hHG, W', hW', hVH, hEH⟩ + have hedges : ∀ e ∈ W'.edges, e ∈ W.edges := by + intro e he + have heH : e ∈ E(H) := by rwa [hEH] + have heQ : e ∈ E(Q) := hHQ.edgeSet_mono heH + rwa [hEQ] at heQ + obtain ⟨hV_sub, hE_sub⟩ := + walk_support_edges_sub_of_isSimple_left + (fun _ _ _ hl => hl) (fun _ _ _ hl => hl.mono hHQ) + hW hW hW' (fun _ h => h) hedges + refine (Compatible.of_le_le hHG hQG).ext ?_ ?_ + · apply Subset.antisymm hHQ.vertexSet_mono + intro x hx + rw [hVQ, mem_ofPred_eq] at hx + rw [hVH, mem_ofPred_eq] + exact hV_sub x hx + · apply Subset.antisymm hHQ.edgeSet_mono + intro e he + rw [hEQ, mem_ofPred_eq] at he + rw [hEH, mem_ofPred_eq] + exact hE_sub e he + +/-- If `Q` is a path in `G` with ends `a, b`, and `H₁, H₂` are subpaths of `Q` with ends `a, s`, +then `H₁ = H₂`. -/ +theorem IsGraphPathWithEnds.subpath_unique_of_left {G Q H₁ H₂ : Graph α β} {a b s : α} + (hQ : IsGraphPathWithEnds G Q a b) + (hH₁ : IsGraphPathWithEnds Q H₁ a s) + (hH₂ : IsGraphPathWithEnds Q H₂ a s) : H₁ = H₂ := by + rcases hQ with ⟨hQG, W, hW, _, hEQ⟩ + rcases hH₁ with ⟨hH₁Q, W₁, hW₁, hVH₁, hEH₁⟩ + rcases hH₂ with ⟨hH₂Q, W₂, hW₂, hVH₂, hEH₂⟩ + have he₁ : ∀ e ∈ W₁.edges, e ∈ W.edges := by + intro e he + have heH₁ : e ∈ E(H₁) := by rwa [hEH₁] + have heQ : e ∈ E(Q) := hH₁Q.edgeSet_mono heH₁ + rwa [hEQ] at heQ + have he₂ : ∀ e ∈ W₂.edges, e ∈ W.edges := by + intro e he + have heH₂ : e ∈ E(H₂) := by rwa [hEH₂] + have heQ : e ∈ E(Q) := hH₂Q.edgeSet_mono heH₂ + rwa [hEQ] at heQ + obtain ⟨hV₁₂, hE₁₂⟩ := + walk_support_edges_sub_of_isSimple_left + (fun _ _ _ hl => hl.mono hH₁Q) (fun _ _ _ hl => hl.mono hH₂Q) + hW hW₁ hW₂ he₁ he₂ + obtain ⟨hV₂₁, hE₂₁⟩ := + walk_support_edges_sub_of_isSimple_left + (fun _ _ _ hl => hl.mono hH₂Q) (fun _ _ _ hl => hl.mono hH₁Q) + hW hW₂ hW₁ he₂ he₁ + refine (Compatible.of_le_le (hH₁Q.trans hQG) (hH₂Q.trans hQG)).ext ?_ ?_ + · apply Subset.antisymm + · intro x hx; rw [hVH₁, mem_ofPred_eq] at hx; rw [hVH₂, mem_ofPred_eq]; exact hV₁₂ x hx + · intro x hx; rw [hVH₂, mem_ofPred_eq] at hx; rw [hVH₁, mem_ofPred_eq]; exact hV₂₁ x hx + · apply Subset.antisymm + · intro e he; rw [hEH₁, mem_ofPred_eq] at he; rw [hEH₂, mem_ofPred_eq]; exact hE₁₂ e he + · intro e he; rw [hEH₂, mem_ofPred_eq] at he; rw [hEH₁, mem_ofPred_eq]; exact hE₂₁ e he + +namespace Society + +variable (S : Society α β) + +/-! ## Dual fence cut and peripheral member bounds for (4.1) -/ + +/-- For any `s ∈ G₁ = Ω.interval a'_0 b_0` and any `t ∈ Ω.bar \ G₁`, there is a fence `(A_f, B_f)` +of `Ω` with `A ∩ W' ⊆ A_f`, `B ∩ W' ⊆ B_f`, and one of `s, t` in `A_f` and the other in `B_f`. -/ +theorem exists_fence_for_gap_and_other {Ω : CyclicPerm α} {A B W' : Set α} + (hfence : Ω.IsFence A B) (hW' : W' ⊆ Ω.bar) + {a_0 a'_0 b_0 b'_0 s t : α} + (ha_0 : a_0 ∈ A ∩ W') (ha'_0 : a'_0 ∈ A ∩ W') + (hb_0 : b_0 ∈ B ∩ W') (hb'_0 : b'_0 ∈ B ∩ W') + (hd_ab : Disjoint (Ω.interval a'_0 b_0) W') + (hd_ba : Disjoint (Ω.interval b'_0 a_0) W') + (hs : s ∈ Ω.interval a'_0 b_0) + (ht_bar : t ∈ Ω.bar) (ht_not_G₁ : t ∉ Ω.interval a'_0 b_0) : + ∃ A_f B_f : Set α, Ω.IsFence A_f B_f ∧ + A ∩ W' ⊆ A_f ∧ B ∩ W' ⊆ B_f ∧ + ((t ∈ A_f ∧ s ∈ B_f) ∨ (s ∈ A_f ∧ t ∈ B_f)) := by + obtain ⟨hA_sub, hB_sub, _, _, _, hpart⟩ := + four_arc_partition hfence hW' ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + by_cases ht_G₂ : t ∈ Ω.interval b'_0 a_0 + · obtain ⟨A₁, B₁, hff₁, hA₁, hG₂₁, hB₁, hs₁⟩ := + fence_cut_G₁ hfence hW' ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba hs + exact ⟨A₁, B₁, hff₁, hA_sub.trans hA₁, hB_sub.trans hB₁, + Or.inl ⟨hG₂₁ ht_G₂, hs₁⟩⟩ + · rcases hpart t ht_bar ht_not_G₁ ht_G₂ with ht_A | ht_B + · obtain ⟨A₁, B₁, hff₁, hA₁, _, hB₁, hs₁⟩ := + fence_cut_G₁ hfence hW' ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba hs + exact ⟨A₁, B₁, hff₁, hA_sub.trans hA₁, hB_sub.trans hB₁, + Or.inl ⟨hA₁ ht_A, hs₁⟩⟩ + · obtain ⟨A₂, B₂, hff₂, hA₂, hs₂, hB₂, _⟩ := + fence_cut_G₁_dual hfence hW' ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba hs + exact ⟨A₂, B₂, hff₂, hA_sub.trans hA₂, hB_sub.trans hB₂, + Or.inr ⟨hs₂, hB₂ ht_B⟩⟩ + +/-- No transaction can have three distinct peripheral members. -/ +theorem IsFenceFor.not_three_peripheral {P_set : Set (Graph α β)} {A B : Set α} + (hfence : S.IsFenceFor P_set A B) + {P₁ P₂ P₃ : Graph α β} + (hper₁ : S.IsPeripheralIn P_set P₁) + (hper₂ : S.IsPeripheralIn P_set P₂) + (hper₃ : S.IsPeripheralIn P_set P₃) + (hne12 : P₁ ≠ P₂) (hne13 : P₁ ≠ P₃) (hne23 : P₂ ≠ P₃) : False := by + have h₁_in : P₁ ∈ P_set := hper₁.1 + have h₂_in : P₂ ∈ P_set := hper₂.1 + have h₃_in : P₃ ∈ P_set := hper₃.1 + obtain ⟨a₁, ha₁, b₁, hb₁, he₁⟩ := hfence.2.2 P₁ h₁_in + obtain ⟨a₂, ha₂, b₂, hb₂, he₂⟩ := hfence.2.2 P₂ h₂_in + obtain ⟨a₃, ha₃, b₃, hb₃, he₃⟩ := hfence.2.2 P₃ h₃_in + let W := S.transactionEnds P_set + have hW : W ⊆ S.Ω.bar := S.transactionEnds_subset_bar P_set + have ha₁W : a₁ ∈ A ∩ W := ⟨ha₁, he₁.mem_transactionEnds_left S h₁_in⟩ + have hb₁W : b₁ ∈ B ∩ W := ⟨hb₁, he₁.mem_transactionEnds_right S h₁_in⟩ + have ha₂W : a₂ ∈ A ∩ W := ⟨ha₂, he₂.mem_transactionEnds_left S h₂_in⟩ + have hb₂W : b₂ ∈ B ∩ W := ⟨hb₂, he₂.mem_transactionEnds_right S h₂_in⟩ + have ha₃W : a₃ ∈ A ∩ W := ⟨ha₃, he₃.mem_transactionEnds_left S h₃_in⟩ + have hb₃W : b₃ ∈ B ∩ W := ⟨hb₃, he₃.mem_transactionEnds_right S h₃_in⟩ + have ha12 : a₁ ≠ a₂ := + fun h => disjoint_left.mp (hfence.1.2 h₁_in h₂_in hne12) he₁.1.left_mem (h ▸ he₂.1.left_mem) + have ha13 : a₁ ≠ a₃ := + fun h => disjoint_left.mp (hfence.1.2 h₁_in h₃_in hne13) he₁.1.left_mem (h ▸ he₃.1.left_mem) + have ha23 : a₂ ≠ a₃ := + fun h => disjoint_left.mp (hfence.1.2 h₂_in h₃_in hne23) he₂.1.left_mem (h ▸ he₃.1.left_mem) + have hb12 : b₁ ≠ b₂ := + fun h => disjoint_left.mp (hfence.1.2 h₁_in h₂_in hne12) he₁.1.right_mem (h ▸ he₂.1.right_mem) + have hb13 : b₁ ≠ b₃ := + fun h => disjoint_left.mp (hfence.1.2 h₁_in h₃_in hne13) he₁.1.right_mem (h ▸ he₃.1.right_mem) + have hb23 : b₂ ≠ b₃ := + fun h => disjoint_left.mp (hfence.1.2 h₂_in h₃_in hne23) he₂.1.right_mem (h ▸ he₃.1.right_mem) + rcases (he₁.isPeripheralIn_iff S h₁_in).mp hper₁ with hd₁ | hd₁ <;> + rcases (he₂.isPeripheralIn_iff S h₂_in).mp hper₂ with hd₂ | hd₂ <;> + rcases (he₃.isPeripheralIn_iff S h₃_in).mp hper₃ with hd₃ | hd₃ + · exact ha12 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1 hW ha₁W hb₁W ha₂W hb₂W hd₁ hd₂).1 + · exact ha12 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1 hW ha₁W hb₁W ha₂W hb₂W hd₁ hd₂).1 + · exact ha13 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1 hW ha₁W hb₁W ha₃W hb₃W hd₁ hd₃).1 + · exact hb23 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1.symm hW hb₂W ha₂W hb₃W ha₃W hd₂ + hd₃).1 + · exact ha23 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1 hW ha₂W hb₂W ha₃W hb₃W hd₂ hd₃).1 + · exact hb13 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1.symm hW hb₁W ha₁W hb₃W ha₃W hd₁ + hd₃).1 + · exact hb12 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1.symm hW hb₁W ha₁W hb₂W ha₂W hd₁ + hd₂).1 + · exact hb12 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1.symm hW hb₁W ha₁W hb₂W ha₂W hd₁ + hd₂).1 + +/-- If `T₁ ⊆ T₂` and `R ∈ T₁` is peripheral in `T₂`, then `R` is peripheral in `T₁`. -/ +theorem IsPeripheralIn.mono_subset {T₁ T₂ : Set (Graph α β)} {R : Graph α β} + (hsub : T₁ ⊆ T₂) (hR : R ∈ T₁) (hper : S.IsPeripheralIn T₂ R) : + S.IsPeripheralIn T₁ R := by + obtain ⟨_, a, b, hR_ends, hd⟩ := hper + have hW_sub : S.transactionEnds T₁ ⊆ S.transactionEnds T₂ := + fun x ⟨P, hP, y, hP_ends⟩ => ⟨P, hsub hP, y, hP_ends⟩ + refine ⟨hR, a, b, hR_ends, ?_⟩ + rcases hd with hd₁ | hd₂ + · exact Or.inl (hd₁.mono_right hW_sub) + · exact Or.inr (hd₂.mono_right hW_sub) + +private theorem peripheral_replacement_of_two_switches + {P_set : Set (Graph α β)} {P P₁ S_sw S'_sw : Graph α β} {A B : Set α} + {s₀ a b a₁ b₁ : α} + (hfence : S.IsFenceFor P_set A B) (hperP : S.IsPeripheralIn P_set P) + (hP₁_in : P₁ ∈ P_set) (hP₁_ne_P : P₁ ≠ P) + (haW : a ∈ A ∩ S.transactionEnds P_set) (hbW : b ∈ B ∩ S.transactionEnds P_set) + (ha₁W : a₁ ∈ A ∩ S.transactionEnds P_set) (hb₁W : b₁ ∈ B ∩ S.transactionEnds P_set) + (hd_ab : Disjoint (S.Ω.interval a b) (S.transactionEnds P_set)) + (hs₀_ab : s₀ ∈ S.Ω.interval a b) + (hP_ends : S.IsOmegaPathWithEnds P a b) (hP₁_ends : S.IsOmegaPathWithEnds P₁ a₁ b₁) + (hS_ends : S.IsOmegaPathWithEnds S_sw s₀ a₁) (hS'_ends : S.IsOmegaPathWithEnds S'_sw s₀ b₁) : + let P_set' := (P_set \ {P₁}) ∪ {S_sw} + let P_set'' := (P_set \ {P₁}) ∪ {S'_sw} + S.IsTransaction P_set' → S.IsTransaction P_set'' → + P_set'.ncard = P_set.ncard → P_set''.ncard = P_set.ncard → + ∃ P_set' : Set (Graph α β), S.IsTransaction P_set' ∧ + P_set.ncard ≤ P_set'.ncard ∧ + ∀ R, S.IsPeripheralIn P_set' R → S.IsPeripheralIn P_set R ∧ R ≠ P := by + intro P_set' P_set'' htrans' htrans'' hcard' hcard'' + have hP_in := hperP.1 + let W := S.transactionEnds P_set + have hW_bar : W ⊆ S.Ω.bar := S.transactionEnds_subset_bar P_set + -- Both `S_sw` and `S'_sw` cross `P`, so neither `P` nor `S_sw` (resp. `S'_sw`) is peripheral. + have ha₁_ba : a₁ ∈ S.Ω.interval b a := by + have ha₁_ne_a : a₁ ≠ a := + fun h => disjoint_left.mp (hfence.1.2 hP₁_in hP_in hP₁_ne_P) hP₁_ends.1.left_mem + (h ▸ hP_ends.1.left_mem) + have ha₁_ne_b : a₁ ≠ b := + fun h => disjoint_left.mp hfence.2.1.2.2.1 ha₁W.1 (h ▸ hbW.1) + exact (S.Ω.mem_interval_or_interval_swap hP_ends.2.2.1 hP_ends.2.2.2 hP₁_ends.2.2.1 + hP_ends.2.1 ha₁_ne_a ha₁_ne_b).resolve_left (disjoint_right.mp hd_ab ha₁W.2) + have hb₁_ba : b₁ ∈ S.Ω.interval b a := by + have hb₁_ne_a : b₁ ≠ a := + fun h => disjoint_left.mp hfence.2.1.2.2.1 haW.1 (h ▸ hb₁W.1) + have hb₁_ne_b : b₁ ≠ b := + fun h => disjoint_left.mp (hfence.1.2 hP₁_in hP_in hP₁_ne_P) hP₁_ends.1.right_mem + (h ▸ hP_ends.1.right_mem) + exact (S.Ω.mem_interval_or_interval_swap hP_ends.2.2.1 hP_ends.2.2.2 hP₁_ends.2.2.2 + hP_ends.2.1 hb₁_ne_a hb₁_ne_b).resolve_left (disjoint_right.mp hd_ab hb₁W.2) + have hP_in_diff : P ∈ P_set \ {P₁} := ⟨hP_in, Ne.symm hP₁_ne_P⟩ + have hS_not_per' : ¬ S.IsPeripheralIn P_set' S_sw := by + intro hper + have hd := (hS_ends.isPeripheralIn_iff S (Or.inr rfl)).mp hper + have ha_in_ends : a ∈ S.transactionEnds P_set' := + hP_ends.mem_transactionEnds_left S (Or.inl hP_in_diff) + have hb_in_ends : b ∈ S.transactionEnds P_set' := + hP_ends.mem_transactionEnds_right S (Or.inl hP_in_diff) + have hcr_SP : S.Ω.Crosses a b s₀ a₁ := + S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hs₀_ab, ha₁_ba⟩) + rcases S.Ω.crosses_iff_interval.mp hcr_SP.symm with ⟨ha_in, hb_in⟩ | ⟨hb_in, ha_in⟩ <;> + rcases hd with hd₁ | hd₂ + · exact disjoint_left.mp hd₁ ha_in ha_in_ends + · exact disjoint_left.mp hd₂ hb_in hb_in_ends + · exact disjoint_left.mp hd₁ hb_in hb_in_ends + · exact disjoint_left.mp hd₂ ha_in ha_in_ends + have hP_not_per' : ¬ S.IsPeripheralIn P_set' P := by + intro hper + have hd := (hP_ends.isPeripheralIn_iff S (Or.inl hP_in_diff)).mp hper + have hs₀_in_ends : s₀ ∈ S.transactionEnds P_set' := + hS_ends.mem_transactionEnds_left S (Or.inr rfl) + have ha₁_in_ends : a₁ ∈ S.transactionEnds P_set' := + hS_ends.mem_transactionEnds_right S (Or.inr rfl) + rcases hd with hd₁ | hd₂ + · exact disjoint_left.mp hd₁ hs₀_ab hs₀_in_ends + · exact disjoint_left.mp hd₂ ha₁_ba ha₁_in_ends + have hS'_not_per'' : ¬ S.IsPeripheralIn P_set'' S'_sw := by + intro hper + have hd := (hS'_ends.isPeripheralIn_iff S (Or.inr rfl)).mp hper + have ha_in_ends : a ∈ S.transactionEnds P_set'' := + hP_ends.mem_transactionEnds_left S (Or.inl hP_in_diff) + have hb_in_ends : b ∈ S.transactionEnds P_set'' := + hP_ends.mem_transactionEnds_right S (Or.inl hP_in_diff) + have hcr_S'P : S.Ω.Crosses a b s₀ b₁ := + S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hs₀_ab, hb₁_ba⟩) + rcases S.Ω.crosses_iff_interval.mp hcr_S'P.symm with ⟨ha_in, hb_in⟩ | ⟨hb_in, ha_in⟩ <;> + rcases hd with hd₁ | hd₂ + · exact disjoint_left.mp hd₁ ha_in ha_in_ends + · exact disjoint_left.mp hd₂ hb_in hb_in_ends + · exact disjoint_left.mp hd₁ hb_in hb_in_ends + · exact disjoint_left.mp hd₂ ha_in ha_in_ends + have hP_not_per'' : ¬ S.IsPeripheralIn P_set'' P := by + intro hper + have hd := (hP_ends.isPeripheralIn_iff S (Or.inl hP_in_diff)).mp hper + have hs₀_in_ends : s₀ ∈ S.transactionEnds P_set'' := + hS'_ends.mem_transactionEnds_left S (Or.inr rfl) + have hb₁_in_ends : b₁ ∈ S.transactionEnds P_set'' := + hS'_ends.mem_transactionEnds_right S (Or.inr rfl) + rcases hd with hd₁ | hd₂ + · exact disjoint_left.mp hd₁ hs₀_ab hs₀_in_ends + · exact disjoint_left.mp hd₂ hb₁_ba hb₁_in_ends + -- Show that either `P_set'` or `P_set''` satisfies the requirement. + by_cases hgood' : ∀ R, S.IsPeripheralIn P_set' R → S.IsPeripheralIn P_set R ∧ R ≠ P + · exact ⟨P_set', htrans', hcard'.symm.le, hgood'⟩ + · refine ⟨P_set'', htrans'', hcard''.symm.le, ?_⟩ + by_contra! hbad'' + rcases not_forall.mp hgood' with ⟨P', hP'_bad⟩ + rw [not_imp, not_and_or] at hP'_bad + rcases hP'_bad with ⟨hP'_per', hP'_not_per | hP'_eq_P⟩ + · rcases hbad'' with ⟨P'', hP''_per'', hP''_not⟩ + have hP''_not_per : ¬ S.IsPeripheralIn P_set P'' := + fun h => hP_not_per'' (hP''_not h ▸ hP''_per'') + have hP'_in_diff : P' ∈ P_set \ {P₁} := + hP'_per'.1.resolve_right fun h => hS_not_per' (mem_singleton_iff.mp h ▸ hP'_per') + have hP''_in_diff : P'' ∈ P_set \ {P₁} := + hP''_per''.1.resolve_right fun h => hS'_not_per'' (mem_singleton_iff.mp h ▸ hP''_per'') + have hP'_ne_P : P' ≠ P := fun h => hP_not_per' (h ▸ hP'_per') + have hP''_ne_P : P'' ≠ P := fun h => hP_not_per'' (h ▸ hP''_per'') + have hP'_per_diff : S.IsPeripheralIn (P_set \ {P₁}) P' := + hP'_per'.mono_subset S subset_union_left hP'_in_diff + have hP''_per_diff : S.IsPeripheralIn (P_set \ {P₁}) P'' := + hP''_per''.mono_subset S subset_union_left hP''_in_diff + have hP_per_diff : S.IsPeripheralIn (P_set \ {P₁}) P := + hperP.mono_subset S sdiff_subset hP_in_diff + -- If `P' = P''`, then `P'` is peripheral in both `P_set'` and `P_set''`, hence in `P_set`. + have hP'_ne_P'' : P' ≠ P'' := by + rintro rfl + apply hP'_not_per + obtain ⟨a', ha'A, b', hb'B, hP'_ends⟩ := hfence.2.2 P' hP'_in_diff.1 + have ha'W : a' ∈ A ∩ W := ⟨ha'A, hP'_ends.mem_transactionEnds_left S hP'_in_diff.1⟩ + have hb'W : b' ∈ B ∩ W := ⟨hb'B, hP'_ends.mem_transactionEnds_right S hP'_in_diff.1⟩ + have hsub_ab : S.Ω.interval a b ⊆ S.Ω.interval a' b' := + S.Ω.interval_subset_of_disjoint_AB hfence.2.1 hW_bar haW hbW hd_ab ha'W hb'W + have hs₀_a'b' : s₀ ∈ S.Ω.interval a' b' := hsub_ab hs₀_ab + have hd' := (hP'_ends.isPeripheralIn_iff S (Or.inl hP'_in_diff)).mp hP'_per' + have hd'' := (hP'_ends.isPeripheralIn_iff S (Or.inl hP'_in_diff)).mp hP''_per'' + have hs₀_ends' : s₀ ∈ S.transactionEnds P_set' := + hS_ends.mem_transactionEnds_left S (Or.inr rfl) + have ha₁_ends' : a₁ ∈ S.transactionEnds P_set' := + hS_ends.mem_transactionEnds_right S (Or.inr rfl) + have hs₀_ends'' : s₀ ∈ S.transactionEnds P_set'' := + hS'_ends.mem_transactionEnds_left S (Or.inr rfl) + have hb₁_ends'' : b₁ ∈ S.transactionEnds P_set'' := + hS'_ends.mem_transactionEnds_right S (Or.inr rfl) + have hd'_ba : Disjoint (S.Ω.interval b' a') (S.transactionEnds P_set') := + hd'.resolve_left fun hd_l => disjoint_left.mp hd_l hs₀_a'b' hs₀_ends' + have hd''_ba : Disjoint (S.Ω.interval b' a') (S.transactionEnds P_set'') := + hd''.resolve_left fun hd_l => disjoint_left.mp hd_l hs₀_a'b' hs₀_ends'' + refine (hP'_ends.isPeripheralIn_iff S hP'_in_diff.1).mpr (Or.inr ?_) + rw [hfence.transactionEnds_eq_union S hP₁_in hP₁_ends, disjoint_union_right] + refine ⟨hd'_ba.mono_right ?_, ?_⟩ + · rintro z ⟨R, hR, y, hRe⟩ + exact ⟨R, Or.inl hR, y, hRe⟩ + · rw [disjoint_left] + rintro z hz (rfl | rfl) + · exact disjoint_left.mp hd'_ba hz ha₁_ends' + · exact disjoint_left.mp hd''_ba hz hb₁_ends'' + have hfence_diff : S.IsFenceFor (P_set \ {P₁}) A B := + ⟨⟨fun R hR => hfence.1.1 R hR.1, fun R₁ hR₁ R₂ hR₂ hne => hfence.1.2 hR₁.1 hR₂.1 hne⟩, + hfence.2.1, fun R hR => hfence.2.2 R hR.1⟩ + exact hfence_diff.not_three_peripheral S hP_per_diff hP'_per_diff hP''_per_diff + hP'_ne_P.symm hP''_ne_P.symm hP'_ne_P'' + · exact hP_not_per' (not_not.mp hP'_eq_P ▸ hP'_per') + +private theorem peripheral_replacement_of_disjoint_cross + {P_set : Set (Graph α β)} {P Q₀ : Graph α β} {A B : Set α} + {a b a_0 b'_0 x s₀ : α} + (hfence : S.IsFenceFor P_set A B) (hP_in : P ∈ P_set) + (haW : a ∈ A ∩ S.transactionEnds P_set) (hbW : b ∈ B ∩ S.transactionEnds P_set) + (ha_0 : a_0 ∈ A ∩ S.transactionEnds P_set) + (hb'_0 : b'_0 ∈ B ∩ S.transactionEnds P_set) + (hd_ab : Disjoint (S.Ω.interval a b) (S.transactionEnds P_set)) + (hd_ba : Disjoint (S.Ω.interval b'_0 a_0) (S.transactionEnds P_set)) + (hP_ends : S.IsOmegaPathWithEnds P a b) + (hQ₀_ft : IsFromToPathWithEnds S.G Q₀ + (V(S.transactionUnion P_set) ∪ S.Ω.interval b a) (S.Ω.interval a b) x s₀) + (hx_ba : x ∈ S.Ω.interval b a) (hx_U : x ∉ V(S.transactionUnion P_set)) + (hs₀_ab : s₀ ∈ S.Ω.interval a b) : + ∃ P_set' : Set (Graph α β), S.IsTransaction P_set' ∧ + P_set.ncard ≤ P_set'.ncard ∧ + ∀ R, S.IsPeripheralIn P_set' R → S.IsPeripheralIn P_set R ∧ R ≠ P := by + let W := S.transactionEnds P_set + have hW_bar : W ⊆ S.Ω.bar := S.transactionEnds_subset_bar P_set + have hfin_P : P_set.Finite := hfence.1.finite S + have hs₀_bar : s₀ ∈ S.Ω.bar := hs₀_ab.1.1 + have hdisj_Q₀_U : Disjoint V(Q₀) V(S.transactionUnion P_set) := by + rw [disjoint_left] + intro z hzQ₀ hzU + have hz_x : z = x := by + have hz_in : z ∈ V(Q₀) ∩ (V(S.transactionUnion P_set) ∪ S.Ω.interval b a) := + ⟨hzQ₀, Or.inl hzU⟩ + rwa [hQ₀_ft.2.1, mem_singleton_iff] at hz_in + exact hx_U (hz_x ▸ hzU) + have hx_bar : x ∈ S.Ω.bar := hx_ba.1.1 + have hxs₀ : x ≠ s₀ := + fun h => disjoint_left.mp (S.Ω.disjoint_interval_swap a b) hs₀_ab (h ▸ hx_ba) + have hx_not_ab : x ∉ S.Ω.interval a b := + disjoint_right.mp (S.Ω.disjoint_interval_swap a b) hx_ba + have hQ₀_ends : S.IsOmegaPathWithEnds Q₀ x s₀ := + ⟨hQ₀_ft.1, hxs₀, hx_bar, hs₀_bar⟩ + let P_set' := P_set ∪ {Q₀} + obtain ⟨A_f, B_f, hff, hAf, hBf, h_xs₀⟩ := + exists_fence_for_gap_and_other hfence.2.1 hW_bar ha_0 haW hbW hb'_0 hd_ab hd_ba + hs₀_ab hx_bar hx_not_ab + have hdisj_Q₀_R : ∀ R ∈ P_set, Disjoint V(Q₀) V(R) := by + intro R hR + exact hdisj_Q₀_U.mono_right fun z hz => mem_iUnion₂.mpr ⟨R, hR, hz⟩ + have htrans' : S.IsTransaction P_set' := by + refine ⟨A_f, B_f, ⟨⟨?_, ?_⟩, hff, ?_⟩⟩ + · rintro R (hR | rfl) + · exact hfence.1.1 R hR + · exact ⟨x, s₀, hQ₀_ends⟩ + · rintro M₁ (hM₁ | rfl) M₂ (hM₂ | rfl) hne + · exact hfence.1.2 hM₁ hM₂ hne + · exact (hdisj_Q₀_R M₁ hM₁).symm + · exact hdisj_Q₀_R M₂ hM₂ + · exact (hne rfl).elim + · rintro R (hR | rfl) + · obtain ⟨aR, haR, bR, hbR, hR_e⟩ := hfence.2.2 R hR + exact ⟨aR, hAf ⟨haR, hR_e.mem_transactionEnds_left S hR⟩, + bR, hBf ⟨hbR, hR_e.mem_transactionEnds_right S hR⟩, hR_e⟩ + · rcases h_xs₀ with ⟨hxA, hs₀B⟩ | ⟨hs₀A, hxB⟩ + · exact ⟨x, hxA, s₀, hs₀B, hQ₀_ends⟩ + · exact ⟨s₀, hs₀A, x, hxB, hQ₀_ends.symm S⟩ + have hQ₀_not_P : Q₀ ∉ P_set := fun h_in => + disjoint_left.mp (hdisj_Q₀_R Q₀ h_in) hQ₀_ft.1.left_mem hQ₀_ft.1.left_mem + have hcard' : P_set.ncard ≤ P_set'.ncard := by + have hset_eq : P_set' = insert Q₀ P_set := by ext R; simp [P_set'] + rw [hset_eq, ncard_insert_of_notMem hQ₀_not_P hfin_P] + exact Nat.le_succ _ + have hQ₀_not_per' : ¬ S.IsPeripheralIn P_set' Q₀ := by + intro hper + have hd := (hQ₀_ends.isPeripheralIn_iff S (Or.inr rfl)).mp hper + have ha_in_ends : a ∈ S.transactionEnds P_set' := + hP_ends.mem_transactionEnds_left S (Or.inl hP_in) + have hb_in_ends : b ∈ S.transactionEnds P_set' := + hP_ends.mem_transactionEnds_right S (Or.inl hP_in) + have hcr_Q₀P : S.Ω.Crosses a b s₀ x := + S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hs₀_ab, hx_ba⟩) + rcases S.Ω.crosses_iff_interval.mp hcr_Q₀P.symm.swap_left with ⟨ha_in, hb_in⟩ | ⟨hb_in, ha_in⟩ + <;> + rcases hd with hd₁ | hd₂ + · exact disjoint_left.mp hd₁ ha_in ha_in_ends + · exact disjoint_left.mp hd₂ hb_in hb_in_ends + · exact disjoint_left.mp hd₁ hb_in hb_in_ends + · exact disjoint_left.mp hd₂ ha_in ha_in_ends + have hP_not_per' : ¬ S.IsPeripheralIn P_set' P := by + intro hper + have hd := (hP_ends.isPeripheralIn_iff S (Or.inl hP_in)).mp hper + have hx_in_ends : x ∈ S.transactionEnds P_set' := + hQ₀_ends.mem_transactionEnds_left S (Or.inr rfl) + have hs₀_in_ends : s₀ ∈ S.transactionEnds P_set' := + hQ₀_ends.mem_transactionEnds_right S (Or.inr rfl) + rcases hd with hd₁ | hd₂ + · exact disjoint_left.mp hd₁ hs₀_ab hs₀_in_ends + · exact disjoint_left.mp hd₂ hx_ba hx_in_ends + refine ⟨P_set', htrans', hcard', fun R hR_per' => ?_⟩ + have hR_in_P : R ∈ P_set := + hR_per'.1.resolve_right fun h => hQ₀_not_per' (mem_singleton_iff.mp h ▸ hR_per') + exact ⟨hR_per'.mono_subset S subset_union_left hR_in_P, + fun h_eq => hP_not_per' (h_eq ▸ hR_per')⟩ + +/-- Single step in the proof of (4.1): if `P_set` is a transaction in which `P ∈ P_set` is +peripheral and non-separating, then there is a transaction `P_set_next` with +`P_set_next.ncard ≥ P_set.ncard` whose peripheral members are all peripheral in `P_set` and +different from `P`. -/ +private theorem theorem_4_1_step {P_set : Set (Graph α β)} + (htrans : S.IsTransaction P_set) + {P : Graph α β} (hperP : S.IsPeripheralIn P_set P) + (hnonsepP : S.IsNonSeparatingOmegaPath P) : + ∃ P_set' : Set (Graph α β), S.IsTransaction P_set' ∧ + P_set.ncard ≤ P_set'.ncard ∧ + ∀ R, S.IsPeripheralIn P_set' R → S.IsPeripheralIn P_set R ∧ R ≠ P := by + have hP_in : P ∈ P_set := hperP.1 + obtain ⟨A₀, B₀, hfence₀⟩ := htrans + obtain ⟨a₀_raw, ha₀_raw, b₀_raw, hb₀_raw, hP_ends_raw⟩ := hfence₀.2.2 P hP_in + -- Ensure `Disjoint (S.Ω.interval a b) W` by swapping `(A₀, B₀)` if needed. + have hex_fence : ∃ A B : Set α, S.IsFenceFor P_set A B ∧ + ∃ a ∈ A, ∃ b ∈ B, S.IsOmegaPathWithEnds P a b ∧ + Disjoint (S.Ω.interval a b) (S.transactionEnds P_set) := by + rcases (hP_ends_raw.isPeripheralIn_iff S hP_in).mp hperP with hd | hd + · exact ⟨A₀, B₀, hfence₀, a₀_raw, ha₀_raw, b₀_raw, hb₀_raw, hP_ends_raw, hd⟩ + · refine ⟨B₀, A₀, ⟨hfence₀.1, hfence₀.2.1.symm, fun R hR => ?_⟩, + b₀_raw, hb₀_raw, a₀_raw, ha₀_raw, hP_ends_raw.symm S, hd⟩ + obtain ⟨x, hx, y, hy, hxy⟩ := hfence₀.2.2 R hR + exact ⟨y, hy, x, hx, hxy.symm S⟩ + obtain ⟨A, B, hfence, a, haA, b, hbB, hP_ends, hd_ab⟩ := hex_fence + let W := S.transactionEnds P_set + have hW_bar : W ⊆ S.Ω.bar := S.transactionEnds_subset_bar P_set + have haW : a ∈ A ∩ W := ⟨haA, hP_ends.mem_transactionEnds_left S hP_in⟩ + have hbW : b ∈ B ∩ W := ⟨hbB, hP_ends.mem_transactionEnds_right S hP_in⟩ + -- Find the other empty-interval boundary pair `(b'_0, a_0)` of `(B, A)` with respect to `W`. + have hW_sub_BA : W ⊆ B ∪ A := by + rw [union_comm, hfence.2.1.2.2.2.1] + exact hW_bar + obtain ⟨b'_0, hb'_0, a_0, ha_0, hd_ba⟩ := + S.Ω.exists_empty_interval_AB_of_subset_union hW_bar hW_sub_BA + ⟨b, hbW⟩ ⟨a, haW⟩ + -- Since `P` is non-separating, there is an `Ω`-path `Q` crossing `P`. + obtain ⟨_, Q_raw, hcross_QP⟩ := hnonsepP + rcases hcross_QP with ⟨hdisj_QP, s_raw, t_raw, a', b', hQ_raw_ends, hP_ends', hcr_raw⟩ + have hcr : S.Ω.Crosses s_raw t_raw a b := by + rcases hP_ends.ends_eq S hP_ends' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hcr_raw + · exact (hcr_raw.symm.swap_left).symm + -- Order the ends of `Q_raw` as `(s, t)` with `s ∈ S.Ω.interval a b` and `t ∈ S.Ω.interval b a`. + have hex_Q : ∃ s t : α, S.IsOmegaPathWithEnds Q_raw s t ∧ + s ∈ S.Ω.interval a b ∧ t ∈ S.Ω.interval b a := by + rcases S.Ω.crosses_iff_interval.mp (hcr.symm) with ⟨hs, ht⟩ | ⟨hs, ht⟩ + · exact ⟨s_raw, t_raw, hQ_raw_ends, hs, ht⟩ + · exact ⟨t_raw, s_raw, hQ_raw_ends.symm S, hs, ht⟩ + obtain ⟨s, t, hQ_ends, hs_ab, ht_ba⟩ := hex_Q + -- Extract a minimal `(V(⋃ P_set) ∪ S.Ω.interval b a) → S.Ω.interval a b` subpath `Q₀ ≤ Q_raw`. + obtain ⟨x, hx_X, s₀, hs₀_ab, Q₀, hQ₀_le, hQ₀_ft⟩ := + hQ_ends.1.symm.exists_isFromToPathWithEnds + (X := V(S.transactionUnion P_set) ∪ S.Ω.interval b a) + (Y := S.Ω.interval a b) + (Or.inr ht_ba) hs_ab + have hdisj_Q₀P : Disjoint V(Q₀) V(P) := hdisj_QP.mono_left hQ₀_le.vertexSet_mono + have hs₀_bar : s₀ ∈ S.Ω.bar := hs₀_ab.1.1 + have hs₀_not_W : s₀ ∉ W := disjoint_left.mp hd_ab hs₀_ab + have hfin_P : P_set.Finite := hfence.1.finite S + by_cases hx_U : x ∈ V(S.transactionUnion P_set) + · -- Case 2: `x ∈ V(S.transactionUnion P_set)`. + change x ∈ ⋃ R ∈ P_set, V(R) at hx_U + obtain ⟨P₁, hP₁_in, hx_P₁⟩ := mem_iUnion₂.mp hx_U + have hP₁_ne_P : P₁ ≠ P := fun h_eq => disjoint_left.mp hdisj_Q₀P hQ₀_ft.1.left_mem + (h_eq ▸ hx_P₁) + obtain ⟨a₁, ha₁A, b₁, hb₁B, hP₁_ends⟩ := hfence.2.2 P₁ hP₁_in + have ha₁W : a₁ ∈ A ∩ W := ⟨ha₁A, hP₁_ends.mem_transactionEnds_left S hP₁_in⟩ + have hb₁W : b₁ ∈ B ∩ W := ⟨hb₁B, hP₁_ends.mem_transactionEnds_right S hP₁_in⟩ + -- Split `P₁` at `x ∈ V(P₁)` into `R₁` (from `x` to `a₁`) and `R₂` (from `x` to `b₁`). + obtain ⟨R₁_rev, R₂, hR₁P₁, hR₂P₁, hR₁_rev, hR₂, _, _, _⟩ := hP₁_ends.1.exists_split_at hx_P₁ + have hR₁ : IsGraphPathWithEnds P₁ R₁_rev x a₁ := hR₁_rev.symm + let S_sw := subgraphUnion S.G Q₀ R₁_rev + let S'_sw := subgraphUnion S.G Q₀ R₂ + let P_set' := (P_set \ {P₁}) ∪ {S_sw} + let P_set'' := (P_set \ {P₁}) ∪ {S'_sw} + have hinter_U : V(Q₀) ∩ V(S.transactionUnion P_set) = {x} := by + apply Subset.antisymm + · intro z ⟨hzQ₀, hzU⟩ + have hz_X : z ∈ V(Q₀) ∩ (V(S.transactionUnion P_set) ∪ S.Ω.interval b a) := + ⟨hzQ₀, Or.inl hzU⟩ + rwa [hQ₀_ft.2.1] at hz_X + · rintro z rfl + exact ⟨hQ₀_ft.1.left_mem, mem_iUnion₂.mpr ⟨P₁, hP₁_in, hx_P₁⟩⟩ + have hinter_P₁ : V(Q₀) ∩ V(P₁) = {x} := by + apply Subset.antisymm + · intro z ⟨hzQ₀, hzP₁⟩ + have hzU : z ∈ V(Q₀) ∩ V(S.transactionUnion P_set) := + ⟨hzQ₀, mem_iUnion₂.mpr ⟨P₁, hP₁_in, hzP₁⟩⟩ + rwa [hinter_U] at hzU + · rintro z rfl + exact ⟨hQ₀_ft.1.left_mem, hx_P₁⟩ + have hdisj_Q₀_other : ∀ R ∈ P_set \ {P₁}, Disjoint V(Q₀) V(R) := by + intro R ⟨hR_in, hR_ne⟩ + rw [disjoint_left] + intro z hzQ₀ hzR + have hz_x : z = x := by + have hzU : z ∈ V(Q₀) ∩ V(S.transactionUnion P_set) := + ⟨hzQ₀, mem_iUnion₂.mpr ⟨R, hR_in, hzR⟩⟩ + rwa [hinter_U, mem_singleton_iff] at hzU + subst hz_x + exact disjoint_left.mp (hfence.1.2 hP₁_in hR_in (Ne.symm hR_ne)) hx_P₁ hzR + have hS_ends : S.IsOmegaPathWithEnds S_sw s₀ a₁ := by + have hinter_R₁ : V(Q₀) ∩ V(R₁_rev) = {x} := by + apply Subset.antisymm + · intro z ⟨hzQ₀, hzR₁⟩ + have hz_in : z ∈ V(Q₀) ∩ V(P₁) := ⟨hzQ₀, hR₁P₁.vertexSet_mono hzR₁⟩ + rwa [hinter_P₁] at hz_in + · rintro z rfl + exact ⟨hQ₀_ft.1.left_mem, hR₁.left_mem⟩ + refine ⟨hQ₀_ft.1.symm.subgraphUnion (hR₁.mono hP₁_ends.1.le) hinter_R₁, + fun h => hs₀_not_W (h ▸ ha₁W.2), hs₀_bar, hP₁_ends.2.2.1⟩ + have hS'_ends : S.IsOmegaPathWithEnds S'_sw s₀ b₁ := by + have hinter_R₂ : V(Q₀) ∩ V(R₂) = {x} := by + apply Subset.antisymm + · intro z ⟨hzQ₀, hzR₂⟩ + have hz_in : z ∈ V(Q₀) ∩ V(P₁) := ⟨hzQ₀, hR₂P₁.vertexSet_mono hzR₂⟩ + rwa [hinter_P₁] at hz_in + · rintro z rfl + exact ⟨hQ₀_ft.1.left_mem, hR₂.left_mem⟩ + refine ⟨hQ₀_ft.1.symm.subgraphUnion (hR₂.mono hP₁_ends.1.le) hinter_R₂, + fun h => hs₀_not_W (h ▸ hb₁W.2), hs₀_bar, hP₁_ends.2.2.2⟩ + have hdisj_S_other : ∀ R ∈ P_set \ {P₁}, Disjoint V(S_sw) V(R) := by + intro R hR + rw [vertexSet_subgraphUnion, disjoint_union_left] + exact ⟨hdisj_Q₀_other R hR, + (hfence.1.2 hP₁_in hR.1 (Ne.symm hR.2)).mono_left hR₁P₁.vertexSet_mono⟩ + have hdisj_S'_other : ∀ R ∈ P_set \ {P₁}, Disjoint V(S'_sw) V(R) := by + intro R hR + rw [vertexSet_subgraphUnion, disjoint_union_left] + exact ⟨hdisj_Q₀_other R hR, + (hfence.1.2 hP₁_in hR.1 (Ne.symm hR.2)).mono_left hR₂P₁.vertexSet_mono⟩ + -- Prove `P_set'` and `P_set''` are transactions with cardinality `P_set.ncard`. + obtain ⟨hA_sub, hB_sub, _, _, _, _⟩ := + four_arc_partition hfence.2.1 hW_bar ha_0 haW hbW hb'_0 hd_ab hd_ba + obtain ⟨A₁, B₁, hff₁, hA₁, _, hB₁, hs₁⟩ := + fence_cut_G₁ hfence.2.1 hW_bar ha_0 haW hbW hb'_0 hd_ab hd_ba hs₀_ab + obtain ⟨A₂, B₂, hff₂, hA₂, hs₂, hB₂, _⟩ := + fence_cut_G₁_dual hfence.2.1 hW_bar ha_0 haW hbW hb'_0 hd_ab hd_ba hs₀_ab + have htrans' : S.IsTransaction P_set' := by + refine ⟨A₁, B₁, ⟨⟨?_, ?_⟩, hff₁, ?_⟩⟩ + · rintro R (hR | rfl) + · exact hfence.1.1 R hR.1 + · exact ⟨s₀, a₁, hS_ends⟩ + · rintro M₁ (hM₁ | rfl) M₂ (hM₂ | rfl) hne + · exact hfence.1.2 hM₁.1 hM₂.1 hne + · exact (hdisj_S_other M₁ hM₁).symm + · exact hdisj_S_other M₂ hM₂ + · exact (hne rfl).elim + · rintro R (hR | rfl) + · obtain ⟨aR, haR, bR, hbR, hR_e⟩ := hfence.2.2 R hR.1 + exact ⟨aR, hA₁ (hA_sub ⟨haR, hR_e.mem_transactionEnds_left S hR.1⟩), + bR, hB₁ (hB_sub ⟨hbR, hR_e.mem_transactionEnds_right S hR.1⟩), hR_e⟩ + · exact ⟨a₁, hA₁ (hA_sub ha₁W), s₀, hs₁, hS_ends.symm S⟩ + have htrans'' : S.IsTransaction P_set'' := by + refine ⟨A₂, B₂, ⟨⟨?_, ?_⟩, hff₂, ?_⟩⟩ + · rintro R (hR | rfl) + · exact hfence.1.1 R hR.1 + · exact ⟨s₀, b₁, hS'_ends⟩ + · rintro M₁ (hM₁ | rfl) M₂ (hM₂ | rfl) hne + · exact hfence.1.2 hM₁.1 hM₂.1 hne + · exact (hdisj_S'_other M₁ hM₁).symm + · exact hdisj_S'_other M₂ hM₂ + · exact (hne rfl).elim + · rintro R (hR | rfl) + · obtain ⟨aR, haR, bR, hbR, hR_e⟩ := hfence.2.2 R hR.1 + exact ⟨aR, hA₂ (hA_sub ⟨haR, hR_e.mem_transactionEnds_left S hR.1⟩), + bR, hB₂ (hB_sub ⟨hbR, hR_e.mem_transactionEnds_right S hR.1⟩), hR_e⟩ + · exact ⟨s₀, hs₂, b₁, hB₂ (hB_sub hb₁W), hS'_ends⟩ + have hS_not_diff : S_sw ∉ P_set \ {P₁} := fun h_in => + disjoint_left.mp (hdisj_S_other S_sw h_in) (Or.inl hQ₀_ft.1.left_mem) + (Or.inl hQ₀_ft.1.left_mem) + have hS'_not_diff : S'_sw ∉ P_set \ {P₁} := fun h_in => + disjoint_left.mp (hdisj_S'_other S'_sw h_in) (Or.inl hQ₀_ft.1.left_mem) + (Or.inl hQ₀_ft.1.left_mem) + have hcard' : P_set'.ncard = P_set.ncard := by + have hset_eq : P_set' = insert S_sw (P_set \ {P₁}) := by ext R; simp [P_set', or_comm] + rw [hset_eq, ncard_insert_of_notMem hS_not_diff hfin_P.sdiff, + ncard_sdiff_singleton_add_one hP₁_in hfin_P] + have hcard'' : P_set''.ncard = P_set.ncard := by + have hset_eq : P_set'' = insert S'_sw (P_set \ {P₁}) := by ext R; simp [P_set'', or_comm] + rw [hset_eq, ncard_insert_of_notMem hS'_not_diff hfin_P.sdiff, + ncard_sdiff_singleton_add_one hP₁_in hfin_P] + exact peripheral_replacement_of_two_switches S hfence hperP hP₁_in hP₁_ne_P + haW hbW ha₁W hb₁W hd_ab hs₀_ab hP_ends hP₁_ends hS_ends hS'_ends + htrans' htrans'' hcard' hcard'' + · exact peripheral_replacement_of_disjoint_cross S hfence hP_in haW hbW ha_0 hb'_0 hd_ab hd_ba + hP_ends hQ₀_ft (hx_X.resolve_left hx_U) hx_U hs₀_ab + +/-- Two crossing `Ω`-paths form a crooked transaction of cardinality 2. -/ +theorem OmegaPathsCross.isCrookedTransaction_pair {P₁ P₂ : Graph α β} + (hcross : S.OmegaPathsCross P₁ P₂) : + S.IsCrookedTransaction {P₁, P₂} ∧ ({P₁, P₂} : Set (Graph α β)).ncard = 2 := by + rcases hcross with ⟨hdisj, s₁, t₁, s₂, t₂, h₁, h₂, hcr⟩ + have h12 : P₁ ≠ P₂ := fun h => disjoint_left.mp hdisj h₁.1.left_mem (h ▸ h₁.1.left_mem) + have hex₁ : ∃ s₁' t₁' : α, S.IsOmegaPathWithEnds P₁ s₁' t₁' ∧ + s₁' ∈ S.Ω.interval s₂ t₂ ∧ t₁' ∈ S.Ω.interval t₂ s₂ := by + rcases S.Ω.crosses_iff_interval.mp hcr.symm with ⟨hs₁, ht₁⟩ | ⟨hs₁, ht₁⟩ + · exact ⟨s₁, t₁, h₁, hs₁, ht₁⟩ + · exact ⟨t₁, s₁, h₁.symm S, hs₁, ht₁⟩ + obtain ⟨s₁', t₁', h₁', hs₁', ht₁'⟩ := hex₁ + have hs₂_ne_s₁' : s₂ ≠ s₁' := fun h => S.Ω.not_mem_interval_left s₂ t₂ (h ▸ hs₁') + have hfence : S.Ω.IsFence ({s₂, s₁'} ∪ S.Ω.interval s₂ s₁') (S.Ω.interval s₁' s₂) := + S.Ω.isFence_interval_compl h₂.2.2.1 h₁'.2.2.1 hs₂_ne_s₁' + have ht₂_in : t₂ ∈ S.Ω.interval s₁' s₂ := S.Ω.mem_interval_rotate_left hs₁' + have ht₁'_in : t₁' ∈ S.Ω.interval s₁' s₂ := + S.Ω.interval_subset_interval_right ht₂_in ht₁' + refine ⟨⟨⟨{s₂, s₁'} ∪ S.Ω.interval s₂ s₁', S.Ω.interval s₁' s₂, ⟨?_, ?_⟩, hfence, ?_⟩, ?_⟩, + ncard_pair h12⟩ + · rintro R (rfl | rfl) + · exact ⟨s₁', t₁', h₁'⟩ + · exact ⟨s₂, t₂, h₂⟩ + · rintro R₁ (rfl | rfl) R₂ (rfl | rfl) hne + · exact (hne rfl).elim + · exact hdisj + · exact hdisj.symm + · exact (hne rfl).elim + · rintro R (rfl | rfl) + · exact ⟨s₁', Or.inl (Or.inr rfl), t₁', ht₁'_in, h₁'⟩ + · exact ⟨s₂, Or.inl (Or.inl rfl), t₂, ht₂_in, h₂⟩ + · rintro R (rfl | rfl) hper + · exact S.not_omegaPathsCross_of_isPeripheralIn hper (Or.inr rfl) + ⟨hdisj.symm, s₂, t₂, s₁, t₁, h₂, h₁, hcr.symm⟩ + · exact S.not_omegaPathsCross_of_isPeripheralIn hper (Or.inl rfl) + ⟨hdisj, s₁, t₁, s₂, t₂, h₁, h₂, hcr⟩ + +/-- **Graph Minors IX, (4.1)** (page 49): +"Let $\mathscr{P}$ be a transaction in $(G, \Omega)$, such that every peripheral member is +non-separating. Then there is a crooked transaction $\mathscr{P}'$ in $(G, \Omega)$ with +$|\mathscr{P}'| \ge |\mathscr{P}|$." -/ +theorem theorem_4_1_proof {P_set : Set (Graph α β)} + (htrans : S.IsTransaction P_set) + (hnonsep : ∀ P ∈ P_set, S.IsPeripheralIn P_set P → S.IsNonSeparatingOmegaPath P) : + ∃ P_set' : Set (Graph α β), S.IsCrookedTransaction P_set' ∧ P_set.ncard ≤ P_set'.ncard := by + by_cases hcrooked : S.IsCrookedTransaction P_set + · exact ⟨P_set, hcrooked, le_rfl⟩ + · -- Since `P_set` is a transaction and not crooked, `P_set` has a peripheral member `P₁`. + have hex_per₁ : ∃ P₁ ∈ P_set, S.IsPeripheralIn P_set P₁ := by + by_contra! hno + exact hcrooked ⟨htrans, hno⟩ + obtain ⟨P₁, hP₁_in, hper₁⟩ := hex_per₁ + -- Apply `theorem_4_1_step` to `P₁`. + obtain ⟨P_set₁, htrans₁, hcard₁, hper_sub₁⟩ := + S.theorem_4_1_step htrans hper₁ (hnonsep P₁ hP₁_in hper₁) + by_cases hcrooked₁ : S.IsCrookedTransaction P_set₁ + · exact ⟨P_set₁, hcrooked₁, hcard₁⟩ + · have hex_per₂ : ∃ P₂ ∈ P_set₁, S.IsPeripheralIn P_set₁ P₂ := by + by_contra! hno + exact hcrooked₁ ⟨htrans₁, hno⟩ + obtain ⟨P₂, _, hper₂'⟩ := hex_per₂ + obtain ⟨hper₂, hP₂_ne_P₁⟩ := hper_sub₁ P₂ hper₂' + -- Apply `theorem_4_1_step` a second time to `P₂` in `P_set₁`. + obtain ⟨P_set₂, htrans₂, hcard₂, hper_sub₂⟩ := + S.theorem_4_1_step htrans₁ hper₂' (hnonsep P₂ hper₂.1 hper₂) + refine ⟨P_set₂, ⟨htrans₂, fun P₃ _ hper₃'' => ?_⟩, hcard₁.trans hcard₂⟩ + obtain ⟨hper₃', hP₃_ne_P₂⟩ := hper_sub₂ P₃ hper₃'' + obtain ⟨hper₃, hP₃_ne_P₁⟩ := hper_sub₁ P₃ hper₃' + obtain ⟨A, B, hfence⟩ := htrans + exact hfence.not_three_peripheral S hper₁ hper₂ hper₃ + hP₂_ne_P₁.symm hP₃_ne_P₁.symm hP₃_ne_P₂.symm + +/-! ## Statement S, (4.2), and (4.3) -/ + +/-- **Graph Minors IX, (4.2)** (page 50): +"Let* **S** *be true. Suppose that $w, w' \in W(\mathscr{Q})$ are distinct, and that neither +of the corresponding attachments is exchangeable. Then $w, w'$ are both ends of the same +member of $\mathscr{Q}$." -/ +theorem theorem_4_2_proof {p : ℕ} {P_set Q_set : Set (Graph α β)} {A B : Set α} + (hS : S.StatementS p P_set Q_set A B) + {w w' : α} (_hw_ne : w ≠ w') + {P P' : Graph α β} + (hatt : S.IsCorrespondingAttachment P_set Q_set w P) + (hatt' : S.IsCorrespondingAttachment P_set Q_set w' P') + (hnot_exch : ¬ S.IsExchangeableAttachment P_set P) + (hnot_exch' : ¬ S.IsExchangeableAttachment P_set P') : + ∃ Q ∈ Q_set, w ∈ pathEnds S.G Q ∧ w' ∈ pathEnds S.G Q := by + rcases hatt with ⟨_, Q, hQ_in, hw_Q, hPQ, v, hatt_vw⟩ + rcases hatt' with ⟨_, Q', hQ'_in, hw'_Q', hP'Q', v', hatt'_v'w'⟩ + by_cases hQQ' : Q = Q' + · subst hQQ' + exact ⟨Q, hQ_in, hw_Q, hw'_Q'⟩ + · exfalso + have hdisj_QQ' : Disjoint V(Q) V(Q') := hS.isTransaction_Q.choose_spec.choose_spec.1.2 hQ_in + hQ'_in hQQ' + have hdisj_PP' : Disjoint V(P) V(P') := + hdisj_QQ'.mono hPQ.vertexSet_mono hP'Q'.vertexSet_mono + obtain ⟨P'', hP''_in, _, _, _, b, b', ⟨u_b, hatt_bu⟩, _, ⟨u_b', hatt'_b'u'⟩, _, + M, hMP'', hM_path, P_set', hcrooked', hcard', hunion_le, hdisj_EM⟩ := + S.theorem_3_3_proof hS.isCrooked_P ⟨v, w, hatt_vw⟩ hnot_exch ⟨v', w', hatt'_v'w'⟩ hnot_exch' + hdisj_PP' + have hb_eq_v : b = v := by + have hb_in : b ∈ V(P) ∩ V(S.transactionUnion P_set) := + ⟨hatt_bu.1.left_mem, hatt_bu.foot_mem_transactionUnion S⟩ + rwa [hatt_vw.2.1, mem_singleton_iff] at hb_in + have hb'_eq_v' : b' = v' := by + have hb'_in : b' ∈ V(P') ∩ V(S.transactionUnion P_set) := + ⟨hatt'_b'u'.1.left_mem, hatt'_b'u'.foot_mem_transactionUnion S⟩ + rwa [hatt'_v'w'.2.1, mem_singleton_iff] at hb'_in + subst hb_eq_v + subst hb'_eq_v' + have hvv' : b ≠ b' := + fun h => disjoint_left.mp hdisj_PP' hatt_vw.1.left_mem (h ▸ hatt'_v'w'.1.left_mem) + -- `P ∪ P' ≤ ⋃ Q_set`, so `⋃ P_set' ∪ ⋃ Q_set ≤ ⋃ P_set ∪ ⋃ Q_set`. + have hQ_set_le : ∀ R ∈ Q_set, R ≤ S.G := fun R hR => by + obtain ⟨_, _, h⟩ := hS.isTransaction_Q.choose_spec.choose_spec.1.1 R hR + exact h.1.le + have hP_set_le : ∀ R ∈ P_set, R ≤ S.G := fun R hR => by + obtain ⟨_, _, h⟩ := hS.isFenceFor_P.1.1 R hR + exact h.1.le + have hP_set'_le : ∀ R ∈ P_set', R ≤ S.G := fun R hR => by + obtain ⟨_, _, h⟩ := hcrooked'.1.choose_spec.choose_spec.1.1 R hR + exact h.1.le + have hUP_le : S.transactionUnion P_set ≤ S.G := subgraphSUnion_le hP_set_le + have hUP'_le : S.transactionUnion P_set' ≤ S.G := subgraphSUnion_le hP_set'_le + have hUQ_le : S.transactionUnion Q_set ≤ S.G := subgraphSUnion_le hQ_set_le + have hQ_le_UQ : Q ≤ S.transactionUnion Q_set := le_subgraphSUnion hQ_set_le hQ_in + have hQ'_le_UQ : Q' ≤ S.transactionUnion Q_set := le_subgraphSUnion hQ_set_le hQ'_in + have hPP'_le_UQ : subgraphUnion S.G P P' ≤ S.transactionUnion Q_set := + (subgraphUnion_le_iff hatt_vw.1.le hatt'_v'w'.1.le hUQ_le).mpr + ⟨hPQ.trans hQ_le_UQ, hP'Q'.trans hQ'_le_UQ⟩ + have hunion_sub : + subgraphUnion S.G (S.transactionUnion P_set') (S.transactionUnion Q_set) ≤ + subgraphUnion S.G (S.transactionUnion P_set) (S.transactionUnion Q_set) := by + rw [subgraphUnion_le_iff hUP'_le hUQ_le (subgraphUnion_le hUP_le hUQ_le)] + refine ⟨hunion_le.trans ?_, le_subgraphUnion_right hUP_le hUQ_le⟩ + rw [subgraphUnion_le_iff hUP_le (subgraphUnion_le hatt_vw.1.le hatt'_v'w'.1.le) + (subgraphUnion_le hUP_le hUQ_le)] + exact ⟨le_subgraphUnion_left hUP_le hUQ_le, + hPP'_le_UQ.trans (le_subgraphUnion_right hUP_le hUQ_le)⟩ + have hunion_eq : + subgraphUnion S.G (S.transactionUnion P_set') (S.transactionUnion Q_set) = + subgraphUnion S.G (S.transactionUnion P_set) (S.transactionUnion Q_set) := + hS.minimal_union P_set' hcrooked' + (hS.card_P_ge.trans (by rw [hcard']; exact Nat.le_succ _)) hunion_sub + -- Since `Disjoint E(M) E(S.transactionUnion P_set')`, every edge of `M` lies in + -- `E(S.transactionUnion Q_set)`. + have hEM_sub_UQ : E(M) ⊆ E(S.transactionUnion Q_set) := by + intro e heM + have he_in_P : e ∈ E(S.transactionUnion P_set) := + (hMP''.trans (le_subgraphSUnion hP_set_le hP''_in)).edgeSet_mono heM + have he_rhs : e ∈ E(subgraphUnion S.G (S.transactionUnion P_set) (S.transactionUnion Q_set)) + := by + rw [edgeSet_subgraphUnion hUP_le hUQ_le] + exact Or.inl he_in_P + rw [← hunion_eq, edgeSet_subgraphUnion hUP'_le hUQ_le] at he_rhs + exact he_rhs.resolve_left (disjoint_left.mp hdisj_EM heM) + -- Walk along `M` from `b ∈ V(Q)` to `b' ∈ V(Q')`: since `Q_set` is pairwise vertex-disjoint, + -- all vertices of `M` lie in `V(Q)`. + have hM_G : IsGraphPathWithEnds S.G M b b' := hM_path.mono (hP_set_le P'' hP''_in) + rcases hM_G with ⟨hMG, W_M, _, hVM, hEM⟩ + have hsupp_in_Q : ∀ z ∈ W_M.support, z ∈ V(Q) := by + have hb_in_Q : b ∈ V(Q) := hPQ.vertexSet_mono hatt_vw.1.left_mem + have h_ind : ∀ {u_w v_w : α} (W : GraphWalk M u_w v_w), + (∀ e ∈ W.edges, e ∈ E(M)) → u_w ∈ V(Q) → ∀ z ∈ W.support, z ∈ V(Q) := by + intro u_w v_w W + induction W with + | nil _ => + intro _ hu_Q z hz + simp only [GraphWalk.support_nil, List.mem_singleton] at hz + exact hz ▸ hu_Q + | @cons u_c w_c _ e_c he_c W_tail ih => + intro hW_edges hu_Q z hz + have he_M : e_c ∈ E(M) := hW_edges e_c List.mem_cons_self + have he_UQ : e_c ∈ ⋃ R ∈ Q_set, E(R) := by + have h := hEM_sub_UQ he_M + rwa [show E(S.transactionUnion Q_set) = ⋃ R ∈ Q_set, E(R) from + edgeSet_subgraphSUnion hQ_set_le] at h + obtain ⟨R, hR_in, he_R⟩ := mem_iUnion₂.mp he_UQ + obtain ⟨x_R, y_R, hxy_R⟩ := R.exists_isLink_of_mem_edgeSet he_R + have hxy_G : S.G.IsLink e_c x_R y_R := hxy_R.mono (hQ_set_le R hR_in) + have he_G : S.G.IsLink e_c u_c w_c := he_c.mono hMG + have hu_R : u_c ∈ V(R) := by + rcases he_G.left_eq_or_eq hxy_G with rfl | rfl + · exact hxy_R.left_mem + · exact hxy_R.right_mem + have hw_R : w_c ∈ V(R) := by + rcases he_G.symm.left_eq_or_eq hxy_G with rfl | rfl + · exact hxy_R.left_mem + · exact hxy_R.right_mem + have hRQ : R = Q := by + by_contra hne + exact disjoint_left.mp + (hS.isTransaction_Q.choose_spec.choose_spec.1.2 hR_in hQ_in hne) hu_R hu_Q + subst hRQ + rcases List.mem_cons.mp hz with rfl | hz_tail + · exact hu_Q + · exact ih (fun e he => hW_edges e (List.mem_cons_of_mem e_c he)) hw_R z hz_tail + exact h_ind W_M (fun e he => by rwa [hEM, mem_ofPred_eq]) hb_in_Q + have hb'_in_Q : b' ∈ V(Q) := hsupp_in_Q b' W_M.end_mem_support + have hb'_in_Q' : b' ∈ V(Q') := hP'Q'.vertexSet_mono hatt'_v'w'.1.left_mem + exact disjoint_left.mp hdisj_QQ' hb'_in_Q hb'_in_Q' + +private theorem path_le_member_of_transaction {R_b Q : Graph α β} {s e₂ : α} + {Q_set : Set (Graph α β)} (hQset : S.IsDisjointOmegaPathSet Q_set) + (hQ_in : Q ∈ Q_set) (hRb_G : IsGraphPathWithEnds S.G R_b s e₂) + (hs_in_Q : s ∈ V(Q)) (hERb_sub_UQ : E(R_b) ⊆ E(S.transactionUnion Q_set)) : R_b ≤ Q := by + have hRb_le := hRb_G.le + have hQ_set_le : ∀ M ∈ Q_set, M ≤ S.G := fun M hM => by + obtain ⟨_, _, hpath⟩ := hQset.1 M hM + exact hpath.1.le + have hQ_le := hQ_set_le Q hQ_in + rcases hRb_G with ⟨_, W_Rb, _, hVRb, hERb⟩ + have h_ind : ∀ {u_w v_w : α} (W : GraphWalk R_b u_w v_w), + (∀ e ∈ W.edges, e ∈ E(R_b)) → u_w ∈ V(Q) → + (∀ z ∈ W.support, z ∈ V(Q)) ∧ (∀ e ∈ W.edges, e ∈ E(Q)) := by + intro u_w v_w W + induction W with + | nil _ => + intro _ hu_Q + refine ⟨fun z hz => ?_, fun e he => by simp [GraphWalk.edges] at he⟩ + simp only [GraphWalk.support_nil, List.mem_singleton] at hz + exact hz ▸ hu_Q + | @cons u_c w_c _ e_c he_c W_tail ih => + intro hW_edges hu_Q + have he_Rb : e_c ∈ E(R_b) := hW_edges e_c List.mem_cons_self + have he_UQ : e_c ∈ ⋃ M ∈ Q_set, E(M) := by + have h := hERb_sub_UQ he_Rb + rwa [show E(S.transactionUnion Q_set) = ⋃ M ∈ Q_set, E(M) from + edgeSet_subgraphSUnion hQ_set_le] at h + obtain ⟨M, hM_in, he_M⟩ := mem_iUnion₂.mp he_UQ + obtain ⟨x_M, y_M, hxy_M⟩ := M.exists_isLink_of_mem_edgeSet he_M + have hxy_G : S.G.IsLink e_c x_M y_M := hxy_M.mono (hQ_set_le M hM_in) + have he_G : S.G.IsLink e_c u_c w_c := he_c.mono hRb_le + have hu_M : u_c ∈ V(M) := by + rcases he_G.left_eq_or_eq hxy_G with rfl | rfl + · exact hxy_M.left_mem + · exact hxy_M.right_mem + have hw_M : w_c ∈ V(M) := by + rcases he_G.symm.left_eq_or_eq hxy_G with rfl | rfl + · exact hxy_M.left_mem + · exact hxy_M.right_mem + have hMQ : M = Q := by + by_contra hne + exact disjoint_left.mp + (hQset.2 hM_in hQ_in hne) hu_M hu_Q + subst hMQ + obtain ⟨ih_V, ih_E⟩ := ih (fun e he => hW_edges e (List.mem_cons_of_mem e_c he)) hw_M + refine ⟨?_, ?_⟩ + · intro z hz + rcases List.mem_cons.mp hz with rfl | hz_tail + · exact hu_Q + · exact ih_V z hz_tail + · intro e he + rcases List.mem_cons.mp he with rfl | he_tail + · exact he_M + · exact ih_E e he_tail + obtain ⟨hV_sub, hE_sub⟩ := h_ind W_Rb (fun e he => by rwa [hERb, mem_ofPred_eq]) hs_in_Q + rw [(Compatible.of_le_le hRb_le hQ_le).le_iff] + exact ⟨fun z hz => hV_sub z (by rwa [hVRb, mem_ofPred_eq] at hz), + fun e he => hE_sub e (by rwa [hERb, mem_ofPred_eq] at he)⟩ + +private theorem disjoint_from_replacement {P_set : Set (Graph α β)} {P₁ P R_a_rev R_b : Graph α β} + {s e₂ : α} (hPset : S.IsDisjointOmegaPathSet P_set) (hP₁_in : P₁ ∈ P_set) + (hRb_P₁ : R_b ≤ P₁) (hRb : IsGraphPathWithEnds S.G R_b s e₂) + (hP_le : P ≤ S.G) (hRa_le : R_a_rev ≤ S.G) (hdisj_ERab : Disjoint E(R_a_rev) E(R_b)) + (hP_inter : V(R_b) ∩ V(P) ⊆ {s}) : + let P_set' := (P_set \ {P₁}) ∪ {subgraphUnion S.G P R_a_rev} + Disjoint E(R_b) E(S.transactionUnion P_set') := by + intro P_set' + have hRb_le := hRb.le + have hP_set_le : ∀ M ∈ P_set, M ≤ S.G := fun M hM => by + obtain ⟨_, _, hpath⟩ := hPset.1 M hM + exact hpath.1.le + have hP_set'_le : ∀ M ∈ P_set', M ≤ S.G := by + rintro M (hM | rfl) + · exact hP_set_le M hM.1 + · exact subgraphUnion_le hP_le hRa_le + rw [show E(S.transactionUnion P_set') = ⋃ M ∈ P_set', E(M) from edgeSet_subgraphSUnion hP_set'_le, + disjoint_iUnion₂_right] + rintro M (hM | rfl) + · rw [disjoint_left] + intro e heRb heM + obtain ⟨x_b, y_b, hxy_b⟩ := R_b.exists_isLink_of_mem_edgeSet heRb + obtain ⟨x_M, y_M, hxy_M⟩ := M.exists_isLink_of_mem_edgeSet heM + have hxy_bG : S.G.IsLink e x_b y_b := hxy_b.mono hRb_le + have hxy_MG : S.G.IsLink e x_M y_M := hxy_M.mono (hP_set_le M hM.1) + have hne_P₁M : P₁ ≠ M := fun h => hM.2 h.symm + rcases hxy_bG.left_eq_or_eq hxy_MG with rfl | rfl + · exact disjoint_left.mp (hPset.2 hP₁_in hM.1 hne_P₁M) + (hRb_P₁.vertexSet_mono hxy_b.left_mem) hxy_M.left_mem + · exact disjoint_left.mp (hPset.2 hP₁_in hM.1 hne_P₁M) + (hRb_P₁.vertexSet_mono hxy_b.left_mem) hxy_M.right_mem + · rw [edgeSet_subgraphUnion hP_le hRa_le, disjoint_union_right] + refine ⟨disjoint_edgeSet_of_inter_singleton (z := s) hRb hP_le ?_, + hdisj_ERab.symm⟩ + exact hP_inter + +/-- If `StatementS` holds and `Q ∈ Q_set` satisfies none of (4.3)(i), (ii), (iii), then some end +`w` of `Q` belongs to `W(Q_set)` and has a non-exchangeable corresponding attachment `P ≤ Q`. -/ +private theorem exists_nonExchangeable_correspondingAttachment_of_not_4_3 + {p : ℕ} {P_set Q_set : Set (Graph α β)} {A B : Set α} + (hS : S.StatementS p P_set Q_set A B) + {Q : Graph α β} (hQ_in : Q ∈ Q_set) + (h_not_i : (V(Q) ∩ V(S.transactionUnion P_set)).Nonempty) + (h_not_ii : ¬ pathEnds S.G Q ⊆ S.transactionEnds P_set) + (h_not_iii : ¬ S.IsHalfCovered P_set Q) : + ∃ w ∈ pathEnds S.G Q, ∃ P : Graph α β, + S.IsCorrespondingAttachment P_set Q_set w P ∧ + ¬ S.IsExchangeableAttachment P_set P := by + obtain ⟨a_raw, b_raw, hQ_ends_raw⟩ := + hS.isTransaction_Q.choose_spec.choose_spec.1.1 Q hQ_in + -- Ensure the first end `w` of `Q` is not in `S.transactionEnds P_set`. + have hex_ends : ∃ w t : α, S.IsOmegaPathWithEnds Q w t ∧ w ∉ S.transactionEnds P_set := by + rw [hQ_ends_raw.1.pathEnds_eq] at h_not_ii + by_cases ha_in : a_raw ∈ S.transactionEnds P_set + · have hb_not : b_raw ∉ S.transactionEnds P_set := fun hb_in => + h_not_ii (by rintro z (rfl | rfl); exacts [ha_in, hb_in]) + exact ⟨b_raw, a_raw, hQ_ends_raw.symm S, hb_not⟩ + · exact ⟨a_raw, b_raw, hQ_ends_raw, ha_in⟩ + obtain ⟨w, t, hQ_ends, hw_not_P⟩ := hex_ends + have hQ_le := hQ_ends.1.le + -- Extract a minimal `V(⋃ P_set) → (S.Ω.bar \ V(P_set))` subpath `P ≤ Q`. + obtain ⟨x₀, hx₀Q, hx₀U⟩ := h_not_i + obtain ⟨Q₁, hQ₁Q, _, hQ₁_path⟩ := hQ_ends.1.exists_subpath hx₀Q hQ_ends.1.left_mem + obtain ⟨s, hs_U, u, hu_bar_diff, P, hPQ₁, hP_ft⟩ := + hQ₁_path.exists_isFromToPathWithEnds + (X := V(S.transactionUnion P_set)) + (Y := S.Ω.bar \ S.transactionEnds P_set) + hx₀U ⟨hQ_ends.2.2.1, hw_not_P⟩ + have hPQ : P ≤ Q := hPQ₁.trans hQ₁Q + have hatt_su : S.IsAttachmentWithEnds P_set P s u := hP_ft + -- Since `Q` has no internal vertex in `S.Ω.bar`, `u ∈ V(P) ⊆ V(Q)` with `u ∈ S.Ω.bar` must be an + -- end of `Q`. + have hu_ends_Q : u ∈ pathEnds S.G Q := by + by_contra hu_not_end + have hu_int : u ∈ pathInternalVerts S.G Q := ⟨hPQ.vertexSet_mono hP_ft.1.right_mem, hu_not_end⟩ + exact disjoint_left.mp (hS.no_internal_in_bar Q hQ_in) hu_int hu_bar_diff.1 + have hu_in_W : u ∈ S.uncoveredSet P_set Q_set := by + have hu_ends_pair : u = w ∨ u = t := by + rwa [hQ_ends.1.pathEnds_eq, mem_insert_iff, mem_singleton_iff] at hu_ends_Q + have hu_trans_Q : u ∈ S.transactionEnds Q_set := by + rcases hu_ends_pair with rfl | rfl + · exact hQ_ends.mem_transactionEnds_left S hQ_in + · exact hQ_ends.mem_transactionEnds_right S hQ_in + exact ⟨hu_trans_Q, hu_bar_diff.2, Q, hQ_in, hu_ends_Q, ⟨x₀, hx₀Q, hx₀U⟩⟩ + have hcorr : S.IsCorrespondingAttachment P_set Q_set u P := + ⟨hu_in_W, Q, hQ_in, hu_ends_Q, hPQ, s, hatt_su⟩ + refine ⟨u, hu_ends_Q, P, hcorr, ?_⟩ + -- Suppose for contradiction that `P` is exchangeable; we deduce `S.IsHalfCovered P_set Q`. + rintro ⟨_, P₁, L', hsw, hcrooked'⟩ + apply h_not_iii + rcases hsw with ⟨hP₁_in, b_sw, u_sw, a₁_sw, b₁_sw, hatt_sw, hb_sw_P₁, hP₁_ends_sw, R, hR_or, rfl⟩ + have hb_eq_s : s = b_sw := by + have hb_in : b_sw ∈ V(P) ∩ V(S.transactionUnion P_set) := + ⟨hatt_sw.1.left_mem, hatt_sw.foot_mem_transactionUnion S⟩ + rw [hatt_su.2.1, mem_singleton_iff] at hb_in + exact hb_in.symm + subst hb_eq_s + -- Orient `P₁` so that `R` is the subpath of `P₁` from `s` to the first end `e₁` of `P₁`. + have hex_P₁ : ∃ e₁ e₂ : α, S.IsOmegaPathWithEnds P₁ e₁ e₂ ∧ IsGraphPathWithEnds P₁ R s e₁ := by + rcases hR_or with hR_a | hR_b + · exact ⟨a₁_sw, b₁_sw, hP₁_ends_sw, hR_a⟩ + · exact ⟨b₁_sw, a₁_sw, hP₁_ends_sw.symm S, hR_b⟩ + obtain ⟨e₁, e₂, hP₁_ends, hR_e₁⟩ := hex_P₁ + obtain ⟨R_a_rev, R_b, hRa_P₁, hRb_P₁, hRa_rev, hRb, _, hinter_Rab, hdisj_ERab⟩ := + hP₁_ends.1.exists_split_at hb_sw_P₁ + have hRa_eq_R : R_a_rev = R := + hP₁_ends.1.subpath_unique_of_left hRa_rev hR_e₁.symm + subst hRa_eq_R + let L' := subgraphUnion S.G P R_a_rev + let P_set' := (P_set \ {P₁}) ∪ {L'} + have hQ_set_le : ∀ M ∈ Q_set, M ≤ S.G := fun M hM => by + obtain ⟨_, _, h⟩ := hS.isTransaction_Q.choose_spec.choose_spec.1.1 M hM + exact h.1.le + have hP_set_le : ∀ M ∈ P_set, M ≤ S.G := fun M hM => by + obtain ⟨_, _, h⟩ := hS.isFenceFor_P.1.1 M hM + exact h.1.le + have hP_set'_le : ∀ M ∈ P_set', M ≤ S.G := fun M hM => by + obtain ⟨_, _, h⟩ := hcrooked'.1.choose_spec.choose_spec.1.1 M hM + exact h.1.le + have hUP_le : S.transactionUnion P_set ≤ S.G := subgraphSUnion_le hP_set_le + have hUP'_le : S.transactionUnion P_set' ≤ S.G := subgraphSUnion_le hP_set'_le + have hUQ_le : S.transactionUnion Q_set ≤ S.G := subgraphSUnion_le hQ_set_le + have hP₁_le : P₁ ≤ S.G := hP₁_ends.1.le + have hP_le : P ≤ S.G := hatt_su.1.le + have hRa_le : R_a_rev ≤ S.G := hRa_P₁.trans hP₁_le + have hRb_le : R_b ≤ S.G := hRb_P₁.trans hP₁_le + -- `|P_set'| = |P_set| ≥ p` and `⋃ P_set' ∪ ⋃ Q_set ≤ ⋃ P_set ∪ ⋃ Q_set`. + have hL'_not_diff : L' ∉ P_set \ {P₁} := + IsAttachmentWithEnds.subgraphUnion_not_mem_sdiff S hS.isFenceFor_P.1 hatt_su hP₁_in hb_sw_P₁ + have hfin_P : P_set.Finite := hS.isFenceFor_P.1.finite S + have hcard' : P_set'.ncard = P_set.ncard := by + have hset_eq : P_set' = insert L' (P_set \ {P₁}) := by ext M; simp [P_set', or_comm] + rw [hset_eq, ncard_insert_of_notMem hL'_not_diff hfin_P.sdiff, + ncard_sdiff_singleton_add_one hP₁_in hfin_P] + have hunion_sub : + subgraphUnion S.G (S.transactionUnion P_set') (S.transactionUnion Q_set) ≤ + subgraphUnion S.G (S.transactionUnion P_set) (S.transactionUnion Q_set) := by + rw [subgraphUnion_le_iff hUP'_le hUQ_le (subgraphUnion_le hUP_le hUQ_le)] + refine ⟨?_, le_subgraphUnion_right hUP_le hUQ_le⟩ + rw [(Compatible.of_le_le hUP'_le (subgraphUnion_le hUP_le hUQ_le)).le_iff] + constructor + · intro x hx + change x ∈ ⋃ M ∈ P_set', V(M) at hx + rw [mem_iUnion₂] at hx + rcases hx with ⟨M, hM | rfl, hxM⟩ + · exact Or.inl (mem_iUnion₂.mpr ⟨M, hM.1, hxM⟩) + · rcases hxM with hxP | hxRa + · exact Or.inr (mem_iUnion₂.mpr ⟨Q, hQ_in, hPQ.vertexSet_mono hxP⟩) + · exact Or.inl (mem_iUnion₂.mpr ⟨P₁, hP₁_in, hRa_P₁.vertexSet_mono hxRa⟩) + · rw [show E(S.transactionUnion P_set') = ⋃ M ∈ P_set', E(M) from edgeSet_subgraphSUnion + hP_set'_le, + edgeSet_subgraphUnion hUP_le hUQ_le, + show E(S.transactionUnion P_set) = ⋃ M ∈ P_set, E(M) from edgeSet_subgraphSUnion hP_set_le, + show E(S.transactionUnion Q_set) = ⋃ M ∈ Q_set, E(M) from edgeSet_subgraphSUnion hQ_set_le] + intro e he + rw [mem_iUnion₂] at he + rcases he with ⟨M, hM | rfl, heM⟩ + · exact Or.inl (mem_iUnion₂.mpr ⟨M, hM.1, heM⟩) + · rw [edgeSet_subgraphUnion hP_le hRa_le] at heM + rcases heM with heP | heRa + · exact Or.inr (mem_iUnion₂.mpr ⟨Q, hQ_in, hPQ.edgeSet_mono heP⟩) + · exact Or.inl (mem_iUnion₂.mpr ⟨P₁, hP₁_in, hRa_P₁.edgeSet_mono heRa⟩) + have hunion_eq : + subgraphUnion S.G (S.transactionUnion P_set') (S.transactionUnion Q_set) = + subgraphUnion S.G (S.transactionUnion P_set) (S.transactionUnion Q_set) := + hS.minimal_union P_set' hcrooked' (hcard' ▸ hS.card_P_ge) hunion_sub + -- `R_b` is edge-disjoint from `⋃ P_set'`, so `E(R_b) ⊆ E(⋃ Q_set)`. + have hdisj_ERb_UP' : Disjoint E(R_b) E(S.transactionUnion P_set') := + disjoint_from_replacement S hS.isFenceFor_P.1 hP₁_in hRb_P₁ (hRb.mono hP₁_le) + hP_le hRa_le hdisj_ERab (by + rw [← hatt_su.inter_leg_eq_singleton S hP₁_in hb_sw_P₁, inter_comm V(P) V(P₁)] + exact inter_subset_inter_left _ hRb_P₁.vertexSet_mono) + have hERb_sub_UQ : E(R_b) ⊆ E(S.transactionUnion Q_set) := by + intro e heRb + have he_in_P : e ∈ E(S.transactionUnion P_set) := + (hRb_P₁.trans (le_subgraphSUnion hP_set_le hP₁_in)).edgeSet_mono heRb + have he_rhs : e ∈ E(subgraphUnion S.G (S.transactionUnion P_set) (S.transactionUnion Q_set)) + := by + rw [edgeSet_subgraphUnion hUP_le hUQ_le] + exact Or.inl he_in_P + rw [← hunion_eq, edgeSet_subgraphUnion hUP'_le hUQ_le] at he_rhs + exact he_rhs.resolve_left (disjoint_left.mp hdisj_ERb_UP' heRb) + -- Since `R_b` starts at `s ∈ V(Q)` and `Q_set` is pairwise vertex-disjoint, `R_b ≤ Q`. + have hRb_le_Q : R_b ≤ Q := + path_le_member_of_transaction S hS.isTransaction_Q.choose_spec.choose_spec.1 hQ_in + (hRb.mono hP₁_le) + (hPQ.vertexSet_mono hatt_su.1.left_mem) hERb_sub_UQ + -- `e₂ ∈ V(R_b) ⊆ V(Q)` and `e₂ ∈ S.Ω.bar`, so `e₂ ∈ pathEnds S.G Q` and `e₂ ≠ u`. + have he₂_in_Q : e₂ ∈ V(Q) := hRb_le_Q.vertexSet_mono hRb.right_mem + have he₂_ends_Q : e₂ ∈ pathEnds S.G Q := by + by_contra he₂_not_end + have he₂_int : e₂ ∈ pathInternalVerts S.G Q := ⟨he₂_in_Q, he₂_not_end⟩ + exact disjoint_left.mp (hS.no_internal_in_bar Q hQ_in) he₂_int hP₁_ends.2.2.2 + have he₂_ne_u : e₂ ≠ u := fun h => + hu_bar_diff.2 (h ▸ hP₁_ends.mem_transactionEnds_right S hP₁_in) + have hQ_ends_e₂u : S.IsOmegaPathWithEnds Q e₂ u := by + rw [hQ_ends.1.pathEnds_eq, mem_insert_iff, mem_singleton_iff] at hu_ends_Q he₂_ends_Q + rcases he₂_ends_Q with rfl | rfl <;> rcases hu_ends_Q with rfl | rfl + · exact (he₂_ne_u rfl).elim + · exact hQ_ends + · exact hQ_ends.symm S + · exact (he₂_ne_u rfl).elim + -- `subgraphUnion S.G R_b P ≤ Q` has the same ends `e₂, u` as `Q`, so `Q = subgraphUnion S.G R_b + -- P`. + have hinter_RbP : V(R_b) ∩ V(P) = {s} := by + apply Subset.antisymm + · intro z ⟨hzRb, hzP⟩ + have hz_in : z ∈ V(P) ∩ V(P₁) := ⟨hzP, hRb_P₁.vertexSet_mono hzRb⟩ + rwa [hatt_su.inter_leg_eq_singleton S hP₁_in hb_sw_P₁] at hz_in + · rintro z rfl + exact ⟨hRb.left_mem, hatt_su.1.left_mem⟩ + have hRbP_path : IsGraphPathWithEnds S.G (subgraphUnion S.G R_b P) e₂ u := + (hRb.mono hP₁_le).symm.subgraphUnion hatt_su.1 hinter_RbP + have hRbP_le_Q : subgraphUnion S.G R_b P ≤ Q := + (subgraphUnion_le_iff hRb_le hP_le hQ_le).mpr ⟨hRb_le_Q, hPQ⟩ + have hQ_eq : subgraphUnion S.G R_b P = Q := + hQ_ends_e₂u.1.eq_of_le_of_same_ends hRbP_path hRbP_le_Q + -- Conclude `S.IsHalfCovered P_set Q`. + refine ⟨P₁, hP₁_in, ⟨s, hb_sw_P₁, hPQ.vertexSet_mono hatt_su.1.left_mem⟩, ?_, + e₂, e₁, e₂, u, s, hP₁_ends.symm S, hQ_ends_e₂u, rfl, hu_bar_diff.2, ?_⟩ + · intro P' hP'_in ⟨z, hzP', hzQ⟩ + rw [← hQ_eq, vertexSet_subgraphUnion] at hzQ + by_contra hne + rcases hzQ with hzRb | hzP + · exact disjoint_left.mp (hS.isFenceFor_P.1.2 hP'_in hP₁_in hne) + hzP' (hRb_P₁.vertexSet_mono hzRb) + · have hz_eq_s : z = s := by + have hzU : z ∈ V(P) ∩ V(S.transactionUnion P_set) := + ⟨hzP, mem_iUnion₂.mpr ⟨P', hP'_in, hzP'⟩⟩ + rwa [hatt_su.2.1, mem_singleton_iff] at hzU + subst hz_eq_s + exact disjoint_left.mp (hS.isFenceFor_P.1.2 hP'_in hP₁_in hne) hzP' hb_sw_P₁ + · have hinter_P₁Q : subgraphInter S.G P₁ Q = R_b := by + refine (Compatible.of_le_le (subgraphInter_le hP₁_le) hRb_le).ext ?_ ?_ + · rw [vertexSet_subgraphInter, ← hQ_eq, vertexSet_subgraphUnion] + ext z + simp only [mem_inter_iff, mem_union] + constructor + · rintro ⟨hzP₁, hzRb | hzP⟩ + · exact hzRb + · have hzs : z = s := by + have h_in : z ∈ V(P) ∩ V(P₁) := ⟨hzP, hzP₁⟩ + rwa [hatt_su.inter_leg_eq_singleton S hP₁_in hb_sw_P₁, mem_singleton_iff] at h_in + exact hzs ▸ hRb.left_mem + · intro hzRb + exact ⟨hRb_P₁.vertexSet_mono hzRb, Or.inl hzRb⟩ + · rw [edgeSet_subgraphInter hP₁_le hQ_le, ← hQ_eq, edgeSet_subgraphUnion hRb_le hP_le] + ext e + simp only [mem_inter_iff, mem_union] + constructor + · rintro ⟨heP₁, heRb | heP⟩ + · exact heRb + · have hdisj_EP₁P : Disjoint E(P₁) E(P) := + disjoint_edgeSet_of_inter_singleton (z := s) hP₁_ends.1 hP_le (by + rw [← hatt_su.inter_leg_eq_singleton S hP₁_in hb_sw_P₁, inter_comm]) + exact (disjoint_left.mp hdisj_EP₁P heP₁ heP).elim + · intro heRb + exact ⟨hRb_P₁.edgeSet_mono heRb, Or.inl heRb⟩ + rw [hinter_P₁Q] + exact (hRb.mono hP₁_le).symm + +/-- **Graph Minors IX, (4.3)** (page 50): +"Let* **S** *be true. For every $Q \in \mathscr{Q}$ except possibly one, either* (i) *$Q \cap +\bigcup \mathscr{P} = \emptyset$, or* (ii) *both ends of $Q$ are in $V(\mathscr{P})$, or* +(iii) *$Q$ meets exactly one member $P$ of $\mathscr{P}$, $P \cap Q$ is a path, and $P, Q$ +and $P \cap Q$ have a common end, and the other end of $Q$ is not in $V(\mathscr{P})$.* *If +(i), (ii), (iii) are all false for some $Q \in \mathscr{Q}$ then $\mathscr{P}$ has an +overpass." -/ +theorem theorem_4_3_proof {p : ℕ} {P_set Q_set : Set (Graph α β)} {A B : Set α} + (hS : S.StatementS p P_set Q_set A B) : + (∀ Q₁ ∈ Q_set, ∀ Q₂ ∈ Q_set, + ¬ (Disjoint V(Q₁) V(S.transactionUnion P_set) ∨ + pathEnds S.G Q₁ ⊆ S.transactionEnds P_set ∨ + S.IsHalfCovered P_set Q₁) → + ¬ (Disjoint V(Q₂) V(S.transactionUnion P_set) ∨ + pathEnds S.G Q₂ ⊆ S.transactionEnds P_set ∨ + S.IsHalfCovered P_set Q₂) → + Q₁ = Q₂) ∧ + (∀ Q ∈ Q_set, + ¬ (Disjoint V(Q) V(S.transactionUnion P_set) ∨ + pathEnds S.G Q ⊆ S.transactionEnds P_set ∨ + S.IsHalfCovered P_set Q) → + ∃ P₁ ∈ P_set, S.IsOverpass P_set P₁) := by + refine ⟨fun Q₁ hQ₁ Q₂ hQ₂ hnot₁ hnot₂ => ?_, fun Q hQ hnot => ?_⟩ + · push Not at hnot₁ hnot₂ + rw [not_disjoint_iff_nonempty_inter] at hnot₁ hnot₂ + obtain ⟨w₁, hw₁_ends, P₁, hcorr₁, hnot_exch₁⟩ := + S.exists_nonExchangeable_correspondingAttachment_of_not_4_3 hS hQ₁ + hnot₁.1 hnot₁.2.1 hnot₁.2.2 + obtain ⟨w₂, hw₂_ends, P₂, hcorr₂, hnot_exch₂⟩ := + S.exists_nonExchangeable_correspondingAttachment_of_not_4_3 hS hQ₂ + hnot₂.1 hnot₂.2.1 hnot₂.2.2 + by_contra hne + have hdisj_Q12 : Disjoint V(Q₁) V(Q₂) := + hS.isTransaction_Q.choose_spec.choose_spec.1.2 hQ₁ hQ₂ hne + have hw₁_V : w₁ ∈ V(Q₁) := by + rcases hw₁_ends with ⟨_, h⟩ + exact h.left_mem + have hw₂_V : w₂ ∈ V(Q₂) := by + rcases hw₂_ends with ⟨_, h⟩ + exact h.left_mem + have hw_ne : w₁ ≠ w₂ := fun h => disjoint_left.mp hdisj_Q12 hw₁_V (h ▸ hw₂_V) + obtain ⟨Q₀, hQ₀_in, hw₁_Q₀, hw₂_Q₀⟩ := + S.theorem_4_2_proof hS hw_ne hcorr₁ hcorr₂ hnot_exch₁ hnot_exch₂ + have hw₁_VQ₀ : w₁ ∈ V(Q₀) := by rcases hw₁_Q₀ with ⟨_, h⟩; exact h.left_mem + have hw₂_VQ₀ : w₂ ∈ V(Q₀) := by rcases hw₂_Q₀ with ⟨_, h⟩; exact h.left_mem + have hQ₀_eq_Q₁ : Q₀ = Q₁ := by + by_contra hne₁ + exact disjoint_left.mp + (hS.isTransaction_Q.choose_spec.choose_spec.1.2 hQ₀_in hQ₁ hne₁) hw₁_VQ₀ hw₁_V + have hQ₀_eq_Q₂ : Q₀ = Q₂ := by + by_contra hne₂ + exact disjoint_left.mp + (hS.isTransaction_Q.choose_spec.choose_spec.1.2 hQ₀_in hQ₂ hne₂) hw₂_VQ₀ hw₂_V + exact hne (hQ₀_eq_Q₁.symm.trans hQ₀_eq_Q₂) + · push Not at hnot + rw [not_disjoint_iff_nonempty_inter] at hnot + obtain ⟨w, _, P, hcorr, hnot_exch⟩ := + S.exists_nonExchangeable_correspondingAttachment_of_not_4_3 hS hQ + hnot.1 hnot.2.1 hnot.2.2 + rcases hcorr with ⟨_, _, _, _, _, s, hatt_sw⟩ + obtain ⟨_, P₁, hleg, hover⟩ := S.theorem_3_2_proof hS.isCrooked_P ⟨s, w, hatt_sw⟩ hnot_exch + exact ⟨P₁, hleg.1, hover⟩ + +end Society + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section4b.lean b/LeanPool/GraphMinor/GM09/Section4b.lean new file mode 100644 index 0000000000..7b4b232d16 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section4b.lean @@ -0,0 +1,941 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2a +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section3c +import LeanPool.GraphMinor.GM09.Section4a +import Mathlib.Data.Set.Card + +/-! +# Graph Minors IX, Section 4 (Part 2): Clockwise Orderings and (4.4) + +This file proves clockwise sequence and ordering lemmas for `CyclicPerm` and `AreInOrder`, +and proves (4.4) from Section 4 of +N. Robertson and P. D. Seymour, *Graph Minors. IX. Disjoint crossed paths*, +J. Combin. Theory Ser. B **49** (1990) 40–77 (pages 50–51). +-/ + +public section + +namespace GraphMinor.GM09 + +open Set Graph GraphMinor + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Clockwise sequences and intervals in cyclic permutations -/ + +namespace CyclicPerm + +variable (Ω : CyclicPerm α) + +/-- In a clockwise sequence `L`, stepping `d ≥ 1` positions along `L` from `L[i]` corresponds to +some `k ≥ 1` iterations of `Ω` such that any intermediate hit in `{v | v ∈ L}` is `L[(i + m) % n]` +for some `1 ≤ m < d`. -/ +theorem exists_iterate_step {L : List α} (h : Ω.IsClockwiseSeq L) + (i d : ℕ) (hi : i < L.length) (hd : 1 ≤ d) : + ∃ k : ℕ, 1 ≤ k ∧ + (Ω.toFun^[k]) (L[i]) = L[(i + d) % L.length]'(Nat.mod_lt _ (Nat.zero_lt_of_lt hi)) ∧ + ∀ j : ℕ, 1 ≤ j → j < k → (Ω.toFun^[j]) (L[i]) ∈ {v | v ∈ L} → + ∃ m : ℕ, 1 ≤ m ∧ m < d ∧ + (Ω.toFun^[j]) (L[i]) = L[(i + m) % L.length]'(Nat.mod_lt _ (Nat.zero_lt_of_lt hi)) := by + have hn_pos : 0 < L.length := Nat.zero_lt_of_lt hi + induction d with + | zero => omega + | succ d ih => + rcases Nat.eq_zero_or_pos d with rfl | hd_pos + · obtain ⟨k, hk1, hk_eq, _, hmin⟩ := h.2.2 i hi + refine ⟨k, hk1, hk_eq, fun j hj1 hjlt hjL => (hmin j hj1 hjlt hjL).elim⟩ + · obtain ⟨k₁, hk₁_pos, hk₁_eq, hk₁_min⟩ := ih hd_pos + let i' := (i + d) % L.length + have hi' : i' < L.length := Nat.mod_lt _ hn_pos + obtain ⟨k₂, hk₂_pos, hk₂_eq, _, hk₂_min⟩ := h.2.2 i' hi' + have hmod_eq : (i' + 1) % L.length = (i + (d + 1)) % L.length := by + simp [i', Nat.add_assoc] + refine ⟨k₁ + k₂, by omega, ?_, ?_⟩ + · rw [Nat.add_comm k₁ k₂, Function.iterate_add_apply, hk₁_eq, hk₂_eq] + congr 1 + · intro j hj1 hjlt hjL + rcases lt_trichotomy j k₁ with hj_lt | rfl | hj_gt + · obtain ⟨m, hm1, hmd, hm_eq⟩ := hk₁_min j hj1 hj_lt hjL + exact ⟨m, hm1, Nat.lt_succ_of_lt hmd, hm_eq⟩ + · exact ⟨d, hd_pos, Nat.lt_succ_self d, hk₁_eq⟩ + · exfalso + have hiter : (Ω.toFun^[j]) (L[i]) = (Ω.toFun^[j - k₁]) (L[i']) := by + have hj_eq : j = (j - k₁) + k₁ := (Nat.sub_add_cancel (le_of_lt hj_gt)).symm + conv_lhs => rw [hj_eq, Function.iterate_add_apply, hk₁_eq] + rw [hiter] at hjL + exact hk₂_min (j - k₁) (by omega) (by omega) hjL + +/-- If `L` is `Ω`-clockwise and `i₁ < i₂ < i₃ < L.length`, then `(L[i₁], L[i₂], L[i₃])` is +`Ω`-clockwise, so `L[i₂] ∈ Ω.interval L[i₁] L[i₃]`. -/ +theorem mem_interval_of_lt {L : List α} (h : Ω.IsClockwiseSeq L) + {i₁ i₂ i₃ : ℕ} (h12 : i₁ < i₂) (h23 : i₂ < i₃) (h3 : i₃ < L.length) : + L[i₂]'(Nat.lt_trans h23 h3) ∈ + Ω.interval (L[i₁]'(Nat.lt_trans h12 (Nat.lt_trans h23 h3))) (L[i₃]'h3) := by + have h1 : i₁ < L.length := Nat.lt_trans h12 (Nat.lt_trans h23 h3) + have h2 : i₂ < L.length := Nat.lt_trans h23 h3 + have hn_pos : 0 < L.length := Nat.zero_lt_of_lt h1 + let v₁ := L[i₁]'h1 + let v₂ := L[i₂]'h2 + let v₃ := L[i₃]'h3 + have hv₁ : v₁ ∈ Ω.bar := h.2.1 v₁ (List.getElem_mem h1) + have hv₂ : v₂ ∈ Ω.bar := h.2.1 v₂ (List.getElem_mem h2) + have hv₃ : v₃ ∈ Ω.bar := h.2.1 v₃ (List.getElem_mem h3) + have hne12 : v₁ ≠ v₂ := fun heq => Nat.ne_of_lt h12 (( List.Nodup.getElem_inj_iff h.1 ).mp heq) + have hne23 : v₂ ≠ v₃ := fun heq => Nat.ne_of_lt h23 (( List.Nodup.getElem_inj_iff h.1 ).mp heq) + have hne13 : v₁ ≠ v₃ := fun heq => + Nat.ne_of_lt (Nat.lt_trans h12 h23) (( List.Nodup.getElem_inj_iff h.1 ).mp heq) + -- Show `FirstHitIn {v₁, v₂, v₃} v₁ v₂`. + have hhit12 : Ω.FirstHitIn {v₁, v₂, v₃} v₁ v₂ := by + obtain ⟨k, hk1, hk_eq, hk_min⟩ := Ω.exists_iterate_step h i₁ (i₂ - i₁) h1 (by omega) + have hmod : (i₁ + (i₂ - i₁)) % L.length = i₂ := by + rw [Nat.add_sub_of_le (le_of_lt h12), Nat.mod_eq_of_lt h2] + have hk_v₂ : (Ω.toFun^[k]) v₁ = v₂ := by + rw [hk_eq]; congr 1 + refine ⟨k, hk1, hk_v₂, by simp, fun j hj1 hjlt hj_in => ?_⟩ + have hjL : (Ω.toFun^[j]) v₁ ∈ {v | v ∈ L} := by + rcases hj_in with heq | heq | heq + · rw [heq]; exact List.getElem_mem h1 + · rw [heq]; exact List.getElem_mem h2 + · rw [heq]; exact List.getElem_mem h3 + obtain ⟨m, hm1, hmd, hm_eq⟩ := hk_min j hj1 hjlt hjL + have hm_lt : i₁ + m < L.length := by omega + have hm_mod : (i₁ + m) % L.length = i₁ + m := Nat.mod_eq_of_lt hm_lt + have hm_elem : (Ω.toFun^[j]) v₁ = L[i₁ + m]'hm_lt := by + rw [hm_eq]; congr 1 + rw [hm_elem] at hj_in + rcases hj_in with heq | heq | heq + · have := (List.Nodup.getElem_inj_iff h.1).mp heq; omega + · have := (List.Nodup.getElem_inj_iff h.1).mp heq; omega + · have := (List.Nodup.getElem_inj_iff h.1).mp heq; omega + -- Show `FirstHitIn {v₁, v₂, v₃} v₂ v₃`. + have hhit23 : Ω.FirstHitIn {v₁, v₂, v₃} v₂ v₃ := by + obtain ⟨k, hk1, hk_eq, hk_min⟩ := Ω.exists_iterate_step h i₂ (i₃ - i₂) h2 (by omega) + have hmod : (i₂ + (i₃ - i₂)) % L.length = i₃ := by + rw [Nat.add_sub_of_le (le_of_lt h23), Nat.mod_eq_of_lt h3] + have hk_v₃ : (Ω.toFun^[k]) v₂ = v₃ := by + rw [hk_eq]; congr 1 + refine ⟨k, hk1, hk_v₃, by simp, fun j hj1 hjlt hj_in => ?_⟩ + have hjL : (Ω.toFun^[j]) v₂ ∈ {v | v ∈ L} := by + rcases hj_in with heq | heq | heq + · rw [heq]; exact List.getElem_mem h1 + · rw [heq]; exact List.getElem_mem h2 + · rw [heq]; exact List.getElem_mem h3 + obtain ⟨m, hm1, hmd, hm_eq⟩ := hk_min j hj1 hjlt hjL + have hm_lt : i₂ + m < L.length := by omega + have hm_mod : (i₂ + m) % L.length = i₂ + m := Nat.mod_eq_of_lt hm_lt + have hm_elem : (Ω.toFun^[j]) v₂ = L[i₂ + m]'hm_lt := by + rw [hm_eq]; congr 1 + rw [hm_elem] at hj_in + rcases hj_in with heq | heq | heq + · have := (List.Nodup.getElem_inj_iff h.1).mp heq; omega + · have := (List.Nodup.getElem_inj_iff h.1).mp heq; omega + · have := (List.Nodup.getElem_inj_iff h.1).mp heq; omega + -- Show `FirstHitIn {v₁, v₂, v₃} v₃ v₁`. + have hhit31 : Ω.FirstHitIn {v₁, v₂, v₃} v₃ v₁ := by + obtain ⟨k, hk1, hk_eq, hk_min⟩ := + Ω.exists_iterate_step h i₃ (L.length + i₁ - i₃) h3 (by omega) + have hmod : (i₃ + (L.length + i₁ - i₃)) % L.length = i₁ := by + have h_add : i₃ + (L.length + i₁ - i₃) = L.length + i₁ := by omega + rw [h_add, Nat.add_mod_left, Nat.mod_eq_of_lt h1] + have hk_v₁ : (Ω.toFun^[k]) v₃ = v₁ := by + rw [hk_eq]; congr 1 + refine ⟨k, hk1, hk_v₁, by simp, fun j hj1 hjlt hj_in => ?_⟩ + have hjL : (Ω.toFun^[j]) v₃ ∈ {v | v ∈ L} := by + rcases hj_in with heq | heq | heq + · rw [heq]; exact List.getElem_mem h1 + · rw [heq]; exact List.getElem_mem h2 + · rw [heq]; exact List.getElem_mem h3 + obtain ⟨m, hm1, hmd, hm_eq⟩ := hk_min j hj1 hjlt hjL + rw [hm_eq] at hj_in + have hmod_ne : (i₃ + m) % L.length ≠ i₁ ∧ (i₃ + m) % L.length ≠ i₂ ∧ (i₃ + m) % L.length ≠ i₃ + := by + by_cases hlt_len : i₃ + m < L.length + · rw [Nat.mod_eq_of_lt hlt_len] + omega + · have h_sub : (i₃ + m) % L.length = i₃ + m - L.length := by + have h_eq : i₃ + m = L.length + (i₃ + m - L.length) := by omega + conv_lhs => rw [h_eq] + rw [Nat.add_mod_left, Nat.mod_eq_of_lt (by omega)] + rw [h_sub] + omega + rcases hj_in with heq | heq | heq + · exact hmod_ne.1 ((List.Nodup.getElem_inj_iff h.1).mp heq) + · exact hmod_ne.2.1 ((List.Nodup.getElem_inj_iff h.1).mp heq) + · exact hmod_ne.2.2 ((List.Nodup.getElem_inj_iff h.1).mp heq) + refine ⟨⟨hv₂, ?_⟩, Ω.isClockwise3_iff.mpr ⟨hne12, hne13, hne23, hv₁, hv₂, hv₃, hhit12, hhit23, + hhit31⟩⟩ + simp only [mem_insert_iff, mem_singleton_iff, not_or] + exact ⟨hne12.symm, hne23⟩ + +/-- Every nonempty subset `W ⊆ Ω.bar` has a clockwise enumeration `L` starting at any given +`w₀ ∈ W`. -/ +theorem exists_isClockwiseSeq_of_subset_bar {W : Set α} (hW_bar : W ⊆ Ω.bar) + {w₀ : α} (hw₀ : w₀ ∈ W) : + ∃ L : List α, + L.length = W.ncard ∧ + {v | v ∈ L} = W ∧ + (∀ (h0 : 0 < L.length), L[0]'h0 = w₀) ∧ + Ω.IsClockwiseSeq L := by + classical + have hW_fin : W.Finite := Ω.finite_bar.subset hW_bar + have hne : (Ω.bar ∩ W).Nonempty := ⟨w₀, hW_bar hw₀, hw₀⟩ + let nextW (x : α) : α := + if hx : x ∈ Ω.bar then (Ω.exists_firstHitIn hx hne).choose else x + have hnext_spec : ∀ {x : α}, x ∈ Ω.bar → Ω.FirstHitIn W x (nextW x) := by + intro x hx + simp only [nextW, hx, ↓reduceDIte] + exact (Ω.exists_firstHitIn hx hne).choose_spec + have hnext_mem : ∀ {x : α}, x ∈ W → nextW x ∈ W := fun hx => + (hnext_spec (hW_bar hx)).mem_set + have hiter_mem : ∀ (m : ℕ) {x : α}, x ∈ W → (nextW^[m]) x ∈ W := by + intro m + induction m with + | zero => intro x hx; exact hx + | succ m ih => + intro x hx + rw [Function.iterate_succ_apply'] + exact hnext_mem (ih hx) + have hnext_inj : Set.InjOn nextW W := by + intro x₁ hx₁ x₂ hx₂ heq + have h₁ := hnext_spec (hW_bar hx₁) + have h₂ := hnext_spec (hW_bar hx₂) + rw [heq] at h₁ + exact h₁.inj_left (hW_bar hx₁) (hW_bar hx₂) hx₁ hx₂ h₂ + have hiter_inj : ∀ m : ℕ, Set.InjOn (nextW^[m]) W := by + intro m + induction m with + | zero => exact Set.injOn_id W + | succ m ih => + intro x₁ hx₁ x₂ hx₂ heq + rw [Function.iterate_succ_apply', Function.iterate_succ_apply'] at heq + exact ih hx₁ hx₂ (hnext_inj (hiter_mem m hx₁) (hiter_mem m hx₂) heq) + -- Every `z ∈ W` is reachable from `w₀` by iterating `nextW`. + have hreach_aux : ∀ (K : ℕ) {x z : α}, x ∈ W → z ∈ W → (Ω.toFun^[K]) x = z → + ∃ m : ℕ, (nextW^[m]) x = z := by + intro K + induction K using Nat.strong_induction_on with + | ind K ih => + intro x z hx hz hK + rcases Nat.eq_zero_or_pos K with rfl | hK_pos + · exact ⟨0, hK⟩ + · obtain ⟨k₁, hk₁_pos, hk₁_eq, _, hk₁_min⟩ := hnext_spec (hW_bar hx) + have hk₁_le : k₁ ≤ K := by + by_contra hgt + exact hk₁_min K hK_pos (by omega) (hK ▸ hz) + have hrem : (Ω.toFun^[K - k₁]) (nextW x) = z := by + have hiter : (Ω.toFun^[k₁]) ((Ω.toFun^[K - k₁]) (nextW x)) = (Ω.toFun^[k₁]) z := by + rw [← hk₁_eq] + simp only [← Function.iterate_add_apply] + rw [Nat.sub_add_cancel hk₁_le, Function.iterate_add_apply, hK] + exact Ω.injOn_iterate k₁ (Ω.iterate_mem (K - k₁) (hW_bar (hnext_mem hx))) + (hW_bar hz) hiter + obtain ⟨m, hm⟩ := ih (K - k₁) (by omega) (hnext_mem hx) hz hrem + refine ⟨m + 1, ?_⟩ + rw [Function.iterate_succ_apply, hm] + have hreach : ∀ z ∈ W, ∃ m : ℕ, (nextW^[m]) w₀ = z := by + intro z hz + obtain ⟨K, hK⟩ := Ω.single_orbit w₀ (hW_bar hw₀) z (hW_bar hz) + exact hreach_aux K hw₀ hz hK + let n := W.ncard + have hn_pos : 0 < n := Set.ncard_pos hW_fin |>.mpr ⟨w₀, hw₀⟩ + let L := (List.range n).map (fun i => (nextW^[i]) w₀) + have hL_len : L.length = n := by simp [L] + have hL_get : ∀ (i : ℕ) (hi : i < L.length), L[i]'hi = (nextW^[i]) w₀ := by + intro i hi + simp [L] + have hL_sub_W : {v | v ∈ L} ⊆ W := by + intro v hv + simp only [L, mem_ofPred_eq, List.mem_map, List.mem_range] at hv + rcases hv with ⟨i, _, rfl⟩ + exact hiter_mem i hw₀ + -- If `(nextW^[d]) w₀ = w₀` for `1 ≤ d`, then `n ≤ d`. + have hperiod_ge : ∀ d : ℕ, 1 ≤ d → (nextW^[d]) w₀ = w₀ → n ≤ d := by + intro d hd1 hd_eq + have hmul : ∀ q : ℕ, (nextW^[d * q]) w₀ = w₀ := by + intro q + induction q with + | zero => rfl + | succ q ih => + rw [Nat.mul_succ, add_comm, Function.iterate_add_apply, ih, hd_eq] + let Ld := (List.range d).map (fun r => (nextW^[r]) w₀) + have hW_sub_Ld : W ⊆ {v | v ∈ Ld} := by + intro z hz + obtain ⟨m, rfl⟩ := hreach z hz + have hm_eq : (nextW^[m]) w₀ = (nextW^[m % d]) w₀ := by + conv_lhs => rw [← Nat.div_add_mod m d, add_comm] + rw [Function.iterate_add_apply, hmul] + rw [hm_eq] + simp only [Ld, mem_ofPred_eq, List.mem_map, List.mem_range] + exact ⟨m % d, Nat.mod_lt m hd1, rfl⟩ + have hLd_fin : {v | v ∈ Ld}.Finite := Ld.toFinset.finite_toSet.subset (fun _ hx + => List.mem_toFinset.mpr hx) + have hcard_le : n ≤ {v | v ∈ Ld}.ncard := Set.ncard_le_ncard hW_sub_Ld hLd_fin + have hLd_eq : {v | v ∈ Ld} = (Ld.toFinset : Set α) := by ext x; simp + have hLd_card : {v | v ∈ Ld}.ncard ≤ d := by + rw [hLd_eq, Set.ncard_coe_finset] + exact (List.toFinset_card_le Ld).trans (by simp [Ld]) + exact hcard_le.trans hLd_card + have hL_nodup : L.Nodup := by + rw [List.nodup_iff_injective_getElem] + intro ⟨i, hi⟩ ⟨j, hj⟩ hij + simp only [Fin.mk.injEq] + dsimp only at hij + rw [hL_get i hi, hL_get j hj] at hij + rcases lt_trichotomy i j with hlt | rfl | hgt + · exfalso + have heq_d : (nextW^[j - i]) w₀ = w₀ := by + have hiter : (nextW^[i]) ((nextW^[j - i]) w₀) = (nextW^[i]) w₀ := by + rw [← Function.iterate_add_apply, Nat.add_sub_of_le (le_of_lt hlt), hij] + exact hiter_inj i (hiter_mem (j - i) hw₀) hw₀ hiter + have hge := hperiod_ge (j - i) (by omega) heq_d + omega + · rfl + · exfalso + have heq_d : (nextW^[i - j]) w₀ = w₀ := by + have hiter : (nextW^[j]) ((nextW^[i - j]) w₀) = (nextW^[j]) w₀ := by + rw [← Function.iterate_add_apply, Nat.add_sub_of_le (le_of_lt hgt), ← hij] + exact hiter_inj j (hiter_mem (i - j) hw₀) hw₀ hiter + have hge := hperiod_ge (i - j) (by omega) heq_d + omega + have hL_ncard : {v | v ∈ L}.ncard = n := by + have h_eq : {v | v ∈ L} = (L.toFinset : Set α) := by ext x; simp + rw [h_eq, Set.ncard_coe_finset, List.card_toFinset, List.dedup_eq_self.mpr hL_nodup, hL_len] + have hL_eq_W : {v | v ∈ L} = W := + Set.eq_of_subset_of_ncard_le hL_sub_W (by rw [hL_ncard]) hW_fin + have hn_eq_w₀ : (nextW^[n]) w₀ = w₀ := by + have hn_in_L : (nextW^[n]) w₀ ∈ {v | v ∈ L} := by + rw [hL_eq_W] + exact hiter_mem n hw₀ + simp only [L, mem_ofPred_eq, List.mem_map, List.mem_range] at hn_in_L + rcases hn_in_L with ⟨i, hi, hi_eq⟩ + rcases Nat.eq_zero_or_pos i with rfl | hi_pos + · exact hi_eq.symm + · exfalso + have heq_d : (nextW^[n - i]) w₀ = w₀ := by + have hiter : (nextW^[i]) ((nextW^[n - i]) w₀) = (nextW^[i]) w₀ := by + rw [← Function.iterate_add_apply, Nat.add_sub_of_le (le_of_lt hi), ← hi_eq] + exact hiter_inj i (hiter_mem (n - i) hw₀) hw₀ hiter + have hge := hperiod_ge (n - i) (by omega) heq_d + omega + refine ⟨L, hL_len, hL_eq_W, fun h0 => by simp [L], hL_nodup, ?_, ?_⟩ + · intro v hv + exact hW_bar (hL_sub_W hv) + · intro i hi + rw [hL_eq_W, hL_get i hi, hL_get ((i + 1) % L.length) (Nat.mod_lt _ (by omega))] + rw [hL_len] at hi ⊢ + by_cases hlt : i + 1 < n + · rw [Nat.mod_eq_of_lt hlt, Function.iterate_succ_apply'] + exact hnext_spec (hW_bar (hiter_mem i hw₀)) + · have hi_eq : i + 1 = n := by omega + have h_rhs : (nextW^[(i + 1) % n]) w₀ = nextW ((nextW^[i]) w₀) := by + conv_lhs => rw [hi_eq, Nat.mod_self, Function.iterate_zero_apply, ← hn_eq_w₀, ← hi_eq, + Function.iterate_succ_apply'] + rw [h_rhs] + exact hnext_spec (hW_bar (hiter_mem i hw₀)) + +end CyclicPerm + +/-! ## Ordering non-crossing transactions and `AreInOrder` properties -/ + +namespace Society + +variable (S : Society α β) + +/-- If `[Q₁, Q₂, Q₃]` are in order with ends `a_i, b_i` (`i = 1, 2, 3`) such that +`[a₃, a₂, a₁, b₁, b₂, b₃]` is clockwise, then `a₁, b₁ ∈ S.Ω.interval a₂ b₂` and +`a₃, b₃ ∈ S.Ω.interval b₂ a₂`. -/ +theorem mem_intervals_of_isClockwiseSeq_six {a₁ a₂ a₃ b₁ b₂ b₃ : α} + (h : S.Ω.IsClockwiseSeq [a₃, a₂, a₁, b₁, b₂, b₃]) : + a₁ ∈ S.Ω.interval a₂ b₂ ∧ b₁ ∈ S.Ω.interval a₂ b₂ ∧ + a₃ ∈ S.Ω.interval b₂ a₂ ∧ b₃ ∈ S.Ω.interval b₂ a₂ := by + have hlen4 : 4 < [a₃, a₂, a₁, b₁, b₂, b₃].length := by simp + have hlen5 : 5 < [a₃, a₂, a₁, b₁, b₂, b₃].length := by simp + have ha₁ : a₁ ∈ S.Ω.interval a₂ b₂ := + S.Ω.mem_interval_of_lt h (i₁ := 1) (i₂ := 2) (i₃ := 4) (by decide) (by decide) hlen4 + have hb₁ : b₁ ∈ S.Ω.interval a₂ b₂ := + S.Ω.mem_interval_of_lt h (i₁ := 1) (i₂ := 3) (i₃ := 4) (by decide) (by decide) hlen4 + have ha₂_in : a₂ ∈ S.Ω.interval a₃ b₂ := + S.Ω.mem_interval_of_lt h (i₁ := 0) (i₂ := 1) (i₃ := 4) (by decide) (by decide) hlen4 + have hb₂_in : b₂ ∈ S.Ω.interval a₂ b₃ := + S.Ω.mem_interval_of_lt h (i₁ := 1) (i₂ := 4) (i₃ := 5) (by decide) (by decide) hlen5 + exact ⟨ha₁, hb₁, S.Ω.mem_interval_rotate_right ha₂_in, S.Ω.mem_interval_rotate_left hb₂_in⟩ + +/-- In a fence `(A, B)` for `P_set`, `(A ∩ S.transactionEnds P_set).ncard = P_set.ncard` and +`(B ∩ S.transactionEnds P_set).ncard = P_set.ncard` and +`(S.transactionEnds P_set).ncard = 2 * P_set.ncard`. -/ +theorem IsFenceFor.ncard_transactionEnds {P_set : Set (Graph α β)} {A B : Set α} + (hfence : S.IsFenceFor P_set A B) : + (A ∩ S.transactionEnds P_set).ncard = P_set.ncard ∧ + (B ∩ S.transactionEnds P_set).ncard = P_set.ncard ∧ + (S.transactionEnds P_set).ncard = 2 * P_set.ncard := by + classical + by_cases hP_ne : P_set.Nonempty + · obtain ⟨P₀, hP₀_in⟩ := hP_ne + obtain ⟨a₀, _, b₀, _, _⟩ := hfence.2.2 P₀ hP₀_in + let endA (P : Graph α β) : α := + if hP : P ∈ P_set then (hfence.2.2 P hP).choose else a₀ + let endB (P : Graph α β) : α := + if hP : P ∈ P_set then (hfence.2.2 P hP).choose_spec.2.choose else b₀ + have hend_spec : ∀ {P : Graph α β}, P ∈ P_set → + endA P ∈ A ∧ endB P ∈ B ∧ S.IsOmegaPathWithEnds P (endA P) (endB P) := by + intro P hP + simp only [endA, endB, hP, ↓reduceDIte] + exact ⟨(hfence.2.2 P hP).choose_spec.1, + (hfence.2.2 P hP).choose_spec.2.choose_spec.1, + (hfence.2.2 P hP).choose_spec.2.choose_spec.2⟩ + have hA_eq : A ∩ S.transactionEnds P_set = endA '' P_set := by + ext x + simp only [mem_inter_iff, mem_image] + constructor + · rintro ⟨hxA, P, hP_in, y, hxy⟩ + refine ⟨P, hP_in, ?_⟩ + obtain ⟨_, hbB, hP_ends⟩ := hend_spec hP_in + rcases hP_ends.ends_eq S hxy with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · exact (disjoint_left.mp hfence.2.1.2.2.1 hxA hbB).elim + · rintro ⟨P, hP_in, rfl⟩ + obtain ⟨haA, _, hP_ends⟩ := hend_spec hP_in + exact ⟨haA, hP_ends.mem_transactionEnds_left S hP_in⟩ + have hB_eq : B ∩ S.transactionEnds P_set = endB '' P_set := by + ext x + simp only [mem_inter_iff, mem_image] + constructor + · rintro ⟨hxB, P, hP_in, y, hxy⟩ + refine ⟨P, hP_in, ?_⟩ + obtain ⟨haA, _, hP_ends⟩ := hend_spec hP_in + rcases hP_ends.ends_eq S hxy with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact (disjoint_left.mp hfence.2.1.2.2.1 haA hxB).elim + · rfl + · rintro ⟨P, hP_in, rfl⟩ + obtain ⟨_, hbB, hP_ends⟩ := hend_spec hP_in + exact ⟨hbB, hP_ends.mem_transactionEnds_right S hP_in⟩ + have hinj_A : Set.InjOn endA P_set := by + intro P₁ hP₁ P₂ hP₂ heq + by_contra hne + exact disjoint_left.mp (hfence.1.2 hP₁ hP₂ hne) + (hend_spec hP₁).2.2.1.left_mem (heq ▸ (hend_spec hP₂).2.2.1.left_mem) + have hinj_B : Set.InjOn endB P_set := by + intro P₁ hP₁ P₂ hP₂ heq + by_contra hne + exact disjoint_left.mp (hfence.1.2 hP₁ hP₂ hne) + (hend_spec hP₁).2.2.1.right_mem (heq ▸ (hend_spec hP₂).2.2.1.right_mem) + have hncard_A : (A ∩ S.transactionEnds P_set).ncard = P_set.ncard := by + rw [hA_eq, hinj_A.ncard_image] + have hncard_B : (B ∩ S.transactionEnds P_set).ncard = P_set.ncard := by + rw [hB_eq, hinj_B.ncard_image] + have hW_union : (A ∩ S.transactionEnds P_set) ∪ (B ∩ S.transactionEnds P_set) = + S.transactionEnds P_set := by + rw [← union_inter_distrib_right, hfence.2.1.2.2.2.1, + inter_eq_self_of_subset_right (S.transactionEnds_subset_bar P_set)] + have hdisj_AB : Disjoint (A ∩ S.transactionEnds P_set) (B ∩ S.transactionEnds P_set) := + hfence.2.1.2.2.1.mono inter_subset_left inter_subset_left + have hfin_W : (S.transactionEnds P_set).Finite := + S.Ω.finite_bar.subset (S.transactionEnds_subset_bar P_set) + have hncard_W : (S.transactionEnds P_set).ncard = 2 * P_set.ncard := by + rw [← hW_union, Set.ncard_union_eq hdisj_AB (hfin_W.subset inter_subset_right) + (hfin_W.subset inter_subset_right), hncard_A, hncard_B, two_mul] + exact ⟨hncard_A, hncard_B, hncard_W⟩ + · have hP_empty : P_set = ∅ := Set.not_nonempty_iff_eq_empty.mp hP_ne + subst hP_empty + have hW_empty : S.transactionEnds ∅ = ∅ := by + ext x; simp [transactionEnds] + simp [hW_empty] + +/-- A clockwise list of transaction ends starts in the first fence side and ends in the second. -/ +theorem transaction_end_list_partitions_fence {F : Set (Graph α β)} {A B : Set α} + (hfence : S.IsFenceFor F A B) {b_k a_k : α} {L : List α} + (hk_pos : 0 < F.ncard) (hL_len : L.length = 2 * F.ncard) (hL_cw : S.Ω.IsClockwiseSeq L) + (hL_0 : ∀ h0 : 0 < L.length, L[0]'h0 = a_k) : + let W := S.transactionEnds F + {v | v ∈ L} = W → + b_k ∈ B ∩ W → a_k ∈ A ∩ W → Disjoint (S.Ω.interval b_k a_k) W → + L[2 * F.ncard - 1]'(by omega) = b_k ∧ + (∀ (i : ℕ) (hi : i < L.length), i < F.ncard → L[i]'hi ∈ A) ∧ + (∀ (i : ℕ) (hi : i < L.length), F.ncard ≤ i → L[i]'hi ∈ B) := by + classical + intro W hL_set hb_k ha_k hd_bk_ak + let k := F.ncard + have hW_bar : W ⊆ S.Ω.bar := S.transactionEnds_subset_bar F + obtain ⟨hncard_A, hncard_B, _⟩ := hfence.ncard_transactionEnds S + have h2k_pos : 0 < L.length := by omega + -- Show `L[2 * k - 1] = b_k`. + have hL_last : L[2 * k - 1]'(by omega) = b_k := by + have hhit_last : S.Ω.FirstHitIn W (L[2 * k - 1]'(by omega)) a_k := by + have h := hL_cw.2.2 (2 * k - 1) (by omega) + have hmod : (2 * k - 1 + 1) % L.length = 0 := by + rw [hL_len, Nat.sub_add_cancel (by omega), Nat.mod_self] + rw [hL_set] at h + simpa [hmod, hL_0 h2k_pos] using h + have hbk_ne_ak : b_k ≠ a_k := + fun h => disjoint_left.mp hfence.2.1.2.2.1 ha_k.1 (h ▸ hb_k.1) + have hhit_bk : S.Ω.FirstHitIn W b_k a_k := + (S.Ω.firstHitIn_iff_disjoint_interval hW_bar hb_k.2 ha_k.2 hbk_ne_ak).mpr + hd_bk_ak + have hlast_W : L[2 * k - 1]'(by omega) ∈ W := by + rw [← hL_set]; exact List.getElem_mem (by omega) + exact hhit_last.inj_left (hW_bar hlast_W) (hW_bar hb_k.2) hlast_W hb_k.2 hhit_bk + -- No `B`-element can precede an `A`-element in `L`. + have hno_BA : ∀ (i j : ℕ) (hi : i < L.length) (hj : j < L.length), + i < j → L[i]'hi ∈ B → L[j]'hj ∈ A → False := by + intro i j hi hj hij hLiB hLjA + have hi_gt : 0 < i := by + rcases Nat.eq_zero_or_pos i with rfl | hpos + · rw [hL_0 h2k_pos] at hLiB + exact (disjoint_left.mp hfence.2.1.2.2.1 ha_k.1 hLiB).elim + · exact hpos + have hj_lt : j < 2 * k - 1 := by + by_contra hge + have hj_eq : j = 2 * k - 1 := by omega + subst hj_eq + rw [hL_last] at hLjA + exact disjoint_left.mp hfence.2.1.2.2.1 hLjA hb_k.1 + have hLi_in : L[i]'hi ∈ S.Ω.interval a_k (L[j]'hj) := by + have h := S.Ω.mem_interval_of_lt hL_cw hi_gt hij hj + simpa [hL_0 h2k_pos] using h + have hLj_in : L[j]'hj ∈ S.Ω.interval a_k b_k := by + have h := S.Ω.mem_interval_of_lt hL_cw (Nat.lt_trans hi_gt hij) hj_lt (by omega) + simpa [hL_0 h2k_pos, hL_last] using h + have hbk_in : b_k ∈ S.Ω.interval (L[j]'hj) a_k := S.Ω.mem_interval_rotate_left hLj_in + have hcr : S.Ω.Crosses a_k (L[j]'hj) (L[i]'hi) b_k := + S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hLi_in, hbk_in⟩) + exact hfence.2.1.2.2.2.2 a_k ha_k.1 (L[j]'hj) hLjA + (fun h => by + have h0j : L[0]'h2k_pos = L[j]'hj := (hL_0 h2k_pos).trans h + have := (List.Nodup.getElem_inj_iff hL_cw.1).mp h0j + omega) + (L[i]'hi) hLiB b_k hb_k.1 + (fun h => by + have hij' : L[i]'hi = L[2 * k - 1]'(by omega) := h.trans hL_last.symm + have := (List.Nodup.getElem_inj_iff hL_cw.1).mp hij' + omega) + hcr + -- Deduce `L[i] ∈ A` for `i < k` and `L[i] ∈ B` for `k ≤ i < 2 * k`. + have hL_A : ∀ (i : ℕ) (hi : i < L.length), i < k → L[i]'hi ∈ A := by + intro i hi hik + have hLi_W : L[i]'hi ∈ W := by rw [← hL_set]; exact List.getElem_mem hi + have hLi_AB : L[i]'hi ∈ A ∪ B := by rw [hfence.2.1.2.2.2.1]; exact hW_bar hLi_W + rcases hLi_AB with hA | hB + · exact hA + · exfalso + have hsub : A ∩ W ⊆ {v | v ∈ L.take i} := by + intro x ⟨hxA, hxW⟩ + rw [← hL_set] at hxW + obtain ⟨j, hj, rfl⟩ := List.getElem_of_mem hxW + have hji : j < i := by + by_contra hge + rcases eq_or_lt_of_le (Nat.le_of_not_lt hge) with rfl | hgt + · exact disjoint_left.mp hfence.2.1.2.2.1 hxA hB + · exact hno_BA i j hi hj hgt hB hxA + rw [mem_ofPred_eq, List.mem_take_iff_getElem] + exact ⟨j, by omega, rfl⟩ + have hfin_take : {v | v ∈ L.take i}.Finite := + (L.take i).toFinset.finite_toSet.subset (fun _ hx => List.mem_toFinset.mpr hx) + have hle1 : k ≤ {v | v ∈ L.take i}.ncard := by + change F.ncard ≤ _ + rw [← hncard_A] + exact Set.ncard_le_ncard hsub hfin_take + have h_eq : {v | v ∈ L.take i} = ((L.take i).toFinset : Set α) := by ext x; simp + have hle2 : {v | v ∈ L.take i}.ncard ≤ i := by + rw [h_eq, Set.ncard_coe_finset] + exact (List.toFinset_card_le (L.take i)).trans (by simp [Nat.le_of_lt hi]) + omega + have hL_B : ∀ (i : ℕ) (hi : i < L.length), k ≤ i → L[i]'hi ∈ B := by + intro i hi hki + have hLi_W : L[i]'hi ∈ W := by rw [← hL_set]; exact List.getElem_mem hi + have hLi_AB : L[i]'hi ∈ A ∪ B := by rw [hfence.2.1.2.2.2.1]; exact hW_bar hLi_W + rcases hLi_AB with hA | hB + · exfalso + have hsub : B ∩ W ⊆ {v | v ∈ L.drop (i + 1)} := by + intro x ⟨hxB, hxW⟩ + rw [← hL_set] at hxW + obtain ⟨j, hj, rfl⟩ := List.getElem_of_mem hxW + have hij : i < j := by + by_contra hle + rcases eq_or_lt_of_le (Nat.le_of_not_lt hle) with rfl | hlt + · exact disjoint_left.mp hfence.2.1.2.2.1 hA hxB + · exact hno_BA j i hj hi hlt hxB hA + rw [mem_ofPred_eq, List.mem_iff_getElem] + refine ⟨j - (i + 1), by simp; omega, ?_⟩ + simp [Nat.add_sub_of_le (by omega : i + 1 ≤ j)] + have hfin_drop : {v | v ∈ L.drop (i + 1)}.Finite := + (L.drop (i + 1)).toFinset.finite_toSet.subset (fun _ hx => List.mem_toFinset.mpr hx) + have hle1 : k ≤ {v | v ∈ L.drop (i + 1)}.ncard := by + change F.ncard ≤ _ + rw [← hncard_B] + exact Set.ncard_le_ncard hsub hfin_drop + have h_eq : {v | v ∈ L.drop (i + 1)} = ((L.drop (i + 1)).toFinset : Set α) := by ext x; simp + have hle2 : {v | v ∈ L.drop (i + 1)}.ncard ≤ L.length - (i + 1) := by + rw [h_eq, Set.ncard_coe_finset] + exact (List.toFinset_card_le (L.drop (i + 1))).trans (by simp) + omega + · exact hB + exact ⟨hL_last, hL_A, hL_B⟩ + +/-- Every transaction `F` in which no two members cross can be enumerated as a list `Q` of length +`F.ncard` with `{P | P ∈ Q} = F` and `S.AreInOrder Q`. -/ +theorem IsTransaction.exists_areInOrder_of_not_cross {F : Set (Graph α β)} + (htrans : S.IsTransaction F) + (hno_cross : ∀ P₁ ∈ F, ∀ P₂ ∈ F, ¬ S.OmegaPathsCross P₁ P₂) : + ∃ Q : List (Graph α β), + Q.length = F.ncard ∧ + Q.Nodup ∧ + {P | P ∈ Q} = F ∧ + S.AreInOrder Q := by + classical + by_cases hF_ne : F.Nonempty + · obtain ⟨A, B, hfence⟩ := htrans + let W := S.transactionEnds F + have hW_bar : W ⊆ S.Ω.bar := S.transactionEnds_subset_bar F + obtain ⟨_, _, hncard_W⟩ := hfence.ncard_transactionEnds S + let k := F.ncard + have hfin_F : F.Finite := hfence.1.finite S + have hk_pos : 0 < k := Set.ncard_pos hfin_F |>.mpr hF_ne + obtain ⟨P₀, hP₀_in⟩ := hF_ne + obtain ⟨a₀, ha₀A, b₀, hb₀B, hP₀_ends⟩ := hfence.2.2 P₀ hP₀_in + have ha₀W : a₀ ∈ A ∩ W := ⟨ha₀A, hP₀_ends.mem_transactionEnds_left S hP₀_in⟩ + have hb₀W : b₀ ∈ B ∩ W := ⟨hb₀B, hP₀_ends.mem_transactionEnds_right S hP₀_in⟩ + have hW_sub_BA : W ⊆ B ∪ A := by + rw [union_comm, hfence.2.1.2.2.2.1]; exact hW_bar + obtain ⟨b_k, hb_k, a_k, ha_k, hd_bk_ak⟩ := + S.Ω.exists_empty_interval_AB_of_subset_union hW_bar hW_sub_BA ⟨b₀, hb₀W⟩ ⟨a₀, ha₀W⟩ + obtain ⟨L, hL_len_W, hL_set, hL_0, hL_cw⟩ := + S.Ω.exists_isClockwiseSeq_of_subset_bar hW_bar ha_k.2 + have hL_len : L.length = 2 * k := hL_len_W.trans hncard_W + obtain ⟨-, hL_A, hL_B⟩ := + transaction_end_list_partitions_fence S hfence hk_pos hL_len hL_cw hL_0 hL_set + hb_k ha_k hd_bk_ak + -- Define `a_list` and `b_list` so `a_list.reverse ++ b_list = L`. + let a_list := List.ofFn (fun i : Fin k => L[k - 1 - i.1]'(by omega)) + let b_list := List.ofFn (fun i : Fin k => L[k + i.1]'(by omega)) + have ha_len : a_list.length = k := by simp [a_list] + have hb_len : b_list.length = k := by simp [b_list] + have hrev_append : a_list.reverse ++ b_list = L := by + apply List.ext_getElem + · simp [a_list, b_list, hL_len, two_mul] + · intro i hi₁ hi₂ + rw [List.getElem_append] + split_ifs with hik + · have hik' : i < k := by simpa [a_list] using hik + rw [List.getElem_reverse] + simp only [a_list, List.length_ofFn, List.getElem_ofFn] + congr 1 + omega + · have hik' : ¬ i < k := by simpa [a_list] using hik + simp only [a_list, b_list, List.length_reverse, List.length_ofFn, List.getElem_ofFn] + congr 1 + omega + -- For each `i < k`, find `Q_i ∈ F` with end `a_list[i] ∈ A` and other end `b_list[φ i] ∈ B`. + have hex_Q : ∀ i : ℕ, (hi : i < k) → + ∃ P ∈ F, ∃ j : ℕ, ∃ hj : j < k, + S.IsOmegaPathWithEnds P (L[k - 1 - i]'(by omega)) (L[k + j]'(by omega)) := by + intro i hi + have h_in_W : L[k - 1 - i]'(by omega) ∈ W := by + rw [← hL_set]; exact List.getElem_mem (by omega) + have h_in_A : L[k - 1 - i]'(by omega) ∈ A := hL_A (k - 1 - i) (by omega) (by omega) + obtain ⟨P, hP_in, y, hPy⟩ := h_in_W + obtain ⟨aP, haPA, bP, hbPB, hP_ends⟩ := hfence.2.2 P hP_in + have haP_eq : aP = L[k - 1 - i]'(by omega) := by + rcases hP_ends.ends_eq S hPy with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · exact (disjoint_left.mp hfence.2.1.2.2.1 h_in_A hbPB).elim + subst haP_eq + have hbP_W : bP ∈ W := hP_ends.mem_transactionEnds_right S hP_in + rw [← hL_set] at hbP_W + obtain ⟨m, hm, hm_eq⟩ := List.getElem_of_mem hbP_W + have hmk : k ≤ m := by + by_contra hlt + exact disjoint_left.mp hfence.2.1.2.2.1 (hL_A m hm (by omega)) (hm_eq ▸ hbPB) + refine ⟨P, hP_in, m - k, by omega, ?_⟩ + have hm_add : k + (m - k) = m := Nat.add_sub_of_le hmk + simpa [hm_add, hm_eq] using hP_ends + let Q_fn (i : ℕ) : Graph α β := + if hi : i < k then (hex_Q i hi).choose else P₀ + let φ (i : ℕ) : ℕ := + if hi : i < k then (hex_Q i hi).choose_spec.2.choose else 0 + have hQ_spec : ∀ (i : ℕ) (hi : i < k), + Q_fn i ∈ F ∧ φ i < k ∧ + S.IsOmegaPathWithEnds (Q_fn i) (L[k - 1 - i]'(by omega)) + (L[k + φ i]'(by + have hlt : φ i < k := by + simp only [φ, hi, ↓reduceDIte] + exact (hex_Q i hi).choose_spec.2.choose_spec.1 + omega)) := by + intro i hi + simp only [Q_fn, φ, hi, ↓reduceDIte] + exact ⟨(hex_Q i hi).choose_spec.1, + (hex_Q i hi).choose_spec.2.choose_spec.1, + (hex_Q i hi).choose_spec.2.choose_spec.2⟩ + have hQ_inj : ∀ i j : ℕ, i < k → j < k → Q_fn i = Q_fn j → i = j := by + intro i j hi hj heq + have h₁ := (hQ_spec i hi).2.2 + have h₂ := (hQ_spec j hj).2.2 + rw [heq] at h₁ + rcases h₁.ends_eq S h₂ with ⟨h_eq, _⟩ | ⟨h_eq, _⟩ + · have := (List.Nodup.getElem_inj_iff hL_cw.1).mp h_eq; omega + · exfalso + have hA_j : L[k - 1 - j]'(by omega) ∈ A := hL_A (k - 1 - j) (by omega) (by omega) + have hB_i : L[k + φ i]'(by have := (hQ_spec i hi).2.1; omega) ∈ B := + hL_B (k + φ i) (by have := (hQ_spec i hi).2.1; omega) (by omega) + exact disjoint_left.mp hfence.2.1.2.2.1 hA_j (h_eq ▸ hB_i) + -- Show `φ` is strictly increasing on `0 ..< k`, hence `φ i = i`. + have hφ_mono : ∀ i j : ℕ, i < j → j < k → φ i < φ j := by + intro i j hij hj + have hi : i < k := Nat.lt_trans hij hj + obtain ⟨hQi_F, hφi, hQi_ends⟩ := hQ_spec i hi + obtain ⟨hQj_F, hφj, hQj_ends⟩ := hQ_spec j hj + have hne_Q : Q_fn i ≠ Q_fn j := fun h => Nat.ne_of_lt hij (hQ_inj i j hi hj h) + have hdisj_Q : Disjoint V(Q_fn i) V(Q_fn j) := hfence.1.2 hQi_F hQj_F hne_Q + rcases lt_trichotomy (φ i) (φ j) with hlt | heq | hgt + · exact hlt + · exfalso + have h_same_b : L[k + φ i]'(by omega) = L[k + φ j]'(by omega) := by congr 1; omega + exact disjoint_left.mp hdisj_Q hQi_ends.1.right_mem (h_same_b ▸ hQj_ends.1.right_mem) + · exfalso + have h1 : k - 1 - j < k - 1 - i := by omega + have h2 : k - 1 - i < k + φ j := by omega + have h3 : k + φ j < k + φ i := by omega + have h4 : k + φ i < L.length := by omega + have h_ai_in : L[k - 1 - i]'(by omega) ∈ + S.Ω.interval (L[k - 1 - j]'(by omega)) (L[k + φ j]'(by omega)) := + S.Ω.mem_interval_of_lt hL_cw h1 h2 (Nat.lt_trans h3 h4) + have h_bj_in : L[k + φ j]'(by omega) ∈ + S.Ω.interval (L[k - 1 - j]'(by omega)) (L[k + φ i]'(by omega)) := + S.Ω.mem_interval_of_lt hL_cw (Nat.lt_trans h1 h2) h3 h4 + have h_bi_in : L[k + φ i]'(by omega) ∈ + S.Ω.interval (L[k + φ j]'(by omega)) (L[k - 1 - j]'(by omega)) := + S.Ω.mem_interval_rotate_left h_bj_in + have hcr : S.Ω.Crosses (L[k - 1 - j]'(by omega)) (L[k + φ j]'(by omega)) + (L[k - 1 - i]'(by omega)) (L[k + φ i]'(by omega)) := + S.Ω.crosses_iff_interval.mpr (Or.inl ⟨h_ai_in, h_bi_in⟩) + exact hno_cross (Q_fn j) hQj_F (Q_fn i) hQi_F + ⟨hdisj_Q.symm, _, _, _, _, hQj_ends, hQi_ends, hcr⟩ + have hφ_ge : ∀ i : ℕ, i < k → i ≤ φ i := by + intro i + induction i with + | zero => intro _; exact Nat.zero_le _ + | succ i ih => + intro hi + have := ih (Nat.lt_of_succ_lt hi) + have := hφ_mono i (i + 1) (Nat.lt_succ_self i) hi + omega + have hφ_le : ∀ d : ℕ, d < k → φ (k - 1 - d) ≤ k - 1 - d := by + intro d + induction d with + | zero => + intro hd + have hlt := (hQ_spec (k - 1) (by omega)).2.1 + simpa using Nat.le_sub_one_of_lt hlt + | succ d ih => + intro hd + have := ih (Nat.lt_of_succ_lt hd) + have := hφ_mono (k - 1 - (d + 1)) (k - 1 - d) (by omega) (by omega) + omega + have hφ_eq : ∀ i : ℕ, i < k → φ i = i := by + intro i hi + have h1 := hφ_ge i hi + have h2 := hφ_le (k - 1 - i) (by omega) + have h_idx : k - 1 - (k - 1 - i) = i := by omega + rw [h_idx] at h2 + omega + let Q := (List.range k).map Q_fn + have hQ_len : Q.length = k := by simp [Q] + have hQ_nodup : Q.Nodup := by + rw [List.nodup_iff_injective_getElem] + intro ⟨i, hi⟩ ⟨j, hj⟩ hij + simp only [Fin.mk.injEq] + simp only [Q, List.getElem_map, List.getElem_range] at hij + simp only [Q, List.length_map, List.length_range] at hi hj + exact hQ_inj i j hi hj hij + have hQ_sub_F : {P | P ∈ Q} ⊆ F := by + intro P hP + simp only [Q, mem_ofPred_eq, List.mem_map, List.mem_range] at hP + rcases hP with ⟨i, hi, rfl⟩ + exact (hQ_spec i hi).1 + have hQ_ncard : {P | P ∈ Q}.ncard = k := by + have h_eq : {P | P ∈ Q} = (Q.toFinset : Set (Graph α β)) := by ext x; simp + rw [h_eq, Set.ncard_coe_finset, List.card_toFinset, List.dedup_eq_self.mpr hQ_nodup, hQ_len] + have hQ_eq_F : {P | P ∈ Q} = F := + Set.eq_of_subset_of_ncard_le hQ_sub_F (by rw [hQ_ncard]) hfin_F + have hQ_pairwise : Q.Pairwise (fun P₁ P₂ => Disjoint V(P₁) V(P₂)) := by + rw [List.pairwise_iff_getElem] + intro i j hi hj hij + have hiF : Q[i]'hi ∈ F := hQ_sub_F (List.getElem_mem hi) + have hjF : Q[j]'hj ∈ F := hQ_sub_F (List.getElem_mem hj) + have hne : Q[i]'hi ≠ Q[j]'hj := + fun h => Nat.ne_of_lt hij ((List.Nodup.getElem_inj_iff hQ_nodup).mp h) + exact hfence.1.2 hiF hjF hne + refine ⟨Q, hQ_len, hQ_nodup, hQ_eq_F, hQ_pairwise, a_list, b_list, + ha_len.trans hQ_len.symm, hb_len.trans hQ_len.symm, ?_, ?_⟩ + · intro i hi + have hik : i < k := by omega + obtain ⟨_, _, hends⟩ := hQ_spec i hik + simp only [Q, a_list, b_list, List.getElem_map, List.getElem_range, List.getElem_ofFn] + simpa [hφ_eq i hik] using hends + · rwa [hrev_append] + · have hF_empty : F = ∅ := Set.not_nonempty_iff_eq_empty.mp hF_ne + subst hF_empty + refine ⟨[], by simp, List.nodup_nil, by simp, List.Pairwise.nil, [], [], rfl, rfl, + fun i hi => by simp at hi, List.nodup_nil, fun v hv => by simp at hv, + fun i hi => by simp at hi⟩ + +/-! ## Proof of (4.4) -/ + +/-- If `Q` is a separating `Ω`-path with ends `a_Q, b_Q` that is half-covered by `P_set`, then no +member `P ∈ P_set` can have one end in `S.Ω.interval a_Q b_Q` and the other end in +`S.Ω.interval b_Q a_Q`. -/ +theorem not_ends_in_both_intervals_of_separating_halfCovered + {P_set : Set (Graph α β)} {Q P : Graph α β} {a_Q b_Q s t : α} + (hQ_ends : S.IsOmegaPathWithEnds Q a_Q b_Q) + (hsep : S.IsSeparatingOmegaPath Q) + (hcov : S.IsHalfCovered P_set Q) + (hP_in : P ∈ P_set) + (hP_ends : S.IsOmegaPathWithEnds P s t) + (hs_ab : s ∈ S.Ω.interval a_Q b_Q) + (ht_ba : t ∈ S.Ω.interval b_Q a_Q) : False := by + have hcr : S.Ω.Crosses a_Q b_Q s t := + S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hs_ab, ht_ba⟩) + have hmeet : (V(P) ∩ V(Q)).Nonempty := by + by_contra hnot + rw [not_nonempty_iff_eq_empty, ← disjoint_iff_inter_eq_empty] at hnot + exact hsep.2 ⟨P, hnot, s, t, a_Q, b_Q, hP_ends, hQ_ends, hcr.symm⟩ + rcases hcov with ⟨P₀, _, _, huniq, s₀, t₀, a₀, b₀, _, hP₀_ends, hQ₀_ends, rfl, _, _⟩ + have hPP₀ : P = P₀ := huniq P hP_in hmeet + subst hPP₀ + have hs₀_st : s₀ = s ∨ s₀ = t := by + rcases hP_ends.ends_eq S hP₀_ends with ⟨h1, _⟩ | ⟨h1, _⟩ + · exact Or.inl h1 + · exact Or.inr h1 + have hs₀_ab : s₀ = a_Q ∨ s₀ = b_Q := by + rcases hQ_ends.ends_eq S hQ₀_ends with ⟨h2, _⟩ | ⟨h2, _⟩ + · exact Or.inl h2 + · exact Or.inr h2 + rcases hs₀_st with rfl | rfl <;> rcases hs₀_ab with h2 | h2 + · rw [h2] at hs_ab; exact S.Ω.not_mem_interval_left a_Q b_Q hs_ab + · rw [h2] at hs_ab; exact S.Ω.not_mem_interval_right a_Q b_Q hs_ab + · rw [h2] at ht_ba; exact S.Ω.not_mem_interval_right b_Q a_Q ht_ba + · rw [h2] at ht_ba; exact S.Ω.not_mem_interval_left b_Q a_Q ht_ba + +/-- In a fence `(A, B)`, if `a₂, b₂ ∈ A` with `a₂ ≠ b₂`, then either `B ⊆ Ω.interval a₂ b₂` or +`B ⊆ Ω.interval b₂ a₂`. -/ +theorem subset_interval_or_swap {A B : Set α} (hfence : S.Ω.IsFence A B) + {a₂ b₂ : α} (ha₂ : a₂ ∈ A) (hb₂ : b₂ ∈ A) (hne : a₂ ≠ b₂) : + B ⊆ S.Ω.interval a₂ b₂ ∨ B ⊆ S.Ω.interval b₂ a₂ := by + have ha₂_bar : a₂ ∈ S.Ω.bar := hfence.1 ha₂ + have hb₂_bar : b₂ ∈ S.Ω.bar := hfence.1 hb₂ + have hB_union : B ⊆ S.Ω.interval a₂ b₂ ∪ S.Ω.interval b₂ a₂ := by + rw [S.Ω.interval_union_interval_swap ha₂_bar hb₂_bar hne] + intro b hb + refine ⟨hfence.2.1 hb, ?_⟩ + simp only [mem_insert_iff, mem_singleton_iff, not_or] + exact ⟨fun h => disjoint_left.mp hfence.2.2.1 ha₂ (h ▸ hb), + fun h => disjoint_left.mp hfence.2.2.1 hb₂ (h ▸ hb)⟩ + by_cases hex : ∃ b ∈ B, b ∈ S.Ω.interval a₂ b₂ + · left + rcases hex with ⟨b, hbB, hb_ab⟩ + intro b' hb'B + rcases hB_union hb'B with h_ab | h_ba + · exact h_ab + · exfalso + have hne_b : b ≠ b' := + fun h => disjoint_left.mp (S.Ω.disjoint_interval_swap a₂ b₂) hb_ab (h ▸ h_ba) + have hcr : S.Ω.Crosses a₂ b₂ b b' := + S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hb_ab, h_ba⟩) + exact hfence.2.2.2.2 a₂ ha₂ b₂ hb₂ hne b hbB b' hb'B hne_b hcr + · right + push Not at hex + intro b hbB + exact (hB_union hbB).resolve_left (hex b hbB) + +/-- **Graph Minors IX, (4.4)** (pages 50–51): +"(4.4) *Let **S** be true, and let $Q_1, Q_2, Q_3 \in \mathscr{Q}$ be in order, where $Q_2$ is +... separating. Suppse that $Q_1, Q_2, Q_3$ are all half-covered. Then one end of $Q_2$ is in $A$ +and +the other is in $B$.*" -/ +theorem theorem_4_4_proof {p : ℕ} {P_set Q_set : Set (Graph α β)} {A B : Set α} + (hS : S.StatementS p P_set Q_set A B) + {Q₁ Q₂ Q₃ : Graph α β} + (_hQ₁ : Q₁ ∈ Q_set) (_hQ₂ : Q₂ ∈ Q_set) (_hQ₃ : Q₃ ∈ Q_set) + (hord : S.AreInOrder [Q₁, Q₂, Q₃]) + (hsep₂ : S.IsSeparatingOmegaPath Q₂) + (hcov₁ : S.IsHalfCovered P_set Q₁) + (hcov₂ : S.IsHalfCovered P_set Q₂) + (hcov₃ : S.IsHalfCovered P_set Q₃) : + ∃ a₂ ∈ A, ∃ b₂ ∈ B, S.IsOmegaPathWithEnds Q₂ a₂ b₂ := by + rcases hord with ⟨_, a_l, b_l, ha_len, hb_len, hends, hcw⟩ + simp only [List.length_cons, List.length_nil, Nat.reduceAdd] at ha_len hb_len + rcases a_l with _ | ⟨a₁, _ | ⟨a₂, _ | ⟨a₃, _ | _⟩⟩⟩ <;> simp at ha_len + rcases b_l with _ | ⟨b₁, _ | ⟨b₂, _ | ⟨b₃, _ | _⟩⟩⟩ <;> simp at hb_len + have h0 : 0 < [Q₁, Q₂, Q₃].length := by simp + have h1 : 1 < [Q₁, Q₂, Q₃].length := by simp + have h2 : 2 < [Q₁, Q₂, Q₃].length := by simp + have hQ₁_ends : S.IsOmegaPathWithEnds Q₁ a₁ b₁ := hends 0 h0 + have hQ₂_ends : S.IsOmegaPathWithEnds Q₂ a₂ b₂ := hends 1 h1 + have hQ₃_ends : S.IsOmegaPathWithEnds Q₃ a₃ b₃ := hends 2 h2 + have hcw6 : S.Ω.IsClockwiseSeq [a₃, a₂, a₁, b₁, b₂, b₃] := hcw + obtain ⟨ha₁_ab, hb₁_ab, ha₃_ba, hb₃_ba⟩ := S.mem_intervals_of_isClockwiseSeq_six hcw6 + -- Helper: it is impossible that `a₂, b₂ ∈ U` when `(U, V)` is a fence for `P_set`. + have hnot_both_in_side : ∀ {U V : Set α}, S.IsFenceFor P_set U V → + a₂ ∈ U → b₂ ∈ U → False := by + intro U V hfenceU ha₂U hb₂U + rcases S.subset_interval_or_swap hfenceU.2.1 ha₂U hb₂U hQ₂_ends.2.1 with hV_ab | hV_ba + · -- `V ⊆ S.Ω.interval a₂ b₂`: use `Q₃` whose ends `a₃, b₃` lie in `S.Ω.interval b₂ a₂`. + rcases hcov₃ with ⟨P₃, hP₃_in, _, _, s₃, t₃, a₃', b₃', _, hP₃_ends, hQ₃_ends', rfl, _, _⟩ + have hs₃_ba : s₃ ∈ S.Ω.interval b₂ a₂ := by + rcases hQ₃_ends.ends_eq S hQ₃_ends' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ha₃_ba + · exact hb₃_ba + have hs₃_not_V : s₃ ∉ V := + fun hsV => disjoint_left.mp (S.Ω.disjoint_interval_swap a₂ b₂) (hV_ab hsV) hs₃_ba + obtain ⟨u₃, hu₃U, v₃, hv₃V, hP₃_uv⟩ := hfenceU.2.2 P₃ hP₃_in + have ht₃_V : t₃ ∈ V := by + rcases hP₃_ends.ends_eq S hP₃_uv with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hv₃V + · exact (hs₃_not_V hv₃V).elim + exact S.not_ends_in_both_intervals_of_separating_halfCovered + hQ₂_ends hsep₂ hcov₂ hP₃_in hP₃_ends.symm (hV_ab ht₃_V) hs₃_ba + · -- `V ⊆ S.Ω.interval b₂ a₂`: use `Q₁` whose ends `a₁, b₁` lie in `S.Ω.interval a₂ b₂`. + rcases hcov₁ with ⟨P₁, hP₁_in, _, _, s₁, t₁, a₁', b₁', _, hP₁_ends, hQ₁_ends', rfl, _, _⟩ + have hs₁_ab : s₁ ∈ S.Ω.interval a₂ b₂ := by + rcases hQ₁_ends.ends_eq S hQ₁_ends' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ha₁_ab + · exact hb₁_ab + have hs₁_not_V : s₁ ∉ V := + fun hsV => disjoint_left.mp (S.Ω.disjoint_interval_swap a₂ b₂) hs₁_ab (hV_ba hsV) + obtain ⟨u₁, hu₁U, v₁, hv₁V, hP₁_uv⟩ := hfenceU.2.2 P₁ hP₁_in + have ht₁_V : t₁ ∈ V := by + rcases hP₁_ends.ends_eq S hP₁_uv with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hv₁V + · exact (hs₁_not_V hv₁V).elim + exact S.not_ends_in_both_intervals_of_separating_halfCovered + hQ₂_ends hsep₂ hcov₂ hP₁_in hP₁_ends hs₁_ab (hV_ba ht₁_V) + have hfence_BA : S.IsFenceFor P_set B A := by + refine ⟨hS.isFenceFor_P.1, hS.isFenceFor_P.2.1.symm, fun P hP => ?_⟩ + obtain ⟨a, ha, b, hb, hab⟩ := hS.isFenceFor_P.2.2 P hP + exact ⟨b, hb, a, ha, hab.symm S⟩ + have ha₂_AB : a₂ ∈ A ∪ B := by + rw [hS.isFenceFor_P.2.1.2.2.2.1]; exact hQ₂_ends.2.2.1 + have hb₂_AB : b₂ ∈ A ∪ B := by + rw [hS.isFenceFor_P.2.1.2.2.2.1]; exact hQ₂_ends.2.2.2 + rcases ha₂_AB with ha₂A | ha₂B <;> rcases hb₂_AB with hb₂A | hb₂B + · exact (hnot_both_in_side hS.isFenceFor_P ha₂A hb₂A).elim + · exact ⟨a₂, ha₂A, b₂, hb₂B, hQ₂_ends⟩ + · exact ⟨b₂, hb₂A, a₂, ha₂B, hQ₂_ends.symm S⟩ + · exact (hnot_both_in_side hfence_BA ha₂B hb₂B).elim + +end Society + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section4c.lean b/LeanPool/GraphMinor/GM09/Section4c.lean new file mode 100644 index 0000000000..a254e1c84e --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section4c.lean @@ -0,0 +1,933 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2a +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section3c +import LeanPool.GraphMinor.GM09.Section4a +import LeanPool.GraphMinor.GM09.Section4b +import Mathlib.Data.Set.Card + +/-! +# Graph Minors IX, Section 4 (Part C): Proof of (4.5) and (4.6) + +This file completes the formalization of Section 4 of Robertson and Seymour, +*Graph Minors IX. Disjoint Crossed Paths*, J. Combin. Theory Ser. B 49 (1990), 40–77: +- `(4.5)` (`theorem_4_5`, pages 51–52): under Statement **S**, if `Q₁, Q₂, Q₃, Q₄, Q₅ ∈ Q_set` + are in order and `Q₂, Q₃, Q₄` are separating, then not all of `Q₁, …, Q₅` are half-covered. +- `(4.6)` (`theorem_4_6`, page 52): under Statement **S** with `p ≥ 2`, `p ≠ 3`, and + `|Q_set| = p + 4`, if every member of `Q_set` is separating, then some `Q ∈ Q_set` is + disjoint from `⋃ P_set`. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Graph GraphMinor GraphMinor.Surface + +universe u v +variable {α : Type u} {β : Type v} + +/-! ## Interval Inclusion and Fence Alignment Lemmas -/ + +namespace CyclicPerm + +variable (Ω : CyclicPerm α) + +/-- In a fence `(U, V)`, if `a, x ∈ U`, `b, y ∈ V`, and `x, y ∉ Ω.interval a b`, then +`Ω.interval a b ⊆ Ω.interval x y`. -/ +theorem IsFence.interval_subset_of_not_mem {U V : Set α} (hfence : Ω.IsFence U V) + {a b x y : α} (ha : a ∈ U) (hb : b ∈ V) (hx : x ∈ U) (hy : y ∈ V) + (hx_not : x ∉ Ω.interval a b) (hy_not : y ∉ Ω.interval a b) : + Ω.interval a b ⊆ Ω.interval x y := by + let W : Set α := {a, b, x, y} + have hW : W ⊆ Ω.bar := by + rintro z (rfl | rfl | rfl | rfl) + · exact hfence.1 ha + · exact hfence.2.1 hb + · exact hfence.1 hx + · exact hfence.2.1 hy + have hdisj : Disjoint (Ω.interval a b) W := by + rw [disjoint_right] + intro z hz + rcases hz with rfl | rfl | rfl | rfl + · exact Ω.not_mem_interval_left z b + · exact Ω.not_mem_interval_right a z + · exact hx_not + · exact hy_not + exact Ω.interval_subset_of_disjoint_AB hfence hW + ⟨ha, by simp [W]⟩ ⟨hb, by simp [W]⟩ hdisj ⟨hx, by simp [W]⟩ ⟨hy, by simp [W]⟩ + +/-- In a fence `(U, V)`, if `a, a₂ ∈ U` and `b, b₂ ∈ V`, it is impossible that both +`a ∈ Ω.interval a₂ b₂` and `a₂ ∈ Ω.interval a b`. -/ +theorem IsFence.not_mem_interval_both_left {U V : Set α} (hfence : Ω.IsFence U V) + {a b a₂ b₂ : α} (ha : a ∈ U) (hb : b ∈ V) (ha₂ : a₂ ∈ U) (hb₂ : b₂ ∈ V) + (ha_in : a ∈ Ω.interval a₂ b₂) (ha₂_in : a₂ ∈ Ω.interval a b) : False := by + have hb₂_aa₂ : b₂ ∈ Ω.interval a a₂ := Ω.mem_interval_rotate_left ha_in + have hb_a₂a : b ∈ Ω.interval a₂ a := Ω.mem_interval_rotate_left ha₂_in + have haa₂ : a ≠ a₂ := fun h => Ω.not_mem_interval_left a₂ b₂ (h ▸ ha_in) + have hbb₂ : b₂ ≠ b := + fun h => disjoint_left.mp (Ω.disjoint_interval_swap a a₂) hb₂_aa₂ (h ▸ hb_a₂a) + exact hfence.2.2.2.2 a ha a₂ ha₂ haa₂ b₂ hb₂ b hb hbb₂ + (Ω.crosses_iff_interval.mpr (Or.inl ⟨hb₂_aa₂, hb_a₂a⟩)) + +/-- In a fence `(U, V)`, for any `a, a₂ ∈ U` and `b, b₂ ∈ V`, either one of the intervals +`Ω.interval a b` and `Ω.interval a₂ b₂` is a subset of the other, or one of `a, b` lies in +`Ω.interval a₂ b₂` and the other lies in `Ω.interval b₂ a₂`. -/ +theorem IsFence.interval_subset_or_subset_or_cross {U V : Set α} (hfence : Ω.IsFence U V) + {a b a₂ b₂ : α} (ha : a ∈ U) (hb : b ∈ V) (ha₂ : a₂ ∈ U) (hb₂ : b₂ ∈ V) : + Ω.interval a b ⊆ Ω.interval a₂ b₂ ∨ + Ω.interval a₂ b₂ ⊆ Ω.interval a b ∨ + (a ∈ Ω.interval a₂ b₂ ∧ b ∈ Ω.interval b₂ a₂) ∨ + (b ∈ Ω.interval a₂ b₂ ∧ a ∈ Ω.interval b₂ a₂) := by + have ha_bar : a ∈ Ω.bar := hfence.1 ha + have hb_bar : b ∈ Ω.bar := hfence.2.1 hb + have ha₂_bar : a₂ ∈ Ω.bar := hfence.1 ha₂ + have hb₂_bar : b₂ ∈ Ω.bar := hfence.2.1 hb₂ + have ha₂b₂ : a₂ ≠ b₂ := fun h => disjoint_left.mp hfence.2.2.1 ha₂ (h ▸ hb₂) + have hab₂ : a ≠ b₂ := fun h => disjoint_left.mp hfence.2.2.1 ha (h ▸ hb₂) + have hba₂ : b ≠ a₂ := fun h => disjoint_left.mp hfence.2.2.1 ha₂ (h ▸ hb) + by_cases ha_in : a ∈ Ω.interval a₂ b₂ + · by_cases hbb₂ : b = b₂ + · subst hbb₂ + exact Or.inl (Ω.interval_subset_interval_right ha_in) + · rcases Ω.mem_interval_or_interval_swap ha₂_bar hb₂_bar hb_bar ha₂b₂ hba₂ hbb₂ with + hb_in | hb_ba + · have ha₂_not : a₂ ∉ Ω.interval a b := + fun h => hfence.not_mem_interval_both_left Ω ha hb ha₂ hb₂ ha_in h + have hb₂_not : b₂ ∉ Ω.interval a b := by + intro hb₂_in + have hb_b₂a₂ : b ∈ Ω.interval b₂ a₂ := by + exfalso + have ha₂_b₂b : a₂ ∈ Ω.interval b₂ b := Ω.mem_interval_rotate_right hb_in + have ha_bb₂ : a ∈ Ω.interval b b₂ := Ω.mem_interval_rotate_right hb₂_in + have hbb₂' : b₂ ≠ b := Ne.symm hbb₂ + have ha₂a : a₂ ≠ a := fun h => Ω.not_mem_interval_left a₂ b₂ (h ▸ ha_in) + exact hfence.symm.2.2.2.2 b₂ hb₂ b hb hbb₂' a₂ ha₂ a ha ha₂a + (Ω.crosses_iff_interval.mpr (Or.inl ⟨ha₂_b₂b, ha_bb₂⟩)) + exact disjoint_left.mp (Ω.disjoint_interval_swap a₂ b₂) hb_in hb_b₂a₂ + exact Or.inl (hfence.interval_subset_of_not_mem Ω ha hb ha₂ hb₂ ha₂_not hb₂_not) + · exact Or.inr (Or.inr (Or.inl ⟨ha_in, hb_ba⟩)) + · by_cases hb_in : b ∈ Ω.interval a₂ b₂ + · by_cases haa₂ : a = a₂ + · subst haa₂ + exact Or.inl (Ω.interval_subset_interval_left hb_in) + · have ha_ba : a ∈ Ω.interval b₂ a₂ := + (Ω.mem_interval_or_interval_swap ha₂_bar hb₂_bar ha_bar ha₂b₂ haa₂ hab₂).resolve_left + ha_in + exact Or.inr (Or.inr (Or.inr ⟨hb_in, ha_ba⟩)) + · exact Or.inr (Or.inl (hfence.interval_subset_of_not_mem Ω ha₂ hb₂ ha hb ha_in hb_in)) + +/-- In a fence `(U, V)`, if `x₁ ∈ U`, `y₁ ∈ V`, `(x₂ ∈ U ∧ y₂ ∈ V) ∨ (x₂ ∈ V ∧ y₂ ∈ U)`, and +`x₂ ∈ Ω.interval x₁ y₁` and `y₂ ∈ Ω.interval x₂ y₁`, then `x₂ ∈ U ∧ y₂ ∈ V`. -/ +theorem IsFence.same_side_of_mem_interval {U V : Set α} (hfence : Ω.IsFence U V) + {x₁ y₁ x₂ y₂ : α} (hx₁ : x₁ ∈ U) (hy₁ : y₁ ∈ V) + (h₂ : (x₂ ∈ U ∧ y₂ ∈ V) ∨ (x₂ ∈ V ∧ y₂ ∈ U)) + (hx₂_in : x₂ ∈ Ω.interval x₁ y₁) (hy₂_in : y₂ ∈ Ω.interval x₂ y₁) : + x₂ ∈ U ∧ y₂ ∈ V := by + rcases h₂ with hUV | ⟨hx₂V, hy₂U⟩ + · exact hUV + · exfalso + have hx₂_x₁y₂ : x₂ ∈ Ω.interval x₁ y₂ := + Ω.mem_interval_left_of_mem_interval_right hx₂_in hy₂_in + have hy₁_y₂x₁ : y₁ ∈ Ω.interval y₂ x₁ := + Ω.mem_interval_rotate_left (Ω.interval_subset_interval_right hx₂_in hy₂_in) + have hx₁y₂ : x₁ ≠ y₂ := fun h => (Ω.mem_interval_rotate_left hy₁_y₂x₁).1.2 (Or.inr h) + have hx₂y₁ : x₂ ≠ y₁ := fun h => hx₂_in.1.2 (Or.inr h) + exact hfence.2.2.2.2 x₁ hx₁ y₂ hy₂U hx₁y₂ x₂ hx₂V y₁ hy₁ hx₂y₁ + (Ω.crosses_iff_interval.mpr (Or.inl ⟨hx₂_x₁y₂, hy₁_y₂x₁⟩)) + +end CyclicPerm + +/-! ## Proof of (4.5) (pages 51–52) -/ + +namespace Society + +variable (S : Society α β) + +/-- A single path `P₃` in `S` cannot share an end with each of three pairwise vertex-disjoint +`Ω`-paths `Q₁, Q₂, Q₃`. -/ +theorem not_shares_end_with_three {P₃ Q₁ Q₂ Q₃ : Graph α β} + {x₁ y₁ x₂ y₂ x₃ y₃ : α} + (hQ₁ : S.IsOmegaPathWithEnds Q₁ x₁ y₁) + (hQ₂ : S.IsOmegaPathWithEnds Q₂ x₂ y₂) + (hQ₃ : S.IsOmegaPathWithEnds Q₃ x₃ y₃) + (hdisj_12 : Disjoint V(Q₁) V(Q₂)) + (hdisj_13 : Disjoint V(Q₁) V(Q₃)) + (hdisj_23 : Disjoint V(Q₂) V(Q₃)) + {u v : α} (_hP₃ : S.IsOmegaPathWithEnds P₃ u v) + {s₁ s₂ s₃ : α} + (hs₁_P : s₁ = u ∨ s₁ = v) (hs₂_P : s₂ = u ∨ s₂ = v) (hs₃_P : s₃ = u ∨ s₃ = v) + (hs₁_Q : s₁ = x₁ ∨ s₁ = y₁) (hs₂_Q : s₂ = x₂ ∨ s₂ = y₂) (hs₃_Q : s₃ = x₃ ∨ s₃ = y₃) : + False := by + have hs₁_V : s₁ ∈ V(Q₁) := by + rcases hs₁_Q with rfl | rfl + · exact hQ₁.1.left_mem + · exact hQ₁.1.right_mem + have hs₂_V : s₂ ∈ V(Q₂) := by + rcases hs₂_Q with rfl | rfl + · exact hQ₂.1.left_mem + · exact hQ₂.1.right_mem + have hs₃_V : s₃ ∈ V(Q₃) := by + rcases hs₃_Q with rfl | rfl + · exact hQ₃.1.left_mem + · exact hQ₃.1.right_mem + have hne_12 : s₁ ≠ s₂ := fun h => disjoint_left.mp hdisj_12 hs₁_V (h ▸ hs₂_V) + have hne_13 : s₁ ≠ s₃ := fun h => disjoint_left.mp hdisj_13 hs₁_V (h ▸ hs₃_V) + have hne_23 : s₂ ≠ s₃ := fun h => disjoint_left.mp hdisj_23 hs₂_V (h ▸ hs₃_V) + rcases hs₁_P with rfl | rfl <;> rcases hs₂_P with h₂ | h₂ <;> rcases hs₃_P with h₃ | h₃ + · exact hne_12 h₂.symm + · exact hne_12 h₂.symm + · exact hne_13 h₃.symm + · exact hne_23 (h₂.trans h₃.symm) + · exact hne_23 (h₂.trans h₃.symm) + · exact hne_13 h₃.symm + · exact hne_12 h₂.symm + · exact hne_12 h₂.symm + +/-- Unified contradiction for both cases of `(4.5)` on one side `(U, V)` of the fence. -/ +theorem half_covered_side_contradiction + {P_set : Set (Graph α β)} {U V : Set α} + {P₃ Q₁ Q₂ Q₃ : Graph α β} {x₁ y₁ x₂ y₂ x₃ y₃ : α} + (hfence : S.IsFenceFor P_set U V) + (hcrooked : S.IsCrookedTransaction P_set) + (hP₃_in : P₃ ∈ P_set) + (hQ₁_ends : S.IsOmegaPathWithEnds Q₁ x₁ y₁) + (hQ₂_ends : S.IsOmegaPathWithEnds Q₂ x₂ y₂) + (hQ₃_ends : S.IsOmegaPathWithEnds Q₃ x₃ y₃) + (hx₂ : x₂ ∈ U) (hy₂ : y₂ ∈ V) (hx₃ : x₃ ∈ U) (hy₃ : y₃ ∈ V) + (hx₁_2 : x₁ ∈ S.Ω.interval x₂ y₂) (hy₁_2 : y₁ ∈ S.Ω.interval x₂ y₂) + (hx₁_3 : x₁ ∈ S.Ω.interval x₃ y₃) (hy₁_3 : y₁ ∈ S.Ω.interval x₃ y₃) + (hx₂_3 : x₂ ∈ S.Ω.interval x₃ y₃) (hy₂_3 : y₂ ∈ S.Ω.interval x₃ y₃) + (hx₃_2 : x₃ ∈ S.Ω.interval y₂ x₂) (hy₃_2 : y₃ ∈ S.Ω.interval y₂ x₂) + (hdisj_12 : Disjoint V(Q₁) V(Q₂)) + (hdisj_13 : Disjoint V(Q₁) V(Q₃)) + (hdisj_23 : Disjoint V(Q₂) V(Q₃)) + (hsep₂ : S.IsSeparatingOmegaPath Q₂) + (hcov₁ : S.IsHalfCovered P_set Q₁) + (hcov₂ : S.IsHalfCovered P_set Q₂) + (hcov₃ : S.IsHalfCovered P_set Q₃) + (hmeet₃ : (V(P₃) ∩ V(Q₃)).Nonempty) + (hcase : Disjoint (S.Ω.interval x₃ y₃) (S.transactionEnds ((P_set \ {P₃}) ∪ {Q₃})) ∨ + ∃ P ∈ P_set \ {P₃}, ∃ a ∈ U, ∃ b ∈ V, + S.IsOmegaPathWithEnds P a b ∧ + Disjoint (S.Ω.interval a b) (S.transactionEnds ((P_set \ {P₃}) ∪ {Q₃}))) : + False := by + let P_set' : Set (Graph α β) := (P_set \ {P₃}) ∪ {Q₃} + -- Extract the witness paths `P₁, P₂, P₃` from `hcov₁, hcov₂, hcov₃`. + have hcov₂' : S.IsHalfCovered P_set Q₂ := hcov₂ + rcases hcov₁ with ⟨P₁, hP₁_in, _, _, s₁, t₁, a₁', b₁', _, hP₁_ends, hQ₁_ends', rfl, _, _⟩ + rcases hcov₂ with ⟨P₂, hP₂_in, _, _, s₂, t₂, a₂', b₂', _, hP₂_ends, hQ₂_ends', rfl, _, _⟩ + rcases hcov₃ with ⟨P₃', hP₃'_in, _, huniq₃, s₃, t₃, a₃', b₃', _, hP₃'_ends, hQ₃_ends', rfl, _, _⟩ + have hP₃_eq : P₃ = P₃' := huniq₃ P₃ hP₃_in hmeet₃ + subst hP₃_eq + have hs₁_xy : s₁ = x₁ ∨ s₁ = y₁ := by + rcases hQ₁_ends.ends_eq S hQ₁_ends' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl rfl + · exact Or.inr rfl + have hs₂_xy : s₂ = x₂ ∨ s₂ = y₂ := by + rcases hQ₂_ends.ends_eq S hQ₂_ends' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl rfl + · exact Or.inr rfl + have hs₃_xy : s₃ = x₃ ∨ s₃ = y₃ := by + rcases hQ₃_ends.ends_eq S hQ₃_ends' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl rfl + · exact Or.inr rfl + have hs₁_2 : s₁ ∈ S.Ω.interval x₂ y₂ := by + rcases hs₁_xy with rfl | rfl + · exact hx₁_2 + · exact hy₁_2 + have hs₁_3 : s₁ ∈ S.Ω.interval x₃ y₃ := by + rcases hs₁_xy with rfl | rfl + · exact hx₁_3 + · exact hy₁_3 + have hs₂_3 : s₂ ∈ S.Ω.interval x₃ y₃ := by + rcases hs₂_xy with rfl | rfl + · exact hx₂_3 + · exact hy₂_3 + have hs₃_2 : s₃ ∈ S.Ω.interval y₂ x₂ := by + rcases hs₃_xy with rfl | rfl + · exact hx₃_2 + · exact hy₃_2 + rcases hcase with hdisj_3 | ⟨P, hP_diff, a, haU, b, hbV, hP_ends, hdisj_ab⟩ + · -- Case 1: `Q₃` is peripheral in `P_set'` with `S.Ω.interval x₃ y₃` empty. + have hP₁_eq : P₁ = P₃ := by + by_contra hne + have hP₁_in' : P₁ ∈ P_set' := Or.inl ⟨hP₁_in, hne⟩ + have hs₁_W' : s₁ ∈ S.transactionEnds P_set' := + hP₁_ends.mem_transactionEnds_left S hP₁_in' + exact disjoint_left.mp hdisj_3 hs₁_3 hs₁_W' + have hP₂_eq : P₂ = P₃ := by + by_contra hne + have hP₂_in' : P₂ ∈ P_set' := Or.inl ⟨hP₂_in, hne⟩ + have hs₂_W' : s₂ ∈ S.transactionEnds P_set' := + hP₂_ends.mem_transactionEnds_left S hP₂_in' + exact disjoint_left.mp hdisj_3 hs₂_3 hs₂_W' + subst hP₁_eq hP₂_eq + have hs₁_P : s₁ = s₃ ∨ s₁ = t₃ := by + rcases hP₃'_ends.ends_eq S hP₁_ends with ⟨h, _⟩ | ⟨h, _⟩ + · exact Or.inl h + · exact Or.inr h + have hs₂_P : s₂ = s₃ ∨ s₂ = t₃ := by + rcases hP₃'_ends.ends_eq S hP₂_ends with ⟨h, _⟩ | ⟨h, _⟩ + · exact Or.inl h + · exact Or.inr h + exact S.not_shares_end_with_three hQ₁_ends hQ₂_ends hQ₃_ends hdisj_12 hdisj_13 hdisj_23 + hP₃'_ends hs₁_P hs₂_P (Or.inl rfl) hs₁_xy hs₂_xy hs₃_xy + · -- Case 2: Some `P ∈ P_set \ {P₃}` is peripheral in `P_set'` with `S.Ω.interval a b` empty. + rcases hfence.2.1.interval_subset_or_subset_or_cross S.Ω haU hbV hx₂ hy₂ with + hab_sub | hx₂y₂_sub | ⟨ha_2, hb_2⟩ | ⟨hb_2, ha_2⟩ + · -- Subcase 2.1: `S.Ω.interval a b ⊆ S.Ω.interval x₂ y₂`. + have hdisj_diff : Disjoint (S.Ω.interval a b) (S.transactionEnds (P_set \ {P₃})) := by + refine hdisj_ab.mono_right ?_ + rintro v ⟨R, hR, hvR, hv_bar⟩ + exact ⟨R, Or.inl hR, hvR, hv_bar⟩ + obtain ⟨u₃, hu₃U, v₃, hv₃V, hP₃_uv⟩ := hfence.2.2 P₃ hP₃_in + have hu₃_or_v₃ : u₃ ∈ S.Ω.interval a b ∨ v₃ ∈ S.Ω.interval a b := by + rcases S.mem_interval_of_peripheral_diff_singleton hfence hcrooked + hP₃_in hP_diff hu₃U hv₃V hP₃_uv haU hbV hP_ends hdisj_diff with ⟨h, _⟩ | ⟨h, _⟩ + · exact Or.inl h + · exact Or.inr h + have hs₃_or_t₃ : s₃ ∈ S.Ω.interval a b ∨ t₃ ∈ S.Ω.interval a b := by + rcases hP₃'_ends.ends_eq S hP₃_uv with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hu₃_or_v₃ + · exact hu₃_or_v₃.symm + have hs₃_not_ab : s₃ ∉ S.Ω.interval a b := by + have hs₃_W' : s₃ ∈ S.transactionEnds P_set' := by + rcases hs₃_xy with rfl | rfl + · exact hQ₃_ends.mem_transactionEnds_left S (Or.inr rfl) + · exact hQ₃_ends.mem_transactionEnds_right S (Or.inr rfl) + exact disjoint_right.mp hdisj_ab hs₃_W' + have ht₃_ab : t₃ ∈ S.Ω.interval a b := hs₃_or_t₃.resolve_left hs₃_not_ab + exact S.not_ends_in_both_intervals_of_separating_halfCovered + hQ₂_ends hsep₂ hcov₂' hP₃_in (hP₃'_ends.symm S) (hab_sub ht₃_ab) hs₃_2 + · -- Subcase 2.2: `S.Ω.interval x₂ y₂ ⊆ S.Ω.interval a b`. + have hs₁_ab : s₁ ∈ S.Ω.interval a b := hx₂y₂_sub hs₁_2 + have hP₁_eq : P₁ = P₃ := by + by_contra hne + have hP₁_in' : P₁ ∈ P_set' := Or.inl ⟨hP₁_in, hne⟩ + have hs₁_W' : s₁ ∈ S.transactionEnds P_set' := + hP₁_ends.mem_transactionEnds_left S hP₁_in' + exact disjoint_left.mp hdisj_ab hs₁_ab hs₁_W' + subst hP₁_eq + have hs₁_ne_s₃ : s₁ ≠ s₃ := by + have hs₁_V : s₁ ∈ V(Q₁) := by + rcases hs₁_xy with rfl | rfl + · exact hQ₁_ends.1.left_mem + · exact hQ₁_ends.1.right_mem + have hs₃_V : s₃ ∈ V(Q₃) := by + rcases hs₃_xy with rfl | rfl + · exact hQ₃_ends.1.left_mem + · exact hQ₃_ends.1.right_mem + exact fun h => disjoint_left.mp hdisj_13 hs₁_V (h ▸ hs₃_V) + have hs₁_eq_t₃ : s₁ = t₃ := by + rcases hP₃'_ends.ends_eq S hP₁_ends with ⟨h, _⟩ | ⟨h, _⟩ + · exact (hs₁_ne_s₃ h).elim + · exact h + subst hs₁_eq_t₃ + exact S.not_ends_in_both_intervals_of_separating_halfCovered + hQ₂_ends hsep₂ hcov₂' hP₁_in (hP₃'_ends.symm S) hs₁_2 hs₃_2 + · -- Subcase 2.3: `a ∈ S.Ω.interval x₂ y₂` and `b ∈ S.Ω.interval y₂ x₂`. + exact S.not_ends_in_both_intervals_of_separating_halfCovered + hQ₂_ends hsep₂ hcov₂' hP_diff.1 hP_ends ha_2 hb_2 + · -- Subcase 2.4: `b ∈ S.Ω.interval x₂ y₂` and `a ∈ S.Ω.interval y₂ x₂`. + exact S.not_ends_in_both_intervals_of_separating_halfCovered + hQ₂_ends hsep₂ hcov₂' hP_diff.1 (hP_ends.symm S) hb_2 ha_2 + +/-- Symmetry of `StatementS` under swapping the fence sides `A` and `B`. -/ +theorem StatementS.symm {p : ℕ} {P_set Q_set : Set (Graph α β)} {A B : Set α} + (hS : S.StatementS p P_set Q_set A B) : S.StatementS p P_set Q_set B A where + two_le_p := hS.two_le_p + isTransaction_Q := hS.isTransaction_Q + no_internal_in_bar := hS.no_internal_in_bar + isCrooked_P := hS.isCrooked_P + card_P_ge := hS.card_P_ge + minimal_union := hS.minimal_union + minimal_card := hS.minimal_card + isFenceFor_P := ⟨hS.isFenceFor_P.1, hS.isFenceFor_P.2.1.symm, fun P hP => by + obtain ⟨a, ha, b, hb, hab⟩ := hS.isFenceFor_P.2.2 P hP + exact ⟨b, hb, a, ha, hab.symm S⟩⟩ + +private theorem replacement_of_half_covered_path {p : ℕ} {P_set Q_set : Set (Graph α β)} + {U V : Set α} (hSUV : S.StatementS p P_set Q_set U V) + {P₃ Q₃ : Graph α β} (hP₃_in : P₃ ∈ P_set) (hQ₃ : Q₃ ∈ Q_set) + (hmeet₃ : (V(P₃) ∩ V(Q₃)).Nonempty) + (huniq₃ : ∀ R ∈ P_set, (V(R) ∩ V(Q₃)).Nonempty → R = P₃) + {s₃ t₃ a₃ b₃ b₃' : α} + (hQ₃_ends : S.IsOmegaPathWithEnds Q₃ a₃ b₃) (ha₃U : a₃ ∈ U) (hb₃V : b₃ ∈ V) + (hP₃_ends : S.IsOmegaPathWithEnds P₃ s₃ t₃) (hQ₃_ends' : S.IsOmegaPathWithEnds Q₃ s₃ b₃') + (hb₃'_not_P : b₃' ∉ S.transactionEnds P_set) : + let P_set' := (P_set \ {P₃}) ∪ {Q₃} + S.IsFenceFor P_set' U V ∧ ¬ S.IsCrookedTransaction P_set' := by + intro P_set' + have hQ₃_not_diff : Q₃ ∉ P_set \ {P₃} := by + intro hQ₃_diff + have hdisj_P₃Q₃ : Disjoint V(P₃) V(Q₃) := + hSUV.isFenceFor_P.1.2 hP₃_in hQ₃_diff.1 (Ne.symm hQ₃_diff.2) + exact disjoint_left.mp hdisj_P₃Q₃ hmeet₃.some_mem.1 hmeet₃.some_mem.2 + -- `(U, V)` is a fence for `P_set'`. + have hfence_P' : S.IsFenceFor P_set' U V := by + refine ⟨⟨?_, ?_⟩, hSUV.isFenceFor_P.2.1, ?_⟩ + · rintro R (hR | rfl) + · exact hSUV.isFenceFor_P.1.1 R hR.1 + · exact ⟨a₃, b₃, hQ₃_ends⟩ + · rintro R₁ (hR₁ | rfl) R₂ (hR₂ | rfl) hne + · exact hSUV.isFenceFor_P.1.2 hR₁.1 hR₂.1 hne + · exact Disjoint.symm (by + by_contra hnot + rw [not_disjoint_iff_nonempty_inter] at hnot + exact hR₁.2 (huniq₃ R₁ hR₁.1 (inter_comm V(R₂) V(R₁) ▸ hnot))) + · by_contra hnot + rw [not_disjoint_iff_nonempty_inter] at hnot + exact hR₂.2 (huniq₃ R₂ hR₂.1 (inter_comm V(R₁) V(R₂) ▸ hnot)) + · exact (hne rfl).elim + · rintro R (hR | rfl) + · exact hSUV.isFenceFor_P.2.2 R hR.1 + · exact ⟨a₃, ha₃U, b₃, hb₃V, hQ₃_ends⟩ + -- `P_set'` is not crooked by minimality of `⋃ P_set ∪ ⋃ Q_set`. + have hnot_crooked_P' : ¬ S.IsCrookedTransaction P_set' := by + intro hcr' + have hfin_P : P_set.Finite := + hSUV.isFenceFor_P.1.finite S + have hcard_P' : P_set'.ncard = P_set.ncard := by + rw [ncard_union_eq (disjoint_singleton_right.mpr hQ₃_not_diff) + (hfin_P.subset sdiff_subset) (finite_singleton Q₃), + ncard_singleton, ncard_sdiff_singleton_of_mem hP₃_in] + have := hSUV.two_le_p + have := hSUV.card_P_ge + omega + have hP_le : ∀ M ∈ P_set, M ≤ S.G := + fun M hM => let ⟨_, _, h⟩ := hSUV.isFenceFor_P.1.1 M hM; h.1.1 + have hQ_le : ∀ M ∈ Q_set, M ≤ S.G := by + obtain ⟨_, _, hfQ⟩ := hSUV.isTransaction_Q + exact fun M hM => let ⟨_, _, h⟩ := hfQ.1.1 M hM; h.1.1 + have hP'_le : ∀ M ∈ P_set', M ≤ S.G := by + rintro M (hM | rfl) + · exact hP_le M hM.1 + · exact hQ_le M hQ₃ + have hUP_le : S.transactionUnion P_set ≤ S.G := subgraphSUnion_le hP_le + have hUP'_le : S.transactionUnion P_set' ≤ S.G := subgraphSUnion_le hP'_le + have hUQ_le : S.transactionUnion Q_set ≤ S.G := subgraphSUnion_le hQ_le + have hle_union : + subgraphUnion S.G (S.transactionUnion P_set') (S.transactionUnion Q_set) ≤ + subgraphUnion S.G (S.transactionUnion P_set) (S.transactionUnion Q_set) := by + rw [subgraphUnion_le_iff hUP'_le hUQ_le (subgraphUnion_le hUP_le hUQ_le)] + refine ⟨?_, le_subgraphUnion_right hUP_le hUQ_le⟩ + rw [(Compatible.of_le_le hUP'_le (subgraphUnion_le hUP_le hUQ_le)).le_iff] + refine ⟨?_, ?_⟩ + · intro v hv + change v ∈ ⋃ M ∈ P_set', V(M) at hv + rw [vertexSet_subgraphUnion] + rcases mem_iUnion₂.mp hv with ⟨R, hR | rfl, hvR⟩ + · exact Or.inl (mem_iUnion₂.mpr ⟨R, hR.1, hvR⟩) + · exact Or.inr (mem_iUnion₂.mpr ⟨R, hQ₃, hvR⟩) + · rw [show E(S.transactionUnion P_set') = ⋃ M ∈ P_set', E(M) from edgeSet_subgraphSUnion + hP'_le, + edgeSet_subgraphUnion hUP_le hUQ_le, + show E(S.transactionUnion P_set) = ⋃ M ∈ P_set, E(M) from edgeSet_subgraphSUnion hP_le, + show E(S.transactionUnion Q_set) = ⋃ M ∈ Q_set, E(M) from edgeSet_subgraphSUnion hQ_le] + intro e he + rcases mem_iUnion₂.mp he with ⟨R, hR | rfl, heR⟩ + · exact Or.inl (mem_iUnion₂.mpr ⟨R, hR.1, heR⟩) + · exact Or.inr (mem_iUnion₂.mpr ⟨R, hQ₃, heR⟩) + have heq_union := hSUV.minimal_union P_set' hcr' (hcard_P' ▸ hSUV.card_P_ge) hle_union + -- Every edge of `P₃` lies in `E(S.transactionUnion Q_set)`. + have hEP₃_sub_UQ : E(P₃) ⊆ E(S.transactionUnion Q_set) := by + intro e heP₃ + have he_rhs : e ∈ E(subgraphUnion S.G (S.transactionUnion P_set) (S.transactionUnion Q_set)) + := by + rw [edgeSet_subgraphUnion hUP_le hUQ_le] + exact Or.inl ((le_subgraphSUnion hP_le hP₃_in).edgeSet_mono heP₃) + rw [← heq_union, edgeSet_subgraphUnion hUP'_le hUQ_le] at he_rhs + rcases he_rhs with heP' | heQ + · rw [show E(S.transactionUnion P_set') = ⋃ M ∈ P_set', E(M) from + edgeSet_subgraphSUnion hP'_le] at heP' + rcases mem_iUnion₂.mp heP' with ⟨R, hR | rfl, heR⟩ + · exfalso + obtain ⟨x₃, y₃, hxy₃⟩ := P₃.exists_isLink_of_mem_edgeSet heP₃ + obtain ⟨xR, yR, hxyR⟩ := R.exists_isLink_of_mem_edgeSet heR + have hxy₃G : S.G.IsLink e x₃ y₃ := hxy₃.mono (hP_le P₃ hP₃_in) + have hxyRG : S.G.IsLink e xR yR := hxyR.mono (hP_le R hR.1) + rcases hxy₃G.left_eq_or_eq hxyRG with rfl | rfl + · exact disjoint_left.mp (hSUV.isFenceFor_P.1.2 hP₃_in hR.1 (Ne.symm hR.2)) + hxy₃.left_mem hxyR.left_mem + · exact disjoint_left.mp (hSUV.isFenceFor_P.1.2 hP₃_in hR.1 (Ne.symm hR.2)) + hxy₃.left_mem hxyR.right_mem + · exact (le_subgraphSUnion hQ_le hQ₃).edgeSet_mono heR + · exact heQ + -- Since `P₃` is a path starting at `s₃ ∈ V(Q₃)` and `Q_set` is pairwise vertex-disjoint, `t₃ + -- ∈ V(Q₃)`. + have ht₃_in_Q₃ : t₃ ∈ V(Q₃) := by + rcases hP₃_ends.1 with ⟨hP₃_le, W₃, _, hVP₃, hEP₃⟩ + have hs₃_in_Q₃ : s₃ ∈ V(Q₃) := hQ₃_ends'.1.left_mem + have h_ind : ∀ {u_w v_w : α} (W : GraphWalk P₃ u_w v_w), + (∀ e ∈ W.edges, e ∈ E(P₃)) → u_w ∈ V(Q₃) → v_w ∈ V(Q₃) := by + intro u_w v_w W + induction W with + | nil _ => + intro _ hu + exact hu + | @cons u_c w_c _ e_c he_c W_tail ih => + intro hW_edges hu_Q₃ + have he_P₃ : e_c ∈ E(P₃) := hW_edges e_c List.mem_cons_self + have he_UQ : e_c ∈ ⋃ M ∈ Q_set, E(M) := by + have h := hEP₃_sub_UQ he_P₃ + rwa [show E(S.transactionUnion Q_set) = ⋃ M ∈ Q_set, E(M) from + edgeSet_subgraphSUnion hQ_le] at h + obtain ⟨M, hM_in, he_M⟩ := mem_iUnion₂.mp he_UQ + obtain ⟨x_M, y_M, hxy_M⟩ := M.exists_isLink_of_mem_edgeSet he_M + have hxy_G : S.G.IsLink e_c x_M y_M := hxy_M.mono (hQ_le M hM_in) + have he_G : S.G.IsLink e_c u_c w_c := he_c.mono hP₃_le + have hu_M : u_c ∈ V(M) := by + rcases he_G.left_eq_or_eq hxy_G with rfl | rfl + · exact hxy_M.left_mem + · exact hxy_M.right_mem + have hw_M : w_c ∈ V(M) := by + rcases he_G.symm.left_eq_or_eq hxy_G with rfl | rfl + · exact hxy_M.left_mem + · exact hxy_M.right_mem + have hMQ₃ : M = Q₃ := by + by_contra hne + exact disjoint_left.mp + (hSUV.isTransaction_Q.choose_spec.choose_spec.1.2 hM_in hQ₃ hne) hu_M hu_Q₃ + subst hMQ₃ + exact ih (fun e he => hW_edges e (List.mem_cons_of_mem e_c he)) hw_M + exact h_ind W₃ (fun e he => by rwa [hEP₃, mem_ofPred_eq]) hs₃_in_Q₃ + have ht₃_ends_Q₃ : t₃ ∈ pathEnds S.G Q₃ := by + by_contra ht₃_not_end + exact disjoint_left.mp (hSUV.no_internal_in_bar Q₃ hQ₃) + ⟨ht₃_in_Q₃, ht₃_not_end⟩ hP₃_ends.2.2.2 + rw [hQ₃_ends'.1.pathEnds_eq, mem_insert_iff, mem_singleton_iff] at ht₃_ends_Q₃ + rcases ht₃_ends_Q₃ with rfl | rfl + · obtain ⟨u₃, hu₃U, v₃, hv₃V, hP₃_uv⟩ := hSUV.isFenceFor_P.2.2 P₃ hP₃_in + have huv_ne : u₃ ≠ v₃ := fun h => + disjoint_left.mp hSUV.isFenceFor_P.2.1.2.2.1 hu₃U (h ▸ hv₃V) + rcases hP₃_ends.ends_eq S hP₃_uv with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact huv_ne rfl + · exact huv_ne rfl + · exact hb₃'_not_P (hP₃_ends.mem_transactionEnds_right S hP₃_in) + exact ⟨hfence_P', hnot_crooked_P'⟩ + +private theorem not_all_five_half_covered {p : ℕ} {P_set Q_set : Set (Graph α β)} {A B : Set α} + (hS : S.StatementS p P_set Q_set A B) + {Q₁ Q₂ Q₃ Q₄ Q₅ : Graph α β} + (hQ₃ : Q₃ ∈ Q_set) + (hord : S.AreInOrder [Q₁, Q₂, Q₃, Q₄, Q₅]) + (hsep₂ : S.IsSeparatingOmegaPath Q₂) + (hsep₃ : S.IsSeparatingOmegaPath Q₃) + (hsep₄ : S.IsSeparatingOmegaPath Q₄) : + ¬ (S.IsHalfCovered P_set Q₁ ∧ S.IsHalfCovered P_set Q₂ ∧ S.IsHalfCovered P_set Q₃ ∧ + S.IsHalfCovered P_set Q₄ ∧ S.IsHalfCovered P_set Q₅) := by + rintro ⟨hcov₁, hcov₂, hcov₃, hcov₄, hcov₅⟩ + rcases hord with ⟨hpair, a_l, b_l, ha_len, hb_len, hends, hcw⟩ + simp only [List.length_cons, List.length_nil, Nat.reduceAdd] at ha_len hb_len + rcases a_l with _ | ⟨a₁, _ | ⟨a₂, _ | ⟨a₃, _ | ⟨a₄, _ | ⟨a₅, _ | _⟩⟩⟩⟩⟩ <;> simp at ha_len + rcases b_l with _ | ⟨b₁, _ | ⟨b₂, _ | ⟨b₃, _ | ⟨b₄, _ | ⟨b₅, _ | _⟩⟩⟩⟩⟩ <;> simp at hb_len + have hQ₁_ends : S.IsOmegaPathWithEnds Q₁ a₁ b₁ := hends 0 (by simp) + have hQ₂_ends : S.IsOmegaPathWithEnds Q₂ a₂ b₂ := hends 1 (by simp) + have hQ₃_ends : S.IsOmegaPathWithEnds Q₃ a₃ b₃ := hends 2 (by simp) + have hQ₄_ends : S.IsOmegaPathWithEnds Q₄ a₄ b₄ := hends 3 (by simp) + have hQ₅_ends : S.IsOmegaPathWithEnds Q₅ a₅ b₅ := hends 4 (by simp) + -- Helper to extract interval memberships from indices in `[a₅, a₄, a₃, a₂, a₁, b₁, b₂, b₃, b₄, + -- b₅]`. + have hmem_int : ∀ (i₁ i₂ i₃ : ℕ) (h12 : i₁ < i₂) (h23 : i₂ < i₃) + (h3 : i₃ < [a₅, a₄, a₃, a₂, a₁, b₁, b₂, b₃, b₄, b₅].length), + [a₅, a₄, a₃, a₂, a₁, b₁, b₂, b₃, b₄, b₅][i₂]'(Nat.lt_trans h23 h3) ∈ + S.Ω.interval + ([a₅, a₄, a₃, a₂, a₁, b₁, b₂, b₃, b₄, b₅][i₁]'(Nat.lt_trans h12 (Nat.lt_trans h23 h3))) + ([a₅, a₄, a₃, a₂, a₁, b₁, b₂, b₃, b₄, b₅][i₃]'h3) := + fun i₁ i₂ i₃ h12 h23 h3 => S.Ω.mem_interval_of_lt hcw h12 h23 h3 + -- Interval memberships for `(Q₁, Q₂, Q₃)`: + have ha₁_2 : a₁ ∈ S.Ω.interval a₂ b₂ := hmem_int 3 4 6 (by decide) (by decide) (by simp) + have hb₁_2 : b₁ ∈ S.Ω.interval a₂ b₂ := hmem_int 3 5 6 (by decide) (by decide) (by simp) + have ha₁_3 : a₁ ∈ S.Ω.interval a₃ b₃ := hmem_int 2 4 7 (by decide) (by decide) (by simp) + have hb₁_3 : b₁ ∈ S.Ω.interval a₃ b₃ := hmem_int 2 5 7 (by decide) (by decide) (by simp) + have ha₂_3 : a₂ ∈ S.Ω.interval a₃ b₃ := hmem_int 2 3 7 (by decide) (by decide) (by simp) + have hb₂_3 : b₂ ∈ S.Ω.interval a₃ b₃ := hmem_int 2 6 7 (by decide) (by decide) (by simp) + have ha₃_2 : a₃ ∈ S.Ω.interval b₂ a₂ := + S.Ω.mem_interval_rotate_right (hmem_int 2 3 6 (by decide) (by decide) (by simp)) + have hb₃_2 : b₃ ∈ S.Ω.interval b₂ a₂ := + S.Ω.mem_interval_rotate_left (hmem_int 3 6 7 (by decide) (by decide) (by simp)) + have hb₂_a₂b₃ : b₂ ∈ S.Ω.interval a₂ b₃ := hmem_int 3 6 7 (by decide) (by decide) (by simp) + -- Interval memberships for `(Q₅, Q₄, Q₃)` with swapped ends `(bᵢ, aᵢ)`: + have hb₅_4 : b₅ ∈ S.Ω.interval b₄ a₄ := + S.Ω.mem_interval_rotate_left (hmem_int 1 8 9 (by decide) (by decide) (by simp)) + have ha₅_4 : a₅ ∈ S.Ω.interval b₄ a₄ := + S.Ω.mem_interval_rotate_right (hmem_int 0 1 8 (by decide) (by decide) (by simp)) + have hb₅_3 : b₅ ∈ S.Ω.interval b₃ a₃ := + S.Ω.mem_interval_rotate_left (hmem_int 2 7 9 (by decide) (by decide) (by simp)) + have ha₅_3 : a₅ ∈ S.Ω.interval b₃ a₃ := + S.Ω.mem_interval_rotate_right (hmem_int 0 2 7 (by decide) (by decide) (by simp)) + have hb₄_3 : b₄ ∈ S.Ω.interval b₃ a₃ := + S.Ω.mem_interval_rotate_left (hmem_int 2 7 8 (by decide) (by decide) (by simp)) + have ha₄_3 : a₄ ∈ S.Ω.interval b₃ a₃ := + S.Ω.mem_interval_rotate_right (hmem_int 1 2 7 (by decide) (by decide) (by simp)) + have hb₃_4 : b₃ ∈ S.Ω.interval a₄ b₄ := hmem_int 1 7 8 (by decide) (by decide) (by simp) + have ha₃_4 : a₃ ∈ S.Ω.interval a₄ b₄ := hmem_int 1 2 8 (by decide) (by decide) (by simp) + have ha₄_b₄a₃ : a₄ ∈ S.Ω.interval b₄ a₃ := + S.Ω.mem_interval_rotate_right (hmem_int 1 2 8 (by decide) (by decide) (by simp)) + -- Pairwise disjointness of `Q₁, Q₂, Q₃, Q₄, Q₅`. + have hdisj : ∀ (i j : ℕ) (hi : i < 5) (hj : j < 5), i < j → + Disjoint V([Q₁, Q₂, Q₃, Q₄, Q₅][i]'hi) V([Q₁, Q₂, Q₃, Q₄, Q₅][j]'hj) := + List.pairwise_iff_getElem.mp hpair + have hdisj_12 : Disjoint V(Q₁) V(Q₂) := hdisj 0 1 (by decide) (by decide) (by decide) + have hdisj_13 : Disjoint V(Q₁) V(Q₃) := hdisj 0 2 (by decide) (by decide) (by decide) + have hdisj_23 : Disjoint V(Q₂) V(Q₃) := hdisj 1 2 (by decide) (by decide) (by decide) + have hdisj_34 : Disjoint V(Q₃) V(Q₄) := hdisj 2 3 (by decide) (by decide) (by decide) + have hdisj_35 : Disjoint V(Q₃) V(Q₅) := hdisj 2 4 (by decide) (by decide) (by decide) + have hdisj_45 : Disjoint V(Q₄) V(Q₅) := hdisj 3 4 (by decide) (by decide) (by decide) + -- By the proof of (4.4), each of `Q₂, Q₃, Q₄` has one end in `A` and one end in `B`. + have hends_AB : ∀ {Q_a Q_m Q_b : Graph α β} {x_a y_a x_m y_m x_b y_b : α}, + S.IsOmegaPathWithEnds Q_a x_a y_a → + S.IsOmegaPathWithEnds Q_m x_m y_m → + S.IsOmegaPathWithEnds Q_b x_b y_b → + S.IsSeparatingOmegaPath Q_m → + S.IsHalfCovered P_set Q_a → + S.IsHalfCovered P_set Q_m → + S.IsHalfCovered P_set Q_b → + x_a ∈ S.Ω.interval x_m y_m → y_a ∈ S.Ω.interval x_m y_m → + x_b ∈ S.Ω.interval y_m x_m → y_b ∈ S.Ω.interval y_m x_m → + (x_m ∈ A ∧ y_m ∈ B) ∨ (x_m ∈ B ∧ y_m ∈ A) := by + intro Q_a Q_m Q_b x_a y_a x_m y_m x_b y_b hQa hQm hQb hsep_m hc_a hc_m hc_b + hxa hym hxb hyb + have hnot_both : ∀ {U V : Set α}, S.IsFenceFor P_set U V → x_m ∈ U → y_m ∈ U → False := by + intro U V hfenceU hxmU hymU + rcases S.subset_interval_or_swap hfenceU.2.1 hxmU hymU hQm.2.1 with hV_ab | hV_ba + · rcases hc_b with ⟨P_b, hPb_in, _, _, s_b, t_b, _, _, _, hPb_ends, hQb', rfl, _, _⟩ + have hsb_ba : s_b ∈ S.Ω.interval y_m x_m := by + rcases hQb.ends_eq S hQb' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hxb + · exact hyb + have hsb_not_V : s_b ∉ V := + fun hsV => disjoint_left.mp (S.Ω.disjoint_interval_swap x_m y_m) (hV_ab hsV) hsb_ba + obtain ⟨u_b, _, v_b, hvV, hPb_uv⟩ := hfenceU.2.2 P_b hPb_in + have htb_V : t_b ∈ V := by + rcases hPb_ends.ends_eq S hPb_uv with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hvV + · exact (hsb_not_V hvV).elim + exact S.not_ends_in_both_intervals_of_separating_halfCovered + hQm hsep_m hc_m hPb_in (hPb_ends.symm S) (hV_ab htb_V) hsb_ba + · rcases hc_a with ⟨P_a, hPa_in, _, _, s_a, t_a, _, _, _, hPa_ends, hQa', rfl, _, _⟩ + have hsa_ab : s_a ∈ S.Ω.interval x_m y_m := by + rcases hQa.ends_eq S hQa' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hxa + · exact hym + have hsa_not_V : s_a ∉ V := + fun hsV => disjoint_left.mp (S.Ω.disjoint_interval_swap x_m y_m) hsa_ab (hV_ba hsV) + obtain ⟨u_a, _, v_a, hvV, hPa_uv⟩ := hfenceU.2.2 P_a hPa_in + have hta_V : t_a ∈ V := by + rcases hPa_ends.ends_eq S hPa_uv with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hvV + · exact (hsa_not_V hvV).elim + exact S.not_ends_in_both_intervals_of_separating_halfCovered + hQm hsep_m hc_m hPa_in hPa_ends hsa_ab (hV_ba hta_V) + have hxm_AB : x_m ∈ A ∪ B := by + rw [hS.isFenceFor_P.2.1.2.2.2.1]; exact hQm.2.2.1 + have hym_AB : y_m ∈ A ∪ B := by + rw [hS.isFenceFor_P.2.1.2.2.2.1]; exact hQm.2.2.2 + rcases hxm_AB with hxmA | hxmB <;> rcases hym_AB with hymA | hymB + · exact (hnot_both hS.isFenceFor_P hxmA hymA).elim + · exact Or.inl ⟨hxmA, hymB⟩ + · exact Or.inr ⟨hxmB, hymA⟩ + · exact (hnot_both hS.symm.isFenceFor_P hxmB hymB).elim + have hQ₂_AB : (a₂ ∈ A ∧ b₂ ∈ B) ∨ (a₂ ∈ B ∧ b₂ ∈ A) := + hends_AB hQ₁_ends hQ₂_ends hQ₃_ends hsep₂ hcov₁ hcov₂ hcov₃ ha₁_2 hb₁_2 ha₃_2 hb₃_2 + have hQ₃_AB : (a₃ ∈ A ∧ b₃ ∈ B) ∨ (a₃ ∈ B ∧ b₃ ∈ A) := + hends_AB hQ₂_ends hQ₃_ends hQ₄_ends hsep₃ hcov₂ hcov₃ hcov₄ ha₂_3 hb₂_3 ha₄_3 hb₄_3 + have hQ₄_AB : (a₄ ∈ A ∧ b₄ ∈ B) ∨ (a₄ ∈ B ∧ b₄ ∈ A) := + hends_AB hQ₃_ends hQ₄_ends hQ₅_ends hsep₄ hcov₃ hcov₄ hcov₅ ha₃_4 hb₃_4 ha₅_4 hb₅_4 + -- Choose `(U, V) ∈ {(A, B), (B, A)}` so that `a₃ ∈ U` and `b₃ ∈ V`. + have hmain : ∀ {U V : Set α}, S.StatementS p P_set Q_set U V → + a₃ ∈ U → b₃ ∈ V → + (a₂ ∈ U ∧ b₂ ∈ V ∨ a₂ ∈ V ∧ b₂ ∈ U) → + (a₄ ∈ U ∧ b₄ ∈ V ∨ a₄ ∈ V ∧ b₄ ∈ U) → False := by + intro U V hSUV ha₃U hb₃V hQ₂_UV hQ₄_UV + have ⟨ha₂U, hb₂V⟩ := hSUV.isFenceFor_P.2.1.same_side_of_mem_interval S.Ω + ha₃U hb₃V hQ₂_UV ha₂_3 hb₂_a₂b₃ + have ⟨hb₄V, ha₄U⟩ := hSUV.isFenceFor_P.2.1.symm.same_side_of_mem_interval S.Ω + hb₃V ha₃U (hQ₄_UV.imp And.symm And.symm) hb₄_3 ha₄_b₄a₃ + -- Let `P₃` be the unique member of `P_set` meeting `Q₃`. + have hcov₃' : S.IsHalfCovered P_set Q₃ := hcov₃ + rcases hcov₃ with ⟨P₃, hP₃_in, hmeet₃, huniq₃, s₃, t₃, a₃', b₃', _, hP₃_ends, hQ₃_ends', + rfl, hb₃'_not_P, _⟩ + let P_set' : Set (Graph α β) := (P_set \ {P₃}) ∪ {Q₃} + obtain ⟨hfence_P', hnot_crooked_P'⟩ := + replacement_of_half_covered_path S hSUV hP₃_in hQ₃ hmeet₃ huniq₃ + hQ₃_ends ha₃U hb₃V hP₃_ends hQ₃_ends' hb₃'_not_P + -- Since `P_set'` is a transaction and not crooked, some `R ∈ P_set'` is peripheral in `P_set'`. + have hex_periph : ∃ R ∈ P_set', S.IsPeripheralIn P_set' R := by + by_contra hno + push Not at hno + exact hnot_crooked_P' ⟨⟨U, V, hfence_P'⟩, hno⟩ + rcases hex_periph with ⟨R, hR_diff | rfl, hperiph⟩ + · -- `R ∈ P_set \ {P₃}` is peripheral in `P_set'`. + obtain ⟨a, haU, b, hbV, hR_ab⟩ := hSUV.isFenceFor_P.2.2 R hR_diff.1 + rcases hperiph with ⟨_, a', b', hR_a'b', hdisj_int⟩ + have hdisj_ab_or_ba : + Disjoint (S.Ω.interval a b) (S.transactionEnds P_set') ∨ + Disjoint (S.Ω.interval b a) (S.transactionEnds P_set') := by + rcases hR_ab.ends_eq S hR_a'b' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hdisj_int + · exact hdisj_int.symm + rcases hdisj_ab_or_ba with hdisj_ab | hdisj_ba + · exact S.half_covered_side_contradiction hSUV.isFenceFor_P hSUV.isCrooked_P hP₃_in + hQ₁_ends hQ₂_ends hQ₃_ends ha₂U hb₂V ha₃U hb₃V + ha₁_2 hb₁_2 ha₁_3 hb₁_3 ha₂_3 hb₂_3 ha₃_2 hb₃_2 + hdisj_12 hdisj_13 hdisj_23 hsep₂ hcov₁ hcov₂ hcov₃' + hmeet₃ (Or.inr ⟨R, hR_diff, a, haU, b, hbV, hR_ab, hdisj_ab⟩) + · exact S.half_covered_side_contradiction hSUV.symm.isFenceFor_P hSUV.isCrooked_P hP₃_in + (hQ₅_ends.symm S) (hQ₄_ends.symm S) (hQ₃_ends.symm S) hb₄V ha₄U hb₃V ha₃U + hb₅_4 ha₅_4 hb₅_3 ha₅_3 hb₄_3 ha₄_3 hb₃_4 ha₃_4 + hdisj_45.symm hdisj_35.symm hdisj_34.symm hsep₄ hcov₅ hcov₄ hcov₃' + hmeet₃ (Or.inr ⟨R, hR_diff, b, hbV, a, haU, hR_ab.symm S, hdisj_ba⟩) + · -- `Q₃` is peripheral in `P_set'`. + rcases hperiph with ⟨_, a', b', hQ₃_a'b', hdisj_int⟩ + have hdisj_ab_or_ba : + Disjoint (S.Ω.interval a₃ b₃) (S.transactionEnds P_set') ∨ + Disjoint (S.Ω.interval b₃ a₃) (S.transactionEnds P_set') := by + rcases hQ₃_ends.ends_eq S hQ₃_a'b' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hdisj_int + · exact hdisj_int.symm + rcases hdisj_ab_or_ba with hdisj_ab | hdisj_ba + · exact S.half_covered_side_contradiction hSUV.isFenceFor_P hSUV.isCrooked_P hP₃_in + hQ₁_ends hQ₂_ends hQ₃_ends ha₂U hb₂V ha₃U hb₃V + ha₁_2 hb₁_2 ha₁_3 hb₁_3 ha₂_3 hb₂_3 ha₃_2 hb₃_2 + hdisj_12 hdisj_13 hdisj_23 hsep₂ hcov₁ hcov₂ hcov₃' + hmeet₃ (Or.inl hdisj_ab) + · exact S.half_covered_side_contradiction hSUV.symm.isFenceFor_P hSUV.isCrooked_P hP₃_in + (hQ₅_ends.symm S) (hQ₄_ends.symm S) (hQ₃_ends.symm S) hb₄V ha₄U hb₃V ha₃U + hb₅_4 ha₅_4 hb₅_3 ha₅_3 hb₄_3 ha₄_3 hb₃_4 ha₃_4 + hdisj_45.symm hdisj_35.symm hdisj_34.symm hsep₄ hcov₅ hcov₄ hcov₃' + hmeet₃ (Or.inl hdisj_ba) + rcases hQ₃_AB with ⟨ha₃A, hb₃B⟩ | ⟨ha₃B, hb₃A⟩ + · exact hmain hS ha₃A hb₃B hQ₂_AB hQ₄_AB + · exact hmain hS.symm ha₃B hb₃A hQ₂_AB.symm hQ₄_AB.symm + +/-! ## Proof of (4.6) (page 52) -/ + +/-- **Graph Minors IX, (4.5)** (pages 51–52): +"(4.5) *Let S be true, and let $Q_1, Q_2, Q_3, Q_4, Q_5 \in \mathscr{Q}$ be in order. Suppose that +$Q_2, Q_3, Q_4$ are all separating. Then not all of $Q_1, ..., Q_5$ are half-covered.*" -/ +theorem theorem_4_5_proof {p : ℕ} {P_set Q_set : Set (Graph α β)} {A B : Set α} + (hS : S.StatementS p P_set Q_set A B) + {Q₁ Q₂ Q₃ Q₄ Q₅ : Graph α β} + (_hQ₁ : Q₁ ∈ Q_set) (_hQ₂ : Q₂ ∈ Q_set) (hQ₃ : Q₃ ∈ Q_set) + (_hQ₄ : Q₄ ∈ Q_set) (_hQ₅ : Q₅ ∈ Q_set) + (hord : S.AreInOrder [Q₁, Q₂, Q₃, Q₄, Q₅]) + (hsep₂ : S.IsSeparatingOmegaPath Q₂) + (hsep₃ : S.IsSeparatingOmegaPath Q₃) + (hsep₄ : S.IsSeparatingOmegaPath Q₄) : + ¬ (S.IsHalfCovered P_set Q₁ ∧ S.IsHalfCovered P_set Q₂ ∧ S.IsHalfCovered P_set Q₃ ∧ + S.IsHalfCovered P_set Q₄ ∧ S.IsHalfCovered P_set Q₅) := by + exact S.not_all_five_half_covered hS hQ₃ hord hsep₂ hsep₃ hsep₄ + +/-- Under Statement **S** with `p ≠ 3`, `|P_set| = p` by `(3.4)` and minimality of `|P_set|`. -/ +theorem StatementS.card_P_eq {p : ℕ} {P_set Q_set : Set (Graph α β)} {A B : Set α} + (hS : S.StatementS p P_set Q_set A B) (hp3 : p ≠ 3) : + P_set.ncard = p := by + obtain ⟨P_set', hsub, hcard_eq, hcr'⟩ := + S.theorem_3_4_proof hS.two_le_p hp3 hS.isCrooked_P hS.card_P_ge + have hP_le : ∀ M ∈ P_set, M ≤ S.G := + fun M hM => let ⟨_, _, h⟩ := hS.isFenceFor_P.1.1 M hM; h.1.1 + have hP'_le : ∀ M ∈ P_set', M ≤ S.G := fun M hM => hP_le M (hsub hM) + have hQ_le : ∀ M ∈ Q_set, M ≤ S.G := by + obtain ⟨_, _, hfQ⟩ := hS.isTransaction_Q + exact fun M hM => let ⟨_, _, h⟩ := hfQ.1.1 M hM; h.1.1 + have hUP_le : S.transactionUnion P_set ≤ S.G := subgraphSUnion_le hP_le + have hUP'_le : S.transactionUnion P_set' ≤ S.G := subgraphSUnion_le hP'_le + have hUQ_le : S.transactionUnion Q_set ≤ S.G := subgraphSUnion_le hQ_le + have hle_union : + subgraphUnion S.G (S.transactionUnion P_set') (S.transactionUnion Q_set) ≤ + subgraphUnion S.G (S.transactionUnion P_set) (S.transactionUnion Q_set) := + (subgraphUnion_le_iff hUP'_le hUQ_le (subgraphUnion_le hUP_le hUQ_le)).mpr + ⟨(subgraphSUnion_mono hP_le hsub).trans (le_subgraphUnion_left hUP_le hUQ_le), + le_subgraphUnion_right hUP_le hUQ_le⟩ + have heq_union := hS.minimal_union P_set' hcr' (by omega) hle_union + have hle_card := hS.minimal_card P_set' hcr' (by omega) heq_union + have := hS.card_P_ge + omega + +/-- If `F` is a finite set of pairwise vertex-disjoint graphs and each `Q ∈ F` has at least `k` +vertices in a finite set `W`, then `⋃ Q ∈ F, (V(Q) ∩ W)` has at least `k * F.ncard` vertices. -/ +theorem mul_ncard_le_ncard_biUnion {F : Set (Graph α β)} {W : Set α} {k : ℕ} + (hfin_F : F.Finite) (hfin_W : W.Finite) + (hdisj : F.PairwiseDisjoint (fun Q => V(Q))) + (hk : ∀ Q ∈ F, k ≤ (V(Q) ∩ W).ncard) : + k * F.ncard ≤ (⋃ Q ∈ F, (V(Q) ∩ W)).ncard := by + induction F, hfin_F using Set.Finite.induction_on with + | empty => simp + | @insert Q F hQ_not hfin ih => + have hdisj_F : F.PairwiseDisjoint (fun R => V(R)) := + hdisj.subset (subset_insert Q F) + have hk_F : ∀ R ∈ F, k ≤ (V(R) ∩ W).ncard := + fun R hR => hk R (mem_insert_of_mem Q hR) + have ih' := ih hdisj_F hk_F + have hk_Q : k ≤ (V(Q) ∩ W).ncard := hk Q (mem_insert Q F) + rw [biUnion_insert, ncard_insert_of_notMem hQ_not hfin] + have hdisj_QW : Disjoint (V(Q) ∩ W) (⋃ R ∈ F, (V(R) ∩ W)) := by + rw [disjoint_left] + intro v hvQ hvF + simp only [mem_iUnion, exists_prop] at hvF + rcases hvF with ⟨R, hR, hvR⟩ + have hne : Q ≠ R := fun h => hQ_not (h ▸ hR) + exact disjoint_left.mp (hdisj (mem_insert Q F) (mem_insert_of_mem Q hR) hne) hvQ.1 hvR.1 + have hfin_QW : (V(Q) ∩ W).Finite := hfin_W.subset inter_subset_right + have hfin_FW : (⋃ R ∈ F, (V(R) ∩ W)).Finite := + hfin_W.subset (iUnion₂_subset fun _ _ => inter_subset_right) + rw [ncard_union_eq hdisj_QW hfin_QW hfin_FW, Nat.mul_add, Nat.mul_one] + omega + +/-- **Graph Minors IX, (4.6)** (page 52): +"Let $S$ be true, with $p \ge 2$ and $p \ne 3$, let $|\mathcal{Q}| = p + 4$, and let every +member of $\mathcal{Q}$ be separating. Then $Q \cap \bigcup \mathcal{P}$ is null for some $Q +\in \mathcal{Q}$." -/ +theorem theorem_4_6_proof {p : ℕ} {P_set Q_set : Set (Graph α β)} {A B : Set α} + (hS : S.StatementS p P_set Q_set A B) (hp3 : p ≠ 3) + (hcard_Q : Q_set.ncard = p + 4) + (hsep : ∀ Q ∈ Q_set, S.IsSeparatingOmegaPath Q) : + ∃ Q ∈ Q_set, Disjoint V(Q) V(S.transactionUnion P_set) := by + by_contra hno + push Not at hno + have hmeet : ∀ Q ∈ Q_set, (V(Q) ∩ V(S.transactionUnion P_set)).Nonempty := by + intro Q hQ + exact not_disjoint_iff_nonempty_inter.mp (hno Q hQ) + obtain ⟨A_Q, B_Q, hfence_Q⟩ := hS.isTransaction_Q + have hfin_Q : Q_set.Finite := hfence_Q.1.finite S + -- Let `H` be the set of half-covered members of `Q_set`, and `C` the set of members of `Q_set` + -- with both ends in `V(P_set)`. + let H : Set (Graph α β) := {Q ∈ Q_set | S.IsHalfCovered P_set Q} + let C : Set (Graph α β) := {Q ∈ Q_set | pathEnds S.G Q ⊆ S.transactionEnds P_set} + have hH_sub : H ⊆ Q_set := fun _ h => h.1 + have hC_sub : C ⊆ Q_set := fun _ h => h.1 + have hfin_H : H.Finite := hfin_Q.subset hH_sub + have hfin_C : C.Finite := hfin_Q.subset hC_sub + -- `H` and `C` are disjoint because a half-covered path has an end not in `V(P_set)`. + have hdisj_HC : Disjoint H C := by + rw [disjoint_left] + intro Q ⟨_, hcov⟩ ⟨_, hboth⟩ + rcases hcov with ⟨_, _, _, _, s, t, a, b, _, _, hQ_ends, rfl, hnot_in, _⟩ + have hb_ends : b ∈ pathEnds S.G Q := by + rw [hQ_ends.1.pathEnds_eq] + exact Or.inr rfl + exact hnot_in (hboth hb_ends) + -- By (4.5), `H.ncard ≤ 4`. + have hH_le_4 : H.ncard ≤ 4 := by + by_contra hgt + obtain ⟨H₅, hH₅_sub, hH₅_card⟩ := Set.exists_subset_card_eq (by omega : 5 ≤ H.ncard) + have hH₅_Q : H₅ ⊆ Q_set := hH₅_sub.trans hH_sub + have htr_H₅ : S.IsTransaction H₅ := + ⟨A_Q, B_Q, ⟨fun Q hQ => hfence_Q.1.1 Q (hH₅_Q hQ), + fun Q₁ hQ₁ Q₂ hQ₂ hne => hfence_Q.1.2 (hH₅_Q hQ₁) (hH₅_Q hQ₂) hne⟩, + hfence_Q.2.1, fun Q hQ => hfence_Q.2.2 Q (hH₅_Q hQ)⟩ + have hno_cr_H₅ : ∀ Q₁ ∈ H₅, ∀ Q₂ ∈ H₅, ¬ S.OmegaPathsCross Q₁ Q₂ := by + intro Q₁ _ Q₂ hQ₂ hcr + exact (hsep Q₂ (hH₅_Q hQ₂)).2 ⟨Q₁, hcr⟩ + obtain ⟨Q_l, hQl_len, _, hQl_set, hQl_ord⟩ := + htr_H₅.exists_areInOrder_of_not_cross S hno_cr_H₅ + rw [hH₅_card] at hQl_len + rcases Q_l with _ | ⟨Q₁, _ | ⟨Q₂, _ | ⟨Q₃, _ | ⟨Q₄, _ | ⟨Q₅, _ | _⟩⟩⟩⟩⟩ <;> simp at hQl_len + have hmem_H₅ : ∀ Q ∈ ([Q₁, Q₂, Q₃, Q₄, Q₅] : List (Graph α β)), Q ∈ H₅ := by + intro Q hQ + rw [← hQl_set] + exact hQ + have h₁ : Q₁ ∈ H := hH₅_sub (hmem_H₅ Q₁ (by simp)) + have h₂ : Q₂ ∈ H := hH₅_sub (hmem_H₅ Q₂ (by simp)) + have h₃ : Q₃ ∈ H := hH₅_sub (hmem_H₅ Q₃ (by simp)) + have h₄ : Q₄ ∈ H := hH₅_sub (hmem_H₅ Q₄ (by simp)) + have h₅ : Q₅ ∈ H := hH₅_sub (hmem_H₅ Q₅ (by simp)) + exact S.not_all_five_half_covered hS h₃.1 hQl_ord + (hsep Q₂ h₂.1) (hsep Q₃ h₃.1) (hsep Q₄ h₄.1) + ⟨h₁.2, h₂.2, h₃.2, h₄.2, h₅.2⟩ + -- By (4.3), `Q_set \ (H ∪ C)` has at most 1 element. + let R_set : Set (Graph α β) := Q_set \ (H ∪ C) + have hfin_R : R_set.Finite := hfin_Q.subset sdiff_subset + have hR_le_1 : R_set.ncard ≤ 1 := by + rw [Set.ncard_le_one_iff hfin_R] + intro Q₁ Q₂ ⟨hQ₁_in, hQ₁_not⟩ ⟨hQ₂_in, hQ₂_not⟩ + refine (S.theorem_4_3_proof hS).1 Q₁ hQ₁_in Q₂ hQ₂_in ?_ ?_ + · rintro (hdisj₁ | hboth₁ | hcov₁) + · exact hno Q₁ hQ₁_in hdisj₁ + · exact hQ₁_not (Or.inr ⟨hQ₁_in, hboth₁⟩) + · exact hQ₁_not (Or.inl ⟨hQ₁_in, hcov₁⟩) + · rintro (hdisj₂ | hboth₂ | hcov₂) + · exact hno Q₂ hQ₂_in hdisj₂ + · exact hQ₂_not (Or.inr ⟨hQ₂_in, hboth₂⟩) + · exact hQ₂_not (Or.inl ⟨hQ₂_in, hcov₂⟩) + -- Since `Q_set = (H ∪ C) ∪ R_set`, we get `p + 3 ≤ H.ncard + C.ncard`. + have hQ_eq : Q_set = (H ∪ C) ∪ R_set := + (union_sdiff_cancel (union_subset hH_sub hC_sub)).symm + have hcard_HC_ge : p + 3 ≤ H.ncard + C.ncard := by + have hle1 : Q_set.ncard ≤ (H ∪ C).ncard + R_set.ncard := by + rw [hQ_eq] + exact ncard_union_le (H ∪ C) R_set + have hle2 : (H ∪ C).ncard = H.ncard + C.ncard := + ncard_union_eq hdisj_HC hfin_H hfin_C + omega + -- Count the ends in `W_P = S.transactionEnds P_set`. + let W_P : Set α := S.transactionEnds P_set + have hfin_WP : W_P.Finite := S.finite_V.subset ((S.transactionEnds_subset_bar P_set).trans + S.bar_subset) + have hH_ends : ∀ Q ∈ H, 1 ≤ (V(Q) ∩ W_P).ncard := by + intro Q ⟨_, hcov⟩ + rcases hcov with ⟨P, hP_in, _, _, s, t, a, b, _, hP_ends, hQ_ends, rfl, _, _⟩ + exact Nat.succ_le_iff.mpr ((ncard_pos (hfin_WP.subset inter_subset_right)).mpr + ⟨s, hQ_ends.1.left_mem, hP_ends.mem_transactionEnds_left S hP_in⟩) + have hC_ends : ∀ Q ∈ C, 2 ≤ (V(Q) ∩ W_P).ncard := by + intro Q ⟨hQ_in, hboth⟩ + rcases hfence_Q.1.1 Q hQ_in with ⟨a, b, hQ_ends⟩ + have ha_ends : a ∈ pathEnds S.G Q := by + rw [hQ_ends.1.pathEnds_eq] + exact Or.inl rfl + have hb_ends : b ∈ pathEnds S.G Q := by + rw [hQ_ends.1.pathEnds_eq] + exact Or.inr rfl + have ha_in : a ∈ V(Q) ∩ W_P := ⟨hQ_ends.1.left_mem, hboth ha_ends⟩ + have hb_in : b ∈ V(Q) ∩ W_P := ⟨hQ_ends.1.right_mem, hboth hb_ends⟩ + have hsub : ({a, b} : Set α) ⊆ V(Q) ∩ W_P := by + rintro z (rfl | rfl) + · exact ha_in + · exact hb_in + have hcard_ab : ({a, b} : Set α).ncard = 2 := ncard_pair hQ_ends.2.1 + rw [← hcard_ab] + exact ncard_le_ncard hsub (hfin_WP.subset inter_subset_right) + have hdisj_Q : Q_set.PairwiseDisjoint (fun Q => V(Q)) := + fun Q₁ hQ₁ Q₂ hQ₂ hne => hfence_Q.1.2 hQ₁ hQ₂ hne + let U_H : Set α := ⋃ Q ∈ H, (V(Q) ∩ W_P) + let U_C : Set α := ⋃ Q ∈ C, (V(Q) ∩ W_P) + have hU_H : 1 * H.ncard ≤ U_H.ncard := + mul_ncard_le_ncard_biUnion hfin_H hfin_WP (hdisj_Q.subset hH_sub) hH_ends + have hU_C : 2 * C.ncard ≤ U_C.ncard := + mul_ncard_le_ncard_biUnion hfin_C hfin_WP (hdisj_Q.subset hC_sub) hC_ends + have hdisj_U : Disjoint U_H U_C := by + rw [disjoint_left] + intro v hvH hvC + simp only [U_H, U_C, mem_iUnion, exists_prop] at hvH hvC + rcases hvH with ⟨Q₁, hQ₁H, hv₁⟩ + rcases hvC with ⟨Q₂, hQ₂C, hv₂⟩ + have hne : Q₁ ≠ Q₂ := fun h => disjoint_left.mp hdisj_HC hQ₁H (h ▸ hQ₂C) + exact disjoint_left.mp (hfence_Q.1.2 (hH_sub hQ₁H) (hC_sub hQ₂C) hne) hv₁.1 hv₂.1 + have hfin_UH : U_H.Finite := hfin_WP.subset (iUnion₂_subset fun _ _ => inter_subset_right) + have hfin_UC : U_C.Finite := hfin_WP.subset (iUnion₂_subset fun _ _ => inter_subset_right) + have hsub_WP : U_H ∪ U_C ⊆ W_P := + union_subset (iUnion₂_subset fun _ _ => inter_subset_right) + (iUnion₂_subset fun _ _ => inter_subset_right) + have hle_WP : U_H.ncard + U_C.ncard ≤ W_P.ncard := by + rw [← ncard_union_eq hdisj_U hfin_UH hfin_UC] + exact ncard_le_ncard hsub_WP hfin_WP + have hWP_eq : W_P.ncard = 2 * p := by + rw [(hS.isFenceFor_P.ncard_transactionEnds S).2.2, hS.card_P_eq S hp3] + omega + +end Society + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section5a.lean b/LeanPool/GraphMinor/GM09/Section5a.lean new file mode 100644 index 0000000000..ac3ccb4874 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section5a.lean @@ -0,0 +1,544 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2a +import LeanPool.GraphMinor.GM09.Section2d +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section3c +import LeanPool.GraphMinor.GM09.Section4a +import LeanPool.GraphMinor.GM09.Section4b +import LeanPool.GraphMinor.GM09.Section4c +import Mathlib.Data.Set.Card + +/-! +# Graph Minors IX, Section 5 (Part A): Separations and Crosses (5.1)–(5.2) + +This file formalizes (5.1) and (5.2) from Section 5 of +N. Robertson and P. D. Seymour, *Graph Minors. IX. Disjoint crossed paths*, +J. Combin. Theory Ser. B **49** (1990) 40–77 (pages 52–53): +- `(5.1)` (`theorem_5_1`, page 52): if `Q` is a separating `Ω`-path with ends `a, b` and `P_set` + is a crooked transaction disjoint from `Q` with `V(P_set) ∩ Ω(a, b) ≠ ∅`, then there is a cross + in `P_set` with all four ends in `Ω(a, b)`. +- `(5.2)` (`theorem_5_2`, pages 52–53): given `{Q₁, …, Q_{p+4}}` separating and in order and a + separation `(G₁, G₂)` along `Q_{p+4}`, either `(G, Ω)` has a cross disjoint from `G₂` or a + crooked transaction of cardinality `p` with no end in `Ω(a₁, b₁)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Clockwise sequences of indexed endpoint pairs -/ + +namespace CyclicPerm + +variable (Ω : CyclicPerm α) + +/-- If `u, v ∈ Ω.interval a b` and `u ≠ v`, then either `Ω.interval u v ⊆ Ω.interval a b` or +`Ω.interval v u ⊆ Ω.interval a b`. -/ +theorem interval_subset_interval_or_swap {a b u v : α} + (hu : u ∈ Ω.interval a b) (hv : v ∈ Ω.interval a b) (huv : u ≠ v) : + Ω.interval u v ⊆ Ω.interval a b ∨ Ω.interval v u ⊆ Ω.interval a b := by + have hv' : v ∈ Ω.interval a u ∪ {u} ∪ Ω.interval u b := by + rw [← Ω.interval_eq_union_of_mem hu] + exact hv + rcases hv' with (hv_au | rfl) | hv_ub + · exact Or.inr ((Ω.interval_subset_interval_right hv_au).trans + (Ω.interval_subset_interval_left hu)) + · exact (huv rfl).elim + · exact Or.inl ((Ω.interval_subset_interval_left hv_ub).trans + (Ω.interval_subset_interval_right hu)) + +/-- If `(a_m, …, a₁, b₁, …, b_m)` is `Ω`-clockwise (`(List.ofFn a).reverse ++ List.ofFn b`) and +`i < j` in `Fin m`, then `a i, b i ∈ Ω.interval (a j) (b j)`, +`Ω.interval (a i) (b i) ⊆ Ω.interval (a j) (b j)`, and `a j, b j ∈ Ω.interval (b i) (a i)`. -/ +theorem mem_intervals_of_isClockwiseSeq_ofFn {m : ℕ} {a b : Fin m → α} + (hcw : Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) + {i j : Fin m} (hij : i < j) : + a i ∈ Ω.interval (a j) (b j) ∧ + b i ∈ Ω.interval (a j) (b j) ∧ + Ω.interval (a i) (b i) ⊆ Ω.interval (a j) (b j) ∧ + a j ∈ Ω.interval (b i) (a i) ∧ + b j ∈ Ω.interval (b i) (a i) := by + have hi_lt : i.1 < m := i.2 + have hj_lt : j.1 < m := j.2 + have hij_val : i.1 < j.1 := hij + let L := (List.ofFn a).reverse ++ List.ofFn b + have hlen_rev : (List.ofFn a).reverse.length = m := by simp + have hlen_b : (List.ofFn b).length = m := by simp + have hlen : L.length = m + m := by + simp [L, List.length_append] + have idx_aj_lt : m - 1 - j.1 < L.length := by omega + have idx_ai_lt : m - 1 - i.1 < L.length := by omega + have idx_bi_lt : m + i.1 < L.length := by omega + have idx_bj_lt : m + j.1 < L.length := by omega + have hL_aj : L[m - 1 - j.1]'idx_aj_lt = a j := by + rw [List.getElem_append_left (by omega)] + rw [List.getElem_reverse] + simp only [List.length_ofFn, List.getElem_ofFn] + congr 1; ext; dsimp; omega + have hL_ai : L[m - 1 - i.1]'idx_ai_lt = a i := by + rw [List.getElem_append_left (by omega)] + rw [List.getElem_reverse] + simp only [List.length_ofFn, List.getElem_ofFn] + congr 1; ext; dsimp; omega + have hL_bi : L[m + i.1]'idx_bi_lt = b i := by + rw [List.getElem_append_right (by omega)] + simp only [hlen_rev, List.getElem_ofFn] + congr 1; ext; dsimp; omega + have hL_bj : L[m + j.1]'idx_bj_lt = b j := by + rw [List.getElem_append_right (by omega)] + simp only [hlen_rev, List.getElem_ofFn] + congr 1; ext; dsimp; omega + have hai_ajbi : a i ∈ Ω.interval (a j) (b i) := by + have h := Ω.mem_interval_of_lt hcw (i₁ := m - 1 - j.1) (i₂ := m - 1 - i.1) (i₃ := m + i.1) + (by omega) (by omega) idx_bi_lt + rwa [hL_aj, hL_ai, hL_bi] at h + have hbi_ajbj : b i ∈ Ω.interval (a j) (b j) := by + have h := Ω.mem_interval_of_lt hcw (i₁ := m - 1 - j.1) (i₂ := m + i.1) (i₃ := m + j.1) + (by omega) (by omega) idx_bj_lt + rwa [hL_aj, hL_bi, hL_bj] at h + have hai_ajbj : a i ∈ Ω.interval (a j) (b j) := by + have h := Ω.mem_interval_of_lt hcw (i₁ := m - 1 - j.1) (i₂ := m - 1 - i.1) (i₃ := m + j.1) + (by omega) (by omega) idx_bj_lt + rwa [hL_aj, hL_ai, hL_bj] at h + have hbi_aibj : b i ∈ Ω.interval (a i) (b j) := by + have h := Ω.mem_interval_of_lt hcw (i₁ := m - 1 - i.1) (i₂ := m + i.1) (i₃ := m + j.1) + (by omega) (by omega) idx_bj_lt + rwa [hL_ai, hL_bi, hL_bj] at h + have hsub : Ω.interval (a i) (b i) ⊆ Ω.interval (a j) (b j) := + (Ω.interval_subset_interval_left hbi_aibj).trans + (Ω.interval_subset_interval_right hai_ajbj) + have haj_biai : a j ∈ Ω.interval (b i) (a i) := + Ω.mem_interval_rotate_right hai_ajbi + have hbj_biai : b j ∈ Ω.interval (b i) (a i) := + Ω.mem_interval_rotate_left hbi_aibj + exact ⟨hai_ajbj, hbi_ajbj, hsub, haj_biai, hbj_biai⟩ + +end CyclicPerm + +/-! ## Proof of (5.1) (page 52) -/ + +namespace Society + +variable (S : Society α β) + +/-- If `Q` is a separating `Ω`-path with ends `a, b` and `P` is an `Ω`-path disjoint from `Q` with +an end `s ∈ Ω(a, b)`, then both ends of `P` lie in `Ω(a, b)`. -/ +theorem both_ends_mem_interval_of_separating {Q P : Graph α β} {a b s t : α} + (hQ_ends : S.IsOmegaPathWithEnds Q a b) + (hQ_sep : S.IsSeparatingOmegaPath Q) + (hP_ends : S.IsOmegaPathWithEnds P s t) + (hdisj : Disjoint V(P) V(Q)) + (hs_in : s ∈ S.Ω.interval a b) : + t ∈ S.Ω.interval a b := by + have hab : a ≠ b := (S.Ω.isClockwise3_iff.mp hs_in.2).2.1 + have ht_ne_a : t ≠ a := fun h => + disjoint_left.mp hdisj hP_ends.1.right_mem (h ▸ hQ_ends.1.left_mem) + have ht_ne_b : t ≠ b := fun h => + disjoint_left.mp hdisj hP_ends.1.right_mem (h ▸ hQ_ends.1.right_mem) + rcases S.Ω.mem_interval_or_interval_swap hQ_ends.2.2.1 hQ_ends.2.2.2 + hP_ends.2.2.2 hab ht_ne_a ht_ne_b with ht_ab | ht_ba + · exact ht_ab + · exfalso + have hcr_ends : S.Ω.Crosses a b s t := + S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hs_in, ht_ba⟩) + exact hQ_sep.2 ⟨P, hdisj, s, t, a, b, hP_ends, hQ_ends, hcr_ends.symm⟩ + +/-- A crooked transaction crosses inside an interval if the paths with an end there +are disjoint from a separating path across the interval. -/ +theorem exists_cross_in_interval_of_disjoint_paths + {Q : Graph α β} {a b : α} {P_set : Set (Graph α β)} + (hQ_ends : S.IsOmegaPathWithEnds Q a b) + (hQ_sep : S.IsSeparatingOmegaPath Q) + (hcrooked : S.IsCrookedTransaction P_set) + (hdisj : ∀ R ∈ P_set, (pathEnds S.G R ∩ S.Ω.interval a b).Nonempty → Disjoint V(R) V(Q)) + (hne : (S.transactionEnds P_set ∩ S.Ω.interval a b).Nonempty) : + ∃ P₁ ∈ P_set, ∃ P₂ ∈ P_set, + S.OmegaPathsCross P₁ P₂ ∧ + pathEnds S.G P₁ ⊆ S.Ω.interval a b ∧ + pathEnds S.G P₂ ⊆ S.Ω.interval a b := by + obtain ⟨A, B, hfence⟩ := hcrooked.1 + -- Every `R ∈ P_set` with an end in `Ω(a, b)` has ends `s, t ∈ Ω(a, b)` with `Ω(s, t) ⊆ Ω(a, b)`. + have hex_good : ∀ R ∈ P_set, (pathEnds S.G R ∩ S.Ω.interval a b).Nonempty → + ∃ s t : α, S.IsOmegaPathWithEnds R s t ∧ + s ∈ S.Ω.interval a b ∧ t ∈ S.Ω.interval a b ∧ + S.Ω.interval s t ⊆ S.Ω.interval a b := by + intro R hR ⟨x, hx_end, hx_ab⟩ + obtain ⟨u, huA, v, hvB, hR_uv⟩ := hfence.2.2 R hR + have huv_ne : u ≠ v := fun h => disjoint_left.mp hfence.2.1.2.2.1 huA (h ▸ hvB) + have hdisj_RQ := hdisj R hR ⟨x, hx_end, hx_ab⟩ + rw [hR_uv.1.pathEnds_eq, mem_insert_iff, mem_singleton_iff] at hx_end + have hu_ab : u ∈ S.Ω.interval a b := by + rcases hx_end with rfl | rfl + · exact hx_ab + · exact S.both_ends_mem_interval_of_separating hQ_ends hQ_sep (hR_uv.symm S) hdisj_RQ hx_ab + have hv_ab : v ∈ S.Ω.interval a b := + S.both_ends_mem_interval_of_separating hQ_ends hQ_sep hR_uv hdisj_RQ hu_ab + rcases S.Ω.interval_subset_interval_or_swap hu_ab hv_ab huv_ne with hsub_uv | hsub_vu + · exact ⟨u, v, hR_uv, hu_ab, hv_ab, hsub_uv⟩ + · exact ⟨v, u, hR_uv.symm S, hv_ab, hu_ab, hsub_vu⟩ + -- Existence of a candidate `P ∈ P_set` with `Ω(s, t) ⊆ Ω(a, b)`. + have hex_cand : ∃ n : ℕ, ∃ P ∈ P_set, ∃ s t : α, + S.IsOmegaPathWithEnds P s t ∧ + s ∈ S.Ω.interval a b ∧ t ∈ S.Ω.interval a b ∧ + S.Ω.interval s t ⊆ S.Ω.interval a b ∧ + (S.Ω.interval s t).ncard = n := by + rcases hne with ⟨x, ⟨P₀, hP₀, y₀, hP₀_xy⟩, hx_ab⟩ + have hx_end : x ∈ pathEnds S.G P₀ := by + rw [hP₀_xy.1.pathEnds_eq] + exact Or.inl rfl + obtain ⟨s₀, t₀, hP₀_st, hs₀, ht₀, hsub₀⟩ := hex_good P₀ hP₀ ⟨x, hx_end, hx_ab⟩ + exact ⟨(S.Ω.interval s₀ t₀).ncard, P₀, hP₀, s₀, t₀, hP₀_st, hs₀, ht₀, hsub₀, rfl⟩ + classical + let n_min := Nat.find hex_cand + obtain ⟨P, hP_in, s, t, hP_ends, hs_ab, ht_ab, hsub_st, hcard_st⟩ := Nat.find_spec hex_cand + have hmin_st : ∀ P' ∈ P_set, ∀ s' t' : α, + S.IsOmegaPathWithEnds P' s' t' → + s' ∈ S.Ω.interval a b → t' ∈ S.Ω.interval a b → + S.Ω.interval s' t' ⊆ S.Ω.interval a b → + n_min ≤ (S.Ω.interval s' t').ncard := by + intro P' hP' s' t' hP'_st hs' ht' hsub' + exact Nat.find_min' hex_cand ⟨P', hP', s', t', hP'_st, hs', ht', hsub', rfl⟩ + -- Since `P_set` is crooked, `P` is not peripheral in `P_set`. + have hnot_periph : ¬ S.IsPeripheralIn P_set P := hcrooked.2 P hP_in + have hhit_st : (S.Ω.interval s t ∩ S.transactionEnds P_set).Nonempty := by + by_contra h_empty + rw [not_nonempty_iff_eq_empty, ← disjoint_iff_inter_eq_empty] at h_empty + exact hnot_periph ⟨hP_in, s, t, hP_ends, Or.inl h_empty⟩ + rcases hhit_st with ⟨x', hx'_st, P', hP'_in, y', hP'_ends⟩ + have hP'_ne_P : P' ≠ P := by + rintro rfl + rcases hP_ends.ends_eq S hP'_ends with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hx'_st.1.2 (Or.inl rfl) + · exact hx'_st.1.2 (Or.inr rfl) + have hdisj_PP' : Disjoint V(P) V(P') := hfence.1.2 hP_in hP'_in hP'_ne_P.symm + -- Find the other end `y'` of `P'`. + have hx'_ab : x' ∈ S.Ω.interval a b := hsub_st hx'_st + have hdisj_P'Q : Disjoint V(P') V(Q) := + hdisj P' hP'_in ⟨x', by rw [hP'_ends.1.pathEnds_eq]; exact Or.inl rfl, hx'_ab⟩ + have hy'_ab : y' ∈ S.Ω.interval a b := + S.both_ends_mem_interval_of_separating hQ_ends hQ_sep hP'_ends hdisj_P'Q hx'_ab + have hx'y'_ne : x' ≠ y' := hP'_ends.2.1 + -- `y' ∉ Ω(s, t)` by minimality of `(Ω(s, t)).ncard`. + have hy'_not_st : y' ∉ S.Ω.interval s t := by + intro hy'_st + have hfin_st : (S.Ω.interval s t).Finite := S.Ω.finite_bar.subset (S.Ω.interval_subset_bar s t) + rcases S.Ω.interval_subset_interval_or_swap hx'_st hy'_st hx'y'_ne with hsub' | hsub' + · have hlt : (S.Ω.interval x' y').ncard < (S.Ω.interval s t).ncard := + ncard_lt_ncard ⟨hsub', fun h_all => (h_all hy'_st).1.2 (Or.inr rfl)⟩ hfin_st + have hge := hmin_st P' hP'_in x' y' hP'_ends hx'_ab hy'_ab (hsub'.trans hsub_st) + omega + · have hlt : (S.Ω.interval y' x').ncard < (S.Ω.interval s t).ncard := + ncard_lt_ncard ⟨hsub', fun h_all => (h_all hx'_st).1.2 (Or.inr rfl)⟩ hfin_st + have hge := hmin_st P' hP'_in y' x' (hP'_ends.symm S) hy'_ab hx'_ab (hsub'.trans hsub_st) + omega + have hst_ne : s ≠ t := by + obtain ⟨u₀, hu₀A, v₀, hv₀B, hP_uv₀⟩ := hfence.2.2 P hP_in + have huv₀_ne : u₀ ≠ v₀ := fun h => disjoint_left.mp hfence.2.1.2.2.1 hu₀A (h ▸ hv₀B) + rcases hP_ends.ends_eq S hP_uv₀ with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact huv₀_ne + · exact huv₀_ne.symm + have hy'_ne_s : y' ≠ s := fun h => + disjoint_left.mp hdisj_PP' (h ▸ hP_ends.1.left_mem) hP'_ends.1.right_mem + have hy'_ne_t : y' ≠ t := fun h => + disjoint_left.mp hdisj_PP' (h ▸ hP_ends.1.right_mem) hP'_ends.1.right_mem + have hy'_ts : y' ∈ S.Ω.interval t s := by + rcases S.Ω.mem_interval_or_interval_swap hP_ends.2.2.1 hP_ends.2.2.2 + hP'_ends.2.2.2 hst_ne hy'_ne_s hy'_ne_t with h_st | h_ts + · exact (hy'_not_st h_st).elim + · exact h_ts + have hcr_PP' : S.OmegaPathsCross P P' := by + refine ⟨hdisj_PP', s, t, x', y', hP_ends, hP'_ends, ?_⟩ + exact S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hx'_st, hy'_ts⟩) + refine ⟨P, hP_in, P', hP'_in, hcr_PP', ?_, ?_⟩ + · rw [hP_ends.1.pathEnds_eq] + rintro z (rfl | rfl) + · exact hs_ab + · exact ht_ab + · rw [hP'_ends.1.pathEnds_eq] + rintro z (rfl | rfl) + · exact hx'_ab + · exact hy'_ab + +/-- **Graph Minors IX, (5.1)** (page 52): +"Let $Q$ be a separating $\Omega$-path in $(G, \Omega)$ with ends $a, b$. If $\mathcal{P}$ is +a crooked transaction in $(G, \Omega)$ with $Q \cap \bigcup \mathcal{P}$ null and with +$V(\mathcal{P}) \cap \Omega(a, b) \ne \emptyset$ then there is a cross $\mathcal{P}' +\subseteq \mathcal{P}$ with all four ends in $\Omega(a, b)$." -/ +theorem theorem_5_1_proof {Q : Graph α β} {a b : α} {P_set : Set (Graph α β)} + (hQ_ends : S.IsOmegaPathWithEnds Q a b) + (hQ_sep : S.IsSeparatingOmegaPath Q) + (hcrooked : S.IsCrookedTransaction P_set) + (hdisj : Disjoint V(Q) V(S.transactionUnion P_set)) + (hne : (S.transactionEnds P_set ∩ S.Ω.interval a b).Nonempty) : + ∃ P₁ ∈ P_set, ∃ P₂ ∈ P_set, + S.OmegaPathsCross P₁ P₂ ∧ + pathEnds S.G P₁ ⊆ S.Ω.interval a b ∧ + pathEnds S.G P₂ ⊆ S.Ω.interval a b := by + refine S.exists_cross_in_interval_of_disjoint_paths hQ_ends hQ_sep hcrooked ?_ hne + intro R hR _ + exact disjoint_left.mpr fun z hzR hzQ => + disjoint_left.mp hdisj hzQ (mem_iUnion₂.mpr ⟨R, hR, hzR⟩) + +/-! ## Proof of (5.2) (pages 52–53) -/ + +/-- For a finite graph `S.G`, if `Q_set` is a transaction in `S` with no internal vertex in `ΩBar` +and `S` has a crooked transaction `P₀` with `p ≤ P₀.ncard` (`2 ≤ p`), then there exist a crooked +transaction `P_set` and a fence `(A, B)` satisfying `S.StatementS p P_set Q_set A B`. -/ +theorem exists_statementS [Finite V(S.G)] [Finite E(S.G)] {p : ℕ} (hp2 : 2 ≤ p) + {Q_set : Set (Graph α β)} (htr_Q : S.IsTransaction Q_set) + (hno_int : ∀ Q ∈ Q_set, Disjoint (pathInternalVerts S.G Q) S.Ω.bar) + (hex_cr : ∃ P₀ : Set (Graph α β), S.IsCrookedTransaction P₀ ∧ p ≤ P₀.ncard) : + ∃ (P_set : Set (Graph α β)) (A B : Set α), S.StatementS p P_set Q_set A B := by + let unionGraph (P_set : Set (Graph α β)) : Graph α β := + subgraphUnion S.G (S.transactionUnion P_set) (S.transactionUnion Q_set) + let unionSize (P_set : Set (Graph α β)) : ℕ := + (V(unionGraph P_set)).ncard + (E(unionGraph P_set)).ncard + have hex_u : ∃ u : ℕ, ∃ P_set : Set (Graph α β), + S.IsCrookedTransaction P_set ∧ p ≤ P_set.ncard ∧ unionSize P_set = u := by + rcases hex_cr with ⟨P₀, hcr₀, hp₀⟩ + exact ⟨unionSize P₀, P₀, hcr₀, hp₀, rfl⟩ + classical + let u_min := Nat.find hex_u + have hex_c : ∃ c : ℕ, ∃ P_set : Set (Graph α β), + S.IsCrookedTransaction P_set ∧ p ≤ P_set.ncard ∧ + unionSize P_set = u_min ∧ P_set.ncard = c := by + obtain ⟨P₁, hcr₁, hp₁, hu₁⟩ := Nat.find_spec hex_u + exact ⟨P₁.ncard, P₁, hcr₁, hp₁, hu₁, rfl⟩ + let c_min := Nat.find hex_c + obtain ⟨P_set, hcr_P, hp_P, hu_P, hc_P⟩ := Nat.find_spec hex_c + obtain ⟨A, B, hfence_P⟩ := hcr_P.1 + have hQ_le : ∀ M ∈ Q_set, M ≤ S.G := by + obtain ⟨_, _, hfQ⟩ := htr_Q + exact fun M hM => let ⟨_, _, h⟩ := hfQ.1.1 M hM; h.1.1 + have hUQ_le : S.transactionUnion Q_set ≤ S.G := subgraphSUnion_le hQ_le + have hVG_fin : V(S.G).Finite := toFinite V(S.G) + have hEG_fin : E(S.G).Finite := toFinite E(S.G) + refine ⟨P_set, A, B, hp2, htr_Q, hno_int, hcr_P, hp_P, ?_, ?_, hfence_P⟩ + · intro P_set' hcr' hp' hle + have hP_le : ∀ M ∈ P_set, M ≤ S.G := + fun M hM => let ⟨_, _, h⟩ := hfence_P.1.1 M hM; h.1.1 + have hP'_le : ∀ M ∈ P_set', M ≤ S.G := by + obtain ⟨_, _, hfP'⟩ := hcr'.1 + exact fun M hM => let ⟨_, _, h⟩ := hfP'.1.1 M hM; h.1.1 + have hU_le : unionGraph P_set ≤ S.G := subgraphUnion_le (subgraphSUnion_le hP_le) hUQ_le + have hU'_le : unionGraph P_set' ≤ S.G := subgraphUnion_le (subgraphSUnion_le hP'_le) hUQ_le + have hV_sub : V(unionGraph P_set') ⊆ V(unionGraph P_set) := hle.vertexSet_mono + have hE_sub : E(unionGraph P_set') ⊆ E(unionGraph P_set) := hle.edgeSet_mono + have hV_fin : (V(unionGraph P_set)).Finite := hVG_fin.subset hU_le.vertexSet_mono + have hE_fin : (E(unionGraph P_set)).Finite := hEG_fin.subset hU_le.edgeSet_mono + have hV_le : (V(unionGraph P_set')).ncard ≤ (V(unionGraph P_set)).ncard := + ncard_le_ncard hV_sub hV_fin + have hE_le : (E(unionGraph P_set')).ncard ≤ (E(unionGraph P_set)).ncard := + ncard_le_ncard hE_sub hE_fin + have hu_ge : u_min ≤ unionSize P_set' := + Nat.find_min' hex_u ⟨P_set', hcr', hp', rfl⟩ + have hV_eq : V(unionGraph P_set') = V(unionGraph P_set) := + eq_of_subset_of_ncard_le hV_sub (by dsimp [unionSize] at hu_P hu_ge; omega) hV_fin + have hE_eq : E(unionGraph P_set') = E(unionGraph P_set) := + eq_of_subset_of_ncard_le hE_sub (by dsimp [unionSize] at hu_P hu_ge; omega) hE_fin + exact (Compatible.of_le_le hU'_le hU_le).ext hV_eq hE_eq + · intro P_set' hcr' hp' heq + have hu' : unionSize P_set' = u_min := by + have h_eq_graph : unionGraph P_set' = unionGraph P_set := heq + dsimp [unionSize] at hu_P ⊢ + rw [h_eq_graph] + exact hu_P + have hc_ge : c_min ≤ P_set'.ncard := + Nat.find_min' hex_c ⟨P_set', hcr', hp', hu', rfl⟩ + omega + +/-- In a separation `(G₁, G₂)` of `S.G` with `V(G₁) ∩ V(G₂) = V(Q_m)` and +`Ω(a_m, b_m) ⊆ V(G₁)`, if `Q_j` is a separating `Ω`-path with `Ω(a_j, b_j) ⊆ Ω(a_m, b_m)` and +`a_m, b_m ∈ Ω(b_j, a_j)` (or `Q_j = Q_m`), then any `Ω`-path `P` disjoint from `Q_j` with +`pathEnds S.G P ⊆ Ω(a_j, b_j)` satisfies `Disjoint V(P) V(G₂)`. -/ +theorem disjoint_right_of_ends_in_interval_of_separating + {Q_j Q_m P G₁ G₂ : Graph α β} {a_j b_j a_m b_m : α} + (hQj_ends : S.IsOmegaPathWithEnds Q_j a_j b_j) + (hQj_sep : S.IsSeparatingOmegaPath Q_j) + (hQm_ends : S.IsOmegaPathWithEnds Q_m a_m b_m) + (hQm_no_int : Disjoint (pathInternalVerts S.G Q_m) S.Ω.bar) + (hsub_jm : S.Ω.interval a_j b_j ⊆ S.Ω.interval a_m b_m) + (hjm : Q_j = Q_m ∨ + (Disjoint V(Q_j) V(Q_m) ∧ a_m ∈ S.Ω.interval b_j a_j ∧ b_m ∈ S.Ω.interval b_j a_j)) + (hsep_G : IsGraphSeparation S.G G₁ G₂) + (hinter_G : V(G₁) ∩ V(G₂) = V(Q_m)) + (hint_G₁ : S.Ω.interval a_m b_m ⊆ V(G₁)) + {s t : α} (hP_ends : S.IsOmegaPathWithEnds P s t) + (hdisj_PQj : Disjoint V(P) V(Q_j)) + (hs_ajbj : s ∈ S.Ω.interval a_j b_j) + (ht_ajbj : t ∈ S.Ω.interval a_j b_j) : + Disjoint V(P) V(G₂) := by + by_contra hnot_disj + rw [not_disjoint_iff_nonempty_inter] at hnot_disj + -- First show `(V(P) ∩ V(Q_m)).Nonempty` because `s ∈ V(G₁)` and `P` is a path meeting `V(G₂)`. + have hs_G₁ : s ∈ V(G₁) := hint_G₁ (hsub_jm hs_ajbj) + have hmeet_P_Qm : (V(P) ∩ V(Q_m)).Nonempty := by + rw [← hinter_G] + rcases hnot_disj with ⟨z, hzP, hzG₂⟩ + obtain ⟨R_sz, hRsz_le, _, hRsz_G⟩ := hP_ends.1.exists_subpath hP_ends.1.left_mem hzP + obtain ⟨w, hw_Rsz, hw_inter⟩ := exists_mem_inter_of_isGraphPathWithEnds hsep_G hRsz_G hs_G₁ hzG₂ + exact ⟨w, hRsz_le.vertexSet_mono hw_Rsz, hw_inter⟩ + -- Now `Q_j ≠ Q_m` since `Disjoint V(P) V(Q_j)`. + rcases hjm with rfl | ⟨hdisj_QjQm, ham_bjaj, hbm_bjaj⟩ + · exact disjoint_left.mp hdisj_PQj hmeet_P_Qm.some_mem.1 hmeet_P_Qm.some_mem.2 + · rcases hmeet_P_Qm with ⟨w₀, hw₀_P, hw₀_Qm⟩ + -- Take subpath of `P` from `s` to `w₀`, then extract `{s, t} → V(Q_m)` path `R₁ ≤ P`. + obtain ⟨R_sw, hRsw_le, _, hRsw_G⟩ := hP_ends.1.exists_subpath hP_ends.1.left_mem hw₀_P + obtain ⟨x_s, hx_s_in, x, hx_Qm, R₁, hR₁_Rsw, hR₁_ft⟩ := + hRsw_G.exists_isFromToPathWithEnds (X := {s, t}) (Y := V(Q_m)) (Or.inl rfl) hw₀_Qm + have hR₁_le : R₁ ≤ P := hR₁_Rsw.trans hRsw_le + -- Take subpath of `Q_m` from `x` to `a_m`. + obtain ⟨R₂, hR₂_le, _, hR₂_G⟩ := hQm_ends.1.exists_subpath hx_Qm hQm_ends.1.left_mem + have hinter_R₁R₂ : V(R₁) ∩ V(R₂) = {x} := by + apply Subset.antisymm + · intro z ⟨hz₁, hz₂⟩ + have hz_in : z ∈ V(R₁) ∩ V(Q_m) := ⟨hz₁, hR₂_le.vertexSet_mono hz₂⟩ + rwa [hR₁_ft.2.2] at hz_in + · rintro z rfl + exact ⟨hR₁_ft.1.right_mem, hR₂_G.left_mem⟩ + let P' := subgraphUnion S.G R₁ R₂ + have hP'_G : IsGraphPathWithEnds S.G P' x_s a_m := + hR₁_ft.1.subgraphUnion hR₂_G hinter_R₁R₂ + have hx_s_ajbj : x_s ∈ S.Ω.interval a_j b_j := by + rcases hx_s_in with rfl | rfl + · exact hs_ajbj + · exact ht_ajbj + have hx_s_ne_am : x_s ≠ a_m := fun h => + disjoint_left.mp (S.Ω.disjoint_interval_swap a_j b_j) hx_s_ajbj (h ▸ ham_bjaj) + have hP'_omega : S.IsOmegaPathWithEnds P' x_s a_m := + ⟨hP'_G, hx_s_ne_am, S.Ω.interval_subset_bar a_j b_j hx_s_ajbj, + S.Ω.interval_subset_bar b_j a_j ham_bjaj⟩ + have hdisj_P'Qj : Disjoint V(P') V(Q_j) := by + rw [disjoint_left] + intro z hzP' hzQj + rw [vertexSet_subgraphUnion] at hzP' + rcases hzP' with hzR₁ | hzR₂ + · exact disjoint_left.mp hdisj_PQj (hR₁_le.vertexSet_mono hzR₁) hzQj + · exact disjoint_left.mp hdisj_QjQm.symm (hR₂_le.vertexSet_mono hzR₂) hzQj + have hcr_P'Qj : S.OmegaPathsCross P' Q_j := + ⟨hdisj_P'Qj, x_s, a_m, a_j, b_j, hP'_omega, hQj_ends, + (S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hx_s_ajbj, ham_bjaj⟩)).symm⟩ + exact hQj_sep.2 ⟨P', hcr_P'Qj⟩ + +/-- **Graph Minors IX, (5.2)** (pages 52–53): +"Let $(G, \Omega)$ have a crooked transaction with cardinality $p \ge 2$ and $p \ne 3$. Let +$\{Q_1, \dots, Q_{p+4}\}$ be a transaction in $(G, \Omega)$ such that for $1 \le i \le p+4$, +$Q_i$ is separating, and has no internal vertex in $\bar{\Omega}$, and has ends $a_i, b_i$, +where $(a_{p+4}, a_{p+3}, \dots, a_1, b_1, b_2, \dots, b_{p+4})$ is clockwise. Let $(G_1, +G_2)$ be a separation of $G$ with $V(G_1 \cap G_2) = V(Q_{p+4})$, $\Omega(a_{p+4}, b_{p+4}) +\subseteq V(G_1)$ and $\Omega(b_{p+4}, a_{p+4}) \subseteq V(G_2)$. Then either* (i) *there +is a cross $\{P_1, P_2\}$ of $(G, \Omega)$ with $P_1 \cap G_2$ and $P_2 \cap G_2$ both null, +or* (ii) *there is a crooked transaction $\mathcal{P}$ in $(G, \Omega)$ with cardinality $p$ +and with $\Omega(a_1, b_1) \cap V(\mathcal{P}) = \emptyset$." -/ +theorem theorem_5_2_proof [Finite V(S.G)] [Finite E(S.G)] {p : ℕ} (hp2 : 2 ≤ p) (hp3 : p ≠ 3) + (hex_cr : ∃ P₀ : Set (Graph α β), S.IsCrookedTransaction P₀ ∧ p ≤ P₀.ncard) + {Q : Fin (p + 4) → Graph α β} {a b : Fin (p + 4) → α} + (hinj_Q : Function.Injective Q) + (htr_Q : S.IsTransaction (range Q)) + (hsep_Q : ∀ i : Fin (p + 4), S.IsSeparatingOmegaPath (Q i)) + (hno_int : ∀ i : Fin (p + 4), Disjoint (pathInternalVerts S.G (Q i)) S.Ω.bar) + (hends_Q : ∀ i : Fin (p + 4), S.IsOmegaPathWithEnds (Q i) (a i) (b i)) + (hcw : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) + {G₁ G₂ : Graph α β} (hsep_G : IsGraphSeparation S.G G₁ G₂) + (hinter_G : V(G₁) ∩ V(G₂) = V(Q ⟨p + 3, by omega⟩)) + (hint_G₁ : S.Ω.interval (a ⟨p + 3, by omega⟩) (b ⟨p + 3, by omega⟩) ⊆ V(G₁)) + (_hint_G₂ : S.Ω.interval (b ⟨p + 3, by omega⟩) (a ⟨p + 3, by omega⟩) ⊆ V(G₂)) : + (∃ P₁ P₂ : Graph α β, S.OmegaPathsCross P₁ P₂ ∧ + Disjoint V(P₁) V(G₂) ∧ Disjoint V(P₂) V(G₂)) ∨ + (∃ P_set : Set (Graph α β), S.IsCrookedTransaction P_set ∧ P_set.ncard = p ∧ + Disjoint (S.Ω.interval (a ⟨0, by omega⟩) (b ⟨0, by omega⟩)) (S.transactionEnds P_set)) := by + let Q_set : Set (Graph α β) := range Q + have hno_int_Q : ∀ R ∈ Q_set, Disjoint (pathInternalVerts S.G R) S.Ω.bar := by + rintro _ ⟨i, rfl⟩ + exact hno_int i + have hsep_Q_set : ∀ R ∈ Q_set, S.IsSeparatingOmegaPath R := by + rintro _ ⟨i, rfl⟩ + exact hsep_Q i + have hcard_Q : Q_set.ncard = p + 4 := by + dsimp [Q_set] + rw [ncard_range_of_injective hinj_Q, Nat.card_eq_fintype_card, Fintype.card_fin] + obtain ⟨P_set, A, B, hS⟩ := S.exists_statementS hp2 htr_Q hno_int_Q hex_cr + have hcard_P : P_set.ncard = p := hS.card_P_eq S hp3 + by_cases hdisj_0 : + Disjoint (S.Ω.interval (a ⟨0, by omega⟩) (b ⟨0, by omega⟩)) (S.transactionEnds P_set) + · exact Or.inr ⟨P_set, hS.isCrooked_P, hcard_P, hdisj_0⟩ + · left + -- By (4.6), some `Q j ∈ Q_set` is vertex-disjoint from `⋃ P_set`. + obtain ⟨_, ⟨j, rfl⟩, hdisj_Qj⟩ := S.theorem_4_6_proof hS hp3 hcard_Q hsep_Q_set + let i₀ : Fin (p + 4) := ⟨0, by omega⟩ + let i_last : Fin (p + 4) := ⟨p + 3, by omega⟩ + have hj_le_last : j ≤ i_last := by + change j.1 ≤ p + 3 + have := j.2 + omega + have hsub_0j : S.Ω.interval (a i₀) (b i₀) ⊆ S.Ω.interval (a j) (b j) := by + rcases eq_or_lt_of_le (Fin.zero_le j) with rfl | hlt + · exact Subset.rfl + · exact (S.Ω.mem_intervals_of_isClockwiseSeq_ofFn hcw hlt).2.2.1 + have hne_j : (S.transactionEnds P_set ∩ S.Ω.interval (a j) (b j)).Nonempty := by + rw [not_disjoint_iff_nonempty_inter] at hdisj_0 + rcases hdisj_0 with ⟨x, hx0, hxP⟩ + exact ⟨x, hxP, hsub_0j hx0⟩ + -- By (5.1), there is a cross `P₁, P₂ ∈ P_set` with all four ends in `Ω(a_j, b_j)`. + obtain ⟨P₁, hP₁_in, P₂, hP₂_in, hcr_12, hends₁_j, hends₂_j⟩ := + S.theorem_5_1_proof (hends_Q j) (hsep_Q j) hS.isCrooked_P hdisj_Qj hne_j + -- Both `P₁` and `P₂` are disjoint from `V(G₂)`. + have hsub_j_last : S.Ω.interval (a j) (b j) ⊆ S.Ω.interval (a i_last) (b i_last) := by + rcases eq_or_lt_of_le hj_le_last with rfl | hlt + · exact Subset.rfl + · exact (S.Ω.mem_intervals_of_isClockwiseSeq_ofFn hcw hlt).2.2.1 + have hj_last : Q j = Q i_last ∨ + (Disjoint V(Q j) V(Q i_last) ∧ + a i_last ∈ S.Ω.interval (b j) (a j) ∧ b i_last ∈ S.Ω.interval (b j) (a j)) := by + rcases eq_or_lt_of_le hj_le_last with rfl | hlt + · exact Or.inl rfl + · right + obtain ⟨_, _, hfence_Q⟩ := htr_Q + have hne_Q : Q j ≠ Q i_last := fun h => (ne_of_lt hlt) (hinj_Q h) + have hdisj_jm : Disjoint V(Q j) V(Q i_last) := + hfence_Q.1.2 (mem_range_self j) (mem_range_self i_last) hne_Q + have hint_jm := S.Ω.mem_intervals_of_isClockwiseSeq_ofFn hcw hlt + exact ⟨hdisj_jm, hint_jm.2.2.2.1, hint_jm.2.2.2.2⟩ + have hdisj_P_G₂ : ∀ P ∈ P_set, pathEnds S.G P ⊆ S.Ω.interval (a j) (b j) → + Disjoint V(P) V(G₂) := by + intro P hP_in hends_P + obtain ⟨s, t, hP_ends⟩ := hS.isFenceFor_P.1.1 P hP_in + have hs_j : s ∈ S.Ω.interval (a j) (b j) := by + apply hends_P + rw [hP_ends.1.pathEnds_eq] + exact Or.inl rfl + have ht_j : t ∈ S.Ω.interval (a j) (b j) := by + apply hends_P + rw [hP_ends.1.pathEnds_eq] + exact Or.inr rfl + have hdisj_PQj : Disjoint V(P) V(Q j) := by + rw [disjoint_left] + intro z hzP hzQj + exact disjoint_left.mp hdisj_Qj hzQj (mem_iUnion₂.mpr ⟨P, hP_in, hzP⟩) + exact S.disjoint_right_of_ends_in_interval_of_separating + (hends_Q j) (hsep_Q j) (hends_Q i_last) (hno_int i_last) + hsub_j_last hj_last hsep_G hinter_G hint_G₁ hP_ends hdisj_PQj hs_j ht_j + exact ⟨P₁, P₂, hcr_12, hdisj_P_G₂ P₁ hP₁_in hends₁_j, hdisj_P_G₂ P₂ hP₂_in hends₂_j⟩ + +end Society + +export Society (theorem_5_1_proof theorem_5_2_proof) + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section5b.lean b/LeanPool/GraphMinor/GM09/Section5b.lean new file mode 100644 index 0000000000..90c369abfc --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section5b.lean @@ -0,0 +1,3379 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2a +import LeanPool.GraphMinor.GM09.Section2c +import LeanPool.GraphMinor.GM09.Section2d +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section3c +import LeanPool.GraphMinor.GM09.Section4a +import LeanPool.GraphMinor.GM09.Section4b +import LeanPool.GraphMinor.GM09.Section4c +import LeanPool.GraphMinor.GM09.Section5a +public import LeanPool.GraphMinor.GM09.Restriction +import LeanPool.GraphMinor.GM09.Section7 +import Mathlib.Data.Set.Card + +/-! +# Graph Minors IX, Section 5 (Part B): One-Point Extensions, Contractions, and (5.3)–(5.5) + +This file formalizes (5.3), (5.4), and (5.5) from Section 5 of +N. Robertson and P. D. Seymour, *Graph Minors. IX. Disjoint crossed paths*, +J. Combin. Theory Ser. B **49** (1990) 40–77 (pages 53–55): +- `(5.3)` (`theorem_5_3`, page 53): if `Q` is an induced `Ω`-path in `(K, Ω)` with ends `a, b` + such that `Ω(a, b) = ∅` and `ΩBar - {a, b}` catches `K \ V(Q)`, and `(K, Ω₁)` has a cross where + `Ω₁` extends `Ω` by an internal vertex `r` of `Q` with `(a, r, b)` clockwise, then `(K, Ω)` has + a cross or tripod. +- `(5.4)` (`theorem_5_4`, page 54): if `(G, Ω)` is internally 4-connected, `Q` is a separating + `Ω`-path with separation `(G₁, G₂)`, and `(G \ V(G₂), Ω | V(G \ V(G₂)))` has a tripod, then + `(G₁, Ω | V(G₁))` has a cross. +- `(5.5)` (`theorem_5_5`, pages 54–55): combines `(5.2)`, `(5.3)`, and `(5.4)` to produce a + non-separating `Ω`-path `P ≤ G₁`. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Restrictions and one-point extensions of cyclic permutations -/ + +namespace CyclicPerm + +variable {Ω : CyclicPerm α} + +/-- If `Ω₁` extends `Ω` by a single point `r ∉ Ω.bar` with `(a, r, b)` `Ω₁`-clockwise and +`Ω(a, b) = ∅`, then `Ω₁(a, b) = {r}`, `Ω₁(a, r) = ∅`, `Ω₁(r, b) = ∅`, and +`Ω₁(b, a) = Ω(b, a) = Ω.bar \ {a, b}`. -/ +theorem extension_intervals {Ω₁ : CyclicPerm α} {a b r : α} + (hbar₁ : Ω₁.bar = Ω.bar ∪ {r}) + (hrest : Ω₁.IsRestriction Ω.bar Ω) + (hab_empty : Ω.interval a b = ∅) + (harb : Ω₁.IsClockwise3 a r b) : + Ω₁.interval a b = {r} ∧ + Ω₁.interval a r = ∅ ∧ + Ω₁.interval r b = ∅ ∧ + Ω₁.interval b a = Ω.interval b a ∧ + Ω.interval b a = Ω.bar \ {a, b} := by + have harb_iff := Ω₁.isClockwise3_iff.mp harb + have hab_ne : a ≠ b := harb_iff.2.1 + have har_ne : a ≠ r := harb_iff.1 + have hrb_ne : r ≠ b := harb_iff.2.2.1 + have hr_bar₁ : r ∈ Ω₁.bar := by rw [hbar₁]; exact Or.inr rfl + have hr_in_ab : r ∈ Ω₁.interval a b := by + refine ⟨⟨hr_bar₁, ?_⟩, harb⟩ + simp [har_ne.symm, hrb_ne] + have ha_bar : a ∈ Ω.bar := by + have ha₁ : a ∈ Ω₁.bar := harb_iff.2.2.2.1 + rw [hbar₁] at ha₁ + rcases ha₁ with ha | rfl + · exact ha + · exact (har_ne rfl).elim + have hb_bar : b ∈ Ω.bar := by + have hb₁ : b ∈ Ω₁.bar := harb_iff.2.2.2.2.2.1 + rw [hbar₁] at hb₁ + rcases hb₁ with hb | rfl + · exact hb + · exact (hrb_ne rfl).elim + have hint_ab : Ω₁.interval a b = {r} := by + ext x + simp only [mem_singleton_iff] + refine ⟨fun hx => ?_, fun h => h ▸ hr_in_ab⟩ + have hx_bar₁ : x ∈ Ω₁.bar := hx.1.1 + rw [hbar₁] at hx_bar₁ + rcases hx_bar₁ with hx_bar | rfl + · exfalso + have hx_in : x ∈ Ω.interval a b := by + rw [hrest.interval_eq ha_bar hb_bar] + exact ⟨hx, hx_bar⟩ + rw [hab_empty] at hx_in + exact hx_in + · rfl + have hunion_r := Ω₁.interval_eq_union_of_mem hr_in_ab + rw [hint_ab] at hunion_r + have hint_ar : Ω₁.interval a r = ∅ := by + rw [eq_empty_iff_forall_notMem] + intro x hx + have hx_r : x ∈ ({r} : Set α) := by + rw [hunion_r] + exact Or.inl (Or.inl hx) + rw [mem_singleton_iff] at hx_r + exact Ω₁.not_mem_interval_right a r (hx_r ▸ hx) + have hint_rb : Ω₁.interval r b = ∅ := by + rw [eq_empty_iff_forall_notMem] + intro x hx + have hx_r : x ∈ ({r} : Set α) := by + rw [hunion_r] + exact Or.inr hx + rw [mem_singleton_iff] at hx_r + exact Ω₁.not_mem_interval_left r b (hx_r ▸ hx) + have hint_ba_bar : Ω.interval b a = Ω.bar \ {a, b} := by + have hun := Ω.interval_union_interval_swap ha_bar hb_bar hab_ne + rwa [hab_empty, empty_union] at hun + have hint_ba₁ : Ω₁.interval b a = Ω.interval b a := by + ext x + constructor + · intro hx + have hx_ne_r : x ≠ r := fun h => + disjoint_left.mp (Ω₁.disjoint_interval_swap a b) (h ▸ hr_in_ab) hx + have hx_bar₁ : x ∈ Ω₁.bar := hx.1.1 + rw [hbar₁] at hx_bar₁ + rcases hx_bar₁ with hx_bar | rfl + · rw [hrest.interval_eq hb_bar ha_bar] + exact ⟨hx, hx_bar⟩ + · exact (hx_ne_r rfl).elim + · intro hx + have hx' := hx + rw [hrest.interval_eq hb_bar ha_bar] at hx' + exact hx'.1 + exact ⟨hint_ab, hint_ar, hint_rb, hint_ba₁, hint_ba_bar⟩ + +theorem Crosses.interval_nonempty {s₁ t₁ s₂ t₂ : α} (h : Ω.Crosses s₁ t₁ s₂ t₂) : + (Ω.interval s₁ t₁).Nonempty ∧ (Ω.interval t₁ s₁).Nonempty := by + rcases Ω.crosses_iff_interval.mp h with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · exact ⟨⟨s₂, h1⟩, ⟨t₂, h2⟩⟩ + · exact ⟨⟨t₂, h1⟩, ⟨s₂, h2⟩⟩ + +theorem Crosses.not_interval_empty {s₁ t₁ s₂ t₂ : α} + (hempty : Ω.interval s₁ t₁ = ∅ ∨ Ω.interval t₁ s₁ = ∅) : + ¬ Ω.Crosses s₁ t₁ s₂ t₂ := by + intro hcr + obtain ⟨hne1, hne2⟩ := hcr.interval_nonempty + rcases hempty with h1 | h2 + · rw [h1] at hne1; exact not_nonempty_empty hne1 + · rw [h2] at hne2; exact not_nonempty_empty hne2 + +/-- If `{s₁, t₁}` crosses `{s₂, t₂}` in `Ω` and `e₀ ∈ Ω.bar \ {s₂, t₂}`, then either `{e₀, s₁}` +or `{e₀, t₁}` crosses `{s₂, t₂}` in `Ω`. -/ +theorem Crosses.left_or_right_of_notMem {s₁ t₁ s₂ t₂ e₀ : α} + (hcr : Ω.Crosses s₁ t₁ s₂ t₂) (he₀ : e₀ ∈ Ω.bar) (he₀_not : e₀ ∉ ({s₂, t₂} : Set α)) : + Ω.Crosses e₀ s₁ s₂ t₂ ∨ Ω.Crosses e₀ t₁ s₂ t₂ := by + by_cases he₀_s₁ : e₀ = s₁ + · subst he₀_s₁; exact Or.inr hcr + by_cases he₀_t₁ : e₀ = t₁ + · subst he₀_t₁; exact Or.inl hcr.swap_left + have haux : ∀ {u₁ v₁ u₂ v₂ : α}, + u₂ ∈ Ω.interval u₁ v₁ → v₂ ∈ Ω.interval v₁ u₁ → + u₂ ≠ e₀ → e₀ ∈ Ω.interval u₁ v₁ → + Ω.Crosses e₀ u₁ u₂ v₂ ∨ Ω.Crosses e₀ v₁ u₂ v₂ := by + intro u₁ v₁ u₂ v₂ hu₂ hv₂ hu₂_ne he₀_int + have hunion := Ω.interval_eq_union_of_mem he₀_int + have hu₂' : u₂ ∈ Ω.interval u₁ e₀ ∪ {e₀} ∪ Ω.interval e₀ v₁ := hunion ▸ hu₂ + have hv₁_e₀u₁ : v₁ ∈ Ω.interval e₀ u₁ := Ω.mem_interval_rotate_left he₀_int + have hu₁_v₁e₀ : u₁ ∈ Ω.interval v₁ e₀ := Ω.mem_interval_rotate_right he₀_int + rcases hu₂' with (hu₂_left | h_eq) | hu₂_right + · left + have hv₂' : v₂ ∈ Ω.interval e₀ u₁ := + (Ω.interval_subset_interval_right hv₁_e₀u₁) hv₂ + exact Ω.crosses_iff_interval.mpr (Or.inr ⟨hv₂', hu₂_left⟩) + · exact (hu₂_ne (mem_singleton_iff.mp h_eq)).elim + · right + have hv₂' : v₂ ∈ Ω.interval v₁ e₀ := + (Ω.interval_subset_interval_left hu₁_v₁e₀) hv₂ + exact Ω.crosses_iff_interval.mpr (Or.inl ⟨hu₂_right, hv₂'⟩) + have hs₂_ne : s₂ ≠ e₀ := fun h => he₀_not (by simp [h]) + have ht₂_ne : t₂ ≠ e₀ := fun h => he₀_not (by simp [h]) + have hs₁_bar : s₁ ∈ Ω.bar := by + rcases Ω.crosses_iff_interval.mp hcr with ⟨h1, _⟩ | ⟨h1, _⟩ + · exact (Ω.isClockwise3_iff.mp h1.2).2.2.2.1 + · exact (Ω.isClockwise3_iff.mp h1.2).2.2.2.1 + have ht₁_bar : t₁ ∈ Ω.bar := by + rcases Ω.crosses_iff_interval.mp hcr with ⟨h1, _⟩ | ⟨h1, _⟩ + · exact (Ω.isClockwise3_iff.mp h1.2).2.2.2.2.2.1 + · exact (Ω.isClockwise3_iff.mp h1.2).2.2.2.2.2.1 + have hs₁t₁_ne : s₁ ≠ t₁ := by + rcases Ω.crosses_iff_interval.mp hcr with ⟨h1, _⟩ | ⟨h1, _⟩ + · exact (Ω.isClockwise3_iff.mp h1.2).2.1 + · exact (Ω.isClockwise3_iff.mp h1.2).2.1 + rcases Ω.mem_interval_or_interval_swap hs₁_bar ht₁_bar he₀ hs₁t₁_ne he₀_s₁ he₀_t₁ with + he₀_st | he₀_ts + · rcases Ω.crosses_iff_interval.mp hcr with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · exact haux h1 h2 hs₂_ne he₀_st + · rcases haux h1 h2 ht₂_ne he₀_st with h | h + · exact Or.inl h.swap_right + · exact Or.inr h.swap_right + · rcases Ω.crosses_iff_interval.mp hcr.swap_left with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · exact (haux h1 h2 hs₂_ne he₀_ts).symm + · rcases haux h1 h2 ht₂_ne he₀_ts with h | h + · exact Or.inr h.swap_right + · exact Or.inl h.swap_right + +end CyclicPerm + +/-! ## Proof of (5.3) (page 53) -/ + +namespace Society + +variable (S : Society α β) + +/-- If `(K, Ω₁)` extends `(K, Ω)` by `r ∉ Ω.bar`, and `{M₁, M₂}` is a cross in `S₁` with ends +`u₁, v₁` and `u₂, v₂` while `S` has no cross, then `r ∈ {u₁, v₁, u₂, v₂}`. -/ +theorem mem_ends_of_isCross_of_not_hasCross {S₁ : Society α β} {r : α} + (hG₁ : S₁.G = S.G) + (hbar₁ : S₁.Ω.bar = S.Ω.bar ∪ {r}) + (hrest : S₁.Ω.IsRestriction S.Ω.bar S.Ω) + (hno_cross : ¬ ∃ M₁ M₂ : Graph α β, S.IsCross M₁ M₂) + {M₁ M₂ : Graph α β} {u₁ v₁ u₂ v₂ : α} + (hdisj : Disjoint V(M₁) V(M₂)) + (hM₁ : S₁.IsOmegaPathWithEnds M₁ u₁ v₁) + (hM₂ : S₁.IsOmegaPathWithEnds M₂ u₂ v₂) + (hcr : S₁.Ω.Crosses u₁ v₁ u₂ v₂) : + r ∈ ({u₁, v₁, u₂, v₂} : Set α) := by + by_contra hr_not + simp only [mem_insert_iff, mem_singleton_iff, not_or] at hr_not + have hmem_bar : ∀ {x : α}, x ∈ S₁.Ω.bar → x ≠ r → x ∈ S.Ω.bar := by + intro x hx hne + rw [hbar₁] at hx + rcases hx with hx | rfl + · exact hx + · exact (hne rfl).elim + have hu₁ : u₁ ∈ S.Ω.bar := hmem_bar hM₁.2.2.1 (Ne.symm hr_not.1) + have hv₁ : v₁ ∈ S.Ω.bar := hmem_bar hM₁.2.2.2 (Ne.symm hr_not.2.1) + have hu₂ : u₂ ∈ S.Ω.bar := hmem_bar hM₂.2.2.1 (Ne.symm hr_not.2.2.1) + have hv₂ : v₂ ∈ S.Ω.bar := hmem_bar hM₂.2.2.2 (Ne.symm hr_not.2.2.2) + have hcr_S : S.Ω.Crosses u₁ v₁ u₂ v₂ := + (hrest.crosses_iff.mpr ⟨hu₁, hv₁, hu₂, hv₂, hcr⟩) + exact hno_cross ⟨M₁, M₂, hdisj, u₁, v₁, u₂, v₂, + ⟨hG₁ ▸ hM₁.1, hM₁.2.1, hu₁, hv₁⟩, + ⟨hG₁ ▸ hM₂.1, hM₂.2.1, hu₂, hv₂⟩, hcr_S⟩ + +/-- Helper for Claim (1) of (5.3): in a minimal cross `{P₁, P₂}` of `S₁`, if `A ≤ Q₁` is a path +from `e₀` to `a' ∈ V(P₁)` meeting `V(P₁) ∪ V(P₂)` only at `a'`, and `P₁` splits at `a'` into `S_p` +(to `u₁`) and `T_p` (to `v₁`) such that `{e₀, u₁}` crosses `{s₂, t₂}`, we obtain a contradiction +assuming `e₀ ∉ {u₁, v₁, s₂, t₂}` and `S` has no cross. -/ +private theorem contradiction_of_branch {S₁ : Society α β} {Q Q₁ Q₂ P₁ P₂ A S_p T_p : Graph α β} + {e₀ e₁ r s₂ t₂ a' u₁ v₁ : α} + (hG₁ : S₁.G = S.G) + (hbar₁ : S₁.Ω.bar = S.Ω.bar ∪ {r}) + (hrest : S₁.Ω.IsRestriction S.Ω.bar S.Ω) + (hno_cross : ¬ ∃ M₁ M₂ : Graph α β, S.IsCross M₁ M₂) + (hQ : S.IsOmegaPathWithEnds Q e₀ e₁) + (hno_int : Disjoint (pathInternalVerts S.G Q) S.Ω.bar) + (hr_Q : r ∈ V(Q) \ {e₀, e₁}) + (hre₁_empty : S₁.Ω.interval r e₁ = ∅ ∨ S₁.Ω.interval e₁ r = ∅) + (hsep_Q : IsGraphSeparation Q Q₁ Q₂) + (hinter_Q : V(Q₁) ∩ V(Q₂) = {r}) + (he₁_Q₂ : e₁ ∈ V(Q₂)) + (hdisj_P : Disjoint V(P₁) V(P₂)) + (hP₁_le : P₁ ≤ S.G) + (hP₂ : S₁.IsOmegaPathWithEnds P₂ s₂ t₂) + (hmin : ∀ P₁' P₂' : Graph α β, S₁.IsCross P₁' P₂' → + subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q ≤ + subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q → + V(subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q) = + V(subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q) ∧ + E(subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q) = + E(subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q)) + (hA_Q₁ : A ≤ Q₁) + (hA_path : IsGraphPathWithEnds S.G A e₀ a') + (hA_inter : V(A) ∩ (V(P₁) ∪ V(P₂)) = {a'}) + (hSp_le : S_p ≤ P₁) (hTp_le : T_p ≤ P₁) + (hSp_path : IsGraphPathWithEnds S.G S_p a' u₁) + (hTp_path : IsGraphPathWithEnds S.G T_p a' v₁) + (hinter_ST : V(S_p) ∩ V(T_p) = {a'}) + (hdisj_EST : Disjoint E(S_p) E(T_p)) + (hu₁_bar : u₁ ∈ S₁.Ω.bar) (hv₁_bar : v₁ ∈ S₁.Ω.bar) + (hu₁v₁_ne : u₁ ≠ v₁) (he₀_u₁ : e₀ ≠ u₁) (he₀_v₁ : e₀ ≠ v₁) + (hcr_uv : S₁.Ω.Crosses u₁ v₁ s₂ t₂) + (hcr_e₀u₁ : S₁.Ω.Crosses e₀ u₁ s₂ t₂) : False := by + have hA_Q : A ≤ Q := hA_Q₁.trans hsep_Q.1 + have hinter_AS : V(A) ∩ V(S_p) = {a'} := by + apply Subset.antisymm + · intro z ⟨hzA, hzS⟩ + have : z ∈ V(A) ∩ (V(P₁) ∪ V(P₂)) := ⟨hzA, Or.inl (hSp_le.vertexSet_mono hzS)⟩ + rwa [hA_inter] at this + · rintro z rfl + exact ⟨hA_path.right_mem, hSp_path.left_mem⟩ + let P' := subgraphUnion S.G A S_p + have hP'_path : IsGraphPathWithEnds S.G P' e₀ u₁ := + hA_path.subgraphUnion hSp_path hinter_AS + have he₀_bar₁ : e₀ ∈ S₁.Ω.bar := by + rw [hbar₁]; exact Or.inl hQ.2.2.1 + have hP'_ends : S₁.IsOmegaPathWithEnds P' e₀ u₁ := + ⟨hG₁.symm ▸ hP'_path, he₀_u₁, he₀_bar₁, hu₁_bar⟩ + have hdisj_P'P₂ : Disjoint V(P') V(P₂) := by + rw [vertexSet_subgraphUnion, disjoint_union_left] + refine ⟨disjoint_left.mpr fun z hzA hzP₂ => ?_, hdisj_P.mono_left hSp_le.vertexSet_mono⟩ + have hz_a' : z = a' := by + have : z ∈ V(A) ∩ (V(P₁) ∪ V(P₂)) := ⟨hzA, Or.inr hzP₂⟩ + rwa [hA_inter, mem_singleton_iff] at this + subst hz_a' + exact disjoint_left.mp hdisj_P (hSp_le.vertexSet_mono hSp_path.left_mem) hzP₂ + have hcr_P'P₂ : S₁.IsCross P' P₂ := + ⟨hdisj_P'P₂, e₀, u₁, s₂, t₂, hP'_ends, hP₂, hcr_e₀u₁⟩ + have hP₂_le : P₂ ≤ S.G := hG₁ ▸ hP₂.1.le + have hQ_le : Q ≤ S.G := hQ.1.le + have hP'_le : P' ≤ S.G := hP'_path.le + have hU'_le : subgraphUnion S.G (subgraphUnion S.G P' P₂) Q ≤ + subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q := by + have hU_le : subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q ≤ S.G := + subgraphUnion_le (subgraphUnion_le hP₁_le hP₂_le) hQ_le + have hP₁_U : P₁ ≤ subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q := + (le_subgraphUnion_left hP₁_le hP₂_le).trans + (le_subgraphUnion_left (subgraphUnion_le hP₁_le hP₂_le) hQ_le) + have hP₂_U : P₂ ≤ subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q := + (le_subgraphUnion_right hP₁_le hP₂_le).trans + (le_subgraphUnion_left (subgraphUnion_le hP₁_le hP₂_le) hQ_le) + have hQ_U : Q ≤ subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q := + le_subgraphUnion_right (subgraphUnion_le hP₁_le hP₂_le) hQ_le + have hP'_U : P' ≤ subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q := + (subgraphUnion_le_iff hA_path.le hSp_path.le hU_le).mpr + ⟨hA_Q.trans hQ_U, hSp_le.trans hP₁_U⟩ + have hP'P₂_U : subgraphUnion S.G P' P₂ ≤ subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q := + (subgraphUnion_le_iff hP'_le hP₂_le hU_le).mpr ⟨hP'_U, hP₂_U⟩ + exact (subgraphUnion_le_iff (subgraphUnion_le hP'_le hP₂_le) hQ_le hU_le).mpr + ⟨hP'P₂_U, hQ_U⟩ + obtain ⟨hV_eq, hE_eq⟩ := hmin P' P₂ hcr_P'P₂ hU'_le + -- Deduce `T_p ≤ Q`. + have hVT_Q : V(T_p) ⊆ V(Q) := by + intro z hzT + have hz_in : z ∈ V(subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q) := + Or.inl (Or.inl (hTp_le.vertexSet_mono hzT)) + rw [← hV_eq] at hz_in + change z ∈ (V(A) ∪ V(S_p)) ∪ V(P₂) ∪ V(Q) at hz_in + rcases hz_in with ((hzA | hzS) | hzP₂) | hzQ + · exact hA_Q.vertexSet_mono hzA + · have hza' : z = a' := by + have : z ∈ V(S_p) ∩ V(T_p) := ⟨hzS, hzT⟩ + rwa [hinter_ST, mem_singleton_iff] at this + exact hza' ▸ hA_Q.vertexSet_mono hA_path.right_mem + · exact (disjoint_left.mp hdisj_P (hTp_le.vertexSet_mono hzT) hzP₂).elim + · exact hzQ + have hET_Q : E(T_p) ⊆ E(Q) := by + intro e heT + have he_in : e ∈ E(subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q) := by + rw [edgeSet_subgraphUnion (subgraphUnion_le hP₁_le hP₂_le) hQ_le, + edgeSet_subgraphUnion hP₁_le hP₂_le] + exact Or.inl (Or.inl (hTp_le.edgeSet_mono heT)) + rw [← hE_eq, edgeSet_subgraphUnion (subgraphUnion_le hP'_le hP₂_le) hQ_le, + edgeSet_subgraphUnion hP'_le hP₂_le, edgeSet_subgraphUnion hA_path.le hSp_path.le] at he_in + rcases he_in with ((heA | heS) | heP₂) | heQ + · exact hA_Q.edgeSet_mono heA + · exact (disjoint_left.mp hdisj_EST heS heT).elim + · obtain ⟨x, y, hxy₁⟩ := T_p.exists_isLink_of_mem_edgeSet heT + obtain ⟨u, v, huv₂⟩ := P₂.exists_isLink_of_mem_edgeSet heP₂ + have heq := (hxy₁.mono hTp_path.le).left_eq_or_eq (huv₂.mono hP₂_le) + have hx_P₂ : x ∈ V(P₂) := by + rcases heq with rfl | rfl + · exact huv₂.left_mem + · exact huv₂.right_mem + exact (disjoint_left.mp hdisj_P (hTp_le.vertexSet_mono hxy₁.left_mem) hx_P₂).elim + · exact heQ + have hTp_Q : T_p ≤ Q := by + rw [(Compatible.of_le_le hTp_path.le hQ_le).le_iff] + exact ⟨hVT_Q, hET_Q⟩ + have hTp_path_Q : IsGraphPathWithEnds Q T_p a' v₁ := hTp_path.of_le hTp_Q + -- Since `S₁.IsCross P' P₂`, `r ∈ {e₀, u₁, s₂, t₂}`; thus `r ∈ V(P₁) → r = u₁`. + have hr_in_ends : r ∈ ({e₀, u₁, s₂, t₂} : Set α) := + S.mem_ends_of_isCross_of_not_hasCross hG₁ hbar₁ hrest hno_cross + hdisj_P'P₂ hP'_ends hP₂ hcr_e₀u₁ + have hr_eq_u₁_of_P₁ : r ∈ V(P₁) → r = u₁ := by + intro hr_P₁ + rcases hr_in_ends with rfl | rfl | rfl | rfl + · exact (hr_Q.2 (by simp)).elim + · rfl + · exact (disjoint_left.mp hdisj_P hr_P₁ hP₂.1.left_mem).elim + · exact (disjoint_left.mp hdisj_P hr_P₁ hP₂.1.right_mem).elim + -- Now `v₁ ∈ V(Q) ∩ S₁.Ω.bar`, so `v₁ ∈ {e₀, e₁, r}`. + have hv₁_Q : v₁ ∈ V(Q) := hVT_Q hTp_path.right_mem + have hv₁_bar' : v₁ ∈ S.Ω.bar ∪ {r} := hbar₁ ▸ hv₁_bar + rcases hv₁_bar' with hv₁_S | rfl + · have hv₁_ends : v₁ ∈ ({e₀, e₁} : Set α) := by + by_contra hnot + have hv₁_int : v₁ ∈ pathInternalVerts S.G Q := by + rw [hQ.1.pathInternalVerts_eq] + exact ⟨hv₁_Q, hnot⟩ + exact disjoint_left.mp hno_int hv₁_int hv₁_S + rcases hv₁_ends with rfl | rfl + · exact he₀_v₁ rfl + · -- `v₁ = e₁`: `T_p` is a path in `Q` from `a' ∈ V(Q₁)` to `e₁ ∈ V(Q₂)`, so `r ∈ V(T_p)`. + have ha'_Q₁ : a' ∈ V(Q₁) := hA_Q₁.vertexSet_mono hA_path.right_mem + obtain ⟨z, hzT, hz_inter⟩ := + exists_mem_inter_of_isGraphPathWithEnds hsep_Q hTp_path_Q ha'_Q₁ he₁_Q₂ + rw [hinter_Q, mem_singleton_iff] at hz_inter + have hr_u₁ : r = u₁ := hr_eq_u₁_of_P₁ (hTp_le.vertexSet_mono (hz_inter ▸ hzT)) + exact CyclicPerm.Crosses.not_interval_empty hre₁_empty (hr_u₁.symm ▸ hcr_uv) + · -- `v₁ = r`: then `r ∈ V(T_p) ⊆ V(P₁)`, so `r = u₁ = v₁`, contradicting `u₁ ≠ v₁`. + have hr_u₁ : v₁ = u₁ := hr_eq_u₁_of_P₁ (hTp_le.vertexSet_mono hTp_path.right_mem) + exact hu₁v₁_ne hr_u₁.symm + +/-- Helper for Claim (1) of (5.3) when `a' ∈ V(P₁)`. -/ +private theorem end_mem_of_hit_left {S₁ : Society α β} {Q Q₁ Q₂ P₁ P₂ A : Graph α β} + {e₀ e₁ r s₁ t₁ s₂ t₂ a' : α} + (hG₁ : S₁.G = S.G) + (hbar₁ : S₁.Ω.bar = S.Ω.bar ∪ {r}) + (hrest : S₁.Ω.IsRestriction S.Ω.bar S.Ω) + (hno_cross : ¬ ∃ M₁ M₂ : Graph α β, S.IsCross M₁ M₂) + (hQ : S.IsOmegaPathWithEnds Q e₀ e₁) + (hno_int : Disjoint (pathInternalVerts S.G Q) S.Ω.bar) + (hr_Q : r ∈ V(Q) \ {e₀, e₁}) + (hre₁_empty : S₁.Ω.interval r e₁ = ∅ ∨ S₁.Ω.interval e₁ r = ∅) + (hsep_Q : IsGraphSeparation Q Q₁ Q₂) + (hinter_Q : V(Q₁) ∩ V(Q₂) = {r}) + (he₁_Q₂ : e₁ ∈ V(Q₂)) + (hdisj_P : Disjoint V(P₁) V(P₂)) + (hP₁ : S₁.IsOmegaPathWithEnds P₁ s₁ t₁) + (hP₂ : S₁.IsOmegaPathWithEnds P₂ s₂ t₂) + (hcr : S₁.Ω.Crosses s₁ t₁ s₂ t₂) + (hmin : ∀ P₁' P₂' : Graph α β, S₁.IsCross P₁' P₂' → + subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q ≤ + subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q → + V(subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q) = + V(subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q) ∧ + E(subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q) = + E(subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q)) + (hA_Q₁ : A ≤ Q₁) + (hA_path : IsGraphPathWithEnds S.G A e₀ a') + (hA_inter : V(A) ∩ (V(P₁) ∪ V(P₂)) = {a'}) + (ha'_P₁ : a' ∈ V(P₁)) : + e₀ ∈ ({s₁, t₁, s₂, t₂} : Set α) := by + by_contra he₀_not + simp only [mem_insert_iff, mem_singleton_iff, not_or] at he₀_not + have hP₁_G : IsGraphPathWithEnds S.G P₁ s₁ t₁ := hG₁ ▸ hP₁.1 + obtain ⟨S_p, T_p, hSp_le, hTp_le, hSp_P₁, hTp_P₁, _, hinter_ST, hdisj_EST⟩ := + hP₁_G.exists_split_at ha'_P₁ + have hSp_G : IsGraphPathWithEnds S.G S_p a' s₁ := (hSp_P₁.mono hP₁_G.le).symm + have hTp_G : IsGraphPathWithEnds S.G T_p a' t₁ := hTp_P₁.mono hP₁_G.le + have he₀_bar₁ : e₀ ∈ S₁.Ω.bar := by rw [hbar₁]; exact Or.inl hQ.2.2.1 + have he₀_not_2 : e₀ ∉ ({s₂, t₂} : Set α) := by + simp [he₀_not.2.2.1, he₀_not.2.2.2] + rcases hcr.left_or_right_of_notMem he₀_bar₁ he₀_not_2 with hcr_s₁ | hcr_t₁ + · exact S.contradiction_of_branch hG₁ hbar₁ hrest hno_cross hQ hno_int hr_Q hre₁_empty + hsep_Q hinter_Q he₁_Q₂ hdisj_P hP₁_G.le hP₂ hmin hA_Q₁ hA_path hA_inter + hSp_le hTp_le hSp_G hTp_G hinter_ST hdisj_EST + hP₁.2.2.1 hP₁.2.2.2 hP₁.2.1 he₀_not.1 he₀_not.2.1 hcr hcr_s₁ + · exact S.contradiction_of_branch hG₁ hbar₁ hrest hno_cross hQ hno_int hr_Q hre₁_empty + hsep_Q hinter_Q he₁_Q₂ hdisj_P hP₁_G.le hP₂ hmin hA_Q₁ hA_path hA_inter + hTp_le hSp_le hTp_G hSp_G (inter_comm V(T_p) V(S_p) ▸ hinter_ST) hdisj_EST.symm + hP₁.2.2.2 hP₁.2.2.1 hP₁.2.1.symm he₀_not.2.1 he₀_not.1 hcr.swap_left hcr_t₁ + +/-- General end-membership lemma for Claim (1) of (5.3): for an `Ω`-path `Q` with ends `e₀, e₁` +satisfying `S₁.Ω.interval r e₁ = ∅ ∨ S₁.Ω.interval e₁ r = ∅`, either `S` has a cross or +`e₀ ∈ {s₁, t₁, s₂, t₂}`. -/ +private theorem end_mem_of_minimal_cross {S₁ : Society α β} {Q P₁ P₂ : Graph α β} + {e₀ e₁ r s₁ t₁ s₂ t₂ : α} + (hG₁ : S₁.G = S.G) + (hbar₁ : S₁.Ω.bar = S.Ω.bar ∪ {r}) + (hrest : S₁.Ω.IsRestriction S.Ω.bar S.Ω) + (hno_cross : ¬ ∃ M₁ M₂ : Graph α β, S.IsCross M₁ M₂) + (hQ : S.IsOmegaPathWithEnds Q e₀ e₁) + (hno_int : Disjoint (pathInternalVerts S.G Q) S.Ω.bar) + (hr_Q : r ∈ V(Q) \ {e₀, e₁}) + (hre₁_empty : S₁.Ω.interval r e₁ = ∅ ∨ S₁.Ω.interval e₁ r = ∅) + (hdisj_P : Disjoint V(P₁) V(P₂)) + (hP₁ : S₁.IsOmegaPathWithEnds P₁ s₁ t₁) + (hP₂ : S₁.IsOmegaPathWithEnds P₂ s₂ t₂) + (hcr : S₁.Ω.Crosses s₁ t₁ s₂ t₂) + (hmin : ∀ P₁' P₂' : Graph α β, S₁.IsCross P₁' P₂' → + subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q ≤ + subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q → + V(subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q) = + V(subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q) ∧ + E(subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q) = + E(subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q)) : + e₀ ∈ ({s₁, t₁, s₂, t₂} : Set α) := by + obtain ⟨Q₁, Q₂, hQ₁_le, hQ₂_le, hQ₁_path, hQ₂_path, hunion_Q, hinter_Q, hdisj_EQ⟩ := + hQ.1.exists_split_at hr_Q.1 + have hsep_Q : IsGraphSeparation Q Q₁ Q₂ := + ⟨hQ₁_le, hQ₂_le, + by rw [← vertexSet_subgraphUnion Q Q₁ Q₂, hunion_Q], + by rw [← edgeSet_subgraphUnion hQ₁_le hQ₂_le, hunion_Q], + hdisj_EQ⟩ + have hr_ends : r ∈ ({s₁, t₁, s₂, t₂} : Set α) := + S.mem_ends_of_isCross_of_not_hasCross hG₁ hbar₁ hrest hno_cross hdisj_P hP₁ hP₂ hcr + have hr_P₁₂ : r ∈ V(P₁) ∪ V(P₂) := by + rcases hr_ends with rfl | rfl | rfl | rfl + · exact Or.inl hP₁.1.left_mem + · exact Or.inl hP₁.1.right_mem + · exact Or.inr hP₂.1.left_mem + · exact Or.inr hP₂.1.right_mem + have hQ₁_G : IsGraphPathWithEnds S.G Q₁ e₀ r := hQ₁_path.mono hQ.1.le + obtain ⟨e₀', he₀'_eq, a', ha'_P₁₂, A, hA_Q₁, hA_ft⟩ := + hQ₁_G.exists_isFromToPathWithEnds (X := {e₀}) (Y := V(P₁) ∪ V(P₂)) rfl hr_P₁₂ + rw [mem_singleton_iff] at he₀'_eq + subst he₀'_eq + rcases ha'_P₁₂ with ha'_P₁ | ha'_P₂ + · exact S.end_mem_of_hit_left hG₁ hbar₁ hrest hno_cross hQ hno_int hr_Q hre₁_empty + hsep_Q hinter_Q hQ₂_path.right_mem hdisj_P hP₁ hP₂ hcr hmin hA_Q₁ hA_ft.1 hA_ft.2.2 ha'_P₁ + · have hP₁_le : P₁ ≤ S.G := hG₁ ▸ hP₁.1.le + have hP₂_le : P₂ ≤ S.G := hG₁ ▸ hP₂.1.le + have hmin_swap : ∀ P₂' P₁' : Graph α β, S₁.IsCross P₂' P₁' → + subgraphUnion S.G (subgraphUnion S.G P₂' P₁') Q ≤ + subgraphUnion S.G (subgraphUnion S.G P₂ P₁) Q → + V(subgraphUnion S.G (subgraphUnion S.G P₂' P₁') Q) = + V(subgraphUnion S.G (subgraphUnion S.G P₂ P₁) Q) ∧ + E(subgraphUnion S.G (subgraphUnion S.G P₂' P₁') Q) = + E(subgraphUnion S.G (subgraphUnion S.G P₂ P₁) Q) := by + intro P₂' P₁' hcr' hle' + obtain ⟨hdisj', a₁, b₁, a₂, b₂, h1', h2', hcr_ends'⟩ := hcr' + have hcr_swap : S₁.IsCross P₁' P₂' := + ⟨hdisj'.symm, a₂, b₂, a₁, b₁, h2', h1', hcr_ends'.symm⟩ + have hP₂'_le : P₂' ≤ S.G := hG₁ ▸ h1'.1.le + have hP₁'_le : P₁' ≤ S.G := hG₁ ▸ h2'.1.le + rw [subgraphUnion_comm hP₂'_le hP₁'_le, subgraphUnion_comm hP₂_le hP₁_le] at hle' ⊢ + exact hmin P₁' P₂' hcr_swap hle' + have hA_inter' : V(A) ∩ (V(P₂) ∪ V(P₁)) = {a'} := by + rw [union_comm] + exact hA_ft.2.2 + have hmem := S.end_mem_of_hit_left hG₁ hbar₁ hrest hno_cross hQ hno_int hr_Q hre₁_empty + hsep_Q hinter_Q hQ₂_path.right_mem hdisj_P.symm hP₂ hP₁ hcr.symm hmin_swap + hA_Q₁ hA_ft.1 hA_inter' ha'_P₂ + simp only [mem_insert_iff, mem_singleton_iff] at hmem ⊢ + tauto + +/-- **Graph Minors IX, (5.3), Claim (1)** (page 53): +"Either $(K, \Omega)$ has a cross or $a, b \in \{s_1, t_1, s_2, t_2\}$." -/ +theorem lemma_5_3_claim_1 {S₁ : Society α β} {Q P₁ P₂ : Graph α β} + {a b r s₁ t₁ s₂ t₂ : α} + (hG₁ : S₁.G = S.G) + (hbar₁ : S₁.Ω.bar = S.Ω.bar ∪ {r}) + (hrest : S₁.Ω.IsRestriction S.Ω.bar S.Ω) + (hab_empty : S.Ω.interval a b = ∅) + (harb : S₁.Ω.IsClockwise3 a r b) + (hQ : S.IsOmegaPathWithEnds Q a b) + (hno_int : Disjoint (pathInternalVerts S.G Q) S.Ω.bar) + (hr_Q : r ∈ V(Q) \ {a, b}) + (hdisj_P : Disjoint V(P₁) V(P₂)) + (hP₁ : S₁.IsOmegaPathWithEnds P₁ s₁ t₁) + (hP₂ : S₁.IsOmegaPathWithEnds P₂ s₂ t₂) + (hcr : S₁.Ω.Crosses s₁ t₁ s₂ t₂) + (hmin : ∀ P₁' P₂' : Graph α β, S₁.IsCross P₁' P₂' → + subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q ≤ + subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q → + V(subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q) = + V(subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q) ∧ + E(subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q) = + E(subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q)) : + (∃ M₁ M₂ : Graph α β, S.IsCross M₁ M₂) ∨ + (a ∈ ({s₁, t₁, s₂, t₂} : Set α) ∧ b ∈ ({s₁, t₁, s₂, t₂} : Set α)) := by + by_cases hcross : ∃ M₁ M₂ : Graph α β, S.IsCross M₁ M₂ + · exact Or.inl hcross + · right + obtain ⟨_, hint_ar, hint_rb, _, _⟩ := + S.Ω.extension_intervals hbar₁ hrest hab_empty harb + have ha_mem : a ∈ ({s₁, t₁, s₂, t₂} : Set α) := + S.end_mem_of_minimal_cross hG₁ hbar₁ hrest hcross hQ hno_int hr_Q + (Or.inl hint_rb) hdisj_P hP₁ hP₂ hcr hmin + have hr_Q_ba : r ∈ V(Q) \ {b, a} := by + rw [pair_comm]; exact hr_Q + have hb_mem : b ∈ ({s₁, t₁, s₂, t₂} : Set α) := + S.end_mem_of_minimal_cross hG₁ hbar₁ hrest hcross (hQ.symm S) hno_int hr_Q_ba + (Or.inr hint_ar) hdisj_P hP₁ hP₂ hcr hmin + exact ⟨ha_mem, hb_mem⟩ + +/-- If `R` is a path in `G` from `u` to `v` with `u ≠ v` and `¬ G.Adj u v`, then `R` has an +internal vertex `w ∈ V(R) \ {u, v}`. -/ +private theorem exists_internal_of_not_adj {G R : Graph α β} {u v : α} + (hR : IsGraphPathWithEnds G R u v) (huv : u ≠ v) (hnadj : ¬ G.Adj u v) : + ∃ w ∈ V(R), w ≠ u ∧ w ≠ v := by + rcases hR with ⟨hRG, W, hW, hVR, _⟩ + cases W with + | nil _ => exact (huv rfl).elim + | @cons _ w _ e hlink W' => + have hnd : (u :: W'.support).Nodup := hW + have hu_not : u ∉ W'.support := (List.nodup_cons.mp hnd).1 + have hwu : w ≠ u := fun h => hu_not (h ▸ W'.start_mem_support) + have hwv : w ≠ v := fun h => hnadj ⟨e, h ▸ hlink.mono hRG⟩ + refine ⟨w, ?_, hwu, hwv⟩ + rw [hVR, mem_ofPred_eq] + exact List.mem_cons_of_mem u W'.start_mem_support + +/-- If `Z` catches `G'`, `X ⊆ V(G')`, and `w₀ ∈ X`, then there exists an `X → Z` path `P ≤ G'` in +`G'`. -/ +theorem exists_isFromToPathWithEnds_of_catches {G' : Graph α β} {X Z : Set α} {w₀ : α} + (hcatch : Catches Z G') (hX : X ⊆ V(G')) (hw₀ : w₀ ∈ X) : + ∃ d ∈ X, ∃ p_end ∈ Z, ∃ P : Graph α β, + P ≤ G' ∧ IsFromToPathWithEnds G' P X Z d p_end := by + obtain ⟨C, hC_comp, hw₀_C⟩ := exists_graphComponent_of_mem (hX hw₀) + obtain ⟨z₀, hz₀_Z, hz₀_C⟩ := hcatch.2 C hC_comp + obtain ⟨W_C⟩ := hC_comp.2.1.2 w₀ hw₀_C z₀ hz₀_C + obtain ⟨W, _, _⟩ := exists_walk_up_of_le hC_comp.1 W_C + obtain ⟨d, hdX, p_end, hpZ, P, hP_W, _, hP_ft⟩ := + exists_isFromToPathWithEnds_of_walk W hw₀ hz₀_Z + exact ⟨d, hdX, p_end, hpZ, P, hP_W.trans (walkSubgraph_le W), hP_ft⟩ + +private theorem range_fin3 (x₀ x₁ x₂ : α) : range ![x₀, x₁, x₂] = {x₀, x₁, x₂} := by + ext z + simp only [mem_range, mem_insert_iff, mem_singleton_iff, Fin.exists_fin_succ, + Fin.isValue, Matrix.cons_val_zero, Matrix.cons_val_succ, IsEmpty.exists_iff, or_false] + tauto + +private theorem pairwise_disjoint_fin3 {L₀ L₁ L₂ : Graph α β} + (h01 : Disjoint V(L₀) V(L₁)) (h02 : Disjoint V(L₀) V(L₂)) (h12 : Disjoint V(L₁) V(L₂)) : + Pairwise (fun i j : Fin 3 => Disjoint V(![L₀, L₁, L₂] i) V(![L₀, L₁, L₂] j)) := by + intro i j hij + fin_cases i <;> fin_cases j + · exact (hij rfl).elim + · exact h01 + · exact h02 + · exact h01.symm + · exact (hij rfl).elim + · exact h12 + · exact h02.symm + · exact h12.symm + · exact (hij rfl).elim + +/-- Helper for Case 1 of (5.3): when `Disjoint V(P) V(R₂)` and `{a', p_end}` crosses `{b', t₂}`, +constructing `M₁ = (C'_a ∪ R₁_left) ∪ P` and `M₂ = D'.symm ∪ R₂.symm` yields a cross in `S`. -/ +private theorem exists_cross_of_disjoint_P_R₂ + {Q R₁ R₂ P C'_a R₁_left D' : Graph α β} {a' b' c u' d p_end t₂ : α} + (ha'_bar : a' ∈ S.Ω.bar) (hb'_bar : b' ∈ S.Ω.bar) + (hp_bar : p_end ∈ S.Ω.bar) (ht₂_bar : t₂ ∈ S.Ω.bar) + (ha'_p : a' ≠ p_end) (hb'_t₂ : b' ≠ t₂) + (hcr : S.Ω.Crosses a' p_end b' t₂) + (hCa_Q : C'_a ≤ Q) (hD'_Q : D' ≤ Q) + (hdisj_Ca_D' : Disjoint V(C'_a) V(D')) + (hc_not_Ca : c ∉ V(C'_a)) + (hCa_path : IsGraphPathWithEnds S.G C'_a a' u') + (hD'_path : IsGraphPathWithEnds S.G D' b' c) + (hR₁_left_le : R₁_left ≤ R₁) + (hR₁_left_path : IsGraphPathWithEnds S.G R₁_left u' d) + (hCa_R₁_inter : V(C'_a) ∩ V(R₁_left) = {u'}) + (hdisj_R₁left_D' : Disjoint V(R₁_left) V(D')) + (hP_path : IsGraphPathWithEnds S.G P d p_end) + (hdisj_PQ : Disjoint V(P) V(Q)) + (hPR₁_inter : V(P) ∩ V(R₁) = {d}) + (hR₂_path : IsGraphPathWithEnds S.G R₂ c t₂) + (hR₂Q_inter : V(R₂) ∩ V(Q) = {c}) + (hdisj_R₁R₂ : Disjoint V(R₁) V(R₂)) + (hdisj_PR₂ : Disjoint V(P) V(R₂)) : + ∃ M₁ M₂ : Graph α β, S.IsCross M₁ M₂ := by + let M₁_0 := subgraphUnion S.G C'_a R₁_left + have hM₁_0_path : IsGraphPathWithEnds S.G M₁_0 a' d := + hCa_path.subgraphUnion hR₁_left_path hCa_R₁_inter + have hinter_M₁0_P : V(M₁_0) ∩ V(P) = {d} := by + ext z + simp only [M₁_0, vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + constructor + · rintro ⟨hzCa | hzR₁, hzP⟩ + · exact (disjoint_left.mp hdisj_PQ hzP (hCa_Q.vertexSet_mono hzCa)).elim + · have : z ∈ V(P) ∩ V(R₁) := ⟨hzP, hR₁_left_le.vertexSet_mono hzR₁⟩ + rwa [hPR₁_inter, mem_singleton_iff] at this + · rintro rfl + exact ⟨Or.inr hR₁_left_path.right_mem, hP_path.left_mem⟩ + let M₁ := subgraphUnion S.G M₁_0 P + have hM₁_path : IsGraphPathWithEnds S.G M₁ a' p_end := + hM₁_0_path.subgraphUnion hP_path hinter_M₁0_P + have hinter_D'R₂ : V(D') ∩ V(R₂) = {c} := by + ext z + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hzD', hzR₂⟩ + have : z ∈ V(R₂) ∩ V(Q) := ⟨hzR₂, hD'_Q.vertexSet_mono hzD'⟩ + rwa [hR₂Q_inter, mem_singleton_iff] at this + · rintro rfl + exact ⟨hD'_path.right_mem, hR₂_path.left_mem⟩ + let M₂ := subgraphUnion S.G D' R₂ + have hM₂_path : IsGraphPathWithEnds S.G M₂ b' t₂ := + hD'_path.subgraphUnion hR₂_path hinter_D'R₂ + have hdisj_M₁M₂ : Disjoint V(M₁) V(M₂) := by + rw [disjoint_left] + rintro z ((hzCa | hzR₁) | hzP) (hzD' | hzR₂) + · exact disjoint_left.mp hdisj_Ca_D' hzCa hzD' + · have hzc : z = c := by + have : z ∈ V(R₂) ∩ V(Q) := ⟨hzR₂, hCa_Q.vertexSet_mono hzCa⟩ + rwa [hR₂Q_inter, mem_singleton_iff] at this + exact hc_not_Ca (hzc ▸ hzCa) + · exact disjoint_left.mp hdisj_R₁left_D' hzR₁ hzD' + · exact disjoint_left.mp hdisj_R₁R₂ (hR₁_left_le.vertexSet_mono hzR₁) hzR₂ + · exact disjoint_left.mp hdisj_PQ hzP (hD'_Q.vertexSet_mono hzD') + · exact disjoint_left.mp hdisj_PR₂ hzP hzR₂ + exact ⟨M₁, M₂, hdisj_M₁M₂, a', p_end, b', t₂, + ⟨hM₁_path, ha'_p, ha'_bar, hp_bar⟩, + ⟨hM₂_path, hb'_t₂, hb'_bar, ht₂_bar⟩, hcr⟩ + +private theorem crossFromSplitPaths {Q R₁ R₂ C D C_a D_b R1C R1D P : Graph α β} + {a b t₂ c u₁ v₁ d p_end : α} (hQ : S.IsOmegaPathWithEnds Q a b) + (hab_empty : S.Ω.interval a b = ∅) (ht₂_ba : t₂ ∈ S.Ω.interval b a) + (hR₂_ft : IsFromToPathWithEnds S.G R₂ {t₂} V(Q) t₂ c) + (hC_Q : C ≤ Q) (hD_Q : D ≤ Q) + (hC_path : IsGraphPathWithEnds Q C a c) (hD_path : IsGraphPathWithEnds Q D c b) + (hinter_CD : V(C) ∩ V(D) = {c}) + (hR₁_ft : IsFromToPathWithEnds S.G R₁ V(C) V(D) u₁ v₁) + (hCa_C : C_a ≤ C) (hDb_D : D_b ≤ D) + (hCa_path : IsGraphPathWithEnds C C_a a u₁) (hDb_path : IsGraphPathWithEnds D D_b v₁ b) + (hc_not_Ca : c ∉ V(C_a)) (hc_not_Db : c ∉ V(D_b)) + (hR1C_le : R1C ≤ R₁) (hR1D_le : R1D ≤ R₁) + (hR1C_path : IsGraphPathWithEnds R₁ R1C u₁ d) + (hR1D_path : IsGraphPathWithEnds R₁ R1D d v₁) + (hv₁_not_R1C : v₁ ∉ V(R1C)) (hu₁_not_R1D : u₁ ∉ V(R1D)) + (hp_bar_ab : p_end ∈ S.Ω.bar \ {a, b}) (hP_G : IsGraphPathWithEnds S.G P d p_end) + (hdisj_PQ : Disjoint V(P) V(Q)) (hPR₁_inter : V(P) ∩ V(R₁) = {d}) + (hdisj_R₁R₂ : Disjoint V(R₁) V(R₂)) (hdisj_PR₂ : Disjoint V(P) V(R₂)) : + ∃ M₁ M₂ : Graph α β, S.IsCross M₁ M₂ := by + have hp_ba : p_end ∈ S.Ω.interval b a := by + have hun := S.Ω.interval_union_interval_swap hQ.2.2.1 hQ.2.2.2 hQ.2.1 + rw [hab_empty, empty_union] at hun + rwa [hun] + have hp_ne_t₂ : p_end ≠ t₂ := fun h => + disjoint_left.mp hdisj_PR₂ hP_G.right_mem (h ▸ hR₂_ft.1.left_mem) + have hp_union : p_end ∈ S.Ω.interval b t₂ ∪ {t₂} ∪ S.Ω.interval t₂ a := by + rw [← S.Ω.interval_eq_union_of_mem ht₂_ba] + exact hp_ba + have ha_bt₂ : a ∈ S.Ω.interval t₂ b := S.Ω.mem_interval_rotate_left ht₂_ba + have hb_t₂a : b ∈ S.Ω.interval a t₂ := S.Ω.mem_interval_rotate_right ht₂_ba + have hp_not_ab : p_end ∉ ({a, b} : Set α) := hp_bar_ab.2 + have ht₂_not_ab : t₂ ∉ ({a, b} : Set α) := by + intro h + rcases h with ht₂a | ht₂b + · exact S.Ω.not_mem_interval_right b a (ht₂a ▸ ht₂_ba) + · exact S.Ω.not_mem_interval_left b a (mem_singleton_iff.mp ht₂b ▸ ht₂_ba) + rcases hp_union with (hp_bt₂ | h_eq) | hp_t₂a + · -- `p_end ∈ Ω(b, t₂)`: `{a, p_end}` crosses `{b, t₂}`. + have hcr_ap_bt₂ : S.Ω.Crosses a p_end b t₂ := + (S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hp_bt₂, ha_bt₂⟩)).symm.swap_left + have hdisj_Ca_D : Disjoint V(C_a) V(D) := by + rw [disjoint_left] + intro z hzCa hzD + have : z ∈ V(C) ∩ V(D) := ⟨hCa_C.vertexSet_mono hzCa, hzD⟩ + rw [hinter_CD, mem_singleton_iff] at this + exact hc_not_Ca (this ▸ hzCa) + have hCa_R1C_inter : V(C_a) ∩ V(R1C) = {u₁} := by + ext z + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hzCa, hzR⟩ => ?_, fun h => h ▸ ⟨hCa_path.right_mem, hR1C_path.left_mem⟩⟩ + have : z ∈ V(R₁) ∩ V(C) := ⟨hR1C_le.vertexSet_mono hzR, hCa_C.vertexSet_mono hzCa⟩ + rwa [hR₁_ft.2.1, mem_singleton_iff] at this + have hdisj_R1C_D : Disjoint V(R1C) V(D) := by + rw [disjoint_left] + intro z hzR hzD + have : z ∈ V(R₁) ∩ V(D) := ⟨hR1C_le.vertexSet_mono hzR, hzD⟩ + rw [hR₁_ft.2.2, mem_singleton_iff] at this + exact hv₁_not_R1C (this ▸ hzR) + exact S.exists_cross_of_disjoint_P_R₂ + hQ.2.2.1 hQ.2.2.2 hp_bar_ab.1 ht₂_ba.1.1 + (fun h => hp_not_ab (Or.inl h.symm)) + (fun h => ht₂_not_ab (Or.inr h.symm)) + hcr_ap_bt₂ (hCa_C.trans hC_Q) hD_Q hdisj_Ca_D hc_not_Ca + (hCa_path.mono (hC_Q.trans hQ.1.le)) (hD_path.mono hQ.1.le).symm + hR1C_le (hR1C_path.mono hR₁_ft.1.le) hCa_R1C_inter hdisj_R1C_D + hP_G hdisj_PQ hPR₁_inter hR₂_ft.1.symm hR₂_ft.2.2 hdisj_R₁R₂ hdisj_PR₂ + · exact (hp_ne_t₂ (mem_singleton_iff.mp h_eq)).elim + · -- `p_end ∈ Ω(t₂, a)`: `{b, p_end}` crosses `{a, t₂}`. + have hcr_bp_at₂ : S.Ω.Crosses b p_end a t₂ := + (S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hp_t₂a, hb_t₂a⟩)).symm.swap_left.swap_right + have hdisj_Db_C : Disjoint V(D_b) V(C) := by + rw [disjoint_left] + intro z hzDb hzC + have : z ∈ V(C) ∩ V(D) := ⟨hzC, hDb_D.vertexSet_mono hzDb⟩ + rw [hinter_CD, mem_singleton_iff] at this + exact hc_not_Db (this ▸ hzDb) + have hDb_R1D_inter : V(D_b) ∩ V(R1D) = {v₁} := by + ext z + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hzDb, hzR⟩ => ?_, fun h => h ▸ ⟨hDb_path.left_mem, hR1D_path.right_mem⟩⟩ + have : z ∈ V(R₁) ∩ V(D) := ⟨hR1D_le.vertexSet_mono hzR, hDb_D.vertexSet_mono hzDb⟩ + rwa [hR₁_ft.2.2, mem_singleton_iff] at this + have hdisj_R1D_C : Disjoint V(R1D) V(C) := by + rw [disjoint_left] + intro z hzR hzC + have : z ∈ V(R₁) ∩ V(C) := ⟨hR1D_le.vertexSet_mono hzR, hzC⟩ + rw [hR₁_ft.2.1, mem_singleton_iff] at this + exact hu₁_not_R1D (this ▸ hzR) + exact S.exists_cross_of_disjoint_P_R₂ + hQ.2.2.2 hQ.2.2.1 hp_bar_ab.1 ht₂_ba.1.1 + (fun h => hp_not_ab (Or.inr h.symm)) + (fun h => ht₂_not_ab (Or.inl h.symm)) + hcr_bp_at₂ (hDb_D.trans hD_Q) hC_Q hdisj_Db_C hc_not_Db + (hDb_path.mono (hD_Q.trans hQ.1.le)).symm (hC_path.mono hQ.1.le) + hR1D_le (hR1D_path.mono hR₁_ft.1.le).symm hDb_R1D_inter hdisj_R1D_C + hP_G hdisj_PQ hPR₁_inter hR₂_ft.1.symm hR₂_ft.2.2 hdisj_R₁R₂ hdisj_PR₂ + +private theorem redirectsTo_branchEnds + {Q P₁ C D R₁ R₂ C_a C_c D_c D_b R1C R1D P R2t R2c P_d L₃ : Graph α β} + {a b c d u₁ v₁ t₂ z t₃ : α} + (hQ : S.IsOmegaPathWithEnds Q a b) + (hno_int : Disjoint (pathInternalVerts S.G Q) S.Ω.bar) + (hP₁ : IsGraphPathWithEnds S.G P₁ a b) (hc_not_P₁ : c ∉ V(P₁)) + (hC_Q : C ≤ Q) (hD_Q : D ≤ Q) + (hC_path : IsGraphPathWithEnds Q C a c) (hD_path : IsGraphPathWithEnds Q D c b) + (hinter_CD : V(C) ∩ V(D) = {c}) + (hR₁_ft : IsFromToPathWithEnds S.G R₁ V(C) V(D) u₁ v₁) + (hR₂_ft : IsFromToPathWithEnds S.G R₂ {t₂} V(Q) t₂ c) + (hCa_C : C_a ≤ C) (hCc_C : C_c ≤ C) (hDc_D : D_c ≤ D) (hDb_D : D_b ≤ D) + (hCa_path : IsGraphPathWithEnds C C_a a u₁) (hDb_path : IsGraphPathWithEnds D D_b v₁ b) + (hinter_CaCc : V(C_a) ∩ V(C_c) = {u₁}) (hinter_DcDb : V(D_c) ∩ V(D_b) = {v₁}) + (hc_not_Ca : c ∉ V(C_a)) (hc_not_Db : c ∉ V(D_b)) + (hR1C_le : R1C ≤ R₁) (hR1D_le : R1D ≤ R₁) + (hu₁_not_R1D : u₁ ∉ V(R1D)) (hv₁_not_R1C : v₁ ∉ V(R1C)) + (hR1C_G : IsGraphPathWithEnds S.G R1C d u₁) (hR1D_G : IsGraphPathWithEnds S.G R1D d v₁) + (hR2t_le : R2t ≤ R₂) (hR2c_le : R2c ≤ R₂) (hR2c_path : IsGraphPathWithEnds R₂ R2c z c) + (hinter_R2 : V(R2t) ∩ V(R2c) = {z}) (hz_ne_c : z ≠ c) (hPd_P : P_d ≤ P) + (hPd_ft : IsFromToPathWithEnds S.G P_d {d} V(R₂) d z) + (hL₃_R2t : L₃ ≤ R2t) (hL₃_ft : IsFromToPathWithEnds S.G L₃ {z} S.Ω.bar z t₃) + (hdisj_PQ : Disjoint V(P) V(Q)) (hdisj_R₁R₂ : Disjoint V(R₁) V(R₂)) : + RedirectsTo S.G + (V(subgraphUnion S.G R1C C_c) ∪ V(subgraphUnion S.G R1D D_c) ∪ + V(subgraphUnion S.G P_d R2c)) S.Ω.bar {u₁, v₁, z} {a, b, t₃} := by + let N₁ := subgraphUnion S.G R1C C_c + let N₂ := subgraphUnion S.G R1D D_c + let N₃ := subgraphUnion S.G P_d R2c + let X_N := V(N₁) ∪ V(N₂) ∪ V(N₃) + have hQ_bar_inter : V(Q) ∩ S.Ω.bar = {a, b} := by + apply Subset.antisymm + · intro w ⟨hwQ, hw_bar⟩ + by_contra hnot + exact disjoint_left.mp hno_int + (by rw [hQ.1.pathInternalVerts_eq]; exact ⟨hwQ, hnot⟩) hw_bar + · rintro w (rfl | rfl) + · exact ⟨hQ.1.left_mem, hQ.2.2.1⟩ + · exact ⟨hQ.1.right_mem, hQ.2.2.2⟩ + have hb_not_C : b ∉ V(C) := fun hbC => by + have hbc : b = c := by + have : b ∈ V(C) ∩ V(D) := ⟨hbC, hD_path.right_mem⟩ + rwa [hinter_CD, mem_singleton_iff] at this + exact hc_not_P₁ (hbc ▸ hP₁.right_mem) + have ha_not_D : a ∉ V(D) := fun haD => by + have hac : a = c := by + have : a ∈ V(C) ∩ V(D) := ⟨hC_path.left_mem, haD⟩ + rwa [hinter_CD, mem_singleton_iff] at this + exact hc_not_P₁ (hac ▸ hP₁.left_mem) + have hL₁_ft : IsFromToPathWithEnds S.G C_a X_N S.Ω.bar u₁ a := by + refine ⟨(hCa_path.mono (hC_Q.trans hQ.1.le)).symm, ?_, ?_⟩ + · apply Subset.antisymm + · rintro w ⟨hwCa, ((hwR1C | hwCc) | (hwR1D | hwDc)) | (hwPd | hwR2c)⟩ + · have : w ∈ V(R₁) ∩ V(C) := ⟨hR1C_le.vertexSet_mono hwR1C, hCa_C.vertexSet_mono hwCa⟩ + rwa [hR₁_ft.2.1] at this + · have : w ∈ V(C_a) ∩ V(C_c) := ⟨hwCa, hwCc⟩ + rwa [hinter_CaCc] at this + · have : w ∈ V(R₁) ∩ V(C) := ⟨hR1D_le.vertexSet_mono hwR1D, hCa_C.vertexSet_mono hwCa⟩ + rw [hR₁_ft.2.1, mem_singleton_iff] at this + exact (hu₁_not_R1D (this ▸ hwR1D)).elim + · have : w ∈ V(C) ∩ V(D) := ⟨hCa_C.vertexSet_mono hwCa, hDc_D.vertexSet_mono hwDc⟩ + rw [hinter_CD, mem_singleton_iff] at this + exact (hc_not_Ca (this ▸ hwCa)).elim + · exact (disjoint_left.mp hdisj_PQ + (hPd_P.vertexSet_mono hwPd) ((hCa_C.trans hC_Q).vertexSet_mono hwCa)).elim + · have : w ∈ V(R₂) ∩ V(Q) := + ⟨hR2c_le.vertexSet_mono hwR2c, (hCa_C.trans hC_Q).vertexSet_mono hwCa⟩ + rw [hR₂_ft.2.2, mem_singleton_iff] at this + exact (hc_not_Ca (this ▸ hwCa)).elim + · rintro w rfl + exact ⟨hCa_path.right_mem, Or.inl (Or.inl (Or.inl hR1C_G.right_mem))⟩ + · apply Subset.antisymm + · rintro w ⟨hwCa, hw_bar⟩ + have : w ∈ V(Q) ∩ S.Ω.bar := ⟨(hCa_C.trans hC_Q).vertexSet_mono hwCa, hw_bar⟩ + rw [hQ_bar_inter, mem_insert_iff, mem_singleton_iff] at this + rcases this with rfl | rfl + · rfl + · exact (hb_not_C (hCa_C.vertexSet_mono hwCa)).elim + · rintro w rfl + exact ⟨hCa_path.left_mem, hQ.2.2.1⟩ + have hL₂_ft : IsFromToPathWithEnds S.G D_b X_N S.Ω.bar v₁ b := by + refine ⟨hDb_path.mono (hD_Q.trans hQ.1.le), ?_, ?_⟩ + · apply Subset.antisymm + · rintro w ⟨hwDb, ((hwR1C | hwCc) | (hwR1D | hwDc)) | (hwPd | hwR2c)⟩ + · have : w ∈ V(R₁) ∩ V(D) := ⟨hR1C_le.vertexSet_mono hwR1C, hDb_D.vertexSet_mono hwDb⟩ + rw [hR₁_ft.2.2, mem_singleton_iff] at this + exact (hv₁_not_R1C (this ▸ hwR1C)).elim + · have : w ∈ V(C) ∩ V(D) := ⟨hCc_C.vertexSet_mono hwCc, hDb_D.vertexSet_mono hwDb⟩ + rw [hinter_CD, mem_singleton_iff] at this + exact (hc_not_Db (this ▸ hwDb)).elim + · have : w ∈ V(R₁) ∩ V(D) := ⟨hR1D_le.vertexSet_mono hwR1D, hDb_D.vertexSet_mono hwDb⟩ + rwa [hR₁_ft.2.2] at this + · have : w ∈ V(D_c) ∩ V(D_b) := ⟨hwDc, hwDb⟩ + rwa [hinter_DcDb] at this + · exact (disjoint_left.mp hdisj_PQ + (hPd_P.vertexSet_mono hwPd) ((hDb_D.trans hD_Q).vertexSet_mono hwDb)).elim + · have : w ∈ V(R₂) ∩ V(Q) := + ⟨hR2c_le.vertexSet_mono hwR2c, (hDb_D.trans hD_Q).vertexSet_mono hwDb⟩ + rw [hR₂_ft.2.2, mem_singleton_iff] at this + exact (hc_not_Db (this ▸ hwDb)).elim + · rintro w rfl + exact ⟨hDb_path.left_mem, Or.inl (Or.inr (Or.inl hR1D_G.right_mem))⟩ + · apply Subset.antisymm + · rintro w ⟨hwDb, hw_bar⟩ + have : w ∈ V(Q) ∩ S.Ω.bar := ⟨(hDb_D.trans hD_Q).vertexSet_mono hwDb, hw_bar⟩ + rw [hQ_bar_inter, mem_insert_iff, mem_singleton_iff] at this + rcases this with rfl | rfl + · exact (ha_not_D (hDb_D.vertexSet_mono hwDb)).elim + · rfl + · rintro w rfl + exact ⟨hDb_path.right_mem, hQ.2.2.2⟩ + have hc_not_R2t : c ∉ V(R2t) := fun hc_R2t => + hz_ne_c <| Eq.symm <| by + have : c ∈ V(R2t) ∩ V(R2c) := ⟨hc_R2t, hR2c_path.right_mem⟩ + rwa [hinter_R2, mem_singleton_iff] at this + have hL₃_ft' : IsFromToPathWithEnds S.G L₃ X_N S.Ω.bar z t₃ := by + refine ⟨hL₃_ft.1, ?_, hL₃_ft.2.2⟩ + apply Subset.antisymm + · rintro w ⟨hwL₃, ((hwR1C | hwCc) | (hwR1D | hwDc)) | (hwPd | hwR2c)⟩ + · exact (disjoint_left.mp hdisj_R₁R₂ + (hR1C_le.vertexSet_mono hwR1C) ((hL₃_R2t.trans hR2t_le).vertexSet_mono hwL₃)).elim + · have : w ∈ V(R₂) ∩ V(Q) := + ⟨(hL₃_R2t.trans hR2t_le).vertexSet_mono hwL₃, (hCc_C.trans hC_Q).vertexSet_mono hwCc⟩ + rw [hR₂_ft.2.2, mem_singleton_iff] at this + exact (hc_not_R2t (this ▸ hL₃_R2t.vertexSet_mono hwL₃)).elim + · exact (disjoint_left.mp hdisj_R₁R₂ + (hR1D_le.vertexSet_mono hwR1D) ((hL₃_R2t.trans hR2t_le).vertexSet_mono hwL₃)).elim + · have : w ∈ V(R₂) ∩ V(Q) := + ⟨(hL₃_R2t.trans hR2t_le).vertexSet_mono hwL₃, (hDc_D.trans hD_Q).vertexSet_mono hwDc⟩ + rw [hR₂_ft.2.2, mem_singleton_iff] at this + exact (hc_not_R2t (this ▸ hL₃_R2t.vertexSet_mono hwL₃)).elim + · have : w ∈ V(P_d) ∩ V(R₂) := ⟨hwPd, (hL₃_R2t.trans hR2t_le).vertexSet_mono hwL₃⟩ + rwa [hPd_ft.2.2] at this + · have : w ∈ V(R2t) ∩ V(R2c) := ⟨hL₃_R2t.vertexSet_mono hwL₃, hwR2c⟩ + rwa [hinter_R2] at this + · rintro w rfl + exact ⟨hL₃_ft.1.left_mem, Or.inr (Or.inl hPd_ft.1.right_mem)⟩ + have hdisj_L₁L₂ : Disjoint V(C_a) V(D_b) := by + rw [disjoint_left] + intro w hwCa hwDb + have : w ∈ V(C) ∩ V(D) := ⟨hCa_C.vertexSet_mono hwCa, hDb_D.vertexSet_mono hwDb⟩ + rw [hinter_CD, mem_singleton_iff] at this + exact hc_not_Ca (this ▸ hwCa) + have hdisj_L₁L₃ : Disjoint V(C_a) V(L₃) := by + rw [disjoint_left] + intro w hwCa hwL₃ + have : w ∈ V(R₂) ∩ V(Q) := + ⟨(hL₃_R2t.trans hR2t_le).vertexSet_mono hwL₃, (hCa_C.trans hC_Q).vertexSet_mono hwCa⟩ + rw [hR₂_ft.2.2, mem_singleton_iff] at this + exact hc_not_Ca (this ▸ hwCa) + have hdisj_L₂L₃ : Disjoint V(D_b) V(L₃) := by + rw [disjoint_left] + intro w hwDb hwL₃ + have : w ∈ V(R₂) ∩ V(Q) := + ⟨(hL₃_R2t.trans hR2t_le).vertexSet_mono hwL₃, (hDb_D.trans hD_Q).vertexSet_mono hwDb⟩ + rw [hR₂_ft.2.2, mem_singleton_iff] at this + exact hc_not_Db (this ▸ hwDb) + have hdisj_L : Pairwise (fun i j : Fin 3 => Disjoint V(![C_a, D_b, L₃] i) V(![C_a, D_b, L₃] j)) := + pairwise_disjoint_fin3 hdisj_L₁L₂ hdisj_L₁L₃ hdisj_L₂L₃ + have hL_all : ∀ i : Fin 3, + IsFromToPathWithEnds S.G (![C_a, D_b, L₃] i) X_N S.Ω.bar (![u₁, v₁, z] i) (![a, b, t₃] i) + := by + intro i + fin_cases i + · exact hL₁_ft + · exact hL₂_ft + · exact hL₃_ft' + have hred := (redirectsTo_of_disjoint_fromToPaths hdisj_L hL_all).2.2.2.2 + rw [range_fin3, range_fin3] at hred + exact hred + +private theorem tripodFromIntersectingPaths + {Q P₁ C D R₁ R₂ C_a C_c D_c D_b R1C R1D P : Graph α β} + {a b c d u₁ v₁ t₂ p_end : α} + (hQ : S.IsOmegaPathWithEnds Q a b) + (hno_int : Disjoint (pathInternalVerts S.G Q) S.Ω.bar) + (hP₁ : IsGraphPathWithEnds S.G P₁ a b) (ht₂_ba : t₂ ∈ S.Ω.interval b a) (hc_Q : c ∈ V(Q)) + (hR₂_ft : IsFromToPathWithEnds S.G R₂ {t₂} V(Q) t₂ c) (hc_not_P₁ : c ∉ V(P₁)) + (hC_Q : C ≤ Q) (hD_Q : D ≤ Q) + (hC_path : IsGraphPathWithEnds Q C a c) (hD_path : IsGraphPathWithEnds Q D c b) + (hinter_CD : V(C) ∩ V(D) = {c}) + (hR₁_ft : IsFromToPathWithEnds S.G R₁ V(C) V(D) u₁ v₁) + (hu₁_ne_c : u₁ ≠ c) (hv₁_ne_c : v₁ ≠ c) (hd_R₁Q : d ∈ V(R₁) \ V(Q)) + (hP_G : IsGraphPathWithEnds S.G P d p_end) (hdisj_PQ : Disjoint V(P) V(Q)) + (hPR₁_inter : V(P) ∩ V(R₁) = {d}) + (hR1C_le : R1C ≤ R₁) (hR1D_le : R1D ≤ R₁) + (hR1C_path : IsGraphPathWithEnds R₁ R1C u₁ d) (hR1D_path : IsGraphPathWithEnds R₁ R1D d v₁) + (hinter_R1 : V(R1C) ∩ V(R1D) = {d}) + (hCa_C : C_a ≤ C) (hCc_C : C_c ≤ C) + (hCa_path : IsGraphPathWithEnds C C_a a u₁) (hCc_path : IsGraphPathWithEnds C C_c u₁ c) + (hinter_CaCc : V(C_a) ∩ V(C_c) = {u₁}) + (hDc_D : D_c ≤ D) (hDb_D : D_b ≤ D) + (hDc_path : IsGraphPathWithEnds D D_c c v₁) (hDb_path : IsGraphPathWithEnds D D_b v₁ b) + (hinter_DcDb : V(D_c) ∩ V(D_b) = {v₁}) + (hc_not_Ca : c ∉ V(C_a)) (hc_not_Db : c ∉ V(D_b)) + (hd_ne_u₁ : d ≠ u₁) (hd_ne_v₁ : d ≠ v₁) + (hv₁_not_R1C : v₁ ∉ V(R1C)) (hu₁_not_R1D : u₁ ∉ V(R1D)) + (hdisj_R₁R₂ : Disjoint V(R₁) V(R₂)) (hdisj_PR₂ : ¬Disjoint V(P) V(R₂)) : + ∃ N₁ N₂ N₃ : Graph α β, S.IsTripod N₁ N₂ N₃ := by + rw [not_disjoint_iff_nonempty_inter] at hdisj_PR₂ + rcases hdisj_PR₂ with ⟨z₀, hz₀_P, hz₀_R₂⟩ + obtain ⟨P_dz₀, hPdz₀_P, _, hPdz₀_G⟩ := hP_G.exists_subpath hP_G.left_mem hz₀_P + obtain ⟨d', hd'_eq, z, hz_R₂, P_d, hPd_Pdz₀, hPd_ft⟩ := + hPdz₀_G.exists_isFromToPathWithEnds (X := {d}) (Y := V(R₂)) rfl hz₀_R₂ + rw [mem_singleton_iff] at hd'_eq + subst d' + have hPd_P : P_d ≤ P := hPd_Pdz₀.trans hPdz₀_P + obtain ⟨R2t, R2c, hR2t_le, hR2c_le, hR2t_path, hR2c_path, _, hinter_R2, _⟩ := + hR₂_ft.1.exists_split_at hz_R₂ + -- Extract `{z} → S.Ω.bar` subpath `L₃ ≤ R2t` from `z` to `t₃ ∈ S.Ω.bar`. + obtain ⟨z', hz'_eq, t₃, ht₃_bar, L₃, hL₃_R2t, hL₃_ft⟩ := + (hR2t_path.mono hR₂_ft.1.le).symm.exists_isFromToPathWithEnds + (X := {z}) (Y := S.Ω.bar) rfl ht₂_ba.1.1 + rw [mem_singleton_iff] at hz'_eq + subst z' + -- Build `N₁ = R1C.symm ∪ C_c`, `N₂ = R1D ∪ D_c.symm`, `N₃ = P_d ∪ R2c`. + have hR1C_G : IsGraphPathWithEnds S.G R1C d u₁ := (hR1C_path.mono hR₁_ft.1.le).symm + have hCc_G : IsGraphPathWithEnds S.G C_c u₁ c := hCc_path.mono (hC_Q.trans hQ.1.le) + have hinter_N₁ : V(R1C) ∩ V(C_c) = {u₁} := by + ext w + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hwR, hwC⟩ => ?_, fun h => h ▸ ⟨hR1C_G.right_mem, hCc_G.left_mem⟩⟩ + have : w ∈ V(R₁) ∩ V(C) := ⟨hR1C_le.vertexSet_mono hwR, hCc_C.vertexSet_mono hwC⟩ + rwa [hR₁_ft.2.1, mem_singleton_iff] at this + let N₁ := subgraphUnion S.G R1C C_c + have hN₁_G : IsGraphPathWithEnds S.G N₁ d c := hR1C_G.subgraphUnion hCc_G hinter_N₁ + have hR1D_G : IsGraphPathWithEnds S.G R1D d v₁ := hR1D_path.mono hR₁_ft.1.le + have hDc_G : IsGraphPathWithEnds S.G D_c v₁ c := (hDc_path.mono (hD_Q.trans hQ.1.le)).symm + have hinter_N₂ : V(R1D) ∩ V(D_c) = {v₁} := by + ext w + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hwR, hwD⟩ => ?_, fun h => h ▸ ⟨hR1D_G.right_mem, hDc_G.left_mem⟩⟩ + have : w ∈ V(R₁) ∩ V(D) := ⟨hR1D_le.vertexSet_mono hwR, hDc_D.vertexSet_mono hwD⟩ + rwa [hR₁_ft.2.2, mem_singleton_iff] at this + let N₂ := subgraphUnion S.G R1D D_c + have hN₂_G : IsGraphPathWithEnds S.G N₂ d c := hR1D_G.subgraphUnion hDc_G hinter_N₂ + have hR2c_G : IsGraphPathWithEnds S.G R2c z c := hR2c_path.mono hR₂_ft.1.le + have hinter_N₃ : V(P_d) ∩ V(R2c) = {z} := by + ext w + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hwP, hwR⟩ => ?_, fun h => h ▸ ⟨hPd_ft.1.right_mem, hR2c_G.left_mem⟩⟩ + have : w ∈ V(P_d) ∩ V(R₂) := ⟨hwP, hR2c_le.vertexSet_mono hwR⟩ + rwa [hPd_ft.2.2, mem_singleton_iff] at this + let N₃ := subgraphUnion S.G P_d R2c + have hN₃_G : IsGraphPathWithEnds S.G N₃ d c := hPd_ft.1.subgraphUnion hR2c_G hinter_N₃ + have hdc_ne : d ≠ c := fun h => hd_R₁Q.2 (h ▸ hc_Q) + -- Pairwise intersections of `V(N₁), V(N₂), V(N₃)` are `{d, c}`. + have hinter_N₁N₂ : V(N₁) ∩ V(N₂) = {d, c} := by + apply Subset.antisymm + · rintro w ⟨hwR1C | hwCc, hwR1D | hwDc⟩ + · have : w ∈ V(R1C) ∩ V(R1D) := ⟨hwR1C, hwR1D⟩ + rw [hinter_R1, mem_singleton_iff] at this + exact Or.inl this + · have : w ∈ V(R₁) ∩ V(D) := ⟨hR1C_le.vertexSet_mono hwR1C, hDc_D.vertexSet_mono hwDc⟩ + rw [hR₁_ft.2.2, mem_singleton_iff] at this + exact (hv₁_not_R1C (this ▸ hwR1C)).elim + · have : w ∈ V(R₁) ∩ V(C) := ⟨hR1D_le.vertexSet_mono hwR1D, hCc_C.vertexSet_mono hwCc⟩ + rw [hR₁_ft.2.1, mem_singleton_iff] at this + exact (hu₁_not_R1D (this ▸ hwR1D)).elim + · have : w ∈ V(C) ∩ V(D) := ⟨hCc_C.vertexSet_mono hwCc, hDc_D.vertexSet_mono hwDc⟩ + rw [hinter_CD, mem_singleton_iff] at this + exact Or.inr this + · rintro w (rfl | rfl) + · exact ⟨hN₁_G.left_mem, hN₂_G.left_mem⟩ + · exact ⟨hN₁_G.right_mem, hN₂_G.right_mem⟩ + have hinter_N₁N₃ : V(N₁) ∩ V(N₃) = {d, c} := by + apply Subset.antisymm + · rintro w ⟨hwR1C | hwCc, hwPd | hwR2c⟩ + · have : w ∈ V(P) ∩ V(R₁) := ⟨hPd_P.vertexSet_mono hwPd, hR1C_le.vertexSet_mono hwR1C⟩ + rw [hPR₁_inter, mem_singleton_iff] at this + exact Or.inl this + · exact (disjoint_left.mp hdisj_R₁R₂ + (hR1C_le.vertexSet_mono hwR1C) (hR2c_le.vertexSet_mono hwR2c)).elim + · exact (disjoint_left.mp hdisj_PQ + (hPd_P.vertexSet_mono hwPd) ((hCc_C.trans hC_Q).vertexSet_mono hwCc)).elim + · have : w ∈ V(R₂) ∩ V(Q) := + ⟨hR2c_le.vertexSet_mono hwR2c, (hCc_C.trans hC_Q).vertexSet_mono hwCc⟩ + rw [hR₂_ft.2.2, mem_singleton_iff] at this + exact Or.inr this + · rintro w (rfl | rfl) + · exact ⟨hN₁_G.left_mem, hN₃_G.left_mem⟩ + · exact ⟨hN₁_G.right_mem, hN₃_G.right_mem⟩ + have hinter_N₂N₃ : V(N₂) ∩ V(N₃) = {d, c} := by + apply Subset.antisymm + · rintro w ⟨hwR1D | hwDc, hwPd | hwR2c⟩ + · have : w ∈ V(P) ∩ V(R₁) := ⟨hPd_P.vertexSet_mono hwPd, hR1D_le.vertexSet_mono hwR1D⟩ + rw [hPR₁_inter, mem_singleton_iff] at this + exact Or.inl this + · exact (disjoint_left.mp hdisj_R₁R₂ + (hR1D_le.vertexSet_mono hwR1D) (hR2c_le.vertexSet_mono hwR2c)).elim + · exact (disjoint_left.mp hdisj_PQ + (hPd_P.vertexSet_mono hwPd) ((hDc_D.trans hD_Q).vertexSet_mono hwDc)).elim + · have : w ∈ V(R₂) ∩ V(Q) := + ⟨hR2c_le.vertexSet_mono hwR2c, (hDc_D.trans hD_Q).vertexSet_mono hwDc⟩ + rw [hR₂_ft.2.2, mem_singleton_iff] at this + exact Or.inr this + · rintro w (rfl | rfl) + · exact ⟨hN₂_G.left_mem, hN₃_G.left_mem⟩ + · exact ⟨hN₂_G.right_mem, hN₃_G.right_mem⟩ + -- Internal vertices `u₁ ∈ V(N₁) \ {d, c}`, `v₁ ∈ V(N₂) \ {d, c}`, `z ∈ V(N₃) \ {d, c}`. + have hu₁_int : u₁ ∈ V(N₁) \ {d, c} := by + refine ⟨Or.inl hR1C_G.right_mem, ?_⟩ + simp [hd_ne_u₁.symm, hu₁_ne_c] + have hv₁_int : v₁ ∈ V(N₂) \ {d, c} := by + refine ⟨Or.inl hR1D_G.right_mem, ?_⟩ + simp [hd_ne_v₁.symm, hv₁_ne_c] + have hz_ne_d : z ≠ d := fun h => + disjoint_left.mp hdisj_R₁R₂ hd_R₁Q.1 (h ▸ hz_R₂) + have hz_ne_c : z ≠ c := fun h => + disjoint_left.mp hdisj_PQ (hPd_P.vertexSet_mono hPd_ft.1.right_mem) (h ▸ hc_Q) + have hz_int : z ∈ V(N₃) \ {d, c} := by + refine ⟨Or.inl hPd_ft.1.right_mem, ?_⟩ + simp [hz_ne_d, hz_ne_c] + have hred := S.redirectsTo_branchEnds hQ hno_int hP₁ hc_not_P₁ hC_Q hD_Q + hC_path hD_path hinter_CD hR₁_ft hR₂_ft hCa_C hCc_C hDc_D hDb_D + hCa_path hDb_path hinter_CaCc hinter_DcDb hc_not_Ca hc_not_Db + hR1C_le hR1D_le hu₁_not_R1D hv₁_not_R1C hR1C_G hR1D_G + hR2t_le hR2c_le hR2c_path hinter_R2 hz_ne_c hPd_P hPd_ft + hL₃_R2t hL₃_ft hdisj_PQ hdisj_R₁R₂ + exact ⟨N₁, N₂, N₃, d, c, hdc_ne, hN₁_G, hN₂_G, hN₃_G, + hinter_N₁N₂, hinter_N₁N₃, hinter_N₂N₃, + u₁, hu₁_int, v₁, hv₁_int, z, hz_int, + a, hQ.2.2.1, b, hQ.2.2.2, t₃, ht₃_bar, hred⟩ + +/-- Main geometric construction of (5.3) once `{P₁, P₂}` is normalized so that `P₁` has ends `a, b` +and `P₂` has ends `r, t₂` with `t₂ ∈ Ω(b, a)`. -/ +private theorem theorem_5_3_of_normalized {Q P₁ P₂ : Graph α β} {a b r t₂ : α} + (hQ : S.IsOmegaPathWithEnds Q a b) + (hQ_ind : S.G.induce V(Q) = Q) + (hno_int : Disjoint (pathInternalVerts S.G Q) S.Ω.bar) + (hab_empty : S.Ω.interval a b = ∅) + (hcatch : Catches (S.Ω.bar \ {a, b}) (deleteVertices S.G V(Q))) + (hr_Q : r ∈ V(Q)) + (hdisj_P : Disjoint V(P₁) V(P₂)) + (hP₁ : IsGraphPathWithEnds S.G P₁ a b) + (hP₂ : IsGraphPathWithEnds S.G P₂ r t₂) + (ht₂_ba : t₂ ∈ S.Ω.interval b a) : + (∃ M₁ M₂ : Graph α β, S.IsCross M₁ M₂) ∨ + (∃ N₁ N₂ N₃ : Graph α β, S.IsTripod N₁ N₂ N₃) := by + -- Extract minimal subpath `R₂ ≤ P₂` from `{t₂}` to `V(Q)` with ends `t₂, c`. + obtain ⟨t₂', ht₂'_eq, c, hc_Q, R₂, hR₂_P₂, hR₂_ft⟩ := + hP₂.symm.exists_isFromToPathWithEnds (X := {t₂}) (Y := V(Q)) rfl hr_Q + rw [mem_singleton_iff] at ht₂'_eq + subst t₂' + have hc_not_P₁ : c ∉ V(P₁) := fun hc₁ => + disjoint_left.mp hdisj_P hc₁ (hR₂_P₂.vertexSet_mono hR₂_ft.1.right_mem) + -- Split `Q` at `c` into `C` (from `a` to `c`) and `D` (from `c` to `b`). + obtain ⟨C, D, hC_Q, hD_Q, hC_path, hD_path, hunion_CD, hinter_CD, hdisj_ECD⟩ := + hQ.1.exists_split_at hc_Q + have hVC_UD : V(C) ∪ V(D) = V(Q) := by + rw [← vertexSet_subgraphUnion Q C D, hunion_CD] + have hEC_UD : E(C) ∪ E(D) = E(Q) := by + rw [← edgeSet_subgraphUnion hC_Q hD_Q, hunion_CD] + -- Extract minimal subpath `R₁ ≤ P₁` from `V(C)` to `V(D)` with ends `u₁ ∈ V(C)` and `v₁ ∈ V(D)`. + obtain ⟨u₁, hu₁_C, v₁, hv₁_D, R₁, hR₁_P₁, hR₁_ft⟩ := + hP₁.exists_isFromToPathWithEnds (X := V(C)) (Y := V(D)) hC_path.left_mem hD_path.right_mem + have hu₁_ne_c : u₁ ≠ c := fun h => hc_not_P₁ (h ▸ hR₁_P₁.vertexSet_mono hR₁_ft.1.left_mem) + have hv₁_ne_c : v₁ ≠ c := fun h => hc_not_P₁ (h ▸ hR₁_P₁.vertexSet_mono hR₁_ft.1.right_mem) + have hu₁_not_D : u₁ ∉ V(D) := fun h => + hu₁_ne_c (by + have : u₁ ∈ V(C) ∩ V(D) := ⟨hu₁_C, h⟩ + rwa [hinter_CD, mem_singleton_iff] at this) + have hv₁_not_C : v₁ ∉ V(C) := fun h => + hv₁_ne_c (by + have : v₁ ∈ V(C) ∩ V(D) := ⟨h, hv₁_D⟩ + rwa [hinter_CD, mem_singleton_iff] at this) + have hu₁v₁_ne : u₁ ≠ v₁ := fun h => hu₁_not_D (h ▸ hv₁_D) + have hR₁_Q_inter : V(R₁) ∩ V(Q) = {u₁, v₁} := by + rw [← hVC_UD, inter_union_distrib_left, hR₁_ft.2.1, hR₁_ft.2.2] + rfl + -- Since `Q` is induced in `S.G`, `u₁` and `v₁` are not adjacent in `S.G`. + have hnadj_uv : ¬ S.G.Adj u₁ v₁ := by + rintro ⟨e, huv⟩ + have huv_Q : Q.IsLink e u₁ v₁ := by + rw [← hQ_ind, induce_isLink] + exact ⟨huv, hC_Q.vertexSet_mono hu₁_C, hD_Q.vertexSet_mono hv₁_D⟩ + have he_CD : e ∈ E(C) ∪ E(D) := hEC_UD.symm ▸ huv_Q.edge_mem + rcases he_CD with heC | heD + · have hlinkC : C.IsLink e u₁ v₁ := (hC_Q.isLink_iff heC).mpr huv_Q + exact hv₁_not_C hlinkC.right_mem + · have hlinkD : D.IsLink e u₁ v₁ := (hD_Q.isLink_iff heD).mpr huv_Q + exact hu₁_not_D hlinkD.left_mem + obtain ⟨w₀, hw₀_R₁, hw₀_u₁, hw₀_v₁⟩ := + exists_internal_of_not_adj hR₁_ft.1 hu₁v₁_ne hnadj_uv + have hw₀_not_Q : w₀ ∉ V(Q) := by + intro hw₀_Q + have : w₀ ∈ V(R₁) ∩ V(Q) := ⟨hw₀_R₁, hw₀_Q⟩ + rw [hR₁_Q_inter, mem_insert_iff, mem_singleton_iff] at this + rcases this with rfl | rfl + · exact hw₀_u₁ rfl + · exact hw₀_v₁ rfl + -- Use `hcatch` to find a `(V(R₁) \ V(Q)) → (S.Ω.bar \ {a, b})` path `P ≤ deleteVertices S.G + -- V(Q)`. + let G_del := deleteVertices S.G V(Q) + have hX_sub : V(R₁) \ V(Q) ⊆ V(G_del) := + sdiff_le_sdiff_right hR₁_ft.1.le.vertexSet_mono + obtain ⟨d, hd_R₁Q, p_end, hp_bar_ab, P, hP_Gdel, hP_ft⟩ := + exists_isFromToPathWithEnds_of_catches hcatch hX_sub ⟨hw₀_R₁, hw₀_not_Q⟩ + have hP_G : IsGraphPathWithEnds S.G P d p_end := + hP_ft.1.mono (deleteVertices_le S.G V(Q)) + have hdisj_PQ : Disjoint V(P) V(Q) := + disjoint_left.mpr fun z hzP hzQ => (hP_Gdel.vertexSet_mono hzP).2 hzQ + have hPR₁_inter : V(P) ∩ V(R₁) = {d} := by + rw [← hP_ft.2.1] + ext z + simp only [mem_inter_iff, mem_sdiff] + exact ⟨fun ⟨hzP, hzR₁⟩ => ⟨hzP, hzR₁, disjoint_left.mp hdisj_PQ hzP⟩, + fun ⟨hzP, hzR₁, _⟩ => ⟨hzP, hzR₁⟩⟩ + -- Split `R₁` at `d`, `C` at `u₁`, and `D` at `v₁`. + obtain ⟨R1C, R1D, hR1C_le, hR1D_le, hR1C_path, hR1D_path, _, hinter_R1, _⟩ := + hR₁_ft.1.exists_split_at hd_R₁Q.1 + obtain ⟨C_a, C_c, hCa_C, hCc_C, hCa_path, hCc_path, _, hinter_CaCc, _⟩ := + (hC_path.mono hQ.1.le).exists_split_at hu₁_C + obtain ⟨D_c, D_b, hDc_D, hDb_D, hDc_path, hDb_path, _, hinter_DcDb, _⟩ := + (hD_path.mono hQ.1.le).exists_split_at hv₁_D + have hc_not_Ca : c ∉ V(C_a) := fun hc_Ca => + hu₁_ne_c <| Eq.symm <| by + have : c ∈ V(C_a) ∩ V(C_c) := ⟨hc_Ca, hCc_path.right_mem⟩ + rwa [hinter_CaCc, mem_singleton_iff] at this + have hc_not_Db : c ∉ V(D_b) := fun hc_Db => + hv₁_ne_c <| Eq.symm <| by + have : c ∈ V(D_c) ∩ V(D_b) := ⟨hDc_path.left_mem, hc_Db⟩ + rwa [hinter_DcDb, mem_singleton_iff] at this + have hd_ne_u₁ : d ≠ u₁ := fun h => hd_R₁Q.2 (h ▸ hC_Q.vertexSet_mono hu₁_C) + have hd_ne_v₁ : d ≠ v₁ := fun h => hd_R₁Q.2 (h ▸ hD_Q.vertexSet_mono hv₁_D) + have hv₁_not_R1C : v₁ ∉ V(R1C) := fun h => + hd_ne_v₁ <| Eq.symm <| by + have : v₁ ∈ V(R1C) ∩ V(R1D) := ⟨h, hR1D_path.right_mem⟩ + rwa [hinter_R1, mem_singleton_iff] at this + have hu₁_not_R1D : u₁ ∉ V(R1D) := fun h => + hd_ne_u₁ <| Eq.symm <| by + have : u₁ ∈ V(R1C) ∩ V(R1D) := ⟨hR1C_path.left_mem, h⟩ + rwa [hinter_R1, mem_singleton_iff] at this + have hdisj_R₁R₂ : Disjoint V(R₁) V(R₂) := + hdisj_P.mono hR₁_P₁.vertexSet_mono hR₂_P₂.vertexSet_mono + -- Branch on whether `V(P)` and `V(R₂)` are disjoint. + by_cases hdisj_PR₂ : Disjoint V(P) V(R₂) + · -- Case 1: `Disjoint V(P) V(R₂)` yields a cross in `S`. + exact Or.inl (S.crossFromSplitPaths hQ hab_empty ht₂_ba hR₂_ft hC_Q hD_Q + hC_path hD_path hinter_CD hR₁_ft hCa_C hDb_D hCa_path hDb_path hc_not_Ca hc_not_Db + hR1C_le hR1D_le hR1C_path hR1D_path hv₁_not_R1C hu₁_not_R1D + hp_bar_ab hP_G hdisj_PQ hPR₁_inter hdisj_R₁R₂ hdisj_PR₂) + · exact Or.inr (S.tripodFromIntersectingPaths hQ hno_int hP₁ ht₂_ba hc_Q hR₂_ft + hc_not_P₁ hC_Q hD_Q hC_path hD_path hinter_CD hR₁_ft hu₁_ne_c hv₁_ne_c + hd_R₁Q hP_G hdisj_PQ hPR₁_inter hR1C_le hR1D_le hR1C_path hR1D_path hinter_R1 + hCa_C hCc_C hCa_path hCc_path hinter_CaCc + hDc_D hDb_D hDc_path hDb_path hinter_DcDb hc_not_Ca hc_not_Db hd_ne_u₁ hd_ne_v₁ + hv₁_not_R1C hu₁_not_R1D hdisj_R₁R₂ hdisj_PR₂) + +/-- Helper for (5.3): once `a, b, r ∈ {s₁, t₁, s₂, t₂}` for a cross `{P₁, P₂}` of `S₁` where `r = +s₂`, +we must have `t₂ ∈ Ω(b, a)` and `{s₁, t₁} = {a, b}`, allowing us to apply +`theorem_5_3_of_normalized`. -/ +private theorem theorem_5_3_of_s₂_eq_r {S₁ : Society α β} {Q P₁ P₂ : Graph α β} + {a b r s₁ t₁ t₂ : α} + (hG : S₁.G = S.G) + (hQ : S.IsOmegaPathWithEnds Q a b) + (hQ_ind : S.G.induce V(Q) = Q) + (hab_empty : S.Ω.interval a b = ∅) + (hcatch : Catches (S.Ω.bar \ {a, b}) (deleteVertices S.G V(Q))) + (hno_int : Disjoint (pathInternalVerts S.G Q) S.Ω.bar) + (hr_Q : r ∈ V(Q) \ {a, b}) + (hbar₁ : S₁.Ω.bar = S.Ω.bar ∪ {r}) + (hrest₁ : S₁.Ω.IsRestriction S.Ω.bar S.Ω) + (hcw_arb : S₁.Ω.IsClockwise3 a r b) + (hdisj_P : Disjoint V(P₁) V(P₂)) + (hP₁ : S₁.IsOmegaPathWithEnds P₁ s₁ t₁) + (hP₂ : S₁.IsOmegaPathWithEnds P₂ r t₂) + (hcr_ends : S₁.Ω.Crosses s₁ t₁ r t₂) + (ha_mem : a ∈ ({s₁, t₁, r, t₂} : Set α)) + (hb_mem : b ∈ ({s₁, t₁, r, t₂} : Set α)) : + (∃ M₁ M₂ : Graph α β, S.IsCross M₁ M₂) ∨ + (∃ N₁ N₂ N₃ : Graph α β, S.IsTripod N₁ N₂ N₃) := by + have hr_not_bar : r ∉ S.Ω.bar := by + have hr_int : r ∈ pathInternalVerts S.G Q := by + rw [hQ.1.pathInternalVerts_eq] + exact hr_Q + exact disjoint_left.mp hno_int hr_int + obtain ⟨_, h₁_ar, h₁_rb, _, h_ba_sdiff⟩ := + S.Ω.extension_intervals hbar₁ hrest₁ hab_empty hcw_arb + have h_not_empty := hcr_ends.symm.not_interval_empty + have ht₂_ne_a : t₂ ≠ a := fun h => h_not_empty (Or.inr (h ▸ h₁_ar)) + have ht₂_ne_b : t₂ ≠ b := fun h => h_not_empty (Or.inl (h ▸ h₁_rb)) + have ht₂_bar : t₂ ∈ S.Ω.bar := by + have ht₂_bar₁ : t₂ ∈ S₁.Ω.bar := hP₂.2.2.2 + rw [hbar₁, mem_union, mem_singleton_iff] at ht₂_bar₁ + exact ht₂_bar₁.resolve_right hP₂.2.1.symm + have ht₂_ba : t₂ ∈ S.Ω.interval b a := by + rw [h_ba_sdiff] + exact ⟨ht₂_bar, fun h => by + rcases h with rfl | h_eq + · exact ht₂_ne_a rfl + · exact ht₂_ne_b (mem_singleton_iff.mp h_eq)⟩ + have ha_ne_r : a ≠ r := fun h => hr_Q.2 (Or.inl h.symm) + have hb_ne_r : b ≠ r := fun h => hr_Q.2 (Or.inr (mem_singleton_iff.mpr h.symm)) + have ha_s₁t₁ : a = s₁ ∨ a = t₁ := by + rcases ha_mem with rfl | rfl | rfl | h_eq + · exact Or.inl rfl + · exact Or.inr rfl + · exact (ha_ne_r rfl).elim + · exact (ht₂_ne_a (mem_singleton_iff.mp h_eq).symm).elim + have hb_s₁t₁ : b = s₁ ∨ b = t₁ := by + rcases hb_mem with rfl | rfl | rfl | h_eq + · exact Or.inl rfl + · exact Or.inr rfl + · exact (hb_ne_r rfl).elim + · exact (ht₂_ne_b (mem_singleton_iff.mp h_eq).symm).elim + have hP₁_ab : IsGraphPathWithEnds S.G P₁ a b := by + have hP₁_G : IsGraphPathWithEnds S.G P₁ s₁ t₁ := hG ▸ hP₁.1 + rcases ha_s₁t₁ with rfl | rfl <;> rcases hb_s₁t₁ with rfl | rfl + · exact (hQ.2.1 rfl).elim + · exact hP₁_G + · exact hP₁_G.symm + · exact (hQ.2.1 rfl).elim + have hP₂_rt₂ : IsGraphPathWithEnds S.G P₂ r t₂ := hG ▸ hP₂.1 + exact S.theorem_5_3_of_normalized hQ hQ_ind hno_int hab_empty hcatch hr_Q.1 + hdisj_P hP₁_ab hP₂_rt₂ ht₂_ba + +/-- **Graph Minors IX, (5.3)** (page 53): +"Let $Q$ be an induced $\Omega$-path in $(K, \Omega)$ with ends $a, b$ such that $\Omega(a, +b) = \emptyset$ and $\bar{\Omega} - \{a, b\}$ catches $K \setminus V(Q)$, and no internal +vertex of $Q$ is in $\bar{\Omega}$. Let $r \in V(Q) - \{a, b\}$, and let $\Omega_1$ be the +cyclic permutation in $V(K)$ with $\bar{\Omega}_1 = \bar{\Omega} \cup \{r\}$ and $\Omega_1 +\mid \bar{\Omega} = \Omega$, and with $(a, r, b)$ $\Omega_1$-clockwise. If $(K, \Omega_1)$ +has a cross then $(K, \Omega)$ has a cross or tripod." -/ +theorem theorem_5_3_proof [Finite V(S.G)] [Finite E(S.G)] + {S₁ : Society α β} {Q : Graph α β} {a b r : α} + (hG : S₁.G = S.G) + (hQ : S.IsOmegaPathWithEnds Q a b) + (hQ_ind : S.G.induce V(Q) = Q) + (hab_empty : S.Ω.interval a b = ∅) + (hcatch : Catches (S.Ω.bar \ {a, b}) (deleteVertices S.G V(Q))) + (hno_int : Disjoint (pathInternalVerts S.G Q) S.Ω.bar) + (hr_Q : r ∈ V(Q) \ {a, b}) + (hbar₁ : S₁.Ω.bar = S.Ω.bar ∪ {r}) + (hrest₁ : S₁.Ω.IsRestriction S.Ω.bar S.Ω) + (hcw_arb : S₁.Ω.IsClockwise3 a r b) + (hcross₁ : ∃ P₁ P₂ : Graph α β, S₁.IsCross P₁ P₂) : + (∃ M₁ M₂ : Graph α β, S.IsCross M₁ M₂) ∨ + (∃ N₁ N₂ N₃ : Graph α β, S.IsTripod N₁ N₂ N₃) := by + by_cases hcross : ∃ M₁ M₂ : Graph α β, S.IsCross M₁ M₂ + · exact Or.inl hcross + · -- Choose a cross `{P₁, P₂}` of `S₁` minimizing `|V(P₁ ∪ P₂ ∪ Q)| + |E(P₁ ∪ P₂ ∪ Q)|`. + let cost (P₁ P₂ : Graph α β) : ℕ := + (V(subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q)).ncard + + (E(subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q)).ncard + have hex : ∃ n : ℕ, ∃ P₁ P₂ : Graph α β, S₁.IsCross P₁ P₂ ∧ cost P₁ P₂ = n := by + rcases hcross₁ with ⟨P₁, P₂, hcr⟩ + exact ⟨cost P₁ P₂, P₁, P₂, hcr, rfl⟩ + classical + obtain ⟨P₁, P₂, hcr₁, hcost_eq⟩ := Nat.find_spec hex + have hmin_cost : ∀ P₁' P₂' : Graph α β, S₁.IsCross P₁' P₂' → cost P₁ P₂ ≤ cost P₁' P₂' := by + intro P₁' P₂' hcr' + rw [hcost_eq] + exact Nat.find_min' hex ⟨P₁', P₂', hcr', rfl⟩ + have hmin : ∀ P₁' P₂' : Graph α β, S₁.IsCross P₁' P₂' → + subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q ≤ + subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q → + V(subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q) = + V(subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q) ∧ + E(subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q) = + E(subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q) := by + intro P₁' P₂' hcr' hle + let H' := subgraphUnion S.G (subgraphUnion S.G P₁' P₂') Q + let H := subgraphUnion S.G (subgraphUnion S.G P₁ P₂) Q + rcases hcr₁ with ⟨_, s₁, t₁, s₂, t₂, hP₁, hP₂, _⟩ + have hH_le : H ≤ S.G := + subgraphUnion_le (subgraphUnion_le (hG ▸ hP₁.1.le) (hG ▸ hP₂.1.le)) hQ.1.le + have hVH_fin : V(H).Finite := toFinite V(S.G) |>.subset hH_le.vertexSet_mono + have hEH_fin : E(H).Finite := toFinite E(S.G) |>.subset hH_le.edgeSet_mono + have hV_le : V(H').ncard ≤ V(H).ncard := ncard_le_ncard hle.vertexSet_mono hVH_fin + have hE_le : E(H').ncard ≤ E(H).ncard := ncard_le_ncard hle.edgeSet_mono hEH_fin + have h_cost : V(H).ncard + E(H).ncard ≤ V(H').ncard + E(H').ncard := hmin_cost P₁' P₂' hcr' + have hV_ge : V(H).ncard ≤ V(H').ncard := by omega + have hE_ge : E(H).ncard ≤ E(H').ncard := by omega + exact ⟨eq_of_subset_of_ncard_le hle.vertexSet_mono hV_ge hVH_fin, + eq_of_subset_of_ncard_le hle.edgeSet_mono hE_ge hEH_fin⟩ + rcases hcr₁ with ⟨hdisj_P, s₁, t₁, s₂, t₂, hP₁, hP₂, hcr_ends⟩ + have hclaim1 := S.lemma_5_3_claim_1 hG hbar₁ hrest₁ hab_empty hcw_arb hQ hno_int hr_Q + hdisj_P hP₁ hP₂ hcr_ends hmin + obtain ⟨ha_mem, hb_mem⟩ := hclaim1.resolve_left hcross + have hr_mem : r ∈ ({s₁, t₁, s₂, t₂} : Set α) := + S.mem_ends_of_isCross_of_not_hasCross hG hbar₁ hrest₁ hcross + hdisj_P hP₁ hP₂ hcr_ends + -- Normalize `(P₁, s₁, t₁)` and `(P₂, s₂, t₂)` so that `r` is the left end of the second path. + rcases hr_mem with rfl | rfl | rfl | h_eq + · -- `r = s₁`: swap `P₁` and `P₂`. + refine S.theorem_5_3_of_s₂_eq_r hG hQ hQ_ind hab_empty hcatch hno_int hr_Q + hbar₁ hrest₁ hcw_arb hdisj_P.symm hP₂ hP₁ hcr_ends.symm ?_ ?_ + · rcases ha_mem with ha | ha | ha | ha <;> simp_all + · rcases hb_mem with hb | hb | hb | hb <;> simp_all + · -- `r = t₁`: swap `P₁` and `P₂` and reverse `P₁`. + refine S.theorem_5_3_of_s₂_eq_r hG hQ hQ_ind hab_empty hcatch hno_int hr_Q + hbar₁ hrest₁ hcw_arb hdisj_P.symm hP₂ hP₁.symm hcr_ends.symm.swap_right ?_ ?_ + · rcases ha_mem with ha | ha | ha | ha <;> simp_all + · rcases hb_mem with hb | hb | hb | hb <;> simp_all + · -- `r = s₂`: already normalized. + exact S.theorem_5_3_of_s₂_eq_r hG hQ hQ_ind hab_empty hcatch hno_int hr_Q + hbar₁ hrest₁ hcw_arb hdisj_P hP₁ hP₂ hcr_ends ha_mem hb_mem + · -- `r = t₂`: reverse `P₂`. + have hr_t₂ : r = t₂ := mem_singleton_iff.mp h_eq + subst hr_t₂ + refine S.theorem_5_3_of_s₂_eq_r hG hQ hQ_ind hab_empty hcatch hno_int hr_Q + hbar₁ hrest₁ hcw_arb hdisj_P hP₁ hP₂.symm hcr_ends.swap_right ?_ ?_ + · rcases ha_mem with ha | ha | ha | ha <;> simp_all + · rcases hb_mem with hb | hb | hb | hb <;> simp_all + +/-! ## Proof of (5.4): Contracting a Separating Path and Tripod-to-Cross Reduction -/ + +/-- Contraction map sending every vertex in `V(Q)` to `a` and fixing all other vertices. -/ +private noncomputable def contractMap (Q : Graph α β) (a u : α) : α := + by classical exact if u ∈ V(Q) then a else u + +private theorem contractMap_of_mem {Q : Graph α β} {a u : α} (hu : u ∈ V(Q)) : + contractMap Q a u = a := by + simp [contractMap, hu] + +private theorem contractMap_of_notMem {Q : Graph α β} {a u : α} (hu : u ∉ V(Q)) : + contractMap Q a u = u := by + simp [contractMap, hu] + +private theorem contractMap_eq_self_of_ne {Q : Graph α β} {a u : α} + (h : contractMap Q a u ≠ a) : u ∉ V(Q) ∧ contractMap Q a u = u := by + by_cases hu : u ∈ V(Q) + · exact (h (contractMap_of_mem hu)).elim + · exact ⟨hu, contractMap_of_notMem hu⟩ + +private theorem contractMap_mem {G₁ Q : Graph α β} {a u : α} (hu : u ∈ V(G₁)) : + contractMap Q a u ∈ (V(G₁) \ V(Q)) ∪ {a} := by + by_cases huQ : u ∈ V(Q) + · rw [contractMap_of_mem huQ] + exact Or.inr rfl + · rw [contractMap_of_notMem huQ] + exact Or.inl ⟨hu, huQ⟩ + +/-- The graph `G''` obtained from `G₁` by contracting `V(Q)` onto `a`. -/ +private noncomputable def contractGraph (G₁ Q : Graph α β) (a : α) : Graph α β where + vertexSet := (V(G₁) \ V(Q)) ∪ {a} + edgeSet := E(G₁) + IsLink e x y := ∃ u v : α, G₁.IsLink e u v ∧ x = contractMap Q a u ∧ y = contractMap Q a v + isLink_symm _ _ := ⟨fun _ _ ⟨u, v, huv, hx, hy⟩ => ⟨v, u, huv.symm, hy, hx⟩⟩ + eq_or_eq_of_isLink_of_isLink e x y z w := by + rintro ⟨u₁, v₁, h₁, rfl, rfl⟩ ⟨u₂, v₂, h₂, rfl, rfl⟩ + rcases h₁.left_eq_or_eq h₂ with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + edge_mem_iff_exists_isLink e := by + constructor + · intro he + obtain ⟨u, v, huv⟩ := G₁.exists_isLink_of_mem_edgeSet he + exact ⟨contractMap Q a u, contractMap Q a v, u, v, huv, rfl, rfl⟩ + · rintro ⟨_, _, u, v, huv, _, _⟩ + exact huv.edge_mem + left_mem_of_isLink e x y := by + rintro ⟨u, _, huv, rfl, _⟩ + exact contractMap_mem huv.left_mem + +@[simp] +private theorem vertexSet_contractGraph (G₁ Q : Graph α β) (a : α) : + V(contractGraph G₁ Q a) = (V(G₁) \ V(Q)) ∪ {a} := rfl + +@[simp] +private theorem edgeSet_contractGraph (G₁ Q : Graph α β) (a : α) : + E(contractGraph G₁ Q a) = E(G₁) := rfl + +private theorem deleteVertices_contractGraph {G₁ Q : Graph α β} {a : α} (ha_Q : a ∈ V(Q)) : + deleteVertices (contractGraph G₁ Q a) {a} = deleteVertices G₁ V(Q) := by + refine Graph.ext ?_ fun e x y => ?_ + · ext z + simp only [vertexSet_deleteVertices, vertexSet_contractGraph, mem_sdiff, mem_union, + mem_singleton_iff] + constructor + · rintro ⟨hz | rfl, hne⟩ + · exact hz + · exact (hne rfl).elim + · rintro ⟨hz₁, hzQ⟩ + exact ⟨Or.inl ⟨hz₁, hzQ⟩, fun h => hzQ (h ▸ ha_Q)⟩ + · simp only [deleteVertices_isLink, mem_singleton_iff] + constructor + · rintro ⟨⟨u, v, huv, hx_eq, hy_eq⟩, hxa, hya⟩ + obtain ⟨huQ, hu_eq⟩ := contractMap_eq_self_of_ne (hx_eq ▸ hxa) + obtain ⟨hvQ, hv_eq⟩ := contractMap_eq_self_of_ne (hy_eq ▸ hya) + have hxu : x = u := hx_eq.trans hu_eq + have hyv : y = v := hy_eq.trans hv_eq + exact ⟨hxu ▸ hyv ▸ huv, hxu ▸ huQ, hyv ▸ hvQ⟩ + · rintro ⟨hxy, hxQ, hyQ⟩ + exact ⟨⟨x, y, hxy, (contractMap_of_notMem hxQ).symm, (contractMap_of_notMem hyQ).symm⟩, + fun h => hxQ (h ▸ ha_Q), fun h => hyQ (h ▸ ha_Q)⟩ + +private theorem deleteVertices_eq_of_isGraphSeparation {G G₁ G₂ Q : Graph α β} + (hsep : IsGraphSeparation G G₁ G₂) (hinter : V(G₁) ∩ V(G₂) = V(Q)) : + deleteVertices G V(G₂) = deleteVertices G₁ V(Q) := by + refine Graph.ext ?_ fun e x y => ?_ + · ext z + simp only [vertexSet_deleteVertices, mem_sdiff] + rw [← hsep.2.2.1, ← hinter] + simp only [mem_union, mem_inter_iff] + tauto + · simp only [deleteVertices_isLink] + constructor + · rintro ⟨hxy, hx₂, hy₂⟩ + have he : e ∈ E(G₁) ∪ E(G₂) := hsep.2.2.2.1 ▸ hxy.edge_mem + rcases he with he₁ | he₂ + · have hxy₁ : G₁.IsLink e x y := (hsep.1.isLink_iff he₁).mpr hxy + have hxQ : x ∉ V(Q) := fun h => hx₂ (hinter ▸ h).2 + have hyQ : y ∉ V(Q) := fun h => hy₂ (hinter ▸ h).2 + exact ⟨hxy₁, hxQ, hyQ⟩ + · have hxy₂ : G₂.IsLink e x y := (hsep.2.1.isLink_iff he₂).mpr hxy + exact (hx₂ hxy₂.left_mem).elim + · rintro ⟨hxy₁, hxQ, hyQ⟩ + refine ⟨hxy₁.mono hsep.1, fun hx₂ => hxQ ?_, fun hy₂ => hyQ ?_⟩ + · rw [← hinter]; exact ⟨hxy₁.left_mem, hx₂⟩ + · rw [← hinter]; exact ⟨hxy₁.right_mem, hy₂⟩ + +/-- Any two vertices in `V(Q)` are connected by a walk in `G₁` whose support lies in `V(Q)`. -/ +private theorem exists_walk_in_Q {G₁ Q : Graph α β} {a b u v : α} + (hQ : IsGraphPathWithEnds G₁ Q a b) (hu : u ∈ V(Q)) (hv : v ∈ V(Q)) : + ∃ W : GraphWalk G₁ u v, ∀ z ∈ W.support, z ∈ V(Q) := by + obtain ⟨P_uv, hPuv_Q, _, hPuv_G₁⟩ := hQ.exists_subpath hu hv + obtain ⟨hPuv_le, W₀, _, hV₀, _⟩ := hPuv_G₁ + obtain ⟨W, hW_supp, _⟩ := W₀.exists_transfer + (fun _ _ _ _ hl => hl.mono hPuv_le) (fun _ hx => hPuv_le.vertexSet_mono (by rw [hV₀]; exact hx)) + refine ⟨W, fun z hz => hPuv_Q.vertexSet_mono ?_⟩ + rw [hV₀, mem_ofPred_eq, ← hW_supp] + exact hz + +/-- A single edge step in `contractGraph G₁ Q a` lifts to a walk in `G₁`. -/ +private theorem exists_step_lift_walk {G₁ Q : Graph α β} {a b : α} + (hQ : IsGraphPathWithEnds G₁ Q a b) {e : β} {x y : α} + (hlink : (contractGraph G₁ Q a).IsLink e x y) : + ∃ W : GraphWalk G₁ x y, + ∀ z ∈ W.support, z = x ∨ z = y ∨ ((x = a ∨ y = a) ∧ z ∈ V(Q)) := by + rcases hlink with ⟨u, v, huv, hx_eq, hy_eq⟩ + have hW_xu : ∃ W₁ : GraphWalk G₁ x u, + ∀ z ∈ W₁.support, z = x ∨ (x = a ∧ z ∈ V(Q)) := by + by_cases huQ : u ∈ V(Q) + · have hxa : x = a := hx_eq.trans (contractMap_of_mem huQ) + obtain ⟨W₁, hW₁⟩ := exists_walk_in_Q hQ (hxa ▸ hQ.left_mem) huQ + exact ⟨W₁, fun z hz => Or.inr ⟨hxa, hW₁ z hz⟩⟩ + · have hxu : x = u := hx_eq.trans (contractMap_of_notMem huQ) + subst hxu + exact ⟨.nil huv.left_mem, fun z hz => Or.inl (List.mem_singleton.mp hz)⟩ + have hW_vy : ∃ W₂ : GraphWalk G₁ v y, + ∀ z ∈ W₂.support, z = y ∨ (y = a ∧ z ∈ V(Q)) := by + by_cases hvQ : v ∈ V(Q) + · have hya : y = a := hy_eq.trans (contractMap_of_mem hvQ) + obtain ⟨W₂, hW₂⟩ := exists_walk_in_Q hQ hvQ (hya ▸ hQ.left_mem) + exact ⟨W₂, fun z hz => Or.inr ⟨hya, hW₂ z hz⟩⟩ + · have hyv : y = v := hy_eq.trans (contractMap_of_notMem hvQ) + subst hyv + exact ⟨.nil huv.right_mem, fun z hz => Or.inl (List.mem_singleton.mp hz)⟩ + obtain ⟨W₁, hW₁⟩ := hW_xu + obtain ⟨W₂, hW₂⟩ := hW_vy + let W_uv : GraphWalk G₁ u v := .cons huv (.nil huv.right_mem) + refine ⟨W₁.append (W_uv.append W₂), fun z hz => ?_⟩ + rw [GraphWalk.mem_support_append] at hz + rcases hz with hz₁ | hz₂₃ + · rcases hW₁ z hz₁ with rfl | ⟨hxa, hzQ⟩ + · exact Or.inl rfl + · exact Or.inr (Or.inr ⟨Or.inl hxa, hzQ⟩) + · rw [GraphWalk.mem_support_append] at hz₂₃ + rcases hz₂₃ with hz_uv | hz₂ + · simp only [W_uv, GraphWalk.support_cons, GraphWalk.support_nil, List.mem_cons] at hz_uv + rcases hz_uv with hzu | hzv | h_nil + · subst z + rcases hW₁ u W₁.end_mem_support with rfl | ⟨hxa, huQ⟩ + · exact Or.inl rfl + · exact Or.inr (Or.inr ⟨Or.inl hxa, huQ⟩) + · subst z + rcases hW₂ v W₂.start_mem_support with rfl | ⟨hya, hvQ⟩ + · exact Or.inr (Or.inl rfl) + · exact Or.inr (Or.inr ⟨Or.inr hya, hvQ⟩) + · exact (List.not_mem_nil h_nil).elim + · rcases hW₂ z hz₂ with rfl | ⟨hya, hzQ⟩ + · exact Or.inr (Or.inl rfl) + · exact Or.inr (Or.inr ⟨Or.inr hya, hzQ⟩) + +/-- Every walk in `contractGraph G₁ Q a` lifts to a walk in `G₁` with the same endpoints. -/ +private theorem exists_lift_walk {G₁ Q : Graph α β} {a b s t : α} + (hQ : IsGraphPathWithEnds G₁ Q a b) + (W : GraphWalk (contractGraph G₁ Q a) s t) : + ∃ W' : GraphWalk G₁ s t, + ∀ z ∈ W'.support, z ∈ W.support ∨ (a ∈ W.support ∧ z ∈ V(Q)) := by + induction W with + | @nil u hu => + have hu_G₁ : u ∈ V(G₁) := by + rcases hu with ⟨hu₁, _⟩ | rfl + · exact hu₁ + · exact hQ.le.vertexSet_mono hQ.left_mem + exact ⟨.nil hu_G₁, fun z hz => Or.inl hz⟩ + | @cons x y t e hxy W_rest ih => + obtain ⟨W_step, hstep⟩ := exists_step_lift_walk hQ hxy + obtain ⟨W_tail, htail⟩ := ih + refine ⟨W_step.append W_tail, fun z hz => ?_⟩ + rw [GraphWalk.mem_support_append] at hz + rcases hz with hz₁ | hz₂ + · rcases hstep z hz₁ with rfl | rfl | ⟨hxy_a, hzQ⟩ + · exact Or.inl List.mem_cons_self + · exact Or.inl (List.mem_cons_of_mem x W_rest.start_mem_support) + · refine Or.inr ⟨?_, hzQ⟩ + rcases hxy_a with rfl | rfl + · exact List.mem_cons_self + · exact List.mem_cons_of_mem x W_rest.start_mem_support + · rcases htail z hz₂ with hz_in | ⟨ha_in, hzQ⟩ + · exact Or.inl (List.mem_cons_of_mem x hz_in) + · exact Or.inr ⟨List.mem_cons_of_mem x ha_in, hzQ⟩ + +/-- Every path `M` in `contractGraph G₁ Q a` with ends `s, t` lifts to a path `M'` in `G₁` with +the same ends `s, t` such that `V(M') ⊆ (V(M) \ {a}) ∪ (if a ∈ V(M) then V(Q) else ∅)`. -/ +private theorem exists_lift_path_of_contractGraph {G₁ Q M : Graph α β} {a b s t : α} + (hQ : IsGraphPathWithEnds G₁ Q a b) + (hM : IsGraphPathWithEnds (contractGraph G₁ Q a) M s t) : + ∃ M' : Graph α β, IsGraphPathWithEnds G₁ M' s t ∧ + ∀ z ∈ V(M'), (z ∈ V(M) ∧ z ≠ a) ∨ (a ∈ V(M) ∧ z ∈ V(Q)) := by + obtain ⟨hM_le, W₀, _, hV₀, _⟩ := hM + obtain ⟨W, hW_supp, _⟩ := W₀.exists_transfer + (fun _ _ _ _ hl => hl.mono hM_le) (fun _ hx => hM_le.vertexSet_mono (by rw [hV₀]; exact hx)) + obtain ⟨W₁, hW₁⟩ := exists_lift_walk hQ W + obtain ⟨M', hM'_path, hM'_V, _⟩ := exists_isGraphPathWithEnds_of_walk W₁ + refine ⟨M', hM'_path, fun z hz => ?_⟩ + have hz_W₁ : z ∈ W₁.support := hM'_V hz + rcases hW₁ z hz_W₁ with hz_W | ⟨ha_W, hzQ⟩ + · have hz_M : z ∈ V(M) := by rw [hV₀, mem_ofPred_eq, ← hW_supp]; exact hz_W + by_cases hza : z = a + · subst hza + exact Or.inr ⟨hz_M, hQ.left_mem⟩ + · exact Or.inl ⟨hz_M, hza⟩ + · have ha_M : a ∈ V(M) := by rw [hV₀, mem_ofPred_eq, ← hW_supp]; exact ha_W + exact Or.inr ⟨ha_M, hzQ⟩ + +/-- A tripod `{P₁, P₂, P₃}` of `S'` (where `S'.G = deleteVertices S''.G {a}`) is also a tripod of +`S''` whenever `S''.Ω.bar = S'.Ω.bar ∪ {a}`. -/ +private theorem isTripod_of_deleteVertices_singleton {S' S'' : Society α β} + {P₁ P₂ P₃ : Graph α β} {a : α} + (hG' : S'.G = deleteVertices S''.G {a}) + (hbar'' : S''.Ω.bar = S'.Ω.bar ∪ {a}) + (htrip : S'.IsTripod P₁ P₂ P₃) : + S''.IsTripod P₁ P₂ P₃ := by + have hle : S'.G ≤ S''.G := hG' ▸ deleteVertices_le S''.G {a} + have ha_not_G' : ∀ z ∈ V(S'.G), z ≠ a := by + intro z hz + rw [hG', vertexSet_deleteVertices, mem_sdiff, mem_singleton_iff] at hz + exact hz.2 + rcases htrip with ⟨u, v, huv, hP₁, hP₂, hP₃, h12, h13, h23, + s₁, hs₁, s₂, hs₂, s₃, hs₃, t₁, ht₁, t₂, ht₂, t₃, ht₃, + hX_sub, hY_sub, hcard, L, hdisj_L, hL⟩ + refine ⟨u, v, huv, hP₁.mono hle, hP₂.mono hle, hP₃.mono hle, h12, h13, h23, + s₁, hs₁, s₂, hs₂, s₃, hs₃, + t₁, hbar'' ▸ Or.inl ht₁, t₂, hbar'' ▸ Or.inl ht₂, t₃, hbar'' ▸ Or.inl ht₃, + hX_sub, hY_sub.trans (hbar'' ▸ subset_union_left), hcard, L, hdisj_L, fun i => ?_⟩ + obtain ⟨x, hx, y, hy, hLi⟩ := hL i + refine ⟨x, hx, y, hy, hLi.1.mono hle, hLi.2.1, ?_⟩ + rw [hbar'', inter_union_distrib_left, hLi.2.2] + have hdisj_a : V(L i) ∩ {a} = ∅ := by + ext z + simp only [mem_inter_iff, mem_singleton_iff, mem_empty_iff_false, iff_false, not_and] + intro hzL rfl + exact ha_not_G' z (hLi.1.le.vertexSet_mono hzL) rfl + rw [hdisj_a, union_empty] + +/-- Deleting a vertex set `X` from a graph separation `(A₁, A₂)` of `G` yields a graph separation +of `deleteVertices G X`. -/ +private theorem IsGraphSeparation.deleteVertices {G A₁ A₂ : Graph α β} + (h : IsGraphSeparation G A₁ A₂) (X : Set α) : + IsGraphSeparation (GM09.deleteVertices G X) + (GM09.deleteVertices A₁ X) (GM09.deleteVertices A₂ X) := by + have hle₁ : GM09.deleteVertices A₁ X ≤ GM09.deleteVertices G X := by + refine ⟨sdiff_le_sdiff_right h.1.vertexSet_mono, fun e x y hxy => ?_⟩ + rw [deleteVertices_isLink] at hxy ⊢ + exact ⟨hxy.1.mono h.1, hxy.2⟩ + have hle₂ : GM09.deleteVertices A₂ X ≤ GM09.deleteVertices G X := by + refine ⟨sdiff_le_sdiff_right h.2.1.vertexSet_mono, fun e x y hxy => ?_⟩ + rw [deleteVertices_isLink] at hxy ⊢ + exact ⟨hxy.1.mono h.2.1, hxy.2⟩ + have hV : V(GM09.deleteVertices A₁ X) ∪ V(GM09.deleteVertices A₂ X) = + V(GM09.deleteVertices G X) := by + simp only [vertexSet_deleteVertices, ← union_sdiff_distrib, h.2.2.1] + have hE₁_sub : E(GM09.deleteVertices A₁ X) ⊆ E(A₁) := + (deleteVertices_le A₁ X).edgeSet_mono + have hE₂_sub : E(GM09.deleteVertices A₂ X) ⊆ E(A₂) := + (deleteVertices_le A₂ X).edgeSet_mono + have hE : E(GM09.deleteVertices A₁ X) ∪ E(GM09.deleteVertices A₂ X) = + E(GM09.deleteVertices G X) := by + apply Subset.antisymm + · exact union_subset hle₁.edgeSet_mono hle₂.edgeSet_mono + · intro e he + obtain ⟨x, y, hxy⟩ := (GM09.deleteVertices G X).exists_isLink_of_mem_edgeSet he + rw [deleteVertices_isLink] at hxy + rcases h.2.2.2.1 ▸ hxy.1.edge_mem with he₁ | he₂ + · left + exact ((deleteVertices_isLink A₁ X).mpr + ⟨(h.1.isLink_iff he₁).mpr hxy.1, hxy.2⟩).edge_mem + · right + exact ((deleteVertices_isLink A₂ X).mpr + ⟨(h.2.1.isLink_iff he₂).mpr hxy.1, hxy.2⟩).edge_mem + exact ⟨hle₁, hle₂, hV, hE, h.2.2.2.2.mono hE₁_sub hE₂_sub⟩ + +private theorem deleteVertices_eq_self_of_notMem {G : Graph α β} {a : α} (ha : a ∉ V(G)) : + deleteVertices G {a} = G := by + refine (Compatible.of_le_le (deleteVertices_le G {a}) le_rfl).ext ?_ ?_ + · ext z + simp only [vertexSet_deleteVertices, mem_sdiff, mem_singleton_iff, and_iff_left_iff_imp] + rintro hz rfl + exact ha hz + · apply Subset.antisymm (deleteVertices_le G {a}).edgeSet_mono + intro e he + obtain ⟨x, y, hxy⟩ := G.exists_isLink_of_mem_edgeSet he + exact ((deleteVertices_isLink G {a}).mpr ⟨hxy, + fun h => ha (mem_singleton_iff.mp h ▸ hxy.left_mem), + fun h => ha (mem_singleton_iff.mp h ▸ hxy.right_mem)⟩).edge_mem + +private theorem liftCrossFromContractGraph {G₁ Q : Graph α β} {a b : α} + {S' S₁ S'' : Society α β} + (hQ_path_G₁ : IsGraphPathWithEnds G₁ Q a b) (hG₁ : S₁.G = G₁) + (hG'' : S''.G = contractGraph G₁ Q a) + (hrest'' : S₁.Ω.IsRestriction (S'.Ω.bar ∪ {a}) S''.Ω) + (hbar'' : S''.Ω.bar = S'.Ω.bar ∪ {a}) + (hsub_bar₁ : S'.Ω.bar ∪ {a} ⊆ S₁.Ω.bar) + (hcr'' : ∃ M₁ M₂ : Graph α β, S''.IsCross M₁ M₂) : + ∃ M₁ M₂ : Graph α β, S₁.IsCross M₁ M₂ := by + let G'' := contractGraph G₁ Q a + rcases hcr'' with ⟨M₁, M₂, hdisj_M, s₁, t₁, s₂, t₂, hM₁, hM₂, hcr_ends⟩ + obtain ⟨M₁', hM₁'_path, hM₁'_V⟩ := exists_lift_path_of_contractGraph hQ_path_G₁ (hG'' ▸ hM₁.1) + obtain ⟨M₂', hM₂'_path, hM₂'_V⟩ := exists_lift_path_of_contractGraph hQ_path_G₁ (hG'' ▸ hM₂.1) + have hdisj_M' : Disjoint V(M₁') V(M₂') := by + rw [disjoint_left] + intro z hz₁ hz₂ + rcases hM₁'_V z hz₁ with ⟨hzM₁, hza⟩ | ⟨haM₁, hzQ⟩ <;> + rcases hM₂'_V z hz₂ with ⟨hzM₂, hza'⟩ | ⟨haM₂, hzQ'⟩ + · exact disjoint_left.mp hdisj_M hzM₁ hzM₂ + · have hz_G'' : z ∈ V(G'') := by + change z ∈ V(contractGraph G₁ Q a) + rw [← hG''] + exact hM₁.1.le.vertexSet_mono hzM₁ + rcases hz_G'' with ⟨_, hz_notQ⟩ | rfl + · exact hz_notQ hzQ' + · exact hza rfl + · have hz_G'' : z ∈ V(G'') := by + change z ∈ V(contractGraph G₁ Q a) + rw [← hG''] + exact hM₂.1.le.vertexSet_mono hzM₂ + rcases hz_G'' with ⟨_, hz_notQ⟩ | rfl + · exact hz_notQ hzQ + · exact hza' rfl + · exact disjoint_left.mp hdisj_M haM₁ haM₂ + have hs₁_bar₁ : s₁ ∈ S₁.Ω.bar := hsub_bar₁ (hbar'' ▸ hM₁.2.2.1) + have ht₁_bar₁ : t₁ ∈ S₁.Ω.bar := hsub_bar₁ (hbar'' ▸ hM₁.2.2.2) + have hs₂_bar₁ : s₂ ∈ S₁.Ω.bar := hsub_bar₁ (hbar'' ▸ hM₂.2.2.1) + have ht₂_bar₁ : t₂ ∈ S₁.Ω.bar := hsub_bar₁ (hbar'' ▸ hM₂.2.2.2) + have hcr₁_ends : S₁.Ω.Crosses s₁ t₁ s₂ t₂ := + (hrest''.crosses_iff.mp hcr_ends).2.2.2.2 + exact ⟨M₁', M₂', hdisj_M', s₁, t₁, s₂, t₂, + ⟨hG₁ ▸ hM₁'_path, hM₁.2.1, hs₁_bar₁, ht₁_bar₁⟩, + ⟨hG₁ ▸ hM₂'_path, hM₂.2.1, hs₂_bar₁, ht₂_bar₁⟩, hcr₁_ends⟩ + +private theorem cross_of_tripod_in_restricted_society (hconn : S.IsInternallyKConnected 4) + {Q G₁ G₂ : Graph α β} {a b : α} + (hQ : S.IsOmegaPathWithEnds Q a b) + (hsep_G : IsGraphSeparation S.G G₁ G₂) + (hinter_G : V(G₁) ∩ V(G₂) = V(Q)) + (hQ_G₁ : Q ≤ G₁) + {S' S₁ : Society α β} + (hG' : S'.G = deleteVertices S.G V(G₂)) + (hΩ' : S.Ω.IsRestriction V(deleteVertices S.G V(G₂)) S'.Ω) + (hG₁ : S₁.G = G₁) + (hΩ₁ : S.Ω.IsRestriction V(G₁) S₁.Ω) + (htripod : ∃ P₁ P₂ P₃ : Graph α β, S'.IsTripod P₁ P₂ P₃) : + ∃ M₁ M₂ : Graph α β, S₁.IsCross M₁ M₂ := by + have hQ_path_G₁ : IsGraphPathWithEnds G₁ Q a b := hQ.1.of_le hQ_G₁ + let G'' := contractGraph G₁ Q a + have hVG''_sub : V(G'') ⊆ V(S.G) := by + rintro z (⟨hz₁, _⟩ | rfl) + · exact hsep_G.1.vertexSet_mono hz₁ + · exact hQ.1.le.vertexSet_mono hQ.1.left_mem + have hVG''_fin : V(G'').Finite := S.finite_V.subset hVG''_sub + have hEG''_fin : E(G'').Finite := S.finite_E.subset hsep_G.1.edgeSet_mono + have hG'_eq : S'.G = deleteVertices G'' {a} := by + rw [hG', deleteVertices_eq_of_isGraphSeparation hsep_G hinter_G, + deleteVertices_contractGraph hQ.1.left_mem] + have hS'_bar_sub_G₁ : S'.Ω.bar ⊆ S₁.Ω.bar := by + rw [hΩ'.1, hΩ₁.1] + rintro z ⟨hz_bar, hz_del⟩ + rw [vertexSet_deleteVertices, ← hsep_G.2.2.1] at hz_del + exact ⟨hz_bar, hz_del.1.resolve_right hz_del.2⟩ + have ha_bar₁ : a ∈ S₁.Ω.bar := by + rw [hΩ₁.1] + exact ⟨hQ.2.2.1, hQ_G₁.vertexSet_mono hQ.1.left_mem⟩ + have hsub_bar₁ : S'.Ω.bar ∪ {a} ⊆ S₁.Ω.bar := + union_subset hS'_bar_sub_G₁ (singleton_subset_iff.mpr ha_bar₁) + obtain ⟨Ω'', hrest''⟩ := S₁.Ω.exists_isRestriction (S'.Ω.bar ∪ {a}) + have hbar'' : Ω''.bar = S'.Ω.bar ∪ {a} := by + rw [hrest''.1, inter_eq_right.mpr hsub_bar₁] + have hbar''_sub : Ω''.bar ⊆ V(G'') := by + rw [hbar''] + refine union_subset ?_ subset_union_right + have hsub : S'.Ω.bar ⊆ V(S'.G) := S'.bar_subset + rw [hG'_eq, vertexSet_deleteVertices] at hsub + exact hsub.trans sdiff_subset + let S'' : Society α β := Society.mk G'' Ω'' hVG''_fin hEG''_fin hbar''_sub + by_cases hcr'' : ∃ M₁ M₂ : Graph α β, S''.IsCross M₁ M₂ + · exact liftCrossFromContractGraph hQ_path_G₁ hG₁ (rfl : S''.G = G'') + hrest'' hbar'' hsub_bar₁ hcr'' + · -- Case 2: `(G'', Ω'')` has no cross; apply (2.3) to get an internal 3-separation of `S''`. + exfalso + rcases htripod with ⟨P₁, P₂, P₃, htrip'⟩ + have htrip'' : S''.IsTripod P₁ P₂ P₃ := + isTripod_of_deleteVertices_singleton hG'_eq hbar'' htrip' + obtain ⟨G''₁, G''₂, hint_sep'', hP_le_G''₁⟩ := (theorem_2_3_proof S'' htrip'').resolve_left + hcr'' + have hsep'' : IsGraphSeparation G'' G''₁ G''₂ := hint_sep''.1.1.1 + have hbar_G''₂ : Ω''.bar ⊆ V(G''₂) := hint_sep''.1.1.2 + have hcard_inter'' : (V(G''₁) ∩ V(G''₂)).ncard ≤ 3 := hint_sep''.1.2.1 + have hV''₂_add_2 : V(G''₂).ncard + 2 ≤ V(G'').ncard := hint_sep''.2 + -- Show `a ∉ V(G''₁)` using the tripod `{P₁, P₂, P₃}` in `S'`. + let J₁ := deleteVertices G''₁ {a} + let J₂ := deleteVertices G''₂ {a} + have hsep_J : IsGraphSeparation S'.G J₁ J₂ := + hG'_eq ▸ IsGraphSeparation.deleteVertices hsep'' {a} + rcases htrip' with ⟨u, v, _, hP₁, hP₂, hP₃, h12, h13, h23, + s₁, hs₁, s₂, hs₂, s₃, hs₃, t₁, _, t₂, _, t₃, _, hred₃⟩ + have hs12 : s₁ ≠ s₂ := fun h => hs₁.2 (by + have : s₁ ∈ V(P₁) ∩ V(P₂) := ⟨hs₁.1, h ▸ hs₂.1⟩; rwa [h12] at this) + have hs13 : s₁ ≠ s₃ := fun h => hs₁.2 (by + have : s₁ ∈ V(P₁) ∩ V(P₃) := ⟨hs₁.1, h ▸ hs₃.1⟩; rwa [h13] at this) + have hs23 : s₂ ≠ s₃ := fun h => hs₂.2 (by + have : s₂ ∈ V(P₂) ∩ V(P₃) := ⟨hs₂.1, h ▸ hs₃.1⟩; rwa [h23] at this) + have hcard_s : ({s₁, s₂, s₃} : Set α).ncard = 3 := by + rw [ncard_insert_of_notMem (by simp [hs12, hs13]), ncard_pair hs23] + have ha_not_S' : ∀ z ∈ V(S'.G), z ≠ a := by + intro z hz + rw [hG'_eq, vertexSet_deleteVertices, mem_sdiff, mem_singleton_iff] at hz + exact hz.2 + have hX_J₁ : V(P₁) ∪ V(P₂) ∪ V(P₃) ⊆ V(J₁) := by + intro z hz + have hz_G''₁ : z ∈ V(G''₁) := by + apply hP_le_G''₁.vertexSet_mono + simpa [vertexSet_subgraphUnion] using hz + have hz_S' : z ∈ V(S'.G) := by + rcases hz with (hz₁ | hz₂) | hz₃ + · exact hP₁.le.vertexSet_mono hz₁ + · exact hP₂.le.vertexSet_mono hz₂ + · exact hP₃.le.vertexSet_mono hz₃ + exact ⟨hz_G''₁, ha_not_S' z hz_S'⟩ + have hbar'_J₂ : S'.Ω.bar ⊆ V(J₂) := fun z hz => + ⟨hbar_G''₂ (hbar'' ▸ Or.inl hz), ha_not_S' z (S'.bar_subset hz)⟩ + rcases hred₃ with ⟨hX'_sub, hY'_sub, _, L, hdisj_L, hL⟩ + have hJ_inter_ge : 3 ≤ (V(J₁) ∩ V(J₂)).ncard := by + have hmeet : ∀ i, ∃ z, z ∈ V(L i) ∧ z ∈ V(J₁) ∩ V(J₂) := by + intro i + obtain ⟨x, hx, y, hy, hLi⟩ := hL i + exact exists_mem_inter_of_isGraphPathWithEnds hsep_J hLi.1 + (hX_J₁ (hX'_sub hx)) (hbar'_J₂ (hY'_sub hy)) + choose z hzL hz_inter using hmeet + have hz_inj : Function.Injective z := fun i j hij => by + by_contra hne + exact disjoint_left.mp (hdisj_L hne) (hzL i) (hij ▸ hzL j) + have hfin_J : (V(J₁) ∩ V(J₂)).Finite := + S'.finite_V.subset (inter_subset_left.trans hsep_J.1.vertexSet_mono) + have hle := ncard_le_ncard (range_subset_iff.mpr hz_inter) hfin_J + rw [ncard_range_of_injective hz_inj, Nat.card_eq_fintype_card, Fintype.card_fin, + hcard_s] at hle + exact hle + have hJ_inter_eq : V(J₁) ∩ V(J₂) = (V(G''₁) ∩ V(G''₂)) \ {a} := by + ext w + simp only [J₁, J₂, vertexSet_deleteVertices, mem_inter_iff, mem_sdiff, mem_singleton_iff] + tauto + have ha_not_G''₁ : a ∉ V(G''₁) := by + intro ha_G''₁ + have ha_inter : a ∈ V(G''₁) ∩ V(G''₂) := ⟨ha_G''₁, hbar_G''₂ (hbar'' ▸ Or.inr rfl)⟩ + have hfin_inter : (V(G''₁) ∩ V(G''₂)).Finite := + hVG''_fin.subset (inter_subset_left.trans hsep''.1.vertexSet_mono) + have hdiff := ncard_sdiff_singleton_add_one ha_inter hfin_inter + rw [← hJ_inter_eq] at hdiff + omega + have hG''₁_eq_J₁ : G''₁ = J₁ := (deleteVertices_eq_self_of_notMem ha_not_G''₁).symm + have hG''₁_le_S' : G''₁ ≤ S'.G := hG''₁_eq_J₁ ▸ hsep_J.1 + have hG''₁_le_G : G''₁ ≤ S.G := + hG''₁_le_S'.trans (hG' ▸ deleteVertices_le S.G V(G₂)) + have hdisj_G''₁_G₂ : Disjoint V(G''₁) V(G₂) := by + rw [disjoint_left] + intro z hz₁ hz₂ + have hz_S' : z ∈ V(S'.G) := hG''₁_le_S'.vertexSet_mono hz₁ + rw [hG', vertexSet_deleteVertices] at hz_S' + exact hz_S'.2 hz₂ + -- Construct `G2_star` on `(V(G''₂) \ {a}) ∪ V(G₂)` and `E(G''₂) ∪ E(G₂)`. + let G2_star : Graph α β := + (S.G.induce ((V(G''₂) \ {a}) ∪ V(G₂))).restrict (E(G''₂) ∪ E(G₂)) + have hV_star_sub : (V(G''₂) \ {a}) ∪ V(G₂) ⊆ V(S.G) := by + rintro z (⟨hz₂, _⟩ | hz₂) + · exact hVG''_sub ( hsep''.2.1.vertexSet_mono hz₂ ) + · exact hsep_G.2.1.vertexSet_mono hz₂ + have hG2_star_le : G2_star ≤ S.G := restrict_le.trans (S.G.induce_le hV_star_sub) + have hV_star : V(G2_star) = (V(G''₂) \ {a}) ∪ V(G₂) := rfl + have hE_star : E(G2_star) = E(G''₂) ∪ E(G₂) := by + unfold G2_star + rw [edgeSet_restrict, inter_eq_right] + rintro e (he₂'' | he₂) + · obtain ⟨x', y', hx'y'⟩ := G''₂.exists_isLink_of_mem_edgeSet he₂'' + have hx'y'_G'' : G''.IsLink e x' y' := hx'y'.mono hsep''.2.1 + rcases hx'y'_G'' with ⟨u, v, huv, rfl, rfl⟩ + have hu_mem : u ∈ (V(G''₂) \ {a}) ∪ V(G₂) := by + by_cases huQ : u ∈ V(Q) + · exact Or.inr ((hinter_G ▸ huQ).2) + · rw [contractMap_of_notMem huQ] at hx'y' + exact Or.inl ⟨hx'y'.left_mem, fun h => huQ (h ▸ hQ.1.left_mem)⟩ + have hv_mem : v ∈ (V(G''₂) \ {a}) ∪ V(G₂) := by + by_cases hvQ : v ∈ V(Q) + · exact Or.inr ((hinter_G ▸ hvQ).2) + · rw [contractMap_of_notMem hvQ] at hx'y' + exact Or.inl ⟨hx'y'.right_mem, fun h => hvQ (h ▸ hQ.1.left_mem)⟩ + exact ⟨u, v, huv.mono hsep_G.1, hu_mem, hv_mem⟩ + · obtain ⟨u, v, huv⟩ := G₂.exists_isLink_of_mem_edgeSet he₂ + exact ⟨u, v, huv.mono hsep_G.2.1, Or.inr huv.left_mem, Or.inr huv.right_mem⟩ + have hsep_star : IsGraphSeparation S.G G''₁ G2_star := by + refine ⟨hG''₁_le_G, hG2_star_le, ?_, ?_, ?_⟩ + · apply Subset.antisymm + · exact union_subset hG''₁_le_G.vertexSet_mono hG2_star_le.vertexSet_mono + · intro z hz + by_cases hz₂ : z ∈ V(G₂) + · exact Or.inr (Or.inr hz₂) + · have hz_S' : z ∈ V(S'.G) := by + rw [hG', vertexSet_deleteVertices]; exact ⟨hz, hz₂⟩ + have hz_G'' : z ∈ V(G'') ∧ z ≠ a := by + rwa [hG'_eq, vertexSet_deleteVertices] at hz_S' + rcases hsep''.2.2.1 ▸ hz_G''.1 with hz₁'' | hz₂'' + · exact Or.inl hz₁'' + · exact Or.inr (Or.inl ⟨hz₂'', hz_G''.2⟩) + · rw [hE_star, ← union_assoc] + have hE_G''₁ : E(G''₁) ∪ E(G''₂) = E(G₁) := hsep''.2.2.2.1 + rw [hE_G''₁, hsep_G.2.2.2.1] + · rw [hE_star, disjoint_union_right] + refine ⟨hsep''.2.2.2.2, ?_⟩ + have hE₁_sub : E(G''₁) ⊆ E(G₁) := hsep''.1.edgeSet_mono + exact hsep_G.2.2.2.2.mono_left hE₁_sub + have hbar_star : S.Ω.bar ⊆ V(G2_star) := by + intro z hz + by_cases hz₂ : z ∈ V(G₂) + · exact Or.inr hz₂ + · have hz_S'_bar : z ∈ S'.Ω.bar := by + rw [hΩ'.1, vertexSet_deleteVertices]; exact ⟨hz, S.bar_subset hz, hz₂⟩ + have hz_S' : z ∈ V(S'.G) := S'.bar_subset hz_S'_bar + exact Or.inl ⟨hbar_G''₂ (hbar'' ▸ Or.inl hz_S'_bar), ha_not_S' z hz_S'⟩ + have hinter_star : V(G''₁) ∩ V(G2_star) = V(G''₁) ∩ V(G''₂) := by + ext z + simp only [hV_star, mem_inter_iff, mem_union, mem_sdiff, mem_singleton_iff] + constructor + · rintro ⟨hz₁, ⟨hz₂, _⟩ | hzG₂⟩ + · exact ⟨hz₁, hz₂⟩ + · exact (disjoint_left.mp hdisj_G''₁_G₂ hz₁ hzG₂).elim + · rintro ⟨hz₁, hz₂⟩ + exact ⟨hz₁, Or.inl ⟨hz₂, fun h => ha_not_G''₁ (h ▸ hz₁)⟩⟩ + have hcard_star : (V(G''₁) ∩ V(G2_star)).ncard ≤ 3 := hinter_star ▸ hcard_inter'' + have hV_star_add_2 : V(G2_star).ncard + 2 ≤ V(S.G).ncard := by + have hfin₁'' : V(G''₁).Finite := hVG''_fin.subset hsep''.1.vertexSet_mono + have hfin₂'' : V(G''₂).Finite := hVG''_fin.subset hsep''.2.1.vertexSet_mono + have hfin_star : V(G2_star).Finite := S.finite_V.subset hG2_star_le.vertexSet_mono + have hun'' := ncard_union_add_ncard_inter V(G''₁) V(G''₂) hfin₁'' hfin₂'' + rw [hsep''.2.2.1] at hun'' + have hun_star := ncard_union_add_ncard_inter V(G''₁) V(G2_star) hfin₁'' hfin_star + rw [hsep_star.2.2.1, hinter_star] at hun_star + omega + have hV_star_ne : V(G2_star) ≠ V(S.G) := by + intro heq + rw [heq] at hV_star_add_2 + omega + have hint_sep_G : S.IsInternalKSeparation 3 G''₁ G2_star := + ⟨⟨⟨hsep_star, hbar_star⟩, hcard_star, hV_star_ne⟩, hV_star_add_2⟩ + exact hconn 3 (by omega) G''₁ G2_star hint_sep_G + +/-! ## Proof of (5.5): Combining (5.2), (5.3), and (5.4) -/ + +/-- **Graph Minors IX, (5.4)** (page 54): +"Let $(G, \Omega)$ be internally 4-connected. Let $Q$ be a separating $\Omega$-path with ends +$a, b$ and with no internal vertex in $\bar{\Omega}$, and let $(G_1, G_2)$ be a separation +of $G$ such that $V(G_1 \cap G_2) = V(Q)$, $\Omega(a, b) \subseteq V(G_1)$ and $\Omega(b, a) +\subseteq V(G_2)$. Let $G' = G \setminus V(G_2)$, let $\Omega' = \Omega \mid V(G')$, and let +$\Omega_1 = \Omega \mid V(G_1)$. If $(G', \Omega')$ has a tripod then $(G_1, \Omega_1)$ has +a cross." -/ +theorem theorem_5_4_proof (hconn : S.IsInternallyKConnected 4) + {Q G₁ G₂ : Graph α β} {a b : α} + (hQ : S.IsOmegaPathWithEnds Q a b) + (_hsep_Q : S.IsSeparatingOmegaPath Q) + (_hno_int : Disjoint (pathInternalVerts S.G Q) S.Ω.bar) + (hsep_G : IsGraphSeparation S.G G₁ G₂) + (hinter_G : V(G₁) ∩ V(G₂) = V(Q)) + (hQ_G₁ : Q ≤ G₁) + (_hint_G₁ : S.Ω.interval a b ⊆ V(G₁)) + (_hint_G₂ : S.Ω.interval b a ⊆ V(G₂)) + {S' S₁ : Society α β} + (hG' : S'.G = deleteVertices S.G V(G₂)) + (hΩ' : S.Ω.IsRestriction V(deleteVertices S.G V(G₂)) S'.Ω) + (hG₁ : S₁.G = G₁) + (hΩ₁ : S.Ω.IsRestriction V(G₁) S₁.Ω) + (htripod : ∃ P₁ P₂ P₃ : Graph α β, S'.IsTripod P₁ P₂ P₃) : + ∃ M₁ M₂ : Graph α β, S₁.IsCross M₁ M₂ := by + exact S.cross_of_tripod_in_restricted_society hconn hQ hsep_G hinter_G hQ_G₁ + hG' hΩ' hG₁ hΩ₁ htripod + +/-- Dropping `a 0` and `b 0` from `(List.ofFn a).reverse ++ List.ofFn b` preserves +`IsClockwiseSeq`. -/ +private theorem isClockwiseSeq_succ_ofFn {m : ℕ} {a b : Fin (m + 1) → α} + (hcw : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) : + S.Ω.IsClockwiseSeq + ((List.ofFn (fun i : Fin m => a i.succ)).reverse ++ + List.ofFn (fun i : Fin m => b i.succ)) := by + let L := (List.ofFn a).reverse ++ List.ofFn b + let a' : Fin m → α := fun i => a i.succ + let b' : Fin m → α := fun i => b i.succ + let M := (List.ofFn a').reverse ++ List.ofFn b' + have hlen_L : L.length = (m + 1) + (m + 1) := by simp [L]; omega + have hlen_M : M.length = m + m := by simp [M] + let pos (i : ℕ) : ℕ := if i < m then i else i + 2 + have hsub : CyclicPerm.IsBoundedSubseq L M 0 L.length := by + refine ⟨Nat.zero_le _, pos, fun i hi => ?_, fun i j hij hj => ?_⟩ + · have hi' : i < m + m := hlen_M ▸ hi + by_cases him : i < m + · have hpos_lt : pos i < L.length := by simp [pos, him, hlen_L]; omega + refine ⟨hpos_lt, Nat.zero_le _, hpos_lt, ?_⟩ + have hM_i : M[i]'hi = a ⟨m - i, by omega⟩ := by + dsimp [M] + rw [List.getElem_append_left (by simp; omega), List.getElem_reverse] + simp only [List.length_ofFn, List.getElem_ofFn, a', Fin.succ] + congr 1; ext; dsimp; omega + have hL_i : L[pos i]'hpos_lt = a ⟨m - i, by omega⟩ := by + dsimp [L] + rw [List.getElem_append_left (by simp [pos, him]; omega), List.getElem_reverse] + simp only [List.length_ofFn, List.getElem_ofFn, pos, him, ↓reduceIte] + rfl + exact hM_i.trans hL_i.symm + · have hpos_lt : pos i < L.length := by simp [pos, him, hlen_L]; omega + refine ⟨hpos_lt, Nat.zero_le _, hpos_lt, ?_⟩ + have hM_i : M[i]'hi = b ⟨i - m + 1, by omega⟩ := by + dsimp [M] + rw [List.getElem_append_right (by simp; omega)] + simp only [List.length_reverse, List.length_ofFn, List.getElem_ofFn, b', Fin.succ] + have hL_i : L[pos i]'hpos_lt = b ⟨i - m + 1, by omega⟩ := by + dsimp [L] + rw [List.getElem_append_right (by simp [pos, him]; omega)] + simp only [List.length_reverse, List.length_ofFn, List.getElem_ofFn, pos, him, ↓reduceIte] + congr 1; ext; dsimp; omega + exact hM_i.trans hL_i.symm + · rw [hlen_M] at hj + dsimp [pos] + split_ifs <;> omega + exact hcw.of_isBoundedSubseq hsub + +/-- If `(List.ofFn a).reverse ++ List.ofFn b` is clockwise in `S.Ω` and `0 < j`, then in `S₀.Ω` +we have `r ∈ S₀.Ω.interval (a j) (b j)`, +`S₀.Ω.interval (a j) (b j) = S.Ω.interval (a j) (b j) ∪ {r}`, and +`S₀.Ω.interval (b j) (a j) = S.Ω.interval (b j) (a j)`. -/ +private theorem mem_interval_r_of_clockwise {S₀ : Society α β} {m : ℕ} + {a b : Fin (m + 1) → α} {r : α} + (hbar₀ : S₀.Ω.bar = S.Ω.bar ∪ {r}) + (hrest₀ : S₀.Ω.IsRestriction S.Ω.bar S.Ω) + (hab_empty : S.Ω.interval (a 0) (b 0) = ∅) + (hcw_arb : S₀.Ω.IsClockwise3 (a 0) r (b 0)) + (hcw : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) + {j : Fin (m + 1)} (hj : (0 : Fin (m + 1)) < j) : + r ∈ S₀.Ω.interval (a j) (b j) ∧ + S₀.Ω.interval (a j) (b j) = S.Ω.interval (a j) (b j) ∪ {r} ∧ + S₀.Ω.interval (b j) (a j) = S.Ω.interval (b j) (a j) := by + obtain ⟨h₀_ab, _, _, _, _⟩ := + S.Ω.extension_intervals hbar₀ hrest₀ hab_empty hcw_arb + obtain ⟨ha0_j, hb0_j, _, haj_b0a0, hbj_b0a0⟩ := + S.Ω.mem_intervals_of_isClockwiseSeq_ofFn hcw hj + have haj_bar : a j ∈ S.Ω.bar := haj_b0a0.1.1 + have hbj_bar : b j ∈ S.Ω.bar := hbj_b0a0.1.1 + have hr_a0b0 : r ∈ S₀.Ω.interval (a 0) (b 0) := by rw [h₀_ab]; rfl + -- Also `a 0 ∈ S.Ω.interval (a j) (b 0)`. + have ha0_ajb0 : a 0 ∈ S.Ω.interval (a j) (b 0) := by + let L := (List.ofFn a).reverse ++ List.ofFn b + have hj_lt : j.1 < m + 1 := j.2 + have h1 : m - j.1 < m := by omega + have h2 : m < m + 1 := by omega + have hlen_rev : (List.ofFn a).reverse.length = m + 1 := by simp + have hlen_L : L.length = (m + 1) + (m + 1) := by simp [L]; omega + have h3 : m + 1 < L.length := by omega + have h := S.Ω.mem_interval_of_lt hcw h1 h2 h3 + have hL1 : L[m - j.1]'(by omega) = a j := by + dsimp [L] + rw [List.getElem_append_left (by omega), List.getElem_reverse] + simp only [List.length_ofFn, List.getElem_ofFn] + congr 1; ext; dsimp; omega + have hL2 : L[m]'(by omega) = a 0 := by + dsimp [L] + rw [List.getElem_append_left (by omega), List.getElem_reverse] + simp only [List.length_ofFn, List.getElem_ofFn] + congr 1; ext; dsimp; omega + have hL3 : L[m + 1]'h3 = b 0 := by + dsimp [L] + rw [List.getElem_append_right (by omega)] + simp only [List.length_reverse, List.length_ofFn, List.getElem_ofFn] + congr 1; ext; dsimp; omega + rwa [hL1, hL2, hL3] at h + have ha0_ajb0' : a 0 ∈ S₀.Ω.interval (a j) (b 0) := + ⟨⟨hbar₀ ▸ Or.inl ha0_ajb0.1.1, ha0_ajb0.1.2⟩, (hrest₀.isClockwise3_iff.mp ha0_ajb0.2).2.2.2⟩ + have hb0_ajbj' : b 0 ∈ S₀.Ω.interval (a j) (b j) := + ⟨⟨hbar₀ ▸ Or.inl hb0_j.1.1, hb0_j.1.2⟩, (hrest₀.isClockwise3_iff.mp hb0_j.2).2.2.2⟩ + have hr_ajb0 : r ∈ S₀.Ω.interval (a j) (b 0) := + S₀.Ω.interval_subset_interval_right ha0_ajb0' hr_a0b0 + have hr_ajbj : r ∈ S₀.Ω.interval (a j) (b j) := + S₀.Ω.interval_subset_interval_left hb0_ajbj' hr_ajb0 + have hr_not_bja : r ∉ S₀.Ω.interval (b j) (a j) := + disjoint_left.mp (S₀.Ω.disjoint_interval_swap (a j) (b j)) hr_ajbj + have h_inter_ab := hrest₀.interval_eq haj_bar hbj_bar + have h_inter_ba := hrest₀.interval_eq hbj_bar haj_bar + refine ⟨hr_ajbj, ?_, ?_⟩ + · ext z + simp only [mem_union, mem_singleton_iff] + constructor + · intro hz + have hz_bar : z ∈ S.Ω.bar ∪ {r} := hbar₀ ▸ hz.1.1 + rcases hz_bar with hzS | rfl + · left; rw [h_inter_ab]; exact ⟨hz, hzS⟩ + · exact Or.inr rfl + · rintro (hz | rfl) + · rw [h_inter_ab] at hz; exact hz.1 + · exact hr_ajbj + · ext z + constructor + · intro hz + have hz_bar : z ∈ S.Ω.bar ∪ {r} := hbar₀ ▸ hz.1.1 + rcases hz_bar with hzS | rfl + · rw [h_inter_ba]; exact ⟨hz, hzS⟩ + · exact (hr_not_bja hz).elim + · intro hz + rw [h_inter_ba] at hz; exact hz.1 + +/-- **Graph Minors IX, (5.5), Claim (1)** (page 54): +"$Q_2, \dots, Q_{p+5}$ are separating $\Omega_0$-paths of $(G, \Omega_0)$." -/ +theorem lemma_5_5_claim_1 {S₀ : Society α β} {m : ℕ} + {Q : Fin (m + 1) → Graph α β} {a b : Fin (m + 1) → α} {r : α} + (hG₀ : S₀.G = S.G) + (hbar₀ : S₀.Ω.bar = S.Ω.bar ∪ {r}) + (hrest₀ : S₀.Ω.IsRestriction S.Ω.bar S.Ω) + (hab_empty : S.Ω.interval (a 0) (b 0) = ∅) + (hcw_arb : S₀.Ω.IsClockwise3 (a 0) r (b 0)) + (hr_Q0 : r ∈ V(Q 0) \ {a 0, b 0}) + (hno_int0 : Disjoint (pathInternalVerts S.G (Q 0)) S.Ω.bar) + (hdisj_Q : Pairwise (fun i j => Disjoint V(Q i) V(Q j))) + (hends_Q : ∀ i, S.IsOmegaPathWithEnds (Q i) (a i) (b i)) + (hsep_Q : ∀ i, S.IsSeparatingOmegaPath (Q i)) + (hcw : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) + (j : Fin (m + 1)) (hj : (0 : Fin (m + 1)) < j) : + S₀.IsSeparatingOmegaPath (Q j) := by + have hQj_ends : S.IsOmegaPathWithEnds (Q j) (a j) (b j) := hends_Q j + have hQj_ends₀ : S₀.IsOmegaPathWithEnds (Q j) (a j) (b j) := + ⟨hG₀ ▸ hQj_ends.1, hQj_ends.2.1, hbar₀ ▸ Or.inl hQj_ends.2.2.1, + hbar₀ ▸ Or.inl hQj_ends.2.2.2⟩ + refine ⟨⟨a j, b j, hQj_ends₀⟩, ?_⟩ + rintro ⟨P, hdisj_PQj, s, t, a', b', hP₀, hQj₀', hcr₀⟩ + have hQj_S' : S.IsOmegaPathWithEnds (Q j) a' b' := by + refine ⟨hG₀ ▸ hQj₀'.1, hQj₀'.2.1, ?_, ?_⟩ + · rcases (hG₀ ▸ hQj₀'.1).ends_eq hQj_ends.1 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hQj_ends.2.2.1 + · exact hQj_ends.2.2.2 + · rcases (hG₀ ▸ hQj₀'.1).ends_eq hQj_ends.1 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hQj_ends.2.2.2 + · exact hQj_ends.2.2.1 + have hcr₀_ajbj : S₀.Ω.Crosses s t (a j) (b j) := by + rcases hQj_ends.ends_eq S hQj_S' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hcr₀ + · exact hcr₀.swap_right + obtain ⟨hr_ajbj, _, h₀_bja⟩ := + S.mem_interval_r_of_clockwise hbar₀ hrest₀ hab_empty hcw_arb hcw hj + obtain ⟨ha0_ajbj, hb0_ajbj, _, _, _⟩ := S.Ω.mem_intervals_of_isClockwiseSeq_ofFn hcw hj + -- Helper when one end of `P` is `r` and the other end `t'` is in `S₀.Ω.bar`. + have h_from_r : ∀ {t' : α}, S₀.IsOmegaPathWithEnds P r t' → + S₀.Ω.Crosses r t' (a j) (b j) → False := by + intro t' hP_rt' hcr_rt' + have ht'_bja : t' ∈ S.Ω.interval (b j) (a j) := by + rcases S₀.Ω.crosses_iff_interval.mp hcr_rt'.symm with ⟨_, ht'⟩ | ⟨_, hr_ba⟩ + · rwa [← h₀_bja] + · exact (disjoint_left.mp (S₀.Ω.disjoint_interval_swap (a j) (b j)) hr_ajbj hr_ba).elim + have ht'_not_Q0 : t' ∉ V(Q 0) := by + intro ht'_Q0 + have ht'_ab0 : t' = a 0 ∨ t' = b 0 := by + by_contra hnot + have hint : t' ∈ pathInternalVerts S.G (Q 0) := by + rw [(hends_Q 0).1.pathInternalVerts_eq] + exact ⟨ht'_Q0, hnot⟩ + exact disjoint_left.mp hno_int0 hint ht'_bja.1.1 + rcases ht'_ab0 with rfl | rfl + · exact disjoint_left.mp (S.Ω.disjoint_interval_swap (a j) (b j)) ha0_ajbj ht'_bja + · exact disjoint_left.mp (S.Ω.disjoint_interval_swap (a j) (b j)) hb0_ajbj ht'_bja + have hP_G : IsGraphPathWithEnds S.G P t' r := (hG₀ ▸ hP_rt'.1).symm + obtain ⟨t'', ht''_eq, x, hx_Q0, R₁, hR₁_P, hR₁_ft⟩ := + hP_G.exists_isFromToPathWithEnds (X := {t'}) (Y := V(Q 0)) rfl hr_Q0.1 + rw [mem_singleton_iff] at ht''_eq + subst t'' + obtain ⟨R₂, hR₂_Q0, _, hR₂_G⟩ := (hends_Q 0).1.exists_subpath hx_Q0 (hends_Q 0).1.left_mem + have hinter_R₁R₂ : V(R₁) ∩ V(R₂) = {x} := by + ext z + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hz₁, hz₂⟩ => ?_, fun h => h ▸ ⟨hR₁_ft.1.right_mem, hR₂_G.left_mem⟩⟩ + have : z ∈ V(R₁) ∩ V(Q 0) := ⟨hz₁, hR₂_Q0.vertexSet_mono hz₂⟩ + rwa [hR₁_ft.2.2, mem_singleton_iff] at this + let P' := subgraphUnion S.G R₁ R₂ + have hP'_G : IsGraphPathWithEnds S.G P' t' (a 0) := hR₁_ft.1.subgraphUnion hR₂_G hinter_R₁R₂ + have ht'_ne_a0 : t' ≠ a 0 := fun h => + disjoint_left.mp (S.Ω.disjoint_interval_swap (a j) (b j)) ha0_ajbj (h ▸ ht'_bja) + have hP'_omega : S.IsOmegaPathWithEnds P' t' (a 0) := + ⟨hP'_G, ht'_ne_a0, ht'_bja.1.1, (hends_Q 0).2.2.1⟩ + have hdisj_Q0Qj : Disjoint V(Q 0) V(Q j) := hdisj_Q (ne_of_lt hj) + have hdisj_P'Qj : Disjoint V(P') V(Q j) := by + rw [disjoint_left] + rintro z (hz₁ | hz₂) hzQj + · exact disjoint_left.mp hdisj_PQj (hR₁_P.vertexSet_mono hz₁) hzQj + · exact disjoint_left.mp hdisj_Q0Qj (hR₂_Q0.vertexSet_mono hz₂) hzQj + have hcr_P'Qj : S.Ω.Crosses t' (a 0) (a j) (b j) := + (S.Ω.crosses_iff_interval.mpr (Or.inr ⟨ht'_bja, ha0_ajbj⟩)).symm.swap_left.swap_right + exact (hsep_Q j).2 ⟨P', hdisj_P'Qj, t', a 0, a j, b j, hP'_omega, hQj_ends, hcr_P'Qj⟩ + by_cases hsr : s = r + · subst hsr; exact h_from_r hP₀ hcr₀_ajbj + · by_cases htr : t = r + · subst htr; exact h_from_r hP₀.symm hcr₀_ajbj.swap_left + · have hs_S : s ∈ S.Ω.bar := by + have hs₀ := hP₀.2.2.1; rw [hbar₀, mem_union, mem_singleton_iff] at hs₀ + exact hs₀.resolve_right hsr + have ht_S : t ∈ S.Ω.bar := by + have ht₀ := hP₀.2.2.2; rw [hbar₀, mem_union, mem_singleton_iff] at ht₀ + exact ht₀.resolve_right htr + have hcr_S : S.Ω.Crosses s t (a j) (b j) := + hrest₀.crosses_iff.mpr ⟨hs_S, ht_S, hQj_ends.2.2.1, hQj_ends.2.2.2, hcr₀_ajbj⟩ + have hP_S : S.IsOmegaPathWithEnds P s t := ⟨hG₀ ▸ hP₀.1, hP₀.2.1, hs_S, ht_S⟩ + exact (hsep_Q j).2 ⟨P, hdisj_PQj, s, t, a j, b j, hP_S, hQj_ends, hcr_S⟩ + +/-- If `P_set` is a crooked transaction in `S₀` with `r ∉ S₀.transactionEnds P_set` (where +`S₀.Ω.bar = S.Ω.bar ∪ {r}` and `S₀.Ω.IsRestriction S.Ω.bar S.Ω`), then `P_set` is a crooked +transaction in `S`. -/ +private theorem isCrookedTransaction_of_notMem_ends {S₀ : Society α β} + {P_set : Set (Graph α β)} {r : α} + (hG₀ : S₀.G = S.G) + (hbar₀ : S₀.Ω.bar = S.Ω.bar ∪ {r}) + (hrest₀ : S₀.Ω.IsRestriction S.Ω.bar S.Ω) + (hcr₀ : S₀.IsCrookedTransaction P_set) + (hr_not : r ∉ S₀.transactionEnds P_set) : + S.IsCrookedTransaction P_set := by + rcases hcr₀ with ⟨⟨A₀, B₀, hfence₀⟩, hnot_per₀⟩ + have hends_sub_S : S₀.transactionEnds P_set ⊆ S.Ω.bar := by + intro v hv + rcases hv with ⟨P, hP, b, hP_ends⟩ + have hv_bar : v ∈ S.Ω.bar ∪ {r} := hbar₀ ▸ hP_ends.2.2.1 + rcases hv_bar with hvS | rfl + · exact hvS + · exact (hr_not ⟨P, hP, b, hP_ends⟩).elim + have hP_ends_iff : ∀ {P : Graph α β} {x y : α}, + P ∈ P_set → (S.IsOmegaPathWithEnds P x y ↔ S₀.IsOmegaPathWithEnds P x y) := by + intro P x y hP + constructor + · rintro ⟨hPG, hxy, hx, hy⟩ + exact ⟨hG₀.symm ▸ hPG, hxy, hbar₀ ▸ Or.inl hx, hbar₀ ▸ Or.inl hy⟩ + · rintro hP₀ + have hx_S : x ∈ S.Ω.bar := hends_sub_S (hP₀.mem_transactionEnds_left S₀ hP) + have hy_S : y ∈ S.Ω.bar := hends_sub_S (hP₀.mem_transactionEnds_right S₀ hP) + exact ⟨hG₀ ▸ hP₀.1, hP₀.2.1, hx_S, hy_S⟩ + have hW_eq : S.transactionEnds P_set = S₀.transactionEnds P_set := by + ext v + simp only [transactionEnds] + exact ⟨fun ⟨P, hP, b, h⟩ => ⟨P, hP, b, (hP_ends_iff hP).mp h⟩, + fun ⟨P, hP, b, h⟩ => ⟨P, hP, b, (hP_ends_iff hP).mpr h⟩⟩ + let A := A₀ ∩ S.Ω.bar + let B := B₀ ∩ S.Ω.bar + have hfence_AB : S.Ω.IsFence A B := by + refine ⟨inter_subset_right, inter_subset_right, + hfence₀.2.1.2.2.1.mono inter_subset_left inter_subset_left, ?_, ?_⟩ + · rw [← union_inter_distrib_right, hfence₀.2.1.2.2.2.1, hbar₀, + inter_eq_right.mpr subset_union_left] + · intro a₁ ha₁ a₂ ha₂ ha12 b₁ hb₁ b₂ hb₂ hb12 hcr + exact hfence₀.2.1.2.2.2.2 a₁ ha₁.1 a₂ ha₂.1 ha12 b₁ hb₁.1 b₂ hb₂.1 hb12 + ((hrest₀.crosses_iff.mp hcr).2.2.2.2) + have hfence_S : S.IsFenceFor P_set A B := by + refine ⟨⟨?_, hfence₀.1.2⟩, hfence_AB, ?_⟩ + · intro P hP + obtain ⟨x, y, hxy⟩ := hfence₀.1.1 P hP + exact ⟨x, y, (hP_ends_iff hP).mpr hxy⟩ + · intro P hP + obtain ⟨x, hxA, y, hyB, hxy⟩ := hfence₀.2.2 P hP + have hxy_S := (hP_ends_iff hP).mpr hxy + exact ⟨x, ⟨hxA, hxy_S.2.2.1⟩, y, ⟨hyB, hxy_S.2.2.2⟩, hxy_S⟩ + refine ⟨⟨A, B, hfence_S⟩, ?_⟩ + intro P hP ⟨_, x, y, hxy_S, hdisj_S⟩ + have hxy₀ : S₀.IsOmegaPathWithEnds P x y := (hP_ends_iff hP).mp hxy_S + apply hnot_per₀ P hP ⟨hP, x, y, hxy₀, ?_⟩ + rw [← hW_eq] + rcases hdisj_S with hd | hd + · left + rw [disjoint_left] + intro z hz₀ hzW + have hz_S : z ∈ S.Ω.interval x y := by + rw [hrest₀.interval_eq hxy_S.2.2.1 hxy_S.2.2.2] + exact ⟨hz₀, hends_sub_S (hW_eq ▸ hzW)⟩ + exact disjoint_left.mp hd hz_S hzW + · right + rw [disjoint_left] + intro z hz₀ hzW + have hz_S : z ∈ S.Ω.interval y x := by + rw [hrest₀.interval_eq hxy_S.2.2.2 hxy_S.2.2.1] + exact ⟨hz₀, hends_sub_S (hW_eq ▸ hzW)⟩ + exact disjoint_left.mp hd hz_S hzW + +/-- Extending a fence `(A, B)` of `S.Ω` across a one-point extension `S₀.Ω` where +`S.Ω.interval a₀ b₀ = ∅` and `(a₀, r, b₀)` is `S₀.Ω`-clockwise. -/ +private theorem exists_isFence_extension {S₀ : Society α β} {A B : Set α} {a₀ b₀ r : α} + (hbar₀ : S₀.Ω.bar = S.Ω.bar ∪ {r}) + (hrest₀ : S₀.Ω.IsRestriction S.Ω.bar S.Ω) + (hab_empty : S.Ω.interval a₀ b₀ = ∅) + (hcw_arb : S₀.Ω.IsClockwise3 a₀ r b₀) + (hfence : S.Ω.IsFence A B) : + ∃ A₀ B₀ : Set α, A ⊆ A₀ ∧ B ⊆ B₀ ∧ S₀.Ω.IsFence A₀ B₀ := by + obtain ⟨h₀_ab, h_a0r_empty, _, _, _⟩ := + S.Ω.extension_intervals hbar₀ hrest₀ hab_empty hcw_arb + have hr_a0b0 : r ∈ S₀.Ω.interval a₀ b₀ := by rw [h₀_ab]; rfl + have harb_iff := S₀.Ω.isClockwise3_iff.mp hcw_arb + have ha0_bar : a₀ ∈ S.Ω.bar := by + rcases hbar₀ ▸ harb_iff.2.2.2.1 with ha0S | rfl + · exact ha0S + · exact (harb_iff.1 rfl).elim + have hb0_bar : b₀ ∈ S.Ω.bar := by + rcases hbar₀ ▸ harb_iff.2.2.2.2.2.1 with hb0S | rfl + · exact hb0S + · exact (harb_iff.2.2.1 rfl).elim + have hr_not_bar : r ∉ S.Ω.bar := by + intro hrS + have hr_in : r ∈ S.Ω.interval a₀ b₀ := by + rw [hrest₀.interval_eq ha0_bar hb0_bar] + exact ⟨hr_a0b0, hrS⟩ + rw [hab_empty] at hr_in + exact hr_in + have hnot_cr_a0r : ∀ x y : α, ¬ S₀.Ω.Crosses a₀ r x y := fun _ _ => + CyclicPerm.Crosses.not_interval_empty (Or.inl h_a0r_empty) + -- Helper when `a₀ ∈ X` for a fence `(X, Y)` of `S.Ω`. + have h_case : ∀ {X Y : Set α}, S.Ω.IsFence X Y → a₀ ∈ X → + S₀.Ω.IsFence (X ∪ {r}) Y := by + intro X Y hf ha0_X + have hX_bar : X ⊆ S.Ω.bar := hf.1 + have hY_bar : Y ⊆ S.Ω.bar := hf.2.1 + have hdisj_XY : Disjoint X Y := hf.2.2.1 + have hunion_XY : X ∪ Y = S.Ω.bar := hf.2.2.2.1 + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · rw [hbar₀]; exact union_subset_union_left _ hX_bar + · rw [hbar₀]; exact hY_bar.trans subset_union_left + · rw [disjoint_union_left, disjoint_singleton_left] + exact ⟨hdisj_XY, fun hrY => hr_not_bar (hY_bar hrY)⟩ + · rw [union_right_comm, hunion_XY, hbar₀] + · intro x₁ hx₁ x₂ hx₂ hx12 y₁ hy₁ y₂ hy₂ hy12 hcr₀ + have hy₁_S : y₁ ∈ S.Ω.bar := hY_bar hy₁ + have hy₂_S : y₂ ∈ S.Ω.bar := hY_bar hy₂ + have ha0_not_Y : a₀ ∉ Y := disjoint_left.mp hdisj_XY ha0_X + have ha0_not_y12 : a₀ ∉ ({y₁, y₂} : Set α) := by + rintro (rfl | rfl) + · exact ha0_not_Y hy₁ + · exact ha0_not_Y hy₂ + have ha0_0 : a₀ ∈ S₀.Ω.bar := hbar₀ ▸ Or.inl ha0_bar + have h_from_r : ∀ {x : α}, x ∈ X → ¬ S₀.Ω.Crosses r x y₁ y₂ := by + intro x hxX hcr_rx + have hx_S : x ∈ S.Ω.bar := hX_bar hxX + have hcr_a0x : S₀.Ω.Crosses a₀ x y₁ y₂ := + (hcr_rx.left_or_right_of_notMem ha0_0 ha0_not_y12).resolve_left (hnot_cr_a0r y₁ y₂) + have ha0_ne_x : a₀ ≠ x := by + rcases S₀.Ω.crosses_iff_interval.mp hcr_a0x with ⟨h1, _⟩ | ⟨h1, _⟩ <;> + exact (S₀.Ω.isClockwise3_iff.mp h1.2).2.1 + have hcr_S : S.Ω.Crosses a₀ x y₁ y₂ := + hrest₀.crosses_iff.mpr ⟨ha0_bar, hx_S, hy₁_S, hy₂_S, hcr_a0x⟩ + exact hf.2.2.2.2 a₀ ha0_X x hxX ha0_ne_x y₁ hy₁ y₂ hy₂ hy12 hcr_S + rcases hx₁ with hx₁X | rfl + · rcases hx₂ with hx₂X | rfl + · have hcr_S : S.Ω.Crosses x₁ x₂ y₁ y₂ := + hrest₀.crosses_iff.mpr ⟨hX_bar hx₁X, hX_bar hx₂X, hy₁_S, hy₂_S, hcr₀⟩ + exact hf.2.2.2.2 x₁ hx₁X x₂ hx₂X hx12 y₁ hy₁ y₂ hy₂ hy12 hcr_S + · exact h_from_r hx₁X hcr₀.swap_left + · rcases hx₂ with hx₂X | rfl + · exact h_from_r hx₂X hcr₀ + · exact hx12 rfl + have ha0_AB : a₀ ∈ A ∪ B := hfence.2.2.2.1.symm ▸ ha0_bar + rcases ha0_AB with ha0_A | ha0_B + · exact ⟨A ∪ {r}, B, subset_union_left, Subset.rfl, h_case hfence ha0_A⟩ + · have hfence_BA : S.Ω.IsFence B A := + ⟨hfence.2.1, hfence.1, hfence.2.2.1.symm, union_comm B A ▸ hfence.2.2.2.1, + fun b₁ hb₁ b₂ hb₂ hb12 a₁ ha₁ a₂ ha₂ ha12 hcr => + hfence.2.2.2.2 a₁ ha₁ a₂ ha₂ ha12 b₁ hb₁ b₂ hb₂ hb12 hcr.symm⟩ + have hf₀_BA := h_case hfence_BA ha0_B + exact ⟨A, B ∪ {r}, Subset.rfl, subset_union_left, + ⟨hf₀_BA.2.1, hf₀_BA.1, hf₀_BA.2.2.1.symm, union_comm A (B ∪ {r}) ▸ hf₀_BA.2.2.2.1, + fun a₁ ha₁ a₂ ha₂ ha12 b₁ hb₁ b₂ hb₂ hb12 hcr => + hf₀_BA.2.2.2.2 b₁ hb₁ b₂ hb₂ hb12 a₁ ha₁ a₂ ha₂ ha12 hcr.symm⟩⟩ + +/-- Preliminary step for **Graph Minors IX, (5.5), Claim (2)** (pages 54–55): by (5.2), either +there is a cross `{P₁, P₂}` of `(G, Ω₀)` disjoint from `V(G₂)`, or `(G, Ω)` has a crooked +transaction of cardinality `p` avoiding `Ω(a₂, b₂)`. -/ +theorem lemma_5_5_claim_2_disjoint {S₀ : Society α β} {p : ℕ} + (hp2 : 2 ≤ p) (hp3 : p ≠ 3) + (hex_cr₀ : ∃ P₀ : Set (Graph α β), S₀.IsCrookedTransaction P₀ ∧ p ≤ P₀.ncard) + {Q : Fin (p + 5) → Graph α β} {a b : Fin (p + 5) → α} {r : α} + (hG₀ : S₀.G = S.G) + (hbar₀ : S₀.Ω.bar = S.Ω.bar ∪ {r}) + (hrest₀ : S₀.Ω.IsRestriction S.Ω.bar S.Ω) + (hab_empty : S.Ω.interval (a 0) (b 0) = ∅) + (hcw_arb : S₀.Ω.IsClockwise3 (a 0) r (b 0)) + (hr_Q0 : r ∈ V(Q 0) \ {a 0, b 0}) + (hinj_Q : Function.Injective Q) + (htr_Q : S.IsTransaction (range Q)) + (hsep_Q : ∀ i : Fin (p + 5), S.IsSeparatingOmegaPath (Q i)) + (hno_int : ∀ i : Fin (p + 5), Disjoint (pathInternalVerts S.G (Q i)) S.Ω.bar) + (hends_Q : ∀ i : Fin (p + 5), S.IsOmegaPathWithEnds (Q i) (a i) (b i)) + (hcw : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) + {G₁ G₂ : Graph α β} (hsep_G : IsGraphSeparation S.G G₁ G₂) + (hinter_G : V(G₁) ∩ V(G₂) = V(Q ⟨p + 4, by omega⟩)) + (hint_G₁ : S.Ω.interval (a ⟨p + 4, by omega⟩) (b ⟨p + 4, by omega⟩) ⊆ V(G₁)) + (hint_G₂ : S.Ω.interval (b ⟨p + 4, by omega⟩) (a ⟨p + 4, by omega⟩) ⊆ V(G₂)) : + (∃ P₁ P₂ : Graph α β, S₀.OmegaPathsCross P₁ P₂ ∧ + Disjoint V(P₁) V(G₂) ∧ Disjoint V(P₂) V(G₂)) ∨ + (∃ P_set : Set (Graph α β), S.IsCrookedTransaction P_set ∧ P_set.ncard = p ∧ + Disjoint (S.Ω.interval (a ⟨1, by omega⟩) (b ⟨1, by omega⟩)) (S.transactionEnds P_set)) := by + have : Finite V(S₀.G) := S₀.finite_V + have : Finite E(S₀.G) := S₀.finite_E + let Q' : Fin (p + 4) → Graph α β := fun i => Q i.succ + let a' : Fin (p + 4) → α := fun i => a i.succ + let b' : Fin (p + 4) → α := fun i => b i.succ + have hinj_Q' : Function.Injective Q' := fun i j h => Fin.succ_injective _ (hinj_Q h) + have hdisj_Q : Pairwise (fun i j : Fin (p + 5) => Disjoint V(Q i) V(Q j)) := by + rcases htr_Q with ⟨_, _, hfence_Q⟩ + intro i j hij + exact hfence_Q.1.2 (mem_range_self i) (mem_range_self j) (fun h => hij (hinj_Q h)) + have htr_Q' : S₀.IsTransaction (range Q') := by + rcases htr_Q with ⟨A, B, hfence_Q⟩ + obtain ⟨A₀, B₀, hAA₀, hBB₀, hfence₀⟩ := + S.exists_isFence_extension hbar₀ hrest₀ hab_empty hcw_arb hfence_Q.2.1 + refine ⟨A₀, B₀, ⟨?_, ?_⟩, hfence₀, ?_⟩ + · rintro _ ⟨i, rfl⟩ + exact ⟨a' i, b' i, (hends_Q i.succ).1 |> fun h => + ⟨hG₀.symm ▸ h, (hends_Q i.succ).2.1, hbar₀ ▸ Or.inl (hends_Q i.succ).2.2.1, + hbar₀ ▸ Or.inl (hends_Q i.succ).2.2.2⟩⟩ + · rintro _ ⟨i, rfl⟩ _ ⟨j, rfl⟩ hne + exact hfence_Q.1.2 (mem_range_self i.succ) (mem_range_self j.succ) hne + · rintro _ ⟨i, rfl⟩ + obtain ⟨x, hxA, y, hyB, hxy⟩ := hfence_Q.2.2 (Q i.succ) (mem_range_self i.succ) + exact ⟨x, hAA₀ hxA, y, hBB₀ hyB, + ⟨hG₀.symm ▸ hxy.1, hxy.2.1, hbar₀ ▸ Or.inl hxy.2.2.1, hbar₀ ▸ Or.inl hxy.2.2.2⟩⟩ + have hsep_Q' : ∀ i : Fin (p + 4), S₀.IsSeparatingOmegaPath (Q' i) := fun i => + S.lemma_5_5_claim_1 hG₀ hbar₀ hrest₀ hab_empty hcw_arb hr_Q0 (hno_int 0) + hdisj_Q hends_Q hsep_Q hcw i.succ (Fin.succ_pos i) + have hno_int' : ∀ i : Fin (p + 4), Disjoint (pathInternalVerts S₀.G (Q' i)) S₀.Ω.bar := by + intro i + rw [hG₀, hbar₀, disjoint_union_right, disjoint_singleton_right] + refine ⟨hno_int i.succ, fun hr_int => ?_⟩ + exact disjoint_left.mp (hdisj_Q (Fin.succ_ne_zero i).symm) hr_Q0.1 hr_int.1 + have hends_Q' : ∀ i : Fin (p + 4), S₀.IsOmegaPathWithEnds (Q' i) (a' i) (b' i) := fun i => + ⟨hG₀.symm ▸ (hends_Q i.succ).1, (hends_Q i.succ).2.1, + hbar₀ ▸ Or.inl (hends_Q i.succ).2.2.1, hbar₀ ▸ Or.inl (hends_Q i.succ).2.2.2⟩ + have hcw' : S₀.Ω.IsClockwiseSeq ((List.ofFn a').reverse ++ List.ofFn b') := by + have hcw_S := S.isClockwiseSeq_succ_ofFn hcw + exact (hrest₀.isClockwiseSeq_iff.mp hcw_S).2 + let i_last : Fin (p + 4) := ⟨p + 3, by omega⟩ + have hinter_G' : V(G₁) ∩ V(G₂) = V(Q' i_last) := hinter_G + obtain ⟨hr_mlast, h₀_ab_mlast, h₀_ba_mlast⟩ := + S.mem_interval_r_of_clockwise hbar₀ hrest₀ hab_empty hcw_arb hcw (Fin.succ_pos i_last) + -- Show `r ∈ V(G₁)` since `Q 0` is disjoint from `V(G₂)`. + have hr_G₁ : r ∈ V(G₁) := by + obtain ⟨ha0_mlast, hb0_mlast, _, _, _⟩ := + S.Ω.mem_intervals_of_isClockwiseSeq_ofFn hcw (Fin.succ_pos i_last) + have hdisj_Q0_G₂ : Disjoint V(Q 0) V(G₂) := + S.disjoint_right_of_ends_in_interval_of_separating + (hends_Q i_last.succ) (hsep_Q i_last.succ) (hends_Q i_last.succ) (hno_int i_last.succ) + Subset.rfl (Or.inl rfl) hsep_G hinter_G hint_G₁ (hends_Q 0) + (hdisj_Q (Fin.succ_ne_zero i_last).symm) ha0_mlast hb0_mlast + have hr_G : r ∈ V(S.G) := (hends_Q 0).1.1.vertexSet_mono hr_Q0.1 + rw [← hsep_G.2.2.1] at hr_G + exact hr_G.resolve_right (disjoint_left.mp hdisj_Q0_G₂ hr_Q0.1) + have hint_G₁' : S₀.Ω.interval (a' i_last) (b' i_last) ⊆ V(G₁) := by + dsimp [a', b'] + rw [h₀_ab_mlast, union_subset_iff, singleton_subset_iff] + exact ⟨hint_G₁, hr_G₁⟩ + have hint_G₂' : S₀.Ω.interval (b' i_last) (a' i_last) ⊆ V(G₂) := by + dsimp [a', b'] + rwa [h₀_ba_mlast] + rcases S₀.theorem_5_2_proof hp2 hp3 hex_cr₀ hinj_Q' htr_Q' hsep_Q' hno_int' hends_Q' hcw' + (hG₀.symm ▸ hsep_G) hinter_G' hint_G₁' hint_G₂' with + ⟨P₁, P₂, hcr₁₂, hd₁, hd₂⟩ | ⟨P_set, hcr_P, hcard_P, hdisj_1⟩ + · exact Or.inl ⟨P₁, P₂, hcr₁₂, hd₁, hd₂⟩ + · right + let j₁ : Fin (p + 5) := ⟨1, by omega⟩ + have hj₁_pos : (0 : Fin (p + 5)) < j₁ := by + change (0 : ℕ) < 1 + omega + obtain ⟨hr_j1, h₀_ab_j1, _⟩ := + S.mem_interval_r_of_clockwise hbar₀ hrest₀ hab_empty hcw_arb hcw hj₁_pos + have hdisj_1' : Disjoint (S₀.Ω.interval (a j₁) (b j₁)) (S₀.transactionEnds P_set) := hdisj_1 + have hr_not_ends : r ∉ S₀.transactionEnds P_set := + disjoint_left.mp hdisj_1' hr_j1 + have hcr_P_S : S.IsCrookedTransaction P_set := + S.isCrookedTransaction_of_notMem_ends hG₀ hbar₀ hrest₀ hcr_P hr_not_ends + have hends_sub : S.transactionEnds P_set ⊆ S₀.transactionEnds P_set := by + intro v ⟨P, hP, y, hxy⟩ + exact ⟨P, hP, y, hG₀.symm ▸ hxy.1, hxy.2.1, + hbar₀ ▸ Or.inl hxy.2.2.1, hbar₀ ▸ Or.inl hxy.2.2.2⟩ + have hdisj_S : Disjoint (S.Ω.interval (a j₁) (b j₁)) (S.transactionEnds P_set) := by + apply hdisj_1'.mono _ hends_sub + rw [h₀_ab_j1] + exact subset_union_left + exact ⟨P_set, hcr_P_S, hcard_P, hdisj_S⟩ + +/-- If `a₀, b₀ ∈ S.Ω.bar` are distinct with `S.Ω.interval a₀ b₀ = ∅`, and `r ∈ V(S.G) \ S.Ω.bar`, +then there is a society `S₀` with `S₀.G = S.G`, `S₀.Ω.bar = S.Ω.bar ∪ {r}`, +`S₀.Ω.IsRestriction S.Ω.bar S.Ω`, and `S₀.Ω.IsClockwise3 a₀ r b₀`. -/ +private theorem exists_society_extension {a₀ b₀ r : α} + (ha₀ : a₀ ∈ S.Ω.bar) (hb₀ : b₀ ∈ S.Ω.bar) (hab_ne : a₀ ≠ b₀) + (hab_empty : S.Ω.interval a₀ b₀ = ∅) + (hr_G : r ∈ V(S.G)) (hr_not : r ∉ S.Ω.bar) : + ∃ S₀ : Society α β, + S₀.G = S.G ∧ + S₀.Ω.bar = S.Ω.bar ∪ {r} ∧ + S₀.Ω.IsRestriction S.Ω.bar S.Ω ∧ + S₀.Ω.IsClockwise3 a₀ r b₀ := by + classical + have hnext_a0 : S.Ω a₀ = b₀ := by + by_contra hne_b + have hne_a : S.Ω a₀ ≠ a₀ := by + intro heq + have hhit_self : S.Ω.FirstHitIn S.Ω.bar a₀ a₀ := + ⟨1, le_rfl, heq, ha₀, fun j hj1 hjlt _ => by omega⟩ + exact S.Ω.not_firstHitIn_self ha₀ hb₀ hb₀ hab_ne.symm hhit_self + have hmem_ba : S.Ω a₀ ∈ S.Ω.interval b₀ a₀ := by + rcases S.Ω.mem_interval_or_interval_swap ha₀ hb₀ (S.Ω.toFun_mem ha₀) hab_ne hne_a hne_b with + hab | hba + · rw [hab_empty] at hab; exact hab.elim + · exact hba + have hcw3 : S.Ω.IsClockwise3 a₀ b₀ (S.Ω a₀) := + S.Ω.isClockwise3_rotate (S.Ω.isClockwise3_rotate hmem_ba.2) + have hhit_b : S.Ω.FirstHitIn {a₀, b₀, S.Ω a₀} a₀ b₀ := + (S.Ω.isClockwise3_iff.mp hcw3).2.2.2.2.2.2.1 + have hhit_1 : S.Ω.FirstHitIn {a₀, b₀, S.Ω a₀} a₀ (S.Ω a₀) := + ⟨1, le_rfl, rfl, by simp, fun j hj1 hjlt _ => by omega⟩ + exact hne_b (hhit_1.unique hhit_b) + have ha0_ne_r : a₀ ≠ r := fun h => hr_not (h ▸ ha₀) + have hb0_ne_r : b₀ ≠ r := fun h => hr_not (h ▸ hb₀) + let bar₀ : Set α := S.Ω.bar ∪ {r} + let f (x : α) : α := if x = a₀ then r else if x = r then b₀ else S.Ω x + have hf_a0 : f a₀ = r := by simp [f] + have hf_r : f r = b₀ := by simp [f, ha0_ne_r.symm] + have hf_other : ∀ {x : α}, x ∈ S.Ω.bar → x ≠ a₀ → f x = S.Ω x := by + intro x hx hne + have hxr : x ≠ r := fun h => hr_not (h ▸ hx) + simp [f, hne, hxr] + have hmaps : MapsTo f bar₀ bar₀ := by + rintro x (hxS | hxr) + · by_cases hxa : x = a₀ + · subst x; rw [hf_a0]; exact Or.inr rfl + · rw [hf_other hxS hxa]; exact Or.inl (S.Ω.toFun_mem hxS) + · rw [mem_singleton_iff] at hxr; subst x + rw [hf_r]; exact Or.inl hb₀ + have hinj : InjOn f bar₀ := by + rintro x (hxS | hxr) y (hyS | hyr) hxy + · by_cases hxa : x = a₀ + · subst x; rw [hf_a0] at hxy + by_cases hya : y = a₀ + · exact hya.symm + · rw [hf_other hyS hya] at hxy + exact (hr_not (hxy ▸ S.Ω.toFun_mem hyS)).elim + · rw [hf_other hxS hxa] at hxy + by_cases hya : y = a₀ + · subst y; rw [hf_a0] at hxy + exact (hr_not (hxy ▸ S.Ω.toFun_mem hxS)).elim + · rw [hf_other hyS hya] at hxy + exact S.Ω.bijOn.injOn hxS hyS hxy + · rw [mem_singleton_iff] at hyr; subst y + rw [hf_r] at hxy + by_cases hxa : x = a₀ + · subst x; rw [hf_a0] at hxy + exact (hb0_ne_r hxy.symm).elim + · rw [hf_other hxS hxa, ← hnext_a0] at hxy + exact (hxa (S.Ω.bijOn.injOn hxS ha₀ hxy)).elim + · rw [mem_singleton_iff] at hxr; subst x + rw [hf_r] at hxy + by_cases hya : y = a₀ + · subst y; rw [hf_a0] at hxy; exact (hb0_ne_r hxy).elim + · rw [hf_other hyS hya, ← hnext_a0] at hxy + exact (hya (S.Ω.bijOn.injOn hyS ha₀ hxy.symm)).elim + · rw [mem_singleton_iff] at hxr hyr; exact hxr.trans hyr.symm + have hsurj : SurjOn f bar₀ bar₀ := by + rintro y (hyS | hyr) + · by_cases hyb : y = b₀ + · subst y; exact ⟨r, Or.inr rfl, hf_r⟩ + · obtain ⟨x, hxS, rfl⟩ := S.Ω.bijOn.surjOn hyS + have hxa : x ≠ a₀ := fun h => hyb (h ▸ hnext_a0) + exact ⟨x, Or.inl hxS, hf_other hxS hxa⟩ + · rw [mem_singleton_iff] at hyr; subst y + exact ⟨a₀, Or.inl ha₀, hf_a0⟩ + have hstep_S : ∀ x ∈ S.Ω.bar, ∃ m : ℕ, (f^[m]) x = S.Ω x := by + intro x hx + by_cases hxa : x = a₀ + · subst x + refine ⟨2, ?_⟩ + change f (f a₀) = S.Ω a₀ + rw [hf_a0, hf_r, hnext_a0] + · exact ⟨1, hf_other hx hxa⟩ + have hiter_S : ∀ (k : ℕ) {x : α}, x ∈ S.Ω.bar → ∃ N : ℕ, (f^[N]) x = (S.Ω.toFun^[k]) x := by + intro k + induction k with + | zero => intro x _; exact ⟨0, rfl⟩ + | succ k ih => + intro x hx + obtain ⟨N, hN⟩ := ih hx + obtain ⟨m, hm⟩ := hstep_S ((S.Ω.toFun^[k]) x) (S.Ω.iterate_mem k hx) + refine ⟨m + N, ?_⟩ + rw [Function.iterate_add_apply, hN, hm, Function.iterate_succ_apply'] + have horb_S : ∀ x ∈ S.Ω.bar, ∀ y ∈ S.Ω.bar, ∃ N : ℕ, (f^[N]) x = y := by + intro x hx y hy + obtain ⟨k, rfl⟩ := S.Ω.single_orbit x hx y hy + exact hiter_S k hx + have horb₀ : ∀ x ∈ bar₀, ∀ y ∈ bar₀, ∃ N : ℕ, (f^[N]) x = y := by + rintro x (hxS | hxr) y (hyS | hyr) + · exact horb_S x hxS y hyS + · rw [mem_singleton_iff] at hyr; subst y + obtain ⟨N, hN⟩ := horb_S x hxS a₀ ha₀ + refine ⟨N + 1, ?_⟩ + rw [Function.iterate_succ_apply', hN, hf_a0] + · rw [mem_singleton_iff] at hxr; subst x + obtain ⟨N, hN⟩ := horb_S b₀ hb₀ y hyS + refine ⟨N + 1, ?_⟩ + rw [Function.iterate_succ_apply, hf_r, hN] + · rw [mem_singleton_iff] at hxr hyr; subst x y; exact ⟨0, rfl⟩ + let Ω₀ : CyclicPerm α := + { bar := bar₀ + toFun := f + finite_bar := S.Ω.finite_bar.union (finite_singleton r) + bijOn := ⟨hmaps, hinj, hsurj⟩ + single_orbit := horb₀ } + let S₀ : Society α β := + { G := S.G + Ω := Ω₀ + finite_V := S.finite_V + finite_E := S.finite_E + bar_subset := union_subset S.bar_subset (singleton_subset_iff.mpr hr_G) } + have hrest₀ : Ω₀.IsRestriction S.Ω.bar S.Ω := by + refine ⟨(inter_eq_right.mpr subset_union_left).symm, fun x hx => ?_⟩ + by_cases hxa : x = a₀ + · subst x + refine ⟨2, by omega, ?_, S.Ω.toFun_mem ha₀, fun j hj1 hjlt => ?_⟩ + · change f (f a₀) = S.Ω a₀ + rw [hf_a0, hf_r, hnext_a0] + · have hj_eq : j = 1 := by omega + subst hj_eq + change f a₀ ∉ S.Ω.bar + rw [hf_a0] + exact hr_not + · refine ⟨1, le_rfl, hf_other hx hxa, S.Ω.toFun_mem hx, fun j hj1 hjlt => by omega⟩ + have hcw_arb : Ω₀.IsClockwise3 a₀ r b₀ := by + have ha₀_0 : a₀ ∈ Ω₀.bar := Or.inl ha₀ + have hr_0 : r ∈ Ω₀.bar := Or.inr rfl + have hb₀_0 : b₀ ∈ Ω₀.bar := Or.inl hb₀ + have hhit_ar : Ω₀.FirstHitIn {a₀, r, b₀} a₀ r := + ⟨1, le_rfl, hf_a0, by simp, fun j hj1 hjlt _ => by omega⟩ + have hhit_rb : Ω₀.FirstHitIn {a₀, r, b₀} r b₀ := + ⟨1, le_rfl, hf_r, by simp, fun j hj1 hjlt _ => by omega⟩ + obtain ⟨z, hhit_bz⟩ := Ω₀.exists_firstHitIn (X := {a₀, r, b₀}) hb₀_0 ⟨b₀, hb₀_0, by simp⟩ + have hz_ne_b : z ≠ b₀ := fun h => + Ω₀.not_firstHitIn_self hb₀_0 ha₀_0 (by simp) hab_ne (h ▸ hhit_bz) + have hz_ne_r : z ≠ r := fun h => + hab_ne (hhit_ar.inj_left ha₀_0 hb₀_0 (by simp) (by simp) (h ▸ hhit_bz)) + have hz_eq : z = a₀ := by + rcases hhit_bz.mem_set with rfl | rfl | rfl + · rfl + · exact (hz_ne_r rfl).elim + · exact (hz_ne_b rfl).elim + rw [hz_eq] at hhit_bz + exact Ω₀.isClockwise3_iff.mpr + ⟨ha0_ne_r, hab_ne, hb0_ne_r.symm, ha₀_0, hr_0, hb₀_0, hhit_ar, hhit_rb, hhit_bz⟩ + exact ⟨S₀, rfl, rfl, hrest₀, hcw_arb⟩ + +/-- The vertex set of `K`: vertices of `G' = S.G \ V(G₂)` that can reach `ΩBar \ V(G₂)` in `G'`. -/ +def reachFromBarMinusSet (G₂ : Graph α β) : Set α := + {v ∈ V(deleteVertices S.G V(G₂)) | + ∃ z ∈ S.Ω.bar \ V(G₂), Nonempty (GraphWalk (deleteVertices S.G V(G₂)) v z)} + +/-- The subgraph `K` of `G' = S.G \ V(G₂)` induced on `reachFromBarMinusSet G₂` (the union of all +components of `G'` meeting `ΩBar \ V(G₂)`). -/ +def reachFromBarMinusGraph (G₂ : Graph α β) : Graph α β := + (deleteVertices S.G V(G₂)).induce (S.reachFromBarMinusSet G₂) + +@[simp] +private theorem vertexSet_reachFromBarMinusGraph (G₂ : Graph α β) : + V(S.reachFromBarMinusGraph G₂) = S.reachFromBarMinusSet G₂ := rfl + +private theorem reachFromBarMinusGraph_le_deleteVertices (G₂ : Graph α β) : + S.reachFromBarMinusGraph G₂ ≤ deleteVertices S.G V(G₂) := + (deleteVertices S.G V(G₂)).induce_le fun _ hv => hv.1 + +private theorem reachFromBarMinusGraph_le (G₂ : Graph α β) : + S.reachFromBarMinusGraph G₂ ≤ S.G := + (S.reachFromBarMinusGraph_le_deleteVertices G₂).trans (deleteVertices_le S.G V(G₂)) + +private theorem bar_diff_subset_reachFromBarMinusSet (G₂ : Graph α β) : + S.Ω.bar \ V(G₂) ⊆ S.reachFromBarMinusSet G₂ := by + intro z hz + have hz_G' : z ∈ V(deleteVertices S.G V(G₂)) := ⟨S.bar_subset hz.1, hz.2⟩ + exact ⟨hz_G', z, hz, ⟨.nil hz_G'⟩⟩ + +private theorem bar_inter_reachFromBarMinusGraph (G₂ : Graph α β) : + S.Ω.bar ∩ V(S.reachFromBarMinusGraph G₂) = S.Ω.bar ∩ V(deleteVertices S.G V(G₂)) := by + ext z + simp only [mem_inter_iff, vertexSet_reachFromBarMinusGraph] + refine ⟨fun ⟨hz_bar, hz_K⟩ => ⟨hz_bar, hz_K.1⟩, fun ⟨hz_bar, hz_G'⟩ => ?_⟩ + exact ⟨hz_bar, S.bar_diff_subset_reachFromBarMinusSet G₂ ⟨hz_bar, hz_G'.2⟩⟩ + +/-- Any path `P` in `S.G` disjoint from `V(G₂)` whose left end is in `reachFromBarMinusSet G₂` +is a subgraph of `reachFromBarMinusGraph G₂`. -/ +private theorem le_reachFromBarMinusGraph_of_isGraphPathWithEnds {G₂ P : Graph α β} {s t : α} + (hP : IsGraphPathWithEnds S.G P s t) (hdisj : Disjoint V(P) V(G₂)) + (hs : s ∈ S.reachFromBarMinusSet G₂) : + P ≤ S.reachFromBarMinusGraph G₂ := by + have hP_G' : P ≤ deleteVertices S.G V(G₂) := le_deleteVertices hP.1 hdisj + have hVP_K : V(P) ⊆ S.reachFromBarMinusSet G₂ := by + intro v hv + obtain ⟨Q_vs, _, hQ_vs_P, _⟩ := hP.exists_subpath hv hP.left_mem + rcases hQ_vs_P with ⟨hQ_P, W_vs, _, _, _⟩ + obtain ⟨W_vs', _, _⟩ := exists_walk_up_of_le (hQ_P.trans hP_G') W_vs + rcases hs with ⟨_, z, hz, ⟨W_sz⟩⟩ + exact ⟨hP_G'.vertexSet_mono hv, z, hz, ⟨W_vs'.append W_sz⟩⟩ + rw [(Compatible.of_le_le hP_G' (S.reachFromBarMinusGraph_le_deleteVertices G₂)).le_iff] + refine ⟨?_, fun e he => ?_⟩ + · rw [vertexSet_reachFromBarMinusGraph]; exact hVP_K + · obtain ⟨x, y, hxy⟩ := P.exists_isLink_of_mem_edgeSet he + exact ⟨x, y, hxy.mono hP_G', hVP_K hxy.left_mem, hVP_K hxy.right_mem⟩ + +/-- **Graph Minors IX, (5.5), Claim (3)** (page 55): +"Let $K$ be the maximal subgraph of $G_1 \setminus V(Q_{p+5})$ caught by $\bar{\Omega} - V(G_2)$... +(3) *$\bar{\Omega} \cap V(K \setminus V(Q_1))$ catches $K \setminus V(Q_1)$.*" -/ +theorem lemma_5_5_claim_3 {p : ℕ} (hp2 : 2 ≤ p) + {Q : Fin (p + 5) → Graph α β} {a b : Fin (p + 5) → α} + (hinj_Q : Function.Injective Q) + (htr_Q : S.IsTransaction (range Q)) + (hsep_Q : ∀ i : Fin (p + 5), S.IsSeparatingOmegaPath (Q i)) + (hno_int : ∀ i : Fin (p + 5), Disjoint (pathInternalVerts S.G (Q i)) S.Ω.bar) + (hends_Q : ∀ i : Fin (p + 5), S.IsOmegaPathWithEnds (Q i) (a i) (b i)) + (hcw : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) + (hcatches : Catches (S.Ω.bar \ {a 0, b 0}) (deleteVertices S.G V(Q 0))) + {G₁ G₂ : Graph α β} (hsep_G : IsGraphSeparation S.G G₁ G₂) + (hinter_G : V(G₁) ∩ V(G₂) = V(Q ⟨p + 4, by omega⟩)) + (hint_G₁ : S.Ω.interval (a ⟨p + 4, by omega⟩) (b ⟨p + 4, by omega⟩) ⊆ V(G₁)) : + Catches ((S.Ω.bar \ V(G₂)) \ {a 0, b 0}) + (deleteVertices (S.reachFromBarMinusGraph G₂) V(Q 0)) := by + let K := S.reachFromBarMinusGraph G₂ + let K_del := deleteVertices K V(Q 0) + let j₁ : Fin (p + 5) := ⟨1, by omega⟩ + let m_last : Fin (p + 5) := ⟨p + 4, by omega⟩ + have hj₁_pos : (0 : Fin (p + 5)) < j₁ := by change (0 : ℕ) < 1; omega + have hj₁_lt_m : j₁ < m_last := by change 1 < p + 4; omega + have h0_lt_m : (0 : Fin (p + 5)) < m_last := by change 0 < p + 4; omega + have hdisj_Q : Pairwise (fun i j : Fin (p + 5) => Disjoint V(Q i) V(Q j)) := by + rcases htr_Q with ⟨_, _, hfence_Q⟩ + intro i j hij + exact hfence_Q.1.2 (mem_range_self i) (mem_range_self j) (fun h => hij (hinj_Q h)) + have hdisj_01 : Disjoint V(Q 0) V(Q j₁) := hdisj_Q (ne_of_lt hj₁_pos) + have hdisj_1m : Disjoint V(Q j₁) V(Q m_last) := hdisj_Q (ne_of_lt hj₁_lt_m) + obtain ⟨ha0_j1, hb0_j1, hsub_01, _, _⟩ := S.Ω.mem_intervals_of_isClockwiseSeq_ofFn hcw hj₁_pos + obtain ⟨ha1_m, hb1_m, hsub_1m, ham_b1a1, hbm_b1a1⟩ := + S.Ω.mem_intervals_of_isClockwiseSeq_ofFn hcw hj₁_lt_m + -- `Q j₁` is disjoint from `V(G₂)` and lies in `K_del`. + have hdisj_Q1_G₂ : Disjoint V(Q j₁) V(G₂) := + S.disjoint_right_of_ends_in_interval_of_separating + (hends_Q m_last) (hsep_Q m_last) (hends_Q m_last) (hno_int m_last) + Subset.rfl (Or.inl rfl) hsep_G hinter_G hint_G₁ + (hends_Q j₁) hdisj_1m ha1_m hb1_m + have ha1_bar_diff : a j₁ ∈ S.Ω.bar \ V(G₂) := + ⟨(hends_Q j₁).2.2.1, disjoint_left.mp hdisj_Q1_G₂ (hends_Q j₁).1.left_mem⟩ + have hQ1_Kdel : Q j₁ ≤ K_del := + le_deleteVertices + (S.le_reachFromBarMinusGraph_of_isGraphPathWithEnds (hends_Q j₁).1 hdisj_Q1_G₂ + (S.bar_diff_subset_reachFromBarMinusSet G₂ ha1_bar_diff)) + hdisj_01.symm + have ha1_not_ab0 : a j₁ ∉ ({a 0, b 0} : Set α) := by + rintro (h | h) + · exact disjoint_left.mp hdisj_01 (h ▸ (hends_Q 0).1.left_mem) (hends_Q j₁).1.left_mem + · exact disjoint_left.mp hdisj_01 (h ▸ (hends_Q 0).1.right_mem) (hends_Q j₁).1.left_mem + have ha1_target : a j₁ ∈ (S.Ω.bar \ V(G₂)) \ {a 0, b 0} := + ⟨ha1_bar_diff, ha1_not_ab0⟩ + have ha1_Kdel : a j₁ ∈ V(K_del) := hQ1_Kdel.vertexSet_mono (hends_Q j₁).1.left_mem + refine ⟨fun z hz => ⟨S.bar_diff_subset_reachFromBarMinusSet G₂ hz.1, + (hcatches.1 ⟨hz.1.1, hz.2⟩).2⟩, fun C hC => ?_⟩ + obtain ⟨v₀, hv₀_C⟩ := hC.2.1.1 + have hC_eq : C = reachableComponent K_del v₀ := isGraphComponent_eq_reachableComponent hC hv₀_C + have hv₀_Kdel : v₀ ∈ V(K_del) := hC.1.vertexSet_mono hv₀_C + have hv₀_K : v₀ ∈ S.reachFromBarMinusSet G₂ := hv₀_Kdel.1 + have hv₀_not_Q0 : v₀ ∉ V(Q 0) := hv₀_Kdel.2 + have hv₀_G' : v₀ ∈ V(deleteVertices S.G V(G₂)) := hv₀_K.1 + have hv₀_G₁ : v₀ ∈ V(G₁) := (hsep_G.2.2.1.symm ▸ hv₀_G'.1).resolve_right hv₀_G'.2 + -- Helper: if `v₀` has a path `P_v` in `K_del` to some `u ∈ V(Q j₁)`, then `C` meets the target. + have hreach_of_Q1 : ∀ {P_v : Graph α β} {u : α}, + IsGraphPathWithEnds K_del P_v v₀ u → u ∈ V(Q j₁) → + (((S.Ω.bar \ V(G₂)) \ {a 0, b 0}) ∩ V(C)).Nonempty := by + intro P_v u hPv hu_Q1 + rcases hPv with ⟨hPv_Kdel, W_vu, _, _, _⟩ + obtain ⟨W_vu', _, _⟩ := exists_walk_up_of_le hPv_Kdel W_vu + obtain ⟨Q1_ua, hQ1_ua_le, hQ1_ua, _⟩ := + (hends_Q j₁).1.exists_subpath hu_Q1 (hends_Q j₁).1.left_mem + rcases hQ1_ua with ⟨_, W_ua, _, _, _⟩ + obtain ⟨W_ua', _, _⟩ := exists_walk_up_of_le (hQ1_ua_le.trans hQ1_Kdel) W_ua + refine ⟨a j₁, ha1_target, ?_⟩ + rw [hC_eq, vertexSet_reachableComponent] + exact ⟨ha1_Kdel, ⟨W_vu'.append W_ua'⟩⟩ + -- Step 1: Extract a path `R` in `K` from `v₀` to `z₁ ∈ S.Ω.bar \ V(G₂)`. + rcases hv₀_K with ⟨_, z₁, hz₁, ⟨W₁⟩⟩ + obtain ⟨R, hR_G', _, _⟩ := exists_isGraphPathWithEnds_of_walk W₁ + have hz₁_K : z₁ ∈ S.reachFromBarMinusSet G₂ := S.bar_diff_subset_reachFromBarMinusSet G₂ hz₁ + have hdisj_R_G₂ : Disjoint V(R) V(G₂) := + disjoint_left.mpr fun _ hx => (hR_G'.1.vertexSet_mono hx).2 + have hR_K : R ≤ K := + S.le_reachFromBarMinusGraph_of_isGraphPathWithEnds + (hR_G'.mono (deleteVertices_le S.G V(G₂))).symm hdisj_R_G₂ hz₁_K + have hR_path_K : IsGraphPathWithEnds K R v₀ z₁ := hR_G'.of_le hR_K + by_cases hdisj_R_Q0 : Disjoint V(R) V(Q 0) + · have hR_Kdel : R ≤ K_del := le_deleteVertices hR_K hdisj_R_Q0 + rcases hR_path_K with ⟨_, W_R, _, _, _⟩ + obtain ⟨W_R', _, _⟩ := exists_walk_up_of_le hR_Kdel W_R + have hz₁_not_Q0 : z₁ ∉ V(Q 0) := disjoint_left.mp hdisj_R_Q0 hR_G'.right_mem + have hz₁_not_ab0 : z₁ ∉ ({a 0, b 0} : Set α) := by + rintro (rfl | rfl) + · exact hz₁_not_Q0 (hends_Q 0).1.left_mem + · exact hz₁_not_Q0 (hends_Q 0).1.right_mem + refine ⟨z₁, ⟨hz₁, hz₁_not_ab0⟩, ?_⟩ + rw [hC_eq, vertexSet_reachableComponent] + exact ⟨⟨hz₁_K, hz₁_not_Q0⟩, ⟨W_R'⟩⟩ + · rw [not_disjoint_iff_nonempty_inter] at hdisj_R_Q0 + rcases hdisj_R_Q0 with ⟨x₀, hx₀_R, hx₀_Q0⟩ + obtain ⟨R₀, hR₀_R, _, hR₀_K⟩ := hR_path_K.exists_subpath hR_path_K.left_mem hx₀_R + obtain ⟨v₀', hv₀'_eq, x₁, hx₁_01, R₁, hR₁_R₀, hR₁_ft⟩ := + hR₀_K.exists_isFromToPathWithEnds (X := {v₀}) (Y := V(Q 0) ∪ V(Q j₁)) rfl (Or.inl hx₀_Q0) + rw [mem_singleton_iff] at hv₀'_eq + subst v₀' + by_cases hx₁_Q1 : x₁ ∈ V(Q j₁) + · have hx₁_not_Q0 : x₁ ∉ V(Q 0) := disjoint_right.mp hdisj_01 hx₁_Q1 + have hdisj_R₁_Q0 : Disjoint V(R₁) V(Q 0) := by + rw [disjoint_left] + intro u hu_R₁ hu_Q0 + have hu_in : u ∈ V(R₁) ∩ (V(Q 0) ∪ V(Q j₁)) := ⟨hu_R₁, Or.inl hu_Q0⟩ + rw [hR₁_ft.2.2, mem_singleton_iff] at hu_in + exact hx₁_not_Q0 (hu_in ▸ hu_Q0) + have hR₁_Kdel : IsGraphPathWithEnds K_del R₁ v₀ x₁ := + hR₁_ft.1.of_le (le_deleteVertices hR₁_ft.1.1 hdisj_R₁_Q0) + exact hreach_of_Q1 hR₁_Kdel hx₁_Q1 + · have hx₁_Q0 : x₁ ∈ V(Q 0) := hx₁_01.resolve_right hx₁_Q1 + have hdisj_R₁_Q1 : Disjoint V(R₁) V(Q j₁) := by + rw [disjoint_left] + intro u hu_R₁ hu_Q1 + have hu_in : u ∈ V(R₁) ∩ (V(Q 0) ∪ V(Q j₁)) := ⟨hu_R₁, Or.inr hu_Q1⟩ + rw [hR₁_ft.2.2, mem_singleton_iff] at hu_in + exact hx₁_Q1 (hu_in ▸ hu_Q1) + -- Step 2: Use `hcatches` on `deleteVertices S.G V(Q 0)` at `v₀`. + have hv₀_G_no_Q0 : v₀ ∈ V(deleteVertices S.G V(Q 0)) := ⟨hv₀_G'.1, hv₀_not_Q0⟩ + obtain ⟨C_G, hC_G, hv₀_CG⟩ := exists_graphComponent_of_mem hv₀_G_no_Q0 + obtain ⟨z₂, hz₂_bar_diff, hz₂_CG⟩ := hcatches.2 C_G hC_G + rw [isGraphComponent_eq_reachableComponent hC_G hv₀_CG, + vertexSet_reachableComponent] at hz₂_CG + rcases hz₂_CG with ⟨_, ⟨W₂⟩⟩ + obtain ⟨M, hM_no_Q0, _, _⟩ := exists_isGraphPathWithEnds_of_walk W₂ + have hdisj_M_Q0 : Disjoint V(M) V(Q 0) := + disjoint_left.mpr fun _ hx => (hM_no_Q0.1.vertexSet_mono hx).2 + have hM_G : IsGraphPathWithEnds S.G M v₀ z₂ := + hM_no_Q0.mono (deleteVertices_le S.G V(Q 0)) + by_cases hdisj_M_G₂ : Disjoint V(M) V(G₂) + · have hM_K : M ≤ K := + S.le_reachFromBarMinusGraph_of_isGraphPathWithEnds hM_G hdisj_M_G₂ ⟨hv₀_G', z₁, hz₁, ⟨W₁⟩⟩ + have hM_Kdel : M ≤ K_del := le_deleteVertices hM_K hdisj_M_Q0 + rcases hM_G with ⟨_, W_M, _, _, _⟩ + obtain ⟨W_M', _, _⟩ := exists_walk_up_of_le hM_Kdel W_M + have hz₂_not_G₂ : z₂ ∉ V(G₂) := disjoint_left.mp hdisj_M_G₂ hM_no_Q0.right_mem + have hz₂_not_Q0 : z₂ ∉ V(Q 0) := disjoint_left.mp hdisj_M_Q0 hM_no_Q0.right_mem + have hz₂_K : z₂ ∈ S.reachFromBarMinusSet G₂ := + S.bar_diff_subset_reachFromBarMinusSet G₂ ⟨hz₂_bar_diff.1, hz₂_not_G₂⟩ + refine ⟨z₂, ⟨⟨hz₂_bar_diff.1, hz₂_not_G₂⟩, hz₂_bar_diff.2⟩, ?_⟩ + rw [hC_eq, vertexSet_reachableComponent] + exact ⟨⟨hz₂_K, hz₂_not_Q0⟩, ⟨W_M'⟩⟩ + · rw [not_disjoint_iff_nonempty_inter] at hdisj_M_G₂ + rcases hdisj_M_G₂ with ⟨y₀, hy₀_M, hy₀_G₂⟩ + obtain ⟨M₀, hM₀_M, _, hM₀_G⟩ := hM_G.exists_subpath hM_G.left_mem hy₀_M + obtain ⟨v₀'', hv₀''_eq, y₁, hy₁_G₂1, M₁, hM₁_M₀, hM₁_ft⟩ := + hM₀_G.exists_isFromToPathWithEnds (X := {v₀}) (Y := V(G₂) ∪ V(Q j₁)) rfl (Or.inl hy₀_G₂) + rw [mem_singleton_iff] at hv₀''_eq + subst v₀'' + have hM₁_M : M₁ ≤ M := hM₁_M₀.trans hM₀_M + by_cases hy₁_Q1 : y₁ ∈ V(Q j₁) + · have hy₁_not_G₂ : y₁ ∉ V(G₂) := disjoint_left.mp hdisj_Q1_G₂ hy₁_Q1 + have hdisj_M₁_G₂ : Disjoint V(M₁) V(G₂) := by + rw [disjoint_left] + intro u hu_M₁ hu_G₂ + have hu_in : u ∈ V(M₁) ∩ (V(G₂) ∪ V(Q j₁)) := ⟨hu_M₁, Or.inl hu_G₂⟩ + rw [hM₁_ft.2.2, mem_singleton_iff] at hu_in + exact hy₁_not_G₂ (hu_in ▸ hu_G₂) + have hM₁_K : M₁ ≤ K := + S.le_reachFromBarMinusGraph_of_isGraphPathWithEnds hM₁_ft.1 hdisj_M₁_G₂ + ⟨hv₀_G', z₁, hz₁, ⟨W₁⟩⟩ + have hdisj_M₁_Q0 : Disjoint V(M₁) V(Q 0) := + hdisj_M_Q0.mono_left hM₁_M.vertexSet_mono + have hM₁_Kdel : IsGraphPathWithEnds K_del M₁ v₀ y₁ := + hM₁_ft.1.of_le (le_deleteVertices hM₁_K hdisj_M₁_Q0) + exact hreach_of_Q1 hM₁_Kdel hy₁_Q1 + · exfalso + have hy₁_G₂ : y₁ ∈ V(G₂) := hy₁_G₂1.resolve_right hy₁_Q1 + have hdisj_M₁_Q1 : Disjoint V(M₁) V(Q j₁) := by + rw [disjoint_left] + intro u hu_M₁ hu_Q1 + have hu_in : u ∈ V(M₁) ∩ (V(G₂) ∪ V(Q j₁)) := ⟨hu_M₁, Or.inr hu_Q1⟩ + rw [hM₁_ft.2.2, mem_singleton_iff] at hu_in + exact hy₁_Q1 (hu_in ▸ hu_Q1) + obtain ⟨w, hw_M₁, hw_inter⟩ := + exists_mem_inter_of_isGraphPathWithEnds hsep_G hM₁_ft.1 hv₀_G₁ hy₁_G₂ + have hw_eq_y₁ : w = y₁ := by + have hw_in : w ∈ V(M₁) ∩ (V(G₂) ∪ V(Q j₁)) := ⟨hw_M₁, Or.inl hw_inter.2⟩ + rwa [hM₁_ft.2.2, mem_singleton_iff] at hw_in + have hy₁_Qm : y₁ ∈ V(Q m_last) := by + rw [← hinter_G, ← hw_eq_y₁]; exact hw_inter + -- Build a walk in `G_no_Q1 := deleteVertices S.G V(Q j₁)` from `a 0` to `a m_last`. + let G_no_Q1 := deleteVertices S.G V(Q j₁) + obtain ⟨Q0_ax, hQ0_ax_le, _, hQ0_ax_G⟩ := + (hends_Q 0).1.exists_subpath (hends_Q 0).1.left_mem hx₁_Q0 + have hQ0_ax_no : Q0_ax ≤ G_no_Q1 := + le_deleteVertices hQ0_ax_G.1 (hdisj_01.mono_left hQ0_ax_le.vertexSet_mono) + rcases hQ0_ax_G with ⟨_, W_ax, _, _, _⟩ + obtain ⟨W_ax', _, _⟩ := exists_walk_up_of_le hQ0_ax_no W_ax + have hR₁_no : R₁ ≤ G_no_Q1 := + le_deleteVertices (hR₁_ft.1.1.trans (S.reachFromBarMinusGraph_le G₂)) hdisj_R₁_Q1 + rcases (hR₁_ft.1.mono (S.reachFromBarMinusGraph_le G₂)).symm with ⟨_, W_xv, _, _, _⟩ + obtain ⟨W_xv', _, _⟩ := exists_walk_up_of_le hR₁_no W_xv + have hM₁_no : M₁ ≤ G_no_Q1 := le_deleteVertices hM₁_ft.1.1 hdisj_M₁_Q1 + rcases hM₁_ft.1 with ⟨_, W_vy, _, _, _⟩ + obtain ⟨W_vy', _, _⟩ := exists_walk_up_of_le hM₁_no W_vy + obtain ⟨Qm_ya, hQm_ya_le, _, hQm_ya_G⟩ := + (hends_Q m_last).1.exists_subpath hy₁_Qm (hends_Q m_last).1.left_mem + have hQm_ya_no : Qm_ya ≤ G_no_Q1 := + le_deleteVertices hQm_ya_G.1 (hdisj_1m.symm.mono_left hQm_ya_le.vertexSet_mono) + rcases hQm_ya_G with ⟨_, W_ya, _, _, _⟩ + obtain ⟨W_ya', _, _⟩ := exists_walk_up_of_le hQm_ya_no W_ya + let W_cross := (W_ax'.append W_xv').append (W_vy'.append W_ya') + obtain ⟨P_cross, hP_cross_no, _, _⟩ := exists_isGraphPathWithEnds_of_walk W_cross + have hdisj_P_Q1 : Disjoint V(P_cross) V(Q j₁) := + disjoint_left.mpr fun _ hx => (hP_cross_no.1.vertexSet_mono hx).2 + have ha0_ne_am : a 0 ≠ a m_last := fun h => + disjoint_left.mp (S.Ω.disjoint_interval_swap (a j₁) (b j₁)) ha0_j1 (h ▸ ham_b1a1) + have hP_cross_omega : S.IsOmegaPathWithEnds P_cross (a 0) (a m_last) := + ⟨hP_cross_no.mono (deleteVertices_le S.G V(Q j₁)), ha0_ne_am, + (hends_Q 0).2.2.1, (hends_Q m_last).2.2.1⟩ + have hcr_PQ1 : S.Ω.Crosses (a 0) (a m_last) (a j₁) (b j₁) := + (S.Ω.crosses_iff_interval.mpr (Or.inl ⟨ha0_j1, ham_b1a1⟩)).symm + exact (hsep_Q j₁).2 + ⟨P_cross, hdisj_P_Q1, a 0, a m_last, a j₁, b j₁, hP_cross_omega, hends_Q j₁, hcr_PQ1⟩ + +/-- If `S₀.Ω` is a one-point extension of `S.Ω` by `r` in `(a₀, b₀)`, `S_K.Ω` is a restriction of +`S.Ω` to `X` containing `a₀, b₀`, and `S₀_K.Ω` is a one-point extension of `S_K.Ω` by `r` in +`(a₀, b₀)`, then any four vertices in `S₀_K.Ω.bar` that cross in `S₀.Ω` also cross in `S₀_K.Ω`. -/ +private theorem crosses_of_extension_restriction {S₀ S_K S₀_K : Society α β} {X : Set α} + {a₀ b₀ r s₁ t₁ s₂ t₂ : α} + (hbar₀ : S₀.Ω.bar = S.Ω.bar ∪ {r}) + (hrest₀ : S₀.Ω.IsRestriction S.Ω.bar S.Ω) + (hab_empty : S.Ω.interval a₀ b₀ = ∅) + (hcw_arb : S₀.Ω.IsClockwise3 a₀ r b₀) + (hrest_K : S.Ω.IsRestriction X S_K.Ω) + (ha₀_K : a₀ ∈ S_K.Ω.bar) (hb₀_K : b₀ ∈ S_K.Ω.bar) + (hbar₀_K : S₀_K.Ω.bar = S_K.Ω.bar ∪ {r}) + (hrest₀_K : S₀_K.Ω.IsRestriction S_K.Ω.bar S_K.Ω) + (hab_empty_K : S_K.Ω.interval a₀ b₀ = ∅) + (hcw_arb_K : S₀_K.Ω.IsClockwise3 a₀ r b₀) + (hs₁ : s₁ ∈ S₀_K.Ω.bar) (ht₁ : t₁ ∈ S₀_K.Ω.bar) + (hs₂ : s₂ ∈ S₀_K.Ω.bar) (ht₂ : t₂ ∈ S₀_K.Ω.bar) + (hcr₀ : S₀.Ω.Crosses s₁ t₁ s₂ t₂) : + S₀_K.Ω.Crosses s₁ t₁ s₂ t₂ := by + obtain ⟨h₀_ab, h_a0r_empty, h_rb0_empty, _, _⟩ := + S.Ω.extension_intervals hbar₀ hrest₀ hab_empty hcw_arb + obtain ⟨h₀K_ab, _, _, _, _⟩ := + S_K.Ω.extension_intervals hbar₀_K hrest₀_K hab_empty_K hcw_arb_K + have hr_a0b0 : r ∈ S₀.Ω.interval a₀ b₀ := by rw [h₀_ab]; rfl + have hr_a0b0_K : r ∈ S₀_K.Ω.interval a₀ b₀ := by rw [h₀K_ab]; rfl + have hK_sub_S : S_K.Ω.bar ⊆ S.Ω.bar := hrest_K.1 ▸ inter_subset_left + have hr_not_S : r ∉ S.Ω.bar := by + intro hrS + have hr_in : r ∈ S.Ω.interval a₀ b₀ := by + rw [hrest₀.interval_eq (hK_sub_S ha₀_K) (hK_sub_S hb₀_K)] + exact ⟨hr_a0b0, hrS⟩ + rw [hab_empty] at hr_in + exact hr_in + have hr_not_K : r ∉ S_K.Ω.bar := fun h => hr_not_S (hK_sub_S h) + have h_bar_trans : ∀ {x y z : α}, + x ∈ S_K.Ω.bar → y ∈ S_K.Ω.bar → z ∈ S_K.Ω.bar → + z ∈ S₀.Ω.interval x y → z ∈ S₀_K.Ω.interval x y := by + intro x y z hx hy hz hz₀ + have hz_S : z ∈ S.Ω.interval x y := by + rw [hrest₀.interval_eq (hK_sub_S hx) (hK_sub_S hy)] + exact ⟨hz₀, hK_sub_S hz⟩ + have hz_K : z ∈ S_K.Ω.interval x y := by + rw [hrest_K.interval_eq hx hy] + exact ⟨hz_S, hz⟩ + have h_eq := hrest₀_K.interval_eq hx hy + rw [h_eq] at hz_K + exact hz_K.1 + have hr_a0v : ∀ {v : α}, v ∈ S_K.Ω.bar → + r ∈ S₀.Ω.interval a₀ v → r ∈ S₀_K.Ω.interval a₀ v := by + intro v hv hrv + by_cases hvb : v = b₀ + · subst v; exact hr_a0b0_K + · have hv_ne_r : v ≠ r := fun h => hr_not_K (h ▸ hv) + have hr_ne_b0 : r ≠ b₀ := (S₀.Ω.isClockwise3_iff.mp hcw_arb).2.2.1 + have hv_0 : v ∈ S₀.Ω.bar := hbar₀ ▸ Or.inl (hK_sub_S hv) + have hb0_0 : b₀ ∈ S₀.Ω.bar := hbar₀ ▸ Or.inl (hK_sub_S hb₀_K) + have hr_0 : r ∈ S₀.Ω.bar := hbar₀ ▸ Or.inr rfl + have hv_b0r : v ∈ S₀.Ω.interval b₀ r := by + rcases S₀.Ω.mem_interval_or_interval_swap hr_0 hb0_0 hv_0 hr_ne_b0 hv_ne_r hvb with + h1 | h2 + · rw [h_rb0_empty] at h1; exact h1.elim + · exact h2 + have hb0_rv : b₀ ∈ S₀.Ω.interval r v := S₀.Ω.mem_interval_rotate_right hv_b0r + have hb0_a0v : b₀ ∈ S₀.Ω.interval a₀ v := + S₀.Ω.interval_subset_interval_right hrv hb0_rv + have hb0_a0v_K : b₀ ∈ S₀_K.Ω.interval a₀ v := h_bar_trans ha₀_K hv hb₀_K hb0_a0v + exact S₀_K.Ω.interval_subset_interval_left hb0_a0v_K hr_a0b0_K + have hr_uv : ∀ {u v : α}, u ∈ S_K.Ω.bar → v ∈ S_K.Ω.bar → + r ∈ S₀.Ω.interval u v → r ∈ S₀_K.Ω.interval u v := by + intro u v hu hv hruv + by_cases hua : u = a₀ + · subst u; exact hr_a0v hv hruv + · have hu_ne_r : u ≠ r := fun h => hr_not_K (h ▸ hu) + have ha0_ne_r : a₀ ≠ r := (S₀.Ω.isClockwise3_iff.mp hcw_arb).1 + have hu_0 : u ∈ S₀.Ω.bar := hbar₀ ▸ Or.inl (hK_sub_S hu) + have ha0_0 : a₀ ∈ S₀.Ω.bar := hbar₀ ▸ Or.inl (hK_sub_S ha₀_K) + have hr_0 : r ∈ S₀.Ω.bar := hbar₀ ▸ Or.inr rfl + have hu_ra0 : u ∈ S₀.Ω.interval r a₀ := by + rcases S₀.Ω.mem_interval_or_interval_swap ha0_0 hr_0 hu_0 ha0_ne_r hua hu_ne_r with + h1 | h2 + · rw [h_a0r_empty] at h1; exact h1.elim + · exact h2 + have ha0_ur : a₀ ∈ S₀.Ω.interval u r := S₀.Ω.mem_interval_rotate_left hu_ra0 + have ha0_uv : a₀ ∈ S₀.Ω.interval u v := S₀.Ω.interval_subset_interval_left hruv ha0_ur + have hr_a0u : r ∈ S₀.Ω.interval a₀ u := S₀.Ω.mem_interval_rotate_right hu_ra0 + have hr_not_ua0 : r ∉ S₀.Ω.interval u a₀ := + disjoint_left.mp (S₀.Ω.disjoint_interval_swap a₀ u) hr_a0u + have hunion := S₀.Ω.interval_eq_union_of_mem ha0_uv + have hr_a0v₀ : r ∈ S₀.Ω.interval a₀ v := by + have hruv' : r ∈ S₀.Ω.interval u a₀ ∪ {a₀} ∪ S₀.Ω.interval a₀ v := hunion ▸ hruv + rcases hruv' with (h1 | h2) | h3 + · exact (hr_not_ua0 h1).elim + · exact (ha0_ne_r (mem_singleton_iff.mp h2).symm).elim + · exact h3 + have ha0_uv_K : a₀ ∈ S₀_K.Ω.interval u v := h_bar_trans hu hv ha₀_K ha0_uv + have hr_a0v_K : r ∈ S₀_K.Ω.interval a₀ v := hr_a0v hv hr_a0v₀ + exact S₀_K.Ω.interval_subset_interval_right ha0_uv_K hr_a0v_K + have hz_uv : ∀ {u v z : α}, + u ∈ S₀_K.Ω.bar → v ∈ S₀_K.Ω.bar → z ∈ S₀_K.Ω.bar → + z ∈ S₀.Ω.interval u v → z ∈ S₀_K.Ω.interval u v := by + intro u v z hu hv hz hz₀ + have hc_iff := S₀.Ω.isClockwise3_iff.mp hz₀.2 + have huz : u ≠ z := hc_iff.1 + have huv : u ≠ v := hc_iff.2.1 + have hzv : z ≠ v := hc_iff.2.2.1 + rcases hbar₀_K ▸ hz with hzK | hzr + · rcases hbar₀_K ▸ hu with huK | hur + · rcases hbar₀_K ▸ hv with hvK | hvr + · exact h_bar_trans huK hvK hzK hz₀ + · rw [mem_singleton_iff] at hvr; subst v + exact S₀_K.Ω.mem_interval_rotate_right + (hr_uv hzK huK (S₀.Ω.mem_interval_rotate_left hz₀)) + · rw [mem_singleton_iff] at hur; subst u + have hvK : v ∈ S_K.Ω.bar := (hbar₀_K ▸ hv).resolve_right (fun h => huv + (mem_singleton_iff.mp h).symm) + exact S₀_K.Ω.mem_interval_rotate_left + (hr_uv hvK hzK (S₀.Ω.mem_interval_rotate_right hz₀)) + · rw [mem_singleton_iff] at hzr; subst z + have huK : u ∈ S_K.Ω.bar := (hbar₀_K ▸ hu).resolve_right (fun h => huz + (mem_singleton_iff.mp h)) + have hvK : v ∈ S_K.Ω.bar := (hbar₀_K ▸ hv).resolve_right (fun h => hzv + (mem_singleton_iff.mp h).symm) + exact hr_uv huK hvK hz₀ + rcases S₀.Ω.crosses_iff_interval.mp hcr₀ with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · exact S₀_K.Ω.crosses_iff_interval.mpr + (Or.inl ⟨hz_uv hs₁ ht₁ hs₂ h1, hz_uv ht₁ hs₁ ht₂ h2⟩) + · exact S₀_K.Ω.crosses_iff_interval.mpr + (Or.inr ⟨hz_uv hs₁ ht₁ ht₂ h1, hz_uv ht₁ hs₁ hs₂ h2⟩) + +/-- **Graph Minors IX, (5.5), Claim (2)** (pages 54–55): +"(2) *There is a cross in $(K, \Omega_0 \mid V(K))$.*" -/ +theorem lemma_5_5_claim_2 {S₀ S_K S₀_K : Society α β} {p : ℕ} + (hp2 : 2 ≤ p) (hp3 : p ≠ 3) + {Q : Fin (p + 5) → Graph α β} {a b : Fin (p + 5) → α} {r : α} + (hinj_Q : Function.Injective Q) + (htr_Q : S.IsTransaction (range Q)) + (hsep_Q : ∀ i : Fin (p + 5), S.IsSeparatingOmegaPath (Q i)) + (hno_int : ∀ i : Fin (p + 5), Disjoint (pathInternalVerts S.G (Q i)) S.Ω.bar) + (hends_Q : ∀ i : Fin (p + 5), S.IsOmegaPathWithEnds (Q i) (a i) (b i)) + (hcw : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) + (hab_empty : S.Ω.interval (a 0) (b 0) = ∅) + (hr_Q0 : r ∈ V(Q 0) \ {a 0, b 0}) + {G₁ G₂ : Graph α β} (hsep_G : IsGraphSeparation S.G G₁ G₂) + (hinter_G : V(G₁) ∩ V(G₂) = V(Q ⟨p + 4, by omega⟩)) + (hint_G₁ : S.Ω.interval (a ⟨p + 4, by omega⟩) (b ⟨p + 4, by omega⟩) ⊆ V(G₁)) + (hint_G₂ : S.Ω.interval (b ⟨p + 4, by omega⟩) (a ⟨p + 4, by omega⟩) ⊆ V(G₂)) + (hG₀ : S₀.G = S.G) + (hbar₀ : S₀.Ω.bar = S.Ω.bar ∪ {r}) + (hrest₀ : S₀.Ω.IsRestriction S.Ω.bar S.Ω) + (hcw_arb : S₀.Ω.IsClockwise3 (a 0) r (b 0)) + (hex_cr₀ : ∃ P₀ : Set (Graph α β), S₀.IsCrookedTransaction P₀ ∧ p ≤ P₀.ncard) + (hno_cr : ∀ P_set : Set (Graph α β), S.IsCrookedTransaction P_set → P_set.ncard ≠ p) + (hGK : S_K.G = S.reachFromBarMinusGraph G₂) + (hrest_K : S.Ω.IsRestriction V(S_K.G) S_K.Ω) + (hG₀_K : S₀_K.G = S_K.G) + (hbar₀_K : S₀_K.Ω.bar = S_K.Ω.bar ∪ {r}) + (hrest₀_K : S₀_K.Ω.IsRestriction S_K.Ω.bar S_K.Ω) + (hcw_arb_K : S₀_K.Ω.IsClockwise3 (a 0) r (b 0)) : + ∃ P₁ P₂ : Graph α β, S₀_K.IsCross P₁ P₂ := by + have : Finite V(S.G) := S.finite_V + have : Finite E(S.G) := S.finite_E + obtain ⟨P₁, P₂, hcr₁₂₀, hd₁, hd₂⟩ : + ∃ P₁ P₂ : Graph α β, S₀.OmegaPathsCross P₁ P₂ ∧ + Disjoint V(P₁) V(G₂) ∧ Disjoint V(P₂) V(G₂) := by + rcases S.lemma_5_5_claim_2_disjoint hp2 hp3 hex_cr₀ hG₀ hbar₀ hrest₀ hab_empty hcw_arb hr_Q0 + hinj_Q htr_Q hsep_Q hno_int hends_Q hcw hsep_G hinter_G hint_G₁ hint_G₂ with + h1 | ⟨P_set, hcr_P, hcard_P, _⟩ + · exact h1 + · exact (hno_cr P_set hcr_P hcard_P).elim + let m_last : Fin (p + 5) := ⟨p + 4, by omega⟩ + have hdisj_Q : Pairwise (fun i j : Fin (p + 5) => Disjoint V(Q i) V(Q j)) := by + rcases htr_Q with ⟨_, _, hfence_Q⟩ + intro i j hij + exact hfence_Q.1.2 (mem_range_self i) (mem_range_self j) (fun h => hij (hinj_Q h)) + have h0_lt_m : (0 : Fin (p + 5)) < m_last := by change (0 : ℕ) < p + 4; omega + obtain ⟨ha0_mlast, hb0_mlast, _, _, _⟩ := + S.Ω.mem_intervals_of_isClockwiseSeq_ofFn hcw h0_lt_m + have hdisj_Q0_G₂ : Disjoint V(Q 0) V(G₂) := + S.disjoint_right_of_ends_in_interval_of_separating + (hends_Q m_last) (hsep_Q m_last) (hends_Q m_last) (hno_int m_last) + Subset.rfl (Or.inl rfl) hsep_G hinter_G hint_G₁ (hends_Q 0) + (hdisj_Q (ne_of_lt h0_lt_m)) ha0_mlast hb0_mlast + have ha0_not_G₂ : a 0 ∉ V(G₂) := disjoint_left.mp hdisj_Q0_G₂ (hends_Q 0).1.left_mem + have hb0_not_G₂ : b 0 ∉ V(G₂) := disjoint_left.mp hdisj_Q0_G₂ (hends_Q 0).1.right_mem + have ha0_K_set : a 0 ∈ S.reachFromBarMinusSet G₂ := + S.bar_diff_subset_reachFromBarMinusSet G₂ ⟨(hends_Q 0).2.2.1, ha0_not_G₂⟩ + have hb0_K_set : b 0 ∈ S.reachFromBarMinusSet G₂ := + S.bar_diff_subset_reachFromBarMinusSet G₂ ⟨(hends_Q 0).2.2.2, hb0_not_G₂⟩ + have hQ0_K : Q 0 ≤ S_K.G := + hGK ▸ S.le_reachFromBarMinusGraph_of_isGraphPathWithEnds (hends_Q 0).1 hdisj_Q0_G₂ ha0_K_set + have ha0_bar_K : a 0 ∈ S_K.Ω.bar := by + rw [hrest_K.1, hGK] + exact ⟨(hends_Q 0).2.2.1, ha0_K_set⟩ + have hb0_bar_K : b 0 ∈ S_K.Ω.bar := by + rw [hrest_K.1, hGK] + exact ⟨(hends_Q 0).2.2.2, hb0_K_set⟩ + have hab_empty_K : S_K.Ω.interval (a 0) (b 0) = ∅ := by + rw [hrest_K.interval_eq ha0_bar_K hb0_bar_K, hab_empty, empty_inter] + have hr_K : r ∈ V(S.reachFromBarMinusGraph G₂) := + (hGK ▸ hQ0_K).vertexSet_mono hr_Q0.1 + have hP_in_0K : ∀ {P : Graph α β} {s t : α}, + S₀.IsOmegaPathWithEnds P s t → Disjoint V(P) V(G₂) → + S₀_K.IsOmegaPathWithEnds P s t := by + intro P s t hP₀ hdP + have hP_G : IsGraphPathWithEnds S.G P s t := hG₀ ▸ hP₀.1 + have h_end_0K : ∀ {u : α}, u ∈ S₀.Ω.bar → u ∈ V(P) → + u ∈ S₀_K.Ω.bar ∧ u ∈ S.reachFromBarMinusSet G₂ := by + intro u hu₀ huP + have hu_not_G₂ : u ∉ V(G₂) := disjoint_left.mp hdP huP + rcases hbar₀ ▸ hu₀ with huS | hur + · have huK : u ∈ S.reachFromBarMinusSet G₂ := + S.bar_diff_subset_reachFromBarMinusSet G₂ ⟨huS, hu_not_G₂⟩ + have hu_bar_K : u ∈ S_K.Ω.bar := by + rw [hrest_K.1, hGK]; exact ⟨huS, huK⟩ + exact ⟨hbar₀_K ▸ Or.inl hu_bar_K, huK⟩ + · rw [mem_singleton_iff] at hur; subst u + exact ⟨hbar₀_K ▸ Or.inr rfl, hr_K⟩ + have hs_0K := h_end_0K hP₀.2.2.1 hP_G.left_mem + have ht_0K := h_end_0K hP₀.2.2.2 hP_G.right_mem + have hP_K : P ≤ S_K.G := + hGK ▸ S.le_reachFromBarMinusGraph_of_isGraphPathWithEnds hP_G hdP hs_0K.2 + exact ⟨hG₀_K ▸ hP_G.of_le hP_K, hP₀.2.1, hs_0K.1, ht_0K.1⟩ + rcases hcr₁₂₀ with ⟨hdisj_12, s₁, t₁, s₂, t₂, hP₁₀, hP₂₀, hcr_st₀⟩ + have hP₁_0K := hP_in_0K hP₁₀ hd₁ + have hP₂_0K := hP_in_0K hP₂₀ hd₂ + have hcr_st_0K : S₀_K.Ω.Crosses s₁ t₁ s₂ t₂ := + S.crosses_of_extension_restriction hbar₀ hrest₀ hab_empty hcw_arb + hrest_K ha0_bar_K hb0_bar_K hbar₀_K hrest₀_K hab_empty_K hcw_arb_K + hP₁_0K.2.2.1 hP₁_0K.2.2.2 hP₂_0K.2.2.1 hP₂_0K.2.2.2 hcr_st₀ + exact ⟨P₁, P₂, hdisj_12, s₁, t₁, s₂, t₂, hP₁_0K, hP₂_0K, hcr_st_0K⟩ + +/-- **Graph Minors IX, (5.5)** (pages 54–55): +"Let $(G, \Omega)$ be internally 4-connected and let $p \ge 2$ with $p \ne 3$. Let $\{Q_1, +\dots, Q_{p+5}\}$ be a transaction such that for $1 \le i \le p+5$, $Q_i$ is separating, has +no internal vertex in $\bar{\Omega}$, and has ends $a_i, b_i$, where $(a_{p+5}, a_{p+4}, +\dots, a_1, b_1, b_2, \dots, b_{p+5})$ is clockwise. Let $\Omega(a_1, b_1) = \emptyset$, and +let $r \in V(Q_1) - \{a_1, b_1\}$. Let $(G_1, G_2)$ be a separation of $G$ with $V(G_1 \cap +G_2) = V(Q_{p+5})$, $\Omega(a_{p+5}, b_{p+5}) \subseteq V(G_1)$, and $\Omega(b_{p+5}, +a_{p+5}) \subseteq V(G_2)$. Let $\Omega_0$ be the cyclic permutation with $\bar{\Omega}_0 = +\bar{\Omega} \cup \{r\}$ and $\Omega_0 \mid \bar{\Omega} = \Omega$, such that $(a_1, r, +b_1)$ is $\Omega_0$-clockwise. Suppose that $Q_1$ is induced, that $\bar{\Omega} - \{a_1, +b_1\}$ catches $G \setminus V(Q_1)$, that $(G, \Omega_0)$ has a crooked transaction of +cardinality $p$ and that $(G, \Omega)$ has no crooked transaction of cardinality $p$. Then +there is a non-separating $\Omega$-path $P$ of $(G, \Omega)$ with $P \subseteq G_1$." -/ +theorem theorem_5_5_proof {S₀ : Society α β} {p : ℕ} + (hconn : S.IsInternallyKConnected 4) + (hp2 : 2 ≤ p) (hp3 : p ≠ 3) + {Q : Fin (p + 5) → Graph α β} {a b : Fin (p + 5) → α} {r : α} + (hinj_Q : Function.Injective Q) + (htr_Q : S.IsTransaction (range Q)) + (hsep_Q : ∀ i : Fin (p + 5), S.IsSeparatingOmegaPath (Q i)) + (hno_int : ∀ i : Fin (p + 5), Disjoint (pathInternalVerts S.G (Q i)) S.Ω.bar) + (hends_Q : ∀ i : Fin (p + 5), S.IsOmegaPathWithEnds (Q i) (a i) (b i)) + (hcw : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) + (hab_empty : S.Ω.interval (a 0) (b 0) = ∅) + (hr_Q0 : r ∈ V(Q 0) \ {a 0, b 0}) + {G₁ G₂ : Graph α β} (hsep_G : IsGraphSeparation S.G G₁ G₂) + (hinter_G : V(G₁) ∩ V(G₂) = V(Q ⟨p + 4, by omega⟩)) + (hQm_G₁ : Q ⟨p + 4, by omega⟩ ≤ G₁) + (hint_G₁ : S.Ω.interval (a ⟨p + 4, by omega⟩) (b ⟨p + 4, by omega⟩) ⊆ V(G₁)) + (hint_G₂ : S.Ω.interval (b ⟨p + 4, by omega⟩) (a ⟨p + 4, by omega⟩) ⊆ V(G₂)) + (hG₀ : S₀.G = S.G) + (hbar₀ : S₀.Ω.bar = S.Ω.bar ∪ {r}) + (hrest₀ : S₀.Ω.IsRestriction S.Ω.bar S.Ω) + (hcw_arb : S₀.Ω.IsClockwise3 (a 0) r (b 0)) + (hQ0_ind : S.G.induce V(Q 0) = Q 0) + (hcatches : Catches (S.Ω.bar \ {a 0, b 0}) (deleteVertices S.G V(Q 0))) + (hex_cr₀ : ∃ P₀ : Set (Graph α β), S₀.IsCrookedTransaction P₀ ∧ p ≤ P₀.ncard) + (hno_cr : ∀ P_set : Set (Graph α β), S.IsCrookedTransaction P_set → P_set.ncard ≠ p) : + (∃ P₁ P₂ : Graph α β, P₁ ≤ G₁ ∧ P₂ ≤ G₁ ∧ S.IsCross P₁ P₂) ∧ + (∃ P : Graph α β, S.IsNonSeparatingOmegaPath P ∧ P ≤ G₁) := by + have : Finite V(S.G) := S.finite_V + have : Finite E(S.G) := S.finite_E + -- Suffices to find a cross `M₁, M₂ ≤ G₁` in `S`. + suffices h_cross_G₁ : ∃ M₁ M₂ : Graph α β, M₁ ≤ G₁ ∧ M₂ ≤ G₁ ∧ S.IsCross M₁ M₂ by + refine ⟨h_cross_G₁, ?_⟩ + rcases h_cross_G₁ with ⟨M₁, M₂, _, hM₂_G₁, hcr_M⟩ + rcases hcr_M.2 with ⟨_, _, s₂, t₂, _, hM₂_ends, _⟩ + exact ⟨M₂, ⟨⟨s₂, t₂, hM₂_ends⟩, M₁, hcr_M⟩, hM₂_G₁⟩ + -- Define `G'`, `K`, `S'`, `S_K`, and `S₁`. + let m_last : Fin (p + 5) := ⟨p + 4, by omega⟩ + let G' := deleteVertices S.G V(G₂) + let K := S.reachFromBarMinusGraph G₂ + obtain ⟨Ω', hrest'⟩ := S.Ω.exists_isRestriction V(G') + have hrest_K : S.Ω.IsRestriction V(K) Ω' := + ⟨hrest'.1.trans (S.bar_inter_reachFromBarMinusGraph G₂).symm, hrest'.2⟩ + let S' : Society α β := + { G := G' + Ω := Ω' + finite_V := S.finite_V.subset (deleteVertices_le S.G V(G₂)).vertexSet_mono + finite_E := S.finite_E.subset (deleteVertices_le S.G V(G₂)).edgeSet_mono + bar_subset := hrest'.1 ▸ inter_subset_right } + let S_K : Society α β := + { G := K + Ω := Ω' + finite_V := S.finite_V.subset (S.reachFromBarMinusGraph_le G₂).vertexSet_mono + finite_E := S.finite_E.subset (S.reachFromBarMinusGraph_le G₂).edgeSet_mono + bar_subset := hrest_K.1 ▸ inter_subset_right } + obtain ⟨Ω₁, hrest₁⟩ := S.Ω.exists_isRestriction V(G₁) + let S₁ : Society α β := + { G := G₁ + Ω := Ω₁ + finite_V := S.finite_V.subset hsep_G.1.vertexSet_mono + finite_E := S.finite_E.subset hsep_G.1.edgeSet_mono + bar_subset := hrest₁.1 ▸ inter_subset_right } + have hdisj_Q : Pairwise (fun i j : Fin (p + 5) => Disjoint V(Q i) V(Q j)) := by + rcases htr_Q with ⟨_, _, hfence_Q⟩ + intro i j hij + exact hfence_Q.1.2 (mem_range_self i) (mem_range_self j) (fun h => hij (hinj_Q h)) + -- Show `Q 0 ≤ K` and `a 0, b 0 ∈ S_K.Ω.bar`. + have h0_lt_m : (0 : Fin (p + 5)) < m_last := by change (0 : ℕ) < p + 4; omega + obtain ⟨ha0_mlast, hb0_mlast, _, _, _⟩ := + S.Ω.mem_intervals_of_isClockwiseSeq_ofFn hcw h0_lt_m + have hdisj_Q0_G₂ : Disjoint V(Q 0) V(G₂) := + S.disjoint_right_of_ends_in_interval_of_separating + (hends_Q m_last) (hsep_Q m_last) (hends_Q m_last) (hno_int m_last) + Subset.rfl (Or.inl rfl) hsep_G hinter_G hint_G₁ (hends_Q 0) + (hdisj_Q (ne_of_lt h0_lt_m)) ha0_mlast hb0_mlast + have ha0_not_G₂ : a 0 ∉ V(G₂) := disjoint_left.mp hdisj_Q0_G₂ (hends_Q 0).1.left_mem + have hb0_not_G₂ : b 0 ∉ V(G₂) := disjoint_left.mp hdisj_Q0_G₂ (hends_Q 0).1.right_mem + have ha0_K_set : a 0 ∈ S.reachFromBarMinusSet G₂ := + S.bar_diff_subset_reachFromBarMinusSet G₂ ⟨(hends_Q 0).2.2.1, ha0_not_G₂⟩ + have hb0_K_set : b 0 ∈ S.reachFromBarMinusSet G₂ := + S.bar_diff_subset_reachFromBarMinusSet G₂ ⟨(hends_Q 0).2.2.2, hb0_not_G₂⟩ + have hQ0_K : Q 0 ≤ K := + S.le_reachFromBarMinusGraph_of_isGraphPathWithEnds (hends_Q 0).1 hdisj_Q0_G₂ ha0_K_set + have ha0_bar_K : a 0 ∈ S_K.Ω.bar := by + change a 0 ∈ Ω'.bar + rw [hrest_K.1] + exact ⟨(hends_Q 0).2.2.1, ha0_K_set⟩ + have hb0_bar_K : b 0 ∈ S_K.Ω.bar := by + change b 0 ∈ Ω'.bar + rw [hrest_K.1] + exact ⟨(hends_Q 0).2.2.2, hb0_K_set⟩ + have hab_empty_K : S_K.Ω.interval (a 0) (b 0) = ∅ := by + rw [hrest_K.interval_eq ha0_bar_K hb0_bar_K, hab_empty, empty_inter] + have hr_K : r ∈ V(K) := hQ0_K.vertexSet_mono hr_Q0.1 + have hr_not_S : r ∉ S.Ω.bar := by + have hr_int : r ∈ pathInternalVerts S.G (Q 0) := by + rw [(hends_Q 0).1.pathInternalVerts_eq] + exact hr_Q0 + exact disjoint_left.mp (hno_int 0) hr_int + have hr_not_bar_K : r ∉ S_K.Ω.bar := by + intro hrK + have hrS : r ∈ S.Ω.bar := (hrest_K.1 ▸ hrK).1 + exact hr_not_S hrS + -- Construct `S₀_K` extending `S_K` by `r` in `(a 0, b 0)`. + obtain ⟨S₀_K, hG₀_K, hbar₀_K, hrest₀_K, hcw_arb_K⟩ := + S_K.exists_society_extension ha0_bar_K hb0_bar_K (hends_Q 0).2.1 hab_empty_K hr_K hr_not_bar_K + -- By Claim (2), there is a cross in `S₀_K`. + have hcross_0K : ∃ P₁ P₂ : Graph α β, S₀_K.IsCross P₁ P₂ := + S.lemma_5_5_claim_2 hp2 hp3 hinj_Q htr_Q hsep_Q hno_int hends_Q hcw hab_empty hr_Q0 + hsep_G hinter_G hint_G₁ hint_G₂ hG₀ hbar₀ hrest₀ hcw_arb hex_cr₀ hno_cr + rfl hrest_K hG₀_K hbar₀_K hrest₀_K hcw_arb_K + -- Check remaining hypotheses of `S_K.theorem_5_3_proof`. + have hQ0_ends_K : S_K.IsOmegaPathWithEnds (Q 0) (a 0) (b 0) := + ⟨(hends_Q 0).1.of_le hQ0_K, (hends_Q 0).2.1, ha0_bar_K, hb0_bar_K⟩ + have hQ0_ind_K : S_K.G.induce V(Q 0) = Q 0 := by + have hK_le_G : S_K.G ≤ S.G := S.reachFromBarMinusGraph_le G₂ + refine (Compatible.of_le_le (S_K.G.induce_le hQ0_K.vertexSet_mono) hQ0_K).ext rfl ?_ + ext e + simp only [edgeSet_induce, mem_ofPred_eq] + refine ⟨fun ⟨x, y, hxy, hx, hy⟩ => ?_, fun he => ?_⟩ + · have hxy_G : (S.G.induce V(Q 0)).IsLink e x y := by + rw [S.G.induce_isLink V(Q 0)] + exact ⟨hxy.mono hK_le_G, hx, hy⟩ + rw [hQ0_ind] at hxy_G + exact hxy_G.edge_mem + · obtain ⟨x, y, hxy⟩ := (Q 0).exists_isLink_of_mem_edgeSet he + exact ⟨x, y, hxy.mono hQ0_K, hxy.left_mem, hxy.right_mem⟩ + have hcatches_K : Catches (S_K.Ω.bar \ {a 0, b 0}) (deleteVertices S_K.G V(Q 0)) := by + have hbar_K_eq : S_K.Ω.bar = S.Ω.bar \ V(G₂) := by + change Ω'.bar = S.Ω.bar \ V(G₂) + rw [hrest'.1] + ext z + simp only [mem_inter_iff, mem_sdiff] + exact ⟨fun ⟨hz₁, _, hz₂⟩ => ⟨hz₁, hz₂⟩, + fun ⟨hz₁, hz₂⟩ => ⟨hz₁, S.bar_subset hz₁, hz₂⟩⟩ + rw [hbar_K_eq] + exact S.lemma_5_5_claim_3 hp2 hinj_Q htr_Q hsep_Q hno_int hends_Q hcw + hcatches hsep_G hinter_G hint_G₁ + have hno_int_K : Disjoint (pathInternalVerts S_K.G (Q 0)) S_K.Ω.bar := by + rw [hQ0_ends_K.1.pathInternalVerts_eq, ← (hends_Q 0).1.pathInternalVerts_eq] + exact (hno_int 0).mono_right (hrest_K.1 ▸ inter_subset_left) + -- Apply `S_K.theorem_5_3_proof`. + have hG'_eq : deleteVertices S.G V(G₂) = deleteVertices G₁ V(Q m_last) := + deleteVertices_eq_of_isGraphSeparation hsep_G hinter_G + have hK_le_G₁ : K ≤ G₁ := + (S.reachFromBarMinusGraph_le_deleteVertices G₂).trans + (hG'_eq ▸ deleteVertices_le G₁ V(Q m_last)) + have : Finite V(S_K.G) := S_K.finite_V + have : Finite E(S_K.G) := S_K.finite_E + rcases S_K.theorem_5_3_proof hG₀_K hQ0_ends_K hQ0_ind_K hab_empty_K hcatches_K hno_int_K + hr_Q0 hbar₀_K hrest₀_K hcw_arb_K hcross_0K with + ⟨M₁, M₂, hdisj_M, u₁, v₁, u₂, v₂, hM₁_K, hM₂_K, hcr_M_K⟩ | ⟨N₁, N₂, N₃, htri_K⟩ + · -- `S_K` has a cross `{M₁, M₂}`. + have hM₁_G₁ : M₁ ≤ G₁ := hM₁_K.1.1.trans hK_le_G₁ + have hM₂_G₁ : M₂ ≤ G₁ := hM₂_K.1.1.trans hK_le_G₁ + have hM₁_S : S.IsOmegaPathWithEnds M₁ u₁ v₁ := + ⟨hM₁_K.1.mono (S.reachFromBarMinusGraph_le G₂), hM₁_K.2.1, + (hrest_K.1 ▸ hM₁_K.2.2.1).1, (hrest_K.1 ▸ hM₁_K.2.2.2).1⟩ + have hM₂_S : S.IsOmegaPathWithEnds M₂ u₂ v₂ := + ⟨hM₂_K.1.mono (S.reachFromBarMinusGraph_le G₂), hM₂_K.2.1, + (hrest_K.1 ▸ hM₂_K.2.2.1).1, (hrest_K.1 ▸ hM₂_K.2.2.2).1⟩ + have hcr_M_S : S.Ω.Crosses u₁ v₁ u₂ v₂ := + (hrest_K.crosses_iff.mp hcr_M_K).2.2.2.2 + exact ⟨M₁, M₂, hM₁_G₁, hM₂_G₁, hdisj_M, u₁, v₁, u₂, v₂, hM₁_S, hM₂_S, hcr_M_S⟩ + · -- `S_K` has a tripod `{N₁, N₂, N₃}`; lift it to `S'` and apply `S.theorem_5_4_proof`. + have hK_le_G' : K ≤ G' := S.reachFromBarMinusGraph_le_deleteVertices G₂ + have htri' : S'.IsTripod N₁ N₂ N₃ := by + rcases htri_K with ⟨u, v, huv, hN₁, hN₂, hN₃, h12, h13, h23, + s₁, hs₁, s₂, hs₂, s₃, hs₃, t₁, ht₁, t₂, ht₂, t₃, ht₃, + hX_sub, hY_sub, hcard_XY, P_r, hdisj_Pr, hPr_ft⟩ + refine ⟨u, v, huv, hN₁.mono hK_le_G', hN₂.mono hK_le_G', hN₃.mono hK_le_G', + h12, h13, h23, s₁, hs₁, s₂, hs₂, s₃, hs₃, t₁, ht₁, t₂, ht₂, t₃, ht₃, + hX_sub, hY_sub, hcard_XY, P_r, hdisj_Pr, fun i => ?_⟩ + obtain ⟨x, hx, y, hy, hft⟩ := hPr_ft i + exact ⟨x, hx, y, hy, hft.1.mono hK_le_G', hft.2.1, hft.2.2⟩ + obtain ⟨M₁, M₂, hdisj_M, u₁, v₁, u₂, v₂, hM₁_1, hM₂_1, hcr_M_1⟩ := + S.cross_of_tripod_in_restricted_society hconn (hends_Q m_last) + hsep_G hinter_G hQm_G₁ + (rfl : S'.G = _) hrest' (rfl : S₁.G = _) hrest₁ ⟨N₁, N₂, N₃, htri'⟩ + have hM₁_S : S.IsOmegaPathWithEnds M₁ u₁ v₁ := + ⟨hM₁_1.1.mono hsep_G.1, hM₁_1.2.1, + (hrest₁.1 ▸ hM₁_1.2.2.1).1, (hrest₁.1 ▸ hM₁_1.2.2.2).1⟩ + have hM₂_S : S.IsOmegaPathWithEnds M₂ u₂ v₂ := + ⟨hM₂_1.1.mono hsep_G.1, hM₂_1.2.1, + (hrest₁.1 ▸ hM₂_1.2.2.1).1, (hrest₁.1 ▸ hM₂_1.2.2.2).1⟩ + have hcr_M_S : S.Ω.Crosses u₁ v₁ u₂ v₂ := + (hrest₁.crosses_iff.mp hcr_M_1).2.2.2.2 + exact ⟨M₁, M₂, hM₁_1.1.1, hM₂_1.1.1, hdisj_M, u₁, v₁, u₂, v₂, hM₁_S, hM₂_S, hcr_M_S⟩ + +end Society + +export Society (theorem_5_3_proof theorem_5_4_proof theorem_5_5_proof) + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section6.lean b/LeanPool/GraphMinor/GM09/Section6.lean new file mode 100644 index 0000000000..bc06887e06 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section6.lean @@ -0,0 +1,2361 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2a +import LeanPool.GraphMinor.GM09.Section2b +import LeanPool.GraphMinor.GM09.Section2d +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section3b +import LeanPool.GraphMinor.GM09.Section3c +import LeanPool.GraphMinor.GM09.Section4a +import LeanPool.GraphMinor.GM09.Section4b +import LeanPool.GraphMinor.GM09.Section4c +import LeanPool.GraphMinor.GM09.Section5a +import LeanPool.GraphMinor.GM09.Section5b +import Mathlib.Data.Set.Card + +/-! +# Graph Minors IX, Section 6: The Main Theorem (6.1) + +This file formalizes Section 6 (pages 55–58) of +N. Robertson and P. D. Seymour, *Graph Minors. IX. Disjoint crossed paths*, +J. Combin. Theory Ser. B **49** (1990) 40–77: +- Properties of `peripheralIntervalSet` (`U(P)`), `transactionPeripheralUnion` (`U(P_set)`), and + `coveredComponentUnion` (`C(P_set)`), and existence of a transaction `P_set` satisfying `(a)`, + `(b)`, and `(c)` (maximal `C(P_set)`). +- Claims `(1)`–`(9)` (`lemma_6_1_claim_5`, `lemma_6_1_claim_6`, `lemma_6_1_claim_7`, + `lemma_6_1_claim_8`, `lemma_6_1_claim_9`, pages 55–57). +- Statement `S_t` (`StatementSt`, page 58), `statementSt_zero`, `statementSt_succ`, + `statementSt_two`, `exists_crooked_of_statementSt_two`, and the main theorem `(6.1)` + (`theorem_6_1`, pages 55–58). +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- Every graph path `P` with ends `a, b` is a connected graph. -/ +theorem IsGraphPathWithEnds.isGraphConnected {G P : Graph α β} {a b : α} + (h : IsGraphPathWithEnds G P a b) : IsGraphConnected P := by + refine ⟨⟨a, h.left_mem⟩, fun u hu v hv => ?_⟩ + obtain ⟨_, hQP, ⟨_, W, _, _, _⟩, _⟩ := h.exists_subpath hu hv + obtain ⟨W_P, _, _⟩ := exists_walk_up_of_le hQP W + exact ⟨W_P⟩ + +namespace Society + +variable (S : Society α β) + +/-! ## Properties of `U(P)`, `U(P_set)`, and `C(P_set)` (page 55) -/ + +/-- If `P` is an `Ω`-path with ends `a, b` and no internal vertex of `P` is in `ΩBar`, then +`V(P) ∩ ΩBar = {a, b}`. -/ +theorem IsOmegaPathWithEnds.vertexSet_inter_bar_eq {P : Graph α β} {a b : α} + (hP : S.IsOmegaPathWithEnds P a b) + (hno_int : Disjoint (pathInternalVerts S.G P) S.Ω.bar) : + V(P) ∩ S.Ω.bar = {a, b} := by + ext x + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨hxP, hx_bar⟩ + by_contra hne + have hx_int : x ∈ pathInternalVerts S.G P := by + rw [pathInternalVerts, hP.1.pathEnds_eq] + exact ⟨hxP, hne⟩ + exact disjoint_left.mp hno_int hx_int hx_bar + · rintro (rfl | rfl) + · exact ⟨hP.1.left_mem, hP.2.2.1⟩ + · exact ⟨hP.1.right_mem, hP.2.2.2⟩ + +/-- When `P_set` is a transaction with `|P_set| ≥ 2` and `P ∈ P_set` has ends `a, b` such that +`Ω(a, b) ∩ V(P_set) = ∅`, the opposite interval `Ω(b, a)` meets `V(P_set)` and hence +`U(P) = peripheralIntervalSet P_set P = Ω(b, a)` uniquely (Graph Minors IX, Section 6, page 55: +"(This defines `U(P)` uniquely.)"). -/ +theorem peripheralIntervalSet_eq_interval {P_set : Set (Graph α β)} {P : Graph α β} {a b : α} + (htrans : S.IsTransaction P_set) + (hcard : 2 ≤ P_set.ncard) + (hP_in : P ∈ P_set) + (hP_ends : S.IsOmegaPathWithEnds P a b) + (hd_ab : Disjoint (S.Ω.interval a b) (S.transactionEnds P_set)) : + ¬ Disjoint (S.Ω.interval b a) (S.transactionEnds P_set) ∧ + S.peripheralIntervalSet P_set P = S.Ω.interval b a := by + obtain ⟨A, B, hfence⟩ := htrans + have hex_other : ∃ P₁ ∈ P_set, P₁ ≠ P := by + by_contra! hall + have hsub : P_set ⊆ {P} := fun Q hQ => mem_singleton_iff.mpr (hall Q hQ) + have hle : P_set.ncard ≤ ({P} : Set (Graph α β)).ncard := + ncard_le_ncard hsub (finite_singleton P) + rw [ncard_singleton] at hle + omega + obtain ⟨P₁, hP₁_in, hP₁_ne⟩ := hex_other + obtain ⟨a₁, _, b₁, _, hP₁_ends⟩ := hfence.2.2 P₁ hP₁_in + have hdisj_P₁P : Disjoint V(P₁) V(P) := hfence.1.2 hP₁_in hP_in hP₁_ne + have ha₁_ne_a : a₁ ≠ a := fun h => + disjoint_left.mp hdisj_P₁P hP₁_ends.1.left_mem (h ▸ hP_ends.1.left_mem) + have ha₁_ne_b : a₁ ≠ b := fun h => + disjoint_left.mp hdisj_P₁P hP₁_ends.1.left_mem (h ▸ hP_ends.1.right_mem) + have ha₁_W : a₁ ∈ S.transactionEnds P_set := hP₁_ends.mem_transactionEnds_left S hP₁_in + have ha₁_ba : a₁ ∈ S.Ω.interval b a := by + rcases S.Ω.mem_interval_or_interval_swap hP_ends.2.2.1 hP_ends.2.2.2 hP₁_ends.2.2.1 + hP_ends.2.1 ha₁_ne_a ha₁_ne_b with ha₁_ab | ha₁_ba + · exact (disjoint_left.mp hd_ab ha₁_ab ha₁_W).elim + · exact ha₁_ba + have hnot_disj_ba : ¬ Disjoint (S.Ω.interval b a) (S.transactionEnds P_set) := + fun hd => disjoint_left.mp hd ha₁_ba ha₁_W + refine ⟨hnot_disj_ba, ?_⟩ + ext x + simp only [peripheralIntervalSet, mem_iUnion] + constructor + · rintro ⟨s, t, ⟨hP_st, hd_st⟩, hx⟩ + rcases hP_ends.ends_eq S hP_st with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hx + · exact (hnot_disj_ba hd_st).elim + · intro hx + exact ⟨a, b, ⟨hP_ends, hd_ab⟩, hx⟩ + +/-- For every peripheral member `P` of `P_set`, `C(P_set) ∩ V(P) = ∅`. -/ +theorem disjoint_coveredComponentUnion_of_isPeripheralIn {P_set : Set (Graph α β)} {P : Graph α β} + (hP_in : P ∈ P_set) (hper : S.IsPeripheralIn P_set P) : + Disjoint (S.coveredComponentUnion P_set) V(P) := by + rw [disjoint_left] + rintro v ⟨_, _, _, Q, hQ, hav⟩ hvP + exact disjoint_left.mp (hav P hP_in hper) hvP hQ.left_mem + +/-- When `P_set` is a transaction with `|P_set| ≥ 2` and no member of `P_set` has an internal vertex +in `ΩBar`, `U(P_set) ⊆ C(P_set)` and `U(P_set)` is disjoint from `V(P)` for every peripheral member +`P` +of `P_set`. -/ +theorem transactionPeripheralUnion_subset_coveredComponentUnion {P_set : Set (Graph α β)} + (htrans : S.IsTransaction P_set) + (hcard : 2 ≤ P_set.ncard) + (hno_int : ∀ P ∈ P_set, Disjoint (pathInternalVerts S.G P) S.Ω.bar) : + S.transactionPeripheralUnion P_set ⊆ S.coveredComponentUnion P_set := by + intro u hu + have hu_bar : u ∈ S.Ω.bar := hu.1 + have huG : u ∈ V(S.G) := S.bar_subset hu_bar + let Q := walkSubgraph (GraphWalk.nil huG) + have hQ_path : IsGraphPathWithEnds S.G Q u u := + isGraphPathWithEnds_walkSubgraph (List.nodup_singleton u) + have hVQ : V(Q) = {u} := by + ext z + simp [Q, vertexSet_walkSubgraph] + refine ⟨huG, u, hu, Q, hQ_path, fun P hP_in hper => ?_⟩ + rw [Avoids, hVQ, disjoint_singleton_right] + intro huP + have hu_ends : u ∈ pathEnds S.G P := by + by_contra hu_not_ends + exact disjoint_left.mp (hno_int P hP_in) ⟨huP, hu_not_ends⟩ hu_bar + rcases hper with ⟨_, a, b, hP_ab, hd_ab | hd_ba⟩ + · obtain ⟨_, hU_eq⟩ := S.peripheralIntervalSet_eq_interval htrans hcard hP_in hP_ab hd_ab + have hu_ba : u ∈ S.Ω.interval b a := by + rw [← hU_eq] + exact mem_iInter₂.mp hu.2 P ⟨hP_in, hP_in, a, b, hP_ab, Or.inl hd_ab⟩ + rw [hP_ab.1.pathEnds_eq, mem_insert_iff, mem_singleton_iff] at hu_ends + rcases hu_ends with h_eq | h_eq + · rw [h_eq] at hu_ba + exact S.Ω.not_mem_interval_right b a hu_ba + · rw [h_eq] at hu_ba + exact S.Ω.not_mem_interval_left b a hu_ba + · obtain ⟨_, hU_eq⟩ := S.peripheralIntervalSet_eq_interval htrans hcard hP_in (hP_ab.symm S) hd_ba + have hu_ab : u ∈ S.Ω.interval a b := by + rw [← hU_eq] + exact mem_iInter₂.mp hu.2 P ⟨hP_in, hP_in, a, b, hP_ab, Or.inr hd_ba⟩ + rw [hP_ab.1.pathEnds_eq, mem_insert_iff, mem_singleton_iff] at hu_ends + rcases hu_ends with h_eq | h_eq + · rw [h_eq] at hu_ab + exact S.Ω.not_mem_interval_left a b hu_ab + · rw [h_eq] at hu_ab + exact S.Ω.not_mem_interval_right a b hu_ab + +/-- Every transaction `P_set` in `(G, Ω)` can be refined to a transaction `P_set'` of the same +cardinality such that no member of `P_set'` has an internal vertex in `ΩBar` (Graph Minors IX, +Section 6, page 56: +"Let $(A, B)$ be a fence for $\mathcal{P}$, for each $P \in \mathcal{P}$ choose an $A \to B$ +subpath of $P$, and let $\mathcal{P}'$ be the collection of these subpaths. Then +$\mathcal{P}'$ satisfies (a) and (b)"). -/ +theorem exists_transaction_no_internal_in_bar {P_set : Set (Graph α β)} + (htrans : S.IsTransaction P_set) : + ∃ P_set' : Set (Graph α β), + S.IsTransaction P_set' ∧ + P_set'.ncard = P_set.ncard ∧ + ∀ P' ∈ P_set', Disjoint (pathInternalVerts S.G P') S.Ω.bar := by + classical + rcases htrans with ⟨A, B, hdisj, hfence, hends⟩ + have hex_sub : ∀ P : P_set, ∃ Q : Graph α β, + Q ≤ P.1 ∧ ∃ a ∈ A, ∃ b ∈ B, + S.IsOmegaPathWithEnds Q a b ∧ + Disjoint (pathInternalVerts S.G Q) S.Ω.bar := by + intro P + obtain ⟨a₀, ha₀, b₀, hb₀, hP₀⟩ := hends P.1 P.2 + obtain ⟨a, haA, b, hbB, Q, hQP, hQ_ft⟩ := + hP₀.1.exists_isFromToPathWithEnds ha₀ hb₀ + have hab_ne : a ≠ b := fun h => disjoint_left.mp hfence.2.2.1 haA (h ▸ hbB) + have hQ_omega : S.IsOmegaPathWithEnds Q a b := + ⟨hQ_ft.1, hab_ne, hfence.1 haA, hfence.2.1 hbB⟩ + have hno_int : Disjoint (pathInternalVerts S.G Q) S.Ω.bar := by + rw [disjoint_left] + rintro z ⟨hzQ, hz_not_ends⟩ hz_bar + rw [hQ_ft.1.pathEnds_eq, mem_insert_iff, mem_singleton_iff, not_or] at hz_not_ends + rcases (hfence.2.2.2.1.symm ▸ hz_bar : z ∈ A ∪ B) with hzA | hzB + · have : z ∈ V(Q) ∩ A := ⟨hzQ, hzA⟩ + rw [hQ_ft.2.1, mem_singleton_iff] at this + exact hz_not_ends.1 this + · have : z ∈ V(Q) ∩ B := ⟨hzQ, hzB⟩ + rw [hQ_ft.2.2, mem_singleton_iff] at this + exact hz_not_ends.2 this + exact ⟨Q, hQP, a, haA, b, hbB, hQ_omega, hno_int⟩ + choose f hf_le hf_ends using hex_sub + let P_set' : Set (Graph α β) := range f + have hf_inj : Function.Injective f := by + intro P₁ P₂ heq + by_contra hne + obtain ⟨a₁, _, _, _, hQ₁, _⟩ := hf_ends P₁ + have ha₁_Q₂ : a₁ ∈ V(f P₂) := heq ▸ hQ₁.1.left_mem + exact disjoint_left.mp (hdisj.2 P₁.2 P₂.2 (Subtype.ext_iff.not.mp hne)) + ((hf_le P₁).vertexSet_mono hQ₁.1.left_mem) + ((hf_le P₂).vertexSet_mono ha₁_Q₂) + have hcard_eq : P_set'.ncard = P_set.ncard := by + have h_img : P_set' = (fun P : Graph α β => if h : P ∈ P_set then f ⟨P, h⟩ else P) '' P_set + := by + ext Q + simp only [P_set', mem_range, mem_image] + exact ⟨by rintro ⟨⟨P, hP⟩, rfl⟩; exact ⟨P, hP, by simp [hP]⟩, + by rintro ⟨P, hP, rfl⟩; exact ⟨⟨P, hP⟩, by simp [hP]⟩⟩ + rw [h_img] + refine Set.InjOn.ncard_image fun P₁ h₁ P₂ h₂ heq => ?_ + simp only [h₁, h₂, ↓reduceDIte] at heq + exact Subtype.ext_iff.mp (hf_inj heq) + refine ⟨P_set', ⟨A, B, ⟨?_, ?_⟩, hfence, ?_⟩, hcard_eq, ?_⟩ + · rintro Q ⟨P, rfl⟩ + obtain ⟨a, _, b, _, hQ, _⟩ := hf_ends P + exact ⟨a, b, hQ⟩ + · rintro Q₁ ⟨P₁, rfl⟩ Q₂ ⟨P₂, rfl⟩ hne + exact (hdisj.2 P₁.2 P₂.2 (fun h => hne (congrArg f (Subtype.ext h)))).mono + (hf_le P₁).vertexSet_mono (hf_le P₂).vertexSet_mono + · rintro Q ⟨P, rfl⟩ + obtain ⟨a, haA, b, hbB, hQ, _⟩ := hf_ends P + exact ⟨a, haA, b, hbB, hQ⟩ + · rintro Q ⟨P, rfl⟩ + obtain ⟨_, _, _, _, _, hno_int⟩ := hf_ends P + exact hno_int + +/-- If `(G, Ω)` has a transaction of cardinality `3p + 8`, then we may choose a transaction `P_set` +in `(G, Ω)` satisfying `(a)`, `(b)`, and `(c)` (Graph Minors IX, Section 6, page 56: +"We claim that we may choose a transaction $\mathcal{P}$ in $(G, \Omega)$ such that (a) +$|\mathcal{P}| = 3p + 8$ (b) for each $P \in \mathcal{P}$, no internal vertex of $P$ is in +$\bar{\Omega}$, and (c) subject to (a) and (b), $C(\mathcal{P})$ is maximal."). -/ +theorem exists_transaction_with_max_coveredComponentUnion {p : ℕ} + (hex : ∃ P_set₀ : Set (Graph α β), S.IsTransaction P_set₀ ∧ P_set₀.ncard = 3 * p + 8) : + ∃ P_set : Set (Graph α β), + S.IsTransaction P_set ∧ + P_set.ncard = 3 * p + 8 ∧ + (∀ P ∈ P_set, Disjoint (pathInternalVerts S.G P) S.Ω.bar) ∧ + (∀ P_set' : Set (Graph α β), + S.IsTransaction P_set' → + P_set'.ncard = 3 * p + 8 → + (∀ P' ∈ P_set', Disjoint (pathInternalVerts S.G P') S.Ω.bar) → + S.coveredComponentUnion P_set ⊆ S.coveredComponentUnion P_set' → + S.coveredComponentUnion P_set = S.coveredComponentUnion P_set') := by + classical + obtain ⟨P_set₀, htrans₀, hcard₀⟩ := hex + obtain ⟨P_set₁, htrans₁, hcard₁, hno_int₁⟩ := S.exists_transaction_no_internal_in_bar htrans₀ + have hcard₁' : P_set₁.ncard = 3 * p + 8 := hcard₁.trans hcard₀ + let Cand (P_set : Set (Graph α β)) : Prop := + S.IsTransaction P_set ∧ + P_set.ncard = 3 * p + 8 ∧ + ∀ P ∈ P_set, Disjoint (pathInternalVerts S.G P) S.Ω.bar + have hCand₁ : Cand P_set₁ := ⟨htrans₁, hcard₁', hno_int₁⟩ + have hC_sub_V : ∀ P_set, S.coveredComponentUnion P_set ⊆ V(S.G) := fun _ _ hv => hv.1 + have hex_gap : ∃ k : ℕ, ∃ P_set : Set (Graph α β), + Cand P_set ∧ V(S.G).ncard - (S.coveredComponentUnion P_set).ncard = k := + ⟨_, P_set₁, hCand₁, rfl⟩ + let k₀ := Nat.find hex_gap + obtain ⟨P_set, ⟨htrans, hcard, hno_int⟩, hk₀⟩ := Nat.find_spec hex_gap + refine ⟨P_set, htrans, hcard, hno_int, fun P_set' htrans' hcard' hno_int' hsub => ?_⟩ + have hmin : k₀ ≤ V(S.G).ncard - (S.coveredComponentUnion P_set').ncard := + Nat.find_min' hex_gap ⟨P_set', ⟨htrans', hcard', hno_int'⟩, rfl⟩ + have hle_V : (S.coveredComponentUnion P_set').ncard ≤ V(S.G).ncard := + ncard_le_ncard (hC_sub_V P_set') S.finite_V + have hle_C : (S.coveredComponentUnion P_set').ncard ≤ (S.coveredComponentUnion P_set).ncard := by + omega + exact Set.eq_of_subset_of_ncard_le hsub hle_C (S.finite_V.subset (hC_sub_V P_set')) + +/-! ## Connected subgraphs avoiding the separator of a graph separation -/ + +/-- If `(G₁, G₂)` is a separation of `G` and `C ≤ G` is a connected subgraph avoiding `V(G₁) ∩ +V(G₂)` +that meets `V(G₂)`, then `V(C) ⊆ V(G₂) \ V(G₁)` (and in particular `Disjoint V(C) V(G₁)`). -/ +theorem connected_subset_right_of_avoids_inter {G G₁ G₂ C : Graph α β} + (hsep : IsGraphSeparation G G₁ G₂) + (hCG : C ≤ G) + (hconn : IsGraphConnected C) + (hav : Disjoint V(C) (V(G₁) ∩ V(G₂))) + (hne : (V(C) ∩ V(G₂)).Nonempty) : + V(C) ⊆ V(G₂) \ V(G₁) := by + obtain ⟨y₀, hy₀C, hy₀G₂⟩ := hne + have hwalk_in_G₂ : ∀ {u v : α} (W : GraphWalk G u v), + (∀ z ∈ W.support, z ∈ V(C)) → u ∈ V(G₂) → v ∈ V(G₂) := by + intro u v W + induction W with + | nil _ => intro _ hu; exact hu + | @cons x w z e hlink W_tail ih => + intro hsupp hxG₂ + have hxC : x ∈ V(C) := hsupp x List.mem_cons_self + have hx_not_G₁ : x ∉ V(G₁) := + fun hxG₁ => disjoint_left.mp hav hxC ⟨hxG₁, hxG₂⟩ + have he_G₂ : e ∈ E(G₂) := by + rcases hsep.2.2.2.1 ▸ hlink.edge_mem with he₁ | he₂ + · exact (hx_not_G₁ ((hsep.1.isLink_iff he₁).mpr hlink).left_mem).elim + · exact he₂ + have hwG₂ : w ∈ V(G₂) := ((hsep.2.1.isLink_iff he_G₂).mpr hlink).right_mem + exact ih (fun q hq => hsupp q (List.mem_cons_of_mem x hq)) hwG₂ + intro v hvC + obtain ⟨W_C⟩ := hconn.2 y₀ hy₀C v hvC + obtain ⟨W_G, hs_G, _⟩ := exists_walk_up_of_le hCG W_C + have hvG₂ : v ∈ V(G₂) := hwalk_in_G₂ W_G + (fun z hz => W_C.mem_vertexSet_of_mem_support (hs_G ▸ hz)) hy₀G₂ + exact ⟨hvG₂, fun hvG₁ => disjoint_left.mp hav hvC ⟨hvG₁, hvG₂⟩⟩ + +/-- For a separating `Ω`-path `P` with ends `a, b` and no internal vertex in `ΩBar`, there is a +canonical separation `(G₁, G₂)` of `G` with `G₂` minimal such that `V(G₁) ∩ V(G₂) = V(P)`, +`P ≤ G₁`, `Ω(a, b) ⊆ V(G₁)`, `Ω(b, a) ⊆ V(G₂)`, `G₁ = G \ V(H)` is induced, and `Ω(b, a)` catches +`H = G₂ \ V(G₁)` (Graph Minors IX, Section 6, pages 56–57: +"Let $(G_1, G_2)$ be a separation of $G$ with $V(P) = V(G_1 \cap G_2)$, +$\Omega(a, b) \subseteq V(G_1)$ and $\Omega(b, a) \subseteq V(G_2)$, chosen so that $G_2$ is +minimal... Let $H = G_2 \setminus V(G_1)$. By the minimality of $G_2$, $\Omega(b, a)$ catches $H$, +and $G_1$ is an induced subgraph of $G$."). -/ +theorem exists_minimal_separation_of_separating {P : Graph α β} {a b : α} + (hP_ends : S.IsOmegaPathWithEnds P a b) + (hP_sep : S.IsSeparatingOmegaPath P) + (hno_intP : Disjoint (pathInternalVerts S.G P) S.Ω.bar) : + ∃ G₁ G₂ H : Graph α β, + IsGraphSeparation S.G G₁ G₂ ∧ + V(G₁) ∩ V(G₂) = V(P) ∧ + P ≤ G₁ ∧ + S.Ω.interval a b ⊆ V(G₁) ∧ + S.Ω.interval b a ⊆ V(G₂) ∧ + H ≤ S.G ∧ + H = deleteVertices G₂ V(G₁) ∧ + H = deleteVertices S.G V(G₁) ∧ + V(H) = V(S.G) \ V(G₁) ∧ + G₁ = deleteVertices S.G V(H) ∧ + Catches (S.Ω.interval b a) H := by + let K := deleteVertices S.G V(P) + have hKG : K ≤ S.G := deleteVertices_le S.G V(P) + let V_H : Set α := {v ∈ V(K) | ∃ u ∈ S.Ω.interval b a, Nonempty (GraphWalk K v u)} + have hVH_sub_K : V_H ⊆ V(K) := fun _ hv => hv.1 + have hVH_sub_G : V_H ⊆ V(S.G) := fun _ hv => hv.1.1 + have hVP_bar : V(P) ∩ S.Ω.bar = {a, b} := hP_ends.vertexSet_inter_bar_eq S hno_intP + have hab_in_K : S.Ω.interval a b ⊆ V(K) := by + intro s hs + refine ⟨S.bar_subset hs.1.1, fun hsP => ?_⟩ + have hs_ab : s ∈ ({a, b} : Set α) := hVP_bar ▸ ⟨hsP, hs.1.1⟩ + exact hs.1.2 hs_ab + have hba_in_K : S.Ω.interval b a ⊆ V(K) := by + intro t ht + refine ⟨S.bar_subset ht.1.1, fun htP => ?_⟩ + have ht_ab : t ∈ ({a, b} : Set α) := hVP_bar ▸ ⟨htP, ht.1.1⟩ + rw [pair_comm] at ht_ab + exact ht.1.2 ht_ab + have hba_in_VH : S.Ω.interval b a ⊆ V_H := + fun t ht => ⟨hba_in_K ht, t, ht, ⟨.nil (hba_in_K ht)⟩⟩ + -- Show `Disjoint V_H (S.Ω.interval a b)` using `S.IsSeparatingOmegaPath P`. + have hdisj_VH_ab : Disjoint V_H (S.Ω.interval a b) := by + rw [disjoint_left] + rintro s ⟨_, t, ht_ba, ⟨W_K⟩⟩ hs_ab + obtain ⟨W_G, _, _⟩ := exists_walk_up_of_le hKG W_K + obtain ⟨P', hP'_K, _, _⟩ := exists_isGraphPathWithEnds_of_walk W_K + have hP'_G : IsGraphPathWithEnds S.G P' s t := hP'_K.mono hKG + have hst_ne : s ≠ t := + fun h => disjoint_left.mp (S.Ω.disjoint_interval_swap a b) hs_ab (h ▸ ht_ba) + have hP'_omega : S.IsOmegaPathWithEnds P' s t := ⟨hP'_G, hst_ne, hs_ab.1.1, ht_ba.1.1⟩ + have hdisj_P'P : Disjoint V(P') V(P) := by + rw [disjoint_left] + intro z hzP' hzP + exact (hP'_K.le.vertexSet_mono hzP').2 hzP + have hcr : S.Ω.Crosses s t a b := + (S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hs_ab, ht_ba⟩)).symm + exact hP_sep.2 ⟨P', hdisj_P'P, s, t, a, b, hP'_omega, hP_ends, hcr⟩ + -- No edge of `K` joins `V_H` to `V(K) \ V_H`. + have hVH_closed_K : ∀ {e : β} {x y : α}, K.IsLink e x y → x ∈ V_H → y ∈ V_H := by + rintro e x y hxy ⟨_, u, hu_ba, ⟨W_xu⟩⟩ + exact ⟨hxy.right_mem, u, hu_ba, ⟨.cons hxy.symm W_xu⟩⟩ + let H := S.G.induce V_H + let G₁ := deleteVertices S.G V_H + let G₂ := (S.G.induce (V_H ∪ V(P))).restrict (E(S.G) \ E(G₁)) + have hHG : H ≤ S.G := S.G.induce_le hVH_sub_G + have hG₁G : G₁ ≤ S.G := deleteVertices_le S.G V_H + have hG₂G : G₂ ≤ S.G := + restrict_le.trans (S.G.induce_le (union_subset hVH_sub_G hP_ends.1.le.vertexSet_mono)) + have hVG₁ : V(G₁) = V(S.G) \ V_H := rfl + have hVG₂ : V(G₂) = V_H ∪ V(P) := rfl + have hdisj_VH_P : Disjoint V_H V(P) := by + rw [disjoint_left] + exact fun _ hz hzP => hz.1.2 hzP + have hVP_sub_G₁ : V(P) ⊆ V(G₁) := + subset_sdiff.mpr ⟨hP_ends.1.le.vertexSet_mono, hdisj_VH_P.symm⟩ + have hP_G₁ : P ≤ G₁ := le_deleteVertices hP_ends.1.le hdisj_VH_P.symm + have hEG₂ : E(G₂) = E(S.G) \ E(G₁) := by + change E(S.G.induce (V_H ∪ V(P))) ∩ (E(S.G) \ E(G₁)) = E(S.G) \ E(G₁) + rw [inter_eq_right] + rintro e ⟨heG, he_not_G₁⟩ + obtain ⟨x, y, hxy⟩ := S.G.exists_isLink_of_mem_edgeSet heG + have hxy_VH : x ∈ V_H ∨ y ∈ V_H := by + by_contra hnot + push Not at hnot + exact he_not_G₁ ((deleteVertices_isLink S.G V_H).mpr ⟨hxy, hnot.1, hnot.2⟩).edge_mem + refine ⟨x, y, hxy, ?_, ?_⟩ + · rcases hxy_VH with hxVH | hyVH + · exact Or.inl hxVH + · by_cases hxP : x ∈ V(P) + · exact Or.inr hxP + · have hxyK : K.IsLink e y x := + (deleteVertices_isLink S.G V(P)).mpr ⟨hxy.symm, hyVH.1.2, hxP⟩ + exact Or.inl (hVH_closed_K hxyK hyVH) + · rcases hxy_VH with hxVH | hyVH + · by_cases hyP : y ∈ V(P) + · exact Or.inr hyP + · have hxyK : K.IsLink e x y := + (deleteVertices_isLink S.G V(P)).mpr ⟨hxy, hxVH.1.2, hyP⟩ + exact Or.inl (hVH_closed_K hxyK hxVH) + · exact Or.inl hyVH + have hsep : IsGraphSeparation S.G G₁ G₂ := by + refine ⟨hG₁G, hG₂G, ?_, ?_, hEG₂ ▸ disjoint_sdiff_self_right⟩ + · rw [hVG₁, hVG₂] + ext z + simp only [mem_union, mem_sdiff] + constructor + · rintro (⟨hzG, _⟩ | hzVH | hzP) + · exact hzG + · exact hVH_sub_G hzVH + · exact hP_ends.1.le.vertexSet_mono hzP + · intro hzG + by_cases hz : z ∈ V_H + · exact Or.inr (Or.inl hz) + · exact Or.inl ⟨hzG, hz⟩ + · rw [hEG₂] + exact union_sdiff_cancel hG₁G.edgeSet_mono + have hinter : V(G₁) ∩ V(G₂) = V(P) := by + rw [hVG₁, hVG₂] + ext z + simp only [mem_inter_iff, mem_sdiff, mem_union] + constructor + · rintro ⟨⟨_, hz_not⟩, hzVH | hzP⟩ + · exact (hz_not hzVH).elim + · exact hzP + · intro hzP + exact ⟨hVP_sub_G₁ hzP, Or.inr hzP⟩ + have hab_G₁ : S.Ω.interval a b ⊆ V(G₁) := + subset_sdiff.mpr ⟨(S.Ω.interval_subset_bar a b).trans S.bar_subset, hdisj_VH_ab.symm⟩ + have hba_G₂ : S.Ω.interval b a ⊆ V(G₂) := hba_in_VH.trans subset_union_left + have hVH_eq_diff : V_H = V(S.G) \ V(G₁) := by + rw [hVG₁, Set.sdiff_sdiff_right_self, inter_eq_right.mpr hVH_sub_G] + have hH_del_G : H = deleteVertices S.G V(G₁) := by + change S.G.induce V_H = S.G.induce (V(S.G) \ V(G₁)) + rw [hVH_eq_diff] + have hH_del_G₂ : H = deleteVertices G₂ V(G₁) := by + refine (Compatible.of_le_le hHG ((deleteVertices_le G₂ V(G₁)).trans hG₂G)).ext ?_ ?_ + · change V_H = (V_H ∪ V(P)) \ V(G₁) + ext z + simp only [mem_sdiff, mem_union] + constructor + · intro hz + exact ⟨Or.inl hz, fun hzG₁ => hzG₁.2 hz⟩ + · rintro ⟨hzVH | hzP, hz_not_G₁⟩ + · exact hzVH + · exact (hz_not_G₁ (hVP_sub_G₁ hzP)).elim + · apply Subset.antisymm + · intro e heH + obtain ⟨x, y, hxy, hxVH, hyVH⟩ := heH + have he_not_G₁ : e ∉ E(G₁) := by + rintro ⟨x', y', hxy', hx'G₁, hy'G₁⟩ + rcases hxy.left_eq_or_eq hxy' with rfl | rfl + · exact hx'G₁.2 hxVH + · exact hy'G₁.2 hxVH + have hxyG₂ : G₂.IsLink e x y := + (hG₂G.isLink_iff (by rw [hEG₂]; exact ⟨hxy.edge_mem, he_not_G₁⟩)).mpr hxy + exact ((deleteVertices_isLink G₂ V(G₁)).mpr + ⟨hxyG₂, fun h => h.2 hxVH, fun h => h.2 hyVH⟩).edge_mem + · intro e he_del + obtain ⟨x, y, hxy⟩ := (deleteVertices G₂ V(G₁)).exists_isLink_of_mem_edgeSet he_del + rw [deleteVertices_isLink] at hxy + have hxyG : S.G.IsLink e x y := hxy.1.mono hG₂G + have hxVH : x ∈ V_H := by + rcases hxy.1.left_mem with hx | hxP + · exact hx + · exact (hxy.2.1 (hVP_sub_G₁ hxP)).elim + have hyVH : y ∈ V_H := by + rcases hxy.1.right_mem with hy | hyP + · exact hy + · exact (hxy.2.2 (hVP_sub_G₁ hyP)).elim + exact ⟨x, y, hxyG, hxVH, hyVH⟩ + -- Prove `Catches (S.Ω.interval b a) H`. + have hcatch_H : Catches (S.Ω.interval b a) H := by + refine ⟨hba_in_VH, fun D hD => ?_⟩ + obtain ⟨v₀, hv₀D⟩ := hD.2.1.1 + have hv₀_VH : v₀ ∈ V_H := hD.1.vertexSet_mono hv₀D + rcases hv₀_VH with ⟨_, u₀, hu₀_ba, ⟨W_K⟩⟩ + -- Every vertex of `W_K.support` is in `V_H = V(H)` and every edge of `W_K.edges` is in `E(H)`. + have hsupp_VH : ∀ z ∈ W_K.support, z ∈ V_H := by + have hwalk : ∀ {p q : α} (W : GraphWalk K p q), q ∈ V_H → ∀ z ∈ W.support, z ∈ V_H := by + intro p q W + induction W with + | nil _ => + intro hq z hz + simp only [GraphWalk.support_nil, List.mem_singleton] at hz + exact hz ▸ hq + | @cons x y w e hlink W_tail ih => + intro hw z hz + have hy_VH : y ∈ V_H := ih hw y W_tail.start_mem_support + have hx_VH : x ∈ V_H := hVH_closed_K hlink.symm hy_VH + rcases List.mem_cons.mp hz with rfl | hz_tail + · exact hx_VH + · exact ih hw z hz_tail + exact hwalk W_K (hba_in_VH hu₀_ba) + obtain ⟨W_G, hs_G, he_G⟩ := exists_walk_up_of_le hKG W_K + have hedges_H : ∀ e ∈ W_G.edges, e ∈ E(H) := by + intro e he + have heK : e ∈ E(K) := walk_edges_subset_edgeSet W_K e (he_G ▸ he) + obtain ⟨x, y, hxyK⟩ := K.exists_isLink_of_mem_edgeSet heK + have hhm := walk_isLink_mem_support W_K (he_G ▸ he) hxyK + exact ⟨x, y, hxyK.mono hKG, hsupp_VH x hhm.1, hsupp_VH y hhm.2⟩ + obtain ⟨W_H, _, _⟩ := exists_walk_down_of_le hHG W_G + (fun z hz => hsupp_VH z (hs_G ▸ hz)) hedges_H + -- Since `W_H` is a walk in `H` from `v₀ ∈ V(D)` to `u₀`, `u₀ ∈ V(D)`. + have hwalk_D : ∀ {p q : α} (W : GraphWalk H p q), p ∈ V(D) → q ∈ V(D) := by + intro p q W + induction W with + | nil _ => intro hp; exact hp + | @cons x y w e hlink W_tail ih => + intro hxD + exact ih ((mem_graphComponent_iff_of_isLink hD hlink).mp hxD) + exact ⟨u₀, hu₀_ba, hwalk_D W_H hv₀D⟩ + exact ⟨G₁, G₂, H, hsep, hinter, hP_G₁, hab_G₁, hba_G₂, hHG, hH_del_G₂, hH_del_G, + hVH_eq_diff, rfl, hcatch_H⟩ + +/-! ## Claims (5)–(9) (pages 55–57) -/ + +/-- **Graph Minors IX, (6.1), Claim (5)** (page 56): +"If $P'$ is an $\Omega$-path with $P' \subseteq G_1$, then $C(\mathcal{P}) \subseteq +C((\mathcal{P} - \{P\}) \cup \{P'\})$." -/ +theorem lemma_6_1_claim_5 {P_set : Set (Graph α β)} {P P' G₁ G₂ : Graph α β} {a b : α} + (htrans : S.IsTransaction P_set) + (hcard : 2 ≤ P_set.ncard) + (hP_in : P ∈ P_set) + (hP_ends : S.IsOmegaPathWithEnds P a b) + (hd_ab : Disjoint (S.Ω.interval a b) (S.transactionEnds P_set)) + (hsep : IsGraphSeparation S.G G₁ G₂) + (hinter : V(G₁) ∩ V(G₂) = V(P)) + (hba_G₂ : S.Ω.interval b a ⊆ V(G₂)) + (hP'_le : P' ≤ G₁) + (hU_sub : S.transactionPeripheralUnion P_set ⊆ + S.transactionPeripheralUnion ((P_set \ {P}) ∪ {P'})) + (hper_sub : ∀ R ∈ (P_set \ {P}) ∪ {P'}, + S.IsPeripheralIn ((P_set \ {P}) ∪ {P'}) R → R = P' ∨ S.IsPeripheralIn P_set R) : + S.coveredComponentUnion P_set ⊆ S.coveredComponentUnion ((P_set \ {P}) ∪ {P'}) := by + have hperP : S.IsPeripheralIn P_set P := ⟨hP_in, a, b, hP_ends, Or.inl hd_ab⟩ + obtain ⟨_, hU_P⟩ := S.peripheralIntervalSet_eq_interval htrans hcard hP_in hP_ends hd_ab + have hU_sub_ba : S.transactionPeripheralUnion P_set ⊆ S.Ω.interval b a := by + intro u hu + rw [← hU_P] + exact mem_iInter₂.mp hu.2 P ⟨hP_in, hperP⟩ + intro v ⟨hvG, u, huU, Q, hQ, hav⟩ + have hu_G₂ : u ∈ V(G₂) := hba_G₂ (hU_sub_ba huU) + have hav_P : Disjoint V(Q) (V(G₁) ∩ V(G₂)) := by + rw [hinter] + exact (hav P hP_in hperP).symm + have hVQ_sub : V(Q) ⊆ V(G₂) \ V(G₁) := + connected_subset_right_of_avoids_inter hsep hQ.le hQ.isGraphConnected hav_P + ⟨u, hQ.right_mem, hu_G₂⟩ + have hav_P' : Avoids Q V(P') := by + rw [Avoids, disjoint_left] + intro z hzP' hzQ + exact (hVQ_sub hzQ).2 (hP'_le.vertexSet_mono hzP') + refine ⟨hvG, u, hU_sub huU, Q, hQ, fun R hR_in hperR => ?_⟩ + rcases hper_sub R hR_in hperR with rfl | hperR_old + · exact hav_P' + · exact hav R hperR_old.1 hperR_old + +/-- Under the separation `(G₁, G₂)` of `S.G` with `V(G₁) ∩ V(G₂) = V(P)` and +`Disjoint (S.Ω.interval a b) (S.transactionEnds P_set)`, every member `R ∈ P_set \ {P}` has both +ends in `S.Ω.interval b a` and satisfies `V(R) ⊆ V(G₂) \ V(G₁)`. -/ +theorem sdiff_singleton_subset_right_of_separation {P_set : Set (Graph α β)} + {P G₁ G₂ R : Graph α β} {a b a_R b_R : α} + (htrans : S.IsTransaction P_set) + (hP_in : P ∈ P_set) + (hP_ends : S.IsOmegaPathWithEnds P a b) + (hd_ab : Disjoint (S.Ω.interval a b) (S.transactionEnds P_set)) + (hsep : IsGraphSeparation S.G G₁ G₂) + (hinter : V(G₁) ∩ V(G₂) = V(P)) + (hba_G₂ : S.Ω.interval b a ⊆ V(G₂)) + (hR : R ∈ P_set \ {P}) + (hR_ends : S.IsOmegaPathWithEnds R a_R b_R) : + a_R ∈ S.Ω.interval b a ∧ b_R ∈ S.Ω.interval b a ∧ V(R) ⊆ V(G₂) \ V(G₁) := by + obtain ⟨_, _, hfence⟩ := htrans + have hdisj_RP : Disjoint V(R) V(P) := hfence.1.2 hR.1 hP_in hR.2 + have ha_ne_a : a_R ≠ a := + fun h => disjoint_left.mp hdisj_RP hR_ends.1.left_mem (h ▸ hP_ends.1.left_mem) + have ha_ne_b : a_R ≠ b := + fun h => disjoint_left.mp hdisj_RP hR_ends.1.left_mem (h ▸ hP_ends.1.right_mem) + have hb_ne_a : b_R ≠ a := + fun h => disjoint_left.mp hdisj_RP hR_ends.1.right_mem (h ▸ hP_ends.1.left_mem) + have hb_ne_b : b_R ≠ b := + fun h => disjoint_left.mp hdisj_RP hR_ends.1.right_mem (h ▸ hP_ends.1.right_mem) + have ha_W : a_R ∈ S.transactionEnds P_set := hR_ends.mem_transactionEnds_left S hR.1 + have hb_W : b_R ∈ S.transactionEnds P_set := hR_ends.mem_transactionEnds_right S hR.1 + have ha_ba : a_R ∈ S.Ω.interval b a := + (S.Ω.mem_interval_or_interval_swap hP_ends.2.2.1 hP_ends.2.2.2 hR_ends.2.2.1 + hP_ends.2.1 ha_ne_a ha_ne_b).resolve_left (fun h => disjoint_left.mp hd_ab h ha_W) + have hb_ba : b_R ∈ S.Ω.interval b a := + (S.Ω.mem_interval_or_interval_swap hP_ends.2.2.1 hP_ends.2.2.2 hR_ends.2.2.2 + hP_ends.2.1 hb_ne_a hb_ne_b).resolve_left (fun h => disjoint_left.mp hd_ab h hb_W) + have hav_inter : Disjoint V(R) (V(G₁) ∩ V(G₂)) := hinter ▸ hdisj_RP + have hVR : V(R) ⊆ V(G₂) \ V(G₁) := + connected_subset_right_of_avoids_inter hsep hR_ends.1.le hR_ends.1.isGraphConnected hav_inter + ⟨a_R, hR_ends.1.left_mem, hba_G₂ ha_ba⟩ + exact ⟨ha_ba, hb_ba, hVR⟩ + +private theorem preservePeripheralIntervals + {S : Society α β} {P_set : Set (Graph α β)} {P : Graph α β} {a b : α} (hP_in : P ∈ P_set) + (hP_ends : S.IsOmegaPathWithEnds P a b) (htrans_orig : S.IsTransaction P_set) {A B : Set α} + (hfence : S.IsFenceFor P_set A B) {P'' : Graph α β} {u₀ v₀ : α} + (hW'_bar : (S.transactionEnds (P_set \ {P})) ⊆ S.Ω.bar) {a'_0 : α} + (ha'_0 : a'_0 ∈ A ∩ (S.transactionEnds (P_set \ {P}))) {b_0 : α} + (hb_0 : b_0 ∈ B ∩ (S.transactionEnds (P_set \ {P}))) + (hd'_ab : Disjoint (S.Ω.interval a'_0 b_0) (S.transactionEnds (P_set \ {P}))) {b'_0 : α} + (hb'_0 : b'_0 ∈ B ∩ (S.transactionEnds (P_set \ {P}))) {a_0 : α} + (ha_0 : a_0 ∈ A ∩ (S.transactionEnds (P_set \ {P}))) + (hd'_ba : Disjoint (S.Ω.interval b'_0 a_0) (S.transactionEnds (P_set \ {P}))) + (hI_sub_G₁ : {a, b} ∪ S.Ω.interval a b ⊆ S.Ω.interval a'_0 b_0) + (hu₀_G₁ : u₀ ∈ S.Ω.interval a'_0 b_0) + (hG₂_sub_b'a' : S.Ω.interval b'_0 a_0 ⊆ S.Ω.interval b'_0 a'_0) + (hG₁_sub_a'b' : S.Ω.interval a'_0 b_0 ⊆ S.Ω.interval a'_0 b'_0) + (hdisj_P_arcs : Disjoint ({a'_0} ∪ S.Ω.interval b'_0 a'_0) ({b'_0} ∪ S.Ω.interval a'_0 b'_0)) + (hfence_f : S.Ω.IsFence (S.Ω.interval b'_0 v₀) ({b'_0, v₀} ∪ S.Ω.interval v₀ b'_0)) + (hA_W'_Af : A ∩ (S.transactionEnds (P_set \ {P})) ⊆ (S.Ω.interval b'_0 v₀)) + (hB_W'_Bf : B ∩ (S.transactionEnds (P_set \ {P})) ⊆ ({b'_0, v₀} ∪ S.Ω.interval v₀ b'_0)) + (hu₀_Af : u₀ ∈ (S.Ω.interval b'_0 v₀)) (hv₀_Bf : v₀ ∈ ({b'_0, v₀} ∪ S.Ω.interval v₀ b'_0)) + (htrans' : S.IsTransaction (P_set \ {P} ∪ {P''})) (hcard_ge2 : 2 ≤ P_set.ncard) + (hcard'_ge2 : 2 ≤ (P_set \ {P} ∪ {P''}).ncard) + (hW_new_bar : (S.transactionEnds (P_set \ {P} ∪ {P''})) ⊆ S.Ω.bar) + (hW_new_eq : (S.transactionEnds (P_set \ {P} ∪ {P''})) = (S.transactionEnds (P_set \ {P})) ∪ + {u₀, v₀}) + (hd_uv_new : Disjoint (S.Ω.interval u₀ v₀) (S.transactionEnds (P_set \ {P} ∪ {P''}))) + {R : Graph α β} (hR : R ∈ P_set \ {P}) (hperR' : S.IsPeripheralIn (P_set \ {P} ∪ {P''}) R) : + S.IsPeripheralIn P_set R ∧ S.peripheralIntervalSet (P_set \ {P} ∪ {P''}) R = + S.peripheralIntervalSet P_set R ∧ S.Ω.interval a'_0 b_0 ⊆ S.peripheralIntervalSet (P_set \ + {P} ∪ {P''}) R := by + classical + let W := S.transactionEnds P_set + let W' := S.transactionEnds (P_set \ {P}) + let A_f := S.Ω.interval b'_0 v₀ + let B_f := {b'_0, v₀} ∪ S.Ω.interval v₀ b'_0 + let P_set' := P_set \ {P} ∪ {P''} + let W_new := S.transactionEnds P_set' + have hW_eq : W_new = W' ∪ {u₀, v₀} := hW_new_eq + obtain ⟨a_R, ha_R_A, b_R, hb_R_B, hR_ends⟩ := hfence.2.2 R hR.1 + have ha_R_W' : a_R ∈ A ∩ W' := ⟨ha_R_A, hR_ends.mem_transactionEnds_left S hR⟩ + have hb_R_W' : b_R ∈ B ∩ W' := ⟨hb_R_B, hR_ends.mem_transactionEnds_right S hR⟩ + have ha_R_Af : a_R ∈ A_f ∩ W_new := ⟨hA_W'_Af ha_R_W', hW_eq ▸ Or.inl ha_R_W'.2⟩ + have hb_R_Bf : b_R ∈ B_f ∩ W_new := ⟨hB_W'_Bf hb_R_W', hW_eq ▸ Or.inl hb_R_W'.2⟩ + have hu₀_Af_W : u₀ ∈ A_f ∩ W_new := ⟨hu₀_Af, hW_eq ▸ Or.inr (Or.inl rfl)⟩ + have hv₀_Bf_W : v₀ ∈ B_f ∩ W_new := ⟨hv₀_Bf, hW_eq ▸ Or.inr (Or.inr rfl)⟩ + have hd_ba_R_new : Disjoint (S.Ω.interval b_R a_R) W_new := by + rcases (hR_ends.isPeripheralIn_iff S (Or.inl hR)).mp hperR' with hd_ab_R | hd_ba_R + · exfalso + have hu₀_eq : u₀ = a_R := + (S.Ω.unique_empty_interval_AB_of_isFence hfence_f hW_new_bar + hu₀_Af_W hv₀_Bf_W ha_R_Af hb_R_Bf hd_uv_new hd_ab_R).1 + exact disjoint_left.mp hd'_ab hu₀_G₁ (hu₀_eq ▸ ha_R_W'.2) + · exact hd_ba_R + have hd_ba_R_W' : Disjoint (S.Ω.interval b_R a_R) W' := + hd_ba_R_new.mono_right (hW_eq ▸ subset_union_left) + obtain ⟨rfl, rfl⟩ := + S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1.symm hW'_bar + hb'_0 ha_0 hb_R_W' ha_R_W' hd'_ba hd_ba_R_W' + have hdisj_G₂_G₁ : Disjoint (S.Ω.interval b'_0 a_0) (S.Ω.interval a'_0 b_0) := + (disjoint_union_left.mp (disjoint_union_right.mp hdisj_P_arcs).2).2.mono + hG₂_sub_b'a' hG₁_sub_a'b' + have hd_ba_W : Disjoint (S.Ω.interval b'_0 a_0) W := by + have hW_union : W = W' ∪ {a, b} := hfence.transactionEnds_eq_union S hP_in hP_ends + rw [hW_union, disjoint_union_right] + refine ⟨hd'_ba, disjoint_left.mpr fun z hz hab => ?_⟩ + exact disjoint_left.mp hdisj_G₂_G₁ hz (hI_sub_G₁ (Or.inl hab)) + have hperR_old : S.IsPeripheralIn P_set R := + ⟨hR.1, a_0, b'_0, hR_ends, Or.inr hd_ba_W⟩ + have hU'_R : S.peripheralIntervalSet P_set' R = S.Ω.interval a_0 b'_0 := + (S.peripheralIntervalSet_eq_interval htrans' hcard'_ge2 (Or.inl hR) + (hR_ends.symm S) hd_ba_R_new).2 + have hU_R : S.peripheralIntervalSet P_set R = S.Ω.interval a_0 b'_0 := + (S.peripheralIntervalSet_eq_interval htrans_orig hcard_ge2 hR.1 + (hR_ends.symm S) hd_ba_W).2 + have hG₁_sub_U' : S.Ω.interval a'_0 b_0 ⊆ S.peripheralIntervalSet P_set' R := by + rw [hU'_R] + exact S.Ω.interval_subset_of_disjoint_AB hfence.2.1 hW'_bar ha'_0 hb_0 hd'_ab ha_0 hb'_0 + exact ⟨hperR_old, hU'_R.trans hU_R.symm, hG₁_sub_U'⟩ + +private theorem replacePathWithOrderedEnds + {S : Society α β} (p : ℕ) {P_set : Set (Graph α β)} {P P' G₁ G₂ : Graph α β} {a b : α} + (hcard : P_set.ncard = 3 * p + 8) + (hno_int : ∀ R ∈ P_set, Disjoint (pathInternalVerts S.G R) S.Ω.bar) (hP_in : P ∈ P_set) + (hP_ends : S.IsOmegaPathWithEnds P a b) + (hd_ab : Disjoint (S.Ω.interval a b) (S.transactionEnds P_set)) + (hsep : IsGraphSeparation S.G G₁ G₂) (hinter : V(G₁) ∩ V(G₂) = V(P)) + (hab_G₁ : S.Ω.interval a b ⊆ V(G₁)) (hba_G₂ : S.Ω.interval b a ⊆ V(G₂)) + (htrans_orig : S.IsTransaction P_set) {A B : Set α} (hfence : S.IsFenceFor P_set A B) + (haA : a ∈ A) (hbB : b ∈ B) {P'' : Graph α β} (hP''_le_P' : P'' ≤ P') (hP''_le_G₁ : P'' ≤ G₁) + (hno_int_P'' : Disjoint (pathInternalVerts S.G P'') S.Ω.bar) {u₀ v₀ x₀ : α} + (hP''_uv : S.IsOmegaPathWithEnds P'' u₀ v₀) (hu₀_av₀ : u₀ ∈ {a} ∪ S.Ω.interval a v₀) + (hu₀_ab : u₀ ∈ {a, b} ∪ S.Ω.interval a b) (hv₀_ab : v₀ ∈ {a, b} ∪ S.Ω.interval a b) + (hx₀_ab : x₀ ∈ ({a, b} : Set α)) (hx₀_vu : x₀ ∈ S.Ω.interval v₀ u₀) + (huv_sub_ab : S.Ω.interval u₀ v₀ ⊆ S.Ω.interval a b) + (hba_sub_vu : S.Ω.interval b a ⊆ S.Ω.interval v₀ u₀) : + ∃ P'' : Graph α β, P'' ≤ P' ∧ S.IsTransaction (P_set \ {P} ∪ {P''}) ∧ + (P_set \ {P} ∪ {P''}).ncard = 3 * p + 8 ∧ + (∀ R ∈ P_set \ {P} ∪ {P''}, Disjoint (pathInternalVerts S.G R) S.Ω.bar) ∧ + S.coveredComponentUnion P_set ⊆ S.coveredComponentUnion (P_set \ {P} ∪ {P''}) ∧ ({a, b} ∩ + S.transactionPeripheralUnion (P_set \ {P} ∪ {P''})).Nonempty := by + classical + let W := S.transactionEnds P_set + let W' := S.transactionEnds (P_set \ {P}) + have hW_bar : W ⊆ S.Ω.bar := S.transactionEnds_subset_bar P_set + have hW'_bar : W' ⊆ S.Ω.bar := S.transactionEnds_subset_bar (P_set \ {P}) + have hW'_eq : W' = W \ {a, b} := S.transactionEnds_diff_singleton hfence.1 hP_in hP_ends + have hW'_sub : W' ⊆ W := hW'_eq ▸ sdiff_subset + have haW : a ∈ A ∩ W := ⟨haA, hP_ends.mem_transactionEnds_left S hP_in⟩ + have hbW : b ∈ B ∩ W := ⟨hbB, hP_ends.mem_transactionEnds_right S hP_in⟩ + have hfin_P : P_set.Finite := hfence.1.finite S + have hne_diff : (P_set \ {P}).Nonempty := by + rw [← ncard_pos hfin_P.sdiff, ncard_sdiff_singleton_of_mem hP_in] + omega + obtain ⟨R₀, hR₀_diff⟩ := hne_diff + obtain ⟨a_R₀, ha_R₀_A, b_R₀, hb_R₀_B, hR₀_ends⟩ := hfence.2.2 R₀ hR₀_diff.1 + have ha_R₀_W' : a_R₀ ∈ A ∩ W' := ⟨ha_R₀_A, hR₀_ends.mem_transactionEnds_left S hR₀_diff⟩ + have hb_R₀_W' : b_R₀ ∈ B ∩ W' := ⟨hb_R₀_B, hR₀_ends.mem_transactionEnds_right S hR₀_diff⟩ + have hW'_AB : W' ⊆ A ∪ B := hfence.2.1.2.2.2.1 ▸ hW'_bar + have hW'_BA : W' ⊆ B ∪ A := union_comm A B ▸ hW'_AB + obtain ⟨a'_0, ha'_0, b_0, hb_0, hd'_ab⟩ := + S.Ω.exists_empty_interval_AB_of_subset_union hW'_bar hW'_AB ⟨a_R₀, ha_R₀_W'⟩ ⟨b_R₀, hb_R₀_W'⟩ + obtain ⟨b'_0, hb'_0, a_0, ha_0, hd'_ba⟩ := + S.Ω.exists_empty_interval_AB_of_subset_union hW'_bar hW'_BA ⟨b_R₀, hb_R₀_W'⟩ ⟨a_R₀, ha_R₀_W'⟩ + -- Show `{a, b} ∪ S.Ω.interval a b ⊆ S.Ω.interval a'_0 b_0`. + have ha'_0_W : a'_0 ∈ A ∩ W := ⟨ha'_0.1, hW'_sub ha'_0.2⟩ + have hb_0_W : b_0 ∈ B ∩ W := ⟨hb_0.1, hW'_sub hb_0.2⟩ + have ha'_0_ne_a : a'_0 ≠ a := fun h => (hW'_eq ▸ ha'_0.2).2 (Or.inl h) + have hb_0_ne_b : b_0 ≠ b := fun h => (hW'_eq ▸ hb_0.2).2 (Or.inr h) + have hb_in_G₁ : b ∈ S.Ω.interval a'_0 b_0 := + (S.Ω.mem_interval_of_mem_B_of_disjoint_AB hfence.2.1 hW_bar haW hbW hd_ab + ha'_0_W hb_0_W hb_0_ne_b).1 + have ha_b_a' : a ∈ S.Ω.interval a'_0 b ∧ b ∈ S.Ω.interval a a'_0 := + S.Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.2.1 hW_bar haW hbW hd_ab + ha'_0_W ha'_0_ne_a hbW + have ha_in_G₁ : a ∈ S.Ω.interval a'_0 b_0 := + S.Ω.interval_subset_interval_left hb_in_G₁ ha_b_a'.1 + have hab_sub_G₁ : S.Ω.interval a b ⊆ S.Ω.interval a'_0 b_0 := + S.Ω.interval_subset_of_disjoint_AB hfence.2.1 hW_bar haW hbW hd_ab ha'_0_W hb_0_W + have hI_sub_G₁ : ({a, b} : Set α) ∪ S.Ω.interval a b ⊆ S.Ω.interval a'_0 b_0 := by + rintro z ((rfl | rfl) | hz) + · exact ha_in_G₁ + · exact hb_in_G₁ + · exact hab_sub_G₁ hz + have hu₀_G₁ : u₀ ∈ S.Ω.interval a'_0 b_0 := hI_sub_G₁ hu₀_ab + have hv₀_G₁ : v₀ ∈ S.Ω.interval a'_0 b_0 := hI_sub_G₁ hv₀_ab + have ha_in_a'v₀ : a ∈ S.Ω.interval a'_0 v₀ := by + rcases hv₀_ab with (rfl | rfl) | hv₀_in + · exfalso + rcases hu₀_av₀ with rfl | hu₀_in + · exact hP''_uv.2.1 rfl + · exact (S.Ω.isClockwise3_iff.mp hu₀_in.2).2.1 rfl + · exact ha_b_a'.1 + · exact S.Ω.mem_interval_rotate_right + (S.Ω.interval_subset_interval_left ha_b_a'.2 hv₀_in) + have hu₀_a'v₀ : u₀ ∈ S.Ω.interval a'_0 v₀ := by + rcases hu₀_av₀ with rfl | hu₀_in + · exact ha_in_a'v₀ + · exact S.Ω.interval_subset_interval_right ha_in_a'v₀ hu₀_in + -- Apply `four_arc_partition` and construct the fence `(A_f, B_f)` cutting `G₁` at `v₀`. + obtain ⟨hA_sub_arc, hB_sub_arc, hG₂_sub_b'a', hG₁_sub_a'b', hdisj_P_arcs, _⟩ := + four_arc_partition hfence.2.1 hW'_bar ha_0 ha'_0 hb_0 hb'_0 hd'_ab hd'_ba + let A_f : Set α := S.Ω.interval b'_0 v₀ + let B_f : Set α := {b'_0, v₀} ∪ S.Ω.interval v₀ b'_0 + have hb'_0_bar : b'_0 ∈ S.Ω.bar := hW'_bar hb'_0.2 + have hv₀_a'b' : v₀ ∈ S.Ω.interval a'_0 b'_0 := hG₁_sub_a'b' hv₀_G₁ + have hv₀_ne_b' : v₀ ≠ b'_0 := fun h => S.Ω.not_mem_interval_right a'_0 b'_0 (h ▸ hv₀_a'b') + have ha'_in_b'v₀ : a'_0 ∈ S.Ω.interval b'_0 v₀ := S.Ω.mem_interval_rotate_right hv₀_a'b' + have hfence_f : S.Ω.IsFence A_f B_f := by + unfold A_f B_f + exact pair_comm v₀ b'_0 ▸ (S.Ω.isFence_interval_compl hP''_uv.2.2.2 hb'_0_bar hv₀_ne_b').symm + have hA_W'_Af : A ∩ W' ⊆ A_f := by + intro z hz + rcases (hA_sub_arc hz).1 with rfl | hz_in + · exact ha'_in_b'v₀ + · exact S.Ω.interval_subset_interval_left ha'_in_b'v₀ hz_in + have hB_W'_Bf : B ∩ W' ⊆ B_f := by + intro y hy + rcases hB_sub_arc hy with ⟨rfl | hy_in, hy_not_G₁⟩ + · exact Or.inl (Or.inl rfl) + · rw [S.Ω.interval_eq_union_of_mem hv₀_a'b'] at hy_in + rcases hy_in with (hy_a'v₀ | rfl) | hy_v₀b' + · exact (hy_not_G₁ (S.Ω.interval_subset_interval_left hv₀_G₁ hy_a'v₀)).elim + · exact Or.inl (Or.inr rfl) + · exact Or.inr hy_v₀b' + have hu₀_Af : u₀ ∈ A_f := S.Ω.interval_subset_interval_right ha'_in_b'v₀ hu₀_a'v₀ + have hv₀_Bf : v₀ ∈ B_f := Or.inl (Or.inr rfl) + -- Vertex-disjointness of `P''` from `P_set \ {P}` and fence for `P_set' := (P_set \ {P}) ∪ + -- {P''}`. + let P_set' := (P_set \ {P}) ∪ {P''} + have hdisj_RP'' : ∀ R ∈ P_set \ {P}, Disjoint V(R) V(P'') := by + intro R hR + obtain ⟨a_R, _, b_R, _, hR_ends⟩ := hfence.2.2 R hR.1 + obtain ⟨_, _, hVR⟩ := S.sdiff_singleton_subset_right_of_separation htrans_orig hP_in hP_ends + hd_ab hsep hinter hba_G₂ hR hR_ends + rw [disjoint_left] + intro z hzR hzP'' + exact (hVR hzR).2 (hP''_le_G₁.vertexSet_mono hzP'') + have hP''_not_in : P'' ∉ P_set \ {P} := + fun h_in => disjoint_left.mp (hdisj_RP'' P'' h_in) hP''_uv.1.left_mem hP''_uv.1.left_mem + have hfence' : S.IsFenceFor P_set' A_f B_f := by + refine ⟨⟨?_, ?_⟩, hfence_f, ?_⟩ + · rintro R (hR | rfl) + · exact hfence.1.1 R hR.1 + · exact ⟨u₀, v₀, hP''_uv⟩ + · rintro R₁ (hR₁ | rfl) R₂ (hR₂ | rfl) hne + · exact hfence.1.2 hR₁.1 hR₂.1 hne + · exact hdisj_RP'' R₁ hR₁ + · exact (hdisj_RP'' R₂ hR₂).symm + · exact (hne rfl).elim + · rintro R (hR | rfl) + · obtain ⟨a_R, ha_R_A, b_R, hb_R_B, hR_ends⟩ := hfence.2.2 R hR.1 + exact ⟨a_R, hA_W'_Af ⟨ha_R_A, hR_ends.mem_transactionEnds_left S hR⟩, + b_R, hB_W'_Bf ⟨hb_R_B, hR_ends.mem_transactionEnds_right S hR⟩, hR_ends⟩ + · exact ⟨u₀, hu₀_Af, v₀, hv₀_Bf, hP''_uv⟩ + have htrans' : S.IsTransaction P_set' := ⟨A_f, B_f, hfence'⟩ + have hcard' : P_set'.ncard = 3 * p + 8 := by + change ((P_set \ {P}) ∪ {P''}).ncard = 3 * p + 8 + rw [union_singleton, ncard_insert_of_notMem hP''_not_in hfin_P.sdiff, + ncard_sdiff_singleton_of_mem hP_in] + omega + have hcard_ge2 : 2 ≤ P_set.ncard := by omega + have hcard'_ge2 : 2 ≤ P_set'.ncard := by omega + have hno_int' : ∀ R ∈ P_set', Disjoint (pathInternalVerts S.G R) S.Ω.bar := by + rintro R (hR | rfl) + · exact hno_int R hR.1 + · exact hno_int_P'' + -- Analyze `W_new := S.transactionEnds P_set'` and the peripheral members of `P_set'`. + let W_new := S.transactionEnds P_set' + have hW_new_bar : W_new ⊆ S.Ω.bar := S.transactionEnds_subset_bar P_set' + have hW_new_eq : W_new = W' ∪ {u₀, v₀} := S.transactionEnds_insert (P_set \ {P}) hP''_uv + have hd_uv_new : Disjoint (S.Ω.interval u₀ v₀) W_new := by + rw [hW_new_eq, disjoint_union_right] + refine ⟨hd'_ab.mono_left (huv_sub_ab.trans hab_sub_G₁), disjoint_left.mpr ?_⟩ + rintro z hz (rfl | rfl) + · exact S.Ω.not_mem_interval_left z v₀ hz + · exact S.Ω.not_mem_interval_right u₀ z hz + have hU_P'' : S.peripheralIntervalSet P_set' P'' = S.Ω.interval v₀ u₀ := + (S.peripheralIntervalSet_eq_interval htrans' hcard'_ge2 (Or.inr rfl) hP''_uv hd_uv_new).2 + have hU_P : S.peripheralIntervalSet P_set P = S.Ω.interval b a := + (S.peripheralIntervalSet_eq_interval htrans_orig hcard_ge2 hP_in hP_ends hd_ab).2 + have hper_other : ∀ R ∈ P_set \ {P}, S.IsPeripheralIn P_set' R → + S.IsPeripheralIn P_set R ∧ + S.peripheralIntervalSet P_set' R = S.peripheralIntervalSet P_set R ∧ + S.Ω.interval a'_0 b_0 ⊆ S.peripheralIntervalSet P_set' R := by + intro R hR hperR' + exact preservePeripheralIntervals hP_in hP_ends htrans_orig hfence hW'_bar ha'_0 hb_0 hd'_ab + hb'_0 ha_0 hd'_ba hI_sub_G₁ hu₀_G₁ hG₂_sub_b'a' hG₁_sub_a'b' hdisj_P_arcs hfence_f hA_W'_Af + hB_W'_Bf hu₀_Af hv₀_Bf htrans' hcard_ge2 hcard'_ge2 hW_new_bar hW_new_eq hd_uv_new hR hperR' + have hper_sub : ∀ R ∈ P_set', S.IsPeripheralIn P_set' R → R = P'' ∨ S.IsPeripheralIn P_set R := by + rintro R (hR | rfl) hperR' + · exact Or.inr (hper_other R hR hperR').1 + · exact Or.inl rfl + have hper_P : S.IsPeripheralIn P_set P := ⟨hP_in, a, b, hP_ends, Or.inl hd_ab⟩ + have hU_sub : S.transactionPeripheralUnion P_set ⊆ S.transactionPeripheralUnion P_set' := by + rintro z ⟨hz_bar, hz_inter⟩ + refine ⟨hz_bar, mem_iInter₂.mpr fun R ⟨hR_in, hperR'⟩ => ?_⟩ + rcases hR_in with hR | rfl + · obtain ⟨hperR_old, hU_eq, _⟩ := hper_other R hR hperR' + rw [hU_eq] + exact mem_iInter₂.mp hz_inter R ⟨hR.1, hperR_old⟩ + · rw [hU_P''] + apply hba_sub_vu + rw [← hU_P] + exact mem_iInter₂.mp hz_inter P ⟨hP_in, hper_P⟩ + have hC_sub : S.coveredComponentUnion P_set ⊆ S.coveredComponentUnion P_set' := + S.lemma_6_1_claim_5 htrans_orig hcard_ge2 hP_in hP_ends hd_ab hsep hinter hba_G₂ + hP''_le_G₁ hU_sub hper_sub + have hx₀_U' : x₀ ∈ S.transactionPeripheralUnion P_set' := by + have hx₀_bar : x₀ ∈ S.Ω.bar := by + rcases hx₀_ab with rfl | rfl + · exact hP_ends.2.2.1 + · exact hP_ends.2.2.2 + refine ⟨hx₀_bar, mem_iInter₂.mpr fun R ⟨hR_in, hperR'⟩ => ?_⟩ + rcases hR_in with hR | rfl + · exact (hper_other R hR hperR').2.2 (hI_sub_G₁ (Or.inl hx₀_ab)) + · rw [hU_P''] + exact hx₀_vu + exact ⟨P'', hP''_le_P', htrans', hcard', hno_int', hC_sub, ⟨x₀, hx₀_ab, hx₀_U'⟩⟩ + +/-- In the setup of Claim (6), if `P' ≤ G₁` is an `Ω`-path with ends `c, d` where `c ∉ {a, b}`, then +a minimal `{c} → (ΩBar \ {c})` subpath `P'' ≤ P'` replaces `P` in `P_set` to form a transaction +`(P_set \ {P}) ∪ {P''}` of size `3p + 8` satisfying (a), (b), +`C(P_set) ⊆ C((P_set \ {P}) ∪ {P''})`, and `{a, b} ∩ U((P_set \ {P}) ∪ {P''}) ≠ ∅`. -/ +theorem exists_replacement_of_end_notMem {p : ℕ} {P_set : Set (Graph α β)} + {P P' G₁ G₂ : Graph α β} {a b c d : α} + (htrans : S.IsTransaction P_set) + (hcard : P_set.ncard = 3 * p + 8) + (hno_int : ∀ R ∈ P_set, Disjoint (pathInternalVerts S.G R) S.Ω.bar) + (hP_in : P ∈ P_set) + (hP_ends : S.IsOmegaPathWithEnds P a b) + (hd_ab : Disjoint (S.Ω.interval a b) (S.transactionEnds P_set)) + (hsep : IsGraphSeparation S.G G₁ G₂) + (hinter : V(G₁) ∩ V(G₂) = V(P)) + (hab_G₁ : S.Ω.interval a b ⊆ V(G₁)) + (hba_G₂ : S.Ω.interval b a ⊆ V(G₂)) + (hP'_le : P' ≤ G₁) + (hP'_cd : S.IsOmegaPathWithEnds P' c d) + (hc_not : c ∉ ({a, b} : Set α)) : + ∃ P'' : Graph α β, + P'' ≤ P' ∧ + S.IsTransaction ((P_set \ {P}) ∪ {P''}) ∧ + ((P_set \ {P}) ∪ {P''}).ncard = 3 * p + 8 ∧ + (∀ R ∈ (P_set \ {P}) ∪ {P''}, Disjoint (pathInternalVerts S.G R) S.Ω.bar) ∧ + S.coveredComponentUnion P_set ⊆ S.coveredComponentUnion ((P_set \ {P}) ∪ {P''}) ∧ + ({a, b} ∩ S.transactionPeripheralUnion ((P_set \ {P}) ∪ {P''})).Nonempty := by + classical + have htrans_orig : S.IsTransaction P_set := htrans + obtain ⟨A₀, B₀, hfence₀⟩ := htrans + have hex_AB : ∃ A B : Set α, S.IsFenceFor P_set A B ∧ a ∈ A ∧ b ∈ B := by + obtain ⟨a₀, ha₀A₀, b₀, hb₀B₀, hP₀⟩ := hfence₀.2.2 P hP_in + rcases hP_ends.ends_eq S hP₀ with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨A₀, B₀, hfence₀, ha₀A₀, hb₀B₀⟩ + · refine ⟨B₀, A₀, ⟨hfence₀.1, hfence₀.2.1.symm, fun R hR => ?_⟩, hb₀B₀, ha₀A₀⟩ + obtain ⟨x, hxA₀, y, hyB₀, hR_xy⟩ := hfence₀.2.2 R hR + exact ⟨y, hyB₀, x, hxA₀, hR_xy.symm S⟩ + obtain ⟨A, B, hfence, haA, hbB⟩ := hex_AB + -- Every vertex of `V(P') ∩ S.Ω.bar` lies in `{a, b} ∪ S.Ω.interval a b`. + have hVP'_bar : ∀ z ∈ V(P'), z ∈ S.Ω.bar → z ∈ ({a, b} : Set α) ∪ S.Ω.interval a b := by + intro z hzP' hz_bar + by_cases hz_ab : z ∈ ({a, b} : Set α) + · exact Or.inl hz_ab + · simp only [mem_insert_iff, mem_singleton_iff, not_or] at hz_ab + rcases S.Ω.mem_interval_or_interval_swap hP_ends.2.2.1 hP_ends.2.2.2 hz_bar + hP_ends.2.1 hz_ab.1 hz_ab.2 with hz_in | hz_ba + · exact Or.inr hz_in + · exfalso + have hzP : z ∈ V(P) := hinter ▸ ⟨hP'_le.vertexSet_mono hzP', hba_G₂ hz_ba⟩ + have hz_pair : z ∈ ({a, b} : Set α) := by + rw [← hP_ends.vertexSet_inter_bar_eq S (hno_int P hP_in)] + exact ⟨hzP, hz_bar⟩ + exact hz_ab.1 (hz_pair.resolve_right hz_ab.2) + have hc_ab : c ∈ S.Ω.interval a b := + (hVP'_bar c hP'_cd.1.left_mem hP'_cd.2.2.1).resolve_left hc_not + -- Choose a minimal `{c} → (S.Ω.bar \ {c})` subpath `P'' ≤ P'`. + obtain ⟨c', hc'_eq, d', hd'_mem, P'', hP''_le_P', hP''_ft⟩ := + hP'_cd.1.exists_isFromToPathWithEnds (X := {c}) (Y := S.Ω.bar \ {c}) + rfl ⟨hP'_cd.2.2.2, Ne.symm hP'_cd.2.1⟩ + rw [mem_singleton_iff] at hc'_eq + subst c' + have hd'_bar : d' ∈ S.Ω.bar := hd'_mem.1 + have hc_ne_d' : c ≠ d' := Ne.symm hd'_mem.2 + have hP''_le_G₁ : P'' ≤ G₁ := hP''_le_P'.trans hP'_le + have hP''_cd' : S.IsOmegaPathWithEnds P'' c d' := + ⟨hP''_ft.1, hc_ne_d', hP'_cd.2.2.1, hd'_bar⟩ + have hno_int_P'' : Disjoint (pathInternalVerts S.G P'') S.Ω.bar := by + rw [hP''_ft.1.pathInternalVerts_eq, disjoint_left] + intro z ⟨hzP'', hz_not_cd'⟩ hz_bar + have hz_ne_c : z ≠ c := fun h => hz_not_cd' (Or.inl h) + have hz_in : z ∈ V(P'') ∩ (S.Ω.bar \ {c}) := ⟨hzP'', hz_bar, hz_ne_c⟩ + rw [hP''_ft.2.2, mem_singleton_iff] at hz_in + exact hz_not_cd' (Or.inr hz_in) + have hd'_ab_or : d' ∈ ({a, b} : Set α) ∪ S.Ω.interval a b := + hVP'_bar d' (hP''_le_P'.vertexSet_mono hP''_ft.1.right_mem) hd'_bar + -- Order the ends `{c, d'}` of `P''` along `{a, b} ∪ S.Ω.interval a b`. + have hex_uv : ∃ u₀ v₀ x₀ : α, + S.IsOmegaPathWithEnds P'' u₀ v₀ ∧ + u₀ ∈ ({a} : Set α) ∪ S.Ω.interval a v₀ ∧ + v₀ ∈ ({b} : Set α) ∪ S.Ω.interval u₀ b ∧ + u₀ ∈ ({a, b} : Set α) ∪ S.Ω.interval a b ∧ + v₀ ∈ ({a, b} : Set α) ∪ S.Ω.interval a b ∧ + x₀ ∈ ({a, b} : Set α) ∧ + x₀ ∈ S.Ω.interval v₀ u₀ := by + have hd'_split : d' ∈ ({a} : Set α) ∪ S.Ω.interval a c ∨ + d' ∈ ({b} : Set α) ∪ S.Ω.interval c b := by + rcases hd'_ab_or with (rfl | rfl) | hd'_in + · exact Or.inl (Or.inl rfl) + · exact Or.inr (Or.inl rfl) + · rw [S.Ω.interval_eq_union_of_mem hc_ab] at hd'_in + rcases hd'_in with (hd'_ac | rfl) | hd'_cb + · exact Or.inl (Or.inr hd'_ac) + · exact (hc_ne_d' rfl).elim + · exact Or.inr (Or.inr hd'_cb) + rcases hd'_split with hd'_ac | hd'_cb + · have hc_d'b : c ∈ S.Ω.interval d' b := by + rcases hd'_ac with rfl | hd'_in + · exact hc_ab + · exact S.Ω.mem_interval_right_of_mem_interval_left hc_ab hd'_in + refine ⟨d', c, b, hP''_cd'.symm S, hd'_ac, Or.inr hc_d'b, hd'_ab_or, Or.inr hc_ab, + Or.inr rfl, S.Ω.mem_interval_rotate_left hc_d'b⟩ + · have hc_ad' : c ∈ S.Ω.interval a d' := by + rcases hd'_cb with rfl | hd'_in + · exact hc_ab + · exact S.Ω.mem_interval_left_of_mem_interval_right hc_ab hd'_in + refine ⟨c, d', a, hP''_cd', Or.inr hc_ad', hd'_cb, Or.inr hc_ab, hd'_ab_or, + Or.inl rfl, S.Ω.mem_interval_rotate_right hc_ad'⟩ + obtain ⟨u₀, v₀, x₀, hP''_uv, hu₀_av₀, hv₀_u₀b, hu₀_ab, hv₀_ab, hx₀_ab, hx₀_vu⟩ := hex_uv + have huv_sub_ab : S.Ω.interval u₀ v₀ ⊆ S.Ω.interval a b := by + have h1 : S.Ω.interval u₀ v₀ ⊆ S.Ω.interval a v₀ := by + rcases hu₀_av₀ with rfl | hu₀_in + · exact Subset.rfl + · exact S.Ω.interval_subset_interval_right hu₀_in + have h2 : S.Ω.interval a v₀ ⊆ S.Ω.interval a b := by + rcases hv₀_ab with (rfl | rfl) | hv₀_in + · exfalso + rcases hu₀_av₀ with rfl | hu₀_in + · exact hP''_uv.2.1 rfl + · exact (S.Ω.isClockwise3_iff.mp hu₀_in.2).2.1 rfl + · exact Subset.rfl + · exact S.Ω.interval_subset_interval_left hv₀_in + exact h1.trans h2 + have hba_sub_vu : S.Ω.interval b a ⊆ S.Ω.interval v₀ u₀ := by + intro z hz_ba + have hz_not_I : z ∉ ({a, b} : Set α) ∪ S.Ω.interval a b := by + rintro ((rfl | rfl) | hz_ab) + · exact S.Ω.not_mem_interval_right b z hz_ba + · exact S.Ω.not_mem_interval_left z a hz_ba + · exact disjoint_left.mp (S.Ω.disjoint_interval_swap a b) hz_ab hz_ba + have hz_ne_u₀ : z ≠ u₀ := fun h => hz_not_I (h ▸ hu₀_ab) + have hz_ne_v₀ : z ≠ v₀ := fun h => hz_not_I (h ▸ hv₀_ab) + exact (S.Ω.mem_interval_or_interval_swap hP''_uv.2.2.1 hP''_uv.2.2.2 hz_ba.1.1 + hP''_uv.2.1 hz_ne_u₀ hz_ne_v₀).resolve_left (fun h => hz_not_I (Or.inr (huv_sub_ab h))) + -- Set up `W := S.transactionEnds P_set` and `W' := S.transactionEnds (P_set \ {P})`. + exact replacePathWithOrderedEnds p hcard hno_int hP_in hP_ends hd_ab hsep hinter hab_G₁ hba_G₂ + htrans_orig hfence haA hbB hP''_le_P' hP''_le_G₁ hno_int_P'' hP''_uv hu₀_av₀ hu₀_ab hv₀_ab + hx₀_ab hx₀_vu huv_sub_ab hba_sub_vu + +/-- **Graph Minors IX, (6.1), Claim (6)** (page 56): +"If $P'$ is an $\Omega$-path with $P' \subseteq G_1$, then $P'$ has ends $a, b$." -/ +theorem lemma_6_1_claim_6 {p : ℕ} {P_set : Set (Graph α β)} {P P' G₁ G₂ : Graph α β} {a b : α} + (htrans : S.IsTransaction P_set) + (hcard : P_set.ncard = 3 * p + 8) + (hno_int : ∀ R ∈ P_set, Disjoint (pathInternalVerts S.G R) S.Ω.bar) + (hmax : ∀ P_set' : Set (Graph α β), + S.IsTransaction P_set' → + P_set'.ncard = 3 * p + 8 → + (∀ R ∈ P_set', Disjoint (pathInternalVerts S.G R) S.Ω.bar) → + S.coveredComponentUnion P_set ⊆ S.coveredComponentUnion P_set' → + S.coveredComponentUnion P_set = S.coveredComponentUnion P_set') + (hP_in : P ∈ P_set) + (hP_ends : S.IsOmegaPathWithEnds P a b) + (hd_ab : Disjoint (S.Ω.interval a b) (S.transactionEnds P_set)) + (hsep : IsGraphSeparation S.G G₁ G₂) + (hinter : V(G₁) ∩ V(G₂) = V(P)) + (hab_G₁ : S.Ω.interval a b ⊆ V(G₁)) + (hba_G₂ : S.Ω.interval b a ⊆ V(G₂)) + (hP'_omega : S.IsOmegaPath P') + (hP'_le : P' ≤ G₁) : + S.IsOmegaPathWithEnds P' a b := by + obtain ⟨c, d, hP'_cd⟩ := hP'_omega + have hc_ab : c ∈ ({a, b} : Set α) := by + by_contra hc_not + obtain ⟨P'', _, htrans', hcard', hno_int', hC_sub, ⟨x, hx_ab, hx_U'⟩⟩ := + S.exists_replacement_of_end_notMem htrans hcard hno_int hP_in hP_ends hd_ab hsep hinter + hab_G₁ hba_G₂ hP'_le hP'_cd hc_not + have hC_eq : S.coveredComponentUnion P_set = + S.coveredComponentUnion ((P_set \ {P}) ∪ {P''}) := + hmax _ htrans' hcard' hno_int' hC_sub + have hcard_ge2 : 2 ≤ ((P_set \ {P}) ∪ {P''}).ncard := by omega + have hx_C : x ∈ S.coveredComponentUnion P_set := by + rw [hC_eq] + exact S.transactionPeripheralUnion_subset_coveredComponentUnion htrans' hcard_ge2 + hno_int' hx_U' + have hperP : S.IsPeripheralIn P_set P := ⟨hP_in, a, b, hP_ends, Or.inl hd_ab⟩ + have hdisj_CP := S.disjoint_coveredComponentUnion_of_isPeripheralIn hP_in hperP + have hx_P : x ∈ V(P) := by + rcases hx_ab with rfl | rfl + · exact hP_ends.1.left_mem + · exact hP_ends.1.right_mem + exact disjoint_left.mp hdisj_CP hx_C hx_P + have hd_ab_mem : d ∈ ({a, b} : Set α) := by + by_contra hd_not + obtain ⟨P'', _, htrans', hcard', hno_int', hC_sub, ⟨x, hx_ab, hx_U'⟩⟩ := + S.exists_replacement_of_end_notMem htrans hcard hno_int hP_in hP_ends hd_ab hsep hinter + hab_G₁ hba_G₂ hP'_le (hP'_cd.symm S) hd_not + have hC_eq : S.coveredComponentUnion P_set = + S.coveredComponentUnion ((P_set \ {P}) ∪ {P''}) := + hmax _ htrans' hcard' hno_int' hC_sub + have hcard_ge2 : 2 ≤ ((P_set \ {P}) ∪ {P''}).ncard := by omega + have hx_C : x ∈ S.coveredComponentUnion P_set := by + rw [hC_eq] + exact S.transactionPeripheralUnion_subset_coveredComponentUnion htrans' hcard_ge2 + hno_int' hx_U' + have hperP : S.IsPeripheralIn P_set P := ⟨hP_in, a, b, hP_ends, Or.inl hd_ab⟩ + have hdisj_CP := S.disjoint_coveredComponentUnion_of_isPeripheralIn hP_in hperP + have hx_P : x ∈ V(P) := by + rcases hx_ab with rfl | rfl + · exact hP_ends.1.left_mem + · exact hP_ends.1.right_mem + exact disjoint_left.mp hdisj_CP hx_C hx_P + rcases hc_ab with rfl | rfl <;> rcases hd_ab_mem with rfl | rfl + · exact (hP'_cd.2.1 rfl).elim + · exact hP'_cd + · exact hP'_cd.symm S + · exact (hP'_cd.2.1 rfl).elim + +/-- **Graph Minors IX, (6.1), Claim (7)** (page 57): +"`Ω(a, b) = ∅`." -/ +theorem lemma_6_1_claim_7 {P G₁ G₂ : Graph α β} {a b : α} + (hconn3 : S.IsKConnected 3) + (hloopless : ∀ x : α, ¬ S.G.Adj x x) + (hno_iso : ∀ v ∈ S.Ω.bar, ∃ u : α, S.G.Adj v u) + (hP_ends : S.IsOmegaPathWithEnds P a b) + (hno_intP : Disjoint (pathInternalVerts S.G P) S.Ω.bar) + (hsep : IsGraphSeparation S.G G₁ G₂) + (hinter : V(G₁) ∩ V(G₂) = V(P)) + (hP_G₁ : P ≤ G₁) + (hab_G₁ : S.Ω.interval a b ⊆ V(G₁)) + (hclaim6 : ∀ P' : Graph α β, S.IsOmegaPath P' → P' ≤ G₁ → S.IsOmegaPathWithEnds P' a b) : + S.Ω.interval a b = ∅ := by + rw [eq_empty_iff_forall_notMem] + intro c hc_ab + have hc_bar : c ∈ S.Ω.bar := hc_ab.1.1 + have hcG : c ∈ V(S.G) := S.bar_subset hc_bar + have hc_not_P : c ∉ V(P) := by + intro hcP + have hc_ab_pair : c ∈ ({a, b} : Set α) := by + rw [← hP_ends.vertexSet_inter_bar_eq S hno_intP] + exact ⟨hcP, hc_bar⟩ + rcases hc_ab_pair with h_eq | h_eq + · rw [h_eq] at hc_ab + exact S.Ω.not_mem_interval_left a b hc_ab + · rw [h_eq] at hc_ab + exact S.Ω.not_mem_interval_right a b hc_ab + let G' := reachableComponent S.G c + have hG'_comp : IsGraphComponent G' S.G := isGraphComponent_reachableComponent hcG + have hcG' : c ∈ V(G') := self_mem_reachableComponent hcG + by_cases hmeet : (V(G') ∩ V(P)).Nonempty + · -- Case 1: `G' ∩ P` is non-null; construct an `Ω`-path `P' ≤ G₁` with end `c ∉ {a, b}`. + obtain ⟨w, hwG', hwP⟩ := hmeet + obtain ⟨W_G'⟩ := hG'_comp.2.1.2 c hcG' w hwG' + obtain ⟨W_G, _, _⟩ := exists_walk_up_of_le hG'_comp.1 W_G' + obtain ⟨Q₀, hQ₀_G, _, _⟩ := exists_isGraphPathWithEnds_of_walk W_G + obtain ⟨c', hc'_eq, x, hxP, P₁, _, hP₁_ft⟩ := + hQ₀_G.exists_isFromToPathWithEnds (X := {c}) (Y := V(P)) rfl hwP + rw [mem_singleton_iff] at hc'_eq + subst c' + obtain ⟨P_xa, hP_xa_le, _, hP_xa_G⟩ := hP_ends.1.exists_subpath hxP hP_ends.1.left_mem + have hinter_P₁_xa : V(P₁) ∩ V(P_xa) = {x} := by + ext z + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hz₁, hz₂⟩ => ?_, fun h => h ▸ ⟨hP₁_ft.1.right_mem, hP_xa_G.left_mem⟩⟩ + have : z ∈ V(P₁) ∩ V(P) := ⟨hz₁, hP_xa_le.vertexSet_mono hz₂⟩ + rwa [hP₁_ft.2.2, mem_singleton_iff] at this + let P' := subgraphUnion S.G P₁ P_xa + have hP'_G : IsGraphPathWithEnds S.G P' c a := hP₁_ft.1.subgraphUnion hP_xa_G hinter_P₁_xa + have hc_ne_a : c ≠ a := fun h => S.Ω.not_mem_interval_left a b (h ▸ hc_ab) + have hP'_omega : S.IsOmegaPath P' := ⟨c, a, hP'_G, hc_ne_a, hc_bar, hP_ends.2.2.1⟩ + have hVP₁_G₁ : V(P₁) ⊆ V(G₁) := by + intro z hz + by_cases hz_G₁ : z ∈ V(G₁) + · exact hz_G₁ + · exfalso + have hz_G₂ : z ∈ V(G₂) := (hsep.2.2.1 ▸ hP₁_ft.1.le.vertexSet_mono hz).resolve_left hz_G₁ + obtain ⟨R₁, hR₁_P₁, hR₁_path, hR₁_G⟩ := hP₁_ft.1.exists_subpath hP₁_ft.1.left_mem hz + have hx_not_R₁ : x ∉ V(R₁) := by + intro hxR₁ + obtain ⟨S₁, S₂, _, _, hpath_S₁, hpath_S₂, _, hinter_S, _⟩ := + hP₁_ft.1.exists_split_at hz + have hx_S₂ : x = z := by + have hR₁_eq : R₁ = S₁ := hP₁_ft.1.subpath_unique_of_left hR₁_path hpath_S₁ + rw [hR₁_eq] at hxR₁ + have : x ∈ V(S₁) ∩ V(S₂) := ⟨hxR₁, hpath_S₂.right_mem⟩ + rwa [hinter_S, mem_singleton_iff] at this + subst hx_S₂ + exact hz_G₁ (hP_G₁.vertexSet_mono hxP) + have hav_R₁ : Disjoint V(R₁) (V(G₁) ∩ V(G₂)) := by + rw [hinter, disjoint_left] + intro q hqR₁ hqP + have hq_x : q = x := by + have : q ∈ V(P₁) ∩ V(P) := ⟨hR₁_P₁.vertexSet_mono hqR₁, hqP⟩ + rwa [hP₁_ft.2.2, mem_singleton_iff] at this + exact hx_not_R₁ (hq_x ▸ hqR₁) + have hVR₁_sub := connected_subset_right_of_avoids_inter hsep hR₁_G.le + hR₁_G.isGraphConnected hav_R₁ ⟨z, hR₁_G.right_mem, hz_G₂⟩ + exact (hVR₁_sub hR₁_G.left_mem).2 (hab_G₁ hc_ab) + have hP₁_le_G₁ : P₁ ≤ G₁ := by + rw [(Compatible.of_le_le hP₁_ft.1.le hsep.1).le_iff] + refine ⟨hVP₁_G₁, fun e he => ?_⟩ + obtain ⟨u, v, huv⟩ := P₁.exists_isLink_of_mem_edgeSet he + have huvG : S.G.IsLink e u v := huv.mono hP₁_ft.1.le + rcases hsep.2.2.2.1 ▸ huvG.edge_mem with he₁ | he₂ + · exact he₁ + · exfalso + have huG₂ : u ∈ V(G₂) := ((hsep.2.1.isLink_iff he₂).mpr huvG).left_mem + have hvG₂ : v ∈ V(G₂) := ((hsep.2.1.isLink_iff he₂).mpr huvG).right_mem + have huP : u ∈ V(P) := hinter ▸ ⟨hVP₁_G₁ huv.left_mem, huG₂⟩ + have hvP : v ∈ V(P) := hinter ▸ ⟨hVP₁_G₁ huv.right_mem, hvG₂⟩ + have hux : u = x := by + have : u ∈ V(P₁) ∩ V(P) := ⟨huv.left_mem, huP⟩ + rwa [hP₁_ft.2.2, mem_singleton_iff] at this + have hvx : v = x := by + have : v ∈ V(P₁) ∩ V(P) := ⟨huv.right_mem, hvP⟩ + rwa [hP₁_ft.2.2, mem_singleton_iff] at this + rw [hux, hvx] at huvG + exact hloopless x huvG.adj + have hP'_le_G₁ : P' ≤ G₁ := + (subgraphUnion_le_iff hP₁_ft.1.le hP_xa_G.le hsep.1).mpr + ⟨hP₁_le_G₁, hP_xa_le.trans hP_G₁⟩ + have hP'_ab := hclaim6 P' hP'_omega hP'_le_G₁ + have hc_ne_b : c ≠ b := fun h => S.Ω.not_mem_interval_right a b (h ▸ hc_ab) + rcases hP'_ab.ends_eq S ⟨hP'_G, hc_ne_a, hc_bar, hP_ends.2.2.1⟩ with ⟨h1, _⟩ | ⟨h1, _⟩ + · exact hc_ne_a h1 + · exact hc_ne_b h1 + · -- Case 2: `G' ∩ P` is null, so `G' ≤ G₁`. + have hdisj_G'P : Disjoint V(G') (V(G₁) ∩ V(G₂)) := by + rw [hinter] + exact not_nonempty_iff_eq_empty.mp hmeet |> disjoint_iff_inter_eq_empty.mpr + have hVG'_sub : V(G') ⊆ V(G₁) \ V(G₂) := + connected_subset_right_of_avoids_inter (IsGraphSeparation.symm hsep) hG'_comp.1 hG'_comp.2.1 + (inter_comm V(G₂) V(G₁) ▸ hdisj_G'P) ⟨c, hcG', hab_G₁ hc_ab⟩ + have hG'_le_G₁ : G' ≤ G₁ := by + rw [(Compatible.of_le_le hG'_comp.1 hsep.1).le_iff] + refine ⟨fun z hz => (hVG'_sub hz).1, fun e he => ?_⟩ + obtain ⟨u, v, huv⟩ := G'.exists_isLink_of_mem_edgeSet he + have huvG : S.G.IsLink e u v := huv.mono hG'_comp.1 + rcases hsep.2.2.2.1 ▸ huvG.edge_mem with he₁ | he₂ + · exact he₁ + · exact ((hVG'_sub huv.left_mem).2 ((hsep.2.1.isLink_iff he₂).mpr huvG).left_mem).elim + -- Show `V(G') ∩ S.Ω.bar ⊆ {c}` using Claim (6). + have hG'_bar : V(G') ∩ S.Ω.bar ⊆ {c} := by + rintro d ⟨hdG', hd_bar⟩ + rw [mem_singleton_iff] + by_contra hdc + obtain ⟨W_cd⟩ := hG'_comp.2.1.2 c hcG' d hdG' + obtain ⟨W_G, hs_G, _⟩ := exists_walk_up_of_le hG'_comp.1 W_cd + obtain ⟨P', hP'_G, hVP', _⟩ := exists_isGraphPathWithEnds_of_walk W_G + have hVP'_G' : V(P') ⊆ V(G') := + fun z hz => W_cd.mem_vertexSet_of_mem_support (hs_G ▸ hVP' hz) + have hP'_le_G' : P' ≤ G' := by + rw [(Compatible.of_le_le hP'_G.le hG'_comp.1).le_iff] + refine ⟨hVP'_G', fun e he => ?_⟩ + obtain ⟨u, v, huv⟩ := P'.exists_isLink_of_mem_edgeSet he + have huvG : S.G.IsLink e u v := huv.mono hP'_G.le + exact (isClosedSubgraph_of_isGraphComponent hG'_comp).closed ⟨v, huvG⟩ + (hVP'_G' huv.left_mem) + have hP'_ab := hclaim6 P' ⟨c, d, hP'_G, Ne.symm hdc, hc_bar, hd_bar⟩ + (hP'_le_G'.trans hG'_le_G₁) + have ha_G₂ : a ∈ V(G₂) := (hinter ▸ hP_ends.1.left_mem : a ∈ V(G₁) ∩ V(G₂)).2 + exact (hVG'_sub (hP'_le_G'.vertexSet_mono hP'_ab.1.left_mem)).2 ha_G₂ + -- Construct the society separation `(G', B')` of `S` with `V(G') ∩ V(B') = {c}`. + let B' := (S.G.induce ((V(S.G) \ V(G')) ∪ {c})).restrict (E(S.G) \ E(G')) + have hB'_le : B' ≤ S.G := + restrict_le.trans (S.G.induce_le (union_subset sdiff_subset (singleton_subset_iff.mpr hcG))) + have hVB' : V(B') = (V(S.G) \ V(G')) ∪ {c} := rfl + have hEB' : E(B') = E(S.G) \ E(G') := by + change E(S.G.induce ((V(S.G) \ V(G')) ∪ {c})) ∩ (E(S.G) \ E(G')) = E(S.G) \ E(G') + rw [inter_eq_right] + rintro e ⟨heG, he_not_G'⟩ + obtain ⟨u, v, huv⟩ := S.G.exists_isLink_of_mem_edgeSet heG + have hu_not_G' : u ∉ V(G') := fun huG' => + he_not_G' ((isClosedSubgraph_of_isGraphComponent hG'_comp).closed ⟨v, huv⟩ huG') + have hv_not_G' : v ∉ V(G') := fun hvG' => + hu_not_G' ((mem_graphComponent_iff_of_isLink hG'_comp huv).mpr hvG') + exact ⟨u, v, huv, Or.inl ⟨huv.left_mem, hu_not_G'⟩, Or.inl ⟨huv.right_mem, hv_not_G'⟩⟩ + have hsep_G'B' : S.IsSocietySeparation G' B' := by + refine ⟨⟨hG'_comp.1, hB'_le, ?_, ?_, hEB' ▸ disjoint_sdiff_self_right⟩, ?_⟩ + · rw [hVB'] + ext z + simp only [mem_union, mem_sdiff, mem_singleton_iff] + exact ⟨by rintro (hzG' | ⟨hzG, _⟩ | rfl); exacts [hG'_comp.1.vertexSet_mono hzG', hzG, hcG], + fun hzG => by_cases Or.inl (fun hz => Or.inr (Or.inl ⟨hzG, hz⟩))⟩ + · rw [hEB'] + exact union_sdiff_cancel hG'_comp.1.edgeSet_mono + · intro z hz_bar + rw [hVB'] + by_cases hzG' : z ∈ V(G') + · exact Or.inr (hG'_bar ⟨hzG', hz_bar⟩) + · exact Or.inl ⟨S.bar_subset hz_bar, hzG'⟩ + have hinter_G'B' : V(G') ∩ V(B') = {c} := by + rw [hVB'] + ext z + simp only [mem_inter_iff, mem_union, mem_sdiff, mem_singleton_iff] + exact ⟨by rintro ⟨hzG', ⟨_, hz_not⟩ | rfl⟩; exacts [(hz_not hzG').elim, rfl], + by rintro rfl; exact ⟨hcG', Or.inr rfl⟩⟩ + -- By `(2)`, `c` has a neighbor `u` in `S.G`, with `u ≠ c` by `hloopless`. + obtain ⟨u, hcu⟩ := hno_iso c hc_bar + have huc_ne : u ≠ c := fun h => hloopless c (h ▸ hcu) + obtain ⟨e, he_cu⟩ := hcu + have huG' : u ∈ V(G') := (mem_graphComponent_iff_of_isLink hG'_comp he_cu).mp hcG' + have hVB'_ne : V(B') ≠ V(S.G) := by + intro heq + have huB' : u ∈ V(B') := heq ▸ hG'_comp.1.vertexSet_mono huG' + rw [hVB', mem_union, mem_sdiff, mem_singleton_iff] at huB' + rcases huB' with ⟨_, hu_not⟩ | h_eq + · exact hu_not huG' + · exact huc_ne h_eq + have hcard_inter : (V(G') ∩ V(B')).ncard ≤ 1 := by + rw [hinter_G'B', ncard_singleton] + exact hconn3 1 (by decide) G' B' ⟨hsep_G'B', hcard_inter, hVB'_ne⟩ + +/-- Concatenating two paths `P₁` (from `u` to `z`) and `P₂` (from `z` to `w`) in `G` yields a path +`M` in `G` from `u` to `w` with `V(M) ⊆ V(P₁) ∪ V(P₂)`. -/ +theorem exists_path_subset_union_of_paths {G P₁ P₂ : Graph α β} {u z w : α} + (h₁ : IsGraphPathWithEnds G P₁ u z) (h₂ : IsGraphPathWithEnds G P₂ z w) : + ∃ M : Graph α β, IsGraphPathWithEnds G M u w ∧ V(M) ⊆ V(P₁) ∪ V(P₂) := by + rcases h₁ with ⟨h₁G, W₁, _, hV₁, _⟩ + rcases h₂ with ⟨h₂G, W₂, _, hV₂, _⟩ + obtain ⟨W₁', hs₁, _⟩ := exists_walk_up_of_le h₁G W₁ + obtain ⟨W₂', hs₂, _⟩ := exists_walk_up_of_le h₂G W₂ + obtain ⟨M, hM, hVM, _⟩ := exists_isGraphPathWithEnds_of_walk (W₁'.append W₂') + refine ⟨M, hM, fun x hx => ?_⟩ + rcases (GraphWalk.mem_support_append W₁' W₂').mp (hVM hx) with hx₁ | hx₂ + · exact Or.inl (hV₁ ▸ hs₁ ▸ hx₁) + · exact Or.inr (hV₂ ▸ hs₂ ▸ hx₂) + +/-- Replacing `P ∈ P_set` (with ends `a, b`) by `P' ≤ G₁` (also with ends `a, b` and no internal +vertex in `ΩBar`) preserves the fence `(A, B)`, cardinality, `transactionEnds`, +`peripheralIntervalSet`, `transactionPeripheralUnion`, and (under `hmax`) `coveredComponentUnion`. +-/ +theorem replacement_same_ends_properties {p : ℕ} {P_set : Set (Graph α β)} + {P P' G₁ G₂ : Graph α β} {a b : α} + (htrans : S.IsTransaction P_set) + (hcard : P_set.ncard = 3 * p + 8) + (hno_int : ∀ R ∈ P_set, Disjoint (pathInternalVerts S.G R) S.Ω.bar) + (hmax : ∀ P_set' : Set (Graph α β), + S.IsTransaction P_set' → + P_set'.ncard = 3 * p + 8 → + (∀ R ∈ P_set', Disjoint (pathInternalVerts S.G R) S.Ω.bar) → + S.coveredComponentUnion P_set ⊆ S.coveredComponentUnion P_set' → + S.coveredComponentUnion P_set = S.coveredComponentUnion P_set') + (hP_in : P ∈ P_set) + (hP_ends : S.IsOmegaPathWithEnds P a b) + (hd_ab : Disjoint (S.Ω.interval a b) (S.transactionEnds P_set)) + (hsep : IsGraphSeparation S.G G₁ G₂) + (hinter : V(G₁) ∩ V(G₂) = V(P)) + (hab_G₁ : S.Ω.interval a b ⊆ V(G₁)) + (hba_G₂ : S.Ω.interval b a ⊆ V(G₂)) + (hP'_ends : S.IsOmegaPathWithEnds P' a b) + (hP'_le : P' ≤ G₁) + (hno_int_P' : Disjoint (pathInternalVerts S.G P') S.Ω.bar) : + let P_set' := (P_set \ {P}) ∪ {P'} + P' ∉ P_set \ {P} ∧ + S.IsTransaction P_set' ∧ + P_set'.ncard = 3 * p + 8 ∧ + (∀ R ∈ P_set', Disjoint (pathInternalVerts S.G R) S.Ω.bar) ∧ + S.transactionEnds P_set' = S.transactionEnds P_set ∧ + S.IsPeripheralIn P_set' P' ∧ + (∀ R ∈ P_set \ {P}, S.IsPeripheralIn P_set' R ↔ S.IsPeripheralIn P_set R) ∧ + S.transactionPeripheralUnion P_set' = S.transactionPeripheralUnion P_set ∧ + S.coveredComponentUnion P_set = S.coveredComponentUnion P_set' := by + intro P_set' + have htrans_orig : S.IsTransaction P_set := htrans + obtain ⟨A, B, hfence⟩ := htrans + have hdisj_RP' : ∀ R ∈ P_set \ {P}, Disjoint V(R) V(P') := by + intro R hR + obtain ⟨a_R, _, b_R, _, hR_ends⟩ := hfence.2.2 R hR.1 + obtain ⟨_, _, hVR⟩ := S.sdiff_singleton_subset_right_of_separation htrans_orig hP_in hP_ends + hd_ab hsep hinter hba_G₂ hR hR_ends + rw [disjoint_left] + intro z hzR hzP' + exact (hVR hzR).2 (hP'_le.vertexSet_mono hzP') + have hP'_not_in : P' ∉ P_set \ {P} := by + intro hP'_in + exact disjoint_left.mp (hdisj_RP' P' hP'_in) hP'_ends.1.left_mem hP'_ends.1.left_mem + have hfence' : S.IsFenceFor P_set' A B := by + refine ⟨⟨?_, ?_⟩, hfence.2.1, ?_⟩ + · rintro R (hR | rfl) + · exact hfence.1.1 R hR.1 + · exact ⟨a, b, hP'_ends⟩ + · rintro R₁ (hR₁ | rfl) R₂ (hR₂ | rfl) hne + · exact hfence.1.2 hR₁.1 hR₂.1 hne + · exact hdisj_RP' R₁ hR₁ + · exact (hdisj_RP' R₂ hR₂).symm + · exact (hne rfl).elim + · rintro R (hR | rfl) + · exact hfence.2.2 R hR.1 + · obtain ⟨a₀, ha₀A, b₀, hb₀B, hP₀⟩ := hfence.2.2 P hP_in + rcases hP_ends.ends_eq S hP₀ with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨a₀, ha₀A, b₀, hb₀B, hP'_ends⟩ + · exact ⟨a₀, ha₀A, b₀, hb₀B, hP'_ends.symm S⟩ + have htrans' : S.IsTransaction P_set' := ⟨A, B, hfence'⟩ + have hfin_P : P_set.Finite := hfence.1.finite S + have hcard' : P_set'.ncard = 3 * p + 8 := by + change ((P_set \ {P}) ∪ {P'}).ncard = 3 * p + 8 + rw [union_singleton, ncard_insert_of_notMem hP'_not_in hfin_P.sdiff, + ncard_sdiff_singleton_of_mem hP_in] + omega + have hno_int' : ∀ R ∈ P_set', Disjoint (pathInternalVerts S.G R) S.Ω.bar := by + rintro R (hR | rfl) + · exact hno_int R hR.1 + · exact hno_int_P' + have hP'_ends_iff : ∀ s t : α, S.IsOmegaPathWithEnds P' s t ↔ S.IsOmegaPathWithEnds P s t := by + intro s t + constructor + · intro h + rcases hP'_ends.ends_eq S h with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hP_ends + · exact hP_ends.symm S + · intro h + rcases hP_ends.ends_eq S h with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hP'_ends + · exact hP'_ends.symm S + have hW_eq : S.transactionEnds P_set' = S.transactionEnds P_set := by + ext x + simp only [transactionEnds, mem_ofPred_eq] + constructor + · rintro ⟨R, hR | rfl, y, hRy⟩ + · exact ⟨R, hR.1, y, hRy⟩ + · exact ⟨P, hP_in, y, (hP'_ends_iff x y).mp hRy⟩ + · rintro ⟨R, hR_in, y, hRy⟩ + by_cases hRP : R = P + · subst hRP + exact ⟨P', Or.inr rfl, y, (hP'_ends_iff x y).mpr hRy⟩ + · exact ⟨R, Or.inl ⟨hR_in, hRP⟩, y, hRy⟩ + have hU_R_eq : ∀ R : Graph α β, + S.peripheralIntervalSet P_set' R = S.peripheralIntervalSet P_set R := by + intro R + simp only [peripheralIntervalSet, hW_eq] + have hU_P'_eq : S.peripheralIntervalSet P_set' P' = S.peripheralIntervalSet P_set P := by + ext x + simp only [peripheralIntervalSet, hW_eq, mem_iUnion, hP'_ends_iff] + have hper_P' : S.IsPeripheralIn P_set' P' := + ⟨Or.inr rfl, a, b, hP'_ends, Or.inl (hW_eq ▸ hd_ab)⟩ + have hper_P : S.IsPeripheralIn P_set P := + ⟨hP_in, a, b, hP_ends, Or.inl hd_ab⟩ + have hper_iff : ∀ R ∈ P_set \ {P}, S.IsPeripheralIn P_set' R ↔ S.IsPeripheralIn P_set R := by + intro R hR + simp only [IsPeripheralIn, hW_eq] + exact ⟨fun ⟨_, h⟩ => ⟨hR.1, h⟩, fun ⟨_, h⟩ => ⟨Or.inl hR, h⟩⟩ + have hper_sub : ∀ R ∈ P_set', S.IsPeripheralIn P_set' R → R = P' ∨ S.IsPeripheralIn P_set R := by + rintro R (hR | rfl) hperR + · exact Or.inr ((hper_iff R hR).mp hperR) + · exact Or.inl rfl + have hU_eq : S.transactionPeripheralUnion P_set' = S.transactionPeripheralUnion P_set := by + ext x + simp only [transactionPeripheralUnion, mem_inter_iff, mem_iInter, mem_ofPred_eq, + and_congr_right_iff] + intro _ + constructor + · intro hx R ⟨hR_in, hperR⟩ + by_cases hRP : R = P + · subst hRP + rw [← hU_P'_eq] + exact hx P' ⟨Or.inr rfl, hper_P'⟩ + · rw [← hU_R_eq R] + exact hx R ⟨Or.inl ⟨hR_in, hRP⟩, (hper_iff R ⟨hR_in, hRP⟩).mpr hperR⟩ + · intro hx R ⟨hR_in, hperR⟩ + rcases hR_in with hR_diff | rfl + · rw [hU_R_eq R] + exact hx R ⟨hR_diff.1, (hper_iff R hR_diff).mp hperR⟩ + · rw [hU_P'_eq] + exact hx P ⟨hP_in, hper_P⟩ + have hcard_ge2 : 2 ≤ P_set.ncard := by omega + have hC_sub : S.coveredComponentUnion P_set ⊆ S.coveredComponentUnion P_set' := + S.lemma_6_1_claim_5 htrans_orig hcard_ge2 hP_in hP_ends hd_ab hsep hinter hba_G₂ + hP'_le hU_eq.symm.subset hper_sub + have hC_eq : S.coveredComponentUnion P_set = S.coveredComponentUnion P_set' := + hmax P_set' htrans' hcard' hno_int' hC_sub + exact ⟨hP'_not_in, htrans', hcard', hno_int', hW_eq, hper_P', hper_iff, hU_eq, hC_eq⟩ + +/-- In the setup of Claim (8), if `H' ≠ H` while `H = deleteVertices S.G V(G₁)`, `H ≤ H' ≤ S.G`, and +`Catches (S.Ω.interval b a) H'`, there exist `v ∈ V(P)`, `u₀ ∈ S.Ω.interval b a`, and a path +`Q ≤ H'` in `S.G` with `IsFromToPathWithEnds S.G Q V(P) (S.Ω.interval b a) v u₀`. -/ +theorem exists_fromToPath_from_P_to_ba_of_ne {P G₁ G₂ H H' : Graph α β} {a b : α} + (hsep : IsGraphSeparation S.G G₁ G₂) + (hinter : V(G₁) ∩ V(G₂) = V(P)) + (hba_G₂ : S.Ω.interval b a ⊆ V(G₂)) + (hHG : H ≤ S.G) + (hH_del_G : H = deleteVertices S.G V(G₁)) + (hVH : V(H) = V(S.G) \ V(G₁)) + (hH_le_H' : H ≤ H') + (hH'_le_G : H' ≤ S.G) + (hcatch_H' : Catches (S.Ω.interval b a) H') + (hne : H' ≠ H) : + ∃ v ∈ V(P), ∃ u₀ ∈ S.Ω.interval b a, ∃ Q : Graph α β, + Q ≤ H' ∧ IsFromToPathWithEnds S.G Q V(P) (S.Ω.interval b a) v u₀ := by + have hex_v₀ : ∃ v₀ ∈ V(H'), v₀ ∉ V(H) := by + by_contra! hall + have hV_eq : V(H') = V(H) := Subset.antisymm hall hH_le_H'.vertexSet_mono + have hE_eq : E(H') = E(H) := by + refine Subset.antisymm (fun e he => ?_) hH_le_H'.edgeSet_mono + obtain ⟨x, y, hxy⟩ := H'.exists_isLink_of_mem_edgeSet he + have hxyG : S.G.IsLink e x y := hxy.mono hH'_le_G + have hxH : x ∈ V(S.G) \ V(G₁) := hVH ▸ hV_eq ▸ hxy.left_mem + have hyH : y ∈ V(S.G) \ V(G₁) := hVH ▸ hV_eq ▸ hxy.right_mem + rw [hH_del_G] + exact ((deleteVertices_isLink S.G V(G₁)).mpr ⟨hxyG, hxH.2, hyH.2⟩).edge_mem + exact hne ((Compatible.of_le_le hH'_le_G hHG).ext hV_eq hE_eq) + obtain ⟨v₀, hv₀H', hv₀_not_H⟩ := hex_v₀ + have hv₀G : v₀ ∈ V(S.G) := hH'_le_G.vertexSet_mono hv₀H' + have hv₀G₁ : v₀ ∈ V(G₁) := by + by_contra hv₀_not_G₁ + exact hv₀_not_H (hVH.symm ▸ ⟨hv₀G, hv₀_not_G₁⟩) + let D := reachableComponent H' v₀ + have hD_comp : IsGraphComponent D H' := isGraphComponent_reachableComponent hv₀H' + have hv₀D : v₀ ∈ V(D) := self_mem_reachableComponent hv₀H' + obtain ⟨w₀, hw₀_ba, hw₀D⟩ := hcatch_H'.2 D hD_comp + obtain ⟨W_D⟩ := hD_comp.2.1.2 v₀ hv₀D w₀ hw₀D + obtain ⟨W_H', _, _⟩ := exists_walk_up_of_le hD_comp.1 W_D + obtain ⟨Q₀, hQ₀_H', _, _⟩ := exists_isGraphPathWithEnds_of_walk W_H' + have hQ₀_G : IsGraphPathWithEnds S.G Q₀ v₀ w₀ := hQ₀_H'.mono hH'_le_G + have hmeet_P : (V(Q₀) ∩ V(P)).Nonempty := by + by_contra hnot + have hdisj : Disjoint V(Q₀) (V(G₁) ∩ V(G₂)) := + hinter ▸ (not_nonempty_iff_eq_empty.mp hnot |> disjoint_iff_inter_eq_empty.mpr) + have hVQ₀_sub := connected_subset_right_of_avoids_inter hsep hQ₀_G.le hQ₀_G.isGraphConnected + hdisj ⟨w₀, hQ₀_G.right_mem, hba_G₂ hw₀_ba⟩ + exact (hVQ₀_sub hQ₀_G.left_mem).2 hv₀G₁ + obtain ⟨x₀, hx₀Q₀, hx₀P⟩ := hmeet_P + obtain ⟨Q₁, hQ₁_Q₀, _, hQ₁_G⟩ := hQ₀_G.exists_subpath hx₀Q₀ hQ₀_G.right_mem + obtain ⟨v, hvP, u₀, hu₀_ba, Q, hQ_Q₁, hQ_ft⟩ := + hQ₁_G.exists_isFromToPathWithEnds hx₀P hw₀_ba + exact ⟨v, hvP, u₀, hu₀_ba, Q, (hQ_Q₁.trans hQ₁_Q₀).trans hQ₀_H'.le, hQ_ft⟩ + +/-- In the setup of Claim (8), if `R` is an `Ω`-path with ends `a, w` (where +`w ∈ {b''} ∪ S.Ω.interval b'' a''`) that is vertex-disjoint from every member of `P_set \ {P, P''}`, +then `R` together with `p - 1` members of `P_set \ {P, P''}` forms a crooked transaction of +cardinality `p`. -/ +theorem exists_crooked_of_leap_path {p : ℕ} {P_set : Set (Graph α β)} {A B : Set α} + {P P'' R : Graph α β} {a b a'' b'' w : α} + (hp2 : 2 ≤ p) + (hfence : S.IsFenceFor P_set A B) + (hcard : P_set.ncard = 3 * p + 8) + (hP_in : P ∈ P_set) + (hP''_diff : P'' ∈ P_set \ {P}) + (haA : a ∈ A) (hbB : b ∈ B) (hP_ends : S.IsOmegaPathWithEnds P a b) + (ha''A : a'' ∈ A) (hb''B : b'' ∈ B) (hP''_ends : S.IsOmegaPathWithEnds P'' a'' b'') + (hd_ab : Disjoint (S.Ω.interval a b) (S.transactionEnds P_set)) + (hd_b''a'' : Disjoint (S.Ω.interval b'' a'') (S.transactionEnds P_set)) + (hw_in : w ∈ ({b''} : Set α) ∪ S.Ω.interval b'' a'') + (hR_ends : S.IsOmegaPathWithEnds R a w) + (hdisj_R : ∀ R₀ ∈ P_set \ {P, P''}, Disjoint V(R) V(R₀)) : + ∃ P_set_c : Set (Graph α β), S.IsCrookedTransaction P_set_c ∧ P_set_c.ncard = p := by + classical + let W := S.transactionEnds P_set + have hW_bar : W ⊆ S.Ω.bar := S.transactionEnds_subset_bar P_set + have haW : a ∈ A ∩ W := ⟨haA, hP_ends.mem_transactionEnds_left S hP_in⟩ + have hbW : b ∈ B ∩ W := ⟨hbB, hP_ends.mem_transactionEnds_right S hP_in⟩ + have ha''W : a'' ∈ A ∩ W := ⟨ha''A, hP''_ends.mem_transactionEnds_left S hP''_diff.1⟩ + have hb''W : b'' ∈ B ∩ W := ⟨hb''B, hP''_ends.mem_transactionEnds_right S hP''_diff.1⟩ + have hdisj_PP'' : Disjoint V(P) V(P'') := hfence.1.2 hP_in hP''_diff.1 (Ne.symm hP''_diff.2) + have ha''_ne_a : a'' ≠ a := + fun h => disjoint_left.mp hdisj_PP'' hP_ends.1.left_mem (h ▸ hP''_ends.1.left_mem) + have hb''_ne_b : b'' ≠ b := + fun h => disjoint_left.mp hdisj_PP'' hP_ends.1.right_mem (h ▸ hP''_ends.1.right_mem) + have hb''_aa'' : b'' ∈ S.Ω.interval a a'' := + (S.Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.2.1 hW_bar haW hbW hd_ab ha''W ha''_ne_a + hb''W).2 + have ha''_b''a : a'' ∈ S.Ω.interval b'' a := S.Ω.mem_interval_rotate_left hb''_aa'' + -- Interval fence `(A_f, B_f) = ({a'', a} ∪ S.Ω.interval a'' a, S.Ω.interval a a'')`. + let A_f : Set α := {a'', a} ∪ S.Ω.interval a'' a + let B_f : Set α := S.Ω.interval a a'' + have hfence_f : S.Ω.IsFence A_f B_f := + S.Ω.isFence_interval_compl hP''_ends.2.2.1 hP_ends.2.2.1 ha''_ne_a + have ha_Af : a ∈ A_f := Or.inl (Or.inr rfl) + have hw_Bf : w ∈ B_f := by + rcases hw_in with rfl | hw_int + · exact hb''_aa'' + · exact S.Ω.interval_subset_interval_right hb''_aa'' hw_int + -- Every `R₀ ∈ P_set \ {P, P''}` has ends `a₀ ∈ A_f`, `b₀ ∈ B_f`, and crosses `R`. + have hR₀_props : ∀ R₀ ∈ P_set \ {P, P''}, + (∃ a₀ ∈ A_f, ∃ b₀ ∈ B_f, S.IsOmegaPathWithEnds R₀ a₀ b₀) ∧ + S.OmegaPathsCross R R₀ := by + intro R₀ ⟨hR₀_in, hR₀_not⟩ + rw [mem_insert_iff, mem_singleton_iff, not_or] at hR₀_not + obtain ⟨a₀, ha₀A, b₀, hb₀B, hR₀_ends⟩ := hfence.2.2 R₀ hR₀_in + have ha₀W : a₀ ∈ A ∩ W := ⟨ha₀A, hR₀_ends.mem_transactionEnds_left S hR₀_in⟩ + have hb₀W : b₀ ∈ B ∩ W := ⟨hb₀B, hR₀_ends.mem_transactionEnds_right S hR₀_in⟩ + have hdisj_R₀P : Disjoint V(R₀) V(P) := hfence.1.2 hR₀_in hP_in hR₀_not.1 + have hdisj_R₀P'' : Disjoint V(R₀) V(P'') := hfence.1.2 hR₀_in hP''_diff.1 hR₀_not.2 + have ha₀_ne_a : a₀ ≠ a := + fun h => disjoint_left.mp hdisj_R₀P hR₀_ends.1.left_mem (h ▸ hP_ends.1.left_mem) + have ha₀_ne_a'' : a₀ ≠ a'' := + fun h => disjoint_left.mp hdisj_R₀P'' hR₀_ends.1.left_mem (h ▸ hP''_ends.1.left_mem) + have hb₀_ne_b'' : b₀ ≠ b'' := + fun h => disjoint_left.mp hdisj_R₀P'' hR₀_ends.1.right_mem (h ▸ hP''_ends.1.right_mem) + have hb_aa₀ : b ∈ S.Ω.interval a a₀ := + (S.Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.2.1 hW_bar haW hbW hd_ab ha₀W ha₀_ne_a hbW).2 + have ha₀_ba : a₀ ∈ S.Ω.interval b a := S.Ω.mem_interval_rotate_left hb_aa₀ + have ha''_ba₀ : a'' ∈ S.Ω.interval b a₀ := + (S.Ω.mem_interval_of_mem_B_of_disjoint_AB hfence.2.1.symm hW_bar hb''W ha''W hd_b''a'' + hbW ha₀W ha₀_ne_a'').1 + have ha₀_a''a : a₀ ∈ S.Ω.interval a'' a := + S.Ω.mem_interval_right_of_mem_interval_left ha₀_ba ha''_ba₀ + have ha_b''b₀ : a ∈ S.Ω.interval b'' b₀ := + (S.Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.2.1.symm hW_bar hb''W ha''W hd_b''a'' + hb₀W hb₀_ne_b'' haW).2 + have hb₀_ab'' : b₀ ∈ S.Ω.interval a b'' := S.Ω.mem_interval_rotate_left ha_b''b₀ + have ha₀_Af : a₀ ∈ A_f := Or.inr ha₀_a''a + have hb₀_Bf : b₀ ∈ B_f := S.Ω.interval_subset_interval_left hb''_aa'' hb₀_ab'' + have hb₀_aw : b₀ ∈ S.Ω.interval a w := by + rcases hw_in with rfl | hw_int + · exact hb₀_ab'' + · have hb''_aw : b'' ∈ S.Ω.interval a w := + S.Ω.mem_interval_left_of_mem_interval_right hb''_aa'' hw_int + exact S.Ω.interval_subset_interval_left hb''_aw hb₀_ab'' + have ha₀_wa : a₀ ∈ S.Ω.interval w a := by + rcases hw_in with rfl | hw_int + · exact S.Ω.interval_subset_interval_right ha''_b''a ha₀_a''a + · have ha''_wa : a'' ∈ S.Ω.interval w a := + S.Ω.mem_interval_right_of_mem_interval_left ha''_b''a hw_int + exact S.Ω.interval_subset_interval_right ha''_wa ha₀_a''a + have hcr : S.Ω.Crosses a w a₀ b₀ := + S.Ω.crosses_iff_interval.mpr (Or.inr ⟨hb₀_aw, ha₀_wa⟩) + have hdisj_RR₀ : Disjoint V(R) V(R₀) := + hdisj_R R₀ ⟨hR₀_in, by simp [hR₀_not.1, hR₀_not.2]⟩ + exact ⟨⟨a₀, ha₀_Af, b₀, hb₀_Bf, hR₀_ends⟩, + ⟨hdisj_RR₀, a, w, a₀, b₀, hR_ends, hR₀_ends, hcr⟩⟩ + -- Choose a subset `M ⊆ P_set \ {P, P''}` of cardinality `p - 1`. + have hfin_P : P_set.Finite := hfence.1.finite S + have hfin_diff : (P_set \ {P, P''}).Finite := hfin_P.sdiff + have hcard_diff : p - 1 ≤ (P_set \ {P, P''}).ncard := by + have h_eq : P_set \ {P, P''} = (P_set \ {P}) \ {P''} := by + ext Q + simp only [mem_sdiff, mem_insert_iff, mem_singleton_iff, not_or] + tauto + rw [h_eq, ncard_sdiff_singleton_of_mem hP''_diff, ncard_sdiff_singleton_of_mem hP_in] + omega + have hex_sub : ∀ k ≤ (P_set \ {P, P''}).ncard, ∃ M ⊆ P_set \ {P, P''}, M.ncard = k := by + intro k + induction k with + | zero => exact fun _ => ⟨∅, empty_subset _, ncard_empty _⟩ + | succ k ih => + intro hk + obtain ⟨M, hM_sub, hM_card⟩ := ih (Nat.le_of_succ_le hk) + have hM_fin : M.Finite := hfin_diff.subset hM_sub + have h_diff_pos : 0 < ((P_set \ {P, P''}) \ M).ncard := by + rw [ncard_sdiff hM_sub hM_fin] + omega + obtain ⟨Q₀, hQ₀_in, hQ₀_not_M⟩ := (ncard_pos hfin_diff.sdiff).mp h_diff_pos + refine ⟨insert Q₀ M, insert_subset hQ₀_in hM_sub, ?_⟩ + rw [ncard_insert_of_notMem hQ₀_not_M hM_fin, hM_card] + obtain ⟨M, hM_sub, hM_card⟩ := hex_sub (p - 1) hcard_diff + have hfin_M : M.Finite := hfin_diff.subset hM_sub + have hR_not_M : R ∉ M := by + intro hRM + exact disjoint_left.mp (hdisj_R R (hM_sub hRM)) hR_ends.1.left_mem hR_ends.1.left_mem + let P_set_c := insert R M + have hcard_c : P_set_c.ncard = p := by + rw [ncard_insert_of_notMem hR_not_M hfin_M, hM_card] + omega + have htrans_c : S.IsTransaction P_set_c := by + refine ⟨A_f, B_f, ⟨?_, ?_⟩, hfence_f, ?_⟩ + · rintro Q (rfl | hQM) + · exact ⟨a, w, hR_ends⟩ + · exact hfence.1.1 Q (hM_sub hQM).1 + · rintro Q₁ (rfl | hQ₁M) Q₂ (rfl | hQ₂M) hne + · exact (hne rfl).elim + · exact hdisj_R Q₂ (hM_sub hQ₂M) + · exact (hdisj_R Q₁ (hM_sub hQ₁M)).symm + · exact hfence.1.2 (hM_sub hQ₁M).1 (hM_sub hQ₂M).1 hne + · rintro Q (rfl | hQM) + · exact ⟨a, ha_Af, w, hw_Bf, hR_ends⟩ + · exact (hR₀_props Q (hM_sub hQM)).1 + have hM_ne : M.Nonempty := (ncard_pos hfin_M).mp (by omega) + obtain ⟨R₀_wit, hR₀_wit⟩ := hM_ne + refine ⟨P_set_c, ⟨htrans_c, ?_⟩, hcard_c⟩ + rintro Q (rfl | hQM) hperQ + · rcases (hR₀_props R₀_wit (hM_sub hR₀_wit)).2 with ⟨hd, s₁, t₁, s₂, t₂, h1, h2, hcr⟩ + exact S.not_omegaPathsCross_of_isPeripheralIn hperQ (Or.inr hR₀_wit) + ⟨hd.symm, s₂, t₂, s₁, t₁, h2, h1, hcr.symm⟩ + · exact S.not_omegaPathsCross_of_isPeripheralIn hperQ (Or.inl rfl) + (hR₀_props Q (hM_sub hQM)).2 + +private theorem connectorDisjointOfPeripheral + {S : Society α β} {P_set : Set (Graph α β)} {P : Graph α β} {a b : α} (hP_in : P ∈ P_set) + (hP_ends : S.IsOmegaPathWithEnds P a b) + (hd_ab : Disjoint (S.Ω.interval a b) (S.transactionEnds P_set)) {P' : Graph α β} + (hP'_not_in : P' ∉ P_set \ {P}) {v : α} {P'' : Graph α β} (hP''_diff : P'' ∈ P_set \ {P}) + {A' B' A B : Set α} (hfence' : S.IsFenceFor (P_set \ {P} ∪ {P'}) A' B') + (hfence : S.IsFenceFor P_set A B) {a'' b'' : α} (hP''_ends : S.IsOmegaPathWithEnds P'' a'' b'') + (hW_bar : (S.transactionEnds P_set) ⊆ S.Ω.bar) (haW : a ∈ A ∩ (S.transactionEnds P_set)) + (hbW : b ∈ B ∩ (S.transactionEnds P_set)) (ha''W : a'' ∈ A ∩ (S.transactionEnds P_set)) + (hb''W : b'' ∈ B ∩ (S.transactionEnds P_set)) + (hd_b''a'' : Disjoint (S.Ω.interval b'' a'') (S.transactionEnds P_set)) + (hU'_eq_inter : S.transactionPeripheralUnion (P_set \ {P} ∪ {P'}) = S.Ω.interval b a ∩ + S.Ω.interval a'' b'') + {u : α} {Q' : Graph α β} + (hQ'_ft : IsFromToPathWithEnds S.G Q' {v} (V(P'') ∪ S.Ω.interval b a) v u) + (hdisj_Q'_P' : Disjoint V(Q') V(P')) + (hno_path_to_U' : ∀ {w : α} {M : Graph α β}, w ∈ S.transactionPeripheralUnion (P_set \ {P} ∪ + {P'}) → IsGraphPathWithEnds S.G M v w → Disjoint V(M) V(P') → Disjoint V(M) V(P'') → + False) + {R₀ : Graph α β} (hR₀_in : R₀ ∈ P_set) (hR₀_not : R₀ ∉ ({P, P''} : Set (Graph α β))) : + Disjoint V(Q') V(R₀) := by + classical + let P_set' := P_set \ {P} ∪ {P'} + let W := S.transactionEnds P_set + rw [mem_insert_iff, mem_singleton_iff, not_or] at hR₀_not + rw [disjoint_left] + intro z hzQ' hzR₀ + obtain ⟨a₀, ha₀A, b₀, hb₀B, hR₀_ends⟩ := hfence.2.2 R₀ hR₀_in + have ha₀W : a₀ ∈ A ∩ W := ⟨ha₀A, hR₀_ends.mem_transactionEnds_left S hR₀_in⟩ + have hdisj_R₀P : Disjoint V(R₀) V(P) := hfence.1.2 hR₀_in hP_in hR₀_not.1 + have hdisj_R₀P'' : Disjoint V(R₀) V(P'') := hfence.1.2 hR₀_in hP''_diff.1 hR₀_not.2 + have hdisj_R₀P' : Disjoint V(R₀) V(P') := hfence'.1.2 (Or.inl ⟨hR₀_in, hR₀_not.1⟩) (Or.inr rfl) + (fun h => hP'_not_in (h ▸ ⟨hR₀_in, hR₀_not.1⟩)) + have ha₀_ne_a : a₀ ≠ a := + fun h => disjoint_left.mp hdisj_R₀P hR₀_ends.1.left_mem (h ▸ hP_ends.1.left_mem) + have ha₀_ne_a'' : a₀ ≠ a'' := + fun h => disjoint_left.mp hdisj_R₀P'' hR₀_ends.1.left_mem (h ▸ hP''_ends.1.left_mem) + have hb_aa₀ : b ∈ S.Ω.interval a a₀ := + (S.Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.2.1 hW_bar haW hbW hd_ab ha₀W ha₀_ne_a hbW).2 + have ha₀_ba : a₀ ∈ S.Ω.interval b a := S.Ω.mem_interval_rotate_left hb_aa₀ + have hb''_a₀a'' : b'' ∈ S.Ω.interval a₀ a'' := + (S.Ω.mem_interval_of_mem_B_of_disjoint_AB hfence.2.1.symm hW_bar hb''W ha''W hd_b''a'' + hb''W ha₀W ha₀_ne_a'').2 + have ha₀_a''b'' : a₀ ∈ S.Ω.interval a'' b'' := S.Ω.mem_interval_rotate_right hb''_a₀a'' + have ha₀_U' : a₀ ∈ S.transactionPeripheralUnion P_set' := + hU'_eq_inter.symm ▸ ⟨ha₀_ba, ha₀_a''b''⟩ + obtain ⟨Q'_vz, Q'_zu, hQ'_vz_le, _, _, hQ'_zu_path, _, hinter_Q', _⟩ := + hQ'_ft.1.exists_split_at hzQ' + obtain ⟨Q'_vz_G, _, _, hQ'_vz_path_G⟩ := + hQ'_ft.1.exists_subpath hQ'_ft.1.left_mem hzQ' + obtain ⟨R₀_za, hR₀_za_le, _, hR₀_za_path_G⟩ := + hR₀_ends.1.exists_subpath hzR₀ hR₀_ends.1.left_mem + have hQ'_vz_eq : Q'_vz_G = Q'_vz := + hQ'_ft.1.subpath_unique_of_left (hQ'_vz_path_G.of_le ‹Q'_vz_G ≤ Q'›) ‹IsGraphPathWithEnds Q' + Q'_vz v z› + have hdisj_vz_P'' : Disjoint V(Q'_vz_G) V(P'') := by + rw [hQ'_vz_eq, disjoint_left] + intro y hy_vz hyP'' + have hyu : y = u := by + have : y ∈ V(Q') ∩ (V(P'') ∪ S.Ω.interval b a) := + ⟨hQ'_vz_le.vertexSet_mono hy_vz, Or.inl hyP''⟩ + rwa [hQ'_ft.2.2, mem_singleton_iff] at this + subst hyu + have hyz : y = z := by + have : y ∈ V(Q'_vz) ∩ V(Q'_zu) := ⟨hy_vz, hQ'_zu_path.right_mem⟩ + rwa [hinter_Q', mem_singleton_iff] at this + exact disjoint_left.mp hdisj_R₀P'' (hyz ▸ hzR₀) hyP'' + obtain ⟨M, hM_path, hVM_sub⟩ := + exists_path_subset_union_of_paths hQ'_vz_path_G hR₀_za_path_G + have hdisj_M_P' : Disjoint V(M) V(P') := + (disjoint_union_left.mpr ⟨hdisj_Q'_P'.mono_left ‹Q'_vz_G ≤ Q'›.vertexSet_mono, + hdisj_R₀P'.mono_left hR₀_za_le.vertexSet_mono⟩).mono_left hVM_sub + have hdisj_M_P'' : Disjoint V(M) V(P'') := + (disjoint_union_left.mpr ⟨hdisj_vz_P'', + hdisj_R₀P''.mono_left hR₀_za_le.vertexSet_mono⟩).mono_left hVM_sub + exact hno_path_to_U' ha₀_U' hM_path hdisj_M_P' hdisj_M_P'' + +/-- **Graph Minors IX, (6.1), Claim (8)** (page 57): +"If $H'$ is a subgraph of $G$ such that $H \subseteq H'$, $\Omega(b, a)$ catches $H'$, and +there is a path of $G$ between $a$ and $b$ avoiding $V(H')$, then $H' = H$." -/ +theorem lemma_6_1_claim_8 {p : ℕ} {P_set : Set (Graph α β)} {P G₁ G₂ H H' : Graph α β} {a b : α} + (hp2 : 2 ≤ p) + (htrans : S.IsTransaction P_set) + (hcard : P_set.ncard = 3 * p + 8) + (hno_int : ∀ R ∈ P_set, Disjoint (pathInternalVerts S.G R) S.Ω.bar) + (hmax : ∀ P_set' : Set (Graph α β), + S.IsTransaction P_set' → + P_set'.ncard = 3 * p + 8 → + (∀ R ∈ P_set', Disjoint (pathInternalVerts S.G R) S.Ω.bar) → + S.coveredComponentUnion P_set ⊆ S.coveredComponentUnion P_set' → + S.coveredComponentUnion P_set = S.coveredComponentUnion P_set') + (hno_crooked : ∀ P_set_c : Set (Graph α β), S.IsCrookedTransaction P_set_c → P_set_c.ncard ≠ p) + (hP_in : P ∈ P_set) + (hP_ends : S.IsOmegaPathWithEnds P a b) + (hd_ab : Disjoint (S.Ω.interval a b) (S.transactionEnds P_set)) + (hsep : IsGraphSeparation S.G G₁ G₂) + (hinter : V(G₁) ∩ V(G₂) = V(P)) + (hab_empty : S.Ω.interval a b = ∅) + (hba_G₂ : S.Ω.interval b a ⊆ V(G₂)) + (hHG : H ≤ S.G) + (hH_del_G : H = deleteVertices S.G V(G₁)) + (hVH : V(H) = V(S.G) \ V(G₁)) + (hG₁_eq : G₁ = deleteVertices S.G V(H)) + (hcatch_H : Catches (S.Ω.interval b a) H) + (hH_le_H' : H ≤ H') + (hH'_le_G : H' ≤ S.G) + (hcatch_H' : Catches (S.Ω.interval b a) H') + (hex_path : ∃ P' : Graph α β, IsGraphPathWithEnds S.G P' a b ∧ Avoids P' V(H')) : + H' = H := by + by_contra hne + obtain ⟨P', hP', hav'⟩ := hex_path + have hdisj_P'_H : Disjoint V(P') V(H) := Disjoint.mono_right hH_le_H'.vertexSet_mono hav'.symm + have hP'_le : P' ≤ G₁ := hG₁_eq ▸ le_deleteVertices hP'.le hdisj_P'_H + have hP'_ends : S.IsOmegaPathWithEnds P' a b := + ⟨hP', hP_ends.2.1, hP_ends.2.2.1, hP_ends.2.2.2⟩ + have hno_int_P' : Disjoint (pathInternalVerts S.G P') S.Ω.bar := by + rw [disjoint_left] + rintro z ⟨hzP', hz_not_ends⟩ hz_bar + rw [hP'.pathEnds_eq, mem_insert_iff, mem_singleton_iff, not_or] at hz_not_ends + rcases S.Ω.mem_interval_or_interval_swap hP_ends.2.2.1 hP_ends.2.2.2 hz_bar + hP_ends.2.1 hz_not_ends.1 hz_not_ends.2 with hz_ab | hz_ba + · exact (hab_empty ▸ hz_ab).elim + · exact disjoint_left.mp hav' (hH_le_H'.vertexSet_mono (hcatch_H.1 hz_ba)) hzP' + have hab_G₁ : S.Ω.interval a b ⊆ V(G₁) := hab_empty ▸ empty_subset _ + let P_set' := (P_set \ {P}) ∪ {P'} + obtain ⟨hP'_not_in, htrans', hcard', hno_int', hW_eq, hper_P', hper_iff, hU_eq, hC_eq⟩ := + S.replacement_same_ends_properties htrans hcard hno_int hmax hP_in hP_ends hd_ab hsep hinter + hab_G₁ hba_G₂ hP'_ends hP'_le hno_int_P' + -- By `H' ≠ H`, obtain `v ∈ V(P)`, `u₀ ∈ S.Ω.interval b a`, and `Q ≤ H'` from `v` to `u₀`. + obtain ⟨v, hvP, u₀, hu₀_ba, Q, hQ_H', hQ_ft⟩ := + S.exists_fromToPath_from_P_to_ba_of_ne hsep hinter hba_G₂ hHG hH_del_G hVH hH_le_H' + hH'_le_G hcatch_H' hne + have hper_P : S.IsPeripheralIn P_set P := ⟨hP_in, a, b, hP_ends, Or.inl hd_ab⟩ + have hv_not_C' : v ∉ S.coveredComponentUnion P_set' := by + rw [← hC_eq] + exact fun hvC => disjoint_left.mp (S.disjoint_coveredComponentUnion_of_isPeripheralIn hP_in + hper_P) + hvC hvP + have hdisj_Q_P' : Disjoint V(Q) V(P') := Disjoint.mono_left hQ_H'.vertexSet_mono hav' + have hcard_ge2 : 2 ≤ P_set.ncard := by omega + have hcard'_ge2 : 2 ≤ P_set'.ncard := by + change 2 ≤ (P_set \ {P} ∪ {P'}).ncard + omega + obtain ⟨_, hU_P'⟩ := + S.peripheralIntervalSet_eq_interval htrans' hcard'_ge2 (Or.inr rfl) hP'_ends (hW_eq ▸ hd_ab) + -- `P_set'` must have a second peripheral member `P'' ∈ P_set \ {P}`. + have hex_P'' : ∃ P'' ∈ P_set \ {P}, S.IsPeripheralIn P_set' P'' := by + by_contra! hno_P'' + have hper_only_P' : ∀ R ∈ P_set', S.IsPeripheralIn P_set' R → R = P' := by + rintro R (hR | rfl) hperR + · exact (hno_P'' R hR hperR).elim + · rfl + have hu₀_U' : u₀ ∈ S.transactionPeripheralUnion P_set' := by + refine ⟨hu₀_ba.1.1, mem_iInter₂.mpr fun R ⟨hR_in, hperR⟩ => ?_⟩ + rcases hper_only_P' R hR_in hperR with rfl + exact hU_P' ▸ hu₀_ba + have hv_in_C' : v ∈ S.coveredComponentUnion P_set' := by + refine ⟨hP_ends.1.le.vertexSet_mono hvP, u₀, hu₀_U', Q, hQ_ft.1, fun R hR_in hperR => ?_⟩ + rcases hper_only_P' R hR_in hperR with rfl + exact hdisj_Q_P'.symm + exact hv_not_C' hv_in_C' + obtain ⟨P'', hP''_diff, hper_P''_in'⟩ := hex_P'' + have hper_P'' : S.IsPeripheralIn P_set P'' := (hper_iff P'' hP''_diff).mp hper_P''_in' + -- Every peripheral member of `P_set'` is either `P'` or `P''`. + obtain ⟨_, _, hfence'⟩ := htrans' + have hper'_eq : ∀ R ∈ P_set', S.IsPeripheralIn P_set' R → R = P' ∨ R = P'' := by + intro R hR_in hperR + by_contra! hne_both + exact hfence'.not_three_peripheral S hper_P' hper_P''_in' hperR + (Ne.symm ( fun h => hP'_not_in (h ▸ hP''_diff) )) + hne_both.1.symm hne_both.2.symm + -- Orient the fence `(A, B)` of `P_set` so `a ∈ A` and `b ∈ B`. + obtain ⟨A₀, B₀, hfence₀⟩ := htrans + have hex_fence_AB : ∃ A B : Set α, S.IsFenceFor P_set A B ∧ a ∈ A ∧ b ∈ B := by + obtain ⟨a₀, ha₀A, b₀, hb₀B, hP₀⟩ := hfence₀.2.2 P hP_in + rcases hP_ends.ends_eq S hP₀ with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨A₀, B₀, hfence₀, ha₀A, hb₀B⟩ + · refine ⟨B₀, A₀, ⟨hfence₀.1, hfence₀.2.1.symm, fun R hR => ?_⟩, hb₀B, ha₀A⟩ + obtain ⟨x, hx, y, hy, hR_xy⟩ := hfence₀.2.2 R hR + exact ⟨y, hy, x, hx, hR_xy.symm S⟩ + obtain ⟨A, B, hfence, haA, hbB⟩ := hex_fence_AB + obtain ⟨a'', ha''A, b'', hb''B, hP''_ends⟩ := hfence.2.2 P'' hP''_diff.1 + let W := S.transactionEnds P_set + have hW_bar : W ⊆ S.Ω.bar := S.transactionEnds_subset_bar P_set + have haW : a ∈ A ∩ W := ⟨haA, hP_ends.mem_transactionEnds_left S hP_in⟩ + have hbW : b ∈ B ∩ W := ⟨hbB, hP_ends.mem_transactionEnds_right S hP_in⟩ + have ha''W : a'' ∈ A ∩ W := ⟨ha''A, hP''_ends.mem_transactionEnds_left S hP''_diff.1⟩ + have hb''W : b'' ∈ B ∩ W := ⟨hb''B, hP''_ends.mem_transactionEnds_right S hP''_diff.1⟩ + have hdisj_PP'' : Disjoint V(P) V(P'') := hfence.1.2 hP_in hP''_diff.1 (Ne.symm hP''_diff.2) + have ha''_ne_a : a'' ≠ a := + fun h => disjoint_left.mp hdisj_PP'' hP_ends.1.left_mem (h ▸ hP''_ends.1.left_mem) + have ha_in_a''b'' : a ∈ S.Ω.interval a'' b'' := + (S.Ω.mem_interval_of_mem_A_of_disjoint_AB hfence.2.1 hW_bar haW hbW hd_ab ha''W ha''_ne_a + hb''W).1 + have hd_b''a'' : Disjoint (S.Ω.interval b'' a'') W := by + rcases (hP''_ends.isPeripheralIn_iff S hP''_diff.1).mp hper_P'' with hd₁ | hd₂ + · exact (disjoint_left.mp hd₁ ha_in_a''b'' haW.2).elim + · exact hd₂ + obtain ⟨_, hU_P''⟩ := S.peripheralIntervalSet_eq_interval ⟨A, B, hfence⟩ hcard_ge2 + hP''_diff.1 (hP''_ends.symm S) hd_b''a'' + have hU_P''_in' : S.peripheralIntervalSet P_set' P'' = S.Ω.interval a'' b'' := by + unfold P_set' peripheralIntervalSet + rw [hW_eq] + exact hU_P'' + have hU'_eq_inter : S.transactionPeripheralUnion P_set' = + S.Ω.interval b a ∩ S.Ω.interval a'' b'' := by + ext x + simp only [transactionPeripheralUnion, mem_inter_iff, mem_iInter, mem_ofPred_eq] + constructor + · intro ⟨_, hx⟩ + exact ⟨hU_P' ▸ hx P' ⟨Or.inr rfl, hper_P'⟩, hU_P''_in' ▸ hx P'' ⟨Or.inl hP''_diff, + hper_P''_in'⟩⟩ + · rintro ⟨hx_ba, hx_a''b''⟩ + refine ⟨hx_ba.1.1, fun R ⟨hR_in, hperR⟩ => ?_⟩ + rcases hper'_eq R hR_in hperR with rfl | rfl + · exact hU_P'.symm ▸ hx_ba + · exact hU_P''_in'.symm ▸ hx_a''b'' + -- Take the minimal subpath `Q' ≤ Q` from `{v}` to `V(P'') ∪ S.Ω.interval b a`. + obtain ⟨v', hv'_eq, u, hu_in, Q', hQ'_Q, hQ'_ft_raw⟩ := + hQ_ft.1.exists_isFromToPathWithEnds (X := {v}) (Y := V(P'') ∪ S.Ω.interval b a) + (mem_singleton v) (Or.inr hu₀_ba) + have hQ'_ft : IsFromToPathWithEnds S.G Q' {v} (V(P'') ∪ S.Ω.interval b a) v u := + mem_singleton_iff.mp hv'_eq ▸ hQ'_ft_raw + have hdisj_Q'_P' : Disjoint V(Q') V(P') := hdisj_Q_P'.mono_left hQ'_Q.vertexSet_mono + have hVQ'_inter_P : V(Q') ∩ V(P) = {v} := by + refine Subset.antisymm (fun z ⟨hzQ', hzP⟩ => ?_) + (singleton_subset_iff.mpr ⟨hQ'_ft.1.left_mem, hvP⟩) + have : z ∈ V(Q) ∩ V(P) := ⟨hQ'_Q.vertexSet_mono hzQ', hzP⟩ + rwa [hQ_ft.2.1] at this + -- Any path in `S.G` from `v` to `U(P_set')` avoiding `V(P')` and `V(P'')` contradicts `v ∉ + -- C(P_set')`. + have hno_path_to_U' : ∀ {w : α} {M : Graph α β}, + w ∈ S.transactionPeripheralUnion P_set' → + IsGraphPathWithEnds S.G M v w → + Disjoint V(M) V(P') → Disjoint V(M) V(P'') → False := by + intro w M hw_U' hM hd_P' hd_P'' + refine hv_not_C' ⟨hP_ends.1.le.vertexSet_mono hvP, w, hw_U', M, hM, fun R hR_in hperR => ?_⟩ + rcases hper'_eq R hR_in hperR with rfl | rfl + · exact hd_P'.symm + · exact hd_P''.symm + -- Deduce `u ∈ V(P'') ∨ u ∈ S.Ω.interval b'' a''`. + have hu_P''_or_b''a'' : u ∈ V(P'') ∨ u ∈ S.Ω.interval b'' a'' := by + by_cases huP'' : u ∈ V(P'') + · exact Or.inl huP'' + · have hu_ba : u ∈ S.Ω.interval b a := hu_in.resolve_left huP'' + have hdisj_Q'_P'' : Disjoint V(Q') V(P'') := by + rw [disjoint_left] + intro z hzQ' hzP'' + have hzu : z = u := by + have : z ∈ V(Q') ∩ (V(P'') ∪ S.Ω.interval b a) := ⟨hzQ', Or.inl hzP''⟩ + rwa [hQ'_ft.2.2, mem_singleton_iff] at this + exact huP'' (hzu ▸ hzP'') + have hu_not_U' : u ∉ S.transactionPeripheralUnion P_set' := + fun hu_U' => hno_path_to_U' hu_U' hQ'_ft.1 hdisj_Q'_P' hdisj_Q'_P'' + have hu_not_a''b'' : u ∉ S.Ω.interval a'' b'' := + fun hu_a''b'' => hu_not_U' (hU'_eq_inter.symm ▸ ⟨hu_ba, hu_a''b''⟩) + have hu_ne_a'' : u ≠ a'' := fun h => huP'' (h ▸ hP''_ends.1.left_mem) + have hu_ne_b'' : u ≠ b'' := fun h => huP'' (h ▸ hP''_ends.1.right_mem) + exact Or.inr ((S.Ω.mem_interval_or_interval_swap hP''_ends.2.2.1 hP''_ends.2.2.2 hu_ba.1.1 + hP''_ends.2.1 hu_ne_a'' hu_ne_b'').resolve_left hu_not_a''b'') + -- Deduce `Disjoint V(Q') V(R₀)` for every `R₀ ∈ P_set \ {P, P''}`. + have hdisj_Q'_R₀ : ∀ R₀ ∈ P_set \ {P, P''}, Disjoint V(Q') V(R₀) := by + intro R₀ ⟨hR₀_in, hR₀_not⟩ + exact connectorDisjointOfPeripheral hP_in hP_ends hd_ab hP'_not_in hP''_diff hfence' hfence + hP''_ends hW_bar haW hbW ha''W hb''W hd_b''a'' hU'_eq_inter hQ'_ft hdisj_Q'_P' + hno_path_to_U' hR₀_in hR₀_not + -- Construct `(R, w)` with `w ∈ {b''} ∪ S.Ω.interval b'' a''` and `S.IsOmegaPathWithEnds R a w`. + obtain ⟨P_av, hP_av_le, _, hP_av_G⟩ := hP_ends.1.exists_subpath hP_ends.1.left_mem hvP + have hinter_av_Q' : V(P_av) ∩ V(Q') = {v} := by + refine Subset.antisymm (fun z ⟨hz_av, hzQ'⟩ => ?_) + (singleton_subset_iff.mpr ⟨hP_av_G.right_mem, hQ'_ft.1.left_mem⟩) + have : z ∈ V(Q') ∩ V(P) := ⟨hzQ', hP_av_le.vertexSet_mono hz_av⟩ + rwa [hVQ'_inter_P] at this + let R₁ := subgraphUnion S.G P_av Q' + have hR₁_G : IsGraphPathWithEnds S.G R₁ a u := hP_av_G.subgraphUnion hQ'_ft.1 hinter_av_Q' + have hex_R : ∃ R : Graph α β, ∃ w ∈ ({b''} : Set α) ∪ S.Ω.interval b'' a'', + S.IsOmegaPathWithEnds R a w ∧ + ∀ R₀ ∈ P_set \ {P, P''}, Disjoint V(R) V(R₀) := by + rcases hu_P''_or_b''a'' with huP'' | hu_b''a'' + · obtain ⟨P''_ub'', hP''_ub''_le, _, hP''_ub''_G⟩ := + hP''_ends.1.exists_subpath huP'' hP''_ends.1.right_mem + have hinter_R₁_ub'' : V(R₁) ∩ V(P''_ub'') = {u} := by + refine Subset.antisymm (fun z ⟨hzR₁, hz_ub''⟩ => ?_) + (singleton_subset_iff.mpr ⟨hR₁_G.right_mem, hP''_ub''_G.left_mem⟩) + have hzP'' : z ∈ V(P'') := hP''_ub''_le.vertexSet_mono hz_ub'' + rcases (vertexSet_subgraphUnion S.G P_av Q' ▸ hzR₁ : z ∈ V(P_av) ∪ V(Q')) with hz_av | hzQ' + · exact (disjoint_left.mp hdisj_PP'' (hP_av_le.vertexSet_mono hz_av) hzP'').elim + · have : z ∈ V(Q') ∩ (V(P'') ∪ S.Ω.interval b a) := ⟨hzQ', Or.inl hzP''⟩ + rwa [hQ'_ft.2.2] at this + let R := subgraphUnion S.G R₁ P''_ub'' + have hR_G : IsGraphPathWithEnds S.G R a b'' := hR₁_G.subgraphUnion hP''_ub''_G hinter_R₁_ub'' + have ha_ne_b'' : a ≠ b'' := + fun h => disjoint_left.mp hdisj_PP'' hP_ends.1.left_mem (h ▸ hP''_ends.1.right_mem) + refine ⟨R, b'', Or.inl rfl, ⟨hR_G, ha_ne_b'', hP_ends.2.2.1, hP''_ends.2.2.2⟩, + fun R₀ hR₀ => ?_⟩ + have hR₀_not := hR₀.2 + rw [mem_insert_iff, mem_singleton_iff, not_or] at hR₀_not + rw [vertexSet_subgraphUnion, vertexSet_subgraphUnion, disjoint_union_left, + disjoint_union_left] + exact ⟨⟨(hfence.1.2 hP_in hR₀.1 (Ne.symm hR₀_not.1)).mono_left hP_av_le.vertexSet_mono, + hdisj_Q'_R₀ R₀ hR₀⟩, + (hfence.1.2 hP''_diff.1 hR₀.1 (Ne.symm hR₀_not.2)).mono_left hP''_ub''_le.vertexSet_mono⟩ + · have ha_ne_u : a ≠ u := + fun h => disjoint_left.mp hd_b''a'' (h ▸ hu_b''a'') haW.2 + refine ⟨R₁, u, Or.inr hu_b''a'', ⟨hR₁_G, ha_ne_u, hP_ends.2.2.1, hu_b''a''.1.1⟩, + fun R₀ hR₀ => ?_⟩ + have hR₀_not := hR₀.2 + rw [mem_insert_iff, mem_singleton_iff, not_or] at hR₀_not + rw [vertexSet_subgraphUnion, disjoint_union_left] + exact ⟨(hfence.1.2 hP_in hR₀.1 (Ne.symm hR₀_not.1)).mono_left hP_av_le.vertexSet_mono, + hdisj_Q'_R₀ R₀ hR₀⟩ + obtain ⟨R, w, hw_in, hR_ends, hdisj_R⟩ := hex_R + obtain ⟨P_set_c, hcr_c, hcard_c⟩ := + S.exists_crooked_of_leap_path hp2 hfence hcard hP_in hP''_diff haA hbB hP_ends ha''A hb''B + hP''_ends hd_ab hd_b''a'' hw_in hR_ends hdisj_R + exact hno_crooked P_set_c hcr_c hcard_c + +/-- Deduction of `G₁ = P` from `(7)`, `(8)`, and `(2.1)` (`theorem_2_1_proof`, Graph Minors IX, +Section 6, +page 57: +"As $H = G_2 \setminus V(G_1)$ and $G_1$ is induced, it follows that $G_1 = G \setminus +V(H)$. Hence, if $G_1 \ne P$, then by (2.1) there would be a separation $(J_1, J_2)$ of $G$ +with $\{a, b\} \subseteq V(J_1)$, $|V(J_1 \cap J_2)| = 2$, $H \subseteq J_1$ and $V(J_1) \ne +V(G)$. But then $(J_2, J_1)$ would by (7) be a separation of $(G, \Omega)$, contradicting +the 3-connectedness of $(G, \Omega)$. It follows that $G_1 = P$."). -/ +theorem eq_path_of_claim_7_and_8 {P G₁ H : Graph α β} {a b : α} + (hconn3 : S.IsKConnected 3) + (hsimple : IsSimpleGraph S.G) + (hP_ends : S.IsOmegaPathWithEnds P a b) + (hHG : H ≤ S.G) + (hG₁_eq : G₁ = deleteVertices S.G V(H)) + (hPG₁ : IsGraphPathWithEnds G₁ P a b) + (hab_empty : S.Ω.interval a b = ∅) + (hcatch_H : Catches (S.Ω.interval b a) H) + (hclaim8 : ∀ H' : Graph α β, H ≤ H' → H' ≤ S.G → Catches (S.Ω.interval b a) H' → + (∃ Q : Graph α β, IsGraphPathWithEnds S.G Q a b ∧ Avoids Q V(H')) → H' = H) : + P = G₁ := by + have hPG_del : IsGraphPathWithEnds (deleteVertices S.G V(H)) P a b := hG₁_eq ▸ hPG₁ + have hloopless : ∀ x : α, ¬ S.G.Adj x x := fun x ⟨e, he⟩ => hsimple.1 e he.edge_mem x he + have hsimple' : ∀ e₁ e₂ x y, S.G.IsLink e₁ x y → S.G.IsLink e₂ x y → e₁ = e₂ := + fun e₁ e₂ x y h1 h2 => hsimple.2 e₁ h1.edge_mem e₂ h2.edge_mem x y h1 h2 + rcases theorem_2_1_proof hloopless hsimple' hP_ends.2.1 hHG hcatch_H hclaim8 hPG_del with + h_eq | ⟨J₁, J₂, hsep_J, hab_J₁, hcard_J, _, _, hH_J₁, hVJ₁_ne⟩ + · exact hG₁_eq ▸ h_eq + · exfalso + have hbar_J₁ : S.Ω.bar ⊆ V(J₁) := by + intro z hz_bar + by_cases hza : z = a + · exact hab_J₁ (Or.inl hza) + · by_cases hzb : z = b + · exact hab_J₁ (Or.inr hzb) + · rcases S.Ω.mem_interval_or_interval_swap hP_ends.2.2.1 hP_ends.2.2.2 hz_bar + hP_ends.2.1 hza hzb with hz_ab | hz_ba + · rw [hab_empty] at hz_ab + exact hz_ab.elim + · exact hH_J₁.vertexSet_mono (hcatch_H.1 hz_ba) + have hsep_soc : S.IsSocietySeparation J₂ J₁ := ⟨IsGraphSeparation.symm hsep_J, hbar_J₁⟩ + have hcard_J' : (V(J₂) ∩ V(J₁)).ncard ≤ 2 := by + rw [inter_comm, hcard_J] + exact hconn3 2 (by decide) J₂ J₁ ⟨hsep_soc, hcard_J', hVJ₁_ne⟩ + +/-- **Graph Minors IX, (6.1), Claim (9)** (page 57): +"If $P \in \mathcal{P}$ is peripheral and separating, with ends $a, b$ where $\Omega(a, b) +\cap V(\mathcal{P}) = \emptyset$, then $\Omega(a, b) = \emptyset$, $P$ is induced, and +$\Omega(b, a)$ catches $G \setminus V(P)$." -/ +theorem lemma_6_1_claim_9 {p : ℕ} {P_set : Set (Graph α β)} {P : Graph α β} {a b : α} + (hp2 : 2 ≤ p) + (hconn3 : S.IsKConnected 3) + (hno_crooked : ∀ P_set_c : Set (Graph α β), S.IsCrookedTransaction P_set_c → P_set_c.ncard ≠ p) + (hsimple : IsSimpleGraph S.G) + (hno_iso : ∀ v ∈ S.Ω.bar, ∃ u : α, S.G.Adj v u) + (htrans : S.IsTransaction P_set) + (hcard : P_set.ncard = 3 * p + 8) + (hno_int : ∀ R ∈ P_set, Disjoint (pathInternalVerts S.G R) S.Ω.bar) + (hmax : ∀ P_set' : Set (Graph α β), + S.IsTransaction P_set' → + P_set'.ncard = 3 * p + 8 → + (∀ R ∈ P_set', Disjoint (pathInternalVerts S.G R) S.Ω.bar) → + S.coveredComponentUnion P_set ⊆ S.coveredComponentUnion P_set' → + S.coveredComponentUnion P_set = S.coveredComponentUnion P_set') + (hP_in : P ∈ P_set) + (hP_sep : S.IsSeparatingOmegaPath P) + (hP_ends : S.IsOmegaPathWithEnds P a b) + (hd_ab : Disjoint (S.Ω.interval a b) (S.transactionEnds P_set)) : + S.Ω.interval a b = ∅ ∧ + P = S.G.induce V(P) ∧ + Catches (S.Ω.interval b a) (deleteVertices S.G V(P)) := by + have hno_intP : Disjoint (pathInternalVerts S.G P) S.Ω.bar := hno_int P hP_in + obtain ⟨G₁, G₂, H, hsep, hinter, hP_G₁, hab_G₁, hba_G₂, hHG, _, hH_del_G, + hVH, hG₁_eq, hcatch_H⟩ := + S.exists_minimal_separation_of_separating hP_ends hP_sep hno_intP + have hloopless : ∀ x : α, ¬ S.G.Adj x x := fun x ⟨e, he⟩ => hsimple.1 e he.edge_mem x he + have hclaim6 : ∀ P' : Graph α β, S.IsOmegaPath P' → P' ≤ G₁ → S.IsOmegaPathWithEnds P' a b := + fun P' hP'_omega hP'_le => + S.lemma_6_1_claim_6 htrans hcard hno_int hmax hP_in hP_ends hd_ab hsep hinter + hab_G₁ hba_G₂ hP'_omega hP'_le + have hab_empty : S.Ω.interval a b = ∅ := + S.lemma_6_1_claim_7 hconn3 hloopless hno_iso hP_ends hno_intP hsep hinter hP_G₁ + hab_G₁ hclaim6 + have hclaim8 : ∀ H' : Graph α β, H ≤ H' → H' ≤ S.G → Catches (S.Ω.interval b a) H' → + (∃ Q : Graph α β, IsGraphPathWithEnds S.G Q a b ∧ Avoids Q V(H')) → H' = H := + fun H' hH_le_H' hH'_le_G hcatch_H' hex_path => + S.lemma_6_1_claim_8 hp2 htrans hcard hno_int hmax hno_crooked + hP_in hP_ends hd_ab hsep hinter hab_empty hba_G₂ hHG hH_del_G hVH + hG₁_eq hcatch_H hH_le_H' hH'_le_G hcatch_H' hex_path + have hPG₁ : IsGraphPathWithEnds G₁ P a b := hP_ends.1.of_le hP_G₁ + have hP_eq_G₁ : P = G₁ := + S.eq_path_of_claim_7_and_8 hconn3 hsimple hP_ends hHG hG₁_eq hPG₁ hab_empty hcatch_H hclaim8 + have hVP_eq : V(P) = V(G₁) := congrArg vertexSet hP_eq_G₁ + have hP_ind : P = S.G.induce V(P) := by + have hV_diff : V(S.G) \ V(H) = V(P) := by + rw [hVH, hVP_eq, sdiff_sdiff_right_self, + inter_eq_right.mpr (hG₁_eq ▸ deleteVertices_le S.G V(H)).vertexSet_mono] + calc + P = G₁ := hP_eq_G₁ + _ = S.G.induce (V(S.G) \ V(H)) := hG₁_eq + _ = S.G.induce V(P) := by rw [hV_diff] + have hH_eq_delP : deleteVertices S.G V(P) = H := by + rw [hH_del_G, hVP_eq] + exact ⟨hab_empty, hP_ind, hH_eq_delP ▸ hcatch_H⟩ + +/-! ## Statement `S_t` and the inductive proof of (6.1) (page 58) -/ + +/-- **Graph Minors IX, Section 6, Statement `S_t`** (page 58): +"For an integer $t$ with $0 \le t \le 2$, let $\mathbf{S}_t$ be the following statement. +*Statement* $\mathbf{S}_t$. *The society $(G, \Omega)$ has a transaction $\mathcal{P}_t$ +with $|\mathcal{P}_t| \ge 3p + 8 - t(p + 4)$ and with at most $2 - t$ peripheral separating +members. Moreover, every separating member of $\mathcal{P}_t$ is in $\mathcal{P}$, and every +peripheral separating member of $\mathcal{P}_t$ is peripheral in $\mathcal{P}$." -/ +def StatementSt (p : ℕ) (P_set : Set (Graph α β)) (t : ℕ) : Prop := + ∃ P_set_t : Set (Graph α β), + S.IsTransaction P_set_t ∧ + 3 * p + 8 - t * (p + 4) ≤ P_set_t.ncard ∧ + {P ∈ P_set_t | S.IsPeripheralIn P_set_t P ∧ S.IsSeparatingOmegaPath P}.ncard ≤ 2 - t ∧ + (∀ P ∈ P_set_t, S.IsSeparatingOmegaPath P → P ∈ P_set) ∧ + (∀ P ∈ P_set_t, S.IsPeripheralIn P_set_t P → S.IsSeparatingOmegaPath P → + S.IsPeripheralIn P_set P) + +/-- Any transaction `P_set` in `S` has at most 2 peripheral members. -/ +theorem ncard_peripheral_le_two {P_set : Set (Graph α β)} (htrans : S.IsTransaction P_set) : + {P ∈ P_set | S.IsPeripheralIn P_set P}.ncard ≤ 2 := by + classical + obtain ⟨A, B, hfence⟩ := htrans + have hfin : {P ∈ P_set | S.IsPeripheralIn P_set P}.Finite := + (hfence.1.finite S).subset fun _ h => h.1 + by_contra hgt + have hge3 : 3 ≤ {P ∈ P_set | S.IsPeripheralIn P_set P}.ncard := by omega + obtain ⟨P₁, hP₁⟩ : {P ∈ P_set | S.IsPeripheralIn P_set P}.Nonempty := + (ncard_pos hfin).mp (by omega) + have hfin₁ : ({P ∈ P_set | S.IsPeripheralIn P_set P} \ {P₁}).Finite := hfin.sdiff + have hcard₁ : 2 ≤ ({P ∈ P_set | S.IsPeripheralIn P_set P} \ {P₁}).ncard := by + have := ncard_sdiff_singleton_of_mem hP₁ + omega + obtain ⟨P₂, hP₂_mem⟩ : ({P ∈ P_set | S.IsPeripheralIn P_set P} \ {P₁}).Nonempty := + (ncard_pos hfin₁).mp (by omega) + rcases hP₂_mem with ⟨hP₂, hP₂_ne₁⟩ + have hfin₂ : (({P ∈ P_set | S.IsPeripheralIn P_set P} \ {P₁}) \ {P₂}).Finite := hfin₁.sdiff + have hcard₂ : 1 ≤ (({P ∈ P_set | S.IsPeripheralIn P_set P} \ {P₁}) \ {P₂}).ncard := by + have := ncard_sdiff_singleton_of_mem (s := {P ∈ P_set | S.IsPeripheralIn P_set P} \ {P₁}) + ⟨hP₂, hP₂_ne₁⟩ + omega + obtain ⟨P₃, hP₃_mem⟩ : + (({P ∈ P_set | S.IsPeripheralIn P_set P} \ {P₁}) \ {P₂}).Nonempty := + (ncard_pos hfin₂).mp (by omega) + rcases hP₃_mem with ⟨⟨hP₃, hP₃_ne₁⟩, hP₃_ne₂⟩ + exact hfence.not_three_peripheral S hP₁.2 hP₂.2 hP₃.2 + (Ne.symm (mem_singleton_iff.not.mp hP₂_ne₁)) + (Ne.symm (mem_singleton_iff.not.mp hP₃_ne₁)) + (Ne.symm (mem_singleton_iff.not.mp hP₃_ne₂)) + +/-- Base case `t = 0` of Statement `S_t` (Graph Minors IX, Section 6, page 58: +"Now $\mathbf{S}_0$ is true, with $\mathcal{P}_0 = \mathcal{P}$."). -/ +theorem statementSt_zero {p : ℕ} {P_set : Set (Graph α β)} + (htrans : S.IsTransaction P_set) + (hcard : P_set.ncard = 3 * p + 8) : + S.StatementSt p P_set 0 := by + have htrans' : S.IsTransaction P_set := htrans + obtain ⟨A, B, hfence⟩ := htrans + have hfin_per : {P ∈ P_set | S.IsPeripheralIn P_set P}.Finite := + (hfence.1.finite S).subset fun _ h => h.1 + have hsub_per : + {P ∈ P_set | S.IsPeripheralIn P_set P ∧ S.IsSeparatingOmegaPath P} ⊆ + {P ∈ P_set | S.IsPeripheralIn P_set P} := + fun _ hP => ⟨hP.1, hP.2.1⟩ + have hle2 : {P ∈ P_set | S.IsPeripheralIn P_set P ∧ S.IsSeparatingOmegaPath P}.ncard ≤ 2 := + (ncard_le_ncard hsub_per hfin_per).trans (S.ncard_peripheral_le_two htrans') + refine ⟨P_set, htrans', by omega, hle2, fun _ hP _ => hP, fun _ _ hper _ => hper⟩ + +/-- Inductive step `S_t → S_{t+1}` for `t < 2` (Graph Minors IX, Section 6, page 58: +"We shall show that for $t = 0$ or $t = 1$, if $\mathbf{S}_t$ is true then $\mathbf{S}_{t+1}$ +is true."). -/ +theorem statementSt_succ {p t : ℕ} {P_set : Set (Graph α β)} + (_ht : t < 2) + (hSt : S.StatementSt p P_set t) + (hstep_of_peripheral_sep : ∀ P_set_t : Set (Graph α β), + S.IsTransaction P_set_t → + 3 * p + 8 - t * (p + 4) ≤ P_set_t.ncard → + {P ∈ P_set_t | S.IsPeripheralIn P_set_t P ∧ S.IsSeparatingOmegaPath P}.ncard ≤ 2 - t → + (∀ P ∈ P_set_t, S.IsSeparatingOmegaPath P → P ∈ P_set) → + (∀ P ∈ P_set_t, S.IsPeripheralIn P_set_t P → S.IsSeparatingOmegaPath P → + S.IsPeripheralIn P_set P) → + (∃ P₁ ∈ P_set_t, S.IsPeripheralIn P_set_t P₁ ∧ S.IsSeparatingOmegaPath P₁) → + S.StatementSt p P_set (t + 1)) : + S.StatementSt p P_set (t + 1) := by + obtain ⟨P_set_t, htrans_t, hcard_t, hper_card_t, hsep_mem_t, hper_sep_t⟩ := hSt + by_cases hex_per_sep : ∃ P₁ ∈ P_set_t, S.IsPeripheralIn P_set_t P₁ ∧ S.IsSeparatingOmegaPath P₁ + · -- `P_set_t` has a peripheral separating member `P₁`. + exact hstep_of_peripheral_sep P_set_t htrans_t hcard_t hper_card_t hsep_mem_t hper_sep_t + hex_per_sep + · -- `P_set_t` has no peripheral separating members; set `P_set_{t+1} = P_set_t`. + push Not at hex_per_sep + have hempty : {P ∈ P_set_t | S.IsPeripheralIn P_set_t P ∧ S.IsSeparatingOmegaPath P} = ∅ := by + ext P + simp only [mem_ofPred_eq, mem_empty_iff_false, iff_false, not_and] + exact fun hP hper => hex_per_sep P hP hper + have hcard_next : 3 * p + 8 - (t + 1) * (p + 4) ≤ P_set_t.ncard := + (Nat.sub_le_sub_left (Nat.mul_le_mul_right (p + 4) (Nat.le_succ t)) (3 * p + 8)).trans hcard_t + refine ⟨P_set_t, htrans_t, hcard_next, ?_, hsep_mem_t, hper_sep_t⟩ + rw [hempty, ncard_empty] + omega + +/-- In the inductive step `S_t → S_{t+1}`, if `P_set_t = {P₁, …, P_n}` is enumerated in order with +`P₁` peripheral and separating, and some `P_j` (`2 ≤ j ≤ p + 5`) is non-separating, then +`P_set_{t+1} = {P_j, P_{p+6}, …, P_n}` satisfies `S_{t+1}` (Graph Minors IX, Section 6, page 58: +"If one of $P_2, \dots, P_{p+5}$ is non-separating (say $P_j$), then we may set +$\mathcal{P}_{t+1}$ to be $\{P_j, P_{p+6}, P_{p+7}, \dots, P_n\}$."). -/ +theorem statementSt_succ_of_nonSeparating_member {p t : ℕ} {P_set P_set_t P_set_next : Set + (Graph α β)} + {P₁ P_j : Graph α β} + (ht : t < 2) + (htrans_t : S.IsTransaction P_set_t) + (hP₁_in : P₁ ∈ P_set_t) + (hP₁_per : S.IsPeripheralIn P_set_t P₁) + (hP₁_sep : S.IsSeparatingOmegaPath P₁) + (hper_card_t : + {P ∈ P_set_t | S.IsPeripheralIn P_set_t P ∧ S.IsSeparatingOmegaPath P}.ncard ≤ 2 - t) + (hsep_mem_t : ∀ P ∈ P_set_t, S.IsSeparatingOmegaPath P → P ∈ P_set) + (hper_sep_t : ∀ P ∈ P_set_t, S.IsPeripheralIn P_set_t P → S.IsSeparatingOmegaPath P → + S.IsPeripheralIn P_set P) + (hsub_next : P_set_next ⊆ P_set_t) + (hP₁_not_next : P₁ ∉ P_set_next) + (_hPj_in_next : P_j ∈ P_set_next) + (hPj_nonsep : S.IsNonSeparatingOmegaPath P_j) + (htrans_next : S.IsTransaction P_set_next) + (hcard_next : 3 * p + 8 - (t + 1) * (p + 4) ≤ P_set_next.ncard) + (hper_next_sub : ∀ R ∈ P_set_next, S.IsPeripheralIn P_set_next R → + S.IsSeparatingOmegaPath R → R = P_j ∨ S.IsPeripheralIn P_set_t R) : + S.StatementSt p P_set (t + 1) := by + have _ := ht + obtain ⟨_, _, hfence_t⟩ := htrans_t + have hfin_t : P_set_t.Finite := hfence_t.1.finite S + have hfin_per_t : {P ∈ P_set_t | S.IsPeripheralIn P_set_t P ∧ S.IsSeparatingOmegaPath P}.Finite := + hfin_t.subset fun _ h => h.1 + have hsub_per_sep : + {P ∈ P_set_next | S.IsPeripheralIn P_set_next P ∧ S.IsSeparatingOmegaPath P} ⊆ + {P ∈ P_set_t | S.IsPeripheralIn P_set_t P ∧ S.IsSeparatingOmegaPath P} \ {P₁} := by + rintro R ⟨hR_next, hR_per_next, hR_sep⟩ + refine ⟨⟨hsub_next hR_next, ?_, hR_sep⟩, fun h_eq => hP₁_not_next + (mem_singleton_iff.mp h_eq ▸ hR_next)⟩ + rcases hper_next_sub R hR_next hR_per_next hR_sep with rfl | hR_per_t + · exact (hR_sep.2 hPj_nonsep.2).elim + · exact hR_per_t + have hP₁_mem_per_t : + P₁ ∈ {P ∈ P_set_t | S.IsPeripheralIn P_set_t P ∧ S.IsSeparatingOmegaPath P} := + ⟨hP₁_in, hP₁_per, hP₁_sep⟩ + have hcard_per_next : + {P ∈ P_set_next | S.IsPeripheralIn P_set_next P ∧ S.IsSeparatingOmegaPath P}.ncard ≤ + 2 - (t + 1) := by + have hle := ncard_le_ncard hsub_per_sep hfin_per_t.sdiff + have hdiff := ncard_sdiff_singleton_of_mem hP₁_mem_per_t + omega + refine ⟨P_set_next, htrans_next, hcard_next, hcard_per_next, + fun R hR hsep => hsep_mem_t R (hsub_next hR) hsep, + fun R hR hperR hsepR => ?_⟩ + rcases hper_next_sub R hR hperR hsepR with rfl | hperR_t + · exact (hsepR.2 hPj_nonsep.2).elim + · exact hper_sep_t R (hsub_next hR) hperR_t hsepR + +/-- In the inductive step `S_t → S_{t+1}`, when `P₁, …, P_{p+5}` are all separating, applying `(9)` +and `(5.5)` produces a non-separating `Ω`-path `P' ≤ G₁` disjoint from `P_{p+6}, …, P_n` such that +`P_set_{t+1} = {P', P_{p+6}, …, P_n}` satisfies `S_{t+1}` (Graph Minors IX, Section 6, page 58: +"By applying (5.5) to the transaction $\{P_1, \dots, P_{p+5}\}$ in $(G, \Omega)$ (which is +possible by (9)) we deduce that there is a non-separating path $P'$ of $(G, \Omega)$ with +$P' \subseteq G_1$. Thus we may set $\mathcal{P}_{t+1} = \{P', P_{p+6}, \dots, P_n\}$ and +$\mathbf{S}_{t+1}$ is true."). -/ +theorem statementSt_succ_of_replacement_nonSeparating {p t : ℕ} + {P_set P_set_t P_rest : Set (Graph α β)} {P₁ P' : Graph α β} + (_ht : t < 2) + (htrans_t : S.IsTransaction P_set_t) + (hP₁_in : P₁ ∈ P_set_t) + (hP₁_per : S.IsPeripheralIn P_set_t P₁) + (hP₁_sep : S.IsSeparatingOmegaPath P₁) + (hper_card_t : + {P ∈ P_set_t | S.IsPeripheralIn P_set_t P ∧ S.IsSeparatingOmegaPath P}.ncard ≤ 2 - t) + (hsep_mem_t : ∀ P ∈ P_set_t, S.IsSeparatingOmegaPath P → P ∈ P_set) + (hper_sep_t : ∀ P ∈ P_set_t, S.IsPeripheralIn P_set_t P → S.IsSeparatingOmegaPath P → + S.IsPeripheralIn P_set P) + (hrest_sub : P_rest ⊆ P_set_t \ {P₁}) + (hP'_nonsep : S.IsNonSeparatingOmegaPath P') + (htrans_next : S.IsTransaction (insert P' P_rest)) + (hcard_next : 3 * p + 8 - (t + 1) * (p + 4) ≤ (insert P' P_rest).ncard) + (hper_next_sub : ∀ R ∈ insert P' P_rest, S.IsPeripheralIn (insert P' P_rest) R → + S.IsSeparatingOmegaPath R → R = P' ∨ S.IsPeripheralIn P_set_t R) : + S.StatementSt p P_set (t + 1) := by + obtain ⟨_, _, hfence_t⟩ := htrans_t + have hfin_t : P_set_t.Finite := hfence_t.1.finite S + have hfin_per_t : {P ∈ P_set_t | S.IsPeripheralIn P_set_t P ∧ S.IsSeparatingOmegaPath P}.Finite := + hfin_t.subset fun _ h => h.1 + have hsub_per_sep : + {P ∈ insert P' P_rest | S.IsPeripheralIn (insert P' P_rest) P ∧ S.IsSeparatingOmegaPath P} ⊆ + {P ∈ P_set_t | S.IsPeripheralIn P_set_t P ∧ S.IsSeparatingOmegaPath P} \ {P₁} := by + rintro R ⟨hR_in, hR_per_next, hR_sep⟩ + rcases mem_insert_iff.mp hR_in with rfl | hR_rest + · exact (hR_sep.2 hP'_nonsep.2).elim + · have hR_diff := hrest_sub hR_rest + refine ⟨⟨hR_diff.1, ?_, hR_sep⟩, hR_diff.2⟩ + rcases hper_next_sub R hR_in hR_per_next hR_sep with rfl | hR_per_t + · exact (hR_sep.2 hP'_nonsep.2).elim + · exact hR_per_t + have hP₁_mem_per_t : + P₁ ∈ {P ∈ P_set_t | S.IsPeripheralIn P_set_t P ∧ S.IsSeparatingOmegaPath P} := + ⟨hP₁_in, hP₁_per, hP₁_sep⟩ + have hcard_per_next : + {P ∈ insert P' P_rest | + S.IsPeripheralIn (insert P' P_rest) P ∧ S.IsSeparatingOmegaPath P}.ncard ≤ + 2 - (t + 1) := by + have hle := ncard_le_ncard hsub_per_sep hfin_per_t.sdiff + have hdiff := ncard_sdiff_singleton_of_mem hP₁_mem_per_t + omega + refine ⟨insert P' P_rest, htrans_next, hcard_next, hcard_per_next, + fun R hR hsepR => ?_, fun R hR hperR hsepR => ?_⟩ + · rcases mem_insert_iff.mp hR with rfl | hR_rest + · exact (hsepR.2 hP'_nonsep.2).elim + · exact hsep_mem_t R (hrest_sub hR_rest).1 hsepR + · rcases hper_next_sub R hR hperR hsepR with rfl | hperR_t + · exact (hsepR.2 hP'_nonsep.2).elim + · rcases mem_insert_iff.mp hR with rfl | hR_rest + · exact (hsepR.2 hP'_nonsep.2).elim + · exact hper_sep_t R (hrest_sub hR_rest).1 hperR_t hsepR + +/-- Applying `statementSt_succ` twice from `statementSt_zero` yields `S₂` +(Graph Minors IX, Section 6, page 58: "We deduce that `S₂` is true."). -/ +theorem statementSt_two {p : ℕ} {P_set : Set (Graph α β)} + (htrans : S.IsTransaction P_set) + (hcard : P_set.ncard = 3 * p + 8) + (hstep : ∀ t < 2, S.StatementSt p P_set t → S.StatementSt p P_set (t + 1)) : + S.StatementSt p P_set 2 := by + have h0 : S.StatementSt p P_set 0 := S.statementSt_zero htrans hcard + have h1 : S.StatementSt p P_set 1 := hstep 0 (by decide) h0 + exact hstep 1 (by decide) h1 + +/-- From `S₂`, `(4.1)` (`theorem_4_1_proof`), and `(3.4)` (`theorem_3_4_proof`), `(G, Ω)` has a +crooked +transaction of cardinality `p` (Graph Minors IX, Section 6, page 58: +"We deduce that $\mathbf{S}_2$ is true. But every peripheral member of $\mathcal{P}_2$ is +non-separating and $|\mathcal{P}_2| \ge p$, and so $(G, \Omega)$ has a crooked transaction +with cardinality $p$, by (4.1) and (3.4)."). -/ +theorem exists_crooked_of_statementSt_two {p : ℕ} {P_set : Set (Graph α β)} + (hp2 : 2 ≤ p) (hp3 : p ≠ 3) + (hS₂ : S.StatementSt p P_set 2) : + ∃ P_set' : Set (Graph α β), S.IsCrookedTransaction P_set' ∧ P_set'.ncard = p := by + obtain ⟨P_set₂, htrans₂, hcard₂, hper_card₂, _, _⟩ := hS₂ + have hcard₂_ge_p : p ≤ P_set₂.ncard := by omega + obtain ⟨A, B, hfence₂⟩ := htrans₂ + have hfin₂ : P_set₂.Finite := hfence₂.1.finite S + have hfin_per_sep : + {P ∈ P_set₂ | S.IsPeripheralIn P_set₂ P ∧ S.IsSeparatingOmegaPath P}.Finite := + hfin₂.subset fun _ h => h.1 + have hper_nonsep : ∀ P ∈ P_set₂, S.IsPeripheralIn P_set₂ P → S.IsNonSeparatingOmegaPath P := by + intro P hP_in hperP + have hP_omega : S.IsOmegaPath P := hfence₂.1.1 P hP_in + by_cases hcross : ∃ P' : Graph α β, S.OmegaPathsCross P' P + · exact ⟨hP_omega, hcross⟩ + · exfalso + have hsepP : S.IsSeparatingOmegaPath P := ⟨hP_omega, hcross⟩ + have hpos : 0 < {Q ∈ P_set₂ | S.IsPeripheralIn P_set₂ Q ∧ S.IsSeparatingOmegaPath Q}.ncard := + (ncard_pos hfin_per_sep).mpr ⟨P, hP_in, hperP, hsepP⟩ + omega + obtain ⟨P_set_cr, hcr, hcard_cr⟩ := S.theorem_4_1_proof ⟨A, B, hfence₂⟩ hper_nonsep + obtain ⟨P_set', _, hcard', hcr'⟩ := S.theorem_3_4_proof hp2 hp3 hcr (hcard₂_ge_p.trans hcard_cr) + exact ⟨P_set', hcr', hcard'⟩ + +end Society + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section6b.lean b/LeanPool/GraphMinor/GM09/Section6b.lean new file mode 100644 index 0000000000..4fd1dcf16c --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section6b.lean @@ -0,0 +1,712 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.RuralExtend + +/-! +# Graph Minors IX, (6.1): smaller societies + +The proof of (6.1) takes a counterexample with `|V(G)| + |E(G)|` as small as possible and shows that +`G` is simple, that no vertex of `ΩBar` is isolated, and that consecutive vertices of `ΩBar` are not +adjacent. Each time the paper says that a smaller society is a smaller counterexample. To check +this we must see that the smaller society keeps the connectivity and has no new crooked +transaction, and that a composition of the smaller society with a rural neighborhood gives one for +`(G, Ω)` with no larger sophistication. That is what this file does. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- The subgraph `H` of `G` with the edge `e` added. -/ +def addEdgeTo (G H : Graph α β) (e : β) : Graph α β := (G.induce V(H)).restrict (insert e E(H)) + +section AddEdge + +variable {G H : Graph α β} {e : β} {u w : α} + +theorem addEdgeTo_le (hH : H ≤ G) : addEdgeTo G H e ≤ G := + restrict_le.trans (G.induce_le hH.vertexSet_mono) + +@[simp] theorem vertexSet_addEdgeTo : V(addEdgeTo G H e) = V(H) := by simp [addEdgeTo] + +theorem edgeSet_addEdgeTo (hH : H ≤ G) (hl : G.IsLink e u w) (hu : u ∈ V(H)) (hw : w ∈ V(H)) : + E(addEdgeTo G H e) = insert e E(H) := by + unfold addEdgeTo + rw [edgeSet_restrict, inter_eq_right] + rintro f (rfl | hf) + · exact ⟨u, w, hl, hu, hw⟩ + · obtain ⟨x, y, hxy⟩ := H.exists_isLink_of_mem_edgeSet hf + exact ⟨x, y, hxy.mono hH, hxy.left_mem, hxy.right_mem⟩ + +theorem le_addEdgeTo (hH : H ≤ G) : H ≤ addEdgeTo G H e := by + refine ⟨by simp, fun {f x y} hl => ?_⟩ + exact ⟨Or.inr hl.edge_mem, hl.mono hH, hl.left_mem, hl.right_mem⟩ + +theorem isLink_addEdgeTo (hl : G.IsLink e u w) (hu : u ∈ V(H)) (hw : w ∈ V(H)) : + (addEdgeTo G H e).IsLink e u w := ⟨Or.inl rfl, hl, hu, hw⟩ + +/-- A separation of `G` with `e` deleted gives one of `G`, if the ends of `e` are in the first +side. -/ +theorem IsGraphSeparation.addEdge_left {G' G₁ G₂ : Graph α β} (h : IsGraphSeparation G' G₁ G₂) + (hle : G' ≤ G) (hV : V(G') = V(G)) (hE : E(G) = insert e E(G')) (he : e ∉ E(G')) + (hl : G.IsLink e u w) (hu : u ∈ V(G₁)) (hw : w ∈ V(G₁)) : + IsGraphSeparation G (addEdgeTo G G₁ e) G₂ := by + obtain ⟨h₁, h₂, hVu, hEu, hd⟩ := h + have h₁G := h₁.trans hle + refine ⟨addEdgeTo_le h₁G, h₂.trans hle, by rw [vertexSet_addEdgeTo, hVu, hV], ?_, ?_⟩ + · rw [edgeSet_addEdgeTo h₁G hl hu hw, insert_union, hEu, hE] + · rw [edgeSet_addEdgeTo h₁G hl hu hw, disjoint_insert_left] + exact ⟨fun h' => he (h₂.edgeSet_mono h'), hd⟩ + +theorem IsGraphSeparation.addEdge_right {G' G₁ G₂ : Graph α β} (h : IsGraphSeparation G' G₁ G₂) + (hle : G' ≤ G) (hV : V(G') = V(G)) (hE : E(G) = insert e E(G')) (he : e ∉ E(G')) + (hl : G.IsLink e u w) (hu : u ∈ V(G₂)) (hw : w ∈ V(G₂)) : + IsGraphSeparation G G₁ (addEdgeTo G G₂ e) := + IsGraphSeparation.symm + (IsGraphSeparation.addEdge_left (IsGraphSeparation.symm h) hle hV hE he hl hu hw) + +/-- If `e` is a loop or parallel to an edge of `H`, then a path of `H` with `e` added may be +replaced by a path of `H` with the same ends and the same vertices. -/ +theorem exists_path_of_addEdge {G' H' P : Graph α β} {a b : α} (hle : H' ≤ G') (hV : V(H') = V(G')) + (hE : E(G') = insert e E(H')) (hl : G'.IsLink e u w) (hred : u = w ∨ ∃ f, H'.IsLink f u w) + (hP : IsGraphPathWithEnds G' P a b) : + ∃ P', IsGraphPathWithEnds H' P' a b ∧ V(P') = V(P) := by + obtain ⟨hPG, W, hs, hVP, -⟩ := hP + have key : ∀ {x y : α} (W : GraphWalk P x y), W.IsSimple → + ∃ W' : GraphWalk H' x y, W'.support = W.support := by + intro x y W + induction W with + | nil hv => + intro _ + exact ⟨.nil (hV ▸ hPG.vertexSet_mono hv), rfl⟩ + | @cons x z y f hlink rest ih => + intro hs' + have hnd : x ∉ rest.support ∧ rest.IsSimple := by + have : (x :: rest.support).Nodup := hs' + exact ⟨(List.nodup_cons.mp this).1, (List.nodup_cons.mp this).2⟩ + obtain ⟨R, hR⟩ := ih hnd.2 + have hlG : G'.IsLink f x z := hlink.mono hPG + have hlk : ∃ g, H'.IsLink g x z := by + by_cases hfe : f = e + · subst hfe + have hxz : x ≠ z := fun h => hnd.1 (h ▸ GraphWalk.start_mem_support rest) + rcases hred with rfl | ⟨g, hg⟩ + · rcases hlG.eq_and_eq_or_eq_and_eq hl with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> + exact (hxz rfl).elim + · rcases hlG.eq_and_eq_or_eq_and_eq hl with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨g, hg⟩ + · exact ⟨g, hg.symm⟩ + · have hfH : f ∈ E(H') := by + have := hlG.edge_mem + rw [hE] at this + exact this.resolve_left hfe + exact ⟨f, (hle.isLink_iff hfH).mpr hlG⟩ + obtain ⟨g, hg⟩ := hlk + exact ⟨.cons hg R, by simp only [GraphWalk.support, hR]⟩ + obtain ⟨W', hW'⟩ := key W hs + have hs' : W'.IsSimple := by + change W'.support.Nodup + rw [hW'] + exact hs + refine ⟨walkSubgraph W', isGraphPathWithEnds_walkSubgraph hs', ?_⟩ + rw [vertexSet_walkSubgraph, hVP, hW'] + +end AddEdge + +/-- The subgraph `H` of `G` with the vertex `v` added. -/ +def addVertexTo (G H : Graph α β) (v : α) : Graph α β := + (G.induce (insert v V(H))).restrict E(H) + +section AddVertex + +variable {G H : Graph α β} {v : α} + +theorem addVertexTo_le (hH : H ≤ G) (hv : v ∈ V(G)) : addVertexTo G H v ≤ G := + restrict_le.trans (G.induce_le (insert_subset hv hH.vertexSet_mono)) + +@[simp] theorem vertexSet_addVertexTo : V(addVertexTo G H v) = insert v V(H) := by + simp [addVertexTo] + +theorem edgeSet_addVertexTo (hH : H ≤ G) : E(addVertexTo G H v) = E(H) := by + unfold addVertexTo + rw [edgeSet_restrict, inter_eq_right] + intro f hf + obtain ⟨x, y, hxy⟩ := H.exists_isLink_of_mem_edgeSet hf + exact ⟨x, y, hxy.mono hH, Or.inr hxy.left_mem, Or.inr hxy.right_mem⟩ + +theorem le_addVertexTo (hH : H ≤ G) : H ≤ addVertexTo G H v := by + refine ⟨fun x hx => by simp [hx], fun {f x y} hl => ?_⟩ + exact ⟨hl.edge_mem, hl.mono hH, Or.inr hl.left_mem, Or.inr hl.right_mem⟩ + +end AddVertex + +namespace Neighborhood + +/-- The neighborhood `N` with the edge `e` of `G` added. -/ +def addEdge (N : Neighborhood α β) (G : Graph α β) (e : β) : Neighborhood α β where + G := addEdgeTo G N.G e + Ω := N.Ω + Ω₀ := N.Ω₀ + finite_V := by simpa using N.finite_V + finite_E := (N.finite_E.insert e).subset inter_subset_right + bar_subset := by simpa using N.bar_subset + bar₀_subset := by simpa using N.bar₀_subset + +end Neighborhood + +namespace Society + +variable (S : Society α β) + +/-- The society `S` with the edge `e` deleted. -/ +def deleteEdge (e : β) : Society α β := + ⟨S.G.restrict (E(S.G) \ {e}), S.Ω, S.finite_V, S.finite_E.subset restrict_le.edgeSet_mono, + S.bar_subset⟩ + +/-- The society on the subgraph `G` with the edge `e` of `G'` added. -/ +def addEdge (G : Graph α β) (e : β) : Society α β where + G := addEdgeTo G S.G e + Ω := S.Ω + finite_V := by simpa using S.finite_V + finite_E := (S.finite_E.insert e).subset inter_subset_right + bar_subset := by simpa using S.bar_subset + +variable {S} + +theorem deleteEdge_le (e : β) : (S.deleteEdge e).G ≤ S.G := restrict_le + +theorem vertexSet_deleteEdge (e : β) : V((S.deleteEdge e).G) = V(S.G) := vertexSet_restrict _ _ + +theorem edgeSet_deleteEdge (e : β) : E((S.deleteEdge e).G) = E(S.G) \ {e} := by + change E(S.G.restrict (E(S.G) \ {e})) = _ + rw [edgeSet_restrict, inter_eq_right] + exact sdiff_subset + +theorem notMem_edgeSet_deleteEdge (e : β) : e ∉ E((S.deleteEdge e).G) := by + rw [edgeSet_deleteEdge] + exact fun h => h.2 rfl + +theorem insert_edgeSet_deleteEdge {e : β} (he : e ∈ E(S.G)) : + E(S.G) = insert e E((S.deleteEdge e).G) := by + rw [edgeSet_deleteEdge, insert_sdiff_singleton, insert_eq_of_mem he] + +theorem ncard_deleteEdge {e : β} (he : e ∈ E(S.G)) : + V((S.deleteEdge e).G).ncard + E((S.deleteEdge e).G).ncard + 1 = + V(S.G).ncard + E(S.G).ncard := by + rw [vertexSet_deleteEdge, edgeSet_deleteEdge, ncard_sdiff_singleton_of_mem he] + have : 0 < E(S.G).ncard := (ncard_pos S.finite_E).mpr ⟨e, he⟩ + omega + +/-- A crooked transaction with `e` deleted is a crooked transaction. -/ +theorem IsCrookedTransaction.of_deleteEdge {e : β} {P_set : Set (Graph α β)} + (h : (S.deleteEdge e).IsCrookedTransaction P_set) : S.IsCrookedTransaction P_set := by + have hle : ∀ P ∈ P_set, P ≤ (S.deleteEdge e).G := by + intro P hP + obtain ⟨A, B, hf⟩ := h.1 + obtain ⟨a, b, hab⟩ := hf.1.1 P hP + exact hab.1.le + exact isCrookedTransaction_of_omega_eq (S₁ := S.deleteEdge e) (S₂ := S) rfl hle + (fun P hP => (hle P hP).trans restrict_le) h + +/-- A separation of the society with `e` deleted gives one of the society, if the ends of `e` are +on one side. -/ +theorem exists_separation_of_deleteEdge {e : β} {u w : α} (hl : S.G.IsLink e u w) + {G₁ G₂ : Graph α β} (hs : (S.deleteEdge e).IsSocietySeparation G₁ G₂) + (hside : (u ∈ V(G₁) ∧ w ∈ V(G₁)) ∨ (u ∈ V(G₂) ∧ w ∈ V(G₂))) : + ∃ G₁' G₂', S.IsSocietySeparation G₁' G₂' ∧ V(G₁') = V(G₁) ∧ V(G₂') = V(G₂) := by + have hle := deleteEdge_le (S := S) e + have hV := vertexSet_deleteEdge (S := S) e + have hE := insert_edgeSet_deleteEdge hl.edge_mem + have he := notMem_edgeSet_deleteEdge (S := S) e + rcases hside with ⟨hu, hw⟩ | ⟨hu, hw⟩ + · exact ⟨addEdgeTo S.G G₁ e, G₂, ⟨IsGraphSeparation.addEdge_left hs.1 hle hV hE he hl hu hw, + hs.2⟩, + vertexSet_addEdgeTo, rfl⟩ + · refine ⟨G₁, addEdgeTo S.G G₂ e, ⟨IsGraphSeparation.addEdge_right hs.1 hle hV hE he hl hu hw, + ?_⟩, + rfl, vertexSet_addEdgeTo⟩ + rw [vertexSet_addEdgeTo] + exact hs.2 + +/-- Connectivity passes to the society with `e` deleted, if every separation has the ends of `e` +on one side. -/ +theorem connected_deleteEdge {e : β} {u w : α} (hl : S.G.IsLink e u w) {k₁ k₂ : ℕ} + (hconn : S.IsKConnected k₁) (hint : S.IsInternallyKConnected k₂) + (hside : ∀ G₁ G₂, (S.deleteEdge e).IsSocietySeparation G₁ G₂ → + (u ∈ V(G₁) ∧ w ∈ V(G₁)) ∨ (u ∈ V(G₂) ∧ w ∈ V(G₂))) : + (S.deleteEdge e).IsKConnected k₁ ∧ (S.deleteEdge e).IsInternallyKConnected k₂ := by + have hV := vertexSet_deleteEdge (S := S) e + constructor + · intro k hk G₁ G₂ hs + obtain ⟨G₁', G₂', h, h₁, h₂⟩ := exists_separation_of_deleteEdge hl hs.1 (hside _ _ hs.1) + exact hconn k hk G₁' G₂' ⟨h, by rw [h₁, h₂]; exact hs.2.1, by rw [h₂, ← hV]; exact hs.2.2⟩ + · intro k hk G₁ G₂ hs + obtain ⟨G₁', G₂', h, h₁, h₂⟩ := exists_separation_of_deleteEdge hl hs.1.1 (hside _ _ hs.1.1) + exact hint k hk G₁' G₂' ⟨⟨h, by rw [h₁, h₂]; exact hs.1.2.1, by rw [h₂, ← hV]; exact hs.1.2.2⟩, + by rw [h₂, ← hV]; exact hs.2⟩ + +/-- If `e` is a loop or parallel to another edge, every separation has its ends on one side. -/ +theorem side_of_redundant {e : β} {u w : α} (hl : S.G.IsLink e u w) + (hred : u = w ∨ ∃ f, f ≠ e ∧ S.G.IsLink f u w) {G₁ G₂ : Graph α β} + (hs : (S.deleteEdge e).IsSocietySeparation G₁ G₂) : + (u ∈ V(G₁) ∧ w ∈ V(G₁)) ∨ (u ∈ V(G₂) ∧ w ∈ V(G₂)) := by + obtain ⟨⟨h₁, h₂, hVu, hEu, -⟩, -⟩ := hs + rcases hred with rfl | ⟨f, hne, hf⟩ + · have hm : u ∈ V(G₁) ∪ V(G₂) := by + rw [hVu, vertexSet_deleteEdge] + exact hl.left_mem + rcases hm with h | h + · exact Or.inl ⟨h, h⟩ + · exact Or.inr ⟨h, h⟩ + · have hf' : f ∈ E((S.deleteEdge e).G) := by + rw [edgeSet_deleteEdge] + exact ⟨hf.edge_mem, hne⟩ + have hfl : (S.deleteEdge e).G.IsLink f u w := (restrict_le.isLink_iff hf').mpr hf + have hm : f ∈ E(G₁) ∪ E(G₂) := hEu ▸ hf' + rcases hm with h | h + · have := (h₁.isLink_iff h).mpr hfl + exact Or.inl ⟨this.left_mem, this.right_mem⟩ + · have := (h₂.isLink_iff h).mpr hfl + exact Or.inr ⟨this.left_mem, this.right_mem⟩ + +/-- A transaction of a society with a redundant edge added gives a transaction of the same size +of the society. -/ +theorem exists_transaction_of_addEdge {S₁ : Society α β} {G : Graph α β} {e : β} {u w : α} + (hG : S₁.G ≤ G) (hl : G.IsLink e u w) (hu : u ∈ V(S₁.G)) (hw : w ∈ V(S₁.G)) + (hred : u = w ∨ ∃ f, S₁.G.IsLink f u w) {P_set : Set (Graph α β)} + (h : (S₁.addEdge G e).IsTransaction P_set) : + ∃ P_set', S₁.IsTransaction P_set' ∧ P_set'.ncard = P_set.ncard := by + classical + have : Nonempty (Graph α β) := ⟨S₁.G⟩ + obtain ⟨A, B, hd, hfence, hends⟩ := h + have hle : S₁.G ≤ (S₁.addEdge G e).G := le_addEdgeTo hG + have hV : V(S₁.G) = V((S₁.addEdge G e).G) := vertexSet_addEdgeTo.symm + have hE : E((S₁.addEdge G e).G) = insert e E(S₁.G) := edgeSet_addEdgeTo hG hl hu hw + have hl' : (S₁.addEdge G e).G.IsLink e u w := isLink_addEdgeTo hl hu hw + have hrep : ∀ R ∈ P_set, ∃ R', (∃ a ∈ A, ∃ b ∈ B, S₁.IsOmegaPathWithEnds R' a b) ∧ + V(R') = V(R) := by + intro R hR + obtain ⟨a, ha, b, hb, hR⟩ := hends R hR + obtain ⟨R', hR', hVR⟩ := exists_path_of_addEdge hle hV hE hl' hred hR.1 + exact ⟨R', ⟨a, ha, b, hb, hR', hR.2.1, hR.2.2.1, hR.2.2.2⟩, hVR⟩ + choose! f hf using hrep + have hne : ∀ R ∈ P_set, V(R).Nonempty := by + intro R hR + obtain ⟨a, -, b, -, hab⟩ := hends R hR + exact ⟨a, hab.1.left_mem⟩ + have hinj : InjOn f P_set := by + intro R hR R' hR' he + by_contra hneq + have hdis := hd.2 hR hR' hneq + obtain ⟨x, hx⟩ := hne R hR + rw [← (hf R hR).2, he, (hf R' hR').2] at hx + exact disjoint_left.mp hdis (by + rw [← (hf R hR).2, he, (hf R' hR').2] + exact hx) hx + refine ⟨f '' P_set, ⟨A, B, ⟨?_, ?_⟩, hfence, ?_⟩, hinj.ncard_image⟩ + · rintro _ ⟨R, hR, rfl⟩ + obtain ⟨a, -, b, -, hab⟩ := (hf R hR).1 + exact ⟨a, b, hab⟩ + · rintro _ ⟨R, hR, rfl⟩ _ ⟨R', hR', rfl⟩ hneq + have hn : R ≠ R' := fun h => hneq (by rw [h]) + change Disjoint V(f R) V(f R') + rw [(hf R hR).2, (hf R' hR').2] + exact hd.2 hR hR' hn + · rintro _ ⟨R, hR, rfl⟩ + exact (hf R hR).1 + +/-- The composition with `e` added to the rural neighborhood. -/ +theorem hasSophisticationLE_add_outer {e : β} {u w : α} (hl : S.G.IsLink e u w) {k : ℕ} + {S₁ : Society α β} {N : Neighborhood α β} (hc : (S.deleteEdge e).IsComposition S₁ N) + (hu : u ∈ V(N.G)) (hw : w ∈ V(N.G)) (hr : (N.addEdge S.G e).IsRural) + (hk : ∀ P_set : Set (Graph α β), S₁.IsTransaction P_set → P_set.ncard ≤ k) : + S.HasSophisticationLE k := by + have hle := deleteEdge_le (S := S) e + have hV := vertexSet_deleteEdge (S := S) e + have hE := insert_edgeSet_deleteEdge hl.edge_mem + have he := notMem_edgeSet_deleteEdge (S := S) e + obtain ⟨⟨hsep, hbar⟩, hΩ, hΩ₀, hb⟩ := hc + refine ⟨S₁, N.addEdge S.G e, ⟨⟨IsGraphSeparation.addEdge_right hsep hle hV hE he hl hu hw, ?_⟩, + hΩ, hΩ₀, ?_⟩, hr, hk⟩ + · change S.Ω.bar ⊆ V(addEdgeTo S.G N.G e) + rw [vertexSet_addEdgeTo] + exact hbar + · change S₁.Ω.bar = V(S₁.G) ∩ V(addEdgeTo S.G N.G e) + rw [vertexSet_addEdgeTo] + exact hb + +/-- The composition with a redundant `e` added to the inner society. -/ +theorem hasSophisticationLE_add_inner {e : β} {u w : α} (hl : S.G.IsLink e u w) {k : ℕ} + {S₁ : Society α β} {N : Neighborhood α β} (hc : (S.deleteEdge e).IsComposition S₁ N) + (hu : u ∈ V(S₁.G)) (hw : w ∈ V(S₁.G)) (hred : u = w ∨ ∃ f, S₁.G.IsLink f u w) + (hr : N.IsRural) + (hk : ∀ P_set : Set (Graph α β), S₁.IsTransaction P_set → P_set.ncard ≤ k) : + S.HasSophisticationLE k := by + have hle := deleteEdge_le (S := S) e + have hV := vertexSet_deleteEdge (S := S) e + have hE := insert_edgeSet_deleteEdge hl.edge_mem + have he := notMem_edgeSet_deleteEdge (S := S) e + obtain ⟨⟨hsep, hbar⟩, hΩ, hΩ₀, hb⟩ := hc + have hG : S₁.G ≤ S.G := hsep.1.trans hle + refine ⟨S₁.addEdge S.G e, N, ⟨⟨IsGraphSeparation.addEdge_left hsep hle hV hE he hl hu hw, hbar⟩, + hΩ, hΩ₀, ?_⟩, hr, fun P_set hP => ?_⟩ + · change S₁.Ω.bar = V(addEdgeTo S.G S₁.G e) ∩ V(N.G) + rw [vertexSet_addEdgeTo] + exact hb + · obtain ⟨P', hP', hn⟩ := exists_transaction_of_addEdge hG hl hu hw hred hP + rw [← hn] + exact hk P' hP' + +/-- The rural neighborhood with `e` added has `e` in its edges. -/ +private theorem addEdge_facts {e : β} {u w : α} (hl : S.G.IsLink e u w) {N : Neighborhood α β} + (hN : N.G ≤ (S.deleteEdge e).G) (hu : u ∈ V(N.G)) (hw : w ∈ V(N.G)) : + N.G ≤ (N.addEdge S.G e).G ∧ V((N.addEdge S.G e).G) = V(N.G) ∧ + E((N.addEdge S.G e).G) = insert e E(N.G) ∧ e ∉ E(N.G) ∧ + (N.addEdge S.G e).G.IsLink e u w := by + have hNG : N.G ≤ S.G := hN.trans (deleteEdge_le e) + exact ⟨le_addEdgeTo hNG, vertexSet_addEdgeTo, edgeSet_addEdgeTo hNG hl hu hw, + fun h => notMem_edgeSet_deleteEdge (S := S) e (hN.edgeSet_mono h), isLink_addEdgeTo hl hu hw⟩ + +/-- Claim (1) of (6.1), for an edge parallel to another edge. -/ +theorem hasSophisticationLE_of_deleteEdge_parallel {e f : β} {u w : α} (hl : S.G.IsLink e u w) + (hne : f ≠ e) (hf : S.G.IsLink f u w) (huw : u ≠ w) {k : ℕ} + (h : (S.deleteEdge e).HasSophisticationLE k) : S.HasSophisticationLE k := by + obtain ⟨S₁, N, hc, hr, hk⟩ := h + have hc' := hc + obtain ⟨⟨⟨h₁, h₂, -, hEu, -⟩, -⟩, -, -, -⟩ := hc' + have hf' : f ∈ E((S.deleteEdge e).G) := by + rw [edgeSet_deleteEdge] + exact ⟨hf.edge_mem, hne⟩ + have hfl : (S.deleteEdge e).G.IsLink f u w := (restrict_le.isLink_iff hf').mpr hf + have hm : f ∈ E(S₁.G) ∪ E(N.G) := hEu ▸ hf' + rcases hm with hm | hm + · have hl₁ := (h₁.isLink_iff hm).mpr hfl + exact hasSophisticationLE_add_inner hl hc hl₁.left_mem hl₁.right_mem (Or.inr ⟨f, hl₁⟩) hr hk + · have hl₂ := (h₂.isLink_iff hm).mpr hfl + obtain ⟨a, b, c, d, g⟩ := addEdge_facts hl h₂ hl₂.left_mem hl₂.right_mem + exact hasSophisticationLE_add_outer hl hc hl₂.left_mem hl₂.right_mem + (hr.add_parallel rfl rfl a b c d g hl₂ huw) hk + +/-- Claim (1) of (6.1), for a loop. -/ +theorem hasSophisticationLE_of_deleteEdge_loop {e : β} {u : α} (hl : S.G.IsLink e u u) {k : ℕ} + (h : (S.deleteEdge e).HasSophisticationLE k) : S.HasSophisticationLE k := by + obtain ⟨S₁, N, hc, hr, hk⟩ := h + have hc' := hc + obtain ⟨⟨⟨h₁, h₂, hVu, -, -⟩, -⟩, -, hΩ₀, hb⟩ := hc' + by_cases hu₁ : u ∈ V(S₁.G) + · exact hasSophisticationLE_add_inner hl hc hu₁ hu₁ (Or.inl rfl) hr hk + · have hu₂ : u ∈ V(N.G) := by + have hm : u ∈ V(S₁.G) ∪ V(N.G) := by + rw [hVu, vertexSet_deleteEdge] + exact hl.left_mem + exact hm.resolve_left hu₁ + have hu₀ : u ∉ N.Ω₀.bar := by + rw [hΩ₀, hb] + exact fun h' => hu₁ h'.1 + obtain ⟨a, b, c, d, g⟩ := addEdge_facts hl h₂ hu₂ hu₂ + exact hasSophisticationLE_add_outer hl hc hu₂ hu₂ (hr.add_loop rfl rfl a b c d g hu₂ hu₀) hk + +/-- Claim (4) of (6.1). -/ +theorem hasSophisticationLE_of_deleteEdge_boundary {e : β} {u w : α} (hl : S.G.IsLink e u w) + (hu : u ∈ S.Ω.bar) (hw : w ∈ S.Ω.bar) (huw : u ≠ w) (hgap : S.Ω.interval u w = ∅) {k : ℕ} + (h : (S.deleteEdge e).HasSophisticationLE k) : S.HasSophisticationLE k := by + obtain ⟨S₁, N, hc, hr, hk⟩ := h + have hc' := hc + obtain ⟨⟨⟨-, h₂, -, -, -⟩, hbar⟩, hΩ, -, -⟩ := hc' + have hΩ' : N.Ω = S.Ω := hΩ + have hu₂ : u ∈ V(N.G) := hbar hu + have hw₂ : w ∈ V(N.G) := hbar hw + obtain ⟨a, b, c, d, g⟩ := addEdge_facts hl h₂ hu₂ hw₂ + exact hasSophisticationLE_add_outer hl hc hu₂ hw₂ (hr.add_boundary_edge rfl rfl a b c d g + (hΩ' ▸ hu) (hΩ' ▸ hw) huw (hΩ' ▸ hgap)) hk + +variable (S) + +/-- The society `S` with the vertex `v` of `ΩBar` deleted. -/ +noncomputable def deleteBarVertex (v : α) : Society α β where + G := deleteVertices S.G {v} + Ω := S.Ω.restrict (S.Ω.bar \ {v}) sdiff_subset + finite_V := S.finite_V.subset (deleteVertices_le S.G {v}).vertexSet_mono + finite_E := S.finite_E.subset (deleteVertices_le S.G {v}).edgeSet_mono + bar_subset := by + rw [S.Ω.restrict_bar] + rintro x ⟨hx, hne⟩ + exact ⟨S.bar_subset hx, hne⟩ + +variable {S} + +theorem vertexSet_deleteBarVertex (v : α) : V((S.deleteBarVertex v).G) = V(S.G) \ {v} := by + change V(S.G.induce (V(S.G) \ {v})) = _ + simp + +theorem edgeSet_deleteBarVertex {v : α} (hno : ∀ e x, ¬ S.G.IsLink e v x) : + E((S.deleteBarVertex v).G) = E(S.G) := by + refine Subset.antisymm (deleteVertices_le S.G {v}).edgeSet_mono fun e he => ?_ + obtain ⟨x, y, hxy⟩ := S.G.exists_isLink_of_mem_edgeSet he + refine ⟨x, y, hxy, ⟨hxy.left_mem, ?_⟩, ⟨hxy.right_mem, ?_⟩⟩ + · rintro rfl + exact hno _ _ hxy + · rintro rfl + exact hno _ _ hxy.symm + +theorem ncard_deleteBarVertex {v : α} (hv : v ∈ S.Ω.bar) (hno : ∀ e x, ¬ S.G.IsLink e v x) : + V((S.deleteBarVertex v).G).ncard + E((S.deleteBarVertex v).G).ncard + 1 = + V(S.G).ncard + E(S.G).ncard := by + have hvG := S.bar_subset hv + rw [vertexSet_deleteBarVertex, edgeSet_deleteBarVertex hno, ncard_sdiff_singleton_of_mem hvG] + have : 0 < V(S.G).ncard := (ncard_pos S.finite_V).mpr ⟨v, hvG⟩ + omega + +/-- A crooked transaction with `v` deleted is a crooked transaction. -/ +theorem IsCrookedTransaction.of_deleteBarVertex {v : α} {P_set : Set (Graph α β)} + (h : (S.deleteBarVertex v).IsCrookedTransaction P_set) : S.IsCrookedTransaction P_set := by + have hle : ∀ P ∈ P_set, P ≤ (S.deleteBarVertex v).G := by + intro P hP + obtain ⟨A, B, hf⟩ := h.1 + obtain ⟨a, b, hab⟩ := hf.1.1 P hP + exact hab.1.le + have h₂ : (S.restrictOmega (S.Ω.bar \ {v}) sdiff_subset).IsCrookedTransaction P_set := + isCrookedTransaction_of_omega_eq (S₁ := S.deleteBarVertex v) rfl hle + (fun P hP => (hle P hP).trans (deleteVertices_le S.G {v})) h + exact ((S.isCrookedTransaction_restrictOmega_iff sdiff_subset).mp h₂).1 + +/-- A separation of the society with the isolated vertex `v` deleted gives one of the society, with +`v` added to the second side. -/ +theorem exists_separation_of_deleteBarVertex {v : α} (hv : v ∈ S.Ω.bar) + (hno : ∀ e x, ¬ S.G.IsLink e v x) {G₁ G₂ : Graph α β} + (hs : (S.deleteBarVertex v).IsSocietySeparation G₁ G₂) : + S.IsSocietySeparation G₁ (addVertexTo S.G G₂ v) ∧ v ∉ V(G₁) ∧ v ∉ V(G₂) := by + obtain ⟨⟨h₁, h₂, hVu, hEu, hd⟩, hbar⟩ := hs + have hle := deleteVertices_le S.G {v} + have hvG := S.bar_subset hv + have hG₂ : G₂ ≤ S.G := h₂.trans hle + have hoff : ∀ {H : Graph α β}, H ≤ (S.deleteBarVertex v).G → v ∉ V(H) := by + intro H hH h + have := hH.vertexSet_mono h + rw [vertexSet_deleteBarVertex] at this + exact this.2 rfl + refine ⟨⟨⟨h₁.trans hle, addVertexTo_le hG₂ hvG, ?_, ?_, ?_⟩, ?_⟩, hoff h₁, hoff h₂⟩ + · rw [vertexSet_addVertexTo, union_insert, hVu, vertexSet_deleteBarVertex, insert_sdiff_singleton, + insert_eq_of_mem hvG] + · rw [edgeSet_addVertexTo hG₂, hEu, edgeSet_deleteBarVertex hno] + · rwa [edgeSet_addVertexTo hG₂] + · rw [vertexSet_addVertexTo] + intro x hx + by_cases hxv : x = v + · exact Or.inl hxv + · refine Or.inr (hbar ?_) + change x ∈ (S.Ω.restrict (S.Ω.bar \ {v}) sdiff_subset).bar + rw [S.Ω.restrict_bar] + exact ⟨hx, hxv⟩ + +/-- Connectivity passes to the society with the isolated vertex `v` deleted. -/ +theorem connected_deleteBarVertex {v : α} (hv : v ∈ S.Ω.bar) (hno : ∀ e x, ¬ S.G.IsLink e v x) + {k₁ k₂ : ℕ} (hconn : S.IsKConnected k₁) (hint : S.IsInternallyKConnected k₂) : + (S.deleteBarVertex v).IsKConnected k₁ ∧ (S.deleteBarVertex v).IsInternallyKConnected k₂ := by + have hvG := S.bar_subset hv + have key : ∀ {G₁ G₂ : Graph α β} {k : ℕ}, (S.deleteBarVertex v).IsKSeparation k G₁ G₂ → + S.IsKSeparation k G₁ (addVertexTo S.G G₂ v) ∧ + V(addVertexTo S.G G₂ v).ncard = V(G₂).ncard + 1 := by + intro G₁ G₂ k hs + obtain ⟨hs', hv₁, hv₂⟩ := exists_separation_of_deleteBarVertex hv hno hs.1 + have hfin : V(G₂).Finite := S.finite_V.subset (hs.1.1.2.1.trans + (deleteVertices_le S.G {v})).vertexSet_mono + refine ⟨⟨hs', ?_, ?_⟩, ?_⟩ + · rw [vertexSet_addVertexTo, inter_insert_of_notMem hv₁] + exact hs.2.1 + · rw [vertexSet_addVertexTo] + intro he + apply hs.2.2 + rw [vertexSet_deleteBarVertex, ← he, insert_sdiff_of_mem _ (mem_singleton v), + sdiff_singleton_eq_self hv₂] + · rw [vertexSet_addVertexTo, ncard_insert_of_notMem hv₂ hfin] + constructor + · intro k hk G₁ G₂ hs + exact hconn k hk _ _ (key hs).1 + · intro k hk G₁ G₂ hs + refine hint k hk _ _ ⟨(key hs.1).1, ?_⟩ + have h₂ := hs.2 + rw [(key hs.1).2] + rw [vertexSet_deleteBarVertex, ncard_sdiff_singleton_of_mem hvG] at h₂ + omega + +/-- Claim (2) of (6.1). -/ +theorem hasSophisticationLE_of_deleteBarVertex {v : α} (hv : v ∈ S.Ω.bar) + (hno : ∀ e x, ¬ S.G.IsLink e v x) {k : ℕ} (h : (S.deleteBarVertex v).HasSophisticationLE k) : + S.HasSophisticationLE k := by + obtain ⟨S₁, N, ⟨hs, hΩ, hΩ₀, hb⟩, hr, hk⟩ := h + obtain ⟨hs', hv₁, hv₂⟩ := exists_separation_of_deleteBarVertex hv hno hs + have hvG := S.bar_subset hv + have hNG : N.G ≤ S.G := hs.1.2.1.trans (deleteVertices_le S.G {v}) + let N' : Neighborhood α β := + { G := addVertexTo S.G N.G v + Ω := S.Ω + Ω₀ := N.Ω₀ + finite_V := S.finite_V.subset (addVertexTo_le hNG hvG).vertexSet_mono + finite_E := S.finite_E.subset (addVertexTo_le hNG hvG).edgeSet_mono + bar_subset := hs'.2 + bar₀_subset := by + rw [vertexSet_addVertexTo] + exact fun x hx => Or.inr (N.bar₀_subset hx) } + have hNΩ : N.Ω = S.Ω.restrict (S.Ω.bar \ {v}) sdiff_subset := hΩ + refine ⟨S₁, N', ⟨hs', rfl, hΩ₀, ?_⟩, ?_, hk⟩ + · change S₁.Ω.bar = V(S₁.G) ∩ V(addVertexTo S.G N.G v) + rw [vertexSet_addVertexTo, inter_insert_of_notMem hv₁] + exact hb + · refine hr.add_boundary_vertex rfl (le_addVertexTo hNG) hv₂ vertexSet_addVertexTo + (edgeSet_addVertexTo hNG) hv ?_ ?_ + · change N.Ω.bar = S.Ω.bar \ {v} + rw [hNΩ, S.Ω.restrict_bar] + · intro v₁ v₂ v₃ h h₁ h₂ h₃ + rw [hNΩ, S.Ω.isClockwise3_restrict_iff] + have hm := CyclicPerm.isClockwise3_iff.mp (show S.Ω.IsClockwise3 v₁ v₂ v₃ from h) + exact ⟨⟨hm.2.2.2.1, h₁⟩, ⟨hm.2.2.2.2.1, h₂⟩, ⟨hm.2.2.2.2.2.1, h₃⟩, h⟩ + +variable (S) + +/-- Adding the vertex `r` of `G` between two consecutive vertices of `Ω`. -/ +theorem exists_extension {a b r : α} (ha : a ∈ S.Ω.bar) (hb : b ∈ S.Ω.bar) (hab : a ≠ b) + (hr : r ∈ V(S.G)) (hrb : r ∉ S.Ω.bar) (hgap : S.Ω.interval a b = ∅) : + ∃ S₀ : Society α β, S₀.G = S.G ∧ S₀.Ω.bar = S.Ω.bar ∪ {r} ∧ + S₀.Ω.IsRestriction S.Ω.bar S.Ω ∧ S₀.Ω.IsClockwise3 a r b := by + classical + obtain ⟨L, hL, hL0⟩ := S.Ω.exists_isOrbitList_starting_at hb + have hpos : 0 < L.length := List.length_pos_of_ne_nil hL.2.1 + have haL : a ∈ L := by + have : a ∈ {v | v ∈ L} := hL.2.2.1 ▸ ha + exact this + obtain ⟨i, hi, rfl⟩ := List.mem_iff_getElem.mp haL + have hi0 : 0 < i := by + refine Nat.pos_of_ne_zero fun h => hab ?_ + subst h + exact hL0 hi + have hilast : i = L.length - 1 := by + by_contra hne + have hlt : i < L.length - 1 := by omega + have hin := S.Ω.isOrbitList_mem_interval_of_lt hL hi0 hlt (by omega) + rw [hL0 hpos] at hin + have hrot := S.Ω.mem_interval_rotate_left hin + rw [hgap] at hrot + exact hrot + have hnd : (L ++ [r]).Nodup := by + rw [List.nodup_append] + refine ⟨hL.1, List.nodup_singleton r, ?_⟩ + intro x hx y hy + rw [List.mem_singleton] at hy + subst hy + rintro rfl + exact hrb (hL.2.2.1 ▸ hx) + have hne : L ++ [r] ≠ [] := by simp + let Ω₀ := CyclicPerm.ofNodupList (L ++ [r]) hnd hne + have hL₀ : Ω₀.IsOrbitList (L ++ [r]) := CyclicPerm.isOrbitList_ofNodupList _ hnd hne + have hbar : Ω₀.bar = S.Ω.bar ∪ {r} := by + rw [← hL₀.2.2.1, ← hL.2.2.1] + ext x + simp [or_comm] + have hlen : (L ++ [r]).length = L.length + 1 := by simp + have hget : ∀ j (hj : j < L.length), (L ++ [r])[j]'(by omega) = L[j] := fun j hj => + List.getElem_append_left hj + have hgetr : (L ++ [r])[L.length]'(by omega) = r := by simp + have hnext : ∀ j (hj : j < L.length) (hj' : j + 1 < L.length), + Ω₀.toFun (L[j]) = L[j + 1] := by + intro j hj hj' + have := hL₀.2.2.2 j (by omega) + rw [hget j hj] at this + rw [this] + simp only [hlen] + have he : (j + 1) % (L.length + 1) = j + 1 := Nat.mod_eq_of_lt (by omega) + simp only [he] + exact hget (j + 1) hj' + refine ⟨⟨S.G, Ω₀, S.finite_V, S.finite_E, ?_⟩, rfl, hbar, ⟨?_, ?_⟩, ?_⟩ + · rw [hbar] + exact union_subset S.bar_subset (singleton_subset_iff.mpr hr) + · rw [hbar, inter_eq_right.mpr subset_union_left] + · intro x hx + have hxL : x ∈ L := by + have : x ∈ {v | v ∈ L} := hL.2.2.1 ▸ hx + exact this + obtain ⟨j, hj, rfl⟩ := List.mem_iff_getElem.mp hxL + have hstep := hL.2.2.2 j hj + rw [show S.Ω (L[j]) = S.Ω.toFun (L[j]) from rfl, hstep] + by_cases hj' : j + 1 < L.length + · have he : (j + 1) % L.length = j + 1 := Nat.mod_eq_of_lt hj' + simp only [he] + refine ⟨1, le_rfl, ?_, ?_, fun k h₁ h₂ => by omega⟩ + · simpa using hnext j hj hj' + · exact hL.2.2.1 ▸ List.getElem_mem hj' + · have hjlast : j + 1 = L.length := by omega + have he : (j + 1) % L.length = 0 := by rw [hjlast, Nat.mod_self] + simp only [he] + have h₁ : Ω₀.toFun (L[j]) = r := by + have := hL₀.2.2.2 j (by omega) + rw [hget j hj] at this + rw [this] + simp only [hlen] + have he' : (j + 1) % (L.length + 1) = L.length := by + rw [hjlast] + exact Nat.mod_eq_of_lt (by omega) + simp only [he'] + exact hgetr + have h₂ : Ω₀.toFun r = L[0] := by + have := hL₀.2.2.2 L.length (by omega) + rw [hgetr] at this + rw [this] + simp only [hlen] + have he' : (L.length + 1) % (L.length + 1) = 0 := Nat.mod_self _ + simp only [he'] + exact hget 0 hpos + refine ⟨2, by omega, ?_, hL.2.2.1 ▸ List.getElem_mem hpos, fun k hk₁ hk₂ => ?_⟩ + · simp only [Function.iterate_succ, Function.iterate_zero, comp_apply, id_eq, h₁, h₂] + · obtain rfl : k = 1 := by omega + simpa [h₁] using hrb + · have hin := Ω₀.isOrbitList_mem_interval_of_lt hL₀ (i := 0) (j := i) (k := L.length) hi0 + (by omega) (by omega) + have hrot := Ω₀.mem_interval_rotate_right hin + have e₁ : (L ++ [r])[i]'(by omega) = L[i] := hget i hi + have e₂ : (L ++ [r])[0]'(by omega) = b := (hget 0 hpos).trans (hL0 hpos) + rw [e₁, e₂, hgetr] at hin + exact Ω₀.isClockwise3_rotate hin.2 + +variable {S} + +/-- Sophistication does not grow when we pass to a smaller outer cyclic permutation. -/ +theorem HasSophisticationLE.of_extension {S₀ : Society α β} (hG : S₀.G = S.G) + (hbar : S.Ω.bar ⊆ S₀.Ω.bar) (hres : S₀.Ω.IsRestriction S.Ω.bar S.Ω) {k : ℕ} + (h : S₀.HasSophisticationLE k) : S.HasSophisticationLE k := by + obtain ⟨S₁, N, ⟨⟨hsep, hb⟩, hΩ, hΩ₀, hc⟩, hr, hk⟩ := h + have hΩ' : N.Ω = S₀.Ω := hΩ + let N' : Neighborhood α β := ⟨N.G, S.Ω, N.Ω₀, N.finite_V, N.finite_E, hbar.trans hb, + N.bar₀_subset⟩ + refine ⟨S₁, N', ⟨⟨hG ▸ hsep, hbar.trans hb⟩, rfl, hΩ₀, hc⟩, ?_, hk⟩ + refine hr.restrict_outer rfl rfl (hΩ' ▸ hbar) fun v₁ v₂ v₃ h => ?_ + rw [hΩ'] + exact (hres.isClockwise3_iff.mp h).2.2.2 + +/-- Connectivity passes to a larger outer cyclic permutation on the same graph. -/ +theorem connected_of_extension {S₀ : Society α β} (hG : S₀.G = S.G) + (hbar : S.Ω.bar ⊆ S₀.Ω.bar) {k₁ k₂ : ℕ} (hconn : S.IsKConnected k₁) + (hint : S.IsInternallyKConnected k₂) : + S₀.IsKConnected k₁ ∧ S₀.IsInternallyKConnected k₂ := by + have key : ∀ {G₁ G₂ : Graph α β} {k : ℕ}, S₀.IsKSeparation k G₁ G₂ → S.IsKSeparation k G₁ G₂ := by + rintro G₁ G₂ k ⟨⟨hs, hb⟩, h₁, h₂⟩ + exact ⟨⟨hG ▸ hs, hbar.trans hb⟩, h₁, hG ▸ h₂⟩ + exact ⟨fun k hk G₁ G₂ h => hconn k hk _ _ (key h), + fun k hk G₁ G₂ h => hint k hk _ _ ⟨key h.1, hG ▸ h.2⟩⟩ + +end Society + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section6c.lean b/LeanPool/GraphMinor/GM09/Section6c.lean new file mode 100644 index 0000000000..e43c8ca652 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section6c.lean @@ -0,0 +1,822 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section3b +import LeanPool.GraphMinor.GM09.Section3c +import LeanPool.GraphMinor.GM09.Section4a +import LeanPool.GraphMinor.GM09.Section4b +import LeanPool.GraphMinor.GM09.Section5b +public import LeanPool.GraphMinor.GM09.Section6 +public import LeanPool.GraphMinor.GM09.Section6b +import LeanPool.GraphMinor.GM09.Section7 +import LeanPool.GraphMinor.GM09.Section10e +import Mathlib.Data.Set.Card + +/-! +# The inductive step of (6.1) of Graph Minors IX + +The proof of (6.1) shrinks a large transaction twice, each time getting rid of one peripheral +separating member. This file carries out that step (page 58): we list the paths in order starting +from a peripheral separating path `P₁`. If one of the next `p + 4` paths is non-separating we keep +it. Otherwise we use (5.5) to find a new non-separating path. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Graph GraphMinor + +universe u v + +variable {α : Type u} {β : Type v} + +namespace Society + +variable {S : Society α β} + +theorem IsFenceFor.mono {F F' : Set (Graph α β)} {A B : Set α} (h : S.IsFenceFor F A B) + (hsub : F' ⊆ F) : S.IsFenceFor F' A B := + ⟨⟨fun R hR => h.1.1 R (hsub hR), fun _ hR₁ _ hR₂ hne => h.1.2 (hsub hR₁) (hsub hR₂) hne⟩, + h.2.1, fun R hR => h.2.2 R (hsub hR)⟩ + +theorem IsFenceFor.symm {F : Set (Graph α β)} {A B : Set α} (h : S.IsFenceFor F A B) : + S.IsFenceFor F B A := by + refine ⟨h.1, h.2.1.symm, fun R hR => ?_⟩ + obtain ⟨a, ha, b, hb, e⟩ := h.2.2 R hR + exact ⟨b, hb, a, ha, IsOmegaPathWithEnds.symm S e⟩ + +/-- If a separating path `R` is peripheral in a set `next`, and an end of `next` lies in `Ω(a, b)`, +and every path of `F` not in `next` has an end in `Ω(a, b)`, then `R` is peripheral in `F`. The +reason is that a path of `F` with an end in `Ω(b, a)` and an end in `Ω(a, b)` would cross `R`. -/ +theorem isPeripheralIn_of_next {F next : Set (Graph α β)} {R : Graph α β} {a b z : α} + (hRF : R ∈ F) (hRn : R ∈ next) (hsep : S.IsSeparatingOmegaPath R) + (hF : S.IsDisjointOmegaPathSet F) (hR : S.IsOmegaPathWithEnds R a b) + (hz : z ∈ S.Ω.interval a b) (hzn : z ∈ S.transactionEnds next) + (hoth : ∀ Q ∈ F, Q ∉ next → ∃ y ∈ S.Ω.interval a b, ∃ w, S.IsOmegaPathWithEnds Q y w) + (hper : S.IsPeripheralIn next R) : S.IsPeripheralIn F R := by + rcases (IsOmegaPathWithEnds.isPeripheralIn_iff S hRn hR).mp hper with h | h + · exact (disjoint_left.mp h hz hzn).elim + · refine (IsOmegaPathWithEnds.isPeripheralIn_iff S hRF hR).mpr (Or.inr ?_) + rw [disjoint_left] + rintro x hx ⟨Q, hQ, y, hQe⟩ + by_cases hQn : Q ∈ next + · exact disjoint_left.mp h hx ⟨Q, hQn, y, hQe⟩ + obtain ⟨y', hy', w, hw⟩ := hoth Q hQ hQn + have hne : Q ≠ R := fun h => hQn (h ▸ hRn) + rcases IsOmegaPathWithEnds.ends_eq S hw hQe with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact disjoint_left.mp (S.Ω.disjoint_interval_swap a b) hy' hx + · refine hsep.2 ⟨Q, hF.2 hQ hRF hne, _, _, _, _, hw, hR, ?_⟩ + exact (S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hy', hx⟩)).symm + +/-- Inside the arc from `s` to `t`, with `w` outside it and `u` before `v`, the cut at `w` and `v` +is a fence with `u` and everything from `w` to `s` on one side, and `v` and everything from `t` to +`w` on the other. -/ +theorem _root_.GraphMinor.GM09.CyclicPerm.exists_fence_of_arc {Ω : CyclicPerm α} {s t w u v : α} + (hw : w ∈ Ω.interval t s) (hv : v = t ∨ v ∈ Ω.interval s t) (hu : u = s ∨ u ∈ Ω.interval s v) + (hvbar : v ∈ Ω.bar) : + Ω.IsFence (Ω.interval w v) ({w, v} ∪ Ω.interval v w) ∧ u ∈ Ω.interval w v ∧ + Ω.interval w s ⊆ Ω.interval w v ∧ Ω.interval t w ⊆ Ω.interval v w := by + have ht : t ∈ Ω.interval s w := Ω.mem_interval_rotate_right hw + have hv' : v ∈ Ω.interval s w := by + rcases hv with rfl | hv + · exact ht + · exact Ω.interval_subset_interval_left ht hv + have hs : s ∈ Ω.interval w v := Ω.mem_interval_rotate_right hv' + have hne : w ≠ v := fun h => Ω.not_mem_interval_right s w (h ▸ hv') + refine ⟨?_, ?_, Ω.interval_subset_interval_left hs, ?_⟩ + · have := (Ω.isFence_interval_compl hvbar hw.1.1 hne.symm).symm + rwa [pair_comm] at this + · rcases hu with rfl | hu + · exact hs + · exact Ω.interval_subset_interval_right hs hu + · rcases hv with rfl | hv + · exact Subset.rfl + · have h4 : Ω.IsClockwise4 s v t w := Ω.isClockwise4_iff_interval.mpr ⟨hv, hw⟩ + exact Ω.interval_subset_interval_right + (Ω.isClockwise4_iff_interval.mp (Ω.isClockwise4_rotate h4)).1 + +/-- Two distinct points of the closed arc from `s` to `t`, listed so that the first comes before the +second. -/ +theorem _root_.GraphMinor.GM09.CyclicPerm.exists_ordered_of_mem_arc {Ω : CyclicPerm α} {s t x y : α} + (hx : x = s ∨ x = t ∨ x ∈ Ω.interval s t) (hy : y = s ∨ y = t ∨ y ∈ Ω.interval s t) + (hst : s ≠ t) (hsbar : s ∈ Ω.bar) (hxy : x ≠ y) : + ((x = s ∨ x ∈ Ω.interval s y) ∧ (y = t ∨ y ∈ Ω.interval s t)) ∨ + ((y = s ∨ y ∈ Ω.interval s x) ∧ (x = t ∨ x ∈ Ω.interval s t)) := by + rcases hx with rfl | rfl | hx + · rcases hy with rfl | rfl | hy + · exact (hxy rfl).elim + · exact Or.inl ⟨Or.inl rfl, Or.inl rfl⟩ + · exact Or.inl ⟨Or.inl rfl, Or.inr hy⟩ + · rcases hy with rfl | rfl | hy + · exact Or.inr ⟨Or.inl rfl, Or.inl rfl⟩ + · exact (hxy rfl).elim + · exact Or.inr ⟨Or.inr hy, Or.inl rfl⟩ + · rcases hy with rfl | rfl | hy + · exact Or.inr ⟨Or.inl rfl, Or.inr hx⟩ + · exact Or.inl ⟨Or.inr hx, Or.inl rfl⟩ + · have hne₁ : x ≠ s := hx.1.2 ∘ fun h => by simp [h] + have hne₂ : y ≠ s := hy.1.2 ∘ fun h => by simp [h] + rcases Ω.mem_interval_or_interval_swap hsbar hy.1.1 hx.1.1 hne₂.symm hne₁ hxy with h | h + · exact Or.inl ⟨Or.inr h, Or.inr hy⟩ + · exact Or.inr ⟨Or.inr (Ω.mem_interval_rotate_right h), Or.inr hx⟩ + +theorem ncard_image_fin_ge {γ : Type*} {k : ℕ} {f : Fin k → γ} (hf : Injective f) (m : ℕ) : + (f '' {i | m ≤ i.1}).ncard = k - m := by + rw [ncard_image_of_injective _ hf] + have h : {i : Fin k | m ≤ i.1} = + range (fun i : Fin (k - m) => (⟨m + i.1, by have := i.2; omega⟩ : Fin k)) := by + ext i + simp only [mem_ofPred_eq, mem_range, Fin.ext_iff] + constructor + · intro hi + exact ⟨⟨i.1 - m, by have := i.2; omega⟩, by simp; omega⟩ + · rintro ⟨j, hj⟩ + omega + rw [h, ← image_univ, ncard_image_of_injective, ncard_univ, Nat.card_eq_fintype_card, + Fintype.card_fin] + intro i j hij + simp only [Fin.mk.injEq] at hij + exact Fin.ext (by omega) + +/-- A bijection of `Fin k` for which each of the first `n` points goes below everything after it +is the identity on those points. -/ +theorem eq_self_of_lt_of_forall {k n : ℕ} {φ : Fin k → Fin k} (hinj : Injective φ) + (hsurj : Surjective φ) (hlt : ∀ i j : Fin k, i.1 < n → i < j → φ i < φ j) : + ∀ i : Fin k, i.1 < n → φ i = i := by + have key : ∀ m (i : Fin k), i.1 = m → i.1 < n → φ i = i := by + intro m + induction m using Nat.strong_induction_on with + | _ m ih => + intro i hi hin + obtain ⟨j, hj⟩ := hsurj i + rcases lt_trichotomy j i with hji | rfl | hij + · have := ih j.1 (by rw [← hi]; exact hji) j rfl (lt_trans (show j.1 < i.1 from hji) hin) + rw [this] at hj + exact (hji.ne hj).elim + · exact hj + · have h₁ : φ i < i := hj ▸ hlt i j hin hij + have h₂ := ih (φ i).1 (by rw [← hi]; exact h₁) (φ i) rfl (lt_trans h₁ hin) + exact (h₁.ne (hinj h₂)).elim + exact fun i hi => key i.1 i rfl hi + +variable (S) in +/-- The paths of a transaction `F` of size `k`, listed in clockwise order of their ends: the first +ends in `L` are those on one side of a fence, with the path `R i` starting at the end number +`k - 1 - i`, and the second ends in the same list at `k`, `k + 1`, .... -/ +structure IsEndEnumeration (F : Set (Graph α β)) {k : ℕ} (L : List α) (R : Fin k → Graph α β) + (φ : Fin k → Fin k) : Prop where + len : L.length = 2 * k + cw : S.Ω.IsClockwiseSeq L + ends_eq : {v | v ∈ L} = S.transactionEnds F + inj : Injective R + range_eq : range R = F + φ_inj : Injective φ + φ_surj : Surjective φ + ends : ∀ i : Fin k, S.IsOmegaPathWithEnds (R i) + (L[k - 1 - i.1]'(by omega)) (L[k + (φ i).1]'(by omega)) + +namespace IsEndEnumeration + +variable {F : Set (Graph α β)} {k : ℕ} {L : List α} {R : Fin k → Graph α β} {φ : Fin k → Fin k} + +/-- The first end at index `i`. -/ +def endA (E : S.IsEndEnumeration F L R φ) (i : Fin k) : α := + L[k - 1 - i.1]'(by have := E.len; omega) + +/-- The second end at index `i`. -/ +def endB (E : S.IsEndEnumeration F L R φ) (i : Fin k) : α := + L[k + i.1]'(by have := E.len; omega) + +theorem ends' (E : S.IsEndEnumeration F L R φ) (i : Fin k) : + S.IsOmegaPathWithEnds (R i) (E.endA i) (E.endB (φ i)) := E.ends i + +theorem mem (E : S.IsEndEnumeration F L R φ) (i : Fin k) : R i ∈ F := + E.range_eq ▸ ⟨i, rfl⟩ + +theorem exists_eq (E : S.IsEndEnumeration F L R φ) {Q : Graph α β} (hQ : Q ∈ F) : + ∃ i, R i = Q := by + have : Q ∈ range R := E.range_eq ▸ hQ + exact this + +theorem endA_mem (E : S.IsEndEnumeration F L R φ) {x i : Fin k} (hx : x < i) (c : Fin k) : + E.endA x ∈ S.Ω.interval (E.endA i) (E.endB c) := by + have := E.len + exact S.Ω.mem_interval_of_lt E.cw (i₁ := k - 1 - i.1) (i₂ := k - 1 - x.1) (i₃ := k + c.1) + (by have : x.1 < i.1 := hx; omega) (by omega) (by omega) + +theorem endB_mem (E : S.IsEndEnumeration F L R φ) {c d : Fin k} (hcd : c < d) (i : Fin k) : + E.endB c ∈ S.Ω.interval (E.endA i) (E.endB d) := by + have := E.len + exact S.Ω.mem_interval_of_lt E.cw (i₁ := k - 1 - i.1) (i₂ := k + c.1) (i₃ := k + d.1) + (by omega) (by have : c.1 < d.1 := hcd; omega) (by omega) + +theorem endB_mem_endB (E : S.IsEndEnumeration F L R φ) {c d e : Fin k} (hcd : c < d) (hde : d < e) : + E.endB d ∈ S.Ω.interval (E.endB c) (E.endB e) := by + have := E.len + exact S.Ω.mem_interval_of_lt E.cw (i₁ := k + c.1) (i₂ := k + d.1) (i₃ := k + e.1) + (by have : c.1 < d.1 := hcd; omega) (by have : d.1 < e.1 := hde; omega) (by omega) + +/-- A separating path does not cross a path listed after it, so the second ends come in the same +order. -/ +theorem φ_lt_of_separating (E : S.IsEndEnumeration F L R φ) (hF : S.IsDisjointOmegaPathSet F) + {i j : Fin k} (hij : i < j) (hsep : S.IsSeparatingOmegaPath (R i)) : φ i < φ j := by + by_contra hlt + have hne : φ j ≠ φ i := fun h => hij.ne (E.φ_inj h).symm + have hji : φ j < φ i := lt_of_le_of_ne (not_lt.mp hlt) hne + have h₁ : E.endB (φ j) ∈ S.Ω.interval (E.endA i) (E.endB (φ i)) := E.endB_mem hji i + have h₂ : E.endA i ∈ S.Ω.interval (E.endA j) (E.endB (φ i)) := E.endA_mem hij _ + have h₃ : E.endA j ∈ S.Ω.interval (E.endB (φ i)) (E.endA i) := S.Ω.mem_interval_rotate_right h₂ + have hcr := S.Ω.crosses_iff_interval.mpr (Or.inr ⟨h₁, h₃⟩) + exact hsep.2 ⟨R j, hF.2 (E.mem j) (E.mem i) (fun h => hij.ne (E.inj h).symm), _, _, _, _, + E.ends' j, E.ends' i, hcr.symm⟩ + +end IsEndEnumeration + +/-- List a transaction in order, starting with a path `P₁` whose ends `a₁`, `b₁` are consecutive +among the ends of the transaction. -/ +theorem exists_isEndEnumeration {F : Set (Graph α β)} {P₁ : Graph α β} {a₁ b₁ : α} {k : ℕ} + (htrans : S.IsTransaction F) (hk : F.ncard = k) (hk₁ : 1 ≤ k) (hP₁ : P₁ ∈ F) + (hends : S.IsOmegaPathWithEnds P₁ a₁ b₁) + (hgap : Disjoint (S.Ω.interval a₁ b₁) (S.transactionEnds F)) : + ∃ (A B : Set α) (L : List α) (R : Fin k → Graph α β) (φ : Fin k → Fin k) + (E : S.IsEndEnumeration F L R φ), S.IsFenceFor F A B ∧ + R ⟨0, by omega⟩ = P₁ ∧ φ ⟨0, by omega⟩ = ⟨0, by omega⟩ ∧ + E.endA ⟨0, by omega⟩ = a₁ ∧ E.endB ⟨0, by omega⟩ = b₁ := by + classical + obtain ⟨A, B, hF, haA, hbB⟩ : ∃ A B, S.IsFenceFor F A B ∧ a₁ ∈ A ∧ b₁ ∈ B := by + obtain ⟨A, B, hF⟩ := htrans + obtain ⟨a, ha, b, hb, e⟩ := hF.2.2 P₁ hP₁ + rcases IsOmegaPathWithEnds.ends_eq S hends e with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨A, B, hF, ha, hb⟩ + · exact ⟨B, A, IsFenceFor.symm hF, hb, ha⟩ + obtain ⟨L, hlen, R, φ, hcw, hset, hinj, hsub, hφi, hφs, hRe, hLA, hLB, -⟩ := + S.exists_clockwise_enumeration hF hk hk₁ + have hrange : range R = F := by + refine eq_of_subset_of_ncard_le hsub ?_ (hF.1.finite S) + rw [← image_univ, ncard_image_of_injective _ hinj, ncard_univ, Nat.card_eq_fintype_card, + Fintype.card_fin, hk] + have E : S.IsEndEnumeration F L R φ := + ⟨hlen, hcw, hset, hinj, hrange, hφi, hφs, hRe⟩ + have hdisjAB := hF.2.1.2.2.1 + have ha_end : a₁ ∈ S.transactionEnds F := hends.mem_transactionEnds_left S hP₁ + have hb_end : b₁ ∈ S.transactionEnds F := hends.mem_transactionEnds_right S hP₁ + rw [← hset] at ha_end hb_end + obtain ⟨u, hu, rfl⟩ := List.getElem_of_mem ha_end + obtain ⟨v, hv, rfl⟩ := List.getElem_of_mem hb_end + have huk : u < k := by + by_contra h + exact disjoint_left.mp hdisjAB haA (hLB u hu (by omega)) + have hvk : k ≤ v := by + by_contra h + exact disjoint_left.mp hdisjAB (hLA v hv (by omega)) hbB + have hmem : ∀ n (hn : n < L.length), L[n] ∈ S.transactionEnds F := fun n hn => by + rw [← hset] + exact List.getElem_mem hn + have hu' : u = k - 1 := by + by_contra hne + have := S.Ω.mem_interval_of_lt hcw (i₁ := u) (i₂ := u + 1) (i₃ := v) (by omega) (by omega) hv + exact disjoint_left.mp hgap this (hmem _ _) + have hv' : v = k := by + by_contra hne + have := S.Ω.mem_interval_of_lt hcw (i₁ := u) (i₂ := k) (i₃ := v) (by omega) (by omega) hv + exact disjoint_left.mp hgap this (hmem _ _) + subst hv' + have h0 := hRe ⟨0, by omega⟩ + have hR0 : R ⟨0, by omega⟩ = P₁ := by + by_contra hne + have hd := hF.1.2 (E.mem ⟨0, by omega⟩) hP₁ hne + refine disjoint_left.mp hd h0.1.left_mem ?_ + have : L[v - 1 - (0 : ℕ)]'(by omega) = L[u] := by + congr 1 + omega + rw [this] + exact hends.1.left_mem + have he₁ : L[v - 1 - (0 : ℕ)]'(by omega) = L[u] := by + congr 1 + omega + refine ⟨A, B, L, R, φ, E, hF, hR0, ?_, he₁, rfl⟩ + rw [hR0, he₁] at h0 + rcases IsOmegaPathWithEnds.ends_eq S hends h0 with ⟨-, h⟩ | ⟨h, -⟩ + · have := (List.Nodup.getElem_inj_iff hcw.1).mp h + exact Fin.ext (by simp; omega) + · exact (hends.2.1 (by + have h' := (List.Nodup.getElem_inj_iff hcw.1).mp h + omega)).elim + +/-- A path with non-adjacent ends in a loopless graph has another vertex. -/ +theorem exists_inner_vertex {G P : Graph α β} {a b : α} (hP : IsGraphPathWithEnds G P a b) + (hab : a ≠ b) (hloop : ∀ e x y, G.IsLink e x y → x ≠ y) (hno : ∀ e, ¬ G.IsLink e a b) : + ∃ r ∈ V(P), r ≠ a ∧ r ≠ b := by + obtain ⟨hle, W, -⟩ := hP + cases W with + | nil hv => exact (hab rfl).elim + | cons hl rest => + rename_i x e + have hxa : x ≠ a := (hloop _ _ _ (hl.mono hle)).symm + refine ⟨x, hl.right_mem, hxa, ?_⟩ + rintro rfl + exact hno _ (hl.mono hle) + +/-- The first case of the step of (6.1): one of `P₂, …, P_{p+5}` is non-separating, and we keep it +together with `P_{p+6}, …`. -/ +theorem statementSt_succ_case_nonSeparating {p t k : ℕ} {P_set P_t : Set (Graph α β)} + {A B : Set α} {L : List α} {R : Fin k → Graph α β} {φ : Fin k → Fin k} + (ht : t < 2) (E : S.IsEndEnumeration P_t L R φ) (hF : S.IsFenceFor P_t A B) + (hcard_t : 3 * p + 8 - t * (p + 4) ≤ k) (hk : p + 5 ≤ k) {i₀ : Fin k} (hi₀ : i₀.1 = 0) + (hper₀ : S.IsPeripheralIn P_t (R i₀)) (hsep₀ : S.IsSeparatingOmegaPath (R i₀)) + (hper_card : + {P ∈ P_t | S.IsPeripheralIn P_t P ∧ S.IsSeparatingOmegaPath P}.ncard ≤ 2 - t) + (hsep_mem : ∀ P ∈ P_t, S.IsSeparatingOmegaPath P → P ∈ P_set) + (hper_sep : ∀ P ∈ P_t, S.IsPeripheralIn P_t P → S.IsSeparatingOmegaPath P → + S.IsPeripheralIn P_set P) + {j : Fin k} (hj₀ : j.1 ≠ 0) (hjp : j.1 < p + 5) (hj : S.IsNonSeparatingOmegaPath (R j)) : + S.StatementSt p P_set (t + 1) := by + have hrest_sub : R '' {i | p + 5 ≤ i.1} ⊆ P_t := by + rintro _ ⟨i, -, rfl⟩ + exact E.mem i + have hj_rest : R j ∉ R '' {i | p + 5 ≤ i.1} := by + rintro ⟨i, hi, h⟩ + have : i = j := E.inj h + have hi' : p + 5 ≤ i.1 := hi + rw [this] at hi' + omega + have hsub_next : insert (R j) (R '' {i | p + 5 ≤ i.1}) ⊆ P_t := + insert_subset (E.mem j) hrest_sub + have hfin : (R '' {i | p + 5 ≤ i.1}).Finite := (hF.1.finite S).subset hrest_sub + refine S.statementSt_succ_of_nonSeparating_member ht ⟨A, B, hF⟩ (E.mem i₀) hper₀ hsep₀ hper_card + hsep_mem hper_sep hsub_next ?_ (mem_insert _ _) hj ⟨A, B, IsFenceFor.mono hF hsub_next⟩ ?_ ?_ + · rintro (h | ⟨i, hi, h⟩) + · exact hj₀ (by rw [← E.inj h]; exact hi₀) + · have hi' : p + 5 ≤ i.1 := hi + rw [E.inj h] at hi' + omega + · rw [ncard_insert_of_notMem hj_rest hfin, ncard_image_fin_ge E.inj, + show (t + 1) * (p + 4) = t * (p + 4) + (p + 4) by ring] + generalize t * (p + 4) = x at hcard_t ⊢ + omega + · rintro Q (rfl | ⟨i, hi, rfl⟩) hper hsep + · exact Or.inl rfl + · have hi' : p + 5 ≤ i.1 := hi + refine Or.inr (isPeripheralIn_of_next (E.mem i) (Or.inr ⟨i, hi, rfl⟩) hsep hF.1 (E.ends' i) + (E.endA_mem (x := j) (Fin.lt_def.mpr (by omega)) _) + ((E.ends' j).mem_transactionEnds_left S (mem_insert _ _)) ?_ hper) + intro Q hQ hQn + obtain ⟨m, rfl⟩ := E.exists_eq hQ + have hm : m.1 < p + 5 := by + by_contra hge + exact hQn (Or.inr ⟨m, not_lt.mp hge, rfl⟩) + exact ⟨_, E.endA_mem (Fin.lt_def.mpr (by omega)) _, _, E.ends' m⟩ + +private theorem pairedPrefixEnds (L : List α) {k m : ℕ} (hlen : L.length = 2 * k) + (hm : m ≤ k) : + (List.ofFn fun i : Fin m => L[k - 1 - i.1]'(by have := i.2; omega)).reverse ++ + (List.ofFn fun i : Fin m => L[k + i.1]'(by have := i.2; omega)) = + (L.drop (k - m)).take (2 * m) := by + apply List.ext_getElem + · simp + omega + · intro n h₁ h₂ + rw [List.getElem_take, List.getElem_drop, List.getElem_append] + split + · rename_i hn + simp only [List.length_reverse, List.length_ofFn] at hn + rw [List.getElem_reverse, List.getElem_ofFn] + simp only [List.length_ofFn] + congr 1 + omega + · rename_i hn + simp only [List.length_reverse, List.length_ofFn] at hn + rw [List.getElem_ofFn] + simp only [List.length_reverse, List.length_ofFn] + congr 1 + omega + +/-- The second case of the step of (6.1): all of `P₁, …, P_{p+5}` are separating, and (5.5) gives a +non-separating path on the far side of `P_{p+5}`, which we add to `P_{p+6}, …`. -/ +theorem statementSt_succ_case_replacement {p t k : ℕ} {P_set P_t : Set (Graph α β)} + {A B : Set α} {L : List α} {R : Fin k → Graph α β} {φ : Fin k → Fin k} + (hconn : S.IsInternallyKConnected 4) (hp2 : 2 ≤ p) (hp3 : p ≠ 3) + (ht : t < 2) (E : S.IsEndEnumeration P_t L R φ) (hF : S.IsFenceFor P_t A B) + (hcard_t : 3 * p + 8 - t * (p + 4) ≤ k) (hk : p + 6 ≤ k) {i₀ : Fin k} (hi₀ : i₀.1 = 0) + (hper₀ : S.IsPeripheralIn P_t (R i₀)) (hsep₀ : S.IsSeparatingOmegaPath (R i₀)) + (hper_card : + {P ∈ P_t | S.IsPeripheralIn P_t P ∧ S.IsSeparatingOmegaPath P}.ncard ≤ 2 - t) + (hsep_mem : ∀ P ∈ P_t, S.IsSeparatingOmegaPath P → P ∈ P_set) + (hper_sep : ∀ P ∈ P_t, S.IsPeripheralIn P_t P → S.IsSeparatingOmegaPath P → + S.IsPeripheralIn P_set P) + (hall : ∀ i : Fin k, i.1 < p + 5 → S.IsSeparatingOmegaPath (R i)) + (hno_int : ∀ Q ∈ P_set, Disjoint (pathInternalVerts S.G Q) S.Ω.bar) + (hempty : S.Ω.interval (E.endA i₀) (E.endB i₀) = ∅) + (_hφ₀ : φ i₀ = i₀) + (hind : S.G.induce V(R i₀) = R i₀) + (hcatch : Catches (S.Ω.interval (E.endB i₀) (E.endA i₀)) (deleteVertices S.G V(R i₀))) + (hloop : ∀ e x y, S.G.IsLink e x y → x ≠ y) + (hno_gap : ∀ e, ¬ S.G.IsLink e (E.endA i₀) (E.endB i₀)) + (hext : ∀ (S₀ : Society α β) (r : α), S₀.G = S.G → r ∉ S.Ω.bar → + S₀.Ω.bar = S.Ω.bar ∪ {r} → S₀.Ω.IsRestriction S.Ω.bar S.Ω → + ∃ P₀ : Set (Graph α β), S₀.IsCrookedTransaction P₀ ∧ p ≤ P₀.ncard) + (hno_cr : ∀ P_c : Set (Graph α β), S.IsCrookedTransaction P_c → P_c.ncard ≠ p) : + S.StatementSt p P_set (t + 1) := by + classical + have hφ : ∀ i : Fin k, i.1 < p + 5 → φ i = i := eq_self_of_lt_of_forall E.φ_inj E.φ_surj + fun i j hi hij => E.φ_lt_of_separating hF.1 hij (hall i hi) + have hφge : ∀ i : Fin k, p + 5 ≤ i.1 → p + 5 ≤ (φ i).1 := by + intro i hi + by_contra hlt + have h := hφ (φ i) (by omega) + rw [E.φ_inj h] at hlt + omega + have hends₀ : ∀ i : Fin k, i.1 < p + 5 → S.IsOmegaPathWithEnds (R i) (E.endA i) (E.endB i) := by + intro i hi + have := E.ends' i + rwa [hφ i hi] at this + have hint : ∀ i : Fin k, i.1 < p + 5 → Disjoint (pathInternalVerts S.G (R i)) S.Ω.bar := + fun i hi => hno_int _ (hsep_mem _ (E.mem i) (hall i hi)) + let m : Fin k := ⟨p + 4, by omega⟩ + have hm : m.1 < p + 5 := by simp [m] + obtain ⟨G₁, G₂, _, hsep, hinter, hle₁, hab₁, hba₂, -⟩ := + S.exists_minimal_separation_of_separating (hends₀ m hm) (hall m hm) (hint m hm) + -- The objects needed for (5.5). + let ι : Fin (p + 5) → Fin k := fun i => ⟨i.1, by omega⟩ + have hι : Injective ι := fun i j h => Fin.ext (by simpa [ι] using h) + have hi0 : ι 0 = i₀ := Fin.ext (by simp [ι, hi₀]) + have hιm : ι ⟨p + 4, by omega⟩ = m := rfl + have hιlt : ∀ i, (ι i).1 < p + 5 := fun i => i.2 + have hr : ∃ r ∈ V(R i₀), r ≠ E.endA i₀ ∧ r ≠ E.endB i₀ := + exists_inner_vertex (hends₀ i₀ (by omega)).1 (hends₀ i₀ (by omega)).2.1 hloop hno_gap + obtain ⟨r, hrV, hra, hrb⟩ := hr + have hrbar : r ∉ S.Ω.bar := by + intro h + have hin : r ∈ V(R i₀) ∩ S.Ω.bar := ⟨hrV, h⟩ + rw [(hends₀ i₀ (by omega)).vertexSet_inter_bar_eq S (hint i₀ (by omega))] at hin + rcases hin with h | h + · exact hra h + · exact hrb h + have ha₀ : E.endA i₀ ∈ S.Ω.bar := (hends₀ i₀ (by omega)).2.2.1 + have hb₀ : E.endB i₀ ∈ S.Ω.bar := (hends₀ i₀ (by omega)).2.2.2 + obtain ⟨S₀, hG₀, hbar₀, hres₀, hcw₀⟩ := S.exists_extension ha₀ hb₀ (hends₀ i₀ (by omega)).2.1 + ((hends₀ i₀ (by omega)).1.1.vertexSet_mono hrV) hrbar hempty + have hlist : (List.ofFn fun i => E.endA (ι i)).reverse ++ (List.ofFn fun i => E.endB (ι i)) = + (L.drop (k - (p + 5))).take (2 * (p + 5)) := by + simpa only [IsEndEnumeration.endA, IsEndEnumeration.endB, ι] using + pairedPrefixEnds L E.len (m := p + 5) (by omega) + have hcw : S.Ω.IsClockwiseSeq + ((List.ofFn fun i => E.endA (ι i)).reverse ++ (List.ofFn fun i => E.endB (ι i))) := by + rw [hlist] + exact E.cw.sublist ((List.take_sublist _ _).trans (List.drop_sublist _ _)) + have htr_Q : S.IsTransaction (range fun i => R (ι i)) := by + refine ⟨A, B, IsFenceFor.mono hF ?_⟩ + rintro _ ⟨i, rfl⟩ + exact E.mem _ + have hcatches : Catches (S.Ω.bar \ {E.endA i₀, E.endB i₀}) (deleteVertices S.G V(R i₀)) := by + have heq : S.Ω.bar \ {E.endA i₀, E.endB i₀} = S.Ω.interval (E.endB i₀) (E.endA i₀) := by + ext x + constructor + · rintro ⟨hx, hne⟩ + simp only [mem_insert_iff, mem_singleton_iff, not_or] at hne + rcases S.Ω.mem_interval_or_interval_swap ha₀ hb₀ hx (hends₀ i₀ (by omega)).2.1 hne.1 + hne.2 with h | h + · rw [hempty] at h + exact h.elim + · exact h + · intro hx + refine ⟨hx.1.1, ?_⟩ + simp only [mem_insert_iff, mem_singleton_iff, not_or] + exact ⟨fun h => S.Ω.not_mem_interval_right _ _ (h ▸ hx), + fun h => S.Ω.not_mem_interval_left _ _ (h ▸ hx)⟩ + rw [heq] + exact hcatch + obtain ⟨-, P', hP'_nonsep, hP'_le⟩ := S.theorem_5_5_proof (S₀ := S₀) (p := p) + (Q := fun i => R (ι i)) (a := fun i => E.endA (ι i)) (b := fun i => E.endB (ι i)) (r := r) + hconn hp2 hp3 (E.inj.comp hι) htr_Q (fun i => hall _ (hιlt i)) (fun i => hint _ (hιlt i)) + (fun i => hends₀ _ (hιlt i)) hcw (by rw [hi0]; exact hempty) + (by rw [hi0]; exact ⟨hrV, by simp [hra, hrb]⟩) hsep hinter hle₁ hab₁ hba₂ hG₀ hbar₀ hres₀ + (by rw [hi0]; exact hcw₀) (by rw [hi0]; exact hind) (by rw [hi0]; exact hcatches) + (hext S₀ r hG₀ hrbar hbar₀ hres₀) hno_cr + -- The paths after `P_{p+5}` lie on the second side. + have hdisj : ∀ i : Fin k, p + 5 ≤ i.1 → Disjoint V(P') V(R i) := by + intro i hi + have hne : R i ≠ R m := fun h => by + have := E.inj h + rw [this] at hi + simp [m] at hi + have hav : Disjoint V(R i) (V(G₁) ∩ V(G₂)) := by + rw [hinter] + exact hF.1.2 (E.mem i) (E.mem m) hne + have ha_in : E.endA i ∈ S.Ω.interval (E.endB m) (E.endA m) := + S.Ω.mem_interval_rotate_right (E.endA_mem (Fin.lt_def.mpr (by simp [m]; omega)) m) + have hsubV : V(R i) ⊆ V(G₂) \ V(G₁) := + connected_subset_right_of_avoids_inter hsep (E.ends' i).1.1 + (E.ends' i).1.isGraphConnected hav ⟨E.endA i, (E.ends' i).1.left_mem, hba₂ ha_in⟩ + rw [disjoint_right] + exact fun z hz hz' => (hsubV hz).2 (hP'_le.vertexSet_mono hz') + obtain ⟨u, v, hPuv⟩ := hP'_nonsep.1 + have hm_ends := hends₀ m hm + have harc : ∀ x, x ∈ V(G₁) → x ∈ S.Ω.bar → + x = E.endA m ∨ x = E.endB m ∨ x ∈ S.Ω.interval (E.endA m) (E.endB m) := by + intro x hx₁ hxb + by_contra hcon + simp only [not_or] at hcon + rcases S.Ω.mem_interval_or_interval_swap hm_ends.2.2.1 hm_ends.2.2.2 hxb hm_ends.2.1 hcon.1 + hcon.2.1 with h | h + · exact hcon.2.2 h + · have hin : x ∈ V(R m) ∩ S.Ω.bar := ⟨hinter ▸ ⟨hx₁, hba₂ h⟩, hxb⟩ + rw [hm_ends.vertexSet_inter_bar_eq S (hint m hm)] at hin + rcases hin with h' | h' + · exact hcon.1 h' + · exact hcon.2.1 h' + have hord := CyclicPerm.exists_ordered_of_mem_arc + (harc u (hP'_le.vertexSet_mono hPuv.1.left_mem) hPuv.2.2.1) + (harc v (hP'_le.vertexSet_mono hPuv.1.right_mem) hPuv.2.2.2) hm_ends.2.1 hm_ends.2.2.1 hPuv.2.1 + obtain ⟨u', v', hPe, hu', hv'⟩ : ∃ u' v', S.IsOmegaPathWithEnds P' u' v' ∧ + (u' = E.endA m ∨ u' ∈ S.Ω.interval (E.endA m) v') ∧ + (v' = E.endB m ∨ v' ∈ S.Ω.interval (E.endA m) (E.endB m)) := by + rcases hord with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact ⟨u, v, hPuv, h₁, h₂⟩ + · exact ⟨v, u, IsOmegaPathWithEnds.symm S hPuv, h₁, h₂⟩ + let last : Fin k := ⟨k - 1, by omega⟩ + have hmlast : m < last := Fin.lt_def.mpr (by simp [m, last]; omega) + have hw : E.endB last ∈ S.Ω.interval (E.endB m) (E.endA m) := + S.Ω.mem_interval_rotate_left (E.endB_mem hmlast m) + obtain ⟨hfence, huw, hA_sub, hB_sub⟩ := CyclicPerm.exists_fence_of_arc hw hv' hu' hPe.2.2.2 + have hrest_sub : R '' {i | p + 5 ≤ i.1} ⊆ P_t := by + rintro _ ⟨i, -, rfl⟩ + exact E.mem i + have hF' : S.IsFenceFor (insert P' (R '' {i | p + 5 ≤ i.1})) (S.Ω.interval (E.endB last) v') + ({E.endB last, v'} ∪ S.Ω.interval v' (E.endB last)) := by + refine ⟨⟨?_, ?_⟩, hfence, ?_⟩ + · rintro Q (rfl | ⟨i, -, rfl⟩) + · exact ⟨_, _, hPe⟩ + · exact ⟨_, _, E.ends' i⟩ + · rintro Q₁ (rfl | ⟨i, hi, rfl⟩) Q₂ (rfl | ⟨j, hj, rfl⟩) hne + · exact (hne rfl).elim + · exact hdisj j hj + · exact (hdisj i hi).symm + · exact hF.1.2 (E.mem i) (E.mem j) hne + · rintro Q (rfl | ⟨i, hi, rfl⟩) + · exact ⟨u', huw, v', Or.inl (Or.inr rfl), hPe⟩ + · have hi' : p + 5 ≤ i.1 := hi + refine ⟨E.endA i, hA_sub (S.Ω.mem_interval_rotate_right + (E.endA_mem (Fin.lt_def.mpr (by simp [m]; omega)) last)), E.endB (φ i), ?_, E.ends' i⟩ + have hφi := hφge i hi' + by_cases hl : φ i = last + · rw [hl] + exact Or.inl (Or.inl rfl) + · have hlt : φ i < last := by + refine lt_of_le_of_ne ?_ hl + exact Fin.le_def.mpr (by simp [last]; have := (φ i).2; omega) + exact Or.inr (hB_sub (E.endB_mem_endB (Fin.lt_def.mpr (by simp [m]; omega)) hlt)) + have hP'_rest : P' ∉ R '' {i | p + 5 ≤ i.1} := by + rintro ⟨i, hi, rfl⟩ + exact disjoint_left.mp (hdisj i hi) (E.ends' i).1.left_mem (E.ends' i).1.left_mem + have hfin : (R '' {i | p + 5 ≤ i.1}).Finite := (hF.1.finite S).subset hrest_sub + have hrest_diff : R '' {i | p + 5 ≤ i.1} ⊆ P_t \ {R i₀} := by + rintro _ ⟨i, hi, rfl⟩ + refine ⟨E.mem i, fun h => ?_⟩ + have hi' : p + 5 ≤ i.1 := hi + rw [E.inj h] at hi' + omega + refine S.statementSt_succ_of_replacement_nonSeparating ht ⟨A, B, hF⟩ (E.mem i₀) hper₀ hsep₀ + hper_card hsep_mem hper_sep hrest_diff hP'_nonsep ⟨_, _, hF'⟩ ?_ ?_ + · rw [ncard_insert_of_notMem hP'_rest hfin, ncard_image_fin_ge E.inj, + show (t + 1) * (p + 4) = t * (p + 4) + (p + 4) by ring] + generalize t * (p + 4) = x at hcard_t ⊢ + omega + · rintro Q (rfl | ⟨i, hi, rfl⟩) hper hsep + · exact Or.inl rfl + · have hi' : p + 5 ≤ i.1 := hi + have hmi : m < i := Fin.lt_def.mpr (by simp [m]; omega) + have hs_in : E.endA m ∈ S.Ω.interval (E.endA i) (E.endB (φ i)) := E.endA_mem hmi _ + have ht_in : E.endB m ∈ S.Ω.interval (E.endA i) (E.endB (φ i)) := + E.endB_mem (Fin.lt_def.mpr (by have := hφge i hi'; simp [m]; omega)) i + have hu_in : u' ∈ S.Ω.interval (E.endA i) (E.endB (φ i)) := by + have hsub : S.Ω.interval (E.endA m) (E.endB m) ⊆ + S.Ω.interval (E.endA i) (E.endB (φ i)) := fun z hz => + S.Ω.interval_subset_interval_left ht_in + (S.Ω.interval_subset_interval_right (E.endA_mem hmi m) hz) + rcases hu' with rfl | hu' + · exact hs_in + · rcases hv' with rfl | hv' + · exact hsub hu' + · exact hsub (S.Ω.interval_subset_interval_left hv' hu') + refine Or.inr (isPeripheralIn_of_next (E.mem i) (Or.inr ⟨i, hi, rfl⟩) hsep hF.1 (E.ends' i) + hu_in (hPe.mem_transactionEnds_left S (mem_insert _ _)) ?_ hper) + intro Q hQ hQn + obtain ⟨n, rfl⟩ := E.exists_eq hQ + have hn : n.1 < p + 5 := by + by_contra hge + exact hQn (Or.inr ⟨n, not_lt.mp hge, rfl⟩) + exact ⟨_, E.endA_mem (Fin.lt_def.mpr (by omega)) _, _, E.ends' n⟩ + +/-- The step `S_t → S_{t+1}` of (6.1) (page 58). The hypothesis `hc9` is (9) of that proof for the +transaction `P_set`, and `hext` says that adding one vertex to `Ω` gives a crooked transaction of +size `p`. -/ +theorem statementSt_step {p t : ℕ} {P_set : Set (Graph α β)} (hp2 : 2 ≤ p) (hp3 : p ≠ 3) + (hconn : S.IsInternallyKConnected 4) (ht : t < 2) + (hloop : ∀ e x y, S.G.IsLink e x y → x ≠ y) + (hbd : ∀ e a b, S.G.IsLink e a b → a ∈ S.Ω.bar → b ∈ S.Ω.bar → a ≠ b → + S.Ω.interval a b ≠ ∅) + (hno_int : ∀ Q ∈ P_set, Disjoint (pathInternalVerts S.G Q) S.Ω.bar) + (hc9 : ∀ P ∈ P_set, S.IsSeparatingOmegaPath P → ∀ a b, S.IsOmegaPathWithEnds P a b → + Disjoint (S.Ω.interval a b) (S.transactionEnds P_set) → + S.Ω.interval a b = ∅ ∧ P = S.G.induce V(P) ∧ + Catches (S.Ω.interval b a) (deleteVertices S.G V(P))) + (hext : ∀ (S₀ : Society α β) (r : α), S₀.G = S.G → r ∉ S.Ω.bar → + S₀.Ω.bar = S.Ω.bar ∪ {r} → S₀.Ω.IsRestriction S.Ω.bar S.Ω → + ∃ P₀ : Set (Graph α β), S₀.IsCrookedTransaction P₀ ∧ p ≤ P₀.ncard) + (hno_cr : ∀ P_c : Set (Graph α β), S.IsCrookedTransaction P_c → P_c.ncard ≠ p) + (hSt : S.StatementSt p P_set t) : S.StatementSt p P_set (t + 1) := by + refine S.statementSt_succ ht hSt fun P_t htrans hcard_t hper_card hsep_mem hper_sep hex => ?_ + obtain ⟨P₁, hin, hper, hsep⟩ := hex + have hP₁ := hsep_mem P₁ hin hsep + obtain ⟨a₁, b₁, hends, hgap⟩ : ∃ a₁ b₁, S.IsOmegaPathWithEnds P₁ a₁ b₁ ∧ + Disjoint (S.Ω.interval a₁ b₁) (S.transactionEnds P_set) := by + obtain ⟨-, a, b, e, hd | hd⟩ := hper_sep P₁ hin hper hsep + · exact ⟨a, b, e, hd⟩ + · exact ⟨b, a, IsOmegaPathWithEnds.symm S e, hd⟩ + obtain ⟨hemp, hind, hcatch⟩ := hc9 P₁ hP₁ hsep a₁ b₁ hends hgap + have hk : 2 * p + 4 ≤ P_t.ncard := by + interval_cases t <;> omega + obtain ⟨A, B, L, R, φ, E, hF, hR0, hφ0, hA0, hB0⟩ := + S.exists_isEndEnumeration htrans rfl (by omega) hin hends (by rw [hemp]; exact empty_disjoint _) + by_cases hall : ∀ i : Fin P_t.ncard, i.1 < p + 5 → S.IsSeparatingOmegaPath (R i) + · refine S.statementSt_succ_case_replacement hconn hp2 hp3 ht E hF hcard_t (by omega) + (i₀ := ⟨0, by omega⟩) rfl (hR0 ▸ hper) (hR0 ▸ hsep) hper_card hsep_mem hper_sep hall hno_int + (by rw [hA0, hB0]; exact hemp) hφ0 ?_ ?_ hloop ?_ hext hno_cr + · rw [hR0] + exact hind.symm + · rw [hA0, hB0, hR0] + exact hcatch + · rw [hA0, hB0] + exact fun e hl => hbd e _ _ hl hends.2.2.1 hends.2.2.2 hends.2.1 hemp + · push Not at hall + obtain ⟨j, hjp, hjn⟩ := hall + have hj₀ : j.1 ≠ 0 := by + intro h + have : j = ⟨0, by omega⟩ := Fin.ext h + rw [this, hR0] at hjn + exact hjn hsep + have hω : S.IsOmegaPath (R j) := hF.1.1 _ (E.mem j) + have hnon : S.IsNonSeparatingOmegaPath (R j) := by + refine ⟨hω, ?_⟩ + by_contra hcr + exact hjn ⟨hω, hcr⟩ + exact S.statementSt_succ_case_nonSeparating ht E hF hcard_t (by omega) (i₀ := ⟨0, by omega⟩) rfl + (hR0 ▸ hper) (hR0 ▸ hsep) hper_card hsep_mem hper_sep hj₀ hjp hnon + +/-- The quantity that drops in the proof of (6.1): deleting an edge or a vertex of `ΩBar` lowers its +first part, and adding a vertex to `Ω` lowers its second part. -/ +noncomputable def sixOneMeasure (S : Society α β) : ℕ := + 2 * (V(S.G).ncard + E(S.G).ncard) + (V(S.G) \ S.Ω.bar).ncard + +theorem sixOneMeasure_deleteEdge {e : β} (he : e ∈ E(S.G)) : + sixOneMeasure (S.deleteEdge e) < sixOneMeasure S := by + have h := ncard_deleteEdge (S := S) he + have hV : V((S.deleteEdge e).G) \ (S.deleteEdge e).Ω.bar = V(S.G) \ S.Ω.bar := by + rw [vertexSet_deleteEdge] + rfl + unfold sixOneMeasure + rw [hV] + omega + +theorem sixOneMeasure_deleteBarVertex {v : α} (hv : v ∈ S.Ω.bar) + (hno : ∀ e x, ¬ S.G.IsLink e v x) : + sixOneMeasure (S.deleteBarVertex v) < sixOneMeasure S := by + have h := ncard_deleteBarVertex hv hno + have hV : V((S.deleteBarVertex v).G) \ (S.deleteBarVertex v).Ω.bar = V(S.G) \ S.Ω.bar := by + rw [vertexSet_deleteBarVertex] + change _ \ (S.Ω.restrict (S.Ω.bar \ {v}) sdiff_subset).bar = _ + rw [S.Ω.restrict_bar] + ext x + simp only [mem_sdiff, mem_singleton_iff, not_and, not_not] + constructor + · rintro ⟨⟨h₁, h₂⟩, h₃⟩ + exact ⟨h₁, fun hx => h₂ (h₃ hx)⟩ + · rintro ⟨h₁, h₂⟩ + exact ⟨⟨h₁, fun hx => h₂ (hx ▸ hv)⟩, fun hx => (h₂ hx).elim⟩ + unfold sixOneMeasure + rw [hV] + omega + +theorem sixOneMeasure_extension {S₀ : Society α β} {r : α} (hG : S₀.G = S.G) (hr : r ∉ S.Ω.bar) + (hbar : S₀.Ω.bar = S.Ω.bar ∪ {r}) : sixOneMeasure S₀ < sixOneMeasure S := by + have hrV : r ∈ V(S.G) := hG ▸ S₀.bar_subset (hbar ▸ Or.inr rfl) + have hsub : V(S.G) \ S₀.Ω.bar ⊂ V(S.G) \ S.Ω.bar := by + refine ⟨fun x hx => ⟨hx.1, fun h => hx.2 (hbar ▸ Or.inl h)⟩, fun h => ?_⟩ + exact (h ⟨hrV, hr⟩).2 (hbar ▸ Or.inr rfl) + have := ncard_lt_ncard hsub (S.finite_V.subset sdiff_subset) + unfold sixOneMeasure + rw [hG] + omega + +/-- **Graph Minors IX, (6.1)** (page 55): the sophistication bound as a statement about +`HasSophisticationLE`, by induction on `sixOneMeasure`. -/ +theorem hasSophisticationLE_of_no_crooked {p : ℕ} (hp2 : 2 ≤ p) (hp3 : p ≠ 3) : + ∀ (n : ℕ) (S : Society α β), sixOneMeasure S = n → S.IsKConnected 3 → + S.IsInternallyKConnected 4 → + (∀ P_set : Set (Graph α β), S.IsCrookedTransaction P_set → P_set.ncard ≠ p) → + S.HasSophisticationLE (3 * p + 7) := by + intro n + induction n using Nat.strong_induction_on with + | _ n ih => + intro S hn hconn3 hconn4 hno_cr + subst hn + by_contra hns + -- Deleting an edge which leaves the connectivity alone would finish the proof. + have hdel : ∀ {e : β} {u w : α}, S.G.IsLink e u w → + (∀ G₁ G₂, (S.deleteEdge e).IsSocietySeparation G₁ G₂ → + (u ∈ V(G₁) ∧ w ∈ V(G₁)) ∨ (u ∈ V(G₂) ∧ w ∈ V(G₂))) → + (S.deleteEdge e).HasSophisticationLE (3 * p + 7) := by + intro e u w hl hside + obtain ⟨h₁, h₂⟩ := connected_deleteEdge hl hconn3 hconn4 hside + exact ih _ (sixOneMeasure_deleteEdge hl.edge_mem) _ rfl h₁ h₂ + fun P hP => hno_cr P hP.of_deleteEdge + -- (1): the graph is simple. + have hloop : ∀ e x y, S.G.IsLink e x y → x ≠ y := by + rintro e x y hl rfl + exact hns (hasSophisticationLE_of_deleteEdge_loop hl + (hdel hl fun _ _ hs => side_of_redundant hl (Or.inl rfl) hs)) + have hpar : ∀ e f x y, S.G.IsLink e x y → S.G.IsLink f x y → e = f := by + intro e f x y he hf + by_contra hne + have hne' : f ≠ e := Ne.symm hne + exact hns (hasSophisticationLE_of_deleteEdge_parallel he hne' hf (hloop _ _ _ he) + (hdel he fun _ _ hs => side_of_redundant he (Or.inr ⟨f, hne', hf⟩) hs)) + have hsimple : IsSimpleGraph S.G := + ⟨fun e _ x hl => hloop e x x hl rfl, fun e he f hf x y h₁ h₂ => hpar e f x y h₁ h₂⟩ + -- (2): every vertex of `ΩBar` has a neighbour. + have hno_iso : ∀ v ∈ S.Ω.bar, ∃ u : α, S.G.Adj v u := by + intro v hv + by_contra hcon + have hno : ∀ e x, ¬ S.G.IsLink e v x := fun e x hl => hcon ⟨x, e, hl⟩ + obtain ⟨h₁, h₂⟩ := connected_deleteBarVertex hv hno hconn3 hconn4 + exact hns (hasSophisticationLE_of_deleteBarVertex hv hno + (ih _ (sixOneMeasure_deleteBarVertex hv hno) _ rfl h₁ h₂ + fun P hP => hno_cr P hP.of_deleteBarVertex)) + -- (4): no edge joins two consecutive vertices of `Ω`. + have hbd : ∀ e a b, S.G.IsLink e a b → a ∈ S.Ω.bar → b ∈ S.Ω.bar → a ≠ b → + S.Ω.interval a b ≠ ∅ := by + intro e a b hl ha hb hab hgap + exact hns (hasSophisticationLE_of_deleteEdge_boundary hl ha hb hab hgap + (hdel hl fun _ _ hs => Or.inr ⟨hs.2 ha, hs.2 hb⟩)) + -- A transaction of size `3p + 8` exists. + have hex : ∃ P₀ : Set (Graph α β), S.IsTransaction P₀ ∧ P₀.ncard = 3 * p + 8 := by + by_contra hcon + refine hns (hasSophisticationLE_of_forall_le S fun F hF => ?_) + by_contra hlt + obtain ⟨F', hF', hc⟩ := Set.exists_subset_card_eq (s := F) (n := 3 * p + 8) (by omega) + obtain ⟨A, B, hf⟩ := hF + exact hcon ⟨F', ⟨A, B, IsFenceFor.mono hf hF'⟩, hc⟩ + obtain ⟨P_set, htrans, hcard, hno_int, hmax⟩ := + S.exists_transaction_with_max_coveredComponentUnion hex + have hc9 : ∀ P ∈ P_set, S.IsSeparatingOmegaPath P → ∀ a b, S.IsOmegaPathWithEnds P a b → + Disjoint (S.Ω.interval a b) (S.transactionEnds P_set) → + S.Ω.interval a b = ∅ ∧ P = S.G.induce V(P) ∧ + Catches (S.Ω.interval b a) (deleteVertices S.G V(P)) := + fun P hP hsep a b hab hd => S.lemma_6_1_claim_9 hp2 hconn3 hno_cr hsimple hno_iso + htrans hcard hno_int hmax hP hsep hab hd + -- Adding a vertex to `Ω` gives a society to which the induction applies. + have hext : ∀ (S₀ : Society α β) (r : α), S₀.G = S.G → r ∉ S.Ω.bar → + S₀.Ω.bar = S.Ω.bar ∪ {r} → S₀.Ω.IsRestriction S.Ω.bar S.Ω → + ∃ P₀ : Set (Graph α β), S₀.IsCrookedTransaction P₀ ∧ p ≤ P₀.ncard := by + intro S₀ r hG hr hbar hres + by_contra hcon + have hsub : S.Ω.bar ⊆ S₀.Ω.bar := hbar ▸ subset_union_left + obtain ⟨h₁, h₂⟩ := connected_of_extension hG hsub hconn3 hconn4 + refine hns (HasSophisticationLE.of_extension hG hsub hres + (ih _ (sixOneMeasure_extension hG hr hbar) _ rfl h₁ h₂ fun P hP hc => ?_)) + exact hcon ⟨P, hP, hc.ge⟩ + have hS₂ : S.StatementSt p P_set 2 := + S.statementSt_two htrans hcard fun t ht h => + statementSt_step hp2 hp3 hconn4 ht hloop hbd hno_int hc9 hext hno_cr h + obtain ⟨P_set', hcr', hcard'⟩ := S.exists_crooked_of_statementSt_two hp2 hp3 hS₂ + exact hno_cr P_set' hcr' hcard' + +/-- **Graph Minors IX, (6.1)** (page 55): +"Let $p \ge 2$ be an integer with $p \ne 3$, and let $(G, \Omega)$ be a 3-connected, +internally 4-connected society, in which there is no crooked transaction of cardinality $p$. +Then the sophistication of $(G, \Omega)$ is at most $3p + 7$." -/ +theorem theorem_6_1_proof {p : ℕ} (hp2 : 2 ≤ p) (hp3 : p ≠ 3) + (hconn3 : S.IsKConnected 3) + (hconn4 : S.IsInternallyKConnected 4) + (hno_crooked : ∀ P_set : Set (Graph α β), S.IsCrookedTransaction P_set → P_set.ncard ≠ p) : + S.HasSophisticationLE (3 * p + 7) ∧ S.sophistication ≤ 3 * p + 7 := by + have h := hasSophisticationLE_of_no_crooked hp2 hp3 _ S rfl hconn3 hconn4 hno_crooked + exact ⟨h, Nat.sInf_le h⟩ + +end Society + +export Society (theorem_6_1_proof) + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section7.lean b/LeanPool/GraphMinor/GM09/Section7.lean new file mode 100644 index 0000000000..10d2f3fc93 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section7.lean @@ -0,0 +1,1540 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2a +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section3c +import LeanPool.GraphMinor.GM09.Section4a +import LeanPool.GraphMinor.GM09.Section4b +import Mathlib.Data.Set.Card + +/-! +# Graph Minors IX, Section 7: Some Special Transactions and (7.1) + +This file formalizes Section 7 of N. Robertson and P. D. Seymour, +*Graph Minors. IX. Disjoint crossed paths*, J. Combin. Theory Ser. B **49** (1990) 40–77 +(pages 58–60), proving (7.1) (`theorem_7_1`): every sufficiently large crooked transaction contains +a crosscap of size `r`, a leap of size `s`, or a doublecross of size `t`. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Graph GraphMinor + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Clockwise Subsequences and Cyclic Rotations -/ + +namespace CyclicPerm + +variable {Ω : CyclicPerm α} + +/-- `M` is a subsequence of `L` realized by strictly increasing indices in `[lo, hi)`. -/ +def IsBoundedSubseq (L M : List α) (lo hi : ℕ) : Prop := + lo ≤ hi ∧ ∃ pos : ℕ → ℕ, + (∀ (i : ℕ) (hi_M : i < M.length), + ∃ hlt : pos i < L.length, lo ≤ pos i ∧ pos i < hi ∧ M[i]'hi_M = L[pos i]'hlt) ∧ + (∀ i j, i < j → j < M.length → pos i < pos j) + +theorem IsBoundedSubseq.singleton (L : List α) {p lo hi : ℕ} (hp : p < L.length) + (hlo : lo ≤ p) (hhi : p < hi) : + IsBoundedSubseq L [L[p]'hp] lo hi := by + refine ⟨by omega, fun _ => p, fun i hi_M => ?_, fun i j hij hj => by simp at hj; omega⟩ + simp only [List.length_singleton] at hi_M + have hi0 : i = 0 := by omega + subst hi0 + exact ⟨hp, hlo, hhi, rfl⟩ + +theorem IsBoundedSubseq.append {L M₁ M₂ : List α} {lo mid hi : ℕ} + (h₁ : IsBoundedSubseq L M₁ lo mid) (h₂ : IsBoundedSubseq L M₂ mid hi) : + IsBoundedSubseq L (M₁ ++ M₂) lo hi := by + rcases h₁ with ⟨hle₁, pos₁, hspec₁, hmono₁⟩ + rcases h₂ with ⟨hle₂, pos₂, hspec₂, hmono₂⟩ + let pos (i : ℕ) : ℕ := if i < M₁.length then pos₁ i else pos₂ (i - M₁.length) + refine ⟨le_trans hle₁ hle₂, pos, fun i hi_M => ?_, fun i j hij hj => ?_⟩ + · simp only [List.length_append] at hi_M + by_cases hi₁ : i < M₁.length + · obtain ⟨hlt, hlo, hmid, heq⟩ := hspec₁ i hi₁ + refine ⟨by simpa [pos, hi₁] using hlt, by simpa [pos, hi₁] using hlo, ?_, ?_⟩ + · simp only [pos, hi₁, ↓reduceIte] + omega + · rw [List.getElem_append_left hi₁] + simpa [pos, hi₁] using heq + · have hi₂ : i - M₁.length < M₂.length := by omega + obtain ⟨hlt, hmid, hhi, heq⟩ := hspec₂ (i - M₁.length) hi₂ + refine ⟨by simpa [pos, hi₁] using hlt, ?_, by simpa [pos, hi₁] using hhi, ?_⟩ + · simp only [pos, hi₁, ↓reduceIte] + omega + · rw [List.getElem_append_right (Nat.le_of_not_lt hi₁)] + simpa [pos, hi₁] using heq + · simp only [List.length_append] at hj + by_cases hj₁ : j < M₁.length + · have hi₁ : i < M₁.length := Nat.lt_trans hij hj₁ + simp only [pos, hi₁, hj₁, ↓reduceIte] + exact hmono₁ i j hij hj₁ + · by_cases hi₁ : i < M₁.length + · obtain ⟨_, _, hmid₁, _⟩ := hspec₁ i hi₁ + obtain ⟨_, hmid₂, _, _⟩ := hspec₂ (j - M₁.length) (by omega) + simp only [pos, hi₁, hj₁, ↓reduceIte] + omega + · simp only [pos, hi₁, hj₁, ↓reduceIte] + exact hmono₂ (i - M₁.length) (j - M₁.length) (by omega) (by omega) + +theorem IsBoundedSubseq.pair (L : List α) {p₁ p₂ lo hi : ℕ} + (hp₁ : p₁ < L.length) (hp₂ : p₂ < L.length) + (hlo : lo ≤ p₁) (h12 : p₁ < p₂) (hhi : p₂ < hi) : + IsBoundedSubseq L [L[p₁]'hp₁, L[p₂]'hp₂] lo hi := + (IsBoundedSubseq.singleton L hp₁ hlo h12).append (IsBoundedSubseq.singleton L hp₂ le_rfl hhi) + +theorem IsBoundedSubseq.ofFn_strictMono (L : List α) {m lo hi : ℕ} (hle : lo ≤ hi) + (f : Fin m → ℕ) (hf_lt : ∀ i : Fin m, f i < L.length) + (hf_lo : ∀ i : Fin m, lo ≤ f i) (hf_hi : ∀ i : Fin m, f i < hi) + (hmono : StrictMono f) : + IsBoundedSubseq L (List.ofFn (fun i : Fin m => L[f i]'(hf_lt i))) lo hi := by + let pos (i : ℕ) : ℕ := if hi_m : i < m then f ⟨i, hi_m⟩ else 0 + refine ⟨hle, pos, fun i hi_M => ?_, fun i j hij hj => ?_⟩ + · simp only [List.length_ofFn] at hi_M + refine ⟨by simpa [pos, hi_M] using hf_lt ⟨i, hi_M⟩, + by simpa [pos, hi_M] using hf_lo ⟨i, hi_M⟩, + by simpa [pos, hi_M] using hf_hi ⟨i, hi_M⟩, ?_⟩ + simp [pos, hi_M] + · simp only [List.length_ofFn] at hj + have hi : i < m := Nat.lt_trans hij hj + simp only [pos, hi, hj, ↓reduceDIte] + exact hmono hij + +theorem IsBoundedSubseq.ofFn_reverse_strictAnti (L : List α) {m lo hi : ℕ} (hle : lo ≤ hi) + (f : Fin m → ℕ) (hf_lt : ∀ i : Fin m, f i < L.length) + (hf_lo : ∀ i : Fin m, lo ≤ f i) (hf_hi : ∀ i : Fin m, f i < hi) + (hanti : StrictAnti f) : + IsBoundedSubseq L ((List.ofFn (fun i : Fin m => L[f i]'(hf_lt i))).reverse) lo hi := by + let pos (i : ℕ) : ℕ := if hi_m : i < m then f ⟨m - 1 - i, by omega⟩ else 0 + refine ⟨hle, pos, fun i hi_M => ?_, fun i j hij hj => ?_⟩ + · simp only [List.length_reverse, List.length_ofFn] at hi_M + have hidx : m - 1 - i < m := by omega + refine ⟨by simpa [pos, hi_M] using hf_lt ⟨m - 1 - i, hidx⟩, + by simpa [pos, hi_M] using hf_lo ⟨m - 1 - i, hidx⟩, + by simpa [pos, hi_M] using hf_hi ⟨m - 1 - i, hidx⟩, ?_⟩ + rw [List.getElem_reverse] + simp [pos, hi_M] + · simp only [List.length_reverse, List.length_ofFn] at hj + have hi : i < m := Nat.lt_trans hij hj + simp only [pos, hi, hj, ↓reduceDIte] + have hlt_rev : (⟨m - 1 - j, by omega⟩ : Fin m) < ⟨m - 1 - i, by omega⟩ := by + simp only [Fin.mk_lt_mk]; omega + exact hanti hlt_rev + +/-- Any subsequence of a clockwise sequence realized by strictly increasing indices is clockwise. -/ +theorem IsClockwiseSeq.of_isBoundedSubseq {L M : List α} {lo hi : ℕ} + (hcw : Ω.IsClockwiseSeq L) (hsub : IsBoundedSubseq L M lo hi) : + Ω.IsClockwiseSeq M := by + rcases hsub with ⟨_, pos, hspec, hmono⟩ + have hpos_lt : ∀ i, i < M.length → pos i < L.length := fun i hi => (hspec i hi).choose + have hpos_eq : ∀ (i : ℕ) (hi : i < M.length), M[i]'hi = L[pos i]'(hpos_lt i hi) := + fun i hi => (hspec i hi).choose_spec.2.2 + have hpos_inj : ∀ i j, i < M.length → j < M.length → pos i = pos j → i = j := by + intro i j hi hj heq + rcases lt_trichotomy i j with hlt | rfl | hgt + · have := hmono i j hlt hj; omega + · rfl + · have := hmono j i hgt hi; omega + have hM_nodup : M.Nodup := by + rw [List.nodup_iff_injective_getElem] + intro ⟨i, hi⟩ ⟨j, hj⟩ hij + simp only [Fin.mk.injEq] + dsimp only at hij + rw [hpos_eq i hi, hpos_eq j hj] at hij + have hpos_eq_ij : pos i = pos j := (List.Nodup.getElem_inj_iff hcw.1).mp hij + exact hpos_inj i j hi hj hpos_eq_ij + have hM_sub_L : ∀ v ∈ M, v ∈ L := by + intro v hv + obtain ⟨i, hi, rfl⟩ := List.getElem_of_mem hv + rw [hpos_eq i hi] + exact List.getElem_mem (hpos_lt i hi) + refine ⟨hM_nodup, fun v hv => hcw.2.1 v (hM_sub_L v hv), fun i hi => ?_⟩ + have hlt_i : pos i < L.length := hpos_lt i hi + have hlen_L : 0 < L.length := Nat.zero_lt_of_lt hlt_i + by_cases hi_next : i + 1 < M.length + · have hlt_next : pos (i + 1) < L.length := hpos_lt (i + 1) hi_next + have hmod_M : (i + 1) % M.length = i + 1 := Nat.mod_eq_of_lt hi_next + have hlt_pos : pos i < pos (i + 1) := hmono i (i + 1) (Nat.lt_succ_self i) hi_next + obtain ⟨k, hk1, hk_eq, hk_min⟩ := + Ω.exists_iterate_step hcw (pos i) (pos (i + 1) - pos i) hlt_i (by omega) + have hmod_L : (pos i + (pos (i + 1) - pos i)) % L.length = pos (i + 1) := by + rw [Nat.add_sub_of_le (le_of_lt hlt_pos), Nat.mod_eq_of_lt hlt_next] + have hk_target : (Ω.toFun^[k]) (M[i]) = M[(i + 1) % M.length]'(Nat.mod_lt _ (by omega)) := by + rw [hpos_eq i hi, hk_eq, hpos_eq ((i + 1) % M.length)] + congr 1 + rw [hmod_L, hmod_M] + refine ⟨k, hk1, hk_target, List.getElem_mem _, fun j hj1 hjlt hj_in => ?_⟩ + have hj_L : (Ω.toFun^[j]) (L[pos i]'hlt_i) ∈ {v | v ∈ L} := by + rw [← hpos_eq i hi] + exact hM_sub_L _ hj_in + obtain ⟨d, hd1, hdd, hd_eq⟩ := hk_min j hj1 hjlt hj_L + obtain ⟨r, hr, hr_eq⟩ := List.getElem_of_mem hj_in + rw [hpos_eq i hi, hd_eq, hpos_eq r hr] at hr_eq + have hpos_r : (pos i + d) % L.length = pos r := + (List.Nodup.getElem_inj_iff hcw.1).mp hr_eq.symm + rw [Nat.mod_eq_of_lt (by omega)] at hpos_r + rcases lt_trichotomy r i with hri | rfl | hir + · have := hmono r i hri hi; omega + · omega + · rcases eq_or_lt_of_le (by omega : i + 1 ≤ r) with rfl | h_gt + · omega + · have := hmono (i + 1) r h_gt hr; omega + · have hi_last : i + 1 = M.length := by omega + have hmod_M : (i + 1) % M.length = 0 := by rw [hi_last, Nat.mod_self] + rcases Nat.eq_zero_or_pos i with rfl | hi_pos + · -- `M.length = 1` + obtain ⟨k, hk1, hk_eq, hk_min⟩ := + Ω.exists_iterate_step hcw (pos 0) L.length hlt_i hlen_L + have hmod_L : (pos 0 + L.length) % L.length = pos 0 := by + rw [Nat.add_mod_right, Nat.mod_eq_of_lt hlt_i] + have hk_target : (Ω.toFun^[k]) (M[0]) = M[(0 + 1) % M.length]'(Nat.mod_lt _ (by omega)) := by + rw [hpos_eq 0 hi, hk_eq, hpos_eq ((0 + 1) % M.length)] + congr 1 + rw [hmod_L, hmod_M] + refine ⟨k, hk1, hk_target, List.getElem_mem _, fun j hj1 hjlt hj_in => ?_⟩ + have hj_L : (Ω.toFun^[j]) (L[pos 0]'hlt_i) ∈ {v | v ∈ L} := by + rw [← hpos_eq 0 hi] + exact hM_sub_L _ hj_in + obtain ⟨d, hd1, hdd, hd_eq⟩ := hk_min j hj1 hjlt hj_L + obtain ⟨r, hr, hr_eq⟩ := List.getElem_of_mem hj_in + have hr0 : r = 0 := by omega + subst hr0 + rw [hpos_eq 0 hi, hd_eq] at hr_eq + have hpos_0 : (pos 0 + d) % L.length = pos 0 := + (List.Nodup.getElem_inj_iff hcw.1).mp hr_eq.symm + by_cases hlt_len : pos 0 + d < L.length + · rw [Nat.mod_eq_of_lt hlt_len] at hpos_0; omega + · have h_sub : (pos 0 + d) % L.length = pos 0 + d - L.length := by + have h_eq : pos 0 + d = L.length + (pos 0 + d - L.length) := by omega + conv_lhs => rw [h_eq] + rw [Nat.add_mod_left, Nat.mod_eq_of_lt (by omega)] + rw [h_sub] at hpos_0; omega + · -- `M.length ≥ 2` + have h0_lt : 0 < M.length := by omega + have hlt_0 : pos 0 < L.length := hpos_lt 0 h0_lt + have hlt_0i : pos 0 < pos i := hmono 0 i hi_pos hi + obtain ⟨k, hk1, hk_eq, hk_min⟩ := + Ω.exists_iterate_step hcw (pos i) (L.length + pos 0 - pos i) hlt_i (by omega) + have hmod_L : (pos i + (L.length + pos 0 - pos i)) % L.length = pos 0 := by + have h_add : pos i + (L.length + pos 0 - pos i) = L.length + pos 0 := by omega + rw [h_add, Nat.add_mod_left, Nat.mod_eq_of_lt hlt_0] + have hk_target : (Ω.toFun^[k]) (M[i]) = M[(i + 1) % M.length]'(Nat.mod_lt _ (by omega)) := by + rw [hpos_eq i hi, hk_eq, hpos_eq ((i + 1) % M.length)] + congr 1 + rw [hmod_L, hmod_M] + refine ⟨k, hk1, hk_target, List.getElem_mem _, fun j hj1 hjlt hj_in => ?_⟩ + have hj_L : (Ω.toFun^[j]) (L[pos i]'hlt_i) ∈ {v | v ∈ L} := by + rw [← hpos_eq i hi] + exact hM_sub_L _ hj_in + obtain ⟨d, hd1, hdd, hd_eq⟩ := hk_min j hj1 hjlt hj_L + obtain ⟨r, hr, hr_eq⟩ := List.getElem_of_mem hj_in + have hlt_r : pos r < L.length := hpos_lt r hr + rw [hpos_eq i hi, hd_eq, hpos_eq r hr] at hr_eq + have hpos_r : (pos i + d) % L.length = pos r := + (List.Nodup.getElem_inj_iff hcw.1).mp hr_eq.symm + have hpos_ge_0 : pos 0 ≤ pos r := by + rcases Nat.eq_zero_or_pos r with rfl | hr_pos + · exact le_rfl + · exact le_of_lt (hmono 0 r hr_pos hr) + have hpos_le_i : pos r ≤ pos i := by + rcases eq_or_lt_of_le (by omega : r ≤ i) with rfl | hri + · exact le_rfl + · exact le_of_lt (hmono r i hri hi) + by_cases hlt_len : pos i + d < L.length + · rw [Nat.mod_eq_of_lt hlt_len] at hpos_r; omega + · have h_sub : (pos i + d) % L.length = pos i + d - L.length := by + have h_eq : pos i + d = L.length + (pos i + d - L.length) := by omega + conv_lhs => rw [h_eq] + rw [Nat.add_mod_left, Nat.mod_eq_of_lt (by omega)] + rw [h_sub] at hpos_r; omega + +/-- Cyclic rotation of a clockwise sequence is clockwise. -/ +theorem IsClockwiseSeq.append_comm {L₁ L₂ : List α} + (hcw : Ω.IsClockwiseSeq (L₁ ++ L₂)) : + Ω.IsClockwiseSeq (L₂ ++ L₁) := by + have hnodup : (L₂ ++ L₁).Nodup := List.nodup_append_comm.mp hcw.1 + have hbar : ∀ v ∈ L₂ ++ L₁, v ∈ Ω.bar := by + intro v hv + rw [List.mem_append] at hv + exact hcw.2.1 v (List.mem_append.mpr hv.symm) + have hset : {v | v ∈ L₂ ++ L₁} = {v | v ∈ L₁ ++ L₂} := by + ext v; simp [or_comm] + have hget : ∀ (m : ℕ) (hm : m < (L₂ ++ L₁).length), + (L₂ ++ L₁)[m]'hm = + (L₁ ++ L₂)[(m + L₁.length) % (L₁ ++ L₂).length]'(Nat.mod_lt _ (by simp at hm ⊢; omega)) + := by + intro m hm + have hlen_eq : (L₁ ++ L₂).length = L₁.length + L₂.length := List.length_append + have hm_len : m < L₂.length + L₁.length := by simpa using hm + by_cases hm₂ : m < L₂.length + · rw [List.getElem_append_left hm₂] + have hmod : (m + L₁.length) % (L₁ ++ L₂).length = L₁.length + m := by + rw [hlen_eq, add_comm m L₁.length] + exact Nat.mod_eq_of_lt (by omega) + have hrhs : (L₁ ++ L₂)[(m + L₁.length) % (L₁ ++ L₂).length]'(Nat.mod_lt _ + (by simp at hm ⊢; omega)) = + (L₁ ++ L₂)[L₁.length + m]'(by rw [hlen_eq]; omega) := by + congr 1 + rw [hrhs, List.getElem_append_right (Nat.le_add_right L₁.length m)] + simp + · rw [List.getElem_append_right (Nat.le_of_not_lt hm₂)] + have hmod : (m + L₁.length) % (L₁ ++ L₂).length = m - L₂.length := by + have h_add : m + L₁.length = (L₁ ++ L₂).length + (m - L₂.length) := by + rw [hlen_eq]; omega + rw [h_add, Nat.add_mod_left, Nat.mod_eq_of_lt (by rw [hlen_eq]; omega)] + have hrhs : (L₁ ++ L₂)[(m + L₁.length) % (L₁ ++ L₂).length]'(Nat.mod_lt _ + (by simp at hm ⊢; omega)) = + (L₁ ++ L₂)[m - L₂.length]'(by rw [hlen_eq]; omega) := by + congr 1 + rw [hrhs, List.getElem_append_left (by omega)] + refine ⟨hnodup, hbar, fun i hi => ?_⟩ + rw [hset] + have hn_pos : 0 < (L₁ ++ L₂).length := by simp at hi ⊢; omega + have hlen_same : (L₂ ++ L₁).length = (L₁ ++ L₂).length := by simp [add_comm] + let i' := (i + L₁.length) % (L₁ ++ L₂).length + have hi' : i' < (L₁ ++ L₂).length := Nat.mod_lt _ hn_pos + have hhit := hcw.2.2 i' hi' + have h1 : (L₂ ++ L₁)[i]'hi = (L₁ ++ L₂)[i']'hi' := hget i hi + have h2 : (L₂ ++ L₁)[(i + 1) % (L₂ ++ L₁).length]'(Nat.mod_lt _ (Nat.zero_lt_of_lt hi)) = + (L₁ ++ L₂)[(i' + 1) % (L₁ ++ L₂).length]'(Nat.mod_lt _ hn_pos) := by + rw [hget ((i + 1) % (L₂ ++ L₁).length)] + congr 1 + simp only [i', hlen_same] + calc ((i + 1) % (L₁ ++ L₂).length + L₁.length) % (L₁ ++ L₂).length + _ = (i + 1 + L₁.length) % (L₁ ++ L₂).length := Nat.mod_add_mod _ _ _ + _ = (i + L₁.length + 1) % (L₁ ++ L₂).length := by ring_nf + _ = ((i + L₁.length) % (L₁ ++ L₂).length + 1) % (L₁ ++ L₂).length := + (Nat.mod_add_mod _ _ _).symm + rwa [h1, h2] + +end CyclicPerm + +/-! ## Fence Construction from Clockwise Endpoint Sequences and Transaction Enumeration -/ + +namespace Society + +variable (S : Society α β) + +/-- Given `p ≥ 2` mutually disjoint `Ω`-paths `P : Fin p → Graph α β` in `P_set` with ends +`a i, b i` such that `(List.ofFn a).reverse ++ b_perm` is `Ω`-clockwise (where every `b i` belongs +to `b_perm`), the complementary intervals determined by `a ⟨p - 1, _⟩` and `a ⟨0, _⟩` form a fence +`(A', B')` for `range P` with `a i ∈ A'` and `b i ∈ B'` for all `i`. -/ +theorem exists_isFenceFor_of_isClockwiseSeq_reverse_append + {P_set : Set (Graph α β)} (hdisj : S.IsDisjointOmegaPathSet P_set) + {p : ℕ} (hp : 2 ≤ p) + (P : Fin p → Graph α β) (a b : Fin p → α) (b_perm : List α) + (hP_inj : Function.Injective P) + (hP_sub : range P ⊆ P_set) + (hends : ∀ i : Fin p, S.IsOmegaPathWithEnds (P i) (a i) (b i)) + (hb_mem : ∀ i : Fin p, b i ∈ b_perm) + (hcw : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ b_perm)) : + (range P).ncard = p ∧ + ∃ A' B' : Set α, S.IsFenceFor (range P) A' B' ∧ + ∀ i : Fin p, a i ∈ A' ∧ b i ∈ B' ∧ S.IsOmegaPathWithEnds (P i) (a i) (b i) := by + have hcard : (range P).ncard = p := by + rw [← image_univ, Set.ncard_image_of_injective _ hP_inj, Set.ncard_univ, + Nat.card_eq_fintype_card, Fintype.card_fin] + let L := (List.ofFn a).reverse ++ b_perm + have hlen_a : ((List.ofFn a).reverse).length = p := by simp + have h0_lt : 0 < L.length := by simp [L]; omega + have hp1_lt : p - 1 < L.length := by simp [L]; omega + let u := a ⟨p - 1, by omega⟩ + let v := a ⟨0, by omega⟩ + have hL0 : L[0]'h0_lt = u := by + rw [List.getElem_append_left (by simp; omega), List.getElem_reverse] + simp [u] + have hLp1 : L[p - 1]'hp1_lt = v := by + rw [List.getElem_append_left (by simp; omega), List.getElem_reverse] + simp [v] + have hu_bar : u ∈ S.Ω.bar := (hends ⟨p - 1, by omega⟩).2.2.1 + have hv_bar : v ∈ S.Ω.bar := (hends ⟨0, by omega⟩).2.2.1 + have huv : u ≠ v := by + intro heq + have h0_eq : L[0]'h0_lt = L[p - 1]'hp1_lt := by rw [hL0, hLp1, heq] + have hidx := (List.Nodup.getElem_inj_iff hcw.1).mp h0_eq + omega + let A' : Set α := {u, v} ∪ S.Ω.interval u v + let B' : Set α := S.Ω.interval v u + have hfence_AB : S.Ω.IsFence A' B' := S.Ω.isFence_interval_compl hu_bar hv_bar huv + have ha_in_A' : ∀ i : Fin p, a i ∈ A' := by + intro i + let m := p - 1 - i.1 + have hm_lt : m < L.length := by simp [L, m]; omega + have hLm : L[m]'hm_lt = a i := by + rw [List.getElem_append_left (by simp [m]; omega), List.getElem_reverse] + simp only [List.length_ofFn, List.getElem_ofFn, m] + congr 1 + ext + dsimp + omega + rcases Nat.eq_zero_or_pos m with hm0 | hm_pos + · have : a i = u := by rw [← hLm, ← hL0]; congr 1 + exact Or.inl (Or.inl this) + · rcases eq_or_lt_of_le (by omega : m ≤ p - 1) with hmp | hm_lt_p1 + · have : a i = v := by rw [← hLm, ← hLp1]; congr 1 + exact Or.inl (Or.inr this) + · right + have hint := S.Ω.mem_interval_of_lt hcw hm_pos hm_lt_p1 hp1_lt + rwa [hL0, hLp1, hLm] at hint + have hb_in_B' : ∀ i : Fin p, b i ∈ B' := by + intro i + obtain ⟨j, hj, hj_eq⟩ := List.getElem_of_mem (hb_mem i) + have h_idx_lt : p + j < L.length := by simp [L]; omega + have hLpj : L[p + j]'h_idx_lt = b i := by + rw [List.getElem_append_right (by simp)] + simpa using hj_eq + have hint := S.Ω.mem_interval_of_lt hcw (i₁ := 0) (i₂ := p - 1) (i₃ := p + j) + (by omega) (by omega) h_idx_lt + rw [hL0, hLp1, hLpj] at hint + exact S.Ω.mem_interval_rotate_left hint + have hdisj_range : S.IsDisjointOmegaPathSet (range P) := + ⟨fun Q hQ => hdisj.1 Q (hP_sub hQ), hdisj.2.mono hP_sub⟩ + refine ⟨hcard, A', B', ⟨hdisj_range, hfence_AB, ?_⟩, + fun i => ⟨ha_in_A' i, hb_in_B' i, hends i⟩⟩ + rintro Q ⟨i, rfl⟩ + exact ⟨a i, ha_in_A' i, b i, hb_in_B' i, hends i⟩ + +theorem exists_crosscap_of_isClockwiseSeq + {P_set : Set (Graph α β)} (hdisj : S.IsDisjointOmegaPathSet P_set) + {r : ℕ} (hr : 2 ≤ r) + (P : Fin r → Graph α β) (a b : Fin r → α) + (hP_inj : Function.Injective P) + (hP_sub : range P ⊆ P_set) + (hends : ∀ i : Fin r, S.IsOmegaPathWithEnds (P i) (a i) (b i)) + (hcw : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ (List.ofFn b).reverse)) : + range P ⊆ P_set ∧ (range P).ncard = r ∧ S.IsCrosscapTransaction (range P) := by + obtain ⟨hcard, A', B', hfence, h_ab⟩ := + S.exists_isFenceFor_of_isClockwiseSeq_reverse_append hdisj hr P a b + ((List.ofFn b).reverse) hP_inj hP_sub hends + (fun i => List.mem_reverse.mpr (List.mem_ofFn.mpr ⟨i, rfl⟩)) hcw + exact ⟨hP_sub, hcard, A', B', hfence, r, hr, P, a, b, hP_inj, rfl, h_ab, hcw⟩ + +theorem exists_leap_of_isClockwiseSeq + {P_set : Set (Graph α β)} (hdisj : S.IsDisjointOmegaPathSet P_set) + {s : ℕ} (hs : 3 ≤ s) + (P : Fin s → Graph α β) (a b : Fin s → α) + (hP_inj : Function.Injective P) + (hP_sub : range P ⊆ P_set) + (hends : ∀ i : Fin s, S.IsOmegaPathWithEnds (P i) (a i) (b i)) + (hcw : S.Ω.IsClockwiseSeq + ((List.ofFn a).reverse ++ + List.ofFn (fun i : Fin (s - 1) => b ⟨i.1 + 1, by omega⟩) ++ + [b ⟨0, by omega⟩])) : + range P ⊆ P_set ∧ (range P).ncard = s ∧ S.IsLeapTransaction (range P) := by + let b_perm := List.ofFn (fun i : Fin (s - 1) => b ⟨i.1 + 1, by omega⟩) ++ [b ⟨0, by omega⟩] + have hcw' : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ b_perm) := by + simpa [b_perm, List.append_assoc] using hcw + have hb_mem : ∀ i : Fin s, b i ∈ b_perm := by + intro ⟨i, hi⟩ + simp only [b_perm, List.mem_append, List.mem_ofFn, List.mem_singleton] + rcases Nat.eq_zero_or_pos i with rfl | hi_pos + · exact Or.inr rfl + · left + refine ⟨⟨i - 1, by omega⟩, ?_⟩ + congr 1 + ext + dsimp + omega + obtain ⟨hcard, A', B', hfence, h_ab⟩ := + S.exists_isFenceFor_of_isClockwiseSeq_reverse_append hdisj (by omega) P a b + b_perm hP_inj hP_sub hends hb_mem hcw' + exact ⟨hP_sub, hcard, A', B', hfence, s, hs, P, a, b, hP_inj, rfl, h_ab, hcw⟩ + +theorem exists_doublecross_of_isClockwiseSeq + {P_set : Set (Graph α β)} (hdisj : S.IsDisjointOmegaPathSet P_set) + {t : ℕ} (ht : 4 ≤ t) + (P : Fin t → Graph α β) (a b : Fin t → α) + (hP_inj : Function.Injective P) + (hP_sub : range P ⊆ P_set) + (hends : ∀ i : Fin t, S.IsOmegaPathWithEnds (P i) (a i) (b i)) + (hcw : S.Ω.IsClockwiseSeq + ((List.ofFn a).reverse ++ + [b ⟨1, by omega⟩, b ⟨0, by omega⟩] ++ + List.ofFn (fun i : Fin (t - 4) => b ⟨i.1 + 2, by omega⟩) ++ + [b ⟨t - 1, by omega⟩, b ⟨t - 2, by omega⟩])) : + range P ⊆ P_set ∧ (range P).ncard = t ∧ S.IsDoublecrossTransaction (range P) := by + let b_perm := [b ⟨1, by omega⟩, b ⟨0, by omega⟩] ++ + List.ofFn (fun i : Fin (t - 4) => b ⟨i.1 + 2, by omega⟩) ++ + [b ⟨t - 1, by omega⟩, b ⟨t - 2, by omega⟩] + have hcw' : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ b_perm) := by + simpa [b_perm, List.append_assoc] using hcw + have hb_mem : ∀ i : Fin t, b i ∈ b_perm := by + intro ⟨i, hi⟩ + simp only [b_perm, List.mem_append, List.mem_cons, List.not_mem_nil, or_false, List.mem_ofFn] + by_cases hi0 : i = 0 + · subst hi0; exact Or.inl (Or.inl (Or.inr rfl)) + · by_cases hi1 : i = 1 + · subst hi1; exact Or.inl (Or.inl (Or.inl rfl)) + · by_cases hit2 : i = t - 2 + · subst hit2; exact Or.inr (Or.inr rfl) + · by_cases hit1 : i = t - 1 + · subst hit1; exact Or.inr (Or.inl rfl) + · left; right + refine ⟨⟨i - 2, by omega⟩, ?_⟩ + congr 1; ext; dsimp; omega + obtain ⟨hcard, A', B', hfence, h_ab⟩ := + S.exists_isFenceFor_of_isClockwiseSeq_reverse_append hdisj (by omega) P a b + b_perm hP_inj hP_sub hends hb_mem hcw' + exact ⟨hP_sub, hcard, A', B', hfence, t, ht, P, a, b, hP_inj, rfl, h_ab, hcw⟩ + +/-- For any transaction `P_set` of cardinality `k ≥ 1` with fence `(A, B)`, there is a clockwise +enumeration `L` of `S.transactionEnds P_set` of length `2 * k` with the ends in `A` first, an +injective map `R : Fin k → Graph α β` into `P_set`, and a bijection `φ : Fin k → Fin k` such that +each `R i` has ends `L[k - 1 - i.1]` and `L[k + (φ i).1]`. -/ +theorem exists_clockwise_enumeration {P_set : Set (Graph α β)} {A B : Set α} + (hfence : S.IsFenceFor P_set A B) {k : ℕ} (hk_eq : P_set.ncard = k) (hk_pos : 1 ≤ k) : + ∃ (L : List α) (hL_len : L.length = 2 * k) + (R : Fin k → Graph α β) (φ : Fin k → Fin k), + S.Ω.IsClockwiseSeq L ∧ {v | v ∈ L} = S.transactionEnds P_set ∧ + Function.Injective R ∧ range R ⊆ P_set ∧ + Function.Injective φ ∧ Function.Surjective φ ∧ + (∀ i : Fin k, S.IsOmegaPathWithEnds (R i) + (L[k - 1 - i.1]'(by omega)) (L[k + (φ i).1]'(by omega))) ∧ + (∀ (i : ℕ) (hi : i < L.length), i < k → L[i]'hi ∈ A) ∧ + (∀ (i : ℕ) (hi : i < L.length), k ≤ i → L[i]'hi ∈ B) ∧ + Disjoint (S.Ω.interval (L[2 * k - 1]'(by omega)) (L[0]'(by omega))) + (S.transactionEnds P_set) := by + classical + let W := S.transactionEnds P_set + have hW_bar : W ⊆ S.Ω.bar := S.transactionEnds_subset_bar P_set + obtain ⟨-, -, hncard_W⟩ := hfence.ncard_transactionEnds S + rw [hk_eq] at hncard_W + have hfin_P : P_set.Finite := hfence.1.finite S + have hP_ne : P_set.Nonempty := (Set.ncard_pos hfin_P).mp (by omega) + obtain ⟨P₀, hP₀_in⟩ := hP_ne + obtain ⟨a₀, ha₀A, b₀, hb₀B, hP₀_ends⟩ := hfence.2.2 P₀ hP₀_in + have ha₀W : a₀ ∈ A ∩ W := ⟨ha₀A, hP₀_ends.mem_transactionEnds_left S hP₀_in⟩ + have hb₀W : b₀ ∈ B ∩ W := ⟨hb₀B, hP₀_ends.mem_transactionEnds_right S hP₀_in⟩ + have hW_sub_BA : W ⊆ B ∪ A := by + rw [union_comm, hfence.2.1.2.2.2.1]; exact hW_bar + obtain ⟨b_k, hb_k, a_k, ha_k, hd_bk_ak⟩ := + S.Ω.exists_empty_interval_AB_of_subset_union hW_bar hW_sub_BA ⟨b₀, hb₀W⟩ ⟨a₀, ha₀W⟩ + obtain ⟨L, hL_len_W, hL_set, hL_0, hL_cw⟩ := + S.Ω.exists_isClockwiseSeq_of_subset_bar hW_bar ha_k.2 + have hL_len : L.length = 2 * k := hL_len_W.trans hncard_W + have h2k_pos : 0 < L.length := by omega + have hlength : L.length = 2 * P_set.ncard := by rwa [hk_eq] + obtain ⟨hLast, hFirstSide, hSecondSide⟩ := + Society.transaction_end_list_partitions_fence S hfence (by omega) hlength hL_cw hL_0 + hL_set hb_k ha_k hd_bk_ak + have hL_last : L[2 * k - 1]'(by omega) = b_k := by simpa only [hk_eq] using hLast + have hL_A (i : ℕ) (hi : i < L.length) (hik : i < k) : L[i]'hi ∈ A := + hFirstSide i hi (hk_eq.symm ▸ hik) + have hL_B (i : ℕ) (hi : i < L.length) (hki : k ≤ i) : L[i]'hi ∈ B := + hSecondSide i hi (hk_eq.symm ▸ hki) + have hex_Q : ∀ i : Fin k, + ∃ P ∈ P_set, ∃ j : Fin k, + S.IsOmegaPathWithEnds P (L[k - 1 - i.1]'(by omega)) (L[k + j.1]'(by omega)) := by + intro i + have h_in_W : L[k - 1 - i.1]'(by omega) ∈ W := by + rw [← hL_set]; exact List.getElem_mem (by omega) + have h_in_A : L[k - 1 - i.1]'(by omega) ∈ A := hL_A (k - 1 - i.1) (by omega) (by omega) + obtain ⟨P, hP_in, y, hPy⟩ := h_in_W + obtain ⟨aP, haPA, bP, hbPB, hP_ends⟩ := hfence.2.2 P hP_in + have haP_eq : aP = L[k - 1 - i.1]'(by omega) := by + rcases hP_ends.ends_eq S hPy with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · exact (disjoint_left.mp hfence.2.1.2.2.1 h_in_A hbPB).elim + subst haP_eq + have hbP_W : bP ∈ W := hP_ends.mem_transactionEnds_right S hP_in + rw [← hL_set] at hbP_W + obtain ⟨m, hm, hm_eq⟩ := List.getElem_of_mem hbP_W + have hmk : k ≤ m := by + by_contra hlt + exact disjoint_left.mp hfence.2.1.2.2.1 (hL_A m hm (by omega)) (hm_eq ▸ hbPB) + refine ⟨P, hP_in, ⟨m - k, by omega⟩, ?_⟩ + have hm_add : k + (m - k) = m := Nat.add_sub_of_le hmk + simpa [hm_add, hm_eq] using hP_ends + let R (i : Fin k) : Graph α β := (hex_Q i).choose + let φ (i : Fin k) : Fin k := (hex_Q i).choose_spec.2.choose + have hR_in : ∀ i : Fin k, R i ∈ P_set := fun i => (hex_Q i).choose_spec.1 + have hR_ends : ∀ i : Fin k, + S.IsOmegaPathWithEnds (R i) (L[k - 1 - i.1]'(by omega)) (L[k + (φ i).1]'(by omega)) := + fun i => (hex_Q i).choose_spec.2.choose_spec + have hR_inj : Function.Injective R := by + intro i j heq + have h₁ := hR_ends i + have h₂ := hR_ends j + rw [heq] at h₁ + rcases h₁.ends_eq S h₂ with ⟨h_eq, _⟩ | ⟨h_eq, _⟩ + · have := (List.Nodup.getElem_inj_iff hL_cw.1).mp h_eq + ext; omega + · exfalso + have hA_j : L[k - 1 - j.1]'(by omega) ∈ A := hL_A (k - 1 - j.1) (by omega) (by omega) + have hB_i : L[k + (φ i).1]'(by omega) ∈ B := hL_B (k + (φ i).1) (by omega) (by omega) + exact disjoint_left.mp hfence.2.1.2.2.1 hA_j (h_eq ▸ hB_i) + have hφ_inj : Function.Injective φ := by + intro i j heq + by_contra hne + have hne_R : R i ≠ R j := fun h => hne (hR_inj h) + have hdisj_R : Disjoint V(R i) V(R j) := hfence.1.2 (hR_in i) (hR_in j) hne_R + have h_same_b : L[k + (φ i).1]'(by omega) = L[k + (φ j).1]'(by omega) := by + congr 1; rw [heq] + exact disjoint_left.mp hdisj_R (hR_ends i).1.right_mem (h_same_b ▸ (hR_ends j).1.right_mem) + have hφ_surj : Function.Surjective φ := Finite.surjective_of_injective hφ_inj + refine ⟨L, hL_len, R, φ, hL_cw, hL_set, hR_inj, by rintro _ ⟨i, rfl⟩; exact hR_in i, + hφ_inj, hφ_surj, hR_ends, hL_A, hL_B, ?_⟩ + rw [hL_last, hL_0 h2k_pos] + exact hd_bk_ak + +/-- For any crooked transaction `P_set` of cardinality `k ≥ 1`, there is a clockwise enumeration `L` +of `S.transactionEnds P_set` of length `2 * k`, an injective map `R : Fin k → Graph α β` into +`P_set`, and a bijection `φ : Fin k → Fin k` such that each `R i` has ends +`L[k - 1 - i.1]` and `L[k + (φ i).1]`, with `φ ⟨0, _⟩ ≠ ⟨0, _⟩` and `φ ⟨k - 1, _⟩ ≠ ⟨k - 1, _⟩`. -/ +theorem exists_clockwise_enumeration_of_crooked + {P_set : Set (Graph α β)} (hcrooked : S.IsCrookedTransaction P_set) + {k : ℕ} (hk_eq : P_set.ncard = k) (hk_pos : 1 ≤ k) : + ∃ (L : List α) (hL_len : L.length = 2 * k) + (R : Fin k → Graph α β) (φ : Fin k → Fin k), + S.Ω.IsClockwiseSeq L ∧ + Function.Injective R ∧ range R ⊆ P_set ∧ + Function.Injective φ ∧ Function.Surjective φ ∧ + (∀ i : Fin k, S.IsOmegaPathWithEnds (R i) + (L[k - 1 - i.1]'(by omega)) (L[k + (φ i).1]'(by omega))) ∧ + φ ⟨0, by omega⟩ ≠ ⟨0, by omega⟩ ∧ + φ ⟨k - 1, by omega⟩ ≠ ⟨k - 1, by omega⟩ := by + obtain ⟨A, B, hfence⟩ := hcrooked.1 + obtain ⟨L, hL_len, R, φ, hL_cw, hL_set, hR_inj, hR_sub, hφ_inj, hφ_surj, hR_ends, -, -, hgap⟩ := + S.exists_clockwise_enumeration hfence hk_eq hk_pos + have hR_in : ∀ i : Fin k, R i ∈ P_set := fun i => hR_sub ⟨i, rfl⟩ + have hW_bar := S.transactionEnds_subset_bar P_set + refine ⟨L, hL_len, R, φ, hL_cw, hR_inj, hR_sub, hφ_inj, hφ_surj, hR_ends, ?_, ?_⟩ + · intro heq0 + have h₀_ends := hR_ends ⟨0, by omega⟩ + have hhit_0 : S.Ω.FirstHitIn (S.transactionEnds P_set) (L[k - 1]'(by omega)) (L[k]'(by omega)) + := by + have h := hL_cw.2.2 (k - 1) (by omega) + have hmod : (k - 1 + 1) % L.length = k := by + rw [Nat.sub_add_cancel hk_pos, Nat.mod_eq_of_lt (by omega)] + rw [hL_set] at h + simpa [hmod] using h + have h_u_W : L[k - 1]'(by omega) ∈ S.transactionEnds P_set := by + rw [← hL_set]; exact List.getElem_mem (by omega) + have h_v_W : L[k]'(by omega) ∈ S.transactionEnds P_set := by + rw [← hL_set]; exact List.getElem_mem (by omega) + have h_uv_ne : L[k - 1]'(by omega) ≠ L[k]'(by omega) := by + intro h + have := (List.Nodup.getElem_inj_iff hL_cw.1).mp h + omega + have hd_0 := (S.Ω.firstHitIn_iff_disjoint_interval hW_bar h_u_W h_v_W h_uv_ne).mp hhit_0 + have h₀_ends' : S.IsOmegaPathWithEnds (R ⟨0, by omega⟩) (L[k - 1]'(by omega)) (L[k]'(by omega)) + := by + simpa [heq0] using h₀_ends + exact hcrooked.2 _ (hR_in _) ⟨hR_in _, _, _, h₀_ends', Or.inl hd_0⟩ + · intro heqk + have hk_ends := hR_ends ⟨k - 1, by omega⟩ + have hk_ends' : S.IsOmegaPathWithEnds (R ⟨k - 1, by omega⟩) + (L[0]'(by omega)) (L[2 * k - 1]'(by omega)) := by + have h_idx : k + (k - 1) = 2 * k - 1 := by omega + simpa [heqk, h_idx] using hk_ends + exact hcrooked.2 _ (hR_in _) ⟨hR_in _, _, _, hk_ends', Or.inr hgap⟩ + +/-! ## Erdős–Szekeres and Longest Increasing Subsequence on `Fin k` -/ + +private theorem strictMono_fin_ge {m k : ℕ} {x : Fin m → Fin k} (hx : StrictMono x) : + ∀ (d : ℕ) (hd : d < m), d ≤ (x ⟨d, hd⟩).1 := by + intro d + induction d with + | zero => intro _; exact Nat.zero_le _ + | succ d ih => + intro hd + have hprev := ih (Nat.lt_of_succ_lt hd) + have hstep : (x ⟨d, Nat.lt_of_succ_lt hd⟩).1 < (x ⟨d + 1, hd⟩).1 := + hx (by simp [Fin.mk_lt_mk]) + omega + +private def IsIncSubseq {k : ℕ} (φ : Fin k → Fin k) (m : ℕ) : Prop := + ∃ x : Fin m → Fin k, StrictMono x ∧ StrictMono (φ ∘ x) + +private def IsIncEndingAt {k : ℕ} (φ : Fin k → Fin k) (i : Fin k) (m : ℕ) : Prop := + ∃ x : Fin m → Fin k, StrictMono x ∧ StrictMono (φ ∘ x) ∧ + ∀ hm : 0 < m, x ⟨m - 1, by omega⟩ = i + +private theorem not_isIncSubseq_succ {k : ℕ} (φ : Fin k → Fin k) : + ¬ IsIncSubseq φ (k + 1) := by + rintro ⟨x, hx, _⟩ + have hge := strictMono_fin_ge hx k (Nat.lt_succ_self k) + have hlt := (x ⟨k, Nat.lt_succ_self k⟩).2 + omega + +private theorem not_isIncEndingAt_succ {k : ℕ} (φ : Fin k → Fin k) (i : Fin k) : + ¬ IsIncEndingAt φ i (k + 1) := by + rintro ⟨x, hx, hφx, _⟩ + exact not_isIncSubseq_succ φ ⟨x, hx, hφx⟩ + +private theorem exists_fiber_ncard_ge {α₀ : Type*} [Finite α₀] + (f : α₀ → ℕ) (r : ℕ) : + ∀ (n : ℕ) (U : Set α₀), (∀ x ∈ U, f x < n) → n * (r - 1) < U.ncard → + ∃ c < n, r ≤ {x ∈ U | f x = c}.ncard := by + intro n + induction n with + | zero => + intro U hU hcard + have hne : U.Nonempty := (Set.ncard_pos (Set.toFinite U)).mp (by omega) + rcases hne with ⟨x, hx⟩ + exact (Nat.not_lt_zero (f x) (hU x hx)).elim + | succ n ih => + intro U hU hcard + let T : Set α₀ := {x ∈ U | f x = n} + let U' : Set α₀ := {x ∈ U | f x < n} + have h_union : U' ∪ T = U := by + ext x + simp only [U', T, mem_union, mem_sep_iff] + exact ⟨fun h => h.elim (fun h1 => h1.1) (fun h2 => h2.1), + fun hx => (lt_or_eq_of_le (Nat.le_of_lt_succ (hU x hx))).imp + (fun hlt => ⟨hx, hlt⟩) (fun heq => ⟨hx, heq⟩)⟩ + have h_disj : Disjoint U' T := by + rw [disjoint_left] + intro x hx₁ hx₂ + exact Nat.ne_of_lt hx₁.2 hx₂.2 + have hcard_eq : U.ncard = U'.ncard + T.ncard := by + rw [← h_union] + exact Set.ncard_union_eq h_disj (Set.toFinite U') (Set.toFinite T) + by_cases hT : r ≤ T.ncard + · exact ⟨n, Nat.lt_succ_self n, hT⟩ + · have hU'_card : n * (r - 1) < U'.ncard := by + rw [Nat.succ_mul] at hcard + omega + obtain ⟨c, hc_lt, hc_card⟩ := ih U' (fun _ hx => hx.2) hU'_card + refine ⟨c, Nat.lt_succ_of_lt hc_lt, hc_card.trans ?_⟩ + refine Set.ncard_le_ncard (fun x hx => ⟨hx.1.1, hx.2⟩) (Set.toFinite _) + +private theorem exists_strictMono_mem_of_ncard_ge {k : ℕ} : + ∀ (r : ℕ) (T : Set (Fin k)), r ≤ T.ncard → + ∃ idx : Fin r → Fin k, StrictMono idx ∧ ∀ j : Fin r, idx j ∈ T := by + classical + intro r + induction r with + | zero => + intro T _ + exact ⟨Fin.elim0, fun i => i.elim0, fun i => i.elim0⟩ + | succ r ih => + intro T hcard + have hne : T.Nonempty := (Set.ncard_pos (Set.toFinite T)).mp (by omega) + have hex : ∃ m : ℕ, ∃ hm : m < k, (⟨m, hm⟩ : Fin k) ∈ T := by + rcases hne with ⟨⟨m, hm⟩, hmT⟩ + exact ⟨m, hm, hmT⟩ + let m₀ := Nat.find hex + have hm₀_spec := Nat.find_spec hex + let x₀ : Fin k := ⟨m₀, hm₀_spec.choose⟩ + have hx₀_in : x₀ ∈ T := hm₀_spec.choose_spec + have hx₀_min : ∀ y ∈ T, x₀ ≤ y := by + intro ⟨y, hy⟩ hyT + change m₀ ≤ y + by_contra hlt + exact Nat.find_min hex (by omega) ⟨hy, hyT⟩ + let T' : Set (Fin k) := T \ {x₀} + have hcard_T' : r ≤ T'.ncard := by + rw [Set.ncard_sdiff_singleton_of_mem hx₀_in] + omega + obtain ⟨idx', hmono', hmem'⟩ := ih T' hcard_T' + let idx (j : Fin (r + 1)) : Fin k := + if hj : j.1 = 0 then x₀ else idx' ⟨j.1 - 1, by omega⟩ + refine ⟨idx, fun i j hij => ?_, fun j => ?_⟩ + · by_cases hi0 : i.1 = 0 + · have hj0 : j.1 ≠ 0 := by omega + simp only [idx, hi0, hj0, ↓reduceDIte] + have hmem_j := hmem' ⟨j.1 - 1, by omega⟩ + exact lt_of_le_of_ne (hx₀_min _ hmem_j.1) (Ne.symm hmem_j.2) + · have hj0 : j.1 ≠ 0 := by omega + simp only [idx, hi0, hj0, ↓reduceDIte] + exact hmono' (by simp only [Fin.mk_lt_mk]; omega) + · by_cases hj0 : j.1 = 0 + · simp only [idx, hj0, ↓reduceDIte] + exact hx₀_in + · simp only [idx, hj0, ↓reduceDIte] + exact (hmem' ⟨j.1 - 1, by omega⟩).1 + +/-- Erdős–Szekeres theorem for an injective map `φ : Fin k → Fin k`: if `(r - 1) * M ≤ k` with +`2 ≤ r` and `1 ≤ M`, then either there is a decreasing subsequence of length `r`, or there is a +maximum-length increasing subsequence `x : Fin n → Fin k` with `M ≤ n`. -/ +theorem exists_decreasing_or_max_increasing {k r M : ℕ} + (hr : 2 ≤ r) (hM : 1 ≤ M) (hk_pos : 1 ≤ k) + (φ : Fin k → Fin k) (hφ_inj : Function.Injective φ) + (hcard : (r - 1) * M ≤ k) : + (∃ idx : Fin r → Fin k, StrictMono idx ∧ StrictAnti (φ ∘ idx)) ∨ + (∃ (n : ℕ) (hn : M ≤ n) (x : Fin n → Fin k), + StrictMono x ∧ StrictMono (φ ∘ x) ∧ + (∀ p : Fin k, p < x ⟨0, by omega⟩ → φ (x ⟨0, by omega⟩) < φ p) ∧ + (∀ p : Fin k, φ p < φ (x ⟨0, by omega⟩) → x ⟨0, by omega⟩ < p) ∧ + (∀ p : Fin k, x ⟨n - 1, by omega⟩ < p → φ p < φ (x ⟨n - 1, by omega⟩)) ∧ + (∀ p : Fin k, φ (x ⟨n - 1, by omega⟩) < φ p → p < x ⟨n - 1, by omega⟩)) := by + classical + have hex_not : ∃ N : ℕ, ¬ IsIncSubseq φ (N + 1) := ⟨k, not_isIncSubseq_succ φ⟩ + let n := Nat.find hex_not + have hnot_succ : ¬ IsIncSubseq φ (n + 1) := Nat.find_spec hex_not + have hn_pos : 1 ≤ n := by + by_contra hlt + have hn0 : n = 0 := by omega + rw [hn0] at hnot_succ + refine hnot_succ ⟨fun _ => ⟨0, hk_pos⟩, ?_, ?_⟩ + · intro i j hij; omega + · intro i j hij; omega + have hinc_n : IsIncSubseq φ n := by + by_contra hnot + exact Nat.find_min hex_not (by omega : n - 1 < n) (by simpa [Nat.sub_add_cancel hn_pos] using + hnot) + by_cases hMn : M ≤ n + · right + obtain ⟨x, hx, hφx⟩ := hinc_n + have hnot_prepend : ∀ p : Fin k, ¬ (p < x ⟨0, by omega⟩ ∧ φ p < φ (x ⟨0, by omega⟩)) := by + rintro p ⟨hp_x, hp_φ⟩ + refine hnot_succ ⟨fun j : Fin (n + 1) => if hj : j.1 = 0 then p else x ⟨j.1 - 1, by omega⟩, + ?_, ?_⟩ + · intro i j hij + by_cases hi0 : i.1 = 0 + · have hj0 : j.1 ≠ 0 := by omega + simp only [hi0, hj0, ↓reduceDIte] + rcases eq_or_lt_of_le (Nat.zero_le (j.1 - 1)) with h0 | hpos + · have h_eq : (⟨j.1 - 1, by omega⟩ : Fin n) = ⟨0, by omega⟩ := by ext; dsimp; omega + rw [h_eq]; exact hp_x + · exact lt_trans hp_x (hx (by simp only [Fin.mk_lt_mk]; omega)) + · have hj0 : j.1 ≠ 0 := by omega + simp only [hi0, hj0, ↓reduceDIte] + exact hx (by simp only [Fin.mk_lt_mk]; omega) + · intro i j hij + change φ _ < φ _ + by_cases hi0 : i.1 = 0 + · have hj0 : j.1 ≠ 0 := by omega + simp only [hi0, hj0, ↓reduceDIte] + rcases eq_or_lt_of_le (Nat.zero_le (j.1 - 1)) with h0 | hpos + · have h_eq : (⟨j.1 - 1, by omega⟩ : Fin n) = ⟨0, by omega⟩ := by ext; dsimp; omega + rw [h_eq]; exact hp_φ + · exact lt_trans hp_φ (hφx (by simp only [Fin.mk_lt_mk]; omega)) + · have hj0 : j.1 ≠ 0 := by omega + simp only [hi0, hj0, ↓reduceDIte] + exact hφx (by simp only [Fin.mk_lt_mk]; omega) + have hnot_append : ∀ p : Fin k, + ¬ (x ⟨n - 1, by omega⟩ < p ∧ φ (x ⟨n - 1, by omega⟩) < φ p) := by + rintro p ⟨hp_x, hp_φ⟩ + refine hnot_succ ⟨fun j : Fin (n + 1) => if hj : j.1 < n then x ⟨j.1, hj⟩ else p, ?_, ?_⟩ + · intro i j hij + by_cases hj_n : j.1 < n + · have hi_n : i.1 < n := Nat.lt_trans hij hj_n + simp only [hi_n, hj_n, ↓reduceDIte] + exact hx hij + · have hi_n : i.1 < n := by omega + simp only [hi_n, hj_n, ↓reduceDIte] + rcases eq_or_lt_of_le (by omega : i.1 ≤ n - 1) with heq | hlt + · have h_eq : (⟨i.1, hi_n⟩ : Fin n) = ⟨n - 1, by omega⟩ := by ext; dsimp; omega + rw [h_eq]; exact hp_x + · exact lt_trans (hx (by simp only [Fin.mk_lt_mk]; exact hlt)) hp_x + · intro i j hij + change φ _ < φ _ + by_cases hj_n : j.1 < n + · have hi_n : i.1 < n := Nat.lt_trans hij hj_n + simp only [hi_n, hj_n, ↓reduceDIte] + exact hφx hij + · have hi_n : i.1 < n := by omega + simp only [hi_n, hj_n, ↓reduceDIte] + rcases eq_or_lt_of_le (by omega : i.1 ≤ n - 1) with heq | hlt + · have h_eq : (⟨i.1, hi_n⟩ : Fin n) = ⟨n - 1, by omega⟩ := by ext; dsimp; omega + rw [h_eq]; exact hp_φ + · exact lt_trans (hφx (by simp only [Fin.mk_lt_mk]; exact hlt)) hp_φ + refine ⟨n, hMn, x, hx, hφx, ?_, ?_, ?_, ?_⟩ + · intro p hp + rcases lt_trichotomy (φ p) (φ (x ⟨0, by omega⟩)) with hlt | heq | hgt + · exact (hnot_prepend p ⟨hp, hlt⟩).elim + · exact (ne_of_lt hp (hφ_inj heq)).elim + · exact hgt + · intro p hp + rcases lt_trichotomy p (x ⟨0, by omega⟩) with hlt | heq | hgt + · exact (hnot_prepend p ⟨hlt, hp⟩).elim + · rw [heq] at hp; exact (lt_irrefl _ hp).elim + · exact hgt + · intro p hp + rcases lt_trichotomy (φ p) (φ (x ⟨n - 1, by omega⟩)) with hlt | heq | hgt + · exact hlt + · exact (ne_of_gt hp (hφ_inj heq)).elim + · exact (hnot_append p ⟨hp, hgt⟩).elim + · intro p hp + rcases lt_trichotomy p (x ⟨n - 1, by omega⟩) with hlt | heq | hgt + · exact hlt + · rw [heq] at hp; exact (lt_irrefl _ hp).elim + · exact (hnot_append p ⟨hgt, hp⟩).elim + · left + have h_mul_lt : n * (r - 1) < k := by + have hn_le : n + 1 ≤ M := by omega + have h1 : (n + 1) * (r - 1) ≤ M * (r - 1) := Nat.mul_le_mul_right (r - 1) hn_le + rw [Nat.add_mul, Nat.one_mul, Nat.mul_comm M (r - 1)] at h1 + omega + have hex_end : ∀ i : Fin k, ∃ N : ℕ, ¬ IsIncEndingAt φ i (N + 1) := + fun i => ⟨k, not_isIncEndingAt_succ φ i⟩ + let len (i : Fin k) : ℕ := Nat.find (hex_end i) + have hlen_not_succ : ∀ i : Fin k, ¬ IsIncEndingAt φ i (len i + 1) := + fun i => Nat.find_spec (hex_end i) + have hlen_pos : ∀ i : Fin k, 1 ≤ len i := by + intro i + by_contra hlt + have h0 : len i = 0 := by omega + have hnot := hlen_not_succ i + rw [h0] at hnot + refine hnot ⟨fun _ => i, fun a b hab => by omega, fun a b hab => by omega, fun _ => rfl⟩ + have hlen_spec : ∀ i : Fin k, IsIncEndingAt φ i (len i) := by + intro i + by_contra hnot + have hp := hlen_pos i + exact Nat.find_min (hex_end i) (by omega : len i - 1 < len i) + (by simpa [Nat.sub_add_cancel hp] using hnot) + have hlen_le_n : ∀ i : Fin k, len i ≤ n := by + intro i + by_contra hgt + obtain ⟨x, hx, hφx, _⟩ := hlen_spec i + refine hnot_succ ⟨fun j : Fin (n + 1) => x ⟨j.1, by omega⟩, + fun a b hab => hx (by simp only [Fin.mk_lt_mk]; exact hab), + fun a b hab => hφx (by simp only [Fin.mk_lt_mk]; exact hab)⟩ + let f (i : Fin k) : ℕ := len i - 1 + have hf_lt_n : ∀ i : Fin k, f i < n := by + intro i; have := hlen_pos i; have := hlen_le_n i; dsimp [f]; omega + have huniv_card : (Set.univ : Set (Fin k)).ncard = k := by + rw [Set.ncard_univ, Nat.card_eq_fintype_card, Fintype.card_fin] + obtain ⟨c, _, hc_card⟩ := + exists_fiber_ncard_ge f r n Set.univ (fun i _ => hf_lt_n i) (by rw [huniv_card]; exact + h_mul_lt) + obtain ⟨idx, hidx_mono, hidx_mem⟩ := + exists_strictMono_mem_of_ncard_ge r {i ∈ (Set.univ : Set (Fin k)) | f i = c} hc_card + refine ⟨idx, hidx_mono, fun a b hab => ?_⟩ + have hij : idx a < idx b := hidx_mono hab + have hfa : f (idx a) = c := (hidx_mem a).2 + have hfb : f (idx b) = c := (hidx_mem b).2 + have hlen_eq : len (idx a) = len (idx b) := by + have := hlen_pos (idx a); have := hlen_pos (idx b) + dsimp [f] at hfa hfb; omega + change φ (idx b) < φ (idx a) + rcases lt_trichotomy (φ (idx a)) (φ (idx b)) with hlt | heq | hgt + · exfalso + obtain ⟨x, hx, hφx, hx_end⟩ := hlen_spec (idx a) + have hp_a := hlen_pos (idx a) + have hend_a := hx_end hp_a + refine hlen_not_succ (idx b) ⟨fun j : Fin (len (idx b) + 1) => + if hj : j.1 < len (idx a) then x ⟨j.1, hj⟩ else idx b, ?_, ?_, ?_⟩ + · intro u v huv + by_cases hv_lt : v.1 < len (idx a) + · have hu_lt : u.1 < len (idx a) := Nat.lt_trans huv hv_lt + simp only [hu_lt, hv_lt, ↓reduceDIte] + exact hx huv + · have hu_lt : u.1 < len (idx a) := by omega + simp only [hu_lt, hv_lt, ↓reduceDIte] + rcases eq_or_lt_of_le (by omega : u.1 ≤ len (idx a) - 1) with heq_u | hlt_u + · have h_eq : (⟨u.1, hu_lt⟩ : Fin (len (idx a))) = ⟨len (idx a) - 1, by omega⟩ := by + ext; dsimp; omega + rw [h_eq, hend_a]; exact hij + · have h_step : x ⟨u.1, hu_lt⟩ < x ⟨len (idx a) - 1, by omega⟩ := + hx (by simp only [Fin.mk_lt_mk]; exact hlt_u) + rw [hend_a] at h_step + exact lt_trans h_step hij + · intro u v huv + change φ _ < φ _ + by_cases hv_lt : v.1 < len (idx a) + · have hu_lt : u.1 < len (idx a) := Nat.lt_trans huv hv_lt + simp only [hu_lt, hv_lt, ↓reduceDIte] + exact hφx huv + · have hu_lt : u.1 < len (idx a) := by omega + simp only [hu_lt, hv_lt, ↓reduceDIte] + rcases eq_or_lt_of_le (by omega : u.1 ≤ len (idx a) - 1) with heq_u | hlt_u + · have h_eq : (⟨u.1, hu_lt⟩ : Fin (len (idx a))) = ⟨len (idx a) - 1, by omega⟩ := by + ext; dsimp; omega + rw [h_eq, hend_a]; exact hlt + · have h_step : φ (x ⟨u.1, hu_lt⟩) < φ (x ⟨len (idx a) - 1, by omega⟩) := + hφx (by simp only [Fin.mk_lt_mk]; exact hlt_u) + rw [hend_a] at h_step + exact lt_trans h_step hlt + · intro _ + have hnot_lt : ¬ (len (idx b) < len (idx a)) := by omega + simp [hnot_lt] + · exact (ne_of_lt hij (hφ_inj heq)).elim + · exact hgt + +/-! ## Construction of Crosscaps, Leaps, and Doublecrosses from Index Configurations -/ + +/-- A decreasing subsequence `idx : Fin r → Fin k` of `φ` yields a crosscap transaction of size `r`. +-/ +theorem exists_crosscap_of_decreasing + {P_set : Set (Graph α β)} (hdisj : S.IsDisjointOmegaPathSet P_set) + {k r : ℕ} (hr : 2 ≤ r) + {L : List α} (hL_len : L.length = 2 * k) (hL_cw : S.Ω.IsClockwiseSeq L) + {R : Fin k → Graph α β} (hR_inj : Function.Injective R) (hR_sub : range R ⊆ P_set) + {φ : Fin k → Fin k} + (hR_ends : ∀ i : Fin k, S.IsOmegaPathWithEnds (R i) + (L[k - 1 - i.1]'(by omega)) (L[k + (φ i).1]'(by omega))) + (idx : Fin r → Fin k) (hidx_mono : StrictMono idx) (hφ_anti : StrictAnti (φ ∘ idx)) : + ∃ P_set' ⊆ P_set, P_set'.ncard = r ∧ S.IsCrosscapTransaction P_set' := by + let P' (j : Fin r) : Graph α β := R (idx j) + let fa (j : Fin r) : ℕ := k - 1 - (idx j).1 + let fb (j : Fin r) : ℕ := k + (φ (idx j)).1 + have hfa_lt : ∀ j : Fin r, fa j < L.length := fun j => by dsimp [fa]; omega + have hfb_lt : ∀ j : Fin r, fb j < L.length := fun j => by dsimp [fb]; omega + let a' (j : Fin r) : α := L[fa j]'(hfa_lt j) + let b' (j : Fin r) : α := L[fb j]'(hfb_lt j) + have hfa_anti : StrictAnti fa := by + intro i j hij + have hlt : (idx i).1 < (idx j).1 := hidx_mono hij + have := (idx j).2 + dsimp [fa]; omega + have hfb_anti : StrictAnti fb := by + intro i j hij + have hlt : (φ (idx j)).1 < (φ (idx i)).1 := hφ_anti hij + dsimp [fb]; omega + have hsub_a : CyclicPerm.IsBoundedSubseq L ((List.ofFn a').reverse) 0 k := + CyclicPerm.IsBoundedSubseq.ofFn_reverse_strictAnti L (by omega) fa hfa_lt + (fun j => Nat.zero_le _) (fun j => by dsimp [fa]; omega) hfa_anti + have hsub_b : CyclicPerm.IsBoundedSubseq L ((List.ofFn b').reverse) k (2 * k) := + CyclicPerm.IsBoundedSubseq.ofFn_reverse_strictAnti L (by omega) fb hfb_lt + (fun j => by dsimp [fb]; omega) (fun j => by have := (φ (idx j)).2; dsimp [fb]; omega) + hfb_anti + have hcw : S.Ω.IsClockwiseSeq ((List.ofFn a').reverse ++ (List.ofFn b').reverse) := + hL_cw.of_isBoundedSubseq (hsub_a.append hsub_b) + have hP'_inj : Function.Injective P' := hR_inj.comp hidx_mono.injective + have hP'_sub : range P' ⊆ P_set := by + rintro _ ⟨j, rfl⟩; exact hR_sub ⟨idx j, rfl⟩ + obtain ⟨hsub, hcard, hcross⟩ := + S.exists_crosscap_of_isClockwiseSeq hdisj hr P' a' b' hP'_inj hP'_sub + (fun j => hR_ends (idx j)) hcw + exact ⟨range P', hsub, hcard, hcross⟩ + +/-- Leap construction (Type A): `p < q 0` and `φ (q (s - 2)) < φ p`. -/ +theorem exists_leap_typeA + {P_set : Set (Graph α β)} (hdisj : S.IsDisjointOmegaPathSet P_set) + {k s : ℕ} (hs : 3 ≤ s) + {L : List α} (hL_len : L.length = 2 * k) (hL_cw : S.Ω.IsClockwiseSeq L) + {R : Fin k → Graph α β} (hR_inj : Function.Injective R) (hR_sub : range R ⊆ P_set) + {φ : Fin k → Fin k} + (hR_ends : ∀ i : Fin k, S.IsOmegaPathWithEnds (R i) + (L[k - 1 - i.1]'(by omega)) (L[k + (φ i).1]'(by omega))) + (q : Fin (s - 1) → Fin k) (hq_mono : StrictMono q) (hφq_mono : StrictMono (φ ∘ q)) + (p : Fin k) (hp_lt : p < q ⟨0, by omega⟩) (hφp_gt : φ (q ⟨s - 2, by omega⟩) < φ p) : + ∃ P_set' ⊆ P_set, P_set'.ncard = s ∧ S.IsLeapTransaction P_set' := by + let idx (i : Fin s) : Fin k := if hi0 : i.1 = 0 then p else q ⟨i.1 - 1, by omega⟩ + have hidx_mono : StrictMono idx := by + intro i j hij + by_cases hi0 : i.1 = 0 + · have hj0 : j.1 ≠ 0 := by omega + simp only [idx, hi0, hj0, ↓reduceDIte] + rcases eq_or_lt_of_le (Nat.zero_le (j.1 - 1)) with h0 | hpos + · have h_eq : (⟨j.1 - 1, by omega⟩ : Fin (s - 1)) = ⟨0, by omega⟩ := by ext; dsimp; omega + rw [h_eq]; exact hp_lt + · exact lt_trans hp_lt (hq_mono (by simp only [Fin.mk_lt_mk]; omega)) + · have hj0 : j.1 ≠ 0 := by omega + simp only [idx, hi0, hj0, ↓reduceDIte] + exact hq_mono (by simp only [Fin.mk_lt_mk]; omega) + let P' (i : Fin s) : Graph α β := R (idx i) + let fa (i : Fin s) : ℕ := k - 1 - (idx i).1 + have hfa_lt : ∀ i : Fin s, fa i < L.length := fun i => by dsimp [fa]; omega + let a' (i : Fin s) : α := L[fa i]'(hfa_lt i) + let b' (i : Fin s) : α := L[k + (φ (idx i)).1]'(by omega) + have hfa_anti : StrictAnti fa := by + intro i j hij + have hlt : (idx i).1 < (idx j).1 := hidx_mono hij + have := (idx j).2 + dsimp [fa]; omega + have hsub_a : CyclicPerm.IsBoundedSubseq L ((List.ofFn a').reverse) 0 k := + CyclicPerm.IsBoundedSubseq.ofFn_reverse_strictAnti L (by omega) fa hfa_lt + (fun i => Nat.zero_le _) (fun i => by dsimp [fa]; omega) hfa_anti + let fb_mid (i : Fin (s - 1)) : ℕ := k + (φ (q i)).1 + have hfb_mid_lt : ∀ i : Fin (s - 1), fb_mid i < L.length := fun i => by dsimp [fb_mid]; omega + have hfb_mid_hi : ∀ i : Fin (s - 1), fb_mid i < k + (φ p).1 := by + intro i + have hi_le : i ≤ ⟨s - 2, by omega⟩ := by change i.1 ≤ s - 2; omega + have hle : (φ (q i)).1 ≤ (φ (q ⟨s - 2, by omega⟩)).1 := hφq_mono.monotone hi_le + have hlt : (φ (q ⟨s - 2, by omega⟩)).1 < (φ p).1 := hφp_gt + dsimp [fb_mid]; omega + have hfb_mid_mono : StrictMono fb_mid := by + intro i j hij + have hlt : (φ (q i)).1 < (φ (q j)).1 := hφq_mono hij + dsimp [fb_mid]; omega + have h_mid_eq : List.ofFn (fun i : Fin (s - 1) => b' ⟨i.1 + 1, by omega⟩) = + List.ofFn (fun i : Fin (s - 1) => L[fb_mid i]'(hfb_mid_lt i)) := by + simp [b', idx, fb_mid] + have hsub_b_mid : CyclicPerm.IsBoundedSubseq L + (List.ofFn (fun i : Fin (s - 1) => b' ⟨i.1 + 1, by omega⟩)) k (k + (φ p).1) := by + rw [h_mid_eq] + exact CyclicPerm.IsBoundedSubseq.ofFn_strictMono L (by omega) fb_mid hfb_mid_lt + (fun i => by dsimp [fb_mid]; omega) hfb_mid_hi hfb_mid_mono + have h_b0_eq : b' ⟨0, by omega⟩ = L[k + (φ p).1]'(by omega) := by + simp [b', idx] + have hsub_b0 : CyclicPerm.IsBoundedSubseq L [b' ⟨0, by omega⟩] (k + (φ p).1) (2 * k) := by + rw [h_b0_eq] + exact CyclicPerm.IsBoundedSubseq.singleton L (by omega) le_rfl + (by have := (φ p).2; omega) + have hcw : S.Ω.IsClockwiseSeq + ((List.ofFn a').reverse ++ + List.ofFn (fun i : Fin (s - 1) => b' ⟨i.1 + 1, by omega⟩) ++ + [b' ⟨0, by omega⟩]) := + hL_cw.of_isBoundedSubseq ((hsub_a.append hsub_b_mid).append hsub_b0) + have hP'_inj : Function.Injective P' := hR_inj.comp hidx_mono.injective + have hP'_sub : range P' ⊆ P_set := by + rintro _ ⟨i, rfl⟩; exact hR_sub ⟨idx i, rfl⟩ + obtain ⟨hsub, hcard, hleap⟩ := + S.exists_leap_of_isClockwiseSeq hdisj hs P' a' b' hP'_inj hP'_sub + (fun i => hR_ends (idx i)) hcw + exact ⟨range P', hsub, hcard, hleap⟩ + +/-- Leap construction (Type B): `q (s - 2) < p` and `φ p < φ (q 0)`. -/ +theorem exists_leap_typeB + {P_set : Set (Graph α β)} (hdisj : S.IsDisjointOmegaPathSet P_set) + {k s : ℕ} (hs : 3 ≤ s) + {L : List α} (hL_len : L.length = 2 * k) (hL_cw : S.Ω.IsClockwiseSeq L) + {R : Fin k → Graph α β} (hR_inj : Function.Injective R) (hR_sub : range R ⊆ P_set) + {φ : Fin k → Fin k} + (hR_ends : ∀ i : Fin k, S.IsOmegaPathWithEnds (R i) + (L[k - 1 - i.1]'(by omega)) (L[k + (φ i).1]'(by omega))) + (q : Fin (s - 1) → Fin k) (hq_mono : StrictMono q) (hφq_mono : StrictMono (φ ∘ q)) + (p : Fin k) (hp_gt : q ⟨s - 2, by omega⟩ < p) (hφp_lt : φ p < φ (q ⟨0, by omega⟩)) : + ∃ P_set' ⊆ P_set, P_set'.ncard = s ∧ S.IsLeapTransaction P_set' := by + let idx (i : Fin s) : Fin k := if hi0 : i.1 = 0 then p else q ⟨i.1 - 1, by omega⟩ + have hq_lt_p : ∀ j : Fin (s - 1), q j < p := by + intro j + have hj_le : j ≤ ⟨s - 2, by omega⟩ := by change j.1 ≤ s - 2; omega + exact lt_of_le_of_lt (hq_mono.monotone hj_le) hp_gt + have hidx_inj : Function.Injective idx := by + intro i j hij + by_cases hi0 : i.1 = 0 + · by_cases hj0 : j.1 = 0 + · ext; omega + · simp only [idx, hi0, hj0, ↓reduceDIte] at hij + exact (ne_of_gt (hq_lt_p ⟨j.1 - 1, by omega⟩) hij).elim + · by_cases hj0 : j.1 = 0 + · simp only [idx, hi0, hj0, ↓reduceDIte] at hij + exact (ne_of_lt (hq_lt_p ⟨i.1 - 1, by omega⟩) hij).elim + · simp only [idx, hi0, hj0, ↓reduceDIte] at hij + have heq := hq_mono.injective hij + ext; have := congrArg Fin.val heq; dsimp at this; omega + let P' (i : Fin s) : Graph α β := R (idx i) + let a' (i : Fin s) : α := + if hi0 : i.1 = 0 then L[k + (φ p).1]'(by omega) + else L[k - 1 - (q ⟨i.1 - 1, by omega⟩).1]'(by omega) + let b' (i : Fin s) : α := + if hi0 : i.1 = 0 then L[k - 1 - p.1]'(by omega) + else L[k + (φ (q ⟨i.1 - 1, by omega⟩)).1]'(by omega) + have hends' : ∀ i : Fin s, S.IsOmegaPathWithEnds (P' i) (a' i) (b' i) := by + intro i + by_cases hi0 : i.1 = 0 + · simp only [P', idx, a', b', hi0, ↓reduceDIte] + exact (hR_ends p).symm S + · simp only [P', idx, a', b', hi0, ↓reduceDIte] + exact hR_ends (q ⟨i.1 - 1, by omega⟩) + let fa_q (j : Fin (s - 1)) : ℕ := k - 1 - (q j).1 + have hfa_q_lt : ∀ j : Fin (s - 1), fa_q j < L.length := fun j => by dsimp [fa_q]; omega + let fb_q (j : Fin (s - 1)) : ℕ := k + (φ (q j)).1 + have hfb_q_lt : ∀ j : Fin (s - 1), fb_q j < L.length := fun j => by dsimp [fb_q]; omega + have h_a_rev_eq : (List.ofFn a').reverse = + (List.ofFn (fun j : Fin (s - 1) => L[fa_q j]'(hfa_q_lt j))).reverse ++ + [L[k + (φ p).1]'(by omega)] := by + have h_a_eq : List.ofFn a' = + [L[k + (φ p).1]'(by omega)] ++ + List.ofFn (fun j : Fin (s - 1) => L[fa_q j]'(hfa_q_lt j)) := by + apply List.ext_getElem + · simp; omega + · intro i hi₁ hi₂ + rcases Nat.eq_zero_or_pos i with rfl | hi_pos + · simp [a'] + · rw [List.getElem_ofFn, List.getElem_append_right (by simp; omega)] + simp [a', Nat.ne_of_gt hi_pos, fa_q] + rw [h_a_eq, List.reverse_append, List.reverse_singleton] + have h_b_mid_eq : List.ofFn (fun j : Fin (s - 1) => b' ⟨j.1 + 1, by omega⟩) = + List.ofFn (fun j : Fin (s - 1) => L[fb_q j]'(hfb_q_lt j)) := by + simp [b', fb_q] + have h_b0_eq : b' ⟨0, by omega⟩ = L[k - 1 - p.1]'(by omega) := by + simp [b'] + let mid₁ := k - 1 - (q ⟨s - 2, by omega⟩).1 + let mid₂ := k + (φ (q ⟨0, by omega⟩)).1 + have hsub_1 : CyclicPerm.IsBoundedSubseq L [L[k - 1 - p.1]'(by omega)] 0 mid₁ := + CyclicPerm.IsBoundedSubseq.singleton L (by omega) (Nat.zero_le _) + (by have : (q ⟨s - 2, by omega⟩).1 < p.1 := hp_gt; have := p.2; dsimp [mid₁]; omega) + have hsub_2 : CyclicPerm.IsBoundedSubseq L + ((List.ofFn (fun j : Fin (s - 1) => L[fa_q j]'(hfa_q_lt j))).reverse) mid₁ k := by + refine CyclicPerm.IsBoundedSubseq.ofFn_reverse_strictAnti L (by dsimp [mid₁]; omega) + fa_q hfa_q_lt (fun j => ?_) (fun j => by dsimp [fa_q]; omega) (fun i j hij => ?_) + · have hj_le : j ≤ ⟨s - 2, by omega⟩ := by change j.1 ≤ s - 2; omega + have : (q j).1 ≤ (q ⟨s - 2, by omega⟩).1 := hq_mono.monotone hj_le + have := (q ⟨s - 2, by omega⟩).2 + dsimp [mid₁, fa_q]; omega + · have : (q i).1 < (q j).1 := hq_mono hij + have := (q j).2 + dsimp [fa_q]; omega + have hsub_3 : CyclicPerm.IsBoundedSubseq L [L[k + (φ p).1]'(by omega)] k mid₂ := + CyclicPerm.IsBoundedSubseq.singleton L (by omega) (by omega) + (by have : (φ p).1 < (φ (q ⟨0, by omega⟩)).1 := hφp_lt; dsimp [mid₂]; omega) + have hsub_4 : CyclicPerm.IsBoundedSubseq L + (List.ofFn (fun j : Fin (s - 1) => L[fb_q j]'(hfb_q_lt j))) mid₂ (2 * k) := by + refine CyclicPerm.IsBoundedSubseq.ofFn_strictMono L + (by have := (φ (q ⟨0, by omega⟩)).2; dsimp [mid₂]; omega) + fb_q hfb_q_lt (fun j => ?_) (fun j => by have := (φ (q j)).2; dsimp [fb_q]; omega) + (fun i j hij => ?_) + · have hj_ge : (⟨0, by omega⟩ : Fin (s - 1)) ≤ j := by change 0 ≤ j.1; omega + have : (φ (q ⟨0, by omega⟩)).1 ≤ (φ (q j)).1 := hφq_mono.monotone hj_ge + dsimp [mid₂, fb_q]; omega + · have : (φ (q i)).1 < (φ (q j)).1 := hφq_mono hij + dsimp [fb_q]; omega + have hcw_rot : S.Ω.IsClockwiseSeq + ([b' ⟨0, by omega⟩] ++ + ((List.ofFn a').reverse ++ + List.ofFn (fun j : Fin (s - 1) => b' ⟨j.1 + 1, by omega⟩))) := by + rw [h_b0_eq, h_a_rev_eq, h_b_mid_eq, ← List.append_assoc, ← List.append_assoc] + exact hL_cw.of_isBoundedSubseq (((hsub_1.append hsub_2).append hsub_3).append hsub_4) + have hcw : S.Ω.IsClockwiseSeq + ((List.ofFn a').reverse ++ + List.ofFn (fun j : Fin (s - 1) => b' ⟨j.1 + 1, by omega⟩) ++ + [b' ⟨0, by omega⟩]) := + hcw_rot.append_comm + have hP'_inj : Function.Injective P' := hR_inj.comp hidx_inj + have hP'_sub : range P' ⊆ P_set := by + rintro _ ⟨i, rfl⟩; exact hR_sub ⟨idx i, rfl⟩ + obtain ⟨hsub, hcard, hleap⟩ := + S.exists_leap_of_isClockwiseSeq hdisj hs P' a' b' hP'_inj hP'_sub hends' hcw + exact ⟨range P', hsub, hcard, hleap⟩ + +/-- Doublecross construction from crossed end pairs `(u₀, u₁)` and `(v₀, v₁)` around the middle +increasing subsequence `x ⟨s - 2, _⟩, …, x ⟨s + t - 7, _⟩`. -/ +theorem exists_doublecross_of_ends + {P_set : Set (Graph α β)} (hdisj : S.IsDisjointOmegaPathSet P_set) + {k s t n : ℕ} (hs : 3 ≤ s) (ht : 4 ≤ t) (hn : 2 * s + t - 7 ≤ n) + {L : List α} (hL_len : L.length = 2 * k) (hL_cw : S.Ω.IsClockwiseSeq L) + {R : Fin k → Graph α β} (hR_inj : Function.Injective R) (hR_sub : range R ⊆ P_set) + {φ : Fin k → Fin k} + (hR_ends : ∀ i : Fin k, S.IsOmegaPathWithEnds (R i) + (L[k - 1 - i.1]'(by omega)) (L[k + (φ i).1]'(by omega))) + (x : Fin n → Fin k) (hx_mono : StrictMono x) (hφx_mono : StrictMono (φ ∘ x)) + (u₀ u₁ : Fin k) (hu_lt : u₀ < u₁) (hu₁_lt : u₁ < x ⟨s - 2, by omega⟩) + (hφu_lt : φ u₁ < φ u₀) (hφu₀_lt : φ u₀ < φ (x ⟨s - 2, by omega⟩)) + (v₀ v₁ : Fin k) (hv₀_gt : x ⟨n - s + 1, by omega⟩ < v₀) (hv_lt : v₀ < v₁) + (hφv₁_gt : φ (x ⟨n - s + 1, by omega⟩) < φ v₁) (hφv_lt : φ v₁ < φ v₀) : + ∃ P_set' ⊆ P_set, P_set'.ncard = t ∧ S.IsDoublecrossTransaction P_set' := by + let idx (i : Fin t) : Fin k := + if i.1 = 0 then u₀ + else if i.1 = 1 then u₁ + else if hlt : i.1 < t - 2 then x ⟨s - 2 + (i.1 - 2), by omega⟩ + else if i.1 = t - 2 then v₀ + else v₁ + have hidx_0 : ∀ i : Fin t, i.1 = 0 → idx i = u₀ := fun i h => by + dsimp [idx]; split_ifs; rfl + have hidx_1 : ∀ i : Fin t, i.1 = 1 → idx i = u₁ := fun i h => by + dsimp [idx]; split_ifs <;> first | rfl | omega + have hidx_mid : ∀ (i : Fin t) (h2 : 2 ≤ i.1) (hlt : i.1 < t - 2), + idx i = x ⟨s - 2 + (i.1 - 2), by omega⟩ := fun i h2 hlt => by + dsimp [idx]; split_ifs <;> first | rfl | omega + have hidx_t2 : ∀ i : Fin t, i.1 = t - 2 → idx i = v₀ := fun i h => by + dsimp [idx]; split_ifs <;> first | rfl | omega + have hidx_t1 : ∀ i : Fin t, i.1 = t - 1 → idx i = v₁ := fun i h => by + dsimp [idx]; split_ifs <;> first | rfl | omega + have hx_bot_lt_v₀ : x ⟨s - 2, by omega⟩ < v₀ := by + have hle : (⟨s - 2, by omega⟩ : Fin n) ≤ ⟨n - s + 1, by omega⟩ := by + change s - 2 ≤ n - s + 1; omega + exact lt_of_le_of_lt (hx_mono.monotone hle) hv₀_gt + have hu₁_lt_v₀ : u₁ < v₀ := lt_trans hu₁_lt hx_bot_lt_v₀ + have hu₁_lt_v₁ : u₁ < v₁ := lt_trans hu₁_lt_v₀ hv_lt + have hu₀_lt_v₀ : u₀ < v₀ := lt_trans hu_lt hu₁_lt_v₀ + have hu₀_lt_v₁ : u₀ < v₁ := lt_trans hu_lt hu₁_lt_v₁ + have hx_mid_lt_v₀ : ∀ m : ℕ, (hm : 2 ≤ m) → (hmt : m < t - 2) → + x ⟨s - 2 + (m - 2), by omega⟩ < v₀ := by + intro m hm hmt + have hle : (⟨s - 2 + (m - 2), by omega⟩ : Fin n) ≤ ⟨n - s + 1, by omega⟩ := by + change s - 2 + (m - 2) ≤ n - s + 1; omega + exact lt_of_le_of_lt (hx_mono.monotone hle) hv₀_gt + have hu₁_lt_x_mid : ∀ m : ℕ, (hm : 2 ≤ m) → (hmt : m < t - 2) → + u₁ < x ⟨s - 2 + (m - 2), by omega⟩ := by + intro m hm hmt + have hle : (⟨s - 2, by omega⟩ : Fin n) ≤ ⟨s - 2 + (m - 2), by omega⟩ := by + change s - 2 ≤ s - 2 + (m - 2); omega + exact lt_of_lt_of_le hu₁_lt (hx_mono.monotone hle) + have hφx_mid_lt_v₁ : ∀ m : ℕ, (hm : m < t - 4) → φ (x ⟨s - 2 + m, by omega⟩) < φ v₁ := by + intro m hm + have hle : (⟨s - 2 + m, by omega⟩ : Fin n) ≤ ⟨n - s + 1, by omega⟩ := by + change s - 2 + m ≤ n - s + 1; omega + exact lt_of_le_of_lt (hφx_mono.monotone hle) hφv₁_gt + have hidx_mono : StrictMono idx := by + intro i j hij + have hij_val : i.1 < j.1 := hij + have hi_t : i.1 < t := i.2 + have hj_t : j.1 < t := j.2 + by_cases hi0 : i.1 = 0 + · rw [hidx_0 i hi0] + by_cases hj1 : j.1 = 1 + · rw [hidx_1 j hj1]; exact hu_lt + · by_cases hjlt : j.1 < t - 2 + · rw [hidx_mid j (by omega) hjlt] + exact lt_trans hu_lt (hu₁_lt_x_mid j.1 (by omega) hjlt) + · by_cases hj2 : j.1 = t - 2 + · rw [hidx_t2 j hj2]; exact hu₀_lt_v₀ + · rw [hidx_t1 j (by omega)]; exact hu₀_lt_v₁ + · by_cases hi1 : i.1 = 1 + · rw [hidx_1 i hi1] + by_cases hjlt : j.1 < t - 2 + · rw [hidx_mid j (by omega) hjlt] + exact hu₁_lt_x_mid j.1 (by omega) hjlt + · by_cases hj2 : j.1 = t - 2 + · rw [hidx_t2 j hj2]; exact hu₁_lt_v₀ + · rw [hidx_t1 j (by omega)]; exact hu₁_lt_v₁ + · by_cases hilt : i.1 < t - 2 + · rw [hidx_mid i (by omega) hilt] + by_cases hjlt : j.1 < t - 2 + · rw [hidx_mid j (by omega) hjlt] + exact hx_mono (by change s - 2 + (i.1 - 2) < s - 2 + (j.1 - 2); omega) + · by_cases hj2 : j.1 = t - 2 + · rw [hidx_t2 j hj2] + exact hx_mid_lt_v₀ i.1 (by omega) hilt + · rw [hidx_t1 j (by omega)] + exact lt_trans (hx_mid_lt_v₀ i.1 (by omega) hilt) hv_lt + · rw [hidx_t2 i (by omega), hidx_t1 j (by omega)] + exact hv_lt + let P' (i : Fin t) : Graph α β := R (idx i) + let fa (i : Fin t) : ℕ := k - 1 - (idx i).1 + have hfa_lt : ∀ i : Fin t, fa i < L.length := fun i => by dsimp [fa]; omega + let a' (i : Fin t) : α := L[fa i]'(hfa_lt i) + let b' (i : Fin t) : α := L[k + (φ (idx i)).1]'(by omega) + have hfa_anti : StrictAnti fa := by + intro i j hij + have hlt : (idx i).1 < (idx j).1 := hidx_mono hij + have := (idx j).2 + dsimp [fa]; omega + have hsub_a : CyclicPerm.IsBoundedSubseq L ((List.ofFn a').reverse) 0 k := + CyclicPerm.IsBoundedSubseq.ofFn_reverse_strictAnti L (by omega) fa hfa_lt + (fun i => Nat.zero_le _) (fun i => by dsimp [fa]; omega) hfa_anti + let m1 : ℕ := k + (φ (x ⟨s - 2, by omega⟩)).1 + let m2 : ℕ := k + (φ v₁).1 + have h_b10_eq : [b' ⟨1, by omega⟩, b' ⟨0, by omega⟩] = + [L[k + (φ u₁).1]'(by omega), L[k + (φ u₀).1]'(by omega)] := by + have h1 : idx ⟨1, by omega⟩ = u₁ := hidx_1 ⟨1, by omega⟩ rfl + have h0 : idx ⟨0, by omega⟩ = u₀ := hidx_0 ⟨0, by omega⟩ rfl + simp [b', h1, h0] + have hsub_b10 : CyclicPerm.IsBoundedSubseq L [b' ⟨1, by omega⟩, b' ⟨0, by omega⟩] k m1 := by + rw [h_b10_eq] + refine CyclicPerm.IsBoundedSubseq.pair L (by omega) (by omega) + (by omega) (by have : (φ u₁).1 < (φ u₀).1 := hφu_lt; omega) + (by have : (φ u₀).1 < (φ (x ⟨s - 2, by omega⟩)).1 := hφu₀_lt; dsimp [m1]; omega) + let fb_mid (j : Fin (t - 4)) : ℕ := k + (φ (x ⟨s - 2 + j.1, by omega⟩)).1 + have hfb_mid_lt : ∀ j : Fin (t - 4), fb_mid j < L.length := fun j => by dsimp [fb_mid]; omega + have h_mid_eq : List.ofFn (fun j : Fin (t - 4) => b' ⟨j.1 + 2, by omega⟩) = + List.ofFn (fun j : Fin (t - 4) => L[fb_mid j]'(hfb_mid_lt j)) := by + congr 1; funext j + have hj_lt : j.1 + 2 < t - 2 := by have := j.2; omega + have hj_idx : idx ⟨j.1 + 2, by omega⟩ = x ⟨s - 2 + j.1, by omega⟩ := + hidx_mid ⟨j.1 + 2, by omega⟩ (by dsimp; omega) hj_lt + simp [b', hj_idx, fb_mid] + have hsub_b_mid : CyclicPerm.IsBoundedSubseq L + (List.ofFn (fun j : Fin (t - 4) => b' ⟨j.1 + 2, by omega⟩)) m1 m2 := by + rw [h_mid_eq] + refine CyclicPerm.IsBoundedSubseq.ofFn_strictMono L + (by have hle : (⟨s - 2, by omega⟩ : Fin n) ≤ ⟨n - s + 1, by omega⟩ := by + change s - 2 ≤ n - s + 1; omega + have : (φ (x ⟨s - 2, by omega⟩)).1 ≤ (φ (x ⟨n - s + 1, by omega⟩)).1 := + hφx_mono.monotone hle + have : (φ (x ⟨n - s + 1, by omega⟩)).1 < (φ v₁).1 := hφv₁_gt + dsimp [m1, m2]; omega) + fb_mid hfb_mid_lt (fun j => ?_) (fun j => ?_) (fun i j hij => ?_) + · have hle : (⟨s - 2, by omega⟩ : Fin n) ≤ ⟨s - 2 + j.1, by omega⟩ := by + change s - 2 ≤ s - 2 + j.1; omega + have : (φ (x ⟨s - 2, by omega⟩)).1 ≤ (φ (x ⟨s - 2 + j.1, by omega⟩)).1 := + hφx_mono.monotone hle + dsimp [m1, fb_mid]; omega + · have : (φ (x ⟨s - 2 + j.1, by omega⟩)).1 < (φ v₁).1 := hφx_mid_lt_v₁ j.1 j.2 + dsimp [m2, fb_mid]; omega + · have hlt : (⟨s - 2 + i.1, by omega⟩ : Fin n) < ⟨s - 2 + j.1, by omega⟩ := by + change s - 2 + i.1 < s - 2 + j.1; exact Nat.add_lt_add_left hij _ + have : (φ (x ⟨s - 2 + i.1, by omega⟩)).1 < (φ (x ⟨s - 2 + j.1, by omega⟩)).1 := + hφx_mono hlt + dsimp [fb_mid]; omega + have h_bt_eq : [b' ⟨t - 1, by omega⟩, b' ⟨t - 2, by omega⟩] = + [L[k + (φ v₁).1]'(by omega), L[k + (φ v₀).1]'(by omega)] := by + have ht1 : idx ⟨t - 1, by omega⟩ = v₁ := hidx_t1 ⟨t - 1, by omega⟩ rfl + have ht2 : idx ⟨t - 2, by omega⟩ = v₀ := hidx_t2 ⟨t - 2, by omega⟩ rfl + simp [b', ht1, ht2] + have hsub_bt : CyclicPerm.IsBoundedSubseq L [b' ⟨t - 1, by omega⟩, b' ⟨t - 2, by omega⟩] m2 + (2 * k) := by + rw [h_bt_eq] + refine CyclicPerm.IsBoundedSubseq.pair L (by omega) (by omega) + (by dsimp [m2]; omega) (by have : (φ v₁).1 < (φ v₀).1 := hφv_lt; omega) + (by have := (φ v₀).2; omega) + have hcw : S.Ω.IsClockwiseSeq + ((List.ofFn a').reverse ++ + [b' ⟨1, by omega⟩, b' ⟨0, by omega⟩] ++ + List.ofFn (fun j : Fin (t - 4) => b' ⟨j.1 + 2, by omega⟩) ++ + [b' ⟨t - 1, by omega⟩, b' ⟨t - 2, by omega⟩]) := + hL_cw.of_isBoundedSubseq (((hsub_a.append hsub_b10).append hsub_b_mid).append hsub_bt) + have hP'_inj : Function.Injective P' := hR_inj.comp hidx_mono.injective + have hP'_sub : range P' ⊆ P_set := by + rintro _ ⟨i, rfl⟩; exact hR_sub ⟨idx i, rfl⟩ + obtain ⟨hsub, hcard, hdc⟩ := + S.exists_doublecross_of_isClockwiseSeq hdisj ht P' a' b' hP'_inj hP'_sub + (fun i => hR_ends (idx i)) hcw + exact ⟨range P', hsub, hcard, hdc⟩ + +/-! ## Proof of Theorem (7.1) -/ + +/-- **Graph Minors IX, (7.1)** (page 59): +"Let $r \ge 2$, $s \ge 3$, $t \ge 4$ be integers. Let $\mathcal{P}$ be a crooked transaction +in $(G, \Omega)$ such that $|\mathcal{P}| \ge (r - 1)(2s + t - 7)$. Then there exists +$\mathcal{P}' \subseteq \mathcal{P}$ such that either* (i) *|\mathcal{P}'| = r and +\mathcal{P}' is a crosscap, or* (ii) *|\mathcal{P}'| = s and \mathcal{P}' is a leap, or* +(iii) *|\mathcal{P}'| = t and \mathcal{P}' is a doublecross." -/ +theorem theorem_7_1_proof + {P_set : Set (Graph α β)} + {r s t : ℕ} (hr : 2 ≤ r) (hs : 3 ≤ s) (ht : 4 ≤ t) + (hcrooked : S.IsCrookedTransaction P_set) + (hcard : (r - 1) * (2 * s + t - 7) ≤ P_set.ncard) : + ∃ P_set' ⊆ P_set, + (P_set'.ncard = r ∧ S.IsCrosscapTransaction P_set') ∨ + (P_set'.ncard = s ∧ S.IsLeapTransaction P_set') ∨ + (P_set'.ncard = t ∧ S.IsDoublecrossTransaction P_set') := by + obtain ⟨A_orig, B_orig, hfence_orig⟩ := hcrooked.1 + have hdisj : S.IsDisjointOmegaPathSet P_set := hfence_orig.1 + let k := P_set.ncard + have hk_ge : (r - 1) * (2 * s + t - 7) ≤ k := hcard + have hk_ge2 : 2 ≤ k := by + have : 1 * 3 ≤ (r - 1) * (2 * s + t - 7) := Nat.mul_le_mul (by omega) (by omega) + omega + obtain ⟨L, hL_len, R, φ, hL_cw, hR_inj, hR_sub, hφ_inj, hφ_surj, hR_ends, hφ_0, hφ_last⟩ := + S.exists_clockwise_enumeration_of_crooked hcrooked rfl (by omega) + rcases exists_decreasing_or_max_increasing hr (by omega : 1 ≤ 2 * s + t - 7) (by omega : 1 ≤ k) + φ hφ_inj hk_ge with + ⟨idx, hidx_mono, hφ_anti⟩ | + ⟨n, hn, x, hx_mono, hφx_mono, hno_before_lt, hno_before_φ, hno_after_gt, hno_after_φ⟩ + · obtain ⟨P_set', hsub, hncard, hcross⟩ := + S.exists_crosscap_of_decreasing hdisj hr hL_len hL_cw hR_inj hR_sub hR_ends + idx hidx_mono hφ_anti + exact ⟨P_set', hsub, Or.inl ⟨hncard, hcross⟩⟩ + · -- First analyze the bottom end (`x 0` and `x (s - 2)`) + have hbottom : + (∃ P_set' ⊆ P_set, P_set'.ncard = s ∧ S.IsLeapTransaction P_set') ∨ + ∃ u₀ u₁ : Fin k, u₀ < u₁ ∧ u₁ < x ⟨s - 2, by omega⟩ ∧ + φ u₁ < φ u₀ ∧ φ u₀ < φ (x ⟨s - 2, by omega⟩) := by + let q_bot (j : Fin (s - 1)) : Fin k := x ⟨j.1, by omega⟩ + have hq_bot_mono : StrictMono q_bot := fun a b hab => + hx_mono (by change a.1 < b.1; exact hab) + have hφq_bot_mono : StrictMono (φ ∘ q_bot) := fun a b hab => + hφx_mono (by change a.1 < b.1; exact hab) + rcases eq_or_lt_of_le (Nat.zero_le (x ⟨0, by omega⟩).1) with hx0_eq | hx0_pos + · -- Case B1: `x 0 = 0` + have hx0 : x ⟨0, by omega⟩ = ⟨0, by omega⟩ := by ext; dsimp; omega + have hφx0_pos : 0 < (φ (x ⟨0, by omega⟩)).1 := by + rw [hx0] + exact Nat.pos_of_ne_zero fun h => hφ_0 (by ext; exact h) + obtain ⟨p, hp_φ⟩ := hφ_surj ⟨0, by omega⟩ + have hφp_lt : φ p < φ (x ⟨0, by omega⟩) := by + change (φ p).1 < (φ (x ⟨0, by omega⟩)).1 + rw [hp_φ]; exact hφx0_pos + have hp_gt_x0 : x ⟨0, by omega⟩ < p := hno_before_φ p hφp_lt + rcases lt_or_ge p (x ⟨s - 2, by omega⟩) with hp_lt_xs | hp_ge_xs + · refine Or.inr ⟨x ⟨0, by omega⟩, p, hp_gt_x0, hp_lt_xs, hφp_lt, ?_⟩ + exact hφx_mono (by change 0 < s - 2; omega) + · have hp_gt_xs : x ⟨s - 2, by omega⟩ < p := by + rcases eq_or_lt_of_le hp_ge_xs with heq | hgt + · exfalso + have hle : φ (x ⟨0, by omega⟩) ≤ φ (x ⟨s - 2, by omega⟩) := + hφx_mono.monotone (by change 0 ≤ s - 2; omega) + exact not_lt_of_ge (heq ▸ hle) hφp_lt + · exact hgt + exact Or.inl (S.exists_leap_typeB hdisj hs hL_len hL_cw hR_inj hR_sub hR_ends + q_bot hq_bot_mono hφq_bot_mono p hp_gt_xs hφp_lt) + · -- Case B2: `0 < x 0` + let p : Fin k := ⟨0, by omega⟩ + have hp_lt_x0 : p < x ⟨0, by omega⟩ := hx0_pos + have hφp_gt_x0 : φ (x ⟨0, by omega⟩) < φ p := hno_before_lt p hp_lt_x0 + rcases lt_or_ge (φ p) (φ (x ⟨s - 2, by omega⟩)) with hφp_lt_xs | hφp_ge_xs + · refine Or.inr ⟨p, x ⟨0, by omega⟩, hp_lt_x0, ?_, hφp_gt_x0, hφp_lt_xs⟩ + exact hx_mono (by change 0 < s - 2; omega) + · have hφp_gt_xs : φ (x ⟨s - 2, by omega⟩) < φ p := by + rcases eq_or_lt_of_le hφp_ge_xs with heq | hgt + · exfalso + have hle : x ⟨0, by omega⟩ ≤ x ⟨s - 2, by omega⟩ := + hx_mono.monotone (by change 0 ≤ s - 2; omega) + have heq_idx : x ⟨s - 2, by omega⟩ = p := hφ_inj heq + exact not_lt_of_ge (heq_idx ▸ hle) hp_lt_x0 + · exact hgt + exact Or.inl (S.exists_leap_typeA hdisj hs hL_len hL_cw hR_inj hR_sub hR_ends + q_bot hq_bot_mono hφq_bot_mono p hp_lt_x0 hφp_gt_xs) + rcases hbottom with ⟨P_set', hsub, hncard, hleap⟩ | ⟨u₀, u₁, hu_lt, hu₁_lt, hφu_lt, hφu₀_lt⟩ + · exact ⟨P_set', hsub, Or.inr (Or.inl ⟨hncard, hleap⟩)⟩ + · -- Next analyze the top end (`x (n - s + 1)` and `x (n - 1)`) + have htop : + (∃ P_set' ⊆ P_set, P_set'.ncard = s ∧ S.IsLeapTransaction P_set') ∨ + ∃ v₀ v₁ : Fin k, x ⟨n - s + 1, by omega⟩ < v₀ ∧ v₀ < v₁ ∧ + φ (x ⟨n - s + 1, by omega⟩) < φ v₁ ∧ φ v₁ < φ v₀ := by + let q_top (j : Fin (s - 1)) : Fin k := x ⟨n - s + 1 + j.1, by omega⟩ + have hq_top_mono : StrictMono q_top := fun a b hab => + hx_mono (by change n - s + 1 + a.1 < n - s + 1 + b.1; exact Nat.add_lt_add_left hab _) + have hφq_top_mono : StrictMono (φ ∘ q_top) := fun a b hab => + hφx_mono (by change n - s + 1 + a.1 < n - s + 1 + b.1; exact Nat.add_lt_add_left hab _) + have hq_top_last : q_top ⟨s - 2, by omega⟩ = x ⟨n - 1, by omega⟩ := by + dsimp [q_top]; congr 1; ext; dsimp; omega + have hxn_le : (x ⟨n - 1, by omega⟩).1 ≤ k - 1 := by + have := (x ⟨n - 1, by omega⟩).2; omega + rcases eq_or_lt_of_le hxn_le with hxn_eq | hxn_lt + · -- Case T1: `x (n - 1) = k - 1` + have hxn : x ⟨n - 1, by omega⟩ = ⟨k - 1, by omega⟩ := by ext; dsimp; omega + have hφxn_lt : (φ (x ⟨n - 1, by omega⟩)).1 < k - 1 := by + have hlt_k := (φ (x ⟨n - 1, by omega⟩)).2 + have hne : φ (x ⟨n - 1, by omega⟩) ≠ ⟨k - 1, by omega⟩ := by + rw [hxn]; exact hφ_last + have hne_val : (φ (x ⟨n - 1, by omega⟩)).1 ≠ k - 1 := fun h => hne (by ext; exact h) + omega + obtain ⟨p, hp_φ⟩ := hφ_surj ⟨k - 1, by omega⟩ + have hφp_gt : φ (x ⟨n - 1, by omega⟩) < φ p := by + change (φ (x ⟨n - 1, by omega⟩)).1 < (φ p).1 + rw [hp_φ]; exact hφxn_lt + have hp_lt_xn : p < x ⟨n - 1, by omega⟩ := hno_after_φ p hφp_gt + rcases lt_or_ge (x ⟨n - s + 1, by omega⟩) p with hp_gt_xns | hp_le_xns + · refine Or.inr ⟨p, x ⟨n - 1, by omega⟩, hp_gt_xns, hp_lt_xn, ?_, hφp_gt⟩ + exact hφx_mono (by change n - s + 1 < n - 1; omega) + · have hp_lt_xns : p < x ⟨n - s + 1, by omega⟩ := by + rcases eq_or_lt_of_le hp_le_xns with heq | hlt + · exfalso + have hle : φ (x ⟨n - s + 1, by omega⟩) ≤ φ (x ⟨n - 1, by omega⟩) := + hφx_mono.monotone (by change n - s + 1 ≤ n - 1; omega) + exact not_lt_of_ge (heq ▸ hle) hφp_gt + · exact hlt + have hp_lt_q0 : p < q_top ⟨0, by omega⟩ := by + simpa [q_top] using hp_lt_xns + have hφp_gt_qlast : φ (q_top ⟨s - 2, by omega⟩) < φ p := by + rw [hq_top_last]; exact hφp_gt + exact Or.inl (S.exists_leap_typeA hdisj hs hL_len hL_cw hR_inj hR_sub hR_ends + q_top hq_top_mono hφq_top_mono p hp_lt_q0 hφp_gt_qlast) + · -- Case T2: `x (n - 1) < k - 1` + let p : Fin k := ⟨k - 1, by omega⟩ + have hp_gt_xn : x ⟨n - 1, by omega⟩ < p := hxn_lt + have hφp_lt_xn : φ p < φ (x ⟨n - 1, by omega⟩) := hno_after_gt p hp_gt_xn + rcases lt_or_ge (φ (x ⟨n - s + 1, by omega⟩)) (φ p) with hφp_gt_xns | hφp_le_xns + · refine Or.inr ⟨x ⟨n - 1, by omega⟩, p, ?_, hp_gt_xn, hφp_gt_xns, hφp_lt_xn⟩ + exact hx_mono (by change n - s + 1 < n - 1; omega) + · have hφp_lt_xns : φ p < φ (x ⟨n - s + 1, by omega⟩) := by + rcases eq_or_lt_of_le hφp_le_xns with heq | hlt + · exfalso + have hle : x ⟨n - s + 1, by omega⟩ ≤ x ⟨n - 1, by omega⟩ := + hx_mono.monotone (by change n - s + 1 ≤ n - 1; omega) + have heq_idx : p = x ⟨n - s + 1, by omega⟩ := hφ_inj heq + exact not_lt_of_ge (heq_idx.symm ▸ hle) hp_gt_xn + · exact hlt + have hp_gt_qlast : q_top ⟨s - 2, by omega⟩ < p := by + rw [hq_top_last]; exact hp_gt_xn + have hφp_lt_q0 : φ p < φ (q_top ⟨0, by omega⟩) := by + simpa [q_top] using hφp_lt_xns + exact Or.inl (S.exists_leap_typeB hdisj hs hL_len hL_cw hR_inj hR_sub hR_ends + q_top hq_top_mono hφq_top_mono p hp_gt_qlast hφp_lt_q0) + rcases htop with ⟨P_set', hsub, hncard, hleap⟩ | ⟨v₀, v₁, hv₀_gt, hv_lt, hφv₁_gt, hφv_lt⟩ + · exact ⟨P_set', hsub, Or.inr (Or.inl ⟨hncard, hleap⟩)⟩ + · obtain ⟨P_set', hsub, hncard, hdc⟩ := + S.exists_doublecross_of_ends hdisj hs ht hn hL_len hL_cw hR_inj hR_sub hR_ends + x hx_mono hφx_mono u₀ u₁ hu_lt hu₁_lt hφu_lt hφu₀_lt v₀ v₁ hv₀_gt hv_lt hφv₁_gt hφv_lt + exact ⟨P_set', hsub, Or.inr (Or.inr ⟨hncard, hdc⟩)⟩ + +end Society + +export Society (theorem_7_1_proof) + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section8.lean b/LeanPool/GraphMinor/GM09/Section8.lean new file mode 100644 index 0000000000..04b9ecf545 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section8.lean @@ -0,0 +1,730 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2d +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section4b +import Mathlib.Data.Set.Card + +/-! +# Graph Minors IX, Section 8: Societies with No Large Transaction + +This file formalizes Section 8 (pages 60–62) of +N. Robertson and P. D. Seymour, *Graph Minors. IX. Disjoint crossed paths*, +J. Combin. Theory Ser. B **49** (1990) 40–77, proving **(8.1)** (`theorem_8_1`): +every society `(G, Ω)` (with `ΩBar ≠ ∅` or `G = ⊥`) that has no transaction of cardinality `> k` +has a linear decomposition of depth `≤ k`. +-/ + +public section + +namespace GraphMinor.GM09 + +open Set Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Step 1: Clockwise enumerations of `ΩBar` and prefix/suffix fences -/ + +namespace CyclicPerm + +variable (Ω : CyclicPerm α) + +/-- Every nonempty cyclic permutation `Ω` has an injective enumeration `t : Fin n → α` of `ΩBar` +(where `n = ΩBar.ncard`) such that `List.ofFn t` is `Ω`-clockwise. -/ +theorem exists_clockwise_enumeration (hne : Ω.bar.Nonempty) : + ∃ (t : Fin Ω.bar.ncard → α), + Function.Injective t ∧ + range t = Ω.bar ∧ + Ω.IsClockwiseSeq (List.ofFn t) := by + obtain ⟨w₀, hw₀⟩ := hne + obtain ⟨L, hL_len, hL_set, _, hL_cw⟩ := + Ω.exists_isClockwiseSeq_of_subset_bar Subset.rfl hw₀ + let t : Fin Ω.bar.ncard → α := fun i => L[i.1]'(by omega) + have hofFn : List.ofFn t = L := by + apply List.ext_getElem + · simp [hL_len] + · intro i hi₁ hi₂ + simp [t] + have hinj : Function.Injective t := by + intro i j hij + ext + exact (List.Nodup.getElem_inj_iff hL_cw.1).mp hij + have hrange : range t = Ω.bar := by + refine Subset.antisymm ?_ ?_ + · rintro _ ⟨i, rfl⟩ + rw [← hL_set, mem_ofPred_eq, List.mem_iff_getElem] + exact ⟨i.1, by omega, rfl⟩ + · intro x hx + rw [← hL_set, mem_ofPred_eq, List.mem_iff_getElem] at hx + rcases hx with ⟨i, hi, rfl⟩ + exact ⟨⟨i, by omega⟩, rfl⟩ + exact ⟨t, hinj, hrange, hofFn ▸ hL_cw⟩ + +/-- The prefix set `A_j = {t_0, …, t_{j-1}}` of an enumeration `t : Fin n → α`. -/ +def prefixSet {n : ℕ} (t : Fin n → α) (j : ℕ) : Set α := + {x : α | ∃ i : Fin n, i.1 < j ∧ t i = x} + +/-- The suffix set `B_j = {t_j, …, t_{n-1}}` of an enumeration `t : Fin n → α`. -/ +def suffixSet {n : ℕ} (t : Fin n → α) (j : ℕ) : Set α := + {x : α | ∃ i : Fin n, j ≤ i.1 ∧ t i = x} + +@[simp] +theorem prefixSet_zero {n : ℕ} (t : Fin n → α) : + prefixSet t 0 = ∅ := by + ext x + simp [prefixSet] + +theorem suffixSet_zero {n : ℕ} (t : Fin n → α) : + suffixSet t 0 = range t := by + ext x + simp [suffixSet] + +theorem prefixSet_all {n : ℕ} (t : Fin n → α) : + prefixSet t n = range t := by + ext x + simp only [prefixSet, mem_ofPred_eq, mem_range] + exact ⟨fun ⟨i, _, hi⟩ => ⟨i, hi⟩, fun ⟨i, hi⟩ => ⟨i, i.2, hi⟩⟩ + +@[simp] +theorem suffixSet_all {n : ℕ} (t : Fin n → α) : + suffixSet t n = ∅ := by + ext x + simp only [suffixSet, mem_ofPred_eq, mem_empty_iff_false, iff_false, not_exists, not_and] + intro i hi + omega + +theorem prefixSet_mono {n : ℕ} (t : Fin n → α) {i j : ℕ} (hij : i ≤ j) : + prefixSet t i ⊆ prefixSet t j := by + rintro x ⟨r, hr, rfl⟩ + exact ⟨r, Nat.lt_of_lt_of_le hr hij, rfl⟩ + +theorem suffixSet_anti {n : ℕ} (t : Fin n → α) {i j : ℕ} (hij : i ≤ j) : + suffixSet t j ⊆ suffixSet t i := by + rintro x ⟨r, hr, rfl⟩ + exact ⟨r, Nat.le_trans hij hr, rfl⟩ + +theorem mem_prefixSet_succ {n : ℕ} (t : Fin n → α) (i : Fin n) : + t i ∈ prefixSet t (i.1 + 1) := + ⟨i, Nat.lt_succ_self i.1, rfl⟩ + +theorem mem_suffixSet_self {n : ℕ} (t : Fin n → α) (i : Fin n) : + t i ∈ suffixSet t i.1 := + ⟨i, le_rfl, rfl⟩ + +theorem prefixSet_union_suffixSet {n : ℕ} (t : Fin n → α) (j : ℕ) : + prefixSet t j ∪ suffixSet t j = range t := by + ext x + simp only [prefixSet, suffixSet, mem_union, mem_ofPred_eq, mem_range] + constructor + · rintro (⟨i, _, rfl⟩ | ⟨i, _, rfl⟩) <;> exact ⟨i, rfl⟩ + · rintro ⟨i, rfl⟩ + rcases lt_or_ge i.1 j with hlt | hge + · exact Or.inl ⟨i, hlt, rfl⟩ + · exact Or.inr ⟨i, hge, rfl⟩ + +theorem disjoint_prefixSet_suffixSet {n : ℕ} {t : Fin n → α} (hinj : Function.Injective t) (j : ℕ) : + Disjoint (prefixSet t j) (suffixSet t j) := by + rw [disjoint_left] + rintro x ⟨i₁, hi₁, rfl⟩ ⟨i₂, hi₂, heq⟩ + have h12 : i₁ = i₂ := hinj heq.symm + subst h12 + omega + +/-- "For $1 \le j \le n-1$, let $A_j = \{t_1, \dots, t_j\}$, $B_j = \{t_{j+1}, \dots, t_n\}$, so +that $(A_j, B_j)$ is a fence of $\Omega$." (Graph Minors IX, Section 8, page 60). -/ +theorem isFence_prefixSet_suffixSet {n : ℕ} {t : Fin n → α} + (hinj : Function.Injective t) (hrange : range t = Ω.bar) + (hcw : Ω.IsClockwiseSeq (List.ofFn t)) (j : ℕ) : + Ω.IsFence (prefixSet t j) (suffixSet t j) := by + have hunion : prefixSet t j ∪ suffixSet t j = Ω.bar := + (prefixSet_union_suffixSet t j).trans hrange + have hsubA : prefixSet t j ⊆ Ω.bar := subset_union_left.trans hunion.le + have hsubB : suffixSet t j ⊆ Ω.bar := subset_union_right.trans hunion.le + refine ⟨hsubA, hsubB, disjoint_prefixSet_suffixSet hinj j, hunion, ?_⟩ + -- Helper: if `i₁ < i₂ < k₁` and `i₁ < i₂ < k₂` with `k₁ ≠ k₂`, then `{t i₁, t i₂}` does not + -- cross `{t k₁, t k₂}`. + have hno_cross_ord : ∀ (i₁ i₂ k₁ k₂ : Fin n), + i₁.1 < i₂.1 → i₂.1 < k₁.1 → i₂.1 < k₂.1 → k₁ ≠ k₂ → + ¬ Ω.Crosses (t i₁) (t i₂) (t k₁) (t k₂) := by + intro i₁ i₂ k₁ k₂ hi12 hik1 hik2 hk12 hcr + have hlen : (List.ofFn t).length = n := List.length_ofFn + have h_k1_in : t k₁ ∈ Ω.interval (t i₂) (t i₁) := by + have h := Ω.mem_interval_of_lt hcw hi12 hik1 (by rw [hlen]; exact k₁.2) + simp only [List.getElem_ofFn] at h + exact Ω.mem_interval_rotate_left h + have h_k2_in : t k₂ ∈ Ω.interval (t i₂) (t i₁) := by + have h := Ω.mem_interval_of_lt hcw hi12 hik2 (by rw [hlen]; exact k₂.2) + simp only [List.getElem_ofFn] at h + exact Ω.mem_interval_rotate_left h + rcases Ω.crosses_iff_interval.mp hcr with ⟨h1, _⟩ | ⟨h1, _⟩ + · exact disjoint_left.mp (Ω.disjoint_interval_swap (t i₁) (t i₂)) h1 h_k1_in + · exact disjoint_left.mp (Ω.disjoint_interval_swap (t i₁) (t i₂)) h1 h_k2_in + rintro a₁ ⟨i₁, hi₁, rfl⟩ a₂ ⟨i₂, hi₂, rfl⟩ ha12 b₁ ⟨k₁, hk₁, rfl⟩ b₂ ⟨k₂, hk₂, rfl⟩ hb12 hcr + have hi_ne : i₁ ≠ i₂ := fun h => ha12 (congrArg t h) + have hk_ne : k₁ ≠ k₂ := fun h => hb12 (congrArg t h) + rcases lt_or_gt_of_ne (Fin.val_ne_of_ne hi_ne) with hlt | hgt + · exact hno_cross_ord i₁ i₂ k₁ k₂ hlt (by omega) (by omega) hk_ne hcr + · exact hno_cross_ord i₂ i₁ k₁ k₂ hgt (by omega) (by omega) hk_ne hcr.swap_left + +end CyclicPerm + +/-! ## Step 2: Disjoint `A → B` paths across a fence form a transaction -/ + +namespace Society + +variable (S : Society α β) + +/-- Any family of `m` mutually vertex-disjoint `A → B` paths in `S.G` across a fence `(A, B)` of +`S.Ω` forms a transaction of cardinality `m` in `S`. -/ +theorem isTransaction_range_of_isFromToPath {A B : Set α} (hfence : S.Ω.IsFence A B) + {m : ℕ} {Q : Fin m → Graph α β} + (hdisj : Pairwise (fun i j => Disjoint V(Q i) V(Q j))) + (hQ : ∀ i : Fin m, IsFromToPath S.G (Q i) A B) : + S.IsTransaction (range Q) ∧ (range Q).ncard = m := by + have hQ_omega : ∀ i : Fin m, ∃ a ∈ A, ∃ b ∈ B, S.IsOmegaPathWithEnds (Q i) a b := by + intro i + obtain ⟨a, b, hP, ha_inter, hb_inter⟩ := hQ i + have ha : a ∈ A := by + have : a ∈ V(Q i) ∩ A := by rw [ha_inter]; exact mem_singleton a + exact this.2 + have hb : b ∈ B := by + have : b ∈ V(Q i) ∩ B := by rw [hb_inter]; exact mem_singleton b + exact this.2 + have hab : a ≠ b := fun h => disjoint_left.mp hfence.2.2.1 ha (h ▸ hb) + exact ⟨a, ha, b, hb, hP, hab, hfence.1 ha, hfence.2.1 hb⟩ + have hinj : Function.Injective Q := by + intro i j hij + by_contra hne + obtain ⟨a, _, _, _, hPi⟩ := hQ_omega i + have ha_i : a ∈ V(Q i) := hPi.1.left_mem + have ha_j : a ∈ V(Q j) := hij ▸ ha_i + exact disjoint_left.mp (hdisj hne) ha_i ha_j + refine ⟨⟨A, B, ⟨⟨?_, ?_⟩, hfence, ?_⟩⟩, ?_⟩ + · rintro P ⟨i, rfl⟩ + obtain ⟨a, _, b, _, hPi⟩ := hQ_omega i + exact ⟨a, b, hPi⟩ + · rintro P₁ ⟨i, rfl⟩ P₂ ⟨j, rfl⟩ hne + exact hdisj (fun hij => hne (congrArg Q hij)) + · rintro P ⟨i, rfl⟩ + exact hQ_omega i + · rw [Set.ncard_range_of_injective hinj, Nat.card_fin] + +/-- If `(G, Ω)` has no transaction of cardinality `> k` and `(A, B)` is a fence of `Ω`, then +every family of `m` mutually disjoint `A → B` paths in `G` has `m ≤ k`. -/ +theorem le_of_disjoint_fromToPaths_of_isFence {k : ℕ} + (hno_trans : ∀ P_set : Set (Graph α β), S.IsTransaction P_set → P_set.ncard ≤ k) + {A B : Set α} (hfence : S.Ω.IsFence A B) + {m : ℕ} {Q : Fin m → Graph α β} + (hdisj : Pairwise (fun i j => Disjoint V(Q i) V(Q j))) + (hQ : ∀ i : Fin m, IsFromToPath S.G (Q i) A B) : + m ≤ k := by + obtain ⟨htrans, hcard⟩ := S.isTransaction_range_of_isFromToPath hfence hdisj hQ + exact hcard ▸ hno_trans (range Q) htrans + +/-! ## Step 3: Uncrossing separations and submodularity -/ + +/-- If `(Y₁, Z₁)` and `(Y₂, Z₂)` are separations of `G`, then `(Y₁ ∩ Y₂, Z₁ ∪ Z₂)` is a +separation of `G`. -/ +theorem isGraphSeparation_inter_union {G Y₁ Z₁ Y₂ Z₂ : Graph α β} + (h₁ : IsGraphSeparation G Y₁ Z₁) (h₂ : IsGraphSeparation G Y₂ Z₂) : + IsGraphSeparation G (subgraphInter G Y₁ Y₂) (subgraphUnion G Z₁ Z₂) := by + refine ⟨subgraphInter_le h₁.1, subgraphUnion_le h₁.2.1 h₂.2.1, ?_, ?_, ?_⟩ + · rw [vertexSet_subgraphInter, vertexSet_subgraphUnion] + ext v + simp only [mem_union, mem_inter_iff] + constructor + · rintro (⟨hv₁, _⟩ | hv₁ | hv₂) + · exact h₁.1.vertexSet_mono hv₁ + · exact h₁.2.1.vertexSet_mono hv₁ + · exact h₂.2.1.vertexSet_mono hv₂ + · intro hvG + rcases h₁.2.2.1.symm ▸ hvG with hv₁ | hv₁ <;> + rcases h₂.2.2.1.symm ▸ hvG with hv₂ | hv₂ + · exact Or.inl ⟨hv₁, hv₂⟩ + · exact Or.inr (Or.inr hv₂) + · exact Or.inr (Or.inl hv₁) + · exact Or.inr (Or.inl hv₁) + · rw [edgeSet_subgraphInter h₁.1 h₂.1, edgeSet_subgraphUnion h₁.2.1 h₂.2.1] + ext e + simp only [mem_union, mem_inter_iff] + constructor + · rintro (⟨he₁, _⟩ | he₁ | he₂) + · exact h₁.1.edgeSet_mono he₁ + · exact h₁.2.1.edgeSet_mono he₁ + · exact h₂.2.1.edgeSet_mono he₂ + · intro heG + rcases h₁.2.2.2.1.symm ▸ heG with he₁ | he₁ <;> + rcases h₂.2.2.2.1.symm ▸ heG with he₂ | he₂ + · exact Or.inl ⟨he₁, he₂⟩ + · exact Or.inr (Or.inr he₂) + · exact Or.inr (Or.inl he₁) + · exact Or.inr (Or.inl he₁) + · rw [edgeSet_subgraphInter h₁.1 h₂.1, edgeSet_subgraphUnion h₁.2.1 h₂.2.1, disjoint_union_right] + exact ⟨h₁.2.2.2.2.mono_left inter_subset_left, h₂.2.2.2.2.mono_left inter_subset_right⟩ + +/-- If `(Y₁, Z₁)` and `(Y₂, Z₂)` are separations of `G`, then `(Y₁ ∪ Y₂, Z₁ ∩ Z₂)` is a +separation of `G`. -/ +theorem isGraphSeparation_union_inter {G Y₁ Z₁ Y₂ Z₂ : Graph α β} + (h₁ : IsGraphSeparation G Y₁ Z₁) (h₂ : IsGraphSeparation G Y₂ Z₂) : + IsGraphSeparation G (subgraphUnion G Y₁ Y₂) (subgraphInter G Z₁ Z₂) := + IsGraphSeparation.symm (isGraphSeparation_inter_union (IsGraphSeparation.symm h₁) + (IsGraphSeparation.symm h₂)) + +/-- Submodularity of vertex separator sizes for two separations `(Y₁, Z₁)` and `(Y₂, Z₂)` of a +finite graph `G`: +`|V((Y₁ ∩ Y₂) ∩ (Z₁ ∪ Z₂))| + |V((Y₁ ∪ Y₂) ∩ (Z₁ ∩ Z₂))| ≤ |V(Y₁ ∩ Z₁)| + |V(Y₂ ∩ Z₂)|` +(Graph Minors IX, Section 8, page 61). -/ +theorem ncard_separator_inter_union_add_le {G Y₁ Z₁ Y₂ Z₂ : Graph α β} (hfin : V(G).Finite) + (h₁ : IsGraphSeparation G Y₁ Z₁) (h₂ : IsGraphSeparation G Y₂ Z₂) : + (V(subgraphInter G Y₁ Y₂) ∩ V(subgraphUnion G Z₁ Z₂)).ncard + + (V(subgraphUnion G Y₁ Y₂) ∩ V(subgraphInter G Z₁ Z₂)).ncard ≤ + (V(Y₁) ∩ V(Z₁)).ncard + (V(Y₂) ∩ V(Z₂)).ncard := by + let P := (V(Y₁) ∩ V(Y₂)) ∩ (V(Z₁) ∪ V(Z₂)) + let Q := (V(Y₁) ∪ V(Y₂)) ∩ (V(Z₁) ∩ V(Z₂)) + let S₁ := V(Y₁) ∩ V(Z₁) + let S₂ := V(Y₂) ∩ V(Z₂) + have hS₁_fin : S₁.Finite := hfin.subset (inter_subset_left.trans h₁.1.vertexSet_mono) + have hS₂_fin : S₂.Finite := hfin.subset (inter_subset_left.trans h₂.1.vertexSet_mono) + have hP_fin : P.Finite := + hfin.subset (inter_subset_left.trans (inter_subset_left.trans h₁.1.vertexSet_mono)) + have hQ_fin : Q.Finite := + hfin.subset (inter_subset_right.trans (inter_subset_left.trans h₁.2.1.vertexSet_mono)) + have hunion_sub : P ∪ Q ⊆ S₁ ∪ S₂ := by + rintro x (⟨⟨hxY₁, hxY₂⟩, hxZ₁ | hxZ₂⟩ | ⟨hxY₁ | hxY₂, hxZ₁, hxZ₂⟩) + · exact Or.inl ⟨hxY₁, hxZ₁⟩ + · exact Or.inr ⟨hxY₂, hxZ₂⟩ + · exact Or.inl ⟨hxY₁, hxZ₁⟩ + · exact Or.inr ⟨hxY₂, hxZ₂⟩ + have hinter_sub : P ∩ Q ⊆ S₁ ∩ S₂ := by + rintro x ⟨⟨⟨hxY₁, hxY₂⟩, _⟩, ⟨_, hxZ₁, hxZ₂⟩⟩ + exact ⟨⟨hxY₁, hxZ₁⟩, ⟨hxY₂, hxZ₂⟩⟩ + have hle₁ : (P ∪ Q).ncard ≤ (S₁ ∪ S₂).ncard := + Set.ncard_le_ncard hunion_sub (hS₁_fin.union hS₂_fin) + have hle₂ : (P ∩ Q).ncard ≤ (S₁ ∩ S₂).ncard := + Set.ncard_le_ncard hinter_sub (hS₁_fin.inter_of_left S₂) + have heq_PQ := Set.ncard_union_add_ncard_inter P Q hP_fin hQ_fin + have heq_S := Set.ncard_union_add_ncard_inter S₁ S₂ hS₁_fin hS₂_fin + change P.ncard + Q.ncard ≤ S₁.ncard + S₂.ncard + omega + +/-- If `Y' ≤ Y ≤ S.G` and `V(Y).ncard + E(Y).ncard ≤ V(Y').ncard + E(Y').ncard`, then `Y' = Y`. -/ +theorem eq_of_le_of_ncard_add_ge {Y' Y : Graph α β} + (hY'Y : Y' ≤ Y) (hYG : Y ≤ S.G) + (hcard : V(Y).ncard + E(Y).ncard ≤ V(Y').ncard + E(Y').ncard) : + Y' = Y := by + have hVY : V(Y).Finite := S.finite_V.subset hYG.vertexSet_mono + have hEY : E(Y).Finite := S.finite_E.subset hYG.edgeSet_mono + have hV_le : V(Y').ncard ≤ V(Y).ncard := Set.ncard_le_ncard hY'Y.vertexSet_mono hVY + have hE_le : E(Y').ncard ≤ E(Y).ncard := Set.ncard_le_ncard hY'Y.edgeSet_mono hEY + have hV_eq : V(Y') = V(Y) := + Set.eq_of_subset_of_ncard_le hY'Y.vertexSet_mono (by omega) hVY + have hE_eq : E(Y') = E(Y) := + Set.eq_of_subset_of_ncard_le hY'Y.edgeSet_mono (by omega) hEY + exact (Compatible.of_le_le (hY'Y.trans hYG) hYG).ext hV_eq hE_eq + +/-- Uncrossing step from the proof of **(8.1)** (Graph Minors IX, Section 8, page 61): +"We claim that $Y_1 \subseteq Y_2 \subseteq \dots \subseteq Y_{n-1}$ and $Z_1 \supseteq Z_2 +\supseteq \dots \supseteq Z_{n-1}$. For let $i, j$ satisfy $1 \le i \le j \le n-1$. Then +$(Y_i \cap Y_j, Z_i \cup Z_j)$ is a separation of $G$ with $A_i \subseteq V(Y_i \cap Y_j)$, +$B_i \subseteq V(Z_i \cup Z_j)$, and hence $$|V((Y_i \cap Y_j) \cap (Z_i \cup Z_j))| \ge +k_i.$$" -/ +theorem lemma_8_1_uncross {A₁ B₁ A₂ B₂ : Set α} {Y₁ Z₁ Y₂ Z₂ : Graph α β} {k₁ k₂ : ℕ} + (hA : A₁ ⊆ A₂) (hB : B₂ ⊆ B₁) + (hsep₁ : IsGraphSeparation S.G Y₁ Z₁) + (hA₁ : A₁ ⊆ V(Y₁)) (hB₁ : B₁ ⊆ V(Z₁)) + (hk₁ : (V(Y₁) ∩ V(Z₁)).ncard = k₁) + (hmin_k₁ : ∀ Y Z : Graph α β, IsGraphSeparation S.G Y Z → + A₁ ⊆ V(Y) → B₁ ⊆ V(Z) → k₁ ≤ (V(Y) ∩ V(Z)).ncard) + (hmin_Y₁ : ∀ Y Z : Graph α β, IsGraphSeparation S.G Y Z → + A₁ ⊆ V(Y) → B₁ ⊆ V(Z) → (V(Y) ∩ V(Z)).ncard = k₁ → Y ≤ Y₁ → Y = Y₁) + (hsep₂ : IsGraphSeparation S.G Y₂ Z₂) + (hA₂ : A₂ ⊆ V(Y₂)) (hB₂ : B₂ ⊆ V(Z₂)) + (hk₂ : (V(Y₂) ∩ V(Z₂)).ncard = k₂) + (hmin_k₂ : ∀ Y Z : Graph α β, IsGraphSeparation S.G Y Z → + A₂ ⊆ V(Y) → B₂ ⊆ V(Z) → k₂ ≤ (V(Y) ∩ V(Z)).ncard) : + Y₁ ≤ Y₂ ∧ Z₂ ≤ Z₁ := by + have hsep_iu := isGraphSeparation_inter_union hsep₁ hsep₂ + have hsep_ui := isGraphSeparation_union_inter hsep₁ hsep₂ + have hA₁_iu : A₁ ⊆ V(subgraphInter S.G Y₁ Y₂) := + subset_inter hA₁ (hA.trans hA₂) + have hB₁_iu : B₁ ⊆ V(subgraphUnion S.G Z₁ Z₂) := + hB₁.trans subset_union_left + have hA₂_ui : A₂ ⊆ V(subgraphUnion S.G Y₁ Y₂) := + hA₂.trans subset_union_right + have hB₂_ui : B₂ ⊆ V(subgraphInter S.G Z₁ Z₂) := + subset_inter (hB.trans hB₁) hB₂ + have hge₁ : k₁ ≤ (V(subgraphInter S.G Y₁ Y₂) ∩ V(subgraphUnion S.G Z₁ Z₂)).ncard := + hmin_k₁ _ _ hsep_iu hA₁_iu hB₁_iu + have hge₂ : k₂ ≤ (V(subgraphUnion S.G Y₁ Y₂) ∩ V(subgraphInter S.G Z₁ Z₂)).ncard := + hmin_k₂ _ _ hsep_ui hA₂_ui hB₂_ui + have hsubmod := ncard_separator_inter_union_add_le S.finite_V hsep₁ hsep₂ + rw [hk₁, hk₂] at hsubmod + have heq₁ : (V(subgraphInter S.G Y₁ Y₂) ∩ V(subgraphUnion S.G Z₁ Z₂)).ncard = k₁ := by omega + have hY_inter_eq : subgraphInter S.G Y₁ Y₂ = Y₁ := + hmin_Y₁ (subgraphInter S.G Y₁ Y₂) (subgraphUnion S.G Z₁ Z₂) hsep_iu hA₁_iu hB₁_iu heq₁ + (subgraphInter_le_left hsep₁.1 hsep₂.1) + have hY₁_le_Y₂ : Y₁ ≤ Y₂ := + hY_inter_eq ▸ subgraphInter_le_right hsep₁.1 hsep₂.1 + -- Deduce `Z₂ ≤ Z₁` as in lines 562–567 of the paper. + have hZ₂_le_Z₁ : Z₂ ≤ Z₁ := by + have h_inter_eq : V(Y₁) ∩ (V(Z₁) ∪ V(Z₂)) = V(Y₁) ∩ V(Z₁) := by + have h_sub : V(Y₁) ∩ V(Z₁) ⊆ V(Y₁) ∩ (V(Z₁) ∪ V(Z₂)) := + inter_subset_inter_right _ subset_union_left + have h_card : (V(Y₁) ∩ (V(Z₁) ∪ V(Z₂))).ncard ≤ (V(Y₁) ∩ V(Z₁)).ncard := by + have h_lhs : V(Y₁) ∩ (V(Z₁) ∪ V(Z₂)) = + V(subgraphInter S.G Y₁ Y₂) ∩ V(subgraphUnion S.G Z₁ Z₂) := by + rw [hY_inter_eq, vertexSet_subgraphUnion] + rw [h_lhs, heq₁, hk₁] + have h_fin : (V(Y₁) ∩ (V(Z₁) ∪ V(Z₂))).Finite := + S.finite_V.subset (inter_subset_left.trans hsep₁.1.vertexSet_mono) + exact (Set.eq_of_subset_of_ncard_le h_sub h_card h_fin).symm + have hV_sub : V(Z₂) ⊆ V(Z₁) := by + intro v hvZ₂ + have hvG : v ∈ V(S.G) := hsep₂.2.1.vertexSet_mono hvZ₂ + have hv_union : v ∈ V(Y₁) ∪ V(Z₁) := hsep₁.2.2.1.symm ▸ hvG + rcases hv_union with hvY₁ | hvZ₁ + · have hv_in : v ∈ V(Y₁) ∩ (V(Z₁) ∪ V(Z₂)) := ⟨hvY₁, Or.inr hvZ₂⟩ + rw [h_inter_eq] at hv_in + exact hv_in.2 + · exact hvZ₁ + have hE_sub : E(Z₂) ⊆ E(Z₁) := by + intro e heZ₂ + have heG : e ∈ E(S.G) := hsep₂.2.1.edgeSet_mono heZ₂ + have he_union : e ∈ E(Y₁) ∪ E(Z₁) := hsep₁.2.2.2.1.symm ▸ heG + rcases he_union with heY₁ | heZ₁ + · exfalso + exact disjoint_left.mp hsep₂.2.2.2.2 (hY₁_le_Y₂.edgeSet_mono heY₁) heZ₂ + · exact heZ₁ + rw [(Compatible.of_le_le hsep₂.2.1 hsep₁.2.1).le_iff] + exact ⟨hV_sub, hE_sub⟩ + exact ⟨hY₁_le_Y₂, hZ₂_le_Z₁⟩ + +/-! ## Step 4: Existence of a minimal Menger separation for `(A_j, B_j)` -/ + +/-- "Choose $k_j$ maximum so that there are $k_j$ mutually disjoint $A_j \to B_j$ paths in $G$. +Let $(Y_j, Z_j)$ be a separation of $G$ satisfying the following conditions (1) and (2). (1) +$A_j \subseteq V(Y_j)$, $B_j \subseteq V(Z_j)$, and $|V(Y_j \cap Z_j)| = k_j$. (This is +possible by Menger's theorem.) ... (2) *Subject to (1), $Y_j$ is minimal." (Graph Minors IX, Section +8, pages 60–61). -/ +theorem exists_minimal_menger_separation {A B : Set α} {k : ℕ} + (hA : A ⊆ V(S.G)) (hB : B ⊆ V(S.G)) + (hmax_paths : ∀ (m : ℕ) (Q : Fin m → Graph α β), + Pairwise (fun i j => Disjoint V(Q i) V(Q j)) → + (∀ i : Fin m, IsFromToPath S.G (Q i) A B) → m ≤ k) : + ∃ (k₀ : ℕ) (Y Z : Graph α β), + k₀ ≤ k ∧ + IsGraphSeparation S.G Y Z ∧ + A ⊆ V(Y) ∧ B ⊆ V(Z) ∧ + (V(Y) ∩ V(Z)).ncard = k₀ ∧ + (∀ Y' Z' : Graph α β, IsGraphSeparation S.G Y' Z' → + A ⊆ V(Y') → B ⊆ V(Z') → k₀ ≤ (V(Y') ∩ V(Z')).ncard) ∧ + (∀ Y' Z' : Graph α β, IsGraphSeparation S.G Y' Z' → + A ⊆ V(Y') → B ⊆ V(Z') → (V(Y') ∩ V(Z')).ncard = k₀ → Y' ≤ Y → Y' = Y) := by + classical + have : Finite V(S.G) := S.finite_V.to_subtype + -- First, by Menger's theorem with `k + 1`, there exists an `(A, B)`-separation of order `≤ k`. + have hex_sep : ∃ m : ℕ, ∃ Y Z : Graph α β, + IsGraphSeparation S.G Y Z ∧ A ⊆ V(Y) ∧ B ⊆ V(Z) ∧ (V(Y) ∩ V(Z)).ncard = m ∧ m ≤ k := by + rcases exists_fromToPaths_or_graphSeparation hA hB (k + 1) with ⟨Q, hdisj, hQ⟩ | ⟨Y, Z, hsep, + _, hAY, hBZ, hlt⟩ + · have hle := hmax_paths (k + 1) Q hdisj hQ + omega + · exact ⟨(V(Y) ∩ V(Z)).ncard, Y, Z, hsep, hAY, hBZ, rfl, by omega⟩ + have hex_k₀ : ∃ m : ℕ, ∃ Y Z : Graph α β, + IsGraphSeparation S.G Y Z ∧ A ⊆ V(Y) ∧ B ⊆ V(Z) ∧ (V(Y) ∩ V(Z)).ncard = m := by + obtain ⟨m, Y, Z, hsep, hAY, hBZ, hcard, _⟩ := hex_sep + exact ⟨m, Y, Z, hsep, hAY, hBZ, hcard⟩ + let k₀ := Nat.find hex_k₀ + have hk₀_spec := Nat.find_spec hex_k₀ + have hk₀_le : k₀ ≤ k := by + obtain ⟨m, Y, Z, hsep, hAY, hBZ, hcard, hm_le⟩ := hex_sep + exact (Nat.find_min' hex_k₀ ⟨Y, Z, hsep, hAY, hBZ, hcard⟩).trans hm_le + have hk₀_min : ∀ Y' Z' : Graph α β, IsGraphSeparation S.G Y' Z' → + A ⊆ V(Y') → B ⊆ V(Z') → k₀ ≤ (V(Y') ∩ V(Z')).ncard := by + intro Y' Z' hsep' hAY' hBZ' + exact Nat.find_min' hex_k₀ ⟨Y', Z', hsep', hAY', hBZ', rfl⟩ + -- Next, among all separations of order `k₀`, choose one minimizing `V(Y).ncard + E(Y).ncard`. + have hex_size : ∃ s : ℕ, ∃ Y Z : Graph α β, + IsGraphSeparation S.G Y Z ∧ A ⊆ V(Y) ∧ B ⊆ V(Z) ∧ + (V(Y) ∩ V(Z)).ncard = k₀ ∧ V(Y).ncard + E(Y).ncard = s := by + obtain ⟨Y, Z, hsep, hAY, hBZ, hcard⟩ := hk₀_spec + exact ⟨V(Y).ncard + E(Y).ncard, Y, Z, hsep, hAY, hBZ, hcard, rfl⟩ + let s₀ := Nat.find hex_size + obtain ⟨Y, Z, hsep, hAY, hBZ, hcard, hs₀⟩ := Nat.find_spec hex_size + refine ⟨k₀, Y, Z, hk₀_le, hsep, hAY, hBZ, hcard, hk₀_min, ?_⟩ + intro Y' Z' hsep' hAY' hBZ' hcard' hY'Y + have hs_ge : s₀ ≤ V(Y').ncard + E(Y').ncard := + Nat.find_min' hex_size ⟨Y', Z', hsep', hAY', hBZ', hcard', rfl⟩ + exact S.eq_of_le_of_ncard_add_ge hY'Y hsep.1 (hs₀ ▸ hs_ge) + +/-! ## Step 5: Constructing the linear decomposition from a nested chain of separations -/ + +/-- "Let $Y_n = Z_0 = G$, and let $Y_0$ and $Z_n$ be the null graph. For $1 \le i \le n$, let +$X_i = Y_i \cap Z_{i-1}$. We claim that $(X_i: 1 \le i \le n)$ is a linear decomposition of +$(G, \Omega)$." +(Graph Minors IX, Section 8, pages 61–62). -/ +theorem isLinearDecomposition_of_nested_separations {n k : ℕ} + {t : Fin n → α} + (hinj : Function.Injective t) + (hrange : range t = S.Ω.bar) + (hcw : S.Ω.IsClockwiseSeq (List.ofFn t)) + {Y Z : ℕ → Graph α β} + (hY0 : Y 0 = ⊥) + (hYn : Y n = S.G) + (hsep : ∀ j ≤ n, IsGraphSeparation S.G (Y j) (Z j)) + (hY_mono : ∀ i j, i ≤ j → j ≤ n → Y i ≤ Y j) + (hZ_anti : ∀ i j, i ≤ j → j ≤ n → Z j ≤ Z i) + (hpref : ∀ j ≤ n, CyclicPerm.prefixSet t j ⊆ V(Y j)) + (hsuff : ∀ j ≤ n, CyclicPerm.suffixSet t j ⊆ V(Z j)) + (hdepth : ∀ j, 1 ≤ j → j < n → (V(Y j) ∩ V(Z j)).ncard ≤ k) : + let X : Fin n → Graph α β := fun i => subgraphInter S.G (Y (i.1 + 1)) (Z i.1) + S.IsLinearDecomposition t X ∧ + ∀ i i' : Fin n, i < i' → (V(X i) ∩ V(X i')).ncard ≤ k := by + intro X + have hX_le_G : ∀ i : Fin n, X i ≤ S.G := fun i => + subgraphInter_le (hsep (i.1 + 1) (by omega)).1 + have hX_le_Y : ∀ i : Fin n, X i ≤ Y (i.1 + 1) := fun i => + subgraphInter_le_left (hsep (i.1 + 1) (by omega)).1 (hsep i.1 (by omega)).2.1 + have hX_le_Z : ∀ i : Fin n, X i ≤ Z i.1 := fun i => + subgraphInter_le_right (hsep (i.1 + 1) (by omega)).1 (hsep i.1 (by omega)).2.1 + -- Condition (i): `⋃_{i} X_i = S.G`. + have hV_cover : ∀ m ≤ n, ∀ v ∈ V(Y m), ∃ i : Fin n, i.1 < m ∧ v ∈ V(X i) := by + intro m + induction m with + | zero => + intro _ v hv + rw [hY0] at hv + exact hv.elim + | succ m ih => + intro hm v hv + by_cases hv_m : v ∈ V(Y m) + · obtain ⟨i, hi, hvX⟩ := ih (by omega) v hv_m + exact ⟨i, by omega, hvX⟩ + · have hvG : v ∈ V(S.G) := (hsep (m + 1) hm).1.vertexSet_mono hv + have hv_union : v ∈ V(Y m) ∪ V(Z m) := (hsep m (by omega)).2.2.1.symm ▸ hvG + have hvZm : v ∈ V(Z m) := hv_union.resolve_left hv_m + exact ⟨⟨m, hm⟩, Nat.lt_succ_self m, hv, hvZm⟩ + have hE_cover : ∀ m ≤ n, ∀ e ∈ E(Y m), ∃ i : Fin n, i.1 < m ∧ e ∈ E(X i) := by + intro m + induction m with + | zero => + intro _ e he + rw [hY0] at he + exact he.elim + | succ m ih => + intro hm e he + by_cases he_m : e ∈ E(Y m) + · obtain ⟨i, hi, heX⟩ := ih (by omega) e he_m + exact ⟨i, by omega, heX⟩ + · have heG : e ∈ E(S.G) := (hsep (m + 1) hm).1.edgeSet_mono he + have he_union : e ∈ E(Y m) ∪ E(Z m) := (hsep m (by omega)).2.2.2.1.symm ▸ heG + have heZm : e ∈ E(Z m) := he_union.resolve_left he_m + refine ⟨⟨m, hm⟩, Nat.lt_succ_self m, ?_⟩ + change e ∈ E(subgraphInter S.G (Y (m + 1)) (Z m)) + rw [edgeSet_subgraphInter (hsep (m + 1) hm).1 (hsep m (by omega)).2.1] + exact ⟨he, heZm⟩ + have hunion_eq : subgraphSUnion S.G (range X) = S.G := by + have hsub_le : subgraphSUnion S.G (range X) ≤ S.G := + subgraphSUnion_le (by rintro _ ⟨i, rfl⟩; exact hX_le_G i) + refine (Compatible.of_le_le hsub_le le_rfl).ext ?_ ?_ + · apply Subset.antisymm hsub_le.vertexSet_mono + intro v hvG + rw [← hYn] at hvG + obtain ⟨i, _, hvXi⟩ := hV_cover n le_rfl v hvG + rw [vertexSet_subgraphSUnion] + exact mem_iUnion₂.mpr ⟨X i, ⟨i, rfl⟩, hvXi⟩ + · apply Subset.antisymm hsub_le.edgeSet_mono + intro e heG + rw [← hYn] at heG + obtain ⟨i, _, heXi⟩ := hE_cover n le_rfl e heG + rw [edgeSet_subgraphSUnion (by rintro _ ⟨j, rfl⟩; exact hX_le_G j)] + exact mem_iUnion₂.mpr ⟨X i, ⟨i, rfl⟩, heXi⟩ + -- Condition (ii): For `i < i'`, `Disjoint E(X i) E(X i')`. + have hedge_disj : ∀ i i' : Fin n, i < i' → Disjoint E(X i) E(X i') := by + intro i i' hii' + have h1 : E(X i) ⊆ E(Y (i.1 + 1)) := (hX_le_Y i).edgeSet_mono + have h2 : E(X i') ⊆ E(Z (i.1 + 1)) := + (hX_le_Z i').edgeSet_mono.trans + (hZ_anti (i.1 + 1) i'.1 (by omega) (by omega)).edgeSet_mono + exact (hsep (i.1 + 1) (by omega)).2.2.2.2.mono h1 h2 + -- Condition (iii): For `i : Fin n`, `t i ∈ V(X i)`. + have hmem_V : ∀ i : Fin n, t i ∈ V(X i) := fun i => + ⟨hpref (i.1 + 1) (by omega) (CyclicPerm.mem_prefixSet_succ t i), + hsuff i.1 (by omega) (CyclicPerm.mem_suffixSet_self t i)⟩ + -- Condition (iv): For `i ≤ i' ≤ i''`, `subgraphInter S.G (X i) (X i'') ≤ X i'`. + have hinter_le : ∀ i i' i'' : Fin n, i ≤ i' → i' ≤ i'' → + subgraphInter S.G (X i) (X i'') ≤ X i' := by + intro i i' i'' hii' hi'i'' + have hle₁ : subgraphInter S.G (X i) (X i'') ≤ Y (i'.1 + 1) := + (subgraphInter_le_left (hX_le_G i) (hX_le_G i'')).trans + ((hX_le_Y i).trans (hY_mono (i.1 + 1) (i'.1 + 1) (by omega) (by omega))) + have hle₂ : subgraphInter S.G (X i) (X i'') ≤ Z i'.1 := + (subgraphInter_le_right (hX_le_G i) (hX_le_G i'')).trans + ((hX_le_Z i'').trans (hZ_anti i'.1 i''.1 (by omega) (by omega))) + exact le_subgraphInter (hsep (i'.1 + 1) (by omega)).1 (hsep i'.1 (by omega)).2.1 hle₁ hle₂ + -- Depth bound: For `i < i'`, `(V(X i) ∩ V(X i')).ncard ≤ k`. + have hdepth_le : ∀ i i' : Fin n, i < i' → (V(X i) ∩ V(X i')).ncard ≤ k := by + intro i i' hii' + have hsub : V(X i) ∩ V(X i') ⊆ V(Y (i.1 + 1)) ∩ V(Z (i.1 + 1)) := + inter_subset_inter (hX_le_Y i).vertexSet_mono + ((hX_le_Z i').vertexSet_mono.trans + (hZ_anti (i.1 + 1) i'.1 (by omega) (by omega)).vertexSet_mono) + have hfin : (V(Y (i.1 + 1)) ∩ V(Z (i.1 + 1))).Finite := + S.finite_V.subset (inter_subset_left.trans (hsep (i.1 + 1) (by omega)).1.vertexSet_mono) + exact (Set.ncard_le_ncard hsub hfin).trans + (hdepth (i.1 + 1) (by omega) (by omega)) + exact ⟨⟨hinj, hrange, hcw, hX_le_G, hunion_eq, hedge_disj, hmem_V, hinter_le⟩, hdepth_le⟩ + +/-! ## Main Theorem: Graph Minors IX, (8.1) -/ + +/-- **Graph Minors IX, (8.1)** (page 60): +"Every society with no transaction of cardinality $>k$ has a linear decomposition of depth +$\le k$." + +*Note on the hypothesis `hne : S.Ω.bar.Nonempty ∨ S.G = ⊥`:* +In a linear decomposition `({t₁, …, t_n}, (X_i : 1 ≤ i ≤ n))` of `(G, Ω)`, `{t₁, …, t_n} = ΩBar` and +`(i) ⋃ (X_i : 1 ≤ i ≤ n) = G`. When `ΩBar = ∅`, we must have `n = 0`, so the union `(i)` is the null +graph `⊥`, which equals `G` if and only if `G = ⊥`. When `ΩBar ≠ ∅`, `n = |ΩBar| ≥ 1` and the proof +in +the paper constructs a linear decomposition `(X_i : 1 ≤ i ≤ n)` of depth `≤ k` for any society +`(G, Ω)` with no transaction of cardinality `> k`. -/ +theorem theorem_8_1_proof (S : Society α β) (hne : S.Ω.bar.Nonempty ∨ S.G = ⊥) (k : ℕ) + (hno_trans : ∀ P_set : Set (Graph α β), S.IsTransaction P_set → P_set.ncard ≤ k) : + S.HasLinearDecompositionOfDepthLE k := by + classical + by_cases hbar_ne : S.Ω.bar.Nonempty + · obtain ⟨t, hinj, hrange, hcw⟩ := S.Ω.exists_clockwise_enumeration hbar_ne + let n := S.Ω.bar.ncard + have hn : 1 ≤ n := Set.ncard_pos S.Ω.finite_bar |>.mpr hbar_ne + let A (j : ℕ) : Set α := CyclicPerm.prefixSet t j + let B (j : ℕ) : Set α := CyclicPerm.suffixSet t j + have hfence : ∀ j : ℕ, S.Ω.IsFence (A j) (B j) := + fun j => S.Ω.isFence_prefixSet_suffixSet hinj hrange hcw j + have hA_sub_G : ∀ j : ℕ, A j ⊆ V(S.G) := + fun j => (hfence j).1.trans S.bar_subset + have hB_sub_G : ∀ j : ℕ, B j ⊆ V(S.G) := + fun j => (hfence j).2.1.trans S.bar_subset + have hmenger : ∀ j : ℕ, + ∃ (k₀ : ℕ) (Y Z : Graph α β), + k₀ ≤ k ∧ + IsGraphSeparation S.G Y Z ∧ + A j ⊆ V(Y) ∧ B j ⊆ V(Z) ∧ + (V(Y) ∩ V(Z)).ncard = k₀ ∧ + (∀ Y' Z' : Graph α β, IsGraphSeparation S.G Y' Z' → + A j ⊆ V(Y') → B j ⊆ V(Z') → k₀ ≤ (V(Y') ∩ V(Z')).ncard) ∧ + (∀ Y' Z' : Graph α β, IsGraphSeparation S.G Y' Z' → + A j ⊆ V(Y') → B j ⊆ V(Z') → (V(Y') ∩ V(Z')).ncard = k₀ → Y' ≤ Y → Y' = Y) := by + intro j + exact S.exists_minimal_menger_separation (hA_sub_G j) (hB_sub_G j) + (fun m Q hdisj hQ => S.le_of_disjoint_fromToPaths_of_isFence hno_trans (hfence j) hdisj hQ) + choose k_sep Y_raw Z_raw hk_le hsep_raw hA_raw hB_raw hcard_raw hmin_k_raw hmin_Y_raw + using hmenger + let Y (j : ℕ) : Graph α β := + if j = 0 then ⊥ else if j < n then Y_raw j else S.G + let Z (j : ℕ) : Graph α β := + if j = 0 then S.G else if j < n then Z_raw j else ⊥ + have hY0 : Y 0 = ⊥ := by simp [Y] + have hZ0 : Z 0 = S.G := by simp [Z] + have hYn : Y n = S.G := by + have hn_ne : n ≠ 0 := by omega + simp [Y, hn_ne] + have hZn : Z n = ⊥ := by + have hn_ne : n ≠ 0 := by omega + simp [Z, hn_ne] + have hY_mid : ∀ j, 1 ≤ j → j < n → Y j = Y_raw j := by + intro j hj1 hjn + have hj_ne : j ≠ 0 := by omega + simp [Y, hj_ne, hjn] + have hZ_mid : ∀ j, 1 ≤ j → j < n → Z j = Z_raw j := by + intro j hj1 hjn + have hj_ne : j ≠ 0 := by omega + simp [Z, hj_ne, hjn] + have hsep_bot_G : IsGraphSeparation S.G ⊥ S.G := + ⟨bot_le, le_rfl, by simp, by simp, by simp⟩ + have hsep : ∀ j ≤ n, IsGraphSeparation S.G (Y j) (Z j) := by + intro j hjn + rcases eq_or_lt_of_le (Nat.zero_le j) with rfl | hj_pos + · rw [hY0, hZ0]; exact hsep_bot_G + · rcases lt_or_eq_of_le hjn with hlt | rfl + · rw [hY_mid j hj_pos hlt, hZ_mid j hj_pos hlt] + exact hsep_raw j + · rw [hYn, hZn]; exact IsGraphSeparation.symm hsep_bot_G + have hnest_mid : ∀ i j, 1 ≤ i → i ≤ j → j < n → + Y_raw i ≤ Y_raw j ∧ Z_raw j ≤ Z_raw i := by + intro i j _ hij _ + exact S.lemma_8_1_uncross + (CyclicPerm.prefixSet_mono t hij) + (CyclicPerm.suffixSet_anti t hij) + (hsep_raw i) (hA_raw i) (hB_raw i) (hcard_raw i) (hmin_k_raw i) (hmin_Y_raw i) + (hsep_raw j) (hA_raw j) (hB_raw j) (hcard_raw j) (hmin_k_raw j) + have hY_mono : ∀ i j, i ≤ j → j ≤ n → Y i ≤ Y j := by + intro i j hij hjn + rcases eq_or_lt_of_le (Nat.zero_le i) with rfl | hi_pos + · rw [hY0]; exact bot_le + · rcases lt_or_eq_of_le hjn with hlt_j | rfl + · rw [hY_mid i hi_pos (by omega), hY_mid j (by omega) hlt_j] + exact (hnest_mid i j hi_pos hij hlt_j).1 + · rw [hYn] + exact (hsep i hij).1 + have hZ_anti : ∀ i j, i ≤ j → j ≤ n → Z j ≤ Z i := by + intro i j hij hjn + rcases eq_or_lt_of_le (Nat.zero_le i) with rfl | hi_pos + · rw [hZ0] + exact (hsep j hjn).2.1 + · rcases lt_or_eq_of_le hjn with hlt_j | rfl + · rw [hZ_mid i hi_pos (by omega), hZ_mid j (by omega) hlt_j] + exact (hnest_mid i j hi_pos hij hlt_j).2 + · rw [hZn]; exact bot_le + have hpref : ∀ j ≤ n, CyclicPerm.prefixSet t j ⊆ V(Y j) := by + intro j hjn + rcases eq_or_lt_of_le (Nat.zero_le j) with rfl | hj_pos + · simp + · rcases lt_or_eq_of_le hjn with hlt | rfl + · rw [hY_mid j hj_pos hlt]; exact hA_raw j + · rw [hYn]; exact hA_sub_G n + have hsuff : ∀ j ≤ n, CyclicPerm.suffixSet t j ⊆ V(Z j) := by + intro j hjn + rcases eq_or_lt_of_le (Nat.zero_le j) with rfl | hj_pos + · rw [hZ0]; exact hB_sub_G 0 + · rcases lt_or_eq_of_le hjn with hlt | rfl + · rw [hZ_mid j hj_pos hlt]; exact hB_raw j + · rw [CyclicPerm.suffixSet_all]; exact empty_subset _ + have hdepth : ∀ j, 1 ≤ j → j < n → (V(Y j) ∩ V(Z j)).ncard ≤ k := by + intro j hj1 hjn + rw [hY_mid j hj1 hjn, hZ_mid j hj1 hjn, hcard_raw j] + exact hk_le j + exact ⟨n, t, fun i => subgraphInter S.G (Y (i.1 + 1)) (Z i.1), + S.isLinearDecomposition_of_nested_separations hinj hrange hcw + hY0 hYn hsep hY_mono hZ_anti hpref hsuff hdepth⟩ + · -- Degenerate case: `S.Ω.bar = ∅` and `S.G = ⊥`. + have hbar_empty : S.Ω.bar = ∅ := Set.not_nonempty_iff_eq_empty.mp hbar_ne + have hG_bot : S.G = ⊥ := hne.resolve_left hbar_ne + refine ⟨0, Fin.elim0, Fin.elim0, ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩, ?_⟩ + · exact fun i => i.elim0 + · simp [hbar_empty] + · exact ⟨List.nodup_nil, fun v hv => by simp at hv, fun i hi => by simp at hi⟩ + · exact fun i => i.elim0 + · rw [hG_bot] + exact le_bot_iff.mp (subgraphSUnion_le (by rintro _ ⟨i, _⟩; exact i.elim0)) + · exact fun i => i.elim0 + · exact fun i => i.elim0 + · exact fun i => i.elim0 + · exact fun i => i.elim0 + +end Society + +export Society (theorem_8_1_proof) + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM09/Section9.lean b/LeanPool/GraphMinor/GM09/Section9.lean new file mode 100644 index 0000000000..5c8e350085 --- /dev/null +++ b/LeanPool/GraphMinor/GM09/Section9.lean @@ -0,0 +1,4210 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM09.Basic +public import LeanPool.GraphMinor.Surface.Crossing +import LeanPool.GraphMinor.GM09.DiscDrawing +import LeanPool.GraphMinor.GM09.Section2d +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section3b +import LeanPool.GraphMinor.GM09.Section3c +import LeanPool.GraphMinor.GM09.Section5a +public import LeanPool.GraphMinor.GM09.Restriction +import LeanPool.GraphMinor.GM09.Section11b +import LeanPool.GraphMinor.GM06.Section3Dual + +/-! +# Graph Minors IX, Section 9: Removing a Rural Neighborhood + +This file formalizes Section 9 (pages 62–63) of N. Robertson and P. D. Seymour, +*Graph Minors. IX. Disjoint crossed paths*, J. Combin. Theory Ser. B **49** (1990) 40–77. +-/ + +@[expose] public section + +namespace GraphMinor.GM09 + +open Set Function Topology Metric Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 + +universe u v w + +variable {α : Type u} {β : Type v} + +/-! ## Topological and Disc-Crossing Lemmas for Rural Presentations -/ + +theorem inter_subBd_subset_subBd {S : Type w} [TopologicalSpace S] {D Δ : Set S} + (hDΔ : D ⊆ Δ) : D ∩ subBd Δ ⊆ subBd D := + fun _ ⟨hxD, _, hx_compl⟩ => + ⟨subset_closure hxD, closure_mono (sdiff_subset_sdiff_right hDΔ) hx_compl⟩ + +theorem subBd_eq_diff_interior_of_isClosed {S : Type w} [TopologicalSpace S] {D : Set S} + (hD : IsClosed D) : subBd D = D \ interior D := by + ext x + simp only [subBd, mem_inter_iff, mem_sdiff, hD.closure_eq] + rw [← compl_eq_univ_sdiff, closure_compl, mem_compl_iff] + +/-- For any closed disc `Δ` in `EuclideanPlane`, its manifold boundary `discBd Δ` equals its +topological boundary `subBd Δ`. -/ +theorem discBd_eq_subBd {Δ : Set EuclideanPlane} (hΔ : IsClosedDisc Δ) : + discBd Δ = subBd Δ := + (subBd_eq_discBd_plane hΔ).symm + +theorem inter_subBd_nonempty_of_isConnected {S : Type w} [TopologicalSpace S] {K D : Set S} + (hK : IsConnected K) (hKD : (K ∩ D).Nonempty) (hKc : (K ∩ Dᶜ).Nonempty) : + (K ∩ subBd D).Nonempty := by + by_contra h_empty + rw [not_nonempty_iff_eq_empty] at h_empty + have hK_sub : K ⊆ interior D ∪ (closure D)ᶜ := by + intro x hxK + by_cases hx_cl : x ∈ closure D + · by_cases hx_int : x ∈ interior D + · exact Or.inl hx_int + · exfalso + have hx_bd : x ∈ subBd D := by + refine ⟨hx_cl, ?_⟩ + rw [← compl_eq_univ_sdiff, closure_compl] + exact hx_int + have : x ∈ K ∩ subBd D := ⟨hxK, hx_bd⟩ + rw [h_empty] at this + exact this + · exact Or.inr hx_cl + have hKD_int : (K ∩ interior D).Nonempty := by + obtain ⟨x, hxK, hxD⟩ := hKD + rcases hK_sub hxK with hx_int | hx_ncl + · exact ⟨x, hxK, hx_int⟩ + · exact (hx_ncl (subset_closure hxD)).elim + have hKc_ext : (K ∩ (closure D)ᶜ).Nonempty := by + obtain ⟨x, hxK, hxc⟩ := hKc + rcases hK_sub hxK with hx_int | hx_ncl + · exact (hxc (interior_subset hx_int)).elim + · exact ⟨x, hxK, hx_ncl⟩ + obtain ⟨x, _, hx_int, hx_ncl⟩ := + hK.2 (interior D) (closure D)ᶜ isOpen_interior isClosed_closure.isOpen_compl + hK_sub hKD_int hKc_ext + exact hx_ncl (subset_closure (interior_subset hx_int)) + +theorem closure_edge_diff_V_eq {S : Type w} [TopologicalSpace S] + (G : Drawing S) {e : Set S} (he : e ∈ G.E) : + closure e \ G.V = e := by + rcases G.toGraph.exists_isLink_of_mem_edgeSet he with ⟨u, v, hlink⟩ + by_cases hne : u ≠ v + · have hcl := closure_edge_eq_union_ends G hlink hne + have hcap : closure e ∩ G.V = {u, v} := hlink.2.2.2 + ext x + simp only [mem_sdiff] + constructor + · rintro ⟨hx_cl, hx_nV⟩ + rw [hcl] at hx_cl + rcases hx_cl with hxe | hxe_uv + · exact hxe + · exfalso + have : x ∈ closure e ∩ G.V := by rw [hcap]; exact hxe_uv + exact hx_nV this.2 + · intro hxe + exact ⟨subset_closure hxe, fun hxV => (he.2.1 hxe).2 hxV⟩ + · push Not at hne + subst hne + rcases G.edge_cond e he with ⟨u', v', huv', hcap', _⟩ | ⟨u', hcap', ⟨f⟩⟩ + · exfalso + have hpair : ({u', v'} : Set S) = {u, u} := hcap'.symm.trans hlink.2.2.2 + rw [pair_eq_singleton] at hpair + have hu' : u' = u := by + have : u' ∈ ({u', v'} : Set S) := mem_insert u' {v'} + rwa [hpair, mem_singleton_iff] at this + have hv' : v' = u := by + have : v' ∈ ({u', v'} : Set S) := mem_insert_of_mem u' rfl + rwa [hpair, mem_singleton_iff] at this + exact huv' (hu'.trans hv'.symm) + · have hu'_cl : u' ∈ closure e := by + have : u' ∈ closure e ∩ G.V := by rw [hcap']; exact mem_singleton u' + exact this.1 + let v₀ : Circle := f.symm ⟨u', hu'_cl⟩ + have hfv₀ : (f v₀).1 = u' := congrArg Subtype.val (f.apply_symm_apply ⟨u', hu'_cl⟩) + obtain ⟨g⟩ := nonempty_homeomorph_Ioo_nextSegment (finite_singleton v₀) (mem_singleton v₀) + have hconv : Convex ℝ (Ioo (0 : ℝ) 1) := convex_Ioo 0 1 + have hpc_ioo : IsPathConnected (Ioo (0 : ℝ) 1) := + hconv.isPathConnected ⟨1 / 2, by constructor <;> linarith⟩ + let psi : Ioo (0 : ℝ) 1 → S := fun t => (f (g t).1).1 + have hpsi_cont : Continuous psi := + continuous_subtype_val.comp (f.continuous.comp (continuous_subtype_val.comp g.continuous)) + have himg_eq : range psi = closure e \ G.V := by + ext z + simp only [mem_range, mem_sdiff, psi] + constructor + · rintro ⟨t, rfl⟩ + refine ⟨(f (g t).1).2, fun hzV => ?_⟩ + have hz_in : (f (g t).1).1 ∈ closure e ∩ G.V := ⟨(f (g t).1).2, hzV⟩ + rw [hcap', mem_singleton_iff] at hz_in + have heq : (g t).1 = v₀ := + f.injective (Subtype.ext (hz_in.trans hfv₀.symm)) + exact (g t).2.1 heq + · rintro ⟨hz_cl, hz_nV⟩ + let w : Circle := f.symm ⟨z, hz_cl⟩ + have hfw : (f w).1 = z := congrArg Subtype.val (f.apply_symm_apply ⟨z, hz_cl⟩) + have hw_seg : w ∈ nextSegment {v₀} v₀ := by + refine ⟨fun hwv₀ => ?_, fun y hy => by simp at hy⟩ + have hzu' : z = u' := by rw [← hfw, hwv₀, hfv₀] + have hu'V : u' ∈ G.V := by + have : u' ∈ closure e ∩ G.V := by rw [hcap']; exact mem_singleton u' + exact this.2 + exact hz_nV (hzu' ▸ hu'V) + refine ⟨g.symm ⟨w, hw_seg⟩, ?_⟩ + have hg : (g (g.symm ⟨w, hw_seg⟩)).1 = w := + congrArg Subtype.val (g.apply_symm_apply ⟨w, hw_seg⟩) + rw [hg, hfw] + have hpc_diff : IsPathConnected (closure e \ G.V) := by + have : PathConnectedSpace (Ioo (0 : ℝ) 1) := + isPathConnected_iff_pathConnectedSpace.mp hpc_ioo + rw [← himg_eq, ← image_univ] + exact isPathConnected_univ.image hpsi_cont + have hsub_diff : closure e \ G.V ⊆ G.U \ G.V := by + have hclU : closure e ⊆ G.U := G.isClosed_U.closure_subset_iff.mpr + (he.2.1.trans sdiff_subset) + exact sdiff_subset_sdiff_left hclU + have he_sub_diff : e ⊆ closure e \ G.V := + subset_sdiff.mpr ⟨subset_closure, disjoint_left.mpr fun _ hxe hxV => (he.2.1 hxe).2 hxV⟩ + exact he.2.2.2 (closure e \ G.V) hsub_diff hpc_diff he_sub_diff + +/-- If the closure of the drawing of an edge `e` with link `G.IsLink e u w` meets +`graphDrawingSubgraphU Γ H` (`H ≤ G`), then at least one endpoint `u` or `w` lies in `V(H)`. -/ +theorem mem_vertexSet_or_of_closure_edge_inter_subgraphU_nonempty {S : Type w} + [TopologicalSpace S] {G H : Graph α β} (Γ : GraphDrawing G S) (hHG : H ≤ G) + {e : β} {u w : α} (hl : G.IsLink e u w) + (hne : (closure (graphDrawingEdgeSet Γ e) ∩ graphDrawingSubgraphU Γ H).Nonempty) : + u ∈ V(H) ∨ w ∈ V(H) := by + obtain ⟨x, hx_cl, hx_H⟩ := hne + have heG : e ∈ E(G) := hl.edge_mem + have huG : u ∈ V(G) := hl.left_mem + have hwG : w ∈ V(G) := hl.right_mem + have hlink_to := (Γ.iso.isLink_iff ⟨e, heG⟩ ⟨u, huG⟩ ⟨w, hwG⟩).mp hl + by_cases hxV : x ∈ Γ.drawing.V + · have hx_inter : x ∈ closure (Γ.iso.edgeEquiv ⟨e, heG⟩).1 ∩ Γ.drawing.V := by + rw [← graphDrawingEdgeSet_eq Γ heG] + exact ⟨hx_cl, hxV⟩ + rw [hlink_to.2.2.2] at hx_inter + rcases hx_inter with hxu | hxw + · left + refine mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU Γ hHG huG ?_ + rw [graphDrawingVertexSet_eq_singleton Γ huG, ← hxu, singleton_subset_iff] + exact hx_H + · right + rw [mem_singleton_iff] at hxw + refine mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU Γ hHG hwG ?_ + rw [graphDrawingVertexSet_eq_singleton Γ hwG, ← hxw, singleton_subset_iff] + exact hx_H + · have hxe : x ∈ (Γ.iso.edgeEquiv ⟨e, heG⟩).1 := by + rw [graphDrawingEdgeSet_eq Γ heG] at hx_cl + rw [← closure_edge_diff_V_eq Γ.drawing (Γ.iso.edgeEquiv ⟨e, heG⟩).2] + exact ⟨hx_cl, hxV⟩ + rcases hx_H with hx_vert | hx_edge + · obtain ⟨v, hvH, hxv⟩ := mem_iUnion₂.mp hx_vert + have hvG : v ∈ V(G) := hHG.vertexSet_mono hvH + rw [graphDrawingVertexSet_eq_singleton Γ hvG, mem_singleton_iff] at hxv + exact (hxV (hxv ▸ (Γ.iso.vertexEquiv ⟨v, hvG⟩).2)).elim + · obtain ⟨f, hfH, hxf⟩ := mem_iUnion₂.mp hx_edge + have hfG : f ∈ E(G) := hHG.edgeSet_mono hfH + have hxf' : x ∈ (Γ.iso.edgeEquiv ⟨f, hfG⟩).1 := by + rw [graphDrawingEdgeSet_eq Γ hfG] at hxf + rw [← closure_edge_diff_V_eq Γ.drawing (Γ.iso.edgeEquiv ⟨f, hfG⟩).2] + exact ⟨hxf, hxV⟩ + have heq_set : (Γ.iso.edgeEquiv ⟨e, heG⟩).1 = (Γ.iso.edgeEquiv ⟨f, hfG⟩).1 := by + by_contra hne_set + exact disjoint_left.mp + (disjoint_edges_of_ne Γ.drawing (Γ.iso.edgeEquiv ⟨e, heG⟩).2 + (Γ.iso.edgeEquiv ⟨f, hfG⟩).2 hne_set) hxe hxf' + have hef : e = f := + congrArg Subtype.val (Γ.iso.edgeEquiv.injective (Subtype.ext heq_set)) + have heH : e ∈ E(H) := hef ▸ hfH + obtain ⟨a, b, habH⟩ := H.exists_isLink_of_mem_edgeSet heH + rcases hl.left_eq_or_eq (habH.mono hHG) with rfl | rfl + · exact Or.inl habH.left_mem + · exact Or.inl habH.right_mem + +/-- Any walk `W : GraphWalk G x y` whose start vertex `x` is drawn outside `D` and whose end vertex +`y` is drawn inside `D` meets `V(C)` whenever `subBd D = graphDrawingSubgraphU Γ C` (`C ≤ G`). -/ +theorem exists_mem_support_of_subBd_eq_subgraphU {S : Type w} [TopologicalSpace S] + {G C : Graph α β} (Γ : GraphDrawing G S) (hCG : C ≤ G) {D : Set S} + (hbd : subBd D = graphDrawingSubgraphU Γ C) {x y : α} (W : GraphWalk G x y) + (hx : graphDrawingVertexSet Γ x ⊆ Dᶜ) (hy : graphDrawingVertexSet Γ y ⊆ D) : + ∃ v ∈ W.support, v ∈ V(C) := by + induction W with + | @nil u hu => + obtain ⟨p, hp⟩ := graphDrawingVertexSet_nonempty Γ hu + exact (hx hp (hy hp)).elim + | @cons u z y e hl rest ih => + by_cases hz : graphDrawingVertexSet Γ z ⊆ D + · have heG : e ∈ E(G) := hl.edge_mem + have hK_conn : IsConnected (closure (graphDrawingEdgeSet Γ e)) := by + rw [graphDrawingEdgeSet_eq Γ heG] + exact isConnected_closure_edge Γ.drawing (Γ.iso.edgeEquiv ⟨e, heG⟩).2 + obtain ⟨pz, hpz⟩ := graphDrawingVertexSet_nonempty Γ hl.right_mem + obtain ⟨pu, hpu⟩ := graphDrawingVertexSet_nonempty Γ hl.left_mem + have hKD : (closure (graphDrawingEdgeSet Γ e) ∩ D).Nonempty := + ⟨pz, graphDrawingVertexSet_subset_closure_edge Γ hl.symm hpz, hz hpz⟩ + have hKc : (closure (graphDrawingEdgeSet Γ e) ∩ Dᶜ).Nonempty := + ⟨pu, graphDrawingVertexSet_subset_closure_edge Γ hl hpu, hx hpu⟩ + have hbd_ne := inter_subBd_nonempty_of_isConnected hK_conn hKD hKc + rw [hbd] at hbd_ne + rcases mem_vertexSet_or_of_closure_edge_inter_subgraphU_nonempty Γ hCG hl hbd_ne with huC | + hzC + · exact ⟨u, List.mem_cons_self, huC⟩ + · exact ⟨z, List.mem_cons_of_mem _ rest.start_mem_support, hzC⟩ + · have hzc : graphDrawingVertexSet Γ z ⊆ Dᶜ := by + rw [graphDrawingVertexSet_eq_singleton Γ hl.right_mem, singleton_subset_iff] at hz ⊢ + exact hz + obtain ⟨v, hv_rest, hvC⟩ := ih hzc hy + exact ⟨v, List.mem_cons_of_mem _ hv_rest, hvC⟩ + +/-- If `t₁ < t₂ < t₁ + 2π`, the circular angle difference from `exp(t₁)` to `exp(t₂)` is `t₂ - t₁`. +-/ +theorem angleDiff_exp_of_lt {t₁ t₂ : ℝ} (h12 : t₁ < t₂) (h2pi : t₂ < t₁ + 2 * Real.pi) : + (Circle.exp t₁).angleDiff (Circle.exp t₂) = t₂ - t₁ := by + have hmul : Circle.exp (t₂ - t₁) * Circle.exp t₁ = Circle.exp t₂ := by + rw [← Circle.exp_add, sub_add_cancel] + rw [← hmul] + exact angleDiff_exp_mul (sub_pos.mpr h12) (sub_lt_iff_lt_add'.mpr h2pi) + +/-- Clockwise agreement on an `O`-arc, for a map that sends each vertex to a set of points. -/ +def SetAgreesWithOArcHomeo {S : Type w} [TopologicalSpace S] (ν : α → Set S) (Ω : CyclicPerm α) + (C : Set S) (φ : Circle ≃ₜ C) : Prop := + (∀ v ∈ Ω.bar, ν v ⊆ C) ∧ + ∀ v₁ v₂ v₃ : α, Ω.IsClockwise3 v₁ v₂ v₃ → + ∃ (t₁ t₂ t₃ : ℝ), t₁ < t₂ ∧ t₂ < t₃ ∧ t₃ < t₁ + 2 * Real.pi ∧ + (φ (Circle.exp t₁)).1 ∈ ν v₁ ∧ (φ (Circle.exp t₂)).1 ∈ ν v₂ ∧ (φ (Circle.exp t₃)).1 ∈ ν v₃ + +/-- Under `SetAgreesWithOArcHomeo`, clockwise order `Ω.IsClockwise3 v₁ v₂ v₃` yields +`z₁.angleDiff z₂ < z₁.angleDiff z₃` on `Circle`. -/ +theorem angleDiff_lt_of_isClockwise3_set {S : Type w} [TopologicalSpace S] + {ν : α → Set S} (hpt : ∀ {v p q}, p ∈ ν v → q ∈ ν v → p = q) {Ω : CyclicPerm α} {C : Set S} + {φ : Circle ≃ₜ C} (hagree : SetAgreesWithOArcHomeo ν Ω C φ) + {v₁ v₂ v₃ : α} (hclw : Ω.IsClockwise3 v₁ v₂ v₃) + {z₁ z₂ z₃ : Circle} + (hz₁ : (φ z₁).1 ∈ ν v₁) + (hz₂ : (φ z₂).1 ∈ ν v₂) + (hz₃ : (φ z₃).1 ∈ ν v₃) : + z₁.angleDiff z₂ < z₁.angleDiff z₃ := by + obtain ⟨t₁, t₂, t₃, ht12, ht23, ht31, hφ₁, hφ₂, hφ₃⟩ := hagree.2 v₁ v₂ v₃ hclw + have heq₁ : z₁ = Circle.exp t₁ := + φ.injective (Subtype.ext (hpt hz₁ hφ₁)) + have heq₂ : z₂ = Circle.exp t₂ := + φ.injective (Subtype.ext (hpt hz₂ hφ₂)) + have heq₃ : z₃ = Circle.exp t₃ := + φ.injective (Subtype.ext (hpt hz₃ hφ₃)) + subst heq₁ heq₂ heq₃ + rw [angleDiff_exp_of_lt ht12 (ht23.trans ht31), + angleDiff_exp_of_lt (ht12.trans ht23) ht31] + linarith + +/-- Under `SetAgreesWithOArcHomeo`, `Ω.Crosses v₁ v₃ v₂ v₄` implies `PairsCrossOn C p₁ p₃ p₂ p₄` +for the corresponding points on the boundary curve `C`. -/ +theorem pairsCrossOn_of_crosses_set {S : Type w} [TopologicalSpace S] + {ν : α → Set S} (hpt : ∀ {v p q}, p ∈ ν v → q ∈ ν v → p = q) + (hinj : ∀ {u w p}, p ∈ ν u → p ∈ ν w → u = w) {Ω : CyclicPerm α} {C : Set S} + {φ : Circle ≃ₜ C} (hagree : SetAgreesWithOArcHomeo ν Ω C φ) + {v₁ v₃ v₂ v₄ : α} (hcr : Ω.Crosses v₁ v₃ v₂ v₄) + {p₁ p₃ p₂ p₄ : S} + (hp₁ : p₁ ∈ ν v₁) + (hp₃ : p₃ ∈ ν v₃) + (hp₂ : p₂ ∈ ν v₂) + (hp₄ : p₄ ∈ ν v₄) : + PairsCrossOn C p₁ p₃ p₂ p₄ := by + have hcr_int := Ω.crosses_iff_interval.mp hcr + have hv₁ : v₁ ∈ Ω.bar := by + rcases hcr_int with ⟨h123, _⟩ | ⟨h143, _⟩ + · exact (Ω.isClockwise3_iff.mp h123.2).2.2.2.1 + · exact (Ω.isClockwise3_iff.mp h143.2).2.2.2.1 + have hv₃ : v₃ ∈ Ω.bar := by + rcases hcr_int with ⟨h123, _⟩ | ⟨h143, _⟩ + · exact (Ω.isClockwise3_iff.mp h123.2).2.2.2.2.2.1 + · exact (Ω.isClockwise3_iff.mp h143.2).2.2.2.2.2.1 + have hv₂ : v₂ ∈ Ω.bar := by + rcases hcr_int with ⟨h123, _⟩ | ⟨_, h321⟩ + · exact h123.1.1 + · exact h321.1.1 + have hv₄ : v₄ ∈ Ω.bar := by + rcases hcr_int with ⟨_, h341⟩ | ⟨h143, _⟩ + · exact h341.1.1 + · exact h143.1.1 + have hp₁C : p₁ ∈ C := hagree.1 v₁ hv₁ hp₁ + have hp₃C : p₃ ∈ C := hagree.1 v₃ hv₃ hp₃ + have hp₂C : p₂ ∈ C := hagree.1 v₂ hv₂ hp₂ + have hp₄C : p₄ ∈ C := hagree.1 v₄ hv₄ hp₄ + let z₁ : Circle := φ.symm ⟨p₁, hp₁C⟩ + let z₃ : Circle := φ.symm ⟨p₃, hp₃C⟩ + let z₂ : Circle := φ.symm ⟨p₂, hp₂C⟩ + let z₄ : Circle := φ.symm ⟨p₄, hp₄C⟩ + have hz₁_val : (φ z₁).1 = p₁ := by simp [z₁] + have hz₃_val : (φ z₃).1 = p₃ := by simp [z₃] + have hz₂_val : (φ z₂).1 = p₂ := by simp [z₂] + have hz₄_val : (φ z₄).1 = p₄ := by simp [z₄] + have hz₁ : (φ z₁).1 ∈ ν v₁ := by rw [hz₁_val]; exact hp₁ + have hz₃ : (φ z₃).1 ∈ ν v₃ := by rw [hz₃_val]; exact hp₃ + have hz₂ : (φ z₂).1 ∈ ν v₂ := by rw [hz₂_val]; exact hp₂ + have hz₄ : (φ z₄).1 ∈ ν v₄ := by rw [hz₄_val]; exact hp₄ + have hcr_circle : CrossesOn (Set.univ : Set Circle) z₁ z₃ z₂ z₄ := by + rw [crossesOn_univ_iff_angleDiff] + have hz_ne : ∀ {u w : α} {zu zw : Circle} {pu pw : S}, + u ≠ w → pu ∈ ν u → pw ∈ ν w → + (φ zu).1 = pu → (φ zw).1 = pw → zu ≠ zw := by + intro u w zu zw pu pw huw hpu hpw hzu hzw h + have hp : pu = pw := hzu.symm.trans ((congrArg Subtype.val (congrArg φ h)).trans hzw) + exact huw (hinj hpu (hp ▸ hpw)) + rcases hcr_int with h1234 | h1432 + · have h123 : Ω.IsClockwise3 v₁ v₂ v₃ := h1234.1.2 + have h341 : Ω.IsClockwise3 v₃ v₄ v₁ := h1234.2.2 + have h134 : Ω.IsClockwise3 v₁ v₃ v₄ := Ω.isClockwise3_rotate (Ω.isClockwise3_rotate h341) + have h234 : Ω.IsClockwise3 v₂ v₃ v₄ := + (Ω.isClockwise4_iff_interval.mp (Ω.isClockwise4_rotate + (Ω.isClockwise4_iff_interval.mpr h1234))).1.2 + have h123_def := Ω.isClockwise3_iff.mp h123 + have h341_def := Ω.isClockwise3_iff.mp h341 + have h234_def := Ω.isClockwise3_iff.mp h234 + refine ⟨hz_ne h123_def.2.1 hp₁ hp₃ hz₁_val hz₃_val, + hz_ne h234_def.2.1 hp₂ hp₄ hz₂_val hz₄_val, + hz_ne h123_def.1 hp₁ hp₂ hz₁_val hz₂_val, + hz_ne h341_def.2.2.1.symm hp₁ hp₄ hz₁_val hz₄_val, + hz_ne h123_def.2.2.1.symm hp₃ hp₂ hz₃_val hz₂_val, + hz_ne h341_def.1 hp₃ hp₄ hz₃_val hz₄_val, ?_⟩ + have hlt₁ : z₁.angleDiff z₂ < z₁.angleDiff z₃ := + angleDiff_lt_of_isClockwise3_set hpt hagree h123 hz₁ hz₂ hz₃ + have hlt₂ : z₁.angleDiff z₃ < z₁.angleDiff z₄ := + angleDiff_lt_of_isClockwise3_set hpt hagree h134 hz₁ hz₃ hz₄ + exact ⟨fun _ => not_lt.mpr hlt₂.le, fun _ => hlt₁⟩ + · have h143 : Ω.IsClockwise3 v₁ v₄ v₃ := h1432.1.2 + have h321 : Ω.IsClockwise3 v₃ v₂ v₁ := h1432.2.2 + have h132 : Ω.IsClockwise3 v₁ v₃ v₂ := Ω.isClockwise3_rotate (Ω.isClockwise3_rotate h321) + have h432 : Ω.IsClockwise3 v₄ v₃ v₂ := + (Ω.isClockwise4_iff_interval.mp (Ω.isClockwise4_rotate + (Ω.isClockwise4_iff_interval.mpr h1432))).1.2 + have h143_def := Ω.isClockwise3_iff.mp h143 + have h321_def := Ω.isClockwise3_iff.mp h321 + have h432_def := Ω.isClockwise3_iff.mp h432 + refine ⟨hz_ne h143_def.2.1 hp₁ hp₃ hz₁_val hz₃_val, + hz_ne h432_def.2.1.symm hp₂ hp₄ hz₂_val hz₄_val, + hz_ne h321_def.2.2.1.symm hp₁ hp₂ hz₁_val hz₂_val, + hz_ne h143_def.1 hp₁ hp₄ hz₁_val hz₄_val, + hz_ne h321_def.1 hp₃ hp₂ hz₃_val hz₂_val, + hz_ne h143_def.2.2.1.symm hp₃ hp₄ hz₃_val hz₄_val, ?_⟩ + have hlt₁ : z₁.angleDiff z₄ < z₁.angleDiff z₃ := + angleDiff_lt_of_isClockwise3_set hpt hagree h143 hz₁ hz₄ hz₃ + have hlt₂ : z₁.angleDiff z₃ < z₁.angleDiff z₂ := + angleDiff_lt_of_isClockwise3_set hpt hagree h132 hz₁ hz₃ hz₂ + exact ⟨fun h => (hlt₂.not_gt h).elim, fun h => (h hlt₁).elim⟩ + have hcr_C : CrossesOn C (oArcMap φ z₁) (oArcMap φ z₃) + (oArcMap φ z₂) (oArcMap φ z₄) := + (crossesOn_oArcMap_iff φ).mpr hcr_circle + have ho₁ : oArcMap φ z₁ = p₁ := by simp [oArcMap, z₁] + have ho₃ : oArcMap φ z₃ = p₃ := by simp [oArcMap, z₃] + have ho₂ : oArcMap φ z₂ = p₂ := by simp [oArcMap, z₂] + have ho₄ : oArcMap φ z₄ = p₄ := by simp [oArcMap, z₄] + rw [ho₁, ho₃, ho₂, ho₄] at hcr_C + exact hcr_C + +/-- Under `DrawingAgreesWithOArcHomeo`, clockwise order `Ω.IsClockwise3 v₁ v₂ v₃` yields +`z₁.angleDiff z₂ < z₁.angleDiff z₃` on `Circle`. -/ +theorem angleDiff_lt_of_isClockwise3 {S : Type w} [TopologicalSpace S] + {G : Graph α β} {Γ : GraphDrawing G S} {Ω : CyclicPerm α} {C : Set S} + {φ : Circle ≃ₜ C} (hagree : DrawingAgreesWithOArcHomeo Γ Ω C φ) + {v₁ v₂ v₃ : α} (hclw : Ω.IsClockwise3 v₁ v₂ v₃) + {z₁ z₂ z₃ : Circle} + (hz₁ : (φ z₁).1 ∈ graphDrawingVertexSet Γ v₁) + (hz₂ : (φ z₂).1 ∈ graphDrawingVertexSet Γ v₂) + (hz₃ : (φ z₃).1 ∈ graphDrawingVertexSet Γ v₃) : + z₁.angleDiff z₂ < z₁.angleDiff z₃ := + angleDiff_lt_of_isClockwise3_set (ν := graphDrawingVertexSet Γ) + (fun h h' => h.2.symm.trans h'.2) hagree hclw hz₁ hz₂ hz₃ + +/-- Under `DrawingAgreesWithOArcHomeo`, `Ω.Crosses v₁ v₃ v₂ v₄` implies `PairsCrossOn C p₁ p₃ p₂ p₄` +for the corresponding vertex points on the boundary curve `C`. -/ +theorem pairsCrossOn_of_crosses {S : Type w} [TopologicalSpace S] + {G : Graph α β} {Γ : GraphDrawing G S} {Ω : CyclicPerm α} {C : Set S} + {φ : Circle ≃ₜ C} (hagree : DrawingAgreesWithOArcHomeo Γ Ω C φ) + {v₁ v₃ v₂ v₄ : α} (hcr : Ω.Crosses v₁ v₃ v₂ v₄) + {p₁ p₃ p₂ p₄ : S} + (hp₁ : p₁ ∈ graphDrawingVertexSet Γ v₁) + (hp₃ : p₃ ∈ graphDrawingVertexSet Γ v₃) + (hp₂ : p₂ ∈ graphDrawingVertexSet Γ v₂) + (hp₄ : p₄ ∈ graphDrawingVertexSet Γ v₄) : + PairsCrossOn C p₁ p₃ p₂ p₄ := + pairsCrossOn_of_crosses_set (ν := graphDrawingVertexSet Γ) + (fun h h' => h.2.symm.trans h'.2) (fun h h' => graphDrawingVertexSet_inj Γ h h') hagree hcr + hp₁ hp₃ hp₂ hp₄ + +/-- If two subgraphs `P₁, P₂ ≤ G` have intersecting drawing images in `Γ`, they share a vertex. -/ +theorem nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' {S : Type w} + [TopologicalSpace S] {G P₁ P₂ : Graph α β} + (Γ : GraphDrawing G S) (hP₁ : P₁ ≤ G) (hP₂ : P₂ ≤ G) + (hne : (graphDrawingSubgraphU Γ P₁ ∩ graphDrawingSubgraphU Γ P₂).Nonempty) : + (V(P₁) ∩ V(P₂)).Nonempty := by + obtain ⟨x, hx₁, hx₂⟩ := hne + rcases hx₁ with hx_vert | hx_edge + · obtain ⟨v, hv₁, hxv⟩ := mem_iUnion₂.mp hx_vert + have hvG : v ∈ V(G) := hP₁.vertexSet_mono hv₁ + have hsub : graphDrawingVertexSet Γ v ⊆ graphDrawingSubgraphU Γ P₂ := by + rw [graphDrawingVertexSet_eq_singleton Γ hvG, hxv.2, singleton_subset_iff] + exact hx₂ + exact ⟨v, hv₁, mem_vertexSet_of_graphDrawingVertexSet_subset_subgraphU Γ hP₂ hvG hsub⟩ + · obtain ⟨e, he₁, hxe⟩ := mem_iUnion₂.mp hx_edge + obtain ⟨u, w, hl₁⟩ := P₁.exists_isLink_of_mem_edgeSet he₁ + rcases mem_vertexSet_or_of_closure_edge_inter_subgraphU_nonempty Γ hP₂ (hl₁.mono hP₁) + ⟨x, hxe, hx₂⟩ with hu₂ | hw₂ + · exact ⟨u, hl₁.left_mem, hu₂⟩ + · exact ⟨w, hl₁.right_mem, hw₂⟩ + +/-- For any walk `W : GraphWalk G u v`, the union of vertex points in `W.support` and closures of +edge drawings in `W.edges` is connected. -/ +theorem isConnected_walkDrawingU {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) {u v : α} (W : GraphWalk G u v) : + IsConnected ((⋃ w ∈ W.support, graphDrawingVertexSet Γ w) ∪ + (⋃ e ∈ W.edges, closure (graphDrawingEdgeSet Γ e))) := by + induction W with + | @nil x hx => + have heq : (⋃ w ∈ (GraphWalk.nil hx).support, graphDrawingVertexSet Γ w) ∪ + (⋃ e ∈ (GraphWalk.nil hx).edges, closure (graphDrawingEdgeSet Γ e)) = + {(Γ.iso.vertexEquiv ⟨x, hx⟩).1} := by + simp [GraphWalk.support, GraphWalk.edges, graphDrawingVertexSet_eq_singleton Γ hx] + rw [heq] + exact isConnected_singleton + | @cons x z y e hl rest ih => + let E_cl := closure (graphDrawingEdgeSet Γ e) + let R_U := (⋃ w ∈ rest.support, graphDrawingVertexSet Γ w) ∪ + (⋃ f ∈ rest.edges, closure (graphDrawingEdgeSet Γ f)) + have heq : (⋃ w ∈ (GraphWalk.cons hl rest).support, graphDrawingVertexSet Γ w) ∪ + (⋃ f ∈ (GraphWalk.cons hl rest).edges, closure (graphDrawingEdgeSet Γ f)) = + E_cl ∪ R_U := by + ext pt + simp only [GraphWalk.support, GraphWalk.edges, List.mem_cons, mem_union, mem_iUnion, + exists_prop, E_cl, R_U] + constructor + · rintro (⟨w, rfl | hw, hpt⟩ | ⟨f, rfl | hf, hpt⟩) + · exact Or.inl (graphDrawingVertexSet_subset_closure_edge Γ hl hpt) + · exact Or.inr (Or.inl ⟨w, hw, hpt⟩) + · exact Or.inl hpt + · exact Or.inr (Or.inr ⟨f, hf, hpt⟩) + · rintro (hpt | ⟨w, hw, hpt⟩ | ⟨f, hf, hpt⟩) + · exact Or.inr ⟨e, Or.inl rfl, hpt⟩ + · exact Or.inl ⟨w, Or.inr hw, hpt⟩ + · exact Or.inr ⟨f, Or.inr hf, hpt⟩ + rw [heq] + have hE_conn : IsConnected E_cl := by + dsimp [E_cl] + rw [graphDrawingEdgeSet_eq Γ hl.edge_mem] + exact isConnected_closure_edge Γ.drawing (Γ.iso.edgeEquiv ⟨e, hl.edge_mem⟩).2 + obtain ⟨pz, hpz⟩ := graphDrawingVertexSet_nonempty Γ hl.right_mem + have hpz_E : pz ∈ E_cl := graphDrawingVertexSet_subset_closure_edge Γ hl.symm hpz + have hpz_R : pz ∈ R_U := + Or.inl (mem_iUnion₂.mpr ⟨z, rest.start_mem_support, hpz⟩) + exact ⟨⟨pz, Or.inl hpz_E⟩, hE_conn.isPreconnected.union pz hpz_E hpz_R ih.isPreconnected⟩ + +/-- If `P` is a path in `G` with ends `u` and `v` drawn inside a closed disc `D`, then +`graphDrawingSubgraphU Γ P` is compact and connected, and contains vertex points for `u` and `v`. -/ +theorem isCompact_and_isConnected_subgraphU_of_isGraphPathWithEnds + {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {Γ : GraphDrawing G S} {P : Graph α β} {u v : α} {D : Set S} + (hD : IsClosedDisc D) (hP : IsGraphPathWithEnds G P u v) + (hU : graphDrawingSubgraphU Γ P ⊆ D) : + IsCompact (graphDrawingSubgraphU Γ P) ∧ IsConnected (graphDrawingSubgraphU Γ P) ∧ + (∃ p_u ∈ graphDrawingVertexSet Γ u, p_u ∈ graphDrawingSubgraphU Γ P) ∧ + (∃ p_v ∈ graphDrawingVertexSet Γ v, p_v ∈ graphDrawingSubgraphU Γ P) := by + have huG : u ∈ V(G) := hP.le.vertexSet_mono hP.left_mem + have hvG : v ∈ V(G) := hP.le.vertexSet_mono hP.right_mem + obtain ⟨p_u, hp_u⟩ := graphDrawingVertexSet_nonempty Γ huG + obtain ⟨p_v, hp_v⟩ := graphDrawingVertexSet_nonempty Γ hvG + have hp_uU : p_u ∈ graphDrawingSubgraphU Γ P := + graphDrawingVertexSet_subset_subgraphU_of_mem Γ hP.left_mem hp_u + have hp_vU : p_v ∈ graphDrawingSubgraphU Γ P := + graphDrawingVertexSet_subset_subgraphU_of_mem Γ hP.right_mem hp_v + obtain ⟨hP_le, W, hW_simple, hVP, hEP⟩ := hP + obtain ⟨W_G, hs_G, he_G⟩ := exists_walk_up_of_le hP_le W + have hU_eq : graphDrawingSubgraphU Γ P = + (⋃ w ∈ W_G.support, graphDrawingVertexSet Γ w) ∪ + (⋃ e ∈ W_G.edges, closure (graphDrawingEdgeSet Γ e)) := by + simp only [graphDrawingSubgraphU, hs_G, he_G, hVP, hEP, mem_ofPred_eq] + have hconn : IsConnected (graphDrawingSubgraphU Γ P) := by + rw [hU_eq] + exact isConnected_walkDrawingU Γ W_G + have hclosed : IsClosed (graphDrawingSubgraphU Γ P) := by + rw [hU_eq] + refine IsClosed.union ?_ ?_ + · refine W_G.support.finite_toSet.isClosed_biUnion fun w hw => ?_ + have hwG : w ∈ V(G) := W_G.mem_vertexSet_of_mem_support hw + rw [graphDrawingVertexSet_eq_singleton Γ hwG] + exact isClosed_singleton + · exact W_G.edges.finite_toSet.isClosed_biUnion fun e _ => isClosed_closure + have hcomp : IsCompact (graphDrawingSubgraphU Γ P) := + (isCompact_of_isClosedDisc hD).of_isClosed_subset hclosed hU + exact ⟨hcomp, hconn, ⟨p_u, hp_u, hp_uU⟩, ⟨p_v, hp_v, hp_vU⟩⟩ + +/-- If `D ⊆ EuclideanPlane` is a closed disc whose boundary `subBd D` agrees with a cyclic order `Ω` +via `φ`, and `P₁, P₂` are paths in `G` with ends `(v₁, v₃)` and `(v₂, v₄)` drawn inside `D` such +that `Ω.Crosses v₁ v₃ v₂ v₄`, then `V(P₁) ∩ V(P₂)` is nonempty. -/ +theorem nonempty_inter_of_crosses_in_disc + {G : Graph α β} {Γ : GraphDrawing G EuclideanPlane} {Ω : CyclicPerm α} + {D : Set EuclideanPlane} {φ : Circle ≃ₜ subBd D} + (hD : IsClosedDisc D) (hagree : DrawingAgreesWithOArcHomeo Γ Ω (subBd D) φ) + {P₁ P₂ : Graph α β} {v₁ v₃ v₂ v₄ : α} + (hP₁ : IsGraphPathWithEnds G P₁ v₁ v₃) (hP₂ : IsGraphPathWithEnds G P₂ v₂ v₄) + (hU₁ : graphDrawingSubgraphU Γ P₁ ⊆ D) (hU₂ : graphDrawingSubgraphU Γ P₂ ⊆ D) + (hcr : Ω.Crosses v₁ v₃ v₂ v₄) : + (V(P₁) ∩ V(P₂)).Nonempty := by + obtain ⟨hcomp₁, hconn₁, ⟨p₁, hp₁, hp₁U⟩, ⟨p₃, hp₃, hp₃U⟩⟩ := + isCompact_and_isConnected_subgraphU_of_isGraphPathWithEnds hD hP₁ hU₁ + obtain ⟨hcomp₂, hconn₂, ⟨p₂, hp₂, hp₂U⟩, ⟨p₄, hp₄, hp₄U⟩⟩ := + isCompact_and_isConnected_subgraphU_of_isGraphPathWithEnds hD hP₂ hU₂ + have hcr_bd : PairsCrossOn (discBd D) p₁ p₃ p₂ p₄ := by + rw [discBd_eq_subBd hD] + exact pairsCrossOn_of_crosses hagree hcr hp₁ hp₃ hp₂ hp₄ + have hU_inter : (graphDrawingSubgraphU Γ P₁ ∩ graphDrawingSubgraphU Γ P₂).Nonempty := + disc_crossing D (graphDrawingSubgraphU Γ P₁) (graphDrawingSubgraphU Γ P₂) + p₁ p₃ p₂ p₄ hD hU₁ hU₂ hcomp₁ hcomp₂ hconn₁ hconn₂ hp₁U hp₃U hp₂U hp₄U hcr_bd + exact nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ hP₁.le hP₂.le hU_inter + +theorem graphDrawingSubgraphU_subset_U' {S : Type w} [TopologicalSpace S] + {G : Graph α β} (Γ : GraphDrawing G S) (P : Graph α β) : + graphDrawingSubgraphU Γ P ⊆ Γ.drawing.U := by + refine union_subset (iUnion₂_subset fun v _ x hx => ?_) (iUnion₂_subset fun e _ => ?_) + · rcases hx with ⟨hvG, rfl⟩ + exact Γ.drawing.V_subset_U (Γ.iso.vertexEquiv ⟨v, hvG⟩).2 + · by_cases heG : e ∈ E(G) + · rw [graphDrawingEdgeSet_eq Γ heG] + exact Γ.drawing.isClosed_U.closure_subset_iff.mpr + (((Γ.iso.edgeEquiv ⟨e, heG⟩).2.2.1).trans sdiff_subset) + · have hemp : graphDrawingEdgeSet Γ e = ∅ := by + ext x; simp [graphDrawingEdgeSet, heG] + rw [hemp, closure_empty] + exact empty_subset _ + +/-- In a rural neighborhood `N`, no two disjoint `N.Ω`-paths in `N.G` can cross on `N.Ω`. -/ +theorem not_omegaPathsCross_of_isRural {N : Neighborhood α β} (hrural : N.IsRural) + {P₁ P₂ : Graph α β} : + ¬ ({ G := N.G, Ω := N.Ω, finite_V := N.finite_V, finite_E := N.finite_E, + bar_subset := N.bar_subset } : Society α β).OmegaPathsCross P₁ P₂ := by + rintro ⟨hdisj, v₁, v₃, v₂, v₄, hP₁, hP₂, hcr⟩ + obtain ⟨Γ, Δ, Δ₀, hΔ, _, hU_sub, _, _, ⟨φ, _, hφ⟩, _⟩ := hrural + have hU₁ : graphDrawingSubgraphU Γ P₁ ⊆ Δ := + (graphDrawingSubgraphU_subset_U' Γ P₁).trans (hU_sub.trans sdiff_subset) + have hU₂ : graphDrawingSubgraphU Γ P₂ ⊆ Δ := + (graphDrawingSubgraphU_subset_U' Γ P₂).trans (hU_sub.trans sdiff_subset) + obtain ⟨v, hv₁, hv₂⟩ := + nonempty_inter_of_crosses_in_disc hΔ hφ hP₁.1 hP₂.1 hU₁ hU₂ hcr + exact disjoint_left.mp hdisj hv₁ hv₂ + +/-! ## Restriction of a cyclic permutation and fences -/ + +namespace CyclicPerm + +variable (Ω : CyclicPerm α) + +/-- The restriction `Ω | Y` of a cyclic permutation `Ω` to a subset `Y ⊆ Ω.bar`. -/ +noncomputable def restrict (Y : Set α) (_hY : Y ⊆ Ω.bar) : CyclicPerm α := + (exists_isRestriction Ω Y).choose + +theorem isRestriction_restrict {Y : Set α} (hY : Y ⊆ Ω.bar) : + Ω.IsRestriction Y (Ω.restrict Y hY) := (exists_isRestriction Ω Y).choose_spec + +@[simp] +theorem restrict_bar {Y : Set α} (hY : Y ⊆ Ω.bar) : + (Ω.restrict Y hY).bar = Y := (Ω.isRestriction_restrict hY).1.trans (inter_eq_right.mpr hY) + +theorem isClockwise3_restrict_iff {Y : Set α} (hY : Y ⊆ Ω.bar) {v₁ v₂ v₃ : α} : + (Ω.restrict Y hY).IsClockwise3 v₁ v₂ v₃ ↔ + v₁ ∈ Y ∧ v₂ ∈ Y ∧ v₃ ∈ Y ∧ Ω.IsClockwise3 v₁ v₂ v₃ := by + rw [(Ω.isRestriction_restrict hY).isClockwise3_iff, Ω.restrict_bar hY] + +theorem crosses_restrict_iff {Y : Set α} (hY : Y ⊆ Ω.bar) {v₁ v₂ v₃ v₄ : α} : + (Ω.restrict Y hY).Crosses v₁ v₂ v₃ v₄ ↔ + v₁ ∈ Y ∧ v₂ ∈ Y ∧ v₃ ∈ Y ∧ v₄ ∈ Y ∧ Ω.Crosses v₁ v₂ v₃ v₄ := by + rw [(Ω.isRestriction_restrict hY).crosses_iff, Ω.restrict_bar hY] + +theorem interval_restrict {Y : Set α} (hY : Y ⊆ Ω.bar) (v₁ v₂ : α) : + v₁ ∈ Y → v₂ ∈ Y → (Ω.restrict Y hY).interval v₁ v₂ = Ω.interval v₁ v₂ ∩ Y := by + intro hv₁ hv₂ + have h := (Ω.isRestriction_restrict hY).interval_eq (a := v₁) (b := v₂) + (by rwa [Ω.restrict_bar hY]) (by rwa [Ω.restrict_bar hY]) + rwa [Ω.restrict_bar hY] at h + +/-- For any distinct `u, v ∈ Ω.bar`, `{u} ∪ Ω(v, u)` and `{v} ∪ Ω(u, v)` form a fence of `Ω`. -/ +theorem isFence_halfOpen_intervals {u v : α} (hu : u ∈ Ω.bar) (hv : v ∈ Ω.bar) (huv : u ≠ v) : + Ω.IsFence ({u} ∪ Ω.interval v u) ({v} ∪ Ω.interval u v) := by + have hA_sub : {u} ∪ Ω.interval v u ⊆ Ω.bar := by + rintro z (rfl | hz); exacts [hu, Ω.interval_subset_bar v u hz] + have hB_sub : {v} ∪ Ω.interval u v ⊆ Ω.bar := by + rintro z (rfl | hz); exacts [hv, Ω.interval_subset_bar u v hz] + have hdisj : Disjoint ({u} ∪ Ω.interval v u) ({v} ∪ Ω.interval u v) := by + rw [disjoint_left]; intro z hz₁ hz₂ + rcases hz₁ with hzu | hz₁ <;> rcases hz₂ with hzv | hz₂ + · exact huv (hzu.symm.trans hzv) + · rw [mem_singleton_iff] at hzu; subst hzu; exact Ω.not_mem_interval_left z v hz₂ + · rw [mem_singleton_iff] at hzv; subst hzv; exact Ω.not_mem_interval_left z u hz₁ + · exact disjoint_left.mp (Ω.disjoint_interval_swap v u) hz₁ hz₂ + have hunion : ({u} ∪ Ω.interval v u) ∪ ({v} ∪ Ω.interval u v) = Ω.bar := by + ext z; simp only [mem_union, mem_singleton_iff] + refine ⟨by rintro ((rfl | hz) | (rfl | hz)); exacts [hu, hz.1.1, hv, hz.1.1], fun hz => ?_⟩ + by_cases hzu : z = u + · exact Or.inl (Or.inl hzu) + · by_cases hzv : z = v + · exact Or.inr (Or.inl hzv) + · exact (Ω.mem_interval_or_interval_swap hv hu hz huv.symm hzv hzu).imp Or.inr Or.inr + have hf₀ := Ω.isFence_interval_compl hv hu huv.symm + have hf₁ := Ω.isFence_interval_compl hu hv huv + refine ⟨hA_sub, hB_sub, hdisj, hunion, ?_⟩ + intro a₁ ha₁ a₂ ha₂ ha12 b₁ hb₁ b₂ hb₂ hb12 hcr + have ha₁_0 : a₁ ∈ {v, u} ∪ Ω.interval v u := ha₁.elim (fun h => Or.inl (Or.inr h)) Or.inr + have ha₂_0 : a₂ ∈ {v, u} ∪ Ω.interval v u := ha₂.elim (fun h => Or.inl (Or.inr h)) Or.inr + have hb₁_1 : b₁ ∈ {u, v} ∪ Ω.interval u v := hb₁.elim (fun h => Or.inl (Or.inr h)) Or.inr + have hb₂_1 : b₂ ∈ {u, v} ∪ Ω.interval u v := hb₂.elim (fun h => Or.inl (Or.inr h)) Or.inr + have h_no_cross_uv : ∀ {x y : α}, x ∈ Ω.interval v u → y ∈ Ω.interval u v → + ¬ Ω.Crosses u x v y := by + intro x y hx hy hcr_xy + have hv_ux : v ∈ Ω.interval u x := Ω.mem_interval_rotate_right hx + have hy_ux : y ∈ Ω.interval u x := Ω.interval_subset_interval_left hv_ux hy + have hdisj_ux := Ω.disjoint_interval_swap u x + rcases Ω.crosses_iff_interval.mp hcr_xy with ⟨_, h2⟩ | ⟨_, h2⟩ + · exact disjoint_left.mp hdisj_ux hy_ux h2 + · exact disjoint_left.mp hdisj_ux hv_ux h2 + rcases ha₁ with rfl | ha₁_in <;> rcases ha₂ with rfl | ha₂_in + · exact ha12 rfl + · rcases hb₁ with rfl | hb₁_in <;> rcases hb₂ with rfl | hb₂_in + · exact hb12 rfl + · exact h_no_cross_uv ha₂_in hb₂_in hcr + · exact h_no_cross_uv ha₂_in hb₁_in hcr.swap_right + · exact hf₀.2.2.2.2 a₁ ha₁_0 a₂ ha₂_0 ha12 b₁ hb₁_in b₂ hb₂_in hb12 hcr + · rcases hb₁ with rfl | hb₁_in <;> rcases hb₂ with rfl | hb₂_in + · exact hb12 rfl + · exact h_no_cross_uv ha₁_in hb₂_in hcr.swap_left + · exact h_no_cross_uv ha₁_in hb₁_in hcr.swap_left.swap_right + · exact hf₀.2.2.2.2 a₁ ha₁_0 a₂ ha₂_0 ha12 b₁ hb₁_in b₂ hb₂_in hb12 hcr + · exact hf₁.symm.2.2.2.2 a₁ ha₁_in a₂ ha₂_in ha12 b₁ hb₁_1 b₂ hb₂_1 hb12 hcr + +/-- Any fence `(A', B')` of `Ω.restrict Y hY` extends to a fence `(A, B)` of `Ω` with +`A' ⊆ A` and `B' ⊆ B`. -/ +theorem exists_isFence_of_restrict {Y : Set α} (hY : Y ⊆ Ω.bar) {A' B' : Set α} + (hfence' : (Ω.restrict Y hY).IsFence A' B') : + ∃ A B : Set α, Ω.IsFence A B ∧ A' ⊆ A ∧ B' ⊆ B := by + let Ω' := Ω.restrict Y hY + by_cases hA' : A'.Nonempty + · by_cases hB' : B'.Nonempty + · have hW' : Y ⊆ Ω'.bar := by rw [Ω.restrict_bar hY] + have hW'_AB : Y ⊆ A' ∪ B' := by + have h_eq := hfence'.2.2.2.1; rw [Ω.restrict_bar hY] at h_eq; exact h_eq.symm.subset + have ha_ne : (A' ∩ Y).Nonempty := by + have h1 := hfence'.1; rw [Ω.restrict_bar hY] at h1; rwa [inter_eq_left.mpr h1] + have hb_ne : (B' ∩ Y).Nonempty := by + have h2 := hfence'.2.1; rw [Ω.restrict_bar hY] at h2; rwa [inter_eq_left.mpr h2] + obtain ⟨a'_0, ha'_0, b_0, hb_0, hd_ab⟩ := + Ω'.exists_empty_interval_AB_of_subset_union hW' hW'_AB ha_ne hb_ne + obtain ⟨b'_0, hb'_0, a_0, ha_0, hd_ba⟩ := + Ω'.exists_empty_interval_AB_of_subset_union hW' (union_comm A' B' ▸ hW'_AB) hb_ne ha_ne + obtain ⟨hA_sub, hB_sub, _, _, _, _⟩ := + Society.four_arc_partition hfence' hW' ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + have ha'_ne_b' : a'_0 ≠ b'_0 := + fun h => disjoint_left.mp hfence'.2.2.1 ha'_0.1 (h ▸ hb'_0.1) + refine ⟨{a'_0} ∪ Ω.interval b'_0 a'_0, {b'_0} ∪ Ω.interval a'_0 b'_0, + Ω.isFence_halfOpen_intervals (hY ha'_0.2) (hY hb'_0.2) ha'_ne_b', ?_, ?_⟩ + · intro x hx + have hxY : x ∈ Y := by have h1 := hfence'.1 hx; rwa [Ω.restrict_bar hY] at h1 + rcases (hA_sub ⟨hx, hxY⟩).1 with rfl | hx_int + · exact Or.inl rfl + · rw [Ω.interval_restrict hY b'_0 a'_0 hb'_0.2 ha'_0.2] at hx_int; exact Or.inr hx_int.1 + · intro y hy + have hyY : y ∈ Y := by have h2 := hfence'.2.1 hy; rwa [Ω.restrict_bar hY] at h2 + rcases (hB_sub ⟨hy, hyY⟩).1 with rfl | hy_int + · exact Or.inl rfl + · rw [Ω.interval_restrict hY a'_0 b'_0 ha'_0.2 hb'_0.2] at hy_int; exact Or.inr hy_int.1 + · rw [not_nonempty_iff_eq_empty] at hB' + have h1 := hfence'.1; rw [Ω.restrict_bar hY] at h1 + refine ⟨Ω.bar, ∅, ⟨Subset.rfl, empty_subset _, disjoint_empty _, union_empty _, ?_⟩, + h1.trans hY, by rw [hB']⟩ + intro _ _ _ _ _ _ hb₁; exact (notMem_empty _ hb₁).elim + · rw [not_nonempty_iff_eq_empty] at hA' + have h2 := hfence'.2.1; rw [Ω.restrict_bar hY] at h2 + refine ⟨∅, Ω.bar, ⟨empty_subset _, Subset.rfl, empty_disjoint _, empty_union _, ?_⟩, + by rw [hA'], h2.trans hY⟩ + intro _ ha₁; exact (notMem_empty _ ha₁).elim + +theorem isFence_inter_restrict {Y : Set α} (hY : Y ⊆ Ω.bar) {A B : Set α} + (hfence : Ω.IsFence A B) : + (Ω.restrict Y hY).IsFence (A ∩ Y) (B ∩ Y) := by + refine ⟨by rw [Ω.restrict_bar hY]; exact inter_subset_right, + by rw [Ω.restrict_bar hY]; exact inter_subset_right, + hfence.2.2.1.mono inter_subset_left inter_subset_left, ?_, ?_⟩ + · rw [← union_inter_distrib_right, hfence.2.2.2.1, Ω.restrict_bar hY, inter_eq_right.mpr hY] + · intro a₁ ha₁ a₂ ha₂ ha12 b₁ hb₁ b₂ hb₂ hb12 hcr + exact hfence.2.2.2.2 a₁ ha₁.1 a₂ ha₂.1 ha12 b₁ hb₁.1 b₂ hb₂.1 hb12 + ((Ω.crosses_restrict_iff hY).mp hcr).2.2.2.2 + +end CyclicPerm + +namespace Society + +variable (S : Society α β) + +/-- The society `(S.G, S.Ω | Y)` obtained by restricting `S.Ω` to `Y ⊆ S.Ω.bar`. -/ +noncomputable def restrictOmega (Y : Set α) (hY : Y ⊆ S.Ω.bar) : Society α β where + G := S.G + Ω := S.Ω.restrict Y hY + finite_V := S.finite_V + finite_E := S.finite_E + bar_subset := by rw [S.Ω.restrict_bar hY]; exact hY.trans S.bar_subset + +@[simp] +theorem restrictOmega_G (Y : Set α) (hY : Y ⊆ S.Ω.bar) : + (S.restrictOmega Y hY).G = S.G := rfl + +@[simp] +theorem restrictOmega_Ω (Y : Set α) (hY : Y ⊆ S.Ω.bar) : + (S.restrictOmega Y hY).Ω = S.Ω.restrict Y hY := rfl + +theorem isOmegaPathWithEnds_restrictOmega_iff {Y : Set α} (hY : Y ⊆ S.Ω.bar) + {P : Graph α β} {a b : α} : + (S.restrictOmega Y hY).IsOmegaPathWithEnds P a b ↔ + S.IsOmegaPathWithEnds P a b ∧ a ∈ Y ∧ b ∈ Y := by + simp only [IsOmegaPathWithEnds, restrictOmega_G, restrictOmega_Ω, CyclicPerm.restrict_bar] + exact ⟨fun ⟨h1, h2, ha, hb⟩ => ⟨⟨h1, h2, hY ha, hY hb⟩, ha, hb⟩, + fun ⟨⟨h1, h2, _, _⟩, ha, hb⟩ => ⟨h1, h2, ha, hb⟩⟩ + +theorem transactionEnds_restrictOmega_eq {Y : Set α} (hY : Y ⊆ S.Ω.bar) + {P_set : Set (Graph α β)} (hends : S.transactionEnds P_set ⊆ Y) : + (S.restrictOmega Y hY).transactionEnds P_set = S.transactionEnds P_set := by + ext v; simp only [transactionEnds, mem_ofPred_eq, isOmegaPathWithEnds_restrictOmega_iff] + exact ⟨fun ⟨P, hP, b, hP_ends, _, _⟩ => ⟨P, hP, b, hP_ends⟩, + fun ⟨P, hP, b, hP_ends⟩ => ⟨P, hP, b, hP_ends, + hends (hP_ends.mem_transactionEnds_left S hP), + hends (hP_ends.mem_transactionEnds_right S hP)⟩⟩ + +/-- `P_set` is a crooked transaction in `(S.G, S.Ω | Y)` if and only if `P_set` is a crooked +transaction in `(S.G, S.Ω)` and `V(P_set) ⊆ Y`. -/ +theorem isCrookedTransaction_restrictOmega_iff {Y : Set α} (hY : Y ⊆ S.Ω.bar) + {P_set : Set (Graph α β)} : + (S.restrictOmega Y hY).IsCrookedTransaction P_set ↔ + S.IsCrookedTransaction P_set ∧ S.transactionEnds P_set ⊆ Y := by + let S' := S.restrictOmega Y hY + constructor + · rintro ⟨⟨A', B', hfence'⟩, hnot_per'⟩ + obtain ⟨A, B, hfence, hA', hB'⟩ := S.Ω.exists_isFence_of_restrict hY hfence'.2.1 + have hends_Y : S.transactionEnds P_set ⊆ Y := by + rintro v ⟨P, hP, b, hP_ends⟩ + obtain ⟨a₀, _, b₀, _, hP_ends'⟩ := hfence'.2.2 P hP + rw [S.isOmegaPathWithEnds_restrictOmega_iff hY] at hP_ends' + rcases hP_ends.ends_eq S hP_ends'.1 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hP_ends'.2.1 + · exact hP_ends'.2.2 + have htr_S : S.IsFenceFor P_set A B := by + refine ⟨⟨fun P hP => ?_, hfence'.1.2⟩, hfence, fun P hP => ?_⟩ + · obtain ⟨a, _, b, _, hP_e⟩ := hfence'.2.2 P hP + exact ⟨a, b, ((S.isOmegaPathWithEnds_restrictOmega_iff hY).mp hP_e).1⟩ + · obtain ⟨a, ha, b, hb, hP_e⟩ := hfence'.2.2 P hP + exact ⟨a, hA' ha, b, hB' hb, ((S.isOmegaPathWithEnds_restrictOmega_iff hY).mp hP_e).1⟩ + refine ⟨⟨⟨A, B, htr_S⟩, ?_⟩, hends_Y⟩ + intro P hP ⟨_, a, b, hP_ends, hdisj⟩ + have haY : a ∈ Y := hends_Y (hP_ends.mem_transactionEnds_left S hP) + have hbY : b ∈ Y := hends_Y (hP_ends.mem_transactionEnds_right S hP) + have hP_ends' : S'.IsOmegaPathWithEnds P a b := + (S.isOmegaPathWithEnds_restrictOmega_iff hY).mpr ⟨hP_ends, haY, hbY⟩ + have hW_eq : S'.transactionEnds P_set = S.transactionEnds P_set := + S.transactionEnds_restrictOmega_eq hY hends_Y + apply hnot_per' P hP ⟨hP, a, b, hP_ends', ?_⟩ + change Disjoint ((S.Ω.restrict Y hY).interval a b) (S'.transactionEnds P_set) ∨ + Disjoint ((S.Ω.restrict Y hY).interval b a) (S'.transactionEnds P_set) + rw [hW_eq, S.Ω.interval_restrict hY a b haY hbY, S.Ω.interval_restrict hY b a hbY haY] + exact hdisj.imp (fun hd => hd.mono_left inter_subset_left) + (fun hd => hd.mono_left inter_subset_left) + · rintro ⟨⟨⟨A, B, hfence⟩, hnot_per⟩, hends_Y⟩ + have hW_eq : S'.transactionEnds P_set = S.transactionEnds P_set := + S.transactionEnds_restrictOmega_eq hY hends_Y + refine ⟨⟨A ∩ Y, B ∩ Y, ⟨fun P hP => ?_, hfence.1.2⟩, + S.Ω.isFence_inter_restrict hY hfence.2.1, fun P hP => ?_⟩, ?_⟩ + · obtain ⟨a, _, b, _, hP_e⟩ := hfence.2.2 P hP + exact ⟨a, b, (S.isOmegaPathWithEnds_restrictOmega_iff hY).mpr + ⟨hP_e, hends_Y (hP_e.mem_transactionEnds_left S hP), + hends_Y (hP_e.mem_transactionEnds_right S hP)⟩⟩ + · obtain ⟨a, ha, b, hb, hP_e⟩ := hfence.2.2 P hP + have haY : a ∈ Y := hends_Y (hP_e.mem_transactionEnds_left S hP) + have hbY : b ∈ Y := hends_Y (hP_e.mem_transactionEnds_right S hP) + exact ⟨a, ⟨ha, haY⟩, b, ⟨hb, hbY⟩, + (S.isOmegaPathWithEnds_restrictOmega_iff hY).mpr ⟨hP_e, haY, hbY⟩⟩ + · intro P hP ⟨_, a, b, hP_ends', hdisj'⟩ + obtain ⟨hP_ends, haY, hbY⟩ := (S.isOmegaPathWithEnds_restrictOmega_iff hY).mp hP_ends' + change Disjoint ((S.Ω.restrict Y hY).interval a b) (S'.transactionEnds P_set) ∨ + Disjoint ((S.Ω.restrict Y hY).interval b a) (S'.transactionEnds P_set) at hdisj' + rw [hW_eq, S.Ω.interval_restrict hY a b haY hbY, + S.Ω.interval_restrict hY b a hbY haY] at hdisj' + apply hnot_per P hP ⟨hP, a, b, hP_ends, ?_⟩ + rcases hdisj' with hd | hd + · exact Or.inl (disjoint_left.mpr fun z hz hzW => disjoint_left.mp hd ⟨hz, hends_Y hzW⟩ hzW) + · exact Or.inr (disjoint_left.mpr fun z hz hzW => disjoint_left.mp hd ⟨hz, hends_Y hzW⟩ hzW) + +/-- Transferring a crooked transaction between societies with the same cyclic permutation. -/ +theorem isCrookedTransaction_of_omega_eq {S₁ S₂ : Society α β} {P_set : Set (Graph α β)} + (hΩ : S₁.Ω = S₂.Ω) (hP₁ : ∀ P ∈ P_set, P ≤ S₁.G) (hP₂ : ∀ P ∈ P_set, P ≤ S₂.G) + (hcr : S₁.IsCrookedTransaction P_set) : S₂.IsCrookedTransaction P_set := by + obtain ⟨A, B, hfence⟩ := hcr.1 + have hends_iff : ∀ P ∈ P_set, ∀ a b : α, + S₂.IsOmegaPathWithEnds P a b ↔ S₁.IsOmegaPathWithEnds P a b := fun P hP a b => by + simp only [IsOmegaPathWithEnds, hΩ] + exact ⟨fun ⟨h1, h2⟩ => ⟨⟨hP₁ P hP, h1.2⟩, h2⟩, fun ⟨h1, h2⟩ => ⟨⟨hP₂ P hP, h1.2⟩, h2⟩⟩ + have hW_eq : S₂.transactionEnds P_set = S₁.transactionEnds P_set := by + ext z; simp only [transactionEnds, mem_ofPred_eq] + exact ⟨fun ⟨P, hP, b, h⟩ => ⟨P, hP, b, (hends_iff P hP z b).mp h⟩, + fun ⟨P, hP, b, h⟩ => ⟨P, hP, b, (hends_iff P hP z b).mpr h⟩⟩ + refine ⟨⟨A, B, ⟨fun P hP => ?_, hfence.1.2⟩, hΩ ▸ hfence.2.1, fun P hP => ?_⟩, ?_⟩ + · obtain ⟨a, _, b, _, h⟩ := hfence.2.2 P hP; exact ⟨a, b, (hends_iff P hP a b).mpr h⟩ + · obtain ⟨a, ha, b, hb, h⟩ := hfence.2.2 P hP; exact ⟨a, ha, b, hb, (hends_iff P hP a b).mpr h⟩ + · intro P hP ⟨_, a, b, hP_e, hdisj⟩ + rw [hW_eq, ← hΩ] at hdisj + exact hcr.2 P hP ⟨hP, a, b, (hends_iff P hP a b).mp hP_e, hdisj⟩ + +end Society + +/-! ## Subgraph helpers for rural neighborhoods -/ + +/-- Every vertex of a path `Q` with distinct ends `x ≠ y` is incident to some edge of `Q`. -/ +theorem IsGraphPathWithEnds.exists_inc_of_mem_of_ne {G Q : Graph α β} {x y v : α} + (hQ : IsGraphPathWithEnds G Q x y) (hxy : x ≠ y) (hv : v ∈ V(Q)) : + ∃ e ∈ E(Q), Q.Inc e v := by + obtain ⟨Q₁, Q₂, hQ₁, hQ₂, hp₁, hp₂, _, _, _⟩ := hQ.exists_split_at hv + by_cases hvx : v = x + · subst hvx; obtain ⟨e, he₂, hinc₂⟩ := hp₂.exists_inc_left_of_ne hxy + exact ⟨e, hQ₂.edgeSet_mono he₂, hinc₂.mono hQ₂⟩ + · obtain ⟨e, he₁, hinc₁⟩ := hp₁.symm.exists_inc_left_of_ne hvx + exact ⟨e, hQ₁.edgeSet_mono he₁, hinc₁.mono hQ₁⟩ + +theorem isGraphPathWithEnds_singleVertexSubgraph {G : Graph α β} {v : α} (hv : v ∈ V(G)) : + IsGraphPathWithEnds G (singleVertexSubgraph G v) v v := by + let Q := singleVertexSubgraph G v + have hvQ : v ∈ V(Q) := by simp [Q] + exact ⟨singleVertexSubgraph_le hv, GraphWalk.nil hvQ, + by simp [GraphWalk.IsSimple, GraphWalk.support], + by ext x; simp [GraphWalk.support], by ext e; simp [GraphWalk.edges]⟩ + +/-- Deleting an edge from a rural neighborhood preserves `IsRural` +(Graph Minors IX, Section 9, Claim (3), page 62). -/ +theorem rural_deleteEdge (N : Neighborhood α β) (hrural : N.IsRural) (e : β) : + (Neighborhood.mk (deleteSingleEdge N.G e) N.Ω N.Ω₀ + N.finite_V (N.finite_E.subset (deleteSingleEdge_le N.G e).edgeSet_mono) + N.bar_subset N.bar₀_subset).IsRural := + hrural.ofSubgraph (deleteSingleEdge_le N.G e) + (by rw [vertexSet_deleteSingleEdge, inter_eq_left.mpr N.bar_subset]) + (fun _ _ _ h => h) + (by rw [vertexSet_deleteSingleEdge, inter_eq_left.mpr N.bar₀_subset]) + (fun _ _ _ h => h) + +/-- Deleting an isolated vertex `v ∉ N.Ω₀.bar` (while restricting `N.Ω` to `N.Ω.bar \ {v}`) +from a rural neighborhood preserves `IsRural` +(Graph Minors IX, Section 9, Claim (3), page 62). -/ +theorem rural_deleteIsolatedVertex (N : Neighborhood α β) (hrural : N.IsRural) {v : α} + (hv₀ : v ∉ N.Ω₀.bar) : + (Neighborhood.mk (deleteVertices N.G {v}) + (N.Ω.restrict (N.Ω.bar \ {v}) sdiff_subset) N.Ω₀ + (N.finite_V.subset (deleteVertices_le N.G {v}).vertexSet_mono) + (N.finite_E.subset (deleteVertices_le N.G {v}).edgeSet_mono) + (by rw [N.Ω.restrict_bar sdiff_subset]; exact fun z hz => ⟨N.bar_subset hz.1, hz.2⟩) + (fun z hz => ⟨N.bar₀_subset hz, fun hzv => hv₀ (hzv ▸ hz)⟩)).IsRural := + hrural.ofSubgraph (deleteVertices_le N.G {v}) + (by + change (N.Ω.restrict (N.Ω.bar \ {v}) sdiff_subset).bar = N.Ω.bar ∩ V(deleteVertices N.G {v}) + rw [N.Ω.restrict_bar sdiff_subset, vertexSet_deleteVertices] + ext z; exact ⟨fun ⟨hz, hzv⟩ => ⟨hz, N.bar_subset hz, hzv⟩, fun ⟨hz, _, hzv⟩ => ⟨hz, hzv⟩⟩) + (fun v₁ v₂ v₃ h => ((N.Ω.isClockwise3_restrict_iff sdiff_subset).mp h).2.2.2) + (by + change N.Ω₀.bar = N.Ω₀.bar ∩ V(deleteVertices N.G {v}) + rw [vertexSet_deleteVertices] + ext z; exact ⟨fun hz => ⟨hz, N.bar₀_subset hz, fun hzv => hv₀ (hzv ▸ hz)⟩, fun ⟨hz, _⟩ => hz⟩) + (fun _ _ _ h => h) + +/-! ## Section 9 configurations and minimum weight -/ + +/-- `(N, S_comp, P_set)` is a Section 9 configuration for `(S, p)` if `N` is a rural neighborhood, +`S_comp` is the composition of `S` with `N`, and `P_set` is a crooked transaction in `S_comp` of +cardinality `≥ p` (Graph Minors IX, Section 9, (1), page 62). -/ +def IsSection9Config (S : Society α β) (p : ℕ) + (N : Neighborhood α β) (S_comp : Society α β) (P_set : Set (Graph α β)) : Prop := + S_comp.IsComposition S N ∧ N.IsRural ∧ S_comp.IsCrookedTransaction P_set ∧ p ≤ P_set.ncard + +/-- Twice the objective `|V(G₁)| + |E(G₁)| + |E(⋃ P_set)| - (1/2)|ΩBar₁|` from (2) on page 62. -/ +noncomputable def section9Weight (N : Neighborhood α β) (S_comp : Society α β) + (P_set : Set (Graph α β)) : ℕ := + 2 * V(N.G).ncard - N.Ω.bar.ncard + + 2 * (E(N.G).ncard + E(S_comp.transactionUnion P_set).ncard) + +/-- `(N, S_comp, P_set)` satisfies (1) and (2) of the proof of (9.1) (page 62): it is a Section 9 +configuration minimizing `section9Weight`. -/ +def IsMinSection9Config (S : Society α β) (p : ℕ) + (N : Neighborhood α β) (S_comp : Society α β) (P_set : Set (Graph α β)) : Prop := + IsSection9Config S p N S_comp P_set ∧ + ∀ (N' : Neighborhood α β) (S_comp' : Society α β) (P_set' : Set (Graph α β)), + IsSection9Config S p N' S_comp' P_set' → + section9Weight N S_comp P_set ≤ section9Weight N' S_comp' P_set' + +/-- If there is a Section 9 configuration for `(S, p)`, then there is one of minimum weight. -/ +theorem exists_isMinSection9Config (S : Society α β) (p : ℕ) + (hex : ∃ (N : Neighborhood α β) (S_comp : Society α β) (P_set : Set (Graph α β)), + IsSection9Config S p N S_comp P_set) : + ∃ (N : Neighborhood α β) (S_comp : Society α β) (P_set : Set (Graph α β)), + IsMinSection9Config S p N S_comp P_set := by + rcases hex with ⟨N₀, S₀, P₀, h₀⟩ + have hex_w : ∃ w : ℕ, ∃ (N : Neighborhood α β) (S_comp : Society α β) (P_set : Set (Graph α β)), + IsSection9Config S p N S_comp P_set ∧ section9Weight N S_comp P_set = w := + ⟨section9Weight N₀ S₀ P₀, N₀, S₀, P₀, h₀, rfl⟩ + classical + obtain ⟨N, S_comp, P_set, hcfg, hw⟩ := Nat.find_spec hex_w + refine ⟨N, S_comp, P_set, hcfg, fun N' S_comp' P_set' hcfg' => ?_⟩ + rw [hw]; exact Nat.find_min' hex_w ⟨N', S_comp', P_set', hcfg', rfl⟩ + +/-! ## Proof of Claim (3) (page 62) -/ + +/-- **Graph Minors IX, (9.1), Claim (3)** (page 62): +"Every edge of $G_1$ is an edge of $\bigcup \mathscr{P}$, and every vertex of $G_1$ not in $V(G)$ +is a vertex of $\bigcup \mathscr{P}$." -/ +theorem lemma_9_1_claim_3 + {S : Society α β} {p : ℕ} + {N : Neighborhood α β} {S_comp : Society α β} {P_set : Set (Graph α β)} + (hmin : IsMinSection9Config S p N S_comp P_set) : + E(N.G) ⊆ E(S_comp.transactionUnion P_set) ∧ + V(N.G) \ V(S.G) ⊆ V(S_comp.transactionUnion P_set) := by + rcases hmin with ⟨⟨hcomp, hrural, hcrooked, hcard⟩, hle_weight⟩ + obtain ⟨A, B, hfence⟩ := hcrooked.1 + have hP_le : ∀ P ∈ P_set, P ≤ S_comp.G := fun P hP => by + obtain ⟨_, _, h⟩ := hfence.1.1 P hP; exact h.1.le + have hEN_sub : E(N.G) ⊆ E(S_comp.transactionUnion P_set) := by + intro e heN; by_contra he_not_U + have he_not_S : e ∉ E(S.G) := fun heS => disjoint_right.mp hcomp.1.1.2.2.2.2 heN heS + let G₁' := deleteSingleEdge N.G e + let G_comp' := deleteSingleEdge S_comp.G e + let N' : Neighborhood α β := + ⟨G₁', N.Ω, N.Ω₀, N.finite_V, + N.finite_E.subset (deleteSingleEdge_le N.G e).edgeSet_mono, + N.bar_subset, N.bar₀_subset⟩ + let S_comp' : Society α β := + ⟨G_comp', S_comp.Ω, S_comp.finite_V, + S_comp.finite_E.subset (deleteSingleEdge_le S_comp.G e).edgeSet_mono, + S_comp.bar_subset⟩ + have hcomp' : S_comp'.IsComposition S N' := by + refine ⟨⟨⟨?_, ?_, hcomp.1.1.2.2.1, ?_, ?_⟩, hcomp.1.2⟩, hcomp.2.1, hcomp.2.2.1, hcomp.2.2.2⟩ + · rw [(Compatible.of_le_le hcomp.1.1.1 (deleteSingleEdge_le S_comp.G e)).le_iff, + edgeSet_deleteSingleEdge] + exact ⟨hcomp.1.1.1.vertexSet_mono, fun f hf => ⟨hcomp.1.1.1.edgeSet_mono hf, + fun hfe => he_not_S (hfe ▸ hf)⟩⟩ + · rw [(Compatible.of_le_le ((deleteSingleEdge_le N.G e).trans hcomp.1.1.2.1) + (deleteSingleEdge_le S_comp.G e)).le_iff, + edgeSet_deleteSingleEdge, edgeSet_deleteSingleEdge] + exact ⟨hcomp.1.1.2.1.vertexSet_mono, + fun f hf => ⟨hcomp.1.1.2.1.edgeSet_mono hf.1, hf.2⟩⟩ + · simp only [S_comp', N', G_comp', G₁', edgeSet_deleteSingleEdge] + ext f; simp only [mem_union, mem_sdiff, mem_singleton_iff] + refine ⟨?_, fun ⟨hf_comp, hfe⟩ => by + rw [← hcomp.1.1.2.2.2.1] at hf_comp; exact hf_comp.imp id (fun hfN => ⟨hfN, hfe⟩)⟩ + rintro (hfS | ⟨hfN, hfe⟩) + · exact ⟨hcomp.1.1.1.edgeSet_mono hfS, fun hfe => he_not_S (hfe ▸ hfS)⟩ + · exact ⟨hcomp.1.1.2.1.edgeSet_mono hfN, hfe⟩ + · exact hcomp.1.1.2.2.2.2.mono_right (deleteSingleEdge_le N.G e).edgeSet_mono + have hP_le' : ∀ P ∈ P_set, P ≤ S_comp'.G := by + intro P hP + rw [(Compatible.of_le_le (hP_le P hP) (deleteSingleEdge_le S_comp.G e)).le_iff, + edgeSet_deleteSingleEdge] + refine ⟨(hP_le P hP).vertexSet_mono, fun f hf => ⟨(hP_le P hP).edgeSet_mono hf, ?_⟩⟩ + intro hfe; apply he_not_U + rw [Society.transactionUnion, edgeSet_subgraphSUnion hP_le, mem_iUnion₂] + exact ⟨P, hP, hfe ▸ hf⟩ + have hcrooked' : S_comp'.IsCrookedTransaction P_set := + S_comp.isCrookedTransaction_of_omega_eq rfl hP_le hP_le' hcrooked + have hEU_eq : E(S_comp'.transactionUnion P_set) = E(S_comp.transactionUnion P_set) := by + rw [Society.transactionUnion, Society.transactionUnion, + edgeSet_subgraphSUnion hP_le', edgeSet_subgraphSUnion hP_le] + have hEN_lt : E(N'.G).ncard < E(N.G).ncard := by + change E(deleteSingleEdge N.G e).ncard < E(N.G).ncard + rw [edgeSet_deleteSingleEdge, ncard_sdiff_singleton_of_mem heN] + have : 0 < E(N.G).ncard := (ncard_pos N.finite_E).mpr ⟨e, heN⟩ + omega + have hw_le := hle_weight N' S_comp' P_set ⟨hcomp', rural_deleteEdge N hrural e, hcrooked', + hcard⟩ + unfold section9Weight at hw_le + change 2 * V(N.G).ncard - N.Ω.bar.ncard + + 2 * (E(N.G).ncard + E(S_comp.transactionUnion P_set).ncard) ≤ + 2 * V(N.G).ncard - N.Ω.bar.ncard + + 2 * (E(N'.G).ncard + E(S_comp'.transactionUnion P_set).ncard) at hw_le + rw [hEU_eq] at hw_le; omega + refine ⟨hEN_sub, fun v ⟨hvN, hv_not_S⟩ => ?_⟩ + by_contra hv_not_U + have hiso_N : ∀ e : β, ¬ N.G.Inc e v := by + intro e hinc + have heU : e ∈ E(S_comp.transactionUnion P_set) := hEN_sub hinc.edge_mem + have hinc_comp : S_comp.G.Inc e v := hinc.mono hcomp.1.1.2.1 + rw [Society.transactionUnion, edgeSet_subgraphSUnion hP_le, mem_iUnion₂] at heU + rcases heU with ⟨P, hP, heP⟩ + obtain ⟨x, y, hxyP⟩ := P.exists_isLink_of_mem_edgeSet heP + rcases hinc_comp with ⟨w, hvw_comp⟩ + rcases hvw_comp.left_eq_or_eq (hxyP.mono (hP_le P hP)) with rfl | rfl + · exact hv_not_U (mem_iUnion₂.mpr ⟨P, hP, hxyP.left_mem⟩) + · exact hv_not_U (mem_iUnion₂.mpr ⟨P, hP, hxyP.right_mem⟩) + have hiso_comp : ∀ e : β, ¬ S_comp.G.Inc e v := by + intro e ⟨w, hvw⟩ + have he_comp : e ∈ E(S_comp.G) := hvw.edge_mem + rw [← hcomp.1.1.2.2.2.1] at he_comp + rcases he_comp with heS | heN + · obtain ⟨x, y, hxyS⟩ := S.G.exists_isLink_of_mem_edgeSet heS + rcases hvw.left_eq_or_eq (hxyS.mono hcomp.1.1.1) with rfl | rfl + · exact hv_not_S hxyS.left_mem + · exact hv_not_S hxyS.right_mem + · obtain ⟨x, y, hxyN⟩ := N.G.exists_isLink_of_mem_edgeSet heN + rcases hvw.left_eq_or_eq (hxyN.mono hcomp.1.1.2.1) with rfl | rfl + · exact hiso_N e hxyN.inc_left + · exact hiso_N e hxyN.inc_right + have hv_not_Ω₀ : v ∉ N.Ω₀.bar := by + intro hv₀ + have hv_in : v ∈ V(S.G) ∩ V(N.G) := by rw [← hcomp.2.2.2, ← hcomp.2.2.1]; exact hv₀ + exact hv_not_S hv_in.1 + let Y := N.Ω.bar \ {v} + have hY_bar : Y ⊆ N.Ω.bar := sdiff_subset + have hY_comp : Y ⊆ S_comp.Ω.bar := hcomp.2.1 ▸ hY_bar + let G₁' := deleteVertices N.G {v} + let G_comp' := deleteVertices S_comp.G {v} + have hY_VN' : (N.Ω.restrict Y hY_bar).bar ⊆ V(G₁') := by + rw [N.Ω.restrict_bar hY_bar]; exact fun z hz => ⟨N.bar_subset hz.1, hz.2⟩ + have hΩ₀_VN' : N.Ω₀.bar ⊆ V(G₁') := + fun z hz => ⟨N.bar₀_subset hz, fun hzv => hv_not_Ω₀ (hzv ▸ hz)⟩ + let N' : Neighborhood α β := + ⟨G₁', N.Ω.restrict Y hY_bar, N.Ω₀, + N.finite_V.subset (deleteVertices_le N.G {v}).vertexSet_mono, + N.finite_E.subset (deleteVertices_le N.G {v}).edgeSet_mono, + hY_VN', hΩ₀_VN'⟩ + have hΩ'_Vcomp' : (S_comp.Ω.restrict Y hY_comp).bar ⊆ V(G_comp') := by + rw [S_comp.Ω.restrict_bar hY_comp]; exact fun z hz => ⟨S_comp.bar_subset (hY_comp hz), hz.2⟩ + let S_comp' : Society α β := + ⟨G_comp', S_comp.Ω.restrict Y hY_comp, + S_comp.finite_V.subset (deleteVertices_le S_comp.G {v}).vertexSet_mono, + S_comp.finite_E.subset (deleteVertices_le S_comp.G {v}).edgeSet_mono, + hΩ'_Vcomp'⟩ + have hEN'_eq : E(G₁') = E(N.G) := by + ext e; simp only [G₁', deleteVertices, edgeSet_induce, mem_ofPred_eq, mem_sdiff, + mem_singleton_iff] + refine ⟨fun ⟨x, y, hxy, _, _⟩ => hxy.edge_mem, fun he => ?_⟩ + obtain ⟨x, y, hxy⟩ := N.G.exists_isLink_of_mem_edgeSet he + exact ⟨x, y, hxy, ⟨hxy.left_mem, fun hxv => hiso_N e (hxv ▸ hxy.inc_left)⟩, + ⟨hxy.right_mem, fun hyv => hiso_N e (hyv ▸ hxy.inc_right)⟩⟩ + have hEcomp'_eq : E(G_comp') = E(S_comp.G) := by + ext e; simp only [G_comp', deleteVertices, edgeSet_induce, mem_ofPred_eq, mem_sdiff, + mem_singleton_iff] + refine ⟨fun ⟨x, y, hxy, _, _⟩ => hxy.edge_mem, fun he => ?_⟩ + obtain ⟨x, y, hxy⟩ := S_comp.G.exists_isLink_of_mem_edgeSet he + exact ⟨x, y, hxy, ⟨hxy.left_mem, fun hxv => hiso_comp e (hxv ▸ hxy.inc_left)⟩, + ⟨hxy.right_mem, fun hyv => hiso_comp e (hyv ▸ hxy.inc_right)⟩⟩ + have hcomp' : S_comp'.IsComposition S N' := by + refine ⟨⟨⟨?_, ?_, ?_, ?_, ?_⟩, ?_⟩, ?_, hcomp.2.2.1, ?_⟩ + · rw [(Compatible.of_le_le hcomp.1.1.1 (deleteVertices_le S_comp.G {v})).le_iff] + exact ⟨fun z hz => ⟨hcomp.1.1.1.vertexSet_mono hz, fun hzv => hv_not_S (hzv ▸ hz)⟩, + hEcomp'_eq.symm ▸ hcomp.1.1.1.edgeSet_mono⟩ + · rw [(Compatible.of_le_le ((deleteVertices_le N.G {v}).trans hcomp.1.1.2.1) + (deleteVertices_le S_comp.G {v})).le_iff] + exact ⟨fun z hz => ⟨hcomp.1.1.2.1.vertexSet_mono hz.1, hz.2⟩, + hEcomp'_eq.symm ▸ hEN'_eq.symm ▸ hcomp.1.1.2.1.edgeSet_mono⟩ + · ext z; change z ∈ V(S.G) ∪ (V(N.G) \ {v}) ↔ z ∈ V(S_comp.G) \ {v} + simp only [mem_union, mem_sdiff, mem_singleton_iff] + refine ⟨?_, fun ⟨hz_comp, hzv⟩ => by + rw [← hcomp.1.1.2.2.1] at hz_comp; exact hz_comp.imp id (fun hzN => ⟨hzN, hzv⟩)⟩ + rintro (hzS | ⟨hzN, hzv⟩) + · exact ⟨hcomp.1.1.1.vertexSet_mono hzS, fun hzv => hv_not_S (hzv ▸ hzS)⟩ + · exact ⟨hcomp.1.1.2.1.vertexSet_mono hzN, hzv⟩ + · rw [hEN'_eq, hEcomp'_eq]; exact hcomp.1.1.2.2.2.1 + · rw [hEN'_eq]; exact hcomp.1.1.2.2.2.2 + · change (S_comp.Ω.restrict Y hY_comp).bar ⊆ V(G₁') + rw [S_comp.Ω.restrict_bar hY_comp, ← N.Ω.restrict_bar hY_bar]; exact hY_VN' + · change N.Ω.restrict Y hY_bar = S_comp.Ω.restrict Y hY_comp; simp_rw [← hcomp.2.1] + · ext z; change z ∈ S.Ω.bar ↔ z ∈ V(S.G) ∧ (z ∈ V(N.G) ∧ z ≠ v) + rw [hcomp.2.2.2, mem_inter_iff] + exact ⟨fun ⟨hzS, hzN⟩ => ⟨hzS, hzN, fun hzv => hv_not_S (hzv ▸ hzS)⟩, + fun ⟨hzS, hzN, _⟩ => ⟨hzS, hzN⟩⟩ + have hP_le' : ∀ P ∈ P_set, P ≤ S_comp'.G := by + intro P hP + rw [(Compatible.of_le_le (hP_le P hP) (deleteVertices_le S_comp.G {v})).le_iff] + exact ⟨fun z hz => ⟨(hP_le P hP).vertexSet_mono hz, + fun hzv => hv_not_U (mem_iUnion₂.mpr ⟨P, hP, hzv ▸ hz⟩)⟩, + hEcomp'_eq.symm ▸ (hP_le P hP).edgeSet_mono⟩ + have hends_Y : S_comp.transactionEnds P_set ⊆ Y := by + rintro z ⟨P, hP, b, hP_e⟩ + exact ⟨hcomp.2.1 ▸ hP_e.2.2.1, + fun hzv => hv_not_U (mem_iUnion₂.mpr ⟨P, hP, hzv ▸ hP_e.1.left_mem⟩)⟩ + have hcrooked' : S_comp'.IsCrookedTransaction P_set := + (S_comp.restrictOmega Y hY_comp).isCrookedTransaction_of_omega_eq rfl hP_le hP_le' + ((S_comp.isCrookedTransaction_restrictOmega_iff hY_comp).mpr ⟨hcrooked, hends_Y⟩) + have hEU_eq : E(S_comp'.transactionUnion P_set) = E(S_comp.transactionUnion P_set) := by + rw [Society.transactionUnion, Society.transactionUnion, + edgeSet_subgraphSUnion hP_le', edgeSet_subgraphSUnion hP_le] + have hVN'_eq : V(N'.G).ncard + 1 = V(N.G).ncard := + ncard_sdiff_singleton_add_one hvN N.finite_V + have hbar'_le : N.Ω.bar.ncard ≤ N'.Ω.bar.ncard + 1 := by + change N.Ω.bar.ncard ≤ (N.Ω.restrict Y hY_bar).bar.ncard + 1 + rw [N.Ω.restrict_bar hY_bar] + change N.Ω.bar.ncard ≤ (N.Ω.bar \ {v}).ncard + 1 + by_cases hv_bar : v ∈ N.Ω.bar + · rw [ncard_sdiff_singleton_add_one hv_bar N.Ω.finite_bar] + · rw [sdiff_eq_left.mpr (disjoint_singleton_right.mpr hv_bar)]; omega + have hVN'_ge_bar' : N'.Ω.bar.ncard ≤ V(N'.G).ncard := ncard_le_ncard N'.bar_subset N'.finite_V + have hw_le := hle_weight N' S_comp' P_set + ⟨hcomp', rural_deleteIsolatedVertex N hrural hv_not_Ω₀, hcrooked', hcard⟩ + unfold section9Weight at hw_le + have hEN_ncard : E(N'.G).ncard = E(N.G).ncard := by + change E(G₁').ncard = E(N.G).ncard; rw [hEN'_eq] + rw [hEN_ncard, hEU_eq] at hw_le; omega + +/-! ## Proof of Claim (4) (page 62) -/ + +/-- If `c ∈ pathInternalVerts S.G P ∩ S.Ω.bar` for some `P ∈ P_set` in a transaction `P_set`, then +`singleVertexSubgraph S.G c` is an attachment to `P_set` with foot `c` and leg `P`. -/ +theorem isAttachmentWithEnds_singleVertexSubgraph (S : Society α β) + {P_set : Set (Graph α β)} {P : Graph α β} {c : α} + (hdisj : S.IsDisjointOmegaPathSet P_set) (hP_in : P ∈ P_set) + (hc_int : c ∈ pathInternalVerts S.G P) (hc_bar : c ∈ S.Ω.bar) : + S.IsAttachmentWithEnds P_set (singleVertexSubgraph S.G c) c c := by + obtain ⟨a, b, hP_ends⟩ := hdisj.1 P hP_in + have hcP : c ∈ V(P) := hc_int.1 + have hcG : c ∈ V(S.G) := hP_ends.1.le.vertexSet_mono hcP + have hcU : c ∈ V(S.transactionUnion P_set) := mem_iUnion₂.mpr ⟨P, hP_in, hcP⟩ + have hc_not_ends : c ∉ S.transactionEnds P_set := by + rintro ⟨R, hR_in, d, hR_ends⟩ + by_cases hRP : R = P + · subst hRP; exact hc_int.2 ⟨d, hR_ends.1⟩ + · exact disjoint_left.mp (hdisj.2 hP_in hR_in (Ne.symm hRP)) hcP hR_ends.1.left_mem + exact ⟨isGraphPathWithEnds_singleVertexSubgraph hcG, by ext z; simp [hcU], + by ext z; simp [hc_bar, hc_not_ends]⟩ + +/-- If `singleVertexSubgraph S.G c` (`c ∈ pathInternalVerts S.G P ∩ S.Ω.bar`, `P ∈ P_set`) is an +exchangeable attachment to a crooked transaction `P_set`, then there is a crooked transaction +`P_set'` of the same cardinality with strictly fewer edges in `⋃ P_set'`. -/ +theorem exists_lt_edges_of_isExchangeable_singleVertex (S : Society α β) + {P_set : Set (Graph α β)} {P : Graph α β} {c : α} + (hcrooked : S.IsCrookedTransaction P_set) (hP_in : P ∈ P_set) + (hc_int : c ∈ pathInternalVerts S.G P) (hc_bar : c ∈ S.Ω.bar) + (hexch : S.IsExchangeableAttachment P_set (singleVertexSubgraph S.G c)) : + ∃ P_set' : Set (Graph α β), S.IsCrookedTransaction P_set' ∧ + P_set'.ncard = P_set.ncard ∧ + E(S.transactionUnion P_set').ncard < E(S.transactionUnion P_set).ncard := by + obtain ⟨A, B, hfence⟩ := hcrooked.1 + let Q_c := singleVertexSubgraph S.G c + have hatt_c : S.IsAttachmentWithEnds P_set Q_c c c := + isAttachmentWithEnds_singleVertexSubgraph S hfence.1 hP_in hc_int hc_bar + rcases hexch with ⟨_, L, L', ⟨hL_in, b, u, a₁, b₁, hatt_bu, hbL, hL_ends, Q, hQ_or, rfl⟩, hcr'⟩ + have hbc : b = c := by + have hbQ : b ∈ V(Q_c) := hatt_bu.1.left_mem + rwa [vertexSet_singleVertexSubgraph, mem_singleton_iff] at hbQ + have huc : u = c := by + have huQ : u ∈ V(Q_c) := hatt_bu.1.right_mem + rwa [vertexSet_singleVertexSubgraph, mem_singleton_iff] at huQ + rcases hbc with rfl; rcases huc with rfl + have hLP : L = P := by + by_contra hne; exact disjoint_left.mp (hfence.1.2 hL_in hP_in hne) hbL hc_int.1 + subst hLP + let P_set' := (P_set \ {L}) ∪ {subgraphUnion S.G Q_c Q} + have hnot_diff : subgraphUnion S.G Q_c Q ∉ P_set \ {L} := + Society.IsAttachmentWithEnds.subgraphUnion_not_mem_sdiff S hfence.1 hatt_c hL_in hbL + have hfin_P : P_set.Finite := hfence.1.finite S + have hcard_eq : P_set'.ncard = P_set.ncard := by + change ((P_set \ {L}) ∪ {subgraphUnion S.G Q_c Q}).ncard = P_set.ncard + rw [union_comm, ← insert_eq, ncard_insert_of_notMem hnot_diff (hfin_P.subset sdiff_subset), + ncard_sdiff_singleton_add_one hL_in hfin_P] + have hR_le : ∀ R ∈ P_set, R ≤ S.G := fun R hR => by + obtain ⟨_, _, h⟩ := hfence.1.1 R hR; exact h.1.le + have hQc_le : Q_c ≤ S.G := hatt_c.1.le + have hQ_L : Q ≤ L := by rcases hQ_or with h | h <;> exact h.le + have hQ_le : Q ≤ S.G := hQ_L.trans (hR_le L hL_in) + have hL'_le : subgraphUnion S.G Q_c Q ≤ S.G := subgraphUnion_le hQc_le hQ_le + have hR'_le : ∀ R ∈ P_set', R ≤ S.G := by rintro R (hR | rfl); exacts [hR_le R hR.1, hL'_le] + have hca₁ : u ≠ a₁ := fun h => hc_int.2 (h ▸ ⟨b₁, hL_ends.1⟩) + have hcb₁ : u ≠ b₁ := fun h => hc_int.2 (h ▸ ⟨a₁, hL_ends.1.symm⟩) + have hex_missing : ∃ e₀ ∈ E(L), e₀ ∉ E(Q) := by + by_contra! hall + have hEQ_eq : E(Q) = E(L) := Subset.antisymm hQ_L.edgeSet_mono hall + have hVQ_eq : V(Q) = V(L) := by + refine Subset.antisymm hQ_L.vertexSet_mono (fun v hvL => ?_) + obtain ⟨e, heL, _, hlink⟩ := hL_ends.1.exists_inc_of_mem_of_ne hL_ends.2.1 hvL + obtain ⟨x, y, hxyQ⟩ := Q.exists_isLink_of_mem_edgeSet (hEQ_eq ▸ heL) + rcases hlink.left_eq_or_eq (hxyQ.mono hQ_L) with rfl | rfl + · exact hxyQ.left_mem + · exact hxyQ.right_mem + have hQL_eq : Q = L := (Compatible.of_le_le hQ_L le_rfl).ext hVQ_eq hEQ_eq + subst hQL_eq + rcases hQ_or with hQ_ba₁ | hQ_bb₁ + · rcases (hQ_ba₁.mono hL_ends.1.le).ends_eq hL_ends.1 with ⟨h1, _⟩ | ⟨_, h2⟩ + · exact hca₁ h1.symm + · exact hcb₁ h2.symm + · rcases (hQ_bb₁.mono hL_ends.1.le).ends_eq hL_ends.1 with ⟨h1, _⟩ | ⟨_, h2⟩ + · exact hca₁ h1.symm + · exact hcb₁ h2.symm + obtain ⟨e₀, he₀_L, he₀_not_Q⟩ := hex_missing + have hE_sub : E(S.transactionUnion P_set') ⊆ E(S.transactionUnion P_set) := by + rw [Society.transactionUnion, Society.transactionUnion, + edgeSet_subgraphSUnion hR'_le, edgeSet_subgraphSUnion hR_le] + intro e he; rw [mem_iUnion₂] at he ⊢ + rcases he with ⟨R, hR | rfl, heR⟩ + · exact ⟨R, hR.1, heR⟩ + · rw [edgeSet_subgraphUnion hQc_le hQ_le, edgeSet_singleVertexSubgraph, empty_union] at heR + exact ⟨L, hL_in, hQ_L.edgeSet_mono heR⟩ + have he₀_in_U : e₀ ∈ E(S.transactionUnion P_set) := by + rw [Society.transactionUnion, edgeSet_subgraphSUnion hR_le, mem_iUnion₂]; exact ⟨L, hL_in, + he₀_L⟩ + have he₀_not_U' : e₀ ∉ E(S.transactionUnion P_set') := by + rw [Society.transactionUnion, edgeSet_subgraphSUnion hR'_le, mem_iUnion₂] + rintro ⟨R, hR | rfl, he₀R⟩ + · obtain ⟨x, y, hxyL⟩ := L.exists_isLink_of_mem_edgeSet he₀_L + obtain ⟨u_R, v_R, huvR⟩ := R.exists_isLink_of_mem_edgeSet he₀R + have hne_LR : L ≠ R := fun h => hR.2 h.symm + rcases (hxyL.mono (hR_le L hL_in)).left_eq_or_eq (huvR.mono (hR_le R hR.1)) with rfl | rfl + · exact disjoint_left.mp (hfence.1.2 hL_in hR.1 hne_LR) hxyL.left_mem huvR.left_mem + · exact disjoint_left.mp (hfence.1.2 hL_in hR.1 hne_LR) hxyL.left_mem huvR.right_mem + · rw [edgeSet_subgraphUnion hQc_le hQ_le, edgeSet_singleVertexSubgraph, empty_union] at he₀R + exact he₀_not_Q he₀R + have hEU_fin : E(S.transactionUnion P_set).Finite := + S.finite_E.subset (subgraphSUnion_le hR_le).edgeSet_mono + exact ⟨P_set', hcr', hcard_eq, + ncard_lt_ncard ⟨hE_sub, fun h_all => he₀_not_U' (h_all he₀_in_U)⟩ hEU_fin⟩ + +/-- First part of Claim (4) (page 62): in a minimum-weight Section 9 configuration, each `P ∈ P_set` +has at most one internal vertex in `S_comp.Ω.bar`, and for such a vertex `c`, `P` is an overpass of +`P_set` and both subpaths `Q₁, Q₂` of `P` from `c` to the ends of `P` are non-separating `Ω`-paths +in `S_comp`. -/ +theorem lemma_9_1_claim_4_nonSeparating {S : Society α β} {p : ℕ} + {N : Neighborhood α β} {S_comp : Society α β} {P_set : Set (Graph α β)} + (hmin : IsMinSection9Config S p N S_comp P_set) {P : Graph α β} (hP_in : P ∈ P_set) : + (pathInternalVerts S_comp.G P ∩ S_comp.Ω.bar).Subsingleton ∧ + ∀ c ∈ pathInternalVerts S_comp.G P ∩ S_comp.Ω.bar, S_comp.IsOverpass P_set P ∧ + ∀ {a b : α} {Q : Graph α β}, S_comp.IsOmegaPathWithEnds P a b → Q ≤ P → + (IsGraphPathWithEnds P Q c a ∨ IsGraphPathWithEnds P Q c b) → + S_comp.IsNonSeparatingOmegaPath Q := by + rcases hmin with ⟨⟨hcomp, hrural, hcrooked, hcard⟩, hle_weight⟩ + obtain ⟨A, B, hfence⟩ := hcrooked.1 + have hR_le : ∀ R ∈ P_set, R ≤ S_comp.G := fun R hR => by + obtain ⟨_, _, h⟩ := hfence.1.1 R hR; exact h.1.le + have hnot_exch : ∀ c ∈ pathInternalVerts S_comp.G P ∩ S_comp.Ω.bar, + ¬ S_comp.IsExchangeableAttachment P_set (singleVertexSubgraph S_comp.G c) := by + intro c ⟨hc_int, hc_bar⟩ hexch + obtain ⟨P_set', hcr', hcard', hlt_E⟩ := + exists_lt_edges_of_isExchangeable_singleVertex S_comp hcrooked hP_in hc_int hc_bar hexch + have hw_le := hle_weight N S_comp P_set' ⟨hcomp, hrural, hcr', hcard' ▸ hcard⟩ + unfold section9Weight at hw_le; omega + have hsub : (pathInternalVerts S_comp.G P ∩ S_comp.Ω.bar).Subsingleton := by + intro c₁ hc₁ c₂ hc₂; by_contra hc12 + let Q₁ := singleVertexSubgraph S_comp.G c₁ + let Q₂ := singleVertexSubgraph S_comp.G c₂ + have hatt₁ : S_comp.IsAttachment P_set Q₁ := + ⟨c₁, c₁, isAttachmentWithEnds_singleVertexSubgraph S_comp hfence.1 hP_in hc₁.1 hc₁.2⟩ + have hatt₂ : S_comp.IsAttachment P_set Q₂ := + ⟨c₂, c₂, isAttachmentWithEnds_singleVertexSubgraph S_comp hfence.1 hP_in hc₂.1 hc₂.2⟩ + have hdisj_12 : Disjoint V(Q₁) V(Q₂) := by simp [Q₁, Q₂, hc12] + obtain ⟨P₁, hP₁_in, _, _, _, b, b', hb_foot, hbP₁, hb'_foot, hb'P₁, + M, hMP₁, hM_path, P_set', hcr', hcard', hunion_le, hdisj_EM⟩ := + S_comp.theorem_3_3_proof hcrooked hatt₁ (hnot_exch c₁ hc₁) hatt₂ (hnot_exch c₂ hc₂) hdisj_12 + have hbc₁ : b = c₁ := by + rcases hb_foot with ⟨u, hatt_bu⟩; have hbQ₁ : b ∈ V(Q₁) := hatt_bu.1.left_mem + rwa [vertexSet_singleVertexSubgraph, mem_singleton_iff] at hbQ₁ + have hb'c₂ : b' = c₂ := by + rcases hb'_foot with ⟨u', hatt'_b'u'⟩; have hb'Q₂ : b' ∈ V(Q₂) := hatt'_b'u'.1.left_mem + rwa [vertexSet_singleVertexSubgraph, mem_singleton_iff] at hb'Q₂ + obtain ⟨e_M, he_M, _⟩ := hM_path.exists_inc_left_of_ne (hbc₁.symm ▸ hb'c₂.symm ▸ hc12) + have hU_le : S_comp.transactionUnion P_set ≤ S_comp.G := subgraphSUnion_le hR_le + have hQ₁_le : Q₁ ≤ S_comp.G := + singleVertexSubgraph_le ((hR_le P hP_in).vertexSet_mono hc₁.1.1) + have hQ₂_le : Q₂ ≤ S_comp.G := + singleVertexSubgraph_le ((hR_le P hP_in).vertexSet_mono hc₂.1.1) + have hQ12_le : subgraphUnion S_comp.G Q₁ Q₂ ≤ S_comp.G := subgraphUnion_le hQ₁_le hQ₂_le + have hE_sub : E(S_comp.transactionUnion P_set') ⊆ E(S_comp.transactionUnion P_set) := by + intro e he; have he' := hunion_le.edgeSet_mono he + rw [edgeSet_subgraphUnion hU_le hQ12_le, edgeSet_subgraphUnion hQ₁_le hQ₂_le, + edgeSet_singleVertexSubgraph, edgeSet_singleVertexSubgraph, union_self, union_empty] at he' + exact he' + have heM_in_U : e_M ∈ E(S_comp.transactionUnion P_set) := by + rw [Society.transactionUnion, edgeSet_subgraphSUnion hR_le, mem_iUnion₂] + exact ⟨P₁, hP₁_in, hMP₁.edgeSet_mono he_M⟩ + have heM_not_U' : e_M ∉ E(S_comp.transactionUnion P_set') := disjoint_left.mp hdisj_EM he_M + have hlt_E : E(S_comp.transactionUnion P_set').ncard < + E(S_comp.transactionUnion P_set).ncard := + ncard_lt_ncard ⟨hE_sub, fun h_all => heM_not_U' (h_all heM_in_U)⟩ + (S_comp.finite_E.subset hU_le.edgeSet_mono) + have hw_le := hle_weight N S_comp P_set' ⟨hcomp, hrural, hcr', by omega⟩ + unfold section9Weight at hw_le; omega + refine ⟨hsub, fun c hc => ?_⟩ + let Q_c := singleVertexSubgraph S_comp.G c + have hatt_cc : S_comp.IsAttachmentWithEnds P_set Q_c c c := + isAttachmentWithEnds_singleVertexSubgraph S_comp hfence.1 hP_in hc.1 hc.2 + obtain ⟨_, P₁, hleg, hover⟩ := + S_comp.theorem_3_2_proof hcrooked ⟨c, c, hatt_cc⟩ (hnot_exch c hc) + have hP₁_eq : P₁ = P := by + rcases hleg with ⟨hP₁_in, b, ⟨u, hatt_bu⟩, hbP₁⟩ + have hbc : b = c := by + have hbQ : b ∈ V(Q_c) := hatt_bu.1.left_mem + rwa [vertexSet_singleVertexSubgraph, mem_singleton_iff] at hbQ + subst hbc; by_contra hne; exact disjoint_left.mp (hfence.1.2 hP₁_in hP_in hne) hbP₁ hc.1.1 + subst hP₁_eq + refine ⟨hover, fun {a b Q} hP_ends hQP hQ_or => ?_⟩ + obtain ⟨a₁_raw, ha₁_raw, b₁_raw, hb₁_raw, hP_ends_raw⟩ := hfence.2.2 P₁ hP_in + rcases hover with ⟨_, _, R₁, hR₁_in, R₂, hR₂_in, hR12, hper₁, hper₂⟩ + obtain ⟨x₁, hx₁, y₁, hy₁, hR₁_ends⟩ := hfence.2.2 R₁ hR₁_in.1 + obtain ⟨x₂, hx₂, y₂, hy₂, hR₂_ends⟩ := hfence.2.2 R₂ hR₂_in.1 + let W' := S_comp.transactionEnds (P_set \ {P₁}) + have hW'_bar : W' ⊆ S_comp.Ω.bar := S_comp.transactionEnds_subset_bar (P_set \ {P₁}) + have hx₁W' : x₁ ∈ A ∩ W' := ⟨hx₁, hR₁_ends.mem_transactionEnds_left S_comp hR₁_in⟩ + have hy₁W' : y₁ ∈ B ∩ W' := ⟨hy₁, hR₁_ends.mem_transactionEnds_right S_comp hR₁_in⟩ + have hx₂W' : x₂ ∈ A ∩ W' := ⟨hx₂, hR₂_ends.mem_transactionEnds_left S_comp hR₂_in⟩ + have hy₂W' : y₂ ∈ B ∩ W' := ⟨hy₂, hR₂_ends.mem_transactionEnds_right S_comp hR₂_in⟩ + have hper₁' := (hR₁_ends.isPeripheralIn_iff S_comp hR₁_in).mp hper₁ + have hper₂' := (hR₂_ends.isPeripheralIn_iff S_comp hR₂_in).mp hper₂ + have hdisj_R12 : Disjoint V(R₁) V(R₂) := hfence.1.2 hR₁_in.1 hR₂_in.1 hR12 + have hx12 : x₁ ≠ x₂ := + fun h => disjoint_left.mp hdisj_R12 hR₁_ends.1.left_mem (h ▸ hR₂_ends.1.left_mem) + have hy12 : y₁ ≠ y₂ := + fun h => disjoint_left.mp hdisj_R12 hR₁_ends.1.right_mem (h ▸ hR₂_ends.1.right_mem) + have hex_boundary : + ∃ a_0 ∈ A ∩ W', ∃ a'_0 ∈ A ∩ W', ∃ b_0 ∈ B ∩ W', ∃ b'_0 ∈ B ∩ W', + Disjoint (S_comp.Ω.interval a'_0 b_0) W' ∧ + Disjoint (S_comp.Ω.interval b'_0 a_0) W' ∧ + (∃ R_ab ∈ P_set \ {P₁}, S_comp.IsOmegaPathWithEnds R_ab a'_0 b_0) ∧ + (∃ R_ba ∈ P_set \ {P₁}, S_comp.IsOmegaPathWithEnds R_ba a_0 b'_0) := by + rcases hper₁' with hd₁ | hd₁ <;> rcases hper₂' with hd₂ | hd₂ + · exact (hx12 (S_comp.Ω.unique_empty_interval_AB_of_isFence hfence.2.1 hW'_bar + hx₁W' hy₁W' hx₂W' hy₂W' hd₁ hd₂).1).elim + · exact ⟨x₂, hx₂W', x₁, hx₁W', y₁, hy₁W', y₂, hy₂W', hd₁, hd₂, + ⟨R₁, hR₁_in, hR₁_ends⟩, ⟨R₂, hR₂_in, hR₂_ends⟩⟩ + · exact ⟨x₁, hx₁W', x₂, hx₂W', y₂, hy₂W', y₁, hy₁W', hd₂, hd₁, + ⟨R₂, hR₂_in, hR₂_ends⟩, ⟨R₁, hR₁_in, hR₁_ends⟩⟩ + · exact (hy12 (S_comp.Ω.unique_empty_interval_AB_of_isFence hfence.2.1.symm hW'_bar + hy₁W' hx₁W' hy₂W' hx₂W' hd₁ hd₂).1).elim + obtain ⟨a_0, ha_0, a'_0, ha'_0, b_0, hb_0, b'_0, hb'_0, hd_ab, hd_ba, + ⟨R_ab, hR_ab_in, hR_ab_ends⟩, ⟨R_ba, hR_ba_in, hR_ba_ends⟩⟩ := hex_boundary + have h_e_G₁ := S_comp.mem_interval_of_peripheral_diff_singleton hfence hcrooked hP_in hR_ab_in + ha₁_raw hb₁_raw hP_ends_raw ha'_0.1 hb_0.1 hR_ab_ends hd_ab + have hfence_BA : S_comp.IsFenceFor P_set B A := + ⟨hfence.1, hfence.2.1.symm, fun R hR => by + obtain ⟨a_e, ha_e, b_e, hb_e, hR_e⟩ := hfence.2.2 R hR + exact ⟨b_e, hb_e, a_e, ha_e, hR_e.symm S_comp⟩⟩ + have h_e_G₂ := S_comp.mem_interval_of_peripheral_diff_singleton hfence_BA hcrooked hP_in hR_ba_in + hb₁_raw ha₁_raw (hP_ends_raw.symm S_comp) hb'_0.1 ha_0.1 (hR_ba_ends.symm S_comp) hd_ba + obtain ⟨_, _, hG₂_sub, hG₁_sub, hdisj_P, _⟩ := + Society.four_arc_partition hfence.2.1 hW'_bar ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + have hdisj_G₁G₂ : Disjoint (S_comp.Ω.interval a'_0 b_0) (S_comp.Ω.interval b'_0 a_0) := + hdisj_P.symm.mono (hG₁_sub.trans subset_union_right) (hG₂_sub.trans subset_union_right) + have hex_ends : ∃ e₁ e₂ : α, S_comp.IsOmegaPathWithEnds P₁ e₁ e₂ ∧ + e₁ ∈ S_comp.Ω.interval a'_0 b_0 ∧ e₂ ∈ S_comp.Ω.interval b'_0 a_0 := by + rcases h_e_G₁ with ⟨ha₁_G₁, _⟩ | ⟨hb₁_G₁, _⟩ <;> + rcases h_e_G₂ with ⟨hb₁_G₂, _⟩ | ⟨ha₁_G₂, _⟩ + · exact ⟨a₁_raw, b₁_raw, hP_ends_raw, ha₁_G₁, hb₁_G₂⟩ + · exact (disjoint_left.mp hdisj_G₁G₂ ha₁_G₁ ha₁_G₂).elim + · exact (disjoint_left.mp hdisj_G₁G₂ hb₁_G₁ hb₁_G₂).elim + · exact ⟨b₁_raw, a₁_raw, hP_ends_raw.symm S_comp, hb₁_G₁, ha₁_G₂⟩ + obtain ⟨e₁, e₂, hP_e12, he₁_G₁, he₂_G₂⟩ := hex_ends + have hc_gaps := S_comp.end_not_mem_gaps_of_not_exchangeable hcrooked hfence hatt_cc + (hnot_exch c hc) hP_in hc.1.1 hP_e12 W' rfl ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba he₁_G₁ he₂_G₂ + have hc_not_W' : c ∉ W' := fun hcW' => + hatt_cc.end_not_mem_transactionEnds S_comp + (by rcases hcW' with ⟨R, hR, d, hR_e⟩; exact ⟨R, hR.1, d, hR_e⟩) + have hc_b0a'0 : c ∈ S_comp.Ω.interval b_0 a'_0 := by + have ha'_ne_b0 : a'_0 ≠ b_0 := fun h => disjoint_left.mp hfence.2.1.2.2.1 ha'_0.1 (h ▸ hb_0.1) + exact (S_comp.Ω.mem_interval_or_interval_swap (hW'_bar ha'_0.2) (hW'_bar hb_0.2) hc.2 + ha'_ne_b0 (fun h => hc_not_W' (h ▸ ha'_0.2)) (fun h => hc_not_W' + (h ▸ hb_0.2))).resolve_left hc_gaps.1 + have hc_a0b'0 : c ∈ S_comp.Ω.interval a_0 b'_0 := by + have hb'_ne_a0 : b'_0 ≠ a_0 := fun h => disjoint_left.mp hfence.2.1.2.2.1 ha_0.1 (h ▸ hb'_0.1) + exact (S_comp.Ω.mem_interval_or_interval_swap (hW'_bar hb'_0.2) (hW'_bar ha_0.2) hc.2 + hb'_ne_a0 (fun h => hc_not_W' (h ▸ hb'_0.2)) (fun h => hc_not_W' + (h ▸ ha_0.2))).resolve_left hc_gaps.2 + have hce₁ : c ≠ e₁ := fun h => hc.1.2 (h ▸ ⟨e₂, hP_e12.1⟩) + have hce₂ : c ≠ e₂ := fun h => hc.1.2 (h ▸ ⟨e₁, hP_e12.1.symm⟩) + have hQ_ends_e : IsGraphPathWithEnds P₁ Q c e₁ ∨ IsGraphPathWithEnds P₁ Q c e₂ := by + rcases hP_ends.ends_eq S_comp hP_e12 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩; exacts [hQ_or, hQ_or.symm] + rcases hQ_ends_e with hQ_ce₁ | hQ_ce₂ + · have hQ_omega : S_comp.IsOmegaPathWithEnds Q c e₁ := + ⟨hQ_ce₁.mono hP_e12.1.le, hce₁, hc.2, hP_e12.2.2.1⟩ + exact ⟨⟨c, e₁, hQ_omega⟩, R_ab, + (hfence.1.2 hR_ab_in.1 hP_in hR_ab_in.2).mono_right hQP.vertexSet_mono, + a'_0, b_0, c, e₁, hR_ab_ends, hQ_omega, + S_comp.Ω.crosses_iff_interval.mpr (Or.inr ⟨he₁_G₁, hc_b0a'0⟩)⟩ + · have hQ_omega : S_comp.IsOmegaPathWithEnds Q c e₂ := + ⟨hQ_ce₂.mono hP_e12.1.le, hce₂, hc.2, hP_e12.2.2.2⟩ + exact ⟨⟨c, e₂, hQ_omega⟩, R_ba, + (hfence.1.2 hR_ba_in.1 hP_in hR_ba_in.2).mono_right hQP.vertexSet_mono, + a_0, b'_0, c, e₂, hR_ba_ends, hQ_omega, + S_comp.Ω.crosses_iff_interval.mpr (Or.inl ⟨hc_a0b'0, he₂_G₂⟩)⟩ + +/-- If `Q ≤ S_comp.G` is a path of positive length (has ends `x ≠ y`) in a composition +`S_comp.IsComposition S N` and `¬ Q ≤ N.G`, then `Q` has an edge in `E(S.G)`. -/ +theorem nonempty_edgeSet_inter_of_not_le_right {S S_comp : Society α β} {N : Neighborhood α β} + {Q : Graph α β} {x y : α} (hcomp : S_comp.IsComposition S N) + (hQ : IsGraphPathWithEnds S_comp.G Q x y) (hxy : x ≠ y) (hnot_le : ¬ Q ≤ N.G) : + (E(Q) ∩ E(S.G)).Nonempty := by + by_contra h_empty + rw [not_nonempty_iff_eq_empty, ← disjoint_iff_inter_eq_empty] at h_empty + apply hnot_le; rw [(Compatible.of_le_le hQ.le hcomp.1.1.2.1).le_iff] + have hEQ : E(Q) ⊆ E(N.G) := fun e heQ => by + have he_comp : e ∈ E(S_comp.G) := hQ.le.edgeSet_mono heQ + rw [← hcomp.1.1.2.2.2.1] at he_comp + exact he_comp.resolve_left (fun heS => disjoint_left.mp h_empty heQ heS) + refine ⟨fun v hvQ => ?_, hEQ⟩ + obtain ⟨e, heQ, z, hvzQ⟩ := hQ.exists_inc_of_mem_of_ne hxy hvQ + obtain ⟨u, w, huwN⟩ := N.G.exists_isLink_of_mem_edgeSet (hEQ heQ) + rcases (hvzQ.mono hQ.le).left_eq_or_eq (huwN.mono hcomp.1.1.2.1) with rfl | rfl + · exact huwN.left_mem + · exact huwN.right_mem + +/-- Any two points `p₁, p₂` in a closed disc `Δ₀ ⊆ EuclideanPlane` are joined by a compact +connected subset `K₀ ⊆ Δ₀` that meets `subBd Δ₀` only in `{p₁, p₂}`. -/ +theorem exists_compact_connected_in_disc_avoiding_bd {Δ₀ : Set EuclideanPlane} + (hΔ₀ : IsClosedDisc Δ₀) {p₁ p₂ : EuclideanPlane} (hp₁ : p₁ ∈ Δ₀) (hp₂ : p₂ ∈ Δ₀) : + ∃ K₀ : Set EuclideanPlane, IsCompact K₀ ∧ IsConnected K₀ ∧ + p₁ ∈ K₀ ∧ p₂ ∈ K₀ ∧ K₀ ⊆ Δ₀ ∧ K₀ ⊆ {p₁, p₂} ∪ interior Δ₀ := by + obtain ⟨ψ₀⟩ := hΔ₀ + let z₁ : ClosedUnitDisc := ψ₀.symm ⟨p₁, hp₁⟩ + let z₂ : ClosedUnitDisc := ψ₀.symm ⟨p₂, hp₂⟩ + let clamp (t : ℝ) : ℝ := max 0 (min 1 t) + have hclamp_cont : Continuous clamp := + continuous_const.max (continuous_const.min continuous_id) + have hclamp_mem : ∀ (z : ClosedUnitDisc) (t : ℝ), + clamp t • z.1 ∈ ClosedUnitDisc := by + intro z t + change clamp t • z.1 ∈ Metric.closedBall (0 : EuclideanPlane) 1 + rw [Metric.mem_closedBall, dist_zero_right, norm_smul, Real.norm_eq_abs] + have h0 : 0 ≤ clamp t := le_max_left 0 _ + have h1 : clamp t ≤ 1 := max_le (by norm_num) (min_le_left 1 t) + have hz1 : ‖z.1‖ ≤ 1 := by + have hz : z.1 ∈ Metric.closedBall (0 : EuclideanPlane) 1 := z.2 + rwa [Metric.mem_closedBall, dist_zero_right] at hz + rw [abs_of_nonneg h0] + exact (mul_le_of_le_one_left (norm_nonneg _) h1).trans hz1 + let seg (z : ClosedUnitDisc) (t : ℝ) : ClosedUnitDisc := ⟨clamp t • z.1, hclamp_mem z t⟩ + have hseg_cont : ∀ z : ClosedUnitDisc, Continuous (seg z) := fun z => + Continuous.subtype_mk (hclamp_cont.smul continuous_const) _ + have hclamp_Icc : ∀ {t : ℝ}, t ∈ Icc (0 : ℝ) 1 → clamp t = t := by + intro t ht + change max 0 (min 1 t) = t + rw [min_eq_right ht.2, max_eq_right ht.1] + let R : Set ClosedUnitDisc := seg z₁ '' Icc 0 1 ∪ seg z₂ '' Icc 0 1 + have hR_comp : IsCompact R := + (isCompact_Icc.image (hseg_cont z₁)).union (isCompact_Icc.image (hseg_cont z₂)) + have h0_Icc : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := ⟨le_rfl, by norm_num⟩ + have h1_Icc : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := ⟨by norm_num, le_rfl⟩ + have h0_mem : (0 : EuclideanPlane) ∈ ClosedUnitDisc := by + rw [ClosedUnitDisc, Metric.mem_closedBall, dist_self] + norm_num + have hseg0 : ∀ z : ClosedUnitDisc, seg z 0 = ⟨0, h0_mem⟩ := by + intro z; ext; simp [seg, clamp] + have hseg1 : ∀ z : ClosedUnitDisc, seg z 1 = z := by + intro z; ext; simp [seg, clamp] + have hR_conn : IsConnected R := by + refine IsConnected.union ?_ + ((isConnected_Icc (by norm_num)).image (seg z₁) (hseg_cont z₁).continuousOn) + ((isConnected_Icc (by norm_num)).image (seg z₂) (hseg_cont z₂).continuousOn) + refine ⟨seg z₁ 0, mem_image_of_mem (seg z₁) h0_Icc, ?_⟩ + rw [hseg0 z₁, ← hseg0 z₂] + exact mem_image_of_mem (seg z₂) h0_Icc + let ι : ClosedUnitDisc → EuclideanPlane := fun w => (ψ₀ w).1 + have hι_cont : Continuous ι := continuous_subtype_val.comp ψ₀.continuous + refine ⟨ι '' R, hR_comp.image hι_cont, hR_conn.image ι hι_cont.continuousOn, ?_, ?_, ?_, ?_⟩ + · refine ⟨z₁, Or.inl ⟨1, h1_Icc, hseg1 z₁⟩, ?_⟩ + simp [ι, z₁] + · refine ⟨z₂, Or.inr ⟨1, h1_Icc, hseg1 z₂⟩, ?_⟩ + simp [ι, z₂] + · rintro _ ⟨w, _, rfl⟩; exact (ψ₀ w).2 + · have hbd_eq : subBd Δ₀ = discBd Δ₀ := subBd_eq_discBd_plane ⟨ψ₀⟩ + have hΔ₀_closed : IsClosed Δ₀ := (isCompact_of_isClosedDisc ⟨ψ₀⟩).isClosed + have hint_eq : interior Δ₀ = Δ₀ \ subBd Δ₀ := by + rw [subBd_eq_diff_interior_of_isClosed hΔ₀_closed] + exact (sdiff_sdiff_right_self.trans (inf_eq_right.mpr interior_subset)).symm + have hseg_int : ∀ (z : ClosedUnitDisc) {t : ℝ}, t ∈ Icc (0 : ℝ) 1 → + ι (seg z t) = ι z ∨ ι (seg z t) ∈ interior Δ₀ := by + intro z t ht + rcases eq_or_lt_of_le ht.2 with rfl | hlt + · left; rw [hseg1 z] + · right + rw [hint_eq, hbd_eq] + refine ⟨(ψ₀ (seg z t)).2, ?_⟩ + intro hbd + rw [disc_boundary Δ₀ ψ₀] at hbd + obtain ⟨u, hu_bd, hu_eq⟩ := hbd + have h_eq : seg z t = u := ψ₀.injective (Subtype.ext hu_eq.symm) + have hu_norm : ‖u.1‖ = 1 := by + change u.1 ∈ UnitCircle at hu_bd + rwa [UnitCircle, Metric.mem_sphere, dist_zero_right] at hu_bd + have hnorm1 : ‖(seg z t).1‖ = 1 := h_eq ▸ hu_norm + change ‖clamp t • z.1‖ = 1 at hnorm1 + rw [hclamp_Icc ht, norm_smul, Real.norm_eq_abs, abs_of_nonneg ht.1] at hnorm1 + have hz_le : ‖z.1‖ ≤ 1 := by + have hz : z.1 ∈ Metric.closedBall (0 : EuclideanPlane) 1 := z.2 + rwa [Metric.mem_closedBall, dist_zero_right] at hz + have h_lt1 : t * ‖z.1‖ < 1 := by + rcases eq_or_lt_of_le ht.1 with rfl | hpos + · norm_num + · exact lt_of_le_of_lt (mul_le_of_le_one_right hpos.le hz_le) hlt + linarith + rintro _ ⟨w, ⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩, rfl⟩ + · rcases hseg_int z₁ ht with h_eq | h_int + · left; left; exact h_eq.trans (by simp [ι, z₁]) + · right; exact h_int + · rcases hseg_int z₂ ht with h_eq | h_int + · left; right; exact h_eq.trans (by simp [ι, z₂]) + · right; exact h_int + +/-- If `R` is a path in `S_comp.G` with distinct ends `v₂ ≠ v₄` and `¬ R ≤ N.G`, then if +`v₂ ∈ N.Ω.bar` there is a subpath `R₁ ≤ R` with `R₁ ≤ N.G` from `v₂` to some `w₁ ∈ N.Ω₀.bar`. -/ +theorem exists_subpath_to_left_of_not_le_right {S S_comp : Society α β} {N : Neighborhood α β} + {R : Graph α β} {v₂ v₄ : α} (hcomp : S_comp.IsComposition S N) + (hR : IsGraphPathWithEnds S_comp.G R v₂ v₄) (hv24 : v₂ ≠ v₄) (hnot_le : ¬ R ≤ N.G) + (hv_bar : v₂ ∈ N.Ω.bar) : + ∃ R₁ : Graph α β, ∃ w₁ ∈ N.Ω₀.bar, + R₁ ≤ R ∧ R₁ ≤ N.G ∧ IsGraphPathWithEnds N.G R₁ v₂ w₁ := by + obtain ⟨e₀, he₀R, he₀S⟩ := nonempty_edgeSet_inter_of_not_le_right hcomp hR hv24 hnot_le + obtain ⟨x₀, y₀, hxy₀S⟩ := S.G.exists_isLink_of_mem_edgeSet he₀S + obtain ⟨a₀, b₀, hab₀R⟩ := R.exists_isLink_of_mem_edgeSet he₀R + have ha₀S : a₀ ∈ V(S.G) := by + rcases (hab₀R.mono hR.le).left_eq_or_eq (hxy₀S.mono hcomp.1.1.1) with rfl | rfl + · exact hxy₀S.left_mem + · exact hxy₀S.right_mem + obtain ⟨Q_va, _, hRa₀_le, _, hQ_va_comp, _, _, _, _⟩ := hR.exists_split_at hab₀R.left_mem + obtain ⟨u₁, hu₁, w₁, hw₁S, R₁, hR₁_Qva, hft⟩ := + hQ_va_comp.exists_isFromToPathWithEnds (X := {v₂}) (Y := V(S.G)) + (mem_singleton v₂) ha₀S + rw [mem_singleton_iff] at hu₁ + subst u₁ + have hR₁_R : R₁ ≤ R := hR₁_Qva.trans hRa₀_le + have hR₁_comp : IsGraphPathWithEnds S_comp.G R₁ v₂ w₁ := hft.1.mono hR.le + have hER₁_N : E(R₁) ⊆ E(N.G) := by + intro f hf + have hf_comp : f ∈ E(S_comp.G) := hR₁_comp.le.edgeSet_mono hf + rw [← hcomp.1.1.2.2.2.1] at hf_comp + rcases hf_comp with hfS | hfN + · exfalso + obtain ⟨x, y, hxyS⟩ := S.G.exists_isLink_of_mem_edgeSet hfS + obtain ⟨x', y', hxyR₁⟩ := R₁.exists_isLink_of_mem_edgeSet hf + have hx'S : x' ∈ V(S.G) := by + rcases (hxyR₁.mono hR₁_comp.le).left_eq_or_eq (hxyS.mono hcomp.1.1.1) with rfl | rfl + · exact hxyS.left_mem + · exact hxyS.right_mem + have hy'S : y' ∈ V(S.G) := by + rcases (hxyR₁.symm.mono hR₁_comp.le).left_eq_or_eq (hxyS.mono hcomp.1.1.1) with rfl | rfl + · exact hxyS.left_mem + · exact hxyS.right_mem + have hx'w₁ : x' = w₁ := by + have hx'_in : x' ∈ V(R₁) ∩ V(S.G) := ⟨hxyR₁.left_mem, hx'S⟩ + rwa [hft.2.2, mem_singleton_iff] at hx'_in + have hy'w₁ : y' = w₁ := by + have hy'_in : y' ∈ V(R₁) ∩ V(S.G) := ⟨hxyR₁.right_mem, hy'S⟩ + rwa [hft.2.2, mem_singleton_iff] at hy'_in + subst x'; subst y' + exact hR₁_comp.not_isLoopAt hf w₁ (hxyR₁.mono hR₁_comp.le) + · exact hfN + have hVR₁_N : V(R₁) ⊆ V(N.G) := by + intro z hz + by_cases hzv : z = v₂ + · exact hzv ▸ N.bar_subset hv_bar + · obtain ⟨Q₁, _, hQ₁, _, hp₁, _, _, _, _⟩ := hR₁_comp.exists_split_at hz + obtain ⟨f, hf, w, hinc⟩ := hp₁.symm.exists_inc_left_of_ne hzv + have hfN : f ∈ E(N.G) := hER₁_N (hQ₁.edgeSet_mono hf) + obtain ⟨x, y, hxyN⟩ := N.G.exists_isLink_of_mem_edgeSet hfN + rcases (hinc.mono (hQ₁.trans hR₁_comp.le)).left_eq_or_eq (hxyN.mono hcomp.1.1.2.1) + with rfl | rfl + · exact hxyN.left_mem + · exact hxyN.right_mem + have hR₁_N : R₁ ≤ N.G := + (Compatible.of_le_le hR₁_comp.le hcomp.1.1.2.1).le_iff.mpr ⟨hVR₁_N, hER₁_N⟩ + have hw₁_Ω₀ : w₁ ∈ N.Ω₀.bar := by + rw [hcomp.2.2.1, hcomp.2.2.2] + exact ⟨hw₁S, hVR₁_N hR₁_comp.right_mem⟩ + exact ⟨R₁, w₁, hw₁_Ω₀, hR₁_R, hR₁_N, hR₁_comp.of_le hR₁_N⟩ + +/-- Given a closed disc `Δ₀ ⊆ EuclideanPlane` and a boundary homeomorphism `φ₀ : Circle ≃ₜ subBd +Δ₀`, +the complement of `interior Δ₀` in the one-point compactification `OnePoint EuclideanPlane` is +contained in a closed disc `D_ext` with `discBd D_ext = OnePoint.some '' subBd Δ₀`. -/ +theorem exists_exterior_disc_in_onePoint {Δ₀ : Set EuclideanPlane} + (hΔ₀ : IsClosedDisc Δ₀) (φ₀ : Circle ≃ₜ subBd Δ₀) : + ∃ D_ext : Set (OnePoint EuclideanPlane), + IsClosedDisc D_ext ∧ + discBd D_ext = OnePoint.some '' subBd Δ₀ ∧ + ∀ x : EuclideanPlane, x ∉ interior Δ₀ → (x : OnePoint EuclideanPlane) ∈ D_ext := by + let ι : EuclideanPlane → OnePoint EuclideanPlane := OnePoint.some + have hι_emb : Topology.IsOpenEmbedding ι := OnePoint.isOpenEmbedding_coe + have hι_cont : Continuous ι := OnePoint.continuous_coe + have hι_inj : Function.Injective ι := OnePoint.coe_injective + let F : Set (OnePoint EuclideanPlane) := ι '' subBd Δ₀ + let eF : subBd Δ₀ ≃ₜ F := hι_emb.isEmbedding.homeomorphImage (subBd Δ₀) + have hF_oArc : IsOArc F := ⟨φ₀.trans eF⟩ + obtain ⟨Δ₁, Δ₂, _, hΔ₁, hΔ₂, hbd₁, hbd₂, huniv, hinter, _, huniq⟩ := + sphere_disc (OnePoint EuclideanPlane) ⟨Homeomorph.refl _⟩ F hF_oArc + let D₀ : Set (OnePoint EuclideanPlane) := ι '' Δ₀ + have hΔ₀_comp : IsCompact Δ₀ := isCompact_of_isClosedDisc hΔ₀ + obtain ⟨ι', hι'_cont, hι'_left⟩ := + exists_inv_of_compactOn hΔ₀_comp hι_cont.continuousOn hι_inj.injOn + obtain ⟨hD₀_disc, hD₀_bd⟩ := hΔ₀.image hι_cont.continuousOn hι'_cont hι'_left + rw [← subBd_eq_discBd_plane hΔ₀] at hD₀_bd + have hsub_compl : ∀ (D_ext : Set (OnePoint EuclideanPlane)), + D₀ ∪ D_ext = univ → F ⊆ D_ext → + ∀ x : EuclideanPlane, x ∉ interior Δ₀ → ι x ∈ D_ext := by + intro D_ext huniv' hF_sub x hx_not_int + have hmem : ι x ∈ D₀ ∪ D_ext := huniv' ▸ mem_univ (ι x) + rcases hmem with ⟨y, hyΔ₀, hyx⟩ | hx_ext + · have hxy : y = x := hι_inj hyx + subst hxy + have hx_bd : y ∈ subBd Δ₀ := by + rw [subBd_eq_diff_interior_of_isClosed (isClosed_of_isClosedDisc hΔ₀)] + exact ⟨hyΔ₀, hx_not_int⟩ + exact hF_sub (mem_image_of_mem ι hx_bd) + · exact hx_ext + rcases huniq D₀ hD₀_disc hD₀_bd with hD₀_eq | hD₀_eq + · refine ⟨Δ₂, hΔ₂, hbd₂, hsub_compl Δ₂ (hD₀_eq.symm ▸ huniv) ?_⟩ + rw [← hinter]; exact inter_subset_right + · refine ⟨Δ₁, hΔ₁, hbd₁, hsub_compl Δ₁ (hD₀_eq.symm ▸ union_comm Δ₁ Δ₂ ▸ huniv) ?_⟩ + rw [← hinter]; exact inter_subset_left + +/-- Two compact connected subsets `V₁, V₂ ⊆ (interior Δ₀)ᶜ` whose endpoints on `subBd Δ₀` cross +with respect to `Ω₀` must intersect. -/ +theorem nonempty_inter_of_crosses_on_inner_bd {G : Graph α β} + {Γ : GraphDrawing G EuclideanPlane} {Ω₀ : CyclicPerm α} {Δ₀ : Set EuclideanPlane} + (hΔ₀ : IsClosedDisc Δ₀) {φ₀ : Circle ≃ₜ subBd Δ₀} + (hagrees₀ : DrawingAgreesWithOArcHomeo Γ Ω₀ (subBd Δ₀) φ₀) + {v₁ v₃ v₂ v₄ : α} (hcr : Ω₀.Crosses v₁ v₃ v₂ v₄) + {p₁ p₃ p₂ p₄ : EuclideanPlane} + (hp₁ : p₁ ∈ graphDrawingVertexSet Γ v₁) + (hp₃ : p₃ ∈ graphDrawingVertexSet Γ v₃) + (hp₂ : p₂ ∈ graphDrawingVertexSet Γ v₂) + (hp₄ : p₄ ∈ graphDrawingVertexSet Γ v₄) + {V₁ V₂ : Set EuclideanPlane} + (hV₁_comp : IsCompact V₁) (hV₂_comp : IsCompact V₂) + (hV₁_conn : IsConnected V₁) (hV₂_conn : IsConnected V₂) + (hV₁_sub : V₁ ⊆ (interior Δ₀)ᶜ) (hV₂_sub : V₂ ⊆ (interior Δ₀)ᶜ) + (hp₁_V₁ : p₁ ∈ V₁) (hp₃_V₁ : p₃ ∈ V₁) (hp₂_V₂ : p₂ ∈ V₂) (hp₄_V₂ : p₄ ∈ V₂) : + (V₁ ∩ V₂).Nonempty := by + obtain ⟨D_ext, hD_ext, hbd_ext, hsub_ext⟩ := exists_exterior_disc_in_onePoint hΔ₀ φ₀ + let ι : EuclideanPlane → OnePoint EuclideanPlane := OnePoint.some + have hι_cont : Continuous ι := OnePoint.continuous_coe + have hι_inj : Function.Injective ι := OnePoint.coe_injective + let eF : subBd Δ₀ ≃ₜ ι '' subBd Δ₀ := + OnePoint.isOpenEmbedding_coe.isEmbedding.homeomorphImage (subBd Δ₀) + let φ₀' : Circle ≃ₜ discBd D_ext := (φ₀.trans eF).trans (Homeomorph.setCongr hbd_ext.symm) + have hcr_bd₀ : PairsCrossOn (subBd Δ₀) p₁ p₃ p₂ p₄ := + pairsCrossOn_of_crosses hagrees₀ hcr hp₁ hp₃ hp₂ hp₄ + have hp₁_bd : p₁ ∈ subBd Δ₀ := hcr_bd₀.1 + have hp₂_bd : p₂ ∈ subBd Δ₀ := hcr_bd₀.2.1 + have hp₃_bd : p₃ ∈ subBd Δ₀ := hcr_bd₀.2.2.1 + have hp₄_bd : p₄ ∈ subBd Δ₀ := hcr_bd₀.2.2.2.1 + let z₁ : Circle := φ₀.symm ⟨p₁, hp₁_bd⟩ + let z₃ : Circle := φ₀.symm ⟨p₃, hp₃_bd⟩ + let z₂ : Circle := φ₀.symm ⟨p₂, hp₂_bd⟩ + let z₄ : Circle := φ₀.symm ⟨p₄, hp₄_bd⟩ + have ho_eq : ∀ (p : EuclideanPlane) (hp : p ∈ subBd Δ₀), + oArcMap φ₀ (φ₀.symm ⟨p, hp⟩) = p := fun p hp => by simp [oArcMap] + have ho'_eq : ∀ (p : EuclideanPlane) (hp : p ∈ subBd Δ₀), + oArcMap φ₀' (φ₀.symm ⟨p, hp⟩) = ι p := fun p hp => by + change ((Homeomorph.setCongr hbd_ext.symm) (eF (φ₀ (φ₀.symm ⟨p, hp⟩)))).1 = ι p + rw [Homeomorph.apply_symm_apply] + rfl + have hcr_circle : CrossesOn (Set.univ : Set Circle) z₁ z₃ z₂ z₄ := by + apply (crossesOn_oArcMap_iff φ₀).mp + change PairsCrossOn (subBd Δ₀) (oArcMap φ₀ z₁) (oArcMap φ₀ z₃) (oArcMap φ₀ z₂) (oArcMap φ₀ z₄) + rwa [ho_eq p₁ hp₁_bd, ho_eq p₃ hp₃_bd, ho_eq p₂ hp₂_bd, ho_eq p₄ hp₄_bd] + have hcr_ext : PairsCrossOn (discBd D_ext) (ι p₁) (ι p₃) (ι p₂) (ι p₄) := by + rw [← ho'_eq p₁ hp₁_bd, ← ho'_eq p₃ hp₃_bd, ← ho'_eq p₂ hp₂_bd, ← ho'_eq p₄ hp₄_bd] + exact (crossesOn_oArcMap_iff φ₀').mpr hcr_circle + have hV₁_ext : ι '' V₁ ⊆ D_ext := by + rintro _ ⟨x, hx, rfl⟩; exact hsub_ext x (hV₁_sub hx) + have hV₂_ext : ι '' V₂ ⊆ D_ext := by + rintro _ ⟨x, hx, rfl⟩; exact hsub_ext x (hV₂_sub hx) + obtain ⟨y, ⟨x₁, hx₁, rfl⟩, ⟨x₂, hx₂, hx12⟩⟩ := + disc_crossing D_ext (ι '' V₁) (ι '' V₂) (ι p₁) (ι p₃) (ι p₂) (ι p₄) hD_ext + hV₁_ext hV₂_ext (hV₁_comp.image hι_cont) (hV₂_comp.image hι_cont) + (hV₁_conn.image ι hι_cont.continuousOn) (hV₂_conn.image ι hι_cont.continuousOn) + (mem_image_of_mem ι hp₁_V₁) (mem_image_of_mem ι hp₃_V₁) + (mem_image_of_mem ι hp₂_V₂) (mem_image_of_mem ι hp₄_V₂) hcr_ext + exact ⟨x₁, hx₁, hι_inj hx12.symm ▸ hx₂⟩ + +/-- Transferring a crooked transaction `P_set₀` in `S₀` to `f_P '' P_set₀` in `S₁` along an end map +`f_v` that is injective on `S₀.transactionEnds P_set₀` and preserves `Crosses`. -/ +theorem isCrookedTransaction_of_end_map {S₀ S₁ : Society α β} + {P_set₀ : Set (Graph α β)} (hcrooked₀ : S₀.IsCrookedTransaction P_set₀) + {f_P : Graph α β → Graph α β} {f_v : α → α} + (hf_ends : ∀ P ∈ P_set₀, ∀ a b : α, + S₀.IsOmegaPathWithEnds P a b → S₁.IsOmegaPathWithEnds (f_P P) (f_v a) (f_v b)) + (hf_disj : ∀ P ∈ P_set₀, ∀ Q ∈ P_set₀, P ≠ Q → Disjoint V(f_P P) V(f_P Q)) + (hf_inj : InjOn f_v (S₀.transactionEnds P_set₀)) + (hf_cross : ∀ v₁ ∈ S₀.transactionEnds P_set₀, ∀ v₃ ∈ S₀.transactionEnds P_set₀, + ∀ v₂ ∈ S₀.transactionEnds P_set₀, ∀ v₄ ∈ S₀.transactionEnds P_set₀, + S₀.Ω.Crosses v₁ v₃ v₂ v₄ ↔ S₁.Ω.Crosses (f_v v₁) (f_v v₃) (f_v v₂) (f_v v₄)) : + S₁.IsCrookedTransaction (f_P '' P_set₀) ∧ (f_P '' P_set₀).ncard = P_set₀.ncard := by + let W₀ := S₀.transactionEnds P_set₀ + let P_set₁ := f_P '' P_set₀ + let W₁ := S₁.transactionEnds P_set₁ + obtain ⟨A₀, B₀, hfence₀⟩ := hcrooked₀.1 + have hf_P_inj : InjOn f_P P_set₀ := by + intro P hP Q hQ hPQ_eq + by_contra hne + obtain ⟨a, _, b, _, hP_ab⟩ := hfence₀.2.2 P hP + have hP'_ab := hf_ends P hP a b hP_ab + have hmem : f_v a ∈ V(f_P P) := hP'_ab.1.left_mem + exact disjoint_left.mp (hf_disj P hP Q hQ hne) hmem (hPQ_eq ▸ hmem) + have hcard : P_set₁.ncard = P_set₀.ncard := Set.InjOn.ncard_image hf_P_inj + have hW₁_eq : W₁ = f_v '' W₀ := by + ext z; constructor + · rintro ⟨P', ⟨P, hP, rfl⟩, d, hP'_zd⟩ + obtain ⟨a, _, b, _, hP_ab⟩ := hfence₀.2.2 P hP + have hP'_ab := hf_ends P hP a b hP_ab + rcases hP'_ab.ends_eq S₁ hP'_zd with ⟨rfl, _⟩ | ⟨rfl, _⟩ + · exact ⟨a, ⟨P, hP, b, hP_ab⟩, rfl⟩ + · exact ⟨b, ⟨P, hP, a, hP_ab.symm S₀⟩, rfl⟩ + · rintro ⟨a, ⟨P, hP, b, hP_ab⟩, rfl⟩ + exact ⟨f_P P, mem_image_of_mem f_P hP, f_v b, hf_ends P hP a b hP_ab⟩ + have hW₀_bar : W₀ ⊆ S₀.Ω.bar := S₀.transactionEnds_subset_bar P_set₀ + have hW₁_bar : W₁ ⊆ S₁.Ω.bar := S₁.transactionEnds_subset_bar P_set₁ + have hcr₀_W₀ : (S₀.restrictOmega W₀ hW₀_bar).IsCrookedTransaction P_set₀ := + ((S₀.isCrookedTransaction_restrictOmega_iff hW₀_bar).mpr ⟨hcrooked₀, Subset.rfl⟩) + obtain ⟨A₀', B₀', hfence₀'⟩ := hcr₀_W₀.1 + have hbar₀' : (S₀.restrictOmega W₀ hW₀_bar).Ω.bar = W₀ := S₀.Ω.restrict_bar hW₀_bar + have hbar₁' : (S₁.restrictOmega W₁ hW₁_bar).Ω.bar = W₁ := S₁.Ω.restrict_bar hW₁_bar + have hA₀'_W₀ : A₀' ⊆ W₀ := hbar₀' ▸ hfence₀'.2.1.1 + have hB₀'_W₀ : B₀' ⊆ W₀ := hbar₀' ▸ hfence₀'.2.1.2.1 + let A₁' := f_v '' A₀' + let B₁' := f_v '' B₀' + have hA₁'_W₁ : A₁' ⊆ (S₁.restrictOmega W₁ hW₁_bar).Ω.bar := by + rw [hbar₁', hW₁_eq]; exact image_mono hA₀'_W₀ + have hB₁'_W₁ : B₁' ⊆ (S₁.restrictOmega W₁ hW₁_bar).Ω.bar := by + rw [hbar₁', hW₁_eq]; exact image_mono hB₀'_W₀ + have hdisj_AB₁' : Disjoint A₁' B₁' := by + rw [disjoint_left] + rintro _ ⟨a, ha, rfl⟩ ⟨b, hb, hba⟩ + have hab : a = b := hf_inj (hA₀'_W₀ ha) (hB₀'_W₀ hb) hba.symm + exact disjoint_left.mp hfence₀'.2.1.2.2.1 ha (hab ▸ hb) + have hunion_AB₁' : A₁' ∪ B₁' = (S₁.restrictOmega W₁ hW₁_bar).Ω.bar := by + rw [hbar₁', hW₁_eq, ← image_union, hfence₀'.2.1.2.2.2.1, hbar₀'] + have hfence₁' : (S₁.restrictOmega W₁ hW₁_bar).Ω.IsFence A₁' B₁' := by + refine ⟨hA₁'_W₁, hB₁'_W₁, hdisj_AB₁', hunion_AB₁', ?_⟩ + rintro _ ⟨a₁, ha₁, rfl⟩ _ ⟨a₂, ha₂, rfl⟩ ha12 _ ⟨b₁, hb₁, rfl⟩ _ ⟨b₂, hb₂, rfl⟩ hb12 hcr' + have ha12₀ : a₁ ≠ a₂ := fun h => ha12 (congrArg f_v h) + have hb12₀ : b₁ ≠ b₂ := fun h => hb12 (congrArg f_v h) + have hcr₁ : S₁.Ω.Crosses (f_v a₁) (f_v a₂) (f_v b₁) (f_v b₂) := + ((S₁.Ω.crosses_restrict_iff hW₁_bar).mp hcr').2.2.2.2 + have hcr₀ : S₀.Ω.Crosses a₁ a₂ b₁ b₂ := + (hf_cross a₁ (hA₀'_W₀ ha₁) a₂ (hA₀'_W₀ ha₂) b₁ (hB₀'_W₀ hb₁) b₂ (hB₀'_W₀ hb₂)).mpr hcr₁ + have hcr₀' : (S₀.restrictOmega W₀ hW₀_bar).Ω.Crosses a₁ a₂ b₁ b₂ := + (S₀.Ω.crosses_restrict_iff hW₀_bar).mpr + ⟨hA₀'_W₀ ha₁, hA₀'_W₀ ha₂, hB₀'_W₀ hb₁, hB₀'_W₀ hb₂, hcr₀⟩ + exact hfence₀'.2.1.2.2.2.2 a₁ ha₁ a₂ ha₂ ha12₀ b₁ hb₁ b₂ hb₂ hb12₀ hcr₀' + obtain ⟨A₁, B₁, hfence₁, hA₁'A₁, hB₁'B₁⟩ := S₁.Ω.exists_isFence_of_restrict hW₁_bar hfence₁' + have htx₁ : S₁.IsTransaction P_set₁ := by + refine ⟨A₁, B₁, ⟨?_, ?_⟩, hfence₁, ?_⟩ + · rintro _ ⟨P, hP, rfl⟩ + obtain ⟨a, _, b, _, hP_ab⟩ := hfence₀.2.2 P hP + exact ⟨f_v a, f_v b, hf_ends P hP a b hP_ab⟩ + · rintro _ ⟨P, hP, rfl⟩ _ ⟨Q, hQ, rfl⟩ hne + exact hf_disj P hP Q hQ (fun h => hne (congrArg f_P h)) + · rintro _ ⟨P, hP, rfl⟩ + obtain ⟨a, ha, b, hb, hP_ab⟩ := hfence₀'.2.2 P hP + have hP_ab₀ : S₀.IsOmegaPathWithEnds P a b := + ⟨hP_ab.1, hP_ab.2.1, hW₀_bar (hbar₀' ▸ hP_ab.2.2.1), hW₀_bar (hbar₀' ▸ hP_ab.2.2.2)⟩ + exact ⟨f_v a, hA₁'A₁ (mem_image_of_mem f_v ha), f_v b, hB₁'B₁ (mem_image_of_mem f_v hb), + hf_ends P hP a b hP_ab₀⟩ + refine ⟨⟨htx₁, ?_⟩, hcard⟩ + rintro _ ⟨P, hP, rfl⟩ ⟨_, a', b', hP'_ab', hdisj_or⟩ + obtain ⟨a, haA, b, hbB, hP_ab⟩ := hfence₀.2.2 P hP + have haW₀ : a ∈ W₀ := ⟨P, hP, b, hP_ab⟩ + have hbW₀ : b ∈ W₀ := ⟨P, hP, a, hP_ab.symm S₀⟩ + have hnot_periph₀ : ¬ S₀.IsPeripheralIn P_set₀ P := hcrooked₀.2 P hP + have hne_ab : (S₀.Ω.interval a b ∩ W₀).Nonempty := by + by_contra h_emp + rw [not_nonempty_iff_eq_empty, ← disjoint_iff_inter_eq_empty] at h_emp + exact hnot_periph₀ ⟨hP, a, b, hP_ab, Or.inl h_emp⟩ + have hne_ba : (S₀.Ω.interval b a ∩ W₀).Nonempty := by + by_contra h_emp + rw [not_nonempty_iff_eq_empty, ← disjoint_iff_inter_eq_empty] at h_emp + exact hnot_periph₀ ⟨hP, a, b, hP_ab, Or.inr h_emp⟩ + rcases hne_ab with ⟨x, hx_ab, hxW₀⟩ + rcases hne_ba with ⟨y, hy_ba, hyW₀⟩ + have hP'_ab₁ := hf_ends P hP a b hP_ab + have hcr₁' : S₁.Ω.Crosses a' b' (f_v x) (f_v y) := by + rcases hP'_ab'.ends_eq S₁ hP'_ab₁ with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact (hf_cross a haW₀ b hbW₀ x hxW₀ y hyW₀).mp + (S₀.Ω.crosses_iff_interval.mpr (Or.inl ⟨hx_ab, hy_ba⟩)) + · exact (hf_cross b hbW₀ a haW₀ x hxW₀ y hyW₀).mp + (S₀.Ω.crosses_iff_interval.mpr (Or.inr ⟨hy_ba, hx_ab⟩)) + have hfx_W₁ : f_v x ∈ W₁ := hW₁_eq ▸ mem_image_of_mem f_v hxW₀ + have hfy_W₁ : f_v y ∈ W₁ := hW₁_eq ▸ mem_image_of_mem f_v hyW₀ + rcases S₁.Ω.crosses_iff_interval.mp hcr₁' with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · rcases hdisj_or with hdisj₁ | hdisj₂ + · exact disjoint_left.mp hdisj₁ h1 hfx_W₁ + · exact disjoint_left.mp hdisj₂ h2 hfy_W₁ + · rcases hdisj_or with hdisj₁ | hdisj₂ + · exact disjoint_left.mp hdisj₁ h1 hfy_W₁ + · exact disjoint_left.mp hdisj₂ h2 hfx_W₁ + +/-- Generalization of `isSeparatingOmegaPath_of_isRural`: if `Q ≤ N.G` is an `S_comp.Ω`-path with +ends `v₁, v₃` and `R₁, R₂` are paths in `S_comp.G` disjoint from `Q` with initial ends +`v₂, v₄ ∈ S_comp.Ω.bar` such that `S_comp.Ω.Crosses v₁ v₃ v₂ v₄`, then `R₁` and `R₂` cannot both +fail to be subgraphs of `N.G`. -/ +theorem not_both_not_le_right_of_crosses_in_rural {S S_comp : Society α β} {N : Neighborhood α β} + {Q R₁ R₂ : Graph α β} {v₁ v₃ v₂ a v₄ b : α} + (hcomp : S_comp.IsComposition S N) (hrural : N.IsRural) + (hQN : Q ≤ N.G) (hQ_ends : S_comp.IsOmegaPathWithEnds Q v₁ v₃) + (hR₁_path : IsGraphPathWithEnds S_comp.G R₁ v₂ a) (hv₂a : v₂ ≠ a) (hv₂ : v₂ ∈ S_comp.Ω.bar) + (hR₂_path : IsGraphPathWithEnds S_comp.G R₂ v₄ b) (hv₄b : v₄ ≠ b) (hv₄ : v₄ ∈ S_comp.Ω.bar) + (hdisj₁ : Disjoint V(Q) V(R₁)) (hdisj₂ : Disjoint V(Q) V(R₂)) + (hcr : S_comp.Ω.Crosses v₁ v₃ v₂ v₄) + (hnot₁ : ¬ R₁ ≤ N.G) (hnot₂ : ¬ R₂ ≤ N.G) : False := by + have hv₁_bar : v₁ ∈ N.Ω.bar := hcomp.2.1 ▸ hQ_ends.2.2.1 + have hv₃_bar : v₃ ∈ N.Ω.bar := hcomp.2.1 ▸ hQ_ends.2.2.2 + have hv₂_bar : v₂ ∈ N.Ω.bar := hcomp.2.1 ▸ hv₂ + have hv₄_bar : v₄ ∈ N.Ω.bar := hcomp.2.1 ▸ hv₄ + have hcr_N : N.Ω.Crosses v₁ v₃ v₂ v₄ := hcomp.2.1 ▸ hcr + obtain ⟨R₁', w₁, hw₁_bar₀, hR₁'_R₁, hR₁'_N, hR₁'_path⟩ := + exists_subpath_to_left_of_not_le_right hcomp hR₁_path hv₂a hnot₁ hv₂_bar + obtain ⟨R₂', w₂, hw₂_bar₀, hR₂'_R₂, hR₂'_N, hR₂'_path⟩ := + exists_subpath_to_left_of_not_le_right hcomp hR₂_path hv₄b hnot₂ hv₄_bar + obtain ⟨Γ, Δ, Δ₀, hΔ, hΔ₀_sub, hU_sub, hbd, hbd₀, ⟨φ, _, hφ⟩, hinner⟩ := hrural + rcases hinner with ⟨_, hΩ₀_emp⟩ | ⟨hΔ₀_disc, _⟩ + · exact (notMem_empty w₁ (hΩ₀_emp ▸ hw₁_bar₀)).elim + · have hv₁G : v₁ ∈ V(N.G) := N.bar_subset hv₁_bar + have hv₃G : v₃ ∈ V(N.G) := N.bar_subset hv₃_bar + have hv₂G : v₂ ∈ V(N.G) := N.bar_subset hv₂_bar + have hv₄G : v₄ ∈ V(N.G) := N.bar_subset hv₄_bar + have hw₁G : w₁ ∈ V(N.G) := N.bar₀_subset hw₁_bar₀ + have hw₂G : w₂ ∈ V(N.G) := N.bar₀_subset hw₂_bar₀ + let p₁ := (Γ.iso.vertexEquiv ⟨v₁, hv₁G⟩).1 + let p₃ := (Γ.iso.vertexEquiv ⟨v₃, hv₃G⟩).1 + let p₂ := (Γ.iso.vertexEquiv ⟨v₂, hv₂G⟩).1 + let p₄ := (Γ.iso.vertexEquiv ⟨v₄, hv₄G⟩).1 + let q₁ := (Γ.iso.vertexEquiv ⟨w₁, hw₁G⟩).1 + let q₂ := (Γ.iso.vertexEquiv ⟨w₂, hw₂G⟩).1 + have hq₁_bd₀ : q₁ ∈ subBd Δ₀ := (hbd₀ w₁ hw₁G).mpr hw₁_bar₀ ⟨hw₁G, rfl⟩ + have hq₂_bd₀ : q₂ ∈ subBd Δ₀ := (hbd₀ w₂ hw₂G).mpr hw₂_bar₀ ⟨hw₂G, rfl⟩ + have hbd₀_sub : subBd Δ₀ ⊆ Δ₀ := + subBd_eq_discBd_plane hΔ₀_disc ▸ Surface.discBd_subset Δ₀ + obtain ⟨K₀, hK₀_comp, hK₀_conn, hq₁_K₀, hq₂_K₀, hK₀_Δ₀, hK₀_int⟩ := + exists_compact_connected_in_disc_avoiding_bd hΔ₀_disc (hbd₀_sub hq₁_bd₀) (hbd₀_sub hq₂_bd₀) + have hQ_path : IsGraphPathWithEnds N.G Q v₁ v₃ := hQ_ends.1.of_le hQN + have hV₁_Δ : graphDrawingSubgraphU Γ Q ⊆ Δ := + (graphDrawingSubgraphU_subset_U' Γ Q).trans (hU_sub.trans sdiff_subset) + have hUR₁_Δ : graphDrawingSubgraphU Γ R₁' ⊆ Δ := + (graphDrawingSubgraphU_subset_U' Γ R₁').trans (hU_sub.trans sdiff_subset) + have hUR₂_Δ : graphDrawingSubgraphU Γ R₂' ⊆ Δ := + (graphDrawingSubgraphU_subset_U' Γ R₂').trans (hU_sub.trans sdiff_subset) + obtain ⟨hUQ_comp, hUQ_conn, _, _⟩ := + isCompact_and_isConnected_subgraphU_of_isGraphPathWithEnds hΔ hQ_path hV₁_Δ + obtain ⟨hUR₁_comp, hUR₁_conn, _, _⟩ := + isCompact_and_isConnected_subgraphU_of_isGraphPathWithEnds hΔ hR₁'_path hUR₁_Δ + obtain ⟨hUR₂_comp, hUR₂_conn, _, _⟩ := + isCompact_and_isConnected_subgraphU_of_isGraphPathWithEnds hΔ hR₂'_path hUR₂_Δ + have hq₁_UR₁ : q₁ ∈ graphDrawingSubgraphU Γ R₁' := + Or.inl (mem_iUnion₂.mpr ⟨w₁, hR₁'_path.right_mem, hw₁G, rfl⟩) + have hq₂_UR₂ : q₂ ∈ graphDrawingSubgraphU Γ R₂' := + Or.inl (mem_iUnion₂.mpr ⟨w₂, hR₂'_path.right_mem, hw₂G, rfl⟩) + let V₁ := graphDrawingSubgraphU Γ Q + let V₂ := (graphDrawingSubgraphU Γ R₁' ∪ K₀) ∪ graphDrawingSubgraphU Γ R₂' + have hV₂_comp : IsCompact V₂ := (hUR₁_comp.union hK₀_comp).union hUR₂_comp + have hV₂_conn : IsConnected V₂ := + IsConnected.union ⟨q₂, Or.inr hq₂_K₀, hq₂_UR₂⟩ + (IsConnected.union ⟨q₁, hq₁_UR₁, hq₁_K₀⟩ hUR₁_conn hK₀_conn) hUR₂_conn + have hV₂_Δ : V₂ ⊆ Δ := + union_subset (union_subset hUR₁_Δ (hK₀_Δ₀.trans hΔ₀_sub)) hUR₂_Δ + have hp₁_V₁ : p₁ ∈ V₁ := Or.inl (mem_iUnion₂.mpr ⟨v₁, hQ_path.left_mem, hv₁G, rfl⟩) + have hp₃_V₁ : p₃ ∈ V₁ := Or.inl (mem_iUnion₂.mpr ⟨v₃, hQ_path.right_mem, hv₃G, rfl⟩) + have hp₂_V₂ : p₂ ∈ V₂ := + Or.inl (Or.inl (Or.inl (mem_iUnion₂.mpr ⟨v₂, hR₁'_path.left_mem, hv₂G, rfl⟩))) + have hp₄_V₂ : p₄ ∈ V₂ := + Or.inr (Or.inl (mem_iUnion₂.mpr ⟨v₄, hR₂'_path.left_mem, hv₄G, rfl⟩)) + have hcross_bd : PairsCrossOn (discBd Δ) p₁ p₃ p₂ p₄ := by + rw [discBd_eq_subBd hΔ] + exact pairsCrossOn_of_crosses hφ hcr_N ⟨hv₁G, rfl⟩ ⟨hv₃G, rfl⟩ ⟨hv₂G, rfl⟩ ⟨hv₄G, rfl⟩ + obtain ⟨x, hx₁, hx₂⟩ := disc_crossing Δ V₁ V₂ p₁ p₃ p₂ p₄ hΔ hV₁_Δ hV₂_Δ + hUQ_comp hV₂_comp hUQ_conn hV₂_conn hp₁_V₁ hp₃_V₁ hp₂_V₂ hp₄_V₂ hcross_bd + have hdisj₁' : Disjoint V(Q) V(R₁') := hdisj₁.mono_right hR₁'_R₁.vertexSet_mono + have hdisj₂' : Disjoint V(Q) V(R₂') := hdisj₂.mono_right hR₂'_R₂.vertexSet_mono + rcases hx₂ with (hxR₁ | hxK₀) | hxR₂ + · obtain ⟨u, huQ, huR₁⟩ := + nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ hQN hR₁'_N ⟨x, hx₁, hxR₁⟩ + exact disjoint_left.mp hdisj₁' huQ huR₁ + · rcases hK₀_int hxK₀ with (rfl | rfl) | hx_int₀ + · obtain ⟨u, huQ, huR₁⟩ := + nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ hQN hR₁'_N ⟨q₁, hx₁, hq₁_UR₁⟩ + exact disjoint_left.mp hdisj₁' huQ huR₁ + · obtain ⟨u, huQ, huR₂⟩ := + nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ hQN hR₂'_N ⟨q₂, hx₁, hq₂_UR₂⟩ + exact disjoint_left.mp hdisj₂' huQ huR₂ + · exact (hU_sub (graphDrawingSubgraphU_subset_U' Γ Q hx₁)).2 hx_int₀ + · obtain ⟨u, huQ, huR₂⟩ := + nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ hQN hR₂'_N ⟨x, hx₁, hxR₂⟩ + exact disjoint_left.mp hdisj₂' huQ huR₂ + +/-- In a rural composition `S_comp.IsComposition S N`, every `S_comp.Ω`-path `Q` that is a subgraph +of `N.G` is separating in `S_comp` (Graph Minors IX, Section 9, Claim (4), page 62). -/ +theorem isSeparatingOmegaPath_of_isRural {S S_comp : Society α β} {N : Neighborhood α β} + {Q : Graph α β} (hcomp : S_comp.IsComposition S N) (hrural : N.IsRural) + (hQN : Q ≤ N.G) (hQ : S_comp.IsOmegaPath Q) : + S_comp.IsSeparatingOmegaPath Q := by + refine ⟨hQ, ?_⟩ + rintro ⟨R, hdisj_RQ, v₂, v₄, v₁, v₃, hR_ends, hQ_ends, hcr_RQ⟩ + by_cases hRN : R ≤ N.G + · have hv₁_bar : v₁ ∈ N.Ω.bar := hcomp.2.1 ▸ hQ_ends.2.2.1 + have hv₃_bar : v₃ ∈ N.Ω.bar := hcomp.2.1 ▸ hQ_ends.2.2.2 + have hv₂_bar : v₂ ∈ N.Ω.bar := hcomp.2.1 ▸ hR_ends.2.2.1 + have hv₄_bar : v₄ ∈ N.Ω.bar := hcomp.2.1 ▸ hR_ends.2.2.2 + have hcr_N : N.Ω.Crosses v₁ v₃ v₂ v₄ := hcomp.2.1 ▸ hcr_RQ.symm + exact not_omegaPathsCross_of_isRural hrural + ⟨hdisj_RQ.symm, v₁, v₃, v₂, v₄, + ⟨hQ_ends.1.of_le hQN, hQ_ends.2.1, hv₁_bar, hv₃_bar⟩, + ⟨hR_ends.1.of_le hRN, hR_ends.2.1, hv₂_bar, hv₄_bar⟩, + hcr_N⟩ + · exact not_both_not_le_right_of_crosses_in_rural hcomp hrural hQN hQ_ends + hR_ends.1 hR_ends.2.1 hR_ends.2.2.1 + hR_ends.1.symm hR_ends.2.1.symm hR_ends.2.2.2 + hdisj_RQ.symm hdisj_RQ.symm hcr_RQ.symm hRN hRN + +/-- Variation of `Society.theorem_5_1_proof` when the separating path `Q` belongs to `P_set` itself: +if `Q ∈ P_set` +has ends `a, b` and is separating in `S`, then there is a crossing pair in `P_set` with all ends in +`S.Ω.interval a b`. -/ +theorem exists_cross_in_interval_of_mem_separating {S : Society α β} + {P_set : Set (Graph α β)} {Q : Graph α β} {a b : α} + (hQ_in : Q ∈ P_set) (hQ_ends : S.IsOmegaPathWithEnds Q a b) + (hQ_sep : S.IsSeparatingOmegaPath Q) (hcrooked : S.IsCrookedTransaction P_set) : + ∃ P₁ ∈ P_set, ∃ P₂ ∈ P_set, + S.OmegaPathsCross P₁ P₂ ∧ + pathEnds S.G P₁ ⊆ S.Ω.interval a b ∧ + pathEnds S.G P₂ ⊆ S.Ω.interval a b := by + have hne : (S.Ω.interval a b ∩ S.transactionEnds P_set).Nonempty := by + by_contra h_empty + rw [not_nonempty_iff_eq_empty, ← disjoint_iff_inter_eq_empty] at h_empty + exact hcrooked.2 Q hQ_in ⟨hQ_in, a, b, hQ_ends, Or.inl h_empty⟩ + refine S.exists_cross_in_interval_of_disjoint_paths hQ_ends hQ_sep hcrooked ?_ + (by simpa only [inter_comm] using hne) + intro R hR hends + obtain ⟨A, B, hfence⟩ := hcrooked.1 + apply hfence.1.2 hR hQ_in + rintro rfl + obtain ⟨x, hx_end, hx_ab⟩ := hends + rw [hQ_ends.1.pathEnds_eq, mem_insert_iff, mem_singleton_iff] at hx_end + exact hx_ab.1.2 hx_end + +/-- In a rural composition `S_comp.IsComposition S N`, no member `Q` of a crooked transaction +`P_set` +in `S_comp` is a subgraph of `N.G`. -/ +theorem forall_not_le_right_of_isCrookedTransaction {S S_comp : Society α β} {N : Neighborhood α β} + {P_set : Set (Graph α β)} (hcomp : S_comp.IsComposition S N) (hrural : N.IsRural) + (hcrooked : S_comp.IsCrookedTransaction P_set) : + ∀ Q ∈ P_set, ¬ Q ≤ N.G := by + intro Q hQ_in hQN + obtain ⟨A, B, hfence⟩ := hcrooked.1 + obtain ⟨v₁, _, v₃, _, hQ_ends⟩ := hfence.2.2 Q hQ_in + have hQ_sep : S_comp.IsSeparatingOmegaPath Q := + isSeparatingOmegaPath_of_isRural hcomp hrural hQN ⟨v₁, v₃, hQ_ends⟩ + have h_side : ∀ {x y : α}, S_comp.IsOmegaPathWithEnds Q x y → + ∃ R ∈ P_set, ¬ R ≤ N.G ∧ Disjoint V(Q) V(R) ∧ + ∃ u w : α, S_comp.IsOmegaPathWithEnds R u w ∧ u ∈ S_comp.Ω.interval x y := by + intro x y hQ_xy + obtain ⟨P₁, hP₁_in, P₂, hP₂_in, hcr12, hends₁, hends₂⟩ := + exists_cross_in_interval_of_mem_separating hQ_in hQ_xy hQ_sep hcrooked + rcases hcr12 with ⟨hdisj12, u₁, w₁, u₂, w₂, hP₁_ends, hP₂_ends, hcr_ends⟩ + have hu₁_xy : u₁ ∈ S_comp.Ω.interval x y := by + apply hends₁; rw [hP₁_ends.1.pathEnds_eq]; exact Or.inl rfl + have hu₂_xy : u₂ ∈ S_comp.Ω.interval x y := by + apply hends₂; rw [hP₂_ends.1.pathEnds_eq]; exact Or.inl rfl + have hP₁_ne_Q : P₁ ≠ Q := by + intro h_eq; subst P₁ + have : u₁ ∈ pathEnds S_comp.G Q := by rw [hP₁_ends.1.pathEnds_eq]; exact Or.inl rfl + rw [hQ_xy.1.pathEnds_eq, mem_insert_iff, mem_singleton_iff] at this + exact hu₁_xy.1.2 this + have hP₂_ne_Q : P₂ ≠ Q := by + intro h_eq; subst P₂ + have : u₂ ∈ pathEnds S_comp.G Q := by rw [hP₂_ends.1.pathEnds_eq]; exact Or.inl rfl + rw [hQ_xy.1.pathEnds_eq, mem_insert_iff, mem_singleton_iff] at this + exact hu₂_xy.1.2 this + by_cases hP₁_N : P₁ ≤ N.G + · have hP₂_not_N : ¬ P₂ ≤ N.G := fun hP₂_N => by + have hu₁_bar : u₁ ∈ N.Ω.bar := hcomp.2.1 ▸ hP₁_ends.2.2.1 + have hw₁_bar : w₁ ∈ N.Ω.bar := hcomp.2.1 ▸ hP₁_ends.2.2.2 + have hu₂_bar : u₂ ∈ N.Ω.bar := hcomp.2.1 ▸ hP₂_ends.2.2.1 + have hw₂_bar : w₂ ∈ N.Ω.bar := hcomp.2.1 ▸ hP₂_ends.2.2.2 + have hcr_N : N.Ω.Crosses u₁ w₁ u₂ w₂ := hcomp.2.1 ▸ hcr_ends + exact not_omegaPathsCross_of_isRural hrural + ⟨hdisj12, u₁, w₁, u₂, w₂, + ⟨hP₁_ends.1.of_le hP₁_N, hP₁_ends.2.1, hu₁_bar, hw₁_bar⟩, + ⟨hP₂_ends.1.of_le hP₂_N, hP₂_ends.2.1, hu₂_bar, hw₂_bar⟩, + hcr_N⟩ + exact ⟨P₂, hP₂_in, hP₂_not_N, hfence.1.2 hQ_in hP₂_in hP₂_ne_Q.symm, + u₂, w₂, hP₂_ends, hu₂_xy⟩ + · exact ⟨P₁, hP₁_in, hP₁_N, hfence.1.2 hQ_in hP₁_in hP₁_ne_Q.symm, + u₁, w₁, hP₁_ends, hu₁_xy⟩ + obtain ⟨R₁, _, hR₁_not_N, hdisj₁, v₂, a, hR₁_ends, hv₂_int⟩ := h_side hQ_ends + obtain ⟨R₂, _, hR₂_not_N, hdisj₂, v₄, b, hR₂_ends, hv₄_int⟩ := h_side (hQ_ends.symm S_comp) + have hcr : S_comp.Ω.Crosses v₁ v₃ v₂ v₄ := + S_comp.Ω.crosses_iff_interval.mpr (Or.inl ⟨hv₂_int, hv₄_int⟩) + exact not_both_not_le_right_of_crosses_in_rural hcomp hrural hQN hQ_ends + hR₁_ends.1 hR₁_ends.2.1 hR₁_ends.2.2.1 + hR₂_ends.1 hR₂_ends.2.1 hR₂_ends.2.2.1 + hdisj₁ hdisj₂ hcr hR₁_not_N hR₂_not_N + +/-- Two vertex-disjoint paths `Q₁, Q₂ ≤ N.G` in a rural neighborhood `N` with ends in `N.Ω₀.bar` +cannot have crossing ends in `N.Ω₀`. -/ +theorem not_crosses_inner_of_disjoint_paths {N : Neighborhood α β} (hrural : N.IsRural) + {Q₁ Q₂ : Graph α β} {x₁ y₁ x₂ y₂ : α} + (hQ₁ : IsGraphPathWithEnds N.G Q₁ x₁ y₁) (hx₁ : x₁ ∈ N.Ω₀.bar) (hy₁ : y₁ ∈ N.Ω₀.bar) + (hQ₂ : IsGraphPathWithEnds N.G Q₂ x₂ y₂) (hx₂ : x₂ ∈ N.Ω₀.bar) (hy₂ : y₂ ∈ N.Ω₀.bar) + (hdisj : Disjoint V(Q₁) V(Q₂)) : + ¬ N.Ω₀.Crosses x₁ y₁ x₂ y₂ := by + intro hcr + obtain ⟨Γ, Δ, Δ₀, hΔ, _, hU_sub, _, _, _, hinner⟩ := hrural + rcases hinner with ⟨_, hΩ₀_emp⟩ | ⟨hΔ₀, φ₀, _, hφ₀⟩ + · exact notMem_empty x₁ (hΩ₀_emp ▸ hx₁) + · have hx₁G : x₁ ∈ V(N.G) := N.bar₀_subset hx₁ + have hy₁G : y₁ ∈ V(N.G) := N.bar₀_subset hy₁ + have hx₂G : x₂ ∈ V(N.G) := N.bar₀_subset hx₂ + have hy₂G : y₂ ∈ V(N.G) := N.bar₀_subset hy₂ + have hV₁_Δ : graphDrawingSubgraphU Γ Q₁ ⊆ Δ := + (graphDrawingSubgraphU_subset_U' Γ Q₁).trans (hU_sub.trans sdiff_subset) + have hV₂_Δ : graphDrawingSubgraphU Γ Q₂ ⊆ Δ := + (graphDrawingSubgraphU_subset_U' Γ Q₂).trans (hU_sub.trans sdiff_subset) + obtain ⟨hV₁_comp, hV₁_conn, _, _⟩ := + isCompact_and_isConnected_subgraphU_of_isGraphPathWithEnds hΔ hQ₁ hV₁_Δ + obtain ⟨hV₂_comp, hV₂_conn, _, _⟩ := + isCompact_and_isConnected_subgraphU_of_isGraphPathWithEnds hΔ hQ₂ hV₂_Δ + have hV₁_sub : graphDrawingSubgraphU Γ Q₁ ⊆ (interior Δ₀)ᶜ := + fun p hp => (hU_sub (graphDrawingSubgraphU_subset_U' Γ Q₁ hp)).2 + have hV₂_sub : graphDrawingSubgraphU Γ Q₂ ⊆ (interior Δ₀)ᶜ := + fun p hp => (hU_sub (graphDrawingSubgraphU_subset_U' Γ Q₂ hp)).2 + have hne := nonempty_inter_of_crosses_on_inner_bd hΔ₀ hφ₀ hcr + ⟨hx₁G, rfl⟩ ⟨hy₁G, rfl⟩ ⟨hx₂G, rfl⟩ ⟨hy₂G, rfl⟩ + hV₁_comp hV₂_comp hV₁_conn hV₂_conn hV₁_sub hV₂_sub + (Or.inl (mem_iUnion₂.mpr ⟨x₁, hQ₁.left_mem, hx₁G, rfl⟩)) + (Or.inl (mem_iUnion₂.mpr ⟨y₁, hQ₁.right_mem, hy₁G, rfl⟩)) + (Or.inl (mem_iUnion₂.mpr ⟨x₂, hQ₂.left_mem, hx₂G, rfl⟩)) + (Or.inl (mem_iUnion₂.mpr ⟨y₂, hQ₂.right_mem, hy₂G, rfl⟩)) + obtain ⟨u, hu₁, hu₂⟩ := nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ hQ₁.le hQ₂.le + hne + exact disjoint_left.mp hdisj hu₁ hu₂ + +/-- If `Q ≤ N.G` is a path with ends `x, y ∈ N.Ω₀.bar` and `T₁, T₂ ≤ N.G` are paths from +`a₁, a₂ ∈ N.Ω.bar` to `z₁, z₂ ∈ N.Ω₀.bar` both vertex-disjoint from `Q`, then `x, y` cannot cross +`z₁, z₂` in `N.Ω₀`. -/ +theorem not_crosses_inner_of_disjoint_paths_to_outer {N : Neighborhood α β} (hrural : N.IsRural) + {Q T₁ T₂ : Graph α β} {x y a₁ z₁ a₂ z₂ : α} + (hQ : IsGraphPathWithEnds N.G Q x y) (hx : x ∈ N.Ω₀.bar) (hy : y ∈ N.Ω₀.bar) + (hT₁ : IsGraphPathWithEnds N.G T₁ a₁ z₁) (ha₁ : a₁ ∈ N.Ω.bar) (hz₁ : z₁ ∈ N.Ω₀.bar) + (hT₂ : IsGraphPathWithEnds N.G T₂ a₂ z₂) (ha₂ : a₂ ∈ N.Ω.bar) (hz₂ : z₂ ∈ N.Ω₀.bar) + (hdisj₁ : Disjoint V(Q) V(T₁)) (hdisj₂ : Disjoint V(Q) V(T₂)) : + ¬ N.Ω₀.Crosses x y z₁ z₂ := by + intro hcr + obtain ⟨Γ, Δ, Δ₀, hΔ, hΔ₀_sub, hU_sub, hbd, hbd₀, ⟨φ, _, hφ⟩, hinner⟩ := hrural + let Y : Set α := {a₁, a₂} + have hY_bar : Y ⊆ N.Ω.bar := by rintro v (rfl | rfl) <;> assumption + let Ω' := N.Ω.restrict Y hY_bar + have hbar'G : Ω'.bar ⊆ V(N.G) := by + rw [N.Ω.restrict_bar hY_bar]; exact hY_bar.trans N.bar_subset + have hbar' : Ω'.bar ⊆ N.Ω.bar := by + rw [N.Ω.restrict_bar hY_bar]; exact hY_bar + have hcw' : ∀ v₁ v₂ v₃ : α, Ω'.IsClockwise3 v₁ v₂ v₃ → N.Ω.IsClockwise3 v₁ v₂ v₃ := + fun v₁ v₂ v₃ h => ((N.Ω.isClockwise3_restrict_iff hY_bar).mp h).2.2.2 + obtain ⟨Ψ, Ψ', Γ', Δ₀', _, _, _, _, _, _, hΔ₀'_sub, _, hU'_sub, _, _, _, + hU'_inter_bd, _, hbd', _, _, hinner'⟩ := + exists_clean_presentation_of_restrict_outer hbar'G hbar' hcw' Γ Δ Δ₀ hΔ hΔ₀_sub hU_sub + hbd hbd₀ φ hφ hinner + rcases hinner' with ⟨_, hΩ₀_emp⟩ | ⟨hΔ₀'_disc, φ₀', _, hφ₀'⟩ + · exact notMem_empty x (hΩ₀_emp ▸ hx) + · have hxG : x ∈ V(N.G) := N.bar₀_subset hx + have hyG : y ∈ V(N.G) := N.bar₀_subset hy + have ha₁G : a₁ ∈ V(N.G) := N.bar_subset ha₁ + have ha₂G : a₂ ∈ V(N.G) := N.bar_subset ha₂ + have hz₁G : z₁ ∈ V(N.G) := N.bar₀_subset hz₁ + have hz₂G : z₂ ∈ V(N.G) := N.bar₀_subset hz₂ + have hUQ_Δ : graphDrawingSubgraphU Γ' Q ⊆ Δ := + (graphDrawingSubgraphU_subset_U' Γ' Q).trans (hU'_sub.trans sdiff_subset) + have hUT₁_Δ : graphDrawingSubgraphU Γ' T₁ ⊆ Δ := + (graphDrawingSubgraphU_subset_U' Γ' T₁).trans (hU'_sub.trans sdiff_subset) + have hUT₂_Δ : graphDrawingSubgraphU Γ' T₂ ⊆ Δ := + (graphDrawingSubgraphU_subset_U' Γ' T₂).trans (hU'_sub.trans sdiff_subset) + obtain ⟨hUQ_comp, hUQ_conn, _, _⟩ := + isCompact_and_isConnected_subgraphU_of_isGraphPathWithEnds hΔ hQ hUQ_Δ + obtain ⟨hUT₁_comp, hUT₁_conn, _, _⟩ := + isCompact_and_isConnected_subgraphU_of_isGraphPathWithEnds hΔ hT₁ hUT₁_Δ + obtain ⟨hUT₂_comp, hUT₂_conn, _, _⟩ := + isCompact_and_isConnected_subgraphU_of_isGraphPathWithEnds hΔ hT₂ hUT₂_Δ + have hbd_eq_range : subBd Δ = range (Subtype.val ∘ φ) := by + ext p; simp only [mem_range, Function.comp_apply] + exact ⟨fun hp => ⟨φ.symm ⟨p, hp⟩, by simp⟩, fun ⟨z, hz⟩ => hz ▸ (φ z).2⟩ + have hbd_comp : IsCompact (subBd Δ) := by + rw [hbd_eq_range]; exact isCompact_range (continuous_subtype_val.comp φ.continuous) + have hbd_conn : IsConnected (subBd Δ) := by + rw [hbd_eq_range]; exact isConnected_range (continuous_subtype_val.comp φ.continuous) + let p_a₁ := (Γ'.iso.vertexEquiv ⟨a₁, ha₁G⟩).1 + let p_a₂ := (Γ'.iso.vertexEquiv ⟨a₂, ha₂G⟩).1 + have ha₁_Ω' : a₁ ∈ Ω'.bar := by rw [N.Ω.restrict_bar hY_bar]; exact Or.inl rfl + have ha₂_Ω' : a₂ ∈ Ω'.bar := by rw [N.Ω.restrict_bar hY_bar]; exact Or.inr rfl + have hp_a₁_bd : p_a₁ ∈ subBd Δ := (hbd' a₁ ha₁G).mpr ha₁_Ω' ⟨ha₁G, rfl⟩ + have hp_a₂_bd : p_a₂ ∈ subBd Δ := (hbd' a₂ ha₂G).mpr ha₂_Ω' ⟨ha₂G, rfl⟩ + have hp_a₁_T₁ : p_a₁ ∈ graphDrawingSubgraphU Γ' T₁ := + Or.inl (mem_iUnion₂.mpr ⟨a₁, hT₁.left_mem, ha₁G, rfl⟩) + have hp_a₂_T₂ : p_a₂ ∈ graphDrawingSubgraphU Γ' T₂ := + Or.inl (mem_iUnion₂.mpr ⟨a₂, hT₂.left_mem, ha₂G, rfl⟩) + let V₁ := graphDrawingSubgraphU Γ' Q + let V₂ := (graphDrawingSubgraphU Γ' T₁ ∪ subBd Δ) ∪ graphDrawingSubgraphU Γ' T₂ + have hV₂_comp : IsCompact V₂ := (hUT₁_comp.union hbd_comp).union hUT₂_comp + have hV₂_conn : IsConnected V₂ := + IsConnected.union ⟨p_a₂, Or.inr hp_a₂_bd, hp_a₂_T₂⟩ + (IsConnected.union ⟨p_a₁, hp_a₁_T₁, hp_a₁_bd⟩ hUT₁_conn hbd_conn) hUT₂_conn + have hV₁_sub : V₁ ⊆ (interior Δ₀')ᶜ := + fun p hp => (hU'_sub (graphDrawingSubgraphU_subset_U' Γ' Q hp)).2 + have hbd_sub_compl : subBd Δ ⊆ (interior Δ₀')ᶜ := by + intro p hp hp_int₀ + have hp_int_Δ : p ∈ interior Δ := interior_mono hΔ₀'_sub hp_int₀ + rw [subBd_eq_diff_interior_of_isClosed (isClosed_of_isClosedDisc hΔ)] at hp + exact hp.2 hp_int_Δ + have hV₂_sub : V₂ ⊆ (interior Δ₀')ᶜ := + union_subset (union_subset + (fun p hp => (hU'_sub (graphDrawingSubgraphU_subset_U' Γ' T₁ hp)).2) + hbd_sub_compl) + (fun p hp => (hU'_sub (graphDrawingSubgraphU_subset_U' Γ' T₂ hp)).2) + obtain ⟨p, hp₁, hp₂⟩ := nonempty_inter_of_crosses_on_inner_bd hΔ₀'_disc hφ₀' hcr + ⟨hxG, rfl⟩ ⟨hyG, rfl⟩ ⟨hz₁G, rfl⟩ ⟨hz₂G, rfl⟩ + hUQ_comp hV₂_comp hUQ_conn hV₂_conn hV₁_sub hV₂_sub + (Or.inl (mem_iUnion₂.mpr ⟨x, hQ.left_mem, hxG, rfl⟩)) + (Or.inl (mem_iUnion₂.mpr ⟨y, hQ.right_mem, hyG, rfl⟩)) + (Or.inl (Or.inl (Or.inl (mem_iUnion₂.mpr ⟨z₁, hT₁.right_mem, hz₁G, rfl⟩)))) + (Or.inr (Or.inl (mem_iUnion₂.mpr ⟨z₂, hT₂.right_mem, hz₂G, rfl⟩))) + rcases hp₂ with (hpT₁ | hp_bd) | hpT₂ + · obtain ⟨u, huQ, huT₁⟩ := + nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ' hQ.le hT₁.le ⟨p, hp₁, hpT₁⟩ + exact disjoint_left.mp hdisj₁ huQ huT₁ + · have hp_U : p ∈ Γ'.drawing.U := graphDrawingSubgraphU_subset_U' Γ' Q hp₁ + have hp_inter : p ∈ Γ'.drawing.U ∩ subBd Δ := ⟨hp_U, hp_bd⟩ + rw [hU'_inter_bd, mem_iUnion₂] at hp_inter + rcases hp_inter with ⟨v, hv_Ω', hp_v⟩ + rw [N.Ω.restrict_bar hY_bar] at hv_Ω' + have hv_V : p ∈ graphDrawingSubgraphU Γ' (singleVertexSubgraph N.G v) := by + left; rw [mem_iUnion₂]; exact ⟨v, by simp [singleVertexSubgraph], hp_v⟩ + obtain ⟨u, huQ, huv⟩ := nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ' + hQ.le (singleVertexSubgraph_le (hbar'G (by rw [N.Ω.restrict_bar hY_bar]; exact hv_Ω'))) + ⟨p, hp₁, hv_V⟩ + rw [vertexSet_singleVertexSubgraph, mem_singleton_iff] at huv + subst u + rcases hv_Ω' with rfl | rfl + · exact disjoint_left.mp hdisj₁ huQ hT₁.left_mem + · exact disjoint_left.mp hdisj₂ huQ hT₂.left_mem + · obtain ⟨u, huQ, huT₂⟩ := + nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ' hQ.le hT₂.le ⟨p, hp₁, hpT₂⟩ + exact disjoint_left.mp hdisj₂ huQ huT₂ + +/-- If `Ω₀.IsClockwise3 z₁ z₃ z₂` and `Ω₀.IsClockwise3 z₁ z₃ z₄`, there is a compact connected arc +`K₁ ⊆ subBd Δ₀` containing `q₁` and `q₃` and avoiding `q₂` and `q₄`. -/ +theorem exists_arc_in_subBd_avoiding_pair {G : Graph α β} + {Γ : GraphDrawing G EuclideanPlane} {Ω₀ : CyclicPerm α} {Δ₀ : Set EuclideanPlane} + {φ₀ : Circle ≃ₜ subBd Δ₀} (hagrees₀ : DrawingAgreesWithOArcHomeo Γ Ω₀ (subBd Δ₀) φ₀) + {z₁ z₃ z₂ z₄ : α} + (hclw₂ : Ω₀.IsClockwise3 z₁ z₃ z₂) (hclw₄ : Ω₀.IsClockwise3 z₁ z₃ z₄) + {q₁ q₃ q₂ q₄ : EuclideanPlane} + (hq₁ : q₁ ∈ graphDrawingVertexSet Γ z₁) + (hq₃ : q₃ ∈ graphDrawingVertexSet Γ z₃) + (hq₂ : q₂ ∈ graphDrawingVertexSet Γ z₂) + (hq₄ : q₄ ∈ graphDrawingVertexSet Γ z₄) : + ∃ K₁ : Set EuclideanPlane, + IsCompact K₁ ∧ IsConnected K₁ ∧ q₁ ∈ K₁ ∧ q₃ ∈ K₁ ∧ K₁ ⊆ subBd Δ₀ ∧ + q₂ ∉ K₁ ∧ q₄ ∉ K₁ := by + obtain ⟨t₁, t₃, t₂, ht13, ht32, ht21, hφ₁, hφ₃, _⟩ := hagrees₀.2 z₁ z₃ z₂ hclw₂ + let f : ℝ → EuclideanPlane := fun t => (φ₀ (Circle.exp t)).1 + have hf_cont : Continuous f := + continuous_subtype_val.comp (φ₀.continuous.comp Circle.exp.continuous) + let K₁ : Set EuclideanPlane := f '' Icc t₁ t₃ + have h_not_mem : ∀ {u : α} {q_u : EuclideanPlane}, + Ω₀.IsClockwise3 z₁ z₃ u → q_u ∈ graphDrawingVertexSet Γ u → q_u ∉ K₁ := by + rintro u q_u hclw_u hq_u ⟨t, ⟨ht₁, ht₃⟩, ht_eq⟩ + have hφ_t : (φ₀ (Circle.exp t)).1 ∈ graphDrawingVertexSet Γ u := by + change f t ∈ _; rw [ht_eq]; exact hq_u + by_cases h_eq : t = t₁ + · subst h_eq + have hzu : z₁ = u := graphDrawingVertexSet_inj Γ hφ₁ hφ_t + exact (Ω₀.isClockwise3_iff.mp hclw_u).2.1 hzu + · have ht1_lt : t₁ < t := lt_of_le_of_ne ht₁ (Ne.symm h_eq) + have ht_2pi : t < t₁ + 2 * Real.pi := lt_of_le_of_lt ht₃ (ht32.trans ht21) + have ht3_2pi : t₃ < t₁ + 2 * Real.pi := ht32.trans ht21 + have hlt_ang := angleDiff_lt_of_isClockwise3 hagrees₀ hclw_u hφ₁ hφ₃ hφ_t + rw [angleDiff_exp_of_lt ht13 ht3_2pi, angleDiff_exp_of_lt ht1_lt ht_2pi] at hlt_ang + linarith + refine ⟨K₁, isCompact_Icc.image hf_cont, + (isConnected_Icc ht13.le).image f hf_cont.continuousOn, + ⟨t₁, left_mem_Icc.mpr ht13.le, hφ₁.2.symm.trans hq₁.2⟩, + ⟨t₃, right_mem_Icc.mpr ht13.le, hφ₃.2.symm.trans hq₃.2⟩, + by rintro _ ⟨t, _, rfl⟩; exact (φ₀ (Circle.exp t)).2, + h_not_mem hclw₂ hq₂, h_not_mem hclw₄ hq₄⟩ + +/-- If `T₁, T₂, T₃, T₄ ≤ N.G` are pairwise vertex-disjoint paths from `a₁, a₂, a₃, a₄ ∈ N.Ω.bar` +to `z₁, z₂, z₃, z₄ ∈ N.Ω₀.bar`, then `N.Ω₀.Crosses z₁ z₂ z₃ z₄` implies +`¬ N.Ω.Crosses a₁ a₃ a₂ a₄`. -/ +theorem not_crosses_outer_of_crosses_inner_swap {N : Neighborhood α β} (hrural : N.IsRural) + {T₁ T₂ T₃ T₄ : Graph α β} {a₁ a₂ a₃ a₄ z₁ z₂ z₃ z₄ : α} + (hT₁ : IsGraphPathWithEnds N.G T₁ a₁ z₁) (ha₁ : a₁ ∈ N.Ω.bar) (hz₁ : z₁ ∈ N.Ω₀.bar) + (hT₂ : IsGraphPathWithEnds N.G T₂ a₂ z₂) (ha₂ : a₂ ∈ N.Ω.bar) (hz₂ : z₂ ∈ N.Ω₀.bar) + (hT₃ : IsGraphPathWithEnds N.G T₃ a₃ z₃) (ha₃ : a₃ ∈ N.Ω.bar) (hz₃ : z₃ ∈ N.Ω₀.bar) + (hT₄ : IsGraphPathWithEnds N.G T₄ a₄ z₄) (ha₄ : a₄ ∈ N.Ω.bar) (hz₄ : z₄ ∈ N.Ω₀.bar) + (hd12 : Disjoint V(T₁) V(T₂)) (hd14 : Disjoint V(T₁) V(T₄)) + (hd32 : Disjoint V(T₃) V(T₂)) (hd34 : Disjoint V(T₃) V(T₄)) + (hcr₀ : N.Ω₀.Crosses z₁ z₂ z₃ z₄) : + ¬ N.Ω.Crosses a₁ a₃ a₂ a₄ := by + intro hcr + obtain ⟨Γ, Δ, Δ₀, hΔ, hΔ₀_sub, hU_sub, hbd, hbd₀, ⟨φ, _, hφ⟩, hinner⟩ := hrural + rcases hinner with ⟨_, hΩ₀_emp⟩ | ⟨hΔ₀_disc, φ₀, _, hφ₀⟩ + · exact notMem_empty z₁ (hΩ₀_emp ▸ hz₁) + · have ha₁G : a₁ ∈ V(N.G) := N.bar_subset ha₁ + have ha₂G : a₂ ∈ V(N.G) := N.bar_subset ha₂ + have ha₃G : a₃ ∈ V(N.G) := N.bar_subset ha₃ + have ha₄G : a₄ ∈ V(N.G) := N.bar_subset ha₄ + have hz₁G : z₁ ∈ V(N.G) := N.bar₀_subset hz₁ + have hz₂G : z₂ ∈ V(N.G) := N.bar₀_subset hz₂ + have hz₃G : z₃ ∈ V(N.G) := N.bar₀_subset hz₃ + have hz₄G : z₄ ∈ V(N.G) := N.bar₀_subset hz₄ + let p₁ := (Γ.iso.vertexEquiv ⟨a₁, ha₁G⟩).1 + let p₂ := (Γ.iso.vertexEquiv ⟨a₂, ha₂G⟩).1 + let p₃ := (Γ.iso.vertexEquiv ⟨a₃, ha₃G⟩).1 + let p₄ := (Γ.iso.vertexEquiv ⟨a₄, ha₄G⟩).1 + let q₁ := (Γ.iso.vertexEquiv ⟨z₁, hz₁G⟩).1 + let q₂ := (Γ.iso.vertexEquiv ⟨z₂, hz₂G⟩).1 + let q₃ := (Γ.iso.vertexEquiv ⟨z₃, hz₃G⟩).1 + let q₄ := (Γ.iso.vertexEquiv ⟨z₄, hz₄G⟩).1 + have hq₁_v : q₁ ∈ graphDrawingVertexSet Γ z₁ := ⟨hz₁G, rfl⟩ + have hq₂_v : q₂ ∈ graphDrawingVertexSet Γ z₂ := ⟨hz₂G, rfl⟩ + have hq₃_v : q₃ ∈ graphDrawingVertexSet Γ z₃ := ⟨hz₃G, rfl⟩ + have hq₄_v : q₄ ∈ graphDrawingVertexSet Γ z₄ := ⟨hz₄G, rfl⟩ + have hex_K₁ : ∃ K₁ : Set EuclideanPlane, + IsCompact K₁ ∧ IsConnected K₁ ∧ q₁ ∈ K₁ ∧ q₃ ∈ K₁ ∧ K₁ ⊆ subBd Δ₀ ∧ + q₂ ∉ K₁ ∧ q₄ ∉ K₁ := by + rcases N.Ω₀.crosses_iff_interval.mp hcr₀ with ⟨h132, h241⟩ | ⟨h142, h231⟩ + · have hc4 := N.Ω₀.isClockwise4_iff_interval.mpr ⟨h132, h241⟩ + have h134 : N.Ω₀.IsClockwise3 z₁ z₃ z₄ := + N.Ω₀.isClockwise3_rotate + (N.Ω₀.isClockwise4_iff_interval.mp + (N.Ω₀.isClockwise4_rotate (N.Ω₀.isClockwise4_rotate (N.Ω₀.isClockwise4_rotate + hc4)))).1.2 + exact exists_arc_in_subBd_avoiding_pair hφ₀ h132.2 h134 hq₁_v hq₃_v hq₂_v hq₄_v + · have hc4 := N.Ω₀.isClockwise4_iff_interval.mpr ⟨h142, h231⟩ + have h312 : N.Ω₀.IsClockwise3 z₃ z₁ z₂ := N.Ω₀.isClockwise3_rotate h231.2 + have h314 : N.Ω₀.IsClockwise3 z₃ z₁ z₄ := + (N.Ω₀.isClockwise4_iff_interval.mp (N.Ω₀.isClockwise4_rotate hc4)).2.2 + obtain ⟨K₁, hcomp, hconn, hq₃_K₁, hq₁_K₁, hsub, hq₂_not, hq₄_not⟩ := + exists_arc_in_subBd_avoiding_pair hφ₀ h312 h314 hq₃_v hq₁_v hq₂_v hq₄_v + exact ⟨K₁, hcomp, hconn, hq₁_K₁, hq₃_K₁, hsub, hq₂_not, hq₄_not⟩ + obtain ⟨R₁, hR₁_comp, hR₁_conn, hq₁_R₁, hq₃_R₁, hR₁_bd₀, hq₂_not_R₁, hq₄_not_R₁⟩ := hex_K₁ + have hbd₀_eq : subBd Δ₀ = discBd Δ₀ := subBd_eq_discBd_plane hΔ₀_disc + have hbd₀_sub : subBd Δ₀ ⊆ Δ₀ := hbd₀_eq ▸ Surface.discBd_subset Δ₀ + have hq₁_bd₀ : q₁ ∈ subBd Δ₀ := (hbd₀ z₁ hz₁G).mpr hz₁ hq₁_v + have hq₂_bd₀ : q₂ ∈ subBd Δ₀ := (hbd₀ z₂ hz₂G).mpr hz₂ hq₂_v + have hq₃_bd₀ : q₃ ∈ subBd Δ₀ := (hbd₀ z₃ hz₃G).mpr hz₃ hq₃_v + have hq₄_bd₀ : q₄ ∈ subBd Δ₀ := (hbd₀ z₄ hz₄G).mpr hz₄ hq₄_v + obtain ⟨R₀, hR₀_comp, hR₀_conn, hq₂_R₀, hq₄_R₀, hR₀_Δ₀, hR₀_int⟩ := + exists_compact_connected_in_disc_avoiding_bd hΔ₀_disc (hbd₀_sub hq₂_bd₀) (hbd₀_sub hq₄_bd₀) + let F : Set EuclideanPlane := {q₁, q₃, q₂, q₄} + have hF_closed : IsClosed F := + (Finite.insert _ (Finite.insert _ (Finite.insert _ (finite_singleton _)))).isClosed + have hF_sub : F ⊆ discBd Δ₀ := by + rw [← hbd₀_eq]; rintro x (rfl | rfl | rfl | rfl) <;> assumption + obtain ⟨Ψ, _, hΨ_cont, _, _, hΨ_inj, hΨ_sub, hΨ_fix, hΨ_int⟩ := + exists_disc_shrink_map hΔ₀_disc hF_closed hF_sub + have hR₁_Δ₀ : R₁ ⊆ Δ₀ := hR₁_bd₀.trans hbd₀_sub + let K₁ := Ψ '' R₁ + let K₀ := Ψ '' R₀ + have hK₁_comp : IsCompact K₁ := hR₁_comp.image_of_continuousOn (hΨ_cont.mono hR₁_Δ₀) + have hK₀_comp : IsCompact K₀ := hR₀_comp.image_of_continuousOn (hΨ_cont.mono hR₀_Δ₀) + have hK₁_conn : IsConnected K₁ := hR₁_conn.image Ψ (hΨ_cont.mono hR₁_Δ₀) + have hK₀_conn : IsConnected K₀ := hR₀_conn.image Ψ (hΨ_cont.mono hR₀_Δ₀) + have hq₁_K₁ : q₁ ∈ K₁ := ⟨q₁, hq₁_R₁, hΨ_fix q₁ (by simp [F])⟩ + have hq₃_K₁ : q₃ ∈ K₁ := ⟨q₃, hq₃_R₁, hΨ_fix q₃ (by simp [F])⟩ + have hq₂_K₀ : q₂ ∈ K₀ := ⟨q₂, hq₂_R₀, hΨ_fix q₂ (by simp [F])⟩ + have hq₄_K₀ : q₄ ∈ K₀ := ⟨q₄, hq₄_R₀, hΨ_fix q₄ (by simp [F])⟩ + have hK₁_Δ₀ : K₁ ⊆ Δ₀ := (image_mono hR₁_Δ₀).trans hΨ_sub + have hK₀_Δ₀ : K₀ ⊆ Δ₀ := (image_mono hR₀_Δ₀).trans hΨ_sub + have hΔ₀_diff_bd : Δ₀ \ discBd Δ₀ = interior Δ₀ := by + rw [← hbd₀_eq, subBd_eq_diff_interior_of_isClosed (isClosed_of_isClosedDisc hΔ₀_disc)] + ext x; simp only [mem_sdiff, not_and, not_not] + exact ⟨fun ⟨hx, h⟩ => h hx, fun hx => ⟨interior_subset hx, fun _ => hx⟩⟩ + have hK₁_int : K₁ ⊆ {q₁, q₃} ∪ interior Δ₀ := by + rintro _ ⟨y, hyR₁, rfl⟩ + by_cases hyF : y ∈ F + · rcases hyF with rfl | rfl | rfl | rfl + · left; left; exact hΨ_fix q₁ (by simp [F]) + · left; right; exact hΨ_fix q₃ (by simp [F]) + · exact (hq₂_not_R₁ hyR₁).elim + · exact (hq₄_not_R₁ hyR₁).elim + · right; rw [← hΔ₀_diff_bd]; exact hΨ_int y ⟨hR₁_Δ₀ hyR₁, hyF⟩ + have hK₀_int : K₀ ⊆ {q₂, q₄} ∪ interior Δ₀ := by + rintro _ ⟨y, hyR₀, rfl⟩ + by_cases hyF : y ∈ F + · rw [hΨ_fix y hyF] + rcases hR₀_int hyR₀ with hy | hy + · exact Or.inl hy + · apply Or.inr + exact hy + · exact Or.inr (hΔ₀_diff_bd ▸ hΨ_int y ⟨hR₀_Δ₀ hyR₀, hyF⟩) + have hdisj_K₁K₀ : Disjoint K₁ K₀ := by + rw [disjoint_left] + rintro _ ⟨y₁, hy₁, rfl⟩ ⟨y₂, hy₂, hy_eq⟩ + have hy12 : y₁ = y₂ := hΨ_inj (hR₁_Δ₀ hy₁) (hR₀_Δ₀ hy₂) hy_eq.symm + subst hy12 + rcases hR₀_int hy₂ with (rfl | rfl) | hy_int + · exact hq₂_not_R₁ hy₁ + · exact hq₄_not_R₁ hy₁ + · exact (subBd_eq_diff_interior_of_isClosed + (isClosed_of_isClosedDisc hΔ₀_disc) ▸ hR₁_bd₀ hy₁).2 hy_int + have hUT₁_Δ : graphDrawingSubgraphU Γ T₁ ⊆ Δ := + (graphDrawingSubgraphU_subset_U' Γ T₁).trans (hU_sub.trans sdiff_subset) + have hUT₂_Δ : graphDrawingSubgraphU Γ T₂ ⊆ Δ := + (graphDrawingSubgraphU_subset_U' Γ T₂).trans (hU_sub.trans sdiff_subset) + have hUT₃_Δ : graphDrawingSubgraphU Γ T₃ ⊆ Δ := + (graphDrawingSubgraphU_subset_U' Γ T₃).trans (hU_sub.trans sdiff_subset) + have hUT₄_Δ : graphDrawingSubgraphU Γ T₄ ⊆ Δ := + (graphDrawingSubgraphU_subset_U' Γ T₄).trans (hU_sub.trans sdiff_subset) + obtain ⟨hUT₁_comp, hUT₁_conn, _, _⟩ := + isCompact_and_isConnected_subgraphU_of_isGraphPathWithEnds hΔ hT₁ hUT₁_Δ + obtain ⟨hUT₂_comp, hUT₂_conn, _, _⟩ := + isCompact_and_isConnected_subgraphU_of_isGraphPathWithEnds hΔ hT₂ hUT₂_Δ + obtain ⟨hUT₃_comp, hUT₃_conn, _, _⟩ := + isCompact_and_isConnected_subgraphU_of_isGraphPathWithEnds hΔ hT₃ hUT₃_Δ + obtain ⟨hUT₄_comp, hUT₄_conn, _, _⟩ := + isCompact_and_isConnected_subgraphU_of_isGraphPathWithEnds hΔ hT₄ hUT₄_Δ + have hq₁_T₁ : q₁ ∈ graphDrawingSubgraphU Γ T₁ := + Or.inl (mem_iUnion₂.mpr ⟨z₁, hT₁.right_mem, hz₁G, rfl⟩) + have hq₂_T₂ : q₂ ∈ graphDrawingSubgraphU Γ T₂ := + Or.inl (mem_iUnion₂.mpr ⟨z₂, hT₂.right_mem, hz₂G, rfl⟩) + have hq₃_T₃ : q₃ ∈ graphDrawingSubgraphU Γ T₃ := + Or.inl (mem_iUnion₂.mpr ⟨z₃, hT₃.right_mem, hz₃G, rfl⟩) + have hq₄_T₄ : q₄ ∈ graphDrawingSubgraphU Γ T₄ := + Or.inl (mem_iUnion₂.mpr ⟨z₄, hT₄.right_mem, hz₄G, rfl⟩) + let V₁ := (graphDrawingSubgraphU Γ T₁ ∪ K₁) ∪ graphDrawingSubgraphU Γ T₃ + let V₂ := (graphDrawingSubgraphU Γ T₂ ∪ K₀) ∪ graphDrawingSubgraphU Γ T₄ + have hV₁_comp : IsCompact V₁ := (hUT₁_comp.union hK₁_comp).union hUT₃_comp + have hV₂_comp : IsCompact V₂ := (hUT₂_comp.union hK₀_comp).union hUT₄_comp + have hV₁_conn : IsConnected V₁ := + IsConnected.union ⟨q₃, Or.inr hq₃_K₁, hq₃_T₃⟩ + (IsConnected.union ⟨q₁, hq₁_T₁, hq₁_K₁⟩ hUT₁_conn hK₁_conn) hUT₃_conn + have hV₂_conn : IsConnected V₂ := + IsConnected.union ⟨q₄, Or.inr hq₄_K₀, hq₄_T₄⟩ + (IsConnected.union ⟨q₂, hq₂_T₂, hq₂_K₀⟩ hUT₂_conn hK₀_conn) hUT₄_conn + have hV₁_Δ : V₁ ⊆ Δ := + union_subset (union_subset hUT₁_Δ (hK₁_Δ₀.trans hΔ₀_sub)) hUT₃_Δ + have hV₂_Δ : V₂ ⊆ Δ := + union_subset (union_subset hUT₂_Δ (hK₀_Δ₀.trans hΔ₀_sub)) hUT₄_Δ + have hp₁_V₁ : p₁ ∈ V₁ := + Or.inl (Or.inl (Or.inl (mem_iUnion₂.mpr ⟨a₁, hT₁.left_mem, ha₁G, rfl⟩))) + have hp₃_V₁ : p₃ ∈ V₁ := + Or.inr (Or.inl (mem_iUnion₂.mpr ⟨a₃, hT₃.left_mem, ha₃G, rfl⟩)) + have hp₂_V₂ : p₂ ∈ V₂ := + Or.inl (Or.inl (Or.inl (mem_iUnion₂.mpr ⟨a₂, hT₂.left_mem, ha₂G, rfl⟩))) + have hp₄_V₂ : p₄ ∈ V₂ := + Or.inr (Or.inl (mem_iUnion₂.mpr ⟨a₄, hT₄.left_mem, ha₄G, rfl⟩)) + have hcross_bd : PairsCrossOn (discBd Δ) p₁ p₃ p₂ p₄ := by + rw [discBd_eq_subBd hΔ] + exact pairsCrossOn_of_crosses hφ hcr ⟨ha₁G, rfl⟩ ⟨ha₃G, rfl⟩ ⟨ha₂G, rfl⟩ ⟨ha₄G, rfl⟩ + obtain ⟨x, hx₁, hx₂⟩ := disc_crossing Δ V₁ V₂ p₁ p₃ p₂ p₄ hΔ hV₁_Δ hV₂_Δ + hV₁_comp hV₂_comp hV₁_conn hV₂_conn hp₁_V₁ hp₃_V₁ hp₂_V₂ hp₄_V₂ hcross_bd + have h_not_T_K₀ : ∀ {T : Graph α β}, T ≤ N.G → + Disjoint V(T) V(T₂) → Disjoint V(T) V(T₄) → + x ∈ graphDrawingSubgraphU Γ T → x ∈ K₀ → False := by + intro T hTG hd2 hd4 hxT hxK₀ + rcases hK₀_int hxK₀ with (rfl | rfl) | hx_int₀ + · obtain ⟨u, huT, huT₂⟩ := + nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ hTG hT₂.le ⟨q₂, hxT, hq₂_T₂⟩ + exact disjoint_left.mp hd2 huT huT₂ + · obtain ⟨u, huT, huT₄⟩ := + nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ hTG hT₄.le ⟨q₄, hxT, hq₄_T₄⟩ + exact disjoint_left.mp hd4 huT huT₄ + · exact (hU_sub (graphDrawingSubgraphU_subset_U' Γ T hxT)).2 hx_int₀ + have h_not_K₁_T : ∀ {T : Graph α β}, T ≤ N.G → + Disjoint V(T₁) V(T) → Disjoint V(T₃) V(T) → + x ∈ K₁ → x ∈ graphDrawingSubgraphU Γ T → False := by + intro T hTG hd1 hd3 hxK₁ hxT + rcases hK₁_int hxK₁ with (rfl | rfl) | hx_int₀ + · obtain ⟨u, huT₁, huT⟩ := + nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ hT₁.le hTG ⟨q₁, hq₁_T₁, hxT⟩ + exact disjoint_left.mp hd1 huT₁ huT + · obtain ⟨u, huT₃, huT⟩ := + nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ hT₃.le hTG ⟨q₃, hq₃_T₃, hxT⟩ + exact disjoint_left.mp hd3 huT₃ huT + · exact (hU_sub (graphDrawingSubgraphU_subset_U' Γ T hxT)).2 hx_int₀ + rcases hx₁ with (hxT₁ | hxK₁) | hxT₃ <;> rcases hx₂ with (hxT₂ | hxK₀) | hxT₄ + · obtain ⟨u, hu₁, hu₂⟩ := + nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ hT₁.le hT₂.le ⟨x, hxT₁, hxT₂⟩ + exact disjoint_left.mp hd12 hu₁ hu₂ + · exact h_not_T_K₀ hT₁.le hd12 hd14 hxT₁ hxK₀ + · obtain ⟨u, hu₁, hu₄⟩ := + nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ hT₁.le hT₄.le ⟨x, hxT₁, hxT₄⟩ + exact disjoint_left.mp hd14 hu₁ hu₄ + · exact h_not_K₁_T hT₂.le hd12 hd32 hxK₁ hxT₂ + · exact disjoint_left.mp hdisj_K₁K₀ hxK₁ hxK₀ + · exact h_not_K₁_T hT₄.le hd14 hd34 hxK₁ hxT₄ + · obtain ⟨u, hu₃, hu₂⟩ := + nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ hT₃.le hT₂.le ⟨x, hxT₃, hxT₂⟩ + exact disjoint_left.mp hd32 hu₃ hu₂ + · exact h_not_T_K₀ hT₃.le hd32 hd34 hxT₃ hxK₀ + · obtain ⟨u, hu₃, hu₄⟩ := + nonempty_inter_vertexSet_of_nonempty_inter_subgraphU' Γ hT₃.le hT₄.le ⟨x, hxT₃, hxT₄⟩ + exact disjoint_left.mp hd34 hu₃ hu₄ + +/-- Four pairwise vertex-disjoint paths `T₁, T₂, T₃, T₄ ≤ N.G` from `a₁, a₂, a₃, a₄ ∈ N.Ω.bar` to +`z₁, z₂, z₃, z₄ ∈ N.Ω₀.bar` preserve and reflect crossing of opposite pairs: +`N.Ω.Crosses a₁ a₃ a₂ a₄ ↔ N.Ω₀.Crosses z₁ z₃ z₂ z₄`. -/ +theorem crosses_outer_iff_crosses_inner_of_disjoint_paths {N : Neighborhood α β} + (hrural : N.IsRural) + {T₁ T₂ T₃ T₄ : Graph α β} {a₁ a₂ a₃ a₄ z₁ z₂ z₃ z₄ : α} + (hT₁ : IsGraphPathWithEnds N.G T₁ a₁ z₁) (ha₁ : a₁ ∈ N.Ω.bar) (hz₁ : z₁ ∈ N.Ω₀.bar) + (hT₂ : IsGraphPathWithEnds N.G T₂ a₂ z₂) (ha₂ : a₂ ∈ N.Ω.bar) (hz₂ : z₂ ∈ N.Ω₀.bar) + (hT₃ : IsGraphPathWithEnds N.G T₃ a₃ z₃) (ha₃ : a₃ ∈ N.Ω.bar) (hz₃ : z₃ ∈ N.Ω₀.bar) + (hT₄ : IsGraphPathWithEnds N.G T₄ a₄ z₄) (ha₄ : a₄ ∈ N.Ω.bar) (hz₄ : z₄ ∈ N.Ω₀.bar) + (hd12 : Disjoint V(T₁) V(T₂)) (hd13 : Disjoint V(T₁) V(T₃)) (hd14 : Disjoint V(T₁) V(T₄)) + (hd23 : Disjoint V(T₂) V(T₃)) (hd24 : Disjoint V(T₂) V(T₄)) (hd34 : Disjoint V(T₃) V(T₄)) : + N.Ω.Crosses a₁ a₃ a₂ a₄ ↔ N.Ω₀.Crosses z₁ z₃ z₂ z₄ := by + have ha12 : a₁ ≠ a₂ := fun h => disjoint_left.mp hd12 hT₁.left_mem (h ▸ hT₂.left_mem) + have ha13 : a₁ ≠ a₃ := fun h => disjoint_left.mp hd13 hT₁.left_mem (h ▸ hT₃.left_mem) + have ha14 : a₁ ≠ a₄ := fun h => disjoint_left.mp hd14 hT₁.left_mem (h ▸ hT₄.left_mem) + have ha23 : a₂ ≠ a₃ := fun h => disjoint_left.mp hd23 hT₂.left_mem (h ▸ hT₃.left_mem) + have ha24 : a₂ ≠ a₄ := fun h => disjoint_left.mp hd24 hT₂.left_mem (h ▸ hT₄.left_mem) + have ha34 : a₃ ≠ a₄ := fun h => disjoint_left.mp hd34 hT₃.left_mem (h ▸ hT₄.left_mem) + have hz12 : z₁ ≠ z₂ := fun h => disjoint_left.mp hd12 hT₁.right_mem (h ▸ hT₂.right_mem) + have hz13 : z₁ ≠ z₃ := fun h => disjoint_left.mp hd13 hT₁.right_mem (h ▸ hT₃.right_mem) + have hz14 : z₁ ≠ z₄ := fun h => disjoint_left.mp hd14 hT₁.right_mem (h ▸ hT₄.right_mem) + have hz23 : z₂ ≠ z₃ := fun h => disjoint_left.mp hd23 hT₂.right_mem (h ▸ hT₃.right_mem) + have hz24 : z₂ ≠ z₄ := fun h => disjoint_left.mp hd24 hT₂.right_mem (h ▸ hT₄.right_mem) + have hz34 : z₃ ≠ z₄ := fun h => disjoint_left.mp hd34 hT₃.right_mem (h ▸ hT₄.right_mem) + refine ⟨fun hcr => ?_, fun hcr₀ => ?_⟩ + · rcases N.Ω₀.crosses_of_four_distinct hz₁ hz₂ hz₃ hz₄ hz12 hz13 hz14 hz23 hz24 hz34 with + h14 | h12 | h13 + · exfalso + exact not_crosses_outer_of_crosses_inner_swap hrural + hT₁ ha₁ hz₁ hT₄ ha₄ hz₄ hT₃ ha₃ hz₃ hT₂ ha₂ hz₂ + hd14 hd12 hd34 hd23.symm h14.swap_right hcr.swap_right + · exfalso + exact not_crosses_outer_of_crosses_inner_swap hrural + hT₁ ha₁ hz₁ hT₂ ha₂ hz₂ hT₃ ha₃ hz₃ hT₄ ha₄ hz₄ + hd12 hd14 hd23.symm hd34 h12 hcr + · exact h13 + · rcases N.Ω.crosses_of_four_distinct ha₁ ha₂ ha₃ ha₄ ha12 ha13 ha14 ha23 ha24 ha34 with + h14 | h12 | h13 + · exfalso + exact not_crosses_outer_of_crosses_inner_swap hrural + hT₁ ha₁ hz₁ hT₃ ha₃ hz₃ hT₄ ha₄ hz₄ hT₂ ha₂ hz₂ + hd13 hd12 hd34.symm hd24.symm hcr₀.swap_right h14.swap_right + · exfalso + exact not_crosses_outer_of_crosses_inner_swap hrural + hT₁ ha₁ hz₁ hT₃ ha₃ hz₃ hT₂ ha₂ hz₂ hT₄ ha₄ hz₄ + hd13 hd14 hd23 hd24 hcr₀ h12 + · exact h13 + +/-- **Graph Minors IX, (9.1), Claim (4)** (page 62): +"For any $P \in \mathscr{P}$, at most one internal vertex of $P$ is in $\bar{\Omega}_1$, and the +subpaths of $P$ from such a vertex to the ends of $P$ both have an edge in $E(G)$." -/ +theorem lemma_9_1_claim_4 + {S : Society α β} {p : ℕ} + {N : Neighborhood α β} {S_comp : Society α β} {P_set : Set (Graph α β)} + (hmin : IsMinSection9Config S p N S_comp P_set) {P : Graph α β} (hP_in : P ∈ P_set) : + (pathInternalVerts S_comp.G P ∩ N.Ω.bar).Subsingleton ∧ + ∀ c ∈ pathInternalVerts S_comp.G P ∩ N.Ω.bar, + ∀ {a b : α} {Q : Graph α β}, S_comp.IsOmegaPathWithEnds P a b → Q ≤ P → + (IsGraphPathWithEnds P Q c a ∨ IsGraphPathWithEnds P Q c b) → + (E(Q) ∩ E(S.G)).Nonempty := by + have hbar_eq : N.Ω.bar = S_comp.Ω.bar := by rw [hmin.1.1.2.1] + rw [hbar_eq] + obtain ⟨hsub, hnonsep⟩ := lemma_9_1_claim_4_nonSeparating hmin hP_in + refine ⟨hsub, fun c hc {a b Q} hP_ends hQP hQ_or => ?_⟩ + have hQ_ns : S_comp.IsNonSeparatingOmegaPath Q := (hnonsep c hc).2 hP_ends hQP hQ_or + have hQ_not_le : ¬ Q ≤ N.G := + fun hQ_N => (isSeparatingOmegaPath_of_isRural hmin.1.1 hmin.1.2.1 hQ_N hQ_ns.1).2 hQ_ns.2 + rcases hQ_or with hQ_ca | hQ_cb + · exact nonempty_edgeSet_inter_of_not_le_right hmin.1.1 (hQ_ca.mono hP_ends.1.le) + (fun h => hc.1.2 (h ▸ ⟨b, hP_ends.1⟩)) hQ_not_le + · exact nonempty_edgeSet_inter_of_not_le_right hmin.1.1 (hQ_cb.mono hP_ends.1.le) + (fun h => hc.1.2 (h ▸ ⟨a, hP_ends.1.symm⟩)) hQ_not_le + +/-! ## Proof of Claim (5) and (9.1) (pages 62–63) -/ + +theorem IsGraphPathWithEnds.inc_left_unique {G P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) {e₁ e₂ : β} + (he₁ : e₁ ∈ E(P)) (he₂ : e₂ ∈ E(P)) (hinc₁ : P.Inc e₁ a) (hinc₂ : P.Inc e₂ a) : + e₁ = e₂ := by + rcases hP with ⟨_, W, hW, _, hEP⟩ + rw [hEP, mem_ofPred_eq] at he₁ he₂ + exact unique_inc_first hW he₁ he₂ hinc₁ hinc₂ + +/-- Given a path `P` from `s` to `t` and a set `Y` meeting `V(P)`, there is a first vertex +`u ∈ V(P) ∩ Y` from `s` along `P`, splitting `P` into `P₁` (`s` to `u`) and `P₂` (`u` to `t`) with +`Disjoint (V(P₁) \ {u}) Y`. -/ +theorem IsGraphPathWithEnds.exists_first_split_at_mem {G P : Graph α β} {s t : α} {Y : Set α} + (hP : IsGraphPathWithEnds G P s t) (hne : (V(P) ∩ Y).Nonempty) : + ∃ u ∈ V(P) ∩ Y, ∃ P₁ P₂ : Graph α β, + P₁ ≤ P ∧ P₂ ≤ P ∧ + IsGraphPathWithEnds P P₁ s u ∧ + IsGraphPathWithEnds P P₂ u t ∧ + GM09.subgraphUnion P P₁ P₂ = P ∧ + V(P₁) ∩ V(P₂) = {u} ∧ + Disjoint E(P₁) E(P₂) ∧ + Disjoint (V(P₁) \ {u}) Y := by + classical + have hex : ∃ n : ℕ, ∃ u ∈ V(P) ∩ Y, ∃ P₁ P₂ : Graph α β, + P₁ ≤ P ∧ P₂ ≤ P ∧ + IsGraphPathWithEnds P P₁ s u ∧ + IsGraphPathWithEnds P P₂ u t ∧ + GM09.subgraphUnion P P₁ P₂ = P ∧ + V(P₁) ∩ V(P₂) = {u} ∧ + Disjoint E(P₁) E(P₂) ∧ + V(P₁).ncard = n := by + rcases hne with ⟨u₀, hu₀P, hu₀Y⟩ + obtain ⟨P₁, P₂, hP₁, hP₂, hp₁, hp₂, hunion, hinter, hdisjE⟩ := hP.exists_split_at hu₀P + exact ⟨V(P₁).ncard, u₀, ⟨hu₀P, hu₀Y⟩, P₁, P₂, hP₁, hP₂, hp₁, hp₂, hunion, hinter, hdisjE, rfl⟩ + let n_min := Nat.find hex + obtain ⟨u, hu, P₁, P₂, hP₁, hP₂, hp₁, hp₂, hunion, hinter, hdisjE, hcard⟩ := Nat.find_spec hex + refine ⟨u, hu, P₁, P₂, hP₁, hP₂, hp₁, hp₂, hunion, hinter, hdisjE, ?_⟩ + rw [disjoint_left] + intro z ⟨hzP₁, hzu⟩ hzY + rw [mem_singleton_iff] at hzu + obtain ⟨Q₁, Q₂, hQ₁, hQ₂, hq₁, hq₂, hunionQ, hinterQ, hdisjEQ⟩ := hp₁.exists_split_at hzP₁ + have hQ₁_P : Q₁ ≤ P := hQ₁.trans hP₁ + have hQ₂_P : Q₂ ≤ P := hQ₂.trans hP₁ + let P₂' := GM09.subgraphUnion P Q₂ P₂ + have hV_Q₂_P₂ : V(Q₂) ∩ V(P₂) = {u} := by + refine Subset.antisymm ?_ (singleton_subset_iff.mpr ⟨hq₂.right_mem, hp₂.left_mem⟩) + rw [← hinter] + exact inter_subset_inter_left _ hQ₂.vertexSet_mono + have hp₂' : IsGraphPathWithEnds P P₂' z t := + (hq₂.mono hP₁).subgraphUnion hp₂ hV_Q₂_P₂ + have hV_Q₁_P₂' : V(Q₁) ∩ V(P₂') = {z} := by + ext w; simp only [P₂', vertexSet_subgraphUnion, mem_inter_iff, mem_union, mem_singleton_iff] + refine ⟨?_, fun h => h ▸ ⟨hq₁.right_mem, Or.inl hq₂.left_mem⟩⟩ + rintro ⟨hwQ₁, hwQ₂ | hwP₂⟩ + · have hw_in : w ∈ V(Q₁) ∩ V(Q₂) := ⟨hwQ₁, hwQ₂⟩ + rwa [hinterQ, mem_singleton_iff] at hw_in + · have hw_u : w = u := by + have hw_in : w ∈ V(P₁) ∩ V(P₂) := ⟨hQ₁.vertexSet_mono hwQ₁, hwP₂⟩ + rwa [hinter, mem_singleton_iff] at hw_in + subst hw_u + have hu_in : w ∈ V(Q₁) ∩ V(Q₂) := ⟨hwQ₁, hq₂.right_mem⟩ + rwa [hinterQ, mem_singleton_iff] at hu_in + have hP₂'_P : P₂' ≤ P := subgraphUnion_le hQ₂_P hP₂ + have hunion' : GM09.subgraphUnion P Q₁ P₂' = P := by + have hQ₁Q₂ : GM09.subgraphUnion P Q₁ Q₂ = P₁ := by + have h1 : GM09.subgraphUnion P Q₁ Q₂ ≤ P := subgraphUnion_le hQ₁_P hQ₂_P + refine (Compatible.of_le_le h1 hP₁).ext ?_ ?_ + · rw [vertexSet_subgraphUnion, ← vertexSet_subgraphUnion P₁ Q₁ Q₂, hunionQ] + · rw [edgeSet_subgraphUnion hQ₁_P hQ₂_P, ← edgeSet_subgraphUnion hQ₁ hQ₂, hunionQ] + refine (Compatible.of_le_le (subgraphUnion_le hQ₁_P hP₂'_P) le_rfl).ext ?_ ?_ + · rw [vertexSet_subgraphUnion, vertexSet_subgraphUnion, ← union_assoc, + ← vertexSet_subgraphUnion P Q₁ Q₂, hQ₁Q₂, ← vertexSet_subgraphUnion P P₁ P₂, hunion] + · rw [edgeSet_subgraphUnion hQ₁_P hP₂'_P, edgeSet_subgraphUnion hQ₂_P hP₂, ← union_assoc, + ← edgeSet_subgraphUnion hQ₁_P hQ₂_P, hQ₁Q₂, ← edgeSet_subgraphUnion hP₁ hP₂, hunion] + have hdisjE' : Disjoint E(Q₁) E(P₂') := + disjoint_edgeSet_of_inter_singleton (hq₁.mono hP₁) hP₂'_P hV_Q₁_P₂'.subset + have hu_not_Q₁ : u ∉ V(Q₁) := fun huQ₁ => by + have hu_in : u ∈ V(Q₁) ∩ V(Q₂) := ⟨huQ₁, hq₂.right_mem⟩ + rw [hinterQ, mem_singleton_iff] at hu_in + exact hzu hu_in.symm + have hlt : V(Q₁).ncard < n_min := by + change V(Q₁).ncard < Nat.find hex + rw [← hcard] + exact ncard_lt_ncard + ⟨hQ₁.vertexSet_mono, fun hsub => hu_not_Q₁ (hsub hp₁.right_mem)⟩ + hp₁.vertexSet_finite + exact Nat.find_min hex hlt ⟨z, ⟨hP₁.vertexSet_mono hzP₁, hzY⟩, Q₁, P₂', + hQ₁_P, hP₂'_P, hq₁.mono hP₁, hp₂', hunion', hV_Q₁_P₂', hdisjE', rfl⟩ + +/-- **Step A**: If `P` is an `S_comp.Ω`-path in `S_comp` (where `S_comp.IsComposition S N`) with +ends +`s, t` and `¬ P ≤ N.G`, then `P` splits into a prefix `L_P ≤ N.G` from `s` to `u ∈ S.Ω.bar`, a +middle subpath `M_P ≤ P` from `u` to `w ∈ S.Ω.bar` (`u ≠ w`) whose first and last edges are in +`E(S.G)`, and a suffix `R_P ≤ N.G` from `t` to `w`. -/ +theorem exists_middle_subpath_in_composition {S S_comp : Society α β} {N : Neighborhood α β} + {P : Graph α β} {s t : α} + (hcomp : S_comp.IsComposition S N) + (hP : S_comp.IsOmegaPathWithEnds P s t) (hnot_le : ¬ P ≤ N.G) : + ∃ u ∈ S.Ω.bar, ∃ w ∈ S.Ω.bar, u ≠ w ∧ + ∃ L_P M_P R_P : Graph α β, + L_P ≤ P ∧ M_P ≤ P ∧ R_P ≤ P ∧ + IsGraphPathWithEnds N.G L_P s u ∧ + IsGraphPathWithEnds S_comp.G M_P u w ∧ + IsGraphPathWithEnds N.G R_P t w ∧ + V(L_P) ∩ V(M_P) = {u} ∧ + V(R_P) ∩ V(M_P) = {w} ∧ + Disjoint V(L_P) V(R_P) ∧ + (∀ c e, M_P.IsLink e u c → e ∈ E(S.G)) ∧ + (∀ c e, M_P.IsLink e w c → e ∈ E(S.G)) := by + let Y : Set α := {v ∈ V(P) | ∃ e ∈ E(P) ∩ E(S.G), P.Inc e v} + obtain ⟨e₀, he₀P, he₀S⟩ := nonempty_edgeSet_inter_of_not_le_right hcomp hP.1 hP.2.1 hnot_le + obtain ⟨x₀, y₀, hx₀y₀⟩ := P.exists_isLink_of_mem_edgeSet he₀P + have hx₀Y : x₀ ∈ V(P) ∩ Y := ⟨hx₀y₀.left_mem, hx₀y₀.left_mem, e₀, ⟨he₀P, he₀S⟩, y₀, hx₀y₀⟩ + obtain ⟨u, ⟨huP, _, e_u, ⟨he_uP, he_uS⟩, z_u, hinc_u⟩, L_P, Q_ut, + hL_P, hQ_ut, hp_L, hp_Q, hunion₁, hinter₁, hdisjE₁, hdisjY₁⟩ := + hP.1.exists_first_split_at_mem ⟨x₀, hx₀Y⟩ + have hE_LP_disj : Disjoint E(L_P) E(S.G) := by + rw [disjoint_left] + intro e heL heS + have heP : e ∈ E(P) := hL_P.edgeSet_mono heL + obtain ⟨x, y, hxyL⟩ := L_P.exists_isLink_of_mem_edgeSet heL + have hxyP : P.IsLink e x y := hxyL.mono hL_P + have hxY : x ∈ Y := ⟨hxyP.left_mem, e, ⟨heP, heS⟩, y, hxyP⟩ + have hyY : y ∈ Y := ⟨hxyP.right_mem, e, ⟨heP, heS⟩, x, hxyP.symm⟩ + have hxu : x = u := by + by_contra hne; exact disjoint_left.mp hdisjY₁ ⟨hxyL.left_mem, hne⟩ hxY + have hyu : y = u := by + by_contra hne; exact disjoint_left.mp hdisjY₁ ⟨hxyL.right_mem, hne⟩ hyY + rw [hxu, hyu] at hxyP + exact hP.1.not_isLoopAt heP u (hxyP.mono hP.1.le) + have hLP_N : L_P ≤ N.G := by + have hLP_comp : L_P ≤ S_comp.G := hL_P.trans hP.1.le + rw [(Compatible.of_le_le hLP_comp hcomp.1.1.2.1).le_iff] + have hEL : E(L_P) ⊆ E(N.G) := fun e heL => by + have he_comp : e ∈ E(S_comp.G) := hLP_comp.edgeSet_mono heL + rw [← hcomp.1.1.2.2.2.1] at he_comp + exact he_comp.resolve_left (disjoint_left.mp hE_LP_disj heL) + refine ⟨fun v hvL => ?_, hEL⟩ + by_cases hsu : s = u + · subst hsu + rcases hp_L with ⟨_, W, hW, hVL, _⟩ + cases W with + | nil _ => + simp only [hVL, GraphWalk.support, List.mem_cons, List.not_mem_nil, or_false, + mem_ofPred_eq] at hvL + subst hvL + exact N.bar_subset (hcomp.2.1 ▸ hP.2.2.1) + | @cons _ w_c _ f_c _ W' => + exact ((List.nodup_cons.mp hW).1 W'.end_mem_support).elim + · obtain ⟨e, heL, w_e, hvw⟩ := hp_L.exists_inc_of_mem_of_ne hsu hvL + obtain ⟨a_e, b_e, habN⟩ := N.G.exists_isLink_of_mem_edgeSet (hEL heL) + rcases (hvw.mono hLP_comp).left_eq_or_eq (habN.mono hcomp.1.1.2.1) with rfl | rfl + · exact habN.left_mem + · exact habN.right_mem + have he_u_Q : e_u ∈ E(Q_ut) := by + have he_u_union : e_u ∈ E(L_P) ∪ E(Q_ut) := by + rw [← edgeSet_subgraphUnion hL_P hQ_ut, hunion₁]; exact he_uP + exact he_u_union.resolve_left fun h => disjoint_left.mp hE_LP_disj h he_uS + have hu_Q_Y : u ∈ V(Q_ut) ∩ Y := ⟨hp_Q.left_mem, huP, e_u, ⟨he_uP, he_uS⟩, z_u, hinc_u⟩ + obtain ⟨w, ⟨hwQ, hwP, e_w, ⟨he_wP, he_wS⟩, z_w, hinc_w⟩, R_P, M_P', + hR_Q, hM_Q, hp_R, hp_M', hunion₂, hinter₂, hdisjE₂, hdisjY₂⟩ := + hp_Q.symm.exists_first_split_at_mem ⟨u, hu_Q_Y⟩ + have hR_P : R_P ≤ P := hR_Q.trans hQ_ut + have hM_P : M_P' ≤ P := hM_Q.trans hQ_ut + have hE_RP_disj : Disjoint E(R_P) E(S.G) := by + rw [disjoint_left] + intro e heR heS + have heP : e ∈ E(P) := hR_P.edgeSet_mono heR + obtain ⟨x, y, hxyR⟩ := R_P.exists_isLink_of_mem_edgeSet heR + have hxyP : P.IsLink e x y := hxyR.mono hR_P + have hxY : x ∈ Y := ⟨hxyP.left_mem, e, ⟨heP, heS⟩, y, hxyP⟩ + have hyY : y ∈ Y := ⟨hxyP.right_mem, e, ⟨heP, heS⟩, x, hxyP.symm⟩ + have hxw : x = w := by + by_contra hne; exact disjoint_left.mp hdisjY₂ ⟨hxyR.left_mem, hne⟩ hxY + have hyw : y = w := by + by_contra hne; exact disjoint_left.mp hdisjY₂ ⟨hxyR.right_mem, hne⟩ hyY + rw [hxw, hyw] at hxyP + exact hP.1.not_isLoopAt heP w (hxyP.mono hP.1.le) + have hRP_N : R_P ≤ N.G := by + have hRP_comp : R_P ≤ S_comp.G := hR_P.trans hP.1.le + rw [(Compatible.of_le_le hRP_comp hcomp.1.1.2.1).le_iff] + have hER : E(R_P) ⊆ E(N.G) := fun e heR => by + have he_comp : e ∈ E(S_comp.G) := hRP_comp.edgeSet_mono heR + rw [← hcomp.1.1.2.2.2.1] at he_comp + exact he_comp.resolve_left (disjoint_left.mp hE_RP_disj heR) + refine ⟨fun v hvR => ?_, hER⟩ + by_cases htw : t = w + · subst htw + rcases hp_R with ⟨_, W, hW, hVR, _⟩ + cases W with + | nil _ => + simp only [hVR, GraphWalk.support, List.mem_cons, List.not_mem_nil, or_false, + mem_ofPred_eq] at hvR + subst hvR + exact N.bar_subset (hcomp.2.1 ▸ hP.2.2.2) + | @cons _ w_c _ f_c _ W' => + exact ((List.nodup_cons.mp hW).1 W'.end_mem_support).elim + · obtain ⟨e, heR, w_e, hvw⟩ := hp_R.exists_inc_of_mem_of_ne htw hvR + obtain ⟨a_e, b_e, habN⟩ := N.G.exists_isLink_of_mem_edgeSet (hER heR) + rcases (hvw.mono hRP_comp).left_eq_or_eq (habN.mono hcomp.1.1.2.1) with rfl | rfl + · exact habN.left_mem + · exact habN.right_mem + have he_u_M : e_u ∈ E(M_P') := by + have he_u_union : e_u ∈ E(R_P) ∪ E(M_P') := by + rw [← edgeSet_subgraphUnion hR_Q hM_Q, hunion₂]; exact he_u_Q + exact he_u_union.resolve_left fun h => disjoint_left.mp hE_RP_disj h he_uS + have he_w_Q : e_w ∈ E(Q_ut) := by + have he_w_union : e_w ∈ E(L_P) ∪ E(Q_ut) := by + rw [← edgeSet_subgraphUnion hL_P hQ_ut, hunion₁]; exact he_wP + exact he_w_union.resolve_left fun h => disjoint_left.mp hE_LP_disj h he_wS + have he_w_M : e_w ∈ E(M_P') := by + have he_w_union : e_w ∈ E(R_P) ∪ E(M_P') := by + rw [← edgeSet_subgraphUnion hR_Q hM_Q, hunion₂]; exact he_w_Q + exact he_w_union.resolve_left fun h => disjoint_left.mp hE_RP_disj h he_wS + have hp_M : IsGraphPathWithEnds P M_P' u w := (hp_M'.mono hQ_ut).symm + have huw : u ≠ w := by + rintro rfl + rcases hp_M with ⟨_, W, hW, _, hEM⟩ + cases W with + | nil _ => + simp only [hEM, GraphWalk.edges, List.not_mem_nil, mem_ofPred_eq] at he_u_M + | @cons _ w_c _ f_c _ W' => + exact (List.nodup_cons.mp hW).1 W'.end_mem_support + have hu_VS : u ∈ V(S.G) := by + obtain ⟨a_e, b_e, habS⟩ := S.G.exists_isLink_of_mem_edgeSet he_uS + rcases (hinc_u.mono hP.1.le).left_eq_or_eq (habS.mono hcomp.1.1.1) with rfl | rfl + · exact habS.left_mem + · exact habS.right_mem + have hw_VS : w ∈ V(S.G) := by + obtain ⟨a_e, b_e, habS⟩ := S.G.exists_isLink_of_mem_edgeSet he_wS + rcases (hinc_w.mono hP.1.le).left_eq_or_eq (habS.mono hcomp.1.1.1) with rfl | rfl + · exact habS.left_mem + · exact habS.right_mem + have hu_bar : u ∈ S.Ω.bar := by + rw [hcomp.2.2.2]; exact ⟨hu_VS, hLP_N.vertexSet_mono hp_L.right_mem⟩ + have hw_bar : w ∈ S.Ω.bar := by + rw [hcomp.2.2.2]; exact ⟨hw_VS, hRP_N.vertexSet_mono hp_R.right_mem⟩ + have hinter_LM : V(L_P) ∩ V(M_P') = {u} := by + refine Subset.antisymm ?_ (singleton_subset_iff.mpr ⟨hp_L.right_mem, hp_M.left_mem⟩) + rw [← hinter₁] + exact inter_subset_inter_right _ hM_Q.vertexSet_mono + have hdisj_LR : Disjoint V(L_P) V(R_P) := by + rw [disjoint_left] + intro z hzL hzR + have hzu : z = u := by + have hz_in : z ∈ V(L_P) ∩ V(Q_ut) := ⟨hzL, hR_Q.vertexSet_mono hzR⟩ + rwa [hinter₁, mem_singleton_iff] at hz_in + subst hzu + have hu_in : z ∈ V(R_P) ∩ V(M_P') := ⟨hzR, hp_M.left_mem⟩ + rw [hinter₂, mem_singleton_iff] at hu_in + exact huw hu_in + refine ⟨u, hu_bar, w, hw_bar, huw, L_P, M_P', R_P, hL_P, hM_P, hR_P, + (hp_L.mono hP.1.le).of_le hLP_N, hp_M.mono hP.1.le, (hp_R.mono (hQ_ut.trans hP.1.le)).of_le + hRP_N, + hinter_LM, hinter₂, hdisj_LR, ?_, ?_⟩ + · intro c e hlink_M + have hinc_u_M : M_P'.Inc e_u u := ⟨z_u, (hM_P.isLink_iff he_u_M).mpr hinc_u⟩ + have he_eq : e = e_u := + hp_M.inc_left_unique hlink_M.edge_mem he_u_M ⟨c, hlink_M⟩ hinc_u_M + exact he_eq ▸ he_uS + · intro c e hlink_M + have hinc_w_M : M_P'.Inc e_w w := ⟨z_w, (hM_P.isLink_iff he_w_M).mpr hinc_w⟩ + have he_eq : e = e_w := + hp_M.symm.inc_left_unique hlink_M.edge_mem he_w_M ⟨c, hlink_M⟩ hinc_w_M + exact he_eq ▸ he_wS + +/-- If `x, y ∈ Ω.bar \ W` (`x ≠ y`) have `Disjoint (Ω.interval x y) W ∨ Disjoint (Ω.interval y x) +W`, +then `x` and `y` belong to the exact same open intervals between vertices of `W`. -/ +theorem mem_interval_iff_of_disjoint_interval {Ω : CyclicPerm α} {W : Set α} {x y : α} + (hx_bar : x ∈ Ω.bar) (hy_bar : y ∈ Ω.bar) (hxy : x ≠ y) + (hxW : x ∉ W) (hyW : y ∉ W) + (hdisj : Disjoint (Ω.interval x y) W ∨ Disjoint (Ω.interval y x) W) + {u v : α} (huW : u ∈ W) (hvW : v ∈ W) : + x ∈ Ω.interval u v ↔ y ∈ Ω.interval u v := by + have haux : ∀ {x₁ y₁ : α}, x₁ ∈ Ω.bar → y₁ ∈ Ω.bar → x₁ ≠ y₁ → x₁ ∉ W → y₁ ∉ W → + (Disjoint (Ω.interval x₁ y₁) W ∨ Disjoint (Ω.interval y₁ x₁) W) → + x₁ ∈ Ω.interval u v → y₁ ∈ Ω.interval u v := by + intro x₁ y₁ hx₁_bar hy₁_bar hx₁y₁ hx₁W hy₁W hdisj₁ hx₁_uv + by_contra hy₁_not_uv + obtain ⟨_, h13, _, hu_bar, _, hv_bar, _⟩ := Ω.isClockwise3_iff.mp hx₁_uv.2 + have huv : u ≠ v := h13 + have hy₁u : y₁ ≠ u := fun h => hy₁W (h ▸ huW) + have hy₁v : y₁ ≠ v := fun h => hy₁W (h ▸ hvW) + have hy₁_vu : y₁ ∈ Ω.interval v u := + (Ω.mem_interval_or_interval_swap hu_bar hv_bar hy₁_bar huv hy₁u hy₁v).resolve_left hy₁_not_uv + have hcr : Ω.Crosses x₁ y₁ u v := + (Ω.crosses_iff_interval.mpr (Or.inl ⟨hx₁_uv, hy₁_vu⟩)).symm + rcases Ω.crosses_iff_interval.mp hcr with ⟨hu_xy, hv_yx⟩ | ⟨hv_xy, hu_yx⟩ + · rcases hdisj₁ with hd | hd + · exact disjoint_left.mp hd hu_xy huW + · exact disjoint_left.mp hd hv_yx hvW + · rcases hdisj₁ with hd | hd + · exact disjoint_left.mp hd hv_xy hvW + · exact disjoint_left.mp hd hu_yx huW + exact ⟨haux hx_bar hy_bar hxy hxW hyW hdisj, + haux hy_bar hx_bar hxy.symm hyW hxW hdisj.symm⟩ + +/-- Under the hypotheses of `mem_interval_iff_of_disjoint_interval`, replacing `x` by `y` on +`W ∪ {x}` preserves and reflects `Ω.Crosses`. -/ +theorem crosses_iff_of_disjoint_interval {Ω : CyclicPerm α} {W : Set α} {x y : α} + (hx_bar : x ∈ Ω.bar) (hy_bar : y ∈ Ω.bar) (hxy : x ≠ y) + (hxW : x ∉ W) (hyW : y ∉ W) + (hdisj : Disjoint (Ω.interval x y) W ∨ Disjoint (Ω.interval y x) W) + {v₁ v₃ v₂ v₄ : α} + (hv₁ : v₁ ∈ W ∪ {x}) (hv₃ : v₃ ∈ W ∪ {x}) (hv₂ : v₂ ∈ W ∪ {x}) (hv₄ : v₄ ∈ W ∪ {x}) : + letI := Classical.decEq α + Ω.Crosses v₁ v₃ v₂ v₄ ↔ + Ω.Crosses (if v₁ = x then y else v₁) (if v₃ = x then y else v₃) + (if v₂ = x then y else v₂) (if v₄ = x then y else v₄) := by + classical + have hsingle : ∀ {a b c : α}, a ∈ W → b ∈ W → c ∈ W → + (Ω.Crosses a b c x ↔ Ω.Crosses a b c y) := by + intro a b c ha hb hc + rw [Ω.crosses_iff_interval, Ω.crosses_iff_interval, + mem_interval_iff_of_disjoint_interval hx_bar hy_bar hxy hxW hyW hdisj ha hb, + mem_interval_iff_of_disjoint_interval hx_bar hy_bar hxy hxW hyW hdisj hb ha] + have hnot_eq : ∀ {a b c d : α}, Ω.Crosses a b c d → + a ≠ b ∧ a ≠ c ∧ a ≠ d ∧ b ≠ c ∧ b ≠ d ∧ c ≠ d := by + intro a b c d h + rcases h with h | h + · obtain ⟨h12, h13, h14, h23, h24, h34, _⟩ := Ω.isClockwise4_iff.mp h + exact ⟨h13, h12, h14, h23.symm, h34, h24⟩ + · obtain ⟨h12, h13, h14, h23, h24, h34, _⟩ := Ω.isClockwise4_iff.mp h + exact ⟨h24.symm, h34.symm, h14.symm, h23, h12.symm, h13.symm⟩ + by_cases h1 : v₁ = x <;> by_cases h3 : v₃ = x <;> by_cases h2 : v₂ = x <;> by_cases h4 : v₄ = x + · subst h1 h3; exact ⟨fun h => ((hnot_eq h).1 rfl).elim, fun h => ((hnot_eq h).1 rfl).elim⟩ + · subst h1 h3; exact ⟨fun h => ((hnot_eq h).1 rfl).elim, fun h => ((hnot_eq h).1 rfl).elim⟩ + · subst h1 h3; exact ⟨fun h => ((hnot_eq h).1 rfl).elim, fun h => ((hnot_eq h).1 rfl).elim⟩ + · subst h1 h3; exact ⟨fun h => ((hnot_eq h).1 rfl).elim, fun h => ((hnot_eq h).1 rfl).elim⟩ + · subst h1 h2; exact ⟨fun h => ((hnot_eq h).2.1 rfl).elim, fun h => ((hnot_eq h).2.1 rfl).elim⟩ + · subst h1 h2; exact ⟨fun h => ((hnot_eq h).2.1 rfl).elim, fun h => ((hnot_eq h).2.1 rfl).elim⟩ + · subst h1 h4; exact ⟨fun h => ((hnot_eq h).2.2.1 rfl).elim, fun h => + ((hnot_eq h).2.2.1 rfl).elim⟩ + · subst h1 + have hv₃W : v₃ ∈ W := hv₃.resolve_right h3 + have hv₂W : v₂ ∈ W := hv₂.resolve_right h2 + have hv₄W : v₄ ∈ W := hv₄.resolve_right h4 + rw [ite_eq_left rfl, ite_eq_right h3, ite_eq_right h2, ite_eq_right h4] + exact ⟨fun h => ((hsingle hv₂W hv₄W hv₃W).mp h.symm.swap_right).swap_right.symm, + fun h => ((hsingle hv₂W hv₄W hv₃W).mpr h.symm.swap_right).swap_right.symm⟩ + · subst h3 h2; exact ⟨fun h => ((hnot_eq h).2.2.2.1 rfl).elim, fun h => + ((hnot_eq h).2.2.2.1 rfl).elim⟩ + · subst h3 h2; exact ⟨fun h => ((hnot_eq h).2.2.2.1 rfl).elim, fun h => + ((hnot_eq h).2.2.2.1 rfl).elim⟩ + · subst h3 h4; exact ⟨fun h => ((hnot_eq h).2.2.2.2.1 rfl).elim, fun h => + ((hnot_eq h).2.2.2.2.1 rfl).elim⟩ + · subst h3 + have hv₁W : v₁ ∈ W := hv₁.resolve_right h1 + have hv₂W : v₂ ∈ W := hv₂.resolve_right h2 + have hv₄W : v₄ ∈ W := hv₄.resolve_right h4 + rw [ite_eq_right h1, ite_eq_left rfl, ite_eq_right h2, ite_eq_right h4] + exact ⟨fun h => ((hsingle hv₂W hv₄W hv₁W).mp h.symm).symm, + fun h => ((hsingle hv₂W hv₄W hv₁W).mpr h.symm).symm⟩ + · subst h2 h4; exact ⟨fun h => ((hnot_eq h).2.2.2.2.2 rfl).elim, fun h => + ((hnot_eq h).2.2.2.2.2 rfl).elim⟩ + · subst h2 + have hv₁W : v₁ ∈ W := hv₁.resolve_right h1 + have hv₃W : v₃ ∈ W := hv₃.resolve_right h3 + have hv₄W : v₄ ∈ W := hv₄.resolve_right h4 + rw [ite_eq_right h1, ite_eq_right h3, ite_eq_left rfl, ite_eq_right h4] + exact ⟨fun h => ((hsingle hv₁W hv₃W hv₄W).mp h.swap_right).swap_right, + fun h => ((hsingle hv₁W hv₃W hv₄W).mpr h.swap_right).swap_right⟩ + · subst h4 + have hv₁W : v₁ ∈ W := hv₁.resolve_right h1 + have hv₃W : v₃ ∈ W := hv₃.resolve_right h3 + have hv₂W : v₂ ∈ W := hv₂.resolve_right h2 + rw [ite_eq_right h1, ite_eq_right h3, ite_eq_right h2, ite_eq_left rfl] + exact hsingle hv₁W hv₃W hv₂W + · rw [ite_eq_right h1, ite_eq_right h3, ite_eq_right h2, ite_eq_right h4] + +private theorem cardinalityAfterReplacingPath + {S : Society α β} {P_set : Set (Graph α β)} {P P_left Q P_right : Graph α β} + (hP_in : P ∈ P_set) (hP_left : P_left ≤ P) (hQ : Q ≤ P) (hP_right : P_right ≤ P) {A B : Set α} + (hfence : S.IsFenceFor P_set A B) (hR_le : ∀ R ∈ P_set, R ≤ S.G) (hP_le : P ≤ S.G) + (hPL_le : P_left ≤ S.G) (hPR_le : P_right ≤ S.G) (hPL_not_diff : P_left ∉ P_set \ {P}) + (hPR_not_diff : P_right ∉ P_set \ {P}) (hPL_ne_PR : P_left ≠ P_right) (hfin_P : P_set.Finite) + (hfin_diff : (P_set \ {P}).Finite) {e_Q : β} (he_Q : e_Q ∈ E(Q)) + (hdisj_EQ_L : Disjoint E(Q) E(P_left)) (hdisj_EQ_R : Disjoint E(Q) E(P_right)) + {P_set' : Set (Graph α β)} + (hor : P_set' = P_set \ {P} ∪ {P_left} ∨ P_set' = P_set \ {P} ∪ {P_right} ∨ P_set' = P_set \ + {P} ∪ {P_left, P_right}) : + P_set.ncard ≤ P_set'.ncard ∧ E(S.transactionUnion P_set').ncard < E(S.transactionUnion + P_set).ncard := by + classical + have hcard_le : P_set.ncard ≤ P_set'.ncard := by + rcases hor with rfl | rfl | rfl + · rw [union_comm, ← insert_eq, ncard_insert_of_notMem hPL_not_diff hfin_diff, + ncard_sdiff_singleton_add_one hP_in hfin_P] + · rw [union_comm, ← insert_eq, ncard_insert_of_notMem hPR_not_diff hfin_diff, + ncard_sdiff_singleton_add_one hP_in hfin_P] + · have hset_eq : (P_set \ {P}) ∪ {P_left, P_right} = + insert P_left (insert P_right (P_set \ {P})) := by + ext R; aesop + rw [hset_eq, + ncard_insert_of_notMem (by simp [hPL_ne_PR, hPL_not_diff]) (hfin_diff.insert P_right), + ncard_insert_of_notMem hPR_not_diff hfin_diff, + ncard_sdiff_singleton_add_one hP_in hfin_P] + omega + have hR'_le : ∀ R ∈ P_set', R ≤ S.G := by + intro R hR + rcases hor with rfl | rfl | rfl + · rcases hR with hR | rfl; exacts [hR_le R hR.1, hPL_le] + · rcases hR with hR | rfl; exacts [hR_le R hR.1, hPR_le] + · rcases hR with hR | rfl | rfl; exacts [hR_le R hR.1, hPL_le, hPR_le] + have hsub_each : ∀ R ∈ P_set', E(R) ⊆ E(S.transactionUnion P_set) ∧ e_Q ∉ E(R) := by + intro R hR + have hcases : R ∈ P_set \ {P} ∨ R = P_left ∨ R = P_right := by + rcases hor with rfl | rfl | rfl + · rcases hR with h | rfl; exacts [Or.inl h, Or.inr (Or.inl rfl)] + · rcases hR with h | rfl; exacts [Or.inl h, Or.inr (Or.inr rfl)] + · exact hR + rcases hcases with hR_diff | rfl | rfl + · refine ⟨fun e he => ?_, fun he_QR => ?_⟩ + · rw [Society.transactionUnion, edgeSet_subgraphSUnion hR_le, mem_iUnion₂] + exact ⟨R, hR_diff.1, he⟩ + · obtain ⟨u₁, v₁, huvQ⟩ := Q.exists_isLink_of_mem_edgeSet he_Q + obtain ⟨u₂, v₂, huvR⟩ := R.exists_isLink_of_mem_edgeSet he_QR + have hne_PR : P ≠ R := fun h => hR_diff.2 h.symm + rcases (huvQ.mono (hQ.trans hP_le)).left_eq_or_eq (huvR.mono (hR_le R hR_diff.1)) + with rfl | rfl + · exact disjoint_left.mp (hfence.1.2 hP_in hR_diff.1 hne_PR) + (hQ.vertexSet_mono huvQ.left_mem) huvR.left_mem + · exact disjoint_left.mp (hfence.1.2 hP_in hR_diff.1 hne_PR) + (hQ.vertexSet_mono huvQ.left_mem) huvR.right_mem + · refine ⟨fun e he => ?_, disjoint_left.mp hdisj_EQ_L he_Q⟩ + rw [Society.transactionUnion, edgeSet_subgraphSUnion hR_le, mem_iUnion₂] + exact ⟨P, hP_in, hP_left.edgeSet_mono he⟩ + · refine ⟨fun e he => ?_, disjoint_left.mp hdisj_EQ_R he_Q⟩ + rw [Society.transactionUnion, edgeSet_subgraphSUnion hR_le, mem_iUnion₂] + exact ⟨P, hP_in, hP_right.edgeSet_mono he⟩ + have hE_sub : E(S.transactionUnion P_set') ⊆ E(S.transactionUnion P_set) := by + rw [Society.transactionUnion, edgeSet_subgraphSUnion hR'_le] + intro e he; rw [mem_iUnion₂] at he + rcases he with ⟨R, hR, heR⟩ + exact (hsub_each R hR).1 heR + have heQ_in_U : e_Q ∈ E(S.transactionUnion P_set) := by + rw [Society.transactionUnion, edgeSet_subgraphSUnion hR_le, mem_iUnion₂] + exact ⟨P, hP_in, hQ.edgeSet_mono he_Q⟩ + have heQ_not_U' : e_Q ∉ E(S.transactionUnion P_set') := by + rw [Society.transactionUnion, edgeSet_subgraphSUnion hR'_le, mem_iUnion₂] + rintro ⟨R, hR, heR⟩ + exact (hsub_each R hR).2 heR + have hEU_fin : E(S.transactionUnion P_set).Finite := + S.finite_E.subset (subgraphSUnion_le hR_le).edgeSet_mono + exact ⟨hcard_le, + ncard_lt_ncard ⟨hE_sub, fun hall => heQ_not_U' (hall heQ_in_U)⟩ hEU_fin⟩ + +private theorem replaceByOneEndPath + {S : Society α β} {P_set : Set (Graph α β)} {P P_left P_right : Graph α β} {s t x y : α} + (hP_in : P ∈ P_set) (hP_ends : S.IsOmegaPathWithEnds P s t) + (hx : x ∈ pathInternalVerts S.G P ∩ S.Ω.bar) (hy : y ∈ pathInternalVerts S.G P ∩ S.Ω.bar) + (hxy : x ≠ y) (hP_left : P_left ≤ P) (hP_right : P_right ≤ P) + (hdisj_int : Disjoint (S.Ω.interval x y) (S.transactionEnds P_set) ∨ Disjoint (S.Ω.interval y + x) (S.transactionEnds P_set)) + {A B : Set α} (hfence : S.IsFenceFor P_set A B) (hx_ne_t : x ≠ t) + (hP_left_ends : S.IsOmegaPathWithEnds P_left s x) + (hP_right_ends : S.IsOmegaPathWithEnds P_right y t) (hx_not_W : x ∉ (S.transactionEnds P_set)) + (hy_not_W : y ∉ (S.transactionEnds P_set)) + (hcard_and_lt : ∀ {P_set' : Set (Graph α β)}, P_set' = P_set \ {P} ∪ {P_left} ∨ P_set' = P_set + \ {P} ∪ {P_right} ∨ P_set' = P_set \ {P} ∪ {P_left, P_right} → P_set.ncard ≤ + P_set'.ncard ∧ E(S.transactionUnion P_set').ncard < E(S.transactionUnion P_set).ncard) + (hexch : S.IsExchangeableAttachment P_set (singleVertexSubgraph S.G x)) : + ∃ P_set', (P_set' = P_set \ {P} ∪ {P_left} ∨ P_set' = P_set \ {P} ∪ {P_right} ∨ P_set' = P_set + \ {P} ∪ {P_left, P_right}) ∧ S.IsCrookedTransaction P_set' ∧ P_set.ncard ≤ P_set'.ncard ∧ + E(S.transactionUnion P_set').ncard < E(S.transactionUnion P_set).ncard := by + classical + let W := S.transactionEnds P_set + let Q_x := singleVertexSubgraph S.G x + rcases hexch with ⟨_, L, L', ⟨hL_in, b, u, a₁, b₁, hatt_bu, hbL, hL_ends, Q_sub, hQ_or, rfl⟩, + hcr'⟩ + have hbx : b = x := by + have hbQ : b ∈ V(Q_x) := hatt_bu.1.left_mem + rwa [vertexSet_singleVertexSubgraph, mem_singleton_iff] at hbQ + have hux : u = x := by + have huQ : u ∈ V(Q_x) := hatt_bu.1.right_mem + rwa [vertexSet_singleVertexSubgraph, mem_singleton_iff] at huQ + rcases hbx.symm with rfl; rcases hux.symm with rfl + have hLP : L = P := by + by_contra hne; exact disjoint_left.mp (hfence.1.2 hL_in hP_in hne) hbL hx.1.1 + subst hLP + let L' := subgraphUnion S.G Q_x Q_sub + let P_set_L := (P_set \ {L}) ∪ {L'} + have hL'_not_diff : L' ∉ P_set \ {L} := + Society.IsAttachmentWithEnds.subgraphUnion_not_mem_sdiff S hfence.1 hatt_bu hL_in hbL + have hne_L' : ∀ {R : Graph α β}, R ∈ P_set \ {L} → R ≠ L' := + fun hR h => hL'_not_diff (h ▸ hR) + have hex_end : ∃ e_end : α, (e_end = s ∨ e_end = t) ∧ S.IsOmegaPathWithEnds L' x e_end := by + have hpair := hL_ends.1.pair_ends_eq hP_ends.1 + rcases hQ_or with hQ_xa₁ | hQ_xb₁ + · have ha₁_in : a₁ ∈ ({s, t} : Set α) := by rw [← hpair]; simp + exact ⟨a₁, by simpa using ha₁_in, + hatt_bu.isOmegaPathWithEnds_subgraphUnion S hL_in hbL hL_ends hQ_xa₁ (Or.inl rfl)⟩ + · have hb₁_in : b₁ ∈ ({s, t} : Set α) := by rw [← hpair]; simp + exact ⟨b₁, by simpa using hb₁_in, + hatt_bu.isOmegaPathWithEnds_subgraphUnion S hL_in hbL hL_ends hQ_xb₁ (Or.inr rfl)⟩ + obtain ⟨e_end, he_end_or, hL'_ends⟩ := hex_end + rcases he_end_or with rfl | rfl + · -- Replace `L'` (ends `x, s`) with `P_left` (ends `s, x`) via `f_v = id`. + let f_P : Graph α β → Graph α β := fun R => if R = L' then P_left else R + have hfP_diff : ∀ {R : Graph α β}, R ∈ P_set \ {L} → f_P R = R := + fun hR => ite_eq_right (hne_L' hR) + have hfP_L' : f_P L' = P_left := ite_eq_left rfl + have hcr_PL : S.IsCrookedTransaction (f_P '' P_set_L) := by + refine (isCrookedTransaction_of_end_map hcr' (f_P := f_P) (f_v := id) ?_ ?_ + (injOn_id _) (fun _ _ _ _ _ _ _ _ => Iff.rfl)).1 + · rintro R (hR | rfl) a b hR_ab + · rw [hfP_diff hR]; exact hR_ab + · rw [hfP_L'] + rcases hL'_ends.ends_eq S hR_ab with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hP_left_ends.symm S + · exact hP_left_ends + · rintro R₁ (hR₁ | rfl) R₂ (hR₂ | rfl) hne + · rw [hfP_diff hR₁, hfP_diff hR₂] + exact hfence.1.2 hR₁.1 hR₂.1 hne + · rw [hfP_diff hR₁, hfP_L'] + exact (hfence.1.2 hR₁.1 hL_in hR₁.2).mono_right hP_left.vertexSet_mono + · rw [hfP_L', hfP_diff hR₂] + exact (hfence.1.2 hL_in hR₂.1 (Ne.symm hR₂.2)).mono_left hP_left.vertexSet_mono + · exact (hne rfl).elim + have himg_eq : f_P '' P_set_L = (P_set \ {L}) ∪ {P_left} := by + ext R; simp only [P_set_L, image_union, image_singleton, hfP_L', mem_union, + mem_image, mem_singleton_iff] + refine ⟨?_, ?_⟩ + · rintro (⟨R₀, hR₀, rfl⟩ | rfl) + · rw [hfP_diff hR₀]; exact Or.inl hR₀ + · exact Or.inr rfl + · rintro (hR | rfl) + · exact Or.inl ⟨R, hR, hfP_diff hR⟩ + · exact Or.inr rfl + rw [himg_eq] at hcr_PL + obtain ⟨hcard, hlt⟩ := hcard_and_lt (Or.inl rfl) + exact ⟨(P_set \ {L}) ∪ {P_left}, Or.inl rfl, hcr_PL, hcard, hlt⟩ + · -- Replace `L'` (ends `x, t`) with `P_right` (ends `y, t`) via `f_v z := if z = x then y else + -- z`. + let f_P : Graph α β → Graph α β := fun R => if R = L' then P_right else R + let f_v : α → α := fun z => if z = x then y else z + have hfP_diff : ∀ {R : Graph α β}, R ∈ P_set \ {L} → f_P R = R := + fun hR => ite_eq_right (hne_L' hR) + have hfP_L' : f_P L' = P_right := ite_eq_left rfl + have hWL_sub : S.transactionEnds P_set_L ⊆ W ∪ {x} := by + rintro z ⟨R, hR | rfl, d, hR_zd⟩ + · exact Or.inl ⟨R, hR.1, d, hR_zd⟩ + · rcases hL'_ends.ends_eq S hR_zd with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inr rfl + · exact Or.inl ⟨L, hL_in, s, hP_ends.symm S⟩ + have hcr_PR : S.IsCrookedTransaction (f_P '' P_set_L) := by + refine (isCrookedTransaction_of_end_map hcr' (f_P := f_P) (f_v := f_v) ?_ ?_ ?_ ?_).1 + · rintro R (hR | rfl) a b hR_ab + · have haW : a ∈ W := ⟨R, hR.1, b, hR_ab⟩ + have hbW : b ∈ W := ⟨R, hR.1, a, hR_ab.symm S⟩ + have hax : a ≠ x := fun h => hx_not_W (h ▸ haW) + have hbx : b ≠ x := fun h => hx_not_W (h ▸ hbW) + rw [hfP_diff hR] + change S.IsOmegaPathWithEnds R (if a = x then y else a) (if b = x then y else b) + rw [ite_eq_right hax, ite_eq_right hbx] + exact hR_ab + · rw [hfP_L'] + change S.IsOmegaPathWithEnds P_right (if a = x then y else a) (if b = x then y else b) + rcases hL'_ends.ends_eq S hR_ab with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rw [ite_eq_left rfl, ite_eq_right hx_ne_t.symm] + exact hP_right_ends + · rw [ite_eq_right hx_ne_t.symm, ite_eq_left rfl] + exact hP_right_ends.symm S + · rintro R₁ (hR₁ | rfl) R₂ (hR₂ | rfl) hne + · rw [hfP_diff hR₁, hfP_diff hR₂] + exact hfence.1.2 hR₁.1 hR₂.1 hne + · rw [hfP_diff hR₁, hfP_L'] + exact (hfence.1.2 hR₁.1 hL_in hR₁.2).mono_right hP_right.vertexSet_mono + · rw [hfP_L', hfP_diff hR₂] + exact (hfence.1.2 hL_in hR₂.1 (Ne.symm hR₂.2)).mono_left hP_right.vertexSet_mono + · exact (hne rfl).elim + · intro z₁ hz₁ z₂ hz₂ heq + rcases hWL_sub hz₁ with hz₁W | hz₁_eq <;> rcases hWL_sub hz₂ with hz₂W | hz₂_eq + · have h1 : z₁ ≠ x := fun h => hx_not_W (h ▸ hz₁W) + have h2 : z₂ ≠ x := fun h => hx_not_W (h ▸ hz₂W) + change (if z₁ = x then y else z₁) = (if z₂ = x then y else z₂) at heq + rw [ite_eq_right h1, ite_eq_right h2] at heq + exact heq + · rw [mem_singleton_iff] at hz₂_eq + have h1 : z₁ ≠ x := fun h => hx_not_W (h ▸ hz₁W) + change (if z₁ = x then y else z₁) = (if z₂ = x then y else z₂) at heq + rw [ite_eq_right h1, ite_eq_left hz₂_eq] at heq + exact (hy_not_W (heq ▸ hz₁W)).elim + · rw [mem_singleton_iff] at hz₁_eq + have h2 : z₂ ≠ x := fun h => hx_not_W (h ▸ hz₂W) + change (if z₁ = x then y else z₁) = (if z₂ = x then y else z₂) at heq + rw [ite_eq_left hz₁_eq, ite_eq_right h2] at heq + exact (hy_not_W (heq.symm ▸ hz₂W)).elim + · rw [mem_singleton_iff] at hz₁_eq hz₂_eq + exact hz₁_eq.trans hz₂_eq.symm + · intro v₁ hv₁ v₃ hv₃ v₂ hv₂ v₄ hv₄ + exact crosses_iff_of_disjoint_interval hx.2 hy.2 hxy hx_not_W hy_not_W hdisj_int + (hWL_sub hv₁) (hWL_sub hv₃) (hWL_sub hv₂) (hWL_sub hv₄) + have himg_eq : f_P '' P_set_L = (P_set \ {L}) ∪ {P_right} := by + ext R; simp only [P_set_L, image_union, image_singleton, hfP_L', mem_union, + mem_image, mem_singleton_iff] + refine ⟨?_, ?_⟩ + · rintro (⟨R₀, hR₀, rfl⟩ | rfl) + · rw [hfP_diff hR₀]; exact Or.inl hR₀ + · exact Or.inr rfl + · rintro (hR | rfl) + · exact Or.inl ⟨R, hR, hfP_diff hR⟩ + · exact Or.inr rfl + rw [himg_eq] at hcr_PR + obtain ⟨hcard, hlt⟩ := hcard_and_lt (Or.inr (Or.inl rfl)) + exact ⟨(P_set \ {L}) ∪ {P_right}, Or.inr (Or.inl rfl), hcr_PR, hcard, hlt⟩ + +private theorem replaceByBothEndPaths + {S : Society α β} {P_set : Set (Graph α β)} {P P_left P_right : Graph α β} {s t x y : α} + (hcrooked : S.IsCrookedTransaction P_set) (hP_in : P ∈ P_set) + (hP_ends : S.IsOmegaPathWithEnds P s t) (hx : x ∈ pathInternalVerts S.G P ∩ S.Ω.bar) + (hy : y ∈ pathInternalVerts S.G P ∩ S.Ω.bar) (hxy : x ≠ y) (hP_left : P_left ≤ P) + (hP_right : P_right ≤ P) (hdisj_LR : Disjoint V(P_left) V(P_right)) + (hdisj_int : Disjoint (S.Ω.interval x y) (S.transactionEnds P_set) ∨ Disjoint (S.Ω.interval y + x) (S.transactionEnds P_set)) + {A B : Set α} (hfence : S.IsFenceFor P_set A B) + (hP_left_ends : S.IsOmegaPathWithEnds P_left s x) + (hP_right_ends : S.IsOmegaPathWithEnds P_right y t) (hx_not_W : x ∉ (S.transactionEnds P_set)) + (hy_not_W : y ∉ (S.transactionEnds P_set)) + (hcard_and_lt : ∀ {P_set' : Set (Graph α β)}, P_set' = P_set \ {P} ∪ {P_left} ∨ P_set' = P_set + \ {P} ∪ {P_right} ∨ P_set' = P_set \ {P} ∪ {P_left, P_right} → P_set.ncard ≤ + P_set'.ncard ∧ E(S.transactionUnion P_set').ncard < E(S.transactionUnion P_set).ncard) + (hatt_x : S.IsAttachmentWithEnds P_set (singleVertexSubgraph S.G x) x x) + (hexch : ¬S.IsExchangeableAttachment P_set (singleVertexSubgraph S.G x)) : + ∃ P_set', (P_set' = P_set \ {P} ∪ {P_left} ∨ P_set' = P_set \ {P} ∪ {P_right} ∨ P_set' = P_set + \ {P} ∪ {P_left, P_right}) ∧ S.IsCrookedTransaction P_set' ∧ P_set.ncard ≤ P_set'.ncard ∧ + E(S.transactionUnion P_set').ncard < E(S.transactionUnion P_set).ncard := by + classical + let W := S.transactionEnds P_set + let Q_x := singleVertexSubgraph S.G x + obtain ⟨_, P₁, hleg, hover⟩ := S.theorem_3_2_proof hcrooked ⟨x, x, hatt_x⟩ hexch + have hP₁_eq : P₁ = P := by + rcases hleg with ⟨hP₁_in, b, ⟨u, hatt_bu⟩, hbP₁⟩ + have hbx : b = x := by + have hbQ : b ∈ V(Q_x) := hatt_bu.1.left_mem + rwa [vertexSet_singleVertexSubgraph, mem_singleton_iff] at hbQ + subst hbx; by_contra hne; exact disjoint_left.mp (hfence.1.2 hP₁_in hP_in hne) hbP₁ hx.1.1 + subst hP₁_eq + obtain ⟨a₁_raw, ha₁_raw, b₁_raw, hb₁_raw, hP_ends_raw⟩ := hfence.2.2 P₁ hP_in + rcases hover with ⟨_, _, R₁, hR₁_in, R₂, hR₂_in, hR12, hper₁, hper₂⟩ + obtain ⟨x₁, hx₁, y₁, hy₁, hR₁_ends⟩ := hfence.2.2 R₁ hR₁_in.1 + obtain ⟨x₂, hx₂, y₂, hy₂, hR₂_ends⟩ := hfence.2.2 R₂ hR₂_in.1 + let W' := S.transactionEnds (P_set \ {P₁}) + have hW'_sub_W : W' ⊆ W := fun z ⟨R, hR, d, hR_zd⟩ => ⟨R, hR.1, d, hR_zd⟩ + have hW'_bar : W' ⊆ S.Ω.bar := S.transactionEnds_subset_bar (P_set \ {P₁}) + have hx₁W' : x₁ ∈ A ∩ W' := ⟨hx₁, hR₁_ends.mem_transactionEnds_left S hR₁_in⟩ + have hy₁W' : y₁ ∈ B ∩ W' := ⟨hy₁, hR₁_ends.mem_transactionEnds_right S hR₁_in⟩ + have hx₂W' : x₂ ∈ A ∩ W' := ⟨hx₂, hR₂_ends.mem_transactionEnds_left S hR₂_in⟩ + have hy₂W' : y₂ ∈ B ∩ W' := ⟨hy₂, hR₂_ends.mem_transactionEnds_right S hR₂_in⟩ + have hper₁' := (hR₁_ends.isPeripheralIn_iff S hR₁_in).mp hper₁ + have hper₂' := (hR₂_ends.isPeripheralIn_iff S hR₂_in).mp hper₂ + have hdisj_R12 : Disjoint V(R₁) V(R₂) := hfence.1.2 hR₁_in.1 hR₂_in.1 hR12 + have hx12 : x₁ ≠ x₂ := + fun h => disjoint_left.mp hdisj_R12 hR₁_ends.1.left_mem (h ▸ hR₂_ends.1.left_mem) + have hy12 : y₁ ≠ y₂ := + fun h => disjoint_left.mp hdisj_R12 hR₁_ends.1.right_mem (h ▸ hR₂_ends.1.right_mem) + have hex_boundary : + ∃ a_0 ∈ A ∩ W', ∃ a'_0 ∈ A ∩ W', ∃ b_0 ∈ B ∩ W', ∃ b'_0 ∈ B ∩ W', + Disjoint (S.Ω.interval a'_0 b_0) W' ∧ + Disjoint (S.Ω.interval b'_0 a_0) W' ∧ + (∃ R_ab ∈ P_set \ {P₁}, S.IsOmegaPathWithEnds R_ab a'_0 b_0) ∧ + (∃ R_ba ∈ P_set \ {P₁}, S.IsOmegaPathWithEnds R_ba a_0 b'_0) := by + rcases hper₁' with hd₁ | hd₁ <;> rcases hper₂' with hd₂ | hd₂ + · exact (hx12 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1 hW'_bar + hx₁W' hy₁W' hx₂W' hy₂W' hd₁ hd₂).1).elim + · exact ⟨x₂, hx₂W', x₁, hx₁W', y₁, hy₁W', y₂, hy₂W', hd₁, hd₂, + ⟨R₁, hR₁_in, hR₁_ends⟩, ⟨R₂, hR₂_in, hR₂_ends⟩⟩ + · exact ⟨x₁, hx₁W', x₂, hx₂W', y₂, hy₂W', y₁, hy₁W', hd₂, hd₁, + ⟨R₂, hR₂_in, hR₂_ends⟩, ⟨R₁, hR₁_in, hR₁_ends⟩⟩ + · exact (hy12 (S.Ω.unique_empty_interval_AB_of_isFence hfence.2.1.symm hW'_bar + hy₁W' hx₁W' hy₂W' hx₂W' hd₁ hd₂).1).elim + obtain ⟨a_0, ha_0, a'_0, ha'_0, b_0, hb_0, b'_0, hb'_0, hd_ab, hd_ba, + ⟨R_ab, hR_ab_in, hR_ab_ends⟩, ⟨R_ba, hR_ba_in, hR_ba_ends⟩⟩ := hex_boundary + have h_e_G₁ := S.mem_interval_of_peripheral_diff_singleton hfence hcrooked hP_in hR_ab_in + ha₁_raw hb₁_raw hP_ends_raw ha'_0.1 hb_0.1 hR_ab_ends hd_ab + have hfence_BA : S.IsFenceFor P_set B A := + ⟨hfence.1, hfence.2.1.symm, fun R hR => by + obtain ⟨a_e, ha_e, b_e, hb_e, hR_e⟩ := hfence.2.2 R hR + exact ⟨b_e, hb_e, a_e, ha_e, hR_e.symm S⟩⟩ + have h_e_G₂ := S.mem_interval_of_peripheral_diff_singleton hfence_BA hcrooked hP_in hR_ba_in + hb₁_raw ha₁_raw (hP_ends_raw.symm S) hb'_0.1 ha_0.1 (hR_ba_ends.symm S) hd_ba + obtain ⟨_, _, hG₂_sub, hG₁_sub, hdisj_P, _⟩ := + Society.four_arc_partition hfence.2.1 hW'_bar ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + have hdisj_G₁G₂ : Disjoint (S.Ω.interval a'_0 b_0) (S.Ω.interval b'_0 a_0) := + hdisj_P.symm.mono (hG₁_sub.trans subset_union_right) (hG₂_sub.trans subset_union_right) + have hex_ends : ∃ e₁ e₂ : α, S.IsOmegaPathWithEnds P₁ e₁ e₂ ∧ + e₁ ∈ S.Ω.interval a'_0 b_0 ∧ e₂ ∈ S.Ω.interval b'_0 a_0 := by + rcases h_e_G₁ with ⟨ha₁_G₁, _⟩ | ⟨hb₁_G₁, _⟩ <;> + rcases h_e_G₂ with ⟨hb₁_G₂, _⟩ | ⟨ha₁_G₂, _⟩ + · exact ⟨a₁_raw, b₁_raw, hP_ends_raw, ha₁_G₁, hb₁_G₂⟩ + · exact (disjoint_left.mp hdisj_G₁G₂ ha₁_G₁ ha₁_G₂).elim + · exact (disjoint_left.mp hdisj_G₁G₂ hb₁_G₁ hb₁_G₂).elim + · exact ⟨b₁_raw, a₁_raw, hP_ends_raw.symm S, hb₁_G₁, ha₁_G₂⟩ + obtain ⟨e₁, e₂, hP_e12, he₁_G₁, he₂_G₂⟩ := hex_ends + have hx_gaps := S.end_not_mem_gaps_of_not_exchangeable hcrooked hfence hatt_x + hexch hP_in hx.1.1 hP_e12 W' rfl ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba he₁_G₁ he₂_G₂ + have hy_gaps : y ∉ S.Ω.interval a'_0 b_0 ∧ y ∉ S.Ω.interval b'_0 a_0 := by + rw [← mem_interval_iff_of_disjoint_interval hx.2 hy.2 hxy hx_not_W hy_not_W hdisj_int + (hW'_sub_W ha'_0.2) (hW'_sub_W hb_0.2), + ← mem_interval_iff_of_disjoint_interval hx.2 hy.2 hxy hx_not_W hy_not_W hdisj_int + (hW'_sub_W hb'_0.2) (hW'_sub_W ha_0.2)] + exact hx_gaps + have hx_not_W' : x ∉ W' := fun h => hx_not_W (hW'_sub_W h) + have hy_not_W' : y ∉ W' := fun h => hy_not_W (hW'_sub_W h) + have hcr_symm : ∀ {L₁ L₂ : Graph α β} {u₁ u₂ : α}, + Disjoint V(L₁) V(L₂) → + (∀ R ∈ P_set \ {P₁}, Disjoint V(L₁) V(R) ∧ Disjoint V(L₂) V(R)) → + S.IsOmegaPathWithEnds L₁ u₁ e₁ → + S.IsOmegaPathWithEnds L₂ u₂ e₂ → + u₁ ∈ S.Ω.bar → u₁ ∉ W' → u₁ ∉ S.Ω.interval a'_0 b_0 → u₁ ∉ S.Ω.interval b'_0 a_0 → + u₂ ∈ S.Ω.bar → u₂ ∉ W' → u₂ ∉ S.Ω.interval a'_0 b_0 → u₂ ∉ S.Ω.interval b'_0 a_0 → + S.IsCrookedTransaction ((P_set \ {P₁}) ∪ {L₁, L₂}) := by + intro L₁ L₂ u₁ u₂ hdisj_L12 hdisj_LR hL₁_ends hL₂_ends + hu₁_bar hu₁_not_W' hu₁_G₁ hu₁_G₂ hu₂_bar hu₂_not_W' hu₂_G₁ hu₂_G₂ + exact S.crookedTransaction_of_two_switches hfence ha_0 ha'_0 hb_0 hb'_0 hd_ab hd_ba + he₁_G₁ he₂_G₂ hdisj_L12 hdisj_LR hL₁_ends hL₂_ends hu₁_bar hu₁_not_W' hu₁_G₁ hu₁_G₂ hu₂_bar + hu₂_not_W' hu₂_G₁ hu₂_G₂ + have hdisj_LR_R : ∀ R ∈ P_set \ {P₁}, Disjoint V(P_left) V(R) ∧ Disjoint V(P_right) V(R) := + fun R hR => + ⟨(hfence.1.2 hP_in hR.1 (Ne.symm hR.2)).mono_left hP_left.vertexSet_mono, + (hfence.1.2 hP_in hR.1 (Ne.symm hR.2)).mono_left hP_right.vertexSet_mono⟩ + have hcr_both : S.IsCrookedTransaction ((P_set \ {P₁}) ∪ {P_left, P_right}) := by + rcases hP_ends.ends_eq S hP_e12 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hcr_symm hdisj_LR hdisj_LR_R (hP_left_ends.symm S) hP_right_ends + hx.2 hx_not_W' hx_gaps.1 hx_gaps.2 hy.2 hy_not_W' hy_gaps.1 hy_gaps.2 + · have hpair : ({P_left, P_right} : Set (Graph α β)) = {P_right, P_left} := + pair_comm P_left P_right + rw [hpair] + exact hcr_symm hdisj_LR.symm (fun R hR => ⟨(hdisj_LR_R R hR).2, (hdisj_LR_R R hR).1⟩) + hP_right_ends (hP_left_ends.symm S) + hy.2 hy_not_W' hy_gaps.1 hy_gaps.2 hx.2 hx_not_W' hx_gaps.1 hx_gaps.2 + obtain ⟨hcard, hlt⟩ := hcard_and_lt (Or.inr (Or.inr rfl)) + exact ⟨(P_set \ {P₁}) ∪ {P_left, P_right}, Or.inr (Or.inr rfl), hcr_both, hcard, hlt⟩ + +/-- **Step B reduction step**: If `P ∈ P_set` (with ends `s, t`) in a crooked transaction `P_set` of +`S` splits at two distinct internal boundary vertices `x, y ∈ pathInternalVerts S.G P ∩ S.Ω.bar` +into `P_left` (`s` to `x`), `Q` (`x` to `y`), and `P_right` (`y` to `t`), and one of the open +intervals `S.Ω.interval x y` or `S.Ω.interval y x` is disjoint from `S.transactionEnds P_set`, then +at least one of `(P_set \ {P}) ∪ {P_left}`, `(P_set \ {P}) ∪ {P_right}`, or +`(P_set \ {P}) ∪ {P_left, P_right}` is a crooked transaction of `S` (with cardinality +`≥ P_set.ncard` and strictly fewer edges in `transactionUnion`). -/ +theorem exists_crooked_drop_middle_of_empty_interval {S : Society α β} + {P_set : Set (Graph α β)} {P P_left Q P_right : Graph α β} {s t x y : α} + (hcrooked : S.IsCrookedTransaction P_set) (hP_in : P ∈ P_set) + (hP_ends : S.IsOmegaPathWithEnds P s t) + (hx : x ∈ pathInternalVerts S.G P ∩ S.Ω.bar) + (hy : y ∈ pathInternalVerts S.G P ∩ S.Ω.bar) (hxy : x ≠ y) + (hP_left : P_left ≤ P) (hQ : Q ≤ P) (hP_right : P_right ≤ P) + (hp_left : IsGraphPathWithEnds P P_left s x) + (hp_Q : IsGraphPathWithEnds P Q x y) + (hp_right : IsGraphPathWithEnds P P_right y t) + (hinter_LQ : V(P_left) ∩ V(Q) = {x}) + (hinter_QR : V(Q) ∩ V(P_right) = {y}) + (hdisj_LR : Disjoint V(P_left) V(P_right)) + (hdisj_int : Disjoint (S.Ω.interval x y) (S.transactionEnds P_set) ∨ + Disjoint (S.Ω.interval y x) (S.transactionEnds P_set)) : + ∃ P_set' : Set (Graph α β), + (P_set' = (P_set \ {P}) ∪ {P_left} ∨ + P_set' = (P_set \ {P}) ∪ {P_right} ∨ + P_set' = (P_set \ {P}) ∪ {P_left, P_right}) ∧ + S.IsCrookedTransaction P_set' ∧ + P_set.ncard ≤ P_set'.ncard ∧ + E(S.transactionUnion P_set').ncard < E(S.transactionUnion P_set).ncard := by + classical + obtain ⟨A, B, hfence⟩ := hcrooked.1 + let W := S.transactionEnds P_set + have hx_ne_s : x ≠ s := fun h => hx.1.2 (h ▸ ⟨t, hP_ends.1⟩) + have hx_ne_t : x ≠ t := fun h => hx.1.2 (h ▸ ⟨s, hP_ends.1.symm⟩) + have hy_ne_s : y ≠ s := fun h => hy.1.2 (h ▸ ⟨t, hP_ends.1⟩) + have hy_ne_t : y ≠ t := fun h => hy.1.2 (h ▸ ⟨s, hP_ends.1.symm⟩) + have hP_left_ends : S.IsOmegaPathWithEnds P_left s x := + ⟨hp_left.mono hP_ends.1.le, hx_ne_s.symm, hP_ends.2.2.1, hx.2⟩ + have hP_right_ends : S.IsOmegaPathWithEnds P_right y t := + ⟨hp_right.mono hP_ends.1.le, hy_ne_t, hy.2, hP_ends.2.2.2⟩ + have hx_not_W : x ∉ W := by + rintro ⟨R, hR, d, hR_xd⟩ + by_cases hRP : R = P + · exact hx.1.2 (hRP ▸ ⟨d, hR_xd.1⟩) + · exact disjoint_left.mp (hfence.1.2 hR hP_in hRP) hR_xd.1.left_mem hx.1.1 + have hy_not_W : y ∉ W := by + rintro ⟨R, hR, d, hR_yd⟩ + by_cases hRP : R = P + · exact hy.1.2 (hRP ▸ ⟨d, hR_yd.1⟩) + · exact disjoint_left.mp (hfence.1.2 hR hP_in hRP) hR_yd.1.left_mem hy.1.1 + have hR_le : ∀ R ∈ P_set, R ≤ S.G := fun R hR => by + obtain ⟨_, _, h⟩ := hfence.1.1 R hR; exact h.1.le + have hP_le : P ≤ S.G := hP_ends.1.le + have hPL_le : P_left ≤ S.G := hP_left.trans hP_le + have hPR_le : P_right ≤ S.G := hP_right.trans hP_le + have hPL_not_diff : P_left ∉ P_set \ {P} := fun h => + disjoint_left.mp (hfence.1.2 h.1 hP_in h.2) hp_left.left_mem hP_ends.1.left_mem + have hPR_not_diff : P_right ∉ P_set \ {P} := fun h => + disjoint_left.mp (hfence.1.2 h.1 hP_in h.2) hp_right.right_mem hP_ends.1.right_mem + have hPL_ne_PR : P_left ≠ P_right := fun h => + disjoint_left.mp hdisj_LR hp_left.left_mem (h ▸ hp_left.left_mem) + have hfin_P : P_set.Finite := hfence.1.finite S + have hfin_diff : (P_set \ {P}).Finite := hfin_P.sdiff + obtain ⟨e_Q, he_Q, _⟩ := hp_Q.exists_inc_left_of_ne hxy + have hdisj_EQ_L : Disjoint E(Q) E(P_left) := + disjoint_edgeSet_of_inter_singleton hp_Q hP_left (by rw [inter_comm, hinter_LQ]) + have hdisj_EQ_R : Disjoint E(Q) E(P_right) := + disjoint_edgeSet_of_inter_singleton hp_Q hP_right hinter_QR.subset + have hcard_and_lt : ∀ {P_set' : Set (Graph α β)}, + (P_set' = (P_set \ {P}) ∪ {P_left} ∨ + P_set' = (P_set \ {P}) ∪ {P_right} ∨ + P_set' = (P_set \ {P}) ∪ {P_left, P_right}) → + P_set.ncard ≤ P_set'.ncard ∧ + E(S.transactionUnion P_set').ncard < E(S.transactionUnion P_set).ncard := by + intro P_set' hor + exact cardinalityAfterReplacingPath hP_in hP_left hQ hP_right hfence hR_le hP_le hPL_le hPR_le + hPL_not_diff hPR_not_diff hPL_ne_PR hfin_P hfin_diff he_Q hdisj_EQ_L hdisj_EQ_R hor + let Q_x := singleVertexSubgraph S.G x + have hatt_x : S.IsAttachmentWithEnds P_set Q_x x x := + isAttachmentWithEnds_singleVertexSubgraph S hfence.1 hP_in hx.1 hx.2 + by_cases hexch : S.IsExchangeableAttachment P_set Q_x + · exact replaceByOneEndPath hP_in hP_ends hx hy hxy hP_left hP_right hdisj_int hfence hx_ne_t + hP_left_ends hP_right_ends hx_not_W hy_not_W hcard_and_lt hexch + · exact replaceByBothEndPaths hcrooked hP_in hP_ends hx hy hxy hP_left hP_right hdisj_LR + hdisj_int hfence hP_left_ends hP_right_ends hx_not_W hy_not_W hcard_and_lt hatt_x hexch + +/-- A three-way split of `P` into `P_left` (`s` to `x`), `Q ≤ N_keep` (`x` to `y`), and `P_right` +(`y` to `t`), where `x ≠ y ∈ S.Ω.bar` and the edges of `P_left` at `x` and `P_right` at `y` lie in +`E(S.G)`. -/ +def IsSplitExcursion (S S_mid : Society α β) (N_keep : Graph α β) + (P P_left Q P_right : Graph α β) (s t x y : α) : Prop := + S_mid.IsOmegaPathWithEnds P s t ∧ + P_left ≤ P ∧ Q ≤ P ∧ P_right ≤ P ∧ Q ≤ N_keep ∧ + IsGraphPathWithEnds P P_left s x ∧ + IsGraphPathWithEnds P Q x y ∧ + IsGraphPathWithEnds P P_right y t ∧ + x ≠ y ∧ x ∈ S.Ω.bar ∧ y ∈ S.Ω.bar ∧ + V(P_left) ∩ V(Q) = {x} ∧ + V(Q) ∩ V(P_right) = {y} ∧ + Disjoint V(P_left) V(P_right) ∧ + (∃ e_x ∈ E(P_left) ∩ E(S.G), P_left.Inc e_x x) ∧ + (∃ e_y ∈ E(P_right) ∩ E(S.G), P_right.Inc e_y y) + +theorem IsSplitExcursion.symm {S S_mid : Society α β} {N_keep P P_left Q P_right : Graph α β} + {s t x y : α} (h : IsSplitExcursion S S_mid N_keep P P_left Q P_right s t x y) : + IsSplitExcursion S S_mid N_keep P P_right Q P_left t s y x := by + rcases h with ⟨hP, hPL, hQ, hPR, hQN, hpL, hpQ, hpR, hxy, hx, hy, hiLQ, hiQR, hdLR, hex, hey⟩ + exact ⟨hP.symm S_mid, hPR, hQ, hPL, hQN, hpR.symm, hpQ.symm, hpL.symm, hxy.symm, hy, hx, + inter_comm V(P_right) V(Q) ▸ hiQR, inter_comm V(Q) V(P_left) ▸ hiLQ, hdLR.symm, hey, hex⟩ + +theorem IsSplitExcursion.internal_and_links {S S_mid : Society α β} + {N_keep P P_left Q P_right : Graph α β} {s t x y : α} + (h : IsSplitExcursion S S_mid N_keep P P_left Q P_right s t x y) + (hdisj_SN : Disjoint E(S.G) E(N_keep)) : + x ∈ pathInternalVerts S_mid.G P ∩ S.Ω.bar ∧ + y ∈ pathInternalVerts S_mid.G P ∩ S.Ω.bar ∧ + (∀ c e, P_left.IsLink e x c → e ∈ E(S.G)) ∧ + (∀ c e, P_right.IsLink e y c → e ∈ E(S.G)) := by + have haux : ∀ {P_l Q_m P_r : Graph α β} {s₀ t₀ x₀ y₀ : α}, + IsSplitExcursion S S_mid N_keep P P_l Q_m P_r s₀ t₀ x₀ y₀ → + x₀ ∈ pathInternalVerts S_mid.G P ∩ S.Ω.bar ∧ + (∀ c e, P_l.IsLink e x₀ c → e ∈ E(S.G)) := by + rintro P_l Q_m P_r s₀ t₀ x₀ y₀ + ⟨hP, hPL, hQ, _, hQN, hpL, hpQ, hpR, hxy, hx, _, _, _, hdLR, ⟨e_x, ⟨hex_L, hex_S⟩, hinc_x⟩, _⟩ + have hlink_S : ∀ c e, P_l.IsLink e x₀ c → e ∈ E(S.G) := fun c e hlink => by + have heq : e = e_x := hpL.symm.inc_left_unique hlink.edge_mem hex_L ⟨c, hlink⟩ hinc_x + exact heq ▸ hex_S + obtain ⟨f_x, hfx_Q, hinc_fx⟩ := hpQ.exists_inc_left_of_ne hxy + have hfx_not_S : f_x ∉ E(S.G) := + fun hS => disjoint_left.mp hdisj_SN hS (hQN.edgeSet_mono hfx_Q) + have hx_ne_s : x₀ ≠ s₀ := by + rintro rfl + have heq : f_x = e_x := hP.1.inc_left_unique + (hQ.edgeSet_mono hfx_Q) (hPL.edgeSet_mono hex_L) + (hinc_fx.mono hQ) (hinc_x.mono hPL) + exact hfx_not_S (heq ▸ hex_S) + have hx_ne_t : x₀ ≠ t₀ := fun h => + disjoint_left.mp hdLR hpL.right_mem (h ▸ hpR.right_mem) + have hx_int : x₀ ∈ pathInternalVerts S_mid.G P := by + rw [hP.1.pathInternalVerts_eq] + exact ⟨hPL.vertexSet_mono hpL.right_mem, fun h_or => h_or.elim hx_ne_s hx_ne_t⟩ + exact ⟨⟨hx_int, hx⟩, hlink_S⟩ + obtain ⟨hx_int, hlink_x⟩ := haux h + obtain ⟨hy_int, hlink_y⟩ := haux h.symm + exact ⟨hx_int, hy_int, hlink_x, hlink_y⟩ + +theorem IsSplitExcursion.extend_right {S S_mid : Society α β} + {N_keep P P_left Q P_right P'_left Q' P'_right : Graph α β} {s t x y x' y' : α} + (h : IsSplitExcursion S S_mid N_keep P P_left Q P_right s t x y) + (hdisj_SN : Disjoint E(S.G) E(N_keep)) + (h' : IsSplitExcursion S S_mid N_keep P_left P'_left Q' P'_right s x x' y') : + IsSplitExcursion S S_mid N_keep P P'_left Q' + (subgraphUnion P P'_right (subgraphUnion P Q P_right)) s t x' y' ∧ + Disjoint V(Q') V(Q) := by + obtain ⟨_, hy'_int, _, _⟩ := h'.internal_and_links hdisj_SN + obtain ⟨_, _, hlink_x, _⟩ := h.internal_and_links hdisj_SN + rcases h with ⟨hP, hPL, hQ, hPR, _, hpL, hpQ, hpR, _, _, _, hiLQ, hiQR, hdLR, _, hey⟩ + rcases h' with ⟨hPL_ends, hP'L, hQ', hP'R, hQ'N, hp'L, hp'Q, hp'R, hx'y', hx', hy', + hi'LQ, hi'QR, hd'LR, hex', hey'⟩ + have hy'_ne_x : y' ≠ x := fun h_eq => + hy'_int.1.2 (by rw [hPL_ends.1.pathEnds_eq, h_eq]; exact Or.inr rfl) + have hx_not_Q' : x ∉ V(Q') := fun hxQ' => by + have hx_in : x ∈ V(Q') ∩ V(P'_right) := ⟨hxQ', hp'R.right_mem⟩ + rw [hi'QR, mem_singleton_iff] at hx_in + exact hy'_ne_x hx_in.symm + have hx_not_P'L : x ∉ V(P'_left) := fun hxP'L => + disjoint_left.mp hd'LR hxP'L hp'R.right_mem + have hdisj_Q'Q : Disjoint V(Q') V(Q) := by + rw [disjoint_left] + intro z hzQ' hzQ + have hzx : z = x := by + have hz_in : z ∈ V(P_left) ∩ V(Q) := ⟨hQ'.vertexSet_mono hzQ', hzQ⟩ + rwa [hiLQ, mem_singleton_iff] at hz_in + exact hx_not_Q' (hzx ▸ hzQ') + let QR := subgraphUnion P Q P_right + have hQR_P : QR ≤ P := subgraphUnion_le hQ hPR + have hp_QR : IsGraphPathWithEnds P QR x t := hpQ.subgraphUnion hpR hiQR + have hP'R_P : P'_right ≤ P := hP'R.trans hPL + have hi_P'R_QR : V(P'_right) ∩ V(QR) = {x} := by + refine Subset.antisymm ?_ (singleton_subset_iff.mpr ⟨hp'R.right_mem, Or.inl hpQ.left_mem⟩) + rintro z ⟨hzP'R, hzQ | hzPR⟩ + · have hz_in : z ∈ V(P_left) ∩ V(Q) := ⟨hP'R.vertexSet_mono hzP'R, hzQ⟩ + rwa [hiLQ] at hz_in + · exact (disjoint_left.mp hdLR (hP'R.vertexSet_mono hzP'R) hzPR).elim + let P₀_right := subgraphUnion P P'_right QR + have hP₀R_P : P₀_right ≤ P := subgraphUnion_le hP'R_P hQR_P + have hp₀_R : IsGraphPathWithEnds P P₀_right y' t := + (hp'R.mono hPL).subgraphUnion hp_QR hi_P'R_QR + have hi_Q'_P₀R : V(Q') ∩ V(P₀_right) = {y'} := by + refine Subset.antisymm ?_ (singleton_subset_iff.mpr ⟨hp'Q.right_mem, Or.inl hp'R.left_mem⟩) + rintro z ⟨hzQ', hzP'R | hzQ | hzPR⟩ + · have hz_in : z ∈ V(Q') ∩ V(P'_right) := ⟨hzQ', hzP'R⟩ + rwa [hi'QR] at hz_in + · exact (disjoint_left.mp hdisj_Q'Q hzQ' hzQ).elim + · exact (disjoint_left.mp hdLR (hQ'.vertexSet_mono hzQ') hzPR).elim + have hd_P'L_P₀R : Disjoint V(P'_left) V(P₀_right) := by + rw [disjoint_left] + rintro z hzP'L (hzP'R | hzQ | hzPR) + · exact disjoint_left.mp hd'LR hzP'L hzP'R + · have hzx : z = x := by + have hz_in : z ∈ V(P_left) ∩ V(Q) := ⟨hP'L.vertexSet_mono hzP'L, hzQ⟩ + rwa [hiLQ, mem_singleton_iff] at hz_in + exact hx_not_P'L (hzx ▸ hzP'L) + · exact disjoint_left.mp hdLR (hP'L.vertexSet_mono hzP'L) hzPR + have hey'₀ : ∃ e_y ∈ E(P₀_right) ∩ E(S.G), P₀_right.Inc e_y y' := by + rcases hey' with ⟨e_y, ⟨hey_R, hey_S⟩, hinc_y⟩ + have hle : P'_right ≤ P₀_right := le_subgraphUnion_left hP'R_P hQR_P + exact ⟨e_y, ⟨hle.edgeSet_mono hey_R, hey_S⟩, hinc_y.mono hle⟩ + exact ⟨⟨hP, hP'L.trans hPL, hQ'.trans hPL, hP₀R_P, hQ'N, + hp'L.mono hPL, hp'Q.mono hPL, hp₀_R, hx'y', hx', hy', + hi'LQ, hi_Q'_P₀R, hd_P'L_P₀R, hex', hey'₀⟩, hdisj_Q'Q⟩ + +theorem IsSplitExcursion.lift_of_subpath {S S_mid : Society α β} + {N_keep P P_left Q P_right P' P'_left Q' P'_right : Graph α β} + {s t x y s' t' x' y' : α} + (h : IsSplitExcursion S S_mid N_keep P P_left Q P_right s t x y) + (hdisj_SN : Disjoint E(S.G) E(N_keep)) + (hP'_or : P' = P_left ∨ P' = P_right) + (h' : IsSplitExcursion S S_mid N_keep P' P'_left Q' P'_right s' t' x' y') : + ∃ s₀ t₀ x₀ y₀ : α, ∃ P₀_left P₀_right : Graph α β, + ({x₀, y₀} : Set α) = {x', y'} ∧ + IsSplitExcursion S S_mid N_keep P P₀_left Q' P₀_right s₀ t₀ x₀ y₀ ∧ + Disjoint V(Q') V(Q) := by + have hleft_case : ∀ {P_l Q_m P_r : Graph α β} {s₁ t₁ x₁ y₁ : α}, + IsSplitExcursion S S_mid N_keep P P_l Q_m P_r s₁ t₁ x₁ y₁ → + IsSplitExcursion S S_mid N_keep P_l P'_left Q' P'_right s' t' x' y' → + ∃ s₀ t₀ x₀ y₀ : α, ∃ P₀_left P₀_right : Graph α β, + ({x₀, y₀} : Set α) = {x', y'} ∧ + IsSplitExcursion S S_mid N_keep P P₀_left Q' P₀_right s₀ t₀ x₀ y₀ ∧ + Disjoint V(Q') V(Q_m) := by + intro P_l Q_m P_r s₁ t₁ x₁ y₁ h₁ h₂ + rcases (h₁.2.2.2.2.2.1.mono h₁.1.1.le).ends_eq h₂.1.1 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · obtain ⟨h_ext, hdisj⟩ := h₁.extend_right hdisj_SN h₂ + exact ⟨s', t₁, x', y', P'_left, _, rfl, h_ext, hdisj⟩ + · obtain ⟨h_ext, hdisj⟩ := h₁.extend_right hdisj_SN h₂.symm + exact ⟨t', t₁, y', x', P'_right, _, pair_comm y' x', h_ext, hdisj⟩ + rcases hP'_or with rfl | rfl + · exact hleft_case h h' + · exact hleft_case h.symm h' + +theorem exists_isSplitExcursion_of_not_le {S S_mid : Society α β} {N_keep P : Graph α β} {s t : α} + (hE_mid : E(S_mid.G) ⊆ E(S.G) ∪ E(N_keep)) + (hSG_le : S.G ≤ S_mid.G) (hN_le : N_keep ≤ S_mid.G) + (hV_inter : V(S.G) ∩ V(N_keep) ⊆ S.Ω.bar) + (hP_ends : S_mid.IsOmegaPathWithEnds P s t) + (hfirst : ∀ c e, P.IsLink e s c → e ∈ E(S.G)) + (hlast : ∀ c e, P.IsLink e t c → e ∈ E(S.G)) + (hnot_le : ¬ P ≤ S.G) : + ∃ P_left Q P_right : Graph α β, ∃ x y : α, + IsSplitExcursion S S_mid N_keep P P_left Q P_right s t x y := by + have hex_edge : ∃ e₀ ∈ E(P), e₀ ∉ E(S.G) := by + by_contra! hall + apply hnot_le + rw [(Compatible.of_le_le hP_ends.1.le hSG_le).le_iff] + refine ⟨fun v hvP => ?_, hall⟩ + obtain ⟨e, heP, z, hvz⟩ := hP_ends.1.exists_inc_of_mem_of_ne hP_ends.2.1 hvP + obtain ⟨a_e, b_e, habS⟩ := S.G.exists_isLink_of_mem_edgeSet (hall e heP) + rcases (hvz.mono hP_ends.1.le).left_eq_or_eq (habS.mono hSG_le) with rfl | rfl + · exact habS.left_mem + · exact habS.right_mem + obtain ⟨e₀, he₀P, he₀_not_S⟩ := hex_edge + obtain ⟨u₀, v₀, hu₀v₀⟩ := P.exists_isLink_of_mem_edgeSet he₀P + let Y_N : Set α := {v ∈ V(P) | ∃ e ∈ E(P) \ E(S.G), P.Inc e v} + have hu₀_YN : u₀ ∈ V(P) ∩ Y_N := + ⟨hu₀v₀.left_mem, hu₀v₀.left_mem, e₀, ⟨he₀P, he₀_not_S⟩, v₀, hu₀v₀⟩ + obtain ⟨x, ⟨hxP, _, f_x, ⟨hfx_P, hfx_not_S⟩, z_x, hfx_inc⟩, P_left, P_xt, + hP_left, hP_xt, hp_left, hp_xt, hunion₁, hinter₁, hdisjE₁, hdisjY₁⟩ := + hP_ends.1.exists_first_split_at_mem ⟨u₀, hu₀_YN⟩ + have hEL_sub_S : E(P_left) ⊆ E(S.G) := by + intro e heL + by_contra he_not_S + have heP : e ∈ E(P) := hP_left.edgeSet_mono heL + obtain ⟨a, b, habL⟩ := P_left.exists_isLink_of_mem_edgeSet heL + have habP : P.IsLink e a b := habL.mono hP_left + have haY : a ∈ Y_N := ⟨habP.left_mem, e, ⟨heP, he_not_S⟩, b, habP⟩ + have hbY : b ∈ Y_N := ⟨habP.right_mem, e, ⟨heP, he_not_S⟩, a, habP.symm⟩ + have hax : a = x := by + by_contra hne; exact disjoint_left.mp hdisjY₁ ⟨habL.left_mem, hne⟩ haY + have hbx : b = x := by + by_contra hne; exact disjoint_left.mp hdisjY₁ ⟨habL.right_mem, hne⟩ hbY + rw [hax, hbx] at habP + exact hP_ends.1.not_isLoopAt heP x (habP.mono hP_ends.1.le) + have hfx_xt : f_x ∈ E(P_xt) := by + have hfx_union : f_x ∈ E(P_left) ∪ E(P_xt) := by + rw [← edgeSet_subgraphUnion hP_left hP_xt, hunion₁]; exact hfx_P + exact hfx_union.resolve_left fun hL => hfx_not_S (hEL_sub_S hL) + have hfx_link_xt : P_xt.IsLink f_x x z_x := by + obtain ⟨a, b, hab⟩ := P_xt.exists_isLink_of_mem_edgeSet hfx_xt + rcases (hab.mono hP_xt).left_eq_or_eq hfx_inc with rfl | rfl + · rcases (hab.symm.mono hP_xt).left_eq_or_eq hfx_inc.symm with rfl | rfl + · exact hab + · exact (hP_ends.1.not_isLoopAt hfx_P b (hab.mono (hP_xt.trans hP_ends.1.le))).elim + · rcases (hab.symm.mono hP_xt).left_eq_or_eq hfx_inc with rfl | rfl + · exact hab.symm + · exact (hP_ends.1.not_isLoopAt hfx_P b (hab.mono (hP_xt.trans hP_ends.1.le))).elim + have hx_ne_s : x ≠ s := by + rintro rfl + exact hfx_not_S (hfirst z_x f_x hfx_inc) + have hx_ne_t : x ≠ t := by + rintro rfl + exact hfx_not_S (hlast z_x f_x hfx_inc) + obtain ⟨e_x, hex_L, c_x, hlink_ex⟩ := hp_left.symm.exists_inc_left_of_ne hx_ne_s + have hex_S : e_x ∈ E(S.G) := hEL_sub_S hex_L + obtain ⟨e_t, het_xt, c_t, hlink_et⟩ := hp_xt.symm.exists_inc_left_of_ne hx_ne_t.symm + have het_S : e_t ∈ E(S.G) := hlast c_t e_t (hlink_et.mono hP_xt) + let Y_S : Set α := {v ∈ V(P_xt) | ∃ e ∈ E(P_xt) ∩ E(S.G), P_xt.Inc e v} + have ht_YS : t ∈ V(P_xt) ∩ Y_S := + ⟨hp_xt.right_mem, hp_xt.right_mem, e_t, ⟨het_xt, het_S⟩, c_t, hlink_et⟩ + obtain ⟨y, ⟨hy_xt, _, e_y, ⟨hey_xt, hey_S⟩, z_y, hey_inc⟩, Q, P_right, + hQ_xt, hP_right_xt, hp_Q, hp_right, hunion₂, hinter₂, hdisjE₂, hdisjY₂⟩ := + hp_xt.exists_first_split_at_mem ⟨t, ht_YS⟩ + have hx_not_YS : x ∉ Y_S := by + rintro ⟨_, e, ⟨he_xt, he_S⟩, z, he_inc⟩ + have heq : e = f_x := hp_xt.inc_left_unique he_xt hfx_xt ⟨z, he_inc⟩ ⟨z_x, hfx_link_xt⟩ + exact hfx_not_S (heq ▸ he_S) + have hxy : x ≠ y := by + rintro rfl; exact hx_not_YS ⟨hy_xt, e_y, ⟨hey_xt, hey_S⟩, z_y, hey_inc⟩ + have hEQ_disj_S : Disjoint E(Q) E(S.G) := by + rw [disjoint_left] + intro e heQ heS + have he_xt : e ∈ E(P_xt) := hQ_xt.edgeSet_mono heQ + obtain ⟨a, b, habQ⟩ := Q.exists_isLink_of_mem_edgeSet heQ + have hab_xt : P_xt.IsLink e a b := habQ.mono hQ_xt + have haY : a ∈ Y_S := ⟨hab_xt.left_mem, e, ⟨he_xt, heS⟩, b, hab_xt⟩ + have hbY : b ∈ Y_S := ⟨hab_xt.right_mem, e, ⟨he_xt, heS⟩, a, hab_xt.symm⟩ + have hay : a = y := by + by_contra hne; exact disjoint_left.mp hdisjY₂ ⟨habQ.left_mem, hne⟩ haY + have hby : b = y := by + by_contra hne; exact disjoint_left.mp hdisjY₂ ⟨habQ.right_mem, hne⟩ hbY + rw [hay, hby] at hab_xt + exact hP_ends.1.not_isLoopAt (hP_xt.edgeSet_mono he_xt) y (hab_xt.mono + (hP_xt.trans hP_ends.1.le)) + have hQ_P : Q ≤ P := hQ_xt.trans hP_xt + have hP_right_P : P_right ≤ P := hP_right_xt.trans hP_xt + have hQ_N : Q ≤ N_keep := by + have hQ_mid : Q ≤ S_mid.G := hQ_P.trans hP_ends.1.le + rw [(Compatible.of_le_le hQ_mid hN_le).le_iff] + have hEQ_N : E(Q) ⊆ E(N_keep) := fun e heQ => + (hE_mid (hQ_mid.edgeSet_mono heQ)).resolve_left (disjoint_left.mp hEQ_disj_S heQ) + refine ⟨fun v hvQ => ?_, hEQ_N⟩ + obtain ⟨e, heQ, z, hvzQ⟩ := hp_Q.exists_inc_of_mem_of_ne hxy hvQ + obtain ⟨a_e, b_e, habN⟩ := N_keep.exists_isLink_of_mem_edgeSet (hEQ_N heQ) + rcases (hvzQ.mono hQ_mid).left_eq_or_eq (habN.mono hN_le) with rfl | rfl + · exact habN.left_mem + · exact habN.right_mem + have hey_right : e_y ∈ E(P_right) := by + have hey_union : e_y ∈ E(Q) ∪ E(P_right) := by + rw [← edgeSet_subgraphUnion hQ_xt hP_right_xt, hunion₂]; exact hey_xt + exact hey_union.resolve_left fun hQ => disjoint_left.mp hEQ_disj_S hQ hey_S + have hey_inc_right : P_right.Inc e_y y := by + obtain ⟨a, b, hab⟩ := P_right.exists_isLink_of_mem_edgeSet hey_right + rcases hey_inc.left_eq_or_eq (hab.mono hP_right_xt) with rfl | rfl + · exact ⟨b, hab⟩ + · exact ⟨a, hab.symm⟩ + have hx_VS : x ∈ V(S.G) := by + obtain ⟨a, b, habS⟩ := S.G.exists_isLink_of_mem_edgeSet hex_S + rcases (hlink_ex.mono (hP_left.trans hP_ends.1.le)).left_eq_or_eq + (habS.mono hSG_le) with rfl | rfl + · exact habS.left_mem + · exact habS.right_mem + have hy_VS : y ∈ V(S.G) := by + rcases hey_inc_right with ⟨w, hlink_ey⟩ + obtain ⟨a, b, habS⟩ := S.G.exists_isLink_of_mem_edgeSet hey_S + rcases (hlink_ey.mono (hP_right_P.trans hP_ends.1.le)).left_eq_or_eq + (habS.mono hSG_le) with rfl | rfl + · exact habS.left_mem + · exact habS.right_mem + have hx_bar : x ∈ S.Ω.bar := hV_inter ⟨hx_VS, hQ_N.vertexSet_mono hp_Q.left_mem⟩ + have hy_bar : y ∈ S.Ω.bar := hV_inter ⟨hy_VS, hQ_N.vertexSet_mono hp_Q.right_mem⟩ + have hi_LQ : V(P_left) ∩ V(Q) = {x} := by + refine Subset.antisymm ?_ (singleton_subset_iff.mpr ⟨hp_left.right_mem, hp_Q.left_mem⟩) + rw [← hinter₁] + exact inter_subset_inter_right _ hQ_xt.vertexSet_mono + have hd_LR : Disjoint V(P_left) V(P_right) := by + rw [disjoint_left] + intro z hzL hzR + have hzx : z = x := by + have hz_in : z ∈ V(P_left) ∩ V(P_xt) := ⟨hzL, hP_right_xt.vertexSet_mono hzR⟩ + rwa [hinter₁, mem_singleton_iff] at hz_in + have hzy : z = y := by + have hz_in : z ∈ V(Q) ∩ V(P_right) := ⟨hzx ▸ hp_Q.left_mem, hzR⟩ + rwa [hinter₂, mem_singleton_iff] at hz_in + exact hxy (hzx.symm.trans hzy) + exact ⟨P_left, Q, P_right, x, y, hP_ends, hP_left, hQ_P, hP_right_P, hQ_N, + hp_left, hp_Q.mono hP_xt, hp_right.mono hP_xt, hxy, hx_bar, hy_bar, + hi_LQ, hinter₂, hd_LR, ⟨e_x, ⟨hex_L, hex_S⟩, c_x, hlink_ex⟩, ⟨e_y, ⟨hey_right, hey_S⟩, + hey_inc_right⟩⟩ + +/-- Invariant maintained during Step B of `(9.1)` while eliminating excursions into `N_keep`. -/ +def IsValidStepBConfig (S S_mid : Society α β) (N_keep : Graph α β) (p : ℕ) + (P_set : Set (Graph α β)) : Prop := + S_mid.IsCrookedTransaction P_set ∧ + p ≤ P_set.ncard ∧ + (∀ P ∈ P_set, ∀ s t c e, S_mid.IsOmegaPathWithEnds P s t → P.IsLink e s c → e ∈ E(S.G)) ∧ + (∀ P ∈ P_set, ∀ P_left Q P_right s t x y, + IsSplitExcursion S S_mid N_keep P P_left Q P_right s t x y → + Disjoint (S.Ω.interval x y) (S_mid.transactionEnds P_set) ∨ + Disjoint (S.Ω.interval y x) (S_mid.transactionEnds P_set)) + +theorem stepB_of_theorem_9_1 {S S_mid : Society α β} {N : Neighborhood α β} + {N_keep : Graph α β} {p : ℕ} {P_set₁ : Set (Graph α β)} + (hrural : N.IsRural) + (hΩ_mid : S_mid.Ω = S.Ω) + (hΩ₀ : N.Ω₀ = S.Ω) + (hE_mid : E(S_mid.G) ⊆ E(S.G) ∪ E(N_keep)) + (hSG_le : S.G ≤ S_mid.G) (hN_le : N_keep ≤ S_mid.G) (hN_keep_le : N_keep ≤ N.G) + (hdisj_SN : Disjoint E(S.G) E(N_keep)) + (hV_inter : V(S.G) ∩ V(N_keep) ⊆ S.Ω.bar) + (hvalid₁ : IsValidStepBConfig S S_mid N_keep p P_set₁) : + ∃ P_set : Set (Graph α β), S.IsCrookedTransaction P_set ∧ p ≤ P_set.ncard := by + classical + have hex_B : ∃ m : ℕ, ∃ P_set : Set (Graph α β), + IsValidStepBConfig S S_mid N_keep p P_set ∧ + E(S_mid.transactionUnion P_set).ncard = m := + ⟨E(S_mid.transactionUnion P_set₁).ncard, P_set₁, hvalid₁, rfl⟩ + let m_min := Nat.find hex_B + obtain ⟨P_set, hvalid, hcard_m⟩ := Nat.find_spec hex_B + have hP_le_S : ∀ P ∈ P_set, P ≤ S.G := by + by_contra! hnot_all + rcases hnot_all with ⟨P₀, hP₀_in, hP₀_not_le⟩ + obtain ⟨A, B, hfence⟩ := hvalid.1.1 + let W := S_mid.transactionEnds P_set + have hex_exc : ∃ d : ℕ, ∃ P₁ ∈ P_set, ∃ P_left Q P_right : Graph α β, ∃ s t x y : α, + IsSplitExcursion S S_mid N_keep P₁ P_left Q P_right s t x y ∧ + Disjoint (S.Ω.interval x y) W ∧ + S.Ω.bar.ncard - (S.Ω.interval x y).ncard = d := by + obtain ⟨s₀, _, t₀, _, hP₀_ends⟩ := hfence.2.2 P₀ hP₀_in + obtain ⟨P₀_left, Q₀, P₀_right, x₀, y₀, hexc₀⟩ := + exists_isSplitExcursion_of_not_le hE_mid hSG_le hN_le hV_inter hP₀_ends + (fun c e hl => hvalid.2.2.1 P₀ hP₀_in s₀ t₀ c e hP₀_ends hl) + (fun c e hl => hvalid.2.2.1 P₀ hP₀_in t₀ s₀ c e (hP₀_ends.symm S_mid) hl) + hP₀_not_le + rcases hvalid.2.2.2 P₀ hP₀_in P₀_left Q₀ P₀_right s₀ t₀ x₀ y₀ hexc₀ with hdisj | hdisj + · exact ⟨_, P₀, hP₀_in, P₀_left, Q₀, P₀_right, s₀, t₀, x₀, y₀, hexc₀, hdisj, rfl⟩ + · exact ⟨_, P₀, hP₀_in, P₀_right, Q₀, P₀_left, t₀, s₀, y₀, x₀, hexc₀.symm, hdisj, rfl⟩ + let d_min := Nat.find hex_exc + obtain ⟨P₁, hP₁_in, P_left, Q, P_right, s, t, x, y, hexc, hdisj_xy, hd_eq⟩ := + Nat.find_spec hex_exc + have hmax_xy : ∀ P' ∈ P_set, ∀ P'_left Q' P'_right : Graph α β, ∀ s' t' x' y' : α, + IsSplitExcursion S S_mid N_keep P' P'_left Q' P'_right s' t' x' y' → + Disjoint (S.Ω.interval x' y') W → + (S.Ω.interval x' y').ncard ≤ (S.Ω.interval x y).ncard := by + intro P' hP' P'_left Q' P'_right s' t' x' y' hexc' hdisj' + have hle_d : d_min ≤ S.Ω.bar.ncard - (S.Ω.interval x' y').ncard := + Nat.find_min' hex_exc ⟨P', hP', P'_left, Q', P'_right, s', t', x', y', hexc', hdisj', rfl⟩ + have hsub_bar : (S.Ω.interval x' y').ncard ≤ S.Ω.bar.ncard := + ncard_le_ncard (S.Ω.interval_subset_bar x' y') S.Ω.finite_bar + omega + obtain ⟨hx_int, hy_int, hlink_x, hlink_y⟩ := hexc.internal_and_links hdisj_SN + have hP₁_ends := hexc.1 + obtain ⟨hP_left_le, hQ_le, hP_right_le, hQ_N, hp_left, hp_Q, hp_right, + hxy, hx_bar, hy_bar, hi_LQ, hi_QR, hd_LR, _, _⟩ := hexc.2 + have hpL_mid : IsGraphPathWithEnds S_mid.G P_left s x := hp_left.mono hP₁_ends.1.le + have hpR_mid : IsGraphPathWithEnds S_mid.G P_right y t := hp_right.mono hP₁_ends.1.le + have hx_int' : x ∈ pathInternalVerts S_mid.G P₁ ∩ S_mid.Ω.bar := by + rwa [hΩ_mid] + have hy_int' : y ∈ pathInternalVerts S_mid.G P₁ ∩ S_mid.Ω.bar := by + rwa [hΩ_mid] + have hdisj_xy_mid : Disjoint (S_mid.Ω.interval x y) W ∨ Disjoint (S_mid.Ω.interval y x) W := by + rw [hΩ_mid]; exact Or.inl hdisj_xy + obtain ⟨P_set', hP_set'_or, hcr', hcard_le, hlt_E⟩ := + exists_crooked_drop_middle_of_empty_interval hvalid.1 hP₁_in hP₁_ends hx_int' hy_int' hxy + hP_left_le hQ_le hP_right_le hp_left hp_Q hp_right + hi_LQ hi_QR hd_LR hdisj_xy_mid + have hR_cases_of_mem : ∀ {R : Graph α β}, R ∈ P_set' → + R ∈ P_set \ {P₁} ∨ R = P_left ∨ R = P_right := by + intro R hR_in' + rcases hP_set'_or with rfl | rfl | rfl + · rcases hR_in' with h | h + · exact Or.inl h + · rw [mem_singleton_iff] at h; exact Or.inr (Or.inl h) + · rcases hR_in' with h | h + · exact Or.inl h + · rw [mem_singleton_iff] at h; exact Or.inr (Or.inr h) + · rcases hR_in' with h | (h | h) + · exact Or.inl h + · exact Or.inr (Or.inl h) + · rw [mem_singleton_iff] at h; exact Or.inr (Or.inr h) + have hW'_sub : S_mid.transactionEnds P_set' ⊆ W ∪ {x, y} := by + rintro z ⟨R, hR_in', d, hR_ends⟩ + rcases hR_cases_of_mem hR_in' with hR_diff | hR_eq | hR_eq + · exact Or.inl ⟨R, hR_diff.1, d, hR_ends⟩ + · rw [hR_eq] at hR_ends + rcases hR_ends.1.ends_eq hpL_mid with ⟨hz, _⟩ | ⟨_, hz⟩ + · rw [← hz]; exact Or.inl ⟨P₁, hP₁_in, t, hP₁_ends⟩ + · rw [← hz]; exact Or.inr (Or.inl rfl) + · rw [hR_eq] at hR_ends + rcases hR_ends.1.ends_eq hpR_mid with ⟨hz, _⟩ | ⟨_, hz⟩ + · rw [← hz]; exact Or.inr (Or.inr rfl) + · rw [← hz]; exact Or.inl ⟨P₁, hP₁_in, s, hP₁_ends.symm S_mid⟩ + have hvalid' : IsValidStepBConfig S S_mid N_keep p P_set' := by + refine ⟨hcr', hvalid.2.1.trans hcard_le, ?_, ?_⟩ + · intro R hR_in' s' t' c e hR_ends hlink + rcases hR_cases_of_mem hR_in' with hR_diff | hR_eq | hR_eq + · exact hvalid.2.2.1 R hR_diff.1 s' t' c e hR_ends hlink + · rw [hR_eq] at hR_ends hlink + rcases hR_ends.1.ends_eq hpL_mid with ⟨hs', _⟩ | ⟨_, hs'⟩ + · rw [← hs'] at hlink + exact hvalid.2.2.1 P₁ hP₁_in s t c e hP₁_ends (hlink.mono hP_left_le) + · rw [← hs'] at hlink + exact hlink_x c e hlink + · rw [hR_eq] at hR_ends hlink + rcases hR_ends.1.ends_eq hpR_mid with ⟨hs', _⟩ | ⟨_, hs'⟩ + · rw [← hs'] at hlink + exact hlink_y c e hlink + · rw [← hs'] at hlink + exact hvalid.2.2.1 P₁ hP₁_in t s c e (hP₁_ends.symm S_mid) (hlink.mono hP_right_le) + · intro R hR_in' P'_left Q' P'_right s' t' x' y' hexc' + have h_lifted : ∃ R₀ ∈ P_set, ∃ s₀ t₀ : α, ∃ P₀_left P₀_right : Graph α β, + IsSplitExcursion S S_mid N_keep R₀ P₀_left Q' P₀_right s₀ t₀ x' y' ∧ + Disjoint V(Q') V(Q) := by + rcases hR_cases_of_mem hR_in' with hR_diff | hR_or + · refine ⟨R, hR_diff.1, s', t', P'_left, P'_right, hexc', ?_⟩ + exact (hfence.1.2 hR_diff.1 hP₁_in hR_diff.2).mono + hexc'.2.2.1.vertexSet_mono hQ_le.vertexSet_mono + · obtain ⟨s₀, t₀, x₀, y₀, P₀_left, P₀_right, hpair, hexc₀, hdisj_Q'Q⟩ := + hexc.lift_of_subpath hdisj_SN hR_or hexc' + have hx₀_in : x₀ ∈ ({x', y'} : Set α) := by rw [← hpair]; simp + have hy₀_in : y₀ ∈ ({x', y'} : Set α) := by rw [← hpair]; simp + have hx₀y₀ : x₀ ≠ y₀ := by + obtain ⟨_, _, _, _, _, _, _, _, hne, _⟩ := hexc₀; exact hne + rcases hx₀_in with h1 | h1 <;> rcases hy₀_in with h2 | h2 + · exact (hx₀y₀ (h1.trans h2.symm)).elim + · rw [h1, h2] at hexc₀ + exact ⟨P₁, hP₁_in, s₀, t₀, P₀_left, P₀_right, hexc₀, hdisj_Q'Q⟩ + · rw [h1, h2] at hexc₀ + exact ⟨P₁, hP₁_in, t₀, s₀, P₀_right, P₀_left, hexc₀.symm, hdisj_Q'Q⟩ + · exact (hx₀y₀ (h1.trans h2.symm)).elim + obtain ⟨R₀, hR₀_in, s₀, t₀, P₀_left, P₀_right, hexc₀, hdisj_Q'Q⟩ := h_lifted + have h_empty_W' : ∀ {P_l P_r : Graph α β} {s₁ t₁ a' b' : α}, + IsSplitExcursion S S_mid N_keep R₀ P_l Q' P_r s₁ t₁ a' b' → + Disjoint (S.Ω.interval a' b') W → + Disjoint (S.Ω.interval a' b') (S_mid.transactionEnds P_set') := by + intro P_l P_r s₁ t₁ a' b' hexc_ab hdisj_ab_W + have hcard_ab_le : (S.Ω.interval a' b').ncard ≤ (S.Ω.interval x y).ncard := + hmax_xy R₀ hR₀_in P_l Q' P_r s₁ t₁ a' b' hexc_ab hdisj_ab_W + obtain ⟨hR₀_ends, _, _, _, hQ'_N, _, hp_Q', _, ha'b', ha'_bar, hb'_bar, _⟩ := hexc_ab + have hQ_path_N : IsGraphPathWithEnds N.G Q x y := + (hp_Q.mono hP₁_ends.1.le).of_le (hQ_N.trans hN_keep_le) + have hQ'_path_N : IsGraphPathWithEnds N.G Q' a' b' := + (hp_Q'.mono hR₀_ends.1.le).of_le (hQ'_N.trans hN_keep_le) + have hnot_cr : ¬ S.Ω.Crosses a' b' x y := by + rw [← hΩ₀] + exact not_crosses_inner_of_disjoint_paths hrural + hQ'_path_N (hΩ₀.symm ▸ ha'_bar) (hΩ₀.symm ▸ hb'_bar) + hQ_path_N (hΩ₀.symm ▸ hx_bar) (hΩ₀.symm ▸ hy_bar) hdisj_Q'Q + have hx_ne_a' : x ≠ a' := fun h => + disjoint_left.mp hdisj_Q'Q hQ'_path_N.left_mem (h ▸ hQ_path_N.left_mem) + have hx_ne_b' : x ≠ b' := fun h => + disjoint_left.mp hdisj_Q'Q hQ'_path_N.right_mem (h ▸ hQ_path_N.left_mem) + have hy_ne_a' : y ≠ a' := fun h => + disjoint_left.mp hdisj_Q'Q hQ'_path_N.left_mem (h ▸ hQ_path_N.right_mem) + have hy_ne_b' : y ≠ b' := fun h => + disjoint_left.mp hdisj_Q'Q hQ'_path_N.right_mem (h ▸ hQ_path_N.right_mem) + have hboth_not : x ∉ S.Ω.interval a' b' ∧ y ∉ S.Ω.interval a' b' := by + have hboth_if_one : x ∈ S.Ω.interval a' b' ∨ y ∈ S.Ω.interval a' b' → + x ∈ S.Ω.interval a' b' ∧ y ∈ S.Ω.interval a' b' := by + rintro (hx_ab | hy_ab) + · refine ⟨hx_ab, ?_⟩ + rcases S.Ω.mem_interval_or_interval_swap ha'_bar hb'_bar hy_bar ha'b' hy_ne_a' + hy_ne_b' + with hy_ab | hy_ba + · exact hy_ab + · exact (hnot_cr (S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hx_ab, hy_ba⟩))).elim + · refine ⟨?_, hy_ab⟩ + rcases S.Ω.mem_interval_or_interval_swap ha'_bar hb'_bar hx_bar ha'b' hx_ne_a' + hx_ne_b' + with hx_ab | hx_ba + · exact hx_ab + · exact (hnot_cr (S.Ω.crosses_iff_interval.mpr (Or.inr ⟨hy_ab, hx_ba⟩))).elim + by_contra hnot + have hor : x ∈ S.Ω.interval a' b' ∨ y ∈ S.Ω.interval a' b' := by tauto + obtain ⟨hx_ab, hy_ab⟩ := hboth_if_one hor + rcases S.Ω.interval_subset_interval_or_swap hx_ab hy_ab hxy with hsub_xy | hsub_yx + · have hfin_ab : (S.Ω.interval a' b').Finite := + S.Ω.finite_bar.subset (S.Ω.interval_subset_bar a' b') + have hlt_card : (S.Ω.interval x y).ncard < (S.Ω.interval a' b').ncard := + ncard_lt_ncard ⟨hsub_xy, fun hall => (hall hy_ab).1.2 (Or.inr rfl)⟩ hfin_ab + omega + · have hs_W : s ∈ W := ⟨P₁, hP₁_in, t, hP₁_ends⟩ + have hs_bar : s ∈ S.Ω.bar := hΩ_mid ▸ hP₁_ends.2.2.1 + have hs_ne_x : s ≠ x := fun h => hx_int.1.2 (h ▸ ⟨t, hP₁_ends.1⟩) + have hs_ne_y : s ≠ y := fun h => hy_int.1.2 (h ▸ ⟨t, hP₁_ends.1⟩) + rcases S.Ω.mem_interval_or_interval_swap hx_bar hy_bar hs_bar hxy hs_ne_x hs_ne_y + with hs_xy | hs_yx + · exact disjoint_left.mp hdisj_xy hs_xy hs_W + · exact disjoint_left.mp hdisj_ab_W (hsub_yx hs_yx) hs_W + rw [disjoint_left] + intro z hz_ab hz_W' + rcases hW'_sub hz_W' with hz_W | (rfl | rfl) + · exact disjoint_left.mp hdisj_ab_W hz_ab hz_W + · exact hboth_not.1 hz_ab + · exact hboth_not.2 hz_ab + rcases hvalid.2.2.2 R₀ hR₀_in P₀_left Q' P₀_right s₀ t₀ x' y' hexc₀ with hd1 | hd2 + · exact Or.inl (h_empty_W' hexc₀ hd1) + · exact Or.inr (h_empty_W' hexc₀.symm hd2) + have hlt_m : E(S_mid.transactionUnion P_set').ncard < m_min := by + change E(S_mid.transactionUnion P_set').ncard < Nat.find hex_B + omega + exact Nat.find_min hex_B hlt_m ⟨P_set', hvalid', rfl⟩ + obtain ⟨A, B, hfence⟩ := hvalid.1.1 + have hP_le_mid : ∀ P ∈ P_set, P ≤ S_mid.G := fun P hP => by + obtain ⟨_, _, h⟩ := hfence.1.1 P hP; exact h.1.le + exact ⟨P_set, Society.isCrookedTransaction_of_omega_eq hΩ_mid hP_le_mid hP_le_S hvalid.1, + hvalid.2.1⟩ + +private theorem endMap_atPathEnds {S : Society α β} {P_set : Set (Graph α β)} + {P : Graph α β} (hP : P ∈ P_set) {s t : Graph α β → α} + (hends : S.IsOmegaPathWithEnds P (s P) (t P)) {f : α → α} {P_v : α → Graph α β} + {u w : Graph α β → α} + (hPv_eq : ∀ v ∈ S.transactionEnds P_set, v ∈ V(P) → P_v v = P) + (hside : ∀ v ∈ S.transactionEnds P_set, + (v = s (P_v v) ∧ f v = u (P_v v)) ∨ (v = t (P_v v) ∧ f v = w (P_v v))) : + (s P ∈ S.transactionEnds P_set ∧ f (s P) = u P) ∧ + (t P ∈ S.transactionEnds P_set ∧ f (t P) = w P) := by + have hs := hends.mem_transactionEnds_left S hP + have ht := hends.mem_transactionEnds_right S hP + constructor + · refine ⟨hs, ?_⟩ + have hor := hside (s P) hs + rw [hPv_eq _ hs hends.1.left_mem] at hor + rcases hor with h | h + · exact h.2 + · exact (hends.2.1 h.1).elim + · refine ⟨ht, ?_⟩ + have hor := hside (t P) ht + rw [hPv_eq _ ht hends.1.right_mem] at hor + rcases hor with h | h + · exact (hends.2.1 h.1.symm).elim + · exact h.2 + +private theorem disjointEndSegments {S : Society α β} {P_set : Set (Graph α β)} + {A B : Set α} (hfence : S.IsFenceFor P_set A B) + {s t : Graph α β → α} {L R : Graph α β → Graph α β} + (hdisj_LR : ∀ P ∈ P_set, Disjoint V(L P) V(R P)) + {P_v T_v : α → Graph α β} {W : Set α} + (h_end : ∀ v ∈ W, P_v v ∈ P_set ∧ + ((v = s (P_v v) ∧ T_v v = L (P_v v)) ∨ (v = t (P_v v) ∧ T_v v = R (P_v v))) ∧ + T_v v ≤ P_v v) + {v₁ v₂ : α} (hv₁ : v₁ ∈ W) (hv₂ : v₂ ∈ W) (hne : v₁ ≠ v₂) : + Disjoint V(T_v v₁) V(T_v v₂) := by + classical + obtain ⟨hP₁, hor₁, hT₁_le⟩ := h_end v₁ hv₁ + obtain ⟨hP₂, hor₂, hT₂_le⟩ := h_end v₂ hv₂ + by_cases hP_eq : P_v v₁ = P_v v₂ + · rw [hP_eq] at hor₁ + have hdLR := hdisj_LR (P_v v₂) hP₂ + rcases hor₁ with ⟨hv₁_s, hT₁_L⟩ | ⟨hv₁_t, hT₁_R⟩ <;> + rcases hor₂ with ⟨hv₂_s, hT₂_L⟩ | ⟨hv₂_t, hT₂_R⟩ + · exact (hne (hv₁_s.trans hv₂_s.symm)).elim + · rw [hT₁_L, hT₂_R]; exact hdLR + · rw [hT₁_R, hT₂_L]; exact hdLR.symm + · exact (hne (hv₁_t.trans hv₂_t.symm)).elim + · exact (hfence.1.2 hP₁ hP₂ hP_eq).mono hT₁_le.vertexSet_mono hT₂_le.vertexSet_mono + +private theorem transportCrossingThroughRural {N : Neighborhood α β} (hrural : N.IsRural) + {W : Set α} (hbar : W ⊆ N.Ω.bar) {f : α → α} {T : α → Graph α β} + (hpath : ∀ v ∈ W, IsGraphPathWithEnds N.G (T v) v (f v) ∧ f v ∈ N.Ω₀.bar) + (hdisj : ∀ v₁ ∈ W, ∀ v₂ ∈ W, v₁ ≠ v₂ → Disjoint V(T v₁) V(T v₂)) + {v₁ v₂ v₃ v₄ : α} (hv₁ : v₁ ∈ W) (hv₃ : v₃ ∈ W) (hv₂ : v₂ ∈ W) (hv₄ : v₄ ∈ W) : + N.Ω.Crosses v₁ v₃ v₂ v₄ ↔ N.Ω₀.Crosses (f v₁) (f v₃) (f v₂) (f v₄) := by + classical + have hnot_eq : ∀ {Ω : CyclicPerm α} {a b c d : α}, Ω.Crosses a b c d → + a ≠ b ∧ a ≠ c ∧ a ≠ d ∧ b ≠ c ∧ b ≠ d ∧ c ≠ d := by + intro Ω a b c d h + rcases h with h | h + · obtain ⟨h12, h13, h14, h23, h24, h34, _⟩ := Ω.isClockwise4_iff.mp h + exact ⟨h13, h12, h14, h23.symm, h34, h24⟩ + · obtain ⟨h12, h13, h14, h23, h24, h34, _⟩ := Ω.isClockwise4_iff.mp h + exact ⟨h24.symm, h34.symm, h14.symm, h23, h12.symm, h13.symm⟩ + by_cases hdist : v₁ ≠ v₂ ∧ v₁ ≠ v₃ ∧ v₁ ≠ v₄ ∧ v₂ ≠ v₃ ∧ v₂ ≠ v₄ ∧ v₃ ≠ v₄ + · rcases hdist with ⟨h12, h13, h14, h23, h24, h34⟩ + exact crosses_outer_iff_crosses_inner_of_disjoint_paths hrural + (hpath v₁ hv₁).1 (hbar hv₁) (hpath v₁ hv₁).2 + (hpath v₂ hv₂).1 (hbar hv₂) (hpath v₂ hv₂).2 + (hpath v₃ hv₃).1 (hbar hv₃) (hpath v₃ hv₃).2 + (hpath v₄ hv₄).1 (hbar hv₄) (hpath v₄ hv₄).2 + (hdisj v₁ hv₁ v₂ hv₂ h12) (hdisj v₁ hv₁ v₃ hv₃ h13) (hdisj v₁ hv₁ v₄ hv₄ h14) + (hdisj v₂ hv₂ v₃ hv₃ h23) (hdisj v₂ hv₂ v₄ hv₄ h24) (hdisj v₃ hv₃ v₄ hv₄ h34) + · refine ⟨fun hcr => ?_, fun hcr' => ?_⟩ + · obtain ⟨h13, h12, h14, h23, h34, h24⟩ := hnot_eq hcr + exact (hdist ⟨h12, h13, h14, h23.symm, h24, h34⟩).elim + · obtain ⟨h13, h12, h14, h23, h34, h24⟩ := hnot_eq hcr' + refine (hdist ⟨fun h => h12 (congrArg f h), fun h => h13 (congrArg f h), + fun h => h14 (congrArg f h), fun h => h23 (congrArg f h.symm), + fun h => h24 (congrArg f h), fun h => h34 (congrArg f h)⟩).elim + +private theorem validationAfterRestriction + {S S_comp S_mid : Society α β} {N : Neighborhood α β} {p : ℕ} + (hcomp : S_comp.IsComposition S N) (hrural : N.IsRural) + {P_set₀ : Set (Graph α β)} (hcard₀ : p ≤ P_set₀.ncard) + {M_fn : Graph α β → Graph α β} {s_fn t_fn u_fn w_fn : Graph α β → α} + (hM_edge : ∀ P ∈ P_set₀, (∀ c e, (M_fn P).IsLink e (u_fn P) c → e ∈ E(S.G)) ∧ + (∀ c e, (M_fn P).IsLink e (w_fn P) c → e ∈ E(S.G))) + {N_keep : Graph α β} (hN_keep_le : N_keep ≤ N.G) {V_drop : Set α} + (hN_edges : ∀ e ∈ E(N_keep), ∀ v ∈ V_drop, ¬ N.G.Inc e v) + (hM_ends_mid : ∀ P ∈ P_set₀, S_mid.IsOmegaPathWithEnds (M_fn P) (u_fn P) (w_fn P)) + {f_v : α → α} {T_v : α → Graph α β} + (h_end : ∀ v ∈ S_comp.transactionEnds P_set₀, f_v v ∈ S.Ω.bar ∧ + IsGraphPathWithEnds N.G (T_v v) v (f_v v) ∧ V(T_v v) ⊆ V_drop) + (hfv_s : ∀ P ∈ P_set₀, s_fn P ∈ S_comp.transactionEnds P_set₀ ∧ f_v (s_fn P) = u_fn P) + (hfv_t : ∀ P ∈ P_set₀, t_fn P ∈ S_comp.transactionEnds P_set₀ ∧ f_v (t_fn P) = w_fn P) + (hcr₁ : S_mid.IsCrookedTransaction (M_fn '' P_set₀)) + (hcard₁_eq : (M_fn '' P_set₀).ncard = P_set₀.ncard) : + IsValidStepBConfig S S_mid N_keep p (M_fn '' P_set₀) := by + classical + let W₀ := S_comp.transactionEnds P_set₀ + let P_set₁ := M_fn '' P_set₀ + refine ⟨hcr₁, hcard₁_eq ▸ hcard₀, ?_, ?_⟩ + · rintro _ ⟨P, hP, rfl⟩ s t c e hM_st hlink + obtain ⟨hfu, hfw⟩ := hM_edge P hP + rcases (hM_ends_mid P hP).ends_eq S_mid hM_st with ⟨rfl, _⟩ | ⟨rfl, _⟩ + · exact hfu c e hlink + · exact hfw c e hlink + · rintro _ ⟨P, hP, rfl⟩ P_left Q P_right s t x y hexc + obtain ⟨hM_st, _, _, _, hQ_N, _, hp_Q, _, hxy, hx_bar, hy_bar, _⟩ := hexc + have hQ_disj_drop : Disjoint V(Q) V_drop := by + rw [disjoint_left] + intro v hvQ hv_drop + obtain ⟨e, heQ, z, hvzQ⟩ := hp_Q.exists_inc_of_mem_of_ne hxy hvQ + have he_keep : e ∈ E(N_keep) := hQ_N.edgeSet_mono heQ + exact hN_edges e he_keep v hv_drop ⟨z, hvzQ.mono (hQ_N.trans hN_keep_le)⟩ + have hQ_path_N : IsGraphPathWithEnds N.G Q x y := + (hp_Q.mono hM_st.1.le).of_le (hQ_N.trans hN_keep_le) + have hW₁_sub : S_mid.transactionEnds P_set₁ ⊆ f_v '' W₀ := by + rintro z ⟨_, ⟨P₀, hP₀, rfl⟩, d, hM₀_zd⟩ + rcases (hM_ends_mid P₀ hP₀).ends_eq S_mid hM₀_zd with ⟨rfl, _⟩ | ⟨rfl, _⟩ + · exact ⟨s_fn P₀, (hfv_s P₀ hP₀).1, (hfv_s P₀ hP₀).2⟩ + · exact ⟨t_fn P₀, (hfv_t P₀ hP₀).1, (hfv_t P₀ hP₀).2⟩ + by_contra hnot_or + push Not at hnot_or + rw [not_disjoint_iff_nonempty_inter, not_disjoint_iff_nonempty_inter] at hnot_or + rcases hnot_or with ⟨⟨z₁, hz₁_xy, hz₁_W₁⟩, ⟨z₂, hz₂_yx, hz₂_W₁⟩⟩ + rcases hW₁_sub hz₁_W₁ with ⟨v₁, hv₁_W₀, rfl⟩ + rcases hW₁_sub hz₂_W₁ with ⟨v₂, hv₂_W₀, rfl⟩ + have hbar₀ : W₀ ⊆ N.Ω.bar := hcomp.2.1 ▸ S_comp.transactionEnds_subset_bar P_set₀ + have h1 := h_end v₁ hv₁_W₀ + have h2 := h_end v₂ hv₂_W₀ + have hcr_inner : N.Ω₀.Crosses x y (f_v v₁) (f_v v₂) := by + rw [hcomp.2.2.1] + exact S.Ω.crosses_iff_interval.mpr (Or.inl ⟨hz₁_xy, hz₂_yx⟩) + exact not_crosses_inner_of_disjoint_paths_to_outer hrural + hQ_path_N (hcomp.2.2.1.symm ▸ hx_bar) (hcomp.2.2.1.symm ▸ hy_bar) + h1.2.1 (hbar₀ hv₁_W₀) (hcomp.2.2.1.symm ▸ h1.1) + h2.2.1 (hbar₀ hv₂_W₀) (hcomp.2.2.1.symm ▸ h2.1) + (hQ_disj_drop.mono_right h1.2.2) + (hQ_disj_drop.mono_right h2.2.2) + hcr_inner + +/-- **Graph Minors IX, (9.1)** (pages 62–63): +"If the composition of a society $(G, \Omega)$ with some rural neighborhood has a crooked +transaction of cardinality $\ge p$, then so does $(G, \Omega)$." -/ +theorem theorem_9_1_proof + {S S_comp : Society α β} {N : Neighborhood α β} {p : ℕ} + (hcomp : S_comp.IsComposition S N) (hrural : N.IsRural) + {P_set₀ : Set (Graph α β)} + (hcrooked₀ : S_comp.IsCrookedTransaction P_set₀) (hcard₀ : p ≤ P_set₀.ncard) : + ∃ P_set : Set (Graph α β), S.IsCrookedTransaction P_set ∧ p ≤ P_set.ncard := by + classical + rcases P_set₀.eq_empty_or_nonempty with rfl | ⟨P_init, hP_init⟩ + · refine ⟨∅, ⟨⟨S.Ω.bar, ∅, ⟨fun _ h => h.elim, fun _ h => h.elim⟩, + ⟨Subset.rfl, empty_subset _, disjoint_empty _, union_empty _, + fun _ _ _ _ _ _ hb => hb.elim⟩, + fun _ h => h.elim⟩, fun _ h => h.elim⟩, hcard₀⟩ + obtain ⟨A₀, B₀, hfence₀⟩ := hcrooked₀.1 + obtain ⟨s_init, _, _, _, _⟩ := hfence₀.2.2 P_init hP_init + have hnot_le₀ : ∀ P ∈ P_set₀, ¬ P ≤ N.G := + forall_not_le_right_of_isCrookedTransaction hcomp hrural hcrooked₀ + have hex_split : ∀ P : Graph α β, + ∃ s t u w : α, ∃ L_P M_P R_P : Graph α β, P ∈ P_set₀ → + S_comp.IsOmegaPathWithEnds P s t ∧ + u ∈ S.Ω.bar ∧ w ∈ S.Ω.bar ∧ u ≠ w ∧ + L_P ≤ P ∧ M_P ≤ P ∧ R_P ≤ P ∧ + IsGraphPathWithEnds N.G L_P s u ∧ + IsGraphPathWithEnds S_comp.G M_P u w ∧ + IsGraphPathWithEnds N.G R_P t w ∧ + V(L_P) ∩ V(M_P) = {u} ∧ + V(R_P) ∩ V(M_P) = {w} ∧ + Disjoint V(L_P) V(R_P) ∧ + (∀ c e, M_P.IsLink e u c → e ∈ E(S.G)) ∧ + (∀ c e, M_P.IsLink e w c → e ∈ E(S.G)) := by + intro P + by_cases hP : P ∈ P_set₀ + · obtain ⟨s, _, t, _, hP_ends⟩ := hfence₀.2.2 P hP + obtain ⟨u, hu, w, hw, huw, L_P, M_P, R_P, hL, hM, hR, hpL, hpM, hpR, hiL, hiR, hdLR, hfu, + hfw⟩ := + exists_middle_subpath_in_composition hcomp hP_ends (hnot_le₀ P hP) + exact ⟨s, t, u, w, L_P, M_P, R_P, fun _ => + ⟨hP_ends, hu, hw, huw, hL, hM, hR, hpL, hpM, hpR, hiL, hiR, hdLR, hfu, hfw⟩⟩ + · exact ⟨s_init, s_init, s_init, s_init, P_init, P_init, P_init, fun h => (hP h).elim⟩ + choose s_fn t_fn u_fn w_fn L_fn M_fn R_fn hsplit using hex_split + let V_drop : Set α := ⋃ P ∈ P_set₀, (V(L_fn P) ∪ V(R_fn P)) + let E_keep : Set β := {e ∈ E(N.G) | ∀ v ∈ V_drop, ¬ N.G.Inc e v} + let N_keep : Graph α β := N.G.restrict E_keep + let G_mid : Graph α β := S_comp.G.restrict (E(S.G) ∪ E_keep) + have hMid_le : G_mid ≤ S_comp.G := restrict_le + have hbar_mid : S.Ω.bar ⊆ V(G_mid) := by + rw [vertexSet_restrict] + exact S.bar_subset.trans hcomp.1.1.1.vertexSet_mono + have hfinV_mid : V(G_mid).Finite := by + rw [vertexSet_restrict]; exact S_comp.finite_V + have hfinE_mid : E(G_mid).Finite := + S_comp.finite_E.subset hMid_le.edgeSet_mono + let S_mid : Society α β := ⟨G_mid, S.Ω, hfinV_mid, hfinE_mid, hbar_mid⟩ + have hSG_le_mid : S.G ≤ S_mid.G := by + rw [(Compatible.of_le_le hcomp.1.1.1 hMid_le).le_iff] + refine ⟨?_, ?_⟩ + · rw [vertexSet_restrict]; exact hcomp.1.1.1.vertexSet_mono + · rw [edgeSet_restrict]; exact subset_inter hcomp.1.1.1.edgeSet_mono subset_union_left + have hN_keep_le : N_keep ≤ N.G := restrict_le + have hN_le_comp : N_keep ≤ S_comp.G := hN_keep_le.trans hcomp.1.1.2.1 + have hN_le_mid : N_keep ≤ S_mid.G := by + rw [(Compatible.of_le_le hN_le_comp hMid_le).le_iff] + refine ⟨?_, ?_⟩ + · rw [vertexSet_restrict, vertexSet_restrict]; exact hcomp.1.1.2.1.vertexSet_mono + · rw [edgeSet_restrict, edgeSet_restrict] + exact subset_inter (inter_subset_left.trans hcomp.1.1.2.1.edgeSet_mono) + (inter_subset_right.trans subset_union_right) + have hE_mid : E(S_mid.G) ⊆ E(S.G) ∪ E(N_keep) := by + rintro e ⟨_, heS | he_keep⟩ + · exact Or.inl heS + · exact Or.inr ⟨he_keep.1, he_keep⟩ + have hdisj_SN : Disjoint E(S.G) E(N_keep) := + hcomp.1.1.2.2.2.2.mono_right hN_keep_le.edgeSet_mono + have hV_inter : V(S.G) ∩ V(N_keep) ⊆ S.Ω.bar := by + rw [vertexSet_restrict, hcomp.2.2.2] + have hM_ends_mid : ∀ P ∈ P_set₀, + S_mid.IsOmegaPathWithEnds (M_fn P) (u_fn P) (w_fn P) := by + intro P hP + obtain ⟨hP_ends, hu, hw, huw, hL, hM, hR, _, hpM, _, hiL, hiR, _, hfu, hfw⟩ := hsplit P hP + have hM_le_mid : M_fn P ≤ S_mid.G := by + rw [(Compatible.of_le_le hpM.le hMid_le).le_iff] + refine ⟨by rw [vertexSet_restrict]; exact hpM.le.vertexSet_mono, fun e heM => ?_⟩ + have he_comp : e ∈ E(S_comp.G) := hpM.le.edgeSet_mono heM + refine ⟨he_comp, ?_⟩ + by_cases heS : e ∈ E(S.G) + · exact Or.inl heS + · have heN : e ∈ E(N.G) := by + rw [← hcomp.1.1.2.2.2.1] at he_comp; exact he_comp.resolve_left heS + refine Or.inr ⟨heN, fun v hv_drop hinc_N => ?_⟩ + obtain ⟨a, b, habM⟩ := (M_fn P).exists_isLink_of_mem_edgeSet heM + rcases hinc_N with ⟨w₀, hvw₀N⟩ + have hinc_M : (M_fn P).Inc e v := by + rcases (hvw₀N.mono hcomp.1.1.2.1).left_eq_or_eq (habM.mono hpM.le) with rfl | rfl + · exact ⟨b, habM⟩ + · exact ⟨a, habM.symm⟩ + rcases hinc_M with ⟨c, hlink_M⟩ + rcases mem_iUnion₂.mp hv_drop with ⟨P₀, hP₀, hv_LR⟩ + have hP₀_eq : P₀ = P := by + by_contra hne + have hvP : v ∈ V(P) := hM.vertexSet_mono hlink_M.left_mem + have hvP₀ : v ∈ V(P₀) := by + rcases hv_LR with hvL | hvR + · exact (hsplit P₀ hP₀).2.2.2.2.1.vertexSet_mono hvL + · exact (hsplit P₀ hP₀).2.2.2.2.2.2.1.vertexSet_mono hvR + exact disjoint_left.mp (hfence₀.1.2 hP₀ hP hne) hvP₀ hvP + rw [hP₀_eq] at hv_LR + rcases hv_LR with hvL | hvR + · have hv_u : v = u_fn P := by + have hv_in : v ∈ V(L_fn P) ∩ V(M_fn P) := ⟨hvL, hlink_M.left_mem⟩ + rwa [hiL, mem_singleton_iff] at hv_in + exact heS (hfu c e (hv_u ▸ hlink_M)) + · have hv_w : v = w_fn P := by + have hv_in : v ∈ V(R_fn P) ∩ V(M_fn P) := ⟨hvR, hlink_M.left_mem⟩ + rwa [hiR, mem_singleton_iff] at hv_in + exact heS (hfw c e (hv_w ▸ hlink_M)) + exact ⟨hpM.of_le hM_le_mid, huw, hu, hw⟩ + let W₀ := S_comp.transactionEnds P_set₀ + have hex_end : ∀ v : α, + ∃ P : Graph α β, ∃ z : α, ∃ T : Graph α β, v ∈ W₀ → + P ∈ P_set₀ ∧ z ∈ S.Ω.bar ∧ + ((v = s_fn P ∧ z = u_fn P ∧ T = L_fn P) ∨ (v = t_fn P ∧ z = w_fn P ∧ T = R_fn P)) ∧ + IsGraphPathWithEnds N.G T v z ∧ + T ≤ P ∧ + V(T) ⊆ V_drop := by + intro v + by_cases hv : v ∈ W₀ + · rcases hv with ⟨P, hP, d, hP_vd⟩ + obtain ⟨hP_ends, hu, hw, _, hL, _, hR, hpL, _, hpR, _⟩ := hsplit P hP + rcases hP_ends.ends_eq S_comp hP_vd with ⟨rfl, _⟩ | ⟨rfl, _⟩ + · refine ⟨P, u_fn P, L_fn P, fun _ => ⟨hP, hu, Or.inl ⟨rfl, rfl, rfl⟩, hpL, hL, + fun x hx => ?_⟩⟩ + exact mem_iUnion₂.mpr ⟨P, hP, Or.inl hx⟩ + · refine ⟨P, w_fn P, R_fn P, fun _ => ⟨hP, hw, Or.inr ⟨rfl, rfl, rfl⟩, hpR, hR, + fun x hx => ?_⟩⟩ + exact mem_iUnion₂.mpr ⟨P, hP, Or.inr hx⟩ + · exact ⟨P_init, s_init, P_init, fun h => (hv h).elim⟩ + choose P_v f_v T_v h_end using hex_end + have hPv_eq : ∀ P ∈ P_set₀, ∀ v ∈ W₀, v ∈ V(P) → P_v v = P := by + intro P hP v hvW₀ hvP + obtain ⟨hPv_in, _, _, hpT, hT_le, _⟩ := h_end v hvW₀ + by_contra hne + exact disjoint_left.mp (hfence₀.1.2 hPv_in hP hne) (hT_le.vertexSet_mono hpT.left_mem) hvP + have hfv (P : Graph α β) (hP : P ∈ P_set₀) := + endMap_atPathEnds hP (hsplit P hP).1 (hPv_eq P hP) fun v hv => + (h_end v hv).2.2.1.imp (fun h => ⟨h.1, h.2.1⟩) (fun h => ⟨h.1, h.2.1⟩) + have hfv_s := fun P hP => (hfv P hP).1 + have hfv_t := fun P hP => (hfv P hP).2 + have hTv_disj : ∀ v₁ ∈ W₀, ∀ v₂ ∈ W₀, v₁ ≠ v₂ → Disjoint V(T_v v₁) V(T_v v₂) := by + intro v₁ hv₁ v₂ hv₂ hne + refine disjointEndSegments hfence₀ (s := s_fn) (t := t_fn) (L := L_fn) (R := R_fn) + (P_v := P_v) ?_ ?_ hv₁ hv₂ hne + · intro P hP + obtain ⟨_, _, _, _, _, _, _, _, _, _, _, _, hdLR, _⟩ := hsplit P hP + exact hdLR + · intro v hv + obtain ⟨hP, _, hside, _, hle, _⟩ := h_end v hv + refine ⟨hP, ?_, hle⟩ + rcases hside with ⟨hs, _, hL⟩ | ⟨ht, _, hR⟩ + · exact Or.inl ⟨hs, hL⟩ + · exact Or.inr ⟨ht, hR⟩ + have hf_ends : ∀ P ∈ P_set₀, ∀ a b : α, + S_comp.IsOmegaPathWithEnds P a b → S_mid.IsOmegaPathWithEnds (M_fn P) (f_v a) (f_v b) := by + intro P hP a b hP_ab + obtain ⟨hP_ends, _⟩ := hsplit P hP + rcases hP_ends.ends_eq S_comp hP_ab with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rw [(hfv_s P hP).2, (hfv_t P hP).2] + exact hM_ends_mid P hP + · rw [(hfv_t P hP).2, (hfv_s P hP).2] + exact (hM_ends_mid P hP).symm S_mid + have hf_disj : ∀ P ∈ P_set₀, ∀ Q ∈ P_set₀, P ≠ Q → Disjoint V(M_fn P) V(M_fn Q) := by + intro P hP Q hQ hne + exact (hfence₀.1.2 hP hQ hne).mono + (hsplit P hP).2.2.2.2.2.1.vertexSet_mono (hsplit Q hQ).2.2.2.2.2.1.vertexSet_mono + have hf_inj : InjOn f_v W₀ := by + intro v₁ hv₁ v₂ hv₂ heq + by_contra hne + have hm₁ : f_v v₁ ∈ V(T_v v₁) := (h_end v₁ hv₁).2.2.2.1.right_mem + have hm₂ : f_v v₂ ∈ V(T_v v₂) := (h_end v₂ hv₂).2.2.2.1.right_mem + exact disjoint_left.mp (hTv_disj v₁ hv₁ v₂ hv₂ hne) hm₁ (heq ▸ hm₂) + have hf_cross : ∀ v₁ ∈ W₀, ∀ v₃ ∈ W₀, ∀ v₂ ∈ W₀, ∀ v₄ ∈ W₀, + S_comp.Ω.Crosses v₁ v₃ v₂ v₄ ↔ S_mid.Ω.Crosses (f_v v₁) (f_v v₃) (f_v v₂) (f_v v₄) := by + intro v₁ hv₁ v₃ hv₃ v₂ hv₂ v₄ hv₄ + change S_comp.Ω.Crosses v₁ v₃ v₂ v₄ ↔ S.Ω.Crosses (f_v v₁) (f_v v₃) (f_v v₂) (f_v v₄) + rw [← hcomp.2.1, ← hcomp.2.2.1] + exact transportCrossingThroughRural hrural + (hcomp.2.1 ▸ S_comp.transactionEnds_subset_bar P_set₀) + (fun v hv => ⟨(h_end v hv).2.2.2.1, hcomp.2.2.1.symm ▸ (h_end v hv).2.1⟩) + hTv_disj hv₁ hv₃ hv₂ hv₄ + obtain ⟨hcr₁, hcard₁_eq⟩ := + isCrookedTransaction_of_end_map hcrooked₀ hf_ends hf_disj hf_inj hf_cross + let P_set₁ := M_fn '' P_set₀ + have hvalid₁ : IsValidStepBConfig S S_mid N_keep p P_set₁ := by + refine validationAfterRestriction (T_v := T_v) hcomp hrural hcard₀ ?_ hN_keep_le + (fun _ he => he.2.2) hM_ends_mid ?_ hfv_s hfv_t hcr₁ hcard₁_eq + · intro P hP + obtain ⟨_, _, _, _, _, _, _, _, _, _, _, _, _, hfu, hfw⟩ := hsplit P hP + exact ⟨hfu, hfw⟩ + · intro v hv + obtain ⟨_, hfv, _, hpath, _, hsub⟩ := h_end v hv + exact ⟨hfv, hpath, hsub⟩ + exact stepB_of_theorem_9_1 hrural (rfl : S_mid.Ω = S.Ω) hcomp.2.2.1 hE_mid + hSG_le_mid hN_le_mid hN_keep_le hdisj_SN hV_inter hvalid₁ + +end GraphMinor.GM09 diff --git a/LeanPool/GraphMinor/GM10/BranchWidth.lean b/LeanPool/GraphMinor/GM10/BranchWidth.lean new file mode 100644 index 0000000000..e31bf37017 --- /dev/null +++ b/LeanPool/GraphMinor/GM10/BranchWidth.lean @@ -0,0 +1,1784 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.TangleLemmas +public import LeanPool.GraphMinor.GM10.Submodular + +/-! +# Branch-Width and Tangles: Graph Minors X, Section 4 + +This file formalizes Section 4 of Robertson and Seymour, +*Graph Minors. X. Obstructions to tree-decomposition*, J. Combin. Theory Ser. B 52 (1991) 153–190 +(pages 164–167): +- Basic properties of `maxEdgeSize` (`γ(G)`), `branchEdgeOrder`, `branchDecompWidth`, and + `branchWidth` (`β(G)`). +- The edge-boundary connectivity function `κ(X) = |∂(X)| - k` on `E(G)` and the singleton edge + family `𝒜 = {{e} : e ∈ E(G)}`. +- **(4.3)** (`theorem_4_3`, with claims `theorem_4_3_claim_1`, `theorem_4_3_claim_2`, + `theorem_4_3_claim_3`): `max(β(G), γ(G)) = θ(G)` unless `γ(G) = 0` and `V(G) ≠ ∅`. +- **(4.4)** (`theorem_4_4`): For `n ≥ 0`, `K_n` has tangle number `⌈(2/3)n⌉`, and for `n ≥ 3`, it + has branch-width `⌈(2/3)n⌉`. +- **(4.5)** (`theorem_4_5`, with claims `theorem_4_5_claim_3` and `theorem_4_5_claim_4`): + Weakening of the second tangle axiom for `θ ≥ 2`. +-/ + +public section + +namespace GraphMinor.GM10 + +open SimpleGraph Hypergraph + +variable {α β ι : Type*} + +/-! ## Basic properties of `maxEdgeSize` and `branchWidth` -/ + +/-- The set of ends of an edge `e` in `G` is finite. -/ +theorem ends_finite (G : Hypergraph α β) (e : β) : (G.ends e).Finite := + G.vertexSet_finite.subset fun _ h ↦ G.vertex_mem_of_inc h + +/-- Every edge `e ∈ E(G)` has size at most `maxEdgeSize G` (`γ(G)`). -/ +theorem edgeSize_le_maxEdgeSize {G : Hypergraph α β} {e : β} (he : e ∈ G.edgeSet) : + edgeSize G e ≤ maxEdgeSize G := + le_csSup ((G.edgeSet_finite.image (edgeSize G)).bddAbove) ⟨e, he, rfl⟩ + +/-- `maxEdgeSize G ≤ k` if and only if every edge `e ∈ E(G)` has `edgeSize G e ≤ k`. -/ +theorem maxEdgeSize_le_iff {G : Hypergraph α β} {k : ℕ} : + maxEdgeSize G ≤ k ↔ ∀ e ∈ G.edgeSet, edgeSize G e ≤ k := by + constructor + · intro hk e he + exact (edgeSize_le_maxEdgeSize he).trans hk + · intro h + by_cases hE : G.edgeSet.Nonempty + · refine csSup_le (hE.image _) ?_ + rintro _ ⟨e, he, rfl⟩ + exact h e he + · rw [Set.not_nonempty_iff_eq_empty] at hE + simp [maxEdgeSize, hE] + +/-- `maxEdgeSize G = 0` if and only if no edge of `G` is incident with any vertex. -/ +theorem maxEdgeSize_eq_zero_iff {G : Hypergraph α β} : + maxEdgeSize G = 0 ↔ ∀ e ∈ G.edgeSet, ∀ v, ¬ G.Inc e v := by + rw [← Nat.le_zero, maxEdgeSize_le_iff] + refine forall₂_congr fun e _ ↦ ?_ + rw [Nat.le_zero, edgeSize, Set.ncard_eq_zero (ends_finite G e), Set.eq_empty_iff_forall_notMem] + rfl + +/-- If `1 ≤ maxEdgeSize G`, then `E(G)` and `V(G)` are both nonempty. -/ +theorem nonempty_of_one_le_maxEdgeSize {G : Hypergraph α β} (hγ : 1 ≤ maxEdgeSize G) : + G.edgeSet.Nonempty ∧ G.vertexSet.Nonempty := by + have hnot0 : ¬ maxEdgeSize G = 0 := by omega + rw [maxEdgeSize_eq_zero_iff] at hnot0 + push Not at hnot0 + obtain ⟨e, he, v, hinc⟩ := hnot0 + exact ⟨⟨e, he⟩, ⟨v, G.vertex_mem_of_inc hinc⟩⟩ + +/-- Every edge `e ∈ E(G)` has `edgeSize G e ≤ tangleNumber G` (from `(2.4)`). -/ +theorem maxEdgeSize_le_tangleNumber (G : Hypergraph α β) : + maxEdgeSize G ≤ tangleNumber G := by + rw [maxEdgeSize_le_iff] + intro e he + by_cases hsize : 1 ≤ edgeSize G e + · exact (theorem_2_4_proof hsize he le_rfl).le_tangleNumber + · omega + +/-- In a branch-decomposition `(T, τ)` of `G`, `|E(G)| = |leafSet T| ≥ 2`. -/ +theorem IsBranchDecomposition.two_le_ncard_edgeSet [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → β} (h : IsBranchDecomposition G T τ) : + 2 ≤ G.edgeSet.ncard := by + have himg : τ '' leafSet T = G.edgeSet := h.bijOn.image_eq + rw [← himg, h.bijOn.injOn.ncard_image] + exact h.isTernaryTree.two_le_ncard_leafSet + +/-- When `|E(G)| ≤ 1`, `G` has no branch-decompositions and `branchWidth G = 0`. -/ +theorem branchWidth_eq_zero_of_ncard_edgeSet_le_one {G : Hypergraph α β} + (h : G.edgeSet.ncard ≤ 1) : branchWidth G = 0 := by + suffices {w : ℕ | ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → β), + IsBranchDecomposition G T τ ∧ branchDecompWidth G T τ = w} = ∅ by + simp [branchWidth, this] + ext w + simp only [Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false] + rintro ⟨ι, _, T, τ, hbd, _⟩ + have h2 := hbd.two_le_ncard_edgeSet + omega + +/-- Every edge `e ∈ E(T)` has `branchEdgeOrder G T τ e ≤ branchDecompWidth G T τ`. -/ +theorem branchEdgeOrder_le_branchDecompWidth [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → β} {e : Sym2 ι} (he : e ∈ T.edgeSet) : + branchEdgeOrder G T τ e ≤ branchDecompWidth G T τ := + le_csSup (((Set.toFinite T.edgeSet).image (branchEdgeOrder G T τ)).bddAbove) ⟨e, he, rfl⟩ + +/-- `branchDecompWidth G T τ ≤ k` if and only if every edge `e ∈ E(T)` has +`branchEdgeOrder G T τ e ≤ k`. -/ +theorem branchDecompWidth_le_iff [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → β} {k : ℕ} : + branchDecompWidth G T τ ≤ k ↔ ∀ e ∈ T.edgeSet, branchEdgeOrder G T τ e ≤ k := by + constructor + · intro hk e he + exact (branchEdgeOrder_le_branchDecompWidth he).trans hk + · intro h + by_cases hE : T.edgeSet.Nonempty + · refine csSup_le (hE.image _) ?_ + rintro _ ⟨e, he, rfl⟩ + exact h e he + · rw [Set.not_nonempty_iff_eq_empty] at hE + simp [branchDecompWidth, hE] + +/-- If `γ(G) = 0`, then `β(G) = 0` (Graph Minors X, Section 4, proof of (4.3), page 165). -/ +theorem branchWidth_eq_zero_of_maxEdgeSize_eq_zero {G : Hypergraph α β} + (hγ : maxEdgeSize G = 0) : branchWidth G = 0 := by + have hno_inc := maxEdgeSize_eq_zero_iff.1 hγ + have hwidth_zero : ∀ (ι : Type) [Fintype ι] (T : SimpleGraph ι) (τ : ι → β), + IsBranchDecomposition G T τ → branchDecompWidth G T τ = 0 := by + intro ι _ T τ hbd + rw [← Nat.le_zero, branchDecompWidth_le_iff] + intro e _ + have hfinite : {v ∈ G.vertexSet | ∃ t₁ ∈ leafSet T, ∃ t₂ ∈ leafSet T, + ¬ (T.deleteEdges {e}).Reachable t₁ t₂ ∧ G.Inc (τ t₁) v ∧ G.Inc (τ t₂) v}.Finite := + G.vertexSet_finite.subset fun _ hx ↦ hx.1 + rw [Nat.le_zero, branchEdgeOrder, Set.ncard_eq_zero hfinite, + Set.eq_empty_iff_forall_notMem] + rintro v ⟨_, t₁, ht₁, _, _, _, hinc₁, _⟩ + exact hno_inc (τ t₁) (hbd.bijOn.mapsTo ht₁) v hinc₁ + by_cases hS : {w : ℕ | ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → β), + IsBranchDecomposition G T τ ∧ branchDecompWidth G T τ = w}.Nonempty + · obtain ⟨w, ι, _, T, τ, hbd, rfl⟩ := hS + have hw0 : branchDecompWidth G T τ = 0 := hwidth_zero ι T τ hbd + exact Nat.eq_zero_of_le_zero (hw0 ▸ Nat.sInf_le ⟨ι, inferInstance, T, τ, hbd, rfl⟩) + · rw [Set.not_nonempty_iff_eq_empty] at hS + simp [branchWidth, hS] + +/-- If `γ(G) = 0`, then `G` has no tangle of order `≥ 2`, so `θ(G) ≤ 1` +(Graph Minors X, Section 4, proof of (4.3), page 165). -/ +theorem tangleNumber_le_one_of_maxEdgeSize_eq_zero {G : Hypergraph α β} + (hγ : maxEdgeSize G = 0) : tangleNumber G ≤ 1 := by + have hno_inc := maxEdgeSize_eq_zero_iff.1 hγ + by_contra! hgt + have h2 : 2 ≤ tangleNumber G := hgt + obtain ⟨𝒯, h𝒯⟩ := exists_isTangle_of_le_tangleNumber (by omega) h2 + have hsep_bot : G.IsSeparation ⊥ G := by + rw [isSeparation_iff_of_le bot_le le_rfl] + simp + have hord_bot : separationOrder (⊥ : Hypergraph α β) G < 2 := by + simp [separationOrder] + have hbot_mem : (⊥, G) ∈ 𝒯 := + (h𝒯.axiom1 hsep_bot hord_bot).resolve_right fun hG ↦ h𝒯.axiom3 hG rfl + obtain ⟨A, B, hext, _, _⟩ := h𝒯.exists_isExtreme hbot_mem + have hAB := hext.1 + have hB_empty : B.edgeSet = ∅ := by + ext e + simp only [Set.mem_empty_iff_false, iff_false] + intro heB + have heG : e ∈ G.edgeSet := (h𝒯.isSeparation hAB).right_le.edgeSet_subset heB + have hends : B.ends e ⊆ A.vertexSet := by + rintro v hv + have hincG : G.Inc e v := inc_of_le (h𝒯.isSeparation hAB).right_le hv + exact (hno_inc e heG v hincG).elim + exact theorem_2_8_no_edge_ends_subset h𝒯 hext heB hends + have hA_eq : A.edgeSet = G.edgeSet := by + have hunion := (h𝒯.isSeparation hAB).edgeSet_union + rwa [hB_empty, Set.union_empty] at hunion + have h3 : (A ∪ A ∪ A).edgeSet = G.edgeSet := by + simp [hA_eq] + exact theorem_2_3_proof h𝒯 (by omega) hAB hAB hAB h3 + +/-- If `γ(G) = 0` and `V(G) ≠ ∅`, then `θ(G) = 1` +(Graph Minors X, Section 4, proof of (4.3), page 165). -/ +theorem tangleNumber_eq_one_of_maxEdgeSize_eq_zero {G : Hypergraph α β} + (hγ : maxEdgeSize G = 0) (hV : G.vertexSet.Nonempty) : + tangleNumber G = 1 := by + have hle := tangleNumber_le_one_of_maxEdgeSize_eq_zero hγ + obtain ⟨θ, 𝒯, h𝒯⟩ := (theorem_2_5_proof G).2 hV + have hge : 1 ≤ tangleNumber G := h𝒯.one_le.trans h𝒯.le_tangleNumber + omega + +/-- `θ(G) = 0` if and only if `V(G) = ∅` (from `(2.5)`). -/ +theorem tangleNumber_eq_zero_iff {G : Hypergraph α β} : + tangleNumber G = 0 ↔ G.vertexSet = ∅ := by + rw [← Set.not_nonempty_iff_eq_empty, ← theorem_2_5_proof] + constructor + · rintro h0 ⟨θ, 𝒯, h𝒯⟩ + have h1 := h𝒯.one_le + have h2 := h𝒯.le_tangleNumber + omega + · intro hne + by_contra! hpos + obtain ⟨𝒯, h𝒯⟩ := exists_isTangle_of_le_tangleNumber le_rfl (Nat.one_le_iff_ne_zero.2 hpos) + exact hne ⟨1, 𝒯, h𝒯⟩ + +/-! ## The edge-boundary connectivity function for (4.3) -/ + +/-- The vertex boundary `∂(X)` of an edge subset `X ⊆ E(G)`: vertices of `G` incident both with an +edge in `X` and with an edge in `E(G) \ X` +(Graph Minors X, Section 4, proof of (4.3), page 165). -/ +abbrev branchEdgeBoundary (G : Hypergraph α β) (X : Set β) : Set α := G.edgeBoundary X + +/-- `κ₀(X) = |∂(X)|`, the number of vertices of `G` incident with both `X` and `E(G) \ X` +(Graph Minors X, Section 4, proof of (4.3), page 165). -/ +@[expose] noncomputable def kappa0 (G : Hypergraph α β) (X : Set β) : ℤ := + ((branchEdgeBoundary G X).ncard : ℤ) + +/-- `κ(X) = κ₀(X) - k` on `E(G)` (Graph Minors X, Section 4, proof of (4.3), page 165). -/ +@[expose] noncomputable def edgeConnFunc (G : Hypergraph α β) (k : ℕ) (X : Set β) : ℤ := + kappa0 G X - (k : ℤ) + +/-- `𝒜 = {{e} : e ∈ E(G)}` (Graph Minors X, Section 4, proof of (4.3), page 165). -/ +@[expose] def singletonEdges (G : Hypergraph α β) : Set (Set β) := + (fun e : β ↦ ({e} : Set β)) '' G.edgeSet + +theorem branchEdgeBoundary_finite (G : Hypergraph α β) (X : Set β) : + (branchEdgeBoundary G X).Finite := + G.vertexSet_finite.subset fun _ h ↦ h.1 + +theorem branchEdgeBoundary_compl {G : Hypergraph α β} {X : Set β} (hX : X ⊆ G.edgeSet) : + branchEdgeBoundary G (G.edgeSet \ X) = branchEdgeBoundary G X := by + ext v + simp only [branchEdgeBoundary, Set.mem_sep_iff, Set.sdiff_sdiff_right_self, Set.inter_eq_right.2 + hX] + exact and_congr_right fun _ ↦ and_comm + +theorem branchEdgeBoundary_empty (G : Hypergraph α β) : + branchEdgeBoundary G ∅ = ∅ := by + ext v + simp [branchEdgeBoundary] + +theorem branchEdgeBoundary_self (G : Hypergraph α β) : + branchEdgeBoundary G G.edgeSet = ∅ := by + ext v + simp [branchEdgeBoundary] + +/-- `edgeConnFunc G k` is a connectivity function on `G.edgeSet` +(Graph Minors X, Section 4, proof of (4.3), page 165). -/ +theorem isConnectivityFunction_edgeConnFunc (G : Hypergraph α β) (k : ℕ) : + IsConnectivityFunction G.edgeSet (edgeConnFunc G k) where + compl_eq {X} hX := by + simp only [edgeConnFunc, kappa0, branchEdgeBoundary_compl hX] + submodular {X Y} _ _ := by + have hsub_union : + branchEdgeBoundary G (X ∪ Y) ⊆ branchEdgeBoundary G X ∪ branchEdgeBoundary G Y := by + rintro v ⟨hv, ⟨e₁, he₁, hinc₁⟩, ⟨e₂, ⟨he₂G, he₂XY⟩, hinc₂⟩⟩ + rcases he₁ with he₁X | he₁Y + · exact Or.inl ⟨hv, ⟨e₁, he₁X, hinc₁⟩, ⟨e₂, ⟨he₂G, fun h ↦ he₂XY (Or.inl h)⟩, hinc₂⟩⟩ + · exact Or.inr ⟨hv, ⟨e₁, he₁Y, hinc₁⟩, ⟨e₂, ⟨he₂G, fun h ↦ he₂XY (Or.inr h)⟩, hinc₂⟩⟩ + have hsub_inter : + branchEdgeBoundary G (X ∩ Y) ⊆ branchEdgeBoundary G X ∪ branchEdgeBoundary G Y := by + rintro v ⟨hv, ⟨e₁, ⟨he₁X, he₁Y⟩, hinc₁⟩, ⟨e₂, ⟨he₂G, he₂XY⟩, hinc₂⟩⟩ + by_cases he₂X : e₂ ∈ X + · have he₂Y : e₂ ∉ Y := fun h ↦ he₂XY ⟨he₂X, h⟩ + exact Or.inr ⟨hv, ⟨e₁, he₁Y, hinc₁⟩, ⟨e₂, ⟨he₂G, he₂Y⟩, hinc₂⟩⟩ + · exact Or.inl ⟨hv, ⟨e₁, he₁X, hinc₁⟩, ⟨e₂, ⟨he₂G, he₂X⟩, hinc₂⟩⟩ + have hsub_both : branchEdgeBoundary G (X ∪ Y) ∩ branchEdgeBoundary G (X ∩ Y) ⊆ + branchEdgeBoundary G X ∩ branchEdgeBoundary G Y := by + rintro v ⟨⟨hv, _, ⟨e₂, ⟨he₂G, he₂XY⟩, hinc₂⟩⟩, ⟨_, ⟨e₁, ⟨he₁X, he₁Y⟩, hinc₁⟩, _⟩⟩ + refine ⟨⟨hv, ⟨e₁, he₁X, hinc₁⟩, ⟨e₂, ⟨he₂G, fun h ↦ he₂XY (Or.inl h)⟩, hinc₂⟩⟩, + ⟨hv, ⟨e₁, he₁Y, hinc₁⟩, ⟨e₂, ⟨he₂G, fun h ↦ he₂XY (Or.inr h)⟩, hinc₂⟩⟩⟩ + have h1 : (branchEdgeBoundary G (X ∪ Y) ∪ branchEdgeBoundary G (X ∩ Y)).ncard ≤ + (branchEdgeBoundary G X ∪ branchEdgeBoundary G Y).ncard := + Set.ncard_le_ncard (Set.union_subset hsub_union hsub_inter) + ((branchEdgeBoundary_finite G X).union (branchEdgeBoundary_finite G Y)) + have h2 : (branchEdgeBoundary G (X ∪ Y) ∩ branchEdgeBoundary G (X ∩ Y)).ncard ≤ + (branchEdgeBoundary G X ∩ branchEdgeBoundary G Y).ncard := + Set.ncard_le_ncard hsub_both ((branchEdgeBoundary_finite G X).inter_of_left _) + have heq1 := + Set.ncard_union_add_ncard_inter (branchEdgeBoundary G (X ∪ Y)) (branchEdgeBoundary G (X ∩ Y)) + (branchEdgeBoundary_finite G (X ∪ Y)) (branchEdgeBoundary_finite G (X ∩ Y)) + have heq2 := Set.ncard_union_add_ncard_inter (branchEdgeBoundary G X) (branchEdgeBoundary G Y) + (branchEdgeBoundary_finite G X) (branchEdgeBoundary_finite G Y) + dsimp [edgeConnFunc, kappa0] + omega + +/-- When `maxEdgeSize G ≤ k`, every singleton `{e}` (`e ∈ E(G)`) is efficient for `edgeConnFunc G k` +(Graph Minors X, Section 4, proof of (4.3), page 165). -/ +theorem singletonEdges_isEfficient {G : Hypergraph α β} {k : ℕ} (hk : maxEdgeSize G ≤ k) : + ∀ A ∈ singletonEdges G, IsEfficient G.edgeSet (edgeConnFunc G k) A := by + rintro _ ⟨e, he, rfl⟩ + refine ⟨Set.singleton_subset_iff.2 he, ?_⟩ + have hsub : branchEdgeBoundary G {e} ⊆ G.ends e := by + rintro v ⟨_, ⟨e', he', hinc⟩, _⟩ + rw [Set.mem_singleton_iff] at he' + exact he' ▸ hinc + have hle : (branchEdgeBoundary G {e}).ncard ≤ edgeSize G e := + Set.ncard_le_ncard hsub (ends_finite G e) + have hle_k : edgeSize G e ≤ k := (edgeSize_le_maxEdgeSize he).trans hk + dsimp [edgeConnFunc, kappa0] + omega + +/-- Canonical left subhypergraph for an edge subset `X ⊆ E(G)`, containing all isolated vertices of +`G`. -/ +@[expose] def sepLeft (G : Hypergraph α β) (X : Set β) : Hypergraph α β where + vertexSet := {v ∈ G.vertexSet | (∃ e ∈ X ∩ G.edgeSet, G.Inc e v) ∨ ∀ e ∈ G.edgeSet, ¬ G.Inc e v} + edgeSet := X ∩ G.edgeSet + Inc e v := e ∈ X ∧ G.Inc e v + vertex_mem_of_inc e _ h := + ⟨G.vertex_mem_of_inc h.2, Or.inl ⟨e, ⟨h.1, G.edge_mem_of_inc h.2⟩, h.2⟩⟩ + edge_mem_of_inc _ _ h := ⟨h.1, G.edge_mem_of_inc h.2⟩ + vertexSet_finite := G.vertexSet_finite.subset fun _ h ↦ h.1 + edgeSet_finite := G.edgeSet_finite.subset Set.inter_subset_right + +/-- Canonical right subhypergraph for an edge subset `X ⊆ E(G)`. -/ +@[expose] def sepRight (G : Hypergraph α β) (X : Set β) : Hypergraph α β where + vertexSet := {v ∈ G.vertexSet | ∃ e ∈ G.edgeSet \ X, G.Inc e v} + edgeSet := G.edgeSet \ X + Inc e v := e ∈ G.edgeSet \ X ∧ G.Inc e v + vertex_mem_of_inc e _ h := ⟨G.vertex_mem_of_inc h.2, e, h.1, h.2⟩ + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := G.vertexSet_finite.subset fun _ h ↦ h.1 + edgeSet_finite := G.edgeSet_finite.subset Set.sdiff_subset + +theorem sepLeft_le (G : Hypergraph α β) (X : Set β) : sepLeft G X ≤ G where + vertexSet_subset _ h := h.1 + edgeSet_subset := Set.inter_subset_right + ends_eq e he := by + ext v + simp [ends, sepLeft, he.1] + +theorem sepRight_le (G : Hypergraph α β) (X : Set β) : sepRight G X ≤ G where + vertexSet_subset _ h := h.1 + edgeSet_subset := Set.sdiff_subset + ends_eq e he := by + ext v + simp [ends, sepRight, he.1, he.2] + +theorem isSeparation_sepLeft_sepRight (G : Hypergraph α β) (X : Set β) : + G.IsSeparation (sepLeft G X) (sepRight G X) := by + rw [isSeparation_iff_of_le (sepLeft_le G X) (sepRight_le G X)] + refine ⟨?_, ?_, ?_⟩ + · ext v + simp only [sepLeft, sepRight, Set.mem_union, Set.mem_sep_iff] + constructor + · rintro (⟨hv, _⟩ | ⟨hv, _⟩) <;> exact hv + · intro hv + by_cases hex : ∃ e ∈ G.edgeSet, G.Inc e v + · obtain ⟨e, heG, hinc⟩ := hex + by_cases heX : e ∈ X + · exact Or.inl ⟨hv, Or.inl ⟨e, ⟨heX, heG⟩, hinc⟩⟩ + · exact Or.inr ⟨hv, e, ⟨heG, heX⟩, hinc⟩ + · push Not at hex + exact Or.inl ⟨hv, Or.inr hex⟩ + · ext e + simp only [sepLeft, sepRight, Set.mem_union, Set.mem_inter_iff, Set.mem_sdiff] + tauto + · ext e + change e ∈ (X ∩ G.edgeSet) ∩ (G.edgeSet \ X) ↔ e ∈ (∅ : Set β) + simp only [Set.mem_inter_iff, Set.mem_sdiff, Set.mem_empty_iff_false, iff_false] + tauto + +theorem separationOrder_sepLeft_sepRight (G : Hypergraph α β) {X : Set β} + (hX : X ⊆ G.edgeSet) : + separationOrder (sepLeft G X) (sepRight G X) = (branchEdgeBoundary G X).ncard := by + rw [separationOrder] + congr 1 + ext v + change v ∈ (sepLeft G X).vertexSet ∧ v ∈ (sepRight G X).vertexSet ↔ v ∈ branchEdgeBoundary G X + simp only [sepLeft, sepRight, branchEdgeBoundary, Set.mem_sep_iff, + Set.inter_eq_self_of_subset_left hX] + constructor + · rintro ⟨⟨hv, h1 | hiso⟩, ⟨_, e₂, he₂, hinc₂⟩⟩ + · exact ⟨hv, h1, e₂, he₂, hinc₂⟩ + · exact (hiso e₂ he₂.1 hinc₂).elim + · rintro ⟨hv, h1, h2⟩ + exact ⟨⟨hv, Or.inl h1⟩, ⟨hv, h2⟩⟩ + +theorem branchEdgeBoundary_subset_of_isSeparation {G A B : Hypergraph α β} + (hsep : G.IsSeparation A B) : + branchEdgeBoundary G A.edgeSet ⊆ (A ∩ B).vertexSet := by + rintro v ⟨_, ⟨e₁, he₁A, hinc₁⟩, ⟨e₂, ⟨he₂G, he₂notA⟩, hinc₂⟩⟩ + have he₂B : e₂ ∈ B.edgeSet := + (hsep.edgeSet_union.symm ▸ he₂G).resolve_left he₂notA + have hvA : v ∈ A.vertexSet := + A.vertex_mem_of_inc ((inc_iff_of_le hsep.left_le he₁A).2 hinc₁) + have hvB : v ∈ B.vertexSet := + B.vertex_mem_of_inc ((inc_iff_of_le hsep.right_le he₂B).2 hinc₂) + exact ⟨hvA, hvB⟩ + +theorem isEfficient_edgeSet_of_isSeparation {G A B : Hypergraph α β} {k : ℕ} + (hsep : G.IsSeparation A B) (hord : separationOrder A B < k + 1) : + IsEfficient G.edgeSet (edgeConnFunc G k) A.edgeSet := by + refine ⟨hsep.left_le.edgeSet_subset, ?_⟩ + have hle : (branchEdgeBoundary G A.edgeSet).ncard ≤ separationOrder A B := + Set.ncard_le_ncard (branchEdgeBoundary_subset_of_isSeparation hsep) (A ∩ B).vertexSet_finite + dsimp [edgeConnFunc, kappa0] + omega + +/-! ## Proof of (4.3) -/ + +/-- Claim (1) in the proof of **Graph Minors X, (4.3)** (page 165): +When `1 ≤ γ(G) ≤ k`, there is a bias extending `𝒜 = {{e} : e ∈ E(G)}` for `κ(X) = |∂(X)| - k` +if and only if `G` has a tangle of order `k + 1`. -/ +theorem theorem_4_3_claim_1 {G : Hypergraph α β} {k : ℕ} + (hγ : 1 ≤ maxEdgeSize G) (hk : maxEdgeSize G ≤ k) : + (∃ ℬ, BiasExtends G.edgeSet (edgeConnFunc G k) (singletonEdges G) ℬ) ↔ + ∃ 𝒯, IsTangle G (k + 1) 𝒯 := by + constructor + · rintro ⟨ℬ, hbias, hsub⟩ + let 𝒯 : Set (Hypergraph α β × Hypergraph α β) := + {p | G.IsSeparation p.1 p.2 ∧ separationOrder p.1 p.2 < k + 1 ∧ p.1.edgeSet ∈ ℬ} + refine ⟨𝒯, (theorem_2_7_proof (𝒯 := 𝒯) (θ := k + 1) (by omega) + (fun _ _ h ↦ h.1) (fun _ _ h ↦ h.2.1) ?_ ?_).2 ?_⟩ + · intro A B hsep hord + have heffA : IsEfficient G.edgeSet (edgeConnFunc G k) A.edgeSet := + isEfficient_edgeSet_of_isSeparation hsep hord + rcases hbias.mem_or_compl_mem heffA with hA | hcompl + · exact Or.inl ⟨hsep, hord, hA⟩ + · have hB_eq : B.edgeSet = G.edgeSet \ A.edgeSet := by + ext e + simp only [Set.mem_sdiff] + exact ⟨fun heB ↦ ⟨hsep.right_le.edgeSet_subset heB, hsep.notMem_edgeSet_left heB⟩, + fun ⟨heG, henotA⟩ ↦ (hsep.edgeSet_union.symm ▸ heG).resolve_left henotA⟩ + rw [← hB_eq] at hcompl + exact Or.inr ⟨hsep.symm, by rwa [separationOrder_comm], hcompl⟩ + · intro A₁ B₁ A₂ B₂ A₃ B₃ h1 h2 h3 hU + have hE : A₁.edgeSet ∪ A₂.edgeSet ∪ A₃.edgeSet = G.edgeSet := + congrArg Hypergraph.edgeSet hU + exact hbias.union_ne h1.2.2 h2.2.2 h3.2.2 hE + · intro e he hsize + refine ⟨isSeparation_edgeHypergraph_deleteEdges he, ?_, ?_⟩ + · rwa [separationOrder_edgeHypergraph_deleteEdges] + · exact hsub ⟨e, he, rfl⟩ + · rintro ⟨𝒯, h𝒯⟩ + let ℬ : Set (Set β) := {X | ∃ A B, (A, B) ∈ 𝒯 ∧ A.edgeSet = X} + refine ⟨ℬ, ⟨?_, ?_, ?_⟩, ?_⟩ + · rintro X ⟨A, B, hAB, rfl⟩ + exact isEfficient_edgeSet_of_isSeparation (h𝒯.isSeparation hAB) (h𝒯.order_lt hAB) + · intro X hX + have hsep := isSeparation_sepLeft_sepRight G X + have hord : separationOrder (sepLeft G X) (sepRight G X) < k + 1 := by + rw [separationOrder_sepLeft_sepRight G hX.1] + have hle := hX.2 + dsimp [edgeConnFunc, kappa0] at hle + omega + rcases h𝒯.axiom1 hsep hord with h1 | h2 + · left + exact ⟨sepLeft G X, sepRight G X, h1, Set.inter_eq_self_of_subset_left hX.1⟩ + · right + exact ⟨sepRight G X, sepLeft G X, h2, rfl⟩ + · rintro X₁ X₂ X₃ ⟨A₁, B₁, h1, rfl⟩ ⟨A₂, B₂, h2, rfl⟩ ⟨A₃, B₃, h3, rfl⟩ + exact theorem_2_3_proof h𝒯 (by omega) h1 h2 h3 + · rintro _ ⟨e, he, rfl⟩ + have hsize : edgeSize G e < k + 1 := by + have := (edgeSize_le_maxEdgeSize he).trans hk + omega + have hmem := (theorem_2_7_proof (by omega) (fun _ _ h ↦ h𝒯.isSeparation h) + (fun _ _ h ↦ h𝒯.order_lt h) h𝒯.axiom1 h𝒯.axiom2).1 h𝒯 e he hsize + exact ⟨edgeHypergraph G e, G.deleteEdges {e}, hmem, rfl⟩ + +/-- When `2 ≤ |E(G)|` and all `singletonEdges G` are efficient for `edgeConnFunc G k`, any exact +tree-labelling over `singletonEdges G` yields a branch-decomposition of `G` of width `≤ k` +(Graph Minors X, Section 4, proof of (4.3), page 166). -/ +theorem exists_branchDecomposition_of_exactTreeLabelling_of_isEfficient [Fintype ι] + {G : Hypergraph α β} {k : ℕ} + (h𝒜 : ∀ A ∈ singletonEdges G, IsEfficient G.edgeSet (edgeConnFunc G k) A) + (hcard : 2 ≤ G.edgeSet.ncard) {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} + (hα : IsExactTreeLabelling G.edgeSet (edgeConnFunc G k) (singletonEdges G) T α) : + ∃ (ι' : Type) (_ : Fintype ι') (T' : SimpleGraph ι') (τ : ι' → β), + IsBranchDecomposition G T' τ ∧ branchDecompWidth G T' τ ≤ k := by + classical + have hE_ne_empty : G.edgeSet ≠ ∅ := by + intro h + have : G.edgeSet.ncard = 0 := by simp [h] + omega + have hE_not_mem : G.edgeSet ∉ singletonEdges G := by + rintro ⟨e, _, heq⟩ + have : G.edgeSet.ncard = 1 := by rw [← heq, Set.ncard_singleton] + omega + rcases theorem_3_6_proof h𝒜 hα with h1 | h2 | ⟨ι', _, T', α', hα', hneE⟩ + · exact (hE_ne_empty h1).elim + · exact (hE_not_mem h2).elim + · have hT' := hα'.isTreeLabelling.isTernaryTree + have hleaf_singleton : ∀ v ∈ leafSet T', ∃ f ∈ G.edgeSet, + ∀ e, IsTreeIncidence T' v e → G.edgeSet \ α' v e = {f} := by + intro v hv + obtain ⟨w, hadj, hw_uniq⟩ := hT'.exists_adj_of_isLeaf hv + have hinc : IsTreeIncidence T' v s(v, w) := isTreeIncidence_iff_adj.2 hadj + rcases hα'.isTreeLabelling.leaf_eq_or_union_eq hinc hv with heq | ⟨A, ⟨f, hf, rfl⟩, hunion⟩ + · exact (hneE v s(v, w) hinc hv heq).elim + · refine ⟨f, hf, fun e he ↦ ?_⟩ + obtain ⟨w', hadj', rfl⟩ := isTreeIncidence_iff_exists_adj.1 he + have hw' : w' = w := hw_uniq w' hadj' + rw [hw'] + have hnot_mem : f ∉ α' v s(v, w) := by + intro hf_in + apply hneE v s(v, w) hinc hv + rw [← hunion, Set.union_eq_left.2 (Set.singleton_subset_iff.2 hf_in)] + ext x + simp only [Set.mem_sdiff, Set.mem_singleton_iff] + constructor + · rintro ⟨hxE, hx_not⟩ + have hx_u : x ∈ α' v s(v, w) ∪ {f} := hunion.symm ▸ hxE + exact Set.mem_singleton_iff.1 (hx_u.resolve_left hx_not) + · rintro rfl + exact ⟨hf, hnot_mem⟩ + obtain ⟨e_def, _⟩ : G.edgeSet.Nonempty := Set.nonempty_iff_ne_empty.2 hE_ne_empty + let τ (v : ι') : β := + if hv : v ∈ leafSet T' then (hleaf_singleton v hv).choose else e_def + have hτ_mem : ∀ v ∈ leafSet T', τ v ∈ G.edgeSet := by + intro v hv + simp only [τ, hv, ↓reduceDIte] + exact (hleaf_singleton v hv).choose_spec.1 + have hτ_compl : ∀ v ∈ leafSet T', ∀ e, IsTreeIncidence T' v e → + G.edgeSet \ α' v e = {τ v} := by + intro v hv e he + simp only [τ, hv, ↓reduceDIte] + exact (hleaf_singleton v hv).choose_spec.2 e he + have hcomp_img : ∀ u w : ι', T'.Adj u w → + G.edgeSet \ α' u s(u, w) = τ '' (leafSet T' ∩ treeComponent T' u s(u, w)) := by + intro u w hadj + obtain ⟨_, hunion⟩ := theorem_3_3_proof hα' (isTreeIncidence_iff_adj.2 hadj) + rw [← hunion] + ext x + simp only [Set.mem_iUnion, Set.mem_image, Set.mem_inter_iff, exists_prop, Prod.exists] + constructor + · rintro ⟨v, e, ⟨hve, hv_leaf, hv_comp⟩, hx⟩ + rw [hτ_compl v hv_leaf e hve, Set.mem_singleton_iff] at hx + exact ⟨v, ⟨hv_leaf, hv_comp⟩, hx.symm⟩ + · rintro ⟨v, ⟨hv_leaf, hv_comp⟩, rfl⟩ + obtain ⟨z, hadj_z, _⟩ := hT'.exists_adj_of_isLeaf hv_leaf + have hve : IsTreeIncidence T' v s(v, z) := isTreeIncidence_iff_adj.2 hadj_z + refine ⟨v, s(v, z), ⟨hve, hv_leaf, hv_comp⟩, ?_⟩ + rw [hτ_compl v hv_leaf s(v, z) hve] + exact Set.mem_singleton (τ v) + have hcomp_label : ∀ u w : ι', T'.Adj u w → + α' u s(u, w) = τ '' (leafSet T' ∩ treeComponent T' w s(w, u)) := by + intro u w hadj + have h1 : G.edgeSet \ α' w s(w, u) = α' u s(u, w) := by + rw [Sym2.eq_swap, ← hα'.isTreeLabelling.compl_eq hadj] + rw [← h1, hcomp_img w u hadj.symm] + -- Show `Set.BijOn τ (leafSet T') G.edgeSet`. + obtain ⟨u₀⟩ := hT'.isTree.connected.nonempty + have hex_adj₀ : ∃ w₀, T'.Adj u₀ w₀ := by + by_cases hleaf₀ : IsLeaf T' u₀ + · obtain ⟨w₀, hw₀, _⟩ := hT'.exists_adj_of_isLeaf hleaf₀ + exact ⟨w₀, hw₀⟩ + · obtain ⟨w₀, _, _, _, _, _, hiff⟩ := hT'.exists_three_adj_of_not_isLeaf hleaf₀ + exact ⟨w₀, (hiff w₀).2 (Or.inl rfl)⟩ + obtain ⟨w₀, hadj₀⟩ := hex_adj₀ + have hbij : Set.BijOn τ (leafSet T') G.edgeSet := by + refine ⟨hτ_mem, ?_, ?_⟩ + · intro v₁ hv₁ v₂ hv₂ hτ_eq + obtain ⟨z₁, hadj₁, _⟩ := hT'.exists_adj_of_isLeaf hv₁ + obtain ⟨z₂, hadj₂, _⟩ := hT'.exists_adj_of_isLeaf hv₂ + have hinc₁ : IsTreeIncidence T' v₁ s(v₁, z₁) := isTreeIncidence_iff_adj.2 hadj₁ + have hinc₂ : IsTreeIncidence T' v₂ s(v₂, z₂) := isTreeIncidence_iff_adj.2 hadj₂ + have hnot_disj : ¬ Disjoint (G.edgeSet \ α' v₁ s(v₁, z₁)) (G.edgeSet \ α' v₂ s(v₂, z₂)) + := by + rw [hτ_compl v₁ hv₁ _ hinc₁, hτ_compl v₂ hv₂ _ hinc₂, hτ_eq, Set.disjoint_singleton] + exact not_ne_iff.2 rfl + by_cases hv₁_c : v₁ ∈ treeComponent T' u₀ s(u₀, w₀) + · by_cases hv₂_c : v₂ ∈ treeComponent T' u₀ s(u₀, w₀) + · obtain ⟨hdisj, _⟩ := theorem_3_3_proof hα' (isTreeIncidence_iff_adj.2 hadj₀) + have hm₁ : (v₁, s(v₁, z₁)) ∈ leafIncidencesIn T' u₀ s(u₀, w₀) := ⟨hinc₁, hv₁, hv₁_c⟩ + have hm₂ : (v₂, s(v₂, z₂)) ∈ leafIncidencesIn T' u₀ s(u₀, w₀) := ⟨hinc₂, hv₂, hv₂_c⟩ + by_contra hne + exact hnot_disj (hdisj hm₁ hm₂ (fun h ↦ hne (Prod.mk.inj h).1)) + · have hv₂_w : v₂ ∈ treeComponent T' w₀ s(w₀, u₀) := + (notMem_treeComponent_iff hT'.isTree hadj₀).1 hv₂_c + have h1 : τ v₁ ∈ G.edgeSet \ α' u₀ s(u₀, w₀) := by + rw [hcomp_img u₀ w₀ hadj₀] + exact ⟨v₁, ⟨hv₁, hv₁_c⟩, rfl⟩ + have h2 : τ v₁ ∈ α' u₀ s(u₀, w₀) := by + rw [hτ_eq, hcomp_label u₀ w₀ hadj₀] + exact ⟨v₂, ⟨hv₂, hv₂_w⟩, rfl⟩ + exact (h1.2 h2).elim + · have hv₁_w : v₁ ∈ treeComponent T' w₀ s(w₀, u₀) := + (notMem_treeComponent_iff hT'.isTree hadj₀).1 hv₁_c + by_cases hv₂_c : v₂ ∈ treeComponent T' u₀ s(u₀, w₀) + · have h1 : τ v₂ ∈ G.edgeSet \ α' u₀ s(u₀, w₀) := by + rw [hcomp_img u₀ w₀ hadj₀] + exact ⟨v₂, ⟨hv₂, hv₂_c⟩, rfl⟩ + have h2 : τ v₂ ∈ α' u₀ s(u₀, w₀) := by + rw [← hτ_eq, hcomp_label u₀ w₀ hadj₀] + exact ⟨v₁, ⟨hv₁, hv₁_w⟩, rfl⟩ + exact (h1.2 h2).elim + · have hv₂_w : v₂ ∈ treeComponent T' w₀ s(w₀, u₀) := + (notMem_treeComponent_iff hT'.isTree hadj₀).1 hv₂_c + obtain ⟨hdisj, _⟩ := theorem_3_3_proof hα' (isTreeIncidence_iff_adj.2 hadj₀.symm) + have hm₁ : (v₁, s(v₁, z₁)) ∈ leafIncidencesIn T' w₀ s(w₀, u₀) := ⟨hinc₁, hv₁, hv₁_w⟩ + have hm₂ : (v₂, s(v₂, z₂)) ∈ leafIncidencesIn T' w₀ s(w₀, u₀) := ⟨hinc₂, hv₂, hv₂_w⟩ + by_contra hne + exact hnot_disj (hdisj hm₁ hm₂ (fun h ↦ hne (Prod.mk.inj h).1)) + · intro x hx + by_cases hx_in : x ∈ α' u₀ s(u₀, w₀) + · rw [hcomp_label u₀ w₀ hadj₀] at hx_in + obtain ⟨v, ⟨hv, _⟩, rfl⟩ := hx_in + exact ⟨v, hv, rfl⟩ + · have hx_compl : x ∈ G.edgeSet \ α' u₀ s(u₀, w₀) := ⟨hx, hx_in⟩ + rw [hcomp_img u₀ w₀ hadj₀] at hx_compl + obtain ⟨v, ⟨hv, _⟩, rfl⟩ := hx_compl + exact ⟨v, hv, rfl⟩ + refine ⟨ι', inferInstance, T', τ, ⟨hT', hbij⟩, ?_⟩ + rw [branchDecompWidth_le_iff] + intro e he + induction e using Sym2.ind with + | _ u w => + have hadj : T'.Adj u w := T'.mem_edgeSet.1 he + have hsub : {v ∈ G.vertexSet | ∃ t₁ ∈ leafSet T', ∃ t₂ ∈ leafSet T', + ¬ (T'.deleteEdges {s(u, w)}).Reachable t₁ t₂ ∧ G.Inc (τ t₁) v ∧ G.Inc (τ t₂) v} ⊆ + branchEdgeBoundary G (α' u s(u, w)) := by + rintro v ⟨hv, t₁, ht₁, t₂, ht₂, hnot_reach, hinc₁, hinc₂⟩ + rw [not_reachable_deleteEdges_iff_treeComponent hT'.isTree hadj] at hnot_reach + rcases hnot_reach with ⟨ht₁_c, ht₂_w⟩ | ⟨ht₁_w, ht₂_c⟩ + · have hτ₂ : τ t₂ ∈ α' u s(u, w) := by + rw [hcomp_label u w hadj] + exact ⟨t₂, ⟨ht₂, ht₂_w⟩, rfl⟩ + have hτ₁ : τ t₁ ∈ G.edgeSet \ α' u s(u, w) := by + rw [hcomp_img u w hadj] + exact ⟨t₁, ⟨ht₁, ht₁_c⟩, rfl⟩ + exact ⟨hv, ⟨τ t₂, hτ₂, hinc₂⟩, ⟨τ t₁, hτ₁, hinc₁⟩⟩ + · have hτ₁ : τ t₁ ∈ α' u s(u, w) := by + rw [hcomp_label u w hadj] + exact ⟨t₁, ⟨ht₁, ht₁_w⟩, rfl⟩ + have hτ₂ : τ t₂ ∈ G.edgeSet \ α' u s(u, w) := by + rw [hcomp_img u w hadj] + exact ⟨t₂, ⟨ht₂, ht₂_c⟩, rfl⟩ + exact ⟨hv, ⟨τ t₁, hτ₁, hinc₁⟩, ⟨τ t₂, hτ₂, hinc₂⟩⟩ + have hle_bd : branchEdgeOrder G T' τ s(u, w) ≤ (branchEdgeBoundary G (α' u s(u, w))).ncard := + Set.ncard_le_ncard hsub (branchEdgeBoundary_finite G _) + have heff := (hα'.isTreeLabelling.isEfficient (isTreeIncidence_iff_adj.2 hadj)).2 + dsimp [edgeConnFunc, kappa0] at heff + omega + +/-- Helper for (4.3) Claim (2): when `2 ≤ |E(G)|` and `maxEdgeSize G ≤ k`, any exact tree-labelling +over `singletonEdges G` yields a branch-decomposition of `G` of width `≤ k` +(Graph Minors X, Section 4, proof of (4.3), page 166). -/ +theorem exists_branchDecomposition_of_exactTreeLabelling [Fintype ι] + {G : Hypergraph α β} {k : ℕ} (hk : maxEdgeSize G ≤ k) + (hcard : 2 ≤ G.edgeSet.ncard) {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} + (hα : IsExactTreeLabelling G.edgeSet (edgeConnFunc G k) (singletonEdges G) T α) : + ∃ (ι' : Type) (_ : Fintype ι') (T' : SimpleGraph ι') (τ : ι' → β), + IsBranchDecomposition G T' τ ∧ branchDecompWidth G T' τ ≤ k := + exists_branchDecomposition_of_exactTreeLabelling_of_isEfficient + (singletonEdges_isEfficient hk) hcard hα + +/-- When `1 ≤ maxEdgeSize G` and `2 ≤ |E(G)|`, `G` has a branch-decomposition achieving width +`branchWidth G`. -/ +theorem exists_branchDecomposition_eq_branchWidth {G : Hypergraph α β} + (hγ : 1 ≤ maxEdgeSize G) (hcard : 2 ≤ G.edgeSet.ncard) : + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → β), + IsBranchDecomposition G T τ ∧ branchDecompWidth G T τ = branchWidth G := by + let k₀ := max G.vertexSet.ncard (maxEdgeSize G) + have hk₀ : maxEdgeSize G ≤ k₀ := le_max_right _ _ + have hno_tangle : ¬ ∃ 𝒯, IsTangle G (k₀ + 1) 𝒯 := by + rintro ⟨𝒯, h𝒯⟩ + have h1 := h𝒯.order_le_ncard_vertexSet + have h2 : G.vertexSet.ncard ≤ k₀ := le_max_left _ _ + omega + have hno_bias : ¬ ∃ ℬ, BiasExtends G.edgeSet (edgeConnFunc G k₀) (singletonEdges G) ℬ := + (theorem_4_3_claim_1 hγ hk₀).not.2 hno_tangle + obtain ⟨ι₀, _, T₀, α₀, hα₀⟩ := theorem_3_4_proof G.edgeSet_finite + (isConnectivityFunction_edgeConnFunc G k₀) (singletonEdges_isEfficient hk₀) hno_bias + obtain ⟨ι₁, _, T₁, τ₁, hbd₁, _⟩ := + exists_branchDecomposition_of_exactTreeLabelling hk₀ hcard hα₀ + have hne : {w : ℕ | ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → β), + IsBranchDecomposition G T τ ∧ branchDecompWidth G T τ = w}.Nonempty := + ⟨branchDecompWidth G T₁ τ₁, ι₁, inferInstance, T₁, τ₁, hbd₁, rfl⟩ + exact Nat.sInf_mem hne + +/-- Every branch-decomposition `(T, τ)` of `G` of width `≤ k` yields an exact tree-labelling over +`singletonEdges G` for `edgeConnFunc G k` +(Graph Minors X, Section 4, proof of (4.3), pages 165–166). -/ +theorem isExactTreeLabelling_of_isBranchDecomposition [Fintype ι] + {G : Hypergraph α β} {k : ℕ} {T : SimpleGraph ι} {τ : ι → β} + (hbd : IsBranchDecomposition G T τ) (hw : branchDecompWidth G T τ ≤ k) : + IsExactTreeLabelling G.edgeSet (edgeConnFunc G k) (singletonEdges G) T + (fun v e ↦ τ '' (leafSet T \ treeComponent T v e)) := by + classical + have hT := hbd.isTernaryTree + let α (v : ι) (e : Sym2 ι) : Set β := + τ '' (leafSet T \ treeComponent T v e) + change IsExactTreeLabelling G.edgeSet (edgeConnFunc G k) (singletonEdges G) T α + have hα_compl : ∀ u w : ι, T.Adj u w → + α w s(u, w) = τ '' (leafSet T ∩ treeComponent T u s(u, w)) := by + intro u w hadj + dsimp [α] + congr 1 + ext t + simp only [Set.mem_sdiff, Set.mem_inter_iff] + refine and_congr_right fun _ ↦ ?_ + have hiff := notMem_treeComponent_iff hT.isTree (x := t) hadj.symm + simpa [treeComponent, Sym2.eq_swap] using hiff + have hα_symm : ∀ u w : ι, T.Adj u w → + α u s(u, w) = G.edgeSet \ α w s(u, w) := by + intro u w hadj + rw [hα_compl u w hadj] + dsimp [α] + ext x + simp only [Set.mem_image, Set.mem_sdiff, Set.mem_inter_iff] + constructor + · rintro ⟨t, ⟨ht_leaf, ht_not⟩, rfl⟩ + refine ⟨hbd.bijOn.mapsTo ht_leaf, ?_⟩ + rintro ⟨t', ⟨ht'_leaf, ht'_c⟩, heq⟩ + have hteq : t' = t := hbd.bijOn.injOn ht'_leaf ht_leaf heq + exact ht_not (hteq ▸ ht'_c) + · rintro ⟨hxE, hnot⟩ + obtain ⟨t, ht_leaf, rfl⟩ := hbd.bijOn.surjOn hxE + refine ⟨t, ⟨ht_leaf, ?_⟩, rfl⟩ + intro ht_c + exact hnot ⟨t, ⟨ht_leaf, ht_c⟩, rfl⟩ + refine ⟨⟨hT, ?_, ?_, ?_, ?_⟩, ?_⟩ + · intro u e he + obtain ⟨w, hadj, rfl⟩ := isTreeIncidence_iff_exists_adj.1 he + have hsubE : α u s(u, w) ⊆ G.edgeSet := by + rintro _ ⟨t, ⟨ht, _⟩, rfl⟩ + exact hbd.bijOn.mapsTo ht + refine ⟨hsubE, ?_⟩ + have hbd_sub : branchEdgeBoundary G (α u s(u, w)) ⊆ + {v ∈ G.vertexSet | ∃ t₁ ∈ leafSet T, ∃ t₂ ∈ leafSet T, + ¬ (T.deleteEdges {s(u, w)}).Reachable t₁ t₂ ∧ G.Inc (τ t₁) v ∧ G.Inc (τ t₂) v} := by + rintro v ⟨hv, ⟨e₁, he₁, hinc₁⟩, ⟨e₂, he₂, hinc₂⟩⟩ + have he₂' : e₂ ∈ α w s(u, w) := by + rw [Sym2.eq_swap, hα_symm w u hadj.symm, Sym2.eq_swap] + exact he₂ + rw [hα_compl u w hadj] at he₂' + obtain ⟨t₁, ⟨ht₁_leaf, ht₁_not⟩, rfl⟩ := he₁ + obtain ⟨t₂, ⟨ht₂_leaf, ht₂_c⟩, rfl⟩ := he₂' + have ht₁_w : t₁ ∈ treeComponent T w s(w, u) := + (notMem_treeComponent_iff hT.isTree hadj).1 ht₁_not + refine ⟨hv, t₁, ht₁_leaf, t₂, ht₂_leaf, ?_, hinc₁, hinc₂⟩ + rw [not_reachable_deleteEdges_iff_treeComponent hT.isTree hadj] + exact Or.inr ⟨ht₁_w, ht₂_c⟩ + have hle_ord : (branchEdgeBoundary G (α u s(u, w))).ncard ≤ branchEdgeOrder G T τ s(u, w) := + Set.ncard_le_ncard hbd_sub (G.vertexSet_finite.subset fun _ h ↦ h.1) + have hle_k : branchEdgeOrder G T τ s(u, w) ≤ k := + (branchEdgeOrder_le_branchDecompWidth (T.mem_edgeSet.2 hadj)).trans hw + dsimp [edgeConnFunc, kappa0] + omega + · intro u w hadj + exact hα_symm u w hadj + · intro v e he hleaf + obtain ⟨w, hadj, rfl⟩ := isTreeIncidence_iff_exists_adj.1 he + right + refine ⟨{τ v}, ⟨τ v, hbd.bijOn.mapsTo hleaf, rfl⟩, ?_⟩ + have hcomp := treeComponent_eq_singleton_of_isLeaf hT hadj hleaf + dsimp [α] + rw [hcomp] + ext x + simp only [Set.mem_union, Set.mem_image, Set.mem_sdiff, Set.mem_singleton_iff] + constructor + · rintro (⟨t, ⟨ht, _⟩, rfl⟩ | rfl) + · exact hbd.bijOn.mapsTo ht + · exact hbd.bijOn.mapsTo hleaf + · intro hxE + obtain ⟨t, ht, rfl⟩ := hbd.bijOn.surjOn hxE + by_cases htv : t = v + · exact Or.inr (congrArg τ htv) + · exact Or.inl ⟨t, ⟨ht, htv⟩, rfl⟩ + · intro u f₁ f₂ f₃ hf₁ hf₂ hf₃ h12 h13 h23 + obtain ⟨w₁, hadj₁, rfl⟩ := isTreeIncidence_iff_exists_adj.1 hf₁ + obtain ⟨w₂, hadj₂, rfl⟩ := isTreeIncidence_iff_exists_adj.1 hf₂ + obtain ⟨w₃, hadj₃, rfl⟩ := isTreeIncidence_iff_exists_adj.1 hf₃ + have hw12 : w₁ ≠ w₂ := fun h ↦ h12 (by rw [h]) + have hw13 : w₁ ≠ w₃ := fun h ↦ h13 (by rw [h]) + have hw23 : w₂ ≠ w₃ := fun h ↦ h23 (by rw [h]) + have hu_not_leaf : ¬ IsLeaf T u := hT.not_isLeaf_of_isFork ⟨hf₁, hf₂, h12⟩ + have hiff : ∀ x, T.Adj u x ↔ x = w₁ ∨ x = w₂ ∨ x = w₃ := by + obtain ⟨z₁, z₂, hwz₁, hwz₂, hz12, hiff₀⟩ := hT.exists_other_two_adj hu_not_leaf hadj₁ + intro x + refine ⟨fun hx ↦ ?_, ?_⟩ + · by_contra! hnot + have hsub4 : ({w₁, w₂, w₃, x} : Finset ι) ⊆ T.neighborFinset u := by + intro y hy + simp only [Finset.mem_insert, Finset.mem_singleton] at hy + rw [mem_neighborFinset] + rcases hy with rfl | rfl | rfl | rfl <;> assumption + have hcard4 : ({w₁, w₂, w₃, x} : Finset ι).card = 4 := by + rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, + Finset.card_insert_of_notMem, Finset.card_singleton] <;> + simp [hw12, hw13, hw23, hnot.1.symm, hnot.2.1.symm, hnot.2.2.symm] + have hcard3 : (T.neighborFinset u).card = 3 := + hT.degree_eq_three_of_not_isLeaf hu_not_leaf + have := Finset.card_le_card hsub4 + omega + · rintro (rfl | rfl | rfl) <;> assumption + obtain ⟨hcomp_eq, _, _, _⟩ := + treeComponent_split_of_not_isLeaf hT hadj₁ hw12 hw13 hw23 hiff + ext x + simp only [Set.mem_union] + constructor + · rintro ((⟨t, ⟨ht, _⟩, rfl⟩ | ⟨t, ⟨ht, _⟩, rfl⟩) | ⟨t, ⟨ht, _⟩, rfl⟩) <;> + exact hbd.bijOn.mapsTo ht + · intro hxE + obtain ⟨t, ht_leaf, rfl⟩ := hbd.bijOn.surjOn hxE + by_cases ht₁ : t ∈ treeComponent T u s(u, w₁) + · rw [hcomp_eq] at ht₁ + rcases ht₁ with (rfl | ht₂) | ht₃ + · exact (hu_not_leaf ht_leaf).elim + · have ht_not₂ : t ∉ treeComponent T u s(u, w₂) := by + intro hm + exact (notMem_treeComponent_iff hT.isTree hadj₂).2 ht₂ hm + exact Or.inl (Or.inr ⟨t, ⟨ht_leaf, ht_not₂⟩, rfl⟩) + · have ht_not₃ : t ∉ treeComponent T u s(u, w₃) := by + intro hm + exact (notMem_treeComponent_iff hT.isTree hadj₃).2 ht₃ hm + exact Or.inr ⟨t, ⟨ht_leaf, ht_not₃⟩, rfl⟩ + · exact Or.inl (Or.inl ⟨t, ⟨ht_leaf, ht₁⟩, rfl⟩) + · intro u f₁ f₂ ⟨hf₁, hf₂, hne⟩ + obtain ⟨w₁, hadj₁, rfl⟩ := isTreeIncidence_iff_exists_adj.1 hf₁ + obtain ⟨w₂, hadj₂, rfl⟩ := isTreeIncidence_iff_exists_adj.1 hf₂ + have hw12 : w₁ ≠ w₂ := fun h ↦ hne (by rw [h]) + have hu_not_leaf : ¬ IsLeaf T u := hT.not_isLeaf_of_isFork ⟨hf₁, hf₂, hne⟩ + obtain ⟨z₁, z₂, hw₁z₁, hw₁z₂, hz12, hiff₁⟩ := hT.exists_other_two_adj hu_not_leaf hadj₁ + obtain ⟨hcomp_eq, _, _, _⟩ := + treeComponent_split_of_not_isLeaf hT hadj₁ hw₁z₁ hw₁z₂ hz12 hiff₁ + have hw₂_mem : w₂ = z₁ ∨ w₂ = z₂ := by + rcases (hiff₁ w₂).1 hadj₂ with h | h | h + · exact (hw12 h.symm).elim + · exact Or.inl h + · exact Or.inr h + have hsub_comp : treeComponent T w₂ s(w₂, u) ⊆ treeComponent T u s(u, w₁) := by + rw [hcomp_eq] + rcases hw₂_mem with rfl | rfl + · exact Set.subset_union_of_subset_left Set.subset_union_right _ + · exact Set.subset_union_right + ext x + simp only [Set.mem_inter_iff, Set.mem_empty_iff_false, iff_false] + rintro ⟨⟨t₁, ⟨ht₁_leaf, ht₁_not⟩, rfl⟩, ⟨t₂, ⟨ht₂_leaf, ht₂_not⟩, hτ_eq⟩⟩ + have hteq : t₁ = t₂ := hbd.bijOn.injOn ht₁_leaf ht₂_leaf hτ_eq.symm + subst hteq + have ht₁_w₂ : t₁ ∈ treeComponent T w₂ s(w₂, u) := + (notMem_treeComponent_iff hT.isTree hadj₂).1 ht₂_not + exact ht₁_not (hsub_comp ht₁_w₂) + +/-- Claim (2) in the proof of **Graph Minors X, (4.3)** (pages 165–166): +When `1 ≤ γ(G) ≤ k`, there is an exact tree-labelling over `𝒜 = {{e} : e ∈ E(G)}` for +`κ(X) = |∂(X)| - k` if and only if `β(G) ≤ k`. -/ +theorem theorem_4_3_claim_2 {G : Hypergraph α β} {k : ℕ} + (hγ : 1 ≤ maxEdgeSize G) (hk : maxEdgeSize G ≤ k) : + (∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (α : ι → Sym2 ι → Set β), + IsExactTreeLabelling G.edgeSet (edgeConnFunc G k) (singletonEdges G) T α) ↔ + branchWidth G ≤ k := by + classical + constructor + · rintro ⟨ι, _, T, α, hα⟩ + by_cases hcard : 2 ≤ G.edgeSet.ncard + · obtain ⟨ι', _, T', τ, hbd, hw⟩ := + exists_branchDecomposition_of_exactTreeLabelling hk hcard hα + have hmem : branchDecompWidth G T' τ ∈ + {w : ℕ | ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → β), + IsBranchDecomposition G T τ ∧ branchDecompWidth G T τ = w} := + ⟨ι', inferInstance, T', τ, hbd, rfl⟩ + exact (Nat.sInf_le hmem).trans hw + · rw [branchWidth_eq_zero_of_ncard_edgeSet_le_one (by omega)] + exact Nat.zero_le k + · intro hbw + by_cases hcard : 2 ≤ G.edgeSet.ncard + · obtain ⟨ι, _, T, τ, hbd, hw_eq⟩ := exists_branchDecomposition_eq_branchWidth hγ hcard + exact ⟨ι, inferInstance, T, _, + isExactTreeLabelling_of_isBranchDecomposition hbd (hw_eq.trans_le hbw)⟩ + · -- Case `G.edgeSet.ncard ≤ 1`: since `1 ≤ maxEdgeSize G`, `G.edgeSet` is a singleton, + -- so `G.edgeSet ∈ singletonEdges G` and no bias can extend `singletonEdges G`. + obtain ⟨⟨e₀, he₀⟩, _⟩ := nonempty_of_one_le_maxEdgeSize hγ + have hE_eq : G.edgeSet = {e₀} := + (Set.eq_of_subset_of_ncard_le (Set.singleton_subset_iff.2 he₀) + (by rw [Set.ncard_singleton]; omega) G.edgeSet_finite).symm + have hno_bias : ¬ ∃ ℬ, BiasExtends G.edgeSet (edgeConnFunc G k) (singletonEdges G) ℬ := by + rintro ⟨ℬ, hbias, hsub⟩ + have hmem : G.edgeSet ∈ ℬ := hsub ⟨e₀, he₀, hE_eq.symm⟩ + exact hbias.union_ne hmem hmem hmem (by simp) + exact theorem_3_4_proof G.edgeSet_finite (isConnectivityFunction_edgeConnFunc G k) + (singletonEdges_isEfficient hk) hno_bias + +/-- Claim (3) in the proof of **Graph Minors X, (4.3)** (page 166): +"For all $k \ge \gamma(G)$, $G$ has a tangle of order $k + 1$ if and only if $k < \beta(G)$." -/ +theorem theorem_4_3_claim_3 {G : Hypergraph α β} {k : ℕ} + (hγ : 1 ≤ maxEdgeSize G) (hk : maxEdgeSize G ≤ k) : + (∃ 𝒯, IsTangle G (k + 1) 𝒯) ↔ k < branchWidth G := by + have h35 := theorem_3_5_proof G.edgeSet_finite (isConnectivityFunction_edgeConnFunc G k) + (singletonEdges_isEfficient hk) + have hiff : (∃ ℬ, BiasExtends G.edgeSet (edgeConnFunc G k) (singletonEdges G) ℬ) ↔ + ¬ ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (α : ι → Sym2 ι → Set β), + IsExactTreeLabelling G.edgeSet (edgeConnFunc G k) (singletonEdges G) T α := by + rw [← not_iff_not, not_not, h35.1, h35.2] + rw [← theorem_4_3_claim_1 hγ hk, hiff, theorem_4_3_claim_2 hγ hk, not_le] + +/-- **Graph Minors X, (4.3)** (page 165): +"(4.3) *For any hypergraph $G$, $\max(\beta(G), \gamma(G)) = \theta(G)$ unless $\gamma(G) = 0$ and +$V(G) \ne \emptyset$.*" -/ +theorem theorem_4_3_proof (G : Hypergraph α β) + (h : ¬ (maxEdgeSize G = 0 ∧ G.vertexSet.Nonempty)) : + max (branchWidth G) (maxEdgeSize G) = tangleNumber G := by + by_cases hγ0 : maxEdgeSize G = 0 + · have hV : G.vertexSet = ∅ := + Set.not_nonempty_iff_eq_empty.1 fun hne ↦ h ⟨hγ0, hne⟩ + rw [hγ0, branchWidth_eq_zero_of_maxEdgeSize_eq_zero hγ0, tangleNumber_eq_zero_iff.2 hV, + max_self] + · have hγ1 : 1 ≤ maxEdgeSize G := Nat.one_le_iff_ne_zero.2 hγ0 + have hγ_le_θ : maxEdgeSize G ≤ tangleNumber G := maxEdgeSize_le_tangleNumber G + have hno_tangle_θ : ¬ ∃ 𝒯, IsTangle G (tangleNumber G + 1) 𝒯 := by + rintro ⟨𝒯, h𝒯⟩ + have := h𝒯.le_tangleNumber + omega + have hβ_le_θ : branchWidth G ≤ tangleNumber G := by + have := (theorem_4_3_claim_3 hγ1 hγ_le_θ).not.1 hno_tangle_θ + omega + have hmax_le : max (branchWidth G) (maxEdgeSize G) ≤ tangleNumber G := + max_le hβ_le_θ hγ_le_θ + by_cases hγ_eq : tangleNumber G ≤ maxEdgeSize G + · exact le_antisymm hmax_le (hγ_eq.trans (le_max_right _ _)) + · push Not at hγ_eq + have hk : maxEdgeSize G ≤ tangleNumber G - 1 := by omega + have h1 : 1 ≤ tangleNumber G := hγ1.trans hγ_le_θ + obtain ⟨𝒯, h𝒯⟩ := exists_isTangle_of_le_tangleNumber h1 le_rfl + have h𝒯' : IsTangle G ((tangleNumber G - 1) + 1) 𝒯 := by + rwa [Nat.sub_add_cancel h1] + have hlt : tangleNumber G - 1 < branchWidth G := + (theorem_4_3_claim_3 hγ1 hk).1 ⟨𝒯, h𝒯'⟩ + have hθ_le_β : tangleNumber G ≤ branchWidth G := by omega + exact le_antisymm hmax_le (hθ_le_β.trans (le_max_left _ _)) + +/-! ## Weakening the second tangle axiom: (4.5) -/ + +/-- Submodularity of separation order for two separations `(A₁, B₁)` and `(A₂, B₂)` of `G` +(Graph Minors X, Section 4, proof of (4.5), page 167): +"The sum of the orders of $(A_1 \cap B_2, B_1 \cup A_2)$ and $(A_1 \cup B_2, B_1 \cap A_2)$ +equals the sum of the orders of $(A_1, B_1)$ and $(A_2, B_2)$." -/ +theorem separationOrder_inter_union_add_union_inter {G A₁ B₁ A₂ B₂ : Hypergraph α β} + (h₁ : G.IsSeparation A₁ B₁) (h₂ : G.IsSeparation A₂ B₂) : + separationOrder (A₁ ∩ B₂) (B₁ ∪ A₂) + separationOrder (A₁ ∪ B₂) (B₁ ∩ A₂) = + separationOrder A₁ B₁ + separationOrder A₂ B₂ := by + let U₁ := ((A₁ ∩ B₂) ∩ (B₁ ∪ A₂)).vertexSet + let U₂ := ((A₁ ∪ B₂) ∩ (B₁ ∩ A₂)).vertexSet + let X := (A₁ ∩ B₁).vertexSet + let Y := (A₂ ∩ B₂).vertexSet + have hU_union : U₁ ∪ U₂ = X ∪ Y := by + ext v + have hvG_iff : v ∈ G.vertexSet ↔ + (v ∈ A₁.vertexSet ∨ v ∈ B₁.vertexSet) ∧ (v ∈ A₂.vertexSet ∨ v ∈ B₂.vertexSet) := by + rw [← Set.mem_union, h₁.vertexSet_union, ← Set.mem_union, h₂.vertexSet_union, and_self] + have h1 : v ∈ A₁.vertexSet → v ∈ G.vertexSet := fun h ↦ h₁.left_le.vertexSet_subset h + have h2 : v ∈ A₂.vertexSet → v ∈ G.vertexSet := fun h ↦ h₂.left_le.vertexSet_subset h + simp only [U₁, U₂, X, Y, inter_vertexSet, union_vertexSet, Set.mem_union, Set.mem_inter_iff] + constructor + · rintro (⟨⟨ha₁, hb₂⟩, hb₁ | ha₂⟩ | ⟨ha₁ | hb₂, hb₁, ha₂⟩) + · exact Or.inl ⟨ha₁, hb₁⟩ + · exact Or.inr ⟨ha₂, hb₂⟩ + · exact Or.inl ⟨ha₁, hb₁⟩ + · exact Or.inr ⟨ha₂, hb₂⟩ + · rintro (⟨ha₁, hb₁⟩ | ⟨ha₂, hb₂⟩) + · obtain ⟨_, ha₂ | hb₂⟩ := hvG_iff.1 (h1 ha₁) + · exact Or.inr ⟨Or.inl ha₁, hb₁, ha₂⟩ + · exact Or.inl ⟨⟨ha₁, hb₂⟩, Or.inl hb₁⟩ + · obtain ⟨ha₁ | hb₁, _⟩ := hvG_iff.1 (h2 ha₂) + · exact Or.inl ⟨⟨ha₁, hb₂⟩, Or.inr ha₂⟩ + · exact Or.inr ⟨Or.inr hb₂, hb₁, ha₂⟩ + have hU_inter : U₁ ∩ U₂ = X ∩ Y := by + ext v + simp only [U₁, U₂, X, Y, inter_vertexSet, union_vertexSet, Set.mem_inter_iff, Set.mem_union] + tauto + have hcard1 := Set.ncard_union_add_ncard_inter U₁ U₂ + (((A₁ ∩ B₂) ∩ (B₁ ∪ A₂)).vertexSet_finite) (((A₁ ∪ B₂) ∩ (B₁ ∩ A₂)).vertexSet_finite) + have hcard2 := Set.ncard_union_add_ncard_inter X Y + ((A₁ ∩ B₁).vertexSet_finite) ((A₂ ∩ B₂).vertexSet_finite) + rw [hU_union, hU_inter] at hcard1 + change U₁.ncard + U₂.ncard = X.ncard + Y.ncard + omega + +/-- Helper for `(4.5)`: if `(A₀, B₀) ∈ 𝒯`, `(X, Y)` is a separation of `G` of order `< θ`, and +`X ≤ A₀`, then `(X, Y) ∈ 𝒯` by the first tangle axiom and condition (i). -/ +private theorem mem_of_left_le {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (hax1 : TangleAxiom1 G θ 𝒯) + (hi : ∀ ⦃A₁ B₁ A₂ B₂ : Hypergraph α β⦄, (A₁, B₁) ∈ 𝒯 → (A₂, B₂) ∈ 𝒯 → ¬ B₁ ≤ A₂) + {A₀ B₀ X Y : Hypergraph α β} (h₀ : (A₀, B₀) ∈ 𝒯) + (hsep : G.IsSeparation X Y) (hord : separationOrder X Y < θ) (hle : X ≤ A₀) : + (X, Y) ∈ 𝒯 := by + rcases hax1 hsep hord with h | h + · exact h + · exact (hi h h₀ hle).elim + +/-- Claim (3) in the proof of **Graph Minors X, (4.5)** (page 167): +"For $1 \le i \le 3$, if $v \in V(A_i \cap B_i)$ then $v$ is incident with an edge of $B_i$; +and also with an edge of $A_i$, unless $v$ belongs to no other $A_j$ ($j \ne i$)." -/ +theorem theorem_4_5_claim_3 {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (hsep : ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ 𝒯 → G.IsSeparation A B) + (hord : ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ 𝒯 → separationOrder A B < θ) + (hax1 : TangleAxiom1 G θ 𝒯) + (hi : ∀ ⦃A₁ B₁ A₂ B₂ : Hypergraph α β⦄, (A₁, B₁) ∈ 𝒯 → (A₂, B₂) ∈ 𝒯 → ¬ B₁ ≤ A₂) + {A₁ B₁ A₂ A₃ : Hypergraph α β} (h₁ : (A₁, B₁) ∈ 𝒯) (hU : A₁ ∪ A₂ ∪ A₃ = G) + (hmin1 : ∀ ⦃A₁' B₁' : Hypergraph α β⦄, (A₁', B₁') ∈ 𝒯 → A₁' ∪ A₂ ∪ A₃ = G → + separationOrder A₁ B₁ ≤ separationOrder A₁' B₁') + {v : α} (hv : v ∈ (A₁ ∩ B₁).vertexSet) : + (∃ e ∈ B₁.edgeSet, B₁.Inc e v) ∧ + (v ∈ A₂.vertexSet ∪ A₃.vertexSet → ∃ e ∈ A₁.edgeSet, A₁.Inc e v) := by + have hsep₁ := hsep h₁ + refine ⟨?_, ?_⟩ + · by_contra! hisoB + have hEB_eq : (B₁.deleteVertices {v}).edgeSet = B₁.edgeSet := by + ext e + simp only [deleteVertices, Set.mem_sep_iff, Set.mem_singleton_iff, forall_eq, + and_iff_left_iff_imp] + exact hisoB e + have hsep' : G.IsSeparation A₁ (B₁.deleteVertices {v}) := by + rw [isSeparation_iff_of_le hsep₁.left_le ((deleteVertices_le B₁ {v}).trans hsep₁.right_le)] + refine ⟨?_, ?_, ?_⟩ + · ext x + simp only [deleteVertices, Set.mem_union, Set.mem_sdiff, Set.mem_singleton_iff] + constructor + · rintro (hxA | ⟨hxB, _⟩) + · exact hsep₁.left_le.vertexSet_subset hxA + · exact hsep₁.right_le.vertexSet_subset hxB + · intro hxG + by_cases hxv : x = v + · exact Or.inl (hxv ▸ hv.1) + · rcases hsep₁.vertexSet_union.symm ▸ hxG with hxA | hxB + · exact Or.inl hxA + · exact Or.inr ⟨hxB, hxv⟩ + · rw [hEB_eq, hsep₁.edgeSet_union] + · rw [hEB_eq] + exact hsep₁.edgeSet_inter_eq + have hinter_eq : (A₁ ∩ B₁.deleteVertices {v}).vertexSet = (A₁ ∩ B₁).vertexSet \ {v} := by + ext x + simp only [inter_vertexSet, deleteVertices, Set.mem_inter_iff, Set.mem_sdiff, + Set.mem_singleton_iff] + tauto + have hord_lt : separationOrder A₁ (B₁.deleteVertices {v}) < separationOrder A₁ B₁ := by + rw [separationOrder, hinter_eq, separationOrder] + exact Set.ncard_lt_ncard (Set.sdiff_singleton_ssubset.2 hv) (A₁ ∩ B₁).vertexSet_finite + have hmem' : (A₁, B₁.deleteVertices {v}) ∈ 𝒯 := + mem_of_left_le hax1 hi h₁ hsep' (hord_lt.trans (hord h₁)) le_rfl + have hle := hmin1 hmem' hU + omega + · intro hv₂₃ + by_contra! hisoA + have hEA_eq : (A₁.deleteVertices {v}).edgeSet = A₁.edgeSet := by + ext e + simp only [deleteVertices, Set.mem_sep_iff, Set.mem_singleton_iff, forall_eq, + and_iff_left_iff_imp] + exact hisoA e + have hsep' : G.IsSeparation (A₁.deleteVertices {v}) B₁ := by + rw [isSeparation_iff_of_le ((deleteVertices_le A₁ {v}).trans hsep₁.left_le) hsep₁.right_le] + refine ⟨?_, ?_, ?_⟩ + · ext x + simp only [deleteVertices, Set.mem_union, Set.mem_sdiff, Set.mem_singleton_iff] + constructor + · rintro (⟨hxA, _⟩ | hxB) + · exact hsep₁.left_le.vertexSet_subset hxA + · exact hsep₁.right_le.vertexSet_subset hxB + · intro hxG + by_cases hxv : x = v + · exact Or.inr (hxv ▸ hv.2) + · rcases hsep₁.vertexSet_union.symm ▸ hxG with hxA | hxB + · exact Or.inl ⟨hxA, hxv⟩ + · exact Or.inr hxB + · rw [hEA_eq, hsep₁.edgeSet_union] + · rw [hEA_eq] + exact hsep₁.edgeSet_inter_eq + have hinter_eq : ((A₁.deleteVertices {v}) ∩ B₁).vertexSet = (A₁ ∩ B₁).vertexSet \ {v} := by + ext x + simp only [inter_vertexSet, deleteVertices, Set.mem_inter_iff, Set.mem_sdiff, + Set.mem_singleton_iff] + tauto + have hord_lt : separationOrder (A₁.deleteVertices {v}) B₁ < separationOrder A₁ B₁ := by + rw [separationOrder, hinter_eq, separationOrder] + exact Set.ncard_lt_ncard (Set.sdiff_singleton_ssubset.2 hv) (A₁ ∩ B₁).vertexSet_finite + have hmem' : (A₁.deleteVertices {v}, B₁) ∈ 𝒯 := + mem_of_left_le hax1 hi h₁ hsep' (hord_lt.trans (hord h₁)) (deleteVertices_le A₁ {v}) + have hU' : (A₁.deleteVertices {v}) ∪ A₂ ∪ A₃ = G := by + rw [← hU] + refine Hypergraph.ext ?_ ?_ ?_ + · ext x + simp only [union_vertexSet, deleteVertices, Set.mem_union, Set.mem_sdiff, + Set.mem_singleton_iff] + constructor + · rintro ((⟨hx₁, _⟩ | hx₂) | hx₃) + · exact Or.inl (Or.inl hx₁) + · exact Or.inl (Or.inr hx₂) + · exact Or.inr hx₃ + · rintro ((hx₁ | hx₂) | hx₃) + · by_cases hxv : x = v + · rcases hxv ▸ hv₂₃ with hv₂ | hv₃ + · exact Or.inl (Or.inr hv₂) + · exact Or.inr hv₃ + · exact Or.inl (Or.inl ⟨hx₁, hxv⟩) + · exact Or.inl (Or.inr hx₂) + · exact Or.inr hx₃ + · simp [hEA_eq] + · funext e x + apply propext + have hinc_eq : (A₁.deleteVertices {v}).Inc e x ↔ A₁.Inc e x := by + simp only [deleteVertices, Set.mem_singleton_iff, forall_eq] + exact ⟨fun h ↦ h.1, fun h ↦ ⟨h, hisoA e (A₁.edge_mem_of_inc h)⟩⟩ + simp [union_inc, hinc_eq] + have hle := hmin1 hmem' hU' + omega + +/-- Claim (4) in the proof of **Graph Minors X, (4.5)** (page 167): +"For $1 \le i, j \le 3$ with $i \ne j$, $A_i \subseteq B_j$." -/ +theorem theorem_4_5_claim_4 {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (hsep : ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ 𝒯 → G.IsSeparation A B) + (hord : ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ 𝒯 → separationOrder A B < θ) + (hax1 : TangleAxiom1 G θ 𝒯) + (hi : ∀ ⦃A₁ B₁ A₂ B₂ : Hypergraph α β⦄, (A₁, B₁) ∈ 𝒯 → (A₂, B₂) ∈ 𝒯 → ¬ B₁ ≤ A₂) + {A₁ B₁ A₂ B₂ A₃ : Hypergraph α β} + (h₁ : (A₁, B₁) ∈ 𝒯) (h₂ : (A₂, B₂) ∈ 𝒯) (hA₃ : A₃ ≤ G) (hU : A₁ ∪ A₂ ∪ A₃ = G) + (hmin1_1 : ∀ ⦃A₁' B₁' : Hypergraph α β⦄, (A₁', B₁') ∈ 𝒯 → A₁' ∪ A₂ ∪ A₃ = G → + separationOrder A₁ B₁ ≤ separationOrder A₁' B₁') + (hmin1_2 : ∀ ⦃A₂' B₂' : Hypergraph α β⦄, (A₂', B₂') ∈ 𝒯 → A₁ ∪ A₂' ∪ A₃ = G → + separationOrder A₂ B₂ ≤ separationOrder A₂' B₂') + (hmin2_1 : ∀ ⦃A₁' B₁' : Hypergraph α β⦄, (A₁', B₁') ∈ 𝒯 → A₁' ∪ A₂ ∪ A₃ = G → + separationOrder A₁' B₁' ≤ separationOrder A₁ B₁ → + A₁.vertexSet.ncard + A₁.edgeSet.ncard ≤ A₁'.vertexSet.ncard + A₁'.edgeSet.ncard) + (hmin2_2 : ∀ ⦃A₂' B₂' : Hypergraph α β⦄, (A₂', B₂') ∈ 𝒯 → A₁ ∪ A₂' ∪ A₃ = G → + separationOrder A₂' B₂' ≤ separationOrder A₂ B₂ → + A₂.vertexSet.ncard + A₂.edgeSet.ncard ≤ A₂'.vertexSet.ncard + A₂'.edgeSet.ncard) : + A₁ ≤ B₂ ∧ A₂ ≤ B₁ := by + have hstep : ∀ {X₁ Y₁ X₂ Y₂ : Hypergraph α β}, + (X₁, Y₁) ∈ 𝒯 → (X₂, Y₂) ∈ 𝒯 → X₁ ∪ X₂ ∪ A₃ = G → + (∀ ⦃X₂' Y₂' : Hypergraph α β⦄, (X₂', Y₂') ∈ 𝒯 → X₂' ∪ X₁ ∪ A₃ = G → + separationOrder X₂ Y₂ ≤ separationOrder X₂' Y₂') → + (∀ ⦃X₁' Y₁' : Hypergraph α β⦄, (X₁', Y₁') ∈ 𝒯 → X₁' ∪ X₂ ∪ A₃ = G → + separationOrder X₁' Y₁' ≤ separationOrder X₁ Y₁ → + X₁.vertexSet.ncard + X₁.edgeSet.ncard ≤ X₁'.vertexSet.ncard + X₁'.edgeSet.ncard) → + separationOrder (X₁ ∩ Y₂) (Y₁ ∪ X₂) ≤ separationOrder X₁ Y₁ → + X₁ ≤ Y₂ ∧ X₂ ≤ Y₁ := by + intro X₁ Y₁ X₂ Y₂ hx₁ hx₂ hU_X hmin1_X₂ hmin2_X₁ hle_ord + have hs₁ := hsep hx₁ + have hs₂ := hsep hx₂ + have hsep_inter : G.IsSeparation (X₁ ∩ Y₂) (Y₁ ∪ X₂) := + (hs₁.symm.union_inter hs₂).symm + have hord_inter : separationOrder (X₁ ∩ Y₂) (Y₁ ∪ X₂) < θ := + hle_ord.trans_lt (hord hx₁) + have hle_X₁ : X₁ ∩ Y₂ ≤ X₁ := inter_le_left hs₁.left_le hs₂.right_le + have hmem_inter : (X₁ ∩ Y₂, Y₁ ∪ X₂) ∈ 𝒯 := + mem_of_left_le hax1 hi hx₁ hsep_inter hord_inter hle_X₁ + have hU_inter : (X₁ ∩ Y₂) ∪ X₂ ∪ A₃ = G := by + have hle_G : (X₁ ∩ Y₂) ∪ X₂ ∪ A₃ ≤ G := + union_le (union_le hsep_inter.left_le hs₂.left_le) hA₃ + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle_G le_rfl ?_ ?_ + · refine Set.Subset.antisymm hle_G.vertexSet_subset ?_ + intro v hvG + have hvU : v ∈ (X₁ ∪ X₂ ∪ A₃).vertexSet := hU_X.symm ▸ hvG + rcases hvU with (hv₁ | hv₂) | hv₃ + · rcases hs₂.vertexSet_union.symm ▸ hvG with hvX₂ | hvY₂ + · exact Or.inl (Or.inr hvX₂) + · exact Or.inl (Or.inl ⟨hv₁, hvY₂⟩) + · exact Or.inl (Or.inr hv₂) + · exact Or.inr hv₃ + · refine Set.Subset.antisymm hle_G.edgeSet_subset ?_ + intro e heG + have heU : e ∈ (X₁ ∪ X₂ ∪ A₃).edgeSet := hU_X.symm ▸ heG + rcases heU with (he₁ | he₂) | he₃ + · rcases hs₂.edgeSet_union.symm ▸ heG with heX₂ | heY₂ + · exact Or.inl (Or.inr heX₂) + · exact Or.inl (Or.inl ⟨he₁, heY₂⟩) + · exact Or.inl (Or.inr he₂) + · exact Or.inr he₃ + have hcard_le := hmin2_X₁ hmem_inter hU_inter hle_ord + have hV_le : (X₁ ∩ Y₂).vertexSet.ncard ≤ X₁.vertexSet.ncard := + Set.ncard_le_ncard hle_X₁.vertexSet_subset X₁.vertexSet_finite + have hE_le : (X₁ ∩ Y₂).edgeSet.ncard ≤ X₁.edgeSet.ncard := + Set.ncard_le_ncard hle_X₁.edgeSet_subset X₁.edgeSet_finite + have heq_X₁ : X₁ ∩ Y₂ = X₁ := + eq_of_le_of_ncard_eq hle_X₁ (by omega) (by omega) + have hX₁_le_Y₂ : X₁ ≤ Y₂ := heq_X₁ ▸ inter_le_right hs₁.left_le hs₂.right_le + refine ⟨hX₁_le_Y₂, ?_⟩ + have hEX₂_sub : X₂.edgeSet ⊆ Y₁.edgeSet := by + intro e heX₂ + have heG : e ∈ G.edgeSet := hs₂.left_le.edgeSet_subset heX₂ + have he_not_Y₂ : e ∉ Y₂.edgeSet := hs₂.notMem_edgeSet_right heX₂ + have he_not_X₁ : e ∉ X₁.edgeSet := fun h ↦ he_not_Y₂ (hX₁_le_Y₂.edgeSet_subset h) + exact (hs₁.edgeSet_union.symm ▸ heG).resolve_left he_not_X₁ + have hVX₂_sub : X₂.vertexSet ⊆ Y₁.vertexSet := by + intro v hvX₂ + by_contra hv_not_Y₁ + have hvG : v ∈ G.vertexSet := hs₂.left_le.vertexSet_subset hvX₂ + have hvX₁ : v ∈ X₁.vertexSet := + (hs₁.vertexSet_union.symm ▸ hvG).resolve_right hv_not_Y₁ + have hvY₂ : v ∈ Y₂.vertexSet := hX₁_le_Y₂.vertexSet_subset hvX₁ + have hU_swap : X₂ ∪ X₁ ∪ A₃ = G := by + rw [union_comm X₂ X₁] + exact hU_X + obtain ⟨_, hclaim3⟩ := theorem_4_5_claim_3 hsep hord hax1 hi hx₂ hU_swap hmin1_X₂ + ⟨hvX₂, hvY₂⟩ + obtain ⟨e, heX₂, hincX₂⟩ := hclaim3 (Or.inl hvX₁) + have heY₁ : e ∈ Y₁.edgeSet := hEX₂_sub heX₂ + have hincG : G.Inc e v := inc_of_le hs₂.left_le hincX₂ + have hincY₁ : Y₁.Inc e v := (inc_iff_of_le hs₁.right_le heY₁).2 hincG + exact hv_not_Y₁ (Y₁.vertex_mem_of_inc hincY₁) + exact (le_iff_of_le hs₂.left_le hs₁.right_le).2 ⟨hVX₂_sub, hEX₂_sub⟩ + have hsum := separationOrder_inter_union_add_union_inter (hsep h₁) (hsep h₂) + have hcomm_ord : separationOrder (A₁ ∪ B₂) (B₁ ∩ A₂) = separationOrder (A₂ ∩ B₁) (B₂ ∪ A₁) := by + rw [separationOrder_comm, union_comm B₂ A₁, inter_comm A₂ B₁] + rw [hcomm_ord] at hsum + by_cases hle1 : separationOrder (A₁ ∩ B₂) (B₁ ∪ A₂) ≤ separationOrder A₁ B₁ + · exact hstep h₁ h₂ hU + (fun A₂' B₂' hm hU' ↦ hmin1_2 hm (by rwa [union_comm A₁ A₂'])) + hmin2_1 hle1 + · have hle2 : separationOrder (A₂ ∩ B₁) (B₂ ∪ A₁) ≤ separationOrder A₂ B₂ := by omega + have hU_swap : A₂ ∪ A₁ ∪ A₃ = G := by rw [union_comm A₂ A₁]; exact hU + obtain ⟨h21, h12⟩ := hstep h₂ h₁ hU_swap + (fun A₁' B₁' hm hU' ↦ hmin1_1 hm hU') + (fun A₂' B₂' hm hU' hle ↦ hmin2_2 hm (by rwa [union_comm A₁ A₂']) hle) + hle2 + exact ⟨h12, h21⟩ + +/-- **Graph Minors X, (4.5)** (page 167): +"Let $\theta \ge 2$, and let $\mathscr{T}$ be a set of separations of a hypergraph $G$, each +of order $< \theta$. Suppose that the first tangle axiom holds, and* (i) *if $(A_1, B_1), +(A_2, B_2) \in \mathscr{T}$ then $B_1 \not\subseteq A_2$* (ii) *there do not exist +subhypergraphs $A_1, A_2, A_3 \subseteq G$, mutually edge-disjoint, with $A_1 \cup A_2 \cup +A_3 = G$ and with $(A_1, A_2 \cup A_3)$, $(A_2, A_3 \cup A_1)$, $(A_3, A_1 \cup A_2)$ all in +$\mathscr{T}$.* *Then the second tangle axiom holds." -/ +theorem theorem_4_5_proof {G : Hypergraph α β} {θ : ℕ} (_hθ : 2 ≤ θ) + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (hsep : ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ 𝒯 → G.IsSeparation A B) + (hord : ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ 𝒯 → separationOrder A B < θ) + (hax1 : TangleAxiom1 G θ 𝒯) + (hi : ∀ ⦃A₁ B₁ A₂ B₂ : Hypergraph α β⦄, (A₁, B₁) ∈ 𝒯 → (A₂, B₂) ∈ 𝒯 → ¬ B₁ ≤ A₂) + (hii : ¬ ∃ A₁ A₂ A₃ : Hypergraph α β, + A₁ ≤ G ∧ A₂ ≤ G ∧ A₃ ≤ G ∧ + Disjoint A₁.edgeSet A₂.edgeSet ∧ + Disjoint A₁.edgeSet A₃.edgeSet ∧ + Disjoint A₂.edgeSet A₃.edgeSet ∧ + A₁ ∪ A₂ ∪ A₃ = G ∧ + (A₁, A₂ ∪ A₃) ∈ 𝒯 ∧ (A₂, A₃ ∪ A₁) ∈ 𝒯 ∧ (A₃, A₁ ∪ A₂) ∈ 𝒯) : + TangleAxiom2 G 𝒯 := by + unfold TangleAxiom2 + by_contra! hnot2 + rcases hnot2 with ⟨A₁₀, B₁₀, A₂₀, B₂₀, A₃₀, B₃₀, h₁₀, h₂₀, h₃₀, hU₀⟩ + let score1 (A₁ B₁ A₂ B₂ A₃ B₃ : Hypergraph α β) : ℕ := + separationOrder A₁ B₁ + separationOrder A₂ B₂ + separationOrder A₃ B₃ + let score2 (A₁ A₂ A₃ : Hypergraph α β) : ℕ := + (A₁.vertexSet.ncard + A₁.edgeSet.ncard) + + (A₂.vertexSet.ncard + A₂.edgeSet.ncard) + + (A₃.vertexSet.ncard + A₃.edgeSet.ncard) + let S₁ : Set ℕ := + {n : ℕ | ∃ A₁ B₁ A₂ B₂ A₃ B₃, + (A₁, B₁) ∈ 𝒯 ∧ (A₂, B₂) ∈ 𝒯 ∧ (A₃, B₃) ∈ 𝒯 ∧ + A₁ ∪ A₂ ∪ A₃ = G ∧ score1 A₁ B₁ A₂ B₂ A₃ B₃ = n} + have hS₁_ne : S₁.Nonempty := + ⟨score1 A₁₀ B₁₀ A₂₀ B₂₀ A₃₀ B₃₀, A₁₀, B₁₀, A₂₀, B₂₀, A₃₀, B₃₀, h₁₀, h₂₀, h₃₀, hU₀, rfl⟩ + obtain ⟨A₁₁, B₁₁, A₂₁, B₂₁, A₃₁, B₃₁, h₁₁, h₂₁, h₃₁, hU₁, hs₁_min⟩ := Nat.sInf_mem hS₁_ne + let s₁_opt := sInf S₁ + let S₂ : Set ℕ := + {n : ℕ | ∃ A₁ B₁ A₂ B₂ A₃ B₃, + (A₁, B₁) ∈ 𝒯 ∧ (A₂, B₂) ∈ 𝒯 ∧ (A₃, B₃) ∈ 𝒯 ∧ + A₁ ∪ A₂ ∪ A₃ = G ∧ score1 A₁ B₁ A₂ B₂ A₃ B₃ = s₁_opt ∧ score2 A₁ A₂ A₃ = n} + have hS₂_ne : S₂.Nonempty := + ⟨score2 A₁₁ A₂₁ A₃₁, A₁₁, B₁₁, A₂₁, B₂₁, A₃₁, B₃₁, h₁₁, h₂₁, h₃₁, hU₁, hs₁_min, rfl⟩ + obtain ⟨A₁, B₁, A₂, B₂, A₃, B₃, h₁, h₂, h₃, hU, hs₁_eq, hs₂_min⟩ := Nat.sInf_mem hS₂_ne + have hmin1_all : ∀ A₁' B₁' A₂' B₂' A₃' B₃', + (A₁', B₁') ∈ 𝒯 → (A₂', B₂') ∈ 𝒯 → (A₃', B₃') ∈ 𝒯 → A₁' ∪ A₂' ∪ A₃' = G → + score1 A₁ B₁ A₂ B₂ A₃ B₃ ≤ score1 A₁' B₁' A₂' B₂' A₃' B₃' := by + intro A₁' B₁' A₂' B₂' A₃' B₃' hm1 hm2 hm3 hU' + rw [hs₁_eq] + exact Nat.sInf_le ⟨A₁', B₁', A₂', B₂', A₃', B₃', hm1, hm2, hm3, hU', rfl⟩ + have hmin2_all : ∀ A₁' B₁' A₂' B₂' A₃' B₃', + (A₁', B₁') ∈ 𝒯 → (A₂', B₂') ∈ 𝒯 → (A₃', B₃') ∈ 𝒯 → A₁' ∪ A₂' ∪ A₃' = G → + score1 A₁' B₁' A₂' B₂' A₃' B₃' ≤ score1 A₁ B₁ A₂ B₂ A₃ B₃ → + score2 A₁ A₂ A₃ ≤ score2 A₁' A₂' A₃' := by + intro A₁' B₁' A₂' B₂' A₃' B₃' hm1 hm2 hm3 hU' hle1 + have hge1 := hmin1_all A₁' B₁' A₂' B₂' A₃' B₃' hm1 hm2 hm3 hU' + have heq1 : score1 A₁' B₁' A₂' B₂' A₃' B₃' = s₁_opt := by omega + rw [hs₂_min] + exact Nat.sInf_le ⟨A₁', B₁', A₂', B₂', A₃', B₃', hm1, hm2, hm3, hU', heq1, rfl⟩ + have hmin1_1 : ∀ ⦃A₁' B₁' : Hypergraph α β⦄, (A₁', B₁') ∈ 𝒯 → A₁' ∪ A₂ ∪ A₃ = G → + separationOrder A₁ B₁ ≤ separationOrder A₁' B₁' := by + intro A₁' B₁' hm hU' + have := hmin1_all A₁' B₁' A₂ B₂ A₃ B₃ hm h₂ h₃ hU' + dsimp [score1] at this + omega + have hmin1_2 : ∀ ⦃A₂' B₂' : Hypergraph α β⦄, (A₂', B₂') ∈ 𝒯 → A₁ ∪ A₂' ∪ A₃ = G → + separationOrder A₂ B₂ ≤ separationOrder A₂' B₂' := by + intro A₂' B₂' hm hU' + have := hmin1_all A₁ B₁ A₂' B₂' A₃ B₃ h₁ hm h₃ hU' + dsimp [score1] at this + omega + have hmin1_3 : ∀ ⦃A₃' B₃' : Hypergraph α β⦄, (A₃', B₃') ∈ 𝒯 → A₁ ∪ A₂ ∪ A₃' = G → + separationOrder A₃ B₃ ≤ separationOrder A₃' B₃' := by + intro A₃' B₃' hm hU' + have := hmin1_all A₁ B₁ A₂ B₂ A₃' B₃' h₁ h₂ hm hU' + dsimp [score1] at this + omega + have hmin2_1 : ∀ ⦃A₁' B₁' : Hypergraph α β⦄, (A₁', B₁') ∈ 𝒯 → A₁' ∪ A₂ ∪ A₃ = G → + separationOrder A₁' B₁' ≤ separationOrder A₁ B₁ → + A₁.vertexSet.ncard + A₁.edgeSet.ncard ≤ A₁'.vertexSet.ncard + A₁'.edgeSet.ncard := by + intro A₁' B₁' hm hU' hle + have := hmin2_all A₁' B₁' A₂ B₂ A₃ B₃ hm h₂ h₃ hU' (by dsimp [score1]; omega) + dsimp [score2] at this + omega + have hmin2_2 : ∀ ⦃A₂' B₂' : Hypergraph α β⦄, (A₂', B₂') ∈ 𝒯 → A₁ ∪ A₂' ∪ A₃ = G → + separationOrder A₂' B₂' ≤ separationOrder A₂ B₂ → + A₂.vertexSet.ncard + A₂.edgeSet.ncard ≤ A₂'.vertexSet.ncard + A₂'.edgeSet.ncard := by + intro A₂' B₂' hm hU' hle + have := hmin2_all A₁ B₁ A₂' B₂' A₃ B₃ h₁ hm h₃ hU' (by dsimp [score1]; omega) + dsimp [score2] at this + omega + have hmin2_3 : ∀ ⦃A₃' B₃' : Hypergraph α β⦄, (A₃', B₃') ∈ 𝒯 → A₁ ∪ A₂ ∪ A₃' = G → + separationOrder A₃' B₃' ≤ separationOrder A₃ B₃ → + A₃.vertexSet.ncard + A₃.edgeSet.ncard ≤ A₃'.vertexSet.ncard + A₃'.edgeSet.ncard := by + intro A₃' B₃' hm hU' hle + have := hmin2_all A₁ B₁ A₂ B₂ A₃' B₃' h₁ h₂ hm hU' (by dsimp [score1]; omega) + dsimp [score2] at this + omega + have hs₁ := hsep h₁ + have hs₂ := hsep h₂ + have hs₃ := hsep h₃ + obtain ⟨h12, h21⟩ := theorem_4_5_claim_4 hsep hord hax1 hi h₁ h₂ hs₃.left_le hU + hmin1_1 hmin1_2 hmin2_1 hmin2_2 + have hU_132 : A₁ ∪ A₃ ∪ A₂ = G := by + rw [union_assoc, union_comm A₃ A₂, ← union_assoc, hU] + obtain ⟨h13, h31⟩ := theorem_4_5_claim_4 hsep hord hax1 hi h₁ h₃ hs₂.left_le hU_132 + (fun A₁' B₁' hm hU' ↦ hmin1_1 hm (by rw [union_assoc, union_comm A₂ A₃, ← union_assoc, hU'])) + (fun A₃' B₃' hm hU' ↦ hmin1_3 hm (by rw [union_assoc, union_comm A₂ A₃', ← union_assoc, hU'])) + (fun A₁' B₁' hm hU' hle ↦ hmin2_1 hm + (by rw [union_assoc, union_comm A₂ A₃, ← union_assoc, hU']) hle) + (fun A₃' B₃' hm hU' hle ↦ hmin2_3 hm + (by rw [union_assoc, union_comm A₂ A₃', ← union_assoc, hU']) hle) + have hU_231 : A₂ ∪ A₃ ∪ A₁ = G := by + rw [union_comm A₂ A₃, union_assoc, union_comm A₃ (A₂ ∪ A₁), union_comm A₂ A₁, hU] + obtain ⟨h23, h32⟩ := theorem_4_5_claim_4 hsep hord hax1 hi h₂ h₃ hs₁.left_le hU_231 + (fun A₂' B₂' hm hU' ↦ hmin1_2 hm (by + rw [union_comm A₁ A₂', union_assoc, union_comm A₁ A₃, ← union_assoc, hU'])) + (fun A₃' B₃' hm hU' ↦ hmin1_3 hm (by + rw [union_comm A₁ A₂, union_assoc, union_comm A₁ A₃', ← union_assoc, hU'])) + (fun A₂' B₂' hm hU' hle ↦ hmin2_2 hm (by + rw [union_comm A₁ A₂', union_assoc, union_comm A₁ A₃, ← union_assoc, hU']) hle) + (fun A₃' B₃' hm hU' hle ↦ hmin2_3 hm (by + rw [union_comm A₁ A₂, union_assoc, union_comm A₁ A₃', ← union_assoc, hU']) hle) + have hdisj12 : Disjoint A₁.edgeSet A₂.edgeSet := + hs₂.disjoint_edgeSet.mono_right h12.edgeSet_subset |>.symm + have hdisj13 : Disjoint A₁.edgeSet A₃.edgeSet := + hs₃.disjoint_edgeSet.mono_right h13.edgeSet_subset |>.symm + have hdisj23 : Disjoint A₂.edgeSet A₃.edgeSet := + hs₃.disjoint_edgeSet.mono_right h23.edgeSet_subset |>.symm + have hmem_pair : ∀ {X Y Z W : Hypergraph α β}, + (X, W) ∈ 𝒯 → Y ≤ W → Z ≤ W → X ∪ (Y ∪ Z) = G → (X, Y ∪ Z) ∈ 𝒯 := by + intro X Y Z W hXW hYW hZW hXYZ + have hsXW := hsep hXW + have hYZ_le_W : Y ∪ Z ≤ W := + (le_iff_of_le (union_le (hYW.trans hsXW.right_le) (hZW.trans hsXW.right_le)) hsXW.right_le).2 + ⟨Set.union_subset hYW.vertexSet_subset hZW.vertexSet_subset, + Set.union_subset hYW.edgeSet_subset hZW.edgeSet_subset⟩ + have hsep_XYZ : G.IsSeparation X (Y ∪ Z) := by + refine ⟨hsXW.left_le, hYZ_le_W.trans hsXW.right_le, hXYZ, ?_⟩ + exact Set.Subset.antisymm + ((Set.inter_subset_inter_right _ hYZ_le_W.edgeSet_subset).trans + hsXW.edgeSet_inter_eq.subset) + (Set.empty_subset _) + have hord_XYZ : separationOrder X (Y ∪ Z) < θ := by + have hsub : (X ∩ (Y ∪ Z)).vertexSet ⊆ (X ∩ W).vertexSet := + Set.inter_subset_inter_right _ hYZ_le_W.vertexSet_subset + exact (Set.ncard_le_ncard hsub (X ∩ W).vertexSet_finite).trans_lt (hord hXW) + exact mem_of_left_le hax1 hi hXW hsep_XYZ hord_XYZ le_rfl + have hm1 : (A₁, A₂ ∪ A₃) ∈ 𝒯 := + hmem_pair h₁ h21 h31 (by rw [← union_assoc, hU]) + have hm2 : (A₂, A₃ ∪ A₁) ∈ 𝒯 := + hmem_pair h₂ h32 h12 (by rw [← union_assoc, hU_231]) + have hm3 : (A₃, A₁ ∪ A₂) ∈ 𝒯 := + hmem_pair h₃ h13 h23 (by rw [union_comm A₃ (A₁ ∪ A₂), hU]) + exact hii ⟨A₁, A₂, A₃, hs₁.left_le, hs₂.left_le, hs₃.left_le, + hdisj12, hdisj13, hdisj23, hU, hm1, hm2, hm3⟩ + +/-! ## Complete graphs: (4.4) -/ + +private theorem ncard_univ_fin (n : ℕ) : (Set.univ : Set (Fin n)).ncard = n := by + rw [Set.ncard_univ, Nat.card_eq_fintype_card, Fintype.card_fin] + +private theorem ncard_le_of_injOn_fin {n θ : ℕ} {W : Set (Fin n)} {f : Fin n → Fin θ} + (hf : Set.InjOn f W) : W.ncard ≤ θ := by + rw [← hf.ncard_image] + exact (Set.ncard_le_ncard (Set.subset_univ _) Set.finite_univ).trans_eq (ncard_univ_fin θ) + +private theorem ends_completeGraph_pair {n : ℕ} {u v : Fin n} (hne : u ≠ v) : + (completeGraph n).ends s(u, v) = {u, v} := by + ext x + simp [completeGraph, Hypergraph.ends, Sym2.mk_isDiag_iff, hne] + +private theorem edgeSize_completeGraph_pair {n : ℕ} {u v : Fin n} (hne : u ≠ v) : + edgeSize (completeGraph n) s(u, v) = 2 := by + rw [edgeSize, ends_completeGraph_pair hne, Set.ncard_pair hne] + +private theorem maxEdgeSize_completeGraph_of_le_one {n : ℕ} (hn : n ≤ 1) : + maxEdgeSize (completeGraph n) = 0 := by + rw [maxEdgeSize_eq_zero_iff] + rintro e he v _ + induction e using Sym2.ind with + | _ u w => + have hne : u ≠ w := by simpa [completeGraph, Sym2.mk_isDiag_iff] using he + omega + +private theorem maxEdgeSize_completeGraph_of_two_le {n : ℕ} (hn : 2 ≤ n) : + maxEdgeSize (completeGraph n) = 2 := by + have hle : maxEdgeSize (completeGraph n) ≤ 2 := by + rw [maxEdgeSize_le_iff] + intro e he + induction e using Sym2.ind with + | _ u v => + have hne : u ≠ v := by simpa [completeGraph, Sym2.mk_isDiag_iff] using he + rw [edgeSize_completeGraph_pair hne] + let u₀ : Fin n := ⟨0, by omega⟩ + let v₀ : Fin n := ⟨1, by omega⟩ + have hne01 : u₀ ≠ v₀ := by simp [u₀, v₀, Fin.ext_iff] + have he01 : s(u₀, v₀) ∈ (completeGraph n).edgeSet := by + simp [completeGraph, Sym2.mk_isDiag_iff, hne01] + have hge : 2 ≤ maxEdgeSize (completeGraph n) := by + rw [← edgeSize_completeGraph_pair hne01] + exact edgeSize_le_maxEdgeSize he01 + omega + +private def completeLeftOf {n : ℕ} (W : Set (Fin n)) : Hypergraph (Fin n) (Sym2 (Fin n)) where + vertexSet := W + edgeSet := {e : Sym2 (Fin n) | ¬ e.IsDiag ∧ ∀ v ∈ e, v ∈ W} + Inc e v := (¬ e.IsDiag ∧ ∀ u ∈ e, u ∈ W) ∧ v ∈ e + vertex_mem_of_inc _ _ h := h.1.2 _ h.2 + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := Set.toFinite _ + edgeSet_finite := Set.toFinite _ + +private def completeRightOf {n : ℕ} (W : Set (Fin n)) : Hypergraph (Fin n) (Sym2 (Fin n)) where + vertexSet := Set.univ + edgeSet := {e : Sym2 (Fin n) | ¬ e.IsDiag ∧ ¬ ∀ v ∈ e, v ∈ W} + Inc e v := (¬ e.IsDiag ∧ ¬ ∀ u ∈ e, u ∈ W) ∧ v ∈ e + vertex_mem_of_inc _ _ _ := Set.mem_univ _ + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := Set.finite_univ + edgeSet_finite := Set.toFinite _ + +/-- Upper bound in `(4.4)`: for `n ≥ 2`, `θ(K_n) ≤ ⌈(2/3)n⌉ = (2 * n + 2) / 3`. -/ +private theorem tangleNumber_completeGraph_le {n : ℕ} (hn : 2 ≤ n) : + tangleNumber (completeGraph n) ≤ (2 * n + 2) / 3 := by + let θ := (2 * n + 2) / 3 + have hθ_pos : 2 ≤ θ := by omega + by_contra! hgt + obtain ⟨𝒯, h𝒯⟩ := exists_isTangle_of_le_tangleNumber (by omega) hgt + have hmem_of_ncard_le : ∀ W : Set (Fin n), W.ncard ≤ θ → + (completeLeftOf W, completeRightOf W) ∈ 𝒯 := by + intro W hW + have hL : completeLeftOf W ≤ completeGraph n := + { vertexSet_subset := Set.subset_univ _ + edgeSet_subset := fun _ h ↦ h.1 + ends_eq := fun e he ↦ by + ext v; exact ⟨fun h ↦ ⟨he, h.2⟩, fun h ↦ ⟨h.1.1, h.2⟩⟩ } + have hR : completeRightOf W ≤ completeGraph n := + { vertexSet_subset := subset_rfl + edgeSet_subset := fun _ h ↦ h.1 + ends_eq := fun e he ↦ by + ext v; exact ⟨fun h ↦ ⟨he, h.2⟩, fun h ↦ ⟨h.1.1, h.2⟩⟩ } + have hsep : (completeGraph n).IsSeparation (completeLeftOf W) (completeRightOf W) := by + rw [isSeparation_iff_of_le hL hR] + refine ⟨Set.union_univ W, ?_, ?_⟩ + · ext e + simp only [completeLeftOf, completeRightOf, completeGraph, Set.mem_union, Set.mem_ofPred_eq] + tauto + · ext e + change (¬ e.IsDiag ∧ ∀ v ∈ e, v ∈ W) ∧ (¬ e.IsDiag ∧ ¬ ∀ v ∈ e, v ∈ W) ↔ False + tauto + have hord : separationOrder (completeLeftOf W) (completeRightOf W) < θ + 1 := by + have : ((completeLeftOf W) ∩ (completeRightOf W)).vertexSet = W := by + simp [completeLeftOf, completeRightOf] + rw [separationOrder, this] + omega + exact (h𝒯.axiom1 hsep hord).resolve_right fun hR_mem ↦ h𝒯.axiom3 hR_mem rfl + let a := n / 3 + let W₁ : Set (Fin n) := {i : Fin n | a ≤ i.1} + let W₂ : Set (Fin n) := {i : Fin n | i.1 < a ∨ 2 * a ≤ i.1} + let W₃ : Set (Fin n) := {i : Fin n | i.1 < 2 * a} + have hW₁ : W₁.ncard ≤ θ := by + let f₁ (i : Fin n) : Fin θ := + ⟨if i.1 - a < θ then i.1 - a else 0, by split_ifs with h <;> omega⟩ + refine ncard_le_of_injOn_fin (f := f₁) ?_ + intro i hi j hj heq + have hi' : i.1 - a < θ := by have := hi; have := i.2; omega + have hj' : j.1 - a < θ := by have := hj; have := j.2; omega + have hval : (f₁ i).1 = (f₁ j).1 := congrArg Fin.val heq + simp only [f₁, hi', hj', ↓reduceIte] at hval + have : a ≤ i.1 := hi + have : a ≤ j.1 := hj + exact Fin.ext (by omega) + have hW₂ : W₂.ncard ≤ θ := by + let g₂ (i : Fin n) : ℕ := if i.1 < a then i.1 else i.1 - a + let f₂ (i : Fin n) : Fin θ := + ⟨if g₂ i < θ then g₂ i else 0, by split_ifs with h <;> omega⟩ + refine ncard_le_of_injOn_fin (f := f₂) ?_ + intro i hi j hj heq + have hi' : g₂ i < θ := by + dsimp [g₂] + rcases hi with h | h <;> have := i.2 <;> split_ifs <;> omega + have hj' : g₂ j < θ := by + dsimp [g₂] + rcases hj with h | h <;> have := j.2 <;> split_ifs <;> omega + have hval : (f₂ i).1 = (f₂ j).1 := congrArg Fin.val heq + simp only [f₂, hi', hj', ↓reduceIte] at hval + dsimp [g₂] at hval + rcases hi with hi1 | hi2 <;> rcases hj with hj1 | hj2 <;> + split_ifs at hval <;> exact Fin.ext (by omega) + have hW₃ : W₃.ncard ≤ θ := by + let f₃ (i : Fin n) : Fin θ := + ⟨if i.1 < θ then i.1 else 0, by split_ifs with h <;> omega⟩ + refine ncard_le_of_injOn_fin (f := f₃) ?_ + intro i hi j hj heq + have hi' : i.1 < θ := by have : i.1 < 2 * a := hi; omega + have hj' : j.1 < θ := by have : j.1 < 2 * a := hj; omega + have hval : (f₃ i).1 = (f₃ j).1 := congrArg Fin.val heq + simp only [f₃, hi', hj', ↓reduceIte] at hval + exact Fin.ext hval + have hm₁ := hmem_of_ncard_le W₁ hW₁ + have hm₂ := hmem_of_ncard_le W₂ hW₂ + have hm₃ := hmem_of_ncard_le W₃ hW₃ + apply theorem_2_3_proof h𝒯 (by omega) hm₁ hm₂ hm₃ + ext e + simp only [union_edgeSet, completeLeftOf, completeGraph, Set.mem_union, Set.mem_ofPred_eq] + constructor + · rintro ((⟨h, _⟩ | ⟨h, _⟩) | ⟨h, _⟩) <;> exact h + · intro he + induction e using Sym2.ind with + | _ u v => + simp only [Sym2.mem_iff, forall_eq_or_imp, forall_eq] + have hcov : (u ∈ W₁ ∧ v ∈ W₁) ∨ (u ∈ W₂ ∧ v ∈ W₂) ∨ (u ∈ W₃ ∧ v ∈ W₃) := by + simp only [W₁, W₂, W₃, Set.mem_ofPred_eq] + omega + rcases hcov with h1 | h2 | h3 + · exact Or.inl (Or.inl ⟨he, h1⟩) + · exact Or.inl (Or.inr ⟨he, h2⟩) + · exact Or.inr ⟨he, h3⟩ + +/-- Lower bound in `(4.4)`: for `n ≥ 4`, `K_n` has a tangle of order `⌈(2/3)n⌉ = (2 * n + 2) / 3` +(Graph Minors X, Section 4, proof of (4.4), page 166). -/ +private theorem le_tangleNumber_completeGraph_of_four_le {n : ℕ} (hn : 4 ≤ n) : + (2 * n + 2) / 3 ≤ tangleNumber (completeGraph n) := by + let G := completeGraph n + let θ := (2 * n + 2) / 3 + have hθ_ge3 : 3 ≤ θ := by omega + have hθ_lt_n : θ < n := by omega + let 𝒯 : Set (Hypergraph (Fin n) (Sym2 (Fin n)) × Hypergraph (Fin n) (Sym2 (Fin n))) := + {p | G.IsSeparation p.1 p.2 ∧ p.1.vertexSet.ncard < θ} + have h𝒯 : IsTangle G θ 𝒯 := by + refine ⟨by omega, fun _ _ h ↦ h.1, ?_, ?_, ?_, ?_⟩ + · intro A B ⟨hsep, hlt⟩ + have hsub : (A ∩ B).vertexSet ⊆ A.vertexSet := Set.inter_subset_left + exact (Set.ncard_le_ncard hsub A.vertexSet_finite).trans_lt hlt + · intro A B hsep hord + by_cases hVA : A.vertexSet = Set.univ + · right + refine ⟨hsep.symm, ?_⟩ + have : (A ∩ B).vertexSet = B.vertexSet := by + simp [hVA] + rwa [separationOrder, this] at hord + by_cases hVB : B.vertexSet = Set.univ + · left + refine ⟨hsep, ?_⟩ + have : (A ∩ B).vertexSet = A.vertexSet := by + simp [hVB] + rwa [separationOrder, this] at hord + · exfalso + obtain ⟨u, _, hu_notA⟩ := Set.exists_of_ssubset + (ssubset_of_subset_of_ne (Set.subset_univ _) hVA) + obtain ⟨v, _, hv_notB⟩ := Set.exists_of_ssubset + (ssubset_of_subset_of_ne (Set.subset_univ _) hVB) + have huG : u ∈ G.vertexSet := Set.mem_univ u + have hvG : v ∈ G.vertexSet := Set.mem_univ v + have huB : u ∈ B.vertexSet := + (hsep.vertexSet_union.symm ▸ huG).resolve_left hu_notA + have hvA : v ∈ A.vertexSet := + (hsep.vertexSet_union.symm ▸ hvG).resolve_right hv_notB + have hne : u ≠ v := fun h ↦ hu_notA (h ▸ hvA) + have heG : s(u, v) ∈ G.edgeSet := by + simp [G, completeGraph, Sym2.mk_isDiag_iff, hne] + rcases hsep.edgeSet_union.symm ▸ heG with heA | heB + · have hincA : A.Inc s(u, v) u := + (inc_iff_of_le hsep.left_le heA).2 ⟨heG, Sym2.mem_mk_left u v⟩ + exact hu_notA (A.vertex_mem_of_inc hincA) + · have hincB : B.Inc s(u, v) v := + (inc_iff_of_le hsep.right_le heB).2 ⟨heG, Sym2.mem_mk_right u v⟩ + exact hv_notB (B.vertex_mem_of_inc hincB) + · intro A₁ B₁ A₂ B₂ A₃ B₃ ⟨hs₁, hlt₁⟩ ⟨hs₂, hlt₂⟩ ⟨hs₃, hlt₃⟩ hU + let V₁ := A₁.vertexSet + let V₂ := A₂.vertexSet + let V₃ := A₃.vertexSet + change V₁.ncard < θ at hlt₁ + change V₂.ncard < θ at hlt₂ + change V₃.ncard < θ at hlt₃ + have hV_union : V₁ ∪ V₂ ∪ V₃ = Set.univ := congrArg Hypergraph.vertexSet hU + have hex_v : ∃ v : Fin n, v ∉ (V₁ ∩ V₂) ∪ ((V₁ ∪ V₂) ∩ V₃) := by + by_contra! hall + have huniv : (V₁ ∩ V₂) ∪ ((V₁ ∪ V₂) ∩ V₃) = Set.univ := + Set.eq_univ_of_forall hall + have heq1 := Set.ncard_union_add_ncard_inter V₁ V₂ + (Set.toFinite V₁) (Set.toFinite V₂) + have heq2 := Set.ncard_union_add_ncard_inter (V₁ ∪ V₂) V₃ + (Set.toFinite (V₁ ∪ V₂)) (Set.toFinite V₃) + have hle3 := Set.ncard_union_le (V₁ ∩ V₂) ((V₁ ∪ V₂) ∩ V₃) + rw [hV_union, ncard_univ_fin] at heq2 + rw [huniv, ncard_univ_fin] at hle3 + omega + obtain ⟨v, hv_not⟩ := hex_v + have hv_in : v ∈ V₁ ∪ V₂ ∪ V₃ := hV_union.symm ▸ Set.mem_univ v + have hnot_12 : v ∉ V₁ ∩ V₂ := fun h ↦ hv_not (Or.inl h) + have hnot_123 : v ∉ (V₁ ∪ V₂) ∩ V₃ := fun h ↦ hv_not (Or.inr h) + have hcases : (v ∉ V₁ ∧ v ∉ V₂ ∧ v ∈ V₃) ∨ + (v ∉ V₁ ∧ v ∉ V₃ ∧ v ∈ V₂) ∨ + (v ∉ V₂ ∧ v ∉ V₃ ∧ v ∈ V₁) := by + simp only [Set.mem_union, Set.mem_inter_iff] at hv_in hnot_12 hnot_123 + tauto + have hno_pair : ∀ {X Y Z : Hypergraph (Fin n) (Sym2 (Fin n))}, + X ≤ G → Y ≤ G → Z ≤ G → + X.edgeSet ∪ Y.edgeSet ∪ Z.edgeSet = G.edgeSet → + Z.vertexSet.ncard < θ → + v ∉ X.vertexSet → v ∉ Y.vertexSet → v ∈ Z.vertexSet → False := by + intro X Y Z hX hY hZ hE_u hZ_lt hvX hvY hvZ + have hZ_ne : Z.vertexSet ≠ Set.univ := by + intro heq + rw [heq, ncard_univ_fin] at hZ_lt + omega + obtain ⟨u, _, hu_notZ⟩ := Set.exists_of_ssubset + (ssubset_of_subset_of_ne (Set.subset_univ _) hZ_ne) + have hne : u ≠ v := fun h ↦ hu_notZ (h ▸ hvZ) + have heG : s(u, v) ∈ G.edgeSet := by + simp [G, completeGraph, Sym2.mk_isDiag_iff, hne] + rcases hE_u.symm ▸ heG with (heX | heY) | heZ + · have hinc : X.Inc s(u, v) v := + (inc_iff_of_le hX heX).2 ⟨heG, Sym2.mem_mk_right u v⟩ + exact hvX (X.vertex_mem_of_inc hinc) + · have hinc : Y.Inc s(u, v) v := + (inc_iff_of_le hY heY).2 ⟨heG, Sym2.mem_mk_right u v⟩ + exact hvY (Y.vertex_mem_of_inc hinc) + · have hinc : Z.Inc s(u, v) u := + (inc_iff_of_le hZ heZ).2 ⟨heG, Sym2.mem_mk_left u v⟩ + exact hu_notZ (Z.vertex_mem_of_inc hinc) + have hE_union : A₁.edgeSet ∪ A₂.edgeSet ∪ A₃.edgeSet = G.edgeSet := + congrArg Hypergraph.edgeSet hU + rcases hcases with ⟨h1, h2, h3⟩ | ⟨h1, h3, h2⟩ | ⟨h2, h3, h1⟩ + · exact hno_pair hs₁.left_le hs₂.left_le hs₃.left_le hE_union hlt₃ h1 h2 h3 + · exact hno_pair hs₁.left_le hs₃.left_le hs₂.left_le + (by rw [Set.union_assoc, Set.union_comm A₃.edgeSet, ← Set.union_assoc, hE_union]) + hlt₂ h1 h3 h2 + · exact hno_pair hs₂.left_le hs₃.left_le hs₁.left_le + (by rw [Set.union_comm (A₂.edgeSet ∪ A₃.edgeSet), ← Set.union_assoc, hE_union]) + hlt₁ h2 h3 h1 + · intro A B ⟨_, hlt⟩ hVA + rw [hVA] at hlt + change (Set.univ : Set (Fin n)).ncard < θ at hlt + rw [ncard_univ_fin] at hlt + omega + exact h𝒯.le_tangleNumber + +/-- For `n ≥ 3`, `branchWidth (completeGraph n) ≥ 2`. -/ +private theorem two_le_branchWidth_completeGraph {n : ℕ} (hn : 3 ≤ n) : + 2 ≤ branchWidth (completeGraph n) := by + let G := completeGraph n + have hγ : 1 ≤ maxEdgeSize G := by + rw [maxEdgeSize_completeGraph_of_two_le (by omega)] + omega + have hcard : 2 ≤ G.edgeSet.ncard := by + let u₀ : Fin n := ⟨0, by omega⟩ + let u₁ : Fin n := ⟨1, by omega⟩ + let u₂ : Fin n := ⟨2, by omega⟩ + have h01 : u₀ ≠ u₁ := by simp [u₀, u₁, Fin.ext_iff] + have h02 : u₀ ≠ u₂ := by simp [u₀, u₂, Fin.ext_iff] + have h12 : u₁ ≠ u₂ := by simp [u₁, u₂, Fin.ext_iff] + have hne_e : (s(u₀, u₁) : Sym2 (Fin n)) ≠ s(u₀, u₂) := + sym2_mk_eq_left_iff.not.2 h12 + have hsub : ({s(u₀, u₁), s(u₀, u₂)} : Set (Sym2 (Fin n))) ⊆ G.edgeSet := by + rintro e (rfl | rfl) <;> simp [G, completeGraph, Sym2.mk_isDiag_iff, h01, h02] + have hpair : ({s(u₀, u₁), s(u₀, u₂)} : Set (Sym2 (Fin n))).ncard = 2 := + Set.ncard_pair hne_e + have hle := Set.ncard_le_ncard hsub G.edgeSet_finite + omega + obtain ⟨ι, _, T, τ, hbd, hw_eq⟩ := exists_branchDecomposition_eq_branchWidth hγ hcard + rw [← hw_eq] + have hT := hbd.isTernaryTree + obtain ⟨u₀⟩ := hT.isTree.connected.nonempty + obtain ⟨w₀, hadj₀⟩ : ∃ w₀, T.Adj u₀ w₀ := by + by_cases hleaf₀ : IsLeaf T u₀ + · obtain ⟨w₀, hw₀, _⟩ := hT.exists_adj_of_isLeaf hleaf₀ + exact ⟨w₀, hw₀⟩ + · obtain ⟨w₀, _, _, _, _, _, hiff⟩ := hT.exists_three_adj_of_not_isLeaf hleaf₀ + exact ⟨w₀, (hiff w₀).2 (Or.inl rfl)⟩ + obtain ⟨t₀, ht₀_leaf, _⟩ := exists_leaf_in_treeComponent hT hadj₀ + obtain ⟨w, hadj_t₀⟩ := hT.exists_adj_of_isLeaf ht₀_leaf + have hcomp_t₀ : treeComponent T t₀ s(t₀, w) = {t₀} := + treeComponent_eq_singleton_of_isLeaf hT hadj_t₀.1 ht₀_leaf + have he₀_G : τ t₀ ∈ G.edgeSet := hbd.bijOn.mapsTo ht₀_leaf + obtain ⟨u, v, huv_ne, hτ_t₀⟩ : ∃ u v : Fin n, u ≠ v ∧ τ t₀ = s(u, v) := by + rcases Sym2.exists.1 ⟨τ t₀, rfl⟩ with ⟨u, v, heq⟩ + rw [heq] at he₀_G + exact ⟨u, v, by simpa [G, completeGraph, Sym2.mk_isDiag_iff] using he₀_G, heq⟩ + have hex_z : ∃ z : Fin n, z ≠ u ∧ z ≠ v := by + have hne_univ : ({u, v} : Set (Fin n)) ≠ Set.univ := by + intro heq + have h1 : ({u, v} : Set (Fin n)).ncard = 2 := Set.ncard_pair huv_ne + rw [heq, ncard_univ_fin] at h1 + omega + obtain ⟨z, _, hz⟩ := Set.exists_of_ssubset + (ssubset_of_subset_of_ne (Set.subset_univ _) hne_univ) + simp only [Set.mem_insert_iff, Set.mem_singleton_iff, not_or] at hz + exact ⟨z, hz⟩ + obtain ⟨z, hzu, hzv⟩ := hex_z + have hsub_uv : ({u, v} : Set (Fin n)) ⊆ + {x ∈ G.vertexSet | ∃ t₁ ∈ leafSet T, ∃ t₂ ∈ leafSet T, + ¬ (T.deleteEdges {s(t₀, w)}).Reachable t₁ t₂ ∧ G.Inc (τ t₁) x ∧ G.Inc (τ t₂) x} := by + have hmem_of : ∀ x y : Fin n, x ≠ y → z ≠ x → z ≠ y → τ t₀ = s(x, y) → + x ∈ {x ∈ G.vertexSet | ∃ t₁ ∈ leafSet T, ∃ t₂ ∈ leafSet T, + ¬ (T.deleteEdges {s(t₀, w)}).Reachable t₁ t₂ ∧ G.Inc (τ t₁) x ∧ G.Inc (τ t₂) x} := by + intro x y hxy hzx hzy hτ_xy + have he_xz : s(x, z) ∈ G.edgeSet := by + simp [G, completeGraph, Sym2.mk_isDiag_iff, hzx.symm] + obtain ⟨t₁, ht₁_leaf, hτ_t₁⟩ := hbd.bijOn.surjOn he_xz + have ht₁_ne : t₁ ≠ t₀ := by + intro hteq + have heq_e : (s(x, z) : Sym2 (Fin n)) = s(x, y) := by + rw [← hτ_t₁, hteq, hτ_xy] + exact hzy (sym2_mk_eq_left_iff.1 heq_e) + have ht₁_w : t₁ ∈ treeComponent T w s(w, t₀) := by + apply (notMem_treeComponent_iff hT.isTree hadj_t₀.1).1 + rw [hcomp_t₀, Set.mem_singleton_iff] + exact ht₁_ne + refine ⟨Set.mem_univ x, t₀, ht₀_leaf, t₁, ht₁_leaf, ?_, ?_, ?_⟩ + · rw [not_reachable_deleteEdges_iff_treeComponent hT.isTree hadj_t₀.1] + exact Or.inl ⟨Reachable.rfl, ht₁_w⟩ + · rw [hτ_xy] + exact ⟨by simp [Sym2.mk_isDiag_iff, hxy], Sym2.mem_mk_left x y⟩ + · rw [hτ_t₁] + exact ⟨he_xz, Sym2.mem_mk_left x z⟩ + rintro x (rfl | rfl) + · exact hmem_of x v huv_ne hzu hzv hτ_t₀ + · exact hmem_of x u huv_ne.symm hzv hzu (hτ_t₀.trans Sym2.eq_swap) + have hle1 : 2 ≤ branchEdgeOrder G T τ s(t₀, w) := by + rw [← Set.ncard_pair huv_ne] + exact Set.ncard_le_ncard hsub_uv (Set.toFinite _) + exact hle1.trans (branchEdgeOrder_le_branchDecompWidth (T.mem_edgeSet.2 hadj_t₀.1)) + +/-- **Graph Minors X, (4.4)** (page 166): +"For $n \ge 0$, $K_n$ has tangle number $\lceil(2/3) n\rceil$, and for $n \ge 3$, it has +branch-width $\lceil(2/3) n\rceil$." -/ +theorem theorem_4_4_proof (n : ℕ) : + tangleNumber (completeGraph n) = (2 * n + 2) / 3 ∧ + (3 ≤ n → branchWidth (completeGraph n) = (2 * n + 2) / 3) := by + have hθ : tangleNumber (completeGraph n) = (2 * n + 2) / 3 := by + by_cases hn0 : n = 0 + · subst hn0 + have hemp : (completeGraph 0).vertexSet = ∅ := Set.eq_empty_of_isEmpty _ + rw [tangleNumber_eq_zero_iff.2 hemp] + by_cases hn1 : n = 1 + · subst hn1 + have hne : (completeGraph 1).vertexSet.Nonempty := ⟨⟨0, by omega⟩, Set.mem_univ _⟩ + rw [tangleNumber_eq_one_of_maxEdgeSize_eq_zero + (maxEdgeSize_completeGraph_of_le_one le_rfl) hne] + by_cases hn3 : n ≤ 3 + · have hn2 : 2 ≤ n := by omega + have hle := tangleNumber_completeGraph_le hn2 + have hge : 2 ≤ tangleNumber (completeGraph n) := by + rw [← maxEdgeSize_completeGraph_of_two_le hn2] + exact maxEdgeSize_le_tangleNumber (completeGraph n) + omega + · have hn4 : 4 ≤ n := by omega + exact le_antisymm (tangleNumber_completeGraph_le (by omega)) + (le_tangleNumber_completeGraph_of_four_le hn4) + refine ⟨hθ, fun hn3 ↦ ?_⟩ + have hγ2 : maxEdgeSize (completeGraph n) = 2 := + maxEdgeSize_completeGraph_of_two_le (by omega) + have h43 := theorem_4_3_proof (completeGraph n) (by simp [hγ2]) + have hbw2 : 2 ≤ branchWidth (completeGraph n) := + two_le_branchWidth_completeGraph hn3 + rw [hγ2, hθ, max_eq_left hbw2] at h43 + exact h43 + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/Defs.lean b/LeanPool/GraphMinor/GM10/Defs.lean new file mode 100644 index 0000000000..11cc8babfc --- /dev/null +++ b/LeanPool/GraphMinor/GM10/Defs.lean @@ -0,0 +1,695 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.TreePath +public import Mathlib.Combinatorics.SimpleGraph.DegreeSum +public import Mathlib.Order.Lattice.Nat +public import LeanPool.GraphMinor.Hypergraph.Basic +import Mathlib.Combinatorics.SimpleGraph.Walk.Maps + +/-! +# Definitions for Graph Minors X, Sections 1–5 + +This file formalizes the definitions of N. Robertson and P. D. Seymour, +*Graph Minors. X. Obstructions to tree-decomposition*, J. Combin. Theory Ser. B 52 (1991) 153–190, +Sections 1–5 (pages 153–170): + +- **Section 1 (pages 153–155):** vertex deletion `G \ X` (`deleteVertices`), the three tangle + axioms (`TangleAxiom1`, `TangleAxiom2`, `TangleAxiom3`), tangles of order `θ` (`IsTangle`), + the tangle number `θ(G)` (`tangleNumber`), and truncation of a tangle (`truncation`). +- **Section 2 (pages 155–159):** the size of an edge (`edgeSize`), the single-edge hypergraph `K_e` + (`edgeHypergraph`), the single-vertex edgeless hypergraph `K_v` (`vertexHypergraph`), the null + hypergraph (`⊥`) and non-null hypergraphs (`IsNonNull`), and extreme separations in a tangle + (`IsExtreme`). +- **Section 3 (pages 159–164):** connectivity functions on a finite set `E` + (`IsConnectivityFunction`), efficient sets (`IsEfficient`), biases (`IsBias`), biases extending + a set `𝒜` (`BiasExtends`), leaves of a tree (`IsLeaf`, `leafSet`), ternary trees + (`IsTernaryTree`), incidences in a tree (`IsTreeIncidence`), tree-labellings over `𝒜` + (`IsTreeLabelling`), passive incidences (`IsPassiveIncidence`), forks (`IsFork`), exact forks + (`IsExactFork`), and exact tree-labellings (`IsExactTreeLabelling`). +- **Section 4 (pages 164–167):** branch-decompositions of a hypergraph (`IsBranchDecomposition`), + the order of an edge in a branch-decomposition (`branchEdgeOrder`), the width of a + branch-decomposition (`branchDecompWidth`), branch-width `β(G)` (`branchWidth`), the maximum + edge size `γ(G)` (`maxEdgeSize`), and the complete graph `K_n` as a hypergraph (`completeGraph`). +- **Section 5 (pages 168–170):** paths in undirected trees (`OnTreePath`), tree-decompositions of + a hypergraph (`IsTreeDecomposition`), width of a tree-decomposition (`treeDecompWidthPlusOne`, + `treeDecompWidth`), and tree-width `ω(G)` (`treeWidthPlusOne`, representing `ω(G) + 1 : ℕ`, and + `treeWidth`, representing `ω(G) : ℤ`, which is `-1` when `V(G) = ∅`). +-/ + +@[expose] public section + +namespace GraphMinor + +namespace Hypergraph + +variable {α β : Type*} + +/-- `G \ X` for a set of vertices `X ⊆ V(G)` (Graph Minors X, Section 1, page 154): +"while if $X \subseteq V(G)$, $G \setminus X$ is the subhypergraph with $V(G') = V(G) - X$ +and $E(G')$ the set of those edges of $G$ incident with no vertex in $X$. We sometimes +abbreviate $G \setminus \{x\}$ to $G \setminus x$, etc." -/ +def deleteVertices (G : Hypergraph α β) (X : Set α) : Hypergraph α β where + vertexSet := G.vertexSet \ X + edgeSet := {e ∈ G.edgeSet | ∀ v ∈ X, ¬ G.Inc e v} + Inc e v := G.Inc e v ∧ ∀ w ∈ X, ¬ G.Inc e w + vertex_mem_of_inc _ _ h := ⟨G.vertex_mem_of_inc h.1, fun hv ↦ h.2 _ hv h.1⟩ + edge_mem_of_inc _ _ h := ⟨G.edge_mem_of_inc h.1, h.2⟩ + vertexSet_finite := G.vertexSet_finite.subset Set.sdiff_subset + edgeSet_finite := G.edgeSet_finite.subset fun _ h ↦ h.1 + +/-- The null hypergraph, with `V(G) = ∅` and `E(G) = ∅`. -/ +instance : Bot (Hypergraph α β) where + bot := + { vertexSet := ∅ + edgeSet := ∅ + Inc := fun _ _ ↦ False + vertex_mem_of_inc := fun _ _ h ↦ h.elim + edge_mem_of_inc := fun _ _ h ↦ h.elim + vertexSet_finite := Set.finite_empty + edgeSet_finite := Set.finite_empty } + +instance : OrderBot (Hypergraph α β) where + bot_le _ := ⟨Set.empty_subset _, Set.empty_subset _, fun _ h ↦ h.elim⟩ + +end Hypergraph + +namespace GM10 + +open SimpleGraph Hypergraph + +variable {α β ι ι' : Type*} + +/-! ## Section 1: Tangles -/ + +export Hypergraph (deleteVertices) + +/-- The first tangle axiom (Graph Minors X, Section 1, page 154): +"(i) for every separation $(A, B)$ of $G$ of order $< \theta$, one of $(A, B)$, $(B, A)$ is +in $\mathscr{T}$" -/ +def TangleAxiom1 (G : Hypergraph α β) (θ : ℕ) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) : Prop := + ∀ ⦃A B : Hypergraph α β⦄, G.IsSeparation A B → separationOrder A B < θ → + (A, B) ∈ 𝒯 ∨ (B, A) ∈ 𝒯 + +/-- The second tangle axiom (Graph Minors X, Section 1, page 154): +"(ii) if $(A_1, B_1), (A_2, B_2), (A_3, B_3) \in \mathscr{T}$ then $A_1 \cup A_2 \cup A_3 \ne G$" -/ +def TangleAxiom2 (G : Hypergraph α β) (𝒯 : Set (Hypergraph α β × Hypergraph α β)) : Prop := + ∀ ⦃A₁ B₁ A₂ B₂ A₃ B₃ : Hypergraph α β⦄, + (A₁, B₁) ∈ 𝒯 → (A₂, B₂) ∈ 𝒯 → (A₃, B₃) ∈ 𝒯 → A₁ ∪ A₂ ∪ A₃ ≠ G + +/-- The third tangle axiom (Graph Minors X, Section 1, page 154): +"(iii) if $(A, B) \in \mathscr{T}$ then $V(A) \ne V(G)$." -/ +def TangleAxiom3 (G : Hypergraph α β) (𝒯 : Set (Hypergraph α β × Hypergraph α β)) : Prop := + ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ 𝒯 → A.vertexSet ≠ G.vertexSet + +/-- The tangle induced in `G` by a tangle in `H`, obtained by restricting each separation +to `H` while retaining the order bound in `G`. -/ +def inducedTangleFromSubgraph (G H : Hypergraph α β) (θ : ℕ) + (T : Set (Hypergraph α β × Hypergraph α β)) : Set (Hypergraph α β × Hypergraph α β) := + {p | G.IsSeparation p.1 p.2 ∧ separationOrder p.1 p.2 < θ ∧ (p.1 ∩ H, p.2 ∩ H) ∈ T} + +/-- A tangle in `G` of order `θ` (Graph Minors X, Section 1, page 154): +"Let $G$ be a hypergraph and let $\theta \ge 1$ be an integer. A *tangle* in $G$ of *order* +$\theta$ is a set $\mathscr{T}$ of separations of $G$, each of order $< \theta$, such that +(i) for every separation $(A, B)$ of $G$ of order $< \theta$, one of $(A, B)$, $(B, A)$ is +in $\mathscr{T}$ (ii) if $(A_1, B_1), (A_2, B_2), (A_3, B_3) \in \mathscr{T}$ then $A_1 \cup +A_2 \cup A_3 \ne G$ (iii) if $(A, B) \in \mathscr{T}$ then $V(A) \ne V(G)$. We refer to +these as the *first*, *second*, and *third (tangle) axioms*." -/ +structure IsTangle (G : Hypergraph α β) (θ : ℕ) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) : Prop where + /-- The order of a tangle satisfies `θ ≥ 1`. -/ + one_le : 1 ≤ θ + /-- Every member of `𝒯` is a separation of `G`. -/ + isSeparation : ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ 𝒯 → G.IsSeparation A B + /-- Every member of `𝒯` has order `< θ`. -/ + order_lt : ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ 𝒯 → separationOrder A B < θ + /-- The first tangle axiom (i). -/ + axiom1 : TangleAxiom1 G θ 𝒯 + /-- The second tangle axiom (ii). -/ + axiom2 : TangleAxiom2 G 𝒯 + /-- The third tangle axiom (iii). -/ + axiom3 : TangleAxiom3 G 𝒯 + +/-- The tangle number `θ(G)` of `G` (Graph Minors X, Section 1, page 154): +"The *tangle number* of $G$, denoted $\theta(G)$, is the maximum order of tangles in $G$ (or +0, if there are no tangles)." -/ +noncomputable def tangleNumber (G : Hypergraph α β) : ℕ := + sSup {θ : ℕ | ∃ 𝒯, IsTangle G θ 𝒯} + +/-- The truncation of a tangle `𝒯` to order `θ'` (Graph Minors X, Section 1, page 155, and +Section 6, page 170): +"Let $\mathscr{T}$ be a tangle of order $\theta$ in a hypergraph $G$, let $1 \le \theta' \le +\theta$, and let $\mathscr{T}'$ be the set of all members of $\mathscr{T}$ with order $< +\theta'$. Then it is easy to see that $\mathscr{T}'$ is a tangle in $G$ of order $\theta'$; +we call $\mathscr{T}'$ the *truncation* of $\mathscr{T}$ to order $\theta'$." -/ +def truncation (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (θ' : ℕ) : + Set (Hypergraph α β × Hypergraph α β) := + {p ∈ 𝒯 | separationOrder p.1 p.2 < θ'} + +/-! ## Section 2: Some Tangle Lemmas -/ + +/-- The size of an edge `e` of `G` (Graph Minors X, Section 2, page 156): +"For an edge $e$ of a hypergraph $G$, the *ends* of $e$ are the vertices of $G$ incident with +$e$, and the *size* of $e$ is the number of ends of $e$." -/ +noncomputable def edgeSize (G : Hypergraph α β) (e : β) : ℕ := + (G.ends e).ncard + +/-- The hypergraph `K_e` formed by an edge `e` and its ends in `G` +(Graph Minors X, Section 2, (2.7), page 157): +"where $K_e$ is the hypergraph formed by $e$ and its ends." -/ +def edgeHypergraph (G : Hypergraph α β) (e : β) : Hypergraph α β where + vertexSet := G.ends e + edgeSet := {e} + Inc e' v := e' = e ∧ G.Inc e v + vertex_mem_of_inc _ _ h := h.2 + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := G.vertexSet_finite.subset fun _ h ↦ G.vertex_mem_of_inc h + edgeSet_finite := Set.finite_singleton e + +/-- The hypergraph `K_v` with vertex set `{v}` and no edges +(Graph Minors X, Section 2, proofs of (2.3) and (2.8), pages 155 and 157): +"Let $K_v$ be the hypergraph with vertex set $\{v\}$ and with no edges." -/ +def vertexHypergraph (v : α) : Hypergraph α β where + vertexSet := {v} + edgeSet := ∅ + Inc _ _ := False + vertex_mem_of_inc _ _ h := h.elim + edge_mem_of_inc _ _ h := h.elim + vertexSet_finite := Set.finite_singleton v + edgeSet_finite := Set.finite_empty + +/-- A hypergraph `G` is non-null if it is not the null hypergraph `⊥`, that is, `V(G) ≠ ∅` or +`E(G) ≠ ∅` (Graph Minors X, Section 2, (2.8), page 157). -/ +def IsNonNull (G : Hypergraph α β) : Prop := + G.vertexSet.Nonempty ∨ G.edgeSet.Nonempty + +/-- A separation `(A, B) ∈ 𝒯` is extreme in `𝒯` (Graph Minors X, Section 2, page 157): +"Let $\mathscr{T}$ be a tangle in a hypergraph $G$. A separation $(A, B)\in \mathscr{T}$ is +*extreme* if $A' = A$ and $B' = B$ for every $(A', B')\in \mathscr{T}$ with $A\subseteq A'$ +and $B'\subseteq B$." -/ +def IsExtreme (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (A B : Hypergraph α β) : Prop := + (A, B) ∈ 𝒯 ∧ ∀ ⦃A' B' : Hypergraph α β⦄, (A', B') ∈ 𝒯 → A ≤ A' → B' ≤ B → A' = A ∧ B' = B + +/-! ## Section 3: A Lemma About Submodular Functions -/ + +/-- A connectivity function on a set `E` (Graph Minors X, Section 3, page 159): +"Let $E$ be a finite set. A *connectivity function* on $E$ is a function $\kappa$ from the +set of all subsets of $E$ to the set of integers such that (i) for $X\subseteq E$, +$\kappa(X) = \kappa(E - X)$ (ii) for $X, Y\subseteq E$, $\kappa(X\cup Y) + \kappa(X\cap +Y)\le \kappa(X) + \kappa(Y)$." -/ +structure IsConnectivityFunction (E : Set β) (κ : Set β → ℤ) : Prop where + /-- (i) For `X ⊆ E`, `κ(X) = κ(E - X)`. -/ + compl_eq : ∀ ⦃X : Set β⦄, X ⊆ E → κ X = κ (E \ X) + /-- (ii) For `X, Y ⊆ E`, `κ(X ∪ Y) + κ(X ∩ Y) ≤ κ(X) + κ(Y)`. -/ + submodular : ∀ ⦃X Y : Set β⦄, X ⊆ E → Y ⊆ E → κ (X ∪ Y) + κ (X ∩ Y) ≤ κ X + κ Y + +/-- A subset `X ⊆ E` is efficient for `κ` (Graph Minors X, Section 3, page 159): +"A subset $X\subseteq E$ is *efficient* if $\kappa(X)\le 0$." -/ +def IsEfficient (E : Set β) (κ : Set β → ℤ) (X : Set β) : Prop := + X ⊆ E ∧ κ X ≤ 0 + +/-- A bias for `(E, κ)` (Graph Minors X, Section 3, page 159): +"A *bias* is a set $\mathscr{B}$ of efficient sets, such that (i) if $X\subseteq E$ is +efficient then $\mathscr{B}$ contains one of $X, E - X$ (ii) if $X, Y, Z\in \mathscr{B}$ +then $X\cup Y\cup Z\ne E$." -/ +structure IsBias (E : Set β) (κ : Set β → ℤ) (ℬ : Set (Set β)) : Prop where + /-- Every member of `ℬ` is an efficient subset of `E`. -/ + isEfficient : ∀ ⦃X : Set β⦄, X ∈ ℬ → IsEfficient E κ X + /-- (i) If `X ⊆ E` is efficient then `ℬ` contains one of `X, E - X`. -/ + mem_or_compl_mem : ∀ ⦃X : Set β⦄, IsEfficient E κ X → X ∈ ℬ ∨ E \ X ∈ ℬ + /-- (ii) If `X, Y, Z ∈ ℬ` then `X ∪ Y ∪ Z ≠ E`. -/ + union_ne : ∀ ⦃X Y Z : Set β⦄, X ∈ ℬ → Y ∈ ℬ → Z ∈ ℬ → X ∪ Y ∪ Z ≠ E + +/-- A bias `ℬ` extends a set `𝒜` of efficient sets (Graph Minors X, Section 3, page 159): +"A bias $\mathscr{B}$ is said to *extend* a set $\mathscr{A}$ of efficient sets if +$\mathscr{A}\subseteq \mathscr{B}$." -/ +def BiasExtends (E : Set β) (κ : Set β → ℤ) (𝒜 ℬ : Set (Set β)) : Prop := + IsBias E κ ℬ ∧ 𝒜 ⊆ ℬ + +open Classical in +/-- A vertex `v` of a tree `T` is a leaf if it has valency `≤ 1` +(Graph Minors X, Section 3, page 159): +"A tree is a connected non-null graph with no circuits; its vertices of valency $\le 1$ are +its *leaves*." -/ +def IsLeaf [Fintype ι] (T : SimpleGraph ι) (v : ι) : Prop := + T.degree v ≤ 1 + +/-- The set of leaves of `T`. -/ +def leafSet [Fintype ι] (T : SimpleGraph ι) : Set ι := + {v | IsLeaf T v} + +open Classical in +/-- A tree `T` is ternary if every vertex has valency `1` or `3` +(Graph Minors X, Section 3, page 159): +"A tree is *ternary* if every vertex has valency $1$ or $3$. (Thus, ternary trees have $\ge +2$ leaves.)" -/ +structure IsTernaryTree [Fintype ι] (T : SimpleGraph ι) : Prop where + /-- `T` is a tree (connected, non-null, and acyclic). -/ + isTree : T.IsTree + /-- Every vertex of `T` has valency `1` or `3`. -/ + degree_eq_one_or_three : ∀ v : ι, T.degree v = 1 ∨ T.degree v = 3 + +/-- An incidence in a tree `T` (Graph Minors X, Section 3, page 159): +"An *incidence* in a tree $T$ is a pair $(v, e)$, where $v\in V(T)$, $e\in E(T)$, and $e$ is +incident with $v$." -/ +def IsTreeIncidence (T : SimpleGraph ι) (v : ι) (e : Sym2 ι) : Prop := + e ∈ T.incidenceSet v + +open Classical in +/-- A tree-labelling `(T, α)` over `𝒜` (Graph Minors X, Section 3, pages 159–160): +"A *tree-labelling over* $\mathscr{A}$ is a pair $(T, \alpha)$, where $T$ is a ternary tree, +and $\alpha$ is a function from the set of all incidences in $T$ to the set of efficient +subsets of $E$, such that ... (i) for each $e\in E(T)$ with ends $u, v$, say, $\alpha(u, e) = E +- \alpha(v, e)$ (ii) for each incidence $(v, e)$ in $T$ such that $v$ is a leaf, either +$\alpha(v, e) = E$ or $\alpha(v, e)\cup X = E$ for some $X\in \mathscr{A}$ (iii) if $v\in +V(T)$ has valency $3$, incident with $e_1, e_2, e_3$, say, then $\alpha(v, e_1)\cup +\alpha(v, e_2)\cup \alpha(v, e_3) = E$." -/ +structure IsTreeLabelling [Fintype ι] (E : Set β) (κ : Set β → ℤ) (𝒜 : Set (Set β)) + (T : SimpleGraph ι) (α : ι → Sym2 ι → Set β) : Prop where + /-- `T` is a ternary tree. -/ + isTernaryTree : IsTernaryTree T + /-- `α` maps every incidence of `T` to an efficient subset of `E`. -/ + isEfficient : ∀ ⦃v : ι⦄ ⦃e : Sym2 ι⦄, IsTreeIncidence T v e → IsEfficient E κ (α v e) + /-- (i) For each edge `s(u, v)` of `T` with ends `u, v`, `α(u, e) = E - α(v, e)`. -/ + compl_eq : ∀ ⦃u v : ι⦄, T.Adj u v → α u s(u, v) = E \ α v s(u, v) + /-- (ii) For each incidence `(v, e)` in `T` such that `v` is a leaf, either `α(v, e) = E` or + `α(v, e) ∪ X = E` for some `X ∈ 𝒜`. -/ + leaf_eq_or_union_eq : ∀ ⦃v : ι⦄ ⦃e : Sym2 ι⦄, IsTreeIncidence T v e → IsLeaf T v → + α v e = E ∨ ∃ X ∈ 𝒜, α v e ∪ X = E + /-- (iii) If `v ∈ V(T)` has valency `3`, incident with distinct `e₁, e₂, e₃`, then + `α(v, e₁) ∪ α(v, e₂) ∪ α(v, e₃) = E`. -/ + degree_three_union_eq : ∀ ⦃v : ι⦄ ⦃e₁ e₂ e₃ : Sym2 ι⦄, + IsTreeIncidence T v e₁ → IsTreeIncidence T v e₂ → IsTreeIncidence T v e₃ → + e₁ ≠ e₂ → e₁ ≠ e₃ → e₂ ≠ e₃ → α v e₁ ∪ α v e₂ ∪ α v e₃ = E + +/-- An incidence `(v, e)` of `T` is passive with respect to a bias `ℬ` and a tree-labelling `α` +(Graph Minors X, Section 3, proof of (3.1), page 160): +"An incidence $(v, e)$ of $T$ is *passive* if $\alpha(v, e)\notin \mathscr{B}$." -/ +def IsPassiveIncidence (T : SimpleGraph ι) (α : ι → Sym2 ι → Set β) (ℬ : Set (Set β)) + (v : ι) (e : Sym2 ι) : Prop := + IsTreeIncidence T v e ∧ α v e ∉ ℬ + +/-- A fork `{e₁, e₂}` in `T` with nub `t` (Graph Minors X, Section 3, page 160): +"A *fork* in $T$ is an unordered pair $\{e_1, e_2\}$ of distinct edges of $T$ with a common +end (the *nub* of the fork)." -/ +def IsFork (T : SimpleGraph ι) (t : ι) (e₁ e₂ : Sym2 ι) : Prop := + IsTreeIncidence T t e₁ ∧ IsTreeIncidence T t e₂ ∧ e₁ ≠ e₂ + +/-- A fork `{e₁, e₂}` with nub `t` is exact for `α` (Graph Minors X, Section 3, page 160): +"A fork $\{e_1, e_2\}$ with nub $t$ is *exact* (for $\alpha$) if $\alpha(t, e_1)\cap +\alpha(t, e_2) = \emptyset$." -/ +def IsExactFork (α : ι → Sym2 ι → Set β) (t : ι) (e₁ e₂ : Sym2 ι) : Prop := + α t e₁ ∩ α t e₂ = ∅ + +/-- An exact tree-labelling `(T, α)` over `𝒜` (Graph Minors X, Section 3, page 160): +"We say that $(T, \alpha)$ is *exact* if every fork of $T$ is exact." -/ +structure IsExactTreeLabelling [Fintype ι] (E : Set β) (κ : Set β → ℤ) (𝒜 : Set (Set β)) + (T : SimpleGraph ι) (α : ι → Sym2 ι → Set β) : Prop where + /-- `(T, α)` is a tree-labelling over `𝒜`. -/ + isTreeLabelling : IsTreeLabelling E κ 𝒜 T α + /-- Every fork of `T` is exact for `α`. -/ + isExactFork : ∀ ⦃t : ι⦄ ⦃e₁ e₂ : Sym2 ι⦄, IsFork T t e₁ e₂ → IsExactFork α t e₁ e₂ + +/-! ## Section 4: Branch-Width -/ + +/-- `(T, τ)` is a branch-decomposition of a hypergraph `G` (Graph Minors X, Section 4, page 164): +"A *branch-decomposition* of a hypergraph $G$ is a pair $(T, \tau)$, where $T$ is a ternary +tree and $\tau$ is a bijection from the set of leaves of $T$ to $E(G)$." -/ +structure IsBranchDecomposition [Fintype ι] (G : Hypergraph α β) (T : SimpleGraph ι) + (τ : ι → β) : Prop where + /-- `T` is a ternary tree. -/ + isTernaryTree : IsTernaryTree T + /-- `τ` is a bijection from the set of leaves of `T` to `E(G)`. -/ + bijOn : Set.BijOn τ (leafSet T) G.edgeSet + +/-- The order of an edge `e` of `T` in a branch-decomposition `(T, τ)` of `G` +(Graph Minors X, Section 4, page 164): +"The *order* of an edge $e$ of $T$ is the number of vertices $v$ of $G$ such that there are +leaves $t_1, t_2$ of $T$ in different components of $T \setminus e$, with $\tau(t_1), +\tau(t_2)$ both incident with $v$." -/ +noncomputable def branchEdgeOrder [Fintype ι] (G : Hypergraph α β) (T : SimpleGraph ι) + (τ : ι → β) (e : Sym2 ι) : ℕ := + {v ∈ G.vertexSet | ∃ t₁ ∈ leafSet T, ∃ t₂ ∈ leafSet T, + ¬ (T.deleteEdges {e}).Reachable t₁ t₂ ∧ G.Inc (τ t₁) v ∧ G.Inc (τ t₂) v}.ncard + +/-- The width of a branch-decomposition `(T, τ)` of `G` (Graph Minors X, Section 4, page 164): +"The *width* of $(T, \tau)$ is the maximum order of the edges of $T$" -/ +noncomputable def branchDecompWidth [Fintype ι] (G : Hypergraph α β) (T : SimpleGraph ι) + (τ : ι → β) : ℕ := + sSup (branchEdgeOrder G T τ '' T.edgeSet) + +/-- The branch-width `β(G)` of `G` (Graph Minors X, Section 4, page 164): +"the *branch-width* $\beta(G)$ of $G$ is the minimum width of all branch-decompositions of +$G$ (or 0 if $|E(G)| \le 1$, when $G$ has no branch-decompositions)." + +The infimum quantifies over trees whose vertex type `ι` lies in `Type`; see +`IsBranchDecomposition.relabel` and `branchWidth_le_of_isBranchDecomposition` for any finite index +type `ι : Type*`. When `|E(G)| ≤ 1`, `G` has no branch-decompositions and `sInf ∅ = 0`. -/ +noncomputable def branchWidth (G : Hypergraph α β) : ℕ := + sInf {w : ℕ | ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → β), + IsBranchDecomposition G T τ ∧ branchDecompWidth G T τ = w} + +/-- `γ(G)`, the maximum size of an edge of `G` (Graph Minors X, Section 4, page 165): +"We denote by $\gamma(G)$ the maximum size of an edge of $G$ (setting $\gamma(G) = 0$ if +$E(G) = \emptyset$)." -/ +noncomputable def maxEdgeSize (G : Hypergraph α β) : ℕ := + sSup (edgeSize G '' G.edgeSet) + +/-- The complete graph `K_n` on `n` vertices, as a hypergraph with vertex set `Fin n` and an edge +`s(u, v)` for every pair of distinct vertices `u, v : Fin n` +(Graph Minors X, Section 4, (4.4), page 166). -/ +def completeGraph (n : ℕ) : Hypergraph (Fin n) (Sym2 (Fin n)) where + vertexSet := Set.univ + edgeSet := {e : Sym2 (Fin n) | ¬ e.IsDiag} + Inc e v := ¬ e.IsDiag ∧ v ∈ e + vertex_mem_of_inc _ _ _ := Set.mem_univ _ + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := Set.finite_univ + edgeSet_finite := Set.toFinite _ + +/-! ## Section 5: Branch-Width and Tree-Width -/ + +/-- `t'` lies on the path of `T` between `t` and `t''`: every path in `T` from `t` to `t''` +contains `t'`. In a tree there is a unique such path (`SimpleGraph.IsTree.existsUnique_path`). -/ +abbrev OnTreePath (T : SimpleGraph ι) (t t'' t' : ι) : Prop := + GraphMinor.TreePath.OnTreePath T t t'' t' + +/-- `(T, τ)` is a tree-decomposition of a hypergraph `G` (Graph Minors X, Section 5, page 168): +"A tree-decomposition of a hypergraph $G$ is a pair $(T, \tau)$, where $T$ is a tree and for +$t \in V(T)$, $\tau(t)$ is a subhypergraph of $G$ with the following properties: (i) +$\bigcup (\tau(t) : t \in V(T)) = G$ (ii) for distinct $t, t' \in V(T)$, $E(\tau(t) \cap +\tau(t')) = \emptyset$ (iii) for $t, t', t'' \in V(T)$, if $t'$ is on the path of $T$ +between $t$ and $t''$ then $\tau(t) \cap \tau(t'') \subseteq \tau(t')$." -/ +structure IsTreeDecomposition [Fintype ι] (G : Hypergraph α β) (T : SimpleGraph ι) + (τ : ι → Hypergraph α β) : Prop where + /-- `T` is a tree. -/ + isTree : T.IsTree + /-- Each `τ(t)` is a subhypergraph of `G`. -/ + le : ∀ t : ι, τ t ≤ G + /-- (i) `⋃ (τ(t) : t ∈ V(T)) = G`. -/ + biUnion_eq : Hypergraph.biUnion Finset.univ τ = G + /-- (ii) For distinct `t, t' ∈ V(T)`, `E(τ(t) ∩ τ(t')) = ∅`. -/ + edgeSet_inter_eq : ∀ ⦃t t' : ι⦄, t ≠ t' → (τ t ∩ τ t').edgeSet = ∅ + /-- (iii) For `t, t', t'' ∈ V(T)`, if `t'` is on the path of `T` between `t` and `t''` then + `τ(t) ∩ τ(t'') ⊆ τ(t')`. -/ + inter_le : ∀ ⦃t t' t'' : ι⦄, OnTreePath T t t'' t' → τ t ∩ τ t'' ≤ τ t' + +/-- One plus the width of a tree-decomposition `(T, τ)`: `max_{t ∈ V(T)} |V(τ(t))|` as a natural +number (Graph Minors X, Section 5, page 168). -/ +noncomputable def treeDecompWidthPlusOne (τ : ι → Hypergraph α β) : ℕ := + sSup (Set.range fun t : ι ↦ (τ t).vertexSet.ncard) + +/-- The width of a tree-decomposition `(T, τ)` as an integer (Graph Minors X, Section 5, page 168): +"The width of such a tree-decomposition is the maximum of $(|V(\tau(t))| - 1)$, taken over +all $t \in V(T)$" -/ +noncomputable def treeDecompWidth (τ : ι → Hypergraph α β) : ℤ := + (treeDecompWidthPlusOne τ : ℤ) - 1 + +/-- `ω(G) + 1` as a natural number (Graph Minors X, Section 5, page 168): +"the tree-width $\omega(G)$ of $G$ is the minimum width of all tree-decomposition of $G$. (Thus, +$\omega(G) \ge 0$ unless $V(G) = \emptyset$, when $\omega(G) = -1$.)" + +Since `ω(G) = -1` when `V(G) = ∅` and Sections 5's main theorems (5.1) and (5.2) are stated in +terms of `ω(G) + 1`, we define `treeWidthPlusOne G : ℕ` as the minimum of +`treeDecompWidthPlusOne τ` over all tree-decompositions `(T, τ)` of `G` (with vertex type in +`Type`; see `IsTreeDecomposition.relabel` and `treeWidthPlusOne_le_of_isTreeDecomposition`), and +`treeWidth G : ℤ` as `(treeWidthPlusOne G : ℤ) - 1`. -/ +noncomputable def treeWidthPlusOne (G : Hypergraph α β) : ℕ := + sInf {w : ℕ | ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α β), + IsTreeDecomposition G T τ ∧ treeDecompWidthPlusOne τ = w} + +/-- The tree-width `ω(G)` of `G` as an integer (Graph Minors X, Section 5, page 168): +`ω(G) = (ω(G) + 1) - 1`, which is `-1` when `V(G) = ∅` and `≥ 0` otherwise. -/ +noncomputable def treeWidth (G : Hypergraph α β) : ℤ := + (treeWidthPlusOne G : ℤ) - 1 + +/-! ## Relabelling of trees in branch- and tree-decompositions -/ + +/-- The graph isomorphism `T ≃g T.map e.toEmbedding` induced by an equivalence `e : ι ≃ ι'`. -/ +def mapIso (T : SimpleGraph ι) (e : ι ≃ ι') : T ≃g T.map e.toEmbedding where + toEquiv := e + map_rel_iff' := (SimpleGraph.Iso.map e T).map_rel_iff + +/-- Relabelling a tree along `e : ι ≃ ι'` preserves degrees, regardless of the `Fintype` instances +on the neighbor sets. -/ +theorem degree_map_equiv (T : SimpleGraph ι) (e : ι ≃ ι') (v : ι) + {inst₁ : Fintype ((T.map e.toEmbedding).neighborSet (e v))} + {inst₂ : Fintype (T.neighborSet v)} : + @SimpleGraph.degree _ (T.map e.toEmbedding) (e v) inst₁ = + @SimpleGraph.degree _ T v inst₂ := by + rw [← @SimpleGraph.ncard_neighborSet _ _ _ inst₁, + ← @SimpleGraph.ncard_neighborSet _ _ _ inst₂] + refine Set.ncard_congr (fun x _ ↦ e.symm x) ?_ (fun _ _ _ _ h ↦ e.symm.injective h) ?_ + · intro x hx + have hx' : (T.map e.toEmbedding).Adj (mapIso T e v) (mapIso T e (e.symm x)) := by + change (T.map e.toEmbedding).Adj (e v) (e (e.symm x)) + rw [e.apply_symm_apply] + exact hx + exact (mapIso T e).map_rel_iff.1 hx' + · intro y hy + exact ⟨e y, (mapIso T e).map_rel_iff.2 hy, e.symm_apply_apply y⟩ + +open Classical in +/-- Relabelling the vertex type of a tree along an equivalence `e : ι ≃ ι'` preserves `IsLeaf`. -/ +theorem isLeaf_map [Fintype ι] [Fintype ι'] {T : SimpleGraph ι} (e : ι ≃ ι') (v : ι) : + IsLeaf (T.map e.toEmbedding) (e v) ↔ IsLeaf T v := by + unfold IsLeaf + rw [degree_map_equiv T e v] + +/-- Relabelling the vertex type of a tree along an equivalence `e : ι ≃ ι'` maps `leafSet T` to +`leafSet (T.map e.toEmbedding)`. -/ +theorem leafSet_map [Fintype ι] [Fintype ι'] {T : SimpleGraph ι} (e : ι ≃ ι') : + leafSet (T.map e.toEmbedding) = e '' leafSet T := by + ext w + obtain ⟨v, rfl⟩ := e.surjective w + simp only [leafSet, Set.mem_ofPred_eq, isLeaf_map, Set.mem_image, EmbeddingLike.apply_eq_iff_eq, + exists_eq_right] + +open Classical in +/-- Relabelling a ternary tree along an equivalence `e : ι ≃ ι'` gives a ternary tree. -/ +theorem IsTernaryTree.map [Fintype ι] [Fintype ι'] {T : SimpleGraph ι} (hT : IsTernaryTree T) + (e : ι ≃ ι') : IsTernaryTree (T.map e.toEmbedding) where + isTree := (mapIso T e).isTree_iff.1 hT.isTree + degree_eq_one_or_three w := by + obtain ⟨v, rfl⟩ := e.surjective w + rw [degree_map_equiv T e v] + exact hT.degree_eq_one_or_three v + +/-- Relabelling a tree-labelling `α` along an equivalence `e : ι ≃ ι'`. -/ +def relabelLabelling (e : ι ≃ ι') (α : ι → Sym2 ι → Set β) : ι' → Sym2 ι' → Set β := + fun v' f' ↦ α (e.symm v') (f'.map e.symm) + +/-- Relabelling a tree along `e : ι ≃ ι'` preserves `IsTreeIncidence`. -/ +theorem isTreeIncidence_map {T : SimpleGraph ι} (e : ι ≃ ι') (v : ι) (f : Sym2 ι) : + IsTreeIncidence (T.map e.toEmbedding) (e v) (f.map e) ↔ IsTreeIncidence T v f := by + induction f using Sym2.ind with | _ x y => + change s(e x, e y) ∈ (T.map e.toEmbedding).edgeSet ∧ e v ∈ s(e x, e y) ↔ + s(x, y) ∈ T.edgeSet ∧ v ∈ s(x, y) + simp only [SimpleGraph.mem_edgeSet, Sym2.mem_iff, e.injective.eq_iff] + exact and_congr_left fun _ ↦ (mapIso T e).map_rel_iff + +/-- Relabelling a tree-labelling `(T, α)` along an equivalence `e : ι ≃ ι'` gives a tree-labelling +`(T.map e.toEmbedding, relabelLabelling e α)`. -/ +theorem IsTreeLabelling.relabel [Fintype ι] [Fintype ι'] {E : Set β} {κ : Set β → ℤ} + {𝒜 : Set (Set β)} {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} + (h : IsTreeLabelling E κ 𝒜 T α) (e : ι ≃ ι') : + IsTreeLabelling E κ 𝒜 (T.map e.toEmbedding) (relabelLabelling e α) where + isTernaryTree := h.isTernaryTree.map e + isEfficient {v' f'} hinc := by + obtain ⟨v, rfl⟩ := e.surjective v' + obtain ⟨f, rfl⟩ : ∃ f : Sym2 ι, Sym2.map e f = f' := by + induction f' using Sym2.ind with | _ x' y' => + exact ⟨s(e.symm x', e.symm y'), by simp⟩ + rw [isTreeIncidence_map] at hinc + simpa [relabelLabelling, Sym2.map_map] using h.isEfficient hinc + compl_eq {u' v'} hadj := by + obtain ⟨u, rfl⟩ := e.surjective u' + obtain ⟨v, rfl⟩ := e.surjective v' + have hadj' : T.Adj u v := (mapIso T e).map_rel_iff.1 hadj + simpa [relabelLabelling] using h.compl_eq hadj' + leaf_eq_or_union_eq {v' f'} hinc hleaf := by + obtain ⟨v, rfl⟩ := e.surjective v' + obtain ⟨f, rfl⟩ : ∃ f : Sym2 ι, Sym2.map e f = f' := by + induction f' using Sym2.ind with | _ x' y' => + exact ⟨s(e.symm x', e.symm y'), by simp⟩ + rw [isTreeIncidence_map] at hinc + rw [isLeaf_map] at hleaf + simpa [relabelLabelling, Sym2.map_map] using h.leaf_eq_or_union_eq hinc hleaf + degree_three_union_eq {v' e₁' e₂' e₃'} h₁ h₂ h₃ h12 h13 h23 := by + obtain ⟨v, rfl⟩ := e.surjective v' + obtain ⟨e₁, rfl⟩ : ∃ f : Sym2 ι, Sym2.map e f = e₁' := by + induction e₁' using Sym2.ind with | _ x' y' => exact ⟨s(e.symm x', e.symm y'), by simp⟩ + obtain ⟨e₂, rfl⟩ : ∃ f : Sym2 ι, Sym2.map e f = e₂' := by + induction e₂' using Sym2.ind with | _ x' y' => exact ⟨s(e.symm x', e.symm y'), by simp⟩ + obtain ⟨e₃, rfl⟩ : ∃ f : Sym2 ι, Sym2.map e f = e₃' := by + induction e₃' using Sym2.ind with | _ x' y' => exact ⟨s(e.symm x', e.symm y'), by simp⟩ + rw [isTreeIncidence_map] at h₁ h₂ h₃ + simpa [relabelLabelling, Sym2.map_map] using + h.degree_three_union_eq h₁ h₂ h₃ (ne_of_apply_ne _ h12) (ne_of_apply_ne _ h13) + (ne_of_apply_ne _ h23) + +/-- Relabelling an exact tree-labelling `(T, α)` along an equivalence `e : ι ≃ ι'` gives an exact +tree-labelling. -/ +theorem IsExactTreeLabelling.relabel [Fintype ι] [Fintype ι'] {E : Set β} {κ : Set β → ℤ} + {𝒜 : Set (Set β)} {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} + (h : IsExactTreeLabelling E κ 𝒜 T α) (e : ι ≃ ι') : + IsExactTreeLabelling E κ 𝒜 (T.map e.toEmbedding) (relabelLabelling e α) where + isTreeLabelling := h.isTreeLabelling.relabel e + isExactFork {t' e₁' e₂'} hf := by + rcases hf with ⟨h₁, h₂, h12⟩ + obtain ⟨t, rfl⟩ := e.surjective t' + obtain ⟨e₁, rfl⟩ : ∃ f : Sym2 ι, Sym2.map e f = e₁' := by + induction e₁' using Sym2.ind with | _ x' y' => exact ⟨s(e.symm x', e.symm y'), by simp⟩ + obtain ⟨e₂, rfl⟩ : ∃ f : Sym2 ι, Sym2.map e f = e₂' := by + induction e₂' using Sym2.ind with | _ x' y' => exact ⟨s(e.symm x', e.symm y'), by simp⟩ + rw [isTreeIncidence_map] at h₁ h₂ + simpa [IsExactFork, relabelLabelling, Sym2.map_map] using + h.isExactFork ⟨h₁, h₂, ne_of_apply_ne _ h12⟩ + +/-- Relabelling a branch-decomposition `(T, τ)` along an equivalence `e : ι ≃ ι'` gives a +branch-decomposition `(T.map e.toEmbedding, τ ∘ e.symm)`. -/ +theorem IsBranchDecomposition.relabel [Fintype ι] [Fintype ι'] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → β} (h : IsBranchDecomposition G T τ) (e : ι ≃ ι') : + IsBranchDecomposition G (T.map e.toEmbedding) (τ ∘ e.symm) where + isTernaryTree := h.isTernaryTree.map e + bijOn := by + rw [leafSet_map] + refine h.bijOn.comp ⟨?_, fun x _ y _ hxy ↦ e.symm.injective hxy, ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + simpa using hx + · rintro x hx + exact ⟨e x, ⟨x, hx, rfl⟩, e.symm_apply_apply x⟩ + +/-- Relabelling a branch-decomposition preserves the order of every edge. -/ +theorem branchEdgeOrder_map [Fintype ι] [Fintype ι'] (G : Hypergraph α β) (T : SimpleGraph ι) + (τ : ι → β) (e : ι ≃ ι') (f : Sym2 ι) : + branchEdgeOrder G (T.map e.toEmbedding) (τ ∘ e.symm) (f.map e) = + branchEdgeOrder G T τ f := by + classical + simp only [branchEdgeOrder] + congr 1 + ext v + simp only [Set.mem_sep_iff, leafSet_map, Set.mem_image, exists_exists_and_eq_and, + Function.comp_apply, Equiv.symm_apply_apply] + refine and_congr_right fun _ ↦ exists_congr fun t₁ ↦ and_congr_right fun _ ↦ + exists_congr fun t₂ ↦ and_congr_right fun _ ↦ and_congr_left fun _ ↦ not_congr ?_ + let φ : (T.deleteEdges {f}) ≃g ((T.map e.toEmbedding).deleteEdges {f.map e}) := + { toEquiv := e + map_rel_iff' := by + intro x y + simp only [SimpleGraph.deleteEdges_adj, Set.mem_singleton_iff] + refine and_congr (SimpleGraph.Iso.map e T).map_rel_iff (not_congr ?_) + have : s(e x, e y) = Sym2.map e s(x, y) := rfl + rw [this, (Sym2.map.injective e.injective).eq_iff] } + exact ⟨fun ⟨w⟩ ↦ ⟨(w.map φ.symm.toHom).copy (e.symm_apply_apply _) (e.symm_apply_apply _)⟩, + fun ⟨w⟩ ↦ ⟨w.map φ.toHom⟩⟩ + +/-- Relabelling a branch-decomposition preserves its width. -/ +theorem branchDecompWidth_map [Fintype ι] [Fintype ι'] (G : Hypergraph α β) (T : SimpleGraph ι) + (τ : ι → β) (e : ι ≃ ι') : + branchDecompWidth G (T.map e.toEmbedding) (τ ∘ e.symm) = branchDecompWidth G T τ := by + simp only [branchDecompWidth] + congr 1 + ext w + simp only [Set.mem_image] + constructor + · rintro ⟨f', hf', rfl⟩ + obtain ⟨f, rfl⟩ : ∃ f : Sym2 ι, Sym2.map e f = f' := by + induction f' using Sym2.ind with | _ x' y' => + exact ⟨s(e.symm x', e.symm y'), by simp⟩ + refine ⟨f, ?_, (branchEdgeOrder_map G T τ e f).symm⟩ + induction f using Sym2.ind with | _ x y => + have hf'' : (T.map e.toEmbedding).Adj (e x) (e y) := by + simpa [SimpleGraph.mem_edgeSet] using hf' + simpa [SimpleGraph.mem_edgeSet] using (SimpleGraph.Iso.map e T).map_rel_iff.1 hf'' + · rintro ⟨f, hf, rfl⟩ + refine ⟨f.map e, ?_, branchEdgeOrder_map G T τ e f⟩ + induction f using Sym2.ind with | _ x y => + have hf' : T.Adj x y := by simpa [SimpleGraph.mem_edgeSet] using hf + simpa [SimpleGraph.mem_edgeSet] using (SimpleGraph.Iso.map e T).map_rel_iff.2 hf' + +/-- Any branch-decomposition `(T, τ)` on an arbitrary finite type `ι : Type*` bounds +`branchWidth G`. -/ +theorem branchWidth_le_of_isBranchDecomposition [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → β} (h : IsBranchDecomposition G T τ) : + branchWidth G ≤ branchDecompWidth G T τ := by + let e := Fintype.equivFin ι + apply Nat.sInf_le + exact ⟨Fin (Fintype.card ι), inferInstance, T.map e.toEmbedding, τ ∘ e.symm, + h.relabel e, branchDecompWidth_map G T τ e⟩ + +/-- Relabelling a tree along an equivalence `e : ι ≃ ι'` preserves `OnTreePath`. -/ +theorem onTreePath_map {T : SimpleGraph ι} (e : ι ≃ ι') {t₁ t₂ t : ι} : + OnTreePath (T.map e.toEmbedding) (e t₁) (e t₂) (e t) ↔ OnTreePath T t₁ t₂ t := by + constructor + · intro h p hp + have hp' : (p.map (mapIso T e).toHom).IsPath := hp.map (mapIso T e).injective + have hm : e t ∈ (p.map (mapIso T e).toHom).support := h (p.map (mapIso T e).toHom) hp' + rw [SimpleGraph.Walk.support_map, List.mem_map] at hm + obtain ⟨x, hx, hxe⟩ := hm + exact e.injective hxe ▸ hx + · intro h p hp + have he₁ : (mapIso T e).symm.toHom (e t₁) = t₁ := e.symm_apply_apply t₁ + have he₂ : (mapIso T e).symm.toHom (e t₂) = t₂ := e.symm_apply_apply t₂ + have hq : ((p.map (mapIso T e).symm.toHom).copy he₁ he₂).IsPath := by + rw [SimpleGraph.Walk.isPath_copy] + exact hp.map (mapIso T e).symm.injective + have hm : t ∈ ((p.map (mapIso T e).symm.toHom).copy he₁ he₂).support := h _ hq + rw [SimpleGraph.Walk.support_copy, SimpleGraph.Walk.support_map, List.mem_map] at hm + obtain ⟨x, hx, hxe⟩ := hm + have : x = e t := by + apply e.symm.injective + change e.symm x = t at hxe + rw [hxe, e.symm_apply_apply] + exact this ▸ hx + +/-- Relabelling a tree-decomposition `(T, τ)` along an equivalence `e : ι ≃ ι'` gives a +tree-decomposition `(T.map e.toEmbedding, τ ∘ e.symm)`. -/ +theorem IsTreeDecomposition.relabel [Fintype ι] [Fintype ι'] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) (e : ι ≃ ι') : + IsTreeDecomposition G (T.map e.toEmbedding) (τ ∘ e.symm) where + isTree := (SimpleGraph.Iso.map e T).isTree_iff.1 h.isTree + le t' := h.le (e.symm t') + biUnion_eq := by + rw [← h.biUnion_eq] + ext v <;> simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, true_and, Function.comp_apply] + · exact e.symm.exists_congr (fun _ ↦ Iff.rfl) + · exact e.symm.exists_congr (fun _ ↦ Iff.rfl) + · exact e.symm.exists_congr (fun _ ↦ Iff.rfl) + edgeSet_inter_eq t₁ t₂ hne := h.edgeSet_inter_eq (e.symm.injective.ne hne) + inter_le {t₁ t₂ t₃} hp := by + apply h.inter_le + rw [← onTreePath_map e] + simpa using hp + +/-- Relabelling a tree-decomposition preserves `treeDecompWidthPlusOne`. -/ +theorem treeDecompWidthPlusOne_comp_equiv (τ : ι → Hypergraph α β) + (e : ι ≃ ι') : + treeDecompWidthPlusOne (τ ∘ e.symm) = treeDecompWidthPlusOne τ := by + simp only [treeDecompWidthPlusOne] + congr 1 + ext n + simp only [Set.mem_range, Function.comp_apply] + exact e.symm.exists_congr (fun _ ↦ Iff.rfl) + +/-- Any tree-decomposition `(T, τ)` on an arbitrary finite type `ι : Type*` bounds +`treeWidthPlusOne G`. -/ +theorem treeWidthPlusOne_le_of_isTreeDecomposition [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) : + treeWidthPlusOne G ≤ treeDecompWidthPlusOne τ := by + let e := Fintype.equivFin ι + apply Nat.sInf_le + exact ⟨Fin (Fintype.card ι), inferInstance, T.map e.toEmbedding, τ ∘ e.symm, + h.relabel e, treeDecompWidthPlusOne_comp_equiv τ e⟩ + +end GM10 + +end GraphMinor diff --git a/LeanPool/GraphMinor/GM10/Defs2.lean b/LeanPool/GraphMinor/GM10/Defs2.lean new file mode 100644 index 0000000000..9cdc0e6fcd --- /dev/null +++ b/LeanPool/GraphMinor/GM10/Defs2.lean @@ -0,0 +1,616 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Defs +public import LeanPool.GraphMinor.GM01.Defs +public import LeanPool.GraphMinor.Minor.Model +public import Mathlib.Combinatorics.Matroid.Rank.ENat + +/-! +# Definitions for Graph Minors X, Sections 6–12 + +This file formalizes the definitions of N. Robertson and P. D. Seymour, +*Graph Minors. X. Obstructions to tree-decomposition*, J. Combin. Theory Ser. B 52 (1991) 153–190, +Sections 6–12 (pages 170–190): + +- **Section 2 (page 158):** circuits in a hypergraph (`HasCircuit`), used in (2.10). +- **Section 6 (pages 170–171):** literal minors of a graph (`IsMinor`), the tangle in `G` induced + by a tangle in a minor `H` (`inducedTangle`), the hypergraph `G / W` obtained by removing `W` + from the vertex set and keeping all edges (`quotientVertices`), and the tangle `𝒯 / W` in `G / W` + (`quotientTangle`). +- **Section 7 (pages 171–173):** the `θ`-grid as a hypergraph (`gridHypergraph`), its horizontal + paths `Pᵢ` (`gridRowPath`) and vertical paths `Qⱼ` (`gridColPath`), the boundary `∂(X)` of an + edge set `X` (`edgeBoundary`), small edge sets (`IsSmallEdgeSet`), and the grid tangle of order + `θ` (`gridTangle`). +- **Section 8 (pages 174–177):** robust separations (`IsRobust`), titanic separations + (`IsTitanic`), the tangle in `G'` constructed from a titanic separation in (8.3) + (`titanicTransferredTangle`), the tangle in `G \ e` in (8.4) (`deleteEdgeTangle`), and the tangle + in `G \ W` in (8.5) (`deleteVerticesTangle`). +- **Section 9 (pages 177–180):** crossing of two separations (`SeparationsCross`), laminar sets of + separations (`IsLaminar`), the subhypergraph `G_i^e` of a component of `T \ e` (`treeDecompSide`), + separations made by an edge of a tree-decomposition (`MakesSeparation`, `separationsMadeBy`), + tie-breakers and the three tie-breaker axioms (`TieBreakerAxiom1`, `TieBreakerAxiom2`, + `TieBreakerAxiom3`, `IsTieBreaker`), smaller `λ`-order (`HasSmallerLambdaOrder`), `λ`-robust + separations (`IsLambdaRobust`), and doubly `λ`-robust separations (`IsDoublyLambdaRobust`). +- **Section 10 (pages 180–184):** indistinguishable and distinguishable tangles + (`AreIndistinguishable`, `AreDistinguishable`), separations distinguishing `𝒯₁` from `𝒯₂` + (`Distinguishes`), the `(𝒯₁, 𝒯₂)`-distinction (`IsDistinction`), homes for a tangle in a + tree-decomposition (`IsHome`), and standard tree-decompositions relative to `𝒯₁, …, 𝒯ₙ` + (`IsStandardTreeDecomposition`). +- **Section 11 (pages 184–188):** designs (`Design`, `IsDesign`), the design of a vertex in a + tree-decomposition (`vertexDesign`), tree-decompositions over a class of designs + (`IsTreeDecompositionOver`), `n`-enlargements (`IsEnlargementVia`, `IsEnlargement`, + `enlargementClass`), the class `ℛ_n` of designs with `|V(H)| ≤ n` (`smallDesignClass`), locations + (`IsLocation`), the design of a location (`locationDesign`), `θ`-pervasive classes of designs + (`IsPervasive`), and the `Z`-extension of a design (`designExtension`). +- **Section 12 (pages 188–190):** the rank function `r(X)` of a tangle (`tangleRank`), the matroid + rank axioms of (12.1) (`IsMatroidRankOn`), free sets (`IsFreeSet`), and Tutte-order + (`tutteOrder`). +-/ + +@[expose] public section + +namespace GraphMinor.GM10 + +open Graph SimpleGraph Hypergraph + +variable {α β α' ι : Type*} + +/-! ## Section 2 (continued): Circuits for (2.10) -/ + +/-- A hypergraph `G` has a circuit (Graph Minors X, Section 2, (2.10), page 158): +either `G` has an edge with at most one end (a loop in a graph), or `G` has two distinct edges with +at least two common ends (parallel edges in a graph), or the 1-skeleton `G.skeleton` has a simple +cycle of length at least `3` (`¬ G.skeleton.IsAcyclic`). For a graph `G`, this is equivalent to `G` +having a circuit in the sense of Graph Minors X. -/ +def HasCircuit (G : Hypergraph α β) : Prop := + (∃ e ∈ G.edgeSet, (G.ends e).ncard ≤ 1) ∨ + (∃ e₁ ∈ G.edgeSet, ∃ e₂ ∈ G.edgeSet, e₁ ≠ e₂ ∧ 2 ≤ (G.ends e₁ ∩ G.ends e₂).ncard) ∨ + ¬ G.skeleton.IsAcyclic + +/-! ## Section 6: New Tangles from Old -/ + +/-- `H` is a literal minor of `G` (Graph Minors X, Section 4, page 164, and Section 6, (6.1), +page 170): "$H$ can be obtained from a subgraph of $G$ by contracting edges", that is, +`H = contract G' C` for some subgraph `G' ≤ G` and some set of edges `C ⊆ E(G')`. Because +`E(contract G' C) = E(G') \ C ⊆ E(G)`, the edge set of `H` is literally a subset of `E(G)`. -/ +def IsMinor (H : Graph (Set α) β) (G : Graph α β) : Prop := + ∃ G' ≤ G, ∃ C ⊆ E(G'), H = contract G' C + +/-- The tangle in `G` induced by a tangle `𝒯'` in a minor `H` of `G` +(Graph Minors X, Section 6, (6.1), page 170): +"Let $H$ be a minor of a graph $G$, and let $\mathscr{T}'$ be a tangle in $H$ of order +$\theta \ge 2$. Let $\mathscr{T}$ be the set of all separations $(A, B)$ of $G$ of order $< +\theta$ such that there exists $(A', B') \in \mathscr{T}'$ with $E(A') = E(A) \cap E(H)$. +Then $\mathscr{T}$ is a tangle in $G$ of order $\theta$." +"We call $\mathscr{T}$ in (6.1) the tangle in $G$ *induced by* $\mathscr{T}'$." + +Here `G` has vertex type `α` and `H` has vertex type `α'` (which is `Set α` when `H = contract G' C` +is a literal minor of a graph `G` viewed as a hypergraph via `Hypergraph.ofGraph`), while both share +the edge type `β` with `E(H) ⊆ E(G)`. Separations `(A, B)` of `G` and `(A', B')` of `H` are +compared through their edge sets in `Set β` via the condition `E(A') = E(A) ∩ E(H)`. -/ +def inducedTangle (G : Hypergraph α β) (H : Hypergraph α' β) + (𝒯' : Set (Hypergraph α' β × Hypergraph α' β)) (θ : ℕ) : + Set (Hypergraph α β × Hypergraph α β) := + {p | G.IsSeparation p.1 p.2 ∧ separationOrder p.1 p.2 < θ ∧ + ∃ p' ∈ 𝒯', p'.1.edgeSet = p.1.edgeSet ∩ H.edgeSet} + +/-- `G / W` for a hypergraph `G` and a set `W` (Graph Minors X, Section 6, page 170): +"Let $G$ be a hypergraph and $W$ a set. We denote by $G/W$ the hypergraph $G'$ with vertex +set $V(G) - W$ and edge set $E(G)$, in which $v \in V(G')$ and $e \in E(G')$ are incident if +and only if they are incident in $G$. (This may produce edges with no ends.)" + +Note that `G / W` keeps every edge of `G`, and edges incident with vertices in `W` lose those ends +(possibly all of their ends), so `G / W` is in general not a subhypergraph of `G`. -/ +def quotientVertices (G : Hypergraph α β) (W : Set α) : Hypergraph α β where + vertexSet := G.vertexSet \ W + edgeSet := G.edgeSet + Inc e v := G.Inc e v ∧ v ∉ W + vertex_mem_of_inc _ _ h := ⟨G.vertex_mem_of_inc h.1, h.2⟩ + edge_mem_of_inc _ _ h := G.edge_mem_of_inc h.1 + vertexSet_finite := G.vertexSet_finite.subset Set.sdiff_subset + edgeSet_finite := G.edgeSet_finite + +/-- The tangle `𝒯 / W` in `G / W` (Graph Minors X, Section 6, (6.2), page 171): +"Let $\mathscr{T}$ be a tangle of order $\theta$ in a hypergraph $G$, and let $W \subseteq +V(G)$ with $|W| < \theta$. Let $\mathscr{T}'$ be the set of all separations $(A', B')$ of +$G/W$ such that there exists $(A, B) \in \mathscr{T}$ with $W \subseteq V(A \cap B)$, $A/W = +A'$, and $B/W = B'$. Then $\mathscr{T}'$ is a tangle in $G/W$ of order $\theta - |W|$." +"We denote the tangle $\mathscr{T}'$ of (6.2) by $\mathscr{T}/W$." -/ +def quotientTangle (G : Hypergraph α β) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (W : Set α) : + Set (Hypergraph α β × Hypergraph α β) := + {p' | (quotientVertices G W).IsSeparation p'.1 p'.2 ∧ + ∃ p ∈ 𝒯, W ⊆ (p.1 ∩ p.2).vertexSet ∧ + quotientVertices p.1 W = p'.1 ∧ quotientVertices p.2 W = p'.2} + +/-! ## Section 7: A Tangle in a Grid -/ + +/-- The `θ`-grid as a hypergraph (Graph Minors X, Section 7, page 171): +"Let $\theta \ge 2$ be an integer. Let $G$ be a simple graph with $V(G) = \{(i, j) : 1 \le i, +j \le \theta\}$, where $(i, j)$ and $(i', j')$ are adjacent if $|i' - i| + |j' - j| = 1$. We +call $G$ a *$\theta$-grid*." + +Here the vertices are `Fin θ × Fin θ` (0-indexed, so `(i, j)` represents `(i + 1, j + 1)`), using +`GM01.gridGraph θ` viewed as a hypergraph via `Hypergraph.ofGraph`. -/ +def gridHypergraph (θ : ℕ) : Hypergraph (Fin θ × Fin θ) (Sym2 (Fin θ × Fin θ)) := + Hypergraph.ofGraph (GM01.gridGraph θ) Set.finite_univ (Set.toFinite _) + +/-- The `i`-th horizontal path `Pᵢ` of the `θ`-grid (Graph Minors X, Section 7, page 171): +"For $1 \le i \le \theta$, let $P_i$ be the path of $G$ with vertex set $\{(i, j) : 1 \le j +\le \theta" -/ +def gridRowPath (θ : ℕ) (i : Fin θ) : + Hypergraph (Fin θ × Fin θ) (Sym2 (Fin θ × Fin θ)) where + vertexSet := {v : Fin θ × Fin θ | v.1 = i} + edgeSet := {e ∈ (gridHypergraph θ).edgeSet | + ∀ v, (gridHypergraph θ).Inc e v → v.1 = i} + Inc e v := (gridHypergraph θ).Inc e v ∧ + ∀ w, (gridHypergraph θ).Inc e w → w.1 = i + vertex_mem_of_inc _ _ h := h.2 _ h.1 + edge_mem_of_inc _ _ h := ⟨(gridHypergraph θ).edge_mem_of_inc h.1, h.2⟩ + vertexSet_finite := Set.toFinite _ + edgeSet_finite := Set.toFinite _ + +/-- The `j`-th vertical path `Qⱼ` of the `θ`-grid (Graph Minors X, Section 7, page 171): +"and for $1 \le j \le \theta$, define $Q_j$ similarly." -/ +def gridColPath (θ : ℕ) (j : Fin θ) : + Hypergraph (Fin θ × Fin θ) (Sym2 (Fin θ × Fin θ)) where + vertexSet := {v : Fin θ × Fin θ | v.2 = j} + edgeSet := {e ∈ (gridHypergraph θ).edgeSet | + ∀ v, (gridHypergraph θ).Inc e v → v.2 = j} + Inc e v := (gridHypergraph θ).Inc e v ∧ + ∀ w, (gridHypergraph θ).Inc e w → w.2 = j + vertex_mem_of_inc _ _ h := h.2 _ h.1 + edge_mem_of_inc _ _ h := ⟨(gridHypergraph θ).edge_mem_of_inc h.1, h.2⟩ + vertexSet_finite := Set.toFinite _ + edgeSet_finite := Set.toFinite _ + +/-- The boundary `∂(X)` of a set of edges `X ⊆ E(G)` (Graph Minors X, Section 7, page 171): +"When $X \subseteq E(G)$, we define $\partial(X)$ to be the set of vertices $v \in X$ such that $v$ +is incident with an edge in $X$ and with an edge in $E(G) - X$." +(Here $v \in X$ in the paper is a misprint for $v \in V(G)$.) -/ +abbrev edgeBoundary (G : Hypergraph α β) (X : Set β) : Set α := G.edgeBoundary X + +/-- A subset `X ⊆ E(G)` of the `θ`-grid is small (Graph Minors X, Section 7, page 172): +"If $X \subseteq E(G)$, we say that $X$ is *small* (in $G$) if $|\partial(X)| < \theta$ and +$X$ includes $E(P_i)$ for no $i$ $(1 \le i \le \theta)$." -/ +def IsSmallEdgeSet (θ : ℕ) (X : Set (Sym2 (Fin θ × Fin θ))) : Prop := + (edgeBoundary (gridHypergraph θ) X).ncard < θ ∧ + ∀ i : Fin θ, ¬ (gridRowPath θ i).edgeSet ⊆ X + +/-- The natural tangle of order `θ` in the `θ`-grid (Graph Minors X, Section 7, (7.3), page 173): +"Given a $\theta$-grid $G$ with $P_1, \dots, P_\theta, Q_1, \dots, Q_\theta$ as before, let +$\mathscr{T}$ be the set of all separations $(A, B)$ of $G$ of order $<\theta$ such that +$E(A)$ is small." -/ +def gridTangle (θ : ℕ) : + Set (Hypergraph (Fin θ × Fin θ) (Sym2 (Fin θ × Fin θ)) × + Hypergraph (Fin θ × Fin θ) (Sym2 (Fin θ × Fin θ))) := + {p | (gridHypergraph θ).IsSeparation p.1 p.2 ∧ + separationOrder p.1 p.2 < θ ∧ IsSmallEdgeSet θ p.1.edgeSet} + +/-! ## Section 8: Robust and Titanic Separations -/ + +/-- A separation `(A, B)` of `G` is robust (Graph Minors X, Section 8, page 174): +"A separation $(A, B)$ of $G$ is *robust* if for every separation $(C, D)$ of $A$, one of the +separations $(C, B \cup D)$, $(D, B \cup C)$ has order at least that of $(A, B)$." -/ +def IsRobust (G A B : Hypergraph α β) : Prop := + G.IsSeparation A B ∧ + ∀ ⦃C D : Hypergraph α β⦄, A.IsSeparation C D → + separationOrder A B ≤ separationOrder C (B ∪ D) ∨ + separationOrder A B ≤ separationOrder D (B ∪ C) + +/-- A separation `(A, B)` of `G` is titanic (Graph Minors X, Section 8, page 174): +"A separation $(A, B)$ of $G$ is *titanic* if for every triple $(X, Y, Z)$ of subhypergraphs +of $A$ such that $A = X \cup Y \cup Z$ and $E(X)$, $E(Y)$, $E(Z)$ are mutually disjoint, we +have either $$|V((X \cup Y) \cap Z)| \ge |V((X \cup Y) \cap B)|$$ or $$|V((Y \cup Z) \cap +X)| \ge |V((Y \cup Z) \cap B)|$$ or $$|V((Z \cup X) \cap Y)| \ge |V((Z \cup X) \cap B)|.$$" -/ +def IsTitanic (G A B : Hypergraph α β) : Prop := + G.IsSeparation A B ∧ + ∀ ⦃X Y Z : Hypergraph α β⦄, X ≤ A → Y ≤ A → Z ≤ A → X ∪ Y ∪ Z = A → + Disjoint X.edgeSet Y.edgeSet → Disjoint Y.edgeSet Z.edgeSet → Disjoint X.edgeSet Z.edgeSet → + ((X ∪ Y) ∩ B).vertexSet.ncard ≤ ((X ∪ Y) ∩ Z).vertexSet.ncard ∨ + ((Y ∪ Z) ∩ B).vertexSet.ncard ≤ ((Y ∪ Z) ∩ X).vertexSet.ncard ∨ + ((Z ∪ X) ∩ B).vertexSet.ncard ≤ ((Z ∪ X) ∩ Y).vertexSet.ncard + +/-- The tangle `𝒯'` in `G'` constructed in (8.3) (Graph Minors X, Section 8, (8.3), page 175): +"Let* $\mathscr{T}'$ *be the set of all separations* $(A', B')$ *of* $G'$ *of order* +$<\theta$ *such that there exists* $(A, B) \in \mathscr{T}$ *with* $E(A \cap D) = E(A' \cap +D)$." -/ +def titanicTransferredTangle (G' D : Hypergraph α β) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (θ : ℕ) : + Set (Hypergraph α β × Hypergraph α β) := + {p' | G'.IsSeparation p'.1 p'.2 ∧ separationOrder p'.1 p'.2 < θ ∧ + ∃ p ∈ 𝒯, (p.1 ∩ D).edgeSet = (p'.1 ∩ D).edgeSet} + +/-- The tangle `𝒯'` in `G \ e` constructed in (8.4) (Graph Minors X, Section 8, (8.4), page 176): +"Let* $\mathscr{T}'$ *be the set of all separations* $(A', B')$ *of* $G \setminus e$ *of +order* $<\theta$ *such that there exists* $(A, B) \in \mathscr{T}$ *with* $E(A \cap (G +\setminus e)) = E(A')$." -/ +def deleteEdgeTangle (G : Hypergraph α β) (e : β) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (θ : ℕ) : + Set (Hypergraph α β × Hypergraph α β) := + {p' | (G.deleteEdges {e}).IsSeparation p'.1 p'.2 ∧ separationOrder p'.1 p'.2 < θ ∧ + ∃ p ∈ 𝒯, (p.1 ∩ G.deleteEdges {e}).edgeSet = p'.1.edgeSet} + +/-- The tangle `𝒯'` in `G \ W` constructed in (8.5) (Graph Minors X, Section 8, (8.5), page 177): +"Let $\mathscr{T}'$ be the set of all separations $(A', B')$ of $G \setminus W$ of order $< +\theta - |W|$ such that there exists $(A, B) \in \mathscr{T}$ with $W \subseteq V(A \cap B)$ +and $A \setminus W = A'$, $B \setminus W = B'$." -/ +def deleteVerticesTangle (G : Hypergraph α β) (W : Set α) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (θ : ℕ) : + Set (Hypergraph α β × Hypergraph α β) := + {p' | (G.deleteVertices W).IsSeparation p'.1 p'.2 ∧ separationOrder p'.1 p'.2 < θ - W.ncard ∧ + ∃ p ∈ 𝒯, W ⊆ (p.1 ∩ p.2).vertexSet ∧ + p.1.deleteVertices W = p'.1 ∧ p.2.deleteVertices W = p'.2} + +/-! ## Section 9: Laminar Separations -/ + +/-- Two separations `(A₁, B₁)` and `(A₂, B₂)` cross (Graph Minors X, Section 9, page 177): +"Let $(A_1, B_1)$, $(A_2, B_2)$ be separations of a hypergraph $G$. We say these separations +*cross* unless either $A_1 \subseteq A_2$ and $B_2 \subseteq B_1$, or $A_1 \subseteq B_2$ +and $A_2 \subseteq B_1$, or $B_1 \subseteq A_2$ and $B_2 \subseteq A_1$, or $B_1 \subseteq +B_2$ and $A_2 \subseteq A_1$." -/ +def SeparationsCross (A₁ B₁ A₂ B₂ : Hypergraph α β) : Prop := + ¬ ((A₁ ≤ A₂ ∧ B₂ ≤ B₁) ∨ (A₁ ≤ B₂ ∧ A₂ ≤ B₁) ∨ (B₁ ≤ A₂ ∧ B₂ ≤ A₁) ∨ (B₁ ≤ B₂ ∧ A₂ ≤ A₁)) + +/-- A set of separations is laminar (Graph Minors X, Section 9, page 177): +"A set of separations is *laminar* if no two of its members cross." -/ +def IsLaminar (𝒮 : Set (Hypergraph α β × Hypergraph α β)) : Prop := + ∀ ⦃p₁⦄, p₁ ∈ 𝒮 → ∀ ⦃p₂⦄, p₂ ∈ 𝒮 → ¬ SeparationsCross p₁.1 p₁.2 p₂.1 p₂.2 + +open Classical in +/-- Given a tree `T`, a mapping `τ : ι → Hypergraph α β`, an edge `e` of `T`, and an end `u` of `e`, +`treeDecompSide T τ e u` is the union `⋃ (τ(t) : t ∈ V(T_u))` over the vertex set of the component +`T_u` of `T \ e` containing `u` (Graph Minors X, Section 9, page 177). -/ +noncomputable def treeDecompSide [Fintype ι] (T : SimpleGraph ι) (τ : ι → Hypergraph α β) + (e : Sym2 ι) (u : ι) : Hypergraph α β := + Hypergraph.biUnion (Finset.univ.filter fun t ↦ (T.deleteEdges {e}).Reachable u t) τ + +/-- A separation `(A, B)` is made by an edge `e ∈ E(T)` under a tree-decomposition `(T, τ)` +(Graph Minors X, Section 9, page 177): +"Let $(T, \tau)$ be a tree-decomposition of a hypergraph $G$. For each $e \in E(T)$, let +$T_1$, $T_2$ be the components of $T \setminus e$ and let $$ G_i^e = \bigcup (\tau(t) : t +\in V(T_i)) \qquad (i = 1, 2). $$ Then $(G_1^e, G_2^e)$ is a separation of $G$, and we call +$(G_1^e, G_2^e)$ and $(G_2^e, G_1^e)$ the separations *made by* $e$ (under the given +tree-decomposition)." -/ +def MakesSeparation [Fintype ι] (T : SimpleGraph ι) (τ : ι → Hypergraph α β) + (e : Sym2 ι) (A B : Hypergraph α β) : Prop := + ∃ u v : ι, T.Adj u v ∧ e = s(u, v) ∧ + A = treeDecompSide T τ s(u, v) u ∧ B = treeDecompSide T τ s(u, v) v + +/-- The set of all separations made by edges of `T` under `(T, τ)` +(Graph Minors X, Section 9, (9.1), page 177). -/ +def separationsMadeBy [Fintype ι] (T : SimpleGraph ι) (τ : ι → Hypergraph α β) : + Set (Hypergraph α β × Hypergraph α β) := + {p | ∃ e ∈ T.edgeSet, MakesSeparation T τ e p.1 p.2} + +/-- The first tie-breaker axiom (Graph Minors X, Section 9, page 178): +"(i) if $(A, B)$, $(C, D)$ are separations of $G$, they have the same $\lambda$-order if and +only if $(A, B) = (C, D)$ or $(A, B) = (D, C)$" -/ +def TieBreakerAxiom1 {Λ : Type*} (G : Hypergraph α β) + (lam : Hypergraph α β × Hypergraph α β → Λ) : Prop := + ∀ ⦃A B C D : Hypergraph α β⦄, G.IsSeparation A B → G.IsSeparation C D → + (lam (A, B) = lam (C, D) ↔ (A = C ∧ B = D) ∨ (A = D ∧ B = C)) + +/-- The second tie-breaker axiom (Graph Minors X, Section 9, page 178): +"(ii) if $(A, B)$, $(C, D)$ are separations of $G$, then either $(A \cup C, B \cap D)$ has +$\lambda$-order at most that of $(A, B)$ or $(A \cap C, B \cup D)$ has $\lambda$-order +smaller than that of $(C, D)$" -/ +def TieBreakerAxiom2 {Λ : Type*} [LinearOrder Λ] (G : Hypergraph α β) + (lam : Hypergraph α β × Hypergraph α β → Λ) : Prop := + ∀ ⦃A B C D : Hypergraph α β⦄, G.IsSeparation A B → G.IsSeparation C D → + lam (A ∪ C, B ∩ D) ≤ lam (A, B) ∨ lam (A ∩ C, B ∪ D) < lam (C, D) + +/-- The third tie-breaker axiom (Graph Minors X, Section 9, page 178): +"(iii) if $(A, B)$, $(C, D)$ are separations of $G$ and $(A, B)$ has smaller order than $(C, +D)$, then $(A, B)$ has smaller $\lambda$-order than $(C, D)$." -/ +def TieBreakerAxiom3 {Λ : Type*} [LinearOrder Λ] (G : Hypergraph α β) + (lam : Hypergraph α β × Hypergraph α β → Λ) : Prop := + ∀ ⦃A B C D : Hypergraph α β⦄, G.IsSeparation A B → G.IsSeparation C D → + separationOrder A B < separationOrder C D → lam (A, B) < lam (C, D) + +/-- A tie-breaker `λ` in a hypergraph `G` (Graph Minors X, Section 9, pages 177–178): +"A *tie-breaker* $\lambda$ in a hypergraph $G$ is a function from the set of all separations +of $G$ into some linearly ordered set $(\Lambda, <)$, satisfying certain axioms given below. +For each separation $(A, B)$, $\lambda(A, B)$ is called the $\lambda$-*order* of $(A, B)$, +... and, if $(A, B)$, $(C, D)$ are separations, we say that $(A, B)$ has *smaller* +$\lambda$-*order than* $(C, D)$ if $\lambda(A, B) < \lambda(C, D)$. The tie-breaker +$\lambda$ must satisfy the following conditions: (i) if $(A, B)$, $(C, D)$ are separations +of $G$, they have the same $\lambda$-order if and only if $(A, B) = (C, D)$ or $(A, B) = (D, +C)$ (ii) if $(A, B)$, $(C, D)$ are separations of $G$, then either $(A \cup C, B \cap D)$ +has $\lambda$-order at most that of $(A, B)$ or $(A \cap C, B \cup D)$ has $\lambda$-order +smaller than that of $(C, D)$ (iii) if $(A, B)$, $(C, D)$ are separations of $G$ and $(A, +B)$ has smaller order than $(C, D)$, then $(A, B)$ has smaller $\lambda$-order than $(C, +D)$. We refer to these as the *first*, *second*, and *third tie-breaker axioms*." + +We parameterize `IsTieBreaker` by an arbitrary `LinearOrder Λ` so that theorems taking a +tie-breaker (such as (9.3), (9.4), (10.2), and (10.3)) apply to any linearly ordered codomain `Λ`, +while (9.2) ("In every hypergraph there is a tie-breaker") can instantiate `Λ` with a concrete +linear order (such as `ℕ ×ₗ ℕ ×ₗ ℕ`, or `ℝ ×ₗ ℝ ×ₗ ℝ` as in the paper's proof). Since `G` has only +finitely many separations, any tie-breaker into `(Λ, <)` also induces an order-preserving +tie-breaker into `ℕ`. -/ +structure IsTieBreaker {Λ : Type*} [LinearOrder Λ] (G : Hypergraph α β) + (lam : Hypergraph α β × Hypergraph α β → Λ) : Prop where + /-- The first tie-breaker axiom (i). -/ + axiom1 : TieBreakerAxiom1 G lam + /-- The second tie-breaker axiom (ii). -/ + axiom2 : TieBreakerAxiom2 G lam + /-- The third tie-breaker axiom (iii). -/ + axiom3 : TieBreakerAxiom3 G lam + +/-- `(A, B)` has smaller `λ`-order than `(C, D)`: `λ(A, B) < λ(C, D)` +(Graph Minors X, Section 9, page 178). -/ +def HasSmallerLambdaOrder {Λ : Type*} [LT Λ] + (lam : Hypergraph α β × Hypergraph α β → Λ) (A B C D : Hypergraph α β) : Prop := + lam (A, B) < lam (C, D) + +/-- A separation `(A, B)` of `G` is `λ`-robust (Graph Minors X, Section 9, page 180): +"Given a tie-breaker $\lambda$, a separation $(A, B)$ of $G$ is $\lambda$-*robust* if for +every separation $(C, D)$ of $A$, one of $(C, B \cup D)$, $(D, B \cup C)$ has +$\lambda$-order at least the $\lambda$-order of $(A, B)$." -/ +def IsLambdaRobust {Λ : Type*} [LE Λ] (G : Hypergraph α β) + (lam : Hypergraph α β × Hypergraph α β → Λ) (A B : Hypergraph α β) : Prop := + G.IsSeparation A B ∧ + ∀ ⦃C D : Hypergraph α β⦄, A.IsSeparation C D → + lam (A, B) ≤ lam (C, B ∪ D) ∨ lam (A, B) ≤ lam (D, B ∪ C) + +/-- A separation `(A, B)` of `G` is doubly `λ`-robust (Graph Minors X, Section 9, page 180): +"The separation $(A, B)$ is *doubly* $\lambda$-*robust* if both $(A, B)$ and $(B, A)$ are +$\lambda$-robust." -/ +def IsDoublyLambdaRobust {Λ : Type*} [LE Λ] (G : Hypergraph α β) + (lam : Hypergraph α β × Hypergraph α β → Λ) (A B : Hypergraph α β) : Prop := + IsLambdaRobust G lam A B ∧ IsLambdaRobust G lam B A + +/-! ## Section 10: Tangle Tree-Decompositions -/ + +/-- Two tangles `𝒯₁` and `𝒯₂` are indistinguishable (Graph Minors X, Section 10, page 180): +"Let $\mathscr{T}_1$, $\mathscr{T}_2$ be tangles in a graph $G$. They are *indistinguishable* +if one is a truncation of the other, that is, either $\mathscr{T}_1 \subseteq \mathscr{T}_2$ +or $\mathscr{T}_2 \subseteq \mathscr{T}_1$, and otherwise they are *distinguishable*." -/ +def AreIndistinguishable (𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)) : Prop := + 𝒯₁ ⊆ 𝒯₂ ∨ 𝒯₂ ⊆ 𝒯₁ + +/-- Two tangles `𝒯₁` and `𝒯₂` are distinguishable (Graph Minors X, Section 10, page 180): +"and otherwise they are *distinguishable*." -/ +def AreDistinguishable (𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)) : Prop := + ¬ AreIndistinguishable 𝒯₁ 𝒯₂ + +/-- A separation `(A, B)` distinguishes `𝒯₁` from `𝒯₂` (Graph Minors X, Section 10, page 180): +"A separation $(A, B)$ of $G$ *distinguishes* $\mathscr{T}_1$ *from* $\mathscr{T}_2$ if $(A, +B) \in \mathscr{T}_1$ and $(B, A) \in \mathscr{T}_2$." -/ +def Distinguishes (𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)) + (A B : Hypergraph α β) : Prop := + (A, B) ∈ 𝒯₁ ∧ (B, A) ∈ 𝒯₂ + +/-- A separation `(A, B)` is the `(𝒯₁, 𝒯₂)`-distinction with respect to a tie-breaker `λ` +(Graph Minors X, Section 10, page 181): +"Given a tie-breaker $\lambda$, a separation $(A, B)$ which distinguishes $\mathscr{T}_1$ +from $\mathscr{T}_2$ is a *$(\mathscr{T}_1, \mathscr{T}_2)$-distinction* if it has minimum +$\lambda$-order of all separations which distinguish $\mathscr{T}_1$ from $\mathscr{T}_2$. +From the first tie-breaker axiom, $(A, B)$ is unique, and we may speak of *the* +$(\mathscr{T}_1, \mathscr{T}_2)$-distinction." -/ +def IsDistinction {Λ : Type*} [LE Λ] + (lam : Hypergraph α β × Hypergraph α β → Λ) + (𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)) (A B : Hypergraph α β) : Prop := + Distinguishes 𝒯₁ 𝒯₂ A B ∧ + ∀ ⦃A' B' : Hypergraph α β⦄, Distinguishes 𝒯₁ 𝒯₂ A' B' → lam (A, B) ≤ lam (A', B') + +/-- A vertex `t₀ ∈ V(T)` is a home for a tangle `𝒯` in a tree-decomposition `(T, τ)` +(Graph Minors X, Section 10, proof of (10.3), page 182): +"For $1 \le i \le n$, we say $t_0 \in V(T)$ is a *home* for $\mathscr{T}_i$ if for every $e +\in E(T)$, $$ \left( \bigcup_{t \in V(T_1)} \tau(t), \bigcup_{t \in V(T_2)} \tau(t) \right) +\notin \mathscr{T}_i, $$ where $T_1, T_2$ are the components of $T \setminus e$ and $t_0 \in +V(T_1)$." -/ +def IsHome [Fintype ι] (T : SimpleGraph ι) (τ : ι → Hypergraph α β) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (t₀ : ι) : Prop := + ∀ ⦃u v : ι⦄, T.Adj u v → (T.deleteEdges {s(u, v)}).Reachable u t₀ → + (treeDecompSide T τ s(u, v) u, treeDecompSide T τ s(u, v) v) ∉ 𝒯 + +/-- A tree-decomposition `(T, τ)` of `G` with `V(T) = Fin n` is a standard tree-decomposition of +`G` relative to `𝒯₁, …, 𝒯ₙ` and tie-breaker `λ` (Graph Minors X, Section 10, (10.3), pages +181–184): +"(i) *For every $e \in E(T)$ and for $1 \le i \le n$, if $T_1, T_2$ are the components of $T + \setminus e$ and $t_i \in V(T_1)$ then* $$ \left( \bigcup_{t \in V(T_1)} \tau(t), \bigcup_{t + \in V(T_2)} \tau(t) \right) \notin \mathscr{T}_i. $$ (ii) *For all $i \ne j$ with $1 \le i, + j \le n$, let $e$ be the edge of the path of $T$ between $t_i$ and $t_j$ making separations + of smallest $\lambda$-order; then these separations are the $(\mathscr{T}_i, + \mathscr{T}_j)$- and $(\mathscr{T}_j, \mathscr{T}_i)$-distinctions." +"We call the tree-decomposition of (10.3) the *standard tree-decomposition* of $G$ relative +to $\mathscr{T}_1, \dots, \mathscr{T}_n$." -/ +structure IsStandardTreeDecomposition {n : ℕ} {Λ : Type*} [LinearOrder Λ] + (G : Hypergraph α β) (lam : Hypergraph α β × Hypergraph α β → Λ) + (𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)) + (T : SimpleGraph (Fin n)) (τ : Fin n → Hypergraph α β) : Prop where + /-- `(T, τ)` is a tree-decomposition of `G`. -/ + isTreeDecomposition : IsTreeDecomposition G T τ + /-- (i) Each vertex `i` is a home for `𝒯 i`. -/ + isHome : ∀ i : Fin n, IsHome T τ (𝒯 i) i + /-- (ii) For `i ≠ j`, on the path in `T` between `i` and `j`, the edge making separations of + minimum `λ`-order makes the `(𝒯 i, 𝒯 j)`- and `(𝒯 j, 𝒯 i)`-distinctions. -/ + path_min_isDistinction : ∀ ⦃i j : Fin n⦄, i ≠ j → + ∃ e ∈ T.edgeSet, + (∀ p : T.Walk i j, p.IsPath → e ∈ p.edges) ∧ + (∀ e' ∈ T.edgeSet, (∀ p : T.Walk i j, p.IsPath → e' ∈ p.edges) → + ∀ A B A' B', MakesSeparation T τ e A B → MakesSeparation T τ e' A' B' → + lam (A, B) ≤ lam (A', B')) ∧ + ∃ A B, MakesSeparation T τ e A B ∧ + IsDistinction lam (𝒯 i) (𝒯 j) A B ∧ IsDistinction lam (𝒯 j) (𝒯 i) B A + +/-! ## Section 11: Structure Relative to a Tangle -/ + +/-- A design `(H, M)` (Graph Minors X, Section 11, page 185): +"A design is a pair $(H, M)$, where $H$ is a hypergraph and $M$ is a set of subsets of $V(H)$." -/ +abbrev Design (α β : Type*) := Hypergraph α β × Set (Set α) + +/-- A pair `(H, M)` is a valid design if every member of `M` is a subset of `V(H)` +(Graph Minors X, Section 11, page 185). -/ +def IsDesign (d : Design α β) : Prop := + ∀ ⦃X : Set α⦄, X ∈ d.2 → X ⊆ d.1.vertexSet + +/-- The design of a vertex `t₀ ∈ V(T)` in a tree-decomposition `(T, τ)` +(Graph Minors X, Section 11, page 185): +"If $(T, \tau)$ is a tree-decomposition of a hypergraph $G$ and $t_0 \in V(T)$, and $t_0$ has +neighbours $t_1, \dots, t_k$ in $T$, then $$ (\tau(t_0), \{V(\tau(t_0) \cap \tau(t_i)): 1 +\le i \le k\}) $$ is a design, called the *design of $t_0$ in $(T, \tau)$*." -/ +def vertexDesign (T : SimpleGraph ι) (τ : ι → Hypergraph α β) (t₀ : ι) : Design α β := + (τ t₀, {X | ∃ t, T.Adj t₀ t ∧ X = (τ t₀ ∩ τ t).vertexSet}) + +/-- A tree-decomposition `(T, τ)` of `G` is over a class of designs `𝒮` +(Graph Minors X, Section 11, page 185): +"If $\mathscr{S}$ is a class of designs, a tree-decomposition $(T, \tau)$ is said to be *over +$\mathscr{S}$* if for each $t_0 \in V(T)$, $\mathscr{S}$ contains the design of $t_0$ in +$(T, \tau)$." -/ +def IsTreeDecompositionOver [Fintype ι] (G : Hypergraph α β) (𝒮 : Set (Design α β)) + (T : SimpleGraph ι) (τ : ι → Hypergraph α β) : Prop := + IsTreeDecomposition G T τ ∧ ∀ t₀ : ι, vertexDesign T τ t₀ ∈ 𝒮 + +/-- `(H', M')` is an enlargement of `(H, M)` via `Z ⊆ V(H')` +(Graph Minors X, Section 11, page 185): +"Let $(H, M)$, $(H', M')$ be designs and let $Z \subseteq V(H')$ be such that (i) $H$ is a +subhypergraph of $H'$ and $V(H') - V(H) \subseteq Z$ (ii) every edge of $H'$ is an edge of +$H$ (iii) for every $X \in M'$ with $X \ne Z$, $X \cap V(H) \in M$. ($Z$ may or may not be a +member of $M'$.) In these circumstances, we say that $(H', M')$ is an *$n$-enlargement* of +$(H, M)$ for every integer $n \ge |Z|$." -/ +structure IsEnlargementVia (d d' : Design α β) (Z : Set α) : Prop where + /-- `d` is a design. -/ + isDesign : IsDesign d + /-- `d'` is a design. -/ + isDesign' : IsDesign d' + /-- `Z ⊆ V(H')`. -/ + subset_vertexSet : Z ⊆ d'.1.vertexSet + /-- (i) `H` is a subhypergraph of `H'`. -/ + le : d.1 ≤ d'.1 + /-- (i) `V(H') - V(H) ⊆ Z`. -/ + sdiff_subset : d'.1.vertexSet \ d.1.vertexSet ⊆ Z + /-- (ii) Every edge of `H'` is an edge of `H`. -/ + edgeSet_subset : d'.1.edgeSet ⊆ d.1.edgeSet + /-- (iii) For every `X ∈ M'` with `X ≠ Z`, `X ∩ V(H) ∈ M`. -/ + inter_mem : ∀ ⦃X : Set α⦄, X ∈ d'.2 → X ≠ Z → X ∩ d.1.vertexSet ∈ d.2 + +/-- `(H', M')` is an `n`-enlargement of `(H, M)` (Graph Minors X, Section 11, page 185). -/ +def IsEnlargement (n : ℕ) (d d' : Design α β) : Prop := + ∃ Z : Set α, Z.ncard ≤ n ∧ IsEnlargementVia d d' Z + +/-- `𝒮^n`, the class of all `n`-enlargements of members of `𝒮` +(Graph Minors X, Section 11, page 185): +"If $\mathscr{S}$ is a class of designs, we denote the class of all $n$-enlargements of +members of $\mathscr{S}$ by $\mathscr{S}^n$." -/ +def enlargementClass (𝒮 : Set (Design α β)) (n : ℕ) : Set (Design α β) := + {d' | ∃ d ∈ 𝒮, IsEnlargement n d d'} + +/-- `ℛ_n`, the class of all designs `(H, M)` with `|V(H)| ≤ n` +(Graph Minors X, Section 11, page 185): +"For any integer $n \ge 0$, we denote by $\mathscr{R}_n$ the class of all designs $(H, M)$ +with $|V(H)| \le n$." -/ +def smallDesignClass (n : ℕ) : Set (Design α β) := + {d | IsDesign d ∧ d.1.vertexSet.ncard ≤ n} + +/-- A location `ℒ` in a hypergraph `G` (Graph Minors X, Section 11, page 185): +"A *location* in a hypergraph $G$ is a set $\{(A_1, B_1), \dots, (A_k, B_k)\}$ of separations +of $G$ such that $A_i \subseteq B_j$ for all distinct $i, j$ with $1 \le i, j \le k$." +Since `G` is finite, any set of separations of `G` is finite. -/ +structure IsLocation (G : Hypergraph α β) + (ℒ : Set (Hypergraph α β × Hypergraph α β)) : Prop where + /-- Every member of `ℒ` is a separation of `G`. -/ + isSeparation : ∀ ⦃p⦄, p ∈ ℒ → G.IsSeparation p.1 p.2 + /-- For distinct `p₁, p₂ ∈ ℒ`, `A₁ ⊆ B₂`. -/ + left_le_right : ∀ ⦃p₁⦄, p₁ ∈ ℒ → ∀ ⦃p₂⦄, p₂ ∈ ℒ → p₁ ≠ p₂ → p₁.1 ≤ p₂.2 + +/-- The intersection `G ∩ B₁ ∩ … ∩ B_k` for a set `ℒ` of separations of `G` +(Graph Minors X, Section 11, page 185). -/ +def locationCore (G : Hypergraph α β) + (ℒ : Set (Hypergraph α β × Hypergraph α β)) : Hypergraph α β where + vertexSet := {v ∈ G.vertexSet | ∀ p ∈ ℒ, v ∈ p.2.vertexSet} + edgeSet := {e ∈ G.edgeSet | ∀ p ∈ ℒ, e ∈ p.2.edgeSet} + Inc e v := G.Inc e v ∧ (∀ p ∈ ℒ, v ∈ p.2.vertexSet) ∧ (∀ p ∈ ℒ, e ∈ p.2.edgeSet) + vertex_mem_of_inc _ _ h := ⟨G.vertex_mem_of_inc h.1, h.2.1⟩ + edge_mem_of_inc _ _ h := ⟨G.edge_mem_of_inc h.1, h.2.2⟩ + vertexSet_finite := G.vertexSet_finite.subset fun _ h ↦ h.1 + edgeSet_finite := G.edgeSet_finite.subset fun _ h ↦ h.1 + +/-- The design of a location `ℒ` in `G` (Graph Minors X, Section 11, page 185): +"If $\{(A_1, B_1), \dots, (A_k, B_k)\}$ is a location in $G$, then +$$ +(G \cap B_1 \cap \dots \cap B_k; \{V(A_i \cap B_i): 1 \le i \le k\}) +$$ +is a design, which we call the *design of the location*." -/ +def locationDesign (G : Hypergraph α β) + (ℒ : Set (Hypergraph α β × Hypergraph α β)) : Design α β := + (locationCore G ℒ, (fun p ↦ (p.1 ∩ p.2).vertexSet) '' ℒ) + +/-- A class of designs `𝒮` is `θ`-pervasive in a hypergraph `G` +(Graph Minors X, Section 11, page 185): +"Let $\theta \ge 1$ be an integer, and let $\mathscr{S}$ be a class of designs. We say that +$\mathscr{S}$ is *$\theta$-pervasive* in a hypergraph $G$ if for every subhypergraph $G'$ of +$G$ and every tangle $\mathscr{T}$ in $G'$ of order $\ge \theta$ there is a location +$\mathscr{L}$ in $G'$ such that $\mathscr{L} \subseteq \mathscr{T}$ and the design of +$\mathscr{L}$ belongs to $\mathscr{S}$." -/ +def IsPervasive (G : Hypergraph α β) (θ : ℕ) (𝒮 : Set (Design α β)) : Prop := + ∀ ⦃G' : Hypergraph α β⦄, G' ≤ G → + ∀ ⦃θ' : ℕ⦄ ⦃𝒯 : Set (Hypergraph α β × Hypergraph α β)⦄, + θ ≤ θ' → IsTangle G' θ' 𝒯 → + ∃ ℒ, IsLocation G' ℒ ∧ ℒ ⊆ 𝒯 ∧ locationDesign G' ℒ ∈ 𝒮 + +/-- The `Z`-extension `(H, M ∪ {Z})` of a design `(H, M)` +(Graph Minors X, Section 11, page 186): +"If $(H, M)$ is a design and $Z \subseteq V(H)$ then $(H, M \cup \{Z\})$ is a design, which +we call the *$Z$-extension* of $(H, M)$." -/ +def designExtension (d : Design α β) (Z : Set α) : Design α β := + (d.1, insert Z d.2) + +/-! ## Section 12: Tangles and Matroids -/ + +open Classical in +/-- The rank function `r(X)` of a tangle `𝒯` of order `θ` in `G` +(Graph Minors X, Section 12, page 188): +"Let $\mathscr{T}$ be a tangle in a hypergraph $G$, of order $\theta$. For $X \subseteq +V(G)$, let us define $r(X)$ to be the least order of a separation $(A, B) \in \mathscr{T}$ +with $X \subseteq V(A)$, if one exists, and $\theta$ otherwise." -/ +noncomputable def tangleRank + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (θ : ℕ) (X : Set α) : ℕ := + if ∃ p ∈ 𝒯, X ⊆ p.1.vertexSet then + sInf {k : ℕ | ∃ p ∈ 𝒯, X ⊆ p.1.vertexSet ∧ separationOrder p.1 p.2 = k} + else + θ + +/-- `r` satisfies the matroid rank axioms on `E` (Graph Minors X, Section 12, (12.1), +pages 188–189): +"(i) $r$ is integral-valued (ii) for $X \subseteq V(G)$, $0 \le r(X) \le |X|$ (iii) for $X +\subseteq Y \subseteq V(G)$, $r(X) \le r(Y)$ (iv) for $X, Y \subseteq V(G)$, $r(X \cup Y) + +r(X \cap Y) \le r(X) + r(Y)$." +Condition (i) and `0 ≤ r(X)` are automatic for `r : Set α → ℕ`. -/ +structure IsMatroidRankOn (E : Set α) (r : Set α → ℕ) : Prop where + /-- (ii) For `X ⊆ E`, `r(X) ≤ |X|`. -/ + le_ncard : ∀ ⦃X : Set α⦄, X ⊆ E → r X ≤ X.ncard + /-- (iii) For `X ⊆ Y ⊆ E`, `r(X) ≤ r(Y)`. -/ + mono : ∀ ⦃X Y : Set α⦄, X ⊆ Y → Y ⊆ E → r X ≤ r Y + /-- (iv) For `X, Y ⊆ E`, `r(X ∪ Y) + r(X ∩ Y) ≤ r(X) + r(Y)`. -/ + submodular : ∀ ⦃X Y : Set α⦄, X ⊆ E → Y ⊆ E → r (X ∪ Y) + r (X ∩ Y) ≤ r X + r Y + +/-- A subset `X ⊆ V(G)` is free with respect to a tangle `𝒯` of order `θ` +(Graph Minors X, Section 12, page 189): +"Thus, given $\mathscr{T}$, $G$ as before, let us say that $X \subseteq V(G)$ is *free* if +$|X| \le \theta$ and there is no $(A, B) \in \mathscr{T}$ of order $< |X|$ with $X \subseteq +V(A)$." -/ +def IsFreeSet (G : Hypergraph α β) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (θ : ℕ) (X : Set α) : Prop := + X ⊆ G.vertexSet ∧ X.ncard ≤ θ ∧ + ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ 𝒯 → X ⊆ A.vertexSet → X.ncard ≤ separationOrder A B + +/-- The Tutte-order of a separation `(A, B)` of `G` (Graph Minors X, Section 12, page 189): +"$$|V(A \cap B)| + 1 + \kappa(G) - \kappa(A) - \kappa(B),$$ where $\kappa(F)$ denotes the +number of components of $F$, for a subgraph $F$ of $G$" -/ +noncomputable def tutteOrder (G A B : Hypergraph α β) : ℤ := + (separationOrder A B : ℤ) + 1 + + (Nat.card (G.skeleton.induce G.vertexSet).ConnectedComponent : ℤ) - + (Nat.card (A.skeleton.induce A.vertexSet).ConnectedComponent : ℤ) - + (Nat.card (B.skeleton.induce B.vertexSet).ConnectedComponent : ℤ) + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/GraphSubhypergraph.lean b/LeanPool/GraphMinor/GM10/GraphSubhypergraph.lean new file mode 100644 index 0000000000..d4a57941e3 --- /dev/null +++ b/LeanPool/GraphMinor/GM10/GraphSubhypergraph.lean @@ -0,0 +1,119 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Minor.Model +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Subgraphs associated with subhypergraphs of a graph + +On subhypergraphs of the incidence hypergraph of a graph, restriction to +the given vertices and edges gives the inverse correspondence. +-/ + +@[expose] public section + +namespace GraphMinor.GM10 + +open Set Graph Hypergraph + +universe u v +variable {α : Type u} {β : Type v} + +/-- If `u ≠ v` and `e` is incident with both `u` and `v` in `G : Graph α β`, then `G.IsLink e u v`. +-/ +theorem isLink_of_inc_of_inc_of_ne {G : Graph α β} {e : β} {u v : α} + (hu : G.Inc e u) (hv : G.Inc e v) (huv : u ≠ v) : G.IsLink e u v := by + rcases hu with ⟨x, hux⟩ + rcases hv with ⟨y, hvy⟩ + rcases G.eq_or_eq_of_isLink_of_isLink hvy hux.symm with rfl | rfl + · exact hux + · exact (huv rfl).elim + +/-- Reachability in `(Hypergraph.ofGraph H hVH hEH).skeleton` implies `Relation.ReflTransGen H.Adj`. +-/ +theorem reflTransGen_adj_of_skeleton_walk {H : Graph α β} + {hVH : V(H).Finite} {hEH : E(H).Finite} {u v : α} + (w : (Hypergraph.ofGraph H hVH hEH).skeleton.Walk u v) : + Relation.ReflTransGen H.Adj u v := by + induction w with + | nil => exact Relation.ReflTransGen.refl + | @cons a b c hadj _ ih => + rcases hadj with ⟨hab, e, ha_inc, hb_inc⟩ + exact Relation.ReflTransGen.head ⟨e, isLink_of_inc_of_inc_of_ne ha_inc hb_inc hab⟩ ih + +/-- The subgraph of `G` corresponding to a subhypergraph `H ≤ Hypergraph.ofGraph G hV hE`. -/ +def subgraphOfSubhypergraph (G : Graph α β) (H : Hypergraph α β) : Graph α β := + (G.induce H.vertexSet).restrict H.edgeSet + +@[simp] +theorem vertexSet_subgraphOfSubhypergraph (G : Graph α β) (H : Hypergraph α β) : + V(subgraphOfSubhypergraph G H) = H.vertexSet := rfl + +theorem subgraphOfSubhypergraph_le {G : Graph α β} {hV : V(G).Finite} {hE : E(G).Finite} + {H : Hypergraph α β} (hH : H ≤ Hypergraph.ofGraph G hV hE) : + subgraphOfSubhypergraph G H ≤ G := + restrict_le.trans (G.induce_le hH.vertexSet_subset) + +@[simp] +theorem edgeSet_subgraphOfSubhypergraph {G : Graph α β} {hV : V(G).Finite} {hE : E(G).Finite} + {H : Hypergraph α β} (hH : H ≤ Hypergraph.ofGraph G hV hE) : + E(subgraphOfSubhypergraph G H) = H.edgeSet := by + ext e + simp only [subgraphOfSubhypergraph, edgeSet_restrict, mem_inter_iff, Graph.edgeSet_induce] + refine ⟨fun h => h.2, fun he => ⟨?_, he⟩⟩ + have heG : e ∈ E(G) := hH.edgeSet_subset he + obtain ⟨x, y, hlink⟩ := exists_isLink_of_mem_edgeSet heG + have hx_end : x ∈ (Hypergraph.ofGraph G hV hE).ends e := ⟨y, hlink⟩ + have hy_end : y ∈ (Hypergraph.ofGraph G hV hE).ends e := ⟨x, hlink.symm⟩ + rw [hH.ends_eq e he] at hx_end hy_end + exact ⟨x, y, hlink, H.vertex_mem_of_inc hx_end, H.vertex_mem_of_inc hy_end⟩ + +theorem subgraphOfSubhypergraph_mono {G : Graph α β} {hV : V(G).Finite} {hE : E(G).Finite} + {H₁ H₂ : Hypergraph α β} (h₁ : H₁ ≤ Hypergraph.ofGraph G hV hE) + (h₂ : H₂ ≤ Hypergraph.ofGraph G hV hE) (hle : H₁ ≤ H₂) : + subgraphOfSubhypergraph G H₁ ≤ subgraphOfSubhypergraph G H₂ := by + rw [(Compatible.of_le_le (subgraphOfSubhypergraph_le h₁) (subgraphOfSubhypergraph_le h₂)).le_iff] + rw [vertexSet_subgraphOfSubhypergraph, vertexSet_subgraphOfSubhypergraph, + edgeSet_subgraphOfSubhypergraph h₁, edgeSet_subgraphOfSubhypergraph h₂] + exact ⟨hle.vertexSet_subset, hle.edgeSet_subset⟩ + +theorem ofGraph_subgraphOfSubhypergraph {G : Graph α β} {hV : V(G).Finite} {hE : E(G).Finite} + {H : Hypergraph α β} (hH : H ≤ Hypergraph.ofGraph G hV hE) : + Hypergraph.ofGraph (subgraphOfSubhypergraph G H) H.vertexSet_finite + (H.edgeSet_finite.subset (by rw [edgeSet_subgraphOfSubhypergraph hH])) = H := by + have hleG : subgraphOfSubhypergraph G H ≤ G := subgraphOfSubhypergraph_le hH + have hle_of : Hypergraph.ofGraph (subgraphOfSubhypergraph G H) H.vertexSet_finite + (H.edgeSet_finite.subset (by rw [edgeSet_subgraphOfSubhypergraph hH])) ≤ + Hypergraph.ofGraph G hV hE := by + refine ⟨hH.vertexSet_subset, ?_, ?_⟩ + · change E(subgraphOfSubhypergraph G H) ⊆ E(G) + rw [edgeSet_subgraphOfSubhypergraph hH] + exact hH.edgeSet_subset + · intro e he + ext v + exact (hleG.inc_congr he).symm + exact GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle_of hH rfl + (edgeSet_subgraphOfSubhypergraph hH) + +theorem subgraphOfSubhypergraph_ofGraph {G H : Graph α β} (hH : H ≤ G) + (hVH : V(H).Finite) (hEH : E(H).Finite) : + subgraphOfSubhypergraph G (Hypergraph.ofGraph H hVH hEH) = H := by + have hle : subgraphOfSubhypergraph G (Hypergraph.ofGraph H hVH hEH) ≤ G := + restrict_le.trans (G.induce_le hH.vertexSet_mono) + refine (Compatible.of_le_le hle hH).ext rfl ?_ + ext e + simp only [subgraphOfSubhypergraph, edgeSet_restrict, mem_inter_iff, Graph.edgeSet_induce, + Hypergraph.ofGraph] + refine ⟨fun h => h.2, fun he => ⟨?_, he⟩⟩ + obtain ⟨x, y, hlink⟩ := exists_isLink_of_mem_edgeSet he + exact ⟨x, y, hlink.mono hH, hlink.left_mem, hlink.right_mem⟩ + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/Section10.lean b/LeanPool/GraphMinor/GM10/Section10.lean new file mode 100644 index 0000000000..ce7f3ec21f --- /dev/null +++ b/LeanPool/GraphMinor/GM10/Section10.lean @@ -0,0 +1,1521 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Defs2 +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM10.Section6 +import LeanPool.GraphMinor.GM10.Section8 +import LeanPool.GraphMinor.GM10.Section9 +import Mathlib.Combinatorics.SimpleGraph.Walk.Maps + +/-! +# Tangle Tree-Decompositions (Graph Minors X, Section 10) + +This file formalizes Section 10 of N. Robertson and P. D. Seymour, +*Graph Minors. X. Obstructions to tree-decomposition*, J. Combin. Theory Ser. B 52 (1991) 153–190 +(pages 180–184): + +- `exists_distinguishes_iff_areDistinguishable` and `theorem_10_1` + (**Graph Minors X, (10.1)**, page 180): either there is a separation of `G` distinguishing `𝒯₁` + from `𝒯₂` or `𝒯₁, 𝒯₂` are indistinguishable, and not both. +- `IsDistinction.unique`, `isDistinction_comm`, and `exists_isDistinction_iff` (page 181): + uniqueness, symmetry, and existence of the `(𝒯₁, 𝒯₂)`-distinction. +- `theorem_10_2` (**Graph Minors X, (10.2)**, page 181): if `𝒯₁, 𝒯₂` are distinguishable tangles + in `G`, the `(𝒯₁, 𝒯₂)`-distinction is doubly `λ`-robust. +- `theorem_10_3_claim_1` through `theorem_10_3_claim_7` and `theorem_10_3` + (**Graph Minors X, (10.3)**, pages 181–184): existence of a standard tree-decomposition of `G` + relative to mutually distinguishable tangles `𝒯₁, …, 𝒯ₙ`. +- `theorem_10_4_strict_inclusion`, `IsStandardTreeDecomposition.card_le_ncard_vertexSet`, + `IsStandardTreeDecomposition.ncard_edgeSet_le`, `card_le_of_mutually_distinguishable`, and + `theorem_10_4` (**Graph Minors X, (10.4)**, page 184): in any hypergraph `G` there are at most + `|V(G)|` maximal tangles. +-/ + +public section + +namespace GraphMinor.GM10 + +open SimpleGraph Hypergraph + +universe u v w + +variable {α : Type u} {β : Type v} {Λ : Type w} {ι : Type*} + +/-! ## Graph Minors X, (10.1) and basic properties of distinctions -/ + +theorem distinguishes_comm {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} + {A B : Hypergraph α β} : + Distinguishes 𝒯₁ 𝒯₂ A B ↔ Distinguishes 𝒯₂ 𝒯₁ B A := + and_comm + +theorem areIndistinguishable_comm {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} : + AreIndistinguishable 𝒯₁ 𝒯₂ ↔ AreIndistinguishable 𝒯₂ 𝒯₁ := + or_comm + +theorem areDistinguishable_comm {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} : + AreDistinguishable 𝒯₁ 𝒯₂ ↔ AreDistinguishable 𝒯₂ 𝒯₁ := + not_congr areIndistinguishable_comm + +/-- If `(A, B)` distinguishes `𝒯₁` from `𝒯₂`, then `𝒯₁` and `𝒯₂` are distinguishable. -/ +theorem areDistinguishable_of_distinguishes {G : Hypergraph α β} {θ₁ θ₂ : ℕ} + {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯₁ : IsTangle G θ₁ 𝒯₁) (h𝒯₂ : IsTangle G θ₂ 𝒯₂) + {A B : Hypergraph α β} (h : Distinguishes 𝒯₁ 𝒯₂ A B) : + AreDistinguishable 𝒯₁ 𝒯₂ := by + rintro (hsub | hsub) + · exact theorem_2_1_proof h𝒯₂ h.2 (hsub h.1) + · exact theorem_2_1_proof h𝒯₁ h.1 (hsub h.2) + +/-- Symmetry step in the proof of **Graph Minors X, (10.1)** (page 180): when `θ₁ ≤ θ₂`, +`𝒯₁` and `𝒯₂` are distinguishable if and only if there is a separation distinguishing `𝒯₁` from +`𝒯₂`. -/ +private theorem exists_distinguishes_of_areDistinguishable_of_le {G : Hypergraph α β} + {θ₁ θ₂ : ℕ} {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯₁ : IsTangle G θ₁ 𝒯₁) (h𝒯₂ : IsTangle G θ₂ 𝒯₂) (hle : θ₁ ≤ θ₂) + (hdist : AreDistinguishable 𝒯₁ 𝒯₂) : + ∃ A B : Hypergraph α β, Distinguishes 𝒯₁ 𝒯₂ A B := by + have hnot_sub : ¬ 𝒯₁ ⊆ 𝒯₂ := fun hsub ↦ hdist (Or.inl hsub) + obtain ⟨⟨A, B⟩, hAB₁, hAB₂⟩ := Set.not_subset.1 hnot_sub + have hsep : G.IsSeparation A B := h𝒯₁.isSeparation hAB₁ + have hord : separationOrder A B < θ₂ := (h𝒯₁.order_lt hAB₁).trans_le hle + have hBA₂ : (B, A) ∈ 𝒯₂ := (h𝒯₂.axiom1 hsep hord).resolve_left hAB₂ + exact ⟨A, B, hAB₁, hBA₂⟩ + +/-- Equivalence form of **Graph Minors X, (10.1)** (page 180): +there is a separation of `G` which distinguishes `𝒯₁` from `𝒯₂` if and only if `𝒯₁` and `𝒯₂` are +distinguishable. -/ +theorem exists_distinguishes_iff_areDistinguishable {G : Hypergraph α β} {θ₁ θ₂ : ℕ} + {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯₁ : IsTangle G θ₁ 𝒯₁) (h𝒯₂ : IsTangle G θ₂ 𝒯₂) : + (∃ A B : Hypergraph α β, Distinguishes 𝒯₁ 𝒯₂ A B) ↔ AreDistinguishable 𝒯₁ 𝒯₂ := by + refine ⟨fun ⟨A, B, h⟩ ↦ areDistinguishable_of_distinguishes h𝒯₁ h𝒯₂ h, fun hdist ↦ ?_⟩ + rcases le_total θ₁ θ₂ with hle | hle + · exact exists_distinguishes_of_areDistinguishable_of_le h𝒯₁ h𝒯₂ hle hdist + · obtain ⟨B, A, hBA⟩ := + exists_distinguishes_of_areDistinguishable_of_le h𝒯₂ h𝒯₁ hle (areDistinguishable_comm.1 hdist) + exact ⟨A, B, distinguishes_comm.2 hBA⟩ + +/-- **Graph Minors X, (10.1)** (page 180): +"Either there is a separation of $G$ which distinguishes $\mathscr{T}_1$ from $\mathscr{T}_2$ +or $\mathscr{T}_1$, $\mathscr{T}_2$ are indistinguishable and not both." -/ +theorem theorem_10_1_proof {G : Hypergraph α β} {θ₁ θ₂ : ℕ} + {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯₁ : IsTangle G θ₁ 𝒯₁) (h𝒯₂ : IsTangle G θ₂ 𝒯₂) : + ((∃ A B : Hypergraph α β, Distinguishes 𝒯₁ 𝒯₂ A B) ∨ AreIndistinguishable 𝒯₁ 𝒯₂) ∧ + ¬ ((∃ A B : Hypergraph α β, Distinguishes 𝒯₁ 𝒯₂ A B) ∧ AreIndistinguishable 𝒯₁ 𝒯₂) := by + rw [exists_distinguishes_iff_areDistinguishable h𝒯₁ h𝒯₂] + unfold AreDistinguishable + exact ⟨(em _).symm, fun ⟨h1, h2⟩ ↦ h1 h2⟩ + +/-- Uniqueness of the `(𝒯₁, 𝒯₂)`-distinction (Graph Minors X, Section 10, page 181): +"From the first tie-breaker axiom, $(A, B)$ is unique, and we may speak of *the* +$(\mathscr{T}_1, \mathscr{T}_2)$-distinction." -/ +theorem IsDistinction.unique [LinearOrder Λ] {G : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} (hTB : IsTieBreaker G lam) + {θ₁ : ℕ} {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} (h𝒯₁ : IsTangle G θ₁ 𝒯₁) + {A B A' B' : Hypergraph α β} + (h : IsDistinction lam 𝒯₁ 𝒯₂ A B) (h' : IsDistinction lam 𝒯₁ 𝒯₂ A' B') : + A = A' ∧ B = B' := by + have hle1 : lam (A, B) ≤ lam (A', B') := h.2 h'.1 + have hle2 : lam (A', B') ≤ lam (A, B) := h'.2 h.1 + have heq : lam (A, B) = lam (A', B') := le_antisymm hle1 hle2 + have hsep : G.IsSeparation A B := h𝒯₁.isSeparation h.1.1 + have hsep' : G.IsSeparation A' B' := h𝒯₁.isSeparation h'.1.1 + rcases (hTB.axiom1 hsep hsep').1 heq with h1 | ⟨rfl, rfl⟩ + · exact h1 + · exact (theorem_2_1_proof h𝒯₁ h.1.1 h'.1.1).elim + +/-- `(A, B)` is the `(𝒯₁, 𝒯₂)`-distinction if and only if `(B, A)` is the `(𝒯₂, 𝒯₁)`-distinction +(Graph Minors X, Section 10, proof of (10.2), page 181). -/ +theorem isDistinction_comm [LinearOrder Λ] {G : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} (hTB : IsTieBreaker G lam) + {θ₁ θ₂ : ℕ} {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯₁ : IsTangle G θ₁ 𝒯₁) (h𝒯₂ : IsTangle G θ₂ 𝒯₂) + {A B : Hypergraph α β} : + IsDistinction lam 𝒯₁ 𝒯₂ A B ↔ IsDistinction lam 𝒯₂ 𝒯₁ B A := by + constructor <;> rintro ⟨hdist, hmin⟩ + · refine ⟨distinguishes_comm.1 hdist, fun B' A' h' ↦ ?_⟩ + have hsep : G.IsSeparation A B := h𝒯₁.isSeparation hdist.1 + have hsep' : G.IsSeparation A' B' := h𝒯₁.isSeparation h'.2 + rw [hTB.lam_swap hsep, hTB.lam_swap hsep'] + exact hmin (distinguishes_comm.2 h') + · refine ⟨distinguishes_comm.2 hdist, fun A' B' h' ↦ ?_⟩ + have hsep : G.IsSeparation B A := h𝒯₂.isSeparation hdist.1 + have hsep' : G.IsSeparation B' A' := h𝒯₂.isSeparation h'.2 + rw [hTB.lam_swap hsep, hTB.lam_swap hsep'] + exact hmin (distinguishes_comm.1 h') + +/-- Existence of the `(𝒯₁, 𝒯₂)`-distinction (Graph Minors X, Section 10, page 181): +"There is a $(\mathscr{T}_1, \mathscr{T}_2)$-distinction if and only if $\mathscr{T}_1, +\mathscr{T}_2$ are distinguishable." -/ +theorem exists_isDistinction_iff [LinearOrder Λ] {G : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ₁ θ₂ : ℕ} {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯₁ : IsTangle G θ₁ 𝒯₁) (h𝒯₂ : IsTangle G θ₂ 𝒯₂) : + (∃ A B : Hypergraph α β, IsDistinction lam 𝒯₁ 𝒯₂ A B) ↔ AreDistinguishable 𝒯₁ 𝒯₂ := by + rw [← exists_distinguishes_iff_areDistinguishable h𝒯₁ h𝒯₂] + refine ⟨fun ⟨A, B, h, _⟩ ↦ ⟨A, B, h⟩, fun ⟨A₀, B₀, h₀⟩ ↦ ?_⟩ + classical + let D : Set (Hypergraph α β × Hypergraph α β) := {p | Distinguishes 𝒯₁ 𝒯₂ p.1 p.2} + have hD_fin : D.Finite := + finite_of_forall_isSeparation fun p hp ↦ h𝒯₁.isSeparation hp.1 + have hD_ne : hD_fin.toFinset.Nonempty := ⟨(A₀, B₀), hD_fin.mem_toFinset.2 h₀⟩ + obtain ⟨⟨A, B⟩, hmem, hmin⟩ := hD_fin.toFinset.exists_min_image lam hD_ne + refine ⟨A, B, hD_fin.mem_toFinset.1 hmem, fun A' B' h' ↦ ?_⟩ + exact hmin (A', B') (hD_fin.mem_toFinset.2 h') + +/-! ## Graph Minors X, (10.2) -/ + +/-- If `(A, B)` is a separation of `G` and `(C, D)` is a separation of `A`, then `(C, B ∪ D)` is a +separation of `G`. -/ +theorem isSeparation_of_isSeparation_left {G A B C D : Hypergraph α β} + (hAB : G.IsSeparation A B) (hCD : A.IsSeparation C D) : + G.IsSeparation C (B ∪ D) := by + have hC_G : C ≤ G := hCD.left_le.trans hAB.left_le + have hD_G : D ≤ G := hCD.right_le.trans hAB.left_le + rw [isSeparation_iff_of_le hC_G (union_le hAB.right_le hD_G)] + refine ⟨?_, ?_, ?_⟩ + · rw [union_vertexSet, ← Set.union_assoc, Set.union_comm C.vertexSet B.vertexSet, + Set.union_assoc, hCD.vertexSet_union, Set.union_comm B.vertexSet A.vertexSet, + hAB.vertexSet_union] + · rw [union_edgeSet, ← Set.union_assoc, Set.union_comm C.edgeSet B.edgeSet, + Set.union_assoc, hCD.edgeSet_union, Set.union_comm B.edgeSet A.edgeSet, + hAB.edgeSet_union] + · ext e + simp only [union_edgeSet, Set.mem_inter_iff, Set.mem_union, Set.mem_empty_iff_false, + iff_false, not_and] + rintro heC (heB | heD) + · exact hAB.notMem_edgeSet_right (hCD.left_le.edgeSet_subset heC) heB + · exact hCD.notMem_edgeSet_right heC heD + +/-- Key step of **Graph Minors X, (10.2)** (page 181): the `(𝒯₁, 𝒯₂)`-distinction is `λ`-robust. -/ +private theorem isLambdaRobust_of_isDistinction [LinearOrder Λ] {G : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} (hTB : IsTieBreaker G lam) + {θ₁ θ₂ : ℕ} {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯₁ : IsTangle G θ₁ 𝒯₁) (h𝒯₂ : IsTangle G θ₂ 𝒯₂) + {A B : Hypergraph α β} (hdist : IsDistinction lam 𝒯₁ 𝒯₂ A B) : + IsLambdaRobust G lam A B := by + have hAB : G.IsSeparation A B := h𝒯₁.isSeparation hdist.1.1 + refine ⟨hAB, fun C D hCD ↦ ?_⟩ + by_contra! hlt + rcases hlt with ⟨hltC, hltD⟩ + have hsepC : G.IsSeparation C (B ∪ D) := isSeparation_of_isSeparation_left hAB hCD + have hsepD : G.IsSeparation D (B ∪ C) := isSeparation_of_isSeparation_left hAB hCD.symm + have hordC_le : separationOrder C (B ∪ D) ≤ separationOrder A B := by + by_contra! hgt + exact not_lt_of_ge hltC.le (hTB.axiom3 hAB hsepC hgt) + have hordD_le : separationOrder D (B ∪ C) ≤ separationOrder A B := by + by_contra! hgt + exact not_lt_of_ge hltD.le (hTB.axiom3 hAB hsepD hgt) + have hordAB_1 : separationOrder A B < θ₁ := h𝒯₁.order_lt hdist.1.1 + have hordAB_2 : separationOrder A B < θ₂ := by + rw [separationOrder_comm] + exact h𝒯₂.order_lt hdist.1.2 + have hC_in_1 : (C, B ∪ D) ∈ 𝒯₁ := + theorem_2_9_proof h𝒯₁ hdist.1.1 hsepC (hordC_le.trans_lt hordAB_1) + (Or.inr (Or.inl hCD.left_le.vertexSet_subset)) + have hD_in_1 : (D, B ∪ C) ∈ 𝒯₁ := + theorem_2_9_proof h𝒯₁ hdist.1.1 hsepD (hordD_le.trans_lt hordAB_1) + (Or.inr (Or.inl hCD.right_le.vertexSet_subset)) + have hC_not_2 : (B ∪ D, C) ∉ 𝒯₂ := fun hm ↦ + not_lt_of_ge (hdist.2 ⟨hC_in_1, hm⟩) hltC + have hD_not_2 : (B ∪ C, D) ∉ 𝒯₂ := fun hm ↦ + not_lt_of_ge (hdist.2 ⟨hD_in_1, hm⟩) hltD + have hC_in_2 : (C, B ∪ D) ∈ 𝒯₂ := + (h𝒯₂.axiom1 hsepC (hordC_le.trans_lt hordAB_2)).resolve_right hC_not_2 + have hD_in_2 : (D, B ∪ C) ∈ 𝒯₂ := + (h𝒯₂.axiom1 hsepD (hordD_le.trans_lt hordAB_2)).resolve_right hD_not_2 + apply h𝒯₂.axiom2 hdist.1.2 hC_in_2 hD_in_2 + rw [union_assoc, hCD.union_eq, union_comm B A, hAB.union_eq] + +/-- **Graph Minors X, (10.2)** (page 181): +"If $\mathscr{T}_1, \mathscr{T}_2$ are distinguishable tangles in $G$, the $(\mathscr{T}_1, +\mathscr{T}_2)$-distinction is doubly $\lambda$-robust." -/ +theorem theorem_10_2_proof [LinearOrder Λ] + (G : Hypergraph α β) (lam : Hypergraph α β × Hypergraph α β → Λ) + (θ₁ θ₂ : ℕ) (𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)) + (A B : Hypergraph α β) + (hTB : IsTieBreaker G lam) + (h𝒯₁ : IsTangle G θ₁ 𝒯₁) + (h𝒯₂ : IsTangle G θ₂ 𝒯₂) + (hdist : IsDistinction lam 𝒯₁ 𝒯₂ A B) : + IsDoublyLambdaRobust G lam A B := + ⟨isLambdaRobust_of_isDistinction hTB h𝒯₁ h𝒯₂ hdist, + isLambdaRobust_of_isDistinction hTB h𝒯₂ h𝒯₁ + ((isDistinction_comm hTB h𝒯₁ h𝒯₂).1 hdist)⟩ + +/-! ## Tree path and edge lemmas for (10.3) -/ + +/-- If a walk `p : T.Walk x y` does not contain the edge `e`, then `x` and `y` are reachable in +`T.deleteEdges {e}`. -/ +private theorem reachable_deleteEdges_of_notMem_edges {T : SimpleGraph ι} {e : Sym2 ι} + {x y : ι} (p : T.Walk x y) (he : e ∉ p.edges) : + (T.deleteEdges {e}).Reachable x y := by + induction p with + | nil => exact Reachable.refl _ + | @cons a b c hab q ih => + simp only [Walk.edges_cons, List.mem_cons, not_or] at he + have hadj : (T.deleteEdges {e}).Adj a b := + deleteEdges_adj.mpr ⟨hab, Ne.symm he.1⟩ + exact hadj.reachable.trans (ih he.2) + +/-- In a tree `T`, an edge `e ∈ T.edgeSet` lies on a path `p : T.Walk x y` if and only if +`x` and `y` are in different components of `T \ e`. -/ +theorem edge_mem_path_iff_not_reachable_deleteEdges {T : SimpleGraph ι} (hT : T.IsTree) + {e : Sym2 ι} {x y : ι} (p : T.Walk x y) (hp : p.IsPath) : + e ∈ p.edges ↔ ¬ (T.deleteEdges {e}).Reachable x y := by + classical + constructor + · intro he ⟨q⟩ + let q_path := q.toPath + have hemb : T.deleteEdges {e} ≤ T := SimpleGraph.deleteEdges_le {e} + let q' : T.Walk x y := q_path.1.map (Hom.ofLE hemb) + have hq'_path : q'.IsPath := q_path.2.map (fun _ _ h ↦ h) + obtain ⟨_, _, huniq⟩ := hT.existsUnique_path x y + have hpq : p = q' := (huniq p hp).trans (huniq q' hq'_path).symm + rw [hpq] at he + have he_sub : e ∈ q_path.1.edges := by + simpa [q', Walk.edges_map] using he + have he_q : e ∈ q.edges := Walk.edges_toPath_subset_edges q he_sub + have hnot : ∀ {u v : ι} (r : (T.deleteEdges {e}).Walk u v), e ∉ r.edges := by + intro u v r + induction r with + | nil => simp + | @cons a b c hab r ih => + simp only [Walk.edges_cons, List.mem_cons, not_or] + exact ⟨Ne.symm (deleteEdges_adj.mp hab).2, ih⟩ + exact hnot q he_q + · intro hnr + by_contra he + exact hnr (reachable_deleteEdges_of_notMem_edges p he) + +/-- In a tree `T`, if `e = s(u, v)` is an edge of `T` (`T.Adj u v`), then `¬ (T \ e).Reachable x y` +if and only if `(T \ e).Reachable u x ∧ (T \ e).Reachable v y` or +`(T \ e).Reachable v x ∧ (T \ e).Reachable u y`. -/ +theorem not_reachable_deleteEdges_iff_sides {T : SimpleGraph ι} (hT : T.IsTree) + {u v x y : ι} (hadj : T.Adj u v) : + ¬ (T.deleteEdges {s(u, v)}).Reachable x y ↔ + ((T.deleteEdges {s(u, v)}).Reachable u x ∧ (T.deleteEdges {s(u, v)}).Reachable v y) ∨ + ((T.deleteEdges {s(u, v)}).Reachable v x ∧ (T.deleteEdges {s(u, v)}).Reachable u y) := by + have hnot_uv := not_reachable_deleteEdges hT hadj + have hx := reachable_deleteEdges_or hT.connected (u := u) (v := v) x + have hy := reachable_deleteEdges_or hT.connected (u := u) (v := v) y + constructor + · intro hnr + rcases hx with hux | hvx <;> rcases hy with huy | hvy + · exfalso; exact hnr (hux.symm.trans huy) + · exact Or.inl ⟨hux, hvy⟩ + · exact Or.inr ⟨hvx, huy⟩ + · exfalso; exact hnr (hvx.symm.trans hvy) + · rintro (⟨hux, hvy⟩ | ⟨hvx, huy⟩) hxy + · exact hnot_uv (hux.trans (hxy.trans hvy.symm)) + · exact hnot_uv (huy.trans (hxy.symm.trans hvx.symm)) + +/-! ## Claims (1)–(7) and Proof of Graph Minors X, (10.3) -/ + +/-- Claim (1) in the proof of **Graph Minors X, (10.3)** (page 182): +"For $t_0 \in T$ and $1 \le i < j \le n$, $t_0$ is not a home for both $\mathscr{T}_i$ and +$\mathscr{T}_j$." -/ +theorem theorem_10_3_claim_1 [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} + {e : Sym2 ι} {A B : Hypergraph α β} + (hmk : MakesSeparation T τ e A B) (hdist : Distinguishes 𝒯₁ 𝒯₂ A B) + (t₀ : ι) : + ¬ (IsHome T τ 𝒯₁ t₀ ∧ IsHome T τ 𝒯₂ t₀) := by + rintro ⟨h1, h2⟩ + obtain ⟨u, v, hadj, rfl, rfl, rfl⟩ := hmk + rcases reachable_deleteEdges_or hTD.isTree.connected (u := u) (v := v) t₀ with hut₀ | hvt₀ + · exact h1 hadj hut₀ hdist.1 + · have h2' := h2 hadj.symm (by simpa [Sym2.eq_swap] using hvt₀) + exact h2' (by simpa [Sym2.eq_swap] using hdist.2) + +/-- An edge `e` of `T` is `θ`-relevant if the separations made by `e` have order `< θ` +(Graph Minors X, Section 10, proof of (10.3), page 182). -/ +def IsRelevantEdge [Fintype ι] (T : SimpleGraph ι) (τ : ι → Hypergraph α β) + (θ : ℕ) (e : Sym2 ι) : Prop := + ∃ u v : ι, T.Adj u v ∧ e = s(u, v) ∧ + separationOrder (treeDecompSide T τ s(u, v) u) (treeDecompSide T τ s(u, v) v) < θ + +theorem IsRelevantEdge.order_lt_of_makesSeparation [Fintype ι] {T : SimpleGraph ι} + {τ : ι → Hypergraph α β} {θ : ℕ} {e : Sym2 ι} + (hrel : IsRelevantEdge T τ θ e) {A B : Hypergraph α β} + (hmk : MakesSeparation T τ e A B) : + separationOrder A B < θ := by + obtain ⟨u, v, _, he, hord⟩ := hrel + obtain ⟨u', v', _, he', rfl, rfl⟩ := hmk + rcases Sym2.eq_iff.1 (he.symm.trans he') with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hord + · simpa [Sym2.eq_swap, separationOrder_comm] using hord + +/-- Claim (2) in the proof of **Graph Minors X, (10.3)** (page 182): +"$t_0 \in V(T)$ is a home for $\mathscr{T}_i$ if and only if every $i$-relevant edge of $T$ +is directed towards $t_0$." -/ +theorem theorem_10_3_claim_2 [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {θ : ℕ} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) (t₀ : ι) : + IsHome T τ 𝒯 t₀ ↔ + ∀ ⦃u v : ι⦄, T.Adj u v → + separationOrder (treeDecompSide T τ s(u, v) u) (treeDecompSide T τ s(u, v) v) < θ → + (T.deleteEdges {s(u, v)}).Reachable u t₀ → + (treeDecompSide T τ s(u, v) v, treeDecompSide T τ s(u, v) u) ∈ 𝒯 := by + constructor + · intro hHome u v hadj hord hut₀ + have hsep := hTD.isSeparation_treeDecompSide hadj + exact (h𝒯.axiom1 hsep hord).resolve_left (hHome hadj hut₀) + · intro hDir u v hadj hut₀ hm + have hord := h𝒯.order_lt hm + exact theorem_2_1_proof h𝒯 hm (hDir hadj hord hut₀) + +/-- Sub-claim of Claim (3) in the proof of **Graph Minors X, (10.3)** (pages 182–183): +for any two `i`-relevant edges `s(u, v)` and `s(u', v')` directed towards `v` and `v'` respectively, +the head components `V(T₂)` and `V(T'₂)` intersect. -/ +theorem theorem_10_3_claim_3_heads_inter [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {θ : ℕ} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {u v u' v' : ι} (hadj : T.Adj u v) (hadj' : T.Adj u' v') + (h1 : (treeDecompSide T τ s(u, v) u, treeDecompSide T τ s(u, v) v) ∈ 𝒯) + (h2 : (treeDecompSide T τ s(u', v') u', treeDecompSide T τ s(u', v') v') ∈ 𝒯) : + ∃ t : ι, (T.deleteEdges {s(u, v)}).Reachable v t ∧ + (T.deleteEdges {s(u', v')}).Reachable v' t := by + by_contra! hdisj + have hsub : treeDecompSide T τ s(u', v') v' ≤ treeDecompSide T τ s(u, v) u := by + apply biUnion_mono hTD.le + intro t ht + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at ht ⊢ + exact (reachable_deleteEdges_or hTD.isTree.connected t).resolve_right + fun hvt ↦ hdisj t hvt ht + have hsep' := hTD.isSeparation_treeDecompSide hadj' + apply h𝒯.axiom2 h1 h1 h2 + rw [union_self] + have hle1 := (hTD.isSeparation_treeDecompSide hadj).left_le + have hle2 := hsep'.left_le + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq (union_le hle1 hle2) le_rfl ?_ ?_ + · ext x + simp only [union_vertexSet, Set.mem_union] + exact ⟨fun h ↦ h.elim (fun hx ↦ hle1.vertexSet_subset hx) (fun hx ↦ hle2.vertexSet_subset hx), + fun hx ↦ (hsep'.vertexSet_union.symm ▸ hx).elim Or.inr + (fun hx' ↦ Or.inl (hsub.vertexSet_subset hx'))⟩ + · ext e + simp only [union_edgeSet, Set.mem_union] + exact ⟨fun h ↦ h.elim (fun he ↦ hle1.edgeSet_subset he) (fun he ↦ hle2.edgeSet_subset he), + fun he ↦ (hsep'.edgeSet_union.symm ▸ he).elim Or.inr + (fun he' ↦ Or.inl (hsub.edgeSet_subset he'))⟩ + +/-- First part of Claim (3) in the proof of **Graph Minors X, (10.3)** (page 182): +the set `Hᵢ` of homes for `𝒯ᵢ` is non-empty. -/ +theorem theorem_10_3_claim_3_nonempty [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {θ : ℕ} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) : + ∃ t₀ : ι, IsHome T τ 𝒯 t₀ := by + let R : ι → ι → Prop := fun x y ↦ + ∀ u v : ι, T.Adj u v → + (∀ t : ι, (T.deleteEdges {s(u, v)}).Reachable v t → + (T.deleteEdges {s(x, y)}).Reachable y t) → + (treeDecompSide T τ s(u, v) u, treeDecompSide T τ s(u, v) v) ∉ 𝒯 + have hR : ∀ ⦃x y : ι⦄, T.Adj x y → R x y ∨ R y x := by + intro x y hxy + by_contra! hnot + dsimp only [R] at hnot + push Not at hnot + rcases hnot with ⟨⟨u, v, huv, hsub1, hm1⟩, ⟨u', v', huv', hsub2, hm2⟩⟩ + obtain ⟨t, hvt, hv't⟩ := theorem_10_3_claim_3_heads_inter hTD h𝒯 huv huv' hm1 hm2 + have hyt : (T.deleteEdges {s(x, y)}).Reachable y t := hsub1 t hvt + have hxt : (T.deleteEdges {s(x, y)}).Reachable x t := by + simpa [Sym2.eq_swap] using hsub2 t hv't + exact not_reachable_deleteEdges hTD.isTree hxy (hxt.trans hyt.symm) + obtain ⟨t₀, ht₀⟩ := exists_sink_of_adj_or hTD.isTree hR + refine ⟨t₀, fun u v huv hut₀ ↦ ?_⟩ + obtain ⟨p, hp, _⟩ := hTD.isTree.existsUnique_path t₀ v + cases p with + | nil => + exfalso + exact not_reachable_deleteEdges hTD.isTree huv hut₀ + | @cons _ w _ htw q => + refine ht₀ w htw u v huv fun t hvt ↦ ?_ + have hnot_ut : ¬ (T.deleteEdges {s(u, v)}).Reachable u t := + fun hut ↦ not_reachable_deleteEdges hTD.isTree huv (hut.trans hvt.symm) + have hnot_t₀t : ¬ (T.deleteEdges {s(u, v)}).Reachable t₀ t := + fun ht₀t ↦ hnot_ut (hut₀.trans ht₀t) + have h_edge : s(t₀, w) ∈ (Walk.cons htw q).edges := by simp + have h_uv_mem : s(u, v) ∈ (Walk.cons htw q).edges := + (edge_mem_path_iff_not_reachable_deleteEdges hTD.isTree (Walk.cons htw q) hp).2 + (fun ht₀v ↦ not_reachable_deleteEdges hTD.isTree huv (hut₀.trans ht₀v)) + by_cases heq : s(u, v) = s(t₀, w) + · rcases Sym2.eq_iff.1 heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hvt + · exfalso + exact not_reachable_deleteEdges hTD.isTree huv hut₀ + · have hadj_uv_in_tw : (T.deleteEdges {s(t₀, w)}).Adj u v := + deleteEdges_adj.mpr ⟨huv, heq⟩ + have hvt_in_tw : (T.deleteEdges {s(t₀, w)}).Reachable v t := + reachable_deleteEdges_of_not_reachable hvt (fun hvt₀ ↦ + not_reachable_deleteEdges hTD.isTree huv (hut₀.trans hvt₀.symm)) + rw [Walk.cons_isPath_iff] at hp + have h_wv_in_tw : (T.deleteEdges {s(t₀, w)}).Reachable w v := + reachable_deleteEdges_of_notMem_support q hp.2 + exact h_wv_in_tw.trans hvt_in_tw + +/-- Second part of Claim (3) in the proof of **Graph Minors X, (10.3)** (page 182): +the set `Hᵢ` of homes for `𝒯ᵢ` is the vertex set of a subtree of `T` (closed under `OnTreePath`). -/ +theorem theorem_10_3_claim_3_subtree [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {t₁ t₂ t : ι} (h1 : IsHome T τ 𝒯 t₁) (h2 : IsHome T τ 𝒯 t₂) + (hon : OnTreePath T t₁ t₂ t) : + IsHome T τ 𝒯 t := by + classical + intro u v hadj hut + by_cases hut₁ : (T.deleteEdges {s(u, v)}).Reachable u t₁ + · exact h1 hadj hut₁ + · by_cases hut₂ : (T.deleteEdges {s(u, v)}).Reachable u t₂ + · exact h2 hadj hut₂ + · exfalso + have hvt₁ : (T.deleteEdges {s(u, v)}).Reachable v t₁ := + (reachable_deleteEdges_or hTD.isTree.connected t₁).resolve_left hut₁ + have hvt₂ : (T.deleteEdges {s(u, v)}).Reachable v t₂ := + (reachable_deleteEdges_or hTD.isTree.connected t₂).resolve_left hut₂ + obtain ⟨p, hp, _⟩ := hTD.isTree.existsUnique_path t₁ t₂ + have hnot_e : s(u, v) ∉ p.edges := by + rw [edge_mem_path_iff_not_reachable_deleteEdges hTD.isTree p hp, not_not] + exact hvt₁.symm.trans hvt₂ + have ht_mem : t ∈ p.support := hon p hp + have hp₁ : (p.takeUntil t ht_mem).IsPath := hp.takeUntil ht_mem + have hnot_e₁ : s(u, v) ∉ (p.takeUntil t ht_mem).edges := + fun hm ↦ hnot_e (Walk.edges_takeUntil_subset_edges p ht_mem hm) + have ht₁t : (T.deleteEdges {s(u, v)}).Reachable t₁ t := + reachable_deleteEdges_of_notMem_edges (p.takeUntil t ht_mem) hnot_e₁ + exact hut₁ (hut.trans ht₁t.symm) + +/-- Claim (4) in the proof of **Graph Minors X, (10.3)** (page 183): +"If $e \in E(T)$ has ends $x, y \in V(T)$, and $x \in H_i$, $y \notin H_i$, then $e$ is +$i$-relevant" (and +directed from `y` to `x`). -/ +theorem theorem_10_3_claim_4 [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} + {θ : ℕ} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {x y : ι} (hadj : T.Adj x y) (hx : IsHome T τ 𝒯 x) (hy : ¬ IsHome T τ 𝒯 y) : + (treeDecompSide T τ s(x, y) y, treeDecompSide T τ s(x, y) x) ∈ 𝒯 ∧ + IsRelevantEdge T τ θ s(x, y) := by + unfold IsHome at hy + push Not at hy + obtain ⟨u, v, huv, huy, hm⟩ := hy + have hnot_ux : ¬ (T.deleteEdges {s(u, v)}).Reachable u x := + fun hux ↦ hx huv hux hm + have heq : s(u, v) = s(x, y) := by + by_contra hne + have hadj_xy : (T.deleteEdges {s(u, v)}).Adj y x := + deleteEdges_adj.mpr ⟨hadj.symm, fun h ↦ hne (h.symm.trans Sym2.eq_swap)⟩ + exact hnot_ux (huy.trans hadj_xy.reachable) + rcases Sym2.eq_iff.1 heq.symm with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact (hnot_ux (Reachable.refl _)).elim + · have hm' : (treeDecompSide T τ s(x, y) y, treeDecompSide T τ s(x, y) x) ∈ 𝒯 := by + simpa [Sym2.eq_swap] using hm + refine ⟨hm', x, y, hadj, rfl, ?_⟩ + rw [separationOrder_comm] + exact h𝒯.order_lt hm' + +/-- Claim (5) in the proof of **Graph Minors X, (10.3)** (page 183): +"For $1 \le i, j \le n$, and $e \in E(T)$, $e$ makes a separation which distinguishes +$\mathscr{T}_i$ from $\mathscr{T}_j$ if and only if $e$ lies on the (unique) minimal path of +$T$ between $V(H_i)$ and $V(H_j)$ and is $i$- and $j$-relevant." +Here `tᵢ ∈ Hᵢ` and `tⱼ ∈ Hⱼ` are any homes for `𝒯ᵢ` and `𝒯ⱼ`. -/ +theorem theorem_10_3_claim_5 [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {θ₁ θ₂ : ℕ} {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯₁ : IsTangle G θ₁ 𝒯₁) (h𝒯₂ : IsTangle G θ₂ 𝒯₂) + {t₁ t₂ : ι} (ht₁ : IsHome T τ 𝒯₁ t₁) (ht₂ : IsHome T τ 𝒯₂ t₂) + {e : Sym2 ι} (he : e ∈ T.edgeSet) : + (∃ A B : Hypergraph α β, MakesSeparation T τ e A B ∧ Distinguishes 𝒯₁ 𝒯₂ A B) ↔ + (∀ p : T.Walk t₁ t₂, p.IsPath → e ∈ p.edges) ∧ + IsRelevantEdge T τ θ₁ e ∧ IsRelevantEdge T τ θ₂ e := by + induction e using Sym2.ind with | _ u v => + have hadj : T.Adj u v := he + constructor + · rintro ⟨A, B, ⟨u', v', hadj', heq, rfl, rfl⟩, hA₁, hB₂⟩ + have hord₁ : separationOrder (treeDecompSide T τ s(u', v') u') + (treeDecompSide T τ s(u', v') v') < θ₁ := h𝒯₁.order_lt hA₁ + have hord₂ : separationOrder (treeDecompSide T τ s(u', v') u') + (treeDecompSide T τ s(u', v') v') < θ₂ := by + rw [separationOrder_comm] + exact h𝒯₂.order_lt hB₂ + have hnot_u't₁ : ¬ (T.deleteEdges {s(u', v')}).Reachable u' t₁ := + fun hr ↦ ht₁ hadj' hr hA₁ + have hv't₁ : (T.deleteEdges {s(u', v')}).Reachable v' t₁ := + (reachable_deleteEdges_or hTD.isTree.connected t₁).resolve_left hnot_u't₁ + have hnot_v't₂ : ¬ (T.deleteEdges {s(u', v')}).Reachable v' t₂ := by + intro hr + have := ht₂ hadj'.symm (by simpa [Sym2.eq_swap] using hr) + exact this (by simpa [Sym2.eq_swap] using hB₂) + have hu't₂ : (T.deleteEdges {s(u', v')}).Reachable u' t₂ := + (reachable_deleteEdges_or hTD.isTree.connected t₂).resolve_right hnot_v't₂ + have hnr : ¬ (T.deleteEdges {s(u, v)}).Reachable t₁ t₂ := by + rw [heq] + intro hr + exact not_reachable_deleteEdges hTD.isTree hadj' (hu't₂.trans (hr.symm.trans hv't₁.symm)) + refine ⟨fun p hp ↦ (edge_mem_path_iff_not_reachable_deleteEdges hTD.isTree p hp).2 hnr, + ⟨u', v', hadj', heq, hord₁⟩, ⟨u', v', hadj', heq, hord₂⟩⟩ + · rintro ⟨hpath, hrel₁, hrel₂⟩ + obtain ⟨p₀, hp₀, _⟩ := hTD.isTree.existsUnique_path t₁ t₂ + have hnr : ¬ (T.deleteEdges {s(u, v)}).Reachable t₁ t₂ := + (edge_mem_path_iff_not_reachable_deleteEdges hTD.isTree p₀ hp₀).1 (hpath p₀ hp₀) + have hmk_uv : MakesSeparation T τ s(u, v) + (treeDecompSide T τ s(u, v) u) (treeDecompSide T τ s(u, v) v) := + ⟨u, v, hadj, rfl, rfl, rfl⟩ + have hord₁ : separationOrder (treeDecompSide T τ s(u, v) u) + (treeDecompSide T τ s(u, v) v) < θ₁ := + hrel₁.order_lt_of_makesSeparation hmk_uv + have hord₂ : separationOrder (treeDecompSide T τ s(u, v) u) + (treeDecompSide T τ s(u, v) v) < θ₂ := + hrel₂.order_lt_of_makesSeparation hmk_uv + rcases (not_reachable_deleteEdges_iff_sides hTD.isTree hadj).1 hnr with + ⟨hut₁, hvt₂⟩ | ⟨hvt₁, hut₂⟩ + · have h1 : (treeDecompSide T τ s(u, v) v, treeDecompSide T τ s(u, v) u) ∈ 𝒯₁ := + (theorem_10_3_claim_2 hTD h𝒯₁ t₁).1 ht₁ hadj hord₁ hut₁ + have h2 : (treeDecompSide T τ s(u, v) u, treeDecompSide T τ s(u, v) v) ∈ 𝒯₂ := by + have := (theorem_10_3_claim_2 hTD h𝒯₂ t₂).1 ht₂ hadj.symm + (by simpa [Sym2.eq_swap, separationOrder_comm] using hord₂) + (by simpa [Sym2.eq_swap] using hvt₂) + simpa [Sym2.eq_swap] using this + exact ⟨treeDecompSide T τ s(u, v) v, treeDecompSide T τ s(u, v) u, + makesSeparation_symm.1 hmk_uv, h1, h2⟩ + · have h1 : (treeDecompSide T τ s(u, v) u, treeDecompSide T τ s(u, v) v) ∈ 𝒯₁ := by + have := (theorem_10_3_claim_2 hTD h𝒯₁ t₁).1 ht₁ hadj.symm + (by simpa [Sym2.eq_swap, separationOrder_comm] using hord₁) + (by simpa [Sym2.eq_swap] using hvt₁) + simpa [Sym2.eq_swap] using this + have h2 : (treeDecompSide T τ s(u, v) v, treeDecompSide T τ s(u, v) u) ∈ 𝒯₂ := + (theorem_10_3_claim_2 hTD h𝒯₂ t₂).1 ht₂ hadj hord₂ hut₂ + exact ⟨treeDecompSide T τ s(u, v) u, treeDecompSide T τ s(u, v) v, + hmk_uv, h1, h2⟩ + +/-- Claim (6) in the proof of **Graph Minors X, (10.3)** (page 183): +"For `1 ≤ i ≤ n`, `|Hᵢ| = 1`" (every home for `𝒯ᵢ` equals any other home for `𝒯ᵢ`). -/ +theorem theorem_10_3_claim_6 [Fintype ι] [LinearOrder Λ] {n : ℕ} {G : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} (hTB : IsTieBreaker G lam) + {θ : Fin n → ℕ} {𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : ∀ i, IsTangle G (θ i) (𝒯 i)) + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + (hex_edge : ∀ i j : Fin n, i ≠ j → + ∃ e ∈ T.edgeSet, ∃ A B, MakesSeparation T τ e A B ∧ IsDistinction lam (𝒯 i) (𝒯 j) A B) + (hevery_edge : ∀ e ∈ T.edgeSet, + ∃ i j : Fin n, i ≠ j ∧ ∃ A B, MakesSeparation T τ e A B ∧ IsDistinction lam (𝒯 i) (𝒯 j) A B) + (i : Fin n) {t₁ t₂ : ι} (ht₁ : IsHome T τ (𝒯 i) t₁) (ht₂ : IsHome T τ (𝒯 i) t₂) : + t₁ = t₂ := by + classical + by_contra hne + obtain ⟨q, hq, _⟩ := hTD.isTree.existsUnique_path t₁ t₂ + cases q with + | nil => exact hne rfl + | @cons _ w _ hadj_t₁w q' => + have hw_home : IsHome T τ (𝒯 i) w := by + refine theorem_10_3_claim_3_subtree hTD ht₁ ht₂ fun p hp ↦ ?_ + obtain ⟨_, _, huniq⟩ := hTD.isTree.existsUnique_path t₁ t₂ + have hpq : p = Walk.cons hadj_t₁w q' := + (huniq p hp).trans (huniq (Walk.cons hadj_t₁w q') hq).symm + rw [hpq] + simp [Walk.start_mem_support] + let e : Sym2 ι := s(t₁, w) + have he_mem : e ∈ T.edgeSet := hadj_t₁w + have hnot_rel_i : ¬ IsRelevantEdge T τ (θ i) e := by + intro hrel + have hmk : MakesSeparation T τ e + (treeDecompSide T τ s(t₁, w) t₁) (treeDecompSide T τ s(t₁, w) w) := + ⟨t₁, w, hadj_t₁w, rfl, rfl, rfl⟩ + have hord := hrel.order_lt_of_makesSeparation hmk + have hsep := hTD.isSeparation_treeDecompSide hadj_t₁w + rcases (h𝒯 i).axiom1 hsep hord with hm | hm + · exact ht₁ hadj_t₁w (Reachable.refl _) hm + · have hw' := hw_home hadj_t₁w.symm (Reachable.refl _) + exact hw' (by simpa [Sym2.eq_swap] using hm) + obtain ⟨j, k, hjk, A_jk, B_jk, hmk_jk, hdist_jk⟩ := hevery_edge e he_mem + obtain ⟨t_j, htj⟩ := theorem_10_3_claim_3_nonempty hTD (h𝒯 j) + obtain ⟨t_k, htk⟩ := theorem_10_3_claim_3_nonempty hTD (h𝒯 k) + obtain ⟨P, hP, _⟩ := hTD.isTree.existsUnique_path t_j t_k + have he_claim5 := (theorem_10_3_claim_5 hTD (h𝒯 j) (h𝒯 k) htj htk he_mem).1 + ⟨A_jk, B_jk, hmk_jk, hdist_jk.1⟩ + have he_in_P : e ∈ P.edges := he_claim5.1 P hP + have hji : j ≠ i := by rintro rfl; exact hnot_rel_i he_claim5.2.1 + have ht₁_in_P : t₁ ∈ P.support := Walk.fst_mem_support_of_mem_edges P he_in_P + obtain ⟨f, hf_mem, A_ji, B_ji, hmk_ji, hdist_ji⟩ := hex_edge j i hji + have hf_claim5 := (theorem_10_3_claim_5 hTD (h𝒯 j) (h𝒯 i) htj ht₁ hf_mem).1 + ⟨A_ji, B_ji, hmk_ji, hdist_ji.1⟩ + have hf_in_P₁ : f ∈ (P.takeUntil t₁ ht₁_in_P).edges := + hf_claim5.1 (P.takeUntil t₁ ht₁_in_P) (hP.takeUntil ht₁_in_P) + have hf_in_P : f ∈ P.edges := Walk.edges_takeUntil_subset_edges P ht₁_in_P hf_in_P₁ + have hord_f_lt_i : separationOrder A_ji B_ji < θ i := by + rw [separationOrder_comm] + exact (h𝒯 i).order_lt hdist_ji.1.2 + have hord_e_ge_i : θ i ≤ separationOrder A_jk B_jk := by + by_contra! hlt + obtain ⟨u, v, hadj, heq, rfl, rfl⟩ := hmk_jk + exact hnot_rel_i ⟨u, v, hadj, heq, hlt⟩ + have hord_f_lt_e : separationOrder A_ji B_ji < separationOrder A_jk B_jk := + hord_f_lt_i.trans_le hord_e_ge_i + have hord_e_lt_k : separationOrder A_jk B_jk < θ k := by + rw [separationOrder_comm] + exact (h𝒯 k).order_lt hdist_jk.1.2 + have hf_rel_k : IsRelevantEdge T τ (θ k) f := by + obtain ⟨u, v, hadj, heq, rfl, rfl⟩ := hmk_ji + exact ⟨u, v, hadj, heq, hord_f_lt_e.trans hord_e_lt_k⟩ + have hf_for_jk : ∃ C D, MakesSeparation T τ f C D ∧ Distinguishes (𝒯 j) (𝒯 k) C D := by + refine (theorem_10_3_claim_5 hTD (h𝒯 j) (h𝒯 k) htj htk hf_mem).2 + ⟨fun p hp ↦ ?_, hf_claim5.2.1, hf_rel_k⟩ + obtain ⟨_, _, huniq⟩ := hTD.isTree.existsUnique_path t_j t_k + have hpP : p = P := (huniq p hp).trans (huniq P hP).symm + exact hpP ▸ hf_in_P + obtain ⟨C, D, hmk_CD, hCD_dist⟩ := hf_for_jk + have hord_CD : separationOrder C D = separationOrder A_ji B_ji := by + obtain ⟨u, v, _, heq, rfl, rfl⟩ := hmk_CD + obtain ⟨u', v', _, heq', rfl, rfl⟩ := hmk_ji + rcases Sym2.eq_iff.1 (heq.symm.trans heq') with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · simp [Sym2.eq_swap, separationOrder_comm] + have hlam_lt : lam (C, D) < lam (A_jk, B_jk) := + hTB.axiom3 (hmk_CD.isSeparation hTD) (hmk_jk.isSeparation hTD) + (hord_CD.trans_lt hord_f_lt_e) + exact not_lt_of_ge (hdist_jk.2 hCD_dist) hlam_lt + +/-- Claim (7) in the proof of **Graph Minors X, (10.3)** (pages 183–184): +"`H₁ ∪ … ∪ Hₙ = V(T)`" (every vertex of `T` is a home for `𝒯ᵢ` for some `i`). -/ +theorem theorem_10_3_claim_7 [Fintype ι] [LinearOrder Λ] {n : ℕ} (hn : 1 ≤ n) + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} (hTB : IsTieBreaker G lam) + {θ : Fin n → ℕ} {𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : ∀ i, IsTangle G (θ i) (𝒯 i)) + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + (huniq_edge : ∀ i j : Fin n, i ≠ j → ∀ A B : Hypergraph α β, + IsDistinction lam (𝒯 i) (𝒯 j) A B → + ∃! e : Sym2 ι, e ∈ T.edgeSet ∧ MakesSeparation T τ e A B) + (hevery_edge : ∀ e ∈ T.edgeSet, + ∃ i j : Fin n, i ≠ j ∧ ∃ A B, MakesSeparation T τ e A B ∧ IsDistinction lam (𝒯 i) (𝒯 j) A B) + (t₀ : ι) : + ∃ i : Fin n, IsHome T τ (𝒯 i) t₀ := by + classical + by_contra! hno_home + let i₀ : Fin n := ⟨0, hn⟩ + obtain ⟨t_home₀, hth₀⟩ := theorem_10_3_claim_3_nonempty hTD (h𝒯 i₀) + have ht₀_ne : t₀ ≠ t_home₀ := fun h ↦ hno_home i₀ (h ▸ hth₀) + obtain ⟨q₀, hq₀, _⟩ := hTD.isTree.existsUnique_path t₀ t_home₀ + have hN_ne : (Finset.univ.filter fun u : ι ↦ T.Adj t₀ u).Nonempty := by + cases q₀ with + | nil => exact (ht₀_ne rfl).elim + | @cons _ u _ hadj _ => + exact ⟨u, Finset.mem_filter.2 ⟨Finset.mem_univ u, hadj⟩⟩ + let val (u : ι) : Λ := + lam (treeDecompSide T τ s(t₀, u) t₀, treeDecompSide T τ s(t₀, u) u) + obtain ⟨u₁, hu₁_mem, hmax⟩ := + (Finset.univ.filter fun u : ι ↦ T.Adj t₀ u).exists_max_image val hN_ne + have hadj₁ : T.Adj t₀ u₁ := (Finset.mem_filter.1 hu₁_mem).2 + let e₁ : Sym2 ι := s(t₀, u₁) + have he₁_mem : e₁ ∈ T.edgeSet := hadj₁ + obtain ⟨i, j, hij, A_ij, B_ij, hmk_ij, hdist_ij⟩ := hevery_edge e₁ he₁_mem + have hval_u₁ : val u₁ = lam (A_ij, B_ij) := by + obtain ⟨x, y, hadj_xy, heq, rfl, rfl⟩ := hmk_ij + rcases Sym2.eq_iff.1 heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · simpa [val, Sym2.eq_swap] using (hTB.lam_swap (hTD.isSeparation_treeDecompSide hadj₁)).symm + obtain ⟨t_i, hti⟩ := theorem_10_3_claim_3_nonempty hTD (h𝒯 i) + obtain ⟨t_j, htj⟩ := theorem_10_3_claim_3_nonempty hTD (h𝒯 j) + obtain ⟨P, hP, _⟩ := hTD.isTree.existsUnique_path t_i t_j + have he₁_claim5 := (theorem_10_3_claim_5 hTD (h𝒯 i) (h𝒯 j) hti htj he₁_mem).1 + ⟨A_ij, B_ij, hmk_ij, hdist_ij.1⟩ + have he₁_in_P : e₁ ∈ P.edges := he₁_claim5.1 P hP + have ht₀_in_P : t₀ ∈ P.support := Walk.fst_mem_support_of_mem_edges P he₁_in_P + have ht₀_ne_i : t₀ ≠ t_i := fun h ↦ hno_home i (h ▸ hti) + have ht₀_ne_j : t₀ ≠ t_j := fun h ↦ hno_home j (h ▸ htj) + let P₁ := P.takeUntil t₀ ht₀_in_P + let P₂ := P.dropUntil t₀ ht₀_in_P + have hP_eq : P₁.append P₂ = P := Walk.take_spec P ht₀_in_P + have hnodup_edges : (P₁.edges ++ P₂.edges).Nodup := by + rw [← Walk.edges_append, hP_eq] + exact hP.edges_nodup + have hex_P₁ : ∃ w₁ : ι, T.Adj t₀ w₁ ∧ s(t₀, w₁) ∈ P₁.edges := by + generalize hr : P₁.reverse = R₁ + cases R₁ with + | nil => + exact (ht₀_ne_i rfl).elim + | @cons _ w₁ _ hadj_w₁ r' => + refine ⟨w₁, hadj_w₁, ?_⟩ + have hmem : s(t₀, w₁) ∈ P₁.reverse.edges := by simp [hr] + rwa [Walk.edges_reverse, List.mem_reverse] at hmem + have hex_P₂ : ∃ w₂ : ι, T.Adj t₀ w₂ ∧ s(t₀, w₂) ∈ P₂.edges := by + cases P₂ with + | nil => + exact (ht₀_ne_j rfl).elim + | @cons _ w₂ _ hadj_w₂ r' => + exact ⟨w₂, hadj_w₂, by simp⟩ + obtain ⟨w₁, hadj_w₁, hw₁_mem⟩ := hex_P₁ + obtain ⟨w₂, hadj_w₂, hw₂_mem⟩ := hex_P₂ + have hw₁_ne_w₂ : s(t₀, w₁) ≠ s(t₀, w₂) := by + intro heq + exact List.disjoint_of_nodup_append hnodup_edges hw₁_mem (heq ▸ hw₂_mem) + have hex_u₂ : ∃ u₂ : ι, T.Adj t₀ u₂ ∧ s(t₀, u₂) ≠ e₁ ∧ s(t₀, u₂) ∈ P.edges := by + rw [← hP_eq, Walk.edges_append] + by_cases h1 : s(t₀, w₁) = e₁ + · refine ⟨w₂, hadj_w₂, ?_, List.mem_append_right _ hw₂_mem⟩ + rw [← h1] + exact Ne.symm hw₁_ne_w₂ + · exact ⟨w₁, hadj_w₁, h1, List.mem_append_left _ hw₁_mem⟩ + obtain ⟨u₂, hadj₂, he₂_ne, he₂_in_P⟩ := hex_u₂ + let e₂ : Sym2 ι := s(t₀, u₂) + have he₂_mem : e₂ ∈ T.edgeSet := hadj₂ + have hval_le : val u₂ ≤ val u₁ := + hmax u₂ (Finset.mem_filter.2 ⟨Finset.mem_univ u₂, hadj₂⟩) + let A₂ := treeDecompSide T τ s(t₀, u₂) t₀ + let B₂ := treeDecompSide T τ s(t₀, u₂) u₂ + have hmk₂ : MakesSeparation T τ e₂ A₂ B₂ := ⟨t₀, u₂, hadj₂, rfl, rfl, rfl⟩ + have hval_ne : val u₂ ≠ val u₁ := by + intro heq + rw [hval_u₁] at heq + have hsep₂ := hTD.isSeparation_treeDecompSide hadj₂ + have hsep_ij := hmk_ij.isSeparation hTD + rcases (hTB.axiom1 hsep₂ hsep_ij).1 heq with ⟨hA, hB⟩ | ⟨hA, hB⟩ + · obtain ⟨_, _, huniq⟩ := huniq_edge i j hij A_ij B_ij hdist_ij + have h1 : e₂ = e₁ := (huniq e₂ ⟨he₂_mem, hA ▸ hB ▸ hmk₂⟩).trans + (huniq e₁ ⟨he₁_mem, hmk_ij⟩).symm + exact he₂_ne h1 + · obtain ⟨_, _, huniq⟩ := huniq_edge i j hij A_ij B_ij hdist_ij + have hmk₂' : MakesSeparation T τ e₂ A_ij B_ij := + makesSeparation_symm.1 (hA ▸ hB ▸ hmk₂) + have h1 : e₂ = e₁ := (huniq e₂ ⟨he₂_mem, hmk₂'⟩).trans + (huniq e₁ ⟨he₁_mem, hmk_ij⟩).symm + exact he₂_ne h1 + have hval_lt : lam (A₂, B₂) < lam (A_ij, B_ij) := by + rw [← hval_u₁] + exact lt_of_le_of_ne hval_le hval_ne + have hord₂_le : separationOrder A₂ B₂ ≤ separationOrder A_ij B_ij := by + by_contra! hgt + exact not_lt_of_ge hval_lt.le + (hTB.axiom3 (hmk_ij.isSeparation hTD) (hmk₂.isSeparation hTD) hgt) + have hord_ij_i : separationOrder A_ij B_ij < θ i := (h𝒯 i).order_lt hdist_ij.1.1 + have hord_ij_j : separationOrder A_ij B_ij < θ j := by + rw [separationOrder_comm] + exact (h𝒯 j).order_lt hdist_ij.1.2 + have he₂_rel_i : IsRelevantEdge T τ (θ i) e₂ := + ⟨t₀, u₂, hadj₂, rfl, hord₂_le.trans_lt hord_ij_i⟩ + have he₂_rel_j : IsRelevantEdge T τ (θ j) e₂ := + ⟨t₀, u₂, hadj₂, rfl, hord₂_le.trans_lt hord_ij_j⟩ + have he₂_dist : ∃ C D, MakesSeparation T τ e₂ C D ∧ Distinguishes (𝒯 i) (𝒯 j) C D := by + refine (theorem_10_3_claim_5 hTD (h𝒯 i) (h𝒯 j) hti htj he₂_mem).2 + ⟨fun p hp ↦ ?_, he₂_rel_i, he₂_rel_j⟩ + obtain ⟨_, _, huniq⟩ := hTD.isTree.existsUnique_path t_i t_j + have hpP : p = P := (huniq p hp).trans (huniq P hP).symm + exact hpP ▸ he₂_in_P + obtain ⟨C, D, hmk_CD, hCD_dist⟩ := he₂_dist + have hlam_CD : lam (C, D) = lam (A₂, B₂) := by + obtain ⟨x, y, hadj_xy, heq, rfl, rfl⟩ := hmk_CD + rcases Sym2.eq_iff.1 heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · simpa [A₂, B₂, Sym2.eq_swap] using hTB.lam_swap (hTD.isSeparation_treeDecompSide hadj₂) + exact not_lt_of_ge (hdist_ij.2 hCD_dist) (hlam_CD ▸ hval_lt) + +/-- Relabelling a tree-decomposition along `e : ι ≃ ι'` preserves `treeDecompSide`. -/ +theorem treeDecompSide_map [Fintype ι] {ι' : Type*} [Fintype ι'] + (T : SimpleGraph ι) (τ : ι → Hypergraph α β) (e : ι ≃ ι') (u v w : ι) : + treeDecompSide (T.map e.toEmbedding) (τ ∘ e.symm) s(e u, e v) (e w) = + treeDecompSide T τ s(u, v) w := by + classical + let φ : (T.deleteEdges {s(u, v)}) ≃g + ((T.map e.toEmbedding).deleteEdges {s(e u, e v)}) := + { toEquiv := e + map_rel_iff' := by + intro x y + simp only [SimpleGraph.deleteEdges_adj, Set.mem_singleton_iff] + refine and_congr (SimpleGraph.Iso.map e T).map_rel_iff (not_congr ?_) + change Sym2.map e s(x, y) = Sym2.map e s(u, v) ↔ s(x, y) = s(u, v) + exact (Sym2.map.injective e.injective).eq_iff } + have hreach : ∀ t : ι, + ((T.map e.toEmbedding).deleteEdges {s(e u, e v)}).Reachable (e w) (e t) ↔ + (T.deleteEdges {s(u, v)}).Reachable w t := + fun t ↦ ⟨fun ⟨p⟩ ↦ ⟨(p.map φ.symm.toHom).copy (e.symm_apply_apply _) (e.symm_apply_apply _)⟩, + fun ⟨p⟩ ↦ ⟨p.map φ.toHom⟩⟩ + ext x <;> + simp only [treeDecompSide, biUnion, Set.mem_iUnion, Finset.mem_filter, Finset.mem_univ, + true_and, Function.comp_apply] + · refine ⟨?_, fun ⟨t, hr, hx⟩ ↦ ⟨e t, (hreach t).2 hr, by simpa using hx⟩⟩ + rintro ⟨t', hr', hx'⟩ + obtain ⟨t, rfl⟩ := e.surjective t' + exact ⟨t, (hreach t).1 hr', by simpa using hx'⟩ + · refine ⟨?_, fun ⟨t, hr, hx⟩ ↦ ⟨e t, (hreach t).2 hr, by simpa using hx⟩⟩ + rintro ⟨t', hr', hx'⟩ + obtain ⟨t, rfl⟩ := e.surjective t' + exact ⟨t, (hreach t).1 hr', by simpa using hx'⟩ + · refine ⟨?_, fun ⟨t, hr, hx⟩ ↦ ⟨e t, (hreach t).2 hr, by simpa using hx⟩⟩ + rintro ⟨t', hr', hx'⟩ + obtain ⟨t, rfl⟩ := e.surjective t' + exact ⟨t, (hreach t).1 hr', by simpa using hx'⟩ + +/-- Relabelling a tree-decomposition along `e : ι ≃ ι'` preserves `MakesSeparation`. -/ +theorem makesSeparation_map [Fintype ι] {ι' : Type*} [Fintype ι'] + (T : SimpleGraph ι) (τ : ι → Hypergraph α β) (e : ι ≃ ι') (f : Sym2 ι) + (A B : Hypergraph α β) : + MakesSeparation (T.map e.toEmbedding) (τ ∘ e.symm) (f.map e) A B ↔ + MakesSeparation T τ f A B := by + constructor + · rintro ⟨u', v', hadj', heq', rfl, rfl⟩ + obtain ⟨u, rfl⟩ := e.surjective u' + obtain ⟨v, rfl⟩ := e.surjective v' + have hadj : T.Adj u v := (SimpleGraph.Iso.map e T).map_rel_iff.1 hadj' + have heq : f = s(u, v) := + Sym2.map.injective e.injective heq' + refine ⟨u, v, hadj, heq, ?_, ?_⟩ + · exact treeDecompSide_map T τ e u v u + · exact treeDecompSide_map T τ e u v v + · rintro ⟨u, v, hadj, rfl, rfl, rfl⟩ + have hadj' : (T.map e.toEmbedding).Adj (e u) (e v) := + (SimpleGraph.Iso.map e T).map_rel_iff.2 hadj + exact ⟨e u, e v, hadj', rfl, + (treeDecompSide_map T τ e u v u).symm, (treeDecompSide_map T τ e u v v).symm⟩ + +/-- Relabelling a tree-decomposition along `e : ι ≃ ι'` preserves `IsHome`. -/ +theorem isHome_map [Fintype ι] {ι' : Type*} [Fintype ι'] + (T : SimpleGraph ι) (τ : ι → Hypergraph α β) (e : ι ≃ ι') + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (t₀ : ι) : + IsHome (T.map e.toEmbedding) (τ ∘ e.symm) 𝒯 (e t₀) ↔ IsHome T τ 𝒯 t₀ := by + constructor + · intro h u v hadj hut₀ + have hadj' : (T.map e.toEmbedding).Adj (e u) (e v) := + (SimpleGraph.Iso.map e T).map_rel_iff.2 hadj + let φ : (T.deleteEdges {s(u, v)}) ≃g + ((T.map e.toEmbedding).deleteEdges {s(e u, e v)}) := + { toEquiv := e + map_rel_iff' := by + intro x y + simp only [SimpleGraph.deleteEdges_adj, Set.mem_singleton_iff] + refine and_congr (SimpleGraph.Iso.map e T).map_rel_iff (not_congr ?_) + change Sym2.map e s(x, y) = Sym2.map e s(u, v) ↔ s(x, y) = s(u, v) + exact (Sym2.map.injective e.injective).eq_iff } + have hut₀' : ((T.map e.toEmbedding).deleteEdges {s(e u, e v)}).Reachable (e u) (e t₀) := by + obtain ⟨p⟩ := hut₀ + exact ⟨p.map φ.toHom⟩ + have := h hadj' hut₀' + rwa [treeDecompSide_map, treeDecompSide_map] at this + · intro h u' v' hadj' hut₀' + obtain ⟨u, rfl⟩ := e.surjective u' + obtain ⟨v, rfl⟩ := e.surjective v' + have hadj : T.Adj u v := (SimpleGraph.Iso.map e T).map_rel_iff.1 hadj' + let φ : (T.deleteEdges {s(u, v)}) ≃g + ((T.map e.toEmbedding).deleteEdges {s(e u, e v)}) := + { toEquiv := e + map_rel_iff' := by + intro x y + simp only [SimpleGraph.deleteEdges_adj, Set.mem_singleton_iff] + refine and_congr (SimpleGraph.Iso.map e T).map_rel_iff (not_congr ?_) + change Sym2.map e s(x, y) = Sym2.map e s(u, v) ↔ s(x, y) = s(u, v) + exact (Sym2.map.injective e.injective).eq_iff } + have hut₀ : (T.deleteEdges {s(u, v)}).Reachable u t₀ := by + obtain ⟨p⟩ := hut₀' + exact ⟨(p.map φ.symm.toHom).copy (e.symm_apply_apply _) (e.symm_apply_apply _)⟩ + rw [treeDecompSide_map, treeDecompSide_map] + exact h hadj hut₀ + +/-- **Graph Minors X, (10.3)** (page 181): +"Let $\mathscr{T}_1, \dots, \mathscr{T}_n$ be mutually distinguishable tangles in a +hypergraph $G$ with $n \ge 1$, and let $\lambda$ be a tie-breaker. Then there is a +tree-decomposition $(T, \tau)$ of $G$, where $V(T) = \{t_1, \dots, t_n\}$, with the +following properties:* (i) *For every $e \in E(T)$ and for $1 \le i \le n$, if $T_1, T_2$ +are the components of $T \setminus e$ and $t_i \in V(T_1)$ then* $$ \left( \bigcup_{t \in +V(T_1)} \tau(t), \bigcup_{t \in V(T_2)} \tau(t) \right) \notin \mathscr{T}_i. $$ (ii) *For +all $i \ne j$ with $1 \le i, j \le n$, let $e$ be the edge of the path of $T$ between $t_i$ +and $t_j$ making separations of smallest $\lambda$-order; then these separations are the +$(\mathscr{T}_i, \mathscr{T}_j)$- and $(\mathscr{T}_j, \mathscr{T}_i)$-distinctions." -/ +theorem theorem_10_3_proof [LinearOrder Λ] {n : ℕ} + (G : Hypergraph α β) (lam : Hypergraph α β × Hypergraph α β → Λ) + (θ : Fin n → ℕ) (𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)) + (hn : 1 ≤ n) + (hTB : IsTieBreaker G lam) + (h𝒯 : ∀ i : Fin n, IsTangle G (θ i) (𝒯 i)) + (hdist : ∀ i j : Fin n, i ≠ j → AreDistinguishable (𝒯 i) (𝒯 j)) : + ∃ (T : SimpleGraph (Fin n)) (τ : Fin n → Hypergraph α β), + IsStandardTreeDecomposition G lam 𝒯 T τ := by + classical + let 𝒮 : Set (Hypergraph α β × Hypergraph α β) := + {p | ∃ i j : Fin n, i ≠ j ∧ IsDistinction lam (𝒯 i) (𝒯 j) p.1 p.2} + have hsep : ∀ p ∈ 𝒮, G.IsSeparation p.1 p.2 := by + rintro ⟨A, B⟩ ⟨i, _, _, h⟩ + exact (h𝒯 i).isSeparation h.1.1 + have hlam : IsLaminar 𝒮 := by + rintro ⟨A₁, B₁⟩ ⟨i₁, j₁, _, hd₁⟩ ⟨A₂, B₂⟩ ⟨i₂, j₂, _, hd₂⟩ + exact theorem_9_4_proof hTB + (theorem_10_2_proof G lam (θ i₁) (θ j₁) (𝒯 i₁) (𝒯 j₁) A₁ B₁ hTB (h𝒯 i₁) (h𝒯 j₁) hd₁) + (theorem_10_2_proof G lam (θ i₂) (θ j₂) (𝒯 i₂) (𝒯 j₂) A₂ B₂ hTB (h𝒯 i₂) (h𝒯 j₂) hd₂) + obtain ⟨ι, hfin_ι, T, τ, hTD, huniq_S, hevery_S, _⟩ := + theorem_9_1_exists_treeDecomposition hsep hlam + have hex_dist : ∀ i j : Fin n, i ≠ j → + ∃ A B : Hypergraph α β, IsDistinction lam (𝒯 i) (𝒯 j) A B := + fun i j hij ↦ (exists_isDistinction_iff (h𝒯 i) (h𝒯 j)).2 (hdist i j hij) + have hex_edge : ∀ i j : Fin n, i ≠ j → + ∃ e ∈ T.edgeSet, ∃ A B, MakesSeparation T τ e A B ∧ IsDistinction lam (𝒯 i) (𝒯 j) A B := by + intro i j hij + obtain ⟨A, B, hd⟩ := hex_dist i j hij + obtain ⟨e, ⟨he, hmk⟩, _⟩ := huniq_S (A, B) ⟨i, j, hij, hd⟩ + exact ⟨e, he, A, B, hmk, hd⟩ + have huniq_edge : ∀ i j : Fin n, i ≠ j → ∀ A B : Hypergraph α β, + IsDistinction lam (𝒯 i) (𝒯 j) A B → + ∃! e : Sym2 ι, e ∈ T.edgeSet ∧ MakesSeparation T τ e A B := + fun i j hij A B hd ↦ huniq_S (A, B) ⟨i, j, hij, hd⟩ + have hevery_edge : ∀ e ∈ T.edgeSet, + ∃ i j : Fin n, i ≠ j ∧ ∃ A B, MakesSeparation T τ e A B ∧ IsDistinction lam (𝒯 i) (𝒯 j) A B + := by + intro e he + obtain ⟨⟨A, B⟩, ⟨i, j, hij, hd⟩, hmk⟩ := hevery_S e he + exact ⟨i, j, hij, A, B, hmk, hd⟩ + have hex_home : ∀ i : Fin n, ∃ t : ι, IsHome T τ (𝒯 i) t := + fun i ↦ theorem_10_3_claim_3_nonempty hTD (h𝒯 i) + choose home hhome using hex_home + have hhome_inj : Function.Injective home := by + intro i j heq + by_contra hij + obtain ⟨e, _, A, B, hmk, hd⟩ := hex_edge i j hij + exact theorem_10_3_claim_1 hTD hmk hd.1 (home i) ⟨hhome i, heq ▸ hhome j⟩ + have hhome_surj : Function.Surjective home := by + intro t₀ + obtain ⟨i, hi⟩ := theorem_10_3_claim_7 hn hTB h𝒯 hTD huniq_edge hevery_edge t₀ + exact ⟨i, theorem_10_3_claim_6 hTB h𝒯 hTD hex_edge hevery_edge i (hhome i) hi⟩ + let e_equiv : ι ≃ Fin n := (Equiv.ofBijective home ⟨hhome_inj, hhome_surj⟩).symm + have he_apply : ∀ i : Fin n, e_equiv (home i) = i := + fun i ↦ (Equiv.ofBijective home ⟨hhome_inj, hhome_surj⟩).symm_apply_apply i + let T₀ : SimpleGraph (Fin n) := T.map e_equiv.toEmbedding + let τ₀ : Fin n → Hypergraph α β := τ ∘ e_equiv.symm + have hTD₀ : IsTreeDecomposition G T₀ τ₀ := hTD.relabel e_equiv + refine ⟨T₀, τ₀, ⟨hTD₀, ?_, ?_⟩⟩ + · intro i + have h1 : IsHome T₀ τ₀ (𝒯 i) (e_equiv (home i)) := + (isHome_map T τ e_equiv (𝒯 i) (home i)).2 (hhome i) + rwa [he_apply i] at h1 + · intro i j hij + obtain ⟨f, hf_mem, A, B, hmk_f, hd_ij⟩ := hex_edge i j hij + have hd_ji : IsDistinction lam (𝒯 j) (𝒯 i) B A := + (isDistinction_comm hTB (h𝒯 i) (h𝒯 j)).1 hd_ij + let e₀ : Sym2 (Fin n) := f.map e_equiv + have he₀_mem : e₀ ∈ T₀.edgeSet := by + induction f using Sym2.ind with | _ u v => + have hadj : T.Adj u v := hf_mem + exact (SimpleGraph.Iso.map e_equiv T).map_rel_iff.2 hadj + have hmk_e₀ : MakesSeparation T₀ τ₀ e₀ A B := + (makesSeparation_map T τ e_equiv f A B).2 hmk_f + have hf_claim5 := (theorem_10_3_claim_5 hTD (h𝒯 i) (h𝒯 j) (hhome i) (hhome j) hf_mem).1 + ⟨A, B, hmk_f, hd_ij.1⟩ + have he₀_on_path : ∀ p : T₀.Walk i j, p.IsPath → e₀ ∈ p.edges := by + intro p hp + let φ : T ≃g T₀ := mapIso T e_equiv + have hi' : φ.symm.toHom i = home i := rfl + have hj' : φ.symm.toHom j = home j := rfl + let q : T.Walk (home i) (home j) := (p.map φ.symm.toHom).copy hi' hj' + have hq : q.IsPath := by + dsimp only [q] + rw [Walk.isPath_copy] + exact hp.map φ.symm.injective + have hf_in_q : f ∈ q.edges := hf_claim5.1 q hq + dsimp only [q] at hf_in_q + rw [Walk.edges_copy, Walk.edges_map, List.mem_map] at hf_in_q + obtain ⟨e', he', heq⟩ := hf_in_q + have he₀_eq : e₀ = e' := by + change f.map e_equiv = e' + rw [← heq] + induction e' using Sym2.ind with | _ x y => + exact Sym2.eq_iff.2 (Or.inl ⟨e_equiv.apply_symm_apply x, e_equiv.apply_symm_apply y⟩) + exact he₀_eq ▸ he' + refine ⟨e₀, he₀_mem, he₀_on_path, ?_, A, B, hmk_e₀, hd_ij, hd_ji⟩ + intro e' he'_mem he'_path A₁ B₁ A' B' hmk₁ hmk' + have hlam₁ : lam (A₁, B₁) = lam (A, B) := by + obtain ⟨u, v, hadj, heq, rfl, rfl⟩ := hmk_e₀ + obtain ⟨u', v', hadj', heq', rfl, rfl⟩ := hmk₁ + rcases Sym2.eq_iff.1 (heq.symm.trans heq') with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · simpa [Sym2.eq_swap] using + hTB.lam_swap (hTD₀.isSeparation_treeDecompSide hadj) + rw [hlam₁] + by_contra! hlt + obtain ⟨f', rfl⟩ : ∃ f' : Sym2 ι, f'.map e_equiv = e' := by + induction e' using Sym2.ind with | _ x y => + exact ⟨s(e_equiv.symm x, e_equiv.symm y), by simp⟩ + have hf'_mem : f' ∈ T.edgeSet := by + induction f' using Sym2.ind with | _ u v => + have hadj' : T₀.Adj (e_equiv u) (e_equiv v) := he'_mem + exact (SimpleGraph.Iso.map e_equiv T).map_rel_iff.1 hadj' + have hmk_f' : MakesSeparation T τ f' A' B' := + (makesSeparation_map T τ e_equiv f' A' B').1 hmk' + have hord'_le : separationOrder A' B' ≤ separationOrder A B := by + by_contra! hgt + exact not_lt_of_ge hlt.le + (hTB.axiom3 (hmk_f.isSeparation hTD) (hmk_f'.isSeparation hTD) hgt) + have hord_i : separationOrder A B < θ i := (h𝒯 i).order_lt hd_ij.1.1 + have hord_j : separationOrder A B < θ j := by + rw [separationOrder_comm] + exact (h𝒯 j).order_lt hd_ij.1.2 + have hf'_rel_i : IsRelevantEdge T τ (θ i) f' := by + obtain ⟨u, v, hadj, heq, rfl, rfl⟩ := hmk_f' + exact ⟨u, v, hadj, heq, hord'_le.trans_lt hord_i⟩ + have hf'_rel_j : IsRelevantEdge T τ (θ j) f' := by + obtain ⟨u, v, hadj, heq, rfl, rfl⟩ := hmk_f' + exact ⟨u, v, hadj, heq, hord'_le.trans_lt hord_j⟩ + have hf'_on_path : ∀ q : T.Walk (home i) (home j), q.IsPath → f' ∈ q.edges := by + intro q hq + let φ : T ≃g T₀ := mapIso T e_equiv + have hi' : φ.toHom (home i) = i := he_apply i + have hj' : φ.toHom (home j) = j := he_apply j + let p : T₀.Walk i j := (q.map φ.toHom).copy hi' hj' + have hp : p.IsPath := by + dsimp only [p] + rw [Walk.isPath_copy] + exact hq.map φ.injective + have he'_in_p : f'.map e_equiv ∈ p.edges := he'_path p hp + dsimp only [p] at he'_in_p + rw [Walk.edges_copy, Walk.edges_map, List.mem_map] at he'_in_p + obtain ⟨f'', hf'', heq⟩ := he'_in_p + have hf'_eq : f'' = f' := + Sym2.map.injective e_equiv.injective heq + exact hf'_eq ▸ hf'' + obtain ⟨C, D, hmk_CD, hCD_dist⟩ := + (theorem_10_3_claim_5 hTD (h𝒯 i) (h𝒯 j) (hhome i) (hhome j) hf'_mem).2 + ⟨hf'_on_path, hf'_rel_i, hf'_rel_j⟩ + have hlam_CD : lam (C, D) = lam (A', B') := by + obtain ⟨u, v, hadj, heq, rfl, rfl⟩ := hmk_CD + obtain ⟨u', v', _, heq', rfl, rfl⟩ := hmk_f' + rcases Sym2.eq_iff.1 (heq.symm.trans heq') with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · simpa [Sym2.eq_swap] using (hTB.lam_swap (hTD.isSeparation_treeDecompSide hadj)).symm + exact not_lt_of_ge (hd_ij.2 hCD_dist) (hlam_CD ▸ hlt) + +/-! ## Proof of Graph Minors X, (10.4) -/ + +/-- A tangle `𝒯` in a hypergraph `G` is a *maximal tangle* if it is a tangle in `G` and is not a +proper subset (truncation) of any tangle in `G` (Graph Minors X, Section 1, page 155, and +Section 10, (10.4), page 184). -/ +def IsMaximalTangle (G : Hypergraph α β) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) : Prop := + (∃ θ, IsTangle G θ 𝒯) ∧ + ∀ ⦃𝒯' : Set (Hypergraph α β × Hypergraph α β)⦄, + (∃ θ', IsTangle G θ' 𝒯') → 𝒯 ⊆ 𝒯' → 𝒯' = 𝒯 + +/-- The set of all maximal tangles in a hypergraph `G` (Graph Minors X, Section 10, (10.4), +page 184). -/ +def maximalTangles (G : Hypergraph α β) : + Set (Set (Hypergraph α β × Hypergraph α β)) := + {𝒯 | IsMaximalTangle G 𝒯} + +/-- Distinct maximal tangles in `G` are distinguishable (Graph Minors X, Section 10, proof of +(10.4), page 184). -/ +theorem IsMaximalTangle.areDistinguishable {G : Hypergraph α β} + {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} + (h₁ : IsMaximalTangle G 𝒯₁) (h₂ : IsMaximalTangle G 𝒯₂) (hne : 𝒯₁ ≠ 𝒯₂) : + AreDistinguishable 𝒯₁ 𝒯₂ := by + rintro (hsub | hsub) + · exact hne (h₁.2 h₂.1 hsub).symm + · exact hne (h₂.2 h₁.1 hsub) + +/-- In a standard tree-decomposition `(T, τ)` of `G` relative to `𝒯₁, …, 𝒯ₙ`, for every adjacent +pair `T.Adj u v`, the separation `(treeDecompSide T τ s(u, v) u, treeDecompSide T τ s(u, v) v)` is +the `(𝒯 v, 𝒯 u)`-distinction (Graph Minors X, Section 10, (10.3), page 181). -/ +theorem IsStandardTreeDecomposition.isDistinction_of_adj {n : ℕ} {Λ : Type*} [LinearOrder Λ] + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)} + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (hstd : IsStandardTreeDecomposition G lam 𝒯 T τ) + {u v : Fin n} (hadj : T.Adj u v) : + IsDistinction lam (𝒯 v) (𝒯 u) + (treeDecompSide T τ s(u, v) u) (treeDecompSide T τ s(u, v) v) := by + obtain ⟨e, _, he_path, _, A, B, hmk, hd_uv, hd_vu⟩ := + hstd.path_min_isDistinction hadj.ne + let p : T.Walk u v := Walk.cons hadj Walk.nil + have hp : p.IsPath := by simp [p, hadj.ne] + have he_mem : e ∈ p.edges := he_path p hp + simp only [p, Walk.edges_cons, Walk.edges_nil, List.mem_singleton] at he_mem + subst he_mem + obtain ⟨u', v', _, heq, rfl, rfl⟩ := hmk + rcases Sym2.eq_iff.1 heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exfalso + exact hstd.isHome u hadj (Reachable.refl u) hd_uv.1.1 + · simpa [Sym2.eq_swap] using hd_vu + +/-- Strict vertex-set inclusion in the proof of **Graph Minors X, (10.4)** (page 184): +"Let $e, f \in E(T)$ be distinct, making separations $(A, B)$ and $(C, D)$, say, where $A +\subseteq C$ and $D \subseteq B$. If $V(A) = V(C)$ then it follows easily that $A = C$, $B = +D$, a contradiction; thus $V(A) \subset V(C)$ and similarly $V(D) \subset V(B)$." +(We deduce `V(A) ⊂ V(C)` directly from `(2.9)(ii)` and `(10.3)(i)`, which avoids assuming `G` has +no edges with ends in `V(A ∩ B)`.) -/ +theorem theorem_10_4_strict_inclusion {n : ℕ} {Λ : Type*} [LinearOrder Λ] + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : Fin n → ℕ} {𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : ∀ i : Fin n, IsTangle G (θ i) (𝒯 i)) + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (hstd : IsStandardTreeDecomposition G lam 𝒯 T τ) + {u v x y : Fin n} (hadj_uv : T.Adj u v) (hadj_xy : T.Adj x y) + (hvx : (T.deleteEdges {s(u, v)}).Reachable v x) + (hxu : (T.deleteEdges {s(x, y)}).Reachable x u) : + (treeDecompSide T τ s(u, v) u).vertexSet ⊂ (treeDecompSide T τ s(x, y) x).vertexSet ∧ + (treeDecompSide T τ s(x, y) y).vertexSet ⊂ (treeDecompSide T τ s(u, v) v).vertexSet := by + have hTD := hstd.isTreeDecomposition + have hle := treeDecompSide_le_of_distinct_edges hTD hadj_uv hadj_xy hvx hxu + have hne_edge : s(u, v) ≠ s(x, y) := by + intro heq + have hnot_uv := not_reachable_deleteEdges hTD.isTree hadj_uv + rcases Sym2.eq_iff.1 heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hnot_uv hvx.symm + · exact not_reachable_deleteEdges hTD.isTree hadj_xy hxu + have hstrict : ∀ {u₁ v₁ x₁ y₁ : Fin n}, + T.Adj u₁ v₁ → T.Adj x₁ y₁ → s(u₁, v₁) ≠ s(x₁, y₁) → + (T.deleteEdges {s(x₁, y₁)}).Reachable x₁ u₁ → + treeDecompSide T τ s(u₁, v₁) u₁ ≤ treeDecompSide T τ s(x₁, y₁) x₁ → + treeDecompSide T τ s(x₁, y₁) y₁ ≤ treeDecompSide T τ s(u₁, v₁) v₁ → + (treeDecompSide T τ s(u₁, v₁) u₁).vertexSet ⊂ + (treeDecompSide T τ s(x₁, y₁) x₁).vertexSet := by + intro u₁ v₁ x₁ y₁ hadj₁ hadj₂ hne hx₁u₁ hAC hDB + refine ssubset_of_subset_of_ne hAC.vertexSet_subset ?_ + intro hV_eq + let A := treeDecompSide T τ s(u₁, v₁) u₁ + let B := treeDecompSide T τ s(u₁, v₁) v₁ + let C := treeDecompSide T τ s(x₁, y₁) x₁ + let D := treeDecompSide T τ s(x₁, y₁) y₁ + have hAB_mem : (A, B) ∈ 𝒯 v₁ := (hstd.isDistinction_of_adj hadj₁).1.1 + have hsep_CD : G.IsSeparation C D := hTD.isSeparation_treeDecompSide hadj₂ + have hCD_sub_AB : (C ∩ D).vertexSet ⊆ (A ∩ B).vertexSet := by + change C.vertexSet ∩ D.vertexSet ⊆ A.vertexSet ∩ B.vertexSet + rw [← hV_eq] + exact Set.inter_subset_inter_right _ hDB.vertexSet_subset + have hord_le : separationOrder C D ≤ separationOrder A B := + Set.ncard_le_ncard hCD_sub_AB (A ∩ B).vertexSet_finite + have hord_CD : separationOrder C D < θ v₁ := + hord_le.trans_lt ((h𝒯 v₁).order_lt hAB_mem) + have hCD_mem : (C, D) ∈ 𝒯 v₁ := + theorem_2_9_proof (h𝒯 v₁) hAB_mem hsep_CD hord_CD (Or.inr (Or.inl hV_eq.symm.subset)) + have hadj₁_in_2 : (T.deleteEdges {s(x₁, y₁)}).Adj u₁ v₁ := + deleteEdges_adj.mpr ⟨hadj₁, hne⟩ + have hx₁v₁ : (T.deleteEdges {s(x₁, y₁)}).Reachable x₁ v₁ := + hx₁u₁.trans hadj₁_in_2.reachable + exact hstd.isHome v₁ hadj₂ hx₁v₁ hCD_mem + refine ⟨hstrict hadj_uv hadj_xy hne_edge hxu hle.1 hle.2, ?_⟩ + have hadj_uv_in_xy : (T.deleteEdges {s(u, v)}).Adj x y := + deleteEdges_adj.mpr ⟨hadj_xy, hne_edge.symm⟩ + have hvy : (T.deleteEdges {s(u, v)}).Reachable v y := + hvx.trans hadj_uv_in_xy.reachable + have h := hstrict hadj_xy.symm hadj_uv.symm + (by intro heq; exact hne_edge (by simpa [Sym2.eq_swap] using heq.symm)) + (by simpa [Sym2.eq_swap] using hvy) + (by simpa [Sym2.eq_swap] using hle.2) + (by simpa [Sym2.eq_swap] using hle.1) + simpa [Sym2.eq_swap] using h + +/-- In a standard tree-decomposition `(T, τ)` of `G` relative to `𝒯₁, …, 𝒯ₙ`, for every edge +`T.Adj t p`, `(τ t).vertexSet` is not contained in `(τ p).vertexSet`. -/ +theorem IsStandardTreeDecomposition.not_bag_vertexSet_subset_of_adj + {n : ℕ} {Λ : Type*} [LinearOrder Λ] + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : Fin n → ℕ} {𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : ∀ i : Fin n, IsTangle G (θ i) (𝒯 i)) + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (hstd : IsStandardTreeDecomposition G lam 𝒯 T τ) + {t p : Fin n} (hadj_tp : T.Adj t p) : + ¬ (τ t).vertexSet ⊆ (τ p).vertexSet := by + classical + intro hsub + have hTD := hstd.isTreeDecomposition + let A := treeDecompSide T τ s(t, p) t + let B := treeDecompSide T τ s(t, p) p + have hsep_AB : G.IsSeparation A B := hTD.isSeparation_treeDecompSide hadj_tp + have hBA_mem : (B, A) ∈ 𝒯 t := by + have hd := hstd.isDistinction_of_adj hadj_tp.symm + simpa [A, B, Sym2.eq_swap] using hd.1.1 + have hAB_not : (A, B) ∉ 𝒯 t := theorem_2_1_proof (h𝒯 t) hBA_mem + have hord_AB : separationOrder A B < θ t := by + rw [separationOrder_comm] + exact (h𝒯 t).order_lt hBA_mem + have hτt_le_A : τ t ≤ A := le_treeDecompSide hTD (Reachable.refl t) + have hτp_le_B : τ p ≤ B := le_treeDecompSide hTD (Reachable.refl p) + have hτt_sub_B : (τ t).vertexSet ⊆ B.vertexSet := + hsub.trans hτp_le_B.vertexSet_subset + have hτt_sub_AB : (τ t).vertexSet ⊆ (A ∩ B).vertexSet := + Set.subset_inter hτt_le_A.vertexSet_subset hτt_sub_B + let S : Finset (Fin n) := Finset.univ.filter (fun u ↦ T.Adj u t ∧ u ≠ p) + let Au : Fin n → Hypergraph α β := fun u ↦ treeDecompSide T τ s(u, t) u + let Bu : Fin n → Hypergraph α β := fun u ↦ treeDecompSide T τ s(u, t) t + have hAu_mem : ∀ u ∈ S, (Au u, Bu u) ∈ 𝒯 t := by + intro u hu + simp only [S, Finset.mem_filter, Finset.mem_univ, true_and] at hu + exact (hstd.isDistinction_of_adj hu.1).1.1 + have hAuBu_sub_τt : ∀ u ∈ S, (Au u ∩ Bu u).vertexSet ⊆ (τ t).vertexSet := by + intro u hu x ⟨hxA, hxB⟩ + simp only [S, Finset.mem_filter, Finset.mem_univ, true_and] at hu + simp only [Au, Bu, treeDecompSide, biUnion, Set.mem_iUnion, Finset.mem_filter, + Finset.mem_univ, true_and] at hxA hxB + obtain ⟨w₁, hw₁, hxw₁⟩ := hxA + obtain ⟨w₂, hw₂, hxw₂⟩ := hxB + have hon : OnTreePath T w₂ w₁ t := + onTreePath_of_reachable_deleteEdges hTD.isTree hu.1.symm + (by simpa [Sym2.eq_swap] using hw₂) + (by simpa [Sym2.eq_swap] using hw₁) + exact (hTD.inter_le hon).vertexSet_subset ⟨hxw₂, hxw₁⟩ + -- Combine `(Au u, Bu u)` over `F ⊆ S` by induction on `F`: + have hcombine : ∀ (F : Finset (Fin n)), F ⊆ S → F.Nonempty → + ∃ C D : Hypergraph α β, (C, D) ∈ 𝒯 t ∧ + (∀ x ∈ D.vertexSet, ∀ u ∈ F, x ∈ (Bu u).vertexSet) ∧ + (C ∩ D).vertexSet ⊆ (τ t).vertexSet := by + intro F hFS hFne + induction F using Finset.cons_induction with + | empty => exact (Finset.not_nonempty_empty hFne).elim + | @cons a s ha_notMem ih => + have haS : a ∈ S := hFS (Finset.mem_cons_self a s) + have hsS : s ⊆ S := (Finset.subset_cons ha_notMem).trans hFS + rcases s.eq_empty_or_nonempty with rfl | hs_ne + · refine ⟨Au a, Bu a, hAu_mem a haS, ?_, hAuBu_sub_τt a haS⟩ + intro x hx u hu + simp only [Finset.cons_empty, Finset.mem_singleton] at hu + exact hu ▸ hx + · obtain ⟨C, D, hCD_mem, hD_mem, hCD_sub⟩ := ih hsS hs_ne + let C' := C ∪ Au a + let D' := D ∩ Bu a + have hC'D'_sub : (C' ∩ D').vertexSet ⊆ (τ t).vertexSet := by + intro x hx + change (x ∈ C.vertexSet ∨ x ∈ (Au a).vertexSet) ∧ + (x ∈ D.vertexSet ∧ x ∈ (Bu a).vertexSet) at hx + rcases hx with ⟨hxC | hxAa, hxD, hxBa⟩ + · exact hCD_sub ⟨hxC, hxD⟩ + · exact hAuBu_sub_τt a haS ⟨hxAa, hxBa⟩ + have hord_C'D' : separationOrder C' D' < θ t := by + have hle : separationOrder C' D' ≤ separationOrder A B := + Set.ncard_le_ncard (hC'D'_sub.trans hτt_sub_AB) (A ∩ B).vertexSet_finite + exact hle.trans_lt hord_AB + have hC'D'_mem : (C', D') ∈ 𝒯 t := + theorem_2_2_proof (h𝒯 t) hCD_mem (hAu_mem a haS) hord_C'D' + refine ⟨C', D', hC'D'_mem, ?_, hC'D'_sub⟩ + intro x hx u hu + rcases Finset.mem_cons.1 hu with rfl | hus + · exact hx.2 + · exact hD_mem x hx.1 u hus + -- Any vertex `x ∈ V(G)` that belongs to `Bu u` for all `u ∈ S` must belong to `B`: + have h_in_B : ∀ x ∈ G.vertexSet, (∀ u ∈ S, x ∈ (Bu u).vertexSet) → x ∈ B.vertexSet := by + intro x hxG hxBu + by_contra hx_notB + have hxA : x ∈ A.vertexSet := + (hsep_AB.vertexSet_union.symm ▸ hxG).resolve_right hx_notB + simp only [A, treeDecompSide, biUnion, Set.mem_iUnion, Finset.mem_filter, + Finset.mem_univ, true_and] at hxA + obtain ⟨w, htw, hxw⟩ := hxA + have hwt_ne : w ≠ t := by + rintro rfl + exact hx_notB (hτt_sub_B hxw) + obtain ⟨q, hq⟩ := htw.exists_isPath + cases q with + | nil => exact (hwt_ne rfl).elim + | @cons _ u _ hstep q' => + rcases deleteEdges_adj.1 hstep with ⟨hadj_tu, hne_edge⟩ + have hu_ne_p : u ≠ p := by + rintro rfl + exact hne_edge rfl + have huS : u ∈ S := by + simp [S, hadj_tu.symm, hu_ne_p] + rw [Walk.cons_isPath_iff] at hq + let q'_T : T.Walk u w := q'.map (SimpleGraph.Hom.ofLE (SimpleGraph.deleteEdges_le {s(t, p)})) + have ht_notMem : t ∉ q'_T.support := by + simpa [q'_T] using hq.2 + have huw : (T.deleteEdges {s(u, t)}).Reachable u w := by + simpa [Sym2.eq_swap] using + (reachable_deleteEdges_of_notMem_support (w := u) q'_T ht_notMem) + have hx_Bu : x ∈ (Bu u).vertexSet := hxBu u huS + simp only [Bu, treeDecompSide, biUnion, Set.mem_iUnion, Finset.mem_filter, + Finset.mem_univ, true_and] at hx_Bu + obtain ⟨w', htw', hxw'⟩ := hx_Bu + have hon : OnTreePath T w' w t := + onTreePath_of_reachable_deleteEdges hTD.isTree hadj_tu + (by simpa [Sym2.eq_swap] using htw') + (by simpa [Sym2.eq_swap] using huw) + have hx_τt : x ∈ (τ t).vertexSet := + (hTD.inter_le hon).vertexSet_subset ⟨hxw', hxw⟩ + exact hx_notB (hτt_sub_B hx_τt) + rcases S.eq_empty_or_nonempty with hS_empty | hS_ne + · have hB_eq_G : B.vertexSet = G.vertexSet := by + refine Set.Subset.antisymm hsep_AB.right_le.vertexSet_subset (fun x hxG ↦ ?_) + exact h_in_B x hxG (fun u hu ↦ by simp [hS_empty] at hu) + exact (h𝒯 t).axiom3 hBA_mem hB_eq_G + · obtain ⟨C, D, hCD_mem, hD_mem, _⟩ := hcombine S (Finset.Subset.refl S) hS_ne + have hD_sub_B : D.vertexSet ⊆ B.vertexSet := by + intro x hxD + exact h_in_B x (((h𝒯 t).isSeparation hCD_mem).right_le.vertexSet_subset hxD) (hD_mem x hxD) + have hAB_mem : (A, B) ∈ 𝒯 t := + theorem_2_9_case_1 (h𝒯 t) hCD_mem hsep_AB hord_AB hD_sub_B + exact hAB_not hAB_mem + +/-- In a standard tree-decomposition `(T, τ)` of `G` relative to `n` tangles `𝒯₁, …, 𝒯ₙ`, +`n ≤ |V(G)|` (Graph Minors X, Section 10, (10.4), page 184). -/ +theorem IsStandardTreeDecomposition.card_le_ncard_vertexSet + {n : ℕ} {Λ : Type*} [LinearOrder Λ] + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : Fin n → ℕ} {𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : ∀ i : Fin n, IsTangle G (θ i) (𝒯 i)) + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (hstd : IsStandardTreeDecomposition G lam 𝒯 T τ) : + n ≤ G.vertexSet.ncard := by + classical + rcases Nat.eq_zero_or_pos n with rfl | hn + · exact Nat.zero_le _ + let r₀ : Fin n := ⟨0, hn⟩ + by_cases hn2 : 2 ≤ n + · have hTD := hstd.isTreeDecomposition + -- `V(τ r₀)` is nonempty since `r₀` has a neighbor in `T`: + have hτ_r₀_ne : (τ r₀).vertexSet.Nonempty := by + obtain ⟨t₁, hne⟩ : ∃ t₁ : Fin n, r₀ ≠ t₁ := + ⟨⟨1, hn2⟩, by simp [r₀, Fin.ext_iff]⟩ + obtain ⟨q, _, _⟩ := hTD.isTree.existsUnique_path r₀ t₁ + cases q with + | nil => exact (hne rfl).elim + | @cons _ u _ hadj _ => + have hnot := hstd.not_bag_vertexSet_subset_of_adj h𝒯 hadj + obtain ⟨x, hx, _⟩ := Set.not_subset.1 hnot + exact ⟨x, hx⟩ + -- For every `t ≠ r₀`, choose the neighbor `p` of `t` on the path from `t` to `r₀`: + have hparent : ∀ t : Fin n, t ≠ r₀ → + ∃ p : Fin n, T.Adj t p ∧ (T.deleteEdges {s(t, p)}).Reachable p r₀ := by + intro t hne + obtain ⟨q, hq, _⟩ := hTD.isTree.existsUnique_path t r₀ + cases q with + | nil => exact (hne rfl).elim + | @cons _ p _ hadj q' => + rw [Walk.cons_isPath_iff] at hq + exact ⟨p, hadj, reachable_deleteEdges_of_notMem_support q' hq.2⟩ + choose parent hadj_parent hreach_parent using hparent + have hvertex_exists : ∀ t : Fin n, + ∃ x ∈ (τ t).vertexSet, ∀ h : t ≠ r₀, x ∉ (τ (parent t h)).vertexSet := by + intro t + by_cases ht : t = r₀ + · subst ht + obtain ⟨x, hx⟩ := hτ_r₀_ne + exact ⟨x, hx, fun h ↦ (h rfl).elim⟩ + · have hnot := hstd.not_bag_vertexSet_subset_of_adj h𝒯 (hadj_parent t ht) + obtain ⟨x, hxt, hxp⟩ := Set.not_subset.1 hnot + exact ⟨x, hxt, fun _ ↦ hxp⟩ + choose f hf_mem hf_notMem using hvertex_exists + have hf_in_G : Set.range f ⊆ G.vertexSet := by + rintro x ⟨t, rfl⟩ + exact (hTD.le t).vertexSet_subset (hf_mem t) + have hf_inj : Function.Injective f := by + intro t₁ t₂ hfeq + by_contra hne + -- Helper: if `ht : tᵢ ≠ r₀` and `tⱼ` is in the `parent tᵢ ht`-component of + -- `T \ s(tᵢ, parent tᵢ ht)`, we get a contradiction from `(T3)`. + have h_contra : ∀ (a b : Fin n) (ha : a ≠ r₀), + f a = f b → + (T.deleteEdges {s(a, parent a ha)}).Reachable (parent a ha) b → False := by + intro a b ha hfab hr_pb + have hon : OnTreePath T b a (parent a ha) := + onTreePath_of_reachable_deleteEdges hTD.isTree (hadj_parent a ha).symm + (by simpa [Sym2.eq_swap] using hr_pb) + (by simp) + have hmem_p : f a ∈ (τ (parent a ha)).vertexSet := + (hTD.inter_le hon).vertexSet_subset ⟨hfab ▸ hf_mem b, hf_mem a⟩ + exact hf_notMem a ha hmem_p + by_cases ht₁ : t₁ = r₀ + · subst ht₁ + have ht₂ : t₂ ≠ r₀ := Ne.symm hne + exact h_contra t₂ r₀ ht₂ hfeq.symm (hreach_parent t₂ ht₂) + · by_cases ht₂ : t₂ = r₀ + · subst ht₂ + exact h_contra t₁ r₀ ht₁ hfeq (hreach_parent t₁ ht₁) + · rcases reachable_deleteEdges_or hTD.isTree.connected + (u := t₁) (v := parent t₁ ht₁) t₂ with hr₁ | hr₁ + · rcases reachable_deleteEdges_or hTD.isTree.connected + (u := t₂) (v := parent t₂ ht₂) t₁ with hr₂ | hr₂ + · -- Neither `parent t₁` nor `parent t₂` separates `t₁` and `t₂`, impossible: + have hnot₁ : ¬ (T.deleteEdges {s(t₁, parent t₁ ht₁)}).Reachable (parent t₁ ht₁) t₂ := + fun h ↦ not_reachable_deleteEdges hTD.isTree (hadj_parent t₁ ht₁) + (hr₁.trans h.symm) + have hr_p₁_r₀ : + (T.deleteEdges {s(t₂, parent t₂ ht₂)}).Reachable (parent t₁ ht₁) r₀ := + reachable_deleteEdges_of_not_reachable (hreach_parent t₁ ht₁) hnot₁ + have hne_edge : s(t₁, parent t₁ ht₁) ≠ s(t₂, parent t₂ ht₂) := by + intro heq + rcases Sym2.eq_iff.1 heq with ⟨h1, _⟩ | ⟨h1, h2⟩ + · exact hne h1 + · subst h2 + exact not_reachable_deleteEdges hTD.isTree (hadj_parent t₁ ht₁) hr₁ + have hadj₁_in_2 : + (T.deleteEdges {s(t₂, parent t₂ ht₂)}).Adj t₁ (parent t₁ ht₁) := + deleteEdges_adj.mpr ⟨hadj_parent t₁ ht₁, hne_edge⟩ + have hr_t₂_r₀ : (T.deleteEdges {s(t₂, parent t₂ ht₂)}).Reachable t₂ r₀ := + hr₂.trans (hadj₁_in_2.reachable.trans hr_p₁_r₀) + exact not_reachable_deleteEdges hTD.isTree (hadj_parent t₂ ht₂) + (hr_t₂_r₀.trans (hreach_parent t₂ ht₂).symm) + · exact (h_contra t₂ t₁ ht₂ hfeq.symm hr₂).elim + · exact (h_contra t₁ t₂ ht₁ hfeq hr₁).elim + have hcard_range : (Set.range f).ncard = n := by + rw [Set.ncard_range_of_injective hf_inj, Nat.card_eq_fintype_card, Fintype.card_fin] + rw [← hcard_range] + exact Set.ncard_le_ncard hf_in_G G.vertexSet_finite + · have hn1 : n = 1 := by omega + rw [hn1] + exact (h𝒯 r₀).one_le.trans (h𝒯 r₀).order_le_ncard_vertexSet + +/-- In a standard tree-decomposition `(T, τ)` of `G` relative to `n ≥ 1` tangles `𝒯₁, …, 𝒯ₙ`, +`|E(T)| ≤ |V(G)| - 1` (Graph Minors X, Section 10, proof of (10.4), page 184). -/ +theorem IsStandardTreeDecomposition.ncard_edgeSet_le + {n : ℕ} {Λ : Type*} [LinearOrder Λ] + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : Fin n → ℕ} {𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)} + (hn : 1 ≤ n) (h𝒯 : ∀ i : Fin n, IsTangle G (θ i) (𝒯 i)) + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (hstd : IsStandardTreeDecomposition G lam 𝒯 T τ) : + T.edgeSet.ncard ≤ G.vertexSet.ncard - 1 := by + classical + have : Nonempty (Fin n) := ⟨⟨0, hn⟩⟩ + have htree := hstd.isTreeDecomposition.isTree.card_edgeFinset + rw [Fintype.card_fin] at htree + rw [Set.ncard_eq_toFinset_card'] + change T.edgeFinset.card ≤ G.vertexSet.ncard - 1 + have hle := hstd.card_le_ncard_vertexSet h𝒯 + omega + +/-- Any family of `n` mutually distinguishable tangles in a hypergraph `G` has `n ≤ |V(G)|` +(Graph Minors X, Section 10, (10.4), page 184). -/ +theorem card_le_of_mutually_distinguishable {n : ℕ} (G : Hypergraph α β) + {θ : Fin n → ℕ} {𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : ∀ i : Fin n, IsTangle G (θ i) (𝒯 i)) + (hdist : ∀ i j : Fin n, i ≠ j → AreDistinguishable (𝒯 i) (𝒯 j)) : + n ≤ G.vertexSet.ncard := by + rcases Nat.eq_zero_or_pos n with rfl | hn + · exact Nat.zero_le _ + obtain ⟨lam, hTB⟩ := theorem_9_2_proof G + obtain ⟨T, τ, hstd⟩ := theorem_10_3_proof G lam θ 𝒯 hn hTB h𝒯 hdist + exact hstd.card_le_ncard_vertexSet h𝒯 + +/-- The set of all maximal tangles in `G` is finite (Graph Minors X, Section 10, (10.4), +page 184). -/ +theorem maximalTangles_finite (G : Hypergraph α β) : + (maximalTangles G).Finite := by + have hsep_fin : {p : Hypergraph α β × Hypergraph α β | G.IsSeparation p.1 p.2}.Finite := + finite_of_forall_isSeparation (G := G) (fun _ h ↦ h) + refine hsep_fin.finite_subsets.subset ?_ + intro 𝒯 h𝒯 p hp + obtain ⟨θ, hT⟩ := h𝒯.1 + exact hT.isSeparation hp + +/-- **Graph Minors X, (10.4)** (page 184): +"In any hypergraph $G$ there are at most $|V(G)|$ maximal tangles." -/ +theorem theorem_10_4_proof (G : Hypergraph α β) : + (maximalTangles G).ncard ≤ G.vertexSet.ncard := by + classical + have hfin := maximalTangles_finite G + let n := (maximalTangles G).ncard + have hcard : Fintype.card hfin.toFinset = n := by + rw [Fintype.card_coe, ← Set.ncard_eq_toFinset_card (maximalTangles G) hfin] + let e : Fin n ≃ hfin.toFinset := (Fintype.equivFinOfCardEq hcard).symm + let 𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β) := fun i ↦ (e i).1 + have hmax : ∀ i : Fin n, IsMaximalTangle G (𝒯 i) := by + intro i + exact (hfin.mem_toFinset).1 (e i).2 + choose θ h𝒯 using fun i ↦ (hmax i).1 + have hdist : ∀ i j : Fin n, i ≠ j → AreDistinguishable (𝒯 i) (𝒯 j) := by + intro i j hij + refine (hmax i).areDistinguishable (hmax j) ?_ + intro heq + exact hij (e.injective (Subtype.ext heq)) + exact card_le_of_mutually_distinguishable G h𝒯 hdist + + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/Section11.lean b/LeanPool/GraphMinor/GM10/Section11.lean new file mode 100644 index 0000000000..776be930e8 --- /dev/null +++ b/LeanPool/GraphMinor/GM10/Section11.lean @@ -0,0 +1,1193 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Defs2 +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM10.Section9 +import Mathlib.Combinatorics.SimpleGraph.Walk.Maps +import Mathlib.Data.Set.Card + +/-! +# Graph Minors X, Section 11: Structure Relative to a Tangle + +This file formalizes Section 11 (pages 184–188) of N. Robertson and P. D. Seymour, +*Graph Minors. X. Obstructions to tree-decomposition*, J. Combin. Theory Ser. B 52 (1991) 153–190: + +- **Star-of-trees gluing construction:** gluing tree-decompositions `(Tᵢ, τᵢ)` of subhypergraphs + `Aᵢ ≤ G` around a central bag `τ₀ ≤ G` to form a tree-decomposition of `G`. +- **(11.2) (`theorem_11_2`, pages 185–186):** for `θ ≥ 1`, `𝒮` `θ`-pervasive in `G`, and + `Z ⊆ V(G)` with `|Z| = 3θ - 2`, either there is a low-order separation splitting `Z` into smaller + pieces or there is a location in `G` with design in `𝒮` where every member has small intersection + with `Z`. +- **(11.3) (`theorem_11_3`, pages 186–188):** the inductive strengthened form of `(11.1)` with a + prescribed set `Z ⊆ V(G)` of size `≤ 3θ - 2`. +- **(11.1) (`theorem_11_1`, page 185):** every hypergraph `G` in which a class of designs `𝒮` is + `θ`-pervasive has a tree-decomposition over `𝒮^{3θ - 2} ∪ ℛ_{4θ - 3}`. +-/ + +public section + +namespace GraphMinor.GM10 + +open SimpleGraph Hypergraph + +variable {α β : Type*} + +/-! ## Helper subhypergraphs and design lemmas -/ + +/-- If `K.edgeSet = ∅` and `K.vertexSet ⊆ H.vertexSet`, then `K ≤ H`. -/ +theorem le_of_edgeSet_eq_empty {K H : Hypergraph α β} + (hE : K.edgeSet = ∅) (hV : K.vertexSet ⊆ H.vertexSet) : K ≤ H := + ⟨hV, hE.symm ▸ Set.empty_subset _, fun _ he ↦ (Set.notMem_empty _ (hE ▸ he)).elim⟩ + +/-- The edgeless subhypergraph of `G` with vertex set `X ∩ V(G)`. -/ +private def edgelessSubhypergraph (G : Hypergraph α β) (X : Set α) : Hypergraph α β where + vertexSet := X ∩ G.vertexSet + edgeSet := ∅ + Inc _ _ := False + vertex_mem_of_inc _ _ h := h.elim + edge_mem_of_inc _ _ h := h.elim + vertexSet_finite := G.vertexSet_finite.subset Set.inter_subset_right + edgeSet_finite := Set.finite_empty + +@[simp] +private theorem edgelessSubhypergraph_vertexSet (G : Hypergraph α β) {X : Set α} + (hX : X ⊆ G.vertexSet) : + (edgelessSubhypergraph G X).vertexSet = X := + Set.inter_eq_self_of_subset_left hX + +@[simp] +private theorem edgelessSubhypergraph_edgeSet (G : Hypergraph α β) (X : Set α) : + (edgelessSubhypergraph G X).edgeSet = ∅ := rfl + +private theorem edgelessSubhypergraph_le (G : Hypergraph α β) (X : Set α) : + edgelessSubhypergraph G X ≤ G := + le_of_edgeSet_eq_empty rfl Set.inter_subset_right + +/-- Adding a set of vertices `Z ⊆ V(G)` to a subhypergraph `H ≤ G` without adding edges. -/ +private def addVertices (G H : Hypergraph α β) (Z : Set α) : Hypergraph α β where + vertexSet := H.vertexSet ∪ (Z ∩ G.vertexSet) + edgeSet := H.edgeSet + Inc := H.Inc + vertex_mem_of_inc _ _ h := Or.inl (H.vertex_mem_of_inc h) + edge_mem_of_inc _ _ h := H.edge_mem_of_inc h + vertexSet_finite := H.vertexSet_finite.union (G.vertexSet_finite.subset Set.inter_subset_right) + edgeSet_finite := H.edgeSet_finite + +@[simp] +private theorem addVertices_vertexSet {G H : Hypergraph α β} {Z : Set α} (hZ : Z ⊆ G.vertexSet) : + (addVertices G H Z).vertexSet = H.vertexSet ∪ Z := by + simp [addVertices, Set.inter_eq_self_of_subset_left hZ] + +@[simp] +private theorem addVertices_edgeSet (G H : Hypergraph α β) (Z : Set α) : + (addVertices G H Z).edgeSet = H.edgeSet := rfl + +private theorem le_addVertices (G H : Hypergraph α β) (Z : Set α) : + H ≤ addVertices G H Z := + ⟨Set.subset_union_left, subset_rfl, fun _ _ ↦ rfl⟩ + +private theorem addVertices_le {G H : Hypergraph α β} (hH : H ≤ G) (Z : Set α) : + addVertices G H Z ≤ G := + ⟨Set.union_subset hH.vertexSet_subset Set.inter_subset_right, + hH.edgeSet_subset, hH.ends_eq⟩ + +/-- Remark at the start of the proof of (11.3) (page 186): +"from the definition of $\theta$-pervasive, if $\mathscr{S}$ is $\theta$-pervasive in $G$ +then it is $\theta$-pervasive in every subhypergraph of $G$." -/ +theorem IsPervasive.mono {G G' : Hypergraph α β} {θ : ℕ} {𝒮 : Set (Design α β)} + (hperv : IsPervasive G θ 𝒮) (hle : G' ≤ G) : + IsPervasive G' θ 𝒮 := + fun _ hle' _ _ hθ' h𝒯 ↦ hperv (hle'.trans hle) hθ' h𝒯 + +/-- For any set `ℒ` of separations of `G`, `locationCore G ℒ ≤ G`. -/ +theorem locationCore_le {G : Hypergraph α β} {ℒ : Set (Hypergraph α β × Hypergraph α β)} + (hsep : ∀ ⦃p⦄, p ∈ ℒ → G.IsSeparation p.1 p.2) : + locationCore G ℒ ≤ G where + vertexSet_subset _ h := h.1 + edgeSet_subset _ h := h.1 + ends_eq e he := by + ext v + simp only [Hypergraph.ends, locationCore, Set.mem_ofPred_eq] + refine ⟨fun hinc ↦ ⟨hinc, fun p hp ↦ ?_, he.2⟩, fun h ↦ h.1⟩ + have hp_le := (hsep hp).right_le + have hv_ends : v ∈ p.2.ends e := hp_le.ends_eq e (he.2 p hp) ▸ hinc + exact p.2.vertex_mem_of_inc hv_ends + +/-- For any location `ℒ` in `G`, `locationDesign G ℒ` is a design (page 185). -/ +theorem IsLocation.isDesign_locationDesign {G : Hypergraph α β} + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hloc : IsLocation G ℒ) : + IsDesign (locationDesign G ℒ) := by + rintro X ⟨p, hp, rfl⟩ x ⟨hxA, hxB⟩ + refine ⟨(hloc.isSeparation hp).left_le.vertexSet_subset hxA, fun q hq ↦ ?_⟩ + by_cases hpq : p = q + · exact hpq ▸ hxB + · exact (hloc.left_le_right hp hq hpq).vertexSet_subset hxA + +/-- Any location in a hypergraph `G` is a finite set of separations. -/ +theorem IsLocation.finite {G : Hypergraph α β} {ℒ : Set (Hypergraph α β × Hypergraph α β)} + (hloc : IsLocation G ℒ) : ℒ.Finite := + finite_of_forall_isSeparation fun _ hp ↦ hloc.isSeparation hp + +/-- Relabelling a tree-decomposition along `e : ι ≃ ι'` preserves `vertexDesign`. -/ +theorem vertexDesign_map {ι ι' : Type*} (T : SimpleGraph ι) (τ : ι → Hypergraph α β) + (e : ι ≃ ι') (t₀ : ι) : + vertexDesign (T.map e.toEmbedding) (τ ∘ e.symm) (e t₀) = vertexDesign T τ t₀ := by + ext : 1 + · simp [vertexDesign] + · ext X + simp only [vertexDesign, Set.mem_ofPred_eq, Function.comp_apply, Equiv.symm_apply_apply] + constructor + · rintro ⟨t', hadj', rfl⟩ + obtain ⟨t, rfl⟩ := e.surjective t' + have hadj : T.Adj t₀ t := (SimpleGraph.Iso.map e T).map_rel_iff.1 hadj' + exact ⟨t, hadj, by simp⟩ + · rintro ⟨t, hadj, rfl⟩ + have hadj' : (T.map e.toEmbedding).Adj (e t₀) (e t) := + (SimpleGraph.Iso.map e T).map_rel_iff.2 hadj + exact ⟨e t, hadj', by simp⟩ + +/-- Relabelling a tree-decomposition over `𝒮` along `e : ι ≃ ι'` gives a tree-decomposition over +`𝒮`. -/ +theorem IsTreeDecompositionOver.relabel {ι ι' : Type*} [Fintype ι] [Fintype ι'] + {G : Hypergraph α β} {𝒮 : Set (Design α β)} {T : SimpleGraph ι} {τ : ι → Hypergraph α β} + (h : IsTreeDecompositionOver G 𝒮 T τ) (e : ι ≃ ι') : + IsTreeDecompositionOver G 𝒮 (T.map e.toEmbedding) (τ ∘ e.symm) := by + refine ⟨h.1.relabel e, fun t' ↦ ?_⟩ + obtain ⟨t, rfl⟩ := e.surjective t' + rw [vertexDesign_map] + exact h.2 t + +/-! ## Proof of Graph Minors X, (11.2) -/ + +/-- **Graph Minors X, (11.2)** (pages 185–186): +"Let $\theta \ge 1$, let $\mathscr{S}$ be $\theta$-pervasive in $G$, and let $Z \subseteq +V(G)$ with $|Z| = 3\theta - 2$. Then either* (i) *there is a separation $(A, B)$ of $G$ of +order $< \theta$ with* $$ |(Z \cup V(A)) \cap V(B)|, |(Z \cup V(B)) \cap V(A)| \le 3\theta - +3 $$ ... *or* (ii) *there is a location $\{(A_1, B_1), \dots, (A_k, B_k)\}$ in $G$, with design +in $\mathscr{S}$, such that for $1 \le i \le k$,* $$ |Z \cap V(A_i)| \le |V(A_i \cap B_i)| < +\theta." -/ +theorem theorem_11_2_proof {G : Hypergraph α β} {θ : ℕ} {𝒮 : Set (Design α β)} {Z : Set α} + (hθ : 1 ≤ θ) (hperv : IsPervasive G θ 𝒮) + (hZ_sub : Z ⊆ G.vertexSet) (hZ_card : Z.ncard = 3 * θ - 2) : + (∃ A B : Hypergraph α β, G.IsSeparation A B ∧ separationOrder A B < θ ∧ + ((Z ∪ A.vertexSet) ∩ B.vertexSet).ncard ≤ 3 * θ - 3 ∧ + ((Z ∪ B.vertexSet) ∩ A.vertexSet).ncard ≤ 3 * θ - 3) ∨ + (∃ ℒ : Set (Hypergraph α β × Hypergraph α β), + IsLocation G ℒ ∧ locationDesign G ℒ ∈ 𝒮 ∧ + ∀ p ∈ ℒ, (Z ∩ p.1.vertexSet).ncard ≤ separationOrder p.1 p.2 ∧ + separationOrder p.1 p.2 < θ) := by + let 𝒯 : Set (Hypergraph α β × Hypergraph α β) := + {p | G.IsSeparation p.1 p.2 ∧ separationOrder p.1 p.2 < θ ∧ + (Z ∩ p.1.vertexSet).ncard ≤ separationOrder p.1 p.2} + have hZ_fin : Z.Finite := G.vertexSet_finite.subset hZ_sub + have hax2 : TangleAxiom2 G 𝒯 := by + intro A₁ B₁ A₂ B₂ A₃ B₃ h1 h2 h3 hunion + have hZ_union : Z = (Z ∩ A₁.vertexSet) ∪ (Z ∩ A₂.vertexSet) ∪ (Z ∩ A₃.vertexSet) := by + ext x + simp only [Set.mem_union, Set.mem_inter_iff] + refine ⟨fun hx ↦ ?_, fun h ↦ h.elim (fun h' ↦ h'.elim And.left And.left) And.left⟩ + have hxG : x ∈ (A₁ ∪ A₂ ∪ A₃).vertexSet := hunion.symm ▸ hZ_sub hx + rcases hxG with (hx1 | hx2) | hx3 + · exact Or.inl (Or.inl ⟨hx, hx1⟩) + · exact Or.inl (Or.inr ⟨hx, hx2⟩) + · exact Or.inr ⟨hx, hx3⟩ + have h1_le : (Z ∩ A₁.vertexSet).ncard ≤ θ - 1 := + Nat.le_sub_one_of_lt (h1.2.2.trans_lt h1.2.1) + have h2_le : (Z ∩ A₂.vertexSet).ncard ≤ θ - 1 := + Nat.le_sub_one_of_lt (h2.2.2.trans_lt h2.2.1) + have h3_le : (Z ∩ A₃.vertexSet).ncard ≤ θ - 1 := + Nat.le_sub_one_of_lt (h3.2.2.trans_lt h3.2.1) + have hcard_le : Z.ncard ≤ (Z ∩ A₁.vertexSet).ncard + (Z ∩ A₂.vertexSet).ncard + + (Z ∩ A₃.vertexSet).ncard := + calc Z.ncard + _ = ((Z ∩ A₁.vertexSet) ∪ (Z ∩ A₂.vertexSet) ∪ (Z ∩ A₃.vertexSet)).ncard := + congrArg Set.ncard hZ_union + _ ≤ ((Z ∩ A₁.vertexSet) ∪ (Z ∩ A₂.vertexSet)).ncard + (Z ∩ A₃.vertexSet).ncard := + Set.ncard_union_le _ _ + _ ≤ (Z ∩ A₁.vertexSet).ncard + (Z ∩ A₂.vertexSet).ncard + (Z ∩ A₃.vertexSet).ncard := + Nat.add_le_add_right (Set.ncard_union_le _ _) _ + have : 3 * θ - 2 ≤ (θ - 1) + (θ - 1) + (θ - 1) := by + rw [← hZ_card] + exact hcard_le.trans (Nat.add_le_add (Nat.add_le_add h1_le h2_le) h3_le) + omega + have hax3 : TangleAxiom3 G 𝒯 := by + intro A B hAB hV + have hZ_eq : Z ∩ A.vertexSet = Z := by + rw [hV, Set.inter_eq_self_of_subset_left hZ_sub] + have hlt : Z.ncard < θ := by + rw [← hZ_eq] + exact hAB.2.2.trans_lt hAB.2.1 + omega + by_cases hax1 : TangleAxiom1 G θ 𝒯 + · right + have hTangle : IsTangle G θ 𝒯 := + ⟨hθ, fun _ _ h ↦ h.1, fun _ _ h ↦ h.2.1, hax1, hax2, hax3⟩ + obtain ⟨ℒ, hloc, hℒ_sub, hdes⟩ := hperv le_rfl le_rfl hTangle + exact ⟨ℒ, hloc, hdes, fun p hp ↦ ⟨(hℒ_sub hp).2.2, (hℒ_sub hp).2.1⟩⟩ + · left + unfold TangleAxiom1 at hax1 + push Not at hax1 + obtain ⟨A, B, hsep, hord, hnotA, hnotB⟩ := hax1 + have hZA : separationOrder A B < (Z ∩ A.vertexSet).ncard := by + by_contra! hle + exact hnotA ⟨hsep, hord, hle⟩ + have hZB : separationOrder A B < (Z ∩ B.vertexSet).ncard := by + rw [separationOrder_comm] + by_contra! hle + exact hnotB ⟨hsep.symm, by rwa [separationOrder_comm], hle⟩ + have hbound : ∀ X Y : Hypergraph α β, G.IsSeparation X Y → + separationOrder X Y < (Z ∩ X.vertexSet).ncard → + ((Z ∪ X.vertexSet) ∩ Y.vertexSet).ncard ≤ 3 * θ - 3 := by + intro X Y hXY hlt + have hset : (Z ∪ X.vertexSet) ∩ Y.vertexSet = + (X ∩ Y).vertexSet ∪ (Z \ X.vertexSet) := by + ext v + simp only [inter_vertexSet, Set.mem_inter_iff, Set.mem_union, + Set.mem_sdiff] + constructor + · rintro ⟨hvZ | hvX, hvY⟩ + · by_cases hvX : v ∈ X.vertexSet + · exact Or.inl ⟨hvX, hvY⟩ + · exact Or.inr ⟨hvZ, hvX⟩ + · exact Or.inl ⟨hvX, hvY⟩ + · rintro (⟨hvX, hvY⟩ | ⟨hvZ, _⟩) + · exact ⟨Or.inr hvX, hvY⟩ + · have hvG : v ∈ G.vertexSet := hZ_sub hvZ + rw [← hXY.vertexSet_union] at hvG + rcases hvG with hvX | hvY + · exact ⟨Or.inr hvX, by contradiction⟩ + · exact ⟨Or.inl hvZ, hvY⟩ + have hle1 : ((Z ∪ X.vertexSet) ∩ Y.vertexSet).ncard ≤ + separationOrder X Y + (Z \ X.vertexSet).ncard := by + rw [hset] + exact Set.ncard_union_le _ _ + have hdisj_ZX : Disjoint (Z ∩ X.vertexSet) (Z \ X.vertexSet) := + Set.disjoint_iff_inter_eq_empty.2 (by ext; simp) + have hZ_split : (Z ∩ X.vertexSet).ncard + (Z \ X.vertexSet).ncard = Z.ncard := by + rw [← Set.ncard_union_eq hdisj_ZX + (hZ_fin.subset Set.inter_subset_left) (hZ_fin.subset Set.sdiff_subset), + Set.inter_union_sdiff] + have hltZ : ((Z ∪ X.vertexSet) ∩ Y.vertexSet).ncard < 3 * θ - 2 := by + calc ((Z ∪ X.vertexSet) ∩ Y.vertexSet).ncard + _ ≤ separationOrder X Y + (Z \ X.vertexSet).ncard := hle1 + _ < (Z ∩ X.vertexSet).ncard + (Z \ X.vertexSet).ncard := + Nat.add_lt_add_right hlt _ + _ = 3 * θ - 2 := hZ_split.trans hZ_card + omega + exact ⟨A, B, hsep, hord, hbound A B hsep hZA, + hbound B A hsep.symm (by rwa [separationOrder_comm])⟩ + +/-! ## Star-of-trees gluing construction for (11.3) -/ + +/-- Adjacency relation for the star-of-trees graph on `Option (Σ i : Fin k, ι i)`, gluing +disjoint trees `T i` by connecting the center `none` to `some ⟨i, r i⟩` for each `i`. -/ +private def StarAdj {k : ℕ} {ι : Fin k → Type*} (T : ∀ i, SimpleGraph (ι i)) (r : ∀ i, ι i) : + Option (Σ i, ι i) → Option (Σ i, ι i) → Prop + | none, none => False + | none, some ⟨i, u⟩ => u = r i + | some ⟨i, u⟩, none => u = r i + | some ⟨i, u⟩, some ⟨j, v⟩ => ∃ h : i = j, (T j).Adj (h ▸ u) v + +/-- The star-of-trees simple graph on `Option (Σ i : Fin k, ι i)`. -/ +private def StarTree {k : ℕ} {ι : Fin k → Type*} (T : ∀ i, SimpleGraph (ι i)) (r : ∀ i, ι i) : + SimpleGraph (Option (Σ i, ι i)) where + Adj := StarAdj T r + symm := ⟨by + rintro (_ | ⟨i, u⟩) (_ | ⟨j, v⟩) h + · exact h + · exact h + · exact h + · rcases h with ⟨rfl, hadj⟩ + exact ⟨rfl, hadj.symm⟩⟩ + loopless := ⟨by + rintro (_ | ⟨i, u⟩) h + · exact h + · rcases h with ⟨h_eq, hadj⟩ + have : h_eq = rfl := Subsingleton.elim _ _ + subst this + exact (T i).loopless.irrefl u hadj⟩ + +/-- The bag map on `Option (Σ i : Fin k, ι i)` assigning `τ₀` to `none` and `τ i u` to +`some ⟨i, u⟩`. -/ +private def starBag {k : ℕ} {ι : Fin k → Type*} (τ₀ : Hypergraph α β) + (τ : ∀ i, ι i → Hypergraph α β) : Option (Σ i, ι i) → Hypergraph α β + | none => τ₀ + | some ⟨i, u⟩ => τ i u + +/-- Embedding of `T i` into `StarTree T r` sending `u` to `some ⟨i, u⟩`. -/ +private abbrev starInl {k : ℕ} {ι : Fin k → Type*} (T : ∀ i, SimpleGraph (ι i)) (r : ∀ i, ι i) + (i : Fin k) : T i →g StarTree T r where + toFun u := some ⟨i, u⟩ + map_rel' hadj := ⟨rfl, hadj⟩ + +private theorem starInl_injective {k : ℕ} {ι : Fin k → Type*} (T : ∀ i, SimpleGraph (ι i)) + (r : ∀ i, ι i) (i : Fin k) : + Function.Injective (starInl T r i) := by + intro u v h + exact (Sigma.mk.inj_iff.1 (Option.some.inj h)).2 |> eq_of_heq + +private theorem starTree_adj_none_r {k : ℕ} {ι : Fin k → Type*} (T : ∀ i, SimpleGraph (ι i)) + (r : ∀ i, ι i) (i : Fin k) : + (StarTree T r).Adj none (some ⟨i, r i⟩) := by + rfl + +/-- Projection from `Option (Σ j, ι j)` onto `ι i` sending `some ⟨i, u⟩` to `u` and all other +vertices to `r i`. -/ +private def starProj {k : ℕ} {ι : Fin k → Type*} (r : ∀ i, ι i) (i : Fin k) : + Option (Σ j, ι j) → ι i + | none => r i + | some ⟨j, u⟩ => if h : j = i then h ▸ u else r i + +@[simp] +private theorem starProj_none {k : ℕ} {ι : Fin k → Type*} (r : ∀ i, ι i) (i : Fin k) : + starProj r i none = r i := rfl + +@[simp] +private theorem starProj_some_self {k : ℕ} {ι : Fin k → Type*} (r : ∀ i, ι i) (i : Fin k) + (u : ι i) : + starProj r i (some ⟨i, u⟩) = u := by + simp [starProj] + +private theorem starProj_some_of_ne {k : ℕ} {ι : Fin k → Type*} (r : ∀ i, ι i) {i j : Fin k} + (h : j ≠ i) (u : ι j) : + starProj r i (some ⟨j, u⟩) = r i := by + simp [starProj, h] + +/-- If each `T i` is a tree, then `StarTree T r` is a tree. -/ +private theorem starTree_isTree {k : ℕ} {ι : Fin k → Type*} {T : ∀ i, SimpleGraph (ι i)} + {r : ∀ i, ι i} (hT : ∀ i, (T i).IsTree) : + (StarTree T r).IsTree := by + have hconn : (StarTree T r).Connected := by + rw [connected_iff_exists_forall_reachable] + refine ⟨none, ?_⟩ + rintro (_ | ⟨i, u⟩) + · exact Reachable.refl _ + · have h1 : (StarTree T r).Reachable none (some ⟨i, r i⟩) := + (starTree_adj_none_r T r i).reachable + obtain ⟨p⟩ := (hT i).connected (r i) u + exact h1.trans ⟨p.map (starInl T r i)⟩ + refine ⟨hconn, isAcyclic_iff_forall_adj_isBridge.2 ?_⟩ + intro a b hadj + rw [isBridge_iff] + -- Helper: if `P` is invariant under `H.Adj`, `P a` and `¬ P b`, then `¬ H.Reachable a b`. + have not_reach_of_inv : ∀ {H : SimpleGraph (Option (Σ i, ι i))} + (P : Option (Σ i, ι i) → Prop) {x y : Option (Σ i, ι i)}, + (∀ u v, H.Adj u v → P u → P v) → P x → ¬ P y → ¬ H.Reachable x y := by + intro H P x y hinv hx hy ⟨w⟩ + apply hy + clear hy + induction w with + | nil => exact hx + | cons hstep _ ih => exact ih (hinv _ _ hstep hx) + rcases a with _ | ⟨i, u⟩ <;> rcases b with _ | ⟨j, v⟩ + · exact hadj.elim + · change v = r j at hadj + subst hadj + let P : Option (Σ l, ι l) → Prop + | none => False + | some ⟨l, _⟩ => l = j + intro hr + refine not_reach_of_inv (x := some ⟨j, r j⟩) (y := none) P ?_ rfl not_false hr.symm + rintro (_ | ⟨l₁, w₁⟩) (_ | ⟨l₂, w₂⟩) hstep hl₁ + · exact hl₁.elim + · exact hl₁.elim + · change l₁ = j at hl₁ + subst hl₁ + rcases deleteEdges_adj.1 hstep with ⟨hw₁, hne⟩ + change w₁ = r l₁ at hw₁ + subst hw₁ + exact (hne Sym2.eq_swap).elim + · rcases (deleteEdges_adj.1 hstep).1 with ⟨rfl, _⟩ + exact hl₁ + · change u = r i at hadj + subst hadj + let P : Option (Σ l, ι l) → Prop + | none => False + | some ⟨l, _⟩ => l = i + refine not_reach_of_inv P ?_ (rfl : P (some ⟨i, r i⟩)) (not_false : ¬ P none) + rintro (_ | ⟨l₁, w₁⟩) (_ | ⟨l₂, w₂⟩) hstep hl₁ + · exact hl₁.elim + · exact hl₁.elim + · change l₁ = i at hl₁ + subst hl₁ + rcases deleteEdges_adj.1 hstep with ⟨hw₁, hne⟩ + change w₁ = r l₁ at hw₁ + subst hw₁ + exact (hne rfl).elim + · rcases (deleteEdges_adj.1 hstep).1 with ⟨rfl, _⟩ + exact hl₁ + · rcases hadj with ⟨rfl, hadj_uv⟩ + rintro ⟨w⟩ + have hreach_proj : ∀ {x y : Option (Σ l, ι l)}, + ((StarTree T r).deleteEdges {s(some ⟨i, u⟩, some ⟨i, v⟩)}).Walk x y → + ((T i).deleteEdges {s(u, v)}).Reachable (starProj r i x) (starProj r i y) := by + intro x y q + induction q with + | nil => exact Reachable.refl _ + | @cons a b c hstep _ ih => + refine Reachable.trans ?_ ih + rcases deleteEdges_adj.1 hstep with ⟨hab, hne⟩ + rcases a with _ | ⟨l₁, w₁⟩ <;> rcases b with _ | ⟨l₂, w₂⟩ + · exact hab.elim + · change w₂ = r l₂ at hab + subst hab + by_cases hl : l₂ = i + · subst hl; simp + · simp [starProj_some_of_ne r hl] + · change w₁ = r l₁ at hab + subst hab + by_cases hl : l₁ = i + · subst hl; simp + · simp [starProj_some_of_ne r hl] + · rcases hab with ⟨rfl, hadj_w⟩ + by_cases hl : l₁ = i + · subst hl + simp only [starProj_some_self] + refine (deleteEdges_adj.2 ⟨hadj_w, ?_⟩).reachable + intro heq + apply hne + rcases Sym2.eq_iff.1 heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · exact Sym2.eq_swap + · simp [starProj_some_of_ne r hl] + have huv := hreach_proj w + simp only [starProj_some_self] at huv + exact not_reachable_deleteEdges (hT i) hadj_uv huv + +private theorem onTreePath_of_mem_support {V : Type*} {G : SimpleGraph V} (hG : G.IsTree) + {x y z : V} {p : G.Walk x y} (hp : p.IsPath) (hz : z ∈ p.support) : + OnTreePath G x y z := by + intro q hq + obtain ⟨_, _, huniq⟩ := hG.existsUnique_path x y + rwa [(huniq q hq).trans (huniq p hp).symm] + +private theorem onTreePath_star_some_some {k : ℕ} {ι : Fin k → Type*} + {T : ∀ i, SimpleGraph (ι i)} {r : ∀ i, ι i} (hT : ∀ i, (T i).IsTree) + {i : Fin k} {u₁ u₂ : ι i} {t : Option (Σ j, ι j)} + (hon : OnTreePath (StarTree T r) (some ⟨i, u₁⟩) (some ⟨i, u₂⟩) t) : + ∃ w : ι i, t = some ⟨i, w⟩ ∧ OnTreePath (T i) u₁ u₂ w := by + obtain ⟨q₀, hq₀, _⟩ := (hT i).existsUnique_path u₁ u₂ + have hmem₀ := hon (q₀.map (starInl T r i)) (hq₀.map (starInl_injective T r i)) + rw [Walk.support_map, List.mem_map] at hmem₀ + obtain ⟨w, _, rfl⟩ := hmem₀ + refine ⟨w, rfl, fun q hq ↦ ?_⟩ + have hmem := hon (q.map (starInl T r i)) (hq.map (starInl_injective T r i)) + rw [Walk.support_map, List.mem_map] at hmem + obtain ⟨w', hw', heq⟩ := hmem + exact starInl_injective T r i heq ▸ hw' + +private theorem onTreePath_star_none_some {k : ℕ} {ι : Fin k → Type*} + {T : ∀ i, SimpleGraph (ι i)} {r : ∀ i, ι i} (hT : ∀ i, (T i).IsTree) + {i : Fin k} {u : ι i} {t : Option (Σ j, ι j)} + (hon : OnTreePath (StarTree T r) none (some ⟨i, u⟩) t) : + t = none ∨ ∃ w : ι i, t = some ⟨i, w⟩ ∧ OnTreePath (T i) (r i) u w := by + have hpath : ∀ (q : (T i).Walk (r i) u), q.IsPath → + (Walk.cons (starTree_adj_none_r T r i) (q.map (starInl T r i))).IsPath := by + intro q hq + rw [Walk.cons_isPath_iff] + refine ⟨hq.map (starInl_injective T r i), ?_⟩ + rw [Walk.support_map, List.mem_map] + rintro ⟨w, _, h⟩ + nomatch h + obtain ⟨q₀, hq₀, _⟩ := (hT i).existsUnique_path (r i) u + have hmem₀ := hon _ (hpath q₀ hq₀) + simp only [Walk.support_cons, Walk.support_map, List.mem_cons, List.mem_map] at hmem₀ + rcases hmem₀ with rfl | ⟨w, _, rfl⟩ + · exact Or.inl rfl + · refine Or.inr ⟨w, rfl, fun q hq ↦ ?_⟩ + have hmem := hon _ (hpath q hq) + simp only [Walk.support_cons, Walk.support_map, List.mem_cons, List.mem_map, + reduceCtorEq, false_or] at hmem + obtain ⟨w', hw', heq⟩ := hmem + exact starInl_injective T r i heq ▸ hw' + +private theorem none_mem_support_of_walk_ne {k : ℕ} {ι : Fin k → Type*} + {T : ∀ i, SimpleGraph (ι i)} {r : ∀ i, ι i} + {i j : Fin k} (hij : i ≠ j) {u₁ : ι i} {u₂ : ι j} + (w : (StarTree T r).Walk (some ⟨i, u₁⟩) (some ⟨j, u₂⟩)) : + none ∈ w.support := by + have haux : ∀ {a b : Option (Σ l, ι l)} (q : (StarTree T r).Walk a b), + none ∉ q.support → ∀ {l : Fin k} (x : ι l), a = some ⟨l, x⟩ → + ∃ y : ι l, b = some ⟨l, y⟩ := by + intro a b q hnot + induction q with + | nil => + intro l x ha + exact ⟨x, ha⟩ + | @cons a a' b hstep q' ih => + intro l x ha + simp only [Walk.support_cons, List.mem_cons, not_or] at hnot + subst ha + rcases a' with _ | ⟨l', x'⟩ + · exact (hnot.2 (Walk.start_mem_support q')).elim + · rcases hstep with ⟨rfl, _⟩ + exact ih hnot.2 x' rfl + by_contra hnot + obtain ⟨y, hy⟩ := haux w hnot u₁ rfl + exact hij (Sigma.mk.inj_iff.1 (Option.some.inj hy)).1.symm + +/-- Star-of-trees gluing lemma for **Graph Minors X, (11.3)**: +gluing tree-decompositions `(T i, τ i)` of `A i ≤ G` around a central bag `τ₀ ≤ G` produces a +tree-decomposition `(StarTree T r, starBag τ₀ τ)` of `G` with the expected vertex designs. -/ +private theorem isTreeDecomposition_starTree {k : ℕ} {ι : Fin k → Type*} [∀ i, Fintype (ι i)] + {G : Hypergraph α β} {A : Fin k → Hypergraph α β} {Z_sub : Fin k → Set α} + {T : ∀ i, SimpleGraph (ι i)} {τ : ∀ i, ι i → Hypergraph α β} {r : ∀ i, ι i} + {τ₀ : Hypergraph α β} + (hA_le : ∀ i, A i ≤ G) (hτ₀_le : τ₀ ≤ G) + (hTD : ∀ i, IsTreeDecomposition (A i) (T i) (τ i)) + (hr_sub : ∀ i, Z_sub i ⊆ (τ i (r i)).vertexSet) + (hZ_sub_eq : ∀ i, τ₀.vertexSet ∩ (A i).vertexSet = Z_sub i) + (hunion_V : τ₀.vertexSet ∪ (⋃ i, (A i).vertexSet) = G.vertexSet) + (hunion_E : τ₀.edgeSet ∪ (⋃ i, (A i).edgeSet) = G.edgeSet) + (hdisj_E0 : ∀ i, Disjoint τ₀.edgeSet (A i).edgeSet) + (hdisj_E : ∀ i j, i ≠ j → Disjoint (A i).edgeSet (A j).edgeSet) + (hinter_V : ∀ i j, i ≠ j → (A i).vertexSet ∩ (A j).vertexSet ⊆ τ₀.vertexSet) : + IsTreeDecomposition G (StarTree T r) (starBag τ₀ τ) ∧ + vertexDesign (StarTree T r) (starBag τ₀ τ) none = (τ₀, Set.range Z_sub) ∧ + (∀ i (u : ι i), u ≠ r i → + vertexDesign (StarTree T r) (starBag τ₀ τ) (some ⟨i, u⟩) = + vertexDesign (T i) (τ i) u) ∧ + (∀ i, + vertexDesign (StarTree T r) (starBag τ₀ τ) (some ⟨i, r i⟩) = + designExtension (vertexDesign (T i) (τ i) (r i)) (Z_sub i)) := by + have hTree : (StarTree T r).IsTree := starTree_isTree fun i ↦ (hTD i).isTree + have hbag_le : ∀ t, starBag τ₀ τ t ≤ G := by + rintro (_ | ⟨i, u⟩) + · exact hτ₀_le + · exact ((hTD i).le u).trans (hA_le i) + have hbag_disj : ∀ ⦃t t'⦄, t ≠ t' → (starBag τ₀ τ t ∩ starBag τ₀ τ t').edgeSet = ∅ := by + rintro (_ | ⟨i, u⟩) (_ | ⟨j, v⟩) hne + · exact (hne rfl).elim + · rw [inter_edgeSet, ← Set.disjoint_iff_inter_eq_empty] + exact (hdisj_E0 j).mono_right ((hTD j).le v).edgeSet_subset + · rw [inter_edgeSet, ← Set.disjoint_iff_inter_eq_empty] + exact (hdisj_E0 i).symm.mono_left ((hTD i).le u).edgeSet_subset + · by_cases hij : i = j + · subst hij + have huv : u ≠ v := fun h ↦ hne (h ▸ rfl) + exact (hTD i).edgeSet_inter_eq huv + · rw [inter_edgeSet, ← Set.disjoint_iff_inter_eq_empty] + exact (hdisj_E i j hij).mono ((hTD i).le u).edgeSet_subset ((hTD j).le v).edgeSet_subset + have hTD_star : IsTreeDecomposition G (StarTree T r) (starBag τ₀ τ) := by + refine ⟨hTree, hbag_le, ?_, hbag_disj, ?_⟩ + · refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (biUnion_le_of_le fun t _ ↦ hbag_le t) le_rfl ?_ ?_ + · rw [← hunion_V] + ext x + simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, true_and, exists_prop, Set.mem_union, + Option.exists, Sigma.exists, starBag] + refine ⟨?_, ?_⟩ + · rintro (hx | ⟨i, u, hx⟩) + · exact Or.inl hx + · exact Or.inr ⟨i, ((hTD i).le u).vertexSet_subset hx⟩ + · rintro (hx | ⟨i, hx⟩) + · exact Or.inl hx + · rw [← (hTD i).biUnion_eq] at hx + simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, true_and, exists_prop] at hx + obtain ⟨u, hu⟩ := hx + exact Or.inr ⟨i, u, hu⟩ + · rw [← hunion_E] + ext e + simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, true_and, exists_prop, Set.mem_union, + Option.exists, Sigma.exists, starBag] + refine ⟨?_, ?_⟩ + · rintro (he | ⟨i, u, he⟩) + · exact Or.inl he + · exact Or.inr ⟨i, ((hTD i).le u).edgeSet_subset he⟩ + · rintro (he | ⟨i, he⟩) + · exact Or.inl he + · rw [← (hTD i).biUnion_eq] at he + simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, true_and, exists_prop] at he + obtain ⟨u, hu⟩ := he + exact Or.inr ⟨i, u, hu⟩ + · -- Helper for path between `none` and `some ⟨i, u⟩`: + have hnone_some : ∀ (i : Fin k) (u : ι i) (t' : Option (Σ l, ι l)), + OnTreePath (StarTree T r) none (some ⟨i, u⟩) t' → + (τ₀ ∩ τ i u).vertexSet ⊆ (starBag τ₀ τ t').vertexSet := by + intro i u t' hon x ⟨hx0, hxu⟩ + rcases onTreePath_star_none_some (fun l ↦ (hTD l).isTree) hon with rfl | ⟨w, rfl, hon_w⟩ + · exact hx0 + · have hxr : x ∈ (τ i (r i)).vertexSet := by + apply hr_sub i + rw [← hZ_sub_eq i] + exact ⟨hx0, ((hTD i).le u).vertexSet_subset hxu⟩ + exact ((hTD i).inter_le hon_w).vertexSet_subset ⟨hxr, hxu⟩ + intro t t' t'' hon + by_cases htt'' : t = t'' + · subst htt'' + have ht' : t' = t := by + have := hon Walk.nil Walk.IsPath.nil + simpa using this + subst ht' + exact ⟨Set.inter_subset_left, Set.inter_subset_left, fun e ⟨he, _⟩ ↦ by + ext v; simp [Hypergraph.ends, inter_inc]⟩ + · refine le_of_edgeSet_eq_empty (hbag_disj htt'') ?_ + rcases t with _ | ⟨i, u₁⟩ <;> rcases t'' with _ | ⟨j, u₂⟩ + · exact (htt'' rfl).elim + · exact hnone_some j u₂ t' hon + · rw [inter_vertexSet, Set.inter_comm] + exact hnone_some i u₁ t' (GraphMinor.TreePath.symm hon) + · by_cases hij : i = j + · subst hij + obtain ⟨w, rfl, hon_w⟩ := + onTreePath_star_some_some (fun l ↦ (hTD l).isTree) hon + exact ((hTD i).inter_le hon_w).vertexSet_subset + · intro x ⟨hx1, hx2⟩ + have hx0 : x ∈ τ₀.vertexSet := + hinter_V i j hij ⟨((hTD i).le u₁).vertexSet_subset hx1, + ((hTD j).le u₂).vertexSet_subset hx2⟩ + classical + obtain ⟨p, hp, _⟩ := hTree.existsUnique_path (some ⟨i, u₁⟩) (some ⟨j, u₂⟩) + have hnone : none ∈ p.support := none_mem_support_of_walk_ne hij p + have ht'_mem : t' ∈ p.support := hon p hp + rw [← Walk.take_spec p hnone, Walk.support_append] at ht'_mem + rcases List.mem_append.1 ht'_mem with ht'1 | ht'2 + · have hon1 : OnTreePath (StarTree T r) (some ⟨i, u₁⟩) none t' := + onTreePath_of_mem_support hTree (hp.takeUntil hnone) ht'1 + exact hnone_some i u₁ t' (GraphMinor.TreePath.symm hon1) ⟨hx0, hx1⟩ + · have hon2 : OnTreePath (StarTree T r) none (some ⟨j, u₂⟩) t' := + onTreePath_of_mem_support hTree (hp.dropUntil hnone) + (List.tail_subset _ ht'2) + exact hnone_some j u₂ t' hon2 ⟨hx0, hx2⟩ + have hroot_inter : ∀ i, (τ₀ ∩ τ i (r i)).vertexSet = Z_sub i := by + intro i + apply Set.Subset.antisymm + · rw [← hZ_sub_eq i] + exact Set.inter_subset_inter_right _ ((hTD i).le (r i)).vertexSet_subset + · refine Set.subset_inter ?_ (hr_sub i) + rw [← hZ_sub_eq i] + exact Set.inter_subset_left + refine ⟨hTD_star, ?_, ?_, ?_⟩ + · -- vertexDesign at `none` + ext : 1 + · rfl + · ext X + simp only [vertexDesign, starBag, Set.mem_ofPred_eq, Set.mem_range, Option.exists, + Sigma.exists] + constructor + · rintro (⟨h, _⟩ | ⟨i, u, rfl : u = r i, rfl⟩) + · exact h.elim + · exact ⟨i, (hroot_inter i).symm⟩ + · rintro ⟨i, rfl⟩ + exact Or.inr ⟨i, r i, rfl, (hroot_inter i).symm⟩ + · -- vertexDesign at `some ⟨i, u⟩` for `u ≠ r i` + intro i u hu + ext : 1 + · rfl + · ext X + simp only [vertexDesign, starBag, Set.mem_ofPred_eq, Option.exists, Sigma.exists] + constructor + · rintro (⟨h : u = r i, _⟩ | ⟨j, v, ⟨rfl, hadj⟩, rfl⟩) + · exact (hu h).elim + · exact ⟨v, hadj, rfl⟩ + · rintro ⟨v, hadj, rfl⟩ + exact Or.inr ⟨i, v, ⟨rfl, hadj⟩, rfl⟩ + · -- vertexDesign at `some ⟨i, r i⟩` + intro i + ext : 1 + · rfl + · ext X + simp only [vertexDesign, designExtension, starBag, Set.mem_ofPred_eq, Set.mem_insert_iff, + Option.exists, Sigma.exists] + constructor + · rintro (⟨_, rfl⟩ | ⟨j, v, ⟨rfl, hadj⟩, rfl⟩) + · left + rw [inter_vertexSet, Set.inter_comm, ← inter_vertexSet, hroot_inter i] + · exact Or.inr ⟨v, hadj, rfl⟩ + · rintro (rfl | ⟨v, hadj, rfl⟩) + · refine Or.inl ⟨rfl, ?_⟩ + rw [inter_vertexSet, Set.inter_comm, ← inter_vertexSet, hroot_inter i] + · exact Or.inr ⟨i, v, ⟨rfl, hadj⟩, rfl⟩ + +/-! ## Proof of Graph Minors X, (11.3) and (11.1) -/ + +private abbrev HasRootedDecomposition (G : Hypergraph α β) + (𝒮 : Set (Design α β)) (Z : Set α) : Prop := + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α β) (r : ι), + IsTreeDecompositionOver G 𝒮 T τ ∧ + Z ⊆ (τ r).vertexSet ∧ designExtension (vertexDesign T τ r) Z ∈ 𝒮 + +private abbrev RootedDecompositionStep (𝒮 : Set (Design α β)) (θ n : ℕ) : Prop := + ∀ (m : ℕ), m < n → ∀ (G : Hypergraph α β) (Z : Set α), + G.vertexSet.ncard = m → IsPervasive G θ 𝒮 → Z ⊆ G.vertexSet → Z.ncard ≤ 3 * θ - 2 → + HasRootedDecomposition G (enlargementClass 𝒮 (3 * θ - 2) ∪ + smallDesignClass (4 * θ - 3)) Z + +private theorem glueRootedDecompositions {𝒮' : Set (Design α β)} + {G' : Hypergraph α β} {Z' : Set α} {k : ℕ} + {A : Fin k → Hypergraph α β} {Z_sub : Fin k → Set α} {τ₀ : Hypergraph α β} : + (∀ i, A i ≤ G') → τ₀ ≤ G' → + (∀ i, ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α β) (r : ι), + IsTreeDecompositionOver (A i) 𝒮' T τ ∧ + Z_sub i ⊆ (τ r).vertexSet ∧ + designExtension (vertexDesign T τ r) (Z_sub i) ∈ 𝒮') → + (∀ i, τ₀.vertexSet ∩ (A i).vertexSet = Z_sub i) → + τ₀.vertexSet ∪ (⋃ i, (A i).vertexSet) = G'.vertexSet → + τ₀.edgeSet ∪ (⋃ i, (A i).edgeSet) = G'.edgeSet → + (∀ i, Disjoint τ₀.edgeSet (A i).edgeSet) → + (∀ i j, i ≠ j → Disjoint (A i).edgeSet (A j).edgeSet) → + (∀ i j, i ≠ j → (A i).vertexSet ∩ (A j).vertexSet ⊆ τ₀.vertexSet) → + Z' ⊆ τ₀.vertexSet → + (τ₀, Set.range Z_sub) ∈ 𝒮' → + designExtension (τ₀, Set.range Z_sub) Z' ∈ 𝒮' → + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α β) (t₀ : ι), + IsTreeDecompositionOver G' 𝒮' T τ ∧ + Z' ⊆ (τ t₀).vertexSet ∧ + designExtension (vertexDesign T τ t₀) Z' ∈ 𝒮' := by + classical + intro hA_le hτ₀_le hex hZ_sub_eq hunion_V hunion_E + hdisj_E0 hdisj_E hinter_V hZ'_sub hdes0 hdes0_ext + choose ι hfin T τ r hTD hr_sub hr_ext using hex + obtain ⟨hTD_star, hdes_none, hdes_ne, hdes_r⟩ := + isTreeDecomposition_starTree hA_le hτ₀_le (fun i ↦ (hTD i).1) hr_sub hZ_sub_eq + hunion_V hunion_E hdisj_E0 hdisj_E hinter_V + have hover_star : IsTreeDecompositionOver G' 𝒮' (StarTree T r) (starBag τ₀ τ) := by + refine ⟨hTD_star, ?_⟩ + rintro (_ | ⟨i, u⟩) + · rw [hdes_none]; exact hdes0 + · by_cases hu : u = r i + · subst hu; rw [hdes_r]; exact hr_ext i + · rw [hdes_ne i u hu]; exact (hTD i).2 u + let e := Fintype.equivFin (Option (Σ i : Fin k, ι i)) + refine ⟨Fin (Fintype.card (Option (Σ i : Fin k, ι i))), inferInstance, + (StarTree T r).map e.toEmbedding, starBag τ₀ τ ∘ e.symm, e none, + hover_star.relabel e, ?_, ?_⟩ + · simpa [starBag] using hZ'_sub + · rw [vertexDesign_map, hdes_none] + exact hdes0_ext + +private theorem rootedDecomposition_of_lowOrderSeparation {G' : Hypergraph α β} {θ n : ℕ} + {𝒮 : Set (Design α β)} {Z'' : Set α} + (hθ : 1 ≤ θ) (hn : G'.vertexSet.ncard = n) (hperv' : IsPervasive G' θ 𝒮) + (hZ''_sub : Z'' ⊆ G'.vertexSet) (hZ''_card : Z''.ncard = 3 * θ - 2) + (ih : RootedDecompositionStep 𝒮 θ n) + {A₁ A₂ : Hypergraph α β} (hsep : G'.IsSeparation A₁ A₂) + (hord : separationOrder A₁ A₂ < θ) + (hcard2 : ((Z'' ∪ A₁.vertexSet) ∩ A₂.vertexSet).ncard ≤ 3 * θ - 3) + (hcard1 : ((Z'' ∪ A₂.vertexSet) ∩ A₁.vertexSet).ncard ≤ 3 * θ - 3) : + HasRootedDecomposition G' + (enlargementClass 𝒮 (3 * θ - 2) ∪ smallDesignClass (4 * θ - 3)) Z'' := by + classical + let 𝒮' : Set (Design α β) := enlargementClass 𝒮 (3 * θ - 2) ∪ smallDesignClass (4 * θ - 3) + let A : Fin 2 → Hypergraph α β := fun i ↦ if i = 0 then A₁ else A₂ + let Z_sub : Fin 2 → Set α := fun i ↦ + if i = 0 then (Z'' ∪ A₂.vertexSet) ∩ A₁.vertexSet + else (Z'' ∪ A₁.vertexSet) ∩ A₂.vertexSet + let τ₀ : Hypergraph α β := + edgelessSubhypergraph G' (Z'' ∪ (A₁ ∩ A₂).vertexSet) + have hτ₀_V : τ₀.vertexSet = Z'' ∪ (A₁ ∩ A₂).vertexSet := + edgelessSubhypergraph_vertexSet G' + (Set.union_subset hZ''_sub + (Set.inter_subset_left.trans hsep.left_le.vertexSet_subset)) + have hA_le : ∀ i, A i ≤ G' := by + intro i; fin_cases i + · exact hsep.left_le + · exact hsep.right_le + have hZ_sub_eq : ∀ i, τ₀.vertexSet ∩ (A i).vertexSet = Z_sub i := by + intro i; fin_cases i + · ext x + simp only [hτ₀_V, A, Z_sub, inter_vertexSet, Fin.zero_eta, ↓reduceIte, + Set.mem_inter_iff, Set.mem_union] + tauto + · ext x + simp only [hτ₀_V, A, Z_sub, inter_vertexSet, Fin.mk_one, one_ne_zero, ↓reduceIte, + Set.mem_inter_iff, Set.mem_union] + tauto + have hex_ind : ∀ i : Fin 2, + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α β) (r : ι), + IsTreeDecompositionOver (A i) 𝒮' T τ ∧ + Z_sub i ⊆ (τ r).vertexSet ∧ + designExtension (vertexDesign T τ r) (Z_sub i) ∈ 𝒮' := by + intro i + have hZi_sub : Z_sub i ⊆ (A i).vertexSet := by + fin_cases i <;> simp [Z_sub, A] + have hZi_card : (Z_sub i).ncard ≤ 3 * θ - 3 := by + fin_cases i + · exact hcard1 + · exact hcard2 + have hAi_lt : (A i).vertexSet.ncard < n := by + rw [← hn] + refine Set.ncard_lt_ncard (Set.ssubset_iff_subset_ne.2 + ⟨(hA_le i).vertexSet_subset, fun hV_eq ↦ ?_⟩) G'.vertexSet_finite + have hZ''_in_Zi : Z'' ⊆ Z_sub i := by + rw [← hZ_sub_eq i, hV_eq, hτ₀_V] + exact Set.subset_inter Set.subset_union_left hZ''_sub + have hZ''_le : Z''.ncard ≤ (Z_sub i).ncard := + Set.ncard_le_ncard hZ''_in_Zi ((A i).vertexSet_finite.subset hZi_sub) + omega + exact ih (A i).vertexSet.ncard hAi_lt (A i) (Z_sub i) rfl + (hperv'.mono (hA_le i)) hZi_sub (by omega) + have hτ₀_card : τ₀.vertexSet.ncard ≤ 4 * θ - 3 := by + rw [hτ₀_V] + have h1 : (Z'' ∪ (A₁ ∩ A₂).vertexSet).ncard ≤ + Z''.ncard + separationOrder A₁ A₂ := Set.ncard_union_le _ _ + omega + have hdes0_isDesign : IsDesign (τ₀, Set.range Z_sub) := by + rintro X ⟨i, rfl⟩ + rw [← hZ_sub_eq i] + exact Set.inter_subset_left + have hdes0_ext_isDesign : IsDesign (designExtension (τ₀, Set.range Z_sub) Z'') := by + rintro X (rfl | ⟨i, rfl⟩) + · change X ⊆ τ₀.vertexSet + rw [hτ₀_V]; exact Set.subset_union_left + · change Z_sub i ⊆ τ₀.vertexSet + rw [← hZ_sub_eq i]; exact Set.inter_subset_left + refine glueRootedDecompositions (𝒮' := 𝒮') hA_le (edgelessSubhypergraph_le G' _) hex_ind + hZ_sub_eq ?_ ?_ ?_ ?_ ?_ + (by rw [hτ₀_V]; exact Set.subset_union_left) + (Or.inr ⟨hdes0_isDesign, hτ₀_card⟩) + (Or.inr ⟨hdes0_ext_isDesign, hτ₀_card⟩) + · have hunion_A : (⋃ i, (A i).vertexSet) = G'.vertexSet := by + rw [← hsep.vertexSet_union] + ext x + simp only [Set.mem_iUnion, Fin.exists_fin_two, A, ↓reduceIte, one_ne_zero, + Set.mem_union] + rw [hunion_A, Set.union_eq_right.2 (edgelessSubhypergraph_le G' _).vertexSet_subset] + · rw [edgelessSubhypergraph_edgeSet, Set.empty_union, ← hsep.edgeSet_union] + ext e + simp only [Set.mem_iUnion, Fin.exists_fin_two, A, ↓reduceIte, one_ne_zero, + Set.mem_union] + · intro i + rw [edgelessSubhypergraph_edgeSet] + exact disjoint_bot_left + · intro i j hij + fin_cases i <;> fin_cases j + · exact (hij rfl).elim + · change Disjoint A₁.edgeSet A₂.edgeSet + exact Set.disjoint_iff_inter_eq_empty.2 hsep.edgeSet_inter_eq + · change Disjoint A₂.edgeSet A₁.edgeSet + exact (Set.disjoint_iff_inter_eq_empty.2 hsep.edgeSet_inter_eq).symm + · exact (hij rfl).elim + · intro i j hij + fin_cases i <;> fin_cases j + · exact (hij rfl).elim + · change (A₁ ∩ A₂).vertexSet ⊆ τ₀.vertexSet + rw [hτ₀_V]; exact Set.subset_union_right + · change A₂.vertexSet ∩ A₁.vertexSet ⊆ τ₀.vertexSet + rw [hτ₀_V, Set.inter_comm]; exact Set.subset_union_right + · exact (hij rfl).elim + +private theorem rootedDecomposition_of_location {G' : Hypergraph α β} {θ n : ℕ} + {𝒮 : Set (Design α β)} {Z'' : Set α} + (hθ : 1 ≤ θ) (hn : G'.vertexSet.ncard = n) (hperv' : IsPervasive G' θ 𝒮) + (hZ''_sub : Z'' ⊆ G'.vertexSet) (hZ''_card : Z''.ncard = 3 * θ - 2) + (ih : RootedDecompositionStep 𝒮 θ n) + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hloc : IsLocation G' ℒ) + (hdes_ℒ : locationDesign G' ℒ ∈ 𝒮) + (hℒ_bound : ∀ p ∈ ℒ, (Z'' ∩ p.1.vertexSet).ncard ≤ separationOrder p.1 p.2 ∧ + separationOrder p.1 p.2 < θ) : + HasRootedDecomposition G' + (enlargementClass 𝒮 (3 * θ - 2) ∪ smallDesignClass (4 * θ - 3)) Z'' := by + classical + let 𝒮' : Set (Design α β) := enlargementClass 𝒮 (3 * θ - 2) ∪ smallDesignClass (4 * θ - 3) + have hℒ_fin : ℒ.Finite := hloc.finite + let k := hℒ_fin.toFinset.card + let eℒ : Fin k ≃ ℒ := + (Finset.equivFin hℒ_fin.toFinset).symm.trans + (Equiv.subtypeEquivRight fun _ ↦ hℒ_fin.mem_toFinset) + let A : Fin k → Hypergraph α β := fun i ↦ (eℒ i).1.1 + let B : Fin k → Hypergraph α β := fun i ↦ (eℒ i).1.2 + let Z_sub : Fin k → Set α := fun i ↦ (Z'' ∪ (B i).vertexSet) ∩ (A i).vertexSet + let H₀ : Hypergraph α β := locationCore G' ℒ + let τ₀ : Hypergraph α β := addVertices G' H₀ Z'' + have hH₀_le : H₀ ≤ G' := locationCore_le fun _ hp ↦ hloc.isSeparation hp + have hτ₀_le : τ₀ ≤ G' := addVertices_le hH₀_le Z'' + have hτ₀_V : τ₀.vertexSet = H₀.vertexSet ∪ Z'' := addVertices_vertexSet hZ''_sub + have hsep_i : ∀ i : Fin k, G'.IsSeparation (A i) (B i) := + fun i ↦ hloc.isSeparation (eℒ i).2 + have hA_le : ∀ i, A i ≤ G' := fun i ↦ (hsep_i i).left_le + have hleft_le_right : ∀ i j : Fin k, i ≠ j → A i ≤ B j := + fun i j hij ↦ hloc.left_le_right (eℒ i).2 (eℒ j).2 + (fun h ↦ hij (eℒ.injective (Subtype.ext h))) + have hH₀_inter_A : ∀ i : Fin k, H₀.vertexSet ∩ (A i).vertexSet = + (A i ∩ B i).vertexSet := by + intro i + ext x + simp only [H₀, locationCore, inter_vertexSet, Set.mem_inter_iff, Set.mem_ofPred_eq] + constructor + · rintro ⟨⟨_, hall⟩, hxA⟩ + exact ⟨hxA, hall (eℒ i).1 (eℒ i).2⟩ + · rintro ⟨hxA, hxB⟩ + refine ⟨⟨(hA_le i).vertexSet_subset hxA, fun p hp ↦ ?_⟩, hxA⟩ + obtain ⟨j, hj⟩ := eℒ.surjective ⟨p, hp⟩ + have hp_eq : p = (eℒ j).1 := congrArg Subtype.val hj.symm + rw [hp_eq] + by_cases hij : i = j + · subst hij; exact hxB + · exact (hleft_le_right i j hij).vertexSet_subset hxA + have hZ_sub_eq : ∀ i, τ₀.vertexSet ∩ (A i).vertexSet = Z_sub i := by + intro i + rw [hτ₀_V, Set.union_inter_distrib_right, hH₀_inter_A i] + ext x + simp only [Z_sub, inter_vertexSet, Set.mem_union, Set.mem_inter_iff] + tauto + have hex_ind : ∀ i : Fin k, + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α β) (r : ι), + IsTreeDecompositionOver (A i) 𝒮' T τ ∧ + Z_sub i ⊆ (τ r).vertexSet ∧ + designExtension (vertexDesign T τ r) (Z_sub i) ∈ 𝒮' := by + intro i + have hZi_sub : Z_sub i ⊆ (A i).vertexSet := Set.inter_subset_right + obtain ⟨hZA_le, hord_lt⟩ : + (Z'' ∩ (A i).vertexSet).ncard ≤ separationOrder (A i) (B i) ∧ + separationOrder (A i) (B i) < θ := hℒ_bound (eℒ i).1 (eℒ i).2 + have hZi_eq : Z_sub i = (Z'' ∩ (A i).vertexSet) ∪ (A i ∩ B i).vertexSet := by + ext x + simp only [Z_sub, inter_vertexSet, Set.mem_inter_iff, Set.mem_union] + tauto + have hZi_card : (Z_sub i).ncard ≤ 3 * θ - 2 := by + have h1 : (Z_sub i).ncard ≤ + (Z'' ∩ (A i).vertexSet).ncard + separationOrder (A i) (B i) := by + rw [hZi_eq] + exact Set.ncard_union_le _ _ + omega + have hAi_lt : (A i).vertexSet.ncard < n := by + rw [← hn] + refine Set.ncard_lt_ncard (Set.ssubset_iff_subset_ne.2 + ⟨(hA_le i).vertexSet_subset, fun hV_eq ↦ ?_⟩) G'.vertexSet_finite + have hZ''_eq : Z'' ∩ (A i).vertexSet = Z'' := by + rw [hV_eq, Set.inter_eq_self_of_subset_left hZ''_sub] + have : Z''.ncard < θ := by + rw [hZ''_eq] at hZA_le + exact hZA_le.trans_lt hord_lt + omega + exact ih (A i).vertexSet.ncard hAi_lt (A i) (Z_sub i) rfl + (hperv'.mono (hA_le i)) hZi_sub hZi_card + have hZi_inter_H₀ : ∀ i : Fin k, Z_sub i ∩ H₀.vertexSet = (A i ∩ B i).vertexSet := by + intro i + have h1 : τ₀.vertexSet ∩ H₀.vertexSet = H₀.vertexSet := by + rw [hτ₀_V] + exact Set.inter_eq_right.2 Set.subset_union_left + calc Z_sub i ∩ H₀.vertexSet + _ = (τ₀.vertexSet ∩ (A i).vertexSet) ∩ H₀.vertexSet := by rw [hZ_sub_eq i] + _ = (τ₀.vertexSet ∩ H₀.vertexSet) ∩ (A i).vertexSet := Set.inter_right_comm _ _ _ + _ = H₀.vertexSet ∩ (A i).vertexSet := by rw [h1] + _ = (A i ∩ B i).vertexSet := hH₀_inter_A i + have hdes_H₀ : IsDesign (locationDesign G' ℒ) := hloc.isDesign_locationDesign + have hdes0_isDesign : IsDesign (τ₀, Set.range Z_sub) := by + rintro X ⟨i, rfl⟩ + rw [← hZ_sub_eq i] + exact Set.inter_subset_left + have hdes0_ext_isDesign : IsDesign (designExtension (τ₀, Set.range Z_sub) Z'') := by + rintro X (rfl | ⟨i, rfl⟩) + · change X ⊆ τ₀.vertexSet + rw [hτ₀_V]; exact Set.subset_union_right + · change Z_sub i ⊆ τ₀.vertexSet + rw [← hZ_sub_eq i]; exact Set.inter_subset_left + have henlarge0 : IsEnlargementVia (locationDesign G' ℒ) (τ₀, Set.range Z_sub) Z'' := + { isDesign := hdes_H₀ + isDesign' := hdes0_isDesign + subset_vertexSet := by change Z'' ⊆ τ₀.vertexSet; rw [hτ₀_V]; exact Set.subset_union_right + le := le_addVertices G' H₀ Z'' + sdiff_subset := by + change τ₀.vertexSet \ H₀.vertexSet ⊆ Z'' + rw [hτ₀_V] + intro x ⟨hx, hnot⟩ + exact hx.resolve_left hnot + edgeSet_subset := subset_rfl + inter_mem := by + rintro X ⟨i, rfl⟩ _ + change Z_sub i ∩ H₀.vertexSet ∈ (locationDesign G' ℒ).2 + rw [hZi_inter_H₀ i] + exact ⟨(eℒ i).1, (eℒ i).2, rfl⟩ } + have henlarge0_ext : IsEnlargementVia (locationDesign G' ℒ) + (designExtension (τ₀, Set.range Z_sub) Z'') Z'' := + { isDesign := hdes_H₀ + isDesign' := hdes0_ext_isDesign + subset_vertexSet := by change Z'' ⊆ τ₀.vertexSet; rw [hτ₀_V]; exact Set.subset_union_right + le := le_addVertices G' H₀ Z'' + sdiff_subset := by + change τ₀.vertexSet \ H₀.vertexSet ⊆ Z'' + rw [hτ₀_V] + intro x ⟨hx, hnot⟩ + exact hx.resolve_left hnot + edgeSet_subset := subset_rfl + inter_mem := by + rintro X (rfl | ⟨i, rfl⟩) hne + · exact (hne rfl).elim + · change Z_sub i ∩ H₀.vertexSet ∈ (locationDesign G' ℒ).2 + rw [hZi_inter_H₀ i] + exact ⟨(eℒ i).1, (eℒ i).2, rfl⟩ } + refine glueRootedDecompositions (𝒮' := 𝒮') hA_le hτ₀_le hex_ind hZ_sub_eq ?_ ?_ ?_ ?_ ?_ + (by rw [hτ₀_V]; exact Set.subset_union_right) + (Or.inl ⟨locationDesign G' ℒ, hdes_ℒ, Z'', hZ''_card.le, henlarge0⟩) + (Or.inl ⟨locationDesign G' ℒ, hdes_ℒ, Z'', hZ''_card.le, henlarge0_ext⟩) + · apply Set.Subset.antisymm + · exact Set.union_subset hτ₀_le.vertexSet_subset + (Set.iUnion_subset fun i ↦ (hA_le i).vertexSet_subset) + · intro x hxG + by_cases hxA : ∃ i : Fin k, x ∈ (A i).vertexSet + · exact Or.inr (Set.mem_iUnion.2 hxA) + · push Not at hxA + left + rw [hτ₀_V] + refine Or.inl ⟨hxG, fun p hp ↦ ?_⟩ + obtain ⟨i, hi⟩ := eℒ.surjective ⟨p, hp⟩ + have hp_eq : p = (eℒ i).1 := congrArg Subtype.val hi.symm + rw [hp_eq] + have hxAB : x ∈ (A i).vertexSet ∪ (B i).vertexSet := + (hsep_i i).vertexSet_union.symm ▸ hxG + exact hxAB.resolve_left (hxA i) + · apply Set.Subset.antisymm + · exact Set.union_subset hτ₀_le.edgeSet_subset + (Set.iUnion_subset fun i ↦ (hA_le i).edgeSet_subset) + · intro e heG + by_cases heA : ∃ i : Fin k, e ∈ (A i).edgeSet + · exact Or.inr (Set.mem_iUnion.2 heA) + · push Not at heA + left + refine ⟨heG, fun p hp ↦ ?_⟩ + obtain ⟨i, hi⟩ := eℒ.surjective ⟨p, hp⟩ + have hp_eq : p = (eℒ i).1 := congrArg Subtype.val hi.symm + rw [hp_eq] + have heAB : e ∈ (A i).edgeSet ∪ (B i).edgeSet := + (hsep_i i).edgeSet_union.symm ▸ heG + exact heAB.resolve_left (heA i) + · intro i + rw [Set.disjoint_iff_inter_eq_empty] + ext e + simp only [τ₀, addVertices_edgeSet, H₀, locationCore, Set.mem_inter_iff, + Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_and] + rintro ⟨_, hall⟩ heA + exact (hsep_i i).notMem_edgeSet_right heA (hall (eℒ i).1 (eℒ i).2) + · intro i j hij + rw [Set.disjoint_iff_inter_eq_empty] + ext e + simp only [Set.mem_inter_iff, Set.mem_empty_iff_false, iff_false, not_and] + intro heAi heAj + exact (hsep_i j).notMem_edgeSet_right heAj + ((hleft_le_right i j hij).edgeSet_subset heAi) + · intro i j hij x ⟨hxAi, hxAj⟩ + rw [hτ₀_V] + refine Or.inl ⟨(hA_le i).vertexSet_subset hxAi, fun p hp ↦ ?_⟩ + obtain ⟨l, hl⟩ := eℒ.surjective ⟨p, hp⟩ + have hp_eq : p = (eℒ l).1 := congrArg Subtype.val hl.symm + rw [hp_eq] + by_cases hil : i = l + · subst hil + exact (hleft_le_right j i hij.symm).vertexSet_subset hxAj + · exact (hleft_le_right i l hil).vertexSet_subset hxAi + +/-- **Graph Minors X, (11.3)** (page 186): +"Let $\mathscr{S}$ be a class of designs, and let $\theta \ge 1$. Let $G$ be a hypergraph +such that $\mathscr{S}$ is $\theta$-pervasive in $G$, and let $Z \subseteq V(G)$ with $|Z| +\le 3\theta - 2$. Then there is a tree-decomposition $(T, \tau)$ of $G$ over +$\mathscr{S}^{3\theta - 2} \cup \mathscr{R}_{4\theta - 3}$, such that for some $t_0 \in +V(T)$, $Z \subseteq V(\tau(t_0))$ and $\mathscr{S}^{3\theta - 2} \cup \mathscr{R}_{4\theta - +3}$ contains the $Z$-extension of the design of $t_0$ in $(T, \tau)$." -/ +theorem theorem_11_3_proof {G : Hypergraph α β} {θ : ℕ} {𝒮 : Set (Design α β)} {Z : Set α} + (hθ : 1 ≤ θ) (hperv : IsPervasive G θ 𝒮) + (hZ_sub : Z ⊆ G.vertexSet) (hZ_card : Z.ncard ≤ 3 * θ - 2) : + let 𝒮' := enlargementClass 𝒮 (3 * θ - 2) ∪ smallDesignClass (4 * θ - 3) + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α β) (t₀ : ι), + IsTreeDecompositionOver G 𝒮' T τ ∧ + Z ⊆ (τ t₀).vertexSet ∧ + designExtension (vertexDesign T τ t₀) Z ∈ 𝒮' := by + classical + let 𝒮' : Set (Design α β) := enlargementClass 𝒮 (3 * θ - 2) ∪ smallDesignClass (4 * θ - 3) + -- Strong induction on `G.vertexSet.ncard`: + suffices hmain : ∀ (n : ℕ) (G' : Hypergraph α β) (Z' : Set α), + G'.vertexSet.ncard = n → + IsPervasive G' θ 𝒮 → Z' ⊆ G'.vertexSet → Z'.ncard ≤ 3 * θ - 2 → + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α β) (t₀ : ι), + IsTreeDecompositionOver G' 𝒮' T τ ∧ + Z' ⊆ (τ t₀).vertexSet ∧ + designExtension (vertexDesign T τ t₀) Z' ∈ 𝒮' from + hmain G.vertexSet.ncard G Z rfl hperv hZ_sub hZ_card + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro G' Z' hn hperv' hZ'_sub hZ'_card + -- First prove the exact case `|Z''| = 3 * θ - 2` for `G'`: + have hexact : ∀ (Z'' : Set α), Z'' ⊆ G'.vertexSet → Z''.ncard = 3 * θ - 2 → + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α β) (t₀ : ι), + IsTreeDecompositionOver G' 𝒮' T τ ∧ + Z'' ⊆ (τ t₀).vertexSet ∧ + designExtension (vertexDesign T τ t₀) Z'' ∈ 𝒮' := by + intro Z'' hZ''_sub hZ''_card + rcases theorem_11_2_proof hθ hperv' hZ''_sub hZ''_card with + ⟨A₁, A₂, hsep, hord, hcard2, hcard1⟩ | ⟨ℒ, hloc, hdes_ℒ, hℒ_bound⟩ + · exact rootedDecomposition_of_lowOrderSeparation hθ hn hperv' hZ''_sub hZ''_card + ih hsep hord hcard2 hcard1 + · exact rootedDecomposition_of_location hθ hn hperv' hZ''_sub hZ''_card + ih hloc hdes_ℒ hℒ_bound + -- Now handle general `|Z'| ≤ 3 * θ - 2`: + by_cases hG'_small : G'.vertexSet.ncard < 3 * θ - 2 + · -- Base case: `|V(G')| < 3 * θ - 2`, 1-vertex tree (`k = 0`) + let A : Fin 0 → Hypergraph α β := Fin.elim0 + let Z_sub : Fin 0 → Set α := Fin.elim0 + have hcard_le : G'.vertexSet.ncard ≤ 4 * θ - 3 := by omega + have hdes0 : IsDesign (G', Set.range Z_sub) := by + rintro X ⟨i, _⟩; exact Fin.elim0 i + have hdes0_ext : IsDesign (designExtension (G', Set.range Z_sub) Z') := by + rintro X (rfl | ⟨i, _⟩) + · exact hZ'_sub + · exact Fin.elim0 i + refine glueRootedDecompositions (𝒮' := 𝒮') (A := A) (Z_sub := Z_sub) (τ₀ := G') + (fun i ↦ Fin.elim0 i) + le_rfl (fun i ↦ Fin.elim0 i) + (fun i ↦ Fin.elim0 i) ?_ ?_ (fun i ↦ Fin.elim0 i) (fun i ↦ Fin.elim0 i) + (fun i ↦ Fin.elim0 i) hZ'_sub + (Or.inr ⟨hdes0, hcard_le⟩) (Or.inr ⟨hdes0_ext, hcard_le⟩) + · simp + · simp + · -- `|V(G')| ≥ 3 * θ - 2`: extend `Z'` to `Z'' ⊆ V(G')` with `|Z''| = 3 * θ - 2` + push Not at hG'_small + obtain ⟨Z'', hZ'_Z'', hZ''_sub, hZ''_card⟩ := + Set.exists_subsuperset_card_eq hZ'_sub hZ'_card hG'_small + obtain ⟨ι₁, hfin₁, T₁, τ₁, r₁, hover₁, hr₁_sub, hr₁_ext⟩ := + hexact Z'' hZ''_sub hZ''_card + let A : Fin 1 → Hypergraph α β := fun _ ↦ G' + let Z_sub : Fin 1 → Set α := fun _ ↦ Z'' + let τ₀ : Hypergraph α β := edgelessSubhypergraph G' Z'' + have hτ₀_V : τ₀.vertexSet = Z'' := edgelessSubhypergraph_vertexSet G' hZ''_sub + have hτ₀_card : τ₀.vertexSet.ncard ≤ 4 * θ - 3 := by + rw [hτ₀_V]; omega + have hdes0 : IsDesign (τ₀, Set.range Z_sub) := by + rintro X ⟨_, rfl⟩ + change Z'' ⊆ τ₀.vertexSet + rw [hτ₀_V] + have hdes0_ext : IsDesign (designExtension (τ₀, Set.range Z_sub) Z') := by + rintro X (rfl | ⟨_, rfl⟩) + · change X ⊆ τ₀.vertexSet + rw [hτ₀_V]; exact hZ'_Z'' + · change Z'' ⊆ τ₀.vertexSet + rw [hτ₀_V] + refine glueRootedDecompositions (𝒮' := 𝒮') (A := A) (Z_sub := Z_sub) (τ₀ := τ₀) + (fun _ ↦ le_rfl) (edgelessSubhypergraph_le G' Z'') + (fun _ ↦ ⟨ι₁, hfin₁, T₁, τ₁, r₁, hover₁, hr₁_sub, hr₁_ext⟩) + (fun _ ↦ by rw [hτ₀_V]; exact Set.inter_eq_self_of_subset_left hZ''_sub) + ?_ ?_ + (fun _ ↦ by rw [edgelessSubhypergraph_edgeSet]; exact disjoint_bot_left) + (fun i j hij ↦ (hij (Subsingleton.elim i j)).elim) + (fun i j hij ↦ (hij (Subsingleton.elim i j)).elim) + (by rwa [hτ₀_V]) + (Or.inr ⟨hdes0, hτ₀_card⟩) + (Or.inr ⟨hdes0_ext, hτ₀_card⟩) + · dsimp only [A] + rw [hτ₀_V, Set.iUnion_const, Set.union_eq_self_of_subset_left hZ''_sub] + · dsimp only [A] + rw [edgelessSubhypergraph_edgeSet, Set.iUnion_const, Set.empty_union] + +/-- **Graph Minors X, (11.1)** (page 185): +"For any $\theta \ge 1$, let $\mathscr{S}$ be a class of designs which is $\theta$-pervasive +in a hypergraph $G$; then $G$ has a tree-decomposition over $\mathscr{S}^{3\theta - 2} \cup +\mathscr{R}_{4\theta - 3}$." -/ +theorem theorem_11_1_proof {G : Hypergraph α β} {θ : ℕ} {𝒮 : Set (Design α β)} + (hθ : 1 ≤ θ) (hperv : IsPervasive G θ 𝒮) : + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α β), + IsTreeDecompositionOver G + (enlargementClass 𝒮 (3 * θ - 2) ∪ smallDesignClass (4 * θ - 3)) T τ := by + obtain ⟨ι, hfin, T, τ, _, hover, _, _⟩ := + theorem_11_3_proof hθ hperv (Set.empty_subset G.vertexSet) (by simp) + exact ⟨ι, hfin, T, τ, hover⟩ + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/Section12.lean b/LeanPool/GraphMinor/GM10/Section12.lean new file mode 100644 index 0000000000..181ec27840 --- /dev/null +++ b/LeanPool/GraphMinor/GM10/Section12.lean @@ -0,0 +1,381 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Defs2 +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM10.Section8 +import Mathlib.Combinatorics.Matroid.IndepAxioms + +/-! +# Graph Minors X, Section 12: Tangles and Matroids + +This file formalizes Section 12 ("Tangles and Matroids", pages 188–190) of Robertson and Seymour, +*Graph Minors. X. Obstructions to Tree-Decomposition*, J. Combin. Theory Ser. B **52** (1991), +153–190: + +- **(12.1) (`theorem_12_1`, page 188):** for any tangle `𝒯` of order `θ` in a hypergraph `G`, the + tangle rank function `r(X) = tangleRank 𝒯 θ X` satisfies the matroid rank axioms on `V(G)` + (`IsMatroidRankOn G.vertexSet (tangleRank 𝒯 θ)`). +- **(12.2) (`theorem_12_2`, page 189):** the free sets (`IsFreeSet G 𝒯 θ`) are the independent sets + of a matroid (`tangleMatroid G h𝒯`) on `V(G)` with rank function `tangleRank 𝒯 θ`. +-/ + +namespace GraphMinor.GM10 + +open Hypergraph Set Matroid +open scoped Sym2 + +variable {α β : Type*} + +public section + +/-! ## Basic Properties of `tangleRank` -/ + +/-- If `(A, B) ∈ 𝒯` and `X ⊆ V(A)`, then `tangleRank 𝒯 θ X ≤ separationOrder A B` +(Graph Minors X, Section 12, page 188). -/ +theorem tangleRank_le_separationOrder {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + {X : Set α} {A B : Hypergraph α β} (hAB : (A, B) ∈ 𝒯) (hX : X ⊆ A.vertexSet) : + tangleRank 𝒯 θ X ≤ separationOrder A B := by + classical + have hex : ∃ p ∈ 𝒯, X ⊆ p.1.vertexSet := ⟨(A, B), hAB, hX⟩ + rw [tangleRank, ite_eq_left hex] + exact Nat.sInf_le ⟨(A, B), hAB, hX, rfl⟩ + +/-- For any tangle `𝒯` of order `θ` in `G` and any set `X`, `tangleRank 𝒯 θ X ≤ θ` +(Graph Minors X, Section 12, page 189). -/ +theorem tangleRank_le_order {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) (X : Set α) : + tangleRank 𝒯 θ X ≤ θ := by + classical + by_cases hex : ∃ p ∈ 𝒯, X ⊆ p.1.vertexSet + · rcases hex with ⟨⟨A, B⟩, hAB, hX⟩ + exact (tangleRank_le_separationOrder hAB hX).trans (h𝒯.order_lt hAB).le + · rw [tangleRank, ite_eq_right hex] + +/-- If `tangleRank 𝒯 θ X < θ`, then there exists `(A, B) ∈ 𝒯` with `X ⊆ V(A)` and +`separationOrder A B = tangleRank 𝒯 θ X` (Graph Minors X, Section 12, page 189). -/ +theorem exists_mem_of_tangleRank_lt {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + {X : Set α} (hlt : tangleRank 𝒯 θ X < θ) : + ∃ A B : Hypergraph α β, (A, B) ∈ 𝒯 ∧ X ⊆ A.vertexSet ∧ + separationOrder A B = tangleRank 𝒯 θ X := by + classical + by_cases hex : ∃ p ∈ 𝒯, X ⊆ p.1.vertexSet + · have hne : {k : ℕ | ∃ p ∈ 𝒯, X ⊆ p.1.vertexSet ∧ separationOrder p.1 p.2 = k}.Nonempty := by + rcases hex with ⟨p, hp, hX⟩ + exact ⟨separationOrder p.1 p.2, p, hp, hX, rfl⟩ + obtain ⟨⟨A, B⟩, hAB, hX, hord⟩ := Nat.sInf_mem hne + refine ⟨A, B, hAB, hX, ?_⟩ + rw [tangleRank, ite_eq_left hex] + exact hord + · rw [tangleRank, ite_eq_right hex] at hlt + exact (lt_irrefl θ hlt).elim + +/-- Monotonicity of `tangleRank`: if `X ⊆ Y`, then `tangleRank 𝒯 θ X ≤ tangleRank 𝒯 θ Y` +(Graph Minors X, Section 12, (12.1)(iii), page 189). -/ +theorem tangleRank_mono {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {X Y : Set α} (hXY : X ⊆ Y) : + tangleRank 𝒯 θ X ≤ tangleRank 𝒯 θ Y := by + by_cases hlt : tangleRank 𝒯 θ Y < θ + · obtain ⟨A, B, hAB, hY, hord⟩ := exists_mem_of_tangleRank_lt hlt + rw [← hord] + exact tangleRank_le_separationOrder hAB (hXY.trans hY) + · push Not at hlt + exact (tangleRank_le_order h𝒯 X).trans hlt + +/-! ## Proof of Graph Minors X, (12.1) -/ + +/-- For `X ⊆ V(G)`, the edgeless subhypergraph `K` with `V(K) = X` and `E(K) = ∅` forms a +separation `(K, G)` of `G` of order `|X|` (Graph Minors X, Section 12, proof of (12.1), page 189). +-/ +private def edgelessSub (G : Hypergraph α β) (X : Set α) (hX : X ⊆ G.vertexSet) : + Hypergraph α β where + vertexSet := X + edgeSet := ∅ + Inc _ _ := False + vertex_mem_of_inc _ _ h := h.elim + edge_mem_of_inc _ _ h := h.elim + vertexSet_finite := G.vertexSet_finite.subset hX + edgeSet_finite := finite_empty + +private lemma isSeparation_edgelessSub (G : Hypergraph α β) {X : Set α} (hX : X ⊆ G.vertexSet) : + G.IsSeparation (edgelessSub G X hX) G := by + have hle : edgelessSub G X hX ≤ G := + ⟨hX, empty_subset _, fun _ he ↦ he.elim⟩ + rw [isSeparation_iff_of_le hle le_rfl] + refine ⟨?_, ?_, ?_⟩ + · change X ∪ G.vertexSet = G.vertexSet + exact union_eq_right.2 hX + · change ∅ ∪ G.edgeSet = G.edgeSet + exact empty_union _ + · change ∅ ∩ G.edgeSet = ∅ + exact empty_inter _ + +private lemma separationOrder_edgelessSub (G : Hypergraph α β) {X : Set α} (hX : X ⊆ G.vertexSet) : + separationOrder (edgelessSub G X hX) G = X.ncard := by + unfold separationOrder + have hinter : (edgelessSub G X hX ∩ G).vertexSet = X := by + change X ∩ G.vertexSet = X + exact inter_eq_left.2 hX + rw [hinter] + +/-- **Graph Minors X, (12.1)** (pages 188–189): +"Let $\mathscr{T}$ be a tangle in a hypergraph $G$, of order $\theta$. For $X \subseteq +V(G)$, let us define $r(X)$ to be the least order of a separation $(A, B) \in \mathscr{T}$ +with $X \subseteq V(A)$, if one exists, and $\theta$ otherwise. (12.1) *$r$ is the rank +function of a matroid on $V(G)$." -/ +theorem theorem_12_1_proof (G : Hypergraph α β) {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) : + IsMatroidRankOn G.vertexSet (tangleRank 𝒯 θ) where + le_ncard := by + intro X hX + -- Follow the paper (page 189): "Since `r(X) ≤ θ`, we may assume that `|X| < θ`. Let `K` be the + -- hypergraph with `V(K) = X`, `E(K) = ∅`. Since `(G, K) ∉ 𝒯` and has order `< θ`, it follows + -- that `(K, G) ∈ 𝒯`, and so `r(X) ≤ |V(K ∩ G)| ≤ |X|`." + by_cases hcard : X.ncard < θ + · let K := edgelessSub G X hX + have hsep : G.IsSeparation K G := isSeparation_edgelessSub G hX + have hord : separationOrder K G < θ := by + rwa [separationOrder_edgelessSub G hX] + have hGK_not : (G, K) ∉ 𝒯 := fun hGK ↦ h𝒯.axiom3 hGK rfl + have hKG : (K, G) ∈ 𝒯 := (h𝒯.axiom1 hsep hord).resolve_right hGK_not + have hle := tangleRank_le_separationOrder (θ := θ) hKG (Subset.rfl : X ⊆ K.vertexSet) + rwa [separationOrder_edgelessSub G hX] at hle + · push Not at hcard + exact (tangleRank_le_order h𝒯 X).trans hcard + mono := fun _ _ hXY _ ↦ tangleRank_mono h𝒯 hXY + submodular := by + intro X Y _ _ + -- Follow the paper (page 189): "Since `r(X ∩ Y) ≤ r(Y)` and `r(X ∪ Y) ≤ θ`, we may assume + -- that `r(X) < θ` and similarly `r(Y) < θ`." + by_cases hrX : tangleRank 𝒯 θ X < θ + · by_cases hrY : tangleRank 𝒯 θ Y < θ + · obtain ⟨A, B, hAB, hXA, hordAB⟩ := exists_mem_of_tangleRank_lt hrX + obtain ⟨C, D, hCD, hYC, hordCD⟩ := exists_mem_of_tangleRank_lt hrY + have hsepAB := h𝒯.isSeparation hAB + have hsepCD := h𝒯.isSeparation hCD + -- "We claim that `r(X ∩ Y)` is at most the order of `(A ∩ C, B ∪ D)`; for this is true if + -- `(A ∩ C, B ∪ D)` has order `≥ θ`, and otherwise `(A ∩ C, B ∪ D) ∈ 𝒯`, and the claim + -- follows since `X ∩ Y ⊆ V(A ∩ C)`." + have h_inter : tangleRank 𝒯 θ (X ∩ Y) ≤ separationOrder (A ∩ C) (B ∪ D) := by + by_cases hord : separationOrder (A ∩ C) (B ∪ D) < θ + · have hsep_inter : G.IsSeparation (A ∩ C) (B ∪ D) := + (hsepAB.symm.union_inter hsepCD.symm).symm + have hmem_inter : (A ∩ C, B ∪ D) ∈ 𝒯 := + theorem_2_9_case_1 h𝒯 hAB hsep_inter hord subset_union_left + exact tangleRank_le_separationOrder hmem_inter (inter_subset_inter hXA hYC) + · push Not at hord + exact (tangleRank_le_order h𝒯 (X ∩ Y)).trans hord + -- "Similarly, `r(X ∪ Y)` is at most the order of `(A ∪ C, B ∩ D)`, by (2.2)." + have h_union : tangleRank 𝒯 θ (X ∪ Y) ≤ separationOrder (A ∪ C) (B ∩ D) := by + by_cases hord : separationOrder (A ∪ C) (B ∩ D) < θ + · have hmem_union : (A ∪ C, B ∩ D) ∈ 𝒯 := + theorem_2_2_proof h𝒯 hAB hCD hord + exact tangleRank_le_separationOrder hmem_union (union_subset_union hXA hYC) + · push Not at hord + exact (tangleRank_le_order h𝒯 (X ∪ Y)).trans hord + -- "Since the sum of the orders of `(A, B)` and `(C, D)` equals the sum of the order of + -- `(A ∩ C, B ∪ D)` and `(A ∪ C, B ∩ D)`, the result follows." + have hsum := separationOrder_add_separationOrder hsepAB hsepCD + omega + · push Not at hrY + have h1 : tangleRank 𝒯 θ (X ∪ Y) ≤ tangleRank 𝒯 θ Y := + (tangleRank_le_order h𝒯 (X ∪ Y)).trans hrY + have h2 : tangleRank 𝒯 θ (X ∩ Y) ≤ tangleRank 𝒯 θ X := + tangleRank_mono h𝒯 inter_subset_left + omega + · push Not at hrX + have h1 : tangleRank 𝒯 θ (X ∪ Y) ≤ tangleRank 𝒯 θ X := + (tangleRank_le_order h𝒯 (X ∪ Y)).trans hrX + have h2 : tangleRank 𝒯 θ (X ∩ Y) ≤ tangleRank 𝒯 θ Y := + tangleRank_mono h𝒯 inter_subset_right + omega + +/-! ## Proof of Graph Minors X, (12.2) -/ + +/-- A subset `X` is free with respect to `𝒯` if and only if `X ⊆ V(G)` and +`tangleRank 𝒯 θ X = X.ncard` (Graph Minors X, Section 12, page 189). -/ +theorem isFreeSet_iff_tangleRank_eq {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) {X : Set α} : + IsFreeSet G 𝒯 θ X ↔ X ⊆ G.vertexSet ∧ tangleRank 𝒯 θ X = X.ncard := by + have hmat := theorem_12_1_proof G h𝒯 + constructor + · rintro ⟨hX, hXθ, hfree⟩ + refine ⟨hX, le_antisymm (hmat.le_ncard hX) ?_⟩ + by_cases hlt : tangleRank 𝒯 θ X < θ + · obtain ⟨A, B, hAB, hXA, hord⟩ := exists_mem_of_tangleRank_lt hlt + rw [← hord] + exact hfree hAB hXA + · push Not at hlt + exact hXθ.trans hlt + · rintro ⟨hX, hr⟩ + refine ⟨hX, ?_, ?_⟩ + · rw [← hr] + exact tangleRank_le_order h𝒯 X + · intro A B hAB hXA + rw [← hr] + exact tangleRank_le_separationOrder hAB hXA + +/-- Submodular closure lemma for `IsMatroidRankOn`: if `I ⊆ E`, `S` is a finite subset of `E \ I`, +and `r (insert e I) ≤ r I` for every `e ∈ S`, then `r (I ∪ S) ≤ r I`. -/ +private lemma rank_union_le_of_forall_insert_le {E : Set α} {r : Set α → ℕ} + (hr : IsMatroidRankOn E r) {I S : Set α} (hI : I ⊆ E) (hS_fin : S.Finite) + (hS : S ⊆ E \ I) (hins : ∀ e ∈ S, r (insert e I) ≤ r I) : + r (I ∪ S) ≤ r I := by + induction S, hS_fin using Set.Finite.induction_on with + | empty => simp + | @insert a s ha_notMem _ ih => + have haE : a ∈ E ∧ a ∉ I := hS (mem_insert a s) + have hs_sub : s ⊆ E \ I := (subset_insert a s).trans hS + have ih' : r (I ∪ s) ≤ r I := ih hs_sub (fun e he ↦ hins e (mem_insert_of_mem a he)) + have ha_le : r (insert a I) ≤ r I := hins a (mem_insert a s) + have hIs_sub : I ∪ s ⊆ E := union_subset hI (hs_sub.trans sdiff_subset) + have haI_sub : insert a I ⊆ E := insert_subset haE.1 hI + have hsubmod := hr.submodular hIs_sub haI_sub + have hunion : (I ∪ s) ∪ insert a I = I ∪ insert a s := by + ext x + simp only [mem_union, mem_insert_iff] + tauto + have hinter : (I ∪ s) ∩ insert a I = I := by + ext x + simp only [mem_inter_iff, mem_union, mem_insert_iff] + constructor + · rintro ⟨hxI | hxs, rfl | hxI⟩ + · exact hxI + · exact hxI + · exact (ha_notMem hxs).elim + · exact hxI + · intro hxI + exact ⟨Or.inl hxI, Or.inr hxI⟩ + rw [hunion, hinter] at hsubmod + omega + +/-- The empty set is free with respect to any tangle `𝒯` in `G` (Graph Minors X, Section 12, +page 189). -/ +theorem isFreeSet_empty (G : Hypergraph α β) (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (θ : ℕ) : IsFreeSet G 𝒯 θ ∅ := + ⟨empty_subset _, by simp, fun _ _ _ _ ↦ by simp⟩ + +/-- Any subset of a free set is free (Graph Minors X, Section 12, (12.2), page 189). -/ +theorem IsFreeSet.subset {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {I J : Set α} (hJ : IsFreeSet G 𝒯 θ J) (hIJ : I ⊆ J) : + IsFreeSet G 𝒯 θ I := by + have hr := theorem_12_1_proof G h𝒯 + rw [isFreeSet_iff_tangleRank_eq h𝒯] at hJ ⊢ + rcases hJ with ⟨hJE, hrJ⟩ + have hIE : I ⊆ G.vertexSet := hIJ.trans hJE + refine ⟨hIE, ?_⟩ + have hdiffE : J \ I ⊆ G.vertexSet := sdiff_subset.trans hJE + have hsubmod := hr.submodular hIE hdiffE + rw [union_sdiff_cancel hIJ, inter_sdiff_self] at hsubmod + have hrI_le : tangleRank 𝒯 θ I ≤ I.ncard := hr.le_ncard hIE + have hr_diff_le : tangleRank 𝒯 θ (J \ I) ≤ (J \ I).ncard := hr.le_ncard hdiffE + have hJ_fin : J.Finite := G.vertexSet_finite.subset hJE + have hcard_add : I.ncard + (J \ I).ncard = J.ncard := by + have h := ncard_sdiff_add_ncard_of_subset hIJ hJ_fin + omega + omega + +/-- Augmentation property for free sets (Graph Minors X, Section 12, (12.2), page 189). -/ +theorem IsFreeSet.augment {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {I J : Set α} (hI : IsFreeSet G 𝒯 θ I) (hJ : IsFreeSet G 𝒯 θ J) (hlt : I.ncard < J.ncard) : + ∃ e ∈ J, e ∉ I ∧ IsFreeSet G 𝒯 θ (insert e I) := by + have hr := theorem_12_1_proof G h𝒯 + rw [isFreeSet_iff_tangleRank_eq h𝒯] at hI hJ + rcases hI with ⟨hIE, hrI⟩ + rcases hJ with ⟨hJE, hrJ⟩ + by_contra! hnot + have hins : ∀ e ∈ J \ I, tangleRank 𝒯 θ (insert e I) ≤ tangleRank 𝒯 θ I := by + intro e ⟨heJ, heI⟩ + have heE : insert e I ⊆ G.vertexSet := insert_subset (hJE heJ) hIE + have hnot_free : ¬ IsFreeSet G 𝒯 θ (insert e I) := hnot e heJ heI + rw [isFreeSet_iff_tangleRank_eq h𝒯, not_and] at hnot_free + have hne : tangleRank 𝒯 θ (insert e I) ≠ (insert e I).ncard := hnot_free heE + have hle : tangleRank 𝒯 θ (insert e I) ≤ (insert e I).ncard := hr.le_ncard heE + have hcard_ins : (insert e I).ncard = I.ncard + 1 := + ncard_insert_of_notMem heI (G.vertexSet_finite.subset hIE) + omega + have hJ_diff_fin : (J \ I).Finite := (G.vertexSet_finite.subset hJE).sdiff + have hJ_diff_sub : J \ I ⊆ G.vertexSet \ I := sdiff_subset_sdiff_left hJE + have h_union_le : tangleRank 𝒯 θ (I ∪ (J \ I)) ≤ tangleRank 𝒯 θ I := + rank_union_le_of_forall_insert_le hr hIE hJ_diff_fin hJ_diff_sub hins + have hJ_sub : J ⊆ I ∪ (J \ I) := by + rw [union_sdiff_self] + exact subset_union_right + have hJ_le : tangleRank 𝒯 θ J ≤ tangleRank 𝒯 θ (I ∪ (J \ I)) := + hr.mono hJ_sub (union_subset hIE (sdiff_subset.trans hJE)) + omega + +/-- The matroid on `V(G)` whose independent sets are the free sets with respect to a tangle `𝒯` of +order `θ` in `G` (Graph Minors X, Section 12, (12.2), page 189). -/ +noncomputable def tangleMatroid (G : Hypergraph α β) {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) : Matroid α := + (IndepMatroid.ofFinite G.vertexSet_finite (IsFreeSet G 𝒯 θ) + (isFreeSet_empty G 𝒯 θ) + (fun _ _ hJ hIJ ↦ hJ.subset h𝒯 hIJ) + (fun _ _ hI hJ hlt ↦ hI.augment h𝒯 hJ hlt) + (fun _ hI ↦ hI.1)).matroid + +theorem tangleMatroid_E (G : Hypergraph α β) {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) : + (tangleMatroid G h𝒯).E = G.vertexSet := by rfl + +theorem tangleMatroid_indep_iff (G : Hypergraph α β) {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) {I : Set α} : + (tangleMatroid G h𝒯).Indep I ↔ IsFreeSet G 𝒯 θ I := by rfl + +/-- The rank function of `tangleMatroid G h𝒯` on subsets of `V(G)` agrees with `tangleRank 𝒯 θ` +(Graph Minors X, Section 12, (12.2), page 189). -/ +theorem tangleMatroid_eRk (G : Hypergraph α β) {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {X : Set α} (hX : X ⊆ G.vertexSet) : + (tangleMatroid G h𝒯).eRk X = tangleRank 𝒯 θ X := by + have hr := theorem_12_1_proof G h𝒯 + obtain ⟨I, hI⟩ := (tangleMatroid G h𝒯).exists_isBasis X + have hIX : I ⊆ X := hI.subset + have hIE : I ⊆ G.vertexSet := hIX.trans hX + have hI_free : IsFreeSet G 𝒯 θ I := hI.indep + have hrI : tangleRank 𝒯 θ I = I.ncard := ((isFreeSet_iff_tangleRank_eq h𝒯).1 hI_free).2 + have hI_le_X : tangleRank 𝒯 θ I ≤ tangleRank 𝒯 θ X := hr.mono hIX hX + have hins : ∀ e ∈ X \ I, tangleRank 𝒯 θ (insert e I) ≤ tangleRank 𝒯 θ I := by + intro e he + have hdep : (tangleMatroid G h𝒯).Dep (insert e I) := hI.insert_dep he + have hnot_indep : ¬ IsFreeSet G 𝒯 θ (insert e I) := hdep.not_indep + have heE : insert e I ⊆ G.vertexSet := insert_subset (hX he.1) hIE + rw [isFreeSet_iff_tangleRank_eq h𝒯, not_and] at hnot_indep + have hne : tangleRank 𝒯 θ (insert e I) ≠ (insert e I).ncard := hnot_indep heE + have hle : tangleRank 𝒯 θ (insert e I) ≤ (insert e I).ncard := hr.le_ncard heE + have hcard_ins : (insert e I).ncard = I.ncard + 1 := + ncard_insert_of_notMem he.2 (G.vertexSet_finite.subset hIE) + omega + have hX_le_I : tangleRank 𝒯 θ X ≤ tangleRank 𝒯 θ I := by + have h := rank_union_le_of_forall_insert_le hr hIE + ((G.vertexSet_finite.subset hX).sdiff) (sdiff_subset_sdiff_left hX) hins + rwa [union_sdiff_cancel hIX] at h + have hr_eq : tangleRank 𝒯 θ X = I.ncard := by omega + rw [← hI.encard_eq_eRk, hr_eq, (G.vertexSet_finite.subset hIE).cast_ncard_eq] + +/-- **Graph Minors X, (12.2)** (page 189): +"The free sets are the independent sets of a matroid on $V(G)$ with rank function $r$ as in +(12.1)." -/ +theorem theorem_12_2_proof (G : Hypergraph α β) {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) : + ∃ M : Matroid α, M.E = G.vertexSet ∧ + (∀ I : Set α, M.Indep I ↔ IsFreeSet G 𝒯 θ I) ∧ + (∀ X : Set α, X ⊆ G.vertexSet → M.eRk X = tangleRank 𝒯 θ X) := + ⟨tangleMatroid G h𝒯, tangleMatroid_E G h𝒯, + fun _ ↦ tangleMatroid_indep_iff G h𝒯, + fun _ hX ↦ tangleMatroid_eRk G h𝒯 hX⟩ + +end + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/Section6.lean b/LeanPool/GraphMinor/GM10/Section6.lean new file mode 100644 index 0000000000..de3ca25ad9 --- /dev/null +++ b/LeanPool/GraphMinor/GM10/Section6.lean @@ -0,0 +1,847 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Defs2 +import LeanPool.GraphMinor.GM10.TangleLemmas +import Mathlib.Combinatorics.SimpleGraph.Acyclic + +/-! +# Circuits and New Tangles from Old (Graph Minors X, (2.10) and Section 6) + +This file formalizes (2.10) and Section 6 of Graph Minors X (pages 158–159 and 170–171): +- `theorem_2_10_claim_1` and `theorem_2_10`: **Graph Minors X, (2.10)** (pages 158–159). +- `subset_iff_truncation` and `subset_iff_exists_truncation`: two tangles in `G` satisfy + `𝒯' ⊆ 𝒯` if and only if `𝒯'` is a truncation of `𝒯` (Graph Minors X, Section 6, page 170). +- `theorem_6_1`: **Graph Minors X, (6.1)** (page 170), the tangle in `G` induced by a tangle in a + minor `H` of `G`. +- `theorem_6_2`: **Graph Minors X, (6.2)** (page 171), the tangle `𝒯 / W` in `G / W` of order + `θ - |W|`. +- `theorem_6_3`: **Graph Minors X, (6.3)** (page 171), characterizing when `(A / W, B / W) ∈ 𝒯 / W`. +-/ + +public section + +namespace GraphMinor.GM10 + +open Graph SimpleGraph Hypergraph Relation + +variable {α β : Type*} + +/-! ## Graph Minors X, (2.10) -/ + +/-- Claim (1) in the proof of **Graph Minors X, (2.10)** (page 159): +"There is no separation $(B_1, B_2)$ of $B$ of order $\le 1$ with $v_1\in V(B_1) - V(B_2)$ +and $v_2\in V(B_2) - V(B_1)$." -/ +theorem theorem_2_10_claim_1 {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {A B : Hypergraph α β} (hext : IsExtreme 𝒯 A B) + {v₁ v₂ : α} (hv₁ : v₁ ∈ (A ∩ B).vertexSet) (hv₂ : v₂ ∈ (A ∩ B).vertexSet) + {B₁ B₂ : Hypergraph α β} (hB : B.IsSeparation B₁ B₂) + (h₁ : v₁ ∈ B₁.vertexSet \ B₂.vertexSet) (h₂ : v₂ ∈ B₂.vertexSet \ B₁.vertexSet) : + 2 ≤ separationOrder B₁ B₂ := by + have hB₁_ne_B : B₁ ≠ B := fun h ↦ h₂.2 (h ▸ hv₂.2) + have hB₂_ne_B : B₂ ≠ B := fun h ↦ h₁.2 (h ▸ hv₁.2) + rcases theorem_2_8_separation h𝒯 hext hB with ⟨_, h⟩ | ⟨_, h⟩ | hlt + · exact (hB₂_ne_B h).elim + · exact (hB₁_ne_B h).elim + · have h1 : 1 ≤ (A ∩ B₁).vertexSet.ncard := by + have : {v₁} ⊆ (A ∩ B₁).vertexSet := Set.singleton_subset_iff.2 ⟨hv₁.1, h₁.1⟩ + simpa using Set.ncard_le_ncard this (A ∩ B₁).vertexSet_finite + have h2 : 1 ≤ (A ∩ B₂).vertexSet.ncard := by + have : {v₂} ⊆ (A ∩ B₂).vertexSet := Set.singleton_subset_iff.2 ⟨hv₂.1, h₂.1⟩ + simpa using Set.ncard_le_ncard this (A ∩ B₂).vertexSet_finite + omega + +/-- Monotonicity of `HasCircuit` under subhypergraph inclusion. -/ +theorem HasCircuit.mono {H G : Hypergraph α β} (hle : H ≤ G) (h : HasCircuit H) : + HasCircuit G := by + rcases h with ⟨e, he, hcard⟩ | ⟨e₁, he₁, e₂, he₂, hne, hcard⟩ | hacyc + · exact Or.inl ⟨e, hle.edgeSet_subset he, by rwa [hle.ends_eq e he]⟩ + · exact Or.inr (Or.inl ⟨e₁, hle.edgeSet_subset he₁, e₂, hle.edgeSet_subset he₂, hne, + by rwa [hle.ends_eq e₁ he₁, hle.ends_eq e₂ he₂]⟩) + · refine Or.inr (Or.inr fun hG_acyc ↦ hacyc ?_) + have hskel_le : H.skeleton ≤ G.skeleton := by + intro x y ⟨hxy, e, hx, hy⟩ + exact ⟨hxy, e, inc_of_le hle hx, inc_of_le hle hy⟩ + exact hG_acyc.anti hskel_le + +private lemma walk_support_subset_vertexSet {G : Hypergraph α β} {u v : α} + (w : G.skeleton.Walk u v) (hu : u ∈ G.vertexSet) : + ∀ z ∈ w.support, z ∈ G.vertexSet := + Hypergraph.skeleton_walk_support_subset_vertexSet w hu + +private def reachableAvoidingVertex (G : Hypergraph α β) (v₁ : α) (S : Set α) : Set α := + {u | ∃ w : G.skeleton.Walk v₁ u, ∀ z ∈ w.support, z ∉ S} + +private lemma exists_separation_of_vertex_separator {B : Hypergraph α β} {v₁ v₂ : α} {S : Set α} + (hv₁ : v₁ ∈ B.vertexSet) (hv₂ : v₂ ∈ B.vertexSet) (hS_sub : S ⊆ B.vertexSet) + (hv₁S : v₁ ∉ S) (hv₂S : v₂ ∉ S) + (hsep_walk : ∀ p : B.skeleton.Path v₁ v₂, ∃ z ∈ p.1.support, z ∈ S) : + ∃ B₁ B₂ : Hypergraph α β, + B.IsSeparation B₁ B₂ ∧ + v₁ ∈ B₁.vertexSet \ B₂.vertexSet ∧ + v₂ ∈ B₂.vertexSet \ B₁.vertexSet ∧ + separationOrder B₁ B₂ = S.ncard := by + classical + let R := reachableAvoidingVertex B v₁ S + have hR_sub : R ⊆ B.vertexSet \ S := by + rintro u ⟨w, hw⟩ + exact ⟨walk_support_subset_vertexSet w hv₁ u (Walk.end_mem_support w), + hw u (Walk.end_mem_support w)⟩ + have hv₁R : v₁ ∈ R := by + refine ⟨.nil, fun z hz ↦ ?_⟩ + simp only [Walk.support_nil, List.mem_cons, List.not_mem_nil, or_false] at hz + exact hz ▸ hv₁S + have hv₂R : v₂ ∉ R := by + rintro ⟨w, hw⟩ + obtain ⟨z, hz, hzS⟩ := hsep_walk ⟨w.bypass, w.bypass_isPath⟩ + exact hw z (w.support_bypass_subset_support hz) hzS + let V₁ : Set α := R ∪ S + let E₁ : Set β := {e ∈ B.edgeSet | B.ends e ⊆ V₁} + let V₂ : Set α := B.vertexSet \ R + let E₂ : Set β := B.edgeSet \ E₁ + have hV₁_sub : V₁ ⊆ B.vertexSet := Set.union_subset (hR_sub.trans Set.sdiff_subset) hS_sub + have hV₂_sub : V₂ ⊆ B.vertexSet := Set.sdiff_subset + have hE₂_ends : ∀ ⦃e : β⦄ ⦃v : α⦄, e ∈ E₂ → B.Inc e v → v ∈ V₂ := by + intro e v he₂ hinc + refine ⟨B.vertex_mem_of_inc hinc, fun hvR ↦ he₂.2 ⟨he₂.1, fun u hu ↦ ?_⟩⟩ + by_contra huV₁ + have huR : u ∉ R := fun h ↦ huV₁ (Or.inl h) + have huS : u ∉ S := fun h ↦ huV₁ (Or.inr h) + have hvu : v ≠ u := fun h ↦ huR (h ▸ hvR) + have hadj : B.skeleton.Adj v u := ⟨hvu, e, hinc, hu⟩ + rcases hvR with ⟨w, hw⟩ + refine huR ⟨w.concat hadj, fun z hz ↦ ?_⟩ + simp only [Walk.support_concat, List.mem_append, List.mem_cons, List.not_mem_nil, + or_false] at hz + rcases hz with hz | rfl + · exact hw z hz + · exact huS + let B₁ : Hypergraph α β := + { vertexSet := V₁ + edgeSet := E₁ + Inc := fun e v ↦ e ∈ E₁ ∧ B.Inc e v + vertex_mem_of_inc := fun _ _ h ↦ h.1.2 h.2 + edge_mem_of_inc := fun _ _ h ↦ h.1 + vertexSet_finite := B.vertexSet_finite.subset hV₁_sub + edgeSet_finite := B.edgeSet_finite.subset (fun _ h ↦ h.1) } + let B₂ : Hypergraph α β := + { vertexSet := V₂ + edgeSet := E₂ + Inc := fun e v ↦ e ∈ E₂ ∧ B.Inc e v + vertex_mem_of_inc := fun _ _ h ↦ hE₂_ends h.1 h.2 + edge_mem_of_inc := fun _ _ h ↦ h.1 + vertexSet_finite := B.vertexSet_finite.subset hV₂_sub + edgeSet_finite := B.edgeSet_finite.subset Set.sdiff_subset } + have hB₁_le : B₁ ≤ B := + ⟨hV₁_sub, fun _ h ↦ h.1, fun e he ↦ Set.ext fun v ↦ ⟨fun h ↦ ⟨he, h⟩, fun h ↦ h.2⟩⟩ + have hB₂_le : B₂ ≤ B := + ⟨hV₂_sub, Set.sdiff_subset, fun e he ↦ Set.ext fun v ↦ ⟨fun h ↦ ⟨he, h⟩, fun h ↦ h.2⟩⟩ + refine ⟨B₁, B₂, ?_, ?_, ?_, ?_⟩ + · rw [isSeparation_iff_of_le hB₁_le hB₂_le] + refine ⟨?_, ?_, ?_⟩ + · ext v + change v ∈ (R ∪ S) ∪ (B.vertexSet \ R) ↔ v ∈ B.vertexSet + exact ⟨fun h ↦ h.elim (fun h₁ ↦ hV₁_sub h₁) (fun h₂ ↦ h₂.1), + fun hv ↦ by by_cases hvR : v ∈ R <;> [exact Or.inl (Or.inl hvR); exact Or.inr ⟨hv, hvR⟩]⟩ + · ext e + change e ∈ E₁ ∪ (B.edgeSet \ E₁) ↔ e ∈ B.edgeSet + exact ⟨fun h ↦ h.elim (fun h₁ ↦ h₁.1) (fun h₂ ↦ h₂.1), + fun he ↦ by by_cases h₁ : e ∈ E₁ <;> [exact Or.inl h₁; exact Or.inr ⟨he, h₁⟩]⟩ + · ext e + change e ∈ E₁ ∧ e ∈ B.edgeSet \ E₁ ↔ False + exact ⟨fun ⟨h₁, _, h₂⟩ ↦ h₂ h₁, False.elim⟩ + · exact ⟨Or.inl hv₁R, fun h ↦ h.2 hv₁R⟩ + · exact ⟨⟨hv₂, hv₂R⟩, fun h ↦ h.elim hv₂R hv₂S⟩ + · have h_inter : (B₁ ∩ B₂).vertexSet = S := by + ext v + change v ∈ (R ∪ S) ∧ v ∈ B.vertexSet \ R ↔ v ∈ S + exact ⟨fun ⟨h₁, _, h₂⟩ ↦ h₁.resolve_left h₂, + fun hvS ↦ ⟨Or.inr hvS, hS_sub hvS, fun hvR ↦ (hR_sub hvR).2 hvS⟩⟩ + rw [separationOrder, h_inter] + +/-- **Graph Minors X, (2.10)** (pages 158–159): +"Let $\mathscr{T}$ be a tangle of order $\ge 3$ in a graph $G$, and let $(A, B)\in +\mathscr{T}$. Then $B$ has a circuit." -/ +theorem theorem_2_10_proof {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) (hθ : 3 ≤ θ) + {A₀ B₀ : Hypergraph α β} (hAB₀ : (A₀, B₀) ∈ 𝒯) : + HasCircuit B₀ := by + obtain ⟨A, B, hext, _, hBB₀⟩ := h𝒯.exists_isExtreme hAB₀ + apply HasCircuit.mono hBB₀ + refine Or.inr (Or.inr fun hacyc ↦ ?_) + have hord : separationOrder A B = θ - 1 := theorem_2_8_order h𝒯 hext + have hcard_ge : 2 ≤ (A ∩ B).vertexSet.ncard := by + rw [← separationOrder] + omega + obtain ⟨v₁, hv₁⟩ := + Set.nonempty_of_ncard_ne_zero (by omega : (A ∩ B).vertexSet.ncard ≠ 0) + obtain ⟨v₂, hv₂, hne₂₁⟩ := + Set.exists_ne_of_one_lt_ncard (by omega : 1 < (A ∩ B).vertexSet.ncard) v₁ + have hne : v₁ ≠ v₂ := hne₂₁.symm + have hnot_adj : ¬ B.skeleton.Adj v₁ v₂ := by + rintro ⟨_, e, hinc₁, hinc₂⟩ + have heB : e ∈ B.edgeSet := B.edge_mem_of_inc hinc₁ + have hnot_sub : ¬ B.ends e ⊆ A.vertexSet := + theorem_2_8_no_edge_ends_subset h𝒯 hext heB + obtain ⟨v₃, hv₃_ends, hv₃_notA⟩ := Set.not_subset.1 hnot_sub + have hv₁₃ : v₁ ≠ v₃ := fun h ↦ hv₃_notA (h ▸ hv₁.1) + have hv₃₂ : v₃ ≠ v₂ := fun h ↦ hv₃_notA (h.symm ▸ hv₂.1) + have hadj₁₂ : B.skeleton.Adj v₁ v₂ := ⟨hne, e, hinc₁, hinc₂⟩ + have hadj₁₃ : B.skeleton.Adj v₁ v₃ := ⟨hv₁₃, e, hinc₁, hv₃_ends⟩ + have hadj₃₂ : B.skeleton.Adj v₃ v₂ := ⟨hv₃₂, e, hv₃_ends, hinc₂⟩ + let p₁ : B.skeleton.Path v₁ v₂ := + ⟨Walk.cons hadj₁₂ .nil, Walk.IsPath.cons .nil (by simp [hne])⟩ + let p₂ : B.skeleton.Path v₁ v₂ := + ⟨Walk.cons hadj₁₃ (Walk.cons hadj₃₂ .nil), + Walk.IsPath.cons (Walk.IsPath.cons .nil (by simp [hv₃₂])) (by simp [hv₁₃, hne])⟩ + have hp_eq : p₁ = p₂ := (hacyc.subsingleton_path v₁ v₂).elim p₁ p₂ + have hlen : p₁.1.length = p₂.1.length := + congrArg (fun p : B.skeleton.Path v₁ v₂ ↦ p.1.length) hp_eq + simp [p₁, p₂] at hlen + by_cases hreach : B.skeleton.Reachable v₁ v₂ + · obtain ⟨w, hw_path⟩ := hreach.exists_isPath + let p : B.skeleton.Path v₁ v₂ := ⟨w, hw_path⟩ + rcases w with _ | ⟨hadj₁, rest⟩ + · exact hne rfl + · rcases rest with _ | ⟨hadj₂, rest'⟩ + · exact hnot_adj hadj₁ + · rename_i u u' + have huB : u ∈ B.vertexSet := by + obtain ⟨_, e, _, hu⟩ := id hadj₁ + exact B.vertex_mem_of_inc hu + have hv₁u : v₁ ≠ u := hadj₁.ne + have huv₂ : u ≠ v₂ := by + have hnodup := hw_path.support_nodup + simp only [Walk.support_cons, List.nodup_cons, List.mem_cons] at hnodup + intro h + exact hnodup.2.1 (h.symm ▸ Walk.end_mem_support rest') + have hsep_walk : ∀ q : B.skeleton.Path v₁ v₂, ∃ z ∈ q.1.support, z ∈ ({u} : Set α) := by + intro q + have hqp : q = p := (hacyc.subsingleton_path v₁ v₂).elim q p + refine ⟨u, ?_, Set.mem_singleton u⟩ + rw [hqp] + simp [p] + obtain ⟨B₁, B₂, hB, h₁, h₂, hordB⟩ := + exists_separation_of_vertex_separator hv₁.2 hv₂.2 (Set.singleton_subset_iff.2 huB) + (Set.notMem_singleton_iff.2 hv₁u) (Set.notMem_singleton_iff.2 huv₂.symm) hsep_walk + have hge2 := theorem_2_10_claim_1 h𝒯 hext hv₁ hv₂ hB h₁ h₂ + rw [hordB, Set.ncard_singleton] at hge2 + omega + · have hsep_walk : ∀ q : B.skeleton.Path v₁ v₂, ∃ z ∈ q.1.support, z ∈ (∅ : Set α) := + fun q ↦ (hreach q.1.reachable).elim + obtain ⟨B₁, B₂, hB, h₁, h₂, hordB⟩ := + exists_separation_of_vertex_separator hv₁.2 hv₂.2 (Set.empty_subset _) + (Set.notMem_empty v₁) (Set.notMem_empty v₂) hsep_walk + have hge2 := theorem_2_10_claim_1 h𝒯 hext hv₁ hv₂ hB h₁ h₂ + rw [hordB, Set.ncard_empty] at hge2 + omega + +/-! ## Section 6: New Tangles from Old -/ + +/-! ### Truncations (Graph Minors X, Section 6, page 170) -/ + +private lemma bot_le (G : Hypergraph α β) : (⊥ : Hypergraph α β) ≤ G where + vertexSet_subset := Set.empty_subset _ + edgeSet_subset := Set.empty_subset _ + ends_eq _ h := h.elim + +private lemma isSeparation_bot_self (G : Hypergraph α β) : G.IsSeparation ⊥ G := by + rw [isSeparation_iff_of_le (bot_le G) le_rfl] + simp + +private lemma bot_self_mem_tangle {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) : + (⊥, G) ∈ 𝒯 := by + have hsep := isSeparation_bot_self G + have hord : separationOrder (⊥ : Hypergraph α β) G < θ := by + have : ((⊥ : Hypergraph α β) ∩ G).vertexSet = ∅ := by simp + rw [separationOrder, this, Set.ncard_empty] + exact h𝒯.one_le + exact (h𝒯.axiom1 hsep hord).resolve_right fun hGbot ↦ h𝒯.axiom3 hGbot rfl + +/-- In a tangle `𝒯` of order `θ`, there exists a separation `(A, B)` of `G` of order `θ` such that +neither `(A, B)` nor `(B, A)` belongs to `𝒯`. -/ +theorem IsTangle.exists_separation_order_eq {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) : + ∃ A B : Hypergraph α β, + G.IsSeparation A B ∧ separationOrder A B = θ ∧ (A, B) ∉ 𝒯 ∧ (B, A) ∉ 𝒯 := by + obtain ⟨A, B, hext, _, _⟩ := h𝒯.exists_isExtreme (bot_self_mem_tangle h𝒯) + obtain ⟨A', hsep, hord, hnot, hnotRev⟩ := h𝒯.exists_enlarged_extreme_separation hext + have horder := theorem_2_8_order h𝒯 hext + have hpos := h𝒯.one_le + exact ⟨A', B, hsep, by omega, hnot, hnotRev⟩ + +/-- **Graph Minors X, Section 6** (page 170): +"We observe also that if $\mathscr{T}, \mathscr{T}'$ are tangles in $G$ then +$\mathscr{T}' \subseteq \mathscr{T}$ if and only if $\mathscr{T}'$ is a truncation of +$\mathscr{T}$." -/ +theorem subset_iff_truncation {G : Hypergraph α β} {θ θ' : ℕ} + {𝒯 𝒯' : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : IsTangle G θ 𝒯) (h𝒯' : IsTangle G θ' 𝒯') : + 𝒯' ⊆ 𝒯 ↔ θ' ≤ θ ∧ 𝒯' = truncation 𝒯 θ' := by + constructor + · intro hsub + have hle : θ' ≤ θ := by + by_contra! hlt + obtain ⟨A, B, hsep, hord, hnotAB, hnotBA⟩ := h𝒯.exists_separation_order_eq + rcases h𝒯'.axiom1 hsep (hord ▸ hlt) with hm | hm + · exact hnotAB (hsub hm) + · exact hnotBA (hsub hm) + refine ⟨hle, Set.Subset.antisymm (fun p hp ↦ ⟨hsub hp, h𝒯'.order_lt hp⟩) ?_⟩ + rintro ⟨A, B⟩ ⟨hAB, hord⟩ + rcases h𝒯'.axiom1 (h𝒯.isSeparation hAB) hord with hm | hm + · exact hm + · exact (theorem_2_1_proof h𝒯 hAB (hsub hm)).elim + · rintro ⟨_, rfl⟩ p hp + exact hp.1 + +/-- Variant of `subset_iff_truncation` existentially quantifying the truncation order. -/ +theorem subset_iff_exists_truncation {G : Hypergraph α β} {θ θ' : ℕ} + {𝒯 𝒯' : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : IsTangle G θ 𝒯) (h𝒯' : IsTangle G θ' 𝒯') : + 𝒯' ⊆ 𝒯 ↔ ∃ θ'', 1 ≤ θ'' ∧ θ'' ≤ θ ∧ 𝒯' = truncation 𝒯 θ'' := by + rw [subset_iff_truncation h𝒯 h𝒯'] + refine ⟨fun ⟨hle, heq⟩ ↦ ⟨θ', h𝒯'.one_le, hle, heq⟩, ?_⟩ + rintro ⟨θ'', _, _, rfl⟩ + rw [← subset_iff_truncation h𝒯 h𝒯'] + exact fun _ hp ↦ hp.1 + +/-! ### Induced Tangles in Minors: Graph Minors X, (6.1) (page 170) -/ + +@[simp] +private lemma ofGraph_vertexSet (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) : + (Hypergraph.ofGraph G hV hE).vertexSet = V(G) := rfl + +@[simp] +private lemma ofGraph_edgeSet (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) : + (Hypergraph.ofGraph G hV hE).edgeSet = E(G) := rfl + +@[simp] +private lemma ofGraph_inc (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) (e : β) (v : α) : + (Hypergraph.ofGraph G hV hE).Inc e v ↔ G.Inc e v := Iff.rfl + +/-- The component of `v` in `(V(G'), C)` used by `contract G' C` (the map `η` in the proof of +(6.1), page 170). -/ +abbrev contractComp (G' : Graph α β) (C : Set β) (v : α) : Set α := + {w | ReflTransGen (fun x y ↦ ∃ e ∈ C, G'.IsLink e x y) v w} + +private lemma mem_contractComp_self (G' : Graph α β) (C : Set β) (v : α) : + v ∈ contractComp G' C v := + ReflTransGen.refl + +private lemma contractComp_symm {G' : Graph α β} {C : Set β} {x y : α} + (h : ReflTransGen (fun a b ↦ ∃ e ∈ C, G'.IsLink e a b) x y) : + ReflTransGen (fun a b ↦ ∃ e ∈ C, G'.IsLink e a b) y x := by + induction h with + | refl => exact .refl + | tail _ hstep ih => + rcases hstep with ⟨e, heC, hl⟩ + exact (ReflTransGen.single ⟨e, heC, hl.symm⟩).trans ih + +private lemma contractComp_eq_of_rel {G' : Graph α β} {C : Set β} {x y : α} + (h : ReflTransGen (fun a b ↦ ∃ e ∈ C, G'.IsLink e a b) x y) : + contractComp G' C x = contractComp G' C y := by + ext z + exact ⟨fun hxz ↦ (contractComp_symm h).trans hxz, fun hyz ↦ h.trans hyz⟩ + +private lemma vertexSet_contract_eq (G' : Graph α β) (C : Set β) : + V(contract G' C) = contractComp G' C '' V(G') := by + simp [contract, contractComp] + +private lemma edgeSet_contract_eq (G' : Graph α β) (C : Set β) : + E(contract G' C) = E(G') \ C := by + simp [contract] + +private lemma contract_isLink_iff (G' : Graph α β) (C : Set β) (e : β) (X Y : Set α) : + (contract G' C).IsLink e X Y ↔ + e ∉ C ∧ ∃ x y, G'.IsLink e x y ∧ contractComp G' C x = X ∧ contractComp G' C y = Y := by + simp only [contract, deleteEdges_isLink, map_isLink, Relation.Map, contractComp] + exact and_comm + +private lemma contract_inc_iff (G' : Graph α β) (C : Set β) (e : β) (X : Set α) : + (contract G' C).Inc e X ↔ + e ∉ C ∧ ∃ x y, G'.IsLink e x y ∧ contractComp G' C x = X := by + unfold Graph.Inc + constructor + · rintro ⟨Y, hl⟩ + rw [contract_isLink_iff] at hl + rcases hl with ⟨heC, x, y, hl, rfl, rfl⟩ + exact ⟨heC, x, y, hl, rfl⟩ + · rintro ⟨heC, x, y, hl, rfl⟩ + refine ⟨contractComp G' C y, ?_⟩ + rw [contract_isLink_iff] + exact ⟨heC, x, y, hl, rfl, rfl⟩ + +/-- The subhypergraph `A'` of `H = contract G' C` associated to a subhypergraph `A` of `G` in the +proof of **Graph Minors X, (6.1)** (page 170): +"First, let $(A, B)$ be a separation of $G$ of order $< \theta$. Then we may choose a separation +$(A', B')$ of $H$ such that $E(A') = E(A) \cap E(H)$, and every vertex of $V(A' \cap B')$ is +incident with an edge of $E(A')$ and with an edge of $E(B')$." +Concretely, we define the image of `A` in `H` to have vertex set +`{η(x) : x ∈ V(A ∩ G')} ∪ {v ∈ V(H) : v is incident in H with an edge in E(A) ∩ E(H)}` +and edge set `E(A) ∩ E(H)`. -/ +@[expose] noncomputable def minorImageSubhypergraph (G' : Graph α β) (C : Set β) + (hVH : V(contract G' C).Finite) (hEH : E(contract G' C).Finite) + (A : Hypergraph α β) : Hypergraph (Set α) β where + vertexSet := + contractComp G' C '' (A.vertexSet ∩ V(G')) ∪ + {v ∈ V(contract G' C) | ∃ e ∈ A.edgeSet ∩ E(contract G' C), (contract G' C).Inc e v} + edgeSet := A.edgeSet ∩ E(contract G' C) + Inc e v := e ∈ A.edgeSet ∩ E(contract G' C) ∧ (contract G' C).Inc e v + vertex_mem_of_inc _ _ h := Or.inr ⟨h.2.vertex_mem, _, h.1, h.2⟩ + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := by + refine hVH.subset ?_ + rintro v (⟨x, ⟨_, hxG'⟩, rfl⟩ | ⟨hvH, _⟩) + · rw [vertexSet_contract_eq] + exact ⟨x, hxG', rfl⟩ + · exact hvH + edgeSet_finite := hEH.subset Set.inter_subset_right + +private lemma minorImageSubhypergraph_vertexSet_eq {G G' : Graph α β} {C : Set β} + (hG' : G' ≤ G) (hV : V(G).Finite) (hE : E(G).Finite) + (hVH : V(contract G' C).Finite) (hEH : E(contract G' C).Finite) + {A : Hypergraph α β} (hA : A ≤ Hypergraph.ofGraph G hV hE) : + (minorImageSubhypergraph G' C hVH hEH A).vertexSet = + contractComp G' C '' (A.vertexSet ∩ V(G')) := by + refine Set.union_eq_left.2 ?_ + rintro v ⟨_, e, ⟨heA, _⟩, hincH⟩ + rw [contract_inc_iff] at hincH + rcases hincH with ⟨_, x, y, hlG', rfl⟩ + have hlG : G.IsLink e x y := hlG'.mono hG' + have hincG : (Hypergraph.ofGraph G hV hE).Inc e x := hlG.inc_left + have hincA : A.Inc e x := (inc_iff_of_le hA heA).2 hincG + exact ⟨x, ⟨A.vertex_mem_of_inc hincA, hlG'.left_mem⟩, rfl⟩ + +lemma minorImageSubhypergraph_le {G' : Graph α β} {C : Set β} + (hVH : V(contract G' C).Finite) (hEH : E(contract G' C).Finite) + (A : Hypergraph α β) : + minorImageSubhypergraph G' C hVH hEH A ≤ + Hypergraph.ofGraph (contract G' C) hVH hEH where + vertexSet_subset := by + rintro v (⟨x, ⟨_, hxG'⟩, rfl⟩ | ⟨hvH, _⟩) + · rw [ofGraph_vertexSet, vertexSet_contract_eq] + exact ⟨x, hxG', rfl⟩ + · exact hvH + edgeSet_subset := Set.inter_subset_right + ends_eq e he := by + ext v + simp only [Hypergraph.ends, Set.mem_ofPred_eq, minorImageSubhypergraph, ofGraph_inc] + exact ⟨fun h ↦ ⟨he, h⟩, fun h ↦ h.2⟩ + +lemma minorImageSubhypergraph_isSeparation {G G' : Graph α β} {C : Set β} + (hG' : G' ≤ G) (hV : V(G).Finite) (hE : E(G).Finite) + (hVH : V(contract G' C).Finite) (hEH : E(contract G' C).Finite) + {A B : Hypergraph α β} (hsep : (Hypergraph.ofGraph G hV hE).IsSeparation A B) : + (Hypergraph.ofGraph (contract G' C) hVH hEH).IsSeparation + (minorImageSubhypergraph G' C hVH hEH A) + (minorImageSubhypergraph G' C hVH hEH B) := by + have hleA := minorImageSubhypergraph_le hVH hEH A + have hleB := minorImageSubhypergraph_le hVH hEH B + rw [isSeparation_iff_of_le hleA hleB] + refine ⟨?_, ?_, ?_⟩ + · rw [minorImageSubhypergraph_vertexSet_eq hG' hV hE hVH hEH hsep.left_le, + minorImageSubhypergraph_vertexSet_eq hG' hV hE hVH hEH hsep.right_le, + ← Set.image_union, ← Set.union_inter_distrib_right, hsep.vertexSet_union, + ofGraph_vertexSet, Set.inter_eq_right.2 hG'.vertexSet_mono, + ofGraph_vertexSet, vertexSet_contract_eq] + · change (A.edgeSet ∩ E(contract G' C)) ∪ (B.edgeSet ∩ E(contract G' C)) = E(contract G' C) + have hEH_sub : E(contract G' C) ⊆ E(G) := by + rw [edgeSet_contract_eq] + exact Set.sdiff_subset.trans hG'.edgeSet_mono + rw [← Set.union_inter_distrib_right, hsep.edgeSet_union, ofGraph_edgeSet, + Set.inter_eq_right.2 hEH_sub] + · ext e + change e ∈ (A.edgeSet ∩ E(contract G' C)) ∩ (B.edgeSet ∩ E(contract G' C)) ↔ e ∈ (∅ : Set β) + simp only [Set.mem_inter_iff, Set.mem_empty_iff_false, iff_false] + rintro ⟨⟨heA, _⟩, ⟨heB, _⟩⟩ + exact hsep.notMem_edgeSet_right heA heB + +private lemma exists_mem_inter_of_contractComp_eq {G G' : Graph α β} {C : Set β} + (hG' : G' ≤ G) (hV : V(G).Finite) (hE : E(G).Finite) + {A B : Hypergraph α β} (hsep : (Hypergraph.ofGraph G hV hE).IsSeparation A B) + {x y : α} (hxy : ReflTransGen (fun a b ↦ ∃ e ∈ C, G'.IsLink e a b) x y) + (hxA : x ∈ A.vertexSet) (hxG' : x ∈ V(G')) (hyB : y ∈ B.vertexSet) : + ∃ z ∈ (A ∩ B).vertexSet ∩ V(G'), contractComp G' C z = contractComp G' C x := by + induction hxy with + | refl => + exact ⟨x, ⟨⟨hxA, hyB⟩, hxG'⟩, rfl⟩ + | @tail a b hab hstep ih => + rcases hstep with ⟨e, heC, hlG'⟩ + have hlG : G.IsLink e a b := hlG'.mono hG' + have heG : e ∈ (Hypergraph.ofGraph G hV hE).edgeSet := hlG.edge_mem + have heAB : e ∈ A.edgeSet ∪ B.edgeSet := hsep.edgeSet_union.symm ▸ heG + rcases heAB with heA | heB + · have hincB_G : (Hypergraph.ofGraph G hV hE).Inc e b := hlG.inc_right + have hincA : A.Inc e b := (inc_iff_of_le hsep.left_le heA).2 hincB_G + have hbA : b ∈ A.vertexSet := A.vertex_mem_of_inc hincA + have hrel_xb : ReflTransGen (fun u v ↦ ∃ e ∈ C, G'.IsLink e u v) x b := + hab.tail ⟨e, heC, hlG'⟩ + exact ⟨b, ⟨⟨hbA, hyB⟩, hlG'.right_mem⟩, (contractComp_eq_of_rel hrel_xb).symm⟩ + · have hincA_G : (Hypergraph.ofGraph G hV hE).Inc e a := hlG.inc_left + have hincB : B.Inc e a := (inc_iff_of_le hsep.right_le heB).2 hincA_G + exact ih (B.vertex_mem_of_inc hincB) + +private lemma minorImageSubhypergraph_inter_vertexSet_subset {G G' : Graph α β} {C : Set β} + (hG' : G' ≤ G) (hV : V(G).Finite) (hE : E(G).Finite) + (hVH : V(contract G' C).Finite) (hEH : E(contract G' C).Finite) + {A B : Hypergraph α β} (hsep : (Hypergraph.ofGraph G hV hE).IsSeparation A B) : + (minorImageSubhypergraph G' C hVH hEH A ∩ + minorImageSubhypergraph G' C hVH hEH B).vertexSet ⊆ + contractComp G' C '' ((A ∩ B).vertexSet ∩ V(G')) := by + intro v hv + rw [inter_vertexSet, + minorImageSubhypergraph_vertexSet_eq hG' hV hE hVH hEH hsep.left_le, + minorImageSubhypergraph_vertexSet_eq hG' hV hE hVH hEH hsep.right_le] at hv + rcases hv with ⟨⟨x, ⟨hxA, hxG'⟩, rfl⟩, ⟨y, ⟨hyB, _⟩, hyx⟩⟩ + have hxy : y ∈ contractComp G' C x := hyx ▸ mem_contractComp_self G' C y + obtain ⟨z, hz, hz_eq⟩ := exists_mem_inter_of_contractComp_eq hG' hV hE hsep hxy hxA hxG' hyB + exact ⟨z, hz, hz_eq⟩ + +lemma minorImageSubhypergraph_separationOrder_le {G G' : Graph α β} {C : Set β} + (hG' : G' ≤ G) (hV : V(G).Finite) (hE : E(G).Finite) + (hVH : V(contract G' C).Finite) (hEH : E(contract G' C).Finite) + {A B : Hypergraph α β} (hsep : (Hypergraph.ofGraph G hV hE).IsSeparation A B) : + separationOrder (minorImageSubhypergraph G' C hVH hEH A) + (minorImageSubhypergraph G' C hVH hEH B) ≤ separationOrder A B := by + have hsub := minorImageSubhypergraph_inter_vertexSet_subset hG' hV hE hVH hEH hsep + have hfin1 : (contractComp G' C '' ((A ∩ B).vertexSet ∩ V(G'))).Finite := + ((A ∩ B).vertexSet_finite.inter_of_left _).image _ + have h1 : separationOrder (minorImageSubhypergraph G' C hVH hEH A) + (minorImageSubhypergraph G' C hVH hEH B) ≤ + (contractComp G' C '' ((A ∩ B).vertexSet ∩ V(G'))).ncard := + Set.ncard_le_ncard hsub hfin1 + have h2 : (contractComp G' C '' ((A ∩ B).vertexSet ∩ V(G'))).ncard ≤ + ((A ∩ B).vertexSet ∩ V(G')).ncard := + Set.ncard_image_le ((A ∩ B).vertexSet_finite.inter_of_left _) + have h3 : ((A ∩ B).vertexSet ∩ V(G')).ncard ≤ separationOrder A B := + Set.ncard_le_ncard Set.inter_subset_left (A ∩ B).vertexSet_finite + exact (h1.trans h2).trans h3 + +/-- **Graph Minors X, (6.1)** (page 170): +"(6.1) *Let $H$ be a minor of a graph $G$, and let $\mathscr{T}'$ be a tangle in $H$ of order +$\theta \ge 2$. Let $\mathscr{T}$ be the set of all separations $(A, B)$ of $G$ of order $< \theta$ +such that there exists $(A', B') \in \mathscr{T}'$ with $E(A') = E(A) \cap E(H)$. Then $\mathscr{T}$ +is a tangle in $G$ of order $\theta$.*" -/ +theorem theorem_6_1_proof {G : Graph α β} {H : Graph (Set α) β} + (hV : V(G).Finite) (hE : E(G).Finite) + (hVH : V(H).Finite) (hEH : E(H).Finite) + (hminor : IsMinor H G) {θ : ℕ} (hθ : 2 ≤ θ) + {𝒯' : Set (Hypergraph (Set α) β × Hypergraph (Set α) β)} + (h𝒯' : IsTangle (Hypergraph.ofGraph H hVH hEH) θ 𝒯') : + IsTangle (Hypergraph.ofGraph G hV hE) θ + (inducedTangle (Hypergraph.ofGraph G hV hE) (Hypergraph.ofGraph H hVH hEH) 𝒯' θ) := by + rcases hminor with ⟨G', hG', C, _, rfl⟩ + let G_hyp := Hypergraph.ofGraph G hV hE + let H_hyp := Hypergraph.ofGraph (contract G' C) hVH hEH + have hEH_sub : H_hyp.edgeSet ⊆ G_hyp.edgeSet := by + change E(contract G' C) ⊆ E(G) + rw [edgeSet_contract_eq] + exact Set.sdiff_subset.trans hG'.edgeSet_mono + refine ⟨by omega, fun _ _ h ↦ h.1, fun _ _ h ↦ h.2.1, ?_, ?_, ?_⟩ + · intro A B hsep hord + let ηA := minorImageSubhypergraph G' C hVH hEH A + let ηB := minorImageSubhypergraph G' C hVH hEH B + have hsepH := minorImageSubhypergraph_isSeparation hG' hV hE hVH hEH hsep + have hordH : separationOrder ηA ηB < θ := + (minorImageSubhypergraph_separationOrder_le hG' hV hE hVH hEH hsep).trans_lt hord + rcases h𝒯'.axiom1 hsepH hordH with hm | hm + · exact Or.inl ⟨hsep, hord, ⟨(ηA, ηB), hm, rfl⟩⟩ + · exact Or.inr ⟨hsep.symm, by rwa [separationOrder_comm], ⟨(ηB, ηA), hm, rfl⟩⟩ + · intro A₁ B₁ A₂ B₂ A₃ B₃ h₁ h₂ h₃ hU + rcases h₁.2.2 with ⟨⟨A₁', B₁'⟩, hm₁, hE₁⟩ + rcases h₂.2.2 with ⟨⟨A₂', B₂'⟩, hm₂, hE₂⟩ + rcases h₃.2.2 with ⟨⟨A₃', B₃'⟩, hm₃, hE₃⟩ + dsimp only at hE₁ hE₂ hE₃ + apply theorem_2_3_proof h𝒯' hθ hm₁ hm₂ hm₃ + have hEU : (A₁ ∪ A₂ ∪ A₃).edgeSet = G_hyp.edgeSet := congrArg Hypergraph.edgeSet hU + calc + (A₁' ∪ A₂' ∪ A₃').edgeSet + = (A₁.edgeSet ∩ H_hyp.edgeSet) ∪ (A₂.edgeSet ∩ H_hyp.edgeSet) ∪ + (A₃.edgeSet ∩ H_hyp.edgeSet) := by + simp [hE₁, hE₂, hE₃, H_hyp] + _ = (A₁ ∪ A₂ ∪ A₃).edgeSet ∩ H_hyp.edgeSet := by + simp [Set.union_inter_distrib_right] + _ = G_hyp.edgeSet ∩ H_hyp.edgeSet := by rw [hEU] + _ = H_hyp.edgeSet := Set.inter_eq_right.2 hEH_sub + · intro A B hAB hVA + rcases hAB with ⟨hsep, hord, ⟨⟨A', B'⟩, hm', hEA'⟩⟩ + dsimp only at hsep hord hm' hEA' + let ηA := minorImageSubhypergraph G' C hVH hEH A + let ηB := minorImageSubhypergraph G' C hVH hEH B + have hsepH := minorImageSubhypergraph_isSeparation hG' hV hE hVH hEH hsep + have hordH : separationOrder ηA ηB < θ := + (minorImageSubhypergraph_separationOrder_le hG' hV hE hVH hEH hsep).trans_lt hord + have hηA_mem : (ηA, ηB) ∈ 𝒯' := + theorem_2_9_proof h𝒯' hm' hsepH hordH (Or.inr (Or.inr ⟨hθ, hEA'.symm.subset⟩)) + have hVηA : ηA.vertexSet = H_hyp.vertexSet := by + rw [minorImageSubhypergraph_vertexSet_eq hG' hV hE hVH hEH hsep.left_le, + hVA, ofGraph_vertexSet, Set.inter_eq_right.2 hG'.vertexSet_mono, + ← vertexSet_contract_eq] + rfl + exact h𝒯'.axiom3 hηA_mem hVηA + +/-! ### Quotient Tangles `𝒯 / W`: Graph Minors X, (6.2) and (6.3) (page 171) -/ + +private lemma quotientVertices_le {G A : Hypergraph α β} (hA : A ≤ G) (W : Set α) : + quotientVertices A W ≤ quotientVertices G W where + vertexSet_subset := Set.sdiff_subset_sdiff hA.vertexSet_subset subset_rfl + edgeSet_subset := hA.edgeSet_subset + ends_eq e he := by + ext v + simp only [Hypergraph.ends, Set.mem_ofPred_eq, quotientVertices] + rw [inc_iff_of_le hA he] + +/-- If `(A, B)` is a separation of `G`, then `(A / W, B / W)` is a separation of `G / W` +(Graph Minors X, Section 6, page 171). -/ +theorem IsSeparation.quotientVertices {G A B : Hypergraph α β} + (hsep : G.IsSeparation A B) (W : Set α) : + (GraphMinor.GM10.quotientVertices G W).IsSeparation + (GraphMinor.GM10.quotientVertices A W) + (GraphMinor.GM10.quotientVertices B W) := by + rw [isSeparation_iff_of_le (quotientVertices_le hsep.left_le W) + (quotientVertices_le hsep.right_le W)] + refine ⟨?_, hsep.edgeSet_union, hsep.edgeSet_inter_eq⟩ + change (A.vertexSet \ W) ∪ (B.vertexSet \ W) = G.vertexSet \ W + rw [← Set.union_sdiff_distrib, hsep.vertexSet_union] + +/-- The separation order of `(A / W, B / W)` is `|V(A ∩ B) \ W|`. -/ +theorem separationOrder_quotientVertices (A B : Hypergraph α β) (W : Set α) : + separationOrder (quotientVertices A W) (quotientVertices B W) = + ((A ∩ B).vertexSet \ W).ncard := by + have : (quotientVertices A W ∩ quotientVertices B W).vertexSet = (A ∩ B).vertexSet \ W := by + ext v + simp only [inter_vertexSet, quotientVertices, Set.mem_inter_iff, Set.mem_sdiff] + tauto + rw [separationOrder, this] + +/-- Lifting a subhypergraph `A'` of `G / W` to a subhypergraph of `G` by adding `W` to its vertex +set, as in the proofs of **Graph Minors X, (6.2) and (6.3)** (page 171). -/ +def liftQuotientSubhypergraph (G : Hypergraph α β) (W : Set α) (hW : W ⊆ G.vertexSet) + (A' : Hypergraph α β) (hA' : A' ≤ quotientVertices G W) : Hypergraph α β where + vertexSet := A'.vertexSet ∪ W + edgeSet := A'.edgeSet + Inc e v := e ∈ A'.edgeSet ∧ G.Inc e v + vertex_mem_of_inc e v h := by + by_cases hvW : v ∈ W + · exact Or.inr hvW + · have hincGW : (quotientVertices G W).Inc e v := ⟨h.2, hvW⟩ + have hincA' : A'.Inc e v := (inc_iff_of_le hA' h.1).2 hincGW + exact Or.inl (A'.vertex_mem_of_inc hincA') + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := A'.vertexSet_finite.union (G.vertexSet_finite.subset hW) + edgeSet_finite := A'.edgeSet_finite + +private lemma liftQuotientSubhypergraph_le {G : Hypergraph α β} {W : Set α} + (hW : W ⊆ G.vertexSet) {A' : Hypergraph α β} (hA' : A' ≤ quotientVertices G W) : + liftQuotientSubhypergraph G W hW A' hA' ≤ G where + vertexSet_subset := + Set.union_subset (hA'.vertexSet_subset.trans Set.sdiff_subset) hW + edgeSet_subset := hA'.edgeSet_subset + ends_eq e he := by + ext v + simp only [Hypergraph.ends, Set.mem_ofPred_eq, liftQuotientSubhypergraph] + exact ⟨fun h ↦ ⟨he, h⟩, fun h ↦ h.2⟩ + +private lemma quotientVertices_liftQuotientSubhypergraph {G : Hypergraph α β} {W : Set α} + (hW : W ⊆ G.vertexSet) {A' : Hypergraph α β} (hA' : A' ≤ quotientVertices G W) : + quotientVertices (liftQuotientSubhypergraph G W hW A' hA') W = A' := by + have hdisj : Disjoint A'.vertexSet W := by + refine Set.disjoint_left.2 fun v hvA' hvW ↦ ?_ + exact (hA'.vertexSet_subset hvA').2 hvW + have hV : (A'.vertexSet ∪ W) \ W = A'.vertexSet := by + rw [Set.union_sdiff_cancel_right (Set.disjoint_iff.1 hdisj)] + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (quotientVertices_le (liftQuotientSubhypergraph_le hW hA') W) hA' hV rfl + +private lemma eq_liftQuotientSubhypergraph_of_subset {G A : Hypergraph α β} {W : Set α} + (hW : W ⊆ G.vertexSet) (hA : A ≤ G) (hWA : W ⊆ A.vertexSet) : + A = liftQuotientSubhypergraph G W hW (quotientVertices A W) (quotientVertices_le hA W) := by + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hA + (liftQuotientSubhypergraph_le hW (quotientVertices_le hA W)) ?_ rfl + change A.vertexSet = (A.vertexSet \ W) ∪ W + exact (Set.sdiff_union_of_subset hWA).symm + +private lemma liftQuotientSubhypergraph_isSeparation {G : Hypergraph α β} {W : Set α} + (hW : W ⊆ G.vertexSet) {A' B' : Hypergraph α β} + (hsep' : (quotientVertices G W).IsSeparation A' B') : + G.IsSeparation + (liftQuotientSubhypergraph G W hW A' hsep'.left_le) + (liftQuotientSubhypergraph G W hW B' hsep'.right_le) := by + rw [isSeparation_iff_of_le (liftQuotientSubhypergraph_le hW hsep'.left_le) + (liftQuotientSubhypergraph_le hW hsep'.right_le)] + refine ⟨?_, hsep'.edgeSet_union, hsep'.edgeSet_inter_eq⟩ + change (A'.vertexSet ∪ W) ∪ (B'.vertexSet ∪ W) = G.vertexSet + have h1 : (A'.vertexSet ∪ W) ∪ (B'.vertexSet ∪ W) = (A'.vertexSet ∪ B'.vertexSet) ∪ W := by + ext v + simp only [Set.mem_union] + tauto + rw [h1, hsep'.vertexSet_union] + exact Set.sdiff_union_of_subset hW + +private lemma liftQuotientSubhypergraph_separationOrder {G : Hypergraph α β} {W : Set α} + (hW : W ⊆ G.vertexSet) {A' B' : Hypergraph α β} + (hsep' : (quotientVertices G W).IsSeparation A' B') : + separationOrder + (liftQuotientSubhypergraph G W hW A' hsep'.left_le) + (liftQuotientSubhypergraph G W hW B' hsep'.right_le) = + separationOrder A' B' + W.ncard := by + have h_inter : + ((liftQuotientSubhypergraph G W hW A' hsep'.left_le) ∩ + (liftQuotientSubhypergraph G W hW B' hsep'.right_le)).vertexSet = + (A' ∩ B').vertexSet ∪ W := by + ext v + simp only [inter_vertexSet, liftQuotientSubhypergraph, Set.mem_inter_iff, Set.mem_union] + tauto + have hdisj : Disjoint (A' ∩ B').vertexSet W := by + refine Set.disjoint_left.2 fun v hv hvW ↦ ?_ + exact (hsep'.left_le.vertexSet_subset hv.1).2 hvW + rw [separationOrder, h_inter, + Set.ncard_union_eq hdisj (A' ∩ B').vertexSet_finite (G.vertexSet_finite.subset hW), + separationOrder] + +/-- **Graph Minors X, (6.2)** (page 171): +"(6.2) *Let $\mathscr{T}$ be a tangle of order $\theta$ in a hypergraph $G$, and let $W \subseteq +V(G)$ with $|W| < \theta$. Let $\mathscr{T}'$ be the set of all separations $(A', B')$ of $G/W$ such +that there exists $(A, B) \in \mathscr{T}$ with $W \subseteq V(A \cap B)$, $A/W = A'$, and $B/W = +B'$. Then $\mathscr{T}'$ is a tangle in $G/W$ of order $\theta - |W|$.*" -/ +theorem theorem_6_2_proof {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {W : Set α} (hW : W ⊆ G.vertexSet) (hW_lt : W.ncard < θ) : + IsTangle (quotientVertices G W) (θ - W.ncard) (quotientTangle G 𝒯 W) where + one_le := by omega + isSeparation _ _ h := h.1 + order_lt A' B' h := by + rcases h with ⟨_, ⟨A, B⟩, ⟨hAB, hW_sub, hAW, hBW⟩⟩ + dsimp only at hAB hW_sub hAW hBW + subst hAW hBW + have hord := h𝒯.order_lt hAB + rw [separationOrder_quotientVertices, + Set.ncard_sdiff hW_sub (G.vertexSet_finite.subset hW), + ← separationOrder] + omega + axiom1 A' B' hsep' hord' := by + let A := liftQuotientSubhypergraph G W hW A' hsep'.left_le + let B := liftQuotientSubhypergraph G W hW B' hsep'.right_le + have hsep := liftQuotientSubhypergraph_isSeparation hW hsep' + have hord : separationOrder A B < θ := by + rw [liftQuotientSubhypergraph_separationOrder hW hsep'] + omega + have hW_AB : W ⊆ (A ∩ B).vertexSet := + Set.subset_inter Set.subset_union_right Set.subset_union_right + have hW_BA : W ⊆ (B ∩ A).vertexSet := + Set.subset_inter Set.subset_union_right Set.subset_union_right + have hAW : quotientVertices A W = A' := + quotientVertices_liftQuotientSubhypergraph hW hsep'.left_le + have hBW : quotientVertices B W = B' := + quotientVertices_liftQuotientSubhypergraph hW hsep'.right_le + rcases h𝒯.axiom1 hsep hord with hm | hm + · exact Or.inl ⟨hsep', ⟨(A, B), hm, hW_AB, hAW, hBW⟩⟩ + · exact Or.inr ⟨hsep'.symm, ⟨(B, A), hm, hW_BA, hBW, hAW⟩⟩ + axiom2 A₁' B₁' A₂' B₂' A₃' B₃' h₁ h₂ h₃ hU' := by + rcases h₁.2 with ⟨⟨A₁, B₁⟩, hm₁, hW₁, hA₁, hB₁⟩ + rcases h₂.2 with ⟨⟨A₂, B₂⟩, hm₂, hW₂, hA₂, hB₂⟩ + rcases h₃.2 with ⟨⟨A₃, B₃⟩, hm₃, hW₃, hA₃, hB₃⟩ + dsimp only at hm₁ hW₁ hA₁ hB₁ hm₂ hW₂ hA₂ hB₂ hm₃ hW₃ hA₃ hB₃ + subst hA₁ hB₁ hA₂ hB₂ hA₃ hB₃ + apply h𝒯.axiom2 hm₁ hm₂ hm₃ + have hU_le : A₁ ∪ A₂ ∪ A₃ ≤ G := + union_le (union_le (h𝒯.isSeparation hm₁).left_le (h𝒯.isSeparation hm₂).left_le) + (h𝒯.isSeparation hm₃).left_le + have hVU' : (A₁.vertexSet \ W) ∪ (A₂.vertexSet \ W) ∪ (A₃.vertexSet \ W) = + G.vertexSet \ W := congrArg Hypergraph.vertexSet hU' + have hEU' : A₁.edgeSet ∪ A₂.edgeSet ∪ A₃.edgeSet = G.edgeSet := + congrArg Hypergraph.edgeSet hU' + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hU_le le_rfl ?_ hEU' + have hW_U : W ⊆ (A₁ ∪ A₂ ∪ A₃).vertexSet := + hW₁.trans (Set.inter_subset_left.trans + (Set.subset_union_left.trans Set.subset_union_left)) + calc + (A₁ ∪ A₂ ∪ A₃).vertexSet + = ((A₁ ∪ A₂ ∪ A₃).vertexSet \ W) ∪ W := (Set.sdiff_union_of_subset hW_U).symm + _ = ((A₁.vertexSet \ W) ∪ (A₂.vertexSet \ W) ∪ (A₃.vertexSet \ W)) ∪ W := by + simp [Set.union_sdiff_distrib] + _ = (G.vertexSet \ W) ∪ W := by rw [hVU'] + _ = G.vertexSet := Set.sdiff_union_of_subset hW + axiom3 A' B' h hVA' := by + rcases h.2 with ⟨⟨A, B⟩, hm, hW_AB, hAW, hBW⟩ + dsimp only at hm hW_AB hAW hBW + subst hAW hBW + apply h𝒯.axiom3 hm + have hWA : W ⊆ A.vertexSet := hW_AB.trans Set.inter_subset_left + have hVA'_eq : A.vertexSet \ W = G.vertexSet \ W := hVA' + calc + A.vertexSet = (A.vertexSet \ W) ∪ W := (Set.sdiff_union_of_subset hWA).symm + _ = (G.vertexSet \ W) ∪ W := by rw [hVA'_eq] + _ = G.vertexSet := Set.sdiff_union_of_subset hW + +/-- **Graph Minors X, (6.3)** (page 171): +"(6.3) *Let $\mathscr{T}, \theta, G, W$ be as in (6.2), and let $(A, B)$ be a separation of $G$. +Then $(A/W, B/W) \in \mathscr{T}/W$ if and only if $(A, B) \in \mathscr{T}$ and +$|V(A \cap B) - W| < \theta - |W|$.*" -/ +theorem theorem_6_3_proof {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {W : Set α} (hW : W ⊆ G.vertexSet) (hW_lt : W.ncard < θ) + {A B : Hypergraph α β} (hsep : G.IsSeparation A B) : + (quotientVertices A W, quotientVertices B W) ∈ quotientTangle G 𝒯 W ↔ + (A, B) ∈ 𝒯 ∧ ((A ∩ B).vertexSet \ W).ncard < θ - W.ncard := by + let A' := quotientVertices A W + let B' := quotientVertices B W + have hsep' : (quotientVertices G W).IsSeparation A' B' := + IsSeparation.quotientVertices hsep W + let A₁ := liftQuotientSubhypergraph G W hW A' hsep'.left_le + let B₁ := liftQuotientSubhypergraph G W hW B' hsep'.right_le + have hsep₁ : G.IsSeparation A₁ B₁ := liftQuotientSubhypergraph_isSeparation hW hsep' + have hord₁ : separationOrder A₁ B₁ = ((A ∩ B).vertexSet \ W).ncard + W.ncard := by + rw [liftQuotientSubhypergraph_separationOrder hW hsep', + separationOrder_quotientVertices] + have hVA_sub : A.vertexSet ⊆ A₁.vertexSet := by + intro v hv + change v ∈ (A.vertexSet \ W) ∪ W + by_cases hvW : v ∈ W + · exact Or.inr hvW + · exact Or.inl ⟨hv, hvW⟩ + have hVB_sub : B.vertexSet ⊆ B₁.vertexSet := by + intro v hv + change v ∈ (B.vertexSet \ W) ∪ W + by_cases hvW : v ∈ W + · exact Or.inr hvW + · exact Or.inl ⟨hv, hvW⟩ + have hord_le : separationOrder A B ≤ separationOrder A₁ B₁ := + Set.ncard_le_ncard (Set.inter_subset_inter hVA_sub hVB_sub) (A₁ ∩ B₁).vertexSet_finite + constructor + · rintro ⟨_, ⟨A₂, B₂⟩, hm₂, hW₂, hA₂, hB₂⟩ + dsimp only at hm₂ hW₂ hA₂ hB₂ + have hsep₂ := h𝒯.isSeparation hm₂ + have hA₂_eq : A₂ = A₁ := by + have := eq_liftQuotientSubhypergraph_of_subset hW hsep₂.left_le + (hW₂.trans Set.inter_subset_left) + simpa [A₁, A', hA₂] using this + have hB₂_eq : B₂ = B₁ := by + have := eq_liftQuotientSubhypergraph_of_subset hW hsep₂.right_le + (hW₂.trans Set.inter_subset_right) + simpa [B₁, B', hB₂] using this + have hm₁ : (A₁, B₁) ∈ 𝒯 := hA₂_eq ▸ hB₂_eq ▸ hm₂ + have hlt₁ : separationOrder A₁ B₁ < θ := h𝒯.order_lt hm₁ + have hordAB : separationOrder A B < θ := hord_le.trans_lt hlt₁ + have hmAB : (A, B) ∈ 𝒯 := + theorem_2_9_proof h𝒯 hm₁ hsep hordAB (Or.inr (Or.inl hVA_sub)) + exact ⟨hmAB, by omega⟩ + · rintro ⟨hmAB, hlt⟩ + have hlt₁ : separationOrder A₁ B₁ < θ := by omega + have hm₁ : (A₁, B₁) ∈ 𝒯 := + theorem_2_9_proof h𝒯 hmAB hsep₁ hlt₁ (Or.inl hVB_sub) + refine ⟨hsep', ⟨(A₁, B₁), hm₁, + Set.subset_inter Set.subset_union_right Set.subset_union_right, + quotientVertices_liftQuotientSubhypergraph hW hsep'.left_le, + quotientVertices_liftQuotientSubhypergraph hW hsep'.right_le⟩⟩ + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/Section7.lean b/LeanPool/GraphMinor/GM10/Section7.lean new file mode 100644 index 0000000000..e6c93211de --- /dev/null +++ b/LeanPool/GraphMinor/GM10/Section7.lean @@ -0,0 +1,1193 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Defs2 +import LeanPool.GraphMinor.GM10.TangleLemmas +import Mathlib.Algebra.Order.BigOperators.Group.Finset + +/-! +# A Tangle in a Grid (Graph Minors X, Section 7) + +This file formalizes Section 7 of N. Robertson and P. D. Seymour, +*Graph Minors. X. Obstructions to tree-decomposition*, J. Combin. Theory Ser. B 52 (1991) 153–190 +(pages 171–173): + +- Structural lemmas on the `θ`-grid hypergraph `gridHypergraph θ`, its row paths `gridRowPath θ i`, + its column paths `gridColPath θ j`, and the edge boundary `edgeBoundary (gridHypergraph θ) X`. +- `theorem_7_1` (**Graph Minors X, (7.1)**, page 171): for `X ⊆ E(G)` with `|∂(X)| < θ`, `X` + includes `E(Pᵢ)` for some `i` if and only if `X` includes `E(Qⱼ)` for some `j`. +- `theorem_7_2` (**Graph Minors X, (7.2)**, page 172, Kleitman–Saks lemma): if + `X₁ ∪ X₂ ∪ X₃ = E(G)`, then not all of `X₁, X₂, X₃` are small in `G`. +- `theorem_7_3` (**Graph Minors X, (7.3)**, page 173): `gridTangle θ` is a tangle in + `gridHypergraph θ` of order `θ` for `θ ≥ 2`. +-/ + +public section + +namespace GraphMinor.GM10 + +open Graph SimpleGraph Hypergraph + +/-! ## Basic properties of `gridHypergraph`, `gridRowPath`, and `gridColPath` -/ + +/-- The underlying simple graph `pathGraph θ □ pathGraph θ` of the `θ`-grid. -/ +private abbrev gridSimpleGraph (θ : ℕ) : SimpleGraph (Fin θ × Fin θ) := + pathGraph θ □ pathGraph θ + +@[simp] +theorem gridHypergraph_vertexSet (θ : ℕ) : + (gridHypergraph θ).vertexSet = Set.univ := rfl + +@[simp] +theorem gridHypergraph_edgeSet (θ : ℕ) : + (gridHypergraph θ).edgeSet = (pathGraph θ □ pathGraph θ).edgeSet := rfl + +theorem gridHypergraph_inc_iff {θ : ℕ} {e : Sym2 (Fin θ × Fin θ)} {v : Fin θ × Fin θ} : + (gridHypergraph θ).Inc e v ↔ + e ∈ (pathGraph θ □ pathGraph θ).edgeSet ∧ v ∈ e := by + change (Graph.ofSimpleGraph (gridSimpleGraph θ)).Inc e v ↔ + e ∈ (gridSimpleGraph θ).edgeSet ∧ v ∈ e + constructor + · rintro ⟨w, rfl, he⟩ + exact ⟨he, Sym2.mem_mk_left v w⟩ + · rintro ⟨he, hv⟩ + obtain ⟨w, rfl⟩ := Sym2.mem_iff_exists.1 hv + exact ⟨w, rfl, he⟩ + +theorem gridHypergraph_inc_sym2 {θ : ℕ} {u w v : Fin θ × Fin θ} : + (gridHypergraph θ).Inc s(u, w) v ↔ + (pathGraph θ □ pathGraph θ).Adj u w ∧ (v = u ∨ v = w) := by + rw [gridHypergraph_inc_iff, SimpleGraph.mem_edgeSet, Sym2.mem_iff] + +@[simp] +theorem gridRowPath_vertexSet (θ : ℕ) (i : Fin θ) : + (gridRowPath θ i).vertexSet = {v : Fin θ × Fin θ | v.1 = i} := rfl + +@[simp] +theorem gridColPath_vertexSet (θ : ℕ) (j : Fin θ) : + (gridColPath θ j).vertexSet = {v : Fin θ × Fin θ | v.2 = j} := rfl + +/-- Construct a horizontal edge in row `i` between columns `a` and `a + 1`. -/ +private def rowEdge {θ : ℕ} (i : Fin θ) (a : ℕ) (ha : a + 1 < θ) : Sym2 (Fin θ × Fin θ) := + s((i, ⟨a, Nat.lt_of_succ_lt ha⟩), (i, ⟨a + 1, ha⟩)) + +/-- Construct a vertical edge in column `j` between rows `a` and `a + 1`. -/ +private def colEdge {θ : ℕ} (j : Fin θ) (a : ℕ) (ha : a + 1 < θ) : Sym2 (Fin θ × Fin θ) := + s((⟨a, Nat.lt_of_succ_lt ha⟩, j), (⟨a + 1, ha⟩, j)) + +private theorem rowEdge_adj {θ : ℕ} (i : Fin θ) (a : ℕ) (ha : a + 1 < θ) : + (gridSimpleGraph θ).Adj (i, ⟨a, Nat.lt_of_succ_lt ha⟩) (i, ⟨a + 1, ha⟩) := by + rw [boxProd_adj] + right + exact ⟨pathGraph_adj.2 (Or.inl rfl), rfl⟩ + +private theorem colEdge_adj {θ : ℕ} (j : Fin θ) (a : ℕ) (ha : a + 1 < θ) : + (gridSimpleGraph θ).Adj (⟨a, Nat.lt_of_succ_lt ha⟩, j) (⟨a + 1, ha⟩, j) := by + rw [boxProd_adj] + left + exact ⟨pathGraph_adj.2 (Or.inl rfl), rfl⟩ + +private theorem rowEdge_mem_gridRowPath {θ : ℕ} (i : Fin θ) (a : ℕ) (ha : a + 1 < θ) : + rowEdge i a ha ∈ (gridRowPath θ i).edgeSet := by + refine ⟨rowEdge_adj i a ha, ?_⟩ + intro v hv + rw [rowEdge, gridHypergraph_inc_sym2] at hv + rcases hv.2 with rfl | rfl <;> rfl + +private theorem colEdge_mem_gridColPath {θ : ℕ} (j : Fin θ) (a : ℕ) (ha : a + 1 < θ) : + colEdge j a ha ∈ (gridColPath θ j).edgeSet := by + refine ⟨colEdge_adj j a ha, ?_⟩ + intro v hv + rw [colEdge, gridHypergraph_inc_sym2] at hv + rcases hv.2 with rfl | rfl <;> rfl + +private theorem rowEdge_mem_gridHypergraph {θ : ℕ} (i : Fin θ) (a : ℕ) (ha : a + 1 < θ) : + rowEdge i a ha ∈ (gridHypergraph θ).edgeSet := + (rowEdge_mem_gridRowPath i a ha).1 + +private theorem colEdge_mem_gridHypergraph {θ : ℕ} (j : Fin θ) (a : ℕ) (ha : a + 1 < θ) : + colEdge j a ha ∈ (gridHypergraph θ).edgeSet := + (colEdge_mem_gridColPath j a ha).1 + +private theorem rowEdge_inc_left {θ : ℕ} (i : Fin θ) (a : ℕ) (ha : a + 1 < θ) : + (gridHypergraph θ).Inc (rowEdge i a ha) (i, ⟨a, Nat.lt_of_succ_lt ha⟩) := + gridHypergraph_inc_sym2.2 ⟨rowEdge_adj i a ha, Or.inl rfl⟩ + +private theorem rowEdge_inc_right {θ : ℕ} (i : Fin θ) (a : ℕ) (ha : a + 1 < θ) : + (gridHypergraph θ).Inc (rowEdge i a ha) (i, ⟨a + 1, ha⟩) := + gridHypergraph_inc_sym2.2 ⟨rowEdge_adj i a ha, Or.inr rfl⟩ + +private theorem colEdge_inc_left {θ : ℕ} (j : Fin θ) (a : ℕ) (ha : a + 1 < θ) : + (gridHypergraph θ).Inc (colEdge j a ha) (⟨a, Nat.lt_of_succ_lt ha⟩, j) := + gridHypergraph_inc_sym2.2 ⟨colEdge_adj j a ha, Or.inl rfl⟩ + +private theorem colEdge_inc_right {θ : ℕ} (j : Fin θ) (a : ℕ) (ha : a + 1 < θ) : + (gridHypergraph θ).Inc (colEdge j a ha) (⟨a + 1, ha⟩, j) := + gridHypergraph_inc_sym2.2 ⟨colEdge_adj j a ha, Or.inr rfl⟩ + +/-- Every edge of `gridRowPath θ i` is `rowEdge i a ha` for some `a` with `a + 1 < θ`. -/ +private theorem mem_gridRowPath_edgeSet_iff {θ : ℕ} {i : Fin θ} {e : Sym2 (Fin θ × Fin θ)} : + e ∈ (gridRowPath θ i).edgeSet ↔ + ∃ (a : ℕ) (ha : a + 1 < θ), e = rowEdge i a ha := by + constructor + · rintro ⟨he, hrow⟩ + induction e using Sym2.ind with | _ u w => + have hadj : (gridSimpleGraph θ).Adj u w := he + have hu : u.1 = i := hrow u (gridHypergraph_inc_sym2.2 ⟨hadj, Or.inl rfl⟩) + have hw : w.1 = i := hrow w (gridHypergraph_inc_sym2.2 ⟨hadj, Or.inr rfl⟩) + rcases boxProd_adj.1 hadj with ⟨h1, _⟩ | ⟨h2, _⟩ + · exfalso + have huw : u.1 = w.1 := hu.trans hw.symm + exact (pathGraph θ).loopless.irrefl u.1 (huw ▸ h1) + · rcases pathGraph_adj.1 h2 with hlt | hlt + · have ha : u.2.val + 1 < θ := by omega + refine ⟨u.2.val, ha, ?_⟩ + have hu_eq : u = (i, ⟨u.2.val, Nat.lt_of_succ_lt ha⟩) := + Prod.ext hu rfl + have hw_eq : w = (i, ⟨u.2.val + 1, ha⟩) := + Prod.ext hw (Fin.ext hlt.symm) + rw [rowEdge, ← hu_eq, ← hw_eq] + · have ha : w.2.val + 1 < θ := by omega + refine ⟨w.2.val, ha, ?_⟩ + have hw_eq : w = (i, ⟨w.2.val, Nat.lt_of_succ_lt ha⟩) := + Prod.ext hw rfl + have hu_eq : u = (i, ⟨w.2.val + 1, ha⟩) := + Prod.ext hu (Fin.ext hlt.symm) + rw [rowEdge, ← hw_eq, ← hu_eq, Sym2.eq_swap] + · rintro ⟨a, ha, rfl⟩ + exact rowEdge_mem_gridRowPath i a ha + +/-- Every edge of `gridColPath θ j` is `colEdge j a ha` for some `a` with `a + 1 < θ`. -/ +private theorem mem_gridColPath_edgeSet_iff {θ : ℕ} {j : Fin θ} {e : Sym2 (Fin θ × Fin θ)} : + e ∈ (gridColPath θ j).edgeSet ↔ + ∃ (a : ℕ) (ha : a + 1 < θ), e = colEdge j a ha := by + constructor + · rintro ⟨he, hcol⟩ + induction e using Sym2.ind with | _ u w => + have hadj : (gridSimpleGraph θ).Adj u w := he + have hu : u.2 = j := hcol u (gridHypergraph_inc_sym2.2 ⟨hadj, Or.inl rfl⟩) + have hw : w.2 = j := hcol w (gridHypergraph_inc_sym2.2 ⟨hadj, Or.inr rfl⟩) + rcases boxProd_adj.1 hadj with ⟨h1, _⟩ | ⟨h2, _⟩ + · rcases pathGraph_adj.1 h1 with hlt | hlt + · have ha : u.1.val + 1 < θ := by omega + refine ⟨u.1.val, ha, ?_⟩ + have hu_eq : u = (⟨u.1.val, Nat.lt_of_succ_lt ha⟩, j) := + Prod.ext rfl hu + have hw_eq : w = (⟨u.1.val + 1, ha⟩, j) := + Prod.ext (Fin.ext hlt.symm) hw + rw [colEdge, ← hu_eq, ← hw_eq] + · have ha : w.1.val + 1 < θ := by omega + refine ⟨w.1.val, ha, ?_⟩ + have hw_eq : w = (⟨w.1.val, Nat.lt_of_succ_lt ha⟩, j) := + Prod.ext rfl hw + have hu_eq : u = (⟨w.1.val + 1, ha⟩, j) := + Prod.ext (Fin.ext hlt.symm) hu + rw [colEdge, ← hw_eq, ← hu_eq, Sym2.eq_swap] + · exfalso + have huw : u.2 = w.2 := hu.trans hw.symm + exact (pathGraph θ).loopless.irrefl u.2 (huw ▸ h2) + · rintro ⟨a, ha, rfl⟩ + exact colEdge_mem_gridColPath j a ha + +/-- Every vertex `(i, j)` in a `θ`-grid with `θ ≥ 2` is incident with an edge of `gridRowPath θ i`. +-/ +private theorem exists_mem_gridRowPath_inc {θ : ℕ} (hθ : 2 ≤ θ) (i j : Fin θ) : + ∃ e ∈ (gridRowPath θ i).edgeSet, (gridHypergraph θ).Inc e (i, j) := by + by_cases hj : j.val + 1 < θ + · exact ⟨rowEdge i j.val hj, rowEdge_mem_gridRowPath i j.val hj, rowEdge_inc_left i j.val hj⟩ + · have hj_pos : 0 < j.val := by omega + have ha : (j.val - 1) + 1 < θ := by + rw [Nat.sub_add_cancel hj_pos] + exact j.isLt + refine ⟨rowEdge i (j.val - 1) ha, rowEdge_mem_gridRowPath i (j.val - 1) ha, ?_⟩ + have hjeq : (⟨(j.val - 1) + 1, ha⟩ : Fin θ) = j := Fin.ext (Nat.sub_add_cancel hj_pos) + simpa [hjeq] using rowEdge_inc_right i (j.val - 1) ha + +/-- Every vertex `(i, j)` in a `θ`-grid with `θ ≥ 2` is incident with an edge of `gridColPath θ j`. +-/ +private theorem exists_mem_gridColPath_inc {θ : ℕ} (hθ : 2 ≤ θ) (i j : Fin θ) : + ∃ e ∈ (gridColPath θ j).edgeSet, (gridHypergraph θ).Inc e (i, j) := by + by_cases hi : i.val + 1 < θ + · exact ⟨colEdge j i.val hi, colEdge_mem_gridColPath j i.val hi, colEdge_inc_left j i.val hi⟩ + · have hi_pos : 0 < i.val := by omega + have ha : (i.val - 1) + 1 < θ := by + rw [Nat.sub_add_cancel hi_pos] + exact i.isLt + refine ⟨colEdge j (i.val - 1) ha, colEdge_mem_gridColPath j (i.val - 1) ha, ?_⟩ + have hieq : (⟨(i.val - 1) + 1, ha⟩ : Fin θ) = i := Fin.ext (Nat.sub_add_cancel hi_pos) + simpa [hieq] using colEdge_inc_right j (i.val - 1) ha + +/-! ## Boundary vertices along a column or row -/ + +private theorem mem_edgeBoundary_gridHypergraph_iff {θ : ℕ} + {X : Set (Sym2 (Fin θ × Fin θ))} {v : Fin θ × Fin θ} : + v ∈ edgeBoundary (gridHypergraph θ) X ↔ + (∃ e ∈ X, (gridHypergraph θ).Inc e v) ∧ + (∃ e ∈ (gridHypergraph θ).edgeSet \ X, (gridHypergraph θ).Inc e v) := by + simp [edgeBoundary] + +/-- If `(i₀, j)` is incident with an edge in `X`, and `colEdge j a ha ∉ X` with `i₀.val ≤ a`, then +there is a vertex `(i₁, j) ∈ edgeBoundary (gridHypergraph θ) X` with `i₀.val ≤ i₁.val ≤ a`. -/ +private theorem exists_le_mem_edgeBoundary_col {θ : ℕ} {X : Set (Sym2 (Fin θ × Fin θ))} + (j : Fin θ) {i₀ : Fin θ} (hX₀ : ∃ e ∈ X, (gridHypergraph θ).Inc e (i₀, j)) + {a : ℕ} (ha : a + 1 < θ) (hia : i₀.val ≤ a) (hna : colEdge j a ha ∉ X) : + ∃ i₁ : Fin θ, i₀.val ≤ i₁.val ∧ i₁.val ≤ a ∧ + (i₁, j) ∈ edgeBoundary (gridHypergraph θ) X := by + classical + have hex : ∃ b : ℕ, i₀.val ≤ b ∧ b ≤ a ∧ ∃ hb : b + 1 < θ, colEdge j b hb ∉ X := + ⟨a, hia, le_rfl, ha, hna⟩ + let b := Nat.find hex + obtain ⟨hib, hba, hb, hnb⟩ := Nat.find_spec hex + let i₁ : Fin θ := ⟨b, Nat.lt_of_succ_lt hb⟩ + refine ⟨i₁, hib, hba, mem_edgeBoundary_gridHypergraph_iff.2 ⟨?_, ?_⟩⟩ + · rcases eq_or_lt_of_le hib with heq | hlt + · have hi₁ : i₁ = i₀ := Fin.ext heq.symm + rwa [hi₁] + · have hlt_find : b - 1 < b := Nat.sub_lt (Nat.zero_lt_of_lt hlt) Nat.one_pos + have hmin := Nat.find_min hex hlt_find + have hb1_lt : (b - 1) + 1 < θ := by + rw [Nat.sub_add_cancel (Nat.one_le_of_lt hlt)] + exact Nat.lt_of_succ_lt hb + have hmemX : colEdge j (b - 1) hb1_lt ∈ X := by + by_contra hnotX + exact hmin ⟨Nat.le_sub_one_of_lt hlt, (Nat.sub_le b 1).trans hba, hb1_lt, hnotX⟩ + refine ⟨colEdge j (b - 1) hb1_lt, hmemX, ?_⟩ + have heq_b : (⟨(b - 1) + 1, hb1_lt⟩ : Fin θ) = i₁ := + Fin.ext (Nat.sub_add_cancel (Nat.one_le_of_lt hlt)) + simpa [heq_b] using colEdge_inc_right j (b - 1) hb1_lt + · exact ⟨colEdge j b hb, ⟨colEdge_mem_gridHypergraph j b hb, hnb⟩, colEdge_inc_left j b hb⟩ + +/-- If `(i₀, j)` is incident with an edge in `X`, and `colEdge j a ha ∉ X` with `a < i₀.val`, then +there is a vertex `(i₂, j) ∈ edgeBoundary (gridHypergraph θ) X` with `a < i₂.val ≤ i₀.val`. -/ +private theorem exists_gt_mem_edgeBoundary_col {θ : ℕ} {X : Set (Sym2 (Fin θ × Fin θ))} + (j : Fin θ) {i₀ : Fin θ} (hX₀ : ∃ e ∈ X, (gridHypergraph θ).Inc e (i₀, j)) + {a : ℕ} (ha : a + 1 < θ) (hai : a < i₀.val) (hna : colEdge j a ha ∉ X) : + ∃ i₂ : Fin θ, a < i₂.val ∧ i₂.val ≤ i₀.val ∧ + (i₂, j) ∈ edgeBoundary (gridHypergraph θ) X := by + classical + have hex : ∃ d : ℕ, d ≤ i₀.val - 1 - a ∧ + ∃ hd : (i₀.val - 1 - d) + 1 < θ, colEdge j (i₀.val - 1 - d) hd ∉ X := by + refine ⟨i₀.val - 1 - a, le_rfl, ?_⟩ + have heq : i₀.val - 1 - (i₀.val - 1 - a) = a := by omega + rw [heq] + exact ⟨ha, hna⟩ + let d := Nat.find hex + obtain ⟨hda, hd, hnd⟩ := Nat.find_spec hex + let b := i₀.val - 1 - d + let i₂ : Fin θ := ⟨b + 1, hd⟩ + have hab : a < b + 1 := by omega + have hbi : b + 1 ≤ i₀.val := by omega + refine ⟨i₂, hab, hbi, mem_edgeBoundary_gridHypergraph_iff.2 ⟨?_, ?_⟩⟩ + · rcases eq_or_lt_of_le (Nat.zero_le d) with hd0 | hd_pos + · have hi₂ : i₂ = i₀ := by + ext + dsimp [i₂, b] + omega + rwa [hi₂] + · have hlt_find : d - 1 < d := Nat.sub_lt hd_pos Nat.one_pos + have hmin := Nat.find_min hex hlt_find + have hb1_eq : i₀.val - 1 - (d - 1) = b + 1 := by omega + have hb1_lt : (b + 1) + 1 < θ := by + have : b + 2 ≤ i₀.val := by omega + exact Nat.lt_of_le_of_lt this i₀.isLt + have hmemX : colEdge j (b + 1) hb1_lt ∈ X := by + by_contra hnotX + apply hmin + refine ⟨by omega, ?_⟩ + rw [hb1_eq] + exact ⟨hb1_lt, hnotX⟩ + exact ⟨colEdge j (b + 1) hb1_lt, hmemX, colEdge_inc_left j (b + 1) hb1_lt⟩ + · exact ⟨colEdge j b hd, ⟨colEdge_mem_gridHypergraph j b hd, hnd⟩, colEdge_inc_right j b hd⟩ + +/-- If `V(Qⱼ)` contains a vertex incident with an edge in `X` and `¬ E(Qⱼ) ⊆ X`, then `V(Qⱼ)` +meets `∂(X)`. -/ +private theorem gridColPath_meets_edgeBoundary {θ : ℕ} {X : Set (Sym2 (Fin θ × Fin θ))} + (j : Fin θ) {i₀ : Fin θ} (hX₀ : ∃ e ∈ X, (gridHypergraph θ).Inc e (i₀, j)) + (hnot : ¬ (gridColPath θ j).edgeSet ⊆ X) : + ((gridColPath θ j).vertexSet ∩ edgeBoundary (gridHypergraph θ) X).Nonempty := by + obtain ⟨e, heQ, heX⟩ := Set.not_subset.1 hnot + obtain ⟨a, ha, rfl⟩ := mem_gridColPath_edgeSet_iff.1 heQ + rcases le_or_gt i₀.val a with hle | hgt + · obtain ⟨i₁, _, _, hmem⟩ := exists_le_mem_edgeBoundary_col j hX₀ ha hle heX + exact ⟨(i₁, j), rfl, hmem⟩ + · obtain ⟨i₂, _, _, hmem⟩ := exists_gt_mem_edgeBoundary_col j hX₀ ha hgt heX + exact ⟨(i₂, j), rfl, hmem⟩ + +/-- If both ends `(0, j)` and `(θ - 1, j)` of `Qⱼ` are incident with edges in `X` and +`¬ E(Qⱼ) ⊆ X`, then `|V(Qⱼ) ∩ ∂(X)| ≥ 2` (Graph Minors X, Section 7, proof of (7.2), page 172). -/ +private theorem two_le_ncard_gridColPath_inter_edgeBoundary {θ : ℕ} (hθ : 2 ≤ θ) + {X : Set (Sym2 (Fin θ × Fin θ))} (j : Fin θ) + (hX_top : ∃ e ∈ X, (gridHypergraph θ).Inc e (⟨0, by omega⟩, j)) + (hX_bot : ∃ e ∈ X, (gridHypergraph θ).Inc e (⟨θ - 1, by omega⟩, j)) + (hnot : ¬ (gridColPath θ j).edgeSet ⊆ X) : + 2 ≤ ((gridColPath θ j).vertexSet ∩ edgeBoundary (gridHypergraph θ) X).ncard := by + obtain ⟨e, heQ, heX⟩ := Set.not_subset.1 hnot + obtain ⟨a, ha, rfl⟩ := mem_gridColPath_edgeSet_iff.1 heQ + obtain ⟨i₁, _, hi₁a, hmem₁⟩ := + exists_le_mem_edgeBoundary_col j hX_top ha (Nat.zero_le a) heX + obtain ⟨i₂, hai₂, _, hmem₂⟩ := + exists_gt_mem_edgeBoundary_col j hX_bot ha (by dsimp; omega) heX + have hne : (i₁, j) ≠ (i₂, j) := by + intro h + have : i₁.val = i₂.val := congrArg (fun p : Fin θ × Fin θ ↦ p.1.val) h + omega + have hsub : ({(i₁, j), (i₂, j)} : Set (Fin θ × Fin θ)) ⊆ + (gridColPath θ j).vertexSet ∩ edgeBoundary (gridHypergraph θ) X := by + rintro v (rfl | rfl) + · exact ⟨rfl, hmem₁⟩ + · exact ⟨rfl, hmem₂⟩ + have hcard : ({(i₁, j), (i₂, j)} : Set (Fin θ × Fin θ)).ncard = 2 := + Set.ncard_pair hne + rw [← hcard] + exact Set.ncard_le_ncard hsub (Set.toFinite _) + +/-! ## Row-column transpose symmetry -/ + +/-- Swapping the two coordinates of `Fin θ × Fin θ` induces an involution on edges of the +`θ`-grid. -/ +private def swapEdge (θ : ℕ) (e : Sym2 (Fin θ × Fin θ)) : Sym2 (Fin θ × Fin θ) := + Sym2.map Prod.swap e + +@[simp] +private theorem swapEdge_swapEdge {θ : ℕ} (e : Sym2 (Fin θ × Fin θ)) : + swapEdge θ (swapEdge θ e) = e := by + induction e using Sym2.ind with | _ x y => + simp [swapEdge] + +private theorem gridSimpleGraph_adj_swap {θ : ℕ} {u v : Fin θ × Fin θ} : + (gridSimpleGraph θ).Adj u.swap v.swap ↔ (gridSimpleGraph θ).Adj u v := by + simp [gridSimpleGraph, boxProd_adj, or_comm] + +private theorem swapEdge_mem_gridHypergraph {θ : ℕ} {e : Sym2 (Fin θ × Fin θ)} : + swapEdge θ e ∈ (gridHypergraph θ).edgeSet ↔ e ∈ (gridHypergraph θ).edgeSet := by + induction e using Sym2.ind with | _ u v => + exact gridSimpleGraph_adj_swap + +private theorem gridHypergraph_inc_swapEdge {θ : ℕ} {e : Sym2 (Fin θ × Fin θ)} + {v : Fin θ × Fin θ} : + (gridHypergraph θ).Inc (swapEdge θ e) v.swap ↔ (gridHypergraph θ).Inc e v := by + have h1 : (gridHypergraph θ).Inc (swapEdge θ e) v.swap ↔ + swapEdge θ e ∈ (gridSimpleGraph θ).edgeSet ∧ v.swap ∈ swapEdge θ e := gridHypergraph_inc_iff + have h2 : (gridHypergraph θ).Inc e v ↔ + e ∈ (gridSimpleGraph θ).edgeSet ∧ v ∈ e := gridHypergraph_inc_iff + rw [h1, h2] + refine and_congr swapEdge_mem_gridHypergraph ?_ + induction e using Sym2.ind with | _ x y => + simp [swapEdge, Prod.swap_inj] + +private theorem swapEdge_mem_gridColPath_iff {θ : ℕ} {j : Fin θ} {e : Sym2 (Fin θ × Fin θ)} : + swapEdge θ e ∈ (gridColPath θ j).edgeSet ↔ e ∈ (gridRowPath θ j).edgeSet := by + simp only [gridRowPath, gridColPath, Set.mem_sep_iff, swapEdge_mem_gridHypergraph] + refine and_congr_right fun _ ↦ ⟨fun h v hv ↦ ?_, fun h v hv ↦ ?_⟩ + · simpa using h v.swap (gridHypergraph_inc_swapEdge.2 hv) + · have hv' : (gridHypergraph θ).Inc e v.swap := + (gridHypergraph_inc_swapEdge (v := v.swap)).1 (by simpa using hv) + exact h v.swap hv' + +private theorem mem_edgeBoundary_preimage_swapEdge {θ : ℕ} {X : Set (Sym2 (Fin θ × Fin θ))} + {v : Fin θ × Fin θ} : + v ∈ edgeBoundary (gridHypergraph θ) (swapEdge θ ⁻¹' X) ↔ + v.swap ∈ edgeBoundary (gridHypergraph θ) X := by + rw [mem_edgeBoundary_gridHypergraph_iff, mem_edgeBoundary_gridHypergraph_iff] + constructor + · rintro ⟨⟨e₁, he₁, hinc₁⟩, ⟨e₂, ⟨he₂G, he₂X⟩, hinc₂⟩⟩ + exact ⟨⟨swapEdge θ e₁, he₁, gridHypergraph_inc_swapEdge.2 hinc₁⟩, + ⟨swapEdge θ e₂, ⟨swapEdge_mem_gridHypergraph.2 he₂G, he₂X⟩, + gridHypergraph_inc_swapEdge.2 hinc₂⟩⟩ + · rintro ⟨⟨e₁, he₁, hinc₁⟩, ⟨e₂, ⟨he₂G, he₂X⟩, hinc₂⟩⟩ + refine ⟨⟨swapEdge θ e₁, by simpa using he₁, ?_⟩, + ⟨swapEdge θ e₂, ⟨swapEdge_mem_gridHypergraph.2 he₂G, by simpa using he₂X⟩, ?_⟩⟩ + · have := gridHypergraph_inc_swapEdge.2 hinc₁ + simpa using this + · have := gridHypergraph_inc_swapEdge.2 hinc₂ + simpa using this + +private theorem ncard_edgeBoundary_preimage_swapEdge {θ : ℕ} (X : Set (Sym2 (Fin θ × Fin θ))) : + (edgeBoundary (gridHypergraph θ) (swapEdge θ ⁻¹' X)).ncard = + (edgeBoundary (gridHypergraph θ) X).ncard := by + refine Set.ncard_congr (fun v _ ↦ v.swap) + (fun v hv ↦ mem_edgeBoundary_preimage_swapEdge.1 hv) + (fun _ _ _ _ h ↦ Prod.swap_inj.1 h) + (fun w hw ↦ ⟨w.swap, ?_, Prod.swap_swap w⟩) + rw [mem_edgeBoundary_preimage_swapEdge, Prod.swap_swap] + exact hw + +/-- If `V(Pᵢ)` contains a vertex incident with an edge in `X` and `¬ E(Pᵢ) ⊆ X`, then `V(Pᵢ)` +meets `∂(X)`. -/ +private theorem gridRowPath_meets_edgeBoundary {θ : ℕ} {X : Set (Sym2 (Fin θ × Fin θ))} + (i : Fin θ) {j₀ : Fin θ} (hX₀ : ∃ e ∈ X, (gridHypergraph θ).Inc e (i, j₀)) + (hnot : ¬ (gridRowPath θ i).edgeSet ⊆ X) : + ((gridRowPath θ i).vertexSet ∩ edgeBoundary (gridHypergraph θ) X).Nonempty := by + have hX₀' : ∃ e ∈ swapEdge θ ⁻¹' X, (gridHypergraph θ).Inc e (j₀, i) := by + obtain ⟨e, heX, hinc⟩ := hX₀ + refine ⟨swapEdge θ e, by simpa using heX, ?_⟩ + have := gridHypergraph_inc_swapEdge.2 hinc + simpa using this + have hnot' : ¬ (gridColPath θ i).edgeSet ⊆ swapEdge θ ⁻¹' X := by + intro hsub + apply hnot + intro e he + have hm : swapEdge θ e ∈ swapEdge θ ⁻¹' X := hsub (swapEdge_mem_gridColPath_iff.2 he) + simpa using hm + obtain ⟨v, hvQ, hvB⟩ := gridColPath_meets_edgeBoundary i hX₀' hnot' + exact ⟨v.swap, hvQ, mem_edgeBoundary_preimage_swapEdge.1 hvB⟩ + +/-! ## Proof of (7.1) -/ + +/-- Forward direction of **Graph Minors X, (7.1)** (page 171): if `|∂(X)| < θ` and `E(Pᵢ) ⊆ X` for +some `i`, then `E(Qⱼ) ⊆ X` for some `j`. -/ +private theorem theorem_7_1_mp {θ : ℕ} (hθ : 2 ≤ θ) {X : Set (Sym2 (Fin θ × Fin θ))} + (hB : (edgeBoundary (gridHypergraph θ) X).ncard < θ) + (hP : ∃ i : Fin θ, (gridRowPath θ i).edgeSet ⊆ X) : + ∃ j : Fin θ, (gridColPath θ j).edgeSet ⊆ X := by + obtain ⟨i, hi⟩ := hP + by_contra! hno + have hmeet : ∀ j : Fin θ, + ((gridColPath θ j).vertexSet ∩ edgeBoundary (gridHypergraph θ) X).Nonempty := by + intro j + obtain ⟨e, heP, hinc⟩ := exists_mem_gridRowPath_inc hθ i j + exact gridColPath_meets_edgeBoundary j ⟨e, hi heP, hinc⟩ (hno j) + choose f hf using hmeet + have hinj : Function.Injective f := by + intro j₁ j₂ heq + have h₁ : (f j₁).2 = j₁ := (hf j₁).1 + have h₂ : (f j₂).2 = j₂ := (hf j₂).1 + rw [← h₁, ← h₂, heq] + have hsub : Set.range f ⊆ edgeBoundary (gridHypergraph θ) X := by + rintro _ ⟨j, rfl⟩ + exact (hf j).2 + have hcard_range : (Set.range f).ncard = θ := by + rw [Set.ncard_range_of_injective hinj, Nat.card_eq_fintype_card, Fintype.card_fin] + have hle : (Set.range f).ncard ≤ (edgeBoundary (gridHypergraph θ) X).ncard := + Set.ncard_le_ncard hsub (Set.toFinite _) + omega + +private theorem theorem_7_1_iff {θ : ℕ} (hθ : 2 ≤ θ) {X : Set (Sym2 (Fin θ × Fin θ))} + (hB : (edgeBoundary (gridHypergraph θ) X).ncard < θ) : + (∃ i : Fin θ, (gridRowPath θ i).edgeSet ⊆ X) ↔ + (∃ j : Fin θ, (gridColPath θ j).edgeSet ⊆ X) := by + constructor + · exact theorem_7_1_mp hθ hB + · intro ⟨j, hj⟩ + have hB' : (edgeBoundary (gridHypergraph θ) (swapEdge θ ⁻¹' X)).ncard < θ := by + rwa [ncard_edgeBoundary_preimage_swapEdge] + have hP' : ∃ i : Fin θ, (gridRowPath θ i).edgeSet ⊆ swapEdge θ ⁻¹' X := by + refine ⟨j, fun e he ↦ ?_⟩ + change swapEdge θ e ∈ X + exact hj (swapEdge_mem_gridColPath_iff.2 he) + obtain ⟨i, hi⟩ := theorem_7_1_mp hθ hB' hP' + refine ⟨i, fun e he ↦ ?_⟩ + have hm : swapEdge θ e ∈ swapEdge θ ⁻¹' X := hi (swapEdge_mem_gridColPath_iff.2 he) + simpa using hm + +/-- **Graph Minors X, (7.1)** (page 171): +"If $X \subseteq E(G)$ and $|\partial(X)| < \theta$ then $X$ includes $E(P_i)$ for some $i$ +$(1 \le i \le \theta)$ if and only if $X$ includes $E(Q_j)$ for some $j$ $(1 \le j \le +\theta)$." -/ +theorem theorem_7_1_proof {θ : ℕ} (hθ : 2 ≤ θ) {X : Set (Sym2 (Fin θ × Fin θ))} + (_hX : X ⊆ (gridHypergraph θ).edgeSet) + (hB : (edgeBoundary (gridHypergraph θ) X).ncard < θ) : + (∃ i : Fin θ, (gridRowPath θ i).edgeSet ⊆ X) ↔ + (∃ j : Fin θ, (gridColPath θ j).edgeSet ⊆ X) := + theorem_7_1_iff hθ hB + +/-! ## Row-reversal symmetry and column partitioning for (7.2) -/ + +/-- If `X` is small in the `θ`-grid (`θ ≥ 2`), then `X` includes `E(Qⱼ)` for no `j`. -/ +private theorem IsSmallEdgeSet.not_gridColPath_subset {θ : ℕ} (hθ : 2 ≤ θ) + {X : Set (Sym2 (Fin θ × Fin θ))} (hX : IsSmallEdgeSet θ X) (j : Fin θ) : + ¬ (gridColPath θ j).edgeSet ⊆ X := by + intro hj + obtain ⟨i, hi⟩ := (theorem_7_1_iff hθ hX.1).2 ⟨j, hj⟩ + exact hX.2 i hi + +/-- Partitioning a vertex subset `S` of the `θ`-grid by columns: `|S| = ∑ⱼ |V(Qⱼ) ∩ S|`. -/ +private theorem ncard_eq_sum_gridColPath_inter {θ : ℕ} (S : Set (Fin θ × Fin θ)) : + S.ncard = ∑ j : Fin θ, ((gridColPath θ j).vertexSet ∩ S).ncard := by + have hsum : ∀ s : Finset (Fin θ), + (⋃ j ∈ s, ((gridColPath θ j).vertexSet ∩ S)).ncard = + ∑ j ∈ s, ((gridColPath θ j).vertexSet ∩ S).ncard := by + intro s + induction s using Finset.cons_induction_on with + | empty => simp + | cons a s ha ih => + have hbi : (⋃ j ∈ Finset.cons a s ha, (gridColPath θ j).vertexSet ∩ S) = + ((gridColPath θ a).vertexSet ∩ S) ∪ (⋃ j ∈ s, (gridColPath θ j).vertexSet ∩ S) := by + ext + simp + rw [hbi, Finset.sum_cons, ← ih] + refine Set.ncard_union_eq ?_ (Set.toFinite _) (Set.toFinite _) + rw [Set.disjoint_left] + intro v hv₁ hv₂ + simp only [Set.mem_iUnion, Set.mem_inter_iff, gridColPath_vertexSet, + Set.mem_ofPred_eq] at hv₁ hv₂ + obtain ⟨b, hb, hvb, _⟩ := hv₂ + have hab : a = b := hv₁.1.symm.trans hvb + exact ha (hab.symm ▸ hb) + have huniv : (⋃ j ∈ (Finset.univ : Finset (Fin θ)), ((gridColPath θ j).vertexSet ∩ S)) = S := by + ext v + simp only [Set.mem_iUnion, Finset.mem_univ, Set.mem_inter_iff, + gridColPath_vertexSet, Set.mem_ofPred_eq] + exact ⟨fun ⟨_, _, _, hv⟩ ↦ hv, fun hv ↦ ⟨v.2, trivial, rfl, hv⟩⟩ + rw [← hsum Finset.univ, huniv] + +/-- If `X₁ ∪ X₂ ∪ X₃ = E(G)` and `X₁, X₂` are small in `G`, then `X₃` cannot be disjoint from +both `E(P₀)` and `E(P_{θ-1})` (Graph Minors X, Section 7, proof of (7.2), page 172). -/ +private theorem theorem_7_2_claim_top_or_bot_meets {θ : ℕ} (hθ : 2 ≤ θ) + {X₁ X₂ X₃ : Set (Sym2 (Fin θ × Fin θ))} + (hU : X₁ ∪ X₂ ∪ X₃ = (gridHypergraph θ).edgeSet) + (hS₁ : IsSmallEdgeSet θ X₁) (hS₂ : IsSmallEdgeSet θ X₂) : + ((gridRowPath θ ⟨0, by omega⟩).edgeSet ∩ X₃).Nonempty ∨ + ((gridRowPath θ ⟨θ - 1, by omega⟩).edgeSet ∩ X₃).Nonempty := by + by_contra! hempty + rcases hempty with ⟨h0, hlast⟩ + have hj_bound : ∀ j : Fin θ, + 2 ≤ ((gridColPath θ j).vertexSet ∩ edgeBoundary (gridHypergraph θ) X₁).ncard + + ((gridColPath θ j).vertexSet ∩ edgeBoundary (gridHypergraph θ) X₂).ncard := by + intro j + let i_top : Fin θ := ⟨0, by omega⟩ + let i_bot : Fin θ := ⟨θ - 1, by omega⟩ + obtain ⟨e_top, he_topP, hinc_top⟩ := exists_mem_gridRowPath_inc hθ i_top j + obtain ⟨e_bot, he_botP, hinc_bot⟩ := exists_mem_gridRowPath_inc hθ i_bot j + have he_topG : e_top ∈ X₁ ∪ X₂ ∪ X₃ := hU.symm ▸ he_topP.1 + have he_botG : e_bot ∈ X₁ ∪ X₂ ∪ X₃ := hU.symm ▸ he_botP.1 + have he_top12 : e_top ∈ X₁ ∨ e_top ∈ X₂ := by + rcases he_topG with (h1 | h2) | h3 + · exact Or.inl h1 + · exact Or.inr h2 + · exact (Set.notMem_empty e_top (h0 ▸ Set.mem_inter he_topP h3)).elim + have he_bot12 : e_bot ∈ X₁ ∨ e_bot ∈ X₂ := by + rcases he_botG with (h1 | h2) | h3 + · exact Or.inl h1 + · exact Or.inr h2 + · exact (Set.notMem_empty e_bot (hlast ▸ Set.mem_inter he_botP h3)).elim + have hnotQ₁ := hS₁.not_gridColPath_subset hθ j + have hnotQ₂ := hS₂.not_gridColPath_subset hθ j + rcases he_top12 with htop1 | htop2 <;> rcases he_bot12 with hbot1 | hbot2 + · have h2 := two_le_ncard_gridColPath_inter_edgeBoundary hθ j + ⟨e_top, htop1, hinc_top⟩ ⟨e_bot, hbot1, hinc_bot⟩ hnotQ₁ + omega + · have hne1 := gridColPath_meets_edgeBoundary j ⟨e_top, htop1, hinc_top⟩ hnotQ₁ + have hne2 := gridColPath_meets_edgeBoundary j ⟨e_bot, hbot2, hinc_bot⟩ hnotQ₂ + have hc1 : 1 ≤ ((gridColPath θ j).vertexSet ∩ edgeBoundary (gridHypergraph θ) X₁).ncard := + Nat.one_le_iff_ne_zero.2 ((Set.ncard_ne_zero_of_mem hne1.some_mem)) + have hc2 : 1 ≤ ((gridColPath θ j).vertexSet ∩ edgeBoundary (gridHypergraph θ) X₂).ncard := + Nat.one_le_iff_ne_zero.2 ((Set.ncard_ne_zero_of_mem hne2.some_mem)) + omega + · have hne2 := gridColPath_meets_edgeBoundary j ⟨e_top, htop2, hinc_top⟩ hnotQ₂ + have hne1 := gridColPath_meets_edgeBoundary j ⟨e_bot, hbot1, hinc_bot⟩ hnotQ₁ + have hc1 : 1 ≤ ((gridColPath θ j).vertexSet ∩ edgeBoundary (gridHypergraph θ) X₁).ncard := + Nat.one_le_iff_ne_zero.2 ((Set.ncard_ne_zero_of_mem hne1.some_mem)) + have hc2 : 1 ≤ ((gridColPath θ j).vertexSet ∩ edgeBoundary (gridHypergraph θ) X₂).ncard := + Nat.one_le_iff_ne_zero.2 ((Set.ncard_ne_zero_of_mem hne2.some_mem)) + omega + · have h2 := two_le_ncard_gridColPath_inter_edgeBoundary hθ j + ⟨e_top, htop2, hinc_top⟩ ⟨e_bot, hbot2, hinc_bot⟩ hnotQ₂ + omega + have hsum_ge : ∑ _j : Fin θ, 2 ≤ + ∑ j : Fin θ, (((gridColPath θ j).vertexSet ∩ edgeBoundary (gridHypergraph θ) X₁).ncard + + ((gridColPath θ j).vertexSet ∩ edgeBoundary (gridHypergraph θ) X₂).ncard) := + Finset.sum_le_sum fun j _ ↦ hj_bound j + rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin, smul_eq_mul, + Finset.sum_add_distrib, ← ncard_eq_sum_gridColPath_inter, + ← ncard_eq_sum_gridColPath_inter] at hsum_ge + have h1 := hS₁.1 + have h2 := hS₂.1 + omega + +/-- Reversing the row order `(i, j) ↦ (i.rev, j)`. -/ +private def revRowVert {θ : ℕ} (v : Fin θ × Fin θ) : Fin θ × Fin θ := + (v.1.rev, v.2) + +@[simp] +private theorem revRowVert_revRowVert {θ : ℕ} (v : Fin θ × Fin θ) : + revRowVert (revRowVert v) = v := by + ext <;> simp [revRowVert] + +private theorem revRowVert_injective {θ : ℕ} : Function.Injective (@revRowVert θ) := + Function.LeftInverse.injective revRowVert_revRowVert + +private def revRowEdge (θ : ℕ) (e : Sym2 (Fin θ × Fin θ)) : Sym2 (Fin θ × Fin θ) := + Sym2.map revRowVert e + +@[simp] +private theorem revRowEdge_revRowEdge {θ : ℕ} (e : Sym2 (Fin θ × Fin θ)) : + revRowEdge θ (revRowEdge θ e) = e := by + induction e using Sym2.ind with | _ x y => + simp [revRowEdge] + +private theorem pathGraph_adj_rev {θ : ℕ} {i₁ i₂ : Fin θ} : + (pathGraph θ).Adj i₁.rev i₂.rev ↔ (pathGraph θ).Adj i₁ i₂ := by + rw [pathGraph_adj, pathGraph_adj, Fin.val_rev, Fin.val_rev] + have h1 := i₁.isLt + have h2 := i₂.isLt + omega + +private theorem gridSimpleGraph_adj_revRowVert {θ : ℕ} {u v : Fin θ × Fin θ} : + (gridSimpleGraph θ).Adj (revRowVert u) (revRowVert v) ↔ (gridSimpleGraph θ).Adj u v := by + simp [gridSimpleGraph, boxProd_adj, revRowVert, pathGraph_adj_rev] + +private theorem revRowEdge_mem_gridHypergraph {θ : ℕ} {e : Sym2 (Fin θ × Fin θ)} : + revRowEdge θ e ∈ (gridHypergraph θ).edgeSet ↔ e ∈ (gridHypergraph θ).edgeSet := by + induction e using Sym2.ind with | _ u v => + exact gridSimpleGraph_adj_revRowVert + +private theorem gridHypergraph_inc_revRowEdge {θ : ℕ} {e : Sym2 (Fin θ × Fin θ)} + {v : Fin θ × Fin θ} : + (gridHypergraph θ).Inc (revRowEdge θ e) (revRowVert v) ↔ (gridHypergraph θ).Inc e v := by + have h1 : (gridHypergraph θ).Inc (revRowEdge θ e) (revRowVert v) ↔ + revRowEdge θ e ∈ (gridSimpleGraph θ).edgeSet ∧ revRowVert v ∈ revRowEdge θ e := + gridHypergraph_inc_iff + have h2 : (gridHypergraph θ).Inc e v ↔ + e ∈ (gridSimpleGraph θ).edgeSet ∧ v ∈ e := gridHypergraph_inc_iff + rw [h1, h2] + refine and_congr revRowEdge_mem_gridHypergraph ?_ + induction e using Sym2.ind with | _ x y => + simp [revRowEdge, revRowVert_injective.eq_iff] + +private theorem revRowEdge_mem_gridRowPath_iff {θ : ℕ} {i : Fin θ} {e : Sym2 (Fin θ × Fin θ)} : + revRowEdge θ e ∈ (gridRowPath θ i).edgeSet ↔ e ∈ (gridRowPath θ i.rev).edgeSet := by + simp only [gridRowPath, Set.mem_sep_iff, revRowEdge_mem_gridHypergraph] + refine and_congr_right fun _ ↦ ⟨fun h v hv ↦ ?_, fun h v hv ↦ ?_⟩ + · have := h (revRowVert v) (gridHypergraph_inc_revRowEdge.2 hv) + simpa [revRowVert, Fin.rev_eq_iff] using this + · have hv' : (gridHypergraph θ).Inc e (revRowVert v) := + (gridHypergraph_inc_revRowEdge (v := revRowVert v)).1 (by simpa using hv) + have := h (revRowVert v) hv' + simpa [revRowVert, Fin.rev_eq_iff] using this + +private theorem revRowEdge_mem_gridColPath_iff {θ : ℕ} {j : Fin θ} {e : Sym2 (Fin θ × Fin θ)} : + revRowEdge θ e ∈ (gridColPath θ j).edgeSet ↔ e ∈ (gridColPath θ j).edgeSet := by + simp only [gridColPath, Set.mem_sep_iff, revRowEdge_mem_gridHypergraph] + refine and_congr_right fun _ ↦ ⟨fun h v hv ↦ ?_, fun h v hv ↦ ?_⟩ + · simpa [revRowVert] using h (revRowVert v) (gridHypergraph_inc_revRowEdge.2 hv) + · have hv' : (gridHypergraph θ).Inc e (revRowVert v) := + (gridHypergraph_inc_revRowEdge (v := revRowVert v)).1 (by simpa using hv) + simpa [revRowVert] using h (revRowVert v) hv' + +private theorem mem_edgeBoundary_preimage_revRowEdge {θ : ℕ} {X : Set (Sym2 (Fin θ × Fin θ))} + {v : Fin θ × Fin θ} : + v ∈ edgeBoundary (gridHypergraph θ) (revRowEdge θ ⁻¹' X) ↔ + revRowVert v ∈ edgeBoundary (gridHypergraph θ) X := by + rw [mem_edgeBoundary_gridHypergraph_iff, mem_edgeBoundary_gridHypergraph_iff] + constructor + · rintro ⟨⟨e₁, he₁, hinc₁⟩, ⟨e₂, ⟨he₂G, he₂X⟩, hinc₂⟩⟩ + exact ⟨⟨revRowEdge θ e₁, he₁, gridHypergraph_inc_revRowEdge.2 hinc₁⟩, + ⟨revRowEdge θ e₂, ⟨revRowEdge_mem_gridHypergraph.2 he₂G, he₂X⟩, + gridHypergraph_inc_revRowEdge.2 hinc₂⟩⟩ + · rintro ⟨⟨e₁, he₁, hinc₁⟩, ⟨e₂, ⟨he₂G, he₂X⟩, hinc₂⟩⟩ + refine ⟨⟨revRowEdge θ e₁, by simpa using he₁, ?_⟩, + ⟨revRowEdge θ e₂, ⟨revRowEdge_mem_gridHypergraph.2 he₂G, by simpa using he₂X⟩, ?_⟩⟩ + · have := gridHypergraph_inc_revRowEdge.2 hinc₁ + simpa using this + · have := gridHypergraph_inc_revRowEdge.2 hinc₂ + simpa using this + +private theorem ncard_edgeBoundary_preimage_revRowEdge {θ : ℕ} (X : Set (Sym2 (Fin θ × Fin θ))) : + (edgeBoundary (gridHypergraph θ) (revRowEdge θ ⁻¹' X)).ncard = + (edgeBoundary (gridHypergraph θ) X).ncard := by + refine Set.ncard_congr (fun v _ ↦ revRowVert v) + (fun v hv ↦ mem_edgeBoundary_preimage_revRowEdge.1 hv) + (fun _ _ _ _ h ↦ revRowVert_injective h) + (fun w hw ↦ ⟨revRowVert w, ?_, revRowVert_revRowVert w⟩) + rw [mem_edgeBoundary_preimage_revRowEdge, revRowVert_revRowVert] + exact hw + +private theorem isSmallEdgeSet_preimage_revRowEdge {θ : ℕ} {X : Set (Sym2 (Fin θ × Fin θ))} + (hX : IsSmallEdgeSet θ X) : + IsSmallEdgeSet θ (revRowEdge θ ⁻¹' X) := by + refine ⟨by rw [ncard_edgeBoundary_preimage_revRowEdge]; exact hX.1, fun i hsub ↦ ?_⟩ + apply hX.2 i.rev + intro e he + have hm : revRowEdge θ e ∈ revRowEdge θ ⁻¹' X := hsub (revRowEdge_mem_gridRowPath_iff.2 he) + simpa using hm + +/-! ## Restriction from `(m + 1)`-grid to `m`-grid in (7.2) -/ + +/-- Embedding vertices of the `m`-grid into the top-left `m × m` subgrid of the `(m + 1)`-grid. -/ +private def embVert {m : ℕ} (v : Fin m × Fin m) : Fin (m + 1) × Fin (m + 1) := + (v.1.castSucc, v.2.castSucc) + +private theorem embVert_injective {m : ℕ} : Function.Injective (@embVert m) := by + intro u v h + exact Prod.ext (Fin.castSucc_inj.1 (congrArg Prod.fst h)) + (Fin.castSucc_inj.1 (congrArg Prod.snd h)) + +private def embEdge (m : ℕ) (e : Sym2 (Fin m × Fin m)) : Sym2 (Fin (m + 1) × Fin (m + 1)) := + Sym2.map embVert e + +private theorem gridSimpleGraph_adj_embVert {m : ℕ} {u v : Fin m × Fin m} : + (gridSimpleGraph (m + 1)).Adj (embVert u) (embVert v) ↔ (gridSimpleGraph m).Adj u v := by + simp [gridSimpleGraph, boxProd_adj, embVert, pathGraph_adj, Fin.castSucc_inj] + +private theorem embEdge_mem_gridHypergraph {m : ℕ} {e : Sym2 (Fin m × Fin m)} : + embEdge m e ∈ (gridHypergraph (m + 1)).edgeSet ↔ e ∈ (gridHypergraph m).edgeSet := by + induction e using Sym2.ind with | _ u v => + exact gridSimpleGraph_adj_embVert + +private theorem gridHypergraph_inc_embEdge {m : ℕ} {e : Sym2 (Fin m × Fin m)} + {v : Fin m × Fin m} : + (gridHypergraph (m + 1)).Inc (embEdge m e) (embVert v) ↔ (gridHypergraph m).Inc e v := by + have h1 : (gridHypergraph (m + 1)).Inc (embEdge m e) (embVert v) ↔ + embEdge m e ∈ (gridSimpleGraph (m + 1)).edgeSet ∧ embVert v ∈ embEdge m e := + gridHypergraph_inc_iff + have h2 : (gridHypergraph m).Inc e v ↔ + e ∈ (gridSimpleGraph m).edgeSet ∧ v ∈ e := gridHypergraph_inc_iff + rw [h1, h2] + refine and_congr embEdge_mem_gridHypergraph ?_ + induction e using Sym2.ind with | _ x y => + simp [embEdge, embVert_injective.eq_iff] + +/-- The pullback `X' = X ∩ E(G')` of an edge set `X` of the `(m + 1)`-grid to the `m`-grid. -/ +private def restrictEdgeSet (m : ℕ) (X : Set (Sym2 (Fin (m + 1) × Fin (m + 1)))) : + Set (Sym2 (Fin m × Fin m)) := + {e ∈ (gridHypergraph m).edgeSet | embEdge m e ∈ X} + +private theorem embVert_mem_edgeBoundary_of_mem_restrictEdgeSet {m : ℕ} + {X : Set (Sym2 (Fin (m + 1) × Fin (m + 1)))} {v : Fin m × Fin m} + (hv : v ∈ edgeBoundary (gridHypergraph m) (restrictEdgeSet m X)) : + embVert v ∈ edgeBoundary (gridHypergraph (m + 1)) X := by + rw [mem_edgeBoundary_gridHypergraph_iff] at hv ⊢ + rcases hv with ⟨⟨e₁, he₁, hinc₁⟩, ⟨e₂, ⟨he₂G, he₂X⟩, hinc₂⟩⟩ + refine ⟨⟨embEdge m e₁, he₁.2, gridHypergraph_inc_embEdge.2 hinc₁⟩, + ⟨embEdge m e₂, ⟨embEdge_mem_gridHypergraph.2 he₂G, fun h ↦ he₂X ⟨he₂G, h⟩⟩, + gridHypergraph_inc_embEdge.2 hinc₂⟩⟩ + +/-- If `V(P_m ∪ Q_m)` meets `∂(X)`, then `|∂'(X')| < |∂(X)|` +(Graph Minors X, Section 7, proof of (7.2), page 172). -/ +private theorem ncard_edgeBoundary_restrictEdgeSet_lt {m : ℕ} + {X : Set (Sym2 (Fin (m + 1) × Fin (m + 1)))} + (hmeet : (((gridRowPath (m + 1) (Fin.last m)).vertexSet ∪ + (gridColPath (m + 1) (Fin.last m)).vertexSet) ∩ + edgeBoundary (gridHypergraph (m + 1)) X).Nonempty) : + (edgeBoundary (gridHypergraph m) (restrictEdgeSet m X)).ncard < + (edgeBoundary (gridHypergraph (m + 1)) X).ncard := by + obtain ⟨w, hwPQ, hwB⟩ := hmeet + have himg_sub : embVert '' edgeBoundary (gridHypergraph m) (restrictEdgeSet m X) ⊆ + edgeBoundary (gridHypergraph (m + 1)) X \ {w} := by + rintro _ ⟨v, hv, rfl⟩ + refine ⟨embVert_mem_edgeBoundary_of_mem_restrictEdgeSet hv, ?_⟩ + rw [Set.mem_singleton_iff] + rintro rfl + rcases hwPQ with hrow | hcol + · exact Fin.castSucc_ne_last v.1 hrow + · exact Fin.castSucc_ne_last v.2 hcol + have hcard_img : (embVert '' edgeBoundary (gridHypergraph m) (restrictEdgeSet m X)).ncard = + (edgeBoundary (gridHypergraph m) (restrictEdgeSet m X)).ncard := + Set.ncard_image_of_injective _ embVert_injective + have hle : (edgeBoundary (gridHypergraph m) (restrictEdgeSet m X)).ncard ≤ + (edgeBoundary (gridHypergraph (m + 1)) X \ {w}).ncard := by + rw [← hcard_img] + exact Set.ncard_le_ncard himg_sub (Set.toFinite _) + have hlt : (edgeBoundary (gridHypergraph (m + 1)) X \ {w}).ncard < + (edgeBoundary (gridHypergraph (m + 1)) X).ncard := + Set.ncard_lt_ncard (Set.sdiff_singleton_ssubset.2 hwB) (Set.toFinite _) + exact hle.trans_lt hlt + +/-- Core step of the induction in (7.2) once `E(Q_m)` meets `X₁` and `X₂` and `E(P_m)` meets `X₃`. +-/ +private theorem theorem_7_2_step_core {m : ℕ} (hm : 2 ≤ m) + (ih : ∀ ⦃Y₁ Y₂ Y₃ : Set (Sym2 (Fin m × Fin m))⦄, + Y₁ ∪ Y₂ ∪ Y₃ = (gridHypergraph m).edgeSet → + ¬ (IsSmallEdgeSet m Y₁ ∧ IsSmallEdgeSet m Y₂ ∧ IsSmallEdgeSet m Y₃)) + {X₁ X₂ X₃ : Set (Sym2 (Fin (m + 1) × Fin (m + 1)))} + (hU : X₁ ∪ X₂ ∪ X₃ = (gridHypergraph (m + 1)).edgeSet) + (hS₁ : IsSmallEdgeSet (m + 1) X₁) + (hS₂ : IsSmallEdgeSet (m + 1) X₂) + (hS₃ : IsSmallEdgeSet (m + 1) X₃) + (hQ₁ : ((gridColPath (m + 1) (Fin.last m)).edgeSet ∩ X₁).Nonempty) + (hQ₂ : ((gridColPath (m + 1) (Fin.last m)).edgeSet ∩ X₂).Nonempty) + (hP₃ : ((gridRowPath (m + 1) (Fin.last m)).edgeSet ∩ X₃).Nonempty) : + False := by + have hm1 : 2 ≤ m + 1 := by omega + have hmeet₁ : (((gridRowPath (m + 1) (Fin.last m)).vertexSet ∪ + (gridColPath (m + 1) (Fin.last m)).vertexSet) ∩ + edgeBoundary (gridHypergraph (m + 1)) X₁).Nonempty := by + obtain ⟨e, heQ, heX₁⟩ := hQ₁ + obtain ⟨a, ha, rfl⟩ := mem_gridColPath_edgeSet_iff.1 heQ + obtain ⟨v, hvQ, hvB⟩ := gridColPath_meets_edgeBoundary (Fin.last m) + ⟨colEdge (Fin.last m) a ha, heX₁, colEdge_inc_left (Fin.last m) a ha⟩ + (hS₁.not_gridColPath_subset hm1 (Fin.last m)) + exact ⟨v, Or.inr hvQ, hvB⟩ + have hmeet₂ : (((gridRowPath (m + 1) (Fin.last m)).vertexSet ∪ + (gridColPath (m + 1) (Fin.last m)).vertexSet) ∩ + edgeBoundary (gridHypergraph (m + 1)) X₂).Nonempty := by + obtain ⟨e, heQ, heX₂⟩ := hQ₂ + obtain ⟨a, ha, rfl⟩ := mem_gridColPath_edgeSet_iff.1 heQ + obtain ⟨v, hvQ, hvB⟩ := gridColPath_meets_edgeBoundary (Fin.last m) + ⟨colEdge (Fin.last m) a ha, heX₂, colEdge_inc_left (Fin.last m) a ha⟩ + (hS₂.not_gridColPath_subset hm1 (Fin.last m)) + exact ⟨v, Or.inr hvQ, hvB⟩ + have hmeet₃ : (((gridRowPath (m + 1) (Fin.last m)).vertexSet ∪ + (gridColPath (m + 1) (Fin.last m)).vertexSet) ∩ + edgeBoundary (gridHypergraph (m + 1)) X₃).Nonempty := by + obtain ⟨e, heP, heX₃⟩ := hP₃ + obtain ⟨a, ha, rfl⟩ := mem_gridRowPath_edgeSet_iff.1 heP + obtain ⟨v, hvP, hvB⟩ := gridRowPath_meets_edgeBoundary (Fin.last m) + ⟨rowEdge (Fin.last m) a ha, heX₃, rowEdge_inc_left (Fin.last m) a ha⟩ + (hS₃.2 (Fin.last m)) + exact ⟨v, Or.inl hvP, hvB⟩ + let X'₁ := restrictEdgeSet m X₁ + let X'₂ := restrictEdgeSet m X₂ + let X'₃ := restrictEdgeSet m X₃ + have hU' : X'₁ ∪ X'₂ ∪ X'₃ = (gridHypergraph m).edgeSet := by + ext e + simp only [X'₁, X'₂, X'₃, restrictEdgeSet, Set.mem_union, Set.mem_sep_iff] + constructor + · rintro ((⟨he, _⟩ | ⟨he, _⟩) | ⟨he, _⟩) <;> exact he + · intro he + have he' : embEdge m e ∈ X₁ ∪ X₂ ∪ X₃ := + hU.symm ▸ embEdge_mem_gridHypergraph.2 he + rcases he' with (h1 | h2) | h3 + · exact Or.inl (Or.inl ⟨he, h1⟩) + · exact Or.inl (Or.inr ⟨he, h2⟩) + · exact Or.inr ⟨he, h3⟩ + have hB'₁ : (edgeBoundary (gridHypergraph m) X'₁).ncard < m := by + have hlt := ncard_edgeBoundary_restrictEdgeSet_lt hmeet₁ + have h1 := hS₁.1 + dsimp [X'₁] + omega + have hB'₂ : (edgeBoundary (gridHypergraph m) X'₂).ncard < m := by + have hlt := ncard_edgeBoundary_restrictEdgeSet_lt hmeet₂ + have h2 := hS₂.1 + dsimp [X'₂] + omega + have hB'₃ : (edgeBoundary (gridHypergraph m) X'₃).ncard < m := by + have hlt := ncard_edgeBoundary_restrictEdgeSet_lt hmeet₃ + have h3 := hS₃.1 + dsimp [X'₃] + omega + have hnot_all := ih hU' + have hrow_or : (∃ i' : Fin m, (gridRowPath m i').edgeSet ⊆ X'₁) ∨ + (∃ i' : Fin m, (gridRowPath m i').edgeSet ⊆ X'₂) ∨ + (∃ i' : Fin m, (gridRowPath m i').edgeSet ⊆ X'₃) := by + by_contra! hno + exact hnot_all ⟨⟨hB'₁, hno.1⟩, ⟨hB'₂, hno.2.1⟩, ⟨hB'₃, hno.2.2⟩⟩ + have col_contra : ∀ {X : Set (Sym2 (Fin (m + 1) × Fin (m + 1)))}, + IsSmallEdgeSet (m + 1) X → + ((gridColPath (m + 1) (Fin.last m)).edgeSet ∩ X).Nonempty → + (∃ i' : Fin m, (gridRowPath m i').edgeSet ⊆ restrictEdgeSet m X) → False := by + intro X hSX hQX ⟨i', hi'⟩ + have hmeet_all : ∀ j : Fin (m + 1), + ((gridColPath (m + 1) j).vertexSet ∩ edgeBoundary (gridHypergraph (m + 1)) X).Nonempty := by + intro j + induction j using Fin.lastCases with + | last => + obtain ⟨e, heQ, heX⟩ := hQX + obtain ⟨a, ha, rfl⟩ := mem_gridColPath_edgeSet_iff.1 heQ + exact gridColPath_meets_edgeBoundary (Fin.last m) + ⟨colEdge (Fin.last m) a ha, heX, colEdge_inc_left (Fin.last m) a ha⟩ + (hSX.not_gridColPath_subset hm1 (Fin.last m)) + | cast j₀ => + obtain ⟨e₀, he₀P, hinc₀⟩ := exists_mem_gridRowPath_inc hm i' j₀ + have he₀X : embEdge m e₀ ∈ X := (hi' he₀P).2 + have hinc : (gridHypergraph (m + 1)).Inc (embEdge m e₀) (i'.castSucc, j₀.castSucc) := + gridHypergraph_inc_embEdge.2 hinc₀ + exact gridColPath_meets_edgeBoundary j₀.castSucc ⟨embEdge m e₀, he₀X, hinc⟩ + (hSX.not_gridColPath_subset hm1 j₀.castSucc) + have hsum : ∑ _j : Fin (m + 1), 1 ≤ + ∑ j : Fin (m + 1), + ((gridColPath (m + 1) j).vertexSet ∩ edgeBoundary (gridHypergraph (m + 1)) X).ncard := by + refine Finset.sum_le_sum fun j _ ↦ ?_ + exact Nat.one_le_iff_ne_zero.2 (Set.ncard_ne_zero_of_mem (hmeet_all j).some_mem) + rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin, smul_eq_mul, Nat.mul_one, + ← ncard_eq_sum_gridColPath_inter] at hsum + have := hSX.1 + omega + rcases hrow_or with h1 | h2 | h3 + · exact col_contra hS₁ hQ₁ h1 + · exact col_contra hS₂ hQ₂ h2 + · obtain ⟨j', hj'⟩ := (theorem_7_1_proof hm (X := X'₃) (fun _ h ↦ h.1) hB'₃).1 h3 + have hmeet_rows : ∀ i : Fin (m + 1), + ((gridRowPath (m + 1) i).vertexSet ∩ edgeBoundary (gridHypergraph (m + 1)) X₃).Nonempty + := by + intro i + induction i using Fin.lastCases with + | last => + obtain ⟨e, heP, heX₃⟩ := hP₃ + obtain ⟨a, ha, rfl⟩ := mem_gridRowPath_edgeSet_iff.1 heP + exact gridRowPath_meets_edgeBoundary (Fin.last m) + ⟨rowEdge (Fin.last m) a ha, heX₃, rowEdge_inc_left (Fin.last m) a ha⟩ + (hS₃.2 (Fin.last m)) + | cast i₀ => + obtain ⟨e₀, he₀Q, hinc₀⟩ := exists_mem_gridColPath_inc hm i₀ j' + have he₀X₃ : embEdge m e₀ ∈ X₃ := (hj' he₀Q).2 + have hinc : (gridHypergraph (m + 1)).Inc (embEdge m e₀) (i₀.castSucc, j'.castSucc) := + gridHypergraph_inc_embEdge.2 hinc₀ + exact gridRowPath_meets_edgeBoundary i₀.castSucc ⟨embEdge m e₀, he₀X₃, hinc⟩ + (hS₃.2 i₀.castSucc) + choose f hf using hmeet_rows + have hinj : Function.Injective f := by + intro i₁ i₂ heq + have h₁ : (f i₁).1 = i₁ := (hf i₁).1 + have h₂ : (f i₂).1 = i₂ := (hf i₂).1 + rw [← h₁, ← h₂, heq] + have hsub : Set.range f ⊆ edgeBoundary (gridHypergraph (m + 1)) X₃ := by + rintro _ ⟨i, rfl⟩ + exact (hf i).2 + have hcard_range : (Set.range f).ncard = m + 1 := by + rw [Set.ncard_range_of_injective hinj, Nat.card_eq_fintype_card, Fintype.card_fin] + have hle : (Set.range f).ncard ≤ (edgeBoundary (gridHypergraph (m + 1)) X₃).ncard := + Set.ncard_le_ncard hsub (Set.toFinite _) + have := hS₃.1 + omega + +/-- Step of (7.2) once `E(Q_m)` meets `X₁` and `X₂` (handling the two cases for whether `E(P_0)` or +`E(P_m)` meets `X₃` via row reversal). -/ +private theorem theorem_7_2_step_wlog {m : ℕ} (hm : 2 ≤ m) + (ih : ∀ ⦃Y₁ Y₂ Y₃ : Set (Sym2 (Fin m × Fin m))⦄, + Y₁ ∪ Y₂ ∪ Y₃ = (gridHypergraph m).edgeSet → + ¬ (IsSmallEdgeSet m Y₁ ∧ IsSmallEdgeSet m Y₂ ∧ IsSmallEdgeSet m Y₃)) + {X₁ X₂ X₃ : Set (Sym2 (Fin (m + 1) × Fin (m + 1)))} + (hU : X₁ ∪ X₂ ∪ X₃ = (gridHypergraph (m + 1)).edgeSet) + (hS₁ : IsSmallEdgeSet (m + 1) X₁) + (hS₂ : IsSmallEdgeSet (m + 1) X₂) + (hS₃ : IsSmallEdgeSet (m + 1) X₃) + (hQ₁ : ((gridColPath (m + 1) (Fin.last m)).edgeSet ∩ X₁).Nonempty) + (hQ₂ : ((gridColPath (m + 1) (Fin.last m)).edgeSet ∩ X₂).Nonempty) : + False := by + have hm1 : 2 ≤ m + 1 := by omega + rcases theorem_7_2_claim_top_or_bot_meets hm1 hU hS₁ hS₂ with hP₀ | hP_last + · let R₁ := revRowEdge (m + 1) ⁻¹' X₁ + let R₂ := revRowEdge (m + 1) ⁻¹' X₂ + let R₃ := revRowEdge (m + 1) ⁻¹' X₃ + have hUR : R₁ ∪ R₂ ∪ R₃ = (gridHypergraph (m + 1)).edgeSet := by + ext e + simp only [R₁, R₂, R₃, Set.mem_union, Set.mem_preimage] + have : revRowEdge (m + 1) e ∈ X₁ ∪ X₂ ∪ X₃ ↔ + revRowEdge (m + 1) e ∈ (gridHypergraph (m + 1)).edgeSet := by rw [hU] + exact this.trans revRowEdge_mem_gridHypergraph + have hRQ₁ : ((gridColPath (m + 1) (Fin.last m)).edgeSet ∩ R₁).Nonempty := by + obtain ⟨e, heQ, heX₁⟩ := hQ₁ + exact ⟨revRowEdge (m + 1) e, revRowEdge_mem_gridColPath_iff.2 heQ, by simpa [R₁] using heX₁⟩ + have hRQ₂ : ((gridColPath (m + 1) (Fin.last m)).edgeSet ∩ R₂).Nonempty := by + obtain ⟨e, heQ, heX₂⟩ := hQ₂ + exact ⟨revRowEdge (m + 1) e, revRowEdge_mem_gridColPath_iff.2 heQ, by simpa [R₂] using heX₂⟩ + have hRP₃ : ((gridRowPath (m + 1) (Fin.last m)).edgeSet ∩ R₃).Nonempty := by + obtain ⟨e, heP, heX₃⟩ := hP₀ + refine ⟨revRowEdge (m + 1) e, ?_, by simpa [R₃] using heX₃⟩ + rw [revRowEdge_mem_gridRowPath_iff] + have hrev_last : (Fin.last m).rev = ⟨0, by omega⟩ := Fin.rev_last m + rwa [hrev_last] + exact theorem_7_2_step_core hm ih hUR + (isSmallEdgeSet_preimage_revRowEdge hS₁) + (isSmallEdgeSet_preimage_revRowEdge hS₂) + (isSmallEdgeSet_preimage_revRowEdge hS₃) + hRQ₁ hRQ₂ hRP₃ + · exact theorem_7_2_step_core hm ih hU hS₁ hS₂ hS₃ hQ₁ hQ₂ hP_last + +/-- **Graph Minors X, (7.2)** (Kleitman–Saks lemma, page 172): +"If $G$ is a $\theta$-grid and $X_1, X_2, X_3 \subseteq E(G)$ with $X_1 \cup X_2 \cup X_3 = +E(G)$, then not all of $X_1, X_2, X_3$ are small in $G$." -/ +theorem theorem_7_2_proof {θ : ℕ} (hθ : 2 ≤ θ) + {X₁ X₂ X₃ : Set (Sym2 (Fin θ × Fin θ))} + (hU : X₁ ∪ X₂ ∪ X₃ = (gridHypergraph θ).edgeSet) : + ¬ (IsSmallEdgeSet θ X₁ ∧ IsSmallEdgeSet θ X₂ ∧ IsSmallEdgeSet θ X₃) := by + induction θ, hθ using Nat.le_induction with + | base => + rintro ⟨hS₁, hS₂, hS₃⟩ + let i₀ : Fin 2 := ⟨0, by decide⟩ + have ha₀ : 0 + 1 < 2 := by decide + let e₀ := rowEdge i₀ 0 ha₀ + have he₀G : e₀ ∈ X₁ ∪ X₂ ∪ X₃ := hU.symm ▸ rowEdge_mem_gridHypergraph i₀ 0 ha₀ + have hrow_sub : ∀ {X : Set (Sym2 (Fin 2 × Fin 2))}, e₀ ∈ X → + (gridRowPath 2 i₀).edgeSet ⊆ X := by + intro X heX e he + obtain ⟨a, ha, rfl⟩ := mem_gridRowPath_edgeSet_iff.1 he + have ha_zero : a = 0 := by omega + subst ha_zero + exact heX + rcases he₀G with (h1 | h2) | h3 + · exact hS₁.2 i₀ (hrow_sub h1) + · exact hS₂.2 i₀ (hrow_sub h2) + · exact hS₃.2 i₀ (hrow_sub h3) + | succ m hm ih => + rintro ⟨hS₁, hS₂, hS₃⟩ + have hm1 : 2 ≤ m + 1 := by omega + let j_last : Fin (m + 1) := Fin.last m + have ha₀ : 0 + 1 < m + 1 := by omega + let e₀ := colEdge j_last 0 ha₀ + have he₀Q : e₀ ∈ (gridColPath (m + 1) j_last).edgeSet := + colEdge_mem_gridColPath j_last 0 ha₀ + have he₀U : e₀ ∈ X₁ ∪ X₂ ∪ X₃ := hU.symm ▸ he₀Q.1 + have hnotQ₁ := hS₁.not_gridColPath_subset hm1 j_last + have hnotQ₂ := hS₂.not_gridColPath_subset hm1 j_last + have hnotQ₃ := hS₃.not_gridColPath_subset hm1 j_last + have hU132 : X₁ ∪ X₃ ∪ X₂ = (gridHypergraph (m + 1)).edgeSet := by + rw [← hU]; ext; simp [or_right_comm] + have hU231 : X₂ ∪ X₃ ∪ X₁ = (gridHypergraph (m + 1)).edgeSet := by + rw [← hU]; ext; simp; tauto + rcases he₀U with (he1 | he2) | he3 + · obtain ⟨f, hfQ, hf_not1⟩ := Set.not_subset.1 hnotQ₁ + have hfU : f ∈ X₁ ∪ X₂ ∪ X₃ := hU.symm ▸ hfQ.1 + rcases hfU with (hf1 | hf2) | hf3 + · exact hf_not1 hf1 + · exact theorem_7_2_step_wlog hm (@ih) hU hS₁ hS₂ hS₃ + ⟨e₀, he₀Q, he1⟩ ⟨f, hfQ, hf2⟩ + · exact theorem_7_2_step_wlog hm (@ih) hU132 hS₁ hS₃ hS₂ + ⟨e₀, he₀Q, he1⟩ ⟨f, hfQ, hf3⟩ + · obtain ⟨f, hfQ, hf_not2⟩ := Set.not_subset.1 hnotQ₂ + have hfU : f ∈ X₁ ∪ X₂ ∪ X₃ := hU.symm ▸ hfQ.1 + rcases hfU with (hf1 | hf2) | hf3 + · exact theorem_7_2_step_wlog hm (@ih) hU hS₁ hS₂ hS₃ + ⟨f, hfQ, hf1⟩ ⟨e₀, he₀Q, he2⟩ + · exact hf_not2 hf2 + · exact theorem_7_2_step_wlog hm (@ih) hU231 hS₂ hS₃ hS₁ + ⟨e₀, he₀Q, he2⟩ ⟨f, hfQ, hf3⟩ + · obtain ⟨f, hfQ, hf_not3⟩ := Set.not_subset.1 hnotQ₃ + have hfU : f ∈ X₁ ∪ X₂ ∪ X₃ := hU.symm ▸ hfQ.1 + rcases hfU with (hf1 | hf2) | hf3 + · exact theorem_7_2_step_wlog hm (@ih) hU132 hS₁ hS₃ hS₂ + ⟨f, hfQ, hf1⟩ ⟨e₀, he₀Q, he3⟩ + · exact theorem_7_2_step_wlog hm (@ih) hU231 hS₂ hS₃ hS₁ + ⟨f, hfQ, hf2⟩ ⟨e₀, he₀Q, he3⟩ + · exact hf_not3 hf3 + +/-! ## Proof of (7.3) -/ + +/-- For any separation `(A, B)` of `G`, `∂(E(A)) ⊆ V(A ∩ B)`. -/ +private theorem edgeBoundary_edgeSet_subset_inter {α β : Type*} {G A B : Hypergraph α β} + (hsep : G.IsSeparation A B) : + edgeBoundary G A.edgeSet ⊆ (A ∩ B).vertexSet := by + rintro v ⟨_, ⟨e₁, he₁A, hinc₁⟩, ⟨e₂, ⟨he₂G, he₂notA⟩, hinc₂⟩⟩ + have hvA : v ∈ A.vertexSet := + A.vertex_mem_of_inc ((inc_iff_of_le hsep.left_le he₁A).2 hinc₁) + have he₂B : e₂ ∈ B.edgeSet := + (hsep.edgeSet_union.symm ▸ he₂G).resolve_left he₂notA + have hvB : v ∈ B.vertexSet := + B.vertex_mem_of_inc ((inc_iff_of_le hsep.right_le he₂B).2 hinc₂) + exact ⟨hvA, hvB⟩ + +/-- If `(A, B)` is a separation of the `θ`-grid and `V(Qⱼ)` meets both `V(A)` and `V(B)`, then +`V(Qⱼ)` meets `V(A ∩ B)` (Graph Minors X, Section 7, proof of (7.3), page 173). -/ +private theorem gridColPath_inter_separation_nonempty {θ : ℕ} + {A B : Hypergraph (Fin θ × Fin θ) (Sym2 (Fin θ × Fin θ))} + (hsep : (gridHypergraph θ).IsSeparation A B) (j : Fin θ) + {h i : Fin θ} (hh : (h, j) ∈ A.vertexSet) (hi : (i, j) ∈ B.vertexSet) : + ((gridColPath θ j).vertexSet ∩ (A ∩ B).vertexSet).Nonempty := by + by_contra! hemp + have hwalk : ∀ {u v : Fin θ}, (pathGraph θ).Reachable u v → + (u, j) ∈ A.vertexSet → (v, j) ∈ A.vertexSet := by + intro u v hreach huA + obtain ⟨w⟩ := hreach + induction w with + | nil => exact huA + | @cons x y z hadj w' ih => + apply ih + have hadjG : (gridSimpleGraph θ).Adj (x, j) (y, j) := by + rw [boxProd_adj] + exact Or.inl ⟨hadj, rfl⟩ + have heG : s((x, j), (y, j)) ∈ A.edgeSet ∪ B.edgeSet := + hsep.edgeSet_union.symm ▸ hadjG + have hinc_x : (gridHypergraph θ).Inc s((x, j), (y, j)) (x, j) := + gridHypergraph_inc_sym2.2 ⟨hadjG, Or.inl rfl⟩ + have hinc_y : (gridHypergraph θ).Inc s((x, j), (y, j)) (y, j) := + gridHypergraph_inc_sym2.2 ⟨hadjG, Or.inr rfl⟩ + rcases heG with heA | heB + · exact A.vertex_mem_of_inc ((inc_iff_of_le hsep.left_le heA).2 hinc_y) + · have hxB : (x, j) ∈ B.vertexSet := + B.vertex_mem_of_inc ((inc_iff_of_le hsep.right_le heB).2 hinc_x) + have hmem : (x, j) ∈ (gridColPath θ j).vertexSet ∩ (A ∩ B).vertexSet := + ⟨rfl, huA, hxB⟩ + exact (Set.notMem_empty (x, j) (hemp ▸ hmem)).elim + have hiA : (i, j) ∈ A.vertexSet := hwalk (preconnected_pathGraph θ h i) hh + have hmem : (i, j) ∈ (gridColPath θ j).vertexSet ∩ (A ∩ B).vertexSet := + ⟨rfl, hiA, hi⟩ + exact Set.notMem_empty (i, j) (hemp ▸ hmem) + +/-- **Graph Minors X, (7.3)** (page 173): +"Given a $\theta$-grid $G$ with $P_1, \dots, P_\theta, Q_1, \dots, Q_\theta$ as before, let +$\mathscr{T}$ be the set of all separations $(A, B)$ of $G$ of order $<\theta$ such that $E(A)$ is +small. +(7.3) *$\mathscr{T}$ is a tangle in $G$ of order $\theta$.*" -/ +theorem theorem_7_3_proof {θ : ℕ} (hθ : 2 ≤ θ) : + IsTangle (gridHypergraph θ) θ (gridTangle θ) where + one_le := by omega + isSeparation _ _ h := h.1 + order_lt _ _ h := h.2.1 + axiom1 A B hsep hord := by + have hBA : (edgeBoundary (gridHypergraph θ) A.edgeSet).ncard < θ := + (Set.ncard_le_ncard (edgeBoundary_edgeSet_subset_inter hsep) + (A ∩ B).vertexSet_finite).trans_lt hord + have hBB : (edgeBoundary (gridHypergraph θ) B.edgeSet).ncard < θ := by + have hord' : separationOrder B A < θ := by rwa [separationOrder_comm] + exact (Set.ncard_le_ncard (edgeBoundary_edgeSet_subset_inter hsep.symm) + (B ∩ A).vertexSet_finite).trans_lt hord' + by_cases hsmallA : IsSmallEdgeSet θ A.edgeSet + · exact Or.inl ⟨hsep, hord, hsmallA⟩ + · right + refine ⟨hsep.symm, by rwa [separationOrder_comm], ⟨hBB, ?_⟩⟩ + intro i hiB + have hhA_ex : ∃ h : Fin θ, (gridRowPath θ h).edgeSet ⊆ A.edgeSet := by + by_contra! hno + exact hsmallA ⟨hBA, hno⟩ + obtain ⟨h, hhA⟩ := hhA_ex + have hmeet : ∀ j : Fin θ, + ((gridColPath θ j).vertexSet ∩ (A ∩ B).vertexSet).Nonempty := by + intro j + obtain ⟨e₁, he₁P, hinc₁⟩ := exists_mem_gridRowPath_inc hθ h j + obtain ⟨e₂, he₂P, hinc₂⟩ := exists_mem_gridRowPath_inc hθ i j + have hh_mem : (h, j) ∈ A.vertexSet := + A.vertex_mem_of_inc ((inc_iff_of_le hsep.left_le (hhA he₁P)).2 hinc₁) + have hi_mem : (i, j) ∈ B.vertexSet := + B.vertex_mem_of_inc ((inc_iff_of_le hsep.right_le (hiB he₂P)).2 hinc₂) + exact gridColPath_inter_separation_nonempty hsep j hh_mem hi_mem + have hsum : ∑ _j : Fin θ, 1 ≤ + ∑ j : Fin θ, ((gridColPath θ j).vertexSet ∩ (A ∩ B).vertexSet).ncard := by + refine Finset.sum_le_sum fun j _ ↦ ?_ + exact Nat.one_le_iff_ne_zero.2 (Set.ncard_ne_zero_of_mem (hmeet j).some_mem) + rw [Finset.sum_const, Finset.card_univ, Fintype.card_fin, smul_eq_mul, Nat.mul_one, + ← ncard_eq_sum_gridColPath_inter] at hsum + rw [separationOrder] at hord + omega + axiom2 A₁ B₁ A₂ B₂ A₃ B₃ h₁ h₂ h₃ hU := by + have hEU : A₁.edgeSet ∪ A₂.edgeSet ∪ A₃.edgeSet = (gridHypergraph θ).edgeSet := + congrArg Hypergraph.edgeSet hU + exact theorem_7_2_proof hθ hEU ⟨h₁.2.2, h₂.2.2, h₃.2.2⟩ + axiom3 A B h hVA := by + rcases h with ⟨hsep, hord, hsmallA⟩ + dsimp only at hsep hord hsmallA + have hVB_eq : (A ∩ B).vertexSet = B.vertexSet := by + rw [inter_vertexSet, hVA, Set.inter_eq_right.2 hsep.right_le.vertexSet_subset] + have hB_card : B.vertexSet.ncard < θ := by + rwa [separationOrder, hVB_eq] at hord + have hex_row : ∃ i : Fin θ, Disjoint (gridRowPath θ i).vertexSet B.vertexSet := by + by_contra hno_disj + have hmeet : ∀ i : Fin θ, ∃ v, v ∈ (gridRowPath θ i).vertexSet ∧ v ∈ B.vertexSet := by + intro i + by_contra! h + exact hno_disj ⟨i, Set.disjoint_left.2 h⟩ + choose f hf using hmeet + have hinj : Function.Injective f := by + intro i₁ i₂ heq + have h₁ : (f i₁).1 = i₁ := (hf i₁).1 + have h₂ : (f i₂).1 = i₂ := (hf i₂).1 + rw [← h₁, ← h₂, heq] + have hsub : Set.range f ⊆ B.vertexSet := by + rintro _ ⟨i, rfl⟩ + exact (hf i).2 + have hcard_range : (Set.range f).ncard = θ := by + rw [Set.ncard_range_of_injective hinj, Nat.card_eq_fintype_card, Fintype.card_fin] + have hle : (Set.range f).ncard ≤ B.vertexSet.ncard := + Set.ncard_le_ncard hsub B.vertexSet_finite + omega + obtain ⟨i, hdisj⟩ := hex_row + apply hsmallA.2 i + intro e heP + have heAB : e ∈ A.edgeSet ∪ B.edgeSet := hsep.edgeSet_union.symm ▸ heP.1 + rcases heAB with heA | heB + · exact heA + · exfalso + obtain ⟨a, ha, rfl⟩ := mem_gridRowPath_edgeSet_iff.1 heP + have hvB : (i, ⟨a, Nat.lt_of_succ_lt ha⟩) ∈ B.vertexSet := + B.vertex_mem_of_inc ((inc_iff_of_le hsep.right_le heB).2 (rowEdge_inc_left i a ha)) + exact Set.disjoint_left.1 hdisj rfl hvB + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/Section8.lean b/LeanPool/GraphMinor/GM10/Section8.lean new file mode 100644 index 0000000000..ab0dfd214f --- /dev/null +++ b/LeanPool/GraphMinor/GM10/Section8.lean @@ -0,0 +1,1025 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Defs2 +public import LeanPool.GraphMinor.GM10.Statements +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM10.Section6 +import LeanPool.GraphMinor.GM10.TreeWidth + +/-! +# Robust and Titanic Separations (Graph Minors X, Section 8) + +This file formalizes Section 8 of Graph Minors X (pages 174–177): +- `theorem_8_1`: **Graph Minors X, (8.1)** (page 174). +- `theorem_8_2`: **Graph Minors X, (8.2)** (page 174), every titanic separation is robust. +- `theorem_8_3`: **Graph Minors X, (8.3)** (page 175), transferring a tangle across a titanic + separation. +- `theorem_8_4`: **Graph Minors X, (8.4)** (page 176), deleting an edge with at most one end. +- `theorem_8_5`: **Graph Minors X, (8.5)** (page 177), deleting a set of `< θ` vertices in a graph. +-/ + +public section + +namespace GraphMinor.GM10 + +open Hypergraph + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Graph Minors X, (8.1) -/ + +/-- If `A ≤ G` and `(C, D)` is a separation of `G`, then `(A ∩ C, A ∩ D)` is a separation of `A`. -/ +theorem _root_.GraphMinor.Hypergraph.IsSeparation.inter_left {G A C D : Hypergraph α β} + (hCD : G.IsSeparation C D) (hA : A ≤ G) : + A.IsSeparation (A ∩ C) (A ∩ D) := by + have hAC : A ∩ C ≤ A := inter_le_left hA hCD.left_le + have hAD : A ∩ D ≤ A := inter_le_left hA hCD.right_le + rw [isSeparation_iff_of_le hAC hAD] + refine ⟨?_, ?_, ?_⟩ + · change (A.vertexSet ∩ C.vertexSet) ∪ (A.vertexSet ∩ D.vertexSet) = A.vertexSet + rw [← Set.inter_union_distrib_left, hCD.vertexSet_union, + Set.inter_eq_left.2 hA.vertexSet_subset] + · change (A.edgeSet ∩ C.edgeSet) ∪ (A.edgeSet ∩ D.edgeSet) = A.edgeSet + rw [← Set.inter_union_distrib_left, hCD.edgeSet_union, + Set.inter_eq_left.2 hA.edgeSet_subset] + · ext e + change e ∈ (A.edgeSet ∩ C.edgeSet) ∩ (A.edgeSet ∩ D.edgeSet) ↔ e ∈ (∅ : Set β) + simp only [Set.mem_inter_iff, Set.mem_empty_iff_false, iff_false] + rintro ⟨⟨_, heC⟩, ⟨_, heD⟩⟩ + exact hCD.notMem_edgeSet_right heC heD + +/-- Submodularity identity for the orders of `(A, B)` and `(C, D)` in the proof of +**Graph Minors X, (8.1)** (page 174): +`|V(A ∩ B)| + |V(C ∩ D)| = |V((A ∩ C) ∩ (B ∪ D))| + |V((A ∪ C) ∩ (B ∩ D))|`. -/ +theorem separationOrder_add_separationOrder {G A B C D : Hypergraph α β} + (hAB : G.IsSeparation A B) (hCD : G.IsSeparation C D) : + separationOrder A B + separationOrder C D = + separationOrder (A ∩ C) (B ∪ D) + separationOrder (A ∪ C) (B ∩ D) := by + let S₁ := (A ∩ B).vertexSet + let S₂ := (C ∩ D).vertexSet + let T₁ := ((A ∩ C) ∩ (B ∪ D)).vertexSet + let T₂ := ((A ∪ C) ∩ (B ∩ D)).vertexSet + have h_union : S₁ ∪ S₂ = T₁ ∪ T₂ := by + ext v + simp only [S₁, S₂, T₁, T₂, inter_vertexSet, union_vertexSet, Set.mem_union, Set.mem_inter_iff] + constructor + · intro h + have hvG : v ∈ G.vertexSet := by + rcases h with ⟨hvA, _⟩ | ⟨hvC, _⟩ + · exact hAB.left_le.vertexSet_subset hvA + · exact hCD.left_le.vertexSet_subset hvC + have hvAB : v ∈ A.vertexSet ∪ B.vertexSet := hAB.vertexSet_union.symm ▸ hvG + have hvCD : v ∈ C.vertexSet ∪ D.vertexSet := hCD.vertexSet_union.symm ▸ hvG + simp only [Set.mem_union] at hvAB hvCD + tauto + · tauto + have h_inter : S₁ ∩ S₂ = T₁ ∩ T₂ := by + ext v + simp only [S₁, S₂, T₁, T₂, inter_vertexSet, union_vertexSet, Set.mem_inter_iff, Set.mem_union] + tauto + have h1 := Set.ncard_union_add_ncard_inter S₁ S₂ + (A ∩ B).vertexSet_finite (C ∩ D).vertexSet_finite + have h2 := Set.ncard_union_add_ncard_inter T₁ T₂ + ((A ∩ C) ∩ (B ∪ D)).vertexSet_finite ((A ∪ C) ∩ (B ∩ D)).vertexSet_finite + rw [h_union, h_inter] at h1 + unfold separationOrder + change S₁.ncard + S₂.ncard = T₁.ncard + T₂.ncard + omega + +/-- **Graph Minors X, (8.1)** (page 174): +"Let* $(A, B)$ *be a robust separation of* $G$, *and let* $(C, D)$ *be a separation of* $G$. +*Then one of* $(A \cup C, B \cap D)$, $(A \cup D, B \cap C)$ *has order at most that of* +$(C, D)$." -/ +theorem theorem_8_1_proof {G A B C D : Hypergraph α β} + (hAB : IsRobust G A B) (hCD : G.IsSeparation C D) : + separationOrder (A ∪ C) (B ∩ D) ≤ separationOrder C D ∨ + separationOrder (A ∪ D) (B ∩ C) ≤ separationOrder C D := by + have hACD : A.IsSeparation (A ∩ C) (A ∩ D) := hCD.inter_left hAB.1.left_le + rcases hAB.2 hACD with h1 | h2 + · left + have heq : ((A ∩ C) ∩ (B ∪ (A ∩ D))).vertexSet = ((A ∩ C) ∩ (B ∪ D)).vertexSet := by + ext v + simp only [inter_vertexSet, union_vertexSet, Set.mem_inter_iff, Set.mem_union] + tauto + have h1' : separationOrder A B ≤ separationOrder (A ∩ C) (B ∪ D) := by + unfold separationOrder at h1 ⊢ + rwa [heq] at h1 + have hsum := separationOrder_add_separationOrder hAB.1 hCD + omega + · right + have heq : ((A ∩ D) ∩ (B ∪ (A ∩ C))).vertexSet = ((A ∩ D) ∩ (B ∪ C)).vertexSet := by + ext v + simp only [inter_vertexSet, union_vertexSet, Set.mem_inter_iff, Set.mem_union] + tauto + have h2' : separationOrder A B ≤ separationOrder (A ∩ D) (B ∪ C) := by + unfold separationOrder at h2 ⊢ + rwa [heq] at h2 + have hsum := separationOrder_add_separationOrder hAB.1 hCD.symm + rw [separationOrder_comm D C] at hsum + omega + +/-! ## Graph Minors X, (8.2) -/ + +private lemma bot_le (G : Hypergraph α β) : (⊥ : Hypergraph α β) ≤ G where + vertexSet_subset := Set.empty_subset _ + edgeSet_subset := Set.empty_subset _ + ends_eq _ h := h.elim + +private lemma robust_step_of_ncard_le {A B C D : Hypergraph α β} + (hCD : A.IsSeparation C D) + (hle : (C ∩ B).vertexSet.ncard ≤ (C ∩ D).vertexSet.ncard) : + separationOrder A B ≤ separationOrder D (B ∪ C) := by + have h1 : (A ∩ B).vertexSet = (C ∩ B).vertexSet ∪ ((D ∩ B).vertexSet \ C.vertexSet) := by + ext v + have hU := Set.ext_iff.1 hCD.vertexSet_union v + simp only [inter_vertexSet, Set.mem_union, Set.mem_inter_iff, Set.mem_sdiff] at hU ⊢ + tauto + have h2 : (D ∩ (B ∪ C)).vertexSet = (C ∩ D).vertexSet ∪ ((D ∩ B).vertexSet \ C.vertexSet) := by + ext v + simp only [inter_vertexSet, union_vertexSet, Set.mem_union, Set.mem_inter_iff, Set.mem_sdiff] + tauto + have hdisj1 : Disjoint (C ∩ B).vertexSet ((D ∩ B).vertexSet \ C.vertexSet) := + Set.disjoint_left.2 fun _ hv1 hv2 ↦ hv2.2 hv1.1 + have hdisj2 : Disjoint (C ∩ D).vertexSet ((D ∩ B).vertexSet \ C.vertexSet) := + Set.disjoint_left.2 fun _ hv1 hv2 ↦ hv2.2 hv1.1 + have hc1 := Set.ncard_union_eq hdisj1 (C ∩ B).vertexSet_finite + ((D ∩ B).vertexSet_finite.sdiff) + have hc2 := Set.ncard_union_eq hdisj2 (C ∩ D).vertexSet_finite + ((D ∩ B).vertexSet_finite.sdiff) + rw [separationOrder, h1, hc1, separationOrder, h2, hc2] + omega + +/-- **Graph Minors X, (8.2)** (page 174): +"Every titanic separation is robust." -/ +theorem theorem_8_2_proof {G A B : Hypergraph α β} (h : IsTitanic G A B) : + IsRobust G A B := by + refine ⟨h.1, fun {C D} hCD ↦ ?_⟩ + have hU : C ∪ D ∪ ⊥ = A := by + rw [hCD.union_eq] + ext <;> simp [union_inc] + have hd1 : Disjoint C.edgeSet D.edgeSet := hCD.disjoint_edgeSet + have hd2 : Disjoint D.edgeSet (⊥ : Hypergraph α β).edgeSet := by simp + have hd3 : Disjoint C.edgeSet (⊥ : Hypergraph α β).edgeSet := by simp + rcases h.2 hCD.left_le hCD.right_le (bot_le A) hU hd1 hd2 hd3 with h1 | h2 | h3 + · left + have hZ : ((C ∪ D) ∩ (⊥ : Hypergraph α β)).vertexSet = ∅ := by simp + have hAB : ((C ∪ D) ∩ B).vertexSet = (A ∩ B).vertexSet := by rw [hCD.union_eq] + rw [hZ, hAB, Set.ncard_empty] at h1 + unfold separationOrder + omega + · left + have hD1 : ((D ∪ ⊥) ∩ B).vertexSet = (D ∩ B).vertexSet := by simp + have hD2 : ((D ∪ ⊥) ∩ C).vertexSet = (D ∩ C).vertexSet := by simp + rw [hD1, hD2] at h2 + exact robust_step_of_ncard_le hCD.symm h2 + · right + have hC1 : ((⊥ ∪ C) ∩ B).vertexSet = (C ∩ B).vertexSet := by simp + have hC2 : ((⊥ ∪ C) ∩ D).vertexSet = (C ∩ D).vertexSet := by simp + rw [hC1, hC2] at h3 + exact robust_step_of_ncard_le hCD h3 + +/-! ## Graph Minors X, (8.3) -/ + +private lemma isSeparation_extend_of_isSeparation {G C D P Q : Hypergraph α β} + (hCD : G.IsSeparation C D) (hPQ : D.IsSeparation P Q) : + G.IsSeparation P (Q ∪ C) := by + have hP_G : P ≤ G := hPQ.left_le.trans hCD.right_le + have hQC_G : Q ∪ C ≤ G := union_le (hPQ.right_le.trans hCD.right_le) hCD.left_le + rw [isSeparation_iff_of_le hP_G hQC_G] + refine ⟨?_, ?_, ?_⟩ + · rw [union_vertexSet, ← Set.union_assoc, hPQ.vertexSet_union, Set.union_comm, + hCD.vertexSet_union] + · rw [union_edgeSet, ← Set.union_assoc, hPQ.edgeSet_union, Set.union_comm, + hCD.edgeSet_union] + · ext e + simp only [union_edgeSet, Set.mem_inter_iff, Set.mem_union, Set.mem_empty_iff_false, + iff_false] + rintro ⟨heP, heQ | heC⟩ + · exact hPQ.notMem_edgeSet_right heP heQ + · exact hCD.notMem_edgeSet_right heC (hPQ.left_le.edgeSet_subset heP) + +private lemma inter_union_eq_of_isSeparation {G' C' D B' : Hypergraph α β} + (hC'D : G'.IsSeparation C' D) (hB' : B' ≤ G') : + (B' ∩ D) ∪ C' = B' ∪ C' := by + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (union_le (inter_le hB' hC'D.right_le) hC'D.left_le) + (union_le hB' hC'D.left_le) ?_ ?_ + · ext v + have hV : v ∈ B'.vertexSet → v ∈ C'.vertexSet ∪ D.vertexSet := + fun hv ↦ hC'D.vertexSet_union.symm ▸ hB'.vertexSet_subset hv + simp only [union_vertexSet, inter_vertexSet, Set.mem_union, Set.mem_inter_iff] at hV ⊢ + tauto + · ext e + have hE : e ∈ B'.edgeSet → e ∈ C'.edgeSet ∪ D.edgeSet := + fun he ↦ hC'D.edgeSet_union.symm ▸ hB'.edgeSet_subset he + simp only [union_edgeSet, inter_edgeSet, Set.mem_union, Set.mem_inter_iff] at hE ⊢ + tauto + +private lemma separationOrder_extend_eq {C C' D P Q : Hypergraph α β} + (hV_inter : (C ∩ D).vertexSet = (C' ∩ D).vertexSet) + (hPQ : D.IsSeparation P Q) : + separationOrder P (Q ∪ C) = separationOrder P (Q ∪ C') := by + have hP_D : P.vertexSet ⊆ D.vertexSet := hPQ.left_le.vertexSet_subset + have hset : (P ∩ (Q ∪ C)).vertexSet = (P ∩ (Q ∪ C')).vertexSet := by + have hCD_eq := Set.ext_iff.1 hV_inter + ext v + have hvD : v ∈ P.vertexSet → v ∈ D.vertexSet := fun hv ↦ hP_D hv + have hCDv := hCD_eq v + simp only [inter_vertexSet, union_vertexSet, Set.mem_inter_iff, Set.mem_union] at hCDv ⊢ + tauto + rw [separationOrder, hset, separationOrder] + +private lemma theorem_8_3_axiom1 {G G' C C' D : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (hCD : G.IsSeparation C D) (hC'D : IsTitanic G' C' D) + (hV_inter : (C ∩ D).vertexSet = (C' ∩ D).vertexSet) + (h𝒯 : IsTangle G θ 𝒯) : + TangleAxiom1 G' θ (titanicTransferredTangle G' D 𝒯 θ) := by + intro A' B' hsep' hord' + have hrob : IsRobust G' C' D := theorem_8_2_proof hC'D + have hstep : ∀ {X' Y' : Hypergraph α β}, G'.IsSeparation X' Y' → + separationOrder X' Y' < θ → + separationOrder (C' ∪ Y') (D ∩ X') ≤ separationOrder X' Y' → + (X', Y') ∈ titanicTransferredTangle G' D 𝒯 θ ∨ + (Y', X') ∈ titanicTransferredTangle G' D 𝒯 θ := by + intro X' Y' hs' ho' hle' + have hPQ' : D.IsSeparation (X' ∩ D) (Y' ∩ D) := by + simpa [inter_comm] using hs'.inter_left hC'D.1.right_le + have hsepG : G.IsSeparation (X' ∩ D) ((Y' ∩ D) ∪ C) := + isSeparation_extend_of_isSeparation hCD hPQ' + have hord_eq : separationOrder (X' ∩ D) ((Y' ∩ D) ∪ C) = + separationOrder (C' ∪ Y') (D ∩ X') := by + rw [separationOrder_extend_eq hV_inter hPQ', + inter_union_eq_of_isSeparation hC'D.1 hs'.right_le, + separationOrder_comm, union_comm Y' C', inter_comm X' D] + have hordG : separationOrder (X' ∩ D) ((Y' ∩ D) ∪ C) < θ := by omega + rcases h𝒯.axiom1 hsepG hordG with hm | hm + · refine Or.inl ⟨hs', ho', ⟨(X' ∩ D, (Y' ∩ D) ∪ C), hm, ?_⟩⟩ + simp + · refine Or.inr ⟨hs'.symm, by rwa [separationOrder_comm], + ⟨((Y' ∩ D) ∪ C, X' ∩ D), hm, ?_⟩⟩ + ext e + simp only [inter_edgeSet, union_edgeSet, Set.mem_inter_iff, Set.mem_union] + exact ⟨fun ⟨he, heD⟩ ↦ ⟨(he.resolve_right (hCD.notMem_edgeSet_left heD)).1, heD⟩, + fun ⟨heY, heD⟩ ↦ ⟨Or.inl ⟨heY, heD⟩, heD⟩⟩ + rcases theorem_8_1_proof hrob hsep'.symm with h1 | h2 + · rw [separationOrder_comm B' A'] at h1 + exact hstep hsep' hord' h1 + · exact (hstep hsep'.symm (by rwa [separationOrder_comm]) h2).symm + +private lemma theorem_8_3_part_i {G G' C D : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (hCD : G.IsSeparation C D) (hD_le : D ≤ G') + (hθ : 2 ≤ θ) (h𝒯 : IsTangle G θ 𝒯) (hCD_mem : (C, D) ∈ 𝒯) + {A₁' B₁' A₂' B₂' : Hypergraph α β} + (h₁ : (A₁', B₁') ∈ titanicTransferredTangle G' D 𝒯 θ) + (h₂ : (A₂', B₂') ∈ titanicTransferredTangle G' D 𝒯 θ) : + ¬ B₁' ≤ A₂' := by + intro hle + rcases h₁.2.2 with ⟨⟨A₁, B₁⟩, hm₁, hE₁⟩ + rcases h₂.2.2 with ⟨⟨A₂, B₂⟩, hm₂, hE₂⟩ + dsimp only at hm₁ hE₁ hm₂ hE₂ + apply theorem_2_3_proof h𝒯 hθ hCD_mem hm₁ hm₂ + have hsep₁' := h₁.1 + have hEU' : A₁'.edgeSet ∪ A₂'.edgeSet = G'.edgeSet := by + refine Set.Subset.antisymm + (Set.union_subset hsep₁'.left_le.edgeSet_subset h₂.1.left_le.edgeSet_subset) ?_ + rw [← hsep₁'.edgeSet_union] + exact Set.union_subset_union subset_rfl hle.edgeSet_subset + ext e + simp only [union_edgeSet, Set.mem_union] + constructor + · rintro ((heC | he₁) | he₂) + · exact hCD.left_le.edgeSet_subset heC + · exact (h𝒯.isSeparation hm₁).left_le.edgeSet_subset he₁ + · exact (h𝒯.isSeparation hm₂).left_le.edgeSet_subset he₂ + · intro heG + have heCD : e ∈ C.edgeSet ∪ D.edgeSet := hCD.edgeSet_union.symm ▸ heG + rcases heCD with heC | heD + · exact Or.inl (Or.inl heC) + · have heG' : e ∈ A₁'.edgeSet ∪ A₂'.edgeSet := hEU'.symm ▸ hD_le.edgeSet_subset heD + rcases heG' with he₁' | he₂' + · have heAD : e ∈ (A₁ ∩ D).edgeSet := by + rw [hE₁] + exact ⟨he₁', heD⟩ + exact Or.inl (Or.inr heAD.1) + · have heAD : e ∈ (A₂ ∩ D).edgeSet := by + rw [hE₂] + exact ⟨he₂', heD⟩ + exact Or.inr heAD.1 + +private lemma theorem_8_3_part_ii_step {G G' C C' D : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (hCD : G.IsSeparation C D) (hC'D : G'.IsSeparation C' D) + (hV_inter : (C ∩ D).vertexSet = (C' ∩ D).vertexSet) + (hθ : 2 ≤ θ) (h𝒯 : IsTangle G θ 𝒯) (hCD_mem : (C, D) ∈ 𝒯) + {A₁' A₂' A₃' : Hypergraph α β} + (hU' : A₁' ∪ A₂' ∪ A₃' = G') + (h₁ : (A₁', A₂' ∪ A₃') ∈ titanicTransferredTangle G' D 𝒯 θ) + (h₂ : (A₂', A₃' ∪ A₁') ∈ titanicTransferredTangle G' D 𝒯 θ) + (h₃ : (A₃', A₁' ∪ A₂') ∈ titanicTransferredTangle G' D 𝒯 θ) + (htit : (((A₂' ∩ C') ∪ (A₃' ∩ C')) ∩ D).vertexSet.ncard ≤ + (((A₂' ∩ C') ∪ (A₃' ∩ C')) ∩ (A₁' ∩ C')).vertexSet.ncard) : + False := by + let B₁' := A₂' ∪ A₃' + have hsep₁' : G'.IsSeparation A₁' B₁' := h₁.1 + have hord₁' : separationOrder A₁' B₁' < θ := h₁.2.1 + rcases h₁.2.2 with ⟨⟨A₁, B₁⟩, hm₁, hE₁⟩ + rcases h₂.2.2 with ⟨⟨A₂, B₂⟩, hm₂, hE₂⟩ + rcases h₃.2.2 with ⟨⟨A₃, B₃⟩, hm₃, hE₃⟩ + dsimp only at hm₁ hE₁ hm₂ hE₂ hm₃ hE₃ + have hBC_D : (((A₂' ∩ C') ∪ (A₃' ∩ C')) ∩ D).vertexSet = ((B₁' ∩ C') ∩ D).vertexSet := by + ext v + simp only [B₁', inter_vertexSet, union_vertexSet, Set.mem_inter_iff, Set.mem_union] + tauto + have hBC_A : (((A₂' ∩ C') ∪ (A₃' ∩ C')) ∩ (A₁' ∩ C')).vertexSet = + ((B₁' ∩ C') ∩ A₁').vertexSet := by + ext v + simp only [B₁', inter_vertexSet, union_vertexSet, Set.mem_inter_iff, Set.mem_union] + tauto + rw [hBC_D, hBC_A] at htit + let R := (A₁'.vertexSet \ C'.vertexSet) ∩ (B₁' ∩ D).vertexSet + have hR_fin : R.Finite := (A₁'.vertexSet_finite.sdiff).inter_of_left _ + have hset1 : ((A₁' ∪ C') ∩ (B₁' ∩ D)).vertexSet = ((B₁' ∩ C') ∩ D).vertexSet ∪ R := by + ext v + simp only [R, inter_vertexSet, union_vertexSet, Set.mem_inter_iff, Set.mem_union, + Set.mem_sdiff] + constructor + · rintro ⟨hvA | hvC, hvB, hvD⟩ + · by_cases hvC : v ∈ C'.vertexSet + · exact Or.inl ⟨⟨hvB, hvC⟩, hvD⟩ + · exact Or.inr ⟨⟨hvA, hvC⟩, hvB, hvD⟩ + · exact Or.inl ⟨⟨hvB, hvC⟩, hvD⟩ + · tauto + have hset2 : (A₁' ∩ B₁').vertexSet = ((B₁' ∩ C') ∩ A₁').vertexSet ∪ R := by + ext v + have hV_A₁ : v ∈ A₁'.vertexSet → v ∈ C'.vertexSet ∪ D.vertexSet := + fun hv ↦ hC'D.vertexSet_union.symm ▸ hsep₁'.left_le.vertexSet_subset hv + simp only [R, inter_vertexSet, Set.mem_inter_iff, Set.mem_union, Set.mem_sdiff] + constructor + · rintro ⟨hvA, hvB⟩ + by_cases hvC : v ∈ C'.vertexSet + · exact Or.inl ⟨⟨hvB, hvC⟩, hvA⟩ + · have hvD : v ∈ D.vertexSet := (hV_A₁ hvA).resolve_left hvC + exact Or.inr ⟨⟨hvA, hvC⟩, hvB, hvD⟩ + · tauto + have hdisj1 : Disjoint ((B₁' ∩ C') ∩ D).vertexSet R := + Set.disjoint_left.2 fun _ hv1 hv2 ↦ hv2.1.2 hv1.1.2 + have hdisj2 : Disjoint ((B₁' ∩ C') ∩ A₁').vertexSet R := + Set.disjoint_left.2 fun _ hv1 hv2 ↦ hv2.1.2 hv1.1.2 + have hc1 := Set.ncard_union_eq hdisj1 ((B₁' ∩ C') ∩ D).vertexSet_finite hR_fin + have hc2 := Set.ncard_union_eq hdisj2 ((B₁' ∩ C') ∩ A₁').vertexSet_finite hR_fin + have hord_le : separationOrder (A₁' ∪ C') (B₁' ∩ D) ≤ separationOrder A₁' B₁' := by + rw [separationOrder, hset1, hc1, separationOrder, hset2, hc2] + omega + have hPQ : D.IsSeparation (B₁' ∩ D) (A₁' ∩ D) := by + simpa [inter_comm] using hsep₁'.symm.inter_left hC'D.right_le + have hsepG : G.IsSeparation (B₁' ∩ D) ((A₁' ∩ D) ∪ C) := + isSeparation_extend_of_isSeparation hCD hPQ + have hordG_eq : separationOrder (B₁' ∩ D) ((A₁' ∩ D) ∪ C) = + separationOrder (A₁' ∪ C') (B₁' ∩ D) := by + rw [separationOrder_extend_eq hV_inter hPQ, + inter_union_eq_of_isSeparation hC'D hsep₁'.left_le, + separationOrder_comm] + have hordG : separationOrder (B₁' ∩ D) ((A₁' ∩ D) ∪ C) < θ := by omega + rcases h𝒯.axiom1 hsepG hordG with hm | hm + · apply theorem_2_3_proof h𝒯 hθ hm hCD_mem hm₁ + ext e + simp only [union_edgeSet, inter_edgeSet, Set.mem_union, Set.mem_inter_iff] + constructor + · rintro ((⟨_, heD⟩ | heC) | heA₁) + · exact hCD.right_le.edgeSet_subset heD + · exact hCD.left_le.edgeSet_subset heC + · exact (h𝒯.isSeparation hm₁).left_le.edgeSet_subset heA₁ + · intro heG + have heCD : e ∈ C.edgeSet ∪ D.edgeSet := hCD.edgeSet_union.symm ▸ heG + rcases heCD with heC | heD + · exact Or.inl (Or.inr heC) + · have heG' : e ∈ A₁'.edgeSet ∪ B₁'.edgeSet := + hsep₁'.edgeSet_union.symm ▸ hC'D.right_le.edgeSet_subset heD + rcases heG' with heA₁' | heB₁' + · have heAD : e ∈ (A₁ ∩ D).edgeSet := by + rw [hE₁] + exact ⟨heA₁', heD⟩ + exact Or.inr heAD.1 + · exact Or.inl (Or.inl ⟨heB₁', heD⟩) + · apply theorem_2_3_proof h𝒯 hθ hm hm₂ hm₃ + ext e + simp only [union_edgeSet, inter_edgeSet, Set.mem_union, Set.mem_inter_iff] + constructor + · rintro (((⟨_, heD⟩ | heC) | heA₂) | heA₃) + · exact hCD.right_le.edgeSet_subset heD + · exact hCD.left_le.edgeSet_subset heC + · exact (h𝒯.isSeparation hm₂).left_le.edgeSet_subset heA₂ + · exact (h𝒯.isSeparation hm₃).left_le.edgeSet_subset heA₃ + · intro heG + have heCD : e ∈ C.edgeSet ∪ D.edgeSet := hCD.edgeSet_union.symm ▸ heG + rcases heCD with heC | heD + · exact Or.inl (Or.inl (Or.inr heC)) + · have heU' : e ∈ (A₁' ∪ A₂' ∪ A₃').edgeSet := + (congrArg Hypergraph.edgeSet hU').symm ▸ hC'D.right_le.edgeSet_subset heD + rcases heU' with (he₁' | he₂') | he₃' + · exact Or.inl (Or.inl (Or.inl ⟨he₁', heD⟩)) + · have heAD : e ∈ (A₂ ∩ D).edgeSet := by + rw [hE₂] + exact ⟨he₂', heD⟩ + exact Or.inl (Or.inr heAD.1) + · have heAD : e ∈ (A₃ ∩ D).edgeSet := by + rw [hE₃] + exact ⟨he₃', heD⟩ + exact Or.inr heAD.1 + +/-- **Graph Minors X, (8.3)** (page 175): +"Let* $(C, D)$ *be a separation of a hypergraph* $G$, *and let* $(C', D)$ *be a titanic +separation of a hypergraph* $G'$, *with* $V(C \cap D) = V(C' \cap D)$. *Let* $\mathscr{T}$ +*be a tangle in* $G$ *of order* $\theta \ge 2$ *with* $(C, D) \in \mathscr{T}$. *Let* +$\mathscr{T}'$ *be the set of all separations* $(A', B')$ *of* $G'$ *of order* $<\theta$ +*such that there exists* $(A, B) \in \mathscr{T}$ *with* $E(A \cap D) = E(A' \cap D)$. +*Then* $\mathscr{T}'$ *is a tangle in* $G'$ *of order* $\theta$." -/ +theorem theorem_8_3_proof + {G G' C C' D : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (hCD : G.IsSeparation C D) (hC'D : IsTitanic G' C' D) + (hV_inter : (C ∩ D).vertexSet = (C' ∩ D).vertexSet) + (hθ : 2 ≤ θ) (h𝒯 : IsTangle G θ 𝒯) (hCD_mem : (C, D) ∈ 𝒯) : + IsTangle G' θ (titanicTransferredTangle G' D 𝒯 θ) := by + let 𝒯' := titanicTransferredTangle G' D 𝒯 θ + have h1_le : 1 ≤ θ := by omega + have hsep' : ∀ ⦃A' B' : Hypergraph α β⦄, (A', B') ∈ 𝒯' → G'.IsSeparation A' B' := + fun _ _ h ↦ h.1 + have hord' : ∀ ⦃A' B' : Hypergraph α β⦄, (A', B') ∈ 𝒯' → separationOrder A' B' < θ := + fun _ _ h ↦ h.2.1 + have hax1 : TangleAxiom1 G' θ 𝒯' := + theorem_8_3_axiom1 hCD hC'D hV_inter h𝒯 + have hax2 : TangleAxiom2 G' 𝒯' := by + refine theorem_4_5_statement.{u, v} G' θ 𝒯' hθ (fun _ _ h ↦ ⟨hsep' h, hord' h⟩) hax1 ?_ ?_ + · intro A₁' B₁' A₂' B₂' h₁ h₂ + exact theorem_8_3_part_i hCD hC'D.1.right_le hθ h𝒯 hCD_mem h₁ h₂ + · rintro ⟨A₁', A₂', A₃', hle₁, hle₂, hle₃, hd₁₂, hd₂₃, hd₁₃, hU', h₁, h₂, h₃⟩ + let F₁ := A₁' ∩ C' + let F₂ := A₂' ∩ C' + let F₃ := A₃' ∩ C' + have hF₁ : F₁ ≤ C' := inter_le_right hle₁ hC'D.1.left_le + have hF₂ : F₂ ≤ C' := inter_le_right hle₂ hC'D.1.left_le + have hF₃ : F₃ ≤ C' := inter_le_right hle₃ hC'D.1.left_le + have hFU : F₁ ∪ F₂ ∪ F₃ = C' := by + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (union_le (union_le hF₁ hF₂) hF₃) le_rfl ?_ ?_ + · change (A₁'.vertexSet ∩ C'.vertexSet) ∪ (A₂'.vertexSet ∩ C'.vertexSet) ∪ + (A₃'.vertexSet ∩ C'.vertexSet) = C'.vertexSet + have hVU : (A₁' ∪ A₂' ∪ A₃').vertexSet = G'.vertexSet := + congrArg Hypergraph.vertexSet hU' + calc + (A₁'.vertexSet ∩ C'.vertexSet) ∪ (A₂'.vertexSet ∩ C'.vertexSet) ∪ + (A₃'.vertexSet ∩ C'.vertexSet) + = (A₁' ∪ A₂' ∪ A₃').vertexSet ∩ C'.vertexSet := by + simp [Set.union_inter_distrib_right] + _ = G'.vertexSet ∩ C'.vertexSet := by rw [hVU] + _ = C'.vertexSet := Set.inter_eq_right.2 hC'D.1.left_le.vertexSet_subset + · change (A₁'.edgeSet ∩ C'.edgeSet) ∪ (A₂'.edgeSet ∩ C'.edgeSet) ∪ + (A₃'.edgeSet ∩ C'.edgeSet) = C'.edgeSet + have hEU : (A₁' ∪ A₂' ∪ A₃').edgeSet = G'.edgeSet := + congrArg Hypergraph.edgeSet hU' + calc + (A₁'.edgeSet ∩ C'.edgeSet) ∪ (A₂'.edgeSet ∩ C'.edgeSet) ∪ + (A₃'.edgeSet ∩ C'.edgeSet) + = (A₁' ∪ A₂' ∪ A₃').edgeSet ∩ C'.edgeSet := by + simp [Set.union_inter_distrib_right] + _ = G'.edgeSet ∩ C'.edgeSet := by rw [hEU] + _ = C'.edgeSet := Set.inter_eq_right.2 hC'D.1.left_le.edgeSet_subset + have hdF₁₂ : Disjoint F₁.edgeSet F₂.edgeSet := + hd₁₂.mono Set.inter_subset_left Set.inter_subset_left + have hdF₂₃ : Disjoint F₂.edgeSet F₃.edgeSet := + hd₂₃.mono Set.inter_subset_left Set.inter_subset_left + have hdF₁₃ : Disjoint F₁.edgeSet F₃.edgeSet := + hd₁₃.mono Set.inter_subset_left Set.inter_subset_left + rcases hC'D.2 hF₁ hF₂ hF₃ hFU hdF₁₂ hdF₂₃ hdF₁₃ with ht1 | ht2 | ht3 + · have hU₃ : A₃' ∪ A₁' ∪ A₂' = G' := by + rw [union_assoc, union_comm A₃', hU'] + exact theorem_8_3_part_ii_step hCD hC'D.1 hV_inter hθ h𝒯 hCD_mem hU₃ h₃ h₁ h₂ ht1 + · exact theorem_8_3_part_ii_step hCD hC'D.1 hV_inter hθ h𝒯 hCD_mem hU' h₁ h₂ h₃ ht2 + · have hU₂ : A₂' ∪ A₃' ∪ A₁' = G' := by + rw [union_comm (A₂' ∪ A₃'), ← union_assoc, hU'] + exact theorem_8_3_part_ii_step hCD hC'D.1 hV_inter hθ h𝒯 hCD_mem hU₂ h₂ h₃ h₁ ht3 + rw [theorem_2_7_proof h1_le hsep' hord' hax1 hax2] + intro e heG' hsize' + have hsep_e' := isSeparation_edgeHypergraph_deleteEdges heG' + have hord_e' : separationOrder (edgeHypergraph G' e) (G'.deleteEdges {e}) < θ := by + rwa [separationOrder_edgeHypergraph_deleteEdges] + have heC'D : e ∈ C'.edgeSet ∪ D.edgeSet := hC'D.1.edgeSet_union.symm ▸ heG' + rcases heC'D with heC' | heD + · refine ⟨hsep_e', hord_e', ⟨(C, D), hCD_mem, ?_⟩⟩ + have he_notD : e ∉ D.edgeSet := hC'D.1.notMem_edgeSet_right heC' + have h1 : (C ∩ D).edgeSet = ∅ := hCD.edgeSet_inter_eq + have h2 : (edgeHypergraph G' e ∩ D).edgeSet = ∅ := by + ext f + simp only [inter_edgeSet, edgeHypergraph, Set.mem_inter_iff, Set.mem_singleton_iff, + Set.mem_empty_iff_false, iff_false] + rintro ⟨rfl, hfD⟩ + exact he_notD hfD + rw [h1, h2] + · have heG : e ∈ G.edgeSet := hCD.right_le.edgeSet_subset heD + have hends_eq : G.ends e = G'.ends e := + (hCD.right_le.ends_eq e heD).trans (hC'D.1.right_le.ends_eq e heD).symm + have hsizeG : edgeSize G e < θ := by + unfold edgeSize at hsize' ⊢ + rwa [hends_eq] + have hKe_mem : (edgeHypergraph G e, G.deleteEdges {e}) ∈ 𝒯 := + (theorem_2_7_proof h1_le (fun _ _ h ↦ h𝒯.isSeparation h) + (fun _ _ h ↦ h𝒯.order_lt h) h𝒯.axiom1 h𝒯.axiom2).1 h𝒯 e heG hsizeG + refine ⟨hsep_e', hord_e', ⟨(edgeHypergraph G e, G.deleteEdges {e}), hKe_mem, ?_⟩⟩ + simp [edgeHypergraph] + +/-! ## Graph Minors X, (8.4) -/ + +private lemma isTitanic_of_ncard_le_one {G' C' D : Hypergraph α β} + (hsep : G'.IsSeparation C' D) (hcard : C'.vertexSet.ncard ≤ 1) : + IsTitanic G' C' D := by + refine ⟨hsep, fun {X Y Z} hX hY hZ hU _ _ _ ↦ ?_⟩ + rcases Set.eq_empty_or_nonempty C'.vertexSet with hemp | ⟨v, hvC'⟩ + · left + have hXY : ((X ∪ Y) ∩ D).vertexSet = ∅ := by + refine Set.eq_empty_of_subset_empty ?_ + rw [← hemp] + exact Set.inter_subset_left.trans (union_le hX hY).vertexSet_subset + rw [hXY, Set.ncard_empty] + exact Nat.zero_le _ + · have hV_eq : C'.vertexSet = {v} := by + have hsub : {v} ⊆ C'.vertexSet := Set.singleton_subset_iff.2 hvC' + exact (Set.eq_of_subset_of_ncard_le hsub (by simpa using hcard) C'.vertexSet_finite).symm + have hvU : v ∈ X.vertexSet ∪ Y.vertexSet ∪ Z.vertexSet := by + have hVU : (X ∪ Y ∪ Z).vertexSet = C'.vertexSet := congrArg Hypergraph.vertexSet hU + rw [← union_vertexSet, ← union_vertexSet, hVU, hV_eq] + exact Set.mem_singleton v + by_cases hvX : v ∈ X.vertexSet + · by_cases hvY : v ∈ Y.vertexSet + · right; left + have hsub : ((Y ∪ Z) ∩ D).vertexSet ⊆ ((Y ∪ Z) ∩ X).vertexSet := by + intro x hx + have hxC' : x ∈ C'.vertexSet := + (union_le hY hZ).vertexSet_subset hx.1 + rcases Set.mem_singleton_iff.1 (hV_eq ▸ hxC') with rfl + exact ⟨Or.inl hvY, hvX⟩ + exact Set.ncard_le_ncard hsub ((Y ∪ Z) ∩ X).vertexSet_finite + · by_cases hvZ : v ∈ Z.vertexSet + · left + have hsub : ((X ∪ Y) ∩ D).vertexSet ⊆ ((X ∪ Y) ∩ Z).vertexSet := by + intro x hx + have hxC' : x ∈ C'.vertexSet := + (union_le hX hY).vertexSet_subset hx.1 + rcases Set.mem_singleton_iff.1 (hV_eq ▸ hxC') with rfl + exact ⟨Or.inl hvX, hvZ⟩ + exact Set.ncard_le_ncard hsub ((X ∪ Y) ∩ Z).vertexSet_finite + · right; left + have hempYZ : ((Y ∪ Z) ∩ D).vertexSet = ∅ := by + ext x + simp only [inter_vertexSet, union_vertexSet, Set.mem_inter_iff, Set.mem_union, + Set.mem_empty_iff_false, iff_false] + rintro ⟨hxY | hxZ, _⟩ + · have hx := Set.mem_singleton_iff.1 (hV_eq ▸ hY.vertexSet_subset hxY) + exact hvY (hx ▸ hxY) + · have hx := Set.mem_singleton_iff.1 (hV_eq ▸ hZ.vertexSet_subset hxZ) + exact hvZ (hx ▸ hxZ) + rw [hempYZ, Set.ncard_empty] + exact Nat.zero_le _ + · by_cases hvY : v ∈ Y.vertexSet + · by_cases hvZ : v ∈ Z.vertexSet + · left + have hsub : ((X ∪ Y) ∩ D).vertexSet ⊆ ((X ∪ Y) ∩ Z).vertexSet := by + intro x hx + have hxC' : x ∈ C'.vertexSet := + (union_le hX hY).vertexSet_subset hx.1 + rcases Set.mem_singleton_iff.1 (hV_eq ▸ hxC') with rfl + exact ⟨Or.inr hvY, hvZ⟩ + exact Set.ncard_le_ncard hsub ((X ∪ Y) ∩ Z).vertexSet_finite + · right; right + have hempZX : ((Z ∪ X) ∩ D).vertexSet = ∅ := by + ext x + simp only [inter_vertexSet, union_vertexSet, Set.mem_inter_iff, Set.mem_union, + Set.mem_empty_iff_false, iff_false] + rintro ⟨hxZ | hxX, _⟩ + · have hx := Set.mem_singleton_iff.1 (hV_eq ▸ hZ.vertexSet_subset hxZ) + exact hvZ (hx ▸ hxZ) + · have hx := Set.mem_singleton_iff.1 (hV_eq ▸ hX.vertexSet_subset hxX) + exact hvX (hx ▸ hxX) + rw [hempZX, Set.ncard_empty] + exact Nat.zero_le _ + · left + have hempXY : ((X ∪ Y) ∩ D).vertexSet = ∅ := by + ext x + simp only [inter_vertexSet, union_vertexSet, Set.mem_inter_iff, Set.mem_union, + Set.mem_empty_iff_false, iff_false] + rintro ⟨hxX | hxY, _⟩ + · have hx := Set.mem_singleton_iff.1 (hV_eq ▸ hX.vertexSet_subset hxX) + exact hvX (hx ▸ hxX) + · have hx := Set.mem_singleton_iff.1 (hV_eq ▸ hY.vertexSet_subset hxY) + exact hvY (hx ▸ hxY) + rw [hempXY, Set.ncard_empty] + exact Nat.zero_le _ + +/-- **Graph Minors X, (8.4)** (page 176): +"Let* $\mathscr{T}$ *be a tangle of order* $\theta \ge 2$ *in a hypergraph* $G$, *and let* $e +\in E(G)$ *with at most one end. Let* $\mathscr{T}'$ *be the set of all separations* $(A', +B')$ *of* $G \setminus e$ *of order* $<\theta$ *such that there exists* $(A, B) \in +\mathscr{T}$ *with* $E(A \cap (G \setminus e)) = E(A')$. *Then* $\mathscr{T}'$ *is a tangle +in* $G \setminus e$ *of order* $\theta$." -/ +theorem theorem_8_4_proof + {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : IsTangle G θ 𝒯) (hθ : 2 ≤ θ) + {e : β} (he : e ∈ G.edgeSet) (hsize : (G.ends e).ncard ≤ 1) : + IsTangle (G.deleteEdges {e}) θ (deleteEdgeTangle G e 𝒯 θ) := by + let C := edgeHypergraph G e + let D := G.deleteEdges {e} + let C' := C.deleteEdges {e} + have hCD : G.IsSeparation C D := isSeparation_edgeHypergraph_deleteEdges he + have hordCD : separationOrder C D < θ := by + rw [separationOrder_edgeHypergraph_deleteEdges] + unfold edgeSize + omega + have hCD_mem : (C, D) ∈ 𝒯 := + (h𝒯.axiom1 hCD hordCD).resolve_right fun hDC ↦ h𝒯.axiom3 hDC rfl + have hC'_le_D : C' ≤ D := + ⟨fun _ hv ↦ G.vertex_mem_of_inc hv, + by simp [C', C, edgeHypergraph, deleteEdges], + fun f hf ↦ by simp [C', C, edgeHypergraph, deleteEdges] at hf⟩ + have hsepC'D : D.IsSeparation C' D := by + rw [isSeparation_iff_of_le hC'_le_D le_rfl] + refine ⟨Set.union_eq_right.2 hC'_le_D.vertexSet_subset, ?_, ?_⟩ + · simp [C', C, edgeHypergraph, deleteEdges] + · simp [C', C, edgeHypergraph, deleteEdges] + have htit : IsTitanic D C' D := isTitanic_of_ncard_le_one hsepC'D hsize + have hV_inter : (C ∩ D).vertexSet = (C' ∩ D).vertexSet := rfl + have h83 := theorem_8_3_proof hCD htit hV_inter hθ h𝒯 hCD_mem + have h_eq : titanicTransferredTangle D D 𝒯 θ = deleteEdgeTangle G e 𝒯 θ := by + ext ⟨A', B'⟩ + simp only [titanicTransferredTangle, deleteEdgeTangle, Set.mem_ofPred_eq, D] + refine and_congr_right fun hsep' ↦ and_congr_right fun _ ↦ ?_ + refine exists_congr fun p ↦ and_congr_right fun _ ↦ ?_ + have hA'_D : (A' ∩ G.deleteEdges {e}).edgeSet = A'.edgeSet := + Set.inter_eq_left.2 hsep'.left_le.edgeSet_subset + rw [hA'_D] + rwa [h_eq] at h83 + +/-! ## Graph Minors X, (8.5) -/ + +private lemma subsingleton_ends_sdiff_of_isGraph {G : Hypergraph α β} + (hG : G.IsGraph) {W : Set α} {e : β} (he : e ∈ G.edgeSet) + {w : α} (hwW : w ∈ W) (hw_inc : G.Inc e w) : + (G.ends e \ W).Subsingleton := by + intro u hu v hv + by_contra hne + have hcard_le : (G.ends e).ncard ≤ 2 := (hG e he).2 + have hsub : {w, u, v} ⊆ G.ends e := by + intro x hx + simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hx + rcases hx with rfl | rfl | rfl + · exact hw_inc + · exact hu.1 + · exact hv.1 + have hwu : w ≠ u := fun h ↦ hu.2 (h ▸ hwW) + have hwv : w ≠ v := fun h ↦ hv.2 (h ▸ hwW) + have h3 : ({w, u, v} : Set α).ncard = 3 := by + rw [Set.ncard_insert_of_notMem, Set.ncard_insert_of_notMem, Set.ncard_singleton] + · simpa using hne + · simp [hwu, hwv] + have hle := Set.ncard_le_ncard hsub (G.vertexSet_finite.subset fun _ h ↦ G.vertex_mem_of_inc h) + omega + +/-- Canonical lift of a subhypergraph `A'` of `G.deleteVertices W` to a subhypergraph `A_pos` of `G` +by adding `W` to the vertex set and adding all edges incident with `W` whose ends lie in +`V(A') ∪ W`. -/ +private def liftDeleteVerticesLeft (G : Hypergraph α β) (W : Set α) (hW : W ⊆ G.vertexSet) + (A' : Hypergraph α β) (hA' : A' ≤ G.deleteVertices W) : Hypergraph α β where + vertexSet := A'.vertexSet ∪ W + edgeSet := A'.edgeSet ∪ + {e ∈ G.edgeSet \ (G.deleteVertices W).edgeSet | G.ends e ⊆ A'.vertexSet ∪ W} + Inc e v := + (e ∈ A'.edgeSet ∪ + {e ∈ G.edgeSet \ (G.deleteVertices W).edgeSet | G.ends e ⊆ A'.vertexSet ∪ W}) ∧ + G.Inc e v + vertex_mem_of_inc e v h := by + rcases h.1 with heA' | ⟨_, hsub⟩ + · have hinc_del : (G.deleteVertices W).Inc e v := + ⟨h.2, (hA'.edgeSet_subset heA').2⟩ + have hincA' : A'.Inc e v := (inc_iff_of_le hA' heA').2 hinc_del + exact Or.inl (A'.vertex_mem_of_inc hincA') + · exact hsub h.2 + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := A'.vertexSet_finite.union (G.vertexSet_finite.subset hW) + edgeSet_finite := + A'.edgeSet_finite.union (G.edgeSet_finite.subset fun _ h ↦ h.1.1) + +/-- Companion lift of `B'` of `G.deleteVertices W` to a subhypergraph `B_neg` of `G` putting the +remaining `W`-incident edges into `B_neg`. -/ +private def liftDeleteVerticesRight (G : Hypergraph α β) (W : Set α) (hW : W ⊆ G.vertexSet) + (hG : G.IsGraph) + {A' B' : Hypergraph α β} (hsep' : (G.deleteVertices W).IsSeparation A' B') : + Hypergraph α β where + vertexSet := B'.vertexSet ∪ W + edgeSet := B'.edgeSet ∪ + {e ∈ G.edgeSet \ (G.deleteVertices W).edgeSet | ¬ G.ends e ⊆ A'.vertexSet ∪ W} + Inc e v := + (e ∈ B'.edgeSet ∪ + {e ∈ G.edgeSet \ (G.deleteVertices W).edgeSet | ¬ G.ends e ⊆ A'.vertexSet ∪ W}) ∧ + G.Inc e v + vertex_mem_of_inc e v h := by + rcases h.1 with heB' | ⟨⟨heG, he_not_del⟩, hnot_sub⟩ + · have hinc_del : (G.deleteVertices W).Inc e v := + ⟨h.2, (hsep'.right_le.edgeSet_subset heB').2⟩ + have hincB' : B'.Inc e v := (inc_iff_of_le hsep'.right_le heB').2 hinc_del + exact Or.inl (B'.vertex_mem_of_inc hincB') + · by_cases hvW : v ∈ W + · exact Or.inr hvW + · have hw_ex : ∃ w ∈ W, G.Inc e w := by + by_contra! hno + exact he_not_del ⟨heG, hno⟩ + obtain ⟨w, hwW, hw_inc⟩ := hw_ex + obtain ⟨u, hu_inc, hu_not⟩ := Set.not_subset.1 hnot_sub + have huW : u ∉ W := fun h ↦ hu_not (Or.inr h) + have hu_eq_v : u = v := + subsingleton_ends_sdiff_of_isGraph hG heG hwW hw_inc ⟨hu_inc, huW⟩ ⟨h.2, hvW⟩ + have hv_del : v ∈ (G.deleteVertices W).vertexSet := ⟨G.vertex_mem_of_inc h.2, hvW⟩ + have hvAB : v ∈ A'.vertexSet ∪ B'.vertexSet := hsep'.vertexSet_union.symm ▸ hv_del + exact Or.inl (hvAB.resolve_left fun hvA' ↦ hu_not (Or.inl (hu_eq_v.symm ▸ hvA'))) + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := B'.vertexSet_finite.union (G.vertexSet_finite.subset hW) + edgeSet_finite := + B'.edgeSet_finite.union (G.edgeSet_finite.subset fun _ h ↦ h.1.1) + +private lemma deleteVertices_mono {G A : Hypergraph α β} (hA : A ≤ G) (W : Set α) : + A.deleteVertices W ≤ G.deleteVertices W where + vertexSet_subset := Set.sdiff_subset_sdiff hA.vertexSet_subset subset_rfl + edgeSet_subset e he := + ⟨hA.edgeSet_subset he.1, fun v hvW hincG ↦ + he.2 v hvW ((inc_iff_of_le hA he.1).2 hincG)⟩ + ends_eq e he := by + ext v + simp only [Hypergraph.ends, Set.mem_ofPred_eq, deleteVertices] + simp_rw [inc_iff_of_le hA he.1] + +private lemma liftDeleteVerticesLeft_le {G : Hypergraph α β} {W : Set α} + (hW : W ⊆ G.vertexSet) {A' : Hypergraph α β} (hA' : A' ≤ G.deleteVertices W) : + liftDeleteVerticesLeft G W hW A' hA' ≤ G where + vertexSet_subset := + Set.union_subset (hA'.vertexSet_subset.trans Set.sdiff_subset) hW + edgeSet_subset := + Set.union_subset + (hA'.edgeSet_subset.trans (deleteVertices_le G W).edgeSet_subset) + (fun _ h ↦ h.1.1) + ends_eq _ he := Set.ext fun _ ↦ ⟨fun h ↦ ⟨he, h⟩, fun h ↦ h.2⟩ + +private lemma liftDeleteVerticesRight_le {G : Hypergraph α β} {W : Set α} + (hW : W ⊆ G.vertexSet) (hG : G.IsGraph) + {A' B' : Hypergraph α β} (hsep' : (G.deleteVertices W).IsSeparation A' B') : + liftDeleteVerticesRight G W hW hG hsep' ≤ G where + vertexSet_subset := + Set.union_subset (hsep'.right_le.vertexSet_subset.trans Set.sdiff_subset) hW + edgeSet_subset := + Set.union_subset + (hsep'.right_le.edgeSet_subset.trans (deleteVertices_le G W).edgeSet_subset) + (fun _ h ↦ h.1.1) + ends_eq _ he := Set.ext fun _ ↦ ⟨fun h ↦ ⟨he, h⟩, fun h ↦ h.2⟩ + +private lemma liftDeleteVertices_isSeparation {G : Hypergraph α β} {W : Set α} + (hW : W ⊆ G.vertexSet) (hG : G.IsGraph) + {A' B' : Hypergraph α β} (hsep' : (G.deleteVertices W).IsSeparation A' B') : + G.IsSeparation + (liftDeleteVerticesLeft G W hW A' hsep'.left_le) + (liftDeleteVerticesRight G W hW hG hsep') := by + let A_pos := liftDeleteVerticesLeft G W hW A' hsep'.left_le + let B_neg := liftDeleteVerticesRight G W hW hG hsep' + have hA_le : A_pos ≤ G := liftDeleteVerticesLeft_le hW hsep'.left_le + have hB_le : B_neg ≤ G := liftDeleteVerticesRight_le hW hG hsep' + rw [isSeparation_iff_of_le hA_le hB_le] + refine ⟨?_, ?_, ?_⟩ + · change (A'.vertexSet ∪ W) ∪ (B'.vertexSet ∪ W) = G.vertexSet + have h1 : (A'.vertexSet ∪ W) ∪ (B'.vertexSet ∪ W) = (A'.vertexSet ∪ B'.vertexSet) ∪ W := by + ext v; simp only [Set.mem_union]; tauto + rw [h1, hsep'.vertexSet_union] + exact Set.sdiff_union_of_subset hW + · ext e + simp only [A_pos, B_neg, liftDeleteVerticesLeft, liftDeleteVerticesRight, Set.mem_union, + Set.mem_ofPred_eq, Set.mem_sdiff] + constructor + · rintro ((heA' | ⟨⟨heG, _⟩, _⟩) | (heB' | ⟨⟨heG, _⟩, _⟩)) + · exact (hsep'.left_le.edgeSet_subset heA').1 + · exact heG + · exact (hsep'.right_le.edgeSet_subset heB').1 + · exact heG + · intro heG + by_cases he_del : e ∈ (G.deleteVertices W).edgeSet + · rcases (hsep'.edgeSet_union.symm ▸ he_del) with heA' | heB' + · exact Or.inl (Or.inl heA') + · exact Or.inr (Or.inl heB') + · by_cases hsub : G.ends e ⊆ A'.vertexSet ∪ W + · exact Or.inl (Or.inr ⟨⟨heG, he_del⟩, hsub⟩) + · exact Or.inr (Or.inr ⟨⟨heG, he_del⟩, hsub⟩) + · ext e + simp only [A_pos, B_neg, liftDeleteVerticesLeft, liftDeleteVerticesRight, Set.mem_inter_iff, + Set.mem_union, Set.mem_ofPred_eq, Set.mem_sdiff, Set.mem_empty_iff_false, iff_false] + rintro ⟨heA' | ⟨⟨_, he_not⟩, hsub⟩, heB' | ⟨⟨_, he_not'⟩, hnot_sub⟩⟩ + · exact hsep'.notMem_edgeSet_right heA' heB' + · exact he_not' (hsep'.left_le.edgeSet_subset heA') + · exact he_not (hsep'.right_le.edgeSet_subset heB') + · exact hnot_sub hsub + +private lemma deleteVertices_liftDeleteVerticesLeft {G : Hypergraph α β} {W : Set α} + (hW : W ⊆ G.vertexSet) {A' : Hypergraph α β} (hA' : A' ≤ G.deleteVertices W) : + (liftDeleteVerticesLeft G W hW A' hA').deleteVertices W = A' := by + let A_pos := liftDeleteVerticesLeft G W hW A' hA' + have hAdel_le : A_pos.deleteVertices W ≤ G.deleteVertices W := + deleteVertices_mono (liftDeleteVerticesLeft_le hW hA') W + have hdisj : Disjoint A'.vertexSet W := + Set.disjoint_left.2 fun _ hvA' hvW ↦ (hA'.vertexSet_subset hvA').2 hvW + have hV : (A'.vertexSet ∪ W) \ W = A'.vertexSet := + Set.union_sdiff_cancel_right (Set.disjoint_iff.1 hdisj) + have hE : (A_pos.deleteVertices W).edgeSet = A'.edgeSet := by + ext e + simp only [A_pos, deleteVertices, liftDeleteVerticesLeft, Set.mem_ofPred_eq, Set.mem_union, + Set.mem_sdiff] + constructor + · rintro ⟨heA' | ⟨⟨heG, he_not_del⟩, _⟩, hnoW⟩ + · exact heA' + · exfalso + exact he_not_del ⟨heG, fun v hvW hincG ↦ + hnoW v hvW ⟨Or.inr ⟨⟨heG, he_not_del⟩, ‹_›⟩, hincG⟩⟩ + · intro heA' + exact ⟨Or.inl heA', fun v hvW hinc ↦ (hA'.edgeSet_subset heA').2 v hvW hinc.2⟩ + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq hAdel_le hA' hV hE + +private lemma deleteVertices_liftDeleteVerticesRight {G : Hypergraph α β} {W : Set α} + (hW : W ⊆ G.vertexSet) (hG : G.IsGraph) + {A' B' : Hypergraph α β} (hsep' : (G.deleteVertices W).IsSeparation A' B') : + (liftDeleteVerticesRight G W hW hG hsep').deleteVertices W = B' := by + let B_neg := liftDeleteVerticesRight G W hW hG hsep' + have hBdel_le : B_neg.deleteVertices W ≤ G.deleteVertices W := + deleteVertices_mono (liftDeleteVerticesRight_le hW hG hsep') W + have hdisj : Disjoint B'.vertexSet W := + Set.disjoint_left.2 fun _ hvB' hvW ↦ (hsep'.right_le.vertexSet_subset hvB').2 hvW + have hV : (B'.vertexSet ∪ W) \ W = B'.vertexSet := + Set.union_sdiff_cancel_right (Set.disjoint_iff.1 hdisj) + have hE : (B_neg.deleteVertices W).edgeSet = B'.edgeSet := by + ext e + simp only [B_neg, deleteVertices, liftDeleteVerticesRight, Set.mem_ofPred_eq, Set.mem_union, + Set.mem_sdiff] + constructor + · rintro ⟨heB' | ⟨⟨heG, he_not_del⟩, _⟩, hnoW⟩ + · exact heB' + · exfalso + exact he_not_del ⟨heG, fun v hvW hincG ↦ + hnoW v hvW ⟨Or.inr ⟨⟨heG, he_not_del⟩, ‹_›⟩, hincG⟩⟩ + · intro heB' + exact ⟨Or.inl heB', fun v hvW hinc ↦ (hsep'.right_le.edgeSet_subset heB').2 v hvW hinc.2⟩ + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq hBdel_le hsep'.right_le hV hE + +private lemma liftDeleteVertices_separationOrder {G : Hypergraph α β} {W : Set α} + (hW : W ⊆ G.vertexSet) (hG : G.IsGraph) + {A' B' : Hypergraph α β} (hsep' : (G.deleteVertices W).IsSeparation A' B') : + separationOrder + (liftDeleteVerticesLeft G W hW A' hsep'.left_le) + (liftDeleteVerticesRight G W hW hG hsep') = + separationOrder A' B' + W.ncard := by + have h_inter : + ((liftDeleteVerticesLeft G W hW A' hsep'.left_le) ∩ + (liftDeleteVerticesRight G W hW hG hsep')).vertexSet = + (A' ∩ B').vertexSet ∪ W := by + ext v + simp only [inter_vertexSet, liftDeleteVerticesLeft, liftDeleteVerticesRight, + Set.mem_inter_iff, Set.mem_union] + tauto + have hdisj : Disjoint (A' ∩ B').vertexSet W := + Set.disjoint_left.2 fun _ hv hvW ↦ (hsep'.left_le.vertexSet_subset hv.1).2 hvW + rw [separationOrder, h_inter, + Set.ncard_union_eq hdisj (A' ∩ B').vertexSet_finite (G.vertexSet_finite.subset hW), + separationOrder] + +/-- **Graph Minors X, (8.5)** (page 177): +"Let $\mathscr{T}$ be a tangle in a graph $G$ of order $\theta \ge 1$. Let $W \subseteq V(G)$ +with $|W| < \theta$. Let $\mathscr{T}'$ be the set of all separations $(A', B')$ of $G +\setminus W$ of order $< \theta - |W|$ such that there exists $(A, B) \in \mathscr{T}$ with +$W \subseteq V(A \cap B)$ and $A \setminus W = A'$, $B \setminus W = B'$. Then +$\mathscr{T}'$ is a tangle in $G \setminus W$ of order $\theta - |W|$." -/ +theorem theorem_8_5_proof {G : Hypergraph α β} (hG : G.IsGraph) {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {W : Set α} (hW : W ⊆ G.vertexSet) (hW_lt : W.ncard < θ) : + IsTangle (G.deleteVertices W) (θ - W.ncard) (deleteVerticesTangle G W 𝒯 θ) where + one_le := by omega + isSeparation _ _ h := h.1 + order_lt _ _ h := h.2.1 + axiom1 A' B' hsep' hord' := by + let A_pos := liftDeleteVerticesLeft G W hW A' hsep'.left_le + let B_neg := liftDeleteVerticesRight G W hW hG hsep' + have hsep := liftDeleteVertices_isSeparation hW hG hsep' + have hord : separationOrder A_pos B_neg < θ := by + rw [liftDeleteVertices_separationOrder hW hG hsep'] + omega + have hW_AB : W ⊆ (A_pos ∩ B_neg).vertexSet := + Set.subset_inter Set.subset_union_right Set.subset_union_right + have hW_BA : W ⊆ (B_neg ∩ A_pos).vertexSet := + Set.subset_inter Set.subset_union_right Set.subset_union_right + have hA_del : A_pos.deleteVertices W = A' := + deleteVertices_liftDeleteVerticesLeft hW hsep'.left_le + have hB_del : B_neg.deleteVertices W = B' := + deleteVertices_liftDeleteVerticesRight hW hG hsep' + rcases h𝒯.axiom1 hsep hord with hm | hm + · exact Or.inl ⟨hsep', hord', ⟨(A_pos, B_neg), hm, hW_AB, hA_del, hB_del⟩⟩ + · exact Or.inr ⟨hsep'.symm, by rwa [separationOrder_comm], + ⟨(B_neg, A_pos), hm, hW_BA, hB_del, hA_del⟩⟩ + axiom2 A₁' B₁' A₂' B₂' A₃' B₃' h₁ h₂ h₃ hU' := by + let A₁_pos := liftDeleteVerticesLeft G W hW A₁' h₁.1.left_le + let B₁_neg := liftDeleteVerticesRight G W hW hG h₁.1 + let A₂_pos := liftDeleteVerticesLeft G W hW A₂' h₂.1.left_le + let B₂_neg := liftDeleteVerticesRight G W hW hG h₂.1 + let A₃_pos := liftDeleteVerticesLeft G W hW A₃' h₃.1.left_le + let B₃_neg := liftDeleteVerticesRight G W hW hG h₃.1 + have lift_mem : ∀ {A' B' : Hypergraph α β} (h : (A', B') ∈ deleteVerticesTangle G W 𝒯 θ), + (liftDeleteVerticesLeft G W hW A' h.1.left_le, + liftDeleteVerticesRight G W hW hG h.1) ∈ 𝒯 := by + intro A' B' h + rcases h.2.2 with ⟨⟨A, B⟩, hm, hW_sub, hA_eq, hB_eq⟩ + dsimp only at hm hW_sub hA_eq hB_eq + have hsep := liftDeleteVertices_isSeparation hW hG h.1 + have hord : separationOrder + (liftDeleteVerticesLeft G W hW A' h.1.left_le) + (liftDeleteVerticesRight G W hW hG h.1) < θ := by + rw [liftDeleteVertices_separationOrder hW hG h.1] + have := h.2.1 + omega + have hVB : B.vertexSet ⊆ (liftDeleteVerticesRight G W hW hG h.1).vertexSet := by + have hWB : W ⊆ B.vertexSet := hW_sub.trans Set.inter_subset_right + have hB'_eq : B.vertexSet \ W = B'.vertexSet := congrArg Hypergraph.vertexSet hB_eq + change B.vertexSet ⊆ B'.vertexSet ∪ W + rw [← hB'_eq, Set.sdiff_union_of_subset hWB] + exact theorem_2_9_case_1 h𝒯 hm hsep hord hVB + have hm₁ := lift_mem h₁ + have hm₂ := lift_mem h₂ + have hm₃ := lift_mem h₃ + apply h𝒯.axiom2 hm₁ hm₂ hm₃ + have hU_le : A₁_pos ∪ A₂_pos ∪ A₃_pos ≤ G := + union_le (union_le (h𝒯.isSeparation hm₁).left_le (h𝒯.isSeparation hm₂).left_le) + (h𝒯.isSeparation hm₃).left_le + have hVU' : A₁'.vertexSet ∪ A₂'.vertexSet ∪ A₃'.vertexSet = G.vertexSet \ W := + congrArg Hypergraph.vertexSet hU' + have hEU' : A₁'.edgeSet ∪ A₂'.edgeSet ∪ A₃'.edgeSet = (G.deleteVertices W).edgeSet := + congrArg Hypergraph.edgeSet hU' + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hU_le le_rfl ?_ ?_ + · change (A₁'.vertexSet ∪ W) ∪ (A₂'.vertexSet ∪ W) ∪ (A₃'.vertexSet ∪ W) = G.vertexSet + have h1 : (A₁'.vertexSet ∪ W) ∪ (A₂'.vertexSet ∪ W) ∪ (A₃'.vertexSet ∪ W) = + (A₁'.vertexSet ∪ A₂'.vertexSet ∪ A₃'.vertexSet) ∪ W := by + ext v; simp only [Set.mem_union]; tauto + rw [h1, hVU', Set.sdiff_union_of_subset hW] + · ext e + simp only [union_edgeSet, Set.mem_union] + refine ⟨fun h ↦ hU_le.edgeSet_subset h, fun heG ↦ ?_⟩ + by_cases he_del : e ∈ (G.deleteVertices W).edgeSet + · rcases (hEU'.symm ▸ he_del) with (he₁' | he₂') | he₃' + · exact Or.inl (Or.inl (Or.inl he₁')) + · exact Or.inl (Or.inr (Or.inl he₂')) + · exact Or.inr (Or.inl he₃') + · have hw_ex : ∃ w ∈ W, G.Inc e w := by + by_contra! hno + exact he_del ⟨heG, hno⟩ + obtain ⟨w, hwW, hw_inc⟩ := hw_ex + have hsub_sdiff := subsingleton_ends_sdiff_of_isGraph hG heG hwW hw_inc + rcases Set.eq_empty_or_nonempty (G.ends e \ W) with hemp | ⟨u, hu⟩ + · have hsub₁ : G.ends e ⊆ A₁'.vertexSet ∪ W := by + intro v hv + by_cases hvW : v ∈ W + · exact Or.inr hvW + · exact (Set.notMem_empty v (hemp ▸ ⟨hv, hvW⟩)).elim + exact Or.inl (Or.inl (Or.inr ⟨⟨heG, he_del⟩, hsub₁⟩)) + · have hu_del : u ∈ G.vertexSet \ W := ⟨G.vertex_mem_of_inc hu.1, hu.2⟩ + have hu_ends : ∀ {V : Set α}, u ∈ V → G.ends e ⊆ V ∪ W := by + intro V huV v hv + by_cases hvW : v ∈ W + · exact Or.inr hvW + · have hvu : v = u := hsub_sdiff ⟨hv, hvW⟩ hu + exact Or.inl (hvu ▸ huV) + rcases (hVU'.symm ▸ hu_del) with (hu₁ | hu₂) | hu₃ + · exact Or.inl (Or.inl (Or.inr ⟨⟨heG, he_del⟩, hu_ends hu₁⟩)) + · exact Or.inl (Or.inr (Or.inr ⟨⟨heG, he_del⟩, hu_ends hu₂⟩)) + · exact Or.inr (Or.inr ⟨⟨heG, he_del⟩, hu_ends hu₃⟩) + axiom3 A' B' h hVA' := by + rcases h.2.2 with ⟨⟨A, B⟩, hm, hW_sub, hA_eq, _⟩ + dsimp only at hm hW_sub hA_eq + apply h𝒯.axiom3 hm + have hWA : W ⊆ A.vertexSet := hW_sub.trans Set.inter_subset_left + have hVA'_eq : A.vertexSet \ W = G.vertexSet \ W := + (congrArg Hypergraph.vertexSet hA_eq).trans hVA' + calc + A.vertexSet = (A.vertexSet \ W) ∪ W := (Set.sdiff_union_of_subset hWA).symm + _ = (G.vertexSet \ W) ∪ W := by rw [hVA'_eq] + _ = G.vertexSet := Set.sdiff_union_of_subset hW + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/Section9.lean b/LeanPool/GraphMinor/GM10/Section9.lean new file mode 100644 index 0000000000..2bd1ae1c98 --- /dev/null +++ b/LeanPool/GraphMinor/GM10/Section9.lean @@ -0,0 +1,1919 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Defs2 +public import Mathlib.Order.Prod.Lex.Basic +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM10.Section8 +import LeanPool.GraphMinor.GM10.TreeWidthBasic +import Mathlib.Algebra.Order.BigOperators.Group.Finset +import Mathlib.Combinatorics.SimpleGraph.Walk.Maps + +/-! +# Laminar Separations and Tie-Breakers (Graph Minors X, Section 9) + +This file formalizes Section 9 of N. Robertson and P. D. Seymour, +*Graph Minors. X. Obstructions to tree-decomposition*, J. Combin. Theory Ser. B 52 (1991) 153–190 +(pages 177–180): + +- `MakesSeparation.isSeparation`: every pair `(G₁^e, G₂^e)` made by an edge `e` of a + tree-decomposition `(T, τ)` of `G` is a separation of `G`. +- `theorem_9_1_laminar` and `theorem_9_1` (**Graph Minors X, (9.1)**, page 177): the set of + separations made by edges of a tree-decomposition is laminar, and conversely every laminar set + of separations of `G` is made by a tree-decomposition of `G`. +- `theorem_9_2_claim_1`, `theorem_9_2_claim_2`, and `theorem_9_2` (**Graph Minors X, (9.2)**, + page 178): in every hypergraph there is a tie-breaker. +- `theorem_9_3` (**Graph Minors X, (9.3)**, page 179): strengthening of the second tie-breaker + axiom. +- `theorem_9_4` (**Graph Minors X, (9.4)**, page 180): two doubly `λ`-robust separations of `G` + do not cross. +-/ + +public section + +namespace GraphMinor.GM10 + +open SimpleGraph Hypergraph + +variable {α β ι : Type*} + +/-! ## Basic symmetries of `SeparationsCross` and `MakesSeparation` -/ + +theorem separationsCross_comm {A₁ B₁ A₂ B₂ : Hypergraph α β} : + SeparationsCross A₁ B₁ A₂ B₂ ↔ SeparationsCross A₂ B₂ A₁ B₁ := by + unfold SeparationsCross + tauto + +theorem separationsCross_swap_left {A₁ B₁ A₂ B₂ : Hypergraph α β} : + SeparationsCross B₁ A₁ A₂ B₂ ↔ SeparationsCross A₁ B₁ A₂ B₂ := by + unfold SeparationsCross + tauto + +theorem separationsCross_swap_right {A₁ B₁ A₂ B₂ : Hypergraph α β} : + SeparationsCross A₁ B₁ B₂ A₂ ↔ SeparationsCross A₁ B₁ A₂ B₂ := by + unfold SeparationsCross + tauto + +theorem makesSeparation_symm [Fintype ι] {T : SimpleGraph ι} {τ : ι → Hypergraph α β} + {e : Sym2 ι} {A B : Hypergraph α β} : + MakesSeparation T τ e A B ↔ MakesSeparation T τ e B A := by + constructor <;> rintro ⟨u, v, hadj, he, hA, hB⟩ + · refine ⟨v, u, hadj.symm, he.trans (Sym2.eq_swap), ?_, ?_⟩ + · simpa [Sym2.eq_swap] using hB + · simpa [Sym2.eq_swap] using hA + · refine ⟨v, u, hadj.symm, he.trans (Sym2.eq_swap), ?_, ?_⟩ + · simpa [Sym2.eq_swap] using hB + · simpa [Sym2.eq_swap] using hA + +/-! ## Tree component lemmas and Part 1 of (9.1) -/ + +/-- In a tree `T`, deleting an edge `s(u, v)` disconnects `u` and `v`. -/ +theorem not_reachable_deleteEdges {T : SimpleGraph ι} (hT : T.IsTree) + {u v : ι} (hadj : T.Adj u v) : + ¬ (T.deleteEdges {s(u, v)}).Reachable u v := + isAcyclic_iff_forall_adj_isBridge.1 hT.isAcyclic hadj + +/-- In a connected graph `T`, deleting an edge `s(u, v)` leaves every vertex `t` reachable from +either `u` or `v`. -/ +private theorem reachable_deleteEdges_or_of_walk {T : SimpleGraph ι} {u v a b : ι} + (w : T.Walk a b) + (hb : (T.deleteEdges {s(u, v)}).Reachable u b ∨ (T.deleteEdges {s(u, v)}).Reachable v b) : + (T.deleteEdges {s(u, v)}).Reachable u a ∨ (T.deleteEdges {s(u, v)}).Reachable v a := by + induction w with + | nil => exact hb + | @cons x y z hxy _ ih => + by_cases he : s(x, y) = s(u, v) + · rcases Sym2.eq_iff.1 he with ⟨rfl, _⟩ | ⟨rfl, _⟩ + · exact Or.inl (Reachable.refl _) + · exact Or.inr (Reachable.refl _) + · have hadj' : (T.deleteEdges {s(u, v)}).Adj y x := + deleteEdges_adj.mpr ⟨hxy.symm, by simpa [Sym2.eq_swap] using he⟩ + exact (ih hb).imp (fun h ↦ h.trans hadj'.reachable) (fun h ↦ h.trans hadj'.reachable) + +theorem reachable_deleteEdges_or {T : SimpleGraph ι} (hT : T.Connected) + {u v : ι} (t : ι) : + (T.deleteEdges {s(u, v)}).Reachable u t ∨ (T.deleteEdges {s(u, v)}).Reachable v t := by + obtain ⟨w⟩ := hT.preconnected t u + exact reachable_deleteEdges_or_of_walk w (Or.inl (Reachable.refl _)) + +/-- If `b` is reachable from `a` in `T \ e₁` and `x` is not reachable from `a` in `T \ e₁`, then +any walk in `T \ e₁` from `a` to `b` avoids `x` and hence avoids the edge `s(x, y)`. -/ +theorem reachable_deleteEdges_of_not_reachable {T : SimpleGraph ι} {e₁ : Sym2 ι} + {a b x y : ι} (hab : (T.deleteEdges {e₁}).Reachable a b) + (hnx : ¬ (T.deleteEdges {e₁}).Reachable a x) : + (T.deleteEdges {s(x, y)}).Reachable a b := by + obtain ⟨p⟩ := hab + induction p with + | nil => exact Reachable.refl _ + | @cons u c w huc p' ih => + have hux : u ≠ x := by + rintro rfl + exact hnx (Reachable.refl _) + have hncx : ¬ (T.deleteEdges {e₁}).Reachable c x := + fun hcx ↦ hnx (huc.reachable.trans hcx) + have hcx : c ≠ x := by + rintro rfl + exact hncx (Reachable.refl _) + have hne : s(u, c) ≠ s(x, y) := by + intro heq + have hx : x ∈ s(u, c) := heq ▸ Sym2.mem_mk_left x y + rcases Sym2.mem_iff.1 hx with rfl | rfl + · exact hux rfl + · exact hcx rfl + have hadj' : (T.deleteEdges {s(x, y)}).Adj u c := + deleteEdges_adj.mpr ⟨(deleteEdges_adj.mp huc).1, hne⟩ + exact hadj'.reachable.trans (ih hncx) + +theorem biUnion_le_of_le {G : Hypergraph α β} {s : Finset ι} {τ : ι → Hypergraph α β} + (hτ : ∀ t ∈ s, τ t ≤ G) : + Hypergraph.biUnion s τ ≤ G where + vertexSet_subset := by + intro v hv + simp only [biUnion, Set.mem_iUnion] at hv + obtain ⟨t, ht, hvt⟩ := hv + exact (hτ t ht).vertexSet_subset hvt + edgeSet_subset := by + intro e he + simp only [biUnion, Set.mem_iUnion] at he + obtain ⟨t, ht, het⟩ := he + exact (hτ t ht).edgeSet_subset het + ends_eq e he := by + simp only [biUnion, Set.mem_iUnion] at he + obtain ⟨t₀, ht₀, het₀⟩ := he + ext v + simp only [ends, Set.mem_ofPred_eq, biUnion] + refine ⟨fun hinc ↦ ⟨t₀, ht₀, (inc_iff_of_le (hτ t₀ ht₀) het₀).2 hinc⟩, ?_⟩ + rintro ⟨t, ht, hinc⟩ + exact inc_of_le (hτ t ht) hinc + +theorem biUnion_mono {G : Hypergraph α β} {s₁ s₂ : Finset ι} {τ : ι → Hypergraph α β} + (hτ : ∀ t, τ t ≤ G) (hsub : s₁ ⊆ s₂) : + Hypergraph.biUnion s₁ τ ≤ Hypergraph.biUnion s₂ τ := by + rw [le_iff_of_le (biUnion_le_of_le fun t _ ↦ hτ t) (biUnion_le_of_le fun t _ ↦ hτ t)] + refine ⟨?_, ?_⟩ <;> + · intro x hx + simp only [biUnion, Set.mem_iUnion] at hx ⊢ + obtain ⟨t, ht, hxt⟩ := hx + exact ⟨t, hsub ht, hxt⟩ + +/-- For any edge `e = s(u, v)` of `T` in a tree-decomposition `(T, τ)` of `G`, +`(treeDecompSide T τ s(u, v) u, treeDecompSide T τ s(u, v) v)` is a separation of `G` +(Graph Minors X, Section 9, page 177). -/ +theorem IsTreeDecomposition.isSeparation_treeDecompSide [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {u v : ι} (hadj : T.Adj u v) : + G.IsSeparation (treeDecompSide T τ s(u, v) u) (treeDecompSide T τ s(u, v) v) := by + classical + have h1 : treeDecompSide T τ s(u, v) u ≤ G := + biUnion_le_of_le fun t _ ↦ hTD.le t + have h2 : treeDecompSide T τ s(u, v) v ≤ G := + biUnion_le_of_le fun t _ ↦ hTD.le t + rw [isSeparation_iff_of_le h1 h2] + have hnot_uv : ¬ (T.deleteEdges {s(u, v)}).Reachable u v := + not_reachable_deleteEdges hTD.isTree hadj + have hor : ∀ t : ι, (T.deleteEdges {s(u, v)}).Reachable u t ∨ + (T.deleteEdges {s(u, v)}).Reachable v t := + reachable_deleteEdges_or hTD.isTree.connected + refine ⟨?_, ?_, ?_⟩ + · rw [← hTD.biUnion_eq] + ext x + simp only [treeDecompSide, biUnion, Set.mem_union, Set.mem_iUnion, + Finset.mem_filter, Finset.mem_univ, true_and, exists_true_left] + constructor + · rintro (⟨t, _, hxt⟩ | ⟨t, _, hxt⟩) <;> exact ⟨t, hxt⟩ + · rintro ⟨t, hxt⟩ + rcases hor t with hut | hvt + · exact Or.inl ⟨t, hut, hxt⟩ + · exact Or.inr ⟨t, hvt, hxt⟩ + · rw [← hTD.biUnion_eq] + ext e + simp only [treeDecompSide, biUnion, Set.mem_union, Set.mem_iUnion, + Finset.mem_filter, Finset.mem_univ, true_and, exists_true_left] + constructor + · rintro (⟨t, _, het⟩ | ⟨t, _, het⟩) <;> exact ⟨t, het⟩ + · rintro ⟨t, het⟩ + rcases hor t with hut | hvt + · exact Or.inl ⟨t, hut, het⟩ + · exact Or.inr ⟨t, hvt, het⟩ + · ext e + simp only [treeDecompSide, biUnion, Set.mem_inter_iff, Set.mem_iUnion, + Finset.mem_filter, Finset.mem_univ, true_and, Set.mem_empty_iff_false, iff_false, not_and] + rintro ⟨t₁, hut₁, het₁⟩ ⟨t₂, hvt₂, het₂⟩ + have hne : t₁ ≠ t₂ := by + rintro rfl + exact hnot_uv (hut₁.trans hvt₂.symm) + have hemp := hTD.edgeSet_inter_eq hne + exact Set.notMem_empty e (hemp ▸ ⟨het₁, het₂⟩) + +/-- Every pair `(A, B)` made by an edge `e` of `T` in a tree-decomposition `(T, τ)` of `G` is a +separation of `G` (Graph Minors X, Section 9, page 177). -/ +theorem MakesSeparation.isSeparation [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {e : Sym2 ι} {A B : Hypergraph α β} (h : MakesSeparation T τ e A B) : + G.IsSeparation A B := by + obtain ⟨u, v, hadj, _, rfl, rfl⟩ := h + exact hTD.isSeparation_treeDecompSide hadj + +/-- If `e₁ = s(u₁, v₁)` and `e₂ = s(u₂, v₂)` are distinct edges of a tree `T`, and `u₂` is in the +`v₁`-component of `T \ e₁` while `u₁` is in the `u₂`-component of `T \ e₂`, then +`treeDecompSide T τ e₁ u₁ ≤ treeDecompSide T τ e₂ u₂` and +`treeDecompSide T τ e₂ v₂ ≤ treeDecompSide T τ e₁ v₁`. -/ +theorem treeDecompSide_le_of_distinct_edges [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {u₁ v₁ u₂ v₂ : ι} (hadj₁ : T.Adj u₁ v₁) (hadj₂ : T.Adj u₂ v₂) + (hv₁u₂ : (T.deleteEdges {s(u₁, v₁)}).Reachable v₁ u₂) + (hu₂u₁ : (T.deleteEdges {s(u₂, v₂)}).Reachable u₂ u₁) : + treeDecompSide T τ s(u₁, v₁) u₁ ≤ treeDecompSide T τ s(u₂, v₂) u₂ ∧ + treeDecompSide T τ s(u₂, v₂) v₂ ≤ treeDecompSide T τ s(u₁, v₁) v₁ := by + classical + have hnot₁ : ¬ (T.deleteEdges {s(u₁, v₁)}).Reachable u₁ v₁ := + not_reachable_deleteEdges hTD.isTree hadj₁ + have hnot₂ : ¬ (T.deleteEdges {s(u₂, v₂)}).Reachable u₂ v₂ := + not_reachable_deleteEdges hTD.isTree hadj₂ + have hnu₁u₂ : ¬ (T.deleteEdges {s(u₁, v₁)}).Reachable u₁ u₂ := + fun h ↦ hnot₁ (h.trans hv₁u₂.symm) + have hnv₂u₁ : ¬ (T.deleteEdges {s(u₂, v₂)}).Reachable v₂ u₁ := + fun h ↦ hnot₂ (hu₂u₁.trans h.symm) + constructor + · apply biUnion_mono hTD.le + intro t ht + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at ht ⊢ + exact hu₂u₁.trans (reachable_deleteEdges_of_not_reachable ht hnu₁u₂) + · apply biUnion_mono hTD.le + intro t ht + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at ht ⊢ + have h1 : (T.deleteEdges {s(u₁, v₁)}).Reachable v₂ t := + reachable_deleteEdges_of_not_reachable ht hnv₂u₁ + have hne : s(u₂, v₂) ≠ s(u₁, v₁) := by + intro heq + rcases Sym2.eq_iff.1 heq with ⟨h1', h2'⟩ | ⟨h1', h2'⟩ + · subst h1' h2' + exact hnu₁u₂ (Reachable.refl _) + · subst h1' h2' + exact hnv₂u₁ (Reachable.refl _) + have hadj_u₂v₂ : (T.deleteEdges {s(u₁, v₁)}).Adj u₂ v₂ := + deleteEdges_adj.mpr ⟨hadj₂, hne⟩ + exact hv₁u₂.trans (hadj_u₂v₂.reachable.trans h1) + +/-- First part of **Graph Minors X, (9.1)** (page 177): +"If $(T, \tau)$ is a tree-decomposition of $G$, then the set of all separations of $G$ made +by edges of $T$ is laminar." -/ +theorem theorem_9_1_laminar [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) : + IsLaminar (separationsMadeBy T τ) := by + rintro ⟨A₁, B₁⟩ ⟨e₁, _, u₁, v₁, hadj₁, rfl, rfl, rfl⟩ + ⟨A₂, B₂⟩ ⟨e₂, _, u₂, v₂, hadj₂, rfl, rfl, rfl⟩ + unfold SeparationsCross + rw [not_not] + by_cases he : s(u₁, v₁) = s(u₂, v₂) + · rcases Sym2.eq_iff.1 he with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl ⟨le_rfl, le_rfl⟩ + · right; left + simp [Sym2.eq_swap] + · have hor₁ : (T.deleteEdges {s(u₁, v₁)}).Reachable u₁ u₂ ∨ + (T.deleteEdges {s(u₁, v₁)}).Reachable v₁ u₂ := + reachable_deleteEdges_or hTD.isTree.connected u₂ + have hor₂ : (T.deleteEdges {s(u₂, v₂)}).Reachable u₂ u₁ ∨ + (T.deleteEdges {s(u₂, v₂)}).Reachable v₂ u₁ := + reachable_deleteEdges_or hTD.isTree.connected u₁ + have hadj₂_in_1 : (T.deleteEdges {s(u₁, v₁)}).Adj u₂ v₂ := + deleteEdges_adj.mpr ⟨hadj₂, Ne.symm he⟩ + have hadj₁_in_2 : (T.deleteEdges {s(u₂, v₂)}).Adj u₁ v₁ := + deleteEdges_adj.mpr ⟨hadj₁, he⟩ + rcases hor₁ with hu₁u₂ | hv₁u₂ <;> rcases hor₂ with hu₂u₁ | hv₂u₁ + · right; right; left + have hv₂v₁ : (T.deleteEdges {s(u₂, v₂)}).Reachable u₂ v₁ := + hu₂u₁.trans hadj₁_in_2.reachable + have h := treeDecompSide_le_of_distinct_edges hTD hadj₁.symm hadj₂ + (by simpa [Sym2.eq_swap] using hu₁u₂) hv₂v₁ + simpa [Sym2.eq_swap] using h + · right; right; right + have hv₂v₁ : (T.deleteEdges {s(u₂, v₂)}).Reachable v₂ v₁ := + hv₂u₁.trans hadj₁_in_2.reachable + have hu₁v₂ : (T.deleteEdges {s(u₁, v₁)}).Reachable u₁ v₂ := + hu₁u₂.trans hadj₂_in_1.reachable + have h := treeDecompSide_le_of_distinct_edges hTD hadj₁.symm hadj₂.symm + (by simpa [Sym2.eq_swap] using hu₁v₂) (by simpa [Sym2.eq_swap] using hv₂v₁) + simpa [Sym2.eq_swap] using h + · left + exact treeDecompSide_le_of_distinct_edges hTD hadj₁ hadj₂ hv₁u₂ hu₂u₁ + · right; left + have hv₁v₂ : (T.deleteEdges {s(u₁, v₁)}).Reachable v₁ v₂ := + hv₁u₂.trans hadj₂_in_1.reachable + have h := treeDecompSide_le_of_distinct_edges hTD hadj₁ hadj₂.symm + hv₁v₂ (by simpa [Sym2.eq_swap] using hv₂u₁) + simpa [Sym2.eq_swap] using h + +/-! ## Converse of (9.1): Tree-decomposition for a laminar set of separations -/ + +/-- In a finite tree `T`, if every edge `s(u, v)` has at least one valid orientation `R u v` or +`R v u`, then there is a vertex `u₀` such that `R u₀ w` holds for all neighbors `w` of `u₀`. -/ +theorem exists_sink_of_adj_or [Finite ι] {T : SimpleGraph ι} (hT : T.IsTree) + {R : ι → ι → Prop} (hR : ∀ ⦃u v : ι⦄, T.Adj u v → R u v ∨ R v u) : + ∃ u₀ : ι, ∀ w : ι, T.Adj u₀ w → R u₀ w := by + let fintypeVertices := Fintype.ofFinite ι + by_contra! hno + let D : ι → ι → Prop := fun u v ↦ T.Adj u v ∧ ¬ R v u + have hD_ex : ∀ v : ι, ∃ u : ι, D u v := by + intro v + obtain ⟨u, huv, hnR⟩ := hno v + exact ⟨u, huv.symm, hnR⟩ + have hD_asym : ∀ ⦃u v : ι⦄, D u v → ¬ D v u := by + rintro u v ⟨huv, hnR⟩ ⟨_, hnR'⟩ + rcases hR huv with h1 | h2 + · exact hnR' h1 + · exact hnR h2 + have hchain : ∀ k : ℕ, ∃ (u v w : ι) (huv : T.Adj u v) (p : T.Walk v w), + D u v ∧ (Walk.cons huv p).length = k + 1 ∧ + List.IsChain (· ≠ ·) (Walk.cons huv p).edges := by + intro k + induction k with + | zero => + obtain ⟨v⟩ := hT.connected.nonempty + obtain ⟨u, hDuv⟩ := hD_ex v + refine ⟨u, v, v, hDuv.1, .nil, hDuv, rfl, ?_⟩ + simp + | succ k ih => + obtain ⟨u, v, w, huv, p, hDuv, hlen, hch⟩ := ih + obtain ⟨x, hDxu⟩ := hD_ex u + refine ⟨x, u, w, hDxu.1, Walk.cons huv p, hDxu, ?_, ?_⟩ + · simp [hlen] + · simp only [Walk.edges_cons] at hch ⊢ + refine List.isChain_cons_cons.2 ⟨?_, hch⟩ + intro heq + rcases Sym2.eq_iff.1 heq with ⟨h1, _⟩ | ⟨h1, _⟩ + · exact hDxu.1.ne h1 + · subst h1; exact hD_asym hDuv hDxu + obtain ⟨u, v, w, huv, p, _, hlen, hch⟩ := hchain (Fintype.card ι) + let q := Walk.cons huv p + have hq : q.IsPath := (hT.isAcyclic.isPath_iff_isChain q).2 hch + have hle : q.support.length ≤ Fintype.card ι := hq.support_nodup.length_le_card + rw [Walk.length_support, hlen] at hle + omega + +/-- Any walk `p` in `T` whose support does not contain `u₀` avoids the edge `s(u₀, w)`. -/ +theorem reachable_deleteEdges_of_notMem_support {T : SimpleGraph ι} {u₀ w a b : ι} + (p : T.Walk a b) (hu₀ : u₀ ∉ p.support) : + (T.deleteEdges {s(u₀, w)}).Reachable a b := by + induction p with + | nil => exact Reachable.refl _ + | @cons x y z hxy q ih => + simp only [Walk.support_cons, List.mem_cons, not_or] at hu₀ + have hy : y ≠ u₀ := by rintro rfl; exact hu₀.2 q.start_mem_support + have hne : s(x, y) ≠ s(u₀, w) := by + intro heq + have : u₀ ∈ s(x, y) := heq ▸ Sym2.mem_mk_left u₀ w + rcases Sym2.mem_iff.1 this with rfl | rfl + · exact hu₀.1 rfl + · exact hy rfl + exact (deleteEdges_adj.mpr ⟨hxy, hne⟩).reachable.trans (ih hu₀.2) + +/-- In a tree `T`, if `t₁` is in the `u₀`-component of `T \ s(u₀, w)` and `t₂` is in the +`w`-component of `T \ s(u₀, w)`, then `u₀` lies on every path between `t₁` and `t₂`. -/ +theorem onTreePath_of_reachable_deleteEdges {T : SimpleGraph ι} (hT : T.IsTree) + {u₀ w t₁ t₂ : ι} (hadj : T.Adj u₀ w) + (ht₁ : (T.deleteEdges {s(u₀, w)}).Reachable u₀ t₁) + (ht₂ : (T.deleteEdges {s(u₀, w)}).Reachable w t₂) : + OnTreePath T t₁ t₂ u₀ := by + intro p _ + by_contra hu₀ + have hp : (T.deleteEdges {s(u₀, w)}).Reachable t₁ t₂ := + reachable_deleteEdges_of_notMem_support p hu₀ + exact not_reachable_deleteEdges hT hadj (ht₁.trans (hp.trans ht₂.symm)) + +theorem le_treeDecompSide [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {e : Sym2 ι} {u t : ι} (hr : (T.deleteEdges {e}).Reachable u t) : + τ t ≤ treeDecompSide T τ e u := by + classical + unfold treeDecompSide + rw [le_iff_of_le (hTD.le t) (biUnion_le_of_le fun x _ ↦ hTD.le x)] + refine ⟨?_, ?_⟩ <;> + · intro x hx + simp only [biUnion, Set.mem_iUnion, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨t, hr, hx⟩ + +/-- If `u₀` is a sink for `(A₀, B₀)` in `(T, τ)`, then `τ t ≤ B₀` for all `t ≠ u₀`. -/ +private theorem tau_le_right_of_sink [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {A₀ B₀ : Hypergraph α β} {u₀ : ι} + (hu₀ : ∀ w : ι, T.Adj u₀ w → + A₀ ≤ treeDecompSide T τ s(u₀, w) u₀ ∧ treeDecompSide T τ s(u₀, w) w ≤ B₀) + {t : ι} (hne : t ≠ u₀) : + τ t ≤ B₀ := by + obtain ⟨p, hp, _⟩ := hTD.isTree.existsUnique_path u₀ t + cases p with + | nil => exact (hne rfl).elim + | @cons _ w _ hadj q => + rw [Walk.cons_isPath_iff] at hp + have hreach : (T.deleteEdges {s(u₀, w)}).Reachable w t := + reachable_deleteEdges_of_notMem_support q hp.2 + exact (le_treeDecompSide hTD hreach).trans (hu₀ w hadj).2 + +/-- If `u₀` is a sink for `(A₀, B₀)` in `(T, τ)`, then `A₀ ≤ τ u₀`. -/ +private theorem left_le_tau_of_sink [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {A₀ B₀ : Hypergraph α β} (hAB : G.IsSeparation A₀ B₀) {u₀ : ι} + (hu₀ : ∀ w : ι, T.Adj u₀ w → + A₀ ≤ treeDecompSide T τ s(u₀, w) u₀ ∧ treeDecompSide T τ s(u₀, w) w ≤ B₀) : + A₀ ≤ τ u₀ := by + rw [le_iff_of_le hAB.left_le (hTD.le u₀)] + refine ⟨?_, ?_⟩ + · intro v hvA + have hvG : v ∈ G.vertexSet := hAB.left_le.vertexSet_subset hvA + rw [← hTD.biUnion_eq] at hvG + simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, true_and, exists_true_left] at hvG + obtain ⟨t, hvt⟩ := hvG + by_cases htu : t = u₀ + · exact htu ▸ hvt + · obtain ⟨p, hp, _⟩ := hTD.isTree.existsUnique_path u₀ t + cases p with + | nil => exact (htu rfl).elim + | @cons _ w _ hadj q => + rw [Walk.cons_isPath_iff] at hp + have hwt : (T.deleteEdges {s(u₀, w)}).Reachable w t := + reachable_deleteEdges_of_notMem_support q hp.2 + have hv_side : v ∈ (treeDecompSide T τ s(u₀, w) u₀).vertexSet := + (hu₀ w hadj).1.vertexSet_subset hvA + simp only [treeDecompSide, biUnion, Set.mem_iUnion, Finset.mem_filter, Finset.mem_univ, + true_and] at hv_side + obtain ⟨t₁, hut₁, hvt₁⟩ := hv_side + have hon : OnTreePath T t₁ t u₀ := + onTreePath_of_reachable_deleteEdges hTD.isTree hadj hut₁ hwt + exact (hTD.inter_le hon).vertexSet_subset ⟨hvt₁, hvt⟩ + · intro e heA + have heG : e ∈ G.edgeSet := hAB.left_le.edgeSet_subset heA + rw [← hTD.biUnion_eq] at heG + simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, true_and, exists_true_left] at heG + obtain ⟨t, het⟩ := heG + by_cases htu : t = u₀ + · exact htu ▸ het + · exfalso + have heB : e ∈ B₀.edgeSet := + (tau_le_right_of_sink hTD hu₀ htu).edgeSet_subset het + have hemp := hAB.edgeSet_inter_eq + exact Set.notMem_empty e (hemp ▸ ⟨heA, heB⟩) + +private theorem union_inter_eq_tau_of_sink [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {A₀ B₀ : Hypergraph α β} (hAB : G.IsSeparation A₀ B₀) {u₀ : ι} + (hu₀ : ∀ w : ι, T.Adj u₀ w → + A₀ ≤ treeDecompSide T τ s(u₀, w) u₀ ∧ treeDecompSide T τ s(u₀, w) w ≤ B₀) : + A₀ ∪ (τ u₀ ∩ B₀) = τ u₀ := by + have hA₀ : A₀ ≤ τ u₀ := left_le_tau_of_sink hTD hAB hu₀ + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (union_le hAB.left_le (inter_le (hTD.le u₀) hAB.right_le)) (hTD.le u₀) ?_ ?_ + · ext v + simp only [union_vertexSet, inter_vertexSet, Set.mem_union, Set.mem_inter_iff] + refine ⟨fun h ↦ h.elim (fun hv ↦ hA₀.vertexSet_subset hv) And.left, fun hvu ↦ ?_⟩ + have hvAB : v ∈ A₀.vertexSet ∪ B₀.vertexSet := + hAB.vertexSet_union.symm ▸ (hTD.le u₀).vertexSet_subset hvu + rcases hvAB with hvA | hvB + · exact Or.inl hvA + · exact Or.inr ⟨hvu, hvB⟩ + · ext e + simp only [union_edgeSet, inter_edgeSet, Set.mem_union, Set.mem_inter_iff] + refine ⟨fun h ↦ h.elim (fun he ↦ hA₀.edgeSet_subset he) And.left, fun heu ↦ ?_⟩ + have heAB : e ∈ A₀.edgeSet ∪ B₀.edgeSet := + hAB.edgeSet_union.symm ▸ (hTD.le u₀).edgeSet_subset heu + rcases heAB with heA | heB + · exact Or.inl heA + · exact Or.inr ⟨heu, heB⟩ + +open Classical in +/-- Bag assignment on `Option ι` splitting `τ u₀` into `A₀` at `none` and `τ u₀ ∩ B₀` at `some u₀`. +-/ +private noncomputable def leafBag (τ : ι → Hypergraph α β) (u₀ : ι) + (A₀ B₀ : Hypergraph α β) : Option ι → Hypergraph α β + | none => A₀ + | some t => if t = u₀ then τ u₀ ∩ B₀ else τ t + +private theorem leafBag_le [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {A₀ B₀ : Hypergraph α β} (hAB : G.IsSeparation A₀ B₀) (u₀ : ι) (a : Option ι) : + leafBag τ u₀ A₀ B₀ a ≤ G := by + classical + rcases a with _ | t + · exact hAB.left_le + · simp only [leafBag] + split_ifs + · exact inter_le (hTD.le u₀) hAB.right_le + · exact hTD.le t + +private theorem leafBag_le_proj [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {A₀ B₀ : Hypergraph α β} (hAB : G.IsSeparation A₀ B₀) {u₀ : ι} + (hu₀ : ∀ w : ι, T.Adj u₀ w → + A₀ ≤ treeDecompSide T τ s(u₀, w) u₀ ∧ treeDecompSide T τ s(u₀, w) w ≤ B₀) + (a : Option ι) : + leafBag τ u₀ A₀ B₀ a ≤ τ (projAttach u₀ a) := by + classical + rcases a with _ | t + · exact left_le_tau_of_sink hTD hAB hu₀ + · simp only [leafBag, projAttach] + split_ifs with htu + · subst t + exact inter_le_left (hTD.le u₀) hAB.right_le + · exact le_rfl + +private theorem leafBag_some_le_right [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {A₀ B₀ : Hypergraph α β} (hAB : G.IsSeparation A₀ B₀) {u₀ : ι} + (hu₀ : ∀ w : ι, T.Adj u₀ w → + A₀ ≤ treeDecompSide T τ s(u₀, w) u₀ ∧ treeDecompSide T τ s(u₀, w) w ≤ B₀) + (t : ι) : + leafBag τ u₀ A₀ B₀ (some t) ≤ B₀ := by + classical + simp only [leafBag] + split_ifs with htu + · exact inter_le_right (hTD.le u₀) hAB.right_le + · exact tau_le_right_of_sink hTD hu₀ htu + +private theorem isTreeDecomposition_leafGraph [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {A₀ B₀ : Hypergraph α β} (hAB : G.IsSeparation A₀ B₀) {u₀ : ι} + (hu₀ : ∀ w : ι, T.Adj u₀ w → + A₀ ≤ treeDecompSide T τ s(u₀, w) u₀ ∧ treeDecompSide T τ s(u₀, w) w ≤ B₀) : + IsTreeDecomposition G (attachLeaf T u₀) (leafBag τ u₀ A₀ B₀) where + isTree := isTree_attachLeaf hTD.isTree u₀ + le := leafBag_le hTD hAB u₀ + biUnion_eq := by + classical + have hu₀_eq := union_inter_eq_tau_of_sink hTD hAB hu₀ + have hle1 : Hypergraph.biUnion Finset.univ (leafBag τ u₀ A₀ B₀) ≤ G := + biUnion_le_of_le fun a _ ↦ leafBag_le hTD hAB u₀ a + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle1 le_rfl ?_ ?_ + · rw [← hTD.biUnion_eq] + ext v + simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, true_and, exists_true_left] + constructor + · rintro ⟨a, hva⟩ + exact ⟨projAttach u₀ a, (leafBag_le_proj hTD hAB hu₀ a).vertexSet_subset hva⟩ + · rintro ⟨t, hvt⟩ + by_cases htu : t = u₀ + · subst t + rw [← hu₀_eq] at hvt + rcases hvt with hvA | hvB + · exact ⟨none, hvA⟩ + · refine ⟨some u₀, ?_⟩ + simpa [leafBag] using hvB + · refine ⟨some t, ?_⟩ + simp [leafBag, htu, hvt] + · rw [← hTD.biUnion_eq] + ext e + simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, true_and, exists_true_left] + constructor + · rintro ⟨a, hea⟩ + exact ⟨projAttach u₀ a, (leafBag_le_proj hTD hAB hu₀ a).edgeSet_subset hea⟩ + · rintro ⟨t, het⟩ + by_cases htu : t = u₀ + · subst t + rw [← hu₀_eq] at het + rcases het with heA | heB + · exact ⟨none, heA⟩ + · refine ⟨some u₀, ?_⟩ + simpa [leafBag] using heB + · refine ⟨some t, ?_⟩ + simp [leafBag, htu, het] + edgeSet_inter_eq a₁ a₂ hne := by + classical + ext e + simp only [inter_edgeSet, Set.mem_inter_iff, Set.mem_empty_iff_false, iff_false, not_and] + intro he1 he2 + rcases a₁ with _ | t₁ <;> rcases a₂ with _ | t₂ + · exact hne rfl + · have heB : e ∈ B₀.edgeSet := (leafBag_some_le_right hTD hAB hu₀ t₂).edgeSet_subset he2 + exact Set.notMem_empty e (hAB.edgeSet_inter_eq ▸ ⟨he1, heB⟩) + · have heB : e ∈ B₀.edgeSet := (leafBag_some_le_right hTD hAB hu₀ t₁).edgeSet_subset he1 + exact Set.notMem_empty e (hAB.edgeSet_inter_eq ▸ ⟨he2, heB⟩) + · have htne : t₁ ≠ t₂ := by rintro rfl; exact hne rfl + have he1' : e ∈ (τ t₁).edgeSet := (leafBag_le_proj hTD hAB hu₀ (some t₁)).edgeSet_subset he1 + have he2' : e ∈ (τ t₂).edgeSet := (leafBag_le_proj hTD hAB hu₀ (some t₂)).edgeSet_subset he2 + exact Set.notMem_empty e (hTD.edgeSet_inter_eq htne ▸ ⟨he1', he2'⟩) + inter_le {a₁ a₂ a₃} hon := by + classical + by_cases h13 : a₁ = a₃ + · subst a₃ + have hmem := hon .nil Walk.IsPath.nil + simp only [Walk.support_nil, List.mem_singleton] at hmem + subst a₂ + exact inter_le_left (leafBag_le hTD hAB u₀ a₁) (leafBag_le hTD hAB u₀ a₁) + · rcases a₂ with _ | w + · rcases a₁ with _ | x₁ + · exact inter_le_left (leafBag_le hTD hAB u₀ none) (leafBag_le hTD hAB u₀ a₃) + · rcases a₃ with _ | x₃ + · exact inter_le_right (leafBag_le hTD hAB u₀ (some x₁)) (leafBag_le hTD hAB u₀ none) + · exfalso + obtain ⟨q, hq, _⟩ := hTD.isTree.existsUnique_path x₁ x₃ + have hq_map : (q.map (attachLeafSomeHom T u₀)).IsPath := + hq.map (Option.some_injective ι) + have hmem : none ∈ (q.map (attachLeafSomeHom T u₀)).support := hon _ hq_map + rw [Walk.support_map, List.mem_map] at hmem + obtain ⟨w, -, hw⟩ := hmem + change some w = none at hw + cases hw + · have hon' : OnTreePath T (projAttach u₀ a₁) (projAttach u₀ a₃) w := + onTreePath_projAttach_of_some hon + have hle_w : leafBag τ u₀ A₀ B₀ a₁ ∩ leafBag τ u₀ A₀ B₀ a₃ ≤ τ w := by + have h1 := leafBag_le_proj hTD hAB hu₀ a₁ + have h3 := leafBag_le_proj hTD hAB hu₀ a₃ + have h13_le : leafBag τ u₀ A₀ B₀ a₁ ∩ leafBag τ u₀ A₀ B₀ a₃ ≤ + τ (projAttach u₀ a₁) ∩ τ (projAttach u₀ a₃) := by + rw [le_iff_of_le + (inter_le (leafBag_le hTD hAB u₀ a₁) (leafBag_le hTD hAB u₀ a₃)) + (inter_le (hTD.le _) (hTD.le _))] + exact ⟨Set.inter_subset_inter h1.vertexSet_subset h3.vertexSet_subset, + Set.inter_subset_inter h1.edgeSet_subset h3.edgeSet_subset⟩ + exact h13_le.trans (hTD.inter_le hon') + change leafBag τ u₀ A₀ B₀ a₁ ∩ leafBag τ u₀ A₀ B₀ a₃ ≤ + if w = u₀ then τ u₀ ∩ B₀ else τ w + split_ifs with hwu + · subst w + have hle_B₀ : leafBag τ u₀ A₀ B₀ a₁ ∩ leafBag τ u₀ A₀ B₀ a₃ ≤ B₀ := by + rcases a₁ with _ | x₁ + · rcases a₃ with _ | x₃ + · exact (h13 rfl).elim + · exact (inter_le_right (leafBag_le hTD hAB u₀ none) + (leafBag_le hTD hAB u₀ (some x₃))).trans + (leafBag_some_le_right hTD hAB hu₀ x₃) + · exact (inter_le_left (leafBag_le hTD hAB u₀ (some x₁)) + (leafBag_le hTD hAB u₀ a₃)).trans + (leafBag_some_le_right hTD hAB hu₀ x₁) + rw [le_iff_of_le + (inter_le (leafBag_le hTD hAB u₀ a₁) (leafBag_le hTD hAB u₀ a₃)) + (inter_le (hTD.le u₀) hAB.right_le)] + exact ⟨Set.subset_inter hle_w.vertexSet_subset hle_B₀.vertexSet_subset, + Set.subset_inter hle_w.edgeSet_subset hle_B₀.edgeSet_subset⟩ + · exact hle_w + +private theorem treeDecompSide_leafGraph_new_none [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {A₀ B₀ : Hypergraph α β} (hAB : G.IsSeparation A₀ B₀) (u₀ : ι) : + treeDecompSide (attachLeaf T u₀) (leafBag τ u₀ A₀ B₀) s(none, some u₀) none = A₀ := by + classical + have hle1 : treeDecompSide (attachLeaf T u₀) (leafBag τ u₀ A₀ B₀) s(none, some u₀) none ≤ G := + biUnion_le_of_le fun a _ ↦ leafBag_le hTD hAB u₀ a + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle1 hAB.left_le ?_ ?_ <;> + · ext x + simp [treeDecompSide, biUnion, attachLeaf_delete_new_reachable_none, leafBag] + +private theorem treeDecompSide_leafGraph_new_some [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {A₀ B₀ : Hypergraph α β} (hAB : G.IsSeparation A₀ B₀) {u₀ : ι} + (hu₀ : ∀ w : ι, T.Adj u₀ w → + A₀ ≤ treeDecompSide T τ s(u₀, w) u₀ ∧ treeDecompSide T τ s(u₀, w) w ≤ B₀) : + treeDecompSide (attachLeaf T u₀) (leafBag τ u₀ A₀ B₀) s(none, some u₀) (some u₀) = B₀ := by + classical + have hle1 : + treeDecompSide (attachLeaf T u₀) (leafBag τ u₀ A₀ B₀) s(none, some u₀) (some u₀) ≤ G := + biUnion_le_of_le fun a _ ↦ leafBag_le hTD hAB u₀ a + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle1 hAB.right_le ?_ ?_ + · ext v + simp only [treeDecompSide, biUnion, Set.mem_iUnion, Finset.mem_filter, Finset.mem_univ, + true_and, attachLeaf_delete_new_reachable_some hTD.isTree.connected] + constructor + · rintro ⟨a, ⟨t, rfl⟩, hva⟩ + exact (leafBag_some_le_right hTD hAB hu₀ t).vertexSet_subset hva + · intro hvB + have hvG : v ∈ G.vertexSet := hAB.right_le.vertexSet_subset hvB + rw [← hTD.biUnion_eq] at hvG + simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, true_and, exists_true_left] at hvG + obtain ⟨t, hvt⟩ := hvG + refine ⟨some t, ⟨t, rfl⟩, ?_⟩ + by_cases htu : t = u₀ + · subst t + simpa [leafBag] using And.intro hvt hvB + · simp [leafBag, htu, hvt] + · ext e + simp only [treeDecompSide, biUnion, Set.mem_iUnion, Finset.mem_filter, Finset.mem_univ, + true_and, attachLeaf_delete_new_reachable_some hTD.isTree.connected] + constructor + · rintro ⟨a, ⟨t, rfl⟩, hea⟩ + exact (leafBag_some_le_right hTD hAB hu₀ t).edgeSet_subset hea + · intro heB + have heG : e ∈ G.edgeSet := hAB.right_le.edgeSet_subset heB + rw [← hTD.biUnion_eq] at heG + simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, true_and, exists_true_left] at heG + obtain ⟨t, het⟩ := heG + refine ⟨some t, ⟨t, rfl⟩, ?_⟩ + by_cases htu : t = u₀ + · subst t + simpa [leafBag] using And.intro het heB + · simp [leafBag, htu, het] + +private theorem treeDecompSide_leafGraph_old [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {A₀ B₀ : Hypergraph α β} (hAB : G.IsSeparation A₀ B₀) {u₀ : ι} + (hu₀ : ∀ w : ι, T.Adj u₀ w → + A₀ ≤ treeDecompSide T τ s(u₀, w) u₀ ∧ treeDecompSide T τ s(u₀, w) w ≤ B₀) + (x y : ι) (z : Option ι) : + treeDecompSide (attachLeaf T u₀) (leafBag τ u₀ A₀ B₀) s(some x, some y) z = + treeDecompSide T τ s(x, y) (projAttach u₀ z) := by + classical + have hu₀_eq := union_inter_eq_tau_of_sink hTD hAB hu₀ + have hle1 : treeDecompSide (attachLeaf T u₀) (leafBag τ u₀ A₀ B₀) s(some x, some y) z ≤ G := + biUnion_le_of_le fun a _ ↦ leafBag_le hTD hAB u₀ a + have hle2 : treeDecompSide T τ s(x, y) (projAttach u₀ z) ≤ G := + biUnion_le_of_le fun t _ ↦ hTD.le t + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle1 hle2 ?_ ?_ + · ext v + simp only [treeDecompSide, biUnion, Set.mem_iUnion, Finset.mem_filter, Finset.mem_univ, + true_and, attachLeaf_delete_old_reachable_iff] + constructor + · rintro ⟨a, hr, hva⟩ + exact ⟨projAttach u₀ a, hr, (leafBag_le_proj hTD hAB hu₀ a).vertexSet_subset hva⟩ + · rintro ⟨t, hr, hvt⟩ + by_cases htu : t = u₀ + · subst t + rw [← hu₀_eq] at hvt + rcases hvt with hvA | hvB + · exact ⟨none, hr, hvA⟩ + · refine ⟨some u₀, hr, ?_⟩ + simpa [leafBag] using hvB + · refine ⟨some t, hr, ?_⟩ + simp [leafBag, htu, hvt] + · ext e + simp only [treeDecompSide, biUnion, Set.mem_iUnion, Finset.mem_filter, Finset.mem_univ, + true_and, attachLeaf_delete_old_reachable_iff] + constructor + · rintro ⟨a, hr, hea⟩ + exact ⟨projAttach u₀ a, hr, (leafBag_le_proj hTD hAB hu₀ a).edgeSet_subset hea⟩ + · rintro ⟨t, hr, het⟩ + by_cases htu : t = u₀ + · subst t + rw [← hu₀_eq] at het + rcases het with heA | heB + · exact ⟨none, hr, heA⟩ + · refine ⟨some u₀, hr, ?_⟩ + simpa [leafBag] using heB + · refine ⟨some t, hr, ?_⟩ + simp [leafBag, htu, het] + +private theorem makesSeparation_leafGraph_new_iff [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {A₀ B₀ : Hypergraph α β} (hAB : G.IsSeparation A₀ B₀) {u₀ : ι} + (hu₀ : ∀ w : ι, T.Adj u₀ w → + A₀ ≤ treeDecompSide T τ s(u₀, w) u₀ ∧ treeDecompSide T τ s(u₀, w) w ≤ B₀) + {C D : Hypergraph α β} : + MakesSeparation (attachLeaf T u₀) (leafBag τ u₀ A₀ B₀) s(none, some u₀) C D ↔ + (C = A₀ ∧ D = B₀) ∨ (C = B₀ ∧ D = A₀) := by + have hnone := treeDecompSide_leafGraph_new_none hTD hAB u₀ + have hsome := treeDecompSide_leafGraph_new_some hTD hAB hu₀ + constructor + · rintro ⟨a, b, _, heq, rfl, rfl⟩ + rcases Sym2.eq_iff.1 heq.symm with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl ⟨hnone, hsome⟩ + · refine Or.inr ⟨?_, ?_⟩ + · simpa [Sym2.eq_swap] using hsome + · simpa [Sym2.eq_swap] using hnone + · rintro (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) + · exact ⟨none, some u₀, rfl, rfl, hnone.symm, hsome.symm⟩ + · refine ⟨some u₀, none, rfl, Sym2.eq_swap, ?_, ?_⟩ + · simpa [Sym2.eq_swap] using hsome.symm + · simpa [Sym2.eq_swap] using hnone.symm + +private theorem makesSeparation_leafGraph_old_iff [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (hTD : IsTreeDecomposition G T τ) + {A₀ B₀ : Hypergraph α β} (hAB : G.IsSeparation A₀ B₀) {u₀ : ι} + (hu₀ : ∀ w : ι, T.Adj u₀ w → + A₀ ≤ treeDecompSide T τ s(u₀, w) u₀ ∧ treeDecompSide T τ s(u₀, w) w ≤ B₀) + {x y : ι} {C D : Hypergraph α β} : + MakesSeparation (attachLeaf T u₀) (leafBag τ u₀ A₀ B₀) s(some x, some y) C D ↔ + MakesSeparation T τ s(x, y) C D := by + constructor + · rintro ⟨a, b, hadj, heq, rfl, rfl⟩ + rcases Sym2.eq_iff.1 heq.symm with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · refine ⟨x, y, hadj, rfl, ?_, ?_⟩ + · exact treeDecompSide_leafGraph_old hTD hAB hu₀ x y (some x) + · exact treeDecompSide_leafGraph_old hTD hAB hu₀ x y (some y) + · refine ⟨y, x, hadj, Sym2.eq_swap, ?_, ?_⟩ + · exact treeDecompSide_leafGraph_old hTD hAB hu₀ y x (some y) + · exact treeDecompSide_leafGraph_old hTD hAB hu₀ y x (some x) + · rintro ⟨u, v, hadj, heq, rfl, rfl⟩ + rcases Sym2.eq_iff.1 heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · refine ⟨some x, some y, hadj, rfl, ?_, ?_⟩ + · exact (treeDecompSide_leafGraph_old hTD hAB hu₀ x y (some x)).symm + · exact (treeDecompSide_leafGraph_old hTD hAB hu₀ x y (some y)).symm + · refine ⟨some y, some x, hadj, Sym2.eq_swap, ?_, ?_⟩ + · exact (treeDecompSide_leafGraph_old hTD hAB hu₀ y x (some y)).symm + · exact (treeDecompSide_leafGraph_old hTD hAB hu₀ y x (some x)).symm + +/-! ## Proof of (9.2): Existence of a tie-breaker -/ + +/-- Sum of powers of 2 over a subset of `{0, ..., n - 1}` is strictly less than `2 ^ n`. -/ +private theorem sum_two_pow_lt {n : ℕ} (S : Finset ℕ) (hS : ∀ i ∈ S, i < n) : + ∑ i ∈ S, 2 ^ i < 2 ^ n := by + have hsub : S ⊆ Finset.range n := fun i hi ↦ Finset.mem_range.2 (hS i hi) + have hle : ∑ i ∈ S, 2 ^ i ≤ ∑ i ∈ Finset.range n, 2 ^ i := + Finset.sum_le_sum_of_subset hsub + have hgeom : ∀ m, (∑ i ∈ Finset.range m, 2 ^ i) + 1 = 2 ^ m := by + intro m + induction m with + | zero => simp + | succ m ihm => + rw [Finset.sum_range_succ, pow_succ] + omega + have := hgeom n + omega + +/-- Distinct subsets of `{0, ..., n - 1}` have distinct sums of `2 ^ i`. -/ +private theorem eq_of_sum_two_pow_eq : + ∀ (n : ℕ) {S₁ S₂ : Finset ℕ}, (∀ i ∈ S₁, i < n) → (∀ i ∈ S₂, i < n) → + ∑ i ∈ S₁, 2 ^ i = ∑ i ∈ S₂, 2 ^ i → S₁ = S₂ + | 0, S₁, S₂, h₁, h₂, _ => by + ext i + constructor <;> intro hi + · have := h₁ i hi; omega + · have := h₂ i hi; omega + | n + 1, S₁, S₂, h₁, h₂, hsum => by + have hmem : n ∈ S₁ ↔ n ∈ S₂ := by + constructor <;> intro hn + · by_contra hn₂ + have hlt₂ : ∑ i ∈ S₂, 2 ^ i < 2 ^ n := by + refine sum_two_pow_lt S₂ fun i hi ↦ ?_ + have hlt := h₂ i hi + have hne : i ≠ n := by rintro rfl; exact hn₂ hi + omega + have hge₁ : 2 ^ n ≤ ∑ i ∈ S₁, 2 ^ i := + Finset.single_le_sum (fun _ _ ↦ Nat.zero_le _) hn + omega + · by_contra hn₁ + have hlt₁ : ∑ i ∈ S₁, 2 ^ i < 2 ^ n := by + refine sum_two_pow_lt S₁ fun i hi ↦ ?_ + have hlt := h₁ i hi + have hne : i ≠ n := by rintro rfl; exact hn₁ hi + omega + have hge₂ : 2 ^ n ≤ ∑ i ∈ S₂, 2 ^ i := + Finset.single_le_sum (fun _ _ ↦ Nat.zero_le _) hn + omega + have h₁' : ∀ i ∈ S₁.erase n, i < n := by + intro i hi + have hne := (Finset.mem_erase.1 hi).1 + have hlt := h₁ i (Finset.mem_erase.1 hi).2 + omega + have h₂' : ∀ i ∈ S₂.erase n, i < n := by + intro i hi + have hne := (Finset.mem_erase.1 hi).1 + have hlt := h₂ i (Finset.mem_erase.1 hi).2 + omega + have hsum' : ∑ i ∈ S₁.erase n, 2 ^ i = ∑ i ∈ S₂.erase n, 2 ^ i := by + by_cases hn₁ : n ∈ S₁ + · have hn₂ : n ∈ S₂ := hmem.1 hn₁ + have hs₁ := Finset.add_sum_erase S₁ (fun i ↦ 2 ^ i) hn₁ + have hs₂ := Finset.add_sum_erase S₂ (fun i ↦ 2 ^ i) hn₂ + omega + · have hn₂ : n ∉ S₂ := mt hmem.2 hn₁ + rwa [Finset.erase_eq_of_notMem hn₁, Finset.erase_eq_of_notMem hn₂] + have heq := eq_of_sum_two_pow_eq n h₁' h₂' hsum' + ext i + by_cases hin : i = n + · subst hin; exact hmem + · constructor <;> intro hi + · exact (Finset.mem_erase.1 (heq ▸ Finset.mem_erase.2 ⟨hin, hi⟩)).2 + · exact (Finset.mem_erase.1 (heq.symm ▸ Finset.mem_erase.2 ⟨hin, hi⟩)).2 + +private theorem eq_of_sum_two_pow_equiv {γ : Type*} {n : ℕ} (e : γ ≃ Fin n) + {S₁ S₂ : Finset γ} + (hsum : ∑ x ∈ S₁, 2 ^ (e x).val = ∑ x ∈ S₂, 2 ^ (e x).val) : S₁ = S₂ := by + let emb : γ ↪ ℕ := ⟨fun x ↦ (e x).val, fun x y h ↦ e.injective (Fin.ext h)⟩ + have h1 : ∀ S : Finset γ, ∑ i ∈ S.map emb, 2 ^ i = ∑ x ∈ S, 2 ^ (e x).val := + fun S ↦ Finset.sum_map S emb (fun i ↦ 2 ^ i) + have h2 : ∀ S : Finset γ, ∀ i ∈ S.map emb, i < n := by + intro S i hi + rcases Finset.mem_map.1 hi with ⟨x, _, rfl⟩ + exact (e x).isLt + have hmap := eq_of_sum_two_pow_eq n (h2 S₁) (h2 S₂) (by rw [h1, h1, hsum]) + exact Finset.map_injective emb hmap + +/-- The disjoint union `L(G) = V(G) ⊔ E(G)` used in the proof of (9.2) (page 178). -/ +abbrev LType (G : Hypergraph α β) : Type _ := ↥G.vertexSet ⊕ ↥G.edgeSet + +noncomputable instance (G : Hypergraph α β) : Fintype (LType G) := by + classical + haveI : Fintype ↥G.vertexSet := G.vertexSet_finite.fintype + haveI : Fintype ↥G.edgeSet := G.edgeSet_finite.fintype + infer_instance + +open Classical in +/-- The subset `L(A) ⊆ L(G)` for a subhypergraph `A` of `G`. -/ +noncomputable def LFinset (G A : Hypergraph α β) : Finset (LType G) := + Finset.univ.filter fun x ↦ + match x with + | .inl v => v.val ∈ A.vertexSet + | .inr e => e.val ∈ A.edgeSet + +@[simp] +private theorem mem_LFinset_inl {G A : Hypergraph α β} (v : ↥G.vertexSet) : + Sum.inl v ∈ LFinset G A ↔ v.val ∈ A.vertexSet := by + simp [LFinset] + +@[simp] +private theorem mem_LFinset_inr {G A : Hypergraph α β} (e : ↥G.edgeSet) : + Sum.inr e ∈ LFinset G A ↔ e.val ∈ A.edgeSet := by + simp [LFinset] + +private theorem LFinset_self (G : Hypergraph α β) : LFinset G G = Finset.univ := by + ext x + rcases x with ⟨v, hv⟩ | ⟨e, he⟩ + · simp [LFinset, hv] + · simp [LFinset, he] + +open Classical in +private theorem LFinset_union (G A B : Hypergraph α β) : + LFinset G (A ∪ B) = LFinset G A ∪ LFinset G B := by + ext x + rcases x with v | e <;> simp [LFinset] + +open Classical in +private theorem LFinset_inter (G A B : Hypergraph α β) : + LFinset G (A ∩ B) = LFinset G A ∩ LFinset G B := by + ext x + rcases x with v | e <;> simp [LFinset] + +private theorem eq_of_LFinset_eq {G A B : Hypergraph α β} (hA : A ≤ G) (hB : B ≤ G) + (h : LFinset G A = LFinset G B) : A = B := by + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hA hB ?_ ?_ + · ext v + constructor <;> intro hv + · have hvG := hA.vertexSet_subset hv + have hmem : (Sum.inl ⟨v, hvG⟩ : LType G) ∈ LFinset G A := (mem_LFinset_inl _).2 hv + exact (mem_LFinset_inl _).1 (h ▸ hmem) + · have hvG := hB.vertexSet_subset hv + have hmem : (Sum.inl ⟨v, hvG⟩ : LType G) ∈ LFinset G B := (mem_LFinset_inl _).2 hv + exact (mem_LFinset_inl _).1 (h.symm ▸ hmem) + · ext e + constructor <;> intro he + · have heG := hA.edgeSet_subset he + have hmem : (Sum.inr ⟨e, heG⟩ : LType G) ∈ LFinset G A := (mem_LFinset_inr _).2 he + exact (mem_LFinset_inr _).1 (h ▸ hmem) + · have heG := hB.edgeSet_subset he + have hmem : (Sum.inr ⟨e, heG⟩ : LType G) ∈ LFinset G B := (mem_LFinset_inr _).2 he + exact (mem_LFinset_inr _).1 (h.symm ▸ hmem) + +private theorem LFinset_mono {G A B : Hypergraph α β} (h : A ≤ B) : + LFinset G A ⊆ LFinset G B := by + intro x hx + rcases x with v | e + · exact (mem_LFinset_inl v).2 (h.vertexSet_subset ((mem_LFinset_inl v).1 hx)) + · exact (mem_LFinset_inr e).2 (h.edgeSet_subset ((mem_LFinset_inr e).1 hx)) + +open Classical in +private noncomputable def sepScore (G A B : Hypergraph α β) : ℕ := + (LFinset G A).card + (Finset.univ \ LFinset G B).card + +private theorem eq_of_le_of_sepScore_le {G A B C D : Hypergraph α β} + (hAB : G.IsSeparation A B) (hCD : G.IsSeparation C D) + (hCA : C ≤ A) (hBD : B ≤ D) (hscore : sepScore G A B ≤ sepScore G C D) : + C = A ∧ D = B := by + classical + have hsub1 : LFinset G C ⊆ LFinset G A := LFinset_mono hCA + have hsub2 : Finset.univ \ LFinset G D ⊆ Finset.univ \ LFinset G B := + Finset.sdiff_subset_sdiff (Finset.Subset.refl _) (LFinset_mono hBD) + have hc1 : (LFinset G C).card ≤ (LFinset G A).card := Finset.card_le_card hsub1 + have hc2 : (Finset.univ \ LFinset G D).card ≤ (Finset.univ \ LFinset G B).card := + Finset.card_le_card hsub2 + unfold sepScore at hscore + have heq1 : LFinset G C = LFinset G A := + Finset.eq_of_subset_of_card_le hsub1 (by omega) + have heq2 : Finset.univ \ LFinset G D = Finset.univ \ LFinset G B := + Finset.eq_of_subset_of_card_le hsub2 (by omega) + have heq2' : LFinset G D = LFinset G B := by + ext x + have := Finset.ext_iff.1 heq2 x + simp only [Finset.mem_sdiff, Finset.mem_univ, true_and, not_iff_not] at this + exact this + exact ⟨eq_of_LFinset_eq hCD.left_le hAB.left_le heq1, + eq_of_LFinset_eq hCD.right_le hAB.right_le heq2'⟩ + +theorem finite_of_forall_isSeparation {G : Hypergraph α β} + {𝒮 : Set (Hypergraph α β × Hypergraph α β)} + (hsep : ∀ p ∈ 𝒮, G.IsSeparation p.1 p.2) : 𝒮.Finite := by + classical + have : Finite 𝒮 := by + refine Finite.of_injective + (fun (p : 𝒮) ↦ (LFinset G p.val.1, LFinset G p.val.2)) ?_ + rintro ⟨⟨A₁, B₁⟩, h1⟩ ⟨⟨A₂, B₂⟩, h2⟩ heq + simp only [Prod.mk.injEq] at heq + have hs1 := hsep _ h1 + have hs2 := hsep _ h2 + refine Subtype.ext (Prod.ext ?_ ?_) + · exact eq_of_LFinset_eq hs1.left_le hs2.left_le heq.1 + · exact eq_of_LFinset_eq hs1.right_le hs2.right_le heq.2 + exact Set.toFinite 𝒮 + +private theorem mem_leafGraph_edgeSet_iff {T : SimpleGraph ι} {u₀ : ι} {e : Sym2 (Option ι)} : + e ∈ (attachLeaf T u₀).edgeSet ↔ + e = s(none, some u₀) ∨ ∃ x y : ι, T.Adj x y ∧ e = s(some x, some y) := by + induction e using Sym2.ind with | _ a b => + rcases a with _ | x <;> rcases b with _ | y + · simp [attachLeaf] + · constructor + · intro h + have hy : y = u₀ := h + exact Or.inl (by rw [hy]) + · rintro (h | ⟨x', y', _, h⟩) + · rcases Sym2.eq_iff.1 h with ⟨_, hy⟩ | ⟨hy, _⟩ + · exact Option.some.inj hy + · cases hy + · rcases Sym2.eq_iff.1 h with ⟨hx, _⟩ | ⟨hx, _⟩ <;> cases hx + · constructor + · intro h + have hx : x = u₀ := h + exact Or.inl (by rw [hx]; exact Sym2.eq_swap) + · rintro (h | ⟨x', y', _, h⟩) + · rcases Sym2.eq_iff.1 h with ⟨hx, _⟩ | ⟨hx, _⟩ + · cases hx + · exact Option.some.inj hx + · rcases Sym2.eq_iff.1 h with ⟨_, hy⟩ | ⟨_, hy⟩ <;> cases hy + · constructor + · intro hadj + exact Or.inr ⟨x, y, hadj, rfl⟩ + · rintro (h | ⟨x', y', hadj, h⟩) + · rcases Sym2.eq_iff.1 h with ⟨hx, _⟩ | ⟨_, hy⟩ + · cases hx + · cases hy + · rcases Sym2.eq_iff.1 h with ⟨hx, hy⟩ | ⟨hx, hy⟩ + · cases hx; cases hy; exact hadj + · cases hx; cases hy; exact hadj.symm + +/-- Inductive construction of a tree-decomposition for a finite symmetric laminar set of +separations of `G`. -/ +private theorem exists_treeDecomposition_of_symm_laminar (G : Hypergraph α β) : + ∀ (n : ℕ) (𝒮 : Finset (Hypergraph α β × Hypergraph α β)), + 𝒮.card = n → + (∀ p ∈ 𝒮, G.IsSeparation p.1 p.2) → + (∀ p ∈ 𝒮, p.swap ∈ 𝒮) → + IsLaminar (𝒮 : Set (Hypergraph α β × Hypergraph α β)) → + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α β), + IsTreeDecomposition G T τ ∧ + (∀ p ∈ 𝒮, ∃! e : Sym2 ι, e ∈ T.edgeSet ∧ MakesSeparation T τ e p.1 p.2) ∧ + separationsMadeBy T τ = (𝒮 : Set (Hypergraph α β × Hypergraph α β)) := by + classical + intro n + induction n using Nat.strongRecOn with + | ind n ih => + intro 𝒮 hcard hsep hsym hlam + rcases 𝒮.eq_empty_or_nonempty with rfl | hne + · refine ⟨Unit, inferInstance, ⊥, fun _ ↦ G, ?_, ?_, ?_⟩ + · refine ⟨IsTree.of_subsingleton, fun _ ↦ le_rfl, ?_, fun _ _ h ↦ (h rfl).elim, + fun _ _ _ _ ↦ inter_le_left le_rfl le_rfl⟩ + ext x <;> simp [biUnion] + · intro p hp + exact (Finset.notMem_empty p hp).elim + · ext p + simp [separationsMadeBy] + · obtain ⟨⟨A₀, B₀⟩, hAB₀_mem, hmin⟩ := + 𝒮.exists_min_image (fun p ↦ sepScore G p.1 p.2) hne + have hAB₀ : G.IsSeparation A₀ B₀ := hsep (A₀, B₀) hAB₀_mem + let 𝒮' : Finset (Hypergraph α β × Hypergraph α β) := + (𝒮.erase (A₀, B₀)).erase (B₀, A₀) + have hsub : 𝒮' ⊆ 𝒮 := + (Finset.erase_subset _ _).trans (Finset.erase_subset _ _) + have hlt : 𝒮'.card < n := by + rw [← hcard] + exact (Finset.card_erase_le).trans_lt (Finset.card_erase_lt_of_mem hAB₀_mem) + have hsep' : ∀ p ∈ 𝒮', G.IsSeparation p.1 p.2 := fun p hp ↦ hsep p (hsub hp) + have hsym' : ∀ p ∈ 𝒮', p.swap ∈ 𝒮' := by + rintro ⟨C, D⟩ hp + simp only [𝒮', Finset.mem_erase, ne_eq, Prod.swap_prod_mk, Prod.mk.injEq] at hp ⊢ + refine ⟨fun h ↦ hp.2.1 ⟨h.2, h.1⟩, fun h ↦ hp.1 ⟨h.2, h.1⟩, ?_⟩ + exact hsym (C, D) hp.2.2 + have hlam' : IsLaminar (𝒮' : Set (Hypergraph α β × Hypergraph α β)) := by + intro p₁ hp₁ p₂ hp₂ + exact hlam (hsub (Finset.mem_coe.1 hp₁)) (hsub (Finset.mem_coe.1 hp₂)) + obtain ⟨ι', hfin', T', τ', hTD', huniq', hmade'⟩ := + ih 𝒮'.card hlt 𝒮' rfl hsep' hsym' hlam' + have horient : ∀ ⦃C D : Hypergraph α β⦄, (C, D) ∈ 𝒮' → + (A₀ ≤ C ∧ D ≤ B₀) ∨ (A₀ ≤ D ∧ C ≤ B₀) := by + intro C D hCD_mem + have hCD_in : (C, D) ∈ 𝒮 := hsub hCD_mem + have hDC_in : (D, C) ∈ 𝒮 := hsym (C, D) hCD_in + have hCD : G.IsSeparation C D := hsep (C, D) hCD_in + have hncross : ¬ SeparationsCross A₀ B₀ C D := hlam hAB₀_mem hCD_in + unfold SeparationsCross at hncross + rw [not_not] at hncross + rcases hncross with h1 | h2 | ⟨hBC, hDA⟩ | ⟨hBD, hCA⟩ + · exact Or.inl h1 + · exact Or.inr h2 + · exfalso + have heq := eq_of_le_of_sepScore_le hAB₀ hCD.symm hDA hBC (hmin (D, C) hDC_in) + simp only [𝒮', Finset.mem_erase, ne_eq, Prod.mk.injEq] at hCD_mem + exact hCD_mem.1 ⟨heq.2, heq.1⟩ + · exfalso + have heq := eq_of_le_of_sepScore_le hAB₀ hCD hCA hBD (hmin (C, D) hCD_in) + simp only [𝒮', Finset.mem_erase, ne_eq, Prod.mk.injEq] at hCD_mem + exact hCD_mem.2.1 heq + have hR : ∀ ⦃u v : ι'⦄, T'.Adj u v → + (A₀ ≤ treeDecompSide T' τ' s(u, v) u ∧ treeDecompSide T' τ' s(u, v) v ≤ B₀) ∨ + (A₀ ≤ treeDecompSide T' τ' s( v, u) v ∧ treeDecompSide T' τ' s(v, u) u ≤ B₀) := by + intro u v hadj + have hmem_made : + (treeDecompSide T' τ' s(u, v) u, treeDecompSide T' τ' s(u, v) v) ∈ + separationsMadeBy T' τ' := + ⟨s(u, v), hadj, u, v, hadj, rfl, rfl, rfl⟩ + rw [hmade'] at hmem_made + rcases horient hmem_made with h1 | h2 + · exact Or.inl h1 + · right + simpa [Sym2.eq_swap] using h2 + obtain ⟨u₀, hu₀⟩ := exists_sink_of_adj_or hTD'.isTree hR + let T := attachLeaf T' u₀ + let τ := leafBag τ' u₀ A₀ B₀ + have hTD : IsTreeDecomposition G T τ := isTreeDecomposition_leafGraph hTD' hAB₀ hu₀ + have hmade : separationsMadeBy T τ = (𝒮 : Set (Hypergraph α β × Hypergraph α β)) := by + ext ⟨C, D⟩ + simp only [separationsMadeBy, Set.mem_ofPred_eq, Finset.mem_coe] + constructor + · rintro ⟨e, he, hmk⟩ + rcases mem_leafGraph_edgeSet_iff.1 he with rfl | ⟨x, y, hadj, rfl⟩ + · rcases (makesSeparation_leafGraph_new_iff hTD' hAB₀ hu₀).1 hmk with + ⟨hC, hD⟩ | ⟨hC, hD⟩ + · rw [hC, hD]; exact hAB₀_mem + · rw [hC, hD]; exact hsym (A₀, B₀) hAB₀_mem + · have hmk' := (makesSeparation_leafGraph_old_iff hTD' hAB₀ hu₀).1 hmk + have hmem' : (C, D) ∈ separationsMadeBy T' τ' := ⟨s(x, y), hadj, hmk'⟩ + rw [hmade'] at hmem' + exact hsub hmem' + · intro hCD + by_cases h1 : (C, D) = (A₀, B₀) ∨ (C, D) = (B₀, A₀) + · refine ⟨s(none, some u₀), ?_, + (makesSeparation_leafGraph_new_iff hTD' hAB₀ hu₀).2 ?_⟩ + · rfl + · rcases h1 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl ⟨rfl, rfl⟩ + · exact Or.inr ⟨rfl, rfl⟩ + · have hCD' : (C, D) ∈ 𝒮' := by + simp only [𝒮', Finset.mem_erase] + exact ⟨fun h ↦ h1 (Or.inr h), fun h ↦ h1 (Or.inl h), hCD⟩ + have hCD_made : (C, D) ∈ separationsMadeBy T' τ' := by + rw [hmade'] + exact hCD' + obtain ⟨e', he', hmk'⟩ := hCD_made + induction e' using Sym2.ind with | _ x y => + have hadj : T'.Adj x y := he' + exact ⟨s(some x, some y), + mem_leafGraph_edgeSet_iff.2 (Or.inr ⟨x, y, hadj, rfl⟩), + (makesSeparation_leafGraph_old_iff hTD' hAB₀ hu₀).2 hmk'⟩ + refine ⟨Option ι', inferInstance, T, τ, hTD, ?_, hmade⟩ + rintro ⟨C, D⟩ hCD + by_cases h1 : (C, D) = (A₀, B₀) ∨ (C, D) = (B₀, A₀) + · refine ⟨s(none, some u₀), + ⟨show (attachLeaf T' u₀).Adj none (some u₀) by simp [attachLeaf], ?_⟩, ?_⟩ + · refine (makesSeparation_leafGraph_new_iff hTD' hAB₀ hu₀).2 ?_ + rcases h1 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl ⟨rfl, rfl⟩ + · exact Or.inr ⟨rfl, rfl⟩ + · rintro e ⟨he, hmk⟩ + rcases mem_leafGraph_edgeSet_iff.1 he with rfl | ⟨x, y, hadj, rfl⟩ + · rfl + · exfalso + have hmk' := (makesSeparation_leafGraph_old_iff hTD' hAB₀ hu₀).1 hmk + have hmem' : (C, D) ∈ separationsMadeBy T' τ' := ⟨s(x, y), hadj, hmk'⟩ + rw [hmade'] at hmem' + simp only [𝒮', Finset.mem_erase, Finset.mem_coe] at hmem' + rcases h1 with h1 | h1 + · exact hmem'.2.1 h1 + · exact hmem'.1 h1 + · have hCD' : (C, D) ∈ 𝒮' := by + simp only [𝒮', Finset.mem_erase] + exact ⟨fun h ↦ h1 (Or.inr h), fun h ↦ h1 (Or.inl h), hCD⟩ + obtain ⟨e₀, ⟨he₀, hmk₀⟩, huniq₀⟩ := huniq' (C, D) hCD' + induction e₀ using Sym2.ind with | _ x₀ y₀ => + have hadj₀ : T'.Adj x₀ y₀ := he₀ + refine ⟨s(some x₀, some y₀), + ⟨mem_leafGraph_edgeSet_iff.2 (Or.inr ⟨x₀, y₀, hadj₀, rfl⟩), + (makesSeparation_leafGraph_old_iff hTD' hAB₀ hu₀).2 hmk₀⟩, ?_⟩ + rintro e ⟨he, hmk⟩ + rcases mem_leafGraph_edgeSet_iff.1 he with rfl | ⟨x, y, hadj, rfl⟩ + · exfalso + rcases (makesSeparation_leafGraph_new_iff hTD' hAB₀ hu₀).1 hmk with + ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact h1 (Or.inl rfl) + · exact h1 (Or.inr rfl) + · have hmk' := (makesSeparation_leafGraph_old_iff hTD' hAB₀ hu₀).1 hmk + have heq : s(x, y) = s(x₀, y₀) := huniq₀ s(x, y) ⟨hadj, hmk'⟩ + exact congrArg (Sym2.map some) heq + +/-- Second part of **Graph Minors X, (9.1)** (page 177): +"Conversely, if $\{(A_i, B_i) : 1 \le i \le k\}$ is a laminar set of separations of $G$, +there is a tree-decomposition $(T, \tau)$ of $G$ such that* (i) *for $1 \le i \le k$, $(A_i, +B_i)$ is made by a unique edge of $T$* (ii) *for each edge $e$ of $T$, at least one of the +two separations made by $e$ equals $(A_i, B_i)$ for some $i$ ($1 \le i \le k$)." -/ +theorem theorem_9_1_exists_treeDecomposition {G : Hypergraph α β} + {𝒮 : Set (Hypergraph α β × Hypergraph α β)} + (hsep : ∀ p ∈ 𝒮, G.IsSeparation p.1 p.2) + (hlam : IsLaminar 𝒮) : + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α β), + IsTreeDecomposition G T τ ∧ + (∀ p ∈ 𝒮, ∃! e : Sym2 ι, e ∈ T.edgeSet ∧ MakesSeparation T τ e p.1 p.2) ∧ + (∀ e ∈ T.edgeSet, ∃ p ∈ 𝒮, MakesSeparation T τ e p.1 p.2) ∧ + separationsMadeBy T τ = 𝒮 ∪ Prod.swap '' 𝒮 := by + classical + let 𝒮_symm : Set (Hypergraph α β × Hypergraph α β) := 𝒮 ∪ Prod.swap '' 𝒮 + have hsep_symm : ∀ p ∈ 𝒮_symm, G.IsSeparation p.1 p.2 := by + rintro ⟨A, B⟩ (hp | ⟨⟨C, D⟩, hCD, heq⟩) + · exact hsep (A, B) hp + · simp only [Prod.swap_prod_mk, Prod.mk.injEq] at heq + rcases heq with ⟨rfl, rfl⟩ + exact (hsep (C, D) hCD).symm + have hlam_symm : IsLaminar 𝒮_symm := by + rintro ⟨A₁, B₁⟩ (h1 | ⟨⟨C₁, D₁⟩, h1, heq1⟩) ⟨A₂, B₂⟩ (h2 | ⟨⟨C₂, D₂⟩, h2, heq2⟩) + · exact hlam h1 h2 + · simp only [Prod.swap_prod_mk, Prod.mk.injEq] at heq2 + rcases heq2 with ⟨rfl, rfl⟩ + rw [separationsCross_swap_right] + exact hlam h1 h2 + · simp only [Prod.swap_prod_mk, Prod.mk.injEq] at heq1 + rcases heq1 with ⟨rfl, rfl⟩ + rw [separationsCross_swap_left] + exact hlam h1 h2 + · simp only [Prod.swap_prod_mk, Prod.mk.injEq] at heq1 heq2 + rcases heq1 with ⟨rfl, rfl⟩ + rcases heq2 with ⟨rfl, rfl⟩ + rw [separationsCross_swap_left, separationsCross_swap_right] + exact hlam h1 h2 + have hfin : 𝒮_symm.Finite := finite_of_forall_isSeparation hsep_symm + let F := hfin.toFinset + have hF_sep : ∀ p ∈ F, G.IsSeparation p.1 p.2 := + fun p hp ↦ hsep_symm p (hfin.mem_toFinset.1 hp) + have hF_sym : ∀ p ∈ F, p.swap ∈ F := by + intro p hp + rw [Set.Finite.mem_toFinset] at hp ⊢ + rcases hp with hp | ⟨q, hq, rfl⟩ + · exact Or.inr ⟨p, hp, rfl⟩ + · rw [Prod.swap_swap] + exact Or.inl hq + have hF_lam : IsLaminar (F : Set (Hypergraph α β × Hypergraph α β)) := by + intro p₁ hp₁ p₂ hp₂ + rw [Set.Finite.coe_toFinset] at hp₁ hp₂ + exact hlam_symm hp₁ hp₂ + obtain ⟨ι, hfin_ι, T, τ, hTD, huniq, hmade⟩ := + exists_treeDecomposition_of_symm_laminar G F.card F rfl hF_sep hF_sym hF_lam + rw [Set.Finite.coe_toFinset] at hmade + refine ⟨ι, hfin_ι, T, τ, hTD, ?_, ?_, hmade⟩ + · intro p hp + exact huniq p (hfin.mem_toFinset.2 (Or.inl hp)) + · intro e he + induction e using Sym2.ind with | _ u v => + have hadj : T.Adj u v := he + have hmem : (treeDecompSide T τ s(u, v) u, treeDecompSide T τ s(u, v) v) ∈ + separationsMadeBy T τ := + ⟨s(u, v), he, u, v, hadj, rfl, rfl, rfl⟩ + rw [hmade] at hmem + rcases hmem with h1 | ⟨⟨A, B⟩, hAB, heq⟩ + · exact ⟨(treeDecompSide T τ s(u, v) u, treeDecompSide T τ s(u, v) v), h1, + u, v, hadj, rfl, rfl, rfl⟩ + · simp only [Prod.swap_prod_mk, Prod.mk.injEq] at heq + refine ⟨(A, B), hAB, (makesSeparation_symm).2 ?_⟩ + exact ⟨u, v, hadj, rfl, heq.1, heq.2⟩ + +/-- **Graph Minors X, (9.1)** (page 177): +Characterization of laminar sets of separations of a hypergraph `G` as those made by edges of a +tree-decomposition of `G`. -/ +theorem theorem_9_1_proof {G : Hypergraph α β} + {𝒮 : Set (Hypergraph α β × Hypergraph α β)} + (hsep : ∀ p ∈ 𝒮, G.IsSeparation p.1 p.2) : + IsLaminar 𝒮 ↔ + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α β), + IsTreeDecomposition G T τ ∧ + (∀ p ∈ 𝒮, ∃! e : Sym2 ι, e ∈ T.edgeSet ∧ MakesSeparation T τ e p.1 p.2) ∧ + (∀ e ∈ T.edgeSet, ∃ p ∈ 𝒮, MakesSeparation T τ e p.1 p.2) ∧ + separationsMadeBy T τ = 𝒮 ∪ Prod.swap '' 𝒮 := by + constructor + · exact theorem_9_1_exists_treeDecomposition hsep + · rintro ⟨ι, _, T, τ, hTD, _, _, hmade⟩ p₁ hp₁ p₂ hp₂ + have hlam := theorem_9_1_laminar hTD + rw [hmade] at hlam + exact hlam (Or.inl hp₁) (Or.inl hp₂) + +open Classical in +/-- An enumeration of unordered pairs in `L(G)`. -/ +private noncomputable def sym2EquivFin (G : Hypergraph α β) : + Sym2 (LType G) ≃ Fin (Fintype.card (Sym2 (LType G))) := + Fintype.equivFin (Sym2 (LType G)) + +open Classical in +/-- The weight function `μ(x, y) = 2 ^ enc({x, y})` on `L(G) × L(G)` in the proof of (9.2) +(page 178). -/ +noncomputable def tieBreakerMu (G : Hypergraph α β) (x y : LType G) : ℕ := + 2 ^ (sym2EquivFin G s(x, y)).val + +private theorem tieBreakerMu_symm (G : Hypergraph α β) (x y : LType G) : + tieBreakerMu G x y = tieBreakerMu G y x := by + simp [tieBreakerMu, Sym2.eq_swap] + +open Classical in +/-- Second component `N₂(A, B) = ∑_{x ∈ V(A ∩ B)} μ(x, x)` in the proof of (9.2) (page 178). -/ +noncomputable def tieBreakerN2 (G A B : Hypergraph α β) : ℕ := + ∑ x ∈ LFinset G A ∩ LFinset G B, tieBreakerMu G x x + +open Classical in +/-- Third component `N₃(A, B) = ∑_{x ∈ L(A) \ L(B), y ∈ L(B) \ L(A)} μ(x, y)` in the proof of (9.2) +(page 178). -/ +noncomputable def tieBreakerN3 (G A B : Hypergraph α β) : ℕ := + ∑ x ∈ LFinset G A \ LFinset G B, + ∑ y ∈ LFinset G B \ LFinset G A, tieBreakerMu G x y + +/-- The concrete tie-breaker `λ(A, B) = (N₁, N₂, N₃)` in `ℕ ×ₗ (ℕ ×ₗ ℕ)` constructed in the +proof of (9.2) (page 178). -/ +noncomputable def canonicalTieBreaker (G : Hypergraph α β) + (p : Hypergraph α β × Hypergraph α β) : Lex (ℕ × Lex (ℕ × ℕ)) := + toLex (separationOrder p.1 p.2, toLex (tieBreakerN2 G p.1 p.2, tieBreakerN3 G p.1 p.2)) + +private theorem bipartite_sym2_Determine {γ : Type*} [DecidableEq γ] + {X Y X' Y' : Finset γ} (hdisj : Disjoint X Y) (hdisj' : Disjoint X' Y') + (hunion : X ∪ Y = X' ∪ Y') + (hpairs : ∀ a b : γ, ((a ∈ X ∧ b ∈ Y) ∨ (b ∈ X ∧ a ∈ Y)) ↔ + ((a ∈ X' ∧ b ∈ Y') ∨ (b ∈ X' ∧ a ∈ Y'))) : + (X' = X ∧ Y' = Y) ∨ (X' = Y ∧ Y' = X) := by + rcases X.eq_empty_or_nonempty with rfl | ⟨x₀, hx₀⟩ + · simp only [Finset.empty_union] at hunion + rcases X'.eq_empty_or_nonempty with rfl | ⟨a, ha⟩ + · simp only [Finset.empty_union] at hunion + exact Or.inl ⟨rfl, hunion.symm⟩ + · have hY' : Y' = ∅ := by + refine Finset.eq_empty_iff_forall_notMem.2 fun b hb ↦ ?_ + have := (hpairs a b).2 (Or.inl ⟨ha, hb⟩) + simp at this + subst hY' + simp only [Finset.union_empty] at hunion + exact Or.inr ⟨hunion.symm, rfl⟩ + · rcases Y.eq_empty_or_nonempty with rfl | ⟨y₀, hy₀⟩ + · simp only [Finset.union_empty] at hunion + rcases Y'.eq_empty_or_nonempty with rfl | ⟨b, hb⟩ + · simp only [Finset.union_empty] at hunion + exact Or.inl ⟨hunion.symm, rfl⟩ + · have hX' : X' = ∅ := by + refine Finset.eq_empty_iff_forall_notMem.2 fun a ha ↦ ?_ + have := (hpairs a b).2 (Or.inl ⟨ha, hb⟩) + simp at this + subst hX' + simp only [Finset.empty_union] at hunion + exact Or.inr ⟨rfl, hunion.symm⟩ + · have hx₀_mem : x₀ ∈ X' ∪ Y' := hunion ▸ Finset.mem_union_left Y hx₀ + rcases Finset.mem_union.1 hx₀_mem with hx₀X' | hx₀Y' + · left + have hY_sub : Y ⊆ Y' := by + intro y hy + rcases (hpairs x₀ y).1 (Or.inl ⟨hx₀, hy⟩) with ⟨_, hyY'⟩ | ⟨_, hx₀Y'⟩ + · exact hyY' + · exfalso; exact Finset.disjoint_left.1 hdisj' hx₀X' hx₀Y' + have hy₀Y' : y₀ ∈ Y' := hY_sub hy₀ + have hX_sub : X ⊆ X' := by + intro x hx + rcases (hpairs x y₀).1 (Or.inl ⟨hx, hy₀⟩) with ⟨hxX', _⟩ | ⟨hy₀X', _⟩ + · exact hxX' + · exfalso; exact Finset.disjoint_left.1 hdisj' hy₀X' hy₀Y' + refine ⟨Finset.Subset.antisymm ?_ hX_sub, Finset.Subset.antisymm ?_ hY_sub⟩ + · intro x hx + have hx_uy : x ∈ X ∪ Y := hunion.symm ▸ Finset.mem_union_left Y' hx + rcases Finset.mem_union.1 hx_uy with hxX | hxY + · exact hxX + · exfalso; exact Finset.disjoint_left.1 hdisj' hx (hY_sub hxY) + · intro y hy + have hy_uy : y ∈ X ∪ Y := hunion.symm ▸ Finset.mem_union_right X' hy + rcases Finset.mem_union.1 hy_uy with hyX | hyY + · exfalso; exact Finset.disjoint_left.1 hdisj' (hX_sub hyX) hy + · exact hyY + · right + have hY_sub : Y ⊆ X' := by + intro y hy + rcases (hpairs x₀ y).1 (Or.inl ⟨hx₀, hy⟩) with ⟨hx₀X', _⟩ | ⟨hyX', _⟩ + · exfalso; exact Finset.disjoint_left.1 hdisj' hx₀X' hx₀Y' + · exact hyX' + have hy₀X' : y₀ ∈ X' := hY_sub hy₀ + have hX_sub : X ⊆ Y' := by + intro x hx + rcases (hpairs x y₀).1 (Or.inl ⟨hx, hy₀⟩) with ⟨_, hy₀Y'⟩ | ⟨_, hxY'⟩ + · exfalso; exact Finset.disjoint_left.1 hdisj' hy₀X' hy₀Y' + · exact hxY' + refine ⟨Finset.Subset.antisymm ?_ hY_sub, Finset.Subset.antisymm ?_ hX_sub⟩ + · intro x hx + have hx_uy : x ∈ X ∪ Y := hunion.symm ▸ Finset.mem_union_left Y' hx + rcases Finset.mem_union.1 hx_uy with hxX | hxY + · exfalso; exact Finset.disjoint_left.1 hdisj' hx (hX_sub hxX) + · exact hxY + · intro y hy + have hy_uy : y ∈ X ∪ Y := hunion.symm ▸ Finset.mem_union_right X' hy + rcases Finset.mem_union.1 hy_uy with hyX | hyY + · exact hyX + · exfalso; exact Finset.disjoint_left.1 hdisj' (hY_sub hyY) hy + +/-- Claim (1) in the proof of **Graph Minors X, (9.2)** (page 178): +"If $(A, B)$ and $(A', B')$ are separations of $G$ with the same $\lambda$-order then $(A', +B') = (A, B)$ or $(B, A)$." -/ +theorem theorem_9_2_claim_1 {G A B A' B' : Hypergraph α β} + (hAB : G.IsSeparation A B) (hA'B' : G.IsSeparation A' B') + (hlam : canonicalTieBreaker G (A, B) = canonicalTieBreaker G (A', B')) : + (A' = A ∧ B' = B) ∨ (A' = B ∧ B' = A) := by + classical + have hN2 : tieBreakerN2 G A B = tieBreakerN2 G A' B' := by + simpa [canonicalTieBreaker] using congrArg (fun x ↦ (ofLex (ofLex x).2).1) hlam + have hN3 : tieBreakerN3 G A B = tieBreakerN3 G A' B' := by + simpa [canonicalTieBreaker] using congrArg (fun x ↦ (ofLex (ofLex x).2).2) hlam + let Z := LFinset G A ∩ LFinset G B + let Z' := LFinset G A' ∩ LFinset G B' + have hZ_eq : Z = Z' := by + let diag : LType G ↪ Sym2 (LType G) := + ⟨fun x ↦ s(x, x), fun x y h ↦ by + rcases Sym2.eq_iff.1 h with ⟨rfl, _⟩ | ⟨rfl, _⟩ <;> rfl⟩ + have hsum1 : ∀ S : Finset (LType G), + ∑ s ∈ S.map diag, 2 ^ (sym2EquivFin G s).val = ∑ x ∈ S, tieBreakerMu G x x := + fun S ↦ Finset.sum_map S diag (fun s ↦ 2 ^ (sym2EquivFin G s).val) + have hmap : Z.map diag = Z'.map diag := + eq_of_sum_two_pow_equiv (sym2EquivFin G) (by rw [hsum1 Z, hsum1 Z']; exact hN2) + exact Finset.map_injective diag hmap + let X := LFinset G A \ LFinset G B + let Y := LFinset G B \ LFinset G A + let X' := LFinset G A' \ LFinset G B' + let Y' := LFinset G B' \ LFinset G A' + have hdisj : Disjoint X Y := disjoint_sdiff_sdiff + have hdisj' : Disjoint X' Y' := disjoint_sdiff_sdiff + have hN3_image : ∀ (P Q : Finset (LType G)), Disjoint P Q → + ∑ x ∈ P, ∑ y ∈ Q, tieBreakerMu G x y = + ∑ s ∈ (P ×ˢ Q).image (fun p ↦ s(p.1, p.2)), 2 ^ (sym2EquivFin G s).val := by + intro P Q hPQ + rw [← Finset.sum_product', Finset.sum_image] + · rfl + · intro ⟨x₁, y₁⟩ h1 ⟨x₂, y₂⟩ h2 heq + simp only [Finset.mem_coe, Finset.mem_product] at h1 h2 + rcases Sym2.eq_iff.1 heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · exfalso; exact Finset.disjoint_left.1 hPQ h1.1 h2.2 + have himg_eq : (X ×ˢ Y).image (fun p ↦ s(p.1, p.2)) = + (X' ×ˢ Y').image (fun p ↦ s(p.1, p.2)) := by + apply eq_of_sum_two_pow_equiv (sym2EquivFin G) + rw [← hN3_image X Y hdisj, ← hN3_image X' Y' hdisj'] + exact hN3 + have hpairs : ∀ a b : LType G, ((a ∈ X ∧ b ∈ Y) ∨ (b ∈ X ∧ a ∈ Y)) ↔ + ((a ∈ X' ∧ b ∈ Y') ∨ (b ∈ X' ∧ a ∈ Y')) := by + intro a b + have hmem : ∀ (P Q : Finset (LType G)), + s(a, b) ∈ (P ×ˢ Q).image (fun p ↦ s(p.1, p.2)) ↔ + ((a ∈ P ∧ b ∈ Q) ∨ (b ∈ P ∧ a ∈ Q)) := by + intro P Q + simp only [Finset.mem_image, Finset.mem_product, Prod.exists, Sym2.eq_iff] + constructor + · rintro ⟨x, y, ⟨hx, hy⟩, ⟨rfl, rfl⟩ | ⟨h1, h2⟩⟩ + · exact Or.inl ⟨hx, hy⟩ + · subst h1 h2; exact Or.inr ⟨hx, hy⟩ + · rintro (⟨ha, hb⟩ | ⟨hb, ha⟩) + · exact ⟨a, b, ⟨ha, hb⟩, Or.inl ⟨rfl, rfl⟩⟩ + · exact ⟨b, a, ⟨hb, ha⟩, Or.inr ⟨rfl, rfl⟩⟩ + rw [← hmem X Y, ← hmem X' Y', himg_eq] + have hunion_Z : ∀ {P Q : Hypergraph α β}, G.IsSeparation P Q → + (LFinset G P \ LFinset G Q) ∪ (LFinset G Q \ LFinset G P) = + Finset.univ \ (LFinset G P ∩ LFinset G Q) := by + intro P Q hPQ + have hPQ_univ : LFinset G P ∪ LFinset G Q = Finset.univ := by + rw [← LFinset_union, hPQ.union_eq, LFinset_self] + ext x + have hx_u : x ∈ LFinset G P ∪ LFinset G Q := hPQ_univ.symm ▸ Finset.mem_univ x + simp only [Finset.mem_union, Finset.mem_sdiff, Finset.mem_inter, + Finset.mem_univ, true_and] at hx_u ⊢ + rcases hx_u with hxP | hxQ <;> tauto + have hunion : X ∪ Y = X' ∪ Y' := by + change (LFinset G A \ LFinset G B) ∪ (LFinset G B \ LFinset G A) = + (LFinset G A' \ LFinset G B') ∪ (LFinset G B' \ LFinset G A') + rw [hunion_Z hAB, hunion_Z hA'B'] + exact congrArg (Finset.univ \ ·) hZ_eq + rcases bipartite_sym2_Determine hdisj hdisj' hunion hpairs with ⟨hX, hY⟩ | ⟨hX, hY⟩ + · left + have hLA : LFinset G A' = LFinset G A := by + rw [← Finset.sdiff_union_inter (LFinset G A') (LFinset G B'), + ← Finset.sdiff_union_inter (LFinset G A) (LFinset G B)] + exact congrArg₂ (· ∪ ·) hX hZ_eq.symm + have hLB : LFinset G B' = LFinset G B := by + rw [← Finset.sdiff_union_inter (LFinset G B') (LFinset G A'), Finset.inter_comm + (LFinset G B'), + ← Finset.sdiff_union_inter (LFinset G B) (LFinset G A), Finset.inter_comm (LFinset G B)] + exact congrArg₂ (· ∪ ·) hY hZ_eq.symm + exact ⟨eq_of_LFinset_eq hA'B'.left_le hAB.left_le hLA, + eq_of_LFinset_eq hA'B'.right_le hAB.right_le hLB⟩ + · right + have hLA : LFinset G A' = LFinset G B := by + rw [← Finset.sdiff_union_inter (LFinset G A') (LFinset G B'), + ← Finset.sdiff_union_inter (LFinset G B) (LFinset G A), Finset.inter_comm (LFinset G B)] + exact congrArg₂ (· ∪ ·) hX hZ_eq.symm + have hLB : LFinset G B' = LFinset G A := by + rw [← Finset.sdiff_union_inter (LFinset G B') (LFinset G A'), Finset.inter_comm + (LFinset G B'), + ← Finset.sdiff_union_inter (LFinset G A) (LFinset G B)] + exact congrArg₂ (· ∪ ·) hY hZ_eq.symm + exact ⟨eq_of_LFinset_eq hA'B'.left_le hAB.right_le hLA, + eq_of_LFinset_eq hA'B'.right_le hAB.left_le hLB⟩ + +private theorem sum_finset_eq_sum_univ {γ : Type*} [Fintype γ] [DecidableEq γ] + (S : Finset γ) (f : γ → ℕ) : + ∑ x ∈ S, f x = ∑ x : γ, if x ∈ S then f x else 0 := by + rw [← Finset.sum_filter] + congr 1 + ext x + simp + +private theorem indicator_add_eq {m : ℕ} {pa pb pc pd : Prop} + [Decidable pa] [Decidable pb] [Decidable pc] [Decidable pd] + (hxAB : pa ∨ pb) (hxCD : pc ∨ pd) : + (if (pa ∨ pc) ∧ (pb ∧ pd) then m else 0) + + (if (pa ∧ pc) ∧ (pb ∨ pd) then m else 0) = + (if pa ∧ pb then m else 0) + (if pc ∧ pd then m else 0) := by + rcases hxAB with hpa | hpb <;> rcases hxCD with hpc | hpd <;> + by_cases hpa' : pa <;> by_cases hpb' : pb <;> + by_cases hpc' : pc <;> by_cases hpd' : pd <;> + simp_all + +private theorem indicator_add_le {m : ℕ} {pa pb pc pd qa qb qc qd : Prop} + [Decidable pa] [Decidable pb] [Decidable pc] [Decidable pd] + [Decidable qa] [Decidable qb] [Decidable qc] [Decidable qd] + (hxAB : pa ∨ pb) (hxCD : pc ∨ pd) (hyAB : qa ∨ qb) (hyCD : qc ∨ qd) : + (if ((pa ∨ pc) ∧ ¬ (pb ∧ pd)) ∧ ((qb ∧ qd) ∧ ¬ (qa ∨ qc)) then m else 0) + + (if ((pa ∧ pc) ∧ ¬ (pb ∨ pd)) ∧ ((qb ∨ qd) ∧ ¬ (qa ∧ qc)) then m else 0) ≤ + (if (pa ∧ ¬ pb) ∧ (qb ∧ ¬ qa) then m else 0) + + (if (pc ∧ ¬ pd) ∧ (qd ∧ ¬ qc) then m else 0) := by + by_cases h1 : ((pa ∨ pc) ∧ ¬ (pb ∧ pd)) ∧ ((qb ∧ qd) ∧ ¬ (qa ∨ qc)) <;> + by_cases h2 : ((pa ∧ pc) ∧ ¬ (pb ∨ pd)) ∧ ((qb ∨ qd) ∧ ¬ (qa ∧ qc)) + · have hr1 : (pa ∧ ¬ pb) ∧ (qb ∧ ¬ qa) := + ⟨⟨h2.1.1.1, fun h ↦ h2.1.2 (Or.inl h)⟩, ⟨h1.2.1.1, fun h ↦ h1.2.2 (Or.inl h)⟩⟩ + have hr2 : (pc ∧ ¬ pd) ∧ (qd ∧ ¬ qc) := + ⟨⟨h2.1.1.2, fun h ↦ h2.1.2 (Or.inr h)⟩, ⟨h1.2.1.2, fun h ↦ h1.2.2 (Or.inr h)⟩⟩ + rw [ite_eq_left_iff.2 fun h ↦ (h h1).elim, ite_eq_left_iff.2 fun h ↦ (h h2).elim, + ite_eq_left_iff.2 fun h ↦ (h hr1).elim, ite_eq_left_iff.2 fun h ↦ (h hr2).elim] + · rw [ite_eq_left_iff.2 fun h ↦ (h h1).elim, ite_eq_right_iff.2 fun h ↦ (h2 h).elim, add_zero] + by_cases hpb : pb + · have hpd : ¬ pd := fun h ↦ h1.1.2 ⟨hpb, h⟩ + have hpc : pc := hxCD.resolve_right hpd + have hr2 : (pc ∧ ¬ pd) ∧ (qd ∧ ¬ qc) := + ⟨⟨hpc, hpd⟩, ⟨h1.2.1.2, fun h ↦ h1.2.2 (Or.inr h)⟩⟩ + rw [ite_eq_left_iff.2 fun h ↦ (h hr2).elim] + exact Nat.le_add_left _ _ + · have hpa : pa := hxAB.resolve_right hpb + have hr1 : (pa ∧ ¬ pb) ∧ (qb ∧ ¬ qa) := + ⟨⟨hpa, hpb⟩, ⟨h1.2.1.1, fun h ↦ h1.2.2 (Or.inl h)⟩⟩ + rw [ite_eq_left_iff.2 fun h ↦ (h hr1).elim] + exact Nat.le_add_right _ _ + · rw [ite_eq_right_iff.2 fun h ↦ (h1 h).elim, ite_eq_left_iff.2 fun h ↦ (h h2).elim, zero_add] + by_cases hqa : qa + · have hqc : ¬ qc := fun h ↦ h2.2.2 ⟨hqa, h⟩ + have hqd : qd := hyCD.resolve_left hqc + have hr2 : (pc ∧ ¬ pd) ∧ (qd ∧ ¬ qc) := + ⟨⟨h2.1.1.2, fun h ↦ h2.1.2 (Or.inr h)⟩, ⟨hqd, hqc⟩⟩ + rw [ite_eq_left_iff.2 fun h ↦ (h hr2).elim] + exact Nat.le_add_left _ _ + · have hqb : qb := hyAB.resolve_left hqa + have hr1 : (pa ∧ ¬ pb) ∧ (qb ∧ ¬ qa) := + ⟨⟨h2.1.1.1, fun h ↦ h2.1.2 (Or.inl h)⟩, ⟨hqb, hqa⟩⟩ + rw [ite_eq_left_iff.2 fun h ↦ (h hr1).elim] + exact Nat.le_add_right _ _ + · rw [ite_eq_right_iff.2 fun h ↦ (h1 h).elim, ite_eq_right_iff.2 fun h ↦ (h2 h).elim, add_zero] + exact Nat.zero_le _ + +/-- Claim (2) in the proof of **Graph Minors X, (9.2)** (page 179): +"Let $(A, B)$, $(C, D)$ be separations of $G$. Then so are $(A \cup C, B \cap D)$, $(A \cap +C, B \cup D)$, and the sum of their $\lambda$-orders is at most the sum of the +$\lambda$-orders of $(A, B)$, $(C, D)$." -/ +theorem theorem_9_2_claim_2 {G A B C D : Hypergraph α β} + (hAB : G.IsSeparation A B) (hCD : G.IsSeparation C D) : + separationOrder (A ∪ C) (B ∩ D) + separationOrder (A ∩ C) (B ∪ D) = + separationOrder A B + separationOrder C D ∧ + tieBreakerN2 G (A ∪ C) (B ∩ D) + tieBreakerN2 G (A ∩ C) (B ∪ D) = + tieBreakerN2 G A B + tieBreakerN2 G C D ∧ + tieBreakerN3 G (A ∪ C) (B ∩ D) + tieBreakerN3 G (A ∩ C) (B ∪ D) ≤ + tieBreakerN3 G A B + tieBreakerN3 G C D := by + classical + have hAB_univ : ∀ x : LType G, x ∈ LFinset G A ∨ x ∈ LFinset G B := by + intro x + have : x ∈ LFinset G A ∪ LFinset G B := by + rw [← LFinset_union, hAB.union_eq, LFinset_self] + exact Finset.mem_univ x + exact Finset.mem_union.1 this + have hCD_univ : ∀ x : LType G, x ∈ LFinset G C ∨ x ∈ LFinset G D := by + intro x + have : x ∈ LFinset G C ∪ LFinset G D := by + rw [← LFinset_union, hCD.union_eq, LFinset_self] + exact Finset.mem_univ x + exact Finset.mem_union.1 this + refine ⟨(add_comm _ _).trans (separationOrder_add_separationOrder hAB hCD).symm, ?_, ?_⟩ + · have hN2_rew : ∀ P Q : Hypergraph α β, + tieBreakerN2 G P Q = + ∑ x : LType G, + if x ∈ LFinset G P ∩ LFinset G Q then tieBreakerMu G x x else 0 := + fun P Q ↦ sum_finset_eq_sum_univ (LFinset G P ∩ LFinset G Q) (fun x ↦ tieBreakerMu G x x) + rw [hN2_rew, hN2_rew, hN2_rew, hN2_rew, ← Finset.sum_add_distrib, ← Finset.sum_add_distrib] + refine Finset.sum_congr rfl fun x _ ↦ ?_ + simp only [LFinset_union, LFinset_inter, Finset.mem_union, Finset.mem_inter] + exact indicator_add_eq (hAB_univ x) (hCD_univ x) + · have hN3_rew : ∀ P Q : Hypergraph α β, + tieBreakerN3 G P Q = + ∑ x : LType G, ∑ y : LType G, + if (x ∈ LFinset G P \ LFinset G Q ∧ y ∈ LFinset G Q \ LFinset G P) then + tieBreakerMu G x y + else 0 := by + intro P Q + unfold tieBreakerN3 + rw [sum_finset_eq_sum_univ] + refine Finset.sum_congr rfl fun x _ ↦ ?_ + rw [sum_finset_eq_sum_univ] + by_cases hx : x ∈ LFinset G P \ LFinset G Q <;> simp [hx] + rw [hN3_rew, hN3_rew, hN3_rew, hN3_rew, ← Finset.sum_add_distrib, ← Finset.sum_add_distrib] + refine Finset.sum_le_sum fun x _ ↦ ?_ + rw [← Finset.sum_add_distrib, ← Finset.sum_add_distrib] + refine Finset.sum_le_sum fun y _ ↦ ?_ + simp only [LFinset_union, LFinset_inter, Finset.mem_sdiff, Finset.mem_union, Finset.mem_inter] + exact indicator_add_le (hAB_univ x) (hCD_univ x) (hAB_univ y) (hCD_univ y) + +/-- `canonicalTieBreaker G` is a tie-breaker in `G`. -/ +theorem isTieBreaker_canonicalTieBreaker (G : Hypergraph α β) : + IsTieBreaker G (canonicalTieBreaker G) where + axiom1 {A B C D} hAB hCD := by + constructor + · intro hlam + rcases theorem_9_2_claim_1 hCD hAB hlam.symm with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl ⟨rfl, rfl⟩ + · exact Or.inr ⟨rfl, rfl⟩ + · rintro (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) + · rfl + · classical + have h1 : separationOrder B A = separationOrder A B := by + simp [separationOrder, inter_comm] + have h2 : tieBreakerN2 G B A = tieBreakerN2 G A B := by + simp [tieBreakerN2, Finset.inter_comm] + have h3 : tieBreakerN3 G B A = tieBreakerN3 G A B := by + unfold tieBreakerN3 + rw [Finset.sum_comm] + refine Finset.sum_congr rfl fun x _ ↦ Finset.sum_congr rfl fun y _ ↦ ?_ + exact tieBreakerMu_symm G y x + simp [canonicalTieBreaker, h1, h2, h3] + axiom2 {A B C D} hAB hCD := by + obtain ⟨h1, h2, h3⟩ := theorem_9_2_claim_2 hAB hCD + by_contra! h + rcases h with ⟨hlt1, hle2⟩ + rw [Prod.Lex.lt_iff] at hlt1 + rw [Prod.Lex.le_iff] at hle2 + simp only [canonicalTieBreaker, ofLex_toLex] at hlt1 hle2 + rcases hlt1 with h1_lt | ⟨h1_eq, hlt1'⟩ + · rcases hle2 with h2_lt | ⟨h2_eq, _⟩ <;> omega + · rcases hle2 with h2_lt | ⟨_, hle2'⟩ + · omega + · rw [Prod.Lex.lt_iff] at hlt1' + rw [Prod.Lex.le_iff] at hle2' + simp only [ofLex_toLex] at hlt1' hle2' + rcases hlt1' with h2_lt | ⟨h2_eq', h3_lt⟩ + · rcases hle2' with h2_lt' | ⟨h2_eq'', _⟩ <;> omega + · rcases hle2' with h2_lt' | ⟨_, h3_le⟩ <;> omega + axiom3 {_ _ _ _} _ _ hord := Prod.Lex.left _ _ hord + +/-- **Graph Minors X, (9.2)** (page 178): +"In every hypergraph there is a tie-breaker." -/ +theorem theorem_9_2_proof (G : Hypergraph α β) : + ∃ (lam : Hypergraph α β × Hypergraph α β → Lex (ℕ × Lex (ℕ × ℕ))), + IsTieBreaker G lam := + ⟨canonicalTieBreaker G, isTieBreaker_canonicalTieBreaker G⟩ + +/-! ## Proof of (9.3) and (9.4) -/ + +/-- A tie-breaker assigns the same `λ`-order to `(A, B)` and `(B, A)`. -/ +theorem IsTieBreaker.lam_swap {Λ : Type*} [LinearOrder Λ] {G : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} (hTB : IsTieBreaker G lam) + {A B : Hypergraph α β} (hAB : G.IsSeparation A B) : + lam (B, A) = lam (A, B) := + (hTB.axiom1 hAB.symm hAB).2 (Or.inr ⟨rfl, rfl⟩) + +/-- **Graph Minors X, (9.3)** (page 179): +"Let $\lambda$ be a tie-breaker in a hypergraph $G$, and let $(A, B)$, $(C, D)$ be +separations of $G$. Then either* (i) *$(A \cup C, B \cap D)$ has smaller $\lambda$-order +than $(A, B)$, or* (ii) *$(A \cap C, B \cup D)$ has smaller $\lambda$-order than $(C, D)$, +or* (iii) *$C \subseteq A$ and $B \subseteq D$, or* (iv) *$B = C = G$ and $A = D$ and $E(A) += \emptyset$." -/ +theorem theorem_9_3_proof {Λ : Type*} [LinearOrder Λ] {G : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} (hTB : IsTieBreaker G lam) + {A B C D : Hypergraph α β} (hAB : G.IsSeparation A B) (hCD : G.IsSeparation C D) : + HasSmallerLambdaOrder lam (A ∪ C) (B ∩ D) A B ∨ + HasSmallerLambdaOrder lam (A ∩ C) (B ∪ D) C D ∨ + (C ≤ A ∧ B ≤ D) ∨ + (B = G ∧ C = G ∧ A = D ∧ A.edgeSet = ∅) := by + unfold HasSmallerLambdaOrder + rcases hTB.axiom2 hAB hCD with hle1 | hlt2 + · rcases lt_or_eq_of_le hle1 with hlt1 | heq1 + · exact Or.inl hlt1 + · have hsep_union : G.IsSeparation (A ∪ C) (B ∩ D) := hAB.union_inter hCD + rcases (hTB.axiom1 hsep_union hAB).1 heq1 with ⟨hAC_A, hBD_B⟩ | ⟨hAC_B, hBD_A⟩ + · right; right; left + exact ⟨hAC_A ▸ le_union_right hAB.left_le hCD.left_le, + hBD_B ▸ inter_le_right hAB.right_le hCD.right_le⟩ + · have hA_le_B : A ≤ B := hBD_A ▸ inter_le_left hAB.right_le hCD.right_le + have hB_eq_G : B = G := by + rw [← hAB.union_eq] + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq + hAB.right_le (union_le hAB.left_le hAB.right_le) + (Set.union_eq_right.2 hA_le_B.vertexSet_subset).symm + (Set.union_eq_right.2 hA_le_B.edgeSet_subset).symm + have hA_eq_D : A = D := by + rw [← hBD_A, hB_eq_G] + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (inter_le le_rfl hCD.right_le) hCD.right_le + (Set.inter_eq_right.2 hCD.right_le.vertexSet_subset) + (Set.inter_eq_right.2 hCD.right_le.edgeSet_subset) + have hsep_inter : G.IsSeparation (A ∩ C) (B ∪ D) := + (hAB.symm.union_inter hCD.symm).symm + have hlam_DB_CA : lam (D ∪ B, C ∩ A) = lam (A ∩ C, B ∪ D) := by + rw [union_comm D B, inter_comm C A] + exact hTB.lam_swap hsep_inter + have hlam_DC : lam (D, C) = lam (C, D) := hTB.lam_swap hCD + have hlam_DB_CA_2 : lam (D ∩ B, C ∪ A) = lam (A ∪ C, B ∩ D) := by + rw [inter_comm D B, union_comm C A] + exact hTB.lam_swap hsep_union + have hlam_BA : lam (B, A) = lam (A, B) := hTB.lam_swap hAB + rcases hTB.axiom2 hCD.symm hAB.symm with hle2 | hlt1' + · rw [hlam_DB_CA, hlam_DC] at hle2 + rcases lt_or_eq_of_le hle2 with hlt2 | heq2 + · exact Or.inr (Or.inl hlt2) + · rcases (hTB.axiom1 hsep_inter hCD).1 heq2 with ⟨hAC_C, hBD_D⟩ | ⟨hAC_D, hBD_C⟩ + · right; right; left + exact ⟨hAC_C ▸ inter_le_left hAB.left_le hCD.left_le, + hBD_D ▸ le_union_left hAB.right_le hCD.right_le⟩ + · right; right; right + have hC_eq_G : C = G := by + rw [← hBD_C, hB_eq_G] + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (union_le le_rfl hCD.right_le) le_rfl + (Set.union_eq_left.2 hCD.right_le.vertexSet_subset) + (Set.union_eq_left.2 hCD.right_le.edgeSet_subset) + have hEA_empty : A.edgeSet = ∅ := by + have := hAB.edgeSet_inter_eq + rwa [inter_edgeSet, hB_eq_G, + Set.inter_eq_left.2 hAB.left_le.edgeSet_subset] at this + exact ⟨hB_eq_G, hC_eq_G, hA_eq_D, hEA_empty⟩ + · rw [hlam_DB_CA_2, hlam_BA] at hlt1' + exact Or.inl hlt1' + · exact Or.inr (Or.inl hlt2) + +/-- Helper for (9.4) when `(A ∩ C, B ∪ D)` has `λ`-order at most those of `(A ∩ D, B ∪ C)` and +`(B ∩ C, A ∪ D)`. -/ +private theorem theorem_9_4_wlog {Λ : Type*} [LinearOrder Λ] {G : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} (hTB : IsTieBreaker G lam) + {A B C D : Hypergraph α β} + (hAB : IsLambdaRobust G lam A B) (hCD : IsLambdaRobust G lam C D) + (h12 : lam (A ∩ C, B ∪ D) ≤ lam (A ∩ D, B ∪ C)) + (h13 : lam (A ∩ C, B ∪ D) ≤ lam (B ∩ C, A ∪ D)) : + ¬ SeparationsCross A B C D := by + have hsepA : A.IsSeparation (A ∩ C) (A ∩ D) := + hCD.1.inter_left hAB.1.left_le + have hB_AD : B ∪ (A ∩ D) = B ∪ D := by + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (union_le hAB.1.right_le (inter_le hAB.1.left_le hCD.1.right_le)) + (union_le hAB.1.right_le hCD.1.right_le) ?_ ?_ + · ext v + simp only [union_vertexSet, inter_vertexSet, Set.mem_union, Set.mem_inter_iff] + refine ⟨by tauto, fun h ↦ h.elim Or.inl fun hvD ↦ ?_⟩ + have hvAB : v ∈ A.vertexSet ∪ B.vertexSet := + hAB.1.vertexSet_union.symm ▸ hCD.1.right_le.vertexSet_subset hvD + rcases hvAB with hvA | hvB + · exact Or.inr ⟨hvA, hvD⟩ + · exact Or.inl hvB + · ext e + simp only [union_edgeSet, inter_edgeSet, Set.mem_union, Set.mem_inter_iff] + refine ⟨by tauto, fun h ↦ h.elim Or.inl fun heD ↦ ?_⟩ + have heAB : e ∈ A.edgeSet ∪ B.edgeSet := + hAB.1.edgeSet_union.symm ▸ hCD.1.right_le.edgeSet_subset heD + rcases heAB with heA | heB + · exact Or.inr ⟨heA, heD⟩ + · exact Or.inl heB + have hB_AC : B ∪ (A ∩ C) = B ∪ C := by + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (union_le hAB.1.right_le (inter_le hAB.1.left_le hCD.1.left_le)) + (union_le hAB.1.right_le hCD.1.left_le) ?_ ?_ + · ext v + simp only [union_vertexSet, inter_vertexSet, Set.mem_union, Set.mem_inter_iff] + refine ⟨by tauto, fun h ↦ h.elim Or.inl fun hvC ↦ ?_⟩ + have hvAB : v ∈ A.vertexSet ∪ B.vertexSet := + hAB.1.vertexSet_union.symm ▸ hCD.1.left_le.vertexSet_subset hvC + rcases hvAB with hvA | hvB + · exact Or.inr ⟨hvA, hvC⟩ + · exact Or.inl hvB + · ext e + simp only [union_edgeSet, inter_edgeSet, Set.mem_union, Set.mem_inter_iff] + refine ⟨by tauto, fun h ↦ h.elim Or.inl fun heC ↦ ?_⟩ + have heAB : e ∈ A.edgeSet ∪ B.edgeSet := + hAB.1.edgeSet_union.symm ▸ hCD.1.left_le.edgeSet_subset heC + rcases heAB with heA | heB + · exact Or.inr ⟨heA, heC⟩ + · exact Or.inl heB + have hrobA : lam (A, B) ≤ lam (A ∩ D, B ∪ C) := by + rcases hAB.2 hsepA with h | h + · rw [hB_AD] at h + exact h.trans h12 + · rwa [hB_AC] at h + have hsepC : C.IsSeparation (C ∩ A) (C ∩ B) := + hAB.1.inter_left hCD.1.left_le + have hD_CB : D ∪ (C ∩ B) = B ∪ D := by + rw [union_comm B D, inter_comm C B] + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (union_le hCD.1.right_le (inter_le hAB.1.right_le hCD.1.left_le)) + (union_le hCD.1.right_le hAB.1.right_le) ?_ ?_ + · ext v + simp only [union_vertexSet, inter_vertexSet, Set.mem_union, Set.mem_inter_iff] + refine ⟨by tauto, fun h ↦ h.elim Or.inl fun hvB ↦ ?_⟩ + have hvCD : v ∈ C.vertexSet ∪ D.vertexSet := + hCD.1.vertexSet_union.symm ▸ hAB.1.right_le.vertexSet_subset hvB + rcases hvCD with hvC | hvD + · exact Or.inr ⟨hvB, hvC⟩ + · exact Or.inl hvD + · ext e + simp only [union_edgeSet, inter_edgeSet, Set.mem_union, Set.mem_inter_iff] + refine ⟨by tauto, fun h ↦ h.elim Or.inl fun heB ↦ ?_⟩ + have heCD : e ∈ C.edgeSet ∪ D.edgeSet := + hCD.1.edgeSet_union.symm ▸ hAB.1.right_le.edgeSet_subset heB + rcases heCD with heC | heD + · exact Or.inr ⟨heB, heC⟩ + · exact Or.inl heD + have hD_CA : D ∪ (C ∩ A) = A ∪ D := by + rw [union_comm A D, inter_comm C A] + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (union_le hCD.1.right_le (inter_le hAB.1.left_le hCD.1.left_le)) + (union_le hCD.1.right_le hAB.1.left_le) ?_ ?_ + · ext v + simp only [union_vertexSet, inter_vertexSet, Set.mem_union, Set.mem_inter_iff] + refine ⟨by tauto, fun h ↦ h.elim Or.inl fun hvA ↦ ?_⟩ + have hvCD : v ∈ C.vertexSet ∪ D.vertexSet := + hCD.1.vertexSet_union.symm ▸ hAB.1.left_le.vertexSet_subset hvA + rcases hvCD with hvC | hvD + · exact Or.inr ⟨hvA, hvC⟩ + · exact Or.inl hvD + · ext e + simp only [union_edgeSet, inter_edgeSet, Set.mem_union, Set.mem_inter_iff] + refine ⟨by tauto, fun h ↦ h.elim Or.inl fun heA ↦ ?_⟩ + have heCD : e ∈ C.edgeSet ∪ D.edgeSet := + hCD.1.edgeSet_union.symm ▸ hAB.1.left_le.edgeSet_subset heA + rcases heCD with heC | heD + · exact Or.inr ⟨heA, heC⟩ + · exact Or.inl heD + have hrobC : lam (C, D) ≤ lam (B ∩ C, A ∪ D) := by + rcases hCD.2 hsepC with h | h + · rw [inter_comm C A, hD_CB] at h + exact h.trans h13 + · rwa [inter_comm C B, hD_CA] at h + rcases theorem_9_3_proof hTB hAB.1.symm hCD.1 with h1 | h2 | ⟨hCB, hAD⟩ | ⟨hAG, hCG, hBD, _⟩ + · exfalso + unfold HasSmallerLambdaOrder at h1 + have hsep_BC_AD : G.IsSeparation (B ∪ C) (A ∩ D) := hAB.1.symm.union_inter hCD.1 + rw [← hTB.lam_swap hsep_BC_AD, hTB.lam_swap hAB.1] at h1 + exact not_lt_of_ge hrobA h1 + · exfalso + unfold HasSmallerLambdaOrder at h2 + exact not_lt_of_ge hrobC h2 + · unfold SeparationsCross + rw [not_not] + exact Or.inr (Or.inl ⟨hAD, hCB⟩) + · unfold SeparationsCross + rw [not_not] + refine Or.inl ⟨?_, ?_⟩ + · rw [hAG, hCG] + · rw [hBD] + +/-- **Graph Minors X, (9.4)** (page 180): +"Let $(A, B)$, $(C, D)$ be doubly $\lambda$-robust separations of $G$. Then $(A, B)$ and $(C, +D)$ do not cross." -/ +theorem theorem_9_4_proof {Λ : Type*} [LinearOrder Λ] {G : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} (hTB : IsTieBreaker G lam) + {A B C D : Hypergraph α β} + (hAB : IsDoublyLambdaRobust G lam A B) (hCD : IsDoublyLambdaRobust G lam C D) : + ¬ SeparationsCross A B C D := by + let vAC := lam (A ∩ C, B ∪ D) + let vAD := lam (A ∩ D, B ∪ C) + let vBC := lam (B ∩ C, A ∪ D) + let vBD := lam (B ∩ D, A ∪ C) + rcases le_total (min vAC vAD) (min vBC vBD) with h1 | h2 + · rcases le_total vAC vAD with hAC | hAD + · have hmin : min vAC vAD = vAC := min_eq_left hAC + have hBC : vAC ≤ vBC := by + rw [← hmin] + exact h1.trans (min_le_left _ _) + exact theorem_9_4_wlog hTB hAB.1 hCD.1 hAC hBC + · have hmin : min vAC vAD = vAD := min_eq_right hAD + have hBD : vAD ≤ vBD := by + rw [← hmin] + exact h1.trans (min_le_right _ _) + rw [← separationsCross_swap_right] + exact theorem_9_4_wlog hTB hAB.1 hCD.2 hAD (by simpa [union_comm] using hBD) + · rcases le_total vBC vBD with hBC | hBD + · have hmin : min vBC vBD = vBC := min_eq_left hBC + have hAC : vBC ≤ vAC := by + rw [← hmin] + exact h2.trans (min_le_left _ _) + rw [← separationsCross_swap_left] + exact theorem_9_4_wlog hTB hAB.2 hCD.1 hBC (by simpa [union_comm] using hAC) + · have hmin : min vBC vBD = vBD := min_eq_right hBD + have hAD : vBD ≤ vAD := by + rw [← hmin] + exact h2.trans (min_le_right _ _) + rw [← separationsCross_swap_left, ← separationsCross_swap_right] + exact theorem_9_4_wlog hTB hAB.2 hCD.2 hBD (by simpa [union_comm] using hAD) + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/Statements.lean b/LeanPool/GraphMinor/GM10/Statements.lean new file mode 100644 index 0000000000..4af5c5cf1d --- /dev/null +++ b/LeanPool/GraphMinor/GM10/Statements.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Defs + +/-! +# Statements of Graph Minors X, Sections 4 and 5 + +These results of Graph Minors X are proved in `TreeWidth.lean` (`theorem_4_3_statement` and the +next three theorems). Each statement follows the paper's wording. +-/ + +@[expose] public section + +namespace GraphMinor.GM10 + +open Hypergraph + +/-- Graph Minors X, (4.3) (page 165): +"(4.3) *For any hypergraph $G$, $\max(\beta(G), \gamma(G)) = \theta(G)$ unless $\gamma(G) = 0$ and +$V(G) \ne \emptyset$.*" -/ +def Theorem43Statement : Prop := + ∀ {α β : Type*} (G : Hypergraph α β), ¬ (maxEdgeSize G = 0 ∧ G.vertexSet.Nonempty) → + max (branchWidth G) (maxEdgeSize G) = tangleNumber G + +/-- Graph Minors X, (4.5) (page 167): "Let $\theta \ge 2$, and let $\mathscr{T}$ be a set of +separations of a hypergraph $G$, each +of order $< \theta$. Suppose that the first tangle axiom holds, and* (i) *if $(A_1, B_1), +(A_2, B_2) \in \mathscr{T}$ then $B_1 \not\subseteq A_2$* (ii) *there do not exist +subhypergraphs $A_1, A_2, A_3 \subseteq G$, mutually edge-disjoint, with $A_1 \cup A_2 \cup +A_3 = G$ and with $(A_1, A_2 \cup A_3)$, $(A_2, A_3 \cup A_1)$, $(A_3, A_1 \cup A_2)$ all in +$\mathscr{T}$.* *Then the second tangle axiom holds." -/ +def Theorem45Statement : Prop := + ∀ {α β : Type*} (G : Hypergraph α β) (θ : ℕ) (𝒯 : Set (Hypergraph α β × Hypergraph α β)), + 2 ≤ θ → + (∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ 𝒯 → G.IsSeparation A B ∧ separationOrder A B < θ) → + TangleAxiom1 G θ 𝒯 → + (∀ ⦃A₁ B₁ A₂ B₂ : Hypergraph α β⦄, (A₁, B₁) ∈ 𝒯 → (A₂, B₂) ∈ 𝒯 → ¬ B₁ ≤ A₂) → + (¬ ∃ A₁ A₂ A₃ : Hypergraph α β, A₁ ≤ G ∧ A₂ ≤ G ∧ A₃ ≤ G ∧ + Disjoint A₁.edgeSet A₂.edgeSet ∧ Disjoint A₂.edgeSet A₃.edgeSet ∧ + Disjoint A₁.edgeSet A₃.edgeSet ∧ A₁ ∪ A₂ ∪ A₃ = G ∧ + (A₁, A₂ ∪ A₃) ∈ 𝒯 ∧ (A₂, A₃ ∪ A₁) ∈ 𝒯 ∧ (A₃, A₁ ∪ A₂) ∈ 𝒯) → + TangleAxiom2 G 𝒯 + +/-- Graph Minors X, (5.1) (page 168): +"(5.1) *For any hypergraph $G$, $\max(\beta(G), \gamma(G)) \le \omega(G) + 1 \le +\max(\lfloor(3/2) \beta(G)\rfloor, \gamma(G), 1)$.*" -/ +def Theorem51Statement : Prop := + ∀ {α β : Type*} (G : Hypergraph α β), + max (branchWidth G) (maxEdgeSize G) ≤ treeWidthPlusOne G ∧ + treeWidthPlusOne G ≤ max (max (3 * branchWidth G / 2) (maxEdgeSize G)) 1 + +/-- Graph Minors X, (5.2) (page 169): "For any hypergraph $G$, $\theta(G) \le \omega(G) + 1 \le +(3/2) \theta(G)$." The second inequality is written `2 (ω(G) + 1) ≤ 3 θ(G)`. -/ +def Theorem52Statement : Prop := + ∀ {α β : Type*} (G : Hypergraph α β), + tangleNumber G ≤ treeWidthPlusOne G ∧ 2 * treeWidthPlusOne G ≤ 3 * tangleNumber G + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/Submodular.lean b/LeanPool/GraphMinor/GM10/Submodular.lean new file mode 100644 index 0000000000..0bb2f5c934 --- /dev/null +++ b/LeanPool/GraphMinor/GM10/Submodular.lean @@ -0,0 +1,449 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.SubmodularTree + +/-! +# Submodular Functions and Tree-Labellings: Graph Minors X, Section 3 (3.4)–(3.6) + +This file formalizes the main theorems of Section 3 of Robertson and Seymour, +*Graph Minors. X. Obstructions to tree-decomposition*, J. Combin. Theory Ser. B 52 (1991) +153–190 (pages 162–164): +- `theorem_3_4` (3.4): If there is no bias extending `𝒜`, then there is an exact tree-labelling + over `𝒜`. +- `theorem_3_5` (3.5): Equivalence of (i) no bias extending `𝒜`, (ii) existence of a + tree-labelling over `𝒜`, and (iii) existence of an exact tree-labelling over `𝒜`. +- `theorem_3_6` (3.6): If there is an exact tree-labelling over `𝒜`, then either `E = ∅`, or + `E ∈ 𝒜`, or there is an exact tree-labelling `(T, α)` over `𝒜` such that `α(v, e) ≠ E` for + every leaf `v` and incident edge `e`. +-/ + +public section + +namespace GraphMinor.GM10 + +open SimpleGraph + +variable {β : Type*} {ι : Type*} + +/-! ## Uncovered efficient sets for the induction in (3.4) -/ + +/-- The set of efficient subsets `X ⊆ E` such that neither `X` nor `E \ X` is a subset of any +member of `𝒜` (Graph Minors X, Section 3, proof of (3.4), page 162). -/ +def uncoveredEfficientSets (E : Set β) (κ : Set β → ℤ) (𝒜 : Set (Set β)) : Set (Set β) := + {X : Set β | IsEfficient E κ X ∧ (∀ A ∈ 𝒜, ¬ X ⊆ A) ∧ (∀ A ∈ 𝒜, ¬ E \ X ⊆ A)} + +theorem uncoveredEfficientSets_finite {E : Set β} {κ : Set β → ℤ} {𝒜 : Set (Set β)} + (hE : E.Finite) : (uncoveredEfficientSets E κ 𝒜).Finite := + hE.finite_subsets.subset fun _ hX ↦ hX.1.1 + +theorem uncoveredEfficientSets_anti {E : Set β} {κ : Set β → ℤ} {𝒜₁ 𝒜₂ : Set (Set β)} + (hsub : 𝒜₁ ⊆ 𝒜₂) : + uncoveredEfficientSets E κ 𝒜₂ ⊆ uncoveredEfficientSets E κ 𝒜₁ := + fun _ ⟨heff, h1, h2⟩ ↦ ⟨heff, fun A hA ↦ h1 A (hsub hA), fun A hA ↦ h2 A (hsub hA)⟩ + +theorem notMem_uncoveredEfficientSets_insert_left {E X : Set β} {κ : Set β → ℤ} + {𝒜 : Set (Set β)} : + X ∉ uncoveredEfficientSets E κ (insert X 𝒜) := + fun ⟨_, h1, _⟩ ↦ h1 X (Set.mem_insert X 𝒜) subset_rfl + +theorem notMem_uncoveredEfficientSets_insert_right {E X : Set β} {κ : Set β → ℤ} + {𝒜 : Set (Set β)} : + X ∉ uncoveredEfficientSets E κ (insert (E \ X) 𝒜) := + fun ⟨_, _, h2⟩ ↦ h2 (E \ X) (Set.mem_insert (E \ X) 𝒜) subset_rfl + +/-! ## Repeated splicing across all bad leaves of `T₂` -/ + +/-- Given a tree-labelling `(T₁, α₁)` with a unique bad leaf `t₀` adjacent to a degree-3 vertex `s` +with `α₁(s, s(s, t₀)) = X`, and any tree-labelling `(T₂, α₂)` over `insert (E \ X) 𝒜`, repeatedly +splicing `T₁ \ t₀` onto the bad leaves of `T₂` produces a tree-labelling over `𝒜` +(Graph Minors X, Section 3, proof of (3.4), page 163). -/ +private theorem exists_treeLabelling_of_unique_bad_leaf {ι₁ : Type} [Fintype ι₁] + {E X : Set β} {κ : Set β → ℤ} {𝒜 𝒜₁ : Set (Set β)} + {T₁ : SimpleGraph ι₁} {α₁ : ι₁ → Sym2 ι₁ → Set β} + (hα₁ : IsTreeLabelling E κ 𝒜₁ T₁ α₁) + {t₀ s : ι₁} (ht₀_leaf : IsLeaf T₁ t₀) (hadj_t₀s : T₁.Adj t₀ s) + (hs_not_leaf : ¬ IsLeaf T₁ s) (hα₁_s : α₁ s s(s, t₀) = X) + (hX_sub_E : X ⊆ E) + (ht₀_only_bad : ∀ u e, IsTreeIncidence T₁ u e → IsLeaf T₁ u → u ≠ t₀ → + α₁ u e = E ∨ ∃ A ∈ 𝒜, α₁ u e ∪ A = E) : + ∀ (k : ℕ) (ι₂ : Type) [Fintype ι₂] (T₂ : SimpleGraph ι₂) (α₂ : ι₂ → Sym2 ι₂ → Set β), + IsTreeLabelling E κ (insert (E \ X) 𝒜) T₂ α₂ → + {u : ι₂ | IsLeaf T₂ u ∧ + ∃ e, IsTreeIncidence T₂ u e ∧ ¬ (α₂ u e = E ∨ ∃ A ∈ 𝒜, α₂ u e ∪ A = E)}.ncard = k → + ∃ (ι' : Type) (_ : Fintype ι') (T' : SimpleGraph ι') (α' : ι' → Sym2 ι' → Set β), + IsTreeLabelling E κ 𝒜 T' α' := by + intro k + induction k using Nat.strong_induction_on with + | ind k ih => + intro ι₂ _ T₂ α₂ hα₂ hcard + let B₂ : Set ι₂ := + {u : ι₂ | IsLeaf T₂ u ∧ + ∃ e, IsTreeIncidence T₂ u e ∧ ¬ (α₂ u e = E ∨ ∃ A ∈ 𝒜, α₂ u e ∪ A = E)} + by_cases hB₂ : B₂.Nonempty + · obtain ⟨t₁, ht₁_leaf, e₁, he₁_inc, ht₁_bad⟩ := hB₂ + obtain ⟨w₁, hadj_t₁w₁, rfl⟩ := isTreeIncidence_iff_exists_adj.1 he₁_inc + have hX_sub : X ⊆ α₂ t₁ s(t₁, w₁) := by + rcases hα₂.leaf_eq_or_union_eq (isTreeIncidence_iff_adj.2 hadj_t₁w₁) ht₁_leaf with + heq | ⟨A, hA_mem, hunion⟩ + · exact (ht₁_bad (Or.inl heq)).elim + · rcases Set.mem_insert_iff.1 hA_mem with rfl | hA𝒜 + · intro x hx + have hxE : x ∈ α₂ t₁ s(t₁, w₁) ∪ (E \ X) := hunion.symm ▸ hX_sub_E hx + rcases hxE with hx1 | ⟨_, hx2⟩ + · exact hx1 + · exact (hx2 hx).elim + · exact (ht₁_bad (Or.inr ⟨A, hA𝒜, hunion⟩)).elim + obtain ⟨ι', hfin', T', α', hα', hlt⟩ := + exists_spliced_treeLabelling (Set.subset_insert (E \ X) 𝒜) hα₁ hα₂ + ht₀_leaf hadj_t₀s hs_not_leaf hα₁_s ht₀_only_bad + ht₁_leaf hadj_t₁w₁ ht₁_bad hX_sub + rw [hcard] at hlt + exact @ih _ hlt ι' hfin' T' α' hα' rfl + · rw [Set.not_nonempty_iff_eq_empty] at hB₂ + refine ⟨ι₂, inferInstance, T₂, α₂, hα₂.isTernaryTree, hα₂.isEfficient, hα₂.compl_eq, + ?_, hα₂.degree_three_union_eq⟩ + intro u e he hleaf + by_contra hbad + have hu_mem : u ∈ B₂ := ⟨hleaf, e, he, hbad⟩ + rw [hB₂] at hu_mem + exact hu_mem + +/-! ## Proof of (3.4) -/ + +/-- A deficient leaf labelled over an extension by a minimal uncovered set has that set as the +complement of its label. -/ +private theorem badLeaf_complement_eq_minimal_uncovered {E X : Set β} {κ : Set β → ℤ} + {𝒜 : Set (Set β)} (hκ : IsConnectivityFunction E κ) + (h𝒜 : ∀ A ∈ 𝒜, IsEfficient E κ A) + (hX_min : Minimal (· ∈ uncoveredEfficientSets E κ 𝒜) X) + (hX_compl_not_sub : ∀ A ∈ 𝒜, ¬ E \ X ⊆ A) + {ι₁ : Type*} [Fintype ι₁] {T₁ : SimpleGraph ι₁} {α₁ : ι₁ → Sym2 ι₁ → Set β} + (hα₁ : IsExactTreeLabelling E κ (insert X 𝒜) T₁ α₁) : + ∀ u e, IsTreeIncidence T₁ u e → IsLeaf T₁ u → + ¬ (α₁ u e = E ∨ ∃ A ∈ 𝒜, α₁ u e ∪ A = E) → E \ α₁ u e = X := by + intro u e he hleaf hbad + have h_union_X : α₁ u e ∪ X = E := by + rcases hα₁.isTreeLabelling.leaf_eq_or_union_eq he hleaf with heq | ⟨A, hA_mem, hunion⟩ + · exact (hbad (Or.inl heq)).elim + · rcases Set.mem_insert_iff.1 hA_mem with rfl | hA𝒜 + · exact hunion + · exact (hbad (Or.inr ⟨A, hA𝒜, hunion⟩)).elim + let Y := E \ α₁ u e + have hY_sub_X : Y ⊆ X := by + rintro y ⟨hyE, hy_not⟩ + have hy_mem : y ∈ α₁ u e ∪ X := h_union_X.symm ▸ hyE + exact hy_mem.resolve_left hy_not + have hY_eff : IsEfficient E κ Y := + (hα₁.isTreeLabelling.isEfficient he).compl hκ + have hY_not_sub : ∀ A ∈ 𝒜, ¬ Y ⊆ A := by + intro A hA hYA + apply hbad + right + refine ⟨A, hA, Set.Subset.antisymm + (Set.union_subset (hα₁.isTreeLabelling.subset_of_inc he) (h𝒜 A hA).1) ?_⟩ + intro y hyE + by_cases hyα : y ∈ α₁ u e + · exact Or.inl hyα + · exact Or.inr (hYA ⟨hyE, hyα⟩) + have hY_compl_not_sub : ∀ A ∈ 𝒜, ¬ E \ Y ⊆ A := by + intro A hA hEYA + apply hX_compl_not_sub A hA + intro y ⟨hyE, hyX⟩ + apply hEYA + exact ⟨hyE, fun hyY ↦ hyX (hY_sub_X hyY)⟩ + have hY_mem : Y ∈ uncoveredEfficientSets E κ 𝒜 := + ⟨hY_eff, hY_not_sub, hY_compl_not_sub⟩ + exact Set.Subset.antisymm hY_sub_X (hX_min.le_of_le hY_mem hY_sub_X) + +/-- **(3.4)** Let `κ` be a connectivity function on a finite set `E`, and let `𝒜` be a set of +efficient subsets of `E`. If there is no bias extending `𝒜`, then there is an exact +tree-labelling over `𝒜` +(Graph Minors X, Section 3, (3.4), page 162). -/ +theorem theorem_3_4_proof {E : Set β} {κ : Set β → ℤ} {𝒜 : Set (Set β)} + (hE : E.Finite) (hκ : IsConnectivityFunction E κ) + (h𝒜 : ∀ A ∈ 𝒜, IsEfficient E κ A) + (hno_bias : ¬ ∃ ℬ, BiasExtends E κ 𝒜 ℬ) : + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (α : ι → Sym2 ι → Set β), + IsExactTreeLabelling E κ 𝒜 T α := by + classical + -- By (3.2), it suffices to construct a tree-labelling over `𝒜`. + suffices ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (α : ι → Sym2 ι → Set β), + IsTreeLabelling E κ 𝒜 T α by + obtain ⟨ι, _, T, α, hα⟩ := this + obtain ⟨α', hα'⟩ := theorem_3_2_proof hE hκ hα + exact ⟨ι, inferInstance, T, α', hα'⟩ + -- Handle `E = ∅`. + by_cases hE_empty : E = ∅ + · by_cases heff_empty : IsEfficient E κ ∅ + · exact exists_isTreeLabelling_of_empty hE_empty heff_empty + · exfalso + apply hno_bias + refine ⟨∅, ⟨fun B (hB : B ∈ (∅ : Set (Set β))) ↦ hB.elim, ?_, ?_⟩, ?_⟩ + · intro X hX + have hX_eq : X = ∅ := Set.eq_empty_of_subset hX.1 hE_empty + exact (heff_empty (hX_eq ▸ hX)).elim + · intro X₁ _ _ (hX₁ : X₁ ∈ (∅ : Set (Set β))) _ _ + exact hX₁.elim + · intro A hA + have hA_eq : A = ∅ := Set.eq_empty_of_subset (h𝒜 A hA).1 hE_empty + exact (heff_empty (hA_eq ▸ h𝒜 A hA)).elim + -- Now `E` is nonempty. + have hE_ne : E.Nonempty := Set.nonempty_iff_ne_empty.2 hE_empty + -- Induction on the number `N` of uncovered efficient sets. + have hmain : ∀ (N : ℕ) (𝒜 : Set (Set β)), + (∀ A ∈ 𝒜, IsEfficient E κ A) → + (¬ ∃ ℬ, BiasExtends E κ 𝒜 ℬ) → + (uncoveredEfficientSets E κ 𝒜).ncard = N → + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (α : ι → Sym2 ι → Set β), + IsTreeLabelling E κ 𝒜 T α := by + intro N + induction N using Nat.strong_induction_on with + | ind N ih => + intro 𝒜 h𝒜 hno_bias hcard + -- Since `E` is nonempty and no bias extends `𝒜`, `𝒜` is nonempty. + have h𝒜_ne : 𝒜.Nonempty := by + by_contra h𝒜_empty + rw [Set.not_nonempty_iff_eq_empty] at h𝒜_empty + obtain ⟨x₀, hx₀⟩ := hE_ne + apply hno_bias + let ℬ : Set (Set β) := {B : Set β | IsEfficient E κ B ∧ x₀ ∉ B} + refine ⟨ℬ, ⟨fun B hB ↦ hB.1, ?_, ?_⟩, ?_⟩ + · intro X hX + by_cases hxX : x₀ ∈ X + · right + exact ⟨hX.compl hκ, fun h ↦ h.2 hxX⟩ + · left + exact ⟨hX, hxX⟩ + · intro X₁ X₂ X₃ h₁ h₂ h₃ hunion + have hx_mem : x₀ ∈ X₁ ∪ X₂ ∪ X₃ := hunion.symm ▸ hx₀ + rcases hx_mem with (hx₁ | hx₂) | hx₃ + · exact h₁.2 hx₁ + · exact h₂.2 hx₂ + · exact h₃.2 hx₃ + · rw [h𝒜_empty] + exact Set.empty_subset _ + by_cases hU_ne : (uncoveredEfficientSets E κ 𝒜).Nonempty + · -- Inductive step: `N > 0`. Choose a minimal uncovered efficient set `X`. + obtain ⟨X, hX_min⟩ := (uncoveredEfficientSets_finite hE).exists_minimal hU_ne + have hX_mem : X ∈ uncoveredEfficientSets E κ 𝒜 := hX_min.prop + have hX_eff : IsEfficient E κ X := hX_mem.1 + have hX_not_sub : ∀ A ∈ 𝒜, ¬ X ⊆ A := hX_mem.2.1 + have hX_compl_not_sub : ∀ A ∈ 𝒜, ¬ E \ X ⊆ A := hX_mem.2.2 + obtain ⟨A₀, hA₀⟩ := h𝒜_ne + have hX_ne : X.Nonempty := by + by_contra hX_emp + rw [Set.not_nonempty_iff_eq_empty] at hX_emp + exact hX_not_sub A₀ hA₀ (hX_emp ▸ Set.empty_subset A₀) + -- Apply IH to `𝒜₁ = insert X 𝒜` and `𝒜₂ = insert (E \ X) 𝒜`. + let 𝒜₁ : Set (Set β) := insert X 𝒜 + let 𝒜₂ : Set (Set β) := insert (E \ X) 𝒜 + have h𝒜₁_eff : ∀ A ∈ 𝒜₁, IsEfficient E κ A := by + rintro A (rfl | hA) + · exact hX_eff + · exact h𝒜 A hA + have h𝒜₂_eff : ∀ A ∈ 𝒜₂, IsEfficient E κ A := by + rintro A (rfl | hA) + · exact hX_eff.compl hκ + · exact h𝒜 A hA + have hno_bias₁ : ¬ ∃ ℬ, BiasExtends E κ 𝒜₁ ℬ := by + rintro ⟨ℬ, hbias, hsub⟩ + exact hno_bias ⟨ℬ, hbias, Set.Subset.trans (Set.subset_insert X 𝒜) hsub⟩ + have hno_bias₂ : ¬ ∃ ℬ, BiasExtends E κ 𝒜₂ ℬ := by + rintro ⟨ℬ, hbias, hsub⟩ + exact hno_bias ⟨ℬ, hbias, Set.Subset.trans (Set.subset_insert (E \ X) 𝒜) hsub⟩ + have hlt₁ : (uncoveredEfficientSets E κ 𝒜₁).ncard < N := by + rw [← hcard] + refine Set.ncard_lt_ncard ⟨uncoveredEfficientSets_anti (Set.subset_insert X 𝒜), ?_⟩ + (uncoveredEfficientSets_finite hE) + intro hsub + exact notMem_uncoveredEfficientSets_insert_left (hsub hX_mem) + have hlt₂ : (uncoveredEfficientSets E κ 𝒜₂).ncard < N := by + rw [← hcard] + refine Set.ncard_lt_ncard ⟨uncoveredEfficientSets_anti (Set.subset_insert (E \ X) 𝒜), ?_⟩ + (uncoveredEfficientSets_finite hE) + intro hsub + exact notMem_uncoveredEfficientSets_insert_right (hsub hX_mem) + obtain ⟨ι₁, _, T₁, α₁₀, hα₁₀⟩ := ih _ hlt₁ 𝒜₁ h𝒜₁_eff hno_bias₁ rfl + obtain ⟨α₁, hα₁⟩ := theorem_3_2_proof hE hκ hα₁₀ + obtain ⟨ι₂, _, T₂, α₂, hα₂⟩ := ih _ hlt₂ 𝒜₂ h𝒜₂_eff hno_bias₂ rfl + have hbad₁_eq_X := + badLeaf_complement_eq_minimal_uncovered hκ h𝒜 hX_min hX_compl_not_sub hα₁ + -- Check whether `T₁` has any bad leaf. + by_cases hex_bad₁ : ∃ t₀ e₀, IsTreeIncidence T₁ t₀ e₀ ∧ IsLeaf T₁ t₀ ∧ + ¬ (α₁ t₀ e₀ = E ∨ ∃ A ∈ 𝒜, α₁ t₀ e₀ ∪ A = E) + · obtain ⟨t₀, e₀, he₀, ht₀_leaf, ht₀_bad⟩ := hex_bad₁ + obtain ⟨s, hadj_t₀s, rfl⟩ := isTreeIncidence_iff_exists_adj.1 he₀ + have hα₁_t₀_compl : E \ α₁ t₀ s(t₀, s) = X := + hbad₁_eq_X t₀ s(t₀, s) (isTreeIncidence_iff_adj.2 hadj_t₀s) ht₀_leaf ht₀_bad + have hα₁_s : α₁ s s(s, t₀) = X := by + rw [hα₁.isTreeLabelling.compl_eq hadj_t₀s.symm, Sym2.eq_swap, hα₁_t₀_compl] + -- By (3.3), `t₀` is the unique bad leaf of `T₁`. + have ht₀_only_bad : ∀ u e, IsTreeIncidence T₁ u e → IsLeaf T₁ u → u ≠ t₀ → + α₁ u e = E ∨ ∃ A ∈ 𝒜, α₁ u e ∪ A = E := by + intro u e he hleaf hu_ne + by_contra hu_bad + have hu_compl : E \ α₁ u e = X := hbad₁_eq_X u e he hleaf hu_bad + have hT₁_tree := hα₁.isTreeLabelling.isTernaryTree + have hT₁_conn_compl : (T₁.induce {t₀}ᶜ).Connected := + hT₁_tree.isTree.connected.induce_compl_singleton_of_degree_eq_one + (hT₁_tree.degree_eq_one_of_isLeaf ht₀_leaf) + let s' : ({t₀}ᶜ : Set ι₁) := ⟨s, hadj_t₀s.ne.symm⟩ + let u' : ({t₀}ᶜ : Set ι₁) := ⟨u, hu_ne⟩ + obtain ⟨p', hp'⟩ := hT₁_conn_compl.exists_isPath s' u' + have hp_not_edge : s(s, t₀) ∉ (p'.map (Embedding.induce {t₀}ᶜ).toHom).edges := by + intro hmem + have ht₀_mem : t₀ ∈ (p'.map (Embedding.induce {t₀}ᶜ).toHom).support := + Walk.mem_support_of_mem_edges hmem (Sym2.mem_mk_right s t₀) + rw [Walk.support_map] at ht₀_mem + obtain ⟨z', _, hz'_eq⟩ := List.mem_map.1 ht₀_mem + exact z'.2 hz'_eq + have hreach_del : (T₁.deleteEdges {s(s, t₀)}).Reachable s u := + ⟨(p'.map (Embedding.induce {t₀}ᶜ).toHom).toDeleteEdges {s(s, t₀)} + (fun e he ↦ by simp only [Set.mem_singleton_iff]; rintro rfl; exact hp_not_edge he)⟩ + obtain ⟨_, hunion_s⟩ := + theorem_3_3_proof hα₁ (isTreeIncidence_iff_adj.2 hadj_t₀s.symm) + have hmem_leaf : (u, e) ∈ leafIncidencesIn T₁ s s(s, t₀) := + show IsTreeIncidence T₁ u e ∧ IsLeaf T₁ u ∧ u ∈ treeComponent T₁ s s(s, t₀) from + ⟨he, hleaf, hreach_del⟩ + have hsub_s : E \ α₁ u e ⊆ E \ α₁ s s(s, t₀) := by + rw [← hunion_s] + exact Set.subset_biUnion_of_mem (u := fun p : ι₁ × Sym2 ι₁ ↦ E \ α₁ p.1 p.2) + hmem_leaf + rw [hu_compl, hα₁_s] at hsub_s + obtain ⟨x, hx⟩ := hX_ne + exact (hsub_s hx).2 hx + -- Show `s` is not a leaf of `T₁`. + have hs_not_leaf : ¬ IsLeaf T₁ s := by + intro hs_leaf + rcases hα₁.isTreeLabelling.leaf_eq_or_union_eq + (isTreeIncidence_iff_adj.2 hadj_t₀s.symm) hs_leaf with heq | ⟨A, hA_mem, hunion⟩ + · rw [hα₁_s] at heq + apply hX_compl_not_sub A₀ hA₀ + rw [heq, Set.sdiff_self] + exact Set.empty_subset A₀ + · rw [hα₁_s] at hunion + rcases Set.mem_insert_iff.1 hA_mem with rfl | hA𝒜 + · rw [Set.union_self] at hunion + apply hX_compl_not_sub A₀ hA₀ + rw [hunion, Set.sdiff_self] + exact Set.empty_subset A₀ + · apply hX_compl_not_sub A hA𝒜 + rintro y ⟨hyE, hyX⟩ + have hy_mem : y ∈ X ∪ A := hunion.symm ▸ hyE + exact hy_mem.resolve_left hyX + exact exists_treeLabelling_of_unique_bad_leaf hα₁.isTreeLabelling + ht₀_leaf hadj_t₀s hs_not_leaf hα₁_s hX_eff.1 ht₀_only_bad + _ ι₂ T₂ α₂ hα₂ rfl + · -- `T₁` has no bad leaf, so `(T₁, α₁)` is already a tree-labelling over `𝒜`. + refine ⟨ι₁, inferInstance, T₁, α₁, hα₁.isTreeLabelling.isTernaryTree, + hα₁.isTreeLabelling.isEfficient, hα₁.isTreeLabelling.compl_eq, ?_, + hα₁.isTreeLabelling.degree_three_union_eq⟩ + intro u e he hleaf + by_contra hbad + exact hex_bad₁ ⟨u, e, he, hleaf, hbad⟩ + · -- Base case: `uncoveredEfficientSets E κ 𝒜 = ∅`. + rw [Set.not_nonempty_iff_eq_empty] at hU_ne + let ℬ : Set (Set β) := {B : Set β | IsEfficient E κ B ∧ ∃ A ∈ 𝒜, B ⊆ A} + have hℬ_sub : 𝒜 ⊆ ℬ := fun A hA ↦ ⟨h𝒜 A hA, A, hA, subset_rfl⟩ + have hℬ_ax1 : ∀ ⦃X : Set β⦄, IsEfficient E κ X → X ∈ ℬ ∨ E \ X ∈ ℬ := by + intro X hX + by_contra! hnot + have hX_mem : X ∈ uncoveredEfficientSets E κ 𝒜 := by + refine ⟨hX, fun A hA hXA ↦ hnot.1 ⟨hX, A, hA, hXA⟩, + fun A hA hEXA ↦ hnot.2 ⟨hX.compl hκ, A, hA, hEXA⟩⟩ + rw [hU_ne] at hX_mem + exact hX_mem + have hnot_ax2 : ¬ ∀ ⦃X Y Z : Set β⦄, X ∈ ℬ → Y ∈ ℬ → Z ∈ ℬ → X ∪ Y ∪ Z ≠ E := by + intro hax2 + exact hno_bias ⟨ℬ, ⟨fun B hB ↦ hB.1, hℬ_ax1, hax2⟩, hℬ_sub⟩ + push Not at hnot_ax2 + obtain ⟨X₁, X₂, X₃, ⟨heff₁, hsub₁⟩, ⟨heff₂, hsub₂⟩, ⟨heff₃, hsub₃⟩, hunion⟩ := hnot_ax2 + exact exists_isTreeLabelling_of_three_sets hκ h𝒜 heff₁ heff₂ heff₃ hsub₁ hsub₂ hsub₃ hunion + exact hmain _ 𝒜 h𝒜 hno_bias rfl + +/-! ## Proof of (3.5) and (3.6) -/ + +/-- **(3.5)** Let `κ` be a connectivity function on a finite set `E`, and let `𝒜` be a set of +efficient subsets of `E`. Then the following are equivalent: +(i) there is no bias extending `𝒜`; +(ii) there is a tree-labelling over `𝒜`; +(iii) there is an exact tree-labelling over `𝒜` +(Graph Minors X, Section 3, (3.5), page 163). -/ +theorem theorem_3_5_proof {E : Set β} {κ : Set β → ℤ} {𝒜 : Set (Set β)} + (hE : E.Finite) (hκ : IsConnectivityFunction E κ) + (h𝒜 : ∀ A ∈ 𝒜, IsEfficient E κ A) : + ((¬ ∃ ℬ, BiasExtends E κ 𝒜 ℬ) ↔ + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (α : ι → Sym2 ι → Set β), + IsTreeLabelling E κ 𝒜 T α) ∧ + ((∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (α : ι → Sym2 ι → Set β), + IsTreeLabelling E κ 𝒜 T α) ↔ + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (α : ι → Sym2 ι → Set β), + IsExactTreeLabelling E κ 𝒜 T α) := by + refine ⟨⟨?_, ?_⟩, ⟨?_, ?_⟩⟩ + · intro hno_bias + obtain ⟨ι, _, T, α, hα⟩ := theorem_3_4_proof hE hκ h𝒜 hno_bias + exact ⟨ι, inferInstance, T, α, hα.isTreeLabelling⟩ + · rintro ⟨ι, _, T, α, hα⟩ ⟨ℬ, hbias⟩ + exact theorem_3_1_proof hbias hα + · rintro ⟨ι, _, T, α, hα⟩ + obtain ⟨α', hα'⟩ := theorem_3_2_proof hE hκ hα + exact ⟨ι, inferInstance, T, α', hα'⟩ + · rintro ⟨ι, _, T, α, hα⟩ + exact ⟨ι, inferInstance, T, α, hα.isTreeLabelling⟩ + +/-- **(3.6)** If there is an exact tree-labelling over `𝒜`, then either `E = ∅`, or `E ∈ 𝒜`, or +there is an exact tree-labelling `(T, α)` over `𝒜` such that `α(v, e) ≠ E` for each leaf `v` and +incident edge `e` +(Graph Minors X, Section 3, (3.6), pages 163–164). -/ +theorem theorem_3_6_proof [Fintype ι] {E : Set β} {κ : Set β → ℤ} {𝒜 : Set (Set β)} + (_h𝒜 : ∀ A ∈ 𝒜, IsEfficient E κ A) + {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} + (hα : IsExactTreeLabelling E κ 𝒜 T α) : + E = ∅ ∨ E ∈ 𝒜 ∨ + ∃ (ι' : Type) (_ : Fintype ι') (T' : SimpleGraph ι') (α' : ι' → Sym2 ι' → Set β), + IsExactTreeLabelling E κ 𝒜 T' α' ∧ + ∀ v e, IsTreeIncidence T' v e → IsLeaf T' v → α' v e ≠ E := by + classical + have hmain : ∀ (n : ℕ) (ι₀ : Type) [Fintype ι₀] (T₀ : SimpleGraph ι₀) + (α₀ : ι₀ → Sym2 ι₀ → Set β), + Fintype.card ι₀ = n → + IsExactTreeLabelling E κ 𝒜 T₀ α₀ → + E = ∅ ∨ E ∈ 𝒜 ∨ + ∃ (ι' : Type) (_ : Fintype ι') (T' : SimpleGraph ι') (α' : ι' → Sym2 ι' → Set β), + IsExactTreeLabelling E κ 𝒜 T' α' ∧ + ∀ v e, IsTreeIncidence T' v e → IsLeaf T' v → α' v e ≠ E := by + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro ι₀ _ T₀ α₀ hcard hα₀ + by_cases hex : ∃ v₀ e₀, IsTreeIncidence T₀ v₀ e₀ ∧ IsLeaf T₀ v₀ ∧ α₀ v₀ e₀ = E + · obtain ⟨v₀, e₀, he₀, hleaf₀, hα_v₀⟩ := hex + obtain ⟨v, hadj₀, rfl⟩ := isTreeIncidence_iff_exists_adj.1 he₀ + by_cases hv_leaf : IsLeaf T₀ v + · have hα_v : α₀ v s(v, v₀) = ∅ := by + rw [hα₀.isTreeLabelling.compl_eq hadj₀.symm, Sym2.eq_swap, hα_v₀, Set.sdiff_self] + rcases hα₀.isTreeLabelling.leaf_eq_or_union_eq + (isTreeIncidence_iff_adj.2 hadj₀.symm) hv_leaf with heq | ⟨A, hA_mem, hunion⟩ + · rw [hα_v] at heq + exact Or.inl heq.symm + · rw [hα_v, Set.empty_union] at hunion + exact Or.inr (Or.inl (hunion ▸ hA_mem)) + · obtain ⟨ι', hfin', T', α', hlt, hexact'⟩ := + exists_smaller_exactTreeLabelling_of_leaf_eq hα₀ hleaf₀ hadj₀ hα_v₀ hv_leaf + rw [hcard] at hlt + exact @ih _ hlt ι' hfin' T' α' rfl hexact' + · push Not at hex + exact Or.inr (Or.inr ⟨ι₀, inferInstance, T₀, α₀, hα₀, hex⟩) + let eFin := Fintype.equivFin ι + exact hmain (Fintype.card (Fin (Fintype.card ι))) (Fin (Fintype.card ι)) + (T.map eFin.toEmbedding) (fun v e ↦ α (eFin.symm v) (e.map eFin.symm)) rfl (hα.relabel eFin) + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/SubmodularBasic.lean b/LeanPool/GraphMinor/GM10/SubmodularBasic.lean new file mode 100644 index 0000000000..f6fdf80952 --- /dev/null +++ b/LeanPool/GraphMinor/GM10/SubmodularBasic.lean @@ -0,0 +1,1274 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Defs +import Mathlib.Combinatorics.SimpleGraph.Acyclic +import Mathlib.Combinatorics.SimpleGraph.DegreeSum +import Mathlib.Combinatorics.SimpleGraph.Metric +import Mathlib.Order.Preorder.Finite + +/-! +# Submodular Functions and Tree-Labellings: Graph Minors X, Section 3 (3.1)–(3.3) + +This file formalizes the first half of Section 3 (pages 159–162) of Robertson and Seymour, +*Graph Minors. X. Obstructions to tree-decomposition*, J. Combin. Theory Ser. B 52 (1991) 153–190: +- Basic properties of ternary trees, incidences, forks, connectivity functions, and biases. +- `(3.1)` (`theorem_3_1`): If there is a bias extending `𝒜` then there is no tree-labelling over +`𝒜`. +- `(3.2)` (`theorem_3_2`): If there is a tree-labelling over `𝒜` then there is an exact + tree-labelling over `𝒜`, using the same tree. +- `(3.3)` (`theorem_3_3`): Disjointness and union of `E \ α(v, e)` over leaf incidences in a + component of `T \ f` for an exact tree-labelling. +-/ + +public section + +namespace GraphMinor.GM10 + +open SimpleGraph + +variable {β : Type*} {ι : Type*} + +/-! ## Connectivity functions, efficient sets, and biases -/ + +theorem IsConnectivityFunction.empty_eq (E : Set β) (κ : Set β → ℤ) + (hκ : IsConnectivityFunction E κ) : κ ∅ = κ E := by + simpa using hκ.compl_eq (Set.empty_subset E) + +theorem IsConnectivityFunction.compl_compl {E X : Set β} {κ : Set β → ℤ} + (_hκ : IsConnectivityFunction E κ) (hX : X ⊆ E) : E \ (E \ X) = X := + Set.sdiff_sdiff_cancel_left hX + +theorem IsEfficient.compl {E X : Set β} {κ : Set β → ℤ} + (hκ : IsConnectivityFunction E κ) (hX : IsEfficient E κ X) : + IsEfficient E κ (E \ X) := + ⟨Set.sdiff_subset, by rw [← hκ.compl_eq hX.1]; exact hX.2⟩ + +theorem IsBias.notMem_self {E : Set β} {κ : Set β → ℤ} {ℬ : Set (Set β)} + (hℬ : IsBias E κ ℬ) : E ∉ ℬ := by + intro hE + apply hℬ.union_ne hE hE hE + simp + +theorem IsBias.notMem_of_union_eq {E X Y : Set β} {κ : Set β → ℤ} {ℬ : Set (Set β)} + (hℬ : IsBias E κ ℬ) (hX : X ∈ ℬ) (hY : Y ∈ ℬ) : X ∪ Y ≠ E := by + intro hXY + apply hℬ.union_ne hX hY hY + rw [Set.union_assoc, Set.union_self, hXY] + +theorem IsBias.compl_notMem {E X : Set β} {κ : Set β → ℤ} {ℬ : Set (Set β)} + (hℬ : IsBias E κ ℬ) (hX : X ∈ ℬ) : E \ X ∉ ℬ := by + intro hcompl + have hsub : X ⊆ E := (hℬ.isEfficient hX).1 + exact hℬ.notMem_of_union_eq hX hcompl (Set.union_sdiff_cancel hsub) + +/-! ## Ternary trees and incidences -/ + +theorem isTreeIncidence_iff_adj {T : SimpleGraph ι} {u v : ι} : + IsTreeIncidence T u s(u, v) ↔ T.Adj u v := by + simp [IsTreeIncidence, mem_incidenceSet] + +theorem isTreeIncidence_symm {T : SimpleGraph ι} {u v : ι} (h : T.Adj u v) : + IsTreeIncidence T v s(u, v) := by + rw [Sym2.eq_swap] + exact isTreeIncidence_iff_adj.2 h.symm + +theorem isTreeIncidence_iff_exists_adj {T : SimpleGraph ι} {v : ι} {e : Sym2 ι} : + IsTreeIncidence T v e ↔ ∃ w, T.Adj v w ∧ e = s(v, w) := by + constructor + · intro h + rcases e with ⟨a, b⟩ + have hadj : T.Adj a b := T.mem_edgeSet.1 h.1 + have hmem : v ∈ s(a, b) := h.2 + rcases Sym2.mem_iff.1 hmem with rfl | rfl + · exact ⟨b, hadj, rfl⟩ + · exact ⟨a, hadj.symm, Sym2.eq_swap⟩ + · rintro ⟨w, hadj, rfl⟩ + exact isTreeIncidence_iff_adj.2 hadj + +theorem IsTernaryTree.degree_eq_one_of_isLeaf [Fintype ι] {T : SimpleGraph ι} + (hT : IsTernaryTree T) {v : ι} (hv : IsLeaf T v) : + by classical exact T.degree v = 1 := by + classical + rcases hT.degree_eq_one_or_three v with h1 | h3 + · exact h1 + · exfalso + have : T.degree v ≤ 1 := hv + omega + +theorem IsTernaryTree.degree_eq_three_of_not_isLeaf [Fintype ι] {T : SimpleGraph ι} + (hT : IsTernaryTree T) {v : ι} (hv : ¬ IsLeaf T v) : + by classical exact T.degree v = 3 := by + classical + rcases hT.degree_eq_one_or_three v with h1 | h3 + · exact (hv h1.le).elim + · exact h3 + +theorem IsTernaryTree.exists_adj_of_isLeaf [Fintype ι] {T : SimpleGraph ι} + (hT : IsTernaryTree T) {v : ι} (hv : IsLeaf T v) : + ∃! w, T.Adj v w := by + classical + have h1 : T.degree v = 1 := hT.degree_eq_one_of_isLeaf hv + exact (degree_eq_one_iff_existsUnique_adj (G := T) (v := v)).1 h1 + +theorem IsTernaryTree.exists_three_adj_of_not_isLeaf [Fintype ι] {T : SimpleGraph ι} + (hT : IsTernaryTree T) {v : ι} (hv : ¬ IsLeaf T v) : + ∃ w₁ w₂ w₃, w₁ ≠ w₂ ∧ w₁ ≠ w₃ ∧ w₂ ≠ w₃ ∧ + ∀ w, T.Adj v w ↔ w = w₁ ∨ w = w₂ ∨ w = w₃ := by + classical + have h3 : (T.neighborFinset v).card = 3 := by + rw [card_neighborFinset_eq_degree] + exact hT.degree_eq_three_of_not_isLeaf hv + obtain ⟨w₁, w₂, w₃, h12, h13, h23, heq⟩ := Finset.card_eq_three.1 h3 + refine ⟨w₁, w₂, w₃, h12, h13, h23, fun w ↦ ?_⟩ + rw [← mem_neighborFinset, heq] + simp + +theorem IsTernaryTree.exists_other_two_adj [Fintype ι] {T : SimpleGraph ι} + (hT : IsTernaryTree T) {v w : ι} (hv : ¬ IsLeaf T v) (hadj : T.Adj v w) : + ∃ w₁ w₂, w ≠ w₁ ∧ w ≠ w₂ ∧ w₁ ≠ w₂ ∧ + ∀ x, T.Adj v x ↔ x = w ∨ x = w₁ ∨ x = w₂ := by + obtain ⟨a, b, c, hab, hac, hbc, hiff⟩ := hT.exists_three_adj_of_not_isLeaf hv + rcases (hiff w).1 hadj with rfl | rfl | rfl + · exact ⟨b, c, hab, hac, hbc, hiff⟩ + · refine ⟨a, c, hab.symm, hbc, hac, fun x ↦ ?_⟩ + rw [hiff x] + tauto + · refine ⟨a, b, hac.symm, hbc.symm, hab, fun x ↦ ?_⟩ + rw [hiff x] + tauto + +theorem sym2_mk_eq_left_iff {v w₁ w₂ : ι} : s(v, w₁) = s(v, w₂) ↔ w₁ = w₂ := by + rw [Sym2.eq_iff] + constructor + · rintro (⟨_, h⟩ | ⟨h1, h2⟩) + · exact h + · exact h2.trans h1 + · rintro rfl + exact Or.inl ⟨rfl, rfl⟩ + +theorem IsTernaryTree.not_isLeaf_of_isFork [Fintype ι] {T : SimpleGraph ι} + (hT : IsTernaryTree T) {t : ι} {e₁ e₂ : Sym2 ι} (hf : IsFork T t e₁ e₂) : + ¬ IsLeaf T t := by + intro hleaf + obtain ⟨w, _, hw_uniq⟩ := hT.exists_adj_of_isLeaf hleaf + obtain ⟨w₁, hw₁, rfl⟩ := isTreeIncidence_iff_exists_adj.1 hf.1 + obtain ⟨w₂, hw₂, rfl⟩ := isTreeIncidence_iff_exists_adj.1 hf.2.1 + have h1 : w₁ = w := hw_uniq w₁ hw₁ + have h2 : w₂ = w := hw_uniq w₂ hw₂ + exact hf.2.2 (by rw [h1, h2]) + +/-! ## Basic properties of tree-labellings -/ + +theorem IsTreeLabelling.subset_of_inc [Fintype ι] {E : Set β} {κ : Set β → ℤ} {𝒜 : Set (Set β)} + {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} (hα : IsTreeLabelling E κ 𝒜 T α) + {v : ι} {e : Sym2 ι} (he : IsTreeIncidence T v e) : α v e ⊆ E := + (hα.isEfficient he).1 + +theorem IsTreeLabelling.compl_eq' [Fintype ι] {E : Set β} {κ : Set β → ℤ} {𝒜 : Set (Set β)} + {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} (hα : IsTreeLabelling E κ 𝒜 T α) + {u v : ι} (hadj : T.Adj u v) : α v s(u, v) = E \ α u s(u, v) := by + rw [Sym2.eq_swap] + exact hα.compl_eq hadj.symm + +theorem IsTreeLabelling.union_adj_eq [Fintype ι] {E : Set β} {κ : Set β → ℤ} {𝒜 : Set (Set β)} + {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} (hα : IsTreeLabelling E κ 𝒜 T α) + {u v : ι} (hadj : T.Adj u v) : α u s(u, v) ∪ α v s(u, v) = E := by + rw [hα.compl_eq' hadj] + exact Set.union_sdiff_cancel (hα.subset_of_inc (isTreeIncidence_iff_adj.2 hadj)) + +theorem IsTreeLabelling.inter_adj_eq_empty [Fintype ι] {E : Set β} {κ : Set β → ℤ} + {𝒜 : Set (Set β)} {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} + (hα : IsTreeLabelling E κ 𝒜 T α) {u v : ι} (hadj : T.Adj u v) : + α u s(u, v) ∩ α v s(u, v) = ∅ := by + rw [hα.compl_eq' hadj] + exact Set.inter_sdiff_self _ _ + +/-! ## Proof of (3.1) -/ + +/-- **Graph Minors X, (3.1)** (page 160): +"If there is a bias extending $\mathscr{A}$ then there is no tree-labelling over $\mathscr{A}$." -/ +theorem theorem_3_1_proof [Fintype ι] {E : Set β} {κ : Set β → ℤ} {𝒜 ℬ : Set (Set β)} + {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} + (hℬ_ext : BiasExtends E κ 𝒜 ℬ) (hα : IsTreeLabelling E κ 𝒜 T α) : False := by + classical + obtain ⟨hℬ, h𝒜ℬ⟩ := hℬ_ext + have hT := hα.isTernaryTree + -- For each edge `e ∈ E(T)`, at most one end of `e` is passive. + have huniq_passive : ∀ {e : Sym2 ι} {v₁ v₂ : ι}, + IsPassiveIncidence T α ℬ v₁ e → IsPassiveIncidence T α ℬ v₂ e → v₁ = v₂ := by + intro e v₁ v₂ hp₁ hp₂ + obtain ⟨w₁, hadj₁, rfl⟩ := isTreeIncidence_iff_exists_adj.1 hp₁.1 + have hmem₂ : v₂ ∈ s(v₁, w₁) := hp₂.1.2 + rcases Sym2.mem_iff.1 hmem₂ with rfl | rfl + · rfl + · exfalso + have heff : IsEfficient E κ (α v₁ s(v₁, v₂)) := + hα.isEfficient (isTreeIncidence_iff_adj.2 hadj₁) + rcases hℬ.mem_or_compl_mem heff with h1 | h2 + · exact hp₁.2 h1 + · rw [← hα.compl_eq' hadj₁] at h2 + exact hp₂.2 h2 + -- If every vertex `v` were in a passive incidence, we would have an injection `ι → T.edgeFinset`. + have hex_no_passive : ∃ v : ι, ∀ e : Sym2 ι, IsTreeIncidence T v e → α v e ∈ ℬ := by + by_contra! hall + choose f hf using hall + have hf_mem : ∀ v : ι, f v ∈ T.edgeFinset := fun v ↦ + T.mem_edgeFinset.2 (hf v).1.1 + let g : ι → {e // e ∈ T.edgeFinset} := fun v ↦ ⟨f v, hf_mem v⟩ + have hg_inj : Function.Injective g := by + intro v₁ v₂ heq + have hfeq : f v₁ = f v₂ := Subtype.ext_iff.1 heq + exact huniq_passive (hf v₁) (hfeq ▸ hf v₂) + have hcard_le := Fintype.card_le_of_injective g hg_inj + rw [Fintype.card_coe] at hcard_le + have hcard_tree : T.edgeFinset.card + 1 = Fintype.card ι := hT.isTree.card_edgeFinset + omega + obtain ⟨v, hv_active⟩ := hex_no_passive + by_cases hleaf : IsLeaf T v + · obtain ⟨w, hadj, _⟩ := hT.exists_adj_of_isLeaf hleaf + have hinc : IsTreeIncidence T v s(v, w) := isTreeIncidence_iff_adj.2 hadj + have hmem : α v s(v, w) ∈ ℬ := hv_active s(v, w) hinc + rcases hα.leaf_eq_or_union_eq hinc hleaf with heq | ⟨X, hX𝒜, hunion⟩ + · rw [heq] at hmem + exact hℬ.notMem_self hmem + · exact hℬ.notMem_of_union_eq hmem (h𝒜ℬ hX𝒜) hunion + · obtain ⟨w₁, w₂, w₃, h12, h13, h23, hiff⟩ := hT.exists_three_adj_of_not_isLeaf hleaf + have hadj₁ : T.Adj v w₁ := (hiff w₁).2 (Or.inl rfl) + have hadj₂ : T.Adj v w₂ := (hiff w₂).2 (Or.inr (Or.inl rfl)) + have hadj₃ : T.Adj v w₃ := (hiff w₃).2 (Or.inr (Or.inr rfl)) + have hinc₁ : IsTreeIncidence T v s(v, w₁) := isTreeIncidence_iff_adj.2 hadj₁ + have hinc₂ : IsTreeIncidence T v s(v, w₂) := isTreeIncidence_iff_adj.2 hadj₂ + have hinc₃ : IsTreeIncidence T v s(v, w₃) := isTreeIncidence_iff_adj.2 hadj₃ + have he12 : s(v, w₁) ≠ s(v, w₂) := sym2_mk_eq_left_iff.not.2 h12 + have he13 : s(v, w₁) ≠ s(v, w₃) := sym2_mk_eq_left_iff.not.2 h13 + have he23 : s(v, w₂) ≠ s(v, w₃) := sym2_mk_eq_left_iff.not.2 h23 + have hunion := hα.degree_three_union_eq hinc₁ hinc₂ hinc₃ he12 he13 he23 + exact hℬ.union_ne (hv_active _ hinc₁) (hv_active _ hinc₂) (hv_active _ hinc₃) hunion + +/-! ## Proof of (3.2) -/ + +open Classical in +/-- The finite set of all incidences `(v, e)` in `T`. -/ +noncomputable def incidencesFinset [Fintype ι] (T : SimpleGraph ι) : Finset (ι × Sym2 ι) := + Finset.univ.filter fun p ↦ IsTreeIncidence T p.1 p.2 + +open Classical in +/-- The sum `∑_{(v, e)} κ(α(v, e))` over all incidences `(v, e)` of `T` +(Graph Minors X, Section 3, proof of (3.2), condition (2), page 160). -/ +noncomputable def kappaSum [Fintype ι] (κ : Set β → ℤ) (T : SimpleGraph ι) + (α : ι → Sym2 ι → Set β) : ℤ := + ∑ p ∈ incidencesFinset T, κ (α p.1 p.2) + +open Classical in +/-- The finite set of ordered non-exact forks `(t, e₁, e₂)` in `T` for `α`. +Each unordered non-exact fork `{e₁, e₂}` with nub `t` corresponds to the two ordered pairs +`(t, e₁, e₂)` and `(t, e₂, e₁)`, so minimizing the sum over ordered non-exact forks is equivalent +to minimizing the sum over unordered non-exact forks. -/ +noncomputable def nonExactForksFinset [Fintype ι] (T : SimpleGraph ι) + (α : ι → Sym2 ι → Set β) : Finset (ι × Sym2 ι × Sym2 ι) := + Finset.univ.filter fun f ↦ IsFork T f.1 f.2.1 f.2.2 ∧ ¬ IsExactFork α f.1 f.2.1 f.2.2 + +open Classical in +/-- The scaled distance weight `∑ 3^{|V(T)| - d(t)}` summed over all ordered non-exact forks, +which is `2 · 3^{|V(T)|} · ∑ 3^{-d(t)}` (since `d(t) < |V(T)|` for every vertex `t` in a tree `T`) +(Graph Minors X, Section 3, proof of (3.2), condition (3), page 160). -/ +noncomputable def forkWeight [Fintype ι] (T : SimpleGraph ι) (t₀ : ι) + (α : ι → Sym2 ι → Set β) : ℕ := + ∑ f ∈ nonExactForksFinset T α, 3 ^ (Fintype.card ι - T.dist t₀ f.1) + +open Classical in +/-- The modified labelling `α'` in the proof of (3.2) (Graph Minors X, page 161): +for an edge `e₁ = s(t, t₁)` and set `A₂ = α(t, e₂)`, +`α'(t, e₁) = α(t, e₁) \ A₂`, `α'(t₁, e₁) = E \ (α(t, e₁) \ A₂)`, and `α'(v, e) = α(v, e)` +elsewhere. -/ +noncomputable def updateLabelling (E : Set β) (α : ι → Sym2 ι → Set β) + (t t₁ : ι) (A₂ : Set β) (v : ι) (e : Sym2 ι) : Set β := + if v = t ∧ e = s(t, t₁) then α t s(t, t₁) \ A₂ + else if v = t₁ ∧ e = s(t, t₁) then E \ (α t s(t, t₁) \ A₂) + else α v e + +private theorem updateLabelling_self_left (E : Set β) (α : ι → Sym2 ι → Set β) + (t t₁ : ι) (A₂ : Set β) : + updateLabelling E α t t₁ A₂ t s(t, t₁) = α t s(t, t₁) \ A₂ := by + classical + simp [updateLabelling] + +private theorem updateLabelling_self_right (E : Set β) (α : ι → Sym2 ι → Set β) + {t t₁ : ι} (hne : t ≠ t₁) (A₂ : Set β) : + updateLabelling E α t t₁ A₂ t₁ s(t, t₁) = E \ (α t s(t, t₁) \ A₂) := by + classical + simp [updateLabelling, hne.symm] + +private theorem updateLabelling_eq_of_ne {E : Set β} {α : ι → Sym2 ι → Set β} + {t t₁ : ι} {A₂ : Set β} {v : ι} {e : Sym2 ι} + (h1 : ¬ (v = t ∧ e = s(t, t₁))) (h2 : ¬ (v = t₁ ∧ e = s(t, t₁))) : + updateLabelling E α t t₁ A₂ v e = α v e := by + classical + dsimp [updateLabelling] + rw [ite_eq_right_iff.2 fun h ↦ (h1 h).elim, ite_eq_right_iff.2 fun h ↦ (h2 h).elim] + +private theorem updateLabelling_isTreeLabelling [Fintype ι] {E : Set β} {κ : Set β → ℤ} + {𝒜 : Set (Set β)} {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} + (hκ : IsConnectivityFunction E κ) (hα : IsTreeLabelling E κ 𝒜 T α) + {t t₁ t₂ : ι} (hadj₁ : T.Adj t t₁) (hadj₂ : T.Adj t t₂) (hne12 : t₁ ≠ t₂) + (heff : IsEfficient E κ (α t s(t, t₁) \ α t s(t, t₂))) : + IsTreeLabelling E κ 𝒜 T (updateLabelling E α t t₁ (α t s(t, t₂))) := by + classical + let e₁ := s(t, t₁) + let e₂ := s(t, t₂) + let A₁ := α t e₁ + let A₂ := α t e₂ + have hne_tt₁ : t ≠ t₁ := hadj₁.ne + have hα_t₁_sub : α t₁ e₁ ⊆ updateLabelling E α t t₁ A₂ t₁ e₁ := by + intro x hx + rw [updateLabelling_self_right E α hne_tt₁ A₂] + rw [hα.compl_eq' hadj₁] at hx + exact ⟨hx.1, fun h ↦ hx.2 h.1⟩ + refine ⟨hα.isTernaryTree, ?_, ?_, ?_, ?_⟩ + · intro v e hinc + by_cases h1 : v = t ∧ e = e₁ + · rcases h1 with ⟨hvt, hfe⟩ + subst hvt hfe + rw [updateLabelling_self_left] + exact heff + by_cases h2 : v = t₁ ∧ e = e₁ + · rcases h2 with ⟨hvt₁, hfe⟩ + subst hvt₁ hfe + rw [updateLabelling_self_right E α hne_tt₁ A₂] + exact heff.compl hκ + · rw [updateLabelling_eq_of_ne h1 h2] + exact hα.isEfficient hinc + · intro u v hadj + by_cases he : s(u, v) = e₁ + · have hmem : u ∈ s(t, t₁) ∧ v ∈ s(t, t₁) := by + change u ∈ e₁ ∧ v ∈ e₁ + rw [← he] + exact ⟨Sym2.mem_mk_left u v, Sym2.mem_mk_right u v⟩ + rcases Sym2.mem_iff.1 hmem.1 with h1 | h1 <;> + rcases Sym2.mem_iff.1 hmem.2 with h2 | h2 + · subst h1 h2; exact (hadj.ne rfl).elim + · subst h1 h2 + rw [updateLabelling_self_left, updateLabelling_self_right E α hne_tt₁ A₂, + Set.sdiff_sdiff_cancel_left heff.1] + · subst h1 h2 + rw [he, updateLabelling_self_left, updateLabelling_self_right E α hne_tt₁ A₂] + · subst h1 h2; exact (hadj.ne rfl).elim + · rw [updateLabelling_eq_of_ne (fun h ↦ he h.2) (fun h ↦ he h.2), + updateLabelling_eq_of_ne (fun h ↦ he h.2) (fun h ↦ he h.2)] + exact hα.compl_eq hadj + · intro v e hinc hleaf + have ht_not_leaf : ¬ IsLeaf T t := + hα.isTernaryTree.not_isLeaf_of_isFork + ⟨isTreeIncidence_iff_adj.2 hadj₁, isTreeIncidence_iff_adj.2 hadj₂, + sym2_mk_eq_left_iff.not.2 hne12⟩ + have hvt : v ≠ t := by rintro rfl; exact ht_not_leaf hleaf + by_cases h2 : v = t₁ ∧ e = e₁ + · rcases h2 with ⟨hvt₁, hfe⟩ + subst hvt₁ hfe + rcases hα.leaf_eq_or_union_eq hinc hleaf with heq | ⟨X, hX, hunion⟩ + · left + refine Set.Subset.antisymm ?_ ?_ + · rw [updateLabelling_self_right E α hne_tt₁ A₂]; exact Set.sdiff_subset + · have hsub := hα_t₁_sub + rwa [heq] at hsub + · right + refine ⟨X, hX, Set.Subset.antisymm ?_ ?_⟩ + · refine Set.union_subset ?_ (hunion ▸ Set.subset_union_right) + rw [updateLabelling_self_right E α hne_tt₁ A₂]; exact Set.sdiff_subset + · have hsub := Set.union_subset_union_left X hα_t₁_sub + rwa [hunion] at hsub + · rw [updateLabelling_eq_of_ne (fun h ↦ hvt h.1) h2] + exact hα.leaf_eq_or_union_eq hinc hleaf + · intro v f₁ f₂ f₃ hf₁ hf₂ hf₃ h12 h13 h23 + have hsub_all : ∀ f, IsTreeIncidence T v f → updateLabelling E α t t₁ A₂ v f ⊆ E := by + intro f hf + by_cases a : v = t ∧ f = e₁ + · rcases a with ⟨hvt, hfe⟩; subst hvt hfe; rw [updateLabelling_self_left]; exact heff.1 + by_cases b : v = t₁ ∧ f = e₁ + · rcases b with ⟨hvt₁, hfe⟩; subst hvt₁ hfe + rw [updateLabelling_self_right E α hne_tt₁ A₂]; exact Set.sdiff_subset + · rw [updateLabelling_eq_of_ne a b]; exact hα.subset_of_inc hf + refine Set.Subset.antisymm + (Set.union_subset (Set.union_subset (hsub_all f₁ hf₁) (hsub_all f₂ hf₂)) (hsub_all f₃ hf₃)) + ?_ + intro x hx + rw [← hα.degree_three_union_eq hf₁ hf₂ hf₃ h12 h13 h23] at hx + by_cases hvt : v = t + · subst hvt + have ht_not_leaf : ¬ IsLeaf T v := + hα.isTernaryTree.not_isLeaf_of_isFork ⟨hf₁, hf₂, h12⟩ + have he₂_mem : e₂ = f₁ ∨ e₂ = f₂ ∨ e₂ = f₃ := by + by_contra! hnot + have hinc_e₂ : e₂ ∈ T.incidenceFinset v := + T.mem_incidenceFinset.2 (isTreeIncidence_iff_adj.2 hadj₂) + have hinc_f₁ : f₁ ∈ T.incidenceFinset v := T.mem_incidenceFinset.2 hf₁ + have hinc_f₂ : f₂ ∈ T.incidenceFinset v := T.mem_incidenceFinset.2 hf₂ + have hinc_f₃ : f₃ ∈ T.incidenceFinset v := T.mem_incidenceFinset.2 hf₃ + have hcard3 : (T.incidenceFinset v).card = 3 := by + rw [card_incidenceFinset_eq_degree] + exact hα.isTernaryTree.degree_eq_three_of_not_isLeaf ht_not_leaf + have hsub4 : ({e₂, f₁, f₂, f₃} : Finset (Sym2 ι)) ⊆ T.incidenceFinset v := by + intro g hg + simp only [Finset.mem_insert, Finset.mem_singleton] at hg + rcases hg with rfl | rfl | rfl | rfl <;> assumption + have hcard4 : ({e₂, f₁, f₂, f₃} : Finset (Sym2 ι)).card = 4 := by + rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, + Finset.card_insert_of_notMem, Finset.card_singleton] <;> + simp [hnot.1, hnot.2.1, hnot.2.2, h12, h13, h23] + have := Finset.card_le_card hsub4 + omega + have hsub_at_t : ∀ f, α v f ⊆ updateLabelling E α v t₁ A₂ v f ∪ A₂ := by + intro f y hy + by_cases hfe : f = e₁ + · subst hfe + rw [updateLabelling_self_left] + by_cases hy2 : y ∈ A₂ + · exact Or.inr hy2 + · exact Or.inl ⟨hy, hy2⟩ + · rw [updateLabelling_eq_of_ne (fun h ↦ hfe h.2) (fun h ↦ hfe h.2)] + exact Or.inl hy + have hA₂_in : A₂ ⊆ + updateLabelling E α v t₁ A₂ v f₁ ∪ + updateLabelling E α v t₁ A₂ v f₂ ∪ + updateLabelling E α v t₁ A₂ v f₃ := by + have he₂_ne_e₁ : e₂ ≠ e₁ := sym2_mk_eq_left_iff.not.2 hne12.symm + have hα'_e₂ : updateLabelling E α v t₁ A₂ v e₂ = A₂ := + updateLabelling_eq_of_ne (fun h ↦ he₂_ne_e₁ h.2) (fun h ↦ he₂_ne_e₁ h.2) + rcases he₂_mem with rfl | rfl | rfl + · rw [hα'_e₂]; exact Set.subset_union_of_subset_left Set.subset_union_left _ + · rw [hα'_e₂]; exact Set.subset_union_of_subset_left Set.subset_union_right _ + · rw [hα'_e₂]; exact Set.subset_union_right + rcases hx with (hx | hx) | hx + · rcases hsub_at_t f₁ hx with hx' | hx2 + · exact Or.inl (Or.inl hx') + · exact hA₂_in hx2 + · rcases hsub_at_t f₂ hx with hx' | hx2 + · exact Or.inl (Or.inr hx') + · exact hA₂_in hx2 + · rcases hsub_at_t f₃ hx with hx' | hx2 + · exact Or.inr hx' + · exact hA₂_in hx2 + · have hsub_not_t : ∀ f, α v f ⊆ updateLabelling E α t t₁ A₂ v f := by + intro f + by_cases h2 : v = t₁ ∧ f = e₁ + · rcases h2 with ⟨hvt₁, hfe⟩ + subst hvt₁ hfe + exact hα_t₁_sub + · rw [updateLabelling_eq_of_ne (fun h ↦ hvt h.1) h2] + rcases hx with (hx | hx) | hx + · exact Or.inl (Or.inl (hsub_not_t f₁ hx)) + · exact Or.inl (Or.inr (hsub_not_t f₂ hx)) + · exact Or.inr (hsub_not_t f₃ hx) + +private theorem kappaSum_updateLabelling [Fintype ι] {E : Set β} {κ : Set β → ℤ} + {𝒜 : Set (Set β)} {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} + (hκ : IsConnectivityFunction E κ) (hα : IsTreeLabelling E κ 𝒜 T α) + {t t₁ t₂ : ι} (hadj₁ : T.Adj t t₁) : + kappaSum κ T (updateLabelling E α t t₁ (α t s(t, t₂))) - kappaSum κ T α = + 2 * (κ (α t s(t, t₁) \ α t s(t, t₂)) - κ (α t s(t, t₁))) := by + classical + let e₁ := s(t, t₁) + let A₁ := α t e₁ + let A₂ := α t s(t, t₂) + let α' := updateLabelling E α t t₁ A₂ + have hne : t ≠ t₁ := hadj₁.ne + have hp₁ : (t, e₁) ∈ incidencesFinset T := by + simp [incidencesFinset, e₁, isTreeIncidence_iff_adj.2 hadj₁] + have hp₂ : (t₁, e₁) ∈ incidencesFinset T := by + simp [incidencesFinset, e₁, isTreeIncidence_symm hadj₁] + have hp_ne : (t, e₁) ≠ (t₁, e₁) := fun h ↦ hne (Prod.ext_iff.1 h).1 + have hsum : ∀ β_lab : ι → Sym2 ι → Set β, + kappaSum κ T β_lab = + κ (β_lab t e₁) + κ (β_lab t₁ e₁) + + ∑ p ∈ (incidencesFinset T).erase (t₁, e₁) |>.erase (t, e₁), κ (β_lab p.1 p.2) := by + intro β_lab + unfold kappaSum + have hp₁' : (t, e₁) ∈ (incidencesFinset T).erase (t₁, e₁) := + Finset.mem_erase.2 ⟨hp_ne, hp₁⟩ + rw [← Finset.add_sum_erase _ _ hp₂, ← Finset.add_sum_erase _ _ hp₁'] + dsimp only + omega + have hrest_eq : + ∑ p ∈ (incidencesFinset T).erase (t₁, e₁) |>.erase (t, e₁), κ (α' p.1 p.2) = + ∑ p ∈ (incidencesFinset T).erase (t₁, e₁) |>.erase (t, e₁), κ (α p.1 p.2) := by + refine Finset.sum_congr rfl fun p hp ↦ ?_ + have hne1 : p ≠ (t, e₁) := (Finset.mem_erase.1 hp).1 + have hne2 : p ≠ (t₁, e₁) := (Finset.mem_erase.1 (Finset.mem_erase.1 hp).2).1 + dsimp only [α'] + rw [updateLabelling_eq_of_ne (fun h ↦ hne1 (Prod.ext h.1 h.2)) + (fun h ↦ hne2 (Prod.ext h.1 h.2))] + have hA₁_sub : A₁ ⊆ E := hα.subset_of_inc (isTreeIncidence_iff_adj.2 hadj₁) + have hA₁_diff_sub : A₁ \ A₂ ⊆ E := Set.sdiff_subset.trans hA₁_sub + have hα'_t : α' t e₁ = A₁ \ A₂ := by simp [α', updateLabelling, e₁, A₁, A₂] + have hα'_t₁ : α' t₁ e₁ = E \ (A₁ \ A₂) := by + simp [α', updateLabelling, e₁, A₁, A₂, hne.symm] + have hκ_α_t₁ : κ (α t₁ e₁) = κ A₁ := by + rw [hα.compl_eq' hadj₁, ← hκ.compl_eq hA₁_sub] + have hκ_α'_t₁ : κ (α' t₁ e₁) = κ (A₁ \ A₂) := by + rw [hα'_t₁, ← hκ.compl_eq hA₁_diff_sub] + change kappaSum κ T α' - kappaSum κ T α = 2 * (κ (A₁ \ A₂) - κ A₁) + rw [hsum α', hsum α, hrest_eq, hα'_t, hκ_α'_t₁, hκ_α_t₁] + dsimp only [A₁] + omega + +private theorem dist_lt_card_of_isTree [Fintype ι] {T : SimpleGraph ι} (hT : T.IsTree) + (u v : ι) : T.dist u v < Fintype.card ι := by + obtain ⟨p, hp, hp_len⟩ := (hT.connected u v).exists_path_of_dist + have hlen : p.support.length = p.length + 1 := Walk.length_support p + have hle : p.support.length ≤ Fintype.card ι := hp.support_nodup.length_le_card + omega + +private theorem forkWeight_updateLabelling_lt [Fintype ι] {E : Set β} + {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} (hT : IsTernaryTree T) (t₀ : ι) + {t t₁ t₂ : ι} (hadj₁ : T.Adj t t₁) (hadj₂ : T.Adj t t₂) (hne12 : t₁ ≠ t₂) + (hnon_exact : ¬ IsExactFork α t s(t, t₁) s(t, t₂)) + (hdist : T.dist t₀ t + 1 = T.dist t₀ t₁) : + forkWeight T t₀ (updateLabelling E α t t₁ (α t s(t, t₂))) < forkWeight T t₀ α := by + classical + let e₁ := s(t, t₁) + let e₂ := s(t, t₂) + let A₂ := α t e₂ + let α' := updateLabelling E α t t₁ A₂ + have hne_tt₁ : t ≠ t₁ := hadj₁.ne + have he12 : e₁ ≠ e₂ := sym2_mk_eq_left_iff.not.2 hne12 + have hinc₁ : IsTreeIncidence T t e₁ := isTreeIncidence_iff_adj.2 hadj₁ + have hinc₂ : IsTreeIncidence T t e₂ := isTreeIncidence_iff_adj.2 hadj₂ + let count (β_lab : ι → Sym2 ι → Set β) (v : ι) : ℕ := + (Finset.univ.filter fun p : Sym2 ι × Sym2 ι ↦ + IsFork T v p.1 p.2 ∧ ¬ IsExactFork β_lab v p.1 p.2).card + -- Decompose the sum over vertices `v : ι` + have hsum_by_vert : ∀ β_lab : ι → Sym2 ι → Set β, + forkWeight T t₀ β_lab = + ∑ v : ι, count β_lab v * 3 ^ (Fintype.card ι - T.dist t₀ v) := by + intro β_lab + unfold forkWeight nonExactForksFinset + rw [← Finset.univ_product_univ, Finset.sum_filter, Finset.sum_product] + refine Finset.sum_congr rfl fun v _ ↦ ?_ + dsimp only [count] + rw [← Finset.sum_filter, Finset.sum_const, smul_eq_mul] + -- For `v ≠ t` and `v ≠ t₁`, `count α' v = count α v` + have hcount_other : ∀ v : ι, v ≠ t → v ≠ t₁ → count α' v = count α v := by + intro v hvt hvt₁ + dsimp [count] + congr 1 + ext ⟨f₁, f₂⟩ + simp only [Finset.mem_filter, Finset.mem_univ, true_and] + have h1 : α' v f₁ = α v f₁ := + updateLabelling_eq_of_ne (fun h ↦ hvt h.1) (fun h ↦ hvt₁ h.1) + have h2 : α' v f₂ = α v f₂ := + updateLabelling_eq_of_ne (fun h ↦ hvt h.1) (fun h ↦ hvt₁ h.1) + simp [IsExactFork, h1, h2] + -- At `v = t`, `count α' t + 2 ≤ count α t` + have hcount_t : count α' t + 2 ≤ count α t := by + let S' := Finset.univ.filter fun p : Sym2 ι × Sym2 ι ↦ + IsFork T t p.1 p.2 ∧ ¬ IsExactFork α' t p.1 p.2 + let S := Finset.univ.filter fun p : Sym2 ι × Sym2 ι ↦ + IsFork T t p.1 p.2 ∧ ¬ IsExactFork α t p.1 p.2 + have hsub_at_t : ∀ f, α' t f ⊆ α t f := by + intro f + by_cases hfe : f = e₁ + · subst hfe + have : α' t e₁ = α t e₁ \ A₂ := by simp [α', updateLabelling, e₁, A₂] + rw [this] + exact Set.sdiff_subset + · dsimp only [α'] + rw [updateLabelling_eq_of_ne (fun h ↦ hfe h.2) (fun h ↦ hfe h.2)] + have hS'_sub : S' ⊆ S := by + intro ⟨f₁, f₂⟩ hp + simp only [S', S, Finset.mem_filter, Finset.mem_univ, true_and] at hp ⊢ + refine ⟨hp.1, fun hex ↦ hp.2 ?_⟩ + exact Set.Subset.antisymm + ((Set.inter_subset_inter (hsub_at_t f₁) (hsub_at_t f₂)).trans hex.subset) + (Set.empty_subset _) + have hp12_S : (e₁, e₂) ∈ S := by + simp only [S, Finset.mem_filter, Finset.mem_univ, true_and] + exact ⟨⟨hinc₁, hinc₂, he12⟩, hnon_exact⟩ + have hp21_S : (e₂, e₁) ∈ S := by + simp only [S, Finset.mem_filter, Finset.mem_univ, true_and] + refine ⟨⟨hinc₂, hinc₁, he12.symm⟩, ?_⟩ + simpa [IsExactFork, Set.inter_comm] using hnon_exact + have hα'_t_e₁ : α' t e₁ = α t e₁ \ A₂ := by simp [α', updateLabelling, e₁, A₂] + have hα'_t_e₂ : α' t e₂ = A₂ := + updateLabelling_eq_of_ne (fun h ↦ he12.symm h.2) (fun h ↦ he12.symm h.2) + have hp12_not_S' : (e₁, e₂) ∉ S' := by + intro hm + apply (Finset.mem_filter.1 hm).2.2 + simp [IsExactFork, hα'_t_e₁, hα'_t_e₂] + have hp21_not_S' : (e₂, e₁) ∉ S' := by + intro hm + apply (Finset.mem_filter.1 hm).2.2 + simp [IsExactFork, hα'_t_e₁, hα'_t_e₂] + have hins : Insert.insert (e₁, e₂) (Insert.insert (e₂, e₁) S') ⊆ S := by + intro p hp + simp only [Finset.mem_insert] at hp + rcases hp with rfl | rfl | hp + · exact hp12_S + · exact hp21_S + · exact hS'_sub hp + have hne_pair : (e₁, e₂) ≠ (e₂, e₁) := fun h ↦ he12 (Prod.ext_iff.1 h).1 + have hcard_ins : + (Insert.insert (e₁, e₂) (Insert.insert (e₂, e₁) S')).card = S'.card + 2 := by + rw [Finset.card_insert_of_notMem (by simp [hne_pair, hp12_not_S']), + Finset.card_insert_of_notMem hp21_not_S'] + have := Finset.card_le_card hins + change S'.card + 2 ≤ S.card + omega + -- At `v = t₁`, `count α' t₁ ≤ count α t₁ + 4` + have hcount_t₁ : count α' t₁ ≤ count α t₁ + 4 := by + let S' := Finset.univ.filter fun p : Sym2 ι × Sym2 ι ↦ + IsFork T t₁ p.1 p.2 ∧ ¬ IsExactFork α' t₁ p.1 p.2 + let S := Finset.univ.filter fun p : Sym2 ι × Sym2 ι ↦ + IsFork T t₁ p.1 p.2 ∧ ¬ IsExactFork α t₁ p.1 p.2 + by_cases hleaf₁ : IsLeaf T t₁ + · have hS'_empty : S' = ∅ := by + ext ⟨f₁, f₂⟩ + simp only [S', Finset.mem_filter, Finset.mem_univ, true_and, Finset.notMem_empty, + iff_false, not_and] + intro hf + exact (hT.not_isLeaf_of_isFork hf hleaf₁).elim + change S'.card ≤ S.card + 4 + rw [hS'_empty] + simp + · obtain ⟨w₁, w₂, hw₁, hw₂, hw12, hiff⟩ := hT.exists_other_two_adj hleaf₁ hadj₁.symm + let g₁ := s(t₁, w₁) + let g₂ := s(t₁, w₂) + let P : Finset (Sym2 ι × Sym2 ι) := {(e₁, g₁), (g₁, e₁), (e₁, g₂), (g₂, e₁)} + have hP_card : P.card ≤ 4 := + (Finset.card_insert_le _ _).trans (Nat.add_le_add_right + ((Finset.card_insert_le _ _).trans (Nat.add_le_add_right + ((Finset.card_insert_le _ _).trans (by simp)) 1)) 1) + have hS'_sub_SP : S' ⊆ S ∪ P := by + intro ⟨f₁, f₂⟩ hp + simp only [S', S, Finset.mem_union, Finset.mem_filter, Finset.mem_univ, true_and] at hp ⊢ + have hf_cases : ∀ f, IsTreeIncidence T t₁ f → f = e₁ ∨ f = g₁ ∨ f = g₂ := by + intro f hf + obtain ⟨w, hadj_w, rfl⟩ := isTreeIncidence_iff_exists_adj.1 hf + rcases (hiff w).1 hadj_w with rfl | rfl | rfl + · exact Or.inl Sym2.eq_swap + · exact Or.inr (Or.inl rfl) + · exact Or.inr (Or.inr rfl) + by_cases hfe : f₁ = e₁ ∨ f₂ = e₁ + · right + rcases hfe with rfl | rfl + · rcases hf_cases f₂ hp.1.2.1 with rfl | rfl | rfl + · exact (hp.1.2.2 rfl).elim + · simp [P] + · simp [P] + · rcases hf_cases f₁ hp.1.1 with rfl | rfl | rfl + · exact (hp.1.2.2 rfl).elim + · simp [P] + · simp [P] + · left + have h1 : α' t₁ f₁ = α t₁ f₁ := + updateLabelling_eq_of_ne (fun h ↦ hfe (Or.inl h.2)) (fun h ↦ hfe (Or.inl h.2)) + have h2 : α' t₁ f₂ = α t₁ f₂ := + updateLabelling_eq_of_ne (fun h ↦ hfe (Or.inr h.2)) (fun h ↦ hfe (Or.inr h.2)) + refine ⟨hp.1, ?_⟩ + simpa [IsExactFork, h1, h2] using hp.2 + have hle := (Finset.card_le_card hS'_sub_SP).trans (Finset.card_union_le S P) + change S'.card ≤ S.card + 4 + omega + -- Combine the vertex contributions + let term (β_lab : ι → Sym2 ι → Set β) (v : ι) : ℕ := + count β_lab v * 3 ^ (Fintype.card ι - T.dist t₀ v) + have hsum_split : ∀ β_lab : ι → Sym2 ι → Set β, + forkWeight T t₀ β_lab = + term β_lab t + term β_lab t₁ + + ∑ v ∈ (Finset.univ.erase t₁).erase t, term β_lab v := by + intro β_lab + rw [hsum_by_vert β_lab] + have ht₁_mem : t₁ ∈ (Finset.univ : Finset ι) := Finset.mem_univ t₁ + have ht_mem : t ∈ (Finset.univ : Finset ι).erase t₁ := + Finset.mem_erase.2 ⟨hne_tt₁, Finset.mem_univ t⟩ + rw [← Finset.add_sum_erase _ _ ht₁_mem, ← Finset.add_sum_erase _ _ ht_mem] + dsimp only [term] + omega + have hrest_eq : + ∑ v ∈ (Finset.univ.erase t₁).erase t, term α' v = + ∑ v ∈ (Finset.univ.erase t₁).erase t, term α v := by + refine Finset.sum_congr rfl fun v hv ↦ ?_ + have hvt : v ≠ t := (Finset.mem_erase.1 hv).1 + have hvt₁ : v ≠ t₁ := (Finset.mem_erase.1 (Finset.mem_erase.1 hv).2).1 + dsimp only [term] + rw [hcount_other v hvt hvt₁] + change forkWeight T t₀ α' < forkWeight T t₀ α + rw [hsum_split α', hsum_split α, hrest_eq] + have hd_lt : T.dist t₀ t₁ < Fintype.card ι := dist_lt_card_of_isTree hT.isTree t₀ t₁ + have hexp : Fintype.card ι - T.dist t₀ t = (Fintype.card ι - T.dist t₀ t₁) + 1 := by omega + let w := 3 ^ (Fintype.card ι - T.dist t₀ t₁) + have hw_pos : 0 < w := Nat.pos_of_ne_zero (pow_ne_zero _ (by decide)) + have hw_eq : 3 ^ (Fintype.card ι - T.dist t₀ t) = 3 * w := by + change 3 ^ (Fintype.card ι - T.dist t₀ t) = 3 * 3 ^ (Fintype.card ι - T.dist t₀ t₁) + rw [hexp, pow_succ, Nat.mul_comm] + dsimp only [term] + rw [hw_eq] + change count α' t * (3 * w) + count α' t₁ * w + _ < + count α t * (3 * w) + count α t₁ * w + _ + rw [← Nat.mul_assoc, ← Nat.mul_assoc, ← Nat.add_mul, ← Nat.add_mul] + have hlin : count α' t * 3 + count α' t₁ < count α t * 3 + count α t₁ := by omega + exact Nat.add_lt_add_right (Nat.mul_lt_mul_of_pos_right hlin hw_pos) _ + +/-- **Graph Minors X, (3.2)** (page 160): +"If there is a tree-labelling over $\mathscr{A}$ then there is an exact tree-labelling over +$\mathscr{A}$, using the same tree." -/ +theorem theorem_3_2_proof [Fintype ι] {E : Set β} {κ : Set β → ℤ} {𝒜 : Set (Set β)} + {T : SimpleGraph ι} {α₀ : ι → Sym2 ι → Set β} + (hE : E.Finite) (hκ : IsConnectivityFunction E κ) (hα₀ : IsTreeLabelling E κ 𝒜 T α₀) : + ∃ α, IsExactTreeLabelling E κ 𝒜 T α := by + classical + have hT := hα₀.isTernaryTree + obtain ⟨t₀⟩ := hT.isTree.connected.nonempty + -- Step 1: Choose a tree-labelling minimizing `kappaSum κ T α`. + let S₁ : Set (ι → Sym2 ι → Set β) := {α | IsTreeLabelling E κ 𝒜 T α} + have hS₁_ne : S₁.Nonempty := ⟨α₀, hα₀⟩ + have hS₁_img_fin : (kappaSum κ T '' S₁).Finite := by + let F : Finset (ι × Sym2 ι) := incidencesFinset T + let subFin : Set (Set β) := {X | X ⊆ E} + have hsubFin : subFin.Finite := hE.finite_subsets + have hmapFin : {f : F → Set β | ∀ p, f p ∈ subFin}.Finite := + Set.Finite.pi' fun _ ↦ hsubFin + have himg_sub : kappaSum κ T '' S₁ ⊆ + (fun f : F → Set β ↦ ∑ p : F, κ (f p)) '' {f : F → Set β | ∀ p, f p ∈ subFin} := by + rintro _ ⟨α, hα, rfl⟩ + refine ⟨fun p ↦ α p.1.1 p.1.2, fun p ↦ ?_, ?_⟩ + · have hp : IsTreeIncidence T p.1.1 p.1.2 := (Finset.mem_filter.1 p.2).2 + exact hα.subset_of_inc hp + · exact Finset.sum_attach F fun p ↦ κ (α p.1 p.2) + exact (hmapFin.image _).subset himg_sub + obtain ⟨α₁, hα₁_mem, hα₁_min⟩ := + Set.Finite.exists_minimalFor' (kappaSum κ T) S₁ hS₁_img_fin hS₁_ne + -- Step 2: Subject to minimizing `kappaSum`, minimize `forkWeight T t₀ α`. + let S₂ : Set (ι → Sym2 ι → Set β) := + {α | IsTreeLabelling E κ 𝒜 T α ∧ kappaSum κ T α = kappaSum κ T α₁} + have hS₂_ne : S₂.Nonempty := ⟨α₁, hα₁_mem, rfl⟩ + have hS₂_img_fin : (forkWeight T t₀ '' S₂).Finite := by + let P := (Finset.univ : Finset (ι × Sym2 ι × Sym2 ι)).powerset + have himg_sub : forkWeight T t₀ '' S₂ ⊆ + (fun s : Finset (ι × Sym2 ι × Sym2 ι) ↦ + ∑ f ∈ s, 3 ^ (Fintype.card ι - T.dist t₀ f.1)) '' (P : Set _) := by + rintro _ ⟨α, _, rfl⟩ + exact ⟨nonExactForksFinset T α, Finset.mem_powerset.2 (Finset.subset_univ _), rfl⟩ + exact (P.finite_toSet.image _).subset himg_sub + obtain ⟨α, ⟨hα_tree, hα_ksum⟩, hα_min⟩ := + Set.Finite.exists_minimalFor' (forkWeight T t₀) S₂ hS₂_img_fin hS₂_ne + have hα_kmin : ∀ α', IsTreeLabelling E κ 𝒜 T α' → kappaSum κ T α ≤ kappaSum κ T α' := by + intro α' hα' + rw [hα_ksum] + exact not_lt.1 fun hlt ↦ not_lt_of_ge (hα₁_min hα' hlt.le) hlt + refine ⟨α, hα_tree, ?_⟩ + intro t e₁ e₂ hfork + by_contra hnon_exact + obtain ⟨t₁, hadj₁, rfl⟩ := isTreeIncidence_iff_exists_adj.1 hfork.1 + obtain ⟨t₂, hadj₂, rfl⟩ := isTreeIncidence_iff_exists_adj.1 hfork.2.1 + have hne12 : t₁ ≠ t₂ := fun h ↦ hfork.2.2 (by rw [h]) + -- Claim: for any two distinct neighbors `a, b` of `t`, `κ (α t s(t, a)) ≤ κ (α t s(t, a) \ α t + -- s(t, b))`. + have hclaim : ∀ {a b : ι}, T.Adj t a → T.Adj t b → a ≠ b → + κ (α t s(t, a)) ≤ κ (α t s(t, a) \ α t s(t, b)) := by + intro a b ha hb hab + have hA_eff : IsEfficient E κ (α t s(t, a)) := + hα_tree.isEfficient (isTreeIncidence_iff_adj.2 ha) + by_cases hk_le : κ (α t s(t, a) \ α t s(t, b)) ≤ 0 + · have heff' : IsEfficient E κ (α t s(t, a) \ α t s(t, b)) := + ⟨Set.sdiff_subset.trans hA_eff.1, hk_le⟩ + have htree' := updateLabelling_isTreeLabelling hκ hα_tree ha hb hab heff' + have hle_sum := hα_kmin _ htree' + have hdiff_sum := kappaSum_updateLabelling (t₂ := b) hκ hα_tree ha + omega + · have := hA_eff.2 + omega + have hle1 : κ (α t s(t, t₁)) ≤ κ (α t s(t, t₁) \ α t s(t, t₂)) := hclaim hadj₁ hadj₂ hne12 + have hle2 : κ (α t s(t, t₂)) ≤ κ (α t s(t, t₂) \ α t s(t, t₁)) := hclaim hadj₂ hadj₁ hne12.symm + -- Submodularity inequality: `κ (A₂ \ A₁) + κ (A₁ \ A₂) ≤ κ A₁ + κ A₂`. + have hA₁_sub : α t s(t, t₁) ⊆ E := hα_tree.subset_of_inc (isTreeIncidence_iff_adj.2 hadj₁) + have hA₂_sub : α t s(t, t₂) ⊆ E := hα_tree.subset_of_inc (isTreeIncidence_iff_adj.2 hadj₂) + have hsubmod := hκ.submodular hA₁_sub (Set.sdiff_subset (s := E) (t := α t s(t, t₂))) + have hinter_eq : α t s(t, t₁) ∩ (E \ α t s(t, t₂)) = α t s(t, t₁) \ α t s(t, t₂) := by + ext x + simp only [Set.mem_inter_iff, Set.mem_sdiff] + exact ⟨fun ⟨hx1, _, hx2⟩ ↦ ⟨hx1, hx2⟩, fun ⟨hx1, hx2⟩ ↦ ⟨hx1, hA₁_sub hx1, hx2⟩⟩ + have hunion_compl_eq : + E \ (α t s(t, t₁) ∪ (E \ α t s(t, t₂))) = α t s(t, t₂) \ α t s(t, t₁) := by + ext x + simp only [Set.mem_sdiff, Set.mem_union, not_or, not_and, not_not] + exact ⟨fun ⟨hxE, hx1, hx2⟩ ↦ ⟨hx2 hxE, hx1⟩, + fun ⟨hx2, hx1⟩ ↦ ⟨hA₂_sub hx2, hx1, fun _ ↦ hx2⟩⟩ + have hκ_union : + κ (α t s(t, t₁) ∪ (E \ α t s(t, t₂))) = κ (α t s(t, t₂) \ α t s(t, t₁)) := by + rw [hκ.compl_eq (Set.union_subset hA₁_sub Set.sdiff_subset), hunion_compl_eq] + have hκ_compl2 : κ (E \ α t s(t, t₂)) = κ (α t s(t, t₂)) := (hκ.compl_eq hA₂_sub).symm + rw [hinter_eq, hκ_union, hκ_compl2] at hsubmod + -- Hence equality holds throughout! + have heq1 : κ (α t s(t, t₁) \ α t s(t, t₂)) = κ (α t s(t, t₁)) := by omega + have heq2 : κ (α t s(t, t₂) \ α t s(t, t₁)) = κ (α t s(t, t₂)) := by omega + -- At least one of `t₁, t₂` has distance `T.dist t₀ t + 1`. + have hdist_or : T.dist t₀ t + 1 = T.dist t₀ t₁ ∨ T.dist t₀ t + 1 = T.dist t₀ t₂ := by + rcases hT.isTree.dist_eq_dist_add_one_of_adj t₀ hadj₁ with hd1 | hd1 + · rcases hT.isTree.dist_eq_dist_add_one_of_adj t₀ hadj₂ with hd2 | hd2 + · exfalso + obtain ⟨p, hp, hp_len⟩ := (hT.isTree.connected t₀ t).exists_path_of_dist + obtain ⟨q₁, hq₁, hq₁_len⟩ := (hT.isTree.connected t₀ t₁).exists_path_of_dist + obtain ⟨q₂, hq₂, hq₂_len⟩ := (hT.isTree.connected t₀ t₂).exists_path_of_dist + have ht_not_q₁ : t ∉ q₁.support := by + intro ht + have := congrArg Walk.length (hT.isTree.isAcyclic.path_concat hp hq₁ hadj₁ ht) + rw [Walk.length_concat, hp_len, hq₁_len] at this + omega + have ht_not_q₂ : t ∉ q₂.support := by + intro ht + have := congrArg Walk.length (hT.isTree.isAcyclic.path_concat hp hq₂ hadj₂ ht) + rw [Walk.length_concat, hp_len, hq₂_len] at this + omega + have ht₁_p : t₁ ∈ p.support := + hT.isTree.isAcyclic.mem_support_of_ne_mem_support_of_adj_of_isPath + hp hq₁ hadj₁ ht_not_q₁ + have ht₂_p : t₂ ∈ p.support := + hT.isTree.isAcyclic.mem_support_of_ne_mem_support_of_adj_of_isPath + hp hq₂ hadj₂ ht_not_q₂ + have hpen₁ : t₁ = p.penultimate := + hT.isTree.isAcyclic.eq_penultimate_of_adj_end hp hadj₁ ht₁_p + have hpen₂ : t₂ = p.penultimate := + hT.isTree.isAcyclic.eq_penultimate_of_adj_end hp hadj₂ ht₂_p + exact hne12 (hpen₁.trans hpen₂.symm) + · exact Or.inr hd2.symm + · exact Or.inl hd1.symm + -- Apply the perturbation to whichever of `t₁, t₂` has larger distance from `t₀`. + have hcontra : ∀ {a b : ι}, T.Adj t a → T.Adj t b → a ≠ b → + ¬ IsExactFork α t s(t, a) s(t, b) → + κ (α t s(t, a) \ α t s(t, b)) = κ (α t s(t, a)) → + T.dist t₀ t + 1 = T.dist t₀ a → False := by + intro a b ha hb hab hne_ex hkeq hda + have hA_eff : IsEfficient E κ (α t s(t, a)) := + hα_tree.isEfficient (isTreeIncidence_iff_adj.2 ha) + have heff' : IsEfficient E κ (α t s(t, a) \ α t s(t, b)) := + ⟨Set.sdiff_subset.trans hA_eff.1, hkeq.trans_le hA_eff.2⟩ + let α' := updateLabelling E α t a (α t s(t, b)) + have htree' : IsTreeLabelling E κ 𝒜 T α' := + updateLabelling_isTreeLabelling hκ hα_tree ha hb hab heff' + have hksum' : kappaSum κ T α' = kappaSum κ T α₁ := by + have hdiff : kappaSum κ T α' - kappaSum κ T α = + 2 * (κ (α t s(t, a) \ α t s(t, b)) - κ (α t s(t, a))) := + kappaSum_updateLabelling (t₂ := b) hκ hα_tree ha + omega + have hα'_S₂ : α' ∈ S₂ := ⟨htree', hksum'⟩ + have hfw_lt : forkWeight T t₀ α' < forkWeight T t₀ α := + forkWeight_updateLabelling_lt hT t₀ ha hb hab hne_ex hda + have hfw_ge : forkWeight T t₀ α ≤ forkWeight T t₀ α' := hα_min hα'_S₂ hfw_lt.le + omega + rcases hdist_or with hd1 | hd2 + · exact hcontra hadj₁ hadj₂ hne12 hnon_exact heq1 hd1 + · have hnon_exact' : ¬ IsExactFork α t s(t, t₂) s(t, t₁) := by + simpa [IsExactFork, Set.inter_comm] using hnon_exact + exact hcontra hadj₂ hadj₁ hne12.symm hnon_exact' heq2 hd2 + +/-! ## Proof of (3.3) -/ + +/-- The vertex set of the component `T₀` of `T \ f` containing `u` +(Graph Minors X, Section 3, (3.3), page 161). -/ +@[expose] def treeComponent (T : SimpleGraph ι) (u : ι) (f : Sym2 ι) : Set ι := + {x : ι | (T.deleteEdges {f}).Reachable u x} + +/-- The set of leaf incidences `(v, e)` in `T` with `v` in the component of `T \ f` containing `u` +(Graph Minors X, Section 3, (3.3), page 161). -/ +@[expose] def leafIncidencesIn [Fintype ι] (T : SimpleGraph ι) (u : ι) (f : Sym2 ι) : + Set (ι × Sym2 ι) := + {p : ι × Sym2 ι | IsTreeIncidence T p.1 p.2 ∧ IsLeaf T p.1 ∧ p.1 ∈ treeComponent T u f} + +theorem reachable_deleteEdges_iff_notMem_edges {T : SimpleGraph ι} (hT : T.IsTree) + {u w x : ι} {p : T.Walk u x} (hp : p.IsPath) : + (T.deleteEdges {s(u, w)}).Reachable u x ↔ s(u, w) ∉ p.edges := by + rw [reachable_deleteEdges_iff_exists_walk] + constructor + · rintro ⟨q, hq⟩ + classical + have hqp : q.toPath.val = p := + congrArg Subtype.val ((hT.isAcyclic.subsingleton_path u x).elim q.toPath ⟨p, hp⟩) + intro hmem + rw [← hqp] at hmem + exact hq (Walk.edges_toPath_subset_edges q hmem) + · intro hnot + exact ⟨p, hnot⟩ + +theorem mem_edges_iff_mem_support_of_adj {T : SimpleGraph ι} (hT : T.IsTree) + {u w x : ι} (hadj : T.Adj u w) {p : T.Walk u x} (hp : p.IsPath) : + s(u, w) ∈ p.edges ↔ w ∈ p.support := by + constructor + · intro hmem + rw [Sym2.eq_swap] at hmem + exact Walk.fst_mem_support_of_mem_edges p hmem + · intro hw + have hwsnd : w = p.snd := hT.isAcyclic.eq_snd_of_adj_start hp hadj hw + rw [hwsnd] + cases p with + | nil => + rw [Walk.support_nil, List.mem_singleton] at hw + exact (hadj.ne hw.symm).elim + | cons _ _ => simp + +theorem mem_treeComponent_iff_notMem_support {T : SimpleGraph ι} (hT : T.IsTree) + {u w x : ι} (hadj : T.Adj u w) {p : T.Walk u x} (hp : p.IsPath) : + x ∈ treeComponent T u s(u, w) ↔ w ∉ p.support := by + change (T.deleteEdges {s(u, w)}).Reachable u x ↔ w ∉ p.support + rw [reachable_deleteEdges_iff_notMem_edges hT hp, + mem_edges_iff_mem_support_of_adj hT hadj hp] + +theorem notMem_treeComponent_iff {T : SimpleGraph ι} (hT : T.IsTree) + {u w x : ι} (hadj : T.Adj u w) : + x ∉ treeComponent T u s(u, w) ↔ x ∈ treeComponent T w s(w, u) := by + constructor + · intro hnot + obtain ⟨p, hp⟩ := hT.connected.exists_isPath u x + have hw : w ∈ p.support := by + by_contra hwnot + exact hnot ((mem_treeComponent_iff_notMem_support hT hadj hp).2 hwnot) + have hwsnd : w = p.snd := hT.isAcyclic.eq_snd_of_adj_start hp hadj hw + cases p with + | nil => + rw [Walk.support_nil, List.mem_singleton] at hw + exact (hadj.ne hw.symm).elim + | cons hadj' q => + simp only [Walk.snd_cons] at hwsnd + subst hwsnd + rw [Walk.cons_isPath_iff] at hp + exact (mem_treeComponent_iff_notMem_support hT hadj.symm hp.1).2 hp.2 + · intro hx_w hx_u + have hx_w' : (T.deleteEdges {s(u, w)}).Reachable w x := by + simpa [treeComponent, Sym2.eq_swap] using hx_w + have huw : (T.deleteEdges {s(u, w)}).Reachable u w := hx_u.trans hx_w'.symm + have hp_edge : (Walk.cons hadj Walk.nil).IsPath := Walk.IsPath.nil.cons (by simp [hadj.ne]) + have hnot_edge := (reachable_deleteEdges_iff_notMem_edges hT hp_edge).1 huw + exact hnot_edge (by simp) + +theorem not_reachable_deleteEdges_iff_treeComponent {T : SimpleGraph ι} (hT : T.IsTree) + {u w t₁ t₂ : ι} (hadj : T.Adj u w) : + ¬ (T.deleteEdges {s(u, w)}).Reachable t₁ t₂ ↔ + (t₁ ∈ treeComponent T u s(u, w) ∧ t₂ ∈ treeComponent T w s(w, u)) ∨ + (t₁ ∈ treeComponent T w s(w, u) ∧ t₂ ∈ treeComponent T u s(u, w)) := by + have h1 := notMem_treeComponent_iff hT hadj (x := t₁) + have h2 := notMem_treeComponent_iff hT hadj (x := t₂) + constructor + · intro hnot + by_cases ht₁ : t₁ ∈ treeComponent T u s(u, w) + · refine Or.inl ⟨ht₁, h2.1 fun ht₂ ↦ hnot (ht₁.symm.trans ht₂)⟩ + · refine Or.inr ⟨h1.1 ht₁, ?_⟩ + by_contra ht₂ + have ht₁' : (T.deleteEdges {s(u, w)}).Reachable w t₁ := by + simpa [treeComponent, Sym2.eq_swap] using h1.1 ht₁ + have ht₂' : (T.deleteEdges {s(u, w)}).Reachable w t₂ := by + simpa [treeComponent, Sym2.eq_swap] using h2.1 ht₂ + exact hnot (ht₁'.symm.trans ht₂') + · rintro (⟨ht₁, ht₂⟩ | ⟨ht₁, ht₂⟩) hreach + · exact (h2.2 ht₂) (ht₁.trans hreach) + · exact (h1.2 ht₁) (ht₂.trans hreach.symm) + +theorem treeComponent_eq_singleton_of_isLeaf [Fintype ι] {T : SimpleGraph ι} + (hT : IsTernaryTree T) {u w : ι} (hadj : T.Adj u w) (hleaf : IsLeaf T u) : + treeComponent T u s(u, w) = {u} := by + ext x + simp only [Set.mem_singleton_iff] + constructor + · intro hx + by_contra hne + obtain ⟨p, hp⟩ := hT.isTree.connected.exists_isPath u x + have hw_not : w ∉ p.support := (mem_treeComponent_iff_notMem_support hT.isTree hadj hp).1 hx + have hnot_nil : ¬ p.Nil := Walk.not_nil_of_ne (Ne.symm hne) + have hadj_snd : T.Adj u p.snd := p.adj_snd hnot_nil + obtain ⟨z, _, hz_uniq⟩ := hT.exists_adj_of_isLeaf hleaf + have hw_eq : p.snd = w := (hz_uniq p.snd hadj_snd).trans (hz_uniq w hadj).symm + exact hw_not (hw_eq ▸ p.snd_mem_tail_support hnot_nil |> List.mem_of_mem_tail) + · rintro rfl + exact Reachable.rfl + +theorem treeComponent_split_of_not_isLeaf [Fintype ι] {T : SimpleGraph ι} + (hT : IsTernaryTree T) {u w u₁ u₂ : ι} (hadj : T.Adj u w) + (hw₁ : w ≠ u₁) (hw₂ : w ≠ u₂) (hu12 : u₁ ≠ u₂) + (hiff : ∀ x, T.Adj u x ↔ x = w ∨ x = u₁ ∨ x = u₂) : + treeComponent T u s(u, w) = + {u} ∪ treeComponent T u₁ s(u₁, u) ∪ treeComponent T u₂ s(u₂, u) ∧ + treeComponent T u₁ s(u₁, u) ∩ treeComponent T u₂ s(u₂, u) = ∅ ∧ + u ∉ treeComponent T u₁ s(u₁, u) ∧ + u ∉ treeComponent T u₂ s(u₂, u) := by + have hadj₁ : T.Adj u u₁ := (hiff u₁).2 (Or.inr (Or.inl rfl)) + have hadj₂ : T.Adj u u₂ := (hiff u₂).2 (Or.inr (Or.inr rfl)) + have hmem_sub : ∀ {v : ι} (hadj_v : T.Adj u v) (hwv : w ≠ v) (x : ι), + x ∈ treeComponent T v s(v, u) ↔ + ∃ (p : T.Walk v x), p.IsPath ∧ u ∉ p.support := by + intro v hadj_v _ x + obtain ⟨p, hp⟩ := hT.isTree.connected.exists_isPath v x + rw [mem_treeComponent_iff_notMem_support hT.isTree hadj_v.symm hp] + exact ⟨fun h ↦ ⟨p, hp, h⟩, fun ⟨q, hq, huq⟩ ↦ by + have hqp : q = p := + congrArg Subtype.val ((hT.isTree.isAcyclic.subsingleton_path v x).elim ⟨q, hq⟩ ⟨p, hp⟩) + rwa [← hqp]⟩ + have hu_not₁ : u ∉ treeComponent T u₁ s(u₁, u) := by + rw [hmem_sub hadj₁ hw₁ u] + rintro ⟨p, _, hu⟩ + exact hu p.end_mem_support + have hu_not₂ : u ∉ treeComponent T u₂ s(u₂, u) := by + rw [hmem_sub hadj₂ hw₂ u] + rintro ⟨p, _, hu⟩ + exact hu p.end_mem_support + have hsub₁ : treeComponent T u₁ s(u₁, u) ⊆ treeComponent T u s(u, w) := by + intro x hx + obtain ⟨p₁, hp₁, hu_not⟩ := (hmem_sub hadj₁ hw₁ x).1 hx + have hp : (Walk.cons hadj₁ p₁).IsPath := (Walk.cons_isPath_iff hadj₁ p₁).2 ⟨hp₁, hu_not⟩ + rw [mem_treeComponent_iff_notMem_support hT.isTree hadj hp] + intro hw_mem + have hwsnd := hT.isTree.isAcyclic.eq_snd_of_adj_start hp hadj hw_mem + simp only [Walk.snd_cons] at hwsnd + exact hw₁ hwsnd + have hsub₂ : treeComponent T u₂ s(u₂, u) ⊆ treeComponent T u s(u, w) := by + intro x hx + obtain ⟨p₂, hp₂, hu_not⟩ := (hmem_sub hadj₂ hw₂ x).1 hx + have hp : (Walk.cons hadj₂ p₂).IsPath := (Walk.cons_isPath_iff hadj₂ p₂).2 ⟨hp₂, hu_not⟩ + rw [mem_treeComponent_iff_notMem_support hT.isTree hadj hp] + intro hw_mem + have hwsnd := hT.isTree.isAcyclic.eq_snd_of_adj_start hp hadj hw_mem + simp only [Walk.snd_cons] at hwsnd + exact hw₂ hwsnd + have hdisj : treeComponent T u₁ s(u₁, u) ∩ treeComponent T u₂ s(u₂, u) = ∅ := by + ext x + simp only [Set.mem_inter_iff, Set.mem_empty_iff_false, iff_false] + rintro ⟨hx₁, hx₂⟩ + obtain ⟨p₁, hp₁, hu₁⟩ := (hmem_sub hadj₁ hw₁ x).1 hx₁ + obtain ⟨p₂, hp₂, hu₂⟩ := (hmem_sub hadj₂ hw₂ x).1 hx₂ + have hpath₁ : (Walk.cons hadj₁ p₁).IsPath := (Walk.cons_isPath_iff hadj₁ p₁).2 ⟨hp₁, hu₁⟩ + have hpath₂ : (Walk.cons hadj₂ p₂).IsPath := (Walk.cons_isPath_iff hadj₂ p₂).2 ⟨hp₂, hu₂⟩ + have heq : Walk.cons hadj₁ p₁ = Walk.cons hadj₂ p₂ := + congrArg Subtype.val + ((hT.isTree.isAcyclic.subsingleton_path u x).elim ⟨_, hpath₁⟩ ⟨_, hpath₂⟩) + have hsnd := congrArg Walk.snd heq + simp only [Walk.snd_cons] at hsnd + exact hu12 hsnd + refine ⟨?_, hdisj, hu_not₁, hu_not₂⟩ + ext x + simp only [Set.mem_union, Set.mem_singleton_iff] + constructor + · intro hx + by_cases hxu : x = u + · exact Or.inl (Or.inl hxu) + · obtain ⟨p, hp⟩ := hT.isTree.connected.exists_isPath u x + have hw_not : w ∉ p.support := (mem_treeComponent_iff_notMem_support hT.isTree hadj hp).1 hx + cases p with + | nil => exact (hxu rfl).elim + | @cons _ v _ hadj_v p' => + obtain ⟨hp', hu_not_p'⟩ := (Walk.cons_isPath_iff hadj_v p').1 hp + rcases (hiff v).1 hadj_v with rfl | rfl | rfl + · exact (hw_not (List.mem_cons_of_mem u p'.start_mem_support)).elim + · exact Or.inl (Or.inr ((hmem_sub hadj₁ hw₁ x).2 ⟨p', hp', hu_not_p'⟩)) + · exact Or.inr ((hmem_sub hadj₂ hw₂ x).2 ⟨p', hp', hu_not_p'⟩) + · rintro ((rfl | hx₁) | hx₂) + · exact Reachable.rfl + · exact hsub₁ hx₁ + · exact hsub₂ hx₂ + +theorem exists_leaf_in_treeComponent [Fintype ι] {T : SimpleGraph ι} + (hT : IsTernaryTree T) {u w : ι} (hadj : T.Adj u w) : + ∃ t ∈ leafSet T, t ∈ treeComponent T u s(u, w) := by + suffices ∀ n : ℕ, ∀ u w : ι, T.Adj u w → (treeComponent T u s(u, w)).ncard = n → + ∃ t ∈ leafSet T, t ∈ treeComponent T u s(u, w) from + this (treeComponent T u s(u, w)).ncard u w hadj rfl + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro u w hadj hcard + by_cases hleaf : IsLeaf T u + · exact ⟨u, hleaf, Reachable.rfl⟩ + · obtain ⟨u₁, u₂, hw₁, hw₂, hu12, hiff⟩ := hT.exists_other_two_adj hleaf hadj + have hadj₁ : T.Adj u u₁ := (hiff u₁).2 (Or.inr (Or.inl rfl)) + obtain ⟨hcomp_eq, _, hu_not₁, _⟩ := + treeComponent_split_of_not_isLeaf hT hadj hw₁ hw₂ hu12 hiff + have hsub₁ : treeComponent T u₁ s(u₁, u) ⊆ treeComponent T u s(u, w) := by + rw [hcomp_eq] + exact Set.subset_union_of_subset_left Set.subset_union_right _ + have hlt₁ : (treeComponent T u₁ s(u₁, u)).ncard < n := by + rw [← hcard] + refine Set.ncard_lt_ncard ⟨hsub₁, fun h ↦ hu_not₁ (h Reachable.rfl)⟩ (Set.toFinite _) + obtain ⟨t, ht_leaf, ht_mem⟩ := ih _ hlt₁ u₁ u hadj₁.symm rfl + exact ⟨t, ht_leaf, hsub₁ ht_mem⟩ + +theorem IsTernaryTree.two_le_ncard_leafSet [Fintype ι] {T : SimpleGraph ι} + (hT : IsTernaryTree T) : 2 ≤ (leafSet T).ncard := by + classical + obtain ⟨u⟩ := hT.isTree.connected.nonempty + have hex_adj : ∃ w, T.Adj u w := by + by_cases hleaf : IsLeaf T u + · obtain ⟨w, hw, _⟩ := hT.exists_adj_of_isLeaf hleaf + exact ⟨w, hw⟩ + · obtain ⟨w₁, _, _, _, _, _, hiff⟩ := hT.exists_three_adj_of_not_isLeaf hleaf + exact ⟨w₁, (hiff w₁).2 (Or.inl rfl)⟩ + obtain ⟨w, hadj⟩ := hex_adj + obtain ⟨t₁, ht₁_leaf, ht₁_comp⟩ := exists_leaf_in_treeComponent hT hadj + obtain ⟨t₂, ht₂_leaf, ht₂_comp⟩ := exists_leaf_in_treeComponent hT hadj.symm + have hne : t₁ ≠ t₂ := fun h ↦ + (notMem_treeComponent_iff hT.isTree hadj).2 (h ▸ ht₂_comp) ht₁_comp + have hsub : ({t₁, t₂} : Set ι) ⊆ leafSet T := by + rintro x (rfl | rfl) <;> assumption + have hcard : ({t₁, t₂} : Set ι).ncard = 2 := Set.ncard_pair hne + have hle := Set.ncard_le_ncard hsub (Set.toFinite _) + omega + +theorem IsExactTreeLabelling.compl_eq_union_of_degree_three [Fintype ι] {E : Set β} + {κ : Set β → ℤ} {𝒜 : Set (Set β)} {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} + (hα : IsExactTreeLabelling E κ 𝒜 T α) {u : ι} {f f₁ f₂ : Sym2 ι} + (hf : IsTreeIncidence T u f) (hf₁ : IsTreeIncidence T u f₁) (hf₂ : IsTreeIncidence T u f₂) + (hne1 : f ≠ f₁) (hne2 : f ≠ f₂) (hne12 : f₁ ≠ f₂) : + α u f₁ ∪ α u f₂ = E \ α u f ∧ α u f₁ ∩ α u f₂ = ∅ := by + have hunion := hα.isTreeLabelling.degree_three_union_eq hf hf₁ hf₂ hne1 hne2 hne12 + have hdisj1 : α u f ∩ α u f₁ = ∅ := hα.isExactFork ⟨hf, hf₁, hne1⟩ + have hdisj2 : α u f ∩ α u f₂ = ∅ := hα.isExactFork ⟨hf, hf₂, hne2⟩ + have hdisj12 : α u f₁ ∩ α u f₂ = ∅ := hα.isExactFork ⟨hf₁, hf₂, hne12⟩ + refine ⟨?_, hdisj12⟩ + ext x + have hx1 : x ∈ α u f → x ∉ α u f₁ := fun h1 h2 ↦ + Set.notMem_empty x (hdisj1 ▸ ⟨h1, h2⟩) + have hx2 : x ∈ α u f → x ∉ α u f₂ := fun h1 h2 ↦ + Set.notMem_empty x (hdisj2 ▸ ⟨h1, h2⟩) + simp only [Set.mem_union, Set.mem_sdiff] + constructor + · rintro (h | h) + · exact ⟨hunion ▸ Or.inl (Or.inr h), fun hf_mem ↦ hx1 hf_mem h⟩ + · exact ⟨hunion ▸ Or.inr h, fun hf_mem ↦ hx2 hf_mem h⟩ + · rintro ⟨hxE, hnot⟩ + rw [← hunion] at hxE + rcases hxE with (h | h) | h + · exact (hnot h).elim + · exact Or.inl h + · exact Or.inr h + +/-- **Graph Minors X, (3.3)** (page 161): +"Let $(T, \alpha)$ be an exact tree-labelling over $\mathscr{A}$, and let $(u, f)$ be an +incidence in $T$. Let $T_0$ be the component of $T \setminus f$ which contains $u$. Then, as +$(v, e)$ ranges over all incidences of $T$ such that $v$ is a leaf of $T$ and $v \in +V(T_0)$, the sets $E - \alpha(v, e)$ are mutually disjoint and have union $E - \alpha(u, +f)$." -/ +theorem theorem_3_3_proof [Fintype ι] {E : Set β} {κ : Set β → ℤ} {𝒜 : Set (Set β)} + {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} + (hα : IsExactTreeLabelling E κ 𝒜 T α) {u : ι} {f : Sym2 ι} (huf : IsTreeIncidence T u f) : + (leafIncidencesIn T u f).PairwiseDisjoint (fun p ↦ E \ α p.1 p.2) ∧ + (⋃ p ∈ leafIncidencesIn T u f, (E \ α p.1 p.2)) = E \ α u f := by + have hT := hα.isTreeLabelling.isTernaryTree + suffices ∀ n : ℕ, ∀ u : ι, ∀ f : Sym2 ι, IsTreeIncidence T u f → + (treeComponent T u f).ncard = n → + (leafIncidencesIn T u f).PairwiseDisjoint (fun p ↦ E \ α p.1 p.2) ∧ + (⋃ p ∈ leafIncidencesIn T u f, (E \ α p.1 p.2)) = E \ α u f by + exact this (treeComponent T u f).ncard u f huf rfl + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro u f huf hcard + obtain ⟨w, hadj, rfl⟩ := isTreeIncidence_iff_exists_adj.1 huf + by_cases hleaf : IsLeaf T u + · have hcomp := treeComponent_eq_singleton_of_isLeaf hT hadj hleaf + have hset : leafIncidencesIn T u s(u, w) = {(u, s(u, w))} := by + ext ⟨v, e⟩ + change (IsTreeIncidence T v e ∧ IsLeaf T v ∧ v ∈ treeComponent T u s(u, w)) ↔ + (v, e) = (u, s(u, w)) + rw [hcomp, Set.mem_singleton_iff, Prod.mk.injEq] + constructor + · rintro ⟨hve, _, rfl⟩ + refine ⟨rfl, ?_⟩ + obtain ⟨z, hadj_z, rfl⟩ := isTreeIncidence_iff_exists_adj.1 hve + obtain ⟨z₀, _, hz₀⟩ := hT.exists_adj_of_isLeaf hleaf + have : z = w := (hz₀ z hadj_z).trans (hz₀ w hadj).symm + rw [this] + · rintro ⟨rfl, rfl⟩ + exact ⟨huf, hleaf, rfl⟩ + rw [hset] + simp + · obtain ⟨u₁, u₂, hw₁, hw₂, hu12, hiff⟩ := hT.exists_other_two_adj hleaf hadj + have hadj₁ : T.Adj u u₁ := (hiff u₁).2 (Or.inr (Or.inl rfl)) + have hadj₂ : T.Adj u u₂ := (hiff u₂).2 (Or.inr (Or.inr rfl)) + obtain ⟨hcomp_eq, _hcomp_disj, hu_not₁, hu_not₂⟩ := + treeComponent_split_of_not_isLeaf hT hadj hw₁ hw₂ hu12 hiff + let f₁ := s(u₁, u) + let f₂ := s(u₂, u) + have hf₁_inc : IsTreeIncidence T u₁ f₁ := isTreeIncidence_iff_adj.2 hadj₁.symm + have hf₂_inc : IsTreeIncidence T u₂ f₂ := isTreeIncidence_iff_adj.2 hadj₂.symm + have hlt₁ : (treeComponent T u₁ f₁).ncard < n := by + rw [← hcard] + refine Set.ncard_lt_ncard ⟨?_, ?_⟩ (Set.toFinite _) + · rw [hcomp_eq] + exact Set.subset_union_of_subset_left Set.subset_union_right _ + · intro hsub + have hu_mem : u ∈ treeComponent T u s(u, w) := Reachable.rfl + exact hu_not₁ (hsub hu_mem) + have hlt₂ : (treeComponent T u₂ f₂).ncard < n := by + rw [← hcard] + refine Set.ncard_lt_ncard ⟨?_, ?_⟩ (Set.toFinite _) + · rw [hcomp_eq] + exact Set.subset_union_right + · intro hsub + have hu_mem : u ∈ treeComponent T u s(u, w) := Reachable.rfl + exact hu_not₂ (hsub hu_mem) + obtain ⟨hdisj₁, hunion₁⟩ := ih _ hlt₁ u₁ f₁ hf₁_inc rfl + obtain ⟨hdisj₂, hunion₂⟩ := ih _ hlt₂ u₂ f₂ hf₂_inc rfl + have hleaf_union : + leafIncidencesIn T u s(u, w) = + leafIncidencesIn T u₁ f₁ ∪ leafIncidencesIn T u₂ f₂ := by + ext ⟨v, e⟩ + change (IsTreeIncidence T v e ∧ IsLeaf T v ∧ v ∈ treeComponent T u s(u, w)) ↔ + (IsTreeIncidence T v e ∧ IsLeaf T v ∧ v ∈ treeComponent T u₁ f₁) ∨ + (IsTreeIncidence T v e ∧ IsLeaf T v ∧ v ∈ treeComponent T u₂ f₂) + rw [hcomp_eq] + simp only [Set.mem_union, Set.mem_singleton_iff] + constructor + · rintro ⟨hve, hv_leaf, (rfl | hv₁) | hv₂⟩ + · exact (hleaf hv_leaf).elim + · exact Or.inl ⟨hve, hv_leaf, hv₁⟩ + · exact Or.inr ⟨hve, hv_leaf, hv₂⟩ + · rintro (⟨hve, hv_leaf, hv₁⟩ | ⟨hve, hv_leaf, hv₂⟩) + · exact ⟨hve, hv_leaf, Or.inl (Or.inr hv₁)⟩ + · exact ⟨hve, hv_leaf, Or.inr hv₂⟩ + have hf₁_u : IsTreeIncidence T u f₁ := isTreeIncidence_symm hadj₁.symm + have hf₂_u : IsTreeIncidence T u f₂ := isTreeIncidence_symm hadj₂.symm + have hne_f1 : s(u, w) ≠ f₁ := by + rw [show f₁ = s(u, u₁) from Sym2.eq_swap] + exact sym2_mk_eq_left_iff.not.2 hw₁ + have hne_f2 : s(u, w) ≠ f₂ := by + rw [show f₂ = s(u, u₂) from Sym2.eq_swap] + exact sym2_mk_eq_left_iff.not.2 hw₂ + have hne_12 : f₁ ≠ f₂ := by + rw [show f₁ = s(u, u₁) from Sym2.eq_swap, show f₂ = s(u, u₂) from Sym2.eq_swap] + exact sym2_mk_eq_left_iff.not.2 hu12 + obtain ⟨hu_union, hu_inter⟩ := + hα.compl_eq_union_of_degree_three huf hf₁_u hf₂_u hne_f1 hne_f2 hne_12 + have hcompl₁ : E \ α u₁ f₁ = α u f₁ := by + rw [hα.isTreeLabelling.compl_eq hadj₁.symm, + Set.sdiff_sdiff_cancel_left (hα.isTreeLabelling.subset_of_inc hf₁_u)] + have hcompl₂ : E \ α u₂ f₂ = α u f₂ := by + rw [hα.isTreeLabelling.compl_eq hadj₂.symm, + Set.sdiff_sdiff_cancel_left (hα.isTreeLabelling.subset_of_inc hf₂_u)] + rw [hleaf_union] + refine ⟨?_, ?_⟩ + · intro p₁ hp₁ p₂ hp₂ hp_ne + have hcross : ∀ (q₁ q₂ : ι × Sym2 ι), + q₁ ∈ leafIncidencesIn T u₁ f₁ → q₂ ∈ leafIncidencesIn T u₂ f₂ → + Disjoint (E \ α q₁.1 q₁.2) (E \ α q₂.1 q₂.2) := by + intro q₁ q₂ hq₁ hq₂ + have hsub₁ : E \ α q₁.1 q₁.2 ⊆ α u f₁ := by + rw [← hcompl₁, ← hunion₁] + exact Set.subset_biUnion_of_mem (u := fun p : ι × Sym2 ι ↦ E \ α p.1 p.2) hq₁ + have hsub₂ : E \ α q₂.1 q₂.2 ⊆ α u f₂ := by + rw [← hcompl₂, ← hunion₂] + exact Set.subset_biUnion_of_mem (u := fun p : ι × Sym2 ι ↦ E \ α p.1 p.2) hq₂ + exact Set.disjoint_iff_inter_eq_empty.2 + (Set.Subset.antisymm + ((Set.inter_subset_inter hsub₁ hsub₂).trans hu_inter.subset) + (Set.empty_subset _)) + rcases hp₁ with hp₁ | hp₁ <;> rcases hp₂ with hp₂ | hp₂ + · exact hdisj₁ hp₁ hp₂ hp_ne + · exact hcross p₁ p₂ hp₁ hp₂ + · exact (hcross p₂ p₁ hp₂ hp₁).symm + · exact hdisj₂ hp₁ hp₂ hp_ne + · rw [Set.biUnion_union, hunion₁, hunion₂, hcompl₁, hcompl₂, hu_union] + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/SubmodularTree.lean b/LeanPool/GraphMinor/GM10/SubmodularTree.lean new file mode 100644 index 0000000000..cb694d7cb4 --- /dev/null +++ b/LeanPool/GraphMinor/GM10/SubmodularTree.lean @@ -0,0 +1,1187 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.SubmodularBasic +import Mathlib.Combinatorics.SimpleGraph.Acyclic + +/-! +# Tree Constructions for Submodular Labellings: Graph Minors X, Section 3 + +This file provides the tree constructions used in the proofs of `(3.4)` and `(3.6)` of +Robertson and Seymour, *Graph Minors. X. Obstructions to tree-decomposition*, +J. Combin. Theory Ser. B 52 (1991) 153–190 (pages 162–164): +- Local neighborhood equivalences (`NeighborEquiv`) transferring degree, leaf status, degree-3 + union, and fork exactness between tree-labellings. +- Base-case trees on `Fin 2` and `Fin 4` for `(3.4)`. +- Splicing a tree `S = T₁ \ t₀` onto a bad leaf `t₁` of `T₂` for the inductive step of `(3.4)`. +- Suppressing a leaf `v₀` with `α(v₀, e₀) = E` and its degree-3 neighbor `v` for `(3.6)`. +-/ + +public section + +namespace GraphMinor.GM10 + +open SimpleGraph + +variable {β : Type*} {ι ι' : Type*} + +/-! ## Local neighborhood equivalences -/ + +/-- Given an equivalence between the neighbors of `u'` in `T'` and the neighbors of `u` in `T`, +their degrees are equal. -/ +theorem degree_eq_of_neighborEquiv [Fintype ι'] [Fintype ι] + {T' : SimpleGraph ι'} {T : SimpleGraph ι} {u' : ι'} {u : ι} + (e : {w' // T'.Adj u' w'} ≃ {w // T.Adj u w}) : + by classical exact T'.degree u' = T.degree u := by + classical + rw [← card_neighborSet_eq_degree, ← card_neighborSet_eq_degree] + exact Fintype.card_congr e + +/-- Given an equivalence between the neighbors of `u'` in `T'` and the neighbors of `u` in `T`, +`u'` is a leaf of `T'` if and only if `u` is a leaf of `T`. -/ +theorem isLeaf_iff_of_neighborEquiv [Fintype ι'] [Fintype ι] + {T' : SimpleGraph ι'} {T : SimpleGraph ι} {u' : ι'} {u : ι} + (e : {w' // T'.Adj u' w'} ≃ {w // T.Adj u w}) : + IsLeaf T' u' ↔ IsLeaf T u := by + classical + simp only [IsLeaf, degree_eq_of_neighborEquiv e] + +/-- Transfer the degree-3 union property along a neighbor equivalence where each label at `u'` +contains the corresponding label at `u`. -/ +theorem degree_three_union_eq_of_neighborEquiv [Fintype ι] + {E : Set β} {κ : Set β → ℤ} {𝒜 : Set (Set β)} + {T' : SimpleGraph ι'} {T : SimpleGraph ι} + {α' : ι' → Sym2 ι' → Set β} {α : ι → Sym2 ι → Set β} + (hα : IsTreeLabelling E κ 𝒜 T α) {u' : ι'} {u : ι} + (e : {w' // T'.Adj u' w'} ≃ {w // T.Adj u w}) + (hsub : ∀ w' (hw' : T'.Adj u' w'), α u s(u, (e ⟨w', hw'⟩).1) ⊆ α' u' s(u', w')) + (hsubE : ∀ w' (_hw' : T'.Adj u' w'), α' u' s(u', w') ⊆ E) + {f₁' f₂' f₃' : Sym2 ι'} + (hf₁' : IsTreeIncidence T' u' f₁') (hf₂' : IsTreeIncidence T' u' f₂') + (hf₃' : IsTreeIncidence T' u' f₃') + (h12' : f₁' ≠ f₂') (h13' : f₁' ≠ f₃') (h23' : f₂' ≠ f₃') : + α' u' f₁' ∪ α' u' f₂' ∪ α' u' f₃' = E := by + obtain ⟨w₁', hw₁', rfl⟩ := isTreeIncidence_iff_exists_adj.1 hf₁' + obtain ⟨w₂', hw₂', rfl⟩ := isTreeIncidence_iff_exists_adj.1 hf₂' + obtain ⟨w₃', hw₃', rfl⟩ := isTreeIncidence_iff_exists_adj.1 hf₃' + have hne12 : w₁' ≠ w₂' := fun h ↦ h12' (by rw [h]) + have hne13 : w₁' ≠ w₃' := fun h ↦ h13' (by rw [h]) + have hne23 : w₂' ≠ w₃' := fun h ↦ h23' (by rw [h]) + let w₁ := e ⟨w₁', hw₁'⟩ + let w₂ := e ⟨w₂', hw₂'⟩ + let w₃ := e ⟨w₃', hw₃'⟩ + have hw12 : w₁.1 ≠ w₂.1 := fun h ↦ hne12 (Subtype.ext_iff.1 (e.injective (Subtype.ext h))) + have hw13 : w₁.1 ≠ w₃.1 := fun h ↦ hne13 (Subtype.ext_iff.1 (e.injective (Subtype.ext h))) + have hw23 : w₂.1 ≠ w₃.1 := fun h ↦ hne23 (Subtype.ext_iff.1 (e.injective (Subtype.ext h))) + have hf₁ : IsTreeIncidence T u s(u, w₁.1) := isTreeIncidence_iff_adj.2 w₁.2 + have hf₂ : IsTreeIncidence T u s(u, w₂.1) := isTreeIncidence_iff_adj.2 w₂.2 + have hf₃ : IsTreeIncidence T u s(u, w₃.1) := isTreeIncidence_iff_adj.2 w₃.2 + have he12 : s(u, w₁.1) ≠ s(u, w₂.1) := sym2_mk_eq_left_iff.not.2 hw12 + have he13 : s(u, w₁.1) ≠ s(u, w₃.1) := sym2_mk_eq_left_iff.not.2 hw13 + have he23 : s(u, w₂.1) ≠ s(u, w₃.1) := sym2_mk_eq_left_iff.not.2 hw23 + have hunion := hα.degree_three_union_eq hf₁ hf₂ hf₃ he12 he13 he23 + refine Set.Subset.antisymm + (Set.union_subset (Set.union_subset (hsubE w₁' hw₁') (hsubE w₂' hw₂')) (hsubE w₃' hw₃')) ?_ + intro x hx + rw [← hunion] at hx + rcases hx with (hx | hx) | hx + · exact Or.inl (Or.inl (hsub w₁' hw₁' hx)) + · exact Or.inl (Or.inr (hsub w₂' hw₂' hx)) + · exact Or.inr (hsub w₃' hw₃' hx) + +/-- Transfer fork exactness along a neighbor equivalence preserving edge labels. -/ +theorem isExactFork_of_neighborEquiv + {T' : SimpleGraph ι'} {T : SimpleGraph ι} + {α' : ι' → Sym2 ι' → Set β} {α : ι → Sym2 ι → Set β} + {u' : ι'} {u : ι} + (e : {w' // T'.Adj u' w'} ≃ {w // T.Adj u w}) + (heq : ∀ w' (hw' : T'.Adj u' w'), α' u' s(u', w') = α u s(u, (e ⟨w', hw'⟩).1)) + (hex : ∀ ⦃f₁ f₂ : Sym2 ι⦄, IsFork T u f₁ f₂ → IsExactFork α u f₁ f₂) + {f₁' f₂' : Sym2 ι'} (hf' : IsFork T' u' f₁' f₂') : + IsExactFork α' u' f₁' f₂' := by + obtain ⟨w₁', hw₁', rfl⟩ := isTreeIncidence_iff_exists_adj.1 hf'.1 + obtain ⟨w₂', hw₂', rfl⟩ := isTreeIncidence_iff_exists_adj.1 hf'.2.1 + have hne : w₁' ≠ w₂' := fun h ↦ hf'.2.2 (by rw [h]) + let w₁ := e ⟨w₁', hw₁'⟩ + let w₂ := e ⟨w₂', hw₂'⟩ + have hw12 : w₁.1 ≠ w₂.1 := fun h ↦ hne (Subtype.ext_iff.1 (e.injective (Subtype.ext h))) + have hf : IsFork T u s(u, w₁.1) s(u, w₂.1) := + ⟨isTreeIncidence_iff_adj.2 w₁.2, isTreeIncidence_iff_adj.2 w₂.2, + sym2_mk_eq_left_iff.not.2 hw12⟩ + dsimp [IsExactFork] + rw [heq w₁' hw₁', heq w₂' hw₂'] + exact hex hf + +/-! ## Base-case trees on `Fin 2` and `Fin 4` for (3.4) -/ + +private theorem degree_eq_degree {V : Type*} (G : SimpleGraph V) (v : V) + (inst₁ inst₂ : Fintype (G.neighborSet v)) : + @SimpleGraph.degree V G v inst₁ = @SimpleGraph.degree V G v inst₂ := + Subsingleton.elim inst₁ inst₂ ▸ rfl + +/-- A 2-vertex tree-labelling when `E = ∅` and `∅` is efficient +(Graph Minors X, Section 3, proof of (3.4), page 162). -/ +theorem exists_isTreeLabelling_of_empty {E : Set β} {κ : Set β → ℤ} {𝒜 : Set (Set β)} + (hE : E = ∅) (heff : IsEfficient E κ ∅) : + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (α : ι → Sym2 ι → Set β), + IsTreeLabelling E κ 𝒜 T α := by + let T : SimpleGraph (Fin 2) := ⊤ + let α : Fin 2 → Sym2 (Fin 2) → Set β := fun _ _ ↦ ∅ + have hcard : Nat.card T.edgeSet + 1 = Nat.card (Fin 2) := by + rw [Nat.card_eq_fintype_card, Nat.card_eq_fintype_card, ← T.edgeFinset_card] + decide + have hT_tree : T.IsTree := isTree_iff_connected_and_card.2 ⟨connected_top, hcard⟩ + have hT : IsTernaryTree T := by + refine ⟨hT_tree, fun v ↦ Or.inl ?_⟩ + rw [degree_eq_degree T v _ inferInstance] + fin_cases v <;> decide + refine ⟨Fin 2, inferInstance, T, α, hT, ?_, ?_, ?_, ?_⟩ + · intro _ _ _ + exact heff + · intro u v _ + simp [α, hE] + · intro v e _ _ + left + simp [α, hE] + · intro v e₁ e₂ e₃ _ _ _ _ _ _ + simp [α, hE] + +/-- The 4-vertex star graph with center `0 : Fin 4` and leaves `1, 2, 3 : Fin 4` +(Graph Minors X, Section 3, proof of (3.4), page 162). -/ +def starFourGraph : SimpleGraph (Fin 4) where + Adj u v := (u = 0 ∧ v ≠ 0) ∨ (v = 0 ∧ u ≠ 0) + symm := ⟨by + rintro _ _ (h | h) + · exact Or.inr h + · exact Or.inl h⟩ + loopless := ⟨fun _ h ↦ by rcases h with ⟨rfl, h⟩ | ⟨rfl, h⟩ <;> exact h rfl⟩ + +instance : DecidableRel starFourGraph.Adj := fun u v ↦ + inferInstanceAs (Decidable ((u = 0 ∧ v ≠ 0) ∨ (v = 0 ∧ u ≠ 0))) + +theorem isTernaryTree_starFourGraph : IsTernaryTree starFourGraph := by + have hconn : starFourGraph.Connected := by + refine Connected.mk fun u v ↦ ?_ + have h0 : ∀ x : Fin 4, starFourGraph.Reachable 0 x := by + intro x + by_cases hx : x = 0 + · subst hx; exact Reachable.rfl + · exact Adj.reachable (Or.inl ⟨rfl, hx⟩) + exact (h0 u).symm.trans (h0 v) + have hcard : Nat.card starFourGraph.edgeSet + 1 = Nat.card (Fin 4) := by + rw [Nat.card_eq_fintype_card, Nat.card_eq_fintype_card, ← starFourGraph.edgeFinset_card] + decide + refine ⟨isTree_iff_connected_and_card.2 ⟨hconn, hcard⟩, fun v ↦ ?_⟩ + rw [degree_eq_degree starFourGraph v _ inferInstance] + fin_cases v <;> decide + +/-- The 4-vertex tree-labelling when there are three efficient sets `X₁, X₂, X₃` with +`X₁ ∪ X₂ ∪ X₃ = E`, each a subset of a member of `𝒜` +(Graph Minors X, Section 3, proof of (3.4), page 162). -/ +theorem exists_isTreeLabelling_of_three_sets {E : Set β} {κ : Set β → ℤ} {𝒜 : Set (Set β)} + (hκ : IsConnectivityFunction E κ) (h𝒜 : ∀ A ∈ 𝒜, IsEfficient E κ A) + {X₁ X₂ X₃ : Set β} + (heff₁ : IsEfficient E κ X₁) (heff₂ : IsEfficient E κ X₂) (heff₃ : IsEfficient E κ X₃) + (hsub₁ : ∃ A ∈ 𝒜, X₁ ⊆ A) (hsub₂ : ∃ A ∈ 𝒜, X₂ ⊆ A) (hsub₃ : ∃ A ∈ 𝒜, X₃ ⊆ A) + (hunion : X₁ ∪ X₂ ∪ X₃ = E) : + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (α : ι → Sym2 ι → Set β), + IsTreeLabelling E κ 𝒜 T α := by + let X : Fin 4 → Set β := fun i ↦ + if i = 1 then X₁ else if i = 2 then X₂ else if i = 3 then X₃ else ∅ + have hX_eff : ∀ i : Fin 4, i ≠ 0 → IsEfficient E κ (X i) := by + intro i hi + fin_cases i + · exact (hi rfl).elim + · exact heff₁ + · exact heff₂ + · exact heff₃ + have hX_sub : ∀ i : Fin 4, i ≠ 0 → ∃ A ∈ 𝒜, X i ⊆ A := by + intro i hi + fin_cases i + · exact (hi rfl).elim + · exact hsub₁ + · exact hsub₂ + · exact hsub₃ + let α : Fin 4 → Sym2 (Fin 4) → Set β := fun v e ↦ + if v = 0 then + if e = s(0, 1) then X₁ else if e = s(0, 2) then X₂ else X₃ + else + E \ X v + have hα0 : ∀ i : Fin 4, i ≠ 0 → α 0 s(0, i) = X i := by + intro i hi + fin_cases i + · exact (hi rfl).elim + · simp [α, X] + · simp [α, X] + · simp [α, X] + refine ⟨Fin 4, inferInstance, starFourGraph, α, isTernaryTree_starFourGraph, ?_, ?_, ?_, ?_⟩ + · intro v e hinc + obtain ⟨w, hadj, rfl⟩ := isTreeIncidence_iff_exists_adj.1 hinc + rcases hadj with ⟨rfl, hw⟩ | ⟨rfl, hv⟩ + · rw [hα0 w hw] + exact hX_eff w hw + · have : α v s(v, 0) = E \ X v := by simp [α, hv] + rw [this] + exact (hX_eff v hv).compl hκ + · intro u v hadj + rcases hadj with ⟨rfl, hv⟩ | ⟨rfl, hu⟩ + · have h1 : α 0 s(0, v) = X v := hα0 v hv + have h2 : α v s(0, v) = E \ X v := by simp [α, hv] + rw [h1, h2, Set.sdiff_sdiff_cancel_left (hX_eff v hv).1] + · have h1 : α u s(u, 0) = E \ X u := by simp [α, hu] + have h2 : α 0 s(u, 0) = X u := by + rw [Sym2.eq_swap] + exact hα0 u hu + rw [h1, h2] + · intro v e hinc hleaf + have hv0 : v ≠ 0 := by + rintro rfl + have hdeg3 : starFourGraph.degree (0 : Fin 4) = 3 := by decide + dsimp [IsLeaf] at hleaf + rw [degree_eq_degree starFourGraph 0 _ inferInstance] at hleaf + omega + have hαv : α v e = E \ X v := by simp [α, hv0] + obtain ⟨A, hA_mem, hXA⟩ := hX_sub v hv0 + right + refine ⟨A, hA_mem, ?_⟩ + rw [hαv] + refine Set.Subset.antisymm (Set.union_subset Set.sdiff_subset (h𝒜 A hA_mem).1) ?_ + intro y hy + by_cases hyX : y ∈ X v + · exact Or.inr (hXA hyX) + · exact Or.inl ⟨hy, hyX⟩ + · intro v e₁ e₂ e₃ h₁ h₂ h₃ h12 h13 h23 + have hv0 : v = 0 := by + by_contra hv0 + obtain ⟨w₁, hw₁, rfl⟩ := isTreeIncidence_iff_exists_adj.1 h₁ + obtain ⟨w₂, hw₂, rfl⟩ := isTreeIncidence_iff_exists_adj.1 h₂ + have hw₁0 : w₁ = 0 := by + rcases hw₁ with ⟨h, _⟩ | ⟨h, _⟩ + · exact (hv0 h).elim + · exact h + have hw₂0 : w₂ = 0 := by + rcases hw₂ with ⟨h, _⟩ | ⟨h, _⟩ + · exact (hv0 h).elim + · exact h + exact h12 (by rw [hw₁0, hw₂0]) + subst hv0 + obtain ⟨w₁, hw₁, rfl⟩ := isTreeIncidence_iff_exists_adj.1 h₁ + obtain ⟨w₂, hw₂, rfl⟩ := isTreeIncidence_iff_exists_adj.1 h₂ + obtain ⟨w₃, hw₃, rfl⟩ := isTreeIncidence_iff_exists_adj.1 h₃ + have hw₁_ne : w₁ ≠ 0 := by + rcases hw₁ with ⟨_, h⟩ | ⟨_, h⟩ + · exact h + · exact (h rfl).elim + have hw₂_ne : w₂ ≠ 0 := by + rcases hw₂ with ⟨_, h⟩ | ⟨_, h⟩ + · exact h + · exact (h rfl).elim + have hw₃_ne : w₃ ≠ 0 := by + rcases hw₃ with ⟨_, h⟩ | ⟨_, h⟩ + · exact h + · exact (h rfl).elim + have hne12 : w₁ ≠ w₂ := fun h ↦ h12 (by rw [h]) + have hne13 : w₁ ≠ w₃ := fun h ↦ h13 (by rw [h]) + have hne23 : w₂ ≠ w₃ := fun h ↦ h23 (by rw [h]) + rw [hα0 w₁ hw₁_ne, hα0 w₂ hw₂_ne, hα0 w₃ hw₃_ne] + have hmem_123 : ∀ w : Fin 4, w ≠ 0 → w ∈ ({1, 2, 3} : Finset (Fin 4)) := by + intro w hw + fin_cases w + · exact (hw rfl).elim + · decide + · decide + · decide + have hset : ({w₁, w₂, w₃} : Finset (Fin 4)) = {1, 2, 3} := by + have hsub : ({w₁, w₂, w₃} : Finset (Fin 4)) ⊆ {1, 2, 3} := by + intro z hz + simp only [Finset.mem_insert, Finset.mem_singleton] at hz + rcases hz with h | h | h + · rw [h]; exact hmem_123 w₁ hw₁_ne + · rw [h]; exact hmem_123 w₂ hw₂_ne + · rw [h]; exact hmem_123 w₃ hw₃_ne + have hcard : ({w₁, w₂, w₃} : Finset (Fin 4)).card = 3 := by + rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_singleton] <;> + simp [hne12, hne13, hne23] + exact Finset.eq_of_subset_of_card_le hsub (by rw [hcard]; decide) + have h1_mem : (1 : Fin 4) ∈ ({w₁, w₂, w₃} : Finset (Fin 4)) := by rw [hset]; decide + have h2_mem : (2 : Fin 4) ∈ ({w₁, w₂, w₃} : Finset (Fin 4)) := by rw [hset]; decide + have h3_mem : (3 : Fin 4) ∈ ({w₁, w₂, w₃} : Finset (Fin 4)) := by rw [hset]; decide + refine Set.Subset.antisymm + (Set.union_subset (Set.union_subset (hX_eff w₁ hw₁_ne).1 (hX_eff w₂ hw₂_ne).1) + (hX_eff w₃ hw₃_ne).1) ?_ + rw [← hunion] + have hsub_i : ∀ i : Fin 4, i ∈ ({w₁, w₂, w₃} : Finset (Fin 4)) → + X i ⊆ X w₁ ∪ X w₂ ∪ X w₃ := by + intro i hi + simp only [Finset.mem_insert, Finset.mem_singleton] at hi + rcases hi with rfl | rfl | rfl + · exact Set.subset_union_of_subset_left Set.subset_union_left _ + · exact Set.subset_union_of_subset_left Set.subset_union_right _ + · exact Set.subset_union_right + exact Set.union_subset (Set.union_subset (hsub_i 1 h1_mem) (hsub_i 2 h2_mem)) + (hsub_i 3 h3_mem) + +/-! ## Vertex-leaf suppression for (3.6) -/ + +private abbrev PrunedVertices (v₀ v : ι) := {u : ι // u ≠ v₀ ∧ u ≠ v} + +/-- Paths in the original tree reach the new bridging edge after deleting the leaf and its +neighbor. -/ +private theorem prunedTree_connected {T : SimpleGraph ι} (hT : T.IsTree) + {v₀ v v₁ v₂ : ι} (hv₀_adj_iff : ∀ x, T.Adj v₀ x ↔ x = v) + (hv_adj_iff : ∀ x, T.Adj v x ↔ x = v₀ ∨ x = v₁ ∨ x = v₂) + (h₁ : v₁ ≠ v₀ ∧ v₁ ≠ v) (h₂ : v₂ ≠ v₀ ∧ v₂ ≠ v) + {T' : SimpleGraph (PrunedVertices v₀ v)} + (hsub : T.induce {u | u ≠ v₀ ∧ u ≠ v} ≤ T') + (hbridge : T'.Adj ⟨v₂, h₂⟩ ⟨v₁, h₁⟩) : T'.Connected := by + classical + let S : Set ι := {u | u ≠ v₀ ∧ u ≠ v} + let v₁' : S := ⟨v₁, h₁⟩ + let v₂' : S := ⟨v₂, h₂⟩ + let G₀ : SimpleGraph S := T.induce S + have : Nonempty S := ⟨v₁'⟩ + refine Connected.mk fun u' w' ↦ ?_ + suffices ∀ x' : S, T'.Reachable x' v₁' from (this u').trans (this w').symm + intro x' + obtain ⟨p, hp⟩ := hT.connected.exists_isPath x'.1 v + have hnot_nil : ¬ p.Nil := Walk.not_nil_of_ne x'.2.2 + let z := p.penultimate + have hadj_z : T.Adj z v := p.adj_penultimate hnot_nil + let q : T.Walk x'.1 z := p.dropLast + have hp_supp : q.support ++ [v] = p.support := p.support_dropLast_concat hnot_nil + have hnodup : (q.support ++ [v]).Nodup := hp_supp.symm ▸ hp.support_nodup + have hv_not_q : v ∉ q.support := fun hv_q ↦ + List.disjoint_of_nodup_append hnodup hv_q (List.mem_singleton_self v) + have hv₀_not_q : v₀ ∉ q.support := by + intro hv₀_q + let q₁ := q.takeUntil v₀ hv₀_q + have hq₁_not_nil : ¬ q₁.Nil := Walk.not_nil_of_ne x'.2.1 + have hadj_pen : T.Adj q₁.penultimate v₀ := q₁.adj_penultimate hq₁_not_nil + have hpen_eq_v : q₁.penultimate = v := (hv₀_adj_iff _).1 hadj_pen.symm + have hv_in_q₁ : v ∈ q₁.support := hpen_eq_v ▸ q₁.getVert_mem_support (q₁.length - 1) + exact hv_not_q (q.support_takeUntil_subset_support hv₀_q hv_in_q₁) + have hq_in_S : ∀ y ∈ q.support, y ∈ S := by + intro y hy + refine ⟨?_, ?_⟩ + · rintro rfl; exact hv₀_not_q hy + · rintro rfl; exact hv_not_q hy + rcases (hv_adj_iff z).1 hadj_z.symm with hzv₀ | hzv₁ | hzv₂ + · exact (hv₀_not_q (hzv₀ ▸ q.end_mem_support)).elim + · have hreach_G₀ : G₀.Reachable x' v₁' := + ⟨(q.induce S hq_in_S).copy (Subtype.ext rfl) (Subtype.ext hzv₁)⟩ + exact hreach_G₀.mono hsub + · have hreach_G₀ : G₀.Reachable x' v₂' := + ⟨(q.induce S hq_in_S).copy (Subtype.ext rfl) (Subtype.ext hzv₂)⟩ + exact (hreach_G₀.mono hsub).trans hbridge.reachable + +private noncomputable def restoredNeighbor {v₀ v : ι} + (v₁' v₂' u' w' : PrunedVertices v₀ v) : ι := by + classical + exact if (u' = v₁' ∧ w' = v₂') ∨ (u' = v₂' ∧ w' = v₁') then v else w'.1 + +/-- The new bridge restores the deleted middle vertex at either of its endpoints. -/ +private noncomputable def prunedTree_neighborEquiv {T : SimpleGraph ι} {v₀ v v₁ v₂ : ι} + (hv₀_adj_iff : ∀ x, T.Adj v₀ x ↔ x = v) + (hv_adj_iff : ∀ x, T.Adj v x ↔ x = v₀ ∨ x = v₁ ∨ x = v₂) + (hadj₁ : T.Adj v v₁) (hadj₂ : T.Adj v v₂) (hnot_adj12 : ¬ T.Adj v₁ v₂) + (h₁ : v₁ ≠ v₀ ∧ v₁ ≠ v) (h₂ : v₂ ≠ v₀ ∧ v₂ ≠ v) + (hv12' : v₁ ≠ v₂) {T' : SimpleGraph (PrunedVertices v₀ v)} + (hadj_T'_iff : ∀ u' w' : PrunedVertices v₀ v, + T'.Adj u' w' ↔ T.Adj u'.1 w'.1 ∨ + (u'.1 = v₁ ∧ w'.1 = v₂) ∨ (u'.1 = v₂ ∧ w'.1 = v₁)) : + ∀ u' : PrunedVertices v₀ v, {w' // T'.Adj u' w'} ≃ {w // T.Adj u'.1 w} := by + classical + let S := PrunedVertices v₀ v + let v₁' : S := ⟨v₁, h₁⟩ + let v₂' : S := ⟨v₂, h₂⟩ + have hv12'' : v₁' ≠ v₂' := fun heq => hv12' (congrArg Subtype.val heq) + let origNeighbor := restoredNeighbor v₁' v₂' + have hadj_iff (u' w' : S) : + T'.Adj u' w' ↔ T.Adj u'.1 w'.1 ∨ + (u' = v₁' ∧ w' = v₂') ∨ (u' = v₂' ∧ w' = v₁') := by + have hleft (x : S) : x.1 = v₁ ↔ x = v₁' := + ⟨fun h => Subtype.ext h, fun h => congrArg Subtype.val h⟩ + have hright (x : S) : x.1 = v₂ ↔ x = v₂' := + ⟨fun h => Subtype.ext h, fun h => congrArg Subtype.val h⟩ + simpa only [hleft, hright] using hadj_T'_iff u' w' + let invNeighbor (u' : S) (w : ι) : S := + if hw : w ≠ v₀ ∧ w ≠ v then ⟨w, hw⟩ else if u' = v₁' then v₂' else v₁' + have horig_adj : ∀ (u' w' : S), T'.Adj u' w' → T.Adj u'.1 (origNeighbor u' w') := by + intro u' w' hw' + dsimp [origNeighbor, restoredNeighbor] + split_ifs with h + · rcases h with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hadj₁.symm + · exact hadj₂.symm + · rcases (hadj_iff u' w').1 hw' with hadj | h1 | h2 + · exact hadj + · exact (h (Or.inl h1)).elim + · exact (h (Or.inr h2)).elim + have hinv_adj : ∀ (u' : S) (w : ι), T.Adj u'.1 w → T'.Adj u' (invNeighbor u' w) := by + intro u' w hw + dsimp [invNeighbor] + split_ifs with hwS hu1 + · exact (hadj_iff _ _).2 (Or.inl hw) + · exact (hadj_iff _ _).2 (Or.inr (Or.inl ⟨hu1, rfl⟩)) + · have hwv : w = v := by + by_contra hne_v + apply hwS + refine ⟨?_, hne_v⟩ + rintro rfl + exact u'.2.2 ((hv₀_adj_iff u'.1).1 hw.symm) + subst hwv + refine (hadj_iff _ _).2 (Or.inr (Or.inr ⟨?_, rfl⟩)) + rcases (hv_adj_iff u'.1).1 hw.symm with h0 | h1 | h2 + · exact (u'.2.1 h0).elim + · exact (hu1 (Subtype.ext h1)).elim + · exact Subtype.ext h2 + intro u' + exact + { toFun := fun ⟨w', hw'⟩ ↦ ⟨origNeighbor u' w', horig_adj u' w' hw'⟩ + invFun := fun ⟨w, hw⟩ ↦ ⟨invNeighbor u' w, hinv_adj u' w hw⟩ + left_inv := by + rintro ⟨w', hw'⟩ + ext + dsimp [origNeighbor, restoredNeighbor, invNeighbor] + by_cases hpair : (u' = v₁' ∧ w' = v₂') ∨ (u' = v₂' ∧ w' = v₁') + · rcases hpair with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · simp + · simp [hv12''.symm] + · simp [hpair, w'.2.1, w'.2.2] + right_inv := by + rintro ⟨w, hw⟩ + ext + dsimp [origNeighbor, restoredNeighbor, invNeighbor] + by_cases hwS : w ≠ v₀ ∧ w ≠ v + · have hnot_pair : ¬ ((u' = v₁' ∧ (⟨w, hwS⟩ : S) = v₂') ∨ + (u' = v₂' ∧ (⟨w, hwS⟩ : S) = v₁')) := by + rintro (⟨rfl, heq⟩ | ⟨rfl, heq⟩) + · have : w = v₂ := congrArg Subtype.val heq + subst this + exact hnot_adj12 hw + · have : w = v₁ := congrArg Subtype.val heq + subst this + exact hnot_adj12 hw.symm + simp [hwS, hnot_pair] + · have hwv : w = v := by + by_contra hne_v + apply hwS + refine ⟨?_, hne_v⟩ + rintro rfl + exact u'.2.2 ((hv₀_adj_iff u'.1).1 hw.symm) + subst hwv + by_cases hu1 : u' = v₁' + · subst hu1; simp + · have hu2 : u' = v₂' := by + rcases (hv_adj_iff u'.1).1 hw.symm with h0 | h1 | h2 + · exact (u'.2.1 h0).elim + · exact (hu1 (Subtype.ext h1)).elim + · exact Subtype.ext h2 + subst hu2 + simp [hv12''.symm] } + +/-- Suppressing a leaf `v₀` with `α(v₀, e₀) = E` and its degree-3 neighbor `v` in an exact +tree-labelling produces an exact tree-labelling on a strictly smaller vertex type +(Graph Minors X, Section 3, proof of (3.6), pages 163–164). -/ +theorem exists_smaller_exactTreeLabelling_of_leaf_eq [Fintype ι] + {E : Set β} {κ : Set β → ℤ} {𝒜 : Set (Set β)} + {T : SimpleGraph ι} {α : ι → Sym2 ι → Set β} + (hα : IsExactTreeLabelling E κ 𝒜 T α) + {v₀ v : ι} (hleaf₀ : IsLeaf T v₀) (hadj₀ : T.Adj v₀ v) + (hα_v₀ : α v₀ s(v₀, v) = E) (hv_not_leaf : ¬ IsLeaf T v) : + ∃ (ι' : Type) (_ : Fintype ι') (T' : SimpleGraph ι') (α' : ι' → Sym2 ι' → Set β), + Fintype.card ι' < Fintype.card ι ∧ IsExactTreeLabelling E κ 𝒜 T' α' := by + classical + have hT := hα.isTreeLabelling.isTernaryTree + have hne_v₀v : v₀ ≠ v := hadj₀.ne + obtain ⟨_, _, hv₀_uniq⟩ := hT.exists_adj_of_isLeaf hleaf₀ + have hv₀_adj_iff : ∀ x, T.Adj v₀ x ↔ x = v := + fun x ↦ ⟨fun hx ↦ (hv₀_uniq x hx).trans (hv₀_uniq v hadj₀).symm, fun hx ↦ hx.symm ▸ hadj₀⟩ + obtain ⟨v₁, v₂, hv₀1, hv₀2, hv12, hv_adj_iff⟩ := + hT.exists_other_two_adj hv_not_leaf hadj₀.symm + have hadj₁ : T.Adj v v₁ := (hv_adj_iff v₁).2 (Or.inr (Or.inl rfl)) + have hadj₂ : T.Adj v v₂ := (hv_adj_iff v₂).2 (Or.inr (Or.inr rfl)) + have hv1_ne_v : v₁ ≠ v := hadj₁.ne.symm + have hv2_ne_v : v₂ ≠ v := hadj₂.ne.symm + -- `v₁` and `v₂` are not adjacent in `T` since `T` is a tree and `v` is adjacent to both. + have hnot_adj12 : ¬ T.Adj v₁ v₂ := by + intro hadj12 + let p₁ : T.Walk v₁ v₂ := Walk.cons hadj12 Walk.nil + let p₂ : T.Walk v₁ v₂ := Walk.cons hadj₁.symm (Walk.cons hadj₂ Walk.nil) + have hp₁ : p₁.IsPath := Walk.IsPath.nil.cons (by simp [hv12]) + have hp₂ : p₂.IsPath := by + rw [Walk.cons_isPath_iff] + refine ⟨Walk.IsPath.nil.cons (by simp [hadj₂.ne]), ?_⟩ + simp [hv1_ne_v, hv12] + have heq : p₁ = p₂ := + congrArg Subtype.val ((hT.isTree.isAcyclic.subsingleton_path v₁ v₂).elim ⟨p₁, hp₁⟩ ⟨p₂, hp₂⟩) + have hlen := congrArg Walk.length heq + simp [p₁, p₂] at hlen + -- Define the reduced vertex type `S = {u : ι | u ≠ v₀ ∧ u ≠ v}`. + let S : Set ι := {u : ι | u ≠ v₀ ∧ u ≠ v} + let v₁' : S := ⟨v₁, hv₀1.symm, hv1_ne_v⟩ + let v₂' : S := ⟨v₂, hv₀2.symm, hv2_ne_v⟩ + have hv12' : v₁' ≠ v₂' := fun h ↦ hv12 (Subtype.ext_iff.1 h) + let G₀ : SimpleGraph S := T.induce S + let T' : SimpleGraph S := G₀ ⊔ SimpleGraph.edge v₁' v₂' + have hadj_T'_iff : ∀ u' w' : S, + T'.Adj u' w' ↔ T.Adj u'.1 w'.1 ∨ (u' = v₁' ∧ w' = v₂') ∨ (u' = v₂' ∧ w' = v₁') := by + intro u' w' + simp only [T', G₀, sup_adj, SimpleGraph.edge_adj] + change T.Adj u'.1 w'.1 ∨ _ ↔ _ + constructor + · rintro (h | ⟨⟨rfl, rfl⟩ | ⟨rfl, rfl⟩, _⟩) + · exact Or.inl h + · exact Or.inr (Or.inl ⟨rfl, rfl⟩) + · exact Or.inr (Or.inr ⟨rfl, rfl⟩) + · rintro (h | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) + · exact Or.inl h + · exact Or.inr ⟨Or.inl ⟨rfl, rfl⟩, hv12'⟩ + · exact Or.inr ⟨Or.inr ⟨rfl, rfl⟩, hv12'.symm⟩ + -- Step 1: `T'` is a tree. + have hnot_reach_G₀ : ¬ G₀.Reachable v₁' v₂' := by + rintro ⟨w⟩ + let q := w.toPath + let embS : G₀ ↪g T := SimpleGraph.Embedding.induce S + let qT := q.1.map embS.toHom + have hqT_path : qT.IsPath := q.2.map embS.injective + let p₂ : T.Walk v₁ v₂ := Walk.cons hadj₁.symm (Walk.cons hadj₂ Walk.nil) + have hp₂ : p₂.IsPath := by + rw [Walk.cons_isPath_iff] + refine ⟨Walk.IsPath.nil.cons (by simp [hadj₂.ne]), ?_⟩ + simp [hv1_ne_v, hv12] + have heq : qT = p₂ := + congrArg Subtype.val + ((hT.isTree.isAcyclic.subsingleton_path v₁ v₂).elim ⟨qT, hqT_path⟩ ⟨p₂, hp₂⟩) + have hv_mem : v ∈ (q.1.map embS.toHom).support := by + change v ∈ qT.support + rw [heq] + exact List.mem_cons_of_mem _ List.mem_cons_self + rw [Walk.support_map] at hv_mem + obtain ⟨u', _, hu'_eq⟩ := List.mem_map.1 hv_mem + exact u'.2.2 hu'_eq + have hT'_acyc : T'.IsAcyclic := + (hT.isTree.isAcyclic.induce S).sup_edge_of_not_reachable hnot_reach_G₀ + have hT'_conn : T'.Connected := + prunedTree_connected hT.isTree hv₀_adj_iff hv_adj_iff ⟨hv₀1.symm, hv1_ne_v⟩ + ⟨hv₀2.symm, hv2_ne_v⟩ le_sup_left + ((hadj_T'_iff v₂' v₁').2 (Or.inr (Or.inr ⟨rfl, rfl⟩))) + have hT'_tree : T'.IsTree := ⟨hT'_conn, hT'_acyc⟩ + let origNeighbor := restoredNeighbor v₁' v₂' + let hneigh_equiv := + prunedTree_neighborEquiv hv₀_adj_iff hv_adj_iff hadj₁ hadj₂ hnot_adj12 + ⟨hv₀1.symm, hv1_ne_v⟩ ⟨hv₀2.symm, hv2_ne_v⟩ hv12 + (fun u' w' => by simpa only [Subtype.ext_iff] using hadj_T'_iff u' w') + -- Step 3: Define `α'` and show it agrees with `origNeighbor`. + let α' (u' : S) (f' : Sym2 S) : Set β := + if f' = s(v₁', v₂') then + if u' = v₁' then α v₁ s(v₁, v) else α v₂ s(v₂, v) + else + α u'.1 (Sym2.map Subtype.val f') + have hα'_eq : ∀ (u' w' : S) (hw' : T'.Adj u' w'), + α' u' s(u', w') = α u'.1 s(u'.1, (hneigh_equiv u' ⟨w', hw'⟩).1) := by + intro u' w' hw' + change α' u' s(u', w') = α u'.1 s(u'.1, origNeighbor u' w') + by_cases hpair : (u' = v₁' ∧ w' = v₂') ∨ (u' = v₂' ∧ w' = v₁') + · rcases hpair with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · simp [α', origNeighbor, restoredNeighbor, v₁', v₂'] + · have hswap : s(v₂', v₁') = s(v₁', v₂') := Sym2.eq_swap + simp [α', origNeighbor, restoredNeighbor, hswap, hv12'.symm, v₁', v₂'] + · have hne_edge : s(u', w') ≠ s(v₁', v₂') := by + intro heq + rcases Sym2.eq_iff.1 heq with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · exact hpair (Or.inl ⟨h1, h2⟩) + · exact hpair (Or.inr ⟨h1, h2⟩) + simp [α', origNeighbor, restoredNeighbor, hpair, hne_edge] + -- Step 4: Verify `IsExactTreeLabelling E κ 𝒜 T' α'`. + have hT'_ternary : IsTernaryTree T' := by + refine ⟨hT'_tree, fun u' ↦ ?_⟩ + rw [degree_eq_of_neighborEquiv (hneigh_equiv u')] + exact hT.degree_eq_one_or_three u'.1 + -- Key relation on the suppressed vertex `v`: `α v₁ s(v₁, v) = E \ α v₂ s(v₂, v)`. + have hα_v1_v2_compl : α v₁ s(v₁, v) = E \ α v₂ s(v₂, v) := by + have hα_v_e₀ : α v s(v, v₀) = ∅ := by + rw [hα.isTreeLabelling.compl_eq hadj₀.symm, Sym2.eq_swap, hα_v₀, Set.sdiff_self] + have hinc0 : IsTreeIncidence T v s(v, v₀) := isTreeIncidence_iff_adj.2 hadj₀.symm + have hinc1 : IsTreeIncidence T v s(v, v₁) := isTreeIncidence_iff_adj.2 hadj₁ + have hinc2 : IsTreeIncidence T v s(v, v₂) := isTreeIncidence_iff_adj.2 hadj₂ + have he01 : s(v, v₀) ≠ s(v, v₁) := sym2_mk_eq_left_iff.not.2 hv₀1 + have he02 : s(v, v₀) ≠ s(v, v₂) := sym2_mk_eq_left_iff.not.2 hv₀2 + have he12 : s(v, v₁) ≠ s(v, v₂) := sym2_mk_eq_left_iff.not.2 hv12 + obtain ⟨hunion_v, hinter_v⟩ := + hα.compl_eq_union_of_degree_three hinc0 hinc1 hinc2 he01 he02 he12 + rw [hα_v_e₀, Set.sdiff_empty] at hunion_v + have h_v2_eq : α v s(v, v₂) = E \ α v s(v, v₁) := by + ext x + have hx_disj : x ∈ α v s(v, v₁) → x ∉ α v s(v, v₂) := fun h1 h2 ↦ + Set.notMem_empty x (hinter_v ▸ ⟨h1, h2⟩) + simp only [Set.mem_sdiff] + constructor + · intro hx2 + exact ⟨hunion_v ▸ Or.inr hx2, fun hx1 ↦ hx_disj hx1 hx2⟩ + · rintro ⟨hxE, hx1⟩ + rw [← hunion_v] at hxE + exact hxE.resolve_left hx1 + have h1 : α v₁ s(v₁, v) = E \ α v s(v, v₁) := by + rw [hα.isTreeLabelling.compl_eq hadj₁.symm, Sym2.eq_swap] + have h2 : E \ α v₂ s(v₂, v) = α v s(v, v₂) := by + rw [hα.isTreeLabelling.compl_eq hadj₂.symm, Sym2.eq_swap, + Set.sdiff_sdiff_cancel_left (hα.isTreeLabelling.subset_of_inc hinc2)] + rw [h1, h2, h_v2_eq] + have htree_lab' : IsTreeLabelling E κ 𝒜 T' α' := by + refine ⟨hT'_ternary, ?_, ?_, ?_, ?_⟩ + · intro u' f' hf' + obtain ⟨w', hw', rfl⟩ := isTreeIncidence_iff_exists_adj.1 hf' + rw [hα'_eq u' w' hw'] + exact hα.isTreeLabelling.isEfficient + (isTreeIncidence_iff_adj.2 (hneigh_equiv u' ⟨w', hw'⟩).2) + · intro u' w' hw' + by_cases hpair : (u' = v₁' ∧ w' = v₂') ∨ (u' = v₂' ∧ w' = v₁') + · rcases hpair with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · simp only [α', ↓reduceIte, hv12'.symm] + exact hα_v1_v2_compl + · have hswap : s(v₂', v₁') = s(v₁', v₂') := Sym2.eq_swap + simp only [α', hswap, ↓reduceIte, hv12'.symm] + rw [hα_v1_v2_compl, Set.sdiff_sdiff_cancel_left + (hα.isTreeLabelling.subset_of_inc (isTreeIncidence_iff_adj.2 hadj₂.symm))] + · have hne_edge : s(u', w') ≠ s(v₁', v₂') := by + intro heq + rcases Sym2.eq_iff.1 heq with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · exact hpair (Or.inl ⟨h1, h2⟩) + · exact hpair (Or.inr ⟨h1, h2⟩) + have hadj_u_w : T.Adj u'.1 w'.1 := + ((hadj_T'_iff u' w').1 hw').resolve_right hpair + simp only [α', hne_edge, ↓reduceIte] + exact hα.isTreeLabelling.compl_eq hadj_u_w + · intro u' f' hf' hleaf' + obtain ⟨w', hw', rfl⟩ := isTreeIncidence_iff_exists_adj.1 hf' + rw [hα'_eq u' w' hw'] + have hleaf_u : IsLeaf T u'.1 := (isLeaf_iff_of_neighborEquiv (hneigh_equiv u')).1 hleaf' + exact hα.isTreeLabelling.leaf_eq_or_union_eq + (isTreeIncidence_iff_adj.2 (hneigh_equiv u' ⟨w', hw'⟩).2) hleaf_u + · intro u' f₁' f₂' f₃' hf₁' hf₂' hf₃' h12' h13' h23' + exact degree_three_union_eq_of_neighborEquiv hα.isTreeLabelling (hneigh_equiv u') + (fun w' hw' ↦ (hα'_eq u' w' hw').symm.subset) + (fun w' hw' ↦ (hα'_eq u' w' hw').subset.trans + (hα.isTreeLabelling.subset_of_inc + (isTreeIncidence_iff_adj.2 (hneigh_equiv u' ⟨w', hw'⟩).2))) + hf₁' hf₂' hf₃' h12' h13' h23' + have hexact' : IsExactTreeLabelling E κ 𝒜 T' α' := by + refine ⟨htree_lab', fun u' f₁' f₂' hf' ↦ ?_⟩ + exact isExactFork_of_neighborEquiv (hneigh_equiv u') (hα'_eq u') + (fun _ _ hf ↦ hα.isExactFork hf) hf' + have hcard_lt : Fintype.card S < Fintype.card ι := + Fintype.card_subtype_lt (x := v₀) (fun h ↦ h.1 rfl) + let eFin := Fintype.equivFin S + refine ⟨Fin (Fintype.card S), inferInstance, T'.map eFin.toEmbedding, + fun v e ↦ α' (eFin.symm v) (e.map eFin.symm), ?_, hexact'.relabel eFin⟩ + simpa using hcard_lt + +/-! ## Tree-splicing for (3.4) -/ + +private abbrev SplicedVert {ι₂ ι₁ : Type*} (t₁ : ι₂) (t₀ : ι₁) : Type _ := + {v : ι₂ // v ≠ t₁} ⊕ {u : ι₁ // u ≠ t₀} + +private def splicedBaseGraph {ι₂ ι₁ : Type*} (T₂ : SimpleGraph ι₂) (T₁ : SimpleGraph ι₁) + (t₁ : ι₂) (t₀ : ι₁) : SimpleGraph (SplicedVert t₁ t₀) where + Adj a b := + match a, b with + | Sum.inl u, Sum.inl v => T₂.Adj u.1 v.1 + | Sum.inr u, Sum.inr v => T₁.Adj u.1 v.1 + | _, _ => False + symm := ⟨by + rintro (u | u) (v | v) h + · exact h.symm + · exact h + · exact h + · exact h.symm⟩ + loopless := ⟨by + rintro (u | u) h + · exact T₂.loopless.irrefl u.1 h + · exact T₁.loopless.irrefl u.1 h⟩ + +private def splicedTree {ι₂ ι₁ : Type*} (T₂ : SimpleGraph ι₂) (T₁ : SimpleGraph ι₁) + {t₁ w₁ : ι₂} {t₀ s : ι₁} (hw₁ : w₁ ≠ t₁) (hs : s ≠ t₀) : + SimpleGraph (SplicedVert t₁ t₀) := + splicedBaseGraph T₂ T₁ t₁ t₀ ⊔ + SimpleGraph.edge (Sum.inl ⟨w₁, hw₁⟩) (Sum.inr ⟨s, hs⟩) + +private theorem splicedTree_adj_iff {ι₂ ι₁ : Type*} {T₂ : SimpleGraph ι₂} {T₁ : SimpleGraph ι₁} + {t₁ w₁ : ι₂} {t₀ s : ι₁} (hw₁ : w₁ ≠ t₁) (hs : s ≠ t₀) + (x y : SplicedVert t₁ t₀) : + (splicedTree T₂ T₁ hw₁ hs).Adj x y ↔ + (splicedBaseGraph T₂ T₁ t₁ t₀).Adj x y ∨ + (x = Sum.inl ⟨w₁, hw₁⟩ ∧ y = Sum.inr ⟨s, hs⟩) ∨ + (x = Sum.inr ⟨s, hs⟩ ∧ y = Sum.inl ⟨w₁, hw₁⟩) := by + simp only [splicedTree, sup_adj, SimpleGraph.edge_adj] + constructor + · rintro (h | ⟨⟨rfl, rfl⟩ | ⟨rfl, rfl⟩, _⟩) + · exact Or.inl h + · exact Or.inr (Or.inl ⟨rfl, rfl⟩) + · exact Or.inr (Or.inr ⟨rfl, rfl⟩) + · rintro (h | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) + · exact Or.inl h + · exact Or.inr ⟨Or.inl ⟨rfl, rfl⟩, Sum.inl_ne_inr⟩ + · exact Or.inr ⟨Or.inr ⟨rfl, rfl⟩, Sum.inr_ne_inl⟩ + +private theorem splicedTree_connected {ι₂ ι₁ : Type*} [Fintype ι₂] [Fintype ι₁] + {T₂ : SimpleGraph ι₂} {T₁ : SimpleGraph ι₁} + (hT₂ : IsTernaryTree T₂) (hT₁ : IsTernaryTree T₁) + {t₁ w₁ : ι₂} {t₀ s : ι₁} + (ht₁_leaf : IsLeaf T₂ t₁) (ht₀_leaf : IsLeaf T₁ t₀) + (hw₁ : w₁ ≠ t₁) (hs : s ≠ t₀) : + (splicedTree T₂ T₁ hw₁ hs).Connected := by + classical + let w₁' : {v : ι₂ // v ≠ t₁} := ⟨w₁, hw₁⟩ + let s' : {u : ι₁ // u ≠ t₀} := ⟨s, hs⟩ + have hT₂'_conn : (T₂.induce {t₁}ᶜ).Connected := + hT₂.isTree.connected.induce_compl_singleton_of_degree_eq_one + (hT₂.degree_eq_one_of_isLeaf ht₁_leaf) + have hT₁'_conn : (T₁.induce {t₀}ᶜ).Connected := + hT₁.isTree.connected.induce_compl_singleton_of_degree_eq_one + (hT₁.degree_eq_one_of_isLeaf ht₀_leaf) + let emb₂ : T₂.induce {t₁}ᶜ ↪g splicedBaseGraph T₂ T₁ t₁ t₀ := + { toFun := Sum.inl, inj' := Sum.inl_injective, map_rel_iff' := Iff.rfl } + let emb₁ : T₁.induce {t₀}ᶜ ↪g splicedBaseGraph T₂ T₁ t₁ t₀ := + { toFun := Sum.inr, inj' := Sum.inr_injective, map_rel_iff' := Iff.rfl } + have : Nonempty (SplicedVert t₁ t₀) := ⟨Sum.inl w₁'⟩ + refine Connected.mk fun x y ↦ ?_ + have hreach_w₁' : ∀ z : SplicedVert t₁ t₀, + (splicedTree T₂ T₁ hw₁ hs).Reachable z (Sum.inl w₁') := by + intro z + cases z with + | inl v => + exact ((hT₂'_conn v w₁').map emb₂.toHom).mono le_sup_left + | inr u => + have h1 : (splicedTree T₂ T₁ hw₁ hs).Reachable (Sum.inr u) (Sum.inr s') := + ((hT₁'_conn u s').map emb₁.toHom).mono le_sup_left + have hadj_bridge : (splicedTree T₂ T₁ hw₁ hs).Adj (Sum.inr s') (Sum.inl w₁') := + (splicedTree_adj_iff hw₁ hs _ _).2 (Or.inr (Or.inr ⟨rfl, rfl⟩)) + exact h1.trans hadj_bridge.reachable + exact (hreach_w₁' x).trans (hreach_w₁' y).symm + +private def splicedToNeighbor₂ {ι₂ ι₁ : Type*} (t₁ : ι₂) {t₀ : ι₁} + (z : SplicedVert t₁ t₀) : ι₂ := + match z with + | Sum.inl w => w.1 + | Sum.inr _ => t₁ + +private def splicedToNeighbor₁ {ι₂ ι₁ : Type*} {t₁ : ι₂} (t₀ : ι₁) + (z : SplicedVert t₁ t₀) : ι₁ := + match z with + | Sum.inr w => w.1 + | Sum.inl _ => t₀ + +private theorem exists_spliced_neighborEquiv₂ {ι₂ ι₁ : Type*} [Fintype ι₂] + {T₂ : SimpleGraph ι₂} {T₁ : SimpleGraph ι₁} + {t₁ w₁ : ι₂} {t₀ s : ι₁} + (ht₁_leaf : IsLeaf T₂ t₁) (hadj_t₁w₁ : T₂.Adj t₁ w₁) + (hT₂ : IsTernaryTree T₂) (hw₁ : w₁ ≠ t₁) (hs : s ≠ t₀) : + ∃ e : ∀ v : {v : ι₂ // v ≠ t₁}, + {z : SplicedVert t₁ t₀ // (splicedTree T₂ T₁ hw₁ hs).Adj (Sum.inl v) z} ≃ + {w : ι₂ // T₂.Adj v.1 w}, + ∀ (v : {v : ι₂ // v ≠ t₁}) (z : SplicedVert t₁ t₀) + (hz : (splicedTree T₂ T₁ hw₁ hs).Adj (Sum.inl v) z), + (e v ⟨z, hz⟩).1 = splicedToNeighbor₂ t₁ z := by + classical + obtain ⟨_, _, ht₁_uniq⟩ := hT₂.exists_adj_of_isLeaf ht₁_leaf + have ht₁_adj_iff : ∀ v, T₂.Adj t₁ v ↔ v = w₁ := + fun v ↦ ⟨fun hv ↦ (ht₁_uniq v hv).trans (ht₁_uniq w₁ hadj_t₁w₁).symm, + fun hv ↦ hv.symm ▸ hadj_t₁w₁⟩ + let invNeighbor₂ (w : ι₂) : SplicedVert t₁ t₀ := + if hw : w ≠ t₁ then Sum.inl ⟨w, hw⟩ else Sum.inr ⟨s, hs⟩ + have hto₂_adj : ∀ (v : {v : ι₂ // v ≠ t₁}) (z : SplicedVert t₁ t₀), + (splicedTree T₂ T₁ hw₁ hs).Adj (Sum.inl v) z → T₂.Adj v.1 (splicedToNeighbor₂ t₁ z) := by + intro v z hz + rcases (splicedTree_adj_iff hw₁ hs (Sum.inl v) z).1 hz with hG₀ | ⟨h1, h2⟩ | ⟨h1, _⟩ + · rcases z with w | u + · exact hG₀ + · exact hG₀.elim + · injection h1 with hv_eq + subst hv_eq + subst h2 + exact hadj_t₁w₁.symm + · cases h1 + have hinv₂_adj : ∀ (v : {v : ι₂ // v ≠ t₁}) (w : ι₂), + T₂.Adj v.1 w → (splicedTree T₂ T₁ hw₁ hs).Adj (Sum.inl v) (invNeighbor₂ w) := by + intro v w hw + by_cases hwt₁ : w = t₁ + · rw [hwt₁] at hw ⊢ + have hveq : v = ⟨w₁, hw₁⟩ := Subtype.ext ((ht₁_adj_iff v.1).1 hw.symm) + have hinv : invNeighbor₂ t₁ = Sum.inr ⟨s, hs⟩ := by simp [invNeighbor₂] + rw [hveq, hinv] + exact (splicedTree_adj_iff hw₁ hs _ _).2 (Or.inr (Or.inl ⟨rfl, rfl⟩)) + · have hinv : invNeighbor₂ w = Sum.inl ⟨w, hwt₁⟩ := by simp [invNeighbor₂, hwt₁] + rw [hinv] + exact (splicedTree_adj_iff hw₁ hs _ _).2 (Or.inl hw) + refine ⟨fun v ↦ + { toFun := fun ⟨z, hz⟩ ↦ ⟨splicedToNeighbor₂ t₁ z, hto₂_adj v z hz⟩ + invFun := fun ⟨w, hw⟩ ↦ ⟨invNeighbor₂ w, hinv₂_adj v w hw⟩ + left_inv := ?_ + right_inv := ?_ }, fun _ _ _ ↦ rfl⟩ + · rintro ⟨z, hz⟩ + ext + dsimp [splicedToNeighbor₂, invNeighbor₂] + rcases (splicedTree_adj_iff hw₁ hs (Sum.inl v) z).1 hz with hG₀ | ⟨_, rfl⟩ | ⟨h1, _⟩ + · rcases z with w | u + · simp [w.2] + · exact hG₀.elim + · simp + · cases h1 + · rintro ⟨w, hw⟩ + ext + dsimp [splicedToNeighbor₂, invNeighbor₂] + by_cases hwt₁ : w ≠ t₁ + · simp [hwt₁] + · have hweq : w = t₁ := not_ne_iff.1 hwt₁ + subst hweq + simp + +private theorem exists_spliced_neighborEquiv₁ {ι₂ ι₁ : Type*} [Fintype ι₁] + {T₂ : SimpleGraph ι₂} {T₁ : SimpleGraph ι₁} + {t₁ w₁ : ι₂} {t₀ s : ι₁} + (ht₀_leaf : IsLeaf T₁ t₀) (hadj_t₀s : T₁.Adj t₀ s) + (hT₁ : IsTernaryTree T₁) (hw₁ : w₁ ≠ t₁) (hs : s ≠ t₀) : + ∃ e : ∀ u : {u : ι₁ // u ≠ t₀}, + {z : SplicedVert t₁ t₀ // (splicedTree T₂ T₁ hw₁ hs).Adj (Sum.inr u) z} ≃ + {w : ι₁ // T₁.Adj u.1 w}, + ∀ (u : {u : ι₁ // u ≠ t₀}) (z : SplicedVert t₁ t₀) + (hz : (splicedTree T₂ T₁ hw₁ hs).Adj (Sum.inr u) z), + (e u ⟨z, hz⟩).1 = splicedToNeighbor₁ t₀ z := by + classical + obtain ⟨_, _, ht₀_uniq⟩ := hT₁.exists_adj_of_isLeaf ht₀_leaf + have ht₀_adj_iff : ∀ u, T₁.Adj t₀ u ↔ u = s := + fun u ↦ ⟨fun hu ↦ (ht₀_uniq u hu).trans (ht₀_uniq s hadj_t₀s).symm, + fun hu ↦ hu.symm ▸ hadj_t₀s⟩ + let invNeighbor₁ (w : ι₁) : SplicedVert t₁ t₀ := + if hw : w ≠ t₀ then Sum.inr ⟨w, hw⟩ else Sum.inl ⟨w₁, hw₁⟩ + have hto₁_adj : ∀ (u : {u : ι₁ // u ≠ t₀}) (z : SplicedVert t₁ t₀), + (splicedTree T₂ T₁ hw₁ hs).Adj (Sum.inr u) z → T₁.Adj u.1 (splicedToNeighbor₁ t₀ z) := by + intro u z hz + rcases (splicedTree_adj_iff hw₁ hs (Sum.inr u) z).1 hz with hG₀ | ⟨h1, _⟩ | ⟨h1, h2⟩ + · rcases z with v | w + · exact hG₀.elim + · exact hG₀ + · cases h1 + · injection h1 with hu_eq + subst hu_eq + subst h2 + exact hadj_t₀s.symm + have hinv₁_adj : ∀ (u : {u : ι₁ // u ≠ t₀}) (w : ι₁), + T₁.Adj u.1 w → (splicedTree T₂ T₁ hw₁ hs).Adj (Sum.inr u) (invNeighbor₁ w) := by + intro u w hw + by_cases hwt₀ : w = t₀ + · rw [hwt₀] at hw ⊢ + have hueq : u = ⟨s, hs⟩ := Subtype.ext ((ht₀_adj_iff u.1).1 hw.symm) + have hinv : invNeighbor₁ t₀ = Sum.inl ⟨w₁, hw₁⟩ := by simp [invNeighbor₁] + rw [hueq, hinv] + exact (splicedTree_adj_iff hw₁ hs _ _).2 (Or.inr (Or.inr ⟨rfl, rfl⟩)) + · have hinv : invNeighbor₁ w = Sum.inr ⟨w, hwt₀⟩ := by simp [invNeighbor₁, hwt₀] + rw [hinv] + exact (splicedTree_adj_iff hw₁ hs _ _).2 (Or.inl hw) + refine ⟨fun u ↦ + { toFun := fun ⟨z, hz⟩ ↦ ⟨splicedToNeighbor₁ t₀ z, hto₁_adj u z hz⟩ + invFun := fun ⟨w, hw⟩ ↦ ⟨invNeighbor₁ w, hinv₁_adj u w hw⟩ + left_inv := ?_ + right_inv := ?_ }, fun _ _ _ ↦ rfl⟩ + · rintro ⟨z, hz⟩ + ext + dsimp [splicedToNeighbor₁, invNeighbor₁] + rcases (splicedTree_adj_iff hw₁ hs (Sum.inr u) z).1 hz with hG₀ | ⟨h1, _⟩ | ⟨_, rfl⟩ + · rcases z with v | w + · exact hG₀.elim + · simp [w.2] + · cases h1 + · simp + · rintro ⟨w, hw⟩ + ext + dsimp [splicedToNeighbor₁, invNeighbor₁] + by_cases hwt₀ : w ≠ t₀ + · simp [hwt₀] + · have hweq : w = t₀ := not_ne_iff.1 hwt₀ + subst hweq + simp + +private theorem card_subtype_ne_add_one {α : Type*} [Fintype α] [DecidableEq α] (a : α) : + Fintype.card {x : α // x ≠ a} + 1 = Fintype.card α := by + have h := Fintype.card_subtype_compl (fun x : α ↦ x = a) + have h1 : Fintype.card {x : α // x = a} = 1 := Fintype.card_unique + have hpos : 1 ≤ Fintype.card α := Fintype.card_pos_iff.2 ⟨a⟩ + change Fintype.card {x : α // x ≠ a} = Fintype.card α - Fintype.card {x : α // x = a} at h + omega + +private theorem splicedTree_isTernaryTree {ι₂ ι₁ : Type*} [Fintype ι₂] [Fintype ι₁] + [DecidableEq ι₂] [DecidableEq ι₁] + {T₂ : SimpleGraph ι₂} {T₁ : SimpleGraph ι₁} + (hT₂ : IsTernaryTree T₂) (hT₁ : IsTernaryTree T₁) + {t₁ w₁ : ι₂} {t₀ s : ι₁} + (ht₁_leaf : IsLeaf T₂ t₁) (ht₀_leaf : IsLeaf T₁ t₀) + (hw₁ : w₁ ≠ t₁) (hs : s ≠ t₀) + (hneigh₂ : ∀ v : {v : ι₂ // v ≠ t₁}, + {z : SplicedVert t₁ t₀ // (splicedTree T₂ T₁ hw₁ hs).Adj (Sum.inl v) z} ≃ + {w : ι₂ // T₂.Adj v.1 w}) + (hneigh₁ : ∀ u : {u : ι₁ // u ≠ t₀}, + {z : SplicedVert t₁ t₀ // (splicedTree T₂ T₁ hw₁ hs).Adj (Sum.inr u) z} ≃ + {w : ι₁ // T₁.Adj u.1 w}) : + IsTernaryTree (splicedTree T₂ T₁ hw₁ hs) := by + classical + let T' := splicedTree T₂ T₁ hw₁ hs + have hdeg_inl : ∀ v : {v : ι₂ // v ≠ t₁}, T'.degree (Sum.inl v) = T₂.degree v.1 := fun v ↦ + degree_eq_of_neighborEquiv (hneigh₂ v) + have hdeg_inr : ∀ u : {u : ι₁ // u ≠ t₀}, T'.degree (Sum.inr u) = T₁.degree u.1 := fun u ↦ + degree_eq_of_neighborEquiv (hneigh₁ u) + have hT'_tree : T'.IsTree := by + rw [isTree_iff_connected_and_card] + refine ⟨splicedTree_connected hT₂ hT₁ ht₁_leaf ht₀_leaf hw₁ hs, ?_⟩ + rw [Nat.card_eq_fintype_card, Nat.card_eq_fintype_card, ← T'.edgeFinset_card, + Fintype.card_sum] + have hsum_T' : ∑ x : SplicedVert t₁ t₀, T'.degree x = 2 * T'.edgeFinset.card := + T'.sum_degrees_eq_twice_card_edges + rw [Fintype.sum_sum_type, Finset.sum_congr rfl fun v _ ↦ hdeg_inl v, + Finset.sum_congr rfl fun u _ ↦ hdeg_inr u] at hsum_T' + have hsum₂ : (∑ v : {v : ι₂ // v ≠ t₁}, T₂.degree v.1) + T₂.degree t₁ = + 2 * T₂.edgeFinset.card := by + rw [← T₂.sum_degrees_eq_twice_card_edges, + ← Finset.sum_erase_add _ _ (Finset.mem_univ t₁)] + congr 1 + refine Finset.sum_bij (fun v _ ↦ v.1) (fun v _ ↦ Finset.mem_erase.2 ⟨v.2, Finset.mem_univ _⟩) + (fun _ _ _ _ h ↦ Subtype.ext h) + (fun v hv ↦ ⟨⟨v, (Finset.mem_erase.1 hv).1⟩, Finset.mem_univ _, rfl⟩) + (fun _ _ ↦ rfl) + have hsum₁ : (∑ u : {u : ι₁ // u ≠ t₀}, T₁.degree u.1) + T₁.degree t₀ = + 2 * T₁.edgeFinset.card := by + rw [← T₁.sum_degrees_eq_twice_card_edges, + ← Finset.sum_erase_add _ _ (Finset.mem_univ t₀)] + congr 1 + refine Finset.sum_bij (fun u _ ↦ u.1) (fun u _ ↦ Finset.mem_erase.2 ⟨u.2, Finset.mem_univ _⟩) + (fun _ _ _ _ h ↦ Subtype.ext h) + (fun u hu ↦ ⟨⟨u, (Finset.mem_erase.1 hu).1⟩, Finset.mem_univ _, rfl⟩) + (fun _ _ ↦ rfl) + have hdeg_t₁ : T₂.degree t₁ = 1 := hT₂.degree_eq_one_of_isLeaf ht₁_leaf + have hdeg_t₀ : T₁.degree t₀ = 1 := hT₁.degree_eq_one_of_isLeaf ht₀_leaf + have hcard_V₂ : Fintype.card {v : ι₂ // v ≠ t₁} + 1 = Fintype.card ι₂ := + card_subtype_ne_add_one t₁ + have hcard_V₁ : Fintype.card {u : ι₁ // u ≠ t₀} + 1 = Fintype.card ι₁ := + card_subtype_ne_add_one t₀ + have he₂ := hT₂.isTree.card_edgeFinset + have he₁ := hT₁.isTree.card_edgeFinset + clear * - hsum_T' hsum₂ hsum₁ hdeg_t₁ hdeg_t₀ hcard_V₂ hcard_V₁ he₂ he₁ + omega + refine ⟨hT'_tree, fun x ↦ ?_⟩ + cases x with + | inl v => + rw [hdeg_inl v] + exact hT₂.degree_eq_one_or_three v.1 + | inr u => + rw [hdeg_inr u] + exact hT₁.degree_eq_one_or_three u.1 + +/-- Splicing `S = T₁ \ t₀` (where `t₀` is the unique bad leaf of `T₁`, adjacent to a degree-3 +vertex `s` with `α₁(s, e₀) = X`) onto a bad leaf `t₁` of `T₂` (with `X ⊆ α₂(t₁, e₁)`) produces a +tree-labelling `(T', α')` over `𝒜₂` with strictly fewer bad leaves for `𝒜` +(Graph Minors X, Section 3, proof of (3.4), pages 162–163). -/ +theorem exists_spliced_treeLabelling {ι₁ ι₂ : Type} [Fintype ι₁] [Fintype ι₂] + {E X : Set β} {κ : Set β → ℤ} {𝒜 𝒜₁ 𝒜₂ : Set (Set β)} + {T₁ : SimpleGraph ι₁} {α₁ : ι₁ → Sym2 ι₁ → Set β} + {T₂ : SimpleGraph ι₂} {α₂ : ι₂ → Sym2 ι₂ → Set β} + (h𝒜_sub : 𝒜 ⊆ 𝒜₂) + (hα₁ : IsTreeLabelling E κ 𝒜₁ T₁ α₁) (hα₂ : IsTreeLabelling E κ 𝒜₂ T₂ α₂) + {t₀ s : ι₁} (ht₀_leaf : IsLeaf T₁ t₀) (hadj_t₀s : T₁.Adj t₀ s) + (hs_not_leaf : ¬ IsLeaf T₁ s) (hα₁_s : α₁ s s(s, t₀) = X) + (ht₀_only_bad : ∀ u e, IsTreeIncidence T₁ u e → IsLeaf T₁ u → u ≠ t₀ → + α₁ u e = E ∨ ∃ A ∈ 𝒜, α₁ u e ∪ A = E) + {t₁ w₁ : ι₂} (ht₁_leaf : IsLeaf T₂ t₁) (hadj_t₁w₁ : T₂.Adj t₁ w₁) + (ht₁_bad : ¬ (α₂ t₁ s(t₁, w₁) = E ∨ ∃ A ∈ 𝒜, α₂ t₁ s(t₁, w₁) ∪ A = E)) + (hX_sub : X ⊆ α₂ t₁ s(t₁, w₁)) : + ∃ (ι' : Type) (_ : Fintype ι') (T' : SimpleGraph ι') (α' : ι' → Sym2 ι' → Set β), + IsTreeLabelling E κ 𝒜₂ T' α' ∧ + {u' : ι' | IsLeaf T' u' ∧ + ∃ e', IsTreeIncidence T' u' e' ∧ ¬ (α' u' e' = E ∨ ∃ A ∈ 𝒜, α' u' e' ∪ A = E)}.ncard < + {u : ι₂ | IsLeaf T₂ u ∧ + ∃ e, IsTreeIncidence T₂ u e ∧ ¬ (α₂ u e = E ∨ ∃ A ∈ 𝒜, α₂ u e ∪ A = E)}.ncard := by + classical + have hT₁ := hα₁.isTernaryTree + have hT₂ := hα₂.isTernaryTree + have hw₁ : w₁ ≠ t₁ := hadj_t₁w₁.ne.symm + have hs : s ≠ t₀ := hadj_t₀s.ne.symm + let w₁' : {v : ι₂ // v ≠ t₁} := ⟨w₁, hw₁⟩ + let s' : {u : ι₁ // u ≠ t₀} := ⟨s, hs⟩ + let T' := splicedTree T₂ T₁ hw₁ hs + obtain ⟨hneigh₂, hneigh₂_val⟩ := + exists_spliced_neighborEquiv₂ ht₁_leaf hadj_t₁w₁ hT₂ hw₁ hs + obtain ⟨hneigh₁, hneigh₁_val⟩ := + exists_spliced_neighborEquiv₁ ht₀_leaf hadj_t₀s hT₁ hw₁ hs + have hT'_ternary : IsTernaryTree T' := + splicedTree_isTernaryTree hT₂ hT₁ ht₁_leaf ht₀_leaf hw₁ hs hneigh₂ hneigh₁ + let α' (x : SplicedVert t₁ t₀) (e : Sym2 (SplicedVert t₁ t₀)) : Set β := + match x with + | Sum.inl v => + if e = s(Sum.inl w₁', Sum.inr s') then α₂ w₁ s(w₁, t₁) + else α₂ v.1 (Sym2.map (splicedToNeighbor₂ t₁) e) + | Sum.inr u => + if e = s(Sum.inl w₁', Sum.inr s') then α₂ t₁ s(t₁, w₁) + else α₁ u.1 (Sym2.map (splicedToNeighbor₁ t₀) e) + have hα'_inl : ∀ (v : {v : ι₂ // v ≠ t₁}) (z : SplicedVert t₁ t₀) + (hz : T'.Adj (Sum.inl v) z), + α' (Sum.inl v) s(Sum.inl v, z) = α₂ v.1 s(v.1, (hneigh₂ v ⟨z, hz⟩).1) := by + intro v z hz + rw [hneigh₂_val v z hz] + rcases (splicedTree_adj_iff hw₁ hs (Sum.inl v) z).1 hz with hG₀ | ⟨h1, rfl⟩ | ⟨h1, _⟩ + · rcases z with w | u + · have hne_br : s(Sum.inl v, Sum.inl w) ≠ s(Sum.inl w₁', Sum.inr s') := by + intro heq + rcases Sym2.eq_iff.1 heq with ⟨_, h⟩ | ⟨h, _⟩ <;> cases h + simp only [α', splicedToNeighbor₂, hne_br, ↓reduceIte] + rfl + · exact hG₀.elim + · injection h1 with hv_eq + subst hv_eq + simp [α', splicedToNeighbor₂, w₁'] + · cases h1 + have hα'_inr_ne : ∀ (u w : {u : ι₁ // u ≠ t₀}), + α' (Sum.inr u) s(Sum.inr u, Sum.inr w) = α₁ u.1 s(u.1, w.1) := by + intro u w + have hne_br : s(Sum.inr u, Sum.inr w) ≠ s(Sum.inl w₁', Sum.inr s') := by + intro heq + rcases Sym2.eq_iff.1 heq with ⟨h, _⟩ | ⟨_, h⟩ <;> cases h + simp only [α', splicedToNeighbor₁, hne_br, ↓reduceIte] + rfl + have hα'_inr_sub : ∀ (u : {u : ι₁ // u ≠ t₀}) (z : SplicedVert t₁ t₀) + (hz : T'.Adj (Sum.inr u) z), + α₁ u.1 s(u.1, (hneigh₁ u ⟨z, hz⟩).1) ⊆ α' (Sum.inr u) s(Sum.inr u, z) ∧ + IsEfficient E κ (α' (Sum.inr u) s(Sum.inr u, z)) := by + intro u z hz + rw [hneigh₁_val u z hz] + rcases (splicedTree_adj_iff hw₁ hs (Sum.inr u) z).1 hz with hG₀ | ⟨h1, _⟩ | ⟨h1, rfl⟩ + · rcases z with v | w + · exact hG₀.elim + · rw [hα'_inr_ne u w] + exact ⟨subset_rfl, hα₁.isEfficient (isTreeIncidence_iff_adj.2 hG₀)⟩ + · cases h1 + · injection h1 with hu_eq + subst hu_eq + have hswap : s(Sum.inr s', Sum.inl w₁') = s(Sum.inl w₁', Sum.inr s') := Sym2.eq_swap + have hval : α' (Sum.inr s') s(Sum.inr s', Sum.inl w₁') = α₂ t₁ s(t₁, w₁) := by + simp [α', hswap] + rw [hval] + refine ⟨?_, hα₂.isEfficient (isTreeIncidence_iff_adj.2 hadj_t₁w₁)⟩ + change α₁ s s(s, t₀) ⊆ α₂ t₁ s(t₁, w₁) + rwa [hα₁_s] + have htree_lab' : IsTreeLabelling E κ 𝒜₂ T' α' := by + refine ⟨hT'_ternary, ?_, ?_, ?_, ?_⟩ + · intro x e he + obtain ⟨z, hz, rfl⟩ := isTreeIncidence_iff_exists_adj.1 he + cases x with + | inl v => + rw [hα'_inl v z hz] + exact hα₂.isEfficient (isTreeIncidence_iff_adj.2 (hneigh₂ v ⟨z, hz⟩).2) + | inr u => + exact (hα'_inr_sub u z hz).2 + · intro x y hxy + rcases (splicedTree_adj_iff hw₁ hs x y).1 hxy with hG₀ | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rcases x with u | u <;> rcases y with v | v + · have hne_br : s(Sum.inl u, Sum.inl v) ≠ s(Sum.inl w₁', Sum.inr s') := by + intro heq + rcases Sym2.eq_iff.1 heq with ⟨_, h⟩ | ⟨h, _⟩ <;> cases h + simp only [α', splicedToNeighbor₂, hne_br, ↓reduceIte] + exact hα₂.compl_eq hG₀ + · exact hG₀.elim + · exact hG₀.elim + · have hne_br : s(Sum.inr u, Sum.inr v) ≠ s(Sum.inl w₁', Sum.inr s') := by + intro heq + rcases Sym2.eq_iff.1 heq with ⟨h, _⟩ | ⟨_, h⟩ <;> cases h + simp only [α', splicedToNeighbor₁, hne_br, ↓reduceIte] + exact hα₁.compl_eq hG₀ + · simp only [α', w₁', s', ↓reduceIte] + rw [Sym2.eq_swap (a := t₁)] + exact hα₂.compl_eq hadj_t₁w₁.symm + · have hswap : s(Sum.inr s', Sum.inl w₁') = s(Sum.inl w₁', Sum.inr s') := Sym2.eq_swap + simp only [α', w₁', s', hswap, ↓reduceIte] + rw [Sym2.eq_swap (a := w₁)] + exact hα₂.compl_eq hadj_t₁w₁ + · intro x e he hleaf' + obtain ⟨z, hz, rfl⟩ := isTreeIncidence_iff_exists_adj.1 he + cases x with + | inl v => + rw [hα'_inl v z hz] + have hleaf_v : IsLeaf T₂ v.1 := (isLeaf_iff_of_neighborEquiv (hneigh₂ v)).1 hleaf' + exact hα₂.leaf_eq_or_union_eq + (isTreeIncidence_iff_adj.2 (hneigh₂ v ⟨z, hz⟩).2) hleaf_v + | inr u => + have hleaf_u : IsLeaf T₁ u.1 := (isLeaf_iff_of_neighborEquiv (hneigh₁ u)).1 hleaf' + have hu_ne_s : u.1 ≠ s := fun h ↦ hs_not_leaf (h ▸ hleaf_u) + rcases (splicedTree_adj_iff hw₁ hs (Sum.inr u) z).1 hz with hG₀ | ⟨h1, _⟩ | ⟨h1, _⟩ + · rcases z with v | w + · exact hG₀.elim + · rw [hα'_inr_ne u w] + rcases ht₀_only_bad u.1 s(u.1, w.1) (isTreeIncidence_iff_adj.2 hG₀) hleaf_u u.2 with + heq | ⟨A, hA𝒜, hunion⟩ + · exact Or.inl heq + · exact Or.inr ⟨A, h𝒜_sub hA𝒜, hunion⟩ + · cases h1 + · injection h1 with hu_eq + exact (hu_ne_s (congrArg Subtype.val hu_eq)).elim + · intro x f₁ f₂ f₃ hf₁ hf₂ hf₃ h12 h13 h23 + cases x with + | inl v => + exact degree_three_union_eq_of_neighborEquiv hα₂ (hneigh₂ v) + (fun z hz ↦ (hα'_inl v z hz).symm.subset) + (fun z hz ↦ by + rw [hα'_inl v z hz] + exact hα₂.subset_of_inc (isTreeIncidence_iff_adj.2 (hneigh₂ v ⟨z, hz⟩).2)) + hf₁ hf₂ hf₃ h12 h13 h23 + | inr u => + exact degree_three_union_eq_of_neighborEquiv hα₁ (hneigh₁ u) + (fun z hz ↦ (hα'_inr_sub u z hz).1) + (fun z hz ↦ (hα'_inr_sub u z hz).2.1) + hf₁ hf₂ hf₃ h12 h13 h23 + let B' : Set (SplicedVert t₁ t₀) := + {u' : SplicedVert t₁ t₀ | IsLeaf T' u' ∧ + ∃ e', IsTreeIncidence T' u' e' ∧ ¬ (α' u' e' = E ∨ ∃ A ∈ 𝒜, α' u' e' ∪ A = E)} + let B₂ : Set ι₂ := + {u : ι₂ | IsLeaf T₂ u ∧ + ∃ e, IsTreeIncidence T₂ u e ∧ ¬ (α₂ u e = E ∨ ∃ A ∈ 𝒜, α₂ u e ∪ A = E)} + let ψ : ι₂ → SplicedVert t₁ t₀ := fun v ↦ if hv : v ≠ t₁ then Sum.inl ⟨v, hv⟩ else Sum.inr s' + have hB'_sub : B' ⊆ ψ '' (B₂ \ {t₁}) := by + rintro x ⟨hleaf_x, e', he', hbad'⟩ + obtain ⟨z, hz, rfl⟩ := isTreeIncidence_iff_exists_adj.1 he' + cases x with + | inl v => + have hleaf_v : IsLeaf T₂ v.1 := (isLeaf_iff_of_neighborEquiv (hneigh₂ v)).1 hleaf_x + rw [hα'_inl v z hz] at hbad' + have hinc_v : IsTreeIncidence T₂ v.1 s(v.1, (hneigh₂ v ⟨z, hz⟩).1) := + isTreeIncidence_iff_adj.2 (hneigh₂ v ⟨z, hz⟩).2 + refine ⟨v.1, ⟨⟨hleaf_v, _, hinc_v, hbad'⟩, v.2⟩, ?_⟩ + simp [ψ, v.2] + | inr u => + exfalso + have hleaf_u : IsLeaf T₁ u.1 := (isLeaf_iff_of_neighborEquiv (hneigh₁ u)).1 hleaf_x + have hu_ne_s : u.1 ≠ s := fun h ↦ hs_not_leaf (h ▸ hleaf_u) + rcases (splicedTree_adj_iff hw₁ hs (Sum.inr u) z).1 hz with hG₀ | ⟨h1, _⟩ | ⟨h1, _⟩ + · rcases z with v | w + · exact hG₀.elim + · rw [hα'_inr_ne u w] at hbad' + exact hbad' (ht₀_only_bad u.1 s(u.1, w.1) (isTreeIncidence_iff_adj.2 hG₀) hleaf_u u.2) + · cases h1 + · injection h1 with hu_eq + exact hu_ne_s (congrArg Subtype.val hu_eq) + have ht₁_mem_B₂ : t₁ ∈ B₂ := + ⟨ht₁_leaf, s(t₁, w₁), isTreeIncidence_iff_adj.2 hadj_t₁w₁, ht₁_bad⟩ + have hncard_lt : B'.ncard < B₂.ncard := by + have h1 : B'.ncard ≤ (ψ '' (B₂ \ {t₁})).ncard := + Set.ncard_le_ncard hB'_sub (Set.toFinite _) + have h2 : (ψ '' (B₂ \ {t₁})).ncard ≤ (B₂ \ {t₁}).ncard := + Set.ncard_image_le (Set.toFinite _) + have h3 : (B₂ \ {t₁}).ncard < B₂.ncard := + Set.ncard_lt_ncard (Set.sdiff_singleton_ssubset.2 ht₁_mem_B₂) (Set.toFinite _) + exact (h1.trans h2).trans_lt h3 + exact ⟨SplicedVert t₁ t₀, inferInstance, T', α', htree_lab', hncard_lt⟩ + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/TangleLemmas.lean b/LeanPool/GraphMinor/GM10/TangleLemmas.lean new file mode 100644 index 0000000000..8bc8d3a6f4 --- /dev/null +++ b/LeanPool/GraphMinor/GM10/TangleLemmas.lean @@ -0,0 +1,1152 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Defs + +/-! +# Tangle Lemmas (Graph Minors X, Section 2) + +This file formalizes Section 2 of Graph Minors X (pages 155–158): +- Basic properties of subhypergraphs, separations, vertex/edge deletion, and extreme separations. +- `IsTangle.order_le_ncard_vertexSet` and `IsTangle.truncation` (Section 1, pages 154–155). +- `theorem_2_1` (Graph Minors X, (2.1), page 155). +- `theorem_2_2` (Graph Minors X, (2.2), page 155). +- `theorem_2_3` (Graph Minors X, (2.3), page 155). +- `theorem_2_4` (Graph Minors X, (2.4), page 156). +- `theorem_2_5` (Graph Minors X, (2.5), page 156). +- `theorem_2_7` (Graph Minors X, (2.7), page 157). +- `theorem_2_8` (Graph Minors X, (2.8), page 157). +- `theorem_2_9` (Graph Minors X, (2.9), page 158). +-/ + +public section + +namespace GraphMinor.GM10 + +open Hypergraph + +variable {α β : Type*} + +/-! ## Basic lemmas on hypergraphs and separations -/ + +@[simp] +theorem bot_vertexSet : (⊥ : Hypergraph α β).vertexSet = ∅ := rfl + +@[simp] +theorem bot_edgeSet : (⊥ : Hypergraph α β).edgeSet = ∅ := rfl + +@[simp] +theorem bot_inc (e : β) (v : α) : ¬ (⊥ : Hypergraph α β).Inc e v := id + +theorem isNonNull_iff_ne_bot (G : Hypergraph α β) : IsNonNull G ↔ G ≠ ⊥ := by + unfold IsNonNull + constructor + · rintro (⟨v, hv⟩ | ⟨e, he⟩) rfl + · exact hv + · exact he + · intro h + by_contra! hc + apply h + refine Hypergraph.ext hc.1 hc.2 ?_ + funext e v + simp only [bot_inc, eq_iff_iff, iff_false] + intro hinc + have he : e ∈ (∅ : Set β) := hc.2 ▸ G.edge_mem_of_inc hinc + exact he + +theorem union_vertexSet (G₁ G₂ : Hypergraph α β) : + (G₁ ∪ G₂).vertexSet = G₁.vertexSet ∪ G₂.vertexSet := + GraphMinor.Hypergraph.union_vertexSet_eq G₁ G₂ + +theorem union_edgeSet (G₁ G₂ : Hypergraph α β) : + (G₁ ∪ G₂).edgeSet = G₁.edgeSet ∪ G₂.edgeSet := + GraphMinor.Hypergraph.union_edgeSet_eq G₁ G₂ + +theorem union_inc (G₁ G₂ : Hypergraph α β) (e : β) (v : α) : + (G₁ ∪ G₂).Inc e v ↔ G₁.Inc e v ∨ G₂.Inc e v := + GraphMinor.Hypergraph.union_inc_iff G₁ G₂ e v + +theorem inter_vertexSet (G₁ G₂ : Hypergraph α β) : + (G₁ ∩ G₂).vertexSet = G₁.vertexSet ∩ G₂.vertexSet := + GraphMinor.Hypergraph.inter_vertexSet_eq G₁ G₂ + +theorem inter_edgeSet (G₁ G₂ : Hypergraph α β) : + (G₁ ∩ G₂).edgeSet = G₁.edgeSet ∩ G₂.edgeSet := + GraphMinor.Hypergraph.inter_edgeSet_eq G₁ G₂ + +theorem inter_inc (G₁ G₂ : Hypergraph α β) (e : β) (v : α) : + (G₁ ∩ G₂).Inc e v ↔ G₁.Inc e v ∧ G₂.Inc e v := + GraphMinor.Hypergraph.inter_inc_iff G₁ G₂ e v + +attribute [simp] GraphMinor.Hypergraph.union_vertexSet_eq + GraphMinor.Hypergraph.union_edgeSet_eq GraphMinor.Hypergraph.inter_vertexSet_eq + GraphMinor.Hypergraph.inter_edgeSet_eq + +theorem union_comm (G₁ G₂ : Hypergraph α β) : G₁ ∪ G₂ = G₂ ∪ G₁ := by + ext <;> simp [union_inc, Set.union_comm, or_comm] + +theorem union_assoc (G₁ G₂ G₃ : Hypergraph α β) : G₁ ∪ G₂ ∪ G₃ = G₁ ∪ (G₂ ∪ G₃) := by + ext <;> simp [union_inc, Set.union_assoc, or_assoc] + +theorem union_self (G : Hypergraph α β) : G ∪ G = G := by + ext <;> simp [union_inc] + +theorem inter_comm (G₁ G₂ : Hypergraph α β) : G₁ ∩ G₂ = G₂ ∩ G₁ := by + ext <;> simp [inter_inc, Set.inter_comm, and_comm] + +theorem inter_assoc (G₁ G₂ G₃ : Hypergraph α β) : G₁ ∩ G₂ ∩ G₃ = G₁ ∩ (G₂ ∩ G₃) := by + ext <;> simp [inter_inc, Set.inter_assoc, and_assoc] + +theorem inter_self (G : Hypergraph α β) : G ∩ G = G := by + ext <;> simp [inter_inc] + +theorem inc_iff_of_le {H G : Hypergraph α β} (h : H ≤ G) {e : β} {v : α} (he : e ∈ H.edgeSet) : + H.Inc e v ↔ G.Inc e v := by + have := Set.ext_iff.1 (h.ends_eq e he) v + exact this.symm + +theorem inc_of_le {H G : Hypergraph α β} (h : H ≤ G) {e : β} {v : α} (hinc : H.Inc e v) : + G.Inc e v := + (inc_iff_of_le h (H.edge_mem_of_inc hinc)).1 hinc + +theorem eq_of_le_of_vertexSet_eq_of_edgeSet_eq {H₁ H₂ G : Hypergraph α β} + (h₁ : H₁ ≤ G) (h₂ : H₂ ≤ G) (hV : H₁.vertexSet = H₂.vertexSet) + (hE : H₁.edgeSet = H₂.edgeSet) : H₁ = H₂ := by + refine Hypergraph.ext hV hE ?_ + funext e v + apply propext + by_cases he : e ∈ H₁.edgeSet + · rw [inc_iff_of_le h₁ he, inc_iff_of_le h₂ (hE ▸ he)] + · constructor <;> intro h + · exact (he (H₁.edge_mem_of_inc h)).elim + · exact (he (hE.symm ▸ H₂.edge_mem_of_inc h)).elim + +theorem le_iff_of_le {H₁ H₂ G : Hypergraph α β} (h₁ : H₁ ≤ G) (h₂ : H₂ ≤ G) : + H₁ ≤ H₂ ↔ H₁.vertexSet ⊆ H₂.vertexSet ∧ H₁.edgeSet ⊆ H₂.edgeSet := by + refine ⟨fun h ↦ ⟨h.vertexSet_subset, h.edgeSet_subset⟩, fun ⟨hV, hE⟩ ↦ ⟨hV, hE, fun e he ↦ ?_⟩⟩ + rw [← h₂.ends_eq e (hE he), ← h₁.ends_eq e he] + +theorem union_le {H₁ H₂ G : Hypergraph α β} (h₁ : H₁ ≤ G) (h₂ : H₂ ≤ G) : H₁ ∪ H₂ ≤ G where + vertexSet_subset := Set.union_subset h₁.vertexSet_subset h₂.vertexSet_subset + edgeSet_subset := Set.union_subset h₁.edgeSet_subset h₂.edgeSet_subset + ends_eq e he := by + ext v + simp only [ends, Set.mem_ofPred_eq, union_inc] + rcases he with he₁ | he₂ + · exact ⟨fun h ↦ Or.inl ((inc_iff_of_le h₁ he₁).2 h), + fun h ↦ h.elim (inc_of_le h₁) (inc_of_le h₂)⟩ + · exact ⟨fun h ↦ Or.inr ((inc_iff_of_le h₂ he₂).2 h), + fun h ↦ h.elim (inc_of_le h₁) (inc_of_le h₂)⟩ + +theorem le_union_left {H₁ H₂ G : Hypergraph α β} (h₁ : H₁ ≤ G) (h₂ : H₂ ≤ G) : + H₁ ≤ H₁ ∪ H₂ := + (le_iff_of_le h₁ (union_le h₁ h₂)).2 ⟨Set.subset_union_left, Set.subset_union_left⟩ + +theorem le_union_right {H₁ H₂ G : Hypergraph α β} (h₁ : H₁ ≤ G) (h₂ : H₂ ≤ G) : + H₂ ≤ H₁ ∪ H₂ := + (le_iff_of_le h₂ (union_le h₁ h₂)).2 ⟨Set.subset_union_right, Set.subset_union_right⟩ + +theorem inter_le {H₁ H₂ G : Hypergraph α β} (h₁ : H₁ ≤ G) (h₂ : H₂ ≤ G) : H₁ ∩ H₂ ≤ G where + vertexSet_subset := Set.inter_subset_left.trans h₁.vertexSet_subset + edgeSet_subset := Set.inter_subset_left.trans h₁.edgeSet_subset + ends_eq e he := by + ext v + simp only [ends, Set.mem_ofPred_eq, inter_inc] + rw [inc_iff_of_le h₁ he.1, inc_iff_of_le h₂ he.2, and_self] + +theorem inter_le_left {H₁ H₂ G : Hypergraph α β} (h₁ : H₁ ≤ G) (h₂ : H₂ ≤ G) : + H₁ ∩ H₂ ≤ H₁ := + (le_iff_of_le (inter_le h₁ h₂) h₁).2 ⟨Set.inter_subset_left, Set.inter_subset_left⟩ + +theorem inter_le_right {H₁ H₂ G : Hypergraph α β} (h₁ : H₁ ≤ G) (h₂ : H₂ ≤ G) : + H₁ ∩ H₂ ≤ H₂ := + (le_iff_of_le (inter_le h₁ h₂) h₂).2 ⟨Set.inter_subset_right, Set.inter_subset_right⟩ + +theorem eq_of_le_of_ncard_eq {H₁ H₂ : Hypergraph α β} (h : H₁ ≤ H₂) + (hV : H₂.vertexSet.ncard ≤ H₁.vertexSet.ncard) + (hE : H₂.edgeSet.ncard ≤ H₁.edgeSet.ncard) : H₁ = H₂ := by + have hV_eq : H₁.vertexSet = H₂.vertexSet := + Set.eq_of_subset_of_ncard_le h.vertexSet_subset hV H₂.vertexSet_finite + have hE_eq : H₁.edgeSet = H₂.edgeSet := + Set.eq_of_subset_of_ncard_le h.edgeSet_subset hE H₂.edgeSet_finite + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq h le_rfl hV_eq hE_eq + +theorem _root_.GraphMinor.Hypergraph.IsSeparation.symm {G A B : Hypergraph α β} + (h : G.IsSeparation A B) : G.IsSeparation B A where + left_le := h.right_le + right_le := h.left_le + union_eq := (union_comm B A).trans h.union_eq + edgeSet_inter_eq := by rw [inter_comm, h.edgeSet_inter_eq] + +theorem separationOrder_comm (A B : Hypergraph α β) : + separationOrder A B = separationOrder B A := + congrArg (fun G : Hypergraph α β ↦ G.vertexSet.ncard) (inter_comm A B) + +theorem _root_.GraphMinor.Hypergraph.IsSeparation.vertexSet_union {G A B : Hypergraph α β} + (h : G.IsSeparation A B) : A.vertexSet ∪ B.vertexSet = G.vertexSet := + congrArg Hypergraph.vertexSet h.union_eq + +theorem _root_.GraphMinor.Hypergraph.IsSeparation.edgeSet_union {G A B : Hypergraph α β} + (h : G.IsSeparation A B) : A.edgeSet ∪ B.edgeSet = G.edgeSet := + congrArg Hypergraph.edgeSet h.union_eq + +theorem _root_.GraphMinor.Hypergraph.IsSeparation.disjoint_edgeSet {G A B : Hypergraph α β} + (h : G.IsSeparation A B) : Disjoint A.edgeSet B.edgeSet := + Set.disjoint_iff_inter_eq_empty.2 h.edgeSet_inter_eq + +theorem _root_.GraphMinor.Hypergraph.IsSeparation.notMem_edgeSet_left {G A B : Hypergraph α β} + (h : G.IsSeparation A B) {e : β} (he : e ∈ B.edgeSet) : e ∉ A.edgeSet := + Set.disjoint_right.1 h.disjoint_edgeSet he + +theorem _root_.GraphMinor.Hypergraph.IsSeparation.notMem_edgeSet_right {G A B : Hypergraph α β} + (h : G.IsSeparation A B) {e : β} (he : e ∈ A.edgeSet) : e ∉ B.edgeSet := + Set.disjoint_left.1 h.disjoint_edgeSet he + +theorem isSeparation_iff_of_le {G A B : Hypergraph α β} (hA : A ≤ G) (hB : B ≤ G) : + G.IsSeparation A B ↔ + A.vertexSet ∪ B.vertexSet = G.vertexSet ∧ + A.edgeSet ∪ B.edgeSet = G.edgeSet ∧ + A.edgeSet ∩ B.edgeSet = ∅ := by + refine ⟨fun h ↦ ⟨h.vertexSet_union, h.edgeSet_union, h.edgeSet_inter_eq⟩, + fun ⟨hV, hE, hI⟩ ↦ ⟨hA, hB, ?_, hI⟩⟩ + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq (union_le hA hB) le_rfl hV hE + +theorem _root_.GraphMinor.Hypergraph.IsSeparation.union_inter {G A B A' B' : Hypergraph α β} + (h : G.IsSeparation A B) (h' : G.IsSeparation A' B') : + G.IsSeparation (A ∪ A') (B ∩ B') := by + have h1 : A ∪ A' ≤ G := union_le h.left_le h'.left_le + have h2 : B ∩ B' ≤ G := inter_le h.right_le h'.right_le + rw [isSeparation_iff_of_le h1 h2] + refine ⟨?_, ?_, ?_⟩ + · ext v + simp only [union_vertexSet, inter_vertexSet, Set.mem_union, Set.mem_inter_iff] + constructor + · rintro ((hv | hv) | ⟨hv, _⟩) + · exact h.left_le.vertexSet_subset hv + · exact h'.left_le.vertexSet_subset hv + · exact h.right_le.vertexSet_subset hv + · intro hv + have hv1 : v ∈ A.vertexSet ∪ B.vertexSet := by rwa [h.vertexSet_union] + have hv2 : v ∈ A'.vertexSet ∪ B'.vertexSet := by rwa [h'.vertexSet_union] + rcases hv1 with hvA | hvB <;> rcases hv2 with hvA' | hvB' <;> tauto + · ext e + simp only [union_edgeSet, inter_edgeSet, Set.mem_union, Set.mem_inter_iff] + constructor + · rintro ((he | he) | ⟨he, _⟩) + · exact h.left_le.edgeSet_subset he + · exact h'.left_le.edgeSet_subset he + · exact h.right_le.edgeSet_subset he + · intro he + have he1 : e ∈ A.edgeSet ∪ B.edgeSet := by rwa [h.edgeSet_union] + have he2 : e ∈ A'.edgeSet ∪ B'.edgeSet := by rwa [h'.edgeSet_union] + rcases he1 with heA | heB <;> rcases he2 with heA' | heB' <;> tauto + · ext e + change e ∈ (A.edgeSet ∪ A'.edgeSet) ∩ (B.edgeSet ∩ B'.edgeSet) ↔ e ∈ (∅ : Set β) + simp only [Set.mem_inter_iff, Set.mem_union, Set.mem_empty_iff_false, iff_false] + rintro ⟨he | he, heB, heB'⟩ + · exact h.notMem_edgeSet_right he heB + · exact h'.notMem_edgeSet_right he heB' + +theorem deleteEdges_le (G : Hypergraph α β) (F : Set β) : G.deleteEdges F ≤ G where + vertexSet_subset := subset_rfl + edgeSet_subset := Set.sdiff_subset + ends_eq e he := by + ext v + simp [ends, deleteEdges, he.2] + +theorem deleteVertices_le (G : Hypergraph α β) (X : Set α) : G.deleteVertices X ≤ G where + vertexSet_subset := Set.sdiff_subset + edgeSet_subset _ h := h.1 + ends_eq e he := by + ext v + exact ⟨fun h ↦ ⟨h, he.2⟩, fun h ↦ h.1⟩ + +theorem edgeHypergraph_le {G : Hypergraph α β} {e : β} (he : e ∈ G.edgeSet) : + edgeHypergraph G e ≤ G where + vertexSet_subset _ h := G.vertex_mem_of_inc h + edgeSet_subset := Set.singleton_subset_iff.2 he + ends_eq e' he' := by + rcases Set.mem_singleton_iff.1 he' with rfl + ext v + simp [ends, edgeHypergraph] + +theorem vertexHypergraph_le {G : Hypergraph α β} {v : α} (hv : v ∈ G.vertexSet) : + (vertexHypergraph v : Hypergraph α β) ≤ G where + vertexSet_subset := Set.singleton_subset_iff.2 hv + edgeSet_subset := Set.empty_subset _ + ends_eq _ h := h.elim + +theorem isSeparation_edgeHypergraph_deleteEdges {G : Hypergraph α β} {e : β} + (he : e ∈ G.edgeSet) : + G.IsSeparation (edgeHypergraph G e) (G.deleteEdges {e}) := by + rw [isSeparation_iff_of_le (edgeHypergraph_le he) (deleteEdges_le G {e})] + refine ⟨?_, ?_, ?_⟩ + · exact Set.union_eq_right.2 fun _ hv ↦ G.vertex_mem_of_inc hv + · simpa [edgeHypergraph, deleteEdges] using Set.insert_sdiff_self_of_mem he + · simp [edgeHypergraph, deleteEdges] + +theorem separationOrder_edgeHypergraph_deleteEdges (G : Hypergraph α β) (e : β) : + separationOrder (edgeHypergraph G e) (G.deleteEdges {e}) = edgeSize G e := by + have : G.ends e ⊆ G.vertexSet := fun _ h ↦ G.vertex_mem_of_inc h + simp [separationOrder, edgeHypergraph, deleteEdges, edgeSize, Set.inter_eq_left.2 this] + +theorem isSeparation_vertexHypergraph_deleteVertices {G : Hypergraph α β} {v : α} + (hv : v ∈ G.vertexSet) (hiso : ∀ e, ¬ G.Inc e v) : + G.IsSeparation (vertexHypergraph v) (G.deleteVertices {v}) := by + rw [isSeparation_iff_of_le (vertexHypergraph_le hv) (deleteVertices_le G {v})] + refine ⟨?_, ?_, ?_⟩ + · simpa [vertexHypergraph, deleteVertices] using Set.insert_sdiff_self_of_mem hv + · ext e + simp [vertexHypergraph, deleteVertices, hiso e] + · simp [vertexHypergraph, deleteVertices] + +theorem separationOrder_vertexHypergraph_deleteVertices (G : Hypergraph α β) (v : α) : + separationOrder (vertexHypergraph v) (G.deleteVertices {v}) = 0 := by + simp [separationOrder, vertexHypergraph, deleteVertices] + +/-! ## Section 1 remarks: tangle order bound and truncation -/ + +/-- Every tangle `𝒯` in `G` has order `≤ |V(G)|` (Graph Minors X, Section 1, page 154): +"Every tangle $\mathscr{T}$ has order $\le |V(G)|$, since $(G, G \setminus E(G)), (G +\setminus E(G), G) \notin \mathscr{T}$." -/ +theorem IsTangle.order_le_ncard_vertexSet {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) : + θ ≤ G.vertexSet.ncard := by + by_contra! hlt + have hsep : G.IsSeparation G (G.deleteEdges G.edgeSet) := by + rw [isSeparation_iff_of_le le_rfl (deleteEdges_le G G.edgeSet)] + simp [deleteEdges] + have hord : separationOrder G (G.deleteEdges G.edgeSet) < θ := by + simpa [separationOrder, deleteEdges] using hlt + rcases h𝒯.axiom1 hsep hord with h1 | h2 + · exact h𝒯.axiom3 h1 rfl + · exact h𝒯.axiom3 h2 rfl + +theorem bddAbove_tangle_orders (G : Hypergraph α β) : + BddAbove {θ : ℕ | ∃ 𝒯, IsTangle G θ 𝒯} := + ⟨G.vertexSet.ncard, fun _ ⟨_, h𝒯⟩ ↦ h𝒯.order_le_ncard_vertexSet⟩ + +theorem IsTangle.le_tangleNumber {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) : + θ ≤ tangleNumber G := + le_csSup (bddAbove_tangle_orders G) ⟨𝒯, h𝒯⟩ + +theorem tangleNumber_le_ncard_vertexSet (G : Hypergraph α β) : + tangleNumber G ≤ G.vertexSet.ncard := by + unfold tangleNumber + rcases Set.eq_empty_or_nonempty {θ : ℕ | ∃ 𝒯, IsTangle G θ 𝒯} with h | h + · simp [h] + · exact csSup_le h fun _ ⟨_, h𝒯⟩ ↦ h𝒯.order_le_ncard_vertexSet + +/-- The truncation of a tangle of order `θ` to order `θ'` (`1 ≤ θ' ≤ θ`) is a tangle of order `θ'` +(Graph Minors X, Section 1, page 155, and Section 6, page 170). -/ +theorem IsTangle.truncation {G : Hypergraph α β} {θ θ' : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + (h1 : 1 ≤ θ') (hle : θ' ≤ θ) : + IsTangle G θ' (truncation 𝒯 θ') where + one_le := h1 + isSeparation _ _ h := h𝒯.isSeparation h.1 + order_lt _ _ h := h.2 + axiom1 A B hsep hord := by + rcases h𝒯.axiom1 hsep (hord.trans_le hle) with h | h + · exact Or.inl ⟨h, hord⟩ + · exact Or.inr ⟨h, by rwa [separationOrder_comm]⟩ + axiom2 _ _ _ _ _ _ h1 h2 h3 := h𝒯.axiom2 h1.1 h2.1 h3.1 + axiom3 _ _ h := h𝒯.axiom3 h.1 + +theorem exists_isTangle_of_le_tangleNumber {G : Hypergraph α β} {θ : ℕ} + (h1 : 1 ≤ θ) (hle : θ ≤ tangleNumber G) : + ∃ 𝒯, IsTangle G θ 𝒯 := by + have hne : {θ' : ℕ | ∃ 𝒯, IsTangle G θ' 𝒯}.Nonempty := by + by_contra! hemp + have : tangleNumber G = 0 := by simp [tangleNumber, hemp] + omega + obtain ⟨𝒯, h𝒯⟩ := Nat.sSup_mem hne (bddAbove_tangle_orders G) + exact ⟨truncation 𝒯 θ, h𝒯.truncation h1 hle⟩ + +/-! ## Section 2: Tangle Lemmas (2.1)–(2.5), (2.7)–(2.9) -/ + +/-- **Graph Minors X, (2.1)** (page 155): +"If $\mathscr{T}$ is a tangle and $(A, B) \in \mathscr{T}$ then $(B, A) \notin \mathscr{T}$." -/ +theorem theorem_2_1_proof {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {A B : Hypergraph α β} (hAB : (A, B) ∈ 𝒯) : + (B, A) ∉ 𝒯 := by + intro hBA + have hsep := h𝒯.isSeparation hAB + apply h𝒯.axiom2 hAB hAB hBA + rw [union_self, hsep.union_eq] + +/-- **Graph Minors X, (2.2)** (page 155): +"If $\mathscr{T}$ is a tangle of order $\theta$ and $(A, B), (A', B') \in \mathscr{T}$ and +$(A \cup A', B \cap B')$ has order $< \theta$ then $(A \cup A', B \cap B') \in \mathscr{T}$." -/ +theorem theorem_2_2_proof {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {A B A' B' : Hypergraph α β} (hAB : (A, B) ∈ 𝒯) (hA'B' : (A', B') ∈ 𝒯) + (hord : separationOrder (A ∪ A') (B ∩ B') < θ) : + (A ∪ A', B ∩ B') ∈ 𝒯 := by + have hsep1 := h𝒯.isSeparation hAB + have hsep2 := h𝒯.isSeparation hA'B' + have hsep : G.IsSeparation (A ∪ A') (B ∩ B') := hsep1.union_inter hsep2 + rcases h𝒯.axiom1 hsep hord with h | h + · exact h + · exfalso + exact h𝒯.axiom2 hAB hA'B' h hsep.union_eq + +/-- **Graph Minors X, (2.3)** (page 155): +"If $\mathscr{T}$ has order $\ge 2$ and $(A_1, B_1), (A_2, B_2), (A_3, B_3) \in \mathscr{T}$ +then $E(A_1 \cup A_2 \cup A_3) \ne E(G)$." -/ +theorem theorem_2_3_proof {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) (hθ : 2 ≤ θ) + {A₁ B₁ A₂ B₂ A₃ B₃ : Hypergraph α β} + (h₁ : (A₁, B₁) ∈ 𝒯) (h₂ : (A₂, B₂) ∈ 𝒯) (h₃ : (A₃, B₃) ∈ 𝒯) : + (A₁ ∪ A₂ ∪ A₃).edgeSet ≠ G.edgeSet := by + intro hE_bad + let S : Set ℕ := + {n : ℕ | ∃ A₁' B₁', (A₁', B₁') ∈ 𝒯 ∧ (A₁' ∪ A₂ ∪ A₃).edgeSet = G.edgeSet ∧ + A₁'.vertexSet.ncard = n} + have hSne : S.Nonempty := ⟨A₁.vertexSet.ncard, A₁, B₁, h₁, hE_bad, rfl⟩ + have hSbdd : BddAbove S := by + refine ⟨G.vertexSet.ncard, ?_⟩ + rintro n ⟨A₁', B₁', h1', -, rfl⟩ + exact Set.ncard_le_ncard (h𝒯.isSeparation h1').left_le.vertexSet_subset G.vertexSet_finite + obtain ⟨A₁', B₁', h₁', hE', hmax⟩ := Nat.sSup_mem hSne hSbdd + have hle_max : ∀ A₁'' B₁'', (A₁'', B₁'') ∈ 𝒯 → (A₁'' ∪ A₂ ∪ A₃).edgeSet = G.edgeSet → + A₁''.vertexSet.ncard ≤ A₁'.vertexSet.ncard := by + intro A₁'' B₁'' hm hE'' + rw [hmax] + exact le_csSup hSbdd ⟨A₁'', B₁'', hm, hE'', rfl⟩ + have hU_le : A₁' ∪ A₂ ∪ A₃ ≤ G := + union_le (union_le (h𝒯.isSeparation h₁').left_le (h𝒯.isSeparation h₂).left_le) + (h𝒯.isSeparation h₃).left_le + have hU_ne : A₁' ∪ A₂ ∪ A₃ ≠ G := h𝒯.axiom2 h₁' h₂ h₃ + have hV_ne : (A₁' ∪ A₂ ∪ A₃).vertexSet ≠ G.vertexSet := by + intro hV' + exact hU_ne (eq_of_le_of_vertexSet_eq_of_edgeSet_eq hU_le le_rfl hV' hE') + obtain ⟨v, hvG, hv_not⟩ := Set.exists_of_ssubset + (ssubset_of_subset_of_ne hU_le.vertexSet_subset hV_ne) + have hiso : ∀ e, ¬ G.Inc e v := by + intro e hinc + have he : e ∈ (A₁' ∪ A₂ ∪ A₃).edgeSet := hE'.symm ▸ G.edge_mem_of_inc hinc + have hinc' : (A₁' ∪ A₂ ∪ A₃).Inc e v := (inc_iff_of_le hU_le he).2 hinc + exact hv_not ((A₁' ∪ A₂ ∪ A₃).vertex_mem_of_inc hinc') + let K : Hypergraph α β := vertexHypergraph v + have hsepK : G.IsSeparation K (G.deleteVertices {v}) := + isSeparation_vertexHypergraph_deleteVertices hvG hiso + have hordK : separationOrder K (G.deleteVertices {v}) < θ := by + rw [separationOrder_vertexHypergraph_deleteVertices] + omega + have hKG_not : (G.deleteVertices {v}, K) ∉ 𝒯 := by + intro hGK + have hsepKG : G.IsSeparation K G := by + rw [isSeparation_iff_of_le (vertexHypergraph_le hvG) le_rfl] + simp [vertexHypergraph, Set.insert_eq_of_mem hvG] + have hordKG : separationOrder K G < θ := by + have : (K ∩ G).vertexSet = {v} := by + simp [K, vertexHypergraph, Set.singleton_subset_iff.2 hvG] + rw [separationOrder, this, Set.ncard_singleton] + exact hθ + have hGK_full_not : (G, K) ∉ 𝒯 := by + intro hGK_full + apply h𝒯.axiom2 hGK_full hGK_full hGK_full + simp [union_self] + have hKG_mem : (K, G) ∈ 𝒯 := (h𝒯.axiom1 hsepKG hordKG).resolve_right hGK_full_not + apply h𝒯.axiom2 hGK hKG_mem hKG_mem + rw [union_assoc, union_self, union_comm, hsepK.union_eq] + have hKG : (K, G.deleteVertices {v}) ∈ 𝒯 := + (h𝒯.axiom1 hsepK hordK).resolve_right hKG_not + have hord_union : separationOrder (K ∪ A₁') ((G.deleteVertices {v}) ∩ B₁') < θ := by + have hsub : ((K ∪ A₁') ∩ (G.deleteVertices {v} ∩ B₁')).vertexSet ⊆ + (A₁' ∩ B₁').vertexSet := by + intro x hx + simp only [inter_vertexSet, union_vertexSet, K, vertexHypergraph, deleteVertices, + Set.mem_inter_iff, Set.mem_union, Set.mem_singleton_iff, Set.mem_sdiff] at hx ⊢ + rcases hx with ⟨rfl | hxA, ⟨_, hne⟩, hxB⟩ + · exact (hne rfl).elim + · exact ⟨hxA, hxB⟩ + have hle_ord : separationOrder (K ∪ A₁') ((G.deleteVertices {v}) ∩ B₁') ≤ + separationOrder A₁' B₁' := + Set.ncard_le_ncard hsub ((A₁' ∩ B₁').vertexSet_finite) + exact hle_ord.trans_lt (h𝒯.order_lt h₁') + have hKA_mem : (K ∪ A₁', (G.deleteVertices {v}) ∩ B₁') ∈ 𝒯 := + theorem_2_2_proof h𝒯 hKG h₁' hord_union + have hKA_edge : ((K ∪ A₁') ∪ A₂ ∪ A₃).edgeSet = G.edgeSet := by + simpa [K, vertexHypergraph] using hE' + have hv_not_A₁ : v ∉ A₁'.vertexSet := fun hvA ↦ hv_not (Or.inl (Or.inl hvA)) + have hcard : (K ∪ A₁').vertexSet.ncard = A₁'.vertexSet.ncard + 1 := by + change ({v} ∪ A₁'.vertexSet).ncard = A₁'.vertexSet.ncard + 1 + rw [Set.singleton_union, Set.ncard_insert_of_notMem hv_not_A₁ A₁'.vertexSet_finite] + have := hle_max (K ∪ A₁') ((G.deleteVertices {v}) ∩ B₁') hKA_mem hKA_edge + omega + +/-- Any hypergraph admitting a tangle of order `θ ≥ 2` has at least one edge. -/ +theorem IsTangle.edgeSet_nonempty_of_two_le {α β : Type*} {G : Hypergraph α β} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} (hT : IsTangle G θ T) (hθ : 2 ≤ θ) : + G.edgeSet.Nonempty := by + have hsep : G.IsSeparation ⊥ G := by + rw [isSeparation_iff_of_le bot_le le_rfl] + simp + have hord : separationOrder (⊥ : Hypergraph α β) G < θ := by + simpa [separationOrder] using (show 0 < θ by omega) + have hbot : (⊥, G) ∈ T := + (hT.axiom1 hsep hord).resolve_right fun hG => hT.axiom3 hG rfl + have hne := GM10.theorem_2_3_proof hT hθ hbot hbot hbot + rw [GM10.union_self, GM10.union_self, bot_edgeSet] at hne + exact Set.nonempty_iff_ne_empty.mpr hne.symm + +/-- **Graph Minors X, (2.4)** (page 156): +"Let $\theta \ge 1$, and let $e$ be an edge of $G$ with size $\ge \theta$. Let $\mathscr{T}$ +be the set of all separations $(A, B)$ of $G$ of order $< \theta$ with $e \in E(B)$. Then +$\mathscr{T}$ is a tangle of order $\theta$." -/ +theorem theorem_2_4_proof {G : Hypergraph α β} {θ : ℕ} (hθ : 1 ≤ θ) {e : β} + (he : e ∈ G.edgeSet) (hsize : θ ≤ edgeSize G e) : + IsTangle G θ + {p | G.IsSeparation p.1 p.2 ∧ separationOrder p.1 p.2 < θ ∧ e ∈ p.2.edgeSet} where + one_le := hθ + isSeparation _ _ h := h.1 + order_lt _ _ h := h.2.1 + axiom1 A B hsep hord := by + have heAB : e ∈ A.edgeSet ∪ B.edgeSet := hsep.edgeSet_union.symm ▸ he + rcases heAB with heA | heB + · exact Or.inr ⟨hsep.symm, by rwa [separationOrder_comm], heA⟩ + · exact Or.inl ⟨hsep, hord, heB⟩ + axiom2 A₁ B₁ A₂ B₂ A₃ B₃ h1 h2 h3 hU := by + have he1 : e ∉ A₁.edgeSet := h1.1.notMem_edgeSet_left h1.2.2 + have he2 : e ∉ A₂.edgeSet := h2.1.notMem_edgeSet_left h2.2.2 + have he3 : e ∉ A₃.edgeSet := h3.1.notMem_edgeSet_left h3.2.2 + have heU : e ∈ (A₁ ∪ A₂ ∪ A₃).edgeSet := hU.symm ▸ he + simp only [union_edgeSet, Set.mem_union] at heU + tauto + axiom3 A B h hVA := by + rcases h with ⟨hsep, hord, heB⟩ + dsimp only at hsep hord heB + have hends : G.ends e ⊆ (A ∩ B).vertexSet := by + intro v hv + have hvG : v ∈ A.vertexSet := hVA.symm ▸ G.vertex_mem_of_inc hv + have hvB : v ∈ B.vertexSet := B.vertex_mem_of_inc ((inc_iff_of_le hsep.right_le heB).2 hv) + exact ⟨hvG, hvB⟩ + have hle : edgeSize G e ≤ separationOrder A B := + Set.ncard_le_ncard hends (A ∩ B).vertexSet_finite + omega + +/-- **Graph Minors X, (2.5)** (page 156): +"$G$ has a tangle if and only if $V(G) \ne \emptyset$." -/ +theorem theorem_2_5_proof (G : Hypergraph α β) : + (∃ θ 𝒯, IsTangle G θ 𝒯) ↔ G.vertexSet.Nonempty := by + constructor + · rintro ⟨θ, 𝒯, h𝒯⟩ + have h1 := h𝒯.one_le + have h2 := h𝒯.order_le_ncard_vertexSet + exact Set.nonempty_of_ncard_ne_zero (by omega) + · rintro ⟨v, hv⟩ + refine ⟨1, {p | G.IsSeparation p.1 p.2 ∧ separationOrder p.1 p.2 < 1 ∧ v ∈ p.2.vertexSet}, + ⟨le_rfl, fun _ _ h ↦ h.1, fun _ _ h ↦ h.2.1, ?_, ?_, ?_⟩⟩ + · intro A B hsep hord + have hvAB : v ∈ A.vertexSet ∪ B.vertexSet := hsep.vertexSet_union.symm ▸ hv + rcases hvAB with hvA | hvB + · exact Or.inr ⟨hsep.symm, by rwa [separationOrder_comm], hvA⟩ + · exact Or.inl ⟨hsep, hord, hvB⟩ + · intro A₁ B₁ A₂ B₂ A₃ B₃ h1 h2 h3 hU + have notMem_left : ∀ {A B : Hypergraph α β}, G.IsSeparation A B → separationOrder A B < 1 → + v ∈ B.vertexSet → v ∉ A.vertexSet := by + intro A B _ hord hvB hvA + dsimp only [separationOrder] at hord + have hemp : (A ∩ B).vertexSet = ∅ := + (Set.ncard_eq_zero (A ∩ B).vertexSet_finite).1 (by omega) + exact Set.notMem_empty v (hemp ▸ ⟨hvA, hvB⟩) + have hv1 := notMem_left h1.1 h1.2.1 h1.2.2 + have hv2 := notMem_left h2.1 h2.2.1 h2.2.2 + have hv3 := notMem_left h3.1 h3.2.1 h3.2.2 + have hvU : v ∈ (A₁ ∪ A₂ ∪ A₃).vertexSet := hU.symm ▸ hv + simp only [union_vertexSet, Set.mem_union] at hvU + tauto + · intro A B ⟨_, hord, hvB⟩ hVA + dsimp only [separationOrder] at hord hvB + have hemp : (A ∩ B).vertexSet = ∅ := + (Set.ncard_eq_zero (A ∩ B).vertexSet_finite).1 (by omega) + exact Set.notMem_empty v (hemp ▸ ⟨hVA.symm ▸ hv, hvB⟩) + +/-- **Graph Minors X, (2.7)** (page 157): +"Let $\mathscr{T}$ be a set of separations of a hypergraph $G$, each of order $<\theta$, +satisfying the first and second tangle axioms. Then $\mathscr{T}$ is a tangle if and only if +$(K_e, G\setminus e)\in \mathscr{T}$ for every $e\in E(G)$ of size $<\theta$, where $K_e$ is +the hypergraph formed by $e$ and its ends." -/ +theorem theorem_2_7_proof {G : Hypergraph α β} {θ : ℕ} (hθ : 1 ≤ θ) + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (hsep : ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ 𝒯 → G.IsSeparation A B) + (hord : ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ 𝒯 → separationOrder A B < θ) + (hax1 : TangleAxiom1 G θ 𝒯) (hax2 : TangleAxiom2 G 𝒯) : + IsTangle G θ 𝒯 ↔ + ∀ e ∈ G.edgeSet, edgeSize G e < θ → + (edgeHypergraph G e, G.deleteEdges {e}) ∈ 𝒯 := by + constructor + · intro h𝒯 e he hsize + have hs := isSeparation_edgeHypergraph_deleteEdges he + have ho : separationOrder (edgeHypergraph G e) (G.deleteEdges {e}) < θ := by + rwa [separationOrder_edgeHypergraph_deleteEdges] + rcases h𝒯.axiom1 hs ho with h | h + · exact h + · exfalso + exact h𝒯.axiom3 h rfl + · intro hKe + refine ⟨hθ, hsep, hord, hax1, hax2, ?_⟩ + unfold TangleAxiom3 + by_contra! hnot3 + rcases hnot3 with ⟨A₀, B₀, hAB₀, hVA₀⟩ + let S : Set ℕ := {n : ℕ | ∃ A B, (A, B) ∈ 𝒯 ∧ A.vertexSet = G.vertexSet ∧ B.edgeSet.ncard = n} + have hSne : S.Nonempty := ⟨B₀.edgeSet.ncard, A₀, B₀, hAB₀, hVA₀, rfl⟩ + obtain ⟨A, B, hAB, hVA, hmin⟩ := Nat.sInf_mem hSne + have hle_min : ∀ A' B', (A', B') ∈ 𝒯 → A'.vertexSet = G.vertexSet → + B.edgeSet.ncard ≤ B'.edgeSet.ncard := by + intro A' B' hm hV' + rw [hmin] + exact Nat.sInf_le ⟨A', B', hm, hV', rfl⟩ + have hsepAB := hsep hAB + have hA_ne_G : A ≠ G := by + intro hAG + apply hax2 hAB hAB hAB + simp [union_self, hAG] + have hEB_ne : B.edgeSet.Nonempty := by + rw [Set.nonempty_iff_ne_empty] + intro hEB + apply hA_ne_G + have hEA : A.edgeSet = G.edgeSet := by + simpa [hEB] using hsepAB.edgeSet_union + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq hsepAB.left_le le_rfl hVA hEA + obtain ⟨e, heB⟩ := hEB_ne + have heG : e ∈ G.edgeSet := hsepAB.right_le.edgeSet_subset heB + have hends_sub : G.ends e ⊆ (A ∩ B).vertexSet := by + intro v hv + exact ⟨hVA.symm ▸ G.vertex_mem_of_inc hv, + B.vertex_mem_of_inc ((inc_iff_of_le hsepAB.right_le heB).2 hv)⟩ + have hsize : edgeSize G e < θ := + (Set.ncard_le_ncard hends_sub (A ∩ B).vertexSet_finite).trans_lt (hord hAB) + let Ke := edgeHypergraph G e + have hsep' : G.IsSeparation (A ∪ Ke) (B.deleteEdges {e}) := by + have h1 : A ∪ Ke ≤ G := union_le hsepAB.left_le (edgeHypergraph_le heG) + have h2 : B.deleteEdges {e} ≤ G := (deleteEdges_le B {e}).trans hsepAB.right_le + rw [isSeparation_iff_of_le h1 h2] + refine ⟨?_, ?_, ?_⟩ + · have hVK : Ke.vertexSet ⊆ G.vertexSet := (edgeHypergraph_le heG).vertexSet_subset + change (A.vertexSet ∪ Ke.vertexSet) ∪ B.vertexSet = G.vertexSet + rw [hVA, Set.union_eq_left.2 hVK, Set.union_eq_left.2 hsepAB.right_le.vertexSet_subset] + · ext f + simp only [union_edgeSet, Ke, edgeHypergraph, deleteEdges, Set.mem_union, + Set.mem_singleton_iff, Set.mem_sdiff] + constructor + · rintro ((hf | rfl) | ⟨hf, _⟩) + · exact hsepAB.left_le.edgeSet_subset hf + · exact heG + · exact hsepAB.right_le.edgeSet_subset hf + · intro hfG + by_cases hfe : f = e + · exact Or.inl (Or.inr hfe) + · have hfAB : f ∈ A.edgeSet ∪ B.edgeSet := by rwa [hsepAB.edgeSet_union] + rcases hfAB with hfA | hfB + · exact Or.inl (Or.inl hfA) + · exact Or.inr ⟨hfB, hfe⟩ + · ext f + change f ∈ (A.edgeSet ∪ {e}) ∩ (B.edgeSet \ {e}) ↔ f ∈ (∅ : Set β) + simp only [Set.mem_inter_iff, Set.mem_union, Set.mem_singleton_iff, Set.mem_sdiff, + Set.mem_empty_iff_false, iff_false] + rintro ⟨hfA | rfl, hfB, hne⟩ + · exact hsepAB.notMem_edgeSet_right hfA hfB + · exact hne rfl + have hVA' : (A ∪ Ke).vertexSet = G.vertexSet := by + have hVK : Ke.vertexSet ⊆ G.vertexSet := (edgeHypergraph_le heG).vertexSet_subset + simp [hVA, Set.union_eq_left.2 hVK] + have hord' : separationOrder (A ∪ Ke) (B.deleteEdges {e}) < θ := by + have : ((A ∪ Ke) ∩ B.deleteEdges {e}).vertexSet = (A ∩ B).vertexSet := by + simp [deleteEdges, hVA', hVA] + rw [separationOrder, this] + exact hord hAB + have hnot_mem : (A ∪ Ke, B.deleteEdges {e}) ∉ 𝒯 := by + intro hm + have hle := hle_min (A ∪ Ke) (B.deleteEdges {e}) hm hVA' + have hlt : (B.deleteEdges {e}).edgeSet.ncard < B.edgeSet.ncard := + Set.ncard_lt_ncard (Set.sdiff_singleton_ssubset.2 heB) B.edgeSet_finite + omega + have hmem_swap : (B.deleteEdges {e}, A ∪ Ke) ∈ 𝒯 := + (hax1 hsep' hord').resolve_left hnot_mem + have hKe_mem : (Ke, G.deleteEdges {e}) ∈ 𝒯 := hKe e heG hsize + apply hax2 hAB hmem_swap hKe_mem + rw [union_assoc, union_comm (B.deleteEdges {e}) Ke, ← union_assoc, hsep'.union_eq] + +/-! ### Extreme separations and (2.8), (2.9) -/ + +/-- Every separation `(A₀, B₀) ∈ 𝒯` can be extended to an extreme separation `(A, B) ∈ 𝒯` with +`A₀ ≤ A` and `B ≤ B₀`. -/ +theorem IsTangle.exists_isExtreme {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {A₀ B₀ : Hypergraph α β} (h₀ : (A₀, B₀) ∈ 𝒯) : + ∃ A B, IsExtreme 𝒯 A B ∧ A₀ ≤ A ∧ B ≤ B₀ := by + let score (A B : Hypergraph α β) : ℕ := + A.vertexSet.ncard + A.edgeSet.ncard + + (G.vertexSet.ncard - B.vertexSet.ncard) + (G.edgeSet.ncard - B.edgeSet.ncard) + let S : Set ℕ := {n : ℕ | ∃ A B, (A, B) ∈ 𝒯 ∧ A₀ ≤ A ∧ B ≤ B₀ ∧ score A B = n} + have hSne : S.Nonempty := ⟨score A₀ B₀, A₀, B₀, h₀, le_rfl, le_rfl, rfl⟩ + have hSbdd : BddAbove S := by + refine ⟨2 * (G.vertexSet.ncard + G.edgeSet.ncard), ?_⟩ + rintro n ⟨A, B, hAB, -, -, rfl⟩ + have hV : A.vertexSet.ncard ≤ G.vertexSet.ncard := + Set.ncard_le_ncard (h𝒯.isSeparation hAB).left_le.vertexSet_subset G.vertexSet_finite + have hE : A.edgeSet.ncard ≤ G.edgeSet.ncard := + Set.ncard_le_ncard (h𝒯.isSeparation hAB).left_le.edgeSet_subset G.edgeSet_finite + dsimp [score] + omega + obtain ⟨A, B, hAB, hA₀, hB₀, hmax⟩ := Nat.sSup_mem hSne hSbdd + refine ⟨A, B, ⟨hAB, ?_⟩, hA₀, hB₀⟩ + intro A' B' hA'B' hAA' hB'B + have hle_score : score A' B' ≤ score A B := by + rw [hmax] + exact le_csSup hSbdd ⟨A', B', hA'B', hA₀.trans hAA', hB'B.trans hB₀, rfl⟩ + have hAV : A.vertexSet.ncard ≤ A'.vertexSet.ncard := + Set.ncard_le_ncard hAA'.vertexSet_subset A'.vertexSet_finite + have hAE : A.edgeSet.ncard ≤ A'.edgeSet.ncard := + Set.ncard_le_ncard hAA'.edgeSet_subset A'.edgeSet_finite + have hBV : B'.vertexSet.ncard ≤ B.vertexSet.ncard := + Set.ncard_le_ncard hB'B.vertexSet_subset B.vertexSet_finite + have hBE : B'.edgeSet.ncard ≤ B.edgeSet.ncard := + Set.ncard_le_ncard hB'B.edgeSet_subset B.edgeSet_finite + have hBGV : B.vertexSet.ncard ≤ G.vertexSet.ncard := + Set.ncard_le_ncard (h𝒯.isSeparation hAB).right_le.vertexSet_subset G.vertexSet_finite + have hBGE : B.edgeSet.ncard ≤ G.edgeSet.ncard := + Set.ncard_le_ncard (h𝒯.isSeparation hAB).right_le.edgeSet_subset G.edgeSet_finite + dsimp [score] at hle_score + refine ⟨(eq_of_le_of_ncard_eq hAA' (by omega) (by omega)).symm, + eq_of_le_of_ncard_eq hB'B (by omega) (by omega)⟩ + +/-- Enlarging the small side of an extreme separation by one vertex raises its order by one. +Neither orientation of the enlarged separation belongs to the tangle. -/ +theorem IsTangle.exists_enlarged_extreme_separation {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {A B : Hypergraph α β} (hext : IsExtreme 𝒯 A B) : + ∃ A', G.IsSeparation A' B ∧ separationOrder A' B = separationOrder A B + 1 ∧ + (A', B) ∉ 𝒯 ∧ (B, A') ∉ 𝒯 := by + have hAB := hext.1 + have hsep := h𝒯.isSeparation hAB + have hVA_ne := h𝒯.axiom3 hAB + obtain ⟨v, hvG, hv_notA⟩ := Set.exists_of_ssubset + (ssubset_of_subset_of_ne hsep.left_le.vertexSet_subset hVA_ne) + have hvB : v ∈ B.vertexSet := + (hsep.vertexSet_union.symm ▸ hvG).resolve_left hv_notA + let Kv : Hypergraph α β := vertexHypergraph v + have hKv_le_G : Kv ≤ G := vertexHypergraph_le hvG + have hsep' : G.IsSeparation (A ∪ Kv) B := by + rw [isSeparation_iff_of_le (union_le hsep.left_le hKv_le_G) hsep.right_le] + refine ⟨?_, ?_, ?_⟩ + · change (A.vertexSet ∪ {v}) ∪ B.vertexSet = G.vertexSet + rw [Set.union_assoc, Set.singleton_union, Set.insert_eq_of_mem hvB, hsep.vertexSet_union] + · simp [Kv, vertexHypergraph, hsep.edgeSet_union] + · simpa [union_edgeSet, Kv, vertexHypergraph] using hsep.edgeSet_inter_eq + have hAK_not : (A ∪ Kv, B) ∉ 𝒯 := by + intro hm + have hAK_eq := (hext.2 hm (le_union_left hsep.left_le hKv_le_G) le_rfl).1 + have hvA : v ∈ A.vertexSet := by + rw [← hAK_eq] + exact Or.inr (Set.mem_singleton v) + exact hv_notA hvA + have hBAK_not : (B, A ∪ Kv) ∉ 𝒯 := by + intro hm + apply h𝒯.axiom2 hAB hAB hm + rw [union_self, hsep.union_eq] + have hset_eq : ((A ∪ Kv) ∩ B).vertexSet = insert v (A ∩ B).vertexSet := by + ext x + simp only [inter_vertexSet, union_vertexSet, Kv, vertexHypergraph, Set.mem_inter_iff, + Set.mem_union, Set.mem_singleton_iff, Set.mem_insert_iff] + constructor + · rintro ⟨hxA | rfl, hxB⟩ + · exact Or.inr ⟨hxA, hxB⟩ + · exact Or.inl rfl + · rintro (rfl | ⟨hxA, hxB⟩) + · exact ⟨Or.inr rfl, hvB⟩ + · exact ⟨Or.inl hxA, hxB⟩ + have hv_notAB : v ∉ (A ∩ B).vertexSet := fun h ↦ hv_notA h.1 + have hcard : separationOrder (A ∪ Kv) B = separationOrder A B + 1 := by + rw [separationOrder, hset_eq, Set.ncard_insert_of_notMem hv_notAB (A ∩ B).vertexSet_finite, + separationOrder] + exact ⟨A ∪ Kv, hsep', hcard, hAK_not, hBAK_not⟩ + +/-- First part of **Graph Minors X, (2.8)** (page 157): +"Let $\mathscr{T}$ be a tangle of order $\theta$ in a hypergraph $G$, and let $(A, B)\in +\mathscr{T}$ be extreme. Then $(A, B)$ has order $\theta - 1$." -/ +theorem theorem_2_8_order {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {A B : Hypergraph α β} (hext : IsExtreme 𝒯 A B) : + separationOrder A B = θ - 1 := by + obtain ⟨A', hsep, hord, hnot, hnotRev⟩ := h𝒯.exists_enlarged_extreme_separation hext + have hlt := h𝒯.order_lt hext.1 + have hge : θ ≤ separationOrder A' B := + Nat.le_of_not_gt fun h => (h𝒯.axiom1 hsep h).elim hnot hnotRev + omega + +/-- Second part of **Graph Minors X, (2.8)** (page 157): +"Moreover, if $(B_1, B_2)$ is a separation of $B$, then either $B_1\subseteq A\cap B$ and $B_2 = B$, +or $B_2\subseteq A\cap B$ and $B_1 = B$, or $(B_1, B_2)$ has order strictly greater than +$$\min(|V(A\cap B_1)|, |V(A\cap B_2)|).$$" -/ +theorem theorem_2_8_separation {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {A B B₁ B₂ : Hypergraph α β} (hext : IsExtreme 𝒯 A B) (hB : B.IsSeparation B₁ B₂) : + (B₁ ≤ A ∩ B ∧ B₂ = B) ∨ (B₂ ≤ A ∩ B ∧ B₁ = B) ∨ + min (A ∩ B₁).vertexSet.ncard (A ∩ B₂).vertexSet.ncard < separationOrder B₁ B₂ := by + have hAB := hext.1 + have hsep := h𝒯.isSeparation hAB + have hB₁_G : B₁ ≤ G := hB.left_le.trans hsep.right_le + have hB₂_G : B₂ ≤ G := hB.right_le.trans hsep.right_le + have hsep1 : G.IsSeparation (A ∪ B₁) B₂ := by + rw [isSeparation_iff_of_le (union_le hsep.left_le hB₁_G) hB₂_G] + refine ⟨?_, ?_, ?_⟩ + · rw [union_vertexSet, Set.union_assoc, hB.vertexSet_union, hsep.vertexSet_union] + · rw [union_edgeSet, Set.union_assoc, hB.edgeSet_union, hsep.edgeSet_union] + · ext e + simp only [union_edgeSet, Set.mem_inter_iff, Set.mem_union, Set.mem_empty_iff_false, + iff_false, not_and] + rintro (heA | heB₁) heB₂ + · exact hsep.notMem_edgeSet_right heA (hB.right_le.edgeSet_subset heB₂) + · exact hB.notMem_edgeSet_right heB₁ heB₂ + have hsep2 : G.IsSeparation (A ∪ B₂) B₁ := by + rw [isSeparation_iff_of_le (union_le hsep.left_le hB₂_G) hB₁_G] + refine ⟨?_, ?_, ?_⟩ + · rw [union_vertexSet, Set.union_assoc, Set.union_comm B₂.vertexSet, hB.vertexSet_union, + hsep.vertexSet_union] + · rw [union_edgeSet, Set.union_assoc, Set.union_comm B₂.edgeSet, hB.edgeSet_union, + hsep.edgeSet_union] + · ext e + simp only [union_edgeSet, Set.mem_inter_iff, Set.mem_union, Set.mem_empty_iff_false, + iff_false, not_and] + rintro (heA | heB₂) heB₁ + · exact hsep.notMem_edgeSet_right heA (hB.left_le.edgeSet_subset heB₁) + · exact hB.notMem_edgeSet_left heB₂ heB₁ + by_cases heq1 : A ∪ B₁ = A ∧ B₂ = B + · left + refine ⟨?_, heq1.2⟩ + have hB₁_A : B₁ ≤ A := heq1.1 ▸ le_union_right hsep.left_le hB₁_G + exact (le_iff_of_le hB₁_G (inter_le hsep.left_le hsep.right_le)).2 + ⟨Set.subset_inter hB₁_A.vertexSet_subset hB.left_le.vertexSet_subset, + Set.subset_inter hB₁_A.edgeSet_subset hB.left_le.edgeSet_subset⟩ + by_cases heq2 : A ∪ B₂ = A ∧ B₁ = B + · right; left + refine ⟨?_, heq2.2⟩ + have hB₂_A : B₂ ≤ A := heq2.1 ▸ le_union_right hsep.left_le hB₂_G + exact (le_iff_of_le hB₂_G (inter_le hsep.left_le hsep.right_le)).2 + ⟨Set.subset_inter hB₂_A.vertexSet_subset hB.right_le.vertexSet_subset, + Set.subset_inter hB₂_A.edgeSet_subset hB.right_le.edgeSet_subset⟩ + right; right + have hnot1 : (A ∪ B₁, B₂) ∉ 𝒯 := fun hm ↦ + heq1 (hext.2 hm (le_union_left hsep.left_le hB₁_G) hB.right_le) + have hnot2 : (A ∪ B₂, B₁) ∉ 𝒯 := fun hm ↦ + heq2 (hext.2 hm (le_union_left hsep.left_le hB₂_G) hB.left_le) + have hnot_both : ¬ ((B₂, A ∪ B₁) ∈ 𝒯 ∧ (B₁, A ∪ B₂) ∈ 𝒯) := by + rintro ⟨hm1, hm2⟩ + apply h𝒯.axiom2 hAB hm1 hm2 + rw [union_assoc, union_comm B₂ B₁, hB.union_eq, hsep.union_eq] + have hord_AB : separationOrder A B = θ - 1 := theorem_2_8_order h𝒯 hext + have h1_le : 1 ≤ θ := h𝒯.one_le + have bound_of_not_swap : ∀ {C D : Hypergraph α β}, B.IsSeparation C D → + G.IsSeparation (A ∪ C) D → (A ∪ C, D) ∉ 𝒯 → (D, A ∪ C) ∉ 𝒯 → + (A ∩ C).vertexSet.ncard < separationOrder C D := by + intro C D hCD hsepCD hnotCD hnotDC + have hge : θ ≤ separationOrder (A ∪ C) D := by + by_contra! hlt + exact (h𝒯.axiom1 hsepCD hlt).elim hnotCD hnotDC + have hsub : ((A ∪ C) ∩ D).vertexSet ⊆ + (C ∩ D).vertexSet ∪ ((A ∩ B).vertexSet \ (A ∩ C).vertexSet) := by + intro v hv + simp only [inter_vertexSet, union_vertexSet, Set.mem_inter_iff, Set.mem_union, + Set.mem_sdiff] at hv ⊢ + rcases hv with ⟨hvA | hvC, hvD⟩ + · by_cases hvC : v ∈ C.vertexSet + · exact Or.inl ⟨hvC, hvD⟩ + · exact Or.inr ⟨⟨hvA, hCD.right_le.vertexSet_subset hvD⟩, fun h ↦ hvC h.2⟩ + · exact Or.inl ⟨hvC, hvD⟩ + have hcard_union : ((A ∪ C) ∩ D).vertexSet.ncard ≤ + (C ∩ D).vertexSet.ncard + ((A ∩ B).vertexSet \ (A ∩ C).vertexSet).ncard := + (Set.ncard_le_ncard hsub + ((C ∩ D).vertexSet_finite.union ((A ∩ B).vertexSet_finite.sdiff))).trans + (Set.ncard_union_le _ _) + have hAC_sub_AB : (A ∩ C).vertexSet ⊆ (A ∩ B).vertexSet := + Set.inter_subset_inter_right _ hCD.left_le.vertexSet_subset + have hcard_diff : ((A ∩ B).vertexSet \ (A ∩ C).vertexSet).ncard = + (A ∩ B).vertexSet.ncard - (A ∩ C).vertexSet.ncard := + Set.ncard_sdiff hAC_sub_AB (A ∩ C).vertexSet_finite + have hAC_le : (A ∩ C).vertexSet.ncard ≤ (A ∩ B).vertexSet.ncard := + Set.ncard_le_ncard hAC_sub_AB (A ∩ B).vertexSet_finite + rw [separationOrder] at hge hord_AB ⊢ + omega + by_cases hm1 : (B₂, A ∪ B₁) ∈ 𝒯 + · have hm2 : (B₁, A ∪ B₂) ∉ 𝒯 := fun h ↦ hnot_both ⟨hm1, h⟩ + have hlt := bound_of_not_swap hB.symm hsep2 hnot2 hm2 + rw [separationOrder_comm] at hlt + exact (min_le_right _ _).trans_lt hlt + · have hlt := bound_of_not_swap hB hsep1 hnot1 hm1 + exact (min_le_left _ _).trans_lt hlt + +/-- Third part of **Graph Minors X, (2.8)** (page 157): +"In particular, there is no separation $(B_1, B_2)$ of $B$ with $B_1, B_2$ non-null of order $0$" -/ +theorem theorem_2_8_no_order_zero {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {A B B₁ B₂ : Hypergraph α β} (hext : IsExtreme 𝒯 A B) (hB : B.IsSeparation B₁ B₂) + (h1 : IsNonNull B₁) (h2 : IsNonNull B₂) : + separationOrder B₁ B₂ ≠ 0 := by + intro hord0 + have hV_inter : (B₁ ∩ B₂).vertexSet = ∅ := + (Set.ncard_eq_zero (B₁ ∩ B₂).vertexSet_finite).1 hord0 + rcases theorem_2_8_separation h𝒯 hext hB with ⟨_, rfl⟩ | ⟨_, rfl⟩ | hlt + · have hV₁ : B₁.vertexSet = ∅ := by + rw [← Set.inter_eq_left.2 hB.left_le.vertexSet_subset] + exact hV_inter + have hE₁ : B₁.edgeSet = ∅ := by + rw [← Set.inter_eq_left.2 hB.left_le.edgeSet_subset] + exact hB.edgeSet_inter_eq + rcases h1 with ⟨v, hv⟩ | ⟨e, he⟩ + · exact Set.notMem_empty v (hV₁ ▸ hv) + · exact Set.notMem_empty e (hE₁ ▸ he) + · have hV₂ : B₂.vertexSet = ∅ := by + rw [← Set.inter_eq_right.2 hB.right_le.vertexSet_subset] + exact hV_inter + have hE₂ : B₂.edgeSet = ∅ := by + rw [← Set.inter_eq_right.2 hB.right_le.edgeSet_subset] + exact hB.edgeSet_inter_eq + rcases h2 with ⟨v, hv⟩ | ⟨e, he⟩ + · exact Set.notMem_empty v (hV₂ ▸ hv) + · exact Set.notMem_empty e (hE₂ ▸ he) + · omega + +/-- Fourth part of **Graph Minors X, (2.8)** (page 157): +"and there is no edge of $B$ with all its ends in $V(A)$." -/ +theorem theorem_2_8_no_edge_ends_subset {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {A B : Hypergraph α β} (hext : IsExtreme 𝒯 A B) {e : β} (heB : e ∈ B.edgeSet) : + ¬ B.ends e ⊆ A.vertexSet := by + intro hsub + have hAB := hext.1 + have hsep := h𝒯.isSeparation hAB + let Ke := edgeHypergraph B e + have hsepB : B.IsSeparation Ke (B.deleteEdges {e}) := + isSeparation_edgeHypergraph_deleteEdges heB + have hKe_not_le : ¬ Ke ≤ A ∩ B := by + intro hle + have heAB : e ∈ (A ∩ B).edgeSet := hle.edgeSet_subset (Set.mem_singleton e) + exact hsep.notMem_edgeSet_left heB heAB.1 + have hBe_not_le : ¬ B.deleteEdges {e} ≤ A ∩ B := by + intro hle + have hVB : B.vertexSet ⊆ A.vertexSet := + hle.vertexSet_subset.trans Set.inter_subset_left + have hVA : A.vertexSet = G.vertexSet := by + rw [← hsep.vertexSet_union, Set.union_eq_left.2 hVB] + exact h𝒯.axiom3 hAB hVA + rcases theorem_2_8_separation h𝒯 hext hsepB with ⟨h1, _⟩ | ⟨h2, _⟩ | hlt + · exact hKe_not_le h1 + · exact hBe_not_le h2 + · have hord : separationOrder Ke (B.deleteEdges {e}) = (B.ends e).ncard := + separationOrder_edgeHypergraph_deleteEdges B e + have h1 : (A ∩ Ke).vertexSet = B.ends e := by + simpa [Ke, edgeHypergraph] using Set.inter_eq_right.2 hsub + have h2 : B.ends e ⊆ (A ∩ B.deleteEdges {e}).vertexSet := + Set.subset_inter hsub fun _ hv ↦ B.vertex_mem_of_inc hv + have hle2 : (B.ends e).ncard ≤ (A ∩ B.deleteEdges {e}).vertexSet.ncard := + Set.ncard_le_ncard h2 (A ∩ B.deleteEdges {e}).vertexSet_finite + rw [hord, h1] at hlt + omega + +/-- **Graph Minors X, (2.8)** (page 157): +"(2.8) *Let $\mathscr{T}$ be a tangle of order $\theta$ in a hypergraph $G$, and let +$(A, B)\in \mathscr{T}$ be extreme. Then $(A, B)$ has order $\theta - 1$. Moreover, if $(B_1, B_2)$ +is a separation of $B$, then either $B_1\subseteq A\cap B$ and $B_2 = B$, or $B_2\subseteq A\cap B$ +and $B_1 = B$, or $(B_1, B_2)$ has order strictly greater than* +$$\min(|V(A\cap B_1)|, |V(A\cap B_2)|).$$ +*In particular, there is no separation $(B_1, B_2)$ of $B$ with $B_1, B_2$ non-null of order $0$, +and there is no edge of $B$ with all its ends in $V(A)$.*" -/ +theorem theorem_2_8_proof {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {A B : Hypergraph α β} (hext : IsExtreme 𝒯 A B) : + separationOrder A B = θ - 1 ∧ + (∀ ⦃B₁ B₂ : Hypergraph α β⦄, B.IsSeparation B₁ B₂ → + (B₁ ≤ A ∩ B ∧ B₂ = B) ∨ (B₂ ≤ A ∩ B ∧ B₁ = B) ∨ + min (A ∩ B₁).vertexSet.ncard (A ∩ B₂).vertexSet.ncard < separationOrder B₁ B₂) ∧ + (∀ ⦃B₁ B₂ : Hypergraph α β⦄, B.IsSeparation B₁ B₂ → + IsNonNull B₁ → IsNonNull B₂ → separationOrder B₁ B₂ ≠ 0) ∧ + (∀ e ∈ B.edgeSet, ¬ B.ends e ⊆ A.vertexSet) := + ⟨theorem_2_8_order h𝒯 hext, + fun _ _ hB ↦ theorem_2_8_separation h𝒯 hext hB, + fun _ _ hB h1 h2 ↦ theorem_2_8_no_order_zero h𝒯 hext hB h1 h2, + fun _ heB ↦ theorem_2_8_no_edge_ends_subset h𝒯 hext heB⟩ + +/-- Case 1 of **Graph Minors X, (2.9)** (page 158): if `(A₁, B₁) ∈ 𝒯`, `(A₂, B₂)` is a separation +of order `< θ`, and `V(B₁) ⊆ V(B₂)`, then `(A₂, B₂) ∈ 𝒯`. -/ +theorem theorem_2_9_case_1 {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {A₁ B₁ A₂ B₂ : Hypergraph α β} (h₁ : (A₁, B₁) ∈ 𝒯) + (hsep₂ : G.IsSeparation A₂ B₂) (hord₂ : separationOrder A₂ B₂ < θ) + (hV : B₁.vertexSet ⊆ B₂.vertexSet) : + (A₂, B₂) ∈ 𝒯 := by + by_contra hnot + have hB₂A₂ : (B₂, A₂) ∈ 𝒯 := (h𝒯.axiom1 hsep₂ hord₂).resolve_left hnot + obtain ⟨A, B, hext, hB₂A, hBA₂⟩ := h𝒯.exists_isExtreme hB₂A₂ + have hsepAB := h𝒯.isSeparation hext.1 + have hsep₁ := h𝒯.isSeparation h₁ + have hB₁_not_le_A : ¬ B₁ ≤ A := by + intro hle + apply h𝒯.axiom2 hext.1 h₁ h₁ + rw [union_assoc, union_self] + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq (union_le hsepAB.left_le hsep₁.left_le) le_rfl + (by + rw [union_vertexSet, ← Set.union_eq_left.2 hle.vertexSet_subset, Set.union_assoc, + Set.union_comm B₁.vertexSet A₁.vertexSet, hsep₁.vertexSet_union, + Set.union_eq_right.2 hsepAB.left_le.vertexSet_subset]) + (by + rw [union_edgeSet, ← Set.union_eq_left.2 hle.edgeSet_subset, Set.union_assoc, + Set.union_comm B₁.edgeSet A₁.edgeSet, hsep₁.edgeSet_union, + Set.union_eq_right.2 hsepAB.left_le.edgeSet_subset]) + have hVB₁_A : B₁.vertexSet ⊆ A.vertexSet := hV.trans hB₂A.vertexSet_subset + have hEB₁_A : B₁.edgeSet ⊆ A.edgeSet := by + intro e heB₁ + have heG : e ∈ G.edgeSet := hsep₁.right_le.edgeSet_subset heB₁ + have heAB : e ∈ A.edgeSet ∪ B.edgeSet := by rwa [hsepAB.edgeSet_union] + rcases heAB with heA | heB + · exact heA + · exfalso + apply theorem_2_8_no_edge_ends_subset h𝒯 hext heB + rw [← hsepAB.right_le.ends_eq e heB, hsep₁.right_le.ends_eq e heB₁] + exact Set.Subset.trans (fun _ hv ↦ B₁.vertex_mem_of_inc hv) hVB₁_A + exact hB₁_not_le_A ((le_iff_of_le hsep₁.right_le hsepAB.left_le).2 ⟨hVB₁_A, hEB₁_A⟩) + +/-- **Graph Minors X, (2.9)** (page 158): +"Let $\mathscr{T}$ be a tangle of order $\theta$ in a hypergraph $G$, and let $(A_1, B_1)\in +\mathscr{T}$. Let $(A_2, B_2)$ be a separation of order $<\theta$. If either* (i) +$V(B_1)\subseteq V(B_2)$, or (ii) $V(A_2)\subseteq V(A_1)$, or (iii) $\theta \ge 2$ and +$E(A_2)\subseteq E(A_1)$ (equivalently, $E(B_1)\subseteq E(B_2)$) *then* $(A_2, B_2)\in +\mathscr{T}$." -/ +theorem theorem_2_9_proof {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {A₁ B₁ A₂ B₂ : Hypergraph α β} (h₁ : (A₁, B₁) ∈ 𝒯) + (hsep₂ : G.IsSeparation A₂ B₂) (hord₂ : separationOrder A₂ B₂ < θ) + (h : B₁.vertexSet ⊆ B₂.vertexSet ∨ A₂.vertexSet ⊆ A₁.vertexSet ∨ + (2 ≤ θ ∧ A₂.edgeSet ⊆ A₁.edgeSet)) : + (A₂, B₂) ∈ 𝒯 := by + rcases h with hV | hV | ⟨hθ, hE⟩ + · exact theorem_2_9_case_1 h𝒯 h₁ hsep₂ hord₂ hV + · by_contra hnot + have hB₂A₂ : (B₂, A₂) ∈ 𝒯 := (h𝒯.axiom1 hsep₂ hord₂).resolve_left hnot + have hsep₁ := (h𝒯.isSeparation h₁).symm + have hord₁ : separationOrder B₁ A₁ < θ := by + rw [separationOrder_comm] + exact h𝒯.order_lt h₁ + have hB₁A₁ : (B₁, A₁) ∈ 𝒯 := theorem_2_9_case_1 h𝒯 hB₂A₂ hsep₁ hord₁ hV + exact theorem_2_1_proof h𝒯 h₁ hB₁A₁ + · by_contra hnot + have hB₂A₂ : (B₂, A₂) ∈ 𝒯 := (h𝒯.axiom1 hsep₂ hord₂).resolve_left hnot + obtain ⟨A, B, hext, hB₂A, hBA₂⟩ := h𝒯.exists_isExtreme hB₂A₂ + have hsepAB := h𝒯.isSeparation hext.1 + have hsep₁ := h𝒯.isSeparation h₁ + have hB_not_le_A₁ : ¬ B ≤ A₁ := by + intro hle + apply h𝒯.axiom2 hext.1 h₁ h₁ + rw [union_assoc, union_self] + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq (union_le hsepAB.left_le hsep₁.left_le) le_rfl + (by + rw [union_vertexSet, ← Set.union_eq_right.2 hle.vertexSet_subset, ← Set.union_assoc, + hsepAB.vertexSet_union, Set.union_eq_left.2 hsep₁.left_le.vertexSet_subset]) + (by + rw [union_edgeSet, ← Set.union_eq_right.2 hle.edgeSet_subset, ← Set.union_assoc, + hsepAB.edgeSet_union, Set.union_eq_left.2 hsep₁.left_le.edgeSet_subset]) + have hEB_A₁ : B.edgeSet ⊆ A₁.edgeSet := hBA₂.edgeSet_subset.trans hE + have hVB_not_sub : ¬ B.vertexSet ⊆ A₁.vertexSet := fun hV ↦ + hB_not_le_A₁ ((le_iff_of_le hsepAB.right_le hsep₁.left_le).2 ⟨hV, hEB_A₁⟩) + obtain ⟨v, hvB, hv_notA₁⟩ := Set.not_subset.1 hVB_not_sub + have hisoB : ∀ e, ¬ B.Inc e v := by + intro e hinc + have heA₁ : e ∈ A₁.edgeSet := hEB_A₁ (B.edge_mem_of_inc hinc) + have hincG : G.Inc e v := inc_of_le hsepAB.right_le hinc + have hincA₁ : A₁.Inc e v := (inc_iff_of_le hsep₁.left_le heA₁).2 hincG + exact hv_notA₁ (A₁.vertex_mem_of_inc hincA₁) + let Kv : Hypergraph α β := vertexHypergraph v + have hsepBv : B.IsSeparation Kv (B.deleteVertices {v}) := + isSeparation_vertexHypergraph_deleteVertices hvB hisoB + have hordBv : separationOrder Kv (B.deleteVertices {v}) = 0 := + separationOrder_vertexHypergraph_deleteVertices B v + have hKv_nn : IsNonNull Kv := Or.inl ⟨v, Set.mem_singleton v⟩ + have hBv_not_nn : ¬ IsNonNull (B.deleteVertices {v}) := fun hnn ↦ + theorem_2_8_no_order_zero h𝒯 hext hsepBv hKv_nn hnn hordBv + rw [isNonNull_iff_ne_bot, not_not] at hBv_not_nn + have hVB_eq : B.vertexSet = {v} := by + have hdiff : B.vertexSet \ {v} = ∅ := congrArg Hypergraph.vertexSet hBv_not_nn + exact Set.Subset.antisymm (Set.sdiff_eq_empty.1 hdiff) (Set.singleton_subset_iff.2 hvB) + have hv_notA : v ∉ A.vertexSet := by + intro hvA + apply h𝒯.axiom3 hext.1 + rw [← hsepAB.vertexSet_union, hVB_eq, Set.union_eq_left.2 (Set.singleton_subset_iff.2 hvA)] + have hAB_empty : (A ∩ B).vertexSet = ∅ := by + simp [hVB_eq, hv_notA] + have hord0 : separationOrder A B = 0 := by + simp [separationOrder, hAB_empty] + have hord_eq := theorem_2_8_order h𝒯 hext + omega + +section + +variable {G H A B : Hypergraph α β} + +/-- Intersecting both sides of a separation with a subgraph gives a separation +of that subgraph, as used in Graph Minors XII, Section 4, page 248. -/ +theorem restrictSeparationToSubgraph (hs : G.IsSeparation A B) (hH : H ≤ G) : + H.IsSeparation (A ∩ H) (B ∩ H) := by + refine (isSeparation_iff_of_le (inter_le_right hs.left_le hH) + (inter_le_right hs.right_le hH)).mpr ⟨?_, ?_, ?_⟩ + · rw [inter_vertexSet, inter_vertexSet, ← Set.union_inter_distrib_right, + hs.vertexSet_union, Set.inter_eq_right.mpr hH.vertexSet_subset] + · rw [inter_edgeSet, inter_edgeSet, ← Set.union_inter_distrib_right, + hs.edgeSet_union, Set.inter_eq_right.mpr hH.edgeSet_subset] + · apply Set.eq_empty_iff_forall_notMem.mpr + intro e he + exact hs.notMem_edgeSet_right he.1.1 he.2.1 + +/-- Restriction does not increase the order of a separation. -/ +theorem separationOrder_restrict_subgraph_le (A B H : Hypergraph α β) : + separationOrder (A ∩ H) (B ∩ H) ≤ separationOrder A B := by + exact Set.ncard_le_ncard (fun _ hx => ⟨hx.1.1, hx.2.1⟩) + (A ∩ B).vertexSet_finite + +/-- Graph Minors XII, Section 4, page 248: the tangle induced by a tangle in a +subgraph is a tangle of the same order. Each axiom follows by intersection with +that subgraph. -/ +theorem isTangle_inducedTangleFromSubgraph {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} + (hH : H ≤ G) (hT : IsTangle H θ T) : + IsTangle G θ (inducedTangleFromSubgraph G H θ T) := by + refine ⟨hT.one_le, fun _ _ h => h.1, fun _ _ h => h.2.1, ?_, ?_, ?_⟩ + · intro A B hs ho + have hsH := restrictSeparationToSubgraph hs hH + have hoH := lt_of_le_of_lt (separationOrder_restrict_subgraph_le A B H) ho + rcases hT.axiom1 hsH hoH with h | h + · exact Or.inl ⟨hs, ho, h⟩ + · exact Or.inr ⟨hs.symm, by rwa [separationOrder_comm], h⟩ + · intro A₁ B₁ A₂ B₂ A₃ B₃ h₁ h₂ h₃ heq + apply hT.axiom2 h₁.2.2 h₂.2.2 h₃.2.2 + have hle := union_le (union_le + (inter_le_right h₁.1.left_le hH) (inter_le_right h₂.1.left_le hH)) + (inter_le_right h₃.1.left_le hH) + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle le_rfl ?_ ?_ + · simp only [union_vertexSet, inter_vertexSet] + rw [← Set.union_inter_distrib_right, ← Set.union_inter_distrib_right] + change (A₁ ∪ A₂ ∪ A₃).vertexSet ∩ H.vertexSet = H.vertexSet + rw [heq, Set.inter_eq_right.mpr hH.vertexSet_subset] + · simp only [union_edgeSet, inter_edgeSet] + rw [← Set.union_inter_distrib_right, ← Set.union_inter_distrib_right] + change (A₁ ∪ A₂ ∪ A₃).edgeSet ∩ H.edgeSet = H.edgeSet + rw [heq, Set.inter_eq_right.mpr hH.edgeSet_subset] + · intro A B h heq + apply hT.axiom3 h.2.2 + change A.vertexSet ∩ H.vertexSet = H.vertexSet + rw [heq, Set.inter_eq_right.mpr hH.vertexSet_subset] + +end + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/TreeWidth.lean b/LeanPool/GraphMinor/GM10/TreeWidth.lean new file mode 100644 index 0000000000..ea1e7bddbe --- /dev/null +++ b/LeanPool/GraphMinor/GM10/TreeWidth.lean @@ -0,0 +1,624 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.TreeWidthClaims +public import LeanPool.GraphMinor.GM10.Statements +import LeanPool.GraphMinor.GM10.BranchWidth + +/-! +# Branch-Width and Tree-Width: Graph Minors X, Section 5 (Part 3) + +This file completes the formalization of Section 5 of Robertson and Seymour, *Graph Minors. X. +Obstructions to tree-decomposition*, J. Combin. Theory Ser. B 52 (1991) 153–190 (pages 168–170): +- Suppression of degree-2 vertices in a tree (`suppressVertex`) and the first inequality of + **(5.1)** (`branchWidth_le_treeWidthPlusOne`). +- **(5.1)** (`theorem_5_1`): for every hypergraph `G`, `max(β(G), γ(G)) ≤ ω(G) + 1`, and either + `γ(G) = 0`, `V(G) ≠ ∅`, `β(G) = 0`, `ω(G) = 0` or `ω(G) + 1 ≤ (3/2) max(β(G), γ(G))`. +- **(5.2)** (`theorem_5_2`): for every hypergraph `G`, `θ(G) ≤ ω(G) + 1 ≤ (3/2) θ(G)`. +-/ + +public section + +namespace GraphMinor.GM10 + +open SimpleGraph Hypergraph + +variable {α β ι : Type*} + +/-! ## Suppression of degree-2 vertices in a tree -/ + +/-- Suppress a vertex `t₀` of `T` with neighbors `w₁, w₂` by deleting `t₀` and joining `w₁` and +`w₂` (if distinct) (Graph Minors X, Section 5, proof of (5.1), page 169). -/ +@[expose] def suppressVertex (T : SimpleGraph ι) (t₀ w₁ w₂ : ι) : SimpleGraph ({t₀}ᶜ : Set ι) where + Adj a b := a.1 ≠ b.1 ∧ (T.Adj a.1 b.1 ∨ (a.1 = w₁ ∧ b.1 = w₂) ∨ (a.1 = w₂ ∧ b.1 = w₁)) + symm := ⟨by + rintro a b ⟨hne, h | ⟨h1, h2⟩ | ⟨h1, h2⟩⟩ + · exact ⟨hne.symm, Or.inl h.symm⟩ + · exact ⟨hne.symm, Or.inr (Or.inr ⟨h2, h1⟩)⟩ + · exact ⟨hne.symm, Or.inr (Or.inl ⟨h2, h1⟩)⟩⟩ + loopless := ⟨fun _ h ↦ h.1 rfl⟩ + +/-- If `T.Adj t₀ w₁`, `T.Adj t₀ w₂`, and `w₁ ≠ w₂` in a tree `T`, then `¬ T.Adj w₁ w₂`. -/ +theorem not_adj_of_common_neighbor_in_tree {T : SimpleGraph ι} (hT : T.IsTree) + {t₀ w₁ w₂ : ι} (hadj₁ : T.Adj t₀ w₁) (hadj₂ : T.Adj t₀ w₂) (hw12 : w₁ ≠ w₂) : + ¬ T.Adj w₁ w₂ := by + intro hadj12 + have hp1 : (Walk.cons hadj12 Walk.nil).IsPath := by + rw [Walk.isPath_def] + simp [hadj12.ne] + have hp2 : (Walk.cons hadj₁.symm (Walk.cons hadj₂ Walk.nil)).IsPath := by + rw [Walk.isPath_def] + simp [hadj₁.ne.symm, hw12, hadj₂.ne] + have heq : (⟨Walk.cons hadj12 Walk.nil, hp1⟩ : T.Path w₁ w₂) = + ⟨Walk.cons hadj₁.symm (Walk.cons hadj₂ Walk.nil), hp2⟩ := + @Subsingleton.elim _ (hT.isAcyclic.subsingleton_path w₁ w₂) _ _ + have hlen := congrArg (fun p : T.Path w₁ w₂ ↦ p.1.length) heq + simp at hlen + +/-- If `T.neighborSet t₀ = {w₁, w₂}`, then every walk `p : T.Walk u v` with `u ≠ t₀` and `v ≠ t₀` +compresses to a walk in `suppressVertex T t₀ w₁ w₂` from `⟨u, hu⟩` to `⟨v, hv⟩` whose support is +contained in `p.support`. -/ +theorem exists_walk_suppressVertex {T : SimpleGraph ι} {t₀ w₁ w₂ : ι} + (hadj_iff : ∀ y, T.Adj t₀ y ↔ y = w₁ ∨ y = w₂) + {u v : ι} (p : T.Walk u v) : + ∀ (hu : u ≠ t₀) (hv : v ≠ t₀), + ∃ w : (suppressVertex T t₀ w₁ w₂).Walk ⟨u, hu⟩ ⟨v, hv⟩, + ∀ z ∈ w.support, z.1 ∈ p.support := by + suffices ∀ (n : ℕ) {u v : ι} (p : T.Walk u v), p.length = n → + ∀ (hu : u ≠ t₀) (hv : v ≠ t₀), + ∃ w : (suppressVertex T t₀ w₁ w₂).Walk ⟨u, hu⟩ ⟨v, hv⟩, + ∀ z ∈ w.support, z.1 ∈ p.support from + this p.length p rfl + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro u v p hlen hu hv + cases p with + | nil => + refine ⟨Walk.nil, fun z hz ↦ ?_⟩ + rw [Walk.support_nil, List.mem_singleton] at hz + subst hz + exact List.mem_singleton.2 rfl + | @cons _ b c hadj q => + by_cases hb : b = t₀ + · subst hb + cases q with + | nil => exact (hv rfl).elim + | @cons _ d _ hadj2 q' => + have hlt : q'.length < n := by + rw [← hlen] + simp + by_cases had : u = d + · subst had + obtain ⟨wq', hwq'⟩ := ih q'.length hlt q' rfl hu hv + refine ⟨wq', fun z hz ↦ ?_⟩ + exact List.mem_cons_of_mem u (List.mem_cons_of_mem b (hwq' z hz)) + · have hd_ne : d ≠ b := hadj2.ne.symm + obtain ⟨wq', hwq'⟩ := ih q'.length hlt q' rfl hd_ne hv + have ha_w : u = w₁ ∨ u = w₂ := (hadj_iff u).1 hadj.symm + have hd_w : d = w₁ ∨ d = w₂ := (hadj_iff d).1 hadj2 + have hadj_supp : (suppressVertex T b w₁ w₂).Adj ⟨u, hu⟩ ⟨d, hd_ne⟩ := by + refine ⟨had, Or.inr ?_⟩ + rcases ha_w with rfl | rfl <;> rcases hd_w with rfl | rfl + · exact (had rfl).elim + · exact Or.inl ⟨rfl, rfl⟩ + · exact Or.inr ⟨rfl, rfl⟩ + · exact (had rfl).elim + refine ⟨Walk.cons hadj_supp wq', fun z hz ↦ ?_⟩ + rw [Walk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · exact List.mem_cons_self + · exact List.mem_cons_of_mem u (List.mem_cons_of_mem b (hwq' z hz)) + · have hlt : q.length < n := by + rw [← hlen] + simp + obtain ⟨wq, hwq⟩ := ih q.length hlt q rfl hb hv + have hadj_supp : (suppressVertex T t₀ w₁ w₂).Adj ⟨u, hu⟩ ⟨b, hb⟩ := + ⟨hadj.ne, Or.inl hadj⟩ + refine ⟨Walk.cons hadj_supp wq, fun z hz ↦ ?_⟩ + rw [Walk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · exact List.mem_cons_self + · exact List.mem_cons_of_mem u (hwq z hz) + +/-- In `suppressVertex T t₀ w₁ w₂`, `OnTreePath` implies `OnTreePath` in `T`. -/ +theorem onTreePath_of_suppressVertex {T : SimpleGraph ι} {t₀ w₁ w₂ : ι} + (hadj_iff : ∀ y, T.Adj t₀ y ↔ y = w₁ ∨ y = w₂) + {a b c : ({t₀}ᶜ : Set ι)} (hp : OnTreePath (suppressVertex T t₀ w₁ w₂) a b c) : + OnTreePath T a.1 b.1 c.1 := by + intro p _ + obtain ⟨w, hw⟩ := exists_walk_suppressVertex hadj_iff p a.2 b.2 + exact hw c (mem_support_of_onTreePath hp w) + +/-- Suppressing a degree-2 vertex `t₀` in a tree `T` with neighbors `w₁, w₂` preserves the degree +of every remaining vertex `x : {t₀}ᶜ`. -/ +theorem degree_suppressVertex [Fintype ι] {T : SimpleGraph ι} (hT : T.IsTree) {t₀ w₁ w₂ : ι} + [Fintype ({t₀}ᶜ : Set ι)] + [DecidableRel (suppressVertex T t₀ w₁ w₂).Adj] [DecidableRel T.Adj] + (hadj₁ : T.Adj t₀ w₁) (hadj₂ : T.Adj t₀ w₂) (hw12 : w₁ ≠ w₂) + (hadj_iff : ∀ y, T.Adj t₀ y ↔ y = w₁ ∨ y = w₂) (x : ({t₀}ᶜ : Set ι)) : + (suppressVertex T t₀ w₁ w₂).degree x = T.degree x.1 := by + classical + let T' := suppressVertex T t₀ w₁ w₂ + have hnot_adj12 : ¬ T.Adj w₁ w₂ := not_adj_of_common_neighbor_in_tree hT hadj₁ hadj₂ hw12 + rw [← ncard_neighborSet, ← ncard_neighborSet] + let g : ({t₀}ᶜ : Set ι) → ι := fun y ↦ if T.Adj x.1 y.1 then y.1 else t₀ + have hbij : Set.BijOn g (T'.neighborSet x) (T.neighborSet x.1) := by + refine ⟨?_, ?_, ?_⟩ + · intro y hy + dsimp only [g] + split_ifs with hxy + · exact hxy + · rcases hy.2 with hxy' | ⟨hx1, _⟩ | ⟨hx2, _⟩ + · exact (hxy hxy').elim + · rw [hx1]; exact hadj₁.symm + · rw [hx2]; exact hadj₂.symm + · intro y₁ hy₁ y₂ hy₂ heq + dsimp only [g] at heq + split_ifs at heq with h1 h2 h2 + · exact Subtype.ext heq + · exact (y₁.2 heq).elim + · exact (y₂.2 heq.symm).elim + · rcases hy₁.2 with h1' | ⟨hxw₁, hy₁w₂⟩ | ⟨hxw₂, hy₁w₁⟩ + · exact (h1 h1').elim + · rcases hy₂.2 with h2' | ⟨_, hy₂w₂⟩ | ⟨hxw₂, _⟩ + · exact (h2 h2').elim + · exact Subtype.ext (hy₁w₂.trans hy₂w₂.symm) + · exact (hw12 (hxw₁.symm.trans hxw₂)).elim + · rcases hy₂.2 with h2' | ⟨hxw₁, _⟩ | ⟨_, hy₂w₁⟩ + · exact (h2 h2').elim + · exact (hw12 (hxw₁.symm.trans hxw₂)).elim + · exact Subtype.ext (hy₁w₁.trans hy₂w₁.symm) + · intro z hz + have hxz : T.Adj x.1 z := hz + by_cases hzt₀ : z = t₀ + · subst hzt₀ + rcases (hadj_iff x.1).1 hxz.symm with hxw₁ | hxw₂ + · refine ⟨⟨w₂, hadj₂.ne.symm⟩, ⟨by change x.1 ≠ w₂; rw [hxw₁]; exact hw12, + Or.inr (Or.inl ⟨hxw₁, rfl⟩)⟩, ?_⟩ + dsimp only [g] + have hnot : ¬ T.Adj x.1 w₂ := by rwa [hxw₁] + exact ite_eq_right_iff.2 fun h ↦ (hnot h).elim + · refine ⟨⟨w₁, hadj₁.ne.symm⟩, ⟨by change x.1 ≠ w₁; rw [hxw₂]; exact hw12.symm, + Or.inr (Or.inr ⟨hxw₂, rfl⟩)⟩, ?_⟩ + dsimp only [g] + have hnot : ¬ T.Adj x.1 w₁ := by + rw [hxw₂] + exact fun h ↦ hnot_adj12 h.symm + exact ite_eq_right_iff.2 fun h ↦ (hnot h).elim + · refine ⟨⟨z, hzt₀⟩, ⟨hxz.ne, Or.inl hxz⟩, ?_⟩ + dsimp only [g] + exact ite_eq_left_iff.2 fun h ↦ (h hxz).elim + rw [← hbij.image_eq, hbij.injOn.ncard_image] + +/-- Suppressing a degree-2 vertex `t₀` in a tree `T` produces a tree. -/ +theorem isTree_suppressVertex [Finite ι] {T : SimpleGraph ι} (hT : T.IsTree) {t₀ w₁ w₂ : ι} + (hadj₁ : T.Adj t₀ w₁) (hadj₂ : T.Adj t₀ w₂) (hw12 : w₁ ≠ w₂) + (hadj_iff : ∀ y, T.Adj t₀ y ↔ y = w₁ ∨ y = w₂) : + (suppressVertex T t₀ w₁ w₂).IsTree := by + classical + let fintypeVertices := Fintype.ofFinite ι + let fintypeComplement := Fintype.ofFinite ({t₀}ᶜ : Set ι) + let T' := suppressVertex T t₀ w₁ w₂ + have hconn : T'.Connected := by + have : Nonempty ({t₀}ᶜ : Set ι) := ⟨⟨w₁, hadj₁.ne.symm⟩⟩ + refine Connected.mk fun a b ↦ ?_ + obtain ⟨p⟩ := hT.connected a.1 b.1 + obtain ⟨w, _⟩ := exists_walk_suppressVertex hadj_iff p a.2 b.2 + exact ⟨w⟩ + have hdeg_t₀ : T.degree t₀ = 2 := by + rw [← ncard_neighborSet] + have hset : T.neighborSet t₀ = {w₁, w₂} := by + ext y + exact hadj_iff y + rw [hset, Set.ncard_pair hw12] + have hsum_compl : ∑ x : ({t₀}ᶜ : Set ι), T'.degree x = + ∑ x ∈ Finset.univ.erase t₀, T.degree x := by + have h1 : ∑ x : ({t₀}ᶜ : Set ι), T'.degree x = + ∑ x : ({t₀}ᶜ : Set ι), T.degree x.1 := + Finset.sum_congr rfl fun x _ ↦ degree_suppressVertex hT hadj₁ hadj₂ hw12 hadj_iff x + rw [h1] + refine Finset.sum_bij (fun (x : ({t₀}ᶜ : Set ι)) _ ↦ x.1) ?_ ?_ ?_ ?_ + · intro x _ + exact Finset.mem_erase.2 ⟨x.2, Finset.mem_univ _⟩ + · intro x₁ _ x₂ _ h + exact Subtype.ext h + · intro y hy + exact ⟨⟨y, (Finset.mem_erase.1 hy).1⟩, Finset.mem_univ _, rfl⟩ + · intros + rfl + have hsum_all : ∑ x : ι, T.degree x = + T.degree t₀ + ∑ x ∈ Finset.univ.erase t₀, T.degree x := + (Finset.add_sum_erase (Finset.univ : Finset ι) (fun x ↦ T.degree x) + (Finset.mem_univ t₀)).symm + have htwice' := T'.sum_degrees_eq_twice_card_edges + have htwice := T.sum_degrees_eq_twice_card_edges + have hedge : Nat.card T'.edgeSet + 1 = Nat.card T.edgeSet := by + rw [Nat.card_eq_fintype_card, Nat.card_eq_fintype_card, ← T'.edgeFinset_card, + ← T.edgeFinset_card] + omega + have hcardT : Nat.card T.edgeSet + 1 = Nat.card ι := + (isTree_iff_connected_and_card.1 hT).2 + have hcard_compl : Nat.card ({t₀}ᶜ : Set ι) + 1 = Nat.card ι := by + rw [Nat.card_eq_fintype_card, Nat.card_eq_fintype_card, Fintype.card_of_subtype + (Finset.univ.erase t₀) (fun x ↦ by simp [Finset.mem_erase]), + Finset.card_erase_of_mem (Finset.mem_univ t₀), Finset.card_univ] + have hpos : 0 < Fintype.card ι := Fintype.card_pos_iff.2 ⟨t₀⟩ + omega + refine isTree_iff_connected_and_card.2 ⟨hconn, ?_⟩ + have hgoal : Nat.card T'.edgeSet + 1 = Nat.card ({t₀}ᶜ : Set ι) := by + omega + exact hgoal + +/-- Single step of suppressing a degree-2 vertex `t₀` in a tree-decomposition `(T, τ)` of a +hypergraph `G` with no isolated vertices. -/ +theorem suppressVertex_isTreeDecomposition [Fintype ι] {G : Hypergraph α β} + (hno_iso : ∀ v ∈ G.vertexSet, ∃ e, G.Inc e v) + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) + {t₀ w₁ w₂ : ι} [Fintype ({t₀}ᶜ : Set ι)] + (hadj₁ : T.Adj t₀ w₁) (hadj₂ : T.Adj t₀ w₂) (hw12 : w₁ ≠ w₂) + (hadj_iff : ∀ y, T.Adj t₀ y ↔ y = w₁ ∨ y = w₂) + (hc1 : ∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T, τ t = edgeHypergraph G e) : + IsTreeDecomposition G (suppressVertex T t₀ w₁ w₂) (fun x ↦ τ x.1) ∧ + treeDecompWidthPlusOne (fun (x : ({t₀}ᶜ : Set ι)) ↦ τ x.1) ≤ treeDecompWidthPlusOne τ := by + have ht₀_not_leaf : t₀ ∉ leafSet T := by + classical + unfold leafSet IsLeaf + rw [Set.mem_ofPred_eq, ← ncard_neighborSet] + have hset : T.neighborSet t₀ = {w₁, w₂} := by ext y; exact hadj_iff y + rw [hset, Set.ncard_pair hw12] + omega + have hc1' : ∀ e ∈ G.edgeSet, ∃ x : ({t₀}ᶜ : Set ι), τ x.1 = edgeHypergraph G e := by + intro e heG + obtain ⟨t, ht_leaf, hτ_t⟩ := hc1 e heG + have ht_ne : t ≠ t₀ := fun h ↦ ht₀_not_leaf (h ▸ ht_leaf) + exact ⟨⟨t, ht_ne⟩, hτ_t⟩ + have hT' : (suppressVertex T t₀ w₁ w₂).IsTree := + isTree_suppressVertex h.isTree hadj₁ hadj₂ hw12 hadj_iff + have : Nonempty ({t₀}ᶜ : Set ι) := hT'.connected.nonempty + refine ⟨⟨hT', fun x ↦ h.le x.1, ?_, ?_, ?_⟩, ?_⟩ + · ext x + · simp only [Hypergraph.biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion] + constructor + · rintro ⟨a, hx⟩ + exact (h.le a.1).vertexSet_subset hx + · intro hxG + obtain ⟨e, hinc⟩ := hno_iso x hxG + obtain ⟨a, hτ_a⟩ := hc1' e (G.edge_mem_of_inc hinc) + refine ⟨a, ?_⟩ + rw [hτ_a] + exact hinc + · simp only [Hypergraph.biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion] + constructor + · rintro ⟨a, hx⟩ + exact (h.le a.1).edgeSet_subset hx + · intro heG + obtain ⟨a, hτ_a⟩ := hc1' x heG + refine ⟨a, ?_⟩ + rw [hτ_a] + exact Set.mem_singleton x + · simp only [Hypergraph.biUnion, Finset.mem_univ, true_and] + constructor + · rintro ⟨a, hinc⟩ + exact inc_of_le (h.le a.1) hinc + · intro hincG + obtain ⟨a, hτ_a⟩ := hc1' x (G.edge_mem_of_inc hincG) + refine ⟨a, ?_⟩ + rw [hτ_a] + exact ⟨rfl, hincG⟩ + · intro x y hne + exact h.edgeSet_inter_eq (fun heq ↦ hne (Subtype.ext heq)) + · intro a c b hp + exact h.inter_le (onTreePath_of_suppressVertex hadj_iff hp) + · rw [treeDecompWidthPlusOne_le_iff] + intro x + exact ncard_vertexSet_le_treeDecompWidthPlusOne τ x.1 + +/-- Leaves of `suppressVertex T t₀ w₁ w₂` are exactly `{x : {t₀}ᶜ | x.1 ∈ leafSet T}`. -/ +theorem mem_leafSet_suppressVertex_iff [Fintype ι] {T : SimpleGraph ι} (hT : T.IsTree) + {t₀ w₁ w₂ : ι} [Fintype ({t₀}ᶜ : Set ι)] + (hadj₁ : T.Adj t₀ w₁) (hadj₂ : T.Adj t₀ w₂) (hw12 : w₁ ≠ w₂) + (hadj_iff : ∀ y, T.Adj t₀ y ↔ y = w₁ ∨ y = w₂) (x : ({t₀}ᶜ : Set ι)) : + x ∈ leafSet (suppressVertex T t₀ w₁ w₂) ↔ x.1 ∈ leafSet T := by + classical + unfold leafSet IsLeaf + rw [Set.mem_ofPred_eq, Set.mem_ofPred_eq, + degree_suppressVertex hT hadj₁ hadj₂ hw12 hadj_iff x] + +/-- Suppressing all degree-2 vertices in a tree-decomposition satisfying Claims (1)–(3) of `(5.1)` +when `2 ≤ |E(G)|` and `G` has no isolated vertices yields a tree-decomposition whose underlying +tree is ternary (`IsTernaryTree`). -/ +theorem exists_ternary_treeDecomposition [Fintype ι] {G : Hypergraph α β} + (hno_iso : ∀ v ∈ G.vertexSet, ∃ e, G.Inc e v) (hcardE : 2 ≤ G.edgeSet.ncard) + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) + (hc1 : ∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T, τ t = edgeHypergraph G e) + (hc2 : ∀ t ∈ leafSet T, ∃ e ∈ G.edgeSet, τ t = edgeHypergraph G e) + (hdeg3 : ∀ t : ι, by classical exact T.degree t ≤ 3) : + ∃ (ι' : Type) (_ : Fintype ι') (T' : SimpleGraph ι') (τ' : ι' → Hypergraph α β), + IsTreeDecomposition G T' τ' ∧ + treeDecompWidthPlusOne τ' ≤ treeDecompWidthPlusOne τ ∧ + IsTernaryTree T' ∧ + (∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T', τ' t = edgeHypergraph G e) ∧ + (∀ t ∈ leafSet T', ∃ e ∈ G.edgeSet, τ' t = edgeHypergraph G e) := by + classical + have hmain : ∀ (n : ℕ) (ι₀ : Type) [Fintype ι₀] (T₀ : SimpleGraph ι₀) + (τ₀ : ι₀ → Hypergraph α β), + IsTreeDecomposition G T₀ τ₀ → + (∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T₀, τ₀ t = edgeHypergraph G e) → + (∀ t ∈ leafSet T₀, ∃ e ∈ G.edgeSet, τ₀ t = edgeHypergraph G e) → + (∀ t : ι₀, T₀.degree t ≤ 3) → + Fintype.card ι₀ = n → + ∃ (ι' : Type) (_ : Fintype ι') (T' : SimpleGraph ι') (τ' : ι' → Hypergraph α β), + IsTreeDecomposition G T' τ' ∧ + treeDecompWidthPlusOne τ' ≤ treeDecompWidthPlusOne τ₀ ∧ + IsTernaryTree T' ∧ + (∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T', τ' t = edgeHypergraph G e) ∧ + (∀ t ∈ leafSet T', ∃ e ∈ G.edgeSet, τ' t = edgeHypergraph G e) := by + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro ι₀ _ T₀ τ₀ h₀ h1 h2 hd3 hcard + by_cases hex2 : ∃ t₀ : ι₀, T₀.degree t₀ = 2 + · obtain ⟨t₀, ht₀_deg⟩ := hex2 + have hcard2 : (T₀.neighborFinset t₀).card = 2 := by + rw [card_neighborFinset_eq_degree, ht₀_deg] + obtain ⟨w₁, w₂, hw12, hfin_eq⟩ := Finset.card_eq_two.1 hcard2 + have hadj_iff : ∀ y, T₀.Adj t₀ y ↔ y = w₁ ∨ y = w₂ := by + intro y + rw [← mem_neighborFinset, hfin_eq, Finset.mem_insert, Finset.mem_singleton] + have hadj₁ : T₀.Adj t₀ w₁ := (hadj_iff w₁).2 (Or.inl rfl) + have hadj₂ : T₀.Adj t₀ w₂ := (hadj_iff w₂).2 (Or.inr rfl) + have ht₀_not_leaf : t₀ ∉ leafSet T₀ := by + unfold leafSet IsLeaf + rw [Set.mem_ofPred_eq] + omega + let S : Set ι₀ := {t₀}ᶜ + let T₁ := suppressVertex T₀ t₀ w₁ w₂ + let τ₁ : S → Hypergraph α β := fun x ↦ τ₀ x.1 + obtain ⟨h₁, hw₁⟩ := + suppressVertex_isTreeDecomposition hno_iso h₀ hadj₁ hadj₂ hw12 hadj_iff h1 + have hleaf_iff := + mem_leafSet_suppressVertex_iff h₀.isTree hadj₁ hadj₂ hw12 hadj_iff + have h1' : ∀ e ∈ G.edgeSet, ∃ x ∈ leafSet T₁, τ₁ x = edgeHypergraph G e := by + intro e heG + obtain ⟨t, ht_leaf, hτ_t⟩ := h1 e heG + have ht_ne : t ≠ t₀ := fun h ↦ ht₀_not_leaf (h ▸ ht_leaf) + exact ⟨⟨t, ht_ne⟩, (hleaf_iff ⟨t, ht_ne⟩).2 ht_leaf, hτ_t⟩ + have h2' : ∀ x ∈ leafSet T₁, ∃ e ∈ G.edgeSet, τ₁ x = edgeHypergraph G e := by + intro x hx_leaf + exact h2 x.1 ((hleaf_iff x).1 hx_leaf) + have hd3' : ∀ x : S, T₁.degree x ≤ 3 := by + intro x + rw [degree_suppressVertex h₀.isTree hadj₁ hadj₂ hw12 hadj_iff x] + exact hd3 x.1 + have hlt : Fintype.card S < n := by + rw [← hcard] + exact Fintype.card_lt_of_injective_of_notMem Subtype.val Subtype.val_injective + (by rintro ⟨⟨x, hx⟩, rfl⟩; exact hx rfl) + obtain ⟨ι', hfin', T', τ', h', hw', htern', hc1', hc2'⟩ := + ih (Fintype.card S) hlt S T₁ τ₁ h₁ h1' h2' hd3' rfl + exact ⟨ι', hfin', T', τ', h', hw'.trans hw₁, htern', hc1', hc2'⟩ + · push Not at hex2 + have htern : IsTernaryTree T₀ := by + refine ⟨h₀.isTree, fun v ↦ ?_⟩ + obtain ⟨e₁, he₁, e₂, he₂, he12⟩ := + (Set.one_lt_ncard G.edgeSet_finite).1 (by omega : 1 < G.edgeSet.ncard) + obtain ⟨t₁, _, hτ₁⟩ := h1 e₁ he₁ + obtain ⟨t₂, _, hτ₂⟩ := h1 e₂ he₂ + have ht12 : t₁ ≠ t₂ := by + rintro rfl + have hmem : e₁ ∈ (edgeHypergraph G e₂).edgeSet := by + rw [← hτ₂, hτ₁] + exact Set.mem_singleton e₁ + exact he12 (Set.mem_singleton_iff.1 hmem) + have hne_v : ∃ u : ι₀, v ≠ u := by + by_cases hvt₁ : v = t₁ + · exact ⟨t₂, hvt₁ ▸ ht12⟩ + · exact ⟨t₁, hvt₁⟩ + obtain ⟨u, hvu⟩ := hne_v + have hdeg_pos : 1 ≤ T₀.degree v := by + obtain ⟨p, _⟩ := h₀.isTree.connected.exists_isPath v u + cases p with + | nil => exact (hvu rfl).elim + | @cons _ w _ hadj _ => + rw [← card_neighborFinset_eq_degree] + exact Finset.card_pos.2 ⟨w, (mem_neighborFinset T₀ v w).2 hadj⟩ + have hle3 := hd3 v + have hne2 := hex2 v + omega + exact ⟨ι₀, inferInstance, T₀, τ₀, h₀, le_rfl, htern, h1, h2⟩ + let eFin := Fintype.equivFin ι + have hc1_fin : ∀ e ∈ G.edgeSet, ∃ t ∈ leafSet (T.map eFin.toEmbedding), + (τ ∘ eFin.symm) t = edgeHypergraph G e := by + intro e heG + obtain ⟨t, ht_leaf, hτ_t⟩ := hc1 e heG + refine ⟨eFin t, (isLeaf_map eFin t).2 ht_leaf, ?_⟩ + simpa using hτ_t + have hc2_fin : ∀ t ∈ leafSet (T.map eFin.toEmbedding), + ∃ e ∈ G.edgeSet, (τ ∘ eFin.symm) t = edgeHypergraph G e := by + intro t ht_leaf + obtain ⟨x, rfl⟩ := eFin.surjective t + rw [leafSet, Set.mem_ofPred_eq, isLeaf_map] at ht_leaf + simpa using hc2 x ht_leaf + have hd3_fin : ∀ t : Fin (Fintype.card ι), (T.map eFin.toEmbedding).degree t ≤ 3 := by + intro t + obtain ⟨x, rfl⟩ := eFin.surjective t + rw [degree_map_equiv T eFin x (inst₂ := by classical infer_instance)] + exact hdeg3 x + obtain ⟨ι', hfin', T', τ', h', hw', htern', hc1', hc2'⟩ := + hmain _ (Fin (Fintype.card ι)) (T.map eFin.toEmbedding) (τ ∘ eFin.symm) + (h.relabel eFin) hc1_fin hc2_fin (fun t ↦ by convert hd3_fin t) rfl + rw [treeDecompWidthPlusOne_comp_equiv] at hw' + exact ⟨ι', hfin', T', τ', h', hw', htern', hc1', hc2'⟩ + +/-! ## First inequality of (5.1) and main theorems (5.1) and (5.2) -/ + +/-- From a ternary tree-decomposition `(T, τ)` satisfying Claims (1) and (2) of `(5.1)`, we obtain +a branch-decomposition `(T, σ)` of `G` with `branchDecompWidth G T σ ≤ treeDecompWidthPlusOne τ` +(Graph Minors X, Section 5, proof of (5.1), page 169). -/ +theorem exists_branchDecomposition_le_treeDecompWidthPlusOne [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) + (htern : IsTernaryTree T) + (hc1 : ∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T, τ t = edgeHypergraph G e) + (hc2 : ∀ t ∈ leafSet T, ∃ e ∈ G.edgeSet, τ t = edgeHypergraph G e) : + ∃ σ : ι → β, IsBranchDecomposition G T σ ∧ + branchDecompWidth G T σ ≤ treeDecompWidthPlusOne τ := by + classical + by_cases hE : G.edgeSet.Nonempty + · obtain ⟨e_def, _⟩ := hE + let σ (t : ι) : β := if ht : t ∈ leafSet T then (hc2 t ht).choose else e_def + have hσ_mem : ∀ t ∈ leafSet T, σ t ∈ G.edgeSet := by + intro t ht + simp only [σ, ht, ↓reduceDIte] + exact (hc2 t ht).choose_spec.1 + have hσ_eq : ∀ t ∈ leafSet T, τ t = edgeHypergraph G (σ t) := by + intro t ht + simp only [σ, ht, ↓reduceDIte] + exact (hc2 t ht).choose_spec.2 + have hbij : Set.BijOn σ (leafSet T) G.edgeSet := by + refine ⟨hσ_mem, ?_, ?_⟩ + · intro t₁ ht₁ t₂ ht₂ hσ12 + have he1 : σ t₁ ∈ (τ t₁).edgeSet := by + rw [hσ_eq t₁ ht₁] + exact Set.mem_singleton _ + have he2 : σ t₁ ∈ (τ t₂).edgeSet := by + rw [hσ12, hσ_eq t₂ ht₂] + exact Set.mem_singleton _ + exact h.eq_of_edge_mem he1 he2 + · intro e heG + obtain ⟨t, ht_leaf, hτ_t⟩ := hc1 e heG + refine ⟨t, ht_leaf, ?_⟩ + have he_mem : σ t ∈ (edgeHypergraph G e).edgeSet := by + rw [← hτ_t, hσ_eq t ht_leaf] + exact Set.mem_singleton _ + exact Set.mem_singleton_iff.1 he_mem + refine ⟨σ, ⟨htern, hbij⟩, ?_⟩ + rw [branchDecompWidth_le_iff] + intro e he + induction e using Sym2.ind with + | _ u w => + have hadj : T.Adj u w := T.mem_edgeSet.1 he + have hsub : {v ∈ G.vertexSet | ∃ t₁ ∈ leafSet T, ∃ t₂ ∈ leafSet T, + ¬ (T.deleteEdges {s(u, w)}).Reachable t₁ t₂ ∧ G.Inc (σ t₁) v ∧ G.Inc (σ t₂) v} ⊆ + (τ u).vertexSet := by + rintro v ⟨_, t₁, ht₁, t₂, ht₂, hnot_reach, hinc₁, hinc₂⟩ + have hv₁ : v ∈ (τ t₁).vertexSet := by + rw [hσ_eq t₁ ht₁] + exact hinc₁ + have hv₂ : v ∈ (τ t₂).vertexSet := by + rw [hσ_eq t₂ ht₂] + exact hinc₂ + rw [not_reachable_deleteEdges_iff_treeComponent h.isTree hadj] at hnot_reach + rcases hnot_reach with ⟨hc1_u, hc2_w⟩ | ⟨hc1_w, hc2_u⟩ + · have hp : OnTreePath T t₁ t₂ u := + onTreePath_of_mem_treeComponent h.isTree hadj hc1_u hc2_w + exact (h.inter_le hp).vertexSet_subset ⟨hv₁, hv₂⟩ + · have hp : OnTreePath T t₂ t₁ u := + onTreePath_of_mem_treeComponent h.isTree hadj hc2_u hc1_w + exact (h.inter_le hp).vertexSet_subset ⟨hv₂, hv₁⟩ + exact (Set.ncard_le_ncard hsub (τ u).vertexSet_finite).trans + (ncard_vertexSet_le_treeDecompWidthPlusOne τ u) + · rw [Set.not_nonempty_iff_eq_empty] at hE + have h2 : 2 ≤ (leafSet T).ncard := htern.two_le_ncard_leafSet + obtain ⟨t, ht_leaf⟩ : (leafSet T).Nonempty := Set.nonempty_of_ncard_ne_zero (by omega) + obtain ⟨e, heG, _⟩ := hc2 t ht_leaf + rw [hE] at heG + exact heG.elim + +/-- First inequality of **(5.1)** (Graph Minors X, Section 5, (5.1), pages 168–169): +For every hypergraph `G`, `branchWidth G ≤ treeWidthPlusOne G` (`β(G) ≤ ω(G) + 1`). -/ +theorem branchWidth_le_treeWidthPlusOne (G : Hypergraph α β) : + branchWidth G ≤ treeWidthPlusOne G := by + by_cases hcard : G.edgeSet.ncard ≤ 1 + · rw [branchWidth_eq_zero_of_ncard_edgeSet_le_one hcard] + exact Nat.zero_le _ + · push Not at hcard + let H := G.deleteVertices (isoSet G) + have hiso : ∀ v ∈ isoSet G, ∀ e, ¬ G.Inc e v := by + intro v hv + exact (Set.mem_sep_iff.1 hv).2 + have hbwH : branchWidth H = branchWidth G := branchWidth_deleteVertices_of_isolated hiso + have htwH : treeWidthPlusOne H ≤ treeWidthPlusOne G := + treeWidthPlusOne_deleteVertices_le_of_isolated hiso + have hcardH : 2 ≤ H.edgeSet.ncard := by + rw [deleteVertices_edgeSet_of_isolated hiso] + exact hcard + have hEH : H.edgeSet.Nonempty := Set.nonempty_of_ncard_ne_zero (by omega) + have hno_isoH : ∀ v ∈ H.vertexSet, ∃ e, H.Inc e v := + fun _ hv ↦ exists_inc_deleteVertices_isoSet hv + obtain ⟨ι₀, _, T₀, τ₀, h₀, hw₀⟩ := exists_treeDecomposition_eq_treeWidthPlusOne H + obtain ⟨ι₁, _, T₁, τ₁, h₁, hw₁, hc1₁, _⟩ := theorem_5_1_claim_1 h₀ + obtain ⟨ι₂, _, T₂, τ₂, h₂, hw₂, hc1₂, hc2₂, hnl₂⟩ := + theorem_5_1_claim_2 hno_isoH hEH h₁ hc1₁ + obtain ⟨ι₃, _, T₃, τ₃, h₃, hw₃, hc1₃, hc2₃, _, hd3₃⟩ := + theorem_5_1_claim_3 h₂ hc1₂ hc2₂ hnl₂ + obtain ⟨ι₄, _, T₄, τ₄, h₄, hw₄, htern₄, hc1₄, hc2₄⟩ := + exists_ternary_treeDecomposition hno_isoH hcardH h₃ hc1₃ hc2₃ hd3₃ + obtain ⟨σ, hbd, hw_bd⟩ := + exists_branchDecomposition_le_treeDecompWidthPlusOne h₄ htern₄ hc1₄ hc2₄ + have hbw_le : branchWidth H ≤ branchDecompWidth H T₄ σ := + branchWidth_le_of_isBranchDecomposition hbd + rw [← hbwH] + exact hbw_le.trans (hw_bd.trans (hw₄.trans (hw₃.trans (hw₂.trans (hw₁.trans + (hw₀.trans_le htwH)))))) + +/-- **Graph Minors X, (5.1)** (page 168): +"(5.1) *For any hypergraph $G$, $\max(\beta(G), \gamma(G)) \le \omega(G) + 1 \le +\max(\lfloor(3/2) \beta(G)\rfloor, \gamma(G), 1)$.*" -/ +theorem theorem_5_1_proof (G : Hypergraph α β) : + max (branchWidth G) (maxEdgeSize G) ≤ treeWidthPlusOne G ∧ + treeWidthPlusOne G ≤ max (max (3 * branchWidth G / 2) (maxEdgeSize G)) 1 := + ⟨max_le (branchWidth_le_treeWidthPlusOne G) (maxEdgeSize_le_treeWidthPlusOne G), + treeWidthPlusOne_le_max_branchWidth_maxEdgeSize G⟩ + +/-- **Graph Minors X, (5.2)** (page 169): +"For any hypergraph $G$, $\theta(G) \le \omega(G) + 1 \le (3/2) \theta(G)$." -/ +theorem theorem_5_2_proof (G : Hypergraph α β) : + tangleNumber G ≤ treeWidthPlusOne G ∧ 2 * treeWidthPlusOne G ≤ 3 * tangleNumber G := by + by_cases hcase : maxEdgeSize G = 0 ∧ G.vertexSet.Nonempty + · obtain ⟨hγ, hV⟩ := hcase + obtain ⟨_, htw⟩ := branchWidth_and_treeWidthPlusOne_of_maxEdgeSize_eq_zero hγ hV + have hθ1 : tangleNumber G = 1 := tangleNumber_eq_one_of_maxEdgeSize_eq_zero hγ hV + rw [htw, hθ1] + omega + · have h43 := theorem_4_3_proof G hcase + have hle : tangleNumber G ≤ treeWidthPlusOne G := by + rw [← h43] + exact (theorem_5_1_proof G).1 + have hle2 : 2 * treeWidthPlusOne G ≤ 3 * tangleNumber G := by + rw [← h43] + by_cases hγ : maxEdgeSize G = 0 + · have hV : G.vertexSet = ∅ := + Set.not_nonempty_iff_eq_empty.1 fun hne ↦ hcase ⟨hγ, hne⟩ + exact two_mul_treeWidthPlusOne_le_three_mul_max (Or.inr hV) + · exact two_mul_treeWidthPlusOne_le_three_mul_max + (Or.inl (Nat.one_le_iff_ne_zero.2 hγ)) + exact ⟨hle, hle2⟩ + +/-- Proof of `Theorem43Statement` (Graph Minors X, (4.3)). -/ +theorem theorem_4_3_statement : Theorem43Statement := + fun G h ↦ theorem_4_3_proof G h + +/-- Proof of `Theorem45Statement` (Graph Minors X, (4.5)). -/ +theorem theorem_4_5_statement : Theorem45Statement := by + intro α β G θ 𝒯 hθ hsep_ord hax1 hi hii + refine theorem_4_5_proof hθ (fun _ _ h ↦ (hsep_ord h).1) (fun _ _ h ↦ (hsep_ord h).2) hax1 hi ?_ + rintro ⟨A₁, A₂, A₃, h1, h2, h3, hd12, hd13, hd23, hU, hm1, hm2, hm3⟩ + exact hii ⟨A₁, A₂, A₃, h1, h2, h3, hd12, hd23, hd13, hU, hm1, hm2, hm3⟩ + +/-- Proof of `Theorem51Statement` (Graph Minors X, (5.1)). -/ +theorem theorem_5_1_statement : Theorem51Statement := + fun G ↦ theorem_5_1_proof G + +/-- Proof of `Theorem52Statement` (Graph Minors X, (5.2)). -/ +theorem theorem_5_2_statement : Theorem52Statement := + fun G ↦ theorem_5_2_proof G + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/TreeWidthBasic.lean b/LeanPool/GraphMinor/GM10/TreeWidthBasic.lean new file mode 100644 index 0000000000..3223eac65d --- /dev/null +++ b/LeanPool/GraphMinor/GM10/TreeWidthBasic.lean @@ -0,0 +1,1256 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.BranchWidth + +/-! +# Tree-Width Basics and Branch-to-Tree Conversion: Graph Minors X, Section 5 (Part 1) + +This file develops the basic theory of tree-decompositions and proves the second inequality of +**(5.1)** of Robertson and Seymour, +*Graph Minors. X. Obstructions to tree-decomposition*, J. Combin. Theory Ser. B 52 (1991) 153–190 +(pages 168–170): +- Basic properties of `OnTreePath` and convexity of `treeComponent` with respect to paths in trees. +- Basic properties of `IsTreeDecomposition`, `treeDecompWidthPlusOne`, and `treeWidthPlusOne`. +- Attaching a pendant leaf (`attachLeaf`) to a tree and reducing `treeWidthPlusOne` to hypergraphs + without isolated vertices (`isoSet`). +- Constructing a tree-decomposition from a branch-decomposition and proving the upper bound + `2 * treeWidthPlusOne G ≤ 3 * max (branchWidth G) (maxEdgeSize G)` when `1 ≤ maxEdgeSize G`. +-/ + +public section + +namespace GraphMinor.GM10 + +open SimpleGraph Hypergraph + +variable {α β ι ι' : Type*} + +/-! ## Basic properties of `OnTreePath` and `treeComponent` -/ + +/-- The start vertex `t₁` lies on every path from `t₁` to `t₂`. -/ +theorem onTreePath_refl_left (T : SimpleGraph ι) (t₁ t₂ : ι) : OnTreePath T t₁ t₂ t₁ := + GraphMinor.TreePath.left T t₁ t₂ + +/-- The end vertex `t₂` lies on every path from `t₁` to `t₂`. -/ +theorem onTreePath_refl_right (T : SimpleGraph ι) (t₁ t₂ : ι) : OnTreePath T t₁ t₂ t₂ := + GraphMinor.TreePath.right T t₁ t₂ + +/-- `OnTreePath T t₁ t₂ t` is symmetric in `t₁` and `t₂`. -/ +theorem onTreePath_comm {T : SimpleGraph ι} {t₁ t₂ t : ι} : + OnTreePath T t₁ t₂ t ↔ OnTreePath T t₂ t₁ t := + ⟨GraphMinor.TreePath.symm, GraphMinor.TreePath.symm⟩ + +/-- Only `t` lies on the path from `t` to `t`. -/ +theorem onTreePath_self_iff {T : SimpleGraph ι} {t t' : ι} : + OnTreePath T t t t' ↔ t' = t := + GraphMinor.TreePath.self_iff + +/-- If `OnTreePath T t₁ t₂ t`, then `t` belongs to the support of every walk from `t₁` to `t₂`. -/ +theorem mem_support_of_onTreePath {T : SimpleGraph ι} {t₁ t₂ t : ι} + (h : OnTreePath T t₁ t₂ t) (w : T.Walk t₁ t₂) : t ∈ w.support := + GraphMinor.TreePath.mem_support h w + +/-- In a tree `T`, `OnTreePath T t₁ t₂ t` holds if and only if `t ∈ p.support` for a given path `p` +from `t₁` to `t₂`. -/ +theorem onTreePath_iff_of_isPath {T : SimpleGraph ι} (hT : T.IsTree) + {t₁ t₂ t : ι} {p : T.Walk t₁ t₂} (hp : p.IsPath) : + OnTreePath T t₁ t₂ t ↔ t ∈ p.support := by + constructor + · intro h + exact h p hp + · intro ht q hq + have hqp : q = p := + congrArg Subtype.val ((hT.isAcyclic.subsingleton_path t₁ t₂).elim ⟨q, hq⟩ ⟨p, hp⟩) + rwa [hqp] + +/-- If `v` has at most one neighbor in `G`, then any path containing `v` has `v` as an endpoint. -/ +theorem eq_fst_or_eq_snd_of_mem_support_of_unique_adj {G : SimpleGraph ι} {v : ι} + (huniq : ∀ w₁ w₂, G.Adj v w₁ → G.Adj v w₂ → w₁ = w₂) + {a b : ι} {p : G.Walk a b} (hp : p.IsPath) (hv : v ∈ p.support) : + v = a ∨ v = b := by + induction p with + | nil => + left + simpa using hv + | @cons a x b h₁ q ih => + rw [Walk.cons_isPath_iff] at hp + rw [Walk.support_cons, List.mem_cons] at hv + rcases hv with rfl | hv_q + · exact Or.inl rfl + · rcases ih hp.1 hv_q with rfl | rfl + · cases q with + | nil => exact Or.inr rfl + | @cons _ y _ h₂ r => + have hay : a = y := huniq a y h₁.symm h₂ + subst hay + exact (hp.2 (Walk.support_subset_support_cons r h₂ r.start_mem_support)).elim + · exact Or.inr rfl + +/-- In a connected graph `T`, if `v` has at most one neighbor and `OnTreePath T a b v`, then +`v = a ∨ v = b`. -/ +theorem eq_or_eq_of_onTreePath_of_unique_adj {T : SimpleGraph ι} (hconn : T.Connected) {v : ι} + (huniq : ∀ w₁ w₂, T.Adj v w₁ → T.Adj v w₂ → w₁ = w₂) + {a b : ι} (h : OnTreePath T a b v) : v = a ∨ v = b := by + obtain ⟨p, hp⟩ := hconn.exists_isPath a b + exact eq_fst_or_eq_snd_of_mem_support_of_unique_adj huniq hp (h p hp) + +/-- Any component `treeComponent T u e` of `T \ e` is convex with respect to `OnTreePath`. -/ +theorem mem_treeComponent_of_onTreePath {T : SimpleGraph ι} {u : ι} {e : Sym2 ι} + {a b x : ι} (ha : a ∈ treeComponent T u e) (hb : b ∈ treeComponent T u e) + (h : OnTreePath T a b x) : x ∈ treeComponent T u e := by + classical + have hab : (T.deleteEdges {e}).Reachable a b := ha.symm.trans hb + obtain ⟨w⟩ := hab + have hx_map : x ∈ (w.mapLe (SimpleGraph.deleteEdges_le _)).support := + mem_support_of_onTreePath h _ + rw [Walk.support_map, List.mem_map] at hx_map + obtain ⟨z, hz, rfl⟩ := hx_map + exact ha.trans (Walk.reachable (w.takeUntil z hz)) + +/-- If `x ∈ treeComponent T u s(u, w)` and `OnTreePath T a b x`, then at least one of `a, b` lies +in `treeComponent T u s(u, w)`. -/ +theorem mem_treeComponent_left_or_right_of_onTreePath {T : SimpleGraph ι} (hT : T.IsTree) + {u w a b x : ι} (hadj : T.Adj u w) + (hx : x ∈ treeComponent T u s(u, w)) (h : OnTreePath T a b x) : + a ∈ treeComponent T u s(u, w) ∨ b ∈ treeComponent T u s(u, w) := by + by_contra! hnot + have ha' : a ∈ treeComponent T w s(w, u) := (notMem_treeComponent_iff hT hadj).1 hnot.1 + have hb' : b ∈ treeComponent T w s(w, u) := (notMem_treeComponent_iff hT hadj).1 hnot.2 + have hx' : x ∈ treeComponent T w s(w, u) := mem_treeComponent_of_onTreePath ha' hb' h + exact (notMem_treeComponent_iff hT hadj).2 hx' hx + +/-- If `a ∈ treeComponent T u s(u, w)` and `b ∈ treeComponent T w s(w, u)`, then `u` lies on the +path of `T` between `a` and `b`. -/ +theorem onTreePath_of_mem_treeComponent {T : SimpleGraph ι} (hT : T.IsTree) + {u w a b : ι} (hadj : T.Adj u w) + (ha : a ∈ treeComponent T u s(u, w)) (hb : b ∈ treeComponent T w s(w, u)) : + OnTreePath T a b u := by + intro p hp + have hnot_reach : ¬ (T.deleteEdges {s(u, w)}).Reachable a b := + (not_reachable_deleteEdges_iff_treeComponent hT hadj).2 (Or.inl ⟨ha, hb⟩) + have he_mem : s(u, w) ∈ p.edges := by + by_contra he_not + apply hnot_reach + exact ⟨p.toDeleteEdges {s(u, w)} fun e he hmem ↦ by + rw [Set.mem_singleton_iff] at hmem + exact he_not (hmem ▸ he)⟩ + exact Walk.fst_mem_support_of_mem_edges p he_mem + +/-- For any subset `S : Set ι`, the set of vertices `x` lying on the path between two elements of +`S` is convex with respect to `OnTreePath`. -/ +theorem isConvex_exists_onTreePath {T : SimpleGraph ι} (hT : T.IsTree) {S : Set ι} + {a b c : ι} + (ha : ∃ t₁ ∈ S, ∃ t₂ ∈ S, OnTreePath T t₁ t₂ a) + (hb : ∃ t₁ ∈ S, ∃ t₂ ∈ S, OnTreePath T t₁ t₂ b) + (hc : OnTreePath T a b c) : + ∃ t₁ ∈ S, ∃ t₂ ∈ S, OnTreePath T t₁ t₂ c := by + by_cases hca : c = a + · subst hca; exact ha + · obtain ⟨p, hp⟩ := hT.connected.exists_isPath c a + cases p with + | nil => exact (hca rfl).elim + | @cons _ w _ hadj q => + obtain ⟨hq, hc_not_q⟩ := (Walk.cons_isPath_iff hadj q).1 hp + have ha_comp : a ∈ treeComponent T w s(w, c) := + (mem_treeComponent_iff_notMem_support hT hadj.symm hq).2 hc_not_q + have hb_comp : b ∈ treeComponent T c s(c, w) := by + rw [← notMem_treeComponent_iff hT hadj.symm] + intro hb_w + have hc_w : c ∈ treeComponent T w s(w, c) := + mem_treeComponent_of_onTreePath ha_comp hb_w hc + exact (notMem_treeComponent_iff hT hadj).2 hc_w Reachable.rfl + obtain ⟨t₁, ht₁S, t₂, ht₂S, ht12⟩ := ha + obtain ⟨t₃, ht₃S, t₄, ht₄S, ht34⟩ := hb + obtain ⟨s₁, hs₁S, hs₁_w⟩ : ∃ s₁ ∈ S, s₁ ∈ treeComponent T w s(w, c) := by + rcases mem_treeComponent_left_or_right_of_onTreePath hT hadj.symm ha_comp ht12 with h1 | h2 + · exact ⟨t₁, ht₁S, h1⟩ + · exact ⟨t₂, ht₂S, h2⟩ + obtain ⟨s₂, hs₂S, hs₂_c⟩ : ∃ s₂ ∈ S, s₂ ∈ treeComponent T c s(c, w) := by + rcases mem_treeComponent_left_or_right_of_onTreePath hT hadj hb_comp ht34 with h3 | h4 + · exact ⟨t₃, ht₃S, h3⟩ + · exact ⟨t₄, ht₄S, h4⟩ + exact ⟨s₂, hs₂S, s₁, hs₁S, onTreePath_of_mem_treeComponent hT hadj hs₂_c hs₁_w⟩ + +/-! ## Basic properties of `IsTreeDecomposition` and `treeWidthPlusOne` -/ + +/-- The index type of a tree-decomposition is nonempty. -/ +theorem IsTreeDecomposition.nonempty [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) : + Nonempty ι := + h.isTree.connected.nonempty + +/-- A vertex `v` belongs to `V(G)` if and only if `v ∈ V(τ(t))` for some `t : ι`. -/ +theorem IsTreeDecomposition.vertex_mem_iff [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) {v : α} : + v ∈ G.vertexSet ↔ ∃ t : ι, v ∈ (τ t).vertexSet := by + rw [← h.biUnion_eq] + simp [Hypergraph.biUnion] + +/-- An edge `e` belongs to `E(G)` if and only if `e ∈ E(τ(t))` for some `t : ι`. -/ +theorem IsTreeDecomposition.edge_mem_iff [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) {e : β} : + e ∈ G.edgeSet ↔ ∃ t : ι, e ∈ (τ t).edgeSet := by + rw [← h.biUnion_eq] + simp [Hypergraph.biUnion] + +/-- `G.Inc e v` holds if and only if `(τ t).Inc e v` for some `t : ι`. -/ +theorem IsTreeDecomposition.inc_iff [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) {e : β} {v : α} : + G.Inc e v ↔ ∃ t : ι, (τ t).Inc e v := by + rw [← h.biUnion_eq] + simp [Hypergraph.biUnion] + +/-- Each edge `e ∈ E(G)` belongs to `E(τ(t))` for at most one `t : ι`. -/ +theorem IsTreeDecomposition.eq_of_edge_mem [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) + {t t' : ι} {e : β} (ht : e ∈ (τ t).edgeSet) (ht' : e ∈ (τ t').edgeSet) : + t = t' := by + by_contra hne + have hemp := h.edgeSet_inter_eq hne + have hmem : e ∈ (τ t ∩ τ t').edgeSet := ⟨ht, ht'⟩ + rw [hemp] at hmem + exact hmem + +/-- If `e ∈ E(τ(t))`, then `(τ t).Inc e v ↔ G.Inc e v`, and `G.ends e ⊆ V(τ(t))`. -/ +theorem IsTreeDecomposition.inc_iff_of_edge_mem [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) + {t : ι} {e : β} (ht : e ∈ (τ t).edgeSet) {v : α} : + (τ t).Inc e v ↔ G.Inc e v := + inc_iff_of_le (h.le t) ht + +/-- If `e ∈ E(τ(t))`, then all ends of `e` in `G` belong to `V(τ(t))`. -/ +theorem IsTreeDecomposition.ends_subset_vertexSet_of_edge_mem [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) + {t : ι} {e : β} (ht : e ∈ (τ t).edgeSet) : + G.ends e ⊆ (τ t).vertexSet := + fun _ hv ↦ (τ t).vertex_mem_of_inc ((h.inc_iff_of_edge_mem ht).2 hv) + +/-- For every `t : ι`, `(τ t).vertexSet.ncard ≤ treeDecompWidthPlusOne τ`. -/ +theorem ncard_vertexSet_le_treeDecompWidthPlusOne [Finite ι] + (τ : ι → Hypergraph α β) (t : ι) : + (τ t).vertexSet.ncard ≤ treeDecompWidthPlusOne τ := + le_csSup (Set.finite_range _).bddAbove ⟨t, rfl⟩ + +/-- `treeDecompWidthPlusOne τ ≤ k` if and only if `(τ t).vertexSet.ncard ≤ k` for all `t : ι`. -/ +theorem treeDecompWidthPlusOne_le_iff [Finite ι] [Nonempty ι] + {τ : ι → Hypergraph α β} {k : ℕ} : + treeDecompWidthPlusOne τ ≤ k ↔ ∀ t : ι, (τ t).vertexSet.ncard ≤ k := by + constructor + · intro hk t + exact (ncard_vertexSet_le_treeDecompWidthPlusOne τ t).trans hk + · intro h + refine csSup_le (Set.range_nonempty _) ?_ + rintro _ ⟨t, rfl⟩ + exact h t + +/-- The trivial 1-vertex tree-decomposition `(⊥ : SimpleGraph (Fin 1), fun _ ↦ G)` of `G`. -/ +theorem isTreeDecomposition_trivial (G : Hypergraph α β) : + IsTreeDecomposition G (⊥ : SimpleGraph (Fin 1)) (fun _ ↦ G) where + isTree := by + refine ⟨Connected.mk fun u v ↦ Subsingleton.elim u v ▸ Reachable.rfl, ?_⟩ + intro v p hp + cases p with + | nil => exact hp.ne_nil rfl + | cons hadj _ => exact hadj + le _ := le_rfl + biUnion_eq := by + ext x <;> simp [Hypergraph.biUnion] + edgeSet_inter_eq t₁ t₂ hne := (hne (Subsingleton.elim t₁ t₂)).elim + inter_le _ _ _ _ := inter_le_left le_rfl le_rfl + +/-- The trivial 1-vertex tree-decomposition of `G` has `treeDecompWidthPlusOne = |V(G)|`. -/ +theorem treeDecompWidthPlusOne_trivial (G : Hypergraph α β) : + treeDecompWidthPlusOne (fun _ : Fin 1 ↦ G) = G.vertexSet.ncard := by + refine le_antisymm ?_ + (ncard_vertexSet_le_treeDecompWidthPlusOne (fun _ : Fin 1 ↦ G) (0 : Fin 1)) + rw [treeDecompWidthPlusOne_le_iff] + intro _ + exact le_rfl + +/-- Every hypergraph `G` has a tree-decomposition `(T, τ)` achieving `treeWidthPlusOne G`. -/ +theorem exists_treeDecomposition_eq_treeWidthPlusOne (G : Hypergraph α β) : + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α β), + IsTreeDecomposition G T τ ∧ treeDecompWidthPlusOne τ = treeWidthPlusOne G := by + let S : Set ℕ := {w : ℕ | ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) + (τ : ι → Hypergraph α β), IsTreeDecomposition G T τ ∧ treeDecompWidthPlusOne τ = w} + have hne : S.Nonempty := ⟨G.vertexSet.ncard, Fin 1, inferInstance, ⊥, fun _ ↦ G, + isTreeDecomposition_trivial G, treeDecompWidthPlusOne_trivial G⟩ + exact Nat.sInf_mem hne + +/-- `treeWidthPlusOne G ≤ G.vertexSet.ncard` for every hypergraph `G`. -/ +theorem treeWidthPlusOne_le_ncard_vertexSet (G : Hypergraph α β) : + treeWidthPlusOne G ≤ G.vertexSet.ncard := by + simpa [treeDecompWidthPlusOne_trivial] using + treeWidthPlusOne_le_of_isTreeDecomposition (isTreeDecomposition_trivial G) + +/-- For any tree-decomposition `(T, τ)` of `G`, `maxEdgeSize G ≤ treeDecompWidthPlusOne τ`. -/ +theorem maxEdgeSize_le_treeDecompWidthPlusOne [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) : + maxEdgeSize G ≤ treeDecompWidthPlusOne τ := by + rw [maxEdgeSize_le_iff] + intro e he + obtain ⟨t, ht⟩ := h.edge_mem_iff.1 he + have hsub := h.ends_subset_vertexSet_of_edge_mem ht + exact (Set.ncard_le_ncard hsub (τ t).vertexSet_finite).trans + (ncard_vertexSet_le_treeDecompWidthPlusOne τ t) + +/-- `maxEdgeSize G ≤ treeWidthPlusOne G` (`γ(G) ≤ ω(G) + 1`) for every hypergraph `G`. -/ +theorem maxEdgeSize_le_treeWidthPlusOne (G : Hypergraph α β) : + maxEdgeSize G ≤ treeWidthPlusOne G := by + obtain ⟨ι, _, T, τ, h, hw⟩ := exists_treeDecomposition_eq_treeWidthPlusOne G + rw [← hw] + exact maxEdgeSize_le_treeDecompWidthPlusOne h + +/-- `treeWidthPlusOne G = 0` (`ω(G) = -1`) if and only if `G.vertexSet = ∅`. -/ +theorem treeWidthPlusOne_eq_zero_iff {G : Hypergraph α β} : + treeWidthPlusOne G = 0 ↔ G.vertexSet = ∅ := by + constructor + · intro h0 + obtain ⟨ι, _, T, τ, h, hw⟩ := exists_treeDecomposition_eq_treeWidthPlusOne G + rw [h0] at hw + ext v + simp only [Set.mem_empty_iff_false, iff_false] + intro hv + obtain ⟨t, ht⟩ := h.vertex_mem_iff.1 hv + have hle := (ncard_vertexSet_le_treeDecompWidthPlusOne τ t).trans hw.le + have hemp : (τ t).vertexSet = ∅ := + (Set.ncard_eq_zero (τ t).vertexSet_finite).1 (Nat.le_zero.1 hle) + rw [hemp] at ht + exact ht + · intro hemp + have hle := treeWidthPlusOne_le_ncard_vertexSet G + rw [hemp, Set.ncard_empty, Nat.le_zero] at hle + exact hle + +/-- If `G.vertexSet` is nonempty, then `1 ≤ treeWidthPlusOne G` (`0 ≤ ω(G)`). -/ +theorem one_le_treeWidthPlusOne_of_nonempty {G : Hypergraph α β} (h : G.vertexSet.Nonempty) : + 1 ≤ treeWidthPlusOne G := by + have hne : treeWidthPlusOne G ≠ 0 := by + rw [ne_eq, treeWidthPlusOne_eq_zero_iff] + exact h.ne_empty + omega + +/-! ## Attaching a pendant leaf to a tree (`attachLeaf`) -/ + +/-- Attach a new leaf `none : Option ι` adjacent only to `some t₀` in `T : SimpleGraph ι`. -/ +@[expose] def attachLeaf (T : SimpleGraph ι) (t₀ : ι) : SimpleGraph (Option ι) where + Adj a b := + match a, b with + | some x, some y => T.Adj x y + | some x, none => x = t₀ + | none, some y => y = t₀ + | none, none => False + symm := ⟨by + intro a b h + cases a <;> cases b + · exact h + · exact h + · exact h + · exact h.symm⟩ + loopless := ⟨by rintro (_ | x) <;> simp⟩ + +instance [DecidableEq ι] (T : SimpleGraph ι) [DecidableRel T.Adj] (t₀ : ι) : + DecidableRel (attachLeaf T t₀).Adj := fun a b ↦ + match a, b with + | some x, some y => inferInstanceAs (Decidable (T.Adj x y)) + | some x, none => inferInstanceAs (Decidable (x = t₀)) + | none, some y => inferInstanceAs (Decidable (y = t₀)) + | none, none => isFalse id + +/-- The embedding of `T` into `attachLeaf T t₀` via `Option.some`. -/ +@[expose] def attachLeafSomeHom (T : SimpleGraph ι) (t₀ : ι) : T →g attachLeaf T t₀ where + toFun := Option.some + map_rel' h := h + +/-- The retraction `Option ι → ι` sending `some x` to `x` and `none` to `t₀`. -/ +@[expose] def projAttach (t₀ : ι) : Option ι → ι + | some x => x + | none => t₀ + +/-- `none` has `some t₀` as its unique neighbor in `attachLeaf T t₀`. -/ +theorem adj_attachLeaf_none_iff {T : SimpleGraph ι} {t₀ : ι} {w : Option ι} : + (attachLeaf T t₀).Adj none w ↔ w = some t₀ := by + cases w <;> simp [attachLeaf] + +private theorem attachLeaf_delete_new_walk_none {T : SimpleGraph ι} {u₀ : ι} + {a b : Option ι} (p : ((attachLeaf T u₀).deleteEdges {s(none, some u₀)}).Walk a b) + (ha : a = none) : b = none := by + induction p with + | nil => exact ha + | @cons x y w hxy _ _ => + subst ha + rcases y with _ | t + · exact (deleteEdges_adj.1 hxy).1.elim + · have htu : t = u₀ := (deleteEdges_adj.1 hxy).1 + subst htu + exact ((deleteEdges_adj.1 hxy).2 rfl).elim + +/-- Deleting the new edge isolates the attached leaf. -/ +theorem attachLeaf_delete_new_reachable_none {T : SimpleGraph ι} {u₀ : ι} + {z : Option ι} : + ((attachLeaf T u₀).deleteEdges {s(none, some u₀)}).Reachable none z ↔ z = none := by + constructor + · rintro ⟨p⟩ + exact attachLeaf_delete_new_walk_none p rfl + · rintro rfl + exact Reachable.refl _ + +/-- After deleting the new edge, the original vertices remain mutually reachable. -/ +theorem attachLeaf_delete_new_reachable_some {T : SimpleGraph ι} (hT : T.Connected) + {u₀ : ι} {z : Option ι} : + ((attachLeaf T u₀).deleteEdges {s(none, some u₀)}).Reachable (some u₀) z ↔ + ∃ t : ι, z = some t := by + constructor + · intro hr + rcases z with _ | t + · exfalso + have := attachLeaf_delete_new_reachable_none.1 hr.symm + simp at this + · exact ⟨t, rfl⟩ + · rintro ⟨t, rfl⟩ + obtain ⟨w⟩ := hT u₀ t + have hwalk : ∀ {a b : ι}, T.Walk a b → + ((attachLeaf T u₀).deleteEdges {s(none, some u₀)}).Reachable (some a) (some b) := by + intro a b p + induction p with + | nil => exact Reachable.refl _ + | @cons x y c hxy _ ih => + have hne : s(some x, some y) ≠ s(none, some u₀) := by simp + have hadj : ((attachLeaf T u₀).deleteEdges {s(none, some u₀)}).Adj (some x) (some y) := + deleteEdges_adj.mpr ⟨hxy, hne⟩ + exact hadj.reachable.trans ih + exact hwalk w + +/-- Deleting an original edge preserves reachability exactly on the corresponding sides. -/ +theorem attachLeaf_delete_old_reachable_iff {T : SimpleGraph ι} {u₀ x y : ι} + {a b : Option ι} : + ((attachLeaf T u₀).deleteEdges {s(some x, some y)}).Reachable a b ↔ + (T.deleteEdges {s(x, y)}).Reachable (projAttach u₀ a) (projAttach u₀ b) := by + have hproj : ∀ z : Option ι, + ((attachLeaf T u₀).deleteEdges {s(some x, some y)}).Reachable z (some (projAttach u₀ z)) := by + rintro (_ | t) + · have hne : s(none, some u₀) ≠ s(some x, some y) := by simp + have hadj : ((attachLeaf T u₀).deleteEdges {s(some x, some y)}).Adj none (some u₀) := + deleteEdges_adj.mpr ⟨rfl, hne⟩ + exact hadj.reachable + · exact Reachable.refl _ + constructor + · rintro ⟨p⟩ + induction p with + | nil => exact Reachable.refl _ + | @cons c d w hcd _ ih => + obtain ⟨hadj, hne⟩ := deleteEdges_adj.1 hcd + rcases c with _ | c <;> rcases d with _ | d + · exact ih + · change d = u₀ at hadj + rcases hadj with rfl + exact ih + · change c = u₀ at hadj + rcases hadj with rfl + exact ih + · change T.Adj c d at hadj + have hne' : s(c, d) ≠ s(x, y) := by + intro heq + exact hne (by simpa [Sym2.eq_iff] using Sym2.eq_iff.1 heq) + have hadj' : (T.deleteEdges {s(x, y)}).Adj c d := deleteEdges_adj.mpr ⟨hadj, hne'⟩ + exact hadj'.reachable.trans ih + · rintro ⟨q⟩ + have hlift : ∀ {c d : ι}, (T.deleteEdges {s(x, y)}).Walk c d → + ((attachLeaf T u₀).deleteEdges {s(some x, some y)}).Reachable (some c) (some d) := by + intro c d p + induction p with + | nil => exact Reachable.refl _ + | @cons c₁ c₂ c₃ hc₁₂ _ ih => + obtain ⟨hadj, hne⟩ := deleteEdges_adj.1 hc₁₂ + have hne' : s(some c₁, some c₂) ≠ s(some x, some y) := by + intro heq + exact hne (by simpa [Sym2.eq_iff] using Sym2.eq_iff.1 heq) + have hadj' : ((attachLeaf T u₀).deleteEdges {s(some x, some y)}).Adj (some c₁) (some c₂) := + deleteEdges_adj.mpr ⟨hadj, hne'⟩ + exact hadj'.reachable.trans ih + exact (hproj a).trans ((hlift q).trans (hproj b).symm) + +/-- Attaching a leaf to a tree yields a tree. -/ +theorem isTree_attachLeaf {T : SimpleGraph ι} (hT : T.IsTree) (u₀ : ι) : + (attachLeaf T u₀).IsTree where + connected := by + refine Connected.mk (fun a b ↦ ?_) + have ha : (attachLeaf T u₀).Reachable a (some (projAttach u₀ a)) := by + rcases a with _ | t + · exact Walk.reachable (Walk.cons (by simp [attachLeaf, projAttach]) .nil) + · exact Reachable.refl _ + have hb : (attachLeaf T u₀).Reachable b (some (projAttach u₀ b)) := by + rcases b with _ | t + · exact Walk.reachable (Walk.cons (by simp [attachLeaf, projAttach]) .nil) + · exact Reachable.refl _ + obtain ⟨w⟩ := hT.connected (projAttach u₀ a) (projAttach u₀ b) + exact ha.trans ((Walk.reachable (w.map (attachLeafSomeHom T u₀))).trans hb.symm) + isAcyclic := by + rw [isAcyclic_iff_forall_adj_isBridge] + rintro (_ | x) (_ | y) hadj + · exact hadj.elim + · change y = u₀ at hadj + subst y + intro hr + have := attachLeaf_delete_new_reachable_none.1 hr + simp at this + · change x = u₀ at hadj + subst x + intro hr + have hr' : ((attachLeaf T u₀).deleteEdges {s(none, some u₀)}).Reachable none (some u₀) := by + simpa [Sym2.eq_swap] using hr.symm + have := attachLeaf_delete_new_reachable_none.1 hr' + simp at this + · change T.Adj x y at hadj + intro hr + have hr' := attachLeaf_delete_old_reachable_iff.1 hr + exact (isAcyclic_iff_forall_adj_isBridge.1 hT.isAcyclic hadj) hr' + +/-- A short walk in `attachLeaf T t₀` from `a` to `some (projAttach t₀ a)` whose support maps into +`{projAttach t₀ a}`. -/ +@[expose] def toSomeWalk (T : SimpleGraph ι) (t₀ : ι) : + ∀ a : Option ι, (attachLeaf T t₀).Walk a (some (projAttach t₀ a)) + | some _ => Walk.nil + | none => Walk.cons (show (attachLeaf T t₀).Adj none (some t₀) from rfl) Walk.nil + +theorem projAttach_mem_toSomeWalk {T : SimpleGraph ι} {t₀ : ι} {a z : Option ι} + (hz : z ∈ (toSomeWalk T t₀ a).support) : + projAttach t₀ z = projAttach t₀ a := by + cases a with + | none => + dsimp only [toSomeWalk, projAttach] at hz ⊢ + rw [Walk.support_cons, Walk.support_nil, List.mem_cons, List.mem_singleton] at hz + rcases hz with rfl | rfl <;> rfl + | some x => + dsimp only [toSomeWalk, projAttach] at hz ⊢ + rw [Walk.support_nil, List.mem_singleton] at hz + subst hz + rfl + +/-- If `some t` lies on the path in `attachLeaf T t₀` between `a` and `b`, then `t` lies on the +path in `T` between `projAttach t₀ a` and `projAttach t₀ b`. -/ +theorem onTreePath_projAttach_of_some {T : SimpleGraph ι} {t₀ : ι} {a b : Option ι} {t : ι} + (h : OnTreePath (attachLeaf T t₀) a b (some t)) : + OnTreePath T (projAttach t₀ a) (projAttach t₀ b) t := by + intro p hp + let w : (attachLeaf T t₀).Walk a b := + (toSomeWalk T t₀ a).append + ((p.map (attachLeafSomeHom T t₀)).append (toSomeWalk T t₀ b).reverse) + have hm : some t ∈ w.support := mem_support_of_onTreePath h w + rcases (Walk.mem_support_append_iff _ _).1 hm with h1 | h2 + · have heq := projAttach_mem_toSomeWalk h1 + change t = projAttach t₀ a at heq + rw [heq] + exact p.start_mem_support + · rcases (Walk.mem_support_append_iff _ _).1 h2 with h3 | h4 + · have h3' : some t ∈ List.map (attachLeafSomeHom T t₀) p.support := + Walk.support_map (attachLeafSomeHom T t₀) p ▸ h3 + obtain ⟨z, hz, hzeq⟩ := List.mem_map.1 h3' + exact Option.some.inj hzeq ▸ hz + · have h4' : some t ∈ (toSomeWalk T t₀ b).support.reverse := + Walk.support_reverse (toSomeWalk T t₀ b) ▸ h4 + have heq := projAttach_mem_toSomeWalk (List.mem_reverse.1 h4') + change t = projAttach t₀ b at heq + rw [heq] + exact p.end_mem_support + +/-- `none` is always a leaf of `attachLeaf T t₀`. -/ +theorem isLeaf_attachLeaf_none [Fintype ι] (T : SimpleGraph ι) (t₀ : ι) : + IsLeaf (attachLeaf T t₀) none := by + classical + unfold IsLeaf + rw [← ncard_neighborSet] + have hset : (attachLeaf T t₀).neighborSet none = {some t₀} := by + ext w + simp [mem_neighborSet, adj_attachLeaf_none_iff] + rw [hset, Set.ncard_singleton] + +/-- For `x ≠ t₀`, `some x` is a leaf of `attachLeaf T t₀` if and only if `x` is a leaf of `T`. -/ +theorem isLeaf_attachLeaf_some_iff [Fintype ι] {T : SimpleGraph ι} {t₀ x : ι} (hne : x ≠ t₀) : + IsLeaf (attachLeaf T t₀) (some x) ↔ IsLeaf T x := by + classical + unfold IsLeaf + rw [← ncard_neighborSet, ← ncard_neighborSet] + have hset : (attachLeaf T t₀).neighborSet (some x) = Option.some '' T.neighborSet x := by + ext w + cases w with + | none => + simp [mem_neighborSet, attachLeaf, hne] + | some y => + simp [mem_neighborSet, attachLeaf] + rw [hset, Set.ncard_image_of_injective _ (Option.some_injective ι)] + +/-! ## Isolated vertices (`isoSet`) and `deleteVertices` -/ + +/-- The set of isolated vertices of `G` (vertices incident with no edge of `G`). -/ +@[expose] def isoSet (G : Hypergraph α β) : Set α := + {v ∈ G.vertexSet | ∀ e, ¬ G.Inc e v} + +theorem isoSet_finite (G : Hypergraph α β) : (isoSet G).Finite := + G.vertexSet_finite.subset fun _ h ↦ h.1 + +theorem deleteVertices_deleteVertices_singleton (G : Hypergraph α β) (X : Set α) (v : α) : + (G.deleteVertices X).deleteVertices {v} = G.deleteVertices (insert v X) := by + ext x <;> simp [Hypergraph.deleteVertices] <;> tauto + +/-- Deleting a set `X` of isolated vertices does not change `edgeSet` or `Inc`. -/ +theorem deleteVertices_edgeSet_of_isolated {G : Hypergraph α β} {X : Set α} + (hX : ∀ v ∈ X, ∀ e, ¬ G.Inc e v) : + (G.deleteVertices X).edgeSet = G.edgeSet := by + ext e + simp only [Hypergraph.deleteVertices, Set.mem_sep_iff, and_iff_left_iff_imp] + intro _ v hv + exact hX v hv e + +theorem deleteVertices_inc_of_isolated {G : Hypergraph α β} {X : Set α} + (hX : ∀ v ∈ X, ∀ e, ¬ G.Inc e v) (e : β) (u : α) : + (G.deleteVertices X).Inc e u ↔ G.Inc e u := by + simp only [Hypergraph.deleteVertices, and_iff_left_iff_imp] + intro _ w hw + exact hX w hw e + +theorem deleteVertices_ends_of_isolated {G : Hypergraph α β} {X : Set α} + (hX : ∀ v ∈ X, ∀ e, ¬ G.Inc e v) (e : β) : + (G.deleteVertices X).ends e = G.ends e := by + ext u + exact deleteVertices_inc_of_isolated hX e u + +/-- Deleting a set `X` of isolated vertices preserves `maxEdgeSize`. -/ +theorem maxEdgeSize_deleteVertices_of_isolated {G : Hypergraph α β} {X : Set α} + (hX : ∀ v ∈ X, ∀ e, ¬ G.Inc e v) : + maxEdgeSize (G.deleteVertices X) = maxEdgeSize G := by + have hedge : ∀ e, edgeSize (G.deleteVertices X) e = edgeSize G e := by + intro e + simp only [edgeSize, deleteVertices_ends_of_isolated hX] + simp only [maxEdgeSize, deleteVertices_edgeSet_of_isolated hX] + congr 1 + ext n + simp [hedge] + +/-- Deleting a set `X` of isolated vertices preserves `IsBranchDecomposition`. -/ +theorem isBranchDecomposition_deleteVertices_iff [Fintype ι] {G : Hypergraph α β} {X : Set α} + (hX : ∀ v ∈ X, ∀ e, ¬ G.Inc e v) {T : SimpleGraph ι} {τ : ι → β} : + IsBranchDecomposition (G.deleteVertices X) T τ ↔ IsBranchDecomposition G T τ := by + constructor <;> rintro ⟨hT, hbij⟩ <;> refine ⟨hT, ?_⟩ + · rwa [deleteVertices_edgeSet_of_isolated hX] at hbij + · rwa [deleteVertices_edgeSet_of_isolated hX] + +/-- Deleting a set `X` of isolated vertices preserves `branchEdgeOrder`. -/ +theorem branchEdgeOrder_deleteVertices_of_isolated [Fintype ι] {G : Hypergraph α β} {X : Set α} + (hX : ∀ v ∈ X, ∀ e, ¬ G.Inc e v) (T : SimpleGraph ι) (τ : ι → β) (e : Sym2 ι) : + branchEdgeOrder (G.deleteVertices X) T τ e = branchEdgeOrder G T τ e := by + simp only [branchEdgeOrder] + congr 1 + ext v + simp only [Set.mem_sep_iff] + constructor + · rintro ⟨⟨hv, _⟩, t₁, ht₁, t₂, ht₂, hnr, hinc₁, hinc₂⟩ + exact ⟨hv, t₁, ht₁, t₂, ht₂, hnr, + (deleteVertices_inc_of_isolated hX _ _).1 hinc₁, + (deleteVertices_inc_of_isolated hX _ _).1 hinc₂⟩ + · rintro ⟨hv, t₁, ht₁, t₂, ht₂, hnr, hinc₁, hinc₂⟩ + exact ⟨⟨hv, fun hvX ↦ hX v hvX (τ t₁) hinc₁⟩, t₁, ht₁, t₂, ht₂, hnr, + (deleteVertices_inc_of_isolated hX _ _).2 hinc₁, + (deleteVertices_inc_of_isolated hX _ _).2 hinc₂⟩ + +/-- Deleting a set `X` of isolated vertices preserves `branchDecompWidth`. -/ +theorem branchDecompWidth_deleteVertices_of_isolated [Fintype ι] {G : Hypergraph α β} {X : Set α} + (hX : ∀ v ∈ X, ∀ e, ¬ G.Inc e v) (T : SimpleGraph ι) (τ : ι → β) : + branchDecompWidth (G.deleteVertices X) T τ = branchDecompWidth G T τ := by + simp only [branchDecompWidth] + congr 1 + ext n + simp [branchEdgeOrder_deleteVertices_of_isolated hX] + +/-- Deleting a set `X` of isolated vertices preserves `branchWidth`. -/ +theorem branchWidth_deleteVertices_of_isolated {G : Hypergraph α β} {X : Set α} + (hX : ∀ v ∈ X, ∀ e, ¬ G.Inc e v) : + branchWidth (G.deleteVertices X) = branchWidth G := by + simp only [branchWidth, isBranchDecomposition_deleteVertices_iff hX, + branchDecompWidth_deleteVertices_of_isolated hX] + +/-- Every vertex of `G.deleteVertices (isoSet G)` is incident with an edge of +`G.deleteVertices (isoSet G)`. -/ +theorem exists_inc_deleteVertices_isoSet {G : Hypergraph α β} {v : α} + (hv : v ∈ (G.deleteVertices (isoSet G)).vertexSet) : + ∃ e, (G.deleteVertices (isoSet G)).Inc e v := by + rcases hv with ⟨hvG, hv_not_iso⟩ + rw [isoSet, Set.mem_sep_iff, not_and_or] at hv_not_iso + rcases hv_not_iso with hnot | hinc + · exact (hnot hvG).elim + · push Not at hinc + obtain ⟨e, he⟩ := hinc + exact ⟨e, (deleteVertices_inc_of_isolated (X := {v ∈ G.vertexSet | ∀ e, ¬ G.Inc e v}) + (fun _ h ↦ h.2) e v).2 he⟩ + +/-- Restricting a tree-decomposition `(T, τ)` of `G` by deleting a set `X` of isolated vertices +gives a tree-decomposition of `G.deleteVertices X`. -/ +theorem IsTreeDecomposition.deleteVertices_of_isolated [Fintype ι] {G : Hypergraph α β} + {X : Set α} (hX : ∀ v ∈ X, ∀ e, ¬ G.Inc e v) + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) : + IsTreeDecomposition (G.deleteVertices X) T (fun t ↦ (τ t).deleteVertices X) := by + have hX_sub : ∀ t, ∀ v ∈ X, ∀ e, ¬ (τ t).Inc e v := + fun t v hv e hinc ↦ hX v hv e (inc_of_le (h.le t) hinc) + have hle_del : ∀ t : ι, (τ t).deleteVertices X ≤ G.deleteVertices X := by + intro t + refine (le_iff_of_le ((deleteVertices_le (τ t) X).trans (h.le t)) (deleteVertices_le G X)).2 + ⟨Set.sdiff_subset_sdiff (h.le t).vertexSet_subset subset_rfl, ?_⟩ + rw [deleteVertices_edgeSet_of_isolated (hX_sub t), deleteVertices_edgeSet_of_isolated hX] + exact (h.le t).edgeSet_subset + refine ⟨h.isTree, hle_del, ?_, ?_, ?_⟩ + · ext x + · simp only [Hypergraph.biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion] + change (∃ i, x ∈ (τ i).vertexSet ∧ x ∉ X) ↔ x ∈ G.vertexSet ∧ x ∉ X + rw [exists_and_right, ← h.vertex_mem_iff] + · simp only [Hypergraph.biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion, + deleteVertices_edgeSet_of_isolated hX, deleteVertices_edgeSet_of_isolated (hX_sub _), + ← h.edge_mem_iff] + · simp only [Hypergraph.biUnion, Finset.mem_univ, true_and, + deleteVertices_inc_of_isolated hX, deleteVertices_inc_of_isolated (hX_sub _), + ← h.inc_iff] + · intro t₁ t₂ hne + change ((τ t₁).deleteVertices X).edgeSet ∩ ((τ t₂).deleteVertices X).edgeSet = ∅ + rw [deleteVertices_edgeSet_of_isolated (hX_sub t₁), + deleteVertices_edgeSet_of_isolated (hX_sub t₂)] + exact h.edgeSet_inter_eq hne + · intro t₁ t₃ t₂ hp + have hle := h.inter_le hp + refine (le_iff_of_le (GM10.inter_le (hle_del t₁) (hle_del t₂)) (hle_del t₃)).2 ⟨?_, ?_⟩ + · intro v ⟨⟨hv1, hvX⟩, ⟨hv2, _⟩⟩ + exact ⟨hle.vertexSet_subset ⟨hv1, hv2⟩, hvX⟩ + · change ((τ t₁).deleteVertices X).edgeSet ∩ ((τ t₂).deleteVertices X).edgeSet ⊆ + ((τ t₃).deleteVertices X).edgeSet + rw [deleteVertices_edgeSet_of_isolated (hX_sub t₁), + deleteVertices_edgeSet_of_isolated (hX_sub t₂), + deleteVertices_edgeSet_of_isolated (hX_sub t₃)] + exact hle.edgeSet_subset + +/-- Deleting a set `X` of isolated vertices does not increase `treeWidthPlusOne`. -/ +theorem treeWidthPlusOne_deleteVertices_le_of_isolated {G : Hypergraph α β} {X : Set α} + (hX : ∀ v ∈ X, ∀ e, ¬ G.Inc e v) : + treeWidthPlusOne (G.deleteVertices X) ≤ treeWidthPlusOne G := by + obtain ⟨ι, _, T, τ, h, hw⟩ := exists_treeDecomposition_eq_treeWidthPlusOne G + have : Nonempty ι := h.nonempty + refine (treeWidthPlusOne_le_of_isTreeDecomposition (h.deleteVertices_of_isolated hX)).trans ?_ + rw [← hw, treeDecompWidthPlusOne_le_iff] + intro t + refine (Set.ncard_le_ncard Set.sdiff_subset (τ t).vertexSet_finite).trans + (ncard_vertexSet_le_treeDecompWidthPlusOne τ t) + +/-- Attaching a single isolated vertex `v ∈ V(G)` to a tree-decomposition of `G \ {v}` increases +`treeWidthPlusOne` by at most `max _ 1`. -/ +theorem treeWidthPlusOne_le_max_deleteVertices_singleton {G : Hypergraph α β} {v : α} + (hvG : v ∈ G.vertexSet) (hiso : ∀ e, ¬ G.Inc e v) : + treeWidthPlusOne G ≤ max (treeWidthPlusOne (G.deleteVertices {v})) 1 := by + obtain ⟨ι, _, T, τ, h, hw⟩ := + exists_treeDecomposition_eq_treeWidthPlusOne (G.deleteVertices {v}) + obtain ⟨t₀⟩ := h.nonempty + let τ' : Option ι → Hypergraph α β + | some t => τ t + | none => vertexHypergraph v + have hX : ∀ w ∈ ({v} : Set α), ∀ e, ¬ G.Inc e w := by + rintro w rfl e; exact hiso e + have hv_not_τ : ∀ t : ι, v ∉ (τ t).vertexSet := by + intro t hv_mem + exact (h.le t).vertexSet_subset hv_mem |>.2 (Set.mem_singleton v) + have hle_G : ∀ x : Option ι, τ' x ≤ G := by + rintro (_ | t) + · exact vertexHypergraph_le hvG + · exact (h.le t).trans (deleteVertices_le G {v}) + have hτ' : IsTreeDecomposition G (attachLeaf T t₀) τ' := by + refine ⟨isTree_attachLeaf h.isTree t₀, hle_G, ?_, ?_, ?_⟩ + · ext x + · simp only [Hypergraph.biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion] + constructor + · rintro ⟨a, hx⟩ + exact (hle_G a).vertexSet_subset hx + · intro hxG + by_cases hxv : x = v + · exact ⟨none, by simp [τ', vertexHypergraph, hxv]⟩ + · have hx' : x ∈ (G.deleteVertices {v}).vertexSet := ⟨hxG, hxv⟩ + obtain ⟨t, ht⟩ := h.vertex_mem_iff.1 hx' + exact ⟨some t, ht⟩ + · simp only [Hypergraph.biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion] + constructor + · rintro ⟨a, he⟩ + exact (hle_G a).edgeSet_subset he + · intro heG + rw [← deleteVertices_edgeSet_of_isolated hX] at heG + obtain ⟨t, ht⟩ := h.edge_mem_iff.1 heG + exact ⟨some t, ht⟩ + · simp only [Hypergraph.biUnion, Finset.mem_univ, true_and] + constructor + · rintro ⟨a, hinc⟩ + exact inc_of_le (hle_G a) hinc + · intro hincG + rw [← deleteVertices_inc_of_isolated hX] at hincG + obtain ⟨t, ht⟩ := h.inc_iff.1 hincG + exact ⟨some t, ht⟩ + · rintro (_ | t₁) (_ | t₂) hne + · exact (hne rfl).elim + · exact Set.empty_inter _ + · exact Set.inter_empty _ + · exact h.edgeSet_inter_eq (fun h ↦ hne (congrArg Option.some h)) + · rintro (_ | t₁) c (_ | t₂) hp + · have hc : c = none := onTreePath_self_iff.1 hp + subst hc + exact GM10.inter_le_left (hle_G none) (hle_G none) + · have hbot : τ' none ∩ τ' (some t₂) = ⊥ := by + ext x + · simp only [τ', vertexHypergraph, inter_vertexSet, Set.mem_inter_iff, + Set.mem_singleton_iff, bot_vertexSet, Set.mem_empty_iff_false, iff_false] + rintro ⟨rfl, hx⟩ + exact hv_not_τ t₂ hx + · simp [τ', vertexHypergraph] + · simp [τ', vertexHypergraph, inter_inc] + rw [hbot] + exact bot_le + · have hbot : τ' (some t₁) ∩ τ' none = ⊥ := by + ext x + · simp only [τ', vertexHypergraph, inter_vertexSet, Set.mem_inter_iff, + Set.mem_singleton_iff, bot_vertexSet, Set.mem_empty_iff_false, iff_false] + rintro ⟨hx, rfl⟩ + exact hv_not_τ t₁ hx + · simp [τ', vertexHypergraph] + · simp [τ', vertexHypergraph, inter_inc] + rw [hbot] + exact bot_le + · cases c with + | none => + rcases eq_or_eq_of_onTreePath_of_unique_adj (isTree_attachLeaf h.isTree t₀).connected + (fun w₁ w₂ h₁ h₂ ↦ (adj_attachLeaf_none_iff.1 h₁).trans + (adj_attachLeaf_none_iff.1 h₂).symm) hp with h1 | h2 + · exact nomatch h1 + · exact nomatch h2 + | some t₃ => + exact h.inter_le (onTreePath_projAttach_of_some hp) + refine (treeWidthPlusOne_le_of_isTreeDecomposition hτ').trans ?_ + rw [← hw, treeDecompWidthPlusOne_le_iff] + rintro (_ | t) + · simp [τ', vertexHypergraph] + · exact (ncard_vertexSet_le_treeDecompWidthPlusOne τ t).trans (le_max_left _ _) + +/-- Deleting all isolated vertices `isoSet G` changes `treeWidthPlusOne G` by at most `max _ 1`. -/ +theorem treeWidthPlusOne_le_max_deleteVertices_isoSet (G : Hypergraph α β) : + treeWidthPlusOne G ≤ max (treeWidthPlusOne (G.deleteVertices (isoSet G))) 1 := by + suffices ∀ (X : Set α), X.Finite → X ⊆ isoSet G → + treeWidthPlusOne G ≤ max (treeWidthPlusOne (G.deleteVertices X)) 1 from + this (isoSet G) (isoSet_finite G) subset_rfl + intro X hXfin + induction X, hXfin using Set.Finite.induction_on with + | empty => + intro _ + have heq : G.deleteVertices ∅ = G := by + ext x <;> simp [Hypergraph.deleteVertices] + rw [heq] + exact le_max_left _ _ + | @insert v S hvS _ ih => + intro hsub + have hS_sub : S ⊆ isoSet G := (Set.subset_insert v S).trans hsub + have hv_iso : v ∈ isoSet G := hsub (Set.mem_insert v S) + have hstep1 := ih hS_sub + have hv_mem : v ∈ (G.deleteVertices S).vertexSet := ⟨hv_iso.1, hvS⟩ + have hv_iso' : ∀ e, ¬ (G.deleteVertices S).Inc e v := fun e hinc ↦ hv_iso.2 e hinc.1 + have hstep2 := treeWidthPlusOne_le_max_deleteVertices_singleton hv_mem hv_iso' + rw [deleteVertices_deleteVertices_singleton] at hstep2 + omega + +/-- When `maxEdgeSize G = 0` and `G.vertexSet` is nonempty, `branchWidth G = 0` and +`treeWidthPlusOne G = 1` (`ω(G) = 0`) +(Graph Minors X, Section 5, (5.1), page 168). -/ +theorem branchWidth_and_treeWidthPlusOne_of_maxEdgeSize_eq_zero {G : Hypergraph α β} + (hγ : maxEdgeSize G = 0) (hne : G.vertexSet.Nonempty) : + branchWidth G = 0 ∧ treeWidthPlusOne G = 1 := by + refine ⟨branchWidth_eq_zero_of_maxEdgeSize_eq_zero hγ, ?_⟩ + have hge : 1 ≤ treeWidthPlusOne G := one_le_treeWidthPlusOne_of_nonempty hne + have hiso_eq : isoSet G = G.vertexSet := by + ext v + simp only [isoSet, Set.mem_sep_iff, and_iff_left_iff_imp] + intro _ e hinc + exact maxEdgeSize_eq_zero_iff.1 hγ e (G.edge_mem_of_inc hinc) v hinc + have hemp : (G.deleteVertices (isoSet G)).vertexSet = ∅ := by + change G.vertexSet \ isoSet G = ∅ + rw [hiso_eq, Set.sdiff_self] + have htw0 : treeWidthPlusOne (G.deleteVertices (isoSet G)) = 0 := + treeWidthPlusOne_eq_zero_iff.2 hemp + have hle := treeWidthPlusOne_le_max_deleteVertices_isoSet G + rw [htw0] at hle + omega + +/-- When `1 ≤ maxEdgeSize G` and `G.edgeSet.ncard ≤ 1`, `treeWidthPlusOne G ≤ maxEdgeSize G`. -/ +theorem treeWidthPlusOne_le_maxEdgeSize_of_ncard_edgeSet_le_one {G : Hypergraph α β} + (hγ : 1 ≤ maxEdgeSize G) (hcard : G.edgeSet.ncard ≤ 1) : + treeWidthPlusOne G ≤ maxEdgeSize G := by + obtain ⟨⟨e₀, he₀⟩, _⟩ := nonempty_of_one_le_maxEdgeSize hγ + have he_eq : ∀ e ∈ G.edgeSet, e = e₀ := by + intro e he + by_contra hne + have hsub : ({e, e₀} : Set β) ⊆ G.edgeSet := by + rintro x (rfl | rfl) <;> assumption + have h2 : ({e, e₀} : Set β).ncard = 2 := Set.ncard_pair hne + have hle := Set.ncard_le_ncard hsub G.edgeSet_finite + omega + have hsub_ends : (G.deleteVertices (isoSet G)).vertexSet ⊆ G.ends e₀ := by + intro v hv + obtain ⟨e, hinc⟩ := exists_inc_deleteVertices_isoSet hv + have he_mem : e ∈ G.edgeSet := G.edge_mem_of_inc hinc.1 + rw [← he_eq e he_mem] + exact hinc.1 + have htw_del : treeWidthPlusOne (G.deleteVertices (isoSet G)) ≤ maxEdgeSize G := + (treeWidthPlusOne_le_ncard_vertexSet _).trans + ((Set.ncard_le_ncard hsub_ends (ends_finite G e₀)).trans (edgeSize_le_maxEdgeSize he₀)) + have hle := treeWidthPlusOne_le_max_deleteVertices_isoSet G + omega + +/-! ## Second inequality of (5.1): tree-decomposition from a branch-decomposition -/ + +/-- The vertex set of the bag `σ(t)` constructed from a branch-decomposition `(T, τ)` of `G` +(Graph Minors X, Section 5, proof of (5.1), page 169): +all `v ∈ V(G)` such that there exist leaves `t₁, t₂` of `T` with `τ(t₁), τ(t₂)` incident with `v` +and `t` on the path of `T` between `t₁` and `t₂`. -/ +@[expose] def branchInternalBag [Fintype ι] (G : Hypergraph α β) (T : SimpleGraph ι) (τ : ι → β) + (t : ι) : Set α := + {v ∈ G.vertexSet | ∃ t₁ ∈ leafSet T, ∃ t₂ ∈ leafSet T, + G.Inc (τ t₁) v ∧ G.Inc (τ t₂) v ∧ OnTreePath T t₁ t₂ t} + +/-- For a leaf `t ∈ leafSet T`, `branchInternalBag G T τ t` is exactly `G.ends (τ t)`. -/ +theorem branchInternalBag_eq_ends_of_isLeaf [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → β} (hT : IsTernaryTree T) {t : ι} (ht : IsLeaf T t) : + branchInternalBag G T τ t = G.ends (τ t) := by + ext v + simp only [branchInternalBag, Hypergraph.ends, Set.mem_ofPred_eq] + constructor + · rintro ⟨_, t₁, _, t₂, _, hinc₁, hinc₂, hp⟩ + obtain ⟨w₀, _, hw₀_uniq⟩ := hT.exists_adj_of_isLeaf ht + have huniq : ∀ w₁ w₂, T.Adj t w₁ → T.Adj t w₂ → w₁ = w₂ := + fun w₁ w₂ h₁ h₂ ↦ (hw₀_uniq w₁ h₁).trans (hw₀_uniq w₂ h₂).symm + rcases eq_or_eq_of_onTreePath_of_unique_adj hT.isTree.connected huniq hp with rfl | rfl + · exact hinc₁ + · exact hinc₂ + · intro hinc + exact ⟨G.vertex_mem_of_inc hinc, t, ht, t, ht, hinc, hinc, onTreePath_refl_left T t t⟩ + +/-- The subhypergraph `σ(t)` of `G` constructed from a branch-decomposition `(T, τ)` of `G` +(Graph Minors X, Section 5, proof of (5.1), page 169): +- if `t` is a leaf of `T`, `σ(t) = K_{τ(t)}` (`edgeHypergraph G (τ t)`), +- if `t` is not a leaf of `T`, `E(σ(t)) = ∅` and `V(σ(t)) = branchInternalBag G T τ t`. -/ +@[expose] noncomputable def branchToTreeBag [Fintype ι] (G : Hypergraph α β) (T : SimpleGraph ι) + (τ : ι → β) (t : ι) : Hypergraph α β where + vertexSet := branchInternalBag G T τ t + edgeSet := {e ∈ G.edgeSet | IsLeaf T t ∧ e = τ t} + Inc e v := IsLeaf T t ∧ e = τ t ∧ G.Inc e v + vertex_mem_of_inc e v h := by + rcases h with ⟨ht, rfl, hinc⟩ + exact ⟨G.vertex_mem_of_inc hinc, t, ht, t, ht, hinc, hinc, onTreePath_refl_left T t t⟩ + edge_mem_of_inc e v h := ⟨G.edge_mem_of_inc h.2.2, h.1, h.2.1⟩ + vertexSet_finite := G.vertexSet_finite.subset fun _ h ↦ h.1 + edgeSet_finite := G.edgeSet_finite.subset fun _ h ↦ h.1 + +theorem branchToTreeBag_le [Fintype ι] {G : Hypergraph α β} {T : SimpleGraph ι} {τ : ι → β} + (t : ι) : branchToTreeBag G T τ t ≤ G where + vertexSet_subset _ h := h.1 + edgeSet_subset _ he := he.1 + ends_eq e he := by + rcases he with ⟨_, ht, rfl⟩ + ext v + simp [Hypergraph.ends, branchToTreeBag, ht] + +/-- If every vertex of `G` is incident with an edge and `(T, τ)` is a branch-decomposition of `G`, +then `(T, branchToTreeBag G T τ)` is a tree-decomposition of `G` +(Graph Minors X, Section 5, proof of (5.1), page 169). -/ +theorem isTreeDecomposition_branchToTreeBag [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → β} + (hno_iso : ∀ v ∈ G.vertexSet, ∃ e, G.Inc e v) + (hbd : IsBranchDecomposition G T τ) : + IsTreeDecomposition G T (branchToTreeBag G T τ) where + isTree := hbd.isTernaryTree.isTree + le := branchToTreeBag_le + biUnion_eq := by + ext x + · simp only [Hypergraph.biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion] + constructor + · rintro ⟨t, ht⟩ + exact ht.1 + · intro hxG + obtain ⟨e, hinc⟩ := hno_iso x hxG + obtain ⟨t, ht_leaf, rfl⟩ := hbd.bijOn.surjOn (G.edge_mem_of_inc hinc) + exact ⟨t, hxG, t, ht_leaf, t, ht_leaf, hinc, hinc, onTreePath_refl_left T t t⟩ + · simp only [Hypergraph.biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion] + constructor + · rintro ⟨t, ht⟩ + exact ht.1 + · intro heG + obtain ⟨t, ht_leaf, rfl⟩ := hbd.bijOn.surjOn heG + exact ⟨t, heG, ht_leaf, rfl⟩ + · simp only [Hypergraph.biUnion, Finset.mem_univ, true_and, branchToTreeBag] + constructor + · rintro ⟨_, _, _, hinc⟩ + exact hinc + · intro hincG + obtain ⟨t, ht_leaf, rfl⟩ := hbd.bijOn.surjOn (G.edge_mem_of_inc hincG) + exact ⟨t, ht_leaf, rfl, hincG⟩ + edgeSet_inter_eq t₁ t₂ hne := by + ext e + simp only [inter_edgeSet, Set.mem_inter_iff, Set.mem_empty_iff_false, iff_false] + rintro ⟨⟨_, h₁, rfl⟩, ⟨_, h₂, heq⟩⟩ + exact hne (hbd.bijOn.injOn h₁ h₂ heq) + inter_le {a c b} hp := by + refine (le_iff_of_le (GM10.inter_le (branchToTreeBag_le a) (branchToTreeBag_le b)) + (branchToTreeBag_le c)).2 ⟨?_, ?_⟩ + · intro v ⟨hva, hvb⟩ + have hconv := isConvex_exists_onTreePath hbd.isTernaryTree.isTree + (S := {t ∈ leafSet T | G.Inc (τ t) v}) + (by obtain ⟨_, t₁, ht₁, t₂, ht₂, hi₁, hi₂, hpa⟩ := hva + exact ⟨t₁, ⟨ht₁, hi₁⟩, t₂, ⟨ht₂, hi₂⟩, hpa⟩) + (by obtain ⟨_, t₃, ht₃, t₄, ht₄, hi₃, hi₄, hpb⟩ := hvb + exact ⟨t₃, ⟨ht₃, hi₃⟩, t₄, ⟨ht₄, hi₄⟩, hpb⟩) + hp + obtain ⟨s₁, ⟨hs₁, his₁⟩, s₂, ⟨hs₂, his₂⟩, hpc⟩ := hconv + exact ⟨hva.1, s₁, hs₁, s₂, hs₂, his₁, his₂, hpc⟩ + · rintro e ⟨⟨heG, ha, rfl⟩, ⟨_, hb, heq⟩⟩ + have hab : a = b := hbd.bijOn.injOn ha hb heq + subst hab + have hca : c = a := onTreePath_self_iff.1 hp + subst hca + exact ⟨heG, ha, rfl⟩ + +/-- For any internal vertex `t ∉ leafSet T` of a branch-decomposition `(T, τ)` of `G`, +`2 * (branchInternalBag G T τ t).ncard ≤ 3 * branchDecompWidth G T τ` +(Graph Minors X, Section 5, proof of (5.1), page 169). -/ +theorem two_mul_ncard_branchInternalBag_le [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → β} (hbd : IsBranchDecomposition G T τ) + {t : ι} (ht : ¬ IsLeaf T t) : + 2 * (branchInternalBag G T τ t).ncard ≤ 3 * branchDecompWidth G T τ := by + have hT := hbd.isTernaryTree + obtain ⟨w₁, w₂, w₃, hw12, hw13, hw23, hiff⟩ := hT.exists_three_adj_of_not_isLeaf ht + have hadj₁ : T.Adj t w₁ := (hiff w₁).2 (Or.inl rfl) + have hadj₂ : T.Adj t w₂ := (hiff w₂).2 (Or.inr (Or.inl rfl)) + have hadj₃ : T.Adj t w₃ := (hiff w₃).2 (Or.inr (Or.inr rfl)) + let E_edge : Sym2 ι → Set α := fun e ↦ + {v ∈ G.vertexSet | ∃ t₁ ∈ leafSet T, ∃ t₂ ∈ leafSet T, + ¬ (T.deleteEdges {e}).Reachable t₁ t₂ ∧ G.Inc (τ t₁) v ∧ G.Inc (τ t₂) v} + let B₁ := E_edge s(t, w₁) + let B₂ := E_edge s(t, w₂) + let B₃ := E_edge s(t, w₃) + have hB_fin : ∀ e, (E_edge e).Finite := + fun _ ↦ G.vertexSet_finite.subset fun _ h ↦ h.1 + have hB₁_le : B₁.ncard ≤ branchDecompWidth G T τ := + branchEdgeOrder_le_branchDecompWidth ((T.mem_edgeSet).2 hadj₁) + have hB₂_le : B₂.ncard ≤ branchDecompWidth G T τ := + branchEdgeOrder_le_branchDecompWidth ((T.mem_edgeSet).2 hadj₂) + have hB₃_le : B₃.ncard ≤ branchDecompWidth G T τ := + branchEdgeOrder_le_branchDecompWidth ((T.mem_edgeSet).2 hadj₃) + -- Partition `V(T) \ {t}` into the three components `treeComponent T w_i s(w_i, t)`. + obtain ⟨hsplit₁, _, _, _⟩ := treeComponent_split_of_not_isLeaf hT hadj₁ hw12 hw13 hw23 hiff + obtain ⟨hsplit₂, _, _, _⟩ := treeComponent_split_of_not_isLeaf hT hadj₂ hw12.symm hw23 hw13 + (fun x ↦ by rw [hiff]; tauto) + obtain ⟨hsplit₃, _, _, _⟩ := treeComponent_split_of_not_isLeaf hT hadj₃ hw13.symm hw23.symm hw12 + (fun x ↦ by rw [hiff]; tauto) + have hmem_three : ∀ x : ι, x ≠ t → + x ∈ treeComponent T w₁ s(w₁, t) ∨ + x ∈ treeComponent T w₂ s(w₂, t) ∨ + x ∈ treeComponent T w₃ s(w₃, t) := by + intro x hxt + by_cases hx₁ : x ∈ treeComponent T w₁ s(w₁, t) + · exact Or.inl hx₁ + · have hx_in : x ∈ treeComponent T t s(t, w₁) := + (notMem_treeComponent_iff hT.isTree hadj₁.symm).1 hx₁ + rw [hsplit₁] at hx_in + rcases hx_in with (rfl | hx₂) | hx₃ + · exact (hxt rfl).elim + · exact Or.inr (Or.inl hx₂) + · exact Or.inr (Or.inr hx₃) + have hmem_B : ∀ {w : ι} (hadj : T.Adj t w) {v : α} {t₁ t₂ : ι}, + v ∈ G.vertexSet → t₁ ∈ leafSet T → t₂ ∈ leafSet T → + G.Inc (τ t₁) v → G.Inc (τ t₂) v → + t₁ ∈ treeComponent T w s(w, t) → t₂ ∈ treeComponent T t s(t, w) → + v ∈ E_edge s(t, w) := by + intro w hadj v t₁ t₂ hvG ht₁ ht₂ hi₁ hi₂ hcomp₁ hcomp₂ + refine ⟨hvG, t₁, ht₁, t₂, ht₂, ?_, hi₁, hi₂⟩ + exact (not_reachable_deleteEdges_iff_treeComponent hT.isTree hadj).2 (Or.inr ⟨hcomp₁, hcomp₂⟩) + have hsub_two : branchInternalBag G T τ t ⊆ (B₁ ∩ B₂) ∪ (B₁ ∩ B₃) ∪ (B₂ ∩ B₃) := by + rintro v ⟨hvG, t₁, ht₁, t₂, ht₂, hi₁, hi₂, hp⟩ + have ht₁_ne : t₁ ≠ t := fun h ↦ ht (h ▸ ht₁) + have ht₂_ne : t₂ ≠ t := fun h ↦ ht (h ▸ ht₂) + have hnot_same : ∀ {w : ι}, T.Adj t w → + ¬ (t₁ ∈ treeComponent T w s(w, t) ∧ t₂ ∈ treeComponent T w s(w, t)) := by + rintro w hadj ⟨h1, h2⟩ + have ht_mem : t ∈ treeComponent T w s(w, t) := mem_treeComponent_of_onTreePath h1 h2 hp + exact (notMem_treeComponent_iff hT.isTree hadj).2 ht_mem Reachable.rfl + have hc₁_in_2 : treeComponent T w₁ s(w₁, t) ⊆ treeComponent T t s(t, w₂) := by + rw [hsplit₂]; exact Set.subset_union_of_subset_left Set.subset_union_right _ + have hc₁_in_3 : treeComponent T w₁ s(w₁, t) ⊆ treeComponent T t s(t, w₃) := by + rw [hsplit₃]; exact Set.subset_union_of_subset_left Set.subset_union_right _ + have hc₂_in_1 : treeComponent T w₂ s(w₂, t) ⊆ treeComponent T t s(t, w₁) := by + rw [hsplit₁]; exact Set.subset_union_of_subset_left Set.subset_union_right _ + have hc₂_in_3 : treeComponent T w₂ s(w₂, t) ⊆ treeComponent T t s(t, w₃) := by + rw [hsplit₃]; exact Set.subset_union_right + have hc₃_in_1 : treeComponent T w₃ s(w₃, t) ⊆ treeComponent T t s(t, w₁) := by + rw [hsplit₁]; exact Set.subset_union_right + have hc₃_in_2 : treeComponent T w₃ s(w₃, t) ⊆ treeComponent T t s(t, w₂) := by + rw [hsplit₂]; exact Set.subset_union_right + rcases hmem_three t₁ ht₁_ne with h1_1 | h1_2 | h1_3 <;> + rcases hmem_three t₂ ht₂_ne with h2_1 | h2_2 | h2_3 + · exact (hnot_same hadj₁ ⟨h1_1, h2_1⟩).elim + · exact Or.inl (Or.inl ⟨hmem_B hadj₁ hvG ht₁ ht₂ hi₁ hi₂ h1_1 (hc₂_in_1 h2_2), + hmem_B hadj₂ hvG ht₂ ht₁ hi₂ hi₁ h2_2 (hc₁_in_2 h1_1)⟩) + · exact Or.inl (Or.inr ⟨hmem_B hadj₁ hvG ht₁ ht₂ hi₁ hi₂ h1_1 (hc₃_in_1 h2_3), + hmem_B hadj₃ hvG ht₂ ht₁ hi₂ hi₁ h2_3 (hc₁_in_3 h1_1)⟩) + · exact Or.inl (Or.inl ⟨hmem_B hadj₁ hvG ht₂ ht₁ hi₂ hi₁ h2_1 (hc₂_in_1 h1_2), + hmem_B hadj₂ hvG ht₁ ht₂ hi₁ hi₂ h1_2 (hc₁_in_2 h2_1)⟩) + · exact (hnot_same hadj₂ ⟨h1_2, h2_2⟩).elim + · exact Or.inr ⟨hmem_B hadj₂ hvG ht₁ ht₂ hi₁ hi₂ h1_2 (hc₃_in_2 h2_3), + hmem_B hadj₃ hvG ht₂ ht₁ hi₂ hi₁ h2_3 (hc₂_in_3 h1_2)⟩ + · exact Or.inl (Or.inr ⟨hmem_B hadj₁ hvG ht₂ ht₁ hi₂ hi₁ h2_1 (hc₃_in_1 h1_3), + hmem_B hadj₃ hvG ht₁ ht₂ hi₁ hi₂ h1_3 (hc₁_in_3 h2_1)⟩) + · exact Or.inr ⟨hmem_B hadj₂ hvG ht₂ ht₁ hi₂ hi₁ h2_2 (hc₃_in_2 h1_3), + hmem_B hadj₃ hvG ht₁ ht₂ hi₁ hi₂ h1_3 (hc₂_in_3 h2_2)⟩ + · exact (hnot_same hadj₃ ⟨h1_3, h2_3⟩).elim + let U₂ := (B₁ ∩ B₂) ∪ (B₁ ∩ B₃) ∪ (B₂ ∩ B₃) + have hB₁_fin := hB_fin s(t, w₁) + have hB₂_fin := hB_fin s(t, w₂) + have hB₃_fin := hB_fin s(t, w₃) + have hU₂_fin : U₂.Finite := + ((hB₁_fin.inter_of_left B₂).union (hB₁_fin.inter_of_left B₃)).union + (hB₂_fin.inter_of_left B₃) + have hbag_le_U₂ : (branchInternalBag G T τ t).ncard ≤ U₂.ncard := + Set.ncard_le_ncard hsub_two hU₂_fin + have h12 := Set.ncard_union_add_ncard_inter B₁ B₂ hB₁_fin hB₂_fin + have h123 := Set.ncard_union_add_ncard_inter (B₁ ∪ B₂) B₃ (hB₁_fin.union hB₂_fin) hB₃_fin + have hinter_distrib : (B₁ ∪ B₂) ∩ B₃ = (B₁ ∩ B₃) ∪ (B₂ ∩ B₃) := + Set.union_inter_distrib_right B₁ B₂ B₃ + rw [hinter_distrib] at h123 + have hU₂_split := Set.ncard_union_add_ncard_inter (B₁ ∩ B₂) ((B₁ ∩ B₃) ∪ (B₂ ∩ B₃)) + (hB₁_fin.inter_of_left B₂) ((hB₁_fin.inter_of_left B₃).union (hB₂_fin.inter_of_left B₃)) + have hU₂_eq : (B₁ ∩ B₂) ∪ ((B₁ ∩ B₃) ∪ (B₂ ∩ B₃)) = U₂ := (Set.union_assoc _ _ _).symm + rw [hU₂_eq] at hU₂_split + have h3_split := Set.ncard_union_add_ncard_inter (B₁ ∩ B₃) (B₂ ∩ B₃) + (hB₁_fin.inter_of_left B₃) (hB₂_fin.inter_of_left B₃) + have hsub_union : U₂ ⊆ (B₁ ∪ B₂) ∪ B₃ := by + rintro x ((⟨hx1, _⟩ | ⟨hx1, _⟩) | ⟨hx2, _⟩) + · exact Or.inl (Or.inl hx1) + · exact Or.inl (Or.inl hx1) + · exact Or.inl (Or.inr hx2) + have hU₂_le_union : U₂.ncard ≤ ((B₁ ∪ B₂) ∪ B₃).ncard := + Set.ncard_le_ncard hsub_union ((hB₁_fin.union hB₂_fin).union hB₃_fin) + omega + +/-- For any branch-decomposition `(T, τ)` of `G`, +`treeDecompWidthPlusOne (branchToTreeBag G T τ) ≤ max (3 * branchDecompWidth G T τ / 2) (maxEdgeSize +G)` +(Graph Minors X, Section 5, proof of (5.1), page 169). -/ +theorem treeDecompWidthPlusOne_branchToTreeBag_le [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → β} (hbd : IsBranchDecomposition G T τ) : + treeDecompWidthPlusOne (branchToTreeBag G T τ) ≤ + max (3 * branchDecompWidth G T τ / 2) (maxEdgeSize G) := by + have : Nonempty ι := hbd.isTernaryTree.isTree.connected.nonempty + rw [treeDecompWidthPlusOne_le_iff] + intro t + change (branchInternalBag G T τ t).ncard ≤ + max (3 * branchDecompWidth G T τ / 2) (maxEdgeSize G) + by_cases ht : IsLeaf T t + · rw [branchInternalBag_eq_ends_of_isLeaf hbd.isTernaryTree ht] + have he_mem : τ t ∈ G.edgeSet := hbd.bijOn.mapsTo ht + exact (edgeSize_le_maxEdgeSize he_mem).trans (le_max_right _ _) + · have hle := two_mul_ncard_branchInternalBag_le hbd ht + have hdiv : (branchInternalBag G T τ t).ncard ≤ 3 * branchDecompWidth G T τ / 2 := by omega + exact hdiv.trans (le_max_left _ _) + +/-- For any branch-decomposition `(T, τ)` of `G`, +`2 * treeDecompWidthPlusOne (branchToTreeBag G T τ) ≤ 3 * max (branchDecompWidth G T τ) (maxEdgeSize +G)` +(Graph Minors X, Section 5, proof of (5.1), page 169). -/ +theorem two_mul_treeDecompWidthPlusOne_branchToTreeBag_le [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → β} (hbd : IsBranchDecomposition G T τ) : + 2 * treeDecompWidthPlusOne (branchToTreeBag G T τ) ≤ + 3 * max (branchDecompWidth G T τ) (maxEdgeSize G) := by + have hle := treeDecompWidthPlusOne_branchToTreeBag_le hbd + have h1 : 3 * branchDecompWidth G T τ / 2 ≤ 3 * max (branchDecompWidth G T τ) (maxEdgeSize G) / 2 + := by + have : branchDecompWidth G T τ ≤ max (branchDecompWidth G T τ) (maxEdgeSize G) + := le_max_left _ _ + omega + have h2 : maxEdgeSize G ≤ max (branchWidth G) (maxEdgeSize G) ∨ + maxEdgeSize G ≤ max (branchDecompWidth G T τ) (maxEdgeSize G) := + Or.inr (le_max_right _ _) + rcases h2 with _ | h2' + · omega + · omega + +/-- Second inequality of **(5.1)** in `max(⌊(3/2) β(G)⌋, γ(G), 1)` form +(Graph Minors X, Section 5, (5.1), pages 168–169): +For any hypergraph `G`, `treeWidthPlusOne G ≤ max (max (3 * branchWidth G / 2) (maxEdgeSize G)) 1`. +-/ +theorem treeWidthPlusOne_le_max_branchWidth_maxEdgeSize (G : Hypergraph α β) : + treeWidthPlusOne G ≤ max (max (3 * branchWidth G / 2) (maxEdgeSize G)) 1 := by + by_cases hγ : maxEdgeSize G = 0 + · by_cases hV : G.vertexSet.Nonempty + · rw [(branchWidth_and_treeWidthPlusOne_of_maxEdgeSize_eq_zero hγ hV).2] + exact le_max_right _ _ + · rw [Set.not_nonempty_iff_eq_empty] at hV + rw [treeWidthPlusOne_eq_zero_iff.2 hV] + exact Nat.zero_le _ + · have hγ1 : 1 ≤ maxEdgeSize G := Nat.one_le_iff_ne_zero.2 hγ + by_cases hcard : G.edgeSet.ncard ≤ 1 + · exact (treeWidthPlusOne_le_maxEdgeSize_of_ncard_edgeSet_le_one hγ1 hcard).trans + ((le_max_right _ _).trans (le_max_left _ _)) + · push Not at hcard + let H := G.deleteVertices (isoSet G) + have hiso : ∀ v ∈ isoSet G, ∀ e, ¬ G.Inc e v := fun _ hv ↦ hv.2 + have hγH : maxEdgeSize H = maxEdgeSize G := maxEdgeSize_deleteVertices_of_isolated hiso + have hbwH : branchWidth H = branchWidth G := branchWidth_deleteVertices_of_isolated hiso + have hcardH : H.edgeSet.ncard = G.edgeSet.ncard := by + rw [deleteVertices_edgeSet_of_isolated hiso] + obtain ⟨ι, _, T, τ, hbd, hw⟩ := + exists_branchDecomposition_eq_branchWidth (hγH.symm ▸ hγ1) (hcardH.symm ▸ hcard) + have htdH : IsTreeDecomposition H T (branchToTreeBag H T τ) := + isTreeDecomposition_branchToTreeBag (fun _ hv ↦ exists_inc_deleteVertices_isoSet hv) hbd + have hleH : treeWidthPlusOne H ≤ max (3 * branchWidth G / 2) (maxEdgeSize G) := by + have hbound := (treeWidthPlusOne_le_of_isTreeDecomposition htdH).trans + (treeDecompWidthPlusOne_branchToTreeBag_le hbd) + rwa [hw, hbwH, hγH] at hbound + exact (treeWidthPlusOne_le_max_deleteVertices_isoSet G).trans + (max_le_max hleH le_rfl) + +/-- Second inequality of **(5.1)** (Graph Minors X, Section 5, (5.1), pages 168–169): +If `1 ≤ maxEdgeSize G` (`γ(G) ≥ 1`) or `G.vertexSet = ∅`, then +`2 * treeWidthPlusOne G ≤ 3 * max (branchWidth G) (maxEdgeSize G)`. -/ +theorem two_mul_treeWidthPlusOne_le_three_mul_max {G : Hypergraph α β} + (h : 1 ≤ maxEdgeSize G ∨ G.vertexSet = ∅) : + 2 * treeWidthPlusOne G ≤ 3 * max (branchWidth G) (maxEdgeSize G) := by + rcases h with hγ | hemp + · by_cases hcard : G.edgeSet.ncard ≤ 1 + · have hle := treeWidthPlusOne_le_maxEdgeSize_of_ncard_edgeSet_le_one hγ hcard + have hmax : maxEdgeSize G ≤ max (branchWidth G) (maxEdgeSize G) := le_max_right _ _ + omega + · push Not at hcard + let H := G.deleteVertices (isoSet G) + have hiso : ∀ v ∈ isoSet G, ∀ e, ¬ G.Inc e v := fun _ hv ↦ hv.2 + have hγH : maxEdgeSize H = maxEdgeSize G := maxEdgeSize_deleteVertices_of_isolated hiso + have hbwH : branchWidth H = branchWidth G := branchWidth_deleteVertices_of_isolated hiso + have hcardH : H.edgeSet.ncard = G.edgeSet.ncard := by + rw [deleteVertices_edgeSet_of_isolated hiso] + obtain ⟨ι, _, T, τ, hbd, hw⟩ := + exists_branchDecomposition_eq_branchWidth (hγH.symm ▸ hγ) (hcardH.symm ▸ hcard) + have htdH : IsTreeDecomposition H T (branchToTreeBag H T τ) := + isTreeDecomposition_branchToTreeBag (fun _ hv ↦ exists_inc_deleteVertices_isoSet hv) hbd + have hleH : treeWidthPlusOne H ≤ treeDecompWidthPlusOne (branchToTreeBag H T τ) := + treeWidthPlusOne_le_of_isTreeDecomposition htdH + have hboundH := two_mul_treeDecompWidthPlusOne_branchToTreeBag_le hbd + rw [hw, hbwH, hγH] at hboundH + have hleG : treeWidthPlusOne G ≤ max (treeWidthPlusOne H) 1 := + treeWidthPlusOne_le_max_deleteVertices_isoSet G + have hmax : maxEdgeSize G ≤ max (branchWidth G) (maxEdgeSize G) := le_max_right _ _ + omega + · rw [treeWidthPlusOne_eq_zero_iff.2 hemp] + omega + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM10/TreeWidthClaims.lean b/LeanPool/GraphMinor/GM10/TreeWidthClaims.lean new file mode 100644 index 0000000000..ec09b89cbb --- /dev/null +++ b/LeanPool/GraphMinor/GM10/TreeWidthClaims.lean @@ -0,0 +1,891 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.TreeWidthBasic + +/-! +# Claims 1–3 of Theorem (5.1): Graph Minors X, Section 5 (Part 2) + +This file formalizes Claims (1), (2), and (3) in the proof of **(5.1)** of Robertson and Seymour, +*Graph Minors. X. Obstructions to tree-decomposition*, J. Combin. Theory Ser. B 52 (1991) 153–190 +(page 169): +- `theorem_5_1_claim_1`: Any tree-decomposition `(T, τ)` of `G` can be modified without increasing + its width so that for each `e ∈ E(G)` there is a leaf `t` of `T` with `τ(t) = K_e`. +- `theorem_5_1_claim_2`: Assuming `G` has no isolated vertices and `E(G) ≠ ∅`, we may further + arrange that `|E(τ(t))| = 1` for every leaf `t` of `T`. +- `theorem_5_1_claim_3`: We may further arrange that every vertex of `T` has valency `≤ 3`. +-/ + +public section + +namespace GraphMinor.GM10 + +open SimpleGraph Hypergraph + +variable {α β ι : Type*} + +/-! ## Claim (1) of (5.1) -/ + +/-- Deleting an edge `e ∉ H.edgeSet` leaves `H` unchanged. -/ +theorem deleteEdges_singleton_eq_self {H : Hypergraph α β} {e : β} (he : e ∉ H.edgeSet) : + H.deleteEdges {e} = H := by + ext x + · rfl + · simp only [Hypergraph.deleteEdges, Set.mem_sdiff, Set.mem_singleton_iff, and_iff_left_iff_imp] + rintro hx rfl + exact he hx + · simp only [Hypergraph.deleteEdges, Set.mem_singleton_iff, and_iff_left_iff_imp] + rintro hinc rfl + exact he (H.edge_mem_of_inc hinc) + +/-- Single step of Claim (1) of (5.1): given an edge `e ∈ E(τ(t₀))`, attaching a new leaf `none` +to `t₀` with `τ'(none) = K_e` and `τ'(some t) = τ(t) \ {e}` produces a tree-decomposition of `G` +of at most the same width. -/ +theorem attachLeaf_edge_isTreeDecomposition [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) + {t₀ : ι} {e : β} (ht₀ : e ∈ (τ t₀).edgeSet) : + let τ' : Option ι → Hypergraph α β + | some t => (τ t).deleteEdges {e} + | none => edgeHypergraph G e + IsTreeDecomposition G (attachLeaf T t₀) τ' ∧ + treeDecompWidthPlusOne τ' ≤ treeDecompWidthPlusOne τ := by + intro τ' + have heG : e ∈ G.edgeSet := (h.le t₀).edgeSet_subset ht₀ + have hends_sub : G.ends e ⊆ (τ t₀).vertexSet := h.ends_subset_vertexSet_of_edge_mem ht₀ + have hle_G : ∀ a : Option ι, τ' a ≤ G := by + rintro (_ | t) + · exact edgeHypergraph_le heG + · exact (deleteEdges_le (τ t) {e}).trans (h.le t) + refine ⟨⟨isTree_attachLeaf h.isTree t₀, hle_G, ?_, ?_, ?_⟩, ?_⟩ + · ext x + · simp only [Hypergraph.biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion] + constructor + · rintro ⟨a, hx⟩ + exact (hle_G a).vertexSet_subset hx + · intro hxG + obtain ⟨t, ht⟩ := h.vertex_mem_iff.1 hxG + exact ⟨some t, ht⟩ + · simp only [Hypergraph.biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion] + constructor + · rintro ⟨a, hx⟩ + exact (hle_G a).edgeSet_subset hx + · intro hxG + by_cases hxe : x = e + · subst hxe + exact ⟨none, Set.mem_singleton x⟩ + · obtain ⟨t, ht⟩ := h.edge_mem_iff.1 hxG + exact ⟨some t, ht, hxe⟩ + · simp only [Hypergraph.biUnion, Finset.mem_univ, true_and] + constructor + · rintro ⟨a, hinc⟩ + exact inc_of_le (hle_G a) hinc + · intro hincG + by_cases hxe : x = e + · subst hxe + exact ⟨none, rfl, hincG⟩ + · obtain ⟨t, ht⟩ := h.inc_iff.1 hincG + exact ⟨some t, ht, hxe⟩ + · rintro (_ | t₁) (_ | t₂) hne + · exact (hne rfl).elim + · ext f + simp only [τ', edgeHypergraph, Hypergraph.deleteEdges, inter_edgeSet, Set.mem_inter_iff, + Set.mem_singleton_iff, Set.mem_sdiff, Set.mem_empty_iff_false, iff_false] + rintro ⟨rfl, _, hne_f⟩ + exact hne_f rfl + · ext f + simp only [τ', edgeHypergraph, Hypergraph.deleteEdges, inter_edgeSet, Set.mem_inter_iff, + Set.mem_singleton_iff, Set.mem_sdiff, Set.mem_empty_iff_false, iff_false] + rintro ⟨⟨_, hne_f⟩, rfl⟩ + exact hne_f rfl + · ext f + simp only [τ', Hypergraph.deleteEdges, inter_edgeSet, Set.mem_inter_iff, Set.mem_sdiff, + Set.mem_empty_iff_false, iff_false] + rintro ⟨⟨hf₁, _⟩, ⟨hf₂, _⟩⟩ + have hmem : f ∈ (τ t₁ ∩ τ t₂).edgeSet := ⟨hf₁, hf₂⟩ + rw [h.edgeSet_inter_eq (fun h ↦ hne (congrArg Option.some h))] at hmem + exact hmem + · rintro (_ | t₁) c (_ | t₂) hp + · have hc : c = none := onTreePath_self_iff.1 hp + subst hc + exact GM10.inter_le_left (hle_G none) (hle_G none) + · refine (le_iff_of_le (GM10.inter_le (hle_G none) (hle_G (some t₂))) (hle_G c)).2 ⟨?_, ?_⟩ + · cases c with + | none => + exact Set.inter_subset_left + | some t₃ => + have hpT : OnTreePath T t₀ t₂ t₃ := onTreePath_projAttach_of_some hp + have hleT := (h.inter_le hpT).vertexSet_subset + intro v ⟨hv₁, hv₂⟩ + exact hleT ⟨hends_sub hv₁, hv₂⟩ + · intro f ⟨hf₁, _, hne_f⟩ + exact (hne_f hf₁).elim + · refine (le_iff_of_le (GM10.inter_le (hle_G (some t₁)) (hle_G none)) (hle_G c)).2 ⟨?_, ?_⟩ + · cases c with + | none => + exact Set.inter_subset_right + | some t₃ => + have hpT : OnTreePath T t₁ t₀ t₃ := onTreePath_projAttach_of_some hp + have hleT := (h.inter_le hpT).vertexSet_subset + intro v ⟨hv₁, hv₂⟩ + exact hleT ⟨hv₁, hends_sub hv₂⟩ + · intro f ⟨⟨_, hne_f⟩, hf₂⟩ + exact (hne_f hf₂).elim + · cases c with + | none => + rcases eq_or_eq_of_onTreePath_of_unique_adj (isTree_attachLeaf h.isTree t₀).connected + (fun w₁ w₂ h₁ h₂ ↦ (adj_attachLeaf_none_iff.1 h₁).trans + (adj_attachLeaf_none_iff.1 h₂).symm) hp with h1 | h2 + · exact nomatch h1 + · exact nomatch h2 + | some t₃ => + have hpT : OnTreePath T t₁ t₂ t₃ := onTreePath_projAttach_of_some hp + have hleT := h.inter_le hpT + refine (le_iff_of_le (GM10.inter_le (hle_G (some t₁)) (hle_G (some t₂))) + (hle_G (some t₃))).2 ⟨hleT.vertexSet_subset, ?_⟩ + rintro f ⟨⟨hf₁, hfe⟩, ⟨hf₂, _⟩⟩ + exact ⟨hleT.edgeSet_subset ⟨hf₁, hf₂⟩, hfe⟩ + · have : Nonempty ι := h.nonempty + rw [treeDecompWidthPlusOne_le_iff] + rintro (_ | t) + · exact (Set.ncard_le_ncard hends_sub (τ t₀).vertexSet_finite).trans + (ncard_vertexSet_le_treeDecompWidthPlusOne τ t₀) + · exact ncard_vertexSet_le_treeDecompWidthPlusOne τ t + +/-- **Claim (1) of (5.1)** (Graph Minors X, Section 5, page 169): +"(1) *We may assume that for each $e \in E(G)$, there is a leaf $t$ of $T$ with $E(\tau(t)) = +\{e\}$ and $V(\tau(t))$ the set of ends of $e$, and hence that $E(\tau(t)) = \emptyset$ for +each $t \in V(T)$ with valency $\ge 2$." -/ +theorem theorem_5_1_claim_1 [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) : + ∃ (ι' : Type) (_ : Fintype ι') (T' : SimpleGraph ι') (τ' : ι' → Hypergraph α β), + IsTreeDecomposition G T' τ' ∧ + treeDecompWidthPlusOne τ' ≤ treeDecompWidthPlusOne τ ∧ + (∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T', τ' t = edgeHypergraph G e) ∧ + (∀ t ∉ leafSet T', (τ' t).edgeSet = ∅) := by + classical + have hmain : ∀ (k : ℕ) (ι₀ : Type) [Fintype ι₀] (T₀ : SimpleGraph ι₀) + (τ₀ : ι₀ → Hypergraph α β), + IsTreeDecomposition G T₀ τ₀ → + {e ∈ G.edgeSet | ¬ ∃ t ∈ leafSet T₀, τ₀ t = edgeHypergraph G e}.ncard = k → + ∃ (ι' : Type) (_ : Fintype ι') (T' : SimpleGraph ι') (τ' : ι' → Hypergraph α β), + IsTreeDecomposition G T' τ' ∧ + treeDecompWidthPlusOne τ' ≤ treeDecompWidthPlusOne τ₀ ∧ + ∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T', τ' t = edgeHypergraph G e := by + intro k + induction k using Nat.strong_induction_on with + | ind k ih => + intro ι₀ _ T₀ τ₀ h₀ hcard + let B : Set β := {e ∈ G.edgeSet | ¬ ∃ t ∈ leafSet T₀, τ₀ t = edgeHypergraph G e} + have hB_fin : B.Finite := G.edgeSet_finite.subset fun _ he ↦ he.1 + by_cases hB : B.Nonempty + · obtain ⟨e, heG, he_not⟩ := hB + obtain ⟨t₀, ht₀⟩ := h₀.edge_mem_iff.1 heG + let τ₁ : Option ι₀ → Hypergraph α β + | some t => (τ₀ t).deleteEdges {e} + | none => edgeHypergraph G e + obtain ⟨h₁, hw₁⟩ := attachLeaf_edge_isTreeDecomposition h₀ ht₀ + let B₁ : Set β := + {f ∈ G.edgeSet | ¬ ∃ t ∈ leafSet (attachLeaf T₀ t₀), τ₁ t = edgeHypergraph G f} + have hB₁_sub : B₁ ⊆ B := by + intro f ⟨hfG, hf_not⟩ + refine ⟨hfG, ?_⟩ + rintro ⟨t₁, ht₁_leaf, hτ₀_t₁⟩ + have ht₁_ne : t₁ ≠ t₀ := by + rintro rfl + have he_mem : e ∈ (edgeHypergraph G f).edgeSet := hτ₀_t₁ ▸ ht₀ + have hef : e = f := Set.mem_singleton_iff.1 he_mem + subst hef + exact he_not ⟨t₁, ht₁_leaf, hτ₀_t₁⟩ + have he_not_t₁ : e ∉ (τ₀ t₁).edgeSet := + fun he_t₁ ↦ ht₁_ne (h₀.eq_of_edge_mem ht₀ he_t₁).symm + apply hf_not + refine ⟨some t₁, (isLeaf_attachLeaf_some_iff ht₁_ne).2 ht₁_leaf, ?_⟩ + change (τ₀ t₁).deleteEdges {e} = edgeHypergraph G f + rw [deleteEdges_singleton_eq_self he_not_t₁, hτ₀_t₁] + have he_not_B₁ : e ∉ B₁ := by + intro ⟨_, hnot⟩ + exact hnot ⟨none, isLeaf_attachLeaf_none T₀ t₀, rfl⟩ + have hlt : B₁.ncard < k := by + rw [← hcard] + exact Set.ncard_lt_ncard ⟨hB₁_sub, fun hsub ↦ he_not_B₁ (hsub ⟨heG, he_not⟩)⟩ hB_fin + obtain ⟨ι', hfin', T', τ', h', hw', hclaim⟩ := ih B₁.ncard hlt (Option ι₀) + (attachLeaf T₀ t₀) τ₁ h₁ rfl + exact ⟨ι', hfin', T', τ', h', hw'.trans hw₁, hclaim⟩ + · rw [Set.not_nonempty_iff_eq_empty] at hB + refine ⟨ι₀, inferInstance, T₀, τ₀, h₀, le_rfl, ?_⟩ + intro e heG + by_contra hnot + have heB : e ∈ B := ⟨heG, hnot⟩ + rw [hB] at heB + exact heB + let eFin := Fintype.equivFin ι + obtain ⟨ι', hfin', T', τ', h', hw', hclaim⟩ := + hmain _ (Fin (Fintype.card ι)) (T.map eFin.toEmbedding) (τ ∘ eFin.symm) (h.relabel eFin) rfl + rw [treeDecompWidthPlusOne_comp_equiv] at hw' + refine ⟨ι', hfin', T', τ', h', hw', hclaim, ?_⟩ + intro t ht_not_leaf + ext e + simp only [Set.mem_empty_iff_false, iff_false] + intro he_t + obtain ⟨t_e, ht_e_leaf, hτ'_te⟩ := hclaim e ((h'.le t).edgeSet_subset he_t) + have he_te : e ∈ (τ' t_e).edgeSet := by + rw [hτ'_te] + exact Set.mem_singleton e + have heq : t = t_e := h'.eq_of_edge_mem he_t he_te + exact ht_not_leaf (heq ▸ ht_e_leaf) + +/-! ## Claim (2) of (5.1) -/ + +/-- The canonical graph homomorphism `T.induce S →g T`. -/ +@[expose] def induceHom (T : SimpleGraph ι) (S : Set ι) : T.induce S →g T where + toFun := Subtype.val + map_rel' h := h + +/-- In an induced subgraph `T.induce S`, the degree of any `x : S` is at most `T.degree x.1`. -/ +theorem degree_induce_le [Fintype ι] (T : SimpleGraph ι) (S : Set ι) [Fintype S] + [DecidableRel (T.induce S).Adj] [DecidableRel T.Adj] (x : S) : + (T.induce S).degree x ≤ T.degree x.1 := by + rw [← ncard_neighborSet, ← ncard_neighborSet] + have hsub : Subtype.val '' (T.induce S).neighborSet x ⊆ T.neighborSet x.1 := by + rintro _ ⟨y, hy, rfl⟩ + exact hy + rw [← Set.ncard_image_of_injective _ Subtype.val_injective] + exact Set.ncard_le_ncard hsub (Set.toFinite _) + +/-- If `x.1` is a leaf of `T`, then `x` is a leaf of `T.induce S`. -/ +theorem isLeaf_induce_of_isLeaf [Fintype ι] {T : SimpleGraph ι} {S : Set ι} [Fintype S] + {x : S} (hx : IsLeaf T x.1) : IsLeaf (T.induce S) x := by + classical + exact (degree_induce_le T S x).trans hx + +/-- Deleting a degree-1 vertex `t₀` from a tree `T` produces a tree `T.induce {t₀}ᶜ`. -/ +theorem isTree_induce_compl_singleton [Fintype ι] {T : SimpleGraph ι} (hT : T.IsTree) + {t₀ : ι} (hdeg1 : by classical exact T.degree t₀ = 1) : + (T.induce {t₀}ᶜ).IsTree := by + classical + exact ⟨hT.connected.induce_compl_singleton_of_degree_eq_one hdeg1, + hT.isAcyclic.comap (induceHom T {t₀}ᶜ) Subtype.val_injective⟩ + +/-- In a tree `T` where `T.induce {t₀}ᶜ` is connected, `OnTreePath (T.induce {t₀}ᶜ) a b c` implies +`OnTreePath T a.1 b.1 c.1`. -/ +theorem onTreePath_of_induce_compl_singleton {T : SimpleGraph ι} (hT : T.IsTree) {t₀ : ι} + (hconn : (T.induce {t₀}ᶜ).Connected) {a b c : ({t₀}ᶜ : Set ι)} + (hp : OnTreePath (T.induce {t₀}ᶜ) a b c) : + OnTreePath T a.1 b.1 c.1 := by + obtain ⟨q, hq⟩ := hconn.exists_isPath a b + have hq_map : (q.map (induceHom T {t₀}ᶜ)).IsPath := + hq.map Subtype.val_injective + change OnTreePath T (induceHom T {t₀}ᶜ a) (induceHom T {t₀}ᶜ b) (induceHom T {t₀}ᶜ c) + rw [onTreePath_iff_of_isPath hT hq_map, Walk.support_map, List.mem_map] + exact ⟨c, hp q hq, rfl⟩ + +/-- **Claim (2) of (5.1)** (Graph Minors X, Section 5, page 169): +"(2) *We may assume that $|E(\tau(t))| = 1$ for each leaf $t$ of $T$." -/ +theorem theorem_5_1_claim_2 [Fintype ι] {G : Hypergraph α β} + (hno_iso : ∀ v ∈ G.vertexSet, ∃ e, G.Inc e v) (hE : G.edgeSet.Nonempty) + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) + (hclaim1 : ∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T, τ t = edgeHypergraph G e) : + ∃ (ι' : Type) (_ : Fintype ι') (T' : SimpleGraph ι') (τ' : ι' → Hypergraph α β), + IsTreeDecomposition G T' τ' ∧ + treeDecompWidthPlusOne τ' ≤ treeDecompWidthPlusOne τ ∧ + (∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T', τ' t = edgeHypergraph G e) ∧ + (∀ t ∈ leafSet T', ∃ e ∈ G.edgeSet, τ' t = edgeHypergraph G e) ∧ + (∀ t ∉ leafSet T', (τ' t).edgeSet = ∅) := by + classical + have hmain : ∀ (n : ℕ) (ι₀ : Type) [Fintype ι₀] (T₀ : SimpleGraph ι₀) + (τ₀ : ι₀ → Hypergraph α β), + IsTreeDecomposition G T₀ τ₀ → + (∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T₀, τ₀ t = edgeHypergraph G e) → + Fintype.card ι₀ = n → + ∃ (ι' : Type) (_ : Fintype ι') (T' : SimpleGraph ι') (τ' : ι' → Hypergraph α β), + IsTreeDecomposition G T' τ' ∧ + treeDecompWidthPlusOne τ' ≤ treeDecompWidthPlusOne τ₀ ∧ + (∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T', τ' t = edgeHypergraph G e) ∧ + (∀ t ∈ leafSet T', (τ' t).edgeSet.Nonempty) := by + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro ι₀ _ T₀ τ₀ h₀ hc1 hcard + by_cases hbad : ∃ t₀ ∈ leafSet T₀, (τ₀ t₀).edgeSet = ∅ + · obtain ⟨t₀, ht₀_leaf, ht₀_empty⟩ := hbad + obtain ⟨e₀, he₀⟩ := hE + obtain ⟨t_e₀, _, hτ₀_te₀⟩ := hc1 e₀ he₀ + have ht₀_ne_te₀ : t₀ ≠ t_e₀ := by + rintro rfl + have hmem : e₀ ∈ (τ₀ t₀).edgeSet := by + rw [hτ₀_te₀] + exact Set.mem_singleton e₀ + rw [ht₀_empty] at hmem + exact hmem + have hdeg_pos : 1 ≤ T₀.degree t₀ := by + obtain ⟨p, _⟩ := h₀.isTree.connected.exists_isPath t₀ t_e₀ + cases p with + | nil => exact (ht₀_ne_te₀ rfl).elim + | @cons _ w _ hadj _ => + rw [← card_neighborFinset_eq_degree] + exact Finset.card_pos.2 ⟨w, (mem_neighborFinset T₀ t₀ w).2 hadj⟩ + have hdeg1 : T₀.degree t₀ = 1 := le_antisymm ht₀_leaf hdeg_pos + let S : Set ι₀ := {t₀}ᶜ + let T₁ := T₀.induce S + let τ₁ : S → Hypergraph α β := fun x ↦ τ₀ x.1 + have hT₁_tree : T₁.IsTree := isTree_induce_compl_singleton h₀.isTree hdeg1 + have hc1' : ∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T₁, τ₁ t = edgeHypergraph G e := by + intro e heG + obtain ⟨t, ht_leaf, hτ_t⟩ := hc1 e heG + have ht_ne : t ≠ t₀ := by + rintro rfl + have hmem : e ∈ (τ₀ t).edgeSet := by + rw [hτ_t] + exact Set.mem_singleton e + rw [ht₀_empty] at hmem + exact hmem + exact ⟨⟨t, ht_ne⟩, isLeaf_induce_of_isLeaf ht_leaf, hτ_t⟩ + have h₁ : IsTreeDecomposition G T₁ τ₁ := by + refine ⟨hT₁_tree, fun x ↦ h₀.le x.1, ?_, ?_, ?_⟩ + · ext x + · simp only [Hypergraph.biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion] + constructor + · rintro ⟨a, hx⟩ + exact (h₀.le a.1).vertexSet_subset hx + · intro hxG + obtain ⟨e, hinc⟩ := hno_iso x hxG + obtain ⟨t, _, hτ_t⟩ := hc1' e (G.edge_mem_of_inc hinc) + refine ⟨t, ?_⟩ + rw [hτ_t] + exact hinc + · simp only [Hypergraph.biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion] + constructor + · rintro ⟨a, hx⟩ + exact (h₀.le a.1).edgeSet_subset hx + · intro heG + obtain ⟨t, _, hτ_t⟩ := hc1' x heG + refine ⟨t, ?_⟩ + rw [hτ_t] + exact Set.mem_singleton x + · simp only [Hypergraph.biUnion, Finset.mem_univ, true_and] + constructor + · rintro ⟨a, hinc⟩ + exact inc_of_le (h₀.le a.1) hinc + · intro hincG + obtain ⟨t, _, hτ_t⟩ := hc1' x (G.edge_mem_of_inc hincG) + refine ⟨t, ?_⟩ + rw [hτ_t] + exact ⟨rfl, hincG⟩ + · intro x y hne + exact h₀.edgeSet_inter_eq (fun h ↦ hne (Subtype.ext h)) + · intro a c b hp + exact h₀.inter_le (onTreePath_of_induce_compl_singleton h₀.isTree hT₁_tree.connected hp) + have hw₁ : treeDecompWidthPlusOne τ₁ ≤ treeDecompWidthPlusOne τ₀ := by + have : Nonempty S := h₁.nonempty + rw [treeDecompWidthPlusOne_le_iff] + intro x + exact ncard_vertexSet_le_treeDecompWidthPlusOne τ₀ x.1 + have hlt : Fintype.card S < n := by + rw [← hcard] + exact Fintype.card_lt_of_injective_of_notMem Subtype.val Subtype.val_injective + (by rintro ⟨⟨x, hx⟩, rfl⟩; exact hx rfl) + obtain ⟨ι', hfin', T', τ', h', hw', hc1'', hne'⟩ := + ih (Fintype.card S) hlt S T₁ τ₁ h₁ hc1' rfl + exact ⟨ι', hfin', T', τ', h', hw'.trans hw₁, hc1'', hne'⟩ + · push Not at hbad + exact ⟨ι₀, inferInstance, T₀, τ₀, h₀, le_rfl, hc1, hbad⟩ + let eFin := Fintype.equivFin ι + have hc1_fin : ∀ e ∈ G.edgeSet, ∃ t ∈ leafSet (T.map eFin.toEmbedding), + (τ ∘ eFin.symm) t = edgeHypergraph G e := by + intro e heG + obtain ⟨t, ht_leaf, hτ_t⟩ := hclaim1 e heG + refine ⟨eFin t, (isLeaf_map eFin t).2 ht_leaf, ?_⟩ + simpa using hτ_t + obtain ⟨ι', hfin', T', τ', h', hw', hc1', hne'⟩ := + hmain _ (Fin (Fintype.card ι)) (T.map eFin.toEmbedding) (τ ∘ eFin.symm) + (h.relabel eFin) hc1_fin rfl + rw [treeDecompWidthPlusOne_comp_equiv] at hw' + have hnonleaf_empty : ∀ t ∉ leafSet T', (τ' t).edgeSet = ∅ := by + intro t ht_not_leaf + ext e + simp only [Set.mem_empty_iff_false, iff_false] + intro he_t + obtain ⟨t_e, ht_e_leaf, hτ'_te⟩ := hc1' e ((h'.le t).edgeSet_subset he_t) + have he_te : e ∈ (τ' t_e).edgeSet := by + rw [hτ'_te] + exact Set.mem_singleton e + have heq : t = t_e := h'.eq_of_edge_mem he_t he_te + exact ht_not_leaf (heq ▸ ht_e_leaf) + have hleaf_eq : ∀ t ∈ leafSet T', ∃ e ∈ G.edgeSet, τ' t = edgeHypergraph G e := by + intro t ht_leaf + obtain ⟨e, he_t⟩ := hne' t ht_leaf + have heG : e ∈ G.edgeSet := (h'.le t).edgeSet_subset he_t + obtain ⟨t_e, _, hτ'_te⟩ := hc1' e heG + have he_te : e ∈ (τ' t_e).edgeSet := by + rw [hτ'_te] + exact Set.mem_singleton e + have heq : t = t_e := h'.eq_of_edge_mem he_t he_te + exact ⟨e, heG, heq ▸ hτ'_te⟩ + exact ⟨ι', hfin', T', τ', h', hw', hc1', hleaf_eq, hnonleaf_empty⟩ + +/-! ## Claim (3) of (5.1): splitting vertices of degree `≥ 4` -/ + +/-- Split a vertex `t₀` of `T` by pulling two of its neighbors `w₁, w₂` onto a new vertex +`none : Option ι` adjacent to `some t₀`, `some w₁`, and `some w₂` +(Graph Minors X, Section 5, proof of (5.1), Claim (3), page 169). -/ +@[expose] def splitVertex (T : SimpleGraph ι) (t₀ w₁ w₂ : ι) : SimpleGraph (Option ι) where + Adj a b := + match a, b with + | some x, some y => + T.Adj x y ∧ ¬ (x = t₀ ∧ (y = w₁ ∨ y = w₂)) ∧ ¬ (y = t₀ ∧ (x = w₁ ∨ x = w₂)) + | some x, none => x = t₀ ∨ x = w₁ ∨ x = w₂ + | none, some y => y = t₀ ∨ y = w₁ ∨ y = w₂ + | none, none => False + symm := ⟨by + intro a b h + cases a <;> cases b + · exact h + · exact h + · exact h + · exact ⟨h.1.symm, h.2.2, h.2.1⟩⟩ + loopless := ⟨by + rintro (_ | x) h + · exact h + · exact T.loopless.irrefl x h.1⟩ + +/-- Every walk `p : T.Walk u v` lifts to a walk in `splitVertex T t₀ w₁ w₂` from `some u` to +`some v` whose support maps into `p.support` under `projAttach t₀`. -/ +theorem exists_walk_splitVertex {T : SimpleGraph ι} {t₀ w₁ w₂ : ι} + {u v : ι} (p : T.Walk u v) : + ∃ w : (splitVertex T t₀ w₁ w₂).Walk (some u) (some v), + ∀ z ∈ w.support, projAttach t₀ z ∈ p.support := by + induction p with + | nil => + refine ⟨Walk.nil, fun z hz ↦ ?_⟩ + rw [Walk.support_nil, List.mem_singleton] at hz + subst hz + simp [projAttach] + | @cons a b c hadj q ih => + obtain ⟨wq, hwq⟩ := ih + have hedge : ∃ we : (splitVertex T t₀ w₁ w₂).Walk (some a) (some b), + ∀ z ∈ we.support, projAttach t₀ z = a ∨ projAttach t₀ z = b := by + by_cases h1 : a = t₀ ∧ (b = w₁ ∨ b = w₂) + · have ha : (splitVertex T t₀ w₁ w₂).Adj (some a) none := Or.inl h1.1 + have hb : (splitVertex T t₀ w₁ w₂).Adj none (some b) := Or.inr h1.2 + refine ⟨Walk.cons ha (Walk.cons hb Walk.nil), fun z hz ↦ ?_⟩ + rw [Walk.support_cons, Walk.support_cons, Walk.support_nil, List.mem_cons, + List.mem_cons, List.mem_singleton] at hz + rcases hz with rfl | rfl | rfl + · exact Or.inl rfl + · exact Or.inl h1.1.symm + · exact Or.inr rfl + · by_cases h2 : b = t₀ ∧ (a = w₁ ∨ a = w₂) + · have ha : (splitVertex T t₀ w₁ w₂).Adj (some a) none := Or.inr h2.2 + have hb : (splitVertex T t₀ w₁ w₂).Adj none (some b) := Or.inl h2.1 + refine ⟨Walk.cons ha (Walk.cons hb Walk.nil), fun z hz ↦ ?_⟩ + rw [Walk.support_cons, Walk.support_cons, Walk.support_nil, List.mem_cons, + List.mem_cons, List.mem_singleton] at hz + rcases hz with rfl | rfl | rfl + · exact Or.inl rfl + · exact Or.inr h2.1.symm + · exact Or.inr rfl + · have hab : (splitVertex T t₀ w₁ w₂).Adj (some a) (some b) := ⟨hadj, h1, h2⟩ + refine ⟨Walk.cons hab Walk.nil, fun z hz ↦ ?_⟩ + rw [Walk.support_cons, Walk.support_nil, List.mem_cons, List.mem_singleton] at hz + rcases hz with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + obtain ⟨we, hwe⟩ := hedge + refine ⟨we.append wq, fun z hz ↦ ?_⟩ + rcases (Walk.mem_support_append_iff _ _).1 hz with h1 | h2 + · rcases hwe z h1 with heq | heq + · rw [heq]; exact List.mem_cons_self + · rw [heq]; exact List.mem_cons_of_mem a q.start_mem_support + · exact List.mem_cons_of_mem a (hwq z h2) + +/-- A short walk in `splitVertex T t₀ w₁ w₂` from `a` to `some (projAttach t₀ a)` whose support +maps into `{projAttach t₀ a}`. -/ +@[expose] def toSomeWalkSplit (T : SimpleGraph ι) (t₀ w₁ w₂ : ι) : + ∀ a : Option ι, (splitVertex T t₀ w₁ w₂).Walk a (some (projAttach t₀ a)) + | some _ => Walk.nil + | none => Walk.cons (show (splitVertex T t₀ w₁ w₂).Adj none (some t₀) from Or.inl rfl) Walk.nil + +theorem projAttach_mem_toSomeWalkSplit {T : SimpleGraph ι} {t₀ w₁ w₂ : ι} {a z : Option ι} + (hz : z ∈ (toSomeWalkSplit T t₀ w₁ w₂ a).support) : + projAttach t₀ z = projAttach t₀ a := by + cases a with + | none => + dsimp only [toSomeWalkSplit, projAttach] at hz ⊢ + rw [Walk.support_cons, Walk.support_nil, List.mem_cons, List.mem_singleton] at hz + rcases hz with rfl | rfl <;> rfl + | some x => + dsimp only [toSomeWalkSplit, projAttach] at hz ⊢ + rw [Walk.support_nil, List.mem_singleton] at hz + subst hz + rfl + +/-- `OnTreePath (splitVertex T t₀ w₁ w₂) a b c` implies +`OnTreePath T (projAttach t₀ a) (projAttach t₀ b) (projAttach t₀ c)`. -/ +theorem onTreePath_projAttach_of_splitVertex {T : SimpleGraph ι} {t₀ w₁ w₂ : ι} + {a b c : Option ι} (h : OnTreePath (splitVertex T t₀ w₁ w₂) a b c) : + OnTreePath T (projAttach t₀ a) (projAttach t₀ b) (projAttach t₀ c) := by + intro p _ + obtain ⟨wp, hwp⟩ := exists_walk_splitVertex (t₀ := t₀) (w₁ := w₁) (w₂ := w₂) p + let w : (splitVertex T t₀ w₁ w₂).Walk a b := + (toSomeWalkSplit T t₀ w₁ w₂ a).append + (wp.append (toSomeWalkSplit T t₀ w₁ w₂ b).reverse) + have hm : c ∈ w.support := mem_support_of_onTreePath h w + rcases (Walk.mem_support_append_iff _ _).1 hm with h1 | h2 + · rw [projAttach_mem_toSomeWalkSplit h1] + exact p.start_mem_support + · rcases (Walk.mem_support_append_iff _ _).1 h2 with h3 | h4 + · exact hwp c h3 + · have h4' : c ∈ (toSomeWalkSplit T t₀ w₁ w₂ b).support.reverse := + Walk.support_reverse (toSomeWalkSplit T t₀ w₁ w₂ b) ▸ h4 + rw [projAttach_mem_toSomeWalkSplit (List.mem_reverse.1 h4')] + exact p.end_mem_support + +/-- Degrees of vertices in `splitVertex T t₀ w₁ w₂`: +- `degree none = 3` +- `degree (some t₀) = T.degree t₀ - 1` +- `degree (some x) = T.degree x` for `x ≠ t₀`. -/ +theorem degrees_splitVertex [Fintype ι] {T : SimpleGraph ι} {t₀ w₁ w₂ : ι} + [DecidableRel (splitVertex T t₀ w₁ w₂).Adj] [DecidableRel T.Adj] + (hadj₁ : T.Adj t₀ w₁) (hadj₂ : T.Adj t₀ w₂) (hw12 : w₁ ≠ w₂) : + (splitVertex T t₀ w₁ w₂).degree none = 3 ∧ + (splitVertex T t₀ w₁ w₂).degree (some t₀) + 1 = T.degree t₀ ∧ + ∀ x : ι, x ≠ t₀ → (splitVertex T t₀ w₁ w₂).degree (some x) = T.degree x := by + let T' := splitVertex T t₀ w₁ w₂ + have hne₁ : t₀ ≠ w₁ := hadj₁.ne + have hne₂ : t₀ ≠ w₂ := hadj₂.ne + refine ⟨?_, ?_, ?_⟩ + · rw [← ncard_neighborSet] + have hset : T'.neighborSet none = {some t₀, some w₁, some w₂} := by + ext z + cases z <;> simp [T', splitVertex, mem_neighborSet] + rw [hset, Set.ncard_insert_of_notMem, Set.ncard_pair (Option.some_injective ι |>.ne hw12)] + simp [hne₁, hne₂] + · rw [← ncard_neighborSet, ← ncard_neighborSet] + let S₀ : Set ι := T.neighborSet t₀ \ {w₁, w₂} + have hset : T'.neighborSet (some t₀) = insert none (Option.some '' S₀) := by + ext z + cases z with + | none => + simp [T', splitVertex, mem_neighborSet] + | some y => + simp [T', splitVertex, mem_neighborSet, S₀, hne₁, hne₂] + have hnone_not : (none : Option ι) ∉ Option.some '' S₀ := by simp + rw [hset, Set.ncard_insert_of_notMem hnone_not (Set.toFinite _), + Set.ncard_image_of_injective _ (Option.some_injective ι)] + have hsub : ({w₁, w₂} : Set ι) ⊆ T.neighborSet t₀ := by + rintro y (rfl | rfl) <;> assumption + have hdiff : S₀.ncard = (T.neighborSet t₀).ncard - ({w₁, w₂} : Set ι).ncard := + Set.ncard_sdiff hsub (Set.toFinite _) + have hpair : ({w₁, w₂} : Set ι).ncard = 2 := Set.ncard_pair hw12 + have hge2 : 2 ≤ (T.neighborSet t₀).ncard := by + rw [← hpair] + exact Set.ncard_le_ncard hsub (Set.toFinite _) + omega + · intro x hxt₀ + rw [← ncard_neighborSet, ← ncard_neighborSet] + have hbij : Set.BijOn (projAttach t₀) (T'.neighborSet (some x)) (T.neighborSet x) := by + refine ⟨?_, ?_, ?_⟩ + · rintro (_ | y) hz + · simp only [T', splitVertex, mem_neighborSet] at hz + rcases hz with rfl | rfl | rfl + · exact (hxt₀ rfl).elim + · exact hadj₁.symm + · exact hadj₂.symm + · exact hz.1 + · rintro (_ | y₁) hz₁ (_ | y₂) hz₂ heq + · rfl + · change t₀ = y₂ at heq + subst heq + rcases hz₁ with rfl | hxw₁ | hxw₂ + · exact (hxt₀ rfl).elim + · exact (hz₂.2.2 ⟨rfl, Or.inl hxw₁⟩).elim + · exact (hz₂.2.2 ⟨rfl, Or.inr hxw₂⟩).elim + · change y₁ = t₀ at heq + subst heq + rcases hz₂ with rfl | hxw₁ | hxw₂ + · exact (hxt₀ rfl).elim + · exact (hz₁.2.2 ⟨rfl, Or.inl hxw₁⟩).elim + · exact (hz₁.2.2 ⟨rfl, Or.inr hxw₂⟩).elim + · exact congrArg Option.some heq + · intro y hy + by_cases hcase : y = t₀ ∧ (x = w₁ ∨ x = w₂) + · exact ⟨none, Or.inr hcase.2, hcase.1.symm⟩ + · refine ⟨some y, ?_, rfl⟩ + change T.Adj x y ∧ ¬ (x = t₀ ∧ (y = w₁ ∨ y = w₂)) ∧ ¬ (y = t₀ ∧ (x = w₁ ∨ x = w₂)) + refine ⟨hy, ?_, hcase⟩ + rintro ⟨rfl, _⟩ + exact hxt₀ rfl + rw [← hbij.image_eq, hbij.injOn.ncard_image] + +/-- Leaves of `splitVertex T t₀ w₁ w₂` when `4 ≤ T.degree t₀` are exactly `some x` for leaves `x` +of `T`. -/ +theorem mem_leafSet_splitVertex_iff [Fintype ι] {T : SimpleGraph ι} {t₀ w₁ w₂ : ι} + [DecidableRel T.Adj] + (hadj₁ : T.Adj t₀ w₁) (hadj₂ : T.Adj t₀ w₂) (hw12 : w₁ ≠ w₂) + (ht₀_deg : 4 ≤ T.degree t₀) (a : Option ι) : + a ∈ leafSet (splitVertex T t₀ w₁ w₂) ↔ ∃ x ∈ leafSet T, a = some x := by + classical + obtain ⟨hdeg_none, hdeg_t₀, hdeg_other⟩ := degrees_splitVertex hadj₁ hadj₂ hw12 + have hleaf_T : ∀ x : ι, x ∈ leafSet T ↔ T.degree x ≤ 1 := by + intro x + unfold leafSet IsLeaf + rw [Set.mem_ofPred_eq] + convert Iff.rfl + have hleaf_T' : ∀ z : Option ι, + z ∈ leafSet (splitVertex T t₀ w₁ w₂) ↔ (splitVertex T t₀ w₁ w₂).degree z ≤ 1 := by + intro z + unfold leafSet IsLeaf + rw [Set.mem_ofPred_eq] + have ht₀_not_leaf : t₀ ∉ leafSet T := by + rw [hleaf_T] + omega + cases a with + | none => + rw [hleaf_T'] + constructor + · intro hnone + omega + · rintro ⟨_, _, h⟩ + exact nomatch h + | some x => + rw [hleaf_T'] + by_cases hxt₀ : x = t₀ + · subst hxt₀ + constructor + · intro hsome + omega + · rintro ⟨y, hy, heq⟩ + exact (ht₀_not_leaf (Option.some.inj heq ▸ hy)).elim + · constructor + · intro hx + refine ⟨x, ?_, rfl⟩ + rw [hleaf_T, ← hdeg_other x hxt₀] + exact hx + · rintro ⟨y, hy, heq⟩ + cases Option.some.inj heq + rw [hleaf_T] at hy + rwa [hdeg_other x hxt₀] + +/-- When `4 ≤ T.degree t₀`, splitting `t₀` strictly decreases `∑ x, (degree x - 3)`. -/ +theorem sum_degree_sub_three_splitVertex_lt [Fintype ι] {T : SimpleGraph ι} {t₀ w₁ w₂ : ι} + [DecidableRel (splitVertex T t₀ w₁ w₂).Adj] [DecidableRel T.Adj] + (hadj₁ : T.Adj t₀ w₁) (hadj₂ : T.Adj t₀ w₂) (hw12 : w₁ ≠ w₂) + (ht₀_deg : 4 ≤ T.degree t₀) : + (∑ a : Option ι, ((splitVertex T t₀ w₁ w₂).degree a - 3)) < + ∑ x : ι, (T.degree x - 3) := by + classical + let T' := splitVertex T t₀ w₁ w₂ + obtain ⟨hdeg_none, hdeg_t₀, hdeg_other⟩ := degrees_splitVertex hadj₁ hadj₂ hw12 + have hs1 : ∑ x : ι, (T'.degree (some x) - 3) = + (T'.degree (some t₀) - 3) + ∑ x ∈ Finset.univ.erase t₀, (T'.degree (some x) - 3) := + (Finset.add_sum_erase (Finset.univ : Finset ι) + (fun x ↦ T'.degree (some x) - 3) (Finset.mem_univ t₀)).symm + have hs2 : ∑ x : ι, (T.degree x - 3) = + (T.degree t₀ - 3) + ∑ x ∈ Finset.univ.erase t₀, (T.degree x - 3) := + (Finset.add_sum_erase (Finset.univ : Finset ι) + (fun x ↦ T.degree x - 3) (Finset.mem_univ t₀)).symm + have heq_rest : ∑ x ∈ Finset.univ.erase t₀, (T'.degree (some x) - 3) = + ∑ x ∈ Finset.univ.erase t₀, (T.degree x - 3) := by + refine Finset.sum_congr rfl fun x hx ↦ ?_ + rw [hdeg_other x (Finset.ne_of_mem_erase hx)] + have hdeg_t₀' : T'.degree (some t₀) + 1 = T.degree t₀ := hdeg_t₀ + rw [Fintype.sum_option, hdeg_none, hs1, hs2, heq_rest] + omega + +/-- Splitting a vertex `t₀` of a tree `T` with neighbors `w₁ ≠ w₂` produces a tree. -/ +theorem isTree_splitVertex [Finite ι] {T : SimpleGraph ι} (hT : T.IsTree) {t₀ w₁ w₂ : ι} + (hadj₁ : T.Adj t₀ w₁) (hadj₂ : T.Adj t₀ w₂) (hw12 : w₁ ≠ w₂) : + (splitVertex T t₀ w₁ w₂).IsTree := by + classical + let := Fintype.ofFinite ι + let T' := splitVertex T t₀ w₁ w₂ + have hconn : T'.Connected := by + refine Connected.mk fun a b ↦ ?_ + obtain ⟨p⟩ := hT.connected (projAttach t₀ a) (projAttach t₀ b) + obtain ⟨wp, _⟩ := exists_walk_splitVertex (t₀ := t₀) (w₁ := w₁) (w₂ := w₂) p + exact ⟨(toSomeWalkSplit T t₀ w₁ w₂ a).append + (wp.append (toSomeWalkSplit T t₀ w₁ w₂ b).reverse)⟩ + obtain ⟨hdeg_none, hdeg_t₀, hdeg_other⟩ := degrees_splitVertex hadj₁ hadj₂ hw12 + have hsum_some : ∑ x : ι, T'.degree (some x) + 1 = ∑ x : ι, T.degree x := by + have h1 : ∑ x : ι, T'.degree (some x) = + T'.degree (some t₀) + ∑ x ∈ Finset.univ.erase t₀, T'.degree (some x) := + (Finset.add_sum_erase (Finset.univ : Finset ι) (fun x ↦ T'.degree (some x)) + (Finset.mem_univ t₀)).symm + have h2 : ∑ x : ι, T.degree x = + T.degree t₀ + ∑ x ∈ Finset.univ.erase t₀, T.degree x := + (Finset.add_sum_erase (Finset.univ : Finset ι) (fun x ↦ T.degree x) + (Finset.mem_univ t₀)).symm + have heq_rest : ∑ x ∈ Finset.univ.erase t₀, T'.degree (some x) = + ∑ x ∈ Finset.univ.erase t₀, T.degree x := by + refine Finset.sum_congr rfl fun x hx ↦ ?_ + exact hdeg_other x (Finset.ne_of_mem_erase hx) + have hdeg_t₀' : T'.degree (some t₀) + 1 = T.degree t₀ := hdeg_t₀ + rw [h1, h2, heq_rest] + omega + have hsum_all : ∑ z : Option ι, T'.degree z = (∑ x : ι, T.degree x) + 2 := by + rw [Fintype.sum_option, hdeg_none] + omega + have htwice' := T'.sum_degrees_eq_twice_card_edges + have htwice := T.sum_degrees_eq_twice_card_edges + have hedge : Nat.card T'.edgeSet = Nat.card T.edgeSet + 1 := by + rw [Nat.card_eq_fintype_card, Nat.card_eq_fintype_card, ← T'.edgeFinset_card, + ← T.edgeFinset_card] + omega + have hcardT : Nat.card T.edgeSet + 1 = Nat.card ι := + (isTree_iff_connected_and_card.1 hT).2 + refine isTree_iff_connected_and_card.2 ⟨hconn, ?_⟩ + rw [hedge, hcardT, Nat.card_eq_fintype_card, Nat.card_eq_fintype_card, Fintype.card_option] + +/-- Single step of Claim (3) of (5.1): splitting a non-leaf vertex `t₀` with `(τ t₀).edgeSet = ∅` +preserves `IsTreeDecomposition` and `treeDecompWidthPlusOne`. -/ +theorem splitVertex_isTreeDecomposition [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) + {t₀ w₁ w₂ : ι} (hadj₁ : T.Adj t₀ w₁) (hadj₂ : T.Adj t₀ w₂) (hw12 : w₁ ≠ w₂) + (ht₀_empty : (τ t₀).edgeSet = ∅) : + IsTreeDecomposition G (splitVertex T t₀ w₁ w₂) (fun a ↦ τ (projAttach t₀ a)) ∧ + treeDecompWidthPlusOne (fun a ↦ τ (projAttach t₀ a)) ≤ treeDecompWidthPlusOne τ := by + refine ⟨⟨isTree_splitVertex h.isTree hadj₁ hadj₂ hw12, fun a ↦ h.le (projAttach t₀ a), + ?_, ?_, ?_⟩, ?_⟩ + · ext x + · simp only [Hypergraph.biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion] + constructor + · rintro ⟨a, hx⟩ + exact (h.le (projAttach t₀ a)).vertexSet_subset hx + · intro hxG + obtain ⟨t, ht⟩ := h.vertex_mem_iff.1 hxG + exact ⟨some t, ht⟩ + · simp only [Hypergraph.biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion] + constructor + · rintro ⟨a, hx⟩ + exact (h.le (projAttach t₀ a)).edgeSet_subset hx + · intro heG + obtain ⟨t, ht⟩ := h.edge_mem_iff.1 heG + exact ⟨some t, ht⟩ + · simp only [Hypergraph.biUnion, Finset.mem_univ, true_and] + constructor + · rintro ⟨a, hinc⟩ + exact inc_of_le (h.le (projAttach t₀ a)) hinc + · intro hincG + obtain ⟨t, ht⟩ := h.inc_iff.1 hincG + exact ⟨some t, ht⟩ + · intro a b hne + by_cases hproj : projAttach t₀ a = projAttach t₀ b + · have ha : projAttach t₀ a = t₀ := by + cases a <;> cases b + · exact (hne rfl).elim + · exact rfl + · exact hproj + · exact (hne (congrArg Option.some hproj)).elim + change (τ (projAttach t₀ a)).edgeSet ∩ (τ (projAttach t₀ b)).edgeSet = ∅ + rw [← hproj, ha, ht₀_empty, Set.inter_self] + · exact h.edgeSet_inter_eq hproj + · intro a c b hp + exact h.inter_le (onTreePath_projAttach_of_splitVertex hp) + · rw [treeDecompWidthPlusOne_le_iff] + intro a + exact ncard_vertexSet_le_treeDecompWidthPlusOne τ (projAttach t₀ a) + +/-- **Claim (3) of (5.1)** (Graph Minors X, Section 5, page 169): +"(3) *We may assume that every vertex of $T$ has valency $\le 3$." -/ +theorem theorem_5_1_claim_3 [Fintype ι] {G : Hypergraph α β} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} (h : IsTreeDecomposition G T τ) + (hc1 : ∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T, τ t = edgeHypergraph G e) + (hc2 : ∀ t ∈ leafSet T, ∃ e ∈ G.edgeSet, τ t = edgeHypergraph G e) + (hnonleaf : ∀ t ∉ leafSet T, (τ t).edgeSet = ∅) : + ∃ (ι' : Type) (_ : Fintype ι') (T' : SimpleGraph ι') (τ' : ι' → Hypergraph α β), + IsTreeDecomposition G T' τ' ∧ + treeDecompWidthPlusOne τ' ≤ treeDecompWidthPlusOne τ ∧ + (∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T', τ' t = edgeHypergraph G e) ∧ + (∀ t ∈ leafSet T', ∃ e ∈ G.edgeSet, τ' t = edgeHypergraph G e) ∧ + (∀ t ∉ leafSet T', (τ' t).edgeSet = ∅) ∧ + (∀ t : ι', by classical exact T'.degree t ≤ 3) := by + classical + have hmain : ∀ (m : ℕ) (ι₀ : Type) [Fintype ι₀] (T₀ : SimpleGraph ι₀) + (τ₀ : ι₀ → Hypergraph α β), + IsTreeDecomposition G T₀ τ₀ → + (∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T₀, τ₀ t = edgeHypergraph G e) → + (∀ t ∈ leafSet T₀, ∃ e ∈ G.edgeSet, τ₀ t = edgeHypergraph G e) → + (∀ t ∉ leafSet T₀, (τ₀ t).edgeSet = ∅) → + (∑ x : ι₀, (T₀.degree x - 3)) = m → + ∃ (ι' : Type) (_ : Fintype ι') (T' : SimpleGraph ι') (τ' : ι' → Hypergraph α β), + IsTreeDecomposition G T' τ' ∧ + treeDecompWidthPlusOne τ' ≤ treeDecompWidthPlusOne τ₀ ∧ + (∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T', τ' t = edgeHypergraph G e) ∧ + (∀ t ∈ leafSet T', ∃ e ∈ G.edgeSet, τ' t = edgeHypergraph G e) ∧ + (∀ t ∉ leafSet T', (τ' t).edgeSet = ∅) ∧ + (∀ t : ι', T'.degree t ≤ 3) := by + intro m + induction m using Nat.strong_induction_on with + | ind m ih => + intro ι₀ _ T₀ τ₀ h₀ h1 h2 hnl hsum + by_cases hex : ∃ t₀ : ι₀, 4 ≤ T₀.degree t₀ + · obtain ⟨t₀, ht₀_deg⟩ := hex + have hcard_ge2 : 1 < (T₀.neighborFinset t₀).card := by + rw [card_neighborFinset_eq_degree] + omega + obtain ⟨w₁, w₂, hw₁, hw₂, hw12⟩ := Finset.one_lt_card_iff.1 hcard_ge2 + have hadj₁ : T₀.Adj t₀ w₁ := (mem_neighborFinset T₀ t₀ w₁).1 hw₁ + have hadj₂ : T₀.Adj t₀ w₂ := (mem_neighborFinset T₀ t₀ w₂).1 hw₂ + have ht₀_not_leaf : t₀ ∉ leafSet T₀ := by + intro hleaf + change T₀.degree t₀ ≤ 1 at hleaf + omega + obtain ⟨h₁, hw₁_le⟩ := + splitVertex_isTreeDecomposition h₀ hadj₁ hadj₂ hw12 (hnl t₀ ht₀_not_leaf) + let T₁ := splitVertex T₀ t₀ w₁ w₂ + let τ₁ : Option ι₀ → Hypergraph α β := fun a ↦ τ₀ (projAttach t₀ a) + have hleaf_iff := mem_leafSet_splitVertex_iff hadj₁ hadj₂ hw12 ht₀_deg + have h1' : ∀ e ∈ G.edgeSet, ∃ t ∈ leafSet T₁, τ₁ t = edgeHypergraph G e := by + intro e heG + obtain ⟨x, hx_leaf, hτ_x⟩ := h1 e heG + exact ⟨some x, (hleaf_iff (some x)).2 ⟨x, hx_leaf, rfl⟩, hτ_x⟩ + have h2' : ∀ a ∈ leafSet T₁, ∃ e ∈ G.edgeSet, τ₁ a = edgeHypergraph G e := by + intro a ha_leaf + obtain ⟨x, hx_leaf, rfl⟩ := (hleaf_iff a).1 ha_leaf + exact h2 x hx_leaf + have hnl' : ∀ a ∉ leafSet T₁, (τ₁ a).edgeSet = ∅ := by + rintro (_ | x) ha_not + · exact hnl t₀ ht₀_not_leaf + · exact hnl x (fun hx ↦ ha_not ((hleaf_iff (some x)).2 ⟨x, hx, rfl⟩)) + have hlt : (∑ a : Option ι₀, (T₁.degree a - 3)) < m := by + rw [← hsum] + exact sum_degree_sub_three_splitVertex_lt hadj₁ hadj₂ hw12 ht₀_deg + obtain ⟨ι', hfin', T', τ', h', hw', hc1', hc2', hnl'', hdeg'⟩ := + ih (∑ a : Option ι₀, (T₁.degree a - 3)) hlt (Option ι₀) T₁ τ₁ h₁ h1' h2' hnl' rfl + exact ⟨ι', hfin', T', τ', h', hw'.trans hw₁_le, hc1', hc2', hnl'', hdeg'⟩ + · push Not at hex + exact ⟨ι₀, inferInstance, T₀, τ₀, h₀, le_rfl, h1, h2, hnl, fun t ↦ by have := hex t; omega⟩ + let eFin := Fintype.equivFin ι + have hc1_fin : ∀ e ∈ G.edgeSet, ∃ t ∈ leafSet (T.map eFin.toEmbedding), + (τ ∘ eFin.symm) t = edgeHypergraph G e := by + intro e heG + obtain ⟨t, ht_leaf, hτ_t⟩ := hc1 e heG + refine ⟨eFin t, (isLeaf_map eFin t).2 ht_leaf, ?_⟩ + simpa using hτ_t + have hc2_fin : ∀ t ∈ leafSet (T.map eFin.toEmbedding), + ∃ e ∈ G.edgeSet, (τ ∘ eFin.symm) t = edgeHypergraph G e := by + intro t ht_leaf + obtain ⟨x, rfl⟩ := eFin.surjective t + rw [leafSet, Set.mem_ofPred_eq, isLeaf_map] at ht_leaf + simpa using hc2 x ht_leaf + have hnl_fin : ∀ t ∉ leafSet (T.map eFin.toEmbedding), + ((τ ∘ eFin.symm) t).edgeSet = ∅ := by + intro t ht_not + obtain ⟨x, rfl⟩ := eFin.surjective t + rw [leafSet, Set.mem_ofPred_eq, isLeaf_map] at ht_not + simpa using hnonleaf x ht_not + obtain ⟨ι', hfin', T', τ', h', hw', hc1', hc2', hnl', hdeg'⟩ := + hmain _ (Fin (Fintype.card ι)) (T.map eFin.toEmbedding) (τ ∘ eFin.symm) + (h.relabel eFin) hc1_fin hc2_fin hnl_fin rfl + rw [treeDecompWidthPlusOne_comp_equiv] at hw' + refine ⟨ι', hfin', T', τ', h', hw', hc1', hc2', hnl', fun t ↦ ?_⟩ + convert hdeg' t + +end GraphMinor.GM10 diff --git a/LeanPool/GraphMinor/GM11/ArcDrawings.lean b/LeanPool/GraphMinor/GM11/ArcDrawings.lean new file mode 100644 index 0000000000..bac8243d20 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/ArcDrawings.lean @@ -0,0 +1,361 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# Drawings on a line and on an `O`-arc + +A line with finitely many marked points that include its ends, and an `O`-arc with a non-empty +finite +set of marked points, each carry a drawing whose vertices are the marked points +(`exists_drawing_on_line`, `exists_drawing_on_oArc`). They are used to turn a painting into a +drawing. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- A curve that is injective on `[a, b]` runs along a line. -/ +theorem isLine_of_injOn {p : ℝ → S} (hp : Continuous p) {a b : ℝ} (hab : a < b) + (hi : InjOn p (Icc a b)) : IsLineWithEnds (p '' Icc a b) (p a) (p b) := by + let m : I → ℝ := fun t => a + t * (b - a) + have hm : ∀ t, m t ∈ Icc a b := fun t => by + have h0 := t.2.1 + have h1 := t.2.2 + constructor + · change a ≤ a + (t : ℝ) * (b - a) + nlinarith + · change a + (t : ℝ) * (b - a) ≤ b + nlinarith + have hg : Continuous fun t : I => p (m t) := hp.comp (by fun_prop) + have hinj : Function.Injective fun t : I => p (m t) := by + intro s t h + have := hi (hm s) (hm t) h + have h' : (s : ℝ) * (b - a) = t * (b - a) := by + change a + (s : ℝ) * (b - a) = a + (t : ℝ) * (b - a) at this + linarith + exact Subtype.ext (mul_right_cancel₀ (by linarith : b - a ≠ 0) h') + have hL := isLine_range hg hinj + have hr : range (fun t : I => p (m t)) = p '' Icc a b := by + ext y + constructor + · rintro ⟨t, rfl⟩ + exact ⟨m t, hm t, rfl⟩ + · rintro ⟨s, hs, rfl⟩ + have hd : 0 < b - a := by linarith + refine ⟨⟨(s - a) / (b - a), div_nonneg (by linarith [hs.1]) hd.le, + (div_le_one hd).mpr (by linarith [hs.2])⟩, ?_⟩ + change p (a + (s - a) / (b - a) * (b - a)) = p s + rw [div_mul_cancel₀ _ hd.ne'] + congr 1 + ring + have h0 : p (m 0) = p a := by + change p (a + ((0 : I) : ℝ) * (b - a)) = p a + simp + have h1 : p (m 1) = p b := by + change p (a + ((1 : I) : ℝ) * (b - a)) = p b + simp + simpa only [hr, h0, h1] using hL + +/-- A line with finitely many marked points, among them its ends, carries a drawing whose vertices +are the marked points. -/ +theorem exists_drawing_on_line (n : ℕ) : ∀ {L A : Set S} {x y : S}, IsLineWithEnds L x y → x ≠ y → + A.Finite → x ∈ A → y ∈ A → A ⊆ L → A.ncard ≤ n → ∃ D : Drawing S, D.U = L ∧ D.V = A := by + induction n with + | zero => + intro L A x y _ _ hA hx _ _ hn + have : A = ∅ := (ncard_eq_zero hA).mp (by omega) + simp [this] at hx + | succ n ih => + intro L A x y hL hxy hA hx hy hAL hn + by_cases hb : ∃ b ∈ A, b ≠ x ∧ b ≠ y + · obtain ⟨b, hbA, hbx, hby⟩ := hb + obtain ⟨f, hf0, hf1⟩ := id hL + let g : I → S := fun t => (f t).1 + have hgc : Continuous g := continuous_subtype_val.comp f.continuous + have hgi : Function.Injective g := Subtype.val_injective.comp f.injective + have hrange : range g = L := by + ext z + constructor + · rintro ⟨t, rfl⟩ + exact (f t).2 + · intro hz + obtain ⟨t, ht⟩ := f.surjective ⟨z, hz⟩ + exact ⟨t, by simp [g, ht]⟩ + obtain ⟨τ, hτ⟩ : b ∈ range g := hrange ▸ hAL hbA + have hτ0 : (0 : I) < τ := by + refine bot_lt_iff_ne_bot.mpr fun h => hbx ?_ + rw [← hτ, ← hf0] + exact congrArg g h + have hτ1 : τ < 1 := by + refine lt_top_iff_ne_top.mpr fun h => hby ?_ + rw [← hτ, ← hf1] + exact congrArg g h + have hL₁ : IsLineWithEnds (g '' Icc 0 τ) x b := by + have := isLine_piece hgc hgi hτ0 + rwa [hτ, show g 0 = x from hf0] at this + have hL₂ : IsLineWithEnds (g '' Icc τ 1) b y := by + have := isLine_piece hgc hgi hτ1 + rwa [hτ, show g 1 = y from hf1] at this + have hyn : y ∉ g '' Icc 0 τ := by + rintro ⟨t, ht, h⟩ + have : t = 1 := hgi (h.trans (show g 1 = y from hf1).symm) + exact absurd ht.2 (by rw [this]; exact not_le.mpr hτ1) + have hxn : x ∉ g '' Icc τ 1 := by + rintro ⟨t, ht, h⟩ + have : t = 0 := hgi (h.trans (show g 0 = x from hf0).symm) + exact absurd ht.1 (by rw [this]; exact not_le.mpr hτ0) + have hc₁ : (A ∩ g '' Icc 0 τ).ncard ≤ n := by + have : (A ∩ g '' Icc 0 τ).ncard < A.ncard := + ncard_lt_ncard ⟨inter_subset_left, fun h => hyn (h hy).2⟩ hA + omega + have hc₂ : (A ∩ g '' Icc τ 1).ncard ≤ n := by + have : (A ∩ g '' Icc τ 1).ncard < A.ncard := + ncard_lt_ncard ⟨inter_subset_left, fun h => hxn (h hx).2⟩ hA + omega + have hb₁ : b ∈ g '' Icc 0 τ := ⟨τ, ⟨hτ0.le, le_rfl⟩, hτ⟩ + have hb₂ : b ∈ g '' Icc τ 1 := ⟨τ, ⟨le_rfl, hτ1.le⟩, hτ⟩ + have hx₁ : x ∈ g '' Icc 0 τ := ⟨0, ⟨le_rfl, hτ0.le⟩, hf0⟩ + have hy₂ : y ∈ g '' Icc τ 1 := ⟨1, ⟨hτ1.le, le_rfl⟩, hf1⟩ + obtain ⟨D₁, hU₁, hV₁⟩ := ih hL₁ hbx.symm (hA.inter_of_left _) ⟨hx, hx₁⟩ ⟨hbA, hb₁⟩ + inter_subset_right hc₁ + obtain ⟨D₂, hU₂, hV₂⟩ := ih hL₂ hby (hA.inter_of_left _) ⟨hbA, hb₂⟩ ⟨hy, hy₂⟩ + inter_subset_right hc₂ + have hmeet : D₁.U ∩ D₂.U ⊆ D₁.V ∩ D₂.V := by + rw [hU₁, hU₂, hV₁, hV₂] + rintro z ⟨⟨s, hs, rfl⟩, ⟨t, ht, ht'⟩⟩ + have hst : t = s := hgi ht' + have hs' : s = τ := le_antisymm hs.2 (hst ▸ ht.1) + subst hs' + rw [hτ] + exact ⟨⟨hbA, hb₁⟩, ⟨hbA, hb₂⟩⟩ + refine ⟨D₁.glue D₂ hmeet, ?_, ?_⟩ + · change D₁.U ∪ D₂.U = L + rw [hU₁, hU₂, ← image_union, ← hrange, ← image_univ] + congr 1 + ext t + simp only [mem_union, mem_Icc, mem_univ, iff_true] + rcases le_total t τ with h | h + · exact Or.inl ⟨t.2.1, h⟩ + · exact Or.inr ⟨h, t.2.2⟩ + · change D₁.V ∪ D₂.V = A + rw [hV₁, hV₂, ← inter_union_distrib_left, inter_eq_left] + intro z hz + obtain ⟨t, rfl⟩ : z ∈ range g := hrange ▸ hAL hz + rcases le_total t τ with h | h + · exact Or.inl ⟨t, ⟨t.2.1, h⟩, rfl⟩ + · exact Or.inr ⟨t, ⟨h, t.2.2⟩, rfl⟩ + · refine ⟨lineDrawing hL hxy, rfl, ?_⟩ + apply subset_antisymm + · rintro z (rfl | rfl) + · exact hx + · exact hy + · intro z hz + by_contra h + exact hb ⟨z, hz, fun e => h (Or.inl e), fun e => h (Or.inr e)⟩ + +omit [T2Space S] in +/-- A parametrization of an `O`-arc from a given point. -/ +theorem exists_oArc_par {F : Set S} (hF : IsOArc F) {a : S} (ha : a ∈ F) : + ∃ p : ℝ → S, Continuous p ∧ p 0 = a ∧ p (2 * Real.pi) = a ∧ + (∀ s t, p s = p t → ∃ m : ℤ, s = t + m * (2 * Real.pi)) ∧ + p '' Ico 0 (2 * Real.pi) = F ∧ range p ⊆ F := by + obtain ⟨f⟩ := hF + obtain ⟨z, hz⟩ := f.surjective ⟨a, ha⟩ + let θ₀ : ℝ := Complex.arg (z : ℂ) + have hθ : Circle.exp θ₀ = z := Circle.exp_arg z + let p : ℝ → S := fun s => (f (Circle.exp (θ₀ + s))).1 + have hp : Continuous p := + continuous_subtype_val.comp (f.continuous.comp (Circle.exp.continuous.comp (by fun_prop))) + have h0 : p 0 = a := by simp [p, hθ, hz] + refine ⟨p, hp, h0, ?_, ?_, ?_, ?_⟩ + · have : Circle.exp (θ₀ + 2 * Real.pi) = Circle.exp θ₀ := by + rw [Circle.exp_add, Circle.exp_two_pi, mul_one] + simp only [p, this, hθ, hz] + · intro s t h + have h₁ := f.injective (Subtype.ext h) + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h₁ + exact ⟨m, by linarith⟩ + · apply subset_antisymm + · rintro _ ⟨s, -, rfl⟩ + exact (f _).2 + · intro y hy + obtain ⟨w, hw⟩ := f.surjective ⟨y, hy⟩ + have hpos : (0 : ℝ) < 2 * Real.pi := Real.two_pi_pos + let s := toIcoMod hpos 0 (Complex.arg (w : ℂ) - θ₀) + have hs : s ∈ Ico 0 (0 + 2 * Real.pi) := toIcoMod_mem_Ico hpos 0 _ + rw [zero_add] at hs + refine ⟨s, hs, ?_⟩ + have hk : (Complex.arg (w : ℂ) - θ₀) - toIcoDiv hpos 0 (Complex.arg (w : ℂ) - θ₀) • + (2 * Real.pi) = s := + self_sub_toIcoDiv_zsmul hpos 0 _ + have he : Circle.exp (θ₀ + s) = w := by + rw [← Circle.exp_arg w] + refine Circle.exp_eq_exp.mpr ⟨- toIcoDiv hpos 0 (Complex.arg (w : ℂ) - θ₀), ?_⟩ + rw [← hk, zsmul_eq_mul] + push_cast + ring + simp only [p, he, hw] + · rintro _ ⟨s, rfl⟩ + exact (f _).2 + +/-- An `O`-arc with one marked point is a loop. -/ +theorem exists_loop_drawing {F : Set S} (hF : IsOArc F) {a : S} (ha : a ∈ F) : + ∃ D : Drawing S, D.U = F ∧ D.V = {a} := by + obtain ⟨p, hp, h0, h2, hper, himg, hr⟩ := exists_oArc_par hF ha + have hpos : (0 : ℝ) < 2 * Real.pi := Real.two_pi_pos + have hsd : F \ {a} = p '' Ioo 0 (2 * Real.pi) := by + ext y + constructor + · rintro ⟨hy, hya⟩ + rw [← himg] at hy + obtain ⟨s, hs, rfl⟩ := hy + refine ⟨s, ⟨lt_of_le_of_ne hs.1 fun h => hya ?_, hs.2⟩, rfl⟩ + rw [← h, h0] + rfl + · rintro ⟨s, hs, rfl⟩ + refine ⟨hr ⟨s, rfl⟩, fun h => ?_⟩ + have h' : p s = p 0 := h.trans h0.symm + obtain ⟨m, hm⟩ := hper s 0 h' + rw [zero_add] at hm + have h₁ : (0 : ℝ) < m := by + by_contra hc + push Not at hc + nlinarith [hs.1] + have h₂ : (m : ℝ) < 1 := by + by_contra hc + push Not at hc + nlinarith [hs.2] + have h₃ : (0 : ℤ) < m := by exact_mod_cast h₁ + have h₄ : m < (1 : ℤ) := by exact_mod_cast h₂ + omega + have hpc : IsPathConnected (F \ {a}) := by + rw [hsd] + exact ((convex_Ioo _ _).isPathConnected (nonempty_Ioo.mpr hpos)).image hp + have hFc : IsClosed F := by + rw [← himg] + have : p '' Ico 0 (2 * Real.pi) = p '' Icc 0 (2 * Real.pi) := by + apply subset_antisymm (image_mono Ico_subset_Icc_self) + rintro _ ⟨s, hs, rfl⟩ + rcases hs.2.lt_or_eq with h | h + · exact ⟨s, ⟨hs.1, h⟩, rfl⟩ + · exact ⟨0, ⟨le_rfl, hpos⟩, by rw [h, h0, h2]⟩ + rw [this] + exact (isCompact_Icc.image hp).isClosed + have hcl : closure (F \ {a}) = F := by + apply subset_antisymm (closure_minimal sdiff_subset hFc) + rw [hsd] + intro y hy + rw [← himg] at hy + obtain ⟨s, hs, rfl⟩ := hy + have : s ∈ closure (Ioo 0 (2 * Real.pi)) := by + rw [closure_Ioo hpos.ne] + exact Ico_subset_Icc_self hs + exact map_mem_closure hp this fun t ht => ⟨t, ht, rfl⟩ + have huniq : ∀ C ∈ arcComponentsIn (F \ {a}), C = F \ {a} := by + rintro C ⟨-, hsub, -, hmax⟩ + exact (hmax _ Subset.rfl hpc hsub).symm + refine ⟨{ U := F, V := {a}, V_subset_U := singleton_subset_iff.mpr ha, isClosed_U := hFc, + finite_V := finite_singleton a, finite_edges := ?_, edge_cond := ?_ }, rfl, rfl⟩ + · exact (finite_singleton _).subset fun C hC => huniq C hC + · intro e he + obtain rfl := huniq e he + rw [hcl] + exact Or.inr ⟨a, inter_eq_right.mpr (singleton_subset_iff.mpr ha), hF⟩ + +/-- An `O`-arc with a non-empty finite set of marked points carries a drawing whose vertices are the +marked points. -/ +theorem exists_drawing_on_oArc {F A : Set S} (hF : IsOArc F) (hA : A.Finite) (hne : A.Nonempty) + (hAF : A ⊆ F) : ∃ D : Drawing S, D.U = F ∧ D.V = A := by + by_cases hs : ∃ a, A = {a} + · obtain ⟨a, rfl⟩ := hs + exact exists_loop_drawing hF (hAF rfl) + obtain ⟨x, hx⟩ := hne + obtain ⟨y, hy, hxy⟩ : ∃ y ∈ A, y ≠ x := by + by_contra h + push Not at h + exact hs ⟨x, eq_singleton_iff_unique_mem.mpr ⟨hx, h⟩⟩ + obtain ⟨p, hp, h0, h2, hper, himg, hr⟩ := exists_oArc_par hF (hAF hx) + have hpos : (0 : ℝ) < 2 * Real.pi := Real.two_pi_pos + obtain ⟨α, hα, rfl⟩ : y ∈ p '' Ico 0 (2 * Real.pi) := himg ▸ hAF hy + have hα0 : 0 < α := by + refine lt_of_le_of_ne hα.1 fun h => hxy ?_ + rw [← h, h0] + have hclose : ∀ {s t : ℝ}, p s = p t → |s - t| < 2 * Real.pi → s = t := by + intro s t h hd + obtain ⟨m, hm⟩ := hper s t h + have hm0 : m = 0 := by + by_contra hc + have h₁ : (1 : ℝ) ≤ |(m : ℝ)| := by exact_mod_cast Int.one_le_abs hc + have h₂ : |s - t| = |(m : ℝ)| * (2 * Real.pi) := by + rw [hm, add_sub_cancel_left, abs_mul, abs_of_pos hpos] + nlinarith + rw [hm, hm0] + simp + have hi₁ : InjOn p (Icc 0 α) := fun s hs t ht h => hclose h (by + rw [abs_lt] + constructor <;> linarith [hs.1, hs.2, ht.1, ht.2, hα.2]) + have hi₂ : InjOn p (Icc α (2 * Real.pi)) := fun s hs t ht h => hclose h (by + rw [abs_lt] + constructor <;> linarith [hs.1, hs.2, ht.1, ht.2, hα0]) + have hL₁ := isLine_of_injOn hp hα0 hi₁ + have hL₂ := isLine_of_injOn hp hα.2 hi₂ + rw [h0] at hL₁ + rw [h2] at hL₂ + have hx₁ : x ∈ p '' Icc 0 α := ⟨0, ⟨le_rfl, hα0.le⟩, h0⟩ + have hx₂ : x ∈ p '' Icc α (2 * Real.pi) := ⟨2 * Real.pi, ⟨hα.2.le, le_rfl⟩, h2⟩ + have hy₁ : p α ∈ p '' Icc 0 α := ⟨α, ⟨hα0.le, le_rfl⟩, rfl⟩ + have hy₂ : p α ∈ p '' Icc α (2 * Real.pi) := ⟨α, ⟨le_rfl, hα.2.le⟩, rfl⟩ + have hFeq : p '' Icc 0 α ∪ p '' Icc α (2 * Real.pi) = F := by + apply subset_antisymm + · rintro _ (⟨s, -, rfl⟩ | ⟨s, -, rfl⟩) <;> exact hr ⟨s, rfl⟩ + · rw [← himg] + rintro _ ⟨s, hs, rfl⟩ + rcases le_total s α with h | h + · exact Or.inl ⟨s, ⟨hs.1, h⟩, rfl⟩ + · exact Or.inr ⟨s, ⟨h, hs.2.le⟩, rfl⟩ + obtain ⟨D₁, hU₁, hV₁⟩ := exists_drawing_on_line _ hL₁ hxy.symm (hA.inter_of_left _) ⟨hx, hx₁⟩ + ⟨hy, hy₁⟩ inter_subset_right le_rfl + obtain ⟨D₂, hU₂, hV₂⟩ := exists_drawing_on_line _ hL₂ hxy (hA.inter_of_left _) ⟨hy, hy₂⟩ + ⟨hx, hx₂⟩ inter_subset_right le_rfl + have hmeet : D₁.U ∩ D₂.U ⊆ D₁.V ∩ D₂.V := by + rw [hU₁, hU₂, hV₁, hV₂] + rintro _ ⟨⟨s, hs, rfl⟩, ⟨t, ht, ht'⟩⟩ + obtain ⟨m, hm⟩ := hper t s ht' + by_cases hst : s = α + · subst hst + exact ⟨⟨hy, hy₁⟩, ⟨hy, hy₂⟩⟩ + have hs' : s < α := lt_of_le_of_ne hs.2 hst + by_cases hs0 : s = 0 + · subst hs0 + rw [h0] + exact ⟨⟨hx, hx₁⟩, ⟨hx, hx₂⟩⟩ + have hs0' : 0 < s := lt_of_le_of_ne hs.1 (Ne.symm hs0) + have hmm : (0 : ℝ) < m ∧ (m : ℝ) < 1 := by + constructor <;> nlinarith [ht.1, ht.2, Real.two_pi_pos] + have h₃ : (0 : ℤ) < m := by exact_mod_cast hmm.1 + have h₄ : m < (1 : ℤ) := by exact_mod_cast hmm.2 + omega + refine ⟨D₁.glue D₂ hmeet, ?_, ?_⟩ + · change D₁.U ∪ D₂.U = F + rw [hU₁, hU₂, hFeq] + · change D₁.V ∪ D₂.V = A + rw [hV₁, hV₂, ← inter_union_distrib_left, hFeq] + exact inter_eq_left.mpr hAF + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/CircuitRegions.lean b/LeanPool/GraphMinor/GM11/CircuitRegions.lean new file mode 100644 index 0000000000..5aa9eeb0a0 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/CircuitRegions.lean @@ -0,0 +1,151 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section5b +public import LeanPool.GraphMinor.GM11.DrawingTopology +public import LeanPool.GraphMinor.GM11.ThreeCircuits +public import LeanPool.GraphMinor.Surface.Crossing + +/-! +# The regions inside a circuit + +For a circuit `C` of length `< 2θ`, let `A` be the set of regions of `Γ` included in `ins(C)`. The +proof of (5.4) in Graph Minors XI (pages 83–85) uses that `N(A) = C`, and that `ins(C) - U(C)` is a +region of `C` and so is connected. This file proves these facts. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface Metric Complex + +universe u + +variable {S : Type u} [TopologicalSpace S] + +variable {Γ : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + +/-- The set `A` of regions of `Γ` included in `ins(C)`. -/ +def insideRegions (Γ : Drawing S) (X : Set S) : Set (Set S) := {r | r ∈ Γ.R ∧ r ⊆ X} + +/-- A vertex of a circuit lies on an edge of it. -/ +theorem exists_edge_at_vertex {C : Drawing S} (hC : C.IsCircuit) {v : S} (hv : v ∈ C.V) : + ∃ g ∈ C.E, v ∈ closure g := by + obtain ⟨X, -, hpos, -, hE⟩ := exists_walk_at hC hv + cases X with + | nil _ => simp at hpos + | @cons a y a' g hg t => + have hgC : g ∈ C.E := by rw [hE]; exact List.mem_cons_self + have hm : v ∈ closure g ∩ C.V := by rw [hg.2.2.2]; simp + exact ⟨g, hgC, hm.1⟩ + +/-- A circuit whose edges are edges of a subdrawing is a subdrawing of it. -/ +theorem circuit_isSubdrawing_of_E {C N : Drawing S} (hC : C.IsCircuit) + (hCs : C.IsSubdrawing Γ) (hNs : N.IsSubdrawing Γ) (hE : C.E ⊆ N.E) : C.IsSubdrawing N := by + refine ⟨fun v hv => ?_, hE⟩ + obtain ⟨g, hg, hvg⟩ := exists_edge_at_vertex hC hv + have hm : v ∈ closure g ∩ C.V := ⟨hvg, hv⟩ + rw [hCs.closure_inter_V hg, ← hNs.closure_inter_V (hE hg)] at hm + exact hm.2 + +/-- An edge outside a subdrawing misses its point set. -/ +theorem edge_disjoint_U {C : Drawing S} (hCs : C.IsSubdrawing Γ) {f : Set S} + (hf : f ∈ Γ.E) (hfC : f ∉ C.E) : Disjoint f C.U := by + refine disjoint_left.mpr fun y hy hyU => hfC ?_ + have hyV : y ∉ C.V := fun h => (hf.2.1 hy).2 (hCs.1 h) + obtain ⟨g, hg, hyg⟩ := C.exists_edge_of_mem hyU hyV + rw [Γ.edge_eq_of_mem hf (hCs.2 hg) hy hyg] + exact hg + +section Disc + +variable [T2Space S] (hS : IsClosedSurface S) (hs : IsSlope Γ k ins) {C : Drawing S} + (hC : C.IsCircuit) (hCs : C.IsSubdrawing Γ) (hl : C.length < k) +include hS hs hC hCs hl + +/-- The interior `ins(C) - U(C)` is connected. -/ +theorem isPreconnected_inner : IsPreconnected (ins C \ C.U) := by + obtain ⟨-, hfr, -⟩ := ins_facts_of_length hs hC hCs hl + have := IsClosedDisc.isPreconnected_diff_frontier hS (hs.isClosedDisc C hC hCs hl) + rwa [hfr] at this + +/-- If `ins(C) - U(C)` is not empty, it is a region of `C`. -/ +theorem inner_mem_R {x : S} (hx : x ∈ ins C) (hxU : x ∉ C.U) : + ins C \ C.U ∈ C.R := by + have hs' := theorem_4_2_proof hs hCs + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem hxU + have hsub : r ⊆ ins C := + (region_subset_or_disjoint hs' hC (Drawing.IsSubdrawing.refl C) hl hr).resolve_right + fun h => disjoint_left.mp h hxr hx + have heq : ins C \ C.U = r := by + refine subset_antisymm ?_ fun y hy => ⟨hsub hy, fun hyU => region_subset hr hy hyU⟩ + exact subset_region hr (isPreconnected_inner hS hs hC hCs hl) disjoint_sdiff_left ⟨hx, hxU⟩ hxr + rw [heq] + exact hr + +omit hS in +/-- A region with a point of the interior of `ins(C)` in its closure lies in `ins(C)`. -/ +theorem region_subset_ins_of_closure {r : Set S} (hr : r ∈ Γ.R) {p : S} (hp : p ∈ closure r) + (hpi : p ∈ ins C) (hpU : p ∉ C.U) : r ⊆ ins C := by + obtain ⟨-, hfr, -⟩ := ins_facts_of_length hs hC hCs hl + have hint : p ∈ interior (ins C) := by + by_contra h + apply hpU + rw [← hfr] + exact ⟨subset_closure hpi, h⟩ + obtain ⟨z, hz, hzr⟩ := mem_closure_iff.mp hp _ isOpen_interior hint + exact (region_subset_or_disjoint hs hC hCs hl hr).resolve_right fun h => + disjoint_left.mp h hzr (interior_subset hz) + +/-- `N(A) = C` for the set `A` of regions of `Γ` in `ins(C)` (Graph Minors XI, proof of (5.4), page +84: "`N(A) = C₁`"). -/ +theorem boundaryDrawing_inside : + boundaryDrawing Γ (insideRegions Γ (ins C)) = C := by + obtain ⟨hcl, hfr, -⟩ := ins_facts_of_length hs hC hCs hl + refine Drawing.ext_of_V_E ?_ ?_ + · ext v + rw [mem_boundaryDrawing_V hS] + constructor + · rintro ⟨⟨a, ⟨ha, hai⟩, hva⟩, b, ⟨hb, hbn⟩, hvb⟩ + by_contra hvC + have hvU : v ∉ C.U := by + intro hvU + obtain ⟨g, hg, hvg⟩ := C.exists_edge_of_mem hvU hvC + exact ((hCs.2 hg).2.1 hvg).2 hva.1 + have hvi : v ∈ ins C := hcl.closure_subset_iff.mpr hai hva.2.2 + exact hbn ⟨hb, region_subset_ins_of_closure hs hC hCs hl hb hvb.2.2 hvi hvU⟩ + · intro hv + obtain ⟨g, hg, hvg⟩ := exists_edge_at_vertex hC hv + obtain ⟨⟨r, hr, h, hsub⟩, r', hr', h', hnot⟩ := + exists_regions_of_circuit_edge hS hs hC hCs hl hg + exact ⟨⟨r, ⟨hr, hsub⟩, hCs.1 hv, Or.inr hr, closure_minimal h isClosed_closure hvg⟩, r', + ⟨hr', fun h'' => hnot h''.2⟩, hCs.1 hv, Or.inr hr', + closure_minimal h' isClosed_closure hvg⟩ + · ext e + rw [mem_boundaryDrawing_E] + constructor + · rintro ⟨⟨a, ⟨ha, hai⟩, hia⟩, b, ⟨hb, hbn⟩, hib⟩ + by_contra heC + obtain ⟨p, hpe, hpb⟩ := hib.2.2 + have hea := edge_subset_closure_of_incident hS hia.1 ha hia.2.2 + have hpi : p ∈ ins C := hcl.closure_subset_iff.mpr hai (hea hpe) + have hpU : p ∉ C.U := disjoint_left.mp (edge_disjoint_U hCs hia.1 heC) hpe + exact hbn ⟨hb, region_subset_ins_of_closure hs hC hCs hl hb hpb hpi hpU⟩ + · intro he + obtain ⟨x, hx⟩ := he.1 + obtain ⟨⟨r, hr, h, hsub⟩, r', hr', h', hnot⟩ := + exists_regions_of_circuit_edge hS hs hC hCs hl he + exact ⟨⟨r, ⟨hr, hsub⟩, hCs.2 he, hr, x, hx, h hx⟩, r', ⟨hr', fun h'' => hnot h''.2⟩, hCs.2 he, + hr', x, hx, h' hx⟩ + +end Disc + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Cited.lean b/LeanPool/GraphMinor/GM11/Cited.lean new file mode 100644 index 0000000000..a0969a4553 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Cited.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs + +/-! +# Statements that Graph Minors XI cites + +Graph Minors XI quotes these results from outside the paper. Each is a `Prop` about the actual +definitions, and the theorems of the paper take them as hypotheses. + +- `GM07Theorem112Statement`, `GM07Theorem1110Statement`: Graph Minors VII, (11.2) and (11.10). + +Two classical facts on the plane, which the paper uses silently when it says that a drawing without +circuits has only one region, are proved in `GraphMinor/GM11/PlaneFacts.lean`. + +Graph Minors X, (2.7), which the paper also cites, is `GM10.theorem_2_7`, already proved. XI (7.1) +quotes Epstein's Theorem 1.7 for disc bounding in the ambient manifold. Robertson and Seymour's +XI (7.2) keeps the disc inside the subset of the null-homotopy. `Surface.EpsteinStatement` supplies +that relative conclusion; the other topological statements are in `Surface/TopologyStatements.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +/-- Graph Minors VII, (11.2) (page 249): "If $\Sigma$ is a surface, and $\phi \colon S^1 \to \Sigma$ +is continuous and +non-null-homotopic, there is a non-null-homotopic $O$-arc included in $|\phi|$." -/ +def GM07Theorem112Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S], IsSurface S → ∀ φ : C(Circle, S), + ¬ ClosedCurveIsNullHomotopicIn univ φ → + ∃ F : Set S, IsOArc F ∧ F ⊆ range φ ∧ ¬ IsNullHomotopicOArc F + +/-- Graph Minors VII, (11.10) (page 253): "If $\Sigma$ is connected and $Z \subseteq \Sigma$ is +solid and flat, then either $Z = +\Sigma$ or $Z$ is planar." -/ +def GM07Theorem1110Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], IsSurface S → ConnectedSpace S → + ∀ Z : Set S, IsSolid Z → IsFlat Z → Z = univ ∨ IsPlanar Z + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/CitedResults.lean b/LeanPool/GraphMinor/GM11/CitedResults.lean new file mode 100644 index 0000000000..62c7db5e19 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/CitedResults.lean @@ -0,0 +1,255 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section91 +public import LeanPool.GraphMinor.GM11.Section92 +public import LeanPool.GraphMinor.GM14.Section7a +public import LeanPool.GraphMinor.GM19.Cited +public import LeanPool.GraphMinor.GM12.Cited +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM12.Section4WalkMetric + +/-! +# The results of Graph Minors XI that other papers cite + +The statements of (8.5), (8.10), (8.12), (9.1) and (9.2) as they are cited in Graph Minors XIV, XV +and +XIX. Most of this file only passes from a `T1Space` to the `T2Space` of a surface. + +The new part is `tangleMetric_vertex_edge_le`: a vertex at an edge has distance at most `2` from the +edge. A tangle puts the edge on the small side of the separation that cuts it off, so a circuit of +the +radial drawing through at most two vertices of the drawing surrounds the edge, by (7.2) of Graph +Minors +XIV. Such a circuit has length at most `4`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface GraphMinor.GM14 GraphMinor.GM10 + +universe u + +section Distance + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- `|W| ≤ 2c + 1`, with `c` the number of vertices of `H` on the walk `W` of a radial drawing after +its first vertex, and with `2c` if the first vertex of `W` is not in `H`. -/ +private theorem length_le_count {H D : Drawing S} (hrad : (PaintingOrDrawing.drawing + H).IsPreRadialDrawing D) + [DecidablePred (· ∈ H.V)] {u v : S} (W : GraphWalk D.toGraph u v) : + W.length ≤ 2 * (W.support.tail.filter (· ∈ H.V)).length + if u ∈ H.V then 1 else 0 := by + have hb := bipartite_of_preRadial hrad + induction W with + | nil _ => simp + | @cons x y z e hl r ih => + have hx : x ∈ H.V ↔ y ∉ H.V := hb _ _ _ hl + have hlen : (GraphWalk.cons hl r).length = r.length + 1 := rfl + have hsup : (GraphWalk.cons hl r).support.tail = r.support := rfl + rw [hlen, hsup, r.support_eq_cons, List.filter_cons] + by_cases hy : y ∈ H.V + · have hx' : x ∉ H.V := fun h => hx.mp h hy + simp only [hy, hx', ite_true, ite_false, decide_true, List.length_cons] at ih ⊢ + omega + · have hx' : x ∈ H.V := hx.mpr hy + simp only [hy, hx', ite_true, ite_false, decide_false, Bool.false_eq_true] at ih ⊢ + omega + +variable [ConnectedSpace S] + +/-- A vertex at an edge has distance at most `2` from the edge. This is a statement about the metric +of a respectful tangle and is one of the metric facts used in Graph Minors XV. +For `θ ≤ 2` it holds by +`d ≤ θ`. Otherwise the edge `e` with its ends is the small side of a separation of order at most +`2`, +and (7.2) of Graph Minors XIV gives a circuit `D` of the radial drawing around `e`, with at most two +vertices in `H`. So `|D| ≤ 4`. -/ +theorem tangleMetric_vertex_edge_le (hS : IsClosedSurface S) {H K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + (hResp : IsRespectfulDrawingTangle H θ T) (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) {v : S} {e : Set S} (he : e ∈ H.E) + (hv : v ∈ H.V) (hve : v ∈ closure e) : tangleMetric H K ins θ {v} e ≤ 2 := by + classical + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hP := hK.2.1 + by_cases hθ : θ ≤ 2 + · exact (tangleMetric_le_order hP _ _).trans hθ + push Not at hθ + have hT := hResp.2.1 + have hefin : (H.toHypergraph.ends e).Finite := + H.toHypergraph.vertexSet_finite.subset fun _ hx => H.toHypergraph.vertex_mem_of_inc hx + have h2 := GM12.drawing_edge_ends_ncard_le_two he + obtain ⟨D, hD, hDs, hDl, hDV, heD⟩ := + GM14.exists_circuit_around_drawing_edge hS ‹_› hResp (by omega) hK hd he + have hT' : IsPretangle (PaintingOrDrawing.drawing H).toHypergraph θ T := hT.isPretangle + have hs := isSlope_of_derived hS hT' hP.1 hd + obtain ⟨-, -, hnice⟩ := ins_slope_facts hS hs hD hDs hDl + have hcl : IsClosed (ins D) := (hs.isClosedDisc D hD hDs hDl).isCompact.isClosed + obtain ⟨u, W₀, hW₀, -, hV, hE⟩ := id hD + obtain ⟨W, hsu, hed⟩ := hDs.exists_walk_up W₀ + have hcount := length_le_count hP W + have hnd : W.support.tail.Nodup := by + rw [hsu] + exact hW₀.1 + have hF : (W.support.tail.filter (· ∈ H.V)).length ≤ 2 := by + have hnd' := hnd.filter (· ∈ H.V) + rw [← List.toFinset_card_of_nodup hnd', ← ncard_coe_finset] + refine (ncard_le_ncard (fun x hx => ?_) hefin).trans h2 + have hx' : x ∈ W.support.tail ∧ x ∈ H.V := by simpa using hx + have hxs : x ∈ W.support := List.mem_of_mem_tail hx'.1 + have hxD : x ∈ D.V := by + rw [hV, ← hsu] + exact hxs + have := hDV ⟨hxD, hx'.2⟩ + exact this.1 + obtain ⟨n, hn⟩ := even_length_of_closed hP W + have hn2 : n ≤ 2 := by + split_ifs at hcount <;> omega + have hsub : D.IsSubdrawing (walkDrawing K W) := by + refine ⟨fun x hx => ?_, fun f hf => ?_⟩ + · rw [walkDrawing_V, hsu] + rw [hV] at hx + exact hx + · rw [walkDrawing_E, hed] + rw [hE] at hf + exact hf + have hins : ins D ⊆ insWalk ins K W := fun x hx => + Or.inr (mem_iUnion₂.mpr ⟨D, ⟨hD, hsub⟩, hx⟩) + obtain ⟨y, hy⟩ := he.1 + have hdisj : Disjoint e K.U := disjoint_left.mpr fun z hz hzK => by + have hzV : z ∈ H.V := by + have h₁ : H.U ∩ K.U = H.V := hP.1 + rw [← h₁] + exact ⟨(he.2.1 hz).1, hzK⟩ + exact (he.2.1 hz).2 hzV + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem (disjoint_left.mp hdisj hy) + have her : e ⊆ r := subset_region hr he.2.2.1.isConnected.isPreconnected hdisj hy hyr + have hrD : r ⊆ ins D := nice_atom hnice (Or.inr hr) ⟨y, hyr, heD hy⟩ + have hwit : MetricWitness H K ins θ {v} e n := by + refine ⟨u, W, {v}, r, ?_, ?_, by omega, by omega, ?_, hrD.trans hins⟩ + · exact ⟨Or.inl (Or.inl ⟨v, hv, rfl⟩), Or.inl (Or.inl ⟨v, hP.2.1 hv, rfl⟩), Or.inl ⟨v, hv, + rfl, rfl⟩⟩ + · exact ⟨Or.inl (Or.inr he), Or.inr hr, Or.inr (Or.inl ⟨he, hr, her⟩)⟩ + · rw [singleton_subset_iff] + exact hins (closure_minimal heD hcl hve) + exact (tangleMetric_le hwit).trans hn2 + +omit [ConnectedSpace S] in +/-- The metric is symmetric. -/ +theorem tangleMetric_comm (H K : Drawing S) (ins : Drawing S → Set S) (θ : ℕ) (x y : Set S) : + tangleMetric H K ins θ x y = tangleMetric H K ins θ y x := by + classical + have h₁ : ∀ x y : Set S, (∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H K x x' ∧ IsCorrespondingAtom H K y y' ∧ + W.length < 2 * θ ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W) → + ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H K y x' ∧ IsCorrespondingAtom H K x y' ∧ + W.length < 2 * θ ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W := + fun x y ⟨u, W, x', y', a, b, c, d, e⟩ => ⟨u, W, y', x', b, a, c, e, d⟩ + have h₂ : ∀ x y : Set S, {k : ℕ | ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H K x x' ∧ IsCorrespondingAtom H K y y' ∧ + W.length < 2 * θ ∧ W.length = 2 * k ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W} = + {k : ℕ | ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H K y x' ∧ IsCorrespondingAtom H K x y' ∧ + W.length < 2 * θ ∧ W.length = 2 * k ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W} := by + intro x y + ext k + exact ⟨fun ⟨u, W, x', y', a, b, c, d, e, f⟩ => ⟨u, W, y', x', b, a, c, d, f, e⟩, + fun ⟨u, W, x', y', a, b, c, d, e, f⟩ => ⟨u, W, y', x', b, a, c, d, f, e⟩⟩ + by_cases hxy : x = y + · rw [hxy] + have hyx : ¬ y = x := fun h => hxy h.symm + unfold tangleMetric + simp only [hxy, hyx, ite_false] + have h₃ := propext (Iff.intro (h₁ x y) (h₁ y x)) + simp only [h₃, h₂ x y] + +end Distance + +section Statements + + + +/-- (8.5) in the form that Graph Minors XII, XIV and XIX cite. -/ +theorem gm19_theorem_8_5 : GM19.GM11Theorem85Statement.{u} := by + intro S _ _ hS hc Γ k ins hs u W hW + have : T2Space S := hS.2.1 + exact theorem_8_5_proof hS hs W hW + +/-- (7.2) in the form that Graph Minors XII cites. -/ +theorem gm12_theorem_7_2 : GM12.GM11Theorem72Statement.{u} := by + intro S _ _ hS hc Z F hF hFZ hn + exact theorem_7_2_proof hS hF hFZ hn + +/-- (8.5) in the form that Graph Minors XII cites. -/ +theorem gm12_theorem_8_5 : GM12.GM11Theorem85Statement.{u} := by + intro S _ _ hS hc Γ k ins hs u W hW + have : T2Space S := hS.2.1 + exact theorem_8_5_proof hS hs W hW + +/-- (8.13) in the form that Graph Minors XII cites. -/ +theorem gm12_theorem_8_13 : GM12.GM11Theorem813Statement.{u} := by + intro S _ _ hS hc Γ k ins hs a b X _ hX ha hb hmax + exact theorem_8_13_proof hS hs hX ha hb hmax + +/-- (8.10) in the form that Graph Minors XIV and XV cite. -/ +theorem gm14_theorem_8_10 : GM14.GM11Theorem810Statement.{u} := by + intro S _ _ hS hc Γ K ins hs c k _ hne + have : T2Space S := hS.2.1 + exact theorem_8_10_proof hS hs hne + +/-- (8.12) in the form that Graph Minors XIV and XV cite. -/ +theorem gm14_theorem_8_12 : GM14.GM11Theorem812Statement.{u} := by + intro S _ _ hS hc Γ K ins hs c + have : T2Space S := hS.2.1 + exact theorem_8_12_proof hS hs c + +/-- (9.2) in the form that Graph Minors XIX cites. -/ +theorem gm19_theorem_9_2 : GM19.GM11Theorem92Statement.{u} := by + intro S _ _ hS hc Γ K ins hs a b Y ha hb hY haY hbY + have : T2Space S := hS.2.1 + exact theorem_9_2_proof hS hs ha hb hY haY hbY + +/-- Metric facts for a respectful tangle used in Graph Minors XV and XIX, including the triangle +inequality from Graph Minors XI, (9.1). -/ +theorem gm15_theorem_9_1 : GM15.GM11Theorem91Statement.{u} := by + intro S _ _ H θ T d hS hc hM + obtain ⟨hResp, K, ins, hK, hd, hdeq⟩ := hM + have hP := hK.2.1 + have hT' : IsPretangle (PaintingOrDrawing.drawing H).toHypergraph θ T := hResp.2.1.isPretangle + have hs := isSlope_of_derived hS hT' hP.1 hd + have hatom : ∀ a ∈ H.A, IsGammaNice H a := fun a ha => ⟨{a}, by simpa using ha, by simp⟩ + have hvA : ∀ {v}, v ∈ H.V → ({v} : Set S) ∈ H.A := fun {v} hv => Or.inl (Or.inl ⟨v, hv, rfl⟩) + refine ⟨fun σ => ?_, fun a ha => ?_, fun a ha b hb => ?_, fun a ha b hb => ?_, + fun a ha b hb c hc' => ?_, fun hE v hv r hr hvr => ?_, fun v hv e he hve => ?_⟩ + · obtain ⟨a, ha, hσ⟩ := exists_atom H σ + refine ⟨a, ⟨ha, hσ⟩, fun b hb => Subset.antisymm ?_ ?_⟩ + · exact nice_atom (hatom a ha) hb.1 ⟨σ, hb.2, hσ⟩ + · exact nice_atom (hatom b hb.1) ha ⟨σ, hσ, hb.2⟩ + · rw [hdeq a ha a ha] + simp [tangleMetric] + · rw [hdeq a ha b hb] + exact tangleMetric_le_order hP a b + · rw [hdeq a ha b hb, hdeq b hb a ha] + exact tangleMetric_comm H K ins θ a b + · rw [hdeq a ha c hc', hdeq a ha b hb, hdeq b hb c hc'] + exact tangleMetric_triangle hS hP hs a b c + · rw [hdeq _ (hvA hv) r (Or.inr hr)] + exact tangleMetric_le_one hS hK hE hv hr hvr + · rw [hdeq _ (hvA hv) e (Or.inl (Or.inr he))] + exact tangleMetric_vertex_edge_le hS hResp hK hd he hv hve + +end Statements + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/CollarCut.lean b/LeanPool/GraphMinor/GM11/CollarCut.lean new file mode 100644 index 0000000000..2ec2e1e6b4 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/CollarCut.lean @@ -0,0 +1,566 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PerimeterCount + +/-! +# Cutting a collar along a line + +Graph Minors XI, proof of (8.7), takes a line `L` outside `X` between two points of `bd(X)`, and +says that +`Σ − (X ∪ L)` has at most two components `Δ₁, Δ₂` and that the perimeter walk splits at the ends of +`L` into +two walks, one on the boundary of each. + +We show the part of this that the proof needs, by means of a collar `h` of `X`. The ends of `L` tend +to two +points of the circle (`exists_end_limit`), the two arcs of the circle between them lead to two +components +(`arc_germ`), each arc lies in the closure of its component, and each component of `Σ − (X ∪ L)` +with a +limit point in `X − L` is one of the two (`exists_cut`). +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval Filter + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {h : C(Circle × I, S)} + +/-- The inverse of a collar on the part with positive height. -/ +noncomputable def collarInv (h : C(Circle × I, S)) : S → Circle × I := + Function.invFunOn h {p | 0 < p.2} + +omit [T2Space S] in +theorem collarInv_apply (hinj : InjOn h {p | 0 < p.2}) {p : Circle × I} (hp : 0 < p.2) : + collarInv h (h p) = p := + hinj.leftInvOn_invFunOn hp + +omit [T2Space S] in +theorem apply_collarInv {y : S} (hy : y ∈ h '' {p | 0 < p.2}) : + h (collarInv h y) = y ∧ 0 < (collarInv h y).2 := + ⟨Function.invFunOn_eq hy, Function.invFunOn_mem hy⟩ + +/-- Each neighbourhood of `0` in the unit interval contains an initial piece. -/ +theorem exists_small {V : Set I} (hV : V ∈ 𝓝 (0 : I)) : ∃ ε : I, 0 < ε ∧ ∀ t : I, t ≤ ε → t ∈ V + := by + obtain ⟨δ, hδ, hball⟩ := Metric.mem_nhds_iff.mp hV + refine ⟨⟨min (δ / 2) 1, by positivity, min_le_right _ _⟩, ?_, fun t ht => hball ?_⟩ + · change (0 : ℝ) < min (δ / 2) 1 + positivity + · have h₁ : (t : ℝ) ≤ min (δ / 2) 1 := ht + have h₂ : (t : ℝ) ≤ δ / 2 := h₁.trans (min_le_left _ _) + rw [Metric.mem_ball, Subtype.dist_eq, Real.dist_eq] + change |(t : ℝ) - 0| < δ + rw [sub_zero, abs_of_nonneg t.2.1] + linarith + +variable {X : Set S} + +/-- The inverse of a collar is continuous on the part with positive height. -/ +theorem collarInv_continuousWithinAt (hinj : InjOn h {p | 0 < p.2}) + (hoff : ∀ p : Circle × I, 0 < p.2 → h p ∉ X) (hbot : ∀ z, h (z, 0) ∈ X) {y : S} + (hy : y ∈ h '' {p | 0 < p.2}) : ContinuousWithinAt (collarInv h) (h '' {p | 0 < p.2}) y := by + obtain ⟨p₀, hp₀, rfl⟩ := hy + rw [ContinuousWithinAt, collarInv_apply hinj hp₀] + have hp₀' : (0 : I) < p₀.2 := hp₀ + have hp₀r : (0 : ℝ) < p₀.2 := hp₀' + let ε : I := ⟨(p₀.2 : ℝ) / 2, by positivity, by have := p₀.2.2.2; linarith⟩ + have hε : ε < p₀.2 := by + change (p₀.2 : ℝ) / 2 < p₀.2 + linarith + have hε0 : 0 < ε := by + change (0 : ℝ) < (p₀.2 : ℝ) / 2 + linarith + rw [tendsto_nhds] + intro N hN hp₀N + have hlow : IsClosed (h '' {p | p.2 ≤ ε}) := + ((isClosed_le continuous_snd continuous_const).isCompact.image h.continuous).isClosed + have hhigh : IsClosed (h '' ({p | ε ≤ p.2} ∩ Nᶜ)) := + (((isClosed_le continuous_const continuous_snd).inter hN.isClosed_compl).isCompact.image + h.continuous).isClosed + have hpos : ∀ q : Circle × I, h q = h p₀ → 0 < q.2 := by + intro q hqe + by_contra hq0 + have hq : q = (q.1, 0) := Prod.ext rfl (le_antisymm (not_lt.mp hq0) (unitInterval.nonneg _)) + refine hoff p₀ hp₀ ?_ + rw [← hqe, hq] + exact hbot q.1 + have hnot₁ : h p₀ ∉ h '' {p | p.2 ≤ ε} := by + rintro ⟨q, hq, hqe⟩ + have hq' : q.2 ≤ ε := hq + have := hinj (hpos q hqe) hp₀ hqe + rw [this] at hq' + exact not_le.mpr hε hq' + have hnot₂ : h p₀ ∉ h '' ({p | ε ≤ p.2} ∩ Nᶜ) := by + rintro ⟨q, hq, hqe⟩ + have := hinj (hpos q hqe) hp₀ hqe + exact hq.2 (this ▸ hp₀N) + refine mem_nhdsWithin.mpr ⟨(h '' {p | p.2 ≤ ε})ᶜ ∩ (h '' ({p | ε ≤ p.2} ∩ Nᶜ))ᶜ, + hlow.isOpen_compl.inter hhigh.isOpen_compl, ⟨hnot₁, hnot₂⟩, ?_⟩ + rintro y ⟨⟨hy₁, hy₂⟩, hyΩ⟩ + obtain ⟨hgy, hg0⟩ := apply_collarInv hyΩ + by_contra hn + have hle : ε ≤ (collarInv h y).2 := by + by_contra hlt + exact hy₁ ⟨_, (not_le.mp hlt).le, hgy⟩ + exact hy₂ ⟨_, ⟨hle, hn⟩, hgy⟩ + +variable {ψ : I → S} + +/-- The end of a path that leaves `X` tends to one point of the circle of the collar. -/ +theorem exists_end_limit (hinj : InjOn h {p | 0 < p.2}) + (hoff : ∀ p : Circle × I, 0 < p.2 → h p ∉ X) (hbot : ∀ z, h (z, 0) ∈ X) + (hop : IsOpen (X ∪ h '' {p | p.2 < 1})) (hψ : Continuous ψ) (hψX : ∀ t ∈ Ioo (0 : I) 1, ψ t ∉ X) + (h0 : ψ 0 ∈ X) (hfin : {z : Circle | h (z, 0) = ψ 0}.Finite) : + ∃ z, h (z, 0) = ψ 0 ∧ ∀ N ∈ 𝓝 ((z, 0) : Circle × I), ∃ s : I, 0 < s ∧ + ∀ s' ∈ Ioo (0 : I) s, collarInv h (ψ s') ∈ N := by + classical + let f : I → Circle × I := fun s => collarInv h (ψ s) + let Ω := h '' {p | 0 < p.2} + let F : Filter I := 𝓝[>] (0 : I) + have hFne : F.NeBot := nhdsGT_neBot_of_exists_gt ⟨1, zero_lt_one' I⟩ + -- Near `0` the path is in the collar. + obtain ⟨s₀, hs₀, hsmall⟩ : ∃ s₀ : I, 0 < s₀ ∧ ∀ s, s ≤ s₀ → ψ s ∈ X ∪ h '' {p | p.2 < 1} := by + refine exists_small ((hop.preimage hψ).mem_nhds (Or.inl h0)) + have hs₁ : ∀ s ∈ Ioo (0 : I) 1, s ≤ s₀ → ψ s ∈ Ω := by + intro s hs hle + rcases hsmall s hle with hx | ⟨p, hp, hpe⟩ + · exact (hψX s hs hx).elim + · refine ⟨p, ?_, hpe⟩ + by_contra hn + have hq : p = (p.1, 0) := Prod.ext rfl (le_antisymm (not_lt.mp hn) (unitInterval.nonneg _)) + refine hψX s hs ?_ + rw [← hpe, hq] + exact hbot p.1 + have hs₀1 : ∃ s₁ : I, 0 < s₁ ∧ s₁ ≤ s₀ ∧ s₁ ≤ 1 := ⟨s₀, hs₀, le_rfl, unitInterval.le_one _⟩ + have hev : ∀ s : I, 0 < s → Ioo (0 : I) s ∈ F := fun s hs => Ioo_mem_nhdsGT hs + have hmemΩ : ∀ s' ∈ Ioo (0 : I) s₀, ψ s' ∈ Ω := fun s' hs' => + hs₁ s' ⟨hs'.1, hs'.2.trans_le (unitInterval.le_one _)⟩ hs'.2.le + have hfc : ContinuousOn f (Ioo (0 : I) s₀) := by + intro s hs + exact (collarInv_continuousWithinAt hinj hoff hbot (hmemΩ s hs)).comp hψ.continuousWithinAt + hmemΩ + have hψt : Tendsto ψ F (𝓝 (ψ 0)) := (hψ.tendsto 0).mono_left nhdsWithin_le_nhds + have hhf : ∀ᶠ s in F, h (f s) = ψ s := by + filter_upwards [hev s₀ hs₀] with s hs + exact (apply_collarInv (hmemΩ s hs)).1 + -- All cluster points lie over `ψ 0` with height zero. + have hcl : ∀ p, MapClusterPt p F f → h p = ψ 0 ∧ p.2 = 0 := by + intro p hp + have hmap : MapClusterPt (h p) F (h ∘ f) := hp.continuousAt_comp h.continuous.continuousAt + have heq : h p = ψ 0 := by + have h₁ : MapClusterPt (h p) F ψ := by + rw [mapClusterPt_iff_frequently] at hmap ⊢ + intro s hs + exact (hmap s hs).mp (hhf.mono fun x hx hm => by + change h (f x) ∈ s at hm + rwa [hx] at hm) + exact eq_of_nhds_neBot (ClusterPt.mono h₁ hψt) + refine ⟨heq, ?_⟩ + by_contra hne + exact hoff p (unitInterval.pos_iff_ne_zero.mpr hne) (heq ▸ h0) + let T : Set (Circle × I) := (fun z => (z, (0 : I))) '' {z | h (z, 0) = ψ 0} + have hT : T.Finite := hfin.image _ + have hclT : ∀ p, MapClusterPt p F f → p ∈ T := fun p hp => by + obtain ⟨h₁, h₂⟩ := hcl p hp + exact ⟨p.1, by simpa [← h₂] using h₁, Prod.ext rfl h₂.symm⟩ + obtain ⟨p, hp⟩ : ∃ p, MapClusterPt p F f := exists_clusterPt_of_compactSpace (map f F) + have huniq : ∀ q, MapClusterPt q F f → q = p := by + intro q hq + by_contra hne + have hT' : IsClosed (T \ {p}) := (hT.subset sdiff_subset).isClosed + obtain ⟨C₁, hC₁, hC₁c, hC₁s⟩ := exists_mem_nhds_isClosed_subset + (hT'.isOpen_compl.mem_nhds (fun h => h.2 rfl)) + have hfrc : IsCompact (C₁ \ interior C₁) := (hC₁c.sdiff isOpen_interior).isCompact + have hfr : ∀ᶠ s in F, f s ∉ C₁ \ interior C₁ := by + refine hfrc.induction_on (p := fun A => ∀ᶠ s in F, f s ∉ A) (by simp) ?_ ?_ ?_ + · intro A B hAB hB + exact hB.mono fun s hs hA => hs (hAB hA) + · intro A B hA hB + exact (hA.and hB).mono fun s hs hm => hm.elim hs.1 hs.2 + · intro x hx + have hnc : ¬ MapClusterPt x F f := by + intro hc + have hxT := hclT x hc + have hxp : x = p := by + by_contra hxp + exact hC₁s hx.1 ⟨hxT, hxp⟩ + exact hx.2 (hxp ▸ mem_interior_iff_mem_nhds.mpr hC₁) + rw [mapClusterPt_iff_frequently] at hnc + push Not at hnc + obtain ⟨A, hA, hev'⟩ := hnc + exact ⟨A, mem_nhdsWithin_of_mem_nhds hA, hev'⟩ + obtain ⟨u, hu, hus⟩ := (mem_nhdsGT_iff_exists_Ioo_subset' (zero_lt_one' I)).mp hfr + let s₂ : I := min u s₀ + have hs₂ : 0 < s₂ := lt_min hu hs₀ + have hsub : Ioo (0 : I) s₂ ⊆ Ioo (0 : I) s₀ := fun x hx => ⟨hx.1, hx.2.trans_le + (min_le_right _ _)⟩ + have hpc : IsPreconnected (f '' Ioo (0 : I) s₂) := + isPreconnected_Ioo.image f (hfc.mono hsub) + have hcover : f '' Ioo (0 : I) s₂ ⊆ interior C₁ ∪ C₁ᶜ := by + rintro _ ⟨x, hx, rfl⟩ + by_cases hC : f x ∈ C₁ + · by_contra hn + exact hus ⟨hx.1, hx.2.trans_le (min_le_left _ _)⟩ ⟨hC, fun hi => hn (Or.inl hi)⟩ + · exact Or.inr hC + have hdis : Disjoint (interior C₁) C₁ᶜ := + disjoint_left.mpr fun x hx hc => hc (interior_subset hx) + have hev₂ : ∀ᶠ s in F, s ∈ Ioo (0 : I) s₂ := hev s₂ hs₂ + rcases hpc.subset_or_subset isOpen_interior hC₁c.isOpen_compl hdis hcover with hin | hin + · have hqC : q ∉ C₁ := fun hqc => hC₁s hqc ⟨hclT q hq, hne⟩ + obtain ⟨s, hs₁, hs₂'⟩ := (hq.frequently (hC₁c.isOpen_compl.mem_nhds hqC)).and_eventually hev₂ + |>.exists + exact hs₁ (interior_subset (hin ⟨s, hs₂', rfl⟩)) + · obtain ⟨s, hs₁, hs₂'⟩ := (hp.frequently hC₁).and_eventually hev₂ |>.exists + exact hin ⟨s, hs₂', rfl⟩ hs₁ + have hle : map f F ≤ 𝓝 p := isCompact_univ.le_nhds_of_unique_clusterPt univ_mem fun x _ hx + => huniq x hx + obtain ⟨hp₁, hp₂⟩ := hcl p hp + have hpe : ((p.1, 0) : Circle × I) = p := Prod.ext rfl hp₂.symm + refine ⟨p.1, by rw [hpe]; exact hp₁, fun N hN => ?_⟩ + rw [hpe] at hN + obtain ⟨u, hu, hus⟩ := (mem_nhdsGT_iff_exists_Ioo_subset' (zero_lt_one' I)).mp (hle hN) + exact ⟨u, hu, fun s' hs' => hus hs'⟩ + +variable {z₀ z₁ : Circle} + +/-- Away from the two ends of the line, a low enough part of the collar misses the line. This is the +step +where the limits at the two ends are used. -/ +theorem exists_tube (hinj : InjOn h {p | 0 < p.2}) (hoff : ∀ p : Circle × I, 0 < p.2 → h p ∉ X) + (hbot : ∀ z, h (z, 0) ∈ X) (hψ : Continuous ψ) (hψX : ∀ t ∈ Ioo (0 : I) 1, ψ t ∉ X) + (h0 : ψ 0 ∈ X) (h1 : ψ 1 ∈ X) + (hl₀ : ∀ N ∈ 𝓝 ((z₀, 0) : Circle × I), ∃ s : I, 0 < s ∧ ∀ s' ∈ Ioo (0 : I) s, collarInv h + (ψ s') ∈ N) + (hl₁ : ∀ N ∈ 𝓝 ((z₁, 0) : Circle × I), ∃ s : I, s < 1 ∧ ∀ s' ∈ Ioo s (1 : I), collarInv h + (ψ s') ∈ N) + {K : Set Circle} (hK : IsCompact K) (hK₀ : z₀ ∉ K) (hK₁ : z₁ ∉ K) : + ∃ ε : I, 0 < ε ∧ ∀ z ∈ K, ∀ t : I, 0 < t → t ≤ ε → h (z, t) ∉ range ψ := by + let B : Set (Circle × I) := {p | 0 < p.2 ∧ h p ∈ range ψ} + have hnot : ∀ z ∈ K, (z, (0 : I)) ∉ closure B := by + intro z hz hcl + obtain ⟨x, hxB, hxt⟩ := mem_closure_iff_seq_limit.mp hcl + have hx : ∀ n, ∃ s : I, ψ s = h (x n) := fun n => (hxB n).2 + choose s hs using hx + obtain ⟨s', hs', φ, hφ, hlim⟩ := isCompact_univ.tendsto_subseq (x := s) fun _ => mem_univ _ + have hsI : ∀ n, s n ∈ Ioo (0 : I) 1 := by + intro n + have hoffn := hoff (x n) (hxB n).1 + refine ⟨unitInterval.pos_iff_ne_zero.mpr fun h' => hoffn ?_, + unitInterval.lt_one_iff_ne_one.mpr fun h' => hoffn ?_⟩ + · rw [← hs n, h'] + exact h0 + · rw [← hs n, h'] + exact h1 + have hg : ∀ n, collarInv h (ψ (s n)) = x n := fun n => by + rw [hs n] + exact collarInv_apply hinj (hxB n).1 + have hxφ : Tendsto (x ∘ φ) atTop (𝓝 (z, (0 : I))) := hxt.comp hφ.tendsto_atTop + have hval : ψ s' = h (z, 0) := by + have h₁ : Tendsto (fun n => ψ (s (φ n))) atTop (𝓝 (ψ s')) := (hψ.tendsto s').comp hlim + have h₂ : Tendsto (fun n => h (x (φ n))) atTop (𝓝 (h (z, 0))) := + (h.continuous.tendsto _).comp hxφ + refine tendsto_nhds_unique h₁ (h₂.congr fun n => (hs (φ n)).symm) + have hsend : s' = 0 ∨ s' = 1 := by + by_contra hn + push Not at hn + refine hψX s' ⟨unitInterval.pos_iff_ne_zero.mpr hn.1, unitInterval.lt_one_iff_ne_one.mpr + hn.2⟩ ?_ + rw [hval] + exact hbot z + rcases hsend with rfl | rfl + · have hne : ((z₀, 0) : Circle × I) ≠ (z, 0) := fun he => + hK₀ (by rw [show z₀ = z from congrArg Prod.fst he]; exact hz) + obtain ⟨N, N', hN, hN', hdis⟩ := t2_separation_nhds hne + obtain ⟨u, hu, hus⟩ := hl₀ N hN + have hev₁ : ∀ᶠ n in atTop, s (φ n) ∈ Iio u := hlim (Iio_mem_nhds hu) + have hev₂ : ∀ᶠ n in atTop, x (φ n) ∈ N' := hxφ hN' + obtain ⟨n, hn₁, hn₂⟩ := (hev₁.and hev₂).exists + have := hus (s (φ n)) ⟨(hsI _).1, hn₁⟩ + rw [hg] at this + exact disjoint_left.mp hdis this hn₂ + · have hne : ((z₁, 0) : Circle × I) ≠ (z, 0) := fun he => + hK₁ (by rw [show z₁ = z from congrArg Prod.fst he]; exact hz) + obtain ⟨N, N', hN, hN', hdis⟩ := t2_separation_nhds hne + obtain ⟨u, hu, hus⟩ := hl₁ N hN + have hev₁ : ∀ᶠ n in atTop, s (φ n) ∈ Ioi u := hlim (Ioi_mem_nhds hu) + have hev₂ : ∀ᶠ n in atTop, x (φ n) ∈ N' := hxφ hN' + obtain ⟨n, hn₁, hn₂⟩ := (hev₁.and hev₂).exists + have := hus (s (φ n)) ⟨hn₁, (hsI _).2⟩ + rw [hg] at this + exact disjoint_left.mp hdis this hn₂ + have hsub : K ×ˢ ({0} : Set I) ⊆ (closure B)ᶜ := by + rintro ⟨z, t⟩ ⟨hz, ht⟩ + obtain rfl : t = 0 := ht + exact hnot z hz + obtain ⟨A, V, hA, hV, hKA, h0V, hAV⟩ := generalized_tube_lemma hK isCompact_singleton + isClosed_closure.isOpen_compl hsub + obtain ⟨ε, hε, hsm⟩ := exists_small (hV.mem_nhds (h0V rfl)) + refine ⟨ε, hε, fun z hz t ht hle hm => ?_⟩ + exact hAV (mk_mem_prod (hKA hz) (hsm t hle)) (subset_closure ⟨ht, hm⟩) + +/-- The point `e^{2π i t}` of the circle. -/ +noncomputable def circlePt (t : ℝ) : Circle := Circle.exp (2 * Real.pi * t) + +theorem continuous_circlePt : Continuous circlePt := + Circle.exp.continuous.comp (continuous_const.mul continuous_id) + +theorem isOpenMap_circlePt : IsOpenMap circlePt := + isLocalHomeomorph_circleExp.isOpenMap.comp + (Homeomorph.mulLeft₀ (2 * Real.pi) (by positivity)).isOpenMap + +/-- An arc of the circle away from the ends of the line leads to one component of `Σ − (X ∪ L)`. -/ +theorem arc_germ (hinj : InjOn h {p | 0 < p.2}) (hoff : ∀ p : Circle × I, 0 < p.2 → h p ∉ X) + (hbot : ∀ z, h (z, 0) ∈ X) (hψ : Continuous ψ) (hψX : ∀ t ∈ Ioo (0 : I) 1, ψ t ∉ X) + (h0 : ψ 0 ∈ X) (h1 : ψ 1 ∈ X) + (hl₀ : ∀ N ∈ 𝓝 ((z₀, 0) : Circle × I), ∃ s : I, 0 < s ∧ ∀ s' ∈ Ioo (0 : I) s, collarInv h + (ψ s') ∈ N) + (hl₁ : ∀ N ∈ 𝓝 ((z₁, 0) : Circle × I), ∃ s : I, s < 1 ∧ ∀ s' ∈ Ioo s (1 : I), collarInv h + (ψ s') ∈ N) + {α β : ℝ} (hαβ : α < β) (hρ : ∀ t ∈ Ioo α β, circlePt t ≠ z₀ ∧ circlePt t ≠ z₁) : + ∃ y ∈ (X ∪ range ψ)ᶜ, ∀ t ∈ Ioo α β, ∀ᶠ p in 𝓝 ((circlePt t, 0) : Circle × I), 0 < p.2 → + h p ∈ connectedComponentIn (X ∪ range ψ)ᶜ y := by + have htube : ∀ K : Set ℝ, IsCompact K → K ⊆ Ioo α β → ∃ ε : I, 0 < ε + ∧ ∀ z ∈ circlePt '' K, ∀ t : I, 0 < t → + t ≤ ε → h (z, t) ∉ range ψ := by + intro K hK hsub + refine exists_tube hinj hoff hbot hψ hψX h0 h1 hl₀ hl₁ (hK.image continuous_circlePt) ?_ ?_ + · rintro ⟨t, ht, he⟩ + exact (hρ t (hsub ht)).1 he + · rintro ⟨t, ht, he⟩ + exact (hρ t (hsub ht)).2 he + let Y := (X ∪ range ψ)ᶜ + let τ := (α + β) / 2 + have hτ : τ ∈ Ioo α β := ⟨by simp only [τ]; linarith, by simp only [τ]; linarith⟩ + obtain ⟨ε₀, hε₀, hsm₀⟩ := htube {τ} isCompact_singleton (singleton_subset_iff.mpr hτ) + have hmemY : ∀ z ∈ circlePt '' Ioo α β, ∀ (K : Set Circle) (ε : I), z ∈ K → + (∀ z ∈ K, ∀ t : I, 0 < t → t ≤ ε → h (z, t) ∉ range ψ) → + ∀ t : I, 0 < t → t ≤ ε → h (z, t) ∈ Y := by + intro z _ K ε hzK hK t ht hle hn + rcases hn with hn | hn + · exact hoff _ ht hn + · exact hK z hzK t ht hle hn + let y := h (circlePt τ, ε₀) + have hyY : y ∈ Y := hmemY _ ⟨τ, hτ, rfl⟩ (circlePt '' {τ}) ε₀ ⟨τ, rfl, rfl⟩ hsm₀ ε₀ hε₀ le_rfl + refine ⟨y, hyY, fun t ht => ?_⟩ + let a' := (α + min t τ) / 2 + let b' := (β + max t τ) / 2 + have ha' : α < a' ∧ a' < min t τ := by + have := lt_min ht.1 hτ.1 + constructor <;> simp only [a'] <;> linarith + have hb' : max t τ < b' ∧ b' < β := by + have := max_lt ht.2 hτ.2 + constructor <;> simp only [b'] <;> linarith + have hsubI : Icc a' b' ⊆ Ioo α β := fun x hx => ⟨ha'.1.trans_le hx.1, hx.2.trans_lt hb'.2⟩ + obtain ⟨ε, hε, hsm⟩ := htube (Icc a' b') isCompact_Icc hsubI + -- The low part of the collar over `[a', b']`, with the segment up to `y`. + let m : I := min ε ε₀ + have hm : 0 < m := lt_min hε hε₀ + let G₀ : Set S := (fun u : I => h (circlePt τ, u)) '' Icc m ε₀ + let G : Set S := (fun q : ℝ × I => h (circlePt q.1, q.2)) '' (Icc a' b' ×ˢ Ioc 0 ε) + have hcG : Continuous fun q : ℝ × I => h (circlePt q.1, q.2) := h.continuous.comp + ((continuous_circlePt.comp continuous_fst).prodMk continuous_snd) + have hG₀p : IsPreconnected G₀ := isPreconnected_Icc.image _ (h.continuous.comp + (continuous_const.prodMk continuous_id)).continuousOn + have hGp : IsPreconnected G := (isPreconnected_Icc.prod isPreconnected_Ioc).image _ + hcG.continuousOn + have hτI : τ ∈ Icc a' b' := ⟨(ha'.2.le.trans (min_le_right _ _)), (le_max_right _ _).trans + hb'.1.le⟩ + have htI : t ∈ Icc a' b' := ⟨(ha'.2.le.trans (min_le_left _ _)), (le_max_left _ _).trans hb'.1.le⟩ + have hjoin : (G₀ ∩ G).Nonempty := + ⟨h (circlePt τ, m), ⟨m, ⟨le_rfl, min_le_right _ _⟩, rfl⟩, ⟨(τ, m), ⟨hτI, hm, min_le_left _ _⟩, + rfl⟩⟩ + have hU := hG₀p.union' hjoin hGp + have hUY : G₀ ∪ G ⊆ Y := by + rintro _ (⟨u, hu, rfl⟩ | ⟨⟨u, v⟩, ⟨hu, hv⟩, rfl⟩) + · exact hmemY _ ⟨τ, hτ, rfl⟩ (circlePt '' {τ}) ε₀ ⟨τ, rfl, rfl⟩ hsm₀ u (hm.trans_le hu.1) hu.2 + · exact hmemY _ ⟨u, hsubI hu, rfl⟩ (circlePt '' Icc a' b') ε ⟨u, hu, rfl⟩ hsm v hv.1 hv.2 + have hyG : y ∈ G₀ ∪ G := Or.inl ⟨ε₀, ⟨min_le_right _ _, le_rfl⟩, rfl⟩ + have hcomp := hU.subset_connectedComponentIn hyG hUY + have hN₁ : circlePt '' Ioo a' b' ∈ 𝓝 (circlePt t) := + (isOpenMap_circlePt _ isOpen_Ioo).mem_nhds ⟨t, ⟨ha'.2.trans_le (min_le_left _ _), + (le_max_left _ _).trans_lt hb'.1⟩, rfl⟩ + have hN₂ : Iic ε ∈ 𝓝 (0 : I) := by + exact Iic_mem_nhds hε + filter_upwards [prod_mem_nhds hN₁ hN₂] with p hp hpos + obtain ⟨⟨u, hu, hue⟩, hv⟩ := hp + refine hcomp (Or.inr ⟨(u, p.2), ⟨⟨hu.1.le, hu.2.le⟩, hpos, hv⟩, ?_⟩) + change h (circlePt u, p.2) = h p + rw [hue] + +/-- Each point of the circle is `e^{2π i t}` with `lo ≤ t < lo + 1`. -/ +theorem exists_circlePt_time (lo : ℝ) (z : Circle) : ∃ t ∈ Ico lo (lo + 1), circlePt t = z := by + obtain ⟨t, ht, hz⟩ := exists_collar_time z + obtain ⟨t', ht', hz'⟩ := exists_collar_time ((circlePt lo)⁻¹ * z) + refine ⟨lo + t', ⟨by linarith [ht'.1], by linarith [ht'.2]⟩, ?_⟩ + have h₁ : circlePt (lo + t') = circlePt lo * circlePt t' := by + simp only [circlePt, mul_add, Circle.exp_add] + rw [h₁] + change circlePt lo * circlePt t' = z + have h₂ : circlePt t' = (circlePt lo)⁻¹ * z := hz'.symm + rw [h₂, mul_inv_cancel_left] + +/-- `e^{2π i t}` is injective on a half-open interval of length one. -/ +theorem circlePt_injOn {lo : ℝ} {s t : ℝ} (hs : s ∈ Ico lo (lo + 1)) (ht : t ∈ Ico lo (lo + 1)) + (h : circlePt s = circlePt t) : s = t := by + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h + have hpi := Real.pi_pos + have hm' : s = t + m := by + have : 2 * Real.pi * s = 2 * Real.pi * (t + m) := by rw [hm]; ring + exact mul_left_cancel₀ (by positivity) this + have hlt₁ : (m : ℝ) < 1 := by linarith [hs.2, ht.1] + have hlt₂ : (-1 : ℝ) < m := by linarith [hs.1, ht.2] + have h₁ : m < 1 := by exact_mod_cast hlt₁ + have h₂ : -1 < m := by exact_mod_cast hlt₂ + obtain rfl : m = 0 := by omega + simpa using hm' + +/-- **Cutting along a line.** Let `ψ` be a path outside `X` with its two ends on `X`, and suppose +the ends +tend to the points `e^{2π i lo}` and `e^{2π i hi}` of the circle of the collar `h`. Then the two +arcs between +those points lead to components `D₁, D₂` of `Σ − (X ∪ L)`. Each arc lies in the closure of its +component, and +each component of `Σ − (X ∪ L)` with a limit point in `X − L` is `D₁` or `D₂`. -/ +theorem exists_cut (hinj : InjOn h {p | 0 < p.2}) (hoff : ∀ p : Circle × I, 0 < p.2 → h p ∉ X) + (hbot : ∀ z, h (z, 0) ∈ X) (hop : IsOpen (X ∪ h '' {p | p.2 < 1})) (hψ : Continuous ψ) + (hψX : ∀ t ∈ Ioo (0 : I) 1, ψ t ∉ X) (h0 : ψ 0 ∈ X) (h1 : ψ 1 ∈ X) + (hl₀ : ∀ N ∈ 𝓝 ((z₀, 0) : Circle × I), ∃ s : I, 0 < s ∧ ∀ s' ∈ Ioo (0 : I) s, collarInv h + (ψ s') ∈ N) + (hl₁ : ∀ N ∈ 𝓝 ((z₁, 0) : Circle × I), ∃ s : I, s < 1 ∧ ∀ s' ∈ Ioo s (1 : I), collarInv h + (ψ s') ∈ N) + (hz₀ : h (z₀, 0) ∈ range ψ) (hz₁ : h (z₁, 0) ∈ range ψ) + {lo hi : ℝ} (hlo : lo < hi) (hhi : hi < lo + 1) + (hends : (z₀ = circlePt lo ∧ z₁ = circlePt hi) ∨ (z₀ = circlePt hi ∧ z₁ = circlePt lo)) : + ∃ y₁ ∈ (X ∪ range ψ)ᶜ, ∃ y₂ ∈ (X ∪ range ψ)ᶜ, + (∀ t ∈ Icc lo hi, h (circlePt t, 0) ∈ closure (connectedComponentIn (X ∪ range ψ)ᶜ y₁)) ∧ + (∀ t ∈ Icc hi (lo + 1), h (circlePt t, 0) ∈ closure (connectedComponentIn (X ∪ range ψ)ᶜ y₂)) + ∧ + ∀ y ∈ (X ∪ range ψ)ᶜ, ∀ x ∈ closure (connectedComponentIn (X ∪ range ψ)ᶜ y), x ∈ X + → x ∉ range ψ → + connectedComponentIn (X ∪ range ψ)ᶜ y = connectedComponentIn (X ∪ range ψ)ᶜ y₁ ∨ + connectedComponentIn (X ∪ range ψ)ᶜ y = connectedComponentIn (X ∪ range ψ)ᶜ y₂ := by + have harc : ∀ {α β : ℝ}, α < β → lo ≤ α → β ≤ lo + 1 → (α = lo ∧ β = hi ∨ α = hi ∧ β = lo + 1) → + ∀ t ∈ Ioo α β, circlePt t ≠ z₀ ∧ circlePt t ≠ z₁ := by + intro α β _ hα hβ hcase t ht + have htI : t ∈ Ico lo (lo + 1) := ⟨hα.trans ht.1.le, ht.2.trans_le hβ⟩ + have hne : circlePt t ≠ circlePt lo ∧ circlePt t ≠ circlePt hi := by + constructor + · intro he + have := circlePt_injOn htI ⟨le_rfl, by linarith⟩ he + rcases hcase with ⟨rfl, -⟩ | ⟨rfl, -⟩ <;> linarith [ht.1] + · intro he + have := circlePt_injOn htI ⟨hlo.le, hhi⟩ he + rcases hcase with ⟨-, rfl⟩ | ⟨rfl, -⟩ <;> linarith [ht.1, ht.2] + rcases hends with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hne + · exact hne.symm + obtain ⟨y₁, hy₁, hg₁⟩ := arc_germ hinj hoff hbot hψ hψX h0 h1 hl₀ hl₁ hlo + (harc hlo le_rfl (by linarith) (Or.inl ⟨rfl, rfl⟩)) + obtain ⟨y₂, hy₂, hg₂⟩ := arc_germ hinj hoff hbot hψ hψX h0 h1 hl₀ hl₁ hhi + (harc hhi hlo.le le_rfl (Or.inr ⟨rfl, rfl⟩)) + have hclosure : ∀ {α β : ℝ} {D : Set S}, α < β → (∀ t ∈ Ioo α β, ∀ᶠ p in 𝓝 + ((circlePt t, 0) : Circle × I), + 0 < p.2 → h p ∈ D) → ∀ t ∈ Icc α β, h (circlePt t, 0) ∈ closure D := by + intro α β D hαβ hg t ht + have hsub : Ioo α β ⊆ (fun t => h (circlePt t, 0)) ⁻¹' closure D := by + intro t ht + have hev := hg t ht + have hc : ContinuousAt (fun u : I => ((circlePt t, u) : Circle × I)) 0 := by fun_prop + have hev' := hc.eventually hev + have hF : (𝓝[>] (0 : I)).NeBot := nhdsGT_neBot_of_exists_gt ⟨1, zero_lt_one' I⟩ + have hev₂ : ∀ᶠ u in 𝓝[>] (0 : I), h (circlePt t, u) ∈ D := by + filter_upwards [hev'.filter_mono nhdsWithin_le_nhds, self_mem_nhdsWithin] with u hu hu₀ + exact hu hu₀ + have hlim : Tendsto (fun u : I => h (circlePt t, u)) (𝓝[>] (0 : I)) (𝓝 (h (circlePt t, 0))) := + ((h.continuous.comp (continuous_const.prodMk continuous_id)).tendsto 0).mono_left + nhdsWithin_le_nhds + exact mem_closure_of_tendsto hlim hev₂ + have hcl : IsClosed ((fun t => h (circlePt t, 0)) ⁻¹' closure D) := + isClosed_closure.preimage (h.continuous.comp (continuous_circlePt.prodMk continuous_const)) + have := closure_minimal hsub hcl + rw [closure_Ioo hαβ.ne] at this + exact this ht + refine ⟨y₁, hy₁, y₂, hy₂, hclosure hlo hg₁, hclosure hhi hg₂, ?_⟩ + intro y hy x hx hxX hxL + let Q := connectedComponentIn (X ∪ range ψ)ᶜ y + have hQY : Q ⊆ (X ∪ range ψ)ᶜ := connectedComponentIn_subset _ _ + let Ω := h '' {p | 0 < p.2} + have hne : (𝓝[Q] x).NeBot := mem_closure_iff_nhdsWithin_neBot.mp hx + have hev₁ : ∀ᶠ q in 𝓝[Q] x, q ∈ Ω := by + filter_upwards [mem_nhdsWithin_of_mem_nhds (hop.mem_nhds (Or.inl hxX)), self_mem_nhdsWithin] + with q hq hqQ + rcases hq with hq | ⟨p, hp, hpe⟩ + · exact ((hQY hqQ) (Or.inl hq)).elim + · refine ⟨p, ?_, hpe⟩ + by_contra hn + have hq0 : p = (p.1, 0) := Prod.ext rfl (le_antisymm (not_lt.mp hn) (unitInterval.nonneg _)) + refine hQY hqQ (Or.inl ?_) + rw [← hpe, hq0] + exact hbot p.1 + obtain ⟨p, hp⟩ : ∃ p, MapClusterPt p (𝓝[Q] x) (collarInv h) := + exists_clusterPt_of_compactSpace (map (collarInv h) (𝓝[Q] x)) + have hpx : h p = x := by + have hmap : MapClusterPt (h p) (𝓝[Q] x) (h ∘ collarInv h) := + hp.continuousAt_comp h.continuous.continuousAt + have h₁ : MapClusterPt (h p) (𝓝[Q] x) id := by + rw [mapClusterPt_iff_frequently] at hmap ⊢ + intro s hs + exact (hmap s hs).mp (hev₁.mono fun q hq hm => by + change h (collarInv h q) ∈ s at hm + rwa [(apply_collarInv hq).1] at hm) + have htend : Tendsto id (𝓝[Q] x) (𝓝 x) := tendsto_id.mono_left nhdsWithin_le_nhds + exact eq_of_nhds_neBot (ClusterPt.mono h₁ htend) + have hp0 : p.2 = 0 := by + by_contra hn + exact hoff p (unitInterval.pos_iff_ne_zero.mpr hn) (hpx ▸ hxX) + obtain ⟨t, htI, htz⟩ := exists_circlePt_time lo p.1 + have hpe : p = (circlePt t, 0) := Prod.ext htz.symm hp0 + have hcirc₀ : circlePt lo ≠ p.1 ∧ circlePt hi ≠ p.1 := by + have hpz : h (p.1, 0) = x := by + rw [← hpx] + exact congrArg h (Prod.ext rfl hp0.symm) + have hnotz : ∀ z, h (z, 0) ∈ range ψ → z ≠ p.1 := fun z hz he => hxL + (by rw [← hpz, ← he]; exact hz) + rcases hends with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨hnotz _ hz₀, hnotz _ hz₁⟩ + · exact ⟨hnotz _ hz₁, hnotz _ hz₀⟩ + have htlo : t ≠ lo := fun he => hcirc₀.1 (by rw [← he, htz]) + have hthi : t ≠ hi := fun he => hcirc₀.2 (by rw [← he, htz]) + have hcase : t ∈ Ioo lo hi ∨ t ∈ Ioo hi (lo + 1) := by + rcases lt_or_gt_of_ne hthi with h' | h' + · exact Or.inl ⟨lt_of_le_of_ne htI.1 htlo.symm, h'⟩ + · exact Or.inr ⟨h', htI.2⟩ + have hfinish : ∀ y' ∈ (X ∪ range ψ)ᶜ, (∀ᶠ p' in 𝓝 ((circlePt t, 0) : Circle × I), 0 < p'.2 → + h p' ∈ connectedComponentIn (X ∪ range ψ)ᶜ y') → + connectedComponentIn (X ∪ range ψ)ᶜ y = connectedComponentIn (X ∪ range ψ)ᶜ y' := by + intro y' _ hg + rw [← hpe] at hg + have hfr := hp.frequently hg + have hmap : ∃ᶠ q in 𝓝[Q] x, (q ∈ Q ∧ q ∈ Ω) ∧ + (0 < (collarInv h q).2 → h (collarInv h q) ∈ connectedComponentIn (X ∪ range ψ)ᶜ y') := + (hfr.and_eventually ((eventually_mem_nhdsWithin).and hev₁)).mono fun q hq => ⟨hq.2, hq.1⟩ + obtain ⟨q, ⟨hqQ, hqΩ⟩, hq⟩ := hmap.exists + obtain ⟨he, hpos⟩ := apply_collarInv hqΩ + have hqD := hq hpos + rw [he] at hqD + have e₁ := connectedComponentIn_eq hqQ + have e₂ := connectedComponentIn_eq hqD + exact e₁.trans e₂.symm + rcases hcase with h' | h' + · exact Or.inl (hfinish y₁ hy₁ (hg₁ t h')) + · exact Or.inr (hfinish y₂ hy₂ (hg₂ t h')) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Corners.lean b/LeanPool/GraphMinor/GM11/Corners.lean new file mode 100644 index 0000000000..7cec89b2b1 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Corners.lean @@ -0,0 +1,324 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Rotation +public import LeanPool.GraphMinor.GM11.Section5b +import LeanPool.GraphMinor.GM11.LeafNbhd + +/-! +# Corners at a vertex, and even valency + +The corners of `exists_rotation` lie in regions. This file records which regions, in `IsCorners` +and `exists_corners`, and deduces that "every vertex of $N(Z_1)$ has even valency" (Graph Minors XI, +proof of (5.4), page 83): `even_nHalf`, where a loop counts twice. Going around the vertex, the +colour of the corner, in `Z` or not, changes exactly at the half-edges of `N(Z)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- `next` is a cyclic order of the half-edges at `v`, and `ρ k` is the region of the corner between +`k` and `next k`. -/ +structure IsCorners (Γ : Drawing S) (γ : Set S → I → S) (v : S) + (next : halfEdges Γ γ v → halfEdges Γ γ v) (ρ : halfEdges Γ γ v → Set S) : Prop where + inj : Function.Injective next + reach : ∀ a b, Relation.ReflTransGen (fun x y => y = next x) a b + region : ∀ k, ρ k ∈ Γ.R + closure_v : ∀ k, v ∈ closure (ρ k) + all : ∀ r ∈ Γ.R, v ∈ closure r → ∃ k, r = ρ k + left : ∀ k, (next k).1.1 ⊆ closure (ρ k) + right : ∀ k, (next k).1.1 ⊆ closure (ρ (next k)) + sides : ∀ k, ∀ r ∈ Γ.R, (next k).1.1 ⊆ closure r → r = ρ k ∨ r = ρ (next k) + +/-- The sectors behind the corners at a vertex `v`: the part `P k` of the corner `k` near `v`, +inside +a closed disc `Q k` with `v` on its boundary. -/ +structure IsSectors (Γ : Drawing S) (γ : Set S → I → S) (v : S) + (next : halfEdges Γ γ v → halfEdges Γ γ v) (ρ P : halfEdges Γ γ v → Set S) (W : Set S) + (Q : halfEdges Γ γ v → Set S) (τ : halfEdges Γ γ v → I) : Prop where + corners : IsCorners Γ γ v next ρ + next_ne : ∀ k, next k ≠ k + isOpen : IsOpen W + mem : v ∈ W + sub : ∀ k, P k ⊆ ρ k + cover : W \ Γ.U ⊆ ⋃ k, P k + subQ : ∀ k, P k ⊆ Q k + disc : ∀ k, IsClosedDisc (Q k) + bd : ∀ k, v ∈ discBd (Q k) + inside : ∀ k, (W ∩ Q k) \ discBd (Q k) ⊆ P k + inter : ∀ k j, k ≠ j → Q k ∩ Q j ⊆ Γ.U + off : ∀ k (i : halfEdges Γ γ v), i ≠ k → i ≠ next k → ∀ t : I, 0 < t → spoke γ i.1 t ∈ W → + spoke γ i.1 t ∉ Q k + bdU : ∀ k, W ∩ discBd (Q k) ⊆ Γ.U + pos : ∀ k, 0 < τ k + left : ∀ k t, t ≤ τ k → spoke γ k.1 t ∈ discBd (Q k) + right : ∀ k t, t ≤ τ (next k) → spoke γ (next k).1 t ∈ discBd (Q k) + +/-- The corners at a vertex with at least two half-edges, with their sectors. -/ +theorem exists_sectors (hS : IsClosedSurface S) + (Γ : Drawing S) {γ : Set S → I → S} (hγ : EdgePar Γ γ) {v : S} + (hv : v ∈ Γ.V) (h2 : 2 ≤ Nat.card (halfEdges Γ γ v)) : + ∃ next ρ P W Q τ, IsSectors Γ γ v next ρ P W Q τ := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have : T2Space S := hS.2.1 + obtain ⟨next, P, W, Q, hW, hvW, hinj, hne, hreach, hconn, hdis, hcl, hcov, hsid, hQ, hQQ, hoff, + hbdU, τ, hτ, hτl, hτr⟩ := exists_rotation_sectors hS Γ hγ hv h2 + have hex : ∀ k, ∃ r ∈ Γ.R, P k ⊆ r := by + intro k + obtain ⟨x, hx⟩ : (P k).Nonempty := by + by_contra h + have h0 := not_nonempty_iff_eq_empty.mp h + have := hcl k + rw [h0] at this + simp at this + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem (disjoint_left.mp (hdis k) hx) + exact ⟨r, hr, subset_region hr (hconn k) (hdis k) hx hxr⟩ + choose ρ hρ hsub using hex + have hin : ∀ {r x}, r ∈ Γ.R → x ∈ r → ∀ k, x ∈ P k → r = ρ k := fun hr hx k hk => + region_eq_of_mem hr (hρ k) hx (hsub k hk) + refine ⟨next, ρ, P, W, Q, τ, ⟨⟨hinj, hreach, hρ, fun k => closure_mono (hsub k) (hcl k), ?_, ?_, + ?_, ?_⟩, hne, hW, hvW, hsub, hcov, fun k => (hQ k).2.2.1, fun k => (hQ k).1, + fun k => (hQ k).2.1, fun k => (hQ k).2.2.2, hQQ, hoff, hbdU, hτ, hτl, hτr⟩⟩ + · intro r hr hvr + obtain ⟨x, hxW, hxr⟩ := mem_closure_iff.mp hvr W hW hvW + obtain ⟨k, hk⟩ := mem_iUnion.mp (hcov ⟨hxW, region_subset hr hxr⟩) + exact ⟨k, hin hr hxr k hk⟩ + · intro k + obtain ⟨q, hq, O, -, -, -, h₁, -⟩ := hsid k + exact edge_subset_closure_of_incident hS (next k).2.1 (hρ k) + ⟨q, hq, closure_mono (hsub k) h₁⟩ + · intro k + obtain ⟨q, hq, O, -, -, -, -, h₂⟩ := hsid k + exact edge_subset_closure_of_incident hS (next k).2.1 (hρ _) + ⟨q, hq, closure_mono (hsub _) h₂⟩ + · intro k r hr hsubr + obtain ⟨q, hq, O, hO, hqO, hOs, -, -⟩ := hsid k + obtain ⟨x, hxO, hxr⟩ := mem_closure_iff.mp (hsubr hq) O hO hqO + rcases hOs ⟨hxO, region_subset hr hxr⟩ with h | h + · exact Or.inl (hin hr hxr _ h) + · exact Or.inr (hin hr hxr _ h) + +/-- The corners at a vertex with at least two half-edges. -/ +theorem exists_corners (hS : IsClosedSurface S) + (Γ : Drawing S) {γ : Set S → I → S} (hγ : EdgePar Γ γ) {v : S} + (hv : v ∈ Γ.V) (h2 : 2 ≤ Nat.card (halfEdges Γ γ v)) : + ∃ next ρ, IsCorners Γ γ v next ρ := by + obtain ⟨next, ρ, P, W, Q, τ, h⟩ := exists_sectors hS Γ hγ hv h2 + exact ⟨next, ρ, IsSectors.corners h⟩ + +/-- The half-edges of a subdrawing `N` at `x`. -/ +def nHalf (N : Drawing S) (γ : Set S → I → S) (x : S) : Set (Set S × Bool) := + {k | k.1 ∈ N.E ∧ γ k.1 (endOf k.2) = x} + +/-- Around a cycle, a colouring changes an even number of times. -/ +theorem even_card_change {α : Type*} [Finite α] (p : α → α) (hp : Function.Injective p) + (f : α → Prop) : Even (Nat.card {a // ¬ (f a ↔ f (p a))}) := by + classical + let fintypeIndices := Fintype.ofFinite α + have hbij : Function.Bijective p := Finite.injective_iff_bijective.mp hp + let e : α ≃ α := Equiv.ofBijective p hbij + let g : α → ZMod 2 := fun a => if f a then 1 else 0 + have hsum : ∑ a, (g a + g (p a)) = 0 := by + rw [Finset.sum_add_distrib, show ∑ a, g (p a) = ∑ a, g a from Equiv.sum_comp e g, ← two_mul] + rw [show (2 : ZMod 2) = 0 from rfl, zero_mul] + have hpt : ∀ a, g a + g (p a) = if ¬ (f a ↔ f (p a)) then 1 else 0 := by + intro a + have h11 : (1 : ZMod 2) + 1 = 0 := rfl + by_cases h₁ : f a <;> by_cases h₂ : f (p a) <;> simp [g, h₁, h₂, h11] + rw [Finset.sum_congr rfl fun a _ => hpt a, Finset.sum_ite, Finset.sum_const_zero, add_zero, + Finset.sum_const, nsmul_one] at hsum + rw [Nat.card_eq_fintype_card, Fintype.card_subtype, ← ZMod.natCast_eq_zero_iff_even] + exact hsum + +/-- The ends of the parametrization of an edge lie in its closure. -/ +theorem end_mem_closure {Γ : Drawing S} {γ : Set S → I → S} (hγ : EdgePar Γ γ) {e : Set S} + (he : e ∈ Γ.E) (b : Bool) : γ e (endOf b) ∈ closure e := by + have h : endOf b ∈ closure (Ioo (0 : I) 1) := by + rw [closure_Ioo (zero_ne_one' I)] + cases b + · simp [endOf] + · simp [endOf] + exact map_mem_closure (hγ.cont e he) h (t := e) fun t ht => by + have h' : γ e t ∈ γ e '' Ioo 0 1 := ⟨t, ht, rfl⟩ + rwa [hγ.image e he] at h' + +theorem end_mem_V {Γ : Drawing S} {γ : Set S → I → S} (hγ : EdgePar Γ γ) {e : Set S} + (he : e ∈ Γ.E) (b : Bool) : γ e (endOf b) ∈ Γ.V := by + cases b + · simpa [endOf] using hγ.zero e he + · simpa [endOf] using hγ.one e he + +/-- A vertex in the closure of an edge is an end of its parametrization. -/ +theorem exists_end_eq [T2Space S] {Γ : Drawing S} {γ : Set S → I → S} (hγ : EdgePar Γ γ) {e : Set S} + (he : e ∈ Γ.E) {v : S} (hv : v ∈ Γ.V) (hve : v ∈ closure e) : ∃ b, γ e (endOf b) = v := by + have hcl : closure e ⊆ range (γ e) := by + refine closure_minimal ?_ (isCompact_range (hγ.cont e he)).isClosed + intro x hx + have h' : x ∈ γ e '' Ioo 0 1 := by rw [hγ.image e he]; exact hx + obtain ⟨t, -, rfl⟩ := h' + exact ⟨t, rfl⟩ + obtain ⟨t, rfl⟩ := hcl hve + by_cases ht : t ∈ Ioo (0 : I) 1 + · have h' : γ e t ∈ γ e '' Ioo 0 1 := ⟨t, ht, rfl⟩ + rw [hγ.image e he] at h' + exact absurd hv (he.2.1 h').2 + · by_cases h0 : t = 0 + · exact ⟨false, by simp [endOf, h0]⟩ + · have h1 : t = 1 := by + by_contra h1 + exact ht ⟨unitInterval.pos_iff_ne_zero.mpr h0, lt_of_le_of_ne le_top h1⟩ + exact ⟨true, by simp [endOf, h1]⟩ + +variable [T1Space S] + +omit [T1Space S] in +/-- Near a vertex with only one half-edge, the points off the drawing are joined off the drawing. -/ +theorem exists_single_nbhd (hS : IsClosedSurface S) {Γ : Drawing S} {γ : Set S → I → S} + (hγ : EdgePar Γ γ) {v : S} (k : halfEdges Γ γ v) (hk : ∀ l : halfEdges Γ γ v, l = k) : + ∃ Z : Set S, IsOpen Z ∧ v ∈ Z ∧ ∀ x ∈ Z, x ∉ Γ.U → ∀ y ∈ Z, y ∉ Γ.U → + ∃ A : Set S, IsPreconnected A ∧ Disjoint A Γ.U ∧ x ∈ A ∧ y ∈ A ∧ A ⊆ univ := by + have : T2Space S := hS.2.1 + obtain ⟨⟨e, b⟩, he, hb⟩ := k + dsimp only at he hb hk + have hvV : v ∈ Γ.V := hb ▸ end_mem_V hγ he b + have hve : v ∈ closure e := hb ▸ end_mem_closure hγ he b + have hother : γ e (endOf (!b)) ≠ v := by + intro h + have := hk ⟨(e, !b), he, h⟩ + have h' := congrArg (fun x => x.1.2) this + simp at h' + have hleaf : ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f := by + intro f hf hfe hvf + obtain ⟨c, hc⟩ := exists_end_eq hγ hf hvV hvf + have := hk ⟨(f, c), hf, hc⟩ + exact hfe (congrArg (fun x => x.1.1) this) + have hu : γ e (endOf (!b)) ∈ closure e := end_mem_closure hγ he _ + have huV := end_mem_V hγ he (!b) + set u := γ e (endOf (!b)) with hudef + have hcase : closure e ∩ Γ.V = {u, v} ∧ IsLineWithEnds (closure e) u v := by + rcases Γ.edge_cond e he with ⟨x, y, hxy, hcap, hL⟩ | ⟨x, hcap, -⟩ + · have hu' : u ∈ ({x, y} : Set S) := hcap ▸ ⟨hu, huV⟩ + have hv' : v ∈ ({x, y} : Set S) := hcap ▸ ⟨hve, hvV⟩ + rcases hu' with rfl | rfl <;> rcases hv' with rfl | rfl + · exact absurd rfl hother + · exact ⟨hcap, hL⟩ + · exact ⟨by rw [hcap, pair_comm], IsLineWithEnds.symm hL⟩ + · exact absurd rfl hother + · have hu' : u ∈ ({x} : Set S) := hcap ▸ ⟨hu, huV⟩ + have hv' : v ∈ ({x} : Set S) := hcap ▸ ⟨hve, hvV⟩ + exact absurd ((mem_singleton_iff.mp hu').trans (mem_singleton_iff.mp hv').symm) hother + exact exists_leaf_nbhd hS Γ he hother hcase.1 hcase.2 hleaf isOpen_univ (mem_univ _) + +/-- At a vertex with only one half-edge, that edge is not in `N(Z)`: only one region is present. -/ +theorem notMem_boundary_of_single (hS : IsClosedSurface S) + {Γ : Drawing S} {γ : Set S → I → S} (hγ : EdgePar Γ γ) {v : S} + (k : halfEdges Γ γ v) (hk : ∀ l : halfEdges Γ γ v, l = k) (Z : Set (Set S)) : + k.1.1 ∉ (boundaryDrawing Γ Z).E := by + have : T2Space S := hS.2.1 + intro hN + obtain ⟨Z₀, hZ₀, hvZ, hsame⟩ := exists_single_nbhd hS hγ k hk + obtain ⟨⟨e, b⟩, he, hb⟩ := k + dsimp only at he hb hN hk + have hve : v ∈ closure e := hb ▸ end_mem_closure hγ he b + obtain ⟨⟨r₁, hr₁, -, hr₁R, hi₁⟩, r₂, ⟨hr₂R, hr₂⟩, -, -, hi₂⟩ := mem_boundaryDrawing_E.mp hN + have hc₁ := edge_subset_closure_of_incident hS he hr₁R hi₁ + have hc₂ := edge_subset_closure_of_incident hS he hr₂R hi₂ + have hvc₁ : v ∈ closure r₁ := closure_minimal hc₁ isClosed_closure hve + have hvc₂ : v ∈ closure r₂ := closure_minimal hc₂ isClosed_closure hve + obtain ⟨x, hxZ, hx⟩ := mem_closure_iff.mp hvc₁ Z₀ hZ₀ hvZ + obtain ⟨y, hyZ, hy⟩ := mem_closure_iff.mp hvc₂ Z₀ hZ₀ hvZ + obtain ⟨A, hA, hdis, hxA, hyA⟩ := hsame x hxZ (region_subset hr₁R hx) y hyZ + (region_subset hr₂R hy) + have := subset_region hr₁R hA hdis hxA hx hyA.1 + exact hr₂ (region_eq_of_mem hr₂R hr₁R hy this ▸ hr₁) + +/-- "every vertex of $N(Z_1)$ has even valency" (Graph Minors XI, proof of (5.4), page 83), for any +set `Z` of regions, where a loop counts twice. -/ +theorem even_nHalf (hS : IsClosedSurface S) + (Γ : Drawing S) {γ : Set S → I → S} (hγ : EdgePar Γ γ) {v : S} + (hv : v ∈ Γ.V) (Z : Set (Set S)) : Even (nHalf (boundaryDrawing Γ Z) γ v).ncard := by + classical + have : T2Space S := hS.2.1 + have hsubE : (boundaryDrawing Γ Z).E ⊆ Γ.E := (boundaryDrawing Γ Z |> fun _ => + (Γ.span_isSubdrawing _ _).2) + have hfin : Finite (halfEdges Γ γ v) := (finite_halfEdges Γ γ v).to_subtype + have : Fintype (halfEdges Γ γ v) := Fintype.ofFinite _ + -- The set as an image of a subset of the half-edges at `v`. + have himg : nHalf (boundaryDrawing Γ Z) γ v = + Subtype.val '' {k : halfEdges Γ γ v | k.1.1 ∈ (boundaryDrawing Γ Z).E} := by + ext k + constructor + · rintro ⟨h₁, h₂⟩ + exact ⟨⟨k, hsubE h₁, h₂⟩, h₁, rfl⟩ + · rintro ⟨l, hl, rfl⟩ + exact ⟨hl, l.2.2⟩ + rw [himg, Set.ncard_image_of_injective _ Subtype.val_injective] + by_cases h2 : 2 ≤ Nat.card (halfEdges Γ γ v) + · obtain ⟨next, ρ, hC⟩ := exists_corners hS Γ hγ hv h2 + have hbij : Function.Bijective next := Finite.injective_iff_bijective.mp hC.inj + have hiff : ∀ k, (next k).1.1 ∈ (boundaryDrawing Γ Z).E ↔ ¬ (ρ k ∈ Z ↔ ρ (next k) ∈ Z) := by + intro k + have hE := (next k).2.1 + have hinc : ∀ r ∈ Γ.R, Γ.EdgeRegionIncident (next k).1.1 r → r = ρ k ∨ r = ρ (next k) := + fun r hr hi => hC.sides k r hr (edge_subset_closure_of_incident hS hE hr hi.2.2) + have hne : ∀ l, (next k).1.1 ⊆ closure (ρ l) → Γ.EdgeRegionIncident (next k).1.1 (ρ l) := by + intro l hl + obtain ⟨p, hp⟩ := (show (next k).1.1 ∈ Γ.E from hE).1 + exact ⟨hE, hC.region l, p, hp, hl hp⟩ + constructor + · intro h + obtain ⟨⟨r₁, hr₁, hi₁⟩, r₂, ⟨hr₂R, hr₂⟩, hi₂⟩ := mem_boundaryDrawing_E.mp h + rcases hinc r₁ hi₁.2.1 hi₁ with rfl | rfl <;> rcases hinc r₂ hr₂R hi₂ with rfl | rfl + · exact absurd hr₁ hr₂ + · tauto + · tauto + · exact absurd hr₁ hr₂ + · intro h + by_cases h₁ : ρ k ∈ Z + · have h₂ : ρ (next k) ∉ Z := fun h₂ => h (iff_of_true h₁ h₂) + exact mem_boundaryDrawing_E.mpr ⟨⟨_, h₁, hne k (hC.left k)⟩, _, ⟨hC.region _, h₂⟩, + hne _ (hC.right k)⟩ + · have h₂ : ρ (next k) ∈ Z := by + by_contra h₂ + exact h (iff_of_false h₁ h₂) + exact mem_boundaryDrawing_E.mpr ⟨⟨_, h₂, hne _ (hC.right k)⟩, _, ⟨hC.region _, h₁⟩, + hne k (hC.left k)⟩ + have hcard := even_card_change next hC.inj fun k => ρ k ∈ Z + have heq : ({k : halfEdges Γ γ v | k.1.1 ∈ (boundaryDrawing Γ Z).E}).ncard = + Nat.card {a // ¬ (ρ a ∈ Z ↔ ρ (next a) ∈ Z)} := by + rw [← Nat.card_coe_set_eq] + refine Nat.card_congr (Equiv.subtypeEquiv (Equiv.ofBijective next hbij).symm ?_) + intro k + obtain ⟨j, rfl⟩ := hbij.2 k + have : (Equiv.ofBijective next hbij).symm (next j) = j := + (Equiv.ofBijective next hbij).symm_apply_apply j + rw [this] + exact hiff j + rw [heq] + exact hcard + · have hle : Nat.card (halfEdges Γ γ v) ≤ 1 := by omega + have hsub : Subsingleton (halfEdges Γ γ v) := by + rw [Nat.card_eq_fintype_card] at hle + exact Fintype.card_le_one_iff_subsingleton.mp hle + have : {k : halfEdges Γ γ v | k.1.1 ∈ (boundaryDrawing Γ Z).E} = ∅ := by + ext k + simp only [mem_ofPred_eq, mem_empty_iff_false, iff_false] + exact notMem_boundary_of_single hS hγ k (fun l => Subsingleton.elim l k) Z + rw [this] + simp + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/CurveArc.lean b/LeanPool/GraphMinor/GM11/CurveArc.lean new file mode 100644 index 0000000000..9280251d6f --- /dev/null +++ b/LeanPool/GraphMinor/GM11/CurveArc.lean @@ -0,0 +1,656 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.LocalCone +public import LeanPool.GraphMinor.GM11.PathClasses +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# An `O`-arc in a closed curve + +This file is the combinatorial heart of Graph Minors VII, (11.2), and of Graph Minors XI, (7.3). Let +`T` be a +Hausdorff space and let `Sm` be a family of small sets, closed under subsets, such that two small +sets that +meet have a union in which paths with the same ends are homotopic (`Flat`). Let `Y ⊆ T`, and suppose +that +each `O`-arc in `Y` is null-homotopic. Then each closed curve in `Y` that is a product of finitely +many small +pieces is null-homotopic (`Ch.eq_refl`). + +The proof follows the paper. First, (11.1) lets us take each piece to be a line or a point +(`IsArmTo`). A +closed curve with pieces `A₁, …, Aₙ` is treated by induction on `n`. If two pieces that are not +consecutive +meet in a point, then the curve splits there into two closed curves with fewer pieces. So we may +assume +that pieces that are not consecutive are disjoint. At each junction the paper "removes" a small +loop, and +after all of the junctions are done, the curve is an `O`-arc. We do this in order along the curve: +`exists_tri` treats all of the junctions but the last two, and `tri_close` treats these two. + +Paths are taken up to homotopy with fixed ends (`Cl`), since in this way the products of paths are +associative. `Arw A f` says that the class `f` contains a path in `A`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {T : Type u} [TopologicalSpace T] + +/-- A line or a point: `A` is a line from `a` to `b`, or `a = b` and `A` is this point. -/ +def IsArmTo (A : Set T) (a b : T) : Prop := (a = b ∧ A = {a}) ∨ IsLineWithEnds A a b + +section Arms + +variable {A B : Set T} {a b c : T} + +theorem IsArmTo.left_mem (h : IsArmTo A a b) : a ∈ A := by + rcases h with ⟨-, rfl⟩ | h + · rfl + · exact IsLineWithEnds.left_mem h + +theorem IsArmTo.right_mem (h : IsArmTo A a b) : b ∈ A := by + rcases h with ⟨rfl, rfl⟩ | h + · rfl + · exact IsLineWithEnds.right_mem h + +theorem IsArmTo.symm (h : IsArmTo A a b) : IsArmTo A b a := by + rcases h with ⟨rfl, rfl⟩ | h + · exact Or.inl ⟨rfl, rfl⟩ + · exact Or.inr (IsLineWithEnds.symm h) + +theorem isArmTo_point (a : T) : IsArmTo {a} a a := Or.inl ⟨rfl, rfl⟩ + +theorem ends_ne (h : IsLineWithEnds A a b) : a ≠ b := by + obtain ⟨f, h0, h1⟩ := h + intro he + have : f 0 = f 1 := Subtype.ext (by rw [h0, h1, he]) + exact zero_ne_one (f.injective this) + +/-- The path along a line or a point. -/ +theorem IsArmTo.exists_arw (h : IsArmTo A a b) : ∃ f : Cl a b, Arw A f := by + rcases h with ⟨rfl, rfl⟩ | h + · exact ⟨Cl.rf a, arw_refl rfl⟩ + · obtain ⟨g, g0, g1⟩ := h + have hg : Continuous fun t : I => (g t).1 := by fun_prop + exact ⟨Cl.mk ⟨⟨fun t => (g t).1, hg⟩, g0, g1⟩, _, fun u => (g u).2, rfl⟩ + +theorem IsArmTo.isSimplyConnected (h : IsArmTo A a b) : IsSimplyConnectedSet A := by + rcases h with ⟨-, rfl⟩ | ⟨f, -, -⟩ + · exact isSimplyConnected_singleton a + · exact IsLine.isSimplyConnected ⟨f⟩ + +theorem IsArmTo.flat (h : IsArmTo A a b) : Flat A := + IsSimplyConnectedSet.flat h.isSimplyConnected + +variable [T2Space T] + +/-- Two arms that meet only at a common end join to an arm. -/ +theorem IsArmTo.join (h₁ : IsArmTo A a b) (h₂ : IsArmTo B b c) (h : A ∩ B = {b}) : + IsArmTo (A ∪ B) a c := by + rcases h₁ with ⟨rfl, rfl⟩ | h₁ + · rwa [union_eq_right.mpr (singleton_subset_iff.mpr h₂.left_mem)] + rcases h₂ with ⟨rfl, rfl⟩ | h₂ + · rw [union_eq_left.mpr (singleton_subset_iff.mpr (IsLineWithEnds.right_mem h₁))] + exact Or.inr h₁ + · exact Or.inr (IsLineWithEnds.union (IsLineWithEnds.symm h₁) h₂ h) + +/-- An arc is cut in two arms at each of its points. -/ +theorem arc_cut {e : I → T} (he : IsArcMap e) (t : I) : + IsArmTo (e '' Iic t) (e 0) (e t) ∧ IsArmTo (e '' Ici t) (e t) (e 1) := by + rcases eq_or_lt_of_le (unitInterval.nonneg t) with h0 | h0 + · have ht : t = 0 := Subtype.ext h0.symm + subst ht + refine ⟨Or.inl ⟨rfl, ?_⟩, Or.inr ?_⟩ + · have : Iic (0 : I) = {0} := subset_antisymm + (fun s hs => Subtype.ext (le_antisymm hs (unitInterval.nonneg s))) + (fun s hs => by rw [mem_singleton_iff.mp hs]; exact mem_Iic.mpr le_rfl) + rw [this, image_singleton] + · have : Ici (0 : I) = univ := eq_univ_of_forall fun s => unitInterval.nonneg s + rw [this, image_univ] + exact he.isLineWithEnds + rcases eq_or_lt_of_le (unitInterval.le_one t) with h1 | h1 + · have ht : t = 1 := Subtype.ext h1 + subst ht + refine ⟨Or.inr ?_, Or.inl ⟨rfl, ?_⟩⟩ + · have : Iic (1 : I) = univ := eq_univ_of_forall fun s => unitInterval.le_one s + rw [this, image_univ] + exact he.isLineWithEnds + · have : Ici (1 : I) = {1} := subset_antisymm + (fun s hs => Subtype.ext (le_antisymm (unitInterval.le_one s) hs)) + (fun s hs => by rw [mem_singleton_iff.mp hs]; exact mem_Ici.mpr le_rfl) + rw [this, image_singleton] + have h0' : (0 : ℝ) < t := h0 + have h1' : (t : ℝ) < 1 := h1 + have a1 := isArcMap_pieceA he le_rfl h0' h1'.le + have a2 := isArcMap_pieceA he h0'.le h1' le_rfl + have e1 : extI e 0 = e 0 := extI_coe e 0 + have e2 : extI e 1 = e 1 := extI_coe e 1 + have e3 : extI e t = e t := extI_coe e t + have r1 : e '' Iic t = range (pieceA e 0 t) := by + rw [range_pieceA e le_rfl h0'.le h1'.le] + ext y + constructor + · rintro ⟨s, hs, rfl⟩ + exact ⟨s, ⟨s.2.1, hs⟩, extI_coe e s⟩ + · rintro ⟨s, hs, rfl⟩ + exact ⟨⟨s, hs.1, hs.2.trans h1'.le⟩, hs.2, (extI_of_mem e _).symm⟩ + have r2 : e '' Ici t = range (pieceA e t 1) := by + rw [range_pieceA e h0'.le h1'.le le_rfl] + ext y + constructor + · rintro ⟨s, hs, rfl⟩ + exact ⟨s, ⟨hs, s.2.2⟩, extI_coe e s⟩ + · rintro ⟨s, hs, rfl⟩ + exact ⟨⟨s, h0'.le.trans hs.1, hs.2⟩, hs.1, (extI_of_mem e _).symm⟩ + refine ⟨Or.inr ?_, Or.inr ?_⟩ + · rw [r1] + have := a1.isLineWithEnds + rwa [pieceA_zero, pieceA_one, e1, e3] at this + · rw [r2] + have := a2.isLineWithEnds + rwa [pieceA_zero, pieceA_one, e2, e3] at this + +/-- **Cutting an arm at the first point of a closed set.** -/ +theorem IsArmTo.exists_first (h : IsArmTo A a b) {C : Set T} (hC : IsClosed C) (hne : + (A ∩ C).Nonempty) : + ∃ x ∈ A ∩ C, ∃ A₁ A₂ : Set T, IsArmTo A₁ a x ∧ IsArmTo A₂ x b ∧ A₁ ∪ A₂ = A ∧ A₁ ∩ A₂ = {x} ∧ + A₁ ∩ C = {x} := by + rcases h with ⟨rfl, rfl⟩ | h + · obtain ⟨x, rfl, hx⟩ := hne + refine ⟨x, ⟨rfl, hx⟩, {x}, {x}, isArmTo_point x, isArmTo_point x, by simp, by simp, ?_⟩ + simpa using hx + obtain ⟨e, he, rfl, rfl, rfl⟩ := h.exists_arc + have hcl : IsCompact (e ⁻¹' C) := (hC.preimage he.1).isCompact + obtain ⟨t, ht, htle⟩ := hcl.exists_isLeast (by + obtain ⟨_, ⟨s, rfl⟩, hs⟩ := hne + exact ⟨s, hs⟩) + obtain ⟨h₁, h₂⟩ := arc_cut he t + refine ⟨e t, ⟨mem_range_self t, ht⟩, e '' Iic t, e '' Ici t, h₁, h₂, ?_, ?_, ?_⟩ + · rw [← image_union, Iic_union_Ici, image_univ] + · ext y + constructor + · rintro ⟨⟨s, hs, rfl⟩, ⟨s', hs', he'⟩⟩ + have h₁ : s' = s := he.2 he' + have h₂ : s = t := le_antisymm hs (h₁ ▸ hs') + rw [h₂] + rfl + · rintro rfl + exact ⟨⟨t, le_rfl, rfl⟩, ⟨t, le_rfl, rfl⟩⟩ + · ext y + constructor + · rintro ⟨⟨s, hs, rfl⟩, hsC⟩ + have h₂ : s = t := le_antisymm hs (htle hsC) + rw [h₂] + rfl + · rintro rfl + exact ⟨⟨t, le_rfl, rfl⟩, ht⟩ + +theorem IsArmTo.isClosed (h : IsArmTo A a b) : IsClosed A := by + rcases h with ⟨-, rfl⟩ | h + · exact isClosed_singleton + · exact h.isCompact.isClosed + +/-- An arm is cut in two arms at each of its points, and a path in it is cut with it. -/ +theorem IsArmTo.cut_arw (h : IsArmTo A a b) {w : T} (hw : w ∈ A) {f : Cl a b} (hf : Arw A f) : + ∃ (A₁ A₂ : Set T) (f₁ : Cl a w) (f₂ : Cl w b), IsArmTo A₁ a w ∧ IsArmTo A₂ w b ∧ A₁ ⊆ A + ∧ A₂ ⊆ A ∧ + Arw A₁ f₁ ∧ Arw A₂ f₂ ∧ f = f₁.trans f₂ := by + obtain ⟨x, ⟨-, hx⟩, A₁, A₂, h₁, h₂, hu, -, -⟩ := h.exists_first (isClosed_singleton (x + := w)) ⟨w, hw, rfl⟩ + obtain rfl : x = w := hx + obtain ⟨f₁, hf₁⟩ := h₁.exists_arw + obtain ⟨f₂, hf₂⟩ := h₂.exists_arw + have hs₁ : A₁ ⊆ A := hu ▸ subset_union_left + have hs₂ : A₂ ⊆ A := hu ▸ subset_union_right + exact ⟨A₁, A₂, f₁, f₂, h₁, h₂, hs₁, hs₂, hf₁, hf₂, h.flat.eq hf ((hf₁.mono hs₁).trans + (hf₂.mono hs₂))⟩ + +end Arms + +/-! ## Chains of small pieces -/ + +/-- `Ch Y Sm l a b f`: the class `f` is a product of paths along the arms of the list `l`, each of +them a +small subset of `Y`. -/ +inductive Ch (Y : Set T) (Sm : Set T → Prop) : List (Set T) → (a b : T) → Cl a b → Prop + | nil (a : T) : Ch Y Sm [] a a (Cl.rf a) + | cons {A : Set T} {l : List (Set T)} {a b c : T} {f : Cl a b} {g : Cl b c} : + IsArmTo A a b → A ⊆ Y → Sm A → Arw A f → Ch Y Sm l b c g → Ch Y Sm (A :: l) a c (f.trans g) + +section Chains + +variable {Y : Set T} {Sm : Set T → Prop} + +theorem Ch.append {l₁ l₂ : List (Set T)} {a b c : T} {f : Cl a b} {g : Cl b c} + (h₁ : Ch Y Sm l₁ a b f) + (h₂ : Ch Y Sm l₂ b c g) : Ch Y Sm (l₁ ++ l₂) a c (f.trans g) := by + induction h₁ with + | nil a => + rw [cl_refl_trans] + exact h₂ + | cons h₁ h₃ h₄ h₅ _ ih => + rw [cl_assoc] + exact Ch.cons h₁ h₃ h₄ h₅ (ih h₂) + +theorem Ch.of_cons {A : Set T} {l : List (Set T)} {a c : T} {h : Cl a c} (hc : Ch Y Sm + (A :: l) a c h) : + ∃ (b : T) (f : Cl a b) (g : Cl b c), IsArmTo A a b ∧ A ⊆ Y ∧ Sm A ∧ Arw A f ∧ Ch Y Sm l b c g ∧ + h = f.trans g := by + cases hc with + | cons h₁ h₂ h₃ h₄ h₅ => exact ⟨_, _, _, h₁, h₂, h₃, h₄, h₅, rfl⟩ + +theorem Ch.split : ∀ {l₁ l₂ : List (Set T)} {a c : T} {h : Cl a c}, Ch Y Sm (l₁ ++ l₂) a c h → + ∃ (b : T) (f : Cl a b) (g : Cl b c), Ch Y Sm l₁ a b f ∧ Ch Y Sm l₂ b c g ∧ h = f.trans g := by + intro l₁ + induction l₁ with + | nil => + intro l₂ a c h hc + exact ⟨a, _, h, .nil a, hc, (cl_refl_trans h).symm⟩ + | cons A l₁ ih => + intro l₂ a c h hc + obtain ⟨b, f, g, h₁, h₂, h₃, h₄, h₅, rfl⟩ := Ch.of_cons hc + obtain ⟨m, g₁, g₂, c₁, c₂, rfl⟩ := ih h₅ + exact ⟨m, f.trans g₁, g₂, .cons h₁ h₂ h₃ h₄ c₁, c₂, (cl_assoc _ _ _).symm⟩ + +theorem Ch.single {A : Set T} {a b : T} {f : Cl a b} (h₁ : IsArmTo A a b) (h₂ : A ⊆ Y) (h₃ : Sm A) + (h₄ : Arw A f) : Ch Y Sm [A] a b f := by + have := Ch.cons h₁ h₂ h₃ h₄ (.nil b) + rwa [cl_trans_refl] at this + +theorem Ch.of_single {A : Set T} {a b : T} {f : Cl a b} (h : Ch Y Sm [A] a b f) : + IsArmTo A a b ∧ A ⊆ Y ∧ Sm A ∧ Arw A f := by + obtain ⟨_, f', g, h₁, h₂, h₃, h₄, h₅, rfl⟩ := Ch.of_cons h + cases h₅ + rw [cl_trans_refl] + exact ⟨h₁, h₂, h₃, h₄⟩ + +/-- A class with `f.trans g` the identity at a junction can be dropped from a longer product. -/ +private theorem drop {a b c d : T} (p : Cl a b) (x : Cl b c) (y : Cl c b) (q : Cl b d) + (h : x.trans y = Cl.rf b) : p.trans (x.trans (y.trans q)) = p.trans q := by + rw [← cl_assoc x y q, h, cl_refl_trans] + +variable [T2Space T] + +/-- If two pieces that are not consecutive meet, then the curve splits in two closed curves with +fewer +pieces. This is (2) in the paper's proof of VII, (11.2). -/ +theorem Ch.split_of_meet (hmono : ∀ {A B : Set T}, Sm A → B ⊆ A → Sm B) {l₁ l₂ l₃ : List (Set T)} + {A B : Set T} {a : T} {c : Cl a a} + (ih : ∀ (l : List (Set T)) (x : T) (h : Cl x x), l.length < (l₁ ++ A :: (l₂ ++ B :: l₃)).length + → + Ch Y Sm l x x h → h = Cl.rf x) + (hc : Ch Y Sm (l₁ ++ A :: (l₂ ++ B :: l₃)) a a c) (h₂ : l₂ ≠ []) (h₁₃ : l₁ ≠ [] ∨ l₃ ≠ []) + (hne : (A ∩ B).Nonempty) : c = Cl.rf a := by + obtain ⟨w, hwA, hwB⟩ := hne + obtain ⟨p, g₁, r₁, c₁, r₂, rfl⟩ := Ch.split hc + obtain ⟨p', x, r₃, hA, hAY, hAs, hx, r₄, rfl⟩ := Ch.of_cons r₂ + obtain ⟨q, g₂, r₅, c₂, r₆, rfl⟩ := Ch.split r₄ + obtain ⟨q', y, g₃, hB, hBY, hBs, hy, c₃, rfl⟩ := Ch.of_cons r₆ + obtain ⟨A₁, A₂, x₁, x₂, a₁, a₂, s₁, s₂, m₁, m₂, rfl⟩ := hA.cut_arw hwA hx + obtain ⟨B₁, B₂, y₁, y₂, b₁, b₂, t₁, t₂, n₁, n₂, rfl⟩ := hB.cut_arw hwB hy + have hl₂ : 0 < l₂.length := List.length_pos_iff.mpr h₂ + have hl₁₃ : 0 < l₁.length + l₃.length := by + rcases h₁₃ with h | h + · have := List.length_pos_iff.mpr h + omega + · have := List.length_pos_iff.mpr h + omega + have hA₂ : Ch Y Sm (A₂ :: (l₂ ++ [B₁])) w w (x₂.trans (g₂.trans y₁)) := + .cons a₂ (s₂.trans hAY) (hmono hAs s₂) m₂ (c₂.append (.single b₁ (t₁.trans hBY) + (hmono hBs t₁) n₁)) + have hin : x₂.trans (g₂.trans y₁) = Cl.rf w := by + refine ih _ _ _ ?_ hA₂ + simp only [List.length_cons, List.length_append, List.length_nil] + omega + have hout : Ch Y Sm (l₁ ++ A₁ :: B₂ :: l₃) a a (g₁.trans (x₁.trans (y₂.trans g₃))) := + c₁.append (.cons a₁ (s₁.trans hAY) (hmono hAs s₁) m₁ (.cons b₂ (t₂.trans hBY) + (hmono hBs t₂) n₂ c₃)) + have hout' := ih _ _ _ (by + simp only [List.length_cons, List.length_append] + omega) hout + rw [← hout'] + have e : (x₁.trans x₂).trans (g₂.trans ((y₁.trans y₂).trans g₃)) = + x₁.trans ((x₂.trans (g₂.trans y₁)).trans (y₂.trans g₃)) := by + simp only [cl_assoc] + rw [e, hin, cl_refl_trans] + +variable (hmono : ∀ {A B : Set T}, Sm A → B ⊆ A → Sm B) + (hpair : ∀ {A B : Set T}, Sm A → Sm B → (A ∩ B).Nonempty → Flat (A ∪ B)) + +include hmono hpair in +/-- All junctions but two: the first `n - 1` pieces of a closed curve are replaced by a line, in +three parts. +`H` lies in the first piece, `R` in the last, and `M` in the pieces between them. -/ +theorem exists_tri (A : Set T) (mid : List (Set T)) : ∀ (B : Set T) (a b : T) (c : Cl a b), + Ch Y Sm (A :: (mid ++ [B])) a b c → + (∀ (l₁ : List (Set T)) (X : Set T) (l₂ : List (Set T)) (Z : Set T) (l₃ : List (Set T)), + A :: (mid ++ [B]) = l₁ ++ X :: (l₂ ++ Z :: l₃) → l₂ ≠ [] → Disjoint X Z) → + ∃ (H M R : Set T) (h g : T) (u : Cl a h) (w : Cl h g) (v : Cl g b), + IsArmTo H a h ∧ IsArmTo M h g ∧ IsArmTo R g b ∧ H ∩ M = {h} ∧ (H ∪ M) ∩ R = {g} ∧ H ⊆ A + ∧ R ⊆ B ∧ + H ⊆ Y ∧ M ⊆ Y ∧ R ⊆ Y ∧ Sm H ∧ Sm R ∧ (∀ y ∈ M, y = h ∨ ∃ Z ∈ mid, y ∈ Z) ∧ Arw H u ∧ Arw M w + ∧ + Arw R v ∧ c = u.trans (w.trans v) := by + induction mid using List.reverseRecOn with + | nil => + intro B a b c hc _ + obtain ⟨p, f, g, hA, hAY, hAs, hf, r, rfl⟩ := Ch.of_cons hc + obtain ⟨hB, hBY, hBs, hg⟩ := Ch.of_single r + obtain ⟨x, ⟨hxA, hxB⟩, A₁, A₂, a₁, a₂, hu, hi, hfirst⟩ := hA.exists_first hB.isClosed + ⟨p, hA.right_mem, hB.left_mem⟩ + have s₁ : A₁ ⊆ A := hu ▸ subset_union_left + have s₂ : A₂ ⊆ A := hu ▸ subset_union_right + obtain ⟨f₁, m₁⟩ := a₁.exists_arw + obtain ⟨f₂, m₂⟩ := a₂.exists_arw + have hff : f = f₁.trans f₂ := hA.flat.eq hf ((m₁.mono s₁).trans (m₂.mono s₂)) + obtain ⟨B₁, B₂, g₁, g₂, b₁, b₂, t₁, t₂, n₁, n₂, rfl⟩ := hB.cut_arw hxB hg + have hloop : f₂.trans g₁ = Cl.rf x := + (hpair hAs hBs ⟨p, hA.right_mem, hB.left_mem⟩).eq ((m₂.mono (s₂.trans + subset_union_left)).trans + (n₁.mono (t₁.trans subset_union_right))) (arw_refl (Or.inl hxA)) + have hxA₁ : x ∈ A₁ := a₁.right_mem + have hxB₂ : x ∈ B₂ := b₂.left_mem + refine ⟨A₁, {x}, B₂, x, x, f₁, Cl.rf x, g₂, a₁, isArmTo_point x, b₂, ?_, ?_, s₁, t₂, + s₁.trans hAY, ?_, + t₂.trans hBY, hmono hAs s₁, hmono hBs t₂, ?_, m₁, arw_refl rfl, n₂, ?_⟩ + · simpa using hxA₁ + · rw [union_eq_left.mpr (singleton_subset_iff.mpr hxA₁)] + ext y + constructor + · rintro ⟨h₁, h₂⟩ + have : y ∈ A₁ ∩ B := ⟨h₁, t₂ h₂⟩ + rwa [hfirst] at this + · rintro rfl + exact ⟨hxA₁, hxB₂⟩ + · exact singleton_subset_iff.mpr (hAY hxA) + · exact fun y hy => Or.inl hy + · rw [hff, cl_refl_trans, cl_assoc, drop f₁ f₂ g₁ g₂ hloop] + | append_singleton mid D ih => + intro X a b c hc hdis + have hsplit : A :: ((mid ++ [D]) ++ [X]) = (A :: (mid ++ [D])) ++ [X] := rfl + rw [hsplit] at hc + obtain ⟨b', c₀, f, r₁, r₂, rfl⟩ := Ch.split hc + obtain ⟨hX, hXY, hXs, hf⟩ := Ch.of_single r₂ + have hdis' : ∀ (l₁ : List (Set T)) (X' : Set T) (l₂ : List (Set T)) (Z : Set T) (l₃ : List + (Set T)), + A :: (mid ++ [D]) = l₁ ++ X' :: (l₂ ++ Z :: l₃) → l₂ ≠ [] → Disjoint X' Z := by + intro l₁ X' l₂ Z l₃ e hl + refine hdis l₁ X' l₂ Z (l₃ ++ [X]) ?_ hl + have := congrArg (· ++ [X]) e + simpa [List.append_assoc] using this + obtain ⟨H, M, R, h, g, u, w, v, aH, aM, aR, hHM, hHMR, hHA, hRD, hHY, hMY, hRY, hHs, hRs, hMid, + mu, mw, + mv, rfl⟩ := ih D a b' c₀ r₁ hdis' + have hAX : Disjoint A X := hdis [] A (mid ++ [D]) X [] (by simp) (by simp) + have hmX : ∀ Z ∈ mid, Disjoint Z X := by + intro Z hZ + obtain ⟨s, t, rfl⟩ := List.append_of_mem hZ + exact hdis (A :: s) Z (t ++ [D]) X [] (by simp) (by simp) + have hoff : ∀ y ∈ H ∪ M, y ∉ X := by + have hH : ∀ y ∈ H, y ∉ X := fun y hy => disjoint_left.mp hAX (hHA hy) + rintro y (hy | hy) + · exact hH y hy + · rcases hMid y hy with rfl | ⟨Z, hZ, hyZ⟩ + · exact hH _ aH.right_mem + · exact disjoint_left.mp (hmX Z hZ) hyZ + obtain ⟨x, ⟨hxR, hxX⟩, R₁, R₂, a₁, a₂, hu, hi, hfirst⟩ := aR.exists_first hX.isClosed + ⟨b', aR.right_mem, hX.left_mem⟩ + have s₁ : R₁ ⊆ R := hu ▸ subset_union_left + have s₂ : R₂ ⊆ R := hu ▸ subset_union_right + obtain ⟨v₁, m₁⟩ := a₁.exists_arw + obtain ⟨v₂, m₂⟩ := a₂.exists_arw + have hvv : v = v₁.trans v₂ := aR.flat.eq mv ((m₁.mono s₁).trans (m₂.mono s₂)) + obtain ⟨X₁, X₂, f₁, f₂, b₁, b₂, t₁, t₂, n₁, n₂, rfl⟩ := hX.cut_arw hxX hf + have hloop : v₂.trans f₁ = Cl.rf x := + (hpair hRs hXs ⟨b', aR.right_mem, hX.left_mem⟩).eq ((m₂.mono (s₂.trans + subset_union_left)).trans + (n₁.mono (t₁.trans subset_union_right))) (arw_refl (Or.inl hxR)) + have hgR : g ∈ R := aR.left_mem + have hgHM : g ∈ H ∪ M := Or.inr aM.right_mem + have hmeet : ∀ y ∈ H ∪ M, y ∈ R → y = g := fun y h₁ h₂ => by + have : y ∈ (H ∪ M) ∩ R := ⟨h₁, h₂⟩ + rwa [hHMR] at this + have hxX₂ : x ∈ X₂ := b₂.left_mem + have hxR₁ : x ∈ R₁ := a₁.right_mem + refine ⟨H, M ∪ R₁, X₂, h, x, u, w.trans v₁, f₂, aH, aM.join a₁ ?_, b₂, ?_, ?_, hHA, t₂, hHY, + union_subset hMY (s₁.trans hRY), t₂.trans hXY, hHs, hmono hXs t₂, ?_, mu, + (mw.mono subset_union_left).trans (m₁.mono subset_union_right), n₂, ?_⟩ + · ext y + constructor + · rintro ⟨h₁, h₂⟩ + exact hmeet y (Or.inr h₁) (s₁ h₂) + · rintro rfl + exact ⟨aM.right_mem, a₁.left_mem⟩ + · ext y + constructor + · rintro ⟨h₁, h₂ | h₂⟩ + · have : y ∈ H ∩ M := ⟨h₁, h₂⟩ + rwa [hHM] at this + · have e₁ := hmeet y (Or.inl h₁) (s₁ h₂) + have : y ∈ H ∩ M := ⟨h₁, e₁ ▸ aM.right_mem⟩ + rwa [hHM] at this + · rintro rfl + exact ⟨aH.right_mem, Or.inl aM.left_mem⟩ + · ext y + constructor + · rintro ⟨h₁ | h₁ | h₁, h₂⟩ + · exact (hoff y (Or.inl h₁) (t₂ h₂)).elim + · exact (hoff y (Or.inr h₁) (t₂ h₂)).elim + · have : y ∈ R₁ ∩ X := ⟨h₁, t₂ h₂⟩ + rwa [hfirst] at this + · rintro rfl + exact ⟨Or.inr (Or.inr hxR₁), hxX₂⟩ + · rintro y (hy | hy) + · rcases hMid y hy with h₁ | ⟨Z, hZ, hyZ⟩ + · exact Or.inl h₁ + · exact Or.inr ⟨Z, List.mem_append_left _ hZ, hyZ⟩ + · exact Or.inr ⟨D, by simp, hRD (s₁ hy)⟩ + · rw [hvv] + have e : (u.trans (w.trans (v₁.trans v₂))).trans (f₁.trans f₂) = + u.trans ((w.trans v₁).trans ((v₂.trans f₁).trans f₂)) := by + simp only [cl_assoc] + rw [e, hloop, cl_refl_trans, cl_assoc] + +include hpair in +/-- The last two junctions. The line `H ∪ M ∪ R` and the arm `Q` close up to an `O`-arc, once a +small loop +at each end of `Q` is removed. -/ +theorem tri_close {H M R Q : Set T} {a h g b : T} {u : Cl a h} {w : Cl h g} {v : Cl g b} {z : Cl b + a} + (aH : IsArmTo H a h) (aM : IsArmTo M h g) (aR : IsArmTo R g b) (aQ : IsArmTo Q b a) + (hHM : H ∩ M = {h}) + (hHMR : (H ∪ M) ∩ R = {g}) (hHY : H ⊆ Y) (hMY : M ⊆ Y) (hRY : R ⊆ Y) (hQY : Q ⊆ Y) (hHs : Sm H) + (hRs : Sm R) (hQs : Sm Q) (hQM : ∀ y ∈ M, y ∈ Q → y = h) (mu : Arw H u) (mw : Arw M w) + (mv : Arw R v) + (mz : Arw Q z) + (hO : ∀ {x y : T} {L₁ L₂ : Set T}, IsLineWithEnds L₁ x y → IsLineWithEnds L₂ x y + → L₁ ∩ L₂ ⊆ {x, y} → + L₁ ∪ L₂ ⊆ Y → ∀ f g : Cl x y, Arw L₁ f → Arw L₂ g → f = g) : + (u.trans (w.trans v)).trans z = Cl.rf a := by + -- The first point of `R` on `Q`. + obtain ⟨x, ⟨hxR, hxQ⟩, R₁, R₂, a₁, a₂, hu, hi, hfirst⟩ := aR.exists_first aQ.isClosed + ⟨b, aR.right_mem, aQ.left_mem⟩ + have s₁ : R₁ ⊆ R := hu ▸ subset_union_left + have s₂ : R₂ ⊆ R := hu ▸ subset_union_right + obtain ⟨v₁, m₁⟩ := a₁.exists_arw + obtain ⟨v₂, m₂⟩ := a₂.exists_arw + have hvv : v = v₁.trans v₂ := aR.flat.eq mv ((m₁.mono s₁).trans (m₂.mono s₂)) + obtain ⟨Q₁, Q₂, z₁, z₂, b₁, b₂, t₁, t₂, n₁, n₂, rfl⟩ := aQ.cut_arw hxQ mz + have hloop₁ : v₂.trans z₁ = Cl.rf x := + (hpair hRs hQs ⟨b, aR.right_mem, aQ.left_mem⟩).eq ((m₂.mono (s₂.trans subset_union_left)).trans + (n₁.mono (t₁.trans subset_union_right))) (arw_refl (Or.inl hxR)) + -- The last point of `H` on the rest of `Q`. + obtain ⟨y, ⟨hyH, hyQ⟩, H₂, H₁, a₃, a₄, hu', hi', hfirst'⟩ := aH.symm.exists_first b₂.isClosed + ⟨a, aH.left_mem, b₂.right_mem⟩ + have s₃ : H₁ ⊆ H := hu' ▸ subset_union_right + have s₄ : H₂ ⊆ H := hu' ▸ subset_union_left + obtain ⟨u₁, m₃⟩ := a₄.symm.exists_arw + obtain ⟨u₂, m₄⟩ := a₃.symm.exists_arw + have huu : u = u₁.trans u₂ := aH.flat.eq mu ((m₃.mono s₃).trans (m₄.mono s₄)) + obtain ⟨Q₃, Q₄, z₃, z₄, b₃, b₄, t₃, t₄, n₃, n₄, rfl⟩ := b₂.cut_arw hyQ n₂ + have hloop₂ : z₄.trans u₁ = Cl.rf y := + (hpair hQs hHs ⟨a, aQ.right_mem, aH.left_mem⟩).eq (((n₄.mono (t₄.trans + (t₂.trans subset_rfl))).mono + subset_union_left).trans (m₃.mono (s₃.trans subset_union_right))) (arw_refl (Or.inr hyH)) + -- The `O`-arc. + have hP₁ : IsArmTo (H₂ ∪ M) y g := a₃.symm.join aM (by + ext p + constructor + · rintro ⟨h₁, h₂⟩ + have : p ∈ H ∩ M := ⟨s₄ h₁, h₂⟩ + rwa [hHM] at this + · rintro rfl + exact ⟨a₃.left_mem, aM.left_mem⟩) + have hmeet : ∀ p ∈ H ∪ M, p ∈ R → p = g := fun p h₁ h₂ => by + have : p ∈ (H ∪ M) ∩ R := ⟨h₁, h₂⟩ + rwa [hHMR] at this + have hP : IsArmTo ((H₂ ∪ M) ∪ R₁) y x := hP₁.join a₁ (by + ext p + constructor + · rintro ⟨h₁, h₂⟩ + refine hmeet p ?_ (s₁ h₂) + rcases h₁ with h₁ | h₁ + · exact Or.inl (s₄ h₁) + · exact Or.inr h₁ + · rintro rfl + exact ⟨Or.inr aM.right_mem, a₁.left_mem⟩) + have hcap : ((H₂ ∪ M) ∪ R₁) ∩ Q₃ ⊆ {x, y} := by + rintro p ⟨(h₁ | h₁) | h₁, h₂⟩ + · have : p ∈ H₂ ∩ Q₂ := ⟨h₁, t₃ h₂⟩ + rw [hfirst'] at this + exact Or.inr this + · have e₁ := hQM p h₁ (t₂ (t₃ h₂)) + have : p ∈ H₂ ∩ Q₂ := ⟨e₁ ▸ a₃.left_mem, t₃ h₂⟩ + rw [hfirst'] at this + exact Or.inr this + · have : p ∈ R₁ ∩ Q := ⟨h₁, t₂ (t₃ h₂)⟩ + rw [hfirst] at this + exact Or.inl this + have hmP : Arw ((H₂ ∪ M) ∪ R₁) (u₂.trans (w.trans v₁)) := + (m₄.mono (subset_union_left.trans subset_union_left)).trans + ((mw.mono (subset_union_right.trans subset_union_left)).trans (m₁.mono subset_union_right)) + have hPY : (H₂ ∪ M) ∪ R₁ ⊆ Y := + union_subset (union_subset (s₄.trans hHY) hMY) (s₁.trans hRY) + have hmid : (u₂.trans (w.trans v₁)).trans z₃ = Cl.rf y := by + by_cases hxy : x = y + · subst hxy + have hpt : (H₂ ∪ M) ∪ R₁ = {x} := by + rcases hP with ⟨-, e⟩ | hl + · exact e + · exact (ends_ne hl rfl).elim + have hq : Q₃ = {x} := by + rcases b₃ with ⟨-, e⟩ | hl + · exact e + · exact (ends_ne hl rfl).elim + rw [hpt] at hmP + rw [hq] at n₃ + exact (isArmTo_point x).flat.eq (hmP.trans n₃) (arw_refl rfl) + · have l₁ : IsLineWithEnds ((H₂ ∪ M) ∪ R₁) y x := by + rcases hP with ⟨e, -⟩ | hl + · exact (hxy e.symm).elim + · exact hl + have l₂ : IsLineWithEnds Q₃ x y := by + rcases b₃ with ⟨e, -⟩ | hl + · exact (hxy e).elim + · exact hl + have hsw : ((H₂ ∪ M) ∪ R₁) ∩ Q₃ ⊆ {y, x} := fun p hp => (hcap hp).symm + have := hO l₁ (IsLineWithEnds.symm l₂) hsw (union_subset hPY (t₃.trans + (t₂.trans hQY))) _ _ hmP n₃.symm + rw [this] + exact cl_symm_trans z₃ + subst huu hvv + have e₁ : ((u₁.trans u₂).trans (w.trans (v₁.trans v₂))).trans (z₁.trans (z₃.trans z₄)) = + u₁.trans (((u₂.trans (w.trans v₁)).trans ((v₂.trans z₁).trans z₃)).trans z₄) := by + simp only [cl_assoc] + rw [e₁, hloop₁, cl_refl_trans, hmid, cl_refl_trans] + have e₂ : z₄ = u₁.symm := by + calc z₄ = z₄.trans (u₁.trans u₁.symm) := by rw [cl_trans_symm, cl_trans_refl] + _ = u₁.symm := by rw [← cl_assoc, hloop₂, cl_refl_trans] + rw [e₂] + exact cl_trans_symm u₁ + +include hmono hpair in +/-- **A closed chain of small pieces is null-homotopic**, if each `O`-arc in `Y` is null-homotopic. +This is +the main step of the proof of Graph Minors VII, (11.2) (page 249), in the setting of the proof of +Graph +Minors XI, (7.3). -/ +theorem Ch.eq_refl + (hO : ∀ {x y : T} {L₁ L₂ : Set T}, IsLineWithEnds L₁ x y → IsLineWithEnds L₂ x y + → L₁ ∩ L₂ ⊆ {x, y} → + L₁ ∪ L₂ ⊆ Y → ∀ f g : Cl x y, Arw L₁ f → Arw L₂ g → f = g) : + ∀ (n : ℕ) (l : List (Set T)) (a : T) (c : Cl a a), l.length = n → Ch Y Sm l a a c → c = Cl.rf a + := by + intro n + induction n using Nat.strong_induction_on with + | _ n ih => + intro l a c hn hc + have ih' : ∀ (l' : List (Set T)) (x : T) (h : Cl x x), l'.length < l.length → Ch Y Sm l' x x h → + h = Cl.rf x := fun l' x h hl hc' => ih l'.length (hn ▸ hl) l' x h rfl hc' + by_cases hbad : ∃ (l₁ : List (Set T)) (A : Set T) (l₂ : List (Set T)) (B : Set T) (l₃ : List + (Set T)), + l = l₁ ++ A :: (l₂ ++ B :: l₃) ∧ l₂ ≠ [] ∧ (l₁ ≠ [] ∨ l₃ ≠ []) ∧ (A ∩ B).Nonempty + · obtain ⟨l₁, A, l₂, B, l₃, rfl, h₂, h₁₃, hne⟩ := hbad + exact Ch.split_of_meet hmono ih' hc h₂ h₁₃ hne + push Not at hbad + have hdisj : ∀ (l₁ : List (Set T)) (A : Set T) (l₂ : List (Set T)) (B : Set T) (l₃ : List + (Set T)), + l = l₁ ++ A :: (l₂ ++ B :: l₃) → l₂ ≠ [] → (l₁ ≠ [] ∨ l₃ ≠ []) → Disjoint A B := by + intro l₁ A l₂ B l₃ e h₂ h₁₃ + have := hbad l₁ A l₂ B l₃ e h₂ h₁₃ + exact Set.disjoint_iff_inter_eq_empty.mpr this + rcases l with - | ⟨A, t⟩ + · cases hc + rfl + rcases List.eq_nil_or_concat' t with rfl | ⟨t', Q, rfl⟩ + · obtain ⟨hA, -, -, hf⟩ := Ch.of_single hc + exact hA.flat.eq hf (arw_refl hA.left_mem) + obtain ⟨b, f, g, hA, hAY, hAs, hf, r, rfl⟩ := Ch.of_cons hc + rcases List.eq_nil_or_concat' t' with rfl | ⟨mid, B, rfl⟩ + · obtain ⟨hQ, hQY, hQs, hg⟩ := Ch.of_single r + exact (hpair hAs hQs ⟨b, hA.right_mem, hQ.left_mem⟩).eq + ((hf.mono subset_union_left).trans (hg.mono subset_union_right)) (arw_refl + (Or.inl hA.left_mem)) + have hch := Ch.cons hA hAY hAs hf r + have hsplit : A :: ((mid ++ [B]) ++ [Q]) = (A :: (mid ++ [B])) ++ [Q] := rfl + rw [hsplit] at hch + obtain ⟨b', c₀, z, r₁, r₂, hz⟩ := Ch.split hch + obtain ⟨hQ, hQY, hQs, mz⟩ := Ch.of_single r₂ + have hdis' : ∀ (l₁ : List (Set T)) (X' : Set T) (l₂ : List (Set T)) (Z : Set T) (l₃ : List + (Set T)), + A :: (mid ++ [B]) = l₁ ++ X' :: (l₂ ++ Z :: l₃) → l₂ ≠ [] → Disjoint X' Z := by + intro l₁ X' l₂ Z l₃ e hl + refine hdisj l₁ X' l₂ Z (l₃ ++ [Q]) ?_ hl (Or.inr (by simp)) + have := congrArg (· ++ [Q]) e + simpa [List.append_assoc] using this + obtain ⟨H, M, R, h, g', u, w, v, aH, aM, aR, hHM, hHMR, -, -, hHY, hMY, hRY, hHs, hRs, hMid, mu, + mw, + mv, rfl⟩ := exists_tri hmono hpair A mid B a b' c₀ r₁ hdis' + rw [hz] + refine tri_close hpair aH aM aR hQ hHM hHMR hHY hMY hRY hQY hHs hRs hQs ?_ mu mw mv mz hO + intro y hy hyQ + rcases hMid y hy with h₁ | ⟨Z, hZ, hyZ⟩ + · exact h₁ + · obtain ⟨s, t, rfl⟩ := List.append_of_mem hZ + have := hdisj (A :: s) Z (t ++ [B]) Q [] (by simp) (by simp) (Or.inl (by simp)) + exact (disjoint_left.mp this hyZ hyQ).elim + +end Chains + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/CutEdges.lean b/LeanPool/GraphMinor/GM11/CutEdges.lean new file mode 100644 index 0000000000..e3937282e9 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/CutEdges.lean @@ -0,0 +1,189 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.FlatCover + +/-! +# Cutting the edges of a drawing near some vertices + +The proof of (6.4) of Graph Minors XI (pages 90–91) passes from `Γ` to `Γ \ V(A ∩ B)`. That set is +not closed, so +we remove instead a small piece of each edge near the deleted vertices. `exists_cut_edges` gives a +closed nice set `Q` +in `U(Γ)` that avoids a set `A` of vertices, and whose complement in `U(Γ)` lies in given +neighbourhoods of `A`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {Γ : Drawing S} + +omit [T2Space S] in +theorem EdgePar.end_mem {γ : Set S → I → S} (hγ : EdgePar Γ γ) {e : Set S} (he : e ∈ Γ.E) + (b : Bool) : + γ e (endOf b) ∈ Γ.V := by + cases b + · exact hγ.zero e he + · exact hγ.one e he + +/-- The part of a half-edge from the parameter `t` to the midpoint of the edge is a line. -/ +theorem isLine_spoke_end {γ : Set S → I → S} (hγ : EdgePar Γ γ) {x : Set S × Bool} + (hx : x.1 ∈ Γ.E) {τ : I} + (hτ : τ < 1) : IsLineWithEnds (spoke γ x '' Icc τ 1) (spoke γ x τ) (spoke γ x 1) := by + have hc := continuous_spoke hγ hx + let p : ℝ → S := fun u => spoke γ x (Set.projIcc 0 1 zero_le_one u) + have hp : ∀ u : I, p u.1 = spoke γ x u := fun u => by + simp only [p] + congr 1 + exact Set.projIcc_val zero_le_one u + have hsub : ∀ u ∈ Icc τ.1 1, u ∈ Icc (0 : ℝ) 1 := fun u hu => ⟨τ.2.1.trans hu.1, hu.2⟩ + have hl := isLine_of_injOn (p := p) (a := τ.1) (b := 1) (hc.comp continuous_projIcc) + (lt_of_le_of_ne τ.2.2 fun h => hτ.ne (Subtype.ext h)) (fun u hu v hv h => by + have := spoke_injective hγ hx h + have h' := congrArg Subtype.val this + rwa [Set.projIcc_of_mem zero_le_one (hsub u hu), Set.projIcc_of_mem zero_le_one + (hsub v hv)] at h') + have h1 := hp 1 + rw [hp τ] at hl + have h1' : p 1 = spoke γ x 1 := h1 + rw [h1'] at hl + have hi : p '' Icc τ.1 1 = spoke γ x '' Icc τ 1 := by + ext z + constructor + · rintro ⟨u, hu, rfl⟩ + exact ⟨⟨u, hsub u hu⟩, hu, (hp ⟨u, hsub u hu⟩).symm⟩ + · rintro ⟨u, hu, rfl⟩ + exact ⟨u.1, hu, hp u⟩ + rwa [hi] at hl + +/-- Each parameter is on one of the two halves. -/ +theorem exists_halfPar_eq (w : I) : ∃ b u, halfPar b u = w := by + rcases le_total w.1 (1 / 2) with h | h + · refine ⟨false, ⟨2 * w.1, by have := w.2.1; positivity, by linarith⟩, Subtype.ext ?_⟩ + rw [halfPar_coe] + simp + · refine ⟨true, ⟨2 * (1 - w.1), by have := w.2.2; linarith, by linarith⟩, Subtype.ext ?_⟩ + rw [halfPar_coe] + simp + +/-- Cut the edges of `Γ` near a set `A` of vertices. -/ +theorem exists_cut_edges {γ : Set S → I → S} + (hγ : EdgePar Γ γ) {A : Set S} (hA : A ⊆ Γ.V) + {D : S → Set S} (hDo : ∀ s ∈ A, IsOpen (D s)) (hD : ∀ s ∈ A, s ∈ D s) : + ∃ Q : Set S, IsClosed Q ∧ IsNice Q ∧ Q ⊆ Γ.U \ A ∧ Γ.U \ Q ⊆ ⋃ s ∈ A, D s := by + classical + -- The parameter at which the half-edge `x` is cut. + have hex : ∀ x : Set S × Bool, x.1 ∈ Γ.E → ∃ t : I, t < 1 ∧ (t = 0 ↔ spoke γ x 0 ∉ A) ∧ + ∀ u, u < t → spoke γ x u ∈ ⋃ s ∈ A, D s := by + intro x hx + by_cases hs : spoke γ x 0 ∈ A + · obtain ⟨u, hu, hu1, hle⟩ := exists_pos_le (continuous_spoke hγ hx) (hDo _ hs) (hD _ hs) + (a := ⟨1 / 2, by norm_num, by norm_num⟩) (by exact Subtype.mk_lt_mk.mpr (by norm_num)) + refine ⟨u, lt_of_le_of_lt hu1 (Subtype.mk_lt_mk.mpr (by norm_num)), + ⟨fun h => absurd h hu.ne', fun h => absurd hs h⟩, + fun v hv => mem_iUnion₂.mpr ⟨_, hs, hle v hv.le⟩⟩ + · exact ⟨0, zero_lt_one, ⟨fun _ => hs, fun _ => rfl⟩, fun u hu => absurd hu (not_lt.mpr + (unitInterval.nonneg u))⟩ + choose! t ht1 ht0 htD using hex + let L : Set S × Bool → Set S := fun x => spoke γ x '' Icc (t x) 1 + let E₀ : Finset (Set S × Bool) := (Γ.finite_edges.toFinset ×ˢ Finset.univ) + have hE₀ : ∀ x, x ∈ E₀ ↔ x.1 ∈ Γ.E := fun x => by + simp only [E₀, Finset.mem_product, Set.Finite.mem_toFinset, Finset.mem_univ, and_true] + rfl + have hmain : ∀ F : Finset (Set S × Bool), (∀ x ∈ F, x.1 ∈ Γ.E) → ∃ G : Drawing S, + G.U = (Γ.V \ A) ∪ ⋃ x ∈ F, L x ∧ + G.V = (Γ.V \ A) ∪ ⋃ x ∈ F, {spoke γ x (t x), spoke γ x 1} := by + intro F + induction F using Finset.induction_on with + | empty => + intro _ + have h : (Γ.V \ A) ∩ Γ.V = Γ.V \ A := inter_eq_left.mpr sdiff_subset + refine ⟨Γ.span (Γ.V \ A) ∅, ?_, ?_⟩ + · simp [Drawing.span_U, Drawing.spanU, Drawing.spanV] + · simp [Drawing.span_V, Drawing.spanV] + | insert x F hxF ih => + intro hall + have hx := hall x (Finset.mem_insert_self _ _) + obtain ⟨G, hU, hV⟩ := ih fun y hy => hall y (Finset.mem_insert_of_mem hy) + have hline := isLine_spoke_end hγ hx (ht1 x hx) + have hne : spoke γ x (t x) ≠ spoke γ x 1 := fun h => (ht1 x hx).ne (spoke_injective hγ hx h) + have hmeet : G.U ∩ (lineDrawing hline hne).U ⊆ G.V ∩ (lineDrawing hline hne).V := by + rintro z ⟨hzG, u, hu, rfl⟩ + have hvert : u = 0 → spoke γ x u ∈ G.V ∩ (lineDrawing hline hne).V := by + rintro rfl + have h0 : t x = 0 := le_antisymm hu.1 (unitInterval.nonneg _) + refine ⟨?_, Or.inl (by rw [h0])⟩ + rw [hV] + refine Or.inl ⟨?_, (ht0 x hx).mp h0⟩ + rw [spoke_zero] + exact hγ.end_mem hx _ + rcases eq_or_lt_of_le (unitInterval.nonneg u) with h0 | h0 + · exact hvert (Subtype.ext h0.symm) + have hue := spoke_mem_edge hγ hx h0 + rw [hU] at hzG + rcases hzG with ⟨hzV, -⟩ | hz + · exact absurd hzV (edge_notMem_V hx hue) + obtain ⟨y, hy, u', hu', e⟩ := mem_iUnion₂.mp hz + have hyE := hall y (Finset.mem_insert_of_mem hy) + rcases eq_or_lt_of_le (unitInterval.nonneg u') with h0' | h0' + · have : u' = 0 := Subtype.ext h0'.symm + rw [this, spoke_zero] at e + exact absurd (e ▸ hγ.end_mem hyE _) (edge_notMem_V hx hue) + have hxy : x ≠ y := fun h => hxF (h ▸ hy) + obtain ⟨rfl, rfl⟩ := spoke_eq_of_ne hγ hx hyE hxy h0 h0' e.symm + refine ⟨?_, Or.inr rfl⟩ + rw [hV] + exact Or.inr (mem_iUnion₂.mpr ⟨y, hy, Or.inr e.symm⟩) + refine ⟨G.glue (lineDrawing hline hne) hmeet, ?_, ?_⟩ + · change G.U ∪ L x = _ + rw [hU, Finset.set_biUnion_insert, union_assoc, union_comm (⋃ y ∈ F, L y) (L x)] + · change G.V ∪ {spoke γ x (t x), spoke γ x 1} = _ + rw [hV, Finset.set_biUnion_insert, union_assoc, union_comm (⋃ y ∈ F, {spoke γ y (t y), + spoke γ y 1})] + obtain ⟨G, hU, hV⟩ := hmain E₀ fun x hx => (hE₀ x).mp hx + have hc := G.isClosed_U + refine ⟨G.U, hc, ⟨G, isGammaNice_of_frontier (Drawing.IsSubdrawing.refl G) subset_rfl + (hc.frontier_eq.subset.trans sdiff_subset)⟩, ?_, ?_⟩ + · rw [hU] + rintro z (hz | hz) + · exact ⟨Γ.V_subset_U hz.1, hz.2⟩ + obtain ⟨y, hy, u, hu, rfl⟩ := mem_iUnion₂.mp hz + have hyE := (hE₀ y).mp hy + rcases eq_or_lt_of_le (unitInterval.nonneg u) with h0 | h0 + · have h0' : u = 0 := Subtype.ext h0.symm + subst h0' + have ht : t y = 0 := le_antisymm hu.1 (unitInterval.nonneg _) + refine ⟨Γ.V_subset_U ?_, (ht0 y hyE).mp ht⟩ + rw [spoke_zero] + exact hγ.end_mem hyE _ + · have hue := spoke_mem_edge hγ hyE h0 + exact ⟨(hyE.2.1 hue).1, fun h => edge_notMem_V hyE hue (hA h)⟩ + · rintro z ⟨hzU, hzQ⟩ + by_cases hzV : z ∈ Γ.V + · by_cases hzA : z ∈ A + · exact mem_iUnion₂.mpr ⟨z, hzA, hD z hzA⟩ + · exact (hzQ (hU ▸ Or.inl ⟨hzV, hzA⟩)).elim + obtain ⟨e, he, hze⟩ := Γ.exists_edge_of_mem hzU hzV + obtain ⟨w, hw, rfl⟩ : z ∈ γ e '' Ioo 0 1 := (hγ.image e he).symm ▸ hze + obtain ⟨b, u, hu⟩ := exists_halfPar_eq w + let x : Set S × Bool := (e, b) + by_cases hut : t x ≤ u + · refine (hzQ (hU ▸ Or.inr (mem_iUnion₂.mpr ⟨x, (hE₀ x).mpr he, u, ⟨hut, u.2.2⟩, ?_⟩))).elim + simp only [spoke, x, hu] + · have := htD x he u (not_le.mp hut) + simpa only [spoke, x, hu] using this + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Cylinder.lean b/LeanPool/GraphMinor/GM11/Cylinder.lean new file mode 100644 index 0000000000..3bb8e7f500 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Cylinder.lean @@ -0,0 +1,210 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.SquareChart +public import LeanPool.GraphMinor.GM11.Section3 + +/-! +# A cylinder made of squares + +Squares `G i : [0, 1] × [0, 1] → Σ` for `i < n`, such that the right side of each is the left side +of the +next and the right side of the last is the left side of the first, form one map on the cylinder +(`exists_cylinder`). +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The square that holds the point `x` of `[0, 1]`, of `n` squares. -/ +noncomputable def slabIndex (n : ℕ) (x : I) : ℕ := min ⌊x.1 * n⌋₊ (n - 1) + +/-- The map on `[0, 1] × [0, 1]` made of `n` squares side by side. -/ +noncomputable def stack (n : ℕ) (G : ℕ → I × I → S) (p : I × I) : S := + G (slabIndex n p.1) (clamp (p.1.1 * n - slabIndex n p.1), p.2) + +/-- The closed slab of the `i`-th square. -/ +def slab (n i : ℕ) : Set (I × I) := {p | (i : ℝ) ≤ p.1.1 * n ∧ p.1.1 * n ≤ i + 1} + +theorem isClosed_slab (n i : ℕ) : IsClosed (slab n i) := by + have h : Continuous fun p : I × I => p.1.1 * (n : ℝ) := + (continuous_subtype_val.comp continuous_fst).mul continuous_const + exact (isClosed_le continuous_const h).inter (isClosed_le h continuous_const) + +omit [TopologicalSpace S] in +theorem stack_eq {n i : ℕ} {G : ℕ → I × I → S} (hi : i < n) + (adj : ∀ i t, G i (1, t) = G (i + 1) (0, t)) {p : I × I} (hp : p ∈ slab n i) : + stack n G p = G i (clamp (p.1.1 * n - i), p.2) := by + obtain ⟨h₁, h₂⟩ := hp + have hzero : clamp 0 = 0 := by + have := clamp_coe (0 : I) + simpa using this + have hone : clamp 1 = 1 := by + have := clamp_coe (1 : I) + simpa using this + have hn : (1 : ℕ) ≤ n := by omega + rcases h₂.lt_or_eq with h₃ | h₃ + · have hf : ⌊p.1.1 * (n : ℝ)⌋₊ = i := by + rw [Nat.floor_eq_iff (mul_nonneg p.1.2.1 (Nat.cast_nonneg n))] + exact ⟨h₁, h₃⟩ + have hs : slabIndex n p.1 = i := by + simp only [slabIndex, hf] + omega + simp only [stack, hs] + · have hf : ⌊p.1.1 * (n : ℝ)⌋₊ = i + 1 := by + rw [h₃] + exact_mod_cast Nat.floor_natCast (i + 1) + have hc : clamp (p.1.1 * n - i) = 1 := by + rw [h₃, add_sub_cancel_left] + exact hone + rw [hc] + by_cases hi' : i + 1 ≤ n - 1 + · have hs : slabIndex n p.1 = i + 1 := by + simp only [slabIndex, hf] + omega + have hd : p.1.1 * n - ((i + 1 : ℕ) : ℝ) = 0 := by + rw [h₃] + push_cast + ring + simp only [stack, hs, hd, hzero] + exact (adj i p.2).symm + · have hs : slabIndex n p.1 = i := by + simp only [slabIndex, hf] + omega + have hd : p.1.1 * n - (i : ℝ) = 1 := by + rw [h₃] + ring + simp only [stack, hs, hd, hone] + +theorem continuous_stack {n : ℕ} (hn : 0 < n) {G : ℕ → I × I → S} (hG : ∀ i, Continuous (G i)) + (adj : ∀ i t, G i (1, t) = G (i + 1) (0, t)) : Continuous (stack n G) := by + let f : Fin n → Set (I × I) := fun i => slab n i + have hcov : ⋃ i, f i = univ := by + refine eq_univ_of_forall fun p => mem_iUnion.mpr ?_ + have hx₀ : 0 ≤ p.1.1 * (n : ℝ) := mul_nonneg p.1.2.1 (by positivity) + have hx₁ : p.1.1 * (n : ℝ) ≤ n := by + have : p.1.1 ≤ 1 := p.1.2.2 + have h₂ : (0 : ℝ) ≤ n := by positivity + nlinarith + by_cases hlt : ⌊p.1.1 * (n : ℝ)⌋₊ < n + · exact ⟨⟨_, hlt⟩, Nat.floor_le hx₀, (Nat.lt_floor_add_one _).le⟩ + · have hfl : (n : ℝ) ≤ p.1.1 * n := by + have := Nat.floor_le hx₀ + have h₂ : (n : ℝ) ≤ ⌊p.1.1 * (n : ℝ)⌋₊ := by exact_mod_cast not_lt.mp hlt + linarith + have hn' : ((n - 1 : ℕ) : ℝ) = n - 1 := by + rw [Nat.cast_sub hn] + simp + refine ⟨⟨n - 1, by omega⟩, ?_, ?_⟩ <;> simp only [hn'] <;> linarith + refine LocallyFinite.continuous (locallyFinite_of_finite f) hcov + (fun i => isClosed_slab n i) fun i => ?_ + have hc : Continuous fun p : I × I => G i (clamp (p.1.1 * n - i), p.2) := by + refine (hG i).comp (Continuous.prodMk (continuous_clamp.comp ?_) continuous_snd) + exact ((continuous_subtype_val.comp continuous_fst).mul continuous_const).sub continuous_const + exact hc.continuousOn.congr fun p hp => stack_eq i.2 adj hp + +/-- **A cylinder made of squares.** -/ +theorem exists_cylinder {n : ℕ} (hn : 0 < n) {G : ℕ → I × I → S} (hG : ∀ i, Continuous (G i)) + (adj : ∀ i t, G i (1, t) = G (i + 1) (0, t)) (wrap : ∀ t, G n (0, t) = G 0 (0, t)) : + ∃ h : C(Circle × I, S), ∀ i, i < n → ∀ u t : I, + h (Circle.exp (2 * Real.pi * ((i + u.1) / n)), t) = G i (u, t) := by + have hcn : (0 : ℝ) < n := by exact_mod_cast hn + let F : C(I × I, S) := ⟨stack n G, continuous_stack hn hG adj⟩ + have hclamp : ∀ {i : ℕ} {u : I} {y : ℝ}, y - i = u.1 → clamp (y - i) = u := fun h => by + rw [h, clamp_coe] + have hx : ∀ i, i < n → ∀ u : I, ∃ x : I, x.1 = (i + u.1) / n ∧ ((x, (0 : I)) : I × I) ∈ slab n i + := by + intro i hi u + have h₁ : (i : ℝ) + 1 ≤ n := by exact_mod_cast hi + have hu₀ := u.2.1 + have hu₁ := u.2.2 + have hx₀ : 0 ≤ ((i : ℝ) + u.1) / n := by positivity + have hx₁ : ((i : ℝ) + u.1) / n ≤ 1 := by + rw [div_le_one hcn] + linarith + refine ⟨⟨_, hx₀, hx₁⟩, rfl, ?_⟩ + have hm : ((i : ℝ) + u.1) / n * n = i + u.1 := by field_simp + constructor <;> simp only [hm] <;> linarith + have hslab : ∀ {x : I} {i : ℕ}, ((x, (0 : I)) : I × I) ∈ slab n i → ∀ t : I, (x, t) ∈ slab n i := + fun h _ => h + have hF : ∀ i, i < n → ∀ (u t : I) (x : I), x.1 = (i + u.1) / n → F (x, t) = G i (u, t) := by + intro i hi u t x hxe + have hm : x.1 * n - i = u.1 := by + rw [hxe] + field_simp + ring + have hmem : (x, t) ∈ slab n i := by + have hu₀ := u.2.1 + have hu₁ := u.2.2 + constructor <;> simp only <;> linarith + change stack n G (x, t) = _ + rw [stack_eq hi adj hmem] + simp only + rw [hclamp hm] + have hends : ∀ v, F (0, v) = F (1, v) := by + intro v + obtain ⟨hl, hr⟩ : (0 : I).1 = (0 + (0 : I).1) / n ∧ (1 : I).1 = (((n - 1 : ℕ) : ℝ) + + (1 : I).1) / n := by + constructor + · simp + · rw [Nat.cast_sub hn] + simp only [Icc.coe_one, Nat.cast_one, sub_add_cancel] + field_simp + have h₁ := hF 0 hn 0 v 0 (by simp) + have h₂ := hF (n - 1) (by omega) 1 v 1 hr + rw [h₁, h₂, adj (n - 1) v] + have : n - 1 + 1 = n := by omega + rw [this, wrap] + refine ⟨cylinderLift 1 F hends, ?_⟩ + intro i hi u t + obtain ⟨x, hxe, -⟩ := hx i hi u + have h₁ := cylinderLift_apply 1 F hends x t + have h₂ : arcParam 1 x = Circle.exp (2 * Real.pi * (((i : ℝ) + u.1) / n)) := by + rw [← hxe] + rw [arcParam_apply, one_mul] + rw [← h₂, h₁] + exact hF i hi u t x hxe + +/-- Each point of the circle is a point of one of the `n` arcs. -/ +theorem exists_circle_param {n : ℕ} (hn : 0 < n) (z : Circle) : + ∃ i, i < n ∧ ∃ u : I, u.1 < 1 ∧ z = Circle.exp (2 * Real.pi * ((i + u.1) / n)) := by + have hcn : (0 : ℝ) < n := by exact_mod_cast hn + obtain ⟨x, hx⟩ : ∃ x : ℝ, 0 ≤ x ∧ x < 1 ∧ z = Circle.exp (2 * Real.pi * x) := by + obtain ⟨t, ht⟩ := arcParam_surjective 1 z + have hz : z = Circle.exp (2 * Real.pi * t.1) := by + rw [← ht, arcParam_apply, one_mul] + by_cases h1 : t.1 = 1 + · refine ⟨0, le_rfl, one_pos, ?_⟩ + rw [hz, h1] + simp [Circle.exp_two_pi] + · exact ⟨t.1, t.2.1, lt_of_le_of_ne t.2.2 h1, hz⟩ + obtain ⟨h₀, h₁, hz⟩ := hx + have hy₀ : 0 ≤ x * (n : ℝ) := by positivity + have hyn : x * n < n := by nlinarith + have hfl : ⌊x * (n : ℝ)⌋₊ < n := by + rw [Nat.floor_lt hy₀] + exact hyn + have ha := Nat.floor_le hy₀ + have hb := Nat.lt_floor_add_one (x * (n : ℝ)) + refine ⟨_, hfl, ⟨x * n - ⌊x * (n : ℝ)⌋₊, by linarith, by linarith⟩, by simp only; linarith, ?_⟩ + rw [hz] + congr 2 + simp only + field_simp + ring + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Defs.lean b/LeanPool/GraphMinor/GM11/Defs.lean new file mode 100644 index 0000000000..d74cab564f --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Defs.lean @@ -0,0 +1,744 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.Circle +public import LeanPool.GraphMinor.GM10.Defs +public import Mathlib.Analysis.SpecialFunctions.Complex.Circle +public import Mathlib.Algebra.BigOperators.Finprod + +/-! +# Definitions of Graph Minors XI + +This file formalizes the definitions of N. Robertson and P. D. Seymour, +*Graph Minors. XI. Circuits on a surface*, J. Combin. Theory Ser. B 60 (1994) 72–106. Everything +is stated over the actual drawings and paintings of `GraphMinor/Surface/Defs.lean`. + +- **Section 2:** tangles are those of Graph Minors X (`GM10.IsTangle`). +- **Section 3:** the type `PaintingOrDrawing` for the paper's "painting or drawing". Subdrawings: + `Drawing.span` builds the subdrawing with given vertices and edges, and adds the ends of the + edges. Circuits and paths (`Drawing.IsCircuit`, `Drawing.IsPathBetween`). Radial drawings + (`PaintingOrDrawing.IsRadialDrawing`). Walks: concatenation, reverse, and `Γ | W`. +- **Section 4:** `Γ ∩ Δ` (`PaintingOrDrawing.inter`), respectful tangles, slopes (`IsSlope`), + capture, confined subdrawings, `ins(Γ')` (`insOf`), non-separable drawings. +- **Section 5:** weightings, `N(Z)`, small sets. +- **Section 6:** pretangles (`IsPretangle`), the derived slope, the induced pretangle, perimeters + of regions and even slopes. +- **Section 7:** nice sets, and the terms of Graph Minors VII, Section 11, that (7.3) and (7.5) + quote: arc-connected, locally arc-connected, solid, flat, planar. +- **Section 8:** `Γ`-nice sets, perimeter walks, `l(X)`, restraints, extreme and optimal restraints. +- **Section 9:** atoms (in `Surface/Defs.lean`), the distance `d`, ties. + +The paper's `θ ≥ 1` is half an integer. We write `k = 2θ`, a natural number with `2 ≤ k`, so that +"length `< 2θ`" reads `length < k`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Hypergraph + +universe u + +/-! ## Section 3: subdrawings -/ + +section Subdrawing + +variable {S : Type u} [TopologicalSpace S] + +/-- An `O`-arc minus one of its points is path connected. -/ +theorem isPathConnected_oArc_diff {F : Set S} (hF : IsOArc F) {u : S} (hu : u ∈ F) : + IsPathConnected (F \ {u}) := + hF.isPathConnected_sdiff_singleton hu + +namespace Drawing + +variable (Γ : Drawing S) + +section + + +theorem closure_subset_U {e : Set S} (he : e ∈ Γ.E) : closure e ⊆ Γ.U := + closure_minimal (he.2.1.trans sdiff_subset) Γ.isClosed_U + +/-- An edge is its closure minus the vertices: "the ends" are all that the closure adds. -/ +theorem closure_diff_V {e : Set S} (he : e ∈ Γ.E) : closure e \ Γ.V = e := by + have hsub : e ⊆ closure e \ Γ.V := fun x hx => ⟨subset_closure hx, (he.2.1 hx).2⟩ + have hU := Γ.closure_subset_U he + rcases Γ.edge_cond e he with ⟨u, v, huv, hcap, hL⟩ | ⟨u, hcap, hF⟩ + · have hEq : closure e \ {u, v} = closure e \ Γ.V := by + rw [← hcap] + ext x + simp only [mem_sdiff, mem_inter_iff, not_and] + tauto + have hconn := hL.isPathConnected_interior + rw [hEq] at hconn + exact he.2.2.2 _ (fun x hx => ⟨hU hx.1, hx.2⟩) hconn hsub + · have hEq : closure e \ {u} = closure e \ Γ.V := by + rw [← hcap] + ext x + simp only [mem_sdiff, mem_inter_iff, not_and] + tauto + have huc : u ∈ closure e := by + have : u ∈ closure e ∩ Γ.V := by rw [hcap]; exact mem_singleton u + exact this.1 + have hconn := isPathConnected_oArc_diff hF huc + rw [hEq] at hconn + exact he.2.2.2 _ (fun x hx => ⟨hU hx.1, hx.2⟩) hconn hsub + +/-- Two edges that share a point are equal. -/ +theorem edge_eq_of_mem {e f : Set S} (he : e ∈ Γ.E) (hf : f ∈ Γ.E) {x : S} (hxe : x ∈ e) + (hxf : x ∈ f) : e = f := by + have hun : IsPathConnected (e ∪ f) := he.2.2.1.union hf.2.2.1 ⟨x, hxe, hxf⟩ + have h1 := he.2.2.2 (e ∪ f) (union_subset he.2.1 hf.2.1) hun subset_union_left + have h2 := hf.2.2.2 (e ∪ f) (union_subset he.2.1 hf.2.1) hun subset_union_right + exact h1.symm.trans h2 + +/-- The vertex set of `Γ.span V' E'`: the members of `V'` that are vertices of `Γ`, and the ends of +the edges in `E'`. -/ +def spanV (V' : Set S) (E' : Set (Set S)) : Set S := + (V' ∩ Γ.V) ∪ ⋃ e ∈ E' ∩ Γ.E, closure e ∩ Γ.V + +/-- The point set of `Γ.span V' E'`. -/ +def spanU (V' : Set S) (E' : Set (Set S)) : Set S := + Γ.spanV V' E' ∪ ⋃ e ∈ E' ∩ Γ.E, closure e + +theorem spanV_subset (V' : Set S) (E' : Set (Set S)) : Γ.spanV V' E' ⊆ Γ.V := by + refine union_subset inter_subset_right ?_ + exact iUnion₂_subset fun _ _ => inter_subset_right + +theorem spanU_diff_spanV (V' : Set S) (E' : Set (Set S)) : + Γ.spanU V' E' \ Γ.spanV V' E' = ⋃₀ (E' ∩ Γ.E) := by + ext x + constructor + · rintro ⟨hx, hxV⟩ + rcases hx with hx | hx + · exact absurd hx hxV + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + refine ⟨e, he, ?_⟩ + rw [← Γ.closure_diff_V he.2] + refine ⟨hxe, fun hxv => hxV ?_⟩ + exact Or.inr (mem_iUnion₂.mpr ⟨e, he, hxe, hxv⟩) + · rintro ⟨e, he, hxe⟩ + refine ⟨Or.inr (mem_iUnion₂.mpr ⟨e, he, subset_closure hxe⟩), fun hxV => ?_⟩ + exact (he.2.2.1 hxe).2 (Γ.spanV_subset V' E' hxV) + +private theorem preconnected_subset_edge (E' : Set (Set S)) {D : Set S} + (hD : IsPreconnected D) (hDsub : D ⊆ ⋃₀ (E' ∩ Γ.E)) {e : Set S} (he : e ∈ E' ∩ Γ.E) {x : S} + (hxD : x ∈ D) (hxe : x ∈ e) : D ⊆ e := by + have hfin : (E' ∩ Γ.E).Finite := Γ.finite_edges.subset inter_subset_right + set B : Set S := ⋃ f ∈ (E' ∩ Γ.E) \ {e}, closure f with hB + have hBcl : IsClosed B := + (hfin.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure + have hAcl : IsClosed (closure e) := isClosed_closure + have hcover : D ⊆ closure e ∪ B := by + intro y hy + obtain ⟨f, hf, hyf⟩ := hDsub hy + by_cases hfe : f = e + · exact Or.inl (subset_closure (hfe ▸ hyf)) + · exact Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfe⟩, subset_closure hyf⟩) + have hdisj : ∀ y ∈ D, y ∈ closure e → y ∉ B := by + intro y hy hye hyB + obtain ⟨f, hf, hyf⟩ := mem_iUnion₂.mp hyB + obtain ⟨g, hg, hyg⟩ := hDsub hy + have hyV : y ∉ Γ.V := (hg.2.2.1 hyg).2 + have h1 : y ∈ e := by rw [← Γ.closure_diff_V he.2]; exact ⟨hye, hyV⟩ + have h2 : y ∈ f := by rw [← Γ.closure_diff_V hf.1.2]; exact ⟨hyf, hyV⟩ + exact hf.2 (Γ.edge_eq_of_mem hf.1.2 he.2 h2 h1) + have hnone : ¬ (D ∩ B).Nonempty := by + intro hne + obtain ⟨y, hy, hyA, hyB⟩ := isPreconnected_closed_iff.mp hD _ _ hAcl hBcl hcover + ⟨x, hxD, subset_closure hxe⟩ hne + exact hdisj y hy hyA hyB + intro y hy + have hyA : y ∈ closure e := (hcover hy).resolve_right fun hyB => hnone ⟨y, hy, hyB⟩ + obtain ⟨g, hg, hyg⟩ := hDsub hy + rw [← Γ.closure_diff_V he.2] + exact ⟨hyA, (hg.2.2.1 hyg).2⟩ + +theorem arcComponentsIn_span (V' : Set S) (E' : Set (Set S)) : + arcComponentsIn (Γ.spanU V' E' \ Γ.spanV V' E') = E' ∩ Γ.E := by + rw [Γ.spanU_diff_spanV] + ext C + constructor + · rintro ⟨⟨x, hx⟩, hsub, hconn, hmax⟩ + obtain ⟨e, he, hxe⟩ := hsub hx + have hCe : C ⊆ e := Γ.preconnected_subset_edge E' hconn.isConnected.isPreconnected hsub he + hx hxe + have : e = C := hmax e (subset_sUnion_of_mem he) he.2.2.2.1 hCe + exact this ▸ he + · intro he + refine ⟨he.2.1, subset_sUnion_of_mem he, he.2.2.2.1, fun D hD hconn heD => ?_⟩ + obtain ⟨x, hx⟩ := he.2.1 + exact (Γ.preconnected_subset_edge E' hconn.isConnected.isPreconnected hD he (heD hx) + hx).antisymm heD + +end + +variable [T1Space S] + +/-- `Γ.span V' E'` is the subdrawing of `Γ` formed by the vertices in `V'`, the edges in `E'`, and +the ends of those edges. Members of `V'` that are not vertices of `Γ`, and members of `E'` that are +not edges of `Γ`, are ignored. Every subdrawing of `Γ` has this form (`Graph Minors XI`, Section 3, +page 74: "$\Gamma'$ is a *subdrawing* of a drawing $\Gamma$ if $V(\Gamma') \subseteq V(\Gamma)$ and +$E(\Gamma') \subseteq E(\Gamma)$"). -/ +def span (V' : Set S) (E' : Set (Set S)) : Drawing S where + U := Γ.spanU V' E' + V := Γ.spanV V' E' + V_subset_U := subset_union_left + isClosed_U := by + have hfin : (E' ∩ Γ.E).Finite := Γ.finite_edges.subset inter_subset_right + refine IsClosed.union ?_ (hfin.isClosed_biUnion fun _ _ => isClosed_closure) + exact ((Γ.finite_V.subset (Γ.spanV_subset V' E')).isClosed) + finite_V := Γ.finite_V.subset (Γ.spanV_subset V' E') + finite_edges := by + rw [Γ.arcComponentsIn_span] + exact Γ.finite_edges.subset inter_subset_right + edge_cond := by + intro e he + rw [Γ.arcComponentsIn_span] at he + have hcap : closure e ∩ Γ.spanV V' E' = closure e ∩ Γ.V := by + apply subset_antisymm (inter_subset_inter_right _ (Γ.spanV_subset V' E')) + rintro x ⟨hxe, hxV⟩ + exact ⟨hxe, Or.inr (mem_iUnion₂.mpr ⟨e, he, hxe, hxV⟩)⟩ + rw [hcap] + exact Γ.edge_cond e he.2 + +theorem span_V (V' : Set S) (E' : Set (Set S)) : (Γ.span V' E').V = Γ.spanV V' E' := rfl + +theorem span_U (V' : Set S) (E' : Set (Set S)) : (Γ.span V' E').U = Γ.spanU V' E' := rfl + +theorem span_E (V' : Set S) (E' : Set (Set S)) : (Γ.span V' E').E = E' ∩ Γ.E := + Γ.arcComponentsIn_span V' E' + +/-- The subdrawing formed by the vertices and edges of `Γ` included in `T`. This is the paper's +`Γ ∩ T` when `T` is a union of atoms of `Γ` (Graph Minors XI, Section 8, page 96: `Γ ∩ bd(X)`). -/ +def interSet (T : Set S) : Drawing S := + Γ.span (Γ.V ∩ T) {e | e ∈ Γ.E ∧ e ⊆ T} + +/-- Restricting to a closed set keeps exactly the vertices in that set. -/ +theorem interSet_V_of_isClosed {T : Set S} (hT : IsClosed T) : + (Γ.interSet T).V = Γ.V ∩ T := by + rw [Drawing.interSet, Drawing.span_V, Drawing.spanV] + refine Subset.antisymm (union_subset inter_subset_left ?_) + (fun _ hx => Or.inl ⟨hx, hx.1⟩) + refine iUnion₂_subset fun e he _ hx => ⟨hx.2, ?_⟩ + exact hT.closure_subset_iff.mpr he.1.2 hx.1 + +/-- Restricting to a set keeps exactly the edges contained in the set. -/ +theorem interSet_E (T : Set S) : (Γ.interSet T).E = {e ∈ Γ.E | e ⊆ T} := by + rw [Drawing.interSet, Drawing.span_E] + ext e + exact ⟨fun h => h.1, fun h => ⟨h, h.1⟩⟩ + +/-- `Γ \ e`, the subdrawing obtained by deleting the edge `e` +(Graph Minors XI, Section 4, proof of (4.4), page 80). -/ +def deleteEdge (e : Set S) : Drawing S := + Γ.span Γ.V (Γ.E \ {e}) + +/-- `Γ₁ ∪ Γ₂` for subdrawings `Γ₁, Γ₂` of `Γ` (Graph Minors XI, Section 3, page 74). -/ +def sup (Γ₁ Γ₂ : Drawing S) : Drawing S := + Γ.span (Γ₁.V ∪ Γ₂.V) (Γ₁.E ∪ Γ₂.E) + +/-- `Γ` is connected: it has a vertex, and any two vertices are joined by a walk. -/ +def IsConnected : Prop := + Γ.V.Nonempty ∧ ∀ u ∈ Γ.V, ∀ v ∈ Γ.V, Nonempty (GraphWalk Γ.toGraph u v) + +/-- The *length* of a path or circuit is the number of edges in it +(Graph Minors XI, Section 4, pages 78–79). -/ +noncomputable def length : ℕ := Γ.E.ncard + +/-- `Γ` is a *circuit*: its vertices and edges are those of a simple-closed walk of positive length +(Graph Minors XI, Section 3, page 77, and Section 4, page 78: paths and circuits have no +"repeated" vertices). A loop with its end is a circuit of length one. -/ +def IsCircuit : Prop := + ∃ (u : S) (W : GraphWalk Γ.toGraph u u), W.IsSimpleClosed ∧ 0 < W.length ∧ + Γ.V = {x | x ∈ W.support} ∧ Γ.E = {e | e ∈ W.edges} + +/-- `Γ` is a *path* between `a` and `b`: its vertices and edges are those of a simple walk from `a` +to `b`. -/ +def IsPathBetween (a b : S) : Prop := + ∃ W : GraphWalk Γ.toGraph a b, W.IsSimple ∧ + Γ.V = {x | x ∈ W.support} ∧ Γ.E = {e | e ∈ W.edges} + +/-- `Γ` is *non-separable* if "it is connected and there is no separation $(A, B)$ of order $1$ with +$E(A), E(B) \ne +\emptyset$" (Graph Minors XI, Section 4, page 79). -/ +def IsNonSeparable : Prop := + Γ.IsConnected ∧ ∀ A B : Hypergraph S (Set S), Γ.toHypergraph.IsSeparation A B → + separationOrder A B = 1 → A.edgeSet.Nonempty → B.edgeSet.Nonempty → False + +/-- `e` is a *loop* of `Γ`: an edge with exactly one end. -/ +def IsLoop (e : Set S) : Prop := + e ∈ Γ.E ∧ ∃ u, closure e ∩ Γ.V = {u} + +end Drawing + + +end Subdrawing + +namespace GraphWalk + +variable {α : Type u} {β : Type*} {G : Graph α β} + +/-- `W + W'`, the concatenation of walks (Graph Minors XI, Section 3, page 77). -/ +def append {u v w : α} : GraphWalk G u v → GraphWalk G v w → GraphWalk G u w + | .nil _, W' => W' + | .cons h r, W' => .cons h (r.append W') + +/-- `W⁻¹`, the reverse of a walk (Graph Minors XI, Section 3, page 77). -/ +def reverse {u v : α} : GraphWalk G u v → GraphWalk G v u + | .nil h => .nil h + | .cons h r => r.reverse.append (.cons h.symm (.nil h.left_mem)) + +end GraphWalk + +end GraphMinor.Surface + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface Hypergraph + +universe u + +/-! ## Section 2 and the start of Section 6: pretangles -/ + +/-- A *pretangle* of order `θ ≥ 1` in a hypergraph `G` (Graph Minors XI, Section 6, page 87): +"a set $\mathscr{T}$ of separations of $G$, all of order $< \theta$, satisfying the first and +second tangle axioms". -/ +structure IsPretangle {α β : Type*} (G : Hypergraph α β) (θ : ℕ) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) : Prop where + /-- The order satisfies `θ ≥ 1`. -/ + one_le : 1 ≤ θ + /-- Every member of `𝒯` is a separation of `G`. -/ + isSeparation : ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ 𝒯 → G.IsSeparation A B + /-- Every member of `𝒯` has order `< θ`. -/ + order_lt : ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ 𝒯 → separationOrder A B < θ + /-- The first tangle axiom. -/ + axiom1 : GM10.TangleAxiom1 G θ 𝒯 + /-- The second tangle axiom. -/ + axiom2 : GM10.TangleAxiom2 G 𝒯 + +/-- Pre-radial drawing conditions for a point set, its vertices, and its regions. -/ +abbrev IsPreRadialOn {S : Type u} [TopologicalSpace S] (U V : Set S) (R : Set (Set S)) + (G : Drawing S) : Prop := + U ∩ G.U = V ∧ + V ⊆ G.V ∧ + (∀ r ∈ R, ∃! w, w ∈ r ∧ w ∈ G.V) ∧ + (∀ w ∈ G.V \ V, ∃ r ∈ R, w ∈ r) ∧ + (∀ e ∈ G.E, ∃ v ∈ V, ∃ w ∈ G.V \ V, closure e ∩ G.V = {v, w}) ∧ + (∀ e ∈ G.E, ∀ f ∈ G.E, e ≠ f → ∀ v ∈ V, ∀ r ∈ R, ∀ w ∈ r ∩ G.V, + closure e ∩ G.V = {v, w} → closure f ∩ G.V = {v, w} → + ¬ ∃ Δ : Set S, IsClosedDisc Δ ∧ Δ ⊆ r ∪ {v} ∧ subBd Δ = closure e ∪ closure f) + +section Main + +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +/-! ## Section 3: paintings or drawings -/ + +/-- The paper's "painting or drawing" (Graph Minors XI, Sections 3–6). A drawing is not a painting +in our definitions (the closure of an edge of a drawing is a line, not a closed disc), so each +statement about "a painting or drawing" is a statement about this type. -/ +inductive PaintingOrDrawing (S : Type u) [TopologicalSpace S] where + /-- A painting. -/ + | painting (Γ : Painting S) + /-- A drawing. -/ + | drawing (Γ : Drawing S) + +namespace PaintingOrDrawing + +/-- `U(Γ)`. -/ +def U : PaintingOrDrawing S → Set S + | painting Γ => Γ.U + | drawing Γ => Γ.U + +/-- `V(Γ)`. -/ +def V : PaintingOrDrawing S → Set S + | painting Γ => Γ.V + | drawing Γ => Γ.V + +/-- `E(Γ)`. -/ +def E : PaintingOrDrawing S → Set (Set S) + | painting Γ => Γ.E + | drawing Γ => Γ.E + +/-- `R(Γ)`, the components of `Σ − U(Γ)`. -/ +noncomputable def R : PaintingOrDrawing S → Set (Set S) + | painting Γ => Γ.R + | drawing Γ => Γ.R + +/-- The hypergraph defined by `V(Γ)`, `E(Γ)` and their incidence relation. -/ +def toHypergraph : PaintingOrDrawing S → Hypergraph S (Set S) + | painting Γ => Γ.toHypergraph + | drawing Γ => Γ.toHypergraph + +/-- `Γ` is *2-cell* (Graph Minors XI, Section 3, page 75): "$\Sigma$ is connected and every region +is an open disc". -/ +def IsTwoCell (Γ : PaintingOrDrawing S) : Prop := + ConnectedSpace S ∧ ∀ r ∈ Γ.R, IsOpenDisc r + +/-- `Z ⊆ Σ` is *`Γ`-normal* (Graph Minors XI, Section 4, page 78): `Z ∩ U(Γ) ⊆ V(Γ)`. -/ +def IsNormal (Γ : PaintingOrDrawing S) (Z : Set S) : Prop := + Z ∩ Γ.U ⊆ Γ.V + +/-- `Γ` is *`θ`-representative* (Graph Minors XI, Section 4, page 78): `Σ` is connected and every +`Γ`-normal `O`-arc `F` with `|F ∩ V(Γ)| < θ` is null-homotopic. -/ +def IsRepresentative (Γ : PaintingOrDrawing S) (θ : ℕ) : Prop := + ConnectedSpace S ∧ + ∀ F : Set S, IsOArc F → Γ.IsNormal F → (F ∩ Γ.V).ncard < θ → IsNullHomotopicOArc F + +omit [T1Space S] in +@[simp] theorem toHypergraph_vertexSet (Γ : PaintingOrDrawing S) : + Γ.toHypergraph.vertexSet = Γ.V := by + cases Γ <;> rfl + +omit [T1Space S] in +@[simp] theorem toHypergraph_edgeSet (Γ : PaintingOrDrawing S) : + Γ.toHypergraph.edgeSet = Γ.E := by + cases Γ <;> rfl + +/-- `Γ ∩ Δ` as a hypergraph (Graph Minors XI, Section 4, page 78): for closed `Δ` with `bd(Δ)` +`Γ`-normal, "$(U(\Gamma) \cap \Delta, V(\Gamma) \cap \Delta)$ is a painting or drawing +(respectively) which we denote by $\Gamma \cap \Delta$". Its +vertices are those of `Γ` in `Δ`, and its edges are those of `Γ` included in `Δ`. -/ +def inter (Γ : PaintingOrDrawing S) (Δ : Set S) : Hypergraph S (Set S) where + vertexSet := Γ.V ∩ Δ + edgeSet := {e | e ∈ Γ.E ∧ e ⊆ Δ} + Inc e v := Γ.toHypergraph.Inc e v ∧ e ⊆ Δ ∧ v ∈ Δ + vertex_mem_of_inc _ _ h := + ⟨Γ.toHypergraph_vertexSet ▸ Γ.toHypergraph.vertex_mem_of_inc h.1, h.2.2⟩ + edge_mem_of_inc _ _ h := ⟨Γ.toHypergraph_edgeSet ▸ Γ.toHypergraph.edge_mem_of_inc h.1, h.2.1⟩ + vertexSet_finite := (Γ.toHypergraph_vertexSet ▸ Γ.toHypergraph.vertexSet_finite).subset + inter_subset_left + edgeSet_finite := (Γ.toHypergraph_edgeSet ▸ Γ.toHypergraph.edgeSet_finite).subset fun _ h => h.1 + +/-- The set `Γ ∩ closure (Σ − Δ)` of the pair `(Γ ∩ Δ, Γ ∩ closure (Σ − Δ))`. -/ +def interOutside (Γ : PaintingOrDrawing S) (Δ : Set S) : Hypergraph S (Set S) := + Γ.inter (closure (univ \ Δ)) + +/-- A set `𝒯` of separations of `Γ` is *respectful* of order `θ` (Graph Minors XI, Section 4, +page 78): "$\Sigma$ is connected and for every $\Gamma$-normal $O$-arc $F$ in $\Sigma$ with +$|F \cap V(\Gamma)| < \theta$, there is a closed disc $\Delta \subseteq \Sigma$ with +$bd(\Delta) = F$ such that +$$(\Gamma \cap \Delta, \Gamma \cap \overline{\Sigma - \Delta}) \in \mathscr{T}.$$". -/ +def IsRespectful (Γ : PaintingOrDrawing S) (θ : ℕ) + (𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) : Prop := + ConnectedSpace S ∧ + ∀ F : Set S, IsOArc F → Γ.IsNormal F → (F ∩ Γ.V).ncard < θ → + ∃ Δ : Set S, IsClosedDisc Δ ∧ subBd Δ = F ∧ (Γ.inter Δ, Γ.interOutside Δ) ∈ 𝒯 + +/-- Conditions (i)–(iv) of a radial drawing `Γ'` of `Γ` (Graph Minors XI, Section 3, page 75): +(i) `U(Γ) ∩ U(Γ') = V(Γ) ⊆ V(Γ')`; +(ii) each region `r` of `Γ` contains a unique vertex `v_r` of `Γ'`; +(iii) `Γ'` is bipartite, and `(V(Γ), {v_r})` is a bipartition of `Γ'`; +(iv) if `e, f` are edges of `Γ'` with the same ends `v, v_r`, where `v ∈ V(Γ)` and `r ∈ R(Γ)`, then +`closure e ∪ closure f` does not bound a closed disc in `r ∪ {v}`. -/ +def IsPreRadialDrawing (Γ : PaintingOrDrawing S) (Γ' : Drawing S) : Prop := + IsPreRadialOn Γ.U Γ.V Γ.R Γ' + +/-- `Γ'` is a *radial drawing* of the 2-cell painting or drawing `Γ` (Graph Minors XI, Section 3, +page 75): it satisfies (i)–(iv) of `IsPreRadialDrawing`, and "(v) $\Gamma'$ is maximal subject to +(i), ..., (iv)". -/ +def IsRadialDrawing (Γ : PaintingOrDrawing S) (Γ' : Drawing S) : Prop := + Γ.IsTwoCell ∧ Γ.IsPreRadialDrawing Γ' ∧ + ∀ Γ'' : Drawing S, Γ.IsPreRadialDrawing Γ'' → Γ'.IsSubdrawing Γ'' → Γ''.IsSubdrawing Γ' + +/-- For a subhypergraph `A` of `Γ`, the point set `U(A)`: the vertices and the edges of `A` +(Graph Minors XI, (6.4), page 90). -/ +def underlying (A : Hypergraph S (Set S)) : Set S := + A.vertexSet ∪ ⋃₀ A.edgeSet + +/-- `Z(A)`, "the set of regions of $\Gamma'$ which include an edge of $A$" +(Graph Minors XI, (6.1), page 87). -/ +def regionsIncludingEdge (Γ' : Drawing S) (A : Hypergraph S (Set S)) : Set (Set S) := + {r | r ∈ Γ'.R ∧ ∃ e ∈ A.edgeSet, e ⊆ r} + +end PaintingOrDrawing + +/-! ## Section 3: walks -/ + +/-- `Γ | W`, "the subdrawing of $\Gamma$ with vertex set $\{v_0, v_1, \dots, v_t\}$ and edge set +$\{e_1, e_2, \dots, e_t\}$" +(Graph Minors XI, Section 3, page 77). `U(W)` is `(walkDrawing Γ W).U`. -/ +def walkDrawing (Γ : Drawing S) {u v : S} (W : GraphWalk Γ.toGraph u v) : Drawing S := + Γ.span {x | x ∈ W.support} {e | e ∈ W.edges} + +/-! ## Section 4: slopes -/ + +/-- `ins` is a *slope* in `Γ` of order `k / 2` (Graph Minors XI, Section 4, page 78). "A *slope* in +$\Gamma$ of order $\theta$ is a function $\text{ins}$ which assigns to every +circuit $C$ of $\Gamma$ of length $< 2\theta$ a closed disc $\text{ins}(C) \subseteq +\Sigma$, bounded by $U(C)$, such that (i) if $C_1, C_2$ are circuits of $\Gamma$, both of +length $< 2\theta$, and $U(C_1) \subseteq \text{ins}(C_2)$, then $\text{ins}(C_1) \subseteq +\text{ins}(C_2)$ (ii) if $P_0, P_1, P_2$ are three paths of $\Gamma$ of length $> 0$, with +the same ends, mutually internally disjoint, and the circuits $P_1 \cup P_2$, $P_2 \cup +P_0$, $P_0 \cup P_1$ all have length $< 2\theta$, then one of $$\text{ins}(P_1 \cup P_2), +\quad \text{ins}(P_2 \cup P_0), \quad \text{ins}(P_0 \cup P_1)$$ includes the other two." +Here `k = 2θ`. The function `ins` is total; only its values on circuits of length `< k` matter. -/ +structure IsSlope (Γ : Drawing S) (k : ℕ) (ins : Drawing S → Set S) : Prop where + /-- `θ ≥ 1`. -/ + two_le : 2 ≤ k + /-- `ins(C)` is a closed disc. -/ + isClosedDisc : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ → C.length < k → + IsClosedDisc (ins C) + /-- `ins(C)` is bounded by `U(C)`. -/ + subBd_eq : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ → C.length < k → + subBd (ins C) = C.U + /-- The first slope axiom. -/ + monotone : ∀ C₁ C₂ : Drawing S, C₁.IsCircuit → C₁.IsSubdrawing Γ → C₁.length < k → + C₂.IsCircuit → C₂.IsSubdrawing Γ → C₂.length < k → C₁.U ⊆ ins C₂ → ins C₁ ⊆ ins C₂ + /-- The second slope axiom. -/ + three_paths : ∀ (P₀ P₁ P₂ : Drawing S) (a b : S), + P₀.IsPathBetween a b → P₁.IsPathBetween a b → P₂.IsPathBetween a b → + P₀.IsSubdrawing Γ → P₁.IsSubdrawing Γ → P₂.IsSubdrawing Γ → + 0 < P₀.length → 0 < P₁.length → 0 < P₂.length → + P₀.V ∩ P₁.V = {a, b} → P₁.V ∩ P₂.V = {a, b} → P₂.V ∩ P₀.V = {a, b} → + Disjoint P₀.E P₁.E → Disjoint P₁.E P₂.E → Disjoint P₂.E P₀.E → + (Γ.sup P₁ P₂).length < k → (Γ.sup P₂ P₀).length < k → (Γ.sup P₀ P₁).length < k → + (ins (Γ.sup P₂ P₀) ⊆ ins (Γ.sup P₁ P₂) ∧ ins (Γ.sup P₀ P₁) ⊆ ins (Γ.sup P₁ P₂)) ∨ + (ins (Γ.sup P₁ P₂) ⊆ ins (Γ.sup P₂ P₀) ∧ ins (Γ.sup P₀ P₁) ⊆ ins (Γ.sup P₂ P₀)) ∨ + (ins (Γ.sup P₁ P₂) ⊆ ins (Γ.sup P₀ P₁) ∧ ins (Γ.sup P₂ P₀) ⊆ ins (Γ.sup P₀ P₁)) + +/-- A subdrawing `Γ'` *captures* `X ⊆ Σ` (Graph Minors XI, Section 4, page 79): "there is a circuit +$C$ of $\Gamma'$ of length $< 2\theta$ with $X \subseteq \text{ins}(C)$". -/ +def Captures (ins : Drawing S → Set S) (k : ℕ) (Γ' : Drawing S) (X : Set S) : Prop := + ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing Γ' ∧ C.length < k ∧ X ⊆ ins C + +/-- A subdrawing `Γ'` is *confined* (Graph Minors XI, Section 4, page 79): "every circuit of `Γ'` +has length `< 2θ`". -/ +def IsConfined (k : ℕ) (Γ' : Drawing S) : Prop := + ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < k + +/-- `ins(Γ')` for a confined `Γ'` (Graph Minors XI, Section 4, page 79): "the union of $U(\Gamma')$ +and $\text{ins}(C)$ for all circuits $C$ of $\Gamma'$". -/ +def insOf (ins : Drawing S → Set S) (Γ' : Drawing S) : Set S := + Γ'.U ∪ ⋃ C ∈ {C : Drawing S | C.IsCircuit ∧ C.IsSubdrawing Γ'}, ins C + +/-- `ins(W)` for a closed walk `W` with `Γ | W` confined (Graph Minors XI, Section 8, page 96). -/ +def insWalk (ins : Drawing S → Set S) (Γ : Drawing S) {u : S} (W : GraphWalk Γ.toGraph u u) : + Set S := + insOf ins (walkDrawing Γ W) + +/-! ## Section 5: small sets -/ + +/-- `(Ω, ω)` is a *weighting* (Graph Minors XI, Section 5, page 81): "$\Omega \subseteq V(\Gamma)$, +$\omega \ge 1$ is an integer and $|\Omega \cap V(C)| \ge +\omega$ for every circuit $C$ of $\Gamma$ of length $\ge 2\theta$". -/ +structure IsWeighting (Γ : Drawing S) (k : ℕ) (Ω : Set S) (ω : ℕ) : Prop where + /-- `Ω ⊆ V(Γ)`. -/ + subset : Ω ⊆ Γ.V + /-- `ω ≥ 1`. -/ + one_le : 1 ≤ ω + /-- Every long circuit has weight at least `ω`. -/ + le_ncard : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ → k ≤ C.length → + ω ≤ (Ω ∩ C.V).ncard + +/-- `N(Z)` for `Z ⊆ R(Γ)` (Graph Minors XI, Section 5, page 81): "the subdrawing of $\Gamma$ formed +by those vertices and edges of $\Gamma$ incident both with +a member of $Z$ and with a member of $R(\Gamma) - Z$". -/ +def boundaryDrawing (Γ : Drawing S) (Z : Set (Set S)) : Drawing S := + Γ.span {v | (∃ r ∈ Z, Γ.VertexIncident v r) ∧ ∃ r ∈ Γ.R \ Z, Γ.VertexIncident v r} + {e | (∃ r ∈ Z, Γ.EdgeRegionIncident e r) ∧ ∃ r ∈ Γ.R \ Z, Γ.EdgeRegionIncident e r} + +/-- `Z ⊆ R(Γ)` is *small* with respect to `(Ω, ω)` (Graph Minors XI, Section 5, page 81): +"$|\Omega \cap V(N(Z))| < \omega$, and $N(Z)$ captures $r$ for each $r \in Z$". -/ +def IsSmall (Γ : Drawing S) (ins : Drawing S → Set S) (k : ℕ) (Ω : Set S) (ω : ℕ) + (Z : Set (Set S)) : Prop := + (Ω ∩ (boundaryDrawing Γ Z).V).ncard < ω ∧ ∀ r ∈ Z, Captures ins k (boundaryDrawing Γ Z) r + +/-- `Z ⊆ R(Γ)` is *little* (Graph Minors XI, Section 5, page 86): "$N(Z)$ is confined, and $N(Z)$ +captures each member of $Z$". -/ +def IsLittle (Γ : Drawing S) (ins : Drawing S → Set S) (k : ℕ) (Z : Set (Set S)) : Prop := + IsConfined k (boundaryDrawing Γ Z) ∧ ∀ r ∈ Z, Captures ins k (boundaryDrawing Γ Z) r + +/-! ## Section 6: tangles and slopes -/ + +/-- `ins` is the slope in `Γ'` *derived* from `𝒯` (Graph Minors XI, Section 6, page 87): for each +circuit `C` of `Γ'` of length `< 2θ`, `ins(C)` is a closed disc with boundary `U(C)` and +`(Γ ∩ ins(C), Γ ∩ closure (Σ − ins(C))) ∈ 𝒯`. -/ +def IsDerivedSlope (Γ : PaintingOrDrawing S) (Γ' : Drawing S) (θ : ℕ) + (𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (ins : Drawing S → Set S) : Prop := + ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < 2 * θ → + IsClosedDisc (ins C) ∧ subBd (ins C) = C.U ∧ (Γ.inter (ins C), Γ.interOutside (ins C)) ∈ 𝒯 + +/-- The *pretangle induced from* `ins` (Graph Minors XI, (6.1), page 87): "the set of all +separations $(A, B)$ of $\Gamma$ of order $< \theta$ such that $Z(A)$ is +small with respect to the weighting $(V(\Gamma), \theta)$ of $\Gamma'$". -/ +def inducedPretangle (Γ : PaintingOrDrawing S) (Γ' : Drawing S) (θ : ℕ) + (ins : Drawing S → Set S) : Set (Hypergraph S (Set S) × Hypergraph S (Set S)) := + {p | Γ.toHypergraph.IsSeparation p.1 p.2 ∧ separationOrder p.1 p.2 < θ ∧ + IsSmall Γ' ins (2 * θ) Γ.V θ (PaintingOrDrawing.regionsIncludingEdge Γ' p.1)} + +/-- The *perimeter* of a region `r` of `Γ` (Graph Minors XI, Section 6, page 91): "the drawing +`Γ ∩ closure r`". -/ +def perimeter (Γ : Drawing S) (r : Set S) : Drawing S := + Γ.interSet (closure r) + +/-- The *length* of the perimeter of `r` (Graph Minors XI, Section 6, page 91): +"$\sum_{e \in E(\Gamma \cap \bar{r})} n(e)$, where $n(e) = 1$ or $2$, depending whether $e$ +is incident with another region or not". -/ +noncomputable def perimeterLength (Γ : Drawing S) (r : Set S) : ℕ := + ∑ᶠ e ∈ (perimeter Γ r).E, + open Classical in if ∃ r' ∈ Γ.R, r' ≠ r ∧ Γ.EdgeRegionIncident e r' then 1 else 2 + +/-- A slope is *even* (Graph Minors XI, Section 6, page 91): "for every region $r$ of $\Gamma$ with +perimeter of length $< 2\theta$, there is a circuit +$C$ of $\Gamma$ of length $< 2\theta$ with $r \subseteq ins(C)$". -/ +def IsEvenSlope (Γ : Drawing S) (k : ℕ) (ins : Drawing S → Set S) : Prop := + ∀ r ∈ Γ.R, perimeterLength Γ r < k → Captures ins k Γ r + +/-! ## Section 7: nice sets, and terms quoted from Graph Minors VII -/ + +/-- `X ⊆ Σ` is *`Γ`-nice* (Graph Minors XI, Section 8, page 96): "$X$ is a union of vertices, edges +and regions of $\Gamma$". -/ +def IsGammaNice (Γ : Drawing S) (X : Set S) : Prop := + ∃ 𝒜 ⊆ Γ.A, X = ⋃₀ 𝒜 + +/-- `Z ⊆ Σ` is *nice* (Graph Minors XI, Section 7, page 93): "there is a drawing $\Gamma$ in +$\Sigma$ such that $Z$ is the union of certain vertices, +edges, and regions of $\Gamma$". -/ +def IsNice (Z : Set S) : Prop := + ∃ Γ : Drawing S, IsGammaNice Γ Z + +/-- `Z ⊆ Σ` is *arc-connected* (Graph Minors VII, Section 11, page 249): "for every pair $a, b \in +Z$ with $a \ne b$ there is a $[0, 1]$-arc included in $Z$ with ends +$a, b$". -/ +def IsArcConnected (Z : Set S) : Prop := + ∀ a ∈ Z, ∀ b ∈ Z, a ≠ b → ∃ L : Set S, L ⊆ Z ∧ IsLineWithEnds L a b + +/-- `Z ⊆ Σ` is *locally arc-connected* (Graph Minors VII, Section 11, page 251): "for every $z \in +Z$ and every open set $A \subseteq \Sigma$ with $z \in A$ there exists $A' +\subseteq A$ with $z \in A'$, open in $\Sigma$, such that $Z \cap A'$ is arc-connected". -/ +def IsLocallyArcConnected (Z : Set S) : Prop := + ∀ z ∈ Z, ∀ A : Set S, IsOpen A → z ∈ A → + ∃ A' : Set S, A' ⊆ A ∧ z ∈ A' ∧ IsOpen A' ∧ IsArcConnected (Z ∩ A') + +/-- `Z ⊆ Σ` is *solid* (Graph Minors VII, Section 11, page 252): "`Z` is l.a.c. and closed". -/ +def IsSolid (Z : Set S) : Prop := + IsLocallyArcConnected Z ∧ IsClosed Z + +/-- `Z ⊆ Σ` is *flat* (Graph Minors VII, Section 11, page 249): "every continuous $\phi \colon S^1 +\to Z$ is null-homotopic in $\Sigma$". -/ +def IsFlat (Z : Set S) : Prop := + ∀ φ : C(Circle, S), range φ ⊆ Z → ClosedCurveIsNullHomotopicIn univ φ + +/-- `X ⊆ Σ` is *planar* (Graph Minors VII, Section 5, page 232): "`X ⊆ Δ` for some closed disc +`Δ ⊆ Σ`". -/ +def IsPlanar (X : Set S) : Prop := + ∃ Δ : Set S, IsClosedDisc Δ ∧ X ⊆ Δ + +/-! ## Section 8: restraints -/ + +/-- The closed curve `t ↦ h (e^{2π i t}, 0)` of a collar `h`. -/ +noncomputable def collarCurve (h : C(Circle × unitInterval, S)) : ℝ → S := + fun t => h (Circle.exp (2 * Real.pi * t), 0) + +/-- The curve `φ`, on `[a, b]`, runs along the walk, once along each step: there are numbers +`a = x₀ ≤ x₁ ≤ … ≤ x_t = b` with `φ(x_i) = v_i`, and `φ` maps `(x_{i-1}, x_i)` bijectively to +the edge `e_i`. -/ +def RunsAlongOn (Γ : Drawing S) (φ : ℝ → S) : (a b : ℝ) → {u v : S} → + GraphWalk Γ.toGraph u v → Prop + | a, b, u, _, .nil _ => a = b ∧ φ a = u + | a, b, u, _, .cons (e := e) _ rest => + ∃ c, a < c ∧ φ a = u ∧ InjOn φ (Ioo a c) ∧ φ '' Ioo a c = e ∧ RunsAlongOn Γ φ c b rest + +/-- `W` is a *perimeter walk* of `X` (Graph Minors XI, Section 8, page 96): `X` is closed, +simply-connected and `Γ`-nice with `X ≠ ∅, Σ`, and "there is a closed walk of $\Gamma$ tracing out +$bd(X)$ in the natural sense". The paper gives no further definition. We make "in the natural +sense" precise, as the view of `bd(X)` from `Σ − X`: there is a collar +`h : S¹ × [0, 1] → Σ`, injective on `S¹ × (0, 1]`, which maps `S¹ × (0, 1]` into `Σ − X` and +whose circle `h(S¹ × {0})` is `bd(X)`, running along `W`, and such that `X ∪ h(S¹ × [0, 1))` is +open, +so that the collar fills a whole neighbourhood of `X` outside `X`. -/ +def IsPerimeterWalk (Γ : Drawing S) (X : Set S) {u : S} (W : GraphWalk Γ.toGraph u u) : Prop := + ∃ h : C(Circle × unitInterval, S), + InjOn h {p | 0 < p.2} ∧ (∀ p : Circle × unitInterval, 0 < p.2 → h p ∉ X) ∧ + range (fun z : Circle => h (z, 0)) = subBd X ∧ IsOpen (X ∪ h '' {p | p.2 < 1}) ∧ + ((W.length = 0 ∧ ∀ z : Circle, h (z, 0) = u) ∨ + (0 < W.length ∧ RunsAlongOn Γ (collarCurve h) 0 1 W)) + +/-- `l(X)`, the length of a perimeter walk of `X` (Graph Minors XI, Section 8, page 96: "We denote +the length of this walk by $l(X)$"). The perimeter walks of `X` are obtained from one another by +reinitializing and reversal, and so have the same length. -/ +noncomputable def perimeterWalkLength (Γ : Drawing S) (X : Set S) : ℕ := + sInf {t | ∃ (u : S) (W : GraphWalk Γ.toGraph u u), IsPerimeterWalk Γ X W ∧ W.length = t} + +/-- `X ⊆ Σ` is a *restraint* of `Γ` with respect to `ins` (Graph Minors XI, Section 8, page 96): +"$X \ne \emptyset$ is closed, simply-connected and $\Gamma$-nice, $l(X) < 2\theta$, and +$\Sigma - X \notin \mathrm{ins}(\Gamma \cap bd(X))$" (where $\notin$ in the paper means +$\not\subseteq$). +The last condition fails for `X = Σ`, as `l(Σ)` is not defined. -/ +structure IsRestraint (Γ : Drawing S) (ins : Drawing S → Set S) (k : ℕ) (X : Set S) : Prop where + /-- `X ≠ ∅`. -/ + nonempty : X.Nonempty + /-- `X` is closed. -/ + isClosed : IsClosed X + /-- `X` is simply-connected. -/ + isSimplyConnected : IsSimplyConnectedSet X + /-- `X` is `Γ`-nice. -/ + isGammaNice : IsGammaNice Γ X + /-- `l(X) < 2θ`. -/ + length_lt : perimeterWalkLength Γ X < k + /-- `Σ − X` is not included in `ins(Γ ∩ bd(X))`. -/ + compl_not_subset : ¬ (univ \ X ⊆ insOf ins (Γ.interSet (subBd X))) + +/-- A restraint `X` is *extreme* (Graph Minors XI, Section 8, page 97): "there is no restraint $Y +\ne X$ with $X \subseteq Y$ and $l(Y) \le l(X)$". -/ +def IsExtremeRestraint (Γ : Drawing S) (ins : Drawing S → Set S) (k : ℕ) (X : Set S) : Prop := + IsRestraint Γ ins k X ∧ ∀ Y : Set S, IsRestraint Γ ins k Y → X ⊆ Y → + perimeterWalkLength Γ Y ≤ perimeterWalkLength Γ X → Y = X + +/-- A restraint `X` is *`a, b`-optimal* (Graph Minors XI, Section 8, page 100): "$a, b \in X$, and +there is no restraint $Y$ with $a, b \in Y$ and $l(Y) < l(X)$". -/ +def IsOptimalRestraint (Γ : Drawing S) (ins : Drawing S → Set S) (k : ℕ) (a b : S) (X : Set S) : + Prop := + IsRestraint Γ ins k X ∧ a ∈ X ∧ b ∈ X ∧ ∀ Y : Set S, IsRestraint Γ ins k Y → a ∈ Y → b ∈ Y → + perimeterWalkLength Γ X ≤ perimeterWalkLength Γ Y + +/-! ## Section 9: the distance function -/ + +/-- `2 d(a, b)` for atoms `a, b` of `Γ` (Graph Minors XI, Section 9, page 104): +"(i) if $a = b$ then $d(a, b) = 0$ +(ii) if $a \ne b$ and $a, b \subseteq X$ for some restraint $X$, we define $d(a, b)$ to be +$\min \frac{1}{2}l(X)$, taken over all such $X$ +(iii) if (i) and (ii) do not apply then $d(a, b) = \theta$." We +record twice the distance, as `d` may be half an integer. -/ +noncomputable def twiceDistance (Γ : Drawing S) (ins : Drawing S → Set S) (k : ℕ) (a b : Set S) : + ℕ := + open Classical in + if a = b then 0 + else if ∃ X, IsRestraint Γ ins k X ∧ a ⊆ X ∧ b ⊆ X then + sInf {t | ∃ X, IsRestraint Γ ins k X ∧ a ⊆ X ∧ b ⊆ X ∧ perimeterWalkLength Γ X = t} + else k + +/-- A *tie* (Graph Minors XI, Section 9, pages 104–105): a restraint `X` such that either +(i) `|X| = 1`, or (ii) `X` is a line, or (iii) `X` is a closed disc, or +(iv) `X = D₁ ∪ D₂`, where `D₁, D₂` are closed discs with `|D₁ ∩ D₂| = 1`, or +(v) `X = D ∪ F`, where `D` is a closed disc and `F` is a line with one end in `D` and no other point +in `D`, or +(vi) `X = D₁ ∪ D₂ ∪ F`, where `D₁, D₂` are disjoint closed discs and `F` is a line with one end in +`D₁`, the other in `D₂`, and no other point in `D₁ ∪ D₂`. -/ +def IsTie (Γ : Drawing S) (ins : Drawing S → Set S) (k : ℕ) (X : Set S) : Prop := + IsRestraint Γ ins k X ∧ + (X.ncard = 1 ∧ X.Finite ∨ + IsLine X ∨ + IsClosedDisc X ∨ + (∃ D₁ D₂ : Set S, IsClosedDisc D₁ ∧ IsClosedDisc D₂ ∧ (D₁ ∩ D₂).ncard = 1 ∧ + (D₁ ∩ D₂).Finite ∧ X = D₁ ∪ D₂) ∨ + (∃ (D F : Set S) (a b : S), IsClosedDisc D ∧ IsLineWithEnds F a b ∧ F ∩ D = {a} ∧ + X = D ∪ F) ∨ + (∃ (D₁ D₂ F : Set S) (a b : S), IsClosedDisc D₁ ∧ IsClosedDisc D₂ ∧ Disjoint D₁ D₂ ∧ + IsLineWithEnds F a b ∧ F ∩ D₁ = {a} ∧ F ∩ D₂ = {b} ∧ X = D₁ ∪ D₂ ∪ F)) + +end Main + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/DrawingConnectivity.lean b/LeanPool/GraphMinor/GM11/DrawingConnectivity.lean new file mode 100644 index 0000000000..00fe027d32 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/DrawingConnectivity.lean @@ -0,0 +1,123 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM11.PaintingRegions +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Walks in drawings with preconnected support + +The vertices in a preconnected drawing belong to one graph component. +-/ + +public section + +namespace GraphMinor.GM11 + +open Set Topology Surface + +universe u + +/-- Vertices of a drawing with preconnected point set are joined by a +graph walk. -/ +theorem drawing_walk_of_isPreconnected_U {S : Type u} [TopologicalSpace S] [T2Space S] + {D : Drawing S} (hU : IsPreconnected D.U) {a b : S} (ha : a ∈ D.V) (hb : b ∈ D.V) : + Nonempty (GraphWalk D.toGraph a b) := by + classical + let R : Set S := {x | Nonempty (GraphWalk D.toGraph a x)} + have hRV : R ⊆ D.V := by + rintro x ⟨W⟩ + exact W.mem_vertexSet_of_mem_support W.end_mem_support + let E₁ : Set (Set S) := {e ∈ D.E | ∃ x ∈ R, x ∈ closure e} + let E₂ : Set (Set S) := D.E \ E₁ + have hprop : ∀ e ∈ E₁, ∀ x ∈ closure e ∩ D.V, x ∈ R := by + rintro e ⟨he, u, ⟨W⟩, hue⟩ x hx + by_cases hux : u = x + · exact hux ▸ ⟨W⟩ + obtain ⟨p, q, hpq⟩ := D.toGraph.exists_isLink_of_mem_edgeSet he + have hu : u ∈ ({p, q} : Set S) := hpq.2.2.2 ▸ + ⟨hue, W.mem_vertexSet_of_mem_support W.end_mem_support⟩ + have hx' : x ∈ ({p, q} : Set S) := hpq.2.2.2 ▸ hx + have hlink : D.toGraph.IsLink e u x := by + rcases hu with rfl | hu <;> rcases hx' with rfl | hx' + · exact (hux rfl).elim + · rw [mem_singleton_iff] at hx' + exact hx' ▸ hpq + · rw [mem_singleton_iff] at hu + exact hu ▸ hpq.symm + · rw [mem_singleton_iff] at hu hx' + exact (hux (hu.trans hx'.symm)).elim + exact ⟨W.append (.cons hlink (.nil hlink.right_mem))⟩ + let C₁ : Set S := R ∪ ⋃ e ∈ E₁, closure e + let C₂ : Set S := (D.V \ R) ∪ ⋃ e ∈ E₂, closure e + have hC₁V : ∀ x ∈ C₁, x ∈ D.V → x ∈ R := by + rintro x (hx | hx) hxV + · exact hx + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact hprop e he x ⟨hxe, hxV⟩ + have hC₂V : ∀ x ∈ C₂, x ∈ D.V → x ∉ R := by + rintro x (hx | hx) _ + · exact hx.2 + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + intro hxR + exact he.2 ⟨he.1, x, hxR, hxe⟩ + have hdis : Disjoint C₁ C₂ := by + apply disjoint_left.mpr + intro x hx hy + by_cases hxV : x ∈ D.V + · exact hC₂V x hy hxV (hC₁V x hx hxV) + obtain ⟨e, he, hxe⟩ : ∃ e ∈ E₁, x ∈ closure e := + by + obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp (hx.resolve_left (fun hxR => hxV (hRV hxR))) + exact ⟨e, he, hxe⟩ + obtain ⟨f, hf, hxf⟩ : ∃ f ∈ E₂, x ∈ closure f := + by + obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp (hy.resolve_left (fun hyV => hxV hyV.1)) + exact ⟨f, hf, hxf⟩ + have hxe' : x ∈ e := by rw [← D.closure_diff_V he.1]; exact ⟨hxe, hxV⟩ + have hxf' : x ∈ f := by rw [← D.closure_diff_V hf.1]; exact ⟨hxf, hxV⟩ + have hef := D.edge_eq_of_mem he.1 hf.1 hxe' hxf' + exact hf.2 (hef ▸ he) + have hfin₁ : E₁.Finite := D.finite_edges.subset fun _ h => h.1 + have hfin₂ : E₂.Finite := D.finite_edges.sdiff + have hclosed₁ : IsClosed C₁ := + (D.finite_V.subset hRV).isClosed.union + (hfin₁.isClosed_biUnion fun _ _ => isClosed_closure) + have hclosed₂ : IsClosed C₂ := + (D.finite_V.subset sdiff_subset).isClosed.union + (hfin₂.isClosed_biUnion fun _ _ => isClosed_closure) + have hcover : C₁ ∪ C₂ = D.U := by + apply subset_antisymm + · rintro x ((hx | hx) | hx | hx) + · exact D.V_subset_U (hRV hx) + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact D.closure_subset_U he.1 hxe + · exact D.V_subset_U hx.1 + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact D.closure_subset_U he.1 hxe + · intro x hx + rw [D.U_eq] at hx + rcases hx with hx | hx + · by_cases hxR : x ∈ R + · exact Or.inl (Or.inl hxR) + · exact Or.inr (Or.inl ⟨hx, hxR⟩) + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + by_cases he₁ : e ∈ E₁ + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨e, he₁, hxe⟩)) + · exact Or.inr (Or.inr (mem_iUnion₂.mpr ⟨e, ⟨he, he₁⟩, hxe⟩)) + by_contra hn + have haPart : (D.U ∩ C₁).Nonempty := ⟨a,D.V_subset_U ha,Or.inl ⟨.nil ha⟩⟩ + have hbPart : (D.U ∩ C₂).Nonempty := ⟨b,D.V_subset_U hb,Or.inl ⟨hb,hn⟩⟩ + obtain ⟨x,_,hx₁,hx₂⟩ := (isPreconnected_closed_iff.mp hU) C₁ C₂ hclosed₁ hclosed₂ + hcover.ge haPart hbPart + exact (disjoint_left.mp hdis) hx₁ hx₂ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/DrawingOps.lean b/LeanPool/GraphMinor/GM11/DrawingOps.lean new file mode 100644 index 0000000000..a010d8ddbd --- /dev/null +++ b/LeanPool/GraphMinor/GM11/DrawingOps.lean @@ -0,0 +1,274 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PaintingCells +public import LeanPool.GraphMinor.GM11.RadialChord + +/-! +# Two operations on drawings + +`exists_added_vertices` adds a point of each edge to the vertices of a drawing, and keeps the point +set, +so the regions do not change. `exists_transport` moves a drawing along a map that is injective on +its +point set. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- Add one point of each edge of `D` to the vertices. -/ +theorem exists_added_vertices (D : Drawing S) {m : Set S → S} (hm : ∀ e ∈ D.E, m e ∈ e) : + ∃ D₂ : Drawing S, D₂.U = D.U ∧ D₂.V = D.V ∪ m '' D.E := by + classical + have key : ∀ T : Finset (Set S), (∀ e ∈ T, e ∈ D.E) → + ∃ D₂ : Drawing S, D₂.U = D.V ∪ ⋃ e ∈ T, closure e ∧ D₂.V = D.V ∪ m '' T := by + intro T + induction T using Finset.induction_on with + | empty => + intro _ + exact ⟨pointsDrawing D.finite_V, by simp [pointsDrawing], by simp [pointsDrawing]⟩ + | insert e T he ih => + intro hT + obtain ⟨C, hU', hV'⟩ := ih fun f hf => hT f (Finset.mem_insert_of_mem hf) + have hee := hT e (Finset.mem_insert_self _ _) + have hme := hm e hee + let A : Set S := insert (m e) (closure e ∩ D.V) + have hA : A.Finite := (D.finite_V.inter_of_right _).insert _ + have hAe : A ⊆ closure e := insert_subset (subset_closure hme) inter_subset_left + obtain ⟨L, hLU, hLV⟩ : ∃ L : Drawing S, L.U = closure e ∧ L.V = A := by + rcases D.edge_cond e hee with ⟨u, v, huv, hcap, hL⟩ | ⟨u, -, hF⟩ + · refine exists_drawing_on_line _ hL huv hA ?_ ?_ hAe le_rfl + · exact mem_insert_of_mem _ (hcap ▸ mem_insert u {v}) + · exact mem_insert_of_mem _ (hcap ▸ mem_insert_of_mem u rfl) + · exact exists_drawing_on_oArc hF hA (insert_nonempty _ _) hAe + have hmeet : C.U ∩ L.U ⊆ C.V ∩ L.V := by + rw [hU', hV', hLU, hLV] + rintro x ⟨hx | hx, hxe⟩ + · exact ⟨Or.inl hx, mem_insert_of_mem _ ⟨hxe, hx⟩⟩ + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + have hfe : f ≠ e := fun h => he (h ▸ hf) + have hff := hT f (Finset.mem_insert_of_mem hf) + by_cases hxV : x ∈ D.V + · exact ⟨Or.inl hxV, mem_insert_of_mem _ ⟨hxe, hxV⟩⟩ + · have h₁ : x ∈ f := D.closure_diff_V hff ▸ (⟨hxf, hxV⟩ : x ∈ closure f \ D.V) + have h₂ : x ∈ e := D.closure_diff_V hee ▸ (⟨hxe, hxV⟩ : x ∈ closure e \ D.V) + exact (hfe (D.edge_eq_of_mem hff hee h₁ h₂)).elim + refine ⟨C.glue L hmeet, ?_, ?_⟩ + · change C.U ∪ L.U = _ + rw [hU', hLU] + ext x + simp only [mem_union, mem_iUnion, Finset.mem_insert, exists_prop] + constructor + · rintro ((h | ⟨f, hf, h⟩) | h) + · exact Or.inl h + · exact Or.inr ⟨f, Or.inr hf, h⟩ + · exact Or.inr ⟨e, Or.inl rfl, h⟩ + · rintro (h | ⟨f, rfl | hf, h⟩) + · exact Or.inl (Or.inl h) + · exact Or.inr h + · exact Or.inl (Or.inr ⟨f, hf, h⟩) + · change C.V ∪ L.V = _ + rw [hV', hLV] + ext x + simp only [A, mem_union, mem_insert_iff, mem_image, Finset.mem_coe, Finset.mem_insert, + mem_inter_iff] + constructor + · rintro ((h | ⟨f, hf, rfl⟩) | rfl | h) + · exact Or.inl h + · exact Or.inr ⟨f, Or.inr hf, rfl⟩ + · exact Or.inr ⟨e, Or.inl rfl, rfl⟩ + · exact Or.inl h.2 + · rintro (h | ⟨f, rfl | hf, rfl⟩) + · exact Or.inl (Or.inl h) + · exact Or.inr (Or.inl rfl) + · exact Or.inl (Or.inr ⟨f, hf, rfl⟩) + have hE : D.E.Finite := D.finite_edges + obtain ⟨D₂, hU, hV⟩ := key hE.toFinset fun e he => hE.mem_toFinset.mp he + refine ⟨D₂, ?_, ?_⟩ + · rw [hU] + conv_rhs => rw [D.U_eq] + simp + · rw [hV] + simp + +omit [T2Space S] in +/-- Arc components move along a map with a continuous inverse. -/ +theorem arcComponentsIn_image {S' : Type*} [TopologicalSpace S'] {F : Set S} {f : S → S'} {g : S' + → S} + (hf : ContinuousOn f F) (hg : ContinuousOn g (f '' F)) (hgf : ∀ x ∈ F, g (f x) = x) : + arcComponentsIn (f '' F) = image f '' arcComponentsIn F := by + have hfg : ∀ y ∈ f '' F, f (g y) = y := by + rintro _ ⟨x, hx, rfl⟩ + rw [hgf x hx] + have hconn : ∀ {D : Set S}, D ⊆ F → IsPathConnected D → IsPathConnected (f '' D) := fun hD h => + h.image' (hf.mono hD) + have hconn' : ∀ {D : Set S'}, D ⊆ f '' F → IsPathConnected D → IsPathConnected (g '' D) + := fun hD h => + h.image' (hg.mono hD) + have hgsub : ∀ {D : Set S'}, D ⊆ f '' F → g '' D ⊆ F := by + rintro D hD _ ⟨y, hy, rfl⟩ + obtain ⟨x, hx, rfl⟩ := hD hy + rwa [hgf x hx] + have hfgim : ∀ {D : Set S'}, D ⊆ f '' F → f '' (g '' D) = D := fun {D} hD => by + rw [image_image] + exact (image_congr fun y hy => hfg y (hD hy)).trans (image_id' D) + have hgfim : ∀ {D : Set S}, D ⊆ F → g '' (f '' D) = D := fun {D} hD => by + rw [image_image] + exact (image_congr fun y hy => hgf y (hD hy)).trans (image_id' D) + ext C' + constructor + · rintro ⟨hne, hsub, hpc, hmax⟩ + refine ⟨g '' C', ⟨hne.image g, hgsub hsub, hconn' hsub hpc, ?_⟩, hfgim hsub⟩ + intro D hD hDc hCD + have h₁ : C' ⊆ f '' D := by + have := image_mono (f := f) hCD + rwa [hfgim hsub] at this + have h₂ := hmax _ (image_mono hD) (hconn hD hDc) h₁ + rw [← h₂, hgfim hD] + · rintro ⟨C, ⟨hne, hsub, hpc, hmax⟩, rfl⟩ + refine ⟨hne.image f, image_mono hsub, hconn hsub hpc, ?_⟩ + intro D hD hDc hCD + have h₁ : C ⊆ g '' D := by + have := image_mono (f := g) hCD + rwa [hgfim hsub] at this + have h₂ := hmax _ (hgsub hD) (hconn' hD hDc) h₁ + rw [← h₂, hfgim hD] + +/-- Transport a drawing `D : Drawing S` whose point set `D.U` is compact along a map `f : S → S'` +continuous and injective on `D.U`. -/ +theorem exists_transportOn_of_isCompact {S S' : Type*} [TopologicalSpace S] [Nonempty S] + [TopologicalSpace S'] [T2Space S'] + (D : Drawing S) (hUc : IsCompact D.U) {f : S → S'} (hf : ContinuousOn f D.U) + (hinj : InjOn f D.U) : + ∃ D' : Drawing S', D'.U = f '' D.U ∧ D'.V = f '' D.V ∧ D'.E = image f '' D.E ∧ + ∀ e ∈ D.E, closure (f '' e) = f '' closure e := by + classical + have : CompactSpace D.U := isCompact_iff_compactSpace.mp hUc + let ι : D.U → S' := fun x => f x.1 + have hιc : Continuous ι := hf.comp_continuous continuous_subtype_val Subtype.prop + have hιi : Function.Injective ι := fun x y h => Subtype.ext (hinj x.2 y.2 h) + have hemb := hιc.isClosedEmbedding hιi + have hrange : range ι = f '' D.U := by + ext y + simp [ι] + let φ : D.U ≃ₜ range ι := hemb.isEmbedding.toHomeomorph + let g : S' → S := Function.invFunOn f D.U + have hgf : ∀ x ∈ D.U, g (f x) = x := fun x hx => by + have h := Function.invFunOn_mem (f := f) (s := D.U) ⟨x, hx, rfl⟩ + exact hinj h hx (Function.invFunOn_eq ⟨x, hx, rfl⟩) + have hg : ContinuousOn g (f '' D.U) := by + rw [continuousOn_iff_continuous_domRestrict] + have heq : (f '' D.U).domRestrict g = fun y => (φ.symm ⟨y.1, hrange.symm ▸ y.2⟩).1 := by + funext y + have h₁ : ι (φ.symm ⟨y.1, hrange.symm ▸ y.2⟩) = y.1 := + congrArg Subtype.val (φ.apply_symm_apply ⟨y.1, hrange.symm ▸ y.2⟩) + have h₂ := hgf _ (φ.symm ⟨y.1, hrange.symm ▸ y.2⟩).2 + change g y.1 = _ + rw [← h₂] + exact congrArg g h₁.symm + rw [heq] + refine continuous_subtype_val.comp (φ.symm.continuous.comp ?_) + exact Continuous.subtype_mk continuous_subtype_val _ + have hsub : D.U \ D.V ⊆ D.U := sdiff_subset + have hgF : ContinuousOn g (f '' (D.U \ D.V)) := hg.mono (image_mono hsub) + have harc := arcComponentsIn_image (F := D.U \ D.V) (hf.mono hsub) hgF fun x hx => hgf x hx.1 + have hdiff : f '' D.U \ f '' D.V = f '' (D.U \ D.V) := + (InjOn.image_sdiff_subset hinj D.V_subset_U).symm + have hcl : ∀ e ∈ D.E, closure (f '' e) = f '' closure e := by + intro e he + have he_sub : closure e ⊆ D.U := D.closure_subset_U he + apply subset_antisymm + · have hc : IsCompact (f '' closure e) := + (hUc.of_isClosed_subset isClosed_closure he_sub).image_of_continuousOn (hf.mono he_sub) + exact closure_minimal (image_mono subset_closure) hc.isClosed + · rintro _ ⟨x, hx, rfl⟩ + rw [_root_.mem_closure_iff] + intro V hV hfxV + obtain ⟨W, hW_open, hxW, hWV⟩ := + mem_nhdsWithin.mp (hf.mono he_sub x hx (hV.mem_nhds hfxV)) + obtain ⟨y, hyW, hye⟩ := _root_.mem_closure_iff.mp hx W hW_open hxW + exact ⟨f y, hWV ⟨hyW, subset_closure hye⟩, mem_image_of_mem f hye⟩ + have hcap : ∀ e ∈ D.E, closure (f '' e) ∩ f '' D.V = f '' (closure e ∩ D.V) := by + intro e he + rw [hcl e he] + exact (InjOn.image_inter hinj (D.closure_subset_U he) D.V_subset_U).symm + refine ⟨⟨f '' D.U, f '' D.V, image_mono D.V_subset_U, + (hUc.image_of_continuousOn hf).isClosed, + D.finite_V.image f, ?_, ?_⟩, rfl, rfl, ?_, hcl⟩ + rotate_left 2 + · change arcComponentsIn (f '' D.U \ f '' D.V) = _ + rw [hdiff, harc] + rfl + · rw [hdiff, harc] + exact D.finite_edges.image _ + · rw [hdiff, harc] + rintro _ ⟨e, he, rfl⟩ + have hinje : InjOn f (closure e) := hinj.mono (D.closure_subset_U he) + rw [hcap e he] + rcases D.edge_cond e he with ⟨u, v, huv, hc, hL⟩ | ⟨u, hc, hF⟩ + · left + have hmem : ∀ z ∈ ({u, v} : Set S), z ∈ closure e := fun z hz => by + rw [← hc] at hz + exact hz.1 + refine ⟨f u, f v, fun h => huv (hinje (hmem u (by simp)) (hmem v (by simp)) h), ?_, ?_⟩ + · rw [hc, image_pair] + · obtain ⟨φ₁, h0, h1⟩ := hL + have hc₁ : Continuous fun t => f (φ₁ t).1 := + hf.comp_continuous (continuous_subtype_val.comp φ₁.continuous) + fun t => D.closure_subset_U he (φ₁ t).2 + have hi₁ : Function.Injective fun t => f (φ₁ t).1 := fun x y h => + φ₁.injective (Subtype.ext (hinje (φ₁ x).2 (φ₁ y).2 h)) + have hl := isLine_range hc₁ hi₁ + have hr : range (fun t => f (φ₁ t).1) = f '' closure e := by + ext y + constructor + · rintro ⟨t, rfl⟩ + exact ⟨_, (φ₁ t).2, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨φ₁.symm ⟨x, hx⟩, by simp⟩ + rw [hr, ← hcl e he] at hl + simpa only [h0, h1] using hl + · right + refine ⟨f u, ?_, ?_⟩ + · rw [hc, image_singleton] + · obtain ⟨φ₂⟩ := hF + have hc₂ : Continuous fun t => f (φ₂ t).1 := + hf.comp_continuous (continuous_subtype_val.comp φ₂.continuous) + fun t => D.closure_subset_U he (φ₂ t).2 + have hi₂ : Function.Injective fun t => f (φ₂ t).1 := fun x y h => + φ₂.injective (Subtype.ext (hinje (φ₂ x).2 (φ₂ y).2 h)) + have hr : range (fun t => f (φ₂ t).1) = f '' closure e := by + ext y + constructor + · rintro ⟨t, rfl⟩ + exact ⟨_, (φ₂ t).2, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨φ₂.symm ⟨x, hx⟩, by simp⟩ + have hem := (hc₂.isClosedEmbedding hi₂).isEmbedding.toHomeomorph + exact ⟨hem.trans (Homeomorph.setCongr (hr.trans (hcl e he).symm))⟩ + +omit [T2Space S] in +/-- Move a drawing along a map that is injective on its point set. -/ +theorem exists_transport {S' : Type*} [TopologicalSpace S'] [T2Space S'] [CompactSpace S] [Nonempty + S] + (D : Drawing S) {f : S → S'} (hf : Continuous f) (hinj : InjOn f D.U) : + ∃ D' : Drawing S', D'.U = f '' D.U ∧ D'.V = f '' D.V ∧ D'.E = image f '' D.E ∧ + ∀ e ∈ D.E, closure (f '' e) = f '' closure e := + exists_transportOn_of_isCompact D D.isClosed_U.isCompact hf.continuousOn hinj + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/DrawingTopology.lean b/LeanPool/GraphMinor/GM11/DrawingTopology.lean new file mode 100644 index 0000000000..0afd6a1f89 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/DrawingTopology.lean @@ -0,0 +1,824 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section7 +public import LeanPool.GraphMinor.GM11.Walks +public import LeanPool.GraphMinor.Surface.DiscsInSurface +public import LeanPool.GraphMinor.Surface.DiscUnion +public import LeanPool.GraphMinor.Surface.SphereDisc +import LeanPool.GraphMinor.GM11.PlaneFacts +import LeanPool.GraphMinor.GM11.Section3 +import LeanPool.GraphMinor.GM11.Section4c +import LeanPool.GraphMinor.GM11.Fan +import LeanPool.GraphMinor.GM11.Forest + +/-! +# Topology of drawings and their bounding discs + +The shared disc-frontier, theta-curve and drawing-walk lemmas used by the slope constructions +in Graph Minors XI and XIV. Two arcs that meet only at their common ends give a simple loop. +-/ + +public section + +namespace GraphMinor.GM11 + +open Set Topology Surface Metric Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The image of the open disc under coordinates on a closed disc is open: this is invariance of +domain, in a chart of the surface around each point. -/ +private theorem isOpen_image_ball (hS : IsClosedSurface S) {g : ℂ → S} + (hg : ContinuousOn g (ball 0 1)) (hinj : InjOn g (ball 0 1)) : IsOpen (g '' ball 0 1) := by + have : T2Space S := hS.2.1 + rw [isOpen_iff_mem_nhds] + rintro _ ⟨z, hz, rfl⟩ + obtain ⟨U, hU, hxU, ⟨f⟩⟩ := hS.2.2 (g z) + classical + let F : S → ℂ := fun y => if hy : y ∈ U then complexPlane.symm (f ⟨y, hy⟩).1 else 0 + have hF : ∀ y (hy : y ∈ U), F y = complexPlane.symm (f ⟨y, hy⟩).1 := fun y hy => by + simp only [F, hy, dite_true] + have hFc : ContinuousOn F U := by + rw [continuousOn_iff_continuous_domRestrict] + have : U.domRestrict F = fun y : U => complexPlane.symm (f y).1 := by + ext y + exact hF y.1 y.2 + rw [this] + exact complexPlane.symm.continuous.comp (continuous_subtype_val.comp f.continuous) + have hFi : InjOn F U := by + intro a ha b hb hab + rw [hF a ha, hF b hb] at hab + have h₁ := complexPlane.symm.injective hab + have h₂ := f.injective (Subtype.ext h₁) + exact congrArg Subtype.val h₂ + let B : Set ℂ := ball 0 1 ∩ g ⁻¹' U + have hBo : IsOpen B := hg.isOpen_inter_preimage isOpen_ball hU + have hzB : z ∈ B := ⟨hz, hxU⟩ + have hGc : ContinuousOn (F ∘ g) B := + hFc.comp (hg.mono inter_subset_left) fun w hw => hw.2 + have hGi : InjOn (F ∘ g) B := fun a ha b hb hab => + hinj ha.1 hb.1 (hFi ha.2 hb.2 hab) + have hOpen := isOpen_image_of_injOn hBo hGc hGi + have hO' : IsOpen (U ∩ F ⁻¹' ((F ∘ g) '' B)) := hFc.isOpen_inter_preimage hU hOpen + refine Filter.mem_of_superset (hO'.mem_nhds ⟨hxU, z, hzB, rfl⟩) ?_ + rintro y ⟨hyU, w, hw, hwy⟩ + exact ⟨w, hw.1, hFi hw.2 hyU hwy⟩ + +/-- The interior of a closed disc in a closed surface is connected. -/ +theorem IsClosedDisc.isPreconnected_diff_frontier (hS : IsClosedSurface S) {D : Set S} + (hD : IsClosedDisc D) : IsPreconnected (D \ frontier D) := by + obtain ⟨h, g, -, hg, hhD, hgD, hl, hr, -⟩ := IsClosedDisc.exists_chart hD + have hgb : ContinuousOn g (ball 0 1) := hg.mono ball_subset_closedBall + have hinj : InjOn g (ball 0 1) := by + intro a ha b hb hab + have ha' := hr (ball_subset_closedBall ha) + have hb' := hr (ball_subset_closedBall hb) + rw [← ha', ← hb'] + exact congrArg h hab + have hO := isOpen_image_ball hS hgb hinj + have hsub : g '' ball 0 1 ⊆ D := by + rintro _ ⟨z, hz, rfl⟩ + exact hgD (ball_subset_closedBall hz) + have hpre : IsPreconnected (g '' ball 0 1) := + (convex_ball (0 : ℂ) 1).isPreconnected.image g hgb + refine hpre.subset_closure ?_ ?_ + · intro y hy + refine ⟨hsub hy, fun hfr => hfr.2 ?_⟩ + exact interior_maximal hsub hO hy + · rintro y ⟨hy, -⟩ + have hz := hhD hy + have hzc : h y ∈ closure (ball (0 : ℂ) 1) := by + rw [closure_ball (0 : ℂ) one_ne_zero] + exact hz + have hwithin : ContinuousWithinAt g (ball 0 1) (h y) := + (hg (h y) hz).mono ball_subset_closedBall + have := hwithin.mem_closure_image hzc + rwa [hl hy] at this + +/-- A connected set that misses the frontier of a closed set lies in it or misses it. -/ +theorem subset_or_disjoint_of_frontier {X A : Set S} (hX : IsClosed X) (hA : IsPreconnected A) + (hdis : Disjoint A (frontier X)) : A ⊆ X ∨ Disjoint A X := by + have hcov : A ⊆ interior X ∪ Xᶜ := by + intro y hy + by_cases hyX : y ∈ X + · refine Or.inl ?_ + by_contra hi + exact disjoint_left.mp hdis hy ⟨subset_closure hyX, hi⟩ + · exact Or.inr hyX + by_cases hm : (A ∩ X).Nonempty + · left + obtain ⟨x, hxA, hxX⟩ := hm + have hxi : x ∈ interior X := (hcov hxA).resolve_right fun h => h hxX + intro y hy + by_contra hyX + obtain ⟨z, -, hz₁, hz₂⟩ := hA _ _ isOpen_interior hX.isOpen_compl hcov ⟨x, hxA, hxi⟩ ⟨y, hy, + hyX⟩ + exact hz₂ (interior_subset hz₁) + · exact Or.inr (disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp hm)) + +/-- The edges of a walk of a drawing are edges of the drawing. -/ +theorem mem_E_of_mem_edges {N : Drawing S} {u v : S} (W : GraphWalk N.toGraph u v) {e : Set S} + (he : e ∈ W.edges) : e ∈ N.E := by + induction W with + | nil => exact absurd he List.not_mem_nil + | cons h r ih => + rcases List.mem_cons.mp he with rfl | h' + · exact h.1 + · exact ih h' + +/-- The manifold boundary of a closed disc in a closed surface is its frontier. This is invariance +of domain, in a chart of the surface. -/ +theorem IsClosedDisc.frontier_eq_discBd (hS : IsClosedSurface S) {D : Set S} (hD : IsClosedDisc D) : + frontier D = discBd D := by + have : T2Space S := hS.2.1 + have hman : ∀ x : S, IsManifoldPoint x := (IsClosedSurface.isSurface hS).2.2 + have hcl : IsClosed D := hD.isCompact.isClosed + obtain ⟨h, g, c⟩ := hD.exists_isChart + obtain ⟨u1, -⟩ := c.union_ball + have hO := c.isOpen_image_ball hman + have hsub : g '' ball 0 1 ⊆ D := fun x hx => u1 ▸ Or.inl hx + apply subset_antisymm + · intro x hx + have hxD : x ∈ D := hcl.frontier_subset hx + rw [← u1] at hxD + rcases hxD with h' | h' + · exact absurd (interior_maximal hsub hO h') hx.2 + · exact h' + · intro x hx + have hxD : x ∈ D := discBd_subset _ hx + refine ⟨subset_closure hxD, fun hint => ?_⟩ + obtain ⟨U, hU, hxU, ⟨f⟩⟩ := hS.2.2 x + classical + let G : ℂ → S := fun w => + if hw : complexPlane w ∈ OpenUnitDisc then (f.symm ⟨_, hw⟩).1 else x + let M : Set ℂ := complexPlane ⁻¹' OpenUnitDisc + have hMo : IsOpen M := by + have : IsOpen OpenUnitDisc := by + have := Metric.isOpen_ball (x := (0 : EuclideanPlane)) (ε := 1) + convert this using 1 + ext y + simp [OpenUnitDisc] + exact this.preimage complexPlane.continuous + have hG : ∀ w (hw : w ∈ M), G w = (f.symm ⟨_, hw⟩).1 := fun w hw => by + have hw' : complexPlane w ∈ OpenUnitDisc := hw + simp only [G, hw', dite_true] + have hGc : ContinuousOn G M := by + rw [continuousOn_iff_continuous_domRestrict] + have : M.domRestrict G = fun w : M => (f.symm ⟨complexPlane w.1, w.2⟩).1 := by + ext w + exact hG w.1 w.2 + rw [this] + refine continuous_subtype_val.comp (f.symm.continuous.comp ?_) + exact Continuous.subtype_mk (complexPlane.continuous.comp continuous_subtype_val) _ + have hGi : InjOn G M := by + intro a ha b hb hab + rw [hG a ha, hG b hb] at hab + have h₁ := f.symm.injective (Subtype.ext hab) + exact complexPlane.injective (congrArg Subtype.val h₁) + let B : Set ℂ := M ∩ G ⁻¹' interior D + have hBo : IsOpen B := hGc.isOpen_inter_preimage hMo isOpen_interior + have hBD : MapsTo G B D := fun w hw => interior_subset hw.2 + have hHc : ContinuousOn (h ∘ G) B := c.hc.comp (hGc.mono inter_subset_left) hBD + have hHi : InjOn (h ∘ G) B := by + intro a ha b hb hab + apply hGi ha.1 hb.1 + have := congrArg g hab + simpa [c.gh (hBD ha), c.gh (hBD hb)] using this + have hOpen := isOpen_image_of_injOn hBo hHc hHi + set w₀ : ℂ := complexPlane.symm (f ⟨x, hxU⟩).1 with hw₀ + have hw₀M : w₀ ∈ M := by + change complexPlane w₀ ∈ OpenUnitDisc + rw [hw₀, LinearIsometryEquiv.apply_symm_apply] + exact (f ⟨x, hxU⟩).2 + have hGw : G w₀ = x := by + rw [hG w₀ hw₀M] + have : (⟨complexPlane w₀, hw₀M⟩ : OpenUnitDisc) = f ⟨x, hxU⟩ := by + apply Subtype.ext + change complexPlane w₀ = _ + rw [hw₀, LinearIsometryEquiv.apply_symm_apply] + rw [this, f.symm_apply_apply] + have hw₀B : w₀ ∈ B := ⟨hw₀M, show G w₀ ∈ interior D from hGw ▸ hint⟩ + have hball : h x ∈ interior (closedBall (0 : ℂ) 1) := by + refine mem_interior.mpr ⟨_, ?_, hOpen, ⟨w₀, hw₀B, by simp [hGw]⟩⟩ + rintro _ ⟨w, hw, rfl⟩ + exact c.hm (hBD hw) + rw [interior_closedBall _ one_ne_zero] at hball + have hsph : h x ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem h hx + rw [mem_ball, mem_sphere.mp hsph] at hball + exact lt_irrefl _ hball + +/-- A closed disc in a closed surface is the closure of its interior. -/ +theorem IsClosedDisc.subset_closure_diff_frontier (hS : IsClosedSurface S) {D : Set S} + (hD : IsClosedDisc D) : D ⊆ closure (D \ frontier D) := by + have : T2Space S := hS.2.1 + have hman : ∀ x : S, IsManifoldPoint x := (IsClosedSurface.isSurface hS).2.2 + obtain ⟨h, g, c⟩ := hD.exists_isChart + obtain ⟨u1, -⟩ := c.union_ball + have hO := c.isOpen_image_ball hman + have hsub : g '' ball 0 1 ⊆ D := fun x hx => u1 ▸ Or.inl hx + have hin : g '' ball 0 1 ⊆ D \ frontier D := fun x hx => + ⟨hsub hx, fun hfr => hfr.2 (interior_maximal hsub hO hx)⟩ + intro y hy + refine closure_mono hin ?_ + have hz := c.hm hy + have hzc : h y ∈ closure (ball (0 : ℂ) 1) := by + rw [closure_ball (0 : ℂ) one_ne_zero] + exact hz + have hwithin : ContinuousWithinAt g (ball 0 1) (h y) := + (c.gc (h y) hz).mono ball_subset_closedBall + have := hwithin.mem_closure_image hzc + rwa [c.gh hy] at this + +/-- Two different closed discs of a connected closed surface with the same boundary cover the +surface. If the surface is not a sphere there are no such discs (`eq_of_discBd_eq`), and in a sphere +the two discs that an `O`-arc bounds cover it. -/ +theorem cover_of_discBd_eq [ConnectedSpace S] (hS : IsClosedSurface S) {Δ₁ Δ₂ : Set S} + (h₁ : IsClosedDisc Δ₁) (h₂ : IsClosedDisc Δ₂) (hb : discBd Δ₁ = discBd Δ₂) (hne : Δ₁ ≠ Δ₂) : + Δ₁ ∪ Δ₂ = univ := by + by_cases hsph : IsSphere S + · obtain ⟨a, b, -, -, -, -, -, hcov, -, -, hall⟩ := sphere_disc S hsph _ h₁.isOArc_discBd + rcases hall Δ₁ h₁ rfl with e₁ | e₁ <;> rcases hall Δ₂ h₂ hb.symm with e₂ | e₂ + · exact absurd (e₁.trans e₂.symm) hne + · rw [e₁, e₂, hcov] + · rw [e₁, e₂, union_comm, hcov] + · exact absurd (e₁.trans e₂.symm) hne + · exact absurd (eq_of_discBd_eq (IsClosedSurface.isSurface hS) hsph h₁ h₂ hb) hne + +/-- The part of a line between its ends is connected. -/ +theorem IsLineWithEnds.isPreconnected_sdiff_pair {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : + IsPreconnected (L \ {a, b}) := by + obtain ⟨f, hf0, hf1⟩ := h + have hEq : L \ {a, b} = (fun t => (f t).1) '' Ioo (0 : unitInterval) 1 := by + ext x + constructor + · rintro ⟨hxL, hx⟩ + obtain ⟨t, ht⟩ := f.surjective ⟨x, hxL⟩ + have hx' : (f t).1 = x := by rw [ht] + refine ⟨t, ⟨lt_of_le_of_ne unitInterval.nonneg' ?_, lt_of_le_of_ne unitInterval.le_one' ?_⟩, + hx'⟩ + · rintro rfl + exact hx (Or.inl (hx'.symm.trans hf0)) + · rintro rfl + exact hx (Or.inr (hx'.symm.trans hf1)) + · rintro ⟨t, ⟨h0, h1⟩, rfl⟩ + refine ⟨(f t).2, ?_⟩ + rintro (h' | h') + · have := f.injective (Subtype.ext (h'.trans hf0.symm)) + exact h0.ne this.symm + · have := f.injective (Subtype.ext (h'.trans hf1.symm)) + exact h1.ne this + rw [hEq] + exact isPreconnected_Ioo.image _ (by fun_prop) + +/-- Adjacent theta-face discs intersect in their common arc. The interior of each opposite arc +lies outside its disc. -/ +theorem theta_disc_intersection (hS : IsClosedSurface S) {A₀ A₁ A₂ Δ₀ Δ₁ : Set S} {a b : S} + (l₀ : IsLineWithEnds A₀ a b) (l₁ : IsLineWithEnds A₁ a b) + (i₀₁ : A₀ ∩ A₁ = {a, b}) (i₁₂ : A₁ ∩ A₂ = {a, b}) (i₂₀ : A₂ ∩ A₀ = {a, b}) + (d₀ : IsClosedDisc Δ₀) (d₁ : IsClosedDisc Δ₁) + (f₀ : frontier Δ₀ = A₁ ∪ A₂) (f₁ : frontier Δ₁ = A₂ ∪ A₀) + (h₀ : ¬ A₀ ⊆ Δ₀) (h₁ : ¬ A₁ ⊆ Δ₁) : + Δ₀ ∩ Δ₁ = A₂ ∧ Disjoint (A₀ \ {a, b}) Δ₀ ∧ Disjoint (A₁ \ {a, b}) Δ₁ := by + have : T2Space S := hS.2.1 + have c₀ : IsClosed Δ₀ := d₀.isCompact.isClosed + have c₁ : IsClosed Δ₁ := d₁.isCompact.isClosed + have sub₀ : A₁ ∪ A₂ ⊆ Δ₀ := f₀ ▸ c₀.frontier_subset + have sub₁ : A₂ ∪ A₀ ⊆ Δ₁ := f₁ ▸ d₁.isCompact.isClosed.frontier_subset + have m₂ : ∀ x, x ∈ A₂ → x ∈ A₀ → x = a ∨ x = b := fun x h h' => by + have : x ∈ A₂ ∩ A₀ := ⟨h, h'⟩ + rwa [i₂₀] at this + have m₁ : ∀ x, x ∈ A₁ → x ∈ A₂ → x = a ∨ x = b := fun x h h' => by + have : x ∈ A₁ ∩ A₂ := ⟨h, h'⟩ + rwa [i₁₂] at this + have m₀ : ∀ x, x ∈ A₀ → x ∈ A₁ → x = a ∨ x = b := fun x h h' => by + have : x ∈ A₀ ∩ A₁ := ⟨h, h'⟩ + rwa [i₀₁] at this + have ha : a ∈ A₀ ∩ A₁ := by rw [i₀₁]; simp + have hb : b ∈ A₀ ∩ A₁ := by rw [i₀₁]; simp + have ha₂ : a ∈ A₁ ∩ A₂ := by rw [i₁₂]; simp + have hb₂ : b ∈ A₁ ∩ A₂ := by rw [i₁₂]; simp + -- The inner parts of `A₀` and `A₁` lie outside `Δ₀` and `Δ₁`. + have out₀ : Disjoint (A₀ \ {a, b}) Δ₀ := by + have hdis : Disjoint (A₀ \ {a, b}) (frontier Δ₀) := by + rw [f₀, disjoint_left] + rintro x ⟨hx, hxn⟩ (h' | h') + · exact hxn (m₀ x hx h') + · exact hxn (m₂ x h' hx) + refine (subset_or_disjoint_of_frontier c₀ (IsLineWithEnds.isPreconnected_sdiff_pair l₀) + hdis).resolve_left ?_ + intro hsub + refine h₀ fun x hx => ?_ + by_cases hxab : x ∈ ({a, b} : Set S) + · rcases hxab with rfl | rfl + · exact sub₀ (Or.inl ha.2) + · exact sub₀ (Or.inl hb.2) + · exact hsub ⟨hx, hxab⟩ + have out₁ : Disjoint (A₁ \ {a, b}) Δ₁ := by + have hdis : Disjoint (A₁ \ {a, b}) (frontier Δ₁) := by + rw [f₁, disjoint_left] + rintro x ⟨hx, hxn⟩ (h' | h') + · exact hxn (m₁ x hx h') + · exact hxn (m₀ x h' hx) + refine (subset_or_disjoint_of_frontier c₁ (IsLineWithEnds.isPreconnected_sdiff_pair l₁) + hdis).resolve_left ?_ + intro hsub + refine h₁ fun x hx => ?_ + by_cases hxab : x ∈ ({a, b} : Set S) + · rcases hxab with rfl | rfl + · exact sub₁ (Or.inl ha₂.2) + · exact sub₁ (Or.inl hb₂.2) + · exact hsub ⟨hx, hxab⟩ + -- So the interior of `Δ₁` misses `Δ₀`. + have hint : Disjoint (Δ₁ \ frontier Δ₁) Δ₀ := by + have hdis : Disjoint (Δ₁ \ frontier Δ₁) (frontier Δ₀) := by + rw [f₀, disjoint_left] + rintro x ⟨hxD, hxf⟩ (h' | h') + · by_cases hxab : x ∈ ({a, b} : Set S) + · apply hxf + rw [f₁] + rcases hxab with rfl | rfl + · exact Or.inl ha₂.2 + · exact Or.inl hb₂.2 + · exact disjoint_left.mp out₁ ⟨h', hxab⟩ hxD + · exact hxf (f₁ ▸ Or.inl h') + refine (subset_or_disjoint_of_frontier c₀ (IsClosedDisc.isPreconnected_diff_frontier hS d₁) + hdis).resolve_left ?_ + intro hsub + refine h₀ fun x hx => ?_ + have hxD : x ∈ Δ₁ := sub₁ (Or.inr hx) + exact c₀.closure_subset_iff.mpr hsub (IsClosedDisc.subset_closure_diff_frontier hS d₁ hxD) + have hcap : Δ₀ ∩ Δ₁ = A₂ := by + apply subset_antisymm + · rintro x ⟨hx₀, hx₁⟩ + have hxf : x ∈ frontier Δ₁ := by + by_contra hn + exact disjoint_left.mp hint ⟨hx₁, hn⟩ hx₀ + rw [f₁] at hxf + rcases hxf with h' | h' + · exact h' + · by_cases hxab : x ∈ ({a, b} : Set S) + · rcases hxab with rfl | rfl + · exact ha₂.2 + · exact hb₂.2 + · exact absurd hx₀ (disjoint_left.mp out₀ ⟨h', hxab⟩) + · exact fun x hx => ⟨sub₀ (Or.inr hx), sub₁ (Or.inl hx)⟩ + exact ⟨hcap, out₀, out₁⟩ + +/-- The union of two theta-face discs is a disc bounded by the two unshared arcs. -/ +theorem theta_glue_discs [T2Space S] (hS : IsClosedSurface S) {A₀ A₁ A₂ Δ₀ Δ₁ : Set S} {a b : S} + (l₀ : IsLineWithEnds A₀ a b) (l₁ : IsLineWithEnds A₁ a b) (l₂ : IsLineWithEnds A₂ a b) + (i₀₁ : A₀ ∩ A₁ = {a, b}) (i₁₂ : A₁ ∩ A₂ = {a, b}) (i₂₀ : A₂ ∩ A₀ = {a, b}) + (d₀ : IsClosedDisc Δ₀) (d₁ : IsClosedDisc Δ₁) + (f₀ : frontier Δ₀ = A₁ ∪ A₂) (f₁ : frontier Δ₁ = A₂ ∪ A₀) + (h₀ : ¬ A₀ ⊆ Δ₀) (h₁ : ¬ A₁ ⊆ Δ₁) : + IsClosedDisc (Δ₀ ∪ Δ₁) ∧ discBd (Δ₀ ∪ Δ₁) = A₀ ∪ A₁ ∧ + Δ₀ ∩ Δ₁ = A₂ ∧ Disjoint (A₀ \ {a, b}) Δ₀ ∧ Disjoint (A₁ \ {a, b}) Δ₁ := by + obtain ⟨hcap, out₀, out₁⟩ := + theta_disc_intersection hS l₀ l₁ i₀₁ i₁₂ i₂₀ d₀ d₁ f₀ f₁ h₀ h₁ + have m₂ : ∀ x, x ∈ A₂ → x ∈ A₀ → x = a ∨ x = b := fun x h h' => by + have : x ∈ A₂ ∩ A₀ := ⟨h, h'⟩ + rwa [i₂₀] at this + have m₁ : ∀ x, x ∈ A₁ → x ∈ A₂ → x = a ∨ x = b := fun x h h' => by + have : x ∈ A₁ ∩ A₂ := ⟨h, h'⟩ + rwa [i₁₂] at this + have ha : a ∈ A₀ ∩ A₁ := by rw [i₀₁]; simp + have hb : b ∈ A₀ ∩ A₁ := by rw [i₀₁]; simp + have e₀ := IsClosedDisc.frontier_eq_discBd hS d₀ + have e₁ := IsClosedDisc.frontier_eq_discBd hS d₁ + obtain ⟨dU, hU⟩ := disc_union Δ₀ Δ₁ A₂ a b d₀ d₁ l₂ hcap + (by rw [← e₀, f₀]; exact subset_union_right) (by rw [← e₁, f₁]; exact subset_union_left) + have hbd : discBd (Δ₀ ∪ Δ₁) = A₀ ∪ A₁ := by + rw [hU, ← e₀, ← e₁, f₀, f₁] + ext x + constructor + · rintro ⟨(h' | h') | h' | h', hn⟩ + · exact Or.inr h' + · have hab : x ∈ ({a, b} : Set S) := by + by_contra hab + exact hn ⟨h', hab⟩ + rcases hab with rfl | rfl + · exact Or.inr ha.2 + · exact Or.inr hb.2 + · have hab : x ∈ ({a, b} : Set S) := by + by_contra hab + exact hn ⟨h', hab⟩ + rcases hab with rfl | rfl + · exact Or.inr ha.2 + · exact Or.inr hb.2 + · exact Or.inl h' + · rintro (h' | h') + · refine ⟨Or.inr (Or.inr h'), fun hx => hx.2 (m₂ x hx.1 h')⟩ + · refine ⟨Or.inl (Or.inl h'), fun hx => hx.2 (m₁ x h' hx.1)⟩ + exact ⟨dU, hbd, hcap, out₀, out₁⟩ + +/-- Let `A₀, A₁, A₂` be lines with common ends and otherwise disjoint, and let `Δ_i` be a closed +disc +with boundary the union of the other two lines. If `A_i ⊄ Δ_i` for each `i`, then `Δ₀ ∪ Δ₁` is a +closed disc, other +than `Δ₂`, with the same boundary as `Δ₂`. -/ +theorem theta_union (hS : IsClosedSurface S) {A₀ A₁ A₂ Δ₀ Δ₁ Δ₂ : Set S} {a b : + S} + (l₀ : IsLineWithEnds A₀ a b) (l₁ : IsLineWithEnds A₁ a b) (l₂ : IsLineWithEnds A₂ a b) + (i₀₁ : A₀ ∩ A₁ = {a, b}) (i₁₂ : A₁ ∩ A₂ = {a, b}) (i₂₀ : A₂ ∩ A₀ = {a, b}) + (d₀ : IsClosedDisc Δ₀) (d₁ : IsClosedDisc Δ₁) (d₂ : IsClosedDisc Δ₂) + (f₀ : frontier Δ₀ = A₁ ∪ A₂) (f₁ : frontier Δ₁ = A₂ ∪ A₀) (f₂ : frontier Δ₂ = A₀ ∪ A₁) + (h₀ : ¬ A₀ ⊆ Δ₀) (h₁ : ¬ A₁ ⊆ Δ₁) (h₂ : ¬ A₂ ⊆ Δ₂) : + IsClosedDisc (Δ₀ ∪ Δ₁) ∧ discBd (Δ₀ ∪ Δ₁) = discBd Δ₂ ∧ Δ₀ ∪ Δ₁ ≠ Δ₂ := by + have : T2Space S := hS.2.1 + obtain ⟨dU, hbd, -, -, -⟩ := theta_glue_discs hS l₀ l₁ l₂ i₀₁ i₁₂ i₂₀ d₀ d₁ f₀ f₁ h₀ h₁ + have sub₀ : A₁ ∪ A₂ ⊆ Δ₀ := f₀ ▸ d₀.isCompact.isClosed.frontier_subset + exact ⟨dU, hbd.trans (f₂.symm.trans (IsClosedDisc.frontier_eq_discBd hS d₂)), + fun heq => h₂ fun x hx => heq ▸ Or.inl (sub₀ (Or.inr hx))⟩ + +/-- Under the hypotheses of `theta_union`, the three discs cover `Σ`. -/ +theorem theta_cover [ConnectedSpace S] (hS : IsClosedSurface S) {A₀ A₁ A₂ Δ₀ Δ₁ Δ₂ : Set S} {a b : + S} + (l₀ : IsLineWithEnds A₀ a b) (l₁ : IsLineWithEnds A₁ a b) (l₂ : IsLineWithEnds A₂ a b) + (i₀₁ : A₀ ∩ A₁ = {a, b}) (i₁₂ : A₁ ∩ A₂ = {a, b}) (i₂₀ : A₂ ∩ A₀ = {a, b}) + (d₀ : IsClosedDisc Δ₀) (d₁ : IsClosedDisc Δ₁) (d₂ : IsClosedDisc Δ₂) + (f₀ : frontier Δ₀ = A₁ ∪ A₂) (f₁ : frontier Δ₁ = A₂ ∪ A₀) (f₂ : frontier Δ₂ = A₀ ∪ A₁) + (h₀ : ¬ A₀ ⊆ Δ₀) (h₁ : ¬ A₁ ⊆ Δ₁) (h₂ : ¬ A₂ ⊆ Δ₂) : Δ₀ ∪ Δ₁ ∪ Δ₂ = univ := by + obtain ⟨dU, hbd, hne⟩ := theta_union hS l₀ l₁ l₂ i₀₁ i₁₂ i₂₀ d₀ d₁ d₂ f₀ f₁ f₂ h₀ h₁ h₂ + exact cover_of_discBd_eq hS dU d₂ hbd hne + +section Paths + +variable [T2Space S] + +omit [T2Space S] in +theorem mem_V_of_mem_support {Γ : Drawing S} {a b : S} (W : GraphWalk Γ.toGraph a b) {x : S} + (hx : x ∈ W.support) : x ∈ Γ.V := by + induction W with + | nil h => + rcases List.mem_singleton.mp hx with rfl + exact h + | @cons a y b e hl r ih => + rcases List.mem_cons.mp hx with rfl | hx + · exact hl.2.1 + · exact ih hx + +omit [T2Space S] in +/-- A vertex in the closure of an edge of a walk is on the walk. -/ +theorem mem_support_of_mem_edges {Γ : Drawing S} {a b : S} (W : GraphWalk Γ.toGraph a b) {f : Set S} + (hf : f ∈ W.edges) {x : S} (hxf : x ∈ closure f) (hxV : x ∈ Γ.V) : x ∈ W.support := by + induction W with + | nil _ => simp [GraphWalk.edges] at hf + | @cons a y b e hl r ih => + rcases List.mem_cons.mp hf with rfl | hf + · have : x ∈ closure f ∩ Γ.V := ⟨hxf, hxV⟩ + rw [hl.2.2.2] at this + rcases this with rfl | rfl + · exact (GraphWalk.cons hl r).start_mem_support + · exact List.mem_cons_of_mem _ r.start_mem_support + · exact List.mem_cons_of_mem _ (ih hf) + +/-- The union of the vertices and edges of a path with distinct ends is a line between them. -/ +theorem walk_isLine (Γ : Drawing S) {a b : S} (W : GraphWalk Γ.toGraph a b) (hW : W.IsSimple) + (hab : a ≠ b) : IsLineWithEnds ({x | x ∈ W.support} ∪ ⋃ e ∈ {e | e ∈ W.edges}, closure e) a b + := by + induction W with + | nil _ => exact absurd rfl hab + | @cons a y b e hl r ih => + have hnd : a ∉ r.support ∧ r.IsSimple := by + have := List.nodup_cons.mp hW + exact ⟨this.1, this.2⟩ + have hay : a ≠ y := fun h => hnd.1 (h ▸ r.start_mem_support) + have hline : IsLineWithEnds (closure e) y a := by + rcases Γ.edge_cond e hl.1 with ⟨u, v, -, hcap, hL⟩ | ⟨u, hcap, -⟩ + · have heq : ({u, v} : Set S) = {a, y} := hcap.symm.trans hl.2.2.2 + have hu : u ∈ ({a, y} : Set S) := heq ▸ mem_insert u _ + have hv : v ∈ ({a, y} : Set S) := heq ▸ mem_insert_of_mem u rfl + have ha : a ∈ ({u, v} : Set S) := heq ▸ mem_insert a _ + have hy : y ∈ ({u, v} : Set S) := heq ▸ mem_insert_of_mem a rfl + rcases hu with rfl | rfl + · rcases hy with rfl | rfl + · exact absurd rfl hay + · exact GraphMinor.GM11.IsLineWithEnds.symm hL + · rcases ha with rfl | rfl + · exact absurd rfl hay + · exact hL + · exfalso + have heq : ({u} : Set S) = {a, y} := hcap.symm.trans hl.2.2.2 + have h₁ : a ∈ ({u} : Set S) := heq ▸ mem_insert a _ + have h₂ : y ∈ ({u} : Set S) := heq ▸ mem_insert_of_mem a rfl + exact hay (h₁.trans h₂.symm) + have hae : a ∈ closure e := by + have : a ∈ closure e ∩ Γ.V := by rw [hl.2.2.2]; exact mem_insert a _ + exact this.1 + have hye : y ∈ closure e := by + have : y ∈ closure e ∩ Γ.V := by rw [hl.2.2.2]; exact mem_insert_of_mem a rfl + exact this.1 + have hcons : ({x | x ∈ (GraphWalk.cons hl r).support} ∪ + ⋃ f ∈ {f | f ∈ (GraphWalk.cons hl r).edges}, closure f) = + closure e ∪ ({x | x ∈ r.support} ∪ ⋃ f ∈ {f | f ∈ r.edges}, closure f) := by + ext x + constructor + · rintro (hx | hx) + · rcases List.mem_cons.mp hx with rfl | hx + · exact Or.inl hae + · exact Or.inr (Or.inl hx) + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + rcases List.mem_cons.mp hf with rfl | hf + · exact Or.inl hxf + · exact Or.inr (Or.inr (mem_iUnion₂.mpr ⟨f, hf, hxf⟩)) + · rintro (hx | hx | hx) + · exact Or.inr (mem_iUnion₂.mpr ⟨e, List.mem_cons_self .., hx⟩) + · exact Or.inl (List.mem_cons_of_mem _ hx) + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + exact Or.inr (mem_iUnion₂.mpr ⟨f, List.mem_cons_of_mem _ hf, hxf⟩) + rw [hcons] + have hcap : closure e ∩ ({x | x ∈ r.support} ∪ ⋃ f ∈ {f | f ∈ r.edges}, closure f) = {y} := by + apply subset_antisymm + · rintro x ⟨hxe, hx⟩ + have hV : x ∈ Γ.V → x = y := fun hxV => by + have h₁ : x ∈ closure e ∩ Γ.V := ⟨hxe, hxV⟩ + rw [hl.2.2.2] at h₁ + rcases h₁ with rfl | h₁ + · exfalso + rcases hx with hx | hx + · exact hnd.1 hx + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + exact hnd.1 (mem_support_of_mem_edges r hf hxf hxV) + · exact h₁ + by_cases hxV : x ∈ Γ.V + · exact hV hxV + · exfalso + rcases hx with hx | hx + · exact hxV (mem_V_of_mem_support r hx) + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + have hfE : f ∈ Γ.E := mem_E_of_mem_edges r hf + have h₁ : x ∈ e := by + rw [← Γ.closure_diff_V hl.1] + exact ⟨hxe, hxV⟩ + have h₂ : x ∈ f := by + rw [← Γ.closure_diff_V hfE] + exact ⟨hxf, hxV⟩ + have := Γ.edge_eq_of_mem hl.1 hfE h₁ h₂ + subst this + exact hnd.1 (mem_support_of_mem_edges r hf hae hl.2.1) + · rintro x rfl + exact ⟨hye, Or.inl r.start_mem_support⟩ + by_cases hyb : y = b + · subst hyb + cases r with + | nil h => + have : closure e ∪ ({x | x ∈ (GraphWalk.nil h).support} ∪ + ⋃ f ∈ {f | f ∈ (GraphWalk.nil h : GraphWalk Γ.toGraph y y).edges}, closure f) = + closure e := by + refine union_eq_left.mpr (union_subset ?_ ?_) + · intro x hx + rcases List.mem_singleton.mp hx with rfl + exact hye + · intro x hx + obtain ⟨f, hf, -⟩ := mem_iUnion₂.mp hx + exact absurd hf (List.not_mem_nil) + rw [this] + exact GraphMinor.GM11.IsLineWithEnds.symm hline + | cons h r' => + exfalso + have := (List.nodup_cons.mp hnd.2).1 + exact this r'.end_mem_support + · exact GraphMinor.GM11.IsLineWithEnds.union hline (ih hnd.2 hyb) hcap + +omit [T2Space S] in +/-- A path of positive length has distinct ends. -/ +theorem ne_of_isPathBetween {P : Drawing S} {a b : S} (hP : P.IsPathBetween a b) + (hl : 0 < P.length) : a ≠ b := by + rintro rfl + obtain ⟨W, hW, -, hE⟩ := hP + cases W with + | nil _ => + rw [Drawing.length, hE] at hl + simp [GraphWalk.edges] at hl + | cons h r => + exact (List.nodup_cons.mp hW).1 r.end_mem_support + +/-- A path of positive length is a line between its ends. -/ +theorem isLine_of_isPathBetween {P : Drawing S} {a b : S} (hP : P.IsPathBetween a b) + (hab : a ≠ b) : IsLineWithEnds P.U a b := by + obtain ⟨W, hW, hV, hE⟩ := hP + have := walk_isLine P W hW hab + rwa [← hV, ← hE, ← Drawing.U_eq] at this + +omit [T2Space S] in +/-- Two subdrawings of a drawing without common edges meet only in common vertices. -/ +theorem U_inter_of_disjoint {Γ C D : Drawing S} (hC : C.IsSubdrawing Γ) (hD : D.IsSubdrawing Γ) + (hE : Disjoint C.E D.E) : C.U ∩ D.U = C.V ∩ D.V := by + apply subset_antisymm + · rintro x ⟨hxC, hxD⟩ + have key : ∀ {C D : Drawing S}, C.IsSubdrawing Γ → D.IsSubdrawing Γ → x ∈ C.U → x ∈ D.U → + x ∉ C.V → ∃ f ∈ C.E, x ∈ f ∧ x ∉ D.V := by + intro C D hC hD hxC hxD hn + obtain ⟨f, hf, hxf⟩ := C.exists_edge_of_mem hxC hn + exact ⟨f, hf, hxf, fun h => ((hC.2 hf).2.1 hxf).2 (hD.1 h)⟩ + by_cases h₁ : x ∈ C.V + · by_cases h₂ : x ∈ D.V + · exact ⟨h₁, h₂⟩ + · obtain ⟨g, hg, hxg, -⟩ := key hD hC hxD hxC h₂ + exact absurd (hC.1 h₁) ((hD.2 hg).2.1 hxg).2 + · obtain ⟨f, hf, hxf, hn⟩ := key hC hD hxC hxD h₁ + obtain ⟨g, hg, hxg⟩ := D.exists_edge_of_mem hxD hn + have := Γ.edge_eq_of_mem (hC.2 hf) (hD.2 hg) hxf hxg + exact absurd (this ▸ hg) (disjoint_left.mp hE hf) + · exact fun x hx => ⟨C.V_subset_U hx.1, D.V_subset_U hx.2⟩ + +end Paths + +/-- Two lines with the same two ends and nothing else in common form an `O`-arc. -/ +theorem isOArc_union [T2Space S] {L₁ L₂ : Set S} {a b : S} (h₁ : IsLineWithEnds L₁ a b) + (h₂ : IsLineWithEnds L₂ a b) (hcap : L₁ ∩ L₂ ⊆ {a, b}) : IsOArc (L₁ ∪ L₂) := by + obtain ⟨f₁, a₁, b₁⟩ := h₁ + obtain ⟨f₂, a₂, b₂⟩ := h₂ + let I := unitInterval + -- The loop that runs along `L₁` and back along `L₂`. + let up : I → I := fun t => Set.projIcc 0 1 zero_le_one (2 * t.1) + let dn : I → I := fun t => Set.projIcc 0 1 zero_le_one (2 - 2 * t.1) + let γ : I → S := fun t => if t.1 ≤ 1 / 2 then (f₁ (up t)).1 else (f₂ (dn t)).1 + have hup : ∀ t : I, t.1 ≤ 1 / 2 → (up t).1 = 2 * t.1 := fun t ht => by + simp only [up] + rw [Set.projIcc_of_mem zero_le_one ⟨by have := t.2.1; positivity, by linarith⟩] + have hdn : ∀ t : I, 1 / 2 ≤ t.1 → (dn t).1 = 2 - 2 * t.1 := fun t ht => by + simp only [dn] + rw [Set.projIcc_of_mem zero_le_one ⟨by have := t.2.2; linarith, by linarith⟩] + have hγ : Continuous γ := by + refine Continuous.if_le ?_ ?_ continuous_subtype_val continuous_const ?_ + · exact continuous_subtype_val.comp (f₁.continuous.comp (by fun_prop)) + · exact continuous_subtype_val.comp (f₂.continuous.comp (by fun_prop)) + · intro t ht + have e₁ : up t = 1 := Subtype.ext (by rw [hup t ht.le]; rw [ht]; norm_num) + have e₂ : dn t = 1 := Subtype.ext (by rw [hdn t ht.ge]; rw [ht]; norm_num) + rw [e₁, e₂, b₁, b₂] + have hγ₀ : ∀ t : I, t.1 ≤ 1 / 2 → γ t = (f₁ (up t)).1 := fun t ht => by simp only [γ, ht, + ite_true] + have hγ₁ : ∀ t : I, ¬ t.1 ≤ 1 / 2 → γ t = (f₂ (dn t)).1 := fun t ht => by + simp only [γ, ht, ite_false] + have hup0 : ∀ t : I, t.1 ≤ 1 / 2 → up t = 0 → t = 0 := fun t ht h => by + have := congrArg Subtype.val h + rw [hup t ht] at this + exact Subtype.ext (by simpa using this) + have hup1 : ∀ t : I, t.1 ≤ 1 / 2 → up t = 1 → t.1 = 1 / 2 := fun t ht h => by + have := congrArg Subtype.val h + rw [hup t ht] at this + have h' : 2 * t.1 = 1 := this + linarith + have hdn0 : ∀ t : I, ¬ t.1 ≤ 1 / 2 → dn t = 0 → t = 1 := fun t ht h => by + have := congrArg Subtype.val h + rw [hdn t (le_of_not_ge ht)] at this + have h' : 2 - 2 * t.1 = 0 := this + exact Subtype.ext (by change t.1 = 1; linarith) + have hdn1 : ∀ t : I, ¬ t.1 ≤ 1 / 2 → dn t ≠ 1 := fun t ht h => by + have := congrArg Subtype.val h + rw [hdn t (le_of_not_ge ht)] at this + have h' : 2 - 2 * t.1 = 1 := this + exact ht (by linarith) + have cross : ∀ s t : I, s.1 ≤ 1 / 2 → ¬ t.1 ≤ 1 / 2 → γ s = γ t → s = 0 ∧ t = 1 := by + intro s t hs ht h + rw [hγ₀ s hs, hγ₁ t ht] at h + have hmem : (f₁ (up s)).1 ∈ L₁ ∩ L₂ := ⟨(f₁ _).2, h ▸ (f₂ _).2⟩ + rcases hcap hmem with h' | h' + · have e₁ : up s = 0 := f₁.injective (Subtype.ext (h'.trans a₁.symm)) + have e₂ : dn t = 0 := f₂.injective (Subtype.ext ((h.symm.trans h').trans a₂.symm)) + exact ⟨hup0 s hs e₁, hdn0 t ht e₂⟩ + · have e₂ : dn t = 1 := f₂.injective (Subtype.ext ((h.symm.trans h').trans b₂.symm)) + exact absurd e₂ (hdn1 t ht) + have hinj : ∀ s t : I, γ s = γ t → s = t ∨ (s = 0 ∧ t = 1) ∨ (s = 1 ∧ t = 0) := by + intro s t h + by_cases hs : s.1 ≤ 1 / 2 <;> by_cases ht : t.1 ≤ 1 / 2 + · rw [hγ₀ s hs, hγ₀ t ht] at h + have e : up s = up t := f₁.injective (Subtype.ext h) + have := congrArg Subtype.val e + rw [hup s hs, hup t ht] at this + exact Or.inl (Subtype.ext (by linarith)) + · exact Or.inr (Or.inl (cross s t hs ht h)) + · obtain ⟨e₁, e₂⟩ := cross t s ht hs h.symm + exact Or.inr (Or.inr ⟨e₂, e₁⟩) + · rw [hγ₁ s hs, hγ₁ t ht] at h + have e : dn s = dn t := f₂.injective (Subtype.ext h) + have := congrArg Subtype.val e + rw [hdn s (le_of_not_ge hs), hdn t (le_of_not_ge ht)] at this + exact Or.inl (Subtype.ext (by linarith)) + have hγ01 : γ 0 = γ 1 := by + have e₀ : up 0 = 0 := Subtype.ext (by rw [hup 0 (by norm_num)]; simp) + have e₁ : dn 1 = 0 := Subtype.ext (by rw [hdn 1 (by norm_num)]; norm_num) + rw [hγ₀ 0 (by norm_num), hγ₁ 1 (by norm_num), e₀, e₁, a₁, a₂] + let q : I → Circle := arcParam 1 + have hq : Continuous q := (arcParam 1).continuous + have hqs : Function.Surjective q := arcParam_surjective 1 + have hqq : Topology.IsQuotientMap q := hq.isClosedMap.isQuotientMap hq hqs + let G : Circle → S := fun z => γ (Function.surjInv hqs z) + have hGq : G ∘ q = γ := by + funext t + have hsi : q (Function.surjInv hqs (q t)) = q t := Function.surjInv_eq hqs _ + change γ (Function.surjInv hqs (q t)) = γ t + rcases arcParam_eq_iff 1 hsi with h | ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · rw [h] + · rw [h₁, h₂, hγ01] + · rw [h₁, h₂, hγ01] + have hG : Continuous G := hqq.continuous_iff.mpr (hGq ▸ hγ) + have hGi : Function.Injective G := by + intro z w h + rw [← Function.surjInv_eq hqs z, ← Function.surjInv_eq hqs w] + rcases hinj _ _ h with h' | ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · rw [h'] + · rw [h₁, h₂] + change arcParam 1 0 = arcParam 1 1 + simp + · rw [h₁, h₂] + change arcParam 1 1 = arcParam 1 0 + simp + have hrange : range G = L₁ ∪ L₂ := by + have hγr : range γ = L₁ ∪ L₂ := by + apply subset_antisymm + · rintro _ ⟨t, rfl⟩ + by_cases ht : t.1 ≤ 1 / 2 + · rw [hγ₀ t ht] + exact Or.inl (f₁ _).2 + · rw [hγ₁ t ht] + exact Or.inr (f₂ _).2 + · rintro x (hx | hx) + · obtain ⟨u, hu⟩ := f₁.surjective ⟨x, hx⟩ + let t : I := ⟨u.1 / 2, by have := u.2.1; positivity, by have := u.2.2; linarith⟩ + have ht : t.1 ≤ 1 / 2 := by + change u.1 / 2 ≤ 1 / 2 + have := u.2.2 + linarith + have e : up t = u := Subtype.ext (by + rw [hup t ht] + change 2 * (u.1 / 2) = u.1 + ring) + exact ⟨t, by rw [hγ₀ t ht, e, hu]⟩ + · obtain ⟨u, hu⟩ := f₂.surjective ⟨x, hx⟩ + by_cases hu1 : u = 1 + · subst hu1 + have hxb : x = b := by + have := congrArg Subtype.val hu + exact this.symm.trans b₂ + let t : I := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht : t.1 ≤ 1 / 2 := le_rfl + have e : up t = 1 := Subtype.ext (by + rw [hup t ht] + change (2 : ℝ) * (1 / 2) = 1 + norm_num) + exact ⟨t, by rw [hγ₀ t ht, e, b₁, hxb]⟩ + · have hu' : u.1 < 1 := lt_of_le_of_ne u.2.2 fun h => hu1 (Subtype.ext h) + let t : I := ⟨1 - u.1 / 2, by have := u.2.2; linarith, by have := u.2.1; linarith⟩ + have ht : ¬ t.1 ≤ 1 / 2 := by + change ¬ 1 - u.1 / 2 ≤ 1 / 2 + linarith + have e : dn t = u := Subtype.ext (by + rw [hdn t (le_of_not_ge ht)] + change 2 - 2 * (1 - u.1 / 2) = u.1 + ring) + exact ⟨t, by rw [hγ₁ t ht, e, hu]⟩ + rw [← hγr, ← hGq, range_comp, hqs.range_eq, image_univ] + have hemb := hG.isClosedEmbedding hGi + rw [← hrange] + exact ⟨hemb.isEmbedding.toHomeomorph⟩ + +/-- The point set `U(C)` of any circuit `C` in a Hausdorff space is an `O`-arc. -/ +theorem IsCircuit.isOArc_U [T2Space S] {C : Drawing S} (hC : C.IsCircuit) : IsOArc C.U := by + obtain ⟨e, he⟩ := IsCircuit.E_nonempty hC + rcases C.edge_cond e he with ⟨a, b, hab, hcap, hL⟩ | ⟨u, hcap, hO⟩ + · have ha : a ∈ C.V := by + have : a ∈ closure e ∩ C.V := by rw [hcap]; simp + exact this.2 + have hb : b ∈ C.V := by + have : b ∈ closure e ∩ C.V := by rw [hcap]; simp + exact this.2 + obtain ⟨P, Q, hP, hQ, hPs, hQs, -, -, hV, hE, hsup⟩ := hC.exists_two_paths ha hb hab + have hU : C.U = P.U ∪ Q.U := by + rw [← hsup, Drawing.U_eq, Drawing.sup_V hPs hQs, Drawing.sup_E hPs hQs, P.U_eq, Q.U_eq, + biUnion_union] + ext x + simp only [mem_union] + tauto + rw [hU] + exact isOArc_union (isLine_of_isPathBetween hP hab) (isLine_of_isPathBetween hQ hab) + (by rw [U_inter_of_disjoint hPs hQs hE, hV]) + · have hE : C.E = {e} := IsCircuit.E_eq_of_loop hC he hcap + have hU : C.U = closure e := by + rw [C.U_eq, hE] + refine subset_antisymm (union_subset ?_ (iUnion₂_subset fun f hf => ?_)) + (subset_union_of_subset_right (subset_biUnion_of_mem (mem_singleton e)) _) + · intro v hv + obtain ⟨W, -, hpos, -, -⟩ := exists_walk_at hC hv + cases W with + | nil _ => simp at hpos + | @cons _ w _ f h r => + have hfe : f = e := mem_singleton_iff.mp (hE ▸ h.1) + have : v ∈ closure f ∩ C.V := by rw [h.2.2.2]; simp + exact hfe ▸ this.1 + · rw [mem_singleton_iff.mp hf] + rwa [hU] + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/EdgeChart.lean b/LeanPool/GraphMinor/GM11/EdgeChart.lean new file mode 100644 index 0000000000..297d47b271 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/EdgeChart.lean @@ -0,0 +1,471 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.GlueDiscs +public import LeanPool.GraphMinor.Surface.Collar + +/-! +# A chart around a point of an edge + +`exists_edge_chart`: near a point of an edge `e` of a drawing, there is a closed disc that meets +`U(Γ)` in a +piece of `e` which is a diameter of the disc. Two facts give this. By `exists_edge_piece`, a piece +of `e` +is a chord of a small disc, so it lies in the boundary of a closed disc. A collar of this closed +disc +makes the boundary round. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval Metric + +universe u + +variable {S : Type u} [TopologicalSpace S] + +theorem cis'_eq_exp (θ : ℝ) : cis' θ = (Circle.exp θ : ℂ) := by + rw [Circle.coe_exp] + rfl + +/-- A polar coordinate chart near a point of a collared circle. -/ +theorem exists_small_polar_chart + {c : ℂ → S} {W : Set S} (hW : IsOpen W) + (hc : ContinuousOn c (closedBall (0 : ℂ) 2)) + (hcinj : InjOn c (closedBall (0 : ℂ) 2)) + {w₀ : Circle} {θ₀ : ℝ} (hw₀c : cis' θ₀ = w₀) (hpW : c w₀ ∈ W) : + ∃ ε δ : ℝ, 0 < ε ∧ + let m : ℂ → ℂ := fun z => ((1 + ε * z.im : ℝ) : ℂ) * cis' (θ₀ + δ * z.re) + (∀ z ∈ closedBall (0 : ℂ) 1, ‖m z‖ = 1 + ε * z.im) ∧ + (∀ z ∈ closedBall (0 : ℂ) 1, m z ∈ ball (0 : ℂ) 2 ∧ c (m z) ∈ W) ∧ + ContinuousOn (c ∘ m) (closedBall 0 1) ∧ InjOn (c ∘ m) (closedBall 0 1) := by + have hopen : IsOpen (ball (0 : ℂ) 2 ∩ c ⁻¹' W) := + (hc.mono ball_subset_closedBall).isOpen_inter_preimage isOpen_ball hW + have hmemw : (w₀ : ℂ) ∈ ball (0 : ℂ) 2 ∩ c ⁻¹' W := by + refine ⟨by simp, ?_⟩ + exact hpW + obtain ⟨r, hr, hball⟩ := Metric.isOpen_iff.mp hopen _ hmemw + obtain ⟨δ₁, hδ₁, hd⟩ := Metric.continuous_iff.mp continuous_cis' θ₀ (r / 2) (by positivity) + obtain ⟨ε, hε, hεr, hε1⟩ : ∃ ε : ℝ, 0 < ε ∧ ε ≤ r / 2 ∧ ε ≤ 1 / 2 := + ⟨min (r / 2) (1 / 2), by positivity, min_le_left _ _, min_le_right _ _⟩ + obtain ⟨δ, hδ, hδ₂, hδ1⟩ : ∃ δ : ℝ, 0 < δ ∧ δ < δ₁ ∧ δ ≤ 1 := + ⟨min (δ₁ / 2) 1, by positivity, (min_le_left _ _).trans_lt (by linarith), min_le_right _ _⟩ + let m : ℂ → ℂ := fun z => ((1 + ε * z.im : ℝ) : ℂ) * cis' (θ₀ + δ * z.re) + have hmc : Continuous m := by + refine Continuous.mul (Complex.continuous_ofReal.comp ?_) (continuous_cis'.comp ?_) + · exact continuous_const.add (continuous_const.mul Complex.continuous_im) + · exact continuous_const.add (continuous_const.mul Complex.continuous_re) + have hbound : ∀ z ∈ closedBall (0 : ℂ) 1, |z.re| ≤ 1 ∧ |z.im| ≤ 1 := fun z hz => by + have hn : ‖z‖ ≤ 1 := by simpa using hz + exact ⟨(Complex.abs_re_le_norm z).trans hn, (Complex.abs_im_le_norm z).trans hn⟩ + have hpos : ∀ z ∈ closedBall (0 : ℂ) 1, 0 < 1 + ε * z.im := fun z hz => by + have h₁ := abs_le.mp (hbound z hz).2 + nlinarith [h₁.1, h₁.2] + have hmn : ∀ z ∈ closedBall (0 : ℂ) 1, ‖m z‖ = 1 + ε * z.im := fun z hz => by + simp only [m, norm_mul, norm_cis', mul_one, Complex.norm_real, Real.norm_eq_abs] + exact abs_of_pos (hpos z hz) + have hmball : ∀ z ∈ closedBall (0 : ℂ) 1, m z ∈ ball (w₀ : ℂ) r := by + intro z hz + obtain ⟨h₁, h₂⟩ := hbound z hz + have h₃ : dist (θ₀ + δ * z.re) θ₀ < δ₁ := by + rw [Real.dist_eq, add_sub_cancel_left, abs_mul, abs_of_pos hδ] + nlinarith [abs_nonneg z.re] + have h₄ : ‖cis' (θ₀ + δ * z.re) - w₀‖ < r / 2 := by + have := hd _ h₃ + rwa [dist_eq_norm, hw₀c] at this + have h₅ : m z - w₀ = ((ε * z.im : ℝ) : ℂ) * cis' (θ₀ + δ * z.re) + (cis' (θ₀ + δ * z.re) - w₀) + := by + simp only [m] + push_cast + ring + have h₆ : ‖((ε * z.im : ℝ) : ℂ) * cis' (θ₀ + δ * z.re)‖ ≤ r / 2 := by + rw [norm_mul, norm_cis', mul_one, Complex.norm_real, Real.norm_eq_abs, abs_mul, abs_of_pos hε] + nlinarith [abs_nonneg z.im] + rw [mem_ball, dist_eq_norm, h₅] + exact (norm_add_le _ _).trans_lt (by linarith) + have hmW : ∀ z ∈ closedBall (0 : ℂ) 1, m z ∈ ball (0 : ℂ) 2 ∧ c (m z) ∈ W := fun z hz => + hball (hmball z hz) + have hmball2 : ∀ z ∈ closedBall (0 : ℂ) 1, m z ∈ closedBall (0 : ℂ) 2 := fun z hz => + ball_subset_closedBall (hmW z hz).1 + let G : ℂ → S := fun z => c (m z) + have hGc : ContinuousOn G (closedBall 0 1) := + hc.comp hmc.continuousOn hmball2 + have hGi : InjOn G (closedBall 0 1) := by + intro y hy z hz hyz + have h₁ : m y = m z := hcinj (hmball2 y hy) (hmball2 z hz) hyz + have h₂ : y.im = z.im := by + have := congrArg norm h₁ + rw [hmn y hy, hmn z hz] at this + exact mul_left_cancel₀ hε.ne' (add_left_cancel this) + have h₃ : cis' (θ₀ + δ * y.re) = cis' (θ₀ + δ * z.re) := by + have hne : ((1 + ε * y.im : ℝ) : ℂ) ≠ 0 := by + exact_mod_cast (hpos y hy).ne' + simp only [m, h₂] at h₁ + rw [h₂] at hne + exact mul_left_cancel₀ hne h₁ + have h₄ : Circle.exp (θ₀ + δ * y.re) = Circle.exp (θ₀ + δ * z.re) := by + apply Circle.ext + rw [← cis'_eq_exp, ← cis'_eq_exp, h₃] + obtain ⟨k, hk⟩ := Circle.exp_eq_exp.mp h₄ + have h₅ : δ * (y.re - z.re) = k * (2 * Real.pi) := by linarith + have h₆ : |y.re - z.re| ≤ 2 := by + have a₁ := abs_le.mp (hbound y hy).1 + have a₂ := abs_le.mp (hbound z hz).1 + exact abs_le.mpr ⟨by linarith, by linarith⟩ + have h₇ : |(k : ℝ) * (2 * Real.pi)| ≤ 2 := by + rw [← h₅, abs_mul, abs_of_pos hδ] + nlinarith [abs_nonneg (y.re - z.re)] + have hπ := Real.pi_gt_three + have hk0 : k = 0 := by + by_contra hk0 + have h₈ : (1 : ℝ) ≤ |(k : ℝ)| := by exact_mod_cast Int.one_le_abs hk0 + rw [abs_mul, abs_of_pos (by positivity : 0 < 2 * Real.pi)] at h₇ + nlinarith + have h₉ : δ * (y.re - z.re) = 0 := by rw [h₅, hk0]; simp + have h₁₀ : y.re = z.re := by + have := (mul_eq_zero.mp h₉).resolve_left hδ.ne' + linarith + exact Complex.ext h₁₀ h₂ + exact ⟨ε, δ, hε, hmn, hmW, hGc, hGi⟩ + +/-- The chart diameter maps to an interval of the edge with the same endpoints. -/ +theorem edge_chart_endpoints [T2Space S] + {γ : I → S} (hγ : Continuous γ) (hinj : InjOn γ (Ioo 0 1)) + {a₀ b₀ s t₀ u : I} (hIcc : Icc a₀ b₀ ⊆ Ioo 0 1) + (hpiece : ∀ {t : I}, γ t = γ t₀ → t = t₀) + {G : ℂ → S} (hGc : ContinuousOn G (closedBall 0 1)) (hGi : InjOn G (closedBall 0 1)) + (hG0 : G 0 = γ t₀) + (hreal : ∀ z ∈ closedBall (0 : ℂ) 1, z.im = 0 → G z ∈ γ '' Ioo a₀ b₀) + (havoid : ∀ z ∈ closedBall (0 : ℂ) 1, ∀ t : I, t ≤ s ∨ u ≤ t → γ t ≠ G z) : + ∃ a b : I, s < a ∧ a < t₀ ∧ t₀ < b ∧ b < u ∧ + G '' {z | z ∈ ball (0 : ℂ) 1 ∧ z.im = 0} = γ '' Ioo a b ∧ + G '' {z | z ∈ closedBall (0 : ℂ) 1 ∧ z.im = 0} = γ '' Icc a b ∧ + ((G (-1) = γ a ∧ G 1 = γ b) ∨ (G (-1) = γ b ∧ G 1 = γ a)) := by + let F := γ '' Icc a₀ b₀ + -- The parameter along the diameter. + let zv : I → ℂ := fun v => ((2 * v.1 - 1 : ℝ) : ℂ) + have hzvc : Continuous zv := Complex.continuous_ofReal.comp (by fun_prop) + have hzvi : Function.Injective zv := fun v w h => by + have h₁ : 2 * v.1 - 1 = 2 * w.1 - 1 := Complex.ofReal_injective h + exact Subtype.ext (by linarith) + have hzvb : ∀ v, zv v ∈ closedBall (0 : ℂ) 1 := fun v => by + rw [mem_closedBall, dist_zero_right, Complex.norm_real, Real.norm_eq_abs, abs_le] + have := v.2.1 + have := v.2.2 + constructor <;> linarith + have hzvim : ∀ v, (zv v).im = 0 := fun v => Complex.ofReal_im _ + have hzvex : ∀ z ∈ closedBall (0 : ℂ) 1, z.im = 0 → ∃ v, z = zv v := by + intro z hz him + have hz_norm : ‖z‖ ≤ 1 := mem_closedBall_zero_iff.mp hz + have h := abs_le.mp ((Complex.abs_re_le_norm z).trans hz_norm) + refine ⟨⟨(z.re + 1) / 2, by linarith [h.1], by linarith [h.2]⟩, Complex.ext ?_ ?_⟩ + · simp [zv] + ring + · simp [zv, him] + have hzvball : ∀ v, v ∈ Ioo (0 : I) 1 ↔ zv v ∈ ball (0 : ℂ) 1 := by + intro v + rw [mem_ball, dist_zero_right, Complex.norm_real, Real.norm_eq_abs, abs_lt] + constructor + · rintro ⟨h₁, h₂⟩ + have h₁' : (0 : ℝ) < v.1 := h₁ + have h₂' : v.1 < 1 := h₂ + constructor <;> linarith + · rintro ⟨h₁, h₂⟩ + exact ⟨show (0 : ℝ) < v.1 by linarith, show v.1 < 1 by linarith⟩ + have hIccF : ∀ v, G (zv v) ∈ F := fun v => by + obtain ⟨t, ht, hte⟩ := hreal _ (hzvb v) (hzvim v) + exact ⟨t, ⟨ht.1.le, ht.2.le⟩, hte⟩ + have hc₁ : CompactSpace (Icc a₀ b₀) := isCompact_iff_compactSpace.mp isCompact_Icc + let j : Icc a₀ b₀ → F := fun t => ⟨γ t.1, mem_image_of_mem γ t.2⟩ + have hjc : Continuous j := Continuous.subtype_mk (hγ.comp continuous_subtype_val) _ + have hjb : Function.Bijective j := by + constructor + · intro x y hxy + exact Subtype.ext (hinj (hIcc x.2) (hIcc y.2) (congrArg Subtype.val hxy)) + · rintro ⟨_, t, ht, rfl⟩ + exact ⟨⟨t, ht⟩, rfl⟩ + let q : Icc a₀ b₀ ≃ₜ F := hjc.homeoOfEquivCompactToT2 (f := Equiv.ofBijective j hjb) + let ψ : I → I := fun v => (q.symm ⟨G (zv v), hIccF v⟩).1 + have hψγ : ∀ v, γ (ψ v) = G (zv v) := fun v => + congrArg Subtype.val (q.apply_symm_apply ⟨G (zv v), hIccF v⟩) + have hψc : Continuous ψ := by + refine continuous_subtype_val.comp (q.symm.continuous.comp (Continuous.subtype_mk ?_ _)) + exact hGc.comp_continuous hzvc hzvb + have hψi : Function.Injective ψ := fun v w h => by + have h₁ : G (zv v) = G (zv w) := by rw [← hψγ, ← hψγ, h] + exact hzvi (hGi (hzvb v) (hzvb w) h₁) + have hmid : ψ ⟨1 / 2, by norm_num, by norm_num⟩ = t₀ := by + apply hpiece + rw [hψγ] + have : zv ⟨1 / 2, by norm_num, by norm_num⟩ = 0 := by simp [zv] + rw [this, hG0] + have hboth : ∀ v, s < ψ v ∧ ψ v < u := by + intro v + exact ⟨lt_of_not_ge fun h => havoid _ (hzvb v) _ (Or.inl h) (hψγ v), + lt_of_not_ge fun h => havoid _ (hzvb v) _ (Or.inr h) (hψγ v)⟩ + have hz0 : zv 0 = -1 := by simp [zv] + have hz1 : zv 1 = 1 := by + simp only [zv] + norm_num + have hmid₀ : (0 : I) < ⟨1 / 2, by norm_num, by norm_num⟩ := + show (0 : ℝ) < 1 / 2 by norm_num + have hmid₁ : (⟨1 / 2, by norm_num, by norm_num⟩ : I) < 1 := + show (1 / 2 : ℝ) < 1 by norm_num + have hrange : ∀ {a b : I}, a ∈ range ψ → b ∈ range ψ → Icc a b ⊆ range ψ := fun ha hb => + isPreconnected_range hψc |>.Icc_subset ha hb + have hseg₁ : ∀ X : Set I, G '' (zv '' X) = γ '' (ψ '' X) := by + intro X + rw [image_image, image_image] + exact image_congr fun v _ => (hψγ v).symm + have hball' : {z | z ∈ ball (0 : ℂ) 1 ∧ z.im = 0} = zv '' Ioo 0 1 := by + ext z + constructor + · rintro ⟨hz, him⟩ + obtain ⟨v, rfl⟩ := hzvex z (ball_subset_closedBall hz) him + exact ⟨v, (hzvball v).mpr hz, rfl⟩ + · rintro ⟨v, hv, rfl⟩ + exact ⟨(hzvball v).mp hv, hzvim v⟩ + have hclosed' : {z | z ∈ closedBall (0 : ℂ) 1 ∧ z.im = 0} = zv '' univ := by + ext z + constructor + · rintro ⟨hz, him⟩ + obtain ⟨v, rfl⟩ := hzvex z hz him + exact ⟨v, mem_univ _, rfl⟩ + · rintro ⟨v, -, rfl⟩ + exact ⟨hzvb v, hzvim v⟩ + rcases Continuous.strictMono_of_inj hψc hψi with hmono | hanti + · refine ⟨ψ 0, ψ 1, (hboth 0).1, ?_, ?_, (hboth 1).2, ?_, ?_, Or.inl ?_⟩ + · rw [← hmid] + exact hmono hmid₀ + · rw [← hmid] + exact hmono hmid₁ + · rw [hball', hseg₁] + congr 1 + apply subset_antisymm + · rintro _ ⟨v, hv, rfl⟩ + exact ⟨hmono hv.1, hmono hv.2⟩ + · rintro t ⟨h₁, h₂⟩ + obtain ⟨v, rfl⟩ := hrange ⟨0, rfl⟩ ⟨1, rfl⟩ (⟨h₁.le, h₂.le⟩ : t ∈ Icc (ψ 0) (ψ 1)) + exact ⟨v, ⟨hmono.lt_iff_lt.mp h₁, hmono.lt_iff_lt.mp h₂⟩, rfl⟩ + · rw [hclosed', hseg₁] + congr 1 + apply subset_antisymm + · rintro _ ⟨v, -, rfl⟩ + exact ⟨hmono.monotone v.2.1, hmono.monotone v.2.2⟩ + · rintro t ht + obtain ⟨v, rfl⟩ := hrange ⟨0, rfl⟩ ⟨1, rfl⟩ ht + exact ⟨v, mem_univ _, rfl⟩ + · exact ⟨by rw [← hz0, hψγ], by rw [hψγ 1, hz1]⟩ + · refine ⟨ψ 1, ψ 0, (hboth 1).1, ?_, ?_, (hboth 0).2, ?_, ?_, Or.inr ?_⟩ + · rw [← hmid] + exact hanti hmid₁ + · rw [← hmid] + exact hanti hmid₀ + · rw [hball', hseg₁] + congr 1 + apply subset_antisymm + · rintro _ ⟨v, hv, rfl⟩ + exact ⟨hanti hv.2, hanti hv.1⟩ + · rintro t ⟨h₁, h₂⟩ + obtain ⟨v, rfl⟩ := hrange ⟨1, rfl⟩ ⟨0, rfl⟩ (⟨h₁.le, h₂.le⟩ : t ∈ Icc (ψ 1) (ψ 0)) + exact ⟨v, ⟨hanti.lt_iff_gt.mp h₂, hanti.lt_iff_gt.mp h₁⟩, rfl⟩ + · rw [hclosed', hseg₁] + congr 1 + apply subset_antisymm + · rintro _ ⟨v, -, rfl⟩ + exact ⟨hanti.antitone v.2.2, hanti.antitone v.2.1⟩ + · rintro t ht + obtain ⟨v, rfl⟩ := hrange ⟨1, rfl⟩ ⟨0, rfl⟩ ht + exact ⟨v, mem_univ _, rfl⟩ + · exact ⟨by rw [← hz0, hψγ], by rw [hψγ 1, hz1]⟩ + +/-- A parametrization of an edge visits each interior edge point at just one parameter. -/ +theorem edge_parameter_unique (H : Drawing S) {e : Set S} (he : e ∈ H.E) + {γ : I → S} (hγ0 : γ 0 ∈ H.V) (hγ1 : γ 1 ∈ H.V) (hinj : InjOn γ (Ioo 0 1)) + {t₀ : I} (ht₀ : t₀ ∈ Ioo 0 1) (hpe : γ t₀ ∈ e) {t : I} (h : γ t = γ t₀) : + t = t₀ := by + have hmemIoo : ∀ {t : I}, γ t ∈ e → γ t ∉ H.V := fun h => (he.2.1 h).2 + have hend : ∀ {t : I}, t ∉ Ioo (0 : I) 1 → γ t ∈ H.V := by + intro t ht + have : t = 0 ∨ t = 1 := by + by_contra hc + push Not at hc + exact ht ⟨unitInterval.pos_iff_ne_zero.mpr hc.1, unitInterval.lt_one_iff_ne_one.mpr hc.2⟩ + rcases this with rfl | rfl + · exact hγ0 + · exact hγ1 + by_cases hti : t ∈ Ioo (0 : I) 1 + · exact hinj hti ht₀ h + · exact absurd (h ▸ hend hti) (hmemIoo hpe) + +/-- The drawing outside an edge segment is closed and misses a point in that segment. -/ +theorem edge_chart_avoidance [T2Space S] (H : Drawing S) {e : Set S} (he : e ∈ H.E) + {γ : I → S} (hγ : Continuous γ) {s t₀ u : I} (hpe : γ t₀ ∈ e) + (hpiece : ∀ {t : I}, γ t = γ t₀ → t = t₀) (hs : s < t₀) (hu : t₀ < u) : + let Y := (H.U \ e) ∪ γ '' {t | t ≤ s ∨ u ≤ t} + IsClosed Y ∧ γ t₀ ∉ Y := by + refine ⟨(isClosed_U_sdiff_edge H he).union + ((isClosed_Iic.union isClosed_Ici).isCompact.image hγ).isClosed, ?_⟩ + rintro (h | ⟨t, ht, hte⟩) + · exact h.2 hpe + · obtain rfl := hpiece hte + exact ht.elim (not_le.mpr hs) (not_le.mpr hu) + +/-- A collared disc gives a chart in which the real diameter traces the edge segment. -/ +theorem exists_edge_chart_in_collared_disc (H : Drawing S) + {e : Set S} {γ : I → S} (hγe : γ '' Ioo 0 1 = e) + {a₀ b₀ t₀ : I} (ha₀ : a₀ < t₀) (hb₀ : t₀ < b₀) + {W A₁ Δ₁ Δ' : Set S} (hW : IsOpen W) (hpW : γ t₀ ∈ W) (hA₁W : Disjoint A₁ W) + (hW_avoid : W ⊆ ((H.U \ e) ∪ γ '' {t | t ≤ a₀ ∨ b₀ ≤ t})ᶜ) + (hΔ₁ : IsClosedDisc Δ₁) (hΔ' : IsClosedDisc Δ') (hin : Δ₁ ⊆ Δ' \ discBd Δ') + (hbd₁ : discBd Δ₁ = A₁ ∪ γ '' Icc a₀ b₀) (hFU : γ '' Icc a₀ b₀ ⊆ H.U) : + ∃ G : ℂ → S, ContinuousOn G (closedBall 0 1) ∧ InjOn G (closedBall 0 1) ∧ G 0 = γ t₀ ∧ + G '' closedBall 0 1 ⊆ W ∧ + (∀ z ∈ closedBall (0 : ℂ) 1, z.im = 0 → G z ∈ γ '' Ioo a₀ b₀) ∧ + (∀ z ∈ closedBall (0 : ℂ) 1, G z ∈ H.U ↔ z.im = 0) := by + have hpbd : γ t₀ ∈ discBd Δ₁ := by + rw [hbd₁] + exact Or.inr (mem_image_of_mem γ ⟨ha₀.le, hb₀.le⟩) + obtain ⟨p⟩ := hΔ₁.isOArc_discBd + obtain ⟨c, c', hc, -, -, -, hl, -, -, -, hcp⟩ := + exists_disc_collar hΔ₁ hΔ' hin p + have hcinj : InjOn c (closedBall 0 2) := hl.injOn + let w₀ : Circle := p.symm ⟨γ t₀, hpbd⟩ + have hcw₀ : c w₀ = γ t₀ := by + rw [hcp] + simp [w₀] + obtain ⟨θ₀, hθ₀⟩ : ∃ θ₀ : ℝ, Circle.exp θ₀ = w₀ := + ⟨Complex.arg (w₀ : ℂ), Circle.exp_arg w₀⟩ + have hw₀c : cis' θ₀ = w₀ := by rw [cis'_eq_exp, hθ₀] + obtain ⟨ε, δ, hε, hmn, hmW, hGc, hGi⟩ := + exists_small_polar_chart hW hc hcinj hw₀c (hcw₀.symm ▸ hpW) + let m : ℂ → ℂ := fun z => ((1 + ε * z.im : ℝ) : ℂ) * cis' (θ₀ + δ * z.re) + have hmball2 : ∀ z ∈ closedBall (0 : ℂ) 1, m z ∈ closedBall (0 : ℂ) 2 := fun z hz => + ball_subset_closedBall (hmW z hz).1 + let G : ℂ → S := fun z => c (m z) + have hG0 : G 0 = γ t₀ := by + change c (m 0) = _ + have : m 0 = w₀ := by simp [m, hw₀c] + rw [this, hcw₀] + have hreal : ∀ z ∈ closedBall (0 : ℂ) 1, z.im = 0 → G z ∈ γ '' Ioo a₀ b₀ := by + intro z hz him + have hmz : m z = (Circle.exp (θ₀ + δ * z.re) : ℂ) := by + simp only [m, him, mul_zero, add_zero, Complex.ofReal_one, one_mul] + exact cis'_eq_exp _ + have hW' := (hmW z hz).2 + have hb : G z ∈ discBd Δ₁ := by + change c (m z) ∈ _ + rw [hmz, hcp] + exact (p _).2 + rw [hbd₁] at hb + rcases hb with hb | ⟨t, ht, hte⟩ + · exact absurd hW' (disjoint_left.mp hA₁W hb) + · refine ⟨t, ?_, hte⟩ + refine ⟨lt_of_le_of_ne ht.1 ?_, lt_of_le_of_ne ht.2 ?_⟩ + · rintro rfl + exact hW_avoid hW' (Or.inr ⟨_, Or.inl le_rfl, hte⟩) + · rintro rfl + exact hW_avoid hW' (Or.inr ⟨_, Or.inr le_rfl, hte⟩) + have hUiff : ∀ z ∈ closedBall (0 : ℂ) 1, G z ∈ H.U ↔ z.im = 0 := by + intro z hz + constructor + · intro hzU + have hW' := (hmW z hz).2 + have hze : G z ∈ e := by + by_contra hn + exact hW_avoid hW' (Or.inl ⟨hzU, hn⟩) + obtain ⟨t, ht, hte⟩ : G z ∈ γ '' Ioo 0 1 := hγe ▸ hze + have htab : t ∈ Icc a₀ b₀ := by + by_contra hn + have : t ≤ a₀ ∨ b₀ ≤ t := by + by_contra hc' + push Not at hc' + exact hn ⟨hc'.1.le, hc'.2.le⟩ + exact hW_avoid hW' (Or.inr ⟨t, this, hte⟩) + have hb : G z ∈ discBd Δ₁ := by + rw [hbd₁] + exact Or.inr ⟨t, htab, hte⟩ + obtain ⟨w, hw⟩ := (show ∃ w : discBd Δ₁, w.1 = G z from ⟨⟨_, hb⟩, rfl⟩) + have hcw : c (p.symm w) = G z := by + rw [hcp] + simpa using hw + have hwn : ((p.symm w : Circle) : ℂ) ∈ closedBall (0 : ℂ) 2 := by simp + have heq := hcinj hwn (hmball2 z hz) hcw + have hn₁ : ‖m z‖ = 1 + ε * z.im := hmn z hz + rw [← heq] at hn₁ + simp only [Circle.norm_coe] at hn₁ + have : ε * z.im = 0 := by linarith + exact (mul_eq_zero.mp this).resolve_left hε.ne' + · intro him + obtain ⟨t, ht, hte⟩ := hreal z hz him + exact hte ▸ hFU ⟨t, ⟨ht.1.le, ht.2.le⟩, rfl⟩ + exact ⟨G, hGc, hGi, hG0, by rintro _ ⟨z, hz, rfl⟩; exact (hmW z hz).2, hreal, hUiff⟩ + +/-- **A chart around a point of an edge.** Here `G` maps the closed unit disc of `ℂ` onto a closed +disc +around `γ t₀`. The real part of the disc is the piece of `e` from `γ a` to `γ b`, and there is no +other +point of `U(H)` in the disc. -/ +theorem exists_edge_chart (hS : IsClosedSurface S) (H : Drawing S) {e : Set S} (he : e ∈ H.E) + {γ : I → S} (hγ : Continuous γ) (hγ0 : γ 0 ∈ H.V) (hγ1 : γ 1 ∈ H.V) (hinj : InjOn γ (Ioo 0 1)) + (hγe : γ '' Ioo 0 1 = e) {s t₀ u : I} (ht₀ : t₀ ∈ Ioo (0 : I) 1) (hs : s < t₀) (hu : t₀ < u) : + ∃ (G : ℂ → S) (a b : I), ContinuousOn G (closedBall 0 1) ∧ InjOn G (closedBall 0 1) ∧ + s < a ∧ a < t₀ ∧ t₀ < b ∧ b < u ∧ G 0 = γ t₀ ∧ + (∀ z ∈ closedBall (0 : ℂ) 1, G z ∈ H.U ↔ z.im = 0) ∧ + G '' {z | z ∈ ball (0 : ℂ) 1 ∧ z.im = 0} = γ '' Ioo a b ∧ + G '' {z | z ∈ closedBall (0 : ℂ) 1 ∧ z.im = 0} = γ '' Icc a b ∧ + ((G (-1) = γ a ∧ G 1 = γ b) ∨ (G (-1) = γ b ∧ G 1 = γ a)) := by + classical + have hT2 : T2Space S := hS.2.1 + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hpe : γ t₀ ∈ e := hγe ▸ mem_image_of_mem γ ht₀ + have hpiece : ∀ {t : I}, γ t = γ t₀ → t = t₀ := + fun h => edge_parameter_unique H he hγ0 hγ1 hinj ht₀ hpe h + let Y₀ : Set S := (H.U \ e) ∪ γ '' {t | t ≤ s ∨ u ≤ t} + obtain ⟨hY₀, hpY₀⟩ := edge_chart_avoidance H he hγ hpe hpiece hs hu + obtain ⟨D, D', a₀, b₀, hD, hD', hpD', hD'D, hDO, hbdD, ha₀, hb₀, hIcc, hIoo, hFline, hFD, hFcap, + hst⟩ := + exists_edge_piece hS H he hγ hγ0 hγ1 hinj hγe ht₀ hY₀.isOpen_compl hpY₀ + (disjoint_left.mpr fun x hx h => hx (Or.inl h)) + set F : Set S := γ '' Icc a₀ b₀ with hF + obtain ⟨A₁, A₂, Δ₁, Δ₂, -, hcomp, hΔ₁, -, -, -, hbd₁, -, -⟩ := + disc_iArc D F (γ a₀) (γ b₀) hD hFD hst hFline hFcap + have hA₁ : A₁ ⊆ discBd D := by + have hmem : A₁ ∈ componentsIn (discBd D \ {γ a₀, γ b₀}) := by rw [hcomp]; simp + obtain ⟨x, -, rfl⟩ := hmem + exact (connectedComponentIn_subset _ _).trans sdiff_subset + have hA₁D' : Disjoint A₁ D' := by + refine disjoint_left.mpr fun x hx hx' => ?_ + have := hA₁ hx + rw [← hbdD] at this + exact this.2 hx' + have hFU : F ⊆ H.U := by + rintro _ ⟨t, ht, rfl⟩ + exact (he.2.1 (hγe ▸ mem_image_of_mem γ (hIcc ht))).1 + -- The rest of `U(H)`. + let Y₁ : Set S := (H.U \ e) ∪ γ '' {t | t ≤ a₀ ∨ b₀ ≤ t} + obtain ⟨hY₁, hpY₁⟩ := edge_chart_avoidance H he hγ hpe hpiece ha₀ hb₀ + let W : Set S := D' ∩ Y₁ᶜ + have hW : IsOpen W := hD'.inter hY₁.isOpen_compl + have hpW : γ t₀ ∈ W := ⟨hpD', hpY₁⟩ + have hWO : ∀ {x}, x ∈ W → x ∉ Y₀ := fun hx => hDO (hD'D hx.1) + obtain ⟨Δ', hΔ', hin, -⟩ := + exists_disc_around hman hΔ₁ (fun x _ => hS.2.2 x) isOpen_univ (subset_univ _) + obtain ⟨G, hGc, hGi, hG0, hGW, hreal, hUiff⟩ := + exists_edge_chart_in_collared_disc H hγe ha₀ hb₀ hW hpW + (hA₁D'.mono_right inter_subset_left) inter_subset_right hΔ₁ hΔ' hin hbd₁ hFU + obtain ⟨a, b, hsa, hat, htb, hbu, hball, hclosed, hends⟩ := + edge_chart_endpoints hγ hinj hIcc hpiece hGc hGi hG0 hreal + (fun z hz t ht heq => hWO (hGW (mem_image_of_mem G hz)) (Or.inr ⟨t, ht, heq⟩)) + exact ⟨G, a, b, hGc, hGi, hsa, hat, htb, hbu, hG0, hUiff, hball, hclosed, hends⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/EdgeSides.lean b/LeanPool/GraphMinor/GM11/EdgeSides.lean new file mode 100644 index 0000000000..2561e342c9 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/EdgeSides.lean @@ -0,0 +1,686 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section4b +public import LeanPool.GraphMinor.Surface.TopologyStatements +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.Disc + +/-! +# The two sides of an edge + +Graph Minors XI uses without comment that an edge of a drawing has two sides. This file proves it. + +The first lemma, `exists_half_nbhd`, looks at a point `p` of the boundary of a closed disc `Δ`, +and a closed set `B` missing `p`. Near `p`, the interior of `Δ` lies in one connected set that +avoids `B`, because in the unit disc a small ball around a boundary point cuts the open disc in a +convex set. The second, `exists_closedDisc_nbhd`, gives small closed discs around a point of a +closed +surface. The main result is `exists_edge_sides`. It cuts a small disc around `p ∈ e` along a piece +of `e`, by `DiscIArcStatement`, and applies the first lemma to the two halves. +-/ + +public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- Near a point `p` of the boundary of a closed disc `Δ`, the interior of `Δ` lies in one connected +set that avoids a given closed set `B` missing `p`. Each point of `bd(Δ)` near `p` is a limit of +that connected set. -/ +theorem exists_half_nbhd {Δ : Set S} (hΔ : IsClosedDisc Δ) + {X : Set S} (hX : IsClosed X) {p : S} (hp : p ∈ discBd Δ) (hpX : p ∉ X) : + ∃ A W : Set S, IsOpen W ∧ p ∈ W ∧ IsPreconnected A ∧ A ⊆ Δ ∧ Disjoint A (discBd Δ) ∧ + Disjoint A X ∧ (W ∩ Δ) \ discBd Δ ⊆ A ∧ W ∩ discBd Δ ⊆ closure A := by + obtain ⟨φ⟩ := hΔ + have hbd := disc_boundary Δ φ + rw [hbd] at hp ⊢ + obtain ⟨c, hc, rfl⟩ := hp + let f : ClosedUnitDisc → S := fun x => (φ x).1 + have hf : Continuous f := continuous_subtype_val.comp φ.continuous + have hfinj : Function.Injective f := fun x y h => φ.injective (Subtype.ext h) + have hopen : IsOpen {x : ClosedUnitDisc | f x ∉ X} := (hX.preimage hf).isOpen_compl + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp hopen c hpX + -- The set of points of the closed disc in the small ball, and its image in `S`. + let N : Set ClosedUnitDisc := {x | dist x c < δ} + have hNopen : IsOpen N := isOpen_lt (continuous_id.dist continuous_const) continuous_const + have hfopen : IsOpen ((fun y : Δ => (φ.symm y)) ⁻¹' N) := hNopen.preimage φ.symm.continuous + obtain ⟨W, hW, hWeq⟩ := isOpen_induced_iff.mp hfopen + have hmemW : ∀ x : ClosedUnitDisc, f x ∈ W ↔ x ∈ N := by + intro x + have := congrArg (fun T : Set Δ => φ x ∈ T) hWeq + simpa [f] using this + let O : Set EuclideanPlane := Metric.ball (c : EuclideanPlane) δ ∩ OpenUnitDisc + have hOconv : Convex ℝ O := (convex_ball _ _).inter convex_openUnitDisc + have hOsub : O ⊆ ClosedUnitDisc := fun x hx => Metric.ball_subset_closedBall hx.2 + let O' : Set ClosedUnitDisc := Subtype.val ⁻¹' O + have hO'conn : IsPreconnected O' := by + have hemb : IsInducing (Subtype.val : ClosedUnitDisc → EuclideanPlane) := IsInducing.subtypeVal + refine hemb.isPreconnected_image.mp ?_ + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hOsub] + exact hOconv.isPreconnected + refine ⟨f '' O', W, hW, ?_, hO'conn.image _ hf.continuousOn, ?_, ?_, ?_, ?_, ?_⟩ + · exact (hmemW c).mpr (by simp [N, hδ]) + · rintro _ ⟨x, -, rfl⟩ + exact (φ x).2 + · refine disjoint_left.mpr ?_ + rintro _ ⟨x, hx, rfl⟩ ⟨y, hy, hxy⟩ + have heq : y = x := hfinj hxy + subst heq + have h₁ : ‖y.1‖ < 1 := by simpa [OpenUnitDisc] using hx.2 + have h₂ : ‖y.1‖ = 1 := by simpa [UnitCircle] using hy + linarith + · refine disjoint_left.mpr ?_ + rintro _ ⟨x, hx, rfl⟩ hxX + exact hball (show dist x c < δ from hx.1) hxX + · rintro q ⟨⟨hqW, hqΔ⟩, hqbd⟩ + let y : ClosedUnitDisc := φ.symm ⟨q, hqΔ⟩ + have hqy : f y = q := by simp [f, y] + rw [← hqy] at hqW hqbd + have hyN := (hmemW y).mp hqW + refine ⟨y, ⟨hyN, ?_⟩, hqy⟩ + have hle : ‖y.1‖ ≤ 1 := by simpa [ClosedUnitDisc] using y.2 + have hne : ‖y.1‖ ≠ 1 := by + intro h + exact hqbd ⟨y, by simpa [UnitCircle] using h, rfl⟩ + simpa [OpenUnitDisc] using lt_of_le_of_ne hle hne + · rintro _ ⟨hqW, x, hx, rfl⟩ + have hxN := (hmemW x).mp hqW + refine image_closure_subset_closure_image hf ⟨x, ?_, rfl⟩ + -- `x` is a limit of points of the open disc inside the small ball. + rw [closure_subtype] + have hxc : (x : EuclideanPlane) ∈ Metric.ball (c : EuclideanPlane) δ := hxN + have hcl : (x : EuclideanPlane) ∈ closure (OpenUnitDisc : Set EuclideanPlane) := by + have : closure (OpenUnitDisc : Set EuclideanPlane) = ClosedUnitDisc := + closure_ball _ one_ne_zero + rw [this] + exact x.2 + have := Metric.isOpen_ball.inter_closure ⟨hxc, hcl⟩ + rwa [Subtype.image_preimage_coe, inter_eq_right.mpr hOsub] + +/-- Small closed discs around a point of a closed surface. Inside any open set around `p` there is a +closed disc with an open core around `p`, whose boundary is the rest of the disc. -/ +theorem exists_closedDisc_nbhd (hS : IsClosedSurface S) {O : Set S} + (hO : IsOpen O) {p : S} (hp : p ∈ O) : + ∃ D D' : Set S, IsClosedDisc D ∧ IsOpen D' ∧ p ∈ D' ∧ D' ⊆ D ∧ D ⊆ O ∧ D \ D' = discBd D := by + obtain ⟨V, hV, hpV, ⟨h⟩⟩ := hS.2.2 p + have : T2Space S := hS.2.1 + let c : OpenUnitDisc := h ⟨p, hpV⟩ + -- The open set in the plane that corresponds to `O ∩ V`. + let P : Set OpenUnitDisc := {x | (h.symm x).1 ∈ O} + have hP : IsOpen P := hO.preimage (continuous_subtype_val.comp h.symm.continuous) + have hP' : IsOpen (Subtype.val '' P : Set EuclideanPlane) := + Metric.isOpen_ball.isOpenEmbedding_subtypeVal.isOpenMap _ hP + have hc : (c : EuclideanPlane) ∈ (Subtype.val '' P : Set EuclideanPlane) := + ⟨c, by simpa [P, c] using hp, rfl⟩ + obtain ⟨ρ', hρ', hball⟩ := Metric.isOpen_iff.mp hP' _ hc + let ρ : ℝ := ρ' / 2 + have hρ : 0 < ρ := half_pos hρ' + have hclosed : Metric.closedBall (c : EuclideanPlane) ρ ⊆ Subtype.val '' P := + (Metric.closedBall_subset_ball (half_lt_self hρ')).trans hball + have hto : Metric.closedBall (c : EuclideanPlane) ρ ⊆ OpenUnitDisc := by + rintro x hx + obtain ⟨y, -, rfl⟩ := hclosed hx + exact y.2 + -- The map from the unit disc to the plane. + let g : EuclideanPlane → EuclideanPlane := fun x => (c : EuclideanPlane) + ρ • x + have hg : Continuous g := by fun_prop + have hgin : ∀ x : EuclideanPlane, g x ∈ Metric.closedBall (c : EuclideanPlane) ρ ↔ + x ∈ ClosedUnitDisc := by + intro x + simp only [g, Metric.mem_closedBall, dist_eq_norm, add_sub_cancel_left, ClosedUnitDisc, + sub_zero, norm_smul, Real.norm_eq_abs, abs_of_pos hρ] + exact ⟨fun h' => le_of_mul_le_mul_left (by simpa using h') hρ, + fun h' => by nlinarith⟩ + have hgball : ∀ x : EuclideanPlane, g x ∈ Metric.ball (c : EuclideanPlane) ρ ↔ + x ∈ OpenUnitDisc := by + intro x + simp only [g, Metric.mem_ball, dist_eq_norm, add_sub_cancel_left, OpenUnitDisc, + sub_zero, norm_smul, Real.norm_eq_abs, abs_of_pos hρ] + exact ⟨fun h' => lt_of_mul_lt_mul_left (by simpa using h') hρ.le, + fun h' => by nlinarith⟩ + have hginj : Function.Injective g := by + intro x y hxy + have := add_left_cancel hxy + exact smul_right_injective _ hρ.ne' this + let k : ClosedUnitDisc → S := fun x => + (h.symm ⟨g x.1, hto ((hgin x.1).mpr x.2)⟩).1 + have hk : Continuous k := by + refine continuous_subtype_val.comp (h.symm.continuous.comp ?_) + exact Continuous.subtype_mk (hg.comp continuous_subtype_val) _ + have hkinj : Function.Injective k := by + intro x y hxy + have h₁ := h.symm.injective (Subtype.ext hxy) + exact Subtype.ext (hginj (congrArg Subtype.val h₁)) + have : CompactSpace ClosedUnitDisc := + isCompact_iff_compactSpace.mp (isCompact_closedBall (0 : EuclideanPlane) 1) + -- `D` is the image of `k`, and `D'` the image of the open ball. + let D : Set S := range k + have hk' : Continuous (rangeFactorization k) := hk.rangeFactorization + let E : ClosedUnitDisc ≃ₜ D := + Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofInjective k hkinj) hk' + have hEv : ∀ x, (E x : S) = k x := fun _ => rfl + let D' : Set S := Subtype.val '' ((fun y : V => (h y : EuclideanPlane)) ⁻¹' + Metric.ball (c : EuclideanPlane) ρ) + have hD'open : IsOpen D' := by + refine hV.isOpenEmbedding_subtypeVal.isOpenMap _ (Metric.isOpen_ball.preimage ?_) + exact continuous_subtype_val.comp h.continuous + have hkD' : ∀ x : ClosedUnitDisc, k x ∈ D' ↔ x.1 ∈ OpenUnitDisc := by + intro x + rw [← hgball] + constructor + · rintro ⟨y, hy, hyx⟩ + have : y = h.symm ⟨g x.1, hto ((hgin x.1).mpr x.2)⟩ := Subtype.ext hyx + rw [this] at hy + simpa using hy + · intro hx + refine ⟨h.symm ⟨g x.1, hto ((hgin x.1).mpr x.2)⟩, ?_, rfl⟩ + simpa using hx + have hbd := disc_boundary D E + refine ⟨D, D', ⟨E⟩, hD'open, ⟨⟨p, hpV⟩, by simp [c, hρ], rfl⟩, ?_, ?_, ?_⟩ + · rintro _ ⟨y, hy, rfl⟩ + have hy' : (h y : EuclideanPlane) ∈ Metric.ball (c : EuclideanPlane) ρ := hy + let x : EuclideanPlane := ρ⁻¹ • ((h y : EuclideanPlane) - c) + have hgx : g x = (h y : EuclideanPlane) := by + simp only [g, x, smul_smul, mul_inv_cancel₀ hρ.ne', one_smul, add_sub_cancel] + have hxm : x ∈ OpenUnitDisc := by + rw [← hgball, hgx] + exact hy' + refine ⟨⟨x, Metric.ball_subset_closedBall hxm⟩, ?_⟩ + have : (⟨g x, hto ((hgin x).mpr (Metric.ball_subset_closedBall hxm))⟩ : OpenUnitDisc) = h y := + Subtype.ext hgx + simp only [k, this, Homeomorph.symm_apply_apply] + · rintro _ ⟨x, rfl⟩ + obtain ⟨y, hy, hyx⟩ := hclosed ((hgin x.1).mpr x.2) + have : y = ⟨g x.1, hto ((hgin x.1).mpr x.2)⟩ := Subtype.ext hyx + rw [this] at hy + exact hy + · rw [hbd] + ext q + constructor + · rintro ⟨⟨x, rfl⟩, hq⟩ + refine ⟨x, ?_, rfl⟩ + have hle : ‖x.1‖ ≤ 1 := by simpa [ClosedUnitDisc] using x.2 + have hne : ¬ ‖x.1‖ < 1 := fun hlt => hq ((hkD' x).mpr (by simpa [OpenUnitDisc] using hlt)) + have : ‖x.1‖ = 1 := le_antisymm hle (not_lt.mp hne) + simpa [UnitCircle] using this + · rintro ⟨x, hx, rfl⟩ + refine ⟨⟨x, rfl⟩, fun hin => ?_⟩ + have h₁ : ‖x.1‖ < 1 := by simpa [OpenUnitDisc] using (hkD' x).mp hin + have h₂ : ‖x.1‖ = 1 := by simpa [UnitCircle] using hx + linarith + +variable [T2Space S] + +/-- `U(Γ)` minus an edge is closed. -/ +theorem isClosed_U_sdiff_edge (Γ : Drawing S) {e : Set S} (he : e ∈ Γ.E) : IsClosed (Γ.U \ e) := by + have hEq : Γ.U \ e = Γ.V ∪ ⋃ f ∈ Γ.E \ {e}, closure f := by + ext x + constructor + · rintro ⟨hx, hxe⟩ + by_cases hxV : x ∈ Γ.V + · exact Or.inl hxV + rw [Γ.U_eq] at hx + rcases hx with hx | hx + · exact absurd hx hxV + obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + refine Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, ?_⟩, hxf⟩) + rintro rfl + exact hxe (by rw [← Γ.closure_diff_V hf]; exact ⟨hxf, hxV⟩) + · rintro (hx | hx) + · exact ⟨Γ.V_subset_U hx, fun hxe => (he.2.1 hxe).2 hx⟩ + · obtain ⟨f, ⟨hf, hfe⟩, hxf⟩ := mem_iUnion₂.mp hx + refine ⟨Γ.closure_subset_U hf hxf, fun hxe => ?_⟩ + have hxV : x ∉ Γ.V := (he.2.1 hxe).2 + have hxf' : x ∈ f := by rw [← Γ.closure_diff_V hf]; exact ⟨hxf, hxV⟩ + exact hfe (Γ.edge_eq_of_mem hf he hxf' hxe) + rw [hEq] + exact Γ.finite_V.isClosed.union + ((Γ.finite_edges.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure) + +omit [T2Space S] in +/-- Every edge is the image of the open unit interval under a map of the closed interval that is +injective on the open interval and sends both ends to vertices. For a loop the map runs once around +the circle, starting at the vertex. -/ +theorem exists_edge_param (Γ : Drawing S) {e : Set S} (he : e ∈ Γ.E) : + ∃ γ : unitInterval → S, Continuous γ ∧ γ 0 ∈ Γ.V ∧ γ 1 ∈ Γ.V ∧ InjOn γ (Ioo 0 1) ∧ + γ '' Ioo 0 1 = e := by + rcases Γ.edge_cond e he with ⟨u, v, huv, hcap, f, hf0, hf1⟩ | ⟨u, hcap, ⟨g⟩⟩ + · have hu : u ∈ closure e ∩ Γ.V := by rw [hcap]; simp + have hv : v ∈ closure e ∩ Γ.V := by rw [hcap]; simp + have hinj : Function.Injective fun t => (f t).1 := fun x y h => f.injective (Subtype.ext h) + refine ⟨fun t => (f t).1, continuous_subtype_val.comp f.continuous, ?_, ?_, + hinj.injOn, ?_⟩ + · simpa [hf0] using hu.2 + · simpa [hf1] using hv.2 + · have hE := Γ.closure_diff_V he + ext x + constructor + · rintro ⟨t, ⟨ht0, ht1⟩, rfl⟩ + refine hE.subset ⟨(f t).2, fun hx => ?_⟩ + have hx' : (f t).1 ∈ closure e ∩ Γ.V := ⟨(f t).2, hx⟩ + rw [hcap] at hx' + rcases hx' with hx' | hx' + · exact ht0.ne' (f.injective (Subtype.ext (hx'.trans hf0.symm))) + · exact ht1.ne (f.injective (Subtype.ext ((mem_singleton_iff.mp hx').trans hf1.symm))) + · intro hx + have hx' : x ∈ closure e \ Γ.V := by rw [hE]; exact hx + refine ⟨f.symm ⟨x, hx'.1⟩, ⟨?_, ?_⟩, by simp⟩ + · refine unitInterval.pos_iff_ne_zero.mpr fun h => hx'.2 ?_ + have : x = u := by + have h₂ := congrArg (fun t => (f t).1) h + simpa [hf0] using h₂ + exact this ▸ hu.2 + · refine unitInterval.lt_one_iff_ne_one.mpr fun h => hx'.2 ?_ + have : x = v := by + have h₂ := congrArg (fun t => (f t).1) h + simpa [hf1] using h₂ + exact this ▸ hv.2 + · have hu : u ∈ closure e ∩ Γ.V := by rw [hcap]; simp + let z₀ : Circle := g.symm ⟨u, hu.1⟩ + let w : unitInterval → Circle := fun t => z₀ * Circle.exp (2 * Real.pi * t.1) + have hw : Continuous w := by fun_prop + have hw0 : w 0 = z₀ := by simp [w] + have hw1 : w 1 = z₀ := by simp [w] + have hg0 : (g z₀).1 = u := by simp [z₀] + have hE := Γ.closure_diff_V he + have hwinj : InjOn w (Ioo 0 1) := by + have key : ∀ s t : unitInterval, s < t → t < 1 → 0 < s → w s ≠ w t := by + intro s t hst ht _ h + have h₁ : Circle.exp (2 * Real.pi * s.1) = Circle.exp (2 * Real.pi * t.1) := + mul_left_cancel h + have hlt : (s : ℝ) < t := hst + have ht1 : (t : ℝ) < 1 := ht + have hs0 : (0 : ℝ) ≤ s := s.2.1 + have hpi := Real.pi_pos + have hmono : 2 * Real.pi * (s : ℝ) < 2 * Real.pi * t := + mul_lt_mul_of_pos_left hlt (by positivity) + have hb : 2 * Real.pi * (t : ℝ) - 2 * Real.pi * s < 2 * Real.pi := by nlinarith + have := Circle.exp_injOn_Icc hb ⟨le_rfl, hmono.le⟩ ⟨hmono.le, le_rfl⟩ h₁ + exact hmono.ne this + intro s hs t ht h + rcases lt_trichotomy s t with hst | hst | hst + · exact absurd h (key s t hst ht.2 hs.1) + · exact hst + · exact absurd h.symm (key t s hst hs.2 ht.1) + refine ⟨fun t => (g (w t)).1, continuous_subtype_val.comp (g.continuous.comp hw), ?_, ?_, ?_, + ?_⟩ + · simpa [hw0, hg0] using hu.2 + · simpa [hw1, hg0] using hu.2 + · exact fun s hs t ht h => hwinj hs ht (g.injective (Subtype.ext h)) + · ext x + constructor + · rintro ⟨t, ht, rfl⟩ + refine hE.subset ⟨(g (w t)).2, fun hx => ?_⟩ + have hx' : (g (w t)).1 ∈ closure e ∩ Γ.V := ⟨(g (w t)).2, hx⟩ + rw [hcap] at hx' + have h₁ : w t = z₀ := g.injective (Subtype.ext (hx'.trans hg0.symm)) + -- `w t = w 0` with `0 < t < 1` is impossible, by the same computation. + have h₂ : Circle.exp (2 * Real.pi * t.1) = Circle.exp 0 := by + rw [Circle.exp_zero] + exact mul_left_cancel (a := z₀) (by rw [mul_one]; exact h₁) + have ht0 : (0 : ℝ) < t := ht.1 + have ht1 : (t : ℝ) < 1 := ht.2 + have hpi := Real.pi_pos + have hb : 2 * Real.pi * (t : ℝ) - 0 < 2 * Real.pi := by nlinarith + have hpos : 0 < 2 * Real.pi * (t : ℝ) := by positivity + have := Circle.exp_injOn_Icc hb ⟨hpos.le, le_rfl⟩ ⟨le_rfl, hpos.le⟩ h₂ + exact hpos.ne' this + · intro hx + have hx' : x ∈ closure e \ Γ.V := by rw [hE]; exact hx + let y : Circle := g.symm ⟨x, hx'.1⟩ + let q : Circle := z₀⁻¹ * y + have hq : z₀ * q = y := by simp [q] + have hq1 : q ≠ 1 := by + intro h + rw [h, mul_one] at hq + have h' : (⟨u, hu.1⟩ : closure e) = ⟨x, hx'.1⟩ := g.symm.injective hq + have hux : u = x := congrArg Subtype.val h' + exact hx'.2 (hux ▸ hu.2) + -- The angle of `q`, moved into `(0, 2π)`. + have hθ : ∃ θ : ℝ, 0 < θ ∧ θ < 2 * Real.pi ∧ Circle.exp θ = q := by + have harg : Complex.arg q ≠ 0 := fun h => hq1 (Circle.arg_eq_zero.mp h) + have hexp := Circle.exp_arg q + have h₁ := Complex.neg_pi_lt_arg (q : ℂ) + have h₂ := Complex.arg_le_pi (q : ℂ) + have hpi := Real.pi_pos + rcases lt_or_gt_of_ne harg with h | h + · exact ⟨Complex.arg q + 2 * Real.pi, by linarith, by linarith, + by rw [Circle.exp_add_two_pi, hexp]⟩ + · exact ⟨Complex.arg q, h, by linarith, hexp⟩ + obtain ⟨θ, hθ₀, hθ₁, hθq⟩ := hθ + have hpi := Real.pi_pos + have htm : θ / (2 * Real.pi) ∈ Set.Icc (0 : ℝ) 1 := + ⟨by positivity, (div_le_one (by positivity)).mpr hθ₁.le⟩ + refine ⟨⟨θ / (2 * Real.pi), htm⟩, ⟨?_, ?_⟩, ?_⟩ + · exact Subtype.mk_lt_mk.mpr (by positivity) + · exact Subtype.mk_lt_mk.mpr ((div_lt_one (by positivity)).mpr hθ₁) + · have hmul : 2 * Real.pi * (θ / (2 * Real.pi)) = θ := by field_simp + have hwt : w ⟨θ / (2 * Real.pi), htm⟩ = y := by + simp only [w, hmul, hθq, hq] + simp only [hwt, y, Homeomorph.apply_symm_apply] + +/-- Choose the piece of a parametrized edge through an open disc neighbourhood, bounded by the +last exit before and first exit after the given parameter. -/ +theorem exists_edge_piece_in_disc {D D' : Set S} (hD : IsClosedDisc D) + (hD' : IsOpen D') (hD'D : D' ⊆ D) (hbdD : D \ D' = discBd D) + {γ : unitInterval → S} (hγ : Continuous γ) (hinj : InjOn γ (Ioo 0 1)) + (hγ0 : γ 0 ∉ D) (hγ1 : γ 1 ∉ D) {t₀ : unitInterval} (hpD' : γ t₀ ∈ D') : + ∃ a b : unitInterval, a < t₀ ∧ t₀ < b ∧ Icc a b ⊆ Ioo 0 1 ∧ + (∀ t, a < t → t < b → γ t ∈ D') ∧ IsLineWithEnds (γ '' Icc a b) (γ a) (γ b) ∧ + γ '' Icc a b ⊆ D ∧ (γ '' Icc a b) ∩ discBd D = {γ a, γ b} ∧ γ a ≠ γ b := by + have hDclosed : IsClosed D := hD.isClosed + -- The last exit `a` before `t₀`, and the first exit `b` after it. + have hC₁ : IsCompact {t : unitInterval | t ≤ t₀ ∧ γ t ∉ D'} := + (isClosed_Iic.inter (hD'.isClosed_compl.preimage hγ)).isCompact + have hC₂ : IsCompact {t : unitInterval | t₀ ≤ t ∧ γ t ∉ D'} := + (isClosed_Ici.inter (hD'.isClosed_compl.preimage hγ)).isCompact + obtain ⟨a, ⟨hat, hagamma⟩, hamax⟩ := hC₁.exists_isGreatest + ⟨0, unitInterval.nonneg _, fun h => hγ0 (hD'D h)⟩ + obtain ⟨b, ⟨htb, hbgamma⟩, hbmin⟩ := hC₂.exists_isLeast + ⟨1, unitInterval.le_one _, fun h => hγ1 (hD'D h)⟩ + have hat' : a < t₀ := lt_of_le_of_ne hat fun h => hagamma (h ▸ hpD') + have htb' : t₀ < b := lt_of_le_of_ne htb fun h => hbgamma (h ▸ hpD') + have hIoo : ∀ t, a < t → t < b → γ t ∈ D' := by + intro t h₁ h₂ + by_contra hcon + rcases le_total t t₀ with h | h + · exact absurd (hamax ⟨h, hcon⟩) (not_le.mpr h₁) + · exact absurd (hbmin ⟨h, hcon⟩) (not_le.mpr h₂) + have hab : a < b := hat'.trans htb' + -- The ends of the piece lie in `D`, so they are not vertices. + have hclosure : ∀ t ∈ closure (Ioo a b), γ t ∈ D := by + intro t ht + have h₁ : γ t ∈ closure (γ '' Ioo a b) := image_closure_subset_closure_image hγ ⟨t, ht, rfl⟩ + have h₂ : γ '' Ioo a b ⊆ D := by + rintro _ ⟨u, hu, rfl⟩ + exact hD'D (hIoo u hu.1 hu.2) + exact hDclosed.closure_subset_iff.mpr h₂ h₁ + have hamem : γ a ∈ D := hclosure a (by rw [closure_Ioo hab.ne]; exact ⟨le_rfl, hab.le⟩) + have hbmem : γ b ∈ D := hclosure b (by rw [closure_Ioo hab.ne]; exact ⟨hab.le, le_rfl⟩) + have ha0 : 0 < a := unitInterval.pos_iff_ne_zero.mpr fun h => hγ0 (h ▸ hamem) + have hb1 : b < 1 := unitInterval.lt_one_iff_ne_one.mpr fun h => hγ1 (h ▸ hbmem) + have hIcc : Icc a b ⊆ Ioo 0 1 := fun t ht => ⟨ha0.trans_le ht.1, ht.2.trans_lt hb1⟩ + -- The piece `F` of `e` from `γ a` to `γ b`. + have habR : (a : ℝ) < b := hab + have hρmem : ∀ u : unitInterval, (a : ℝ) + u.1 * (b - a) ∈ Set.Icc (0 : ℝ) 1 := by + intro u + have hu₀ := u.2.1 + have hu₁ := u.2.2 + have ha' := a.2.1 + have hb' := b.2.2 + constructor + · have : 0 ≤ u.1 * ((b : ℝ) - a) := mul_nonneg hu₀ (by linarith) + linarith + · have : u.1 * ((b : ℝ) - a) ≤ 1 * ((b : ℝ) - a) := + mul_le_mul_of_nonneg_right hu₁ (by linarith) + linarith + let ρ : unitInterval → unitInterval := fun u => ⟨(a : ℝ) + u.1 * (b - a), hρmem u⟩ + have hρ : Continuous ρ := by + refine Continuous.subtype_mk ?_ _ + fun_prop + have hρIcc : ∀ u, ρ u ∈ Icc a b := by + intro u + have hu₀ := u.2.1 + have hu₁ := u.2.2 + constructor + · have : 0 ≤ u.1 * ((b : ℝ) - a) := mul_nonneg hu₀ (by linarith) + exact Subtype.mk_le_mk.mpr (by linarith) + · have : u.1 * ((b : ℝ) - a) ≤ 1 * ((b : ℝ) - a) := + mul_le_mul_of_nonneg_right hu₁ (by linarith) + exact Subtype.mk_le_mk.mpr (by linarith) + have hρsurj : ∀ t ∈ Icc a b, ∃ u, ρ u = t := by + intro t ht + have ht₁ : (a : ℝ) ≤ t := ht.1 + have ht₂ : (t : ℝ) ≤ b := ht.2 + have hd : (0 : ℝ) < b - a := by linarith + have hu : ((t : ℝ) - a) / (b - a) ∈ Set.Icc (0 : ℝ) 1 := + ⟨div_nonneg (by linarith) hd.le, (div_le_one hd).mpr (by linarith)⟩ + refine ⟨⟨_, hu⟩, Subtype.ext ?_⟩ + change (a : ℝ) + ((t : ℝ) - a) / (b - a) * (b - a) = t + field_simp + ring + have hρ0 : ρ 0 = a := Subtype.ext (by simp [ρ]) + have hρ1 : ρ 1 = b := Subtype.ext (by simp [ρ]) + have hρinj : Function.Injective ρ := by + intro u v h + have h₁ : (a : ℝ) + u.1 * (b - a) = a + v.1 * (b - a) := congrArg Subtype.val h + have hd : ((b : ℝ) - a) ≠ 0 := by linarith + exact Subtype.ext (mul_right_cancel₀ hd (add_left_cancel h₁)) + let k : unitInterval → S := fun u => γ (ρ u) + have hk : Continuous k := hγ.comp hρ + have hkinj : Function.Injective k := fun u v h => + hρinj (hinj (hIcc (hρIcc u)) (hIcc (hρIcc v)) h) + let F : Set S := range k + have hFmem : ∀ x, x ∈ F ↔ ∃ t ∈ Icc a b, γ t = x := by + intro x + constructor + · rintro ⟨u, rfl⟩ + exact ⟨ρ u, hρIcc u, rfl⟩ + · rintro ⟨t, ht, rfl⟩ + obtain ⟨u, rfl⟩ := hρsurj t ht + exact ⟨u, rfl⟩ + have hFline : IsLineWithEnds F (γ a) (γ b) := by + refine ⟨Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofInjective k hkinj) + hk.rangeFactorization, ?_, ?_⟩ + · change k 0 = γ a + simp [k, hρ0] + · change k 1 = γ b + simp [k, hρ1] + have hFD : F ⊆ D := by + rintro x hx + obtain ⟨t, ht, rfl⟩ := (hFmem x).mp hx + rcases eq_or_lt_of_le ht.1 with rfl | h₁ + · exact hamem + rcases eq_or_lt_of_le ht.2 with rfl | h₂ + · exact hbmem + exact hD'D (hIoo t h₁ h₂) + have hst : γ a ≠ γ b := fun h => hab.ne (hinj (hIcc ⟨le_rfl, hab.le⟩) (hIcc ⟨hab.le, le_rfl⟩) h) + have hFcap : F ∩ discBd D = {γ a, γ b} := by + rw [← hbdD] + ext x + constructor + · rintro ⟨hx, -, hxD'⟩ + obtain ⟨t, ht, rfl⟩ := (hFmem x).mp hx + rcases eq_or_lt_of_le ht.1 with rfl | h₁ + · exact Or.inl rfl + rcases eq_or_lt_of_le ht.2 with rfl | h₂ + · exact Or.inr rfl + exact absurd (hIoo t h₁ h₂) hxD' + · rintro (rfl | hx) + · exact ⟨(hFmem _).mpr ⟨a, ⟨le_rfl, hab.le⟩, rfl⟩, hamem, hagamma⟩ + · rw [mem_singleton_iff.mp hx] + exact ⟨(hFmem _).mpr ⟨b, ⟨hab.le, le_rfl⟩, rfl⟩, hbmem, hbgamma⟩ + have hFeq : F = γ '' Icc a b := by + ext x + rw [hFmem] + rfl + rw [hFeq] at hFline hFD hFcap + exact ⟨a, b, hat', htb', hIcc, hIoo, hFline, hFD, hFcap, hst⟩ + +/-- A piece `γ([a, b])` of an edge around `γ t₀`, as a chord of a small closed disc `D`. -/ +theorem exists_edge_piece (hS : IsClosedSurface S) + (Γ : Drawing S) {e : Set S} (he : e ∈ Γ.E) {γ : unitInterval → S} (hγ : Continuous γ) + (hγ0 : γ 0 ∈ Γ.V) (hγ1 : γ 1 ∈ Γ.V) (hinj : InjOn γ (Ioo 0 1)) (hγe : γ '' Ioo 0 1 = e) + {t₀ : unitInterval} (ht₀ : t₀ ∈ Ioo (0 : unitInterval) 1) {O : Set S} (hO : IsOpen O) + (hpO : γ t₀ ∈ O) (hOdis : Disjoint O (Γ.U \ e)) : + ∃ (D D' : Set S) (a b : unitInterval), IsClosedDisc D ∧ IsOpen D' ∧ γ t₀ ∈ D' ∧ D' ⊆ D ∧ D ⊆ O ∧ + D \ D' = discBd D ∧ a < t₀ ∧ t₀ < b ∧ Icc a b ⊆ Ioo 0 1 ∧ (∀ t, a < t → t < b → γ t ∈ D') ∧ + IsLineWithEnds (γ '' Icc a b) (γ a) (γ b) ∧ γ '' Icc a b ⊆ D ∧ + (γ '' Icc a b) ∩ discBd D = {γ a, γ b} ∧ γ a ≠ γ b := by + obtain ⟨D, D', hD, hD', hpD', hD'D, hDO, hbdD⟩ := + exists_closedDisc_nbhd hS hO hpO + have hVout : ∀ x ∈ Γ.V, x ∉ D := fun x hx hxD => + disjoint_left.mp hOdis (hDO hxD) ⟨Γ.V_subset_U hx, fun hxe => (he.2.1 hxe).2 hx⟩ + have hpe : γ t₀ ∈ e := hγe ▸ mem_image_of_mem γ ht₀ + obtain ⟨a, b, hat', htb', hIcc, hIoo, hFline, hFD, hFcap, hst⟩ := + exists_edge_piece_in_disc hD hD' hD'D hbdD hγ hinj (hVout _ hγ0) (hVout _ hγ1) hpD' + exact ⟨D, D', a, b, hD, hD', hpD', hD'D, hDO, hbdD, hat', htb', hIcc, hIoo, hFline, hFD, hFcap, + hst⟩ + +/-- **Two sides of an edge, away from a closed set.** Let `p` be a point of an edge `e` of a drawing +in a +closed surface, and `Z` a closed set missing `p`. Then `p` has an open neighbourhood `W` that meets +`U(Γ)` +only in `e`, and `W - U(Γ)` lies in the union of two connected subsets of `Σ - (U(Γ) ∪ Z)`. Every +point of +`e` in `W` is a limit of both of them. -/ +theorem exists_edge_sides_off (hS : IsClosedSurface S) + (Γ : Drawing S) {e : Set S} (he : e ∈ Γ.E) {p : S} (hp : p ∈ e) + {Z : Set S} (hZ : IsClosed Z) (hpZ : p ∉ Z) : + ∃ W A₁ A₂ Δ₁ Δ₂ : Set S, IsOpen W ∧ p ∈ W ∧ W ∩ Γ.U ⊆ e ∧ W \ Γ.U ⊆ A₁ ∪ A₂ ∧ + IsPreconnected A₁ ∧ IsPreconnected A₂ ∧ Disjoint A₁ Γ.U ∧ Disjoint A₂ Γ.U ∧ + e ∩ W ⊆ closure A₁ ∧ e ∩ W ⊆ closure A₂ ∧ IsClosed Δ₁ ∧ IsClosed Δ₂ ∧ A₁ ⊆ Δ₁ ∧ A₂ ⊆ Δ₂ ∧ + W ⊆ Δ₁ ∪ Δ₂ ∧ Δ₁ ∩ Δ₂ ⊆ Γ.U ∧ Disjoint A₁ Z ∧ Disjoint A₂ Z := by + obtain ⟨γ, hγ, hγ0, hγ1, hinj, hγe⟩ := exists_edge_param Γ he + have hX₀ := isClosed_U_sdiff_edge Γ he + have hpX₀ : p ∉ Γ.U \ e := fun h => h.2 hp + obtain ⟨t₀, ht₀, rfl⟩ : p ∈ γ '' Ioo 0 1 := by rw [hγe]; exact hp + obtain ⟨D, D', a, b, hD, hD', hpD', hD'D, -, hbdD, hat', htb', hIcc, hIoo, hFline, hFD, hFcap, + hst⟩ := + exists_edge_piece hS Γ he hγ hγ0 hγ1 hinj hγe ht₀ hX₀.isOpen_compl hpX₀ disjoint_compl_left + obtain ⟨ht₀0, ht₀1⟩ := ht₀ + have hat : a ≤ t₀ := hat'.le + have htb : t₀ ≤ b := htb'.le + set F : Set S := γ '' Icc a b with hF + have hFmem : ∀ x, x ∈ F ↔ ∃ t ∈ Icc a b, γ t = x := fun x => Iff.rfl + obtain ⟨A₁, A₂, Δ₁, Δ₂, -, hcomp, hΔ₁, hΔ₂, hunion, hmeet, hbd₁, hbd₂, -⟩ := + disc_iArc D F (γ a) (γ b) hD hFD hst hFline hFcap + have hAsub : ∀ A ∈ componentsIn (discBd D \ {γ a, γ b}), A ⊆ discBd D := by + rintro _ ⟨x, -, rfl⟩ + exact (connectedComponentIn_subset _ _).trans sdiff_subset + have hA₁ : A₁ ⊆ discBd D := hAsub _ (by rw [hcomp]; simp) + have hA₂ : A₂ ⊆ discBd D := hAsub _ (by rw [hcomp]; simp) + have hFU : F ⊆ Γ.U := by + intro x hx + obtain ⟨t, ht, rfl⟩ := (hFmem x).mp hx + have hmem : γ t ∈ e := by rw [← hγe]; exact ⟨t, hIcc ht, rfl⟩ + exact (he.2.1 hmem).1 + -- The closed set to avoid near `p`. + let Y : Set S := D'ᶜ ∪ (Γ.U \ e) ∪ γ '' {t | t ≤ a ∨ b ≤ t} ∪ Z + have hY : IsClosed Y := by + refine ((hD'.isClosed_compl.union hX₀).union ?_).union hZ + exact ((isClosed_Iic.union isClosed_Ici).isCompact.image hγ).isClosed + have hpY : γ t₀ ∉ Y := by + rintro (((h | h) | ⟨t, ht, hteq⟩) | h) + · exact h hpD' + · exact h.2 hp + · have hpV : t ∈ Ioo (0 : unitInterval) 1 := by + refine ⟨unitInterval.pos_iff_ne_zero.mpr ?_, unitInterval.lt_one_iff_ne_one.mpr ?_⟩ + · rintro rfl + exact (he.2.1 hp).2 (hteq ▸ hγ0) + · rintro rfl + exact (he.2.1 hp).2 (hteq ▸ hγ1) + have := hinj hpV ⟨ht₀0, ht₀1⟩ hteq + subst this + rcases ht with h | h + · exact absurd h (not_le.mpr hat') + · exact absurd h (not_le.mpr htb') + · exact hpZ h + have hpF : γ t₀ ∈ F := (hFmem _).mpr ⟨t₀, ⟨hat, htb⟩, rfl⟩ + have hFsub : ∀ x ∈ e, x ∉ Y → x ∈ F := by + intro x hx hxY + obtain ⟨t, -, rfl⟩ : x ∈ γ '' Ioo 0 1 := by rw [hγe]; exact hx + refine (hFmem _).mpr ⟨t, ?_, rfl⟩ + have hn : ¬ (t ≤ a ∨ b ≤ t) := fun h => hxY (Or.inl (Or.inr ⟨t, h, rfl⟩)) + push Not at hn + exact ⟨hn.1.le, hn.2.le⟩ + have side : ∀ Δ A₀ : Set S, IsClosedDisc Δ → discBd Δ = A₀ ∪ F → A₀ ⊆ discBd D → + ∃ A W : Set S, IsOpen W ∧ γ t₀ ∈ W ∧ IsPreconnected A ∧ A ⊆ Δ ∧ Disjoint A Γ.U ∧ Disjoint A Y + ∧ + (∀ x ∈ W, x ∈ D' → x ∈ Δ → x ∉ Γ.U → x ∈ A) ∧ + (∀ x ∈ W, x ∈ e → x ∉ Y → x ∈ closure A) := by + intro Δ A₀ hΔ hbdΔ hA₀ + have hpbd : γ t₀ ∈ discBd Δ := by rw [hbdΔ]; exact Or.inr hpF + obtain ⟨A, W, hW, hpW, hconn, hAΔ, hAbd, hAY, hin, hcl⟩ := + exists_half_nbhd hΔ hY hpbd hpY + refine ⟨A, W, hW, hpW, hconn, hAΔ, ?_, hAY, ?_, ?_⟩ + · refine disjoint_left.mpr fun x hxA hxU => ?_ + have hxY : x ∉ Y := disjoint_left.mp hAY hxA + have hxe : x ∈ e := by + by_contra hxe + exact hxY (Or.inl (Or.inl (Or.inr ⟨hxU, hxe⟩))) + refine disjoint_left.mp hAbd hxA ?_ + rw [hbdΔ] + exact Or.inr (hFsub x hxe hxY) + · intro x hxW hxD' hxΔ hxU + refine hin ⟨⟨hxW, hxΔ⟩, ?_⟩ + rw [hbdΔ] + rintro (h | h) + · have hx' := hA₀ h + rw [← hbdD] at hx' + exact hx'.2 hxD' + · exact hxU (hFU h) + · intro x hxW hxe hxY + refine hcl ⟨hxW, ?_⟩ + rw [hbdΔ] + exact Or.inr (hFsub x hxe hxY) + obtain ⟨S₁, W₁, hW₁, hpW₁, hconn₁, hs₁, hdis₁, hY₁, hin₁, hcl₁⟩ := side Δ₁ A₁ hΔ₁ hbd₁ hA₁ + obtain ⟨S₂, W₂, hW₂, hpW₂, hconn₂, hs₂, hdis₂, hY₂, hin₂, hcl₂⟩ := side Δ₂ A₂ hΔ₂ hbd₂ hA₂ + refine ⟨W₁ ∩ W₂ ∩ Yᶜ, S₁, S₂, Δ₁, Δ₂, (hW₁.inter hW₂).inter hY.isOpen_compl, ⟨⟨hpW₁, hpW₂⟩, hpY⟩, + ?_, ?_, hconn₁, hconn₂, hdis₁, hdis₂, ?_, ?_, hΔ₁.isCompact.isClosed, hΔ₂.isCompact.isClosed, + hs₁, + hs₂, ?_, ?_, hY₁.mono_right subset_union_right, hY₂.mono_right subset_union_right⟩ + · rintro x ⟨⟨-, hxY⟩, hxU⟩ + by_contra hxe + exact hxY (Or.inl (Or.inl (Or.inr ⟨hxU, hxe⟩))) + · rintro x ⟨⟨⟨hx₁, hx₂⟩, hxY⟩, hxU⟩ + have hxD' : x ∈ D' := by + by_contra h + exact hxY (Or.inl (Or.inl (Or.inl h))) + have hxD : x ∈ Δ₁ ∪ Δ₂ := by rw [hunion]; exact hD'D hxD' + rcases hxD with h | h + · exact Or.inl (hin₁ x hx₁ hxD' h hxU) + · exact Or.inr (hin₂ x hx₂ hxD' h hxU) + · rintro x ⟨hxe, ⟨hx₁, -⟩, hxY⟩ + exact hcl₁ x hx₁ hxe hxY + · rintro x ⟨hxe, ⟨-, hx₂⟩, hxY⟩ + exact hcl₂ x hx₂ hxe hxY + · rintro x ⟨-, hxY⟩ + have hxD' : x ∈ D' := by + by_contra h + exact hxY (Or.inl (Or.inl (Or.inl h))) + rw [hunion] + exact hD'D hxD' + · rw [hmeet] + exact hFU + +/-- **Two sides of an edge.** Let `p` be a point of an edge `e` of a drawing in a closed surface. +Then `p` has an open neighbourhood `W` that meets `U(Γ)` only in `e`, and `W - U(Γ)` lies in the +union +of two connected subsets of `Σ - U(Γ)`. Every point of `e` in `W` is a limit of both of them. -/ +theorem exists_edge_sides_split (hS : IsClosedSurface S) + (Γ : Drawing S) {e : Set S} (he : e ∈ Γ.E) {p : S} (hp : p ∈ e) : + ∃ W A₁ A₂ Δ₁ Δ₂ : Set S, IsOpen W ∧ p ∈ W ∧ W ∩ Γ.U ⊆ e ∧ W \ Γ.U ⊆ A₁ ∪ A₂ ∧ + IsPreconnected A₁ ∧ IsPreconnected A₂ ∧ Disjoint A₁ Γ.U ∧ Disjoint A₂ Γ.U ∧ + e ∩ W ⊆ closure A₁ ∧ e ∩ W ⊆ closure A₂ ∧ IsClosed Δ₁ ∧ IsClosed Δ₂ ∧ A₁ ⊆ Δ₁ ∧ A₂ ⊆ Δ₂ ∧ + W ⊆ Δ₁ ∪ Δ₂ ∧ Δ₁ ∩ Δ₂ ⊆ Γ.U := by + obtain ⟨W, A₁, A₂, Δ₁, Δ₂, h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈, h₉, h₁₀, h₁₁, h₁₂, h₁₃, h₁₄, h₁₅, h₁₆, + -, -⟩ := + exists_edge_sides_off hS Γ he hp isClosed_empty (notMem_empty p) + exact ⟨W, A₁, A₂, Δ₁, Δ₂, h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈, h₉, h₁₀, h₁₁, h₁₂, h₁₃, h₁₄, h₁₅, h₁₆⟩ + +/-- The two sides of an edge near a point of the edge. -/ +theorem exists_edge_sides (hS : IsClosedSurface S) + (Γ : Drawing S) {e : Set S} (he : e ∈ Γ.E) {p : S} (hp : p ∈ e) : + ∃ W A₁ A₂ : Set S, IsOpen W ∧ p ∈ W ∧ W ∩ Γ.U ⊆ e ∧ W \ Γ.U ⊆ A₁ ∪ A₂ ∧ + IsPreconnected A₁ ∧ IsPreconnected A₂ ∧ Disjoint A₁ Γ.U ∧ Disjoint A₂ Γ.U ∧ + e ∩ W ⊆ closure A₁ ∧ e ∩ W ⊆ closure A₂ := by + obtain ⟨W, A₁, A₂, -, -, h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈, h₉, h₁₀, -⟩ := + exists_edge_sides_split hS Γ he hp + exact ⟨W, A₁, A₂, h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈, h₉, h₁₀⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/EvenCircuit.lean b/LeanPool/GraphMinor/GM11/EvenCircuit.lean new file mode 100644 index 0000000000..389afada64 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/EvenCircuit.lean @@ -0,0 +1,205 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Corners +public import LeanPool.GraphMinor.GM11.DrawingTopology + +/-! +# Even valency gives circuits + +"every vertex of $N(Z_1)$ has even valency and so every edge of $N(Z_1)$ is in a circuit" (Graph +Minors +XI, proof of (5.4), page 83). This is `exists_circuit_of_even`. Suppose that deleting `e` leaves its +ends in different parts, and let `A` be the vertices reached from one end. Count the half-edges with +end in `A`. The count is even, as each vertex has even valency, and it is odd, as the half-edges +other than one half of `e` come in pairs. +-/ + +public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +/-- The vertices and edges of a simple-closed walk form a circuit. -/ +theorem isCircuit_walkDrawing (N : Drawing S) {u : S} {W : GraphWalk N.toGraph u u} + (hW : W.IsSimpleClosed) (hpos : 0 < W.length) : (walkDrawing N W).IsCircuit := by + obtain ⟨W', hs, he⟩ := (walkDrawing_isSubdrawing N W).exists_walk_down W + (by rw [walkDrawing_V]; exact fun x hx => hx) (by rw [walkDrawing_E]; exact fun e he => he) + refine ⟨u, W', ?_, ?_, ?_, ?_⟩ + · unfold GraphWalk.IsSimpleClosed + rw [hs, he] + exact hW + · have : W'.edges.length = W.edges.length := by rw [he] + exact lt_of_lt_of_eq hpos this.symm + · rw [walkDrawing_V, hs] + · rw [walkDrawing_E, he] + +variable [T2Space S] {Γ N : Drawing S} {γ : Set S → I → S} + +omit [T1Space S] in +/-- The vertices of an edge are the two ends of its parametrization. -/ +theorem closure_inter_V_eq (hγ : EdgePar Γ γ) {e : Set S} (he : e ∈ Γ.E) : + closure e ∩ Γ.V = {γ e (endOf false), γ e (endOf true)} := by + ext x + constructor + · rintro ⟨hx, hxV⟩ + obtain ⟨b, rfl⟩ := exists_end_eq hγ he hxV hx + cases b <;> simp + · rintro (rfl | rfl) + · exact ⟨end_mem_closure hγ he _, end_mem_V hγ he _⟩ + · exact ⟨end_mem_closure hγ he _, end_mem_V hγ he _⟩ + +omit [T1Space S] in +/-- An edge of a subdrawing links the two ends of its parametrization. -/ +theorem isLink_ends (hγ : EdgePar Γ γ) (hN : N.IsSubdrawing Γ) {e : Set S} (he : e ∈ N.E) + (b : Bool) : + N.toGraph.IsLink e (γ e (endOf b)) (γ e (endOf (!b))) := by + have hcap := closure_inter_V_eq hγ (hN.2 he) + have hcap' : closure e ∩ N.V = {γ e (endOf false), γ e (endOf true)} := by + rw [← hcap] + exact hN.closure_inter_V he + have hm : ∀ c, γ e (endOf c) ∈ N.V := fun c => by + have : γ e (endOf c) ∈ closure e ∩ N.V := by + rw [hcap'] + cases c <;> simp + exact this.2 + refine ⟨he, hm _, hm _, ?_⟩ + rw [hcap'] + cases b + · rfl + · exact pair_comm _ _ + +/-- An edge whose ends are joined by a walk that avoids it lies on a circuit. -/ +theorem exists_circuit_of_reach (hγ : EdgePar Γ γ) (hN : N.IsSubdrawing Γ) {e : Set S} + (he : e ∈ N.E) + (hreach : Nonempty (GraphWalk (N.deleteEdge e).toGraph (γ e (endOf false)) (γ e + (endOf true)))) : + ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing N ∧ e ∈ C.E := by + classical + set a := γ e (endOf false) with ha + set b := γ e (endOf true) with hb + let D := N.deleteEdge e + have hDN : D.IsSubdrawing N := deleteEdge_isSubdrawing N e + have hDE : D.E = N.E \ {e} := deleteEdge_E N e + have hlink := isLink_ends hγ hN he false + obtain ⟨P₀⟩ := hreach + obtain ⟨P₁, hP₁, -, hP₁e⟩ := GraphWalk.exists_isSimple P₀ + have hP₁e' : ∀ f ∈ P₁.edges, f ∈ D.E := fun f hf => by + exact mem_E_of_mem_edges P₀ (hP₁e f hf) + obtain ⟨P, hPs, hPe⟩ := hDN.exists_walk_up P₁ + have hPsimple : P.IsSimple := by + unfold GraphWalk.IsSimple + rw [hPs] + exact hP₁ + let W : GraphWalk N.toGraph a a := .cons hlink P.reverse + have heP : e ∉ P.reverse.edges := by + intro h + rw [GraphWalk.edges_reverse, List.mem_reverse, hPe] at h + have := hP₁e' e h + rw [hDE] at this + exact this.2 rfl + have hW : W.IsSimpleClosed := by + refine ⟨?_, ?_⟩ + · exact hPsimple.reverse + · exact List.nodup_cons.mpr ⟨heP, hPsimple.reverse.edges_nodup⟩ + have hlen : 0 < W.length := by + change 0 < (e :: P.reverse.edges).length + simp + refine ⟨_, isCircuit_walkDrawing N hW hlen, walkDrawing_isSubdrawing N W, ?_⟩ + rw [walkDrawing_E] + exact List.mem_cons_self + +/-- Every edge of a subdrawing with even valencies lies on a circuit. -/ +theorem exists_circuit_of_even (hγ : EdgePar Γ γ) (hN : N.IsSubdrawing Γ) + (heven : ∀ v ∈ Γ.V, Even (nHalf N γ v).ncard) {e : Set S} (he : e ∈ N.E) : + ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing N ∧ e ∈ C.E := by + classical + set a := γ e (endOf false) with ha + set b := γ e (endOf true) with hb + let D := N.deleteEdge e + have hDN : D.IsSubdrawing N := deleteEdge_isSubdrawing N e + have hDE : D.E = N.E \ {e} := deleteEdge_E N e + have hDV : D.V = N.V := deleteEdge_V N e + have hlink := isLink_ends hγ hN he false + by_cases hreach : Nonempty (GraphWalk D.toGraph a b) + · exact exists_circuit_of_reach hγ hN he hreach + · exfalso + let A : Set S := {x | Nonempty (GraphWalk D.toGraph a x)} + have haA : a ∈ A := by + have : a ∈ D.V := by rw [hDV]; exact hlink.2.1 + exact ⟨.nil this⟩ + have hbA : b ∉ A := hreach + have hAV : A ⊆ Γ.V := by + rintro x ⟨W⟩ + exact hN.1 (hDN.1 (W.mem_vertexSet_of_mem_support W.end_mem_support)) + have hAfin : A.Finite := Γ.finite_V.subset hAV + let X : Set (Set S × Bool) := {k | k.1 ∈ N.E ∧ γ k.1 (endOf k.2) ∈ A} + have hXfin : X.Finite := + (N.finite_edges.prod (finite_univ (α := Bool))).subset fun k hk => ⟨hk.1, mem_univ _⟩ + let T := hXfin.toFinset + have hTmem : ∀ k, k ∈ T ↔ k ∈ X := fun k => hXfin.mem_toFinset + let f : Set S × Bool → S := fun k => γ k.1 (endOf k.2) + have hsum := Finset.card_eq_sum_card_fiberwise (f := f) (s := T) (t := hAfin.toFinset) + (fun k hk => hAfin.mem_toFinset.mpr ((hTmem k).mp hk).2) + have heT : Even T.card := by + rw [hsum] + refine Finset.even_sum _ fun x hx => ?_ + have hxA : x ∈ A := hAfin.mem_toFinset.mp hx + have : (T.filter fun k => f k = x).card = (nHalf N γ x).ncard := by + rw [← Set.ncard_coe_finset] + congr 1 + ext k + simp only [Finset.coe_filter, mem_ofPred_eq, hTmem] + change _ ↔ (k.1 ∈ N.E ∧ γ k.1 (endOf k.2) = x) + constructor + · rintro ⟨h₁, h₂⟩ + exact ⟨h₁.1, h₂⟩ + · rintro ⟨h₁, h₂⟩ + exact ⟨⟨h₁, h₂ ▸ hxA⟩, h₂⟩ + rw [this] + exact heven x (hAV hxA) + have hmem₀ : (e, false) ∈ T := (hTmem _).mpr ⟨he, haA⟩ + have hne : ∀ k ∈ T.erase (e, false), k.1 ≠ e := by + rintro ⟨g, c⟩ hk rfl + obtain ⟨h₁, h₂⟩ := Finset.mem_erase.mp hk + cases c + · exact h₁ rfl + · exact hbA ((hTmem _).mp h₂).2 + have hflip : ∀ k ∈ T.erase (e, false), (k.1, !k.2) ∈ T.erase (e, false) := by + rintro ⟨g, c⟩ hk + have hg := hne _ hk + obtain ⟨h₁, h₂⟩ := (hTmem _).mp (Finset.mem_erase.mp hk).2 + dsimp only at hg h₁ h₂ ⊢ + refine Finset.mem_erase.mpr ⟨fun h => hg (congrArg Prod.fst h), (hTmem _).mpr ⟨h₁, ?_⟩⟩ + obtain ⟨W⟩ := h₂ + have hgD : g ∈ D.E := by + rw [hDE] + exact ⟨h₁, hg⟩ + have hl : D.toGraph.IsLink g (γ g (endOf c)) (γ g (endOf (!c))) := + isLink_ends hγ (hDN.trans hN) hgD c + exact ⟨W.append (.cons hl (.nil hl.symm.left_mem))⟩ + have hz : ∑ _k ∈ T.erase (e, false), (1 : ZMod 2) = 0 := by + refine Finset.sum_involution (fun k _ => (k.1, !k.2)) (fun _ _ => rfl) ?_ hflip ?_ + · rintro ⟨g, c⟩ - - h + have := congrArg Prod.snd h + simp at this + · rintro ⟨g, c⟩ - + simp + rw [Finset.sum_const, nsmul_one, ZMod.natCast_eq_zero_iff_even] at hz + have hc := Finset.card_erase_add_one hmem₀ + rw [← hc] at heT + exact (Nat.not_even_iff_odd.mpr hz.add_one) heT + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Fan.lean b/LeanPool/GraphMinor/GM11/Fan.lean new file mode 100644 index 0000000000..d9ee9db892 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Fan.lean @@ -0,0 +1,909 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.EdgeSides +import LeanPool.GraphMinor.Surface.Circle +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# Sectors of a disc around a point + +Let `v` be an interior point of a closed disc `D`, and let `J_i` be finitely many (at least two) +lines from `v` to the boundary of `D`, which meet only at `v`, and which meet the boundary only at +their other ends. Then the lines cut `D` into closed discs, the sectors, one between each line and +the next in a cyclic order around `v`. + +The papers use this picture without comment, whenever they speak of the edges and regions around a +vertex. Here `exists_fanInv` proves it, by adding one line at a time and splitting one sector with +`DiscIArcStatement`. The cyclic order is the function `next`. +-/ + +public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +section Lines + +/-- The range of an injective curve is a line. -/ +theorem isLineWithEnds_range [T2Space S] (f : C(I, S)) (hf : Function.Injective f) : + IsLineWithEnds (range f) (f 0) (f 1) := by + let e : I ≃ₜ range f := + Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofInjective f hf) + f.continuous.rangeFactorization + exact ⟨e, rfl, rfl⟩ + +/-- Two lines from `v` that meet only at `v` form a line between their other ends. -/ +theorem IsLineWithEnds.union [T2Space S] {L₁ L₂ : Set S} {v p q : S} (h₁ : IsLineWithEnds L₁ v p) + (h₂ : IsLineWithEnds L₂ v q) (h : L₁ ∩ L₂ = {v}) : IsLineWithEnds (L₁ ∪ L₂) p q := by + obtain ⟨f₁, hf₁0, hf₁1⟩ := h₁ + obtain ⟨f₂, hf₂0, hf₂1⟩ := h₂ + let c₁ : Path p v := + ⟨⟨fun t => (f₁ (σ t)).1, by fun_prop⟩, by simpa using hf₁1, by simpa using hf₁0⟩ + let c₂ : Path v q := ⟨⟨fun t => (f₂ t).1, by fun_prop⟩, hf₂0, hf₂1⟩ + have hc₁ : Function.Injective c₁ := fun x y hxy => by + have := f₁.injective (Subtype.ext hxy) + simpa using this + have hc₂ : Function.Injective c₂ := fun x y hxy => f₂.injective (Subtype.ext hxy) + have hr₁ : range c₁ = L₁ := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (f₁ (σ t)).2 + · intro hx + obtain ⟨t, ht⟩ := f₁.surjective ⟨x, hx⟩ + exact ⟨σ t, by simp [c₁, ht]⟩ + have hr₂ : range c₂ = L₂ := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (f₂ t).2 + · intro hx + obtain ⟨t, ht⟩ := f₂.surjective ⟨x, hx⟩ + exact ⟨t, by simp [c₂, ht]⟩ + have hinj : Function.Injective (c₁.trans c₂) := by + have hcross : ∀ a b : I, c₁ a = c₂ b → a = 1 ∧ b = 0 := by + intro a b hab + have hv : c₁ a ∈ L₁ ∩ L₂ := ⟨hr₁ ▸ mem_range_self a, hab ▸ hr₂ ▸ mem_range_self b⟩ + rw [h] at hv + have h₁ : c₁ a = c₁ 1 := by simpa using hv + have h₂ : c₂ b = c₂ 0 := by rw [← hab, h₁]; simp + exact ⟨hc₁ h₁, hc₂ h₂⟩ + intro x y hxy + simp only [Path.trans_apply] at hxy + split_ifs at hxy with h₁ h₂ h₂ + · have := hc₁ hxy + have := congrArg Subtype.val this + simp only at this + exact Subtype.ext (by linarith) + · obtain ⟨h₃, h₄⟩ := hcross _ _ hxy + have := congrArg Subtype.val h₃ + have h₅ := congrArg Subtype.val h₄ + simp only [Icc.coe_one, Icc.coe_zero] at this h₅ + exact Subtype.ext (by linarith) + · obtain ⟨h₃, h₄⟩ := hcross _ _ hxy.symm + have := congrArg Subtype.val h₃ + have h₅ := congrArg Subtype.val h₄ + simp only [Icc.coe_one, Icc.coe_zero] at this h₅ + exact Subtype.ext (by linarith) + · have := hc₂ hxy + have := congrArg Subtype.val this + simp only at this + exact Subtype.ext (by linarith) + have := isLineWithEnds_range (c₁.trans c₂).toContinuousMap hinj + have hrange : range (c₁.trans c₂).toContinuousMap = L₁ ∪ L₂ := by + change range (c₁.trans c₂) = _ + rw [Path.trans_range, hr₁, hr₂] + rw [hrange] at this + simpa using this + +/-- A line minus one end is preconnected. -/ +theorem IsLineWithEnds.isPreconnected_sdiff {L : Set S} {v p : S} (h : IsLineWithEnds L v p) : + IsPreconnected (L \ {v}) := by + obtain ⟨f, hf0, hf1⟩ := h + have hEq : L \ {v} = (fun t => (f t).1) '' Ioc (0 : I) 1 := by + ext x + constructor + · rintro ⟨hx, hxv⟩ + obtain ⟨t, ht⟩ := f.surjective ⟨x, hx⟩ + have ht0 : t ≠ 0 := by + rintro rfl + exact hxv (by rw [← hf0, ht]; rfl) + exact ⟨t, ⟨unitInterval.pos_iff_ne_zero.mpr ht0, le_top⟩, by simp [ht]⟩ + · rintro ⟨t, ⟨h0, -⟩, rfl⟩ + refine ⟨(f t).2, fun hv => ?_⟩ + have : f t = f 0 := Subtype.ext (hv.trans hf0.symm) + exact h0.ne (f.injective this).symm + rw [hEq] + exact (isPreconnected_Ioc).image _ (by fun_prop) + +/-- The closure of a line minus one end contains that end. -/ +theorem IsLineWithEnds.mem_closure_sdiff {L : Set S} {v p : S} (h : IsLineWithEnds L v p) : + v ∈ closure (L \ {v}) := by + obtain ⟨f, hf0, hf1⟩ := h + have h1 : (0 : I) ∈ closure (Ioc (0 : I) 1) := by + rw [closure_Ioc (zero_ne_one)] + simp + have hc : Continuous fun t => (f t).1 := by fun_prop + have h2 := map_mem_closure hc h1 (t := L \ {v}) (by + rintro t ⟨h0, -⟩ + refine ⟨(f t).2, fun hv => ?_⟩ + have : f t = f 0 := Subtype.ext (hv.trans hf0.symm) + exact h0.ne (f.injective this).symm) + rwa [hf0] at h2 + +/-- A component of an `O`-arc minus two points has both points in its closure. -/ +theorem mem_closure_of_mem_componentsIn {F A : Set S} (hF : IsOArc F) {x y : S} (hx : x ∈ F) + (hy : y ∈ F) (hxy : x ≠ y) (hA : A ∈ componentsIn (F \ {x, y})) : x ∈ closure A := by + obtain ⟨φ⟩ := hF + obtain ⟨a, ha⟩ := φ.surjective ⟨x, hx⟩ + obtain ⟨b, hb⟩ := φ.surjective ⟨y, hy⟩ + have hab : a ≠ b := by + rintro rfl + exact hxy (congrArg Subtype.val (ha.symm.trans hb)) + let ι : Circle → S := fun w => (φ w).1 + have hι : Continuous ι := by fun_prop + have hιinj : Function.Injective ι := fun u w h => φ.injective (Subtype.ext h) + have hιa : ι a = x := by simp [ι, ha] + have hιb : ι b = y := by simp [ι, hb] + -- each of the two open arcs is sent into the complement of the two points + have hsub : ∀ c d : Circle, c ≠ d → (c = a ∧ d = b ∨ c = b ∧ d = a) → + ι '' circleOpenArc c d ⊆ F \ {x, y} := by + rintro c d hcd hor _ ⟨w, hw, rfl⟩ + refine ⟨(φ w).2, ?_⟩ + have h₁ : w ∈ ({a, b}ᶜ : Set Circle) := by + rw [compl_pair_eq_union_circleOpenArc hab] + rcases hor with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl hw + · exact Or.inr hw + rintro (h | h) + · exact h₁ (Or.inl (hιinj (h.trans hιa.symm))) + · exact h₁ (Or.inr (hιinj (h.trans hιb.symm))) + have hconn : ∀ c d : Circle, IsPreconnected (ι '' circleOpenArc c d) := fun c d => + (isPathConnected_circleOpenArc c d).isConnected.isPreconnected.image _ hι.continuousOn + have hclos : ∀ c d : Circle, c ≠ d → ι c ∈ closure (ι '' circleOpenArc c d) ∧ + ι d ∈ closure (ι '' circleOpenArc c d) := by + intro c d hcd + have h0 : (0 : I) ∈ closure (Ioo (0 : I) 1) := by + rw [closure_Ioo zero_ne_one] + simp + have h1 : (1 : I) ∈ closure (Ioo (0 : I) 1) := by + rw [closure_Ioo zero_ne_one] + simp + have hc : Continuous fun t => ι (Circle.path c d t) := by fun_prop + have m0 := map_mem_closure hc h0 (t := ι '' circleOpenArc c d) fun t ht => + mem_image_of_mem _ (mem_image_of_mem _ ht) + have m1 := map_mem_closure hc h1 (t := ι '' circleOpenArc c d) fun t ht => + mem_image_of_mem _ (mem_image_of_mem _ ht) + simpa using And.intro m0 m1 + obtain ⟨z, hz, rfl⟩ := hA + have hz' : (⟨z, hz.1⟩ : F) = φ (φ.symm ⟨z, hz.1⟩) := by simp + have hzι : z = ι (φ.symm ⟨z, hz.1⟩) := by simp [ι] + set w := φ.symm ⟨z, hz.1⟩ with hw + have hwc : w ∈ ({a, b}ᶜ : Set Circle) := by + rintro (h | h) + · exact hz.2 (Or.inl (by rw [hzι, h]; exact hιa)) + · exact hz.2 (Or.inr (by rw [hzι, h]; exact hιb)) + rw [compl_pair_eq_union_circleOpenArc hab] at hwc + rcases hwc with hwc | hwc + · have hs := (hconn a b).subset_connectedComponentIn (x := z) ⟨w, hwc, hzι.symm⟩ + (hsub a b hab (Or.inl ⟨rfl, rfl⟩)) + exact closure_mono hs (hιa ▸ (hclos a b hab).1) + · have hs := (hconn b a).subset_connectedComponentIn (x := z) ⟨w, hwc, hzι.symm⟩ + (hsub b a hab.symm (Or.inr ⟨rfl, rfl⟩)) + exact closure_mono hs (hιa ▸ (hclos b a hab.symm).2) + +/-! ## Splitting a sector -/ + +/-- A closed disc contains its boundary. -/ +theorem discBd_subset (Δ : Set S) : discBd Δ ⊆ Δ := by + rintro _ ⟨x, -, rfl⟩ + exact x.2 + +/-- Components are disjoint, or equal. -/ +private theorem disjoint_of_mem_componentsIn {T A B : Set S} (hA : A ∈ componentsIn T) + (hB : B ∈ componentsIn T) (h : A ≠ B) : Disjoint A B := by + obtain ⟨x, hx, rfl⟩ := hA + obtain ⟨y, hy, rfl⟩ := hB + refine Set.disjoint_left.mpr fun z hz hz' => h ?_ + rw [connectedComponentIn_eq hz, connectedComponentIn_eq hz'] + +/-- A nonempty preconnected subset of `T` lies in a component of `T`. -/ +private theorem exists_component_superset {T X : Set S} (hX : IsPreconnected X) (hne : X.Nonempty) + (hsub : X ⊆ T) : ∃ A ∈ componentsIn T, X ⊆ A := by + obtain ⟨x, hx⟩ := hne + exact ⟨_, ⟨x, hsub hx, rfl⟩, hX.subset_connectedComponentIn hx hsub⟩ + +/-- The sets of `componentsIn T` lie in `T`. -/ +private theorem subset_of_mem_componentsIn {T A : Set S} (hA : A ∈ componentsIn T) : A ⊆ T := by + obtain ⟨x, -, rfl⟩ := hA + exact connectedComponentIn_subset _ _ + +/-- The conclusion of `split_sector`, with the two sides named. -/ +private theorem split_sector_aux {Q Jk Jl Jc B A₁ A₂ Δ₁ Δ₂ : Set S} {v p : S} + (hdisj : Disjoint A₁ A₂) (hunion : discBd Q \ {v, p} ⊆ A₁ ∪ A₂) + (hA₁ : A₁ ⊆ discBd Q \ {v, p}) (h₁ : discBd Δ₁ = A₁ ∪ Jc) (h₂ : discBd Δ₂ = A₂ ∪ Jc) + (hΔ : Δ₁ ∩ Δ₂ = Jc) (hv : v ∈ Jc) (hp : p ∈ Jc) + (hbd : discBd Q = Jk ∪ Jl ∪ B) (hkA : Jk \ {v} ⊆ A₁) (hlA : Jl \ {v} ⊆ A₂) + (hcl : Jc ∩ Jl = {v}) (hvk : v ∈ Jk) : + (∃ B' ⊆ B, discBd Δ₁ = Jk ∪ Jc ∪ B') ∧ Δ₁ ∩ discBd Q ⊆ discBd Δ₁ ∧ Jl ∩ Δ₁ ⊆ {v} := by + have hA₂Δ : A₂ ⊆ Δ₂ := fun x hx => discBd_subset _ (h₂ ▸ Or.inl hx) + have hnot : ∀ x ∈ Jl, x ∈ Δ₁ → x = v := by + intro x hx hxΔ + by_cases hxv : x = v + · exact hxv + · have hx₂ : x ∈ Δ₁ ∩ Δ₂ := ⟨hxΔ, hA₂Δ (hlA ⟨hx, hxv⟩)⟩ + rw [hΔ] at hx₂ + have : x ∈ Jc ∩ Jl := ⟨hx₂, hx⟩ + rw [hcl] at this + exact this + refine ⟨⟨A₁ ∩ B, inter_subset_right, ?_⟩, ?_, fun x hx => hnot x hx.1 hx.2⟩ + · rw [h₁] + ext x + constructor + · rintro (hx | hx) + · have hxQ := (hA₁ hx).1 + rw [hbd] at hxQ + rcases hxQ with (hxk | hxl) | hxB + · exact Or.inl (Or.inl hxk) + · have hxv : x ≠ v := fun h => (hA₁ hx).2 (Or.inl h) + exact absurd (hlA ⟨hxl, hxv⟩) (Set.disjoint_left.mp hdisj hx) + · exact Or.inr ⟨hx, hxB⟩ + · exact Or.inl (Or.inr hx) + · rintro ((hx | hx) | hx) + · by_cases hxv : x = v + · exact Or.inr (hxv ▸ hv) + · exact Or.inl (hkA ⟨hx, hxv⟩) + · exact Or.inr hx + · exact Or.inl hx.1 + · rintro x ⟨hxΔ, hxQ⟩ + rw [h₁] + by_cases hxc : x ∈ ({v, p} : Set S) + · rcases hxc with rfl | rfl + · exact Or.inr hv + · exact Or.inr hp + · rcases hunion ⟨hxQ, hxc⟩ with hx | hx + · exact Or.inl hx + · have hx₂ : x ∈ Δ₁ ∩ Δ₂ := ⟨hxΔ, hA₂Δ hx⟩ + rw [hΔ] at hx₂ + exact Or.inr hx₂ + +/-- Split the sector `Q`, whose boundary consists of the lines `Jk`, `Jl` from `v` and a set `B` far +from `v`, along a new line `Jc` from `v`. The new sectors are `Δ₁`, between `Jk` and `Jc`, and `Δ₂`, +between `Jc` and `Jl`. -/ +theorem split_sector {Q Jk Jl Jc B E : Set S} + {v pk pl pc : S} (hQ : IsClosedDisc Q) (hk : IsLineWithEnds Jk v pk) + (hl : IsLineWithEnds Jl v pl) (hc : IsLineWithEnds Jc v pc) (hkv : v ≠ pk) (hlv : v ≠ pl) + (hcv : v ≠ pc) (hbd : discBd Q = Jk ∪ Jl ∪ B) (hBE : B ⊆ E) (hE : IsClosed E) (hvE : v ∉ E) + (hcQ : Jc ⊆ Q) (hcbd : Jc ∩ discBd Q = {v, pc}) (hck : Jc ∩ Jk = {v}) (hcl : Jc ∩ Jl = {v}) : + ∃ Δ₁ Δ₂ : Set S, IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ Δ₁ ∪ Δ₂ = Q ∧ Δ₁ ∩ Δ₂ = Jc ∧ + (∃ B' ⊆ B, discBd Δ₁ = Jk ∪ Jc ∪ B') ∧ (∃ B' ⊆ B, discBd Δ₂ = Jc ∪ Jl ∪ B') ∧ + Δ₁ ∩ discBd Q ⊆ discBd Δ₁ ∧ Δ₂ ∩ discBd Q ⊆ discBd Δ₂ ∧ Jl ∩ Δ₁ ⊆ {v} ∧ Jk ∩ Δ₂ ⊆ {v} := by + obtain ⟨A₁, A₂, Δ₁, Δ₂, hne, hcomp, hd₁, hd₂, hun, hint, hb₁, hb₂, -⟩ := + disc_iArc Q Jc v pc hQ hcQ hcv hc hcbd + have hvmem : v ∈ Jc ∩ discBd Q := by rw [hcbd]; simp + have hpmem : pc ∈ Jc ∩ discBd Q := by rw [hcbd]; simp + have hvc : v ∈ Jc := hvmem.1 + have hpc : pc ∈ Jc := hpmem.1 + have hA₁m : A₁ ∈ componentsIn (discBd Q \ {v, pc}) := by rw [hcomp]; simp + have hA₂m : A₂ ∈ componentsIn (discBd Q \ {v, pc}) := by rw [hcomp]; simp + have hdisj := disjoint_of_mem_componentsIn hA₁m hA₂m hne + have hunion : discBd Q \ {v, pc} ⊆ A₁ ∪ A₂ := by + intro x hx + have : connectedComponentIn (discBd Q \ {v, pc}) x ∈ componentsIn (discBd Q \ {v, pc}) := + ⟨x, hx, rfl⟩ + rw [hcomp] at this + rcases this with h | h + · exact Or.inl (h ▸ mem_connectedComponentIn hx) + · exact Or.inr ((mem_singleton_iff.mp h) ▸ mem_connectedComponentIn hx) + have hA₁s := subset_of_mem_componentsIn hA₁m + have hA₂s := subset_of_mem_componentsIn hA₂m + have hO : IsOArc (discBd Q) := hQ.isOArc_discBd + -- A component that misses both lines lies in `E`, and then `v` is not in its closure. + have hfar : ∀ A ∈ componentsIn (discBd Q \ {v, pc}), Disjoint A (Jk ∪ Jl) → False := by + intro A hA hdis + have hAE : A ⊆ E := by + intro x hx + have := (subset_of_mem_componentsIn hA hx).1 + rw [hbd] at this + rcases this with h | h + · exact absurd h (Set.disjoint_left.mp hdis hx) + · exact hBE h + have hcl' : v ∈ closure A := + mem_closure_of_mem_componentsIn hO hvmem.2 hpmem.2 hcv hA + exact hvE (closure_minimal hAE hE hcl') + -- Each line minus `v` lies in one of the components. + have hin : ∀ J : Set S, ∀ p, IsLineWithEnds J v p → v ≠ p → J ⊆ discBd Q → Jc ∩ J = {v} → + (J \ {v} ⊆ A₁ ∨ J \ {v} ⊆ A₂) := by + intro J p hJ hvp hJQ hcJ + have hpJ : p ∈ J := by + obtain ⟨f, -, hf⟩ := hJ + exact hf ▸ (f 1).2 + have hsub : J \ {v} ⊆ discBd Q \ {v, pc} := by + rintro x ⟨hx, hxv⟩ + refine ⟨hJQ hx, ?_⟩ + rintro (h | h) + · exact hxv h + · have hxpc : x = pc := h + have : x ∈ Jc ∩ J := ⟨hxpc ▸ hpc, hx⟩ + rw [hcJ] at this + exact hxv this + obtain ⟨A, hA, hsA⟩ := exists_component_superset (IsLineWithEnds.isPreconnected_sdiff hJ) + ⟨p, hpJ, fun h => hvp (mem_singleton_iff.mp h).symm⟩ hsub + rw [hcomp] at hA + rcases hA with rfl | hA + · exact Or.inl hsA + · exact Or.inr ((mem_singleton_iff.mp hA) ▸ hsA) + have hkQ : Jk ⊆ discBd Q := fun x hx => hbd ▸ Or.inl (Or.inl hx) + have hlQ : Jl ⊆ discBd Q := fun x hx => hbd ▸ Or.inl (Or.inr hx) + have hvk : v ∈ Jk := by obtain ⟨f, hf, -⟩ := hk; exact hf ▸ (f 0).2 + have hvl : v ∈ Jl := by obtain ⟨f, hf, -⟩ := hl; exact hf ▸ (f 0).2 + have hsamecase : ∀ A' ∈ componentsIn (discBd Q \ {v, pc}), Disjoint A' (Jk \ {v}) → + Disjoint A' (Jl \ {v}) → False := by + intro A' hA' h₁ h₂ + refine hfar A' hA' (Set.disjoint_left.mpr ?_) + rintro x hx (hxk | hxl) + · have hxv : x ≠ v := fun h => (subset_of_mem_componentsIn hA' hx).2 (Or.inl h) + exact Set.disjoint_left.mp h₁ hx ⟨hxk, hxv⟩ + · have hxv : x ≠ v := fun h => (subset_of_mem_componentsIn hA' hx).2 (Or.inl h) + exact Set.disjoint_left.mp h₂ hx ⟨hxl, hxv⟩ + have hpair : (Jk \ {v} ⊆ A₁ ∧ Jl \ {v} ⊆ A₂) ∨ (Jk \ {v} ⊆ A₂ ∧ Jl \ {v} ⊆ A₁) := by + rcases hin Jk pk hk hkv hkQ hck with h₁ | h₁ <;> rcases hin Jl pl hl hlv hlQ hcl with h₂ | h₂ + · exact absurd (hsamecase A₂ hA₂m (hdisj.symm.mono_right h₁) (hdisj.symm.mono_right h₂)) id + · exact Or.inl ⟨h₁, h₂⟩ + · exact Or.inr ⟨h₁, h₂⟩ + · exact absurd (hsamecase A₁ hA₁m (hdisj.mono_right h₁) (hdisj.mono_right h₂)) id + have hun' : A₂ ∪ A₁ = A₁ ∪ A₂ := union_comm _ _ + have hclk : Jc ∩ Jk = {v} := hck + have hint' : Δ₂ ∩ Δ₁ = Jc := by rw [inter_comm, hint] + have comm : ∀ {X Y Z : Set S}, Y ∪ X ∪ Z = X ∪ Y ∪ Z := fun {X Y Z} => by rw [union_comm Y X] + rcases hpair with ⟨hkA, hlA⟩ | ⟨hkA, hlA⟩ + · obtain ⟨c₁, c₂, c₃⟩ := split_sector_aux hdisj hunion hA₁s hb₁ hb₂ hint hvc hpc hbd + hkA hlA hcl hvk + obtain ⟨c₄, c₅, c₆⟩ := split_sector_aux hdisj.symm (by rwa [hun']) hA₂s hb₂ hb₁ hint' hvc hpc + (hbd.trans comm.symm) hlA hkA hck hvl + obtain ⟨B₁, hB₁, h₁⟩ := c₁ + obtain ⟨B₂, hB₂, h₂⟩ := c₄ + refine ⟨Δ₁, Δ₂, hd₁, hd₂, hun, hint, ⟨B₁, hB₁, h₁⟩, ⟨B₂, hB₂, ?_⟩, c₂, c₅, c₃, c₆⟩ + rw [h₂, union_comm Jl Jc] + · -- The two discs are exchanged. + obtain ⟨c₁, c₂, c₃⟩ := split_sector_aux hdisj.symm (by rwa [hun']) hA₂s hb₂ hb₁ hint' hvc hpc + hbd hkA hlA hcl hvk + obtain ⟨c₄, c₅, c₆⟩ := split_sector_aux hdisj hunion hA₁s hb₁ hb₂ hint hvc hpc + (hbd.trans comm.symm) hlA hkA hck hvl + obtain ⟨B₁, hB₁, h₁⟩ := c₁ + obtain ⟨B₂, hB₂, h₂⟩ := c₄ + refine ⟨Δ₂, Δ₁, hd₂, hd₁, by rw [union_comm, hun], hint', ⟨B₁, hB₁, h₁⟩, + ⟨B₂, hB₂, ?_⟩, c₂, c₅, c₃, c₆⟩ + rw [h₂, union_comm Jl Jc] + +end Lines + +/-! ## The sectors -/ + +section Fan + +variable {ι : Type*} [DecidableEq ι] + +/-- The sectors `Q k` of the closed disc `D` around `v`, for the lines `J i`, `i ∈ s`. The sector +`Q k` lies between the line `J k` and the next line `J (next k)`. The conditions are those that +adding a line needs. -/ +structure FanInv (D : Set S) (J : ι → Set S) (v : S) (s : Finset ι) (next : ι → ι) + (Q : ι → Set S) : Prop where + next_mem : ∀ k ∈ s, next k ∈ s + next_ne : ∀ k ∈ s, next k ≠ k + next_inj : ∀ k ∈ s, ∀ l ∈ s, next k = next l → k = l + disc : ∀ k ∈ s, IsClosedDisc (Q k) + bd : ∀ k ∈ s, ∃ B ⊆ discBd D, discBd (Q k) = J k ∪ J (next k) ∪ B + cover : ⋃ k ∈ s, Q k = D + inter : ∀ k ∈ s, ∀ l ∈ s, k ≠ l → Q k ∩ Q l ⊆ ⋃ i ∈ s, J i + edge : ∀ k ∈ s, Q k ∩ discBd D ⊆ discBd (Q k) + off : ∀ k ∈ s, ∀ i ∈ s, i ≠ k → i ≠ next k → J i ∩ Q k ⊆ {v} ∪ discBd D + reach : ∀ a ∈ s, ∀ b ∈ s, Relation.ReflTransGen (fun x y => y = next x) a b + +variable [T2Space S] {D : Set S} {J : ι → Set S} {v : S} {p : ι → S} + +/-- The two sectors of two lines. -/ +theorem fanInv_pair (hD : IsClosedDisc D) + (hline : ∀ i, IsLineWithEnds (J i) v (p i)) (hsub : ∀ i, J i ⊆ D) + (hbd : ∀ i, J i ∩ discBd D = {p i}) (hJJ : ∀ i j, i ≠ j → J i ∩ J j = {v}) + (hne : ∀ i, v ≠ p i) {a b : ι} (hab : a ≠ b) : + ∃ next Q, FanInv D J v {a, b} next Q := by + have hF : IsLineWithEnds (J a ∪ J b) (p a) (p b) := IsLineWithEnds.union (hline a) (hline b) + (hJJ a b hab) + have hpp : p a ≠ p b := by + intro h + have hpa : p a ∈ J a := by + have : p a ∈ J a ∩ discBd D := by rw [hbd]; simp + exact this.1 + have hpb : p a ∈ J b := by + have : p b ∈ J b ∩ discBd D := by rw [hbd]; simp + exact h ▸ this.1 + have : p a ∈ J a ∩ J b := ⟨hpa, hpb⟩ + rw [hJJ a b hab] at this + exact hne a this.symm + have hcap : (J a ∪ J b) ∩ discBd D = {p a, p b} := by + rw [union_inter_distrib_right, hbd, hbd] + rfl + obtain ⟨A₁, A₂, Δ₁, Δ₂, hneA, hcomp, hd₁, hd₂, hun, hint, hb₁, hb₂, -⟩ := + disc_iArc D (J a ∪ J b) (p a) (p b) hD (union_subset (hsub a) (hsub b)) hpp hF hcap + have hA₁m : A₁ ∈ componentsIn (discBd D \ {p a, p b}) := by rw [hcomp]; simp + have hA₂m : A₂ ∈ componentsIn (discBd D \ {p a, p b}) := by rw [hcomp]; simp + have hA₁s := subset_of_mem_componentsIn hA₁m + have hA₂s := subset_of_mem_componentsIn hA₂m + have hunion : discBd D \ {p a, p b} ⊆ A₁ ∪ A₂ := by + intro x hx + have : connectedComponentIn (discBd D \ {p a, p b}) x ∈ componentsIn (discBd D \ {p a, p b}) := + ⟨x, hx, rfl⟩ + rw [hcomp] at this + rcases this with h | h + · exact Or.inl (h ▸ mem_connectedComponentIn hx) + · exact Or.inr ((mem_singleton_iff.mp h) ▸ mem_connectedComponentIn hx) + have hbaF : ∀ x ∈ discBd D, x ∈ J a ∪ J b ∨ x ∈ A₁ ∨ x ∈ A₂ := by + intro x hx + by_cases h : x ∈ ({p a, p b} : Set S) + · left + rw [← hcap] at h + exact h.1 + · exact Or.inr (hunion ⟨hx, h⟩) + have hA₁Δ : A₁ ⊆ Δ₁ := fun x hx => discBd_subset _ (hb₁ ▸ Or.inl hx) + have hA₂Δ : A₂ ⊆ Δ₂ := fun x hx => discBd_subset _ (hb₂ ▸ Or.inl hx) + let next : ι → ι := fun k => if k = a then b else a + let Q : ι → Set S := fun k => if k = a then Δ₁ else Δ₂ + have hna : next a = b := by simp [next] + have hnb : next b = a := by simp [next, hab.symm] + have hQa : Q a = Δ₁ := by simp [Q] + have hQb : Q b = Δ₂ := by simp [Q, hab.symm] + have hmem : ∀ k ∈ ({a, b} : Finset ι), k = a ∨ k = b := by simp + refine ⟨next, Q, ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩⟩ + · intro k hk + rcases hmem k hk with rfl | rfl + · simp [hna] + · simp [hnb] + · intro k hk + rcases hmem k hk with rfl | rfl + · rw [hna]; exact hab.symm + · rw [hnb]; exact hab + · intro k hk l hl h + rcases hmem k hk with rfl | rfl <;> rcases hmem l hl with rfl | rfl + · rfl + · rw [hna, hnb] at h; exact h.symm ▸ rfl + · rw [hna, hnb] at h; exact h.symm ▸ rfl + · rfl + · intro k hk + rcases hmem k hk with rfl | rfl + · rwa [hQa] + · rwa [hQb] + · intro k hk + rcases hmem k hk with rfl | rfl + · exact ⟨A₁, fun x hx => (hA₁s hx).1, by rw [hna, hQa, hb₁, union_comm]⟩ + · refine ⟨A₂, fun x hx => (hA₂s hx).1, ?_⟩ + rw [hnb, hQb, hb₂] + ext x + simp only [mem_union] + tauto + · simp only [Finset.mem_insert, Finset.mem_singleton, iUnion_iUnion_eq_or_left, + iUnion_iUnion_eq_left, + hQa, hQb, hun] + · intro k hk l hl h + rcases hmem k hk with rfl | rfl <;> rcases hmem l hl with rfl | rfl + · exact absurd rfl h + · rw [hQa, hQb, hint] + rintro x (hx | hx) + · exact mem_iUnion₂.mpr ⟨k, by simp, hx⟩ + · exact mem_iUnion₂.mpr ⟨l, by simp, hx⟩ + · rw [hQa, hQb, inter_comm, hint] + rintro x (hx | hx) + · exact mem_iUnion₂.mpr ⟨l, by simp, hx⟩ + · exact mem_iUnion₂.mpr ⟨k, by simp, hx⟩ + · exact absurd rfl h + · intro k hk + rintro x ⟨hxQ, hxD⟩ + rcases hmem k hk with rfl | rfl + · rw [hQa] at hxQ ⊢ + rw [hb₁] + rcases hbaF x hxD with h | h | h + · exact Or.inr h + · exact Or.inl h + · have : x ∈ Δ₁ ∩ Δ₂ := ⟨hxQ, hA₂Δ h⟩ + rw [hint] at this + exact Or.inr this + · rw [hQb] at hxQ ⊢ + rw [hb₂] + rcases hbaF x hxD with h | h | h + · exact Or.inr h + · have : x ∈ Δ₁ ∩ Δ₂ := ⟨hA₁Δ h, hxQ⟩ + rw [hint] at this + exact Or.inr this + · exact Or.inl h + · intro k hk i hi h₁ h₂ + rcases hmem k hk with rfl | rfl <;> rcases hmem i hi with rfl | rfl + · exact absurd rfl h₁ + · exact absurd hna.symm h₂ + · exact absurd hnb.symm h₂ + · exact absurd rfl h₁ + · intro x hx y hy + have hstep : Relation.ReflTransGen (fun x y => y = next x) a b := + Relation.ReflTransGen.single hna.symm + have hstep' : Relation.ReflTransGen (fun x y => y = next x) b a := + Relation.ReflTransGen.single hnb.symm + rcases hmem x hx with rfl | rfl <;> rcases hmem y hy with rfl | rfl + · exact Relation.ReflTransGen.refl + · exact hstep + · exact hstep' + · exact Relation.ReflTransGen.refl + +omit [DecidableEq ι] in +private theorem exists_sector_containing_line + (hline : ∀ i, IsLineWithEnds (J i) v (p i)) (hsub : ∀ i, J i ⊆ D) + (hbd : ∀ i, J i ∩ discBd D = {p i}) (hJJ : ∀ i j, i ≠ j → J i ∩ J j = {v}) + (hne : ∀ i, v ≠ p i) {s : Finset ι} {next : ι → ι} {Q : ι → Set S} + (h : FanInv D J v s next Q) {c : ι} (hc : c ∉ s) : + ∃ k ∈ s, J c ⊆ Q k ∧ J c ∩ discBd (Q k) = {v, p c} := by + classical + have hpc : p c ∈ J c ∩ discBd D := by rw [hbd]; simp + have hvJ : ∀ i, v ∈ J i := fun i => by obtain ⟨f, hf, -⟩ := hline i; exact hf ▸ (f 0).2 + have hcJ : ∀ i ∈ s, J c ∩ J i = {v} := fun i hi => hJJ c i fun h' => hc (h' ▸ hi) + have hpcD : p c ∈ D := hsub c hpc.1 + rw [← h.cover] at hpcD + obtain ⟨k, hk, hpck⟩ := mem_iUnion₂.mp hpcD + have hTne : p c ∈ J c \ {v} := ⟨hpc.1, fun h' => hne c (mem_singleton_iff.mp h').symm⟩ + have hTconn := IsLineWithEnds.isPreconnected_sdiff (hline c) + have hcQ' : J c \ {v} ⊆ Q k := by + by_contra hnot + obtain ⟨x, hx, hxk⟩ := not_subset.mp hnot + have hBclosed : IsClosed (⋃ l ∈ s.erase k, Q l) := + (s.erase k).finite_toSet.isClosed_biUnion fun l hl => + (h.disc l (Finset.mem_of_mem_erase hl)).isClosed + have hcover : J c \ {v} ⊆ Q k ∪ ⋃ l ∈ s.erase k, Q l := by + intro y hy + have hyD : y ∈ D := hsub c hy.1 + rw [← h.cover] at hyD + obtain ⟨l, hl, hyl⟩ := mem_iUnion₂.mp hyD + by_cases hlk : l = k + · exact Or.inl (hlk ▸ hyl) + · exact Or.inr (mem_iUnion₂.mpr ⟨l, Finset.mem_erase.mpr ⟨hlk, hl⟩, hyl⟩) + have hxB : x ∈ ⋃ l ∈ s.erase k, Q l := (hcover hx).resolve_left hxk + obtain ⟨y, hy, hyk, hyB⟩ := isPreconnected_closed_iff.mp hTconn _ _ (h.disc k hk).isClosed + hBclosed hcover ⟨p c, hTne, hpck⟩ ⟨x, hx, hxB⟩ + obtain ⟨l, hl, hyl⟩ := mem_iUnion₂.mp hyB + have hle := Finset.mem_erase.mp hl + obtain ⟨i, hi, hyi⟩ := mem_iUnion₂.mp (h.inter k hk l hle.2 (Ne.symm hle.1) ⟨hyk, hyl⟩) + have : y ∈ J c ∩ J i := ⟨hy.1, hyi⟩ + rw [hcJ i hi] at this + exact hy.2 this + have hcQ : J c ⊆ Q k := by + intro x hx + by_cases hxv : x = v + · have := closure_minimal hcQ' (h.disc k hk).isClosed + (IsLineWithEnds.mem_closure_sdiff (hline c)) + exact hxv ▸ this + · exact hcQ' ⟨hx, hxv⟩ + have hl := h.next_mem k hk + obtain ⟨B, hBD, hbdQ⟩ := h.bd k hk + have hkbd : J k ⊆ discBd (Q k) := fun x hx => hbdQ ▸ Or.inl (Or.inl hx) + have hcbd : J c ∩ discBd (Q k) = {v, p c} := by + ext x + constructor + · rintro ⟨hx, hxQ⟩ + rw [hbdQ] at hxQ + rcases hxQ with (h₁ | h₁) | h₁ + · have : x ∈ J c ∩ J k := ⟨hx, h₁⟩ + rw [hcJ k hk] at this + exact Or.inl this + · have : x ∈ J c ∩ J (next k) := ⟨hx, h₁⟩ + rw [hcJ _ hl] at this + exact Or.inl this + · have : x ∈ J c ∩ discBd D := ⟨hx, hBD h₁⟩ + rw [hbd] at this + exact Or.inr this + · rintro (rfl | rfl) + · exact ⟨hvJ c, hkbd (hvJ k)⟩ + · exact ⟨hpc.1, h.edge k hk ⟨hpck, hpc.2⟩⟩ + exact ⟨k, hk, hcQ, hcbd⟩ + +/-- Add one line to the sectors: it lies in one sector, and it splits that sector into two. -/ +theorem fanInv_insert (hD : IsClosedDisc D) + (hline : ∀ i, IsLineWithEnds (J i) v (p i)) (hsub : ∀ i, J i ⊆ D) + (hbd : ∀ i, J i ∩ discBd D = {p i}) (hJJ : ∀ i j, i ≠ j → J i ∩ J j = {v}) + (hne : ∀ i, v ≠ p i) (hvD : v ∉ discBd D) {s : Finset ι} {next : ι → ι} {Q : ι → Set S} + (h : FanInv D J v s next Q) {c : ι} (hc : c ∉ s) : + ∃ next' Q', FanInv D J v (insert c s) next' Q' := by + have hEclosed : IsClosed (discBd D) := by + obtain ⟨φ⟩ := hD.isOArc_discBd + have : CompactSpace (discBd D) := φ.compactSpace + exact (isCompact_iff_compactSpace.mpr this).isClosed + have hcJ : ∀ i ∈ s, J c ∩ J i = {v} := fun i hi => hJJ c i fun h' => hc (h' ▸ hi) + obtain ⟨k, hk, hcQ, hcbd⟩ := exists_sector_containing_line hline hsub hbd hJJ hne h hc + have hl := h.next_mem k hk + obtain ⟨B, hBD, hbdQ⟩ := h.bd k hk + obtain ⟨Δ₁, Δ₂, hd₁, hd₂, hun, hint, ⟨B₁, hB₁, hb₁⟩, ⟨B₂, hB₂, hb₂⟩, he₁, he₂, hoff₁, hoff₂⟩ := + split_sector (h.disc k hk) (hline k) (hline (next k)) (hline c) (hne k) (hne _) (hne c) hbdQ + hBD hEclosed hvD hcQ hcbd (hcJ k hk) (hcJ _ hl) + have hΔ₁ : Δ₁ ⊆ Q k := hun ▸ subset_union_left + have hΔ₂ : Δ₂ ⊆ Q k := hun ▸ subset_union_right + set l := next k with hldef + have hcs : ∀ x ∈ s, x ≠ c := fun x hx hxc => hc (hxc ▸ hx) + let next' : ι → ι := fun x => if x = c then l else if x = k then c else next x + let Q' : ι → Set S := fun x => if x = c then Δ₂ else if x = k then Δ₁ else Q x + have nc : next' c = l := by simp [next'] + have nk : next' k = c := by simp [next', hcs k hk] + have nx : ∀ x ∈ s, x ≠ k → next' x = next x := fun x hx hxk => by simp [next', hcs x hx, hxk] + have Qc : Q' c = Δ₂ := by simp [Q'] + have Qk : Q' k = Δ₁ := by simp [Q', hcs k hk] + have Qx : ∀ x ∈ s, x ≠ k → Q' x = Q x := fun x hx hxk => by simp [Q', hcs x hx, hxk] + have hmem : ∀ x ∈ insert c s, x = c ∨ x = k ∨ (x ∈ s ∧ x ≠ k) := by + intro x hx + rcases Finset.mem_insert.mp hx with rfl | hx + · exact Or.inl rfl + · by_cases hxk : x = k + · exact Or.inr (Or.inl hxk) + · exact Or.inr (Or.inr ⟨hx, hxk⟩) + have hkin : k ∈ insert c s := Finset.mem_insert_of_mem hk + have hlin : l ∈ insert c s := Finset.mem_insert_of_mem hl + have hcin : c ∈ insert c s := Finset.mem_insert_self c s + have hnextne : ∀ x ∈ s, x ≠ k → next x ≠ l := fun x hx hxk he => hxk (h.next_inj x hx k hk he) + have hQsub : ∀ x ∈ s, x ≠ k → Q' x ⊆ Q x := fun x hx hxk => (Qx x hx hxk).subset + have hbig : (⋃ i ∈ s, J i) ⊆ ⋃ i ∈ insert c s, J i := by + refine iUnion₂_subset fun i hi => ?_ + exact subset_biUnion_of_mem (u := J) (show i ∈ (↑(insert c s) : Set ι) by simp [hi]) + have hJcbig : J c ⊆ ⋃ i ∈ insert c s, J i := + subset_biUnion_of_mem (u := J) (show c ∈ (↑(insert c s) : Set ι) by simp) + refine ⟨next', Q', ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩⟩ + · intro x hx + rcases hmem x hx with rfl | rfl | ⟨hxs, hxk⟩ + · rwa [nc] + · rwa [nk] + · rw [nx x hxs hxk]; exact Finset.mem_insert_of_mem (h.next_mem x hxs) + · intro x hx + rcases hmem x hx with rfl | rfl | ⟨hxs, hxk⟩ + · rw [nc]; exact hcs l hl + · rw [nk]; exact (hcs x hk).symm + · rw [nx x hxs hxk]; exact h.next_ne x hxs + · intro x hx y hy he + rcases hmem x hx with rfl | rfl | ⟨hxs, hxk⟩ <;> rcases hmem y hy with rfl | rfl | ⟨hys, hyk⟩ + · rfl + · rw [nc, nk] at he; exact absurd he (hcs l hl) + · rw [nc, nx y hys hyk] at he; exact absurd he.symm (hnextne y hys hyk) + · rw [nc, nk] at he; exact absurd he.symm (hcs l hl) + · rfl + · rw [nk, nx y hys hyk] at he + exact absurd (he ▸ h.next_mem y hys) hc + · rw [nc, nx x hxs hxk] at he; exact absurd he (hnextne x hxs hxk) + · rw [nk, nx x hxs hxk] at he + exact absurd (he.symm ▸ h.next_mem x hxs) hc + · rw [nx x hxs hxk, nx y hys hyk] at he + exact h.next_inj x hxs y hys he + · intro x hx + rcases hmem x hx with rfl | rfl | ⟨hxs, hxk⟩ + · rwa [Qc] + · rwa [Qk] + · rw [Qx x hxs hxk]; exact h.disc x hxs + · intro x hx + rcases hmem x hx with rfl | rfl | ⟨hxs, hxk⟩ + · exact ⟨B₂, hB₂.trans hBD, by rw [Qc, nc, hb₂]⟩ + · exact ⟨B₁, hB₁.trans hBD, by rw [Qk, nk, hb₁]⟩ + · rw [Qx x hxs hxk, nx x hxs hxk]; exact h.bd x hxs + · ext y + constructor + · intro hy + obtain ⟨x, hx, hyx⟩ := mem_iUnion₂.mp hy + rw [← h.cover] + rcases hmem x hx with rfl | rfl | ⟨hxs, hxk⟩ + · rw [Qc] at hyx; exact mem_iUnion₂.mpr ⟨k, hk, hΔ₂ hyx⟩ + · rw [Qk] at hyx; exact mem_iUnion₂.mpr ⟨x, hk, hΔ₁ hyx⟩ + · exact mem_iUnion₂.mpr ⟨x, hxs, hQsub x hxs hxk hyx⟩ + · intro hy + rw [← h.cover] at hy + obtain ⟨x, hx, hyx⟩ := mem_iUnion₂.mp hy + by_cases hxk : x = k + · subst hxk + rw [← hun] at hyx + rcases hyx with hyx | hyx + · exact mem_iUnion₂.mpr ⟨x, hkin, by rwa [Qk]⟩ + · exact mem_iUnion₂.mpr ⟨c, hcin, by rwa [Qc]⟩ + · exact mem_iUnion₂.mpr ⟨x, Finset.mem_insert_of_mem hx, by rwa [Qx x hx hxk]⟩ + · intro x hx y hy hxy + rcases hmem x hx with rfl | rfl | ⟨hxs, hxk⟩ <;> rcases hmem y hy with rfl | rfl | ⟨hys, hyk⟩ + · exact absurd rfl hxy + · rw [Qc, Qk, inter_comm, hint]; exact hJcbig + · rw [Qc, Qx y hys hyk] + exact (inter_subset_inter_left _ hΔ₂).trans ((h.inter k hk y hys (Ne.symm hyk)).trans hbig) + · rw [Qc, Qk, hint]; exact hJcbig + · exact absurd rfl hxy + · rw [Qk, Qx y hys hyk] + exact (inter_subset_inter_left _ hΔ₁).trans ((h.inter x hk y hys (Ne.symm hyk)).trans hbig) + · rw [Qc, Qx x hxs hxk] + exact (inter_subset_inter_right _ hΔ₂).trans ((h.inter x hxs k hk hxk).trans hbig) + · rw [Qk, Qx x hxs hxk] + exact (inter_subset_inter_right _ hΔ₁).trans ((h.inter x hxs y hk hxk).trans hbig) + · rw [Qx x hxs hxk, Qx y hys hyk] + exact (h.inter x hxs y hys hxy).trans hbig + · intro x hx + rcases hmem x hx with rfl | rfl | ⟨hxs, hxk⟩ + · rw [Qc] + rintro y ⟨hy, hyD⟩ + exact he₂ ⟨hy, h.edge k hk ⟨hΔ₂ hy, hyD⟩⟩ + · rw [Qk] + rintro y ⟨hy, hyD⟩ + exact he₁ ⟨hy, h.edge x hk ⟨hΔ₁ hy, hyD⟩⟩ + · rw [Qx x hxs hxk]; exact h.edge x hxs + · intro x hx i hi h₁ h₂ + rcases hmem x hx with rfl | rfl | ⟨hxs, hxk⟩ + · rw [nc] at h₂ + rw [Qc] + have his : i ∈ s := (Finset.mem_insert.mp hi).resolve_left h₁ + by_cases hik : i = k + · subst hik + exact hoff₂.trans subset_union_left + · exact (inter_subset_inter_right _ hΔ₂).trans (h.off k hk i his hik h₂) + · rw [nk] at h₂ + rw [Qk] + have his : i ∈ s := (Finset.mem_insert.mp hi).resolve_left h₂ + by_cases hil : i = l + · subst hil + exact hoff₁.trans subset_union_left + · exact (inter_subset_inter_right _ hΔ₁).trans (h.off x hk i his h₁ hil) + · rw [nx x hxs hxk] at h₂ + rw [Qx x hxs hxk] + rcases Finset.mem_insert.mp hi with rfl | his + · rintro y ⟨hyc, hyx⟩ + obtain ⟨m, hm, hym⟩ := mem_iUnion₂.mp (h.inter x hxs k hk hxk ⟨hyx, hcQ hyc⟩) + have : y ∈ J i ∩ J m := ⟨hyc, hym⟩ + rw [hcJ m hm] at this + exact Or.inl this + · exact h.off x hxs i his h₁ h₂ + · have hold : ∀ a ∈ s, ∀ y, Relation.ReflTransGen (fun x y => y = next x) a y → + y ∈ s ∧ Relation.ReflTransGen (fun x y => y = next' x) a y := by + intro a ha y hy + induction hy with + | refl => exact ⟨ha, Relation.ReflTransGen.refl⟩ + | @tail x y _ hstep ih => + obtain ⟨hx, hr⟩ := ih + subst hstep + refine ⟨h.next_mem x hx, ?_⟩ + by_cases hxk : x = k + · subst hxk + exact (hr.tail nk.symm).tail nc.symm + · exact hr.tail (nx x hx hxk).symm + have hold' : ∀ a ∈ s, ∀ b ∈ s, Relation.ReflTransGen (fun x y => y = next' x) a b := + fun a ha b hb => (hold a ha b (h.reach a ha b hb)).2 + intro a ha b hb + rcases Finset.mem_insert.mp ha with rfl | has <;> rcases Finset.mem_insert.mp hb with rfl | hbs + · exact Relation.ReflTransGen.refl + · have hstep : Relation.ReflTransGen (fun x y => y = next' x) a l := + Relation.ReflTransGen.single nc.symm + exact hstep.trans (hold' l hl b hbs) + · exact (hold' a has k hk).tail nk.symm + · exact hold' a has b hbs + +omit [DecidableEq ι] in +/-- The sectors of finitely many lines, at least two, from an interior point of a closed disc. -/ +theorem exists_fanInv (hD : IsClosedDisc D) + (hline : ∀ i, IsLineWithEnds (J i) v (p i)) (hsub : ∀ i, J i ⊆ D) + (hbd : ∀ i, J i ∩ discBd D = {p i}) (hJJ : ∀ i j, i ≠ j → J i ∩ J j = {v}) + (hne : ∀ i, v ≠ p i) (hvD : v ∉ discBd D) (s : Finset ι) (hs : 2 ≤ s.card) : + ∃ next Q, FanInv D J v s next Q := by + classical + induction s using Finset.induction_on with + | empty => simp at hs + | insert c t hc ih => + rw [Finset.card_insert_of_notMem hc] at hs + by_cases ht : 2 ≤ t.card + · obtain ⟨next, Q, h⟩ := ih ht + exact fanInv_insert hD hline hsub hbd hJJ hne hvD h hc + · obtain ⟨a, rfl⟩ := Finset.card_eq_one.mp (show t.card = 1 by omega) + exact fanInv_pair hD hline hsub hbd hJJ hne (fun h' => hc (by simp [h'])) + +omit [T2Space S] [DecidableEq ι] in +/-- Sets near `v` in the sectors. Each `P k` is a preconnected set in the sector `Q k`, off the +closed set `X` and off the boundary of the sector, and near `v` it is all of the interior of the +sector and has all of the boundary in its closure. -/ +theorem exists_sector_sets {s : Finset ι} {next : ι → ι} + {Q : ι → Set S} (h : FanInv D J v s next Q) {G : Set S} (hG : IsOpen G) (hvG : v ∈ G) + (hvJ : ∀ i, v ∈ J i) {X : Set S} (hX : IsClosed X) (hvX : v ∉ X) : + ∃ (P : ι → Set S) (W : Set S), IsOpen W ∧ v ∈ W ∧ W ⊆ G ∧ + (∀ k ∈ s, IsPreconnected (P k) ∧ P k ⊆ Q k ∧ Disjoint (P k) (discBd (Q k)) ∧ + Disjoint (P k) X ∧ (W ∩ Q k) \ discBd (Q k) ⊆ P k ∧ + W ∩ discBd (Q k) ⊆ closure (P k)) := by + classical + have hvbd : ∀ k ∈ s, v ∈ discBd (Q k) := by + intro k hk + obtain ⟨B, -, hb⟩ := h.bd k hk + exact hb ▸ Or.inl (Or.inl (hvJ k)) + have hex : ∀ k : ι, ∃ A W : Set S, k ∈ s → IsOpen W ∧ v ∈ W ∧ IsPreconnected A ∧ A ⊆ Q k ∧ + Disjoint A (discBd (Q k)) ∧ Disjoint A X ∧ (W ∩ Q k) \ discBd (Q k) ⊆ A ∧ + W ∩ discBd (Q k) ⊆ closure A := by + intro k + by_cases hk : k ∈ s + · obtain ⟨A, W, a₁, a₂, a₃, a₄, a₅, a₆, a₇, a₈⟩ := + exists_half_nbhd (h.disc k hk) hX (hvbd k hk) hvX + exact ⟨A, W, fun _ => ⟨a₁, a₂, a₃, a₄, a₅, a₆, a₇, a₈⟩⟩ + · exact ⟨∅, ∅, fun h' => absurd h' hk⟩ + choose P W₀ hPW using hex + refine ⟨P, G ∩ ⋂ k ∈ s, W₀ k, ?_, ?_, inter_subset_left, ?_⟩ + · exact hG.inter (s.finite_toSet.isOpen_biInter fun k hk => (hPW k hk).1) + · exact ⟨hvG, mem_iInter₂.mpr fun k hk => (hPW k hk).2.1⟩ + · intro k hk + obtain ⟨-, -, a₃, a₄, a₅, a₆, a₇, a₈⟩ := hPW k hk + have hsubW : G ∩ ⋂ k ∈ s, W₀ k ⊆ W₀ k := fun x hx => mem_iInter₂.mp hx.2 k hk + exact ⟨a₃, a₄, a₅, a₆, fun x hx => a₇ ⟨⟨hsubW hx.1.1, hx.1.2⟩, hx.2⟩, + fun x hx => a₈ ⟨hsubW hx.1, hx.2⟩⟩ + +omit [T2Space S] [DecidableEq ι] in +/-- What the sets of `exists_sector_sets` give near `v`. Off the lines, a point of `W` lies in one +of +the sets `P k`. Moreover, a point of the line `J (next k)` near `v` has a neighbourhood that off the +lines lies in `P k` and `P (next k)`, and it is in the closure of both. -/ +theorem sector_sets_props {s : Finset ι} {next : ι → ι} {Q : ι → Set S} + (h : FanInv D J v s next Q) {P : ι → Set S} {W : Set S} (hW : IsOpen W) + (hWD : W ⊆ D) (hWbd : Disjoint W (discBd D)) + (hclosed : ∀ k ∈ s, IsClosed (Q k)) + (hP : ∀ k ∈ s, (W ∩ Q k) \ discBd (Q k) ⊆ P k ∧ W ∩ discBd (Q k) ⊆ closure (P k)) : + (W \ ⋃ i ∈ s, J i ⊆ ⋃ k ∈ s, P k) ∧ + ∀ k ∈ s, ∀ q ∈ W ∩ J (next k), q ≠ v → ∃ O, IsOpen O ∧ q ∈ O ∧ + O \ (⋃ i ∈ s, J i) ⊆ P k ∪ P (next k) ∧ q ∈ closure (P k) ∧ q ∈ closure (P (next k)) := by + classical + have hin : ∀ m ∈ s, ∀ x ∈ W, x ∈ Q m → x ∉ (⋃ i ∈ s, J i) → x ∈ P m := by + intro m hm x hxW hxm hxJ + refine (hP m hm).1 ⟨⟨hxW, hxm⟩, ?_⟩ + obtain ⟨B, hBD, hb⟩ := h.bd m hm + rw [hb] + rintro ((hx | hx) | hx) + · exact hxJ (mem_iUnion₂.mpr ⟨m, hm, hx⟩) + · exact hxJ (mem_iUnion₂.mpr ⟨_, h.next_mem m hm, hx⟩) + · exact Set.disjoint_left.mp hWbd hxW (hBD hx) + constructor + · rintro x ⟨hxW, hxJ⟩ + have hxD := hWD hxW + rw [← h.cover] at hxD + obtain ⟨m, hm, hxm⟩ := mem_iUnion₂.mp hxD + exact mem_iUnion₂.mpr ⟨m, hm, hin m hm x hxW hxm hxJ⟩ + · rintro k hk q ⟨hqW, hqJ⟩ hqv + have hl := h.next_mem k hk + obtain ⟨B₁, -, hb₁⟩ := h.bd k hk + obtain ⟨B₂, -, hb₂⟩ := h.bd _ hl + have hq₁ : q ∈ discBd (Q k) := hb₁ ▸ Or.inl (Or.inr hqJ) + have hq₂ : q ∈ discBd (Q (next k)) := hb₂ ▸ Or.inl (Or.inl hqJ) + -- Remove the other sectors. + have hclosedU : IsClosed (⋃ m ∈ (s.erase k).erase (next k), Q m) := + ((s.erase k).erase (next k)).finite_toSet.isClosed_biUnion fun m hm => + hclosed m (Finset.mem_of_mem_erase (Finset.mem_of_mem_erase hm)) + have hqU : q ∉ ⋃ m ∈ (s.erase k).erase (next k), Q m := by + intro hq + obtain ⟨m, hm, hqm⟩ := mem_iUnion₂.mp hq + have hm₁ := Finset.mem_erase.mp hm + have hm₂ := Finset.mem_erase.mp hm₁.2 + have hne : next k ≠ next m := fun he => hm₂.1 (h.next_inj k hk m hm₂.2 he).symm + rcases h.off m hm₂.2 (next k) hl (Ne.symm hm₁.1) hne ⟨hqJ, hqm⟩ with hx | hx + · exact hqv hx + · exact Set.disjoint_left.mp hWbd hqW hx + refine ⟨W \ ⋃ m ∈ (s.erase k).erase (next k), Q m, hW.sdiff hclosedU, ⟨hqW, hqU⟩, ?_, + (hP k hk).2 ⟨hqW, hq₁⟩, (hP _ hl).2 ⟨hqW, hq₂⟩⟩ + rintro x ⟨⟨hxW, hxU⟩, hxJ⟩ + have hxD := hWD hxW + rw [← h.cover] at hxD + obtain ⟨m, hm, hxm⟩ := mem_iUnion₂.mp hxD + by_cases hmk : m = k + · exact Or.inl (hmk ▸ hin m hm x hxW hxm hxJ) + · by_cases hml : m = next k + · exact Or.inr (hml ▸ hin m hm x hxW hxm hxJ) + · exact absurd (mem_iUnion₂.mpr ⟨m, Finset.mem_erase.mpr ⟨hml, + Finset.mem_erase.mpr ⟨hmk, hm⟩⟩, hxm⟩) hxU + +end Fan + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/FlatCover.lean b/LeanPool/GraphMinor/GM11/FlatCover.lean new file mode 100644 index 0000000000..7b6f7b6ac4 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/FlatCover.lean @@ -0,0 +1,176 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Theorem75 +import LeanPool.GraphMinor.Surface.DiscsInSurface +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.Collar + +/-! +# A cover of a set by flat open sets + +`flat_iUnion_cover` is a form of (11.5) of Graph Minors VII (page 251) for sets that meet in more +than one +piece. Each set `O i` has a base point in a flat set `Z`. Where `O i` and `O j` meet, the path +through a meeting +point is homotopic to a path in `Z`. Then the union of the sets `O i` is flat. + +`not_flat_compl_disc` says that in a closed connected surface that is not a sphere, the outside of a +closed disc +is not included in a flat open set. The proof of (6.4) of Graph Minors XI (pages 90–91) uses this. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {T : Type u} [TopologicalSpace T] + +theorem cl_trans_symm_left {a b c : T} (f : Cl a b) (g : Cl a c) : f.trans (f.symm.trans g) = g + := by + rw [← cl_assoc, cl_trans_symm, cl_refl_trans] + +/-- A form of **(11.5)** of Graph Minors VII (page 251). -/ +theorem flat_iUnion_cover {ι : Type*} {Z : Set T} (hZ : Flat Z) (O : ι → Set T) (b : ι → T) + (hOo : ∀ i, IsOpen (O i)) (hb : ∀ i, b i ∈ O i) (hOc : ∀ i, IsPathConnected (O i)) + (hOf : ∀ i, Flat (O i)) + (hpair : ∀ i j y, y ∈ O i → y ∈ O j → ∃ (f : Cl (b i) y) (g : Cl y (b j)), Arw (O i) f ∧ Arw + (O j) g ∧ + Arw Z (f.trans g)) : Flat (⋃ i, O i) := by + have harw : ∀ i, ∀ x ∈ O i, ∀ y ∈ O i, ∃ f : Cl x y, Arw (O i) f := fun i x hx y hy => by + have hj := (hOc i).joinedIn x hx y hy + exact ⟨Cl.mk hj.somePath, hj.somePath, fun u => hj.somePath_mem u, rfl⟩ + have key : ∀ (a e : T) (p : Path a e), (∀ u, p u ∈ ⋃ i, O i) → ∀ (i₀ : ι) (α : Cl + (b i₀) a), a ∈ O i₀ → + Arw (O i₀) α → ∃ i, e ∈ O i ∧ ∃ (β : Cl e (b i)) (θ : Cl (b i₀) (b i)), Arw (O i) β ∧ Arw Z θ + ∧ + α.trans ((Cl.mk p).trans β) = θ := by + intro a e p hp i₀ α ha hα + let Q : ∀ c : T, Cl a c → Prop := fun c f => ∃ i, c ∈ O i ∧ ∃ (β : Cl c (b i)) (θ : Cl (b i₀) + (b i)), + Arw (O i) β ∧ Arw Z θ ∧ α.trans (f.trans β) = θ + refine cl_induction (𝒞 := range O) ?_ p (fun u => ?_) Q ?_ ?_ + · rintro _ ⟨i, rfl⟩ + exact hOo i + · obtain ⟨i, hi⟩ := mem_iUnion.mp (hp u) + exact ⟨O i, ⟨i, rfl⟩, hi⟩ + · obtain ⟨f, g, hf, hg, hw⟩ := hpair i₀ i₀ a ha ha + refine ⟨i₀, ha, α.symm, Cl.rf _, hα.symm, arw_refl hw.left_mem, ?_⟩ + rw [cl_refl_trans, cl_trans_symm] + · rintro c d f r _ ⟨j, rfl⟩ hr ⟨i, hc, β, θ, hβ, hθ, e⟩ + have hc' : c ∈ O j := by simpa using hr 0 + have hd' : d ∈ O j := by simpa using hr 1 + obtain ⟨f', g', hf', hg', hw⟩ := hpair i j c hc hc' + obtain ⟨β', hβ'⟩ := harw j d hd' (b j) (hb j) + have h₁ : f' = β.symm := (hOf i).eq hf' hβ.symm + have h₂ : (Cl.mk r).trans β' = g' := (hOf j).eq ((Arw.of_path r hr).trans hβ') hg' + refine ⟨j, hd', β', θ.trans (f'.trans g'), hβ', hθ.trans hw, ?_⟩ + rw [h₁, ← e] + simp only [cl_assoc, ← h₂, cl_trans_symm_left] + intro a e p q hp hq + obtain ⟨i₀, ha⟩ := mem_iUnion.mp (by simpa using hp 0 : a ∈ ⋃ i, O i) + obtain ⟨α, hα⟩ := harw i₀ _ (hb i₀) a ha + obtain ⟨i, hi, β, θ, hβ, hθ, e₁⟩ := key a e p hp i₀ α ha hα + obtain ⟨j, hj, β', θ', hβ', hθ', e₂⟩ := key a e q hq i₀ α ha hα + obtain ⟨f, g, hf, hg, hw⟩ := hpair i j e hi hj + have h₁ : f = β.symm := (hOf i).eq hf hβ.symm + have h₂ : g = β' := (hOf j).eq hg hβ' + have h₃ : θ' = θ.trans (f.trans g) := hZ.eq hθ' (hθ.trans hw) + refine Path.Homotopic.Quotient.eq.mp (cl_cancel α g ?_) + rw [h₂, e₂, h₃, ← e₁, h₁, h₂] + simp only [cl_assoc, cl_trans_symm_left] + +/-- The inclusion of `T` in the subtype `univ`. -/ +def toUniv : C(T, (univ : Set T)) := ⟨fun x => ⟨x, trivial⟩, by fun_prop⟩ + +/-- Flatness in `T` is flatness in the subtype `univ`. -/ +theorem flat_univ_iff {A : Set T} : Flat (Subtype.val ⁻¹' A : Set (univ : Set T)) ↔ Flat A := by + constructor + · intro h a b p q hp hq + have := (h (p.map toUniv.continuous) (q.map toUniv.continuous) hp hq).map ⟨Subtype.val, + continuous_subtype_val⟩ + exact this + · intro h a b p q hp hq + have := (h (p.map continuous_subtype_val) (q.map continuous_subtype_val) hp hq).map toUniv + exact this + +/-- An `O`-arc in a flat set is null-homotopic. -/ +theorem null_of_flat {K F : Set T} (hK : Flat K) (hF : IsOArc F) (hFK : F ⊆ K) : + IsNullHomotopicOArc F := by + have hK' := flat_univ_iff.mpr hK + obtain ⟨ψ⟩ := id hF + let φ : C(Circle, T) := ⟨fun x => (ψ x).1, continuous_subtype_val.comp ψ.continuous⟩ + let a : (univ : Set T) := ⟨φ (arcParam 1 0), trivial⟩ + let γ : Path a a := ⟨⟨fun t => ⟨φ (arcParam 1 t), trivial⟩, by fun_prop⟩, rfl, Subtype.ext + (by simp [a])⟩ + have hγ : ∀ u, γ u ∈ (Subtype.val ⁻¹' K : Set (univ : Set T)) := fun u => hFK (ψ _).2 + have hh : γ.Homotopic (Path.refl a) := hK' _ _ hγ fun _ => by simpa using hγ 0 + exact ⟨ψ, a.1, a.2, closedCurvesHomotopicIn_of_path 1 φ (ContinuousMap.const _ a.1) γ + (Path.refl a) (fun _ => rfl) + (fun _ => rfl) hh⟩ + +/-- In a closed connected surface that is not a sphere, the outside of a closed disc does not lie in +a flat set. -/ +theorem not_flat_compl_disc {S : Type u} [TopologicalSpace S] [ConnectedSpace S] + (hS : IsClosedSurface S) + (hns : ¬ IsSphere S) {Δ K : Set S} (hΔ : IsClosedDisc Δ) (hsub : Δᶜ ⊆ K) (hf : Flat K) : False + := by + have : T2Space S := hS.2.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + obtain ⟨Δ', hΔ', h₁, -⟩ := exists_disc_around hman hΔ (fun x _ => hS.2.2 x) isOpen_univ + (subset_univ _) + have hO := IsClosedDisc.isOArc_discBd hΔ' + have hif : Δ' \ discBd Δ' = interior Δ' := by + have := IsClosedDisc.frontier_eq_discBd hS hΔ' + rw [← this, frontier, (IsClosedDisc.isCompact hΔ').isClosed.closure_eq] + ext x + constructor + · rintro ⟨h₁, h₂⟩ + by_contra h + exact h₂ ⟨h₁, h⟩ + · exact fun h => ⟨interior_subset h, fun h' => h'.2 h⟩ + let Y : Set S := (interior Δ')ᶜ + have hYc : IsClosed Y := isOpen_interior.isClosed_compl + have hbY : discBd Δ' ⊆ Y := fun x hx hi => by + rw [← hif] at hi + exact hi.2 hx + have hYK : Y ⊆ K := fun x hx => hsub fun hxΔ => hx (hif ▸ h₁ hxΔ) + obtain ⟨a, ha⟩ := (infinite_of_isOArc hO).nonempty + obtain ⟨N, hNU, -⟩ := exists_drawing_on_oArc hO (finite_singleton a) (singleton_nonempty a) + (singleton_subset_iff.mpr ha) + have hYn : IsNice Y := ⟨N, isGammaNice_of_frontier (Drawing.IsSubdrawing.refl N) (hNU ▸ hbY) (by + rw [hNU, frontier_compl, ← IsClosedDisc.frontier_eq_discBd hS hΔ'] + exact frontier_interior_subset)⟩ + have hu : Y ≠ univ := fun h => by + obtain ⟨x, hx⟩ := (infinite_of_isOArc (IsClosedDisc.isOArc_discBd hΔ)).nonempty + exact (h ▸ mem_univ x : x ∈ Y) (hif ▸ h₁ (discBd_subset Δ hx)) + obtain ⟨E, hE, -, hYE⟩ := theorem_7_5_proof hS hYc hYn hu (finite_empty) + (disjoint_empty _) fun F hFY hF => by + rw [sdiff_empty] + exact null_of_flat hf hF (hFY.trans hYK) + obtain ⟨D, ⟨hDE, hD, hb, -⟩, -⟩ := disc_oArc E (discBd Δ') hE (hbY.trans hYE) hO + obtain rfl : D = Δ' := eq_of_discBd_eq (IsClosedSurface.isSurface hS) hns hD hΔ' hb + have huE : E = univ := by + refine eq_univ_of_forall fun x => ?_ + by_cases hx : x ∈ interior D + · exact hDE (interior_subset hx) + · exact hYE hx + have hfr := IsClosedDisc.frontier_eq_discBd hS hE + rw [huE, frontier_univ] at hfr + have hO' := IsClosedDisc.isOArc_discBd hE + rw [huE, ← hfr] at hO' + exact (infinite_of_isOArc hO').nonempty.ne_empty rfl + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Forest.lean b/LeanPool/GraphMinor/GM11/Forest.lean new file mode 100644 index 0000000000..3bf2308268 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Forest.lean @@ -0,0 +1,266 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Regions +public import LeanPool.GraphMinor.GM11.Cited + +/-! +# Drawings without circuits: graph theory + +Graph Minors XI uses in the proof of (4.4) that a drawing without circuits has only one region. This +file has the combinatorial part: a drawing with an edge and no circuit has a leaf (`exists_leaf`), +found at the end of a longest path. It also has `isPreconnected_sdiff_of_local`, the connectedness +principle used to remove a piece of a drawing from a connected open set, and the basic facts on +`deleteEdge`. +-/ + +public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- To see that `G - T` is connected, for an open connected set `G` and a set `T` closed in `G`, it +suffices that every component of `G - T` with a point of `T` in its closure contains a fixed set. -/ +theorem isPreconnected_sdiff_of_local [LocallyConnectedSpace S] {G T : Set S} (_hG : IsOpen G) + (hGc : IsPreconnected G) (hT : IsClosed (Gᶜ ∪ T)) (hTG : (G ∩ T).Nonempty) {a : S} + (_ha : a ∈ G \ T) + (hloc : ∀ x ∈ G \ T, ((G ∩ T) ∩ closure (connectedComponentIn (G \ T) x)).Nonempty → + a ∈ connectedComponentIn (G \ T) x) : IsPreconnected (G \ T) := by + have hopen : IsOpen (G \ T) := by + have : G \ T = (Gᶜ ∪ T)ᶜ := by + ext y + simp + rw [this] + exact hT.isOpen_compl + have hcomp : ∀ x ∈ G \ T, a ∈ connectedComponentIn (G \ T) x := by + intro x hx + refine hloc x hx ?_ + by_contra hcon + set C := connectedComponentIn (G \ T) x with hC + have hCo : IsOpen C := hopen.connectedComponentIn + have hxC : x ∈ C := mem_connectedComponentIn hx + obtain ⟨t, ht⟩ := hTG + have htC : t ∉ closure C := fun h => hcon ⟨t, ht, h⟩ + have hcov : G ⊆ C ∪ (closure C)ᶜ := by + intro y hy + by_cases hyc : y ∈ closure C + · refine Or.inl ?_ + by_cases hyT : y ∈ T + · exact absurd ⟨y, ⟨hy, hyT⟩, hyc⟩ hcon + have hy' : y ∈ G \ T := ⟨hy, hyT⟩ + have hop : IsOpen (connectedComponentIn (G \ T) y) := hopen.connectedComponentIn + obtain ⟨z, hz, hzC⟩ := mem_closure_iff.mp hyc _ hop (mem_connectedComponentIn hy') + rw [hC, connectedComponentIn_eq hzC, ← connectedComponentIn_eq hz] + exact mem_connectedComponentIn hy' + · exact Or.inr hyc + obtain ⟨y, -, hy₁, hy₂⟩ := hGc C (closure C)ᶜ hCo isClosed_closure.isOpen_compl hcov + ⟨x, (connectedComponentIn_subset _ _ hxC).1, hxC⟩ ⟨t, ht.1, htC⟩ + exact hy₂ (subset_closure hy₁) + have hEq : G \ T = connectedComponentIn (G \ T) a := by + refine subset_antisymm (fun x hx => ?_) (connectedComponentIn_subset _ _) + rw [← connectedComponentIn_eq (hcomp x hx)] + exact mem_connectedComponentIn hx + rw [hEq] + exact isPreconnected_connectedComponentIn + +variable [T2Space S] + +/-- The drawing `Γ` with an edge deleted has the point set `U(Γ) - e`. -/ +theorem deleteEdge_U (Γ : Drawing S) {e : Set S} (he : e ∈ Γ.E) : + (Γ.deleteEdge e).U = Γ.U \ e := by + have hV : (Γ.deleteEdge e).V = Γ.V := by + apply subset_antisymm (Drawing.span_isSubdrawing Γ _ _).1 + intro x hx + exact Or.inl ⟨hx, hx⟩ + have hE : (Γ.deleteEdge e).E = Γ.E \ {e} := by + rw [Drawing.deleteEdge, Γ.span_E] + ext f + exact ⟨fun h => h.1, fun h => ⟨h, h.1⟩⟩ + rw [Drawing.U_eq, hV, hE] + ext x + constructor + · rintro (hx | hx) + · exact ⟨Γ.V_subset_U hx, fun hxe => (he.2.1 hxe).2 hx⟩ + · obtain ⟨f, ⟨hf, hfe⟩, hxf⟩ := mem_iUnion₂.mp hx + refine ⟨Γ.closure_subset_U hf hxf, fun hxe => ?_⟩ + have hxV : x ∉ Γ.V := (he.2.1 hxe).2 + have hxf' : x ∈ f := by rw [← Γ.closure_diff_V hf]; exact ⟨hxf, hxV⟩ + exact hfe (Γ.edge_eq_of_mem hf he hxf' hxe) + · rintro ⟨hx, hxe⟩ + rw [Γ.U_eq] at hx + rcases hx with hx | hx + · exact Or.inl hx + obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + by_cases hfe : f = e + · subst hfe + refine Or.inl ?_ + by_contra hxV + exact hxe (by rw [← Γ.closure_diff_V hf]; exact ⟨hxf, hxV⟩) + · exact Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfe⟩, hxf⟩) + +theorem deleteEdge_E (Γ : Drawing S) (e : Set S) : (Γ.deleteEdge e).E = Γ.E \ {e} := by + rw [Drawing.deleteEdge, Γ.span_E] + ext f + exact ⟨fun h => h.1, fun h => ⟨h, h.1⟩⟩ + +theorem deleteEdge_isSubdrawing (Γ : Drawing S) (e : Set S) : (Γ.deleteEdge e).IsSubdrawing Γ := + Drawing.span_isSubdrawing Γ _ _ + +/-- A drawing without circuits has no loops: every edge has two distinct ends. -/ +theorem exists_ends_of_noCircuit {Γ : Drawing S} + (hno : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ → False) {e : Set S} (he : e ∈ Γ.E) : + ∃ u v : S, u ≠ v ∧ closure e ∩ Γ.V = {u, v} ∧ IsLineWithEnds (closure e) u v := by + rcases Γ.edge_cond e he with ⟨u, v, huv, hcap, hL⟩ | ⟨u, hcap, -⟩ + · exact ⟨u, v, huv, hcap, hL⟩ + · exfalso + have hu : u ∈ Γ.V := by + have : u ∈ closure e ∩ Γ.V := by rw [hcap]; simp + exact this.2 + have hl : Γ.toGraph.IsLink e u u := ⟨he, hu, hu, by simpa using hcap⟩ + let W : GraphWalk Γ.toGraph u u := .cons hl (.nil hu) + have hsub := walkDrawing_isSubdrawing Γ W + obtain ⟨W', hs, hed⟩ := hsub.exists_walk_down W + (fun x hx => by rw [walkDrawing_V]; exact hx) (fun f hf => by rw [walkDrawing_E]; exact hf) + refine hno _ ⟨u, W', ⟨?_, ?_⟩, ?_, ?_, ?_⟩ hsub + · rw [hs] + exact List.nodup_singleton u + · rw [hed] + exact List.nodup_singleton e + · have : W'.edges ≠ [] := by + rw [hed] + simp [W] + exact List.length_pos_iff.mpr this + · rw [walkDrawing_V, hs] + · rw [walkDrawing_E, hed] + +omit [T2Space S] in +theorem length_support {α β : Type*} {G : Graph α β} {a b : α} (W : GraphWalk G a b) : + W.support.length = W.length + 1 := by + induction W with + | nil _ => simp + | cons h r ih => simp [ih] + +omit [T2Space S] in +theorem IsLineWithEnds.symm {L : Set S} {u v : S} (h : IsLineWithEnds L u v) : + IsLineWithEnds L v u := by + obtain ⟨f, h₀, h₁⟩ := h + refine ⟨unitInterval.symmHomeomorph.trans f, ?_, ?_⟩ + · simpa using h₁ + · simpa using h₀ + +/-- A drawing with an edge and without circuits has a leaf: an edge `e` with ends `u ≠ v`, such +that no other edge has `v` as an end. We take `v` to be the start of a longest path. -/ +theorem exists_leaf {Γ : Drawing S} + (hno : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ → False) (hE : Γ.E.Nonempty) : + ∃ e ∈ Γ.E, ∃ u v : S, u ≠ v ∧ closure e ∩ Γ.V = {u, v} ∧ IsLineWithEnds (closure e) u v ∧ + ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f := by + classical + -- A longest simple walk. + let P : ℕ → Prop := fun n => ∃ (a b : S) (W : GraphWalk Γ.toGraph a b), W.IsSimple ∧ W.length = n + have hbound : ∀ n, P n → n ≤ Γ.finite_V.toFinset.card := by + rintro n ⟨a, b, W, hW, rfl⟩ + have hsub : W.support.toFinset ⊆ Γ.finite_V.toFinset := by + intro x hx + simp only [List.mem_toFinset] at hx + have : x ∈ Γ.V := W.mem_vertexSet_of_mem_support hx + simpa using this + have h₁ := Finset.card_le_card hsub + rw [List.toFinset_card_of_nodup hW, length_support] at h₁ + omega + -- Every edge gives a link between two distinct vertices. + have hlink : ∀ f ∈ Γ.E, ∀ x ∈ Γ.V, x ∈ closure f → ∃ y, x ≠ y ∧ Γ.toGraph.IsLink f x y := by + intro f hf x hxV hxf + obtain ⟨u, v, huv, hcap, -⟩ := exists_ends_of_noCircuit hno hf + have hx : x ∈ closure f ∩ Γ.V := ⟨hxf, hxV⟩ + have hu : u ∈ Γ.V := by + have : u ∈ closure f ∩ Γ.V := by rw [hcap]; simp + exact this.2 + have hv : v ∈ Γ.V := by + have : v ∈ closure f ∩ Γ.V := by rw [hcap]; simp + exact this.2 + rw [hcap] at hx + rcases hx with rfl | hx + · exact ⟨v, huv, hf, hu, hv, by simpa using hcap⟩ + · rw [mem_singleton_iff.mp hx] + exact ⟨u, huv.symm, hf, hv, hu, by simpa [pair_comm] using hcap⟩ + obtain ⟨e₀, he₀⟩ := hE + obtain ⟨u₀, v₀, huv₀, hcap₀, -⟩ := exists_ends_of_noCircuit hno he₀ + have hu₀ : u₀ ∈ closure e₀ ∩ Γ.V := by rw [hcap₀]; simp + obtain ⟨y₀, hne₀, hl₀⟩ := hlink e₀ he₀ u₀ hu₀.2 hu₀.1 + have hP1 : P 1 := by + refine ⟨u₀, y₀, .cons hl₀ (.nil hl₀.right_mem), ?_, rfl⟩ + exact List.nodup_cons.mpr ⟨by simpa using hne₀, List.nodup_singleton _⟩ + let N := Nat.findGreatest P Γ.finite_V.toFinset.card + have hmax : ∀ n, P n → n ≤ N := fun n hn => Nat.le_findGreatest (hbound n hn) hn + have hN : P N := Nat.findGreatest_spec (hbound 1 hP1) hP1 + obtain ⟨a, b, W, hW, hlen⟩ := hN + have hN1 := hmax 1 hP1 + cases W with + | nil _ => simp at hlen; omega + | @cons _ w _ e h r => + have hnd := List.nodup_cons.mp hW + have hrem : ∀ f ∈ Γ.E, f ≠ e → a ∉ closure f := by + intro f hf hfe haf + obtain ⟨y, hay, hl⟩ := hlink f hf a h.left_mem haf + by_cases hy : y ∈ (GraphWalk.cons h r).support + · obtain ⟨W₁, W₂, hsplit⟩ := (GraphWalk.cons h r).exists_append_of_mem hy + have hsimple : (W₁.append W₂).IsSimple := by rw [← hsplit]; exact hW + have hW₁ := (isSimple_of_append hsimple).1 + have hfW : f ∉ W₁.edges := by + intro hfW + have h₁ : f ∈ (GraphWalk.cons h r).edges := by + rw [hsplit, GraphWalk.edges_append] + exact List.mem_append_left _ hfW + rcases List.mem_cons.mp h₁ with h₂ | h₂ + · exact hfe h₂ + · exact hnd.1 (r.left_mem_support_of_mem_edges h₂ hl) + let Q : GraphWalk Γ.toGraph a y := .cons hl (.nil hl.right_mem) + have hQ : Q.IsSimple := + List.nodup_cons.mpr ⟨by simpa [Q] using hay, List.nodup_singleton _⟩ + have hPs := walkDrawing_isSubdrawing Γ W₁ + have hQs := walkDrawing_isSubdrawing Γ Q + have hV : (walkDrawing Γ W₁).V ∩ (walkDrawing Γ Q).V = {a, y} := by + rw [walkDrawing_V, walkDrawing_V] + ext x + constructor + · rintro ⟨-, hx⟩ + simpa [Q] using hx + · rintro (rfl | hx) + · exact ⟨W₁.start_mem_support, by simp [Q]⟩ + · rw [mem_singleton_iff.mp hx] + exact ⟨W₁.end_mem_support, by simp [Q]⟩ + have hEd : Disjoint (walkDrawing Γ W₁).E (walkDrawing Γ Q).E := by + rw [walkDrawing_E, walkDrawing_E] + refine disjoint_left.mpr fun x hx hxQ => ?_ + have hxf : x = f := by simpa [Q] using hxQ + exact hfW (hxf ▸ hx) + exact hno _ (Drawing.isCircuit_sup (walkDrawing_isPathBetween Γ hW₁) + (walkDrawing_isPathBetween Γ hQ) hPs hQs hay hV hEd) (Drawing.sup_isSubdrawing _ _ _) + · have := hmax (N + 1) ⟨y, b, .cons hl.symm (.cons h r), List.nodup_cons.mpr ⟨hy, hW⟩, by + simp only [GraphWalk.length_cons] at hlen ⊢ + omega⟩ + omega + obtain ⟨u, v, huv, hcap, hL⟩ := exists_ends_of_noCircuit hno h.1 + have ha : a ∈ closure e ∩ Γ.V := ⟨by + have : a ∈ closure e ∩ Γ.V := by rw [h.2.2.2]; simp + exact this.1, h.left_mem⟩ + rw [hcap] at ha + rcases ha with rfl | ha + · exact ⟨e, h.1, v, a, huv.symm, by rw [hcap, pair_comm], GraphMinor.GM11.IsLineWithEnds.symm + hL, hrem⟩ + · rw [mem_singleton_iff.mp ha] at hrem + exact ⟨e, h.1, u, v, huv, hcap, hL, hrem⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/ForestRegions.lean b/LeanPool/GraphMinor/GM11/ForestRegions.lean new file mode 100644 index 0000000000..f92e83614d --- /dev/null +++ b/LeanPool/GraphMinor/GM11/ForestRegions.lean @@ -0,0 +1,348 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.LeafNbhd +import Mathlib.Analysis.Normed.Module.Connected +import Mathlib.LinearAlgebra.FiniteDimensional.Lemmas + +/-! +# A drawing without circuits has one region + +This file proves `isPreconnected_compl_of_noCircuit`: the complement of a drawing without circuits +in +a connected closed surface is connected. Graph Minors XI uses this in the proof of (4.4) with the +words "(since `Σ` is connected)". + +We first remove finitely many points, since a punctured small disc is connected. Then we add the +edges of the drawing, in the reverse of the order in which leaves can be deleted. By +`isPreconnected_sdiff_of_local`, it is enough to see that a region that reaches a new edge, or its +free end `v`, contains a fixed point near `v`. This follows from the two sides of the edge +(`exists_edge_sides`) and the neighbourhood of a leaf (`exists_leaf_nbhd`). +-/ + +public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A punctured round ball in the plane is connected. -/ +theorem isPreconnected_ball_sdiff (c : EuclideanPlane) {δ : ℝ} (_hδ : 0 < δ) : + IsPreconnected (Metric.ball c δ \ {c}) := by + have hrank : 1 < Module.rank ℝ EuclideanPlane := by + apply Module.lt_rank_of_lt_finrank + simp + have hsph : IsPreconnected (Metric.sphere (0 : EuclideanPlane) 1) := isPreconnected_sphere hrank + 0 1 + have hprod : IsPreconnected (Ioo (0 : ℝ) δ ×ˢ Metric.sphere (0 : EuclideanPlane) 1) := + isPreconnected_Ioo.prod hsph + have hEq : Metric.ball c δ \ {c} = + (fun q : ℝ × EuclideanPlane => c + q.1 • q.2) '' + (Ioo (0 : ℝ) δ ×ˢ Metric.sphere (0 : EuclideanPlane) 1) := by + ext x + constructor + · rintro ⟨hx, hxc⟩ + have hd : 0 < ‖x - c‖ := norm_pos_iff.mpr (sub_ne_zero.mpr hxc) + refine ⟨(‖x - c‖, ‖x - c‖⁻¹ • (x - c)), ⟨⟨hd, ?_⟩, ?_⟩, ?_⟩ + · simpa [dist_eq_norm] using hx + · simp [norm_smul, hd.ne'] + · simp [smul_smul, hd.ne'] + · rintro ⟨⟨r, w⟩, ⟨⟨hr₀, hr₁⟩, hw⟩, rfl⟩ + have hw' : ‖w‖ = 1 := by simpa using hw + refine ⟨?_, ?_⟩ + · simp [dist_eq_norm, norm_smul, hw', abs_of_pos hr₀, hr₁] + · intro h + have h₁ : r • w = 0 := by simpa using h + rcases smul_eq_zero.mp h₁ with h₂ | h₂ + · exact hr₀.ne' h₂ + · simp [h₂] at hw' + rw [hEq] + exact hprod.image _ (by fun_prop) + +/-- Small punctured neighbourhoods in a closed surface. -/ +theorem exists_punctured_nbhd (hS : IsClosedSurface S) {O : Set S} (hO : IsOpen O) {x : S} + (hx : x ∈ O) : + ∃ Z : Set S, IsOpen Z ∧ x ∈ Z ∧ Z ⊆ O ∧ IsPreconnected (Z \ {x}) ∧ x ∈ closure (Z \ {x}) := by + obtain ⟨V, hV, hxV, ⟨h⟩⟩ := hS.2.2 x + let T : OpenUnitDisc → S := fun y => (h.symm y).1 + have hT : Continuous T := continuous_subtype_val.comp h.symm.continuous + have hTinj : Function.Injective T := fun p q hpq => h.symm.injective (Subtype.ext hpq) + have hTopen : IsOpenMap T := hV.isOpenEmbedding_subtypeVal.isOpenMap.comp h.symm.isOpenMap + let c : OpenUnitDisc := h ⟨x, hxV⟩ + have hTc : T c = x := by simp [T, c] + let P : Set OpenUnitDisc := T ⁻¹' O + have hP : IsOpen P := hO.preimage hT + have hP' : IsOpen (Subtype.val '' P : Set EuclideanPlane) := + Metric.isOpen_ball.isOpenEmbedding_subtypeVal.isOpenMap _ hP + have hcP : (c : EuclideanPlane) ∈ (Subtype.val '' P : Set EuclideanPlane) := + ⟨c, by simpa [P, hTc] using hx, rfl⟩ + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp hP' _ hcP + have hsub : Metric.ball (c : EuclideanPlane) δ ⊆ OpenUnitDisc := by + intro y hy + obtain ⟨z, -, rfl⟩ := hball hy + exact z.2 + let B : Set OpenUnitDisc := Subtype.val ⁻¹' Metric.ball (c : EuclideanPlane) δ + have hdiff : T '' B \ {x} = T '' (Subtype.val ⁻¹' (Metric.ball (c : EuclideanPlane) δ \ {(c : + EuclideanPlane)})) := by + ext q + constructor + · rintro ⟨⟨y, hy, rfl⟩, hne⟩ + refine ⟨y, ⟨hy, fun hyc => hne ?_⟩, rfl⟩ + have : y = c := Subtype.ext hyc + rw [this, hTc] + rfl + · rintro ⟨y, ⟨hy, hne⟩, rfl⟩ + refine ⟨⟨y, hy, rfl⟩, fun hq => hne ?_⟩ + have : y = c := hTinj (hq.trans hTc.symm) + rw [this] + rfl + refine ⟨T '' B, hTopen _ (Metric.isOpen_ball.preimage continuous_subtype_val), + ⟨c, by simp [B, hδ], hTc⟩, ?_, ?_, ?_⟩ + · rintro _ ⟨y, hy, rfl⟩ + obtain ⟨z, hz, hzy⟩ := hball hy + have : z = y := Subtype.ext hzy + exact this ▸ hz + · rw [hdiff] + refine IsPreconnected.image ?_ _ hT.continuousOn + refine (IsInducing.subtypeVal : + IsInducing (Subtype.val : OpenUnitDisc → EuclideanPlane)).isPreconnected_image.mp ?_ + rw [Subtype.image_preimage_coe, inter_eq_right.mpr (sdiff_subset.trans hsub)] + exact isPreconnected_ball_sdiff _ hδ + · rw [hdiff, ← hTc] + refine image_closure_subset_closure_image hT ⟨c, ?_, rfl⟩ + rw [closure_subtype, Subtype.image_preimage_coe, inter_eq_right.mpr (sdiff_subset.trans hsub)] + refine Metric.mem_closure_iff.mpr fun ε hε => ?_ + have hr : 0 < min ε δ / 2 := by positivity + obtain ⟨b, hb⟩ := (NormedSpace.sphere_nonempty (x := (c : EuclideanPlane))).mpr hr.le + have hbd : dist b (c : EuclideanPlane) = min ε δ / 2 := hb + have hlt₁ : min ε δ / 2 < δ := by + have := min_le_right ε δ + linarith + have hlt₂ : min ε δ / 2 < ε := by + have := min_le_left ε δ + linarith + refine ⟨b, ⟨by simpa [Metric.mem_ball, hbd] using hlt₁, ?_⟩, ?_⟩ + · intro hbc + rw [mem_singleton_iff.mp hbc, dist_self] at hbd + linarith + · rw [dist_comm, hbd] + exact hlt₂ + +/-- The complement of a finite set in a connected closed surface is connected. -/ +theorem isPreconnected_compl_finite (hS : IsClosedSurface S) [PreconnectedSpace S] {F : Set S} + (hF : F.Finite) : IsPreconnected Fᶜ := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + induction F, hF using Set.Finite.induction_on with + | empty => + rw [compl_empty] + exact isPreconnected_univ + | @insert x F hxF hF ih => + have hG : IsOpen Fᶜ := hF.isClosed.isOpen_compl + have hxG : x ∈ Fᶜ := hxF + obtain ⟨Z, hZ, hxZ, hZG, hZc, hZcl⟩ := exists_punctured_nbhd hS hG hxG + obtain ⟨a, haZ⟩ : (Z \ {x}).Nonempty := by + by_contra hcon + rw [not_nonempty_iff_eq_empty] at hcon + rw [hcon, closure_empty] at hZcl + exact hZcl + have hEq : (insert x F)ᶜ = Fᶜ \ {x} := by + ext y + simp [not_or, and_comm] + rw [hEq] + have hcl : IsClosed (Fᶜᶜ ∪ {x}) := by + rw [compl_compl] + exact hF.isClosed.union isClosed_singleton + refine isPreconnected_sdiff_of_local hG ih hcl ⟨x, hxG, rfl⟩ ⟨hZG haZ.1, haZ.2⟩ ?_ + rintro y hy ⟨t, ⟨-, ht⟩, htc⟩ + obtain rfl : t = x := ht + have hopen : IsOpen (Fᶜ \ {t}) := hG.sdiff isClosed_singleton + obtain ⟨b, hbZ, hbC⟩ := mem_closure_iff.mp htc Z hZ hxZ + have hbne : b ≠ t := (connectedComponentIn_subset _ _ hbC).2 + rw [connectedComponentIn_eq hbC] + refine hZc.subset_connectedComponentIn ⟨hbZ, hbne⟩ ?_ haZ + exact fun q hq => ⟨hZG hq.1, hq.2⟩ + +/-- One step of the induction: adding a leaf edge keeps the complement connected. -/ +private theorem isPreconnected_compl_of_leaf (hS : IsClosedSurface S) + (Γ : Drawing S) {e : Set S} (he : e ∈ Γ.E) {u v : S} (huv : u ≠ v) + (hcap : closure e ∩ Γ.V = {u, v}) (hL : IsLineWithEnds (closure e) u v) + (hleaf : ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f) (hc : IsPreconnected (Γ.U \ e)ᶜ) : + IsPreconnected Γ.Uᶜ := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hvV : v ∈ Γ.V := by + have : v ∈ closure e ∩ Γ.V := by rw [hcap]; simp + exact this.2 + have hve : v ∈ closure e := by + have : v ∈ closure e ∩ Γ.V := by rw [hcap]; simp + exact this.1 + have hvnot : v ∉ e := fun h => (he.2.1 h).2 hvV + -- `Bad` is `U(Γ) - e` without `v`. + let Bad : Set S := (Γ.V \ {v}) ∪ ⋃ g ∈ Γ.E \ {e}, closure g + have hBad : IsClosed Bad := + (Γ.finite_V.subset sdiff_subset).isClosed.union + ((Γ.finite_edges.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure) + have hBadeq : (Γ.U \ e) \ {v} = Bad := by + rw [← deleteEdge_U Γ he, Drawing.U_eq, deleteEdge_E] + have hV : (Γ.deleteEdge e).V = Γ.V := by + apply subset_antisymm (Drawing.span_isSubdrawing Γ _ _).1 + intro x hx + exact Or.inl ⟨hx, hx⟩ + rw [hV] + ext x + constructor + · rintro ⟨hx | hx, hxv⟩ + · exact Or.inl ⟨hx, hxv⟩ + · exact Or.inr hx + · rintro (hx | hx) + · exact ⟨Or.inl hx.1, hx.2⟩ + · refine ⟨Or.inr hx, ?_⟩ + obtain ⟨g, ⟨hg, hge⟩, hxg⟩ := mem_iUnion₂.mp hx + rintro rfl + exact hleaf g hg hge hxg + have hvBad : v ∉ Bad := by + rw [← hBadeq] + exact fun h => h.2 rfl + -- `G` is the complement of `Bad`, and `T` is `e` with its end `v`. + have hBadU : ∀ x ∈ Bad, x ∈ Γ.U ∧ x ∉ e := by + intro x hx + rw [← hBadeq] at hx + exact hx.1 + obtain ⟨Z₁, hZ₁, hvZ₁, hZ₁B, -, hZ₁cl⟩ := exists_punctured_nbhd hS hBad.isOpen_compl hvBad + have hG : IsPreconnected Badᶜ := by + refine hc.subset_closure ?_ ?_ + · intro x hx hxB + exact hx (hBadU x hxB) + · intro x hx + by_cases hxv : x = v + · rw [hxv] + refine closure_mono ?_ hZ₁cl + rintro y ⟨hyZ, hyv⟩ hyU + exact hZ₁B hyZ (by rw [← hBadeq]; exact ⟨hyU, hyv⟩) + · refine subset_closure fun hxU => hx ?_ + rw [← hBadeq] + exact ⟨hxU, hxv⟩ + let T : Set S := e ∪ {v} + have hGT : Badᶜ \ T = univ \ Γ.U := by + ext x + constructor + · rintro ⟨hxB, hxT⟩ + refine ⟨mem_univ _, fun hxU => hxB ?_⟩ + rw [← hBadeq] + exact ⟨⟨hxU, fun hxe => hxT (Or.inl hxe)⟩, fun hxv => hxT (Or.inr hxv)⟩ + · rintro ⟨-, hxU⟩ + refine ⟨fun hxB => hxU (hBadU x hxB).1, ?_⟩ + rintro (hxe | hxv) + · exact hxU (he.2.1 hxe).1 + · exact hxU (Γ.V_subset_U (by rw [mem_singleton_iff.mp hxv]; exact hvV)) + have hclosed : IsClosed (Badᶜᶜ ∪ T) := by + have : Badᶜᶜ ∪ T = Γ.U := by + rw [compl_compl] + ext x + constructor + · rintro (hx | hx | hx) + · exact (hBadU x hx).1 + · exact (he.2.1 hx).1 + · exact Γ.V_subset_U (by rw [mem_singleton_iff.mp hx]; exact hvV) + · intro hx + by_cases hxe : x ∈ e + · exact Or.inr (Or.inl hxe) + by_cases hxv : x = v + · exact Or.inr (Or.inr hxv) + · refine Or.inl ?_ + rw [← hBadeq] + exact ⟨⟨hx, hxe⟩, hxv⟩ + rw [this] + exact Γ.isClosed_U + -- A point `p` of `e` near `v`, and points `a₁, a₂` on its two sides near `v`. + obtain ⟨Z, hZ, hvZ, hZpts⟩ := exists_leaf_nbhd hS Γ he huv hcap hL hleaf isOpen_univ (mem_univ v) + obtain ⟨p, hpZ, hpe⟩ := mem_closure_iff.mp hve Z hZ hvZ + obtain ⟨W, A₁, A₂, hW, hpW, -, hsub, h₁, h₂, d₁, d₂, c₁, c₂⟩ := exists_edge_sides hS Γ he hpe + have hWZ : IsOpen (W ∩ Z) := hW.inter hZ + have hpWZ : p ∈ W ∩ Z := ⟨hpW, hpZ⟩ + obtain ⟨a₁, ha₁WZ, ha₁⟩ := mem_closure_iff.mp (c₁ ⟨hpe, hpW⟩) _ hWZ hpWZ + obtain ⟨a₂, ha₂WZ, ha₂⟩ := mem_closure_iff.mp (c₂ ⟨hpe, hpW⟩) _ hWZ hpWZ + have ha₁U : a₁ ∉ Γ.U := disjoint_left.mp d₁ ha₁ + have ha₂U : a₂ ∉ Γ.U := disjoint_left.mp d₂ ha₂ + have hcomp : IsPreconnected (univ \ Γ.U) → IsPreconnected Γ.Uᶜ := by + intro h + rwa [← compl_eq_univ_sdiff] at h + apply hcomp + rw [← hGT] + refine isPreconnected_sdiff_of_local hBad.isOpen_compl hG hclosed + ⟨v, hvBad, Or.inr rfl⟩ (a := a₁) (by rw [hGT]; exact ⟨mem_univ _, ha₁U⟩) ?_ + rw [hGT] + rintro x hx ⟨t, ⟨-, ht⟩, htc⟩ + have hreg : connectedComponentIn (univ \ Γ.U) x ∈ Γ.R := (mem_R_iff Γ).mpr ⟨x, hx.2, rfl⟩ + set C := connectedComponentIn (univ \ Γ.U) x with hC + have hCo : IsOpen C := region_isOpen hreg + -- Two points of `Z` off `U(Γ)`, one of them in `C`: the other one is in `C` as well. + have hjoin : ∀ b ∈ C, b ∈ Z → ∀ a ∈ Z, a ∉ Γ.U → a ∈ C := by + intro b hbC hbZ a haZ haU + obtain ⟨A, hA, hAd, hbA, haA⟩ := hZpts b hbZ (region_subset hreg hbC) a haZ haU + exact subset_region hreg hA hAd hbA hbC haA.1 + rcases ht with hte | htv + · have hpc : p ∈ closure C := edge_subset_closure_of_incident hS he hreg ⟨t, hte, htc⟩ hpe + obtain ⟨b, hbWZ, hbC⟩ := mem_closure_iff.mp hpc _ hWZ hpWZ + rcases hsub ⟨hbWZ.1, region_subset hreg hbC⟩ with hb | hb + · exact subset_region hreg h₁ d₁ hb hbC ha₁ + · have ha₂C : a₂ ∈ C := subset_region hreg h₂ d₂ hb hbC ha₂ + exact hjoin a₂ ha₂C ha₂WZ.2 a₁ ha₁WZ.2 ha₁U + · obtain rfl : t = v := htv + obtain ⟨b, hbZ, hbC⟩ := mem_closure_iff.mp htc Z hZ hvZ + exact hjoin b hbC hbZ a₁ ha₁WZ.2 ha₁U + +/-- The complement of a drawing without circuits in a connected closed surface is connected. So the +drawing has only one region, which Graph Minors XI uses in the proof of (4.4), page 80. -/ +theorem isPreconnected_compl_of_noCircuit (hS : IsClosedSurface S) [PreconnectedSpace S] + (Γ : Drawing S) + (hno : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ → False) : IsPreconnected Γ.Uᶜ := by + have : T2Space S := hS.2.1 + induction hn : Γ.E.ncard using Nat.strong_induction_on generalizing Γ with + | _ n ih => + by_cases hE : Γ.E.Nonempty + · obtain ⟨e, he, u, v, huv, hcap, hL, hleaf⟩ := exists_leaf hno hE + refine isPreconnected_compl_of_leaf hS Γ he huv hcap hL hleaf ?_ + rw [← deleteEdge_U Γ he] + have hlt : (Γ.deleteEdge e).E.ncard < n := by + rw [deleteEdge_E, ← hn] + exact Set.ncard_sdiff_singleton_lt_of_mem he Γ.finite_edges + exact ih _ hlt (Γ.deleteEdge e) + (fun C hC hCs => hno C hC (hCs.trans (deleteEdge_isSubdrawing Γ e))) rfl + · have hU : Γ.U = Γ.V := by + rw [Γ.U_eq] + have hemp : Γ.E = ∅ := not_nonempty_iff_eq_empty.mp hE + rw [hemp] + simp + rw [hU] + exact isPreconnected_compl_finite hS Γ.finite_V + +/-- A drawing without circuits has at most one region. -/ +theorem region_eq_of_noCircuit (hS : IsClosedSurface S) [PreconnectedSpace S] + {Γ : Drawing S} + (hno : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ → False) {r₁ r₂ : Set S} + (h₁ : r₁ ∈ Γ.R) (h₂ : r₂ ∈ Γ.R) : r₁ = r₂ := by + have hc := isPreconnected_compl_of_noCircuit hS Γ hno + obtain ⟨x, hx⟩ := region_nonempty h₁ + obtain ⟨y, hy⟩ := region_nonempty h₂ + have hy₁ : y ∈ r₁ := by + obtain ⟨z, -, rfl⟩ := (mem_R_iff Γ).mp h₁ + rw [connectedComponentIn_eq hx] + refine (compl_eq_univ_sdiff Γ.U ▸ hc).subset_connectedComponentIn + (connectedComponentIn_subset _ _ hx) subset_rfl ?_ + exact ⟨mem_univ _, region_subset h₂ hy⟩ + exact region_eq_of_mem h₁ h₂ hy₁ hy + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/GlueDiscs.lean b/LeanPool/GraphMinor/GM11/GlueDiscs.lean new file mode 100644 index 0000000000..5b802ba9a7 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/GlueDiscs.lean @@ -0,0 +1,668 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialExists +public import LeanPool.GraphMinor.Surface.Cap +import Mathlib.Analysis.Normed.Module.Ball.Homeomorph +import Mathlib.Analysis.Complex.Convex + +/-! +# Two open discs across an edge + +A region of a radial drawing `Γ'` is made of an edge `e` of `Γ` and the two faces of `Γ ∪ Γ'` on the +two +sides of `e`. To see that it is an open disc we use `open_disc`, so we must find a closed disc +around +each `O`-arc in the region. + +The tool is `exists_disc_off`. Let `A` be an open disc and let `N` be a closed disc that meets the +frontier +of `A` in a connected piece. Collapse the complement of `A` to a point `∞`. This gives a sphere, in +which +the image of `bd(N)` is an `O`-arc through `∞`. So the part of `A` outside `N` is a closed disc with +`∞` +on its boundary, and a chord near `∞` cuts off a closed disc `ρ ⊆ A` that holds any given compact +set. It +meets `N` in a line, so `N ∪ ρ` is a closed disc. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval Metric OnePoint + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A loop that is injective apart from its ends has an `O`-arc as range. -/ +theorem isOArc_of_loop {X : Type u} [TopologicalSpace X] [T2Space X] {m : I → X} (hm : Continuous m) + (h01 : m 0 = m 1) (hinj : InjOn m (Ioo 0 1)) (hne : ∀ t ∈ Ioo (0 : I) 1, m t ≠ m 0) : + IsOArc (range m) := by + let h : I := ⟨1 / 2, by norm_num, by norm_num⟩ + let a : I → X := fun t => m ⟨t.1 / 2, by have := t.2.1; positivity, by have := t.2.2; linarith⟩ + let b : I → X := fun t => m ⟨1 - t.1 / 2, by have := t.2.2; linarith, by have := t.2.1; linarith⟩ + have hac : Continuous a := hm.comp (by fun_prop) + have hbc : Continuous b := hm.comp (by fun_prop) + have hmi : ∀ {s t : I}, m s = m t → s = t ∨ s ∉ Ioo (0 : I) 1 ∧ t ∉ Ioo (0 : I) 1 := by + intro s t hst + by_cases hs : s ∈ Ioo (0 : I) 1 + · by_cases ht : t ∈ Ioo (0 : I) 1 + · exact Or.inl (hinj hs ht hst) + · exfalso + have hend : m t = m 0 := by + have : t = 0 ∨ t = 1 := by + by_contra hc + push Not at hc + exact ht ⟨unitInterval.pos_iff_ne_zero.mpr hc.1, unitInterval.lt_one_iff_ne_one.mpr + hc.2⟩ + rcases this with rfl | rfl + · rfl + · exact h01.symm + exact hne s hs (hst.trans hend) + · by_cases ht : t ∈ Ioo (0 : I) 1 + · exfalso + have hend : m s = m 0 := by + have : s = 0 ∨ s = 1 := by + by_contra hc + push Not at hc + exact hs ⟨unitInterval.pos_iff_ne_zero.mpr hc.1, unitInterval.lt_one_iff_ne_one.mpr + hc.2⟩ + rcases this with rfl | rfl + · rfl + · exact h01.symm + exact hne t ht (hst.symm.trans hend) + · exact Or.inr ⟨hs, ht⟩ + have hnotIoo : ∀ {u : I}, u ∉ Ioo (0 : I) 1 → u.1 = 0 ∨ u.1 = 1 := by + intro u hu + by_contra hc + push Not at hc + exact hu ⟨unitInterval.pos_iff_ne_zero.mpr fun h => hc.1 (by rw [h]; rfl), + unitInterval.lt_one_iff_ne_one.mpr fun h => hc.2 (by rw [h]; rfl)⟩ + have hai : Function.Injective a := by + intro s t hst + rcases hmi hst with h' | ⟨h₁, h₂⟩ + · have := congrArg Subtype.val h' + simp only at this + exact Subtype.ext (by linarith) + · rcases hnotIoo h₁ with h₃ | h₃ <;> rcases hnotIoo h₂ with h₄ | h₄ <;> + simp only at h₃ h₄ <;> first + | exact Subtype.ext (by linarith) + | (exfalso; have := s.2.2; have := t.2.2; linarith) + have hbi : Function.Injective b := by + intro s t hst + rcases hmi hst with h' | ⟨h₁, h₂⟩ + · have := congrArg Subtype.val h' + simp only at this + exact Subtype.ext (by linarith) + · rcases hnotIoo h₁ with h₃ | h₃ <;> rcases hnotIoo h₂ with h₄ | h₄ <;> + simp only at h₃ h₄ <;> first + | exact Subtype.ext (by linarith) + | (exfalso; have := s.2.2; have := t.2.2; have := s.2.1; have := t.2.1; linarith) + have h0 : a 0 = b 0 := by + have e₀ : a 0 = m 0 := congrArg m (Subtype.ext (by simp)) + have e₁ : b 0 = m 1 := congrArg m (Subtype.ext (by simp)) + rw [e₀, e₁, h01] + have h1 : a 1 = b 1 := by + refine congrArg m (Subtype.ext ?_) + simp only [Icc.coe_one] + norm_num + have hmeet : ∀ s t, a s = b t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + intro s t hst + rcases hmi hst with h' | ⟨h₁, h₂⟩ + · have := congrArg Subtype.val h' + simp only at this + right + have hs := s.2.2 + have ht := t.2.1 + have ht' := t.2.2 + have hs' := s.2.1 + exact ⟨Subtype.ext (show s.1 = 1 by linarith), Subtype.ext (show t.1 = 1 by linarith)⟩ + · rcases hnotIoo h₁ with h₃ | h₃ <;> rcases hnotIoo h₂ with h₄ | h₄ <;> simp only at h₃ h₄ + · exfalso + have := t.2.2 + linarith + · exact Or.inl ⟨Subtype.ext (show s.1 = 0 by linarith), Subtype.ext (show t.1 + = 0 by linarith)⟩ + · exfalso + have := s.2.2 + linarith + · exfalso + have := s.2.2 + linarith + obtain ⟨f⟩ := oArc_of_two_arcs (a := a) (b := b) ⟨hac, hai⟩ ⟨hbc, hbi⟩ h0 h1 hmeet + have hr : range a ∪ range b = range m := by + apply subset_antisymm + · rintro _ (⟨t, rfl⟩ | ⟨t, rfl⟩) <;> exact mem_range_self _ + · rintro _ ⟨t, rfl⟩ + by_cases ht : t.1 ≤ 1 / 2 + · refine Or.inl ⟨⟨2 * t.1, by have := t.2.1; positivity, by linarith⟩, ?_⟩ + refine congrArg m (Subtype.ext ?_) + simp + · push Not at ht + refine Or.inr ⟨⟨2 * (1 - t.1), by have := t.2.2; linarith, by linarith⟩, ?_⟩ + refine congrArg m (Subtype.ext ?_) + simp + exact ⟨f.trans (Homeomorph.setCongr hr)⟩ + +/-- The map that collapses the complement of the open set `A` to the point at infinity. -/ +noncomputable def collapse (A : Set S) (x : S) : OnePoint A := by + classical + exact if h : x ∈ A then ((⟨x, h⟩ : A) : OnePoint A) else ∞ + +omit [TopologicalSpace S] in +theorem collapse_of_mem {A : Set S} {x : S} (h : x ∈ A) : collapse A x = + ((⟨x, h⟩ : A) : OnePoint A) := by + simp [collapse, h] + +omit [TopologicalSpace S] in +theorem collapse_of_notMem {A : Set S} {x : S} (h : x ∉ A) : collapse A x = ∞ := by + simp [collapse, h] + +theorem continuous_collapse [T2Space S] {A : Set S} (hA : IsOpen A) : + Continuous (collapse A) := by + classical + refine continuous_def.mpr fun V hV => ?_ + rw [OnePoint.isOpen_def] at hV + obtain ⟨h₁, h₂⟩ := hV + have hop : IsOpen (Subtype.val '' ((↑) ⁻¹' V : Set A)) := hA.isOpenMap_subtype_val _ h₂ + by_cases hinf : ∞ ∈ V + · have hcomp := h₁ hinf + have : (collapse A ⁻¹' V)ᶜ = Subtype.val '' ((↑) ⁻¹' V : Set A)ᶜ := by + ext x + constructor + · intro hx + by_cases hxA : x ∈ A + · refine ⟨⟨x, hxA⟩, ?_, rfl⟩ + intro h + apply hx + simpa [collapse_of_mem hxA] using h + · exact absurd (by simpa [collapse_of_notMem hxA] using hinf) hx + · rintro ⟨a, ha, rfl⟩ h + apply ha + simpa [collapse_of_mem a.2] using h + rw [← isClosed_compl_iff, this] + exact (hcomp.image continuous_subtype_val).isClosed + · have : collapse A ⁻¹' V = Subtype.val '' ((↑) ⁻¹' V : Set A) := by + ext x + constructor + · intro hx + by_cases hxA : x ∈ A + · refine ⟨⟨x, hxA⟩, ?_, rfl⟩ + simpa [mem_preimage, collapse_of_mem hxA] using hx + · exact absurd (by simpa [mem_preimage, collapse_of_notMem hxA] using hx) hinf + · rintro ⟨a, ha, rfl⟩ + simpa [mem_preimage, collapse_of_mem a.2] using ha + rw [this] + exact hop + +/-- The one-point compactification of an open disc is a sphere. -/ +theorem isSphere_onePoint {A : Set S} (hA : IsOpenDisc A) : IsSphere (OnePoint A) := by + obtain ⟨-, ⟨φ⟩⟩ := hA + have hb : OpenUnitDisc ≃ₜ EuclideanPlane := (Homeomorph.unitBall (E := EuclideanPlane)).symm + exact ⟨(φ.symm.trans hb).onePointCongr⟩ + +/-- The map back from the compactification. -/ +noncomputable def uncollapse {A : Set S} (z : S) (x : OnePoint A) : S := x.elim z Subtype.val + +omit [TopologicalSpace S] in +theorem uncollapse_coe {A : Set S} (z : S) (a : A) : uncollapse z (a : OnePoint A) = a.1 := rfl + +theorem continuousAt_uncollapse {A : Set S} (z : S) (a : A) : + ContinuousAt (uncollapse z) (a : OnePoint A) := by + have h : uncollapse z ∘ ((↑) : A → OnePoint A) = Subtype.val := rfl + have : ContinuousAt (uncollapse z ∘ ((↑) : A → OnePoint A)) a := by + rw [h] + exact continuous_subtype_val.continuousAt + exact (OnePoint.isOpenEmbedding_coe.continuousAt_iff).mp this + +/-- A closed disc mapped by a continuous injective map into a Hausdorff space is a closed disc. -/ +theorem isClosedDisc_image {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] [T2Space Y] + {K : Set X} (hK : IsClosedDisc K) {G : X → Y} (hG : ContinuousOn G K) (hi : InjOn G K) : + IsClosedDisc (G '' K) ∧ discBd (G '' K) = G '' discBd K := by + obtain ⟨φ⟩ := id hK + have hc : CompactSpace K := by + have : CompactSpace ClosedUnitDisc := isCompact_iff_compactSpace.mp (isCompact_closedBall _ _) + exact φ.compactSpace + let j : K → G '' K := fun x => ⟨G x.1, x.1, x.2, rfl⟩ + have hjc : Continuous j := Continuous.subtype_mk hG.domRestrict _ + have hjb : Function.Bijective j := by + constructor + · intro x y hxy + exact Subtype.ext (hi x.2 y.2 (congrArg Subtype.val hxy)) + · rintro ⟨_, x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + have : T2Space (G '' K) := inferInstance + let J : K ≃ₜ G '' K := hjc.homeoOfEquivCompactToT2 (f := Equiv.ofBijective j hjb) + let ψ : ClosedUnitDisc ≃ₜ G '' K := φ.trans J + refine ⟨⟨ψ⟩, ?_⟩ + rw [disc_boundary _ ψ, disc_boundary _ φ, image_image] + rfl + +/-- A rotation of a chart. -/ +theorem isChart_rotate {X : Type*} [TopologicalSpace X] {D : Set X} {h : X → ℂ} {g : ℂ → X} + (c : IsChart D h g) {u : ℂ} (hu : ‖u‖ = 1) : + IsChart D (fun x => u * h x) (fun z => g (u⁻¹ * z)) := by + have hu0 : u ≠ 0 := by + rintro rfl + simp at hu + have hnorm : ∀ z : ℂ, ‖u⁻¹ * z‖ = ‖z‖ := fun z => by simp [hu] + have hnorm' : ∀ z : ℂ, ‖u * z‖ = ‖z‖ := fun z => by simp [hu] + have hin : ∀ z ∈ closedBall (0 : ℂ) 1, u⁻¹ * z ∈ closedBall (0 : ℂ) 1 := fun z hz => by + rw [mem_closedBall, dist_zero_right, hnorm] + simpa using hz + refine ⟨continuousOn_const.mul c.hc, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · exact c.gc.comp (continuousOn_const.mul continuousOn_id) hin + · intro x hx + have := c.hm hx + rw [mem_closedBall, dist_zero_right] at this ⊢ + rwa [hnorm'] + · intro z hz + exact c.gm (hin z hz) + · intro x hx + simp only [inv_mul_cancel_left₀ hu0] + exact c.gh hx + · intro z hz + simp only + rw [c.hg (hin z hz), mul_inv_cancel_left₀ hu0] + · rw [show (fun x => u * h x) '' discBd D = (fun z => u * z) '' (h '' discBd D) by + rw [image_image], c.bd] + ext z + constructor + · rintro ⟨w, hw, rfl⟩ + rw [mem_sphere_zero_iff_norm] at hw ⊢ + rwa [hnorm'] + · intro hz + refine ⟨u⁻¹ * z, ?_, mul_inv_cancel_left₀ hu0 z⟩ + rw [mem_sphere_zero_iff_norm] at hz ⊢ + rwa [hnorm] + +/-- The part of the closed unit disc on the right of a vertical chord. -/ +def rightPart (τ : ℝ) : Set ℂ := {z | z ∈ closedBall (0 : ℂ) 1 ∧ τ ≤ z.re} + +theorem rightPart_disc {τ : ℝ} (hτ : τ < 1 / 4) : + IsClosedDisc (rightPart τ) ∧ discBd (rightPart τ) = frontier (rightPart τ) := by + have hc : Convex ℝ (rightPart τ) := + (convex_closedBall 0 1).inter (convex_halfSpace_re_ge τ) + have hcl : IsClosed (rightPart τ) := + isClosed_closedBall.inter (isClosed_le continuous_const Complex.continuous_re) + have hb : Bornology.IsBounded (rightPart τ) := isBounded_closedBall.subset fun z hz => hz.1 + refine isClosedDisc_of_convex hc ⟨(1 / 2 : ℂ), ?_⟩ hb hcl + refine mem_interior.mpr ⟨ball (1 / 2 : ℂ) (1 / 4), ?_, isOpen_ball, mem_ball_self (by norm_num)⟩ + intro z hz + have hz' : ‖z - 1 / 2‖ < 1 / 4 := by simpa [dist_eq_norm] using hz + refine ⟨?_, ?_⟩ + · have : ‖z‖ ≤ ‖z - 1 / 2‖ + ‖(1 / 2 : ℂ)‖ := by + simpa using norm_add_le (z - 1 / 2) (1 / 2 : ℂ) + have h2 : ‖(1 / 2 : ℂ)‖ = 1 / 2 := by norm_num + simp only [mem_closedBall, dist_zero_right] + linarith + · have h1 : |(z - 1 / 2).re| ≤ ‖z - 1 / 2‖ := Complex.abs_re_le_norm _ + have h2 := (abs_le.mp h1).1 + have h3 : (z - 1 / 2).re = z.re - 1 / 2 := by simp + rw [h3] at h2 + linarith + +theorem rightPart_sphere {τ : ℝ} (_hτ : -1 < τ) (_hτ' : τ < 1) {η : ℝ} (hη : Real.cos η = -τ) + (h0 : 0 < η) (hπ : η < Real.pi) : + rightPart τ ∩ sphere 0 1 = cis' '' Icc (-(Real.pi - η)) (Real.pi - η) := by + have hcos : Real.cos (Real.pi - η) = τ := by rw [Real.cos_pi_sub, hη, neg_neg] + have hre : ∀ θ : ℝ, (cis' θ).re = Real.cos θ := fun θ => Complex.exp_ofReal_mul_I_re θ + have hη' : Real.pi - η ∈ Icc 0 Real.pi := ⟨by linarith, by linarith⟩ + ext z + constructor + · rintro ⟨⟨-, hz⟩, hs⟩ + have hn : ‖z‖ = 1 := mem_sphere_zero_iff_norm.mp hs + have hz' : cis' (Complex.arg z) = z := by + have := Complex.norm_mul_exp_arg_mul_I z + rw [hn] at this + simpa [cis'] using this + refine ⟨Complex.arg z, ?_, hz'⟩ + have hle : |Complex.arg z| ≤ Real.pi - η := by + by_contra hc + push Not at hc + have h₁ : |Complex.arg z| ∈ Icc 0 Real.pi := ⟨abs_nonneg _, Complex.abs_arg_le_pi z⟩ + have h₂ := Real.strictAntiOn_cos hη' h₁ hc + rw [Real.cos_abs, ← hre, hz', hcos] at h₂ + linarith + exact abs_le.mp hle + · rintro ⟨θ, hθ, rfl⟩ + have hn : ‖cis' θ‖ = 1 := norm_cis' θ + refine ⟨⟨by simp [hn], ?_⟩, by simp [hn]⟩ + rw [hre, ← Real.cos_abs θ, ← hcos] + exact Real.strictAntiOn_cos.antitoneOn ⟨abs_nonneg _, (abs_le.mpr hθ).trans hη'.2⟩ hη' + (abs_le.mpr hθ) + +private theorem exists_disc_off_on_other_side {A N C : Set S} [T2Space S] + {O Δ₁ Δ₂ : Set (OnePoint A)} + (hd₁ : IsClosedDisc Δ₁) (hd₂ : IsClosedDisc Δ₂) + (hb₁ : discBd Δ₁ = O) (hb₂ : discBd Δ₂ = O) + (hu : Δ₁ ∪ Δ₂ = univ) (hi : Δ₁ ∩ Δ₂ = O) + (hinfO : (∞ : OnePoint A) ∈ O) + (hκ : Continuous (collapse A)) (hκA : InjOn (collapse A) A) + (hbdO : ∀ {x : S}, x ∈ discBd N → collapse A x ∈ O) + (hObd : ∀ {x : S}, x ∈ A → collapse A x ∈ O → x ∈ discBd N) + (hTne : (discInt N ∩ A).Nonempty) + (hC : IsCompact C) (hCA : C ⊆ A) (hCT : Disjoint C (discInt N)) (hCne : C.Nonempty) : + let T' := collapse A '' (discInt N ∩ A) + Disjoint T' O → IsOpen T' → closure T' ⊆ T' ∪ O → T' ⊆ Δ₁ → + ∃ (ρ L : Set S) (s t : S), IsClosedDisc ρ ∧ ρ ⊆ A ∧ C ⊆ ρ ∧ ρ ∩ N = L ∧ + IsLineWithEnds L s t ∧ L ⊆ discBd ρ ∧ L ⊆ discBd N := by + intro T' hT'O hT'open hclT hT'₁ + have hO₂ : O ⊆ Δ₂ := hb₂ ▸ discBd_subset Δ₂ + -- The inside of `Δ₁` is `T'`. + have hint : Δ₁ \ O ⊆ T' := by + have hpre : IsPreconnected (discInt Δ₁) := hd₁.isPreconnected_discInt + have heq : discInt Δ₁ = Δ₁ \ O := by rw [discInt, hb₁] + rw [heq] at hpre + obtain ⟨y, hy⟩ := hTne + have hyT : collapse A y ∈ T' := ⟨y, hy, rfl⟩ + refine hpre.subset_of_closure_inter_subset hT'open + ⟨_, ⟨hT'₁ hyT, fun h => disjoint_left.mp hT'O hyT h⟩, hyT⟩ ?_ + rintro x ⟨hx, -, hxO⟩ + exact (hclT hx).resolve_right hxO + have hT'₂ : Disjoint T' Δ₂ := by + refine disjoint_left.mpr fun x hx hx₂ => ?_ + exact disjoint_left.mp hT'O hx (hi ▸ ⟨hT'₁ hx, hx₂⟩) + have hCΔ : ∀ x ∈ C, collapse A x ∈ Δ₂ := by + intro x hx + have huniv : collapse A x ∈ Δ₁ ∪ Δ₂ := hu ▸ mem_univ _ + rcases huniv with h | h + · by_cases hxO : collapse A x ∈ O + · exact hO₂ hxO + · obtain ⟨y, hy, hyx⟩ := hint ⟨h, hxO⟩ + have : y = x := hκA hy.2 (hCA hx) hyx + exact absurd (this ▸ hy.1) (disjoint_left.mp hCT hx) + · exact h + -- The chart of `Δ₂`, with `∞` at the point `-1`. + obtain ⟨h₀, g₀, c₀⟩ := hd₂.exists_isChart + have hinfb : (∞ : OnePoint A) ∈ discBd Δ₂ := hb₂.symm ▸ hinfO + have hbn : ‖h₀ ∞‖ = 1 := by + have : h₀ ∞ ∈ sphere (0 : ℂ) 1 := c₀.bd ▸ mem_image_of_mem h₀ hinfb + exact mem_sphere_zero_iff_norm.mp this + have hbne : h₀ ∞ ≠ 0 := fun h => by + rw [h] at hbn + simp at hbn + obtain ⟨h, g, c, hh⟩ : ∃ h g, IsChart Δ₂ h g ∧ h ∞ = -1 := by + refine ⟨_, _, isChart_rotate c₀ (u := -(h₀ ∞)⁻¹) (by simp [hbn]), ?_⟩ + rw [neg_mul, inv_mul_cancel₀ hbne] + have hg1 : g (-1) = ∞ := by + rw [← hh] + exact c.gh (hO₂ hinfO) + have hOg : O = g '' sphere 0 1 := by + rw [← c.bd, hb₂, c.g_h (hO₂)] + -- A chord that keeps `C` on its right. + have hCc : IsCompact (h '' (collapse A '' C)) := + ((hC.image hκ).image_of_continuousOn + (c.hc.mono (image_subset_iff.mpr fun x hx => hCΔ x hx))) + obtain ⟨z₀, hz₀, hmin⟩ := hCc.exists_isMinOn (hCne.image _ |>.image _) + Complex.continuous_re.continuousOn + obtain ⟨_, ⟨x₀, hx₀, rfl⟩, rfl⟩ := hz₀ + have hz₀b := c.hm (hCΔ x₀ hx₀) + have hzne : h (collapse A x₀) ≠ -1 := by + intro he + have := c.gh (hCΔ x₀ hx₀) + simp only [he, hg1] at this + rw [collapse_of_mem (hCA hx₀)] at this + exact OnePoint.infty_ne_coe _ this + set w := h (collapse A x₀) with hw + have hwn : ‖w‖ ≤ 1 := by simpa using hz₀b + have hwre : -1 < w.re := by + by_contra hc + push Not at hc + apply hzne + have h₁ : |w.re| ≤ ‖w‖ := Complex.abs_re_le_norm w + have h₂ := Complex.sq_norm w + have h₃ : w.re = -1 := by + have := (abs_le.mp (h₁.trans hwn)).1 + linarith + have h₄ : w.im = 0 := by + rw [Complex.normSq_apply] at h₂ + nlinarith [mul_self_nonneg w.im, norm_nonneg w] + exact Complex.ext (by simpa using h₃) (by simpa using h₄) + have hwre' : w.re ≤ 1 := (Complex.re_le_norm w).trans hwn + set τ : ℝ := (w.re - 1) / 2 with hτ + have hτ₁ : -1 < τ := by rw [hτ]; linarith + have hτ₂ : τ ≤ 0 := by rw [hτ]; linarith + have hτ₃ : τ < w.re := by rw [hτ]; linarith + set η := Real.arccos (-τ) with hηd + have hηc : Real.cos η = -τ := Real.cos_arccos (by linarith) (by linarith) + have hη₀ : 0 < η := Real.arccos_pos.mpr (by linarith) + have hηπ : η < Real.pi := Real.arccos_lt_pi.mpr (by linarith) |>.trans_le le_rfl + obtain ⟨hdK, hbK⟩ := rightPart_disc (τ := τ) (by linarith) + have hsph := rightPart_sphere hτ₁ (by linarith) hηc hη₀ hηπ + have hKball : rightPart τ ⊆ closedBall 0 1 := fun z hz => hz.1 + have hne1 : ∀ z ∈ rightPart τ, z ≠ -1 := by + rintro z ⟨-, hz⟩ rfl + simp at hz + linarith + have hgne : ∀ z ∈ rightPart τ, g z ≠ ∞ := by + intro z hz he + apply hne1 z hz + have h₁ := c.hg (hKball hz) + simp only [he, hh] at h₁ + exact h₁.symm + -- The disc in `S`. + let G : ℂ → S := fun z => uncollapse x₀ (g z) + have hGκ : ∀ z ∈ rightPart τ, G z ∈ A ∧ collapse A (G z) = g z := by + intro z hz + have hne := hgne z hz + obtain ⟨a, ha⟩ := OnePoint.ne_infty_iff_exists.mp hne + have hG : G z = a.1 := by + change uncollapse x₀ (g z) = a.1 + rw [← ha] + rfl + rw [hG] + exact ⟨a.2, by rw [collapse_of_mem a.2, ← ha]⟩ + have hGc : ContinuousOn G (rightPart τ) := by + intro z hz + obtain ⟨a, ha⟩ := OnePoint.ne_infty_iff_exists.mp (hgne z hz) + have h₁ : ContinuousAt (uncollapse x₀) (g z) := by + rw [← ha] + exact continuousAt_uncollapse x₀ a + exact h₁.comp_continuousWithinAt ((c.gc z (hKball hz)).mono hKball) + have hGi : InjOn G (rightPart τ) := by + intro y hy z hz hyz + have h₁ : g y = g z := by rw [← (hGκ y hy).2, ← (hGκ z hz).2, hyz] + have h₂ := c.hg (hKball hy) + rw [← h₂, ← c.hg (hKball hz)] + simp only [h₁] + obtain ⟨hρ, hρb⟩ := isClosedDisc_image hdK hGc hGi + -- The line. + let cl : ℝ → ℝ := fun θ => max (-(Real.pi - η)) (min θ (Real.pi - η)) + have hcl : ∀ θ ∈ Icc (-(Real.pi - η)) (Real.pi - η), cl θ = θ := fun θ hθ => by + simp only [cl] + rw [min_eq_left hθ.2, max_eq_right hθ.1] + have hclm : ∀ θ, cis' (cl θ) ∈ rightPart τ := by + intro θ + have hab : -(Real.pi - η) ≤ Real.pi - η := by linarith + have : cl θ ∈ Icc (-(Real.pi - η)) (Real.pi - η) := + ⟨le_max_left _ _, max_le hab (min_le_right _ _)⟩ + exact (hsph.ge (mem_image_of_mem cis' this)).1 + let p : ℝ → S := fun θ => G (cis' (cl θ)) + have hpc : Continuous p := by + refine hGc.comp_continuous (continuous_cis'.comp ?_) hclm + exact continuous_const.max (continuous_id.min continuous_const) + have hpi : InjOn p (Icc (-(Real.pi - η)) (Real.pi - η)) := by + intro a ha b hb hab + have h₁ := hGi (hclm a) (hclm b) hab + rw [hcl a ha, hcl b hb] at h₁ + have ha' : a ∈ Ioo (-Real.pi) Real.pi := ⟨by linarith [ha.1], by linarith [ha.2]⟩ + have hb' : b ∈ Ioo (-Real.pi) Real.pi := ⟨by linarith [hb.1], by linarith [hb.2]⟩ + exact cis'_injOn ha' hb' h₁ + have hline := isLine_of_injOn hpc (a := -(Real.pi - η)) (b := Real.pi - η) (by linarith) hpi + have hLeq : p '' Icc (-(Real.pi - η)) (Real.pi - η) = G '' (rightPart τ ∩ sphere 0 1) := by + rw [hsph, image_image] + exact image_congr fun θ hθ => by simp only [p, hcl θ hθ] + have hρN : G '' rightPart τ ∩ N = G '' (rightPart τ ∩ sphere 0 1) := by + apply subset_antisymm + · rintro _ ⟨⟨z, hz, rfl⟩, hzN⟩ + obtain ⟨hzA, hzκ⟩ := hGκ z hz + have hzΔ : collapse A (G z) ∈ Δ₂ := by + rw [hzκ] + exact c.gm (hKball hz) + have hzb : G z ∈ discBd N := by + by_contra hn + exact disjoint_left.mp hT'₂ ⟨_, ⟨⟨hzN, hn⟩, hzA⟩, rfl⟩ hzΔ + have hzO := hbdO hzb + rw [hzκ, hOg] at hzO + obtain ⟨y, hy, hyz⟩ := hzO + have : y = z := by + have h₁ := c.hg (sphere_subset_closedBall hy) + rw [hyz, c.hg (hKball hz)] at h₁ + exact h₁.symm + exact ⟨z, ⟨hz, this ▸ hy⟩, rfl⟩ + · rintro _ ⟨z, ⟨hz, hzs⟩, rfl⟩ + refine ⟨⟨z, hz, rfl⟩, ?_⟩ + obtain ⟨hzA, hzκ⟩ := hGκ z hz + refine discBd_subset N (hObd hzA ?_) + rw [hzκ, hOg] + exact mem_image_of_mem g hzs + refine ⟨G '' rightPart τ, G '' (rightPart τ ∩ sphere 0 1), _, _, hρ, ?_, ?_, hρN, + hLeq ▸ hline, ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact (hGκ z hz).1 + · intro x hx + have hxr : h (collapse A x) ∈ rightPart τ := by + refine ⟨c.hm (hCΔ x hx), hτ₃.le.trans ?_⟩ + exact hmin (mem_image_of_mem h (mem_image_of_mem _ hx)) + refine ⟨_, hxr, ?_⟩ + apply hκA (hGκ _ hxr).1 (hCA hx) + rw [(hGκ _ hxr).2] + exact c.gh (hCΔ x hx) + · rw [hρb, hbK] + refine image_mono fun z hz => ?_ + refine ⟨subset_closure hz.1, fun hi' => ?_⟩ + have hb' : z ∈ interior (closedBall (0 : ℂ) 1) := interior_mono hKball hi' + rw [interior_closedBall _ one_ne_zero] at hb' + have h₁ : ‖z‖ = 1 := mem_sphere_zero_iff_norm.mp hz.2 + have h₂ : ‖z‖ < 1 := by simpa using hb' + linarith + · rintro _ ⟨z, ⟨hz, hzs⟩, rfl⟩ + obtain ⟨hzA, hzκ⟩ := hGκ z hz + refine hObd hzA ?_ + rw [hzκ, hOg] + exact mem_image_of_mem g hzs + +/-- **A closed disc off a closed disc.** See the module docstring. The closed disc `N` meets the +complement of the open disc `A` so that the rest of `bd(N)` is the open part of the curve `ℓ` with +ends off `A`. Each compact subset of `A` that misses the inside of `N` lies in a closed disc in `A` +that meets `N` in a line of both boundaries. -/ +theorem exists_disc_off (hS : IsClosedSurface S) {A N C : Set S} (hA : IsOpenDisc A) + (hN : IsClosedDisc N) {ℓ : I → S} (hℓ : Continuous ℓ) (h0 : ℓ 0 ∉ A) (h1 : ℓ 1 ∉ A) + (hinj : InjOn ℓ (Ioo 0 1)) (hbd : discBd N ∩ A = ℓ '' Ioo 0 1) + (hT : IsPreconnected (discInt N ∩ A)) (hTne : (discInt N ∩ A).Nonempty) + (hC : IsCompact C) (hCA : C ⊆ A) (hCT : Disjoint C (discInt N)) (hCne : C.Nonempty) : + ∃ (ρ L : Set S) (s t : S), IsClosedDisc ρ ∧ ρ ⊆ A ∧ C ⊆ ρ ∧ ρ ∩ N = L ∧ + IsLineWithEnds L s t ∧ L ⊆ discBd ρ ∧ L ⊆ discBd N := by + classical + have hK : CompactSpace S := hS.1 + have hT2 : T2Space S := hS.2.1 + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hAo : IsOpen A := hA.1 + have hXT : T2Space (OnePoint A) := by + obtain ⟨e⟩ := isSphere_onePoint hA + exact e.symm.t2Space + have hκ : Continuous (collapse A) := continuous_collapse hAo + have hκA : InjOn (collapse A) A := by + intro x hx y hy hxy + rw [collapse_of_mem hx, collapse_of_mem hy] at hxy + exact congrArg Subtype.val (OnePoint.coe_injective hxy) + have hκmem : ∀ {x : S}, collapse A x ≠ ∞ → x ∈ A := fun {x} h => by + by_contra hx + exact h (collapse_of_notMem hx) + let m : I → OnePoint A := collapse A ∘ ℓ + have hm : Continuous m := hκ.comp hℓ + have hm0 : m 0 = ∞ := collapse_of_notMem h0 + have hm1 : m 1 = ∞ := collapse_of_notMem h1 + have hIoo : ∀ {t : I}, t ∈ Ioo (0 : I) 1 → ℓ t ∈ A := fun ht => + (hbd.ge (mem_image_of_mem ℓ ht)).2 + have hO : IsOArc (range m) := by + refine isOArc_of_loop hm (hm0.trans hm1.symm) ?_ ?_ + · intro s hs t ht hst + exact hinj hs ht (hκA (hIoo hs) (hIoo ht) hst) + · intro t ht + rw [hm0] + change collapse A (ℓ t) ≠ ∞ + rw [collapse_of_mem (hIoo ht)] + exact OnePoint.coe_ne_infty _ + set O := range m with hOdef + have hinfO : (∞ : OnePoint A) ∈ O := ⟨0, hm0⟩ + have hbdO : ∀ {x : S}, x ∈ discBd N → collapse A x ∈ O := by + intro x hx + by_cases hxA : x ∈ A + · obtain ⟨t, ht, rfl⟩ := hbd.subset ⟨hx, hxA⟩ + exact ⟨t, rfl⟩ + · rw [collapse_of_notMem hxA] + exact hinfO + have hObd : ∀ {x : S}, x ∈ A → collapse A x ∈ O → x ∈ discBd N := by + rintro x hx ⟨t, ht⟩ + have ht' : collapse A (ℓ t) = collapse A x := ht + have htA : ℓ t ∈ A := by + apply hκmem + rw [ht', collapse_of_mem hx] + exact OnePoint.coe_ne_infty _ + have hxt : ℓ t = x := hκA htA hx ht' + have htIoo : t ∈ Ioo (0 : I) 1 := by + refine ⟨unitInterval.pos_iff_ne_zero.mpr ?_, unitInterval.lt_one_iff_ne_one.mpr ?_⟩ + · rintro rfl + exact h0 htA + · rintro rfl + exact h1 htA + exact (hbd.ge (mem_image_of_mem ℓ htIoo)).1 |> fun h => hxt ▸ h + let T' : Set (OnePoint A) := collapse A '' (discInt N ∩ A) + have hT'c : IsPreconnected T' := hT.image _ hκ.continuousOn + have hT'O : Disjoint T' O := by + refine disjoint_left.mpr ?_ + rintro _ ⟨x, ⟨hx, hxA⟩, rfl⟩ hO' + exact hx.2 (hObd hxA hO') + have hT'open : IsOpen T' := by + have hop : IsOpen (discInt N ∩ A) := (hN.isOpen_discInt hman).inter hAo + have : T' = ((↑) : A → OnePoint A) '' (Subtype.val ⁻¹' (discInt N ∩ A)) := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + exact ⟨⟨x, hx.2⟩, hx, (collapse_of_mem hx.2).symm⟩ + · rintro ⟨a, ha, rfl⟩ + exact ⟨a.1, ha, collapse_of_mem a.2⟩ + rw [this] + exact OnePoint.isOpenEmbedding_coe.isOpenMap _ (hop.preimage continuous_subtype_val) + have hNc : IsCompact N := hN.isCompact + have hκN : collapse A '' N ⊆ T' ∪ O := by + rintro _ ⟨x, hx, rfl⟩ + by_cases hxA : x ∈ A + · by_cases hxb : x ∈ discBd N + · exact Or.inr (hbdO hxb) + · exact Or.inl ⟨x, ⟨⟨hx, hxb⟩, hxA⟩, rfl⟩ + · rw [collapse_of_notMem hxA] + exact Or.inr hinfO + have hclT : closure T' ⊆ T' ∪ O := by + have hcl : IsClosed (collapse A '' N) := (hNc.image hκ).isClosed + have hsub : T' ⊆ collapse A '' N := image_mono fun x hx => hx.1.1 + exact (closure_minimal hsub hcl).trans hκN + obtain ⟨Δ₁, Δ₂, -, hd₁, hd₂, hb₁, hb₂, hu, hi, -, -⟩ := + sphere_disc (OnePoint A) (isSphere_onePoint hA) O hO + have hcls : ∀ {Δ : Set (OnePoint A)}, IsClosedDisc Δ → IsClosed Δ := fun h => h.isCompact.isClosed + have hsub : T' ⊆ Δ₁ ∪ Δ₂ := by + rw [hu] + exact subset_univ _ + have hdis : ∀ x ∈ T', x ∈ Δ₁ → x ∉ Δ₂ := by + intro x hx hx₁ hx₂ + have : x ∈ O := hi ▸ ⟨hx₁, hx₂⟩ + exact disjoint_left.mp hT'O hx this + rcases subset_or_subset_of_closed hT'c (hcls hd₁) (hcls hd₂) hsub hdis with h | h + · exact exists_disc_off_on_other_side hd₁ hd₂ hb₁ hb₂ hu hi hinfO hκ hκA hbdO hObd + hTne hC hCA hCT hCne hT'O hT'open hclT h + · exact exists_disc_off_on_other_side hd₂ hd₁ hb₂ hb₁ (by rw [union_comm]; exact hu) + (by rw [inter_comm]; exact hi) hinfO hκ hκA hbdO hObd hTne hC hCA hCT hCne + hT'O hT'open hclT h + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/GlueFaces.lean b/LeanPool/GraphMinor/GM11/GlueFaces.lean new file mode 100644 index 0000000000..df056f2fe2 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/GlueFaces.lean @@ -0,0 +1,1119 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.EdgeChart +public import LeanPool.GraphMinor.Surface.PushOff +import Mathlib.Analysis.Complex.Convex + +/-! +# The union of two regions across an edge + +`theorem_glue_regions`: let `e` be an edge of a drawing in a closed surface, with different regions +`p` +and `q` on its two sides, and suppose both are open discs. Then `p ∪ e ∪ q` is an open disc. + +We let the union grow along `e`. Write `Z(s, t)` for `p ∪ q` with the piece of `e` between the +parameters +`s` and `t`. A chart around a point of `e` shows that `Z(s, t)` is an open disc for a short piece +(`zone_start`), and that a piece can be made longer (`zone_step`). In both steps, `exists_disc_off` +finds +a closed disc around a given `O`-arc. The union of a chain of open discs of this kind is an open +disc, +so the piece reaches the ends of `e`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval Metric + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The closed unit disc of `ℂ` is a closed disc with the unit circle as boundary. -/ +theorem closedBall_disc : + IsClosedDisc (closedBall (0 : ℂ) 1) ∧ discBd (closedBall (0 : ℂ) 1) = sphere 0 1 := by + have h := isClosedDisc_of_convex (convex_closedBall (0 : ℂ) 1) + (by rw [interior_closedBall _ one_ne_zero]; exact ⟨0, by simp⟩) isBounded_closedBall + isClosed_closedBall + rw [frontier_closedBall _ one_ne_zero] at h + exact h + +/-- A closed disc grown by a closed disc. -/ +theorem exists_absorb (hS : IsClosedSurface S) {A N C : Set S} (hA : IsOpenDisc A) + (hN : IsClosedDisc N) {ℓ : I → S} (hℓ : Continuous ℓ) (h0 : ℓ 0 ∉ A) (h1 : ℓ 1 ∉ A) + (hinj : InjOn ℓ (Ioo 0 1)) (hbd : discBd N ∩ A = ℓ '' Ioo 0 1) + (hT : IsPreconnected (discInt N ∩ A)) (hTne : (discInt N ∩ A).Nonempty) + (hC : IsCompact C) (hCA : C ⊆ A) (hCT : Disjoint C (discInt N)) (hCne : C.Nonempty) : + ∃ ρ : Set S, IsClosedDisc (N ∪ ρ) ∧ ρ ⊆ A ∧ C ⊆ ρ ∧ discInt (N ∪ ρ) ⊆ ρ ∪ discInt N ∧ + ∀ x, x ∉ ρ → x ∈ discBd N → x ∈ discBd (N ∪ ρ) := by + have hT2 : T2Space S := hS.2.1 + obtain ⟨ρ, L, s, t, hρ, hρA, hCρ, hL, hline, hLρ, hLN⟩ := + exists_disc_off hS hA hN hℓ h0 h1 hinj hbd hT hTne hC hCA hCT hCne + have hLr : L ⊆ ρ := hL ▸ inter_subset_left + obtain ⟨hW, hbW⟩ := disc_union N ρ L s t hN hρ hline (by rw [inter_comm]; exact hL) hLN hLρ + have hkey : ∀ x, x ∉ ρ → x ∈ discBd N → x ∈ discBd (N ∪ ρ) := fun x hx hb => by + rw [hbW] + exact ⟨Or.inl hb, fun h => hx (hLr h.1)⟩ + refine ⟨ρ, hW, hρA, hCρ, ?_, hkey⟩ + rintro x ⟨hx | hx, hb⟩ + · by_cases hxρ : x ∈ ρ + · exact Or.inl hxρ + · exact Or.inr ⟨hx, fun h => hb (hkey x hxρ h)⟩ + · exact Or.inl hx + +/-- An `O`-arc in a closed disc whose inside lies in `Y` bounds a closed disc in `Y`, if it lies in +`Y`. -/ +theorem exists_bound_in {W F Y : Set S} (hW : IsClosedDisc W) (hF : IsOArc F) (hFW : F ⊆ W) + (hsub : discInt W ⊆ Y) (hFY : F ⊆ Y) : ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F := by + obtain ⟨Δ, ⟨hΔW, hΔ, hb, -, hdis, -⟩, -⟩ := disc_oArc W F hW hFW hF + refine ⟨Δ, ?_, hΔ, hb⟩ + intro x hx + by_cases hxF : x ∈ F + · exact hFY hxF + · exact hsub ⟨hΔW hx, disjoint_left.mp hdis ⟨hx, hxF⟩⟩ + +/-- `open_disc` for a proper subset. -/ +theorem isOpenDisc_of_bound (hS : IsClosedSurface S) [ConnectedSpace S] {Y : Set S} (hY : IsOpen Y) + (hconn : IsConnected Y) (hne : Y ≠ univ) + (H : ∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) : + IsOpenDisc Y := by + rcases open_disc S Y hS inferInstance hconn hY H with h | h + · exact absurd h.2 hne + · exact h + +/-- A chart of an edge, as in `exists_edge_chart`. -/ +structure IsEdgeChart (H : Drawing S) (γ : I → S) (t₀ : I) (G : ℂ → S) (a b : I) : Prop where + cont : ContinuousOn G (closedBall 0 1) + inj : InjOn G (closedBall 0 1) + left : a < t₀ + right : t₀ < b + zero : G 0 = γ t₀ + mem_U : ∀ z ∈ closedBall (0 : ℂ) 1, G z ∈ H.U ↔ z.im = 0 + ball_eq : G '' {z | z ∈ ball (0 : ℂ) 1 ∧ z.im = 0} = γ '' Ioo a b + closed_eq : G '' {z | z ∈ closedBall (0 : ℂ) 1 ∧ z.im = 0} = γ '' Icc a b + ends : (G (-1) = γ a ∧ G 1 = γ b) ∨ (G (-1) = γ b ∧ G 1 = γ a) + +namespace IsEdgeChart + +variable {H : Drawing S} {γ : I → S} {t₀ a b : I} {G : ℂ → S} + +/-- The closed disc of the chart. -/ +noncomputable def disc (_ : IsEdgeChart H γ t₀ G a b) : Set S := G '' closedBall 0 1 + +section + +variable [T2Space S] (c : IsEdgeChart H γ t₀ G a b) + +include c + +theorem isClosedDisc : IsClosedDisc c.disc := (isClosedDisc_image closedBall_disc.1 c.cont c.inj).1 + +theorem discBd_eq : discBd c.disc = G '' sphere 0 1 := by + rw [disc, (isClosedDisc_image closedBall_disc.1 c.cont c.inj).2, closedBall_disc.2] + +theorem discInt_eq : discInt c.disc = G '' ball 0 1 := by + rw [discInt, discBd_eq c, disc] + ext x + constructor + · rintro ⟨⟨z, hz, rfl⟩, hn⟩ + refine ⟨z, ?_, rfl⟩ + have : ‖z‖ ≤ 1 := by simpa using hz + have h' : ‖z‖ ≠ 1 := fun h => hn ⟨z, by simpa using h, rfl⟩ + simpa using lt_of_le_of_ne this h' + · rintro ⟨z, hz, rfl⟩ + refine ⟨⟨z, ball_subset_closedBall hz, rfl⟩, ?_⟩ + rintro ⟨w, hw, he⟩ + have := c.inj (sphere_subset_closedBall hw) (ball_subset_closedBall hz) he + rw [this] at hw + have h₁ : ‖z‖ = 1 := by simpa using hw + have h₂ : ‖z‖ < 1 := by simpa using hz + linarith + +omit [T2Space S] in +/-- The open lower half of the chart. -/ +theorem mem_lower_of_mem {A : Set S} (hdis : Disjoint A H.U) {x : S} (hx : x ∈ A) {z : ℂ} + (hz : z ∈ closedBall (0 : ℂ) 1) (hxz : G z = x) : z.im ≠ 0 := fun h => + disjoint_left.mp hdis hx (hxz ▸ (c.mem_U z hz).mpr h) + +end + +/-- The lower half of the closed unit disc. -/ +def lower : Set ℂ := {z | z ∈ closedBall (0 : ℂ) 1 ∧ z.im < 0} + +/-- The upper half of the closed unit disc. -/ +def upper : Set ℂ := {z | z ∈ closedBall (0 : ℂ) 1 ∧ 0 < z.im} + +/-- The reflection of a chart. -/ +theorem conj (c : IsEdgeChart H γ t₀ G a b) : + IsEdgeChart H γ t₀ (fun z => G ((starRingEnd ℂ) z)) a b := by + have hnorm : ∀ z ∈ closedBall (0 : ℂ) 1, (starRingEnd ℂ) z ∈ closedBall (0 : ℂ) 1 := fun z hz + => by + simpa using hz + have hset : ∀ X : Set ℂ, (∀ z, z ∈ X → z.im = 0) → + (fun z => G ((starRingEnd ℂ) z)) '' X = G '' X := fun X hX => + image_congr fun z hz => by rw [Complex.conj_eq_iff_im.mpr (hX z hz)] + refine ⟨c.cont.comp Complex.continuous_conj.continuousOn hnorm, ?_, c.left, c.right, ?_, ?_, + ?_, ?_, ?_⟩ + · intro y hy z hz h + have := c.inj (hnorm y hy) (hnorm z hz) h + simpa using congrArg (starRingEnd ℂ) this + · simpa using c.zero + · intro z hz + rw [c.mem_U _ (hnorm z hz)] + simp + · rw [hset {z ∈ ball (0 : ℂ) 1 | z.im = 0} fun _ hz => hz.2] + exact c.ball_eq + · rw [hset {z ∈ closedBall (0 : ℂ) 1 | z.im = 0} fun _ hz => hz.2] + exact c.closed_eq + · simpa using c.ends + +theorem conj_disc (c : IsEdgeChart H γ t₀ G a b) : c.conj.disc = c.disc := by + change (fun z => G ((starRingEnd ℂ) z)) '' _ = G '' _ + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨_, by simpa using hz, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + exact ⟨(starRingEnd ℂ) z, by simpa using hz, by simp⟩ + +omit [TopologicalSpace S] in +theorem image_conj_lower : (fun z => G ((starRingEnd ℂ) z)) '' lower = G '' upper := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨_, ⟨by simpa using hz.1, by simpa using hz.2⟩, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + exact ⟨(starRingEnd ℂ) z, ⟨by simpa using hz.1, by simpa using hz.2⟩, by simp⟩ + +omit [TopologicalSpace S] in +theorem image_conj_upper : (fun z => G ((starRingEnd ℂ) z)) '' upper = G '' lower := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨_, ⟨by simpa using hz.1, by simpa using hz.2⟩, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + exact ⟨(starRingEnd ℂ) z, ⟨by simpa using hz.1, by simpa using hz.2⟩, by simp⟩ + +theorem convex_lower : Convex ℝ lower := + (convex_closedBall 0 1).inter (convex_halfSpace_im_lt 0) + +theorem convex_upper : Convex ℝ upper := + (convex_closedBall 0 1).inter (convex_halfSpace_im_gt 0) + +variable [T2Space S] (c : IsEdgeChart H γ t₀ G a b) + +include c + +omit [T2Space S] in +theorem lower_conn : IsPreconnected (G '' lower) := + (convex_lower.isPreconnected).image _ (c.cont.mono fun _ h => h.1) + +omit [T2Space S] in +theorem upper_conn : IsPreconnected (G '' upper) := + (convex_upper.isPreconnected).image _ (c.cont.mono fun _ h => h.1) + +omit [T2Space S] in +theorem lower_disjoint : Disjoint (G '' lower) H.U := by + refine disjoint_left.mpr ?_ + rintro _ ⟨z, hz, rfl⟩ hU + exact hz.2.ne ((c.mem_U z hz.1).mp hU) + +omit [T2Space S] in +theorem upper_disjoint : Disjoint (G '' upper) H.U := by + refine disjoint_left.mpr ?_ + rintro _ ⟨z, hz, rfl⟩ hU + exact hz.2.ne' ((c.mem_U z hz.1).mp hU) + +omit [TopologicalSpace S] [T2Space S] c in +theorem cases_of_closedBall {z : ℂ} (hz : z ∈ closedBall (0 : ℂ) 1) : + z ∈ lower ∨ z.im = 0 ∨ z ∈ upper := by + rcases lt_trichotomy z.im 0 with h | h | h + · exact Or.inl ⟨hz, h⟩ + · exact Or.inr (Or.inl h) + · exact Or.inr (Or.inr ⟨hz, h⟩) + +/-- **The two sides of the edge in the chart are the two regions.** -/ +theorem sides (hS : IsClosedSurface S) {p q : Set S} (hp : p ∈ H.R) (hq : q ∈ H.R) (hpq : p ≠ q) + (hep : γ t₀ ∈ closure p) (heq : γ t₀ ∈ closure q) : + (G '' lower ⊆ p ∧ G '' upper ⊆ q) ∨ (G '' lower ⊆ q ∧ G '' upper ⊆ p) := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hzl : (⟨0, -1 / 2⟩ : ℂ) ∈ lower := by + refine ⟨?_, by norm_num⟩ + rw [mem_closedBall, dist_zero_right] + have : ‖(⟨0, -1 / 2⟩ : ℂ)‖ = 1 / 2 := by + rw [Complex.norm_def, Complex.normSq_mk] + rw [show (0 : ℝ) * 0 + -1 / 2 * (-1 / 2) = (1 / 2) ^ 2 by ring] + exact Real.sqrt_sq (by norm_num) + rw [this] + norm_num + have hzu : (⟨0, 1 / 2⟩ : ℂ) ∈ upper := by + refine ⟨?_, by norm_num⟩ + rw [mem_closedBall, dist_zero_right] + have : ‖(⟨0, 1 / 2⟩ : ℂ)‖ = 1 / 2 := by + rw [Complex.norm_def, Complex.normSq_mk] + rw [show (0 : ℝ) * 0 + 1 / 2 * (1 / 2) = (1 / 2) ^ 2 by ring] + exact Real.sqrt_sq (by norm_num) + rw [this] + norm_num + have hxl : G ⟨0, -1 / 2⟩ ∉ H.U := disjoint_left.mp (lower_disjoint c) ⟨_, hzl, rfl⟩ + have hxu : G ⟨0, 1 / 2⟩ ∉ H.U := disjoint_left.mp (upper_disjoint c) ⟨_, hzu, rfl⟩ + obtain ⟨r₁, hr₁, hxr₁⟩ := exists_region_of_notMem hxl + obtain ⟨r₂, hr₂, hxr₂⟩ := exists_region_of_notMem hxu + have hl := subset_region hr₁ (lower_conn c) (lower_disjoint c) ⟨_, hzl, rfl⟩ hxr₁ + have hu := subset_region hr₂ (upper_conn c) (upper_disjoint c) ⟨_, hzu, rfl⟩ hxr₂ + have hop : IsOpen (G '' ball 0 1) := discInt_eq c ▸ c.isClosedDisc.isOpen_discInt hman + have hmem : γ t₀ ∈ G '' ball 0 1 := ⟨0, by simp, c.zero⟩ + have hcase : ∀ {r : Set S}, r ∈ H.R → γ t₀ ∈ closure r → r = r₁ ∨ r = r₂ := by + intro r hr hcl + obtain ⟨x, hxb, hxr⟩ := mem_closure_iff.mp hcl _ hop hmem + obtain ⟨z, hz, rfl⟩ := hxb + have hzc := ball_subset_closedBall hz + rcases cases_of_closedBall hzc with h | h | h + · exact Or.inl (region_eq_of_mem hr hr₁ hxr (hl ⟨z, h, rfl⟩)) + · exact absurd ((c.mem_U z hzc).mpr h) (region_subset hr hxr) + · exact Or.inr (region_eq_of_mem hr hr₂ hxr (hu ⟨z, h, rfl⟩)) + rcases hcase hp hep with rfl | rfl <;> rcases hcase hq heq with rfl | rfl + · exact absurd rfl hpq + · exact Or.inl ⟨hl, hu⟩ + · exact Or.inr ⟨hl, hu⟩ + · exact absurd rfl hpq + +theorem isOpen_image_ball (hS : IsClosedSurface S) : IsOpen (G '' ball 0 1) := + discInt_eq c ▸ c.isClosedDisc.isOpen_discInt fun x => (hS.2.2 x).isManifoldPoint + +/-- The data for `exists_disc_off`, for the lower half of the chart. -/ +theorem lower_data {A : Set S} (hlo : G '' lower ⊆ A) + (hrest : ∀ z ∈ closedBall (0 : ℂ) 1, 0 ≤ z.im → G z ∉ A) : + ∃ ℓ : I → S, Continuous ℓ ∧ ℓ 0 ∉ A ∧ ℓ 1 ∉ A ∧ InjOn ℓ (Ioo 0 1) ∧ + discBd c.disc ∩ A = ℓ '' Ioo 0 1 ∧ IsPreconnected (discInt c.disc ∩ A) ∧ + (discInt c.disc ∩ A).Nonempty := by + have harc := isTwoArcs_low_high + have hmem : ∀ t, lowArc t ∈ sphere (0 : ℂ) 1 := fun t => + range_low_union_high ▸ Or.inl ⟨t, rfl⟩ + have hball : ∀ t, lowArc t ∈ closedBall (0 : ℂ) 1 := fun t => sphere_subset_closedBall (hmem t) + have hneg : ∀ t ∈ Ioo (0 : I) 1, (lowArc t).im < 0 := by + intro t ht + have h₁ : (0 : ℝ) < t.1 := ht.1 + have h₂ : t.1 < 1 := ht.2 + have : 0 < capH (2 * t.1 - 1) := capH_pos (abs_lt.mpr ⟨by linarith, by linarith⟩) + simpa [lowArc] using this + have him : ∀ t, t ∉ Ioo (0 : I) 1 → (lowArc t).im = 0 := by + intro t ht + have : 1 ≤ |2 * t.1 - 1| := by + by_contra hc + push Not at hc + obtain ⟨h₁, h₂⟩ := abs_lt.mp hc + exact ht ⟨show (0 : ℝ) < t.1 by linarith, show t.1 < 1 by linarith⟩ + simp [lowArc, capH_eq_zero this] + have hn0 : (0 : I) ∉ Ioo (0 : I) 1 := fun h => lt_irrefl _ h.1 + have hn1 : (1 : I) ∉ Ioo (0 : I) 1 := fun h => lt_irrefl _ h.2 + have hballeq : discInt c.disc ∩ A = G '' {z | z ∈ ball (0 : ℂ) 1 ∧ z.im < 0} := by + rw [discInt_eq c] + ext x + constructor + · rintro ⟨⟨z, hz, rfl⟩, hxA⟩ + refine ⟨z, ⟨hz, ?_⟩, rfl⟩ + by_contra hc + exact hrest z (ball_subset_closedBall hz) (not_lt.mp hc) hxA + · rintro ⟨z, hz, rfl⟩ + exact ⟨⟨z, hz.1, rfl⟩, hlo ⟨z, ⟨ball_subset_closedBall hz.1, hz.2⟩, rfl⟩⟩ + refine ⟨G ∘ lowArc, c.cont.comp_continuous harc.arc_left.1 hball, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · exact hrest _ (hball 0) (him 0 hn0).ge + · exact hrest _ (hball 1) (him 1 hn1).ge + · intro s hs t ht h + exact harc.arc_left.2 (c.inj (hball s) (hball t) h) + · rw [discBd_eq c] + ext x + constructor + · rintro ⟨⟨z, hz, rfl⟩, hxA⟩ + have hzim : z.im < 0 := by + by_contra hc + exact hrest z (sphere_subset_closedBall hz) (not_lt.mp hc) hxA + rw [← range_low_union_high] at hz + rcases hz with ⟨t, rfl⟩ | ⟨t, rfl⟩ + · refine ⟨t, ?_, rfl⟩ + by_contra hn + rw [him t hn] at hzim + exact lt_irrefl _ hzim + · exfalso + have : 0 ≤ capH (2 * t.1 - 1) := Real.sqrt_nonneg _ + have h₂ : (highArc t).im = capH (2 * t.1 - 1) := rfl + linarith + · rintro ⟨t, ht, rfl⟩ + exact ⟨⟨_, hmem t, rfl⟩, hlo ⟨_, ⟨hball t, hneg t ht⟩, rfl⟩⟩ + · rw [hballeq] + refine IsPreconnected.image ?_ _ (c.cont.mono fun _ h => ball_subset_closedBall h.1) + exact ((convex_ball _ _).inter (convex_halfSpace_im_lt 0)).isPreconnected + · rw [hballeq] + refine ⟨_, (⟨0, -1 / 2⟩ : ℂ), ⟨?_, by norm_num⟩, rfl⟩ + rw [mem_ball, dist_zero_right] + have : ‖(⟨0, -1 / 2⟩ : ℂ)‖ = 1 / 2 := by + rw [Complex.norm_def, Complex.normSq_mk] + rw [show (0 : ℝ) * 0 + -1 / 2 * (-1 / 2) = (1 / 2) ^ 2 by ring] + exact Real.sqrt_sq (by norm_num) + rw [this] + norm_num + +end IsEdgeChart + +theorem isPreconnected_of_isOpenDisc {r : Set S} (hr : IsOpenDisc r) : IsPreconnected r := by + obtain ⟨-, ⟨φ⟩⟩ := hr + have h : PreconnectedSpace OpenUnitDisc := + isPreconnected_iff_preconnectedSpace.mp (convex_ball _ _).isPreconnected + have hr : range (fun x => (φ x).1) = r := by + ext x + constructor + · rintro ⟨y, rfl⟩ + exact (φ y).2 + · intro hx + exact ⟨φ.symm ⟨x, hx⟩, by simp⟩ + exact hr ▸ isPreconnected_range (continuous_subtype_val.comp φ.continuous) + +/-- The two regions on the two sides of the edge `e`, with a parametrization of `e`. -/ +structure GlueData (H : Drawing S) (e : Set S) (γ : I → S) (p q : Set S) : Prop where + he : e ∈ H.E + cont : Continuous γ + zero : γ 0 ∈ H.V + one : γ 1 ∈ H.V + inj : InjOn γ (Ioo 0 1) + image : γ '' Ioo 0 1 = e + base : ∃ p₀ ∈ H.R, ∃ q₀ ∈ H.R, p₀ ≠ q₀ ∧ e ⊆ closure p₀ ∧ e ⊆ closure q₀ ∧ p₀ ⊆ p ∧ q₀ ⊆ q + discp : IsOpenDisc p + discq : IsOpenDisc q + pq_dis : Disjoint p q + notMem_p : ∀ t, γ t ∉ p + notMem_q : ∀ t, γ t ∉ q + +/-- `p ∪ q` with the piece of the edge between `s` and `t`. -/ +def zone (p q : Set S) (γ : I → S) (s t : I) : Set S := p ∪ q ∪ γ '' Ioo s t + +namespace GlueData + +variable {H : Drawing S} {e : Set S} {γ : I → S} {p q : Set S} (d : GlueData H e γ p q) + +include d + +theorem swap : GlueData H e γ q p := by + obtain ⟨p₀, hp, q₀, hq, hne, h₁, h₂, h₃, h₄⟩ := d.base + exact ⟨d.he, d.cont, d.zero, d.one, d.inj, d.image, ⟨q₀, hq, p₀, hp, hne.symm, h₂, h₁, h₄, h₃⟩, + d.discq, d.discp, d.pq_dis.symm, d.notMem_q, d.notMem_p⟩ + +omit d in +omit [TopologicalSpace S] in +theorem symm_lt_symm {x y : I} : unitInterval.symm x < unitInterval.symm y ↔ y < x := by + rw [← Subtype.coe_lt_coe, ← Subtype.coe_lt_coe, coe_symm_eq, coe_symm_eq] + constructor <;> intro h <;> linarith + +omit d in +omit [TopologicalSpace S] in +theorem symm_image_Ioo (x y : I) : unitInterval.symm '' Ioo x y = Ioo (unitInterval.symm y) + (unitInterval.symm x) := by + ext t + constructor + · rintro ⟨u, hu, rfl⟩ + exact ⟨symm_lt_symm.mpr hu.2, symm_lt_symm.mpr hu.1⟩ + · rintro ⟨h₁, h₂⟩ + refine ⟨unitInterval.symm t, ⟨?_, ?_⟩, symm_symm t⟩ + · rw [← symm_lt_symm, symm_symm] + exact h₂ + · rw [← symm_lt_symm, symm_symm] + exact h₁ + +/-- The same edge, traversed backwards. -/ +theorem reverse : GlueData H e (γ ∘ unitInterval.symm) p q := by + have hsym : unitInterval.symm '' Ioo (0 : I) 1 = Ioo 0 1 := by + rw [symm_image_Ioo, symm_zero, symm_one] + refine ⟨d.he, d.cont.comp continuous_symm, ?_, ?_, ?_, ?_, d.base, d.discp, d.discq, d.pq_dis, + fun t => d.notMem_p _, fun t => d.notMem_q _⟩ + · simpa using d.one + · simpa using d.zero + · intro x hx y hy h + have hx' : unitInterval.symm x ∈ Ioo (0 : I) 1 := hsym ▸ mem_image_of_mem _ hx + have hy' : unitInterval.symm y ∈ Ioo (0 : I) 1 := hsym ▸ mem_image_of_mem _ hy + exact symm_bijective.1 (d.inj hx' hy' h) + · rw [image_comp, hsym] + exact d.image + +omit d in +omit [TopologicalSpace S] in +theorem zone_reverse (p q : Set S) (γ : I → S) (s t : I) : + zone p q (γ ∘ unitInterval.symm) s t = zone p q γ (unitInterval.symm t) (unitInterval.symm s) + := by + simp only [zone] + rw [image_comp, symm_image_Ioo] + +theorem mem_e {t : I} (ht : t ∈ Ioo (0 : I) 1) : γ t ∈ e := d.image ▸ mem_image_of_mem γ ht + +theorem mem_U (t : I) : γ t ∈ H.U := by + by_cases ht : t ∈ Ioo (0 : I) 1 + · exact (d.he.2.1 (d.mem_e ht)).1 + · have : t = 0 ∨ t = 1 := by + by_contra hc + push Not at hc + exact ht ⟨unitInterval.pos_iff_ne_zero.mpr hc.1, unitInterval.lt_one_iff_ne_one.mpr hc.2⟩ + rcases this with rfl | rfl + · exact H.V_subset_U d.zero + · exact H.V_subset_U d.one + +theorem clp : e ⊆ closure p := by + obtain ⟨p₀, -, q₀, -, -, h₁, -, h₃, -⟩ := d.base + exact h₁.trans (closure_mono h₃) + +theorem clq : e ⊆ closure q := by + obtain ⟨p₀, -, q₀, -, -, -, h₂, -, h₄⟩ := d.base + exact h₂.trans (closure_mono h₄) + +omit d in +omit [TopologicalSpace S] in +theorem Ioo_subset (s t : I) : Ioo s t ⊆ Ioo 0 1 := fun _ hx => + ⟨lt_of_le_of_lt (unitInterval.nonneg s) hx.1, lt_of_lt_of_le hx.2 (unitInterval.le_one t)⟩ + +theorem notMem_zone {s t x : I} (hx : x ∉ Ioo s t) : γ x ∉ zone p q γ s t := by + rintro (h | ⟨y, hy, hyx⟩) + · rcases h with h | h + · exact d.notMem_p x h + · exact d.notMem_q x h + · have hy' := Ioo_subset _ _ hy + by_cases hx' : x ∈ Ioo (0 : I) 1 + · exact hx (d.inj hy' hx' hyx ▸ hy) + · have : x = 0 ∨ x = 1 := by + by_contra hc + push Not at hc + exact hx' ⟨unitInterval.pos_iff_ne_zero.mpr hc.1, unitInterval.lt_one_iff_ne_one.mpr hc.2⟩ + have hV : γ x ∈ H.V := by + rcases this with rfl | rfl + · exact d.zero + · exact d.one + exact (d.he.2.1 (d.mem_e hy')).2 (hyx ▸ hV) + +theorem zone_ne_univ (s t : I) : zone p q γ s t ≠ univ := fun h => + d.notMem_zone (fun h' => not_lt.mpr (unitInterval.nonneg s) h'.1) (h ▸ mem_univ (γ 0)) + +theorem zone_isConnected {s t : I} (hst : s < t) : IsConnected (zone p q γ s t) := by + obtain ⟨m, hm⟩ : (Ioo s t).Nonempty := by + refine ⟨⟨(s.1 + t.1) / 2, ?_, ?_⟩, ?_, ?_⟩ + · have := s.2.1 + have := t.2.1 + linarith + · have := s.2.2 + have := t.2.2 + linarith + · exact show s.1 < (s.1 + t.1) / 2 by have : s.1 < t.1 := hst; linarith + · exact show (s.1 + t.1) / 2 < t.1 by have : s.1 < t.1 := hst; linarith + have hsub : ∀ {r : Set S}, IsOpenDisc r → e ⊆ closure r → IsPreconnected (r ∪ γ '' Ioo s t) := by + intro r hr hcl + have hrc : IsPreconnected r := isPreconnected_of_isOpenDisc hr + refine hrc.subset_closure subset_union_left (union_subset subset_closure ?_) + rintro _ ⟨x, hx, rfl⟩ + exact hcl (d.mem_e (Ioo_subset _ _ hx)) + have hne : γ m ∈ (p ∪ γ '' Ioo s t) ∩ (q ∪ γ '' Ioo s t) := + ⟨Or.inr (mem_image_of_mem γ hm), Or.inr (mem_image_of_mem γ hm)⟩ + have hu := (hsub d.discp d.clp).union' ⟨_, hne⟩ (hsub d.discq d.clq) + have heq : (p ∪ γ '' Ioo s t) ∪ (q ∪ γ '' Ioo s t) = zone p q γ s t := by + simp only [zone] + ext x + simp only [mem_union] + tauto + exact ⟨⟨γ m, Or.inr (mem_image_of_mem γ hm)⟩, heq ▸ hu⟩ + +omit d in +omit [TopologicalSpace S] in +theorem zone_mono (p q : Set S) (γ : I → S) (s : I) {t t' : I} (h : t ≤ t') : + zone p q γ s t ⊆ zone p q γ s t' := + union_subset_union_right _ (image_mono fun _ hx => ⟨hx.1, hx.2.trans_le h⟩) + +variable [T2Space S] [ConnectedSpace S] {G : ℂ → S} {t₀ a b : I} + +/-- A short piece, when the lower half of the chart lies in `p`. -/ +theorem zone_start_aux (hS : IsClosedSurface S) (c : IsEdgeChart H γ t₀ G a b) + (hlo : G '' IsEdgeChart.lower ⊆ p) (hup : G '' IsEdgeChart.upper ⊆ q) : + IsOpenDisc (zone p q γ a b) := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hcase : ∀ {z}, z ∈ closedBall (0 : ℂ) 1 → z.im ≠ 0 → G z ∈ p ∨ G z ∈ q := by + intro z hz him + rcases IsEdgeChart.cases_of_closedBall hz with h | h | h + · exact Or.inl (hlo ⟨z, h, rfl⟩) + · exact absurd h him + · exact Or.inr (hup ⟨z, h, rfl⟩) + have hYeq : zone p q γ a b = p ∪ q ∪ G '' ball 0 1 := by + simp only [zone] + refine subset_antisymm (union_subset_union_right _ ?_) (union_subset subset_union_left ?_) + · rw [← c.ball_eq] + exact image_mono fun z hz => hz.1 + · rintro _ ⟨z, hz, rfl⟩ + by_cases him : z.im = 0 + · exact Or.inr (c.ball_eq ▸ mem_image_of_mem G ⟨hz, him⟩) + · exact Or.inl (hcase (ball_subset_closedBall hz) him) + have hop : IsOpen (zone p q γ a b) := by + rw [hYeq] + exact (d.discp.1.union d.discq.1).union (c.isOpen_image_ball hS) + refine isOpenDisc_of_bound hS hop (d.zone_isConnected (c.left.trans c.right)) + (d.zone_ne_univ _ _) ?_ + intro F hFY hF + have hbN : IsOpen (discInt c.disc) := c.isClosedDisc.isOpen_discInt hman + have hKc : IsCompact (F \ discInt c.disc) := hF.isCompact.diff hbN + have hint := c.discInt_eq + have hKpq : F \ discInt c.disc ⊆ p ∪ q := by + rintro x ⟨hxF, hxN⟩ + have := hFY hxF + rw [hYeq] at this + rcases this with h | h + · exact h + · exact absurd (hint ▸ h) hxN + have hKp : IsCompact ((F \ discInt c.disc) ∩ p) := by + have : (F \ discInt c.disc) ∩ p = (F \ discInt c.disc) \ q := by + ext x + constructor + · rintro ⟨hx, hxp⟩ + exact ⟨hx, disjoint_left.mp d.pq_dis hxp⟩ + · rintro ⟨hx, hxq⟩ + exact ⟨hx, (hKpq hx).resolve_right hxq⟩ + rw [this] + exact hKc.diff d.discq.1 + have hKq : IsCompact ((F \ discInt c.disc) ∩ q) := by + have : (F \ discInt c.disc) ∩ q = (F \ discInt c.disc) \ p := by + ext x + constructor + · rintro ⟨hx, hxp⟩ + exact ⟨hx, disjoint_right.mp d.pq_dis hxp⟩ + · rintro ⟨hx, hxq⟩ + exact ⟨hx, (hKpq hx).resolve_left hxq⟩ + rw [this] + exact hKc.diff d.discp.1 + -- Two points of the boundary of the disc. + have hI₁ : Complex.I ∈ sphere (0 : ℂ) 1 := by simp + have hI₂ : -Complex.I ∈ sphere (0 : ℂ) 1 := by simp + have hnotint : ∀ {z}, z ∈ sphere (0 : ℂ) 1 → G z ∉ discInt c.disc := by + intro z hz hin + have := hin.2 + rw [c.discBd_eq] at this + exact this (mem_image_of_mem G hz) + have hwp : G (-Complex.I) ∈ p := hlo ⟨_, ⟨sphere_subset_closedBall hI₂, by simp⟩, rfl⟩ + have hwq : G Complex.I ∈ q := hup ⟨_, ⟨sphere_subset_closedBall hI₁, by simp⟩, rfl⟩ + have hrp : ∀ z ∈ closedBall (0 : ℂ) 1, 0 ≤ z.im → G z ∉ p := by + intro z hz him hzp + rcases him.lt_or_eq with h | h + · exact disjoint_left.mp d.pq_dis hzp (hup ⟨z, ⟨hz, h⟩, rfl⟩) + · obtain ⟨y, -, hy⟩ : G z ∈ γ '' Icc a b := c.closed_eq ▸ mem_image_of_mem G ⟨hz, h.symm⟩ + exact d.notMem_p y (hy ▸ hzp) + obtain ⟨ℓ, hℓ, h0, h1, hinj, hbd, hT, hTne⟩ := c.lower_data hlo hrp + obtain ⟨ρ₁, hW₁, hρ₁, hCρ₁, hint₁, hbd₁⟩ := exists_absorb hS d.discp c.isClosedDisc hℓ h0 h1 hinj + hbd + hT hTne (C := insert (G (-Complex.I)) ((F \ discInt c.disc) ∩ p)) (hKp.insert _) + (insert_subset hwp inter_subset_right) + (disjoint_left.mpr (by + rintro x (rfl | hx) + · exact hnotint hI₂ + · exact hx.1.2)) (insert_nonempty _ _) + have hρ₁q : ∀ {x}, x ∈ q → x ∉ ρ₁ := fun hx h => disjoint_left.mp d.pq_dis (hρ₁ h) hx + have hbq : discBd (c.disc ∪ ρ₁) ∩ q = discBd c.disc ∩ q := by + ext x + constructor + · rintro ⟨hx, hxq⟩ + refine ⟨?_, hxq⟩ + by_contra hn + have hxN : x ∈ c.disc := by + rcases discBd_subset _ hx with h | h + · exact h + · exact absurd h (hρ₁q hxq) + have : x ∈ discInt (c.disc ∪ ρ₁) := discInt_mono hman c.isClosedDisc subset_union_left ⟨hxN, + hn⟩ + exact this.2 hx + · rintro ⟨hx, hxq⟩ + exact ⟨hbd₁ x (hρ₁q hxq) hx, hxq⟩ + have hiq : discInt (c.disc ∪ ρ₁) ∩ q = discInt c.disc ∩ q := by + ext x + constructor + · rintro ⟨hx, hxq⟩ + exact ⟨(hint₁ hx).resolve_left (hρ₁q hxq), hxq⟩ + · rintro ⟨hx, hxq⟩ + exact ⟨discInt_mono hman c.isClosedDisc subset_union_left hx, hxq⟩ + have hrq : ∀ z ∈ closedBall (0 : ℂ) 1, 0 ≤ z.im → (fun z => G ((starRingEnd ℂ) z)) z ∉ q := by + intro z hz him hzq + rcases him.lt_or_eq with h | h + · exact disjoint_left.mp d.pq_dis + (hlo ⟨(starRingEnd ℂ) z, ⟨by simpa using hz, by simpa using h⟩, rfl⟩) hzq + · have hz' : (starRingEnd ℂ) z = z := Complex.conj_eq_iff_im.mpr h.symm + obtain ⟨y, -, hy⟩ : G z ∈ γ '' Icc a b := c.closed_eq ▸ mem_image_of_mem G ⟨hz, h.symm⟩ + refine d.notMem_q y ?_ + rw [hy] + simpa only [hz'] using hzq + obtain ⟨ℓ', hℓ', h0', h1', hinj', hbd', hT', hTne'⟩ := + c.conj.lower_data (A := q) (by rw [IsEdgeChart.image_conj_lower]; exact hup) hrq + rw [c.conj_disc] at hbd' hT' hTne' + rw [← hbq] at hbd' + rw [← hiq] at hT' hTne' + obtain ⟨ρ₂, hW₂, hρ₂, hCρ₂, hint₂, -⟩ := exists_absorb hS d.discq hW₁ hℓ' h0' h1' hinj' hbd' + hT' hTne' (C := insert (G Complex.I) ((F \ discInt c.disc) ∩ q)) (hKq.insert _) + (insert_subset hwq inter_subset_right) + (disjoint_left.mpr (by + rintro x hx hin + have hxq : x ∈ q := by + rcases hx with rfl | hx + · exact hwq + · exact hx.2 + have hin' : x ∈ discInt c.disc := (hiq.subset ⟨hin, hxq⟩).1 + rcases hx with rfl | hx + · exact hnotint hI₁ hin' + · exact hx.1.2 hin')) (insert_nonempty _ _) + refine exists_bound_in hW₂ hF ?_ ?_ hFY + · intro x hx + by_cases hxN : x ∈ discInt c.disc + · exact Or.inl (Or.inl hxN.1) + · rcases hKpq ⟨hx, hxN⟩ with h | h + · exact Or.inl (Or.inr (hCρ₁ (Or.inr ⟨⟨hx, hxN⟩, h⟩))) + · exact Or.inr (hCρ₂ (Or.inr ⟨⟨hx, hxN⟩, h⟩)) + · intro x hx + rw [hYeq] + rcases hint₂ hx with h | h + · exact Or.inl (Or.inr (hρ₂ h)) + · rcases hint₁ h with h' | h' + · exact Or.inl (Or.inl (hρ₁ h')) + · exact Or.inr (hint ▸ h') + +omit [ConnectedSpace S] in +theorem sides (hS : IsClosedSurface S) (c : IsEdgeChart H γ t₀ G a b) (ht₀ : t₀ ∈ Ioo (0 : I) 1) : + (G '' IsEdgeChart.lower ⊆ p ∧ G '' IsEdgeChart.upper ⊆ q) ∨ + (G '' IsEdgeChart.lower ⊆ q ∧ G '' IsEdgeChart.upper ⊆ p) := by + obtain ⟨p₀, hp, q₀, hq, hne, h₁, h₂, h₃, h₄⟩ := d.base + rcases c.sides hS hp hq hne (h₁ (d.mem_e ht₀)) (h₂ (d.mem_e ht₀)) with ⟨a₁, a₂⟩ | ⟨a₁, a₂⟩ + · exact Or.inl ⟨a₁.trans h₃, a₂.trans h₄⟩ + · exact Or.inr ⟨a₁.trans h₄, a₂.trans h₃⟩ + +/-- A short piece of the edge. -/ +theorem zone_start (hS : IsClosedSurface S) (c : IsEdgeChart H γ t₀ G a b) + (ht₀ : t₀ ∈ Ioo (0 : I) 1) : IsOpenDisc (zone p q γ a b) := by + rcases d.sides hS c ht₀ with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact d.zone_start_aux hS c h₁ h₂ + · have heq : zone p q γ a b = zone q p γ a b := by + simp only [zone] + rw [union_comm p q] + rw [heq] + exact d.swap.zone_start_aux hS c h₁ h₂ + +omit d [TopologicalSpace S] [T2Space S] [ConnectedSpace S] in +theorem real_of_sphere {z : ℂ} (hz : z ∈ sphere (0 : ℂ) 1) (him : z.im = 0) : z = 1 ∨ z = -1 := by + have h₁ : ‖z‖ = 1 := mem_sphere_zero_iff_norm.mp hz + have h₂ : z = (z.re : ℂ) := Complex.ext (by simp) (by simp [him]) + rw [h₂, Complex.norm_real, Real.norm_eq_abs] at h₁ + rcases (abs_eq (by norm_num : (0 : ℝ) ≤ 1)).mp h₁ with h | h + · left + rw [h₂, h] + simp + · right + rw [h₂, h] + simp + +omit d [TopologicalSpace S] [T2Space S] [ConnectedSpace S] in +/-- Real points of the open disc are limits of the lower half. -/ +theorem mem_closure_lowerBall {z : ℂ} (hz : z ∈ ball (0 : ℂ) 1) (him : z.im = 0) : + z ∈ closure {w | w ∈ ball (0 : ℂ) 1 ∧ w.im < 0} := by + rw [Metric.mem_closure_iff] + intro ε hε + have hn : ‖z‖ < 1 := by simpa using hz + obtain ⟨δ, hδ, hδε, hδn⟩ : ∃ δ : ℝ, 0 < δ ∧ δ < ε ∧ δ < 1 - ‖z‖ := + ⟨min (ε / 2) ((1 - ‖z‖) / 2), by have : 0 < 1 - ‖z‖ := by linarith + positivity, + (min_le_left _ _).trans_lt (by linarith), (min_le_right _ _).trans_lt (by linarith)⟩ + have hnI : ‖((δ : ℂ) * Complex.I)‖ = δ := by simp [abs_of_pos hδ] + refine ⟨z - δ * Complex.I, ⟨?_, ?_⟩, ?_⟩ + · have := norm_sub_le z ((δ : ℂ) * Complex.I) + rw [hnI] at this + rw [mem_ball, dist_zero_right] + linarith + · simp [him, hδ] + · rw [dist_eq_norm, sub_sub_cancel, hnI] + exact hδε + +omit [ConnectedSpace S] in +private theorem zone_chart_boundary (c : IsEdgeChart H γ t₀ G a b) + {s : I} (hs : s < a) + (hcase : ∀ {z}, z ∈ closedBall (0 : ℂ) 1 → z.im ≠ 0 → G z ∈ p ∪ q) : + ∃ ℓ : I → S, Continuous ℓ ∧ ℓ 0 ∉ zone p q γ s t₀ ∧ ℓ 1 ∉ zone p q γ s t₀ ∧ + InjOn ℓ (Ioo 0 1) ∧ discBd c.disc ∩ zone p q γ s t₀ = ℓ '' Ioo 0 1 := by + have hpqA : p ∪ q ⊆ zone p q γ s t₀ := subset_union_left + have hbb : γ b ∉ zone p q γ s t₀ := d.notMem_zone fun h => lt_asymm h.2 c.right + have haA : γ a ∈ zone p q γ s t₀ := Or.inr ⟨a, ⟨hs, c.left⟩, rfl⟩ + -- The loop along the boundary of the chart, from the far end of the chord. + obtain ⟨e₀, he₀, hGe₀, hGe₁⟩ : ∃ e₀ : ℂ, (e₀ = 1 ∨ e₀ = -1) ∧ G e₀ = γ b ∧ G (-e₀) = γ a := by + rcases c.ends with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact ⟨1, Or.inl rfl, h₂, h₁⟩ + · exact ⟨-1, Or.inr rfl, h₁, by simpa using h₂⟩ + have he₀s : e₀ ∈ sphere (0 : ℂ) 1 := by + rcases he₀ with rfl | rfl <;> simp + have hsO : IsOArc (sphere (0 : ℂ) 1) := oArc_sphere + obtain ⟨P, hPc, hP0, hP1, hPi, hPim, hPr⟩ := exists_oArc_par hsO he₀s + have hPs : ∀ θ, P θ ∈ closedBall (0 : ℂ) 1 := fun θ => sphere_subset_closedBall (hPr ⟨θ, rfl⟩) + have hpi := Real.pi_pos + let ℓ : I → S := fun v => G (P (2 * Real.pi * v.1)) + have hℓ : Continuous ℓ := c.cont.comp_continuous (hPc.comp (by fun_prop)) fun v => hPs _ + have hPne : ∀ {θ}, θ ∈ Ioo 0 (2 * Real.pi) → P θ ≠ e₀ := by + intro θ hθ he + obtain ⟨k, hk⟩ := hPi θ 0 (he.trans hP0.symm) + rw [zero_add] at hk + have h₁ : (0 : ℝ) < k := by + by_contra hc + push Not at hc + nlinarith [hθ.1] + have h₂ : (k : ℝ) < 1 := by + by_contra hc + push Not at hc + nlinarith [hθ.2] + have h₃ : (0 : ℤ) < k := by exact_mod_cast h₁ + have h₄ : k < (1 : ℤ) := by exact_mod_cast h₂ + omega + have hE : ∀ z ∈ sphere (0 : ℂ) 1, z ≠ e₀ → ∃ v ∈ Ioo (0 : I) 1, P (2 * Real.pi * v.1) = z := by + intro z hz hne + obtain ⟨θ, hθ, rfl⟩ : z ∈ P '' Ico 0 (2 * Real.pi) := hPim ▸ hz + have hθ₀ : 0 < θ := lt_of_le_of_ne hθ.1 (by rintro rfl; exact hne hP0) + have hv : θ / (2 * Real.pi) ∈ Ioo (0 : ℝ) 1 := + ⟨by positivity, (div_lt_one (by positivity)).mpr hθ.2⟩ + refine ⟨⟨_, hv.1.le, hv.2.le⟩, ⟨hv.1, hv.2⟩, ?_⟩ + simp only + congr 1 + field_simp + have hthet : ∀ v ∈ Ioo (0 : I) 1, 2 * Real.pi * v.1 ∈ Ioo 0 (2 * Real.pi) := by + intro v hv + have h₁ : (0 : ℝ) < v.1 := hv.1 + have h₂ : v.1 < 1 := hv.2 + constructor <;> nlinarith + have hℓ0 : ℓ 0 ∉ zone p q γ s t₀ := by + simp only [ℓ, Icc.coe_zero, mul_zero, hP0, hGe₀] + exact hbb + have hℓ1 : ℓ 1 ∉ zone p q γ s t₀ := by + simp only [ℓ, Icc.coe_one, mul_one, hP1, hGe₀] + exact hbb + have hℓi : InjOn ℓ (Ioo 0 1) := by + intro v hv w hw h + have h₁ := c.inj (hPs _) (hPs _) h + obtain ⟨k, hk⟩ := hPi _ _ h₁ + have hv₀ := hv.1 + have hv₁ := hv.2 + have hw₀ := hw.1 + have hw₁ := hw.2 + change (0 : ℝ) < v.1 at hv₀ + change v.1 < 1 at hv₁ + change (0 : ℝ) < w.1 at hw₀ + change w.1 < 1 at hw₁ + have h₂ : v.1 = w.1 + k := by + have : 2 * Real.pi * v.1 = 2 * Real.pi * (w.1 + k) := by rw [hk]; ring + exact mul_left_cancel₀ (by positivity) this + have h₃ : (k : ℝ) < 1 := by linarith + have h₄ : (-1 : ℝ) < k := by linarith + have h₅ : k = 0 := by + have a₁ : k < (1 : ℤ) := by exact_mod_cast h₃ + have a₂ : (-1 : ℤ) < k := by exact_mod_cast h₄ + omega + rw [h₅] at h₂ + exact Subtype.ext (by simpa using h₂) + have hbd : discBd c.disc ∩ zone p q γ s t₀ = ℓ '' Ioo 0 1 := by + rw [c.discBd_eq] + ext x + constructor + · rintro ⟨⟨z, hz, rfl⟩, hxA⟩ + have hne : z ≠ e₀ := by + rintro rfl + exact hbb (hGe₀ ▸ hxA) + obtain ⟨v, hv, rfl⟩ := hE z hz hne + exact ⟨v, hv, rfl⟩ + · rintro ⟨v, hv, rfl⟩ + have hzs : P (2 * Real.pi * v.1) ∈ sphere (0 : ℂ) 1 := hPr ⟨_, rfl⟩ + refine ⟨⟨_, hzs, rfl⟩, ?_⟩ + set z := P (2 * Real.pi * v.1) with hz + by_cases him : z.im = 0 + · have hne := hPne (hthet v hv) + rw [← hz] at hne + have hz' : z = -e₀ := by + rcases he₀ with rfl | rfl <;> rcases real_of_sphere hzs him with h | h + · exact absurd h hne + · exact h + · simpa using h + · exact absurd h hne + change G z ∈ _ + rw [hz', hGe₁] + exact haA + · exact hpqA (hcase (sphere_subset_closedBall hzs) him) + exact ⟨ℓ, hℓ, hℓ0, hℓ1, hℓi, hbd⟩ + +/-- **A piece of the edge can be made longer.** -/ +theorem zone_step (hS : IsClosedSurface S) (c : IsEdgeChart H γ t₀ G a b) + (ht₀ : t₀ ∈ Ioo (0 : I) 1) {s : I} (hs : s < a) (hA : IsOpenDisc (zone p q γ s t₀)) : + IsOpenDisc (zone p q γ s b) := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hsides : G '' IsEdgeChart.lower ⊆ p ∪ q ∧ G '' IsEdgeChart.upper ⊆ p ∪ q := by + rcases d.sides hS c ht₀ with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact ⟨h₁.trans subset_union_left, h₂.trans subset_union_right⟩ + · exact ⟨h₁.trans subset_union_right, h₂.trans subset_union_left⟩ + have hpqA : p ∪ q ⊆ zone p q γ s t₀ := subset_union_left + have hcase : ∀ {z}, z ∈ closedBall (0 : ℂ) 1 → z.im ≠ 0 → G z ∈ p ∪ q := by + intro z hz him + rcases IsEdgeChart.cases_of_closedBall hz with h | h | h + · exact hsides.1 ⟨z, h, rfl⟩ + · exact absurd h him + · exact hsides.2 ⟨z, h, rfl⟩ + have hYeq : zone p q γ s b = zone p q γ s t₀ ∪ G '' ball 0 1 := by + apply subset_antisymm + · rintro x (h | ⟨y, hy, rfl⟩) + · exact Or.inl (Or.inl h) + · by_cases hyt : y < t₀ + · exact Or.inl (Or.inr ⟨y, ⟨hy.1, hyt⟩, rfl⟩) + · refine Or.inr ?_ + have : γ y ∈ γ '' Ioo a b := ⟨y, ⟨c.left.trans_le (not_lt.mp hyt), hy.2⟩, rfl⟩ + rw [← c.ball_eq] at this + exact image_mono (Set.sep_subset _ _) this + · refine union_subset (zone_mono _ _ _ _ (c.right.le)) ?_ + rintro _ ⟨z, hz, rfl⟩ + by_cases him : z.im = 0 + · have : G z ∈ γ '' Ioo a b := c.ball_eq ▸ mem_image_of_mem G ⟨hz, him⟩ + obtain ⟨y, hy, he⟩ := this + exact Or.inr ⟨y, ⟨hs.trans hy.1, hy.2⟩, he⟩ + · exact Or.inl (hcase (ball_subset_closedBall hz) him) + have hop : IsOpen (zone p q γ s b) := by + rw [hYeq] + exact hA.1.union (c.isOpen_image_ball hS) + refine isOpenDisc_of_bound hS hop (d.zone_isConnected ((hs.trans c.left).trans c.right)) + (d.zone_ne_univ _ _) ?_ + intro F hFY hF + have hbN : IsOpen (discInt c.disc) := c.isClosedDisc.isOpen_discInt hman + have hint := c.discInt_eq + obtain ⟨ℓ, hℓ, hℓ0, hℓ1, hℓi, hbd⟩ := d.zone_chart_boundary c hs hcase + -- The inside of the chart in `A`. + let Bl : Set ℂ := {z | z ∈ ball (0 : ℂ) 1 ∧ z.im < 0} + let Bu : Set ℂ := {z | z ∈ ball (0 : ℂ) 1 ∧ 0 < z.im} + have hTeq : discInt c.disc ∩ zone p q γ s t₀ = (G '' Bl ∪ γ '' Ioo a t₀) ∪ + (G '' Bu ∪ γ '' Ioo a t₀) := by + rw [hint] + ext x + constructor + · rintro ⟨⟨z, hz, rfl⟩, hxA⟩ + rcases lt_trichotomy z.im 0 with h | h | h + · exact Or.inl (Or.inl ⟨z, ⟨hz, h⟩, rfl⟩) + · obtain ⟨y, hy, he⟩ : G z ∈ γ '' Ioo a b := c.ball_eq ▸ mem_image_of_mem G ⟨hz, h⟩ + refine Or.inl (Or.inr ⟨y, ⟨hy.1, ?_⟩, he⟩) + by_contra hn + exact d.notMem_zone (fun h' => hn h'.2) (he ▸ hxA) + · exact Or.inr (Or.inl ⟨z, ⟨hz, h⟩, rfl⟩) + · rintro ((⟨z, hz, rfl⟩ | ⟨y, hy, rfl⟩) | (⟨z, hz, rfl⟩ | ⟨y, hy, rfl⟩)) + · exact ⟨⟨z, hz.1, rfl⟩, hpqA (hcase (ball_subset_closedBall hz.1) hz.2.ne)⟩ + · have : γ y ∈ γ '' Ioo a b := ⟨y, ⟨hy.1, hy.2.trans c.right⟩, rfl⟩ + rw [← c.ball_eq] at this + exact ⟨image_mono (Set.sep_subset _ _) this, Or.inr ⟨y, ⟨hs.trans hy.1, hy.2⟩, rfl⟩⟩ + · exact ⟨⟨z, hz.1, rfl⟩, hpqA (hcase (ball_subset_closedBall hz.1) hz.2.ne')⟩ + · have : γ y ∈ γ '' Ioo a b := ⟨y, ⟨hy.1, hy.2.trans c.right⟩, rfl⟩ + rw [← c.ball_eq] at this + exact ⟨image_mono (Set.sep_subset _ _) this, Or.inr ⟨y, ⟨hs.trans hy.1, hy.2⟩, rfl⟩⟩ + have hBlc : IsPreconnected (G '' Bl) := + (((convex_ball _ _).inter (convex_halfSpace_im_lt 0)).isPreconnected).image _ + (c.cont.mono fun _ h => ball_subset_closedBall h.1) + have hBuc : IsPreconnected (G '' Bu) := + (((convex_ball _ _).inter (convex_halfSpace_im_gt 0)).isPreconnected).image _ + (c.cont.mono fun _ h => ball_subset_closedBall h.1) + have hclosure : ∀ X : Set ℂ, X ⊆ ball 0 1 → (∀ z ∈ ball (0 : ℂ) 1, z.im = 0 → z ∈ closure X) → + γ '' Ioo a t₀ ⊆ closure (G '' X) := by + intro X hX hcl x hx + obtain ⟨y, hy, rfl⟩ := hx + have hmem : γ y ∈ γ '' Ioo a b := ⟨y, ⟨hy.1, hy.2.trans c.right⟩, rfl⟩ + rw [← c.ball_eq] at hmem + obtain ⟨z, ⟨hz, him⟩, he⟩ := hmem + rw [← he] + have hcont : ContinuousOn G (closure X) := c.cont.mono + (closure_minimal (hX.trans ball_subset_closedBall) isClosed_closedBall) + exact hcont.image_closure ⟨z, hcl z hz him, rfl⟩ + have hBlγ : IsPreconnected (G '' Bl ∪ γ '' Ioo a t₀) := + hBlc.subset_closure subset_union_left (union_subset subset_closure + (hclosure _ (fun _ h => h.1) fun z hz him => mem_closure_lowerBall hz him)) + have hBuγ : IsPreconnected (G '' Bu ∪ γ '' Ioo a t₀) := by + refine hBuc.subset_closure subset_union_left (union_subset subset_closure + (hclosure _ (fun _ h => h.1) fun z hz him => ?_)) + have h₁ : (starRingEnd ℂ) z ∈ closure Bl := by + apply mem_closure_lowerBall (by simpa using hz) + simpa using him + have h₂ : Continuous (starRingEnd ℂ : ℂ → ℂ) := Complex.continuous_conj + have h₃ := image_closure_subset_closure_image h₂ (mem_image_of_mem _ h₁) + have h₄ : (starRingEnd ℂ : ℂ → ℂ) '' Bl = Bu := by + ext w + constructor + · rintro ⟨y, hy, rfl⟩ + exact ⟨by simpa using hy.1, by simpa using hy.2⟩ + · intro hw + exact ⟨(starRingEnd ℂ) w, ⟨by simpa using hw.1, by simpa using hw.2⟩, by simp⟩ + rw [h₄] at h₃ + simpa using h₃ + obtain ⟨m, hm⟩ : (Ioo a t₀).Nonempty := by + refine ⟨⟨(a.1 + t₀.1) / 2, ?_, ?_⟩, ?_, ?_⟩ + · have := a.2.1 + have := t₀.2.1 + linarith + · have := a.2.2 + have := t₀.2.2 + linarith + · exact show a.1 < (a.1 + t₀.1) / 2 by have : a.1 < t₀.1 := c.left; linarith + · exact show (a.1 + t₀.1) / 2 < t₀.1 by have : a.1 < t₀.1 := c.left; linarith + have hT : IsPreconnected (discInt c.disc ∩ zone p q γ s t₀) := by + rw [hTeq] + exact hBlγ.union (γ m) (Or.inr (mem_image_of_mem γ hm)) (Or.inr (mem_image_of_mem γ hm)) hBuγ + have hTne : (discInt c.disc ∩ zone p q γ s t₀).Nonempty := by + rw [hTeq] + exact ⟨γ m, Or.inl (Or.inr (mem_image_of_mem γ hm))⟩ + -- Now the closed disc around `F`. + have hI₁ : Complex.I ∈ sphere (0 : ℂ) 1 := by simp + have hwA : G Complex.I ∈ zone p q γ s t₀ := + hpqA (hsides.2 ⟨_, ⟨sphere_subset_closedBall hI₁, by simp⟩, rfl⟩) + have hwb : G Complex.I ∉ discInt c.disc := by + intro hin + have := hin.2 + rw [c.discBd_eq] at this + exact this (mem_image_of_mem G hI₁) + have hFA : F \ discInt c.disc ⊆ zone p q γ s t₀ := by + rintro x ⟨hxF, hxN⟩ + have := hFY hxF + rw [hYeq] at this + rcases this with h | h + · exact h + · exact absurd (hint ▸ h) hxN + obtain ⟨ρ, hW, hρ, hCρ, hint', -⟩ := exists_absorb hS hA c.isClosedDisc hℓ hℓ0 hℓ1 hℓi hbd hT hTne + (C := insert (G Complex.I) (F \ discInt c.disc)) ((hF.isCompact.diff hbN).insert _) + (insert_subset hwA hFA) + (disjoint_left.mpr (by + rintro x (rfl | hx) + · exact hwb + · exact hx.2)) (insert_nonempty _ _) + refine exists_bound_in hW hF ?_ ?_ hFY + · intro x hx + by_cases hxN : x ∈ discInt c.disc + · exact Or.inl hxN.1 + · exact Or.inr (hCρ (Or.inr ⟨hx, hxN⟩)) + · intro x hx + rw [hYeq] + rcases hint' hx with h | h + · exact Or.inl (hρ h) + · exact Or.inr (hint ▸ h) + +/-- A limit of pieces. -/ +theorem zone_limit (hS : IsClosedSurface S) {s t : I} {T : Set I} (hst : s < t) + (hT : ∀ x ∈ T, IsOpenDisc (zone p q γ s x)) (hle : ∀ x ∈ T, x ≤ t) + (hsup : ∀ y < t, ∃ x ∈ T, y < x) : IsOpenDisc (zone p q γ s t) := by + obtain ⟨y₀, -⟩ : ∃ y, y < t := ⟨s, hst⟩ + obtain ⟨x₀, hx₀, -⟩ := hsup s hst + have hcov : zone p q γ s t ⊆ ⋃ x : T, zone p q γ s x.1 := by + rintro y (h | ⟨u, hu, rfl⟩) + · exact mem_iUnion.mpr ⟨⟨x₀, hx₀⟩, Or.inl h⟩ + · obtain ⟨x, hx, hux⟩ := hsup u hu.2 + exact mem_iUnion.mpr ⟨⟨x, hx⟩, Or.inr ⟨u, ⟨hu.1, hux⟩, rfl⟩⟩ + have hsubu : ⋃ x : T, zone p q γ s x.1 = zone p q γ s t := + subset_antisymm (iUnion_subset fun x => zone_mono _ _ _ _ (hle _ x.2)) hcov + have hop : IsOpen (zone p q γ s t) := by + rw [← hsubu] + exact isOpen_iUnion fun x => (hT _ x.2).1 + refine isOpenDisc_of_bound hS hop (d.zone_isConnected hst) (d.zone_ne_univ _ _) ?_ + intro F hFY hF + have : Nonempty T := ⟨⟨x₀, hx₀⟩⟩ + have hdir : Directed (· ⊆ ·) fun x : T => zone p q γ s x.1 := by + intro x y + rcases le_total x.1 y.1 with h | h + · exact ⟨y, zone_mono _ _ _ _ h, Subset.rfl⟩ + · exact ⟨x, Subset.rfl, zone_mono _ _ _ _ h⟩ + obtain ⟨x, hx⟩ := hF.isCompact.elim_directed_cover _ (fun x => (hT _ x.2).1) (hFY.trans hcov) hdir + obtain ⟨Δ, hΔ, hd, hb⟩ := exists_disc_in_openDisc (hT _ x.2) hF hx + exact ⟨Δ, hΔ.trans (zone_mono _ _ _ _ (hle _ x.2)), hd, hb⟩ + +/-- **The piece reaches the end of the edge.** -/ +theorem zone_right (hS : IsClosedSurface S) {s t : I} (hst : s < t) + (hA : IsOpenDisc (zone p q γ s t)) : IsOpenDisc (zone p q γ s 1) := by + let T : Set I := {x | s < x ∧ IsOpenDisc (zone p q γ s x)} + have hne : (closure T).Nonempty := ⟨t, subset_closure ⟨hst, hA⟩⟩ + obtain ⟨m, hmc, hgr⟩ := isClosed_closure.isCompact.exists_isGreatest hne + have hle : ∀ x ∈ T, x ≤ m := fun x hx => hgr (subset_closure hx) + have htm : t ≤ m := hle t ⟨hst, hA⟩ + have hsm : s < m := hst.trans_le htm + have hsup : ∀ y < m, ∃ x ∈ T, y < x := by + intro y hy + obtain ⟨x, hx₁, hx₂⟩ := mem_closure_iff.mp hmc _ isOpen_Ioi hy + exact ⟨x, hx₂, hx₁⟩ + have hm : IsOpenDisc (zone p q γ s m) := d.zone_limit hS hsm (fun x (hx : x ∈ T) => hx.2) hle hsup + by_cases hm1 : m = 1 + · exact hm1 ▸ hm + have hm₀ : m ∈ Ioo (0 : I) 1 := + ⟨lt_of_le_of_lt (unitInterval.nonneg s) hsm, unitInterval.lt_one_iff_ne_one.mpr hm1⟩ + obtain ⟨G, a, b, h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈, h₉, h₁₀, h₁₁⟩ := + exists_edge_chart hS H d.he d.cont d.zero d.one d.inj d.image hm₀ hsm hm₀.2 + have c : IsEdgeChart H γ m G a b := ⟨h₁, h₂, h₄, h₅, h₇, h₈, h₉, h₁₀, h₁₁⟩ + have hb : IsOpenDisc (zone p q γ s b) := d.zone_step hS c hm₀ h₃ hm + exact absurd (hle b ⟨(h₃.trans h₄).trans h₅, hb⟩) (not_le.mpr h₅) + +end GlueData + +/-- **Two open discs across an edge.** Let `e` be an edge of a drawing `H` in a closed connected +surface. +Let `p₀ ≠ q₀` be regions of `H` with `e` in both closures. Let `p ⊇ p₀` and `q ⊇ q₀` be disjoint +open +discs that miss the closure of `e`. Then `p ∪ q ∪ e` is an open disc. -/ +theorem glue_open_discs [ConnectedSpace S] (hS : IsClosedSurface S) {H : Drawing S} {e p q p₀ q₀ : + Set S} + (he : e ∈ H.E) (hp₀ : p₀ ∈ H.R) (hq₀ : q₀ ∈ H.R) (hne : p₀ ≠ q₀) (hcp : e ⊆ closure p₀) + (hcq : e ⊆ closure q₀) (hsp : p₀ ⊆ p) (hsq : q₀ ⊆ q) (hdp : IsOpenDisc p) (hdq : IsOpenDisc q) + (hpq : Disjoint p q) (hpe : Disjoint p (closure e)) (hqe : Disjoint q (closure e)) : + IsOpenDisc (p ∪ q ∪ e) := by + have hT2 : T2Space S := hS.2.1 + obtain ⟨γ, hγ, h0, h1, hinj, hγe⟩ := exists_edge_param H he + have hcl : ∀ t, γ t ∈ closure e := by + intro t + have h₁ : range γ ⊆ closure (γ '' Ioo 0 1) := by + have : (univ : Set I) ⊆ closure (Ioo (0 : I) 1) := by + rw [closure_Ioo (zero_ne_one' I)] + exact fun x _ => ⟨unitInterval.nonneg x, unitInterval.le_one x⟩ + rintro _ ⟨t, rfl⟩ + exact image_closure_subset_closure_image hγ ⟨t, this (mem_univ t), rfl⟩ + exact hγe ▸ h₁ ⟨t, rfl⟩ + have d : GlueData H e γ p q := ⟨he, hγ, h0, h1, hinj, hγe, ⟨p₀, hp₀, q₀, hq₀, hne, hcp, hcq, hsp, + hsq⟩, + hdp, hdq, hpq, fun t ht => disjoint_left.mp hpe ht (hcl t), fun t ht => disjoint_left.mp hqe ht + (hcl t)⟩ + let t₀ : I := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht₀ : t₀ ∈ Ioo (0 : I) 1 := ⟨show (0 : ℝ) < 1 / 2 by norm_num, show + (1 / 2 : ℝ) < 1 by norm_num⟩ + obtain ⟨G, a, b, g₁, g₂, g₃, g₄, g₅, g₆, g₇, g₈, g₉, g₁₀, g₁₁⟩ := + exists_edge_chart hS H he hγ h0 h1 hinj hγe ht₀ ht₀.1 ht₀.2 + have c : IsEdgeChart H γ t₀ G a b := ⟨g₁, g₂, g₄, g₅, g₇, g₈, g₉, g₁₀, g₁₁⟩ + have hab : a < b := g₄.trans g₅ + have hstart := d.zone_start hS c ht₀ + have hright := d.zone_right hS hab hstart + have hsym : unitInterval.symm 1 < unitInterval.symm a := by + rw [GlueData.symm_lt_symm] + exact g₄.trans ht₀.2 + have hr' : IsOpenDisc (zone p q (γ ∘ unitInterval.symm) (unitInterval.symm 1) + (unitInterval.symm a)) := by + rw [GlueData.zone_reverse, symm_symm, symm_symm] + exact hright + have hall := d.reverse.zone_right hS hsym hr' + rw [GlueData.zone_reverse, symm_symm, symm_one] at hall + have heq : zone p q γ 0 1 = p ∪ q ∪ e := by + simp only [zone] + rw [hγe] + exact heq ▸ hall + +/-- **The union of two regions across an edge.** Let `e` be an edge of a drawing in a closed +connected +surface. Let `p ≠ q` be regions with `e` in both closures, and suppose both are open discs. Then +`p ∪ q ∪ e` is an open disc. -/ +theorem theorem_glue_regions [ConnectedSpace S] (hS : IsClosedSurface S) {H : Drawing S} {e p q : + Set S} + (he : e ∈ H.E) (hp : p ∈ H.R) (hq : q ∈ H.R) (hpq : p ≠ q) (hdp : IsOpenDisc p) + (hdq : IsOpenDisc q) + (hcp : e ⊆ closure p) (hcq : e ⊆ closure q) : IsOpenDisc (p ∪ q ∪ e) := by + have hdis : ∀ r ∈ H.R, Disjoint r (closure e) := fun r hr => + disjoint_left.mpr fun x hx h => region_subset hr hx (H.closure_subset_U he h) + exact glue_open_discs hS he hp hq hpq hcp hcq Subset.rfl Subset.rfl hdp hdq + (disjoint_left.mpr fun x hx hx' => hpq (region_eq_of_mem hp hq hx hx')) (hdis p hp) (hdis q hq) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/HubCollar.lean b/LeanPool/GraphMinor/GM11/HubCollar.lean new file mode 100644 index 0000000000..c9c6e9247c --- /dev/null +++ b/LeanPool/GraphMinor/GM11/HubCollar.lean @@ -0,0 +1,680 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.HubCycle +public import LeanPool.GraphMinor.GM11.Cylinder + +/-! +# A collar of the frontier of a region + +Let `Γ` be a 2-cell drawing in a sphere with no loop, `Γ'` a radial drawing of `Γ`, and `r` a region +of `Γ` +with vertex `c`. The corners at `c`, in their cyclic order, are closed discs with three sides. +Coordinates +on them (`exists_square_chart`) that agree on the spokes form a map on the cylinder +(`exists_cylinder`), +which runs along the frontier of `r` at height `0` and is injective on the rest +(`exists_hub_collar`). +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- What the corners at the vertex of a region give. Here `v i`, `a i`, `s i`, `P i` are the `i`-th +vertex +of the frontier of `r`, edge of the frontier, spoke, and region of `Γ ∪ Γ'`, and these repeat with +period +`n`. The map `ε i` runs along the closure of `a i`, and `h` is the collar. -/ +structure IsHubCollar (Γ Γ' H : Drawing S) (r : Set S) (n : ℕ) (v : ℕ → S) (a s P : ℕ → Set S) + (ε : ℕ → I → S) (h : C(Circle × I, S)) : Prop where + two_le : 2 ≤ n + per_v : ∀ i, v (i + n) = v i + per_a : ∀ i, a (i + n) = a i + per_s : ∀ i, s (i + n) = s i + per_P : ∀ i, P (i + n) = P i + per_ε : ∀ i, ε (i + n) = ε i + edge : ∀ i, a i ∈ Γ.E + vertex : ∀ i, v i ∈ Γ.V + cap : ∀ i, closure (a i) ∩ Γ.V = {v i, v (i + 1)} + ne : ∀ i, v i ≠ v (i + 1) + spoke : ∀ i, s i ∈ Γ'.E + spoke_cap : ∀ i, ∃ c ∈ r, closure (s i) ∩ Γ'.V = {v i, c} + region : ∀ i, P i ∈ H.R + region_sub : ∀ i, P i ⊆ r + edge_cl : ∀ i, a i ⊆ closure (P i) + spoke_cl : ∀ i, s i ⊆ closure (P i) ∧ s (i + 1) ⊆ closure (P i) + inj : ∀ i j, i < n → j < n → P i = P j → i = j + all : ∀ p ∈ H.R, p ⊆ r → ∃ i, i < n ∧ p = P i + ε_cont : ∀ i, Continuous (ε i) + ε_inj : ∀ i, Function.Injective (ε i) + ε_zero : ∀ i, ε i 0 = v i + ε_one : ∀ i, ε i 1 = v (i + 1) + ε_range : ∀ i, range (ε i) = closure (a i) + bottom : ∀ i, i < n → ∀ u : I, h (Circle.exp (2 * Real.pi * ((i + u.1) / n)), 0) = ε i u + injOn : InjOn h {p | 0 < p.2} + mem_r : ∀ p : Circle × I, 0 < p.2 → h p ∈ r + range_bottom : range (fun z : Circle => h (z, 0)) = frontier r + isOpen : IsOpen (rᶜ ∪ h '' {p | p.2 < 1}) + +variable {Γ Γ' : Drawing S} + +omit [ConnectedSpace S] in +/-- Two half-edges at the vertex of a region with the same spoke are equal. -/ +theorem half_unique (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') (hS : IsClosedSurface S) + {γ : Set S → I → S} (hγ : EdgePar (radialUnion hrad) γ) {r : Set S} + (hr : r ∈ Γ.R) {c : S} (hc : c ∈ r) (hcV : c ∈ Γ'.V) {k k' : halfEdges (radialUnion hrad) γ c} + (h : k.1.1 = k'.1.1) : k = k' := by + have hs : k.1.1 ∈ Γ'.E := hub_half_spoke hrad hr hc k hγ + have hcs : c ∈ closure k.1.1 := by + have := end_mem_closure hγ k.2.1 k.1.2 + rwa [k.2.2] at this + obtain ⟨a, ha, hcap⟩ := spoke_end hrad hS hr hc hcV hs hcs + have hac : a ≠ c := fun h => region_subset hr hc (Γ.V_subset_U (h ▸ ha)) + have ham : a ∈ closure k.1.1 ∩ Γ'.V := by rw [hcap]; simp + have haH : a ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact ham.2 + obtain ⟨b, hb⟩ := exists_end_eq hγ k.2.1 haH ham.1 + apply Subtype.ext + refine Prod.ext h ?_ + by_contra hbb + have h₁ : γ k.1.1 (endOf k.1.2) = c := k.2.2 + have h₂ : γ k.1.1 (endOf k'.1.2) = c := by + rw [h] + exact k'.2.2 + have : b = k.1.2 ∨ b = k'.1.2 := by + cases b <;> cases hk : k.1.2 <;> cases hk' : k'.1.2 <;> simp_all + rcases this with rfl | rfl + · exact hac (hb.symm.trans h₁) + · exact hac (hb.symm.trans h₂) + +omit [ConnectedSpace S] in +private theorem half_height_collar {r : Set S} (H₀ : C(Circle × I, S)) {c : S} + (hbotU : ∀ z, H₀ (z, 0) ∉ r) (hHc : ∀ z, H₀ (z, 1) = c) + (hpos' : ∀ {p : Circle × I}, 0 < p.2 → H₀ p ∈ r) + (hinjH : InjOn H₀ {p | 0 < p.2 ∧ p.2 < 1}) + (hcover : ∀ z ∈ r, ∃ p : Circle × I, 0 < p.2 ∧ H₀ p = z) + (havoid : ∀ p : Circle × I, 0 < p.2 → p.2 < 1 → H₀ p ≠ c) : + ∃ hh : C(Circle × I, S), (∀ z, hh (z, 0) = H₀ (z, 0)) ∧ + InjOn hh {p | 0 < p.2} ∧ (∀ p : Circle × I, 0 < p.2 → hh p ∈ r) ∧ + IsOpen (rᶜ ∪ hh '' {p | p.2 < 1}) := by + have isCompact_closed_set : IsCompact {p : Circle × I | (1 / 2 : ℝ) ≤ p.2.1} := + (isClosed_le continuous_const (continuous_subtype_val.comp continuous_snd)).isCompact + let hh : C(Circle × I, S) := ⟨fun p => H₀ (p.1, halfT p.2), by + refine H₀.continuous.comp (continuous_fst.prodMk ?_) + refine Continuous.subtype_mk ?_ _ + exact (continuous_subtype_val.comp continuous_snd).div_const 2⟩ + have hhalf0 : ∀ t : I, 0 < t → 0 < halfT t := fun t ht => by + change (0 : ℝ) < t.1 / 2 + have : (0 : ℝ) < t.1 := ht + positivity + have hhalf1 : ∀ t : I, halfT t < 1 := fun t => by + change t.1 / 2 < 1 + have := t.2.2 + linarith + have hhz : ∀ z, hh (z, 0) = H₀ (z, 0) := fun z => by + change H₀ (z, halfT 0) = _ + congr 2 + exact Subtype.ext (by simp [halfT]) + have hzero' : ∀ {p : Circle × I}, H₀ p ∈ r → 0 < p.2 := by + rintro ⟨z, t⟩ hm + by_contra hnot + have ht : t = 0 := le_antisymm (not_lt.mp hnot) (unitInterval.nonneg t) + exact hbotU z (ht ▸ hm) + have hcompl : (rᶜ ∪ hh '' {p | p.2 < 1})ᶜ = H₀ '' {p | (1 / 2 : ℝ) ≤ p.2.1} := by + ext x + constructor + · intro hx + have hxr : x ∈ r := by + by_contra h + exact hx (Or.inl h) + obtain ⟨p, hp, rfl⟩ := hcover x hxr + refine ⟨p, ?_, rfl⟩ + by_contra hlt + have hlt' : p.2.1 < 1 / 2 := not_le.mp hlt + refine hx (Or.inr ⟨(p.1, ⟨2 * p.2.1, by have := p.2.2.1; positivity, by linarith⟩), ?_, ?_⟩) + · change 2 * p.2.1 < 1 + linarith + · change H₀ (p.1, halfT _) = H₀ p + congr 1 + refine Prod.ext rfl (Subtype.ext ?_) + simp [halfT] + · rintro ⟨p, hp, rfl⟩ (hcase | ⟨q, hq, hqe⟩) + · have hp0 : 0 < p.2 := by + change (0 : ℝ) < p.2.1 + have : (1 / 2 : ℝ) ≤ p.2.1 := hp + linarith + exact hcase (hpos' hp0) + · have hp0 : 0 < p.2 := by + change (0 : ℝ) < p.2.1 + have : (1 / 2 : ℝ) ≤ p.2.1 := hp + linarith + have hm : H₀ (q.1, halfT q.2) ∈ r := by + have : H₀ (q.1, halfT q.2) = H₀ p := hqe + rw [this] + exact hpos' hp0 + have hq0 : 0 < halfT q.2 := hzero' (p := (q.1, halfT q.2)) hm + have hlt : (halfT q.2).1 < 1 / 2 := by + have : q.2.1 < 1 := hq + change q.2.1 / 2 < 1 / 2 + linarith + by_cases hp1 : p.2 < 1 + · have heq := hinjH (x₁ := (q.1, halfT q.2)) (x₂ := p) ⟨hq0, hhalf1 _⟩ ⟨hp0, hp1⟩ hqe + have : (1 / 2 : ℝ) ≤ p.2.1 := hp + rw [← heq] at this + have h₂ : (1 / 2 : ℝ) ≤ (halfT q.2).1 := this + linarith + · have hp1' : p.2 = 1 := le_antisymm (unitInterval.le_one _) (not_lt.mp hp1) + obtain ⟨z, t⟩ := p + simp only at hp1' + subst hp1' + have hqc : H₀ (q.1, halfT q.2) = c := hqe.trans (hHc z) + exact havoid ⟨q.1, halfT q.2⟩ hq0 (hhalf1 _) hqc + refine ⟨hh, hhz, ?_, ?_, ?_⟩ + · rintro ⟨z, t⟩ ht ⟨z', t'⟩ ht' heq + have hpt := hinjH (x₁ := (z, halfT t)) (x₂ := (z', halfT t')) ⟨hhalf0 _ ht, hhalf1 _⟩ + ⟨hhalf0 _ ht', hhalf1 _⟩ heq + have h₁ : z = z' := congrArg Prod.fst hpt + have h₂ : halfT t = halfT t' := congrArg Prod.snd hpt + have h₃ : t.1 / 2 = t'.1 / 2 := congrArg Subtype.val h₂ + subst h₁ + exact Prod.ext rfl (Subtype.ext (by linarith)) + · intro p hp + exact hpos' (p := (p.1, halfT p.2)) (hhalf0 _ hp) + · rw [← isClosed_compl_iff, hcompl] + exact (isCompact_closed_set.image H₀.continuous).isClosed + +omit [ConnectedSpace S] in +private theorem corner_charts_cover_region (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') + (hS : IsClosedSurface S) {r : Set S} (hr : r ∈ Γ.R) {c : S} (hc : c ∈ r) (hcV : c ∈ Γ'.V) + {γ : Set S → I → S} (hγ : EdgePar (radialUnion hrad) γ) (hcH : c ∈ (radialUnion hrad).V) : + let K := halfEdges (radialUnion hrad) γ c + ∀ {next : K → K} {ρ : K → Set S}, IsCorners (radialUnion hrad) γ c next ρ → + ∀ {A : K → S} {E' : K → Set S} {sp ε₀ : K → I → S} {G : K → I × I → S}, + (∀ k, A k ∈ Γ.V) → (∀ k, E' k ∈ Γ.E) → + (∀ k, range (sp k) = closure k.1.1) → (∀ k, sp k 0 = A k) → (∀ k, sp k 1 = c) → + (∀ k, range (ε₀ k) = closure (E' k)) → (∀ k, range (G k) = closure (ρ k)) → + (∀ k t, G k (0, t) = sp k t) → (∀ k u, G k (u, 0) = ε₀ k u) → + Nonempty K → ∀ {n : ℕ} {κ : ℕ → K} {H₀ : C(Circle × I, S)}, + (∀ k, ∃ i, i < n ∧ κ i = k) → + (∀ i, i < n → ∀ u t : I, H₀ (Circle.exp (2 * Real.pi * ((i + u.1) / n)), t) = G (κ i) (u, t)) → + ∀ z ∈ r, ∃ p : Circle × I, 0 < p.2 ∧ H₀ p = z := by + intro K next ρ hcor A E' sp ε₀ G hA hE' hspR hspZ hspO hεr hGr' hGl hGb hK n κ H₀ hκall hH₀ + obtain ⟨k₀⟩ := hK + intro z hz + have hup : ∀ (k : halfEdges (radialUnion hrad) γ c) (q : I × I), 0 < q.2 → G k q = z → + ∃ p : Circle × I, 0 < p.2 ∧ H₀ p = z := by + intro k q hq hG + obtain ⟨i, hi, rfl⟩ := hκall k + exact ⟨(Circle.exp (2 * Real.pi * ((i + q.1.1) / n)), q.2), hq, by rw [hH₀ i hi q.1 q.2]; exact + hG⟩ + have hzΓ : z ∉ Γ.U := region_subset hr hz + by_cases hzH : z ∈ (radialUnion hrad).U + · have hzU' : z ∈ Γ'.U := hzH.resolve_left hzΓ + by_cases hzV : z ∈ Γ'.V + · obtain rfl : z = c := hub_unique hrad hr hc hcV hz hzV + exact hup k₀ (0, 1) one_pos (by rw [hGl, hspO]) + · rw [Γ'.U_eq] at hzU' + rcases hzU' with h | h + · exact (hzV h).elim + obtain ⟨g', hg', hzg'⟩ := mem_iUnion₂.mp h + have hzg : z ∈ g' := Γ'.closure_diff_V hg' ▸ ⟨hzg', hzV⟩ + have hcg := (spoke_in_region hrad hS hr hc hcV hg' hzg hz).1 + have hgH : g' ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inr hg' + obtain ⟨b, hb⟩ := exists_end_eq hγ hgH hcH hcg + let k : halfEdges (radialUnion hrad) γ c := ⟨(g', b), hgH, hb⟩ + have hzr : z ∈ range (sp k) := hspR k ▸ hzg' + obtain ⟨t, rfl⟩ := hzr + refine hup k (0, t) (lt_of_le_of_ne (unitInterval.nonneg t) ?_) (hGl k t) + rintro rfl + exact hzΓ (by + rw [hspZ] + exact Γ.V_subset_U (hA k)) + · obtain ⟨p, hp, hzp⟩ := exists_region_of_notMem hzH + have hpr : p ⊆ r := by + obtain ⟨r', hr', hsub⟩ := exists_region_of_sub hrad hp + obtain rfl := region_eq_of_mem hr' hr (hsub hzp) hz + exact hsub + have hcp := hub_mem_closure hrad hS hr hp hpr hc hcV + obtain ⟨k, rfl⟩ := IsCorners.all hcor p hp hcp + have hzm : z ∈ range (G k) := hGr' k ▸ subset_closure hzp + obtain ⟨q, rfl⟩ := hzm + refine hup k q (lt_of_le_of_ne (unitInterval.nonneg _) ?_) rfl + intro hq + have h₁ : q = (q.1, 0) := Prod.ext rfl hq.symm + have h₂ : G k q = ε₀ k q.1 := by + rw [h₁] + exact hGb k q.1 + exact hzΓ (h₂ ▸ Γ.closure_subset_U (hE' k) (hεr k ▸ mem_range_self _)) + +omit [ConnectedSpace S] in +private theorem cylinder_bottom_eq_frontier {r : Set S} (hrOpen : IsOpen r) + (H₀ : C(Circle × I, S)) + (hcover : ∀ z ∈ r, ∃ p : Circle × I, 0 < p.2 ∧ H₀ p = z) + (hpos' : ∀ {p : Circle × I}, 0 < p.2 → H₀ p ∈ r) + (hbotU : ∀ z, H₀ (z, 0) ∉ r) : range (fun z : Circle => H₀ (z, 0)) = frontier r := by + have hcl : closure r ⊆ range H₀ := by + have hcomp : IsCompact (range H₀) := isCompact_range H₀.continuous + refine closure_minimal (fun z hz => ?_) hcomp.isClosed + obtain ⟨p, -, rfl⟩ := hcover z hz + exact mem_range_self p + apply subset_antisymm + · rintro _ ⟨z, rfl⟩ + rw [hrOpen.frontier_eq] + refine ⟨?_, hbotU z⟩ + have hcont : Continuous fun t : I => H₀ (z, t) := + H₀.continuous.comp (Continuous.prodMk continuous_const continuous_id) + have h₀ : (0 : I) ∈ closure (Ioi (0 : I)) := by + rw [closure_Ioi' ⟨1, zero_lt_one⟩] + exact self_mem_Ici + have h₁ := image_closure_subset_closure_image hcont (mem_image_of_mem _ h₀) + refine closure_mono ?_ h₁ + rintro _ ⟨t, ht, rfl⟩ + exact hpos' (p := (z, t)) ht + · intro x hx + have hxr : x ∉ r := by + have := hx + rw [hrOpen.frontier_eq] at this + exact this.2 + obtain ⟨⟨z, t⟩, rfl⟩ := hcl (frontier_subset_closure hx) + by_cases ht : 0 < t + · exact (hxr (hpos' ht)).elim + · have : t = 0 := le_antisymm (not_lt.mp ht) (unitInterval.nonneg t) + subst this + exact ⟨z, rfl⟩ + +omit [ConnectedSpace S] in +private theorem corner_square_chart (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') + (hS : IsClosedSurface S) {r : Set S} (hr : r ∈ Γ.R) {c : S} (hc : c ∈ r) (hcV : c ∈ Γ'.V) + {γ : Set S → I → S} (hγ : EdgePar (radialUnion hrad) γ) : + let K := halfEdges (radialUnion hrad) γ c + ∀ {next : K → K} {ρ P Q : K → Set S} {W : Set S} {τ : K → I}, + IsSectors (radialUnion hrad) γ c next ρ P W Q τ → + ∀ {A B : K → S} {E' : K → Set S}, + (∀ k, E' k ∈ Γ.E) → (∀ k : K, k.1.1 ∈ Γ'.E) → (∀ k, A k ≠ B k) → + (∀ k, A k ≠ c) → (∀ k, B k = A (next k)) → + (∀ k, closure k.1.1 ∩ Γ'.V = {A k, c}) → + (∀ k, closure (next k).1.1 ∩ Γ'.V = {B k, c}) → + (∀ k, frontier (ρ k) = closure k.1.1 ∪ closure (next k).1.1 ∪ closure (E' k)) → + (∀ k, IsClosedDisc (closure (ρ k)) ∧ discInt (closure (ρ k)) = ρ k ∧ + discBd (closure (ρ k)) = frontier (ρ k)) → + ∀ (f : ∀ k : K, I ≃ₜ closure k.1.1) (g : ∀ k : K, I ≃ₜ closure (E' k)), + let sp : K → I → S := fun k t => (f k t).1 + let ε₀ : K → I → S := fun k t => (g k t).1 + (∀ k, Continuous (sp k)) → (∀ k, Continuous (ε₀ k)) → + (∀ k, Function.Injective (sp k)) → (∀ k, Function.Injective (ε₀ k)) → + (∀ k, range (sp k) = closure k.1.1) → (∀ k, range (ε₀ k) = closure (E' k)) → + (∀ k, sp k 0 = A k) → (∀ k, sp k 1 = c) → + (∀ k, ε₀ k 0 = A k) → (∀ k, ε₀ k 1 = B k) → + ∀ k, ∃ G : I × I → S, Continuous G ∧ (∀ u, G (u, 0) = ε₀ k u) ∧ (∀ t, G (0, t) = sp k t) ∧ + (∀ t, G (1, t) = sp (next k) t) ∧ (∀ u, G (u, 1) = sp k 1) ∧ InjOn G {p | p.2 < 1} ∧ + range G = closure (ρ k) ∧ + (∀ p : I × I, 0 < p.1 → p.1 < 1 → 0 < p.2 → p.2 < 1 → G p ∉ discBd (closure (ρ k))) := by + intro K next ρ P Q W τ hsec A B E' hE' hsp hAB hAc hBnext hcapa hcapb hfr hdisc + f g sp ε₀ hspC hεc hspI hεi hspR hεr hspZ hspO hε0 hε1 + have hUU : Γ.U ∩ Γ'.U = Γ.V := radial_inter hrad + have hse : ∀ (k k' : halfEdges (radialUnion hrad) γ c) {x}, x ∈ closure (E' k) + → x ∈ closure k'.1.1 → + x ∈ Γ.V := fun k k' x h₁ h₂ => + hUU ▸ (⟨Γ.closure_subset_U (hE' k) h₁, Γ'.closure_subset_U (hsp k') h₂⟩ : x ∈ Γ.U ∩ Γ'.U) + intro k + obtain ⟨hD, -, hbd⟩ := hdisc k + have hkne : k.1.1 ≠ (next k).1.1 := by + intro h + exact IsSectors.next_ne hsec k (half_unique hrad hS hγ hr hc hcV h.symm) + refine exists_square_chart hD hS.2.2 (hεc k) (hspC k) (hspC (next k)) (hεi k) (hspI k) (hspI + (next k)) + ?_ ?_ ?_ ?_ ?_ ?_ ?_ + · rw [hε0, hspZ] + · rw [hε1, hspZ, hBnext] + · rw [hspO, hspO] + · intro s t h + have h₁ : ε₀ k s ∈ closure (E' k) := (g k s).2 + have h₂ : ε₀ k s ∈ closure k.1.1 := h ▸ (f k t).2 + have hV := hse k k h₁ h₂ + have h₃ : ε₀ k s ∈ closure k.1.1 ∩ Γ'.V := ⟨h₂, radial_V hrad hV⟩ + rw [hcapa] at h₃ + have h₄ : ε₀ k s = A k := h₃.resolve_right fun h' => hAc k (by + have h₅ : ε₀ k s ∈ Γ.V := hV + exact (region_subset hr hc (Γ.V_subset_U (h' ▸ h₅))).elim) + exact ⟨hεi k (h₄.trans (hε0 k).symm), hspI k ((h.symm.trans h₄).trans (hspZ k).symm)⟩ + · intro s t h + have h₁ : ε₀ k s ∈ closure (E' k) := (g k s).2 + have h₂ : ε₀ k s ∈ closure (next k).1.1 := h ▸ (f (next k) t).2 + have hV := hse k (next k) h₁ h₂ + have h₃ : ε₀ k s ∈ closure (next k).1.1 ∩ Γ'.V := ⟨h₂, radial_V hrad hV⟩ + rw [hcapb] at h₃ + have h₄ : ε₀ k s = B k := h₃.resolve_right fun h' => hAc k (by + have h₅ : ε₀ k s ∈ Γ.V := hV + exact (region_subset hr hc (Γ.V_subset_U (h' ▸ h₅))).elim) + refine ⟨hεi k (h₄.trans (hε1 k).symm), hspI (next k) ((h.symm.trans h₄).trans ?_)⟩ + rw [hBnext, hspZ] + · intro s t h + have h₁ : sp k s ∈ closure k.1.1 := (f k s).2 + have h₂ : sp k s ∈ closure (next k).1.1 := h ▸ (f (next k) t).2 + have hV := closure_inter_subset_V (hsp k) (hsp (next k)) hkne ⟨h₁, h₂⟩ + have m₁ : sp k s ∈ closure k.1.1 ∩ Γ'.V := ⟨h₁, hV⟩ + have m₂ : sp k s ∈ closure (next k).1.1 ∩ Γ'.V := ⟨h₂, hV⟩ + rw [hcapa] at m₁ + rw [hcapb] at m₂ + have hxc : sp k s = c := by + rcases m₁ with e₁ | e₁ + · rcases m₂ with e₂ | e₂ + · exact (hAB k (e₁.symm.trans e₂)).elim + · exact e₂ + · exact e₁ + exact ⟨hspI k (hxc.trans (hspO k).symm), hspI (next k) ((h.symm.trans hxc).trans (hspO _).symm)⟩ + · rw [(hdisc k).2.2, hfr k, hεr, hspR, hspR] + ext x + simp only [mem_union] + tauto + +omit [ConnectedSpace S] in +private theorem cylinder_between_boundaries (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') + (hS : IsClosedSurface S) {r : Set S} (hr : r ∈ Γ.R) {c : S} (hc : c ∈ r) (hcV : c ∈ Γ'.V) + {γ : Set S → I → S} (hγ : EdgePar (radialUnion hrad) γ) : + let K := halfEdges (radialUnion hrad) γ c + ∀ {ρ : K → Set S} {sp : K → I → S} {G : K → I × I → S}, + (∀ k : K, k.1.1 ∈ Γ'.E) → (∀ k, ρ k ∈ (radialUnion hrad).R) → + (∀ k, ρ k ⊆ r) → (∀ k : K, k.1.1 ⊆ r) → + (∀ k k', ρ k = ρ k' → k = k') → + (∀ k, Function.Injective (sp k)) → + (∀ k, InjOn (G k) {p | p.2 < 1}) → + (∀ k t, G k (0, t) = sp k t) → + (∀ k (p : I × I), 0 < p.1 → p.1 < 1 → 0 < p.2 → p.2 < 1 → G k p ∈ ρ k) → + (∀ k (t : I), 0 < t → t < 1 → sp k t ∈ k.1.1) → + ∀ {n : ℕ}, 0 < n → + ∀ {κ : ℕ → K} {H₀ : C(Circle × I, S)}, + (∀ i j, i < n → j < n → κ i = κ j → i = j) → + (∀ i, i < n → ∀ u t : I, H₀ (Circle.exp (2 * Real.pi * ((i + u.1) / n)), t) = G (κ i) (u, t)) → + (∀ {p : Circle × I}, 0 < p.2 → p.2 < 1 → H₀ p ∈ r) ∧ + InjOn H₀ {p | 0 < p.2 ∧ p.2 < 1} ∧ + ∀ p : Circle × I, 0 < p.2 → p.2 < 1 → H₀ p ≠ c := by + intro K ρ sp G hsp hR hρr hsubr hcoreq hspI hGi hGl hGin hspIn n hn κ H₀ hκinj hH₀ + have hclass : ∀ (z : Circle) (t : I), 0 < t → t < 1 → ∃ i, i < n ∧ ∃ u : I, u < 1 ∧ + z = Circle.exp (2 * Real.pi * ((i + u.1) / n)) ∧ H₀ (z, t) = G (κ i) (u, t) ∧ + ((0 < u ∧ H₀ (z, t) ∈ ρ (κ i)) ∨ (u = 0 ∧ H₀ (z, t) = sp (κ i) t ∧ H₀ (z, t) ∈ (κ i).1.1)) + := by + intro z t h₀ h₁ + obtain ⟨i, hi, u, hu, rfl⟩ := exists_circle_param hn z + refine ⟨i, hi, u, hu, rfl, hH₀ i hi u t, ?_⟩ + rw [hH₀ i hi u t] + by_cases hu0 : 0 < u + · exact Or.inl ⟨hu0, hGin _ _ hu0 hu h₀ h₁⟩ + · have hu0' : u = 0 := le_antisymm (not_lt.mp hu0) (unitInterval.nonneg u) + subst hu0' + refine Or.inr ⟨rfl, hGl _ _, ?_⟩ + rw [hGl] + exact hspIn _ _ h₀ h₁ + have hpos : ∀ {p : Circle × I}, 0 < p.2 → p.2 < 1 → H₀ p ∈ r := by + rintro ⟨z, t⟩ h₀ h₁ + obtain ⟨i, -, u, -, -, -, h | h⟩ := hclass z t h₀ h₁ + · exact hρr _ h.2 + · exact hsubr _ h.2.2 + have hinjH : InjOn H₀ {p | 0 < p.2 ∧ p.2 < 1} := by + rintro ⟨z, t⟩ ⟨h₀, h₁⟩ ⟨z', t'⟩ ⟨h₀', h₁'⟩ heq + simp only at h₀ h₁ h₀' h₁' + obtain ⟨i, hi, u, hu, rfl, hG₁, c₁⟩ := hclass z t h₀ h₁ + obtain ⟨i', hi', u', hu', rfl, hG₂, c₂⟩ := hclass z' t' h₀' h₁' + have hspokeU : ∀ {i x}, x ∈ (κ i).1.1 → x ∈ (radialUnion hrad).U := fun {i x} hx => + Or.inr ((hsp (κ i)).2.1 hx).1 + have hii : i = i' ∧ (u = u' ∨ False) ∧ t = t' := by + rcases c₁ with ⟨hu0, c₁⟩ | ⟨hu0, c₁, c₃⟩ <;> rcases c₂ with ⟨hu0', c₂⟩ | ⟨hu0', c₂, c₄⟩ + · have e₁ : ρ (κ i) = ρ (κ i') := region_eq_of_mem (hR _) (hR _) c₁ (heq ▸ c₂) + have e₂ := hκinj i i' hi hi' (hcoreq _ _ e₁) + subst e₂ + rw [hG₁, hG₂] at heq + have := hGi (κ i) (show (u, t).2 < 1 from h₁) (show (u', t').2 < 1 from h₁') heq + exact ⟨rfl, Or.inl (congrArg Prod.fst this), congrArg Prod.snd this⟩ + · exact (region_subset (hR _) c₁ (hspokeU (heq ▸ c₄))).elim + · exact (region_subset (hR _) c₂ (hspokeU (heq ▸ c₃))).elim + · have hee : (κ i).1.1 = (κ i').1.1 := + Γ'.edge_eq_of_mem (hsp _) (hsp _) c₃ (heq ▸ c₄) + have e₂ := hκinj i i' hi hi' (half_unique hrad hS hγ hr hc hcV hee) + subst e₂ + rw [c₁, c₂] at heq + exact ⟨rfl, Or.inl (hu0.trans hu0'.symm), hspI _ heq⟩ + obtain ⟨rfl, hu₁ | hu₁, rfl⟩ := hii + · rw [hu₁] + · exact hu₁.elim + have havoid : ∀ p : Circle × I, 0 < p.2 → p.2 < 1 → H₀ p ≠ c := by + rintro ⟨z, t⟩ ht₀ ht₁ he + obtain ⟨i, -, u, -, -, -, h | h⟩ := hclass z t ht₀ ht₁ + · exact region_subset (hR _) (he ▸ h.2) (Or.inr (Γ'.V_subset_U hcV)) + · have hcin : c ∈ (κ i).1.1 := he ▸ h.2.2 + exact ((Γ'.closure_diff_V (hsp (κ i))).superset hcin).2 hcV + exact ⟨fun {_} hp₀ hp₁ => hpos hp₀ hp₁, hinjH, havoid⟩ + +omit [T2Space S] [ConnectedSpace S] in +private theorem range_homeomorph_subtype {U : Set S} (f : I ≃ₜ U) : + range (fun t => (f t).1) = U := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (f t).2 + · intro hx + exact ⟨f.symm ⟨x, hx⟩, by simp⟩ + +/-- **The collar of the frontier of a region.** -/ +theorem exists_hub_collar (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') (hS : IsClosedSurface S) + (hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ') (hsph : IsSphere S) (hE : Γ.E.Nonempty) + (hloop : ∀ e ∈ Γ.E, ∃ x y, x ≠ y ∧ closure e ∩ Γ.V = {x, y}) {r : Set S} (hr : r ∈ Γ.R) : + ∃ n v a s P ε h, IsHubCollar Γ Γ' (radialUnion hrad) r n v a s P ε h := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hne : Nonempty S := ⟨(region_nonempty hr).some⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar (radialUnion hrad) + obtain ⟨c, ⟨hc, hcV⟩, -⟩ := hrad.2.2.2.1 r hr + change c ∈ r at hc + change c ∈ Γ'.V at hcV + have hcH : c ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact hcV + obtain ⟨next, ρ, Pc, Wc, Qc, τc, hsec⟩ := exists_sectors hS _ hγ hcH + (hub_two_halves hrad hS hmax hE hloop hγ hr hc hcV) + have hcor := IsSectors.corners hsec + have hsurj := next_surjective hcor + have hR : ∀ k, ρ k ∈ (radialUnion hrad).R := IsCorners.region hcor + have hρr : ∀ k, ρ k ⊆ r := fun k => by + obtain ⟨r', hr', hsub⟩ := exists_region_of_sub hrad (hR k) + obtain ⟨w, hw', hw⟩ := mem_closure_iff.mp (IsCorners.closure_v hcor k) r (region_isOpen hr) hc + obtain rfl := region_eq_of_mem hr' hr (hsub hw) hw' + exact hsub + have hdata := corner_data hrad hS hmax hE hloop hγ hr hc hcV hsec hρr + choose E' hE' A B hAB hA hB hcap hep hcapa hcapb hfr using hdata + have hsp : ∀ k : halfEdges (radialUnion hrad) γ c, k.1.1 ∈ Γ'.E := fun k + => hub_half_spoke hrad hr hc k hγ + have hBnext : ∀ k, B k = A (next k) := by + intro k + have h₁ : B k ∈ closure (next k).1.1 ∩ Γ'.V := by rw [hcapb]; simp + rw [hcapa] at h₁ + rcases h₁ with h | h + · exact h + · exact (region_subset hr hc (Γ.V_subset_U (h ▸ hB k))).elim + have hAc : ∀ k, A k ≠ c := fun k h => region_subset hr hc (Γ.V_subset_U (h ▸ hA k)) + have hBc : ∀ k, B k ≠ c := fun k h => region_subset hr hc (Γ.V_subset_U (h ▸ hB k)) + have hL : ∀ k : halfEdges (radialUnion hrad) γ c, IsLineWithEnds (closure k.1.1) (A k) c := fun k + => + isLine_closure (hsp k) (hAc k) (hcapa k) + have hLe : ∀ k, IsLineWithEnds (closure (E' k)) (A k) (B k) := fun k => + isLine_closure (hE' k) (hAB k) (hcap k) + choose f hf0 hf1 using hL + choose g hg0 hg1 using hLe + let sp : halfEdges (radialUnion hrad) γ c → I → S := fun k t => (f k t).1 + let ε₀ : halfEdges (radialUnion hrad) γ c → I → S := fun k t => (g k t).1 + have hspC : ∀ k, Continuous (sp k) := fun k => continuous_subtype_val.comp (f k).continuous + have hεc : ∀ k, Continuous (ε₀ k) := fun k => continuous_subtype_val.comp (g k).continuous + have hspI : ∀ k, Function.Injective (sp k) := fun k x y h => + (f k).injective (Subtype.ext h) + have hεi : ∀ k, Function.Injective (ε₀ k) := fun k x y h => + (g k).injective (Subtype.ext h) + have hspR : ∀ k, range (sp k) = closure k.1.1 := fun k => range_homeomorph_subtype (f k) + have hεr : ∀ k, range (ε₀ k) = closure (E' k) := fun k => range_homeomorph_subtype (g k) + have hspZ : ∀ k, sp k 0 = A k := hf0 + have hspO : ∀ k, sp k 1 = c := hf1 + have hε0 : ∀ k, ε₀ k 0 = A k := hg0 + have hε1 : ∀ k, ε₀ k 1 = B k := hg1 + have hdisc := isClosedDisc_closure_corner hrad hS hmax hsph hE hloop hγ hr hc hcV hsec hρr + have hsquare := corner_square_chart hrad hS hr hc hcV hγ hsec hE' hsp hAB hAc hBnext + hcapa hcapb hfr hdisc f g hspC hεc hspI hεi hspR hεr hspZ hspO hε0 hε1 + choose G hGc hGb hGl hGr hGt hGi hGr' hGint using hsquare + have hsubr : ∀ k : halfEdges (radialUnion hrad) γ c, k.1.1 ⊆ r := by + intro k y hy + obtain ⟨v', hv', r', hr', w, hwr, hwV, -, hsub⟩ := spoke_ends hrad hS (hsp k) + have hkcl : k.1.1 ⊆ closure (ρ k) := by + obtain ⟨l, hl⟩ := hsurj k + have := IsCorners.right hcor l + rwa [hl] at this + obtain ⟨z, hz, hzp⟩ := mem_closure_iff.mp (hkcl hy) r' (region_isOpen hr') (hsub hy) + obtain rfl := region_eq_of_mem hr' hr hz (hρr k hzp) + exact hsub hy + have hspIn : ∀ k (t : I), 0 < t → t < 1 → sp k t ∈ k.1.1 := by + intro k t h₀ h₁ + have hm : sp k t ∈ closure k.1.1 := (f k t).2 + have hnV : sp k t ∉ Γ'.V := by + intro hV + have : sp k t ∈ closure k.1.1 ∩ Γ'.V := ⟨hm, hV⟩ + rw [hcapa] at this + rcases this with h | h + · exact h₀.ne ((hspI k (h.trans (hspZ k).symm)).symm) + · exact h₁.ne (hspI k (h.trans (hspO k).symm)) + exact Γ'.closure_diff_V (hsp k) ▸ (⟨hm, hnV⟩ : sp k t ∈ closure k.1.1 \ Γ'.V) + have hGin : ∀ k (p : I × I), 0 < p.1 → p.1 < 1 → 0 < p.2 → p.2 < 1 → G k p ∈ ρ k := by + intro k p a₁ a₂ a₃ a₄ + have hmem : G k p ∈ closure (ρ k) := hGr' k ▸ mem_range_self p + have := (hdisc k).2.1 + rw [← this] + exact ⟨hmem, hGint k p a₁ a₂ a₃ a₄⟩ + -- The cyclic order. + obtain ⟨k₀⟩ : Nonempty (halfEdges (radialUnion hrad) γ c) := by + have := hub_two_halves hrad hS hmax hE hloop hγ hr hc hcV + have hfin : Finite (halfEdges (radialUnion hrad) γ c) := (finite_halfEdges _ _ _).to_subtype + exact (Finite.one_lt_card_iff_nontrivial.mp this).to_nonempty + have hfin : Finite (halfEdges (radialUnion hrad) γ c) := (finite_halfEdges _ _ _).to_subtype + have hinj : Function.Injective next := IsCorners.inj hcor + have hper : k₀ ∈ Function.periodicPts next := hinj.mem_periodicPts k₀ + let n := Function.minimalPeriod next k₀ + have hn : 0 < n := Function.minimalPeriod_pos_of_mem_periodicPts hper + let κ : ℕ → halfEdges (radialUnion hrad) γ c := fun i => next^[i] k₀ + have hκs : ∀ i, κ (i + 1) = next (κ i) := fun i => Function.iterate_succ_apply' next i k₀ + have hκn : ∀ i, κ (i + n) = κ i := fun i => by + change next^[i + n] k₀ = next^[i] k₀ + rw [Function.iterate_add_apply, Function.iterate_minimalPeriod] + have hκinj : ∀ i j, i < n → j < n → κ i = κ j → i = j := fun i j hi hj h => + Function.iterate_injOn_Iio_minimalPeriod hi hj h + have hκall : ∀ k, ∃ i, i < n ∧ κ i = k := by + intro k + have hreach := IsCorners.reach hcor k₀ k + have : ∃ m, next^[m] k₀ = k := by + induction hreach with + | refl => exact ⟨0, rfl⟩ + | tail _ h ih => + obtain ⟨m, hm⟩ := ih + exact ⟨m + 1, by rw [Function.iterate_succ_apply', hm, h]⟩ + obtain ⟨m, hm⟩ := this + refine ⟨m % n, Nat.mod_lt _ hn, ?_⟩ + rw [← hm] + exact Function.iterate_mod_minimalPeriod_eq + have hcoreq : ∀ k k', ρ k = ρ k' → k = k' := by + intro k k' h + by_contra hkk + exact corner_regions_ne hrad hS hr hc hcV hsec hkk h + have htwo : 2 ≤ n := by + by_contra hlt + have hn1 : n = 1 := by omega + have h₁ : κ 1 = κ 0 := by simpa [hn1] using hκn 0 + rw [hκs] at h₁ + exact IsSectors.next_ne hsec _ h₁ + obtain ⟨H₀, hH₀⟩ := exists_cylinder hn (G := fun i => G (κ i)) (fun i => hGc _) + (fun i t => by + rw [hGr, hGl, hκs]) + (fun t => by + have := hκn 0 + rw [zero_add] at this + rw [this]) + -- Points of the cylinder at positive height. + obtain ⟨hpos, hinjH, havoid⟩ := + cylinder_between_boundaries hrad hS hr hc hcV hγ hsp hR hρr hsubr hcoreq hspI hGi hGl + hGin hspIn hn hκinj hH₀ + have hzpar : ∀ (z : Circle) (t : I), ∃ i, i < n ∧ ∃ u : I, H₀ (z, t) = G (κ i) (u, t) := by + intro z t + obtain ⟨i, hi, u, hu, rfl⟩ := exists_circle_param hn z + exact ⟨i, hi, u, hH₀ i hi u t⟩ + have hHc : ∀ z, H₀ (z, 1) = c := by + intro z + obtain ⟨i, -, u, h⟩ := hzpar z 1 + rw [h, hGt] + exact hspO _ + have hcover := corner_charts_cover_region hrad hS hr hc hcV hγ hcH hcor + hA hE' hspR hspZ hspO hεr hGr' hGl hGb ⟨k₀⟩ hκall hH₀ + have hpos' : ∀ {p : Circle × I}, 0 < p.2 → H₀ p ∈ r := by + rintro ⟨z, t⟩ h₀ + by_cases h₁ : t < 1 + · exact hpos h₀ h₁ + · have : t = 1 := le_antisymm (unitInterval.le_one t) (not_lt.mp h₁) + subst this + rw [hHc] + exact hc + have hbotU : ∀ z, H₀ (z, 0) ∉ r := by + intro z hz + obtain ⟨i, -, u, h⟩ := hzpar z 0 + rw [h, hGb] at hz + exact region_subset hr hz (Γ.closure_subset_U (hE' _) (hεr _ ▸ mem_range_self _)) + have hfrontier := cylinder_bottom_eq_frontier (region_isOpen hr) H₀ hcover hpos' hbotU + obtain ⟨hh, hhz, hhinj, hhmem, hhopen⟩ := half_height_collar H₀ hbotU hHc hpos' hinjH hcover + havoid + refine ⟨n, fun i => A (κ i), fun i => E' (κ i), fun i => (κ i).1.1, fun i => ρ (κ i), + fun i => ε₀ (κ i), hh, ?_⟩ + refine ⟨htwo, fun i => by simp only [hκn], fun i => by simp only [hκn], + fun i => by simp only [hκn], + fun i => by simp only [hκn], fun i => by simp only [hκn], fun i => hE' _, fun i => hA _, ?_, ?_, + fun i => hsp _, fun i => ⟨c, hc, hcapa _⟩, fun i => hR _, fun i => hρr _, fun i + => hep _, ?_, ?_, ?_, + fun i => hεc _, fun i => hεi _, fun i => hε0 _, ?_, fun i => hεr _, ?_, ?_, ?_, ?_, ?_⟩ + · intro i + rw [hcap, hBnext, hκs] + · intro i + rw [hκs, ← hBnext] + exact hAB _ + · intro i + obtain ⟨l, hl⟩ := hsurj (κ i) + refine ⟨?_, ?_⟩ + · have := IsCorners.right hcor l + rwa [hl] at this + · rw [hκs] + exact IsCorners.left hcor _ + · intro i j hi hj h + exact hκinj i j hi hj (hcoreq _ _ h) + · intro p hp hpr + obtain ⟨k, rfl⟩ := IsCorners.all hcor p hp (hub_mem_closure hrad hS hr hp hpr hc hcV) + obtain ⟨i, hi, rfl⟩ := hκall k + exact ⟨i, hi, rfl⟩ + · intro i + rw [hε1, hBnext, hκs] + · intro i hi u + rw [hhz, hH₀ i hi u 0, hGb] + · exact hhinj + · exact hhmem + · rw [← hfrontier] + congr 1 + funext z + exact hhz z + · exact hhopen + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/HubCycle.lean b/LeanPool/GraphMinor/GM11/HubCycle.lean new file mode 100644 index 0000000000..923bbeb29b --- /dev/null +++ b/LeanPool/GraphMinor/GM11/HubCycle.lean @@ -0,0 +1,401 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialTwoCell + +/-! +# The corners at the vertex of a region + +Let `Γ'` be a radial drawing of a 2-cell drawing `Γ`, let `r` be a region of `Γ`, and let `c` be the +vertex +of `Γ'` in `r`. Suppose that no edge of `Γ` is a loop. Each corner at `c` lies in a region `p` of `Γ +∪ Γ'`, +and we show that `p` is bounded by the two spokes of the corner and one edge of `Γ` (`corner_data`). +In a +sphere, the closure of `p` is a closed disc (`isClosedDisc_closure_corner`). +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] {Γ Γ' : Drawing S} [T2Space S] [ConnectedSpace S] + (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') (hS : IsClosedSurface S) + (hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ') + +include hrad hS + +omit [ConnectedSpace S] in +/-- A spoke in the closure of a region of `Γ ∪ Γ'` inside `r` has a half-edge at the vertex of `r`. +-/ +theorem spoke_at_hub {γ : Set S → I → S} (hγ : EdgePar (radialUnion hrad) γ) {r p s : Set S} + (hr : r ∈ Γ.R) + {c : S} (hc : c ∈ r) (hcV : c ∈ Γ'.V) (_hp : p ∈ (radialUnion hrad).R) (hpr : p ⊆ r) + (hs : s ∈ Γ'.E) + (hsp : s ⊆ closure p) : ∃ k : halfEdges (radialUnion hrad) γ c, k.1.1 = s := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨v, hv, r', hr', w, hwr, hwV, hcap, hsub⟩ := spoke_ends hrad hS hs + obtain ⟨y, hy⟩ := hs.1 + obtain ⟨z, hz, hzp⟩ := mem_closure_iff.mp (hsp hy) r' (region_isOpen hr') (hsub hy) + obtain rfl : r' = r := region_eq_of_mem hr' hr hz (hpr hzp) + have hwc : w = c := hub_unique hrad hr hc hcV hwr hwV + subst hwc + have hcs : w ∈ closure s := by + have : w ∈ closure s ∩ Γ'.V := by rw [hcap]; simp + exact this.1 + have hsH : s ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inr hs + have hcH : w ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact hcV + obtain ⟨b, hb⟩ := exists_end_eq hγ hsH hcH hcs + exact ⟨⟨(s, b), hsH, hb⟩, rfl⟩ + +omit [T2Space S] [ConnectedSpace S] in +/-- A spoke at the vertex of a region joins it to a vertex of `Γ`. -/ +theorem spoke_end {r s : Set S} (hr : r ∈ Γ.R) {c : S} (hc : c ∈ r) (hcV : c ∈ Γ'.V) (hs : s ∈ Γ'.E) + (hcs : c ∈ closure s) : ∃ a ∈ Γ.V, closure s ∩ Γ'.V = {a, c} := by + obtain ⟨v, hv, r', hr', w, hwr, hwV, hcap, hsub⟩ := spoke_ends hrad hS hs + have hcv : c ≠ v := fun h => region_subset hr hc (Γ.V_subset_U (h ▸ hv)) + have hmem : c ∈ closure s ∩ Γ'.V := ⟨hcs, hcV⟩ + rw [hcap] at hmem + rcases hmem with h | h + · exact (hcv h).elim + · have h' : c = w := h + exact ⟨v, hv, by rw [hcap, h']⟩ + +omit [ConnectedSpace S] in +/-- A half-edge at the vertex of `r` whose spoke lies in the closure of a corner is a side of the +corner. -/ +theorem corner_mem {γ : Set S → I → S} {r : Set S} (hr : r ∈ Γ.R) {c : S} (hc : c ∈ r) + (hcV : c ∈ Γ'.V) + {next : halfEdges (radialUnion hrad) γ c → halfEdges (radialUnion hrad) γ c} + {ρ P Q : halfEdges (radialUnion hrad) γ c → Set S} {W : Set S} + {τ : halfEdges (radialUnion hrad) γ c → I} + (hsec : IsSectors (radialUnion hrad) γ c next ρ P W Q τ) + {k k' : halfEdges (radialUnion hrad) γ c} (h : k'.1.1 ⊆ closure (ρ k)) : k' = k ∨ k' = next k + := by + have hcor := IsSectors.corners hsec + obtain ⟨l, rfl⟩ := next_surjective hcor k' + rcases IsCorners.sides hcor l (ρ k) (IsCorners.region hcor k) h with h₁ | h₁ + · by_contra hn + push Not at hn + by_cases hkl : k = l + · exact hn.2 (hkl ▸ rfl) + · exact corner_regions_ne hrad hS hr hc hcV hsec hkl h₁ + · by_contra hn + push Not at hn + exact corner_regions_ne hrad hS hr hc hcV hsec (Ne.symm hn.1) h₁ + +include hmax in +/-- **A corner at the vertex of `r`.** Its region is bounded by its two spokes and one edge of `Γ`. +-/ +theorem corner_data (hE : Γ.E.Nonempty) + (hloop : ∀ e ∈ Γ.E, ∃ x y, x ≠ y ∧ closure e ∩ Γ.V = {x, y}) + {γ : Set S → I → S} (hγ : EdgePar (radialUnion hrad) γ) {r : Set S} (hr : r ∈ Γ.R) {c : S} + (hc : c ∈ r) + (hcV : c ∈ Γ'.V) + {next : halfEdges (radialUnion hrad) γ c → halfEdges (radialUnion hrad) γ c} + {ρ P Q : halfEdges (radialUnion hrad) γ c → Set S} {W : Set S} + {τ : halfEdges (radialUnion hrad) γ c → I} + (hsec : IsSectors (radialUnion hrad) γ c next ρ P W Q τ) + (hρr : ∀ k, ρ k ⊆ r) (k : halfEdges (radialUnion hrad) γ c) : + ∃ e ∈ Γ.E, ∃ a b, a ≠ b ∧ a ∈ Γ.V ∧ b ∈ Γ.V ∧ closure e ∩ Γ.V = {a, b} ∧ e ⊆ closure (ρ k) ∧ + closure k.1.1 ∩ Γ'.V = {a, c} ∧ closure (next k).1.1 ∩ Γ'.V = {b, c} ∧ + frontier (ρ k) = closure k.1.1 ∪ closure (next k).1.1 ∪ closure e := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hcor := IsSectors.corners hsec + have hp : ρ k ∈ (radialUnion hrad).R := IsCorners.region hcor k + have hspoke : ∀ i : halfEdges (radialUnion hrad) γ c, i.1.1 ∈ Γ'.E := fun i => + hub_half_spoke hrad hr hc i hγ + have hhalf : ∀ i : halfEdges (radialUnion hrad) γ c, c ∈ closure i.1.1 := fun i => by + have := end_mem_closure hγ i.2.1 i.1.2 + rwa [i.2.2] at this + have hsurj := next_surjective hcor + have hkcl : k.1.1 ⊆ closure (ρ k) := by + obtain ⟨l, hl⟩ := hsurj k + have := IsCorners.right hcor l + rwa [hl] at this + have hnkcl : (next k).1.1 ⊆ closure (ρ k) := IsCorners.left hcor k + obtain ⟨a, ha, hcapa⟩ := spoke_end hrad hS hr hc hcV (hspoke k) (hhalf k) + obtain ⟨b, hb, hcapb⟩ := spoke_end hrad hS hr hc hcV (hspoke (next k)) (hhalf (next k)) + obtain ⟨e, he, hep, hu, hv⟩ := face_edge hrad hS hmax hE hp + obtain ⟨x, y, hxy, hcap⟩ := hloop e he + have heH : e ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inl he + have hsec' : ∀ x : Γ.V, ∃ next ρ P W Q τ, IsSectors (radialUnion hrad) γ x.1 next ρ P W Q τ := + fun x => exists_sectors hS _ hγ + (by rw [radialUnion_V]; exact radial_V hrad x.2) (two_half_edges hrad hS hmax hE hγ x.2) + -- Each end of `e` is an end of a side of the corner. + have hend : ∀ z, z ∈ closure e ∩ Γ.V → z = a ∨ z = b := by + rintro z ⟨hze, hzV⟩ + have hzH : z ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact radial_V hrad hzV + obtain ⟨bb, hbb⟩ := exists_end_eq hγ heH hzH hze + obtain ⟨_, _, _, _, _, _, hs⟩ := hsec' ⟨z, hzV⟩ + obtain ⟨φ, hφ, hφp, -⟩ := exists_adj hrad hS hmax hE hγ hzV hs ⟨(e, bb), heH, hbb⟩ he hp hep + obtain ⟨k', hk'⟩ := spoke_at_hub hrad hS hγ hr hc hcV hp (hρr k) hφ hφp + have hzφ : z ∈ closure φ.1.1 := by + have := end_mem_closure hγ φ.2.1 φ.1.2 + rwa [φ.2.2] at this + have hzc : z ≠ c := fun h => region_subset hr hc (Γ.V_subset_U (h ▸ hzV)) + rw [← hk'] at hzφ + rcases corner_mem hrad hS hr hc hcV hsec (hk' ▸ hφp) with rfl | rfl + · have : z ∈ closure k'.1.1 ∩ Γ'.V := ⟨hzφ, radial_V hrad hzV⟩ + rw [hcapa] at this + exact Or.inl (this.resolve_right hzc) + · have : z ∈ closure (next k).1.1 ∩ Γ'.V := ⟨hzφ, radial_V hrad hzV⟩ + rw [hcapb] at this + exact Or.inr (this.resolve_right hzc) + have hxm : x ∈ closure e ∩ Γ.V := by rw [hcap]; simp + have hym : y ∈ closure e ∩ Γ.V := by rw [hcap]; simp + have hab : a ≠ b := by + rintro rfl + have h₁ := (hend x hxm).elim id id + have h₂ := (hend y hym).elim id id + exact hxy (h₁.trans h₂.symm) + have hcape : closure e ∩ Γ.V = {a, b} := by + rw [hcap] + rcases hend x hxm with rfl | rfl <;> rcases hend y hym with rfl | rfl + · exact (hxy rfl).elim + · rfl + · exact pair_comm _ _ + · exact (hxy rfl).elim + refine ⟨e, he, a, b, hab, ha, hb, hcape, hep, hcapa, hcapb, ?_⟩ + have hclosed : IsClosed (closure k.1.1 ∪ closure (next k).1.1 ∪ closure e) := + (isClosed_closure.union isClosed_closure).union isClosed_closure + rw [(region_isOpen hp).frontier_eq] + apply subset_antisymm + · rintro z ⟨hzcl, hzp⟩ + have hzU : z ∈ (radialUnion hrad).U := by + by_contra hn + obtain ⟨p', hp', hzp'⟩ := exists_region_of_notMem hn + obtain ⟨w, hw', hw⟩ := mem_closure_iff.mp hzcl p' (region_isOpen hp') hzp' + exact hzp (region_eq_of_mem hp' hp hw' hw ▸ hzp') + by_cases hzV : z ∈ (radialUnion hrad).V + · rw [radialUnion_V] at hzV + by_cases hzΓ : z ∈ Γ.V + · have hmem : z ∈ closure e ∩ Γ.V := ⟨hv z hzΓ hzcl, hzΓ⟩ + exact Or.inr hmem.1 + · obtain ⟨r', hr', hzr'⟩ := hrad.2.2.2.2.1 z ⟨hzV, hzΓ⟩ + obtain ⟨w, hw', hw⟩ := mem_closure_iff.mp hzcl r' (region_isOpen hr') hzr' + obtain rfl : r' = r := region_eq_of_mem hr' hr hw' (hρr k hw) + have hzc : z = c := hub_unique hrad hr hc hcV hzr' hzV + exact Or.inl (Or.inl (hzc ▸ hhalf k)) + · rw [(radialUnion hrad).U_eq] at hzU + rcases hzU with h | h + · exact (hzV h).elim + obtain ⟨g, hg, hzg'⟩ := mem_iUnion₂.mp h + have hzg : z ∈ g := (radialUnion hrad).closure_diff_V hg ▸ ⟨hzg', hzV⟩ + have hgp : g ⊆ closure (ρ k) := + edge_subset_closure_of_incident hS hg hp ⟨z, hzg, hzcl⟩ + rw [radialUnion_E] at hg + rcases hg with hg | hg + · have := hu g hg hgp + subst this + exact Or.inr hzg' + · obtain ⟨k', hk'⟩ := spoke_at_hub hrad hS hγ hr hc hcV hp (hρr k) hg hgp + rcases corner_mem hrad hS hr hc hcV hsec (hk' ▸ hgp) with rfl | rfl + · exact Or.inl (Or.inl (hk' ▸ hzg')) + · exact Or.inl (Or.inr (hk' ▸ hzg')) + · have hdis : ∀ {g : Set S}, g ∈ (radialUnion hrad).E → closure g ⊆ (radialUnion hrad).U := + fun hg => (radialUnion hrad).closure_subset_U hg + have hk₁ : k.1.1 ∈ (radialUnion hrad).E := k.2.1 + have hk₂ : (next k).1.1 ∈ (radialUnion hrad).E := (next k).2.1 + rintro z ((h | h) | h) + · exact ⟨closure_minimal hkcl isClosed_closure h, fun hz => region_subset hp hz (hdis hk₁ h)⟩ + · exact ⟨closure_minimal hnkcl isClosed_closure h, fun hz => region_subset hp hz (hdis hk₂ h)⟩ + · exact ⟨closure_minimal hep isClosed_closure h, fun hz => region_subset hp hz (hdis heH h)⟩ + +include hmax in +/-- **In a sphere, the closure of a corner is a closed disc.** -/ +theorem isClosedDisc_closure_corner (hsph : IsSphere S) (hE : Γ.E.Nonempty) + (hloop : ∀ e ∈ Γ.E, ∃ x y, x ≠ y ∧ closure e ∩ Γ.V = {x, y}) + {γ : Set S → I → S} (hγ : EdgePar (radialUnion hrad) γ) {r : Set S} (hr : r ∈ Γ.R) {c : S} + (hc : c ∈ r) + (hcV : c ∈ Γ'.V) + {next : halfEdges (radialUnion hrad) γ c → halfEdges (radialUnion hrad) γ c} + {ρ P Q : halfEdges (radialUnion hrad) γ c → Set S} {W : Set S} + {τ : halfEdges (radialUnion hrad) γ c → I} + (hsec : IsSectors (radialUnion hrad) γ c next ρ P W Q τ) + (hρr : ∀ k, ρ k ⊆ r) (k : halfEdges (radialUnion hrad) γ c) : + IsClosedDisc (closure (ρ k)) ∧ discInt (closure (ρ k)) = ρ k ∧ + discBd (closure (ρ k)) = frontier (ρ k) := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hcor := IsSectors.corners hsec + have hp : ρ k ∈ (radialUnion hrad).R := IsCorners.region hcor k + obtain ⟨e, he, a, b, hab, ha, hb, hcape, hep, hcapa, hcapb, hfr⟩ := + corner_data hrad hS hmax hE hloop hγ hr hc hcV hsec hρr k + have hspoke : ∀ i : halfEdges (radialUnion hrad) γ c, i.1.1 ∈ Γ'.E := fun i => + hub_half_spoke hrad hr hc i hγ + have hca : c ≠ a := fun h => region_subset hr hc (Γ.V_subset_U (h ▸ ha)) + have hcb : c ≠ b := fun h => region_subset hr hc (Γ.V_subset_U (h ▸ hb)) + have hL₁ : IsLineWithEnds (closure k.1.1) c a := + isLine_closure (hspoke k) hca (by rw [hcapa, pair_comm]) + have hL₂ : IsLineWithEnds (closure (next k).1.1) c b := + isLine_closure (hspoke (next k)) hcb (by rw [hcapb, pair_comm]) + have hL₃ : IsLineWithEnds (closure e) a b := isLine_closure he hab hcape + have hne : k.1.1 ≠ (next k).1.1 := by + intro h + rw [← h, hcapa] at hcapb + have : a ∈ ({b, c} : Set S) := hcapb ▸ mem_insert a {c} + rcases this with h₁ | h₁ + · exact hab h₁ + · exact hca h₁.symm + have h₁₂ : closure k.1.1 ∩ closure (next k).1.1 = {c} := by + apply subset_antisymm + · rintro z ⟨hz₁, hz₂⟩ + have hzV := closure_inter_subset_V (hspoke k) (hspoke (next k)) hne ⟨hz₁, hz₂⟩ + have m₁ : z ∈ closure k.1.1 ∩ Γ'.V := ⟨hz₁, hzV⟩ + have m₂ : z ∈ closure (next k).1.1 ∩ Γ'.V := ⟨hz₂, hzV⟩ + rw [hcapa] at m₁ + rw [hcapb] at m₂ + rcases m₁ with rfl | h + · rcases m₂ with h | h + · exact (hab h).elim + · exact h + · exact h + · rintro z rfl + have h₁ : z ∈ closure k.1.1 ∩ Γ'.V := by rw [hcapa]; simp + have h₂ : z ∈ closure (next k).1.1 ∩ Γ'.V := by rw [hcapb]; simp + exact ⟨h₁.1, h₂.1⟩ + have hL₄ : IsLineWithEnds (closure k.1.1 ∪ closure (next k).1.1) a b := + IsLineWithEnds.union hL₁ hL₂ h₁₂ + have hsp₃ : ∀ i : halfEdges (radialUnion hrad) γ c, closure i.1.1 ∩ closure e ⊆ Γ.V := by + rintro i z ⟨hz₁, hz₂⟩ + have h₁ : Γ.U ∩ Γ'.U = Γ.V := radial_inter hrad + exact h₁ ▸ (⟨Γ.closure_subset_U he hz₂, Γ'.closure_subset_U (hspoke i) hz₁⟩ : z ∈ Γ.U ∩ Γ'.U) + have hcap₃ : (closure k.1.1 ∪ closure (next k).1.1) ∩ closure e ⊆ {a, b} := by + rintro z ⟨hz | hz, hze⟩ + · have hzV := hsp₃ k ⟨hz, hze⟩ + exact (hcape ▸ (⟨hze, hzV⟩ : z ∈ closure e ∩ Γ.V)) + · have hzV := hsp₃ (next k) ⟨hz, hze⟩ + exact (hcape ▸ (⟨hze, hzV⟩ : z ∈ closure e ∩ Γ.V)) + have hF : IsOArc (frontier (ρ k)) := hfr ▸ isOArc_union hL₄ hL₃ hcap₃ + obtain ⟨Δ₁, Δ₂, -, h₁, h₂, hb₁, hb₂, -, -, hcomp, -⟩ := sphere_disc S hsph _ hF + have hpo : IsOpen (ρ k) := region_isOpen hp + have hpdis : ρ k ⊆ univ \ frontier (ρ k) := fun x hx => ⟨trivial, fun h => by + rw [hpo.frontier_eq] at h + exact h.2 hx⟩ + obtain ⟨x₀, hx₀⟩ := region_nonempty hp + have hx₁ := hpdis hx₀ + have hcompx : connectedComponentIn (univ \ frontier (ρ k)) x₀ ∈ + componentsIn (univ \ frontier (ρ k)) := ⟨x₀, hx₁, rfl⟩ + have hsub : ρ k ⊆ connectedComponentIn (univ \ frontier (ρ k)) x₀ := + (region_isPreconnected hp).subset_connectedComponentIn hx₀ hpdis + rw [hcomp] at hcompx + -- The region is all of one side of the frontier. + have key : ∀ Δ, IsClosedDisc Δ → discBd Δ = frontier (ρ k) → Δ \ frontier (ρ k) ∈ componentsIn + (univ \ frontier (ρ k)) → + ρ k ⊆ Δ \ frontier (ρ k) → IsClosedDisc (closure (ρ k)) ∧ discInt (closure (ρ k)) = ρ k ∧ + discBd (closure (ρ k)) = frontier (ρ k) := by + intro Δ hΔ hbΔ hΔc hsubΔ + have hconn : IsPreconnected (Δ \ frontier (ρ k)) := by + rw [← hbΔ] + exact hΔ.isPreconnected_discInt + have hopenΔ : IsOpen (Δ \ frontier (ρ k)) := by + have := hΔ.isOpen_discInt fun x => (hS.2.2 x).isManifoldPoint + rwa [discInt, hbΔ] at this + have heq : ρ k = Δ \ frontier (ρ k) := by + apply subset_antisymm hsubΔ + intro z hz + by_contra hzp + have hO : IsOpen (closure (ρ k))ᶜ := isClosed_closure.isOpen_compl + have hzO : z ∈ (closure (ρ k))ᶜ := fun h => hz.2 ⟨h, by rw [hpo.interior_eq]; exact hzp⟩ + have hd : Disjoint (ρ k) (closure (ρ k))ᶜ := disjoint_left.mpr fun y hy h => h + (subset_closure hy) + have hcov : Δ \ frontier (ρ k) ⊆ ρ k ∪ (closure (ρ k))ᶜ := by + intro y hy + by_cases hyp : y ∈ ρ k + · exact Or.inl hyp + · exact Or.inr fun h => hy.2 ⟨h, by rw [hpo.interior_eq]; exact hyp⟩ + have := hconn.subset_left_of_subset_union hpo hO hd hcov ⟨x₀, hsubΔ hx₀, hx₀⟩ hz + exact hzp this + have hcl : closure (ρ k) = Δ := by + apply subset_antisymm + · exact closure_minimal (hsubΔ.trans sdiff_subset) hΔ.isClosed + · have h₃ := hΔ.subset_closure_discInt + rw [discInt, hbΔ, ← heq] at h₃ + exact h₃ + rw [hcl] + exact ⟨hΔ, by rw [discInt, hbΔ]; exact heq.symm, hbΔ⟩ + rcases hcompx with h | h + · rw [h] at hsub + exact key Δ₁ h₁ hb₁ (by rw [hcomp]; simp) hsub + · rw [show connectedComponentIn (univ \ frontier (ρ k)) x₀ = Δ₂ \ frontier (ρ k) from h] at hsub + exact key Δ₂ h₂ hb₂ (by rw [hcomp]; simp) hsub + +include hmax in +/-- The vertex of a region has at least two half-edges, if no edge of `Γ` is a loop. -/ +theorem hub_two_halves (hE : Γ.E.Nonempty) + (hloop : ∀ e ∈ Γ.E, ∃ x y, x ≠ y ∧ closure e ∩ Γ.V = {x, y}) + {γ : Set S → I → S} (hγ : EdgePar (radialUnion hrad) γ) {r : Set S} (hr : r ∈ Γ.R) {c : S} + (hc : c ∈ r) + (hcV : c ∈ Γ'.V) : 2 ≤ Nat.card (halfEdges (radialUnion hrad) γ c) := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨z, hzr, hzU⟩ := exists_notMem_U (Γ := radialUnion hrad) hS + (region_isOpen hr) (region_nonempty hr) + obtain ⟨p, hp, hzp⟩ := exists_region_of_notMem hzU + have hpr : p ⊆ r := by + obtain ⟨r', hr', hpr'⟩ := exists_region_of_sub hrad hp + obtain rfl := region_eq_of_mem hr' hr (hpr' hzp) hzr + exact hpr' + obtain ⟨e, he, hep, -, -⟩ := face_edge hrad hS hmax hE hp + obtain ⟨x, y, hxy, hcap⟩ := hloop e he + have heH : e ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inl he + have hsec' : ∀ x : Γ.V, ∃ next ρ P W Q τ, IsSectors (radialUnion hrad) γ x.1 next ρ P W Q τ := + fun x => exists_sectors hS _ hγ + (by rw [radialUnion_V]; exact radial_V hrad x.2) (two_half_edges hrad hS hmax hE hγ x.2) + have hend : ∀ z, z ∈ closure e ∩ Γ.V → ∃ k : halfEdges (radialUnion hrad) γ c, z ∈ closure k.1.1 + := by + rintro z ⟨hze, hzV⟩ + have hzH : z ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact radial_V hrad hzV + obtain ⟨bb, hbb⟩ := exists_end_eq hγ heH hzH hze + obtain ⟨_, _, _, _, _, _, hs⟩ := hsec' ⟨z, hzV⟩ + obtain ⟨φ, hφ, hφp, -⟩ := exists_adj hrad hS hmax hE hγ hzV hs ⟨(e, bb), heH, hbb⟩ he hp hep + obtain ⟨k', hk'⟩ := spoke_at_hub hrad hS hγ hr hc hcV hp hpr hφ hφp + have hzφ : z ∈ closure φ.1.1 := by + have := end_mem_closure hγ φ.2.1 φ.1.2 + rwa [φ.2.2] at this + exact ⟨k', hk' ▸ hzφ⟩ + have hxm : x ∈ closure e ∩ Γ.V := by rw [hcap]; simp + have hym : y ∈ closure e ∩ Γ.V := by rw [hcap]; simp + obtain ⟨k₁, hk₁⟩ := hend x hxm + obtain ⟨k₂, hk₂⟩ := hend y hym + have hne : k₁ ≠ k₂ := by + rintro rfl + have hcs : c ∈ closure k₁.1.1 := by + have := end_mem_closure hγ k₁.2.1 k₁.1.2 + rwa [k₁.2.2] at this + obtain ⟨a, ha, hcapa⟩ := spoke_end hrad hS hr hc hcV (hub_half_spoke hrad hr hc k₁ hγ) hcs + have hxc : x ≠ c := fun h => region_subset hr hc (Γ.V_subset_U (h ▸ hxm.2)) + have hyc : y ≠ c := fun h => region_subset hr hc (Γ.V_subset_U (h ▸ hym.2)) + have h₁ : x ∈ closure k₁.1.1 ∩ Γ'.V := ⟨hk₁, radial_V hrad hxm.2⟩ + have h₂ : y ∈ closure k₁.1.1 ∩ Γ'.V := ⟨hk₂, radial_V hrad hym.2⟩ + rw [hcapa] at h₁ h₂ + exact hxy ((h₁.resolve_right hxc).trans (h₂.resolve_right hyc).symm) + have hfin : Finite (halfEdges (radialUnion hrad) γ c) := (finite_halfEdges _ _ _).to_subtype + have hnt : Nontrivial (halfEdges (radialUnion hrad) γ c) := ⟨k₁, k₂, hne⟩ + exact Finite.one_lt_card + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/HubWalk.lean b/LeanPool/GraphMinor/GM11/HubWalk.lean new file mode 100644 index 0000000000..56de84438a --- /dev/null +++ b/LeanPool/GraphMinor/GM11/HubWalk.lean @@ -0,0 +1,311 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.HubCollar +public import LeanPool.GraphMinor.GM11.EvenCircuit + +/-! +# The edges met by the collar of a region + +Let `h` be the collar of `exists_hub_collar`. `collar_turn` says that the collar does not turn back +at a +vertex of valency two. `IsHubCollar.shift` moves the start of the collar by one step. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +namespace IsHubCollar + +variable {Γ Γ' H : Drawing S} {r : Set S} {n : ℕ} {v : ℕ → S} {a s P : ℕ → Set S} {ε : ℕ → I → S} + {h : C(Circle × I, S)} + +theorem pos (hc : IsHubCollar Γ Γ' H r n v a s P ε h) : 0 < n := by + have := hc.two_le + omega + +/-- Periodicity of a sequence with period `n`, reducing the index. -/ +theorem mod_eq {α : Type*} {f : ℕ → α} {n : ℕ} (hp : ∀ i, f (i + n) = f i) (i : ℕ) : + f (i % n) = f i := by + induction i using Nat.strong_induction_on with + | _ i ih => + by_cases hi : i < n + · rw [Nat.mod_eq_of_lt hi] + · have hs : i = (i - n) + n := by omega + rw [Nat.mod_eq_sub_mod (not_lt.mp hi)] + by_cases h0 : n = 0 + · subst h0 + simp + rw [ih (i - n) (by omega)] + conv_rhs => rw [hs] + rw [hp] + +theorem region_succ_ne (hc : IsHubCollar Γ Γ' H r n v a s P ε h) (i : ℕ) : P i ≠ P (i + 1) := by + intro heq + have hn := hc.two_le + have h₁ : P (i % n) = P ((i + 1) % n) := by + rw [mod_eq hc.per_P, mod_eq hc.per_P] + exact heq + have h₂ := hc.inj _ _ (Nat.mod_lt _ hc.pos) (Nat.mod_lt _ hc.pos) h₁ + rw [Nat.add_mod] at h₂ + rcases Nat.lt_or_ge (i % n + 1) n with h₃ | h₃ + · rw [show 1 % n = 1 from Nat.mod_eq_of_lt (by omega), Nat.mod_eq_of_lt h₃] at h₂ + omega + · have h₄ : i % n + 1 = n := by + have := Nat.mod_lt i hc.pos + omega + rw [show 1 % n = 1 from Nat.mod_eq_of_lt (by omega), h₄, Nat.mod_self] at h₂ + omega + +/-- Start the collar one step later. -/ +theorem shift (hc : IsHubCollar Γ Γ' H r n v a s P ε h) : + ∃ h' : C(Circle × I, S), IsHubCollar Γ Γ' H r n (fun i => v (i + 1)) (fun i => a (i + 1)) + (fun i => s (i + 1)) (fun i => P (i + 1)) (fun i => ε (i + 1)) h' ∧ + (∀ z t, h' (z, t) = h (z * Circle.exp (2 * Real.pi / n), t)) := by + have hn := hc.pos + have hcn : (0 : ℝ) < n := by exact_mod_cast hn + let h' : C(Circle × I, S) := ⟨fun p => h (p.1 * Circle.exp (2 * Real.pi / n), p.2), by fun_prop⟩ + have hexp : ∀ (i : ℕ) (u : I), Circle.exp (2 * Real.pi * ((i + u.1) / n)) * Circle.exp + (2 * Real.pi / n) = + Circle.exp (2 * Real.pi * (((i + 1 : ℕ) + u.1) / n)) := by + intro i u + rw [← Circle.exp_add] + congr 1 + push_cast + field_simp + ring + have hmul : ∀ {z z' : Circle}, z * Circle.exp (2 * Real.pi / n) = z' * Circle.exp + (2 * Real.pi / n) → z = z' := + fun h => mul_right_cancel h + refine ⟨h', ?_, fun _ _ => rfl⟩ + have hbij : Function.Bijective fun p : Circle × I => (p.1 * Circle.exp (2 * Real.pi / n), p.2) + := by + refine ⟨fun p q h => ?_, fun q => ⟨(q.1 * (Circle.exp (2 * Real.pi / n))⁻¹, q.2), ?_⟩⟩ + · have h₁ := congrArg Prod.fst h + have h₂ := congrArg Prod.snd h + exact Prod.ext (hmul h₁) h₂ + · simp + let g : Circle × I → Circle × I := fun p => (p.1 * Circle.exp (2 * Real.pi / n), p.2) + have himg : ∀ T : Set I, h' '' {p | p.2 ∈ T} = h '' {p | p.2 ∈ T} := by + intro T + ext x + constructor + · rintro ⟨p, hp, rfl⟩ + exact ⟨g p, hp, rfl⟩ + · rintro ⟨p, hp, rfl⟩ + obtain ⟨q, rfl⟩ := hbij.2 p + exact ⟨q, hp, rfl⟩ + refine ⟨hc.two_le, fun i => ?_, fun i => ?_, fun i => ?_, fun i => ?_, fun i => ?_, + fun i => hc.edge _, + fun i => hc.vertex _, fun i => hc.cap _, fun i => hc.ne _, fun i => hc.spoke _, + fun i => hc.spoke_cap _, fun i => hc.region _, fun i => hc.region_sub _, fun i => hc.edge_cl _, + fun i => hc.spoke_cl _, ?_, ?_, fun i => hc.ε_cont _, fun i => hc.ε_inj _, fun i => hc.ε_zero _, + fun i => hc.ε_one _, fun i => hc.ε_range _, ?_, ?_, ?_, ?_, ?_⟩ + · simp only [show i + n + 1 = (i + 1) + n by omega, hc.per_v] + · simp only [show i + n + 1 = (i + 1) + n by omega, hc.per_a] + · simp only [show i + n + 1 = (i + 1) + n by omega, hc.per_s] + · simp only [show i + n + 1 = (i + 1) + n by omega, hc.per_P] + · simp only [show i + n + 1 = (i + 1) + n by omega, hc.per_ε] + · intro i j hi hj heq + have h₁ : P ((i + 1) % n) = P ((j + 1) % n) := by + rw [mod_eq hc.per_P, mod_eq hc.per_P] + exact heq + have h₂ := hc.inj _ _ (Nat.mod_lt _ hn) (Nat.mod_lt _ hn) h₁ + have h₃ : (i + 1) ≡ (j + 1) [MOD n] := h₂ + have h₄ : i ≡ j [MOD n] := Nat.ModEq.add_right_cancel' 1 h₃ + exact Nat.ModEq.eq_of_lt_of_lt h₄ hi hj + · intro p hp hpr + obtain ⟨i, hi, rfl⟩ := hc.all p hp hpr + by_cases h0 : i = 0 + · subst h0 + exact ⟨n - 1, by omega, by + rw [show n - 1 + 1 = 0 + n by omega, hc.per_P]⟩ + · exact ⟨i - 1, by omega, by + rw [show i - 1 + 1 = i by omega]⟩ + · intro i hi u + change h (_ * _, 0) = _ + rw [hexp] + by_cases hi' : i + 1 < n + · exact hc.bottom _ hi' u + · have hin : i + 1 = n := by omega + rw [hin] + have := hc.bottom 0 hn u + rw [show (((n : ℕ) : ℝ) + u.1) / n = (((0 : ℕ) : ℝ) + u.1) / n + 1 by + simp only [Nat.cast_zero, zero_add] + field_simp + ring, mul_add, mul_one, Circle.exp_add, Circle.exp_two_pi, mul_one, this] + have h₂ := hc.per_ε 0 + rw [zero_add] at h₂ + rw [h₂] + · rintro p hp q hq heq + have := hc.injOn (show g p ∈ {p | 0 < p.2} from hp) (show g q ∈ {p | 0 < p.2} from hq) heq + exact hbij.1 this + · intro p hp + exact hc.mem_r (g p) hp + · rw [← hc.range_bottom] + ext x + constructor + · rintro ⟨z, rfl⟩ + exact ⟨z * Circle.exp (2 * Real.pi / n), rfl⟩ + · rintro ⟨z, rfl⟩ + refine ⟨z * (Circle.exp (2 * Real.pi / n))⁻¹, ?_⟩ + change h (_ * _, 0) = _ + simp + · have := himg (Iio 1) + change rᶜ ∪ h' '' {p | p.2 ∈ Iio 1} |> IsOpen + rw [this] + exact hc.isOpen + +end IsHubCollar + +variable [T2Space S] [ConnectedSpace S] {Γ Γ' : Drawing S} + +omit [T2Space S] [ConnectedSpace S] in +/-- No set is an edge of both `Γ` and its radial drawing. -/ +theorem not_both_edge (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') {e : Set S} (he : e ∈ Γ.E) + (he' : e ∈ Γ'.E) : False := by + obtain ⟨x, hx⟩ := he.1 + have hxU : x ∈ Γ.U ∩ Γ'.U := ⟨(he.2.1 hx).1, (he'.2.1 hx).1⟩ + rw [radial_inter hrad] at hxU + exact (he.2.1 hx).2 hxU + +omit [ConnectedSpace S] in +/-- An edge with two different ends has only one half-edge at a vertex. -/ +theorem half_eq (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') {γ : Set S → I → S} + (hγ : EdgePar (radialUnion hrad) γ) {x : S} {k k' : halfEdges (radialUnion hrad) γ x} + (hke : k.1.1 = k'.1.1) (_he : k.1.1 ∈ Γ.E) (hne : ∃ a b, a ≠ b ∧ closure k.1.1 ∩ Γ.V = {a, b}) : + k = k' := by + obtain ⟨a, b, hab, hcap⟩ := hne + apply Subtype.ext + refine Prod.ext hke ?_ + by_contra hbb + have h₁ : γ k.1.1 (endOf k.1.2) = x := k.2.2 + have h₂ : γ k.1.1 (endOf k'.1.2) = x := by + rw [hke] + exact k'.2.2 + have hall : ∀ c, γ k.1.1 (endOf c) = x := by + intro c + have : c = k.1.2 ∨ c = k'.1.2 := by + cases c <;> cases hk : k.1.2 <;> cases hk' : k'.1.2 <;> simp_all + rcases this with rfl | rfl + · exact h₁ + · exact h₂ + have hcapH := closure_inter_V_eq hγ k.2.1 + have hmem : ∀ z, z ∈ closure k.1.1 ∩ Γ.V → z = x := by + intro z hz + have hzH : z ∈ closure k.1.1 ∩ (radialUnion hrad).V := by + refine ⟨hz.1, ?_⟩ + rw [radialUnion_V] + exact radial_V hrad hz.2 + rw [hcapH] at hzH + rcases hzH with h | h + · exact h.trans (hall _) + · exact (mem_singleton_iff.mp h).trans (hall _) + have ha : a ∈ closure k.1.1 ∩ Γ.V := by rw [hcap]; simp + have hb : b ∈ closure k.1.1 ∩ Γ.V := by rw [hcap]; simp + exact hab ((hmem a ha).trans (hmem b hb).symm) + +/-- **The collar does not turn back** at a vertex with another edge. -/ +theorem collar_turn (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') (hS : IsClosedSurface S) + (hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ') (hE : Γ.E.Nonempty) + (hloop : ∀ e ∈ Γ.E, ∃ x y, x ≠ y ∧ closure e ∩ Γ.V = {x, y}) {r : Set S} {n : ℕ} {v : ℕ → S} + {a s P : ℕ → Set S} {ε : ℕ → I → S} {h : C(Circle × I, S)} + (hc : IsHubCollar Γ Γ' (radialUnion hrad) r n v a s P ε h) (i : ℕ) {g : Set S} (hg : g ∈ Γ.E) + (hvg : v (i + 1) ∈ closure g) (hga : g ≠ a i) : a (i + 1) ≠ a i := by + classical + intro heq + have hne : Nonempty S := ⟨v 0⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar (radialUnion hrad) + set x := v (i + 1) with hx + have hxV : x ∈ Γ.V := hc.vertex _ + have hxH : x ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact radial_V hrad hxV + obtain ⟨next, ρ, Pc, Wc, Qc, τc, hsec⟩ := exists_sectors hS _ hγ hxH + (two_half_edges hrad hS hmax hE hγ hxV) + have hcor := IsSectors.corners hsec + obtain ⟨c, -, hcap⟩ := hc.spoke_cap (i + 1) + have hxs : x ∈ closure (s (i + 1)) := by + have : x ∈ closure (s (i + 1)) ∩ Γ'.V := by rw [hcap]; simp [hx] + exact this.1 + have hsH : s (i + 1) ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inr (hc.spoke _) + obtain ⟨b, hb⟩ := exists_end_eq hγ hsH hxH hxs + let φ : halfEdges (radialUnion hrad) γ x := ⟨(s (i + 1), b), hsH, hb⟩ + obtain ⟨k', hk'⟩ := next_surjective hcor φ + have hφs : φ.1.1 = s (i + 1) := rfl + have e₁ := IsCorners.sides hcor k' (P i) (hc.region i) (by rw [hk']; exact (hc.spoke_cl i).2) + have e₂ := IsCorners.sides hcor k' (P (i + 1)) (hc.region _) (by rw [hk']; exact + (hc.spoke_cl _).1) + rw [hk'] at e₁ e₂ + have hPne := hc.region_succ_ne i + have halt₁ := corner_alternates hrad hS hmax hE hγ hxV hsec k' + have halt₂ := corner_alternates hrad hS hmax hE hγ hxV hsec φ + rw [hk'] at halt₁ + have hk'E : k'.1.1 ∈ Γ.E := by + rcases halt₁ with h' | h' + · exact (not_both_edge hrad h'.2 (hc.spoke _)).elim + · exact h'.1 + have hnE : (next φ).1.1 ∈ Γ.E := by + rcases halt₂ with h' | h' + · exact h'.2 + · exact (not_both_edge hrad h'.1 (hc.spoke _)).elim + have hcl₁ : k'.1.1 ⊆ closure (ρ k') := by + obtain ⟨l, hl⟩ := next_surjective hcor k' + have := IsCorners.right hcor l + rwa [hl] at this + have hcl₂ : (next φ).1.1 ⊆ closure (ρ φ) := IsCorners.left hcor φ + have hae₁ : a i ⊆ closure (P i) := hc.edge_cl i + have hae₂ : a i ⊆ closure (P (i + 1)) := heq ▸ hc.edge_cl (i + 1) + have hρ₁ : a i ⊆ closure (ρ k') := by + rcases e₁ with h₁ | h₁ + · exact h₁ ▸ hae₁ + · rcases e₂ with h₂ | h₂ + · exact h₂ ▸ hae₂ + · exact (hPne (h₁.trans h₂.symm)).elim + have hρ₂ : a i ⊆ closure (ρ φ) := by + rcases e₁ with h₁ | h₁ + · rcases e₂ with h₂ | h₂ + · exact (hPne (h₁.trans h₂.symm)).elim + · exact h₂ ▸ hae₂ + · exact h₁ ▸ hae₁ + obtain ⟨e₀, he₀, -, huniq, -⟩ := face_edge hrad hS hmax hE (IsCorners.region hcor k') + obtain ⟨e₃, he₃, -, huniq', -⟩ := face_edge hrad hS hmax hE (IsCorners.region hcor φ) + have h₁ : k'.1.1 = a i := (huniq _ hk'E hcl₁).trans (huniq _ (hc.edge i) hρ₁).symm + have h₂ : (next φ).1.1 = a i := (huniq' _ hnE hcl₂).trans (huniq' _ (hc.edge i) hρ₂).symm + have hnk : next φ = k' := half_eq hrad hγ (h₂.trans h₁.symm) hnE (hloop _ hnE) + have hall : ∀ z, z = φ ∨ z = k' := by + intro z + have hreach := IsCorners.reach hcor φ z + induction hreach with + | refl => exact Or.inl rfl + | tail _ h ih => + rcases ih with rfl | rfl + · exact Or.inr (h.trans hnk) + · exact Or.inl (h.trans hk') + have hgH : g ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inl hg + obtain ⟨b', hb'⟩ := exists_end_eq hγ hgH hxH hvg + rcases hall ⟨(g, b'), hgH, hb'⟩ with h₃ | h₃ + · have : g = s (i + 1) := congrArg (fun z => z.1.1) h₃ + exact not_both_edge hrad hg (this ▸ hc.spoke _) + · have : g = k'.1.1 := congrArg (fun z => z.1.1) h₃ + exact hga (this.trans h₁) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/LeafNbhd.lean b/LeanPool/GraphMinor/GM11/LeafNbhd.lean new file mode 100644 index 0000000000..bc9a75233d --- /dev/null +++ b/LeanPool/GraphMinor/GM11/LeafNbhd.lean @@ -0,0 +1,385 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Forest +import LeanPool.GraphMinor.GM11.PlaneFacts + +/-! +# The neighbourhood of a leaf + +Let `v` be a vertex of a drawing in a closed surface that is an end of just one edge `e`, and let +`e` not be a loop. Then `v` has an open neighbourhood `Z` such that any two points of `Z - U(Γ)` lie +in one connected subset of `Σ - U(Γ)` (`exists_leaf_nbhd`). So only one region reaches `v`. + +The proof works in a chart. Let `D` be a small round disc around `v`. Let `J` be the end piece of +`e` from its last entry into `D` to `v`, and let `K` be the union of the circle `bd(D)` with the +rest of `e` in `D`. Then `J` is an arc, so it does not separate the plane, and points near `v` lie +in one component of the complement of `K`, as `K` misses a small ball around `v`. Moreover `J ∩ K` +is one point. Janiszewski's theorem now says that `J ∪ K` does not separate points near `v`, and the +component of its complement stays inside `D`. +-/ + +public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The affine map of the unit interval onto a closed subinterval. -/ +theorem exists_reparam {a b : unitInterval} (hab : a < b) : + ∃ ρ : unitInterval → unitInterval, Continuous ρ ∧ Function.Injective ρ ∧ + range ρ = Icc a b ∧ ρ 0 = a ∧ ρ 1 = b := by + have habR : (a : ℝ) < b := hab + have hρmem : ∀ u : unitInterval, (a : ℝ) + u.1 * (b - a) ∈ Set.Icc (0 : ℝ) 1 := by + intro u + have hu₀ := u.2.1 + have hu₁ := u.2.2 + have ha' := a.2.1 + have hb' := b.2.2 + constructor + · have : 0 ≤ u.1 * ((b : ℝ) - a) := mul_nonneg hu₀ (by linarith) + linarith + · have : u.1 * ((b : ℝ) - a) ≤ 1 * ((b : ℝ) - a) := + mul_le_mul_of_nonneg_right hu₁ (by linarith) + linarith + let ρ : unitInterval → unitInterval := fun u => ⟨(a : ℝ) + u.1 * (b - a), hρmem u⟩ + refine ⟨ρ, ?_, ?_, ?_, Subtype.ext (by simp [ρ]), Subtype.ext (by simp [ρ])⟩ + · refine Continuous.subtype_mk ?_ _ + fun_prop + · intro u v h + have h₁ : (a : ℝ) + u.1 * (b - a) = a + v.1 * (b - a) := congrArg Subtype.val h + have hd : ((b : ℝ) - a) ≠ 0 := by linarith + exact Subtype.ext (mul_right_cancel₀ hd (add_left_cancel h₁)) + · ext t + constructor + · rintro ⟨u, rfl⟩ + have hu₀ := u.2.1 + have hu₁ := u.2.2 + constructor + · have : 0 ≤ u.1 * ((b : ℝ) - a) := mul_nonneg hu₀ (by linarith) + exact Subtype.mk_le_mk.mpr (by linarith) + · have : u.1 * ((b : ℝ) - a) ≤ 1 * ((b : ℝ) - a) := + mul_le_mul_of_nonneg_right hu₁ (by linarith) + exact Subtype.mk_le_mk.mpr (by linarith) + · intro ht + have ht₁ : (a : ℝ) ≤ t := ht.1 + have ht₂ : (t : ℝ) ≤ b := ht.2 + have hd : (0 : ℝ) < b - a := by linarith + have hu : ((t : ℝ) - a) / (b - a) ∈ Set.Icc (0 : ℝ) 1 := + ⟨div_nonneg (by linarith) hd.le, (div_le_one hd).mpr (by linarith)⟩ + refine ⟨⟨_, hu⟩, Subtype.ext ?_⟩ + change (a : ℝ) + ((t : ℝ) - a) / (b - a) * (b - a) = t + field_simp + ring + +variable [T2Space S] + +private theorem drawing_off_leaf_closed (Γ : Drawing S) {e : Set S} {v : S} + (hv : v ∈ closure e) (hleaf : ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f) : + let Bad : Set S := (Γ.V \ {v}) ∪ ⋃ g ∈ Γ.E \ {e}, closure g + IsClosed Bad ∧ v ∉ Bad ∧ (∀ x ∈ Γ.U, x ∈ Bad ∨ x ∈ closure e) := by + intro Bad + have hBad : IsClosed Bad := + (Γ.finite_V.subset sdiff_subset).isClosed.union + ((Γ.finite_edges.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure) + have hvBad : v ∉ Bad := by + rintro (h | h) + · exact h.2 rfl + · obtain ⟨g, ⟨hg, hge⟩, hvg⟩ := mem_iUnion₂.mp h + exact hleaf g hg hge hvg + have hUsub : ∀ x ∈ Γ.U, x ∈ Bad ∨ x ∈ closure e := by + intro x hx + rw [Γ.U_eq] at hx + rcases hx with hx | hx + · by_cases hxv : x = v + · exact Or.inr (hxv ▸ hv) + · exact Or.inl (Or.inl ⟨hx, hxv⟩) + · obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp hx + by_cases hge : g = e + · exact Or.inr (hge ▸ hxg) + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨g, ⟨hg, hge⟩, hxg⟩)) + exact ⟨hBad, hvBad, hUsub⟩ + +omit [T2Space S] in +private theorem exists_last_exit {φ : unitInterval → S} (hφ : Continuous φ) + {U C : Set S} (hU : IsOpen U) (hC : IsClosed C) (hUC : U ⊆ C) + (h0 : φ 0 ∉ U) (h1 : φ 1 ∈ U) : + ∃ a : unitInterval, φ a ∉ U ∧ a < 1 ∧ (∀ t, a < t → φ t ∈ U) ∧ φ a ∈ C := by + have hC₁ : IsCompact {t : unitInterval | φ t ∉ U} := + (hU.isClosed_compl.preimage hφ).isCompact + obtain ⟨a, ha, hamax⟩ := hC₁.exists_isGreatest + ⟨0, h0⟩ + have ha1 : a < 1 := lt_of_le_of_ne (unitInterval.le_one _) fun h' => ha (h' ▸ h1) + have hlate : ∀ t, a < t → φ t ∈ U := by + intro t ht + by_contra hcon + exact absurd (hamax hcon) (not_le.mpr ht) + have hφaBC : φ a ∈ C := by + have h₁ : a ∈ closure (Ioi a) := by + rw [closure_Ioi' (⟨1, ha1⟩ : (Ioi a).Nonempty)] + exact self_mem_Ici + have h₂ : φ a ∈ closure (φ '' Ioi a) := image_closure_subset_closure_image hφ ⟨a, h₁, rfl⟩ + refine hC.closure_subset_iff.mpr ?_ h₂ + rintro _ ⟨t, ht, rfl⟩ + exact hUC (hlate t ht) + exact ⟨a, ha, ha1, hlate, hφaBC⟩ + +private theorem preconnected_subset_ball_of_disjoint_sphere {C : Set EuclideanPlane} + {c x : EuclideanPlane} {r : ℝ} (hconn : IsPreconnected C) + (havoid : Disjoint C (Metric.sphere c r)) (hx : x ∈ C) (hxb : x ∈ Metric.ball c r) : + C ⊆ Metric.ball c r := by + refine hconn.subset_left_of_subset_union Metric.isOpen_ball + (show IsOpen (Metric.closedBall (c : EuclideanPlane) r)ᶜ from + Metric.isClosed_closedBall.isOpen_compl) ?_ ?_ ⟨x, hx, hxb⟩ + · exact disjoint_left.mpr fun z hz h' => h' (Metric.ball_subset_closedBall hz) + · intro z hz + by_cases hzb : z ∈ Metric.ball (c : EuclideanPlane) r + · exact Or.inl hzb + · refine Or.inr fun hzc => ?_ + have h₁ : dist z c = r := + le_antisymm hzc (not_lt.mp hzb) + exact Set.disjoint_left.1 havoid hz h₁ + +private theorem isCompact_preimage_closedBall {c : EuclideanPlane} {r : ℝ} + (hin : Metric.closedBall c r ⊆ OpenUnitDisc) : + IsCompact (Subtype.val ⁻¹' Metric.closedBall c r : Set OpenUnitDisc) := by + refine IsInducing.subtypeVal.isCompact_iff.mpr ?_ + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hin] + exact isCompact_closedBall _ _ + +private theorem mem_connectedComponentIn_compl_union_of_ball + {K J : Set EuclideanPlane} {c x y : EuclideanPlane} {r : ℝ} + (hK : IsCompact K) (hJ : IsCompact J) (hKJ : IsPreconnected (K ∩ J)) + (hline : IsLine J) (hsmall : Metric.ball c r ⊆ Kᶜ) + (hx : x ∈ Metric.ball c r) (hy : y ∈ Metric.ball c r) + (hxnot : x ∉ K ∪ J) (hynot : y ∉ K ∪ J) : + y ∈ connectedComponentIn (K ∪ J)ᶜ x := by + have hsameK : y ∈ connectedComponentIn Kᶜ x := + (convex_ball _ _).isPreconnected.subset_connectedComponentIn hx hsmall hy + have hsameJ : y ∈ connectedComponentIn Jᶜ x := + (isPreconnected_compl_of_isLine hline).subset_connectedComponentIn + (fun h => hxnot (Or.inr h)) subset_rfl (fun h => hynot (Or.inr h)) + exact janiszewski_plane hK hJ hKJ hxnot hynot hsameK hsameJ + +/-- Near a leaf only one region is present. See the module docstring for the proof. -/ +theorem exists_leaf_nbhd (hS : IsClosedSurface S) (Γ : Drawing S) {e : Set S} (he : e ∈ Γ.E) + {u v : S} (huv : u ≠ v) (hcap : closure e ∩ Γ.V = {u, v}) (hL : IsLineWithEnds (closure e) u v) + (hleaf : ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f) {N : Set S} (hN : IsOpen N) (hvN : v ∈ N) : + ∃ Z : Set S, IsOpen Z ∧ v ∈ Z ∧ ∀ x ∈ Z, x ∉ Γ.U → ∀ y ∈ Z, y ∉ Γ.U → + ∃ A : Set S, IsPreconnected A ∧ Disjoint A Γ.U ∧ x ∈ A ∧ y ∈ A ∧ A ⊆ N := by + obtain ⟨f, hf0, hf1⟩ := hL + let φ : unitInterval → S := fun t => (f t).1 + have hφ : Continuous φ := continuous_subtype_val.comp f.continuous + have hφinj : Function.Injective φ := fun s t h => f.injective (Subtype.ext h) + have hφr : ∀ x ∈ closure e, ∃ t, φ t = x := fun x hx => ⟨f.symm ⟨x, hx⟩, by simp [φ]⟩ + have huV : u ∈ Γ.V := by + have : u ∈ closure e ∩ Γ.V := by rw [hcap]; simp + exact this.2 + -- The closed set `Bad`: what `U(Γ)` has besides the closure of `e`. + let Bad : Set S := (Γ.V \ {v}) ∪ ⋃ g ∈ Γ.E \ {e}, closure g + have hvClosure : v ∈ closure e := hf1 ▸ (f 1).2 + obtain ⟨hBad, hvBad, hUsub⟩ := drawing_off_leaf_closed Γ (e := e) hvClosure hleaf + change IsClosed Bad at hBad + change v ∉ Bad at hvBad + have huBad : u ∈ Bad := Or.inl ⟨huV, huv⟩ + -- A chart around `v`. + obtain ⟨V₀, hV₀, hvV₀, ⟨h⟩⟩ := hS.2.2 v + let T : OpenUnitDisc → S := fun y => (h.symm y).1 + have hT : Continuous T := continuous_subtype_val.comp h.symm.continuous + have hTinj : Function.Injective T := fun x y hxy => h.symm.injective (Subtype.ext hxy) + have hTopen : IsOpenMap T := + hV₀.isOpenEmbedding_subtypeVal.isOpenMap.comp h.symm.isOpenMap + have hTV : ∀ y, T y ∈ V₀ := fun y => (h.symm y).2 + have hTh : ∀ (x : S) (hx : x ∈ V₀), T (h ⟨x, hx⟩) = x := by intro x hx; simp [T] + have hhT : ∀ y, h ⟨T y, hTV y⟩ = y := by intro y; simp [T] + let c : OpenUnitDisc := h ⟨v, hvV₀⟩ + have hTc : T c = v := hTh v hvV₀ + let Pb : Set OpenUnitDisc := {y | T y ∉ Bad ∧ T y ∈ N} + have hPb : IsOpen Pb := (hBad.isOpen_compl.inter hN).preimage hT + have hPb' : IsOpen (Subtype.val '' Pb : Set EuclideanPlane) := + Metric.isOpen_ball.isOpenEmbedding_subtypeVal.isOpenMap _ hPb + have hcPb : (c : EuclideanPlane) ∈ (Subtype.val '' Pb : Set EuclideanPlane) := + ⟨c, by simpa [Pb, hTc] using ⟨hvBad, hvN⟩, rfl⟩ + obtain ⟨ρ', hρ', hball⟩ := Metric.isOpen_iff.mp hPb' _ hcPb + let ρ₀ : ℝ := ρ' / 2 + have hρ₀ : 0 < ρ₀ := half_pos hρ' + have hCB : Metric.closedBall (c : EuclideanPlane) ρ₀ ⊆ Subtype.val '' Pb := + (Metric.closedBall_subset_ball (half_lt_self hρ')).trans hball + have hCBo : ∀ z ∈ Metric.closedBall (c : EuclideanPlane) ρ₀, z ∈ OpenUnitDisc := by + intro z hz + obtain ⟨y, -, rfl⟩ := hCB hz + exact y.2 + have hCBgood : ∀ z (hz : z ∈ Metric.closedBall (c : EuclideanPlane) ρ₀), + T ⟨z, hCBo z hz⟩ ∉ Bad := by + intro z hz + obtain ⟨y, hy, rfl⟩ := hCB hz + exact hy.1 + -- The images of the open and the closed round disc. + let BO : Set OpenUnitDisc := Subtype.val ⁻¹' Metric.ball (c : EuclideanPlane) ρ₀ + have hBO : IsOpen BO := Metric.isOpen_ball.preimage continuous_subtype_val + have hYO : IsOpen (T '' BO) := hTopen _ hBO + let BC : Set OpenUnitDisc := Subtype.val ⁻¹' Metric.closedBall (c : EuclideanPlane) ρ₀ + have hBCcpt : IsCompact BC := isCompact_preimage_closedBall hCBo + have hYC : IsClosed (T '' BC) := (hBCcpt.image hT).isClosed + have hBOC : BO ⊆ BC := fun y hy => Metric.ball_subset_closedBall hy + -- The last time `a` when `φ` is outside the small open disc. + have hφ0 : φ 0 = u := hf0 + have hφ1 : φ 1 = v := hf1 + have huBC : u ∉ T '' BC := by + rintro ⟨y, hy, hyu⟩ + exact hCBgood y.1 hy (by simpa [hyu] using huBad) + have hcBO : c ∈ BO := by simp [BO, hρ₀] + have hvYO : v ∈ T '' BO := ⟨c, hcBO, hTc⟩ + obtain ⟨a, ha, ha1, hlate, hφaBC⟩ := + exists_last_exit hφ hYO hYC (image_mono hBOC) (fun h' => huBC (hφ0 ▸ image_mono hBOC h')) + (hφ1.symm ▸ hvYO) + -- The end piece `J`, as a curve `ψ` in the plane. + obtain ⟨σ, hσ, hσinj, hσr, hσ0, hσ1⟩ := exists_reparam ha1 + have hσa : ∀ s, a ≤ σ s := fun s => (show σ s ∈ Icc a 1 from hσr ▸ mem_range_self s).1 + have hkBC : ∀ s, φ (σ s) ∈ T '' BC := by + intro s + rcases eq_or_lt_of_le (hσa s) with h' | h' + · rw [← h'] + exact hφaBC + · exact image_mono hBOC (hlate _ h') + have hkV : ∀ s, φ (σ s) ∈ V₀ := by + intro s + obtain ⟨y, -, hy⟩ := hkBC s + exact hy ▸ hTV y + let ψ : unitInterval → EuclideanPlane := fun s => (h ⟨φ (σ s), hkV s⟩).1 + have hψ : Continuous ψ := by + refine continuous_subtype_val.comp (h.continuous.comp ?_) + exact Continuous.subtype_mk (hφ.comp hσ) _ + have hψinj : Function.Injective ψ := by + intro s s' hss + have h₁ := h.injective (Subtype.ext hss) + have h₂ : φ (σ s) = φ (σ s') := congrArg (fun z : V₀ => z.1) h₁ + exact hσinj (hφinj h₂) + have hTψ : ∀ s, T (h ⟨φ (σ s), hkV s⟩) = φ (σ s) := fun s => hTh _ _ + have hψBC : ∀ s, ψ s ∈ Metric.closedBall (c : EuclideanPlane) ρ₀ := by + intro s + obtain ⟨y, hy, hyeq⟩ := hkBC s + have : h ⟨φ (σ s), hkV s⟩ = y := hTinj ((hTψ s).trans hyeq.symm) + change (h ⟨φ (σ s), hkV s⟩ : EuclideanPlane) ∈ _ + rw [this] + exact hy + have hψBO : ∀ s, a < σ s → ψ s ∈ Metric.ball (c : EuclideanPlane) ρ₀ := by + intro s hs + obtain ⟨y, hy, hyeq⟩ := hlate _ hs + have : h ⟨φ (σ s), hkV s⟩ = y := hTinj ((hTψ s).trans hyeq.symm) + change (h ⟨φ (σ s), hkV s⟩ : EuclideanPlane) ∈ _ + rw [this] + exact hy + have hJline : IsLine (range ψ) := by + refine ⟨Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofInjective ψ hψinj) + hψ.rangeFactorization⟩ + -- The set `M`: the rest of `e` in the closed round disc, and `K`. + let M : Set EuclideanPlane := Subtype.val '' (BC ∩ T ⁻¹' (φ '' Iic a)) + have hMcpt : IsCompact M := by + have hcl : IsClosed (φ '' Iic a) := (isClosed_Iic.isCompact.image hφ).isClosed + have : IsCompact (BC ∩ T ⁻¹' (φ '' Iic a)) := hBCcpt.inter_right (hcl.preimage hT) + exact this.image continuous_subtype_val + let K : Set EuclideanPlane := Metric.sphere (c : EuclideanPlane) ρ₀ ∪ M + have hKcpt : IsCompact K := (isCompact_sphere _ _).union hMcpt + have hKJ : K ∩ range ψ = {ψ 0} := by + ext x + constructor + · rintro ⟨hxK, s, rfl⟩ + have hs : σ s = a := by + by_contra hne + have hlt : a < σ s := lt_of_le_of_ne (hσa s) (Ne.symm hne) + rcases hxK with hxK | ⟨z, ⟨-, t, ht, htz⟩, hzs⟩ + · have h₁ := hψBO s hlt + exact absurd hxK (ne_of_lt (Metric.mem_ball.mp h₁)) + · have hzeq : z = h ⟨φ (σ s), hkV s⟩ := Subtype.ext hzs + have h₁ : φ t = φ (σ s) := by rw [htz, hzeq, hTψ] + have h₂ : t = σ s := hφinj h₁ + exact absurd (h₂ ▸ ht) (not_le.mpr hlt) + have : s = 0 := hσinj (hs.trans hσ0.symm) + rw [this] + exact rfl + · intro hx + rw [mem_singleton_iff.mp hx] + refine ⟨Or.inr ⟨h ⟨φ (σ 0), hkV 0⟩, ⟨hψBC 0, a, le_refl a, ?_⟩, rfl⟩, mem_range_self 0⟩ + rw [hTψ, hσ0] + have hKJconn : IsPreconnected (K ∩ range ψ) := hKJ ▸ isPreconnected_singleton + have hcK : (c : EuclideanPlane) ∉ K := by + rintro (h' | ⟨z, ⟨-, t, ht, htz⟩, hzc⟩) + · have : dist (c : EuclideanPlane) c = ρ₀ := h' + rw [dist_self] at this + exact hρ₀.ne this + · have hzeq : z = c := Subtype.ext hzc + have h₁ : φ t = φ 1 := by rw [htz, hzeq, hTc, hφ1] + have h₂ : t = 1 := hφinj h₁ + exact absurd (h₂ ▸ ht) (not_le.mpr ha1) + obtain ⟨ρ₂, hρ₂, hballK⟩ := Metric.isOpen_iff.mp hKcpt.isClosed.isOpen_compl _ hcK + let ρ₃ : ℝ := min ρ₂ ρ₀ + have hρ₃ : 0 < ρ₃ := lt_min hρ₂ hρ₀ + have hsmall : Metric.ball (c : EuclideanPlane) ρ₃ ⊆ Kᶜ := + (Metric.ball_subset_ball (min_le_left _ _)).trans hballK + have hsmall₀ : Metric.ball (c : EuclideanPlane) ρ₃ ⊆ Metric.ball (c : EuclideanPlane) ρ₀ := + Metric.ball_subset_ball (min_le_right _ _) + let B₃ : Set OpenUnitDisc := Subtype.val ⁻¹' Metric.ball (c : EuclideanPlane) ρ₃ + refine ⟨T '' B₃, hTopen _ (Metric.isOpen_ball.preimage continuous_subtype_val), + ⟨c, by simp [B₃, hρ₃], hTc⟩, ?_⟩ + rintro _ ⟨x, hx, rfl⟩ hxU _ ⟨y, hy, rfl⟩ hyU + -- Points of the small ball are outside `J`, since they are off `U(Γ)`. + have hoff : ∀ z : OpenUnitDisc, T z ∉ Γ.U → (z : EuclideanPlane) ∉ range ψ := by + rintro z hz ⟨s, hs⟩ + have hzeq : h ⟨φ (σ s), hkV s⟩ = z := Subtype.ext hs + have h₁ : T z = φ (σ s) := by rw [← hzeq, hTψ] + exact hz (h₁ ▸ Γ.closure_subset_U he (f (σ s)).2) + have hxnot : (x : EuclideanPlane) ∉ K ∪ range ψ := + fun h => h.elim (hsmall hx) (hoff x hxU) + have hynot : (y : EuclideanPlane) ∉ K ∪ range ψ := + fun h => h.elim (hsmall hy) (hoff y hyU) + have hsame := mem_connectedComponentIn_compl_union_of_ball hKcpt (isCompact_range hψ) + hKJconn hJline hsmall hx hy hxnot hynot + let Cc : Set EuclideanPlane := connectedComponentIn (K ∪ range ψ)ᶜ (x : EuclideanPlane) + have hCcconn : IsPreconnected Cc := isPreconnected_connectedComponentIn + have hCcsub : Cc ⊆ (K ∪ range ψ)ᶜ := connectedComponentIn_subset _ _ + have hxCc : (x : EuclideanPlane) ∈ Cc := mem_connectedComponentIn hxnot + have hCcball : Cc ⊆ Metric.ball (c : EuclideanPlane) ρ₀ := + preconnected_subset_ball_of_disjoint_sphere hCcconn + (Set.disjoint_left.2 fun _ hz hs => hCcsub hz (Or.inl (Or.inl hs))) hxCc (hsmall₀ hx) + have hCcO : Cc ⊆ OpenUnitDisc := fun z hz => hCBo z (Metric.ball_subset_closedBall (hCcball hz)) + have hconn' : IsPreconnected (Subtype.val ⁻¹' Cc : Set OpenUnitDisc) := by + refine (IsInducing.subtypeVal : + IsInducing (Subtype.val : OpenUnitDisc → EuclideanPlane)).isPreconnected_image.mp ?_ + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hCcO] + exact hCcconn + refine ⟨T '' (Subtype.val ⁻¹' Cc), hconn'.image _ hT.continuousOn, ?_, ⟨x, hxCc, rfl⟩, + ⟨y, hsame, rfl⟩, ?_⟩ + swap + · rintro _ ⟨z, hz, rfl⟩ + obtain ⟨w, hw, hwz⟩ := hCB (Metric.ball_subset_closedBall (hCcball hz)) + have : w = z := Subtype.ext hwz + exact this ▸ hw.2 + refine disjoint_left.mpr ?_ + rintro _ ⟨z, hz, rfl⟩ hzU + have hzB : (z : EuclideanPlane) ∈ Metric.closedBall (c : EuclideanPlane) ρ₀ := + Metric.ball_subset_closedBall (hCcball hz) + rcases hUsub _ hzU with h' | h' + · exact hCBgood z.1 hzB h' + obtain ⟨t, ht⟩ := hφr _ h' + rcases le_or_gt t a with hta | hta + · exact hCcsub hz (Or.inl (Or.inr ⟨z, ⟨hzB, t, hta, ht⟩, rfl⟩)) + · have htm : t ∈ Icc a 1 := ⟨hta.le, unitInterval.le_one _⟩ + rw [← hσr] at htm + obtain ⟨s, rfl⟩ := htm + refine hCcsub hz (Or.inr ⟨s, ?_⟩) + have : h ⟨φ (σ s), hkV s⟩ = z := hTinj ((hTψ s).trans ht) + exact congrArg Subtype.val this + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/LocalCone.lean b/LeanPool/GraphMinor/GM11/LocalCone.lean new file mode 100644 index 0000000000..7c23c62a59 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/LocalCone.lean @@ -0,0 +1,626 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PolarChart +public import LeanPool.GraphMinor.GM11.Corners +public import LeanPool.GraphMinor.GM11.EdgeSides +public import LeanPool.GraphMinor.GM11.Solid +public import LeanPool.GraphMinor.GM11.NiceStatements +import Mathlib.Analysis.Convex.Contractible +import LeanPool.GraphMinor.Surface.ArcTools + +/-! +# Closed nice sets are cones near each point + +`isLocalCone` says that two closed nice sets `X, Y` look like a cone near each point `z` of `X ∪ Y`. +There +is a simply-connected set `K` that contains all of `X ∪ Y` near `z`, and each point of `K` is joined +to `z` +inside `K`, by a path in `X` or by a path in `Y`. + +The proof takes a polar chart at `z`, in which each ray from the centre lies in one atom of the +drawing. A +closed nice set then contains, with each point of the chart, the whole segment from that point to +the +centre. A polar chart exists at a vertex with at least two half-edges (`exists_isPolar_of_sectors`) +and at a +point of an edge (`exists_isPolar_of_edge`). At other points only one region is near `z`, and at +most one +edge, and `isLocalCone` treats them directly. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- `X` and `Y` are a cone at `z`. See the module docstring. -/ +def IsLocalCone (X Y : Set S) (z : S) : Prop := + ∃ O K : Set S, IsOpen O ∧ z ∈ O ∧ (X ∪ Y) ∩ O ⊆ K ∧ K ⊆ X ∪ Y ∧ IsSimplyConnectedSet K ∧ z ∈ K ∧ + ∀ a ∈ K, JoinedIn (K ∩ X) a z ∨ JoinedIn (K ∩ Y) a z + +theorem IsLocalCone.symm {X Y : Set S} {z : S} (h : IsLocalCone X Y z) : IsLocalCone Y X z := by + obtain ⟨O, K, h₁, h₂, h₃, h₄, h₅, h₆, h₇⟩ := h + exact ⟨O, K, h₁, h₂, by rwa [union_comm], by rwa [union_comm], h₅, h₆, fun a ha => (h₇ a ha).symm⟩ + +/-- A simply-connected set inside `X` that contains `X ∪ Y` near `z` makes a cone. -/ +theorem isLocalCone_of_subset {X Y K O : Set S} {z : S} (hK : IsSimplyConnectedSet K) (hKX : K ⊆ X) + (hz : z ∈ K) (hO : IsOpen O) (hzO : z ∈ O) (hsub : (X ∪ Y) ∩ O ⊆ K) : IsLocalCone X Y z := by + refine ⟨O, K, hO, hzO, hsub, hKX.trans subset_union_left, hK, hz, fun a ha => Or.inl ?_⟩ + exact ((hK.1.joinedIn a ha z hz).mono fun x hx => ⟨hx, hKX hx⟩) + +theorem isSimplyConnected_singleton (z : S) : IsSimplyConnectedSet ({z} : Set S) := by + refine ⟨isPathConnected_singleton z, fun φ hφ => ⟨z, rfl, ⟨ContinuousMap.const _ z, + fun _ => rfl, fun x => ?_, + fun _ => rfl⟩⟩⟩ + exact (hφ (mem_range_self x)).symm + +/-- A line is simply-connected. -/ +theorem IsLine.isSimplyConnected {L : Set S} (h : IsLine L) : IsSimplyConnectedSet L := by + obtain ⟨f⟩ := h + have hne : L.Nonempty := ⟨(f 0).1, (f 0).2⟩ + have hc : Continuous fun t : I => (f t).1 := by fun_prop + have hrange : L = range fun t : I => (f t).1 := by + ext x + constructor + · intro hx + exact ⟨f.symm ⟨x, hx⟩, by simp⟩ + · rintro ⟨t, rfl⟩ + exact (f t).2 + have hpc : PathConnectedSpace I := + have : ContractibleSpace I := (convex_Icc (0 : ℝ) 1).contractibleSpace ⟨0, by simp⟩ + inferInstance + refine ⟨hrange ▸ isPathConnected_range hc, fun φ hφ => ?_⟩ + let g : Circle → I := fun z => f.symm ⟨φ z, hφ (mem_range_self z)⟩ + have hg : Continuous g := by fun_prop + refine ⟨(f 0).1, (f 0).2, ⟨⟨fun p => (f (g p.1 * σ p.2)).1, by fun_prop⟩, fun p => (f _).2, + fun x => ?_, + fun x => ?_⟩⟩ + · simp [g] + · simp + +/-! ## Polar charts of a drawing -/ + +/-- A polar chart of `Γ` at `z`: an embedded closed disc with centre `z`, around `z`, such that for +each +point of the disc other than `z`, the segment from that point towards `z` stays in one atom of `Γ`. +-/ +structure IsPolar (Γ : Drawing S) (z : S) (Φ : C(ClosedUnitDisc, S)) : Prop where + inj : Function.Injective Φ + centre : Φ polarCentre = z + nhd : z ∈ interior (range Φ) + ray : ∀ x, x ≠ polarCentre → ∀ c : I, 0 < c → ∃ a ∈ Γ.A, Φ x ∈ a ∧ Φ (discScale c x) ∈ a + +variable [T2Space S] + +/-- The image of a set that is star-shaped about the centre is simply-connected. -/ +theorem isSimplyConnected_star {Φ : C(ClosedUnitDisc, S)} (hΦ : Function.Injective Φ) + {T : Set ClosedUnitDisc} (hT : ∀ x ∈ T, ∀ c : I, discScale c x ∈ T) (hne : T.Nonempty) : + IsSimplyConnectedSet (Φ '' T) := by + obtain ⟨x₀, hx₀⟩ := hne + have hc : polarCentre ∈ T := discScale_zero x₀ ▸ hT x₀ hx₀ 0 + have hcont : Continuous fun p : I × ClosedUnitDisc => Φ (discScale p.1 p.2) := + Φ.continuous.comp continuous_discScale + refine ⟨⟨Φ polarCentre, ⟨_, hc, rfl⟩, ?_⟩, fun φ hφ => ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + have hp : Continuous fun t : I => Φ (discScale t x) := + hcont.comp (Continuous.prodMk continuous_id continuous_const) + refine ⟨⟨⟨fun t => Φ (discScale t x), hp⟩, by simp [discScale_zero], + by simp [discScale_one]⟩, fun t => ?_⟩ + exact ⟨_, hT x hx t, rfl⟩ + · have hemb : IsEmbedding Φ := (Φ.continuous.isClosedEmbedding hΦ).isEmbedding + have hex : ∀ z, ∃ x ∈ T, Φ x = φ z := fun z => hφ (mem_range_self z) + choose ψ hψT hψ using hex + have hψc : Continuous ψ := hemb.continuous_iff.mpr (by + have : (Φ ∘ ψ) = φ := funext hψ + rw [this] + exact φ.continuous) + refine ⟨Φ polarCentre, ⟨_, hc, rfl⟩, ⟨⟨fun p => Φ (discScale (σ p.2) (ψ p.1)), ?_⟩, ?_, ?_, ?_⟩⟩ + · exact hcont.comp (Continuous.prodMk (by fun_prop) (by fun_prop)) + · intro p + exact ⟨_, hT _ (hψT _) _, rfl⟩ + · intro z + change Φ (discScale (σ 0) (ψ z)) = φ z + rw [unitInterval.symm_zero, discScale_one, hψ] + · intro z + change Φ (discScale (σ 1) (ψ z)) = Φ polarCentre + rw [unitInterval.symm_one, discScale_zero] + +omit [T2Space S] in +/-- A closed nice set contains, with each point of a polar chart, the segment to the centre. -/ +theorem IsPolar.star {Γ : Drawing S} {z : S} {Φ : C(ClosedUnitDisc, S)} + (hp : IsPolar Γ z Φ) {Z : Set S} + (hc : IsClosed Z) (hn : IsGammaNice Γ Z) {x : ClosedUnitDisc} (hx : Φ x ∈ Z) (c : I) : + Φ (discScale c x) ∈ Z := by + have hpos : ∀ c : I, 0 < c → Φ (discScale c x) ∈ Z := by + intro c hc₀ + by_cases hxc : x = polarCentre + · have : discScale c x = x := by + subst hxc + exact Subtype.ext (by simp [discScale, polarCentre]) + rwa [this] + · obtain ⟨a, ha, h₁, h₂⟩ := hp.ray x hxc c hc₀ + exact nice_atom hn ha ⟨_, h₁, hx⟩ h₂ + rcases eq_or_lt_of_le (unitInterval.nonneg c) with h0 | h0 + · have hcf : Continuous fun t : I => Φ (discScale t x) := + (Φ.continuous.comp continuous_discScale).comp (Continuous.prodMk continuous_id + continuous_const) + have hcl : IsClosed {t : I | Φ (discScale t x) ∈ Z} := hc.preimage hcf + have hsub : Ioi (0 : I) ⊆ {t : I | Φ (discScale t x) ∈ Z} := fun t ht => hpos t ht + have h₁ := closure_minimal hsub hcl + rw [closure_Ioi' ⟨1, zero_lt_one⟩] at h₁ + have h₂ : c = 0 := Subtype.ext h0.symm + rw [h₂] + exact h₁ (mem_Ici.mpr le_rfl) + · exact hpos c h0 + +theorem IsPolar.isLocalCone {Γ : Drawing S} {z : S} {Φ : C(ClosedUnitDisc, S)} (hp : IsPolar Γ z Φ) + {X Y : Set S} (hX : IsClosed X) (hY : IsClosed Y) (hXn : IsGammaNice Γ X) + (hYn : IsGammaNice Γ Y) + (hz : z ∈ X ∪ Y) : IsLocalCone X Y z := by + let T : Set ClosedUnitDisc := Φ ⁻¹' (X ∪ Y) + have hT : ∀ x ∈ T, ∀ c : I, discScale c x ∈ T := by + intro x hx c + rcases hx with hx | hx + · exact Or.inl (hp.star hX hXn hx c) + · exact Or.inr (hp.star hY hYn hx c) + have hcT : polarCentre ∈ T := by + change Φ polarCentre ∈ X ∪ Y + rw [hp.centre] + exact hz + have hzK : z ∈ Φ '' T := ⟨_, hcT, hp.centre⟩ + have hcont : Continuous fun p : I × ClosedUnitDisc => Φ (discScale p.1 p.2) := + Φ.continuous.comp continuous_discScale + have hjoin : ∀ {Z : Set S}, IsClosed Z → IsGammaNice Γ Z → ∀ x ∈ T, Φ x ∈ Z → + JoinedIn (Φ '' T ∩ Z) (Φ x) z := by + intro Z hc hn x hx hxZ + have hpc : Continuous fun t : I => Φ (discScale (σ t) x) := + hcont.comp (Continuous.prodMk (by fun_prop) continuous_const) + refine ⟨⟨⟨fun t => Φ (discScale (σ t) x), hpc⟩, by simp [discScale_one], + by simp [discScale_zero, hp.centre]⟩, fun t => ?_⟩ + exact ⟨⟨_, hT x hx _, rfl⟩, hp.star hc hn hxZ _⟩ + refine ⟨interior (range Φ), Φ '' T, isOpen_interior, hp.nhd, ?_, ?_, + isSimplyConnected_star hp.inj hT ⟨_, hcT⟩, + hzK, ?_⟩ + · rintro y ⟨hy, hyi⟩ + obtain ⟨x, rfl⟩ := interior_subset hyi + exact ⟨x, hy, rfl⟩ + · rintro _ ⟨x, hx, rfl⟩ + exact hx + · rintro _ ⟨x, hx, rfl⟩ + rcases id hx with hx' | hx' + · exact Or.inl (hjoin hX hXn x hx hx') + · exact Or.inr (hjoin hY hYn x hx hx') + +/-- A fan whose sectors and spokes lie in atoms gives a polar chart. -/ +theorem exists_isPolar_of_fan {H : Type*} [Finite H] [Nonempty H] (hS : IsClosedSurface S) {Γ : + Drawing S} + {next : H → H} {v : S} {s : H → I → S} {Q B : H → Set S} {W : Set S} {τ : H → I} + (hf : IsFan next v s Q B W τ) (hB : ∀ k x y, x ∈ B k → y ∈ B k → ∃ a ∈ Γ.A, x ∈ a ∧ y ∈ a) + (hs : ∀ k (t t' : I), 0 < t → t < 1 → 0 < t' → t' < 1 → ∃ a ∈ Γ.A, s k t ∈ a ∧ s k t' ∈ a) : + ∃ Φ, IsPolar Γ v Φ := by + obtain ⟨Φ, hΦ, hc, -, hray⟩ := exists_polar_of_fan hS hf + refine ⟨Φ, hΦ, hc, ?_, fun x hx c hc₀ => ?_⟩ + · have hemb : IsEmbedding Φ := (Φ.continuous.isClosedEmbedding hΦ).isEmbedding + let e : ClosedUnitDisc ≃ₜ range Φ := hemb.toHomeomorph + have hD : IsClosedDisc (range Φ) := ⟨e⟩ + rw [interior_eq_sdiff_discBd hS hD, disc_boundary (range Φ) e] + refine ⟨⟨_, hc⟩, ?_⟩ + rintro ⟨y, hy, hye⟩ + have hy₀ : y = polarCentre := by + apply hΦ + rw [hc] + exact hye + have : ‖y.1‖ = 1 := mem_sphere_zero_iff_norm.mp hy + rw [hy₀] at this + simp [polarCentre] at this + · rcases hray x hx c hc₀ with ⟨k, h₁, h₂⟩ | ⟨k, t, t', h₁, h₂, h₃, h₄, e₁, e₂⟩ + · exact hB k _ _ h₁ h₂ + · rw [e₁, e₂] + exact hs k t t' h₁ h₂ h₃ h₄ + +/-- A polar chart at a vertex with at least two half-edges. -/ +theorem exists_isPolar_of_sectors (hS : IsClosedSurface S) {Γ : Drawing S} {γ : Set S → I → S} + (hγ : EdgePar Γ γ) {v : S} (hv : v ∈ Γ.V) (h2 : 2 ≤ Nat.card (halfEdges Γ γ v)) : + ∃ Φ, IsPolar Γ v Φ := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨next, ρ, P, W, Q, τ, hsec⟩ := exists_sectors hS Γ hγ hv h2 + have hcor := IsSectors.corners hsec + have hfin : Finite (halfEdges Γ γ v) := (finite_halfEdges Γ γ v).to_subtype + have hne : Nonempty (halfEdges Γ γ v) := (Finite.one_lt_card_iff_nontrivial.mp h2).to_nonempty + have hR : ∀ k, ρ k ∈ Γ.R := IsCorners.region hcor + have hPoff : ∀ k x, x ∈ P k → x ∉ Γ.U := fun k x hx => region_subset (hR k) + (IsSectors.sub hsec k hx) + have hspU : ∀ (i : halfEdges Γ γ v) (t : I), spoke γ i.1 t ∈ Γ.U := by + intro i t + rcases eq_or_lt_of_le (unitInterval.nonneg t) with h0 | h0 + · have : t = 0 := Subtype.ext h0.symm + rw [this, spoke_zero, i.2.2] + exact Γ.V_subset_U hv + · exact (i.2.1.2.1 (spoke_mem_edge hγ i.2.1 h0)).1 + have hspV : ∀ (i : halfEdges Γ γ v), spoke γ i.1 0 = v := fun i => by + rw [spoke_zero] + exact i.2.2 + have hf : IsFan next v (fun i t => spoke γ i.1 t) Q P W τ := by + refine ⟨IsCorners.inj hcor, IsCorners.reach hcor, IsSectors.next_ne hsec, + fun k => continuous_spoke hγ k.2.1, + fun k => spoke_injective hγ k.2.1, hspV, ?_, IsSectors.disc hsec, IsSectors.bd hsec, + IsSectors.isOpen hsec, IsSectors.mem hsec, IsSectors.pos hsec, IsSectors.left hsec, + IsSectors.right hsec, + IsSectors.inside hsec, ?_, fun k i t _ h => hPoff k _ h (hspU i t)⟩ + · intro i j hij t t' ht ht' h + by_contra ht0 + have htp : 0 < t := unitInterval.pos_iff_ne_zero.mpr ht0 + rcases eq_or_lt_of_le (unitInterval.nonneg t') with h0 | h0 + · have ht'0 : t' = 0 := Subtype.ext h0.symm + rw [ht'0, hspV] at h + have hv' : spoke γ i.1 t ∈ Γ.V := by rwa [h] + exact (i.2.1.2.1 (spoke_mem_edge hγ i.2.1 htp)).2 hv' + · have hne' : i.1 ≠ j.1 := fun e => hij (Subtype.ext e) + exact ht.ne (spoke_eq_of_ne hγ i.2.1 j.2.1 hne' htp h0 h).1 + · intro k j hkj + refine disjoint_left.mpr fun x hx hxQ => hPoff k x hx ?_ + exact IsSectors.inter hsec k j hkj ⟨IsSectors.subQ hsec k hx, hxQ⟩ + refine exists_isPolar_of_fan hS hf (fun k x y hx hy => ?_) fun k t t' h₁ _ h₃ _ => ?_ + · exact ⟨ρ k, Or.inr (hR k), IsSectors.sub hsec k hx, IsSectors.sub hsec k hy⟩ + · exact ⟨k.1.1, Or.inl (Or.inr k.2.1), spoke_mem_edge hγ k.2.1 h₁, spoke_mem_edge hγ k.2.1 h₃⟩ + +omit [T2Space S] in +/-- Two discs on the two sides of a line through `v` form a fan with two sectors. -/ +private theorem isFan_bool {v : S} {f₁ f₂ : I → S} {Δ₁ Δ₂ S₁ S₂ W F : Set S} (hf₁ : IsArcMap f₁) + (hf₂ : IsArcMap f₂) (h₁0 : f₁ 0 = v) (h₂0 : f₂ 0 = v) (hm : ∀ t t', f₁ t = f₂ t' → t = 0) + (hm' : ∀ t t', f₂ t = f₁ t' → t = 0) (hF₁ : range f₁ ⊆ F) (hF₂ : range f₂ ⊆ F) + (hΔ₁ : IsClosedDisc Δ₁) + (hΔ₂ : IsClosedDisc Δ₂) (hb₁ : F ⊆ discBd Δ₁) (hb₂ : F ⊆ discBd Δ₂) (hW : IsOpen W) + (hvW : v ∈ W) + (hvF : v ∈ F) (hin₁ : (W ∩ Δ₁) \ discBd Δ₁ ⊆ S₁) (hin₂ : (W ∩ Δ₂) \ discBd Δ₂ ⊆ S₂) + (hd₁ : ∀ x ∈ S₁, x ∉ Δ₂) (hd₂ : ∀ x ∈ S₂, x ∉ Δ₁) (hoff₁ : ∀ x ∈ S₁, x ∉ F) + (hoff₂ : ∀ x ∈ S₂, x ∉ F) : + IsFan not v (fun k => if k then f₁ else f₂) (fun k => if k then Δ₁ else Δ₂) + (fun k => if k then S₁ else S₂) W (fun _ => 1) := by + refine ⟨Function.Involutive.injective (fun k => by simp), ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, hW, hvW, + fun _ => zero_lt_one, ?_, ?_, ?_, ?_, ?_⟩ + · intro x y + cases x <;> cases y + · exact .refl + · exact .single rfl + · exact .single rfl + · exact .refl + · intro k + cases k <;> simp + · intro k + cases k + · exact hf₂.1 + · exact hf₁.1 + · intro k + cases k + · exact hf₂.2 + · exact hf₁.2 + · intro k + cases k + · exact h₂0 + · exact h₁0 + · intro i j hij t t' _ _ h + cases i <;> cases j + · exact (hij rfl).elim + · exact hm' t t' h + · exact hm t t' h + · exact (hij rfl).elim + · intro k + cases k + · exact hΔ₂ + · exact hΔ₁ + · intro k + cases k + · exact hb₂ hvF + · exact hb₁ hvF + · intro k t _ + cases k + · exact hb₂ (hF₂ (mem_range_self t)) + · exact hb₁ (hF₁ (mem_range_self t)) + · intro k t _ + cases k + · exact hb₂ (hF₁ (mem_range_self t)) + · exact hb₁ (hF₂ (mem_range_self t)) + · intro k + cases k + · exact hin₂ + · exact hin₁ + · intro k j hkj + cases k <;> cases j + · exact (hkj rfl).elim + · exact disjoint_left.mpr hd₂ + · exact disjoint_left.mpr hd₁ + · exact (hkj rfl).elim + · intro k i t _ h + cases k <;> cases i + · exact hoff₂ _ h (hF₂ (mem_range_self t)) + · exact hoff₂ _ h (hF₁ (mem_range_self t)) + · exact hoff₁ _ h (hF₂ (mem_range_self t)) + · exact hoff₁ _ h (hF₁ (mem_range_self t)) + +/-- A polar chart at a point of an edge. The two sides of the edge near `p` form a fan with two +sectors. -/ +theorem exists_isPolar_of_edge (hS : IsClosedSurface S) (Γ : Drawing S) {e : Set S} + (he : e ∈ Γ.E) {p : S} + (hp : p ∈ e) : ∃ Φ, IsPolar Γ p Φ := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨γ, hγ, hγ0, hγ1, hinj, hγe⟩ := exists_edge_param Γ he + have hX₀ := isClosed_U_sdiff_edge Γ he + have hpX₀ : p ∉ Γ.U \ e := fun h => h.2 hp + obtain ⟨t₀, ht₀, rfl⟩ : p ∈ γ '' Ioo 0 1 := by rw [hγe]; exact hp + obtain ⟨D, D', a, b, hD, hD', hpD', hD'D, -, hbdD, hat', htb', hIcc, hIoo, hFline, hFD, hFcap, + hst⟩ := + exists_edge_piece hS Γ he hγ hγ0 hγ1 hinj hγe ht₀ hX₀.isOpen_compl hpX₀ disjoint_compl_left + obtain ⟨ht₀0, ht₀1⟩ := ht₀ + have hat : a ≤ t₀ := hat'.le + have htb : t₀ ≤ b := htb'.le + set F : Set S := γ '' Icc a b with hF + have hFmem : ∀ x, x ∈ F ↔ ∃ t ∈ Icc a b, γ t = x := fun x => Iff.rfl + obtain ⟨A₁, A₂, Δ₁, Δ₂, -, -, hΔ₁, hΔ₂, -, hmeet, hbd₁, hbd₂, -⟩ := + disc_iArc D F (γ a) (γ b) hD hFD hst hFline hFcap + have hFe : F ⊆ e := by + rintro _ ⟨t, ht, rfl⟩ + rw [← hγe] + exact ⟨t, hIcc ht, rfl⟩ + have hFU : F ⊆ Γ.U := fun x hx => (he.2.1 (hFe hx)).1 + let Y : Set S := (Γ.U \ e) ∪ γ '' {t | t ≤ a ∨ b ≤ t} + have hY : IsClosed Y := hX₀.union ((isClosed_Iic.union isClosed_Ici).isCompact.image hγ).isClosed + have hpY : γ t₀ ∉ Y := by + rintro (h | ⟨t, ht, hteq⟩) + · exact h.2 hp + · have hpV : t ∈ Ioo (0 : unitInterval) 1 := by + refine ⟨unitInterval.pos_iff_ne_zero.mpr ?_, unitInterval.lt_one_iff_ne_one.mpr ?_⟩ + · rintro rfl + exact (he.2.1 hp).2 (hteq ▸ hγ0) + · rintro rfl + exact (he.2.1 hp).2 (hteq ▸ hγ1) + have := hinj hpV ⟨ht₀0, ht₀1⟩ hteq + subst this + rcases ht with h | h + · exact absurd h (not_le.mpr hat') + · exact absurd h (not_le.mpr htb') + have hpF : γ t₀ ∈ F := (hFmem _).mpr ⟨t₀, ⟨hat, htb⟩, rfl⟩ + have hFsub : ∀ x ∈ e, x ∉ Y → x ∈ F := by + intro x hx hxY + obtain ⟨t, -, rfl⟩ : x ∈ γ '' Ioo 0 1 := by rw [hγe]; exact hx + refine (hFmem _).mpr ⟨t, ?_, rfl⟩ + have hn : ¬ (t ≤ a ∨ b ≤ t) := fun h => hxY (Or.inr ⟨t, h, rfl⟩) + push Not at hn + exact ⟨hn.1.le, hn.2.le⟩ + have side : ∀ Δ A₀ : Set S, IsClosedDisc Δ → discBd Δ = A₀ ∪ F → + ∃ A W : Set S, IsOpen W ∧ γ t₀ ∈ W ∧ IsPreconnected A ∧ A ⊆ Δ ∧ Disjoint A Γ.U ∧ + (W ∩ Δ) \ discBd Δ ⊆ A := by + intro Δ A₀ hΔ hbdΔ + have hpbd : γ t₀ ∈ discBd Δ := by rw [hbdΔ]; exact Or.inr hpF + obtain ⟨A, W, hW, hpW, hconn, hAΔ, hAbd, hAY, hin, -⟩ := exists_half_nbhd hΔ hY hpbd hpY + refine ⟨A, W, hW, hpW, hconn, hAΔ, ?_, hin⟩ + refine disjoint_left.mpr fun x hxA hxU => ?_ + have hxY : x ∉ Y := disjoint_left.mp hAY hxA + have hxe : x ∈ e := by + by_contra hxe + exact hxY (Or.inl ⟨hxU, hxe⟩) + refine disjoint_left.mp hAbd hxA ?_ + rw [hbdΔ] + exact Or.inr (hFsub x hxe hxY) + obtain ⟨S₁, W₁, hW₁, hpW₁, hconn₁, hs₁, hdis₁, hin₁⟩ := side Δ₁ A₁ hΔ₁ hbd₁ + obtain ⟨S₂, W₂, hW₂, hpW₂, hconn₂, hs₂, hdis₂, hin₂⟩ := side Δ₂ A₂ hΔ₂ hbd₂ + -- The two halves of `F`, from `p`. + have hne₁ : γ t₀ ≠ γ a := fun h => by + have := hinj ⟨ht₀0, ht₀1⟩ (hIcc ⟨le_rfl, hat.trans htb⟩) h + exact hat'.ne this.symm + have hne₂ : γ t₀ ≠ γ b := fun h => by + have := hinj ⟨ht₀0, ht₀1⟩ (hIcc ⟨hat.trans htb, le_rfl⟩) h + exact htb'.ne this + obtain ⟨L₁, L₂, hL₁, hL₂, hLu, hLi⟩ := IsLineWithEnds.split hFline hpF hne₁ hne₂ + obtain ⟨f₁, hf₁, hr₁, h₁0, -⟩ := (IsLineWithEnds.symm hL₁).exists_arc + obtain ⟨f₂, hf₂, hr₂, h₂0, -⟩ := hL₂.exists_arc + have hf₁F : range f₁ ⊆ F := fun x hx => by + rw [← hLu] + exact Or.inl (hr₁ ▸ hx) + have hf₂F : range f₂ ⊆ F := fun x hx => by + rw [← hLu] + exact Or.inr (hr₂ ▸ hx) + have hmf : ∀ t t', f₁ t = f₂ t' → t = 0 := by + intro t t' h + have hm : f₁ t ∈ L₁ ∩ L₂ := ⟨hr₁ ▸ mem_range_self t, h ▸ (hr₂ ▸ mem_range_self t' : f₂ t' ∈ L₂)⟩ + rw [hLi] at hm + exact hf₁.2 (hm.trans h₁0.symm) + have hmf' : ∀ t t', f₂ t = f₁ t' → t = 0 := by + intro t t' h + have hm : f₂ t ∈ L₁ ∩ L₂ := ⟨h ▸ (hr₁ ▸ mem_range_self t' : f₁ t' ∈ L₁), hr₂ ▸ mem_range_self t⟩ + rw [hLi] at hm + exact hf₂.2 (hm.trans h₂0.symm) + have hoff₁ : ∀ x ∈ S₁, x ∉ F := fun x hx hxF => disjoint_left.mp hdis₁ hx (hFU hxF) + have hoff₂ : ∀ x ∈ S₂, x ∉ F := fun x hx hxF => disjoint_left.mp hdis₂ hx (hFU hxF) + have hf := isFan_bool hf₁ hf₂ h₁0 h₂0 hmf hmf' hf₁F hf₂F hΔ₁ hΔ₂ + (show F ⊆ discBd Δ₁ by rw [hbd₁]; exact subset_union_right) + (show F ⊆ discBd Δ₂ by rw [hbd₂]; exact subset_union_right) (hW₁.inter hW₂) ⟨hpW₁, hpW₂⟩ hpF + (fun x hx => hin₁ ⟨⟨hx.1.1.1, hx.1.2⟩, hx.2⟩) (fun x hx => hin₂ ⟨⟨hx.1.1.2, hx.1.2⟩, hx.2⟩) + (fun x hx hxΔ => hoff₁ x hx (hmeet ▸ ⟨hs₁ hx, hxΔ⟩)) (fun x hx hxΔ => hoff₂ x hx + (hmeet ▸ ⟨hxΔ, hs₂ hx⟩)) + hoff₁ hoff₂ + have hreg : ∀ {A : Set S}, IsPreconnected A → Disjoint A Γ.U → ∀ x y, x ∈ A → y ∈ A → + ∃ a ∈ Γ.A, x ∈ a ∧ y ∈ a := by + intro A hA hdis x y hx hy + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem (disjoint_left.mp hdis hx) + exact ⟨r, Or.inr hr, hxr, subset_region hr hA hdis hx hxr hy⟩ + refine exists_isPolar_of_fan hS hf (fun k x y => ?_) fun k t t' _ _ _ _ => ?_ + · cases k + · exact hreg hconn₂ hdis₂ x y + · exact hreg hconn₁ hdis₁ x y + · refine ⟨e, Or.inl (Or.inr he), ?_, ?_⟩ <;> cases k + · exact hFe (hf₂F (mem_range_self t)) + · exact hFe (hf₁F (mem_range_self t)) + · exact hFe (hf₂F (mem_range_self t')) + · exact hFe (hf₁F (mem_range_self t')) + +omit [T2Space S] in +/-- If a neighbourhood `Z` of `z` lies in the closure of a set `r ⊆ X`, then `z` is a cone point. -/ +private theorem cone_of_region (hS : IsClosedSurface S) {X Y Z : Set S} {z : S} {r : Set S} + (hr : r ⊆ X) (hX : IsClosed X) (hZ : IsOpen Z) (hzZ : z ∈ Z) (hZr : Z ⊆ closure r) : + IsLocalCone X Y z := by + obtain ⟨D, D', hD, hD', hzD', hD'D, hDZ, -⟩ := exists_closedDisc_nbhd hS hZ hzZ + have hDX : D ⊆ X := hDZ.trans (hZr.trans (closure_minimal hr hX)) + exact isLocalCone_of_subset (IsClosedDisc.isSimplyConnectedSet hD) hDX (hD'D hzD') hD' hzD' + fun y hy => hD'D hy.2 + +/-- **Closed nice sets are cones.** -/ +theorem isLocalCone [ConnectedSpace S] (hS : IsClosedSurface S) {Γ : Drawing S} {X Y : Set S} + (hX : IsClosed X) (hY : IsClosed Y) (hXn : IsGammaNice Γ X) (hYn : IsGammaNice Γ Y) {z : S} + (hz : z ∈ X ∪ Y) : IsLocalCone X Y z := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hne : Nonempty S := ⟨z⟩ + by_cases hzV : z ∈ Γ.V + · obtain ⟨γ, hγ⟩ := exists_edgePar Γ + by_cases h2 : 2 ≤ Nat.card (halfEdges Γ γ z) + · obtain ⟨Φ, hΦ⟩ := exists_isPolar_of_sectors hS hγ hzV h2 + exact hΦ.isLocalCone hX hY hXn hYn hz + -- A region near `z`. + obtain ⟨r, hr, hzr⟩ : ∃ r ∈ Γ.R, z ∈ closure r := by + have hfin := finite_R hS Γ + have hd : z ∈ closure (⋃ r ∈ Γ.R, r) := mem_closure_iff.mpr fun O hO hzO => by + obtain ⟨y, hyO, hyU⟩ := exists_notMem_U (Γ := Γ) hS hO ⟨z, hzO⟩ + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem hyU + exact ⟨y, hyO, mem_iUnion₂.mpr ⟨r, hr, hyr⟩⟩ + rw [hfin.closure_biUnion] at hd + obtain ⟨r, hr, hzr⟩ := mem_iUnion₂.mp hd + exact ⟨r, hr, hzr⟩ + obtain ⟨Z, hZ, hzZ, hZr⟩ := exists_nbhd_of_few hS hγ hzV h2 hr hzr + have hrA : r ∈ Γ.A := Or.inr hr + by_cases hrX : (r ∩ X).Nonempty + · exact cone_of_region hS (nice_atom hXn hrA hrX) hX hZ hzZ hZr + by_cases hrY : (r ∩ Y).Nonempty + · exact (cone_of_region hS (nice_atom hYn hrA hrY) hY hZ hzZ hZr).symm + have hoff : ∀ y ∈ Z, y ∈ X ∪ Y → y ∈ Γ.U := by + intro y hyZ hy + rcases closure_region_subset hr (hZr hyZ) with h | h + · rcases hy with h' | h' + · exact (hrX ⟨y, h, h'⟩).elim + · exact (hrY ⟨y, h, h'⟩).elim + · exact h + have hpoint : ∀ {T : Set S}, IsClosed T → z ∉ T → (∀ y ∈ Z \ T, y ∈ X ∪ Y → y = z) → + IsLocalCone X Y z := by + intro T hT hzT hy + have hsub : (X ∪ Y) ∩ (Z \ T) ⊆ {z} := fun y h => hy y h.2 h.1 + rcases hz with h | h + · exact isLocalCone_of_subset (isSimplyConnected_singleton z) (singleton_subset_iff.mpr h) rfl + (hZ.sdiff hT) ⟨hzZ, hzT⟩ hsub + · exact (isLocalCone_of_subset (Y := X) (isSimplyConnected_singleton z) + (singleton_subset_iff.mpr h) + rfl (hZ.sdiff hT) ⟨hzZ, hzT⟩ (by rwa [union_comm])).symm + have hfinH : Finite (halfEdges Γ γ z) := (finite_halfEdges Γ γ z).to_subtype + have hss : Subsingleton (halfEdges Γ γ z) := Finite.card_le_one_iff_subsingleton.mp (by omega) + rcases isEmpty_or_nonempty (halfEdges Γ γ z) with h0 | ⟨⟨k⟩⟩ + · have hno : ∀ g ∈ Γ.E, z ∉ closure g := by + intro g hg hzg + obtain ⟨b, hb⟩ := exists_end_eq hγ hg hzV hzg + exact h0.false ⟨(g, b), hg, hb⟩ + let T : Set S := (Γ.V \ {z}) ∪ ⋃ g ∈ Γ.E, closure g + have hT : IsClosed T := (Γ.finite_V.subset sdiff_subset).isClosed.union + (Γ.finite_edges.isClosed_biUnion fun _ _ => isClosed_closure) + have hzT : z ∉ T := by + rintro (h | h) + · exact h.2 rfl + · obtain ⟨g, hg, hzg⟩ := mem_iUnion₂.mp h + exact hno g hg hzg + refine hpoint hT hzT fun y hy hyU => ?_ + have hyU' := hoff y hy.1 hyU + rw [Γ.U_eq] at hyU' + rcases hyU' with h | h + · by_contra hyz + exact hy.2 (Or.inl ⟨h, hyz⟩) + · exact (hy.2 (Or.inr h)).elim + · obtain ⟨⟨e, b⟩, he, hb⟩ := k + let T : Set S := (Γ.V \ {z}) ∪ ⋃ g ∈ Γ.E \ {e}, closure g + have hT : IsClosed T := (Γ.finite_V.subset sdiff_subset).isClosed.union + ((Γ.finite_edges.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure) + have hzT : z ∉ T := by + rintro (h | h) + · exact h.2 rfl + · obtain ⟨g, hg, hzg⟩ := mem_iUnion₂.mp h + obtain ⟨b', hb'⟩ := exists_end_eq hγ hg.1 hzV hzg + have := congrArg (fun k : halfEdges Γ γ z => k.1.1) + (hss.elim ⟨(g, b'), hg.1, hb'⟩ ⟨(e, b), he, hb⟩) + exact hg.2 this + have hin : ∀ y ∈ Z \ T, y ∈ X ∪ Y → y = z ∨ y ∈ e := by + intro y hy hyU + have hyU' := hoff y hy.1 hyU + by_cases hyV : y ∈ Γ.V + · left + by_contra hyz + exact hy.2 (Or.inl ⟨hyV, hyz⟩) + · obtain ⟨g, hg, hyg⟩ := Γ.exists_edge_of_mem hyU' hyV + right + by_cases hge : g = e + · exact hge ▸ hyg + · exact (hy.2 (Or.inr (mem_iUnion₂.mpr ⟨g, ⟨hg, hge⟩, subset_closure hyg⟩))).elim + have hzcl : z ∈ closure e := by + have := end_mem_closure hγ he b + rwa [hb] at this + have hline : IsLine (closure e) := by + rcases Γ.edge_cond e he with ⟨u, v, -, -, hl⟩ | ⟨u, hu, -⟩ + · obtain ⟨f, -, -⟩ := hl + exact ⟨f⟩ + · exfalso + have hend : ∀ c, γ e (endOf c) = z := by + intro c + have h₁ : γ e (endOf c) ∈ closure e ∩ Γ.V := by + refine ⟨end_mem_closure hγ he c, ?_⟩ + cases c + · exact hγ.zero e he + · exact hγ.one e he + have h₂ : z ∈ closure e ∩ Γ.V := ⟨hzcl, hzV⟩ + rw [hu] at h₁ h₂ + exact h₁.trans h₂.symm + have := congrArg (fun k : halfEdges Γ γ z => k.1.2) + (hss.elim ⟨(e, true), he, hend true⟩ ⟨(e, false), he, hend false⟩) + simp at this + have heA : e ∈ Γ.A := Or.inl (Or.inr he) + have hsub : ∀ {X' Y' : Set S}, X ∪ Y = X' ∪ Y' → (X' ∪ Y') ∩ (Z \ T) ⊆ closure e := by + intro X' Y' h y hy + rw [← h] at hy + rcases hin y hy.2 hy.1 with rfl | h' + · exact hzcl + · exact subset_closure h' + by_cases heX : (e ∩ X).Nonempty + · have hclX : closure e ⊆ X := closure_minimal (nice_atom hXn heA heX) hX + exact isLocalCone_of_subset (IsLine.isSimplyConnected hline) hclX hzcl + (hZ.sdiff hT) ⟨hzZ, hzT⟩ + (hsub rfl) + by_cases heY : (e ∩ Y).Nonempty + · have hclY : closure e ⊆ Y := closure_minimal (nice_atom hYn heA heY) hY + exact (isLocalCone_of_subset (IsLine.isSimplyConnected hline) hclY hzcl + (hZ.sdiff hT) ⟨hzZ, hzT⟩ + (hsub (union_comm X Y))).symm + refine hpoint hT hzT fun y hy hyU => ?_ + rcases hin y hy hyU with h | h + · exact h + · rcases hyU with h' | h' + · exact (heX ⟨y, h, h'⟩).elim + · exact (heY ⟨y, h, h'⟩).elim + by_cases hzU : z ∈ Γ.U + · obtain ⟨e, he, hze⟩ := Γ.exists_edge_of_mem hzU hzV + obtain ⟨Φ, hΦ⟩ := exists_isPolar_of_edge hS Γ he hze + exact hΦ.isLocalCone hX hY hXn hYn hz + · obtain ⟨r, hr, hzr⟩ := exists_region_of_notMem hzU + have hrA : r ∈ Γ.A := Or.inr hr + have hZ := region_isOpen hr + rcases hz with h | h + · exact cone_of_region hS (nice_atom hXn hrA ⟨z, hzr, h⟩) hX hZ hzr subset_closure + · exact (cone_of_region hS (nice_atom hYn hrA ⟨z, hzr, h⟩) hY hZ hzr subset_closure).symm + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Nice73.lean b/LeanPool/GraphMinor/GM11/Nice73.lean new file mode 100644 index 0000000000..7ccada63ca --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Nice73.lean @@ -0,0 +1,343 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.CurveArc +public import LeanPool.GraphMinor.GM11.NicePush +public import LeanPool.GraphMinor.GM11.RadialBasics +public import LeanPool.GraphMinor.GM11.NiceStatements +import LeanPool.GraphMinor.Surface.ArcInPath + +/-! +# (7.3) of Graph Minors XI for closed nice sets + +We show that a closed curve in a compact Hausdorff space which is covered by flat open sets is +null-homotopic if each `O`-arc in the curve is (`loop_homotopic_of_oArcs`). This is the proof of +Graph Minors VII, (11.2), with `CurveArc.lean` as its main step. The steps here are the first ones +of that +proof: the curve is cut in small pieces, and by (11.1) each piece can be taken to be a line or a +point. + +The paper's (7.3) says that the proof of VII, (11.2) "applies", and closed nice sets are cones at +each point by +`isLocalCone`, so they are covered by flat open sets. This proves `Nice73Statement`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {T : Type u} [TopologicalSpace T] + +variable [T2Space T] + +/-- A short path is, up to homotopy in the flat set around it, a path along a line or a point. This +is +Graph Minors VII, (11.1). -/ +theorem exists_arm_of_path {A : Set T} (hA : Flat A) {a b : T} (p : Path a b) (hp : ∀ u, p u ∈ A) : + ∃ B ⊆ range p, IsArmTo B a b ∧ Arw B (Cl.mk p) := by + by_cases hab : a = b + · subst hab + have ha : a ∈ range p := ⟨0, p.source⟩ + have e : Cl.mk p = Cl.rf a := hA.eq ⟨p, hp, rfl⟩ (arw_refl (by simpa using hp 0)) + rw [e] + exact ⟨{a}, singleton_subset_iff.mpr ha, isArmTo_point a, arw_refl rfl⟩ + · obtain ⟨e, he, hi, h0, h1, hr⟩ := exists_arc_of_path p.continuous (by simpa using hab) + have h0' : e 0 = a := by simpa using h0 + have h1' : e 1 = b := by simpa using h1 + have harc : IsArcMap e := ⟨he, hi⟩ + have hl : IsLineWithEnds (range e) a b := by + have := harc.isLineWithEnds + rwa [h0', h1'] at this + have ham : IsArmTo (range e) a b := Or.inr hl + obtain ⟨f, hf⟩ := ham.exists_arw + refine ⟨range e, hr, ham, ?_⟩ + rwa [hA.eq ⟨p, hp, rfl⟩ (hf.mono fun y hy => ?_)] + obtain ⟨u, rfl⟩ := hr hy + exact hp u + +omit [T2Space T] in +private theorem Ch.of_cast {Y : Set T} {Sm : Set T → Prop} {l : List (Set T)} {a b a' b' : T} + (ea : a' = a) + (eb : b' = b) {p : Path a b} (h : Ch Y Sm l a' b' (Cl.mk (p.cast ea eb))) : Ch Y Sm l a b + (Cl.mk p) := by + subst ea eb + exact h + +/-- A path, each point of which has a neighbourhood mapping into a small set, is a chain. -/ +theorem exists_ch_of_path {Y : Set T} {Sm : Set T → Prop} (hflat : ∀ {A : Set T}, Sm A → A.Nonempty + → Flat A) + (hmono : ∀ {A B : Set T}, Sm A → B ⊆ A → Sm B) {a b : T} (γ : Path a b) (hY : ∀ u, γ u ∈ Y) + (hcov : ∀ u : I, ∃ O : Set I, IsOpen O ∧ u ∈ O ∧ Sm (γ '' O)) : + ∃ l, Ch Y Sm l a b (Cl.mk γ) := by + let good : Set I → Prop := fun O => IsOpen O ∧ Sm (γ '' O) + have hcover : (univ : Set I) ⊆ ⋃ O : {O : Set I // good O}, O.1 := by + intro u _ + obtain ⟨O, h₁, h₂, h₃⟩ := hcov u + exact mem_iUnion.mpr ⟨⟨O, h₁, h₃⟩, h₂⟩ + obtain ⟨t, ht0, htmono, ⟨n₀, hn₀⟩, htO⟩ := exists_monotone_Icc_subset_open_cover_unitInterval + (fun O : {O : Set I // good O} => O.2.1) hcover + have key : ∀ n, ∃ l, Ch Y Sm l (γ 0) (γ (t n)) (Cl.mk (γ.subpath 0 (t n))) := by + intro n + induction n with + | zero => + refine ⟨[], ?_⟩ + rw [ht0, Path.subpath_self] + exact Ch.nil _ + | succ n ih => + obtain ⟨l, hl⟩ := ih + obtain ⟨⟨O, _, hSm⟩, hsub⟩ := htO n + have hle : t n ≤ t (n + 1) := htmono (Nat.le_succ n) + have hpiece : ∀ u, (γ.subpath (t n) (t (n + 1))) u ∈ γ '' O := by + intro u + have : (γ.subpath (t n) (t (n + 1))) u ∈ γ '' uIcc (t n) (t (n + 1)) := by + rw [← Path.range_subpath] + exact mem_range_self u + obtain ⟨v, hv, hv'⟩ := this + rw [uIcc_of_le hle] at hv + exact ⟨v, hsub hv, hv'⟩ + have hA : Flat (γ '' O) := hflat hSm ⟨_, hpiece 0⟩ + obtain ⟨B, hB, harm, hBa⟩ := exists_arm_of_path hA _ hpiece + have hBs : B ⊆ γ '' O := fun y hy => by + obtain ⟨u, rfl⟩ := hB hy + exact hpiece u + have hBY : B ⊆ Y := fun y hy => by + obtain ⟨u, -, rfl⟩ := hBs hy + exact hY u + refine ⟨l ++ [B], ?_⟩ + have h := hl.append (Ch.single harm hBY (hmono hSm hBs) hBa) + have e : (Cl.mk (γ.subpath 0 (t n))).trans (Cl.mk (γ.subpath (t n) (t (n + 1)))) = + Cl.mk (γ.subpath 0 (t (n + 1))) := by + rw [← Path.Homotopic.Quotient.mk_trans] + exact Path.Homotopic.Quotient.eq.mpr (Path.Homotopic.subpath_trans_subpath _ _ _ _) + rwa [e] at h + obtain ⟨l, hl⟩ := key n₀ + rw [hn₀ n₀ le_rfl, Path.subpath_zero_one] at hl + exact ⟨l, Ch.of_cast γ.source γ.target hl⟩ + +/-- **A closed curve is null-homotopic if each `O`-arc in it is.** Here the curve is covered by open +sets `U i` such +that each of them is flat where it meets the curve. This is the proof of Graph Minors VII, (11.2) +(page 249). -/ +theorem loop_homotopic_of_oArcs {ι : Type*} (U : ι → Set T) (hU : ∀ i, IsOpen (U i)) {a : T} + (γ : Path a a) + (hc : range γ ⊆ ⋃ i, U i) (hflat : ∀ i, Flat (U i ∩ range γ)) + (hO : ∀ F : Set T, IsOArc F → F ⊆ range γ → ∀ (x : T) (p : Path x x), (∀ u, p u ∈ F) → + p.Homotopic (Path.refl x)) : + γ.Homotopic (Path.refl a) := by + classical + have hK : CompactSpace (range γ) := isCompact_iff_compactSpace.mp (isCompact_range γ.continuous) + obtain ⟨R', hR', hN'⟩ := exists_small_rel (fun i => (Subtype.val ⁻¹' U i : Set (range γ))) + (fun i => (hU i).preimage continuous_subtype_val) (fun x _ => by + obtain ⟨i, hi⟩ := mem_iUnion.mp (hc x.2) + exact mem_iUnion.mpr ⟨i, hi⟩) + let R : T → T → Prop := fun x y => ∃ (hx : x ∈ range γ) (hy : y ∈ range γ), R' ⟨x, hx⟩ ⟨y, hy⟩ + have hR : ∀ x ∈ range γ, ∃ i, ∀ y, R x y → y ∈ U i ∩ range γ := fun x hx => by + obtain ⟨i, hi⟩ := hR' ⟨x, hx⟩ + exact ⟨i, fun y ⟨_, hy, h⟩ => ⟨hi _ h, hy⟩⟩ + have hN : ∀ x ∈ range γ, ∃ N : Set T, IsOpen N ∧ x ∈ N ∧ ∀ a ∈ N, ∀ b ∈ N, a ∈ range γ + → b ∈ range γ → R a b := + fun x hx => by + obtain ⟨N, hNo, hxN, hNr⟩ := hN' ⟨x, hx⟩ + obtain ⟨N₀, hN₀, rfl⟩ := isOpen_induced_iff.mp hNo + exact ⟨N₀, hN₀, hxN, fun a ha b hb h₁ h₂ => ⟨h₁, h₂, hNr ⟨a, h₁⟩ ha ⟨b, h₂⟩ hb⟩⟩ + let Sm : Set T → Prop := fun A => ∀ x ∈ A, ∀ y ∈ A, R x y + have hmono : ∀ {A B : Set T}, Sm A → B ⊆ A → Sm B := fun h hBA x hx y hy => h x (hBA hx) y + (hBA hy) + have hpair : ∀ {A B : Set T}, Sm A → Sm B → (A ∩ B).Nonempty → Flat (A ∪ B) := by + rintro A B hA hB ⟨w, hwA, hwB⟩ + obtain ⟨hw, -, -⟩ := hA w hwA w hwA + obtain ⟨i, hi⟩ := hR w hw + refine (hflat i).mono ?_ + rintro y (hy | hy) + · exact hi y (hA w hwA y hy) + · exact hi y (hB w hwB y hy) + have hsm : ∀ {A : Set T}, Sm A → A.Nonempty → Flat A := fun {A} hA ⟨w, hw⟩ => by + have := hpair hA hA ⟨w, hw, hw⟩ + rwa [union_self] at this + have hcov : ∀ u : I, ∃ O : Set I, IsOpen O ∧ u ∈ O ∧ Sm (γ '' O) := by + intro u + obtain ⟨N, hNo, hNm, hNr⟩ := hN (γ u) (mem_range_self u) + refine ⟨γ ⁻¹' N, hNo.preimage γ.continuous, hNm, ?_⟩ + rintro _ ⟨s, hs, rfl⟩ _ ⟨r, hr, rfl⟩ + exact hNr _ hs _ hr (mem_range_self s) (mem_range_self r) + obtain ⟨l, hl⟩ := exists_ch_of_path (Y := range γ) hsm hmono γ (fun u => mem_range_self u) hcov + have hO' : ∀ {x y : T} {L₁ L₂ : Set T}, IsLineWithEnds L₁ x y → IsLineWithEnds L₂ x y + → L₁ ∩ L₂ ⊆ {x, y} → + L₁ ∪ L₂ ⊆ range γ → ∀ f g : Cl x y, Arw L₁ f → Arw L₂ g → f = g := by + intro x y L₁ L₂ h₁ h₂ hcap hsub f g hf hg + obtain ⟨r, hr, e⟩ := Arw.trans (hf.mono (subset_union_left (t := L₂))) + (Arw.symm (hg.mono (subset_union_right (s := L₁)))) + have hloop : f.trans g.symm = Cl.rf x := by + rw [e] + exact Path.Homotopic.Quotient.eq.mpr (hO _ (isOArc_union h₁ h₂ hcap) hsub x r hr) + calc f = f.trans (g.symm.trans g) := by rw [cl_symm_trans, cl_trans_refl] + _ = g := by rw [← cl_assoc, hloop, cl_refl_trans] + have := Ch.eq_refl hmono hpair hO' _ l a _ rfl hl + exact Path.Homotopic.Quotient.eq.mp this + +/-- A closed curve in an `O`-arc that is null-homotopic in `W` is null-homotopic in `W`. -/ +theorem homotopic_refl_of_null {S : Type u} [TopologicalSpace S] {W G : Set S} + (hG : IsNullHomotopicOArcIn W G) + {x : W} (p : Path x x) (hp : ∀ u, (p u).1 ∈ G) : p.Homotopic (Path.refl x) := by + obtain ⟨ψ, c, hcW, H, hHW, h0, h1⟩ := hG + let P : I → G := fun s => ⟨(p s).1, hp s⟩ + have hP : Continuous P := by + refine Continuous.subtype_mk ?_ _ + fun_prop + let F : C(I × I, W) := ⟨fun w => ⟨H (ψ.symm (P w.1), w.2), hHW _⟩, by + refine Continuous.subtype_mk ?_ _ + exact H.continuous.comp ((ψ.symm.continuous.comp (hP.comp continuous_fst)).prodMk + continuous_snd)⟩ + refine loop_homotopic_refl p F (c := ⟨c, hcW⟩) (fun s => Subtype.ext ?_) (fun v => Subtype.ext ?_) + fun s => Subtype.ext ?_ + · change H (ψ.symm (P s), 0) = (p s).1 + rw [h0] + change ((ψ (ψ.symm (P s))) : S) = _ + rw [ψ.apply_symm_apply] + · have e : P 0 = P 1 := Subtype.ext (by simp [P]) + change H (ψ.symm (P 0), v) = H (ψ.symm (P 1), v) + rw [e] + · change H (ψ.symm (P s), 1) = c + rw [h1] + rfl + +/-- The heart of (7.3): a closed nice set `Z` in a closed surface, and a closed curve in `Z` in the +subtype `W ⊇ Z`. +The curve is null-homotopic in `W` if each `O`-arc in the curve is. -/ +theorem loop_homotopic_of_null {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {Z W : Set S} (hZ : IsClosed Z) + (hZn : IsGammaNice Γ Z) (hZW : Z ⊆ W) + {a : W} (γ : Path a a) (hγ : ∀ u, (γ u).1 ∈ Z) + (hall : ∀ F : Set S, IsOArc F → F ⊆ Subtype.val '' range γ → IsNullHomotopicOArcIn W F) : + γ.Homotopic (Path.refl a) := by + let good : Set W → Prop := fun O => IsOpen O ∧ Flat (O ∩ range γ) + have hc : range γ ⊆ ⋃ O : {O : Set W // good O}, O.1 := by + rintro _ ⟨u, rfl⟩ + obtain ⟨O, K, hO, hzO, hsub, hK, hsc, -⟩ := isLocalCone hS hZ hZ hZn hZn (Or.inl (hγ u)) + rw [union_self] at hsub hK + refine mem_iUnion.mpr ⟨⟨Subtype.val ⁻¹' O, hO.preimage continuous_subtype_val, ?_⟩, hzO⟩ + have hin : ∀ {x : W}, x ∈ Subtype.val ⁻¹' O ∩ range γ → x.1 ∈ K := by + rintro _ ⟨h₁, v, rfl⟩ + exact hsub ⟨hγ v, h₁⟩ + intro b c p q hp hq + exact homotopic_of_mem hsc (hK.trans hZW) p q (hin (by simpa using hp 0)) (hin + (by simpa using hp 1)) + (fun u => hin (hp u)) fun u => hin (hq u) + refine loop_homotopic_of_oArcs (fun O : {O : Set W // good O} => O.1) (fun O => O.2.1) γ hc + (fun O => O.2.2) ?_ + intro F hF hFγ x p hp + have hG : IsOArc (Subtype.val '' F) := + isOArc_image hF continuous_subtype_val.continuousOn Subtype.val_injective.injOn + have hGγ : Subtype.val '' F ⊆ Subtype.val '' range γ := image_mono hFγ + exact homotopic_refl_of_null (hall _ hG hGγ) p fun u => ⟨_, hp u, rfl⟩ + +/-- **(7.3)** of Graph Minors XI (page 93), for closed nice sets. -/ +theorem nice_73 : Nice73Statement.{u} := by + intro S _ _ _ hS Γ Z hZ hZn φ hφ hnot + by_contra! hall + have hmem : ∀ t, φ (arcParam 1 t) ∈ Z := fun t => hφ (mem_range_self _) + let a : Z := ⟨φ (arcParam 1 0), hmem 0⟩ + let γ : Path a a := ⟨⟨fun t => ⟨φ (arcParam 1 t), hmem t⟩, by fun_prop⟩, rfl, + Subtype.ext (by simp [a])⟩ + have hh : γ.Homotopic (Path.refl a) := by + refine loop_homotopic_of_null hS hZ hZn subset_rfl γ (fun u => (γ u).2) fun F hF hFγ + => hall F hF ?_ + refine hFγ.trans ?_ + rintro _ ⟨_, ⟨t, rfl⟩, rfl⟩ + exact mem_range_self _ + exact hnot ⟨a.1, a.2, closedCurvesHomotopicIn_of_path 1 φ (ContinuousMap.const _ a.1) γ + (Path.refl a) + (fun _ => rfl) (fun _ => rfl) hh⟩ + +/-- **(7.3)** of Graph Minors XI (page 93), for closed nice sets: "If $Z \subseteq \Sigma$ is nice +and $\phi \colon S^1 \to Z$ is continuous and not null-homotopic in $Z$, then there is an $O$-arc $F +\subseteq |\phi|$ which is not null-homotopic in $Z$." -/ +theorem theorem_7_3_proof {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Z : Set S} (hZ : IsClosed Z) (hZn : IsNice Z) + (φ : C(Circle, S)) (hφ : range φ ⊆ Z) (hnot : ¬ ClosedCurveIsNullHomotopicIn Z φ) : + ∃ F : Set S, IsOArc F ∧ F ⊆ range φ ∧ ¬ IsNullHomotopicOArcIn Z F := by + obtain ⟨Γ, hΓ⟩ := hZn + exact nice_73 S hS Γ Z hZ hΓ φ hφ hnot + +/-- A closed nice set is flat in `W` if each `O`-arc in it is null-homotopic in `W`. This is the +form of (7.3) that +(7.5) uses. -/ +theorem flat_of_null_oArcs {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {Z W : Set S} (hZ : IsClosed Z) + (hZn : IsGammaNice Γ Z) (hZW : Z ⊆ W) + (hall : ∀ F : Set S, F ⊆ Z → IsOArc F → IsNullHomotopicOArcIn W F) : + Flat (Subtype.val ⁻¹' Z : Set W) := by + intro a b p q hp hq + let γ : Path a a := p.trans q.symm + have hin : ∀ u, (γ u).1 ∈ Z := by + intro u + have hu : γ u ∈ range p ∪ range q.symm := by + rw [← Path.trans_range] + exact mem_range_self u + rcases hu with ⟨v, hv⟩ | ⟨v, hv⟩ + · rw [← hv] + exact hp v + · rw [← hv] + exact hq _ + have hγ : γ.Homotopic (Path.refl a) := loop_homotopic_of_null hS hZ hZn hZW γ hin fun F hF hFγ => + hall F (hFγ.trans (by rintro _ ⟨_, ⟨u, rfl⟩, rfl⟩; exact hin u)) hF + refine Path.Homotopic.Quotient.eq.mp ?_ + have h₁ : (Cl.mk p).trans (Cl.mk q).symm = Cl.rf a := by + rw [← Path.Homotopic.Quotient.mk_symm, ← Path.Homotopic.Quotient.mk_trans, Cl.rf, + ← Path.Homotopic.Quotient.mk_refl] + exact Path.Homotopic.Quotient.eq.mpr hγ + calc Cl.mk p = ((Cl.mk p).trans (Cl.mk q).symm).trans (Cl.mk q) := by + rw [cl_assoc, cl_symm_trans, cl_trans_refl] + _ = Cl.mk q := by rw [h₁, cl_refl_trans] + +/-- **(7.4)** of Graph Minors XI (page 94), for closed nice sets: "If $\Sigma$ is connected and $X +\subseteq \Sigma$ is nice, then $X$ is simply-connected if +and only if $X$ is arc-wise connected and every $O$-arc $F \subseteq X$ bounds a disc in +$X$." Here +`X` is non-empty, since our simply-connected sets are. -/ +theorem theorem_7_4_proof {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {X : Set S} (hc : IsClosed X) (hn : IsGammaNice Γ X) + (hne : X.Nonempty) : IsSimplyConnectedSet X ↔ IsArcConnected X ∧ + ∀ F : Set S, F ⊆ X → IsOArc F → ∃ Δ : Set S, Δ ⊆ X ∧ IsClosedDisc Δ ∧ subBd Δ = F := by + constructor + · intro hs + refine ⟨isArcConnected_of_isPathConnected hs.1, fun F hFX hF => theorem_7_2_proof hS hF hFX ?_⟩ + obtain ⟨ψ⟩ := id hF + exact ⟨ψ, hs.2 _ (by + rintro _ ⟨x, rfl⟩ + exact hFX (ψ x).2)⟩ + · rintro ⟨harc, hdisc⟩ + obtain ⟨x₀, hx₀⟩ := hne + refine ⟨⟨x₀, hx₀, fun {y} hy => ?_⟩, fun φ hφ => ?_⟩ + · by_cases hxy : x₀ = y + · subst hxy + exact JoinedIn.refl hx₀ + · obtain ⟨L, hL, hl⟩ := harc x₀ hx₀ y hy hxy + obtain ⟨f, h0, h1⟩ := hl + exact (show JoinedIn L x₀ y from ⟨⟨⟨fun t => (f t).1, by fun_prop⟩, h0, h1⟩, + fun t => (f t).2⟩).mono hL + · by_contra hnot + obtain ⟨F, hF, hFφ, hFn⟩ := nice_73 S hS Γ X hc hn φ hφ hnot + obtain ⟨Δ, hΔX, hΔ, hb⟩ := hdisc F (hFφ.trans hφ) hF + have hFΔ : F ⊆ Δ := by + rw [← hb, subBd_eq_frontier] + exact (IsClosedDisc.isCompact hΔ).isClosed.frontier_subset + obtain ⟨ψ⟩ := id hF + obtain ⟨c, hcΔ, hh⟩ := (IsClosedDisc.isSimplyConnectedSet hΔ).2 + ⟨fun x => (ψ x).1, continuous_subtype_val.comp ψ.continuous⟩ (by + rintro _ ⟨x, rfl⟩ + exact hFΔ (ψ x).2) + exact hFn ⟨ψ, c, hΔX hcΔ, hh.mono hΔX⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/NicePush.lean b/LeanPool/GraphMinor/GM11/NicePush.lean new file mode 100644 index 0000000000..c7a7c4f997 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/NicePush.lean @@ -0,0 +1,182 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.LocalCone + +/-! +# (3.1) of Graph Minors XI for closed nice sets + +Let `X, Y` be closed and nice, with `X` simply-connected and `X ∩ Y` arc-wise connected. We show +that a curve +in `X ∪ Y` can be pushed into `Y`, which is (3.1) in the case that (7.8) and (8.8) need. + +The paper's proof of (3.1) cuts the curve at the points where it meets `Y`, and each piece between +two such +points lies in `X`. That fails for a general curve, which may meet `Y` in a Cantor set, and (3.1) is +false for general closed sets (see the correction to (3.1) in `corrections/GM11.md`). For nice sets +the cones of `isLocalCone` make the step work. A +path is cut into short pieces, each in one cone, and each piece is homotopic to a path through the +apex. So +the path is homotopic to a finite product of paths, each of them in `X` or in `Y`, and now the +paper's step +applies: a stretch in `X` with ends in `X ∩ Y` is homotopic in `X` to a path in `X ∩ Y`. + +The induction is on the number of pieces. `IsPushed` is the state after some pieces, and +`IsPushed.step` adds +one more path. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] {X Y : Set S} + +private theorem trans_mem {A : Set S} {Z : Set S} {a b c : Z} {p : Path a b} {q : Path b c} + (hp : ∀ u, (p u).1 ∈ A) (hq : ∀ u, (q u).1 ∈ A) (u : I) : ((p.trans q) u).1 ∈ A := by + have : (p.trans q) u ∈ range p ∪ range q := by + rw [← Path.trans_range] + exact mem_range_self u + rcases this with ⟨v, hv⟩ | ⟨v, hv⟩ + · rw [← hv] + exact hp v + · rw [← hv] + exact hq v + +/-- The state of the induction for a path `ω` from `a` to `c`: it is homotopic to a path in `Y`, or +to a path +in `Y` followed by a path in `X`. -/ +private def IsPushed (X Y : Set S) {a c : (X ∪ Y : Set S)} (ω : Path a c) : Prop := + (∃ q : Path a c, ω.Homotopic q ∧ ∀ u, (q u).1 ∈ Y) ∨ + ∃ (e : (X ∪ Y : Set S)) (q : Path a e) (r : Path e c), ω.Homotopic (q.trans r) ∧ + (∀ u, (q u).1 ∈ Y) ∧ ∀ u, (r u).1 ∈ X + +private theorem IsPushed.congr {a c : (X ∪ Y : Set S)} {ω ω' : Path a c} (h : IsPushed X Y ω) + (hh : ω'.Homotopic ω) : IsPushed X Y ω' := by + rcases h with ⟨q, h₁, h₂⟩ | ⟨e, q, r, h₁, h₂⟩ + · exact Or.inl ⟨q, hh.trans h₁, h₂⟩ + · exact Or.inr ⟨e, q, r, hh.trans h₁, h₂⟩ + +/-- A path in `X` with ends in `X ∩ Y` is homotopic in `X ∪ Y` to a path in `X ∩ Y`. This is the +step of the +paper's proof of (3.1). -/ +private theorem flatten (hsc : IsSimplyConnectedSet X) (hL : IsPathConnected (X ∩ Y)) + {e c : (X ∪ Y : Set S)} (r : Path e c) (hr : ∀ u, (r u).1 ∈ X) (he : e.1 ∈ Y) (hc : c.1 ∈ Y) : + ∃ r' : Path e c, r.Homotopic r' ∧ ∀ u, (r' u).1 ∈ Y := by + have heX : e.1 ∈ X := by simpa using hr 0 + have hcX : c.1 ∈ X := by simpa using hr 1 + obtain ⟨c', hc'⟩ := hL.joinedIn _ ⟨heX, he⟩ _ ⟨hcX, hc⟩ + refine ⟨pathCod c' e.2 c.2 fun u => Or.inl (hc' u).1, ?_, fun u => (hc' u).2⟩ + exact homotopic_of_mem hsc subset_union_left _ _ heX hcX hr fun u => (hc' u).1 + +private theorem IsPushed.step (hsc : IsSimplyConnectedSet X) (hL : IsPathConnected (X ∩ Y)) + {a c d : (X ∪ Y : Set S)} {ω : Path a c} (h : IsPushed X Y ω) (s : Path c d) + (hs : (∀ u, (s u).1 ∈ X) ∨ ∀ u, (s u).1 ∈ Y) : IsPushed X Y (ω.trans s) := by + rcases h with ⟨q, h₁, h₂⟩ | ⟨e, q, r, h₁, h₂, h₃⟩ + · rcases hs with hs | hs + · exact Or.inr ⟨c, q, s, h₁.hcomp (Path.Homotopic.refl s), h₂, hs⟩ + · exact Or.inl ⟨q.trans s, h₁.hcomp (Path.Homotopic.refl s), trans_mem h₂ hs⟩ + · have hassoc : (ω.trans s).Homotopic (q.trans (r.trans s)) := + (h₁.hcomp (Path.Homotopic.refl s)).trans (Path.Homotopic.trans_assoc q r s) + rcases hs with hs | hs + · exact Or.inr ⟨e, q, r.trans s, hassoc, h₂, trans_mem h₃ hs⟩ + · have heY : e.1 ∈ Y := by simpa using h₂ 1 + have hcY : c.1 ∈ Y := by simpa using hs 0 + obtain ⟨r', hr', hr'Y⟩ := flatten hsc hL r h₃ heY hcY + refine Or.inl ⟨q.trans (r'.trans s), hassoc.trans ?_, trans_mem h₂ (trans_mem hr'Y hs)⟩ + exact (Path.Homotopic.refl q).hcomp (hr'.hcomp (Path.Homotopic.refl s)) + +/-- Each path of `X ∪ Y` with ends in `Y` is homotopic to a path in `Y`, when `X` and `Y` are cones +at each +point of `X ∪ Y`. -/ +theorem exists_homotopic_path_of_cones (hsc : IsSimplyConnectedSet X) (hL : IsPathConnected (X ∩ Y)) + (hcone : ∀ z ∈ X ∪ Y, IsLocalCone X Y z) {a b : (X ∪ Y : Set S)} (p : Path a b) (ha : a.1 ∈ Y) + (hb : b.1 ∈ Y) : ∃ q : Path a b, p.Homotopic q ∧ ∀ u, (q u).1 ∈ Y := by + let good : Set I → Prop := fun O => IsOpen O ∧ ∃ K : Set S, IsSimplyConnectedSet K ∧ K ⊆ X ∪ Y ∧ + (∀ u ∈ O, (p u).1 ∈ K) ∧ ∃ z ∈ K, ∀ c ∈ K, JoinedIn (K ∩ X) c z ∨ JoinedIn (K ∩ Y) c z + have hcont : Continuous fun u : I => (p u).1 := by fun_prop + have hcover : (univ : Set I) ⊆ ⋃ O : {O : Set I // good O}, O.1 := by + intro u _ + obtain ⟨O, K, hO, hzO, hsub, hK, hsc', hzK, hj⟩ := hcone _ (p u).2 + exact mem_iUnion.mpr ⟨⟨_, hO.preimage hcont, K, hsc', hK, fun w hw => hsub ⟨(p w).2, hw⟩, _, + hzK, hj⟩, hzO⟩ + obtain ⟨t, ht0, htmono, ⟨n₀, hn₀⟩, htO⟩ := exists_monotone_Icc_subset_open_cover_unitInterval + (fun O : {O : Set I // good O} => O.2.1) hcover + have h0Y : (p 0).1 ∈ Y := by simpa using ha + have key : ∀ n, IsPushed X Y (p.subpath 0 (t n)) := by + intro n + induction n with + | zero => + rw [ht0, Path.subpath_self] + exact Or.inl ⟨Path.refl _, Path.Homotopic.refl _, fun _ => h0Y⟩ + | succ n ih => + obtain ⟨⟨O, _, K, hK, hKZ, hKO, z, hzK, hj⟩, hsub⟩ := htO n + have hle : t n ≤ t (n + 1) := htmono (Nat.le_succ n) + let zT : (X ∪ Y : Set S) := ⟨z, hKZ hzK⟩ + have harm : ∀ x : (X ∪ Y : Set S), x.1 ∈ K → ∃ α : Path x zT, (∀ u, (α u).1 ∈ K) ∧ + ((∀ u, (α u).1 ∈ X) ∨ ∀ u, (α u).1 ∈ Y) := by + intro x hx + rcases hj x.1 hx with ⟨c, hc⟩ | ⟨c, hc⟩ + · exact ⟨pathCod c x.2 zT.2 fun u => hKZ (hc u).1, fun u => (hc u).1, + Or.inl fun u => (hc u).2⟩ + · exact ⟨pathCod c x.2 zT.2 fun u => hKZ (hc u).1, fun u => (hc u).1, + Or.inr fun u => (hc u).2⟩ + have hpK : ∀ w ∈ Icc (t n) (t (n + 1)), (p w).1 ∈ K := fun w hw => hKO w (hsub hw) + obtain ⟨α, hαK, hα⟩ := harm (p (t n)) (hpK _ ⟨le_rfl, hle⟩) + obtain ⟨β, hβK, hβ⟩ := harm (p (t (n + 1))) (hpK _ ⟨hle, le_rfl⟩) + have hpiece : ∀ u, ((p.subpath (t n) (t (n + 1))) u).1 ∈ K := by + intro u + have : (p.subpath (t n) (t (n + 1))) u ∈ p '' uIcc (t n) (t (n + 1)) := by + rw [← Path.range_subpath] + exact mem_range_self u + obtain ⟨v, hv, hv'⟩ := this + rw [uIcc_of_le hle] at hv + rw [← hv'] + exact hpK v hv + have hβs : ∀ {A : Set S}, (∀ u, (β u).1 ∈ A) → ∀ u, (β.symm u).1 ∈ A := fun hA u => by + rw [Path.symm_apply] + exact hA _ + have hh : (p.subpath (t n) (t (n + 1))).Homotopic (α.trans β.symm) := + homotopic_of_mem hK hKZ _ _ (hpK _ ⟨le_rfl, hle⟩) (hpK _ ⟨hle, le_rfl⟩) hpiece + (trans_mem hαK (hβs hβK)) + have h₁ := (ih.step hsc hL α hα).step hsc hL β.symm (hβ.imp hβs hβs) + refine h₁.congr ?_ + refine (Path.Homotopic.subpath_trans_subpath p 0 (t n) (t (n + 1))).symm.trans ?_ + exact ((Path.Homotopic.refl _).hcomp hh).trans (Path.Homotopic.trans_assoc _ _ _).symm + have hfin := key n₀ + rw [hn₀ n₀ le_rfl] at hfin + have h1Y : (p 1).1 ∈ Y := by simpa using hb + have hdone : ∃ q : Path (p 0) (p 1), (p.subpath 0 1).Homotopic q ∧ ∀ u, (q u).1 ∈ Y := by + rcases hfin with h | ⟨e, q, r, h₁, h₂, h₃⟩ + · exact h + · have heY : e.1 ∈ Y := by simpa using h₂ 1 + obtain ⟨r', hr', hr'Y⟩ := flatten hsc hL r h₃ heY h1Y + exact ⟨q.trans r', h₁.trans ((Path.Homotopic.refl q).hcomp hr'), trans_mem h₂ hr'Y⟩ + obtain ⟨q, hq, hqY⟩ := hdone + rw [Path.subpath_zero_one] at hq + refine ⟨q.cast p.source.symm p.target.symm, ?_, fun w => ?_⟩ + · have e : (p.cast p.source p.target).cast p.source.symm p.target.symm = p := by + ext w + simp + have h := Path.Homotopic.pathCast hq p.source.symm p.target.symm + rwa [e] at h + · simpa using hqY w + +/-- **(3.1)** of Graph Minors XI (page 76), for closed nice sets. -/ +theorem nice_31 : Nice31Statement.{u} := by + intro S _ _ _ hS Γ X Y hX hY hXn hYn hsc hL + exact exists_push_of_paths hsc hL fun p ha hb => + exists_homotopic_path_of_cones hsc hL (fun _ hz => isLocalCone hS hX hY hXn hYn hz) p ha hb + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/NiceSets.lean b/LeanPool/GraphMinor/GM11/NiceSets.lean new file mode 100644 index 0000000000..e1f581f605 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/NiceSets.lean @@ -0,0 +1,139 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section7 +public import LeanPool.GraphMinor.GM11.EdgeSides +public import LeanPool.GraphMinor.GM11.Regions +public import LeanPool.GraphMinor.GM11.Section4c +public import LeanPool.GraphMinor.Surface.InvarianceOfDomain +public import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# The frontier of a `Γ`-nice set + +A `Γ`-nice set is a union of vertices, edges and regions of `Γ`, and so an edge or a region lies +inside it +or misses it. `frontier_interSet` says that the frontier of a closed `Γ`-nice set is the point set +of the +drawing `Γ ∩ bd(X)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {Γ : Drawing S} {X : Set S} + +omit [T2Space S] in +/-- An atom of `Γ` lies inside a `Γ`-nice set or misses it. -/ +theorem nice_atom (hX : IsGammaNice Γ X) {a : Set S} (ha : a ∈ Γ.A) (hne : + (a ∩ X).Nonempty) : a ⊆ X := by + obtain ⟨𝒜, h𝒜, rfl⟩ := hX + obtain ⟨z, hza, hzX⟩ := hne + obtain ⟨b, hb, hzb⟩ := mem_sUnion.mp hzX + have hab : a = b := by + have hdis : ∀ {c d : Set S}, c ∈ Γ.A → d ∈ Γ.A → z ∈ c → z ∈ d → c = d := by + rintro c d ((⟨v, hv, rfl⟩ | hc) | hc) ((⟨w, hw, rfl⟩ | hd) | hd) hzc hzd + · have h₁ : z = v := hzc + have h₂ : z = w := hzd + subst h₁ + subst h₂ + rfl + · exact ((hd.2.1 hzd).2 (mem_singleton_iff.mp hzc ▸ hv)).elim + · exact (region_subset hd hzd (Γ.V_subset_U (mem_singleton_iff.mp hzc ▸ hv))).elim + · exact ((hc.2.1 hzc).2 (mem_singleton_iff.mp hzd ▸ hw)).elim + · exact Γ.edge_eq_of_mem hc hd hzc hzd + · exact (region_subset hd hzd (hc.2.1 hzc).1).elim + · exact (region_subset hc hzc (Γ.V_subset_U (mem_singleton_iff.mp hzd ▸ hw))).elim + · exact (region_subset hc hzc (hd.2.1 hzd).1).elim + · exact region_eq_of_mem hc hd hzc hzd + exact hdis ha (h𝒜 hb) hza hzb + subst hab + exact fun x hx => mem_sUnion.mpr ⟨a, hb, hx⟩ + +omit [T2Space S] in +theorem nice_edge (hX : IsGammaNice Γ X) {e : Set S} (he : e ∈ Γ.E) (hne : + (e ∩ X).Nonempty) : e ⊆ X := + nice_atom hX (Or.inl (Or.inr he)) hne + +omit [T2Space S] in +theorem nice_region (hX : IsGammaNice Γ X) {r : Set S} (hr : r ∈ Γ.R) (hne : + (r ∩ X).Nonempty) : r ⊆ X := + nice_atom hX (Or.inr hr) hne + +/-- An edge in a closed `Γ`-nice set with a point on its frontier lies on its frontier. -/ +theorem edge_subset_frontier (hS : IsClosedSurface S) (hXc : IsClosed X) + (hXn : IsGammaNice Γ X) {e : Set S} (he : e ∈ Γ.E) {y : S} (hye : y ∈ e) + (hy : y ∈ frontier X) : e ⊆ frontier X := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨W, A₁, A₂, hW, hyW, -, hcov, c₁, c₂, d₁, d₂, h₁, h₂⟩ := + exists_edge_sides hS Γ he hye + have hyc : y ∈ closure Xᶜ := by + rw [closure_compl] + exact hy.2 + have hyX : y ∈ closure X := hy.1 + obtain ⟨w, hwW, hwc⟩ := mem_closure_iff.mp hyc W hW hyW + obtain ⟨z, ⟨hzW, hzc⟩, hzU⟩ := exists_notMem_U (Γ := Γ) hS + (hW.inter hXc.isOpen_compl) ⟨w, hwW, hwc⟩ + obtain ⟨p, hp, hzp⟩ := exists_region_of_notMem hzU + have hpX : p ⊆ Xᶜ := fun x hx hxX => hzc (nice_region hXn hp ⟨x, hx, hxX⟩ hzp) + have hinc : (e ∩ closure p).Nonempty := by + have hmem : z ∈ W \ Γ.U := ⟨hzW, hzU⟩ + rcases hcov hmem with h | h + · exact ⟨y, hye, closure_mono (subset_region hp c₁ d₁ h hzp) (h₁ ⟨hye, hyW⟩)⟩ + · exact ⟨y, hye, closure_mono (subset_region hp c₂ d₂ h hzp) (h₂ ⟨hye, hyW⟩)⟩ + have hecl := edge_subset_closure_of_incident hS he hp hinc + have heX : e ⊆ X := nice_edge hXn he ⟨y, hye, hXc.frontier_subset hy⟩ + intro x hx + refine ⟨subset_closure (heX hx), ?_⟩ + have := closure_mono hpX (hecl hx) + rwa [closure_compl] at this + +/-- **The frontier of a closed `Γ`-nice set** is the point set of `Γ ∩ bd(X)`. -/ +theorem frontier_interSet (hS : IsClosedSurface S) (hXc : IsClosed X) + (hXn : IsGammaNice Γ X) : (Γ.interSet (frontier X)).U = frontier X := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hsE : Γ.interSet (frontier X) = Γ.span (Γ.V ∩ frontier X) {e | e ∈ Γ.E ∧ e ⊆ frontier X} + := rfl + have hEs : ∀ e, e ∈ (Γ.interSet (frontier X)).E ↔ e ∈ Γ.E ∧ e ⊆ frontier X := by + intro e + rw [hsE, Γ.span_E] + exact ⟨fun h => h.1, fun h => ⟨h, h.1⟩⟩ + have hfc : IsClosed (frontier X) := isClosed_frontier + apply subset_antisymm + · rw [Drawing.U_eq] + rintro x (hx | hx) + · rcases hx with ⟨⟨-, hx⟩, -⟩ | hx + · exact hx + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact closure_minimal he.1.2 hfc hxe.1 + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact closure_minimal ((hEs e).mp he).2 hfc hxe + · intro y hy + have hyX : y ∈ X := hXc.frontier_subset hy + by_cases hyU : y ∈ Γ.U + · by_cases hyV : y ∈ Γ.V + · exact (Γ.interSet (frontier X)).V_subset_U (by + rw [hsE] + exact Or.inl ⟨⟨hyV, hy⟩, hyV⟩) + · rw [Γ.U_eq] at hyU + obtain ⟨e, he, hye⟩ := mem_iUnion₂.mp (hyU.resolve_left hyV) + have hyee : y ∈ e := (Γ.closure_diff_V he).subset ⟨hye, hyV⟩ + have hsub := edge_subset_frontier hS hXc hXn he hyee hy + exact (Γ.interSet (frontier X)).closure_subset_U ((hEs e).mpr ⟨he, hsub⟩) hye + · obtain ⟨p, hp, hyp⟩ := exists_region_of_notMem hyU + have hpX := nice_region hXn hp ⟨y, hyp, hyX⟩ + exact (hy.2 (interior_maximal hpX (region_isOpen hp) hyp)).elim + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/NiceStatements.lean b/LeanPool/GraphMinor/GM11/NiceStatements.lean new file mode 100644 index 0000000000..0fbdc51b86 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/NiceStatements.lean @@ -0,0 +1,243 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Restraints +public import LeanPool.GraphMinor.GM11.Section7b +public import LeanPool.GraphMinor.GM11.OArcCircuit + +/-! +# Nice sets + +`Nice31Statement` and `Nice73Statement` are (3.1) and (7.3) of Graph Minors XI for closed `Γ`-nice +sets. The +paper's (3.1) needs a tameness condition (see the correction to (3.1) in `corrections/GM11.md`), and +closed nice sets satisfy it. Section 8 uses them through these statements. + +The lemmas here show that sets are nice. `isGammaNice_of_frontier` is the main one: a set whose +frontier +lies in a subdrawing, which it contains, is nice. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +/-- (3.1) of Graph Minors XI (page 76), for closed nice sets. -/ +def Nice31Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T2Space S] [ConnectedSpace S], IsClosedSurface S → + ∀ (Γ : Drawing S) (X Y : Set S), IsClosed X → IsClosed Y → IsGammaNice Γ X → IsGammaNice Γ Y → + IsSimplyConnectedSet X → IsPathConnected (X ∩ Y) → CanPush X Y + +/-- (7.3) of Graph Minors XI (page 93), for closed nice sets: "If $Z \subseteq \Sigma$ is nice and +$\phi \colon S^1 \to Z$ is continuous and not +null-homotopic in $Z$, then there is an $O$-arc $F \subseteq |\phi|$ which is not +null-homotopic in $Z$." -/ +def Nice73Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T2Space S] [ConnectedSpace S], IsClosedSurface S → + ∀ (Γ : Drawing S) (Z : Set S), IsClosed Z → IsGammaNice Γ Z → + ∀ φ : C(Circle, S), range φ ⊆ Z → ¬ ClosedCurveIsNullHomotopicIn Z φ → + ∃ F : Set S, IsOArc F ∧ F ⊆ range φ ∧ ¬ IsNullHomotopicOArcIn Z F + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {Γ : Drawing S} + +omit [T2Space S] in +/-- A closed disc is the closure of its interior: each boundary point is a limit of inner points. -/ +theorem discBd_subset_closure {Δ : Set S} (hΔ : IsClosedDisc Δ) {y : S} (hy : y ∈ discBd Δ) : + y ∈ closure (Δ \ discBd Δ) := by + obtain ⟨φ⟩ := hΔ + have hbd := disc_boundary Δ φ + rw [hbd] at hy + obtain ⟨z, hz, rfl⟩ := hy + have hz1 : ‖z.1‖ = 1 := by simpa [UnitCircle] using hz + let c : ℕ → ClosedUnitDisc := fun n => ⟨(1 - 1 / ((n : ℝ) + 2)) • z.1, by + have h₁ : (0 : ℝ) < 1 / ((n : ℝ) + 2) := by positivity + have h₂ : 1 / ((n : ℝ) + 2) ≤ 1 / 2 := by + apply one_div_le_one_div_of_le (by norm_num) + linarith [(Nat.cast_nonneg n : (0 : ℝ) ≤ n)] + simp only [ClosedUnitDisc, Metric.mem_closedBall, dist_zero_right, norm_smul, hz1, + mul_one, Real.norm_eq_abs] + rw [abs_of_nonneg (by linarith)] + linarith⟩ + have hlim : Filter.Tendsto c Filter.atTop (𝓝 z) := by + rw [tendsto_subtype_rng] + have h₁ : Filter.Tendsto (fun n : ℕ => 1 / ((n : ℝ) + 2)) Filter.atTop (𝓝 0) := by + have := tendsto_one_div_add_atTop_nhds_zero_nat (𝕜 := ℝ) + have h₂ := (Filter.tendsto_add_atTop_iff_nat 1).mpr this + refine h₂.congr fun n => ?_ + push_cast + ring_nf + have h₂ : Filter.Tendsto (fun n : ℕ => (1 - 1 / ((n : ℝ) + 2)) • z.1) Filter.atTop + (𝓝 ((1 - 0 : ℝ) • z.1)) := (tendsto_const_nhds.sub h₁).smul_const z.1 + rw [sub_zero, one_smul] at h₂ + exact h₂ + have hlim' := (continuous_subtype_val.comp φ.continuous).tendsto z |>.comp hlim + refine mem_closure_of_tendsto hlim' (Filter.Eventually.of_forall fun n => ?_) + refine ⟨(φ (c n)).2, ?_⟩ + rw [hbd] + rintro ⟨w, hw, hwc⟩ + have hw' := φ.injective (Subtype.ext hwc) + have hn : ‖(c n).1‖ = 1 := by + rw [← hw'] + simpa [UnitCircle] using hw + have h₁ : (0 : ℝ) < 1 / ((n : ℝ) + 2) := by positivity + have h₂ : 1 / ((n : ℝ) + 2) ≤ 1 / 2 := by + apply one_div_le_one_div_of_le (by norm_num) + linarith [(Nat.cast_nonneg n : (0 : ℝ) ≤ n)] + have h₃ : ‖(c n).1‖ = 1 - 1 / ((n : ℝ) + 2) := by + change ‖(1 - 1 / ((n : ℝ) + 2)) • z.1‖ = _ + rw [norm_smul, hz1, mul_one, Real.norm_eq_abs, abs_of_nonneg (by linarith)] + linarith + +omit [T2Space S] in +/-- Each point of the surface lies in a vertex, an edge or a region. -/ +theorem exists_atom (Γ : Drawing S) (x : S) : ∃ a ∈ Γ.A, x ∈ a := by + by_cases hV : x ∈ Γ.V + · exact ⟨{x}, Or.inl (Or.inl ⟨x, hV, rfl⟩), rfl⟩ + by_cases hU : x ∈ Γ.U + · obtain ⟨e, he, hx⟩ := Γ.exists_edge_of_mem hU hV + exact ⟨e, Or.inl (Or.inr he), hx⟩ + · obtain ⟨r, hr, hx⟩ := exists_region_of_notMem hU + exact ⟨r, Or.inr hr, hx⟩ + +omit [T2Space S] in +/-- A set that contains each atom it meets is nice. -/ +theorem isGammaNice_of_sat {X : Set S} (h : ∀ a ∈ Γ.A, (a ∩ X).Nonempty → a ⊆ X) : IsGammaNice Γ X + := by + refine ⟨{a | a ∈ Γ.A ∧ (a ∩ X).Nonempty}, fun a ha => ha.1, subset_antisymm (fun x hx => ?_) ?_⟩ + · obtain ⟨a, ha, hxa⟩ := exists_atom Γ x + exact mem_sUnion.mpr ⟨a, ⟨ha, x, hxa, hx⟩, hxa⟩ + · refine sUnion_subset fun a ha => h a ha.1 ha.2 + +omit [T2Space S] in +theorem IsGammaNice.union {X Y : Set S} (hX : IsGammaNice Γ X) (hY : IsGammaNice Γ Y) : + IsGammaNice Γ (X ∪ Y) := by + refine isGammaNice_of_sat fun a ha hne => ?_ + obtain ⟨x, hxa, hx | hx⟩ := hne + · exact (nice_atom hX ha ⟨x, hxa, hx⟩).trans subset_union_left + · exact (nice_atom hY ha ⟨x, hxa, hx⟩).trans subset_union_right + +omit [T2Space S] in +theorem IsGammaNice.inter {X Y : Set S} (hX : IsGammaNice Γ X) (hY : IsGammaNice Γ Y) : + IsGammaNice Γ (X ∩ Y) := by + refine isGammaNice_of_sat fun a ha hne => ?_ + obtain ⟨x, hxa, hx, hy⟩ := hne + exact subset_inter (nice_atom hX ha ⟨x, hxa, hx⟩) (nice_atom hY ha ⟨x, hxa, hy⟩) + +omit [T2Space S] in +/-- An atom is preconnected. -/ +theorem isPreconnected_atom {a : Set S} (ha : a ∈ Γ.A) : IsPreconnected a + := by + rcases ha with (⟨v, -, rfl⟩ | he) | hr + · exact isPreconnected_singleton + · exact he.2.2.1.isConnected.isPreconnected + · exact region_isPreconnected hr + +omit [T2Space S] in +/-- A preconnected set that meets a set and its complement meets the frontier of the set. -/ +theorem meets_frontier {a T : Set S} (ha : IsPreconnected a) (h₁ : (a ∩ T).Nonempty) + {z : S} (hza : z ∈ a) (hzT : z ∉ T) : ∃ y ∈ a, y ∈ frontier T := by + by_contra hno + push Not at hno + have hin : ∀ y ∈ a, y ∈ T → y ∈ interior T := fun y hy hyT => by + by_contra hni + exact hno y hy ⟨subset_closure hyT, hni⟩ + have hout : ∀ y ∈ a, y ∉ T → y ∈ (closure T)ᶜ := fun y hy hyT hcl => + hno y hy ⟨hcl, fun hi => hyT (interior_subset hi)⟩ + obtain ⟨x, hxa, hxT⟩ := h₁ + obtain ⟨y, -, hy₁, hy₂⟩ := ha (interior T) (closure T)ᶜ isOpen_interior + isClosed_closure.isOpen_compl + (fun y hy => by + by_cases hyT : y ∈ T + · exact Or.inl (hin y hy hyT) + · exact Or.inr (hout y hy hyT)) + ⟨x, hxa, hin x hxa hxT⟩ ⟨z, hza, hout z hza hzT⟩ + exact hy₂ (subset_closure (interior_subset hy₁)) + +omit [T2Space S] in +/-- **A set with its frontier in a subdrawing that it contains is nice.** -/ +theorem isGammaNice_of_frontier {N : Drawing S} {T : Set S} + (hN : N.IsSubdrawing Γ) (hNT : N.U ⊆ T) (hf : frontier T ⊆ N.U) : IsGammaNice Γ T := by + refine isGammaNice_of_sat fun a ha hne => ?_ + by_contra hnot + obtain ⟨z, hza, hzT⟩ := not_subset.mp hnot + obtain ⟨y, hya, hyf⟩ := meets_frontier (isPreconnected_atom ha) hne hza hzT + have hyU : y ∈ N.U := hf hyf + rcases ha with (⟨v, -, rfl⟩ | he) | hr + · have h₁ : y = v := hya + have h₂ : z = v := hza + exact hzT (h₂.trans h₁.symm ▸ hNT hyU) + · have hyV : y ∉ N.V := fun h => (he.2.1 hya).2 (hN.1 h) + obtain ⟨e', he', hye'⟩ := N.exists_edge_of_mem hyU hyV + obtain rfl := Γ.edge_eq_of_mem he (hN.2 he') hya hye' + exact hzT (hNT (N.closure_subset_U he' (subset_closure hza))) + · exact region_subset hr hya (hN.U_subset hyU) + +/-- The closure of an edge is path-connected. -/ +theorem isPathConnected_closure_edge [ConnectedSpace S] {e : Set S} (he : e ∈ Γ.E) : + IsPathConnected (closure e) := by + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + have hcl : closure e = range (γ e) := by + apply subset_antisymm + · refine closure_minimal ?_ (isCompact_range (hγ.cont e he)).isClosed + intro y hy + obtain ⟨t, -, rfl⟩ := (hγ.image e he).superset hy + exact mem_range_self t + · rintro _ ⟨t, rfl⟩ + have ht : t ∈ closure (Ioo (0 : I) 1) := by + rw [closure_Ioo (zero_ne_one' I)] + exact ⟨t.2.1, t.2.2⟩ + have := image_closure_subset_closure_image (hγ.cont e he) (mem_image_of_mem _ ht) + rwa [hγ.image e he] at this + rw [hcl] + have hI : PathConnectedSpace I := isPathConnected_iff_pathConnectedSpace.mp + ((convex_Icc (0 : ℝ) 1).isPathConnected ⟨0, by simp⟩) + rw [← image_univ] + exact isPathConnected_univ.image (hγ.cont e he) + +/-- The point set of a walk is path-connected. -/ +theorem isPathConnected_walk_U [ConnectedSpace S] {u v : S} (W : GraphWalk Γ.toGraph u v) : + IsPathConnected {x | x ∈ W.support ∨ ∃ e ∈ W.edges, x ∈ closure e} := by + induction W with + | @nil a ha => + have heq : {x | x ∈ (GraphWalk.nil ha : GraphWalk Γ.toGraph a a).support ∨ + ∃ e ∈ (GraphWalk.nil ha : GraphWalk Γ.toGraph a a).edges, x ∈ closure e} = {a} := by + ext x + simp [GraphWalk.support, GraphWalk.edges] + rw [heq] + exact isPathConnected_singleton a + | @cons a b c e hlink rest ih => + have hab : a ∈ closure e ∧ b ∈ closure e := by + have h : a ∈ closure e ∩ Γ.V ∧ b ∈ closure e ∩ Γ.V := by + rw [hlink.2.2.2] + exact ⟨Or.inl rfl, Or.inr rfl⟩ + exact ⟨h.1.1, h.2.1⟩ + have heq : {z | z ∈ (GraphWalk.cons hlink rest).support ∨ + ∃ f ∈ (GraphWalk.cons hlink rest).edges, z ∈ closure f} = + closure e ∪ {z | z ∈ rest.support ∨ ∃ f ∈ rest.edges, z ∈ closure f} := by + ext z + simp only [GraphWalk.support, GraphWalk.edges, List.mem_cons, mem_ofPred_eq, mem_union] + constructor + · rintro ((rfl | h) | ⟨f, (rfl | hf), hz⟩) + · exact Or.inl hab.1 + · exact Or.inr (Or.inl h) + · exact Or.inl hz + · exact Or.inr (Or.inr ⟨f, hf, hz⟩) + · rintro (h | h | ⟨f, hf, hz⟩) + · exact Or.inr ⟨e, Or.inl rfl, h⟩ + · exact Or.inl (Or.inr h) + · exact Or.inr ⟨f, Or.inr hf, hz⟩ + rw [heq] + refine (isPathConnected_closure_edge hlink.1).union ih ⟨b, hab.2, Or.inl rest.start_mem_support⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/NormalNoncover.lean b/LeanPool/GraphMinor/GM11/NormalNoncover.lean new file mode 100644 index 0000000000..20d9d5b539 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/NormalNoncover.lean @@ -0,0 +1,121 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +import LeanPool.GraphMinor.GM11.DrawingTopology +public import LeanPool.GraphMinor.GM11.Section6Pretangle + +/-! Closed sides with normal frontiers give the non-cover criterion for a pretangle. -/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology Surface + +variable {S : Type*} [TopologicalSpace S] {Γ : PaintingOrDrawing S} {Γ' : Drawing S} + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + +theorem PaintingOrDrawing.toHypergraph_inc {Γ : PaintingOrDrawing S} {e : Set S} {v : S} : + Γ.toHypergraph.Inc e v ↔ e ∈ Γ.E ∧ v ∈ Γ.V ∧ v ∈ closure e := by + cases Γ <;> rfl + +theorem PaintingOrDrawing.edge_props {Γ : PaintingOrDrawing S} {e : Set S} (he : e ∈ Γ.E) : + IsPreconnected e ∧ Disjoint e Γ.V ∧ e ⊆ Γ.U ∧ e.Nonempty := by + cases Γ with + | painting Γ => + exact ⟨he.2.2.1.isConnected.isPreconnected, disjoint_left.mpr fun x hx => (he.2.1 hx).2, + fun x hx => (he.2.1 hx).1, he.1⟩ + | drawing Γ => + exact ⟨he.2.2.1.isConnected.isPreconnected, disjoint_left.mpr fun x hx => (he.2.1 hx).2, + fun x hx => (he.2.1 hx).1, he.1⟩ + +/-- An edge lies wholly inside or outside a closed set with normal +frontier, because it is connected and misses the frontier. -/ +theorem edge_subset_or_disjoint_of_normal_frontier {Δ : Set S} (hΔ : IsClosed Δ) + (hb : Γ.IsNormal (frontier Δ)) {e : Set S} (he : e ∈ Γ.E) : + e ⊆ Δ ∨ Disjoint e Δ := by + obtain ⟨hp, hd, hU, _⟩ := Γ.edge_props he + apply subset_or_disjoint_of_frontier hΔ hp + exact Set.disjoint_left.mpr fun x hx hf => Set.disjoint_left.mp hd hx (hb ⟨hf, hU hx⟩) + +/-- The second tangle axiom excludes three small closed sides with +normal frontiers covering the drawing. -/ +theorem not_support_subset_of_normal_frontiers (hT : IsPretangle Γ.toHypergraph θ T) + {Δ₁ Δ₂ Δ₃ : Set S} (c₁ : IsClosed Δ₁) (c₂ : IsClosed Δ₂) (c₃ : IsClosed Δ₃) + (b₁ : Γ.IsNormal (frontier Δ₁)) (b₂ : Γ.IsNormal (frontier Δ₂)) (b₃ : Γ.IsNormal (frontier Δ₃)) + (m₁ : (Γ.inter Δ₁, Γ.interOutside Δ₁) ∈ T) (m₂ : (Γ.inter Δ₂, Γ.interOutside Δ₂) ∈ T) + (m₃ : (Γ.inter Δ₃, Γ.interOutside Δ₃) ∈ T) (hcov : Γ.U ⊆ Δ₁ ∪ Δ₂ ∪ Δ₃) : False := by + have hedge : ∀ e ∈ Γ.E, e ⊆ Δ₁ ∨ e ⊆ Δ₂ ∨ e ⊆ Δ₃ := by + intro e he + obtain ⟨x, hx⟩ := (Γ.edge_props he).2.2.2 + have hxc : x ∈ Δ₁ ∪ Δ₂ ∪ Δ₃ := hcov ((Γ.edge_props he).2.2.1 hx) + have side : ∀ {Δ : Set S}, IsClosed Δ → Γ.IsNormal (frontier Δ) → x ∈ Δ → e ⊆ Δ := fun c b h => + (edge_subset_or_disjoint_of_normal_frontier c b he).resolve_right + fun hd => disjoint_left.mp hd hx h + rcases hxc with (h | h) | h + · exact Or.inl (side c₁ b₁ h) + · exact Or.inr (Or.inl (side c₂ b₂ h)) + · exact Or.inr (Or.inr (side c₃ b₃ h)) + refine hT.axiom2 m₁ m₂ m₃ (Hypergraph.ext ?_ ?_ ?_) + · ext v + simp only [PaintingOrDrawing.toHypergraph_vertexSet] + constructor + · rintro ((h | h) | h) <;> exact h.1 + · intro hv + have hvU : v ∈ Γ.U := by + cases Γ with + | painting G => exact G.V_subset_U hv + | drawing G => exact G.V_subset_U hv + have hvc : v ∈ Δ₁ ∪ Δ₂ ∪ Δ₃ := hcov hvU + rcases hvc with (h | h) | h + · exact Or.inl (Or.inl ⟨hv, h⟩) + · exact Or.inl (Or.inr ⟨hv, h⟩) + · exact Or.inr ⟨hv, h⟩ + · ext e + simp only [PaintingOrDrawing.toHypergraph_edgeSet] + constructor + · rintro ((h | h) | h) <;> exact h.1 + · intro he + rcases hedge e he with h | h | h + · exact Or.inl (Or.inl ⟨he, h⟩) + · exact Or.inl (Or.inr ⟨he, h⟩) + · exact Or.inr ⟨he, h⟩ + · funext e v + apply propext + constructor + · rintro ((h | h) | h) <;> exact h.1 + · intro hi + have hcl : ∀ {Δ : Set S}, IsClosed Δ → e ⊆ Δ → v ∈ Δ := fun c h => + c.closure_subset_iff.mpr h (PaintingOrDrawing.toHypergraph_inc.mp hi).2.2 + rcases hedge e (PaintingOrDrawing.toHypergraph_inc.mp hi).1 with h | h | h + · exact Or.inl (Or.inl ⟨hi, h, hcl c₁ h⟩) + · exact Or.inl (Or.inr ⟨hi, h, hcl c₂ h⟩) + · exact Or.inr ⟨hi, h, hcl c₃ h⟩ + +/-- An edge of `Γ` misses `U(Γ')`, so it lies inside or outside a closed set with frontier in +`U(Γ')`. -/ +theorem edge_subset_or_disjoint_of_radial (hrad : Γ.U ∩ Γ'.U = Γ.V) {Δ : Set S} (hΔ : IsClosed Δ) + (hb : frontier Δ ⊆ Γ'.U) {e : Set S} (he : e ∈ Γ.E) : e ⊆ Δ ∨ Disjoint e Δ := + edge_subset_or_disjoint_of_normal_frontier hΔ (fun _ hx => hrad ▸ ⟨hx.2, hb hx.1⟩) he + +/-- Three small closed sides with radial frontiers cannot cover the surface. -/ +theorem not_cover_of_radial_frontiers (hT : IsPretangle Γ.toHypergraph θ T) + (hrad : Γ.U ∩ Γ'.U = Γ.V) + {Δ₁ Δ₂ Δ₃ : Set S} (c₁ : IsClosed Δ₁) (c₂ : IsClosed Δ₂) (c₃ : IsClosed Δ₃) + (b₁ : frontier Δ₁ ⊆ Γ'.U) (b₂ : frontier Δ₂ ⊆ Γ'.U) (b₃ : frontier Δ₃ ⊆ Γ'.U) + (m₁ : (Γ.inter Δ₁, Γ.interOutside Δ₁) ∈ T) (m₂ : (Γ.inter Δ₂, Γ.interOutside Δ₂) ∈ T) + (m₃ : (Γ.inter Δ₃, Γ.interOutside Δ₃) ∈ T) + (hcov : Δ₁ ∪ Δ₂ ∪ Δ₃ = univ) : False := by + have normal {Δ : Set S} (h : frontier Δ ⊆ Γ'.U) : Γ.IsNormal (frontier Δ) := + fun _ hx => hrad ▸ ⟨hx.2, h hx.1⟩ + exact not_support_subset_of_normal_frontiers hT c₁ c₂ c₃ + (normal b₁) (normal b₂) (normal b₃) m₁ m₂ m₃ (hcov ▸ subset_univ _) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/OArcCircuit.lean b/LeanPool/GraphMinor/GM11/OArcCircuit.lean new file mode 100644 index 0000000000..0694e7d3f8 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/OArcCircuit.lean @@ -0,0 +1,487 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.EvenCircuit +public import LeanPool.GraphMinor.GM11.PaintingRegions +public import LeanPool.GraphMinor.GM11.Separate +public import LeanPool.GraphMinor.GM11.PaintingFacts + +/-! +# An `O`-arc in a drawing is a circuit + +`exists_circuit_of_oArc` says that an `O`-arc inside the point set of a drawing is the point set of +a circuit. +Graph Minors XI, (8.5), uses this without comment when it says that an `O`-arc in `U(W)` bounds a +disc in +`ins(W)`. An edge that meets the `O`-arc lies in it (`edge_subset_of_oArc`). Then the `O`-arc is a +union of +edges, each edge lies on a circuit of this union, since the arc stays connected when a point is +removed, +and that circuit is the whole `O`-arc, since one `O`-arc does not contain another +(`eq_of_oArc_subset`). +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- There is no injective continuous map from the circle to the line. -/ +theorem not_injective_circle_real {g : Circle → ℝ} (hg : Continuous g) : ¬ Function.Injective g + := by + intro hi + have hK : IsCompact (range g) := isCompact_range hg + obtain ⟨z₁, hz₁⟩ : ∃ z, IsMinOn g univ z := by + obtain ⟨z, -, h⟩ := isCompact_univ.exists_isMinOn univ_nonempty hg.continuousOn + exact ⟨z, h⟩ + obtain ⟨z₂, hz₂⟩ : ∃ z, IsMaxOn g univ z := by + obtain ⟨z, -, h⟩ := isCompact_univ.exists_isMaxOn univ_nonempty hg.continuousOn + exact ⟨z, h⟩ + have hU : IsOArc (univ : Set Circle) := ⟨(Homeomorph.Set.univ Circle).symm⟩ + have hinf : (univ : Set Circle).Infinite := infinite_of_isOArc hU + obtain ⟨z, -, hzne⟩ : ∃ z ∈ (univ : Set Circle), z ∉ ({z₁, z₂} : Set Circle) := + (hinf.sdiff (toFinite _)).nonempty.imp fun z h => ⟨h.1, h.2⟩ + have hne₁ : z ≠ z₁ := fun h => hzne (Or.inl h) + have hne₂ : z ≠ z₂ := fun h => hzne (Or.inr h) + have hc : IsPreconnected ({z}ᶜ : Set Circle) := by + have := (isPathConnected_oArc_diff hU (mem_univ z)).isConnected.isPreconnected + rwa [← compl_eq_univ_sdiff] at this + have hsub := hc.image g hg.continuousOn + have hle₁ : g z₁ < g z := lt_of_le_of_ne (hz₁ (mem_univ z)) (fun h => hne₁ (hi h).symm) + have hle₂ : g z < g z₂ := lt_of_le_of_ne (hz₂ (mem_univ z)) (fun h => hne₂ (hi h)) + have hord : (g '' {z}ᶜ).OrdConnected := hsub.ordConnected + obtain ⟨w, hw, hwz⟩ := hord.out ⟨z₁, Ne.symm hne₁, rfl⟩ ⟨z₂, Ne.symm hne₂, rfl⟩ ⟨hle₁.le, hle₂.le⟩ + exact hw (hi hwz) + +/-- One `O`-arc does not contain another, except itself. -/ +theorem eq_of_oArc_subset [T2Space S] {F₁ F : Set S} (h₁ : IsOArc F₁) (h : IsOArc F) + (hsub : F₁ ⊆ F) : + F₁ = F := by + by_contra hne + obtain ⟨a, haF, ha₁⟩ : ∃ a ∈ F, a ∉ F₁ := by + by_contra hall + push Not at hall + exact hne (subset_antisymm hsub hall) + obtain ⟨p, hp, h0, h2, hper, himg, hr⟩ := exists_oArc_par h haF + have hpos : (0 : ℝ) < 2 * Real.pi := Real.two_pi_pos + obtain ⟨φ⟩ := id h₁ + have hc₁ : IsCompact F₁ := isCompact_of_isOArc h₁ + let T : Set ℝ := Icc 0 (2 * Real.pi) ∩ p ⁻¹' F₁ + have hTc : IsCompact T := isCompact_Icc.inter_right (hc₁.isClosed.preimage hp) + have hcT : CompactSpace T := isCompact_iff_compactSpace.mp hTc + let j : T → F₁ := fun t => ⟨p t.1, t.2.2⟩ + have hjc : Continuous j := Continuous.subtype_mk (hp.comp continuous_subtype_val) _ + have hjb : Function.Bijective j := by + constructor + · rintro ⟨s, hs₁, hs₂⟩ ⟨t, ht₁, ht₂⟩ hst + have heq : p s = p t := congrArg Subtype.val hst + have hs0 : s ≠ 0 := fun h' => ha₁ (by rw [← h0, ← h']; exact hs₂) + have ht0 : t ≠ 0 := fun h' => ha₁ (by rw [← h0, ← h']; exact ht₂) + have hs2 : s ≠ 2 * Real.pi := fun h' => ha₁ (by rw [← h2, ← h']; exact hs₂) + have ht2 : t ≠ 2 * Real.pi := fun h' => ha₁ (by rw [← h2, ← h']; exact ht₂) + have hs' : 0 < s := lt_of_le_of_ne hs₁.1 (Ne.symm hs0) + have ht' : 0 < t := lt_of_le_of_ne ht₁.1 (Ne.symm ht0) + have hs'' : s < 2 * Real.pi := lt_of_le_of_ne hs₁.2 hs2 + have ht'' : t < 2 * Real.pi := lt_of_le_of_ne ht₁.2 ht2 + obtain ⟨m, hm⟩ := hper s t heq + have hm0 : m = 0 := by + by_contra hm0 + have h₃ : (1 : ℝ) ≤ |(m : ℝ)| := by exact_mod_cast Int.one_le_abs hm0 + have h₄ : |s - t| = |(m : ℝ)| * (2 * Real.pi) := by + rw [hm, add_sub_cancel_left, abs_mul, abs_of_pos hpos] + have h₅ : |s - t| < 2 * Real.pi := abs_lt.mpr ⟨by linarith, by linarith⟩ + nlinarith + exact Subtype.ext (by simpa [hm0] using hm) + · rintro ⟨y, hy⟩ + have hyF := hsub hy + rw [← himg] at hyF + obtain ⟨t, ht, rfl⟩ := hyF + exact ⟨⟨t, ⟨ht.1, ht.2.le⟩, hy⟩, rfl⟩ + have hT2 : T2Space F₁ := inferInstance + let J := hjc.homeoOfEquivCompactToT2 (f := Equiv.ofBijective j hjb) + let g : Circle → ℝ := fun z => (J.symm (φ z)).1 + have hgc : Continuous g := continuous_subtype_val.comp (J.symm.continuous.comp φ.continuous) + refine not_injective_circle_real hgc fun x y hxy => φ.injective (J.symm.injective ?_) + exact Subtype.ext hxy + +/-- An edge of a drawing that meets an `O`-arc in the drawing lies in the `O`-arc. -/ +theorem edge_subset_of_oArc [T2Space S] [ConnectedSpace S] {N : Drawing S} {F e : Set S} + (hF : IsOArc F) + (hFU : F ⊆ N.U) (he : e ∈ N.E) (hne : (e ∩ F).Nonempty) : e ⊆ F := by + obtain ⟨γ, hγ⟩ := exists_edgePar N + have hc := hγ.cont e he + have hFc : IsClosed F := (isCompact_of_isOArc hF).isClosed + -- We work in the parameter interval of the edge. + have hsplit : ∀ t ∈ Ioo (0 : I) 1, γ e t ∈ F → ∃ O : Set I, IsOpen O ∧ t ∈ O ∧ O ⊆ γ e ⁻¹' F := by + intro t ht htF + obtain ⟨p, hp, h0, -, hper, -, hr⟩ := exists_oArc_par hF htF + have hpos : (0 : ℝ) < 2 * Real.pi := Real.two_pi_pos + have hO : IsOpen (p ⁻¹' (N.U \ e)ᶜ) := (isClosed_U_sdiff_edge N he).isOpen_compl.preimage hp + have h0O : (0 : ℝ) ∈ p ⁻¹' (N.U \ e)ᶜ := by + change p 0 ∈ (N.U \ e)ᶜ + rw [h0] + exact fun h => h.2 ((hγ.image e he).subset ⟨t, ht, rfl⟩) + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp hO 0 h0O + let ε : ℝ := min (δ / 2) 1 + have hε : 0 < ε := by positivity + have hεδ : ε < δ := lt_of_le_of_lt (min_le_left _ _) (by linarith) + have hε1 : ε ≤ 1 := min_le_right _ _ + have hpe : ∀ θ ∈ Icc (-ε) ε, p θ ∈ e := by + intro θ hθ + have hmem : θ ∈ Metric.ball (0 : ℝ) δ := by + rw [Metric.mem_ball, Real.dist_eq, sub_zero] + exact (abs_le.mpr hθ).trans_lt hεδ + by_contra hn + exact hball hmem ⟨hFU (hr (mem_range_self θ)), hn⟩ + let K : Set S := p '' Icc (-ε) ε + have hKc : IsCompact K := isCompact_Icc.image hp + let T' : Set I := γ e ⁻¹' K + have hT'c : IsCompact T' := (hKc.isClosed.preimage hc).isCompact + have hT'I : T' ⊆ Ioo 0 1 := by + intro s hs + obtain ⟨θ, hθ, hθs⟩ := hs + have hsV : γ e s ∉ N.V := by + rw [← hθs] + exact (he.2.1 (hpe θ hθ)).2 + refine ⟨unitInterval.pos_iff_ne_zero.mpr ?_, unitInterval.lt_one_iff_ne_one.mpr ?_⟩ + · rintro rfl + exact hsV (hγ.zero e he) + · rintro rfl + exact hsV (hγ.one e he) + have hcT : CompactSpace T' := isCompact_iff_compactSpace.mp hT'c + let j : T' → K := fun s => ⟨γ e s.1, s.2⟩ + have hjc : Continuous j := Continuous.subtype_mk (hc.comp continuous_subtype_val) _ + have hjb : Function.Bijective j := by + constructor + · rintro ⟨s₁, h₁⟩ ⟨s₂, h₂⟩ hs + exact Subtype.ext (hγ.inj e he (hT'I h₁) (hT'I h₂) (congrArg Subtype.val hs)) + · rintro ⟨y, θ, hθ, rfl⟩ + obtain ⟨s, -, hs⟩ := (hγ.image e he).superset (hpe θ hθ) + exact ⟨⟨s, θ, hθ, hs.symm⟩, Subtype.ext hs⟩ + let J := hjc.homeoOfEquivCompactToT2 (f := Equiv.ofBijective j hjb) + have hJ : ∀ y, γ e (J.symm y).1 = y.1 := fun y => by + have := congrArg Subtype.val (J.apply_symm_apply y) + exact this + have hmemK : ∀ θ : Icc (-ε) ε, p θ.1 ∈ K := fun θ => ⟨θ.1, θ.2, rfl⟩ + let f : ℝ → ℝ := fun θ => + ((J.symm ⟨p (projIcc (-ε) ε (by linarith) θ).1, hmemK _⟩).1.1 : ℝ) + have hfc : Continuous f := by + refine continuous_subtype_val.comp (continuous_subtype_val.comp (J.symm.continuous.comp ?_)) + exact Continuous.subtype_mk (hp.comp (continuous_subtype_val.comp continuous_projIcc)) _ + have hfγ : ∀ θ ∈ Icc (-ε) ε, ∃ s : I, s.1 = f θ ∧ γ e s = p θ := by + intro θ hθ + refine ⟨(J.symm ⟨p (projIcc (-ε) ε (by linarith) θ).1, hmemK _⟩).1, rfl, ?_⟩ + rw [hJ] + simp [projIcc_of_mem _ hθ] + have hfi : InjOn f (Icc (-ε) ε) := by + intro a ha b hb hab + obtain ⟨s₁, h₁, h₂⟩ := hfγ a ha + obtain ⟨s₂, h₃, h₄⟩ := hfγ b hb + have hss : s₁ = s₂ := Subtype.ext (by rw [h₁, h₃, hab]) + have hpp : p a = p b := by rw [← h₂, ← h₄, hss] + obtain ⟨m, hm⟩ := hper a b hpp + have hm0 : m = 0 := by + by_contra hm0 + have h₃ : (1 : ℝ) ≤ |(m : ℝ)| := by exact_mod_cast Int.one_le_abs hm0 + have h₄ : |a - b| = |(m : ℝ)| * (2 * Real.pi) := by + rw [hm, add_sub_cancel_left, abs_mul, abs_of_pos hpos] + have h₅ : |a - b| ≤ 2 := by + rw [abs_le] + constructor <;> linarith [ha.1, ha.2, hb.1, hb.2] + have hpi := Real.two_le_pi + nlinarith + simpa [hm0] using hm + obtain ⟨s₀, hs₀, hs₀γ⟩ := hfγ 0 ⟨by linarith, hε.le⟩ + have hs₀t : s₀ = t := hγ.inj e he (hT'I (show s₀ ∈ T' from ⟨0, ⟨by linarith, hε.le⟩, + hs₀γ.symm⟩)) + ht (by rw [hs₀γ, h0]) + have hmono := hfc.continuousOn.strictMonoOn_of_injOn_Icc' (a := -ε) (b := ε) (by linarith) hfi + let m₁ : ℝ := min (f (-ε)) (f ε) + let m₂ : ℝ := max (f (-ε)) (f ε) + have hbet : m₁ < f 0 ∧ f 0 < m₂ := by + have ha : -ε ∈ Icc (-ε) ε := ⟨le_rfl, by linarith⟩ + have hb : ε ∈ Icc (-ε) ε := ⟨by linarith, le_rfl⟩ + have h0' : (0 : ℝ) ∈ Icc (-ε) ε := ⟨by linarith, hε.le⟩ + rcases hmono with h | h + · have h₁ := h ha h0' (by linarith) + have h₂ := h h0' hb hε + exact ⟨(min_le_left _ _).trans_lt h₁, h₂.trans_le (le_max_right _ _)⟩ + · have h₁ := h ha h0' (by linarith) + have h₂ := h h0' hb hε + exact ⟨(min_le_right _ _).trans_lt h₂, h₁.trans_le (le_max_left _ _)⟩ + refine ⟨Subtype.val ⁻¹' Ioo m₁ m₂, isOpen_Ioo.preimage continuous_subtype_val, ?_, ?_⟩ + · change t.1 ∈ Ioo m₁ m₂ + rw [← hs₀t, hs₀] + exact hbet + · intro s hs + have hIVT : Ioo m₁ m₂ ⊆ f '' Icc (-ε) ε := by + have hle : -ε ≤ ε := by linarith + have h₁ := intermediate_value_uIcc (a := -ε) (b := ε) (f := f) + (by rw [uIcc_of_le hle]; exact hfc.continuousOn) + rw [uIcc_of_le hle] at h₁ + intro y hy + exact h₁ (by + rw [mem_uIcc] + rcases le_total (f (-ε)) (f ε) with hc' | hc' + · left + simp only [m₁, m₂, min_eq_left hc', max_eq_right hc'] at hy + exact ⟨hy.1.le, hy.2.le⟩ + · right + simp only [m₁, m₂, min_eq_right hc', max_eq_left hc'] at hy + exact ⟨hy.1.le, hy.2.le⟩) + obtain ⟨θ, hθ, hθs⟩ := hIVT hs + obtain ⟨s', hs', hγs⟩ := hfγ θ hθ + have hss : s' = s := Subtype.ext (hs'.trans hθs) + change γ e s ∈ F + rw [← hss, hγs] + exact hr (mem_range_self θ) + choose! O hOo hOm hOs using hsplit + let u : Set I := ⋃ t ∈ Ioo (0 : I) 1 ∩ γ e ⁻¹' F, O t + have hu : IsOpen u := isOpen_biUnion fun t ht => hOo t ht.1 ht.2 + obtain ⟨y, hye, hyF⟩ := hne + obtain ⟨t₀, ht₀, rfl⟩ := (hγ.image e he).superset hye + have hus : u ⊆ γ e ⁻¹' F := iUnion₂_subset fun t ht => hOs t ht.1 ht.2 + have hconn : IsPreconnected (Ioo (0 : I) 1) := isPreconnected_Ioo + have hsub : Ioo (0 : I) 1 ⊆ u := hconn.subset_of_closure_inter_subset hu + ⟨t₀, ht₀, mem_biUnion ⟨ht₀, hyF⟩ (hOm t₀ ht₀ hyF)⟩ (by + rintro s ⟨hs₁, hs₂⟩ + have : s ∈ γ e ⁻¹' F := closure_minimal hus (hFc.preimage hc) hs₁ + exact mem_biUnion ⟨hs₂, this⟩ (hOm s hs₂ this)) + intro x hx + obtain ⟨s, hs, rfl⟩ := (hγ.image e he).superset hx + exact hus (hsub hs) + +/-- **An `O`-arc inside a drawing is the point set of a circuit.** -/ +theorem exists_circuit_of_oArc [T2Space S] [ConnectedSpace S] {N : Drawing S} {F : Set S} + (hF : IsOArc F) + (hFU : F ⊆ N.U) : ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing N ∧ C.U = F := by + classical + obtain ⟨γ, hγ⟩ := exists_edgePar N + have hFc : IsClosed F := (isCompact_of_isOArc hF).isClosed + let H := N.interSet F + have hHN : H.IsSubdrawing N := Drawing.span_isSubdrawing N _ _ + have hHE : ∀ f, f ∈ H.E ↔ f ∈ N.E ∧ f ⊆ F := by + intro f + change f ∈ (N.span _ _).E ↔ _ + rw [N.span_E] + exact ⟨fun h => h.1, fun h => ⟨h, h.1⟩⟩ + have hHU : H.U ⊆ F := by + rw [H.U_eq] + rintro x (hx | hx) + · rcases hx with ⟨⟨-, hx⟩, -⟩ | hx + · exact hx + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + exact closure_minimal hf.1.2 hFc hxf.1 + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + exact closure_minimal ((hHE f).mp hf).2 hFc hxf + obtain ⟨y₀, hy₀F, hy₀V⟩ : ∃ y ∈ F, y ∉ N.V := + ((infinite_of_isOArc hF).sdiff N.finite_V).nonempty.imp fun _ h => ⟨h.1, h.2⟩ + obtain ⟨e, heN, hy₀e⟩ := N.exists_edge_of_mem (hFU hy₀F) hy₀V + have heF : e ⊆ F := edge_subset_of_oArc hF hFU heN ⟨y₀, hy₀e, hy₀F⟩ + have heH : e ∈ H.E := (hHE e).mpr ⟨heN, heF⟩ + let D := H.deleteEdge e + have hDH : D.IsSubdrawing H := deleteEdge_isSubdrawing H e + have hDN : D.IsSubdrawing N := hDH.trans hHN + have hDE : D.E = H.E \ {e} := deleteEdge_E H e + have hDV : D.V = H.V := deleteEdge_V H e + have hDU : D.U = H.U \ e := deleteEdge_U H heH + set a := γ e (endOf false) with ha + set b := γ e (endOf true) with hb + have haV : a ∈ H.V := by + have := (isLink_ends hγ hHN heH false).2.1 + exact this + have hbV : b ∈ H.V := (isLink_ends hγ hHN heH false).2.2.1 + have hreach : Nonempty (GraphWalk D.toGraph a b) := by + by_contra hno + let A : Set S := {x | Nonempty (GraphWalk D.toGraph a x)} + have haA : a ∈ A := ⟨.nil (show a ∈ D.V from hDV ▸ haV)⟩ + have hbA : b ∉ A := hno + have hAV : A ⊆ D.V := by + rintro x ⟨W⟩ + exact mem_V_of_mem_support W W.end_mem_support + have hstep : ∀ f ∈ D.E, ∀ c, γ f (endOf c) ∈ A → γ f (endOf (!c)) ∈ A := by + rintro f hf c ⟨W⟩ + exact ⟨W.append (.cons (isLink_ends hγ hDN hf c) + (.nil (isLink_ends hγ hDN hf c).2.2.1))⟩ + let side : Set S → Prop := fun f => γ f (endOf false) ∈ A + have hside : ∀ f ∈ D.E, ∀ x ∈ closure f, x ∈ N.V → (side f ↔ x ∈ A) := by + intro f hf x hxf hxV + obtain ⟨c, rfl⟩ := exists_end_eq hγ (hDN.2 hf) hxV hxf + cases c with + | false => exact Iff.rfl + | true => exact ⟨hstep f hf false, hstep f hf true⟩ + let G₁ : Set S := A ∪ ⋃ f ∈ {f | f ∈ D.E ∧ side f}, closure f + let G₂ : Set S := (D.V \ A) ∪ ⋃ f ∈ {f | f ∈ D.E ∧ ¬ side f}, closure f + have hfinE : ∀ P : Set S → Prop, {f | f ∈ D.E ∧ P f}.Finite := fun P => + D.finite_edges.subset fun _ h => h.1 + have hG₁c : IsClosed G₁ := ((D.finite_V.subset hAV).isClosed).union + ((hfinE _).isClosed_biUnion fun _ _ => isClosed_closure) + have hG₂c : IsClosed G₂ := ((D.finite_V.subset sdiff_subset).isClosed).union + ((hfinE _).isClosed_biUnion fun _ _ => isClosed_closure) + have hcl : ∀ f ∈ D.E, closure f ⊆ D.U := fun f hf => D.closure_subset_U hf + have hG₁U : G₁ ⊆ D.U := by + rintro x (hx | hx) + · exact D.V_subset_U (hAV hx) + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + exact hcl f hf.1 hxf + have hG₂U : G₂ ⊆ D.U := by + rintro x (hx | hx) + · exact D.V_subset_U hx.1 + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + exact hcl f hf.1 hxf + have hmeet : Disjoint G₁ G₂ := by + refine disjoint_left.mpr ?_ + rintro x (hx₁ | hx₁) (hx₂ | hx₂) + · exact hx₂.2 hx₁ + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx₂ + exact hf.2 ((hside f hf.1 x hxf (hDN.1 (hAV hx₁))).mpr hx₁) + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx₁ + exact hx₂.2 ((hside f hf.1 x hxf (hDN.1 hx₂.1)).mp hf.2) + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx₁ + obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp hx₂ + have hfg : f ≠ g := fun h => hg.2 (h ▸ hf.2) + have hxV : x ∈ N.V := closure_inter_subset_V (hDN.2 hf.1) (hDN.2 hg.1) hfg ⟨hxf, hxg⟩ + exact hg.2 ((hside g hg.1 x hxg hxV).mpr ((hside f hf.1 x hxf hxV).mp hf.2)) + -- Cut `e` at an inner point `y₀`. + obtain ⟨s₀, hs₀, rfl⟩ := (hγ.image e heN).superset hy₀e + let P₁ : Set S := γ e '' Icc 0 s₀ + let P₂ : Set S := γ e '' Icc s₀ 1 + have hc := hγ.cont e heN + have hP₁c : IsClosed P₁ := (isCompact_Icc.image hc).isClosed + have hP₂c : IsClosed P₂ := (isCompact_Icc.image hc).isClosed + have hPmem : ∀ {t : I}, t ∈ Ioo (0 : I) 1 → γ e t ∈ e := fun ht => + (hγ.image e heN).subset ⟨_, ht, rfl⟩ + have hsplit : ∀ t : I, t = 0 ∨ t = 1 ∨ t ∈ Ioo (0 : I) 1 := fun t => by + by_cases h0 : t = 0 + · exact Or.inl h0 + by_cases h1 : t = 1 + · exact Or.inr (Or.inl h1) + exact Or.inr (Or.inr ⟨unitInterval.pos_iff_ne_zero.mpr h0, unitInterval.lt_one_iff_ne_one.mpr + h1⟩) + have ha0 : γ e 0 = a := by simp [ha, endOf] + have hb1 : γ e 1 = b := by simp [hb, endOf] + have haF : a ∈ F := hHU (H.V_subset_U haV) + have hbF : b ∈ F := hHU (H.V_subset_U hbV) + have hnoe : ∀ x ∈ G₁ ∪ G₂, x ∉ e := fun x hx hxe => + (hDU ▸ (hx.elim (fun h => hG₁U h) fun h => hG₂U h) : x ∈ H.U \ e).2 hxe + have hcover : F \ {γ e s₀} ⊆ (P₁ ∪ G₁) ∪ (P₂ ∪ G₂) := by + intro x hx + by_cases hxe : x ∈ e + · obtain ⟨t, ht, rfl⟩ := (hγ.image e heN).superset hxe + rcases le_total t s₀ with h | h + · exact Or.inl (Or.inl ⟨t, ⟨unitInterval.nonneg _, h⟩, rfl⟩) + · exact Or.inr (Or.inl ⟨t, ⟨h, unitInterval.le_one _⟩, rfl⟩) + · by_cases hxV : x ∈ N.V + · have hxD : x ∈ D.V := hDV ▸ (Or.inl ⟨⟨hxV, hx.1⟩, hxV⟩ : x ∈ H.V) + by_cases hxA : x ∈ A + · exact Or.inl (Or.inr (Or.inl hxA)) + · exact Or.inr (Or.inr (Or.inl ⟨hxD, hxA⟩)) + · obtain ⟨g, hgN, hxg⟩ := N.exists_edge_of_mem (hFU hx.1) hxV + have hgH : g ∈ H.E := (hHE g).mpr ⟨hgN, edge_subset_of_oArc hF hFU hgN ⟨x, hxg, hx.1⟩⟩ + have hgD : g ∈ D.E := hDE ▸ ⟨hgH, fun h => hxe (mem_singleton_iff.mp h ▸ hxg)⟩ + by_cases hgs : side g + · exact Or.inl (Or.inr (Or.inr (mem_iUnion₂.mpr ⟨g, ⟨hgD, hgs⟩, subset_closure hxg⟩))) + · exact Or.inr (Or.inr (Or.inr (mem_iUnion₂.mpr ⟨g, ⟨hgD, hgs⟩, subset_closure hxg⟩))) + have hpc : IsPreconnected (F \ {γ e s₀}) := + (isPathConnected_oArc_diff hF hy₀F).isConnected.isPreconnected + have hes : γ e s₀ ∈ e := hPmem hs₀ + have haN : a ∈ N.V := hHN.1 haV + have hbN : b ∈ N.V := hHN.1 hbV + have hoff : ∀ {x}, x ∈ N.V → x ∉ e := fun hx hxe => (heN.2.1 hxe).2 hx + obtain ⟨x, hx, hx₁, hx₂⟩ := isPreconnected_closed_iff.mp hpc (P₁ ∪ G₁) (P₂ ∪ G₂) + (hP₁c.union hG₁c) (hP₂c.union hG₂c) hcover + ⟨a, ⟨haF, fun h => hoff haN (mem_singleton_iff.mp h ▸ hes)⟩, + Or.inl ⟨0, ⟨le_rfl, unitInterval.nonneg _⟩, ha0⟩⟩ + ⟨b, ⟨hbF, fun h => hoff hbN (mem_singleton_iff.mp h ▸ hes)⟩, + Or.inl ⟨1, ⟨unitInterval.le_one _, le_rfl⟩, hb1⟩⟩ + have hs₀1 : s₀ ≠ 1 := hs₀.2.ne + have hs₀0 : (0 : I) ≠ s₀ := hs₀.1.ne + rcases hx₁ with ⟨t, ht, rfl⟩ | hg₁ <;> rcases hx₂ with hx₂ | hg₂ + · obtain ⟨t', ht', hte⟩ := hx₂ + rcases hsplit t with rfl | rfl | hi + · rcases hsplit t' with rfl | rfl | hi' + · exact not_le.mpr hs₀.1 ht'.1 + · exact hbA (by + have h₁ : b = a := by rw [← hb1, hte, ha0] + exact h₁ ▸ haA) + · exact hoff haN (by + have := hPmem hi' + rwa [hte, ha0] at this) + · exact hs₀1 (le_antisymm (unitInterval.le_one _) ht.2) + · rcases hsplit t' with rfl | rfl | hi' + · exact not_le.mpr hs₀.1 ht'.1 + · exact hoff hbN (by + have := hPmem hi + rwa [← hte, hb1] at this) + · have htt : t' = t := hγ.inj e heN hi' hi hte + subst htt + have hts : t' = s₀ := le_antisymm ht.2 ht'.1 + exact hx.2 (by rw [hts]; rfl) + · have hne : γ e t ∉ e := hnoe _ (Or.inr hg₂) + rcases hsplit t with rfl | rfl | hi + · rw [ha0] at hg₂ + rcases hg₂ with h | h + · exact h.2 haA + · obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h + exact hg.2 ((hside g hg.1 a hxg haN).mpr haA) + · exact hs₀1 (le_antisymm (unitInterval.le_one _) ht.2) + · exact hne (hPmem hi) + · obtain ⟨t', ht', hte⟩ := hx₂ + have hne : x ∉ e := hnoe _ (Or.inl hg₁) + subst hte + rcases hsplit t' with rfl | rfl | hi + · exact not_le.mpr hs₀.1 ht'.1 + · rw [hb1] at hg₁ + rcases hg₁ with h | h + · exact hbA h + · obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h + exact hbA ((hside g hg.1 b hxg hbN).mp hg.2) + · exact hne (hPmem hi) + · exact disjoint_left.mp hmeet hg₁ hg₂ + obtain ⟨C, hC, hCs, -⟩ := exists_circuit_of_reach hγ hHN heH hreach + exact ⟨C, hC, hCs.trans hHN, eq_of_oArc_subset (IsCircuit.isOArc_U hC) hF + (hCs.U_subset.trans hHU)⟩ + +/-- Restricting a drawing to a closed `O`-arc in its point set gives the corresponding circuit. -/ +theorem interSet_isCircuit_and_U_of_isOArc [T2Space S] [ConnectedSpace S] + {H : Drawing S} {F : Set S} (hF : IsOArc F) (hclosed : IsClosed F) (hsub : F ⊆ H.U) : + (H.interSet F).IsCircuit ∧ (H.interSet F).U = F := by + obtain ⟨C_bd, hC_bd, hCH_bd, hCU_bd⟩ := exists_circuit_of_oArc hF hsub + have hEq_C : H.interSet F = C_bd := by + refine Drawing.ext_of_V_E ?_ ?_ + · rw [H.interSet_V_of_isClosed hclosed] + ext x + simp only [mem_inter_iff] + refine ⟨fun ⟨hxV, hxbd⟩ => ?_, fun hxC => ⟨hCH_bd.1 hxC, hCU_bd ▸ C_bd.V_subset_U hxC⟩⟩ + by_contra hxnot + obtain ⟨e, heC, hxe⟩ := C_bd.exists_edge_of_mem (hCU_bd.symm ▸ hxbd) hxnot + exact ((hCH_bd.2 heC).2.1 hxe).2 hxV + · rw [Drawing.interSet_E] + ext e + simp only [mem_ofPred_eq] + refine ⟨fun ⟨heH, hebd⟩ => ?_, + fun heC => ⟨hCH_bd.2 heC, hCU_bd ▸ subset_closure.trans (C_bd.closure_subset_U heC)⟩⟩ + obtain ⟨x, hxe⟩ := heH.1 + have hxnotV : x ∉ C_bd.V := fun hxC => (heH.2.1 hxe).2 (hCH_bd.1 hxC) + obtain ⟨f, hfC, hxf⟩ := C_bd.exists_edge_of_mem (hCU_bd.symm ▸ hebd hxe) hxnotV + have hfH := hCH_bd.2 hfC + have hconn := heH.2.2.1.union hfH.2.2.1 ⟨x, hxe, hxf⟩ + have hsub := union_subset heH.2.1 hfH.2.1 + have hef : e = f := (heH.2.2.2 _ hsub hconn subset_union_left).symm.trans + (hfH.2.2.2 _ hsub hconn subset_union_right) + exact hef ▸ hfC + exact ⟨hEq_C ▸ hC_bd, hEq_C ▸ hCU_bd⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/OpenAround.lean b/LeanPool/GraphMinor/GM11/OpenAround.lean new file mode 100644 index 0000000000..94b66b74dc --- /dev/null +++ b/LeanPool/GraphMinor/GM11/OpenAround.lean @@ -0,0 +1,464 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Epstein +public import LeanPool.GraphMinor.GM11.PathClasses +public import LeanPool.GraphMinor.GM11.Solid +public import LeanPool.GraphMinor.GM11.EdgeSides +public import LeanPool.GraphMinor.GM11.RadialAccess +public import LeanPool.GraphMinor.GM11.PaintingCells +public import LeanPool.GraphMinor.Surface.OpenDisc +public import LeanPool.GraphMinor.Surface.SphereDisc +import LeanPool.GraphMinor.Surface.Disc +import Mathlib.Analysis.Convex.Contractible + +/-! +# Flat sets in an open disc + +This file proves the part of Graph Minors VII, (11.5)--(11.10), that Graph Minors XI uses: a closed +flat +set that is arc-wise connected and locally arc-wise connected lies in an open set which is a disc, +or else +the surface is a sphere. We follow the paper: + +- `flat_iUnion` is (11.5): the set has an open flat neighbourhood. +- `flat_union_disc` is the case of (11.3) that the proof of (11.8) uses, where the disc has all of + its boundary in + the open set. Here the paper's limit of curves is not needed. +- `exists_maximal_flat` is the first step of the proof of (11.8), by Zorn's lemma. +- `exists_open_around` is (11.9), and with `open_disc` it gives the conclusion. + +"Flat" here is relative to an open set `W`, in place of the whole surface, so that the proof also +gives +(7.5) of Graph Minors XI. So the homotopies live in the subtype `W`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +section Abstract + +variable {T : Type u} [TopologicalSpace T] + +/-- **(11.5)** of Graph Minors VII (page 251). Let `N z` be path-connected neighbourhoods of the +points `z` of +a flat set `X`. If `N z`, `N z'` meet, then they lie in one flat set, in which `X` is +path-connected. Then +the union of the sets `N z` is flat. -/ +theorem flat_iUnion {X : Set T} (hX : Flat X) (N : T → Set T) (hNo : ∀ z ∈ X, IsOpen (N z)) + (hNm : ∀ z ∈ X, z ∈ N z) (hNc : ∀ z ∈ X, IsPathConnected (N z)) + (hpair : ∀ z ∈ X, ∀ z' ∈ X, (N z ∩ N z').Nonempty → ∃ D : Set T, Flat D ∧ N z ∪ N z' ⊆ D ∧ + ∀ a ∈ X ∩ D, ∀ b ∈ X ∩ D, JoinedIn (X ∩ D) a b) : + Flat (⋃ z ∈ X, N z) := by + -- A path between two points of `N z`, in `N z`. + have harw : ∀ z ∈ X, ∀ a ∈ N z, ∀ b ∈ N z, ∃ f : Cl a b, Arw (N z) f := fun z hz a ha b hb => by + have hj := (hNc z hz).joinedIn a ha b hb + exact ⟨Cl.mk hj.somePath, hj.somePath, fun u => hj.somePath_mem u, rfl⟩ + have hjoin : ∀ z ∈ X, ∀ z' ∈ X, (N z ∩ N z').Nonempty → ∃ (D : Set T) (w : Cl z z'), Flat D ∧ + N z ∪ N z' ⊆ D ∧ Arw (X ∩ D) w := fun z hz z' hz' hne => by + obtain ⟨D, hD, hsub, hj⟩ := hpair z hz z' hz' hne + have hj' := hj z ⟨hz, hsub (Or.inl (hNm z hz))⟩ z' ⟨hz', hsub (Or.inr (hNm z' hz'))⟩ + exact ⟨D, Cl.mk hj'.somePath, hD, hsub, hj'.somePath, fun u => hj'.somePath_mem u, rfl⟩ + -- The main claim: a path in the union, seen from its first point, is homotopic to a path in `X`. + have key : ∀ (a b : T) (p : Path a b), (∀ u, p u ∈ ⋃ z ∈ X, N z) → ∀ (z₀ : T) + (α : Cl z₀ a), z₀ ∈ X → + a ∈ N z₀ → Arw (N z₀) α → ∃ z ∈ X, b ∈ N z ∧ ∃ (β : Cl b z) (θ : Cl z₀ z), Arw (N z) β + ∧ Arw X θ ∧ + α.trans ((Cl.mk p).trans β) = θ := by + intro a b p hp z₀ α hz₀ ha hα + let Q : ∀ c : T, Cl a c → Prop := fun c f => ∃ z ∈ X, c ∈ N z ∧ ∃ (β : Cl c z) (θ : Cl z₀ z), + Arw (N z) β ∧ Arw X θ ∧ α.trans (f.trans β) = θ + refine cl_induction (𝒞 := {O | ∃ z ∈ X, O = N z}) ?_ p (fun u => ?_) Q ?_ ?_ + · rintro _ ⟨z, hz, rfl⟩ + exact hNo z hz + · have := hp u + simp only [mem_iUnion, exists_prop] at this + obtain ⟨z, hz, hu⟩ := this + exact ⟨N z, ⟨z, hz, rfl⟩, hu⟩ + · refine ⟨z₀, hz₀, ha, α.symm, Cl.rf z₀, hα.symm, arw_refl hz₀, ?_⟩ + rw [cl_refl_trans, cl_trans_symm] + · rintro c d f r _ ⟨z', hz', rfl⟩ hr ⟨z, hz, hc, β, θ, hβ, hθ, e⟩ + have hc' : c ∈ N z' := by simpa using hr 0 + have hd' : d ∈ N z' := by simpa using hr 1 + obtain ⟨D, w, hD, hsub, hw⟩ := hjoin z hz z' hz' ⟨c, hc, hc'⟩ + obtain ⟨β', hβ'⟩ := harw z' hz' d hd' z' (hNm z' hz') + refine ⟨z', hz', hd', β', θ.trans w, hβ', hθ.trans (hw.mono inter_subset_left), ?_⟩ + have h₁ : (Cl.mk r).trans β' = β.trans w := hD.eq + ((Arw.of_path r hr).trans hβ' |>.mono subset_union_right |>.mono hsub) + ((hβ.mono subset_union_left |>.mono hsub).trans (hw.mono inter_subset_right)) + have e₂ : α.trans ((f.trans (Cl.mk r)).trans β') = (α.trans (f.trans β)).trans w := by + simp only [cl_assoc, h₁] + rw [e₂, e] + intro a b p q hp hq + have ha : a ∈ ⋃ z ∈ X, N z := by simpa using hp 0 + simp only [mem_iUnion, exists_prop] at ha + obtain ⟨z₀, hz₀, ha⟩ := ha + obtain ⟨α, hα⟩ := harw z₀ hz₀ z₀ (hNm z₀ hz₀) a ha + obtain ⟨z, hz, hb, β, θ, hβ, hθ, e⟩ := key a b p hp z₀ α hz₀ ha hα + obtain ⟨z', hz', hb', β', θ', hβ', hθ', e'⟩ := key a b q hq z₀ α hz₀ ha hα + obtain ⟨D, w, hD, hsub, hw⟩ := hjoin z hz z' hz' ⟨b, hb, hb'⟩ + have h₁ : β' = β.trans w := hD.eq (hβ'.mono (subset_union_right.trans hsub)) + ((hβ.mono (subset_union_left.trans hsub)).trans (hw.mono inter_subset_right)) + have h₂ : θ' = θ.trans w := hX.eq hθ' (hθ.trans (hw.mono inter_subset_left)) + refine Path.Homotopic.Quotient.eq.mp (cl_cancel α (β.trans w) ?_) + have e₃ : ∀ k : Cl a b, α.trans (k.trans (β.trans w)) = (α.trans (k.trans β)).trans w := fun k + => by + simp only [cl_assoc] + rw [e₃, e, ← h₂, ← e', h₁] + +/-- A path from a point of `D` to a set `F`, where `D` is closed and `D \ F` is open, stays in `D` +until it first +reaches `F`. -/ +theorem exists_arw_to {Y D F : Set T} (hDc : IsClosed D) (hDo : IsOpen (D \ F)) (hFc : IsClosed F) + (hFD : F ⊆ D) {a f : T} (haD : a ∈ D) (hf : f ∈ F) (p : Path a f) (hp : ∀ u, p u ∈ Y) : + ∃ x ∈ F, ∃ g : Cl a x, Arw (Y ∩ D) g := by + by_cases haF : a ∈ F + · exact ⟨a, haF, Cl.rf a, arw_refl ⟨by simpa using hp 0, haD⟩⟩ + have hcp : IsCompact (p ⁻¹' F) := (hFc.preimage p.continuous).isCompact + obtain ⟨t, ht, hle⟩ := hcp.exists_isLeast ⟨1, by simpa using hf⟩ + have hpre : IsPreconnected (Ico (0 : I) t) := ordConnected_Ico.isPreconnected + have hin : Ico (0 : I) t ⊆ p ⁻¹' (D \ F) := by + have hsub : Ico (0 : I) t ⊆ p ⁻¹' (D \ F) ∪ p ⁻¹' Dᶜ := by + intro u hu + by_cases huD : p u ∈ D + · exact Or.inl ⟨huD, fun h => absurd (hle h) (not_le.mpr hu.2)⟩ + · exact Or.inr huD + have h0 : (0 : I) ∈ Ico (0 : I) t := ⟨le_rfl, lt_of_le_of_ne (unitInterval.nonneg t) fun e => by + apply haF + have : p t ∈ F := ht + rwa [← e, p.source] at this⟩ + refine hpre.subset_left_of_subset_union (hDo.preimage p.continuous) + (hDc.isOpen_compl.preimage p.continuous) ?_ hsub ⟨0, h0, ?_⟩ + · exact disjoint_left.mpr fun x hx hx' => hx' hx.1 + · simpa using (⟨haD, haF⟩ : a ∈ D \ F) + refine ⟨p t, ht, Cl.mk (p.subpath 0 t |>.cast p.source.symm rfl), _, fun u => ?_, rfl⟩ + have : (p.subpath 0 t) u ∈ p '' uIcc 0 t := by + rw [← Path.range_subpath] + exact mem_range_self u + obtain ⟨v, hv, hv'⟩ := this + rw [uIcc_of_le (show (0 : I) ≤ t from unitInterval.nonneg t)] at hv + simp only [Path.cast_coe] + rw [← hv'] + refine ⟨hp v, ?_⟩ + rcases eq_or_lt_of_le hv.2 with e | hlt + · rw [e] + exact hFD ht + · exact (hin ⟨hv.1, hlt⟩).1 + +/-- **A case of (11.3)** of Graph Minors VII (page 249). Let `Y` be open, flat and path-connected. +Let `D` be a closed +flat path-connected set with `D \ F` open, where `F ⊆ Y ∩ D` is closed and path-connected. Then `Y ∪ +D` is flat. -/ +theorem flat_union_disc {Y D F : Set T} (hYo : IsOpen Y) (hYc : IsPathConnected Y) (hYf : Flat Y) + (hDf : Flat D) (hDc : IsClosed D) (hDp : IsPathConnected D) (hDo : IsOpen (D \ F)) + (hFc : IsClosed F) + (hFp : IsPathConnected F) (hFY : F ⊆ Y) (hFD : F ⊆ D) : Flat (Y ∪ D) := by + obtain ⟨f₀, hf₀⟩ := hFp.nonempty + -- Each point of `Y ∩ D` is joined to `F` in `Y ∩ D`. + have hto : ∀ a ∈ Y ∩ D, ∃ x ∈ F, ∃ g : Cl a x, Arw (Y ∩ D) g := fun a ha => by + have hj := hYc.joinedIn a ha.1 f₀ (hFY hf₀) + exact exists_arw_to hDc hDo hFc hFD ha.2 hf₀ hj.somePath hj.somePath_mem + -- A class of `D` with ends in `Y` has a path in `Y`. + have hflatten : ∀ (a b : T) (f : Cl a b), a ∈ Y → b ∈ Y → Arw D f → Arw Y f := by + intro a b f ha hb hf + obtain ⟨x, hx, g, hg⟩ := hto a ⟨ha, hf.left_mem⟩ + obtain ⟨y, hy, h, hh⟩ := hto b ⟨hb, hf.right_mem⟩ + have hj := hFp.joinedIn x hx y hy + have hη : Arw F (Cl.mk hj.somePath) := ⟨_, hj.somePath_mem, rfl⟩ + have e : f = g.trans ((Cl.mk hj.somePath).trans h.symm) := hDf.eq hf + ((hg.mono inter_subset_right).trans ((hη.mono hFD).trans (hh.mono inter_subset_right).symm)) + rw [e] + exact (hg.mono inter_subset_left).trans ((hη.mono hFY).trans (hh.mono inter_subset_left).symm) + -- A path of `Y ∪ D` with ends in `Y` is homotopic to a path in `Y`. + have hpush : ∀ (a b : T) (p : Path a b), a ∈ Y → b ∈ Y → (∀ u, p u ∈ Y ∪ D) → Arw Y (Cl.mk p) + := by + intro a b p ha hb hp + let Q : ∀ c : T, Cl a c → Prop := fun c f => Arw Y f ∨ + ∃ (e : T) (g : Cl a e) (r : Cl e c), e ∈ Y ∧ Arw Y g ∧ Arw D r ∧ f = g.trans r + have hQ : Q b (Cl.mk p) := by + refine cl_induction (𝒞 := {Y, D \ F}) ?_ p (fun u => ?_) Q (Or.inl (arw_refl ha)) ?_ + · rintro O (h | h) + · rw [h] + exact hYo + · rw [h] + exact hDo + · by_cases hu : p u ∈ F + · exact ⟨Y, Or.inl rfl, hFY hu⟩ + · rcases hp u with h | h + · exact ⟨Y, Or.inl rfl, h⟩ + · exact ⟨D \ F, Or.inr rfl, h, hu⟩ + · rintro c d f r O (h | h) hr hc + · rw [h] at hr + have hcY : c ∈ Y := by simpa using hr 0 + left + rcases hc with hc | ⟨e, g, t, he, hg, ht, rfl⟩ + · exact hc.trans (Arw.of_path r hr) + · exact (hg.trans (hflatten e c t he hcY ht)).trans (Arw.of_path r hr) + · rw [h] at hr + have hr' : Arw D (Cl.mk r) := (Arw.of_path r hr).mono sdiff_subset + right + rcases hc with hc | ⟨e, g, t, he, hg, ht, rfl⟩ + · exact ⟨c, f, Cl.mk r, hc.right_mem, hc, hr', rfl⟩ + · exact ⟨e, g, t.trans (Cl.mk r), he, hg, ht.trans hr', cl_assoc _ _ _⟩ + rcases hQ with h | ⟨e, g, r, he, hg, hr, h⟩ + · exact h + · rw [h] + exact hg.trans (hflatten e b r he hb hr) + -- Each point of `Y ∪ D` is joined to `Y`. + have hbase : ∀ x ∈ Y ∪ D, ∃ y ∈ Y, ∃ ρ : Cl y x, Arw (Y ∪ D) ρ := by + rintro x (hx | hx) + · exact ⟨x, hx, Cl.rf x, arw_refl (Or.inl hx)⟩ + · have hj := hDp.joinedIn f₀ (hFD hf₀) x hx + exact ⟨f₀, hFY hf₀, Cl.mk hj.somePath, _, fun u => Or.inr (hj.somePath_mem u), rfl⟩ + intro a b p q hp hq + obtain ⟨a', ha', ρ, hρ⟩ := hbase a (by simpa using hp 0) + obtain ⟨b', hb', ρ', hρ'⟩ := hbase b (by simpa using hp 1) + have hpush' : ∀ f : Cl a' b', Arw (Y ∪ D) f → Arw Y f := by + rintro _ ⟨r, hr, rfl⟩ + exact hpush _ _ r ha' hb' hr + refine Path.Homotopic.Quotient.eq.mp (cl_cancel ρ ρ'.symm (hYf.eq (hpush' _ ?_) (hpush' _ ?_))) + · exact hρ.trans ((Arw.of_path p hp).trans hρ'.symm) + · exact hρ.trans ((Arw.of_path q hq).trans hρ'.symm) + +/-- **The first step of the proof of (11.8)** of Graph Minors VII (page 253): by Zorn's lemma, there +is a maximal +open flat path-connected set that contains a given one. -/ +theorem exists_maximal_flat {Y₀ : Set T} (hY₀o : IsOpen Y₀) (hY₀c : IsPathConnected Y₀) + (hY₀f : Flat Y₀) : + ∃ Y, Y₀ ⊆ Y ∧ IsOpen Y ∧ IsPathConnected Y ∧ Flat Y ∧ + ∀ Y', Y ⊆ Y' → IsOpen Y' → IsPathConnected Y' → Flat Y' → Y' ⊆ Y := by + let 𝓕 : Set (Set T) := {Y | Y₀ ⊆ Y ∧ IsOpen Y ∧ IsPathConnected Y ∧ Flat Y} + obtain ⟨x₀, hx₀⟩ := hY₀c.nonempty + have hchain : ∀ c ⊆ 𝓕, IsChain (· ⊆ ·) c → c.Nonempty → ∃ ub ∈ 𝓕, ∀ s ∈ c, s ⊆ ub := by + intro c hc hch hne + obtain ⟨Y₁, hY₁⟩ := hne + refine ⟨⋃₀ c, ⟨(hc hY₁).1.trans (subset_sUnion_of_mem hY₁), isOpen_sUnion fun s hs => + (hc hs).2.1, + ?_, ?_⟩, fun s hs => subset_sUnion_of_mem hs⟩ + · refine ⟨x₀, ⟨Y₁, hY₁, (hc hY₁).1 hx₀⟩, ?_⟩ + rintro y ⟨s, hs, hy⟩ + exact ((hc hs).2.2.1.joinedIn x₀ ((hc hs).1 hx₀) y hy).mono (subset_sUnion_of_mem hs) + · intro a b p q hp hq + have hK : IsCompact (range p ∪ range q) := (isCompact_range p.continuous).union + (isCompact_range q.continuous) + have hsub : range p ∪ range q ⊆ ⋃ s : c, s.1 := by + rw [← sUnion_eq_iUnion] + rintro _ (⟨u, rfl⟩ | ⟨u, rfl⟩) + · exact hp u + · exact hq u + have : Nonempty c := ⟨⟨Y₁, hY₁⟩⟩ + obtain ⟨s, hs⟩ := hK.elim_directed_cover _ (fun s : c => (hc s.2).2.1) hsub + (directedOn_iff_directed.mp hch.directedOn) + exact (hc s.2).2.2.2 p q (fun u => hs (Or.inl ⟨u, rfl⟩)) fun u => hs (Or.inr ⟨u, rfl⟩) + obtain ⟨Y, -, hY⟩ := zorn_subset_nonempty 𝓕 hchain Y₀ ⟨subset_rfl, hY₀o, hY₀c, hY₀f⟩ + refine ⟨Y, hY.prop.1, hY.prop.2.1, hY.prop.2.2.1, hY.prop.2.2.2, fun Y' h₁ h₂ h₃ h₄ => ?_⟩ + exact hY.le_of_ge ⟨hY.prop.1.trans h₁, h₂, h₃, h₄⟩ h₁ + +end Abstract + +variable {S : Type u} [TopologicalSpace S] + +/-- A subset of `W` that is simply-connected is flat in `W`. -/ +theorem flat_of_simplyConnected {W K : Set S} (hK : IsSimplyConnectedSet K) (hKW : K ⊆ W) : + Flat (Subtype.val ⁻¹' K : Set W) := fun _ _ p q hp hq => + homotopic_of_mem hK hKW p q (by simpa using hp 0) (by simpa using hp 1) hp hq + +/-- A set in `W` is path-connected in `W` if it is path-connected in the surface. -/ +theorem isPathConnected_preimage {W K : Set S} (hK : IsPathConnected K) (hKW : K ⊆ W) : + IsPathConnected (Subtype.val ⁻¹' K : Set W) := by + rw [IsInducing.subtypeVal.isPathConnected_iff, Subtype.image_preimage_coe, inter_eq_right.mpr hKW] + exact hK + +/-- **(11.5)** of Graph Minors VII (page 251), in a closed surface: a closed flat path-connected set +`X` +that is locally arc-wise connected has an open flat path-connected neighbourhood in `W`. -/ +theorem exists_open_flat (hS : IsClosedSurface S) {W X : Set S} (hW : IsOpen W) + (hXW : X ⊆ W) + (hXc : IsClosed X) (hXl : IsLocallyArcConnected X) (hXp : IsPathConnected X) + (hXf : Flat (Subtype.val ⁻¹' X : Set W)) : + ∃ Y₀ : Set W, Subtype.val ⁻¹' X ⊆ Y₀ ∧ IsOpen Y₀ ∧ IsPathConnected Y₀ ∧ Flat Y₀ := by + classical + have hT : T2Space S := hS.2.1 + have hC : CompactSpace S := hS.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + -- The cover: open sets that miss `X`, and open subsets of discs in `W` where `X` is + -- path-connected. + let Good : Set S → Prop := fun O => IsOpen O ∧ (O ⊆ Xᶜ ∨ ∃ D, IsClosedDisc D ∧ O ⊆ D ∧ D ⊆ W ∧ + ∀ a ∈ X ∩ O, ∀ b ∈ X ∩ O, JoinedIn (X ∩ O) a b) + have hcover : (univ : Set S) ⊆ ⋃ O : {O // Good O}, O.1 := by + intro z _ + by_cases hz : z ∈ X + · obtain ⟨D, D', hD, hD'o, hzD', hD'D, hDW, -⟩ := exists_closedDisc_nbhd hS hW (hXW hz) + obtain ⟨A, hA, hzA, hAo, hAc⟩ := hXl z hz D' hD'o hzD' + refine mem_iUnion.mpr ⟨⟨A, hAo, Or.inr ⟨D, hD, hA.trans hD'D, hDW, fun a ha b hb => ?_⟩⟩, hzA⟩ + by_cases hab : a = b + · subst hab + exact JoinedIn.refl ha + · obtain ⟨L, hL, hl⟩ := hAc a ha b hb hab + obtain ⟨f, h0, h1⟩ := hl + exact (show JoinedIn L a b from ⟨⟨⟨fun t => (f t).1, by fun_prop⟩, h0, h1⟩, + fun t => (f t).2⟩).mono hL + · exact mem_iUnion.mpr ⟨⟨Xᶜ, hXc.isOpen_compl, Or.inl subset_rfl⟩, hz⟩ + obtain ⟨R, hR, hN⟩ := exists_small_rel (fun O : {O // Good O} => O.1) (fun O => O.2.1) hcover + -- The neighbourhoods. + have hnb : ∀ z : S, ∃ V : Set S, z ∈ X → (IsOpen V ∧ z ∈ V ∧ V ⊆ W ∧ IsPathConnected V ∧ + ∀ a ∈ V, ∀ b ∈ V, R a b) := by + intro z + by_cases hz : z ∈ X + · obtain ⟨N, hNo, hNz, hNr⟩ := hN z + obtain ⟨V, hV, hVo, hzV, hVc⟩ := locallyConnectedSpace_iff_subsets_isOpen_isConnected.mp hlc + z (N ∩ W) + ((hNo.inter hW).mem_nhds ⟨hNz, hXW hz⟩) + exact ⟨V, fun _ => ⟨hVo, hzV, hV.trans inter_subset_right, + isPathConnected_of_isOpen hS hVo hVc.isPreconnected ⟨z, hzV⟩, + fun a ha b hb => hNr a (hV ha).1 b (hV hb).1⟩⟩ + · exact ⟨∅, fun h => (hz h).elim⟩ + choose V hV using hnb + let N : W → Set W := fun z => Subtype.val ⁻¹' V z.1 + have hNf := flat_iUnion hXf N (fun z hz => (hV z.1 hz).1.preimage continuous_subtype_val) + (fun z hz => (hV z.1 hz).2.1) (fun z hz => isPathConnected_preimage (hV z.1 hz).2.2.2.1 + (hV z.1 hz).2.2.1) + (fun z hz z' hz' hne => ?_) + · refine ⟨⋃ z ∈ (Subtype.val ⁻¹' X : Set W), N z, fun z hz => ?_, ?_, ?_, hNf⟩ + · exact mem_biUnion hz (hV z.1 hz).2.1 + · exact isOpen_biUnion fun z hz => (hV z.1 hz).1.preimage continuous_subtype_val + · obtain ⟨x₀, hx₀, hj⟩ := isPathConnected_preimage hXp hXW + have hsub : ∀ z ∈ (Subtype.val ⁻¹' X : Set W), N z ⊆ ⋃ z ∈ (Subtype.val ⁻¹' X : Set W), N z := + fun z hz => subset_biUnion_of_mem (u := N) hz + have hmem : ∀ z ∈ (Subtype.val ⁻¹' X : Set W), z ∈ N z := fun z hz => (hV z.1 hz).2.1 + refine ⟨x₀, hsub x₀ hx₀ (hmem x₀ hx₀), fun y hy => ?_⟩ + simp only [mem_iUnion, exists_prop] at hy + obtain ⟨z, hz, hy⟩ := hy + have h₁ : JoinedIn (⋃ z ∈ (Subtype.val ⁻¹' X : Set W), N z) x₀ z := + (hj hz).mono fun w hw => hsub w hw (hmem w hw) + have h₂ : JoinedIn (N z) z y := + (isPathConnected_preimage (hV z.1 hz).2.2.2.1 (hV z.1 hz).2.2.1).joinedIn z (hmem z hz) y hy + exact h₁.trans (h₂.mono (hsub z hz)) + · obtain ⟨u, hu, hu'⟩ := hne + obtain ⟨⟨O, hOo, hO⟩, hOr⟩ := hR u.1 + have hin : ∀ y ∈ N z, y.1 ∈ O := fun y hy => hOr _ ((hV z.1 hz).2.2.2.2 _ hu _ hy) + have hin' : ∀ y ∈ N z', y.1 ∈ O := fun y hy => hOr _ ((hV z'.1 hz').2.2.2.2 _ hu' _ hy) + rcases hO with hO | ⟨D, hD, hOD, hDW, hj⟩ + · exact (hO (hin z (hV z.1 hz).2.1) hz).elim + · refine ⟨Subtype.val ⁻¹' O, (flat_of_simplyConnected (IsClosedDisc.isSimplyConnectedSet hD) + hDW).mono + (preimage_mono hOD), ?_, fun a ha b hb => ?_⟩ + · rintro y (hy | hy) + · exact hin y hy + · exact hin' y hy + · have := hj a.1 ha b.1 hb + have e : (Subtype.val '' ((Subtype.val ⁻¹' X : Set W) ∩ Subtype.val ⁻¹' O)) = X ∩ O := by + rw [← preimage_inter, Subtype.image_preimage_coe, inter_eq_right.mpr + (inter_subset_left.trans hXW)] + exact (IsInducing.subtypeVal.joinedIn_image ha hb).mp (by rwa [e]) + +/-- **(11.9)** of Graph Minors VII (page 253), in a closed surface and inside an open set `W`, with +the conclusion +that (11.10) draws from it. Graph Minors XI (7.2) gives a disc in `W` bounded by an `O`-arc +null-homotopic in `W`. -/ +theorem exists_open_around [ConnectedSpace S] (hS : IsClosedSurface S) {W X : Set S} + (hW : IsOpen W) (hXW : X ⊆ W) (hXc : IsClosed X) (hXl : IsLocallyArcConnected X) + (hXp : IsPathConnected X) + (hXf : Flat (Subtype.val ⁻¹' X : Set W)) : + ∃ Y, X ⊆ Y ∧ Y ⊆ W ∧ ((IsSphere S ∧ Y = univ) ∨ IsOpenDisc Y) := by + have hT : T2Space S := hS.2.1 + obtain ⟨Y₀, hsub, h₁, h₂, h₃⟩ := exists_open_flat hS hW hXW hXc hXl hXp hXf + obtain ⟨Y, hY₀, hYo, hYc, hYf, hmax⟩ := exists_maximal_flat h₁ h₂ h₃ + have hopen : IsOpen (Subtype.val '' Y) := hW.isOpenEmbedding_subtypeVal.isOpenMap _ hYo + refine ⟨Subtype.val '' Y, fun x hx => ⟨⟨x, hXW hx⟩, hY₀ (hsub hx), rfl⟩, ?_, ?_⟩ + · rintro _ ⟨y, -, rfl⟩ + exact y.2 + have hbody : ∀ F : Set S, F ⊆ Subtype.val '' Y → IsOArc F → + ∃ Δ : Set S, Δ ⊆ Subtype.val '' Y ∧ IsClosedDisc Δ ∧ discBd Δ = F := by + intro F hFY hF + have hFW : F ⊆ W := by + rintro x hx + obtain ⟨y, -, rfl⟩ := hFY hx + exact y.2 + obtain ⟨ψ⟩ := id hF + let φ : C(Circle, S) := ⟨fun x => (ψ x).1, continuous_subtype_val.comp ψ.continuous⟩ + have hmem : ∀ t, φ (arcParam 1 t) ∈ W := fun t => hFW (ψ _).2 + let a : W := ⟨φ (arcParam 1 0), hmem 0⟩ + let γ : Path a a := ⟨⟨fun t => ⟨φ (arcParam 1 t), hmem t⟩, by fun_prop⟩, rfl, + Subtype.ext (by simp [a])⟩ + have hγ : ∀ u, γ u ∈ Y := fun u => by + obtain ⟨y, hy, e⟩ := hFY (ψ (arcParam 1 u)).2 + have : γ u = y := Subtype.ext e.symm + rwa [this] + have hh : γ.Homotopic (Path.refl a) := hYf _ _ (hγ) (fun _ => by simpa using hγ 0) + have hnull : IsNullHomotopicOArcIn W F := ⟨ψ, a.1, a.2, closedCurvesHomotopicIn_of_path 1 φ + (ContinuousMap.const _ a.1) γ (Path.refl a) (fun _ => rfl) (fun _ => rfl) hh⟩ + have hbd : Disjoint F (bd S) := disjoint_left.mpr fun x _ hx => hx (hS.2.2 x) + obtain ⟨Δ, hΔW, hΔ, hb⟩ := (epstein S W F (IsClosedSurface.isSurface hS) inferInstance hF hFW + hbd).1 hnull + have hcφ : Continuous fun t : I => φ (arcParam 1 t) := by fun_prop + have hrange : range (fun t : I => φ (arcParam 1 t)) = F := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (ψ _).2 + · intro hx + obtain ⟨w, hw⟩ := ψ.surjective ⟨x, hx⟩ + obtain ⟨t, rfl⟩ := arcParam_surjective 1 w + exact ⟨t, congrArg Subtype.val hw⟩ + have hFc : IsClosed F := hrange ▸ (isCompact_range hcφ).isClosed + have hpc : PathConnectedSpace I := + have : ContractibleSpace I := (convex_Icc (0 : ℝ) 1).contractibleSpace ⟨0, by simp⟩ + inferInstance + have hpF : IsPathConnected F := hrange ▸ isPathConnected_range hcφ + let D : Set W := Subtype.val ⁻¹' Δ + let G : Set W := Subtype.val ⁻¹' F + have hDG : D \ G = Subtype.val ⁻¹' (Δ \ F) := rfl + have hDo : IsOpen (D \ G) := by + rw [hDG, ← hb] + exact (isOpenDisc_interior hS hΔ).1.preimage continuous_subtype_val + have hFΔ : F ⊆ Δ := by + rw [← hb] + exact discBd_subset Δ + have hGY : G ⊆ Y := fun x hx => by + obtain ⟨y, hy, e⟩ := hFY hx + have : x = y := Subtype.ext e.symm + rwa [this] + have hGD : G ⊆ D := fun x hx => hFΔ hx + have hDp : IsPathConnected D := isPathConnected_preimage (IsClosedDisc.isSimplyConnectedSet + hΔ).1 hΔW + have hGp : IsPathConnected G := isPathConnected_preimage hpF hFW + have hflat : Flat (Y ∪ D) := flat_union_disc hYo hYc hYf + (flat_of_simplyConnected (IsClosedDisc.isSimplyConnectedSet hΔ) hΔW) + ((IsClosedDisc.isCompact hΔ).isClosed.preimage continuous_subtype_val) hDp hDo + (hFc.preimage continuous_subtype_val) + hGp hGY hGD + have hopen' : IsOpen (Y ∪ D) := by + have e : Y ∪ D = Y ∪ (D \ G) := by + ext x + constructor + · rintro (h | h) + · exact Or.inl h + · by_cases hx : x ∈ G + · exact Or.inl (hGY hx) + · exact Or.inr ⟨h, hx⟩ + · rintro (h | h) + · exact Or.inl h + · exact Or.inr h.1 + rw [e] + exact hYo.union hDo + obtain ⟨g, hg⟩ := hGp.nonempty + have hpc : IsPathConnected (Y ∪ D) := hYc.union hDp ⟨g, hGY hg, hGD hg⟩ + have hsubD := hmax _ subset_union_left hopen' hpc hflat + refine ⟨Δ, fun x hx => ⟨⟨x, hΔW hx⟩, hsubD (Or.inr hx), rfl⟩, hΔ, hb⟩ + exact open_disc S _ hS inferInstance (hYc.isConnected.image _ + continuous_subtype_val.continuousOn) hopen hbody + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/PaintingCells.lean b/LeanPool/GraphMinor/GM11/PaintingCells.lean new file mode 100644 index 0000000000..e57f360d49 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PaintingCells.lean @@ -0,0 +1,323 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.ArcDrawings +public import LeanPool.GraphMinor.GM11.Section6 + +/-! +# The cells of a 2-cell painting + +We use the following facts to reduce radial drawings of paintings to radial drawings of drawings. + +- `discRay`: in a closed disc with a chart, the line from the centre to a point. Hence a closed disc + minus finitely many points of its boundary is arc-wise connected (`isPathConnected_disc_sdiff`). +- `isOpenDisc_interior`: the interior of a closed disc in a surface is an open disc. +- `Cell.isClosed_U`, `Cell.closure_sdiff_V`, `Cell.closure_inter_subset_V`: if all regions of + a painting are open discs, then `U` is closed, a cell is its closure minus the vertices, and two + cells meet only in vertices. +- `componentsIn_of_partition`: the components of a union of disjoint connected open sets. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The point `t z` of the closed unit disc. -/ +def scaleDisc (t : I) (z : ClosedUnitDisc) : ClosedUnitDisc := + ⟨(t : ℝ) • z.1, by + have hz : ‖z.1‖ ≤ 1 := by simpa [ClosedUnitDisc] using z.2 + have ht : (t : ℝ) ≤ 1 := t.2.2 + have h0 : (0 : ℝ) ≤ t := t.2.1 + have : ‖(t : ℝ) • z.1‖ ≤ 1 := by + rw [norm_smul, Real.norm_of_nonneg h0] + nlinarith [norm_nonneg z.1] + simpa [ClosedUnitDisc] using this⟩ + +theorem continuous_scaleDisc (z : ClosedUnitDisc) : Continuous fun t : I => scaleDisc t z := + Continuous.subtype_mk (by fun_prop) _ + +theorem scaleDisc_one (z : ClosedUnitDisc) : scaleDisc 1 z = z := by + apply Subtype.ext + simp [scaleDisc] + +theorem scaleDisc_zero (z w : ClosedUnitDisc) : scaleDisc 0 z = scaleDisc 0 w := by + apply Subtype.ext + simp [scaleDisc] + +theorem norm_scaleDisc (t : I) (z : ClosedUnitDisc) : ‖(scaleDisc t z).1‖ = t * ‖z.1‖ := by + simp only [scaleDisc, norm_smul] + rw [Real.norm_of_nonneg t.2.1] + +theorem norm_le_one_disc (z : ClosedUnitDisc) : ‖z.1‖ ≤ 1 := by + simpa [ClosedUnitDisc] using z.2 + +/-- The centre of the closed unit disc. -/ +def discCentre : ClosedUnitDisc := ⟨0, by simp [ClosedUnitDisc]⟩ + +theorem scaleDisc_zero_eq (z : ClosedUnitDisc) : scaleDisc 0 z = discCentre := by + apply Subtype.ext + simp [scaleDisc, discCentre] + +/-- A closed disc minus a set of its boundary points is arc-wise connected. -/ +theorem isPathConnected_disc_sdiff {D A : Set S} (hD : IsClosedDisc D) (hA : A ∩ D ⊆ discBd D) : + IsPathConnected (D \ A) := by + obtain ⟨φ⟩ := id hD + have hb := disc_boundary D φ + let c : S := (φ discCentre).1 + have hbd : ∀ z : ClosedUnitDisc, ‖z.1‖ < 1 → (φ z).1 ∉ A := by + intro z hz hzA + have : (φ z).1 ∈ discBd D := hA ⟨hzA, (φ z).2⟩ + rw [hb] at this + obtain ⟨w, hw, he⟩ := this + have : w = z := φ.injective (Subtype.ext he) + subst this + have hw' : ‖w.1‖ = 1 := by simpa [UnitCircle] using hw + linarith + have hcA : c ∈ D \ A := ⟨(φ _).2, hbd _ (by simp [discCentre])⟩ + refine ⟨c, hcA, fun {y} hy => ?_⟩ + obtain ⟨z, hz⟩ := φ.surjective ⟨y, hy.1⟩ + have hzy : (φ z).1 = y := by rw [hz] + let g : I → S := fun t => (φ (scaleDisc t z)).1 + have hg : Continuous g := + continuous_subtype_val.comp (φ.continuous.comp (continuous_scaleDisc z)) + have h0 : g 0 = c := by simp only [g, c, scaleDisc_zero_eq] + have h1 : g 1 = y := by simp only [g, scaleDisc_one, hzy] + refine ⟨⟨⟨g, hg⟩, h0, h1⟩, fun t => ⟨(φ _).2, ?_⟩⟩ + change g t ∉ A + have hle := norm_le_one_disc z + by_cases ht : t = 1 + · rw [ht, h1] + exact hy.2 + · have ht' : (t : ℝ) < 1 := lt_of_le_of_ne t.2.2 fun h => ht (Subtype.ext h) + refine hbd _ ?_ + rw [norm_scaleDisc] + nlinarith [t.2.1, norm_nonneg z.1] + +theorem interior_eq_sdiff_discBd (hS : IsClosedSurface S) {D : Set S} (hD : IsClosedDisc D) : + interior D = D \ discBd D := by + have : T2Space S := hS.2.1 + rw [← IsClosedDisc.frontier_eq_discBd hS hD] + have hc : IsClosed D := hD.isCompact.isClosed + ext x + constructor + · intro hx + exact ⟨interior_subset hx, fun h => h.2 hx⟩ + · rintro ⟨hx, hn⟩ + by_contra h + exact hn ⟨subset_closure hx, h⟩ + +/-- The interior of a closed disc in a surface is an open disc. -/ +theorem isOpenDisc_interior (hS : IsClosedSurface S) {D : Set S} (hD : IsClosedDisc D) : + IsOpenDisc (D \ discBd D) := by + refine ⟨interior_eq_sdiff_discBd hS hD ▸ isOpen_interior, ?_⟩ + obtain ⟨φ⟩ := id hD + have hsub : OpenUnitDisc ⊆ ClosedUnitDisc := Metric.ball_subset_closedBall + let m : OpenUnitDisc → S := fun z => (φ (inclusion hsub z)).1 + have hm : IsEmbedding m := + IsEmbedding.subtypeVal.comp (φ.isEmbedding.comp (IsEmbedding.inclusion hsub)) + have hr : range m = D \ discBd D := by + rw [disc_boundary D φ] + ext y + constructor + · rintro ⟨z, rfl⟩ + refine ⟨(φ _).2, ?_⟩ + rintro ⟨w, hw, he⟩ + have hw' : w = inclusion hsub z := φ.injective (Subtype.ext he) + subst hw' + have h₁ : ‖z.1‖ < 1 := by simpa [OpenUnitDisc] using z.2 + have h₂ : ‖z.1‖ = 1 := by simpa [UnitCircle] using hw + linarith + · rintro ⟨hy, hn⟩ + obtain ⟨w, hw⟩ := φ.surjective ⟨y, hy⟩ + have hle := norm_le_one_disc w + have hlt : ‖w.1‖ < 1 := by + refine lt_of_le_of_ne hle fun h => hn ⟨w, by simpa [UnitCircle] using h, by simp [hw]⟩ + refine ⟨⟨w.1, by simpa [OpenUnitDisc] using hlt⟩, ?_⟩ + simp [m, inclusion, hw] + exact ⟨hm.toHomeomorph.trans (Homeomorph.setCongr hr)⟩ + +/-- A point of a set lies in an arc-wise connected component of it. -/ +theorem exists_mem_arcComponent {F : Set S} {x : S} (hx : x ∈ F) : + ∃ C ∈ arcComponentsIn F, x ∈ C := by + exact ⟨pathComponentIn F x, GraphMinor.Surface.mem_arcComponentsIn_of_mem hx, + mem_pathComponentIn_self hx⟩ + +/-- Two arc-wise connected components with a common point are equal. -/ +theorem arcComponent_eq {F C D : Set S} (hC : C ∈ arcComponentsIn F) (hD : D ∈ arcComponentsIn F) + {x : S} (hxC : x ∈ C) (hxD : x ∈ D) : C = D := by + have hu : IsPathConnected (C ∪ D) := hC.2.2.1.union hD.2.2.1 ⟨x, hxC, hxD⟩ + have h₁ := hC.2.2.2 _ (union_subset hC.2.1 hD.2.1) hu subset_union_left + have h₂ := hD.2.2.2 _ (union_subset hC.2.1 hD.2.1) hu subset_union_right + exact h₂.symm.trans h₁ |>.symm + +/-- The components of a union of disjoint connected open sets are those sets. -/ +theorem componentsIn_of_partition {Y : Set S} {F : Set (Set S)} + (hF : ∀ a ∈ F, IsOpen a ∧ IsPreconnected a ∧ a.Nonempty) + (hd : ∀ a ∈ F, ∀ b ∈ F, (a ∩ b).Nonempty → a = b) (hY : ⋃₀ F = Y) : componentsIn Y = F := by + have key : ∀ a ∈ F, ∀ x ∈ a, connectedComponentIn Y x = a := by + intro a ha x hx + have haY : a ⊆ Y := fun y hy => hY ▸ ⟨a, ha, hy⟩ + have hxY := haY hx + apply subset_antisymm _ ((hF a ha).2.1.subset_connectedComponentIn hx haY) + have hrest : IsOpen (⋃₀ (F \ {a})) := isOpen_sUnion fun b hb => (hF b hb.1).1 + refine (isPreconnected_connectedComponentIn).subset_left_of_subset_union (hF a ha).1 hrest ?_ ?_ + ⟨x, mem_connectedComponentIn hxY, hx⟩ + · refine disjoint_left.mpr ?_ + rintro y hya ⟨b, hb, hyb⟩ + exact hb.2 (hd a ha b hb.1 ⟨y, hya, hyb⟩).symm + · intro y hy + have hy' : y ∈ Y := connectedComponentIn_subset _ _ hy + rw [← hY] at hy' + obtain ⟨b, hb, hyb⟩ := hy' + by_cases hab : b = a + · exact Or.inl (hab ▸ hyb) + · exact Or.inr ⟨b, ⟨hb, hab⟩, hyb⟩ + ext a + constructor + · rintro ⟨x, hx, rfl⟩ + rw [← hY] at hx + obtain ⟨b, hb, hxb⟩ := hx + rw [key b hb x hxb] + exact hb + · intro ha + obtain ⟨x, hx⟩ := (hF a ha).2.2 + exact ⟨x, hY ▸ ⟨a, ha, hx⟩, key a ha x hx⟩ + +namespace Cell + +variable (Γ : Painting S) + +/-- If the regions of a painting are open, its point set is closed. -/ +theorem isClosed_U (hP : ∀ r ∈ Γ.R, IsOpen r) : IsClosed Γ.U := by + rw [← isOpen_compl_iff] + have : Γ.Uᶜ = ⋃₀ Γ.R := by + ext x + constructor + · intro hx + have hx' : x ∈ univ \ Γ.U := ⟨trivial, hx⟩ + exact ⟨_, ⟨x, hx', rfl⟩, mem_connectedComponentIn hx'⟩ + · rintro ⟨r, ⟨y, -, rfl⟩, hx⟩ + exact (connectedComponentIn_subset _ _ hx).2 + rw [this] + exact isOpen_sUnion hP + +/-- A point of a painting is a vertex or lies in a cell. -/ +theorem mem_V_or_cell {x : S} (hx : x ∈ Γ.U) : x ∈ Γ.V ∨ ∃ e ∈ Γ.E, x ∈ e := by + by_cases hV : x ∈ Γ.V + · exact Or.inl hV + · exact Or.inr (exists_mem_arcComponent ⟨hx, hV⟩) + +variable {Γ} + +theorem isClosedDisc_closure {e : Set S} (he : e ∈ Γ.E) : IsClosedDisc (closure e) := + (Γ.edge_cond e he).1 + +theorem closure_inter_V_subset (hS : IsClosedSurface S) {e : Set S} (he : e ∈ Γ.E) : + closure e ∩ Γ.V ⊆ discBd (closure e) := by + have := (Γ.edge_cond e he).2 + rwa [subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hS (isClosedDisc_closure he)] at this + +/-- In a painting with closed `U`, a cell is its closure without the vertices. -/ +theorem closure_sdiff_V (hS : IsClosedSurface S) (hU : IsClosed Γ.U) {e : Set S} (he : e ∈ Γ.E) : + closure e \ Γ.V = e := by + have hsub : e ⊆ Γ.U \ Γ.V := he.2.1 + have hcl : closure e ⊆ Γ.U := closure_minimal (hsub.trans sdiff_subset) hU + have hpc := isPathConnected_disc_sdiff (isClosedDisc_closure he) (A := Γ.V) (by + rw [inter_comm] + exact closure_inter_V_subset hS he) + refine he.2.2.2 _ (fun x hx => ⟨hcl hx.1, hx.2⟩) hpc fun x hx => ⟨subset_closure hx, (hsub hx).2⟩ + +/-- In a painting with closed `U`, two cells meet only in vertices. -/ +theorem closure_inter_subset_V (hS : IsClosedSurface S) (hU : IsClosed Γ.U) {e f : Set S} + (he : e ∈ Γ.E) (hf : f ∈ Γ.E) (hef : e ≠ f) : closure e ∩ closure f ⊆ Γ.V := by + rintro x ⟨hxe, hxf⟩ + by_contra hV + have h₁ : x ∈ e := closure_sdiff_V hS hU he ▸ (⟨hxe, hV⟩ : x ∈ closure e \ Γ.V) + have h₂ : x ∈ f := closure_sdiff_V hS hU hf ▸ (⟨hxf, hV⟩ : x ∈ closure f \ Γ.V) + exact hef (arcComponent_eq he hf h₁ h₂) + +end Cell + +/-- A finite set of points, as a drawing with no edges. -/ +def pointsDrawing [T1Space S] {A : Set S} (hA : A.Finite) : Drawing S where + U := A + V := A + V_subset_U := Subset.rfl + isClosed_U := hA.isClosed + finite_V := hA + finite_edges := by + refine finite_empty.subset ?_ + rintro C ⟨⟨x, hx⟩, hsub, -⟩ + simpa using hsub hx + edge_cond := by + rintro C ⟨⟨x, hx⟩, hsub, -⟩ + simpa using hsub hx + +variable [T2Space S] + +/-- The drawing of the boundaries of the cells of a painting, with vertex set `V₀`. -/ +theorem exists_boundary_drawing (hS : IsClosedSurface S) {Γ : Painting S} (hU : IsClosed Γ.U) + {V₀ : Set S} (hfin : V₀.Finite) (hsub : Γ.V ⊆ V₀) + (hne : ∀ e ∈ Γ.E, (V₀ ∩ discBd (closure e)).Nonempty) : + ∃ D : Drawing S, D.U = V₀ ∪ ⋃ e ∈ Γ.E, discBd (closure e) ∧ D.V = V₀ := by + classical + have key : ∀ T : Finset (Set S), (∀ e ∈ T, e ∈ Γ.E) → + ∃ D : Drawing S, D.U = V₀ ∪ ⋃ e ∈ T, discBd (closure e) ∧ D.V = V₀ := by + intro T + induction T using Finset.induction_on with + | empty => + intro _ + exact ⟨pointsDrawing hfin, by simp [pointsDrawing], rfl⟩ + | insert e T he ih => + intro hT + obtain ⟨D, hU', hV'⟩ := ih fun f hf => hT f (Finset.mem_insert_of_mem hf) + have hee := hT e (Finset.mem_insert_self _ _) + obtain ⟨C, hCU, hCV⟩ := exists_drawing_on_oArc + (Cell.isClosedDisc_closure hee).isOArc_discBd (hfin.inter_of_left _) + (hne e hee) inter_subset_right + have hmeet : D.U ∩ C.U ⊆ D.V ∩ C.V := by + rw [hU', hV', hCU, hCV] + rintro x ⟨hx | hx, hxb⟩ + · exact ⟨hx, hx, hxb⟩ + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + have hfe : e ≠ f := fun h => he (h ▸ hf) + have hxV := Cell.closure_inter_subset_V hS hU hee (hT f (Finset.mem_insert_of_mem hf)) + hfe ⟨discBd_subset _ hxb, discBd_subset _ hxf⟩ + exact ⟨hsub hxV, hsub hxV, hxb⟩ + refine ⟨D.glue C hmeet, ?_, ?_⟩ + · change D.U ∪ C.U = _ + rw [hU', hCU] + ext x + simp only [mem_union, mem_iUnion, Finset.mem_insert, exists_prop] + constructor + · rintro ((h | ⟨f, hf, h⟩) | h) + · exact Or.inl h + · exact Or.inr ⟨f, Or.inr hf, h⟩ + · exact Or.inr ⟨e, Or.inl rfl, h⟩ + · rintro (h | ⟨f, rfl | hf, h⟩) + · exact Or.inl (Or.inl h) + · exact Or.inr h + · exact Or.inl (Or.inr ⟨f, hf, h⟩) + · change D.V ∪ C.V = V₀ + rw [hV', hCV] + exact union_eq_left.mpr inter_subset_left + have hfe : Γ.E.Finite := Γ.finite_edges + obtain ⟨D, hD, hV⟩ := key hfe.toFinset fun e he => hfe.mem_toFinset.mp he + refine ⟨D, ?_, hV⟩ + rw [hD] + simp only [hfe.mem_toFinset] + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/PaintingFacts.lean b/LeanPool/GraphMinor/GM11/PaintingFacts.lean new file mode 100644 index 0000000000..a482a2a38c --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PaintingFacts.lean @@ -0,0 +1,256 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PaintingRadial +public import LeanPool.GraphMinor.GM11.RadialFacts +import LeanPool.GraphMinor.Surface.Circle + +/-! +# Each region of a radial drawing of a painting contains a unique cell + +`regionFacts_of_painting` is the statement of Graph Minors XI (Section 3, page 75) for a 2-cell +painting +with a cell. + +If a cell has no vertex, this is `regionFacts_of_free_cell`. Otherwise let `D` be the drawing of the +boundaries of the cells, and `G` a radial drawing of `D` made from `Γ'` by adding stars in the +cells. By +`regionFacts_of_radial`, each region of `G` contains a unique edge of `D`. Each region of `Γ'` is +then +the union of one cell `e` with the regions of `G` that contain an edge of `D` in `e`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- An `O`-arc is infinite. -/ +theorem infinite_of_isOArc {F : Set S} (hF : IsOArc F) : F.Infinite := + hF.infinite + +variable [T2Space S] [ConnectedSpace S] {Γ : Painting S} {Γ' : Drawing S} + +/-- **Every region of a radial drawing of a 2-cell painting contains a unique cell.** Graph Minors +XI, +Section 3 (page 75). -/ +theorem regionFacts_of_painting (hrad : PreRad (PaintingOrDrawing.painting Γ) Γ') + (hmax : RadMax (PaintingOrDrawing.painting Γ) Γ') (hS : IsClosedSurface S) (hE : + (PaintingOrDrawing.painting Γ).E.Nonempty) : + RegionFacts (PaintingOrDrawing.painting Γ) Γ' := by + classical + by_cases hfree : ∃ e ∈ Γ.E, closure e ∩ Γ.V = ∅ + · obtain ⟨e, he, hf⟩ := hfree + exact regionFacts_of_free_cell hS hrad he hf + have hv : ∀ e ∈ Γ.E, (closure e ∩ Γ.V).Nonempty := fun e he => by + by_contra h + exact hfree ⟨e, he, not_nonempty_iff_eq_empty.mp h⟩ + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨e₀, he₀⟩ := hE + obtain ⟨y₀, -⟩ := he₀.1 + have hneS : Nonempty S := ⟨y₀⟩ + have hU : IsClosed Γ.U := cell_isClosed_U hrad + obtain ⟨c, K, hst⟩ := exists_cellStars (Γ := Γ) + obtain ⟨G, hG⟩ := exists_star_drawing hrad hst hS + have hbd : ∀ e ∈ Γ.E, Γ.V ∩ closure e ⊆ discBd (closure e) := fun e he x hx => + Cell.closure_inter_V_subset hS he ⟨hx.2, hx.1⟩ + obtain ⟨D, hDU, hDV⟩ := exists_boundary_drawing hS hU Γ.finite_V Subset.rfl fun e he => by + obtain ⟨x, hx, hxV⟩ := hv e he + exact ⟨x, hxV, hbd e he ⟨hxV, hx⟩⟩ + have hDR : D.R = Γ.R ∪ cellInt '' Γ.E := + boundary_R hS hrad.1.2 Subset.rfl Γ.V_subset_U hbd hDU + have hGrad := radial_of_stars hrad hst hS hG hDU hDV hv hmax hDR + -- Each point of `D` that is not a vertex lies in an edge of `D`. + have hedge : ∀ x ∈ D.U, x ∉ D.V → ∃ a ∈ D.E, x ∈ a := fun x hx hn => + exists_mem_arcComponent ⟨hx, hn⟩ + have hDE : D.E.Nonempty := by + have hinf := infinite_of_isOArc (Cell.isClosedDisc_closure he₀).isOArc_discBd + obtain ⟨x, hx, hn⟩ := hinf.exists_notMem_finite Γ.finite_V + have hxD : x ∈ D.U := by + rw [hDU] + exact Or.inr (mem_iUnion₂.mpr ⟨e₀, he₀, hx⟩) + obtain ⟨a, ha, -⟩ := hedge x hxD (hDV ▸ hn) + exact ⟨a, ha⟩ + obtain ⟨hf₁, hf₂, hf₃⟩ := regionFacts_of_radial ⟨hGrad.1, hGrad.2.1⟩ hS hGrad.2.2 hDE + have hf₁' : ∀ s ∈ G.R, ∃ a ∈ D.E, a ⊆ s := hf₁ + have hf₂' : ∀ s ∈ G.R, ∀ a ∈ D.E, ∀ b ∈ D.E, a ⊆ s → b ⊆ s → a = b := hf₂ + have hf₃' : ∀ s ∈ G.R, ∀ a ∈ D.E, a ⊆ s → ∀ v ∈ D.V, v ∈ closure s → v ∈ closure a := hf₃ + have hDUsub : D.U ⊆ Γ.U := D_U_subset hrad hDU + have hUU' : Γ.U ∩ Γ'.U = Γ.V := hrad.2.1 + have hcellV : ∀ e ∈ Γ.E, Disjoint e Γ.V := fun e he => + disjoint_left.mpr fun x hx h => (he.2.1 hx).2 h + -- Each edge of `D` lies in a cell. + have hcell : ∀ a ∈ D.E, ∃ e ∈ Γ.E, a ⊆ e := by + intro a ha + have hsub : a ⊆ Γ.U \ Γ.V := fun x hx => by + have h := ha.2.1 hx + exact ⟨hDUsub h.1, fun hV => h.2 (hDV.symm.subset hV)⟩ + obtain ⟨x, hx⟩ := ha.1 + obtain ⟨e, he, hxe⟩ := exists_mem_arcComponent (hsub hx) + refine ⟨e, he, ?_⟩ + have hu : IsPathConnected (e ∪ a) := he.2.2.1.union ha.2.2.1 ⟨x, hxe, hx⟩ + have := he.2.2.2 _ (union_subset he.2.1 hsub) hu subset_union_left + exact this ▸ subset_union_right + have hG_U : Γ'.U ⊆ G.U := fun x hx => hG.U ▸ Or.inl hx + have hVG : Γ.V ⊆ G.U := fun x hx => hG_U (Γ'.V_subset_U (hrad.2.2.1 hx)) + have hadis : ∀ a ∈ D.E, Disjoint a G.U := fun a ha => + edge_disjoint ⟨hGrad.1, hGrad.2.1⟩ ha + have hcellU' : ∀ e ∈ Γ.E, Disjoint e Γ'.U := fun e he => + disjoint_left.mpr fun x hx h => disjoint_left.mp (hcellV e he) hx + (hUU'.subset ⟨(he.2.1 hx).1, h⟩) + -- A region of `G` with an edge in the cell `e` misses the other cells. + have hcross : ∀ p ∈ G.R, ∀ a ∈ D.E, a ⊆ p → ∀ e ∈ Γ.E, a ⊆ e → ∀ f ∈ Γ.E, f ≠ e → + Disjoint f p := by + intro p hp a ha hap e he hae f hf hfe + refine disjoint_left.mpr fun x hxf hxp => ?_ + obtain ⟨z, hz⟩ := ha.1 + have hd := Cell.isClosedDisc_closure hf + have hsep : Disjoint a (closure f) := by + refine disjoint_left.mpr fun y hya hyf => ?_ + have hyV : y ∉ Γ.V := disjoint_left.mp (hcellV e he) (hae hya) + have hyf' : y ∈ f := Cell.closure_sdiff_V hS hU hf ▸ (⟨hyf, hyV⟩ : y ∈ closure f \ Γ.V) + exact hfe (arcComponent_eq hf he hyf' (hae hya)) + -- `p` meets the boundary of `f`. + have hmeet : ∃ y ∈ p, y ∈ discBd (closure f) := by + by_contra hno + push Not at hno + have hxint : x ∈ cellInt f := ⟨subset_closure hxf, hno x hxp⟩ + have hsub : p ⊆ cellInt f ∪ (closure f)ᶜ := fun y hy => by + by_cases hyf : y ∈ closure f + · exact Or.inl ⟨hyf, hno y hy⟩ + · exact Or.inr hyf + have hin := (region_isPreconnected hp).subset_left_of_subset_union + (isOpenDisc_interior hS hd).1 isClosed_closure.isOpen_compl + (disjoint_left.mpr fun y hy h => h hy.1) hsub ⟨x, hxp, hxint⟩ + exact disjoint_left.mp hsep hz (hin (hap hz)).1 + obtain ⟨y, hyp, hyb⟩ := hmeet + have hyU : y ∉ G.U := region_subset hp hyp + have hyV : y ∉ Γ.V := fun h => hyU (hVG h) + have hyD : y ∈ D.U := by + rw [hDU] + exact Or.inr (mem_iUnion₂.mpr ⟨f, hf, hyb⟩) + obtain ⟨b, hb, hyb'⟩ := hedge y hyD (hDV ▸ hyV) + have hbp : b ⊆ p := subset_region hp hb.2.2.1.isConnected.isPreconnected (hadis b hb) hyb' hyp + obtain rfl : a = b := hf₂' p hp a ha b hb hap hbp + have hyf : y ∈ f := Cell.closure_sdiff_V hS hU hf ▸ + (⟨discBd_subset _ hyb, hyV⟩ : y ∈ closure f \ Γ.V) + exact disjoint_left.mp hsep hyb' (subset_closure hyf) + -- The part of a region `s` of `Γ'` around the cell `e`. + let Y : Set S → Set S → Set S := fun s e => + e ∪ ⋃ p ∈ {p ∈ G.R | p ⊆ s ∧ ∃ a ∈ D.E, a ⊆ p ∧ a ⊆ e}, p + have hregsub : ∀ s ∈ Γ'.R, ∀ p ∈ G.R, ∀ x ∈ p, x ∈ s → p ⊆ s := fun s hs p hp x hxp hxs => + subset_region hs (region_isPreconnected hp) + (disjoint_left.mpr fun y hy h => region_subset hp hy (hG_U h)) hxp hxs + have hopen : ∀ s ∈ Γ'.R, ∀ e ∈ Γ.E, e ⊆ s → IsOpen (Y s e) := by + intro s hs e he hes + refine isOpen_iff_mem_nhds.mpr ?_ + rintro y (hy | hy) + · by_cases hyb : y ∈ discBd (closure e) + · have hyV : y ∉ Γ.V := disjoint_left.mp (hcellV e he) hy + have hyD : y ∈ D.U := by + rw [hDU] + exact Or.inr (mem_iUnion₂.mpr ⟨e, he, hyb⟩) + obtain ⟨b, hb, hyb'⟩ := hedge y hyD (hDV ▸ hyV) + obtain ⟨p, hp, hyp⟩ := exists_region_of_notMem (disjoint_left.mp (hadis b hb) hyb') + have hbp : b ⊆ p := + subset_region hp hb.2.2.1.isConnected.isPreconnected (hadis b hb) hyb' hyp + obtain ⟨e', he', hbe'⟩ := hcell b hb + obtain rfl : e' = e := arcComponent_eq he' he (hbe' hyb') hy + refine Filter.mem_of_superset ((region_isOpen hp).mem_nhds hyp) fun z hz => ?_ + exact Or.inr (mem_iUnion₂.mpr ⟨p, ⟨hp, hregsub s hs p hp y hyp (hes hy), b, hb, hbp, + hbe'⟩, hz⟩) + · have hO := (isOpenDisc_interior hS (Cell.isClosedDisc_closure he)).1 + refine Filter.mem_of_superset (hO.mem_nhds ⟨subset_closure hy, hyb⟩) fun z hz => ?_ + have hzV : z ∉ Γ.V := disjoint_left.mp (cellInt_disjoint_V hS he) hz + exact Or.inl (Cell.closure_sdiff_V hS hU he ▸ (⟨hz.1, hzV⟩ : z ∈ closure e \ Γ.V)) + · obtain ⟨p, hp, hyp⟩ := mem_iUnion₂.mp hy + exact Filter.mem_of_superset ((region_isOpen hp.1).mem_nhds hyp) fun z hz => + Or.inr (mem_iUnion₂.mpr ⟨p, hp, hz⟩) + have hdisj : ∀ s, ∀ e ∈ Γ.E, ∀ f ∈ Γ.E, f ≠ e → Disjoint (Y s f) (Y s e) := by + intro s e he f hf hfe + refine disjoint_left.mpr ?_ + rintro x (hx | hx) (hy | hy) + · exact hfe (arcComponent_eq hf he hx hy) + · obtain ⟨p, ⟨hp, -, a, ha, hap, hae⟩, hxp⟩ := mem_iUnion₂.mp hy + exact disjoint_left.mp (hcross p hp a ha hap e he hae f hf hfe) hx hxp + · obtain ⟨p, ⟨hp, -, a, ha, hap, haf⟩, hxp⟩ := mem_iUnion₂.mp hx + exact disjoint_left.mp (hcross p hp a ha hap f hf haf e he hfe.symm) hy hxp + · obtain ⟨p, ⟨hp, -, a, ha, hap, haf⟩, hxp⟩ := mem_iUnion₂.mp hx + obtain ⟨q, ⟨hq, -, b, hb, hbq, hbe⟩, hxq⟩ := mem_iUnion₂.mp hy + obtain rfl : p = q := region_eq_of_mem hp hq hxp hxq + obtain rfl := hf₂' p hp a ha b hb hap hbq + obtain ⟨z, hz⟩ := ha.1 + exact hfe (arcComponent_eq hf he (haf hz) (hbe hz)) + have hstarU : G.U ⊆ Γ'.U ∪ Γ.U := by + rw [hG.U] + refine union_subset_union_right _ (iUnion₂_subset fun t ht => ?_) + have hb := Cell.closure_inter_V_subset hS ht.1 ⟨ht.2.2, ht.2.1⟩ + exact (star_subset_closure hst ht.1 hb).trans (closure_subset_cell_U hrad ht.1) + have hcover : ∀ s ∈ Γ'.R, ∀ x ∈ s, ∃ e ∈ Γ.E, e ⊆ s ∧ x ∈ Y s e := by + intro s hs x hx + have hxU' : x ∉ Γ'.U := region_subset hs hx + by_cases hxU : x ∈ Γ.U + · rcases Cell.mem_V_or_cell Γ hxU with h | ⟨e, he, hxe⟩ + · exact (hxU' (Γ'.V_subset_U (hrad.2.2.1 h))).elim + · exact ⟨e, he, subset_region hs he.2.2.1.isConnected.isPreconnected (hcellU' e he) hxe hx, + Or.inl hxe⟩ + · have hxG : x ∉ G.U := fun h => (hstarU h).elim hxU' hxU + obtain ⟨p, hp, hxp⟩ := exists_region_of_notMem hxG + have hps := hregsub s hs p hp x hxp hx + obtain ⟨a, ha, hap⟩ := hf₁' p hp + obtain ⟨e, he, hae⟩ := hcell a ha + obtain ⟨z, hz⟩ := ha.1 + refine ⟨e, he, subset_region hs he.2.2.1.isConnected.isPreconnected (hcellU' e he) (hae hz) + (hps (hap hz)), Or.inr (mem_iUnion₂.mpr ⟨p, ⟨hp, hps, a, ha, hap, hae⟩, hxp⟩)⟩ + have hfill : ∀ s ∈ Γ'.R, ∀ e ∈ Γ.E, e ⊆ s → s ⊆ Y s e := by + intro s hs e he hes + let Rest : Set S := ⋃ f ∈ {f ∈ Γ.E | f ⊆ s ∧ f ≠ e}, Y s f + have hRest : IsOpen Rest := isOpen_biUnion fun f hf => hopen s hs f hf.1 hf.2.1 + have hcov : s ⊆ Y s e ∪ Rest := by + intro x hx + obtain ⟨f, hf, hfs, hxf⟩ := hcover s hs x hx + by_cases hfe : f = e + · exact Or.inl (hfe ▸ hxf) + · exact Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfs, hfe⟩, hxf⟩) + have hd : Disjoint (Y s e) Rest := by + refine disjoint_left.mpr fun x hx hx' => ?_ + obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx' + exact disjoint_left.mp (hdisj s e he f hf.1 hf.2.2) hxf hx + obtain ⟨y, hy⟩ := he.1 + exact (region_isPreconnected hs).subset_left_of_subset_union (hopen s hs e he hes) hRest hd hcov + ⟨y, hes hy, Or.inl hy⟩ + refine ⟨?_, ?_, ?_⟩ + · intro s hs + obtain ⟨x, hx⟩ := region_nonempty hs + obtain ⟨e, he, hes, -⟩ := hcover s hs x hx + exact ⟨e, he, hes⟩ + · intro s hs e he f hf hes hfs + by_contra hef + obtain ⟨y, hy⟩ := (show f ∈ Γ.E from hf).1 + exact disjoint_left.mp (hdisj s e he f hf (Ne.symm hef)) (Or.inl hy) + (hfill s hs e he hes (hfs hy)) + · intro s hs e he hes v hvV hvs + have hfin := finite_R hS G + have hcl := closure_mono (hfill s hs e he hes) hvs + change v ∈ closure (e ∪ ⋃ p ∈ {p ∈ G.R | p ⊆ s ∧ ∃ a ∈ D.E, a ⊆ p ∧ a ⊆ e}, p) at hcl + have hpfin : {p ∈ G.R | p ⊆ s ∧ ∃ a ∈ D.E, a ⊆ p ∧ a ⊆ e}.Finite := + hfin.subset fun _ h => h.1 + rw [closure_union, hpfin.closure_biUnion _] at hcl + rcases hcl with h | h + · exact h + · obtain ⟨p, ⟨hp, -, a, ha, hap, hae⟩, hvp⟩ := mem_iUnion₂.mp h + exact closure_mono hae (hf₃' p hp a ha hap v (hDV.symm.subset hvV) hvp) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/PaintingFlat.lean b/LeanPool/GraphMinor/GM11/PaintingFlat.lean new file mode 100644 index 0000000000..cf50e14100 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PaintingFlat.lean @@ -0,0 +1,471 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section64b +public import LeanPool.GraphMinor.GM11.PaintingTwoCell + +/-! +# Claim (2) of (6.4) of Graph Minors XI, for paintings + +`exists_flat_painting` is `exists_flat_regions` for a painting. It runs on the drawing of the +boundaries of the cells, and +the drawing made from `Γ'` by adding stars in the cells. Only the regions of the painting enter the +cover, so only edges of +`Γ'` are used. + +`exists_oArc_of_null_painting` is claim (2) of (6.4). The closed set is the union of closed discs in +the cells that miss +the vertices of `A ∩ B` (`exists_disc_cut`). +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval Metric Filter Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- A closed disc has a closed sub-disc that misses a given finite part of its boundary, and that +includes all of +the disc outside an open set around that part. The sub-disc is the disc cut by a half-plane at each +point. -/ +theorem exists_disc_cut {Δ P O : Set S} (hΔ : IsClosedDisc Δ) (hP : P.Finite) (hPb : P ⊆ discBd Δ) + (hO : IsOpen O) + (hPO : P ⊆ O) : ∃ E, IsClosedDisc E ∧ E ⊆ Δ ∧ Disjoint E P ∧ Δ \ O ⊆ E := by + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + have hP' : (h '' P).Finite := hP.image h + -- Near each point of `P`, the chart stays in `O`. + have hnear : ∀ p ∈ h '' P, ∀ᶠ ε in 𝓝[>] (0 : ℝ), ∀ z ∈ closedBall (0 : ℂ) 1, ‖z - p‖ ^ 2 ≤ 2 * ε + → g z ∈ O := by + rintro _ ⟨x, hx, rfl⟩ + have hxΔ : x ∈ Δ := discBd_subset _ (hPb hx) + have hhx : h x ∈ closedBall (0 : ℂ) 1 := c.hm hxΔ + have hcont := c.gc (h x) hhx + have hmem : O ∈ 𝓝 (g (h x)) := hO.mem_nhds (by rw [c.gh hxΔ]; exact hPO hx) + obtain ⟨δ, hδ, hball⟩ := Metric.mem_nhdsWithin_iff.mp (hcont hmem) + have hpos : 0 < δ ^ 2 / 4 := by positivity + filter_upwards [Ioo_mem_nhdsGT hpos] with ε hε z hz hle + refine hball ⟨?_, hz⟩ + have h₁ : ‖z - h x‖ ^ 2 < δ ^ 2 := by nlinarith [hε.2] + have h₂ : ‖z - h x‖ < δ := lt_of_pow_lt_pow_left₀ 2 hδ.le h₁ + rwa [mem_ball, dist_eq_norm] + have hall := (Set.Finite.eventually_all hP').mpr hnear + obtain ⟨ε, hε, hεlt⟩ := (hall.and (Ioo_mem_nhdsGT (show (0 : ℝ) < 1 / 2 by norm_num))).exists + have hε₀ : 0 < ε := hεlt.1 + have hε₁ : ε < 1 / 2 := hεlt.2 + let K : Set ℂ := closedBall 0 1 ∩ ⋂ p ∈ h '' P, {z | (z * (starRingEnd ℂ) p).re ≤ 1 - ε} + have hpn : ∀ p ∈ h '' P, ‖p‖ = 1 := by + rintro _ ⟨x, hx, rfl⟩ + have : h x ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem h (hPb hx) + simpa using this + have hre : ∀ z p : ℂ, ‖z - p‖ ^ 2 = ‖z‖ ^ 2 + ‖p‖ ^ 2 - 2 * (z * (starRingEnd ℂ) p).re := by + intro z p + rw [← Complex.normSq_eq_norm_sq, ← Complex.normSq_eq_norm_sq, ← Complex.normSq_eq_norm_sq, + Complex.normSq_sub] + have hKcv : Convex ℝ K := by + refine (convex_closedBall _ _).inter (convex_iInter₂ fun p _ => ?_) + intro x hx y hy a b ha hb hab + simp only [mem_ofPred_eq, Complex.real_smul] at hx hy ⊢ + have e : ((a : ℂ) * x + (b : ℂ) * y) * (starRingEnd ℂ) p = (a : ℂ) * (x * (starRingEnd ℂ) p) + + (b : ℂ) * (y * (starRingEnd ℂ) p) := by ring + rw [e, Complex.add_re, Complex.re_ofReal_mul, Complex.re_ofReal_mul] + nlinarith + have hKcl : IsClosed K := by + refine isClosed_closedBall.inter (isClosed_biInter fun p _ => ?_) + exact isClosed_le (by fun_prop) continuous_const + have hKb : Bornology.IsBounded K := isBounded_closedBall.subset inter_subset_left + have hball : ball (0 : ℂ) (1 / 2) ⊆ K := fun z hz => by + have hz' : ‖z‖ < 1 / 2 := by simpa using hz + refine ⟨?_, mem_iInter₂.mpr fun p hp => ?_⟩ + · simp only [mem_closedBall, dist_zero_right] + linarith + have h₁ : (z * (starRingEnd ℂ) p).re ≤ ‖z * (starRingEnd ℂ) p‖ := Complex.re_le_norm _ + rw [norm_mul, RCLike.norm_conj, hpn p hp, mul_one] at h₁ + change _ ≤ _ + linarith + have hKint : (interior K).Nonempty := ⟨0, mem_interior.mpr ⟨_, hball, isOpen_ball, by simp⟩⟩ + obtain ⟨hKd, -⟩ := isClosedDisc_of_convex hKcv hKint hKb hKcl + refine ⟨g '' K, (c.disc_g inter_subset_left hKd).1, ?_, ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact c.gm hz.1 + · refine disjoint_left.mpr ?_ + rintro _ ⟨z, hz, rfl⟩ hzP + have hpm : h (g z) ∈ h '' P := mem_image_of_mem h hzP + rw [c.hg hz.1] at hpm + have h₁ := mem_iInter₂.mp hz.2 z hpm + have h₂ := hre z z + rw [sub_self, norm_zero, hpn z hpm] at h₂ + change _ ≤ _ at h₁ + nlinarith + · rintro x ⟨hxΔ, hxO⟩ + refine ⟨h x, ⟨c.hm hxΔ, mem_iInter₂.mpr fun p hp => ?_⟩, c.gh hxΔ⟩ + change _ ≤ _ + by_contra hlt + have hn : ‖h x‖ ≤ 1 := by simpa using c.hm hxΔ + have h₁ := hre (h x) p + rw [hpn p hp] at h₁ + refine hxO ?_ + have hsq : ‖h x‖ ^ 2 ≤ 1 := by nlinarith [norm_nonneg (h x)] + rw [one_pow] at h₁ + have h₂ := hε p hp (h x) (c.hm hxΔ) (by push Not at hlt; linarith) + rwa [c.gh hxΔ] at h₂ + + +/-- A drawing whose point set is a finite family of `O`-arcs that meet only in a finite set `V₀`. -/ +theorem exists_drawing_on_oArcs (_hS : IsClosedSurface S) {ι : Type*} {I₀ : Set ι} + (hI : I₀.Finite) {F : ι → Set S} + {V₀ : Set S} (hfin : V₀.Finite) (hF : ∀ i ∈ I₀, IsOArc (F i)) (hne : ∀ i ∈ I₀, + (V₀ ∩ F i).Nonempty) + (hmeet : ∀ i ∈ I₀, ∀ j ∈ I₀, i ≠ j → F i ∩ F j ⊆ V₀) : + ∃ D : Drawing S, D.U = V₀ ∪ ⋃ i ∈ I₀, F i ∧ D.V = V₀ := by + classical + have key : ∀ T : Finset ι, (∀ e ∈ T, e ∈ I₀) → + ∃ D : Drawing S, D.U = V₀ ∪ ⋃ e ∈ T, F e ∧ D.V = V₀ := by + intro T + induction T using Finset.induction_on with + | empty => + intro _ + exact ⟨pointsDrawing hfin, by simp [pointsDrawing], rfl⟩ + | insert e T he ih => + intro hT + obtain ⟨D, hU', hV'⟩ := ih fun f hf => hT f (Finset.mem_insert_of_mem hf) + have hee := hT e (Finset.mem_insert_self _ _) + obtain ⟨C, hCU, hCV⟩ := exists_drawing_on_oArc (hF e hee) (hfin.inter_of_left _) + (hne e hee) inter_subset_right + have hmeet' : D.U ∩ C.U ⊆ D.V ∩ C.V := by + rw [hU', hV', hCU, hCV] + rintro x ⟨hx | hx, hxb⟩ + · exact ⟨hx, hx, hxb⟩ + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + have hfe : e ≠ f := fun h => he (h ▸ hf) + have hxV := hmeet e hee f (hT f (Finset.mem_insert_of_mem hf)) hfe ⟨hxb, hxf⟩ + exact ⟨hxV, hxV, hxb⟩ + refine ⟨D.glue C hmeet', ?_, ?_⟩ + · change D.U ∪ C.U = _ + rw [hU', hCU] + ext x + simp only [mem_union, mem_iUnion, Finset.mem_insert, exists_prop] + constructor + · rintro ((h | ⟨f, hf, h⟩) | h) + · exact Or.inl h + · exact Or.inr ⟨f, Or.inr hf, h⟩ + · exact Or.inr ⟨e, Or.inl rfl, h⟩ + · rintro (h | ⟨f, rfl | hf, h⟩) + · exact Or.inl (Or.inl h) + · exact Or.inr h + · exact Or.inl (Or.inr ⟨f, hf, h⟩) + · change D.V ∪ C.V = V₀ + rw [hV', hCV] + exact union_eq_left.mpr inter_subset_left + obtain ⟨D, hD, hV⟩ := key hI.toFinset fun e he => hI.mem_toFinset.mp he + refine ⟨D, ?_, hV⟩ + rw [hD] + simp only [hI.mem_toFinset] + +variable [ConnectedSpace S] {Γ : Painting S} {Γ' : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + +/-- A 2-cell painting with a cell that has no vertex is in a sphere. -/ +theorem sphere_of_free_cell (hS : IsClosedSurface S) + (hrad : PreRad (PaintingOrDrawing.painting Γ) Γ') {e : Set S} (he : e ∈ Γ.E) + (hfree : closure e ∩ Γ.V = ∅) : IsSphere S := + (free_cell_disc_cover hS hrad he hfree).1 + +/-- A cell of a 2-cell painting in a surface other than a sphere has a vertex. -/ +theorem cell_has_vertex (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + (hrad : PreRad (PaintingOrDrawing.painting Γ) Γ') {e : Set S} (he : e ∈ Γ.E) : + (closure e ∩ Γ.V).Nonempty := by + by_contra h + exact hns (sphere_of_free_cell hS hrad he (not_nonempty_iff_eq_empty.mp h)) + +/-- The drawing `D` of the boundaries of the cells of a painting, and the radial drawing `G` of `D` +made from `Γ'` by +adding stars in the cells. -/ +theorem exists_cell_drawings (hS : IsClosedSurface S) (hrad : (PaintingOrDrawing.painting + Γ).IsRadialDrawing Γ') + (hE : Γ.E.Nonempty) (hv : ∀ e ∈ Γ.E, (closure e ∩ Γ.V).Nonempty) : + ∃ D G : Drawing S, D.U = Γ.V ∪ (⋃ e ∈ Γ.E, discBd (closure e)) ∧ D.V = Γ.V ∧ D.R + = Γ.R ∪ cellInt '' Γ.E ∧ + (PaintingOrDrawing.drawing D).IsRadialDrawing G ∧ D.E.Nonempty ∧ Γ'.IsSubdrawing G ∧ + G.U ⊆ Γ'.U ∪ Γ.U ∧ (∀ h ∈ G.E, ∀ r ∈ Γ.R, h ⊆ r → h ∈ Γ'.E) ∧ ∀ x ∈ G.V, x ∉ Γ.U → x ∈ Γ'.V + := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hpre : PreRad (PaintingOrDrawing.painting Γ) Γ' := ⟨hrad.1, hrad.2.1⟩ + have hmax : RadMax (PaintingOrDrawing.painting Γ) Γ' := hrad.2.2 + obtain ⟨e₀, he₀⟩ := hE + obtain ⟨y₀, -⟩ := he₀.1 + have hneS : Nonempty S := ⟨y₀⟩ + have hU : IsClosed Γ.U := cell_isClosed_U hpre + obtain ⟨c, K, hst⟩ := exists_cellStars (Γ := Γ) + obtain ⟨G, hG⟩ := exists_star_drawing hpre hst hS + have hbd : ∀ e ∈ Γ.E, Γ.V ∩ closure e ⊆ discBd (closure e) := fun e he x hx => + Cell.closure_inter_V_subset hS he ⟨hx.2, hx.1⟩ + obtain ⟨D, hDU, hDV⟩ := exists_boundary_drawing hS hU Γ.finite_V Subset.rfl fun e he => by + obtain ⟨x, hx, hxV⟩ := hv e he + exact ⟨x, hxV, hbd e he ⟨hxV, hx⟩⟩ + have hDR : D.R = Γ.R ∪ cellInt '' Γ.E := + boundary_R hS hrad.1.2 Subset.rfl Γ.V_subset_U hbd hDU + have hGrad := radial_of_stars hpre hst hS hG hDU hDV hv hmax hDR + have hedge : ∀ x ∈ D.U, x ∉ D.V → ∃ a ∈ D.E, x ∈ a := fun x hx hn => + exists_mem_arcComponent ⟨hx, hn⟩ + have hDE : D.E.Nonempty := by + have hinf := infinite_of_isOArc (Cell.isClosedDisc_closure he₀).isOArc_discBd + obtain ⟨x, hx, hn⟩ := hinf.exists_notMem_finite Γ.finite_V + have hxD : x ∈ D.U := by + rw [hDU] + exact Or.inr (mem_iUnion₂.mpr ⟨e₀, he₀, hx⟩) + obtain ⟨a, ha, -⟩ := hedge x hxD (hDV ▸ hn) + exact ⟨a, ha⟩ + have hoff : ∀ {a x}, a ∈ Γ.R → x ∈ a → x ∉ Γ.U := by + rintro a x ⟨y, -, rfl⟩ hx + exact (connectedComponentIn_subset _ _ hx).2 + have hsub : Γ'.IsSubdrawing G := ⟨fun x hx => hG.V ▸ Or.inl hx, fun e he => by + have : e ∈ G.E := hG.E ▸ Or.inl he + exact this⟩ + have hstarU : G.U ⊆ Γ'.U ∪ Γ.U := by + rw [hG.U] + refine union_subset_union_right _ (iUnion₂_subset fun t ht => ?_) + have hb := Cell.closure_inter_V_subset hS ht.1 ⟨ht.2.2, ht.2.1⟩ + exact (star_subset_closure hst ht.1 hb).trans (closure_subset_cell_U hpre ht.1) + refine ⟨D, G, hDU, hDV, hDR, hGrad, hDE, hsub, hstarU, ?_, ?_⟩ + · intro h hh r hr hhr + have hh' : h ∈ G.E := hh + rw [hG.E] at hh' + rcases hh' with h₁ | ⟨t, ht, rfl⟩ + · exact h₁ + · exfalso + obtain ⟨y, hy⟩ := (show _ ∈ G.E from hh).1 + have hb := Cell.closure_inter_V_subset hS ht.1 ⟨ht.2.2, ht.2.1⟩ + exact hoff hr (hhr hy) (closure_subset_cell_U hpre ht.1 (star_subset_closure hst ht.1 hb + hy.1)) + · intro x hxV hxU + have hxV' : x ∈ G.V := hxV + rw [hG.V] at hxV' + rcases hxV' with h₁ | ⟨t, ht, rfl⟩ + · exact h₁ + · exact absurd (closure_subset_cell_U hpre ht.1 (hst.hub t.1 ht.1).1) hxU + +/-- `exists_flat_regions` for a painting. -/ +theorem exists_flat_painting (hS : IsClosedSurface S) (hrad : (PaintingOrDrawing.painting + Γ).IsRadialDrawing Γ') + (hE : Γ.E.Nonempty) (hv : ∀ e ∈ Γ.E, (closure e ∩ Γ.V).Nonempty) (hθ : 1 ≤ θ) + (hnull : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < 2 * θ + → IsNullHomotopicOArc C.U) + {S₀ : Set S} (hS₀V : S₀ ⊆ Γ.V) (hS₀f : S₀.Finite) (hord : S₀.ncard < θ) : + ∃ D : S → Set S, (∀ s ∈ S₀, IsOpen (D s)) ∧ (∀ s ∈ S₀, s ∈ D s) ∧ + Flat ((⋃ r ∈ Γ.R, r) ∪ ⋃ s ∈ S₀, D s) := by + obtain ⟨D, G, -, hDV, hDR, hGrad, hDE, hsub, -, hh₁, hh₂⟩ := exists_cell_drawings hS hrad hE hv + have hoff : ∀ {a x}, a ∈ Γ.R → x ∈ a → x ∉ Γ.U := by + rintro a x ⟨y, -, rfl⟩ hx + exact (connectedComponentIn_subset _ _ hx).2 + exact exists_flat_regions_of_sub (Γ := D) (Γ' := G) hS hDE hGrad hθ hsub + (hDR ▸ subset_union_left) hh₁ + (fun r hr x hx hxV => hh₂ x hxV (hoff hr hx)) hnull (hDV ▸ hS₀V) (hS₀V.trans hrad.2.1.2.1) hS₀f + hord + +omit [ConnectedSpace S] in +/-- A painting with a cell does not fill the surface. -/ +theorem exists_notMem_painting_U (hS : IsClosedSurface S) (hrad : PreRad + (PaintingOrDrawing.painting Γ) Γ') + (hE : Γ.E.Nonempty) : ∃ y, y ∉ Γ.U := by + classical + have hU : IsClosed Γ.U := cell_isClosed_U hrad + obtain ⟨e, he⟩ := hE + have hd := Cell.isClosedDisc_closure he + obtain ⟨b, hb, hbV⟩ := (infinite_of_isOArc hd.isOArc_discBd).exists_notMem_finite Γ.finite_V + have hfe : Γ.E.Finite := Γ.finite_edges + let W : Set S := (Γ.V ∪ ⋃ f ∈ Γ.E \ {e}, closure f)ᶜ + have hW : IsOpen W := (Γ.finite_V.isClosed.union ((hfe.subset sdiff_subset).isClosed_biUnion + fun _ _ => isClosed_closure)).isOpen_compl + have hbW : b ∈ W := by + rintro (h | h) + · exact hbV h + · obtain ⟨f, hf, hbf⟩ := mem_iUnion₂.mp h + exact hbV (Cell.closure_inter_subset_V hS hU he hf.1 (Ne.symm hf.2) ⟨discBd_subset _ hb, hbf⟩) + have hbf : b ∈ closure (closure e)ᶜ := by + have : b ∈ frontier (closure e) := by + rw [IsClosedDisc.frontier_eq_discBd hS hd] + exact hb + exact (frontier_eq_closure_inter_closure.subset this).2 + obtain ⟨y, hyW, hye⟩ := mem_closure_iff.mp hbf W hW hbW + refine ⟨y, fun hyU => ?_⟩ + rcases Cell.mem_V_or_cell Γ hyU with h | ⟨f, hf, hyf⟩ + · exact hyW (Or.inl h) + · by_cases hfe' : f = e + · exact hye (subset_closure (hfe' ▸ hyf)) + · exact hyW (Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfe'⟩, subset_closure hyf⟩)) + +/-- **Claim (2) of (6.4)** (pages 90–91), for a painting. -/ +theorem exists_oArc_of_null_painting (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + (hE : Γ.E.Nonempty) + (hrad : (PaintingOrDrawing.painting Γ).IsRadialDrawing Γ') (hθ : 1 ≤ θ) + (hd : IsDerivedSlope (PaintingOrDrawing.painting Γ) Γ' θ T ins) {A B : Hypergraph S (Set S)} + (hsep : Γ.toHypergraph.IsSeparation A B) (hord : separationOrder A B < θ) + (hA : ∀ F : Set S, F ⊆ PaintingOrDrawing.underlying A → IsOArc F → IsNullHomotopicOArc F) : + ∃ F : Set S, IsOArc F ∧ F ⊆ PaintingOrDrawing.underlying B \ PaintingOrDrawing.underlying A ∧ + ¬ IsNullHomotopicOArc F := by + classical + by_contra hno + push Not at hno + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hpre : PreRad (PaintingOrDrawing.painting Γ) Γ' := ⟨hrad.1, hrad.2.1⟩ + have hU : IsClosed Γ.U := cell_isClosed_U hpre + have hnull : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < 2 * θ + → IsNullHomotopicOArc C.U := + fun C hC hCs hl => null_of_short hd hC hCs hl + have hS₀V : (A ∩ B).vertexSet ⊆ Γ.V := fun x hx => hsep.left_le.vertexSet_subset hx.1 + have hS₀f := (A ∩ B).vertexSet_finite + obtain ⟨D, hDo, hsD, hfl⟩ := exists_flat_painting hS hrad hE (fun e he + => cell_has_vertex hS hns hpre he) hθ hnull + hS₀V hS₀f hord + set S₀ : Set S := (A ∩ B).vertexSet with hS₀ + let O : Set S := ⋃ s ∈ S₀, D s + have hOo : IsOpen O := isOpen_biUnion hDo + have hex : ∀ e ∈ Γ.E, ∃ E, IsClosedDisc E ∧ E ⊆ closure e ∧ Disjoint E (S₀ ∩ closure e) + ∧ closure e \ O ⊆ E := + fun e he => exists_disc_cut (Cell.isClosedDisc_closure he) (hS₀f.inter_of_left _) + (fun x hx => Cell.closure_inter_V_subset hS he ⟨hx.2, hS₀V hx.1⟩) hOo + (fun x hx => mem_iUnion₂.mpr ⟨x, hx.1, hsD x hx.1⟩) + choose! E hEd hEs hEdis hEcov using hex + have hfe : Γ.E.Finite := Γ.finite_edges + have hEc : ∀ e ∈ Γ.E, IsClosed (E e) := fun e he => (IsClosedDisc.isCompact (hEd e he)).isClosed + have hbne : ∀ e ∈ Γ.E, (discBd (E e)).Nonempty := fun e he => (infinite_of_isOArc + (hEd e he).isOArc_discBd).nonempty + choose! b hb using hbne + let V₀ : Set S := (Γ.V \ S₀) ∪ b '' Γ.E + let Q : Set S := V₀ ∪ ⋃ e ∈ Γ.E, E e + have hV₀f : V₀.Finite := (Γ.finite_V.subset sdiff_subset).union (hfe.image b) + have hQc : IsClosed Q := hV₀f.isClosed.union (hfe.isClosed_biUnion hEc) + have hVoff : ∀ e ∈ Γ.E, ∀ x ∈ E e, x ∉ S₀ := fun e he x hx hxS => + disjoint_left.mp (hEdis e he) hx ⟨hxS, hEs e he hx⟩ + have hQU : Q ⊆ Γ.U \ S₀ := by + rintro x ((hx | ⟨e, he, rfl⟩) | hx) + · exact ⟨Γ.V_subset_U hx.1, hx.2⟩ + · have h₁ := discBd_subset _ (hb e he) + exact ⟨closure_subset_cell_U hpre he (hEs e he h₁), hVoff e he _ h₁⟩ + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact ⟨closure_subset_cell_U hpre he (hEs e he hxe), hVoff e he _ hxe⟩ + have hUQ : Γ.U \ Q ⊆ O := by + rintro x ⟨hxU, hxQ⟩ + rcases Cell.mem_V_or_cell Γ hxU with h | ⟨e, he, hxe⟩ + · have hxS : x ∈ S₀ := by + by_contra hn + exact hxQ (Or.inl (Or.inl ⟨h, hn⟩)) + exact mem_iUnion₂.mpr ⟨x, hxS, hsD x hxS⟩ + · by_contra hxO + exact hxQ (Or.inr (mem_iUnion₂.mpr ⟨e, he, hEcov e he ⟨subset_closure hxe, hxO⟩⟩)) + -- `Q` is nice. + obtain ⟨N, hNU, hNV⟩ := exists_drawing_on_oArcs hS hfe hV₀f (F := fun e => discBd (E e)) + (fun e he => (hEd e he).isOArc_discBd) + (fun e he => ⟨b e, Or.inr (mem_image_of_mem b he), hb e he⟩) (fun e he f hf hef x hx => by + have hxV := Cell.closure_inter_subset_V hS hU he hf hef + ⟨hEs e he (discBd_subset _ hx.1), hEs f hf (discBd_subset _ hx.2)⟩ + exact Or.inl ⟨hxV, hVoff e he x (discBd_subset _ hx.1)⟩) + have hQn : IsNice Q := by + refine ⟨N, isGammaNice_of_frontier (Drawing.IsSubdrawing.refl N) ?_ ?_⟩ + · rw [hNU] + refine union_subset subset_union_left (iUnion₂_subset fun e he => ?_) + exact (discBd_subset _).trans ((subset_biUnion_of_mem (u := E) he).trans subset_union_right) + · intro x hx + have hxQ : x ∈ Q := hQc.frontier_subset hx + rw [hNU] + rcases hxQ with h | h + · exact Or.inl h + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp h + by_cases hxb : x ∈ discBd (E e) + · exact Or.inr (mem_iUnion₂.mpr ⟨e, he, hxb⟩) + · exfalso + have hxi : x ∈ interior (E e) := by + rw [interior_eq_sdiff_discBd hS (hEd e he)] + exact ⟨hxe, hxb⟩ + exact hx.2 (interior_mono ((subset_biUnion_of_mem (u := E) he).trans subset_union_right) + hxi) + have hu : Q ≠ univ := fun h => by + obtain ⟨y, hy⟩ := exists_notMem_painting_U hS hpre hE + exact hy (hQU (h ▸ mem_univ y)).1 + have hcl : ∀ e ∈ (PaintingOrDrawing.painting Γ).E, closure e \ (PaintingOrDrawing.painting Γ).V ⊆ + e := fun e he => + (Cell.closure_sdiff_V hS hU he).subset + have hAc := isClosed_underlying (Γ := PaintingOrDrawing.painting Γ) hcl hsep.left_le + have hBc := isClosed_underlying (Γ := PaintingOrDrawing.painting Γ) hcl hsep.right_le + have hcov := U_subset_underlying (Γ := PaintingOrDrawing.painting Γ) (fun x hx hxV => + (Cell.mem_V_or_cell Γ hx).resolve_left hxV) hsep + have hint := underlying_inter (Γ := PaintingOrDrawing.painting Γ) + (fun e he f hf x hxe hxf => arcComponent_eq he hf hxe hxf) (fun e he x hx => (he.2.1 hx).2) hsep + obtain ⟨Δ, hΔ, -, hQΔ⟩ := theorem_7_5_proof hS hQc hQn hu finite_empty + (disjoint_empty _) fun F hFQ hF => by + rw [sdiff_empty] + have hFA : F ⊆ PaintingOrDrawing.underlying A ∪ PaintingOrDrawing.underlying B := fun x hx => + hcov (hQU (hFQ hx)).1 + by_cases hFa : F ⊆ PaintingOrDrawing.underlying A + · exact hA F hFa hF + · refine hno F hF fun x hx => ?_ + have hFB : F ⊆ PaintingOrDrawing.underlying B := by + obtain ⟨a, ha, haA⟩ := not_subset.mp hFa + by_contra hFb + obtain ⟨c, hc, hcB⟩ := not_subset.mp hFb + obtain ⟨z, hzF, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp hF.isPreconnected _ _ hAc hBc hFA + ⟨c, hc, (hFA hc).resolve_right hcB⟩ ⟨a, ha, (hFA ha).resolve_left haA⟩ + exact (hQU (hFQ hzF)).2 (hint ⟨hz₁, hz₂⟩) + refine ⟨hFB hx, fun hxA => ?_⟩ + exact (hQU (hFQ hx)).2 (hint ⟨hxA, hFB hx⟩) + refine not_flat_compl_disc hS hns hΔ (fun x hx => ?_) hfl + have hxQ : x ∉ Q := fun h => hx (hQΔ h) + by_cases hxU : x ∈ Γ.U + · exact Or.inr (hUQ ⟨hxU, hxQ⟩) + · exact Or.inl (mem_iUnion₂.mpr ⟨_, ⟨x, ⟨trivial, hxU⟩, rfl⟩, mem_connectedComponentIn ⟨trivial, + hxU⟩⟩) + +section Any + +variable {Γ : PaintingOrDrawing S} + +omit [T2Space S] [ConnectedSpace S] in +/-- A point off `U(Γ)` lies in a region of `Γ`. -/ +theorem exists_mem_region {x : S} (hx : x ∉ Γ.U) : ∃ r ∈ Γ.R, x ∈ r := by + cases Γ with + | painting Γ => exact ⟨_, ⟨x, ⟨trivial, hx⟩, rfl⟩, mem_connectedComponentIn ⟨trivial, hx⟩⟩ + | drawing Γ => exact exists_region_of_notMem hx + +/-- `exists_flat_regions`, for a painting or drawing in a surface other than a sphere. -/ +theorem exists_flat_of_not_sphere (hS : IsClosedSurface S) (hns : ¬ IsSphere S) (hE : Γ.E.Nonempty) + (hrad : Γ.IsRadialDrawing Γ') (hθ : 1 ≤ θ) + (hnull : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < 2 * θ + → IsNullHomotopicOArc C.U) + {S₀ : Set S} (hS₀V : S₀ ⊆ Γ.V) (hS₀f : S₀.Finite) (hord : S₀.ncard < θ) : + ∃ D : S → Set S, (∀ s ∈ S₀, IsOpen (D s)) ∧ (∀ s ∈ S₀, s ∈ D s) ∧ + Flat ((⋃ r ∈ Γ.R, r) ∪ ⋃ s ∈ S₀, D s) := by + cases Γ with + | painting Γ => + exact exists_flat_painting hS hrad hE (fun e he => cell_has_vertex hS hns ⟨hrad.1, + hrad.2.1⟩ he) hθ hnull hS₀V hS₀f + hord + | drawing Γ => exact exists_flat_regions hS hE hrad hθ hnull hS₀V hS₀f hord + +/-- **Claim (2) of (6.4)** (pages 90–91), for a painting or drawing. -/ +theorem exists_oArc_of_null_any (hS : IsClosedSurface S) (hns : ¬ IsSphere S) (hE : Γ.E.Nonempty) + (hrad : Γ.IsRadialDrawing Γ') (hθ : 1 ≤ θ) (hd : IsDerivedSlope Γ Γ' θ T ins) {A B : Hypergraph + S (Set S)} + (hsep : Γ.toHypergraph.IsSeparation A B) (hord : separationOrder A B < θ) + (hA : ∀ F : Set S, F ⊆ PaintingOrDrawing.underlying A → IsOArc F → IsNullHomotopicOArc F) : + ∃ F : Set S, IsOArc F ∧ F ⊆ PaintingOrDrawing.underlying B \ PaintingOrDrawing.underlying A ∧ + ¬ IsNullHomotopicOArc F := by + cases Γ with + | painting Γ => exact exists_oArc_of_null_painting hS hns hE hrad hθ hd hsep hord hA + | drawing Γ => exact exists_oArc_of_null hS hns hE hrad hθ hd hsep hord hA + +end Any + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/PaintingPerimeter.lean b/LeanPool/GraphMinor/GM11/PaintingPerimeter.lean new file mode 100644 index 0000000000..f4996d2eb9 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PaintingPerimeter.lean @@ -0,0 +1,373 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PaintingFlat +public import LeanPool.GraphMinor.GM11.PerimeterBound + +/-! +# The perimeter of a region of a radial drawing of a painting + +`two_mul_ends_le_painting` and `perimeterLength_le_cell` show that a region of a radial drawing of a +painting has perimeter +of length twice the number of ends of the cell in it. Graph Minors XI, proof of (6.5), page 92, uses +the first, and the +converse of (6.5) uses the second. + +For the second, let `D` be the drawing of the boundaries of the cells, and `G` the radial drawing of +`D` made from `Γ'` by +adding stars in the cells. The cell `e` in a region `s` of `Γ'` has as many boundary edges in `D` as +it has ends, and +each of these is a side of one face of `D ∪ G` in `s` outside `e`. Each such face has two sides in +`G`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- A circuit has at least as many vertices as edges. -/ +theorem length_le_ncard_V {C : Drawing S} (hC : C.IsCircuit) : C.length ≤ C.V.ncard := by + classical + obtain ⟨u, W, ⟨hnd, hed⟩, hpos, hCV, hCE⟩ := id hC + have hlen : C.length = W.length := by + rw [Drawing.length, hCE] + have h : {e | e ∈ W.edges} = (W.edges.toFinset : Set (Set S)) := by + ext x + simp + rw [h, ncard_coe_finset, List.toFinset_card_of_nodup hed] + rfl + have htail : W.support.tail.length = W.length := by + rw [List.length_tail, length_support] + rfl + have hsub : (W.support.tail.toFinset : Set S) ⊆ C.V := fun x hx => by + rw [hCV] + exact List.mem_of_mem_tail (by simpa using hx) + have := ncard_le_ncard hsub C.finite_V + rw [ncard_coe_finset, List.toFinset_card_of_nodup hnd, htail] at this + rwa [hlen] + +variable [ConnectedSpace S] {Γ : Painting S} {Γ' : Drawing S} + +omit [ConnectedSpace S] in +/-- A boundary point of a cell off the vertices is in the closure of a region of the painting. -/ +theorem exists_region_at_boundary (hS : IsClosedSurface S) (hrad : (PaintingOrDrawing.painting + Γ).IsRadialDrawing Γ') + (hR : Γ.R.Finite) {e : Set S} (he : e ∈ Γ.E) {y : S} (hy : y ∈ discBd (closure e)) + (hyV : y ∉ Γ.V) : + ∃ r ∈ Γ.R, y ∈ closure r := by + classical + have hpre : PreRad (PaintingOrDrawing.painting Γ) Γ' := ⟨hrad.1, hrad.2.1⟩ + have hU : IsClosed Γ.U := cell_isClosed_U hpre + have hd := Cell.isClosedDisc_closure he + have hfe : Γ.E.Finite := Γ.finite_edges + let W : Set S := (Γ.V ∪ ⋃ f ∈ Γ.E \ {e}, closure f)ᶜ + have hW : IsOpen W := (Γ.finite_V.isClosed.union ((hfe.subset sdiff_subset).isClosed_biUnion + fun _ _ => isClosed_closure)).isOpen_compl + have hbW : y ∈ W := by + rintro (h | h) + · exact hyV h + · obtain ⟨f, hf, hbf⟩ := mem_iUnion₂.mp h + exact hyV (Cell.closure_inter_subset_V hS hU he hf.1 (Ne.symm hf.2) ⟨discBd_subset _ hy, hbf⟩) + have hbf : y ∈ closure (closure e)ᶜ := by + have : y ∈ frontier (closure e) := by + rw [IsClosedDisc.frontier_eq_discBd hS hd] + exact hy + exact (frontier_eq_closure_inter_closure.subset this).2 + have hcl : y ∈ closure (⋃ r ∈ Γ.R, r) := by + refine mem_closure_iff.mpr fun O hO hyO => ?_ + obtain ⟨z, ⟨hzO, hzW⟩, hze⟩ := mem_closure_iff.mp hbf (O ∩ W) (hO.inter hW) ⟨hyO, hbW⟩ + refine ⟨z, hzO, ?_⟩ + have hzU : z ∉ Γ.U := fun hzU => by + rcases Cell.mem_V_or_cell Γ hzU with h | ⟨f, hf, hzf⟩ + · exact hzW (Or.inl h) + · by_cases hfe' : f = e + · exact hze (subset_closure (hfe' ▸ hzf)) + · exact hzW (Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfe'⟩, subset_closure hzf⟩)) + exact mem_iUnion₂.mpr ⟨_, ⟨z, ⟨trivial, hzU⟩, rfl⟩, mem_connectedComponentIn ⟨trivial, hzU⟩⟩ + rw [hR.closure_biUnion] at hcl + obtain ⟨r, hr, hyr⟩ := mem_iUnion₂.mp hcl + exact ⟨r, hr, hyr⟩ + +variable (hS : IsClosedSurface S) (hrad : (PaintingOrDrawing.painting Γ).IsRadialDrawing Γ') + (hE : Γ.E.Nonempty) + (hv : ∀ e ∈ Γ.E, (closure e ∩ Γ.V).Nonempty) + +include hS hrad hE hv + +/-- Each vertex of a painting with a cell at every point is an end of an edge of a radial drawing. +-/ +theorem exists_spoke_painting {v : S} (hvV : v ∈ Γ.V) : ∃ h ∈ Γ'.E, v ∈ closure h := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨D, G, hDU, hDV, hDR, hGrad, hDE, hsub, -, hh₁, hh₂⟩ := exists_cell_drawings hS hrad hE hv + have hGpre : PreRad (PaintingOrDrawing.drawing D) G := ⟨hGrad.1, hGrad.2.1⟩ + have hvD : v ∈ D.V := hDV ▸ hvV + obtain ⟨a, ha, hva⟩ := exists_edge_at hGpre hS hDE hvD + obtain ⟨y, hy⟩ := ha.1 + have hyU := (ha.2.1 hy) + have hyV : y ∉ Γ.V := fun h => hyU.2 (hDV ▸ h) + have hR : Γ.R.Finite := (finite_R hS D).subset (hDR ▸ subset_union_left) + rw [hDU] at hyU + obtain ⟨f, hf, hyf⟩ : ∃ f ∈ Γ.E, y ∈ discBd (closure f) := by + rcases hyU.1 with h | h + · exact absurd h hyV + · obtain ⟨f, hf, h'⟩ := mem_iUnion₂.mp h + exact ⟨f, hf, h'⟩ + obtain ⟨r, hr, hyr⟩ := exists_region_at_boundary (Γ' := Γ') hS hrad hR hf hyf hyV + have hrD : r ∈ D.R := hDR ▸ Or.inl hr + have har : a ⊆ closure r := edge_subset_closure_of_incident hS ha hrD ⟨y, hy, hyr⟩ + have hvr : v ∈ closure r := closure_minimal har isClosed_closure hva + obtain ⟨c, ⟨hc, hcV⟩, -⟩ := hGrad.2.1.2.2.1 r hrD + obtain ⟨h, hh, hcap⟩ := exists_spoke_at hGpre hGrad.2.2 hS hDE hrD hc hcV hvD hvr + obtain ⟨v', hv', r₁, hr₁, w, hw, hwV, hcap', hsubr⟩ := spoke_ends hGpre hS hh + have hcc : c ∈ closure h ∩ G.V := by rw [hcap]; simp + rw [hcap'] at hcc + have hcw : c = w := by + rcases hcc with h' | h' + · exact absurd (h' ▸ hv') fun h'' => region_subset hrD hc (D.V_subset_U h'') + · exact h' + obtain rfl : r₁ = r := region_eq_of_mem hr₁ hrD (hcw ▸ hw) hc + have hvh : v ∈ closure h ∩ G.V := by rw [hcap]; simp + exact ⟨h, hh₁ h hh r₁ hr hsubr, hvh.1⟩ + +/-- **Graph Minors XI, proof of (6.5)** (page 92), for a painting: "the perimeter of $r$ has length +at least twice the number of ends of $e$". -/ +theorem two_mul_ends_le_painting {s : Set S} (hs : s ∈ Γ'.R) : 2 * (Γ.V ∩ closure s).ncard + ≤ perimeterLength Γ' s := + two_mul_ncard_le_perimeter hS (two_ends_of_preRadial hrad.2.1) Γ.finite_V hrad.2.1.2.1 hs + (end_unique_of_preRadial hrad.2.1) fun _ hx => exists_spoke_painting hS hrad hE hv hx.1 + +omit hS hrad hE hv in +omit [T2Space S] [ConnectedSpace S] in +/-- The weight of an edge `h` in a region `s` of `Γ'` is at most its total weight in the regions of +`G` inside `s`. +If `h` has `s` on both sides, the two sides are one region of `G` on both sides, or two regions of +`G`. -/ +theorem perimN_le_sum {G : Drawing S} (hGs : Γ'.IsSubdrawing G) (hS : IsClosedSurface S) {s h p₀ : + Set S} + {P : Finset (Set S)} (hP : ∀ p, p ∈ P ↔ p ∈ G.R ∧ p ⊆ s) (hh' : h ∈ Γ'.E) (hp₀ : p₀ ∈ P) + (hh₀ : h ⊆ closure p₀) : + open Classical in + perimN Γ' s h ≤ ∑ p ∈ P, if h ⊆ closure p then perimN G p h else 0 := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hh : h ∈ G.E := hGs.2 hh' + have hone : 1 ≤ perimN G p₀ h := one_le_perimN _ _ + have hle₀ : perimN G p₀ h ≤ ∑ p ∈ P, if h ⊆ closure p then perimN G p h else 0 := by + have := Finset.single_le_sum (f := fun p => if h ⊆ closure p then perimN G p h else 0) + (fun _ _ => Nat.zero_le _) hp₀ + simpa only [ite_eq_left hh₀] using this + unfold perimN at hone hle₀ ⊢ + by_cases hG : ∃ r' ∈ G.R, r' ≠ p₀ ∧ G.EdgeRegionIncident h r' + · obtain ⟨r', hr', hne, hinc⟩ := hG + by_cases hΓ : ∃ r' ∈ Γ'.R, r' ≠ s ∧ Γ'.EdgeRegionIncident h r' + · rw [ite_eq_left hΓ] + exact hone.trans hle₀ + · rw [ite_eq_right hΓ] + obtain ⟨x, hx⟩ := region_nonempty hr' + have hxU : x ∉ Γ'.U := fun h' => region_subset hr' hx (hGs.U_subset h') + obtain ⟨r'', hr'', hxr''⟩ := exists_region_of_notMem hxU + have hsub : r' ⊆ r'' := subset_region hr'' (region_isPreconnected hr') + (disjoint_left.mpr fun z hz h' => region_subset hr' hz (hGs.U_subset h')) hx hxr'' + have heq : r'' = s := by + by_contra hn + obtain ⟨y, hy, hyc⟩ := hinc.2.2 + exact hΓ ⟨r'', hr'', hn, hh', hr'', y, hy, closure_mono hsub hyc⟩ + have hr'P : r' ∈ P := (hP r').mpr ⟨hr', heq ▸ hsub⟩ + have hcl : h ⊆ closure r' := edge_subset_closure_of_incident hS hh hr' hinc.2.2 + have hsum := Finset.sum_le_sum_of_subset (f := fun p => if h ⊆ closure p then + (if ∃ r' ∈ G.R, r' ≠ p ∧ G.EdgeRegionIncident h r' then 1 else 2) else 0) + (show ({p₀, r'} : Finset (Set S)) ⊆ P from by + intro q hq + rcases Finset.mem_insert.mp hq with rfl | hq + · exact hp₀ + · rw [Finset.mem_singleton.mp hq] + exact hr'P) + rw [Finset.sum_pair (Ne.symm hne)] at hsum + simp only [ite_eq_left hh₀, ite_eq_left hcl] at hsum + refine le_trans ?_ hsum + split_ifs <;> omega + · rw [ite_eq_right hG] at hle₀ + refine le_trans ?_ hle₀ + split_ifs <;> omega + +/-- **The perimeter of a region of `Γ'`**: at most twice the number of ends of the cell in it. Each +region of `G` in `s` +has perimeter of length at most 4, and the centre of the cell gives weight 2 of that from the star. +So the region +has weight at most 2 on the edges of `Γ'`, and there are at most as many such regions as sides of +the cell. -/ +theorem perimeterLength_le_painting {s e : Set S} (hs : s ∈ Γ'.R) (he : e ∈ Γ.E) (hes : e ⊆ s) : + perimeterLength Γ' s ≤ 2 * (Γ.V ∩ closure e).ncard := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hpre : PreRad (PaintingOrDrawing.painting Γ) Γ' := ⟨hrad.1, hrad.2.1⟩ + have hmax : RadMax (PaintingOrDrawing.painting Γ) Γ' := hrad.2.2 + obtain ⟨D, G, hDU, hDV, hDR, hGrad, hDE, hsub, hGU, -, -⟩ := exists_cell_drawings hS hrad hE hv + have hGpre : PreRad (PaintingOrDrawing.drawing D) G := ⟨hGrad.1, hGrad.2.1⟩ + have hGmax : RadMax (PaintingOrDrawing.drawing D) G := hGrad.2.2 + obtain ⟨hex, -, -⟩ := regionFacts_of_radial hGpre hS hGmax hDE + obtain ⟨-, huniq, -⟩ := regionFacts_of_painting hpre hmax hS hE + have hUc : IsClosed Γ.U := cell_isClosed_U hpre + have hRf : G.R.Finite := finite_R hS G + let P : Finset (Set S) := hRf.toFinset.filter (· ⊆ s) + have hP : ∀ p, p ∈ P ↔ p ∈ G.R ∧ p ⊆ s := fun p => by simp [P] + have hEd : ∀ {f}, f ∈ Γ.E → Disjoint f Γ'.U := fun {f} hf => disjoint_left.mpr fun x hx hxU => by + obtain ⟨-, hdis, hfU, -⟩ := (PaintingOrDrawing.painting Γ).edge_props hf + have : x ∈ Γ.V := hrad.2.1.1.subset ⟨hfU hx, hxU⟩ + exact disjoint_left.mp hdis hx this + -- An edge of `D` in `s` is on the boundary of `e`. + have hbd : ∀ {a}, a ∈ D.E → a ⊆ s → a ⊆ discBd (closure e) := fun {a} ha has y hy => by + have hyU : y ∈ D.U := ha.2.1 hy |>.1 + have hyV : y ∉ D.V := (ha.2.1 hy).2 + rw [hDU] at hyU + rcases hyU with h | h + · exact absurd (hDV ▸ h) hyV + · obtain ⟨f, hf, hyf⟩ := mem_iUnion₂.mp h + have hyc : y ∈ closure f := discBd_subset _ hyf + have hyf' : y ∈ f := by + rw [← Cell.closure_sdiff_V hS hUc hf] + exact ⟨hyc, fun h' => hyV (hDV ▸ h')⟩ + have hfs : f ⊆ s := subset_region hs ((PaintingOrDrawing.painting Γ).edge_props hf).1 + (hEd hf) hyf' (has hy) + rwa [huniq s hs e he f hf hes hfs] + -- The perimeter edges of `s`. + have hEf : (perimeter Γ' s).E.Finite := (perimeter Γ' s).finite_edges + have hlen : perimeterLength Γ' s = ∑ h ∈ hEf.toFinset, perimN Γ' s h := by + rw [perimeterLength, finsum_mem_eq_finite_toFinset_sum _ hEf] + rfl + -- Each perimeter edge of `s` is on the closure of a region of `G` in `s`. + have hcover : ∀ h ∈ hEf.toFinset, ∃ p ∈ P, h ⊆ closure p := fun h hh => by + obtain ⟨hhE, hhc⟩ := mem_interSet_E_iff.mp (hEf.mem_toFinset.mp hh) + obtain ⟨y, hy⟩ := hhE.1 + have hyU : y ∉ Γ.U := fun h' => + edge_notMem_V hhE hy (hrad.2.1.2.1 (hrad.2.1.1.subset ⟨h', hhE.2.1 hy |>.1⟩)) + have hclo : y ∈ closure (⋃ p ∈ P, p) := by + refine mem_closure_iff.mpr fun O hO hyO => ?_ + obtain ⟨z, ⟨hzO, hzU⟩, hzs⟩ := mem_closure_iff.mp (hhc hy) (O ∩ Γ.Uᶜ) + (hO.inter hUc.isOpen_compl) ⟨hyO, hyU⟩ + have hzG : z ∉ G.U := fun h' => (hGU h').elim (region_subset hs hzs) hzU + obtain ⟨p, hp, hzp⟩ := exists_region_of_notMem hzG + have hps : p ⊆ s := subset_region hs (region_isPreconnected hp) + (disjoint_left.mpr fun x hx h' => region_subset hp hx (hsub.U_subset h')) hzp hzs + exact ⟨z, hzO, mem_iUnion₂.mpr ⟨p, (hP p).mpr ⟨hp, hps⟩, hzp⟩⟩ + have hfin : ((P : Finset (Set S)) : Set (Set S)).Finite := P.finite_toSet + rw [show (⋃ p ∈ P, p) = ⋃ p ∈ (P : Set (Set S)), p from rfl, hfin.closure_biUnion] at hclo + obtain ⟨p, hp, hyp⟩ := mem_iUnion₂.mp hclo + have hp' := (hP p).mp hp + exact ⟨p, hp, edge_subset_closure_of_incident hS (hsub.2 hhE) hp'.1 ⟨y, hy, hyp⟩⟩ + -- The centre of `e` in `G`. + have hcell : cellInt e ∈ D.R := hDR ▸ Or.inr ⟨e, he, rfl⟩ + obtain ⟨c, ⟨hc, hcV⟩, -⟩ := hGrad.2.1.2.2.1 _ hcell + have hcU : c ∉ Γ'.U := fun hc' => by + have hcV' : c ∈ Γ.V := hrad.2.1.1.subset ⟨closure_subset_cell_U hpre he hc.1, hc'⟩ + exact hc.2 (Cell.closure_inter_V_subset hS he ⟨hc.1, hcV'⟩) + -- The centre is on the closure of each region of `G` in `s`, and has an edge there. + have hat : ∀ p ∈ P, c ∈ closure p ∧ ∃ f ∈ G.E, c ∈ closure f := fun p hp => by + obtain ⟨hpR, hps⟩ := (hP p).mp hp + obtain ⟨a, ha, hap⟩ := hex p hpR + obtain ⟨y, hy⟩ := ha.1 + have hyb := hbd ha (hap.trans hps) hy + have hyc : y ∈ closure (closure e \ discBd (closure e)) := + discBd_subset_closure (Cell.isClosedDisc_closure he) hyb + obtain ⟨z, hzp, hzi⟩ := mem_closure_iff.mp hyc p (region_isOpen hpR) (hap hy) + obtain ⟨p', hp', q', hq', -, -, -, hseq⟩ := region_eq_two_faces hGpre hS hGmax hDE hpR ha hap + have key : ∀ t ∈ (radialUnion hGpre).R, t ⊆ p → z ∈ t → c ∈ closure p + ∧ ∃ f ∈ G.E, c ∈ closure f := by + intro t ht htp hzt + obtain ⟨r, hr, htr⟩ := exists_region_of_sub hGpre ht + obtain rfl : r = cellInt e := region_eq_of_mem hr hcell (htr hzt) hzi + obtain ⟨f, -, hf, -, hft, -⟩ := hub_sides hGpre hS hGmax hDE hr ht htr + obtain ⟨v, -, r₁, hr₁, w, hw, hwV, hcap, hfr₁⟩ := spoke_ends hGpre hS hf + obtain ⟨x, hx⟩ := hf.1 + obtain ⟨u, hu₁, hu⟩ := mem_closure_iff.mp (closure_mono htr (hft hx)) r₁ (region_isOpen hr₁) + (hfr₁ hx) + obtain rfl : r₁ = cellInt e := region_eq_of_mem hr₁ hr hu₁ hu + have hwc : w = c := hub_unique hGpre hr hc hcV hw hwV + have hcf : c ∈ closure f ∩ G.V := by + rw [hcap, hwc] + simp + exact ⟨closure_mono htp (closure_minimal hft isClosed_closure hcf.1), f, hf, hcf.1⟩ + have hzs : z ∈ p' ∪ q' ∪ a := hseq ▸ hzp + rcases hzs with (h | h) | h + · exact key p' hp' (fun x hx => hseq ▸ Or.inl (Or.inl hx)) h + · exact key q' hq' (fun x hx => hseq ▸ Or.inl (Or.inr hx)) h + · exact absurd (hbd ha (hap.trans hps) h) hzi.2 + -- Each region of `G` in `s` has weight at most 2 on the perimeter edges of `s`. + have hweight : ∀ p ∈ P, ∑ h ∈ hEf.toFinset, (if h ⊆ closure p then perimN G p h else 0) ≤ 2 + := fun p hp => by + obtain ⟨hpR, hps⟩ := (hP p).mp hp + obtain ⟨hcp, f, hf, hcf⟩ := hat p hp + obtain ⟨T, hT, hT2⟩ := two_le_of_spoke hS (two_ends_of_preRadial hGrad.2.1) hpR hcV hcp hf hcf + have hEp : (perimeter G p).E.Finite := (perimeter G p).finite_edges + have hlenp : perimeterLength G p = ∑ h ∈ hEp.toFinset, perimN G p h := by + rw [perimeterLength, finsum_mem_eq_finite_toFinset_sum _ hEp] + rfl + have h4 := perimeterLength_le_four hGpre hS hGmax hDE hpR + rw [← Finset.sum_filter] + have hA : hEf.toFinset.filter (· ⊆ closure p) ⊆ hEp.toFinset := fun h hh => by + obtain ⟨h₁, h₂⟩ := Finset.mem_filter.mp hh + exact hEp.mem_toFinset.mpr (mem_interSet_E_iff.mpr + ⟨hsub.2 (mem_interSet_E_iff.mp (hEf.mem_toFinset.mp h₁)).1, h₂⟩) + have hTs : T ⊆ hEp.toFinset := fun h hh => + hEp.mem_toFinset.mpr (mem_interSet_E_iff.mpr ⟨(hT h hh).1, (hT h hh).2.1⟩) + have hdis : Disjoint (hEf.toFinset.filter (· ⊆ closure p)) T := Finset.disjoint_left.mpr fun h + h₁ h₂ => by + obtain ⟨h₃, -⟩ := Finset.mem_filter.mp h₁ + exact hcU (Γ'.closure_subset_U (mem_interSet_E_iff.mp (hEf.mem_toFinset.mp h₃)).1 + (hT h h₂).2.2) + have hsum := Finset.sum_le_sum_of_subset (f := perimN G p) (Finset.union_subset hA hTs) + rw [Finset.sum_union hdis] at hsum + omega + -- There are at most as many such regions as sides of `e`. + have hcount : P.card ≤ (Γ.V ∩ closure e).ncard := by + have hB := (Cell.isClosedDisc_closure he).isOArc_discBd + have hBU : discBd (closure e) ⊆ D.U := by + rw [hDU] + exact fun x hx => Or.inr (mem_iUnion₂.mpr ⟨e, he, hx⟩) + obtain ⟨C, hC, hCs, hCU⟩ := exists_circuit_of_oArc hB hBU + have hCf : C.E.Finite := C.finite_edges + have hle₁ : (Γ.V ∩ closure e).ncard ≥ C.V.ncard := by + refine ncard_le_ncard (fun x hx => ⟨hDV ▸ hCs.1 hx, ?_⟩) (Γ.finite_V.subset inter_subset_left) + exact discBd_subset _ (hCU ▸ C.V_subset_U hx) + have hle₂ : C.length ≤ C.V.ncard := length_le_ncard_V hC + choose! a ha hap using fun p (hp : p ∈ P) => hex p ((hP p).mp hp).1 + have hmem : ∀ p ∈ P, a p ∈ C.E := fun p hp => by + obtain ⟨y, hy⟩ := (ha p hp).1 + have hyb := hbd (ha p hp) ((hap p hp).trans ((hP p).mp hp).2) hy + have hyV : y ∉ C.V := fun h' => ((ha p hp).2.1 hy).2 (hCs.1 h') + obtain ⟨a', ha', hya'⟩ := exists_mem_arcComponent (show y ∈ C.U \ C.V from ⟨hCU ▸ hyb, hyV⟩) + have := arcComponent_eq (ha p hp) (hCs.2 ha') hy hya' + rwa [this] + have hinj : Set.InjOn a (P : Set (Set S)) := fun p hp q hq hpq => by + obtain ⟨y, hy⟩ := (ha p hp).1 + exact region_eq_of_mem ((hP p).mp hp).1 ((hP q).mp hq).1 (hap p hp hy) (hap q hq (hpq ▸ hy)) + have := Finset.card_le_card_of_injOn a (s := P) (t := hCf.toFinset) + (fun p hp => hCf.mem_toFinset.mpr (hmem p hp)) hinj + have hlenC : C.length = hCf.toFinset.card := by + rw [Drawing.length, ncard_eq_toFinset_card _ hCf] + omega + calc perimeterLength Γ' s = ∑ h ∈ hEf.toFinset, perimN Γ' s h := hlen + _ ≤ ∑ h ∈ hEf.toFinset, ∑ p ∈ P, (if h ⊆ closure p then perimN G p h else 0) + := Finset.sum_le_sum fun h hh => by + obtain ⟨p₀, hp₀, hh₀⟩ := hcover h hh + exact perimN_le_sum hsub hS hP (mem_interSet_E_iff.mp (hEf.mem_toFinset.mp hh)).1 hp₀ hh₀ + _ = ∑ p ∈ P, ∑ h ∈ hEf.toFinset, (if h ⊆ closure p then perimN G p h else 0) := Finset.sum_comm + _ ≤ ∑ p ∈ P, 2 := Finset.sum_le_sum hweight + _ = 2 * P.card := by rw [Finset.sum_const, smul_eq_mul, mul_comm] + _ ≤ 2 * (Γ.V ∩ closure e).ncard := Nat.mul_le_mul_left 2 hcount + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/PaintingRadial.lean b/LeanPool/GraphMinor/GM11/PaintingRadial.lean new file mode 100644 index 0000000000..8ff87651b6 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PaintingRadial.lean @@ -0,0 +1,497 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PaintingStars + +/-! +# A radial drawing of the boundary drawing of a painting + +Let `Γ` be a 2-cell painting in which each cell has a vertex, with radial drawing `Γ'`, and let `G` +be +`Γ'` with stars in the cells. Then `G` is a radial drawing of the drawing `D` of the boundaries of +the +cells (`radial_of_stars`). +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + {Γ : Painting S} {Γ' G D : Drawing S} {c : Set S → S} {K : Set S → S → Set S} + (hrad : PreRad (PaintingOrDrawing.painting Γ) Γ') (hst : CellStars Γ c K) + (hS : IsClosedSurface S) (hG : IsStarDrawing Γ Γ' c K G) + (hDU : D.U = Γ.V ∪ ⋃ e ∈ Γ.E, discBd (closure e)) + (hDV : D.V = Γ.V) (hv : ∀ e ∈ Γ.E, (closure e ∩ Γ.V).Nonempty) + +omit [T2Space S] in +/-- The drawing `D` of the boundaries of the cells is 2-cell. -/ +theorem boundary_twoCell (hS : IsClosedSurface S) (hP : ∀ r ∈ Γ.R, IsOpenDisc r) [ConnectedSpace S] + (hDR : D.R = Γ.R ∪ cellInt '' Γ.E) : (PaintingOrDrawing.drawing D).IsTwoCell := by + refine ⟨inferInstance, ?_⟩ + intro r hr + have hr' : r ∈ D.R := hr + rw [hDR] at hr' + rcases hr' with h | ⟨e, he, rfl⟩ + · exact hP r h + · exact isOpenDisc_interior hS (Cell.isClosedDisc_closure he) + +include hrad hst hS hG + +omit hG [T2Space S] in +theorem hub_notMem_U' {e : Set S} (he : e ∈ Γ.E) : c e ∉ Γ'.U := fun h => + hub_notMem_V hst hS he ((show Γ.U ∩ Γ'.U = Γ.V from hrad.2.1) ▸ + ⟨cellInt_subset_U hrad he (hst.hub e he), h⟩) + +omit hS hrad hst [T2Space S] in +theorem G_V_cases {x : S} (hx : x ∈ G.V) : x ∈ Γ'.V ∨ ∃ e ∈ Γ.E, x = c e := by + rw [hG.V] at hx + rcases hx with h | ⟨t, ht, rfl⟩ + · exact Or.inl h + · exact Or.inr ⟨t.1, ht.1, rfl⟩ + +omit hrad hG in +theorem star_closure {t : Set S × S} (ht : t ∈ cellPairs Γ) : + closure (K t.1 t.2 \ {c t.1, t.2}) = K t.1 t.2 := + closure_sdiff_pair (hst.line _ ht.1 _ (Cell.closure_inter_V_subset hS ht.1 ⟨ht.2.2, ht.2.1⟩)) + +omit [T2Space S] in +/-- A line of a star meets the vertices of `G` in its ends. -/ +theorem star_inter_V {t : Set S × S} (ht : t ∈ cellPairs Γ) : + K t.1 t.2 ∩ G.V = {t.2, c t.1} := by + have hb : t.2 ∈ discBd (closure t.1) := Cell.closure_inter_V_subset hS ht.1 ⟨ht.2.2, ht.2.1⟩ + obtain ⟨f, h0, h1⟩ := hst.line t.1 ht.1 t.2 hb + apply subset_antisymm + · rintro x ⟨hx, hxG⟩ + by_cases hxb : x = t.2 + · exact Or.inl hxb + refine Or.inr ?_ + have hxint := hst.sub _ ht.1 _ hb ⟨hx, hxb⟩ + rcases G_V_cases hG hxG with h | ⟨e, he, rfl⟩ + · exact (hxb (star_inter_U hrad hst hS ht hx (Γ'.V_subset_U h))).elim + · by_cases hee : e = t.1 + · rw [hee] + rfl + · exact (disjoint_left.mp (cellInt_disjoint hrad hS he ht.1 hee) (hst.hub e he) hxint.1).elim + · rintro x (rfl | rfl) + · refine ⟨by have := (f 1).2; rwa [h1] at this, ?_⟩ + rw [hG.V] + exact Or.inl (hrad.2.2.1 ht.2.1) + · refine ⟨by have := (f 0).2; rwa [h0] at this, ?_⟩ + rw [hG.V] + exact Or.inr ⟨t, ht, rfl⟩ + +omit [T2Space S] in +/-- An edge of `Γ'` has the same vertices in `G` as in `Γ'`. -/ +theorem closure_inter_G_V {e : Set S} (he : e ∈ Γ'.E) : closure e ∩ G.V = closure e ∩ Γ'.V := by + apply subset_antisymm + · rintro x ⟨hx, hxG⟩ + rcases G_V_cases hG hxG with h | ⟨f, hf, rfl⟩ + · exact ⟨hx, h⟩ + · exact (hub_notMem_U' hrad hst hS hf (Γ'.closure_subset_U he hx)).elim + · rintro x ⟨hx, hxG⟩ + refine ⟨hx, ?_⟩ + rw [hG.V] + exact Or.inl hxG + +include hDU in +omit hst hG hS [T2Space S] in +theorem D_U_subset : D.U ⊆ Γ.U := by + rw [hDU] + refine union_subset Γ.V_subset_U (iUnion₂_subset fun e he => ?_) + exact (discBd_subset _).trans (closure_subset_cell_U hrad he) + +include hDU in +omit hst hG [T2Space S] in +theorem cellInt_disjoint_D {e : Set S} (he : e ∈ Γ.E) : Disjoint (cellInt e) D.U := by + rw [hDU] + refine disjoint_left.mpr fun x hx h => ?_ + rcases h with h | h + · exact disjoint_left.mp (cellInt_disjoint_V hS he) hx h + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp h + by_cases hef : e = f + · subst hef + exact hx.2 hxf + · exact disjoint_left.mp (cellInt_disjoint hrad hS he hf hef) hx (discBd_subset _ hxf) + +include hDU hDV in +omit [T2Space S] in +/-- Condition (i) of a radial drawing. -/ +theorem star_cond_one : D.U ∩ G.U = D.V := by + have hUU' : Γ.U ∩ Γ'.U = Γ.V := hrad.2.1 + rw [hDV] + apply subset_antisymm + · rintro x ⟨hx, hxG⟩ + rw [hG.U] at hxG + rcases hxG with h | h + · exact hUU' ▸ ⟨D_U_subset hrad hDU hx, h⟩ + · obtain ⟨t, ht, hxt⟩ := mem_iUnion₂.mp h + by_cases hxb : x = t.2 + · exact hxb ▸ ht.2.1 + · have hb := Cell.closure_inter_V_subset hS ht.1 ⟨ht.2.2, ht.2.1⟩ + exact (disjoint_left.mp (cellInt_disjoint_D hrad hS hDU ht.1) + (hst.sub _ ht.1 _ hb ⟨hxt, hxb⟩) hx).elim + · intro x hx + refine ⟨?_, ?_⟩ + · rw [hDU] + exact Or.inl hx + · rw [hG.U] + exact Or.inl (Γ'.V_subset_U (hrad.2.2.1 hx)) + +include hv in +omit hrad hst hS [T2Space S] in +theorem hub_mem_G {e : Set S} (he : e ∈ Γ.E) : c e ∈ G.V := by + obtain ⟨b, hb, hbV⟩ := hv e he + rw [hG.V] + exact Or.inr ⟨(e, b), ⟨he, hbV, hb⟩, rfl⟩ + +include hv in +omit [T2Space S] in +/-- A region of `Γ` or the interior of a cell has exactly one vertex of `G`. -/ +theorem star_cond_two {r : Set S} (hr : r ∈ Γ.R ∪ cellInt '' Γ.E) : ∃! w, w ∈ r ∧ w ∈ G.V := by + have hUU' : Γ.U ∩ Γ'.U = Γ.V := hrad.2.1 + have hoff : ∀ {a x}, a ∈ Γ.R → x ∈ a → x ∉ Γ.U := by + rintro a x ⟨y, -, rfl⟩ hx + exact (connectedComponentIn_subset _ _ hx).2 + rcases hr with hr | ⟨e, he, rfl⟩ + · obtain ⟨w, ⟨hwr, hwV⟩, huniq⟩ := hrad.2.2.2.1 r hr + refine ⟨w, ⟨hwr, ?_⟩, ?_⟩ + · rw [hG.V] + exact Or.inl hwV + · rintro y ⟨hyr, hyG⟩ + rcases G_V_cases hG hyG with h | ⟨f, hf, rfl⟩ + · exact huniq y ⟨hyr, h⟩ + · exact (hoff hr hyr (cellInt_subset_U hrad hf (hst.hub f hf))).elim + · refine ⟨c e, ⟨hst.hub e he, hub_mem_G hG hv he⟩, ?_⟩ + rintro y ⟨hyr, hyG⟩ + rcases G_V_cases hG hyG with h | ⟨f, hf, rfl⟩ + · by_cases hyV : y ∈ Γ.V + · exact (disjoint_left.mp (cellInt_disjoint_V hS he) hyr hyV).elim + · obtain ⟨a, ha, hya⟩ := hrad.2.2.2.2.1 y ⟨h, hyV⟩ + exact (hoff ha hya (cellInt_subset_U hrad he hyr)).elim + · by_cases hfe : f = e + · rw [hfe] + · exact (disjoint_left.mp (cellInt_disjoint hrad hS hf he hfe) (hst.hub f hf) hyr.1).elim + +include hDV in +omit hS [T2Space S] in +/-- Each vertex of `G` not in `D` lies in a region of `Γ` or the interior of a cell. -/ +theorem star_cond_three {w : S} (hw : w ∈ G.V \ D.V) : ∃ r ∈ Γ.R ∪ cellInt '' Γ.E, w ∈ r := by + rw [hDV] at hw + rcases G_V_cases hG hw.1 with h | ⟨e, he, rfl⟩ + · obtain ⟨a, ha, hwa⟩ := hrad.2.2.2.2.1 w ⟨h, hw.2⟩ + exact ⟨a, Or.inl ha, hwa⟩ + · exact ⟨cellInt e, Or.inr ⟨e, he, rfl⟩, hst.hub e he⟩ + +include hDV in +/-- Each edge of `G` has one end in `D` and one other. -/ +theorem star_cond_four {e : Set S} (he : e ∈ G.E) : + ∃ v ∈ D.V, ∃ w ∈ G.V \ D.V, closure e ∩ G.V = {v, w} := by + rw [hDV] + rw [hG.E] at he + rcases he with he | ⟨t, ht, rfl⟩ + · obtain ⟨v, hv', w, ⟨hwV, hwn⟩, hcap⟩ := hrad.2.2.2.2.2.1 e he + refine ⟨v, hv', w, ⟨?_, hwn⟩, ?_⟩ + · rw [hG.V] + exact Or.inl hwV + · rw [closure_inter_G_V hrad hst hS hG he] + exact hcap + · have hcG := star_inter_V hrad hst hS hG ht + refine ⟨t.2, ht.2.1, c t.1, ⟨?_, hub_notMem_V hst hS ht.1⟩, ?_⟩ + · have : c t.1 ∈ K t.1 t.2 ∩ G.V := by rw [hcG]; simp + exact this.2 + · rw [star_closure hst hS ht, hcG] + +include hDV hv in +/-- Condition (iv) of a radial drawing. -/ +theorem star_cond_five {e f : Set S} (he : e ∈ G.E) (hf : f ∈ G.E) (hef : e ≠ f) {v : S} + (hvD : v ∈ D.V) {r : Set S} (hr : r ∈ Γ.R ∪ cellInt '' Γ.E) {w : S} (hw : w ∈ r ∩ G.V) + (he' : closure e ∩ G.V = {v, w}) (hf' : closure f ∩ G.V = {v, w}) : + ¬ ∃ Δ : Set S, IsClosedDisc Δ ∧ Δ ⊆ r ∪ {v} ∧ subBd Δ = closure e ∪ closure f := by + have hoff : ∀ {a x}, a ∈ Γ.R → x ∈ a → x ∉ Γ.U := by + rintro a x ⟨y, -, rfl⟩ hx + exact (connectedComponentIn_subset _ _ hx).2 + rw [hDV] at hvD + have hwcap : ∀ {g : Set S}, closure g ∩ G.V = {v, w} → w ∈ closure g := by + intro g h + have : w ∈ closure g ∩ G.V := by rw [h]; simp + exact this.1 + rcases hr with hr | ⟨g, hg, rfl⟩ + · -- Both edges are edges of `Γ'`, as the lines of the stars stay in the cells. + have hin : ∀ {g : Set S}, g ∈ G.E → closure g ∩ G.V = {v, w} → g ∈ Γ'.E := by + intro g hg hc + rw [hG.E] at hg + rcases hg with h | ⟨t, ht, rfl⟩ + · exact h + · exfalso + have hb := Cell.closure_inter_V_subset hS ht.1 ⟨ht.2.2, ht.2.1⟩ + have hwK := hwcap hc + rw [star_closure hst hS ht] at hwK + exact hoff hr hw.1 (closure_subset_cell_U hrad ht.1 (star_subset_closure hst ht.1 hb hwK)) + have he₁ := hin he he' + have hf₁ := hin hf hf' + have hw' : w ∈ Γ'.V := by + rcases G_V_cases hG hw.2 with h | ⟨g, hg, rfl⟩ + · exact h + · exact (hoff hr hw.1 (cellInt_subset_U hrad hg (hst.hub g hg))).elim + rw [closure_inter_G_V hrad hst hS hG he₁] at he' + rw [closure_inter_G_V hrad hst hS hG hf₁] at hf' + exact hrad.2.2.2.2.2.2 e he₁ f hf₁ hef v hvD r hr w ⟨hw.1, hw'⟩ he' hf' + · exfalso + have hwc : w = c g := (star_cond_two hrad hst hS hG hv (Or.inr ⟨g, hg, rfl⟩)).unique + hw ⟨hst.hub g hg, hub_mem_G hG hv hg⟩ + subst hwc + have hne : v ≠ c g := fun h => hub_notMem_V hst hS hg (h ▸ hvD) + have hin : ∀ {x : Set S}, x ∈ G.E → closure x ∩ G.V = {v, c g} → + x = K g v \ {c g, v} := by + intro x hx hc + rw [hG.E] at hx + rcases hx with h | ⟨t, ht, rfl⟩ + · exact (hub_notMem_U' hrad hst hS hg (Γ'.closure_subset_U h (hwcap hc))).elim + · rw [star_closure hst hS ht, star_inter_V hrad hst hS hG ht] at hc + have h₁ : c g ∈ ({t.2, c t.1} : Set S) := hc ▸ (Or.inr rfl) + have h₂ : v ∈ ({t.2, c t.1} : Set S) := hc ▸ (Or.inl rfl) + have hcc : c g = c t.1 := by + rcases h₁ with h | h + · exact (hub_notMem_V hst hS hg (h ▸ ht.2.1)).elim + · exact h + have htg : t.1 = g := by + by_contra hn + exact disjoint_left.mp (cellInt_disjoint hrad hS hg ht.1 (Ne.symm hn)) (hst.hub g hg) + (hcc ▸ (hst.hub t.1 ht.1).1) + have hv2 : v = t.2 := by + rcases h₂ with h | h + · exact h + · exact (hne (h.trans hcc.symm)).elim + change K t.1 t.2 \ {c t.1, t.2} = _ + rw [htg, ← hv2] + exact hef ((hin he he').trans (hin hf hf').symm) + +include hDU hDV hv in +/-- **`G` is a pre-radial drawing of `D`.** -/ +theorem star_preRadial (hDR : D.R = Γ.R ∪ cellInt '' Γ.E) : + (PaintingOrDrawing.drawing D).IsPreRadialDrawing G := by + refine ⟨star_cond_one hrad hst hS hG hDU hDV, ?_, ?_, ?_, ?_, ?_⟩ + · intro x hx + have hx' : x ∈ Γ.V := hDV ▸ hx + change x ∈ G.V + rw [hG.V] + exact Or.inl (hrad.2.2.1 hx') + · intro r hr + have hr' : r ∈ D.R := hr + rw [hDR] at hr' + exact star_cond_two hrad hst hS hG hv hr' + · intro w hw + obtain ⟨r, hr, hwr⟩ := star_cond_three hrad hst hG hDV hw + refine ⟨r, ?_, hwr⟩ + change r ∈ D.R + rw [hDR] + exact hr + · intro e he + exact star_cond_four hrad hst hS hG hDV he + · intro e he f hf hef v hvD r hr w hw he' hf' + have hr' : r ∈ D.R := hr + rw [hDR] at hr' + exact star_cond_five hrad hst hS hG hDV hv he hf hef hvD hr' hw he' hf' + +include hDU hDV hv in +/-- **`G` is maximal: it is a radial drawing of `D`.** -/ +theorem radial_of_stars (hmax : RadMax (PaintingOrDrawing.painting Γ) Γ') + (hDR : D.R = Γ.R ∪ cellInt '' Γ.E) [ConnectedSpace S] : + (PaintingOrDrawing.drawing D).IsRadialDrawing G := by + have hpre := star_preRadial hrad hst hS hG hDU hDV hv hDR + have hoff : ∀ {a x}, a ∈ Γ.R → x ∈ a → x ∉ Γ.U := by + rintro a x ⟨y, -, rfl⟩ hx + exact (connectedComponentIn_subset _ _ hx).2 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + refine ⟨boundary_twoCell hS hrad.1.2 hDR, hpre, ?_⟩ + rintro G₁ hp ⟨hVs, hEs⟩ + have hVG : G₁.V ⊆ G.V := by + intro x hx + by_cases hxD : x ∈ D.V + · exact hpre.2.1 hxD + · obtain ⟨r, hr, hxr⟩ := hp.2.2.2.1 x ⟨hx, hxD⟩ + obtain ⟨w, ⟨hwr, hwG⟩, -⟩ := hpre.2.2.1 r hr + have : x = w := (hp.2.2.1 r hr).unique ⟨hxr, hx⟩ ⟨hwr, hVs hwG⟩ + exact this ▸ hwG + have hVeq : G₁.V = G.V := subset_antisymm hVG hVs + refine ⟨hVG, fun g hg => ?_⟩ + obtain ⟨v, hvD, w, ⟨hwV, hwn⟩, hcap⟩ := hp.2.2.2.2.1 g hg + obtain ⟨r, hr, hwr⟩ := hp.2.2.2.1 w ⟨hwV, hwn⟩ + have hr' : r ∈ D.R := hr + have hvΓ : v ∈ Γ.V := hDV ▸ hvD + have hgD : Disjoint g D.U := by + refine disjoint_left.mpr fun x hx hxD => ?_ + have h₁ : x ∈ D.U ∩ G₁.U := ⟨hxD, G₁.closure_subset_U hg (subset_closure hx)⟩ + have h₂ : x ∈ D.V := (show D.U ∩ G₁.U = D.V from hp.1) ▸ h₁ + exact edge_notMem_V hg hx (hp.2.1 h₂) + have hwg : w ∈ closure g := by + have : w ∈ closure g ∩ G₁.V := by rw [hcap]; simp + exact this.1 + have hvg : v ∈ closure g := by + have : v ∈ closure g ∩ G₁.V := by rw [hcap]; simp + exact this.1 + have hvV : v ∈ G₁.V := by + have : v ∈ closure g ∩ G₁.V := by rw [hcap]; simp + exact this.2 + obtain ⟨y, hyr, hyg⟩ := mem_closure_iff.mp hwg r (region_isOpen hr') hwr + have hgr : g ⊆ r := subset_region hr' hg.2.2.1.isConnected.isPreconnected hgD hyg hyr + have hgcl : ∀ x ∈ closure g, x = v ∨ x = w ∨ x ∈ g := by + intro x hx + by_cases hxV : x ∈ G₁.V + · have : x ∈ closure g ∩ G₁.V := ⟨hx, hxV⟩ + rw [hcap] at this + rcases this with h | h + · exact Or.inl h + · exact Or.inr (Or.inl h) + · exact Or.inr (Or.inr ((G₁.closure_diff_V hg).subset ⟨hx, hxV⟩)) + rw [hDR] at hr' + rcases hr' with hrΓ | ⟨e, he, rfl⟩ + · -- `g` lies in a region of `Γ`, so that adding it to `Γ'` contradicts the maximality of `Γ'`. + have hwΓ' : w ∈ Γ'.V := by + rcases G_V_cases hG (hVG hwV) with h | ⟨f, hf, rfl⟩ + · exact h + · exact (hoff hrΓ hwr (cellInt_subset_U hrad hf (hst.hub f hf))).elim + have hvΓ' : v ∈ Γ'.V := hrad.2.2.1 hvΓ + have hV'G₁ : Γ'.V ⊆ G₁.V := fun x hx => hVs (by rw [hG.V]; exact Or.inl hx) + have hE'G₁ : Γ'.E ⊆ G₁.E := fun x hx => hEs (by rw [hG.E]; exact Or.inl hx) + let G₂ : Drawing S := G₁.span Γ'.V (insert g Γ'.E) + have hsame : ∀ e ∈ insert g Γ'.E, closure e ∩ G₁.V = closure e ∩ Γ'.V := by + rintro e (rfl | he) + · apply subset_antisymm + · rintro x ⟨hx, hxV⟩ + have : x ∈ closure e ∩ G₁.V := ⟨hx, hxV⟩ + rw [hcap] at this + refine ⟨hx, ?_⟩ + rcases this with h | h + · exact h ▸ hvΓ' + · exact h ▸ hwΓ' + · exact fun x hx => ⟨hx.1, hV'G₁ hx.2⟩ + · rw [hVeq] + exact closure_inter_G_V hrad hst hS hG he + have hG₂V : G₂.V = Γ'.V := by + apply subset_antisymm + · rintro x (⟨hx, -⟩ | hx) + · exact hx + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + rw [hsame e he.1] at hxe + exact hxe.2 + · exact fun x hx => Or.inl ⟨hx, hV'G₁ hx⟩ + have hG₂E : G₂.E = insert g Γ'.E := by + exact (G₁.span_E _ _).trans (inter_eq_left.mpr (insert_subset hg hE'G₁)) + have hG₂U : G₂.U ⊆ Γ'.U ∪ closure g := by + rintro x (hx | hx) + · have hx' : x ∈ G₂.V := hx + rw [hG₂V] at hx' + exact Or.inl (Γ'.V_subset_U hx') + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + rcases he.1 with rfl | h + · exact Or.inr hxe + · exact Or.inl (Γ'.closure_subset_U h hxe) + have hUU' : Γ.U ∩ Γ'.U = Γ.V := hrad.2.1 + have hpre₂ : (PaintingOrDrawing.painting Γ).IsPreRadialDrawing G₂ := by + refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ + · apply subset_antisymm + · rintro x ⟨hxU, hxG⟩ + rcases hG₂U hxG with h | h + · exact hUU'.subset ⟨hxU, h⟩ + · rcases hgcl x h with h' | h' | h' + · exact h' ▸ hvΓ + · exact (hoff hrΓ (h' ▸ hwr) hxU).elim + · exact (hoff hrΓ (hgr h') hxU).elim + · intro x hx + have hx' : x ∈ Γ'.V := hrad.2.2.1 hx + exact ⟨Γ.V_subset_U hx, Or.inl (show x ∈ _ from by + have : x ∈ G₂.V := hG₂V ▸ hx' + exact this)⟩ + · change Γ.V ⊆ G₂.V + rw [hG₂V] + exact hrad.2.2.1 + · change ∀ r ∈ Γ.R, ∃! w, w ∈ r ∧ w ∈ G₂.V + rw [hG₂V] + exact hrad.2.2.2.1 + · change ∀ w ∈ G₂.V \ Γ.V, ∃ r ∈ Γ.R, w ∈ r + rw [hG₂V] + exact hrad.2.2.2.2.1 + · change ∀ e ∈ G₂.E, ∃ v ∈ Γ.V, ∃ w ∈ G₂.V \ Γ.V, closure e ∩ G₂.V = {v, w} + rw [hG₂V, hG₂E] + rintro e (rfl | he) + · refine ⟨v, hvΓ, w, ⟨hwΓ', fun h => hwn (hDV.symm.subset h)⟩, ?_⟩ + rw [← hsame e (mem_insert _ _), hcap] + · exact hrad.2.2.2.2.2.1 e he + · change ∀ e ∈ G₂.E, ∀ f ∈ G₂.E, e ≠ f → ∀ v ∈ Γ.V, ∀ r ∈ Γ.R, ∀ w ∈ r ∩ G₂.V, + closure e ∩ G₂.V = {v, w} → closure f ∩ G₂.V = {v, w} → + ¬ ∃ Δ : Set S, IsClosedDisc Δ ∧ Δ ⊆ r ∪ {v} ∧ subBd Δ = closure e ∪ closure f + rw [hG₂V, hG₂E] + intro e he f hf hef x hx a ha z hz hez hfz + have he₁ : e ∈ G₁.E := insert_subset hg hE'G₁ he + have hf₁ : f ∈ G₁.E := insert_subset hg hE'G₁ hf + have ha' : a ∈ (PaintingOrDrawing.drawing D).R := by + change a ∈ D.R + rw [hDR] + exact Or.inl ha + refine hp.2.2.2.2.2 e he₁ f hf₁ hef x (hDV.symm.subset hx) a ha' z ⟨hz.1, hV'G₁ hz.2⟩ ?_ ?_ + · rw [hsame e he, hez] + · rw [hsame f hf, hfz] + have hsub := (hmax G₂ hpre₂ ⟨hG₂V.ge, by rw [hG₂E]; exact subset_insert _ _⟩).2 + have hgE : g ∈ Γ'.E := hsub (by rw [hG₂E]; exact mem_insert _ _) + rw [hG.E] + exact Or.inl hgE + · -- `g` lies in the interior of a cell, where it is parallel to a line of the star. + have hwc : w = c e := (hpre.2.2.1 (cellInt e) hr).unique ⟨hwr, hVG hwV⟩ + ⟨hst.hub e he, hub_mem_G hG hv he⟩ + subst hwc + have hd := Cell.isClosedDisc_closure he + have hcl : closure (cellInt e) ⊆ closure e := + closure_minimal sdiff_subset isClosed_closure + have hve : v ∈ closure e := hcl (closure_mono hgr hvg) + have ht : (e, v) ∈ cellPairs Γ := ⟨he, hvΓ, hve⟩ + have hb : v ∈ discBd (closure e) := Cell.closure_inter_V_subset hS he ⟨hve, hvΓ⟩ + let s : Set S := K e v \ {c e, v} + have hsG : s ∈ G.E := by + rw [hG.E] + exact Or.inr ⟨(e, v), ht, rfl⟩ + by_cases hgs : g = s + · exact hgs ▸ hsG + exfalso + have hs₁ : s ∈ G₁.E := hEs hsG + have hscl : closure s = K e v := star_closure hst hS ht + have hne : v ≠ c e := fun h => hub_notMem_V hst hS he (h ▸ hvΓ) + have hcaps : closure s ∩ G₁.V = {v, c e} := by + rw [hVeq, hscl] + exact star_inter_V hrad hst hS hG ht + have hJ := isOArc_spokes hg hs₁ hgs hne hcap hcaps + have hJsub : closure g ∪ closure s ⊆ cellInt e ∪ {v} := by + rintro x (hx | hx) + · rcases hgcl x hx with h | h | h + · exact Or.inr h + · exact Or.inl (h ▸ hst.hub e he) + · exact Or.inl (hgr h) + · rw [hscl] at hx + by_cases hxv : x = v + · exact Or.inr hxv + · exact Or.inl (hst.sub e he v hb ⟨hx, hxv⟩) + have hJD : closure g ∪ closure s ⊆ closure e := fun x hx => by + rcases hJsub hx with h | h + · exact h.1 + · exact mem_singleton_iff.mp h ▸ hve + obtain ⟨Δ, ⟨hΔsub, hΔ, hΔbd, -, hΔdis, -⟩, -⟩ := disc_oArc _ _ hd hJD hJ + refine hp.2.2.2.2.2 g hg s hs₁ hgs v hvD _ hr (c e) ⟨hwr, hwV⟩ hcap hcaps + ⟨Δ, hΔ, fun x hx => ?_, ?_⟩ + · by_cases hxJ : x ∈ closure g ∪ closure s + · exact hJsub hxJ + · exact Or.inl ⟨hΔsub hx, disjoint_left.mp hΔdis ⟨hx, hxJ⟩⟩ + · rw [subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hS hΔ, hΔbd] + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/PaintingRegions.lean b/LeanPool/GraphMinor/GM11/PaintingRegions.lean new file mode 100644 index 0000000000..2f6714c7e4 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PaintingRegions.lean @@ -0,0 +1,547 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PaintingCells +import Mathlib.Analysis.Normed.Module.Connected +import Mathlib.LinearAlgebra.FiniteDimensional.Lemmas + +/-! +# The regions of the boundary drawing of a painting + +`boundary_R`: the regions of the drawing of the boundaries of the cells of a painting are the +regions +of the painting and the interiors of the cells. + +`isPreconnected_frontier`: the frontier of an open disc in a surface is connected. Hence the point +set +of a drawing with all regions open discs is connected (`eq_empty_of_split`). The consequence used +later: if a 2-cell painting has a cell with no vertex, that cell is all of it. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A decreasing sequence of compact connected sets has a connected intersection. -/ +theorem isPreconnected_iInter_of_antitone [CompactSpace S] [T2Space S] {K : ℕ → Set S} + (hanti : ∀ n, K (n + 1) ⊆ K n) (hc : ∀ n, IsClosed (K n)) (hp : ∀ n, IsPreconnected (K n)) : + IsPreconnected (⋂ n, K n) := by + rw [isPreconnected_closed_iff] + intro t t' ht ht' hsub hne hne' + by_contra hemp + let s := ⋂ n, K n + have hs : IsClosed s := isClosed_iInter hc + have hdis : Disjoint (s ∩ t) (s ∩ t') := by + refine disjoint_left.mpr fun x hx hx' => hemp ⟨x, hx.1, hx.2, hx'.2⟩ + obtain ⟨O₁, O₂, h₁, h₂, hs₁, hs₂, hO⟩ := SeparatedNhds.of_isCompact_isCompact + (hs.inter ht).isCompact (hs.inter ht').isCompact hdis + -- Some `K n` lies in `O₁ ∪ O₂`. + have hex : ∃ n, K n ⊆ O₁ ∪ O₂ := by + by_contra hno + push Not at hno + let L : ℕ → Set S := fun n => K n \ (O₁ ∪ O₂) + have hLc : ∀ n, IsClosed (L n) := fun n => (hc n).sdiff (h₁.union h₂) + obtain ⟨x, hx⟩ := IsCompact.nonempty_iInter_of_sequence_nonempty_isCompact_isClosed L + (fun n x hx => ⟨hanti n hx.1, hx.2⟩) + (fun n => by + obtain ⟨x, hx, hn⟩ := not_subset.mp (hno n) + exact ⟨x, hx, hn⟩) (hLc 0).isCompact hLc + have hxs : x ∈ s := mem_iInter.mpr fun n => (mem_iInter.mp hx n).1 + have hn := (mem_iInter.mp hx 0).2 + rcases hsub hxs with h | h + · exact hn (Or.inl (hs₁ ⟨hxs, h⟩)) + · exact hn (Or.inr (hs₂ ⟨hxs, h⟩)) + obtain ⟨n, hn⟩ := hex + obtain ⟨x, hxs, hxt⟩ := hne + obtain ⟨y, hys, hyt⟩ := hne' + obtain ⟨z, -, hz₁, hz₂⟩ := hp n O₁ O₂ h₁ h₂ hn ⟨x, mem_iInter.mp hxs n, hs₁ ⟨hxs, hxt⟩⟩ + ⟨y, mem_iInter.mp hys n, hs₂ ⟨hys, hyt⟩⟩ + exact disjoint_left.mp hO hz₁ hz₂ + +/-- An open annulus around the origin of the plane is connected. -/ +theorem isPreconnected_annulus {a : ℝ} (ha : 0 ≤ a) : + IsPreconnected {x : EuclideanPlane | a < ‖x‖ ∧ ‖x‖ < 1} := by + have hrank : 1 < Module.rank ℝ EuclideanPlane := by + apply Module.lt_rank_of_lt_finrank + simp + have hsph : IsPreconnected (Metric.sphere (0 : EuclideanPlane) 1) := + isPreconnected_sphere hrank 0 1 + have hI : IsPreconnected (Ioo a 1) := isPreconnected_Ioo + have himg : {x : EuclideanPlane | a < ‖x‖ ∧ ‖x‖ < 1} = + (fun p : ℝ × EuclideanPlane => p.1 • p.2) '' (Ioo a 1 ×ˢ Metric.sphere 0 1) := by + ext x + constructor + · rintro ⟨h₁, h₂⟩ + have hx : ‖x‖ ≠ 0 := by linarith + refine ⟨(‖x‖, ‖x‖⁻¹ • x), ⟨⟨h₁, h₂⟩, ?_⟩, ?_⟩ + · simp [norm_smul, hx] + · simp [smul_smul, hx] + · rintro ⟨⟨t, u⟩, ⟨ht, hu⟩, rfl⟩ + have hu' : ‖u‖ = 1 := by simpa using hu + have ht0 : 0 ≤ t := by linarith [ht.1] + simp only [mem_ofPred_eq, norm_smul, hu', mul_one, Real.norm_of_nonneg ht0] + exact ht + rw [himg] + exact (hI.prod hsph).image _ (by fun_prop) + +/-- **The frontier of an open disc in a compact surface is connected.** -/ +theorem isPreconnected_frontier [CompactSpace S] [T2Space S] {r : Set S} (hr : IsOpenDisc r) : + IsPreconnected (frontier r) := by + obtain ⟨hopen, ⟨φ⟩⟩ := hr + let f : OpenUnitDisc → S := fun z => (φ z).1 + have hf : IsOpenEmbedding f := hopen.isOpenEmbedding_subtypeVal.comp φ.isOpenEmbedding + have hfr : range f = r := by + ext y + constructor + · rintro ⟨z, rfl⟩ + exact (φ z).2 + · intro hy + obtain ⟨z, hz⟩ := φ.surjective ⟨y, hy⟩ + exact ⟨z, by simp [f, hz]⟩ + let a : ℕ → ℝ := fun n => 1 - 1 / ((n : ℝ) + 2) + have ha0 : ∀ n, 0 ≤ a n := fun n => by + have : 1 / ((n : ℝ) + 2) ≤ 1 := by + rw [div_le_one (by positivity)] + have : (0 : ℝ) ≤ n := Nat.cast_nonneg n + linarith + simp only [a] + linarith + have ha1 : ∀ n, a n < 1 := fun n => by + have : 0 < 1 / ((n : ℝ) + 2) := by positivity + simp only [a] + linarith + have hamono : ∀ n, a n ≤ a (n + 1) := fun n => by + have : 1 / (((n + 1 : ℕ) : ℝ) + 2) ≤ 1 / ((n : ℝ) + 2) := by + apply one_div_le_one_div_of_le (by positivity) + push_cast + linarith + simp only [a] + linarith + let A : ℕ → Set OpenUnitDisc := fun n => {z | a n < ‖z.1‖} + let K : ℕ → Set S := fun n => closure (f '' A n) + have hAconn : ∀ n, IsPreconnected (A n) := fun n => by + rw [← IsEmbedding.subtypeVal.isInducing.isPreconnected_image] + have : Subtype.val '' A n = {x : EuclideanPlane | a n < ‖x‖ ∧ ‖x‖ < 1} := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨hz, by simpa [OpenUnitDisc] using z.2⟩ + · rintro ⟨h₁, h₂⟩ + exact ⟨⟨x, by simpa [OpenUnitDisc] using h₂⟩, h₁, rfl⟩ + rw [this] + exact isPreconnected_annulus (ha0 n) + have hK : frontier r = ⋂ n, K n := by + have hsplit : ∀ n, r = f '' {z | ‖z.1‖ ≤ a n} ∪ f '' A n := fun n => by + rw [← image_union, ← hfr, ← image_univ] + congr 1 + ext z + simp only [mem_univ, mem_union, mem_ofPred_eq, A, true_iff] + exact le_or_gt _ _ + have hCc : ∀ n, IsClosed (f '' {z | ‖z.1‖ ≤ a n}) := fun n => by + have hcomp : IsCompact {z : OpenUnitDisc | ‖z.1‖ ≤ a n} := by + rw [IsEmbedding.subtypeVal.isCompact_iff] + have : Subtype.val '' {z : OpenUnitDisc | ‖z.1‖ ≤ a n} = Metric.closedBall 0 (a n) := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + simpa using hz + · intro hx + have hx' : ‖x‖ ≤ a n := by simpa using hx + exact ⟨⟨x, by simpa [OpenUnitDisc] using lt_of_le_of_lt hx' (ha1 n)⟩, hx', rfl⟩ + rw [this] + exact isCompact_closedBall _ _ + exact (hcomp.image hf.continuous).isClosed + apply subset_antisymm + · intro y hy + refine mem_iInter.mpr fun n => ?_ + have hcl : y ∈ closure r := hy.1 + have hyn : y ∉ r := fun h => hy.2 (by rwa [hopen.interior_eq]) + rw [hsplit n, closure_union, (hCc n).closure_eq] at hcl + rcases hcl with h | h + · exact (hyn ((hsplit n).symm ▸ Or.inl h)).elim + · exact h + · intro y hy + have hcl : y ∈ closure r := by + have h0 := mem_iInter.mp hy 0 + exact closure_mono (fun w hw => (hsplit 0).symm ▸ Or.inr hw) h0 + refine ⟨hcl, ?_⟩ + rw [hopen.interior_eq] + intro hyr + obtain ⟨z, rfl⟩ : y ∈ range f := hfr ▸ hyr + have hz : ‖z.1‖ < 1 := by simpa [OpenUnitDisc] using z.2 + obtain ⟨n, hn⟩ := exists_nat_gt (1 / (1 - ‖z.1‖)) + have hd : 0 < 1 - ‖z.1‖ := by linarith + have hlt : ‖z.1‖ < a n := by + have hn0 : (0 : ℝ) < (n : ℝ) + 2 := by positivity + have h₁ : 1 / ((n : ℝ) + 2) < 1 - ‖z.1‖ := by + rw [div_lt_iff₀ hn0] + rw [div_lt_iff₀ hd] at hn + nlinarith [mul_comm (n : ℝ) (1 - ‖z.1‖)] + simp only [a] + linarith + have hO : IsOpen (f '' {w | ‖w.1‖ < a n}) := + hf.isOpenMap _ (isOpen_lt (by fun_prop) continuous_const) + obtain ⟨_, ⟨w, hw, rfl⟩, ⟨w', hw', he⟩⟩ := mem_closure_iff.mp (mem_iInter.mp hy n) _ hO + ⟨z, hlt, rfl⟩ + obtain rfl := hf.injective he + exact lt_asymm (show ‖w'.1‖ < a n from hw) hw' + rw [hK] + refine isPreconnected_iInter_of_antitone (fun n => closure_mono ?_) (fun n => isClosed_closure) + fun n => ((hAconn n).image f hf.continuous.continuousOn).closure + exact image_mono fun z hz => lt_of_le_of_lt (hamono n) hz + +variable [T2Space S] + +/-- If the regions of a drawing are open discs, its point set is connected: it does not split into +two non-empty disjoint closed sets. -/ +theorem eq_empty_of_split (hS : IsClosedSurface S) [ConnectedSpace S] {D : Drawing S} + (hD : ∀ r ∈ D.R, IsOpenDisc r) {C₁ C₂ : Set S} (h₁ : IsClosed C₁) (h₂ : IsClosed C₂) + (hdis : Disjoint C₁ C₂) (hU : C₁ ∪ C₂ = D.U) (hne : C₁.Nonempty) : C₂ = ∅ := by + classical + have : CompactSpace S := hS.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hfin := finite_R hS D + have hfr : ∀ r ∈ D.R, frontier r ⊆ D.U := by + intro r hr x hx + by_contra hxU + obtain ⟨r', hr', hxr'⟩ := exists_region_of_notMem hxU + obtain ⟨z, hz', hz⟩ := mem_closure_iff.mp hx.1 r' (region_isOpen hr') hxr' + obtain rfl := region_eq_of_mem hr' hr hz' hz + exact hx.2 (by rwa [(region_isOpen hr').interior_eq]) + have isClosed_of_frontier_subset' : ∀ {r : Set S}, r ∈ D.R → frontier r = ∅ → IsClosed r := by + intro r _ h + exact isClosed_of_closure_subset fun x hx => by + by_contra hn + have : x ∈ frontier r := ⟨hx, fun hi => hn (interior_subset hi)⟩ + rw [h] at this + exact this + have hfrne : ∀ r ∈ D.R, (frontier r).Nonempty := by + intro r hr + by_contra hemp + have hemp' : frontier r = ∅ := not_nonempty_iff_eq_empty.mp hemp + have hcl : IsClopen r := ⟨isClosed_of_frontier_subset' hr hemp', region_isOpen hr⟩ + rcases isClopen_iff.mp hcl with h | h + · exact (region_nonempty hr).ne_empty h + · obtain ⟨x, hx⟩ := hne + exact region_subset hr (h ▸ mem_univ x) (hU ▸ Or.inl hx) + let Reg : Set S → Set S := fun C => C ∪ ⋃ r ∈ {r ∈ D.R | frontier r ⊆ C}, r + have hclosed : ∀ C, IsClosed C → IsClosed (Reg C) := by + intro C hC + have heq : Reg C = C ∪ ⋃ r ∈ {r ∈ D.R | frontier r ⊆ C}, closure r := by + apply subset_antisymm + · refine union_subset_union_right _ (iUnion₂_mono fun r _ => subset_closure) + · refine union_subset subset_union_left (iUnion₂_subset fun r hr x hx => ?_) + by_cases hxr : x ∈ r + · exact Or.inr (mem_iUnion₂.mpr ⟨r, hr, hxr⟩) + · exact Or.inl (hr.2 ⟨hx, by rwa [(region_isOpen hr.1).interior_eq]⟩) + rw [heq] + have hCfin : {r ∈ D.R | frontier r ⊆ C}.Finite := hfin.subset fun _ h => h.1 + exact hC.union (hCfin.isClosed_biUnion fun _ _ => isClosed_closure) + have hcover : Reg C₁ ∪ Reg C₂ = univ := by + refine eq_univ_of_forall fun x => ?_ + by_cases hx : x ∈ D.U + · rw [← hU] at hx + exact hx.elim (fun h => Or.inl (Or.inl h)) fun h => Or.inr (Or.inl h) + · obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem hx + have hsub : frontier r ⊆ C₁ ∪ C₂ := hU ▸ hfr r hr + rcases subset_or_subset_of_closed (isPreconnected_frontier (hD r hr)) h₁ h₂ hsub + (fun _ _ h h' => disjoint_left.mp hdis h h') with h | h + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨r, ⟨hr, h⟩, hxr⟩)) + · exact Or.inr (Or.inr (mem_iUnion₂.mpr ⟨r, ⟨hr, h⟩, hxr⟩)) + have hdisj : Disjoint (Reg C₁) (Reg C₂) := by + refine disjoint_left.mpr ?_ + have hoff : ∀ {C r x}, C ⊆ D.U → r ∈ D.R → x ∈ r → x ∉ C := fun hC hr hx hxC => + region_subset hr hx (hC hxC) + have hC₁ : C₁ ⊆ D.U := hU ▸ subset_union_left + have hC₂ : C₂ ⊆ D.U := hU ▸ subset_union_right + rintro x (hx | hx) (hy | hy) + · exact disjoint_left.mp hdis hx hy + · obtain ⟨r, hr, hxr⟩ := mem_iUnion₂.mp hy + exact hoff hC₁ hr.1 hxr hx + · obtain ⟨r, hr, hxr⟩ := mem_iUnion₂.mp hx + exact hoff hC₂ hr.1 hxr hy + · obtain ⟨r, hr, hxr⟩ := mem_iUnion₂.mp hx + obtain ⟨r', hr', hxr'⟩ := mem_iUnion₂.mp hy + obtain rfl := region_eq_of_mem hr.1 hr'.1 hxr hxr' + obtain ⟨z, hz⟩ := hfrne r hr.1 + exact disjoint_left.mp hdis (hr.2 hz) (hr'.2 hz) + have hclopen : IsClopen (Reg C₁) := by + refine ⟨hclosed C₁ h₁, ?_⟩ + have : Reg C₁ = (Reg C₂)ᶜ := by + ext x + constructor + · exact fun h h' => disjoint_left.mp hdisj h h' + · intro h + exact (mem_union _ _ _).mp (hcover ▸ mem_univ x) |>.resolve_right h + rw [this] + exact (hclosed C₂ h₂).isOpen_compl + rcases isClopen_iff.mp hclopen with h | h + · obtain ⟨x, hx⟩ := hne + have : x ∈ Reg C₁ := Or.inl hx + rw [h] at this + exact this.elim + · refine eq_empty_of_forall_notMem fun x hx => ?_ + exact disjoint_left.mp hdisj (h ▸ mem_univ x) (Or.inl hx) + +omit [T2Space S] in +/-- An `O`-arc is compact. -/ +theorem isCompact_of_isOArc {F : Set S} (hF : IsOArc F) : IsCompact F := by + obtain ⟨f⟩ := hF + have : F = range fun x : Circle => (f x).1 := by + ext y + constructor + · intro hy + obtain ⟨x, hx⟩ := f.surjective ⟨y, hy⟩ + exact ⟨x, by simp [hx]⟩ + · rintro ⟨x, rfl⟩ + exact (f x).2 + rw [this] + exact isCompact_range (by fun_prop) + +omit [T2Space S] in +/-- **The regions of the boundary drawing of a painting** are the regions of the painting and the +interiors of its cells. -/ +theorem boundary_R (hS : IsClosedSurface S) {Γ : Painting S} (hP : ∀ r ∈ Γ.R, IsOpenDisc r) + {D : Drawing S} {V₀ : Set S} (hsub : Γ.V ⊆ V₀) (hV₀ : V₀ ⊆ Γ.U) + (hbd : ∀ e ∈ Γ.E, V₀ ∩ closure e ⊆ discBd (closure e)) + (hDU : D.U = V₀ ∪ ⋃ e ∈ Γ.E, discBd (closure e)) : + D.R = Γ.R ∪ (fun e => closure e \ discBd (closure e)) '' Γ.E := by + have hU : IsClosed Γ.U := Cell.isClosed_U Γ fun r hr => (hP r hr).1 + have hclU : ∀ e ∈ Γ.E, closure e ⊆ Γ.U := fun e he => + closure_minimal (he.2.1.trans sdiff_subset) hU + have hintne : ∀ e ∈ Γ.E, (closure e \ discBd (closure e)).Nonempty := fun e he => by + obtain ⟨-, ⟨φ⟩⟩ := isOpenDisc_interior hS (Cell.isClosedDisc_closure he) + exact ⟨(φ ⟨0, by simp [OpenUnitDisc]⟩).1, (φ _).2⟩ + have hintV : ∀ e ∈ Γ.E, Disjoint (closure e \ discBd (closure e)) V₀ := fun e he => by + refine disjoint_left.mpr fun x hx hxV => hx.2 (hbd e he ⟨hxV, hx.1⟩) + have hintint : ∀ e ∈ Γ.E, ∀ f ∈ Γ.E, e ≠ f → + Disjoint (closure e \ discBd (closure e)) (closure f) := fun e he f hf hef => by + refine disjoint_left.mpr fun x hx hxf => ?_ + exact disjoint_left.mp (hintV e he) hx (hsub (Cell.closure_inter_subset_V hS hU he hf hef + ⟨hx.1, hxf⟩)) + refine componentsIn_of_partition ?_ ?_ ?_ + · rintro a (ha | ⟨e, he, rfl⟩) + · obtain ⟨x, hx, rfl⟩ := id ha + exact ⟨(hP _ ha).1, isPreconnected_connectedComponentIn, ⟨x, mem_connectedComponentIn hx⟩⟩ + · have hd := Cell.isClosedDisc_closure he + refine ⟨(isOpenDisc_interior hS hd).1, ?_, hintne e he⟩ + have := IsClosedDisc.isPreconnected_diff_frontier hS hd + rwa [IsClosedDisc.frontier_eq_discBd hS hd] at this + · have hreg : ∀ a ∈ Γ.R, ∀ e ∈ Γ.E, ¬ (a ∩ (closure e \ discBd (closure e))).Nonempty := by + rintro a ⟨y, -, rfl⟩ e he ⟨x, hxa, hxe⟩ + exact (connectedComponentIn_subset _ _ hxa).2 (hclU e he hxe.1) + rintro a (ha | ⟨e, he, rfl⟩) b (hb | ⟨f, hf, rfl⟩) hne + · obtain ⟨x, hxa, hxb⟩ := hne + obtain ⟨y, -, rfl⟩ := id ha + obtain ⟨z, -, rfl⟩ := id hb + rw [connectedComponentIn_eq hxa, connectedComponentIn_eq hxb] + · exact (hreg a ha f hf hne).elim + · exact (hreg b hb e he (by rwa [inter_comm] at hne)).elim + · by_cases hef : e = f + · rw [hef] + · obtain ⟨x, hxa, hxb⟩ := hne + exact (disjoint_left.mp (hintint e he f hf hef) hxa hxb.1).elim + · ext x + rw [hDU] + constructor + · rintro ⟨a, ha | ⟨e, he, rfl⟩, hx⟩ + · refine ⟨trivial, ?_⟩ + obtain ⟨y, -, rfl⟩ := id ha + have hxU := (connectedComponentIn_subset _ _ hx).2 + rintro (h | h) + · exact hxU (hV₀ h) + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp h + exact hxU (hclU f hf (discBd_subset _ hxf)) + · refine ⟨trivial, ?_⟩ + rintro (h | h) + · exact disjoint_left.mp (hintV e he) hx h + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp h + by_cases hef : e = f + · subst hef + exact hx.2 hxf + · exact disjoint_left.mp (hintint e he f hf hef) hx (discBd_subset _ hxf) + · rintro ⟨-, hx⟩ + by_cases hxU : x ∈ Γ.U + · rcases Cell.mem_V_or_cell Γ hxU with h | ⟨e, he, hxe⟩ + · exact (hx (Or.inl (hsub h))).elim + · refine ⟨_, Or.inr ⟨e, he, rfl⟩, subset_closure hxe, fun h => hx (Or.inr ?_)⟩ + exact mem_iUnion₂.mpr ⟨e, he, h⟩ + · have hx' : x ∈ univ \ Γ.U := ⟨trivial, hxU⟩ + exact ⟨_, Or.inl ⟨x, hx', rfl⟩, mem_connectedComponentIn hx'⟩ + +/-- **A cell with no vertex is all of a 2-cell painting.** -/ +theorem free_cell (hS : IsClosedSurface S) [ConnectedSpace S] {Γ : Painting S} + (hP : ∀ r ∈ Γ.R, IsOpenDisc r) {e : Set S} (he : e ∈ Γ.E) (hfree : closure e ∩ Γ.V = ∅) : + Γ.V = ∅ ∧ Γ.E = {e} := by + classical + have hU : IsClosed Γ.U := Cell.isClosed_U Γ fun r hr => (hP r hr).1 + have hclU : ∀ e ∈ Γ.E, closure e ⊆ Γ.U := fun e he => + closure_minimal (he.2.1.trans sdiff_subset) hU + have hbdne : ∀ f ∈ Γ.E, (discBd (closure f)).Nonempty := fun f hf => by + obtain ⟨g⟩ := (Cell.isClosedDisc_closure hf).isOArc_discBd + exact ⟨_, (g 1).2⟩ + -- Choose one boundary point for each cell, and add these points to the vertices. + choose! w hw using hbdne + let V₀ : Set S := Γ.V ∪ w '' {f ∈ Γ.E | closure f ∩ Γ.V = ∅} + have hfe : Γ.E.Finite := Γ.finite_edges + have hf₀ : {f ∈ Γ.E | closure f ∩ Γ.V = ∅}.Finite := hfe.subset fun _ h => h.1 + have hfin : V₀.Finite := Γ.finite_V.union (hf₀.image w) + have hV₀U : V₀ ⊆ Γ.U := by + refine union_subset Γ.V_subset_U ?_ + rintro _ ⟨f, hf, rfl⟩ + exact hclU f hf.1 (discBd_subset _ (hw f hf.1)) + -- A vertex of `V₀` in the closure of a cell `f` is on its boundary. + have hbd : ∀ f ∈ Γ.E, V₀ ∩ closure f ⊆ discBd (closure f) := by + rintro f hf x ⟨h | ⟨g, hg, rfl⟩, hxf⟩ + · exact Cell.closure_inter_V_subset hS hf ⟨hxf, h⟩ + · by_cases hfg : f = g + · subst hfg + exact hw f hf + · have := Cell.closure_inter_subset_V hS hU hf hg.1 hfg + ⟨hxf, discBd_subset _ (hw g hg.1)⟩ + have h' : w g ∈ closure g ∩ Γ.V := ⟨discBd_subset _ (hw g hg.1), this⟩ + rw [hg.2] at h' + exact h'.elim + have hne : ∀ f ∈ Γ.E, (V₀ ∩ discBd (closure f)).Nonempty := by + intro f hf + by_cases hc : closure f ∩ Γ.V = ∅ + · exact ⟨w f, Or.inr ⟨f, ⟨hf, hc⟩, rfl⟩, hw f hf⟩ + · obtain ⟨x, hx, hxV⟩ := nonempty_iff_ne_empty.mpr hc + exact ⟨x, Or.inl hxV, Cell.closure_inter_V_subset hS hf ⟨hx, hxV⟩⟩ + obtain ⟨D, hDU, hDV⟩ := exists_boundary_drawing hS hU hfin subset_union_left hne + have hR := boundary_R hS hP subset_union_left hV₀U hbd hDU + have hDisc : ∀ r ∈ D.R, IsOpenDisc r := by + rw [hR] + rintro r (hr | ⟨f, hf, rfl⟩) + · exact hP r hr + · exact isOpenDisc_interior hS (Cell.isClosedDisc_closure hf) + -- Split `U(D)` into the boundary of `e` and the rest. + let C₁ : Set S := discBd (closure e) + let C₂ : Set S := (V₀ \ {w e}) ∪ ⋃ f ∈ Γ.E \ {e}, discBd (closure f) + have hcl₁ : IsClosed C₁ := (isCompact_of_isOArc (Cell.isClosedDisc_closure + he).isOArc_discBd).isClosed + have hcl₂ : IsClosed C₂ := by + refine (hfin.subset sdiff_subset).isClosed.union ((hfe.subset sdiff_subset).isClosed_biUnion + fun f hf => ?_) + exact (isCompact_of_isOArc (Cell.isClosedDisc_closure hf.1).isOArc_discBd).isClosed + have hcapV : V₀ ∩ closure e ⊆ {w e} := by + rintro x ⟨h | ⟨g, hg, rfl⟩, hxe⟩ + · have : x ∈ closure e ∩ Γ.V := ⟨hxe, h⟩ + rw [hfree] at this + exact this.elim + · by_cases hfg : e = g + · rw [hfg] + rfl + · have := Cell.closure_inter_subset_V hS hU he hg.1 hfg ⟨hxe, discBd_subset _ (hw g hg.1)⟩ + have h' : w g ∈ closure e ∩ Γ.V := ⟨hxe, this⟩ + rw [hfree] at h' + exact h'.elim + have hsep : ∀ f ∈ Γ.E, f ≠ e → Disjoint (closure e) (closure f) := by + intro f hf hfe' + refine disjoint_left.mpr fun x hx hxf => ?_ + have := Cell.closure_inter_subset_V hS hU he hf hfe'.symm ⟨hx, hxf⟩ + have h' : x ∈ closure e ∩ Γ.V := ⟨hx, this⟩ + rw [hfree] at h' + exact h' + have hdis : Disjoint C₁ C₂ := by + refine disjoint_left.mpr ?_ + rintro x hx (⟨hxV, hn⟩ | hxU) + · exact hn (hcapV ⟨hxV, discBd_subset _ hx⟩) + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hxU + exact disjoint_left.mp (hsep f hf.1 hf.2) (discBd_subset _ hx) (discBd_subset _ hxf) + have hcover : C₁ ∪ C₂ = D.U := by + rw [hDU] + apply subset_antisymm + · rintro x (hx | ⟨hx, -⟩ | hx) + · exact Or.inr (mem_iUnion₂.mpr ⟨e, he, hx⟩) + · exact Or.inl hx + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + exact Or.inr (mem_iUnion₂.mpr ⟨f, hf.1, hxf⟩) + · rintro x (hx | hx) + · by_cases hxw : x = w e + · exact Or.inl (hxw ▸ hw e he) + · exact Or.inr (Or.inl ⟨hx, hxw⟩) + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + by_cases hfe' : f = e + · subst hfe' + exact Or.inl hxf + · exact Or.inr (Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfe'⟩, hxf⟩)) + have hemp : C₂ = ∅ := eq_empty_of_split hS hDisc hcl₁ hcl₂ hdis hcover ⟨w e, hw e he⟩ + constructor + · refine eq_empty_of_forall_notMem fun x hx => ?_ + have hxw : x ≠ w e := by + intro h + have h' : x ∈ closure e ∩ Γ.V := ⟨h ▸ discBd_subset _ (hw e he), hx⟩ + rw [hfree] at h' + exact h' + have : x ∈ C₂ := Or.inl ⟨Or.inl hx, hxw⟩ + rw [hemp] at this + exact this + · refine eq_singleton_iff_unique_mem.mpr ⟨he, fun f hf => ?_⟩ + by_contra hfe' + have : w f ∈ C₂ := Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfe'⟩, hw f hf⟩) + rw [hemp] at this + exact this + +/-- `RegionFacts` for a 2-cell painting with a cell with no vertex. -/ +theorem regionFacts_of_free_cell (hS : IsClosedSurface S) [ConnectedSpace S] {Γ : Painting S} + {Γ' : Drawing S} (hrad : PreRad (PaintingOrDrawing.painting Γ) Γ') + {e : Set S} (he : e ∈ Γ.E) (hfree : closure e ∩ Γ.V = ∅) : + RegionFacts (PaintingOrDrawing.painting Γ) Γ' := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hP : ∀ r ∈ Γ.R, IsOpenDisc r := hrad.1.2 + obtain ⟨hV, hE⟩ := free_cell hS hP he hfree + have hEΓ' : Γ'.E = ∅ := by + refine eq_empty_of_forall_notMem fun f hf => ?_ + obtain ⟨v, hv, -⟩ := hrad.2.2.2.2.2.1 f hf + have hv' : v ∈ Γ.V := hv + rw [hV] at hv' + exact hv' + have hno : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → False := by + intro C hC hsub + obtain ⟨u, W, -, hpos, -, hE'⟩ := hC + have hne : ∃ f, f ∈ W.edges := by + cases W with + | nil => simp at hpos + | cons h rest => exact ⟨_, List.mem_cons_self⟩ + obtain ⟨f, hf⟩ := hne + have hfC : f ∈ C.E := hE' ▸ hf + have := hsub.2 hfC + rw [hEΓ'] at this + exact this + have heU : Disjoint e Γ'.U := by + refine disjoint_left.mpr fun x hx hx' => ?_ + have h₁ : x ∈ Γ.U ∩ Γ'.U := ⟨(he.2.1 hx).1, hx'⟩ + have h₂ : Γ.U ∩ Γ'.U = Γ.V := hrad.2.1 + exact (he.2.1 hx).2 (h₂ ▸ h₁) + have hcontain : ∀ s ∈ Γ'.R, e ⊆ s := by + intro s hs + obtain ⟨x, hx⟩ := he.1 + obtain ⟨s', hs', hxs'⟩ := exists_region_of_notMem (disjoint_left.mp heU hx) + obtain rfl := region_eq_of_noCircuit hS hno hs hs' + exact subset_region hs (he.2.2.1.isConnected.isPreconnected) heU hx hxs' + refine ⟨fun s hs => ⟨e, he, hcontain s hs⟩, ?_, ?_⟩ + · intro s _ f hf g hg _ _ + have hf' : f ∈ Γ.E := hf + have hg' : g ∈ Γ.E := hg + rw [hE] at hf' hg' + exact hf'.trans hg'.symm + · intro s _ f _ _ v hv + have hv' : v ∈ Γ.V := hv + rw [hV] at hv' + exact hv'.elim + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/PaintingStars.lean b/LeanPool/GraphMinor/GM11/PaintingStars.lean new file mode 100644 index 0000000000..8e322e273f --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PaintingStars.lean @@ -0,0 +1,286 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PaintingRegions + +/-! +# Stars in the cells of a painting + +Let `Γ` be a 2-cell painting with radial drawing `Γ'`, such that each cell has a vertex. We add a +point +`c e` inside each cell `e`, joined by a line to each vertex of `e`. The result `Γ''` is a radial +drawing +of the drawing `D` of the boundaries of the cells (`radial_of_stars`): the regions of `D` are the +regions of `Γ` and the interiors of the cells. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The interior of the cell `e`. -/ +def cellInt (e : Set S) : Set S := closure e \ discBd (closure e) + +/-- The centres and lines of the stars in the cells of a painting. -/ +structure CellStars (Γ : Painting S) (c : Set S → S) (K : Set S → S → Set S) : Prop where + /-- The centre is inside the cell. -/ + hub : ∀ e ∈ Γ.E, c e ∈ cellInt e + /-- A line from the centre to a boundary point. -/ + line : ∀ e ∈ Γ.E, ∀ b ∈ discBd (closure e), IsLineWithEnds (K e b) (c e) b + /-- Apart from its end, the line is inside the cell. -/ + sub : ∀ e ∈ Γ.E, ∀ b ∈ discBd (closure e), K e b \ {b} ⊆ cellInt e + /-- Two lines meet only in the centre. -/ + inter : ∀ e ∈ Γ.E, ∀ b ∈ discBd (closure e), ∀ b' ∈ discBd (closure e), b ≠ b' → + K e b ∩ K e b' = {c e} + +variable [T2Space S] + +/-- A closed disc has a star: a centre, and lines to its boundary points that meet only there. -/ +theorem exists_disc_star {D : Set S} (hD : IsClosedDisc D) : + ∃ (c : S) (K : S → Set S), c ∈ D \ discBd D ∧ + (∀ b ∈ discBd D, IsLineWithEnds (K b) c b) ∧ (∀ b ∈ discBd D, K b \ {b} ⊆ D \ discBd D) ∧ + ∀ b ∈ discBd D, ∀ b' ∈ discBd D, b ≠ b' → K b ∩ K b' = {c} := by + classical + obtain ⟨φ⟩ := id hD + have hbd := disc_boundary D φ + let g : ClosedUnitDisc → I → S := fun z t => (φ (scaleDisc t z)).1 + have hgc : ∀ z, Continuous (g z) := fun z => + continuous_subtype_val.comp (φ.continuous.comp (continuous_scaleDisc z)) + have hbdiff : ∀ z : ClosedUnitDisc, ‖z.1‖ < 1 → (φ z).1 ∉ discBd D := by + intro z hz h + rw [hbd] at h + obtain ⟨w, hw, he⟩ := h + obtain rfl : w = z := φ.injective (Subtype.ext he) + have hw' : ‖w.1‖ = 1 := by simpa [UnitCircle] using hw + linarith + have hsplit : ∀ b ∈ discBd D, ∃ z : ClosedUnitDisc, ‖z.1‖ = 1 ∧ (φ z).1 = b := by + intro b hb + rw [hbd] at hb + obtain ⟨z, hz, rfl⟩ := hb + exact ⟨z, by simpa [UnitCircle] using hz, rfl⟩ + have : Nonempty ClosedUnitDisc := ⟨discCentre⟩ + choose! z hz1 hzb using hsplit + let c : S := (φ discCentre).1 + have hg1 : ∀ w, g w 1 = (φ w).1 := fun w => by simp only [g, scaleDisc_one] + have hg0 : ∀ w, g w 0 = c := fun w => by simp only [g, c, scaleDisc_zero_eq] + have hnorm : ∀ b ∈ discBd D, ∀ t : I, ‖(scaleDisc t (z b)).1‖ = t := fun b hb t => by + rw [norm_scaleDisc, hz1 b hb, mul_one] + have hinj : ∀ b ∈ discBd D, Function.Injective (g (z b)) := by + intro b hb s t h + have h' := φ.injective (Subtype.ext h) + have := congrArg (fun w : ClosedUnitDisc => ‖w.1‖) h' + simp only [hnorm b hb] at this + exact Subtype.ext this + refine ⟨c, fun b => range (g (z b)), ⟨(φ _).2, hbdiff _ (by simp [discCentre])⟩, ?_, ?_, ?_⟩ + · intro b hb + have := isLine_range (hgc (z b)) (hinj b hb) + rwa [hg0, hg1, hzb b hb] at this + · rintro b hb _ ⟨⟨t, rfl⟩, hn⟩ + refine ⟨(φ _).2, hbdiff _ ?_⟩ + rw [hnorm b hb] + refine lt_of_le_of_ne t.2.2 fun h => hn ?_ + have ht : t = 1 := Subtype.ext h + rw [ht, hg1, hzb b hb] + rfl + · intro b hb b' hb' hne + apply subset_antisymm + · rintro _ ⟨⟨t, rfl⟩, ⟨t', ht'⟩⟩ + have h' := φ.injective (Subtype.ext ht') + have hn := congrArg (fun w : ClosedUnitDisc => ‖w.1‖) h' + simp only [hnorm b hb, hnorm b' hb'] at hn + have htt : t' = t := Subtype.ext hn + subst htt + by_cases h0 : t' = 0 + · rw [h0, hg0] + rfl + · exfalso + have hpos : (t' : ℝ) ≠ 0 := fun h => h0 (Subtype.ext h) + have hv := congrArg (fun w : ClosedUnitDisc => w.1) h' + have hzz : (z b').1 = (z b).1 := smul_right_injective _ hpos hv + exact hne (by rw [← hzb b hb, ← hzb b' hb', Subtype.ext hzz]) + · rintro _ rfl + exact ⟨⟨0, hg0 _⟩, ⟨0, hg0 _⟩⟩ + +theorem exists_cellStars [Nonempty S] {Γ : Painting S} : + ∃ (c : Set S → S) (K : Set S → S → Set S), CellStars Γ c K := by + classical + have h : ∀ e ∈ Γ.E, ∃ (c : S) (K : S → Set S), c ∈ cellInt e ∧ + (∀ b ∈ discBd (closure e), IsLineWithEnds (K b) c b) ∧ + (∀ b ∈ discBd (closure e), K b \ {b} ⊆ cellInt e) ∧ + ∀ b ∈ discBd (closure e), ∀ b' ∈ discBd (closure e), b ≠ b' → K b ∩ K b' = {c} := + fun e he => exists_disc_star (Cell.isClosedDisc_closure he) + choose! c K h₁ h₂ h₃ h₄ using h + exact ⟨c, K, h₁, h₂, h₃, h₄⟩ + +/-- The pairs of a cell and a vertex of it. -/ +def cellPairs (Γ : Painting S) : Set (Set S × S) := {t | t.1 ∈ Γ.E ∧ t.2 ∈ Γ.V ∧ t.2 ∈ closure t.1} + +omit [T2Space S] in +theorem finite_cellPairs (Γ : Painting S) : (cellPairs Γ).Finite := by + have hfe : Γ.E.Finite := Γ.finite_edges + exact (hfe.prod Γ.finite_V).subset fun t ht => ⟨ht.1, ht.2.1⟩ + +variable {Γ : Painting S} {Γ' : Drawing S} {c : Set S → S} {K : Set S → S → Set S} + +/-- The drawing `Γ'` with the stars of the cells. -/ +structure IsStarDrawing (Γ : Painting S) (Γ' : Drawing S) (c : Set S → S) (K : Set S → S → Set S) + (G : Drawing S) : Prop where + /-- The point set. -/ + U : G.U = Γ'.U ∪ ⋃ t ∈ cellPairs Γ, K t.1 t.2 + /-- The vertices. -/ + V : G.V = Γ'.V ∪ (fun t : Set S × S => c t.1) '' cellPairs Γ + /-- The edges. -/ + E : G.E = Γ'.E ∪ (fun t : Set S × S => K t.1 t.2 \ {c t.1, t.2}) '' cellPairs Γ + +section + +variable (hrad : PreRad (PaintingOrDrawing.painting Γ) Γ') (hst : CellStars Γ c K) + (hS : IsClosedSurface S) + +omit [T2Space S] in +theorem cell_isClosed_U (hrad : PreRad (PaintingOrDrawing.painting Γ) Γ') : + IsClosed Γ.U := + Cell.isClosed_U Γ fun r hr => (hrad.1.2 r hr).1 + +omit [T2Space S] in +theorem closure_subset_cell_U (hrad : PreRad (PaintingOrDrawing.painting Γ) Γ') {e : Set S} + (he : e ∈ Γ.E) : closure e ⊆ Γ.U := + closure_minimal (he.2.1.trans sdiff_subset) (cell_isClosed_U hrad) + +omit [T2Space S] in +theorem cellInt_subset_U (hrad : PreRad (PaintingOrDrawing.painting Γ) Γ') {e : Set S} + (he : e ∈ Γ.E) : cellInt e ⊆ Γ.U := + sdiff_subset.trans (closure_subset_cell_U hrad he) + +omit [T2Space S] in +theorem cellInt_disjoint_V (hS : IsClosedSurface S) {e : Set S} (he : e ∈ Γ.E) : + Disjoint (cellInt e) Γ.V := + disjoint_left.mpr fun _ hx hxV => hx.2 (Cell.closure_inter_V_subset hS he ⟨hx.1, hxV⟩) + +omit [T2Space S] in +theorem cellInt_disjoint (hrad : PreRad (PaintingOrDrawing.painting Γ) Γ') + (hS : IsClosedSurface S) {e f : Set S} (he : e ∈ Γ.E) (hf : f ∈ Γ.E) (hef : e ≠ f) : + Disjoint (cellInt e) (closure f) := + disjoint_left.mpr fun _ hx hxf => disjoint_left.mp (cellInt_disjoint_V hS he) hx + (Cell.closure_inter_subset_V hS (cell_isClosed_U hrad) he hf hef ⟨hx.1, hxf⟩) + +include hst in +omit [T2Space S] in +theorem star_subset_closure {e : Set S} (he : e ∈ Γ.E) {b : S} (hb : b ∈ discBd (closure e)) : + K e b ⊆ closure e := fun x hx => by + by_cases hxb : x = b + · exact hxb ▸ discBd_subset _ hb + · exact (hst.sub e he b hb ⟨hx, hxb⟩).1 + +include hst hS + +omit [T2Space S] in +theorem hub_notMem_V {e : Set S} (he : e ∈ Γ.E) : c e ∉ Γ.V := + disjoint_left.mp (cellInt_disjoint_V hS he) (hst.hub e he) + +include hrad + +omit [T2Space S] in +/-- A point of a line of a star that lies in `Γ'` is the vertex at the end of the line. -/ +theorem star_inter_U {t : Set S × S} (ht : t ∈ cellPairs Γ) {x : S} (hx : x ∈ K t.1 t.2) + (hx' : x ∈ Γ'.U) : x = t.2 := by + have hb := Cell.closure_inter_V_subset hS ht.1 ⟨ht.2.2, ht.2.1⟩ + have hxU : x ∈ Γ.U := closure_subset_cell_U hrad ht.1 (star_subset_closure hst ht.1 hb hx) + have hxV : x ∈ Γ.V := (show Γ.U ∩ Γ'.U = Γ.V from hrad.2.1) ▸ ⟨hxU, hx'⟩ + by_contra hne + exact disjoint_left.mp (cellInt_disjoint_V hS ht.1) (hst.sub _ ht.1 _ hb ⟨hx, hne⟩) hxV + +/-- `Γ'` together with the stars is a drawing. -/ +theorem exists_star_drawing : ∃ G : Drawing S, IsStarDrawing Γ Γ' c K G := by + classical + have key : ∀ F : Finset (Set S × S), (∀ t ∈ F, t ∈ cellPairs Γ) → ∃ G : Drawing S, + G.U = Γ'.U ∪ (⋃ t ∈ F, K t.1 t.2) ∧ + G.V = Γ'.V ∪ (fun t : Set S × S => c t.1) '' F ∧ + G.E = Γ'.E ∪ (fun t : Set S × S => K t.1 t.2 \ {c t.1, t.2}) '' F := by + intro F + induction F using Finset.induction_on with + | empty => + intro _ + exact ⟨Γ', by simp, by simp, by simp⟩ + | insert t F htF ih => + intro hF + obtain ⟨G, hU, hV, hE⟩ := ih fun u hu => hF u (Finset.mem_insert_of_mem hu) + have ht := hF t (Finset.mem_insert_self _ _) + obtain ⟨e, b⟩ := t + have he : e ∈ Γ.E := ht.1 + have hbV : b ∈ Γ.V := ht.2.1 + have hb : b ∈ discBd (closure e) := Cell.closure_inter_V_subset hS he ⟨ht.2.2, hbV⟩ + have hL := hst.line e he b hb + have hcb : c e ≠ b := fun h => hub_notMem_V hst hS he (h ▸ hbV) + have hbG : b ∈ G.V := hV ▸ Or.inl (hrad.2.2.1 hbV) + have hmeet : G.U ∩ (lineDrawing hL hcb).U ⊆ G.V ∩ (lineDrawing hL hcb).V := by + rintro x ⟨hxG, hxL⟩ + have hxL' : x ∈ K e b := hxL + by_cases hxb : x = b + · subst hxb + exact ⟨hbG, Or.inr rfl⟩ + have hxint := hst.sub e he b hb ⟨hxL', hxb⟩ + rw [hU] at hxG + rcases hxG with hx' | hx' + · exact (hxb (star_inter_U hrad hst hS ht hxL' hx')).elim + · obtain ⟨⟨e', b'⟩, ht', hx''⟩ := mem_iUnion₂.mp hx' + have ht'P := hF _ (Finset.mem_insert_of_mem ht') + have he' : e' ∈ Γ.E := ht'P.1 + have hb' : b' ∈ discBd (closure e') := + Cell.closure_inter_V_subset hS he' ⟨ht'P.2.2, ht'P.2.1⟩ + have hxK : x ∈ K e' b' := hx'' + by_cases hee : e = e' + · subst hee + have hbb : b ≠ b' := fun h => htF (by rw [h]; exact ht') + have : x ∈ K e b ∩ K e b' := ⟨hxL', hxK⟩ + rw [hst.inter e he b hb b' hb' hbb] at this + have hxc : x = c e := this + refine ⟨?_, Or.inl hxc⟩ + rw [hV, hxc] + exact Or.inr ⟨(e, b'), ht', rfl⟩ + · exact (disjoint_left.mp (cellInt_disjoint hrad hS he he' hee) hxint + (star_subset_closure hst he' hb' hxK)).elim + refine ⟨G.glue (lineDrawing hL hcb) hmeet, ?_, ?_, ?_⟩ + · change G.U ∪ K e b = _ + rw [hU, Finset.set_biUnion_insert, union_assoc, union_comm (⋃ t ∈ F, K t.1 t.2) (K e b)] + · change G.V ∪ {c e, b} = _ + rw [hV, Finset.coe_insert, image_insert_eq] + ext x + simp only [mem_union, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ((h | h) | (h | h)) + · exact Or.inl h + · exact Or.inr (Or.inr h) + · exact Or.inr (Or.inl h) + · exact Or.inl (h ▸ hrad.2.2.1 hbV) + · rintro (h | h | h) + · exact Or.inl (Or.inl h) + · exact Or.inr (Or.inl h) + · exact Or.inl (Or.inr h) + · rw [Drawing.glue_E, lineDrawing_E, hE, Finset.coe_insert, image_insert_eq, union_assoc] + congr 1 + rw [union_comm, ← insert_eq] + have hfin := finite_cellPairs Γ + obtain ⟨G, hU, hV, hE⟩ := key hfin.toFinset fun t ht => hfin.mem_toFinset.mp ht + refine ⟨G, ⟨?_, ?_, ?_⟩⟩ + · rw [hU] + simp only [hfin.mem_toFinset] + · rw [hV, hfin.coe_toFinset] + · rw [hE, hfin.coe_toFinset] + +end + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/PaintingTwoCell.lean b/LeanPool/GraphMinor/GM11/PaintingTwoCell.lean new file mode 100644 index 0000000000..fa5fad6968 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PaintingTwoCell.lean @@ -0,0 +1,500 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PaintingFacts +public import LeanPool.GraphMinor.GM11.RadialTwoCell + +/-! +# A radial drawing of a painting is 2-cell + +Graph Minors XI, Section 3 (page 75): "$\Gamma'$ is 2-cell", for a 2-cell painting `Γ`. + +Let `D` be the drawing of the boundaries of the cells, and `G` a radial drawing of `D` made from +`Γ'` by +adding a star in each cell. Let `s` be a region of `Γ'`, and let `e` be the cell in `s`. Each edge +`a` of +`D` in `e` has two regions of `D ∪ G` beside it. One lies inside the cell. Call the other one `f a`, +and +it lies outside the cell (`exists_inner_outer`). Now `s` is the interior of `e`, with each `a` and +each +`f a` added. We add them one at a time with `glue_open_discs`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval Metric + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +omit [ConnectedSpace S] in +/-- Beside a point of an edge, the two regions and the edge fill an open set. -/ +theorem exists_open_sides (hS : IsClosedSurface S) {F : Drawing S} {a u f : Set S} (ha : a ∈ F.E) + (hu : u ∈ F.R) (hf : f ∈ F.R) (hne : u ≠ f) (hau : a ⊆ closure u) (haf : a ⊆ closure f) : + ∃ y ∈ a, ∃ O, IsOpen O ∧ y ∈ O ∧ O ⊆ u ∪ f ∪ a := by + obtain ⟨γ, hγ, h0, h1, hinj, hγe⟩ := exists_edge_param F ha + let t₀ : I := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht₀ : t₀ ∈ Ioo (0 : I) 1 := ⟨show (0 : ℝ) < 1 / 2 by norm_num, show + (1 / 2 : ℝ) < 1 by norm_num⟩ + obtain ⟨G, c₁, c₂, g₁, g₂, g₃, g₄, g₅, g₆, g₇, g₈, g₉, g₁₀, g₁₁⟩ := + exists_edge_chart hS F ha hγ h0 h1 hinj hγe ht₀ ht₀.1 ht₀.2 + have c : IsEdgeChart F γ t₀ G c₁ c₂ := ⟨g₁, g₂, g₄, g₅, g₇, g₈, g₉, g₁₀, g₁₁⟩ + have hy : γ t₀ ∈ a := hγe ▸ mem_image_of_mem γ ht₀ + have hsub : γ '' Ioo c₁ c₂ ⊆ a := by + rw [← hγe] + refine image_mono fun t ht => ⟨?_, ?_⟩ + · exact g₃.trans ht.1 + · exact ht.2.trans g₆ + have hsd : G '' IsEdgeChart.lower ⊆ u ∪ f ∧ G '' IsEdgeChart.upper ⊆ u ∪ f := by + rcases c.sides hS hu hf hne (hau hy) (haf hy) with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact ⟨h₁.trans subset_union_left, h₂.trans subset_union_right⟩ + · exact ⟨h₁.trans subset_union_right, h₂.trans subset_union_left⟩ + refine ⟨γ t₀, hy, G '' ball 0 1, c.isOpen_image_ball hS, ⟨0, by simp, g₇⟩, ?_⟩ + rintro _ ⟨z, hz, rfl⟩ + rcases IsEdgeChart.cases_of_closedBall (ball_subset_closedBall hz) with h | h | h + · exact Or.inl (hsd.1 ⟨z, h, rfl⟩) + · exact Or.inr (hsub (g₉ ▸ mem_image_of_mem G ⟨hz, h⟩)) + · exact Or.inl (hsd.2 ⟨z, h, rfl⟩) + +omit [ConnectedSpace S] in +/-- Let `a` be an edge of `F` in the boundary of a closed disc `N`, and let `u, f` be the regions +beside +`a`. If each of `u, f` lies in the interior of `N` or misses `N`, then one of them does each. -/ +theorem exists_inner_outer (hS : IsClosedSurface S) {F : Drawing S} {a u f N : Set S} (ha : a ∈ F.E) + (hu : u ∈ F.R) (hf : f ∈ F.R) (hne : u ≠ f) (hau : a ⊆ closure u) (haf : a ⊆ closure f) + (hN : IsClosedDisc N) (haN : a ⊆ discBd N) (hcu : u ⊆ discInt N ∨ Disjoint u N) + (hcf : f ⊆ discInt N ∨ Disjoint f N) : + (u ⊆ discInt N ∧ Disjoint f N) ∨ (f ⊆ discInt N ∧ Disjoint u N) := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + obtain ⟨y, hy, O, hO, hyO, hsub⟩ := exists_open_sides hS ha hu hf hne hau haf + rcases hcu with h₁ | h₁ <;> rcases hcf with h₂ | h₂ + · have hsN : O ⊆ N := hsub.trans (union_subset (union_subset (h₁.trans sdiff_subset) + (h₂.trans sdiff_subset)) (haN.trans (discBd_subset N))) + have hin : y ∈ interior N := mem_interior.mpr ⟨O, hsN, hO, hyO⟩ + rw [interior_eq_sdiff_discBd hS hN] at hin + exact (hin.2 (haN hy)).elim + · exact Or.inl ⟨h₁, h₂⟩ + · exact Or.inr ⟨h₂, h₁⟩ + · have hcl : y ∈ closure (discInt N) := hN.subset_closure_discInt (discBd_subset N (haN hy)) + obtain ⟨x, hxO, hxN⟩ := mem_closure_iff.mp hcl O hO hyO + rcases hsub hxO with (h | h) | h + · exact (disjoint_left.mp h₁ h hxN.1).elim + · exact (disjoint_left.mp h₂ h hxN.1).elim + · exact (hxN.2 (haN h)).elim + +variable {Γ : Painting S} {Γ' : Drawing S} + +/-- A vertex-free cell gives a sphere and a cover that locates the radial vertices in one +painting region. -/ +theorem free_cell_disc_cover (hS : IsClosedSurface S) + (hrad : PreRad (PaintingOrDrawing.painting Γ) Γ') {e : Set S} (he : e ∈ Γ.E) + (hfree : closure e ∩ Γ.V = ∅) : + IsSphere S ∧ Γ'.U = Γ'.V ∧ + ∃ D Δ r : Set S, D ∪ Δ = univ ∧ Disjoint D Γ'.V ∧ r ∈ Γ.R ∧ Δ ⊆ r := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hP : ∀ r ∈ Γ.R, IsOpenDisc r := hrad.1.2 + obtain ⟨hV, hE⟩ := free_cell hS hP he hfree + have hEΓ' : Γ'.E = ∅ := by + refine eq_empty_of_forall_notMem fun f hf => ?_ + obtain ⟨v, hv, -⟩ := hrad.2.2.2.2.2.1 f hf + have hv' : v ∈ Γ.V := hv + rw [hV] at hv' + exact hv' + have hU'V : Γ'.U = Γ'.V := by + rw [Γ'.U_eq, hEΓ'] + simp + have hN : IsClosedDisc (closure e) := Cell.isClosedDisc_closure he + have hUΓ : closure e ⊆ Γ.U := closure_subset_cell_U hrad he + have hNV' : Disjoint (closure e) Γ'.V := by + refine disjoint_left.mpr fun x hx hxV => ?_ + have h₁ : x ∈ Γ.U ∩ Γ'.U := ⟨hUΓ hx, Γ'.V_subset_U hxV⟩ + have h₂ : Γ.U ∩ Γ'.U = Γ.V := hrad.2.1 + have h₃ := h₂ ▸ h₁ + rw [hV] at h₃ + exact h₃ + have hW : IsOpen Γ'.Vᶜ := Γ'.finite_V.isClosed.isOpen_compl + obtain ⟨D, hD, hND, hDsub⟩ := exists_disc_around hman hN (fun x _ => hS.2.2 x) hW + (fun x hx h => disjoint_left.mp hNV' (discBd_subset _ hx) h) + have hDV : Disjoint D Γ'.V := by + refine disjoint_left.mpr fun x hx hxV => ?_ + rcases hDsub hx with h | h + · exact disjoint_left.mp hNV' h hxV + · exact h hxV + have hF := hD.isOArc_discBd + have hUe : Γ.U ⊆ closure e := by + intro x hx + rcases Cell.mem_V_or_cell Γ hx with h | ⟨f, hf, hxf⟩ + · rw [hV] at h + exact h.elim + · have hf' : f ∈ Γ.E := hf + rw [hE] at hf' + exact subset_closure (hf' ▸ hxf) + have hbU : Disjoint (discBd D) Γ.U := by + refine disjoint_left.mpr fun x hx hxU => ?_ + exact (hND (hUe hxU)).2 hx + have hbne : (discBd D).Nonempty := by + obtain ⟨φ⟩ := hF + exact ⟨_, (φ 1).2⟩ + obtain ⟨y, hy⟩ := hbne + obtain ⟨r, hr, hyr⟩ : ∃ r ∈ Γ.R, y ∈ r := by + have hy' : y ∈ univ \ Γ.U := ⟨trivial, disjoint_left.mp hbU hy⟩ + exact ⟨_, ⟨y, hy', rfl⟩, mem_connectedComponentIn hy'⟩ + have hrU : Disjoint r Γ.U := by + obtain ⟨z, hz, rfl⟩ := hr + exact disjoint_left.mpr fun x hx h => (connectedComponentIn_subset _ _ hx).2 h + have hbconn : IsPreconnected (discBd D) := by + obtain ⟨φ⟩ := id hF + have : discBd D = range fun z => (φ z).1 := by + ext y + exact ⟨fun hy => ⟨φ.symm ⟨y, hy⟩, by simp⟩, by rintro ⟨z, rfl⟩; exact (φ z).2⟩ + rw [this] + exact isPreconnected_range (by fun_prop) + have hbr : discBd D ⊆ r := by + obtain ⟨z, hz, rfl⟩ := hr + rw [connectedComponentIn_eq hyr] + exact hbconn.subset_connectedComponentIn hy fun x hx => ⟨trivial, disjoint_left.mp hbU hx⟩ + obtain ⟨Δ, hΔr, hΔ, hb⟩ := exists_disc_in_openDisc (hP r hr) hF hbr + have hne : D ≠ Δ := by + rintro rfl + obtain ⟨x, hx⟩ := he.1 + exact disjoint_left.mp hrU (hΔr (hND (subset_closure hx)).1) (hUΓ (subset_closure hx)) + have hcov := cover_of_discBd_eq hS hD hΔ hb.symm hne + have hsph : IsSphere S := by + by_contra hsph + exact hne (eq_of_discBd_eq (IsClosedSurface.isSurface hS) hsph hD hΔ hb.symm) + exact ⟨hsph, hU'V, D, Δ, r, hcov, hDV, hr, hΔr⟩ + +/-- If a 2-cell painting has a cell with no vertex, each region of its radial drawing is an open +disc. +In this case the cell and a closed disc in the region fill the surface, so the surface is a sphere, +and +`Γ'` is one point. -/ +theorem region_isOpenDisc_of_free_cell (hS : IsClosedSurface S) + (hrad : PreRad (PaintingOrDrawing.painting Γ) Γ') {e : Set S} (he : e ∈ Γ.E) + (hfree : closure e ∩ Γ.V = ∅) {s : Set S} (hs : s ∈ Γ'.R) : IsOpenDisc s := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hsph, hU'V, D, Δ, r, hcov, hDV, hr, hΔr⟩ := + free_cell_disc_cover hS hrad he hfree + -- All vertices of `Γ'` are the vertex of `r`. + obtain ⟨c, ⟨hc, hcV⟩, -⟩ := hrad.2.2.2.1 r hr + have hc' : c ∈ r := hc + have hcV' : c ∈ Γ'.V := hcV + have hall : ∀ w ∈ Γ'.V, w = c := by + intro w hw + have hwr : w ∈ r := by + rcases (hcov ▸ mem_univ w : w ∈ D ∪ Δ) with h | h + · exact (disjoint_left.mp hDV h hw).elim + · exact hΔr h + exact (hrad.2.2.2.1 r hr).unique ⟨hwr, hw⟩ ⟨hc', hcV'⟩ + have hcs : c ∉ s := fun h => region_subset hs h (Γ'.V_subset_U hcV') + have hdisc := open_disc S s hS inferInstance + ⟨region_nonempty hs, region_isPreconnected hs⟩ (region_isOpen hs) ?_ + · rcases hdisc with ⟨-, h⟩ | h + · exact (hcs (h ▸ mem_univ c)).elim + · exact h + intro F hFs hFO + obtain ⟨Δ₁, Δ₂, -, h₁, h₂, hb₁, hb₂, hc₁, hc₂, -, -⟩ := sphere_disc S hsph F hFO + have hcF : c ∉ F := fun h => region_subset hs (hFs h) (Γ'.V_subset_U hcV') + have key : ∀ A : Set S, IsClosedDisc A → discBd A = F → c ∉ A → + ∃ Δ : Set S, Δ ⊆ s ∧ IsClosedDisc Δ ∧ discBd Δ = F := by + intro A hA hbA hcA + obtain ⟨z, hz⟩ : F.Nonempty := by + obtain ⟨φ⟩ := hFO + exact ⟨_, (φ 1).2⟩ + have hconn : IsPreconnected A := by + obtain ⟨h, g, c'⟩ := hA.exists_isChart + rw [← c'.g_closedBall] + exact (convex_closedBall _ _).isPreconnected.image _ c'.gc + have hdis : Disjoint A Γ'.U := by + rw [hU'V] + exact disjoint_left.mpr fun x hx hxV => hcA (hall x hxV ▸ hx) + exact ⟨A, subset_region hs hconn hdis (discBd_subset A (hbA.symm.subset hz)) (hFs hz), hA, hbA⟩ + by_cases hc₁' : c ∈ Δ₁ + · refine key Δ₂ h₂ hb₂ fun hc₂' => hcF ?_ + exact hc₂ ▸ (⟨hc₁', hc₂'⟩ : c ∈ Δ₁ ∩ Δ₂) + · exact key Δ₁ h₁ hb₁ hc₁' + +private theorem adjacent_regions_of_cell_edge (hS : IsClosedSurface S) + (hrad : PreRad (PaintingOrDrawing.painting Γ) Γ') {D G : Drawing S} + (hU : IsClosed Γ.U) (hDU : D.U = Γ.V ∪ ⋃ e ∈ Γ.E, discBd (closure e)) + (hDV : D.V = Γ.V) (hDR : D.R = Γ.R ∪ cellInt '' Γ.E) + (hrG : PreRad (PaintingOrDrawing.drawing D) G) + (hmG : RadMax (PaintingOrDrawing.drawing D) G) {e : Set S} (he : e ∈ Γ.E) : + let F := radialUnion hrG + ∀ a ∈ D.E, a ⊆ e → ∃ u ∈ F.R, ∃ f ∈ F.R, u ≠ f ∧ a ⊆ closure u ∧ a ⊆ closure f ∧ + u ⊆ cellInt e ∧ Disjoint f (closure e) ∧ ∀ p ∈ G.R, a ⊆ p → p = u ∪ f ∪ a := by + intro F + have hFE : ∀ {a}, a ∈ D.E → a ∈ F.E := fun {a} ha => by + change a ∈ (radialUnion hrG).E + rw [radialUnion_E] + exact Or.inl ha + have hN : IsClosedDisc (closure e) := Cell.isClosedDisc_closure he + have hNU : closure e ⊆ Γ.U := closure_subset_cell_U hrad he + intro a ha hae + have hadis : Disjoint a G.U := edge_disjoint hrG ha + obtain ⟨y, hy⟩ := ha.1 + obtain ⟨p, hp, hyp⟩ := exists_region_of_notMem (disjoint_left.mp hadis hy) + have hap : a ⊆ p := subset_region hp ha.2.2.1.isConnected.isPreconnected hadis hy hyp + have hDE : D.E.Nonempty := ⟨a, ha⟩ + obtain ⟨u, hu, f, hf, hne, hau, haf, hpeq⟩ := region_eq_two_faces hrG hS hmG hDE hp ha hap + have haN : a ⊆ discBd (closure e) := by + intro x hx + have hxU := (ha.2.1 hx).1 + rw [hDU] at hxU + rcases hxU with h | h + · exact ((ha.2.1 hx).2 (hDV.symm.subset h)).elim + · obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h + have hxV : x ∉ Γ.V := fun h' => (ha.2.1 hx).2 (hDV.symm.subset h') + have hxg' : x ∈ g := Cell.closure_sdiff_V hS hU hg ▸ + (⟨discBd_subset _ hxg, hxV⟩ : x ∈ closure g \ Γ.V) + rwa [arcComponent_eq hg he hxg' (hae hx)] at hxg + have hclass : ∀ w ∈ F.R, a ⊆ closure w → w ⊆ discInt (closure e) ∨ Disjoint w (closure e) := by + intro w hw haw + obtain ⟨r, hr, hwr⟩ := exists_region_of_sub hrG hw + have hr' : r ∈ D.R := hr + rw [hDR] at hr' + rcases hr' with h | ⟨g, hg, rfl⟩ + · refine Or.inr (disjoint_left.mpr fun x hx hxe => ?_) + obtain ⟨z, hz, rfl⟩ := h + exact (connectedComponentIn_subset _ _ (hwr hx)).2 (hNU hxe) + · have hyg : y ∈ closure g := + closure_minimal (hwr.trans sdiff_subset) isClosed_closure (haw hy) + have hyV : y ∉ Γ.V := fun h' => (ha.2.1 hy).2 (hDV.symm.subset h') + have hyg' : y ∈ g := Cell.closure_sdiff_V hS hU hg ▸ (⟨hyg, hyV⟩ : y ∈ closure g \ Γ.V) + obtain rfl := arcComponent_eq hg he hyg' (hae hy) + exact Or.inl hwr + rcases exists_inner_outer hS (hFE ha) hu hf hne hau haf hN haN (hclass u hu hau) + (hclass f hf haf) with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · refine ⟨u, hu, f, hf, hne, hau, haf, h₁, h₂, fun p' hp' hap' => ?_⟩ + obtain rfl := region_eq_of_mem hp' hp (hap' hy) hyp + exact hpeq + · refine ⟨f, hf, u, hu, hne.symm, haf, hau, h₁, h₂, fun p' hp' hap' => ?_⟩ + obtain rfl := region_eq_of_mem hp' hp (hap' hy) hyp + rw [hpeq, union_comm u f] + +/-- **Each region of a radial drawing of a 2-cell painting is an open disc.** -/ +theorem painting_region_isOpenDisc (hS : IsClosedSurface S) + (hrad : PreRad (PaintingOrDrawing.painting Γ) Γ') (hmax : RadMax (PaintingOrDrawing.painting Γ) + Γ') + {s : Set S} (hs : s ∈ Γ'.R) : IsOpenDisc s := by + classical + by_cases hfree : ∃ e ∈ Γ.E, closure e ∩ Γ.V = ∅ + · obtain ⟨e, he, hf⟩ := hfree + exact region_isOpenDisc_of_free_cell hS hrad he hf hs + have hv : ∀ e ∈ Γ.E, (closure e ∩ Γ.V).Nonempty := fun e he => by + by_contra h + exact hfree ⟨e, he, not_nonempty_iff_eq_empty.mp h⟩ + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hneS : Nonempty S := ⟨(region_nonempty hs).some⟩ + have hU : IsClosed Γ.U := cell_isClosed_U hrad + obtain ⟨c, K, hst⟩ := exists_cellStars (Γ := Γ) + obtain ⟨G, hG⟩ := exists_star_drawing hrad hst hS + have hbd : ∀ e ∈ Γ.E, Γ.V ∩ closure e ⊆ discBd (closure e) := fun e he x hx => + Cell.closure_inter_V_subset hS he ⟨hx.2, hx.1⟩ + obtain ⟨D, hDU, hDV⟩ := exists_boundary_drawing hS hU Γ.finite_V Subset.rfl fun e he => by + obtain ⟨x, hx, hxV⟩ := hv e he + exact ⟨x, hxV, hbd e he ⟨hxV, hx⟩⟩ + have hDR : D.R = Γ.R ∪ cellInt '' Γ.E := + boundary_R hS hrad.1.2 Subset.rfl Γ.V_subset_U hbd hDU + have hGrad := radial_of_stars hrad hst hS hG hDU hDV hv hmax hDR + have hrG : PreRad (PaintingOrDrawing.drawing D) G := ⟨hGrad.1, hGrad.2.1⟩ + have hmG := hGrad.2.2 + by_cases hE : (PaintingOrDrawing.painting Γ).E.Nonempty + swap + · -- With no cell, `G` is `Γ'`. + have hE₀ : Γ.E = ∅ := not_nonempty_iff_eq_empty.mp hE + have hUU : G.U = Γ'.U := by + rw [hG.U] + have : cellPairs Γ = ∅ := by + refine eq_empty_of_forall_notMem fun t ht => ?_ + have h := ht.1 + rw [hE₀] at h + exact h + simp [this] + have hsG : s ∈ G.R := by + change s ∈ componentsIn (univ \ G.U) + rw [hUU] + exact hs + exact radial_region_isOpenDisc hrG hS hmG hsG + obtain ⟨hex, huniq, -⟩ := regionFacts_of_painting hrad hmax hS hE + obtain ⟨e, he, hes⟩ := hex s hs + have he' : e ∈ Γ.E := he + have hhuniq : ∀ f ∈ Γ.E, f ⊆ s → f = e := fun f hf hfs => huniq s hs f hf e he hfs hes + have hedge : ∀ x ∈ D.U, x ∉ D.V → ∃ a ∈ D.E, x ∈ a := fun x hx hn => + exists_mem_arcComponent ⟨hx, hn⟩ + have hDUsub : D.U ⊆ Γ.U := D_U_subset hrad hDU + have hUU' : Γ.U ∩ Γ'.U = Γ.V := hrad.2.1 + have hcellV : ∀ e ∈ Γ.E, Disjoint e Γ.V := fun e he => + disjoint_left.mpr fun x hx h => (he.2.1 hx).2 h + have hcell : ∀ a ∈ D.E, ∃ e ∈ Γ.E, a ⊆ e := by + intro a ha + have hsub : a ⊆ Γ.U \ Γ.V := fun x hx => by + have h := ha.2.1 hx + exact ⟨hDUsub h.1, fun hV => h.2 (hDV.symm.subset hV)⟩ + obtain ⟨x, hx⟩ := ha.1 + obtain ⟨e, he, hxe⟩ := exists_mem_arcComponent (hsub hx) + refine ⟨e, he, ?_⟩ + have hu : IsPathConnected (e ∪ a) := he.2.2.1.union ha.2.2.1 ⟨x, hxe, hx⟩ + have := he.2.2.2 _ (union_subset he.2.1 hsub) hu subset_union_left + exact this ▸ subset_union_right + have hcellU' : ∀ e ∈ Γ.E, Disjoint e Γ'.U := fun e he => + disjoint_left.mpr fun x hx h => disjoint_left.mp (hcellV e he) hx + (hUU'.subset ⟨(he.2.1 hx).1, h⟩) + have hG_U : Γ'.U ⊆ G.U := fun x hx => hG.U ▸ Or.inl hx + have hstarU : G.U ⊆ Γ'.U ∪ Γ.U := by + rw [hG.U] + refine union_subset_union_right _ (iUnion₂_subset fun t ht => ?_) + have hb := Cell.closure_inter_V_subset hS ht.1 ⟨ht.2.2, ht.2.1⟩ + exact (star_subset_closure hst ht.1 hb).trans (closure_subset_cell_U hrad ht.1) + let F : Drawing S := radialUnion hrG + have hFU : F.U = D.U ∪ G.U := rfl + have hFE : ∀ {a}, a ∈ D.E → a ∈ F.E := fun {a} ha => by + change a ∈ (radialUnion hrG).E + rw [radialUnion_E] + exact Or.inl ha + have hFdis : ∀ {p}, p ∈ F.R → Disjoint p G.U := fun {p} hp => + disjoint_left.mpr fun x hx h => region_subset hp hx (Or.inr h) + have hN : IsClosedDisc (closure e) := Cell.isClosedDisc_closure he' + have hNU : closure e ⊆ Γ.U := closure_subset_cell_U hrad he' + have hDint : Disjoint (cellInt e) D.U := cellInt_disjoint_D hrad hS hDU he' + have hside := adjacent_regions_of_cell_edge hS hrad hU hDU hDV hDR hrG hmG he' + choose! u hu f hf hne hcu hcf hui hfo hpe using hside + let M : Set (Set S) → Set S := fun A => cellInt e ∪ ⋃ a ∈ A, (a ∪ f a) + let Aall : Set (Set S) := {a | a ∈ D.E ∧ a ⊆ e} + have hAll : Aall.Finite := D.finite_edges.subset fun _ h => h.1 + have hfdis : ∀ a ∈ Aall, ∀ b ∈ Aall, a ≠ b → Disjoint (f a) (f b) := by + intro a ha b hb hab + refine disjoint_left.mpr fun x hxa hxb => hab ?_ + have hff := region_eq_of_mem (hf a ha.1 ha.2) (hf b hb.1 hb.2) hxa hxb + obtain ⟨e₀, -, -, hun, -⟩ := face_edge hrG hS hmG ⟨a, ha.1⟩ (hf a ha.1 ha.2) + exact (hun a ha.1 (hcf a ha.1 ha.2)).trans (hun b hb.1 (hff ▸ hcf b hb.1 hb.2)).symm + have hregU : ∀ {r b}, r ∈ F.R → b ∈ D.E → Disjoint r (closure b) := fun {r b} hr hb => + disjoint_left.mpr fun x hx h => region_subset hr hx (Or.inl (D.closure_subset_U hb h)) + have key : ∀ A : Set (Set S), A.Finite → A ⊆ Aall → IsOpenDisc (M A) := by + intro A hA + induction A, hA using Set.Finite.induction_on with + | empty => + intro _ + have h₀ : M ∅ = cellInt e := by simp [M] + rw [h₀] + exact isOpenDisc_interior hS hN + | @insert b A hbA hfin ih => + intro hsub + have hA' : A ⊆ Aall := fun x hx => hsub (mem_insert_of_mem _ hx) + have hb : b ∈ Aall := hsub (mem_insert _ _) + have hih := ih hA' + have heq : M (insert b A) = M A ∪ f b ∪ b := by + ext x + simp only [M, biUnion_insert, mem_union] + tauto + rw [heq] + have hdisM : Disjoint (M A) (f b) := by + refine disjoint_left.mpr ?_ + rintro x (hx | hx) hxb + · exact disjoint_left.mp (hfo b hb.1 hb.2) hxb hx.1 + · obtain ⟨a, ha, hx⟩ := mem_iUnion₂.mp hx + rcases hx with hx | hx + · exact region_subset (hf b hb.1 hb.2) hxb (Or.inl ((hA' ha).1.2.1 hx).1) + · exact disjoint_left.mp (hfdis a (hA' ha) b hb (fun h => hbA (h ▸ ha))) hx hxb + have hdiscl : Disjoint (M A) (closure b) := by + refine disjoint_left.mpr ?_ + rintro x (hx | hx) hxb + · exact disjoint_left.mp hDint hx (D.closure_subset_U hb.1 hxb) + · obtain ⟨a, ha, hx⟩ := mem_iUnion₂.mp hx + rcases hx with hx | hx + · have hab : a ≠ b := fun h => hbA (h ▸ ha) + have hxV : x ∉ D.V := ((hA' ha).1.2.1 hx).2 + have hxb' : x ∈ b := D.closure_diff_V hb.1 ▸ (⟨hxb, hxV⟩ : x ∈ closure b \ D.V) + exact hab (D.edge_eq_of_mem (hA' ha).1 hb.1 hx hxb') + · exact disjoint_left.mp (hregU (hf a (hA' ha).1 (hA' ha).2) hb.1) hx hxb + exact glue_open_discs hS (hFE hb.1) (hu b hb.1 hb.2) (hf b hb.1 hb.2) (hne b hb.1 hb.2) + (hcu b hb.1 hb.2) (hcf b hb.1 hb.2) ((hui b hb.1 hb.2).trans subset_union_left) Subset.rfl + hih (face_isOpenDisc hrG hS hmG (hf b hb.1 hb.2)) hdisM hdiscl + (hregU (hf b hb.1 hb.2) hb.1) + have heq : s = M Aall := by + have hes' : cellInt e ⊆ e := fun x hx => by + have hxV : x ∉ Γ.V := disjoint_left.mp (cellInt_disjoint_V hS he') hx + exact Cell.closure_sdiff_V hS hU he' ▸ (⟨hx.1, hxV⟩ : x ∈ closure e \ Γ.V) + have hbdpart : ∀ x ∈ e, x ∈ M Aall := by + intro x hx + by_cases hxb : x ∈ discBd (closure e) + · have hxV : x ∉ Γ.V := disjoint_left.mp (hcellV e he') hx + have hxD : x ∈ D.U := by + rw [hDU] + exact Or.inr (mem_iUnion₂.mpr ⟨e, he', hxb⟩) + obtain ⟨b, hb, hxb'⟩ := hedge x hxD (hDV ▸ hxV) + obtain ⟨e', he'', hbe'⟩ := hcell b hb + obtain rfl : e' = e := arcComponent_eq he'' he' (hbe' hxb') hx + exact Or.inr (mem_iUnion₂.mpr ⟨b, ⟨hb, hbe'⟩, Or.inl hxb'⟩) + · exact Or.inl ⟨subset_closure hx, hxb⟩ + apply subset_antisymm + · intro x hx + have hxU' : x ∉ Γ'.U := region_subset hs hx + by_cases hxU : x ∈ Γ.U + · rcases Cell.mem_V_or_cell Γ hxU with h | ⟨g, hg, hxg⟩ + · exact (hxU' (Γ'.V_subset_U (hrad.2.2.1 h))).elim + · have hgs : g ⊆ s := + subset_region hs hg.2.2.1.isConnected.isPreconnected (hcellU' g hg) hxg hx + exact hbdpart x (hhuniq g hg hgs ▸ hxg) + · have hxG : x ∉ G.U := fun h => (hstarU h).elim hxU' hxU + obtain ⟨p, hp, hxp⟩ := exists_region_of_notMem hxG + have hps : p ⊆ s := subset_region hs (region_isPreconnected hp) + (disjoint_left.mpr fun y hy h => region_subset hp hy (hG_U h)) hxp hx + have hDE : D.E.Nonempty := by + obtain ⟨e₀, he₀⟩ := hE + have hinf := infinite_of_isOArc (Cell.isClosedDisc_closure he₀).isOArc_discBd + obtain ⟨y, hy, hn⟩ := hinf.exists_notMem_finite Γ.finite_V + have hyD : y ∈ D.U := by + rw [hDU] + exact Or.inr (mem_iUnion₂.mpr ⟨e₀, he₀, hy⟩) + obtain ⟨a, ha, -⟩ := hedge y hyD (hDV ▸ hn) + exact ⟨a, ha⟩ + obtain ⟨hf₁, -, -⟩ := regionFacts_of_radial hrG hS hmG hDE + obtain ⟨a, ha, hap⟩ := hf₁ p hp + have ha' : a ∈ D.E := ha + obtain ⟨g, hg, hag⟩ := hcell a ha' + obtain ⟨z, hz⟩ := ha'.1 + have hgs : g ⊆ s := subset_region hs hg.2.2.1.isConnected.isPreconnected (hcellU' g hg) + (hag hz) (hps (hap hz)) + obtain rfl := hhuniq g hg hgs + have hmem : x ∈ u a ∪ f a ∪ a := hpe a ha' hag p hp hap ▸ hxp + rcases hmem with (h | h) | h + · exact Or.inl (hui a ha' hag h) + · exact Or.inr (mem_iUnion₂.mpr ⟨a, ⟨ha', hag⟩, Or.inr h⟩) + · exact Or.inr (mem_iUnion₂.mpr ⟨a, ⟨ha', hag⟩, Or.inl h⟩) + · refine union_subset (hes'.trans hes) (iUnion₂_subset fun a ha => union_subset + (ha.2.trans hes) ?_) + obtain ⟨y, hy⟩ := (show a ∈ D.E from ha.1).1 + have hmeet : (f a ∩ s).Nonempty := by + obtain ⟨z, hzs, hzf⟩ := mem_closure_iff.mp (hcf a ha.1 ha.2 hy) s (region_isOpen hs) (hes + (ha.2 hy)) + exact ⟨z, hzf, hzs⟩ + obtain ⟨z, hzf, hzs⟩ := hmeet + exact subset_region hs (region_isPreconnected (hf a ha.1 ha.2)) + (disjoint_left.mpr fun y hy h => disjoint_left.mp (hFdis (hf a ha.1 ha.2)) hy + (hG_U h)) hzf hzs + exact heq ▸ key Aall hAll Subset.rfl + +/-- **A radial drawing of a 2-cell painting or drawing is 2-cell.** Graph Minors XI, Section 3 +(page 75). -/ +theorem radial_isTwoCell (hS : IsClosedSurface S) {Γ : PaintingOrDrawing S} {Γ' : Drawing S} + (h : Γ.IsRadialDrawing Γ') : (PaintingOrDrawing.drawing Γ').IsTwoCell := by + refine ⟨inferInstance, fun s hs => ?_⟩ + have hs' : s ∈ Γ'.R := hs + cases Γ with + | painting Γ => exact painting_region_isOpenDisc hS ⟨h.1, h.2.1⟩ h.2.2 hs' + | drawing Γ => exact radial_region_isOpenDisc ⟨h.1, h.2.1⟩ hS h.2.2 hs' + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/PathClasses.lean b/LeanPool/GraphMinor/GM11/PathClasses.lean new file mode 100644 index 0000000000..99be369530 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PathClasses.lean @@ -0,0 +1,222 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section3 +import Mathlib.Topology.UniformSpace.OfCompactT2 +import Mathlib.Topology.UniformSpace.Compact + +/-! +# Homotopy classes of paths + +Paths are taken up to homotopy with fixed ends (`Cl`), since in this way the products of paths are +associative. `Arw A f` says that the class `f` contains a path in `A`. A set is `Flat` if paths in +it with +the same ends are homotopic in the whole space. + +`cl_induction` is induction along a path that is cut in pieces, and `exists_small_rel` is the +Lebesgue number +of an open cover of a compact space. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval Uniformity + +universe u + +variable {T : Type u} [TopologicalSpace T] + +/-- The homotopy classes of paths from `a` to `b`, with the ends fixed. -/ +abbrev Cl (a b : T) := Path.Homotopic.Quotient a b + +/-- The class of a path. -/ +abbrev Cl.mk {a b : T} (p : Path a b) : Cl a b := Path.Homotopic.Quotient.mk p + +/-- The class of the constant path. -/ +abbrev Cl.rf (a : T) : Cl a a := Path.Homotopic.Quotient.refl a + +section Classes + +variable {a b c d : T} + +theorem cl_assoc (f : Cl a b) (g : Cl b c) (h : Cl c d) : (f.trans g).trans h = f.trans (g.trans h) + := by + induction f using Path.Homotopic.Quotient.ind with | mk f => ?_ + induction g using Path.Homotopic.Quotient.ind with | mk g => ?_ + induction h using Path.Homotopic.Quotient.ind with | mk h => ?_ + simp only [← Path.Homotopic.Quotient.mk_trans] + exact Path.Homotopic.Quotient.eq.mpr (Path.Homotopic.trans_assoc f g h) + +theorem cl_refl_trans (f : Cl a b) : (Cl.rf a).trans f = f := by + induction f using Path.Homotopic.Quotient.ind with | mk f => ?_ + rw [Cl.rf, ← Path.Homotopic.Quotient.mk_refl, ← Path.Homotopic.Quotient.mk_trans] + exact Path.Homotopic.Quotient.eq.mpr (Path.Homotopic.refl_trans f) + +theorem cl_trans_refl (f : Cl a b) : f.trans (Cl.rf b) = f := by + induction f using Path.Homotopic.Quotient.ind with | mk f => ?_ + rw [Cl.rf, ← Path.Homotopic.Quotient.mk_refl, ← Path.Homotopic.Quotient.mk_trans] + exact Path.Homotopic.Quotient.eq.mpr (Path.Homotopic.trans_refl f) + +theorem cl_trans_symm (f : Cl a b) : f.trans f.symm = Cl.rf a := by + induction f using Path.Homotopic.Quotient.ind with | mk f => ?_ + rw [← Path.Homotopic.Quotient.mk_symm, ← Path.Homotopic.Quotient.mk_trans, Cl.rf, + ← Path.Homotopic.Quotient.mk_refl] + exact Path.Homotopic.Quotient.eq.mpr (Path.Homotopic.trans_symm f) + +theorem cl_symm_trans (f : Cl a b) : f.symm.trans f = Cl.rf b := by + induction f using Path.Homotopic.Quotient.ind with | mk f => ?_ + rw [← Path.Homotopic.Quotient.mk_symm, ← Path.Homotopic.Quotient.mk_trans, Cl.rf, + ← Path.Homotopic.Quotient.mk_refl] + exact Path.Homotopic.Quotient.eq.mpr (Path.Homotopic.symm_trans f) + +theorem cl_symm_trans_left (f : Cl a b) (g : Cl b c) : f.symm.trans (f.trans g) = g := by + rw [← cl_assoc, cl_symm_trans, cl_refl_trans] + +/-- The class `f` contains a path in `A`. -/ +def Arw (A : Set T) (f : Cl a b) : Prop := ∃ p : Path a b, (∀ u, p u ∈ A) ∧ f = Cl.mk p + +theorem Arw.of_path {A : Set T} (p : Path a b) (hp : ∀ u, p u ∈ A) : Arw A (Cl.mk p) := ⟨p, hp, rfl⟩ + +theorem Arw.left_mem {A : Set T} {f : Cl a b} (h : Arw A f) : a ∈ A := by + obtain ⟨p, hp, -⟩ := h + simpa using hp 0 + +theorem Arw.right_mem {A : Set T} {f : Cl a b} (h : Arw A f) : b ∈ A := by + obtain ⟨p, hp, -⟩ := h + simpa using hp 1 + +theorem Arw.mono {A B : Set T} {f : Cl a b} (h : Arw A f) (hAB : A ⊆ B) : Arw B f := by + obtain ⟨p, hp, rfl⟩ := h + exact ⟨p, fun u => hAB (hp u), rfl⟩ + +theorem Arw.trans {A : Set T} {f : Cl a b} {g : Cl b c} (hf : Arw A f) (hg : Arw A g) : + Arw A (f.trans g) := by + obtain ⟨p, hp, rfl⟩ := hf + obtain ⟨q, hq, rfl⟩ := hg + refine ⟨p.trans q, fun u => ?_, (Path.Homotopic.Quotient.mk_trans p q).symm⟩ + have : (p.trans q) u ∈ range p ∪ range q := by + rw [← Path.trans_range] + exact mem_range_self u + rcases this with ⟨v, hv⟩ | ⟨v, hv⟩ + · rw [← hv] + exact hp v + · rw [← hv] + exact hq v + +theorem Arw.symm {A : Set T} {f : Cl a b} (hf : Arw A f) : Arw A f.symm := by + obtain ⟨p, hp, rfl⟩ := hf + refine ⟨p.symm, fun u => ?_, (Path.Homotopic.Quotient.mk_symm p).symm⟩ + rw [Path.symm_apply] + exact hp _ + +theorem arw_refl {A : Set T} (h : a ∈ A) : Arw A (Cl.rf a) := + ⟨Path.refl a, fun _ => h, (Path.Homotopic.Quotient.mk_refl a).symm⟩ + +end Classes + +/-- Paths in `A` with the same ends are homotopic in the whole space. -/ +def Flat (A : Set T) : Prop := + ∀ ⦃a b : T⦄ (p q : Path a b), (∀ u, p u ∈ A) → (∀ u, q u ∈ A) → p.Homotopic q + +theorem Flat.mono {A B : Set T} (h : Flat B) (hAB : A ⊆ B) : Flat A := + fun _ _ p q hp hq => h p q (fun u => hAB (hp u)) fun u => hAB (hq u) + +theorem Flat.eq {A : Set T} (h : Flat A) {a b : T} {f g : Cl a b} (hf : Arw A f) (hg : Arw A g) : f + = g := by + obtain ⟨p, hp, rfl⟩ := hf + obtain ⟨q, hq, rfl⟩ := hg + exact Path.Homotopic.Quotient.eq.mpr (h p q hp hq) + +/-- A simply-connected set is flat. -/ +theorem IsSimplyConnectedSet.flat {A : Set T} (hA : IsSimplyConnectedSet A) : Flat A := by + intro a b p q hp hq + have ha : a ∈ A := by simpa using hp 0 + have hb : b ∈ A := by simpa using hp 1 + let f : C(A, T) := ⟨Subtype.val, continuous_subtype_val⟩ + let p' : Path (⟨a, ha⟩ : A) ⟨b, hb⟩ := + ⟨⟨fun u => ⟨p u, hp u⟩, by fun_prop⟩, by simp, by simp⟩ + let q' : Path (⟨a, ha⟩ : A) ⟨b, hb⟩ := + ⟨⟨fun u => ⟨q u, hq u⟩, by fun_prop⟩, by simp, by simp⟩ + have h := (hA.pathsHomotopic p' q').map f + exact h + +/-- The Lebesgue number of a cover: a relation `R` for which each point has its `R`-neighbours in +one set of +the cover, and each point has an open neighbourhood whose points are all `R`-related. -/ +theorem exists_small_rel [CompactSpace T] [T2Space T] {ι : Type*} (U : ι → Set T) (hU : ∀ i, IsOpen + (U i)) + (hc : univ ⊆ ⋃ i, U i) : + ∃ R : T → T → Prop, (∀ x, ∃ i, ∀ y, R x y → y ∈ U i) ∧ + ∀ x, ∃ N : Set T, IsOpen N ∧ x ∈ N ∧ ∀ a ∈ N, ∀ b ∈ N, R a b := by + let _ : UniformSpace T := uniformSpaceOfCompactR1 + obtain ⟨V, hV, hball⟩ := lebesgue_number_lemma (isCompact_univ (X := T)) hU hc + obtain ⟨W, hW, hsym, hcomp⟩ := comp_symm_mem_uniformity_sets hV + refine ⟨fun x y => (y, x) ∈ V, fun x => ?_, fun x => ?_⟩ + · obtain ⟨i, hi⟩ := hball x (mem_univ x) + exact ⟨i, fun y hy => hi hy⟩ + · have hn : SetRel.ball W x ∈ 𝓝 x := SetRel.ball_mem_nhds x hW + refine ⟨interior (SetRel.ball W x), isOpen_interior, mem_interior_iff_mem_nhds.mpr hn, ?_⟩ + intro a ha b hb + have h₁ : a ∈ SetRel.ball W x := interior_subset ha + have h₂ : b ∈ SetRel.ball W x := interior_subset hb + exact hcomp (SetRel.prodMk_mem_comp h₂ (SetRel.symm W h₁)) + +theorem cl_cancel {a b c d : T} (u : Cl a b) (v : Cl c d) {f g : Cl b c} + (h : u.trans (f.trans v) = u.trans (g.trans v)) : f = g := by + have key : ∀ k : Cl b c, u.symm.trans ((u.trans (k.trans v)).trans v.symm) = k := by + intro k + rw [← cl_assoc u.symm, cl_symm_trans_left, cl_assoc, cl_trans_symm, cl_trans_refl] + rw [← key f, h, key g] + +/-- **Induction along a path.** Each point of `γ` lies on an open set of the family, and `Q` passes +along +each piece of `γ` that lies in one set of the family. -/ +theorem cl_induction {𝒞 : Set (Set T)} (h𝒞 : ∀ O ∈ 𝒞, IsOpen O) {a b : T} (γ : Path a b) + (hcov : ∀ u, ∃ O ∈ 𝒞, γ u ∈ O) (Q : ∀ c : T, Cl a c → Prop) (h0 : Q a (Cl.rf a)) + (step : ∀ (c d : T) (f : Cl a c) (r : Path c d) (O : Set T), O ∈ 𝒞 → (∀ u, r u ∈ O) → Q c f → + Q d (f.trans (Cl.mk r))) : Q b (Cl.mk γ) := by + rcases γ with ⟨f, rfl, rfl⟩ + let γ : Path (f 0) (f 1) := ⟨f, rfl, rfl⟩ + have hcover : (univ : Set I) ⊆ ⋃ O : {O // O ∈ 𝒞}, (γ ⁻¹' O.1) := fun u _ => by + obtain ⟨O, h₁, h₂⟩ := hcov u + exact mem_iUnion.mpr ⟨⟨O, h₁⟩, h₂⟩ + obtain ⟨t, ht0, htmono, ⟨n₀, hn₀⟩, htO⟩ := exists_monotone_Icc_subset_open_cover_unitInterval + (fun O : {O // O ∈ 𝒞} => (h𝒞 O.1 O.2).preimage γ.continuous) hcover + have key : ∀ n, Q (γ (t n)) (Cl.mk (γ.subpath 0 (t n))) := by + intro n + induction n with + | zero => + rw [ht0, Path.subpath_self] + exact h0 + | succ n ih => + obtain ⟨O, hsub⟩ := htO n + have hle : t n ≤ t (n + 1) := htmono (Nat.le_succ n) + have hpiece : ∀ u, (γ.subpath (t n) (t (n + 1))) u ∈ O.1 := by + intro u + have : (γ.subpath (t n) (t (n + 1))) u ∈ γ '' uIcc (t n) (t (n + 1)) := by + rw [← Path.range_subpath] + exact mem_range_self u + obtain ⟨v, hv, hv'⟩ := this + rw [uIcc_of_le hle] at hv + rw [← hv'] + exact hsub hv + have h := step _ _ _ _ O.1 O.2 hpiece ih + have e : (Cl.mk (γ.subpath 0 (t n))).trans (Cl.mk (γ.subpath (t n) (t (n + 1)))) = + Cl.mk (γ.subpath 0 (t (n + 1))) := by + rw [← Path.Homotopic.Quotient.mk_trans] + exact Path.Homotopic.Quotient.eq.mpr (Path.Homotopic.subpath_trans_subpath _ _ _ _) + rwa [e] at h + have h := key n₀ + rw [hn₀ n₀ le_rfl, Path.subpath_zero_one] at h + exact h + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/PerimeterBound.lean b/LeanPool/GraphMinor/GM11/PerimeterBound.lean new file mode 100644 index 0000000000..28fc1e5341 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PerimeterBound.lean @@ -0,0 +1,333 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Theorem64 +public import LeanPool.GraphMinor.GM11.Section810 + +/-! +# The perimeter of a region of a radial drawing + +Graph Minors XI, proof of (6.5), page 92: "the perimeter of $r$ has length at least twice the number +of ends of $e$". +This is `two_mul_ends_le`. `perimeterLength_le_four` is the bound in the other direction, and it is +what the converse +of (6.5) needs. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] {Γ Γ' : Drawing S} + +/-- The weight `n(h)` of an edge in the perimeter of `s`. -/ +noncomputable def perimN (Γ' : Drawing S) (s h : Set S) : ℕ := + open Classical in if ∃ r' ∈ Γ'.R, r' ≠ s ∧ Γ'.EdgeRegionIncident h r' then 1 else 2 + +omit [T2Space S] [ConnectedSpace S] in +theorem one_le_perimN (s h : Set S) : 1 ≤ perimN Γ' s h := by + unfold perimN + split_ifs <;> simp + +section Generic + +omit [ConnectedSpace S] in +/-- A spoke is not a loop: its two ends are different. -/ +theorem spoke_half_eq (hnl : ∀ h ∈ Γ'.E, ∃ x y, x ≠ y ∧ closure h ∩ Γ'.V = {x, y}) {γ : Set S → I + → S} + (hγ : EdgePar Γ' γ) {h : Set S} (hh : h ∈ Γ'.E) {v : S} {b b' : Bool} + (h₁ : γ h (endOf b) = v) (h₂ : γ h (endOf b') = v) : b = b' := by + by_contra hne + obtain ⟨x, y, hxy, hcap⟩ := hnl h hh + have hall : ∀ c, γ h (endOf c) = v := fun c => by + cases b <;> cases b' <;> cases c <;> simp_all + have hxc : x ∈ closure h ∩ Γ'.V := by rw [hcap]; simp + have hyc : y ∈ closure h ∩ Γ'.V := by rw [hcap]; simp + obtain ⟨c₁, hc₁⟩ := exists_end_eq hγ hh hxc.2 hxc.1 + obtain ⟨c₂, hc₂⟩ := exists_end_eq hγ hh hyc.2 hyc.1 + exact hxy (by rw [← hc₁, ← hc₂, hall, hall]) + +/-- Around a vertex of `Γ'` on the closure of a region `s`, if an edge has that vertex as an end, +the perimeter of `s` +has weight at least 2. -/ +theorem two_le_of_spoke (hS : IsClosedSurface S) (hnl : ∀ h ∈ Γ'.E, ∃ x y, x ≠ y ∧ closure h ∩ Γ'.V + = {x, y}) + {s h₀ : Set S} (hs : s ∈ Γ'.R) {v : S} (hv' : v ∈ Γ'.V) (hvs : v ∈ closure s) (hh₀ : h₀ ∈ Γ'.E) + (hvh₀ : v ∈ closure h₀) : + ∃ T : Finset (Set S), (∀ h ∈ T, h ∈ Γ'.E ∧ h ⊆ closure s ∧ v ∈ closure h) ∧ 2 + ≤ ∑ h ∈ T, perimN Γ' s h := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨γ, hγ⟩ := exists_edgePar Γ' + obtain ⟨b, hb⟩ := exists_end_eq hγ hh₀ hv' hvh₀ + have hfin : Finite (halfEdges Γ' γ v) := (finite_halfEdges Γ' γ v).to_subtype + by_cases h2 : 2 ≤ Nat.card (halfEdges Γ' γ v) + · obtain ⟨next, ρ, P, W, Q, τ, hsec⟩ := exists_sectors hS Γ' hγ hv' h2 + have hcor := IsSectors.corners hsec + obtain ⟨k, rfl⟩ := IsCorners.all hcor s hs hvs + obtain ⟨k', rfl⟩ := next_surjective hcor k + have hne : next k' ≠ next (next k') := (IsSectors.next_ne hsec _).symm + have hne' : (next k').1.1 ≠ (next (next k')).1.1 := fun h => by + have h₁ := (next k').2.2 + have h₂ := (next (next k')).2.2 + rw [← h] at h₂ + have hbb := spoke_half_eq hnl hγ (next k').2.1 h₁ h₂ + exact hne (Subtype.ext (Prod.ext h hbb)) + have hc₁ := IsCorners.right hcor k' + have hc₂ := IsCorners.left hcor (next k') + have hv₁ : v ∈ closure (next k').1.1 := by + have := end_mem_closure hγ (next k').2.1 (next k').1.2 + rwa [(next k').2.2] at this + have hv₂ : v ∈ closure (next (next k')).1.1 := by + have := end_mem_closure hγ (next (next k')).2.1 (next (next k')).1.2 + rwa [(next (next k')).2.2] at this + refine ⟨{(next k').1.1, (next (next k')).1.1}, fun h hh => ?_, ?_⟩ + · rcases Finset.mem_insert.mp hh with rfl | hh + · exact ⟨(next k').2.1, hc₁, hv₁⟩ + · obtain rfl := Finset.mem_singleton.mp hh + exact ⟨(next (next k')).2.1, hc₂, hv₂⟩ + · rw [Finset.sum_pair hne'] + have := one_le_perimN (Γ' := Γ') (ρ (next k')) (next k').1.1 + have := one_le_perimN (Γ' := Γ') (ρ (next k')) (next (next k')).1.1 + omega + · have hk : ∀ l : halfEdges Γ' γ v, l = ⟨(h₀, b), hh₀, hb⟩ := fun l => by + have h1 : Nat.card (halfEdges Γ' γ v) ≤ 1 := by omega + exact (Finite.card_le_one_iff_subsingleton.mp h1).elim _ _ + obtain ⟨Z, hZo, hvZ, hZ⟩ := exists_single_nbhd hS hγ _ hk + have hone : ∀ r' ∈ Γ'.R, v ∈ closure r' → r' = s := fun r' hr' hvr' => by + obtain ⟨y, hyZ, hyr'⟩ := mem_closure_iff.mp hvr' Z hZo hvZ + obtain ⟨x, hxZ, hxs⟩ := mem_closure_iff.mp hvs Z hZo hvZ + obtain ⟨A, hAc, hAd, hxA, hyA, -⟩ := hZ x hxZ (region_subset hs hxs) y hyZ + (region_subset hr' hyr') + exact region_eq_of_mem hr' hs hyr' (subset_region hs hAc hAd hxA hxs hyA) + obtain ⟨r', hr', hh₀r'⟩ := exists_region_incident hS hh₀ + have hsub : closure h₀ ⊆ closure r' := closure_minimal hh₀r' isClosed_closure + obtain rfl := hone r' hr' (hsub hvh₀) + refine ⟨{h₀}, fun h hh => ?_, ?_⟩ + · obtain rfl := Finset.mem_singleton.mp hh + exact ⟨hh₀, hh₀r', hvh₀⟩ + · rw [Finset.sum_singleton, perimN, ite_eq_right] + rintro ⟨r₂, hr₂, hne, -, -, hinc⟩ + exact hne (hone r₂ hr₂ ((closure_minimal (edge_subset_closure_of_incident hS hh₀ hr₂ hinc) + isClosed_closure) hvh₀)) + +/-- The perimeter of a region `s` has length at least twice the number of its vertices in a set `V₀` +of ends, if each +edge of `Γ'` has at most one end in `V₀`. -/ +theorem two_mul_ncard_le_perimeter (hS : IsClosedSurface S) + (hnl : ∀ h ∈ Γ'.E, ∃ x y, x ≠ y ∧ closure h ∩ Γ'.V = {x, y}) {V₀ s : Set S} (hf : V₀.Finite) + (hV : V₀ ⊆ Γ'.V) + (hs : s ∈ Γ'.R) (hu : ∀ h ∈ Γ'.E, ∀ v ∈ V₀, ∀ w ∈ V₀, v ∈ closure h → w ∈ closure h → v = w) + (hspoke : ∀ v ∈ V₀ ∩ closure s, ∃ h ∈ Γ'.E, v ∈ closure h) : + 2 * (V₀ ∩ closure s).ncard ≤ perimeterLength Γ' s := by + classical + have hX : (V₀ ∩ closure s).Finite := hf.subset inter_subset_left + have hex : ∀ v, v ∈ V₀ ∩ closure s → ∃ T : Finset (Set S), (∀ h ∈ T, h ∈ Γ'.E ∧ h ⊆ closure s + ∧ v ∈ closure h) ∧ + 2 ≤ ∑ h ∈ T, perimN Γ' s h := fun v hv => by + obtain ⟨h₀, hh₀, hvh₀⟩ := hspoke v hv + exact two_le_of_spoke hS hnl hs (hV hv.1) hv.2 hh₀ hvh₀ + choose! T hT hT2 using hex + have hPf : (perimeter Γ' s).E.Finite := (perimeter Γ' s).finite_edges + have hdis : ((hX.toFinset : Finset S) : Set S).PairwiseDisjoint T := fun a ha b hb hab => by + rw [Function.onFun, Finset.disjoint_left] + intro h h₁ h₂ + have ha' : a ∈ V₀ ∩ closure s := by simpa using ha + have hb' : b ∈ V₀ ∩ closure s := by simpa using hb + exact hab (hu h (hT a ha' h h₁).1 a ha'.1 b hb'.1 (hT a ha' h h₁).2.2 (hT b hb' h h₂).2.2) + have hsub : hX.toFinset.biUnion T ⊆ hPf.toFinset := fun h hh => by + obtain ⟨v, hv, hhv⟩ := Finset.mem_biUnion.mp hh + have hv' : v ∈ V₀ ∩ closure s := by simpa using hv + obtain ⟨h₁, h₂, -⟩ := hT v hv' h hhv + exact hPf.mem_toFinset.mpr (mem_interSet_E_iff.mpr ⟨h₁, h₂⟩) + have hlen : perimeterLength Γ' s = ∑ h ∈ hPf.toFinset, perimN Γ' s h := by + rw [perimeterLength, finsum_mem_eq_finite_toFinset_sum _ hPf] + rfl + rw [hlen, ncard_eq_toFinset_card _ hX, Finset.card_eq_sum_ones, Finset.mul_sum] + calc ∑ v ∈ hX.toFinset, 2 * 1 ≤ ∑ v ∈ hX.toFinset, ∑ h ∈ T v, perimN Γ' s h := + Finset.sum_le_sum fun v hv => by simpa using hT2 v (by simpa using hv) + _ = ∑ h ∈ hX.toFinset.biUnion T, perimN Γ' s h := (Finset.sum_biUnion hdis).symm + _ ≤ ∑ h ∈ hPf.toFinset, perimN Γ' s h := Finset.sum_le_sum_of_subset hsub + +omit [T2Space S] [ConnectedSpace S] in +/-- An edge of a radial drawing has two different ends. -/ +theorem two_ends_of_preRadial {Γ : PaintingOrDrawing S} (hrad : Γ.IsPreRadialDrawing Γ') : + ∀ h ∈ Γ'.E, ∃ x y, x ≠ y ∧ closure h ∩ Γ'.V = {x, y} := fun h hh => by + obtain ⟨v, hv, w, hw, hcap⟩ := hrad.2.2.2.2.1 h hh + exact ⟨v, w, fun e => hw.2 (e ▸ hv), hcap⟩ + +omit [T2Space S] [ConnectedSpace S] in +/-- An edge of a radial drawing has one end in `V(Γ)`. -/ +theorem end_unique_of_preRadial {Γ : PaintingOrDrawing S} (hrad : Γ.IsPreRadialDrawing Γ') : + ∀ h ∈ Γ'.E, ∀ v ∈ Γ.V, ∀ w ∈ Γ.V, v ∈ closure h → w ∈ closure h → v = w + := fun h hh a ha b hb h₁ h₂ => by + obtain ⟨v, -, w, hw, hcap⟩ := hrad.2.2.2.2.1 h hh + have key : ∀ z ∈ Γ.V, z ∈ closure h → z = v := fun z hz hzh => by + have : z ∈ closure h ∩ Γ'.V := ⟨hzh, hrad.2.1 hz⟩ + rw [hcap] at this + rcases this with h' | h' + · exact h' + · exact absurd hz ((mem_singleton_iff.mp h') ▸ hw.2) + rw [key a ha h₁, key b hb h₂] + +end Generic + +variable (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') (hS : IsClosedSurface S) + (hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ') (hE : Γ.E.Nonempty) + +include hrad hS hmax hE + +/-- **Graph Minors XI, proof of (6.5)** (page 92): "the perimeter of $r$ has length at least twice +the number of ends of $e$". -/ +theorem two_mul_ends_le {s : Set S} (hs : s ∈ Γ'.R) : 2 * (Γ.V ∩ closure s).ncard + ≤ perimeterLength Γ' s := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + refine two_mul_ncard_le_perimeter hS (two_ends_of_preRadial hrad.2) Γ.finite_V hrad.2.2.1 hs + (end_unique_of_preRadial hrad.2) fun v hv => ?_ + obtain ⟨e₀, he₀, hve₀⟩ := exists_edge_at hrad hS hE hv.1 + obtain ⟨r, hr, he₀r⟩ := exists_region_incident hS he₀ + obtain ⟨c, ⟨hc, hcV⟩, -⟩ := hrad.2.2.2.1 r hr + obtain ⟨h₀, hh₀, hcap⟩ := exists_spoke_at hrad hmax hS hE hr hc hcV hv.1 + (closure_minimal he₀r isClosed_closure hve₀) + have hvh₀ : v ∈ closure h₀ ∩ Γ'.V := by rw [hcap]; simp + exact ⟨h₀, hh₀, hvh₀.1⟩ + +/-- The perimeter of a region of `Γ'` has length at most 4: its two faces in `Γ ∪ Γ'` have two sides +each in `Γ'`. -/ +theorem perimeterLength_le_four {s : Set S} (hs : s ∈ Γ'.R) : perimeterLength Γ' s ≤ 4 := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hex, -, -⟩ := regionFacts_of_radial hrad hS hmax hE + obtain ⟨e, he, hes⟩ := hex s hs + obtain ⟨p, hp, q, hq, hpq, hep, heq, hseq⟩ := region_eq_two_faces hrad hS hmax hE hs he hes + obtain ⟨r₁, hr₁, hpr⟩ := exists_region_of_sub hrad hp + obtain ⟨r₂, hr₂, hqr⟩ := exists_region_of_sub hrad hq + obtain ⟨f, g, hf, hg, hfp, hgp, hall, hsides⟩ := hub_sides hrad hS hmax hE hr₁ hp hpr + obtain ⟨f', g', hf', hg', hfq, hgq, hall', hsides'⟩ := hub_sides hrad hS hmax hE hr₂ hq hqr + have hPf : (perimeter Γ' s).E.Finite := (perimeter Γ' s).finite_edges + have hlen : perimeterLength Γ' s = ∑ h ∈ hPf.toFinset, perimN Γ' s h := by + rw [perimeterLength, finsum_mem_eq_finite_toFinset_sum _ hPf] + rfl + have hHE : ∀ {h}, h ∈ Γ'.E → h ∈ (radialUnion hrad).E := fun hh => by + rw [radialUnion_E] + exact Or.inr hh + -- A region of `Γ ∪ Γ'` in `s` is one of the two faces. + have hface : ∀ A ∈ (radialUnion hrad).R, (A ∩ s).Nonempty → A = p ∨ A = q := by + rintro A hA ⟨y, hyA, hys⟩ + rw [hseq] at hys + rcases hys with (hy | hy) | hy + · exact Or.inl (region_eq_of_mem hA hp hyA hy) + · exact Or.inr (region_eq_of_mem hA hq hyA hy) + · have heE : e ∈ Γ.E := he + exact absurd (Or.inl (Γ.closure_subset_U heE (subset_closure hy)) : y ∈ Γ.U ∪ Γ'.U) + (region_subset hA hyA) + -- The closure of `s`. + have hclo : ∀ h ∈ Γ'.E, h ⊆ closure s → h ⊆ closure p ∨ h ⊆ closure q := fun h hh hhs => by + obtain ⟨y, hy⟩ := hh.1 + have hyU : y ∉ Γ.U := fun hyU => by + exact disjoint_left.mp (spoke_disjoint hrad hh) hy hyU + have hy' := hhs hy + rw [hseq, closure_union, closure_union] at hy' + rcases hy' with (hy' | hy') | hy' + · exact Or.inl (edge_subset_closure_of_incident hS (hHE hh) hp ⟨y, hy, hy'⟩) + · exact Or.inr (edge_subset_closure_of_incident hS (hHE hh) hq ⟨y, hy, hy'⟩) + · have heE : e ∈ Γ.E := he + exact absurd (Γ.closure_subset_U heE hy') hyU + have hsubs : closure p ⊆ closure s ∧ closure q ⊆ closure s := by + constructor <;> refine closure_mono ?_ <;> rw [hseq] + · exact fun x hx => Or.inl (Or.inl hx) + · exact fun x hx => Or.inl (Or.inr hx) + -- An edge on a third face is incident with another region. + have hoth : ∀ h ∈ Γ'.E, ∀ A ∈ (radialUnion hrad).R, h ⊆ closure A → A ≠ p → A ≠ q → perimN Γ' s h + ≤ 1 := by + intro h hh A hA hhA hAp hAq + obtain ⟨y, hy⟩ := region_nonempty hA + have hyU : y ∉ Γ'.U := fun h' => region_subset hA hy (Or.inr h') + obtain ⟨s', hs', hys'⟩ := exists_region_of_notMem hyU + have hAs' : A ⊆ s' := subset_region hs' (region_isPreconnected hA) + (disjoint_left.mpr fun x hx h' => region_subset hA hx (Or.inr h')) hy hys' + have hne : s' ≠ s := fun h' => (hface A hA ⟨y, hy, h' ▸ hys'⟩).elim hAp hAq + obtain ⟨z, hz⟩ := hh.1 + have hif : ∃ r' ∈ Γ'.R, r' ≠ s ∧ Γ'.EdgeRegionIncident h r' := + ⟨s', hs', hne, hh, hs', z, hz, closure_mono hAs' (hhA hz)⟩ + rw [perimN, ite_eq_left hif] + let wp : ℕ := if f = g then 2 else 1 + let wq : ℕ := if f' = g' then 2 else 1 + let w : Set S → ℕ := fun h => (if h ⊆ closure p then wp else 0) + if h ⊆ closure q then wq else 0 + have hwp : 1 ≤ wp := by simp only [wp]; split_ifs <;> omega + have hwq : 1 ≤ wq := by simp only [wq]; split_ifs <;> omega + have hn2 : ∀ h, perimN Γ' s h ≤ 2 := fun h => by + unfold perimN + split_ifs <;> omega + have hstep : ∀ {f g : Set S} {p' q' : Set S}, p' ∈ (radialUnion hrad).R → + (f = g ∨ ∀ s', (s' = f ∨ s' = g) → ∃ A₁ ∈ (radialUnion hrad).R, ∃ A₂ ∈ (radialUnion hrad).R, + A₁ ≠ A₂ ∧ s' ⊆ closure A₁ ∧ s' ⊆ closure A₂) → (p' = p ∧ q' = q ∨ p' = q ∧ q' = p) → + ∀ h ∈ Γ'.E, (h = f ∨ h = g) → ¬ h ⊆ closure q' → f ≠ g → perimN Γ' s h ≤ 1 := by + rintro f₁ g₁ p' q' - hsd hpp h hh hhfg hnq hne + obtain ⟨A₁, hA₁, A₂, hA₂, hA, h₁, h₂⟩ := (hsd.resolve_left hne) h hhfg + have hpick : ∃ A ∈ (radialUnion hrad).R, h ⊆ closure A ∧ A ≠ p' := by + by_cases h' : A₁ = p' + · exact ⟨A₂, hA₂, h₂, fun e => hA (h'.trans e.symm)⟩ + · exact ⟨A₁, hA₁, h₁, h'⟩ + obtain ⟨A, hAR, hhA, hAp⟩ := hpick + have hAq : A ≠ q' := fun e => hnq (e ▸ hhA) + rcases hpp with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hoth h hh A hAR hhA hAp hAq + · exact hoth h hh A hAR hhA hAq hAp + have hbound : ∀ h ∈ hPf.toFinset, perimN Γ' s h ≤ w h := fun h hh => by + have hh' : h ∈ Γ'.E ∧ h ⊆ closure s := mem_interSet_E_iff.mp (hPf.mem_toFinset.mp hh) + by_cases hP : h ⊆ closure p <;> by_cases hQ : h ⊆ closure q + · have := hn2 h + simp only [w, ite_eq_left hP, ite_eq_left hQ] + omega + · simp only [w, ite_eq_left hP, ite_eq_right hQ, add_zero] + by_cases hfg : f = g + · have := hn2 h + simp only [wp, ite_eq_left hfg] + omega + · exact (hstep hp hsides (Or.inl ⟨rfl, rfl⟩) h hh'.1 (hall h hh'.1 hP) hQ hfg).trans hwp + · simp only [w, ite_eq_right hP, ite_eq_left hQ, zero_add] + by_cases hfg : f' = g' + · have := hn2 h + simp only [wq, ite_eq_left hfg] + omega + · exact (hstep hq hsides' (Or.inr ⟨rfl, rfl⟩) h hh'.1 (hall' h hh'.1 hQ) hP hfg).trans hwq + · exact ((hclo h hh'.1 hh'.2).elim hP hQ).elim + have hsum : ∀ (f g c : Set S) (c' : ℕ), (∀ h ∈ hPf.toFinset, h ⊆ c → h = f ∨ h = g) → + c' = (if f = g then 2 else 1) → ∑ h ∈ hPf.toFinset, (if h ⊆ c then c' else 0) ≤ 2 := by + intro f g c c' hin hc' + rw [← Finset.sum_filter, Finset.sum_const, smul_eq_mul] + have hsub : hPf.toFinset.filter (fun h => h ⊆ c) ⊆ {f, g} := fun h hh => by + obtain ⟨h₁, h₂⟩ := Finset.mem_filter.mp hh + simpa using hin h h₁ h₂ + have hcard := Finset.card_le_card hsub + by_cases hfg : f = g + · subst hfg + simp only [hc', ite_true, Finset.pair_eq_singleton, Finset.card_singleton] at hcard ⊢ + omega + · have := Finset.card_pair hfg + simp only [hc', ite_eq_right hfg] + omega + rw [hlen] + calc ∑ h ∈ hPf.toFinset, perimN Γ' s h ≤ ∑ h ∈ hPf.toFinset, w h := Finset.sum_le_sum hbound + _ = ∑ h ∈ hPf.toFinset, (if h ⊆ closure p then wp else 0) + ∑ h ∈ hPf.toFinset, + (if h ⊆ closure q then wq else 0) := + Finset.sum_add_distrib + _ ≤ 2 + 2 := add_le_add + (hsum f g _ wp (fun h hh hc => hall h (mem_interSet_E_iff.mp (hPf.mem_toFinset.mp hh)).1 + hc) rfl) + (hsum f' g' _ wq (fun h hh hc => hall' h (mem_interSet_E_iff.mp + (hPf.mem_toFinset.mp hh)).1 hc) rfl) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/PerimeterCount.lean b/LeanPool/GraphMinor/GM11/PerimeterCount.lean new file mode 100644 index 0000000000..d6b55d2aa2 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PerimeterCount.lean @@ -0,0 +1,358 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PerimeterWalk +public import LeanPool.GraphMinor.GM11.Cylinder + +/-! +# How often a perimeter walk uses an edge + +`perimeterCount Γ X e` is the number of sides of `e` outside `X`, for an edge `e` on the frontier of +`X`, and +`0` for other edges. Each perimeter walk of `X` uses `e` at least that often (`count_le_edgeCount`), +and +`exists_perimeterWalk` gives a perimeter walk that uses it exactly that often. So `l(X)` is the sum +of these +numbers (`perimeterWalkLength_eq`). Graph Minors XI, Section 8 (page 96), says this as "its length +equals +the length of the perimeter of $\Sigma - X$". +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +section Runs + +variable {Γ : Drawing S} {φ : ℝ → S} + +theorem runs_start {u v : S} {W : GraphWalk Γ.toGraph u v} {a b : ℝ} (h : RunsAlongOn Γ φ a b W) : + φ a = u := by + cases W with + | nil hv => exact h.2 + | cons hlink rest => + obtain ⟨c, -, hu, -⟩ := h + exact hu + +theorem runs_le {u v : S} (W : GraphWalk Γ.toGraph u v) : + ∀ {a b : ℝ}, RunsAlongOn Γ φ a b W → a ≤ b := by + induction W with + | nil hv => + rintro a b ⟨rfl, -⟩ + exact le_rfl + | @cons x y w e hlink rest ih => + rintro a b ⟨c, hac, -, -, -, hrest⟩ + exact hac.le.trans (ih hrest) + +/-- A point of a walk that is not a vertex lies in an edge of the walk. -/ +theorem runs_mem {u v : S} (W : GraphWalk Γ.toGraph u v) : + ∀ {a b : ℝ}, RunsAlongOn Γ φ a b W → ∀ t ∈ Icc a b, φ t ∉ Γ.V → ∃ e ∈ W.edges, φ t ∈ e := by + induction W with + | nil hv => + rintro a b ⟨rfl, hu⟩ t ⟨h₁, h₂⟩ ht + obtain rfl : t = a := le_antisymm h₂ h₁ + exact (ht (hu ▸ hv)).elim + | @cons x y w e hlink rest ih => + rintro a b ⟨c, hac, hu, -, him, hrest⟩ t ht hV + rcases lt_or_ge t c with htc | htc + · rcases eq_or_lt_of_le ht.1 with rfl | hat + · exact (hV (hu ▸ hlink.2.1)).elim + · exact ⟨e, List.mem_cons_self, him ▸ mem_image_of_mem φ ⟨hat, htc⟩⟩ + · obtain ⟨e', he', hm⟩ := ih hrest t ⟨htc, ht.2⟩ hV + exact ⟨e', List.mem_cons_of_mem _ he', hm⟩ + +open Classical in +/-- If a walk uses an edge at most once, it passes each point of the edge at most once. -/ +theorem runs_unique {u v : S} (W : GraphWalk Γ.toGraph u v) {e : Set S} (he : e ∈ Γ.E) : + ∀ {a b : ℝ}, RunsAlongOn Γ φ a b W → edgeCount W.edges e ≤ 1 → ∀ s ∈ Icc a b, ∀ t ∈ Icc a b, + φ s ∈ e → φ s = φ t → s = t := by + have hoffV : ∀ {t}, φ t ∈ e → φ t ∉ Γ.V := fun h => (he.2.1 h).2 + induction W with + | nil hv => + rintro a b ⟨rfl, -⟩ - s ⟨h₁, h₂⟩ t ⟨h₃, h₄⟩ - - + exact (le_antisymm h₂ h₁).trans (le_antisymm h₄ h₃).symm + | @cons x y w e' hlink rest ih => + rintro a b ⟨c, hac, hu, hi, him, hrest⟩ hc s hs t ht hse hst + have hte : φ t ∈ e := hst ▸ hse + have hrestV := runs_start hrest + have he' : e' ∈ Γ.E := hlink.1 + have hin : ∀ r ∈ Icc a b, φ r ∈ e → r < c → r ∈ Ioo a c ∧ e = e' := by + intro r hr hre hrc + have har : a < r := by + rcases eq_or_lt_of_le hr.1 with rfl | h + · exact (hoffV hre (hu ▸ hlink.2.1)).elim + · exact h + have hm : r ∈ Ioo a c := ⟨har, hrc⟩ + exact ⟨hm, Γ.edge_eq_of_mem he he' hre (him ▸ mem_image_of_mem φ hm)⟩ + by_cases hee : e = e' + · subst hee + have hc0 : edgeCount rest.edges e = 0 := by + have : edgeCount (e :: rest.edges) e = edgeCount rest.edges e + 1 := List.count_cons_self + change edgeCount (e :: rest.edges) e ≤ 1 at hc + omega + have hnot : e ∉ rest.edges := fun h => by + have : 0 < edgeCount rest.edges e := List.count_pos_iff.mpr h + omega + have hlt : ∀ r ∈ Icc a b, φ r ∈ e → r < c := by + intro r hr hre + by_contra hrc + obtain ⟨e₂, he₂, hm⟩ := runs_mem rest hrest r ⟨not_lt.mp hrc, hr.2⟩ (hoffV hre) + have he₂E : e₂ ∈ Γ.E := mem_E_of_mem_edges rest he₂ + exact hnot (Γ.edge_eq_of_mem he he₂E hre hm ▸ he₂) + exact hi (hin s hs hse (hlt s hs hse)).1 (hin t ht hte (hlt t ht hte)).1 hst + · have hge : ∀ r ∈ Icc a b, φ r ∈ e → r ∈ Icc c b := by + intro r hr hre + refine ⟨?_, hr.2⟩ + by_contra hrc + exact hee (hin r hr hre (not_le.mp hrc)).2 + have hc' : edgeCount rest.edges e ≤ 1 := by + have : edgeCount (e' :: rest.edges) e = edgeCount rest.edges e := + List.count_cons_of_ne (Ne.symm hee) + change edgeCount (e' :: rest.edges) e ≤ 1 at hc + omega + exact ih hrest hc' s (hge s hs hse) t (hge t ht hte) hse hst + +end Runs + +/-- A collar of a closed set `X`, near a point `y` of an edge inside `X` with both sides of the edge +outside +`X`, cannot have just one point of its bottom at `y`. -/ +theorem no_single_pass [T2Space S] (hS : IsClosedSurface S) {Γ : Drawing S} + {X e : Set S} (he : e ∈ Γ.E) (heX : e ⊆ X) (h : C(Circle × I, S)) + (hoff : ∀ p : Circle × I, 0 < p.2 → h p ∉ X) (hbot : ∀ z, h (z, 0) ∈ X) + (hop : IsOpen (X ∪ h '' {p | p.2 < 1})) {y : S} (hye : y ∈ e) (hyi : y ∈ interior (Xᶜ ∪ e)) + {z₀ : Circle} (hz₀ : h (z₀, 0) = y) (huniq : ∀ z, h (z, 0) = y → z = z₀) : False := by + have hK : CompactSpace S := hS.1 + obtain ⟨W, A₁, A₂, Δ₁, Δ₂, hW, hyW, hWU, -, -, -, d₁, d₂, c₁, c₂, hΔ₁, hΔ₂, s₁, s₂, hcov, hmeet⟩ + := + exists_edge_sides_split hS Γ he hye + have hyX : y ∈ X := heX hye + let G₀ : Set S := W ∩ interior (Xᶜ ∪ e) ∩ (X ∪ h '' {p | p.2 < 1}) + have hG₀ : IsOpen G₀ := (hW.inter isOpen_interior).inter hop + have hyG₀ : y ∈ G₀ := ⟨⟨hyW, hyi⟩, Or.inl hyX⟩ + have hO : IsOpen (h ⁻¹' G₀) := hG₀.preimage h.continuous + have hmem₀ : ((z₀, 0) : Circle × I) ∈ h ⁻¹' G₀ := by + change h (z₀, 0) ∈ G₀ + rw [hz₀] + exact hyG₀ + obtain ⟨u, v, hu, hv, hzu, h0v, huv⟩ := isOpen_prod_iff.mp hO z₀ 0 hmem₀ + -- A connected open arc around `z₀`. + obtain ⟨J, hJo, hzJ, hJu, hJc⟩ : ∃ J : Set Circle, IsOpen J ∧ z₀ ∈ J ∧ J ⊆ u ∧ IsPreconnected J + := by + obtain ⟨θ, hθ⟩ : ∃ θ : ℝ, Circle.exp θ = z₀ := ⟨_, Circle.exp_arg z₀⟩ + have hop' : IsOpen (Circle.exp ⁻¹' u) := hu.preimage Circle.exp.continuous + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hop' θ (by simpa [hθ] using hzu) + rw [Real.ball_eq_Ioo] at hball + refine ⟨Circle.exp '' Ioo (θ - ε) (θ + ε), isLocalHomeomorph_circleExp.isOpenMap _ isOpen_Ioo, + ⟨θ, ⟨by linarith, by linarith⟩, hθ⟩, ?_, isPreconnected_Ioo.image _ + Circle.exp.continuous.continuousOn⟩ + rintro _ ⟨t, ht, rfl⟩ + exact hball ht + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp hv 0 h0v + let δ' : I := ⟨min (δ / 2) 1, by positivity, min_le_right _ _⟩ + have hδ' : (0 : I) < δ' := by + change (0 : ℝ) < min (δ / 2) 1 + positivity + have hvsub : Iio δ' ⊆ v := by + intro t ht + refine hball ?_ + have ht' : t.1 < min (δ / 2) 1 := ht + rw [Metric.mem_ball, Subtype.dist_eq, Icc.coe_zero, Real.dist_eq, sub_zero, abs_of_nonneg t.2.1] + linarith [min_le_left (δ / 2) (1 : ℝ)] + let B : Set (Circle × I) := J ×ˢ Iio δ' + have hBo : IsOpen B := hJo.prod isOpen_Iio + have hBG : ∀ p ∈ B, h p ∈ G₀ := fun p hp => huv ⟨hJu hp.1, hvsub hp.2⟩ + have hCc : IsClosed (h '' Bᶜ) := (hBo.isClosed_compl.isCompact.image h.continuous).isClosed + have hyC : y ∉ h '' Bᶜ := by + rintro ⟨⟨z, t⟩, hp, hpe⟩ + have ht0 : t = 0 := by + by_contra ht + exact hoff (z, t) (unitInterval.pos_iff_ne_zero.mpr ht) (hpe ▸ hyX) + subst ht0 + obtain rfl := huniq z hpe + exact hp ⟨hzJ, hδ'⟩ + let T : Set S := h '' (J ×ˢ Ioo 0 δ') + have hTc : IsPreconnected T := + (hJc.prod isPreconnected_Ioo).image _ h.continuous.continuousOn + have hTW : T ⊆ W := by + rintro _ ⟨p, hp, rfl⟩ + exact (hBG p ⟨hp.1, hp.2.2⟩).1.1 + have hTX : ∀ x ∈ T, x ∉ X := by + rintro _ ⟨p, hp, rfl⟩ + exact hoff p hp.2.1 + have hTU : ∀ x ∈ T, x ∉ Γ.U := fun x hx hxU => hTX x hx (heX (hWU ⟨hTW hx, hxU⟩)) + -- Each point near `y` off `X` is in `T`. + let G : Set S := G₀ ∩ (h '' Bᶜ)ᶜ + have hGo : IsOpen G := hG₀.inter hCc.isOpen_compl + have hyG : y ∈ G := ⟨hyG₀, hyC⟩ + have hsub : ∀ a ∈ G, a ∉ Γ.U → a ∈ T := by + rintro a ⟨⟨⟨-, hai⟩, hah⟩, haC⟩ haU + have hae : a ∉ e := fun h' => haU ((he.2.1 h').1) + have haX : a ∉ X := by + rcases interior_subset hai with h' | h' + · exact h' + · exact (hae h').elim + obtain ⟨p, -, rfl⟩ := hah.resolve_left haX + have hpB : p ∈ B := by + by_contra hp + exact haC ⟨p, hp, rfl⟩ + have hp0 : 0 < p.2 := by + by_contra hp + have ht : p.2 = 0 := le_antisymm (not_lt.mp hp) (unitInterval.nonneg _) + have hpz : p = (p.1, 0) := Prod.ext rfl ht + exact haX (hpz ▸ hbot p.1) + exact ⟨p, ⟨hpB.1, hp0, hpB.2⟩, rfl⟩ + have key : ∀ {Δ₃ A₄ Δ₄ : Set S}, T ⊆ Δ₃ → A₄ ⊆ Δ₄ → Disjoint A₄ Γ.U → y ∈ closure A₄ → + Δ₃ ∩ Δ₄ ⊆ Γ.U → False := by + intro Δ₃ A₄ Δ₄ h₁ h₂ h₃ h₄ h₅ + obtain ⟨a, haG, haA⟩ := mem_closure_iff.mp h₄ G hGo hyG + have haU := disjoint_left.mp h₃ haA + exact haU (h₅ ⟨h₁ (hsub a haG haU), h₂ haA⟩) + have hTcov : T ⊆ Δ₁ ∪ Δ₂ := fun x hx => hcov (hTW hx) + have hsplit : T ⊆ Δ₁ ∨ T ⊆ Δ₂ := by + by_contra hnot + push Not at hnot + obtain ⟨hn₁, hn₂⟩ := hnot + obtain ⟨a, ha, ha₁⟩ := not_subset.mp hn₁ + obtain ⟨b, hb, hb₂⟩ := not_subset.mp hn₂ + obtain ⟨x, hxT, hx₁, hx₂⟩ := isPreconnected_closed_iff.mp hTc Δ₁ Δ₂ hΔ₁ hΔ₂ hTcov + ⟨b, hb, (hTcov hb).resolve_right hb₂⟩ ⟨a, ha, (hTcov ha).resolve_left ha₁⟩ + exact hTU x hxT (hmeet ⟨hx₁, hx₂⟩) + rcases hsplit with hs | hs + · exact key hs s₂ d₂ (c₂ ⟨hye, hyW⟩) hmeet + · exact key hs s₁ d₁ (c₁ ⟨hye, hyW⟩) (by rwa [inter_comm]) + +open Classical in +/-- The number of sides of `e` outside `X`, if `e` meets the frontier of `X`, and otherwise `0`. -/ +noncomputable def perimeterCount (X e : Set S) : ℕ := + if (e ∩ frontier X).Nonempty then (if IsTwoSided Xᶜ e then 2 else 1) else 0 + +/-- Each point of the circle is `Circle.exp (2πt)` for some `t` in `[0, 1)`. -/ +theorem exists_collar_time (z : Circle) : ∃ t : ℝ, t ∈ Ico (0 : ℝ) 1 ∧ z = Circle.exp + (2 * Real.pi * t) := by + obtain ⟨i, hi, u, hu, hz⟩ := exists_circle_param one_pos z + obtain rfl : i = 0 := by omega + refine ⟨u.1, ⟨u.2.1, hu⟩, ?_⟩ + simpa using hz + +variable [T2Space S] [ConnectedSpace S] + +omit [ConnectedSpace S] in +/-- **Each perimeter walk uses `e` at least `perimeterCount X e` times.** -/ +theorem count_le_edgeCount (hS : IsClosedSurface S) {Γ : Drawing S} {X : Set S} (hXc : IsClosed X) + (hXn : IsGammaNice Γ X) {u : S} {W : GraphWalk Γ.toGraph u u} (hW : IsPerimeterWalk Γ X W) + {e : Set S} (he : e ∈ Γ.E) : perimeterCount X e ≤ edgeCount W.edges e := by + classical + obtain ⟨h, -, hoff, hrng, hop, hcase⟩ := hW + rw [subBd_eq_frontier] at hrng + by_cases hef : (e ∩ frontier X).Nonempty + swap + · simp [perimeterCount, hef] + obtain ⟨y₀, hy₀, hy₀f⟩ := hef + have hef : (e ∩ frontier X).Nonempty := ⟨y₀, hy₀, hy₀f⟩ + have heF : e ⊆ frontier X := edge_subset_frontier hS hXc hXn he hy₀ hy₀f + have hbot : ∀ z, h (z, 0) ∈ X := fun z => hXc.frontier_subset (hrng ▸ mem_range_self z) + rcases hcase with ⟨h0, hu⟩ | ⟨-, hrun⟩ + · exfalso + obtain ⟨z, hz⟩ := hrng.superset hy₀f + have hzu : y₀ = u := hz.symm.trans (hu z) + have huV : u ∈ Γ.V := by + cases W with + | nil hv => exact hv + | cons hl rest => exact hl.2.1 + exact (he.2.1 hy₀).2 (hzu ▸ huV) + have htime : ∀ y ∈ e, ∃ z, ∃ t ∈ Ico (0 : ℝ) 1, collarCurve h t = y ∧ h (z, 0) = y ∧ + z = Circle.exp (2 * Real.pi * t) := by + intro y hy + obtain ⟨z, hz⟩ := hrng.superset (heF hy) + obtain ⟨t, ht, rfl⟩ := exists_collar_time z + exact ⟨_, t, ht, hz, hz, rfl⟩ + have hpos : 0 < edgeCount W.edges e := by + obtain ⟨z, t, ht, hty, -⟩ := htime y₀ hy₀ + obtain ⟨e', he', hm⟩ := runs_mem W hrun t ⟨ht.1, ht.2.le⟩ (by + rw [hty] + exact (he.2.1 hy₀).2) + have heq : e = e' := Γ.edge_eq_of_mem he (mem_E_of_mem_edges W he') (hty ▸ hy₀) hm + exact List.count_pos_iff.mpr (heq ▸ he') + by_cases hts : IsTwoSided Xᶜ e + swap + · simp only [perimeterCount, hef, hts, ite_true, ite_false] + exact hpos + simp only [perimeterCount, hef, hts, ite_true] + by_contra hlt + have hle : edgeCount W.edges e ≤ 1 := by omega + obtain ⟨y, hye, hyi⟩ := hts + obtain ⟨z₀, t₀, ht₀, hty₀, hz₀, rfl⟩ := htime y hye + refine no_single_pass hS he (heF.trans hXc.frontier_subset) h hoff hbot hop hye hyi hz₀ fun z hz + => ?_ + obtain ⟨t, ht, rfl⟩ := exists_collar_time z + have heqt : t = t₀ := runs_unique W he hrun hle t ⟨ht.1, ht.2.le⟩ t₀ ⟨ht₀.1, ht₀.2.le⟩ + (by + change h (_, 0) ∈ e + rw [hz] + exact hye) + (by + change h (_, 0) = h (_, 0) + rw [hz, hz₀]) + rw [heqt] + +omit [T2Space S] [ConnectedSpace S] in +/-- The length of a walk is the sum of the number of times it uses each edge. -/ +theorem length_eq_sum {Γ : Drawing S} {u v : S} (W : GraphWalk Γ.toGraph u v) : + W.length = ∑ e ∈ Γ.finite_edges.toFinset, edgeCount W.edges e := by + classical + have hsub : W.edges.toFinset ⊆ Γ.finite_edges.toFinset := fun e he => + Γ.finite_edges.mem_toFinset.mpr (mem_E_of_mem_edges W (List.mem_toFinset.mp he)) + have h₀ : ∀ e ∈ Γ.finite_edges.toFinset, e ∉ W.edges.toFinset → edgeCount W.edges e = 0 := + fun e _ he => edgeCount_eq_zero fun h => he (List.mem_toFinset.mpr h) + rw [← Finset.sum_subset hsub h₀] + exact (List.sum_toFinset_count_eq_length W.edges).symm + +/-- The sum over the edges of `Γ` of `perimeterCount X e`. -/ +noncomputable def perimeterSum (Γ : Drawing S) (X : Set S) : ℕ := + ∑ e ∈ Γ.finite_edges.toFinset, perimeterCount X e + +/-- **A shortest perimeter walk.** The walk has length `l(X)`, and it uses each edge exactly +`perimeterCount X e` times. -/ +theorem exists_minimal_perimeterWalk (hS : IsClosedSurface S) + {Γ : Drawing S} {X : Set S} (hXc : IsClosed X) + (hXn : IsGammaNice Γ X) (hXs : IsSimplyConnectedSet X) (hne : X.Nonempty) (hu : X ≠ univ) : + ∃ (u : S) (W : GraphWalk Γ.toGraph u u), IsPerimeterWalk Γ X W ∧ + W.length = perimeterWalkLength Γ X ∧ W.length = perimeterSum Γ X ∧ + ∀ e ∈ Γ.E, edgeCount W.edges e = perimeterCount X e := by + obtain ⟨u, W, hW, hc⟩ := exists_perimeterWalk hS hXc hXn hXs hne hu + have hc' : ∀ e ∈ Γ.E, edgeCount W.edges e = perimeterCount X e := hc + have hsum : W.length = perimeterSum Γ X := by + rw [length_eq_sum] + exact Finset.sum_congr rfl fun e he => hc' e (Γ.finite_edges.mem_toFinset.mp he) + refine ⟨u, W, hW, ?_, hsum, hc'⟩ + apply le_antisymm + · refine le_csInf ⟨_, u, W, hW, rfl⟩ ?_ + rintro _ ⟨v, W', hW', rfl⟩ + rw [hsum, length_eq_sum, perimeterSum] + exact Finset.sum_le_sum fun e he => count_le_edgeCount hS hXc hXn hW' + (Γ.finite_edges.mem_toFinset.mp he) + · exact Nat.sInf_le ⟨u, W, hW, rfl⟩ + +/-- The formula for `l(X)`. -/ +theorem perimeterWalkLength_eq (hS : IsClosedSurface S) + {Γ : Drawing S} {X : Set S} (hXc : IsClosed X) + (hXn : IsGammaNice Γ X) (hXs : IsSimplyConnectedSet X) (hne : X.Nonempty) (hu : X ≠ univ) : + perimeterWalkLength Γ X = perimeterSum Γ X := by + obtain ⟨u', W, -, h₁, h₂, -⟩ := exists_minimal_perimeterWalk hS hXc hXn hXs hne hu + exact h₁.symm.trans h₂ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/PerimeterExists.lean b/LeanPool/GraphMinor/GM11/PerimeterExists.lean new file mode 100644 index 0000000000..52cb807a13 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PerimeterExists.lean @@ -0,0 +1,456 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PerimeterPull +public import LeanPool.GraphMinor.GM11.NiceSets +public import LeanPool.GraphMinor.GM11.Section7b +public import LeanPool.GraphMinor.GM11.EvenCircuit + +/-! +# Existence of perimeter walks + +`exists_perimeter_of_disc`: a closed, `Γ`-nice, simply-connected set `X` inside an open disc has a +perimeter +walk, which uses each edge of `Γ ∩ bd(X)` once for each side of the edge outside `X`. The proof +collapses the +complement of the open disc to a point. In the resulting sphere `Γ ∩ bd(X)` is 2-cell, the +complement of +`X` is a region of it, and `exists_region_walk` gives the walk. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval OnePoint + +universe u + +/-- An injective image of an `O`-arc in a Hausdorff space is an `O`-arc. -/ +theorem isOArc_image {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] [T2Space Y] {F : Set X} + (hF : IsOArc F) {G : X → Y} (hG : ContinuousOn G F) (hi : InjOn G F) : IsOArc (G '' F) := by + obtain ⟨φ⟩ := hF + have hc : CompactSpace F := φ.compactSpace + let j : F → G '' F := fun x => ⟨G x.1, x.1, x.2, rfl⟩ + have hjc : Continuous j := Continuous.subtype_mk hG.domRestrict _ + have hjb : Function.Bijective j := by + constructor + · intro x y hxy + exact Subtype.ext (hi x.2 y.2 (congrArg Subtype.val hxy)) + · rintro ⟨_, x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + exact ⟨φ.trans (hjc.homeoOfEquivCompactToT2 (f := Equiv.ofBijective j hjb))⟩ + +section Count + +variable {α β : Type*} + +open Classical in +theorem edgeCount_map {S S' : Type*} {l : List (Set S')} {G : Set S' → Set S} {T : Set (Set S')} + (hl : ∀ x ∈ l, x ∈ T) (hinj : InjOn G T) {e : Set S'} (he : e ∈ T) : + edgeCount (l.map G) (G e) = edgeCount l e := by + induction l with + | nil => simp [edgeCount] + | cons a l ih => + have h₁ := ih fun x hx => hl x (List.mem_cons_of_mem _ hx) + simp only [edgeCount] at h₁ ⊢ + have ha := hl a List.mem_cons_self + by_cases hae : a = e + · subst hae + simp [List.count_cons_self, h₁] + · have hne : G a ≠ G e := fun h => hae (hinj ha he h) + rw [List.map_cons, List.count_cons_of_ne hne, List.count_cons_of_ne hae, h₁] + +open Classical in +theorem edgeCount_eq_zero {S : Type*} {l : List (Set S)} {e : Set S} (h : e ∉ l) : edgeCount l e + = 0 := + List.count_eq_zero.mpr h + +end Count + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] {Γ : Drawing S} {X A : + Set S} + +private theorem drawing_circle_bounds_subdisc + {S : Type u} + [TopologicalSpace S] + [T2Space S] + [ConnectedSpace S] + {X : Set S} + {A : Set S} + (hS : IsClosedSurface S) + (hXs : IsSimplyConnectedSet X) + (hXA : X ⊆ A) + [T2Space (OnePoint ↑A)] + (hf : Continuous (collapse A)) + (g : OnePoint ↑A → S) + (hfA : ∀ {x : S}, x ∈ A → (collapse A) x ≠ ∞) + (hgf : ∀ (x : S), (collapse A) x ≠ ∞ → g ((collapse A) x) = x) + (hfg : ∀ (y : OnePoint ↑A), y ≠ ∞ → (collapse A) (g y) = y) + (hgc : ∀ (y : OnePoint ↑A), y ≠ ∞ → ContinuousAt g y) + (hinjA : InjOn (collapse A) A) + (hQc : IsClosed[instTopologicalSpace] ((collapse A) '' X)) + (hinf : ∞ ∉ ((collapse A) '' X)) + (D : Drawing (OnePoint ↑A)) + (hDU' : D.U = frontier ((collapse A) '' X)) : + ∀ (F : Set (OnePoint ↑A)), IsOArc F → F ⊆ D.U → ∃ Δ, IsClosedDisc Δ ∧ Δ ⊆ ((collapse A) '' X) + ∧ discBd Δ = F := by + let f := collapse A + let Q := f '' X + intro F hF hFU + have hFinf : ∀ y ∈ F, y ≠ ∞ := fun y hy h => hinf (h ▸ hQc.frontier_subset (hDU' ▸ hFU hy)) + have hgcF : ContinuousOn g F := fun y hy => (hgc y (hFinf y hy)).continuousWithinAt + have hginj : InjOn g F := fun x hx y hy h => by + rw [← hfg x (hFinf x hx), ← hfg y (hFinf y hy), h] + have hO := isOArc_image hF hgcF hginj + have hFX : g '' F ⊆ X := by + rintro _ ⟨y, hy, rfl⟩ + rw [hDU'] at hFU + obtain ⟨x, hx, rfl⟩ := hQc.frontier_subset (hFU hy) + rw [hgf x (hfA (hXA hx))] + exact hx + obtain ⟨φ⟩ := id hO + have hnull : IsNullHomotopicOArcIn X (g '' F) := by + refine ⟨φ, hXs.2 _ ?_⟩ + rintro _ ⟨z, rfl⟩ + exact hFX (φ z).2 + obtain ⟨Δ, hΔX, hΔ, hbd⟩ := theorem_7_2_proof hS hO hFX hnull + obtain ⟨h₁, h₂⟩ := isClosedDisc_image hΔ hf.continuousOn (hinjA.mono (hΔX.trans hXA)) + refine ⟨f '' Δ, h₁, image_mono hΔX, ?_⟩ + rw [h₂, ← IsClosedDisc.frontier_eq_discBd hS hΔ, ← subBd_eq_frontier, hbd, image_image] + calc (fun x => f (g x)) '' F = id '' F := image_congr fun y hy => hfg y (hFinf y hy) + _ = F := image_id F + +private theorem map_link_of_drawing_embedding + {S : Type u} + [TopologicalSpace S] + {Γ : Drawing S} + {A : Set S} + (g : OnePoint ↑A → S) + (hfA : ∀ {x : S}, x ∈ A → (collapse A) x ≠ ∞) + (hgf : ∀ (x : S), (collapse A) x ≠ ∞ → g ((collapse A) x) = x) + (hinjA : InjOn (collapse A) A) + (B : Drawing S) + (hBs : B.IsSubdrawing Γ) + (hBA : B.U ⊆ A) + (D : Drawing (OnePoint ↑A)) + (hDV : D.V = collapse A '' B.V) + (hcl : ∀ e ∈ B.E, closure[instTopologicalSpace] (collapse A '' e) = collapse A '' closure e) + (hEA : ∀ {e₀ : Set S}, e₀ ∈ B.E → e₀ ⊆ A) + (hgfe : ∀ {e₀ : Set S}, e₀ ⊆ A → g '' (collapse A) '' e₀ = e₀) + (hEA' : ∀ e ∈ D.E, ∃ e₀ ∈ B.E, e = (collapse A) '' e₀) : + ∀ (e : Set (OnePoint ↑A)) (x y : OnePoint ↑A), D.toGraph.IsLink e x y → Γ.toGraph.IsLink (g '' + e) (g x) (g y) := by + let f := collapse A + rintro e x y ⟨he, hx, hy, hcap⟩ + obtain ⟨e₀, he₀, rfl⟩ := hEA' e he + rw [hDV] at hx hy + obtain ⟨x₀, hx₀, rfl⟩ := hx + obtain ⟨y₀, hy₀, rfl⟩ := hy + have hxA : x₀ ∈ A := hBA (B.V_subset_U hx₀) + have hyA : y₀ ∈ A := hBA (B.V_subset_U hy₀) + rw [hgfe (hEA he₀), hgf x₀ (hfA hxA), hgf y₀ (hfA hyA)] + refine ⟨hBs.2 he₀, hBs.1 hx₀, hBs.1 hy₀, ?_⟩ + rw [← hBs.closure_inter_V he₀] + rw [hcl e₀ he₀, hDV] at hcap + have hclA : closure e₀ ⊆ A := (B.closure_subset_U he₀).trans hBA + ext w + constructor + · rintro ⟨hw, hwV⟩ + have hmem' : f w ∈ f '' closure e₀ ∩ f '' B.V := ⟨mem_image_of_mem f hw, mem_image_of_mem f + hwV⟩ + rw [hcap] at hmem' + rcases hmem' with h₁ | h₁ + · exact Or.inl (hinjA (hclA hw) hxA h₁) + · exact Or.inr (hinjA (hclA hw) hyA h₁) + · have hxm : f x₀ ∈ f '' closure e₀ ∩ f '' B.V := by + rw [hcap] + exact Or.inl rfl + have hym : f y₀ ∈ f '' closure e₀ ∩ f '' B.V := by + rw [hcap] + exact Or.inr rfl + rintro (rfl | rfl) + · obtain ⟨z, hz, hze⟩ := hxm.1 + obtain rfl := hinjA (hclA hz) hxA hze + exact ⟨hz, hx₀⟩ + · obtain ⟨z, hz, hze⟩ := hym.1 + obtain rfl := hinjA (hclA hz) hyA hze + exact ⟨hz, hy₀⟩ + +open Classical in +private theorem perimeter_edge_count_pull + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {Γ : Drawing S} + {X : Set S} + {A : Set S} + (hS : IsClosedSurface S) + (hXc : IsClosed X) + (hXn : IsGammaNice Γ X) + (hA : IsOpenDisc A) + (hf : Continuous (collapse A)) + (g : OnePoint ↑A → S) + (hfA : ∀ {x : S}, x ∈ A → (collapse A) x ≠ ∞) + (hgf : ∀ (x : S), (collapse A) x ≠ ∞ → g ((collapse A) x) = x) + (hopenf : ∀ {O : Set S}, IsOpen O → O ⊆ A → IsOpen[instTopologicalSpace] ((collapse A) '' O)) + (hpre : (collapse A) ⁻¹' ((collapse A) '' X) = X) + (hfr : frontier ((collapse A) '' X) = (collapse A) '' frontier X) + (D : Drawing (OnePoint ↑A)) + (hDE : D.E = image (collapse A) '' (Γ.interSet (frontier X)).E) + (u' : OnePoint ↑A) + (W' : GraphWalk D.toGraph u' u') + (hcount : ∀ e ∈ D.E, edgeCount W'.edges e = + if (e ∩ frontier ((collapse A '' X)ᶜ)).Nonempty then + if IsTwoSided (collapse A '' X)ᶜ e then 2 else 1 else 0) + (hEA : ∀ {e₀ : Set S}, e₀ ∈ (Γ.interSet (frontier X)).E → e₀ ⊆ A) + (hgfe : ∀ {e₀ : Set S}, e₀ ⊆ A → g '' (collapse A) '' e₀ = e₀) + (hEA' : ∀ e ∈ D.E, ∃ e₀ ∈ (Γ.interSet (frontier X)).E, e = (collapse A) '' e₀) + (W : GraphWalk Γ.toGraph (g u') (g u')) + (hedges : W.edges = List.map (image g) W'.edges) : + ∀ e ∈ Γ.E, edgeCount W.edges e = if (e ∩ frontier X).Nonempty then if IsTwoSided Xᶜ e then 2 + else 1 else 0 := by + let f := collapse A + let Q := f '' X + let B := Γ.interSet (frontier X) + intro e he + have hBE : ∀ e₀, e₀ ∈ B.E ↔ e₀ ∈ Γ.E ∧ e₀ ⊆ frontier X := by + intro e₀ + change e₀ ∈ (Γ.span _ _).E ↔ _ + rw [Γ.span_E] + exact ⟨fun h => h.1, fun h => ⟨h, h.1⟩⟩ + by_cases hef : (e ∩ frontier X).Nonempty + · obtain ⟨y, hye, hyf⟩ := hef + have heB : e ∈ B.E := (hBE e).mpr ⟨he, edge_subset_frontier hS hXc hXn he hye hyf⟩ + have heA := hEA heB + have heD : f '' e ∈ D.E := hDE ▸ mem_image_of_mem _ heB + have hinjG : InjOn (image g) D.E := by + intro e₁ h₁ e₂ h₂ h + obtain ⟨c₁, hc₁, rfl⟩ := hEA' e₁ h₁ + obtain ⟨c₂, hc₂, rfl⟩ := hEA' e₂ h₂ + rw [hgfe (hEA hc₁), hgfe (hEA hc₂)] at h + rw [h] + have hmemD : ∀ x ∈ W'.edges, x ∈ D.E := fun x hx => mem_E_of_mem_edges W' hx + have hc₁ := edgeCount_map hmemD hinjG heD + rw [← hedges, hgfe heA] at hc₁ + rw [hc₁, hcount _ heD] + have hn : ((f '' e) ∩ frontier Qᶜ).Nonempty := by + refine ⟨f y, mem_image_of_mem f hye, ?_⟩ + rw [frontier_compl, hfr] + exact mem_image_of_mem f hyf + have hpreU : f ⁻¹' (Qᶜ ∪ f '' e) = Xᶜ ∪ e := by + ext z + constructor + · rintro (hz | ⟨w, hw, hwz⟩) + · refine Or.inl fun hzX => hz (mem_image_of_mem f hzX) + · refine Or.inr ?_ + have hne' : f z ≠ ∞ := hwz ▸ hfA (heA hw) + rw [← hgf z hne'] + change g (f z) ∈ e + rw [← hwz, hgf w (hfA (heA hw))] + exact hw + · rintro (hz | hz) + · refine Or.inl fun hzQ => hz ?_ + rw [← hpre] + exact hzQ + · exact Or.inr (mem_image_of_mem f hz) + have hside : IsTwoSided Qᶜ (f '' e) ↔ IsTwoSided Xᶜ e := by + constructor + · rintro ⟨w, ⟨x, hx, rfl⟩, hw⟩ + refine ⟨x, hx, ?_⟩ + have hop₁ : IsOpen (f ⁻¹' interior (Qᶜ ∪ f '' e)) := isOpen_interior.preimage hf + have hsub : f ⁻¹' interior (Qᶜ ∪ f '' e) ⊆ Xᶜ ∪ e := by + rw [← hpreU] + exact preimage_mono interior_subset + exact interior_maximal hsub hop₁ hw + · rintro ⟨x, hx, hxi⟩ + refine ⟨f x, mem_image_of_mem f hx, ?_⟩ + have hop₁ : IsOpen (interior (Xᶜ ∪ e) ∩ A) := isOpen_interior.inter hA.1 + have hsub : f '' (interior (Xᶜ ∪ e) ∩ A) ⊆ Qᶜ ∪ f '' e := by + rintro _ ⟨z, ⟨hz, -⟩, rfl⟩ + have hz' : z ∈ f ⁻¹' (Qᶜ ∪ f '' e) := by + rw [hpreU] + exact interior_subset hz + exact hz' + exact interior_maximal hsub (hopenf hop₁ inter_subset_right) + (mem_image_of_mem f ⟨hxi, heA hx⟩) + change (if (f '' e ∩ frontier Qᶜ).Nonempty then + if IsTwoSided Qᶜ (f '' e) then 2 else 1 else 0) = _ + have hef' : (e ∩ frontier X).Nonempty := ⟨y, hye, hyf⟩ + simp only [hn, hside, hef', ite_true] + · have hnot : e ∉ W.edges := by + intro hmem' + rw [hedges, List.mem_map] at hmem' + obtain ⟨e₁, h₁, rfl⟩ := hmem' + obtain ⟨c, hc, rfl⟩ := hEA' e₁ (mem_E_of_mem_edges W' h₁) + rw [hgfe (hEA hc)] at hef + obtain ⟨x, hx⟩ : c.Nonempty := hc.1 + exact hef ⟨x, hx, ((hBE c).mp hc).2 hx⟩ + rw [edgeCount_eq_zero hnot] + simp only [hef, ite_false] + +open Classical in +/-- **Existence of a perimeter walk**, for a set inside an open disc and with an edge on its +frontier. -/ +theorem exists_perimeter_of_disc (hS : IsClosedSurface S) (hXc : IsClosed X) + (hXn : IsGammaNice Γ X) (hXs : IsSimplyConnectedSet X) (hne : X.Nonempty) (hA : IsOpenDisc A) + (hXA : X ⊆ A) (hE : (Γ.interSet (frontier X)).E.Nonempty) : + ∃ (u : S) (W : GraphWalk Γ.toGraph u u), IsPerimeterWalk Γ X W ∧ 0 < W.length ∧ + ∀ e ∈ Γ.E, edgeCount W.edges e = + if (e ∩ frontier X).Nonempty then (if IsTwoSided Xᶜ e then 2 else 1) else 0 := by + have hK : CompactSpace S := hS.1 + have hsph := isSphere_onePoint hA + obtain ⟨hS', hconn'⟩ := IsSphere.isClosedSurface hsph + have hT2' : T2Space (OnePoint A) := hS'.2.1 + have hf : Continuous (collapse A) := continuous_collapse hA.1 + obtain ⟨b, hb⟩ := hne + let f := collapse A + let g : OnePoint A → S := uncollapse b + have hnS : Nonempty S := ⟨b⟩ + have hfA : ∀ {x}, x ∈ A → f x ≠ ∞ := fun {x} hx => by + change collapse A x ≠ ∞ + rw [collapse_of_mem hx] + exact coe_ne_infty _ + have hAf : ∀ {x}, f x ≠ ∞ → x ∈ A := fun {x} hx => by + by_contra h + exact hx (collapse_of_notMem h) + have hgf : ∀ x, f x ≠ ∞ → g (f x) = x := fun x hx => by + change uncollapse b (collapse A x) = x + rw [collapse_of_mem (hAf hx), uncollapse_coe] + have hfg : ∀ y, y ≠ ∞ → f (g y) = y := by + intro y hy + obtain ⟨a, rfl⟩ := ne_infty_iff_exists.mp hy + change collapse A (uncollapse b (a : OnePoint A)) = a + rw [uncollapse_coe, collapse_of_mem a.2] + have hgc : ∀ y, y ≠ ∞ → ContinuousAt g y := by + intro y hy + obtain ⟨a, rfl⟩ := ne_infty_iff_exists.mp hy + exact continuousAt_uncollapse b a + have hinjA : InjOn f A := fun x hx y hy h => by + rw [← hgf x (hfA hx), ← hgf y (hfA hy), h] + have hopenf : ∀ {O : Set S}, IsOpen O → O ⊆ A → IsOpen (f '' O) := by + intro O hO hOA + have heq : f '' O = ((↑) : A → OnePoint A) '' (Subtype.val ⁻¹' O) := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + exact ⟨⟨x, hOA hx⟩, hx, (collapse_of_mem (hOA hx)).symm⟩ + · rintro ⟨a, ha, rfl⟩ + exact ⟨a.1, ha, collapse_of_mem a.2⟩ + rw [heq] + exact OnePoint.isOpenEmbedding_coe.isOpenMap _ (hO.preimage continuous_subtype_val) + set Q := f '' X with hQ + have hQc : IsClosed Q := (hXc.isCompact.image hf).isClosed + have hpre : f ⁻¹' Q = X := by + apply subset_antisymm + · rintro x ⟨y, hy, hxy⟩ + have hne' : f x ≠ ∞ := hxy ▸ hfA (hXA hy) + rw [← hgf x hne', ← hxy, hgf y (hfA (hXA hy))] + exact hy + · exact fun x hx => mem_image_of_mem f hx + have hinf : (∞ : OnePoint A) ∉ Q := by + rintro ⟨x, hx, hxe⟩ + exact hfA (hXA hx) hxe + have hfr : frontier Q = f '' frontier X := by + rw [hQc.frontier_eq, hXc.frontier_eq] + ext y + constructor + · rintro ⟨⟨x, hx, rfl⟩, hint⟩ + refine ⟨x, ⟨hx, fun h => hint ?_⟩, rfl⟩ + exact interior_maximal (image_mono interior_subset) (hopenf isOpen_interior + (interior_subset.trans hXA)) (mem_image_of_mem f h) + · rintro ⟨x, ⟨hx, hint⟩, rfl⟩ + refine ⟨mem_image_of_mem f hx, fun h => hint ?_⟩ + have hop : IsOpen (f ⁻¹' interior Q) := isOpen_interior.preimage hf + have hsub : f ⁻¹' interior Q ⊆ X := by + rw [← hpre] + exact preimage_mono interior_subset + exact interior_maximal hsub hop h + let B := Γ.interSet (frontier X) + have hBs : B.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hBU : B.U = frontier X := frontier_interSet hS hXc hXn + have hfrA : frontier X ⊆ A := hXc.frontier_subset.trans hXA + have hBA : B.U ⊆ A := hBU ▸ hfrA + obtain ⟨D, hDU, hDV, hDE, hcl⟩ := exists_transport B hf (hinjA.mono hBA) + have hDU' : D.U = frontier Q := by rw [hDU, hBU, hfr] + have hdisc : ∀ F, IsOArc F → F ⊆ D.U → ∃ Δ, IsClosedDisc Δ ∧ Δ ⊆ Q ∧ discBd Δ = F := by + exact drawing_circle_bounds_subdisc (S := S) (X := X) (A := A) hS hXs hXA hf g hfA hgf hfg hgc + hinjA hQc hinf D hDU' + have hQp : IsPreconnected Q := (hXs.1.image' hf.continuousOn).isConnected.isPreconnected + have hQne : Q.Nonempty := ⟨f b, mem_image_of_mem f hb⟩ + have hQu : Q ≠ univ := fun h => hinf (h ▸ mem_univ _) + obtain ⟨hreg, -, hT⟩ := sphere_outside hS' hsph hQc hQp hQne hQu hDU' hdisc + have hEne : D.E.Nonempty := by + obtain ⟨e, he⟩ := hE + exact ⟨f '' e, hDE ▸ mem_image_of_mem _ he⟩ + obtain ⟨u', W', h', hpos, hinj, hmem, hrng, hop, hrun, hcount⟩ := + exists_region_walk hS' hsph hT hEne hreg + rw [frontier_compl] at hrng + rw [compl_compl] at hop + have hbot : ∀ z, h' (z, 0) ∈ Q := fun z => hQc.frontier_subset (hrng ▸ mem_range_self z) + obtain ⟨h, hinjh, hoffh, hboth, hoph⟩ := pull_collar hf hgc hgf hfg hinf h' hinj + (fun p hp hq => hmem p hp hq) hbot hop + rw [hpre] at hoph + -- The edges and vertices of `D` come from those of `B`. + have hEA : ∀ {e₀ : Set S}, e₀ ∈ B.E → e₀ ⊆ A := fun {e₀} he x hx => hBA (he.2.1 hx).1 + have hgfe : ∀ {e₀ : Set S}, e₀ ⊆ A → image g (f '' e₀) = e₀ := by + intro e₀ he + rw [image_image] + calc (fun x => g (f x)) '' e₀ = id '' e₀ := image_congr fun x hx => hgf x (hfA (he hx)) + _ = e₀ := image_id e₀ + have hEA' : ∀ e ∈ D.E, ∃ e₀ ∈ B.E, e = f '' e₀ := by + intro e he + rw [hDE] at he + obtain ⟨e₀, he₀, rfl⟩ := he + exact ⟨e₀, he₀, rfl⟩ + have hlink : ∀ e x y, D.toGraph.IsLink e x y → Γ.toGraph.IsLink (image g e) (g x) (g y) := by + exact map_link_of_drawing_embedding (S := S) (Γ := Γ) (A := A) g hfA hgf hinjA B hBs hBA D hDV + hcl hEA hgfe hEA' + have hvert : ∀ v ∈ D.V, g v ∈ Γ.V := by + intro v hv + rw [hDV] at hv + obtain ⟨x₀, hx₀, rfl⟩ := hv + rw [hgf x₀ (hfA (hBA (B.V_subset_U hx₀)))] + exact hBs.1 hx₀ + have hginj : ∀ e ∈ D.E, InjOn g e := by + intro e he + obtain ⟨e₀, he₀, rfl⟩ := hEA' e he + rintro _ ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩ h₁ + rw [hgf x (hfA (hEA he₀ hx)), hgf y (hfA (hEA he₀ hy))] at h₁ + rw [h₁] + obtain ⟨W, hW, hedges⟩ := walk_pull hlink hvert hginj (fun _ _ => rfl) W' hrun + have hcurve : g ∘ collarCurve h' = collarCurve h := by + funext t + exact (hboth _).symm + rw [hcurve] at hW + refine ⟨_, W, ⟨h, hinjh, fun p hp hx => hoffh p hp (mem_image_of_mem f hx), ?_, hoph, + Or.inr ⟨?_, hW⟩⟩, ?_, ?_⟩ + · rw [subBd_eq_frontier] + ext x + constructor + · rintro ⟨z, rfl⟩ + have hzm : h' (z, 0) ∈ f '' frontier X := hfr ▸ hrng ▸ mem_range_self z + obtain ⟨w, hw, hwe⟩ := hzm + change h (z, 0) ∈ _ + rw [hboth, ← hwe, hgf w (hfA (hfrA hw))] + exact hw + · intro hx + have hxm : f x ∈ range fun z : Circle => h' (z, 0) := hrng ▸ hfr ▸ mem_image_of_mem f hx + obtain ⟨z, hz⟩ := hxm + refine ⟨z, ?_⟩ + change h (z, 0) = x + rw [hboth] + have hz' : h' (z, 0) = f x := hz + rw [hz', hgf x (hfA (hfrA hx))] + · simpa [GraphWalk.length, hedges] using hpos + · simpa [GraphWalk.length, hedges] using hpos + · exact perimeter_edge_count_pull (S := S) (Γ := Γ) (X := X) (A := A) hS hXc hXn hA hf g hfA hgf + hopenf hpre hfr D hDE u' W' hcount hEA hgfe hEA' W hedges +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/PerimeterPull.lean b/LeanPool/GraphMinor/GM11/PerimeterPull.lean new file mode 100644 index 0000000000..b15295ace2 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PerimeterPull.lean @@ -0,0 +1,208 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.SphereRegion +public import LeanPool.GraphMinor.GM11.GlueDiscs +public import LeanPool.GraphMinor.Surface.Jordan +import Mathlib.Analysis.Normed.Module.Ball.Homeomorph + +/-! +# Carrying a collar and a walk from a sphere back to a surface + +An open disc in a surface collapses onto a sphere minus a point. `pull_collar` carries a collar back +from +the sphere to the surface, after shrinking it to miss the point at infinity, and `walk_pull` carries +a walk. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S S' : Type u} [TopologicalSpace S] [TopologicalSpace S'] + +/-- A walk moves along a map of the vertices and the edges. -/ +theorem walk_pull {D : Drawing S'} {Γ : Drawing S} {g : S' → S} {G : Set S' → Set S} + (hl : ∀ e x y, D.toGraph.IsLink e x y → Γ.toGraph.IsLink (G e) (g x) (g y)) + (hV : ∀ v ∈ D.V, g v ∈ Γ.V) (hinj : ∀ e ∈ D.E, InjOn g e) (himg : ∀ e ∈ D.E, g '' e = G e) + {φ : ℝ → S'} {u v : S'} (W : GraphWalk D.toGraph u v) : + ∀ {a b : ℝ}, RunsAlongOn D φ a b W → + ∃ W' : GraphWalk Γ.toGraph (g u) (g v), RunsAlongOn Γ (g ∘ φ) a b W' ∧ + W'.edges = W.edges.map G := by + induction W with + | nil hv => + intro a b h + exact ⟨.nil (hV _ hv), ⟨h.1, congrArg g h.2⟩, rfl⟩ + | @cons x y w e hlink rest ih => + rintro a b ⟨c, hac, hu, hi, him, hrest⟩ + obtain ⟨W', hW', hedges⟩ := ih hrest + have he : e ∈ D.E := hlink.1 + refine ⟨.cons (hl _ _ _ hlink) W', ⟨c, hac, congrArg g hu, ?_, ?_, hW'⟩, ?_⟩ + · rintro s hs t ht hst + exact hi hs ht (hinj e he (him ▸ mem_image_of_mem φ hs) (him ▸ mem_image_of_mem φ ht) hst) + · rw [← himg e he, ← him, image_comp] + · simp [GraphWalk.edges, hedges] + +/-- A small height at which a collar still misses a point. -/ +theorem exists_height (h : C(Circle × I, S')) [T1Space S'] {z₀ : S'} (hz : ∀ z, h (z, 0) ≠ z₀) : + ∃ ε : I, 0 < ε ∧ ∀ z t, t ≤ ε → h (z, t) ≠ z₀ := by + have hK : IsCompact (h ⁻¹' {z₀}) := (isClosed_singleton.preimage h.continuous).isCompact + have hT : IsCompact (Prod.snd '' (h ⁻¹' {z₀})) := hK.image continuous_snd + have h0 : (0 : I) ∉ Prod.snd '' (h ⁻¹' {z₀}) := by + rintro ⟨⟨z, t⟩, hp, rfl⟩ + exact hz z hp + have hnhds : (Prod.snd '' (h ⁻¹' {z₀}))ᶜ ∈ 𝓝 (0 : I) := hT.isClosed.isOpen_compl.mem_nhds h0 + obtain ⟨δ, hδ, hball⟩ := Metric.mem_nhds_iff.mp hnhds + let ε : I := ⟨min (δ / 2) 1, by positivity, min_le_right _ _⟩ + refine ⟨ε, ?_, ?_⟩ + · change (0 : ℝ) < min (δ / 2) 1 + positivity + · intro z t ht hzt + have ht' : t.1 ≤ min (δ / 2) 1 := ht + have hmem : t ∈ Metric.ball (0 : I) δ := by + rw [Metric.mem_ball, Subtype.dist_eq, Icc.coe_zero, Real.dist_eq, sub_zero, + abs_of_nonneg t.2.1] + linarith [min_le_left (δ / 2) (1 : ℝ)] + exact hball hmem ⟨(z, t), hzt, rfl⟩ + +/-- A shorter collar still fills a neighbourhood. -/ +theorem isOpen_shrink [T2Space S'] {Q : Set S'} (h : C(Circle × I, S')) + (hinj : InjOn h {p | 0 < p.2}) (hoff : ∀ p : Circle × I, 0 < p.2 → h p ∉ Q) + (hbot : ∀ z, h (z, 0) ∈ Q) (hop : IsOpen (Q ∪ h '' {p | p.2 < 1})) {ε : I} (hε : 0 < ε) : + IsOpen (Q ∪ h '' {p | p.2 < ε}) := by + have hK : IsClosed (Q ∪ h '' {p | p.2 < 1})ᶜ := hop.isClosed_compl + have hT : IsClosed (h '' {p | ε ≤ p.2}) := + ((isClosed_le continuous_const continuous_snd).isCompact.image h.continuous).isClosed + have heq : (Q ∪ h '' {p | p.2 < ε})ᶜ = (Q ∪ h '' {p | p.2 < 1})ᶜ ∪ h '' {p | ε ≤ p.2} := by + ext y + constructor + · intro hy + by_cases hin : y ∈ Q ∪ h '' {p | p.2 < 1} + · refine Or.inr ?_ + rcases hin with hin | ⟨p, hp, rfl⟩ + · exact (hy (Or.inl hin)).elim + · refine ⟨p, ?_, rfl⟩ + by_contra hlt + exact hy (Or.inr ⟨p, not_le.mp (show ¬ ε ≤ p.2 from hlt), rfl⟩) + · exact Or.inl hin + · rintro (hy | ⟨p, hp, rfl⟩) (hin | ⟨q, hq, hqe⟩) + · exact hy (Or.inl hin) + · exact hy (Or.inr ⟨q, lt_of_lt_of_le hq (unitInterval.le_one ε), hqe⟩) + · exact hoff p (lt_of_lt_of_le hε hp) hin + · have hp0 : 0 < p.2 := lt_of_lt_of_le hε hp + by_cases hq0 : 0 < q.2 + · have := hinj hq0 hp0 hqe + subst this + exact not_le.mpr (show q.2 < ε from hq) hp + · have ht0 : q.2 = 0 := le_antisymm (not_lt.mp hq0) (unitInterval.nonneg _) + have hq' : q = (q.1, 0) := Prod.ext rfl ht0 + exact hoff p hp0 (hqe ▸ hq' ▸ hbot q.1) + rw [← isClosed_compl_iff, heq] + exact hK.union hT + +/-- **Carrying a collar back from the sphere.** The map `f` collapses `S` to `S'`, and it has an +inverse +`g` away from the point `z₀`. A collar of `Q` in `S'` gives a collar of `f⁻¹(Q)` in `S`. -/ +theorem pull_collar [T2Space S'] {f : S → S'} {g : S' → S} {z₀ : S'} + (hfc : Continuous f) + (hgc : ∀ y, y ≠ z₀ → ContinuousAt g y) (hgf : ∀ x, f x ≠ z₀ → g (f x) = x) + (hfg : ∀ y, y ≠ z₀ → f (g y) = y) {Q : Set S'} (hz₀ : z₀ ∉ Q) + (h' : C(Circle × I, S')) (hinj : InjOn h' {p | 0 < p.2}) (hoff : ∀ p : Circle × I, 0 < p.2 + → h' p ∉ Q) + (hbot : ∀ z, h' (z, 0) ∈ Q) (hop : IsOpen (Q ∪ h' '' {p | p.2 < 1})) : + ∃ h : C(Circle × I, S), InjOn h {p | 0 < p.2} ∧ (∀ p : Circle × I, 0 < p.2 → f (h p) ∉ Q) ∧ + (∀ z, h (z, 0) = g (h' (z, 0))) ∧ IsOpen (f ⁻¹' Q ∪ h '' {p | p.2 < 1}) := by + obtain ⟨ε, hε, hsmall⟩ := exists_height h' (z₀ := z₀) fun z h => hz₀ (h ▸ hbot z) + have hmul : ∀ t : I, ε * t ≤ ε := fun t => unitInterval.mul_le_left + have hne : ∀ p : Circle × I, h' (p.1, ε * p.2) ≠ z₀ := fun p => hsmall _ _ (hmul _) + let k : Circle × I → Circle × I := fun p => (p.1, ε * p.2) + have hkc : Continuous k := by fun_prop + let h : C(Circle × I, S) := ⟨fun p => g (h' (k p)), by + refine continuous_iff_continuousAt.mpr fun p => ?_ + have hk : ContinuousAt (fun p => h' (k p)) p := (h'.continuous.comp hkc).continuousAt + exact ContinuousAt.comp (f := fun p => h' (k p)) (hgc _ (hne p)) hk⟩ + have hfh : ∀ p, f (h p) = h' (k p) := fun p => hfg _ (hne p) + have hpos : ∀ {t : I}, 0 < t → 0 < ε * t := fun {t} ht => by + change (0 : ℝ) < ε.1 * t.1 + exact mul_pos hε ht + refine ⟨h, ?_, ?_, ?_, ?_⟩ + · rintro ⟨z, t⟩ ht ⟨z', t'⟩ ht' heq + have h₁ : h' (k (z, t)) = h' (k (z', t')) := by rw [← hfh, ← hfh, heq] + have h₂ := hinj (hpos ht) (hpos ht') h₁ + have h₃ : z = z' := congrArg Prod.fst h₂ + have h₄ : ε * t = ε * t' := congrArg Prod.snd h₂ + have h₅ : ε.1 * t.1 = ε.1 * t'.1 := congrArg Subtype.val h₄ + have h₆ : t.1 = t'.1 := mul_left_cancel₀ (ne_of_gt hε) h₅ + exact Prod.ext h₃ (Subtype.ext h₆) + · intro p hp + rw [hfh] + exact hoff _ (hpos hp) + · intro z + change g (h' (z, ε * 0)) = _ + rw [mul_zero] + · have hshrink := isOpen_shrink h' hinj hoff hbot hop hε + have heq : f ⁻¹' Q ∪ h '' {p | p.2 < 1} = f ⁻¹' (Q ∪ h' '' {p | p.2 < ε}) := by + ext x + constructor + · rintro (hx | ⟨p, hp, rfl⟩) + · exact Or.inl hx + · refine Or.inr ⟨k p, ?_, (hfh p).symm⟩ + have hp' : p.2.1 < 1 := hp + change ε.1 * p.2.1 < ε.1 + have hε' : (0 : ℝ) < ε.1 := hε + nlinarith + · rintro (hx | ⟨p, hp, hpe⟩) + · exact Or.inl hx + · refine Or.inr ?_ + have hp' : p.2.1 < ε.1 := hp + have hε' : (0 : ℝ) < ε.1 := hε + let t : I := ⟨p.2.1 / ε.1, div_nonneg p.2.2.1 hε'.le, (div_le_one hε').mpr hp'.le⟩ + have hk : k (p.1, t) = p := by + refine Prod.ext rfl (Subtype.ext ?_) + change ε.1 * (p.2.1 / ε.1) = p.2.1 + field_simp + refine ⟨(p.1, t), (div_lt_one hε').mpr hp', ?_⟩ + change g (h' (k (p.1, t))) = x + rw [hk, hpe] + refine hgf x fun hxz => ?_ + have hsm : p.2 ≤ ε := le_of_lt hp' + exact hsmall p.1 p.2 hsm (by rw [show (p.1, p.2) = p from rfl, hpe, hxz]) + rw [heq] + exact hshrink.preimage hfc + +/-- A sphere is a connected closed surface. -/ +theorem IsSphere.isClosedSurface (hS : IsSphere S) : IsClosedSurface S ∧ ConnectedSpace S := by + obtain ⟨e⟩ := id hS + have hT2 : T2Space S := e.symm.t2Space + refine ⟨⟨e.symm.compactSpace, hT2, fun x => ?_⟩, e.symm.surjective.connectedSpace + e.symm.continuous⟩ + obtain ⟨w, hw⟩ : ∃ w : OnePoint EuclideanPlane, w ≠ e x := by + by_cases h : e x = OnePoint.infty + · refine ⟨((0 : EuclideanPlane) : OnePoint EuclideanPlane), ?_⟩ + rw [h] + exact OnePoint.coe_ne_infty _ + · exact ⟨_, Ne.symm h⟩ + obtain ⟨h, hh⟩ := exists_homeomorph_onePoint w + let T : S ≃ₜ OnePoint EuclideanPlane := e.trans h + have hTx : T x ≠ OnePoint.infty := fun hx => hw (h.injective (hh.trans hx.symm)) + have hemb : IsOpenEmbedding (fun z : EuclideanPlane => T.symm (z : OnePoint EuclideanPlane)) := + T.symm.isOpenEmbedding.comp OnePoint.isOpenEmbedding_coe + obtain ⟨z, hz⟩ : ∃ z : EuclideanPlane, (z : OnePoint EuclideanPlane) = T x := + OnePoint.ne_infty_iff_exists.mp hTx + refine ⟨range fun z : EuclideanPlane => T.symm (z : OnePoint EuclideanPlane), hemb.isOpen_range, + ⟨z, by simp [hz]⟩, ?_⟩ + have hb : OpenUnitDisc ≃ₜ EuclideanPlane := (Homeomorph.unitBall (E := EuclideanPlane)).symm + exact ⟨(hemb.isEmbedding.toHomeomorph.symm).trans hb.symm⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/PerimeterWalk.lean b/LeanPool/GraphMinor/GM11/PerimeterWalk.lean new file mode 100644 index 0000000000..e50fe8b501 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PerimeterWalk.lean @@ -0,0 +1,294 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PerimeterExists +public import LeanPool.GraphMinor.GM11.Solid +public import LeanPool.GraphMinor.GM11.OpenAround +public import LeanPool.GraphMinor.GM11.Cited +public import LeanPool.GraphMinor.GM11.ForestRegions +public import LeanPool.GraphMinor.Surface.Collar +public import LeanPool.GraphMinor.GM11.PaintingCells + +/-! +# Perimeter walks exist + +Graph Minors XI, Section 8 (page 96): "there is a closed walk of $\Gamma$ tracing out $bd(X)$ in the +natural +sense." `exists_perimeterWalk` proves this for each closed, simply-connected, `Γ`-nice set `X` other +than +the empty set and the whole surface, and it counts how often the walk uses each edge. The main case +is +`exists_perimeter_of_disc`. What remains is the set with no edge on its frontier, which is a single +vertex. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A collar around a point. -/ +theorem exists_point_collar (hS : IsClosedSurface S) (v : S) : + ∃ h : C(Circle × I, S), InjOn h {p | 0 < p.2} ∧ (∀ p : Circle × I, 0 < p.2 → h p ≠ v) ∧ + (∀ z, h (z, 0) = v) ∧ IsOpen ({v} ∪ h '' {p | p.2 < 1}) := by + obtain ⟨V, hV, hvV, ⟨e⟩⟩ := hS.2.2 v + let T : OpenUnitDisc → S := fun y => (e.symm y).1 + have hT : Continuous T := continuous_subtype_val.comp e.symm.continuous + have hTi : Function.Injective T := fun p q hpq => e.symm.injective (Subtype.ext hpq) + have hTo : IsOpenMap T := hV.isOpenEmbedding_subtypeVal.isOpenMap.comp e.symm.isOpenMap + let c : OpenUnitDisc := e ⟨v, hvV⟩ + have hTc : T c = v := by simp [T, c] + have hc1 : ‖c.1‖ < 1 := by simpa [OpenUnitDisc] using c.2 + let ρ : ℝ := (1 - ‖c.1‖) / 2 + have hρ : 0 < ρ := by + simp only [ρ] + linarith + have hcz : ∀ z : Circle, ‖complexPlane (z : ℂ)‖ = 1 := fun z => by simp + let pt : Circle × I → EuclideanPlane := fun p => c.1 + (ρ * p.2.1) • complexPlane (p.1 : ℂ) + have hpt : Continuous pt := by + have h₁ : Continuous fun p : Circle × I => complexPlane (p.1 : ℂ) := + complexPlane.continuous.comp (continuous_induced_dom.comp continuous_fst) + have h₂ : Continuous fun p : Circle × I => ρ * p.2.1 := + continuous_const.mul (continuous_subtype_val.comp continuous_snd) + exact continuous_const.add (h₂.smul h₁) + have hnorm : ∀ p : Circle × I, ‖(ρ * p.2.1) • complexPlane (p.1 : ℂ)‖ = ρ * p.2.1 := fun p => by + rw [norm_smul, hcz, mul_one, Real.norm_of_nonneg (mul_nonneg hρ.le p.2.2.1)] + have hmem : ∀ p, pt p ∈ OpenUnitDisc := by + intro p + have h₁ := norm_add_le c.1 ((ρ * p.2.1) • complexPlane (p.1 : ℂ)) + rw [hnorm] at h₁ + have h₂ : ρ * p.2.1 ≤ ρ := by nlinarith [p.2.2.2] + have h₃ : ‖pt p‖ < 1 := by + simp only [ρ] at h₂ h₁ + simp only [pt, ρ] + linarith + simpa [OpenUnitDisc] using h₃ + let pt' : Circle × I → OpenUnitDisc := fun p => ⟨pt p, hmem p⟩ + have hpt' : Continuous pt' := Continuous.subtype_mk hpt _ + let h : C(Circle × I, S) := ⟨fun p => T (pt' p), hT.comp hpt'⟩ + have hbot : ∀ z, h (z, 0) = v := by + intro z + have : pt' (z, 0) = c := Subtype.ext (by simp [pt', pt]) + change T (pt' (z, 0)) = v + rw [this, hTc] + have heq : ∀ p q, h p = h q → (ρ * p.2.1) • complexPlane (p.1 : ℂ) = (ρ * q.2.1) • complexPlane + (q.1 : ℂ) := by + intro p q hpq + have h₁ : pt' p = pt' q := hTi hpq + have h₂ : pt p = pt q := congrArg Subtype.val h₁ + exact add_left_cancel h₂ + refine ⟨h, ?_, ?_, hbot, ?_⟩ + · rintro ⟨z, t⟩ ht ⟨z', t'⟩ ht' hpq + have htp : (0 : ℝ) < t.1 := ht + have h₁ := heq _ _ hpq + have h₂ := congrArg norm h₁ + rw [hnorm, hnorm] at h₂ + have h₃ : t.1 = t'.1 := mul_left_cancel₀ hρ.ne' h₂ + have ht₃ : t = t' := Subtype.ext h₃ + subst ht₃ + have h₄ := smul_right_injective _ (mul_pos hρ htp).ne' h₁ + have h₅ : (z : ℂ) = z' := complexPlane.injective h₄ + exact Prod.ext (Circle.ext h₅) rfl + · intro p hp hpv + have htp : (0 : ℝ) < p.2.1 := hp + have h₁ : h p = h (p.1, 0) := hpv.trans (hbot _).symm + have h₂ := congrArg norm (heq _ _ h₁) + rw [hnorm, hnorm] at h₂ + simp only [Icc.coe_zero, mul_zero] at h₂ + exact (mul_pos hρ htp).ne' h₂ + · have hop : IsOpen {y : OpenUnitDisc | dist y.1 c.1 < ρ} := + isOpen_lt (continuous_subtype_val.dist continuous_const) continuous_const + have hsets : ({v} ∪ h '' {p | p.2 < 1} : Set S) = T '' {y : OpenUnitDisc | dist y.1 c.1 < ρ} + := by + ext x + constructor + · rintro (hx | ⟨p, hp, rfl⟩) + · exact ⟨c, by simpa using hρ, by rw [hTc, mem_singleton_iff.mp hx]⟩ + · refine ⟨pt' p, ?_, rfl⟩ + have hp' : p.2.1 < 1 := hp + change dist (pt p) c.1 < ρ + rw [dist_eq_norm] + simp only [pt, add_sub_cancel_left] + rw [hnorm] + nlinarith + · rintro ⟨y, hy, rfl⟩ + by_cases hyc : y = c + · exact Or.inl (by rw [hyc, hTc]; rfl) + have hy' : ‖y.1 - c.1‖ < ρ := by + rw [← dist_eq_norm] + exact hy + let w : ℂ := complexPlane.symm (y.1 - c.1) + have hw : ‖w‖ = ‖y.1 - c.1‖ := complexPlane.symm.norm_map _ + have hwpos : 0 < ‖w‖ := by + rw [hw, norm_pos_iff, sub_ne_zero] + exact fun h₀ => hyc (Subtype.ext h₀) + let t : I := ⟨‖w‖ / ρ, by positivity, (div_le_one hρ).mpr (by rw [hw]; exact hy'.le)⟩ + have ht1 : t.1 * ρ = ‖w‖ := by + change ‖w‖ / ρ * ρ = ‖w‖ + field_simp + have hz : (Circle.exp (Complex.arg w) : ℂ) * ‖w‖ = w := by + rw [Circle.coe_exp, mul_comm] + exact Complex.norm_mul_exp_arg_mul_I w + refine Or.inr ⟨(Circle.exp (Complex.arg w), t), ?_, ?_⟩ + · change ‖w‖ / ρ < 1 + rw [div_lt_one hρ, hw] + exact hy' + · change T (pt' _) = T y + congr 1 + apply Subtype.ext + change c.1 + (ρ * t.1) • complexPlane (Circle.exp (Complex.arg w) : ℂ) = y.1 + have hsm : (ρ * t.1) • complexPlane (Circle.exp (Complex.arg w) : ℂ) = y.1 - c.1 := by + rw [← map_smul] + have : (ρ * t.1) • (Circle.exp (Complex.arg w) : ℂ) = w := by + rw [Complex.real_smul, mul_comm ρ, ht1, mul_comm] + exact_mod_cast hz + rw [this] + exact complexPlane.apply_symm_apply _ + rw [hsm] + abel + rw [hsets] + exact hTo _ hop + +variable [T2Space S] [ConnectedSpace S] + +/-- A closed nice simply-connected set other than the surface lies in an open disc. This is the case +`Y = ∅` of +Graph Minors XI, (7.5), which the paper derives from Graph Minors VII, (11.10). We take the proof of +(11.10) from +`exists_open_around`, and the sphere is done by hand. -/ +theorem exists_openDisc_around (hS : IsClosedSurface S) + {Γ : Drawing S} {X : Set S} (hXc : IsClosed X) (hXn : IsGammaNice Γ X) + (hXs : IsSimplyConnectedSet X) (hu : X ≠ univ) : ∃ A, IsOpenDisc A ∧ X ⊆ A := by + have hflat : Flat (Subtype.val ⁻¹' X : Set (univ : Set S)) := + flat_of_simplyConnected hXs (subset_univ X) + obtain ⟨Y, hXY, -, h | h⟩ := exists_open_around hS isOpen_univ (subset_univ X) hXc + (isSolid_of_nice hS hXc hXn).1 hXs.1 hflat + · -- In a sphere, take an `O`-arc off `X`. Then `X` lies on one side of it. + obtain ⟨z, hz⟩ := (ne_univ_iff_exists_notMem X).mp hu + obtain ⟨D, D', hD, -, -, -, hDX, -⟩ := exists_closedDisc_nbhd hS hXc.isOpen_compl hz + obtain ⟨F, hF⟩ : ∃ F, F = discBd D := ⟨_, rfl⟩ + have hFO : IsOArc F := hF ▸ IsClosedDisc.isOArc_discBd hD + have hFX : Disjoint X F := disjoint_left.mpr fun x hx hxF => + hDX (discBd_subset D (hF ▸ hxF)) hx + obtain ⟨Δ₁, Δ₂, -, hΔ₁, hΔ₂, hb₁, hb₂, hcup, hcap, -, -⟩ := sphere_disc S h.1 F hFO + have hint₁ : IsOpen (Δ₁ \ discBd Δ₁) := (isOpenDisc_interior hS hΔ₁).1 + have hint₂ : IsOpen (Δ₂ \ discBd Δ₂) := (isOpenDisc_interior hS hΔ₂).1 + have hdis : Disjoint (Δ₁ \ discBd Δ₁) (Δ₂ \ discBd Δ₂) := disjoint_left.mpr fun x h₁ h₂ => + h₁.2 (by rw [hb₁, ← hcap]; exact ⟨h₁.1, h₂.1⟩) + have hcover : X ⊆ (Δ₁ \ discBd Δ₁) ∪ (Δ₂ \ discBd Δ₂) := fun x hx => by + have hxF : x ∉ F := disjoint_left.mp hFX hx + have hxu : x ∈ Δ₁ ∪ Δ₂ := hcup ▸ mem_univ x + rcases hxu with h' | h' + · exact Or.inl ⟨h', by rwa [hb₁]⟩ + · exact Or.inr ⟨h', by rwa [hb₂]⟩ + rcases hXs.1.isConnected.isPreconnected.subset_or_subset hint₁ hint₂ hdis hcover with h' | h' + · exact ⟨_, isOpenDisc_interior hS hΔ₁, h'⟩ + · exact ⟨_, isOpenDisc_interior hS hΔ₂, h'⟩ + · exact ⟨Y, h, hXY⟩ + +open Classical in +/-- **Existence of perimeter walks** (Graph Minors XI, Section 8, page 96). The walk uses an edge on +the +frontier of `X` once for each side outside `X`, and it uses no other edge. -/ +theorem exists_perimeterWalk (hS : IsClosedSurface S) + {Γ : Drawing S} {X : Set S} (hXc : IsClosed X) + (hXn : IsGammaNice Γ X) (hXs : IsSimplyConnectedSet X) (hne : X.Nonempty) (hu : X ≠ univ) : + ∃ (u : S) (W : GraphWalk Γ.toGraph u u), IsPerimeterWalk Γ X W ∧ + ∀ e ∈ Γ.E, edgeCount W.edges e = + if (e ∩ frontier X).Nonempty then (if IsTwoSided Xᶜ e then 2 else 1) else 0 := by + obtain ⟨A, hA, hXA⟩ := exists_openDisc_around hS hXc hXn hXs hu + by_cases hE : (Γ.interSet (frontier X)).E.Nonempty + · obtain ⟨u, W, hW, -, hc⟩ := exists_perimeter_of_disc hS hXc hXn hXs hne hA hXA hE + exact ⟨u, W, hW, hc⟩ + have hK : CompactSpace S := hS.1 + set B := Γ.interSet (frontier X) with hBdef + have hBs : B.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hBU : B.U = frontier X := frontier_interSet hS hXc hXn + have hEe : B.E = ∅ := not_nonempty_iff_eq_empty.mp hE + have hBV : frontier X = B.V := by + rw [← hBU, B.U_eq, hEe] + simp + have hno : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing B → False := fun C hC hsub => by + obtain ⟨e, he⟩ := IsCircuit.E_nonempty hC + exact (hEe ▸ hsub.2 he : e ∈ (∅ : Set (Set S))) + have hconn := isPreconnected_compl_of_noCircuit hS B hno + -- The complement of the frontier lies outside `X`, for otherwise `X` is everything. + have hdis : Disjoint (interior X) Xᶜ := disjoint_left.mpr fun x hx h => h (interior_subset hx) + have hcov : B.Uᶜ ⊆ interior X ∪ Xᶜ := by + intro x hx + by_cases hxX : x ∈ X + · refine Or.inl ?_ + by_contra hint + exact hx (hBU ▸ (⟨subset_closure hxX, hint⟩ : x ∈ frontier X)) + · exact Or.inr hxX + have hXsub : X ⊆ B.U := by + rcases hconn.subset_or_subset isOpen_interior hXc.isOpen_compl hdis hcov with h | h + · exfalso + apply hu + refine eq_univ_of_forall fun x => hXc.closure_subset_iff.mpr ?_ (?_ : x ∈ closure B.Uᶜ) + · exact h.trans interior_subset + · refine mem_closure_iff.mpr fun O hO hxO => ?_ + obtain ⟨z, hzO, hzU⟩ := exists_notMem_U (Γ := B) hS hO ⟨x, hxO⟩ + exact ⟨z, hzO, hzU⟩ + · intro x hx + by_contra hxU + exact h hxU hx + have hXfin : X.Finite := (B.finite_V).subset (by rwa [hBU, hBV] at hXsub) + obtain ⟨v, hv⟩ := hne + have hXv : X = {v} := by + refine eq_singleton_iff_unique_mem.mpr ⟨hv, fun a ha => ?_⟩ + by_contra hav + have hp := hXs.1.isConnected.isPreconnected + have hcl : IsClosed (X \ {v}) := (hXfin.subset sdiff_subset).isClosed + rcases isPreconnected_iff_subset_of_disjoint.mp hp (X \ {v})ᶜ {v}ᶜ hcl.isOpen_compl + isOpen_compl_singleton (fun x hx => by + by_cases hxv : x = v + · exact Or.inl fun h => h.2 hxv + · exact Or.inr hxv) (by + ext x + simp only [mem_inter_iff, mem_compl_iff, mem_sdiff, mem_singleton_iff, mem_empty_iff_false, + iff_false] + tauto) with h | h + · exact h ha ⟨ha, hav⟩ + · exact h hv rfl + subst hXv + have hfr : frontier ({v} : Set S) = {v} := by + refine subset_antisymm hXc.frontier_subset ?_ + obtain ⟨y, hy⟩ : (frontier ({v} : Set S)).Nonempty := + nonempty_frontier_iff.mpr ⟨⟨v, rfl⟩, fun h => hu h⟩ + have : y = v := hXc.frontier_subset hy + subst this + exact singleton_subset_iff.mpr hy + have hvf : v ∈ frontier ({v} : Set S) := by + rw [hfr] + rfl + have hvV : v ∈ Γ.V := hBs.1 (hBV ▸ hvf) + obtain ⟨h, h₁, h₂, h₃, h₄⟩ := exists_point_collar hS v + refine ⟨v, .nil hvV, ⟨h, h₁, fun p hp hx => h₂ p hp hx, ?_, h₄, Or.inl ⟨rfl, h₃⟩⟩, fun e he => ?_⟩ + · rw [subBd_eq_frontier, hfr] + ext x + constructor + · rintro ⟨z, rfl⟩ + exact h₃ z + · rintro rfl + exact ⟨1, h₃ 1⟩ + · have hemp : ¬ (e ∩ frontier ({v} : Set S)).Nonempty := by + rintro ⟨y, hye, hyf⟩ + have : y = v := by rwa [hfr] at hyf + exact (he.2.1 hye).2 (this ▸ hvV) + simp only [hemp, ite_false] + rfl + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/PlaneFacts.lean b/LeanPool/GraphMinor/GM11/PlaneFacts.lean new file mode 100644 index 0000000000..61418b2c94 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PlaneFacts.lean @@ -0,0 +1,161 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.Crossing +import LeanPool.GraphMinor.Surface.Jordan +import LeanPool.GraphMinor.Surface.PlaneSeparation + +/-! +# Two facts on the plane, and closed surfaces are surfaces + +Graph Minors XI says that a drawing without circuits in a connected surface has only one region. +Our proof of that fact, in `GraphMinor/GM11/ForestRegions.lean`, uses two classical facts on the +plane: an arc does not separate the plane, and Janiszewski's theorem. Both are proved over `ℂ` in +`GraphMinor/Surface/PlaneSeparation.lean` and `GraphMinor/Surface/Crossing.lean`. This file carries +them over the isometry `complexPlane` to `EuclideanPlane`, as `isPreconnected_compl_of_isLine` and +`janiszewski_plane`. + +It also proves `IsClosedSurface.isSurface`: a compact 2-manifold without boundary is a compact +2-manifold with (possibly null) boundary. An open disc embeds as an open subset of the half plane by +a translation. +-/ + +public section + +namespace GraphMinor.Surface + +open Set Topology + +universe u + +/-- The homeomorphism between `ℂ` and the plane. -/ +private noncomputable def complexPlaneHomeo : ℂ ≃ₜ EuclideanPlane := complexPlane.toHomeomorph + +/-- A homeomorphism carries the components of a complement to the components of the complement of +the image. -/ +private theorem image_component (A : Set ℂ) {a : ℂ} (ha : a ∈ Aᶜ) : + complexPlaneHomeo '' connectedComponentIn Aᶜ a = + connectedComponentIn (complexPlaneHomeo '' A)ᶜ (complexPlaneHomeo a) := by + rw [complexPlaneHomeo.image_connectedComponentIn ha, image_compl_eq complexPlaneHomeo.bijective] + +/-- The set of `ℂ` that corresponds to a set of the plane. -/ +private theorem image_symm (A : Set EuclideanPlane) : + complexPlaneHomeo '' (complexPlaneHomeo.symm '' A) = A := by + rw [← image_comp] + simp + +/-- An arc does not separate the plane. Follows from `component_eq_of_arc`. -/ +theorem isPreconnected_compl_of_isLine {L : Set EuclideanPlane} (hL : IsLine L) : + IsPreconnected Lᶜ := by + obtain ⟨φ⟩ := hL + set L' : Set ℂ := complexPlaneHomeo.symm '' L with hL' + have φ' : unitInterval ≃ₜ L' := φ.trans (complexPlaneHomeo.symm.image L) + have hcomp : ∀ a b : EuclideanPlane, a ∈ Lᶜ → b ∈ Lᶜ → b ∈ connectedComponentIn Lᶜ a := by + intro a b ha hb + have ha' : complexPlaneHomeo.symm a ∉ L' := by + rintro ⟨x, hx, h⟩ + rw [complexPlaneHomeo.symm.injective h] at hx + exact ha hx + have hb' : complexPlaneHomeo.symm b ∉ L' := by + rintro ⟨x, hx, h⟩ + rw [complexPlaneHomeo.symm.injective h] at hx + exact hb hx + have heq := component_eq_of_arc φ' ha' hb' + have hmem : complexPlaneHomeo.symm b ∈ connectedComponentIn L'ᶜ (complexPlaneHomeo.symm a) := by + rw [heq] + exact mem_connectedComponentIn hb' + have himg := mem_image_of_mem complexPlaneHomeo hmem + rw [image_component _ ha', hL', image_symm] at himg + simpa using himg + refine isPreconnected_of_forall_pair fun a ha b hb => ?_ + exact ⟨connectedComponentIn Lᶜ a, connectedComponentIn_subset _ _, + mem_connectedComponentIn ha, hcomp a b ha hb, isPreconnected_connectedComponentIn⟩ + +/-- **Janiszewski's theorem**, in the plane. If `A ∩ B` is preconnected, and neither of the compact +sets `A`, `B` separates `x` from `y`, then `A ∪ B` does not separate them. Follows from +`janiszewski`. -/ +theorem janiszewski_plane {A B : Set EuclideanPlane} (hA : IsCompact A) (hB : IsCompact B) + (hAB : IsPreconnected (A ∩ B)) {x y : EuclideanPlane} (hx : x ∉ A ∪ B) (hy : y ∉ A ∪ B) + (h₁ : y ∈ connectedComponentIn Aᶜ x) (h₂ : y ∈ connectedComponentIn Bᶜ x) : + y ∈ connectedComponentIn (A ∪ B)ᶜ x := by + let f := complexPlaneHomeo.symm + have hn : ∀ {C : Set EuclideanPlane} {z : EuclideanPlane}, z ∉ C → f z ∉ f '' C := by + rintro C z hz ⟨w, hw, h⟩ + rw [f.injective h] at hw + exact hz hw + have comp : ∀ {C : Set EuclideanPlane}, y ∈ connectedComponentIn Cᶜ x → x ∉ C → + f y ∈ connectedComponentIn (f '' C)ᶜ (f x) := by + intro C h hxC + have hm := mem_image_of_mem f h + rw [f.image_connectedComponentIn hxC, image_compl_eq f.bijective] at hm + exact hm + have hxA : x ∉ A := fun h => hx (Or.inl h) + have hxB : x ∉ B := fun h => hx (Or.inr h) + have hmem := janiszewski (K₁ := f '' A) (K₂ := f '' B) (hA.image f.continuous) + (hB.image f.continuous) + (by rw [← image_inter f.injective]; exact hAB.image _ f.continuous.continuousOn) + (by rw [← image_union]; exact hn hx) (by rw [← image_union]; exact hn hy) + (comp h₁ hxA) (comp h₂ hxB) + rw [← image_union] at hmem + have him := mem_image_of_mem complexPlaneHomeo hmem + have hmemc : f x ∈ (f '' (A ∪ B))ᶜ := hn hx + rw [image_component _ hmemc] at him + have himg : complexPlaneHomeo '' (f '' (A ∪ B)) = A ∪ B := image_symm _ + rw [himg] at him + simpa [f] using him + +/-- A point of the plane with positive first coordinate. -/ +private noncomputable def shift : EuclideanPlane := EuclideanSpace.single 0 2 + +/-- The translation of the open unit disc into the half plane. -/ +private noncomputable def discToHalf (x : OpenUnitDisc) : EuclideanHalfSpace 2 := + ⟨x.1 + shift, by + have h1 : ‖x.1‖ < 1 := mem_ball_zero_iff.mp x.2 + have h2 : |x.1 0| ≤ ‖x.1‖ := by + simpa using PiLp.norm_apply_le x.1 0 + have h3 := (abs_lt.mp (lt_of_le_of_lt h2 h1)).1 + simp only [PiLp.add_apply, shift, PiLp.single_apply, ite_true] + linarith⟩ + +private theorem isEmbedding_discToHalf : IsEmbedding discToHalf := by + have h : IsEmbedding (Subtype.val ∘ discToHalf) := by + have : (Subtype.val ∘ discToHalf) = (Homeomorph.addRight shift) ∘ Subtype.val := rfl + rw [this] + exact (Homeomorph.addRight shift).isEmbedding.comp IsEmbedding.subtypeVal + exact IsEmbedding.of_comp (by unfold discToHalf; fun_prop) continuous_subtype_val h + +private theorem isOpen_range_discToHalf : IsOpen (range discToHalf) := by + have : range discToHalf = Subtype.val ⁻¹' ((fun y => y - shift) ⁻¹' Metric.ball 0 1) := by + ext y + constructor + · rintro ⟨x, rfl⟩ + have hx : ‖x.1‖ < 1 := mem_ball_zero_iff.mp x.2 + simpa [discToHalf] using hx + · intro hy + exact ⟨⟨y.1 - shift, hy⟩, Subtype.ext (sub_add_cancel _ _)⟩ + rw [this] + exact (Metric.isOpen_ball.preimage (by fun_prop)).preimage continuous_subtype_val + +/-- An interior point is a manifold point: an open disc embeds as an open subset of the half +plane. -/ +theorem IsInteriorPoint.isManifoldPoint {S : Type u} [TopologicalSpace S] {x : S} + (h : IsInteriorPoint x) : IsManifoldPoint x := by + obtain ⟨U, hU, hx, ⟨e⟩⟩ := h + exact ⟨U, range discToHalf, hU, isOpen_range_discToHalf, hx, + ⟨e.trans isEmbedding_discToHalf.toHomeomorph⟩⟩ + +/-- A compact 2-manifold without boundary (the surfaces of Graph Minors XI) is a compact 2-manifold +with possibly null boundary (the surfaces of Graph Minors VII). -/ +theorem IsClosedSurface.isSurface {S : Type u} [TopologicalSpace S] (h : IsClosedSurface S) : + IsSurface S := + ⟨h.1, h.2.1, fun x => (h.2.2 x).isManifoldPoint⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/GM11/PolarChart.lean b/LeanPool/GraphMinor/GM11/PolarChart.lean new file mode 100644 index 0000000000..63da098e22 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/PolarChart.lean @@ -0,0 +1,468 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialCap +public import LeanPool.GraphMinor.GM11.Cylinder + +/-! +# Polar charts + +Near a point of a surface, a drawing looks like a finite set of rays from one centre. This file +makes +that precise. A *fan* at `v` (`IsFan`) is a cyclic list of closed discs around `v`, in which two +consecutive discs share a line from `v`. Then `exists_polar_of_fan` gives an embedding `Φ` of the +closed +unit disc with `Φ 0 = v`, in which every ray from the centre stays in one sector or on one line. + +The sets that this is used for are closed unions of atoms of a drawing. Such a set is a cone in the +chart, +and so it is simply-connected near each of its points. These local facts are what (3.1) and (7.3) of +Graph +Minors XI need for nice sets. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## The closed disc as a cone over the circle -/ + +instance : CompactSpace ClosedUnitDisc := + isCompact_iff_compactSpace.mp (isCompact_closedBall 0 1) + +/-- The plane as the complex numbers. -/ +noncomputable def planeOf : ℂ ≃ₗᵢ[ℝ] EuclideanPlane := Complex.orthonormalBasisOneI.repr + +/-- The centre of the closed unit disc. -/ +noncomputable def polarCentre : ClosedUnitDisc := ⟨0, by simp [ClosedUnitDisc]⟩ + +/-- The point of the closed disc at distance `1 - t` from the centre, in direction `z`. -/ +noncomputable def coneMap (p : Circle × I) : ClosedUnitDisc := + ⟨(1 - p.2.1 : ℝ) • planeOf (p.1 : ℂ), by + have h₀ := p.2.2.1 + have h₁ := p.2.2.2 + simp only [ClosedUnitDisc, Metric.mem_closedBall, dist_zero_right, norm_smul, + LinearIsometryEquiv.norm_map, Circle.norm_coe, mul_one, Real.norm_eq_abs] + rw [abs_of_nonneg (by linarith)] + linarith⟩ + +/-- Multiply a point of the closed disc by `c ∈ [0, 1]`. -/ +noncomputable def discScale (c : I) (x : ClosedUnitDisc) : ClosedUnitDisc := + ⟨(c.1 : ℝ) • x.1, by + have h₀ := c.2.1 + have h₁ := c.2.2 + have hx : ‖x.1‖ ≤ 1 := mem_closedBall_zero_iff.mp x.2 + simp only [ClosedUnitDisc, Metric.mem_closedBall, dist_zero_right, norm_smul, Real.norm_eq_abs] + rw [abs_of_nonneg h₀] + nlinarith [norm_nonneg x.1]⟩ + +theorem continuous_coneMap : Continuous coneMap := by + refine Continuous.subtype_mk ?_ _ + have : Continuous fun z : Circle => planeOf (z : ℂ) := + planeOf.continuous.comp continuous_subtype_val + fun_prop + +theorem continuous_discScale : Continuous fun p : I × ClosedUnitDisc => discScale p.1 p.2 := by + refine Continuous.subtype_mk ?_ _ + fun_prop + +theorem discScale_coneMap (c : I) (hc : 0 < c) (p : Circle × I) (hp : p.2 < 1) : + ∃ t : I, t < 1 ∧ discScale c (coneMap p) = coneMap (p.1, t) := by + have h₀ := p.2.2.1 + have h₁ := p.2.2.2 + have hc₀ := c.2.1 + have hc₁ := c.2.2 + have hlt : p.2.1 < 1 := hp + have hcp : 0 < c.1 := hc + have hmem : (1 - c.1 * (1 - p.2.1) : ℝ) ∈ I := ⟨by nlinarith, by nlinarith⟩ + refine ⟨⟨_, hmem⟩, ?_, Subtype.ext ?_⟩ + · have : (1 - c.1 * (1 - p.2.1) : ℝ) < 1 := by nlinarith + exact this + · simp only [discScale, coneMap, smul_smul] + congr 1 + ring + +theorem discScale_zero (x : ClosedUnitDisc) : discScale 0 x = polarCentre := + Subtype.ext (by simp [discScale, polarCentre]) + +theorem discScale_one (x : ClosedUnitDisc) : discScale 1 x = x := + Subtype.ext (by simp [discScale]) + +theorem coneMap_top (z : Circle) : coneMap (z, 1) = polarCentre := + Subtype.ext (by simp [coneMap, polarCentre]) + +theorem coneMap_surjective : Function.Surjective coneMap := by + rintro ⟨x, hx⟩ + have hn : ‖x‖ ≤ 1 := mem_closedBall_zero_iff.mp hx + by_cases h0 : x = 0 + · subst h0 + exact ⟨(1, 1), Subtype.ext (by simp [coneMap])⟩ + have hpos : 0 < ‖x‖ := norm_pos_iff.mpr h0 + let w : ℂ := planeOf.symm x + have hw : ‖w‖ = ‖x‖ := planeOf.symm.norm_map x + have hne : w ≠ 0 := norm_pos_iff.mp (hw ▸ hpos) + let z : Circle := ⟨(‖w‖ : ℂ)⁻¹ * w, mem_sphere_zero_iff_norm.2 (by + rw [norm_mul, norm_inv, Complex.norm_real, norm_norm] + exact inv_mul_cancel₀ (norm_ne_zero_iff.mpr hne))⟩ + have hlt : (1 - ‖x‖ : ℝ) ∈ I := ⟨by linarith, by linarith⟩ + refine ⟨(z, ⟨1 - ‖x‖, hlt⟩), Subtype.ext ?_⟩ + have hzc : (z : ℂ) = (‖x‖ : ℂ)⁻¹ * w := by + rw [← hw] + have hsmul : (z : ℂ) = (‖x‖⁻¹ : ℝ) • w := by + rw [hzc, Complex.real_smul] + push_cast + ring + simp only [coneMap, sub_sub_cancel] + rw [hsmul, map_smul, smul_smul, mul_inv_cancel₀ hpos.ne', one_smul] + exact planeOf.apply_symm_apply x + +private theorem coneMap_norm (p : Circle × I) : ‖(coneMap p).1‖ = 1 - p.2.1 := by + have h₁ := p.2.2.2 + simp only [coneMap, norm_smul, LinearIsometryEquiv.norm_map, Circle.norm_coe, mul_one, + Real.norm_eq_abs] + exact abs_of_nonneg (by linarith) + +private theorem coneMap_eq {p q : Circle × I} (h : coneMap p = coneMap q) (hp : p.2 < 1) : p = q + := by + have hn := congrArg (fun x : ClosedUnitDisc => ‖x.1‖) h + simp only [coneMap_norm] at hn + have ht : p.2 = q.2 := Subtype.ext (by linarith) + have hv := congrArg Subtype.val h + simp only [coneMap] at hv + rw [← ht] at hv + have hne : (1 - p.2.1 : ℝ) ≠ 0 := by + have : p.2.1 < 1 := hp + linarith + have := smul_right_injective _ hne hv + refine Prod.ext ?_ ht + exact Circle.coe_injective (planeOf.injective this) + +private theorem isQuotientMap_coneMap : IsQuotientMap coneMap := + continuous_coneMap.isClosedMap.isQuotientMap continuous_coneMap coneMap_surjective + +/-- A cylinder that is pinched at its top, and is injective elsewhere, is a closed disc. -/ +theorem exists_disc_of_cone {h : C(Circle × I, S)} {v : S} (htop : ∀ z, h (z, 1) = v) + (hinj : InjOn h {p | p.2 < 1}) (hne : ∀ p : Circle × I, p.2 < 1 → h p ≠ v) : + ∃ Φ : C(ClosedUnitDisc, S), Function.Injective Φ ∧ ∀ p, Φ (coneMap p) = h p := by + have htop' : ∀ p : Circle × I, ¬ p.2 < 1 → h p = v := fun p hp => by + have : p.2 = 1 := le_antisymm (unitInterval.le_one _) (not_lt.mp hp) + rw [show p = (p.1, 1) from Prod.ext rfl this, htop] + have hft : Function.FactorsThrough h coneMap := by + intro p q hpq + by_cases hp : p.2 < 1 + · rw [coneMap_eq hpq hp] + · by_cases hq : q.2 < 1 + · rw [coneMap_eq hpq.symm hq] + · rw [htop' p hp, htop' q hq] + let cm : C(Circle × I, ClosedUnitDisc) := ⟨coneMap, continuous_coneMap⟩ + have hcm : IsQuotientMap cm := isQuotientMap_coneMap + let Φ : C(ClosedUnitDisc, S) := hcm.lift h hft + have hΦ : ∀ p, Φ (coneMap p) = h p := fun p => + congrArg (fun f : C(Circle × I, S) => f p) (hcm.lift_comp h hft) + refine ⟨Φ, ?_, hΦ⟩ + intro x y hxy + obtain ⟨p, rfl⟩ := coneMap_surjective x + obtain ⟨q, rfl⟩ := coneMap_surjective y + rw [hΦ, hΦ] at hxy + by_cases hp : p.2 < 1 + · by_cases hq : q.2 < 1 + · rw [hinj hp hq hxy] + · exact (hne p hp (hxy.trans (htop' q hq))).elim + · by_cases hq : q.2 < 1 + · exact (hne q hq (hxy.symm.trans (htop' p hp))).elim + · have e₁ : p.2 = 1 := le_antisymm (unitInterval.le_one _) (not_lt.mp hp) + have e₂ : q.2 = 1 := le_antisymm (unitInterval.le_one _) (not_lt.mp hq) + rw [show p = (p.1, 1) from Prod.ext rfl e₁, show q = (q.1, 1) from Prod.ext rfl e₂, + coneMap_top, coneMap_top] + +/-! ## Fans -/ + +/-- A *fan* at `v`. The index set `H` is cyclically ordered by `next`. Each `s k` is a line from +`v`, and +`Q k` is a closed disc that has the first part of `s k` and of `s (next k)` in its boundary. Near +`v`, the +points of `Q k` off its boundary lie in `B k`. -/ +structure IsFan {H : Type*} (next : H → H) (v : S) (s : H → I → S) (Q B : H → Set S) (W : Set S) + (τ : H → I) : Prop where + inj : Function.Injective next + reach : ∀ a b, Relation.ReflTransGen (fun x y => y = next x) a b + next_ne : ∀ k, next k ≠ k + cont : ∀ k, Continuous (s k) + sInj : ∀ k, Function.Injective (s k) + zero : ∀ k, s k 0 = v + meet : ∀ i j, i ≠ j → ∀ t t' : I, t < 1 → t' < 1 → s i t = s j t' → t = 0 + disc : ∀ k, IsClosedDisc (Q k) + bd : ∀ k, v ∈ discBd (Q k) + isOpen : IsOpen W + mem : v ∈ W + pos : ∀ k, 0 < τ k + left : ∀ k t, t ≤ τ k → s k t ∈ discBd (Q k) + right : ∀ k t, t ≤ τ (next k) → s (next k) t ∈ discBd (Q k) + inside : ∀ k, (W ∩ Q k) \ discBd (Q k) ⊆ B k + disj : ∀ k j, k ≠ j → Disjoint (B k) (Q j) + off : ∀ k i (t : I), t < 1 → s i t ∉ B k + +private theorem exists_small {f : I → S} (hf : Continuous f) {O : Set S} (hO : IsOpen O) + (h0 : f 0 ∈ O) {τ : I} (hτ : 0 < τ) : ∃ t : I, 0 < t ∧ t < 1 ∧ t ≤ τ ∧ ∀ u, u ≤ t → f u ∈ O + := by + obtain ⟨ε, hε, hb⟩ := Metric.isOpen_iff.mp (hO.preimage hf) 0 h0 + have hτ' : 0 < τ.1 := hτ + let r : ℝ := min (ε / 2) (min τ.1 (1 / 2)) + have hr : 0 < r := by positivity + have hr₁ : r ≤ τ.1 := (min_le_right _ _).trans (min_le_left _ _) + have hr₂ : r ≤ 1 / 2 := (min_le_right _ _).trans (min_le_right _ _) + have hr₃ : r ≤ ε / 2 := min_le_left _ _ + refine ⟨⟨r, hr.le, by linarith⟩, hr, ?_, hr₁, fun u hu => ?_⟩ + · change r < 1 + linarith + · have hu' : u.1 ≤ r := hu + refine hb ?_ + rw [Metric.mem_ball, Subtype.dist_eq] + have hu0 := u.2.1 + simp only [Set.Icc.coe_zero, Real.dist_eq, sub_zero] + rw [abs_of_nonneg hu0] + linarith + +omit [TopologicalSpace S] in +private theorem adjacent_spokes_inter {H : Type*} {next : H → H} {v : S} + {sp : H → I → S} (hsp1 : ∀ k, sp k 1 = v) (hnext : ∀ k, next k ≠ k) + (hspeq : ∀ a b r r', r < 1 → r' < 1 → sp a r = sp b r' → a = b ∧ r = r') : + ∀ k, range (sp k) ∩ range (sp (next k)) = {v} := by + intro k + ext x + constructor + · rintro ⟨⟨r, rfl⟩, ⟨r', hr'⟩⟩ + by_contra hne + have hr : r < 1 := unitInterval.lt_one_iff_ne_one.mpr fun h => hne (by rw [h, hsp1]; rfl) + have hr'' : r' < 1 := unitInterval.lt_one_iff_ne_one.mpr fun h => hne (by + rw [← hr', h, hsp1]; rfl) + exact hnext k (hspeq _ _ _ _ hr'' hr hr').1 + · rintro rfl + exact ⟨⟨1, hsp1 k⟩, ⟨1, hsp1 _⟩⟩ + +theorem exists_polar_of_fan {H : Type*} [Finite H] [Nonempty H] (hS : IsClosedSurface S) + {next : H → H} {v : S} {s : H → I → S} {Q B : H → Set S} {W : Set S} {τ : H → I} + (hf : IsFan next v s Q B W τ) : + ∃ Φ : C(ClosedUnitDisc, S), Function.Injective Φ ∧ Φ polarCentre = v ∧ range Φ ⊆ W ∧ + ∀ x, x ≠ polarCentre → ∀ c : I, 0 < c → + (∃ k, Φ x ∈ B k ∧ Φ (discScale c x) ∈ B k) ∨ + ∃ k, ∃ t t' : I, 0 < t ∧ t < 1 ∧ 0 < t' ∧ t' < 1 ∧ Φ x = s k t ∧ Φ (discScale c x) = s k t' + := by + classical + have hT2 : T2Space S := hS.2.1 + have hcapk := fun k => exists_cap hS (hf.disc k) (hf.bd k) hf.isOpen hf.mem + choose W' hW'o hvW' hW'c using hcapk + have hW₀o : IsOpen (⋂ k, W' k) := isOpen_iInter_of_finite hW'o + have hvW₀ : v ∈ ⋂ k, W' k := mem_iInter.mpr hvW' + have hsmall : ∀ k, ∃ t : I, 0 < t ∧ t < 1 ∧ t ≤ τ k ∧ ∀ u, u ≤ t → s k u ∈ ⋂ k, W' k := fun k => + exists_small (hf.cont k) hW₀o (by rw [hf.zero]; exact hvW₀) (hf.pos k) + choose t ht0 ht1 htτ htW using hsmall + -- The spokes, from the rim to `v`. + let par : H → I → I := fun k r => t k * σ r + have hparc : ∀ k, Continuous (par k) := fun k => by fun_prop + have hparinj : ∀ k, Function.Injective (par k) := fun k a b h => by + have h' : (t k).1 * (1 - a.1) = (t k).1 * (1 - b.1) := congrArg Subtype.val h + have := mul_left_cancel₀ (ne_of_gt (show 0 < (t k).1 from ht0 k)) h' + exact Subtype.ext (by linarith) + have hparle : ∀ k r, par k r ≤ t k := fun k r => unitInterval.mul_le_left + have hparlt : ∀ k r, par k r < 1 := fun k r => (hparle k r).trans_lt (ht1 k) + have hparpos : ∀ k r, r < 1 → 0 < par k r := fun k r hr => by + have h₁ : 0 < 1 - r.1 := sub_pos.mpr hr + exact mul_pos (ht0 k) h₁ + let sp : H → I → S := fun k r => s k (par k r) + have hspc : ∀ k, Continuous (sp k) := fun k => (hf.cont k).comp (hparc k) + have hspi : ∀ k, Function.Injective (sp k) := fun k => (hf.sInj k).comp (hparinj k) + have hsp1 : ∀ k, sp k 1 = v := fun k => by + simp only [sp, par, unitInterval.symm_one, mul_zero] + exact hf.zero k + have hspne : ∀ k r, r < 1 → sp k r ≠ v := fun k r hr h => + hr.ne (hspi k (h.trans (hsp1 k).symm)) + have hspeq : ∀ a b r r', r < 1 → r' < 1 → sp a r = sp b r' → a = b ∧ r = r' := by + intro a b r r' hr hr' h + by_cases hab : a = b + · subst hab + exact ⟨rfl, hspi a h⟩ + · exact ((hparpos a r hr).ne' (hf.meet a b hab _ _ (hparlt a r) (hparlt b r') h)).elim + have hrange : ∀ k, IsLineWithEnds (range (sp k)) v (sp k 0) := fun k => by + have := IsArcMap.isLineWithEnds (⟨hspc k, hspi k⟩ : IsArcMap (sp k)) + have h' := IsLineWithEnds.symm this + rwa [hsp1] at h' + have hrcap := adjacent_spokes_inter hsp1 hf.next_ne hspeq + have hTline : ∀ k, IsLineWithEnds (range (sp k) ∪ range (sp (next k))) (sp k 0) (sp (next k) 0) := + fun k => IsLineWithEnds.union (hrange k) (hrange (next k)) (hrcap k) + have hTbd : ∀ k, range (sp k) ∪ range (sp (next k)) ⊆ discBd (Q k) := by + rintro k x (⟨r, rfl⟩ | ⟨r, rfl⟩) + · exact hf.left k _ ((hparle k r).trans (htτ k)) + · exact hf.right k _ ((hparle _ r).trans (htτ _)) + have hTW : ∀ k, range (sp k) ∪ range (sp (next k)) ⊆ W' k := by + rintro k x (⟨r, rfl⟩ | ⟨r, rfl⟩) + · exact mem_iInter.mp (htW k _ (hparle k r)) k + · exact mem_iInter.mp (htW _ _ (hparle _ r)) k + have hend₁ : ∀ k, sp k 0 ≠ sp (next k) 0 := fun k h => + hf.next_ne k (hspeq _ _ _ _ zero_lt_one zero_lt_one h).1.symm + have hvT : ∀ k, v ∈ range (sp k) ∪ range (sp (next k)) := fun k => Or.inl ⟨1, hsp1 k⟩ + have hcap := fun k => hW'c k (sp k 0) (sp (next k) 0) _ (hend₁ k) (hTline k) (hTbd k) (hTW k) + (hvT k) + (hspne k 0 zero_lt_one).symm (hspne _ 0 zero_lt_one).symm + choose C Q₁ hCl hCW hCQ hCdis hQ₁ hQ₁W hQ₁Q hQ₁bd hQ₁cap using hcap + have hCarc := fun k => IsLineWithEnds.exists_arc (hCl k) + choose e he her he0 he1 using hCarc + -- A point of the cap is not on a spoke, except at the ends of the cap. + have hcapoff : ∀ k x, x ∈ C k → x ∈ discBd (Q k) → x = sp k 0 ∨ x = sp (next k) 0 := by + intro k x hx hb + by_contra hne + push Not at hne + exact disjoint_left.mp (hCdis k) ⟨hx, fun h => (h.elim hne.1 hne.2)⟩ hb + have hsquare : ∀ k, ∃ G : I × I → S, Continuous G ∧ (∀ u, G (u, 0) = e k u) ∧ (∀ r, G (0, r) + = sp k r) ∧ + (∀ r, G (1, r) = sp (next k) r) ∧ (∀ u, G (u, 1) = sp k 1) ∧ InjOn G {p | p.2 < 1} ∧ + range G = Q₁ k ∧ + (∀ p : I × I, 0 < p.1 → p.1 < 1 → 0 < p.2 → p.2 < 1 → G p ∉ discBd (Q₁ k)) := by + intro k + have hneq : ∀ {a b : I}, sp k a = sp (next k) b → a = 1 ∧ b = 1 := by + intro a b h + have hm : sp k a ∈ range (sp k) ∩ range (sp (next k)) := ⟨⟨a, rfl⟩, ⟨b, h.symm⟩⟩ + rw [hrcap k] at hm + exact ⟨hspi k (hm.trans (hsp1 k).symm), hspi _ ((h.symm.trans hm).trans (hsp1 _).symm)⟩ + have hmemC : ∀ a, e k a ∈ C k := fun a => her k ▸ mem_range_self a + refine exists_square_chart (hQ₁ k) hS.2.2 (he k).1 (hspc k) (hspc (next k)) (he k).2 (hspi k) + (hspi (next k)) (he0 k) (he1 k) ((hsp1 k).trans (hsp1 _).symm) ?_ ?_ ?_ ?_ + · intro a b h + have hb : e k a ∈ discBd (Q k) := hTbd k (Or.inl ⟨b, h.symm⟩) + rcases hcapoff k _ (hmemC a) hb with h₁ | h₁ + · exact ⟨(he k).2 (h₁.trans (he0 k).symm), hspi k ((h.symm.trans h₁))⟩ + · have := hneq (a := b) (b := 0) (h.symm.trans h₁) + exact absurd this.2 zero_ne_one + · intro a b h + have hb : e k a ∈ discBd (Q k) := hTbd k (Or.inr ⟨b, h.symm⟩) + rcases hcapoff k _ (hmemC a) hb with h₁ | h₁ + · have := hneq (a := 0) (b := b) (h₁.symm.trans h) + exact absurd this.1 zero_ne_one + · exact ⟨(he k).2 (h₁.trans (he1 k).symm), hspi _ ((h.symm.trans h₁))⟩ + · intro a b h + exact hneq h + · rw [hQ₁bd k, her k] + ext x + simp only [mem_union] + tauto + choose G hGc hGb hGl hGr hGt hGi hGR hGint using hsquare + -- Where the points of a sector lie. + have hclass : ∀ k (p : I × I), p.2 < 1 → p.1 < 1 → (0 < p.1 ∧ G k p ∈ B k) ∨ (p.1 = 0 ∧ G k p + = sp k p.2) := by + rintro k ⟨u, r⟩ hr hu + simp only at hr hu ⊢ + by_cases hu0 : u = 0 + · subst hu0 + exact Or.inr ⟨rfl, hGl k r⟩ + have hupos : 0 < u := unitInterval.pos_iff_ne_zero.mpr hu0 + refine Or.inl ⟨hupos, ?_⟩ + have hmem : G k (u, r) ∈ Q₁ k := hGR k ▸ mem_range_self _ + refine hf.inside k ⟨⟨hQ₁W k hmem, hQ₁Q k hmem⟩, fun hb => ?_⟩ + by_cases hr0 : r = 0 + · subst hr0 + rw [hGb] at hb + have hmemC : e k u ∈ C k := her k ▸ mem_range_self u + rcases hcapoff k _ hmemC hb with h₁ | h₁ + · exact hu0 ((he k).2 (h₁.trans (he0 k).symm)) + · exact hu.ne ((he k).2 (h₁.trans (he1 k).symm)) + · have hrpos : 0 < r := unitInterval.pos_iff_ne_zero.mpr hr0 + have hT := hQ₁cap k ⟨hmem, hb⟩ + exact hGint k (u, r) hupos hu hrpos hr ((hQ₁bd k).symm ▸ Or.inl hT) + -- The cyclic order. + obtain ⟨k₀⟩ := ‹Nonempty H› + let n := Function.minimalPeriod next k₀ + have hn : 0 < n := Function.minimalPeriod_pos_of_mem_periodicPts (hf.inj.mem_periodicPts k₀) + let κ : ℕ → H := fun i => next^[i] k₀ + have hκs : ∀ i, κ (i + 1) = next (κ i) := fun i => Function.iterate_succ_apply' next i k₀ + have hκn : ∀ i, κ (i + n) = κ i := fun i => by + change next^[i + n] k₀ = next^[i] k₀ + rw [Function.iterate_add_apply, Function.iterate_minimalPeriod] + have hκinj : ∀ i j, i < n → j < n → κ i = κ j → i = j := fun i j hi hj h => + Function.iterate_injOn_Iio_minimalPeriod hi hj h + obtain ⟨h, hh⟩ := exists_cylinder hn (G := fun i => G (κ i)) (fun i => hGc _) + (fun i r => by + rw [hGr, hGl, hκs]) + (fun r => by + have := hκn 0 + rw [zero_add] at this + rw [this]) + have hpar : ∀ z : Circle, ∃ i, i < n ∧ ∃ u : I, u < 1 ∧ + z = Circle.exp (2 * Real.pi * ((i + u.1) / n)) ∧ ∀ r, h (z, r) = G (κ i) (u, r) := by + intro z + obtain ⟨i, hi, u, hu, rfl⟩ := exists_circle_param hn z + exact ⟨i, hi, u, hu, rfl, fun r => hh i hi u r⟩ + have htop : ∀ z, h (z, 1) = v := fun z => by + obtain ⟨i, -, u, -, -, hz⟩ := hpar z + rw [hz, hGt, hsp1] + have hne : ∀ p : Circle × I, p.2 < 1 → h p ≠ v := by + rintro ⟨z, r⟩ hr + obtain ⟨i, -, u, hu, -, hz⟩ := hpar z + rw [hz] + rcases hclass (κ i) (u, r) hr hu with ⟨-, hb⟩ | ⟨-, hb⟩ + · intro h' + rw [h'] at hb + exact hf.off _ (κ i) 0 zero_lt_one (by rw [hf.zero]; exact hb) + · rw [hb] + exact hspne _ _ hr + have hinjh : InjOn h {p | p.2 < 1} := by + rintro ⟨z, r⟩ hr ⟨z', r'⟩ hr' heq + simp only [mem_ofPred_eq] at hr hr' + obtain ⟨i, hi, u, hu, ez, hz⟩ := hpar z + obtain ⟨i', hi', u', hu', ez', hz'⟩ := hpar z' + have hsame : i = i' ∧ u = u' ∧ r = r' := by + rw [hz, hz'] at heq + have hmem' : G (κ i') (u', r') ∈ Q₁ (κ i') := hGR _ ▸ mem_range_self _ + have hmem : G (κ i) (u, r) ∈ Q₁ (κ i) := hGR _ ▸ mem_range_self _ + rcases hclass (κ i) (u, r) hr hu with ⟨h₀, hb⟩ | ⟨h₀, hb⟩ <;> + rcases hclass (κ i') (u', r') hr' hu' with ⟨h₀', hb'⟩ | ⟨h₀', hb'⟩ + · have hk : κ i = κ i' := by + by_contra hk + exact disjoint_left.mp (hf.disj _ _ hk) hb (hQ₁Q _ (heq ▸ hmem')) + obtain rfl := hκinj i i' hi hi' hk + have := hGi (κ i) (show (u, r).2 < 1 from hr) (show (u', r').2 < 1 from hr') heq + exact ⟨rfl, congrArg Prod.fst this, congrArg Prod.snd this⟩ + · rw [heq, hb'] at hb + exact (hf.off _ _ _ (hparlt _ _) hb).elim + · rw [← heq, hb] at hb' + exact (hf.off _ _ _ (hparlt _ _) hb').elim + · rw [hb, hb'] at heq + obtain ⟨e₁, e₂⟩ := hspeq _ _ _ _ hr hr' heq + exact ⟨hκinj i i' hi hi' e₁, h₀.trans h₀'.symm, e₂⟩ + obtain ⟨rfl, rfl, rfl⟩ := hsame + rw [ez, ez'] + obtain ⟨Φ, hΦinj, hΦ⟩ := exists_disc_of_cone htop hinjh hne + refine ⟨Φ, hΦinj, ?_, ?_, ?_⟩ + · rw [← coneMap_top 1, hΦ, htop] + · rintro _ ⟨x, rfl⟩ + obtain ⟨⟨z, r⟩, rfl⟩ := coneMap_surjective x + obtain ⟨i, -, u, -, -, hz⟩ := hpar z + rw [hΦ, hz] + exact hQ₁W _ (hGR _ ▸ mem_range_self _) + · intro x hx c hc + obtain ⟨⟨z, r⟩, rfl⟩ := coneMap_surjective x + have hr : r < 1 := unitInterval.lt_one_iff_ne_one.mpr fun h' => hx (by rw [h', coneMap_top]) + obtain ⟨r', hr', he'⟩ := discScale_coneMap c hc (z, r) hr + obtain ⟨i, -, u, hu, -, hz⟩ := hpar z + simp only at he' + rw [he', hΦ, hΦ, hz, hz] + rcases hclass (κ i) (u, r) hr hu with ⟨h₀, hb⟩ | ⟨h₀, hb⟩ <;> + rcases hclass (κ i) (u, r') hr' hu with ⟨h₀', hb'⟩ | ⟨h₀', hb'⟩ + · exact Or.inl ⟨_, hb, hb'⟩ + · exact absurd h₀' h₀.ne' + · exact absurd h₀ h₀'.ne' + · refine Or.inr ⟨κ i, _, _, hparpos _ _ hr, hparlt _ _, hparpos _ _ hr', hparlt _ _, hb, hb'⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/RadialAccess.lean b/LeanPool/GraphMinor/GM11/RadialAccess.lean new file mode 100644 index 0000000000..7800ace263 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/RadialAccess.lean @@ -0,0 +1,365 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialBasics + +/-! +# Reaching a vertex from a region + +Let `x` be a vertex of a drawing `Γ` with at least one half-edge, and let `p` be a region with `x` +in +its closure. This file builds a path from `x` that stays in `p` after time `0`. + +* With two or more half-edges at `x`, the path runs inside the closed disc `Q k` of a sector + (`exists_path_into_disc`). +* With one half-edge, `x` is a leaf, and the sector is missing. Then the path is an infinite + concatenation of ever shorter paths, whose existence comes from `exists_leaf_nbhd` + (`exists_path_of_steps`). +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface Filter unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A closed surface is locally path connected. -/ +theorem IsClosedSurface.locPathConnected (hS : IsClosedSurface S) : LocallyPathConnectedSpace S + := by + have hP : LocallyPathConnectedSpace OpenUnitDisc := + (Metric.isOpen_ball : IsOpen (Metric.ball (0 : EuclideanPlane) 1)).locallyPathConnectedSpace + refine ⟨fun x => ⟨fun U => ⟨fun hU => ?_, fun h => ?_⟩⟩⟩ + swap + · obtain ⟨s, ⟨hs, -⟩, hsub⟩ := h + exact mem_of_superset hs hsub + obtain ⟨V, hV, hxV, ⟨h⟩⟩ := hS.2.2 x + let T : OpenUnitDisc → S := fun y => (h.symm y).1 + have hTe : IsOpenEmbedding T := hV.isOpenEmbedding_subtypeVal.comp h.symm.isOpenEmbedding + let c : OpenUnitDisc := h ⟨x, hxV⟩ + have hTc : T c = x := by simp [T, c] + have hU' : T ⁻¹' U ∈ 𝓝 c := (hTe.continuous.tendsto c).mono_right (by rw [hTc]) hU + obtain ⟨s, ⟨hs, hsp⟩, hsub⟩ := (path_connected_basis c).mem_iff.mp hU' + refine ⟨T '' s, ⟨?_, hsp.image hTe.continuous⟩, image_subset_iff.mpr hsub⟩ + rw [← hTc, ← hTe.map_nhds_eq] + exact image_mem_map hs + +/-- An open connected subset of a closed surface is path connected. -/ +theorem isPathConnected_of_isOpen (hS : IsClosedSurface S) {A : Set S} (hA : IsOpen A) + (hc : IsPreconnected A) (hne : A.Nonempty) : IsPathConnected A := by + have := IsClosedSurface.locPathConnected hS + exact hA.isConnected_iff_isPathConnected.mp ⟨hne, hc⟩ + +/-- The concatenation of infinitely many paths `p n` from `y n` to `y (n + 1)`, which tend to `x`. +It +runs from `x` at time `0`, through all the paths in the reverse order, to `y 0` at time `1`. -/ +theorem exists_path_of_steps {x : S} {y : ℕ → S} (p : ∀ n, Path (y n) (y (n + 1))) + {N : ℕ → Set S} (hN : ∀ O ∈ 𝓝 x, ∃ n₀, ∀ n ≥ n₀, N n ⊆ O) (hpN : ∀ n t, p n t ∈ N n) : + ∃ g : I → S, Continuous g ∧ g 0 = x ∧ ∀ t, 0 < t → ∃ n s, g t = p n s := by + classical + let cl : ℝ → I := projIcc 0 1 zero_le_one + have hcl : Continuous cl := continuous_projIcc + let F : ℝ → S := fun u => p ⌊u⌋₊ (cl (u - ⌊u⌋₊)) + let C : ℕ → Set ℝ := fun n => if n = 0 then Iic 1 else Icc (n : ℝ) (n + 1) + have hfl : ∀ (u : ℝ) (m : ℕ), ⌊u⌋₊ = m → F u = p m (cl (u - m)) := by + rintro u m rfl + rfl + have hFeq : ∀ (n : ℕ) (u : ℝ), u ∈ C n → F u = p n (cl (u - n)) := by + have key : ∀ (n : ℕ) (u : ℝ), u ∈ Icc (n : ℝ) (n + 1) → F u = p n (cl (u - n)) := by + intro n u hu + rcases eq_or_lt_of_le hu.2 with h | h + · have hf : ⌊u⌋₊ = n + 1 := by + rw [h] + exact_mod_cast Nat.floor_natCast (R := ℝ) (n + 1) + rw [hfl u _ hf] + have e₁ : cl (u - (n + 1 : ℕ)) = 0 := by + rw [h] + have : ((n : ℝ) + 1 - (n + 1 : ℕ)) = 0 := by push_cast; ring + rw [this] + exact projIcc_left _ + have e₂ : cl (u - n) = 1 := by + rw [h] + have : ((n : ℝ) + 1 - n) = 1 := by ring + rw [this] + exact projIcc_right _ + rw [e₁, e₂, (p (n + 1)).source, (p n).target] + · exact hfl u n ((Nat.floor_eq_iff (le_trans (Nat.cast_nonneg n) hu.1)).mpr ⟨hu.1, h⟩) + intro n u hu + by_cases hn : n = 0 + · subst hn + have hu1 : u ≤ 1 := by simpa [C] using hu + rcases le_or_gt 0 u with h0 | h0 + · exact key 0 u (by simpa using ⟨h0, hu1⟩) + · exact hfl u 0 (Nat.floor_of_nonpos h0.le) + · have : u ∈ Icc (n : ℝ) (n + 1) := by simpa [C, hn] using hu + exact key n u this + have hFc : Continuous F := by + have hlf : LocallyFinite C := by + intro u + refine ⟨Ioo (u - 1) (u + 1), Ioo_mem_nhds (by linarith) (by linarith), ?_⟩ + refine (finite_Iic ⌈u + 1⌉₊).subset ?_ + rintro n ⟨z, hz, hzI⟩ + by_cases hn : n = 0 + · subst hn + exact Nat.zero_le _ + · have hz' : z ∈ Icc (n : ℝ) (n + 1) := by simpa [C, hn] using hz + have : (n : ℝ) ≤ ⌈u + 1⌉₊ := calc + (n : ℝ) ≤ z := hz'.1 + _ ≤ u + 1 := hzI.2.le + _ ≤ _ := Nat.le_ceil _ + exact_mod_cast this + refine hlf.continuous ?_ ?_ ?_ + · refine eq_univ_of_forall fun u => mem_iUnion.mpr ?_ + rcases le_or_gt u 1 with h | h + · exact ⟨0, by simpa [C] using h⟩ + · have hf : 1 ≤ ⌊u⌋₊ := Nat.le_floor (by simpa using h.le) + refine ⟨⌊u⌋₊, ?_⟩ + have hn : ⌊u⌋₊ ≠ 0 := by omega + simp only [C, hn, ite_false] + exact ⟨Nat.floor_le (by linarith), (Nat.lt_floor_add_one u).le⟩ + · intro n + by_cases hn : n = 0 <;> simp [C, hn, isClosed_Iic, isClosed_Icc] + · intro n + have hc : Continuous fun u : ℝ => p n (cl (u - n)) := + (p n).continuous.comp (hcl.comp (by fun_prop)) + exact hc.continuousOn.congr (hFeq n) + let g : I → S := fun t => if (t : ℝ) = 0 then x else F ((t : ℝ)⁻¹ - 1) + have hg0 : g 0 = x := by simp [g] + have hgF : ∀ t : I, (t : ℝ) ≠ 0 → g t = F ((t : ℝ)⁻¹ - 1) := fun t ht => ite_eq_right ht + refine ⟨g, ?_, hg0, ?_⟩ + · refine continuous_iff_continuousAt.mpr fun t => ?_ + by_cases ht : (t : ℝ) = 0 + · have ht0 : t = 0 := Subtype.ext ht + subst ht0 + change Tendsto g (𝓝 0) (𝓝 (g 0)) + rw [hg0] + refine fun O hO => ?_ + obtain ⟨n₀, hn₀⟩ := hN O hO + have hpos : (0 : ℝ) < ((n₀ : ℝ) + 1)⁻¹ := by positivity + have : ∀ᶠ t : I in 𝓝 0, (t : ℝ) < ((n₀ : ℝ) + 1)⁻¹ := + continuous_subtype_val.continuousAt.eventually_lt_const (by simpa using hpos) + refine mem_map.mpr ?_ + filter_upwards [this] with t ht + by_cases ht0 : (t : ℝ) = 0 + · have e : g t = x := ite_eq_left ht0 + rw [mem_preimage, e] + exact mem_of_mem_nhds hO + · have htp : (0 : ℝ) < t := lt_of_le_of_ne t.2.1 (Ne.symm ht0) + rw [mem_preimage, hgF t ht0] + have hu : (n₀ : ℝ) ≤ (t : ℝ)⁻¹ - 1 := by + have := (inv_lt_inv₀ (by positivity) htp).mpr ht + rw [inv_inv] at this + linarith + exact hn₀ ⌊(t : ℝ)⁻¹ - 1⌋₊ (Nat.le_floor hu) (hpN _ _) + · have hev : g =ᶠ[𝓝 t] fun t' : I => F ((t' : ℝ)⁻¹ - 1) := by + have : ∀ᶠ t' : I in 𝓝 t, (t' : ℝ) ≠ 0 := + continuous_subtype_val.continuousAt.eventually_ne ht + filter_upwards [this] with t' ht' using hgF t' ht' + refine ContinuousAt.congr ?_ hev.symm + refine hFc.continuousAt.comp ?_ + exact (ContinuousAt.inv₀ continuous_subtype_val.continuousAt ht).sub continuousAt_const + · intro t ht + have ht' : (t : ℝ) ≠ 0 := fun h => ht.ne' (Subtype.ext h) + exact ⟨_, _, hgF t ht'⟩ + +/-- A path from a point of the boundary of a closed disc into the interior of the disc, near that +point. -/ +theorem exists_path_into_disc {Q : Set S} (hQ : IsClosedDisc Q) {x : S} (hx : x ∈ discBd Q) + {W : Set S} (hW : IsOpen W) (hxW : x ∈ W) : + ∃ g : I → S, Continuous g ∧ Function.Injective g ∧ g 0 = x ∧ + ∀ t, 0 < t → g t ∈ W ∧ g t ∈ Q ∧ g t ∉ discBd Q := by + obtain ⟨φ⟩ := hQ + have hbd := disc_boundary Q φ + rw [hbd] at hx + obtain ⟨b, hb, rfl⟩ := hx + have hbn : ‖(b : EuclideanPlane)‖ = 1 := by simpa [UnitCircle] using hb + -- The points of the radius ending at `b`. + let pt : I → ClosedUnitDisc := fun s => ⟨(1 - (s : ℝ)) • (b : EuclideanPlane), by + have : ‖(1 - (s : ℝ)) • (b : EuclideanPlane)‖ ≤ 1 := by + rw [norm_smul, hbn, mul_one, Real.norm_of_nonneg (by linarith [s.2.2])] + linarith [s.2.1] + simpa [ClosedUnitDisc] using this⟩ + have hpt : Continuous pt := Continuous.subtype_mk (by fun_prop) _ + have hpt0 : pt 0 = b := Subtype.ext (by simp [pt]) + let m : I → S := fun s => (φ (pt s)).1 + have hm : Continuous m := continuous_subtype_val.comp (φ.continuous.comp hpt) + have hmW : IsOpen (m ⁻¹' W) := hW.preimage hm + have h0W : (0 : I) ∈ m ⁻¹' W := by + change (φ (pt 0)).1 ∈ W + rw [hpt0] + exact hxW + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp hmW 0 h0W + let d : ℝ := min (δ / 2) 1 + have hd0 : 0 < d := lt_min (half_pos hδ) one_pos + have hd1 : d ≤ 1 := min_le_right _ _ + let sc : I → I := fun t => ⟨d * t, mul_nonneg hd0.le t.2.1, by nlinarith [t.2.1, t.2.2]⟩ + have hsc : Continuous sc := Continuous.subtype_mk (by fun_prop) _ + refine ⟨m ∘ sc, hm.comp hsc, ?_, ?_, ?_⟩ + · intro s t h + have h₁ : pt (sc s) = pt (sc t) := φ.injective (Subtype.ext h) + have h₂ := congrArg Subtype.val h₁ + have hne : (b : EuclideanPlane) ≠ 0 := fun h0 => by simp [h0] at hbn + have h₃ := smul_left_injective ℝ hne h₂ + exact Subtype.ext (mul_left_cancel₀ hd0.ne' (by linarith [h₃, show (sc s : ℝ) = d * s from rfl, + show (sc t : ℝ) = d * t from rfl])) + · change (φ (pt (sc 0))).1 = _ + have : sc 0 = 0 := Subtype.ext (by simp [sc]) + rw [this, hpt0] + · intro t ht + have ht' : (0 : ℝ) < t := ht + have hs : (sc t : ℝ) = d * t := rfl + have hs0 : 0 < (sc t : ℝ) := by rw [hs]; positivity + refine ⟨hball ?_, (φ _).2, ?_⟩ + · rw [Metric.mem_ball, Subtype.dist_eq, Real.dist_eq] + have : (sc t : ℝ) ≤ δ / 2 := by + rw [hs] + have h₁ : d ≤ δ / 2 := min_le_left _ _ + nlinarith [t.2.1, t.2.2] + change |(sc t : ℝ) - ((0 : I) : ℝ)| < δ + rw [Icc.coe_zero, sub_zero, abs_of_pos hs0] + linarith + · rw [hbd] + rintro ⟨z, hz, hze⟩ + have hzp : z = pt (sc t) := φ.injective (Subtype.ext hze) + have hzn : ‖(z : EuclideanPlane)‖ = 1 := by simpa [UnitCircle] using hz + rw [hzp] at hzn + have hle : (sc t : ℝ) ≤ 1 := (sc t).2.2 + have : ‖(1 - (sc t : ℝ)) • (b : EuclideanPlane)‖ = 1 - (sc t : ℝ) := by + rw [norm_smul, hbn, mul_one, Real.norm_of_nonneg (by linarith)] + have h₂ : ‖(pt (sc t) : EuclideanPlane)‖ = 1 - (sc t : ℝ) := this + linarith + +/-- A path that starts at a leaf and then stays in a region whose closure contains the leaf. -/ +theorem exists_path_of_leaf (hS : IsClosedSurface S) (Γ : Drawing S) {e : Set S} (he : e ∈ Γ.E) + {u v : S} (huv : u ≠ v) (hcap : closure e ∩ Γ.V = {u, v}) (hL : IsLineWithEnds (closure e) u v) + (hleaf : ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f) {p : Set S} (hp : p ∈ Γ.R) + (hvp : v ∈ closure p) : + ∃ g : I → S, Continuous g ∧ g 0 = v ∧ ∀ t, 0 < t → g t ∈ p := by + classical + have : T2Space S := hS.2.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hC : (𝓝 v).IsCountablyGenerated := by + obtain ⟨V₀, hV₀, hvV₀, ⟨h⟩⟩ := hS.2.2 v + let T : OpenUnitDisc → S := fun y => (h.symm y).1 + have hTe : IsOpenEmbedding T := hV₀.isOpenEmbedding_subtypeVal.comp h.symm.isOpenEmbedding + have hTc : T (h ⟨v, hvV₀⟩) = v := by simp [T] + rw [← hTc, ← hTe.map_nhds_eq] + infer_instance + obtain ⟨B, hB⟩ := (𝓝 v).exists_antitone_basis + let Nb := {N : Set S // IsOpen N ∧ v ∈ N} + have hstep : ∀ N : Nb, ∃ Z : Nb, ∀ x ∈ Z.1, x ∉ Γ.U → ∀ y ∈ Z.1, y ∉ Γ.U → + ∃ A : Set S, IsPreconnected A ∧ Disjoint A Γ.U ∧ x ∈ A ∧ y ∈ A ∧ A ⊆ N.1 := fun N => by + obtain ⟨Z, h₁, h₂, h₃⟩ := exists_leaf_nbhd hS Γ he huv hcap hL hleaf N.2.1 N.2.2 + exact ⟨⟨Z, h₁, h₂⟩, h₃⟩ + choose Z hZ using hstep + let O : ℕ → Nb := fun n => Nat.rec ⟨univ, isOpen_univ, mem_univ _⟩ + (fun n N => ⟨(Z N).1 ∩ interior (B n) ∩ N.1, ((Z N).2.1.inter isOpen_interior).inter N.2.1, + ⟨(Z N).2.2, mem_interior_iff_mem_nhds.mpr (hB.mem n)⟩, N.2.2⟩) n + have hOs : ∀ n, (O (n + 1)).1 = (Z (O n)).1 ∩ interior (B n) ∩ (O n).1 := fun _ => rfl + have hy : ∀ n, ∃ y, y ∈ (O (n + 1)).1 ∧ y ∈ p := fun n => + mem_closure_iff.mp hvp _ (O (n + 1)).2.1 (O (n + 1)).2.2 + choose y hyO hyp using hy + have hyU : ∀ n, y n ∉ Γ.U := fun n => region_subset hp (hyp n) + have hpath : ∀ n, ∃ P : Path (y n) (y (n + 1)), ∀ t, P t ∈ (O n).1 ∧ P t ∈ p := by + intro n + have h₁ : y n ∈ (Z (O n)).1 := by + exact (show y n ∈ (Z (O n)).1 ∩ interior (B n) ∩ (O n).1 from hyO n).1.1 + have h₂ : y (n + 1) ∈ (Z (O n)).1 := by + have h₃ : y (n + 1) ∈ (O (n + 1)).1 := + (show y (n + 1) ∈ (Z (O (n + 1))).1 ∩ interior (B (n + 1)) ∩ (O (n + 1)).1 from hyO + (n + 1)).2 + exact (show y (n + 1) ∈ (Z (O n)).1 ∩ interior (B n) ∩ (O n).1 from h₃).1.1 + obtain ⟨A, hA, hAU, hyA, hyA', hAO⟩ := hZ (O n) _ h₁ (hyU n) _ h₂ (hyU (n + 1)) + have hE : IsOpen ((O n).1 \ Γ.U) := (O n).2.1.sdiff Γ.isClosed_U + let E : Set S := connectedComponentIn ((O n).1 \ Γ.U) (y n) + have hEo : IsOpen E := hE.connectedComponentIn + have hEs : E ⊆ (O n).1 \ Γ.U := connectedComponentIn_subset _ _ + have hyAs : A ⊆ (O n).1 \ Γ.U := fun z hz => ⟨hAO hz, disjoint_left.mp hAU hz⟩ + have hyE : y n ∈ E := mem_connectedComponentIn (hyAs hyA) + have hAE : A ⊆ E := hA.subset_connectedComponentIn hyA hyAs + have hEp : IsPathConnected E := isPathConnected_of_isOpen hS hEo + isPreconnected_connectedComponentIn ⟨_, hyE⟩ + have hEd : Disjoint E Γ.U := disjoint_left.mpr fun z hz => (hEs hz).2 + have hEr : E ⊆ p := subset_region hp isPreconnected_connectedComponentIn hEd hyE (hyp n) + obtain ⟨P, hP⟩ := hEp.joinedIn _ hyE _ (hAE hyA') + exact ⟨P, fun t => ⟨(hEs (hP t)).1, hEr (hP t)⟩⟩ + choose P hP using hpath + have hN : ∀ O' ∈ 𝓝 v, ∃ n₀, ∀ n ≥ n₀, (O n).1 ⊆ O' := by + intro O' hO' + obtain ⟨m, -, hm⟩ := hB.1.mem_iff.mp hO' + refine ⟨m + 1, fun n hn => ?_⟩ + obtain ⟨n', rfl⟩ : ∃ n', n = n' + 1 := ⟨n - 1, by omega⟩ + exact fun z hz => hm (hB.2 (show m ≤ n' by omega) (interior_subset + (show z ∈ (Z (O n')).1 ∩ interior (B n') ∩ (O n').1 from hz).1.2)) + obtain ⟨g, hg, hg0, hgt⟩ := exists_path_of_steps P hN fun n t => (hP n t).1 + refine ⟨g, hg, hg0, fun t ht => ?_⟩ + obtain ⟨n, s, hs⟩ := hgt t ht + rw [hs] + exact (hP n s).2 + +/-- A path from a vertex with a half-edge into a region whose closure contains the vertex. -/ +theorem exists_access (hS : IsClosedSurface S) (Γ : Drawing S) {γ : Set S → I → S} + (hγ : EdgePar Γ γ) {x : S} (hx : x ∈ Γ.V) (hne : (halfEdges Γ γ x).Nonempty) {p : Set S} + (hp : p ∈ Γ.R) (hxp : x ∈ closure p) : + ∃ g : I → S, Continuous g ∧ g 0 = x ∧ ∀ t, 0 < t → g t ∈ p := by + classical + have : T2Space S := hS.2.1 + by_cases h2 : 2 ≤ Nat.card (halfEdges Γ γ x) + · obtain ⟨next, ρ, P, W, Q, τ, h⟩ := exists_sectors hS Γ hγ hx h2 + obtain ⟨k, rfl⟩ := IsCorners.all (IsSectors.corners h) p hp hxp + obtain ⟨g, hg, -, hg0, hgt⟩ := exists_path_into_disc (IsSectors.disc h k) (IsSectors.bd h k) + (IsSectors.isOpen h) (IsSectors.mem h) + refine ⟨g, hg, hg0, fun t ht => IsSectors.sub h k (IsSectors.inside h k ?_)⟩ + obtain ⟨h₁, h₂, h₃⟩ := hgt t ht + exact ⟨⟨h₁, h₂⟩, h₃⟩ + · have hfin := finite_halfEdges Γ γ x + have : Fintype (halfEdges Γ γ x) := hfin.fintype + obtain ⟨⟨e, b⟩, he, hb⟩ := hne + dsimp only at he hb + have hsingle : ∀ y ∈ halfEdges Γ γ x, y = (e, b) := by + intro y hy + by_contra hne' + apply h2 + have hc : 1 < (halfEdges Γ γ x).ncard := (one_lt_ncard hfin).mpr + ⟨y, hy, (e, b), ⟨he, hb⟩, hne'⟩ + exact hc + have hother : γ e (endOf (!b)) ≠ x := by + intro h' + have := hsingle (e, !b) ⟨he, h'⟩ + simp at this + have hxcl : x ∈ closure e := hb ▸ end_mem_closure hγ he b + have hoV := end_mem_V hγ he (!b) + have hocl := end_mem_closure hγ he (!b) + have hleaf : ∀ f ∈ Γ.E, f ≠ e → x ∉ closure f := by + intro f hf hfe hxf + obtain ⟨c, hc⟩ := exists_end_eq hγ hf hx hxf + have := hsingle (f, c) ⟨hf, hc⟩ + exact hfe (congrArg Prod.fst this) + rcases Γ.edge_cond e he with ⟨u, v, huv, hcap, hL⟩ | ⟨u, hcap, -⟩ + · have hxm : x ∈ ({u, v} : Set S) := by + rw [← hcap] + exact ⟨hxcl, hx⟩ + rcases hxm with rfl | hxv + · rw [pair_comm] at hcap + exact exists_path_of_leaf hS Γ he huv.symm hcap (IsLineWithEnds.symm hL) hleaf hp hxp + · obtain rfl : x = v := hxv + exact exists_path_of_leaf hS Γ he huv hcap hL hleaf hp hxp + · have h₁ : x ∈ ({u} : Set S) := by + rw [← hcap] + exact ⟨hxcl, hx⟩ + have h₂ : γ e (endOf (!b)) ∈ ({u} : Set S) := by + rw [← hcap] + exact ⟨hocl, hoV⟩ + exact absurd (h₂.trans h₁.symm) hother + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/RadialBasics.lean b/LeanPool/GraphMinor/GM11/RadialBasics.lean new file mode 100644 index 0000000000..e5fd72094e --- /dev/null +++ b/LeanPool/GraphMinor/GM11/RadialBasics.lean @@ -0,0 +1,233 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section6 +public import LeanPool.GraphMinor.GM11.Corners +public import LeanPool.GraphMinor.GM11.Section3 + +/-! +# Tools for radial drawings + +Graph Minors XI omits the proof that "every region of $\Gamma'$ includes a unique edge of $\Gamma$", +for a radial +drawing `Γ'` of `Γ` (Section 3, page 75). This file has three general tools for that proof. + +* `Drawing.glue`: the union of two drawings that meet only in common vertices, with its edges. +* `isOArc_union`: two lines with the same ends and nothing else in common form an `O`-arc. +* `exists_disc_in_openDisc`: an `O`-arc in an open disc bounds a closed disc in that open disc. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface Metric + +universe u + +variable {S : Type u} [TopologicalSpace S] + +section Glue + +variable {A B : Set S} {X Y : Set S} + +/-- A connected subset of two closed sets, which misses their intersection, lies in one of them. -/ +theorem subset_or_subset_of_closed {C : Set S} (hC : IsPreconnected C) (hX : IsClosed X) + (hY : IsClosed Y) (hsub : C ⊆ X ∪ Y) (hdis : ∀ x ∈ C, x ∈ X → x ∉ Y) : C ⊆ X ∨ C ⊆ Y := by + by_contra hno + push Not at hno + obtain ⟨hnX, hnY⟩ := hno + obtain ⟨y, hyC, hyX⟩ := not_subset.mp hnX + obtain ⟨x, hxC, hxY⟩ := not_subset.mp hnY + have hxX : x ∈ X := (hsub hxC).resolve_right hxY + have hyY : y ∈ Y := (hsub hyC).resolve_left hyX + obtain ⟨z, hzC, hzX, hzY⟩ := isPreconnected_closed_iff.mp hC X Y hX hY hsub ⟨x, hxC, hxX⟩ + ⟨y, hyC, hyY⟩ + exact hdis z hzC hzX hzY + +end Glue + +/-- The arc-wise connected components of the union of two sets `A`, `B` that lie in closed sets +meeting only outside `A` and `B`. -/ +theorem arcComponentsIn_union {U₁ U₂ A B : Set S} (h₁ : IsClosed U₁) (h₂ : IsClosed U₂) + (hA : A ⊆ U₁) (hB : B ⊆ U₂) (hAB : ∀ x ∈ A ∪ B, x ∈ U₁ → x ∉ U₂) : + arcComponentsIn (A ∪ B) = arcComponentsIn A ∪ arcComponentsIn B := by + have hdisj : ∀ x, x ∈ A → x ∈ B → False := fun x h h' => + hAB x (Or.inl h) (hA h) (hB h') + have hsplit : ∀ {C : Set S}, IsPathConnected C → C ⊆ A ∪ B → C ⊆ A ∨ C ⊆ B := by + intro C hC hsub + have hc : C ⊆ U₁ ∪ U₂ := hsub.trans (union_subset_union hA hB) + rcases subset_or_subset_of_closed hC.isConnected.isPreconnected h₁ h₂ hc + (fun x hx => hAB x (hsub hx)) with h | h + · refine Or.inl fun x hx => (hsub hx).resolve_right fun hxB => ?_ + exact hAB x (hsub hx) (h hx) (hB hxB) + · refine Or.inr fun x hx => (hsub hx).resolve_left fun hxA => ?_ + exact hAB x (hsub hx) (hA hxA) (h hx) + ext C + constructor + · rintro ⟨hne, hsub, hp, hmax⟩ + rcases hsplit hp hsub with h | h + · exact Or.inl ⟨hne, h, hp, fun D hD hpD hCD => hmax D (hD.trans subset_union_left) hpD hCD⟩ + · exact Or.inr ⟨hne, h, hp, fun D hD hpD hCD => hmax D (hD.trans subset_union_right) hpD hCD⟩ + · rintro (⟨hne, hsub, hp, hmax⟩ | ⟨hne, hsub, hp, hmax⟩) + · refine ⟨hne, hsub.trans subset_union_left, hp, fun D hD hpD hCD => ?_⟩ + obtain ⟨x, hx⟩ := hne + rcases hsplit hpD hD with h | h + · exact hmax D h hpD hCD + · exact (hdisj x (hsub hx) (h (hCD hx))).elim + · refine ⟨hne, hsub.trans subset_union_right, hp, fun D hD hpD hCD => ?_⟩ + obtain ⟨x, hx⟩ := hne + rcases hsplit hpD hD with h | h + · exact (hdisj x (h (hCD hx)) (hsub hx)).elim + · exact hmax D h hpD hCD + +theorem glue_sdiff {Γ₁ Γ₂ : Drawing S} (h : Γ₁.U ∩ Γ₂.U ⊆ Γ₁.V ∩ Γ₂.V) : + (Γ₁.U ∪ Γ₂.U) \ (Γ₁.V ∪ Γ₂.V) = (Γ₁.U \ Γ₁.V) ∪ (Γ₂.U \ Γ₂.V) := by + ext x + constructor + · rintro ⟨hx | hx, hn⟩ + · exact Or.inl ⟨hx, fun h' => hn (Or.inl h')⟩ + · exact Or.inr ⟨hx, fun h' => hn (Or.inr h')⟩ + · rintro (⟨hx, hn⟩ | ⟨hx, hn⟩) + · refine ⟨Or.inl hx, ?_⟩ + rintro (h' | h') + · exact hn h' + · exact hn (h ⟨hx, Γ₂.V_subset_U h'⟩).1 + · refine ⟨Or.inr hx, ?_⟩ + rintro (h' | h') + · exact hn (h ⟨Γ₁.V_subset_U h', hx⟩).2 + · exact hn h' + +theorem glue_arc {Γ₁ Γ₂ : Drawing S} (h : Γ₁.U ∩ Γ₂.U ⊆ Γ₁.V ∩ Γ₂.V) : + arcComponentsIn ((Γ₁.U ∪ Γ₂.U) \ (Γ₁.V ∪ Γ₂.V)) = + arcComponentsIn (Γ₁.U \ Γ₁.V) ∪ arcComponentsIn (Γ₂.U \ Γ₂.V) := by + rw [glue_sdiff h] + refine arcComponentsIn_union Γ₁.isClosed_U Γ₂.isClosed_U sdiff_subset sdiff_subset ?_ + rintro x (⟨-, hn⟩ | ⟨-, hn⟩) hx₁ hx₂ + · exact hn (h ⟨hx₁, hx₂⟩).1 + · exact hn (h ⟨hx₁, hx₂⟩).2 + +/-- The union of two drawings that meet only in common vertices. -/ +def _root_.GraphMinor.Surface.Drawing.glue (Γ₁ Γ₂ : Drawing S) (h : Γ₁.U ∩ Γ₂.U ⊆ Γ₁.V ∩ Γ₂.V) : + Drawing S where + U := Γ₁.U ∪ Γ₂.U + V := Γ₁.V ∪ Γ₂.V + V_subset_U := union_subset_union Γ₁.V_subset_U Γ₂.V_subset_U + isClosed_U := Γ₁.isClosed_U.union Γ₂.isClosed_U + finite_V := Γ₁.finite_V.union Γ₂.finite_V + finite_edges := by + rw [glue_arc h] + exact Γ₁.finite_edges.union Γ₂.finite_edges + edge_cond := by + intro e he + rw [glue_arc h] at he + rcases he with he | he + · have hcap : closure e ∩ (Γ₁.V ∪ Γ₂.V) = closure e ∩ Γ₁.V := by + ext x + constructor + · rintro ⟨hx, hv | hv⟩ + · exact ⟨hx, hv⟩ + · exact ⟨hx, (h ⟨Γ₁.closure_subset_U he hx, Γ₂.V_subset_U hv⟩).1⟩ + · exact fun hx => ⟨hx.1, Or.inl hx.2⟩ + rw [hcap] + exact Γ₁.edge_cond e he + · have hcap : closure e ∩ (Γ₁.V ∪ Γ₂.V) = closure e ∩ Γ₂.V := by + ext x + constructor + · rintro ⟨hx, hv | hv⟩ + · exact ⟨hx, (h ⟨Γ₁.V_subset_U hv, Γ₂.closure_subset_U he hx⟩).2⟩ + · exact ⟨hx, hv⟩ + · exact fun hx => ⟨hx.1, Or.inr hx.2⟩ + rw [hcap] + exact Γ₂.edge_cond e he + +theorem _root_.GraphMinor.Surface.Drawing.glue_E {Γ₁ Γ₂ : Drawing S} (h : Γ₁.U ∩ Γ₂.U ⊆ Γ₁.V ∩ + Γ₂.V) : + (Γ₁.glue Γ₂ h).E = Γ₁.E ∪ Γ₂.E := + glue_arc h + +/-- An `O`-arc in an open disc bounds a closed disc in that open disc. -/ +theorem exists_disc_in_openDisc [T2Space S] {r J : Set S} (hr : IsOpenDisc r) (hJ : IsOArc J) + (hsub : J ⊆ r) : ∃ Δ : Set S, Δ ⊆ r ∧ IsClosedDisc Δ ∧ discBd Δ = J := by + obtain ⟨-, ⟨φ⟩⟩ := hr + have hJc : IsCompact J := by + obtain ⟨f⟩ := hJ + have : J = range fun x : Circle => (f x).1 := by + ext y + constructor + · intro hy + obtain ⟨x, hx⟩ := f.surjective ⟨y, hy⟩ + exact ⟨x, by simp [hx]⟩ + · rintro ⟨x, rfl⟩ + exact (f x).2 + rw [this] + exact isCompact_range (by fun_prop) + -- The points of the plane that correspond to `J` lie in a smaller closed disc. + let T : Set r := Subtype.val ⁻¹' J + have hT : IsCompact T := Topology.IsEmbedding.subtypeVal.isCompact_iff.mpr (by + rw [Subtype.image_preimage_coe] + rwa [inter_eq_right.mpr hsub]) + have hT' : IsCompact (φ.symm '' T) := hT.image φ.symm.continuous + have hbd : ∃ ρ : ℝ, 0 < ρ ∧ ρ < 1 ∧ ∀ x ∈ φ.symm '' T, ‖(x : EuclideanPlane)‖ ≤ ρ := by + by_cases hne : (φ.symm '' T).Nonempty + · obtain ⟨x₀, hx₀, hmax⟩ := hT'.exists_isMaxOn hne + (f := fun x : OpenUnitDisc => ‖(x : EuclideanPlane)‖) (by fun_prop) + have hn : ‖(x₀ : EuclideanPlane)‖ < 1 := by + have := x₀.2 + simpa [OpenUnitDisc] using this + refine ⟨(‖(x₀ : EuclideanPlane)‖ + 1) / 2, by positivity, by linarith, fun x hx => ?_⟩ + have := hmax hx + have this' : ‖(x : EuclideanPlane)‖ ≤ ‖(x₀ : EuclideanPlane)‖ := this + linarith + · refine ⟨1 / 2, by norm_num, by norm_num, fun x hx => ?_⟩ + exact absurd ⟨x, hx⟩ hne + obtain ⟨ρ, h0, h1, hρ⟩ := hbd + have hin : ∀ x : ClosedUnitDisc, ρ • (x : EuclideanPlane) ∈ OpenUnitDisc := by + intro x + have hx : ‖(x : EuclideanPlane)‖ ≤ 1 := by + have := x.2 + simpa [ClosedUnitDisc] using this + have : ‖ρ • (x : EuclideanPlane)‖ < 1 := by + rw [norm_smul, Real.norm_of_nonneg h0.le] + nlinarith + simpa [OpenUnitDisc] using this + let m : ClosedUnitDisc → S := fun x => (φ ⟨ρ • x.1, hin x⟩).1 + have hmc : Continuous m := by + refine continuous_subtype_val.comp (φ.continuous.comp ?_) + exact Continuous.subtype_mk (by fun_prop) _ + have hmi : Function.Injective m := by + intro x y hxy + have h₁ := φ.injective (Subtype.ext hxy) + have h₂ : ρ • x.1 = ρ • y.1 := congrArg Subtype.val h₁ + exact Subtype.ext (smul_right_injective _ h0.ne' h₂) + have : CompactSpace ClosedUnitDisc := isCompact_iff_compactSpace.mp (isCompact_closedBall 0 1) + have hemb := hmc.isClosedEmbedding hmi + have hD : IsClosedDisc (range m) := ⟨hemb.isEmbedding.toHomeomorph⟩ + have hJD : J ⊆ range m := by + intro y hy + have hyr := hsub hy + set z := φ.symm ⟨y, hyr⟩ with hz + have hzn : ‖(z : EuclideanPlane)‖ ≤ ρ := hρ z ⟨⟨y, hyr⟩, hy, rfl⟩ + have hmem : ρ⁻¹ • (z : EuclideanPlane) ∈ ClosedUnitDisc := by + have : ‖ρ⁻¹ • (z : EuclideanPlane)‖ ≤ 1 := by + rw [norm_smul, norm_inv, Real.norm_of_nonneg h0.le] + exact (inv_mul_le_iff₀ h0).mpr (by simpa using hzn) + simpa [ClosedUnitDisc] using this + refine ⟨⟨_, hmem⟩, ?_⟩ + have heq : (⟨ρ • (ρ⁻¹ • (z : EuclideanPlane)), hin ⟨_, hmem⟩⟩ : OpenUnitDisc) = z := + Subtype.ext (smul_inv_smul₀ h0.ne' _) + change (φ _).1 = y + rw [heq, hz, φ.apply_symm_apply] + obtain ⟨Δ, ⟨hsubΔ, hd, hb, -⟩, -⟩ := disc_oArc (range m) J hD hJD hJ + refine ⟨Δ, hsubΔ.trans ?_, hd, hb⟩ + rintro _ ⟨x, rfl⟩ + exact (φ _).2 + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/RadialCap.lean b/LeanPool/GraphMinor/GM11/RadialCap.lean new file mode 100644 index 0000000000..c6b2319092 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/RadialCap.lean @@ -0,0 +1,457 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.Surface.Circle + +/-! +# A small cap at a boundary point of a closed disc + +Let `Q` be a closed disc, and let `T` be a short line in `bd(Q)` through a point `x`, with ends +`y₁`, +`y₂`. A straight chord (in a chart of `Q`) from `y₁` to `y₂` cuts from `Q` a small closed disc whose +boundary is `T` together with the chord (`exists_cap`). In the proof that a radial drawing has no +corner between two of its edges, this small disc closes up an `O`-arc through `x`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A connected subset `T` of an `O`-arc with `s, t ∈ T` whose other points lie in one component `A` +of `F - {s, t}` contains all of `A`. -/ +theorem subset_of_component [T2Space S] {F T A₁ A₂ : Set S} (hF : IsOArc F) {s t : S} (hst : s ≠ t) + (hs : s ∈ F) (ht : t ∈ F) (hT : IsPreconnected T) (hTF : T ⊆ F) (hsT : s ∈ T) (htT : t ∈ T) + (hne : A₁ ≠ A₂) (hcomp : componentsIn (F \ {s, t}) = {A₁, A₂}) (hsub : T \ {s, t} ⊆ A₁) : + A₁ ⊆ T := by + classical + obtain ⟨φ⟩ := hF + let ι : Circle → S := fun w => (φ w).1 + have hι : Continuous ι := by fun_prop + have hinj : Function.Injective ι := fun u w h => φ.injective (Subtype.ext h) + have hr : ∀ y ∈ F, ∃ w, ι w = y := fun y hy => ⟨φ.symm ⟨y, hy⟩, by simp [ι]⟩ + obtain ⟨a, rfl⟩ := hr s hs + obtain ⟨b, rfl⟩ := hr t ht + have hab : a ≠ b := fun h => hst (congrArg ι h) + have hA₁ : A₁ ∈ componentsIn (F \ {ι a, ι b}) := by rw [hcomp]; simp + have hA₂ : A₂ ∈ componentsIn (F \ {ι a, ι b}) := by rw [hcomp]; simp + have harc : ∀ c d : Circle, (c = a ∧ d = b ∨ c = b ∧ d = a) → + ι '' circleOpenArc c d ⊆ F \ {ι a, ι b} := by + rintro c d hor _ ⟨w, hw, rfl⟩ + refine ⟨(φ w).2, ?_⟩ + have h₁ : w ∈ ({a, b}ᶜ : Set Circle) := by + rw [compl_pair_eq_union_circleOpenArc hab] + rcases hor with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl hw + · exact Or.inr hw + rintro (h | h) + · exact h₁ (Or.inl (hinj h)) + · exact h₁ (Or.inr (hinj h)) + have hconn : ∀ c d : Circle, IsPreconnected (ι '' circleOpenArc c d) := fun c d => + (isPathConnected_circleOpenArc c d).isConnected.isPreconnected.image _ hι.continuousOn + have hdisj : ∀ y, y ∈ A₁ → y ∉ A₂ := by + intro y hy hy' + obtain ⟨u, -, rfl⟩ := hA₁ + obtain ⟨u', -, rfl⟩ := hA₂ + exact hne (by rw [connectedComponentIn_eq hy, connectedComponentIn_eq hy']) + have hin : ∀ {A X : Set S}, A ∈ componentsIn (F \ {ι a, ι b}) → IsPreconnected X → + X ⊆ F \ {ι a, ι b} → (X ∩ A).Nonempty → X ⊆ A := by + rintro A X ⟨u, -, rfl⟩ hX hXs ⟨y, hyX, hyA⟩ + rw [connectedComponentIn_eq hyA] + exact hX.subset_connectedComponentIn hyX hXs + have hsplit : ∀ u : Circle, ι u ∉ ({ι a, ι b} : Set S) → + u ∈ circleOpenArc a b ∨ u ∈ circleOpenArc b a := by + intro u hu + have : u ∈ ({a, b}ᶜ : Set Circle) := by + rintro (h | h) + · exact hu (Or.inl (congrArg ι h)) + · exact hu (Or.inr (congrArg ι h)) + rwa [compl_pair_eq_union_circleOpenArc hab] at this + by_contra hn + obtain ⟨z, hzA, hzT⟩ := not_subset.mp hn + have hzF : z ∈ F \ {ι a, ι b} := by + obtain ⟨u, hu, rfl⟩ := hA₁ + exact connectedComponentIn_subset _ _ hzA + obtain ⟨w, rfl⟩ := hr z hzF.1 + have key : ∀ c d : Circle, (c = a ∧ d = b ∨ c = b ∧ d = a) → w ∈ circleOpenArc c d → False := by + intro c d hor hw + have hcd : c ≠ d := by + rcases hor with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hab + · exact hab.symm + have hor' : d = a ∧ c = b ∨ d = b ∧ c = a := by tauto + have hsplit' : ∀ u : Circle, ι u ∉ ({ι a, ι b} : Set S) → + u ∈ circleOpenArc c d ∨ u ∈ circleOpenArc d c := by + intro u hu + rcases hor with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hsplit u hu + · exact (hsplit u hu).symm + have hX : ι '' circleOpenArc c d ⊆ A₁ := + hin hA₁ (hconn c d) (harc c d hor) ⟨ι w, ⟨w, hw, rfl⟩, hzA⟩ + have hX' : ι '' circleOpenArc d c ⊆ A₂ := by + obtain ⟨y, hy⟩ : A₂.Nonempty := by + obtain ⟨u, hu, rfl⟩ := hA₂ + exact ⟨u, mem_connectedComponentIn hu⟩ + have hyF : y ∈ F \ {ι a, ι b} := by + obtain ⟨u, hu, rfl⟩ := hA₂ + exact connectedComponentIn_subset _ _ hy + obtain ⟨u, rfl⟩ := hr y hyF.1 + rcases hsplit' u hyF.2 with h | h + · exact (hdisj _ (hX ⟨u, h, rfl⟩) hy).elim + · exact hin hA₂ (hconn d c) (harc d c hor') ⟨ι u, ⟨u, h, rfl⟩, hy⟩ + let C : I → S := fun t => ι (Circle.path c d t) + have hC : Continuous C := hι.comp (Circle.path c d).continuous + have hCi : Function.Injective C := fun _ _ h => Circle.path_injective_of_ne hcd (hinj h) + have hend : ({ι a, ι b} : Set S) ⊆ range C := by + have h0 : C 0 = ι c := by simp [C] + have h1 : C 1 = ι d := by simp [C] + rcases hor with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rintro y (rfl | rfl) + · exact ⟨0, h0⟩ + · exact ⟨1, h1⟩ + · rintro y (rfl | rfl) + · exact ⟨1, h1⟩ + · exact ⟨0, h0⟩ + have hTr : T ⊆ range C := by + intro y hy + by_cases hye : y ∈ ({ι a, ι b} : Set S) + · exact hend hye + · obtain ⟨u, rfl⟩ := hr y (hTF hy) + rcases hsplit' u hye with ⟨t, -, ht⟩ | h + · exact ⟨t, congrArg ι ht⟩ + · exact (hdisj _ (hsub ⟨hy, hye⟩) (hX' ⟨u, h, rfl⟩)).elim + have hemb := (hC.isClosedEmbedding hCi).isInducing + have hpre : IsPreconnected (C ⁻¹' T) := by + refine hemb.isPreconnected_image.mp ?_ + rwa [image_preimage_eq_of_subset hTr] + have hm0 : (0 : I) ∈ C ⁻¹' T := by + have h0 : C 0 = ι c := by simp [C] + change C 0 ∈ T + rw [h0] + rcases hor with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> assumption + have hm1 : (1 : I) ∈ C ⁻¹' T := by + have h1 : C 1 = ι d := by simp [C] + change C 1 ∈ T + rw [h1] + rcases hor with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> assumption + obtain ⟨τ, hτ, rfl⟩ := hw + exact hzT (hpre.Icc_subset hm0 hm1 ⟨unitInterval.nonneg _, unitInterval.le_one _⟩) + rcases hsplit w hzF.2 with h | h + · exact key a b (Or.inl ⟨rfl, rfl⟩) h + · exact key b a (Or.inr ⟨rfl, rfl⟩) h + +private theorem cap_inside_neighborhood [T2Space S] (hS : IsClosedSurface S) + {Q W W' T C : Set S} (hQ : IsClosedDisc Q) + {x y₁ y₂ : S} (hy : y₁ ≠ y₂) (hxT : x ∈ T) (hx₁ : x ≠ y₁) (hx₂ : x ≠ y₂) + (hTline : IsLineWithEnds T y₁ y₂) (hTb : T ⊆ discBd Q) + (hend : y₁ ∈ T ∧ y₂ ∈ T) (hy₁b : y₁ ∈ discBd Q) (hy₂b : y₂ ∈ discBd Q) + (hCline : IsLineWithEnds C y₁ y₂) (hCQ : C ⊆ Q) + (hCin : Disjoint (C \ {y₁, y₂}) (discBd Q)) + (hCinter : C ∩ discBd Q = {y₁, y₂}) + {f : ClosedUnitDisc → S} {N : Set ClosedUnitDisc} + (hf : Continuous f) (hfi : Function.Injective f) (hfmem : ∀ y ∈ Q, ∃ z, f z = y) + (hmem : ∀ z, f z ∈ W' ↔ z ∈ N) (hTW : T ⊆ W') (hNWs : f '' N ⊆ W) + (hCW' : C ⊆ f '' N) (hRconn : IsPreconnected Nᶜ) + {z₀ : ClosedUnitDisc} (hz₀ : z₀ ∉ N) (hz₀b : f z₀ ∈ discBd Q) + (A₁ A₂ Δ₁ Δ₂ : Set S) (hne : A₁ ≠ A₂) + (hcomp : componentsIn (discBd Q \ {y₁, y₂}) = {A₁, A₂}) + (hd₁ : IsClosedDisc Δ₁) + (hcov : Δ₁ ∪ Δ₂ = Q) (hmeet : Δ₁ ∩ Δ₂ = C) + (hb₁ : discBd Δ₁ = A₁ ∪ C) (hb₂ : discBd Δ₂ = A₂ ∪ C) (hxA : x ∈ A₁) : + ∃ C Q₁ : Set S, IsLineWithEnds C y₁ y₂ ∧ C ⊆ W ∧ C ⊆ Q ∧ + Disjoint (C \ {y₁, y₂}) (discBd Q) ∧ IsClosedDisc Q₁ ∧ Q₁ ⊆ W ∧ Q₁ ⊆ Q ∧ + discBd Q₁ = T ∪ C ∧ Q₁ ∩ discBd Q ⊆ T := by + classical + have hA₁m : A₁ ∈ componentsIn (discBd Q \ {y₁, y₂}) := by rw [hcomp]; simp + have hTo : IsPreconnected (T \ {y₁, y₂}) := + (isPathConnected_sdiff_pair hTline).isConnected.isPreconnected + have hTc : IsPreconnected T := by + obtain ⟨g, hg, hr, -⟩ := exists_line_param hTline + rw [← hr] + exact isPreconnected_range hg + have hTsub : T \ {y₁, y₂} ⊆ A₁ := by + obtain ⟨u, -, hu⟩ := hA₁m + rw [← hu] at hxA ⊢ + rw [connectedComponentIn_eq hxA] + exact hTo.subset_connectedComponentIn ⟨hxT, fun h => h.elim hx₁ hx₂⟩ + (fun y hy' => ⟨hTb hy'.1, hy'.2⟩) + have hAT : A₁ ⊆ T := subset_of_component hQ.isOArc_discBd hy hy₁b hy₂b + hTc hTb hend.1 hend.2 hne hcomp hTsub + have hbdΔ : discBd Δ₁ = T ∪ C := by + rw [hb₁] + apply subset_antisymm + · exact union_subset_union_left _ hAT + · refine union_subset (fun y hy' => ?_) subset_union_right + by_cases hye : y ∈ ({y₁, y₂} : Set S) + · have hm : y ∈ C ∩ discBd Q := hCinter.symm ▸ hye + exact Or.inr hm.1 + · exact Or.inl (hTsub ⟨hy', hye⟩) + have hΔQ : Δ₁ ⊆ Q := hcov ▸ subset_union_left + have hz₀T : f z₀ ∉ T := fun h => hz₀ ((hmem z₀).mp (hTW h)) + have hz₀C : f z₀ ∉ C := fun h => by + obtain ⟨z, hz, hze⟩ := hCW' h + exact hz₀ (hfi hze ▸ hz) + have hz₀Δ : f z₀ ∉ Δ₁ := by + intro h + have hz₀A₂ : f z₀ ∈ A₂ := by + have hcc : connectedComponentIn (discBd Q \ {y₁, y₂}) (f z₀) ∈ + componentsIn (discBd Q \ {y₁, y₂}) := + ⟨f z₀, ⟨hz₀b, fun h' => h'.elim (fun e => hz₀T (e ▸ hend.1)) fun e => hz₀T (e ▸ hend.2)⟩, + rfl⟩ + rw [hcomp] at hcc + have hmemc : f z₀ ∈ connectedComponentIn (discBd Q \ {y₁, y₂}) (f z₀) := + mem_connectedComponentIn + ⟨hz₀b, fun h' => h'.elim (fun e => hz₀T (e ▸ hend.1)) fun e => hz₀T (e ▸ hend.2)⟩ + rcases hcc with e | e + · exact (hz₀T (hAT (e ▸ hmemc))).elim + · exact e ▸ hmemc + have : f z₀ ∈ Δ₂ := by + have : f z₀ ∈ discBd Δ₂ := by rw [hb₂]; exact Or.inl hz₀A₂ + exact discBd_subset _ this + exact hz₀C (hmeet ▸ ⟨h, this⟩) + let R : Set ClosedUnitDisc := Nᶜ + have hRS : IsPreconnected (f '' R) := hRconn.image _ hf.continuousOn + have hRdis : Disjoint (f '' R) (frontier Δ₁) := by + rw [IsClosedDisc.frontier_eq_discBd hS hd₁, hbdΔ] + refine disjoint_left.mpr ?_ + rintro _ ⟨z, hz, rfl⟩ (h | h) + · exact hz ((hmem z).mp (hTW h)) + · obtain ⟨z', hz', hze⟩ := hCW' h + exact hz (hfi hze ▸ hz') + have hsep : Disjoint (f '' R) Δ₁ := by + rcases subset_or_disjoint_of_frontier hd₁.isClosed hRS hRdis with h | h + · exact (hz₀Δ (h ⟨z₀, hz₀, rfl⟩)).elim + · exact h + have hΔN : Δ₁ ⊆ f '' N := by + intro y hy' + obtain ⟨z, rfl⟩ := hfmem y (hΔQ hy') + by_cases hz : z ∈ N + · exact ⟨z, hz, rfl⟩ + · exact (disjoint_left.mp hsep ⟨z, hz, rfl⟩ hy').elim + refine ⟨C, Δ₁, hCline, hCW'.trans hNWs, hCQ, hCin, hd₁, hΔN.trans hNWs, hΔQ, hbdΔ, ?_⟩ + rintro y ⟨hyΔ, hyb⟩ + by_cases hye : y ∈ ({y₁, y₂} : Set S) + · rcases hye with rfl | rfl + · exact hend.1 + · exact hend.2 + · have hcc : connectedComponentIn (discBd Q \ {y₁, y₂}) y ∈ + componentsIn (discBd Q \ {y₁, y₂}) := ⟨y, ⟨hyb, hye⟩, rfl⟩ + rw [hcomp] at hcc + have hmemc : y ∈ connectedComponentIn (discBd Q \ {y₁, y₂}) y := + mem_connectedComponentIn ⟨hyb, hye⟩ + rcases hcc with e | e + · exact hAT (e ▸ hmemc) + · have hy₂ : y ∈ Δ₂ := discBd_subset _ (by rw [hb₂]; exact Or.inl (e ▸ hmemc)) + exact (hye (hCinter ▸ ⟨hmeet ▸ ⟨hyΔ, hy₂⟩, hyb⟩)).elim + +/-- **A cap at a boundary point.** See the module docstring. -/ +theorem exists_cap (hS : IsClosedSurface S) {Q : Set S} (hQ : IsClosedDisc Q) {x : S} + (hx : x ∈ discBd Q) {W : Set S} (hW : IsOpen W) (hxW : x ∈ W) : + ∃ W', IsOpen W' ∧ x ∈ W' ∧ ∀ (y₁ y₂ : S) (T : Set S), y₁ ≠ y₂ → IsLineWithEnds T y₁ y₂ → + T ⊆ discBd Q → T ⊆ W' → x ∈ T → x ≠ y₁ → x ≠ y₂ → + ∃ C Q₁ : Set S, IsLineWithEnds C y₁ y₂ ∧ C ⊆ W ∧ C ⊆ Q ∧ Disjoint (C \ {y₁, y₂}) (discBd Q) ∧ + IsClosedDisc Q₁ ∧ Q₁ ⊆ W ∧ Q₁ ⊆ Q ∧ discBd Q₁ = T ∪ C ∧ Q₁ ∩ discBd Q ⊆ T := by + classical + have : T2Space S := hS.2.1 + obtain ⟨φ⟩ := id hQ + have hbd := disc_boundary Q φ + rw [hbd] at hx + obtain ⟨b, hb, rfl⟩ := hx + have hbn : ‖(b : EuclideanPlane)‖ = 1 := by simpa [UnitCircle] using hb + let f : ClosedUnitDisc → S := fun z => (φ z).1 + have hf : Continuous f := continuous_subtype_val.comp φ.continuous + have hfi : Function.Injective f := fun _ _ h => φ.injective (Subtype.ext h) + have hfmem : ∀ y ∈ Q, ∃ z, f z = y := fun y hy => ⟨φ.symm ⟨y, hy⟩, by simp [f]⟩ + have hopen : IsOpen {z : ClosedUnitDisc | f z ∈ W} := hW.preimage hf + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp hopen b hxW + let inner' : EuclideanPlane → ℝ := fun z => inner ℝ z (b : EuclideanPlane) + have hinner : Continuous inner' := by fun_prop + let η : ℝ := min (δ ^ 2 / 2) 1 + have hη : 0 < η := lt_min (by positivity) one_pos + have hηle : η ≤ 1 := min_le_right _ _ + let N : Set ClosedUnitDisc := {z | 1 - η < inner' z} + have hNo : IsOpen N := isOpen_lt continuous_const (hinner.comp continuous_subtype_val) + have hNW : N ⊆ {z | f z ∈ W} := by + intro z hz + refine hball ?_ + have hzn : ‖(z : EuclideanPlane)‖ ≤ 1 := by + have := z.2 + simpa [ClosedUnitDisc] using this + have hz' : 1 - η < inner ℝ (z : EuclideanPlane) b := hz + have h₁ : ‖(z : EuclideanPlane) - b‖ ^ 2 < δ ^ 2 := by + rw [@norm_sub_sq_real, hbn] + have : η ≤ δ ^ 2 / 2 := min_le_left _ _ + nlinarith [norm_nonneg (z : EuclideanPlane)] + have h₂ : ‖(z : EuclideanPlane) - b‖ < δ := lt_of_pow_lt_pow_left₀ 2 hδ.le h₁ + rw [Metric.mem_ball, Subtype.dist_eq, dist_eq_norm] + exact h₂ + have hfopen : IsOpen ((fun y : Q => φ.symm y) ⁻¹' N) := hNo.preimage φ.symm.continuous + obtain ⟨W', hW', hWeq⟩ := isOpen_induced_iff.mp hfopen + have hmem : ∀ z : ClosedUnitDisc, f z ∈ W' ↔ z ∈ N := by + intro z + have := congrArg (fun T : Set Q => φ z ∈ T) hWeq + simpa [f] using this + have hbN : b ∈ N := by + change 1 - η < inner ℝ (b : EuclideanPlane) b + rw [real_inner_self_eq_norm_sq, hbn] + linarith + refine ⟨W', hW', (hmem b).mpr hbN, ?_⟩ + intro y₁ y₂ T hy hTline hTb hTW hxT hx₁ hx₂ + have hsubQ : discBd Q ⊆ Q := discBd_subset Q + have hend : y₁ ∈ T ∧ y₂ ∈ T := by + obtain ⟨g, h0, h1⟩ := hTline + exact ⟨h0 ▸ (g 0).2, h1 ▸ (g 1).2⟩ + have hy₁b : y₁ ∈ discBd Q := hTb hend.1 + have hy₂b : y₂ ∈ discBd Q := hTb hend.2 + have hcirc : ∀ y ∈ discBd Q, ∃ z : ClosedUnitDisc, f z = y ∧ ‖(z : EuclideanPlane)‖ = 1 := by + intro y hy' + rw [hbd] at hy' + obtain ⟨z, hz, rfl⟩ := hy' + exact ⟨z, rfl, by simpa [UnitCircle] using hz⟩ + obtain ⟨z₁, rfl, hz₁⟩ := hcirc y₁ hy₁b + obtain ⟨z₂, rfl, hz₂⟩ := hcirc y₂ hy₂b + have hzne : (z₁ : EuclideanPlane) ≠ z₂ := fun h => hy (congrArg f (Subtype.ext h)) + have hdn : ∀ z : EuclideanPlane, z ∈ ClosedUnitDisc ↔ ‖z‖ ≤ 1 := fun z => by simp [ClosedUnitDisc] + have hseg : ∀ t : I, (1 - (t : ℝ)) • (z₁ : EuclideanPlane) + (t : ℝ) • (z₂ : EuclideanPlane) ∈ + ClosedUnitDisc := by + intro t + exact (convex_closedBall (0 : EuclideanPlane) 1) z₁.2 z₂.2 (by linarith [t.2.2]) t.2.1 (by ring) + let m : I → ClosedUnitDisc := fun t => ⟨_, hseg t⟩ + have hm : Continuous m := Continuous.subtype_mk (by fun_prop) _ + have hmi : Function.Injective m := by + intro s t h + have h' := congrArg Subtype.val h + have h₂ : ((s : ℝ) - t) • ((z₂ : EuclideanPlane) - z₁) = 0 := by + have h₃ : (1 - (s : ℝ)) • (z₁ : EuclideanPlane) + (s : ℝ) • (z₂ : EuclideanPlane) = + (1 - (t : ℝ)) • (z₁ : EuclideanPlane) + (t : ℝ) • (z₂ : EuclideanPlane) := h' + have h₄ : ((s : ℝ) - t) • ((z₂ : EuclideanPlane) - z₁) = + ((1 - (s : ℝ)) • (z₁ : EuclideanPlane) + (s : ℝ) • (z₂ : EuclideanPlane)) - + ((1 - (t : ℝ)) • (z₁ : EuclideanPlane) + (t : ℝ) • (z₂ : EuclideanPlane)) := by + module + rw [h₄, h₃, sub_self] + have h₅ := (smul_eq_zero.mp h₂).resolve_right (sub_ne_zero.mpr hzne.symm) + exact Subtype.ext (by linarith) + have hm0 : m 0 = z₁ := Subtype.ext (by simp [m]) + have hm1 : m 1 = z₂ := Subtype.ext (by simp [m]) + let C : Set S := range (f ∘ m) + have hCc : Continuous (f ∘ m) := hf.comp hm + have hCline : IsLineWithEnds C (f z₁) (f z₂) := by + have := isLine_range hCc (hfi.comp hmi) + simpa [hm0, hm1] using this + have hN₁ : z₁ ∈ N := (hmem z₁).mp (hTW hend.1) + have hN₂ : z₂ ∈ N := (hmem z₂).mp (hTW hend.2) + have hmN : ∀ t, m t ∈ N := by + intro t + have hlin : inner' (m t : EuclideanPlane) = + (1 - (t : ℝ)) * inner' z₁ + (t : ℝ) * inner' z₂ := by + simp only [inner', m, inner_add_left, real_inner_smul_left] + change 1 - η < inner' (m t : EuclideanPlane) + rw [hlin] + have h₁ : 1 - η < inner' z₁ := hN₁ + have h₂ : 1 - η < inner' z₂ := hN₂ + have ht0 := t.2.1 + have ht1 := t.2.2 + have hl : 1 - η < min (inner' z₁) (inner' z₂) := lt_min h₁ h₂ + have h₃ := min_le_left (inner' z₁) (inner' z₂) + have h₄ := min_le_right (inner' z₁) (inner' z₂) + nlinarith [mul_nonneg (sub_nonneg.mpr ht1) (sub_nonneg.mpr h₃), mul_nonneg ht0 + (sub_nonneg.mpr h₄)] + have hCW' : C ⊆ f '' N := by + rintro _ ⟨t, rfl⟩ + exact ⟨m t, hmN t, rfl⟩ + have hNWs : f '' N ⊆ W := by + rintro _ ⟨z, hz, rfl⟩ + exact hNW hz + have hCQ : C ⊆ Q := by + rintro _ ⟨t, rfl⟩ + exact (φ _).2 + have hCin : Disjoint (C \ {f z₁, f z₂}) (discBd Q) := by + refine disjoint_left.mpr ?_ + rintro _ ⟨⟨t, rfl⟩, hne⟩ hb' + obtain ⟨z, hze, hzn⟩ := hcirc _ hb' + have hzm : z = m t := hfi hze + have ht0 : t ≠ 0 := fun h => hne (Or.inl (by simp [h, hm0])) + have ht1 : t ≠ 1 := fun h => hne (Or.inr (by simp [h, hm1])) + have ht0' : (0 : ℝ) < t := lt_of_le_of_ne t.2.1 fun h => ht0 (Subtype.ext h.symm) + have ht1' : (t : ℝ) < 1 := lt_of_le_of_ne t.2.2 fun h => ht1 (Subtype.ext h) + have hin : inner ℝ (z₁ : EuclideanPlane) (z₂ : EuclideanPlane) < 1 := by + have hpos : 0 < ‖(z₁ : EuclideanPlane) - z₂‖ := norm_pos_iff.mpr (sub_ne_zero.mpr hzne) + have := norm_sub_sq_real (z₁ : EuclideanPlane) (z₂ : EuclideanPlane) + rw [hz₁, hz₂] at this + nlinarith + have h₁ : ‖(1 - (t : ℝ)) • (z₁ : EuclideanPlane) + (t : ℝ) • (z₂ : EuclideanPlane)‖ ^ 2 < 1 + := by + rw [@norm_add_sq_real, norm_smul, norm_smul, real_inner_smul_left, real_inner_smul_right, + hz₁, hz₂, Real.norm_of_nonneg (show 0 ≤ 1 - (t : ℝ) by linarith), + Real.norm_of_nonneg (show 0 ≤ (t : ℝ) by linarith)] + nlinarith [mul_pos ht0' (show 0 < 1 - (t : ℝ) by linarith)] + have h₂ : ‖(1 - (t : ℝ)) • (z₁ : EuclideanPlane) + (t : ℝ) • (z₂ : EuclideanPlane)‖ < 1 := by + nlinarith [norm_nonneg ((1 - (t : ℝ)) • (z₁ : EuclideanPlane) + (t : ℝ) • + (z₂ : EuclideanPlane))] + have : ‖(z : EuclideanPlane)‖ < 1 := by rw [hzm]; exact h₂ + linarith + have hCinter : C ∩ discBd Q = {f z₁, f z₂} := by + apply subset_antisymm + · rintro y ⟨hyC, hyb⟩ + by_contra hn + exact disjoint_left.mp hCin ⟨hyC, hn⟩ hyb + · rintro y (rfl | rfl) + · exact ⟨⟨0, by simp [hm0]⟩, hy₁b⟩ + · exact ⟨⟨1, by simp [hm1]⟩, hy₂b⟩ + obtain ⟨A₁, A₂, Δ₁, Δ₂, hne, hcomp, hd₁, hd₂, hcov, hmeet, hb₁, hb₂, -⟩ := + disc_iArc Q C (f z₁) (f z₂) hQ hCQ hy hCline hCinter + -- The point opposite to `x`. + have hmb : (-(b : EuclideanPlane)) ∈ ClosedUnitDisc := by + rw [hdn, norm_neg, hbn] + let z₀ : ClosedUnitDisc := ⟨_, hmb⟩ + have hz₀ : z₀ ∉ N := by + change ¬ 1 - η < inner ℝ (-(b : EuclideanPlane)) b + rw [inner_neg_left, real_inner_self_eq_norm_sq, hbn] + linarith + have hz₀b : f z₀ ∈ discBd Q := by + rw [hbd] + exact ⟨z₀, by simpa [UnitCircle, z₀] using hbn, rfl⟩ + let R : Set ClosedUnitDisc := Nᶜ + have hRconn : IsPreconnected R := by + have hlin : IsLinearMap ℝ inner' := + ⟨fun x y => inner_add_left _ _ _, fun c x => real_inner_smul_left _ _ _⟩ + have hconv : Convex ℝ (ClosedUnitDisc ∩ {z : EuclideanPlane | inner' z ≤ 1 - η}) := + (convex_closedBall (0 : EuclideanPlane) 1).inter (convex_halfSpace_le hlin _) + refine (IsInducing.subtypeVal : + IsInducing (Subtype.val : ClosedUnitDisc → EuclideanPlane)).isPreconnected_image.mp ?_ + have : Subtype.val '' R = ClosedUnitDisc ∩ {z : EuclideanPlane | inner' z ≤ 1 - η} := by + ext z + constructor + · rintro ⟨y, hy', rfl⟩ + exact ⟨y.2, not_lt.mp (show ¬ 1 - η < inner' y from hy')⟩ + · rintro ⟨h₁, h₂⟩ + exact ⟨⟨z, h₁⟩, show ¬ 1 - η < inner' z from not_lt.mpr h₂, rfl⟩ + rw [this] + exact hconv.isPreconnected + have main := cap_inside_neighborhood hS hQ hy hxT hx₁ hx₂ hTline hTb hend hy₁b hy₂b + hCline hCQ hCin hCinter hf hfi hfmem hmem hTW hNWs hCW' hRconn hz₀ hz₀b + have hxnot : f b ∉ ({f z₁, f z₂} : Set S) := fun h => h.elim hx₁ hx₂ + have hcc : connectedComponentIn (discBd Q \ {f z₁, f z₂}) (f b) ∈ + componentsIn (discBd Q \ {f z₁, f z₂}) := ⟨f b, ⟨hTb hxT, hxnot⟩, rfl⟩ + have hmemc : f b ∈ connectedComponentIn (discBd Q \ {f z₁, f z₂}) (f b) := + mem_connectedComponentIn ⟨hTb hxT, hxnot⟩ + rw [hcomp] at hcc + rcases hcc with e | e + · exact main A₁ A₂ Δ₁ Δ₂ hne hcomp hd₁ hcov hmeet hb₁ hb₂ (e ▸ hmemc) + · exact main A₂ A₁ Δ₂ Δ₁ hne.symm (by rw [hcomp, pair_comm]) hd₂ (by rw [union_comm, hcov]) + (by rw [inter_comm, hmeet]) hb₂ hb₁ (e ▸ hmemc) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/RadialChord.lean b/LeanPool/GraphMinor/GM11/RadialChord.lean new file mode 100644 index 0000000000..877b043172 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/RadialChord.lean @@ -0,0 +1,339 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialAccess +public import LeanPool.GraphMinor.Surface.ArcInPath + +/-! +# Chords of a region of a radial drawing + +A line `K` from a vertex `c = v_r` of a radial drawing `Γ'` to a vertex `x` of `Γ`, inside the +region +`r` of `Γ` and off `Γ'`, cannot be added to `Γ'`, because `Γ'` is maximal. Conditions (i)-(iii) hold +for `Γ' + K`, so condition (iv) fails. So `K` and an edge of `Γ'` bound a closed disc in `r ∪ {x}` +(`exists_parallel_spoke`). This is the only place where maximality is used. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The range of an injective path in a Hausdorff space is a line. -/ +theorem isLine_range [T2Space S] {g : I → S} (hg : Continuous g) (hi : Function.Injective g) : + IsLineWithEnds (range g) (g 0) (g 1) := by + have hemb := hg.isClosedEmbedding hi + let f : I ≃ₜ range g := hemb.isEmbedding.toHomeomorph + exact ⟨f, rfl, rfl⟩ + +/-- A line through a path-connected set `p`, from `x` to `c`, that starts along `g₁`. -/ +theorem exists_chord [T2Space S] {p : Set S} (hp : IsPathConnected p) {x c : S} (hxc : x ≠ c) + (hxp : x ∉ p) {g₁ g₂ : I → S} (hg₁ : Continuous g₁) (hg₂ : Continuous g₂) + (h₁0 : g₁ 0 = x) (h₂0 : g₂ 0 = c) (h₁ : ∀ t, 0 < t → g₁ t ∈ p) (h₂ : ∀ t, 0 < t → g₂ t ∈ p) : + ∃ e : I → S, Continuous e ∧ Function.Injective e ∧ e 0 = x ∧ e 1 = c ∧ + (∀ t, t ≠ 0 → t ≠ 1 → e t ∈ p) ∧ + ∃ O, IsOpen O ∧ x ∈ O ∧ ∀ t, e t ∈ O → e t ∈ range g₁ := by + have h₁1 : g₁ 1 ∈ p := h₁ 1 one_pos + have h₂1 : g₂ 1 ∈ p := h₂ 1 one_pos + let a : Path x (g₁ 1) := ⟨⟨g₁, hg₁⟩, h₁0, rfl⟩ + let b : Path c (g₂ 1) := ⟨⟨g₂, hg₂⟩, h₂0, rfl⟩ + obtain ⟨m, hm⟩ := hp.joinedIn _ h₁1 _ h₂1 + let ℓ : Path x c := (a.trans m).trans b.symm + have hr : range ℓ = range g₁ ∪ range m ∪ range g₂ := by + simp only [ℓ, Path.trans_range, Path.symm_range] + rfl + obtain ⟨e, he, hi, he0, he1, hsub⟩ := exists_arc_of_path (γ := ℓ) ℓ.continuous + (by simpa using hxc) + have he0' : e 0 = x := by simpa using he0 + have he1' : e 1 = c := by simpa using he1 + have hsub' : ∀ t, e t ∈ range g₁ ∪ range m ∪ range g₂ := fun t => hr ▸ hsub ⟨t, rfl⟩ + have hgood : ∀ {g : I → S} {z : S}, (g 0 = z) → (∀ t, 0 < t → g t ∈ p) → ∀ y ∈ range g, y ≠ z → + y ∈ p := by + rintro g z h0 h _ ⟨t, rfl⟩ hy + by_cases ht : t = 0 + · exact absurd (ht ▸ h0) hy + · exact h t (unitInterval.pos_iff_ne_zero.mpr ht) + refine ⟨e, he, hi, he0', he1', ?_, ?_⟩ + · intro t ht0 ht1 + have hne0 : e t ≠ x := fun h => ht0 (hi (h.trans he0'.symm)) + have hne1 : e t ≠ c := fun h => ht1 (hi (h.trans he1'.symm)) + rcases hsub' t with (h' | h') | h' + · exact hgood h₁0 h₁ _ h' hne0 + · obtain ⟨s, hs⟩ := h' + exact hs ▸ hm s + · exact hgood h₂0 h₂ _ h' hne1 + · let B : Set S := range m ∪ range g₂ + have hB : IsClosed B := ((isCompact_range m.continuous).union (isCompact_range hg₂)).isClosed + refine ⟨Bᶜ, hB.isOpen_compl, ?_, fun t ht => ?_⟩ + · rintro (⟨s, hs⟩ | ⟨s, hs⟩) + · exact hxp (hs ▸ hm s) + · by_cases h0 : s = 0 + · exact hxc ((h0 ▸ hs).symm.trans h₂0) + · exact hxp (hs ▸ h₂ s (unitInterval.pos_iff_ne_zero.mpr h0)) + · rcases hsub' t with (h' | h') | h' + · exact h' + · exact absurd (Or.inl h') ht + · exact absurd (Or.inr h') ht + +/-- A line from `x` to a point `c` of a path-connected set `p`, inside `p` after time `0`. -/ +theorem exists_chord_to_point [T2Space S] {p : Set S} (hp : IsPathConnected p) {x c : S} + (hxp : x ∉ p) (hcp : c ∈ p) {g₁ : I → S} (hg₁ : Continuous g₁) (h₁0 : g₁ 0 = x) + (h₁ : ∀ t, 0 < t → g₁ t ∈ p) : + ∃ e : I → S, Continuous e ∧ Function.Injective e ∧ e 0 = x ∧ e 1 = c ∧ (∀ t, t ≠ 0 → e t ∈ p) ∧ + ∃ O, IsOpen O ∧ x ∈ O ∧ ∀ t, e t ∈ O → e t ∈ range g₁ := by + have h₁1 : g₁ 1 ∈ p := h₁ 1 one_pos + have hxc : x ≠ c := fun h => hxp (h ▸ hcp) + let a : Path x (g₁ 1) := ⟨⟨g₁, hg₁⟩, h₁0, rfl⟩ + obtain ⟨m, hm⟩ := hp.joinedIn _ h₁1 _ hcp + let ℓ : Path x c := a.trans m + have hr : range ℓ = range g₁ ∪ range m := by + simp only [ℓ, Path.trans_range] + rfl + obtain ⟨e, he, hi, he0, he1, hsub⟩ := exists_arc_of_path (γ := ℓ) ℓ.continuous + (by simpa using hxc) + have he0' : e 0 = x := by simpa using he0 + have he1' : e 1 = c := by simpa using he1 + have hsub' : ∀ t, e t ∈ range g₁ ∪ range m := fun t => hr ▸ hsub ⟨t, rfl⟩ + refine ⟨e, he, hi, he0', he1', fun t ht => ?_, (range m)ᶜ, + (isCompact_range m.continuous).isClosed.isOpen_compl, ?_, fun t ht => ?_⟩ + · have hne0 : e t ≠ x := fun h => ht (hi (h.trans he0'.symm)) + rcases hsub' t with ⟨s, hs⟩ | ⟨s, hs⟩ + · by_cases h0 : s = 0 + · exact absurd (hs.symm.trans (h0 ▸ h₁0)) hne0 + · exact hs ▸ h₁ s (unitInterval.pos_iff_ne_zero.mpr h0) + · exact hs ▸ hm s + · rintro ⟨s, hs⟩ + exact hxp (hs ▸ hm s) + · exact (hsub' t).resolve_right ht + +section LineDrawing + +variable [T2Space S] {K : Set S} {c x : S} + +omit [T2Space S] in +theorem exists_line_param (hK : IsLineWithEnds K c x) : + ∃ g : I → S, Continuous g ∧ range g = K ∧ K \ {c, x} = g '' Ioo (0 : I) 1 := by + obtain ⟨f, h0, h1⟩ := hK + refine ⟨fun t => (f t).1, by fun_prop, ?_, ?_⟩ + · ext y + exact ⟨by rintro ⟨t, rfl⟩; exact (f t).2, fun hy => ⟨f.symm ⟨y, hy⟩, by simp⟩⟩ + ext y + constructor + · rintro ⟨hy, hn⟩ + refine ⟨f.symm ⟨y, hy⟩, ⟨?_, ?_⟩, by simp⟩ + · refine unitInterval.pos_iff_ne_zero.mpr fun h => hn (Or.inl ?_) + have := congrArg f h + simp only [Homeomorph.apply_symm_apply] at this + exact (congrArg Subtype.val this).trans h0 + · refine lt_of_le_of_ne (unitInterval.le_one _) fun h => hn (Or.inr ?_) + have := congrArg f h + simp only [Homeomorph.apply_symm_apply] at this + exact (congrArg Subtype.val this).trans h1 + · rintro ⟨t, ⟨ht0, ht1⟩, rfl⟩ + refine ⟨(f t).2, ?_⟩ + rintro (h | h) + · exact ht0.ne' (f.injective (Subtype.ext (h.trans h0.symm))) + · exact ht1.ne (f.injective (Subtype.ext (h.trans h1.symm))) + +omit [T2Space S] in +theorem isPathConnected_sdiff_pair (hK : IsLineWithEnds K c x) : IsPathConnected (K \ {c, x}) := + hK.isPathConnected_interior + +theorem closure_sdiff_pair (hK : IsLineWithEnds K c x) : closure (K \ {c, x}) = K := by + obtain ⟨g, hg, hr, _⟩ := exists_line_param hK + have hKc : IsClosed K := hr ▸ (isCompact_range hg).isClosed + exact Subset.antisymm (closure_minimal sdiff_subset hKc) hK.subset_closure_interior + +/-- A line, as a drawing with one edge. -/ +noncomputable def lineDrawing (hK : IsLineWithEnds K c x) (hcx : c ≠ x) : Drawing S where + U := K + V := {c, x} + V_subset_U := by + obtain ⟨f, h0, h1⟩ := hK + rintro y (rfl | rfl) + · exact h0 ▸ (f 0).2 + · exact h1 ▸ (f 1).2 + isClosed_U := by + rw [← closure_sdiff_pair hK] + exact isClosed_closure + finite_V := by simp + finite_edges := by + refine (finite_singleton (K \ {c, x})).subset ?_ + rintro C ⟨-, hsub, -, hmax⟩ + exact (hmax _ Subset.rfl (isPathConnected_sdiff_pair hK) hsub).symm ▸ rfl + edge_cond := by + rintro C ⟨-, hsub, -, hmax⟩ + have hC : C = K \ {c, x} := (hmax _ Subset.rfl (isPathConnected_sdiff_pair hK) hsub).symm + subst hC + rw [closure_sdiff_pair hK] + refine Or.inl ⟨c, x, hcx, ?_, hK⟩ + apply inter_eq_right.mpr + obtain ⟨f, h0, h1⟩ := hK + rintro y (rfl | rfl) + · exact h0 ▸ (f 0).2 + · exact h1 ▸ (f 1).2 + +theorem lineDrawing_E (hK : IsLineWithEnds K c x) (hcx : c ≠ x) : + (lineDrawing hK hcx).E = {K \ {c, x}} := by + apply subset_antisymm + · rintro C ⟨-, hsub, -, hmax⟩ + exact (hmax _ Subset.rfl (isPathConnected_sdiff_pair hK) hsub).symm + · rintro _ rfl + refine ⟨(isPathConnected_sdiff_pair hK).nonempty, Subset.rfl, + isPathConnected_sdiff_pair hK, fun D hD _ hsub => subset_antisymm hD hsub⟩ + +end LineDrawing + +variable [T2Space S] {K : Set S} {c x : S} + +/-- `Γ` is 2-cell and `Γ'` satisfies conditions (i)–(iv) of a radial drawing of it. -/ +def PreRad (Γ : PaintingOrDrawing S) (Γ' : Drawing S) : Prop := + Γ.IsTwoCell ∧ Γ.IsPreRadialDrawing Γ' + +/-- Condition (v) of a radial drawing: `Γ'` is maximal subject to (i)–(iv). -/ +def RadMax (Γ : PaintingOrDrawing S) (Γ' : Drawing S) : Prop := + ∀ Γ'' : Drawing S, Γ.IsPreRadialDrawing Γ'' → Γ'.IsSubdrawing Γ'' → Γ''.IsSubdrawing Γ' + +/-- A proposed spoke that avoids a drawing in its interior meets its vertices at its ends. -/ +theorem line_inter_spoke_vertices + {G : Drawing S} {K : Set S} {c x : S} (hc : c ∈ G.V) (hxV : x ∈ G.V) + (hK : IsLineWithEnds K c x) (hcx : c ≠ x) (hKU : Disjoint (K \ {c, x}) G.U) : + K ∩ G.V = {x, c} := by + apply subset_antisymm + · rintro y ⟨hyK, hyV⟩ + by_contra hn + have hn' : y ∉ ({c, x} : Set S) := fun h ↦ hn (by rw [pair_comm]; exact h) + exact disjoint_left.mp hKU ⟨hyK, hn'⟩ (G.V_subset_U hyV) + · have hend : ({c, x} : Set S) ⊆ K := (lineDrawing hK hcx).V_subset_U + rintro y (rfl | rfl) + · exact ⟨hend (Or.inr rfl), hxV⟩ + · exact ⟨hend (Or.inl rfl), hc⟩ + +/-- Glue a line to a pre-radial drawing when the new edge bounds no disc with an old edge +with the same ends. -/ +theorem exists_glue_spoke_of_no_bounded_disc + {U V : Set S} {R : Set (Set S)} {G : Drawing S} (hpre : IsPreRadialOn U V R G) + {r : Set S} {c x : S} (hcr : c ∈ r) (hc : c ∈ G.V) (hx : x ∈ V) + {K : Set S} (hK : IsLineWithEnds K c x) (hcx : c ≠ x) (hKr : K \ {c, x} ⊆ r) + (hKU : Disjoint (K \ {c, x}) G.U) (hrU : Disjoint r U) (hVU : V ⊆ U) + (hiv : ∀ f ∈ G.E, K \ {c, x} ≠ f → ∀ v ∈ V, ∀ r' ∈ R, ∀ w ∈ r' ∩ G.V, + K ∩ G.V = {v, w} → closure f ∩ G.V = {v, w} → + ¬ ∃ Δ : Set S, IsClosedDisc Δ ∧ Δ ⊆ r' ∪ {v} ∧ subBd Δ = K ∪ closure f) : + ∃ G₂ : Drawing S, IsPreRadialOn U V R G₂ ∧ G₂.V = G.V ∧ + G₂.E = G.E ∪ {K \ {c, x}} ∧ G₂.U = G.U ∪ K := by + classical + obtain ⟨h₁, h₂, h₃, h₄, h₅, h₆⟩ := hpre + have hxV : x ∈ G.V := h₂ hx + have hVsub : (lineDrawing hK hcx).V ⊆ G.V := by + rintro y (rfl | rfl) + · exact hc + · exact hxV + have hmeet : G.U ∩ (lineDrawing hK hcx).U ⊆ G.V ∩ (lineDrawing hK hcx).V := by + rintro y ⟨hy, hyK⟩ + have : y ∈ ({c, x} : Set S) := by + by_contra hn + exact disjoint_left.mp hKU ⟨hyK, hn⟩ hy + exact ⟨hVsub this, this⟩ + let G₂ : Drawing S := G.glue (lineDrawing hK hcx) hmeet + have hGV : G₂.V = G.V := union_eq_left.mpr hVsub + have hGE : G₂.E = G.E ∪ {K \ {c, x}} := by + change (G.glue (lineDrawing hK hcx) hmeet).E = _ + rw [Drawing.glue_E, lineDrawing_E] + have hKcl : closure (K \ {c, x}) = K := closure_sdiff_pair hK + have hKV := line_inter_spoke_vertices hc hxV hK hcx hKU + have hcnV : c ∉ V := fun h ↦ disjoint_left.mp hrU hcr (hVU h) + have hiv₂ : ∀ e ∈ G₂.E, ∀ f ∈ G₂.E, e ≠ f → ∀ v ∈ V, ∀ r' ∈ R, ∀ w ∈ r' ∩ G₂.V, + closure e ∩ G₂.V = {v, w} → closure f ∩ G₂.V = {v, w} → + ¬ ∃ Δ : Set S, IsClosedDisc Δ ∧ Δ ⊆ r' ∪ {v} ∧ subBd Δ = closure e ∪ closure f := by + rw [hGE, hGV] + rintro e (he | rfl) f (hf | rfl) hef v hv r' hr' w hw hee hfe hΔ + · exact h₆ e he f hf hef v hv r' hr' w hw hee hfe hΔ + · rw [hKcl] at hfe hΔ + obtain ⟨Δ, h₁, h₂, h₃⟩ := hΔ + exact hiv e he hef.symm v hv r' hr' w hw hfe hee ⟨Δ, h₁, h₂, by rw [h₃, Set.union_comm]⟩ + · rw [hKcl] at hee hΔ + exact hiv f hf hef v hv r' hr' w hw hee hfe hΔ + · exact hef rfl + have hpre' : IsPreRadialOn U V R G₂ := by + refine ⟨?_, ?_, ?_, ?_, ?_, hiv₂⟩ + · apply subset_antisymm + · rintro y ⟨hyU, hyG | hyK⟩ + · rw [← h₁] + exact ⟨hyU, hyG⟩ + · by_cases hym : y ∈ ({c, x} : Set S) + · rcases hym with rfl | rfl + · exact (disjoint_left.mp hrU hcr hyU).elim + · exact hx + · exact (disjoint_left.mp hrU (hKr ⟨hyK, hym⟩) hyU).elim + · intro y hy + rw [← h₁] at hy + exact ⟨hy.1, Or.inl hy.2⟩ + · rw [hGV] + exact h₂ + · rw [hGV] + exact h₃ + · rw [hGV] + exact h₄ + · intro e he + rw [hGE] at he + rw [hGV] + rcases he with he | rfl + · exact h₅ e he + · exact ⟨x, hx, c, ⟨hc, hcnV⟩, by rw [hKcl]; exact hKV⟩ + exact ⟨G₂, hpre', hGV, hGE, rfl⟩ + +/-- **A chord has a parallel spoke.** Graph Minors XI, Section 3, uses the maximality in condition +(v) of a radial drawing in this form, without stating it. -/ +theorem exists_parallel_spoke {Γ : PaintingOrDrawing S} {Γ' : Drawing S} + (hpre : Γ.IsPreRadialDrawing Γ') (hmax : RadMax Γ Γ') + {r : Set S} (hr : r ∈ Γ.R) (hcr : c ∈ r) (hc : c ∈ Γ'.V) (hx : x ∈ Γ.V) + (hK : IsLineWithEnds K c x) (hcx : c ≠ x) (hKr : K \ {c, x} ⊆ r) + (hKU : Disjoint (K \ {c, x}) Γ'.U) (hrU : Disjoint r Γ.U) + (hrr : ∀ {r₁ r₂ : Set S}, r₁ ∈ Γ.R → r₂ ∈ Γ.R → ∀ {y : S}, y ∈ r₁ → y ∈ r₂ → r₁ = r₂) : + ∃ h ∈ Γ'.E, closure h ∩ Γ'.V = {x, c} ∧ ∃ Δ : Set S, IsClosedDisc Δ ∧ Δ ⊆ r ∪ {x} ∧ + subBd Δ = closure h ∪ K := by + have hVU : Γ.V ⊆ Γ.U := by + rw [← hpre.1] + exact inter_subset_left + have hcnV : c ∉ Γ.V := fun h => disjoint_left.mp hrU hcr (hVU h) + have hKV := line_inter_spoke_vertices hc (hpre.2.1 hx) hK hcx hKU + by_contra hno + have key : ∀ f ∈ Γ'.E, K \ {c, x} ≠ f → ∀ v ∈ Γ.V, ∀ r' ∈ Γ.R, ∀ w ∈ r' ∩ Γ'.V, + K ∩ Γ'.V = {v, w} → closure f ∩ Γ'.V = {v, w} → + ¬ ∃ Δ : Set S, IsClosedDisc Δ ∧ Δ ⊆ r' ∪ {v} ∧ subBd Δ = K ∪ closure f := by + intro f hf _ v hv r' hr' w hw hKe hfe hΔ + have hmx : x ∈ ({v, w} : Set S) := hKe ▸ (show x ∈ K ∩ Γ'.V by rw [hKV]; simp) + have hmc : c ∈ ({v, w} : Set S) := hKe ▸ (show c ∈ K ∩ Γ'.V by rw [hKV]; simp) + have hvc : c ≠ v := fun h => hcnV (h ▸ hv) + have hcw : c = w := hmc.resolve_left hvc + subst hcw + have hr'r : r' = r := hrr hr' hr hw.1 hcr + have hxv : x = v := by + rcases hmx with h | h + · exact h + · exact absurd h.symm hcx + subst hxv + subst hr'r + obtain ⟨Δ, hd, hsubΔ, hb⟩ := hΔ + exact hno ⟨f, hf, hfe, Δ, hd, hsubΔ, by rw [hb, union_comm]⟩ + obtain ⟨G, hpre', hGV, hGE, _⟩ := + exists_glue_spoke_of_no_bounded_disc (R := Γ.R) hpre hcr hc hx hK hcx hKr hKU hrU hVU key + have hsub : Γ'.IsSubdrawing G := ⟨by rw [hGV], by rw [hGE]; exact subset_union_left⟩ + have hback := hmax G hpre' hsub + have hmem : K \ {c, x} ∈ Γ'.E := hback.2 (by rw [hGE]; exact Or.inr rfl) + obtain ⟨y, hy⟩ := (isPathConnected_sdiff_pair hK).nonempty + exact disjoint_left.mp hKU hy (Γ'.closure_subset_U hmem (subset_closure hy)) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/RadialCorners.lean b/LeanPool/GraphMinor/GM11/RadialCorners.lean new file mode 100644 index 0000000000..293cf5f363 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/RadialCorners.lean @@ -0,0 +1,689 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialRegions + +/-! +# The corners of the union of a drawing and its radial drawing + +Let `H` be the union of a 2-cell drawing `Γ` with an edge and a radial drawing `Γ'` of `Γ`. This +file +looks at the rotation of `H` at a vertex. + +At a vertex of `Γ`, no corner lies between two edges of `Γ`: this is `corner_has_spoke`, and it +comes +from the maximality of `Γ'`. The other results of this file are tools for `RadialFaces.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A point of the unit interval other than `0`, with image in a given neighbourhood. -/ +theorem exists_pos_mem {g : I → S} (hg : Continuous g) {N : Set S} (hN : IsOpen N) + (h0 : g 0 ∈ N) : ∃ t, 0 < t ∧ g t ∈ N := by + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp (hN.preimage hg) 0 h0 + let t : I := ⟨min (δ / 2) 1, le_min (by positivity) zero_le_one, min_le_right _ _⟩ + have ht : (0 : ℝ) < t := lt_min (half_pos hδ) one_pos + refine ⟨t, ht, hball ?_⟩ + rw [Metric.mem_ball, Subtype.dist_eq, Real.dist_eq] + show |(t : ℝ) - ((0 : I) : ℝ)| < δ + rw [Icc.coe_zero, sub_zero, abs_of_pos ht] + have : (t : ℝ) ≤ δ / 2 := min_le_left _ _ + linarith + +/-- All the points of a path up to some positive time lie in a given neighbourhood. -/ +theorem exists_pos_le {g : I → S} (hg : Continuous g) {N : Set S} (hN : IsOpen N) + (h0 : g 0 ∈ N) {a : I} (ha : 0 < a) : ∃ u, 0 < u ∧ u ≤ a ∧ ∀ s, s ≤ u → g s ∈ N := by + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp (hN.preimage hg) 0 h0 + have ha' : (0 : ℝ) < a := ha + let u : I := ⟨min (δ / 2) a, le_min (by positivity) ha'.le, (min_le_right _ _).trans a.2.2⟩ + have hu : (0 : ℝ) < u := lt_min (half_pos hδ) ha' + refine ⟨u, hu, Subtype.coe_le_coe.mp (min_le_right _ _), fun s hs => hball ?_⟩ + rw [Metric.mem_ball, Subtype.dist_eq, Real.dist_eq] + show |(s : ℝ) - ((0 : I) : ℝ)| < δ + have hs' : (s : ℝ) ≤ u := hs + have hu' : (u : ℝ) ≤ δ / 2 := min_le_left _ _ + rw [Icc.coe_zero, sub_zero, abs_of_nonneg s.2.1] + linarith + +/-- A piece of an injective path is a line. -/ +theorem isLine_piece [T2Space S] {g : I → S} (hg : Continuous g) (hi : Function.Injective g) + {a b : I} (hab : a < b) : IsLineWithEnds (g '' Icc a b) (g a) (g b) := by + have hab' : (a : ℝ) < b := hab + let m : I → I := fun t => ⟨(1 - (t : ℝ)) * a + t * b, by + have := t.2.1 + have := t.2.2 + have := a.2.1 + have := b.2.1 + nlinarith, by + have := t.2.1 + have := t.2.2 + have := a.2.2 + have := b.2.2 + nlinarith⟩ + have hm : Continuous m := Continuous.subtype_mk (by fun_prop) _ + have hmi : Function.Injective m := by + intro s t h + have h' : (1 - (s : ℝ)) * a + s * b = (1 - (t : ℝ)) * a + t * b := congrArg Subtype.val h + have h₂ : ((s : ℝ) - t) * ((b : ℝ) - a) = 0 := by linarith + have h₃ := (mul_eq_zero.mp h₂).resolve_right (by linarith) + exact Subtype.ext (by linarith) + have hm0 : m 0 = a := Subtype.ext (by simp [m]) + have hm1 : m 1 = b := Subtype.ext (by simp [m]) + have hr : g '' Icc a b = range (g ∘ m) := by + ext y + constructor + · rintro ⟨s, hs, rfl⟩ + have hs₁ : (a : ℝ) ≤ s := hs.1 + have hs₂ : (s : ℝ) ≤ b := hs.2 + have hpos : (0 : ℝ) < (b : ℝ) - a := by linarith + let t : I := ⟨((s : ℝ) - a) / ((b : ℝ) - a), div_nonneg (by linarith) hpos.le, + (div_le_one hpos).mpr (by linarith)⟩ + refine ⟨t, ?_⟩ + have : m t = s := Subtype.ext (by + change (1 - ((s : ℝ) - a) / ((b : ℝ) - a)) * a + ((s : ℝ) - a) / ((b : ℝ) - a) * b = s + field_simp + ring) + simp [this] + · rintro ⟨t, rfl⟩ + refine ⟨m t, ⟨?_, ?_⟩, rfl⟩ + · change (a : ℝ) ≤ (1 - (t : ℝ)) * a + t * b + nlinarith [t.2.1] + · change (1 - (t : ℝ)) * a + t * b ≤ b + nlinarith [t.2.2] + rw [hr] + have := isLine_range (hg.comp hm) (hi.comp hmi) + simpa [hm0, hm1] using this + +variable {Γ Γ' : Drawing S} {e : Set S} + +/-- Two different edges of a drawing meet only in vertices. -/ +theorem closure_inter_subset_V {Γ : Drawing S} {e f : Set S} (he : e ∈ Γ.E) (hf : f ∈ Γ.E) + (hef : e ≠ f) : closure e ∩ closure f ⊆ Γ.V := by + rintro y ⟨h₁, h₂⟩ + by_contra hy + exact hef (Γ.edge_eq_of_mem he hf ((Γ.closure_diff_V he).subset ⟨h₁, hy⟩) + ((Γ.closure_diff_V hf).subset ⟨h₂, hy⟩)) + +/-- An edge with two different ends is a line with these ends. -/ +theorem isLine_closure {Γ : Drawing S} {e : Set S} (he : e ∈ Γ.E) {x c : S} (hxc : x ≠ c) + (hcap : closure e ∩ Γ.V = {x, c}) : IsLineWithEnds (closure e) x c := by + rcases Γ.edge_cond e he with ⟨u, v, -, hc, hL⟩ | ⟨u, hc, -⟩ + · have hset : ({u, v} : Set S) = {x, c} := hc.symm.trans hcap + have hx : x ∈ ({u, v} : Set S) := hset ▸ (Or.inl rfl) + have hc' : c ∈ ({u, v} : Set S) := hset ▸ (Or.inr rfl) + rcases hx with rfl | hx + · rcases hc' with rfl | hc' + · exact (hxc rfl).elim + · obtain rfl : c = v := hc' + exact hL + · obtain rfl : x = v := hx + rcases hc' with rfl | hc' + · exact GraphMinor.GM11.IsLineWithEnds.symm hL + · exact (hxc hc'.symm).elim + · have hset : ({u} : Set S) = {x, c} := hc.symm.trans hcap + have hx : x ∈ ({u} : Set S) := hset ▸ (Or.inl rfl) + have hc' : c ∈ ({u} : Set S) := hset ▸ (Or.inr rfl) + exact (hxc (hx.trans hc'.symm)).elim + +/-- The edge `e`, as an injective path from the end `b`. The half-edge at `b` is its first half. -/ +theorem exists_fullPar [T2Space S] {Γ : Drawing S} {γ : Set S → I → S} + (hγ : EdgePar Γ γ) {e : Set S} + (he : e ∈ Γ.E) (b : Bool) (hne : γ e 0 ≠ γ e 1) : + ∃ g : I → S, Continuous g ∧ Function.Injective g ∧ g 0 = γ e (endOf b) ∧ + g 1 = γ e (endOf (!b)) ∧ range g = closure e ∧ ∀ t, spoke γ (e, b) t = g (halfT t) := by + have hc := hγ.cont e he + have hsplit : ∀ t : I, t = 0 ∨ t = 1 ∨ t ∈ Ioo (0 : I) 1 := by + intro t + by_cases h0 : t = 0 + · exact Or.inl h0 + by_cases h1 : t = 1 + · exact Or.inr (Or.inl h1) + exact Or.inr (Or.inr ⟨unitInterval.pos_iff_ne_zero.mpr h0, unitInterval.lt_one_iff_ne_one.mpr + h1⟩) + have hedge : ∀ t ∈ Ioo (0 : I) 1, γ e t ∈ e := fun t ht => (hγ.image e he).subset ⟨t, ht, rfl⟩ + have hinj : Function.Injective (γ e) := by + intro s t h + have hV0 : ∀ t ∈ Ioo (0 : I) 1, γ e t ≠ γ e 0 := fun t ht h' => + edge_notMem_V he (hedge t ht) (h' ▸ hγ.zero e he) + have hV1 : ∀ t ∈ Ioo (0 : I) 1, γ e t ≠ γ e 1 := fun t ht h' => + edge_notMem_V he (hedge t ht) (h' ▸ hγ.one e he) + rcases hsplit s with rfl | rfl | hs <;> rcases hsplit t with rfl | rfl | ht + · rfl + · exact (hne h).elim + · exact (hV0 t ht h.symm).elim + · exact (hne h.symm).elim + · rfl + · exact (hV1 t ht h.symm).elim + · exact (hV0 s hs h).elim + · exact (hV1 s hs h).elim + · exact hγ.inj e he hs ht h + have hrange : range (γ e) = closure e := by + apply subset_antisymm + · rintro _ ⟨t, rfl⟩ + rcases hsplit t with rfl | rfl | ht + · exact end_mem_closure hγ he false + · exact end_mem_closure hγ he true + · exact subset_closure (hedge t ht) + · refine closure_minimal ?_ (isCompact_range hc).isClosed + exact (hγ.image e he).symm.subset.trans (image_subset_range _ _) + cases b + · exact ⟨γ e, hc, hinj, rfl, by simp [endOf], hrange, fun t => rfl⟩ + · refine ⟨fun t => γ e (σ t), hc.comp continuous_symm, hinj.comp symm_bijective.injective, ?_, + ?_, ?_, + fun t => rfl⟩ + · simp [endOf] + · simp [endOf] + · rw [← hrange] + exact symm_bijective.surjective.range_comp _ + +/-- Two different edges of `Γ'` with the same ends `x`, `c` form an `O`-arc. -/ +theorem isOArc_spokes [T2Space S] {e f : Set S} (he : e ∈ Γ'.E) (hf : f ∈ Γ'.E) (hef : e ≠ f) + {x c : S} (hxc : x ≠ c) (hce : closure e ∩ Γ'.V = {x, c}) (hcf : closure f ∩ Γ'.V = {x, c}) : + IsOArc (closure e ∪ closure f) := by + refine isOArc_union (isLine_closure he hxc hce) (isLine_closure hf hxc hcf) fun y hy => ?_ + rw [← hce] + exact ⟨hy.1, closure_inter_subset_V he hf hef hy⟩ + +private theorem corner_discs_inter [T2Space S] (hS : IsClosedSurface S) + {C Q₁ Δ' : Set S} (hQ₁ : IsClosedDisc Q₁) (hΔ' : IsClosedDisc Δ') + (hCb' : C ⊆ discBd Δ') (hCbQ : C ⊆ discBd Q₁) + (hYfr : Disjoint (Q₁ \ C) (frontier Δ')) {x : S} + (hxQ₁ : x ∈ Q₁) (hxC : x ∉ C) (hxΔ : x ∉ Δ') : Δ' ∩ Q₁ = C := by + -- `Q₁ - C` is connected, so it misses `Δ'`. + have hYconn : IsPreconnected (Q₁ \ C) := by + refine (IsClosedDisc.isPreconnected_diff_frontier hS hQ₁).subset_closure ?_ ?_ + · rintro y ⟨hy', hn⟩ + rw [IsClosedDisc.frontier_eq_discBd hS hQ₁] at hn + exact ⟨hy', fun h => hn (hCbQ h)⟩ + · exact sdiff_subset.trans (IsClosedDisc.subset_closure_diff_frontier hS hQ₁) + have hYd : Disjoint (Q₁ \ C) Δ' := by + rcases subset_or_disjoint_of_frontier hΔ'.isClosed hYconn hYfr with h | h + · exact (hxΔ (h ⟨hxQ₁, hxC⟩)).elim + · exact h + have hinter : Δ' ∩ Q₁ = C := by + apply subset_antisymm + · rintro y ⟨h₁, h₂⟩ + by_contra hn + exact disjoint_left.mp hYd ⟨h₂, hn⟩ h₁ + · exact fun y hy' => ⟨discBd_subset _ (hCb' hy'), discBd_subset _ (hCbQ hy')⟩ + exact hinter + +omit [TopologicalSpace S] in +private theorem range_eq_image_halves (G : I → S) (u : I) : + range G = G '' Icc 0 u ∪ G '' Icc u 1 := by + apply subset_antisymm + · rintro _ ⟨s, rfl⟩ + rcases le_total s u with h | h + · exact Or.inl ⟨s, ⟨unitInterval.nonneg _, h⟩, rfl⟩ + · exact Or.inr ⟨s, ⟨h, unitInterval.le_one _⟩, rfl⟩ + · exact union_subset (image_subset_range _ _) (image_subset_range _ _) + +/-- Two injective paths `G₁`, `G₂` from `x` to `c`, that start along the boundary of a closed disc +`Q` +and meet only at their ends, bound a closed disc in `r ∪ {x}`. Here `r` is an open disc not +containing +`x`, which contains the two paths without `x`, and also `Q` near `x` without the boundary of `Q`. -/ +theorem exists_disc_of_corner [T2Space S] (hS : IsClosedSurface S) {Q W r ρ' : Set S} + (hQ : IsClosedDisc Q) {x c : S} (hxQ : x ∈ discBd Q) (hW : IsOpen W) (hxW : x ∈ W) + (hr : IsOpenDisc r) (hxr : x ∉ r) {G₁ G₂ : I → S} (hG₁ : Continuous G₁) (hG₂ : Continuous G₂) + (hi₁ : Function.Injective G₁) (hi₂ : Function.Injective G₂) (h₁0 : G₁ 0 = x) (h₂0 : G₂ 0 = x) + (h₁1 : G₁ 1 = c) (h₂1 : G₂ 1 = c) (hmeet : range G₁ ∩ range G₂ ⊆ {x, c}) + (hr₁ : ∀ s, s ≠ 0 → G₁ s ∈ r) (hr₂ : ∀ s, s ≠ 0 → G₂ s ∈ r) + (hin : ∀ y ∈ W, y ∈ Q → y ∉ discBd Q → y ∈ ρ') (hρr : ρ' ⊆ r) + (hρ₁ : Disjoint ρ' (range G₁)) (hρ₂ : Disjoint ρ' (range G₂)) {a₁ a₂ : I} (ha₁ : 0 < a₁) + (ha₂ : 0 < a₂) (ha₁' : a₁ < 1) (ha₂' : a₂ < 1) (hb₁ : ∀ s, s ≤ a₁ → G₁ s ∈ discBd Q) + (hb₂ : ∀ s, s ≤ a₂ → G₂ s ∈ discBd Q) : + ∃ Δ, IsClosedDisc Δ ∧ Δ ⊆ r ∪ {x} ∧ discBd Δ = range G₁ ∪ range G₂ := by + obtain ⟨W', hW', hxW', hcap⟩ := exists_cap hS hQ hxQ hW hxW + obtain ⟨u₁, hu₁, hu₁a, hu₁W⟩ := exists_pos_le hG₁ hW' (h₁0 ▸ hxW') ha₁ + obtain ⟨u₂, hu₂, hu₂a, hu₂W⟩ := exists_pos_le hG₂ hW' (h₂0 ▸ hxW') ha₂ + have hu₁1 : u₁ < 1 := hu₁a.trans_lt ha₁' + have hu₂1 : u₂ < 1 := hu₂a.trans_lt ha₂' + let T₁ := G₁ '' Icc 0 u₁ + let T₂ := G₂ '' Icc 0 u₂ + let R₁ := G₁ '' Icc u₁ 1 + let R₂ := G₂ '' Icc u₂ 1 + have lT₁ : IsLineWithEnds T₁ x (G₁ u₁) := h₁0 ▸ isLine_piece hG₁ hi₁ hu₁ + have lT₂ : IsLineWithEnds T₂ x (G₂ u₂) := h₂0 ▸ isLine_piece hG₂ hi₂ hu₂ + have lR₁ : IsLineWithEnds R₁ (G₁ u₁) c := h₁1 ▸ isLine_piece hG₁ hi₁ hu₁1 + have lR₂ : IsLineWithEnds R₂ (G₂ u₂) c := h₂1 ▸ isLine_piece hG₂ hi₂ hu₂1 + have hxT₁ : x ∈ T₁ := ⟨0, ⟨le_rfl, hu₁.le⟩, h₁0⟩ + have hxT₂ : x ∈ T₂ := ⟨0, ⟨le_rfl, hu₂.le⟩, h₂0⟩ + have hcR₁ : c ∈ R₁ := ⟨1, ⟨hu₁1.le, le_rfl⟩, h₁1⟩ + have hcR₂ : c ∈ R₂ := ⟨1, ⟨hu₂1.le, le_rfl⟩, h₂1⟩ + have hxR₁ : x ∉ R₁ := by + rintro ⟨s, hs, hsx⟩ + have : s = 0 := hi₁ (hsx.trans h₁0.symm) + exact absurd (this ▸ hs.1) (not_le.mpr hu₁) + have hxR₂ : x ∉ R₂ := by + rintro ⟨s, hs, hsx⟩ + have : s = 0 := hi₂ (hsx.trans h₂0.symm) + exact absurd (this ▸ hs.1) (not_le.mpr hu₂) + have hcT₁ : c ∉ T₁ := by + rintro ⟨s, hs, hsx⟩ + have : s = 1 := hi₁ (hsx.trans h₁1.symm) + exact absurd (this ▸ hs.2) (not_le.mpr hu₁1) + have hcT₂ : c ∉ T₂ := by + rintro ⟨s, hs, hsx⟩ + have : s = 1 := hi₂ (hsx.trans h₂1.symm) + exact absurd (this ▸ hs.2) (not_le.mpr hu₂1) + have hT₁r : T₁ ⊆ range G₁ := image_subset_range _ _ + have hT₂r : T₂ ⊆ range G₂ := image_subset_range _ _ + have hR₁r : R₁ ⊆ range G₁ := image_subset_range _ _ + have hR₂r : R₂ ⊆ range G₂ := image_subset_range _ _ + have hTT : T₁ ∩ T₂ = {x} := by + apply subset_antisymm + · rintro y ⟨h₁, h₂⟩ + rcases hmeet ⟨hT₁r h₁, hT₂r h₂⟩ with h | h + · exact h + · exact (hcT₁ (h ▸ h₁)).elim + · rintro y rfl + exact ⟨hxT₁, hxT₂⟩ + have hRR : R₁ ∩ R₂ = {c} := by + apply subset_antisymm + · rintro y ⟨h₁, h₂⟩ + rcases hmeet ⟨hR₁r h₁, hR₂r h₂⟩ with h | h + · exact (hxR₁ (h ▸ h₁)).elim + · exact h + · rintro y rfl + exact ⟨hcR₁, hcR₂⟩ + have hT : IsLineWithEnds (T₁ ∪ T₂) (G₁ u₁) (G₂ u₂) := IsLineWithEnds.union lT₁ lT₂ hTT + have hL : IsLineWithEnds (R₁ ∪ R₂) (G₁ u₁) (G₂ u₂) := + IsLineWithEnds.union (GraphMinor.GM11.IsLineWithEnds.symm lR₁) + (GraphMinor.GM11.IsLineWithEnds.symm lR₂) hRR + have hy₁T : G₁ u₁ ∈ T₁ := ⟨u₁, ⟨hu₁.le, le_rfl⟩, rfl⟩ + have hy₂T : G₂ u₂ ∈ T₂ := ⟨u₂, ⟨hu₂.le, le_rfl⟩, rfl⟩ + have hy₁R : G₁ u₁ ∈ R₁ := ⟨u₁, ⟨le_rfl, hu₁1.le⟩, rfl⟩ + have hy₂R : G₂ u₂ ∈ R₂ := ⟨u₂, ⟨le_rfl, hu₂1.le⟩, rfl⟩ + have hxy₁ : x ≠ G₁ u₁ := fun h => hxR₁ (h ▸ hy₁R) + have hxy₂ : x ≠ G₂ u₂ := fun h => hxR₂ (h ▸ hy₂R) + have hy : G₁ u₁ ≠ G₂ u₂ := by + intro h + rcases hmeet ⟨⟨u₁, rfl⟩, h ▸ ⟨u₂, rfl⟩⟩ with h' | h' + · exact hxy₁ h'.symm + · exact hcT₁ (h' ▸ hy₁T) + have hTL : (T₁ ∪ T₂) ∩ (R₁ ∪ R₂) ⊆ {G₁ u₁, G₂ u₂} := by + rintro y ⟨h₁ | h₁, h₂ | h₂⟩ + · obtain ⟨s, hs, rfl⟩ := h₁ + obtain ⟨s', hs', hss⟩ := h₂ + have : s' = s := hi₁ hss + have e : s = u₁ := le_antisymm hs.2 (this ▸ hs'.1) + exact Or.inl (by rw [e]) + · rcases hmeet ⟨hT₁r h₁, hR₂r h₂⟩ with h | h + · exact (hxR₂ (h ▸ h₂)).elim + · exact (hcT₁ (h ▸ h₁)).elim + · rcases hmeet ⟨hR₁r h₂, hT₂r h₁⟩ with h | h + · exact (hxR₁ (h ▸ h₂)).elim + · exact (hcT₂ (h ▸ h₁)).elim + · obtain ⟨s, hs, rfl⟩ := h₁ + obtain ⟨s', hs', hss⟩ := h₂ + have : s' = s := hi₂ hss + have e : s = u₂ := le_antisymm hs.2 (this ▸ hs'.1) + exact Or.inr (by rw [e]; rfl) + have hTb : T₁ ∪ T₂ ⊆ discBd Q := by + rintro _ (⟨s, hs, rfl⟩ | ⟨s, hs, rfl⟩) + · exact hb₁ s (hs.2.trans hu₁a) + · exact hb₂ s (hs.2.trans hu₂a) + have hTW : T₁ ∪ T₂ ⊆ W' := by + rintro _ (⟨s, hs, rfl⟩ | ⟨s, hs, rfl⟩) + · exact hu₁W s hs.2 + · exact hu₂W s hs.2 + obtain ⟨C, Q₁, hC, hCW, hCQ, hCd, hQ₁, hQ₁W, hQ₁Q, hbQ₁, hQ₁b⟩ := + hcap _ _ (T₁ ∪ T₂) hy hT hTb hTW (Or.inl hxT₁) hxy₁ hxy₂ + have hCρ : C \ {G₁ u₁, G₂ u₂} ⊆ ρ' := fun y hy' => + hin y (hCW hy'.1) (hCQ hy'.1) (disjoint_left.mp hCd hy') + have hQρ : ∀ y ∈ Q₁, y ∉ T₁ ∪ T₂ → y ∈ ρ' := fun y hy' hn => + hin y (hQ₁W hy') (hQ₁Q hy') fun hyb => hn (hQ₁b ⟨hy', hyb⟩) + have hρU : ∀ y ∈ ρ', y ∉ range G₁ ∧ y ∉ range G₂ := fun y hy' => + ⟨disjoint_left.mp hρ₁ hy', disjoint_left.mp hρ₂ hy'⟩ + have hLU : ∀ y ∈ R₁ ∪ R₂, y ∉ ρ' := by + rintro y (h | h) hy' + · exact (hρU y hy').1 (hR₁r h) + · exact (hρU y hy').2 (hR₂r h) + have hLC : (R₁ ∪ R₂) ∩ C ⊆ {G₁ u₁, G₂ u₂} := by + rintro y ⟨h₁, h₂⟩ + by_contra hn + exact hLU y h₁ (hCρ ⟨h₂, hn⟩) + have hJ : IsOArc ((R₁ ∪ R₂) ∪ C) := isOArc_union hL hC hLC + have hend : G₁ u₁ ∈ C ∧ G₂ u₂ ∈ C := by + obtain ⟨g, h0, h1⟩ := hC + exact ⟨h0 ▸ (g 0).2, h1 ▸ (g 1).2⟩ + have hu₁r : G₁ u₁ ∈ r := hr₁ _ hu₁.ne' + have hu₂r : G₂ u₂ ∈ r := hr₂ _ hu₂.ne' + have hJr : (R₁ ∪ R₂) ∪ C ⊆ r := by + rintro y ((⟨s, hs, rfl⟩ | ⟨s, hs, rfl⟩) | h) + · exact hr₁ s fun h => (hu₁.trans_le (h ▸ hs.1)).ne rfl + · exact hr₂ s fun h => (hu₂.trans_le (h ▸ hs.1)).ne rfl + · by_cases hye : y ∈ ({G₁ u₁, G₂ u₂} : Set S) + · rcases hye with rfl | rfl + · exact hu₁r + · exact hu₂r + · exact hρr (hCρ ⟨h, hye⟩) + obtain ⟨Δ', hΔ'r, hΔ', hbΔ'⟩ := exists_disc_in_openDisc hr hJ hJr + have hCb' : C ⊆ discBd Δ' := hbΔ' ▸ subset_union_right + have hCbQ : C ⊆ discBd Q₁ := hbQ₁ ▸ subset_union_right + have hxC : x ∉ C := fun h => by + have hn : x ∉ ({G₁ u₁, G₂ u₂} : Set S) := fun h' => h'.elim hxy₁ hxy₂ + exact (hρU x (hCρ ⟨h, hn⟩)).1 ⟨0, h₁0⟩ + have hxQ₁ : x ∈ Q₁ := discBd_subset _ (hbQ₁ ▸ Or.inl (Or.inl hxT₁)) + have hYfr : Disjoint (Q₁ \ C) (frontier Δ') := by + rw [IsClosedDisc.frontier_eq_discBd hS hΔ', hbΔ'] + refine disjoint_left.mpr ?_ + rintro y ⟨hy', hnC⟩ (hyL | hyC) + · by_cases hyT : y ∈ T₁ ∪ T₂ + · exact (hTL ⟨hyT, hyL⟩).elim (fun e => hnC (e ▸ hend.1)) fun e => hnC (e ▸ hend.2) + · exact hLU y hyL (hQρ y hy' hyT) + · exact hnC hyC + have hinter := corner_discs_inter hS hQ₁ hΔ' hCb' hCbQ hYfr hxQ₁ hxC + (fun hxΔ => hxr (hΔ'r hxΔ)) + obtain ⟨hU, hUb⟩ := disc_union Δ' Q₁ C _ _ hΔ' hQ₁ hC hinter hCb' hCbQ + have hcovG₁ : range G₁ = T₁ ∪ R₁ := range_eq_image_halves G₁ u₁ + have hcovG₂ : range G₂ = T₂ ∪ R₂ := range_eq_image_halves G₂ u₂ + have hnotρ : ∀ y, y ∈ range G₁ ∪ range G₂ → y ∉ ρ' := by + rintro y (h | h) hy' + · exact (hρU y hy').1 h + · exact (hρU y hy').2 h + refine ⟨Δ' ∪ Q₁, hU, ?_, ?_⟩ + · rintro y (h | h) + · exact Or.inl (hΔ'r h) + · by_cases hyT : y ∈ T₁ ∪ T₂ + · rcases hyT with ⟨s, -, rfl⟩ | ⟨s, -, rfl⟩ + · by_cases hs : s = 0 + · exact Or.inr (by rw [hs, h₁0]; rfl) + · exact Or.inl (hr₁ s hs) + · by_cases hs : s = 0 + · exact Or.inr (by rw [hs, h₂0]; rfl) + · exact Or.inl (hr₂ s hs) + · exact Or.inl (hρr (hQρ y h hyT)) + · rw [hUb, hbΔ', hbQ₁] + apply subset_antisymm + · rintro y ⟨h, hn⟩ + have hyC : y ∈ C → y ∈ T₁ ∪ T₂ := fun hc' => by + by_contra hyT + exact hn ⟨hc', fun he => hyT (he.elim (fun e => e ▸ Or.inl hy₁T) + fun e => e ▸ Or.inr hy₂T)⟩ + have hyU : y ∈ (T₁ ∪ T₂) ∪ (R₁ ∪ R₂) := by + rcases h with (h | h) | (h | h) + · exact Or.inr h + · exact Or.inl (hyC h) + · exact Or.inl h + · exact Or.inl (hyC h) + rcases hyU with (h | h) | (h | h) + · exact Or.inl (hT₁r h) + · exact Or.inr (hT₂r h) + · exact Or.inl (hR₁r h) + · exact Or.inr (hR₂r h) + · intro y hy' + refine ⟨?_, fun h => hnotρ y hy' (hCρ h)⟩ + rcases hy' with h | h + · rw [hcovG₁] at h + rcases h with h | h + · exact Or.inr (Or.inl (Or.inl h)) + · exact Or.inl (Or.inl (Or.inl h)) + · rw [hcovG₂] at h + rcases h with h | h + · exact Or.inr (Or.inl (Or.inr h)) + · exact Or.inl (Or.inl (Or.inr h)) + +variable [T2Space S] [ConnectedSpace S] (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') + (hS : IsClosedSurface S) + +include hrad hS + +omit [T2Space S] [ConnectedSpace S] in +/-- Two edges of `Γ'` with the same ends do not bound a closed disc in `r ∪ {x}`: this is condition +(iv), with `bd(Δ)` in place of the frontier. -/ +theorem no_bigon {e f : Set S} (he : e ∈ Γ'.E) (hf : f ∈ Γ'.E) (hef : e ≠ f) {x c : S} + (hx : x ∈ Γ.V) {r : Set S} (hr : r ∈ Γ.R) (hc : c ∈ r) (hcV : c ∈ Γ'.V) + (hce : closure e ∩ Γ'.V = {x, c}) (hcf : closure f ∩ Γ'.V = {x, c}) {Δ : Set S} + (hΔ : IsClosedDisc Δ) (hsub : Δ ⊆ r ∪ {x}) (hb : discBd Δ = closure e ∪ closure f) : False := by + refine hrad.2.2.2.2.2.2 e he f hf hef x hx r hr c ⟨hc, hcV⟩ hce hcf ⟨Δ, hΔ, hsub, ?_⟩ + rw [subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hS hΔ, hb] + +omit [ConnectedSpace S] in +/-- The interior of the disc between a chord and a parallel edge of `Γ'` misses `H`. -/ +theorem parallel_interior {r K Δ h : Set S} (hr : r ∈ Γ.R) {c x : S} (hc : c ∈ r) (hcV : c ∈ Γ'.V) + (hx : x ∈ Γ.V) (hh : h ∈ Γ'.E) (hcap : closure h ∩ Γ'.V = {x, c}) + (hKU : Disjoint (K \ {c, x}) Γ'.U) (hΔ : IsClosedDisc Δ) (hsub : Δ ⊆ r ∪ {x}) + (hb : discBd Δ = closure h ∪ K) : Disjoint (Δ \ discBd Δ) (radialUnion hrad).U := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hxc : x ≠ c := fun h' => region_subset hr (h' ▸ hc) (Γ.V_subset_U hx) + have hxb : x ∈ discBd Δ := by + rw [hb] + have : x ∈ closure h ∩ Γ'.V := by rw [hcap]; simp + exact Or.inl this.1 + have hcb : c ∈ discBd Δ := by + rw [hb] + have : c ∈ closure h ∩ Γ'.V := by rw [hcap]; simp + exact Or.inl this.1 + have hV : ∀ y ∈ Δ, y ∈ Γ'.V → y = x ∨ y = c := by + intro y hy hyV + rcases hsub hy with h' | h' + · exact Or.inr (hub_unique hrad hr hc hcV h' hyV) + · exact Or.inl h' + refine disjoint_left.mpr ?_ + rintro y ⟨hyΔ, hyb⟩ (hyU | hyU) + · rcases hsub hyΔ with h' | h' + · exact region_subset hr h' hyU + · exact hyb (h'.symm ▸ hxb) + by_cases hyV : y ∈ Γ'.V + · rcases hV y hyΔ hyV with rfl | rfl + · exact hyb hxb + · exact hyb hcb + rw [Γ'.U_eq] at hyU + rcases hyU with h' | hyE + · exact hyV h' + obtain ⟨g, hg, hyg'⟩ := mem_iUnion₂.mp hyE + have hyg : y ∈ g := (Γ'.closure_diff_V hg).subset ⟨hyg', hyV⟩ + have hgh : g ≠ h := by + rintro rfl + exact hyb (hb ▸ Or.inl hyg') + -- The edge `g` misses the boundary of `Δ`, so it lies inside `Δ`. + have hgb : Disjoint g (discBd Δ) := by + refine disjoint_left.mpr fun z hz hzb => ?_ + have hzV : z ∉ Γ'.V := edge_notMem_V hg hz + rw [hb] at hzb + rcases hzb with hzh | hzK + · exact hgh (Γ'.edge_eq_of_mem hg hh hz ((Γ'.closure_diff_V hh).subset ⟨hzh, hzV⟩)) + · have hmem : z ∈ K \ {c, x} := ⟨hzK, fun h' => hzV (h'.elim (fun e => e ▸ hcV) + fun e => e ▸ radial_V hrad hx)⟩ + exact disjoint_left.mp hKU hmem (Γ'.closure_subset_U hg (subset_closure hz)) + have hgconn : IsPreconnected g := hg.2.2.1.isConnected.isPreconnected + rw [← IsClosedDisc.frontier_eq_discBd hS hΔ] at hgb + have hgΔ : g ⊆ Δ := by + rcases subset_or_disjoint_of_frontier hΔ.isClosed hgconn hgb with h' | h' + · exact h' + · exact (disjoint_left.mp h' hyg hyΔ).elim + have hclΔ : closure g ⊆ Δ := closure_minimal hgΔ hΔ.isClosed + obtain ⟨v, hv, r', hr', w, hwr, hwV, hcg, hgr⟩ := spoke_ends hrad hS hg + have hvcl : v ∈ closure g ∩ Γ'.V := by rw [hcg]; simp + have hwcl : w ∈ closure g ∩ Γ'.V := by rw [hcg]; simp + have hvx : v = x := by + rcases hV v (hclΔ hvcl.1) hvcl.2 with h' | h' + · exact h' + · exact (notMem_V_of_mem_region hr hc (h' ▸ hv)).elim + have hwc : w = c := by + rcases hV w (hclΔ hwcl.1) hwcl.2 with h' | h' + · exact (notMem_V_of_mem_region hr' hwr (h' ▸ hx)).elim + · exact h' + subst hvx hwc + have hJ := isOArc_spokes hg hh hgh hxc hcg hcap + have hJsub : closure g ∪ closure h ⊆ Δ := + union_subset hclΔ (subset_union_left.trans (hb ▸ discBd_subset Δ)) + obtain ⟨Δ₂, ⟨hsubΔ, hd, hb₂, -⟩, -⟩ := disc_oArc Δ _ hΔ hJsub hJ + exact no_bigon hrad hS hg hh hgh hx hr hc hcV hcg hcap hd (hsubΔ.trans hsub) hb₂ + +/-- A half-edge of `H` at the vertex of a region. -/ +theorem exists_half_at_hub (hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ') + (hE : Γ.E.Nonempty) {γ : Set S → I → S} + (hγ : EdgePar (radialUnion hrad) γ) {r : Set S} (hr : r ∈ Γ.R) {c : S} (hc : c ∈ r) + (hcV : c ∈ Γ'.V) : (halfEdges (radialUnion hrad) γ c).Nonempty := by + obtain ⟨x, hx, hxr⟩ := exists_vertex_at_region hS hE hr + obtain ⟨h, hh, hcap⟩ := exists_spoke_at hrad hmax hS hE hr hc hcV hx hxr + have hhH : h ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inr hh + have hcl : c ∈ closure h ∩ Γ'.V := by rw [hcap]; simp + obtain ⟨b, hb⟩ := exists_end_eq hγ hhH (by rw [radialUnion_V]; exact hcV) hcl.1 + exact ⟨(h, b), hhH, hb⟩ + +/-- **No corner at a vertex of `Γ` lies between two edges of `Γ`.** Take a chord from the vertex of +the region into the corner. By maximality it has a parallel edge of `Γ'`, and the disc between them +shows that this edge is one of the two sides of the corner. -/ +theorem corner_has_spoke (hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ') + (hE : Γ.E.Nonempty) {γ : Set S → I → S} + (hγ : EdgePar (radialUnion hrad) γ) {x : S} (hx : x ∈ Γ.V) + {next : halfEdges (radialUnion hrad) γ x → halfEdges (radialUnion hrad) γ x} + {ρ P Q : halfEdges (radialUnion hrad) γ x → Set S} {W : Set S} + {τ : halfEdges (radialUnion hrad) γ x → I} + (hsec : IsSectors (radialUnion hrad) γ x next ρ P W Q τ) (k : halfEdges + (radialUnion hrad) γ x) : + k.1.1 ∈ Γ'.E ∨ (next k).1.1 ∈ Γ'.E := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hpR : ρ k ∈ (radialUnion hrad).R := IsCorners.region (IsSectors.corners hsec) k + obtain ⟨r, hr, hpr⟩ := exists_region_of_sub hrad hpR + have hxH : x ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact radial_V hrad hx + obtain ⟨c, ⟨hc, hcV⟩, -⟩ := hrad.2.2.2.1 r hr + have hcH : c ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact hcV + have hxU : x ∉ r := fun h => region_subset hr h (Γ.V_subset_U hx) + have hcx : c ≠ x := fun h => hxU (h ▸ hc) + have hcp := hub_mem_closure hrad hS hr hpR hpr hc hcV + obtain ⟨g₁, hg₁, -, h₁0, h₁⟩ := exists_path_into_disc (IsSectors.disc hsec k) + (IsSectors.bd hsec k) + (IsSectors.isOpen hsec) (IsSectors.mem hsec) + have hg₁p : ∀ t, 0 < t → g₁ t ∈ ρ k := fun t ht => by + obtain ⟨a, b, d⟩ := h₁ t ht + exact IsSectors.sub hsec k (IsSectors.inside hsec k ⟨⟨a, b⟩, d⟩) + obtain ⟨g₂, hg₂, h₂0, h₂⟩ := exists_access hS _ hγ hcH (exists_half_at_hub hrad hS hmax hE hγ hr + hc hcV) + hpR hcp + obtain ⟨y₀, hy₀⟩ := region_nonempty hpR + have hppath : IsPathConnected (ρ k) := + isPathConnected_of_isOpen hS (region_isOpen hpR) (region_isPreconnected hpR) ⟨y₀, hy₀⟩ + obtain ⟨u, hu, hui, hu0, hu1, hup, O, hO, hxO, hOr⟩ := + exists_chord hppath hcx.symm (fun h => hxU (hpr h)) hg₁ hg₂ h₁0 h₂0 hg₁p h₂ + have hline : IsLineWithEnds (range u) c x := by + have := isLine_range hu hui + rw [hu0, hu1] at this + exact GraphMinor.GM11.IsLineWithEnds.symm this + have hsubp : range u \ {c, x} ⊆ ρ k := by + rintro _ ⟨⟨t, rfl⟩, hn⟩ + exact hup t (fun h => hn (Or.inr (by rw [h, hu0]; rfl))) fun h => hn (Or.inl (by rw [h, hu1])) + have hKU : Disjoint (range u \ {c, x}) Γ'.U := + disjoint_left.mpr fun z hz hzU => region_subset hpR (hsubp hz) (Or.inr hzU) + obtain ⟨h, hh, hcap, Δ, hΔ, hΔr, hb'⟩ := + parallel_of_line hrad hmax hS hr hc hcV hx hline hcx (hsubp.trans hpr) hKU + have hb : discBd Δ = closure h ∪ range u := by + rw [← IsClosedDisc.frontier_eq_discBd hS hΔ, ← subBd_eq_frontier, hb'] + have hfree := parallel_interior hrad hS hr hc hcV hx hh hcap hKU hΔ hΔr hb + have hhH : h ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inr hh + have hxh : x ∈ closure h ∩ Γ'.V := by rw [hcap]; simp + obtain ⟨b, hbx⟩ := exists_end_eq hγ hhH hxH hxh.1 + let i : halfEdges (radialUnion hrad) γ x := ⟨(h, b), hhH, hbx⟩ + by_cases hik : i = k + · exact Or.inl (hik ▸ hh) + by_cases hin : i = next k + · exact Or.inr (hin ▸ hh) + exfalso + have hxb : x ∈ discBd Δ := hb ▸ Or.inl hxh.1 + have hWO : IsOpen (W ∩ O) := (IsSectors.isOpen hsec).inter hO + obtain ⟨A, W₀, hW₀, hxW₀, hAc, hAΔ, hAb, hAX, hsubA, hclA⟩ := + exists_half_nbhd hΔ hWO.isClosed_compl hxb + (fun h' => h' ⟨IsSectors.mem hsec, hxO⟩) + have hAW : ∀ y ∈ A, y ∈ W ∩ O := fun y hy => by + by_contra hn + exact disjoint_left.mp hAX hy hn + have hAU : ∀ y ∈ A, y ∉ (radialUnion hrad).U := fun y hy hyU => + disjoint_left.mp hfree ⟨hAΔ hy, disjoint_left.mp hAb hy⟩ hyU + have hQd := IsSectors.disc hsec k + have hAfr : Disjoint A (frontier (Q k)) := by + rw [IsClosedDisc.frontier_eq_discBd hS hQd] + exact disjoint_left.mpr fun y hy hyb => + hAU y hy (IsSectors.bdU hsec k ⟨(hAW y hy).1, hyb⟩) + obtain ⟨t, ht, hutW⟩ := exists_pos_mem hu (hW₀.inter hO) (by rw [hu0]; exact ⟨hxW₀, hxO⟩) + obtain ⟨s, hs⟩ := hOr t hutW.2 + have hs0 : 0 < s := by + refine unitInterval.pos_iff_ne_zero.mpr ?_ + rintro rfl + exact ht.ne' (hui (hs.symm.trans (h₁0.trans hu0.symm))) + have hzcl : u t ∈ closure A := hclA ⟨hutW.1, hb ▸ Or.inr ⟨t, rfl⟩⟩ + obtain ⟨-, hzQ, hzb⟩ := h₁ s hs0 + rw [hs] at hzQ hzb + have hzint : u t ∈ interior (Q k) := by + have hnf : u t ∉ frontier (Q k) := by + rwa [IsClosedDisc.frontier_eq_discBd hS hQd] + by_contra hni + exact hnf ⟨subset_closure hzQ, hni⟩ + have hAQ : A ⊆ Q k := by + rcases subset_or_disjoint_of_frontier hQd.isClosed hAc hAfr with h' | h' + · exact h' + · obtain ⟨y, hyI, hyA⟩ := mem_closure_iff.mp hzcl _ isOpen_interior hzint + exact (disjoint_left.mp h' hyA (interior_subset hyI)).elim + have hclQ : closure A ⊆ Q k := closure_minimal hAQ hQd.isClosed + obtain ⟨s', hs', hsW⟩ := exists_pos_mem (continuous_spoke hγ i.2.1) + (hW₀.inter (IsSectors.isOpen hsec)) (by + have e₀ : spoke γ i.1 0 = x := by + rw [spoke_zero] + exact hbx + rw [e₀] + exact ⟨hxW₀, IsSectors.mem hsec⟩) + have hmem : spoke γ i.1 s' ∈ closure h := subset_closure (spoke_mem_edge hγ i.2.1 hs') + exact IsSectors.off hsec k i hik hin s' hs' hsW.2 + (hclQ (hclA ⟨hsW.1, hb ▸ Or.inl hmem⟩)) + +omit [T2Space S] [ConnectedSpace S] in +/-- Facts on an edge `f` of `Γ'` with `f` in the closure of a region of `H` inside `r`. -/ +theorem spoke_facts {f p r : Set S} (hf : f ∈ Γ'.E) (hr : r ∈ Γ.R) (hpr : p ⊆ r) + (hfp : f ⊆ closure p) {c x : S} (hc : c ∈ r) (hcV : c ∈ Γ'.V) (hx : x ∈ Γ.V) + (hxf : x ∈ closure f) : + closure f ∩ Γ'.V = {x, c} ∧ f ⊆ r ∧ ∀ y ∈ closure f, y ≠ x → y ∈ r := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨v, hv, r', hr', w, hwr, hwV, hcap, hsubr⟩ := spoke_ends hrad hS hf + obtain ⟨q, hq⟩ := hf.1 + obtain ⟨z, hz', hz⟩ := mem_closure_iff.mp (hfp hq) r' (region_isOpen hr') (hsubr hq) + obtain rfl : r' = r := region_eq_of_mem hr' hr hz' (hpr hz) + obtain rfl : w = c := hub_unique hrad hr hc hcV hwr hwV + have hxm : x ∈ ({v, w} : Set S) := hcap ▸ ⟨hxf, radial_V hrad hx⟩ + have hxv : x = v := by + rcases hxm with h | h + · exact h + · exact (notMem_V_of_mem_region hr hwr (h ▸ hx)).elim + subst hxv + refine ⟨hcap, hsubr, fun y hy hyx => ?_⟩ + by_cases hyV : y ∈ Γ'.V + · have : y ∈ ({x, w} : Set S) := hcap ▸ ⟨hy, hyV⟩ + rcases this with h | h + · exact (hyx h).elim + · exact h ▸ hwr + · exact hsubr ((Γ'.closure_diff_V hf).subset ⟨hy, hyV⟩) + +omit [T2Space S] [ConnectedSpace S] hS hrad in +/-- The map `next` of a rotation is onto. -/ +theorem next_surjective {H : Drawing S} {γ : Set S → I → S} {x : S} + {next : halfEdges H γ x → halfEdges H γ x} {ρ : halfEdges H γ x → Set S} + (hc : IsCorners H γ x next ρ) : Function.Surjective next := by + have : Finite (halfEdges H γ x) := (finite_halfEdges H γ x).to_subtype + exact Finite.surjective_of_injective (IsCorners.inj hc) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/RadialExists.lean b/LeanPool/GraphMinor/GM11/RadialExists.lean new file mode 100644 index 0000000000..0112aef06a --- /dev/null +++ b/LeanPool/GraphMinor/GM11/RadialExists.lean @@ -0,0 +1,339 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PaintingFacts + +/-! +# Every 2-cell painting or drawing has a radial drawing + +Graph Minors XI, Section 3 (page 75): "It is not difficult to show that every 2-cell painting or +drawing +$\Gamma$ has a radial drawing $\Gamma'$". This is `exists_radialDrawing`. + +Choose one point in each region. These points and the vertices of `Γ`, with no edges, satisfy +conditions +(i)–(iv). A drawing that satisfies (i)–(iv) has a bounded number of edges (`ncard_spokes_le`): in +the +rotation at a vertex of `Γ` no two edges of `Γ'` are next to each other (`corner_has_edge`), so we +can +send each edge of `Γ'` to the half-edge of `Γ` after it. So a drawing with the most edges exists. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +section Bound + +variable [T2Space S] {Γ Γ' : Drawing S} + +/-- **A drawing that satisfies (i)–(iv) has a bounded number of edges.** -/ +theorem ncard_spokes_le (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') (hS : IsClosedSurface S) : + Γ'.E.ncard ≤ Γ.V.ncard + 2 * Γ.E.ncard := by + classical + by_cases hemp : Γ'.E = ∅ + · simp [hemp] + obtain ⟨s₀, hs₀⟩ := nonempty_iff_ne_empty.mpr hemp + obtain ⟨y₀, -⟩ := hs₀.1 + have hne : Nonempty S := ⟨y₀⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar (radialUnion hrad) + let H := radialUnion hrad + let Half := Σ y : Γ.V, halfEdges H γ y.1 + have hspoke : ∀ s : Γ'.E, ∃ p : Half, p.2.1.1 = s.1 := fun s => by + obtain ⟨x, φ, h, -⟩ := spoke_half_unique hrad hS s.2 hγ + exact ⟨⟨x, φ⟩, h⟩ + choose p hp using hspoke + have hpinj : Function.Injective p := fun s t h => Subtype.ext (by rw [← hp, ← hp, h]) + have hsec : ∀ y : Γ.V, 2 ≤ Nat.card (halfEdges H γ y.1) → + ∃ next ρ P W Q τ, IsSectors H γ y.1 next ρ P W Q τ := fun y h2 => + exists_sectors hS _ hγ + (by rw [show H.V = Γ'.V from radialUnion_V hrad]; exact radial_V hrad y.2) h2 + let succ : ∀ y : Γ.V, halfEdges H γ y.1 → halfEdges H γ y.1 := fun y => + if h : 2 ≤ Nat.card (halfEdges H γ y.1) then (hsec y h).choose else id + have hsucc : ∀ y (h : 2 ≤ Nat.card (halfEdges H γ y.1)), + ∃ ρ P W Q τ, IsSectors H γ y.1 (succ y) ρ P W Q τ := fun y h => by + simp only [succ, h, dite_true] + exact (hsec y h).choose_spec + let Φ : Half → S ⊕ (Set S × Bool) := fun q => + if 2 ≤ Nat.card (halfEdges H γ q.1.1) then Sum.inr (succ q.1 q.2).1 else Sum.inl q.1.1 + have hinj : Function.Injective Φ := by + rintro ⟨y, a⟩ ⟨z, b⟩ hst + by_cases hs : 2 ≤ Nat.card (halfEdges H γ y.1) <;> by_cases ht : 2 ≤ Nat.card + (halfEdges H γ z.1) + · simp only [Φ, hs, ht, ite_true, Sum.inr.injEq] at hst + have hvx : y = z := by + have h₁ := (succ y a).2.2 + have h₂ := (succ z b).2.2 + rw [hst] at h₁ + exact Subtype.ext (h₁.symm.trans h₂) + subst hvx + obtain ⟨ρ, P, W, Q, τ, hc⟩ := hsucc y hs + have := hc.corners.inj (Subtype.ext hst) + rw [this] + · have h₁ : Φ ⟨y, a⟩ = Sum.inr (succ y a).1 := ite_eq_left_iff.mpr fun h => absurd hs h + have h₂ : Φ ⟨z, b⟩ = Sum.inl z.1 := ite_eq_right_iff.mpr fun h => absurd h ht + rw [h₁, h₂] at hst + cases hst + · have h₁ : Φ ⟨y, a⟩ = Sum.inl y.1 := ite_eq_right_iff.mpr fun h => absurd h hs + have h₂ : Φ ⟨z, b⟩ = Sum.inr (succ z b).1 := ite_eq_left_iff.mpr fun h => absurd ht h + rw [h₁, h₂] at hst + cases hst + · simp only [Φ, hs, ht, ite_false, Sum.inl.injEq] at hst + have hvx : y = z := Subtype.ext hst + subst hvx + have hfin : Finite (halfEdges H γ y.1) := finite_halfEdges H γ y.1 + have : Subsingleton (halfEdges H γ y.1) := by + rw [← Finite.card_le_one_iff_subsingleton] + omega + rw [Subsingleton.elim a b] + let T : Set (S ⊕ (Set S × Bool)) := Sum.inl '' Γ.V ∪ Sum.inr '' (Γ.E ×ˢ univ) + have hmaps : ∀ s, Φ (p s) ∈ T := by + intro s + by_cases h : 2 ≤ Nat.card (halfEdges H γ (p s).1.1) + · simp only [Φ, h, ite_true] + refine Or.inr ⟨(succ (p s).1 (p s).2).1, ⟨?_, mem_univ _⟩, rfl⟩ + obtain ⟨ρ, P, W, Q, τ, hc⟩ := hsucc _ h + refine (edge_cases hrad (succ (p s).1 (p s).2)).resolve_right fun h' => ?_ + exact corner_has_edge hrad hS hγ (p s).1.2 hc (p s).2 (by rw [hp]; exact s.2) h' + · simp only [Φ, h, ite_false] + exact Or.inl ⟨_, (p s).1.2, rfl⟩ + have hVf : Γ.V.Finite := Γ.finite_V + have hEf : Γ.E.Finite := Γ.finite_edges + have hEf' : Γ'.E.Finite := Γ'.finite_edges + have hTf : T.Finite := (hVf.image _).union ((hEf.prod finite_univ).image _) + have hle : Γ'.E.ncard ≤ T.ncard := by + rw [← Nat.card_coe_set_eq, ← Nat.card_coe_set_eq] + have := hTf.to_subtype + exact Nat.card_le_card_of_injective (fun s => (⟨Φ (p s), hmaps s⟩ : T)) + fun s t h => hpinj (hinj (congrArg Subtype.val h)) + refine hle.trans ((ncard_union_le _ _).trans ?_) + have h₁ : (Sum.inl '' Γ.V : Set (S ⊕ (Set S × Bool))).ncard ≤ Γ.V.ncard := ncard_image_le hVf + have h₂ : (Sum.inr '' (Γ.E ×ˢ univ) : Set (S ⊕ (Set S × Bool))).ncard ≤ (Γ.E ×ˢ + (univ : Set Bool)).ncard := + ncard_image_le (hEf.prod finite_univ) + have h₃ : (Γ.E ×ˢ (univ : Set Bool)).ncard = Γ.E.ncard * 2 := by + rw [ncard_prod] + simp + omega + +/-- A 2-cell drawing has only boundedly many edges in a drawing that satisfies (i)–(iv). -/ +theorem exists_spoke_bound_drawing (hT : (PaintingOrDrawing.drawing Γ).IsTwoCell) + (hS : IsClosedSurface S) : + ∃ N : ℕ, ∀ Γ' : Drawing S, (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing Γ' → + Γ'.E.ncard ≤ N := + ⟨Γ.V.ncard + 2 * Γ.E.ncard, fun _ h => ncard_spokes_le ⟨hT, h⟩ hS⟩ + +end Bound + +section BoundPainting + +variable [T2Space S] {Γ : Painting S} + +/-- The cells of a painting, and the bound for paintings. Each drawing that satisfies (i)–(iv) lies +in a drawing that satisfies them for the drawing `D` of the boundaries of the cells, by adding the +stars of the cells, and `D` does not depend on the drawing. -/ +theorem exists_spoke_bound_painting (hT : (PaintingOrDrawing.painting Γ).IsTwoCell) + (hS : IsClosedSurface S) : + Γ.R.Finite ∧ ∃ N : ℕ, ∀ Γ' : Drawing S, (PaintingOrDrawing.painting Γ).IsPreRadialDrawing Γ' → + Γ'.E.ncard ≤ N := by + classical + obtain ⟨hconn, hP⟩ := hT + have hP' : ∀ r ∈ Γ.R, IsOpenDisc r := hP + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hne : Nonempty S := hconn.toNonempty + by_cases hfree : ∃ e ∈ Γ.E, closure e ∩ Γ.V = ∅ + · obtain ⟨e, he, hf⟩ := hfree + obtain ⟨hV, hE⟩ := free_cell hS hP' he hf + refine ⟨?_, 0, fun Γ' hpre => ?_⟩ + · have hU : IsClosed Γ.U := Cell.isClosed_U Γ fun r hr => (hP' r hr).1 + have hd := Cell.isClosedDisc_closure he + obtain ⟨a, ha⟩ : (discBd (closure e)).Nonempty := + hd.isOArc_discBd.elim fun f => ⟨(f (Classical.arbitrary _)).1, (f _).2⟩ + have hcl : closure e ⊆ Γ.U := closure_minimal (fun x hx => (he.2.1 hx).1) hU + have haU : a ∈ Γ.U := hcl (discBd_subset _ ha) + have hsub : Γ.V ⊆ {a} := by rw [hV]; exact empty_subset _ + obtain ⟨D, hDU, hDV⟩ := exists_boundary_drawing hS hU (finite_singleton a) hsub fun f hf => by + rw [hE] at hf + rw [mem_singleton_iff.mp hf] + exact ⟨a, rfl, ha⟩ + have hbd : ∀ f ∈ Γ.E, ({a} : Set S) ∩ closure f ⊆ discBd (closure f) := by + intro f hf x hx + rw [hE] at hf + rw [mem_singleton_iff.mp hf, mem_singleton_iff.mp hx.1] + exact ha + have hDR := boundary_R hS hP' hsub (singleton_subset_iff.mpr haU) hbd hDU + exact (finite_R hS D).subset (hDR ▸ subset_union_left) + · have : Γ'.E = ∅ := by + refine eq_empty_of_forall_notMem fun s hs => ?_ + obtain ⟨v, hv, -⟩ := hpre.2.2.2.2.1 s hs + have hv' : v ∈ Γ.V := hv + rw [hV] at hv' + exact hv' + simp [this] + have hv : ∀ e ∈ Γ.E, (closure e ∩ Γ.V).Nonempty := fun e he => by + by_contra h + exact hfree ⟨e, he, not_nonempty_iff_eq_empty.mp h⟩ + have hU : IsClosed Γ.U := Cell.isClosed_U Γ fun r hr => (hP' r hr).1 + obtain ⟨c, K, hst⟩ := exists_cellStars (Γ := Γ) + have hbd : ∀ e ∈ Γ.E, Γ.V ∩ closure e ⊆ discBd (closure e) := fun e he x hx => + Cell.closure_inter_V_subset hS he ⟨hx.2, hx.1⟩ + obtain ⟨D, hDU, hDV⟩ := exists_boundary_drawing hS hU Γ.finite_V Subset.rfl fun e he => by + obtain ⟨x, hx, hxV⟩ := hv e he + exact ⟨x, hxV, hbd e he ⟨hxV, hx⟩⟩ + have hDR : D.R = Γ.R ∪ cellInt '' Γ.E := boundary_R hS hP' Subset.rfl Γ.V_subset_U hbd hDU + have hRf : D.R.Finite := finite_R hS D + refine ⟨hRf.subset (hDR ▸ subset_union_left), ?_⟩ + obtain ⟨N, hN⟩ := exists_spoke_bound_drawing (boundary_twoCell hS hP' hDR) hS + refine ⟨N, fun Γ' hpre => ?_⟩ + have hrad : PreRad (PaintingOrDrawing.painting Γ) Γ' := ⟨⟨hconn, hP⟩, hpre⟩ + obtain ⟨G, hG⟩ := exists_star_drawing hrad hst hS + have hb := hN G (star_preRadial hrad hst hS hG hDU hDV hv hDR) + have hsub : Γ'.E ⊆ G.E := fun s hs => hG.E ▸ Or.inl hs + exact (ncard_le_ncard hsub G.finite_edges).trans hb + +end BoundPainting + +section Existence + +variable [T2Space S] {Γ : PaintingOrDrawing S} + +omit [T2Space S] in +theorem not_mem_U_of_region {r : Set S} (hr : r ∈ Γ.R) {x : S} (hx : x ∈ r) : x ∉ Γ.U := by + cases Γ with + | painting Γ => + obtain ⟨y, -, rfl⟩ := hr + exact (connectedComponentIn_subset _ _ hx).2 + | drawing Γ => + obtain ⟨y, -, rfl⟩ := hr + exact (connectedComponentIn_subset _ _ hx).2 + +omit [T2Space S] in +theorem region_eq_of_common {r₁ r₂ : Set S} (h₁ : r₁ ∈ Γ.R) (h₂ : r₂ ∈ Γ.R) {x : S} (hx₁ : x ∈ r₁) + (hx₂ : x ∈ r₂) : r₁ = r₂ := by + have key : ∀ {F : Set S} {r₁ r₂ : Set S}, r₁ ∈ componentsIn F → r₂ ∈ componentsIn F → x ∈ r₁ → + x ∈ r₂ → r₁ = r₂ := by + rintro F _ _ ⟨a, -, rfl⟩ ⟨b, -, rfl⟩ ha hb + rw [connectedComponentIn_eq ha, connectedComponentIn_eq hb] + cases Γ with + | painting Γ => exact key h₁ h₂ hx₁ hx₂ + | drawing Γ => exact key h₁ h₂ hx₁ hx₂ + +omit [T2Space S] in +theorem V_subset_U' : Γ.V ⊆ Γ.U := by + cases Γ with + | painting Γ => exact Γ.V_subset_U + | drawing Γ => exact Γ.V_subset_U + +omit [T2Space S] in +theorem finite_V' : Γ.V.Finite := by + cases Γ with + | painting Γ => exact Γ.finite_V + | drawing Γ => exact Γ.finite_V + +theorem pointsDrawing_E {A : Set S} (hA : A.Finite) : (pointsDrawing hA).E = ∅ := by + refine eq_empty_of_forall_notMem ?_ + rintro C ⟨⟨x, hx⟩, hsub, -⟩ + simpa [pointsDrawing] using hsub hx + +/-- **There is a drawing that satisfies (i)–(iv).** Take the vertices and one point in each region, +with no edges. -/ +theorem exists_preRadial [Nonempty S] (hR : Γ.R.Finite) (hne : ∀ r ∈ Γ.R, r.Nonempty) : + ∃ Γ' : Drawing S, Γ.IsPreRadialDrawing Γ' := by + classical + choose! hub hhub using hne + have hA : (Γ.V ∪ hub '' Γ.R).Finite := finite_V'.union (hR.image _) + have hV : (pointsDrawing hA).V = Γ.V ∪ hub '' Γ.R := rfl + have hU : (pointsDrawing hA).U = Γ.V ∪ hub '' Γ.R := rfl + have hE := pointsDrawing_E hA + refine ⟨pointsDrawing hA, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [hU] + ext x + constructor + · rintro ⟨hxU, hx | ⟨r, hr, rfl⟩⟩ + · exact hx + · exact absurd hxU (not_mem_U_of_region hr (hhub r hr)) + · exact fun hx => ⟨V_subset_U' hx, Or.inl hx⟩ + · rw [hV] + exact subset_union_left + · intro r hr + refine ⟨hub r, ⟨hhub r hr, Or.inr ⟨r, hr, rfl⟩⟩, ?_⟩ + rintro w ⟨hwr, hw | ⟨r', hr', rfl⟩⟩ + · exact absurd (V_subset_U' hw) (not_mem_U_of_region hr hwr) + · rw [region_eq_of_common hr hr' hwr (hhub r' hr')] + · rintro w ⟨hw | ⟨r, hr, rfl⟩, hn⟩ + · exact absurd hw hn + · exact ⟨r, hr, hhub r hr⟩ + · intro e he + rw [hE] at he + exact absurd he (notMem_empty _) + · intro e he + rw [hE] at he + exact absurd he (notMem_empty _) + +/-- **A drawing with the most edges among those that satisfy (i)–(iv) is a radial drawing.** -/ +theorem exists_radial_of_bound (hT : Γ.IsTwoCell) (hR : Γ.R.Finite) (hne : ∀ r ∈ Γ.R, r.Nonempty) + {N : ℕ} (hN : ∀ Γ' : Drawing S, Γ.IsPreRadialDrawing Γ' → Γ'.E.ncard ≤ N) : + ∃ Γ' : Drawing S, Γ.IsRadialDrawing Γ' := by + classical + have hS' : Nonempty S := hT.1.toNonempty + let A : Set ℕ := {n | ∃ Γ' : Drawing S, Γ.IsPreRadialDrawing Γ' ∧ Γ'.E.ncard = n} + have hAne : A.Nonempty := by + obtain ⟨Γ', h⟩ := exists_preRadial hR hne + exact ⟨_, Γ', h, rfl⟩ + have hbdd : BddAbove A := ⟨N, by rintro _ ⟨Γ', h, rfl⟩; exact hN Γ' h⟩ + obtain ⟨Γ', hpre, hc⟩ := Nat.sSup_mem hAne hbdd + refine ⟨Γ', hT, hpre, ?_⟩ + rintro Γ'' hpre' ⟨hV, hE⟩ + refine ⟨?_, ?_⟩ + · intro w hw + by_cases hwV : w ∈ Γ.V + · exact hpre.2.1 hwV + obtain ⟨r, hr, hwr⟩ := hpre'.2.2.2.1 w ⟨hw, hwV⟩ + obtain ⟨w', ⟨hw'r, hw'⟩, -⟩ := hpre.2.2.1 r hr + rw [(hpre'.2.2.1 r hr).unique ⟨hwr, hw⟩ ⟨hw'r, hV hw'⟩] + exact hw' + · have hle : Γ''.E.ncard ≤ Γ'.E.ncard := by + rw [hc] + exact le_csSup hbdd ⟨Γ'', hpre', rfl⟩ + exact (eq_of_subset_of_ncard_le hE hle Γ''.finite_edges).ge + +omit [T2Space S] in +theorem region_nonempty' {r : Set S} (hr : r ∈ Γ.R) : r.Nonempty := by + cases Γ with + | painting Γ => + obtain ⟨y, hy, rfl⟩ := hr + exact ⟨y, mem_connectedComponentIn hy⟩ + | drawing Γ => + obtain ⟨y, hy, rfl⟩ := hr + exact ⟨y, mem_connectedComponentIn hy⟩ + +/-- **Every 2-cell painting or drawing has a radial drawing.** Graph Minors XI, Section 3 (page 75): +"every 2-cell painting or drawing $\Gamma$ has a radial drawing $\Gamma'$". -/ +theorem exists_radialDrawing (hS : IsClosedSurface S) (hT : Γ.IsTwoCell) : + ∃ Γ' : Drawing S, Γ.IsRadialDrawing Γ' := by + cases Γ with + | painting Γ => + obtain ⟨hR, N, hN⟩ := exists_spoke_bound_painting hT hS + exact exists_radial_of_bound hT hR (fun _ h => region_nonempty' h) hN + | drawing Γ => + obtain ⟨N, hN⟩ := exists_spoke_bound_drawing hT hS + have : ConnectedSpace S := hT.1 + exact exists_radial_of_bound hT (finite_R hS Γ) + (fun _ h => region_nonempty' h) hN + +end Existence + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/RadialFaces.lean b/LeanPool/GraphMinor/GM11/RadialFaces.lean new file mode 100644 index 0000000000..01fc3fdff0 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/RadialFaces.lean @@ -0,0 +1,565 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# Each region of a radial drawing contains one edge + +Let `H` be the union of a 2-cell drawing `Γ` with an edge and a radial drawing `Γ'` of `Γ`. We show +that the closure of each region of `H` contains exactly one edge of `Γ`, and then deduce +`RegionFacts`, +which is the sentence of Graph Minors XI (Section 3, page 75) that every region of `Γ'` contains a +unique edge of `Γ`. The steps are these. + +* At a vertex of `Γ`, no corner lies between two edges of `Γ'` (`corner_has_edge`). With + `corner_has_spoke`, this says that exactly one side of each corner is an edge of `Γ'`. +* At the vertex of a region of `Γ`, different corners lie in different regions of `H` + (`corner_regions_ne`). +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] {Γ Γ' : Drawing S} + +/-- A parameter below `t / 2` is `s / 2` for some `s ≤ t`. -/ +theorem exists_halfT_eq {s t : I} (h : s ≤ halfT t) : ∃ t', t' ≤ t ∧ halfT t' = s := by + have h' : (s : ℝ) ≤ (t : ℝ) / 2 := h + have ht := t.2.2 + refine ⟨⟨2 * s, by have := s.2.1; positivity, by linarith⟩, ?_, ?_⟩ + · change 2 * (s : ℝ) ≤ t + linarith + · exact Subtype.ext (by change 2 * (s : ℝ) / 2 = s; ring) + +theorem halfT_pos {t : I} (h : 0 < t) : 0 < halfT t := by + have h' : (0 : ℝ) < t := h + change (0 : ℝ) < (t : ℝ) / 2 + positivity + +theorem halfT_lt_one (t : I) : halfT t < 1 := by + change (t : ℝ) / 2 < 1 + linarith [t.2.2] + +/-- An edge of `H` with the two different ends `x`, `c`, as a path from the end of a half-edge. -/ +theorem exists_edge_path [T2Space S] {H : Drawing S} {γ : Set S → I → S} (hγ : EdgePar H γ) + {x c : S} (i : halfEdges H γ x) (hxc : x ≠ c) (hc : c ∈ H.V) (hcl : c ∈ closure i.1.1) : + ∃ G : I → S, Continuous G ∧ Function.Injective G ∧ G 0 = x ∧ G 1 = c ∧ + range G = closure i.1.1 ∧ ∀ t, spoke γ i.1 t = G (halfT t) := by + obtain ⟨⟨e, b⟩, he, hb⟩ := i + dsimp only at he hb hcl ⊢ + obtain ⟨b', hb'⟩ := exists_end_eq hγ he hc hcl + have hbb : b' = !b := by + cases b <;> cases b' <;> first | rfl | exact (hxc (hb.symm.trans hb')).elim + subst hbb + have hne : γ e 0 ≠ γ e 1 := by + intro h + apply hxc + cases b + · simpa [endOf, ← hb, ← hb'] using h + · simpa [endOf, ← hb, ← hb'] using h.symm + obtain ⟨G, h₁, h₂, h₃, h₄, h₅, h₆⟩ := exists_fullPar hγ he b hne + exact ⟨G, h₁, h₂, h₃.trans hb, h₄.trans hb', h₅, h₆⟩ + +/-- Distinct sectors in a single region give a loop through their common vertex. If such a +loop bounds a disc with interior disjoint from the drawing, the two sectors cannot share a region. +The hypothesis supplies the disc for the particular drawing. -/ +theorem corner_regions_ne_of_free_disc [T2Space S] (hS : IsClosedSurface S) + {H : Drawing S} {c : S} (hc : c ∈ H.U) {γ : Set S → I → S} + {next : halfEdges H γ c → halfEdges H γ c} + {ρ P Q : halfEdges H γ c → Set S} {W : Set S} {τ : halfEdges H γ c → I} + (hsec : IsSectors H γ c next ρ P W Q τ) + {k k' : halfEdges H γ c} (hkk : k ≠ k') + (hdisc : ∀ J : Set S, IsOArc J → c ∈ J → (∀ y ∈ J, y = c ∨ y ∈ ρ k) → + ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = J ∧ Disjoint (Δ \ discBd Δ) H.U) : + ρ k ≠ ρ k' := by + intro hρ + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hpR : ρ k ∈ H.R := IsCorners.region (IsSectors.corners hsec) k + have hcp : c ∉ ρ k := fun h => region_subset hpR h hc + have hppath : IsPathConnected (ρ k) := + isPathConnected_of_isOpen hS (region_isOpen hpR) (region_isPreconnected hpR) + (region_nonempty hpR) + obtain ⟨g₁, hg₁, hi₁, h₁0, h₁⟩ := exists_path_into_disc (IsSectors.disc hsec k) + (IsSectors.bd hsec k) (IsSectors.isOpen hsec) (IsSectors.mem hsec) + obtain ⟨g₂, hg₂, hi₂, h₂0, h₂⟩ := exists_path_into_disc (IsSectors.disc hsec k') + (IsSectors.bd hsec k') (IsSectors.isOpen hsec) (IsSectors.mem hsec) + have hg₁p : ∀ t, 0 < t → g₁ t ∈ ρ k := fun t ht => by + obtain ⟨a, b, d⟩ := h₁ t ht + exact IsSectors.sub hsec k (IsSectors.inside hsec k ⟨⟨a, b⟩, d⟩) + have hg₂p : ∀ t, 0 < t → g₂ t ∈ ρ k := fun t ht => by + obtain ⟨a, b, d⟩ := h₂ t ht + rw [hρ] + exact IsSectors.sub hsec k' (IsSectors.inside hsec k' ⟨⟨a, b⟩, d⟩) + obtain ⟨e, he, hei, he0, he1, hep, O, hO, hcO, hOr⟩ := + exists_chord_to_point hppath hcp (hg₂p 1 one_pos) hg₁ h₁0 hg₁p + -- The first time after `0` at which `e` meets `g₂`. + have hsame : ∀ t, t ≠ 0 → e t ∈ O → e t ∉ range g₂ := by + rintro t ht htO ⟨b, hb⟩ + obtain ⟨a, ha⟩ := hOr t htO + have hne : e t ≠ c := fun h => hcp (h ▸ hep t ht) + have ha0 : 0 < a := unitInterval.pos_iff_ne_zero.mpr fun h => hne (by rw [← ha, h, h₁0]) + have hb0 : 0 < b := unitInterval.pos_iff_ne_zero.mpr fun h => hne (by rw [← hb, h, h₂0]) + have hmem : e t ∈ Q k ∩ Q k' := ⟨ha ▸ (h₁ a ha0).2.1, hb ▸ (h₂ b hb0).2.1⟩ + exact region_subset hpR (hep t ht) (IsSectors.inter hsec k k' hkk hmem) + obtain ⟨δ, hδ, hδa, hδO⟩ := exists_pos_le he hO (he0 ▸ hcO) (a := 1) one_pos + let Z : Set I := Icc δ 1 ∩ e ⁻¹' range g₂ + have hZc : IsCompact Z := isCompact_Icc.inter_right + ((isCompact_range hg₂).isClosed.preimage he) + have hZne : Z.Nonempty := ⟨1, ⟨hδa, le_rfl⟩, ⟨1, he1.symm⟩⟩ + obtain ⟨t₀, ⟨ht₀I, s₀, hs₀⟩, ht₀min⟩ := hZc.exists_isLeast hZne + have ht₀ : 0 < t₀ := hδ.trans_le ht₀I.1 + have hne₀ : e t₀ ≠ c := fun h => ht₀.ne' (hei (h.trans he0.symm)) + have hs₀0 : 0 < s₀ := unitInterval.pos_iff_ne_zero.mpr fun h => hne₀ (by rw [← hs₀, h, h₂0]) + have hl₁ : IsLineWithEnds (e '' Icc 0 t₀) c (e t₀) := he0 ▸ isLine_piece he hei ht₀ + have hl₂ : IsLineWithEnds (g₂ '' Icc 0 s₀) c (e t₀) := by + have := isLine_piece hg₂ hi₂ hs₀0 + rwa [h₂0, hs₀] at this + have hmeet : e '' Icc 0 t₀ ∩ g₂ '' Icc 0 s₀ ⊆ {c, e t₀} := by + rintro y ⟨⟨a, ha, rfl⟩, b, -, hb⟩ + by_cases ha0 : a = 0 + · exact Or.inl (by rw [ha0, he0]) + · refine Or.inr ?_ + have hle : t₀ ≤ a := by + by_cases hδa' : δ ≤ a + · exact ht₀min ⟨⟨hδa', unitInterval.le_one _⟩, ⟨b, hb⟩⟩ + · have hal : a ≤ δ := (not_le.mp hδa').le + exact (hsame a ha0 (hδO a hal) ⟨b, hb⟩).elim + have : a = t₀ := le_antisymm ha.2 hle + change e a = e t₀ + rw [this] + have hJ : IsOArc (e '' Icc 0 t₀ ∪ g₂ '' Icc 0 s₀) := isOArc_union hl₁ hl₂ hmeet + have hJp : ∀ y ∈ e '' Icc 0 t₀ ∪ g₂ '' Icc 0 s₀, y = c ∨ y ∈ ρ k := by + rintro _ (⟨a, -, rfl⟩ | ⟨a, -, rfl⟩) + · by_cases ha : a = 0 + · exact Or.inl (by rw [ha, he0]) + · exact Or.inr (hep a ha) + · by_cases ha : a = 0 + · exact Or.inl (by rw [ha, h₂0]) + · exact Or.inr (hg₂p a (unitInterval.pos_iff_ne_zero.mpr ha)) + have hcJ : c ∈ e '' Icc 0 t₀ ∪ g₂ '' Icc 0 s₀ := + Or.inl ⟨0, ⟨le_rfl, ht₀.le⟩, he0⟩ + obtain ⟨Δ, hΔ, hb, hfree⟩ := hdisc _ hJ hcJ hJp + have hcb : c ∈ discBd Δ := hb.symm ▸ hcJ + obtain ⟨A, W₀, hW₀, hcW₀, hAc, hAΔ, hAb, hAX, -, hclA⟩ := + exists_half_nbhd hΔ (IsSectors.isOpen hsec).isClosed_compl hcb + (fun h' => h' (IsSectors.mem hsec)) + have hAW : ∀ y ∈ A, y ∈ W := fun y hy => by + by_contra hn + exact disjoint_left.mp hAX hy hn + have hAU : ∀ y ∈ A, y ∉ H.U := fun y hy hyU => + disjoint_left.mp hfree ⟨hAΔ hy, disjoint_left.mp hAb hy⟩ hyU + -- A connected set off `H` near `c`, with a point of a sector interior in its closure, lies in the + -- closed disc of that sector. + have hinQ : ∀ j, ∀ z, z ∈ closure A → z ∈ Q j → z ∉ discBd (Q j) → A ⊆ Q j := by + intro j z hzA hzQ hzb + have hQd := IsSectors.disc hsec j + have hAfr : Disjoint A (frontier (Q j)) := by + rw [IsClosedDisc.frontier_eq_discBd hS hQd] + exact disjoint_left.mpr fun y hy hyb => hAU y hy (IsSectors.bdU hsec j ⟨hAW y hy, hyb⟩) + have hzint : z ∈ interior (Q j) := by + have hnf : z ∉ frontier (Q j) := by + rwa [IsClosedDisc.frontier_eq_discBd hS hQd] + by_contra hni + exact hnf ⟨subset_closure hzQ, hni⟩ + rcases subset_or_disjoint_of_frontier hQd.isClosed hAc hAfr with h' | h' + · exact h' + · obtain ⟨y, hyI, hyA⟩ := mem_closure_iff.mp hzA _ isOpen_interior hzint + exact (disjoint_left.mp h' hyA (interior_subset hyI)).elim + obtain ⟨t, ht, htt₀, htN⟩ := exists_pos_le he (hW₀.inter hO) (by rw [he0]; exact ⟨hcW₀, hcO⟩) ht₀ + obtain ⟨s, hs, hss₀, hsN⟩ := exists_pos_le hg₂ hW₀ (by rw [h₂0]; exact hcW₀) hs₀0 + have hzt : e t ∈ closure A := hclA ⟨(htN t le_rfl).1, hb ▸ Or.inl ⟨t, ⟨ht.le, htt₀⟩, rfl⟩⟩ + have hzs : g₂ s ∈ closure A := hclA ⟨hsN s le_rfl, hb ▸ Or.inr ⟨s, ⟨hs.le, hss₀⟩, rfl⟩⟩ + obtain ⟨a, ha⟩ := hOr t (htN t le_rfl).2 + have ha0 : 0 < a := unitInterval.pos_iff_ne_zero.mpr fun h => + ht.ne' (hei ((ha.symm.trans (by rw [h, h₁0])).trans he0.symm)) + have hA₁ : A ⊆ Q k := hinQ k _ hzt (ha ▸ (h₁ a ha0).2.1) (ha ▸ (h₁ a ha0).2.2) + have hA₂ : A ⊆ Q k' := hinQ k' _ hzs (h₂ s hs).2.1 (h₂ s hs).2.2 + obtain ⟨y, -, hyA⟩ := mem_closure_iff.mp hzs _ isOpen_univ (mem_univ _) + exact hAU y hyA (IsSectors.inter hsec k k' hkk ⟨hA₁ hyA, hA₂ hyA⟩) + +variable [T2Space S] [ConnectedSpace S] (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') + (hS : IsClosedSurface S) + +include hrad hS + +omit [ConnectedSpace S] in +/-- **No corner at a vertex of `Γ` lies between two edges of `Γ'`.** Let `f`, `g` be such edges. +They +run from `x` to the vertex `c` of a region `r`. Then `exists_disc_of_corner` gives a closed disc in +`r ∪ {x}` with boundary `closure f ∪ closure g`, against condition (iv). -/ +theorem corner_has_edge {γ : Set S → I → S} (hγ : EdgePar (radialUnion hrad) γ) {x : S} + (hx : x ∈ Γ.V) {next : halfEdges (radialUnion hrad) γ x → halfEdges (radialUnion hrad) γ x} + {ρ P Q : halfEdges (radialUnion hrad) γ x → Set S} {W : Set S} + {τ : halfEdges (radialUnion hrad) γ x → I} + (hsec : IsSectors (radialUnion hrad) γ x next ρ P W Q τ) (k : halfEdges (radialUnion hrad) γ x) + (hk : k.1.1 ∈ Γ'.E) (hn : (next k).1.1 ∈ Γ'.E) : False := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hcor := IsSectors.corners hsec + have hpR : ρ k ∈ (radialUnion hrad).R := IsCorners.region hcor k + obtain ⟨r, hr, hpr⟩ := exists_region_of_sub hrad hpR + obtain ⟨c, ⟨hc, hcV⟩, -⟩ := hrad.2.2.2.1 r hr + have hxU : x ∉ r := fun h => region_subset hr h (Γ.V_subset_U hx) + have hxc : x ≠ c := fun h => hxU (h ▸ hc) + have hcH : c ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact hcV + obtain ⟨j, hj⟩ := next_surjective hcor k + have hkcl : k.1.1 ⊆ closure (ρ k) := by + have := IsCorners.right hcor j + rwa [hj] at this + have hncl : (next k).1.1 ⊆ closure (ρ k) := IsCorners.left hcor k + have hxk : x ∈ closure k.1.1 := by + have := end_mem_closure hγ k.2.1 k.1.2 + rwa [k.2.2] at this + have hxn : x ∈ closure (next k).1.1 := by + have := end_mem_closure hγ (next k).2.1 (next k).1.2 + rwa [(next k).2.2] at this + obtain ⟨hcapk, -, hrk⟩ := spoke_facts hrad hS hk hr hpr hkcl hc hcV hx hxk + obtain ⟨hcapn, -, hrn⟩ := spoke_facts hrad hS hn hr hpr hncl hc hcV hx hxn + have hclk : c ∈ closure k.1.1 ∩ Γ'.V := by rw [hcapk]; simp + have hcln : c ∈ closure (next k).1.1 ∩ Γ'.V := by rw [hcapn]; simp + obtain ⟨G₁, hG₁, hi₁, h₁0, h₁1, hr₁, hs₁⟩ := exists_edge_path hγ k hxc hcH hclk.1 + obtain ⟨G₂, hG₂, hi₂, h₂0, h₂1, hr₂, hs₂⟩ := exists_edge_path hγ (next k) hxc hcH hcln.1 + have hne : k.1.1 ≠ (next k).1.1 := by + intro he + have hb : k.1.2 ≠ (next k).1.2 := fun h => + IsSectors.next_ne hsec k (Subtype.ext (Prod.ext he.symm h.symm)) + obtain ⟨b', hb'⟩ := exists_end_eq hγ k.2.1 hcH hclk.1 + have hk₂ := k.2.2 + have hn₂ := (next k).2.2 + rw [← he] at hn₂ + have : b' = k.1.2 ∨ b' = (next k).1.2 := by + revert hb + cases b' <;> cases k.1.2 <;> cases (next k).1.2 <;> simp + rcases this with h | h + · rw [h] at hb' + exact hxc (hk₂.symm.trans hb') + · rw [h] at hb' + exact hxc (hn₂.symm.trans hb') + have hmeet : range G₁ ∩ range G₂ ⊆ {x, c} := by + rw [hr₁, hr₂, ← hcapk] + exact fun y hy => ⟨hy.1, closure_inter_subset_V hk hn hne hy⟩ + have hU₁ : closure k.1.1 ⊆ (radialUnion hrad).U := fun y hy => + Or.inr (Γ'.closure_subset_U hk hy) + have hU₂ : closure (next k).1.1 ⊆ (radialUnion hrad).U := fun y hy => + Or.inr (Γ'.closure_subset_U hn hy) + have hsnz : ∀ {G : I → S}, G 0 = x → Function.Injective G → ∀ s, s ≠ 0 → G s ≠ x := + fun h0 hi s hs h => hs (hi (h.trans h0.symm)) + obtain ⟨Δ, hΔ, hsub, hb⟩ := exists_disc_of_corner hS (IsSectors.disc hsec k) + (IsSectors.bd hsec k) (IsSectors.isOpen hsec) (IsSectors.mem hsec) (hrad.1.2 r hr) hxU hG₁ hG₂ + hi₁ hi₂ h₁0 h₂0 h₁1 h₂1 hmeet + (fun s hs => hrk _ (hr₁ ▸ ⟨s, rfl⟩) (hsnz h₁0 hi₁ s hs)) + (fun s hs => hrn _ (hr₂ ▸ ⟨s, rfl⟩) (hsnz h₂0 hi₂ s hs)) + (ρ' := ρ k) (fun y hyW hyQ hyb => IsSectors.sub hsec k (IsSectors.inside hsec k ⟨⟨hyW, hyQ⟩, + hyb⟩)) + hpr + (disjoint_left.mpr fun y hy h => region_subset hpR hy (hU₁ (hr₁ ▸ h))) + (disjoint_left.mpr fun y hy h => region_subset hpR hy (hU₂ (hr₂ ▸ h))) + (halfT_pos (IsSectors.pos hsec k)) (halfT_pos (IsSectors.pos hsec (next k))) + (halfT_lt_one _) (halfT_lt_one _) + (fun s hs => by + obtain ⟨t, ht, rfl⟩ := exists_halfT_eq hs + rw [← hs₁] + exact IsSectors.left hsec k t ht) + (fun s hs => by + obtain ⟨t, ht, rfl⟩ := exists_halfT_eq hs + rw [← hs₂] + exact IsSectors.right hsec k t ht) + rw [hr₁, hr₂] at hb + exact no_bigon hrad hS hk hn hne hx hr hc hcV hcapk hcapn hΔ hsub hb + +omit [ConnectedSpace S] in +/-- **At the vertex of a region of `Γ`, different corners lie in different regions of `H`.** If two +corners lie in the same region of `H`, an `O`-arc `J` runs through `c` and these two corners, inside +a +region `r` of `Γ`. It bounds a closed disc in the open disc `r`. No edge of `Γ'` enters this disc, +because each one ends outside `r`. So the disc is on just one side of `J` at `c`, and it lies in one +sector at `c`. But `J` runs along both corners. -/ +theorem corner_regions_ne {γ : Set S → I → S} {r : Set S} (hr : r ∈ Γ.R) {c : S} (hc : c ∈ r) + (hcV : c ∈ Γ'.V) + {next : halfEdges (radialUnion hrad) γ c → halfEdges (radialUnion hrad) γ c} + {ρ P Q : halfEdges (radialUnion hrad) γ c → Set S} {W : Set S} + {τ : halfEdges (radialUnion hrad) γ c → I} + (hsec : IsSectors (radialUnion hrad) γ c next ρ P W Q τ) + {k k' : halfEdges (radialUnion hrad) γ c} (hkk : k ≠ k') : ρ k ≠ ρ k' := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hcor := IsSectors.corners hsec + have hpR : ρ k ∈ (radialUnion hrad).R := IsCorners.region hcor k + have hcH : c ∈ (radialUnion hrad).U := Or.inr (Γ'.V_subset_U hcV) + have hdisH : Disjoint (ρ k) Γ.U := disjoint_left.mpr fun y hy h => region_subset hpR hy (Or.inl h) + obtain ⟨y₀, hy₀r, hy₀⟩ := mem_closure_iff.mp (IsCorners.closure_v hcor k) r (region_isOpen hr) hc + have hpr : ρ k ⊆ r := subset_region hr (region_isPreconnected hpR) hdisH hy₀ hy₀r + refine corner_regions_ne_of_free_disc hS hcH hsec hkk ?_ + intro J hJ hcJ hJp + have hJr : J ⊆ r := fun y hy => by + rcases hJp y hy with h | h + · exact h ▸ hc + · exact hpr h + obtain ⟨Δ, hΔr, hΔ, hb⟩ := exists_disc_in_openDisc (hrad.1.2 r hr) hJ hJr + have hcb : c ∈ discBd Δ := hb.symm ▸ hcJ + -- The interior of `Δ` misses `H`. + have hfree : Disjoint (Δ \ discBd Δ) (radialUnion hrad).U := by + refine disjoint_left.mpr ?_ + rintro y ⟨hyΔ, hyb⟩ (hyU | hyU) + · exact region_subset hr (hΔr hyΔ) hyU + by_cases hyV : y ∈ Γ'.V + · exact hyb ((hub_unique hrad hr hc hcV (hΔr hyΔ) hyV) ▸ hcb) + rw [Γ'.U_eq] at hyU + rcases hyU with h' | hyE + · exact hyV h' + obtain ⟨g, hg, hyg'⟩ := mem_iUnion₂.mp hyE + have hyg : y ∈ g := (Γ'.closure_diff_V hg).subset ⟨hyg', hyV⟩ + have hgb : Disjoint g (frontier Δ) := by + rw [IsClosedDisc.frontier_eq_discBd hS hΔ, hb] + refine disjoint_left.mpr fun z hz hzJ => ?_ + rcases hJp z hzJ with h | h + · exact edge_notMem_V hg hz (h ▸ hcV) + · exact region_subset hpR h (Or.inr (Γ'.closure_subset_U hg (subset_closure hz))) + have hgΔ : g ⊆ Δ := by + rcases subset_or_disjoint_of_frontier hΔ.isClosed hg.2.2.1.isConnected.isPreconnected hgb with + h' | h' + · exact h' + · exact (disjoint_left.mp h' hyg hyΔ).elim + obtain ⟨v, hv, -, -, w, -, -, hcap, -⟩ := spoke_ends hrad hS hg + have hvcl : v ∈ closure g ∩ Γ'.V := by rw [hcap]; simp + exact region_subset hr (hΔr (closure_minimal hgΔ hΔ.isClosed hvcl.1)) (Γ.V_subset_U hv) + exact ⟨Δ, hΔ, hb, hfree⟩ + +omit [ConnectedSpace S] [T2Space S] hS in +/-- No set is an edge of both `Γ` and `Γ'`. -/ +theorem edge_not_both {e : Set S} (he : e ∈ Γ.E) (he' : e ∈ Γ'.E) : False := by + obtain ⟨y, hy⟩ := he.1 + exact disjoint_left.mp (edge_disjoint hrad he) hy (Γ'.closure_subset_U he' (subset_closure hy)) + +omit [ConnectedSpace S] [T2Space S] hS in +/-- An edge of `H` is an edge of `Γ` or an edge of `Γ'`. -/ +theorem edge_cases {γ : Set S → I → S} {x : S} (k : halfEdges (radialUnion hrad) γ x) : + k.1.1 ∈ Γ.E ∨ k.1.1 ∈ Γ'.E := by + have := k.2.1 + rwa [radialUnion_E] at this + +/-- Exactly one side of a corner at a vertex of `Γ` is an edge of `Γ'`. -/ +theorem corner_alternates (hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ') + (hE : Γ.E.Nonempty) {γ : Set S → I → S} + (hγ : EdgePar (radialUnion hrad) γ) {x : S} (hx : x ∈ Γ.V) + {next : halfEdges (radialUnion hrad) γ x → halfEdges (radialUnion hrad) γ x} + {ρ P Q : halfEdges (radialUnion hrad) γ x → Set S} {W : Set S} + {τ : halfEdges (radialUnion hrad) γ x → I} + (hsec : IsSectors (radialUnion hrad) γ x next ρ P W Q τ) + (k : halfEdges (radialUnion hrad) γ x) : + (k.1.1 ∈ Γ'.E ∧ (next k).1.1 ∈ Γ.E) ∨ (k.1.1 ∈ Γ.E ∧ (next k).1.1 ∈ Γ'.E) := by + rcases corner_has_spoke hrad hS hmax hE hγ hx hsec k with h | h + · refine Or.inl ⟨h, (edge_cases hrad (next k)).resolve_right fun h' => ?_⟩ + exact corner_has_edge hrad hS hγ hx hsec k h h' + · refine Or.inr ⟨(edge_cases hrad k).resolve_right fun h' => ?_, h⟩ + exact corner_has_edge hrad hS hγ hx hsec k h' h + +/-- The half-edge `a` lies next to the half-edge `φ` in the rotation, with the corner between them +in +the region `p`. -/ +def IsAdj {H : Drawing S} {γ : Set S → I → S} {x : S} (next : halfEdges H γ x → halfEdges H γ x) + (ρ : halfEdges H γ x → Set S) (p : Set S) (φ a : halfEdges H γ x) : Prop := + (next φ = a ∧ ρ φ = p) ∨ (next a = φ ∧ ρ a = p) + +/-- A half-edge of `Γ` in the closure of a region of `H` lies next to a half-edge of `Γ'`, with the +corner between them in that region. -/ +theorem exists_adj (hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ') (hE : Γ.E.Nonempty) {γ : Set S + → I → S} + (hγ : EdgePar (radialUnion hrad) γ) {x : S} (hx : x ∈ Γ.V) + {next : halfEdges (radialUnion hrad) γ x → halfEdges (radialUnion hrad) γ x} + {ρ P Q : halfEdges (radialUnion hrad) γ x → Set S} {W : Set S} + {τ : halfEdges (radialUnion hrad) γ x → I} + (hsec : IsSectors (radialUnion hrad) γ x next ρ P W Q τ) + (i : halfEdges (radialUnion hrad) γ x) (hi : i.1.1 ∈ Γ.E) {p : Set S} + (hp : p ∈ (radialUnion hrad).R) (hip : i.1.1 ⊆ closure p) : + ∃ φ, φ.1.1 ∈ Γ'.E ∧ φ.1.1 ⊆ closure p ∧ IsAdj next ρ p φ i := by + have hcor := IsSectors.corners hsec + have hsurj := next_surjective hcor + have hsidecl : ∀ k, k.1.1 ⊆ closure (ρ k) := fun k => by + obtain ⟨j, hj⟩ := hsurj k + have := IsCorners.right hcor j + rwa [hj] at this + obtain ⟨j, hj⟩ := hsurj i + rcases IsCorners.sides hcor j p hp (hj ▸ hip) with h | h + · rcases corner_alternates hrad hS hmax hE hγ hx hsec j with ⟨h₁, -⟩ | ⟨-, h₂⟩ + · exact ⟨j, h₁, h ▸ hsidecl j, Or.inl ⟨hj, h.symm⟩⟩ + · exact (edge_not_both hrad hi (hj ▸ h₂)).elim + · rw [hj] at h + rcases corner_alternates hrad hS hmax hE hγ hx hsec i with ⟨h₁, -⟩ | ⟨-, h₂⟩ + · exact (edge_not_both hrad hi h₁).elim + · exact ⟨next i, h₂, h ▸ IsCorners.left hcor i, Or.inr ⟨rfl, h.symm⟩⟩ + +omit hrad hS [T2Space S] [ConnectedSpace S] in +/-- If a half-edge has different regions on its two sides, then at most one half-edge lies next to +it +with its corner in a given region. -/ +theorem adj_unique {H : Drawing S} {γ : Set S → I → S} {x : S} + {next : halfEdges H γ x → halfEdges H γ x} {ρ : halfEdges H γ x → Set S} + (hcor : IsCorners H γ x next ρ) {φ a₁ a₂ : halfEdges H γ x} {p A₁ A₂ : Set S} + (hA₁ : A₁ ∈ H.R) (hA₂ : A₂ ∈ H.R) (hne : A₁ ≠ A₂) (h₁ : φ.1.1 ⊆ closure A₁) + (h₂ : φ.1.1 ⊆ closure A₂) (ha₁ : IsAdj next ρ p φ a₁) (ha₂ : IsAdj next ρ p φ a₂) : + a₁ = a₂ := by + have key : ∀ j, next j = φ → ρ j ≠ ρ φ := by + rintro j rfl h + rcases IsCorners.sides hcor j A₁ hA₁ h₁ with e₁ | e₁ <;> + rcases IsCorners.sides hcor j A₂ hA₂ h₂ with e₂ | e₂ + all_goals first + | exact hne (e₁.trans e₂.symm) + | exact hne (e₁.trans (h ▸ e₂.symm)) + rcases ha₁ with ⟨h₃, h₄⟩ | ⟨h₃, h₄⟩ <;> rcases ha₂ with ⟨h₅, h₆⟩ | ⟨h₅, h₆⟩ + · exact h₃.symm.trans h₅ + · exact (key a₂ h₅ (h₆.trans h₄.symm)).elim + · exact (key a₁ h₃ (h₄.trans h₆.symm)).elim + · exact IsCorners.inj hcor (h₃.trans h₅.symm) + +omit hrad [ConnectedSpace S] in +/-- Only one region has a leaf of a drawing in its closure. -/ +theorem region_eq_at_leaf {H : Drawing S} {γ : Set S → I → S} (hγ : EdgePar H γ) {v : S} + (hv : v ∈ H.V) (k : halfEdges H γ v) (hk : ∀ l : halfEdges H γ v, l = k) {r₁ r₂ : Set S} + (hr₁ : r₁ ∈ H.R) (hr₂ : r₂ ∈ H.R) (h₁ : v ∈ closure r₁) (h₂ : v ∈ closure r₂) : r₁ = r₂ := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨⟨e, b⟩, he, hb⟩ := k + dsimp only at he hb + have hve : v ∈ closure e := hb ▸ end_mem_closure hγ he b + have hother : γ e (endOf (!b)) ≠ v := by + intro h + have := congrArg (fun x => x.1.2) (hk ⟨(e, !b), he, h⟩) + simp at this + have hleaf : ∀ f ∈ H.E, f ≠ e → v ∉ closure f := by + intro f hf hfe hvf + obtain ⟨c, hc⟩ := exists_end_eq hγ hf hv hvf + exact hfe (congrArg (fun x => x.1.1) (hk ⟨(f, c), hf, hc⟩)) + have hu : γ e (endOf (!b)) ∈ closure e := end_mem_closure hγ he _ + have huV := end_mem_V hγ he (!b) + set u := γ e (endOf (!b)) with hudef + have hcase : closure e ∩ H.V = {u, v} ∧ IsLineWithEnds (closure e) u v := by + rcases H.edge_cond e he with ⟨x, y, hxy, hcap, hL⟩ | ⟨x, hcap, -⟩ + · have hu' : u ∈ ({x, y} : Set S) := hcap ▸ ⟨hu, huV⟩ + have hv' : v ∈ ({x, y} : Set S) := hcap ▸ ⟨hve, hv⟩ + rcases hu' with rfl | rfl <;> rcases hv' with rfl | rfl + · exact absurd rfl hother + · exact ⟨hcap, hL⟩ + · exact ⟨by rw [hcap, pair_comm], GraphMinor.GM11.IsLineWithEnds.symm hL⟩ + · exact absurd rfl hother + · have hu' : u ∈ ({x} : Set S) := hcap ▸ ⟨hu, huV⟩ + have hv' : v ∈ ({x} : Set S) := hcap ▸ ⟨hve, hv⟩ + exact absurd ((mem_singleton_iff.mp hu').trans (mem_singleton_iff.mp hv').symm) hother + obtain ⟨Z, hZ, hvZ, hsame⟩ := + exists_leaf_nbhd hS H he hother hcase.1 hcase.2 hleaf isOpen_univ (mem_univ _) + obtain ⟨x, hxZ, hx⟩ := mem_closure_iff.mp h₁ Z hZ hvZ + obtain ⟨y, hyZ, hy⟩ := mem_closure_iff.mp h₂ Z hZ hvZ + obtain ⟨A, hA, hdis, hxA, hyA⟩ := hsame x hxZ (region_subset hr₁ hx) y hyZ (region_subset hr₂ hy) + exact region_eq_of_mem hr₁ hr₂ (subset_region hr₁ hA hdis hxA hx hyA.1) hy + +omit [T2Space S] [ConnectedSpace S] hS in +/-- A half-edge of `H` at a vertex of `Γ'` in a region `r` belongs to an edge of `Γ'`. -/ +theorem hub_half_spoke {γ : Set S → I → S} {r : Set S} (hr : r ∈ Γ.R) {c : S} (hc : c ∈ r) + (i : halfEdges (radialUnion hrad) γ c) (hγ : EdgePar (radialUnion hrad) γ) : i.1.1 ∈ Γ'.E := by + refine (edge_cases hrad i).resolve_left fun h => ?_ + have hcl : c ∈ closure i.1.1 := by + have := end_mem_closure hγ i.2.1 i.1.2 + rwa [i.2.2] at this + exact region_subset hr hc (Γ.closure_subset_U h hcl) + +/-- The sides at the vertex of a region: the edges of `Γ'` in the closure of a region `p` of `H` are +one or two, and if two, each of them has different regions on its two sides. -/ +theorem hub_sides (hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ') (hE : Γ.E.Nonempty) {r p : Set + S} (hr : r ∈ Γ.R) + (hp : p ∈ (radialUnion hrad).R) (hpr : p ⊆ r) : + ∃ f g : Set S, f ∈ Γ'.E ∧ g ∈ Γ'.E ∧ f ⊆ closure p ∧ g ⊆ closure p ∧ + (∀ s ∈ Γ'.E, s ⊆ closure p → s = f ∨ s = g) ∧ + (f = g ∨ ∀ s, (s = f ∨ s = g) → ∃ A₁ ∈ (radialUnion hrad).R, ∃ A₂ ∈ (radialUnion hrad).R, + A₁ ≠ A₂ ∧ s ⊆ closure A₁ ∧ s ⊆ closure A₂) := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨c, ⟨hc, hcV⟩, -⟩ := hrad.2.2.2.1 r hr + have hne : Nonempty S := ⟨c⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar (radialUnion hrad) + have hcH : c ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact hcV + have hcp := hub_mem_closure hrad hS hr hp hpr hc hcV + obtain ⟨k₀, hk₀⟩ := exists_half_at_hub hrad hS hmax hE hγ hr hc hcV + let k : halfEdges (radialUnion hrad) γ c := ⟨k₀, hk₀⟩ + have hspoke : ∀ i : halfEdges (radialUnion hrad) γ c, i.1.1 ∈ Γ'.E := fun i => + hub_half_spoke hrad hr hc i hγ + have hcl : ∀ i : halfEdges (radialUnion hrad) γ c, c ∈ closure i.1.1 := fun i => by + have := end_mem_closure hγ i.2.1 i.1.2 + rwa [i.2.2] at this + -- An edge of `Γ'` in the closure of `p` has a half-edge at `c`. + have hathub : ∀ s ∈ Γ'.E, s ⊆ closure p → ∃ i : halfEdges (radialUnion hrad) γ c, i.1.1 = s := by + intro s hs hsp + obtain ⟨v, hv, r', hr', w, hwr, hwV, hcap, hsubr⟩ := spoke_ends hrad hS hs + obtain ⟨q, hq⟩ := hs.1 + obtain ⟨z, hz', hz⟩ := mem_closure_iff.mp (hsp hq) r' (region_isOpen hr') (hsubr hq) + obtain rfl : r' = r := region_eq_of_mem hr' hr hz' (hpr hz) + obtain rfl : w = c := hub_unique hrad hr hc hcV hwr hwV + have hwcl : w ∈ closure s ∩ Γ'.V := by rw [hcap]; simp + have hsH : s ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inr hs + obtain ⟨b, hb⟩ := exists_end_eq hγ hsH hcH hwcl.1 + exact ⟨⟨(s, b), hsH, hb⟩, rfl⟩ + by_cases h2 : 2 ≤ Nat.card (halfEdges (radialUnion hrad) γ c) + · obtain ⟨next, ρ, P, W, Q, τ, hsec⟩ := exists_sectors hS _ hγ hcH h2 + have hcor := IsSectors.corners hsec + obtain ⟨j, rfl⟩ := IsCorners.all hcor p hp hcp + have hsurj := next_surjective hcor + have hinj : ∀ {a b}, a ≠ b → ρ a ≠ ρ b := fun hab => + corner_regions_ne hrad hS hr hc hcV hsec hab + have hsidecl : ∀ i, i.1.1 ⊆ closure (ρ i) := fun i => by + obtain ⟨l, hl⟩ := hsurj i + have := IsCorners.right hcor l + rwa [hl] at this + obtain ⟨l, hl⟩ := hsurj j + refine ⟨j.1.1, (next j).1.1, hspoke j, hspoke _, hsidecl j, IsCorners.left hcor j, ?_, + Or.inr ?_⟩ + · intro s hs hsp + obtain ⟨i, rfl⟩ := hathub s hs hsp + obtain ⟨m, rfl⟩ := hsurj i + rcases IsCorners.sides hcor m (ρ j) (IsCorners.region hcor j) hsp with h | h + · by_cases hmj : j = m + · subst hmj + exact Or.inr rfl + · exact (hinj hmj h).elim + · by_cases hmj : j = next m + · rw [← hmj] + exact Or.inl rfl + · exact (hinj hmj h).elim + · rintro s (rfl | rfl) + · refine ⟨ρ l, IsCorners.region hcor l, ρ j, IsCorners.region hcor j, ?_, ?_, hsidecl j⟩ + · refine hinj fun h => IsSectors.next_ne hsec l (hl.trans h.symm) + · have := IsCorners.left hcor l + rwa [hl] at this + · exact ⟨ρ j, IsCorners.region hcor j, ρ (next j), IsCorners.region hcor _, + hinj (IsSectors.next_ne hsec j).symm, IsCorners.left hcor j, IsCorners.right hcor j⟩ + · have hsingle : ∀ l : halfEdges (radialUnion hrad) γ c, l = k := by + intro l + by_contra hl + apply h2 + have hfin := finite_halfEdges (radialUnion hrad) γ c + have hne' : l.1 ≠ k.1 := fun h => hl (Subtype.ext h) + exact (one_lt_ncard hfin).mpr ⟨l.1, l.2, k.1, k.2, hne'⟩ + obtain ⟨A, hA, hkA⟩ := exists_region_incident hS k.2.1 + have hcA : c ∈ closure A := closure_minimal hkA isClosed_closure (hcl k) + obtain rfl : A = p := region_eq_at_leaf hS hγ hcH k hsingle hA hp hcA hcp + refine ⟨k.1.1, k.1.1, hspoke k, hspoke k, hkA, hkA, ?_, Or.inl rfl⟩ + intro s hs hsp + obtain ⟨i, rfl⟩ := hathub s hs hsp + exact Or.inl (by rw [hsingle i]) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/RadialFacts.lean b/LeanPool/GraphMinor/GM11/RadialFacts.lean new file mode 100644 index 0000000000..74e4096a76 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/RadialFacts.lean @@ -0,0 +1,394 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialFaces +public import LeanPool.GraphMinor.GM11.Section6 + +/-! +# Each region of a radial drawing contains a unique edge + +This file finishes the proof of the sentence of Graph Minors XI (Section 3, page 75), for a radial +drawing `Γ'` of a 2-cell drawing `Γ` with an edge: every region of `Γ'` contains a unique edge of +`Γ`. +More precisely, `regionFacts_of_radial` gives `RegionFacts Γ Γ'`, which also says that a vertex of +`Γ` +in the closure of a region of `Γ'` is an end of its edge. + +Let `H` be the union of `Γ` and `Γ'`. First, the closure of each region of `H` contains exactly one +edge of `Γ` (`face_edge`). The reason is a count of half-edges. Each half-edge of `Γ` in the closure +of a region `p` of `H` lies next to an edge of `Γ'` in the rotation at its end, with the corner +between +them in `p`, and `p` has at most two such positions. Then each region of `Γ'` is the union of one +edge +of `Γ` with the regions of `H` whose closure contains that edge. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] {Γ Γ' : Drawing S} [T2Space S] [ConnectedSpace S] + (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') (hS : IsClosedSurface S) + (hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ') + +include hrad hS + +include hmax in +/-- A vertex of `Γ` has at least two half-edges in `H`: one of `Γ` and one of `Γ'`. -/ +theorem two_half_edges (hE : Γ.E.Nonempty) {γ : Set S → I → S} (hγ : EdgePar (radialUnion hrad) γ) + {x : S} (hx : x ∈ Γ.V) : 2 ≤ Nat.card (halfEdges (radialUnion hrad) γ x) := by + obtain ⟨e₀, he₀, hxe₀⟩ := exists_edge_at hrad hS hE hx + obtain ⟨r, hr, he₀r⟩ := exists_region_incident hS he₀ + obtain ⟨c, ⟨hc, hcV⟩, -⟩ := hrad.2.2.2.1 r hr + obtain ⟨h, hh, hcap⟩ := exists_spoke_at hrad hmax hS hE hr hc hcV hx + (closure_minimal he₀r isClosed_closure hxe₀) + have hxH : x ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact radial_V hrad hx + have he₀H : e₀ ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inl he₀ + have hhH : h ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inr hh + have hxh : x ∈ closure h ∩ Γ'.V := by rw [hcap]; simp + obtain ⟨b₁, hb₁⟩ := exists_end_eq hγ he₀H hxH hxe₀ + obtain ⟨b₂, hb₂⟩ := exists_end_eq hγ hhH hxH hxh.1 + have hfin := finite_halfEdges (radialUnion hrad) γ x + refine (one_lt_ncard hfin).mpr ⟨(e₀, b₁), ⟨he₀H, hb₁⟩, (h, b₂), ⟨hhH, hb₂⟩, fun he => ?_⟩ + have he' : e₀ = h := congrArg Prod.fst he + exact edge_not_both hrad he₀ (he' ▸ hh) + +omit [ConnectedSpace S] in +/-- An edge of `Γ'` has just one end in `V(Γ)`, and just one half-edge there. -/ +theorem spoke_half_unique {s : Set S} (hs : s ∈ Γ'.E) {γ : Set S → I → S} + (hγ : EdgePar (radialUnion hrad) γ) : + ∃ x : Γ.V, ∃ φ : halfEdges (radialUnion hrad) γ x.1, φ.1.1 = s ∧ + ∀ (x' : Γ.V) (φ' : halfEdges (radialUnion hrad) γ x'.1), φ'.1.1 = s → x' = x ∧ φ'.1 = φ.1 + := by + obtain ⟨v, hv, r, hr, w, hwr, hwV, hcap, -⟩ := spoke_ends hrad hS hs + have hvcl : v ∈ closure s ∩ Γ'.V := by rw [hcap]; simp + have hwcl : w ∈ closure s ∩ Γ'.V := by rw [hcap]; simp + have hsH : s ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inr hs + have hvH : v ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact hvcl.2 + have hwH : w ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact hwV + obtain ⟨b, hb⟩ := exists_end_eq hγ hsH hvH hvcl.1 + obtain ⟨b', hb'⟩ := exists_end_eq hγ hsH hwH hwcl.1 + have hvw : v ≠ w := fun h => notMem_V_of_mem_region hr hwr (h ▸ hv) + have hbb : b' = !b := by + cases b <;> cases b' <;> first | rfl | exact (hvw (hb.symm.trans hb')).elim + refine ⟨⟨v, hv⟩, ⟨(s, b), hsH, hb⟩, rfl, ?_⟩ + rintro ⟨x', hx'⟩ ⟨⟨s', c⟩, hs', hc⟩ rfl + dsimp only at hs' hc ⊢ + have hm : x' ∈ ({v, w} : Set S) := hcap ▸ ⟨hc ▸ end_mem_closure hγ hs' c, radial_V hrad hx'⟩ + have hx'v : x' = v := by + rcases hm with h | h + · exact h + · exact (notMem_V_of_mem_region hr hwr (h ▸ hx')).elim + subst hx'v + refine ⟨rfl, ?_⟩ + have hcb : c = b := by + subst hbb + cases b <;> cases c <;> first | rfl | exact (hvw (hc.symm.trans hb')).elim + rw [hcb] + +include hmax in +/-- **The closure of each region of `H` contains exactly one edge of `Γ`.** It also contains no +vertex +of `Γ` other than the ends of that edge. -/ +theorem face_edge (hE : Γ.E.Nonempty) {p : Set S} (hp : p ∈ (radialUnion hrad).R) : + ∃ e ∈ Γ.E, e ⊆ closure p ∧ (∀ e' ∈ Γ.E, e' ⊆ closure p → e' = e) ∧ + ∀ v ∈ Γ.V, v ∈ closure p → v ∈ closure e := by + classical + obtain ⟨y₀, -⟩ := region_nonempty hp + have hne : Nonempty S := ⟨y₀⟩ + obtain ⟨r, hr, hpr⟩ := exists_region_of_sub hrad hp + obtain ⟨γ, hγ⟩ := exists_edgePar (radialUnion hrad) + obtain ⟨f, g, hf, hg, hfp, hgp, hall, hsides⟩ := hub_sides hrad hS hmax hE hr hp hpr + have hsec : ∀ x : Γ.V, ∃ next ρ P W Q τ, IsSectors (radialUnion hrad) γ x.1 next ρ P W Q τ := + fun x => exists_sectors hS _ hγ + (by rw [radialUnion_V]; exact radial_V hrad x.2) (two_half_edges hrad hS hmax hE hγ x.2) + choose next ρ P W Q τ hs using hsec + have hcor : ∀ x, IsCorners (radialUnion hrad) γ x.1 (next x) (ρ x) := fun x => + IsSectors.corners (hs x) + have hsurj : ∀ x, Function.Surjective (next x) := fun x => next_surjective (hcor x) + have hsidecl : ∀ x i, i.1.1 ⊆ closure (ρ x i) := fun x i => by + obtain ⟨l, hl⟩ := hsurj x i + have := IsCorners.right (hcor x) l + rwa [hl] at this + -- The half-edges of `Γ` next to the edge `s` of `Γ'`, with the corner in `p`. + let Cand : Set S → Set S × Bool → Prop := fun s a => + ∃ (x : Γ.V) (φ i : halfEdges (radialUnion hrad) γ x.1), φ.1.1 = s ∧ i.1 = a ∧ + IsAdj (next x) (ρ x) p φ i + have hcand : ∀ e ∈ Γ.E, e ⊆ closure p → ∀ b, Cand f (e, b) ∨ Cand g (e, b) := by + intro e he hep b + have heH : e ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inl he + have hxU : γ e (endOf b) ∈ Γ.U := Γ.closure_subset_U he (end_mem_closure hγ heH b) + have hxV' : γ e (endOf b) ∈ Γ'.V := by + have := end_mem_V hγ heH b + rwa [radialUnion_V] at this + have hxV : γ e (endOf b) ∈ Γ.V := + radial_inter hrad ▸ ⟨hxU, Γ'.V_subset_U hxV'⟩ + let x : Γ.V := ⟨_, hxV⟩ + let i : halfEdges (radialUnion hrad) γ x.1 := ⟨(e, b), heH, rfl⟩ + obtain ⟨φ, hφ, hφp, hadj⟩ := exists_adj hrad hS hmax hE hγ hxV (hs x) i he hp hep + rcases hall _ hφ hφp with h | h + · exact Or.inl ⟨x, φ, i, h, rfl, hadj⟩ + · exact Or.inr ⟨x, φ, i, h, rfl, hadj⟩ + have hunique : ∀ s ∈ Γ'.E, s ⊆ closure p → (∃ A₁ ∈ (radialUnion hrad).R, + ∃ A₂ ∈ (radialUnion hrad).R, A₁ ≠ A₂ ∧ s ⊆ closure A₁ ∧ s ⊆ closure A₂) → + ∃ b, ∀ a, Cand s a → a = b := by + rintro s hs' - ⟨A₁, hA₁, A₂, hA₂, hne', h₁, h₂⟩ + by_cases hex : ∃ a, Cand s a + · obtain ⟨a, x, φ, i, hφ, hia, hadj⟩ := hex + refine ⟨a, ?_⟩ + rintro a' ⟨x', φ', i', hφ', hia', hadj'⟩ + obtain ⟨x₀, φ₀, -, huniq⟩ := spoke_half_unique hrad hS hs' hγ + obtain ⟨e₁, e₂⟩ := huniq x φ hφ + obtain ⟨e₃, e₄⟩ := huniq x' φ' hφ' + subst e₁ + subst e₃ + have hφφ : φ' = φ := Subtype.ext (e₄.trans e₂.symm) + subst hφφ + rw [← hia, ← hia'] + exact congrArg Subtype.val (adj_unique (hcor _) hA₁ hA₂ hne' (hφ ▸ h₁) (hφ ▸ h₂) hadj' hadj) + · exact ⟨(∅, false), fun a ha => (hex ⟨a, ha⟩).elim⟩ + have htwo : ∀ s ∈ Γ'.E, ∃ b₁ b₂, ∀ a, Cand s a → a = b₁ ∨ a = b₂ := by + intro s hs' + obtain ⟨x, φ, hφ, huniq⟩ := spoke_half_unique hrad hS hs' hγ + refine ⟨(next x φ).1, (Function.surjInv (hsurj x) φ).1, ?_⟩ + rintro a ⟨x', φ', i, hφ', hia, hadj⟩ + obtain ⟨e₁, e₂⟩ := huniq x' φ' hφ' + subst e₁ + have hφφ : φ' = φ := Subtype.ext e₂ + subst hφφ + rcases hadj with ⟨h, -⟩ | ⟨h, -⟩ + · exact Or.inl (by rw [← hia, h]) + · refine Or.inr ?_ + rw [← hia] + have : i = Function.surjInv (hsurj x') φ' := + IsCorners.inj (hcor x') (h.trans (Function.surjInv_eq (hsurj x') φ').symm) + rw [this] + have hbound : ∃ b₁ b₂ : Set S × Bool, ∀ e ∈ Γ.E, e ⊆ closure p → ∀ b : Bool, + (e, b) = b₁ ∨ (e, b) = b₂ := by + rcases hsides with rfl | hsides + · obtain ⟨b₁, b₂, h⟩ := htwo f hf + exact ⟨b₁, b₂, fun e he hep b => (hcand e he hep b).elim (h _) (h _)⟩ + · obtain ⟨b₁, h₁⟩ := hunique f hf hfp (hsides f (Or.inl rfl)) + obtain ⟨b₂, h₂⟩ := hunique g hg hgp (hsides g (Or.inr rfl)) + exact ⟨b₁, b₂, fun e he hep b => (hcand e he hep b).elim (fun h => Or.inl (h₁ _ h)) + fun h => Or.inr (h₂ _ h)⟩ + obtain ⟨b₁, b₂, hb⟩ := hbound + have huniq : ∀ e ∈ Γ.E, e ⊆ closure p → ∀ e' ∈ Γ.E, e' ⊆ closure p → e' = e := by + intro e he hep e' he' hep' + rcases hb e he hep false with h₁ | h₁ <;> rcases hb e he hep true with h₂ | h₂ <;> + rcases hb e' he' hep' false with h₃ | h₃ + all_goals first + | exact absurd (Prod.ext_iff.mp (h₁.trans h₂.symm)).2 (by simp) + | exact congrArg Prod.fst (h₃.trans h₁.symm) + | exact congrArg Prod.fst (h₃.trans h₂.symm) + -- The edge next to `f` at its end in `V(Γ)`. + obtain ⟨x, φ, hφ, -⟩ := spoke_half_unique hrad hS hf hγ + have hφΓ' : φ.1.1 ∈ Γ'.E := hφ ▸ hf + obtain ⟨j, hj⟩ := hsurj x φ + have hexists : ∃ e ∈ Γ.E, e ⊆ closure p := by + rcases IsCorners.sides (hcor x) j p hp (by rw [hj, hφ]; exact hfp) with h | h + · rcases corner_alternates hrad hS hmax hE hγ x.2 (hs x) j with ⟨-, h₂⟩ | ⟨h₁, -⟩ + · exact (edge_not_both hrad (hj ▸ h₂) hφΓ').elim + · exact ⟨_, h₁, h ▸ hsidecl x j⟩ + · rw [hj] at h + rcases corner_alternates hrad hS hmax hE hγ x.2 (hs x) φ with ⟨-, h₂⟩ | ⟨h₁, -⟩ + · exact ⟨_, h₂, h ▸ IsCorners.left (hcor x) φ⟩ + · exact (edge_not_both hrad h₁ hφΓ').elim + obtain ⟨e, he, hep⟩ := hexists + refine ⟨e, he, hep, fun e' he' hep' => huniq e he hep e' he' hep', ?_⟩ + intro v hv hvp + let z : Γ.V := ⟨v, hv⟩ + obtain ⟨k, rfl⟩ := IsCorners.all (hcor z) p hp hvp + have hkcl : ∀ i : halfEdges (radialUnion hrad) γ z.1, v ∈ closure i.1.1 := fun i => by + have := end_mem_closure hγ i.2.1 i.1.2 + rwa [i.2.2] at this + rcases corner_alternates hrad hS hmax hE hγ hv (hs z) k with ⟨-, h₂⟩ | ⟨h₁, -⟩ + · have := huniq e he hep _ h₂ (IsCorners.left (hcor z) k) + exact this ▸ hkcl (next z k) + · have := huniq e he hep _ h₁ (hsidecl z k) + exact this ▸ hkcl k + +/-- The part of a region `s` of `Γ'` around the edge `e` of `Γ`: the edge, with the regions of `H` +in +`s` whose closure contains it. -/ +def faceUnion (Γ Γ' : Drawing S) (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') (s e : Set S) : + Set S := + e ∪ ⋃ p ∈ {p ∈ (radialUnion hrad).R | p ⊆ s ∧ e ⊆ closure p}, p + +omit [T2Space S] [ConnectedSpace S] in +/-- A region of `H` that meets a region `s` of `Γ'` lies in it. -/ +theorem region_sub_of_mem {s p : Set S} (hs : s ∈ Γ'.R) (hp : p ∈ (radialUnion hrad).R) {y : S} + (hy : y ∈ closure p) (hys : y ∈ s) : p ⊆ s := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨z, hzs, hzp⟩ := mem_closure_iff.mp hy s (region_isOpen hs) hys + refine subset_region hs (region_isPreconnected hp) ?_ hzp hzs + exact disjoint_left.mpr fun w hw h => region_subset hp hw (Or.inr h) + +omit [T2Space S] [ConnectedSpace S] in +/-- An edge of `Γ` that meets the closure of a region `s` of `Γ'` lies in `s`. -/ +theorem edge_sub_of_closure {s e : Set S} (hs : s ∈ Γ'.R) (he : e ∈ Γ.E) {y : S} (hye : y ∈ e) + (hys : y ∈ closure s) : e ⊆ s := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hyU : y ∉ Γ'.U := disjoint_left.mp (edge_disjoint hrad he) hye + obtain ⟨s', hs', hys'⟩ := exists_region_of_notMem hyU + obtain ⟨z, hz', hz⟩ := mem_closure_iff.mp hys s' (region_isOpen hs') hys' + obtain rfl : s' = s := region_eq_of_mem hs' hs hz' hz + exact subset_region hs' he.2.2.1.isConnected.isPreconnected (edge_disjoint hrad he) hye hys' + +omit [ConnectedSpace S] in +theorem isOpen_faceUnion {s e : Set S} (hs : s ∈ Γ'.R) (he : e ∈ Γ.E) (hes : e ⊆ s) : + IsOpen (faceUnion Γ Γ' hrad s e) := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have heH : e ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inl he + refine isOpen_iff_mem_nhds.mpr ?_ + rintro y (hy | hy) + · obtain ⟨W, A₁, A₂, hW, hyW, hWU, hsub, hc₁, hc₂, hd₁, hd₂, hcl₁, hcl₂⟩ := + exists_edge_sides hS (radialUnion hrad) heH hy + refine Filter.mem_of_superset (hW.mem_nhds hyW) fun z hz => ?_ + by_cases hzU : z ∈ (radialUnion hrad).U + · exact Or.inl (hWU ⟨hz, hzU⟩) + refine Or.inr ?_ + -- Each side of `e` near `y` lies in a region of `H` in `s`. + have hside : ∀ A : Set S, IsPreconnected A → Disjoint A (radialUnion hrad).U → + e ∩ W ⊆ closure A → z ∈ A → z ∈ ⋃ p ∈ {p ∈ (radialUnion hrad).R | p ⊆ s ∧ e ⊆ closure p}, p + := by + intro A hA hd hcl hzA + obtain ⟨p, hp, hzp⟩ := exists_region_of_notMem hzU + have hAp : A ⊆ p := subset_region hp hA hd hzA hzp + have hyp : y ∈ closure p := closure_mono hAp (hcl ⟨hy, hyW⟩) + have hpe := edge_subset_closure_of_incident hS heH hp ⟨y, hy, hyp⟩ + exact mem_iUnion₂.mpr ⟨p, ⟨hp, region_sub_of_mem hrad hS hs hp hyp (hes hy), hpe⟩, hzp⟩ + rcases hsub ⟨hz, hzU⟩ with h | h + · exact hside A₁ hc₁ hd₁ hcl₁ h + · exact hside A₂ hc₂ hd₂ hcl₂ h + · obtain ⟨p, hp, hyp⟩ := mem_iUnion₂.mp hy + refine Filter.mem_of_superset ((region_isOpen hp.1).mem_nhds hyp) fun z hz => ?_ + exact Or.inr (mem_iUnion₂.mpr ⟨p, hp, hz⟩) + +include hmax in +/-- A region of `Γ'` is the union of one edge of `Γ` and regions of `H`. -/ +theorem region_eq_faceUnion (hE : Γ.E.Nonempty) {s e : Set S} (hs : s ∈ Γ'.R) (he : e ∈ Γ.E) + (hes : e ⊆ s) : s ⊆ faceUnion Γ Γ' hrad s e := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + -- The rest of `s` is covered by the sets of the other edges in `s`. + let Rest : Set S := ⋃ f ∈ {f ∈ Γ.E | f ⊆ s ∧ f ≠ e}, faceUnion Γ Γ' hrad s f + have hRest : IsOpen Rest := isOpen_biUnion fun f hf => isOpen_faceUnion hrad hS hs hf.1 hf.2.1 + have hcover : s ⊆ faceUnion Γ Γ' hrad s e ∪ Rest := by + have hedge : ∀ f ∈ Γ.E, f ⊆ s → ∀ y ∈ f, y ∈ faceUnion Γ Γ' hrad s e ∪ Rest := by + intro f hf hfs y hy + by_cases hfe : f = e + · exact Or.inl (Or.inl (hfe ▸ hy)) + · exact Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfs, hfe⟩, Or.inl hy⟩) + intro y hy + have hyU' : y ∉ Γ'.U := region_subset hs hy + by_cases hyU : y ∈ Γ.U + · have hyV : y ∉ Γ.V := fun h => hyU' (Γ'.V_subset_U (radial_V hrad h)) + rw [Γ.U_eq] at hyU + rcases hyU with h | hyE + · exact (hyV h).elim + obtain ⟨f, hf, hyf'⟩ := mem_iUnion₂.mp hyE + have hyf : y ∈ f := (Γ.closure_diff_V hf).subset ⟨hyf', hyV⟩ + exact hedge f hf (edge_sub_of_closure hrad hS hs hf hyf (subset_closure hy)) y hyf + · have hyH : y ∉ (radialUnion hrad).U := fun h => h.elim hyU hyU' + obtain ⟨p, hp, hyp⟩ := exists_region_of_notMem hyH + have hps := region_sub_of_mem hrad hS hs hp (subset_closure hyp) hy + obtain ⟨f, hf, hfp, -⟩ := face_edge hrad hS hmax hE hp + obtain ⟨q, hq⟩ := hf.1 + have hfs : f ⊆ s := edge_sub_of_closure hrad hS hs hf hq (closure_mono hps (hfp hq)) + by_cases hfe : f = e + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨p, ⟨hp, hps, hfe ▸ hfp⟩, hyp⟩)) + · exact Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfs, hfe⟩, Or.inr (mem_iUnion₂.mpr + ⟨p, ⟨hp, hps, hfp⟩, hyp⟩)⟩) + have hdisj : Disjoint (faceUnion Γ Γ' hrad s e) Rest := by + refine disjoint_left.mpr ?_ + intro y hy hy' + obtain ⟨f, ⟨hf, -, hfe⟩, hyf⟩ := mem_iUnion₂.mp hy' + have heH : e ⊆ (radialUnion hrad).U := fun z hz => Or.inl (Γ.closure_subset_U he + (subset_closure hz)) + have hfH : f ⊆ (radialUnion hrad).U := fun z hz => Or.inl (Γ.closure_subset_U hf + (subset_closure hz)) + rcases hy with hy | hy <;> rcases hyf with hyf | hyf + · exact hfe (Γ.edge_eq_of_mem hf he hyf hy) + · obtain ⟨p, hp, hyp⟩ := mem_iUnion₂.mp hyf + exact region_subset hp.1 hyp (heH hy) + · obtain ⟨p, hp, hyp⟩ := mem_iUnion₂.mp hy + exact region_subset hp.1 hyp (hfH hyf) + · obtain ⟨p, hp, hyp⟩ := mem_iUnion₂.mp hy + obtain ⟨p', hp', hyp'⟩ := mem_iUnion₂.mp hyf + obtain rfl : p = p' := region_eq_of_mem hp.1 hp'.1 hyp hyp' + obtain ⟨g, -, -, hg, -⟩ := face_edge hrad hS hmax hE hp.1 + exact hfe ((hg f hf hp'.2.2).trans (hg e he hp.2.2).symm) + obtain ⟨y, hy⟩ := he.1 + exact (region_isPreconnected hs).subset_left_of_subset_union + (isOpen_faceUnion hrad hS hs he hes) hRest hdisj hcover ⟨y, hes hy, Or.inl hy⟩ + +include hmax in +/-- **Every region of a radial drawing contains a unique edge.** Graph Minors XI, Section 3 (page +75): +"every region of $\Gamma'$ includes a unique edge of $\Gamma$", for a drawing `Γ` with an edge. -/ +theorem regionFacts_of_radial (hE : Γ.E.Nonempty) : + RegionFacts (PaintingOrDrawing.drawing Γ) Γ' := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + refine ⟨?_, ?_, ?_⟩ + · intro s hs + obtain ⟨y, hyO⟩ := region_nonempty hs + obtain ⟨z, hzs, hzU⟩ := exists_notMem_U (Γ := radialUnion hrad) hS + (region_isOpen hs) ⟨y, hyO⟩ + obtain ⟨p, hp, hzp⟩ := exists_region_of_notMem hzU + have hps := region_sub_of_mem hrad hS hs hp (subset_closure hzp) hzs + obtain ⟨e, he, hep, -⟩ := face_edge hrad hS hmax hE hp + obtain ⟨q, hq⟩ := he.1 + exact ⟨e, he, edge_sub_of_closure hrad hS hs he hq (closure_mono hps (hep hq))⟩ + · intro s hs e he f hf hes hfs + obtain ⟨y, hy⟩ := hf.1 + have hyU : y ∉ (radialUnion hrad).R.sUnion := by + rintro ⟨p, hp, hyp⟩ + exact region_subset hp hyp (Or.inl (Γ.closure_subset_U hf (subset_closure hy))) + rcases region_eq_faceUnion hrad hS hmax hE hs he hes (hfs hy) with h | h + · exact Γ.edge_eq_of_mem he hf h hy + · obtain ⟨p, hp, hyp⟩ := mem_iUnion₂.mp h + exact (hyU ⟨p, hp.1, hyp⟩).elim + · intro s hs e he hes v hv hvs + have hfin := finite_R hS (radialUnion hrad) + have hsub : s ⊆ e ∪ ⋃ p ∈ {p ∈ (radialUnion hrad).R | p ⊆ s ∧ e ⊆ closure p}, p := + region_eq_faceUnion hrad hS hmax hE hs he hes + have hcl := closure_mono hsub hvs + have hpfin : {p ∈ (radialUnion hrad).R | p ⊆ s ∧ e ⊆ closure p}.Finite := + hfin.subset fun _ h => h.1 + rw [closure_union, hpfin.closure_biUnion _] at hcl + rcases hcl with h | h + · exact h + · obtain ⟨p, hp, hvp⟩ := mem_iUnion₂.mp h + obtain ⟨e', -, -, hu, hv'⟩ := face_edge hrad hS hmax hE hp.1 + rw [hu e he hp.2.2] + exact hv' v hv hvp + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/RadialPrescribed.lean b/LeanPool/GraphMinor/GM11/RadialPrescribed.lean new file mode 100644 index 0000000000..58a5b11ded --- /dev/null +++ b/LeanPool/GraphMinor/GM11/RadialPrescribed.lean @@ -0,0 +1,238 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialExists +public import LeanPool.GraphMinor.GM11.RadialChord + +/-! +# Radial drawings with prescribed spokes + +Graph Minors XI, Section 3 (page 75), says that every 2-cell drawing has a radial drawing. Graph +Minors XII, proof of (6.1) (page 258), needs more: "we may choose a radial drawing $K$ of $\Gamma$ +such +that ... $D_i$ contains a vertex $v_i$ say of $K$, and $D_i$ includes edges of $K$ from $v_i$ to +every +vertex of $P_i$". This file proves the general form. We fix a point in each region and some lines, +each from the point of a region to a vertex at that region. If the lines meet only in common ends +and +no two have the same ends, then some radial drawing has these points as vertices and these lines as +edges (`exists_radial_with_spokes`). + +The proof adds the lines one at a time to the drawing of the points (`exists_glue_spoke`), and then +takes a drawing with the most edges among those that satisfy (i)–(iv) and contain it +(`exists_radial_extending`), as in `exists_radial_of_bound`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {Γ : PaintingOrDrawing S} + +/-- **Adding a spoke.** A line from a point `c` of `Γ'` in a region `r` to a vertex `x` of `Γ`, that +runs in `r` and misses `Γ'` except at its ends, can be added to a drawing `Γ'` that satisfies +(i)–(iv), if no edge of `Γ'` has the same ends. -/ +theorem exists_glue_spoke {Γ' : Drawing S} (hpre : Γ.IsPreRadialDrawing Γ') + {K r : Set S} {c x : S} (hr : r ∈ Γ.R) (hcr : c ∈ r) (hc : c ∈ Γ'.V) (hx : x ∈ Γ.V) + (hK : IsLineWithEnds K c x) (hKr : K \ {c, x} ⊆ r) (hKU : Disjoint (K \ {c, x}) Γ'.U) + (hno : ∀ f ∈ Γ'.E, closure f ∩ Γ'.V ≠ {x, c}) : + ∃ G : Drawing S, Γ.IsPreRadialDrawing G ∧ G.V = Γ'.V ∧ G.E = Γ'.E ∪ {K \ {c, x}} ∧ + G.U = Γ'.U ∪ K := by + have hVU : Γ.V ⊆ Γ.U := V_subset_U' + have hrU : Disjoint r Γ.U := + disjoint_left.mpr fun _ hp hpU => not_mem_U_of_region hr hp hpU + have hcnV : c ∉ Γ.V := fun h => disjoint_left.mp hrU hcr (hVU h) + have hcx : c ≠ x := fun h => hcnV (h ▸ hx) + have hKV := line_inter_spoke_vertices hc (hpre.2.1 hx) hK hcx hKU + exact exists_glue_spoke_of_no_bounded_disc (R := Γ.R) hpre hcr hc hx hK hcx hKr hKU hrU hVU + (fun f hf _ _ _ _ _ _ _ hKe hfe _ => hno f hf (hfe.trans (hKe.symm.trans hKV))) + +omit [T2Space S] in +/-- **A drawing that satisfies (i)–(iv) lies in a radial drawing.** Among the drawings that satisfy +(i)–(iv) and contain `K₀`, one with the most edges is maximal. -/ +theorem exists_radial_extending (hT : Γ.IsTwoCell) {N : ℕ} + (hN : ∀ Γ' : Drawing S, Γ.IsPreRadialDrawing Γ' → Γ'.E.ncard ≤ N) + {K₀ : Drawing S} (h₀ : Γ.IsPreRadialDrawing K₀) : + ∃ K : Drawing S, Γ.IsRadialDrawing K ∧ K₀.IsSubdrawing K := by + classical + let A : Set ℕ := + {n | ∃ Γ' : Drawing S, Γ.IsPreRadialDrawing Γ' ∧ K₀.IsSubdrawing Γ' ∧ Γ'.E.ncard = n} + have hAne : A.Nonempty := ⟨_, K₀, h₀, ⟨subset_rfl, subset_rfl⟩, rfl⟩ + have hbdd : BddAbove A := ⟨N, by rintro _ ⟨Γ', h, -, rfl⟩; exact hN Γ' h⟩ + obtain ⟨Γ', hpre, hsub₀, hc⟩ := Nat.sSup_mem hAne hbdd + refine ⟨Γ', ⟨hT, hpre, ?_⟩, hsub₀⟩ + rintro Γ'' hpre' ⟨hV, hE⟩ + refine ⟨?_, ?_⟩ + · intro w hw + by_cases hwV : w ∈ Γ.V + · exact hpre.2.1 hwV + obtain ⟨r, hr, hwr⟩ := hpre'.2.2.2.1 w ⟨hw, hwV⟩ + obtain ⟨w', ⟨hw'r, hw'⟩, -⟩ := hpre.2.2.1 r hr + rw [(hpre'.2.2.1 r hr).unique ⟨hwr, hw⟩ ⟨hw'r, hV hw'⟩] + exact hw' + · have hle : Γ''.E.ncard ≤ Γ'.E.ncard := by + rw [hc] + exact le_csSup hbdd ⟨Γ'', hpre', ⟨hsub₀.1.trans hV, hsub₀.2.trans hE⟩, rfl⟩ + exact (eq_of_subset_of_ncard_le hE hle Γ''.finite_edges).ge + +omit [TopologicalSpace S] [T2Space S] in +/-- Two pairs, each of a point in `P` and a point outside `P`, are equal only term by term. -/ +theorem pair_eq_of_mem {P : Set S} {a b c d : S} (ha : a ∈ P) (hb : b ∉ P) (hc : c ∈ P) + (hd : d ∉ P) (h : ({a, b} : Set S) = {c, d}) : a = c ∧ b = d := by + have ha' : a ∈ ({c, d} : Set S) := h ▸ Or.inl rfl + have hb' : b ∈ ({c, d} : Set S) := h ▸ Or.inr rfl + refine ⟨ha'.resolve_right fun e => hd (e ▸ ha), hb'.resolve_left fun e => hb (e ▸ hc)⟩ + +variable (hub : Set S → S) (hhub : ∀ r ∈ Γ.R, hub r ∈ r) + {ι : Type*} (ρ : ι → Set S) (x : ι → S) (L : ι → Set S) (s : Finset ι) + (hρ : ∀ j ∈ s, ρ j ∈ Γ.R) (hx : ∀ j ∈ s, x j ∈ Γ.V) + (hL : ∀ j ∈ s, IsLineWithEnds (L j) (hub (ρ j)) (x j)) + (hLr : ∀ j ∈ s, L j \ {x j} ⊆ ρ j) + (hmeet : ∀ j ∈ s, ∀ j' ∈ s, j ≠ j' → L j ∩ L j' ⊆ {hub (ρ j), x j}) + (hinj : ∀ j ∈ s, ∀ j' ∈ s, ρ j = ρ j' → x j = x j' → j = j') + +omit [T2Space S] in +include hhub hρ hLr in +/-- A prescribed spoke meets the points and the vertices of `Γ` only at its ends. -/ +theorem spoke_inter_points {j : ι} (hj : j ∈ s) : + L j ∩ (Γ.V ∪ hub '' Γ.R) ⊆ {hub (ρ j), x j} := by + rintro y ⟨hyL, hyV | ⟨r, hr, rfl⟩⟩ + · by_cases hyx : y = x j + · exact Or.inr hyx + · exact (not_mem_U_of_region (hρ j hj) (hLr j hj ⟨hyL, hyx⟩) (V_subset_U' hyV)).elim + · by_cases hyx : hub r = x j + · exact Or.inr hyx + · have h1 := hLr j hj ⟨hyL, hyx⟩ + rw [region_eq_of_common hr (hρ j hj) (hhub r hr) h1] + exact Or.inl rfl + +include hhub hρ hx hL hLr hmeet hinj in +/-- **The drawing of the points and the prescribed spokes satisfies (i)–(iv).** -/ +theorem exists_preRadial_spokes (hR : Γ.R.Finite) : + ∃ K₀ : Drawing S, Γ.IsPreRadialDrawing K₀ ∧ K₀.V = Γ.V ∪ hub '' Γ.R ∧ + K₀.E = (fun j => L j \ {hub (ρ j), x j}) '' s := by + classical + have hA : (Γ.V ∪ hub '' Γ.R).Finite := finite_V'.union (hR.image _) + suffices H : ∀ t : Finset ι, t ⊆ s → ∃ K₀ : Drawing S, Γ.IsPreRadialDrawing K₀ ∧ + K₀.V = Γ.V ∪ hub '' Γ.R ∧ K₀.U = (Γ.V ∪ hub '' Γ.R) ∪ ⋃ j ∈ t, L j ∧ + K₀.E = (fun j => L j \ {hub (ρ j), x j}) '' t by + obtain ⟨K₀, h1, h2, -, h4⟩ := H s subset_rfl + exact ⟨K₀, h1, h2, h4⟩ + intro t + induction t using Finset.induction_on with + | empty => + intro _ + have hV : (pointsDrawing hA).V = Γ.V ∪ hub '' Γ.R := rfl + have hU : (pointsDrawing hA).U = Γ.V ∪ hub '' Γ.R := rfl + have hE := pointsDrawing_E hA + refine ⟨pointsDrawing hA, ⟨?_, ?_, ?_, ?_, ?_, ?_⟩, rfl, by simp [hU], by simp [hE]⟩ + · rw [hU] + ext y + constructor + · rintro ⟨hyU, hy | ⟨r, hr, rfl⟩⟩ + · exact hy + · exact absurd hyU (not_mem_U_of_region hr (hhub r hr)) + · exact fun hy => ⟨V_subset_U' hy, Or.inl hy⟩ + · rw [hV] + exact subset_union_left + · intro r hr + refine ⟨hub r, ⟨hhub r hr, Or.inr ⟨r, hr, rfl⟩⟩, ?_⟩ + rintro w ⟨hwr, hw | ⟨r', hr', rfl⟩⟩ + · exact absurd (V_subset_U' hw) (not_mem_U_of_region hr hwr) + · rw [region_eq_of_common hr hr' hwr (hhub r' hr')] + · rintro w ⟨hw | ⟨r, hr, rfl⟩, hn⟩ + · exact absurd hw hn + · exact ⟨r, hr, hhub r hr⟩ + · intro e he + rw [hE] at he + exact absurd he (notMem_empty _) + · intro e he + rw [hE] at he + exact absurd he (notMem_empty _) + | insert j₀ t hj₀ ih => + intro hts + obtain ⟨K₀, hpre, hV, hU, hE⟩ := ih ((Finset.subset_insert _ _).trans hts) + have hj₀s : j₀ ∈ s := hts (Finset.mem_insert_self _ _) + have hts' : ∀ j ∈ t, j ∈ s := fun j hj => hts (Finset.mem_insert_of_mem hj) + have hr := hρ j₀ hj₀s + have hcr := hhub _ hr + have hc : hub (ρ j₀) ∈ K₀.V := hV ▸ Or.inr ⟨_, hr, rfl⟩ + have hKr : L j₀ \ {hub (ρ j₀), x j₀} ⊆ ρ j₀ := fun y hy => + hLr j₀ hj₀s ⟨hy.1, fun h => hy.2 (Or.inr h)⟩ + have hKU : Disjoint (L j₀ \ {hub (ρ j₀), x j₀}) K₀.U := by + refine disjoint_left.mpr fun y hy hyU => ?_ + rw [hU] at hyU + rcases hyU with hyA | hyL + · exact hy.2 (spoke_inter_points hub hhub ρ x L s hρ hLr hj₀s ⟨hy.1, hyA⟩) + · obtain ⟨j, hj, hyj⟩ := mem_iUnion₂.mp hyL + have hne : j₀ ≠ j := fun e => hj₀ (e ▸ hj) + exact hy.2 (hmeet j₀ hj₀s j (hts' j hj) hne ⟨hy.1, hyj⟩) + have hno : ∀ f ∈ K₀.E, closure f ∩ K₀.V ≠ {x j₀, hub (ρ j₀)} := by + intro f hf heq + rw [hE] at hf + obtain ⟨j, hj, rfl⟩ := hf + have hjs := hts' j hj + have hcl : closure (L j \ {hub (ρ j), x j}) = L j := closure_sdiff_pair (hL j hjs) + have hLV : L j ∩ K₀.V = {hub (ρ j), x j} := by + rw [hV] + refine subset_antisymm (spoke_inter_points hub hhub ρ x L s hρ hLr hjs) ?_ + obtain ⟨φ, hφ0, hφ1⟩ := hL j hjs + rintro y (rfl | rfl) + · exact ⟨hφ0 ▸ (φ 0).2, Or.inr ⟨_, hρ j hjs, rfl⟩⟩ + · exact ⟨hφ1 ▸ (φ 1).2, Or.inl (hx j hjs)⟩ + rw [hcl, hLV, pair_comm] at heq + have hnot : ∀ r ∈ Γ.R, hub r ∉ Γ.V := fun r hr hv => + not_mem_U_of_region hr (hhub r hr) (V_subset_U' hv) + obtain ⟨e1, e2⟩ := pair_eq_of_mem (P := Γ.V) (hx j hjs) (hnot _ (hρ j hjs)) (hx j₀ hj₀s) + (hnot _ hr) heq + have hρe : ρ j = ρ j₀ := + region_eq_of_common (hρ j hjs) hr (hhub _ (hρ j hjs)) (e2 ▸ hcr) + exact hj₀ (hinj j hjs j₀ hj₀s hρe e1 ▸ hj) + obtain ⟨G, hG, hGV, hGE, hGU⟩ := exists_glue_spoke hpre hr hcr hc (hx j₀ hj₀s) (hL j₀ hj₀s) + hKr hKU hno + refine ⟨G, hG, hGV.trans hV, ?_, ?_⟩ + · rw [hGU, hU, Finset.set_biUnion_insert] + ext y + simp only [mem_union] + tauto + · rw [hGE, hE, Finset.coe_insert, image_insert_eq, union_comm] + rfl + +/-- **A radial drawing with prescribed spokes.** Let `hub r` be a point of each region `r` of a +2-cell +drawing `Γ`, and let `L j` (`j ∈ s`) be lines, each from `hub (ρ j)` to a vertex `x j` of `Γ` and +inside the region `ρ j` but for its end `x j`. If two of the lines meet only in common ends and no +two +have the same ends, then there is a radial drawing of `Γ` with all `hub r` as vertices and all +`L j` as edges (minus their ends). -/ +theorem exists_radial_with_spokes (hS : IsClosedSurface S) {Γ : Drawing S} + (hT : (PaintingOrDrawing.drawing Γ).IsTwoCell) (hub : Set S → S) + (hhub : ∀ r ∈ Γ.R, hub r ∈ r) {ι : Type*} (ρ : ι → Set S) (x : ι → S) (L : ι → Set S) + (s : Finset ι) (hρ : ∀ j ∈ s, ρ j ∈ Γ.R) (hx : ∀ j ∈ s, x j ∈ Γ.V) + (hL : ∀ j ∈ s, IsLineWithEnds (L j) (hub (ρ j)) (x j)) + (hLr : ∀ j ∈ s, L j \ {x j} ⊆ ρ j) + (hmeet : ∀ j ∈ s, ∀ j' ∈ s, j ≠ j' → L j ∩ L j' ⊆ {hub (ρ j), x j}) + (hinj : ∀ j ∈ s, ∀ j' ∈ s, ρ j = ρ j' → x j = x j' → j = j') : + ∃ K : Drawing S, (PaintingOrDrawing.drawing Γ).IsRadialDrawing K ∧ (∀ r ∈ Γ.R, hub r ∈ K.V) ∧ + ∀ j ∈ s, L j \ {hub (ρ j), x j} ∈ K.E := by + have : ConnectedSpace S := hT.1 + obtain ⟨K₀, hpre, hV, hE⟩ := exists_preRadial_spokes (Γ := PaintingOrDrawing.drawing Γ) hub hhub + ρ x L s hρ hx hL hLr hmeet hinj (finite_R hS Γ) + obtain ⟨N, hN⟩ := exists_spoke_bound_drawing hT hS + obtain ⟨K, hK, hsub⟩ := exists_radial_extending hT hN hpre + refine ⟨K, hK, fun r hr => hsub.1 (hV ▸ Or.inr ⟨r, hr, rfl⟩), fun j hj => hsub.2 ?_⟩ + rw [hE] + exact ⟨j, hj, rfl⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/RadialRegions.lean b/LeanPool/GraphMinor/GM11/RadialRegions.lean new file mode 100644 index 0000000000..3489e94691 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/RadialRegions.lean @@ -0,0 +1,374 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialCap + +/-! +# The regions of a radial drawing + +Let `Γ'` be a radial drawing of a 2-cell drawing `Γ` with an edge. Graph Minors XI (Section 3, +page 75) states without proof that every region of `Γ'` contains a unique edge of `Γ`. This file and +`RadialCorners.lean` prove it. We work in the union `H` of `Γ` and `Γ'`. + +This file has the first steps: each vertex of `Γ` is an end of an edge of `Γ` (`exists_edge_at`), +and +it is joined by an edge of `Γ'` to the vertex `v_r` of every region `r` at it (`exists_spoke_at`). +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] {Γ Γ' : Drawing S} {e : Set S} + +theorem radial_inter (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') : + Γ.U ∩ Γ'.U = Γ.V := hrad.2.1 + +theorem radial_V (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') : Γ.V ⊆ Γ'.V := + hrad.2.2.1 + +theorem radial_meet (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') : + Γ.U ∩ Γ'.U ⊆ Γ.V ∩ Γ'.V := by + rw [radial_inter hrad] + exact fun x hx => ⟨hx, radial_V hrad hx⟩ + +/-- The union `H` of a drawing and a radial drawing of it. -/ +def radialUnion (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') : Drawing S := + Γ.glue Γ' (radial_meet hrad) + +variable (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') + +include hrad + +theorem radialUnion_U : (radialUnion hrad).U = Γ.U ∪ Γ'.U := rfl + +theorem radialUnion_V : (radialUnion hrad).V = Γ'.V := union_eq_right.mpr (radial_V hrad) + +theorem radialUnion_E : (radialUnion hrad).E = Γ.E ∪ Γ'.E := Drawing.glue_E _ + +/-- An edge of `Γ` misses `U(Γ')`. -/ +theorem edge_disjoint (he : e ∈ Γ.E) : Disjoint e Γ'.U := by + refine disjoint_left.mpr fun x hx hx' => ?_ + have : x ∈ Γ.V := radial_inter hrad ▸ ⟨Γ.closure_subset_U he (subset_closure hx), hx'⟩ + exact edge_notMem_V he hx this + +/-- An edge of `Γ'` misses `U(Γ)`. -/ +theorem spoke_disjoint (he : e ∈ Γ'.E) : Disjoint e Γ.U := by + refine disjoint_left.mpr fun x hx hx' => ?_ + have : x ∈ Γ.V := radial_inter hrad ▸ ⟨hx', Γ'.closure_subset_U he (subset_closure hx)⟩ + exact edge_notMem_V he hx (radial_V hrad this) + +/-- The two ends of an edge of `Γ'`, and the region of `Γ` that contains the edge. -/ +theorem spoke_ends (hS : IsClosedSurface S) (he : e ∈ Γ'.E) : + ∃ v ∈ Γ.V, ∃ r ∈ Γ.R, ∃ w, w ∈ r ∧ w ∈ Γ'.V ∧ closure e ∩ Γ'.V = {v, w} ∧ e ⊆ r := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨v, hv, w, ⟨hwV, hwn⟩, hcap⟩ := hrad.2.2.2.2.2.1 e he + obtain ⟨r, hr, hwr⟩ := hrad.2.2.2.2.1 w ⟨hwV, hwn⟩ + have hwe : w ∈ closure e := by + have : w ∈ closure e ∩ Γ'.V := by rw [hcap]; simp + exact this.1 + have hrΓ : r ∈ Γ.R := hr + obtain ⟨y, hyr, hye⟩ := mem_closure_iff.mp hwe r (region_isOpen hrΓ) hwr + refine ⟨v, hv, r, hr, w, hwr, hwV, hcap, ?_⟩ + exact subset_region hrΓ he.2.2.1.isConnected.isPreconnected (spoke_disjoint hrad he) hye hyr + +/-- The vertex of `Γ'` in a region of `Γ` is unique. -/ +theorem hub_unique {r : Set S} (hr : r ∈ Γ.R) {c w : S} (hc : c ∈ r) (hcV : c ∈ Γ'.V) (hw : w ∈ r) + (hwV : w ∈ Γ'.V) : w = c := + (hrad.2.2.2.1 r hr).unique ⟨hw, hwV⟩ ⟨hc, hcV⟩ + +omit hrad in +/-- A vertex of `Γ'` in a region of `Γ` is not a vertex of `Γ`. -/ +theorem notMem_V_of_mem_region {r : Set S} (hr : r ∈ Γ.R) {c : S} (hc : c ∈ r) : c ∉ Γ.V := + fun h => region_subset hr hc (Γ.V_subset_U h) + +/-- **Every vertex of `Γ` is an end of an edge of `Γ`.** A vertex with no edge has a small closed +disc `D` around it, with `D` minus the vertex in a region `r`. The boundary of `D` bounds a closed +disc +in the open disc `r`. These two discs cover the surface, so `U(Γ)` is one point, against `E(Γ) ≠ ∅`. +This is why the paper excludes the case "`|V(Γ)| = 1` and `E(Γ) = ∅`". -/ +theorem exists_edge_at [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) + {x : S} (hx : x ∈ Γ.V) : ∃ e ∈ Γ.E, x ∈ closure e := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + by_contra hno + push Not at hno + let Bad : Set S := (Γ.V \ {x}) ∪ ⋃ e ∈ Γ.E, closure e + have hBad : IsClosed Bad := (Γ.finite_V.subset sdiff_subset).isClosed.union + (Γ.finite_edges.isClosed_biUnion fun _ _ => isClosed_closure) + have hxBad : x ∉ Bad := by + rintro (h | h) + · exact h.2 rfl + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp h + exact hno e he hxe + obtain ⟨D, D', hD, hD', hxD', hD'D, hDO, hbdD⟩ := + exists_closedDisc_nbhd hS hBad.isOpen_compl hxBad + have hbdU : Disjoint (discBd D) Γ.U := by + refine disjoint_left.mpr fun y hy hyU => ?_ + have hyD : y ∈ D := discBd_subset D hy + have hyx : y ≠ x := fun h => (hbdD ▸ hy).2 (h ▸ hxD') + rw [Γ.U_eq] at hyU + refine hDO hyD ?_ + rcases hyU with hyV | hyE + · exact Or.inl ⟨hyV, hyx⟩ + · exact Or.inr hyE + have hF := hD.isOArc_discBd + have hbdne : (discBd D).Nonempty := by + obtain ⟨φ⟩ := hF + exact ⟨_, (φ 1).2⟩ + have hbdconn : IsPreconnected (discBd D) := by + obtain ⟨φ⟩ := hF + have : discBd D = range fun z => (φ z).1 := by + ext y + exact ⟨fun hy => ⟨φ.symm ⟨y, hy⟩, by simp⟩, by rintro ⟨z, rfl⟩; exact (φ z).2⟩ + rw [this] + exact isPreconnected_range (by fun_prop) + obtain ⟨y, hy⟩ := hbdne + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem (disjoint_left.mp hbdU hy) + have hsub : discBd D ⊆ r := subset_region hr hbdconn hbdU hy hyr + obtain ⟨Δ, hΔr, hΔ, hb⟩ := exists_disc_in_openDisc (hrad.1.2 r hr) hF hsub + have hxΔ : x ∉ Δ := fun h => region_subset hr (hΔr h) (Γ.V_subset_U hx) + have hcov := cover_of_discBd_eq hS hD hΔ hb.symm fun h => hxΔ (h ▸ hD'D hxD') + obtain ⟨e, he⟩ := hE + obtain ⟨z, hz⟩ := he.1 + have hzU : z ∈ Γ.U := Γ.closure_subset_U he (subset_closure hz) + rcases (hcov ▸ mem_univ z : z ∈ D ∪ Δ) with h | h + · exact hDO h (Or.inr (mem_iUnion₂.mpr ⟨e, he, subset_closure hz⟩)) + · exact region_subset hr (hΔr h) hzU + +variable [T2Space S] + +omit [T2Space S] in +/-- A region of `H` lies in a region of `Γ`. -/ +theorem exists_region_of_sub {p : Set S} (hp : p ∈ (radialUnion hrad).R) : + ∃ r ∈ Γ.R, p ⊆ r := by + obtain ⟨y, hy⟩ := region_nonempty hp + have hyU : y ∉ Γ.U := fun h => region_subset hp hy (Or.inl h) + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem hyU + refine ⟨r, hr, subset_region hr (region_isPreconnected hp) ?_ hy hyr⟩ + exact disjoint_left.mpr fun z hz h => region_subset hp hz (Or.inl h) + +/-- If `x` is in the closure of a region of `Γ`, then it is in the closure of a region of `H` inside +that region. -/ +theorem exists_sub_closure [ConnectedSpace S] (hS : IsClosedSurface S) {r : Set S} (hr : r ∈ Γ.R) + {x : S} (hx : x ∈ closure r) : + ∃ p ∈ (radialUnion hrad).R, p ⊆ r ∧ x ∈ closure p := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hfin := finite_R hS (radialUnion hrad) + by_contra hno + push Not at hno + let Y : Set S := ⋃ p ∈ {p ∈ (radialUnion hrad).R | p ⊆ r}, closure p + have hRfinite : {p ∈ (radialUnion hrad).R | p ⊆ r}.Finite := hfin.subset fun _ h => h.1 + have hY : IsClosed Y := hRfinite.isClosed_biUnion fun _ _ => isClosed_closure + have hxY : x ∉ Y := by + intro h + obtain ⟨p, ⟨hp, hpr⟩, hxp⟩ := mem_iUnion₂.mp h + exact hno p hp hpr hxp + obtain ⟨y, hyW, hyr⟩ := mem_closure_iff.mp hx _ hY.isOpen_compl hxY + obtain ⟨z, ⟨hzW, hzr⟩, hzU⟩ := exists_notMem_U (Γ := radialUnion hrad) hS + (hY.isOpen_compl.inter (region_isOpen hr)) ⟨y, hyW, hyr⟩ + obtain ⟨p, hp, hzp⟩ := exists_region_of_notMem hzU + have hpr : p ⊆ r := by + refine subset_region hr (region_isPreconnected hp) ?_ hzp hzr + exact disjoint_left.mpr fun w hw h => region_subset hp hw (Or.inl h) + exact hzW (mem_iUnion₂.mpr ⟨p, ⟨hp, hpr⟩, subset_closure hzp⟩) + +omit [T2Space S] in +/-- The vertex of `Γ'` in `r` is in the closure of each region of `H` inside `r`. -/ +theorem hub_mem_closure (hS : IsClosedSurface S) {r p : Set S} (hr : r ∈ Γ.R) + (hp : p ∈ (radialUnion hrad).R) (hpr : p ⊆ r) {c : S} (hc : c ∈ r) (hcV : c ∈ Γ'.V) : + c ∈ closure p := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + -- The set `p` is open in `r`, and not all of it, so `r` has a point in the frontier of `p`. + have hpo : IsOpen p := region_isOpen hp + have hcH : c ∈ (radialUnion hrad).U := Or.inr (Γ'.V_subset_U hcV) + have hcp : c ∉ p := fun h => region_subset hp h hcH + obtain ⟨q, hqr, hqcl, hqp⟩ : ∃ q ∈ r, q ∈ closure p ∧ q ∉ p := by + by_contra hno + push Not at hno + have hclopen : r ⊆ p ∪ (closure p)ᶜ := fun y hy => by + by_cases h : y ∈ closure p + · exact Or.inl (hno y hy h) + · exact Or.inr h + obtain ⟨y, hy⟩ := region_nonempty hp + have := (region_isPreconnected hr).subset_left_of_subset_union hpo isClosed_closure.isOpen_compl + (disjoint_compl_right_iff_subset.mpr subset_closure) hclopen ⟨y, hpr hy, hy⟩ + exact hcp (this hc) + have hqU : q ∈ (radialUnion hrad).U := by + by_contra hqn + obtain ⟨p', hp', hqp'⟩ := exists_region_of_notMem hqn + obtain ⟨z, hz', hz⟩ := mem_closure_iff.mp hqcl p' (region_isOpen hp') hqp' + exact hqp (region_eq_of_mem hp' hp hz' hz ▸ hqp') + rcases hqU with hq | hq + · exact (region_subset hr hqr hq).elim + rw [Γ'.U_eq] at hq + rcases hq with hqV | hqE + · rw [← hub_unique hrad hr hc hcV hqr hqV] + exact hqcl + by_cases hqV : q ∈ Γ'.V + · rw [← hub_unique hrad hr hc hcV hqr hqV] + exact hqcl + obtain ⟨e, he, hqe'⟩ := mem_iUnion₂.mp hqE + have hqe : q ∈ e := Γ'.closure_diff_V he ▸ ⟨hqe', hqV⟩ + have heH : e ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inr he + have hsub := edge_subset_closure_of_incident hS heH hp ⟨q, hqe, hqcl⟩ + obtain ⟨v, hv, r', hr', w, hwr, hwV, hcap, hsubr⟩ := spoke_ends hrad hS he + have hr'r : r' = r := region_eq_of_mem hr' hr (hsubr hqe) hqr + subst hr'r + have hwe : w ∈ closure e := by + have : w ∈ closure e ∩ Γ'.V := by rw [hcap]; simp + exact this.1 + rw [← hub_unique hrad hr hc hcV hwr hwV] + exact closure_minimal hsub isClosed_closure hwe + +/-- Condition (v) of a radial drawing, for a chord of `r` from `c` to a vertex `x` of `Γ`. -/ +theorem parallel_of_line (hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ') + (hS : IsClosedSurface S) {r K : Set S} (hr : r ∈ Γ.R) + {c x : S} (hc : c ∈ r) (hcV : c ∈ Γ'.V) (hx : x ∈ Γ.V) (hK : IsLineWithEnds K c x) (hcx : c ≠ x) + (hKr : K \ {c, x} ⊆ r) (hKU : Disjoint (K \ {c, x}) Γ'.U) : + ∃ h ∈ Γ'.E, closure h ∩ Γ'.V = {x, c} ∧ ∃ Δ : Set S, IsClosedDisc Δ ∧ Δ ⊆ r ∪ {x} ∧ + subBd Δ = closure h ∪ K := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + refine exists_parallel_spoke (Γ := PaintingOrDrawing.drawing Γ) hrad.2 hmax hr hc hcV hx hK hcx + hKr hKU + (disjoint_left.mpr fun y hy => region_subset hr hy) ?_ + intro r₁ r₂ h₁ h₂ y hy hy' + exact region_eq_of_mem h₁ h₂ hy hy' + +/-- **Each vertex of `Γ` at a region `r` is joined by an edge of `Γ'` to the vertex of `r`.** -/ +theorem exists_spoke_at (hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ') [ConnectedSpace S] + (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) {r : Set S} + (hr : r ∈ Γ.R) {c x : S} (hc : c ∈ r) (hcV : c ∈ Γ'.V) (hx : x ∈ Γ.V) (hxr : x ∈ closure r) : + ∃ h ∈ Γ'.E, closure h ∩ Γ'.V = {x, c} := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hne : Nonempty S := ⟨c⟩ + have hxU : x ∉ r := fun h => region_subset hr h (Γ.V_subset_U hx) + have hcx : c ≠ x := fun h => hxU (h ▸ hc) + have hcxU : x ≠ c := hcx.symm + obtain ⟨e₀, he₀, hxe₀⟩ := exists_edge_at hrad hS hE hx + obtain ⟨γ, hγ⟩ := exists_edgePar (radialUnion hrad) + have he₀H : e₀ ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inl he₀ + have hxH : x ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact radial_V hrad hx + have hcH : c ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact hcV + obtain ⟨b, hb⟩ := exists_end_eq hγ he₀H hxH hxe₀ + have hhalf : (halfEdges (radialUnion hrad) γ x).Nonempty := ⟨(e₀, b), he₀H, hb⟩ + have hrpath : IsPathConnected r := + isPathConnected_of_isOpen hS (region_isOpen hr) (region_isPreconnected hr) ⟨c, hc⟩ + by_cases hchalf : (halfEdges (radialUnion hrad) γ c).Nonempty + · obtain ⟨p, hp, hpr, hxp⟩ := exists_sub_closure hrad hS hr hxr + have hcp := hub_mem_closure hrad hS hr hp hpr hc hcV + obtain ⟨g₁, hg₁, h₁0, h₁⟩ := exists_access hS _ hγ hxH hhalf hp hxp + obtain ⟨g₂, hg₂, h₂0, h₂⟩ := exists_access hS _ hγ hcH hchalf hp hcp + obtain ⟨y, hy⟩ := region_nonempty hp + have hppath : IsPathConnected p := + isPathConnected_of_isOpen hS (region_isOpen hp) (region_isPreconnected hp) ⟨y, hy⟩ + obtain ⟨u, hu, hui, hu0, hu1, hup, -⟩ := + exists_chord hppath hcxU (fun h => hxU (hpr h)) hg₁ hg₂ h₁0 h₂0 h₁ h₂ + have hline : IsLineWithEnds (range u) c x := by + have := isLine_range hu hui + rw [hu0, hu1] at this + exact GraphMinor.GM11.IsLineWithEnds.symm this + have hsubp : range u \ {c, x} ⊆ p := by + rintro _ ⟨⟨t, rfl⟩, hn⟩ + exact hup t (fun h => hn (Or.inr (by rw [h, hu0]; rfl))) fun h => hn (Or.inl (by rw [h, hu1])) + obtain ⟨h, hh, hcap, -⟩ := parallel_of_line hrad hmax hS hr hc hcV hx hline hcx + (hsubp.trans hpr) + (disjoint_left.mpr fun z hz hzU => region_subset hp (hsubp hz) (Or.inr hzU)) + exact ⟨h, hh, hcap⟩ + · -- There is no edge of `Γ'` at `c`, so `U(Γ')` meets `r` only in `c`. + have hrU : ∀ y ∈ r, y ∈ Γ'.U → y = c := by + intro y hy hyU + by_cases hyV : y ∈ Γ'.V + · exact hub_unique hrad hr hc hcV hy hyV + rw [Γ'.U_eq] at hyU + rcases hyU with h | hyE + · exact (hyV h).elim + obtain ⟨g, hg, hyg'⟩ := mem_iUnion₂.mp hyE + have hyg : y ∈ g := Γ'.closure_diff_V hg ▸ ⟨hyg', hyV⟩ + obtain ⟨v, -, r', hr', w, hwr, hwV, hcap, hsubr⟩ := spoke_ends hrad hS hg + have hr'r : r' = r := region_eq_of_mem hr' hr (hsubr hyg) hy + subst hr'r + have hwc : w = c := hub_unique hrad hr hc hcV hwr hwV + have hcg : c ∈ closure g := by + have : w ∈ closure g ∩ Γ'.V := by rw [hcap]; simp + exact hwc ▸ this.1 + have hgH : g ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inr hg + obtain ⟨b', hb'⟩ := exists_end_eq hγ hgH hcH hcg + exact (hchalf ⟨(g, b'), hgH, hb'⟩).elim + obtain ⟨γ₀, hγ₀⟩ := exists_edgePar Γ + obtain ⟨b₀, hb₀⟩ := exists_end_eq hγ₀ he₀ hx hxe₀ + obtain ⟨g₁, hg₁, h₁0, h₁⟩ := exists_access hS Γ hγ₀ hx ⟨(e₀, b₀), he₀, hb₀⟩ hr hxr + obtain ⟨u, hu, hui, hu0, hu1, hup, -⟩ := exists_chord_to_point hrpath hxU hc hg₁ h₁0 h₁ + have hline : IsLineWithEnds (range u) c x := by + have := isLine_range hu hui + rw [hu0, hu1] at this + exact GraphMinor.GM11.IsLineWithEnds.symm this + have hsubp : range u \ {c, x} ⊆ r := by + rintro _ ⟨⟨t, rfl⟩, hn⟩ + exact hup t fun h => hn (Or.inr (by rw [h, hu0]; rfl)) + obtain ⟨h, hh, hcap, -⟩ := parallel_of_line hrad hmax hS hr hc hcV hx hline hcx hsubp + (disjoint_left.mpr fun z hz hzU => hz.2 (Or.inl (hrU z (hsubp hz) hzU))) + exact ⟨h, hh, hcap⟩ + +omit hrad [T2Space S] in +/-- A region of a 2-cell drawing with an edge has a vertex in its closure. -/ +theorem exists_vertex_at_region [ConnectedSpace S] (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) + {r : Set S} (hr : r ∈ Γ.R) : ∃ x ∈ Γ.V, x ∈ closure r := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hT2 : T2Space S := hS.2.1 + obtain ⟨e, he⟩ := hE + obtain ⟨z, hz⟩ := he.1 + have hzU : z ∈ Γ.U := Γ.closure_subset_U he (subset_closure hz) + have hro := region_isOpen hr + have hrne := region_nonempty hr + obtain ⟨q, hq⟩ : (frontier r).Nonempty := by + by_contra hn + have hempty := not_nonempty_iff_eq_empty.mp hn + have hcl : IsClopen r := isClopen_iff_frontier_eq_empty.mpr hempty + have huniv := hcl.eq_univ hrne + exact region_subset hr (huniv ▸ mem_univ z) hzU + have hqcl : q ∈ closure r := frontier_subset_closure hq + have hqr : q ∉ r := fun h => by + rw [hro.frontier_eq] at hq + exact hq.2 h + have hqU : q ∈ Γ.U := by + by_contra hqn + obtain ⟨r', hr', hqr'⟩ := exists_region_of_notMem hqn + obtain ⟨y, hy', hy⟩ := mem_closure_iff.mp hqcl r' (region_isOpen hr') hqr' + exact hqr (region_eq_of_mem hr' hr hy' hy ▸ hqr') + by_cases hqV : q ∈ Γ.V + · exact ⟨q, hqV, hqcl⟩ + rw [Γ.U_eq] at hqU + rcases hqU with h | hqE + · exact (hqV h).elim + obtain ⟨g, hg, hqg'⟩ := mem_iUnion₂.mp hqE + have hqg : q ∈ g := Γ.closure_diff_V hg ▸ ⟨hqg', hqV⟩ + have hsub := edge_subset_closure_of_incident hS hg hr ⟨q, hqg, hqcl⟩ + have hne : Nonempty S := ⟨q⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + exact ⟨_, end_mem_V hγ hg false, closure_minimal hsub isClosed_closure + (end_mem_closure hγ hg false)⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/RadialTwoCell.lean b/LeanPool/GraphMinor/GM11/RadialTwoCell.lean new file mode 100644 index 0000000000..099240c4bf --- /dev/null +++ b/LeanPool/GraphMinor/GM11/RadialTwoCell.lean @@ -0,0 +1,451 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.GlueFaces +public import LeanPool.GraphMinor.GM11.RadialFacts + +/-! +# A radial drawing is 2-cell + +Graph Minors XI, Section 3 (page 75): "$\Gamma'$ is 2-cell". We prove this here for drawings. + +Each region `p` of `H = Γ ∪ Γ'` lies in a region `r` of `Γ`, and `r` is an open disc. An `O`-arc in +`p` +bounds a closed disc in `r`. This disc holds no point of `Γ'`, since each edge of `Γ'` in `r` +reaches the +frontier of `r` (`face_isOpenDisc`). So `p` is an open disc, by `open_disc`. + +A region of `Γ'` is an edge `e` of `Γ` with the two regions of `H` on the two sides of `e` +(`edge_two_faces`), and `theorem_glue_regions` shows that this is an open disc. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval Metric + +universe u + +variable {S : Type u} [TopologicalSpace S] {Γ Γ' : Drawing S} [T2Space S] [ConnectedSpace S] + (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') (hS : IsClosedSurface S) + (hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ') + +include hrad hS + +omit [T2Space S] [ConnectedSpace S] hrad in +/-- A region of a closed surface is not the whole surface, if it is an open disc. -/ +theorem openDisc_ne_univ {r : Set S} (hr : IsOpenDisc r) : r ≠ univ := by + rintro rfl + obtain ⟨-, ⟨φ⟩⟩ := hr + have hc : CompactSpace S := hS.1 + have h₁ : CompactSpace (univ : Set S) := isCompact_iff_compactSpace.mp isCompact_univ + have h₂ : CompactSpace OpenUnitDisc := φ.symm.compactSpace + have h₃ : IsCompact (OpenUnitDisc : Set EuclideanPlane) := isCompact_iff_compactSpace.mpr h₂ + have h₄ : IsClosed (OpenUnitDisc : Set EuclideanPlane) := h₃.isClosed + have h₅ : IsClopen (OpenUnitDisc : Set EuclideanPlane) := ⟨h₄, isOpen_ball⟩ + have h₆ := h₅.eq_univ ⟨0, by simp [OpenUnitDisc]⟩ + obtain ⟨v, hv⟩ : ∃ v : EuclideanPlane, ‖v‖ = 2 := by + have := exists_norm_eq EuclideanPlane (by norm_num : (0 : ℝ) ≤ 2) + simpa using this + have h₇ : v ∈ (OpenUnitDisc : Set EuclideanPlane) := h₆ ▸ mem_univ v + have h₈ : ‖v‖ < 1 := by simpa [OpenUnitDisc] using h₇ + linarith + +omit [T2Space S] [ConnectedSpace S] in +/-- Each edge of `Γ'` that meets `r` joins the vertex of `r` to a vertex off `r`. -/ +theorem spoke_in_region {r s : Set S} (hr : r ∈ Γ.R) {c : S} (hc : c ∈ r) (hcV : c ∈ Γ'.V) + (hs : s ∈ Γ'.E) {y : S} (hys : y ∈ s) (hyr : y ∈ r) : + c ∈ closure s ∧ ∃ v ∈ closure s, v ∉ r := by + obtain ⟨v, hv, r', hr', w, hwr, hwV, hcap, hsubr⟩ := spoke_ends hrad hS hs + have hr'r : r' = r := region_eq_of_mem hr' hr (hsubr hys) hyr + subst hr'r + have hwc : w = c := hub_unique hrad hr hc hcV hwr hwV + have hmem : ∀ z ∈ ({v, w} : Set S), z ∈ closure s := fun z hz => by + rw [← hcap] at hz + exact hz.1 + refine ⟨hwc ▸ hmem w (by simp), v, hmem v (by simp), ?_⟩ + exact fun h => region_subset hr h (Γ.V_subset_U hv) + +include hmax in +/-- **Each vertex of `Γ'` in a region of `Γ` has an edge of `Γ'`.** -/ +theorem hub_has_spoke {r : Set S} (hr : r ∈ Γ.R) {c : S} (hc : c ∈ r) (hcV : c ∈ Γ'.V) : + ∃ s ∈ Γ'.E, c ∈ closure s := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + by_cases hE : Γ.E.Nonempty + · obtain ⟨x, hx, hxr⟩ := exists_vertex_at_region hS hE hr + obtain ⟨h, hh, hcap⟩ := exists_spoke_at hrad hmax hS hE hr hc hcV hx hxr + have : c ∈ closure h ∩ Γ'.V := by rw [hcap]; simp + exact ⟨h, hh, this.1⟩ + by_contra hno + push Not at hno + have hE₀ : Γ.E = ∅ := not_nonempty_iff_eq_empty.mp hE + have hUV : Γ.U = Γ.V := by + rw [Γ.U_eq, hE₀] + simp + have hrU : ∀ y ∈ r, y ∈ Γ'.U → y = c := by + intro y hy hyU + by_cases hyV : y ∈ Γ'.V + · exact hub_unique hrad hr hc hcV hy hyV + rw [Γ'.U_eq] at hyU + rcases hyU with h | hyE + · exact (hyV h).elim + obtain ⟨g, hg, hyg'⟩ := mem_iUnion₂.mp hyE + have hyg : y ∈ g := Γ'.closure_diff_V hg ▸ ⟨hyg', hyV⟩ + exact absurd (spoke_in_region hrad hS hr hc hcV hg hyg hy).1 (hno g hg) + have hrd : IsOpenDisc r := hrad.1.2 r hr + have hro := region_isOpen hr + -- A vertex on the frontier of `r`. + obtain ⟨x, hxfr⟩ : (frontier r).Nonempty := by + by_contra hn + have hcl : IsClopen r := isClopen_iff_frontier_eq_empty.mpr (not_nonempty_iff_eq_empty.mp hn) + exact openDisc_ne_univ hS hrd (hcl.eq_univ ⟨c, hc⟩) + have hxcl : x ∈ closure r := frontier_subset_closure hxfr + have hxr : x ∉ r := fun h => by + rw [hro.frontier_eq] at hxfr + exact hxfr.2 h + have hxV : x ∈ Γ.V := by + rw [← hUV] + by_contra hxU + obtain ⟨r', hr', hxr'⟩ := exists_region_of_notMem hxU + obtain ⟨y, hy', hy⟩ := mem_closure_iff.mp hxcl r' (region_isOpen hr') hxr' + exact hxr (region_eq_of_mem hr' hr hy' hy ▸ hxr') + have hcx : c ≠ x := fun h => hxr (h ▸ hc) + -- A path from `x` into `r`. + have hW : IsOpen (Γ.V \ {x})ᶜ := (Γ.finite_V.subset sdiff_subset).isClosed.isOpen_compl + obtain ⟨U₀, h, g, hch, hU₀, hg0⟩ := (hS.2.2 x).exists_ballChart hW (fun h => h.2 rfl) one_pos + obtain ⟨y, hyU, hyr⟩ := mem_closure_iff.mp hxcl U₀ hch.isOpen (hg0 ▸ hch.gm (by simp)) + have hzb : h y ∈ ball (0 : ℂ) 1 := hch.hm hyU + have hgy : g (h y) = y := hch.gh hyU + have htz : ∀ t : I, (t.1 : ℂ) * h y ∈ ball (0 : ℂ) 1 := fun t => by + have hn : ‖h y‖ < 1 := by simpa using hzb + have h₁ : |t.1| ≤ 1 := abs_le.mpr ⟨by linarith [t.2.1], t.2.2⟩ + rw [mem_ball, dist_zero_right, norm_mul, Complex.norm_real, Real.norm_eq_abs] + nlinarith [norm_nonneg (h y), abs_nonneg t.1] + let g₁ : I → S := fun t => g ((t.1 : ℂ) * h y) + have hg₁ : Continuous g₁ := hch.gc.comp_continuous (by fun_prop) htz + have h₁0 : g₁ 0 = x := by simp [g₁, hg0] + have h₁1 : g₁ 1 = y := by simp [g₁, hgy] + have hzne : h y ≠ 0 := fun h0 => hxr (by + have : y = x := by rw [← hgy, h0, hg0] + exact this ▸ hyr) + have hoff : ∀ t : I, 0 < t → g₁ t ∉ Γ.U := by + intro t ht hU + rw [hUV] at hU + have hmem : g₁ t ∈ U₀ := hch.gm (htz t) + have heq : g₁ t = x := by + by_contra hn + exact hU₀ hmem ⟨hU, hn⟩ + have h₂ : (t.1 : ℂ) * h y = 0 := by + have h₃ := hch.hg (htz t) + have h₄ := hch.hg (show (0 : ℂ) ∈ ball (0 : ℂ) 1 by simp) + change h (g₁ t) = _ at h₃ + rw [heq, ← hg0, h₄] at h₃ + exact h₃.symm + have h₃ : (t.1 : ℂ) ≠ 0 := by + exact_mod_cast (ne_of_gt (show (0 : ℝ) < t.1 from ht)) + exact (mul_ne_zero h₃ hzne) h₂ + have h₁ : ∀ t : I, 0 < t → g₁ t ∈ r := by + have hconn : IsPreconnected (g₁ '' Ioi 0) := by + refine IsPreconnected.image ?_ _ hg₁.continuousOn + exact isPreconnected_Ioi + have hdis : Disjoint (g₁ '' Ioi 0) Γ.U := by + refine disjoint_left.mpr ?_ + rintro _ ⟨t, ht, rfl⟩ + exact hoff t ht + have hsub := subset_region hr hconn hdis (x := y) ⟨1, unitInterval.pos_iff_ne_zero.mpr + one_ne_zero, h₁1⟩ hyr + exact fun t ht => hsub ⟨t, ht, rfl⟩ + have hrpath : IsPathConnected r := isPathConnected_of_isOpen hS hro + (region_isPreconnected hr) ⟨c, hc⟩ + obtain ⟨u, hu, hui, hu0, hu1, hup, -⟩ := exists_chord_to_point hrpath hxr hc hg₁ h₁0 h₁ + have hline : IsLineWithEnds (range u) c x := by + have := isLine_range hu hui + rw [hu0, hu1] at this + exact GraphMinor.GM11.IsLineWithEnds.symm this + have hsubp : range u \ {c, x} ⊆ r := by + rintro _ ⟨⟨t, rfl⟩, hn⟩ + exact hup t fun h => hn (Or.inr (by rw [h, hu0]; rfl)) + obtain ⟨s, hs, hcap, -⟩ := parallel_of_line hrad hmax hS hr hc hcV hxV hline hcx hsubp + (disjoint_left.mpr fun z hz hzU => hz.2 (Or.inl (hrU z (hsubp hz) hzU))) + have : c ∈ closure s ∩ Γ'.V := by rw [hcap]; simp + exact hno s hs this.1 + +omit hrad hS [ConnectedSpace S] in +/-- A connected set that misses the boundary of a closed disc and has a point outside misses the +disc. -/ +theorem disjoint_disc_of_outside (hman : ∀ x : S, IsManifoldPoint x) {Δ K : Set S} + (hΔ : IsClosedDisc Δ) + (hK : IsPreconnected K) (hKb : Disjoint K (discBd Δ)) {v : S} (hv : v ∈ K) (hvΔ : v ∉ Δ) : + Disjoint K Δ := by + refine disjoint_left.mpr fun x hxK hxΔ => ?_ + have hi : IsOpen (discInt Δ) := hΔ.isOpen_discInt hman + have hc : IsOpen Δᶜ := hΔ.isClosed.isOpen_compl + have hdis : Disjoint (discInt Δ) Δᶜ := disjoint_left.mpr fun y hy hy' => hy' hy.1 + have hsub : K ⊆ discInt Δ ∪ Δᶜ := fun y hy => by + by_cases hyΔ : y ∈ Δ + · exact Or.inl ⟨hyΔ, disjoint_left.mp hKb hy⟩ + · exact Or.inr hyΔ + have hne : (K ∩ discInt Δ).Nonempty := ⟨x, hxK, hxΔ, disjoint_left.mp hKb hxK⟩ + exact hvΔ (hK.subset_left_of_subset_union hi hc hdis hsub hne hv).1 + +include hmax in +/-- **Each region of `Γ ∪ Γ'` is an open disc.** -/ +theorem face_isOpenDisc {p : Set S} (hp : p ∈ (radialUnion hrad).R) : IsOpenDisc p := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + obtain ⟨r, hr, hpr⟩ := exists_region_of_sub hrad hp + have hrd : IsOpenDisc r := hrad.1.2 r hr + obtain ⟨c, ⟨hc, hcV⟩, -⟩ := hrad.2.2.2.1 r hr + have hc' : c ∈ r := hc + have hcV' : c ∈ Γ'.V := hcV + refine isOpenDisc_of_bound hS (region_isOpen hp) ⟨region_nonempty hp, region_isPreconnected hp⟩ + (fun h => openDisc_ne_univ hS hrd (subset_antisymm (subset_univ _) (h ▸ hpr))) ?_ + intro F hFp hF + obtain ⟨Δ, hΔr, hΔ, hb⟩ := exists_disc_in_openDisc hrd hF (hFp.trans hpr) + have hFdis : Disjoint F (radialUnion hrad).U := + disjoint_left.mpr fun x hx hxU => region_subset hp (hFp hx) hxU + -- Each spoke with a point in `r` misses `Δ`. + have hspoke : ∀ s ∈ Γ'.E, (s ∩ r).Nonempty → Disjoint (closure s) Δ ∧ c ∈ closure s := by + rintro s hs ⟨y, hys, hyr⟩ + obtain ⟨h₁, v, hv, hvr⟩ := spoke_in_region hrad hS hr hc' hcV' hs hys hyr + have hconn : IsPreconnected (closure s) := by + have : IsPreconnected s := hs.2.2.1.isConnected.isPreconnected + exact this.closure + have hKb : Disjoint (closure s) (discBd Δ) := by + rw [hb] + refine disjoint_right.mpr fun x hx hxs => ?_ + exact disjoint_left.mp hFdis hx (Or.inr (Γ'.closure_subset_U hs hxs)) + exact ⟨disjoint_disc_of_outside hman hΔ hconn hKb hv fun h => hvr (hΔr h), h₁⟩ + have hΔU : Disjoint Δ (radialUnion hrad).U := by + refine disjoint_left.mpr fun x hx hxU => ?_ + have hxr := hΔr hx + rcases hxU with h | h + · exact region_subset hr hxr h + by_cases hxV : x ∈ Γ'.V + · have hxc : x = c := hub_unique hrad hr hc' hcV' hxr hxV + obtain ⟨s, hs, hcs⟩ := hub_has_spoke hrad hS hmax hr hc' hcV' + obtain ⟨z, hzc, hzs⟩ := mem_closure_iff.mp hcs r (region_isOpen hr) hc' + exact disjoint_left.mp (hspoke s hs ⟨z, hzs, hzc⟩).1 hcs (hxc ▸ hx) + · rw [Γ'.U_eq] at h + rcases h with h | hyE + · exact hxV h + obtain ⟨g, hg, hxg'⟩ := mem_iUnion₂.mp hyE + have hxg : x ∈ g := Γ'.closure_diff_V hg ▸ ⟨hxg', hxV⟩ + exact disjoint_left.mp (hspoke g hg ⟨x, hxg, hxr⟩).1 hxg' hx + obtain ⟨z, hz⟩ : F.Nonempty := by + obtain ⟨φ⟩ := hF + exact ⟨_, (φ 1).2⟩ + have hconn : IsPreconnected Δ := by + obtain ⟨h, g, c'⟩ := hΔ.exists_isChart + rw [← c'.g_closedBall] + exact (convex_closedBall _ _).isPreconnected.image _ c'.gc + have hzΔ : z ∈ Δ := discBd_subset Δ (hb.symm.subset hz) + exact ⟨Δ, subset_region hp hconn hΔU hzΔ (hFp hz), hΔ, hb⟩ + +include hmax in +/-- **An edge of `Γ` has exactly two regions of `Γ ∪ Γ'` beside it.** The proof compares the two +corners of `Γ ∪ Γ'` beside one end of `e`, and uses `hub_sides`, which says that a region has at +most +two spokes. -/ +theorem exists_two_faces (hE : Γ.E.Nonempty) {e : Set S} (he : e ∈ Γ.E) : + ∃ p ∈ (radialUnion hrad).R, ∃ q ∈ (radialUnion hrad).R, p ≠ q ∧ e ⊆ closure p ∧ e ⊆ closure q ∧ + ∀ p' ∈ (radialUnion hrad).R, e ⊆ closure p' → p' = p ∨ p' = q := by + classical + obtain ⟨y₀, hy₀⟩ := he.1 + have hne : Nonempty S := ⟨y₀⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar (radialUnion hrad) + have hsec : ∀ x : Γ.V, ∃ next ρ P W Q τ, IsSectors (radialUnion hrad) γ x.1 next ρ P W Q τ := + fun x => exists_sectors hS _ hγ + (by rw [radialUnion_V]; exact radial_V hrad x.2) (two_half_edges hrad hS hmax hE hγ x.2) + choose next ρ P W Q τ hs using hsec + have hcor : ∀ x, IsCorners (radialUnion hrad) γ x.1 (next x) (ρ x) := fun x => + IsSectors.corners (hs x) + have hsurj : ∀ x, Function.Surjective (next x) := fun x => next_surjective (hcor x) + have hsidecl : ∀ x i, i.1.1 ⊆ closure (ρ x i) := fun x i => by + obtain ⟨l, hl⟩ := hsurj x i + have := IsCorners.right (hcor x) l + rwa [hl] at this + have heH : e ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inl he + have hend : ∀ b, γ e (endOf b) ∈ Γ.V := fun b => by + have hxU : γ e (endOf b) ∈ Γ.U := Γ.closure_subset_U he (end_mem_closure hγ heH b) + have hxV' : γ e (endOf b) ∈ Γ'.V := by + have := end_mem_V hγ heH b + rwa [radialUnion_V] at this + exact radial_inter hrad ▸ ⟨hxU, Γ'.V_subset_U hxV'⟩ + let x : Γ.V := ⟨_, hend false⟩ + let y : Γ.V := ⟨_, hend true⟩ + let i : halfEdges (radialUnion hrad) γ x.1 := ⟨(e, false), heH, rfl⟩ + let i' : halfEdges (radialUnion hrad) γ y.1 := ⟨(e, true), heH, rfl⟩ + obtain ⟨l, hl⟩ := hsurj x i + have hli : (next x l).1.1 = e := by rw [hl] + refine ⟨ρ x i, IsCorners.region (hcor x) i, ρ x l, IsCorners.region (hcor x) l, ?_, + hsidecl x i, ?_, ?_⟩ + rotate_left + · have := IsCorners.left (hcor x) l + rwa [hli] at this + · intro p' hp' hep' + rcases IsCorners.sides (hcor x) l p' hp' (by rw [hli]; exact hep') with h | h + · exact Or.inr h + · rw [hl] at h + exact Or.inl h + -- Suppose that the two corners lie in one region `p`. + intro hpq + set p := ρ x l with hp_def + have hpR : p ∈ (radialUnion hrad).R := IsCorners.region (hcor x) l + have hip : i.1.1 ⊆ closure p := hpq ▸ hsidecl x i + have hspoke₁ : (next x i).1.1 ∈ Γ'.E := by + rcases corner_alternates hrad hS hmax hE hγ x.2 (hs x) i with ⟨h₁, -⟩ | ⟨-, h₂⟩ + · exact (edge_not_both hrad he h₁).elim + · exact h₂ + have hspoke₂ : l.1.1 ∈ Γ'.E := by + rcases corner_alternates hrad hS hmax hE hγ x.2 (hs x) l with ⟨h₁, -⟩ | ⟨-, h₂⟩ + · exact h₁ + · exact (edge_not_both hrad he (by rw [← hli]; exact h₂)).elim + have hcl₁ : (next x i).1.1 ⊆ closure p := by + have := IsCorners.left (hcor x) i + rwa [hpq] at this + have hcl₂ : l.1.1 ⊆ closure p := hsidecl x l + obtain ⟨r, hr, hpr⟩ := exists_region_of_sub hrad hpR + obtain ⟨f, g, hf, hg, hfp, hgp, hall, hsides⟩ := hub_sides hrad hS hmax hE hr hpR hpr + obtain ⟨φ, hφ, hφp, hadj⟩ := exists_adj hrad hS hmax hE hγ y.2 (hs y) i' he hpR hip + have hadj₁ : IsAdj (next x) (ρ x) p (next x i) i := Or.inr ⟨rfl, hpq⟩ + have hadj₂ : IsAdj (next x) (ρ x) p l i := Or.inl ⟨hl, rfl⟩ + -- A half-edge of a spoke is determined by the spoke. + have hsame : ∀ (u : Γ.V) (φ a : halfEdges (radialUnion hrad) γ u.1) + (m : halfEdges (radialUnion hrad) γ x.1), a.1 = (e, true) → φ.1.1 ∈ Γ'.E → φ.1.1 = m.1.1 → + IsAdj (next u) (ρ u) p φ a → + ∃ a' : halfEdges (radialUnion hrad) γ x.1, a'.1 = (e, true) ∧ IsAdj (next x) (ρ x) p m a' + := by + intro u φ a m ha hk hkm hadj + obtain ⟨x₀, φ₀, -, huniq⟩ := spoke_half_unique hrad hS hk hγ + obtain ⟨e₁, e₂⟩ := huniq u φ rfl + obtain ⟨e₃, e₄⟩ := huniq x m hkm.symm + have hux : u = x := e₁.trans e₃.symm + subst hux + have hk' : φ = m := Subtype.ext (e₂.trans e₄.symm) + subst hk' + exact ⟨a, ha, hadj⟩ + have hyx : ∀ (a : halfEdges (radialUnion hrad) γ x.1), a.1 = (e, true) → a ≠ i := by + intro a ha hai + have := congrArg (fun z : halfEdges (radialUnion hrad) γ x.1 => z.1.2) hai + simp [ha, i] at this + by_cases hφeq : next x i = l + · -- The spoke beside `i` is the same on both sides, so `p` is on both sides of this spoke. + have hone : ∀ A ∈ (radialUnion hrad).R, l.1.1 ⊆ closure A → A = p := by + intro A hA hAl + rcases IsCorners.sides (hcor x) i A hA (by rw [hφeq]; exact hAl) with h | h + · exact h.trans hpq + · rw [hφeq] at h + exact h + by_cases hφl : φ.1.1 = l.1.1 + · obtain ⟨a, ha, hadj'⟩ := hsame y φ i' l rfl hφ hφl hadj + rcases hadj' with ⟨h, -⟩ | ⟨h, -⟩ + · exact hyx a ha (h.symm.trans hl) + · exact hyx a ha (IsCorners.inj (hcor x) (h.trans hφeq.symm)) + · have hfg : f ≠ g := by + rintro rfl + have h₁ := hall _ hspoke₂ hcl₂ + have h₂ := hall _ hφ hφp + simp only [or_self] at h₁ h₂ + exact hφl (h₂.trans h₁.symm) + have hsd := hsides.resolve_left hfg + obtain ⟨A₁, hA₁, A₂, hA₂, hA, h₁, h₂⟩ := hsd _ (hall _ hspoke₂ hcl₂) + exact hA ((hone A₁ hA₁ h₁).trans (hone A₂ hA₂ h₂).symm) + · have hneq : (next x i).1.1 ≠ l.1.1 := by + intro h + obtain ⟨x₀, φ₀, -, huniq⟩ := spoke_half_unique hrad hS hspoke₁ hγ + exact hφeq (Subtype.ext ((huniq x _ rfl).2.trans (huniq x l h.symm).2.symm)) + have hfg : f ≠ g := by + rintro rfl + have h₁ := hall _ hspoke₂ hcl₂ + have h₂ := hall _ hspoke₁ hcl₁ + simp only [or_self] at h₁ h₂ + exact hneq (h₂.trans h₁.symm) + have hsd := hsides.resolve_left hfg + have hcover : φ.1.1 = (next x i).1.1 ∨ φ.1.1 = l.1.1 := by + rcases hall _ hφ hφp with h₀ | h₀ <;> rcases hall _ hspoke₁ hcl₁ with h₁ | h₁ <;> + rcases hall _ hspoke₂ hcl₂ with h₂ | h₂ + all_goals first + | exact Or.inl (h₀.trans h₁.symm) + | exact Or.inr (h₀.trans h₂.symm) + | exact (hneq (h₁.trans h₂.symm)).elim + have key : ∀ m : halfEdges (radialUnion hrad) γ x.1, φ.1.1 = m.1.1 → m.1.1 ∈ Γ'.E → + IsAdj (next x) (ρ x) p m i → False := by + intro m hm hm' hadjm + obtain ⟨a, ha, hadj'⟩ := hsame y φ i' m rfl hφ hm hadj + obtain ⟨A₁, hA₁, A₂, hA₂, hA, h₁, h₂⟩ := hsd m.1.1 (hall _ hm' (hm ▸ hφp)) + exact hyx a ha (adj_unique (hcor x) hA₁ hA₂ hA h₁ h₂ hadj' hadjm) + rcases hcover with h | h + · exact key _ h hspoke₁ hadj₁ + · exact key _ h hspoke₂ hadj₂ + +include hmax in +/-- A region of `Γ'` is an edge of `Γ` with the two regions of `Γ ∪ Γ'` beside it. -/ +theorem region_eq_two_faces (hE : Γ.E.Nonempty) {s e : Set S} (hs : s ∈ Γ'.R) (he : e ∈ Γ.E) + (hes : e ⊆ s) : + ∃ p ∈ (radialUnion hrad).R, ∃ q ∈ (radialUnion hrad).R, p ≠ q ∧ e ⊆ closure p ∧ e ⊆ closure q ∧ + s = p ∪ q ∪ e := by + obtain ⟨p, hp, q, hq, hpq, hep, heq, hall⟩ := exists_two_faces hrad hS hmax hE he + obtain ⟨y, hy⟩ := he.1 + refine ⟨p, hp, q, hq, hpq, hep, heq, subset_antisymm ?_ ?_⟩ + · intro x hx + rcases region_eq_faceUnion hrad hS hmax hE hs he hes hx with h | h + · exact Or.inr h + · obtain ⟨p', ⟨hp', -, hc⟩, hxp'⟩ := mem_iUnion₂.mp h + rcases hall p' hp' hc with rfl | rfl + · exact Or.inl (Or.inl hxp') + · exact Or.inl (Or.inr hxp') + · refine union_subset (union_subset ?_ ?_) hes + · exact region_sub_of_mem hrad hS hs hp (hep hy) (hes hy) + · exact region_sub_of_mem hrad hS hs hq (heq hy) (hes hy) + +include hmax in +/-- **Each region of a radial drawing of a 2-cell drawing is an open disc.** If `Γ` has an edge, a +region of `Γ'` is an edge of `Γ` with the two regions of `Γ ∪ Γ'` beside it, so +`theorem_glue_regions` +applies. If `Γ` has no edge, each region of `Γ'` is a region of `Γ ∪ Γ'`. -/ +theorem radial_region_isOpenDisc {s : Set S} (hs : s ∈ Γ'.R) : IsOpenDisc s := by + by_cases hE : Γ.E.Nonempty + · obtain ⟨hex, -, -⟩ := regionFacts_of_radial hrad hS hmax hE + obtain ⟨e, he, hes⟩ := hex s hs + obtain ⟨p, hp, q, hq, hpq, hep, heq, heqs⟩ := region_eq_two_faces hrad hS hmax hE hs he hes + rw [heqs] + have heH : e ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inl he + exact theorem_glue_regions hS heH hp hq hpq (face_isOpenDisc hrad hS hmax hp) + (face_isOpenDisc hrad hS hmax hq) hep heq + · have hE₀ : Γ.E = ∅ := not_nonempty_iff_eq_empty.mp hE + have hUU : (radialUnion hrad).U = Γ'.U := by + apply subset_antisymm + · rintro x (h | h) + · rw [Γ.U_eq, hE₀] at h + simp only [mem_empty_iff_false, iUnion_of_empty, iUnion_empty, union_empty] at h + exact Γ'.V_subset_U (radial_V hrad h) + · exact h + · exact fun x h => Or.inr h + have hsH : s ∈ (radialUnion hrad).R := by + change s ∈ componentsIn (univ \ (radialUnion hrad).U) + rw [hUU] + exact hs + exact face_isOpenDisc hrad hS hmax hsH + +omit hrad hS in +/-- **A radial drawing of a 2-cell drawing is 2-cell.** Graph Minors XI, Section 3 (page 75). -/ +theorem radial_isTwoCell_of_drawing (hS : IsClosedSurface S) + (h : (PaintingOrDrawing.drawing Γ).IsRadialDrawing Γ') : Γ'.IsTwoCell := by + have hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ' := ⟨h.1, h.2.1⟩ + exact ⟨inferInstance, fun _ hs => radial_region_isOpenDisc hrad hS h.2.2 hs⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/RegionCount.lean b/LeanPool/GraphMinor/GM11/RegionCount.lean new file mode 100644 index 0000000000..ab3f2789a1 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/RegionCount.lean @@ -0,0 +1,465 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RegionWalk + +/-! +# How often the walk around a region uses an edge + +The walk around a region `r` uses an edge once for each side of the edge in `r`. An edge has two +sides in +`r` when `r` together with the edge contains a neighbourhood of a point of the edge (`IsTwoSided`). +`count_collar_walk` is the result. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- Both sides of the edge `e` are in `r`: the set `r ∪ e` contains a neighbourhood of a point of +`e`. -/ +def IsTwoSided (r e : Set S) : Prop := (e ∩ interior (r ∪ e)).Nonempty + +open Classical in +/-- The number of times a list of edges contains `e`. -/ +noncomputable def edgeCount (l : List (Set S)) (e : Set S) : ℕ := l.count e + +omit [TopologicalSpace S] in +open Classical in +theorem edgeCount_map_range (F : ℕ → Set S) (e : Set S) (p : ℕ) : + edgeCount ((List.range' 0 p).map F) e = ((Finset.range p).filter fun j => F j = e).card := by + induction p with + | zero => simp [edgeCount] + | succ p ih => + have h₁ : List.range' 0 (p + 1) = List.range' 0 p ++ [p] := by + simpa using (List.range'_1_concat (s := 0) (n := p)) + rw [Finset.range_add_one, Finset.filter_insert] + simp only [edgeCount, h₁, List.map_append, List.map_cons, List.map_nil, List.count_append] + simp only [edgeCount] at ih + rw [ih] + by_cases h : F p = e + · have hnot : p ∉ (Finset.range p).filter fun j => F j = e := by simp + simp [h, hnot] + · have h' : ¬ e = F p := fun h' => h h'.symm + simp [h] + +variable [T2Space S] [ConnectedSpace S] {D D₂ Γ' : Drawing S} {A B : Set S → Set S} {m x y : Set S + → S} + {r : Set S} {n p : ℕ} {v : ℕ → S} {a s P : ℕ → Set S} {ε : ℕ → I → S} {h : C(Circle × I, S)} + {F : ℕ → Set S} + +open Classical in +/-- The steps of the collar along the edge `g`. -/ +noncomputable def stepsOn (n : ℕ) (a : ℕ → Set S) (g : Set S) : Finset ℕ := + (Finset.range n).filter fun i => a i = g + +omit [TopologicalSpace S] [T2Space S] [ConnectedSpace S] in +theorem mem_stepsOn {g : Set S} {i : ℕ} : i ∈ stepsOn n a g ↔ i < n ∧ a i = g := by + simp [stepsOn] + +section + +variable (hrad : PreRad (PaintingOrDrawing.drawing D₂) Γ') (hS : IsClosedSurface S) + (hmax : RadMax (PaintingOrDrawing.drawing D₂) Γ') (hE : D₂.E.Nonempty) + (hc : IsHubCollar D₂ Γ' (radialUnion hrad) r n v a s P ε h) +include hrad hS hmax hE hc + +open Classical in +/-- The steps along an edge match its two faces inside `r`. -/ +theorem card_stepsOn {g f₁ f₂ : Set S} (hg : g ∈ D₂.E) (h₁ : f₁ ∈ (radialUnion hrad).R) + (h₂ : f₂ ∈ (radialUnion hrad).R) (hne : f₁ ≠ f₂) + (hall : ∀ p' ∈ (radialUnion hrad).R, g ⊆ closure p' → p' = f₁ ∨ p' = f₂) + (hc₁ : g ⊆ closure f₁) (hc₂ : g ⊆ closure f₂) : + (stepsOn n a g).card = (if f₁ ⊆ r then 1 else 0) + (if f₂ ⊆ r then 1 else 0) := by + have hinj : InjOn P (stepsOn n a g : Set ℕ) := by + intro i hi j hj heq + exact hc.inj i j (mem_stepsOn.mp hi).1 (mem_stepsOn.mp hj).1 heq + have himg : (stepsOn n a g).image P = (({f₁, f₂} : Finset (Set S)).filter fun f => f ⊆ r) := by + ext f + simp only [Finset.mem_image, Finset.mem_filter, Finset.mem_insert, Finset.mem_singleton] + constructor + · rintro ⟨i, hi, rfl⟩ + obtain ⟨hin, hai⟩ := mem_stepsOn.mp hi + exact ⟨hall _ (hc.region i) (hai ▸ hc.edge_cl i), hc.region_sub i⟩ + · rintro ⟨hf, hfr⟩ + have hfR : f ∈ (radialUnion hrad).R := by + rcases hf with rfl | rfl + · exact h₁ + · exact h₂ + have hgf : g ⊆ closure f := by + rcases hf with rfl | rfl + · exact hc₁ + · exact hc₂ + obtain ⟨i, hi, rfl⟩ := hc.all f hfR hfr + obtain ⟨e₀, -, -, huniq, -⟩ := face_edge hrad hS hmax hE hfR + exact ⟨i, mem_stepsOn.mpr ⟨hi, (huniq _ (hc.edge i) (hc.edge_cl i)).trans + (huniq _ hg hgf).symm⟩, rfl⟩ + rw [← Finset.card_image_of_injOn hinj, himg, Finset.filter_insert, Finset.filter_singleton] + by_cases a₁ : f₁ ⊆ r <;> by_cases a₂ : f₂ ⊆ r <;> simp only [a₁, a₂, ite_true, ite_false] <;> + simp [hne] + +omit hc in +/-- The faces of `e` from the region of `Γ'` around it: the region is the union of the faces and +`e`. -/ +theorem exists_faces_region {g : Set S} (hg : g ∈ D₂.E) : + ∃ t ∈ Γ'.R, ∃ f₁ ∈ (radialUnion hrad).R, ∃ f₂ ∈ (radialUnion hrad).R, f₁ ≠ f₂ ∧ + g ⊆ closure f₁ ∧ g ⊆ closure f₂ ∧ t = f₁ ∪ f₂ ∪ g ∧ + ∀ p' ∈ (radialUnion hrad).R, g ⊆ closure p' → p' = f₁ ∨ p' = f₂ := by + obtain ⟨z, hz⟩ := hg.1 + have hzU : z ∉ Γ'.U := by + intro hzU + have hmem : z ∈ D₂.U ∩ Γ'.U := ⟨(hg.2.1 hz).1, hzU⟩ + rw [radial_inter hrad] at hmem + exact (hg.2.1 hz).2 hmem + obtain ⟨t, ht, hzt⟩ := exists_region_of_notMem hzU + have hdis : Disjoint g Γ'.U := by + refine disjoint_left.mpr fun w hw hwU => ?_ + have hmem : w ∈ D₂.U ∩ Γ'.U := ⟨(hg.2.1 hw).1, hwU⟩ + rw [radial_inter hrad] at hmem + exact (hg.2.1 hw).2 hmem + have hgt : g ⊆ t := subset_region ht hg.2.2.1.isConnected.isPreconnected hdis hz hzt + obtain ⟨f₁, h₁, f₂, h₂, hne, c₁, c₂, heq⟩ := region_eq_two_faces hrad hS hmax hE ht hg hgt + obtain ⟨f₃, h₃, f₄, h₄, hne', c₃, c₄, hall⟩ := exists_two_faces hrad hS hmax hE hg + refine ⟨t, ht, f₁, h₁, f₂, h₂, hne, c₁, c₂, heq, ?_⟩ + intro p' hp' hc' + have e₁ := hall _ h₁ c₁ + have e₂ := hall _ h₂ c₂ + rcases hall p' hp' hc' with rfl | rfl <;> rcases e₁ with rfl | rfl <;> rcases e₂ with rfl | rfl + all_goals first | exact Or.inl rfl | exact Or.inr rfl | exact (hne rfl).elim + +end + +section + +variable (hd : SplitData D D₂ A B m x y) (hnp : n = 2 * p) + (hF : ∀ j, F j ∈ D.E ∧ v (2 * j + 1) = m (F j) ∧ + ((a (2 * j) = A (F j) ∧ a (2 * j + 1) = B (F j) ∧ x (F j) = v (2 * j) ∧ + y (F j) = v (2 * j + 2)) ∨ + (a (2 * j) = B (F j) ∧ a (2 * j + 1) = A (F j) ∧ y (F j) = v (2 * j) ∧ + x (F j) = v (2 * j + 2)))) +include hd hnp hF + +omit [T2Space S] [ConnectedSpace S] in +open Classical in +/-- A step on one half of `e` lies in a passage along `e`, and each passage has one such step. -/ +theorem card_steps_half {e g g' : Set S} (he : e ∈ D.E) (hsub : g ∈ D₂.E) (hne : g ≠ g') + (hgg : g ⊆ e) + (hpair : ∀ j, (a (2 * j) = g ∧ a (2 * j + 1) = g') ∨ (a (2 * j) = g' ∧ a (2 * j + 1) = g) + ∨ F j ≠ e) : + (stepsOn n a g).card = ((Finset.range p).filter fun j => F j = e).card := by + have hedge : ∀ j, a (2 * j) ⊆ F j ∧ a (2 * j + 1) ⊆ F j := by + intro j + obtain ⟨hf, -, h₁⟩ := hF j + rcases h₁ with ⟨h₁, h₂, -⟩ | ⟨h₁, h₂, -⟩ + · rw [h₁, h₂] + exact ⟨hd.A_sub hf, hd.B_sub hf⟩ + · rw [h₁, h₂] + exact ⟨hd.B_sub hf, hd.A_sub hf⟩ + obtain ⟨z, hz⟩ := hsub.1 + have heq : ∀ {i j}, (i = 2 * j ∨ i = 2 * j + 1) → a i = g → F j = e := by + rintro i j (rfl | rfl) hi + · exact D.edge_eq_of_mem (hF j).1 he ((hedge j).1 (hi ▸ hz)) (hgg hz) + · exact D.edge_eq_of_mem (hF j).1 he ((hedge j).2 (hi ▸ hz)) (hgg hz) + refine Finset.card_bij (fun i _ => i / 2) ?_ ?_ ?_ + · intro i hi + obtain ⟨hin, hai⟩ := mem_stepsOn.mp hi + simp only [Finset.mem_filter, Finset.mem_range] + exact ⟨by omega, heq (by omega) hai⟩ + · intro i hi i' hi' hii + obtain ⟨-, hai⟩ := mem_stepsOn.mp hi + obtain ⟨-, hai'⟩ := mem_stepsOn.mp hi' + set j := i / 2 with hj + have hFj : F j = e := heq (by omega) hai + have hc₁ : i = 2 * j ∨ i = 2 * j + 1 := by omega + have hc₂ : i' = 2 * j ∨ i' = 2 * j + 1 := by omega + rcases hpair j with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ | h₁ + · rcases hc₂ with rfl | rfl + · rcases hc₁ with h₃ | h₃ + · exact h₃ + · exact (hne (hai.symm.trans (by rw [h₃, h₂]))).elim + · exact (hne (hai'.symm.trans h₂)).elim + · rcases hc₁ with h₃ | h₃ + · exact (hne ((by rw [← hai, h₃, h₁]))).elim + · rcases hc₂ with h₄ | h₄ + · exact (hne ((by rw [← hai', h₄, h₁]))).elim + · omega + · exact (h₁ hFj).elim + · intro j hj + simp only [Finset.mem_filter, Finset.mem_range] at hj + rcases hpair j with ⟨h₁, -⟩ | ⟨-, h₁⟩ | h₁ + · exact ⟨2 * j, mem_stepsOn.mpr ⟨by omega, h₁⟩, by omega⟩ + · exact ⟨2 * j + 1, mem_stepsOn.mpr ⟨by omega, h₁⟩, by omega⟩ + · exact (h₁ hj.2).elim + +omit [T2Space S] [ConnectedSpace S] in +open Classical in +theorem card_steps_A {e : Set S} (he : e ∈ D.E) : + (stepsOn n a (A e)).card = ((Finset.range p).filter fun j => F j = e).card := by + refine card_steps_half hd hnp hF he (hd.A_mem e he) (hd.ne_AB he) (hd.A_sub he) fun j => ?_ + by_cases hj : F j = e + · obtain ⟨-, -, h₁⟩ := hF j + rw [hj] at h₁ + rcases h₁ with ⟨h₁, h₂, -⟩ | ⟨h₁, h₂, -⟩ + · exact Or.inl ⟨h₁, h₂⟩ + · exact Or.inr (Or.inl ⟨h₁, h₂⟩) + · exact Or.inr (Or.inr hj) + +omit [T2Space S] [ConnectedSpace S] in +open Classical in +theorem card_steps_B {e : Set S} (he : e ∈ D.E) : + (stepsOn n a (B e)).card = ((Finset.range p).filter fun j => F j = e).card := by + refine card_steps_half hd hnp hF he (hd.B_mem e he) (hd.ne_AB he).symm (hd.B_sub he) fun j => ?_ + by_cases hj : F j = e + · obtain ⟨-, -, h₁⟩ := hF j + rw [hj] at h₁ + rcases h₁ with ⟨h₁, h₂, -⟩ | ⟨h₁, h₂, -⟩ + · exact Or.inr (Or.inl ⟨h₁, h₂⟩) + · exact Or.inl ⟨h₁, h₂⟩ + · exact Or.inr (Or.inr hj) + +end + +open Classical in +/-- **How often the walk around a region uses an edge**, in terms of the steps of the collar. -/ +theorem card_passes (hd : SplitData D D₂ A B m x y) + (hrad : PreRad (PaintingOrDrawing.drawing D₂) Γ') (hS : IsClosedSurface S) + (hmax : RadMax (PaintingOrDrawing.drawing D₂) Γ') (hE : D₂.E.Nonempty) + (hc : IsHubCollar D₂ Γ' (radialUnion hrad) r n v a s P ε h) (hr : r ∈ D₂.R) (hnp : n = 2 * p) + (hF : ∀ j, F j ∈ D.E ∧ v (2 * j + 1) = m (F j) ∧ + ((a (2 * j) = A (F j) ∧ a (2 * j + 1) = B (F j) ∧ x (F j) = v (2 * j) ∧ + y (F j) = v (2 * j + 2)) ∨ + (a (2 * j) = B (F j) ∧ a (2 * j + 1) = A (F j) ∧ y (F j) = v (2 * j) ∧ + x (F j) = v (2 * j + 2)))) {e : Set S} (he : e ∈ D.E) : + edgeCount ((List.range' 0 p).map F) e = + if (e ∩ frontier r).Nonempty then (if IsTwoSided r e then 2 else 1) else 0 := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hcount := edgeCount_map_range F e p + rw [hcount] + set c := ((Finset.range p).filter fun j => F j = e).card with hcdef + have hA := card_steps_A hd hnp hF he + have hB := card_steps_B hd hnp hF he + have hU : ∀ f ∈ (radialUnion hrad).R, Disjoint f D₂.U := fun f hf => + disjoint_left.mpr fun w hw hwU => region_subset hf hw (Or.inl hwU) + -- A face either lies in `r` or misses it. + have hface : ∀ f ∈ (radialUnion hrad).R, (f ∩ r).Nonempty → f ⊆ r := by + rintro f hf ⟨w, hw, hwr⟩ + obtain ⟨r', hr', hsub⟩ := exists_region_of_sub hrad hf + obtain rfl := region_eq_of_mem hr' hr (hsub hw) hwr + exact hsub + -- Two steps on an edge with a point inside `r ∪ e`. + have htwo : ∀ {g : Set S}, g ∈ D₂.E → g ⊆ e → (g ∩ interior (r ∪ e)).Nonempty → + (stepsOn n a g).card = 2 := by + rintro g hg hge ⟨z, hzg, hzO⟩ + obtain ⟨t, ht, f₁, h₁, f₂, h₂, hne, c₁, c₂, -, hall⟩ := exists_faces_region hrad hS hmax hE hg + have hin : ∀ f ∈ (radialUnion hrad).R, g ⊆ closure f → f ⊆ r := by + intro f hf hgf + obtain ⟨w, hwO, hwf⟩ := mem_closure_iff.mp (hgf hzg) _ isOpen_interior hzO + refine hface f hf ⟨w, hwf, ?_⟩ + rcases interior_subset hwO with hw | hw + · exact hw + · have hwU : w ∈ D₂.U := by + rw [hd.U_eq] + exact (he.2.1 hw).1 + exact (disjoint_left.mp (hU f hf) hwf hwU).elim + rw [card_stepsOn hrad hS hmax hE hc hg h₁ h₂ hne hall c₁ c₂] + simp [hin f₁ h₁ c₁, hin f₂ h₂ c₂] + have hcA : c = (stepsOn n a (A e)).card := hA.symm + have hAe := hd.A_sub he + have hBe := hd.B_sub he + have hmA : m e ∈ closure (A e) := by + have : m e ∈ closure (A e) ∩ D₂.V := by rw [hd.cap_A e he]; simp + exact this.1 + have htwo₁ : IsTwoSided r e → c = 2 := by + rintro ⟨w, hw, hwO⟩ + rw [hd.union e he] at hw + rcases hw with (hw | hw) | hw + · rw [hcA] + exact htwo (hd.A_mem e he) hAe ⟨w, hw, hwO⟩ + · have hwm : w = m e := hw + obtain ⟨w', hw'O, hw'⟩ := mem_closure_iff.mp (hwm ▸ hmA) _ isOpen_interior hwO + rw [hcA] + exact htwo (hd.A_mem e he) hAe ⟨w', hw', hw'O⟩ + · rw [hcdef, ← hB] + exact htwo (hd.B_mem e he) hBe ⟨w, hw, hwO⟩ + have htwo₂ : c = 2 → IsTwoSided r e := by + intro hc2 + obtain ⟨t, ht, f₁, h₁, f₂, h₂, hne, c₁, c₂, heq, hall⟩ := + exists_faces_region hrad hS hmax hE (hd.A_mem e he) + rw [hcA, card_stepsOn hrad hS hmax hE hc (hd.A_mem e he) h₁ h₂ hne hall c₁ c₂] at hc2 + have hf₁ : f₁ ⊆ r := by + by_contra h' + simp only [h', ite_false] at hc2 + split_ifs at hc2 + all_goals omega + have hf₂ : f₂ ⊆ r := by + by_contra h' + simp only [h', ite_false] at hc2 + split_ifs at hc2; omega + obtain ⟨z, hz⟩ := (hd.A_mem e he).1 + refine ⟨z, hAe hz, ?_⟩ + have hsub : t ⊆ r ∪ e := by + rw [heq] + rintro w ((hw | hw) | hw) + · exact Or.inl (hf₁ hw) + · exact Or.inl (hf₂ hw) + · exact Or.inr (hAe hw) + exact interior_maximal hsub (region_isOpen ht) (heq ▸ Or.inr hz) + have hfr : (e ∩ frontier r).Nonempty ↔ 0 < c := by + constructor + · rintro ⟨z, hze, hzf⟩ + rw [← hc.range_bottom] at hzf + obtain ⟨w, rfl⟩ := hzf + obtain ⟨i, hi, u, -, rfl⟩ := exists_circle_param hc.pos w + have hval : h (Circle.exp (2 * Real.pi * ((i + u.1) / n)), 0) = ε i u := hc.bottom i hi u + simp only [hval] at hze + have hcl : ε i u ∈ closure (a i) := hc.ε_range i ▸ mem_range_self u + obtain ⟨f, hf, hai⟩ := hd.all _ (hc.edge i) + have hfe : f = e := by + by_cases hV : ε i u ∈ D₂.V + · have hVm : ε i u = m e := by + rw [hd.V_eq] at hV + rcases hV with hV | ⟨f', hf', hm⟩ + · exact ((he.2.1 hze).2 hV).elim + · have : f' = e := D.edge_eq_of_mem hf' he (hm ▸ hd.mid f' hf') hze + rw [← hm, this] + rcases hai with hai | hai + · have hmem : ε i u ∈ closure (A f) ∩ D₂.V := ⟨hai ▸ hcl, hd.V_eq ▸ hV⟩ + rw [hd.cap_A f hf, hVm] at hmem + rcases hmem with h₁ | h₁ + · exact (hd.mid_notMem he (h₁ ▸ hd.x_mem f hf)).elim + · exact (hd.mid_inj he hf h₁).symm + · have hmem : ε i u ∈ closure (B f) ∩ D₂.V := ⟨hai ▸ hcl, hd.V_eq ▸ hV⟩ + rw [hd.cap_B f hf, hVm] at hmem + rcases hmem with h₁ | h₁ + · exact (hd.mid_inj he hf h₁).symm + · exact (hd.mid_notMem he ((mem_singleton_iff.mp h₁) ▸ hd.y_mem f hf)).elim + · have hin : ε i u ∈ a i := (D₂.closure_diff_V (hc.edge i)).subset ⟨hcl, hV⟩ + rcases hai with hai | hai + · exact D.edge_eq_of_mem hf he (hd.A_sub hf (hai ▸ hin)) hze + · exact D.edge_eq_of_mem hf he (hd.B_sub hf (hai ▸ hin)) hze + subst hfe + rcases hai with hai | hai + · rw [hcA] + exact Finset.card_pos.mpr ⟨i, mem_stepsOn.mpr ⟨hi, hai⟩⟩ + · rw [hcdef, ← hB] + exact Finset.card_pos.mpr ⟨i, mem_stepsOn.mpr ⟨hi, hai⟩⟩ + · intro hpos + rw [hcA] at hpos + obtain ⟨i, hi⟩ := Finset.card_pos.mp hpos + obtain ⟨hin, hai⟩ := mem_stepsOn.mp hi + obtain ⟨z, hz⟩ := (hc.edge i).1 + refine ⟨z, hAe (hai ▸ hz), ?_⟩ + rw [← hc.image_Ioo] at hz + obtain ⟨u, -, rfl⟩ := hz + rw [← hc.range_bottom, ← hc.bottom i hin u] + exact mem_range_self _ + have hle : c ≤ 2 := by + obtain ⟨t, ht, f₁, h₁, f₂, h₂, hne, c₁, c₂, heq, hall⟩ := + exists_faces_region hrad hS hmax hE (hd.A_mem e he) + rw [hcA, card_stepsOn hrad hS hmax hE hc (hd.A_mem e he) h₁ h₂ hne hall c₁ c₂] + split_ifs <;> simp + by_cases h₂ : IsTwoSided r e + · have h₃ := htwo₁ h₂ + have hnn := hfr.mpr (by omega) + simp only [h₂, hnn, ite_true] + exact h₃ + · simp only [h₂, ite_false] + have hne2 : c ≠ 2 := fun h' => h₂ (htwo₂ h') + by_cases h₃ : (e ∩ frontier r).Nonempty + · simp only [h₃, ite_true] + have := hfr.mp h₃ + omega + · simp only [h₃, ite_false] + have := mt hfr.mpr h₃ + omega + +omit [T2Space S] [ConnectedSpace S] in +/-- The first vertex of the collar can be taken in the first drawing. -/ +theorem exists_start (hd : SplitData D D₂ A B m x y) {H : Drawing S} + (hc : IsHubCollar D₂ Γ' H r n v a s P ε h) : + ∃ h', ∃ (v' : ℕ → S) (a' s' P' : ℕ → Set S) (ε' : ℕ → I → S), + IsHubCollar D₂ Γ' H r n v' a' s' P' ε' h' ∧ v' 0 ∈ D.V ∧ + (range (fun z : Circle => h' (z, 0)) = range fun z : Circle => h (z, 0)) := by + have hsame : v 0 ∈ D.V ∨ v 1 ∈ D.V := by + obtain ⟨e, he, hg⟩ := hd.all _ (hc.edge 0) + have hcap := hc.cap 0 + rcases hg with hg | hg + · rw [hg, hd.cap_A e he] at hcap + have : x e ∈ ({v 0, v (0 + 1)} : Set S) := hcap ▸ (by simp) + rcases this with h₁ | h₁ + · exact Or.inl (h₁ ▸ hd.x_mem e he) + · exact Or.inr ((mem_singleton_iff.mp h₁) ▸ hd.x_mem e he) + · rw [hg, hd.cap_B e he] at hcap + have : y e ∈ ({v 0, v (0 + 1)} : Set S) := hcap ▸ (by simp) + rcases this with h₁ | h₁ + · exact Or.inl (h₁ ▸ hd.y_mem e he) + · exact Or.inr ((mem_singleton_iff.mp h₁) ▸ hd.y_mem e he) + rcases hsame with h₁ | h₁ + · exact ⟨h, v, a, s, P, ε, hc, h₁, rfl⟩ + · obtain ⟨h', hc', hh⟩ := hc.shift + refine ⟨h', _, _, _, _, _, hc', h₁, ?_⟩ + rw [hc'.range_bottom, hc.range_bottom] + +open Classical in +/-- **The walk around a region of a 2-cell drawing in a sphere.** The curve at the bottom of the +collar +`h` runs along a closed walk `W` around the frontier of `r`, which uses each edge once for each of +its +sides in `r`. -/ +theorem exists_region_walk (hS : IsClosedSurface S) (hsph : IsSphere S) + (hT : (PaintingOrDrawing.drawing D).IsTwoCell) (hE : D.E.Nonempty) (hr : r ∈ D.R) : + ∃ (u : S) (W : GraphWalk D.toGraph u u) (h : C(Circle × I, S)), 0 < W.length ∧ + InjOn h {p | 0 < p.2} ∧ (∀ p : Circle × I, 0 < p.2 → h p ∈ r) ∧ + range (fun z : Circle => h (z, 0)) = frontier r ∧ IsOpen (rᶜ ∪ h '' {p | p.2 < 1}) ∧ + RunsAlongOn D (collarCurve h) 0 1 W ∧ + ∀ e ∈ D.E, edgeCount W.edges e = + if (e ∩ frontier r).Nonempty then (if IsTwoSided r e then 2 else 1) else 0 := by + have hne : Nonempty S := ⟨(region_nonempty hr).some⟩ + obtain ⟨D₂, A', B', m', x', y', hU, hV, hall, hevery⟩ := exists_split D + have hd : SplitData D D₂ A' B' m' x' y' := by + refine ⟨hU, hV, fun e he => (hall e he).1, fun e he => (hall e he).2.1, + fun e he => (hall e he).2.2.1, fun e he => (hall e he).2.2.2.1, + fun e he => (hall e he).2.2.2.2.1, fun e he => (hall e he).2.2.2.2.2.1, + fun e he => (hall e he).2.2.2.2.2.2.1, fun e he => (hall e he).2.2.2.2.2.2.2.1, + fun e he => (hall e he).2.2.2.2.2.2.2.2.1, fun e he => (hall e he).2.2.2.2.2.2.2.2.2.1, + fun e he => (hall e he).2.2.2.2.2.2.2.2.2.2.1, fun e he => (hall e he).2.2.2.2.2.2.2.2.2.2.2, + hevery⟩ + have hRR : D₂.R = D.R := by + change componentsIn (univ \ D₂.U) = componentsIn (univ \ D.U) + rw [hU] + have hr₂ : r ∈ D₂.R := hRR ▸ hr + have hT₂ : (PaintingOrDrawing.drawing D₂).IsTwoCell := by + refine ⟨hT.1, fun q hq => hT.2 q (show q ∈ D.R from hRR ▸ (show q ∈ D₂.R from hq))⟩ + have hE₂ : D₂.E.Nonempty := by + obtain ⟨e, he⟩ := hE + exact ⟨_, hd.A_mem e he⟩ + obtain ⟨Γ'', hΓ⟩ := exists_radialDrawing hS hT₂ + have hrad : PreRad (PaintingOrDrawing.drawing D₂) Γ'' := ⟨hΓ.1, hΓ.2.1⟩ + have hmax : RadMax (PaintingOrDrawing.drawing D₂) Γ'' := hΓ.2.2 + obtain ⟨n₀, v₀, a₀, s₀, P₀, ε₀, h₀, hc₀⟩ := exists_hub_collar hrad hS hmax hsph hE₂ hd.noLoop hr₂ + obtain ⟨h₁, v₁, a₁, s₁, P₁, ε₁, hc₁, hv₁, -⟩ := exists_start hd hc₀ + obtain ⟨p', hnp, F, hF⟩ := exists_steps hd hrad hS hmax hE₂ hc₁ hv₁ + obtain ⟨W, hW, hedges⟩ := exists_collar_walk hd hc₁ hv₁ hnp hF + have hp : 0 < p' := by + have := hc₁.two_le + omega + refine ⟨_, W, h₁, ?_, hc₁.injOn, hc₁.mem_r, hc₁.range_bottom, hc₁.isOpen, hW, ?_⟩ + · simp [GraphWalk.length, hedges, hp] + · intro e he + rw [hedges] + exact card_passes hd hrad hS hmax hE₂ hc₁ hr₂ hnp hF he + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/RegionWalk.lean b/LeanPool/GraphMinor/GM11/RegionWalk.lean new file mode 100644 index 0000000000..a9e45ddf12 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/RegionWalk.lean @@ -0,0 +1,517 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.HubWalk +public import LeanPool.GraphMinor.GM11.SplitEdge + +/-! +# A walk around a region + +`exists_steps` reads off from the collar of a region, in a drawing whose edges have been split, the +walk +around the region in the first drawing. `exists_runs_walk` turns a list of steps into a walk with +`RunsAlongOn`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A list of steps along a curve is a walk that the curve runs along. -/ +theorem exists_runs_walk (D : Drawing S) {m : ℕ} {w : ℕ → S} {e : ℕ → Set S} {x : ℕ → ℝ} {φ : ℝ → S} + (hlink : ∀ j < m, D.toGraph.IsLink (e j) (w j) (w (j + 1))) (hx : ∀ j < m, x j < x (j + 1)) + (hstart : ∀ j ≤ m, φ (x j) = w j) (hinj : ∀ j < m, InjOn φ (Ioo (x j) (x (j + 1)))) + (him : ∀ j < m, φ '' Ioo (x j) (x (j + 1)) = e j) (hV : w m ∈ D.V) {z : S} (hz : w m = z) : + ∀ d ≤ m, ∃ W : GraphWalk D.toGraph (w (m - d)) z, RunsAlongOn D φ (x (m - d)) (x m) W ∧ + W.edges = (List.range' (m - d) d).map e := by + subst hz + intro d + induction d with + | zero => + intro _ + simp only [Nat.sub_zero] + exact ⟨.nil hV, ⟨rfl, hstart m le_rfl⟩, by simp [GraphWalk.edges]⟩ + | succ d ih => + intro hd + obtain ⟨W, hW, hedges⟩ := ih (by omega) + have hj : m - (d + 1) < m := by omega + have hs : m - (d + 1) + 1 = m - d := by omega + have hl := hlink _ hj + rw [hs] at hl + refine ⟨.cons hl W, ?_, ?_⟩ + · refine ⟨x (m - d), ?_, hstart _ (by omega), ?_, ?_, hW⟩ + · have := hx _ hj + rwa [hs] at this + · have := hinj _ hj + rwa [hs] at this + · have := him _ hj + rwa [hs] at this + · simp only [GraphWalk.edges, hedges] + rw [show d + 1 = (d + 1) by rfl, List.range'_succ, List.map_cons, hs] + +namespace IsHubCollar + +variable {Γ Γ' H : Drawing S} {r : Set S} {n : ℕ} {v : ℕ → S} {a s P : ℕ → Set S} {ε : ℕ → I → S} + {h : C(Circle × I, S)} + +/-- The open arc of a step is its edge. -/ +theorem image_Ioo (hc : IsHubCollar Γ Γ' H r n v a s P ε h) (i : ℕ) : ε i '' Ioo 0 1 = a i := by + have hE := Γ.closure_diff_V (hc.edge i) + ext y + constructor + · rintro ⟨u, hu, rfl⟩ + rw [← hE] + refine ⟨hc.ε_range i ▸ mem_range_self u, fun hV => ?_⟩ + have hm : ε i u ∈ closure (a i) ∩ Γ.V := ⟨hc.ε_range i ▸ mem_range_self u, hV⟩ + rw [hc.cap] at hm + rcases hm with h₁ | h₁ + · have := hc.ε_inj i (h₁.trans (hc.ε_zero i).symm) + exact hu.1.ne' this + · have := hc.ε_inj i ((mem_singleton_iff.mp h₁).trans (hc.ε_one i).symm) + exact hu.2.ne this + · intro hy + have hcl : y ∈ range (ε i) := hc.ε_range i ▸ subset_closure hy + obtain ⟨u, rfl⟩ := hcl + have hnV := ((hc.edge i).2.1 hy).2 + refine ⟨u, ⟨?_, ?_⟩, rfl⟩ + · refine unitInterval.pos_iff_ne_zero.mpr fun h₀ => hnV ?_ + rw [h₀, hc.ε_zero] + exact hc.vertex i + · refine lt_of_le_of_ne (unitInterval.le_one u) fun h₁ => hnV ?_ + rw [h₁, hc.ε_one] + exact hc.vertex _ + +/-- The curve at the bottom of the collar, on the `i`-th step. -/ +theorem curve_eq (hc : IsHubCollar Γ Γ' H r n v a s P ε h) {i : ℕ} (hi : i < n) (u : I) : + collarCurve h ((i + u.1) / n) = ε i u := + hc.bottom i hi u + +end IsHubCollar + +/-- The data of `exists_split`. -/ +structure SplitData (D D₂ : Drawing S) (A B : Set S → Set S) (m x y : Set S → S) : Prop where + U_eq : D₂.U = D.U + V_eq : D₂.V = D.V ∪ m '' D.E + A_mem : ∀ e ∈ D.E, A e ∈ D₂.E + B_mem : ∀ e ∈ D.E, B e ∈ D₂.E + mid : ∀ e ∈ D.E, m e ∈ e + mid_A : ∀ e ∈ D.E, m e ∉ A e + mid_B : ∀ e ∈ D.E, m e ∉ B e + disj : ∀ e ∈ D.E, Disjoint (A e) (B e) + union : ∀ e ∈ D.E, e = A e ∪ {m e} ∪ B e + x_mem : ∀ e ∈ D.E, x e ∈ D.V + y_mem : ∀ e ∈ D.E, y e ∈ D.V + cap : ∀ e ∈ D.E, closure e ∩ D.V = {x e, y e} + cap_A : ∀ e ∈ D.E, closure (A e) ∩ D₂.V = {x e, m e} + cap_B : ∀ e ∈ D.E, closure (B e) ∩ D₂.V = {m e, y e} + all : ∀ g ∈ D₂.E, ∃ e ∈ D.E, g = A e ∨ g = B e + +variable {D D₂ : Drawing S} {A B : Set S → Set S} {m x y : Set S → S} + +namespace SplitData + +theorem mid_notMem (hd : SplitData D D₂ A B m x y) {e : Set S} (he : e ∈ D.E) : m e ∉ D.V := + (he.2.1 (hd.mid e he)).2 + +theorem mid_V₂ (hd : SplitData D D₂ A B m x y) {e : Set S} (he : e ∈ D.E) : m e ∈ D₂.V := + hd.V_eq ▸ Or.inr ⟨e, he, rfl⟩ + +theorem V_sub (hd : SplitData D D₂ A B m x y) {z : S} (hz : z ∈ D.V) : z ∈ D₂.V := + hd.V_eq ▸ Or.inl hz + +theorem A_sub (hd : SplitData D D₂ A B m x y) {e : Set S} (he : e ∈ D.E) : A e ⊆ e := fun _ h => by + rw [hd.union e he] + exact Or.inl (Or.inl h) + +theorem B_sub (hd : SplitData D D₂ A B m x y) {e : Set S} (he : e ∈ D.E) : B e ⊆ e := fun _ h => by + rw [hd.union e he] + exact Or.inr h + +/-- Two edges of the first drawing with a point in common are equal. -/ +theorem edge_of_piece (hd : SplitData D D₂ A B m x y) {e f : Set S} (he : e ∈ D.E) (hf : f ∈ D.E) + (h : (A e = A f ∨ A e = B f ∨ B e = A f ∨ B e = B f)) : e = f := by + have hsame : ∀ {g₁ g₂ : Set S}, g₁ ∈ D₂.E → g₁ = g₂ → g₁ ⊆ e → g₂ ⊆ f → e = f := by + rintro g₁ _ hg rfl h₁ h₂ + obtain ⟨z, hz⟩ := hg.1 + exact D.edge_eq_of_mem he hf (h₁ hz) (h₂ hz) + rcases h with h | h | h | h + · exact hsame (hd.A_mem e he) h (hd.A_sub he) (hd.A_sub hf) + · exact hsame (hd.A_mem e he) h (hd.A_sub he) (hd.B_sub hf) + · exact hsame (hd.B_mem e he) h (hd.B_sub he) (hd.A_sub hf) + · exact hsame (hd.B_mem e he) h (hd.B_sub he) (hd.B_sub hf) + +theorem mid_inj (hd : SplitData D D₂ A B m x y) {e f : Set S} (he : e ∈ D.E) (hf : f ∈ D.E) + (h : m e = m f) : e = f := + D.edge_eq_of_mem he hf (hd.mid e he) (h ▸ hd.mid f hf) + +theorem ne_AB (hd : SplitData D D₂ A B m x y) {e : Set S} (he : e ∈ D.E) : A e ≠ B e := by + intro h + obtain ⟨z, hz⟩ := (hd.A_mem e he).1 + exact disjoint_left.mp (hd.disj e he) hz (h ▸ hz) + +/-- No edge of the second drawing is a loop. -/ +theorem noLoop (hd : SplitData D D₂ A B m x y) : + ∀ g ∈ D₂.E, ∃ a b, a ≠ b ∧ closure g ∩ D₂.V = {a, b} := by + intro g hg + obtain ⟨e, he, rfl | rfl⟩ := hd.all g hg + · refine ⟨x e, m e, fun h => hd.mid_notMem he ?_, hd.cap_A e he⟩ + rw [← h] + exact hd.x_mem e he + · refine ⟨m e, y e, fun h => hd.mid_notMem he ?_, hd.cap_B e he⟩ + rw [h] + exact hd.y_mem e he + +end SplitData + +variable [T2Space S] [ConnectedSpace S] {Γ' H : Drawing S} {r : Set S} {n : ℕ} {v : ℕ → S} + {a s P : ℕ → Set S} {ε : ℕ → I → S} {h : C(Circle × I, S)} + +/-- The steps of the collar, two at a time, are the edges of the first drawing. -/ +theorem exists_steps (hd : SplitData D D₂ A B m x y) + (hrad : PreRad (PaintingOrDrawing.drawing D₂) Γ') (hS : IsClosedSurface S) + (hmax : RadMax (PaintingOrDrawing.drawing D₂) Γ') (hE : D₂.E.Nonempty) + (hc : IsHubCollar D₂ Γ' (radialUnion hrad) r n v a s P ε h) (hv0 : v 0 ∈ D.V) : + ∃ p, n = 2 * p ∧ ∃ F : ℕ → Set S, ∀ j, F j ∈ D.E ∧ v (2 * j + 1) = m (F j) ∧ + ((a (2 * j) = A (F j) ∧ a (2 * j + 1) = B (F j) ∧ x (F j) = v (2 * j) ∧ + y (F j) = v (2 * j + 2)) ∨ + (a (2 * j) = B (F j) ∧ a (2 * j + 1) = A (F j) ∧ y (F j) = v (2 * j) ∧ + x (F j) = v (2 * j + 2))) := by + classical + have hstep : ∀ i, v i ∈ D.V → ∃ e ∈ D.E, v (i + 1) = m e ∧ (a i = A e ∨ a i = B e) := by + intro i hi + obtain ⟨e, he, hg⟩ := hd.all _ (hc.edge i) + refine ⟨e, he, ?_, hg⟩ + have hcap := hc.cap i + rcases hg with hg | hg + · rw [hg, hd.cap_A e he] at hcap + have hm : m e ∈ ({v i, v (i + 1)} : Set S) := hcap ▸ (by simp) + rcases hm with h₁ | h₁ + · exact (hd.mid_notMem he (h₁ ▸ hi)).elim + · exact (mem_singleton_iff.mp h₁).symm + · rw [hg, hd.cap_B e he] at hcap + have hm : m e ∈ ({v i, v (i + 1)} : Set S) := hcap ▸ (by simp) + rcases hm with h₁ | h₁ + · exact (hd.mid_notMem he (h₁ ▸ hi)).elim + · exact (mem_singleton_iff.mp h₁).symm + have hback : ∀ e ∈ D.E, ∀ i, v i = m e → v (i + 1) ∈ D.V ∧ (a i = A e ∨ a i = B e) := by + intro e he i hi + obtain ⟨f, hf, hg⟩ := hd.all _ (hc.edge i) + have hcap := hc.cap i + rcases hg with hg | hg + · rw [hg, hd.cap_A f hf] at hcap + have hm : v i ∈ ({x f, m f} : Set S) := hcap ▸ (by simp) + rcases hm with h₁ | h₁ + · exact (hd.mid_notMem he (hi ▸ h₁ ▸ hd.x_mem f hf)).elim + · have hef : e = f := hd.mid_inj he hf (hi.symm.trans (mem_singleton_iff.mp h₁)) + subst hef + have h₂ : x e ∈ ({v i, v (i + 1)} : Set S) := hcap ▸ (by simp) + rcases h₂ with h₂ | h₂ + · exact (hd.mid_notMem he (hi ▸ h₂ ▸ hd.x_mem e he)).elim + · exact ⟨(mem_singleton_iff.mp h₂) ▸ hd.x_mem e he, Or.inl hg⟩ + · rw [hg, hd.cap_B f hf] at hcap + have hm : v i ∈ ({m f, y f} : Set S) := hcap ▸ (by simp) + rcases hm with h₁ | h₁ + · have hef : e = f := hd.mid_inj he hf (hi.symm.trans h₁) + subst hef + have h₂ : y e ∈ ({v i, v (i + 1)} : Set S) := hcap ▸ (by simp) + rcases h₂ with h₂ | h₂ + · exact (hd.mid_notMem he (hi ▸ h₂ ▸ hd.y_mem e he)).elim + · exact ⟨(mem_singleton_iff.mp h₂) ▸ hd.y_mem e he, Or.inr hg⟩ + · exact (hd.mid_notMem he (hi ▸ (mem_singleton_iff.mp h₁) ▸ hd.y_mem f hf)).elim + have hodd : ∀ j, v (2 * j) ∈ D.V := by + intro j + induction j with + | zero => exact hv0 + | succ j ih => + obtain ⟨e, he, h₁, -⟩ := hstep _ ih + exact (hback e he _ h₁).1 + have hn : Even n := by + by_contra hodd' + obtain ⟨q, hq⟩ := Nat.not_even_iff_odd.mp hodd' + obtain ⟨e, he, h₁, -⟩ := hstep (2 * q) (hodd q) + have h₂ := hc.per_v 0 + rw [zero_add, hq] at h₂ + exact hd.mid_notMem he (h₁ ▸ h₂ ▸ hv0) + obtain ⟨p, hp⟩ := hn + refine ⟨p, by omega, ?_⟩ + have key : ∀ j, ∃ e, e ∈ D.E ∧ v (2 * j + 1) = m e ∧ + ((a (2 * j) = A e ∧ a (2 * j + 1) = B e ∧ x e = v (2 * j) ∧ y e = v (2 * j + 2)) ∨ + (a (2 * j) = B e ∧ a (2 * j + 1) = A e ∧ y e = v (2 * j) ∧ x e = v (2 * j + 2))) := by + intro j + obtain ⟨e, he, h₁, hg⟩ := hstep _ (hodd j) + obtain ⟨-, hg'⟩ := hback e he _ h₁ + have hAcl : m e ∈ closure (A e) := by + have : m e ∈ closure (A e) ∩ D₂.V := by rw [hd.cap_A e he]; simp + exact this.1 + have hBcl : m e ∈ closure (B e) := by + have : m e ∈ closure (B e) ∩ D₂.V := by rw [hd.cap_B e he]; simp + exact this.1 + have hE₂ : D₂.E.Nonempty := hE + refine ⟨e, he, h₁, ?_⟩ + have hcap₁ := hc.cap (2 * j) + have hcap₂ := hc.cap (2 * j + 1) + rw [h₁] at hcap₁ hcap₂ + rw [show 2 * j + 1 + 1 = 2 * j + 2 by omega] at hcap₂ + rcases hg with hg | hg + · have hne : a (2 * j + 1) ≠ a (2 * j) := collar_turn hrad hS hmax hE hd.noLoop hc (2 * j) + (hd.B_mem e he) (h₁ ▸ hBcl) (by rw [hg]; exact (hd.ne_AB he).symm) + have hb : a (2 * j + 1) = B e := by + rcases hg' with h₂ | h₂ + · exact (hne (h₂.trans hg.symm)).elim + · exact h₂ + refine Or.inl ⟨hg, hb, ?_, ?_⟩ + · rw [hg, hd.cap_A e he] at hcap₁ + have : x e ∈ ({v (2 * j), m e} : Set S) := hcap₁ ▸ (by simp) + rcases this with h₃ | h₃ + · exact h₃ + · exact (hd.mid_notMem he (mem_singleton_iff.mp h₃ ▸ hd.x_mem e he)).elim + · rw [hb, hd.cap_B e he] at hcap₂ + have : y e ∈ ({m e, v (2 * j + 2)} : Set S) := hcap₂ ▸ (by simp) + rcases this with h₃ | h₃ + · exact (hd.mid_notMem he (h₃ ▸ hd.y_mem e he)).elim + · exact mem_singleton_iff.mp h₃ + · have hne : a (2 * j + 1) ≠ a (2 * j) := collar_turn hrad hS hmax hE hd.noLoop hc (2 * j) + (hd.A_mem e he) (h₁ ▸ hAcl) (by rw [hg]; exact hd.ne_AB he) + have hb : a (2 * j + 1) = A e := by + rcases hg' with h₂ | h₂ + · exact h₂ + · exact (hne (h₂.trans hg.symm)).elim + refine Or.inr ⟨hg, hb, ?_, ?_⟩ + · rw [hg, hd.cap_B e he] at hcap₁ + have : y e ∈ ({v (2 * j), m e} : Set S) := hcap₁ ▸ (by simp) + rcases this with h₃ | h₃ + · exact h₃ + · exact (hd.mid_notMem he (mem_singleton_iff.mp h₃ ▸ hd.y_mem e he)).elim + · rw [hb, hd.cap_A e he] at hcap₂ + have : x e ∈ ({m e, v (2 * j + 2)} : Set S) := hcap₂ ▸ (by simp) + rcases this with h₃ | h₃ + · exact (hd.mid_notMem he (h₃ ▸ hd.x_mem e he)).elim + · exact mem_singleton_iff.mp h₃ + choose F hF using key + exact ⟨F, fun j => ⟨(hF j).1, (hF j).2.1, (hF j).2.2⟩⟩ + +omit [T2Space S] [ConnectedSpace S] in +/-- **The walk around a region**, from the steps of `exists_steps`. -/ +theorem exists_collar_walk (hd : SplitData D D₂ A B m x y) + (hc : IsHubCollar D₂ Γ' H r n v a s P ε h) (hc₀ : v 0 ∈ D.V) {p : ℕ} (hnp : n = 2 * p) + {F : ℕ → Set S} (hF : ∀ j, F j ∈ D.E ∧ v (2 * j + 1) = m (F j) ∧ + ((a (2 * j) = A (F j) ∧ a (2 * j + 1) = B (F j) ∧ x (F j) = v (2 * j) ∧ + y (F j) = v (2 * j + 2)) ∨ + (a (2 * j) = B (F j) ∧ a (2 * j + 1) = A (F j) ∧ y (F j) = v (2 * j) ∧ + x (F j) = v (2 * j + 2)))) : + ∃ W : GraphWalk D.toGraph (v 0) (v 0), RunsAlongOn D (collarCurve h) 0 1 W ∧ + W.edges = (List.range' 0 p).map F := by + have hn := hc.pos + have hpp : 0 < p := by omega + have hcn : (0 : ℝ) < n := by exact_mod_cast hn + have hcp : (0 : ℝ) < p := by exact_mod_cast hpp + have hnr : (n : ℝ) = 2 * p := by exact_mod_cast hnp + let φ := collarCurve h + have hφ : ∀ i, i < n → ∀ u : I, φ ((i + u.1) / n) = ε i u := fun i hi u => hc.curve_eq hi u + have hzero : ∀ j : ℕ, j < p → φ (j / p) = v (2 * j) := by + intro j hj + have := hφ (2 * j) (by omega) 0 + rw [hc.ε_zero] at this + rw [← this] + congr 1 + rw [hnr] + simp only [Icc.coe_zero, add_zero] + push_cast + field_simp + have hmid : ∀ j, j < p → φ ((2 * j + 1) / n) = v (2 * j + 1) := by + intro j hj + have := hφ (2 * j + 1) (by omega) 0 + rw [hc.ε_zero] at this + rw [← this] + congr 1 + push_cast + simp + have hone : φ 1 = v 0 := by + have h₀ := hzero 0 hpp + simp only [Nat.cast_zero, zero_div, mul_zero] at h₀ + rw [← h₀] + simp [φ, collarCurve, Circle.exp_two_pi] + have hend : v (2 * p) = v 0 := by + have := hc.per_v 0 + rwa [zero_add, hnp] at this + have hL : ∀ j, j < p → ∀ u : I, φ ((2 * j + u.1) / n) = ε (2 * j) u := fun j hj u => by + have := hφ (2 * j) (by omega) u + rwa [show (((2 * j : ℕ) : ℝ) + u.1) = 2 * j + u.1 by push_cast; ring] at this + have hR : ∀ j, j < p → ∀ u : I, φ ((2 * j + 1 + u.1) / n) = ε (2 * j + 1) u := fun j hj u => by + have := hφ (2 * j + 1) (by omega) u + rwa [show (((2 * j + 1 : ℕ) : ℝ) + u.1) = 2 * j + 1 + u.1 by push_cast; ring] at this + have hL' : ∀ j, j < p → ∀ u ∈ Ioo (0 : I) 1, ε (2 * j) u ∈ a (2 * j) := fun j _ u hu => + hc.image_Ioo _ ▸ mem_image_of_mem _ hu + have hR' : ∀ j, j < p → ∀ u ∈ Ioo (0 : I) 1, ε (2 * j + 1) u ∈ a (2 * j + 1) := fun j _ u hu => + hc.image_Ioo _ ▸ mem_image_of_mem _ hu + have hsplit : ∀ j, F j = a (2 * j) ∪ {m (F j)} ∪ a (2 * j + 1) ∧ Disjoint (a (2 * j)) (a + (2 * j + 1)) ∧ + m (F j) ∉ a (2 * j) ∧ m (F j) ∉ a (2 * j + 1) := by + intro j + obtain ⟨he, -, h₁⟩ := hF j + rcases h₁ with ⟨h₁, h₂, -, -⟩ | ⟨h₁, h₂, -, -⟩ + · rw [h₁, h₂] + exact ⟨hd.union _ he, hd.disj _ he, hd.mid_A _ he, hd.mid_B _ he⟩ + · rw [h₁, h₂] + refine ⟨?_, (hd.disj _ he).symm, hd.mid_B _ he, hd.mid_A _ he⟩ + conv_lhs => rw [hd.union _ he] + ext z + simp only [mem_union, mem_singleton_iff] + tauto + -- The three parts of the open interval of a step. + have htri : ∀ (j : ℕ) (t : ℝ), (j : ℝ) / p < t → t < ((j + 1 : ℕ) : ℝ) / p → + (∃ u ∈ Ioo (0 : I) 1, t = (2 * j + u.1) / n) ∨ t = (2 * j + 1) / n ∨ + ∃ u ∈ Ioo (0 : I) 1, t = (2 * j + 1 + u.1) / n := by + intro j t h₁ h₂ + rw [div_lt_iff₀ hcp] at h₁ + rw [lt_div_iff₀ hcp] at h₂ + push_cast at h₂ + have hval : t * n = 2 * (t * p) := by rw [hnr]; ring + have hdiv : ∀ {c : ℝ}, t * n = c → t = c / n := fun h => by + rw [← h] + field_simp + rcases lt_trichotomy (t * n) (2 * j + 1) with h₃ | h₃ | h₃ + · refine Or.inl ⟨⟨t * n - 2 * j, by linarith, by linarith⟩, ⟨?_, ?_⟩, hdiv (by simp)⟩ + · change (0 : ℝ) < t * n - 2 * j + linarith + · change t * n - 2 * j < 1 + linarith + · exact Or.inr (Or.inl (hdiv h₃)) + · refine Or.inr (Or.inr ⟨⟨t * n - (2 * j + 1), by linarith, by linarith⟩, ⟨?_, ?_⟩, + hdiv (by simp)⟩) + · change (0 : ℝ) < t * n - (2 * j + 1) + linarith + · change t * n - (2 * j + 1) < 1 + linarith + have hrange₁ : ∀ j : ℕ, (j : ℝ) / p < (2 * j + 1) / n ∧ ((2 * j + 1 : ℝ) / n < + ((j + 1 : ℕ) : ℝ) / p) := by + intro j + rw [hnr] + push_cast + constructor + · rw [div_lt_div_iff₀ hcp (by positivity)] + nlinarith + · rw [div_lt_div_iff₀ (by positivity) hcp] + nlinarith + have hrangeL : ∀ (j : ℕ) (u : I), 0 < u → (j : ℝ) / p < (2 * j + u.1) / n ∧ + ((2 * j + u.1 : ℝ) / n < (2 * j + 1) / n ∨ u = 1) := by + intro j u hu + have hu₀ : (0 : ℝ) < u.1 := hu + constructor + · rw [hnr, div_lt_div_iff₀ hcp (by positivity)] + nlinarith + · by_cases h₁ : u = 1 + · exact Or.inr h₁ + · refine Or.inl ?_ + have : u.1 < 1 := lt_of_le_of_ne u.2.2 fun h => h₁ (Subtype.ext h) + exact (div_lt_div_iff_of_pos_right hcn).mpr (by linarith) + have hrangeR : ∀ (j : ℕ) (u : I), u < 1 → (2 * j + 1 : ℝ) / n ≤ (2 * j + 1 + u.1) / n ∧ + ((2 * j + 1 + u.1 : ℝ) / n < ((j + 1 : ℕ) : ℝ) / p) := by + intro j u hu + have hu₁ : u.1 < 1 := hu + constructor + · exact (div_le_div_iff_of_pos_right hcn).mpr (by linarith [u.2.1]) + · push_cast + rw [hnr, div_lt_div_iff₀ (by positivity) hcp] + nlinarith + refine (fun (key : ∃ W : GraphWalk D.toGraph (v (2 * (p - p))) (v 0), + RunsAlongOn D φ (((p - p : ℕ) : ℝ) / p) ((p : ℝ) / p) W ∧ + W.edges = (List.range' (p - p) p).map F) => ?_) + (exists_runs_walk (m := p) (w := fun j => v (2 * j)) (e := F) + (x := fun j => (j : ℝ) / p) (φ := φ) D (z := v 0) ?_ ?_ ?_ ?_ ?_ ?_ hend p le_rfl) + · revert key + rw [Nat.sub_self] + rintro ⟨W, hW, hedges⟩ + refine ⟨W, ?_, hedges⟩ + have h₁ : ((p : ℝ) / p) = 1 := div_self hcp.ne' + rw [h₁, Nat.cast_zero, zero_div] at hW + exact hW + · intro j _ + obtain ⟨he, -, h₁⟩ := hF j + refine ⟨he, ?_, ?_, ?_⟩ + · rcases h₁ with ⟨-, -, h₂, -⟩ | ⟨-, -, h₂, -⟩ + · exact h₂ ▸ hd.x_mem _ he + · exact h₂ ▸ hd.y_mem _ he + · rcases h₁ with ⟨-, -, -, h₂⟩ | ⟨-, -, -, h₂⟩ + · rw [show 2 * (j + 1) = 2 * j + 2 by ring] + exact h₂ ▸ hd.y_mem _ he + · rw [show 2 * (j + 1) = 2 * j + 2 by ring] + exact h₂ ▸ hd.x_mem _ he + · rw [show 2 * (j + 1) = 2 * j + 2 by ring, hd.cap _ he] + rcases h₁ with ⟨-, -, h₂, h₃⟩ | ⟨-, -, h₂, h₃⟩ + · rw [h₂, h₃] + · rw [h₂, h₃, pair_comm] + · intro j _ + exact (div_lt_div_iff_of_pos_right hcp).mpr (by push_cast; linarith) + · intro j hj + rcases hj.lt_or_eq with h₁ | rfl + · exact hzero j h₁ + · rw [div_self hcp.ne', hone, hend] + · intro j hj t ht t' ht' heq + obtain ⟨hs, hdisj, hma, hmb⟩ := hsplit j + have hms := (hF j).2.1 + rcases htri j t ht.1 ht.2 with ⟨u, hu, rfl⟩ | rfl | ⟨u, hu, rfl⟩ <;> + rcases htri j t' ht'.1 ht'.2 with ⟨u', hu', rfl⟩ | rfl | ⟨u', hu', rfl⟩ + · rw [hL j hj, hL j hj] at heq + rw [hc.ε_inj _ heq] + · rw [hL j hj, hmid j hj, hms] at heq + exact (hma (heq ▸ hL' j hj u hu)).elim + · rw [hL j hj, hR j hj] at heq + exact (disjoint_left.mp hdisj (hL' j hj u hu) (heq ▸ hR' j hj u' hu')).elim + · rw [hL j hj, hmid j hj, hms] at heq + exact (hma (heq ▸ hL' j hj u' hu')).elim + · rfl + · rw [hR j hj, hmid j hj, hms] at heq + exact (hmb (heq ▸ hR' j hj u' hu')).elim + · rw [hR j hj, hL j hj] at heq + exact (disjoint_left.mp hdisj (hL' j hj u' hu') (heq ▸ hR' j hj u hu)).elim + · rw [hR j hj, hmid j hj, hms] at heq + exact (hmb (heq ▸ hR' j hj u hu)).elim + · rw [hR j hj, hR j hj] at heq + rw [hc.ε_inj _ heq] + · intro j hj + obtain ⟨hs, hdisj, hma, hmb⟩ := hsplit j + have hms := (hF j).2.1 + apply subset_antisymm + · rintro _ ⟨t, ht, rfl⟩ + rw [hs] + rcases htri j t ht.1 ht.2 with ⟨u, hu, rfl⟩ | rfl | ⟨u, hu, rfl⟩ + · rw [hL j hj] + exact Or.inl (Or.inl (hL' j hj u hu)) + · rw [hmid j hj, hms] + exact Or.inl (Or.inr rfl) + · rw [hR j hj] + exact Or.inr (hR' j hj u hu) + · intro z hz + rw [hs] at hz + rcases hz with (hz | hz) | hz + · rw [← hc.image_Ioo] at hz + obtain ⟨u, hu, rfl⟩ := hz + obtain ⟨h₁, h₂⟩ := hrangeL j u hu.1 + refine ⟨_, ⟨h₁, ?_⟩, hL j hj u⟩ + rcases h₂ with h₂ | h₂ + · exact h₂.trans (hrange₁ j).2 + · exact (hu.2.ne h₂).elim + · rw [mem_singleton_iff.mp hz, ← hms, ← hmid j hj] + exact mem_image_of_mem _ (hrange₁ j) + · rw [← hc.image_Ioo] at hz + obtain ⟨u, hu, rfl⟩ := hz + obtain ⟨h₁, h₂⟩ := hrangeR j u hu.2 + exact ⟨_, ⟨(hrange₁ j).1.trans_le h₁, h₂⟩, hR j hj u⟩ + · rw [hend] + exact hc₀ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Regions.lean b/LeanPool/GraphMinor/GM11/Regions.lean new file mode 100644 index 0000000000..efd2cd51af --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Regions.lean @@ -0,0 +1,252 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.EdgeSides + +/-! +# Regions and edges of a drawing in a closed surface + +This file proves the facts on regions that Graph Minors XI uses without comment: + +- a closed surface is locally connected, so regions are open (`region_isOpen`); +- if a region has a point of an edge `e` in its closure, then all of `e` is in its closure + (`edge_subset_closure_of_incident`); +- every edge is incident with a region, and with at most two (`exists_region_incident`, + `region_incident_two`); +- a region not incident with `e` is still a region after `e` is deleted + (`region_deleteEdge_of_not_incident`). + +The proofs use the two sides of an edge, `exists_edge_sides`. +-/ + +public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A closed surface is locally connected, because its charts are open subsets of the plane. -/ +theorem IsClosedSurface.locallyConnectedSpace (hS : IsClosedSurface S) : + LocallyConnectedSpace S := by + refine locallyConnectedSpace_iff_subsets_isOpen_isConnected.mpr fun x U hU => ?_ + obtain ⟨V, hV, hxV, ⟨h⟩⟩ := hS.2.2 x + let P : Set OpenUnitDisc := {y | (h.symm y).1 ∈ interior U} + have hP : IsOpen P := + isOpen_interior.preimage (continuous_subtype_val.comp h.symm.continuous) + have hP' : IsOpen (Subtype.val '' P : Set EuclideanPlane) := + Metric.isOpen_ball.isOpenEmbedding_subtypeVal.isOpenMap _ hP + let c : OpenUnitDisc := h ⟨x, hxV⟩ + have hc : (c : EuclideanPlane) ∈ (Subtype.val '' P : Set EuclideanPlane) := + ⟨c, by simpa [P, c] using mem_interior_iff_mem_nhds.mpr hU, rfl⟩ + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp hP' _ hc + let B : Set OpenUnitDisc := Subtype.val ⁻¹' Metric.ball (c : EuclideanPlane) δ + have hBsub : Metric.ball (c : EuclideanPlane) δ ⊆ OpenUnitDisc := by + intro y hy + obtain ⟨z, -, rfl⟩ := hball hy + exact z.2 + have hBconn : IsPreconnected B := by + refine (IsInducing.subtypeVal : + IsInducing (Subtype.val : OpenUnitDisc → EuclideanPlane)).isPreconnected_image.mp ?_ + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hBsub] + exact (convex_ball _ _).isPreconnected + let f : OpenUnitDisc → S := fun y => (h.symm y).1 + have hf : Continuous f := continuous_subtype_val.comp h.symm.continuous + have hEq : f '' B = Subtype.val '' ((fun y : V => (h y : EuclideanPlane)) ⁻¹' + Metric.ball (c : EuclideanPlane) δ) := by + ext q + constructor + · rintro ⟨y, hy, rfl⟩ + refine ⟨h.symm y, ?_, rfl⟩ + simp only [mem_preimage, Homeomorph.apply_symm_apply] + exact hy + · rintro ⟨y, hy, rfl⟩ + exact ⟨h y, hy, by simp [f]⟩ + refine ⟨f '' B, ?_, ?_, ?_, ⟨⟨f c, c, by simp [B, hδ], rfl⟩, hBconn.image _ hf.continuousOn⟩⟩ + · rintro _ ⟨y, hy, rfl⟩ + obtain ⟨z, hz, hzy⟩ := hball hy + have : z = y := Subtype.ext hzy + subst this + exact interior_subset hz + · rw [hEq] + exact hV.isOpenEmbedding_subtypeVal.isOpenMap _ + (Metric.isOpen_ball.preimage (continuous_subtype_val.comp h.continuous)) + · exact ⟨c, by simp [B, hδ], by simp [f, c]⟩ + +variable (Γ : Drawing S) + +theorem mem_R_iff {r : Set S} : + r ∈ Γ.R ↔ ∃ x, x ∉ Γ.U ∧ r = connectedComponentIn (univ \ Γ.U) x := by + constructor + · rintro ⟨x, hx, rfl⟩ + exact ⟨x, hx.2, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨x, ⟨mem_univ _, hx⟩, rfl⟩ + +variable {Γ} + +theorem region_subset {r : Set S} (hr : r ∈ Γ.R) : r ⊆ Γ.Uᶜ := by + obtain ⟨x, -, rfl⟩ := (mem_R_iff Γ).mp hr + exact fun y hy => (connectedComponentIn_subset _ _ hy).2 + +theorem region_isPreconnected {r : Set S} (hr : r ∈ Γ.R) : IsPreconnected r := by + obtain ⟨x, -, rfl⟩ := (mem_R_iff Γ).mp hr + exact isPreconnected_connectedComponentIn + +theorem region_nonempty {r : Set S} (hr : r ∈ Γ.R) : r.Nonempty := by + obtain ⟨x, hx, rfl⟩ := (mem_R_iff Γ).mp hr + exact ⟨x, mem_connectedComponentIn ⟨mem_univ _, hx⟩⟩ + +theorem region_isOpen [LocallyConnectedSpace S] {r : Set S} (hr : r ∈ Γ.R) : IsOpen r := by + obtain ⟨x, -, rfl⟩ := (mem_R_iff Γ).mp hr + have : IsOpen (univ \ Γ.U) := isOpen_univ.sdiff Γ.isClosed_U + exact this.connectedComponentIn + +/-- Two regions with a common point are equal. -/ +theorem region_eq_of_mem {r r' : Set S} (hr : r ∈ Γ.R) (hr' : r' ∈ Γ.R) {x : S} (hx : x ∈ r) + (hx' : x ∈ r') : r = r' := by + obtain ⟨y, -, rfl⟩ := (mem_R_iff Γ).mp hr + obtain ⟨z, -, rfl⟩ := (mem_R_iff Γ).mp hr' + rw [connectedComponentIn_eq hx, connectedComponentIn_eq hx'] + +/-- A connected set that avoids `U(Γ)` and meets a region lies in it. -/ +theorem subset_region {r A : Set S} (hr : r ∈ Γ.R) (hA : IsPreconnected A) + (hdis : Disjoint A Γ.U) {x : S} (hxA : x ∈ A) (hxr : x ∈ r) : A ⊆ r := by + obtain ⟨y, -, rfl⟩ := (mem_R_iff Γ).mp hr + rw [connectedComponentIn_eq hxr] + exact hA.subset_connectedComponentIn hxA fun z hz => ⟨mem_univ _, disjoint_left.mp hdis hz⟩ + +/-- The region containing a point off `U(Γ)`. -/ +theorem exists_region_of_notMem {x : S} (hx : x ∉ Γ.U) : ∃ r ∈ Γ.R, x ∈ r := + ⟨_, (mem_R_iff Γ).mpr ⟨x, hx, rfl⟩, mem_connectedComponentIn ⟨mem_univ _, hx⟩⟩ + +/-- The closure of a region adds only points of `U(Γ)`. -/ +theorem closure_region_subset [LocallyConnectedSpace S] {r : Set S} (hr : r ∈ Γ.R) : + closure r ⊆ r ∪ Γ.U := by + intro y hy + by_cases hyU : y ∈ Γ.U + · exact Or.inr hyU + obtain ⟨r', hr', hyr'⟩ := exists_region_of_notMem hyU + obtain ⟨z, hz', hz⟩ := mem_closure_iff.mp hy r' (region_isOpen hr') hyr' + rw [region_eq_of_mem hr hr' hz hz'] + exact Or.inl hyr' + +/-- Two locally defined sides cover the complement of a drawing around each point of an edge. -/ +@[expose] +def LocalEdgeSides (Γ : Drawing S) (e : Set S) : Prop := + ∀ p ∈ e, ∃ W A₁ A₂ : Set S, IsOpen W ∧ p ∈ W ∧ W ∩ Γ.U ⊆ e ∧ + W \ Γ.U ⊆ A₁ ∪ A₂ ∧ IsPreconnected A₁ ∧ IsPreconnected A₂ ∧ + Disjoint A₁ Γ.U ∧ Disjoint A₂ Γ.U ∧ e ∩ W ⊆ closure A₁ ∧ e ∩ W ⊆ closure A₂ + +/-- If a region has a point of an edge in its closure then all of the edge is in its closure. The +set of such points is open in `e` by the two sides of an edge, and `e` is connected. -/ +theorem edge_subset_closure_of_local_sides + {e r : Set S} (hsides : LocalEdgeSides Γ e) (he : e ∈ Γ.E) (hr : r ∈ Γ.R) + (hinc : (e ∩ closure r).Nonempty) : e ⊆ closure r := by + have hstep : ∀ p ∈ e ∩ closure r, ∃ W : Set S, IsOpen W ∧ p ∈ W ∧ e ∩ W ⊆ closure r := by + rintro p ⟨hpe, hpr⟩ + obtain ⟨W, A₁, A₂, hW, hpW, -, hsub, h₁, h₂, d₁, d₂, c₁, c₂⟩ := hsides p hpe + refine ⟨W, hW, hpW, ?_⟩ + obtain ⟨x, hxW, hxr⟩ := mem_closure_iff.mp hpr W hW hpW + have hxU : x ∉ Γ.U := region_subset hr hxr + rcases hsub ⟨hxW, hxU⟩ with hx | hx + · exact c₁.trans (closure_mono (subset_region hr h₁ d₁ hx hxr)) + · exact c₂.trans (closure_mono (subset_region hr h₂ d₂ hx hxr)) + choose! W hWo hpW hWs using hstep + let O : Set S := ⋃ p ∈ e ∩ closure r, W p + have hO : IsOpen O := isOpen_biUnion fun p hp => hWo p hp + by_contra hcon + obtain ⟨z, hze, hzr⟩ := not_subset.mp hcon + have hconn : IsPreconnected e := he.2.2.1.isConnected.isPreconnected + have hcov : e ⊆ O ∪ (closure r)ᶜ := by + intro y hy + by_cases hyr : y ∈ closure r + · exact Or.inl (mem_iUnion₂.mpr ⟨y, ⟨hy, hyr⟩, hpW y ⟨hy, hyr⟩⟩) + · exact Or.inr hyr + obtain ⟨p, hp⟩ := hinc + obtain ⟨y, hye, hyO, hyr⟩ := hconn O (closure r)ᶜ hO isClosed_closure.isOpen_compl hcov + ⟨p, hp.1, mem_iUnion₂.mpr ⟨p, hp, hpW p hp⟩⟩ ⟨z, hze, hzr⟩ + obtain ⟨q, hq, hyq⟩ := mem_iUnion₂.mp hyO + exact hyr (hWs q hq ⟨hye, hyq⟩) + +/-- Every edge is incident with a region. -/ +theorem exists_region_incident_of_local_sides + {e : Set S} (hsides : LocalEdgeSides Γ e) (he : e ∈ Γ.E) : + ∃ r ∈ Γ.R, e ⊆ closure r := by + obtain ⟨p, hp⟩ := he.1 + obtain ⟨W, A₁, A₂, -, hpW, -, -, h₁, -, d₁, -, c₁, -⟩ := hsides p hp + have hne : A₁.Nonempty := by + by_contra hcon + rw [not_nonempty_iff_eq_empty] at hcon + have := c₁ ⟨hp, hpW⟩ + rw [hcon, closure_empty] at this + exact this + obtain ⟨x, hx⟩ := hne + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem (disjoint_left.mp d₁ hx) + refine ⟨r, hr, edge_subset_closure_of_local_sides hsides he hr ⟨p, hp, ?_⟩⟩ + exact closure_mono (subset_region hr h₁ d₁ hx hxr) (c₁ ⟨hp, hpW⟩) + +/-- An edge is incident with at most two regions: of three such regions, two are equal. -/ +theorem region_incident_two_of_local_sides + {e r₁ r₂ r₃ : Set S} (hsides : LocalEdgeSides Γ e) (he : e ∈ Γ.E) + (h₁ : r₁ ∈ Γ.R) (h₂ : r₂ ∈ Γ.R) (h₃ : r₃ ∈ Γ.R) + (i₁ : e ⊆ closure r₁) (i₂ : e ⊆ closure r₂) (i₃ : e ⊆ closure r₃) : + r₁ = r₂ ∨ r₁ = r₃ ∨ r₂ = r₃ := by + obtain ⟨p, hp⟩ := he.1 + obtain ⟨W, A₁, A₂, hW, hpW, -, hsub, c₁, c₂, d₁, d₂, -, -⟩ := hsides p hp + have hside : ∀ r ∈ Γ.R, e ⊆ closure r → (∃ x ∈ A₁, x ∈ r) ∨ ∃ x ∈ A₂, x ∈ r := by + intro r hr hi + obtain ⟨x, hxW, hxr⟩ := mem_closure_iff.mp (hi hp) W hW hpW + rcases hsub ⟨hxW, region_subset hr hxr⟩ with hx | hx + · exact Or.inl ⟨x, hx, hxr⟩ + · exact Or.inr ⟨x, hx, hxr⟩ + have hsame : ∀ {A r r' : Set S}, IsPreconnected A → Disjoint A Γ.U → r ∈ Γ.R → r' ∈ Γ.R → + (∃ x ∈ A, x ∈ r) → (∃ x ∈ A, x ∈ r') → r = r' := by + rintro A r r' hA hd hr hr' ⟨x, hxA, hxr⟩ ⟨y, hyA, hyr⟩ + exact region_eq_of_mem hr hr' (subset_region hr hA hd hxA hxr hyA) hyr + rcases hside r₁ h₁ i₁ with a | a <;> rcases hside r₂ h₂ i₂ with b | b <;> + rcases hside r₃ h₃ i₃ with c | c + · exact Or.inl (hsame c₁ d₁ h₁ h₂ a b) + · exact Or.inl (hsame c₁ d₁ h₁ h₂ a b) + · exact Or.inr (Or.inl (hsame c₁ d₁ h₁ h₃ a c)) + · exact Or.inr (Or.inr (hsame c₂ d₂ h₂ h₃ b c)) + · exact Or.inr (Or.inr (hsame c₁ d₁ h₂ h₃ b c)) + · exact Or.inr (Or.inl (hsame c₂ d₂ h₁ h₃ a c)) + · exact Or.inl (hsame c₂ d₂ h₁ h₂ a b) + · exact Or.inl (hsame c₂ d₂ h₁ h₂ a b) + +/-- If a region has a point of an edge in its closure then all of the edge is in its closure. The +set of such points is open in `e` by the two sides of an edge, and `e` is connected. -/ +theorem edge_subset_closure_of_incident (hS : IsClosedSurface S) + {e r : Set S} (he : e ∈ Γ.E) (hr : r ∈ Γ.R) + (hinc : (e ∩ closure r).Nonempty) : e ⊆ closure r := by + have : T2Space S := hS.2.1 + exact edge_subset_closure_of_local_sides (fun _ hp => exists_edge_sides hS Γ he hp) he hr hinc + +/-- Every edge is incident with a region. -/ +theorem exists_region_incident (hS : IsClosedSurface S) + {e : Set S} (he : e ∈ Γ.E) : + ∃ r ∈ Γ.R, e ⊆ closure r := by + have : T2Space S := hS.2.1 + exact exists_region_incident_of_local_sides (fun _ hp => exists_edge_sides hS Γ he hp) he + +/-- An edge is incident with at most two regions: of three such regions, two are equal. -/ +theorem region_incident_two (hS : IsClosedSurface S) + {e r₁ r₂ r₃ : Set S} (he : e ∈ Γ.E) (h₁ : r₁ ∈ Γ.R) (h₂ : r₂ ∈ Γ.R) + (h₃ : r₃ ∈ Γ.R) (i₁ : e ⊆ closure r₁) (i₂ : e ⊆ closure r₂) (i₃ : e ⊆ closure r₃) : + r₁ = r₂ ∨ r₁ = r₃ ∨ r₂ = r₃ := by + have : T2Space S := hS.2.1 + exact region_incident_two_of_local_sides + (fun _ hp => exists_edge_sides hS Γ he hp) he h₁ h₂ h₃ i₁ i₂ i₃ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Restraints.lean b/LeanPool/GraphMinor/GM11/Restraints.lean new file mode 100644 index 0000000000..4bcd2b731b --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Restraints.lean @@ -0,0 +1,373 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PerimeterCount +public import LeanPool.GraphMinor.GM11.Section8 + +/-! +# The outside of a set, and restraints + +`theorem_7_6` is (7.6) of Graph Minors XI, for sets other than the whole surface. The paper derives +it from +(7.5) with a set `Y` of two points. We derive it from the collar of a perimeter walk, which is +shorter here, +since that collar is already there: each component of the complement of `X` meets the collar. + +From this, `compl_mem_R` says that `Σ - X` is a region of `Γ ∩ bd(X)`. `theorem_8_3` and +`theorem_8_4` are +(8.3) and (8.4). +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A path-connected set in a Hausdorff space is arc-connected. -/ +theorem isArcConnected_of_isPathConnected [T2Space S] {C : Set S} (hpc : IsPathConnected C) : + IsArcConnected C := by + intro a ha b hb hab + have hj := hpc.joinedIn a ha b hb + obtain ⟨e, hec, hei, he0, he1, hsub⟩ := exists_arc_of_path (γ := hj.somePath) + hj.somePath.continuous + (by simpa using hab) + have hc : CompactSpace (range e) := isCompact_iff_compactSpace.mp (isCompact_range hec) + refine ⟨range e, ?_, ?_⟩ + · rintro _ ⟨t, rfl⟩ + obtain ⟨u, hu⟩ := hsub (mem_range_self t) + exact hu ▸ hj.somePath_mem u + · have hjb : Function.Bijective (rangeFactorization e) := + ⟨fun x y hxy => hei (congrArg Subtype.val hxy), rangeFactorization_surjective⟩ + refine ⟨(Continuous.subtype_mk hec _).homeoOfEquivCompactToT2 + (f := Equiv.ofBijective _ hjb), ?_, ?_⟩ + · exact he0.trans (by simp) + · exact he1.trans (by simp) + +section Runs + +variable {Γ : Drawing S} {φ : ℝ → S} + +/-- Each vertex of a walk is a point of its curve. -/ +theorem runs_support {u v : S} (W : GraphWalk Γ.toGraph u v) : + ∀ {a b : ℝ}, RunsAlongOn Γ φ a b W → ∀ x ∈ W.support, ∃ t ∈ Icc a b, φ t = x := by + induction W with + | nil hv => + rintro a b ⟨rfl, hu⟩ x hx + obtain rfl : x = _ := by simpa [GraphWalk.support] using hx + exact ⟨a, ⟨le_rfl, le_rfl⟩, hu⟩ + | @cons x y w e hlink rest ih => + rintro a b ⟨c, hac, hu, -, -, hrest⟩ t ht + rcases List.mem_cons.mp ht with rfl | h + · exact ⟨a, ⟨le_rfl, (hac.trans_le (runs_le rest hrest)).le⟩, hu⟩ + · obtain ⟨s, hs, hse⟩ := ih hrest t h + exact ⟨s, ⟨hac.le.trans hs.1, hs.2⟩, hse⟩ + +/-- A point of the curve that is a vertex is a vertex of the walk. -/ +theorem runs_vertex {u v : S} (W : GraphWalk Γ.toGraph u v) : + ∀ {a b : ℝ}, RunsAlongOn Γ φ a b W → ∀ t ∈ Icc a b, φ t ∈ Γ.V → φ t ∈ W.support := by + induction W with + | nil hv => + rintro a b ⟨rfl, hu⟩ t ⟨h₁, h₂⟩ - + obtain rfl : t = a := le_antisymm h₂ h₁ + simp [GraphWalk.support, hu] + | @cons x y w e hlink rest ih => + rintro a b ⟨c, hac, hu, -, him, hrest⟩ t ht hV + rcases lt_or_ge t c with htc | htc + · rcases eq_or_lt_of_le ht.1 with rfl | hat + · exact hu ▸ List.mem_cons_self + · have hm : φ t ∈ e := him ▸ mem_image_of_mem φ ⟨hat, htc⟩ + exact ((hlink.1.2.1 hm).2 hV).elim + · exact List.mem_cons_of_mem _ (ih hrest t ⟨htc, ht.2⟩ hV) + +end Runs + +variable [ConnectedSpace S] + +/-- The complement of a closed set `X` with a collar is connected: each component of the complement +meets +the collar. -/ +theorem isConnected_compl_of_collar (hS : IsClosedSurface S) {X : Set S} (hXc : IsClosed X) + (hne : X.Nonempty) (hu : X ≠ univ) (h : C(Circle × I, S)) + (hoff : ∀ p : Circle × I, 0 < p.2 → h p ∉ X) (hbot : ∀ z, h (z, 0) ∈ X) + (hop : IsOpen (X ∪ h '' {p | p.2 < 1})) : IsConnected Xᶜ := by + have hlp : LocallyPathConnectedSpace S := IsClosedSurface.locallyPathConnectedSpace hS + obtain ⟨a, ha⟩ : ∃ a, a ∉ X := by + by_contra hall + push Not at hall + exact hu (eq_univ_of_forall hall) + let T : Set S := h '' (univ ×ˢ Ioo 0 1) + have hTc : IsPreconnected T := + (isPreconnected_univ.prod isPreconnected_Ioo).image _ h.continuous.continuousOn + have hTX : T ⊆ Xᶜ := by + rintro _ ⟨p, hp, rfl⟩ + exact hoff p hp.2.1 + have hopc : IsOpen Xᶜ := hXc.isOpen_compl + -- Each component meets `T`. + have hmeet : ∀ b ∈ Xᶜ, (connectedComponentIn Xᶜ b ∩ T).Nonempty := by + intro b hb + set D := connectedComponentIn Xᶜ b with hD + have hDo : IsOpen D := hopc.connectedComponentIn + have hDne : D.Nonempty := ⟨b, mem_connectedComponentIn hb⟩ + have hDX : D ⊆ Xᶜ := connectedComponentIn_subset _ _ + have hDu : D ≠ univ := fun h' => by + obtain ⟨x, hx⟩ := hne + exact hDX (h' ▸ mem_univ x) hx + obtain ⟨p, hp⟩ : (frontier D).Nonempty := nonempty_frontier_iff.mpr ⟨hDne, hDu⟩ + have hpX : p ∈ X := by + by_contra hpX + -- A boundary point of a component lies outside the open set only if it is in the component. + have hpc : p ∈ D := by + have hconn : IsPreconnected (D ∪ connectedComponentIn Xᶜ p) := by + refine IsPreconnected.union' ?_ isPreconnected_connectedComponentIn + isPreconnected_connectedComponentIn + obtain ⟨z, hz₁, hz₂⟩ := mem_closure_iff.mp hp.1 _ hopc.connectedComponentIn + (mem_connectedComponentIn hpX) + exact ⟨z, hz₂, hz₁⟩ + have hsub := IsPreconnected.subset_connectedComponentIn hconn (Or.inl + (mem_connectedComponentIn hb)) + (union_subset hDX (connectedComponentIn_subset _ _)) + exact hsub (Or.inr (mem_connectedComponentIn hpX)) + exact hp.2 (by + rw [hDo.interior_eq] + exact hpc) + obtain ⟨d, hd₁, hd₂⟩ := mem_closure_iff.mp hp.1 _ hop (Or.inl hpX) + have hdX : d ∉ X := hDX hd₂ + obtain ⟨q, hq, rfl⟩ := hd₁.resolve_left hdX + have hq0 : 0 < q.2 := by + by_contra hq0 + have ht : q.2 = 0 := le_antisymm (not_lt.mp hq0) (unitInterval.nonneg _) + have hqz : q = (q.1, 0) := Prod.ext rfl ht + exact hdX (hqz ▸ hbot q.1) + exact ⟨h q, hd₂, q, ⟨mem_univ _, hq0, hq⟩, rfl⟩ + obtain ⟨c, hcD, hcT⟩ := hmeet a ha + have hcX : c ∈ Xᶜ := hTX hcT + have hall : Xᶜ ⊆ connectedComponentIn Xᶜ c := by + intro b hb + obtain ⟨d, hd₁, hd₂⟩ := hmeet b hb + have hdc : IsPreconnected (T ∪ connectedComponentIn Xᶜ b) := + IsPreconnected.union' ⟨d, hd₂, hd₁⟩ hTc isPreconnected_connectedComponentIn + exact IsPreconnected.subset_connectedComponentIn hdc (Or.inl hcT) + (union_subset hTX (connectedComponentIn_subset _ _)) (Or.inr (mem_connectedComponentIn hb)) + have heq : connectedComponentIn Xᶜ c = Xᶜ := + subset_antisymm (connectedComponentIn_subset _ _) hall + rw [← heq] + exact isConnected_connectedComponentIn_iff.mpr hcX + +variable [T2Space S] + +omit [ConnectedSpace S] in +theorem IsRestraint.ne_univ {Γ : Drawing S} {ins : Drawing S → Set S} {k : ℕ} {X : Set S} + (hr : IsRestraint Γ ins k X) : X ≠ univ := by + rintro rfl + apply hr.compl_not_subset + simp + +section Main + +variable (hS : IsClosedSurface S) + {Γ : Drawing S} {X : Set S} + +include hS + +/-- The complement of a closed, simply-connected, `Γ`-nice set is connected. -/ +theorem isConnected_compl (hXc : IsClosed X) (hXn : IsGammaNice Γ X) (hXs : IsSimplyConnectedSet X) + (hne : X.Nonempty) (hu : X ≠ univ) : IsConnected Xᶜ := by + obtain ⟨u, W, ⟨h, -, hoff, hrng, hop, -⟩, -⟩ := exists_perimeterWalk hS hXc hXn hXs hne hu + rw [subBd_eq_frontier] at hrng + exact isConnected_compl_of_collar hS hXc hne hu h hoff + (fun z => hXc.frontier_subset (hrng ▸ mem_range_self z)) hop + +/-- **(7.6)** of Graph Minors XI (page 94): "If $\Sigma$ is connected, and $X \subseteq \Sigma$ is +closed, nice, and simply-connected, +then $\Sigma - X$ is arc-wise connected." Here `X` is non-empty and `Γ`-nice. -/ +theorem theorem_7_6_proof (hXc : IsClosed X) (hXn : IsGammaNice Γ X) (hXs : IsSimplyConnectedSet X) + (hne : X.Nonempty) : IsArcConnected Xᶜ := by + have hlp : LocallyPathConnectedSpace S := IsClosedSurface.locallyPathConnectedSpace hS + by_cases hu : X = univ + · intro a ha + exact (ha (hu ▸ mem_univ a)).elim + have hc := isConnected_compl hS hXc hXn hXs hne hu + exact isArcConnected_of_isPathConnected (hXc.isOpen_compl.isConnected_iff_isPathConnected.mp hc) + +/-- `Σ - X` is a region of `Γ ∩ bd(X)`. The proof of (8.3) gets this from (7.6). -/ +theorem compl_mem_R (hXc : IsClosed X) (hXn : IsGammaNice Γ X) (hXs : IsSimplyConnectedSet X) + (hne : X.Nonempty) (hu : X ≠ univ) : Xᶜ ∈ (Γ.interSet (frontier X)).R := by + have hc := isConnected_compl hS hXc hXn hXs hne hu + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + set B := Γ.interSet (frontier X) + have hBU : B.U = frontier X := frontier_interSet hS hXc hXn + obtain ⟨a, ha⟩ := hc.nonempty + have haU : a ∉ B.U := fun h => ha (hXc.frontier_subset (hBU ▸ h)) + obtain ⟨p, hp, hap⟩ := exists_region_of_notMem haU + have hdis : Disjoint Xᶜ B.U := disjoint_left.mpr fun x hx hxU => + hx (hXc.frontier_subset (hBU ▸ hxU)) + have h₁ : Xᶜ ⊆ p := subset_region hp hc.isPreconnected hdis ha hap + have h₂ : p ⊆ Xᶜ := by + have hcov : p ⊆ interior X ∪ Xᶜ := by + intro x hx + by_cases hxX : x ∈ X + · refine Or.inl ?_ + by_contra hint + exact region_subset hp hx (hBU ▸ (⟨subset_closure hxX, hint⟩ : x ∈ frontier X)) + · exact Or.inr hxX + have hdj : Disjoint (interior X) Xᶜ := disjoint_left.mpr fun x hx h => h (interior_subset hx) + rcases (region_isPreconnected hp).subset_or_subset isOpen_interior hXc.isOpen_compl hdj hcov + with + h | h + · exact (ha (interior_subset (h hap))).elim + · exact h + exact subset_antisymm h₂ h₁ ▸ hp + +omit [ConnectedSpace S] in +/-- The vertices and edges of a shortest perimeter walk are those of `Γ ∩ bd(X)`. -/ +theorem walkDrawing_eq (hXc : IsClosed X) (hXn : IsGammaNice Γ X) {u : S} + {W : GraphWalk Γ.toGraph u u} (hW : IsPerimeterWalk Γ X W) + (hc : ∀ e ∈ Γ.E, edgeCount W.edges e = perimeterCount X e) : + walkDrawing Γ W = Γ.interSet (frontier X) := by + classical + have hE : ∀ e, e ∈ W.edges ↔ e ∈ Γ.E ∧ e ⊆ frontier X := by + intro e + constructor + · intro he + have heE := mem_E_of_mem_edges W he + have hpos : 0 < edgeCount W.edges e := List.count_pos_iff.mpr he + rw [hc e heE] at hpos + by_cases hef : (e ∩ frontier X).Nonempty + · obtain ⟨y, hy, hyf⟩ := hef + exact ⟨heE, edge_subset_frontier hS hXc hXn heE hy hyf⟩ + · simp [perimeterCount, hef] at hpos + · rintro ⟨heE, hsub⟩ + obtain ⟨y, hy⟩ : e.Nonempty := heE.1 + have hef : (e ∩ frontier X).Nonempty := ⟨y, hy, hsub hy⟩ + have hpos : 0 < edgeCount W.edges e := by + rw [hc e heE] + simp only [perimeterCount, hef, ite_true] + split_ifs <;> omega + exact List.count_pos_iff.mp hpos + have hV : {x | x ∈ W.support} = Γ.V ∩ frontier X := by + obtain ⟨h, -, -, hrng, -, hcase⟩ := hW + rw [subBd_eq_frontier] at hrng + ext x + constructor + · intro hx + refine ⟨mem_V_of_mem_support W hx, ?_⟩ + rcases hcase with ⟨h0, hu⟩ | ⟨-, hrun⟩ + · have hxu : x = u := by + cases W with + | nil hv => simpa [GraphWalk.support] using hx + | cons hl rest => simp [GraphWalk.length, GraphWalk.edges] at h0 + rw [hxu, ← hu 1, ← hrng] + exact ⟨1, rfl⟩ + · obtain ⟨t, -, rfl⟩ := runs_support W hrun x hx + rw [← hrng] + exact ⟨_, rfl⟩ + · rintro ⟨hxV, hxf⟩ + obtain ⟨z, hz⟩ := hrng.superset hxf + rcases hcase with ⟨h0, hu⟩ | ⟨-, hrun⟩ + · have hzu : x = u := hz.symm.trans (hu z) + rw [hzu] + exact W.start_mem_support + · obtain ⟨t, ht, rfl⟩ := exists_collar_time z + have hz' : h (Circle.exp (2 * Real.pi * t), 0) = x := hz + have hmem := runs_vertex W hrun t ⟨ht.1, ht.2.le⟩ (by + change h (_, 0) ∈ Γ.V + rw [hz'] + exact hxV) + change h (_, 0) ∈ W.support at hmem + rw [hz'] at hmem + exact hmem + have hEs : {e | e ∈ W.edges} = {e | e ∈ Γ.E ∧ e ⊆ frontier X} := by + ext e + exact hE e + change Γ.span {x | x ∈ W.support} {e | e ∈ W.edges} = Γ.span (Γ.V ∩ frontier X) _ + rw [hV, hEs] + +variable {ins : Drawing S → Set S} {k : ℕ} + +/-- A restraint has a shortest perimeter walk, of length `< 2θ`, whose drawing is `Γ ∩ bd(X)`. -/ +theorem IsRestraint.exists_walk (hr : IsRestraint Γ ins k X) : + ∃ (u : S) (W : GraphWalk Γ.toGraph u u), IsPerimeterWalk Γ X W ∧ + W.length = perimeterWalkLength Γ X ∧ W.length < k ∧ + (∀ e ∈ Γ.E, edgeCount W.edges e = perimeterCount X e) ∧ + walkDrawing Γ W = Γ.interSet (frontier X) := by + obtain ⟨u, W, hW, h₁, -, h₂⟩ := exists_minimal_perimeterWalk hS hr.isClosed hr.isGammaNice + hr.isSimplyConnected hr.nonempty hr.ne_univ + exact ⟨u, W, hW, h₁, h₁ ▸ hr.length_lt, h₂, walkDrawing_eq hS hr.isClosed hr.isGammaNice hW h₂⟩ + +/-- `Γ ∩ bd(X)` is confined, for a restraint `X`. -/ +theorem IsRestraint.isConfined (hr : IsRestraint Γ ins k X) : + IsConfined k (Γ.interSet (frontier X)) := by + obtain ⟨u, W, -, -, hl, -, hd⟩ := hr.exists_walk hS + intro C hC hCs + have hsub : C.E ⊆ {x | x ∈ W.edges} := by + intro e he + have h₁ : e ∈ (Γ.interSet (frontier X)).E := hCs.2 he + rw [← hd] at h₁ + change e ∈ (Γ.span _ _).E at h₁ + rw [Γ.span_E] at h₁ + exact h₁.1 + have hfin : {x | x ∈ W.edges}.Finite := W.edges.finite_toSet + calc C.length = C.E.ncard := rfl + _ ≤ {x | x ∈ W.edges}.ncard := ncard_le_ncard hsub hfin + _ ≤ W.edges.length := ncard_mem_list_le _ + _ < k := hl + +/-- **(8.3)** of Graph Minors XI (page 97): "If $X \subseteq \Sigma$ is a restraint, then +$\mathrm{ins}(\Gamma \cap bd(X)) = X$." -/ +theorem theorem_8_3_proof (hs : IsSlope Γ k ins) (hr : IsRestraint Γ ins k X) : + insOf ins (Γ.interSet (subBd X)) = X := by + rw [subBd_eq_frontier] + have hnot := hr.compl_not_subset + rw [subBd_eq_frontier] at hnot + have hr₁ := compl_mem_R hS hr.isClosed hr.isGammaNice hr.isSimplyConnected hr.nonempty + hr.ne_univ + have hr₂ := theorem_4_4_proof hS hs (Drawing.span_isSubdrawing Γ _ _) + (hr.isConfined hS) + obtain ⟨x, hx, hxi⟩ := not_subset.mp hnot + have heq := region_eq_of_mem hr₁ hr₂ (hx.2 : x ∈ Xᶜ) ⟨mem_univ x, hxi⟩ + have := congrArg compl heq + rw [compl_compl, ← compl_eq_univ_sdiff, compl_compl] at this + exact this.symm + +/-- `ins(W) = X` for a shortest perimeter walk `W` of a restraint `X`, as the proof of (8.4) uses +it. -/ +theorem insWalk_eq (hs : IsSlope Γ k ins) (hr : IsRestraint Γ ins k X) {u : S} + {W : GraphWalk Γ.toGraph u u} (hd : walkDrawing Γ W = Γ.interSet (frontier X)) : + insWalk ins Γ W = X := by + have := theorem_8_3_proof hS hs hr + rw [subBd_eq_frontier] at this + rw [insWalk, hd, this] + +/-- **(8.4)** of Graph Minors XI (page 97): "If $X_1, X_2, X_3$ are restraints then $X_1 \cup X_2 +\cup X_3 \ne \Sigma$." -/ +theorem theorem_8_4_proof (hs : IsSlope Γ k ins) {X₁ X₂ X₃ : Set S} (h₁ : IsRestraint Γ ins k X₁) + (h₂ : IsRestraint Γ ins k X₂) (h₃ : IsRestraint Γ ins k X₃) : X₁ ∪ X₂ ∪ X₃ ≠ univ := by + obtain ⟨u₁, W₁, -, -, l₁, -, d₁⟩ := h₁.exists_walk hS + obtain ⟨u₂, W₂, -, -, l₂, -, d₂⟩ := h₂.exists_walk hS + obtain ⟨u₃, W₃, -, -, l₃, -, d₃⟩ := h₃.exists_walk hS + obtain ⟨r, hr, n₁, n₂, n₃⟩ := theorem_8_2_proof hS hs W₁ W₂ W₃ l₁ l₂ l₃ + rw [insWalk_eq hS hs h₁ d₁] at n₁ + rw [insWalk_eq hS hs h₂ d₂] at n₂ + rw [insWalk_eq hS hs h₃ d₃] at n₃ + intro hun + obtain ⟨x, hx⟩ := region_nonempty hr + rcases (hun ▸ mem_univ x : x ∈ X₁ ∪ X₂ ∪ X₃) with (h | h) | h + · exact n₁ (nice_region h₁.isGammaNice hr ⟨x, hx, h⟩) + · exact n₂ (nice_region h₂.isGammaNice hr ⟨x, hx, h⟩) + · exact n₃ (nice_region h₃.isGammaNice hr ⟨x, hx, h⟩) + +end Main + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Rings.lean b/LeanPool/GraphMinor/GM11/Rings.lean new file mode 100644 index 0000000000..8e6ac4a379 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Rings.lean @@ -0,0 +1,628 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.EvenCircuit + +/-! +# Rings + +The proof of (5.4) in Graph Minors XI (pages 82–83) studies the circuits of `N(Z₁)` with `ins(C)` +maximal, called `Z₁`-rings, and a forest `G` that records how they meet. We need only one thing from +`G`: a ring that meets the rest in at most one vertex, statement (1) of the proof, and a second such +ring if there are two rings. We get these without the forest, by choosing a ring and a vertex `v` of +it so that the set of vertices reached from the ring without passing through `v` is smallest. + +This file works in a confined subdrawing `N` with a slope. `path_mem_ins` is the form of (4.3)(i) +that the paper uses: a path with both ends in `ins(C)` stays there. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {N : Drawing S} {k : ℕ} + {ins : Drawing S → Set S} + +/-- A *ring* of `N` (Graph Minors XI, proof of (5.4), page 82): "a circuit $C$ of $N(Z_1)$ chosen +with $\operatorname{ins}(C)$ maximal". -/ +def IsRing (ins : Drawing S → Set S) (N C : Drawing S) : Prop := + C.IsCircuit ∧ C.IsSubdrawing N ∧ + ∀ C' : Drawing S, C'.IsCircuit → C'.IsSubdrawing N → ins C ⊆ ins C' → ins C' ⊆ ins C + +omit [T2Space S] in +/-- Above each circuit lies a ring. -/ +theorem exists_ring_above (ins : Drawing S → Set S) {D : Drawing S} (hD : D.IsCircuit) + (hDs : D.IsSubdrawing N) : ∃ C, IsRing ins N C ∧ ins D ⊆ ins C := by + let 𝓒 : Set (Drawing S) := {C | C.IsCircuit ∧ C.IsSubdrawing N} + have hfin : 𝓒.Finite := by + refine Set.Finite.of_finite_image (f := fun C : Drawing S => (C.V, C.E)) ?_ ?_ + · refine (N.finite_V.finite_subsets.prod N.finite_edges.finite_subsets).subset ?_ + rintro _ ⟨C, ⟨-, hs⟩, rfl⟩ + exact ⟨hs.1, hs.2⟩ + · intro C _ D _ h + exact Drawing.ext_of_V_E (congrArg Prod.fst h) (congrArg Prod.snd h) + obtain ⟨X, hle, hX⟩ := (hfin.image ins).exists_le_maximal (a := ins D) ⟨D, ⟨hD, hDs⟩, rfl⟩ + obtain ⟨C, ⟨hC, hCs⟩, rfl⟩ := hX.1 + exact ⟨C, ⟨hC, hCs, fun C' hC' hC's h => hX.2 ⟨C', ⟨hC', hC's⟩, rfl⟩ h⟩, hle⟩ + +/-- What the disc `ins(C)` gives. -/ +theorem ins_facts_of_length (hs : IsSlope N k ins) {C : Drawing S} (hC : C.IsCircuit) + (hCs : C.IsSubdrawing N) (hl : C.length < k) : + IsClosed (ins C) ∧ frontier (ins C) = C.U ∧ C.U ⊆ ins C := by + have hcl : IsClosed (ins C) := (hs.isClosedDisc C hC hCs hl).isClosed + have hfr : frontier (ins C) = C.U := by rw [subBd_eq_frontier', hs.subBd_eq C hC hCs hl] + exact ⟨hcl, hfr, hs.U_subset_ins hC hCs hl⟩ + +/-- An edge lies in `ins(C)` or misses it. -/ +theorem edge_subset_or_disjoint_of_length (hs : IsSlope N k ins) {C : Drawing S} (hC : C.IsCircuit) + (hCs : C.IsSubdrawing N) (hl : C.length < k) {f : Set S} (hf : f ∈ N.E) : f ⊆ ins C + ∨ Disjoint f (ins C) := by + obtain ⟨hcl, hfr, hU⟩ := ins_facts_of_length hs hC hCs hl + by_cases hfC : f ∈ C.E + · exact Or.inl (fun x hx => hU (hfC.2.1 hx).1) + by_cases hmeet : (f ∩ ins C).Nonempty + · left + obtain ⟨x, hxf, hxi⟩ := hmeet + have hdis : Disjoint f (frontier (ins C)) := by + rw [hfr] + refine disjoint_left.mpr fun y hy hyU => hfC ?_ + have hyV : y ∉ C.V := fun h => (hf.2.1 hy).2 (hCs.1 h) + obtain ⟨g, hg, hyg⟩ := C.exists_edge_of_mem hyU hyV + rw [N.edge_eq_of_mem hf (hCs.2 hg) hy hyg] + exact hg + have hcov : f ⊆ interior (ins C) ∪ (ins C)ᶜ := by + intro y hy + by_cases hyi : y ∈ ins C + · refine Or.inl ?_ + by_contra h + exact disjoint_left.mp hdis hy ⟨subset_closure hyi, h⟩ + · exact Or.inr hyi + have hxin : x ∈ interior (ins C) := + (hcov hxf).resolve_right fun h => h hxi + intro y hy + by_contra hyi + have hconn : IsPreconnected f := + (show IsPathConnected f from hf.2.2.1).isConnected.isPreconnected + obtain ⟨z, -, hz₁, hz₂⟩ := hconn _ _ isOpen_interior hcl.isOpen_compl hcov ⟨x, hxf, hxin⟩ + ⟨y, hy, hyi⟩ + exact hz₂ (interior_subset hz₁) + · exact Or.inr (disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp hmeet)) + +section Slope + +variable (hs : IsSlope N k ins) (hconf : IsConfined k N) +include hs hconf + +/-- What the disc `ins(C)` gives. -/ +theorem ins_facts {C : Drawing S} (hC : C.IsCircuit) (hCs : C.IsSubdrawing N) : + IsClosed (ins C) ∧ frontier (ins C) = C.U ∧ C.U ⊆ ins C := + ins_facts_of_length hs hC hCs (hconf C hC hCs) + +/-- An edge lies in `ins(C)` or misses it. -/ +theorem edge_subset_or_disjoint {C : Drawing S} (hC : C.IsCircuit) (hCs : C.IsSubdrawing N) + {f : Set S} (hf : f ∈ N.E) : f ⊆ ins C ∨ Disjoint f (ins C) := + edge_subset_or_disjoint_of_length hs hC hCs (hconf C hC hCs) hf + +/-- A vertex in `ins(C)` at the end of an edge outside lies on `C`. -/ +theorem mem_V_of_outside_edge {C : Drawing S} (hC : C.IsCircuit) (hCs : C.IsSubdrawing N) + {f : Set S} (hdis : Disjoint f (ins C)) {x : S} (hxV : x ∈ N.V) + (hxf : x ∈ closure f) (hxi : x ∈ ins C) : x ∈ C.V := by + obtain ⟨hcl, hfr, -⟩ := ins_facts hs hconf hC hCs + have hfrx : x ∈ frontier (ins C) := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure hxi, closure_mono (fun y hy => disjoint_left.mp hdis hy) hxf⟩ + rw [hfr] at hfrx + by_contra h + obtain ⟨g, hg, hxg⟩ := C.exists_edge_of_mem hfrx h + exact ((hCs.2 hg).2.1 hxg).2 hxV + +/-- If a walk leaves `ins(C)` and first returns at `z`, it arrives by an edge outside. -/ +theorem exists_exit_edge {C : Drawing S} (hC : C.IsCircuit) (hCs : C.IsSubdrawing N) {p z : S} + (W : GraphWalk N.toGraph p z) (hp : p ∉ ins C) (hz : z ∈ ins C) + (huniq : ∀ x ∈ W.support, x ∈ ins C → x = z) : + ∃ f ∈ N.E, z ∈ closure f ∧ Disjoint f (ins C) := by + induction W with + | nil h => exact absurd hz hp + | @cons a y b e hl r ih => + have huniq' : ∀ x ∈ r.support, x ∈ ins C → x = b := fun x hx => huniq x + (List.mem_cons_of_mem _ hx) + have hedge : e ∈ N.E := hl.1 + have hcase : Disjoint e (ins C) := by + refine (edge_subset_or_disjoint hs hconf hC hCs hedge).resolve_left fun h => hp ?_ + have ha : a ∈ closure e := by + have : a ∈ closure e ∩ N.V := by rw [hl.2.2.2]; simp + exact this.1 + exact (ins_facts hs hconf hC hCs).1.closure_subset_iff.mpr h ha + by_cases hy : y ∈ ins C + · have hyb : y = b := huniq' y r.start_mem_support hy + subst hyb + have hy' : y ∈ closure e := by + have : y ∈ closure e ∩ N.V := by rw [hl.2.2.2]; simp + exact this.1 + exact ⟨e, hedge, hy', hcase⟩ + · exact ih hy hz huniq' + +/-- The form of (4.3)(i) that the paper uses: for a ring `C`, a path of `N` with both ends in +`ins(C)` +stays in `ins(C)`. -/ +theorem path_mem_ins {C : Drawing S} (hC : IsRing ins N C) {a b : S} (W : GraphWalk N.toGraph a b) + (hW : W.IsSimple) (ha : a ∈ ins C) (hb : b ∈ ins C) : + (∀ x ∈ W.support, x ∈ ins C) ∧ ∀ e ∈ W.edges, e ⊆ ins C := by + obtain ⟨hcirc, hCs, hmax⟩ := hC + obtain ⟨hcl, hfr, hUC⟩ := ins_facts hs hconf hcirc hCs + induction W with + | nil h => + refine ⟨fun x hx => ?_, fun e he => absurd he List.not_mem_nil⟩ + rw [GraphWalk.support_nil, List.mem_singleton] at hx + rw [hx] + exact ha + | @cons a v b e hl r ih => + have hr : r.IsSimple := GraphWalk.IsSimple.of_cons hW + have hedge : e ∈ N.E := hl.1 + have hae : a ∈ closure e := by + have : a ∈ closure e ∩ N.V := by rw [hl.2.2.2]; simp + exact this.1 + have hve : v ∈ closure e := by + have : v ∈ closure e ∩ N.V := by rw [hl.2.2.2]; simp + exact this.1 + rcases edge_subset_or_disjoint hs hconf hcirc hCs hedge with hsub | hdis + · have hv : v ∈ ins C := hcl.closure_subset_iff.mpr hsub hve + obtain ⟨h₁, h₂⟩ := ih hr hv hb + refine ⟨fun x hx => ?_, fun f hf => ?_⟩ + · rcases List.mem_cons.mp hx with rfl | hx + · exact ha + · exact h₁ x hx + · rcases List.mem_cons.mp hf with rfl | hf + · exact hsub + · exact h₂ f hf + · exfalso + have haC : a ∈ C.V := mem_V_of_outside_edge hs hconf hcirc hCs hdis hl.2.1 hae ha + obtain ⟨z, W', hzA, huniq, hsup, -, hsimple⟩ := GraphWalk.exists_prefix r (ins C) hb + have hzC : z ∈ C.V := by + by_cases hv : v ∈ ins C + · have hvz : v = z := huniq v W'.start_mem_support hv + subst hvz + exact mem_V_of_outside_edge hs hconf hcirc hCs hdis hl.2.2.1 hve hv + · obtain ⟨f, hf, hzf, hdisf⟩ := exists_exit_edge hs hconf hcirc hCs W' hv hzA huniq + have hzV : z ∈ N.V := W'.mem_vertexSet_of_mem_support W'.end_mem_support + exact mem_V_of_outside_edge hs hconf hcirc hCs hdisf hzV hzf hzA + have hT : (GraphWalk.cons hl W').IsSimple := by + refine List.nodup_cons.mpr ⟨fun h => ?_, hsimple hr⟩ + exact (List.nodup_cons.mp hW).1 (hsup a h) + have hU := theorem_4_3_i hs (Drawing.IsSubdrawing.refl N) hconf hcirc hCs hmax + (GraphWalk.cons hl W') hT haC hzC + obtain ⟨x, hx⟩ := (show e ∈ N.E from hedge).1 + have hxU : x ∈ (walkDrawing N (GraphWalk.cons hl W')).U := + (mem_walkDrawing_U N _).mpr (Or.inr ⟨e, List.mem_cons_self, subset_closure hx⟩) + exact disjoint_left.mp hdis hx (hU hxU) + +/-- If a circuit `D` of `N` has two vertices in `ins(C)` for a ring `C`, then `U(D) ⊆ ins(C)` +(Graph Minors XI, proof of (5.4), page 82). -/ +theorem circuit_U_subset {C D : Drawing S} (hC : IsRing ins N C) (hD : D.IsCircuit) + (hDs : D.IsSubdrawing N) {a b : S} (ha : a ∈ D.V) (hb : b ∈ D.V) (hab : a ≠ b) + (hai : a ∈ ins C) (hbi : b ∈ ins C) : D.U ⊆ ins C := by + have hcl := (ins_facts hs hconf hC.1 hC.2.1).1 + obtain ⟨P, Q, hP, hQ, hPs, hQs, -, -, -, -, hsup⟩ := hD.exists_two_paths ha hb hab + have hkey : ∀ R : Drawing S, R.IsPathBetween a b → R.IsSubdrawing D → + (∀ x ∈ R.V, x ∈ ins C) ∧ ∀ e ∈ R.E, e ⊆ ins C := by + rintro R ⟨W, hW, hV, hE⟩ hR + obtain ⟨W', hs', he'⟩ := (hR.trans hDs).exists_walk_up W + have hW' : W'.IsSimple := by + unfold GraphWalk.IsSimple + rw [hs'] + exact hW + obtain ⟨h₁, h₂⟩ := path_mem_ins hs hconf hC W' hW' hai hbi + refine ⟨fun x hx => h₁ x ?_, fun e he => h₂ e ?_⟩ + · rw [hV] at hx + rw [hs'] + exact hx + · rw [hE] at he + rw [he'] + exact he + obtain ⟨p₁, p₂⟩ := hkey P hP hPs + obtain ⟨q₁, q₂⟩ := hkey Q hQ hQs + rw [D.U_eq] + refine union_subset ?_ (iUnion₂_subset fun e he => hcl.closure_subset_iff.mpr ?_) + · intro x hx + rw [← hsup, Drawing.sup_V hPs hQs] at hx + exact hx.elim (p₁ x) (q₁ x) + · rw [← hsup, Drawing.sup_E hPs hQs] at he + exact he.elim (p₂ e) (q₂ e) + +/-- Two rings with `U(C') ⊆ ins(C)` are equal. -/ +theorem ring_eq_of_U_subset {C C' : Drawing S} (hC : IsRing ins N C) (hC' : IsRing ins N C') + (hU : C'.U ⊆ ins C) : C' = C := by + have hle := hs.monotone C' C hC'.1 (hC'.2.1.trans (Drawing.IsSubdrawing.refl N)) + (hconf _ hC'.1 hC'.2.1) hC.1 hC.2.1 (hconf _ hC.1 hC.2.1) hU + have hge := hC'.2.2 C hC.1 hC.2.1 hle + have heq : ins C' = ins C := subset_antisymm hle hge + have hUU : C'.U = C.U := by + rw [← (ins_facts hs hconf hC'.1 hC'.2.1).2.1, ← (ins_facts hs hconf hC.1 hC.2.1).2.1, heq] + have hV : ∀ {A B : Drawing S}, A.IsSubdrawing N → B.IsSubdrawing N → A.U = B.U → A.V ⊆ B.V := by + intro A B hA hB hAB x hx + by_contra h + have hxU : x ∈ B.U := hAB ▸ A.V_subset_U hx + obtain ⟨g, hg, hxg⟩ := B.exists_edge_of_mem hxU h + exact ((hB.2 hg).2.1 hxg).2 (hA.1 hx) + have hE : ∀ {A B : Drawing S}, A.IsSubdrawing N → B.IsSubdrawing N → A.U = B.U → A.E ⊆ B.E := by + intro A B hA hB hAB e he + obtain ⟨x, hx⟩ := he.1 + have hxU : x ∈ B.U := hAB ▸ (he.2.1 hx).1 + have hxV : x ∉ B.V := fun h => ((hA.2 he).2.1 hx).2 (hB.1 h) + obtain ⟨g, hg, hxg⟩ := B.exists_edge_of_mem hxU hxV + rw [N.edge_eq_of_mem (hA.2 he) (hB.2 hg) hx hxg] + exact hg + exact Drawing.ext_of_V_E (subset_antisymm (hV hC'.2.1 hC.2.1 hUU) (hV hC.2.1 hC'.2.1 hUU.symm)) + (subset_antisymm (hE hC'.2.1 hC.2.1 hUU) (hE hC.2.1 hC'.2.1 hUU.symm)) + +/-- Distinct rings share at most one vertex (Graph Minors XI, proof of (5.4), page 82). -/ +theorem ring_inter_le_one {C C' : Drawing S} (hC : IsRing ins N C) (hC' : IsRing ins N C') + (hne : C' ≠ C) {a b : S} (ha : a ∈ C'.V) (hb : b ∈ C'.V) (hai : a ∈ ins C) (hbi : b ∈ ins C) : + a = b := by + by_contra hab + exact hne (ring_eq_of_U_subset hs hconf hC hC' (circuit_U_subset hs hconf hC hC'.1 hC'.2.1 ha hb + hab + hai hbi)) + +/-- If a vertex `w` of a ring `C'` lies in `ins(C)` for another ring `C`, then `w` lies on `C`, and +an +edge of `C'` at `w` lies outside `ins(C)`. -/ +theorem ring_vertex_in_ins {C C' : Drawing S} (hC : IsRing ins N C) (hC' : IsRing ins N C') + (hne : C' ≠ C) {w : S} (hw : w ∈ C'.V) (hwi : w ∈ ins C) : + w ∈ C.V ∧ ∃ g ∈ C'.E, w ∈ closure g ∧ Disjoint g (ins C) := by + have hcl := (ins_facts hs hconf hC.1 hC.2.1).1 + obtain ⟨W, ⟨hnd, hed⟩, hpos, hV, hE⟩ := exists_walk_at hC'.1 hw + cases W with + | nil h => simp [GraphWalk.length, GraphWalk.edges] at hpos + | @cons a y b g hl r => + have hgN : g ∈ C'.E := by rw [hE]; exact List.mem_cons_self + have hgN' : g ∈ N.E := hC'.2.1.2 hgN + have hcap : closure g ∩ C'.V = {w, y} := hl.2.2.2 + have hwg : w ∈ closure g := by + have : w ∈ closure g ∩ C'.V := by rw [hcap]; simp + exact this.1 + have hyg : y ∈ closure g ∩ C'.V := by rw [hcap]; simp + rcases edge_subset_or_disjoint hs hconf hC.1 hC.2.1 hgN' with hsub | hdis + · exfalso + have hyi : y ∈ ins C := hcl.closure_subset_iff.mpr hsub hyg.1 + have hwy : w = y := ring_inter_le_one hs hconf hC hC' hne hw hyg.2 hwi hyi + subst hwy + -- A loop is the whole of `C'`. + have hr : r.IsSimple := hnd + have hlen := GraphWalk.IsSimple.length_eq_zero hr + have hsup : r.support = [w] := by + cases r with + | nil _ => rfl + | cons _ _ => simp [GraphWalk.length, GraphWalk.edges] at hlen + have hred : r.edges = [] := by + cases r with + | nil _ => rfl + | cons _ _ => simp [GraphWalk.length, GraphWalk.edges] at hlen + apply hne + refine ring_eq_of_U_subset hs hconf hC hC' ?_ + rw [C'.U_eq] + refine union_subset ?_ (iUnion₂_subset fun e he => ?_) + · intro x hx + rw [hV] at hx + have : x = w := by + have hsupp : x ∈ w :: r.support := hx + rw [hsup] at hsupp + simpa using hsupp + exact this ▸ hwi + · rw [hE] at he + have : e = g := by + have hee : e ∈ g :: r.edges := he + rw [hred] at hee + simpa using hee + rw [this] + exact hcl.closure_subset_iff.mpr hsub + · exact ⟨mem_V_of_outside_edge hs hconf hC.1 hC.2.1 hdis (hC'.2.1.1 hw) hwg hwi, + g, hgN, hwg, hdis⟩ + +end Slope + +omit [TopologicalSpace S] [T2Space S] in +theorem mem_support_nil {G : Graph S (Set S)} {a x : S} {h : a ∈ G.vertexSet} : + x ∈ (GraphWalk.nil h).support ↔ x = a := by + simp [GraphWalk.support_nil] + +omit [T2Space S] in +/-- Joining two simple walks that share only the joint gives a simple walk. -/ +theorem isSimple_append' {a x b : S} {W₁ : GraphWalk N.toGraph a x} {W₂ : GraphWalk N.toGraph x b} + (h₁ : W₁.IsSimple) (h₂ : W₂.IsSimple) (hdis : ∀ y ∈ W₁.support, y ∈ W₂.support → y = x) : + (W₁.append W₂).IsSimple := by + unfold GraphWalk.IsSimple + rw [GraphWalk.support_append] + have h₂' : W₂.support = x :: W₂.support.tail := W₂.support_eq_cons + have hnd : (x :: W₂.support.tail).Nodup := h₂' ▸ h₂ + refine List.nodup_append.mpr ⟨h₁, (List.nodup_cons.mp hnd).2, ?_⟩ + rintro y hy z hz rfl + have := hdis y hy (h₂' ▸ List.mem_cons_of_mem _ hz) + exact (List.nodup_cons.mp hnd).1 (this ▸ hz) + +/-- A simple walk inside a subdrawing between two vertices of a circuit. -/ +theorem exists_simple_walk_in_circuit {C : Drawing S} (hC : C.IsCircuit) (hCs : C.IsSubdrawing N) + {a b : S} (ha : a ∈ C.V) (hb : b ∈ C.V) : + ∃ W : GraphWalk N.toGraph a b, W.IsSimple ∧ ∀ x ∈ W.support, x ∈ C.V := by + by_cases hab : a = b + · subst hab + have h0 : a ∈ N.V := hCs.1 ha + exact ⟨.nil h0, List.nodup_singleton a, fun x hx => mem_support_nil.mp hx ▸ ha⟩ + obtain ⟨P, -, ⟨W, hW, hV, -⟩, -, hPs, -⟩ := hC.exists_two_paths ha hb hab + obtain ⟨W', hs', -⟩ := (hPs.trans hCs).exists_walk_up W + refine ⟨W', ?_, fun x hx => ?_⟩ + · unfold GraphWalk.IsSimple + rw [hs'] + exact hW + · rw [hs'] at hx + exact hPs.1 (hV ▸ hx) + +section Slope + +variable (hs : IsSlope N k ins) (hconf : IsConfined k N) +include hs hconf + +/-- No walk that avoids a common vertex `u` of two distinct rings joins them (Graph Minors XI, proof +of (5.4), page 82: the circuit through both rings that the paper excludes). -/ +theorem no_walk_between_rings {C C' : Drawing S} (hC : IsRing ins N C) (hC' : IsRing ins N C') + (hne : C' ≠ C) {u y x : S} (hu : u ∈ C.V) (hu' : u ∈ C'.V) (hy : y ∈ C.V) (hx : x ∈ C'.V) + (W : GraphWalk N.toGraph y x) (hW : u ∉ W.support) : False := by + classical + have hUC := (ins_facts hs hconf hC.1 hC.2.1).2.2 + have hVin : ∀ {w}, w ∈ C.V → w ∈ ins C := fun h => hUC (C.V_subset_U h) + obtain ⟨W₁, hW₁, hW₁s, -⟩ := GraphWalk.exists_isSimple W + obtain ⟨z, W₂, hz, huniq, hsup, -, hsimple⟩ := GraphWalk.exists_prefix W₁ C'.V hx + have hW₂ := hsimple hW₁ + obtain ⟨Q, hQ, hQV⟩ := exists_simple_walk_in_circuit hC'.1 hC'.2.1 hz hu' + have hR : (W₂.append Q).IsSimple := isSimple_append' hW₂ hQ fun a ha haQ => huniq a ha (hQV a haQ) + obtain ⟨h₁, -⟩ := path_mem_ins hs hconf hC _ hR (hVin hy) (hVin hu) + have hzi : z ∈ ins C := h₁ z ((GraphWalk.mem_support_append _ _).mpr (Or.inl W₂.end_mem_support)) + have hzu : z ≠ u := fun h => hW (hW₁s u (hsup u (h ▸ W₂.end_mem_support))) + exact hzu (ring_inter_le_one hs hconf hC hC' hne hz hu' hzi (hVin hu)) + +/-- A vertex `u` of a ring `C` at an edge not in `ins(C)` lies on another ring (Graph Minors XI, +proof of (5.4), page 83). Here every edge of `N` lies on a circuit. -/ +theorem exists_other_ring (hcirc : ∀ e ∈ N.E, ∃ D : Drawing S, D.IsCircuit ∧ D.IsSubdrawing N + ∧ e ∈ D.E) + {C : Drawing S} (hC : IsRing ins N C) {f : Set S} (hf : f ∈ N.E) (hfC : ¬ f ⊆ ins C) {u : S} + (hu : u ∈ C.V) (huf : u ∈ closure f) : ∃ C', IsRing ins N C' ∧ C' ≠ C ∧ u ∈ C'.V := by + obtain ⟨D, hD, hDs, hfD⟩ := hcirc f hf + obtain ⟨C', hC', hle⟩ := exists_ring_above ins hD hDs + have hfi : f ⊆ ins C' := fun x hx => + hle ((ins_facts hs hconf hD hDs).2.2 (hfD.2.1 hx).1) + have hne : C' ≠ C := fun h => hfC (h ▸ hfi) + have hne' : C ≠ C' := fun h => hne h.symm + have hui : u ∈ ins C' := (ins_facts hs hconf hC'.1 hC'.2.1).1.closure_subset_iff.mpr hfi huf + exact ⟨C', hC', hne, (ring_vertex_in_ins hs hconf hC' hC hne' hu hui).1⟩ + +/-- Distinct rings have no common edge (Graph Minors XI, proof of (5.4), page 82). -/ +theorem ring_edge_disjoint {C C' : Drawing S} (hC : IsRing ins N C) (hC' : IsRing ins N C') + (hne : C' ≠ C) : Disjoint C.E C'.E := by + refine disjoint_left.mpr fun g hg hg' => ?_ + obtain ⟨-, -, hU⟩ := ins_facts hs hconf hC.1 hC.2.1 + have hgi : closure g ⊆ ins C := + (ins_facts hs hconf hC.1 hC.2.1).1.closure_subset_iff.mpr fun x hx => hU (hg.2.1 hx).1 + obtain ⟨u, W, -, -, -, hE⟩ := id hC'.1 + have hgW : g ∈ W.edges := by + rw [hE] at hg' + exact hg' + obtain ⟨x, y, -, hl, -, -⟩ := exists_split_edge W hgW + have hx : x ∈ closure g ∩ C'.V := by rw [hl.2.2.2]; simp + have hy : y ∈ closure g ∩ C'.V := by rw [hl.2.2.2]; simp + have hxy : x = y := ring_inter_le_one hs hconf hC hC' hne hx.2 hy.2 (hgi hx.1) (hgi hy.1) + have hloop : closure g ∩ C'.V = {x} := by + rw [hl.2.2.2, ← hxy] + simp + have hone := IsCircuit.E_eq_of_loop hC'.1 hg' hloop + obtain ⟨-, g₀, hg₀, -, hdis⟩ := ring_vertex_in_ins hs hconf hC hC' hne hx.2 (hgi hx.1) + rw [hone] at hg₀ + have hg₀g : g₀ = g := hg₀ + obtain ⟨p, hp⟩ := hg.1 + exact disjoint_left.mp hdis (hg₀g ▸ hp) (hU (hg.2.1 hp).1) + +end Slope + +/-- The vertices reached from `C` by walks of `N` that avoid `v`. -/ +def ringSide (N C : Drawing S) (v : S) : Set S := + {x | ∃ y ∈ C.V, ∃ W : GraphWalk N.toGraph y x, v ∉ W.support} + +/-- `C` meets the rest of `N` only at `v`: statement (1) of the proof of (5.4) in Graph Minors XI +(page 83), "at most one vertex of $C_1$ is incident with an edge of $N(Z_1)$ not in +$\operatorname{ins}(C_1)$". -/ +def IsLeafRing (ins : Drawing S → Set S) (N C : Drawing S) (v : S) : Prop := + IsRing ins N C ∧ v ∈ C.V ∧ ∀ u ∈ C.V, u ≠ v → ∀ f ∈ N.E, u ∈ closure f → f ⊆ ins C + +section Slope + +variable (hs : IsSlope N k ins) (hconf : IsConfined k N) +include hs hconf + +/-- The descent: from a ring and a vertex, reach a leaf ring whose side stays in the first side, and +that is the first ring or has a vertex in that side. -/ +theorem exists_leaf_ring_below + (hcirc : ∀ e ∈ N.E, ∃ D : Drawing S, D.IsCircuit ∧ D.IsSubdrawing N ∧ e ∈ D.E) + {C₀ : Drawing S} (hC₀ : IsRing ins N C₀) {v₀ : S} (hv₀ : v₀ ∈ C₀.V) : + ∃ C v, IsLeafRing ins N C v ∧ ringSide N C v ⊆ ringSide N C₀ v₀ ∧ + (C = C₀ ∨ ∃ u ∈ C.V, u ∈ ringSide N C₀ v₀) := by + classical + have hfin : ∀ C v, (ringSide N C v).Finite := fun C v => N.finite_V.subset <| by + rintro x ⟨y, -, W, -⟩ + exact W.mem_vertexSet_of_mem_support W.end_mem_support + induction hn : (ringSide N C₀ v₀).ncard using Nat.strong_induction_on generalizing C₀ v₀ with + | _ n ih => + by_cases hleaf : ∀ u ∈ C₀.V, u ≠ v₀ → ∀ f ∈ N.E, u ∈ closure f → f ⊆ ins C₀ + · exact ⟨C₀, v₀, ⟨hC₀, hv₀, hleaf⟩, subset_rfl, Or.inl rfl⟩ + push Not at hleaf + obtain ⟨u, hu, huv, f, hf, huf, hfC⟩ := hleaf + obtain ⟨C', hC', hne, hu'⟩ := exists_other_ring hs hconf hcirc hC₀ hf hfC hu huf + have hne' : C₀ ≠ C' := fun h => hne h.symm + have hUC₀ := (ins_facts hs hconf hC₀.1 hC₀.2.1).2.2 + have hUC' := (ins_facts hs hconf hC'.1 hC'.2.1).2.2 + have hv₀C' : v₀ ∉ C'.V := fun h => huv (ring_inter_le_one hs hconf hC₀ hC' hne hu' h + (hUC₀ (C₀.V_subset_U hu)) (hUC₀ (C₀.V_subset_U hv₀))) + have huN : u ∈ N.V := hC₀.2.1.1 hu + have huside : u ∈ ringSide N C₀ v₀ := ⟨u, hu, .nil huN, fun h => huv + (mem_support_nil.mp h).symm⟩ + have hsub : ringSide N C' u ⊆ ringSide N C₀ v₀ := by + rintro x ⟨y, hy, W, hW⟩ + have hvW : v₀ ∉ W.support := by + intro hv + obtain ⟨W₁, W₂, rfl⟩ := W.exists_append_of_mem hv + refine no_walk_between_rings hs hconf hC₀ hC' hne hu hu' hv₀ hy W₁.reverse ?_ + rw [GraphWalk.support_reverse, List.mem_reverse] + exact fun h => hW ((GraphWalk.mem_support_append _ _).mpr (Or.inl h)) + obtain ⟨Q, -, hQV⟩ := exists_simple_walk_in_circuit hC'.1 hC'.2.1 hu' hy + refine ⟨u, hu, Q.append W, fun h => ?_⟩ + rcases (GraphWalk.mem_support_append _ _).mp h with h | h + · exact hv₀C' (hQV _ h) + · exact hvW h + have hnot : u ∉ ringSide N C' u := by + rintro ⟨y, -, W, hW⟩ + exact hW W.end_mem_support + have hlt : (ringSide N C' u).ncard < n := by + rw [← hn] + exact Set.ncard_lt_ncard ⟨hsub, fun h => hnot (h huside)⟩ (hfin _ _) + obtain ⟨C, v, h₁, h₂, h₃⟩ := ih _ hlt hC' hu' rfl + refine ⟨C, v, h₁, h₂.trans hsub, Or.inr ?_⟩ + rcases h₃ with rfl | ⟨w, hw, hws⟩ + · exact ⟨u, hu', huside⟩ + · exact ⟨w, hw, hsub hws⟩ + +/-- There is a ring as in statement (1), if `N` has a circuit. -/ +theorem exists_leaf_ring + (hcirc : ∀ e ∈ N.E, ∃ D : Drawing S, D.IsCircuit ∧ D.IsSubdrawing N ∧ e ∈ D.E) + {D : Drawing S} (hD : D.IsCircuit) (hDs : D.IsSubdrawing N) : ∃ C v, IsLeafRing ins N C v := by + obtain ⟨C₀, hC₀, -⟩ := exists_ring_above ins hD hDs + obtain ⟨v, hv⟩ : C₀.V.Nonempty := by + obtain ⟨u, W, -, -, hV, -⟩ := hC₀.1 + exact ⟨u, hV ▸ W.start_mem_support⟩ + obtain ⟨C, v, h, -, -⟩ := exists_leaf_ring_below hs hconf hcirc hC₀ hv + exact ⟨C, v, h⟩ + +/-- A walk from outside `ins(C₁)` to a vertex in `ins(C₁)`, for a leaf ring, passes through its +vertex `v₁`. -/ +theorem walk_passes_leaf_vertex {C₁ : Drawing S} {v₁ : S} (hL : IsLeafRing ins N C₁ v₁) {y x : S} + (W : GraphWalk N.toGraph y x) (hy : y ∉ ins C₁) (hx : x ∈ ins C₁) : v₁ ∈ W.support := by + classical + obtain ⟨hC, hv, hleaf⟩ := hL + obtain ⟨z, W', hz, huniq, hsup, -, -⟩ := GraphWalk.exists_prefix W (ins C₁) hx + obtain ⟨f, hf, hzf, hdis⟩ := exists_exit_edge hs hconf hC.1 hC.2.1 W' hy hz huniq + have hzV : z ∈ N.V := W'.mem_vertexSet_of_mem_support W'.end_mem_support + have hzC := mem_V_of_outside_edge hs hconf hC.1 hC.2.1 hdis hzV hzf hz + by_cases hzv : z = v₁ + · exact hzv ▸ hsup z W'.end_mem_support + · exfalso + obtain ⟨p, hp⟩ := (show f ∈ N.E from hf).1 + exact disjoint_left.mp hdis hp (hleaf z hzC hzv f hf hzf hp) + +/-- A second ring as in statement (1): if `C₁` is a leaf ring and `C'` is another ring, there is a +leaf ring other than `C₁`. This is the paper's "the graph $G$ defined before (1) has at least two +vertices of valency $\le 1$" (Graph Minors XI, proof of (5.4), page 84). -/ +theorem exists_second_leaf_ring + (hcirc : ∀ e ∈ N.E, ∃ D : Drawing S, D.IsCircuit ∧ D.IsSubdrawing N ∧ e ∈ D.E) + {C₁ C' : Drawing S} {v₁ : S} (hL : IsLeafRing ins N C₁ v₁) (hC' : IsRing ins N C') + (hne : C' ≠ C₁) : ∃ C v, IsLeafRing ins N C v ∧ C ≠ C₁ := by + classical + have hC₁ := hL.1 + have hUC₁ := (ins_facts hs hconf hC₁.1 hC₁.2.1).2.2 + have hUC' := (ins_facts hs hconf hC'.1 hC'.2.1).2.2 + have hne' : C₁ ≠ C' := fun h => hne h.symm + -- It is enough to find a vertex of `C'` whose side misses `V(C₁)`. + have hgoal : ∀ v ∈ C'.V, Disjoint (ringSide N C' v) C₁.V → + ∃ C v, IsLeafRing ins N C v ∧ C ≠ C₁ := by + intro v hv hdis + obtain ⟨C, w, h₁, -, h₃⟩ := exists_leaf_ring_below hs hconf hcirc hC' hv + refine ⟨C, w, h₁, ?_⟩ + rintro rfl + rcases h₃ with h | ⟨u, hu, hus⟩ + · exact hne h.symm + · exact disjoint_left.mp hdis hus hu + obtain ⟨c, hc⟩ : C'.V.Nonempty := by + obtain ⟨u, W, -, -, hV, -⟩ := hC'.1 + exact ⟨u, hV ▸ W.start_mem_support⟩ + by_cases hv₁ : v₁ ∈ C'.V + · -- The ring `C'` passes through `v₁`. + refine hgoal v₁ hv₁ (disjoint_left.mpr ?_) + rintro x ⟨y, hy, W, hW⟩ hx + have hyv : y ≠ v₁ := fun h => hW (h ▸ W.start_mem_support) + have hyi : y ∉ ins C₁ := fun h => hyv (ring_inter_le_one hs hconf hC₁ hC' hne hy hv₁ h + (hUC₁ (C₁.V_subset_U hL.2.1))) + exact hW (walk_passes_leaf_vertex hs hconf hL W hyi (hUC₁ (C₁.V_subset_U hx))) + · -- All of `C'` lies outside `ins(C₁)`. + have hout : ∀ w ∈ C'.V, w ∉ ins C₁ := by + intro w hw hwi + obtain ⟨hwC, g, hg, hwg, hdis⟩ := ring_vertex_in_ins hs hconf hC₁ hC' hne hw hwi + by_cases hwv : w = v₁ + · exact hv₁ (hwv ▸ hw) + · obtain ⟨p, hp⟩ := (show g ∈ C'.E from hg).1 + exact disjoint_left.mp hdis hp (hL.2.2 w hwC hwv g (hC'.2.1.2 hg) hwg hp) + have hv₁i : v₁ ∉ ins C' := fun h => + hv₁ (ring_vertex_in_ins hs hconf hC' hC₁ hne' hL.2.1 h).1 + by_cases hconn : ∃ y ∈ C'.V, Nonempty (GraphWalk N.toGraph y v₁) + · obtain ⟨y₀, hy₀, ⟨W₀⟩⟩ := hconn + obtain ⟨W₀', hW₀', -, -⟩ := GraphWalk.exists_isSimple W₀.reverse + obtain ⟨v, P, hvC, huniq, -, -, hsimple⟩ := GraphWalk.exists_prefix W₀' C'.V hy₀ + have hP := hsimple hW₀' + -- Off `v`, the walk `P` from `v₁` stays outside `ins(C')`. + have hPout : ∀ x ∈ P.support, x ≠ v → x ∉ ins C' := by + intro x hx hxv hxi + obtain ⟨P₁, P₂, rfl⟩ := P.exists_append_of_mem hx + obtain ⟨z, X, hz, hzu, hzs, -, -⟩ := GraphWalk.exists_prefix P₁ (ins C') hxi + obtain ⟨f, hf, hzf, hdis⟩ := exists_exit_edge hs hconf hC'.1 hC'.2.1 X hv₁i hz hzu + have hzV : z ∈ N.V := X.mem_vertexSet_of_mem_support X.end_mem_support + have hzC' := mem_V_of_outside_edge hs hconf hC'.1 hC'.2.1 hdis hzV hzf hz + have hzv : z = v := huniq z ((GraphWalk.mem_support_append _ _).mpr (Or.inl (hzs z + X.end_mem_support))) hzC' + -- `z = v` occurs before the end of `P`, which is impossible in a simple walk unless `x = + -- v`. + have hndP : (P₁.append P₂).support.Nodup := hP + rw [GraphWalk.support_append, P₂.support_eq_cons] at hndP + have hd := List.nodup_append.mp hndP + have hvP₂ : v ∈ (x :: P₂.support.tail).tail ∨ v = x := by + have := P₂.end_mem_support + rw [P₂.support_eq_cons] at this + rcases List.mem_cons.mp this with h | h + · exact Or.inr h + · exact Or.inl h + rcases hvP₂ with h | h + · exact hd.2.2 v (hzv ▸ hzs z X.end_mem_support) v h rfl + · exact hxv h.symm + refine hgoal v hvC (disjoint_left.mpr ?_) + rintro x ⟨y, hy, W, hW⟩ hx + have hv₁W : v₁ ∈ W.support := walk_passes_leaf_vertex hs hconf hL W (hout y hy) + (hUC₁ (C₁.V_subset_U hx)) + obtain ⟨Q, R, rfl⟩ := W.exists_append_of_mem hv₁W + have hvQ : v ∉ Q.support := fun h => hW ((GraphWalk.mem_support_append _ _).mpr (Or.inl h)) + obtain ⟨Q₁, hQ₁, hQ₁s, -⟩ := GraphWalk.exists_isSimple Q + obtain ⟨s, Q₂, hsA, hsu, hQ₂s, -, hsimple'⟩ := + GraphWalk.exists_prefix Q₁ {x | x ∈ P.support} P.start_mem_support + obtain ⟨P₁, P₂, rfl⟩ := P.exists_append_of_mem hsA + have hP₂ := (isSimple_of_append hP).2 + have hR : (Q₂.append P₂).IsSimple := isSimple_append' (hsimple' hQ₁) hP₂ fun a ha haP => + hsu a ha ((GraphWalk.mem_support_append _ _).mpr (Or.inr haP)) + obtain ⟨h₁, -⟩ := path_mem_ins hs hconf hC' _ hR (hUC' (C'.V_subset_U hy)) + (hUC' (C'.V_subset_U hvC)) + have hsi : s ∈ ins C' := h₁ s ((GraphWalk.mem_support_append _ _).mpr + (Or.inl Q₂.end_mem_support)) + have hsv : s ≠ v := fun h => hvQ (hQ₁s v (hQ₂s v (h ▸ Q₂.end_mem_support))) + exact hPout s hsA hsv hsi + · refine hgoal c hc (disjoint_left.mpr ?_) + rintro x ⟨y, hy, W, -⟩ hx + have hv₁W := walk_passes_leaf_vertex hs hconf hL W (hout y hy) (hUC₁ (C₁.V_subset_U hx)) + obtain ⟨Q, -, -⟩ := W.exists_append_of_mem hv₁W + exact hconn ⟨y, hy, ⟨Q⟩⟩ + +end Slope + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Rotation.lean b/LeanPool/GraphMinor/GM11/Rotation.lean new file mode 100644 index 0000000000..88f59651b2 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Rotation.lean @@ -0,0 +1,586 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Fan +import LeanPool.GraphMinor.GM11.Regions + +/-! +# The rotation at a vertex of a drawing + +The papers use freely that the edges and regions at a vertex of a drawing come in a cyclic order. +This file proves what we need of that. Each edge has two ends, so a loop at `v` counts twice: the +*half-edges* at `v` are the pairs `(e, b)` where `b` says which end of `e` is at `v`. Theorem +`exists_rotation` gives a cyclic order `next` on the half-edges at `v`, and a connected set `P k` +off +the drawing for each half-edge `k`, the corner between `k` and `next k`. Near `v` the corners fill +everything off the drawing, and near a point of the edge of `next k` everything off the drawing lies +in the two corners `P k` and `P (next k)`. + +The proof takes a small closed disc around `v`, follows each half-edge from `v` until it first +reaches the boundary of the disc, and applies `exists_fanInv` and `sector_sets_props` to these +lines. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A parametrization of all the edges of a drawing, as in `exists_edge_param`. -/ +structure EdgePar (Γ : Drawing S) (γ : Set S → I → S) : Prop where + cont : ∀ e ∈ Γ.E, Continuous (γ e) + zero : ∀ e ∈ Γ.E, γ e 0 ∈ Γ.V + one : ∀ e ∈ Γ.E, γ e 1 ∈ Γ.V + inj : ∀ e ∈ Γ.E, InjOn (γ e) (Ioo 0 1) + image : ∀ e ∈ Γ.E, γ e '' Ioo 0 1 = e + +theorem exists_edgePar [Nonempty S] (Γ : Drawing S) : ∃ γ, EdgePar Γ γ := by + choose! γ h using fun e (he : e ∈ Γ.E) => exists_edge_param Γ he + exact ⟨γ, fun e he => (h e he).1, fun e he => (h e he).2.1, fun e he => (h e he).2.2.1, + fun e he => (h e he).2.2.2.1, fun e he => (h e he).2.2.2.2⟩ + +/-- The end `0` or `1` of the parameter interval. -/ +def endOf (b : Bool) : I := if b then 1 else 0 + +/-- The half-edges at `v`: an edge with one of its two ends at `v`. A loop gives two half-edges. -/ +def halfEdges (Γ : Drawing S) (γ : Set S → I → S) (v : S) : Set (Set S × Bool) := + {x | x.1 ∈ Γ.E ∧ γ x.1 (endOf x.2) = v} + +theorem finite_halfEdges (Γ : Drawing S) (γ : Set S → I → S) (v : S) : + (halfEdges Γ γ v).Finite := + (Γ.finite_edges.prod (finite_univ (α := Bool))).subset fun _ hx => ⟨hx.1, mem_univ _⟩ + +/-- Half of a parameter. -/ +noncomputable def halfT (t : I) : I := + ⟨t.1 / 2, by have := t.2.1; positivity, by have := t.2.2; linarith⟩ + +/-- The point of parameter `t` on the half of `e` from the end `b`: this is `t / 2` of the way from +that end. -/ +noncomputable def halfPar : Bool → I → I + | true, t => σ (halfT t) + | false, t => halfT t + +theorem continuous_halfPar (b : Bool) : Continuous (halfPar b) := by + have h : Continuous halfT := Continuous.subtype_mk (by fun_prop) _ + cases b + · exact h + · exact unitInterval.continuous_symm.comp h + +@[simp] theorem halfPar_zero (b : Bool) : halfPar b 0 = endOf b := by + have h : halfT 0 = 0 := Subtype.ext (by simp [halfT]) + cases b + · exact h + · change σ (halfT 0) = 1 + rw [h] + simp + +theorem halfPar_coe (b : Bool) (t : I) : + (halfPar b t : ℝ) = if b then 1 - t.1 / 2 else t.1 / 2 := by + cases b <;> rfl + +theorem halfPar_injective (b : Bool) : Function.Injective (halfPar b) := by + intro s t h + have h' := congrArg Subtype.val h + rw [halfPar_coe, halfPar_coe] at h' + apply Subtype.ext + cases b <;> simp only [Bool.false_eq_true, ite_false, ite_true] at h' <;> linarith + +theorem halfPar_mem_Ioo (b : Bool) {t : I} (ht : 0 < t) : halfPar b t ∈ Ioo (0 : I) 1 := by + have ht₁ : (0 : ℝ) < t.1 := ht + have ht₂ := t.2.2 + have h := halfPar_coe b t + constructor + · change (0 : ℝ) < _ + rw [h] + cases b <;> simp only [Bool.false_eq_true, ite_false, ite_true] <;> linarith + · change _ < (1 : ℝ) + rw [h] + cases b <;> simp only [Bool.false_eq_true, ite_false, ite_true] <;> linarith + +theorem halfPar_eq_of_ne {b b' : Bool} (h : b ≠ b') {s t : I} (hst : halfPar b s = halfPar b' t) : + s = 1 ∧ t = 1 := by + have h' := congrArg Subtype.val hst + rw [halfPar_coe, halfPar_coe] at h' + have hs := s.2.2 + have ht := t.2.2 + cases b <;> cases b' <;> simp only [Bool.false_eq_true, ite_false, ite_true] at h' <;> + first + | exact absurd rfl h + | exact ⟨Subtype.ext (show s.1 = 1 by linarith), Subtype.ext (show t.1 = 1 by linarith)⟩ + +section Spoke + +variable {Γ : Drawing S} {γ : Set S → I → S} + +/-- The half-edge `x`, from its end to the middle of the edge. -/ +noncomputable def spoke (γ : Set S → I → S) (x : Set S × Bool) (t : I) : S := + γ x.1 (halfPar x.2 t) + +theorem spoke_mem_edge (hγ : EdgePar Γ γ) {x : Set S × Bool} (hx : x.1 ∈ Γ.E) {t : I} (ht : 0 < t) : + spoke γ x t ∈ x.1 := by + have := mem_image_of_mem (γ x.1) (halfPar_mem_Ioo x.2 ht) + rwa [hγ.image _ hx] at this + +omit [TopologicalSpace S] in +theorem spoke_zero (γ : Set S → I → S) (x : Set S × Bool) : spoke γ x 0 = γ x.1 (endOf x.2) := by + simp [spoke] + +theorem continuous_spoke (hγ : EdgePar Γ γ) {x : Set S × Bool} (hx : x.1 ∈ Γ.E) : + Continuous (spoke γ x) := + (hγ.cont _ hx).comp (continuous_halfPar x.2) + +theorem edge_notMem_V {e : Set S} (he : e ∈ Γ.E) {x : S} (hx : x ∈ e) : x ∉ Γ.V := + (he.2.1 hx).2 + +theorem spoke_injective (hγ : EdgePar Γ γ) {x : Set S × Bool} (hx : x.1 ∈ Γ.E) : + Function.Injective (spoke γ x) := by + intro s t h + by_cases hs : 0 < s + · by_cases ht : 0 < t + · exact halfPar_injective _ (hγ.inj _ hx (halfPar_mem_Ioo _ hs) (halfPar_mem_Ioo _ ht) h) + · have ht0 : t = 0 := le_antisymm (not_lt.mp ht) (bot_le) + subst ht0 + rw [spoke_zero] at h + have hmem := spoke_mem_edge hγ hx hs + rw [h] at hmem + have hV : γ x.1 (endOf x.2) ∈ Γ.V := by + cases hb : x.2 + · exact hγ.zero _ hx + · exact hγ.one _ hx + exact absurd hV (edge_notMem_V hx hmem) + · have hs0 : s = 0 := le_antisymm (not_lt.mp hs) (bot_le) + subst hs0 + by_cases ht : 0 < t + · rw [spoke_zero] at h + have hmem := spoke_mem_edge hγ hx ht + rw [← h] at hmem + have hV : γ x.1 (endOf x.2) ∈ Γ.V := by + cases hb : x.2 + · exact hγ.zero _ hx + · exact hγ.one _ hx + exact absurd hV (edge_notMem_V hx hmem) + · exact (le_antisymm (not_lt.mp ht) bot_le).symm + +/-- Different half-edges meet only at the middle of an edge, or at their ends. -/ +theorem spoke_eq_of_ne (hγ : EdgePar Γ γ) {x y : Set S × Bool} (hx : x.1 ∈ Γ.E) (hy : y.1 ∈ Γ.E) + (hxy : x ≠ y) {s t : I} (hs : 0 < s) (ht : 0 < t) (h : spoke γ x s = spoke γ y t) : + s = 1 ∧ t = 1 := by + obtain ⟨e, b⟩ := x + obtain ⟨e', b'⟩ := y + have h₁ := spoke_mem_edge hγ hx hs + have h₂ := spoke_mem_edge hγ hy ht + rw [h] at h₁ + have he : e = e' := Γ.edge_eq_of_mem hx hy h₁ h₂ + subst he + have hb : b ≠ b' := fun hb => hxy (by rw [hb]) + exact halfPar_eq_of_ne hb (hγ.inj _ hx (halfPar_mem_Ioo b hs) (halfPar_mem_Ioo b' ht) h) + +/-- Follow a half-edge from `v` until it first leaves the open set `D'`, in a point of `discBd D`. +-/ +theorem exists_truncation (hγ : EdgePar Γ γ) {x : Set S × Bool} (hx : x.1 ∈ Γ.E) {D D' : Set S} + (hD : IsClosed D) (hD' : IsOpen D') (hsub : D' ⊆ D) (hbd : D \ D' = discBd D) + (hv : spoke γ x 0 ∈ D') (hout : spoke γ x 1 ∉ D) : + ∃ τ : I, 0 < τ ∧ τ < 1 ∧ (∀ t, t < τ → spoke γ x t ∈ D') ∧ spoke γ x τ ∈ discBd D := by + have hc := continuous_spoke hγ hx + have hC : IsCompact {t : I | spoke γ x t ∉ D'} := (hD'.isClosed_compl.preimage hc).isCompact + obtain ⟨τ, hτ, hmin⟩ := hC.exists_isLeast ⟨1, fun h => hout (hsub h)⟩ + have hτ0 : 0 < τ := by + refine unitInterval.pos_iff_ne_zero.mpr ?_ + rintro rfl + exact hτ hv + have hbefore : ∀ t, t < τ → spoke γ x t ∈ D' := fun t ht => by + by_contra hcon + exact absurd (hmin hcon) (not_le.mpr ht) + have hτD : spoke γ x τ ∈ D := by + have h₁ : τ ∈ closure (Iio τ) := by + rw [closure_Iio' (a := τ) ⟨0, hτ0⟩] + exact mem_Iic.mpr le_rfl + have h₂ := map_mem_closure hc h₁ (t := D) fun t ht => hsub (hbefore t ht) + rwa [hD.closure_eq] at h₂ + have hτ1 : τ < 1 := by + refine lt_of_le_of_ne le_top ?_ + rintro rfl + exact hout hτD + exact ⟨τ, hτ0, hτ1, hbefore, hbd ▸ ⟨hτD, hτ⟩⟩ + +/-- The piece of a half-edge up to `τ` is a line. -/ +theorem isLine_spoke_piece [T2Space S] (hγ : EdgePar Γ γ) {x : Set S × Bool} (hx : x.1 ∈ Γ.E) + {τ : I} (hτ : 0 < τ) : IsLineWithEnds (spoke γ x '' Icc 0 τ) (spoke γ x 0) (spoke γ x τ) := by + have hc := continuous_spoke hγ hx + let f : C(I, S) := ⟨fun t => spoke γ x (t * τ), hc.comp (by fun_prop)⟩ + have hinj : Function.Injective f := by + intro s t h + have h₁ := spoke_injective hγ hx h + have h₂ : s.1 * τ.1 = t.1 * τ.1 := congrArg Subtype.val h₁ + have hτ' : (τ : ℝ) ≠ 0 := ne_of_gt hτ + exact Subtype.ext (mul_right_cancel₀ hτ' h₂) + have hr : range f = spoke γ x '' Icc 0 τ := by + ext y + constructor + · rintro ⟨t, rfl⟩ + exact ⟨t * τ, ⟨bot_le, unitInterval.mul_le_right⟩, rfl⟩ + · rintro ⟨t, ⟨-, ht⟩, rfl⟩ + have hτ' : (0 : ℝ) < τ := hτ + have ht' : t.1 ≤ τ.1 := ht + refine ⟨⟨t.1 / τ.1, div_nonneg t.2.1 hτ'.le, (div_le_one hτ').mpr ht'⟩, ?_⟩ + change spoke γ x _ = _ + congr 1 + apply Subtype.ext + change t.1 / τ.1 * τ.1 = t.1 + field_simp + have := isLineWithEnds_range f hinj + rw [hr] at this + have h0 : f 0 = spoke γ x 0 := by simp [f] + have h1 : f 1 = spoke γ x τ := by simp [f] + rwa [h0, h1] at this + +end Spoke + +/-- A closed drawing remainder away from a vertex and prescribed positive initial pieces of +its incident half-edges. The vertex and these pieces cover the rest of the drawing. -/ +theorem exists_closed_drawingAwayFromSpokes {Γ : Drawing S} {γ : Set S → I → S} + (hγ : EdgePar Γ γ) {v : S} (hv : v ∈ Γ.V) [T2Space S] + (τ : halfEdges Γ γ v → I) (hτ0 : ∀ x, 0 < τ x) : + ∃ K : Set S, IsClosed K ∧ v ∉ K ∧ + Γ.U ⊆ K ∪ ({v} ∪ ⋃ i : halfEdges Γ γ v, spoke γ i.1 '' Icc 0 (τ i)) := by + classical + let H := halfEdges Γ γ v + let J : H → Set S := fun i => spoke γ i.1 '' Icc 0 (τ i) + let C : Set S → Set I := fun e => {t | ∀ x : H, x.1.1 = e → + (if x.1.2 then t.1 ≤ 1 - (τ x).1 / 2 else (τ x).1 / 2 ≤ t.1)} + let K : Set S := (Γ.V \ {v}) ∪ ⋃ e ∈ Γ.E, γ e '' C e + have hCclosed : ∀ e, IsClosed (C e) := by + intro e + have : C e = ⋂ x : H, {t : I | x.1.1 = e → + (if x.1.2 then t.1 ≤ 1 - (τ x).1 / 2 else (τ x).1 / 2 ≤ t.1)} := by + ext t + simp [C] + rw [this] + refine isClosed_iInter fun x => ?_ + by_cases hx : x.1.1 = e + · cases hb : x.1.2 + · simpa [hx, hb] using isClosed_le continuous_const continuous_subtype_val + · simpa [hx, hb] using isClosed_le continuous_subtype_val continuous_const + · simp [hx] + have hKclosed : IsClosed K := by + refine ((Γ.finite_V.subset sdiff_subset).isClosed).union ?_ + exact Γ.finite_edges.isClosed_biUnion fun e he => + ((hCclosed e).isCompact.image (hγ.cont e he)).isClosed + have hend : ∀ e ∈ Γ.E, ∀ t : I, t ∉ Ioo (0 : I) 1 → t = 0 ∨ t = 1 := by + intro e _ t ht + by_contra hcon + push Not at hcon + exact ht ⟨unitInterval.pos_iff_ne_zero.mpr hcon.1, lt_of_le_of_ne le_top hcon.2⟩ + have hvK : v ∉ K := by + rintro (⟨-, h⟩ | h) + · exact h rfl + · obtain ⟨e, he, t, ht, hte⟩ := mem_iUnion₂.mp h + by_cases hIoo : t ∈ Ioo (0 : I) 1 + · have : v ∈ e := by + rw [← hγ.image e he] + exact ⟨t, hIoo, hte⟩ + exact edge_notMem_V he this hv + · rcases hend e he t hIoo with rfl | rfl + · have hx : ((e, false) : Set S × Bool) ∈ halfEdges Γ γ v := ⟨he, hte⟩ + have := ht ⟨_, hx⟩ rfl + simp only [Bool.false_eq_true, ite_false] at this + have h0 : (0 : ℝ) < τ ⟨_, hx⟩ := hτ0 ⟨_, hx⟩ + simp at this + linarith + · have hx : ((e, true) : Set S × Bool) ∈ halfEdges Γ γ v := ⟨he, hte⟩ + have := ht ⟨_, hx⟩ rfl + simp only [ite_true] at this + have h0 : (0 : ℝ) < τ ⟨_, hx⟩ := hτ0 ⟨_, hx⟩ + simp at this + linarith + have hclosureE : ∀ e ∈ Γ.E, closure e ⊆ γ e '' univ := by + intro e he + refine closure_minimal ?_ ((isCompact_univ.image (hγ.cont e he)).isClosed) + intro x hx + have h' : x ∈ γ e '' Ioo 0 1 := by rw [hγ.image e he]; exact hx + obtain ⟨t, -, rfl⟩ := h' + exact ⟨t, mem_univ _, rfl⟩ + have hUsub : Γ.U ⊆ K ∪ ({v} ∪ ⋃ i, J i) := by + rw [Γ.U_eq] + rintro x (hx | hx) + · by_cases hxv : x = v + · exact Or.inr (Or.inl (mem_singleton_iff.mpr hxv)) + · exact Or.inl (Or.inl ⟨hx, hxv⟩) + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + obtain ⟨t, -, rfl⟩ := hclosureE e he hxe + by_cases htC : t ∈ C e + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨e, he, t, htC, rfl⟩)) + · right + right + simp only [C, mem_ofPred_eq, not_forall] at htC + obtain ⟨y, hye, hcon⟩ := htC + refine mem_iUnion.mpr ⟨y, ?_⟩ + subst hye + have hy0 := (τ y).2.2 + cases hb : y.1.2 + · rw [hb] at hcon + simp only [Bool.false_eq_true, ite_false, not_le] at hcon + have ht0 := t.2.1 + refine ⟨⟨2 * t.1, by linarith, by linarith⟩, ⟨bot_le, ?_⟩, ?_⟩ + · change 2 * t.1 ≤ (τ y).1 + linarith + · change γ y.1.1 (halfPar y.1.2 _) = _ + rw [hb] + congr 1 + exact Subtype.ext (by simp [halfPar, halfT]) + · rw [hb] at hcon + simp only [ite_true, not_le] at hcon + have ht1 := t.2.2 + refine ⟨⟨2 * (1 - t.1), by linarith, by linarith⟩, ⟨bot_le, ?_⟩, ?_⟩ + · change 2 * (1 - t.1) ≤ (τ y).1 + linarith + · change γ y.1.1 (halfPar y.1.2 _) = _ + rw [hb] + congr 1 + exact Subtype.ext (by simp [halfPar, halfT]) + exact ⟨K, hKclosed, hvK, hUsub⟩ + +/-- **The rotation at a vertex.** The half-edges at `v`, when there are at least two, have a cyclic +order `next`. Each half-edge `k` has a corner `P k`, the part near `v` between `k` and `next k`. The +corners are connected and miss the drawing, and `v` is in their closure. Near `v`, everything off +the +drawing lies in the corners. At some point `q` of the edge of `next k`, everything near `q` and off +the drawing lies in `P k` and `P (next k)`, and `q` is in the closure of both. -/ +theorem exists_rotation_sectors (hS : IsClosedSurface S) + (Γ : Drawing S) {γ : Set S → I → S} (hγ : EdgePar Γ γ) {v : S} + (hv : v ∈ Γ.V) (h2 : 2 ≤ Nat.card (halfEdges Γ γ v)) : + ∃ (next : halfEdges Γ γ v → halfEdges Γ γ v) (P : halfEdges Γ γ v → Set S) (W : Set S) + (Q : halfEdges Γ γ v → Set S), + IsOpen W ∧ v ∈ W ∧ Function.Injective next ∧ (∀ k, next k ≠ k) ∧ + (∀ a b, Relation.ReflTransGen (fun x y => y = next x) a b) ∧ + (∀ k, IsPreconnected (P k)) ∧ (∀ k, Disjoint (P k) Γ.U) ∧ (∀ k, v ∈ closure (P k)) ∧ + (W \ Γ.U ⊆ ⋃ k, P k) ∧ + (∀ k, ∃ q ∈ (next k).1.1, ∃ O, IsOpen O ∧ q ∈ O ∧ O \ Γ.U ⊆ P k ∪ P (next k) ∧ + q ∈ closure (P k) ∧ q ∈ closure (P (next k))) ∧ + (∀ k, IsClosedDisc (Q k) ∧ v ∈ discBd (Q k) ∧ P k ⊆ Q k ∧ (W ∩ Q k) \ discBd (Q k) ⊆ P k) ∧ + (∀ k j, k ≠ j → Q k ∩ Q j ⊆ Γ.U) ∧ + (∀ k (i : halfEdges Γ γ v), i ≠ k → i ≠ next k → ∀ t : I, 0 < t → spoke γ i.1 t ∈ W → + spoke γ i.1 t ∉ Q k) ∧ + (∀ k, W ∩ discBd (Q k) ⊆ Γ.U) ∧ + ∃ τ : halfEdges Γ γ v → I, (∀ k, 0 < τ k) ∧ + (∀ k t, t ≤ τ k → spoke γ k.1 t ∈ discBd (Q k)) ∧ + ∀ k t, t ≤ τ (next k) → spoke γ (next k).1 t ∈ discBd (Q k) := by + classical + have : T2Space S := hS.2.1 + have : Fintype (halfEdges Γ γ v) := (finite_halfEdges Γ γ v).fintype + let H := halfEdges Γ γ v + have hmidE : ∀ x : H, spoke γ x.1 1 ∈ x.1.1 := fun x => + spoke_mem_edge hγ x.2.1 (by simp) + have hmidfin : (range fun x : H => spoke γ x.1 1).Finite := finite_range _ + have hvmid : v ∉ range fun x : H => spoke γ x.1 1 := by + rintro ⟨x, hx⟩ + exact edge_notMem_V x.2.1 (hmidE x) (by rw [show spoke γ x.1 1 = v from hx]; exact hv) + obtain ⟨D, D', hD, hD', hvD', hD'D, hDO, hbdD⟩ := + exists_closedDisc_nbhd hS hmidfin.isClosed.isOpen_compl hvmid + have hDc : IsClosed D := hD.isClosed + have hspoke0 : ∀ x : H, spoke γ x.1 0 = v := fun x => by rw [spoke_zero]; exact x.2.2 + have htrunc : ∀ x : H, ∃ τ : I, 0 < τ ∧ τ < 1 ∧ (∀ t, t < τ → spoke γ x.1 t ∈ D') ∧ + spoke γ x.1 τ ∈ discBd D := fun x => + exists_truncation hγ x.2.1 hDc hD' hD'D hbdD (by rw [hspoke0]; exact hvD') + fun h => hDO h ⟨x, rfl⟩ + choose τ hτ0 hτ1 hτb hτp using htrunc + let J : H → Set S := fun x => spoke γ x.1 '' Icc 0 (τ x) + let p : H → S := fun x => spoke γ x.1 (τ x) + have hbdD' : Disjoint D' (discBd D) := by + rw [← hbdD] + exact Set.disjoint_left.mpr fun x hx hx' => hx'.2 hx + have hvJ : ∀ i, v ∈ J i := fun i => ⟨0, ⟨le_rfl, bot_le⟩, hspoke0 i⟩ + have hline : ∀ i, IsLineWithEnds (J i) v (p i) := fun i => by + have := isLine_spoke_piece hγ i.2.1 (hτ0 i) + rwa [hspoke0] at this + have hbdJ : ∀ i (t : I), t ≤ τ i → spoke γ i.1 t ∈ D := by + intro i t ht + rcases ht.eq_or_lt with rfl | ht + · exact discBd_subset _ (hτp i) + · exact hD'D (hτb i t ht) + have hsub : ∀ i, J i ⊆ D := by + rintro i _ ⟨t, ht, rfl⟩ + exact hbdJ i t ht.2 + have hbd : ∀ i, J i ∩ discBd D = {p i} := by + intro i + ext x + constructor + · rintro ⟨⟨t, ht, rfl⟩, hx⟩ + rcases ht.2.eq_or_lt with rfl | hlt + · rfl + · exact absurd hx (Set.disjoint_left.mp hbdD' (hτb i t hlt)) + · rintro rfl + exact ⟨⟨τ i, ⟨bot_le, le_rfl⟩, rfl⟩, hτp i⟩ + have hJJ : ∀ i j, i ≠ j → J i ∩ J j = {v} := by + intro i j hij + ext x + constructor + · rintro ⟨⟨s, hs, rfl⟩, ⟨t, ht, hst⟩⟩ + by_cases hs0 : 0 < s + · by_cases ht0 : 0 < t + · have hne : i.1 ≠ j.1 := fun h => hij (Subtype.ext h) + have := (spoke_eq_of_ne hγ i.2.1 j.2.1 hne hs0 ht0 hst.symm).1 + have hs1 : s < 1 := lt_of_le_of_lt hs.2 (hτ1 i) + exact absurd this hs1.ne + · have ht' : t = 0 := le_antisymm (not_lt.mp ht0) bot_le + rw [← hst, ht', hspoke0] + rfl + · have hs' : s = 0 := le_antisymm (not_lt.mp hs0) bot_le + rw [hs', hspoke0] + rfl + · rintro rfl + exact ⟨hvJ i, hvJ j⟩ + have hne : ∀ i, v ≠ p i := fun i h => + edge_notMem_V i.2.1 (spoke_mem_edge hγ i.2.1 (hτ0 i)) + (by rw [show spoke γ i.1 (τ i) = v from h.symm]; exact hv) + have hvD : v ∉ discBd D := fun h => Set.disjoint_left.mp hbdD' hvD' h + obtain ⟨next, Q, hF⟩ := exists_fanInv hD hline hsub hbd hJJ hne hvD (Finset.univ : Finset H) + (by rwa [Finset.card_univ, ← Nat.card_eq_fintype_card]) + obtain ⟨K, hKclosed, hvK, hcover⟩ := exists_closed_drawingAwayFromSpokes hγ hv τ hτ0 + have hvJ' : v ∈ ⋃ i, J i := by + obtain ⟨i⟩ : Nonempty H := (Nat.card_pos_iff.mp (lt_of_lt_of_le (by norm_num) h2)).1 + exact mem_iUnion.mpr ⟨i, hvJ i⟩ + have hUsub : Γ.U ⊆ K ∪ ⋃ i, J i := + hcover.trans (union_subset_union_right _ + (union_subset (singleton_subset_iff.mpr hvJ') subset_rfl)) + have hJU : ∀ i, J i ⊆ Γ.U := by + rintro i _ ⟨t, -, rfl⟩ + by_cases ht : 0 < t + · exact Γ.closure_subset_U i.2.1 (subset_closure (spoke_mem_edge hγ i.2.1 ht)) + · have : t = 0 := le_antisymm (not_lt.mp ht) bot_le + rw [this, hspoke0] + exact Γ.V_subset_U hv + obtain ⟨P, W, hW, hvW, hWG, hP⟩ := exists_sector_sets hF (hD'.inter hKclosed.isOpen_compl) + ⟨hvD', hvK⟩ hvJ hKclosed hvK + have hWD' : W ⊆ D' := hWG.trans inter_subset_left + have hWK : Disjoint W K := disjoint_left.mpr fun x hx => (hWG hx).2 + have hWbd : Disjoint W (discBd D) := hbdD'.mono_left hWD' + have hWD : W ⊆ D := hWD'.trans hD'D + obtain ⟨c₁, c₂⟩ := sector_sets_props hF hW hWD hWbd + (fun k hk => (hF.disc k hk).isClosed) + (fun k hk => ⟨(hP k hk).2.2.2.2.1, (hP k hk).2.2.2.2.2⟩) + have mem : ∀ k : H, k ∈ (Finset.univ : Finset H) := Finset.mem_univ + have hiU : (⋃ i ∈ (Finset.univ : Finset H), J i) ⊆ Γ.U := + iUnion₂_subset fun i _ => hJU i + have hvbd : ∀ k, v ∈ discBd (Q k) := by + intro k + obtain ⟨B, -, hb⟩ := hF.bd k (mem k) + exact hb ▸ Or.inl (Or.inl (hvJ k)) + have hdisjU : ∀ k, Disjoint (P k) Γ.U := by + intro k + obtain ⟨-, hPQ, hPbd, hPK, -, -⟩ := hP k (mem k) + refine Set.disjoint_left.mpr fun x hx hxU => ?_ + obtain ⟨B, hBD, hb⟩ := hF.bd k (mem k) + have hxbd : x ∉ discBd (Q k) := Set.disjoint_left.mp hPbd hx + rw [hb] at hxbd + rcases hUsub hxU with hxK | hxJ + · exact Set.disjoint_left.mp hPK hx hxK + · obtain ⟨i, hi⟩ := mem_iUnion.mp hxJ + by_cases hik : i = k + · exact hxbd (Or.inl (Or.inl (hik ▸ hi))) + · by_cases hin : i = next k + · exact hxbd (Or.inl (Or.inr (hin ▸ hi))) + · rcases hF.off k (mem k) i (mem i) hik hin ⟨hi, hPQ hx⟩ with h | h + · have : x = v := h + exact hxbd (Or.inl (Or.inl (this ▸ hvJ k))) + · have := hF.edge k (mem k) ⟨hPQ hx, h⟩ + rw [hb] at this + exact hxbd this + refine ⟨next, P, W, Q, hW, hvW, ?_, fun k => hF.next_ne k (mem k), ?_, fun k => (hP k (mem k)).1, + hdisjU, ?_, ?_, ?_, ?_, ?_, ?_, ?_, τ, hτ0, ?_, ?_⟩ + · intro a b he + exact hF.next_inj a (mem a) b (mem b) he + · intro a b + exact hF.reach a (mem a) b (mem b) + · intro k + exact (hP k (mem k)).2.2.2.2.2 ⟨hvW, hvbd k⟩ + · rintro x ⟨hxW, hxU⟩ + obtain ⟨k, -, hk⟩ := mem_iUnion₂.mp + (c₁ ⟨hxW, fun h => hxU (hiU h)⟩) + exact mem_iUnion.mpr ⟨k, hk⟩ + · intro k + have hl := next k + have hmem := IsLineWithEnds.mem_closure_sdiff (hline (next k)) + obtain ⟨q, hqW, hqJ, hqv⟩ := mem_closure_iff.mp hmem W hW hvW + obtain ⟨t, ht, rfl⟩ := hqJ + have ht0 : 0 < t := by + refine unitInterval.pos_iff_ne_zero.mpr ?_ + rintro rfl + exact hqv (hspoke0 _) + obtain ⟨O, hO, hqO, hsubO, hcl₁, hcl₂⟩ := c₂ k (mem k) _ ⟨hqW, ⟨t, ht, rfl⟩⟩ hqv + exact ⟨_, spoke_mem_edge hγ (next k).2.1 ht0, O, hO, hqO, + fun x hx => hsubO ⟨hx.1, fun h => hx.2 (hiU h)⟩, hcl₁, hcl₂⟩ + · intro k + obtain ⟨-, hPQ, -, -, hsubP, -⟩ := hP k (mem k) + exact ⟨hF.disc k (mem k), hvbd k, hPQ, hsubP⟩ + · intro k j hkj x hx + obtain ⟨i, -, hi⟩ := mem_iUnion₂.mp (hF.inter k (mem k) j (mem j) hkj hx) + exact hJU i hi + · intro k i hik hin t ht hW' hQ + have hmem : spoke γ i.1 t ∈ i.1.1 := spoke_mem_edge hγ i.2.1 ht + have hne : spoke γ i.1 t ≠ v := fun h => edge_notMem_V i.2.1 hmem (by rw [h]; exact hv) + have hWbd : Disjoint W (discBd D) := hbdD'.mono_left hWD' + have hU : spoke γ i.1 t ∈ Γ.U := Γ.closure_subset_U i.2.1 (subset_closure hmem) + rcases hUsub hU with hK | hJ + · exact disjoint_left.mp hWK hW' hK + obtain ⟨i', hi'⟩ := mem_iUnion.mp hJ + have hkey : ∀ j : H, j ≠ i → spoke γ i.1 t ∉ J j := by + rintro j hji ⟨s, hs, hst⟩ + have hs0 : 0 < s := by + refine unitInterval.pos_iff_ne_zero.mpr ?_ + rintro rfl + exact hne (hst.symm.trans (hspoke0 j)) + have hne' : j.1 ≠ i.1 := fun h => hji (Subtype.ext h) + have := (spoke_eq_of_ne hγ j.2.1 i.2.1 hne' hs0 ht hst).1 + exact absurd this (lt_of_le_of_lt hs.2 (hτ1 j)).ne + have hi'i : i' = i := by + by_contra h + exact hkey i' h hi' + subst hi'i + rcases hF.off k (mem k) i' (mem i') hik hin ⟨hi', hQ⟩ with h | h + · exact hne h + · exact disjoint_left.mp hWbd hW' h + · intro k x hx + obtain ⟨B, hB', hb⟩ := hF.bd k (mem k) + rw [hb] at hx + rcases hx.2 with (h | h) | h + · exact hJU _ h + · exact hJU _ h + · exact (disjoint_left.mp hWbd hx.1 (hB' h)).elim + · intro k t ht + obtain ⟨B, -, hb⟩ := hF.bd k (mem k) + rw [hb] + exact Or.inl (Or.inl ⟨t, ⟨bot_le, ht⟩, rfl⟩) + · intro k t ht + obtain ⟨B, -, hb⟩ := hF.bd k (mem k) + rw [hb] + exact Or.inl (Or.inr ⟨t, ⟨bot_le, ht⟩, rfl⟩) + +/-- The cyclic order at a vertex, without the sectors of `exists_rotation_sectors`. -/ +theorem exists_rotation (hS : IsClosedSurface S) + (Γ : Drawing S) {γ : Set S → I → S} (hγ : EdgePar Γ γ) {v : S} + (hv : v ∈ Γ.V) (h2 : 2 ≤ Nat.card (halfEdges Γ γ v)) : + ∃ (next : halfEdges Γ γ v → halfEdges Γ γ v) (P : halfEdges Γ γ v → Set S) (W : Set S), + IsOpen W ∧ v ∈ W ∧ Function.Injective next ∧ (∀ k, next k ≠ k) ∧ + (∀ a b, Relation.ReflTransGen (fun x y => y = next x) a b) ∧ + (∀ k, IsPreconnected (P k)) ∧ (∀ k, Disjoint (P k) Γ.U) ∧ (∀ k, v ∈ closure (P k)) ∧ + (W \ Γ.U ⊆ ⋃ k, P k) ∧ + ∀ k, ∃ q ∈ (next k).1.1, ∃ O, IsOpen O ∧ q ∈ O ∧ O \ Γ.U ⊆ P k ∪ P (next k) ∧ + q ∈ closure (P k) ∧ q ∈ closure (P (next k)) := by + obtain ⟨next, P, W, -, a₁, a₂, a₃, a₄, a₅, a₆, a₇, a₈, a₉, a₁₀, -, -, -, -, -⟩ := + exists_rotation_sectors hS Γ hγ hv h2 + exact ⟨next, P, W, a₁, a₂, a₃, a₄, a₅, a₆, a₇, a₈, a₉, a₁₀⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section3.lean b/LeanPool/GraphMinor/GM11/Section3.lean new file mode 100644 index 0000000000..ce9fab1b3e --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section3.lean @@ -0,0 +1,740 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.TopologyStatements +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +public import Mathlib.Topology.Subpath +public import Mathlib.AlgebraicTopology.FundamentalGroupoid.SimplyConnected +import Mathlib.Analysis.Convex.Contractible +import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# Section 3 of Graph Minors XI: homotopy, and the corrected form of (3.1) + +Statement (3.1) of the paper is false as it stands (see the correction to (3.1) in +`corrections/GM11.md`). This file proves `theorem_3_1`, which adds one local hypothesis, +`IsLocalDeformationRetract`. + +The proof follows the paper. It looks at the times when `φ` leaves `Y`, and on those intervals it +replaces `φ` by a path in `X ∩ Y`, using that `X` is simply-connected. The paper does this for all +of the infinitely many intervals at once, and that is the gap. We cut the circle into finitely many +pieces instead. On a piece that stays near one point of `X ∩ Y`, the local hypothesis pushes all +excursions of `φ` into `X ∩ Y` in one step. The remaining pieces are either in `Y` already, or are +single excursions in `X`, which are handled as in the paper. + +The file also gives the tools on loops that this needs: a map from `[0, 1]` that agrees at the ends +gives a map from the circle (`loopLift`), and in a simply-connected set any two paths with the same +ends are homotopic (`IsSimplyConnectedSet.pathsHomotopic`). +-/ + +public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u v + +/-! ## The circle as a quotient of `[0, 1]` -/ + +/-- The map `[0, 1] → S¹` that winds once around the circle, starting at `z`. -/ +noncomputable def arcParam (z : Circle) : C(I, Circle) := + ⟨fun t => z * Circle.exp (2 * Real.pi * t), by fun_prop⟩ + +theorem arcParam_apply (z : Circle) (t : I) : arcParam z t = z * Circle.exp (2 * Real.pi * t) := by + simp [arcParam] + +@[simp] theorem arcParam_zero (z : Circle) : arcParam z 0 = z := by + simp [arcParam] + +@[simp] theorem arcParam_one (z : Circle) : arcParam z 1 = z := by + simp [arcParam, Circle.exp_two_pi] + +theorem arcParam_surjective (z : Circle) : Function.Surjective (arcParam z) := by + intro w + set θ : ℝ := Complex.arg (z⁻¹ * w : Circle) with hθ + have hexp : Circle.exp θ = z⁻¹ * w := Circle.exp_arg _ + have hlo : -Real.pi < θ := Complex.neg_pi_lt_arg _ + have hhi : θ ≤ Real.pi := Complex.arg_le_pi _ + have hpi := Real.pi_pos + by_cases h : 0 ≤ θ + · refine ⟨⟨θ / (2 * Real.pi), by positivity, ?_⟩, ?_⟩ + · rw [div_le_one (by positivity)] + linarith + · have : 2 * Real.pi * (θ / (2 * Real.pi)) = θ := by field_simp + simp [arcParam, this, hexp] + · push Not at h + refine ⟨⟨θ / (2 * Real.pi) + 1, ?_, ?_⟩, ?_⟩ + · have : -1 ≤ θ / (2 * Real.pi) := by + rw [le_div_iff₀ (by positivity)] + linarith + linarith + · have : θ / (2 * Real.pi) ≤ 0 := div_nonpos_of_nonpos_of_nonneg h.le (by positivity) + linarith + · have : 2 * Real.pi * (θ / (2 * Real.pi) + 1) = θ + 2 * Real.pi := by field_simp + simp [arcParam, this, Circle.exp_add, Circle.exp_two_pi, hexp] + +/-- Two parameters with the same image are equal, or they are the two ends of `[0, 1]`. -/ +theorem arcParam_eq_iff (z : Circle) {s t : I} (h : arcParam z s = arcParam z t) : + s = t ∨ (s = 0 ∧ t = 1) ∨ (s = 1 ∧ t = 0) := by + have h' : Circle.exp (2 * Real.pi * s) = Circle.exp (2 * Real.pi * t) := + mul_left_cancel (a := z) h + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h' + have hpi := Real.pi_pos + have hst : (s : ℝ) = t + m := by + have : 2 * Real.pi * ((s : ℝ) - t - m) = 0 := by linarith + have := (mul_eq_zero.mp this).resolve_left (by positivity) + linarith + have hs0 := s.2.1 + have hs1 := s.2.2 + have ht0 := t.2.1 + have ht1 := t.2.2 + have hmle : (m : ℝ) ≤ 1 := by linarith + have hmge : (-1 : ℝ) ≤ m := by linarith + have h1 : m ≤ 1 := by exact_mod_cast hmle + have h2 : -1 ≤ m := by exact_mod_cast hmge + have hm3 : m = 0 ∨ m = 1 ∨ m = -1 := by omega + rcases hm3 with rfl | rfl | rfl + · left + exact Subtype.ext (by simpa using hst) + · right; right + simp only [Int.cast_one] at hst + exact ⟨Subtype.ext (show (s : ℝ) = 1 by linarith), Subtype.ext (show (t : ℝ) = 0 by linarith)⟩ + · right; left + simp only [Int.cast_neg, Int.cast_one] at hst + exact ⟨Subtype.ext (show (s : ℝ) = 0 by linarith), Subtype.ext (show (t : ℝ) = 1 by linarith)⟩ + +theorem isQuotientMap_arcParam (z : Circle) : IsQuotientMap (arcParam z) := + (arcParam z).continuous.isClosedMap.isQuotientMap (arcParam z).continuous + (arcParam_surjective z) + +theorem isQuotientMap_arcParam_prod (z : Circle) : + IsQuotientMap ((arcParam z).prodMap (ContinuousMap.id I)) := by + have hc := ((arcParam z).prodMap (ContinuousMap.id I)).continuous + exact hc.isClosedMap.isQuotientMap hc ((arcParam_surjective z).prodMap Function.surjective_id) + +private theorem loop_factors {T : Type*} (z : Circle) (f : I → T) (h : f 0 = f 1) : + Function.FactorsThrough f (arcParam z) := by + intro a b hab + rcases arcParam_eq_iff z hab with rfl | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · exact h + · exact h.symm + +private theorem cylinder_factors {T : Type*} (z : Circle) (F : I × I → T) + (h : ∀ v, F (0, v) = F (1, v)) : + Function.FactorsThrough F ((arcParam z).prodMap (ContinuousMap.id I)) := by + rintro ⟨a, u⟩ ⟨b, v⟩ hab + have h₁ : arcParam z a = arcParam z b := (Prod.ext_iff.mp hab).1 + have h₂ : u = v := (Prod.ext_iff.mp hab).2 + subst h₂ + rcases arcParam_eq_iff z h₁ with rfl | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · exact h u + · exact (h u).symm + +/-- A map from `[0, 1]` that agrees at the two ends, seen as a map from the circle. -/ +noncomputable def loopLift {T : Type*} [TopologicalSpace T] (z : Circle) (f : C(I, T)) + (h : f 0 = f 1) : C(Circle, T) := + (isQuotientMap_arcParam z).lift f (loop_factors z f h) + +@[simp] theorem loopLift_apply {T : Type*} [TopologicalSpace T] (z : Circle) (f : C(I, T)) + (h : f 0 = f 1) (t : I) : loopLift z f h (arcParam z t) = f t := + DFunLike.congr_fun ((isQuotientMap_arcParam z).lift_comp f (loop_factors z f h)) t + +/-- A map from `[0, 1] × [0, 1]` that agrees on the left and right sides, seen as a map from the +cylinder. -/ +noncomputable def cylinderLift {T : Type*} [TopologicalSpace T] (z : Circle) (F : C(I × I, T)) + (h : ∀ v, F (0, v) = F (1, v)) : C(Circle × I, T) := + (isQuotientMap_arcParam_prod z).lift F (cylinder_factors z F h) + +@[simp] theorem cylinderLift_apply {T : Type*} [TopologicalSpace T] (z : Circle) (F : C(I × I, T)) + (h : ∀ v, F (0, v) = F (1, v)) (t v : I) : + cylinderLift z F h (arcParam z t, v) = F (t, v) := + DFunLike.congr_fun ((isQuotientMap_arcParam_prod z).lift_comp F (cylinder_factors z F h)) + (t, v) + +/-! ## Paths and homotopy -/ + +section Paths + +variable {T : Type*} [TopologicalSpace T] + +/-- A square with sides `pb, pr, pl, pt` gives a homotopy between `pb + pr` and `pl + pt`. The +square is simply-connected, and the homotopy there is mapped forward. -/ +theorem homotopic_of_square {a b c d : T} (F : C(I × I, T)) (pb : Path a b) (pr : Path b d) + (pl : Path a c) (pt : Path c d) (hb : ∀ s, F (s, 0) = pb s) (hr : ∀ v, F (1, v) = pr v) + (hl : ∀ v, F (0, v) = pl v) (ht : ∀ s, F (s, 1) = pt s) : + (pb.trans pr).Homotopic (pl.trans pt) := by + obtain rfl : F (0, 0) = a := by simpa using hb 0 + obtain rfl : F (1, 0) = b := by simpa using hb 1 + obtain rfl : F (0, 1) = c := by simpa using hl 1 + obtain rfl : F (1, 1) = d := by simpa using hr 1 + have : ContractibleSpace I := (convex_Icc (0 : ℝ) 1).contractibleSpace ⟨0, by simp⟩ + let idp : Path (0 : I) 1 := ⟨ContinuousMap.id I, rfl, rfl⟩ + let bottom : Path ((0, 0) : I × I) (1, 0) := idp.prod (Path.refl 0) + let right : Path ((1, 0) : I × I) (1, 1) := (Path.refl 1).prod idp + let left : Path ((0, 0) : I × I) (0, 1) := (Path.refl 0).prod idp + let top : Path ((0, 1) : I × I) (1, 1) := idp.prod (Path.refl 1) + have h := (SimplyConnectedSpace.paths_homotopic (bottom.trans right) (left.trans top)).map F + rw [Path.map_trans, Path.map_trans] at h + have e₁ : bottom.map F.continuous = pb := Path.ext (funext fun s => hb s) + have e₂ : right.map F.continuous = pr := Path.ext (funext fun s => hr s) + have e₃ : left.map F.continuous = pl := Path.ext (funext fun s => hl s) + have e₄ : top.map F.continuous = pt := Path.ext (funext fun s => ht s) + rwa [e₁, e₂, e₃, e₄] at h + +/-- A loop is homotopic to the constant loop if there is a square with the loop at the bottom, a +constant top side, and the same path on the left and on the right. -/ +theorem loop_homotopic_refl {a c : T} (γ : Path a a) (F : C(I × I, T)) + (hb : ∀ s, F (s, 0) = γ s) (hlr : ∀ v, F (0, v) = F (1, v)) (ht : ∀ s, F (s, 1) = c) : + γ.Homotopic (Path.refl a) := by + have h0 : F (0, 0) = a := by simpa using hb 0 + have h1 : F (0, 1) = c := ht 0 + let β : Path a c := ⟨⟨fun v => F (0, v), by fun_prop⟩, h0, h1⟩ + have h := homotopic_of_square F γ β β (Path.refl c) hb (fun v => (hlr v).symm) (fun _ => rfl) + (fun s => by simpa using ht s) + have e₁ : γ.Homotopic ((γ.trans β).trans β.symm) := + (Path.Homotopic.trans_refl γ).symm.trans + (((Path.Homotopic.refl γ).hcomp (Path.Homotopic.trans_symm β)).symm.trans + (Path.Homotopic.trans_assoc γ β β.symm).symm) + exact e₁.trans ((h.hcomp (Path.Homotopic.refl β.symm)).trans + (((Path.Homotopic.trans_refl β).hcomp (Path.Homotopic.refl β.symm)).trans + (Path.Homotopic.trans_symm β))) + +/-- If every loop is homotopic to a constant loop then any two paths with the same ends are +homotopic. -/ +theorem paths_homotopic_of_loops (hl : ∀ (a : T) (γ : Path a a), γ.Homotopic (Path.refl a)) + {a b : T} (p q : Path a b) : p.Homotopic q := + (Path.Homotopic.trans_refl p).symm.trans + (((Path.Homotopic.refl p).hcomp (Path.Homotopic.symm_trans q)).symm.trans + ((Path.Homotopic.trans_assoc p q.symm q).symm.trans + (((hl a (p.trans q.symm)).hcomp (Path.Homotopic.refl q)).trans + (Path.Homotopic.refl_trans q)))) + +end Paths + +section Sets + +variable {S : Type u} [TopologicalSpace S] + +/-- In a simply-connected set, any two paths with the same ends are homotopic. This is the fact +that the proof of (3.1) calls on when it says that a path in `X` is homotopic in `X` to a path in +`X ∩ Y` with the same ends. -/ +theorem _root_.GraphMinor.Surface.IsSimplyConnectedSet.pathsHomotopic {X : Set S} + (hX : IsSimplyConnectedSet X) {a b : X} + (p q : Path a b) : p.Homotopic q := by + refine paths_homotopic_of_loops (fun a γ => ?_) p q + let f : C(I, S) := ⟨fun t => (γ t).1, by fun_prop⟩ + have hf : f 0 = f 1 := by simp [f] + have hr : range (loopLift 1 f hf) ⊆ X := by + rintro _ ⟨w, rfl⟩ + obtain ⟨t, rfl⟩ := arcParam_surjective 1 w + rw [loopLift_apply] + exact (γ t).2 + obtain ⟨c, hc, ψ, hψ, h0, h1⟩ := hX.2 _ hr + let F : C(I × I, X) := + ⟨fun p => ⟨ψ (arcParam 1 p.1, p.2), hψ _⟩, by + refine Continuous.subtype_mk (ψ.continuous.comp ?_) _ + exact ((arcParam 1).continuous.comp continuous_fst).prodMk continuous_snd⟩ + refine loop_homotopic_refl (c := ⟨c, hc⟩) γ F (fun s => ?_) (fun v => ?_) (fun s => ?_) + · apply Subtype.ext + simp only [F, ContinuousMap.coe_mk] + rw [h0, loopLift_apply] + rfl + · apply Subtype.ext + simp [F] + · apply Subtype.ext + simp only [F, ContinuousMap.coe_mk] + rw [h1] + rfl + +/-- A path in a set `Z` that stays in a subset of `Z`, seen as a path in the subset. -/ +private def pathRestrict {Z W : Set S} {a b : Z} (p : Path a b) (ha : a.1 ∈ W) (hb : b.1 ∈ W) + (h : ∀ u, (p u).1 ∈ W) : Path (⟨a.1, ha⟩ : W) ⟨b.1, hb⟩ where + toFun u := ⟨(p u).1, h u⟩ + continuous_toFun := by fun_prop + source' := by simp + target' := by simp + +/-- A path in `S` that stays in `Z`, seen as a path in `Z`. -/ +@[expose] def pathCod {Z : Set S} {a b : S} (p : Path a b) (ha : a ∈ Z) (hb : b ∈ Z) + (h : ∀ u, p u ∈ Z) : Path (⟨a, ha⟩ : Z) ⟨b, hb⟩ where + toFun u := ⟨p u, h u⟩ + continuous_toFun := by fun_prop + source' := by simp + target' := by simp + +/-- Two paths of `Z` that stay in the simply-connected set `X ⊆ Z` are homotopic in `Z`. -/ +theorem homotopic_of_mem {X Z : Set S} (hX : IsSimplyConnectedSet X) (hXZ : X ⊆ Z) + {a b : Z} (p q : Path a b) (ha : a.1 ∈ X) (hb : b.1 ∈ X) (hp : ∀ u, (p u).1 ∈ X) + (hq : ∀ u, (q u).1 ∈ X) : p.Homotopic q := by + have h := (hX.pathsHomotopic (pathRestrict p ha hb hp) (pathRestrict q ha hb hq)).map + (f := (⟨inclusion hXZ, continuous_inclusion hXZ⟩ : C(X, Z))) + have e₁ : (pathRestrict p ha hb hp).map + (⟨inclusion hXZ, continuous_inclusion hXZ⟩ : C(X, Z)).continuous = p := by + ext u + rfl + have e₂ : (pathRestrict q ha hb hq).map + (⟨inclusion hXZ, continuous_inclusion hXZ⟩ : C(X, Z)).continuous = q := by + ext u + rfl + rwa [e₁, e₂] at h + +end Sets + +/-! ## The local hypothesis, and the proof of (3.1) -/ + +variable {S : Type u} [TopologicalSpace S] + +/-- The local hypothesis of the corrected (3.1). Each point `y` of `L` has an open neighbourhood `A` +such that `X ∩ A` can be deformed in `X` into `L`, with the points of `L ∩ A` kept fixed. + +For example this holds when `X` is a closed disc and `L` its boundary, see +`IsClosedDisc.isLocalDeformationRetract`. It also holds for any `L ⊆ X` for which `X` and `L` look +like cones with one apex near each point of `L`, so for finite unions of points, lines and closed +discs that are drawn in a tame way. -/ +def IsLocalDeformationRetract (X L : Set S) : Prop := + ∀ y ∈ L, ∃ A : Set S, IsOpen A ∧ y ∈ A ∧ ∃ h : C((X ∩ A : Set S) × I, S), + (∀ p, h p ∈ X) ∧ (∀ x, h (x, 0) = x.1) ∧ (∀ x, h (x, 1) ∈ L) ∧ + ∀ x t, x.1 ∈ L → h (x, t) = x.1 + +section Push + +variable {X Y : Set S} + +/-- The subpath of `p` from time `s` to time `t` is homotopic to a path in `Y`. -/ +private def Pushes {a b : (X ∪ Y : Set S)} (p : Path a b) (s t : I) : Prop := + ∃ q : Path (p s) (p t), (p.subpath s t).Homotopic q ∧ ∀ u, (q u).1 ∈ Y + +private theorem Pushes.trans {a b : (X ∪ Y : Set S)} {p : Path a b} {s t r : I} + (h₁ : Pushes p s t) (h₂ : Pushes p t r) : Pushes p s r := by + obtain ⟨q₁, h₁, hq₁⟩ := h₁ + obtain ⟨q₂, h₂, hq₂⟩ := h₂ + refine ⟨q₁.trans q₂, ((Path.Homotopic.subpath_trans_subpath p s t r).symm).trans + (h₁.hcomp h₂), fun u => ?_⟩ + obtain ⟨v, hv | hv⟩ : ∃ v, (q₁.trans q₂) u = q₁ v ∨ (q₁.trans q₂) u = q₂ v := by + have : (q₁.trans q₂) u ∈ range q₁ ∪ range q₂ := by + rw [← Path.trans_range] + exact mem_range_self u + rcases this with ⟨v, hv⟩ | ⟨v, hv⟩ + · exact ⟨v, Or.inl hv.symm⟩ + · exact ⟨v, Or.inr hv.symm⟩ + · rw [hv]; exact hq₁ v + · rw [hv]; exact hq₂ v + +private theorem pushes_refl {a b : (X ∪ Y : Set S)} (p : Path a b) (s : I) (hs : (p s).1 ∈ Y) : + Pushes p s s := by + refine ⟨Path.refl _, ?_, fun _ => hs⟩ + rw [Path.subpath_self] + +/-- A piece of `p` that stays in `Y` already. -/ +private theorem pushes_of_mem {a b : (X ∪ Y : Set S)} (p : Path a b) {s t : I} (hst : s ≤ t) + (h : ∀ u ∈ Icc s t, (p u).1 ∈ Y) : Pushes p s t := by + refine ⟨p.subpath s t, Path.Homotopic.refl _, fun u => ?_⟩ + have : (p.subpath s t) u ∈ p '' uIcc s t := by + rw [← Path.range_subpath] + exact mem_range_self u + obtain ⟨v, hv, hv'⟩ := this + rw [uIcc_of_le hst] at hv + rw [← hv'] + exact h v hv + +/-- A single excursion of `p` in `X`, with ends in `Y`: this is the step of the paper. The path is +homotopic in `X` to a path in `X ∩ Y` with the same ends, since `X` is simply-connected and `X ∩ Y` +is arc-wise connected. -/ +private theorem pushes_of_excursion (hX : IsClosed X) (hsc : IsSimplyConnectedSet X) + (hL : IsPathConnected (X ∩ Y)) {a b : (X ∪ Y : Set S)} (p : Path a b) {s t : I} (hst : s ≤ t) + (hs : (p s).1 ∈ Y) (ht : (p t).1 ∈ Y) (hout : ∀ u ∈ Ioo s t, (p u).1 ∉ Y) : Pushes p s t := by + rcases hst.eq_or_lt with rfl | hlt + · exact pushes_refl p s hs + have hclosed : IsClosed {u : I | (p u).1 ∈ X} := + hX.preimage (continuous_subtype_val.comp p.continuous) + have hin : ∀ u ∈ Ioo s t, (p u).1 ∈ X := fun u hu => + ((p u).2).resolve_right (hout u hu) + have hcl : Icc s t ⊆ {u : I | (p u).1 ∈ X} := by + rw [← closure_Ioo hlt.ne] + exact closure_minimal hin hclosed + have hsX : (p s).1 ∈ X := hcl ⟨le_rfl, hst⟩ + have htX : (p t).1 ∈ X := hcl ⟨hst, le_rfl⟩ + obtain ⟨c, hc⟩ := hL.joinedIn _ ⟨hsX, hs⟩ _ ⟨htX, ht⟩ + let Z : Set S := X ∪ Y + let r : Path (p s) (p t) := pathCod c (p s).2 (p t).2 fun u => Or.inl (hc u).1 + refine ⟨r, ?_, fun u => (hc u).2⟩ + refine homotopic_of_mem hsc subset_union_left _ _ hsX htX (fun u => ?_) (fun u => (hc u).1) + have : (p.subpath s t) u ∈ p '' uIcc s t := by + rw [← Path.range_subpath] + exact mem_range_self u + obtain ⟨v, hv, hv'⟩ := this + rw [uIcc_of_le hst] at hv + rw [← hv'] + exact hcl hv + +/-- A piece of `p` near one point of `X ∩ Y`, with ends in `Y`. The local deformation is applied to +the points of the piece in `X`, and the points in `Y` stay fixed. -/ +private theorem pushes_of_local (hX : IsClosed X) (hY : IsClosed Y) {a b : (X ∪ Y : Set S)} + (p : Path a b) {s t : I} (hst : s ≤ t) (hs : (p s).1 ∈ Y) (ht : (p t).1 ∈ Y) {A : Set S} + (hA : ∀ u ∈ Icc s t, (p u).1 ∈ A) (h : C((X ∩ A : Set S) × I, S)) + (h₁ : ∀ p, h p ∈ X) (h₂ : ∀ x, h (x, 0) = x.1) (h₃ : ∀ x, h (x, 1) ∈ X ∩ Y) + (h₄ : ∀ x t, x.1 ∈ X ∩ Y → h (x, t) = x.1) : Pushes p s t := by + classical + let r := p.subpath s t + have hrA : ∀ u, (r u).1 ∈ A := by + intro u + have : r u ∈ p '' uIcc s t := by + rw [← Path.range_subpath] + exact mem_range_self u + obtain ⟨v, hv, hv'⟩ := this + rw [uIcc_of_le hst] at hv + rw [← hv'] + exact hA v hv + let G : I × I → S := fun q => + if hq : (r q.2).1 ∈ X then h (⟨(r q.2).1, hq, hrA _⟩, q.1) else (r q.2).1 + have hGX : ∀ q, (r q.2).1 ∈ X → G q ∈ X := by + intro q hq + simp only [G, dite_eq_left hq] + exact h₁ _ + have hcont : Continuous G := by + have hc₁ : IsClosed {q : I × I | (r q.2).1 ∈ X} := + hX.preimage (by fun_prop) + have hc₂ : IsClosed {q : I × I | (r q.2).1 ∈ Y} := + hY.preimage (by fun_prop) + have hun : {q : I × I | (r q.2).1 ∈ X} ∪ {q : I × I | (r q.2).1 ∈ Y} = univ := + eq_univ_of_forall fun q => (r q.2).2 + rw [← continuousOn_univ, ← hun] + refine ContinuousOn.union_of_isClosed ?_ ?_ hc₁ hc₂ + · rw [continuousOn_iff_continuous_domRestrict] + have : ({q : I × I | (r q.2).1 ∈ X}.domRestrict G) = fun q => + h (⟨(r q.1.2).1, q.2, hrA _⟩, q.1.1) := + funext fun q => dite_eq_left q.2 + rw [this] + exact h.continuous.comp (Continuous.prodMk (by fun_prop) (by fun_prop)) + · have heq : EqOn G (fun q => (r q.2).1) {q : I × I | (r q.2).1 ∈ Y} := by + intro q hq + by_cases hqX : (r q.2).1 ∈ X + · simp only [G, dite_eq_left hqX] + exact h₄ _ _ ⟨hqX, hq⟩ + · simp only [G, dite_eq_right hqX] + exact (Continuous.continuousOn (by fun_prop)).congr heq + have hZ : ∀ q, G q ∈ X ∪ Y := by + intro q + by_cases hq : (r q.2).1 ∈ X + · exact Or.inl (hGX q hq) + · right + simp only [G, dite_eq_right hq] + exact (r q.2).2.resolve_left hq + have hend : ∀ (v : I) (u : I), (r u).1 ∈ Y → G (v, u) = (r u).1 := by + intro v u hu + by_cases hq : (r u).1 ∈ X + · simp only [G, dite_eq_left hq] + exact h₄ _ _ ⟨hq, hu⟩ + · simp only [G, dite_eq_right hq] + have hr0 : (r 0).1 ∈ Y := by simpa [r] using hs + have hr1 : (r 1).1 ∈ Y := by simpa [r] using ht + let F : C(I × I, (X ∪ Y : Set S)) := ⟨fun q => ⟨G q, hZ q⟩, hcont.subtype_mk _⟩ + have F0 : ∀ u, F (0, u) = r u := by + intro u + apply Subtype.ext + by_cases hq : (r u).1 ∈ X + · simp only [F, G, ContinuousMap.coe_mk, dite_eq_left hq] + exact h₂ _ + · simp only [F, G, ContinuousMap.coe_mk, dite_eq_right hq] + let q : Path (p s) (p t) := + { toFun := fun u => F (1, u) + continuous_toFun := by fun_prop + source' := by + apply Subtype.ext + have : (r 0).1 = (p s).1 := by simp [r] + simp only [F, ContinuousMap.coe_mk] + rw [hend 1 0 hr0, this] + target' := by + apply Subtype.ext + have : (r 1).1 = (p t).1 := by simp [r] + simp only [F, ContinuousMap.coe_mk] + rw [hend 1 1 hr1, this] } + have hH : r.Homotopic q := by + refine ⟨⟨⟨F, F0, fun u => rfl⟩, ?_⟩⟩ + rintro v u (rfl | hu) + · apply Subtype.ext + change G (v, 0) = (r 0).1 + exact hend v 0 hr0 + · obtain rfl : u = 1 := hu + apply Subtype.ext + change G (v, 1) = (r 1).1 + exact hend v 1 hr1 + refine ⟨q, hH, fun u => ?_⟩ + by_cases hq : (r u).1 ∈ X + · change G (1, u) ∈ Y + simp only [G, dite_eq_left hq] + exact (h₃ _).2 + · change G (1, u) ∈ Y + simp only [G, dite_eq_right hq] + exact (r u).2.resolve_left hq + +/-- Each path of `X ∪ Y` with ends in `Y` is homotopic in `X ∪ Y`, with its ends fixed, to a path in +`Y`. See the module docstring for the structure of the proof. -/ +theorem exists_homotopic_path (hX : IsClosed X) (hY : IsClosed Y) (hsc : IsSimplyConnectedSet X) + (hL : IsPathConnected (X ∩ Y)) (hloc : IsLocalDeformationRetract X (X ∩ Y)) + {a b : (X ∪ Y : Set S)} (p : Path a b) (ha : a.1 ∈ Y) (hb : b.1 ∈ Y) : + ∃ q : Path a b, p.Homotopic q ∧ ∀ u, (q u).1 ∈ Y := by + -- The good open subsets of `[0, 1]`: their points stay out of `Y`, or out of `X`, or near one + -- point of `X ∩ Y` where the local hypothesis applies. + let good : Set I → Prop := fun O => IsOpen O ∧ ((∀ u ∈ O, (p u).1 ∉ Y) ∨ (∀ u ∈ O, (p u).1 ∉ X) ∨ + ∃ A : Set S, (∀ u ∈ O, (p u).1 ∈ A) ∧ ∃ h : C((X ∩ A : Set S) × I, S), + (∀ p, h p ∈ X) ∧ (∀ x, h (x, 0) = x.1) ∧ (∀ x, h (x, 1) ∈ X ∩ Y) ∧ + ∀ x t, x.1 ∈ X ∩ Y → h (x, t) = x.1) + have hcont : Continuous fun u : I => (p u).1 := by fun_prop + have hcover : (univ : Set I) ⊆ ⋃ O : {O : Set I // good O}, O.1 := by + intro u _ + by_cases huY : (p u).1 ∈ Y + · by_cases huX : (p u).1 ∈ X + · obtain ⟨A, hAo, huA, h, h₁, h₂, h₃, h₄⟩ := hloc _ ⟨huX, huY⟩ + exact mem_iUnion.mpr ⟨⟨_, hAo.preimage hcont, Or.inr (Or.inr ⟨A, fun _ h + => h, h, h₁, h₂, h₃, + h₄⟩)⟩, huA⟩ + · exact mem_iUnion.mpr ⟨⟨_, hX.isOpen_compl.preimage hcont, + Or.inr (Or.inl fun _ h => h)⟩, huX⟩ + · exact mem_iUnion.mpr ⟨⟨_, hY.isOpen_compl.preimage hcont, Or.inl fun _ h => h⟩, huY⟩ + obtain ⟨t, ht0, htmono, ⟨n₀, hn₀⟩, htO⟩ := exists_monotone_Icc_subset_open_cover_unitInterval + (fun O : {O : Set I // good O} => O.2.1) hcover + have hclosedY : IsClosed {u : I | (p u).1 ∈ Y} := hY.preimage hcont + have h0Y : (p 0).1 ∈ Y := by simpa using ha + have h1Y : (p 1).1 ∈ Y := by simpa using hb + have key : ∀ n, ∃ u, u ≤ t n ∧ (p u).1 ∈ Y ∧ (∀ w, u < w → w ≤ t n → (p w).1 ∉ Y) ∧ + Pushes p 0 u := by + intro n + induction n with + | zero => + refine ⟨0, by rw [ht0], h0Y, fun w hw hw' => ?_, pushes_refl p 0 h0Y⟩ + rw [ht0] at hw' + exact absurd hw (not_lt.mpr hw') + | succ n ih => + obtain ⟨u, hu, huY, hout, hpu⟩ := ih + have hle : t n ≤ t (n + 1) := htmono (Nat.le_succ n) + by_cases hne : ({u : I | (p u).1 ∈ Y} ∩ Icc (t n) (t (n + 1))).Nonempty + · have hC : IsCompact ({u : I | (p u).1 ∈ Y} ∩ Icc (t n) (t (n + 1))) := + isCompact_Icc.inter_left hclosedY + obtain ⟨c, hc, hcle⟩ := hC.exists_isLeast hne + obtain ⟨d, hd, hdle⟩ := hC.exists_isGreatest hne + have hcd : c ≤ d := hdle hc + have huc : u ≤ c := hu.trans hc.2.1 + have hstep₁ : Pushes p u c := by + refine pushes_of_excursion hX hsc hL p huc huY hc.1 fun w hw hwY => ?_ + by_cases hwn : w ≤ t n + · exact hout w hw.1 hwn hwY + · push Not at hwn + have : c ≤ w := hcle ⟨hwY, hwn.le, hw.2.le.trans hc.2.2⟩ + exact absurd hw.2 (not_lt.mpr this) + obtain ⟨⟨O, hOo, hO⟩, hsub⟩ := htO n + have hstep₂ : Pushes p c d := by + rcases hO with hO | hO | ⟨A, hA, h, h₁, h₂, h₃, h₄⟩ + · exact absurd hc.1 (hO c (hsub hc.2)) + · refine pushes_of_mem p hcd fun w hw => ?_ + exact (p w).2.resolve_left (hO w (hsub ⟨hc.2.1.trans hw.1, hw.2.trans hd.2.2⟩)) + · refine pushes_of_local hX hY p hcd hc.1 hd.1 (fun w hw => ?_) h h₁ h₂ h₃ h₄ + exact hA w (hsub ⟨hc.2.1.trans hw.1, hw.2.trans hd.2.2⟩) + refine ⟨d, hd.2.2, hd.1, fun w hw hw' hwY => ?_, (hpu.trans hstep₁).trans hstep₂⟩ + have : w ≤ d := hdle ⟨hwY, hc.2.1.trans (hcd.trans hw.le), hw'⟩ + exact absurd hw (not_lt.mpr this) + · refine ⟨u, hu.trans hle, huY, fun w hw hw' hwY => ?_, hpu⟩ + by_cases hwn : w ≤ t n + · exact hout w hw hwn hwY + · push Not at hwn + exact hne ⟨w, hwY, hwn.le, hw'⟩ + obtain ⟨u, -, -, hout, hpu⟩ := key n₀ + have hu1 : u = 1 := by + by_contra hne + exact hout 1 (lt_of_le_of_ne le_top hne) (by rw [hn₀ n₀ le_rfl]) h1Y + subst hu1 + obtain ⟨q, hq, hqY⟩ := hpu + rw [Path.subpath_zero_one] at hq + refine ⟨q.cast p.source.symm p.target.symm, ?_, fun w => ?_⟩ + · have e : (p.cast p.source p.target).cast p.source.symm p.target.symm = p := by + ext w + simp + have h := Path.Homotopic.pathCast hq p.source.symm p.target.symm + rwa [e] at h + · simpa using hqY w + +end Push + +/-- A homotopy in `Z` from `φ` to `φ'`, read on `[0, 1] × [0, 1]`, gives closed curves homotopic in +`Z`. -/ +theorem closedCurvesHomotopicIn_of_path {Z : Set S} {a : Z} (z : Circle) (φ φ' : C(Circle, S)) + (p q : Path a a) (hp : ∀ t, (p t).1 = φ (arcParam z t)) (hq : ∀ t, (q t).1 = φ' (arcParam z t)) + (h : p.Homotopic q) : ClosedCurvesHomotopicIn Z φ φ' := by + obtain ⟨H⟩ := h + let F : C(I × I, S) := ⟨fun w => (H (w.2, w.1)).1, by fun_prop⟩ + have hlr : ∀ v, F (0, v) = F (1, v) := by + intro v + have h0 : H (v, 0) = p 0 := H.eq_fst v (by simp) + have h1 : H (v, 1) = p 1 := H.eq_fst v (by simp) + simp [F, h0, h1] + refine ⟨cylinderLift z F hlr, ?_, ?_, ?_⟩ + · rintro ⟨w, v⟩ + obtain ⟨t, rfl⟩ := arcParam_surjective z w + rw [cylinderLift_apply] + exact (H (v, t)).2 + · intro w + obtain ⟨t, rfl⟩ := arcParam_surjective z w + rw [cylinderLift_apply, ← hp] + simp [F] + · intro w + obtain ⟨t, rfl⟩ := arcParam_surjective z w + rw [cylinderLift_apply, ← hq] + simp [F] + +/-- A homotopy in `Z` is a homotopy in any larger set. -/ +theorem _root_.GraphMinor.Surface.ClosedCurvesHomotopicIn.mono {Z Z' : Set S} + (hZ : Z ⊆ Z') {φ₀ φ₁ : C(Circle, S)} + (h : ClosedCurvesHomotopicIn Z φ₀ φ₁) : ClosedCurvesHomotopicIn Z' φ₀ φ₁ := by + obtain ⟨ψ, h₁, h₂⟩ := h + exact ⟨ψ, fun p => hZ (h₁ p), h₂⟩ + +/-- The last step of (3.1). If each path of `X ∪ Y` with ends in `Y` is homotopic, with its ends +fixed, to a +path in `Y`, then each closed curve in `X ∪ Y` is homotopic in `X ∪ Y` to a closed curve in `Y`. -/ +theorem exists_push_of_paths {X Y : Set S} (hsc : IsSimplyConnectedSet X) (hL : IsPathConnected + (X ∩ Y)) + (hpath : ∀ {a b : (X ∪ Y : Set S)} (p : Path a b), a.1 ∈ Y → b.1 ∈ Y → + ∃ q : Path a b, p.Homotopic q ∧ ∀ u, (q u).1 ∈ Y) + (φ : C(Circle, S)) (hφ : range φ ⊆ X ∪ Y) : + ∃ φ' : C(Circle, S), range φ' ⊆ Y ∧ ClosedCurvesHomotopicIn (X ∪ Y) φ φ' := by + by_cases hin : ∃ z, φ z ∈ Y + · obtain ⟨z, hz⟩ := hin + let a : (X ∪ Y : Set S) := ⟨φ z, Or.inr hz⟩ + let p : Path a a := + { toFun := fun t => ⟨φ (arcParam z t), hφ (mem_range_self _)⟩ + continuous_toFun := by fun_prop + source' := by simp [a] + target' := by simp [a] } + obtain ⟨q, hpq, hqY⟩ := hpath p hz hz + let f : C(I, S) := ⟨fun t => (q t).1, by fun_prop⟩ + have hf : f 0 = f 1 := by simp [f] + refine ⟨loopLift z f hf, ?_, ?_⟩ + · rintro _ ⟨w, rfl⟩ + obtain ⟨t, rfl⟩ := arcParam_surjective z w + rw [loopLift_apply] + exact hqY t + · exact closedCurvesHomotopicIn_of_path z φ _ p q (fun _ => rfl) + (fun t => by rw [loopLift_apply]; rfl) hpq + · -- The curve stays in `X`, so it is null-homotopic there. + push Not at hin + have hrX : range φ ⊆ X := by + rintro _ ⟨z, rfl⟩ + exact (hφ (mem_range_self z)).resolve_right (hin z) + obtain ⟨c, hc, h⟩ := hsc.2 φ hrX + obtain ⟨y, hy⟩ := hL.nonempty + obtain ⟨β, hβ⟩ := hsc.1.joinedIn c hc y hy.1 + refine ⟨ContinuousMap.const Circle y, ?_, (h.mono subset_union_left).trans ?_⟩ + · rintro _ ⟨_, rfl⟩ + exact hy.2 + · exact ⟨⟨fun p => β p.2, by fun_prop⟩, fun p => Or.inl (hβ _), fun _ => by simp, + fun _ => by simp⟩ + +/-- **Graph Minors XI, (3.1)**, corrected (page 76). If `X, Y ⊆ Σ` are closed, and `X` is +simply-connected and `X ∩ Y` is non-empty and arc-wise connected, and moreover `X` deforms locally +into `X ∩ Y` (`IsLocalDeformationRetract`), then any continuous `φ : S¹ → X ∪ Y` is homotopic in +`X ∪ Y` to a continuous `φ' : S¹ → Y`. + +The paper has no local hypothesis, and without one the statement is false (see the correction to +(3.1) in `corrections/GM11.md`). The hypothesis holds in the paper's uses: there `X` is a closed +disc and `X ∩ Y` is its boundary (`IsClosedDisc.isLocalDeformationRetract`), except in (7.8) as used +in (8.8), where `X` and `Y` are unions of vertices, edges and regions of a drawing. The space need +not be a surface. -/ +theorem theorem_3_1_proof {X Y : Set S} (hX : IsClosed X) (hY : IsClosed Y) + (hsc : IsSimplyConnectedSet X) (hL : IsPathConnected (X ∩ Y)) + (hloc : IsLocalDeformationRetract X (X ∩ Y)) (φ : C(Circle, S)) (hφ : range φ ⊆ X ∪ Y) : + ∃ φ' : C(Circle, S), range φ' ⊆ Y ∧ ClosedCurvesHomotopicIn (X ∪ Y) φ φ' := + exists_push_of_paths hsc hL (fun p ha hb => exists_homotopic_path hX hY hsc hL hloc p ha hb) φ hφ + +/-- A closed disc deforms into its boundary circle, with the circle fixed, once its centre is +removed. So a closed disc and its boundary satisfy the local hypothesis of (3.1). -/ +theorem IsClosedDisc.isLocalDeformationRetract_of_homeomorph [T1Space S] {Δ : Set S} + (e : ClosedUnitDisc ≃ₜ Δ) : + IsLocalDeformationRetract Δ ((fun x => (e x).1) '' {x | x.1 ∈ UnitCircle}) := by + rintro y ⟨w, hw, rfl⟩ + have hnorm : ∀ x : ClosedUnitDisc, ‖x.1‖ ≤ 1 := fun x => mem_closedBall_zero_iff.mp x.2 + let c : ClosedUnitDisc := ⟨0, by simp [ClosedUnitDisc]⟩ + refine ⟨{(e c).1}ᶜ, isOpen_compl_singleton, ?_, ?_⟩ + · rintro hy + have heq : e w = e c := Subtype.ext hy + have hwc : w = c := e.injective heq + have : ‖w.1‖ = 1 := mem_sphere_zero_iff_norm.mp hw + simp [hwc, c] at this + let u : (Δ ∩ {(e c).1}ᶜ : Set S) → EuclideanPlane := fun x => (e.symm ⟨x.1, x.2.1⟩).1 + have hu : Continuous u := by fun_prop + have hu0 : ∀ x, ‖u x‖ ≠ 0 := by + intro x h0 + have h1 : u x = 0 := norm_eq_zero.mp h0 + have h2 : e.symm ⟨x.1, x.2.1⟩ = c := Subtype.ext h1 + have h3 := e.apply_symm_apply ⟨x.1, x.2.1⟩ + rw [h2] at h3 + exact x.2.2 (congrArg Subtype.val h3).symm + have hu1 : ∀ x, ‖u x‖ ≤ 1 := fun x => hnorm _ + let g : (Δ ∩ {(e c).1}ᶜ : Set S) × I → EuclideanPlane := fun p => + ((1 - (p.2 : ℝ)) + (p.2 : ℝ) / ‖u p.1‖) • u p.1 + have hgcont : Continuous g := by + have h0 : Continuous fun p : (Δ ∩ {(e c).1}ᶜ : Set S) × I => u p.1 := + hu.comp continuous_fst + have h1 : Continuous fun p : (Δ ∩ {(e c).1}ᶜ : Set S) × I => (p.2 : ℝ) := + continuous_subtype_val.comp continuous_snd + have h2 : Continuous fun p : (Δ ∩ {(e c).1}ᶜ : Set S) × I => ‖u p.1‖ := h0.norm + have h3 : Continuous fun p : (Δ ∩ {(e c).1}ᶜ : Set S) × I => + (1 - (p.2 : ℝ)) + (p.2 : ℝ) / ‖u p.1‖ := + (continuous_const.sub h1).add (h1.div h2 fun p => hu0 _) + exact h3.smul h0 + have hgnorm : ∀ p, ‖g p‖ = (1 - (p.2 : ℝ)) * ‖u p.1‖ + p.2 := by + intro p + have h0 := hu0 p.1 + have ht0 := p.2.2.1 + have ht1 := p.2.2.2 + have hc : 0 ≤ (1 - (p.2 : ℝ)) + (p.2 : ℝ) / ‖u p.1‖ := + add_nonneg (by linarith) (div_nonneg ht0 (norm_nonneg _)) + simp only [g, norm_smul, Real.norm_eq_abs, abs_of_nonneg hc] + field_simp + have hgmem : ∀ p, g p ∈ ClosedUnitDisc := by + intro p + rw [ClosedUnitDisc, mem_closedBall_zero_iff, hgnorm] + have ht0 := p.2.2.1 + have ht1 := p.2.2.2 + nlinarith [hu1 p.1] + refine ⟨⟨fun p => (e ⟨g p, hgmem p⟩).1, by fun_prop⟩, fun p => (e _).2, fun x => ?_, fun x => ?_, + fun x t hx => ?_⟩ + · have : g (x, 0) = u x := by simp [g] + simp only [ContinuousMap.coe_mk] + have h2 : (⟨g (x, 0), hgmem _⟩ : ClosedUnitDisc) = e.symm ⟨x.1, x.2.1⟩ := Subtype.ext this + rw [h2, e.apply_symm_apply] + · refine ⟨⟨g (x, 1), hgmem _⟩, ?_, rfl⟩ + change g (x, 1) ∈ UnitCircle + rw [UnitCircle, mem_sphere_zero_iff_norm, hgnorm] + simp + · obtain ⟨w', hw', hxw⟩ := hx + have hx' : e.symm ⟨x.1, x.2.1⟩ = w' := by + rw [e.symm_apply_eq] + exact Subtype.ext hxw.symm + have hn : ‖u x‖ = 1 := by + have : u x = w'.1 := by simp only [u, hx'] + rw [this] + exact mem_sphere_zero_iff_norm.mp hw' + have : g (x, t) = u x := by + simp [g, hn] + simp only [ContinuousMap.coe_mk] + have h2 : (⟨g (x, t), hgmem _⟩ : ClosedUnitDisc) = e.symm ⟨x.1, x.2.1⟩ := Subtype.ext this + rw [h2, e.apply_symm_apply] + +/-- A closed disc and its boundary satisfy the local hypothesis of (3.1). -/ +theorem IsClosedDisc.isLocalDeformationRetract [T1Space S] + {Δ : Set S} (hΔ : IsClosedDisc Δ) : IsLocalDeformationRetract Δ (discBd Δ) := by + obtain ⟨e⟩ := hΔ + rw [disc_boundary Δ e] + exact IsClosedDisc.isLocalDeformationRetract_of_homeomorph e + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section4.lean b/LeanPool/GraphMinor/GM11/Section4.lean new file mode 100644 index 0000000000..a14e26d205 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section4.lean @@ -0,0 +1,650 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Walks +import Mathlib.Analysis.InnerProductSpace.PiL2 + +/-! +# Graph Minors XI, Section 4: slopes + +This file proves results of Section 4 of Graph Minors XI on a drawing `Γ` with a slope `ins`: + +- (4.2): the restriction of a slope to a subdrawing is a slope (`theorem_4_2`); +- (4.3)(i): if `C` is a circuit of a confined subdrawing `Γ'` with `ins(C)` maximal, every path of + `Γ'` with both ends in `V(C)` lies in `ins(C)` (`theorem_4_3_i`). The proof takes a shortest + counterexample and applies the second slope axiom, as in the paper. +- (4.3)(ii): `Γ'` does not capture a region incident with an edge of `C` and not in `ins(C)` + (`theorem_4_3_ii`). The paper's "and so there are distinct vertices $a, b \in V(C \cap C')$" is + the + connectedness of a circuit minus a vertex (`isPreconnected_U_diff`). +-/ + +public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A closed disc is compact. -/ +theorem _root_.GraphMinor.Surface.IsClosedDisc.isCompact {Δ : Set S} (h : IsClosedDisc Δ) : + IsCompact Δ := by + obtain ⟨f⟩ := h + have : CompactSpace ClosedUnitDisc := + isCompact_iff_compactSpace.mp (isCompact_closedBall (0 : EuclideanPlane) 1) + have : CompactSpace Δ := f.compactSpace + exact isCompact_iff_compactSpace.mpr this + +/-- A closed disc in a Hausdorff space is closed. -/ +theorem _root_.GraphMinor.Surface.IsClosedDisc.isClosed [T2Space S] {Δ : Set S} + (h : IsClosedDisc Δ) : IsClosed Δ := + h.isCompact.isClosed + +theorem subBd_eq_frontier' (X : Set S) : frontier X = subBd X := by + rw [frontier_eq_closure_inter_closure, subBd, compl_eq_univ_sdiff] + +theorem subBd_subset_of_isClosed {X : Set S} (hX : IsClosed X) : subBd X ⊆ X := + fun _ hx => hX.closure_subset_iff.mpr subset_rfl hx.1 + +variable [T2Space S] + +/-- Graph Minors XI, (4.2) (page 79): "Let $\Gamma'$ be a subdrawing of $\Gamma$. Then the +restriction of $\text{ins}$ to the set +circuits of $\Gamma'$ of length $< 2\theta$ is a slope of order $\theta$ in $\Gamma'$." -/ +theorem theorem_4_2_proof {Γ Γ' : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + (hs : IsSlope Γ k ins) + (hsub : Γ'.IsSubdrawing Γ) : IsSlope Γ' k ins where + two_le := hs.two_le + isClosedDisc C hC hCs hlen := hs.isClosedDisc C hC (hCs.trans hsub) hlen + subBd_eq C hC hCs hlen := hs.subBd_eq C hC (hCs.trans hsub) hlen + monotone C₁ C₂ h₁ h₁s hl₁ h₂ h₂s hl₂ hU := + hs.monotone C₁ C₂ h₁ (h₁s.trans hsub) hl₁ h₂ (h₂s.trans hsub) hl₂ hU + three_paths P₀ P₁ P₂ a b h₀ h₁ h₂ h₀s h₁s h₂s l₀ l₁ l₂ i₀ i₁ i₂ d₀ d₁ d₂ c₀ c₁ c₂ := by + have hsup : ∀ {P Q : Drawing S}, P.IsSubdrawing Γ' → Q.IsSubdrawing Γ' → + Γ'.sup P Q = Γ.sup P Q := by + intro P Q hP hQ + apply Drawing.ext_of_V_E + · rw [Drawing.sup_V hP hQ, Drawing.sup_V (hP.trans hsub) (hQ.trans hsub)] + · rw [Drawing.sup_E hP hQ, Drawing.sup_E (hP.trans hsub) (hQ.trans hsub)] + rw [hsup h₁s h₂s] at c₀ ⊢ + rw [hsup h₂s h₀s] at c₁ ⊢ + rw [hsup h₀s h₁s] at c₂ ⊢ + exact hs.three_paths P₀ P₁ P₂ a b h₀ h₁ h₂ (h₀s.trans hsub) (h₁s.trans hsub) (h₂s.trans hsub) + l₀ l₁ l₂ i₀ i₁ i₂ d₀ d₁ d₂ c₀ c₁ c₂ + +/-- `U(C) ⊆ ins(C)`. -/ +theorem IsSlope.U_subset_ins {Γ : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + (hs : IsSlope Γ k ins) {C : Drawing S} (hC : C.IsCircuit) (hCs : C.IsSubdrawing Γ) + (hlen : C.length < k) : C.U ⊆ ins C := by + rw [← hs.subBd_eq C hC hCs hlen] + exact subBd_subset_of_isClosed (hs.isClosedDisc C hC hCs hlen).isClosed + +omit [T2Space S] in +theorem isSimple_of_append {Γ : Drawing S} {a x b : S} {W₁ : GraphWalk Γ.toGraph a x} + {W₂ : GraphWalk Γ.toGraph x b} (h : (W₁.append W₂).IsSimple) : + W₁.IsSimple ∧ W₂.IsSimple := + GraphWalk.simple_parts_of_append h + +omit [T2Space S] in +theorem exists_split_edge {Γ : Drawing S} {a b : S} (W : GraphWalk Γ.toGraph a b) {e : Set S} + (he : e ∈ W.edges) : + ∃ (x y : S) (W₁ : GraphWalk Γ.toGraph a x) (h : Γ.toGraph.IsLink e x y) + (W₂ : GraphWalk Γ.toGraph y b), W = W₁.append (.cons h W₂) := by + obtain ⟨x, y, h, W₁, W₂, heq⟩ := W.split_at_edge he + exact ⟨x, y, W₁, h, W₂, heq⟩ + +omit [TopologicalSpace S] [T2Space S] in +theorem support_of_length_zero {G : Graph S (Set S)} {a b : S} {W : GraphWalk G a b} + (h : W.length = 0) : W.support = [a] ∧ W.edges = [] := by + cases W with + | nil _ => exact ⟨rfl, rfl⟩ + | cons h' r => simp at h + +/-- Under the setting of (4.3)(i), a simple walk with its ends in `C` and an edge in `C` is that +edge, so it lies in `U(C)`. -/ +private theorem walk_subset_of_common_edge {C Γ' : Drawing S} (hCs : C.IsSubdrawing Γ') {a b : S} + (W : GraphWalk Γ'.toGraph a b) (hW : W.IsSimple) (ha : a ∈ C.V) (hb : b ∈ C.V) + (hint : ∀ x ∈ W.support, x ∈ C.V → x = a ∨ x = b) {e : Set S} (he : e ∈ W.edges) + (heC : e ∈ C.E) : (walkDrawing Γ' W).U ⊆ C.U := by + obtain ⟨x, y, W₁, h, W₂, rfl⟩ := exists_split_edge W he + have hs := isSimple_of_append hW + have hsplit : ((W₁.support ++ (GraphWalk.cons h W₂).support.tail).Nodup) := by + have h' : (W₁.append (GraphWalk.cons h W₂)).support.Nodup := hW + rwa [GraphWalk.support_append] at h' + have hd := List.nodup_append.mp hsplit + have hyneW₁ : y ∉ W₁.support := fun hy => hd.2.2 y hy y W₂.start_mem_support rfl + have hbneW₁ : b ∉ W₁.support := fun hy => hd.2.2 b hy b W₂.end_mem_support rfl + have haneW₂ : a ∉ W₂.support := fun hy => hd.2.2 a W₁.start_mem_support a hy rfl + have hlC : C.toGraph.IsLink e x y := (hCs.isLink_iff heC).mpr h + have hxC : x ∈ C.V := hlC.2.1 + have hyC : y ∈ C.V := hlC.2.2.1 + have hxW : x ∈ (W₁.append (GraphWalk.cons h W₂)).support := + (GraphWalk.mem_support_append _ _).mpr (Or.inl W₁.end_mem_support) + have hyW : y ∈ (W₁.append (GraphWalk.cons h W₂)).support := + (GraphWalk.mem_support_append _ _).mpr (Or.inr (by simp [W₂.start_mem_support])) + have hxa : x = a := (hint x hxW hxC).resolve_right fun hxb => hbneW₁ (hxb ▸ W₁.end_mem_support) + have hyb : y = b := (hint y hyW hyC).resolve_left fun hya => haneW₂ (hya ▸ W₂.start_mem_support) + subst hxa hyb + have h₁ := support_of_length_zero hs.1.length_eq_zero + have hs₂ : W₂.IsSimple := hs.2.of_cons + have h₂ := support_of_length_zero hs₂.length_eq_zero + intro z hz + rw [mem_walkDrawing_U] at hz + rcases hz with hz | ⟨f, hf, hz⟩ + · rw [GraphWalk.support_append, h₁.1] at hz + simp only [GraphWalk.support_cons, List.tail_cons, h₂.1] at hz + rw [C.U_eq] + simp only [List.cons_append, List.nil_append, List.mem_cons, List.not_mem_nil, or_false] at hz + rcases hz with rfl | rfl + · exact Or.inl hxC + · exact Or.inl hyC + · rw [GraphWalk.edges_append, h₁.2] at hf + simp only [GraphWalk.edges_cons, h₂.2, List.nil_append, List.mem_singleton] at hf + subst hf + rw [C.U_eq] + exact Or.inr (mem_iUnion₂.mpr ⟨f, heC, hz⟩) + +/-- Graph Minors XI, (4.3)(i) (page 79): +"(4.3) *Let $\Gamma'$ be a confined subdrawing of $\Gamma$, and let $C$ be a circuit of $\Gamma'$ +with $\text{ins}(C)$ maximal. Then* (i) $U(P) \subseteq \text{ins}(C)$ *for every path $P$ of +$\Gamma'$ with both ends in $V(C)$,*" The path is given as a simple walk. -/ +theorem theorem_4_3_i {Γ Γ' C : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + (hs : IsSlope Γ k ins) (hsub : Γ'.IsSubdrawing Γ) (hconf : IsConfined k Γ') + (hC : C.IsCircuit) (hCs : C.IsSubdrawing Γ') + (hmax : ∀ C' : Drawing S, C'.IsCircuit → C'.IsSubdrawing Γ' → ins C ⊆ ins C' → ins C' ⊆ ins C) + {a b : S} (W : GraphWalk Γ'.toGraph a b) (hW : W.IsSimple) (ha : a ∈ C.V) (hb : b ∈ C.V) : + (walkDrawing Γ' W).U ⊆ ins C := by + have hs' := theorem_4_2_proof hs hsub + have hCl := hconf C hC hCs + have hUC := hs'.U_subset_ins hC hCs hCl + -- Induction on the length gives the minimal counterexample of the paper. + induction hn : W.length using Nat.strong_induction_on generalizing a b with + | _ n ih => + by_cases hint : ∃ x ∈ W.support, x ∈ C.V ∧ x ≠ a ∧ x ≠ b + · -- An internal vertex in `C` splits the walk into two shorter walks. + obtain ⟨x, hx, hxC, hxa, hxb⟩ := hint + obtain ⟨W₁, W₂, rfl⟩ := W.exists_append_of_mem hx + have hsp := isSimple_of_append hW + have hl₁ : W₁.length ≠ 0 := fun h => hxa (GraphWalk.eq_of_length_eq_zero h).symm + have hl₂ : W₂.length ≠ 0 := fun h => hxb (GraphWalk.eq_of_length_eq_zero h) + rw [GraphWalk.length_append] at hn + have i₁ := ih W₁.length (by omega) W₁ hsp.1 ha hxC rfl + have i₂ := ih W₂.length (by omega) W₂ hsp.2 hxC hb rfl + intro z hz + rw [mem_walkDrawing_U] at hz + rcases hz with hz | ⟨f, hf, hz⟩ + · rcases (GraphWalk.mem_support_append _ _).mp hz with hz | hz + · exact i₁ ((mem_walkDrawing_U _ _).mpr (Or.inl hz)) + · exact i₂ ((mem_walkDrawing_U _ _).mpr (Or.inl hz)) + · rw [GraphWalk.edges_append, List.mem_append] at hf + rcases hf with hf | hf + · exact i₁ ((mem_walkDrawing_U _ _).mpr (Or.inr ⟨f, hf, hz⟩)) + · exact i₂ ((mem_walkDrawing_U _ _).mpr (Or.inr ⟨f, hf, hz⟩)) + · have hint' : ∀ x ∈ W.support, x ∈ C.V → x = a ∨ x = b := by + intro x hx hxC + by_contra hcon + push Not at hcon + exact hint ⟨x, hx, hxC, hcon.1, hcon.2⟩ + by_cases hab : a = b + · subst hab + have h₀ := support_of_length_zero hW.length_eq_zero + intro z hz + rw [mem_walkDrawing_U, h₀.1, h₀.2] at hz + simp only [List.mem_singleton, List.not_mem_nil, false_and, exists_false, or_false] at hz + subst hz + exact hUC (C.V_subset_U ha) + by_cases hedge : ∃ e ∈ W.edges, e ∈ C.E + · obtain ⟨e, he, heC⟩ := hedge + exact (walk_subset_of_common_edge hCs W hW ha hb hint' he heC).trans hUC + -- Now `P`, `P₁`, `P₂` are three paths to which the second slope axiom applies. + obtain ⟨P₁, P₂, hP₁, hP₂, hP₁s, hP₂s, hl₁, hl₂, hV₁₂, hE₁₂, hsupC⟩ + := hC.exists_two_paths ha hb hab + set P := walkDrawing Γ' W with hPdef + have hPs : P.IsSubdrawing Γ' := walkDrawing_isSubdrawing Γ' W + have hP : P.IsPathBetween a b := walkDrawing_isPathBetween Γ' hW + have hP₁' := hP₁s.trans hCs + have hP₂' := hP₂s.trans hCs + have habV : a ∈ P₁.V ∩ P₂.V ∧ b ∈ P₁.V ∩ P₂.V := by rw [hV₁₂]; simp + have hPlen : 0 < P.length := by + have hne : W.edges ≠ [] := by + intro h + have : W.length = 0 := by simp [GraphWalk.length, h] + exact hab (GraphWalk.eq_of_length_eq_zero this) + obtain ⟨e, he⟩ := List.exists_mem_of_ne_nil _ hne + have heP : e ∈ P.E := by + rw [hPdef, walkDrawing_E] + exact he + exact Set.ncard_pos P.finite_edges |>.mpr ⟨e, heP⟩ + have hVP : ∀ {Q : Drawing S}, Q.IsSubdrawing C → a ∈ Q.V → b ∈ Q.V → P.V ∩ Q.V = {a, b} := by + intro Q hQ haQ hbQ + ext x + constructor + · rintro ⟨hxP, hxQ⟩ + rw [hPdef, walkDrawing_V] at hxP + exact hint' x hxP (hQ.1 hxQ) + · rintro (rfl | hx) + · refine ⟨?_, haQ⟩ + rw [hPdef, walkDrawing_V] + exact W.start_mem_support + · rw [mem_singleton_iff.mp hx] + refine ⟨?_, hbQ⟩ + rw [hPdef, walkDrawing_V] + exact W.end_mem_support + have hEP : ∀ {Q : Drawing S}, Q.IsSubdrawing C → Disjoint P.E Q.E := by + intro Q hQ + refine disjoint_left.mpr fun e he heQ => hedge ⟨e, ?_, hQ.2 heQ⟩ + rw [hPdef, walkDrawing_E] at he + exact he + have hV01 := hVP hP₁s habV.1.1 habV.2.1 + have hV02 := hVP hP₂s habV.1.2 habV.2.2 + have hsupC' : Γ'.sup P₁ P₂ = C := by + rw [← hsupC] + apply Drawing.ext_of_V_E + · rw [Drawing.sup_V hP₁' hP₂', Drawing.sup_V hP₁s hP₂s] + · rw [Drawing.sup_E hP₁' hP₂', Drawing.sup_E hP₁s hP₂s] + -- The circuits `P ∪ P₁` and `P₂ ∪ P`. + have hc₁ : (Γ'.sup P P₁).IsCircuit := Drawing.isCircuit_sup hP hP₁ hPs hP₁' hab hV01 + (hEP hP₁s) + have hc₂ : (Γ'.sup P₂ P).IsCircuit := + Drawing.isCircuit_sup hP₂ hP hP₂' hPs hab (by rw [inter_comm]; exact hV02) + (hEP hP₂s).symm + have hc₁s := Drawing.sup_isSubdrawing Γ' P P₁ + have hc₂s := Drawing.sup_isSubdrawing Γ' P₂ P + have hl₁' := hconf _ hc₁ hc₁s + have hl₂' := hconf _ hc₂ hc₂s + have hUP₁ : P.U ⊆ ins (Γ'.sup P P₁) := + ((Drawing.le_sup_left hPs hP₁').U_subset).trans (hs'.U_subset_ins hc₁ hc₁s hl₁') + have hUP₂ : P.U ⊆ ins (Γ'.sup P₂ P) := + ((Drawing.le_sup_right hP₂' hPs).U_subset).trans (hs'.U_subset_ins hc₂ hc₂s hl₂') + have h3 := hs'.three_paths P P₁ P₂ a b hP hP₁ hP₂ hPs hP₁' hP₂' hPlen hl₁ hl₂ hV01 hV₁₂ + (by rw [inter_comm]; exact hV02) (hEP hP₁s) hE₁₂ (hEP hP₂s).symm + (by rw [hsupC']; exact hCl) hl₂' hl₁' + rw [hsupC'] at h3 + rcases h3 with ⟨h, -⟩ | ⟨h, h'⟩ | ⟨h, h'⟩ + · exact hUP₂.trans h + · exact hUP₂.trans (hmax _ hc₂ hc₂s h) + · exact hUP₁.trans (hmax _ hc₁ hc₁s h) + +omit [T2Space S] in +/-- A circuit can be read as a simple-closed walk from any of its vertices. -/ +theorem exists_walk_at {C : Drawing S} (hC : C.IsCircuit) {v : S} (hv : v ∈ C.V) : + ∃ W : GraphWalk C.toGraph v v, W.IsSimpleClosed ∧ 0 < W.length ∧ + C.V = {x | x ∈ W.support} ∧ C.E = {e | e ∈ W.edges} := by + obtain ⟨u, W, ⟨hnd, hed⟩, hpos, hV, hE⟩ := hC + rw [hV] at hv + obtain ⟨W₁, W₂, rfl⟩ := W.exists_append_of_mem hv + refine ⟨W₂.append W₁, ⟨?_, ?_⟩, ?_, ?_, ?_⟩ + · have h1 : (W₁.append W₂).support.tail = W₁.support.tail ++ W₂.support.tail := by + rw [GraphWalk.support_append, W₁.support_eq_cons]; simp + have h2 : (W₂.append W₁).support.tail = W₂.support.tail ++ W₁.support.tail := by + rw [GraphWalk.support_append, W₂.support_eq_cons]; simp + rw [h2] + rw [h1] at hnd + exact (List.perm_append_comm.nodup_iff).mp hnd + · rw [GraphWalk.edges_append] + rw [GraphWalk.edges_append] at hed + exact (List.perm_append_comm.nodup_iff).mp hed + · rw [GraphWalk.length_append] at hpos ⊢ + omega + · rw [hV] + ext x + simp only [mem_ofPred_eq, GraphWalk.mem_support_append, or_comm] + · rw [hE] + ext e + simp only [mem_ofPred_eq, GraphWalk.edges_append, List.mem_append, or_comm] + +omit [T2Space S] in +/-- The closure of an edge minus a point is preconnected. -/ +private theorem isPreconnected_closure_diff (Γ : Drawing S) {e : Set S} (he : e ∈ Γ.E) {v : S} + (hv : v ∈ Γ.V) : IsPreconnected (closure e \ {v}) := by + have h₁ : IsPreconnected e := he.2.2.1.isConnected.isPreconnected + refine h₁.subset_closure (fun x hx => ⟨subset_closure hx, ?_⟩) sdiff_subset + rintro rfl + exact (he.2.1 hx).2 hv + +omit [T2Space S] in +/-- For a simple walk ending in `v`, its point set minus `v` is preconnected. -/ +private theorem isPreconnected_walk_diff (Γ : Drawing S) {a v : S} (hv : v ∈ Γ.V) + (W : GraphWalk Γ.toGraph a v) (hW : W.IsSimple) : + IsPreconnected ({x | x ∈ W.support ∨ ∃ e ∈ W.edges, x ∈ closure e} \ {v}) := by + induction W with + | nil h => + convert isPreconnected_empty using 1 + ext x + simp + | @cons u w v e h r ih => + have hr := hW.of_cons + have hu : u ≠ v := fun huv => (List.nodup_cons.mp hW).1 (huv ▸ r.end_mem_support) + have hEq : {x | x ∈ (GraphWalk.cons h r).support ∨ ∃ e' ∈ (GraphWalk.cons h r).edges, + x ∈ closure e'} \ {v} = (closure e \ {v}) ∪ + ({x | x ∈ r.support ∨ ∃ e' ∈ r.edges, x ∈ closure e'} \ {v}) := by + have hul : u ∈ closure e := by + have : u ∈ closure e ∩ Γ.V := by rw [h.2.2.2]; simp + exact this.1 + ext x + simp only [GraphWalk.support_cons, GraphWalk.edges_cons, List.mem_cons, mem_sdiff, + mem_ofPred_eq, + mem_singleton_iff, mem_union, exists_eq_or_imp] + constructor + · rintro ⟨(h1 | h1) | (h1 | h1), hx⟩ + · exact Or.inl ⟨h1 ▸ hul, hx⟩ + · exact Or.inr ⟨Or.inl h1, hx⟩ + · exact Or.inl ⟨h1, hx⟩ + · exact Or.inr ⟨Or.inr h1, hx⟩ + · rintro (⟨h1, hx⟩ | ⟨h1 | h1, hx⟩) + · exact ⟨Or.inr (Or.inl h1), hx⟩ + · exact ⟨Or.inl (Or.inr h1), hx⟩ + · exact ⟨Or.inr (Or.inr h1), hx⟩ + rw [hEq] + by_cases hwv : w = v + · subst hwv + have h₀ := support_of_length_zero hr.length_eq_zero + have hsmall : {x | x ∈ r.support ∨ ∃ e' ∈ r.edges, x ∈ closure e'} \ {w} = ∅ := by + ext x + simp [h₀.1, h₀.2] + rw [hsmall, union_empty] + exact isPreconnected_closure_diff Γ h.1 hv + · refine IsPreconnected.union w ⟨?_, hwv⟩ ⟨Or.inl r.start_mem_support, hwv⟩ + (isPreconnected_closure_diff Γ h.1 hv) (ih hv hr) + have : w ∈ closure e ∩ Γ.V := by rw [h.2.2.2]; simp + exact this.1 + +omit [T2Space S] in +/-- A circuit minus one of its vertices is preconnected. -/ +theorem isPreconnected_U_diff {C : Drawing S} (hC : C.IsCircuit) {v : S} (hv : v ∈ C.V) : + IsPreconnected (C.U \ {v}) := by + obtain ⟨W, ⟨hnd, -⟩, hpos, hV, hE⟩ := exists_walk_at hC hv + have hU : C.U = {x | x ∈ W.support ∨ ∃ e ∈ W.edges, x ∈ closure e} := by + rw [C.U_eq, hV, hE] + ext x + simp + rw [hU] + cases W with + | nil _ => simp at hpos + | @cons _ w _ e h r => + have hr : r.IsSimple := by simpa [GraphWalk.IsSimple] using hnd + have hEq : {x | x ∈ (GraphWalk.cons h r).support ∨ ∃ e' ∈ (GraphWalk.cons h r).edges, + x ∈ closure e'} \ {v} = (closure e \ {v}) ∪ + ({x | x ∈ r.support ∨ ∃ e' ∈ r.edges, x ∈ closure e'} \ {v}) := by + ext x + simp only [GraphWalk.support_cons, GraphWalk.edges_cons, List.mem_cons, mem_sdiff, + mem_ofPred_eq, + mem_singleton_iff, mem_union, exists_eq_or_imp] + constructor + · rintro ⟨(h1 | h1) | (h1 | h1), hx⟩ + · exact absurd h1 hx + · exact Or.inr ⟨Or.inl h1, hx⟩ + · exact Or.inl ⟨h1, hx⟩ + · exact Or.inr ⟨Or.inr h1, hx⟩ + · rintro (⟨h1, hx⟩ | ⟨h1 | h1, hx⟩) + · exact ⟨Or.inr (Or.inl h1), hx⟩ + · exact ⟨Or.inl (Or.inr h1), hx⟩ + · exact ⟨Or.inr (Or.inr h1), hx⟩ + rw [hEq] + by_cases hwv : w = v + · subst hwv + have h₀ := support_of_length_zero hr.length_eq_zero + have hsmall : {x | x ∈ r.support ∨ ∃ e' ∈ r.edges, x ∈ closure e'} \ {w} = ∅ := by + ext x + simp [h₀.1, h₀.2] + rw [hsmall, union_empty] + exact isPreconnected_closure_diff C h.1 hv + · refine IsPreconnected.union w ⟨?_, hwv⟩ ⟨Or.inl r.start_mem_support, hwv⟩ + (isPreconnected_closure_diff C h.1 hv) (isPreconnected_walk_diff C hv r hr) + have : w ∈ closure e ∩ C.V := by rw [h.2.2.2]; simp + exact this.1 + +omit [T2Space S] in +/-- A circuit with a loop consists of that loop. -/ +theorem IsCircuit.E_eq_of_loop {C : Drawing S} (hC : C.IsCircuit) {f : Set S} (hf : f ∈ C.E) + {v : S} (hl : closure f ∩ C.V = {v}) : C.E = {f} := by + have hv : v ∈ C.V := by + have : v ∈ closure f ∩ C.V := by rw [hl]; simp + exact this.2 + obtain ⟨W, ⟨hnd, hed⟩, hpos, hV, hE⟩ := exists_walk_at hC hv + have hloop : C.toGraph.IsLink f v v := ⟨hf, hv, hv, by simpa using hl⟩ + cases W with + | nil _ => simp at hpos + | @cons _ w _ e h r => + have hr : r.IsSimple := by simpa [GraphWalk.IsSimple] using hnd + have hfr : f ∉ r.edges := by + intro hfr + obtain ⟨x, y, R₁, h', R₂, rfl⟩ := exists_split_edge r hfr + have hxv : x = v := by + have : x ∈ closure f ∩ C.V := by rw [h'.2.2.2]; simp + rw [hl] at this + exact this + have hyv : y = v := by + have : y ∈ closure f ∩ C.V := by rw [h'.2.2.2]; simp + rw [hl] at this + exact this + subst hxv + obtain rfl := hyv + have hsplit : ((R₁.support ++ (GraphWalk.cons h' R₂).support.tail).Nodup) := by + have h'' : (R₁.append (GraphWalk.cons h' R₂)).support.Nodup := hr + rwa [GraphWalk.support_append] at h'' + have hd := List.nodup_append.mp hsplit + exact hd.2.2 y R₁.end_mem_support y R₂.start_mem_support rfl + have hfe : e = f := by + have hmem : f ∈ (GraphWalk.cons h r).edges := by + rw [hE] at hf + exact hf + rcases List.mem_cons.mp hmem with h1 | h1 + · exact h1.symm + · exact absurd h1 hfr + subst hfe + have hwv : w = v := by + have : w ∈ closure e ∩ C.V := by rw [h.2.2.2]; simp + rw [hl] at this + exact this + subst hwv + have h₀ := support_of_length_zero hr.length_eq_zero + rw [hE] + ext x + simp [h₀.2] + +/-- `U(P) ⊆ X` for a path given by a simple walk of `Γ'`. -/ +theorem path_U_subset {Γ' P : Drawing S} {a b : S} (hP : P.IsPathBetween a b) + (hPs : P.IsSubdrawing Γ') {X : Set S} + (h : ∀ {W : GraphWalk Γ'.toGraph a b}, W.IsSimple → (walkDrawing Γ' W).U ⊆ X) : P.U ⊆ X := by + obtain ⟨W, hW, hV, hE⟩ := hP + obtain ⟨W', hs, he⟩ := hPs.exists_walk_up W + have hsimple : W'.IsSimple := by + unfold GraphWalk.IsSimple + rw [hs] + exact hW + refine subset_trans ?_ (h hsimple) + intro z hz + rw [mem_walkDrawing_U, hs, he] + rw [P.U_eq, hV, hE] at hz + rcases hz with hz | hz + · exact Or.inl hz + · obtain ⟨e, he', hz⟩ := mem_iUnion₂.mp hz + exact Or.inr ⟨e, he', hz⟩ + +/-- Graph Minors XI, (4.3)(ii) (page 79): for every edge `e` of `C`, `Γ'` does not capture the +region +of `Γ` incident with `e` not included in `ins(C)`. -/ +theorem theorem_4_3_ii {Γ Γ' C : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + (hs : IsSlope Γ k ins) (hsub : Γ'.IsSubdrawing Γ) (hconf : IsConfined k Γ') + (hC : C.IsCircuit) (hCs : C.IsSubdrawing Γ') + (hmax : ∀ C' : Drawing S, C'.IsCircuit → C'.IsSubdrawing Γ' → ins C ⊆ ins C' → ins C' ⊆ ins C) + {e r : Set S} (he : e ∈ C.E) (hinc : (e ∩ closure r).Nonempty) (hnot : ¬ r ⊆ ins C) : + ¬ Captures ins k Γ' r := by + rintro ⟨C', hC', hC's, hl', hr⟩ + have hs' := theorem_4_2_proof hs hsub + have hCl := hconf C hC hCs + have hclosed' : IsClosed (ins C') := (hs'.isClosedDisc C' hC' hC's hl').isClosed + have hUC' := hs'.U_subset_ins hC' hC's hl' + obtain ⟨x, hxe, hxr⟩ := hinc + have hxin : x ∈ ins C' := hclosed'.closure_subset_iff.mpr hr hxr + by_cases hUU : C.U ⊆ ins C' + · exact hnot (hr.trans (hmax C' hC' hC's (hs'.monotone C C' hC hCs hCl hC' hC's hl' hUU))) + obtain ⟨y, hyC, hyout⟩ := not_subset.mp hUU + -- Two distinct common vertices finish the proof, by (4.3)(i). + have hdone : ∀ a b : S, a ∈ C.V → a ∈ C'.V → b ∈ C.V → b ∈ C'.V → a ≠ b → False := by + intro a b haC haC' hbC hbC' hab + obtain ⟨P, Q, hP, hQ, hPs, hQs, -, -, -, -, hsup⟩ := hC'.exists_two_paths haC' hbC' hab + have hP' : P.U ⊆ ins C := path_U_subset hP (hPs.trans hC's) fun hW => + theorem_4_3_i hs hsub hconf hC hCs hmax _ hW haC hbC + have hQ' : Q.U ⊆ ins C := path_U_subset hQ (hQs.trans hC's) fun hW => + theorem_4_3_i hs hsub hconf hC hCs hmax _ hW haC hbC + have hU : C'.U ⊆ ins C := by + rw [← hsup] + intro z hz + rw [Drawing.U_eq, Drawing.sup_V hPs hQs, Drawing.sup_E hPs hQs] at hz + rcases hz with (hz | hz) | hz + · exact hP' (P.V_subset_U hz) + · exact hQ' (Q.V_subset_U hz) + · obtain ⟨f, hf | hf, hz⟩ := mem_iUnion₂.mp hz + · exact hP' (P.closure_subset_U hf hz) + · exact hQ' (Q.closure_subset_U hf hz) + exact hnot (hr.trans (hs'.monotone C' C hC' hC's hl' hC hCs hCl hU)) + -- A common edge gives two common vertices, unless it is a loop. + have hnoedge : ∀ f, f ∈ C.E → f ∉ C'.E := by + intro f hf hf' + obtain ⟨p, q, hpq⟩ := (C.toGraph.edge_mem_iff_exists_isLink f).mp hf + have hlC' : C'.toGraph.IsLink f p q := + ((hC's.isLink_iff hf').mpr ((hCs.isLink_iff hf).mp hpq)) + by_cases hpqe : p = q + · subst hpqe + have hl₁ : closure f ∩ C.V = {p} := by simpa using hpq.2.2.2 + have hl₂ : closure f ∩ C'.V = {p} := by simpa using hlC'.2.2.2 + have hE₁ := IsCircuit.E_eq_of_loop hC hf hl₁ + have hE₂ := IsCircuit.E_eq_of_loop hC' hf' hl₂ + apply hUU + have hUeq : C.U ⊆ C'.U := by + rw [C.U_eq, C'.U_eq, hE₁, hE₂] + refine union_subset_union ?_ subset_rfl + intro z hz + have hzc : z ∈ C.U := C.V_subset_U hz + have hzz : z = p := by + by_contra hzp + have hzE : ∃ e' ∈ C.E, z ∈ e' ∨ True := by + exact ⟨f, hf, Or.inr trivial⟩ + -- `z` is a vertex of the circuit, whose only edge is `f`. + obtain ⟨u, W, -, hpos, hV, hE⟩ := hC + have hzW : z ∈ W.support := by rw [hV] at hz; exact hz + have hedges : ∀ e' ∈ W.edges, e' = f := by + intro e' he' + have : e' ∈ C.E := by rw [hE]; exact he' + rw [hE₁] at this + exact this + have hall : ∀ w ∈ W.support, w = p := by + have hgen : ∀ {a b : S} (R : GraphWalk C.toGraph a b), (∀ e' ∈ R.edges, e' = f) → + 0 < R.length → ∀ w ∈ R.support, w = p := by + intro a b R + induction R with + | nil _ => simp + | @cons u' v' w' e' h' R' ih => + intro hed _ w hw + have hee : e' = f := hed _ (by simp) + subst hee + have huu : u' = p := by + have : u' ∈ closure e' ∩ C.V := by rw [h'.2.2.2]; simp + rw [hl₁] at this + exact this + have hvv : v' = p := by + have : v' ∈ closure e' ∩ C.V := by rw [h'.2.2.2]; simp + rw [hl₁] at this + exact this + rcases List.mem_cons.mp hw with rfl | hw + · exact huu + · cases R' with + | nil _ => + simp only [GraphWalk.support_nil, List.mem_singleton] at hw + exact hw.trans hvv + | cons h'' R'' => + exact ih (fun e'' he'' => hed e'' (List.mem_cons_of_mem _ he'')) (by simp) w hw + exact hgen W hedges hpos + exact hzp (hall z hzW) + rw [hzz] + have : p ∈ closure f ∩ C'.V := by rw [hl₂]; simp + exact this.2 + exact hUeq.trans hUC' + · exact hdone p q hpq.2.1 hlC'.2.1 hpq.2.2.1 hlC'.2.2.1 hpqe + -- The set `T`: `U(C)` minus the common vertex, if any. + have hsep : ∀ T : Set S, IsPreconnected T → T ⊆ C.U → x ∈ T → y ∈ T → + (∀ z ∈ T, z ∈ C.V → z ∉ C'.V) → False := by + intro T hT hTC hxT hyT hTV + have hnon : (T ∩ frontier (ins C')).Nonempty := by + by_contra hcon + have hcon' : ∀ z ∈ T, z ∉ frontier (ins C') := fun z hz hzf => hcon ⟨z, hz, hzf⟩ + have hcov : T ⊆ interior (ins C') ∪ (ins C')ᶜ := by + intro z hz + by_cases hzin : z ∈ ins C' + · refine Or.inl ?_ + by_contra hzi + exact hcon' z hz ⟨subset_closure hzin, hzi⟩ + · exact Or.inr hzin + have hxi : x ∈ interior (ins C') := by + by_contra hxi + exact hcon' x hxT ⟨subset_closure hxin, hxi⟩ + obtain ⟨z, -, hz₁, hz₂⟩ := hT _ _ isOpen_interior hclosed'.isOpen_compl hcov ⟨x, hxT, hxi⟩ + ⟨y, hyT, hyout⟩ + exact hz₂ (interior_subset hz₁) + obtain ⟨z, hzT, hzf⟩ := hnon + rw [subBd_eq_frontier', hs'.subBd_eq C' hC' hC's hl'] at hzf + have hzC := hTC hzT + by_cases hzV : z ∈ C.V + · have hzV' : z ∉ C'.V := hTV z hzT hzV + obtain ⟨f, hf, hzf'⟩ := C'.exists_edge_of_mem hzf hzV' + exact (((hC's.trans hsub).2 hf).2.1 hzf').2 ((hCs.trans hsub).1 hzV) + · obtain ⟨g, hg, hzg⟩ := C.exists_edge_of_mem hzC hzV + by_cases hzV' : z ∈ C'.V + · exact (((hCs.trans hsub).2 hg).2.1 hzg).2 ((hC's.trans hsub).1 hzV') + · obtain ⟨f, hf, hzf'⟩ := C'.exists_edge_of_mem hzf hzV' + have hgf := Γ.edge_eq_of_mem ((hCs.trans hsub).2 hg) ((hC's.trans hsub).2 hf) hzg hzf' + exact hnoedge g hg (hgf ▸ hf) + have hxV : x ∉ Γ.V := ((hCs.trans hsub).2 he).2.1 hxe |>.2 + have hxC : x ∈ C.U := C.closure_subset_U he (subset_closure hxe) + by_cases hcom : ∃ v, v ∈ C.V ∧ v ∈ C'.V + · obtain ⟨v, hvC, hvC'⟩ := hcom + have huniq : ∀ z, z ∈ C.V → z ∈ C'.V → z = v := by + intro z hz hz' + by_contra hne + exact hdone z v hz hz' hvC hvC' hne + refine hsep (C.U \ {v}) (isPreconnected_U_diff hC hvC) sdiff_subset ⟨hxC, ?_⟩ ⟨hyC, ?_⟩ ?_ + · rintro rfl + exact hxV ((hCs.trans hsub).1 hvC) + · rintro rfl + exact hyout (hUC' (C'.V_subset_U hvC')) + · intro z hz hzC hzC' + exact hz.2 (huniq z hzC hzC') + · obtain ⟨v, hv⟩ : C.V.Nonempty := by + obtain ⟨u, W, -, -, hV, -⟩ := hC + exact ⟨u, by rw [hV]; exact W.start_mem_support⟩ + have hprec : IsPreconnected (C.U \ {v}) := isPreconnected_U_diff hC hv + have hclo : C.U ⊆ closure (C.U \ {v}) := by + intro z hz + by_cases hzv : z = v + · subst hzv + obtain ⟨W, -, hpos, hV, hE⟩ := exists_walk_at hC hv + cases W with + | nil _ => simp at hpos + | @cons _ w _ e' h r => + have he' : e' ∈ C.E := h.1 + have hzc : z ∈ closure e' := by + have : z ∈ closure e' ∩ C.V := by rw [h.2.2.2]; simp + exact this.1 + have hsubs : e' ⊆ C.U \ {z} := by + intro q hq + refine ⟨C.closure_subset_U he' (subset_closure hq), ?_⟩ + rintro rfl + exact (he'.2.1 hq).2 hv + exact closure_mono hsubs hzc + · exact subset_closure ⟨hz, hzv⟩ + exact hsep C.U (hprec.subset_closure sdiff_subset hclo) subset_rfl hxC hyC + fun z _ hz hz' => hcom ⟨z, hz, hz'⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section4b.lean b/LeanPool/GraphMinor/GM11/Section4b.lean new file mode 100644 index 0000000000..13b7a51ba1 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section4b.lean @@ -0,0 +1,472 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section4 + +/-! +# Graph Minors XI, (4.3)(iii) + +This file proves (4.3)(iii): if `Γ'` is non-separable and `C` is a circuit of `Γ'` with `ins(C)` +maximal, then `ins(Γ') = ins(C)`. The paper deduces it from (4.3)(i), and leaves to the reader that +every edge of a non-separable drawing lies on a path with ends in `V(C)`. We prove this in the +classical way: in a non-separable drawing, any edge lies on a common circuit with a fixed edge +(`exists_circuit_through`). +-/ + +public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- Any walk contains a simple walk with the same ends. -/ +theorem GraphWalk.exists_isSimple {α : Type u} {β : Type*} {G : Graph α β} + {u v : α} (W : GraphWalk G u v) : + ∃ W' : GraphWalk G u v, W'.IsSimple ∧ (∀ x ∈ W'.support, x ∈ W.support) ∧ + ∀ e ∈ W'.edges, e ∈ W.edges := by + classical + induction W with + | nil h => exact ⟨.nil h, by simp [GraphWalk.IsSimple], fun _ h => h, fun _ h => h⟩ + | @cons u v w e h r ih => + obtain ⟨R, hR, hs, he⟩ := ih + by_cases hu : u ∈ R.support + · obtain ⟨R₁, R₂, rfl⟩ := R.exists_append_of_mem hu + have hR₂ : R₂.IsSimple := by + have hn : (R₁.support ++ R₂.support.tail).Nodup := by + have h' : (R₁.append R₂).support.Nodup := hR + rwa [GraphWalk.support_append] at h' + have hd := List.nodup_append.mp hn + unfold GraphWalk.IsSimple + rw [R₂.support_eq_cons] + exact List.nodup_cons.mpr ⟨fun hx => hd.2.2 u R₁.end_mem_support u hx rfl, hd.2.1⟩ + refine ⟨R₂, hR₂, fun x hx => ?_, fun e' he' => ?_⟩ + · exact List.mem_cons_of_mem _ (hs x ((GraphWalk.mem_support_append _ _).mpr (Or.inr hx))) + · refine List.mem_cons_of_mem _ (he e' ?_) + rw [GraphWalk.edges_append] + exact List.mem_append_right _ he' + · refine ⟨.cons h R, List.nodup_cons.mpr ⟨hu, hR⟩, fun x hx => ?_, fun e' he' => ?_⟩ + · rcases List.mem_cons.mp hx with rfl | hx + · simp + · exact List.mem_cons_of_mem _ (hs x hx) + · rcases List.mem_cons.mp he' with rfl | he' + · simp + · exact List.mem_cons_of_mem _ (he _ he') + +/-- A walk that ends in `A` has a first vertex in `A`. -/ +theorem GraphWalk.exists_prefix {α : Type u} {β : Type*} {G : Graph α β} {u v : α} + (W : GraphWalk G u v) (A : Set α) (hv : v ∈ A) : + ∃ (z : α) (W' : GraphWalk G u z), z ∈ A ∧ (∀ x ∈ W'.support, x ∈ A → x = z) ∧ + (∀ x ∈ W'.support, x ∈ W.support) ∧ (∀ e ∈ W'.edges, e ∈ W.edges) ∧ + (W.IsSimple → W'.IsSimple) := by + induction W with + | nil h => + refine ⟨_, .nil h, hv, ?_, fun _ h => h, fun _ h => h, fun h => h⟩ + intro x hx _ + simpa using hx + | @cons u v w e h r ih => + by_cases hu : u ∈ A + · refine ⟨u, .nil h.left_mem, hu, ?_, ?_, ?_, ?_⟩ + · intro x hx _ + simpa using hx + · intro x hx + simp only [GraphWalk.support_nil, List.mem_singleton] at hx + simp [hx] + · simp + · intro _ + simp [GraphWalk.IsSimple] + · obtain ⟨z, W', hz, h₁, h₂, h₃, h₄⟩ := ih hv + refine ⟨z, .cons h W', hz, ?_, ?_, ?_, ?_⟩ + · intro x hx hxA + rcases List.mem_cons.mp hx with rfl | hx + · exact absurd hxA hu + · exact h₁ x hx hxA + · intro x hx + rcases List.mem_cons.mp hx with rfl | hx + · simp + · exact List.mem_cons_of_mem _ (h₂ x hx) + · intro e' he' + rcases List.mem_cons.mp he' with rfl | he' + · simp + · exact List.mem_cons_of_mem _ (h₃ _ he') + · intro hs + have hs' := List.nodup_cons.mp hs + exact List.nodup_cons.mpr ⟨fun hx => hs'.1 (h₂ u hx), h₄ hs'.2⟩ + +/-- The subhypergraph of a hypergraph on a vertex set and an edge set closed under ends. -/ +private def restrictHyper {α β : Type*} (G : Hypergraph α β) (V' : Set α) (E' : Set β) + (hV : V' ⊆ G.vertexSet) (hE : E' ⊆ G.edgeSet) (hends : ∀ e ∈ E', ∀ v, G.Inc e v → v ∈ V') : + Hypergraph α β where + vertexSet := V' + edgeSet := E' + Inc e v := e ∈ E' ∧ G.Inc e v + vertex_mem_of_inc _ _ h := hends _ h.1 _ h.2 + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := G.vertexSet_finite.subset hV + edgeSet_finite := G.edgeSet_finite.subset hE + +private theorem restrictHyper_le {α β : Type*} (G : Hypergraph α β) (V' : Set α) (E' : Set β) + (hV : V' ⊆ G.vertexSet) (hE : E' ⊆ G.edgeSet) (hends : ∀ e ∈ E', ∀ v, G.Inc e v → v ∈ V') : + restrictHyper G V' E' hV hE hends ≤ G := by + refine ⟨hV, hE, fun e he => ?_⟩ + ext v + exact ⟨fun h => ⟨he, h⟩, fun h => h.2⟩ + +omit [TopologicalSpace S] in +/-- Two distinct members of `{a, b}` are `a` and `b`. -/ +private theorem pair_of_ne {X : Set S} {a b t v : S} (h : X = {a, b}) (ht : t ∈ X) (hv : v ∈ X) + (hne : t ≠ v) : X = {t, v} := by + rw [h] at ht hv ⊢ + rcases ht with rfl | ht <;> rcases hv with rfl | hv + · exact absurd rfl hne + · rw [mem_singleton_iff.mp hv] + · rw [mem_singleton_iff.mp ht, pair_comm] + · rw [mem_singleton_iff.mp ht, mem_singleton_iff.mp hv] at hne + exact absurd rfl hne + +/-- A simple walk that meets `V(D)` only in its last vertex has no edge in `D`. -/ +private theorem edge_notMem_of_first {Γ' D : Drawing S} (hDs : D.IsSubdrawing Γ') {y z : S} + (Q : GraphWalk Γ'.toGraph y z) (hQ : Q.IsSimple) + (hfirst : ∀ x ∈ Q.support, x ∈ D.V → x = z) {e : Set S} (he : e ∈ Q.edges) : e ∉ D.E := by + intro heD + obtain ⟨a, b, W₁, h', W₂, rfl⟩ := exists_split_edge Q he + have hlD : D.toGraph.IsLink e a b := (hDs.isLink_iff heD).mpr h' + have haQ : a ∈ (W₁.append (GraphWalk.cons h' W₂)).support := + (GraphWalk.mem_support_append _ _).mpr (Or.inl W₁.end_mem_support) + have hbQ : b ∈ (W₁.append (GraphWalk.cons h' W₂)).support := + (GraphWalk.mem_support_append _ _).mpr (Or.inr (by simp [W₂.start_mem_support])) + have ha := hfirst a haQ hlD.2.1 + have hb := hfirst b hbQ hlD.2.2.1 + have hsplit : ((W₁.support ++ (GraphWalk.cons h' W₂).support.tail).Nodup) := by + have h'' : (W₁.append (GraphWalk.cons h' W₂)).support.Nodup := hQ + rwa [GraphWalk.support_append] at h'' + have hd := List.nodup_append.mp hsplit + exact hd.2.2 a W₁.end_mem_support b W₂.start_mem_support (ha.trans hb.symm) + +variable [T2Space S] + +/-- The extension step: if `f` shares a vertex with an edge of a circuit `D` through `e₀`, then a +circuit passes through `e₀` and `f`. This uses that `Γ'` has no separation of order one. -/ +private theorem circuit_step {Γ' D : Drawing S} (hns : Γ'.IsNonSeparable) (hD : D.IsCircuit) + (hDs : D.IsSubdrawing Γ') {e₀ g f : Set S} (he₀ : e₀ ∈ D.E) (hg : g ∈ D.E) (hf : f ∈ Γ'.E) + (hfD : f ∉ D.E) {x : S} (hxg : x ∈ closure g) (hxf : x ∈ closure f) (hxV : x ∈ Γ'.V) : + ∃ D' : Drawing S, D'.IsCircuit ∧ D'.IsSubdrawing Γ' ∧ e₀ ∈ D'.E ∧ f ∈ D'.E := by + classical + have hxD : x ∈ D.V := by + have : x ∈ closure g ∩ D.V := by rw [hDs.closure_inter_V hg]; exact ⟨hxg, hxV⟩ + exact this.2 + -- The other end `y` of `f`. + obtain ⟨p, q, hpq⟩ := (Γ'.toGraph.edge_mem_iff_exists_isLink f).mp hf + obtain ⟨y, hxy⟩ : ∃ y, Γ'.toGraph.IsLink f x y := by + have hx : x ∈ closure f ∩ Γ'.V := ⟨hxf, hxV⟩ + rw [hpq.2.2.2] at hx + rcases hx with rfl | hx + · exact ⟨q, hpq⟩ + · exact ⟨p, by rw [mem_singleton_iff.mp hx]; exact hpq.symm⟩ + set T : Set S := {z | ∃ W : GraphWalk Γ'.toGraph y z, x ∉ W.support} with hT + have hxT : x ∉ T := fun ⟨W, hW⟩ => hW W.end_mem_support + have hmeet : ∃ z ∈ T, z ∈ D.V := by + by_contra hcon + push Not at hcon + -- Otherwise the vertices reachable from `y` avoiding `x` give a separation of order one. + have hyT : y ∈ T ∨ y = x := by + by_cases h : y = x + · exact Or.inr h + · refine Or.inl ⟨.nil hxy.right_mem, ?_⟩ + simpa using fun h' : x = y => h h'.symm + set EB : Set (Set S) := {h | h ∈ Γ'.E ∧ (h = f ∨ ∃ t ∈ T, t ∈ closure h)} with hEB + set G := Γ'.toHypergraph with hG + have hInc : ∀ e v, G.Inc e v ↔ e ∈ Γ'.E ∧ v ∈ Γ'.V ∧ v ∈ closure e := fun _ _ => Iff.rfl + have hendB : ∀ e ∈ EB, ∀ v, G.Inc e v → v ∈ T ∪ {x} := by + rintro e ⟨heE, rfl | ⟨t, ⟨W, hW⟩, hte⟩⟩ v hv + · have hv' : v ∈ closure e ∩ Γ'.V := ⟨hv.2.2, hv.2.1⟩ + rw [hxy.2.2.2] at hv' + rcases hv' with rfl | hv' + · exact Or.inr rfl + · rw [mem_singleton_iff.mp hv'] + rcases hyT with h | h + · exact Or.inl h + · exact Or.inr h + · by_cases hvx : v = x + · exact Or.inr hvx + · refine Or.inl ?_ + by_cases hvt : v = t + · exact hvt ▸ ⟨W, hW⟩ + obtain ⟨a, b, hab⟩ := (Γ'.toGraph.edge_mem_iff_exists_isLink e).mp heE + have htab : t ∈ closure e ∩ Γ'.V := + ⟨hte, W.mem_vertexSet_of_mem_support W.end_mem_support⟩ + have hvab : v ∈ closure e ∩ Γ'.V := ⟨hv.2.2, hv.2.1⟩ + have hlink : Γ'.toGraph.IsLink e t v := + ⟨heE, htab.2, hvab.2, pair_of_ne hab.2.2.2 htab hvab (Ne.symm hvt)⟩ + refine ⟨W.append (.cons hlink (.nil hlink.right_mem)), ?_⟩ + intro hmem + rcases (GraphWalk.mem_support_append _ _).mp hmem with hmem | hmem + · exact hW hmem + · simp only [GraphWalk.support_cons, GraphWalk.support_nil, List.mem_cons, + List.not_mem_nil, or_false] at hmem + rcases hmem with hmem | hmem + · exact hW (hmem ▸ W.end_mem_support) + · exact hvx hmem.symm + have hEBsub : EB ⊆ G.edgeSet := fun h hh => hh.1 + have hVB : T ∪ {x} ⊆ G.vertexSet := by + rintro z (⟨W, -⟩ | rfl) + · exact W.mem_vertexSet_of_mem_support W.end_mem_support + · exact hxV + have hendA : ∀ e ∈ G.edgeSet \ EB, ∀ v, G.Inc e v → v ∈ G.vertexSet \ T := by + rintro e ⟨heE, heB⟩ v hv + exact ⟨hv.2.1, fun hvT => heB ⟨heE, Or.inr ⟨v, hvT, hv.2.2⟩⟩⟩ + set A := restrictHyper G (G.vertexSet \ T) (G.edgeSet \ EB) sdiff_subset sdiff_subset hendA + with hA + set B := restrictHyper G (T ∪ {x}) EB hVB hEBsub hendB with hB + have hAle : A ≤ G := restrictHyper_le _ _ _ _ _ _ + have hBle : B ≤ G := restrictHyper_le _ _ _ _ _ _ + have hsep : G.IsSeparation A B := by + refine ⟨hAle, hBle, ?_, ?_⟩ + · refine Hypergraph.ext ?_ ?_ ?_ + · ext v + constructor + · rintro (h | h) + · exact h.1 + · exact hVB h + · intro h + by_cases hv : v ∈ T + · exact Or.inr (Or.inl hv) + · exact Or.inl ⟨h, hv⟩ + · ext e + constructor + · rintro (h | h) + · exact h.1 + · exact h.1 + · intro h + by_cases he : e ∈ EB + · exact Or.inr he + · exact Or.inl ⟨h, he⟩ + · funext e v + apply propext + constructor + · rintro (h | h) + · exact h.2 + · exact h.2 + · intro h + by_cases he : e ∈ EB + · exact Or.inr ⟨he, h⟩ + · exact Or.inl ⟨⟨G.edge_mem_of_inc h, he⟩, h⟩ + · ext e + constructor + · rintro ⟨h₁, h₂⟩ + exact h₁.2 h₂ + · exact fun h => h.elim + have hord : separationOrder A B = 1 := by + have : (A ∩ B).vertexSet = {x} := by + ext v + constructor + · rintro ⟨h₁, h₂ | h₂⟩ + · exact absurd h₂ h₁.2 + · exact h₂ + · rintro rfl + exact ⟨⟨hxV, hxT⟩, Or.inr rfl⟩ + rw [separationOrder, this, ncard_singleton] + refine hns.2 A B hsep hord ⟨g, hDs.2 hg, ?_⟩ ⟨f, hf, Or.inl rfl⟩ + rintro ⟨-, hgf | ⟨t, ht, htg⟩⟩ + · exact hfD (hgf ▸ hg) + · have : t ∈ closure g ∩ D.V := by + rw [hDs.closure_inter_V hg] + obtain ⟨W, -⟩ := ht + exact ⟨htg, W.mem_vertexSet_of_mem_support W.end_mem_support⟩ + exact hcon t ht this.2 + obtain ⟨z₀, ⟨W₀, hW₀⟩, hz₀⟩ := hmeet + obtain ⟨W₁, hW₁, hs₁, -⟩ := GraphWalk.exists_isSimple W₀ + obtain ⟨z, Q, hzD, hfirst, hsQ, heQ, hQs⟩ := GraphWalk.exists_prefix W₁ D.V hz₀ + have hQ : Q.IsSimple := hQs hW₁ + have hxQ : x ∉ Q.support := fun h => hW₀ (hs₁ x (hsQ x h)) + have hzx : x ≠ z := fun h => hxQ (h ▸ Q.end_mem_support) + have hRs : (GraphWalk.cons hxy Q).IsSimple := List.nodup_cons.mpr ⟨hxQ, hQ⟩ + have hPs := walkDrawing_isSubdrawing Γ' (GraphWalk.cons hxy Q) + have hPp : (walkDrawing Γ' (GraphWalk.cons hxy Q)).IsPathBetween x z := + walkDrawing_isPathBetween Γ' hRs + have hPV := walkDrawing_V Γ' (GraphWalk.cons hxy Q) + have hPE := walkDrawing_E Γ' (GraphWalk.cons hxy Q) + obtain ⟨P₁, P₂, hP₁, hP₂, hP₁s, hP₂s, -, -, hV₁₂, -, hsup⟩ := hD.exists_two_paths hxD hzD hzx + have hkey : ∀ P' : Drawing S, P'.IsPathBetween x z → P'.IsSubdrawing D → x ∈ P'.V → z ∈ P'.V → + e₀ ∈ P'.E → + ∃ D' : Drawing S, D'.IsCircuit ∧ D'.IsSubdrawing Γ' ∧ e₀ ∈ D'.E ∧ f ∈ D'.E := by + intro P' hP' hP's hxP' hzP' he₀P' + have hP'' := hP's.trans hDs + have hV : (walkDrawing Γ' (GraphWalk.cons hxy Q)).V ∩ P'.V = {x, z} := by + ext v + constructor + · rintro ⟨h₁, h₂⟩ + rw [hPV] at h₁ + rcases List.mem_cons.mp h₁ with rfl | h₁ + · exact Or.inl rfl + · exact Or.inr (hfirst v h₁ (hP's.1 h₂)) + · rintro (rfl | hv) + · refine ⟨?_, hxP'⟩ + rw [hPV] + exact GraphWalk.start_mem_support _ + · rw [mem_singleton_iff.mp hv] + refine ⟨?_, hzP'⟩ + rw [hPV] + exact GraphWalk.end_mem_support _ + have hE : Disjoint (walkDrawing Γ' (GraphWalk.cons hxy Q)).E P'.E := by + refine disjoint_left.mpr fun e he heP' => ?_ + rw [hPE] at he + have heD : e ∈ D.E := hP's.2 heP' + rcases List.mem_cons.mp he with rfl | he + · exact hfD heD + · exact edge_notMem_of_first hDs Q hQ hfirst he heD + refine ⟨Γ'.sup _ P', Drawing.isCircuit_sup hPp hP' hPs hP'' hzx hV hE, + Drawing.sup_isSubdrawing _ _ _, ?_, ?_⟩ + · rw [Drawing.sup_E hPs hP''] + exact Or.inr he₀P' + · rw [Drawing.sup_E hPs hP'', hPE] + exact Or.inl (by simp) + have hxz : x ∈ P₁.V ∩ P₂.V ∧ z ∈ P₁.V ∩ P₂.V := by rw [hV₁₂]; simp + have he₀' : e₀ ∈ P₁.E ∪ P₂.E := by + have : e₀ ∈ (D.sup P₁ P₂).E := by rw [hsup]; exact he₀ + rwa [Drawing.sup_E hP₁s hP₂s] at this + rcases he₀' with h | h + · exact hkey P₁ hP₁ hP₁s hxz.1.1 hxz.2.1 h + · exact hkey P₂ hP₂ hP₂s hxz.1.2 hxz.2.2 h + +/-- Graph theory of non-separable drawings: every edge lies on a circuit with a fixed edge of a +given circuit. -/ +theorem exists_circuit_through {Γ' C : Drawing S} (hns : Γ'.IsNonSeparable) (hC : C.IsCircuit) + (hCs : C.IsSubdrawing Γ') {e₀ f : Set S} (he₀ : e₀ ∈ C.E) (hf : f ∈ Γ'.E) : + ∃ D : Drawing S, D.IsCircuit ∧ D.IsSubdrawing Γ' ∧ e₀ ∈ D.E ∧ f ∈ D.E := by + classical + set Y : Set S := {v | ∃ D : Drawing S, D.IsCircuit ∧ D.IsSubdrawing Γ' ∧ e₀ ∈ D.E ∧ v ∈ D.V} + with hY + -- An edge at a vertex of `Y` lies on a circuit through `e₀`. + have hstep : ∀ {v : S} {h : Set S}, v ∈ Y → h ∈ Γ'.E → v ∈ closure h → + ∃ D : Drawing S, D.IsCircuit ∧ D.IsSubdrawing Γ' ∧ e₀ ∈ D.E ∧ h ∈ D.E := by + rintro v h ⟨D, hD, hDs, he, hv⟩ hh hvh + by_cases hhD : h ∈ D.E + · exact ⟨D, hD, hDs, he, hhD⟩ + obtain ⟨W, -, hpos, -, hE⟩ := exists_walk_at hD hv + cases W with + | nil _ => simp at hpos + | @cons _ w _ g hl r => + have hg : g ∈ D.E := hl.1 + have hvg : v ∈ closure g := by + have : v ∈ closure g ∩ D.V := by rw [hl.2.2.2]; simp + exact this.1 + exact circuit_step hns hD hDs he hg hh hhD hvg hvh (hDs.1 hv) + -- Walks starting in `Y` stay in `Y`. + have hwalk : ∀ {a b : S} (W : GraphWalk Γ'.toGraph a b), a ∈ Y → b ∈ Y := by + intro a b W + induction W with + | nil _ => exact id + | @cons a v b e hl r ih => + intro ha + refine ih ?_ + have hae : a ∈ closure e := by + have : a ∈ closure e ∩ Γ'.V := by rw [hl.2.2.2]; simp + exact this.1 + obtain ⟨D, hD, hDs, he, heD⟩ := hstep ha hl.1 hae + exact ⟨D, hD, hDs, he, ((hDs.isLink_iff heD).mpr hl).2.2.1⟩ + obtain ⟨a, _, hal⟩ := (C.toGraph.edge_mem_iff_exists_isLink e₀).mp he₀ + have haY : a ∈ Y := ⟨C, hC, hCs, he₀, hal.2.1⟩ + obtain ⟨b, c, hbc⟩ := (Γ'.toGraph.edge_mem_iff_exists_isLink f).mp hf + obtain ⟨W⟩ := hns.1.2 a (hCs.1 hal.2.1) b hbc.2.1 + have hb : b ∈ closure f := by + have : b ∈ closure f ∩ Γ'.V := by rw [hbc.2.2.2]; simp + exact this.1 + exact hstep (hwalk W haY) hf hb + +/-- Graph Minors XI, (4.3)(iii) (page 79): "if $\Gamma'$ is non-separable then $\text{ins}(\Gamma') += \text{ins}(C)$". The +hypotheses are those of (4.3): `Γ'` is confined and `ins(C)` is maximal. -/ +theorem theorem_4_3_iii {Γ Γ' C : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + (hs : IsSlope Γ k ins) (hsub : Γ'.IsSubdrawing Γ) (hconf : IsConfined k Γ') + (hC : C.IsCircuit) (hCs : C.IsSubdrawing Γ') + (hmax : ∀ C' : Drawing S, C'.IsCircuit → C'.IsSubdrawing Γ' → ins C ⊆ ins C' → ins C' ⊆ ins C) + (hns : Γ'.IsNonSeparable) : insOf ins Γ' = ins C := by + have hs' := theorem_4_2_proof hs hsub + have hCl := hconf C hC hCs + have hUC := hs'.U_subset_ins hC hCs hCl + obtain ⟨e₀, he₀⟩ : C.E.Nonempty := by + obtain ⟨u, W, -, hpos, -, hE⟩ := hC + cases W with + | nil _ => simp at hpos + | @cons _ w _ e h r => exact ⟨e, h.1⟩ + -- Every edge of `Γ'` lies in `ins(C)`. + have hedge : ∀ f ∈ Γ'.E, closure f ⊆ ins C := by + intro f hf + obtain ⟨D, hD, hDs, he₀D, hfD⟩ := exists_circuit_through hns hC hCs he₀ hf + obtain ⟨a, b, hab⟩ := (D.toGraph.edge_mem_iff_exists_isLink e₀).mp he₀D + have hlC : C.toGraph.IsLink e₀ a b := + (hCs.isLink_iff he₀).mpr ((hDs.isLink_iff he₀D).mp hab) + by_cases hne : a = b + · -- `e₀` is a loop, so `D` has no other edge. + subst hne + have hE₁ : D.E = {e₀} := IsCircuit.E_eq_of_loop hD he₀D (by simpa using hab.2.2.2) + have hfe : f = e₀ := by rw [hE₁] at hfD; exact hfD + subst hfe + exact (C.closure_subset_U he₀).trans hUC + · obtain ⟨P, Q, hP, hQ, hPs, hQs, -, -, -, -, hsup⟩ := hD.exists_two_paths hab.2.1 hab.2.2.1 hne + have hP' : P.U ⊆ ins C := path_U_subset hP (hPs.trans hDs) fun hW => + theorem_4_3_i hs hsub hconf hC hCs hmax _ hW hlC.2.1 hlC.2.2.1 + have hQ' : Q.U ⊆ ins C := path_U_subset hQ (hQs.trans hDs) fun hW => + theorem_4_3_i hs hsub hconf hC hCs hmax _ hW hlC.2.1 hlC.2.2.1 + have hfPQ : f ∈ P.E ∪ Q.E := by + have : f ∈ (D.sup P Q).E := by rw [hsup]; exact hfD + rwa [Drawing.sup_E hPs hQs] at this + rcases hfPQ with h | h + · exact (P.closure_subset_U h).trans hP' + · exact (Q.closure_subset_U h).trans hQ' + -- Every vertex of `Γ'` lies in `ins(C)`. + have hvertex : ∀ v ∈ Γ'.V, v ∈ ins C := by + intro v hv + obtain ⟨a, hal⟩ : C.V.Nonempty := by + obtain ⟨u, W, -, -, hV, -⟩ := hC + exact ⟨u, by rw [hV]; exact W.start_mem_support⟩ + obtain ⟨W⟩ := hns.1.2 v hv a (hCs.1 hal) + cases W with + | nil _ => exact hUC (C.V_subset_U hal) + | @cons _ w _ e h r => + refine hedge e h.1 ?_ + have : v ∈ closure e ∩ Γ'.V := by rw [h.2.2.2]; simp + exact this.1 + have hU : Γ'.U ⊆ ins C := by + rw [Γ'.U_eq] + exact union_subset hvertex (iUnion₂_subset hedge) + apply subset_antisymm + · refine union_subset hU (iUnion₂_subset ?_) + rintro C' ⟨hC', hC's⟩ + exact hs'.monotone C' C hC' hC's (hconf C' hC' hC's) hC hCs hCl (hC's.U_subset.trans hU) + · exact (subset_biUnion_of_mem (u := ins) + (show C ∈ {C : Drawing S | C.IsCircuit ∧ C.IsSubdrawing Γ'} from ⟨hC, hCs⟩)).trans + subset_union_right + +/-- Graph Minors XI, (4.3) (page 79): "Let $\Gamma'$ be a confined subdrawing of $\Gamma$, and let +$C$ be a circuit of $\Gamma'$ with $\text{ins}(C)$ maximal. Then +(i) $U(P) \subseteq \text{ins}(C)$ for every path $P$ of $\Gamma'$ with both ends in $V(C)$, +(ii) for every edge $e$ of $C$, $\Gamma'$ does not capture the region of $\Gamma$ incident with $e$ +not included in $\text{ins}(C)$, and +(iii) if $\Gamma'$ is non-separable then $\text{ins}(\Gamma') = \text{ins}(C)$." -/ +theorem theorem_4_3_proof {Γ Γ' C : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + (hs : IsSlope Γ k ins) (hsub : Γ'.IsSubdrawing Γ) (hconf : IsConfined k Γ') + (hC : C.IsCircuit) (hCs : C.IsSubdrawing Γ') + (hmax : ∀ C' : Drawing S, C'.IsCircuit → C'.IsSubdrawing Γ' → ins C ⊆ ins C' → ins C' ⊆ ins C) : + (∀ (P : Drawing S) (a b : S), P.IsPathBetween a b → P.IsSubdrawing Γ' → + a ∈ C.V → b ∈ C.V → P.U ⊆ ins C) ∧ + (∀ e r : Set S, e ∈ C.E → (e ∩ closure r).Nonempty → ¬ r ⊆ ins C → + ¬ Captures ins k Γ' r) ∧ + (Γ'.IsNonSeparable → insOf ins Γ' = ins C) := + ⟨fun _ _ _ hP hPs ha hb => + path_U_subset hP hPs fun hW => theorem_4_3_i hs hsub hconf hC hCs hmax _ hW ha hb, + fun _ _ he hinc hnot => theorem_4_3_ii hs hsub hconf hC hCs hmax he hinc hnot, + theorem_4_3_iii hs hsub hconf hC hCs hmax⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section4c.lean b/LeanPool/GraphMinor/GM11/Section4c.lean new file mode 100644 index 0000000000..d3c6782749 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section4c.lean @@ -0,0 +1,567 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.ForestRegions +import Mathlib.Analysis.Normed.Module.Connected +import Mathlib.LinearAlgebra.FiniteDimensional.Lemmas + +/-! +# Graph Minors XI, (4.4) and (4.5) + +Throughout, `Γ` is a drawing in a connected closed surface with a slope `ins`. + +(4.4) says that the complement of `ins(Γ')` is a region of `Γ'`, for `Γ'` confined. We follow the +paper. There is a region not captured, by (4.3)(ii). Any two distinct regions contain a captured +one, +by induction on the number of edges, deleting an edge of a circuit. + +(4.5) says that a region of a confined `Γ'` that `Γ` captures is captured by `Γ'`. The paper says +that some circuit `C'` of `Γ'` bounds a closed disc in `ins(C)` around the region. We prove what is +needed by deleting edges of `Γ'` as long as the region stays in `ins(C)`. + +The topological input on discs is `closedDisc_not_subset_edge`: a neighbourhood in a closed disc is +not contained in an edge. A real-valued injective map on a circle would have `f(x) = f(-x)` +for some `x`, by the intermediate value theorem. +-/ + +public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +/-- No continuous real function on a circle in the plane is injective. -/ +theorem not_injective_sphere {c : EuclideanPlane} {s : ℝ} (hs : 0 < s) + (g : Metric.sphere c s → ℝ) (hg : Continuous g) : ¬ Function.Injective g := by + intro hinj + have hrank : 1 < Module.rank ℝ EuclideanPlane := by + apply Module.lt_rank_of_lt_finrank + simp + have hconn : IsPreconnected (univ : Set (Metric.sphere c s)) := + isPreconnected_iff_preconnectedSpace.mp (isPreconnected_sphere hrank c s) |>.isPreconnected_univ + have hanti : ∀ x : Metric.sphere c s, c - (x.1 - c) ∈ Metric.sphere c s := by + intro x + have hx : ‖x.1 - c‖ = s := by simpa [dist_eq_norm] using x.2 + simp only [mem_sphere_iff_norm, sub_sub_cancel_left, norm_neg, hx] + let σ : Metric.sphere c s → Metric.sphere c s := fun x => ⟨c - (x.1 - c), hanti x⟩ + have hσ : Continuous σ := by + refine Continuous.subtype_mk ?_ _ + fun_prop + have hσσ : ∀ x, σ (σ x) = x := fun x => Subtype.ext (by simp [σ]) + have hne : ∀ x, σ x ≠ x := by + intro x h + have hx : ‖x.1 - c‖ = s := by simpa [dist_eq_norm] using x.2 + have h₁ : c - (x.1 - c) = x.1 := congrArg Subtype.val h + have h₂ : (2 : ℝ) • (x.1 - c) = 0 := by + rw [two_smul] + have : x.1 - c = -(x.1 - c) := by + nth_rw 1 [← h₁] + abel + nth_rw 1 [this] + simp + have h₃ : x.1 - c = 0 := by simpa using h₂ + rw [h₃, norm_zero] at hx + exact hs.ne hx + let d : Metric.sphere c s → ℝ := fun x => g x - g (σ x) + have hd : Continuous d := hg.sub (hg.comp hσ) + obtain ⟨x⟩ : Nonempty (Metric.sphere c s) := by + obtain ⟨x, hx⟩ := (NormedSpace.sphere_nonempty (x := c)).mpr hs.le + exact ⟨⟨x, hx⟩⟩ + have hdσ : d (σ x) = - d x := by simp [d, hσσ] + have hzero : (0 : ℝ) ∈ Icc (min (d x) (d (σ x))) (max (d x) (d (σ x))) := by + rw [hdσ] + rcases le_total (d x) 0 with h | h + · exact ⟨le_trans (min_le_left _ _) h, le_trans (by linarith) (le_max_right _ _)⟩ + · exact ⟨le_trans (min_le_right _ _) (by linarith), le_trans h (le_max_left _ _)⟩ + have hsub : Icc (min (d x) (d (σ x))) (max (d x) (d (σ x))) ⊆ d '' univ := by + rcases le_total (d x) (d (σ x)) with h | h + · rw [min_eq_left h, max_eq_right h] + exact hconn.intermediate_value (mem_univ _) (mem_univ _) hd.continuousOn + · rw [min_eq_right h, max_eq_left h] + exact hconn.intermediate_value (mem_univ _) (mem_univ _) hd.continuousOn + obtain ⟨y, -, hy⟩ := hsub hzero + have : g y = g (σ y) := by linarith [show g y - g (σ y) = 0 from hy] + exact hne y (hinj this).symm + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- A neighbourhood in a closed disc is not contained in an edge. Otherwise a small circle in the +disc would embed in an open interval. -/ +theorem closedDisc_not_subset_edge {Δ W : Set S} (hΔ : IsClosedDisc Δ) (hW : IsOpen W) {p : S} + (hpW : p ∈ W) (hp : p ∈ Δ) (Γ : Drawing S) {e : Set S} (he : e ∈ Γ.E) : ¬ W ∩ Δ ⊆ e := by + intro hsub + obtain ⟨φ⟩ := hΔ + let f : ClosedUnitDisc → S := fun x => (φ x).1 + have hf : Continuous f := continuous_subtype_val.comp φ.continuous + have hfinj : Function.Injective f := fun x y h => φ.injective (Subtype.ext h) + -- A round circle inside the open disc whose image lies in `W`. + let c₀ : ClosedUnitDisc := φ.symm ⟨p, hp⟩ + have hfc : f c₀ = p := by simp [f, c₀] + have hopen : IsOpen {x : ClosedUnitDisc | f x ∈ W} := hW.preimage hf + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp hopen c₀ (by simpa [hfc] using hpW) + have hcl : (c₀ : EuclideanPlane) ∈ closure (OpenUnitDisc : Set EuclideanPlane) := by + have : closure (OpenUnitDisc : Set EuclideanPlane) = ClosedUnitDisc := + closure_ball _ one_ne_zero + rw [this] + exact c₀.2 + obtain ⟨w, hwb, hwO⟩ := Metric.mem_closure_iff.mp hcl δ hδ + let P : Set EuclideanPlane := Metric.ball (c₀ : EuclideanPlane) δ ∩ OpenUnitDisc + have hP : IsOpen P := Metric.isOpen_ball.inter Metric.isOpen_ball + have hwP : w ∈ P := ⟨by rw [Metric.mem_ball, dist_comm]; exact hwO, hwb⟩ + obtain ⟨ρ, hρ, hρP⟩ := Metric.isOpen_iff.mp hP w hwP + let s : ℝ := ρ / 2 + have hs : 0 < s := half_pos hρ + have hsphere : Metric.sphere w s ⊆ P := + (Metric.sphere_subset_closedBall.trans + (Metric.closedBall_subset_ball (half_lt_self hρ))).trans hρP + let i : Metric.sphere w s → ClosedUnitDisc := fun x => + ⟨x.1, Metric.ball_subset_closedBall (hsphere x.2).2⟩ + have hi : Continuous i := Continuous.subtype_mk continuous_subtype_val _ + have hiW : ∀ x, f (i x) ∈ W := fun x => hball (hsphere x.2).1 + have hie : ∀ x, f (i x) ∈ e := fun x => hsub ⟨hiW x, (φ (i x)).2⟩ + -- Move the circle to the interval by the parametrization of `e`. + obtain ⟨γ, hγ, hγ0, hγ1, hinj, hγe⟩ := exists_edge_param Γ he + let Y : Set S := range (fun x => f (i x)) + have : CompactSpace (Metric.sphere w s) := + isCompact_iff_compactSpace.mp (isCompact_sphere _ _) + have hYcpt : IsCompact Y := isCompact_range (hf.comp hi) + let K : Set unitInterval := γ ⁻¹' Y + have hKcpt : IsCompact K := (hYcpt.isClosed.preimage hγ).isCompact + have : CompactSpace K := isCompact_iff_compactSpace.mp hKcpt + have hKIoo : K ⊆ Ioo 0 1 := by + intro t ht + obtain ⟨x, hx⟩ := ht + have hte : γ t ∈ e := by + have := hie x + simpa [hx] using this + refine ⟨unitInterval.pos_iff_ne_zero.mpr ?_, unitInterval.lt_one_iff_ne_one.mpr ?_⟩ + · rintro rfl + exact (he.2.1 hte).2 hγ0 + · rintro rfl + exact (he.2.1 hte).2 hγ1 + let γK : K → S := fun t => γ t.1 + have hγK : Continuous γK := hγ.comp continuous_subtype_val + have hγKinj : Function.Injective γK := fun s t h => + Subtype.ext (hinj (hKIoo s.2) (hKIoo t.2) h) + have hγKemb : IsClosedEmbedding γK := hγK.isClosedEmbedding hγKinj + have hch : ∀ x, ∃ t : K, γK t = f (i x) := by + intro x + have hmem : f (i x) ∈ e := hie x + rw [← hγe] at hmem + obtain ⟨t, -, ht⟩ := hmem + exact ⟨⟨t, ⟨x, ht.symm⟩⟩, ht⟩ + choose τ hτ using hch + have hτc : Continuous τ := by + refine hγKemb.isInducing.continuous_iff.mpr ?_ + have : γK ∘ τ = fun x => f (i x) := funext hτ + rw [this] + exact hf.comp hi + have hinj' : Function.Injective fun x => ((τ x).1 : ℝ) := by + intro x y hxy + have h₁ : τ x = τ y := Subtype.ext (Subtype.ext hxy) + have h₂ : f (i x) = f (i y) := by rw [← hτ, ← hτ, h₁] + have h₃ := hfinj h₂ + have h₄ : (x : EuclideanPlane) = y := congrArg (fun z : ClosedUnitDisc => z.1) h₃ + exact Subtype.ext h₄ + exact not_injective_sphere hs _ (continuous_subtype_val.comp + (continuous_subtype_val.comp hτc)) hinj' + +variable {Γ : Drawing S} + +/-- A region of a subdrawing either lies in `ins(C)` or misses it, since it misses the frontier +`U(C)` of `ins(C)`. -/ +theorem region_subset_or_disjoint {Γ' C : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + (hs : IsSlope Γ' k ins) (hC : C.IsCircuit) (hCs : C.IsSubdrawing Γ') (hl : C.length < k) + {r : Set S} (hr : r ∈ Γ'.R) : r ⊆ ins C ∨ Disjoint r (ins C) := by + have hcl : IsClosed (ins C) := (hs.isClosedDisc C hC hCs hl).isClosed + have hfr : frontier (ins C) = C.U := by rw [subBd_eq_frontier', hs.subBd_eq C hC hCs hl] + have hcov : r ⊆ interior (ins C) ∪ (ins C)ᶜ := by + intro x hx + by_cases hxi : x ∈ ins C + · refine Or.inl ?_ + by_contra hxn + exact region_subset hr hx (hCs.U_subset (hfr ▸ ⟨subset_closure hxi, hxn⟩)) + · exact Or.inr hxi + have hdis : Disjoint (interior (ins C)) (ins C)ᶜ := + disjoint_left.mpr fun x hx hx' => hx' (interior_subset hx) + by_cases hmeet : (r ∩ ins C).Nonempty + · refine Or.inl (subset_trans ?_ interior_subset) + obtain ⟨x, hxr, hxi⟩ := hmeet + have hxint : x ∈ interior (ins C) := by + rcases hcov hxr with h | h + · exact h + · exact absurd hxi h + exact (region_isPreconnected hr).subset_left_of_subset_union isOpen_interior + hcl.isOpen_compl hdis hcov ⟨x, hxr, hxint⟩ + · exact Or.inr (disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp hmeet)) + +/-- Every edge of a circuit `C` of `Γ'` is incident with a region of `Γ'` inside `ins(C)` and with +a region not inside `ins(C)`. -/ +theorem exists_regions_of_circuit_edge (hS : IsClosedSurface S) + {Γ' C : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + (hs : IsSlope Γ' k ins) (hC : C.IsCircuit) (hCs : C.IsSubdrawing Γ') (hl : C.length < k) + {e : Set S} (he : e ∈ C.E) : + (∃ r ∈ Γ'.R, e ⊆ closure r ∧ r ⊆ ins C) ∧ ∃ r ∈ Γ'.R, e ⊆ closure r ∧ ¬ r ⊆ ins C := by + have heΓ : e ∈ Γ'.E := hCs.2 he + obtain ⟨p, hp⟩ := he.1 + obtain ⟨W, A₁, A₂, hW, hpW, hsub, hcov, h₁, h₂, d₁, d₂, c₁, c₂⟩ := + exists_edge_sides hS Γ' heΓ hp + have heU : e ⊆ C.U := fun x hx => (he.2.1 hx).1 + have hUins := hs.U_subset_ins hC hCs hl + -- Regions through a side of `e` near `p`. + have hreg : ∀ x ∈ W, x ∉ Γ'.U → ∃ r ∈ Γ'.R, x ∈ r ∧ e ⊆ closure r := by + intro x hxW hxU + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem hxU + refine ⟨r, hr, hxr, edge_subset_closure_of_incident hS heΓ hr ⟨p, hp, ?_⟩⟩ + rcases hcov ⟨hxW, hxU⟩ with hx | hx + · exact closure_mono (subset_region hr h₁ d₁ hx hxr) (c₁ ⟨hp, hpW⟩) + · exact closure_mono (subset_region hr h₂ d₂ hx hxr) (c₂ ⟨hp, hpW⟩) + constructor + · -- A point of `ins(C)` near `p` that is not on `e`. + have hnot := closedDisc_not_subset_edge (hs.isClosedDisc C hC hCs hl) hW hpW (hUins (heU hp)) + Γ' heΓ + obtain ⟨x, ⟨hxW, hxin⟩, hxe⟩ := not_subset.mp hnot + have hxU : x ∉ Γ'.U := fun h => hxe (hsub ⟨hxW, h⟩) + obtain ⟨r, hr, hxr, hinc⟩ := hreg x hxW hxU + refine ⟨r, hr, hinc, ?_⟩ + rcases region_subset_or_disjoint hs hC hCs hl hr with h | h + · exact h + · exact absurd hxin (disjoint_left.mp h hxr) + · -- A point outside `ins(C)` near `p`. + have hpfr : p ∈ closure (univ \ ins C) := by + have : p ∈ subBd (ins C) := by + rw [hs.subBd_eq C hC hCs hl] + exact heU hp + exact this.2 + obtain ⟨x, hxW, hxout⟩ := mem_closure_iff.mp hpfr W hW hpW + have hxU : x ∉ Γ'.U := fun h => hxout.2 (hUins (heU (hsub ⟨hxW, h⟩))) + obtain ⟨r, hr, hxr, hinc⟩ := hreg x hxW hxU + exact ⟨r, hr, hinc, fun h => hxout.2 (h hxr)⟩ + +/-- A region not incident with `e` is a region after `e` is deleted. -/ +theorem region_deleteEdge_of_not_incident [LocallyConnectedSpace S] {e r : Set S} (he : e ∈ Γ.E) + (hr : r ∈ Γ.R) (hinc : Disjoint e (closure r)) : r ∈ (Γ.deleteEdge e).R := by + obtain ⟨x, hxr⟩ := region_nonempty hr + have hxU : x ∉ Γ.U := region_subset hr hxr + have hU := deleteEdge_U Γ he + have hxU' : x ∉ (Γ.deleteEdge e).U := by + rw [hU] + exact fun h => hxU h.1 + refine (mem_R_iff _).mpr ⟨x, hxU', subset_antisymm ?_ ?_⟩ + · refine (region_isPreconnected hr).subset_connectedComponentIn hxr ?_ + intro y hy + refine ⟨mem_univ _, ?_⟩ + rw [hU] + exact fun h => region_subset hr hy h.1 + · have hcov : connectedComponentIn (univ \ (Γ.deleteEdge e).U) x ⊆ r ∪ (closure r)ᶜ := by + intro y hy + by_cases hyc : y ∈ closure r + · refine Or.inl ?_ + rcases closure_region_subset hr hyc with h | h + · exact h + · exfalso + have hy' := (connectedComponentIn_subset _ _ hy).2 + rw [hU] at hy' + have hye : y ∈ e := by + by_contra hye + exact hy' ⟨h, hye⟩ + exact disjoint_left.mp hinc hye hyc + · exact Or.inr hyc + refine (isPreconnected_connectedComponentIn).subset_left_of_subset_union (region_isOpen hr) + isClosed_closure.isOpen_compl ?_ hcov ⟨x, ?_, hxr⟩ + · exact disjoint_left.mpr fun y hy h => h (subset_closure hy) + · exact mem_connectedComponentIn ⟨mem_univ _, hxU'⟩ + +omit [T2Space S] in +/-- Every region lies in a region of any subdrawing. -/ +theorem exists_region_superset {Γ' : Drawing S} (hsub : Γ'.IsSubdrawing Γ) {r : Set S} + (hr : r ∈ Γ.R) : ∃ r' ∈ Γ'.R, r ⊆ r' := by + obtain ⟨x, hxr⟩ := region_nonempty hr + have hxU : x ∉ Γ'.U := fun h => region_subset hr hxr (hsub.U_subset h) + obtain ⟨r', hr', hxr'⟩ := exists_region_of_notMem hxU + exact ⟨r', hr', subset_region hr' (region_isPreconnected hr) + (disjoint_left.mpr fun y hy h => region_subset hr hy (hsub.U_subset h)) hxr hxr'⟩ + +/-- A point in any nonempty open set is off `U(Γ)`. A drawing has empty interior. -/ +theorem exists_notMem_U (hS : IsClosedSurface S) + {O : Set S} (hO : IsOpen O) (hne : O.Nonempty) : + ∃ y ∈ O, y ∉ Γ.U := by + obtain ⟨x, hx⟩ := hne + -- First a point off the vertices. + obtain ⟨y, hyO, hyV⟩ : ∃ y ∈ O, y ∉ Γ.V := by + have hF : IsOpen (O ∩ (Γ.V \ {x})ᶜ) := + hO.inter (Γ.finite_V.subset sdiff_subset).isClosed.isOpen_compl + obtain ⟨Z, -, -, hZsub, -, hZcl⟩ := exists_punctured_nbhd hS hF ⟨hx, fun h => h.2 rfl⟩ + obtain ⟨y, hy⟩ : (Z \ {x}).Nonempty := by + by_contra hcon + rw [not_nonempty_iff_eq_empty] at hcon + rw [hcon, closure_empty] at hZcl + exact hZcl + exact ⟨y, (hZsub hy.1).1, fun hyV => (hZsub hy.1).2 ⟨hyV, hy.2⟩⟩ + by_cases hyU : y ∈ Γ.U + · obtain ⟨e, he, hye⟩ := Γ.exists_edge_of_mem hyU hyV + obtain ⟨W, A₁, A₂, hW, hyW, -, -, -, -, d₁, -, c₁, -⟩ := exists_edge_sides hS Γ he hye + obtain ⟨a, ⟨haW, haO⟩, ha⟩ := mem_closure_iff.mp (c₁ ⟨hye, hyW⟩) _ (hW.inter hO) ⟨hyW, hyO⟩ + exact ⟨a, haO, disjoint_left.mp d₁ ha⟩ + · exact ⟨y, hyO, hyU⟩ + +omit [T2Space S] in +/-- If a drawing has a circuit, some circuit `C` has `ins(C)` maximal. -/ +theorem exists_maximal_circuit {Γ' C₀ : Drawing S} (ins : Drawing S → Set S) (hC₀ : C₀.IsCircuit) + (hC₀s : C₀.IsSubdrawing Γ') : + ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing Γ' ∧ + ∀ C' : Drawing S, C'.IsCircuit → C'.IsSubdrawing Γ' → ins C ⊆ ins C' → ins C' ⊆ ins C := by + let 𝓒 : Set (Drawing S) := {C | C.IsCircuit ∧ C.IsSubdrawing Γ'} + have hfin : 𝓒.Finite := by + refine Set.Finite.of_finite_image (f := fun C : Drawing S => (C.V, C.E)) ?_ ?_ + · refine (Γ'.finite_V.finite_subsets.prod Γ'.finite_edges.finite_subsets).subset ?_ + rintro _ ⟨C, ⟨-, hs⟩, rfl⟩ + exact ⟨hs.1, hs.2⟩ + · intro C _ D _ h + have h₁ : C.V = D.V := congrArg Prod.fst h + have h₂ : C.E = D.E := congrArg Prod.snd h + exact Drawing.ext_of_V_E h₁ h₂ + obtain ⟨X, hX⟩ := (hfin.image ins).exists_maximal ⟨_, C₀, ⟨hC₀, hC₀s⟩, rfl⟩ + obtain ⟨C, ⟨hC, hCs⟩, rfl⟩ := hX.1 + exact ⟨C, hC, hCs, fun C' hC' hC's h => hX.2 ⟨C', ⟨hC', hC's⟩, rfl⟩ h⟩ + +omit [T2Space S] in +theorem IsCircuit.E_nonempty {C : Drawing S} (hC : C.IsCircuit) : C.E.Nonempty := by + obtain ⟨u, W, -, hpos, -, hE⟩ := hC + cases W with + | nil _ => simp at hpos + | @cons _ w _ e h r => exact ⟨e, h.1⟩ + +omit [T2Space S] in +/-- Either an edge is incident with a region, or it misses the closure of the region. -/ +theorem edge_incident_or_disjoint (hS : IsClosedSurface S) + {e r : Set S} (he : e ∈ Γ.E) (hr : r ∈ Γ.R) : + e ⊆ closure r ∨ Disjoint e (closure r) := by + by_cases h : (e ∩ closure r).Nonempty + · exact Or.inl (edge_subset_closure_of_incident hS he hr h) + · exact Or.inr (disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp h)) + +/-- The inductive claim in the proof of (4.4) (page 80): if `r₁, r₂` are distinct regions of a +confined `Γ'`, then `Γ'` captures at least one of them. -/ +theorem captures_of_ne (hS : IsClosedSurface S) [PreconnectedSpace S] + {k : ℕ} {ins : Drawing S → Set S} (hs : IsSlope Γ k ins) + {Γ' : Drawing S} (hsub : Γ'.IsSubdrawing Γ) (hconf : IsConfined k Γ') {r₁ r₂ : Set S} + (h₁ : r₁ ∈ Γ'.R) (h₂ : r₂ ∈ Γ'.R) (hne : r₁ ≠ r₂) : + Captures ins k Γ' r₁ ∨ Captures ins k Γ' r₂ := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + induction hn : Γ'.E.ncard using Nat.strong_induction_on generalizing Γ' r₁ r₂ with + | _ n ih => + have hs' := theorem_4_2_proof hs hsub + by_cases hcirc : ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing Γ' + · obtain ⟨C, hC, hCs⟩ := hcirc + have hl := hconf C hC hCs + obtain ⟨e, he⟩ := IsCircuit.E_nonempty hC + have heΓ : e ∈ Γ'.E := hCs.2 he + obtain ⟨⟨r', hr', hinc', hsubC⟩, -⟩ := exists_regions_of_circuit_edge hS hs' hC hCs hl he + have hcap : ∀ r, r = r' → Captures ins k Γ' r := fun r hrr => ⟨C, hC, hCs, hl, hrr ▸ hsubC⟩ + by_cases he₁ : r₁ = r' + · exact Or.inl (hcap _ he₁) + by_cases he₂ : r₂ = r' + · exact Or.inr (hcap _ he₂) + -- The step with `r₁` not incident with `e`. + have hstep : ∀ {a b : Set S}, a ∈ Γ'.R → b ∈ Γ'.R → a ≠ b → Disjoint e (closure a) → + Captures ins k Γ' a ∨ Captures ins k Γ' b := by + intro a b ha hb hab hda + have hdel := deleteEdge_isSubdrawing Γ' e + have ha' := region_deleteEdge_of_not_incident heΓ ha hda + obtain ⟨b', hb', hbsub⟩ := exists_region_superset hdel hb + have hab' : a ≠ b' := by + rintro rfl + obtain ⟨x, hx⟩ := region_nonempty hb + exact hab (region_eq_of_mem ha hb (hbsub hx) hx) + have hlt : (Γ'.deleteEdge e).E.ncard < n := by + rw [deleteEdge_E, ← hn] + exact Set.ncard_sdiff_singleton_lt_of_mem heΓ Γ'.finite_edges + have hconf' : IsConfined k (Γ'.deleteEdge e) := fun D hD hDs => hconf D hD (hDs.trans hdel) + rcases ih _ hlt (hdel.trans hsub) hconf' ha' hb' hab' rfl with + ⟨D, hD, hDs, hl', hin⟩ | ⟨D, hD, hDs, hl', hin⟩ + · exact Or.inl ⟨D, hD, hDs.trans hdel, hl', hin⟩ + · exact Or.inr ⟨D, hD, hDs.trans hdel, hl', hbsub.trans hin⟩ + rcases edge_incident_or_disjoint hS heΓ h₁ with i₁ | d₁ + · rcases edge_incident_or_disjoint hS heΓ h₂ with i₂ | d₂ + · rcases region_incident_two hS heΓ hr' h₁ h₂ hinc' i₁ i₂ with h | h | h + · exact absurd h.symm he₁ + · exact absurd h.symm he₂ + · exact absurd h hne + · exact (hstep h₂ h₁ (Ne.symm hne) d₂).symm + · exact hstep h₁ h₂ hne d₁ + · push Not at hcirc + exact absurd (region_eq_of_noCircuit hS (Γ := Γ') + (fun C hC hCs => hcirc C hC hCs) h₁ h₂) hne + +/-- Graph Minors XI, (4.4) (page 80): "If $\Gamma'$ is confined then $\Sigma - +\operatorname{ins}(\Gamma')$ is a region of $\Gamma'$." +Here `Σ` is a connected closed surface. -/ +theorem theorem_4_4_proof (hS : IsClosedSurface S) [ConnectedSpace S] + {k : ℕ} {ins : Drawing S → Set S} (hs : IsSlope Γ k ins) + {Γ' : Drawing S} (hsub : Γ'.IsSubdrawing Γ) (hconf : IsConfined k Γ') : + univ \ insOf ins Γ' ∈ Γ'.R := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hs' := theorem_4_2_proof hs hsub + -- There is a region that is not captured. + obtain ⟨r₀, hr₀, hnot⟩ : ∃ r₀ ∈ Γ'.R, ¬ Captures ins k Γ' r₀ := by + by_cases hcirc : ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing Γ' + · obtain ⟨C₀, hC₀, hC₀s⟩ := hcirc + obtain ⟨C, hC, hCs, hmax⟩ := exists_maximal_circuit ins hC₀ hC₀s + obtain ⟨e, he⟩ := IsCircuit.E_nonempty hC + obtain ⟨-, r, hr, hinc, hnsub⟩ := + exists_regions_of_circuit_edge hS hs' hC hCs (hconf C hC hCs) he + obtain ⟨x, hx⟩ := he.1 + exact ⟨r, hr, theorem_4_3_ii hs hsub hconf hC hCs hmax he ⟨x, hx, hinc hx⟩ hnsub⟩ + · push Not at hcirc + obtain ⟨y, -, hy⟩ := exists_notMem_U (Γ := Γ') hS isOpen_univ univ_nonempty + obtain ⟨r, hr, -⟩ := exists_region_of_notMem hy + refine ⟨r, hr, ?_⟩ + rintro ⟨C, hC, hCs, -⟩ + exact hcirc C hC hCs + have hEq : univ \ insOf ins Γ' = r₀ := by + ext x + constructor + · rintro ⟨-, hx⟩ + have hxU : x ∉ Γ'.U := fun h => hx (Or.inl h) + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem hxU + have hrc : ¬ Captures ins k Γ' r := by + rintro ⟨C, hC, hCs, -, hin⟩ + exact hx (Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, hCs⟩, hin hxr⟩)) + by_cases hre : r = r₀ + · exact hre ▸ hxr + · rcases captures_of_ne hS hs hsub hconf hr hr₀ hre with h | h + · exact absurd h hrc + · exact absurd h hnot + · intro hx + refine ⟨mem_univ _, ?_⟩ + rintro (hxU | hxC) + · exact region_subset hr₀ hx hxU + · obtain ⟨C, ⟨hC, hCs⟩, hxC⟩ := mem_iUnion₂.mp hxC + have hl := hconf C hC hCs + rcases region_subset_or_disjoint hs' hC hCs hl hr₀ with h | h + · exact hnot ⟨C, hC, hCs, hl, h⟩ + · exact disjoint_left.mp h hx hxC + rw [hEq] + exact hr₀ + +/-- The induction in the proof of (4.5). -/ +private theorem captures_aux (hS : IsClosedSurface S) [PreconnectedSpace S] + {k : ℕ} {ins : Drawing S → Set S} (hs : IsSlope Γ k ins) + {Γ' C : Drawing S} (hsub : Γ'.IsSubdrawing Γ) (hconf : IsConfined k Γ') (hC : C.IsCircuit) + (hCs : C.IsSubdrawing Γ) (hl : C.length < k) {r' : Set S} {Γ'' : Drawing S} + (hsub' : Γ''.IsSubdrawing Γ') {r'' : Set S} (hr'' : r'' ∈ Γ''.R) (hr'r : r' ⊆ r'') + (hrΔ : r'' ⊆ ins C) : Captures ins k Γ' r' := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hΔcl : IsClosed (ins C) := (hs.isClosedDisc C hC hCs hl).isClosed + induction hn : Γ''.E.ncard using Nat.strong_induction_on generalizing Γ'' r'' with + | _ n ih => + have hsubΓ := hsub'.trans hsub + have hs'' := theorem_4_2_proof hs hsubΓ + by_cases hcirc : ∃ D : Drawing S, D.IsCircuit ∧ D.IsSubdrawing Γ'' + · obtain ⟨D, hD, hDs⟩ := hcirc + have hDl := hconf D hD (hDs.trans hsub') + by_cases hdel : ∃ g ∈ D.E, ∃ r₃ ∈ (Γ''.deleteEdge g).R, r'' ⊆ r₃ ∧ r₃ ⊆ ins C + · obtain ⟨g, hg, r₃, hr₃, h₁, h₂⟩ := hdel + have hgΓ : g ∈ Γ''.E := hDs.2 hg + have hlt : (Γ''.deleteEdge g).E.ncard < n := by + rw [deleteEdge_E, ← hn] + exact Set.ncard_sdiff_singleton_lt_of_mem hgΓ Γ''.finite_edges + exact ih _ hlt ((deleteEdge_isSubdrawing Γ'' g).trans hsub') hr₃ (hr'r.trans h₁) h₂ rfl + · push Not at hdel + -- Every edge of `D` is incident with `r''`, so `U(D)` lies in `ins(C)`. + have hincD : ∀ g ∈ D.E, g ⊆ closure r'' := by + intro g hg + rcases edge_incident_or_disjoint hS (hDs.2 hg) hr'' with h | h + · exact h + · exact absurd hrΔ (hdel g hg r'' + (region_deleteEdge_of_not_incident (hDs.2 hg) hr'' h) subset_rfl) + have hclΔ : closure r'' ⊆ ins C := hΔcl.closure_subset_iff.mpr hrΔ + have hclg : ∀ g ∈ D.E, closure g ⊆ ins C := fun g hg => + (closure_minimal (hincD g hg) isClosed_closure).trans hclΔ + have hU : D.U ⊆ ins C := by + rw [D.U_eq] + refine union_subset ?_ (iUnion₂_subset hclg) + intro v hv + obtain ⟨W, -, hpos, -, -⟩ := exists_walk_at hD hv + cases W with + | nil _ => simp at hpos + | @cons _ w _ e h r => + have : v ∈ closure e ∩ D.V := by rw [h.2.2.2]; simp + exact hclg e h.1 this.1 + have hDΓ := (hDs.trans hsub') + have hinsD : ins D ⊆ ins C := + hs.monotone D C hD (hDΓ.trans hsub) hDl hC hCs hl hU + obtain ⟨g, hg⟩ := IsCircuit.E_nonempty hD + have hgΓ : g ∈ Γ''.E := hDs.2 hg + obtain ⟨⟨ri, hri, iin, hrisub⟩, ro, hro, iout, hronot⟩ := + exists_regions_of_circuit_edge hS hs'' hD hDs hDl hg + have hio : ri ≠ ro := fun h => hronot (h ▸ hrisub) + rcases region_incident_two hS hgΓ hri hro hr'' iin iout (hincD g hg) with h | h | h + · exact absurd h hio + · exact ⟨D, hD, hDΓ, hDl, hr'r.trans (h ▸ hrisub)⟩ + · -- Now `r'' = ro`, and the second region at `g` lies in `ins(C)`. + exfalso + have hdels := deleteEdge_isSubdrawing Γ'' g + obtain ⟨r₃, hr₃, hsub₃⟩ := exists_region_superset hdels hr'' + obtain ⟨x, hx₃, hxout⟩ := not_subset.mp (hdel g hg r₃ hr₃ hsub₃) + have hxg : x ∉ g := fun h' => hxout (hclΔ (hincD g hg h')) + have hxU : x ∉ Γ''.U := by + intro h' + have := region_subset hr₃ hx₃ + rw [deleteEdge_U Γ'' hgΓ] at this + exact this ⟨h', hxg⟩ + obtain ⟨t, ht, hxt⟩ := exists_region_of_notMem hxU + rcases edge_incident_or_disjoint hS hgΓ ht with hit | hdt + · rcases region_incident_two hS hgΓ hri hro ht iin iout hit with h' | h' | h' + · exact hio h' + · exact hxout (hinsD (hrisub (h' ▸ hxt))) + · exact hxout (hrΔ (h ▸ h' ▸ hxt)) + · have htdel := region_deleteEdge_of_not_incident hgΓ ht hdt + have ht₃ : t = r₃ := region_eq_of_mem htdel hr₃ hxt hx₃ + obtain ⟨y, hy⟩ := region_nonempty hr'' + have htr : t = r'' := region_eq_of_mem ht hr'' (ht₃ ▸ hsub₃ hy) hy + exact hxout (hrΔ (htr ▸ hxt)) + · -- Without circuits there is only one region, which would be all of `Σ` off `U(Γ'')`. + push Not at hcirc + exfalso + obtain ⟨e, he⟩ := IsCircuit.E_nonempty hC + obtain ⟨x, hx⟩ := he.1 + have hxU : x ∈ subBd (ins C) := by + rw [hs.subBd_eq C hC hCs hl] + exact (he.2.1 hx).1 + obtain ⟨z, hz⟩ : (ins C)ᶜ.Nonempty := by + by_contra hcon + rw [not_nonempty_iff_eq_empty] at hcon + have h₁ := hxU.2 + rw [← compl_eq_univ_sdiff, hcon, closure_empty] at h₁ + exact h₁ + obtain ⟨y, hyO, hyU⟩ := exists_notMem_U (Γ := Γ'') hS hΔcl.isOpen_compl ⟨z, hz⟩ + obtain ⟨t, ht, hyt⟩ := exists_region_of_notMem hyU + have := region_eq_of_noCircuit hS (Γ := Γ'') + (fun D hD hDs => hcirc D hD hDs) ht hr'' + exact hyO (hrΔ (this ▸ hyt)) + +/-- Graph Minors XI, (4.5) (pages 80–81): "Let $\Gamma' \subseteq \Gamma$ be confined, and let $r' +\in R(\Gamma')$. Suppose that +$\Gamma$ captures $r'$. Then so does $\Gamma'$." The paper takes a circuit of `Γ'` bounding a closed +disc +in `ins(C)` around `r'`. We replace this step by `captures_aux`. -/ +theorem theorem_4_5_proof (hS : IsClosedSurface S) [PreconnectedSpace S] + {k : ℕ} {ins : Drawing S → Set S} (hs : IsSlope Γ k ins) + {Γ' : Drawing S} (hsub : Γ'.IsSubdrawing Γ) (hconf : IsConfined k Γ') {r' : Set S} + (hr' : r' ∈ Γ'.R) (hcap : Captures ins k Γ r') : Captures ins k Γ' r' := by + obtain ⟨C, hC, hCs, hl, hin⟩ := hcap + exact captures_aux hS hs hsub hconf hC hCs hl (Drawing.IsSubdrawing.refl Γ') hr' + subset_rfl hin + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section5.lean b/LeanPool/GraphMinor/GM11/Section5.lean new file mode 100644 index 0000000000..f4facd4f5d --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section5.lean @@ -0,0 +1,407 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section4c + +/-! +# Graph Minors XI, Section 5: small sets, (5.1)–(5.3) + +Throughout, `Γ` is a drawing in a connected closed surface with a slope `ins`, and `(Ω, ω)` is a +weighting. + +(5.1) says that regions of `Γ` in one region of a subdrawing `Γ'` are linked by edges not in `Γ'`. +The paper gives this as a sequence of regions. To supply it, we delete the edges of `E(Γ) - E(Γ')` +one at a time: each deletion merges only the regions at that edge. When no edges are left, `Γ` and +`Γ'` differ only in finitely many vertices, and these do not separate a region. + +(5.2) and (5.3) follow the paper. +-/ + +public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- Finite punctures preserve preconnectedness in an open set when points have arbitrarily +small preconnected punctured neighbourhoods that accumulate at the removed point. -/ +theorem isPreconnected_sdiff_finite_of_punctured_nbhd [T2Space S] [LocallyConnectedSpace S] + (hneighbourhood : ∀ {O : Set S}, IsOpen O → ∀ {x : S}, x ∈ O → + ∃ Z : Set S, IsOpen Z ∧ x ∈ Z ∧ Z ⊆ O ∧ IsPreconnected (Z \ {x}) ∧ x ∈ closure (Z \ {x})) + {G F : Set S} (hG : IsOpen G) (hGc : IsPreconnected G) (hF : F.Finite) : + IsPreconnected (G \ F) := by + induction F, hF using Set.Finite.induction_on with + | empty => simpa using hGc + | @insert x F hxF hF ih => + have hEq : G \ insert x F = (G \ F) \ {x} := by + ext y + simp only [mem_sdiff, mem_insert_iff, mem_singleton_iff, not_or] + tauto + rw [hEq] + by_cases hx : x ∈ G \ F + · have hG' : IsOpen (G \ F) := hG.sdiff hF.isClosed + obtain ⟨Z, hZ, hxZ, hZG, hZc, hZcl⟩ := hneighbourhood hG' hx + obtain ⟨a, haZ⟩ : (Z \ {x}).Nonempty := by + by_contra hcon + rw [not_nonempty_iff_eq_empty] at hcon + rw [hcon, closure_empty] at hZcl + exact hZcl + have hcl : IsClosed ((G \ F)ᶜ ∪ {x}) := hG'.isClosed_compl.union isClosed_singleton + refine isPreconnected_sdiff_of_local hG' ih hcl ⟨x, hx, rfl⟩ ⟨hZG haZ.1, haZ.2⟩ ?_ + rintro y hy ⟨t, ⟨-, ht⟩, htc⟩ + obtain rfl : t = x := ht + obtain ⟨b, hbZ, hbC⟩ := mem_closure_iff.mp htc Z hZ hxZ + have hbne : b ≠ t := (connectedComponentIn_subset _ _ hbC).2 + rw [connectedComponentIn_eq hbC] + refine hZc.subset_connectedComponentIn ⟨hbZ, hbne⟩ ?_ haZ + exact fun q hq => ⟨hZG hq.1, hq.2⟩ + · have : (G \ F) \ {x} = G \ F := by + ext y + constructor + · exact fun h => h.1 + · intro hy + exact ⟨hy, fun h => hx (by rw [← mem_singleton_iff.mp h]; exact hy)⟩ + rw [this] + exact ih + +/-- An open connected subset of a closed surface stays connected when finitely many points are +removed. -/ +theorem isPreconnected_sdiff_finite (hS : IsClosedSurface S) {G F : Set S} (hG : IsOpen G) + (hGc : IsPreconnected G) (hF : F.Finite) : IsPreconnected (G \ F) := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + exact isPreconnected_sdiff_finite_of_punctured_nbhd + (fun {_} hO {_} hx => exists_punctured_nbhd hS hO hx) + hG hGc hF + +variable [T2Space S] {Γ : Drawing S} + +theorem deleteEdge_V (Γ : Drawing S) (e : Set S) : (Γ.deleteEdge e).V = Γ.V := by + apply subset_antisymm (Drawing.span_isSubdrawing Γ _ _).1 + intro x hx + exact Or.inl ⟨hx, hx⟩ + +/-- Edge deletion separates coloured regions using local facts about the two sides of each edge. +The drawing property must persist on deleting an edge. When all extra edges have been deleted, +only finitely many vertices remain to remove from the region. -/ +theorem exists_separating_region_edge [LocallyConnectedSpace S] + (P : Drawing S → Prop) (hdelete : ∀ {G : Drawing S}, P G → ∀ e, P (G.deleteEdge e)) + (hincident : ∀ {G : Drawing S}, P G → ∀ {e r : Set S}, e ∈ G.E → r ∈ G.R → + e ⊆ closure r ∨ Disjoint e (closure r)) + (hsides : ∀ {G : Drawing S}, P G → ∀ {e : Set S}, e ∈ G.E → ∀ {p : S}, p ∈ e → + ∃ W A₁ A₂ : Set S, IsOpen W ∧ p ∈ W ∧ W ∩ G.U ⊆ e ∧ W \ G.U ⊆ A₁ ∪ A₂ ∧ + IsPreconnected A₁ ∧ IsPreconnected A₂ ∧ Disjoint A₁ G.U ∧ Disjoint A₂ G.U ∧ + e ∩ W ⊆ closure A₁ ∧ e ∩ W ⊆ closure A₂) + (hpuncture : ∀ {O F : Set S}, IsOpen O → IsPreconnected O → F.Finite → IsPreconnected (O \ F)) + (hP : P Γ) + {Γ' : Drawing S} (hsub : Γ'.IsSubdrawing Γ) {Z : Set (Set S)} + {r' r₁ r₂ : Set S} (hr' : r' ∈ Γ'.R) (h₁ : r₁ ∈ Γ.R) (hz₁ : r₁ ∈ Z) (h₂ : r₂ ∈ Γ.R) + (hz₂ : r₂ ∉ Z) (hs₁ : r₁ ⊆ r') (hs₂ : r₂ ⊆ r') : + ∃ e ∈ Γ.E, e ∉ Γ'.E ∧ ∃ a b : Set S, a ∈ Z ∧ b ∉ Z ∧ a ⊆ r' ∧ b ⊆ r' ∧ + Γ.EdgeRegionIncident e a ∧ Γ.EdgeRegionIncident e b := by + induction hn : (Γ.E \ Γ'.E).ncard using Nat.strong_induction_on generalizing Γ Z r₁ r₂ with + | _ n ih => + by_cases hE : (Γ.E \ Γ'.E).Nonempty + · obtain ⟨e, heΓ, heΓ'⟩ := hE + have hdel := deleteEdge_isSubdrawing Γ e + have hPdel := hdelete hP e + have hUe := deleteEdge_U Γ heΓ + have hsub'' : Γ'.IsSubdrawing (Γ.deleteEdge e) := by + refine ⟨by rw [deleteEdge_V]; exact hsub.1, ?_⟩ + rw [deleteEdge_E] + exact fun f hf => ⟨hsub.2 hf, fun hfe => heΓ' (hfe ▸ hf)⟩ + by_cases hA : ∃ a b : Set S, a ∈ Γ.R ∧ b ∈ Γ.R ∧ a ∈ Z ∧ b ∉ Z ∧ a ⊆ r' ∧ b ⊆ r' ∧ + e ⊆ closure a ∧ e ⊆ closure b + · obtain ⟨a, b, ha, hb, haZ, hbZ, has, hbs, hia, hib⟩ := hA + obtain ⟨p, hp⟩ := heΓ.1 + exact ⟨e, heΓ, heΓ', a, b, haZ, hbZ, has, hbs, ⟨heΓ, ha, p, hp, hia hp⟩, + ⟨heΓ, hb, p, hp, hib hp⟩⟩ + push Not at hA + -- Regions of `Γ` in one region of `Γ - e` inside `r'` are all in `Z` or all outside it. + have hsame : ∀ s ∈ (Γ.deleteEdge e).R, s ⊆ r' → ∀ c ∈ Γ.R, ∀ d ∈ Γ.R, c ⊆ s → d ⊆ s → + c ∈ Z → d ∈ Z := by + intro s hs hsr c hc d hd hcs hds hcZ + by_contra hdZ + have hne : c ≠ d := fun h => hdZ (h ▸ hcZ) + have honly : ∀ {t u : Set S}, t ∈ Γ.R → u ∈ Γ.R → t ⊆ s → u ⊆ s → t ≠ u → + e ⊆ closure t := by + intro t u ht hu hts hus htu + rcases hincident hP heΓ ht with h | h + · exact h + · exfalso + have htdel := region_deleteEdge_of_not_incident heΓ ht h + obtain ⟨x, hx⟩ := region_nonempty ht + have hts' : t = s := region_eq_of_mem htdel hs hx (hts hx) + obtain ⟨y, hy⟩ := region_nonempty hu + exact htu (region_eq_of_mem ht hu (hts' ▸ hus hy) hy) + exact hA c d hc hd hcZ hdZ (hcs.trans hsr) (hds.trans hsr) (honly hc hd hcs hds hne) + (honly hd hc hds hcs hne.symm) + -- A region of `Γ - e` that meets `r'` lies in `r'`. + have hinr : ∀ s ∈ (Γ.deleteEdge e).R, ∀ z : Set S, z.Nonempty → z ⊆ s → z ⊆ r' → s ⊆ r' := by + intro s hs z ⟨x, hx⟩ hzs hzr + refine subset_region hr' (region_isPreconnected hs) ?_ (hzs hx) (hzr hx) + exact disjoint_left.mpr fun y hy h => region_subset hs hy (hsub''.U_subset h) + let Z'' : Set (Set S) := {s | ∃ z ∈ Γ.R, z ∈ Z ∧ z ⊆ r' ∧ z ⊆ s} + obtain ⟨s₁, hs₁', hs₁s⟩ := exists_region_superset hdel h₁ + obtain ⟨s₂, hs₂', hs₂s⟩ := exists_region_superset hdel h₂ + have hs₂r : s₂ ⊆ r' := hinr s₂ hs₂' r₂ (region_nonempty h₂) hs₂s hs₂ + have hs₁Z : s₁ ∈ Z'' := ⟨r₁, h₁, hz₁, hs₁, hs₁s⟩ + have hs₂Z : s₂ ∉ Z'' := by + rintro ⟨z, hz, hzZ, -, hzs⟩ + exact hz₂ (hsame s₂ hs₂' hs₂r z hz r₂ h₂ hzs hs₂s hzZ) + have hlt : ((Γ.deleteEdge e).E \ Γ'.E).ncard < n := by + have hEq : (Γ.deleteEdge e).E \ Γ'.E = (Γ.E \ Γ'.E) \ {e} := by + rw [deleteEdge_E] + ext f + simp only [mem_sdiff, mem_singleton_iff] + tauto + rw [hEq, ← hn] + exact Set.ncard_sdiff_singleton_lt_of_mem ⟨heΓ, heΓ'⟩ + (Γ.finite_edges.subset sdiff_subset) + obtain ⟨e', he', he'Γ', a, b, haZ, hbZ, has, hbs, hia, hib⟩ := + ih _ hlt hPdel hsub'' hs₁' hs₁Z hs₂' hs₂Z + ((hinr s₁ hs₁' r₁ (region_nonempty h₁) hs₁s hs₁)) hs₂r rfl + have he'Γ : e' ∈ Γ.E := hdel.2 he' + have he'e : e' ≠ e := by + have := he' + rw [deleteEdge_E] at this + exact this.2 + -- A region of `Γ - e` incident with `e'` contains a region of `Γ` incident with `e'`. + have hlift : ∀ s ∈ (Γ.deleteEdge e).R, (e' ∩ closure s).Nonempty → + ∃ c ∈ Γ.R, c ⊆ s ∧ Γ.EdgeRegionIncident e' c := by + rintro s hs ⟨p, hpe, hps⟩ + obtain ⟨W, A₁, A₂, hW, hpW, hWU, hcov, c₁, c₂, d₁, d₂, cl₁, cl₂⟩ := + hsides hP he'Γ hpe + obtain ⟨x, hxW, hxs⟩ := mem_closure_iff.mp hps W hW hpW + have hxU'' := region_subset hs hxs + have hxU : x ∉ Γ.U := by + intro hxU + have hxe' : x ∈ e' := hWU ⟨hxW, hxU⟩ + have hxe : x ∉ e := fun hxe => he'e (Γ.edge_eq_of_mem he'Γ heΓ hxe' hxe) + exact hxU'' (by rw [hUe]; exact ⟨hxU, hxe⟩) + obtain ⟨c, hc, hxc⟩ := exists_region_of_notMem hxU + have hcs : c ⊆ s := subset_region hs (region_isPreconnected hc) + (disjoint_left.mpr fun y hy h => region_subset hc hy (hdel.U_subset h)) hxc hxs + refine ⟨c, hc, hcs, he'Γ, hc, p, hpe, ?_⟩ + rcases hcov ⟨hxW, hxU⟩ with hx | hx + · exact closure_mono (subset_region hc c₁ d₁ hx hxc) (cl₁ ⟨hpe, hpW⟩) + · exact closure_mono (subset_region hc c₂ d₂ hx hxc) (cl₂ ⟨hpe, hpW⟩) + obtain ⟨c, hc, hca, hic⟩ := hlift a hia.2.1 hia.2.2 + obtain ⟨d, hd, hdb, hid⟩ := hlift b hib.2.1 hib.2.2 + obtain ⟨z, hz, hzZ, hzr, hza⟩ := haZ + have hcZ : c ∈ Z := hsame a hia.2.1 has z hz c hc hza hca hzZ + have hdZ : d ∉ Z := fun h => hbZ ⟨d, hd, h, hdb.trans hbs, hdb⟩ + exact ⟨e', he'Γ, he'Γ', c, d, hcZ, hdZ, hca.trans has, hdb.trans hbs, hic, hid⟩ + · -- Now `Γ` and `Γ'` have the same edges, and only vertices separate `r'`. + exfalso + have hEsub : Γ.E ⊆ Γ'.E := by + intro f hf + by_contra hf' + exact hE ⟨f, hf, hf'⟩ + have hconn : IsPreconnected (r' \ Γ.V) := + hpuncture (region_isOpen hr') (region_isPreconnected hr') Γ.finite_V + have hdisj : Disjoint (r' \ Γ.V) Γ.U := by + refine disjoint_left.mpr fun x hx hxU => ?_ + obtain ⟨f, hf, hxf⟩ := Γ.exists_edge_of_mem hxU hx.2 + exact region_subset hr' hx.1 ((Γ'.closure_subset_U (hEsub hf)) (subset_closure hxf)) + have hin : ∀ {r : Set S}, r ∈ Γ.R → r ⊆ r' → r ⊆ r' \ Γ.V := fun hr hrr x hx => + ⟨hrr hx, fun hxV => region_subset hr hx (Γ.V_subset_U hxV)⟩ + obtain ⟨x, hx⟩ := region_nonempty h₁ + obtain ⟨y, hy⟩ := region_nonempty h₂ + have hy₁ : y ∈ r₁ := subset_region h₁ hconn hdisj (hin h₁ hs₁ hx) hx (hin h₂ hs₂ hy) + exact hz₂ (region_eq_of_mem h₁ h₂ hy₁ hy ▸ hz₁) + +/-- Graph Minors XI, (5.1) (page 81): "Let $Z \subseteq R(\Gamma)$, and let $\Gamma' \subseteq +\Gamma$. Let $r'$ be a region of +$\Gamma'$. If there are regions $r_1 \in Z$, $r_2 \in R(\Gamma) - Z$ with $r_1, r_2 +\subseteq r'$, then there are such regions $r_1, r_2$ which in addition are incident with +some edge $e$ of $\Gamma$ with $e \notin E(\Gamma')$." -/ +theorem theorem_5_1_proof (hS : IsClosedSurface S) + {Γ' : Drawing S} (hsub : Γ'.IsSubdrawing Γ) {Z : Set (Set S)} + {r' r₁ r₂ : Set S} (hr' : r' ∈ Γ'.R) (h₁ : r₁ ∈ Γ.R) (hz₁ : r₁ ∈ Z) (h₂ : r₂ ∈ Γ.R) + (hz₂ : r₂ ∉ Z) (hs₁ : r₁ ⊆ r') (hs₂ : r₂ ⊆ r') : + ∃ e ∈ Γ.E, e ∉ Γ'.E ∧ ∃ a b : Set S, a ∈ Z ∧ b ∉ Z ∧ a ⊆ r' ∧ b ⊆ r' ∧ + Γ.EdgeRegionIncident e a ∧ Γ.EdgeRegionIncident e b := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + exact exists_separating_region_edge (fun _ => True) + (fun {_} _ _ => trivial) (fun {_} _ {_ _} he hr => edge_incident_or_disjoint hS he hr) + (fun {G} _ {_} he {_} hp => exists_edge_sides hS G he hp) + (isPreconnected_sdiff_finite hS) trivial hsub hr' h₁ hz₁ h₂ hz₂ hs₁ hs₂ + +/-- A subdrawing `N(Z)` with small weight is confined: a long circuit would have weight at least +`ω`, by the definition of a weighting. -/ +theorem boundaryDrawing_isConfined {k ω : ℕ} {Ω : Set S} {Z : Set (Set S)} + (hw : IsWeighting Γ k Ω ω) (hlt : (Ω ∩ (boundaryDrawing Γ Z).V).ncard < ω) : + IsConfined k (boundaryDrawing Γ Z) := by + intro C hC hCs + by_contra hcon + have hsub : (boundaryDrawing Γ Z).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have h₁ := hw.le_ncard C hC (hCs.trans hsub) (not_lt.mp hcon) + have hfin : (Ω ∩ (boundaryDrawing Γ Z).V).Finite := + (Γ.finite_V.subset hw.subset).subset inter_subset_left + have h₂ : (Ω ∩ C.V).ncard ≤ (Ω ∩ (boundaryDrawing Γ Z).V).ncard := + Set.ncard_le_ncard (inter_subset_inter_right _ hCs.1) hfin + omega + +theorem boundaryDrawing_compl {Z : Set (Set S)} (hZ : Z ⊆ Γ.R) : + boundaryDrawing Γ (Γ.R \ Z) = boundaryDrawing Γ Z := by + have hEq : Γ.R \ (Γ.R \ Z) = Z := by + ext r + constructor + · rintro ⟨h₁, h₂⟩ + by_contra h + exact h₂ ⟨h₁, h⟩ + · exact fun h => ⟨hZ h, fun h' => h'.2 h⟩ + unfold boundaryDrawing + rw [hEq] + simp only [and_comm] + +/-- `N(Z)` has the edges incident with a member of `Z` and with a region outside `Z`. -/ +theorem mem_boundaryDrawing_E {Z : Set (Set S)} {e : Set S} : + e ∈ (boundaryDrawing Γ Z).E ↔ (∃ r ∈ Z, Γ.EdgeRegionIncident e r) ∧ + ∃ r ∈ Γ.R \ Z, Γ.EdgeRegionIncident e r := by + unfold boundaryDrawing + rw [Γ.span_E] + constructor + · exact fun h => h.1 + · rintro ⟨h₁, h₂⟩ + obtain ⟨r, hrZ, hr⟩ := h₁ + exact ⟨⟨⟨r, hrZ, hr⟩, h₂⟩, hr.1⟩ + +/-- Graph Minors XI, (5.2) (page 81): "If $Z \subseteq R(\Gamma)$ and $|\Omega \cap V(N(Z))| < +\omega$, then exactly one of $Z$, +$R(\Gamma) - Z$ is small." -/ +theorem theorem_5_2_proof (hS : IsClosedSurface S) [ConnectedSpace S] + {k ω : ℕ} {ins : Drawing S → Set S} {Ω : Set S} + {Z : Set (Set S)} (hs : IsSlope Γ k ins) (hw : IsWeighting Γ k Ω ω) (hZ : Z ⊆ Γ.R) + (hlt : (Ω ∩ (boundaryDrawing Γ Z).V).ncard < ω) : + (IsSmall Γ ins k Ω ω Z ∨ IsSmall Γ ins k Ω ω (Γ.R \ Z)) ∧ + ¬ (IsSmall Γ ins k Ω ω Z ∧ IsSmall Γ ins k Ω ω (Γ.R \ Z)) := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + set N := boundaryDrawing Γ Z with hN + have hsub : N.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hconf : IsConfined k N := boundaryDrawing_isConfined hw hlt + have hcomp : boundaryDrawing Γ (Γ.R \ Z) = N := boundaryDrawing_compl hZ + have hr₀ := theorem_4_4_proof hS hs hsub hconf + set r₀ := univ \ insOf ins N with hr₀def + have hnotcap : ∀ r : Set S, r.Nonempty → r ⊆ r₀ → ¬ Captures ins k N r := by + rintro r ⟨x, hx⟩ hrr ⟨C, hC, hCs, -, hin⟩ + exact (hrr hx).2 (Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, hCs⟩, hin hx⟩)) + -- A region of `Γ` is captured by `N(Z)` unless it lies in `r₀`. + have hcap : ∀ r ∈ Γ.R, ¬ Captures ins k N r → r ⊆ r₀ := by + intro r hr hnot + obtain ⟨r', hr', hrr'⟩ := exists_region_superset hsub hr + by_cases he : r' = r₀ + · exact he ▸ hrr' + · exfalso + obtain ⟨x, hx⟩ := region_nonempty hr + rcases captures_of_ne hS hs hsub hconf hr' hr₀ he with + ⟨C, hC, hCs, hl, hin⟩ | h + · exact hnot ⟨C, hC, hCs, hl, hrr'.trans hin⟩ + · exact hnotcap r₀ (region_nonempty hr₀) subset_rfl h + constructor + · by_contra hcon + push Not at hcon + obtain ⟨hnZ, hnc⟩ := hcon + have hexists : ∀ {Y : Set (Set S)}, boundaryDrawing Γ Y = N → ¬ IsSmall Γ ins k Ω ω Y → + ∃ r ∈ Y, ¬ Captures ins k N r := by + intro Y hY hnot + by_contra hall + push Not at hall + refine hnot ⟨by rw [hY]; exact hlt, ?_⟩ + rw [hY] + exact hall + obtain ⟨r₁, hr₁, hn₁⟩ := hexists rfl hnZ + obtain ⟨r₂, hr₂, hn₂⟩ := hexists hcomp hnc + obtain ⟨e, -, heN, a, b, haZ, hbZ, -, -, hia, hib⟩ := + theorem_5_1_proof hS hsub hr₀ (hZ hr₁) hr₁ hr₂.1 hr₂.2 (hcap _ (hZ hr₁) hn₁) + (hcap _ hr₂.1 hn₂) + exact heN (mem_boundaryDrawing_E.mpr ⟨⟨a, haZ, hia⟩, b, ⟨hib.2.1, hbZ⟩, hib⟩) + · rintro ⟨⟨-, h₁⟩, ⟨-, h₂⟩⟩ + rw [hcomp] at h₂ + obtain ⟨y, hy⟩ := region_nonempty hr₀ + have hO : IsOpen r₀ := region_isOpen hr₀ + obtain ⟨z, hz, hzU⟩ := exists_notMem_U (Γ := Γ) hS hO ⟨y, hy⟩ + obtain ⟨r, hr, hzr⟩ := exists_region_of_notMem hzU + have hrr₀ : r ⊆ r₀ := subset_region hr₀ (region_isPreconnected hr) + (disjoint_left.mpr fun q hq h => region_subset hr hq (hsub.U_subset h)) hzr hz + by_cases hrZ : r ∈ Z + · exact hnotcap r (region_nonempty hr) hrr₀ (h₁ r hrZ) + · exact hnotcap r (region_nonempty hr) hrr₀ (h₂ r ⟨hr, hrZ⟩) + +/-- Graph Minors XI, (5.3) (page 82): "If $Z \subseteq R(\Gamma)$ is small, $Z' \subseteq Z$, and +$|\Omega \cap V(N(Z'))| < +\omega$, then $Z'$ is small." -/ +theorem theorem_5_3_proof (hS : IsClosedSurface S) [ConnectedSpace S] + {k ω : ℕ} {ins : Drawing S → Set S} {Ω : Set S} + {Z Z' : Set (Set S)} (hs : IsSlope Γ k ins) (hw : IsWeighting Γ k Ω ω) (hZ : Z ⊆ Γ.R) + (hsm : IsSmall Γ ins k Ω ω Z) (hZ' : Z' ⊆ Z) + (hlt : (Ω ∩ (boundaryDrawing Γ Z').V).ncard < ω) : IsSmall Γ ins k Ω ω Z' := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + refine ⟨hlt, fun r hr => ?_⟩ + obtain ⟨C, hC, hCN, hl, hin⟩ := hsm.2 r (hZ' hr) + have hNs : (boundaryDrawing Γ Z).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hN's : (boundaryDrawing Γ Z').IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hCs := hCN.trans hNs + have hconf := boundaryDrawing_isConfined hw hlt + have hrR : r ∈ Γ.R := hZ (hZ' hr) + obtain ⟨r', hr', hrr'⟩ := exists_region_superset hN's hrR + have hΔ : IsClosed (ins C) := (hs.isClosedDisc C hC hCs hl).isClosed + -- The claim of the paper: `r' ⊆ ins(C)`. + have hclaim : r' ⊆ ins C := by + by_contra hcon + obtain ⟨x, hxr', hxC⟩ := not_subset.mp hcon + obtain ⟨y, ⟨hyr', hyC⟩, hyU⟩ := exists_notMem_U (Γ := Γ) hS + ((region_isOpen hr').inter hΔ.isOpen_compl) ⟨x, hxr', hxC⟩ + obtain ⟨s, hs', hys⟩ := exists_region_of_notMem hyU + have hsr' : s ⊆ r' := subset_region hr' (region_isPreconnected hs') + (disjoint_left.mpr fun q hq h => region_subset hs' hq (hN's.U_subset h)) hys hyr' + let X : Set (Set S) := {t | t ⊆ ins C} + obtain ⟨e, heΓ, heN, a, b, haZ, hbZ, has, hbs, hia, hib⟩ := + theorem_5_1_proof (Z := X ∩ Z') hS hN's hr' hrR ⟨hin, hr⟩ hs' (fun h => hyC (h.1 hys)) + hrr' hsr' + have hbZ' : b ∈ Z' := by + by_contra hb + exact heN (mem_boundaryDrawing_E.mpr ⟨⟨a, haZ.2, hia⟩, b, ⟨hib.2.1, hb⟩, hib⟩) + have hbX : ¬ b ⊆ ins C := fun h => hbZ ⟨h, hbZ'⟩ + have hbdis : Disjoint b (ins C) := by + rcases region_subset_or_disjoint hs hC hCs hl hib.2.1 with h | h + · exact absurd h hbX + · exact h + -- Now `e` lies in the frontier of `ins(C)`, so `e` is an edge of `C`. + have hes : e ⊆ closure a := edge_subset_closure_of_incident hS heΓ hia.2.1 hia.2.2 + have heb : e ⊆ closure b := edge_subset_closure_of_incident hS heΓ hib.2.1 hib.2.2 + have heC : e ∈ C.E := by + obtain ⟨p, hp⟩ := heΓ.1 + have hpU : p ∈ C.U := by + rw [← hs.subBd_eq C hC hCs hl] + refine ⟨subset_closure (hΔ.closure_subset_iff.mpr haZ.1 (hes hp)), closure_mono ?_ (heb hp)⟩ + exact fun q hq => ⟨mem_univ _, disjoint_left.mp hbdis hq⟩ + have hpV : p ∉ C.V := fun h => (heΓ.2.1 hp).2 (hCs.1 h) + obtain ⟨f, hf, hpf⟩ := C.exists_edge_of_mem hpU hpV + have := Γ.edge_eq_of_mem (hCs.2 hf) heΓ hpf hp + exact this ▸ hf + -- But `e` is in `N(Z)`, so a third region at `e` lies outside `Z`. + obtain ⟨-, t, ⟨ht, htZ⟩, hit⟩ := mem_boundaryDrawing_E.mp (hCN.2 heC) + have hab : a ≠ b := fun h => hbX (h ▸ haZ.1) + have hti : e ⊆ closure t := edge_subset_closure_of_incident hS heΓ hit.2.1 hit.2.2 + rcases region_incident_two hS heΓ hia.2.1 hib.2.1 ht hes heb hti with h | h | h + · exact hab h + · exact htZ (h ▸ hZ' haZ.2) + · exact htZ (h ▸ hZ' hbZ') + obtain ⟨D, hD, hDs, hDl, hDin⟩ := theorem_4_5_proof hS hs hN's hconf hr' + ⟨C, hC, hCs, hl, hclaim⟩ + exact ⟨D, hD, hDs, hDl, hrr'.trans hDin⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section5b.lean b/LeanPool/GraphMinor/GM11/Section5b.lean new file mode 100644 index 0000000000..59317b50f0 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section5b.lean @@ -0,0 +1,212 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section5 + +/-! +# Graph Minors XI, (5.5) from (5.4) + +This file proves that a drawing in a connected closed surface has only finitely many regions +(`finite_R`), and deduces (5.5) from (5.4) by the paper's argument (`theorem_5_5_of_partition`). +Statement (5.4) itself is `PartitionNotSmall`, and it is a hypothesis of the deduction only. It is +proved in `Section5c.lean`, where (5.5) is stated without this hypothesis. +-/ + +public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {Γ : Drawing S} + +/-- A drawing in a connected closed surface has finitely many regions. Deleting an edge merges only +regions incident with that edge, and these are at most two. A drawing without edges has one +region. -/ +theorem finite_R (hS : IsClosedSurface S) [PreconnectedSpace S] + (Γ : Drawing S) : Γ.R.Finite := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + induction hn : Γ.E.ncard using Nat.strong_induction_on generalizing Γ with + | _ n ih => + by_cases hE : Γ.E.Nonempty + · obtain ⟨e, he⟩ := hE + have hlt : (Γ.deleteEdge e).E.ncard < n := by + rw [deleteEdge_E, ← hn] + exact Set.ncard_sdiff_singleton_lt_of_mem he Γ.finite_edges + have h₁ := ih _ hlt (Γ.deleteEdge e) rfl + have h₂ : {r ∈ Γ.R | e ⊆ closure r}.Finite := by + by_contra hinf + obtain ⟨T, hT, hcard⟩ := (Set.not_finite.mp hinf |> Set.Infinite.exists_subset_ncard_eq) 3 + obtain ⟨a, b, c, hab, hac, hbc, rfl⟩ := Set.ncard_eq_three.mp hcard.2 + have ha := hT (show a ∈ _ by simp) + have hb := hT (show b ∈ _ by simp) + have hc := hT (show c ∈ _ by simp) + rcases region_incident_two hS he ha.1 hb.1 hc.1 ha.2 hb.2 hc.2 with h | h | h + · exact hab h + · exact hac h + · exact hbc h + refine (h₁.union h₂).subset fun r hr => ?_ + rcases edge_incident_or_disjoint hS he hr with h | h + · exact Or.inr ⟨hr, h⟩ + · exact Or.inl (region_deleteEdge_of_not_incident he hr h) + · have hU : Γ.U = Γ.V := by + rw [Γ.U_eq, not_nonempty_iff_eq_empty.mp hE] + simp + have hc : IsPreconnected (univ \ Γ.U) := by + rw [hU, ← compl_eq_univ_sdiff] + exact isPreconnected_compl_finite hS Γ.finite_V + refine Set.Subsingleton.finite fun r₁ h₁ r₂ h₂ => ?_ + obtain ⟨x, hx⟩ := region_nonempty h₁ + obtain ⟨y, hy⟩ := region_nonempty h₂ + refine region_eq_of_mem h₁ h₂ (subset_region h₁ hc ?_ ⟨mem_univ _, region_subset h₁ hx⟩ hx + ⟨mem_univ _, region_subset h₂ hy⟩) hy + exact disjoint_left.mpr fun q hq => hq.2 + +/-- The vertices of `N(Z)` are those incident with a member of `Z` and a region outside `Z`. The +ends of an edge of `N(Z)` are of this kind, since an edge lies in the closure of its regions. -/ +theorem mem_boundaryDrawing_V (hS : IsClosedSurface S) + {Z : Set (Set S)} {v : S} : + v ∈ (boundaryDrawing Γ Z).V ↔ (∃ r ∈ Z, Γ.VertexIncident v r) ∧ + ∃ r ∈ Γ.R \ Z, Γ.VertexIncident v r := by + constructor + · intro hv + rcases hv with ⟨hv, -⟩ | hv + · exact hv + · obtain ⟨e, ⟨he, heΓ⟩, hve, hvV⟩ := mem_iUnion₂.mp hv + obtain ⟨⟨r₁, hr₁, hi₁⟩, r₂, hr₂, hi₂⟩ := he + have hclosure : ∀ r ∈ Γ.R, Γ.EdgeRegionIncident e r → Γ.VertexIncident v r := by + intro r hr hi + have hsub := edge_subset_closure_of_incident hS heΓ hr hi.2.2 + exact ⟨hvV, Or.inr hr, closure_minimal hsub isClosed_closure hve⟩ + exact ⟨⟨r₁, hr₁, hclosure r₁ hi₁.2.1 hi₁⟩, r₂, hr₂, hclosure r₂ hr₂.1 hi₂⟩ + · intro hv + exact Or.inl ⟨hv, hv.1.choose_spec.2.1⟩ + +/-- Graph Minors XI, (5.4) (page 82): "If $(Z_1, Z_2, Z_3)$ is a partition of $R(\Gamma)$, then one +of $Z_1, Z_2, Z_3$ is not +small." -/ +@[expose] def PartitionNotSmall (Γ : Drawing S) (ins : Drawing S → Set S) (k : ℕ) (Ω : Set S) + (ω : ℕ) : Prop := + ∀ Z₁ Z₂ Z₃ : Set (Set S), Z₁ ∪ Z₂ ∪ Z₃ = Γ.R → Disjoint Z₁ Z₂ → Disjoint Z₁ Z₃ → + Disjoint Z₂ Z₃ → ¬ (IsSmall Γ ins k Ω ω Z₁ ∧ IsSmall Γ ins k Ω ω Z₂ ∧ IsSmall Γ ins k Ω ω Z₃) + +/-- The counting step of (5.5): the sets of `Ω`-vertices of `N(Z₁ - Z₂)` and `N(Z₂ - Z₁)` have total +size at most that of `N(Z₁)` and `N(Z₂)`. -/ +private theorem count_step (hS : IsClosedSurface S) + {Ω : Set S} (hΩ : Ω ⊆ Γ.V) {Z₁ Z₂ : Set (Set S)} + (hZ₁ : Z₁ ⊆ Γ.R) (hZ₂ : Z₂ ⊆ Γ.R) : + (Ω ∩ (boundaryDrawing Γ (Z₁ \ Z₂)).V).ncard + (Ω ∩ (boundaryDrawing Γ (Z₂ \ Z₁)).V).ncard ≤ + (Ω ∩ (boundaryDrawing Γ Z₁).V).ncard + (Ω ∩ (boundaryDrawing Γ Z₂).V).ncard := by + have hmem := fun Z v => mem_boundaryDrawing_V (Γ := Γ) (Z := Z) (v := v) hS + set A := (boundaryDrawing Γ (Z₁ \ Z₂)).V with hA + set B := (boundaryDrawing Γ (Z₂ \ Z₁)).V with hB' + set X := (boundaryDrawing Γ Z₁).V with hX + set Y := (boundaryDrawing Γ Z₂).V with hY + have hΩf : Ω.Finite := Γ.finite_V.subset hΩ + -- The first claim of the paper, for either order of `Z₁` and `Z₂`. + have hclaim : ∀ P Q : Set (Set S), P ⊆ Γ.R → ∀ v, v ∈ (boundaryDrawing Γ (P \ Q)).V → + v ∈ (boundaryDrawing Γ P).V ∨ v ∈ (boundaryDrawing Γ Q).V := by + intro P Q hP v hv + obtain ⟨⟨r₁, ⟨hr₁P, hr₁Q⟩, hi₁⟩, r₂, ⟨hr₂R, hr₂⟩, hi₂⟩ := (hmem _ v).mp hv + by_cases hr₂P : r₂ ∈ P + · have hr₂Q : r₂ ∈ Q := by + by_contra h + exact hr₂ ⟨hr₂P, h⟩ + exact Or.inr ((hmem _ v).mpr ⟨⟨r₂, hr₂Q, hi₂⟩, r₁, ⟨hP hr₁P, hr₁Q⟩, hi₁⟩) + · exact Or.inl ((hmem _ v).mpr ⟨⟨r₁, hr₁P, hi₁⟩, r₂, ⟨hr₂R, hr₂P⟩, hi₂⟩) + have hun : Ω ∩ (A ∪ B) ⊆ Ω ∩ (X ∪ Y) := by + rintro v ⟨hvΩ, hv | hv⟩ + · exact ⟨hvΩ, hclaim Z₁ Z₂ hZ₁ v hv⟩ + · refine ⟨hvΩ, ?_⟩ + rcases hclaim Z₂ Z₁ hZ₂ v hv with h | h + · exact Or.inr h + · exact Or.inl h + have hin : Ω ∩ (A ∩ B) ⊆ Ω ∩ (X ∩ Y) := by + rintro v ⟨hvΩ, hvA, hvB⟩ + obtain ⟨⟨r₁, ⟨hr₁, hr₁n⟩, hi₁⟩, -⟩ := (hmem _ v).mp hvA + obtain ⟨⟨r₂, ⟨hr₂, hr₂n⟩, hi₂⟩, -⟩ := (hmem _ v).mp hvB + exact ⟨hvΩ, (hmem _ v).mpr ⟨⟨r₁, hr₁, hi₁⟩, r₂, ⟨hZ₂ hr₂, hr₂n⟩, hi₂⟩, + (hmem _ v).mpr ⟨⟨r₂, hr₂, hi₂⟩, r₁, ⟨hZ₁ hr₁, hr₁n⟩, hi₁⟩⟩ + have hf : ∀ T : Set S, (Ω ∩ T).Finite := fun T => hΩf.subset inter_subset_left + have e₁ := Set.ncard_union_add_ncard_inter (Ω ∩ A) (Ω ∩ B) (hf A) (hf B) + have e₂ := Set.ncard_union_add_ncard_inter (Ω ∩ X) (Ω ∩ Y) (hf X) (hf Y) + rw [← inter_union_distrib_left, ← inter_inter_distrib_left] at e₁ e₂ + have l₁ := Set.ncard_le_ncard hun (hf _) + have l₂ := Set.ncard_le_ncard hin (hf _) + omega + +/-- One step of the proof of (5.5): if `Z₁` and `Z₂` meet, the triple can be made smaller. -/ +private theorem step_5_5 (hS : IsClosedSurface S) [ConnectedSpace S] + {k ω : ℕ} {ins : Drawing S → Set S} {Ω : Set S} + (hs : IsSlope Γ k ins) (hw : IsWeighting Γ k Ω ω) {Z₁ Z₂ Z₃ : Set (Set S)} + (hU : Z₁ ∪ Z₂ ∪ Z₃ = Γ.R) (h₁ : IsSmall Γ ins k Ω ω Z₁) (h₂ : IsSmall Γ ins k Ω ω Z₂) + (hne : (Z₁ ∩ Z₂).Nonempty) : + (IsSmall Γ ins k Ω ω (Z₁ \ Z₂) ∧ (Z₁ \ Z₂) ∪ Z₂ ∪ Z₃ = Γ.R ∧ (Z₁ \ Z₂).ncard < Z₁.ncard) ∨ + (IsSmall Γ ins k Ω ω (Z₂ \ Z₁) ∧ Z₁ ∪ (Z₂ \ Z₁) ∪ Z₃ = Γ.R ∧ (Z₂ \ Z₁).ncard < Z₂.ncard) := by + have hZ₁ : Z₁ ⊆ Γ.R := fun r hr => hU ▸ Or.inl (Or.inl hr) + have hZ₂ : Z₂ ⊆ Γ.R := fun r hr => hU ▸ Or.inl (Or.inr hr) + have hfin := finite_R hS Γ + have hcount := count_step hS hw.subset hZ₁ hZ₂ + have ha := h₁.1 + have hb := h₂.1 + have hlt : (Ω ∩ (boundaryDrawing Γ (Z₁ \ Z₂)).V).ncard < ω ∨ + (Ω ∩ (boundaryDrawing Γ (Z₂ \ Z₁)).V).ncard < ω := by omega + obtain ⟨x, hx₁, hx₂⟩ := hne + rcases hlt with h | h + · refine Or.inl ⟨theorem_5_3_proof hS hs hw hZ₁ h₁ sdiff_subset h, ?_, ?_⟩ + · rw [← hU] + ext r + simp only [mem_union, mem_sdiff] + tauto + · exact Set.ncard_lt_ncard ⟨sdiff_subset, fun hsub => (hsub hx₁).2 hx₂⟩ (hfin.subset hZ₁) + · refine Or.inr ⟨theorem_5_3_proof hS hs hw hZ₂ h₂ sdiff_subset h, ?_, ?_⟩ + · rw [← hU] + ext r + simp only [mem_union, mem_sdiff] + tauto + · exact Set.ncard_lt_ncard ⟨sdiff_subset, fun hsub => (hsub hx₂).2 hx₁⟩ (hfin.subset hZ₂) + +/-- Graph Minors XI, (5.5) (page 86), deduced from (5.4) as in the paper: "If $Z_1, Z_2, Z_3 +\subseteq R(\Gamma)$ are small, then $Z_1 \cup Z_2 \cup Z_3 \ne +R(\Gamma)$." -/ +theorem theorem_5_5_of_partition (hS : IsClosedSurface S) [ConnectedSpace S] + {k ω : ℕ} {ins : Drawing S → Set S} {Ω : Set S} + (hs : IsSlope Γ k ins) (hw : IsWeighting Γ k Ω ω) (h54 : PartitionNotSmall Γ ins k Ω ω) + {Z₁ Z₂ Z₃ : Set (Set S)} (h₁ : IsSmall Γ ins k Ω ω Z₁) (h₂ : IsSmall Γ ins k Ω ω Z₂) + (h₃ : IsSmall Γ ins k Ω ω Z₃) : Z₁ ∪ Z₂ ∪ Z₃ ≠ Γ.R := by + intro hU + induction hn : Z₁.ncard + Z₂.ncard + Z₃.ncard using Nat.strong_induction_on + generalizing Z₁ Z₂ Z₃ with + | _ n ih => + by_cases h₁₂ : (Z₁ ∩ Z₂).Nonempty + · rcases step_5_5 hS hs hw hU h₁ h₂ h₁₂ with ⟨a, b, c⟩ | ⟨a, b, c⟩ + · exact ih _ (by omega) a h₂ h₃ b rfl + · exact ih _ (by omega) h₁ a h₃ b rfl + by_cases h₁₃ : (Z₁ ∩ Z₃).Nonempty + · have hU' : Z₁ ∪ Z₃ ∪ Z₂ = Γ.R := by rw [← hU, union_right_comm] + rcases step_5_5 hS hs hw hU' h₁ h₃ h₁₃ with ⟨a, b, c⟩ | ⟨a, b, c⟩ + · exact ih _ (by omega) a h₃ h₂ b rfl + · exact ih _ (by omega) h₁ a h₂ b rfl + by_cases h₂₃ : (Z₂ ∩ Z₃).Nonempty + · have hU' : Z₂ ∪ Z₃ ∪ Z₁ = Γ.R := by + rw [← hU] + ext r + simp only [mem_union] + tauto + rcases step_5_5 hS hs hw hU' h₂ h₃ h₂₃ with ⟨a, b, c⟩ | ⟨a, b, c⟩ + · exact ih _ (by omega) a h₃ h₁ b rfl + · exact ih _ (by omega) h₂ a h₁ b rfl + exact h54 Z₁ Z₂ Z₃ hU (disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp h₁₂)) + (disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp h₁₃)) + (disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp h₂₃)) ⟨h₁, h₂, h₃⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section5c.lean b/LeanPool/GraphMinor/GM11/Section5c.lean new file mode 100644 index 0000000000..fde75ded15 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section5c.lean @@ -0,0 +1,1045 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.CircuitRegions + +/-! +# Graph Minors XI, statement (5.4) + +The main result is `theorem_5_4`: if `(Z₁, Z₂, Z₃)` is a partition of `R(Γ)`, then one of `Z₁, Z₂, +Z₃` +is not small. With `theorem_5_5_of_partition` this gives (5.5) (`theorem_5_5`). + +We follow the paper's proof (pages 82–86) up to its statement (8): a counterexample with `N(Z₁, Z₂, +Z₃)` +minimal has `N(Z_i)` a circuit `C_i` and `Z_i` the set of regions in `ins(C_i)`. The paper then +shows that +every circuit of `K = C₁ ∪ C₂ ∪ C₃` is null-homotopic, so that `Σ` is a sphere and `K` is three +paths +with the same ends. We replace this homotopy step by the same argument modulo 2, which needs no +topology beyond the discs `ins(C)`. A circuit `T` of `K` of length `< 2θ` has `N(A) = T` for the set +`A` of regions in `ins(T)`. Since +each `ins(C_i) - U(C_i)` is connected and misses `U(T)`, the set `A` is a union of some of the +`Z_i`, and so +`T` is one of `C₁, C₂, C₃`. Then `exists_theta` gives the three paths directly, and the second slope +axiom +gives the contradiction, as in the paper. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] {Γ : Drawing S} {k ω : ℕ} {ins : Drawing S → Set S} + {Ω : Set S} + +/-- Three small sets that partition `R(Γ)`. -/ +structure IsTriple [T1Space S] (Γ : Drawing S) (ins : Drawing S → Set S) (k : ℕ) (Ω : Set S) (ω : ℕ) + (Z₁ Z₂ Z₃ : Set (Set S)) : Prop where + cover : Z₁ ∪ Z₂ ∪ Z₃ = Γ.R + d₁₂ : Disjoint Z₁ Z₂ + d₁₃ : Disjoint Z₁ Z₃ + d₂₃ : Disjoint Z₂ Z₃ + s₁ : IsSmall Γ ins k Ω ω Z₁ + s₂ : IsSmall Γ ins k Ω ω Z₂ + s₃ : IsSmall Γ ins k Ω ω Z₃ + +/-- The edges of `N(Z₁, Z₂, Z₃)`. -/ +def tripleE [T1Space S] (Γ : Drawing S) (Z₁ Z₂ Z₃ : Set (Set S)) : Set (Set S) := + (boundaryDrawing Γ Z₁).E ∪ (boundaryDrawing Γ Z₂).E ∪ (boundaryDrawing Γ Z₃).E + +/-- A counterexample to (5.4) "chosen with `N(Z₁, Z₂, Z₃)` minimal". -/ +structure IsMinTriple [T1Space S] (Γ : Drawing S) (ins : Drawing S → Set S) (k : ℕ) (Ω : Set S) + (ω : ℕ) (Z₁ Z₂ Z₃ : Set (Set S)) : Prop where + triple : IsTriple Γ ins k Ω ω Z₁ Z₂ Z₃ + min : ∀ Z₁' Z₂' Z₃', IsTriple Γ ins k Ω ω Z₁' Z₂' Z₃' → + (tripleE Γ Z₁ Z₂ Z₃).ncard ≤ (tripleE Γ Z₁' Z₂' Z₃').ncard + +section Basic + +variable [T1Space S] {Z₁ Z₂ Z₃ : Set (Set S)} + +theorem IsTriple.swap₂₃ (h : IsTriple Γ ins k Ω ω Z₁ Z₂ Z₃) : IsTriple Γ ins k Ω ω Z₁ Z₃ Z₂ := + ⟨by rw [← h.cover, union_right_comm], h.d₁₃, h.d₁₂, h.d₂₃.symm, h.s₁, h.s₃, h.s₂⟩ + +theorem IsTriple.swap₁₂ (h : IsTriple Γ ins k Ω ω Z₁ Z₂ Z₃) : IsTriple Γ ins k Ω ω Z₂ Z₁ Z₃ := + ⟨by rw [← h.cover, union_comm Z₂], h.d₁₂.symm, h.d₂₃, h.d₁₃, h.s₂, h.s₁, h.s₃⟩ + +theorem tripleE_swap₂₃ : tripleE Γ Z₁ Z₃ Z₂ = tripleE Γ Z₁ Z₂ Z₃ := by + unfold tripleE + rw [union_right_comm] + +theorem tripleE_swap₁₂ : tripleE Γ Z₂ Z₁ Z₃ = tripleE Γ Z₁ Z₂ Z₃ := by + unfold tripleE + rw [union_comm (boundaryDrawing Γ Z₂).E] + +theorem IsMinTriple.swap₂₃ (h : IsMinTriple Γ ins k Ω ω Z₁ Z₂ Z₃) : + IsMinTriple Γ ins k Ω ω Z₁ Z₃ Z₂ := + ⟨h.triple.swap₂₃, fun _ _ _ h' => by rw [tripleE_swap₂₃]; exact h.min _ _ _ h'⟩ + +theorem IsMinTriple.swap₁₂ (h : IsMinTriple Γ ins k Ω ω Z₁ Z₂ Z₃) : + IsMinTriple Γ ins k Ω ω Z₂ Z₁ Z₃ := + ⟨h.triple.swap₁₂, fun _ _ _ h' => by rw [tripleE_swap₁₂]; exact h.min _ _ _ h'⟩ + +end Basic + +/-- The vertices of `C` other than `v₁` whose outer regions all lie in `Z`: the set `W_i` of the +paper. -/ +def outerSet (Γ : Drawing S) (X : Set S) (V : Set S) (v₁ : S) (Z : Set (Set S)) : Set S := + {v | v ∈ V ∧ v ≠ v₁ ∧ ∀ r ∈ Γ.R, v ∈ closure r → ¬ r ⊆ X → r ∈ Z} + +/-- All regions at an edge are the two given ones. -/ +theorem sides_of_edge (hS : IsClosedSurface S) + {e a b r : Set S} (he : e ∈ Γ.E) (ha : a ∈ Γ.R) (hb : b ∈ Γ.R) + (hne : a ≠ b) (ia : e ⊆ closure a) (ib : e ⊆ closure b) (hr : r ∈ Γ.R) + (ir : (e ∩ closure r).Nonempty) : r = a ∨ r = b := by + have hr' := edge_subset_closure_of_incident hS he hr ir + rcases region_incident_two hS he ha hb hr ia ib hr' with h | h | h + · exact absurd h hne + · exact Or.inl h.symm + · exact Or.inr h.symm + +section Leaf + +variable [T2Space S] (hS : IsClosedSurface S) + (hs : IsSlope Γ k ins) (hw : IsWeighting Γ k Ω ω) + {Z₁ : Set (Set S)} {C₁ : Drawing S} {v₁ : S} (hsm : IsSmall Γ ins k Ω ω Z₁) + (hL : IsLeafRing ins (boundaryDrawing Γ Z₁) C₁ v₁) +include hS hs hw hsm hL + +/-- Statement (2) of the proof of (5.4) (Graph Minors XI, page 83): "If $e \in E(C_1)$ then one +region of $\Gamma$ incident with $e$ belongs to $A \cap Z_1$ and +the other belongs to $B \cap (Z_2 \cup Z_3)$." -/ +theorem leaf_edge_sides {e : Set S} (he : e ∈ C₁.E) : + ∃ a b, a ∈ Γ.R ∧ b ∈ Γ.R ∧ a ⊆ ins C₁ ∧ ¬ b ⊆ ins C₁ ∧ a ∈ Z₁ ∧ b ∉ Z₁ ∧ e ⊆ closure a ∧ + e ⊆ closure b ∧ ∀ r ∈ Γ.R, (e ∩ closure r).Nonempty → r = a ∨ r = b := by + have hsub : (boundaryDrawing Γ Z₁).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hconf := boundaryDrawing_isConfined hw hsm.1 + obtain ⟨hC, hCs, hmax⟩ := hL.1 + have hCΓ := hCs.trans hsub + have heΓ := hCΓ.2 he + obtain ⟨⟨a, ha, hea, hai⟩, b, hb, heb, hbn⟩ := + exists_regions_of_circuit_edge hS hs hC hCΓ (hconf C₁ hC hCs) he + have hne : a ≠ b := fun h => hbn (h ▸ hai) + obtain ⟨x, hx⟩ := he.1 + have hsides := fun r (hr : r ∈ Γ.R) (ir : (e ∩ closure r).Nonempty) => + sides_of_edge hS heΓ ha hb hne hea heb hr ir + have hbZ : b ∉ Z₁ := fun h => + theorem_4_3_ii hs hsub hconf hC hCs hmax he ⟨x, hx, heb hx⟩ hbn (hsm.2 b h) + obtain ⟨⟨r, hrZ, hir⟩, -⟩ := mem_boundaryDrawing_E.mp (hCs.2 he) + have haZ : a ∈ Z₁ := by + rcases hsides r hir.2.1 hir.2.2 with rfl | rfl + · exact hrZ + · exact absurd hrZ hbZ + exact ⟨a, b, ha, hb, hai, hbn, haZ, hbZ, hea, heb, hsides⟩ + +/-- The paper's "It follows from (2) that $R(v) \subseteq Z_2 \cup Z_3$ for all $v \ne v_1$" (Graph +Minors XI, page +83). Going around `v` from an edge of `C₁`, the region can leave `B - Z₁` only over an edge of +`N(Z₁)` not +in `ins(C₁)`, and at `v` there is none. -/ +theorem leaf_vertex_regions {v : S} (hv : v ∈ C₁.V) (hne : v ≠ v₁) {r : Set S} (hr : r ∈ Γ.R) + (hvr : v ∈ closure r) (hnot : ¬ r ⊆ ins C₁) : r ∉ Z₁ := by + have hsub : (boundaryDrawing Γ Z₁).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hconf := boundaryDrawing_isConfined hw hsm.1 + have hCs := hL.1.2.1 + have hC := hL.1.1 + have hCΓ := hCs.trans hsub + have hl := hconf C₁ hC hCs + have : Nonempty S := ⟨v⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + have hvΓ : v ∈ Γ.V := hCΓ.1 hv + obtain ⟨g, hg, hvg⟩ := exists_edge_at_vertex hC hv + have hgΓ := hCΓ.2 hg + obtain ⟨c, hc⟩ := exists_end_eq hγ hgΓ hvΓ hvg + have hfinH := finite_halfEdges Γ γ v + have h2 : 2 ≤ Nat.card (halfEdges Γ γ v) := by + have he := even_nHalf hS Γ hγ hvΓ Z₁ + have hsubH : nHalf (boundaryDrawing Γ Z₁) γ v ⊆ halfEdges Γ γ v := + fun x hx => ⟨hsub.2 hx.1, hx.2⟩ + have hmem : (g, c) ∈ nHalf (boundaryDrawing Γ Z₁) γ v := ⟨hCs.2 hg, hc⟩ + have hpos := (ncard_pos (hfinH.subset hsubH)).mpr ⟨_, hmem⟩ + have hle := ncard_le_ncard hsubH hfinH + rw [Nat.card_coe_set_eq] + obtain ⟨m, hm⟩ := he + omega + obtain ⟨next, ρ, hρ⟩ := exists_corners hS Γ hγ hvΓ h2 + have : Finite (halfEdges Γ γ v) := hfinH.to_subtype + have hsurj := Finite.injective_iff_surjective.mp hρ.inj + have hcl := (ins_facts_of_length hs hC hCΓ hl).1 + let P : halfEdges Γ γ v → Prop := fun k => ¬ ρ k ⊆ ins C₁ → ρ k ∉ Z₁ + -- Over an edge of `C₁`, the region is `A ∩ Z₁` or `B - Z₁`. + have hedge : ∀ k, (next k).1.1 ∈ C₁.E → P (next k) := by + intro k hk hnotk + obtain ⟨a, b, -, -, hai, -, -, hbZ, -, -, hsides⟩ := leaf_edge_sides hS hs hw hsm hL hk + obtain ⟨x, hx⟩ := hk.1 + rcases hsides _ (hρ.region _) ⟨x, hx, hρ.right k hx⟩ with h | h + · exact absurd (h ▸ hai) hnotk + · exact h ▸ hbZ + have hstep : ∀ k, P k → P (next k) := by + intro k hk + by_cases heC : (next k).1.1 ∈ C₁.E + · exact hedge k heC + intro hnotk hZk + have heΓ : (next k).1.1 ∈ Γ.E := (next k).2.1 + have hend : v ∈ closure (next k).1.1 := by + have h := end_mem_closure hγ heΓ (next k).1.2 + have hev : γ (next k).1.1 (endOf (next k).1.2) = v := (next k).2.2 + rwa [hev] at h + obtain ⟨x, hx⟩ := heΓ.1 + have hxU : x ∉ C₁.U := disjoint_left.mp (edge_disjoint_U hCΓ heΓ heC) hx + -- The edge is outside `ins(C₁)`, since the next region is. + have hxi : x ∉ ins C₁ := fun h => hnotk + (region_subset_ins_of_closure hs hC hCΓ hl (hρ.region _) (hρ.right k hx) h hxU) + -- So it is not an edge of `N(Z₁)`, as `v ≠ v₁`. + have heN : (next k).1.1 ∉ (boundaryDrawing Γ Z₁).E := fun h => + hxi (hL.2.2 v hv hne _ h hend hx) + have hkZ : ρ k ∈ Z₁ := by + by_contra hkZ + exact heN (mem_boundaryDrawing_E.mpr ⟨⟨_, hZk, heΓ, hρ.region _, x, hx, hρ.right k hx⟩, _, + ⟨hρ.region _, hkZ⟩, heΓ, hρ.region _, x, hx, hρ.left k hx⟩) + have hkin : ρ k ⊆ ins C₁ := by + by_contra h + exact hk h hkZ + exact hxi (hcl.closure_subset_iff.mpr hkin (hρ.left k hx)) + let x₀ : halfEdges Γ γ v := ⟨(g, c), hgΓ, hc⟩ + obtain ⟨k₀, hk₀⟩ := hsurj x₀ + have hbase : P x₀ := by + have h := hedge k₀ (by rw [hk₀]; exact hg) + rwa [hk₀] at h + have hall : ∀ k, P k := by + intro k + induction hρ.reach x₀ k with + | refl => exact hbase + | tail _ hyz ih => exact hyz ▸ hstep _ ih + obtain ⟨k, rfl⟩ := hρ.all r hr hvr + exact hall k hnot + +/-- Regions on both sides of `ins(C₁)` at a vertex put it on `C₁`. -/ +theorem vertex_of_both_sides {v : S} (hv : v ∈ Γ.V) {a b : Set S} (ha : a ∈ Γ.R) (hb : b ∈ Γ.R) + (hai : a ⊆ ins C₁) (hbn : ¬ b ⊆ ins C₁) (hva : v ∈ closure a) (hvb : v ∈ closure b) : + v ∈ C₁.V := by + have hsub : (boundaryDrawing Γ Z₁).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hconf := boundaryDrawing_isConfined hw hsm.1 + have hCΓ := hL.1.2.1.trans hsub + have hNA := boundaryDrawing_inside hS hs hL.1.1 hCΓ (hconf C₁ hL.1.1 hL.1.2.1) + have hm : v ∈ (boundaryDrawing Γ (insideRegions Γ (ins C₁))).V := + (mem_boundaryDrawing_V hS).mpr ⟨⟨a, ⟨ha, hai⟩, hv, Or.inr ha, hva⟩, b, + ⟨hb, fun h => hbn h.2⟩, hv, Or.inr hb, hvb⟩ + rwa [hNA] at hm + +/-- Statement (4), first part (Graph Minors XI, page 83): `N(Z - A)` lies in `N(Z)`. -/ +theorem boundary_diff_inside {Z : Set (Set S)} (hZ : Z = Z₁ ∨ Disjoint Z Z₁) (hZR : Z ⊆ Γ.R) : + (boundaryDrawing Γ (Z \ insideRegions Γ (ins C₁))).IsSubdrawing (boundaryDrawing Γ Z) := by + have hsub : (boundaryDrawing Γ Z₁).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hconf := boundaryDrawing_isConfined hw hsm.1 + have hCs := hL.1.2.1 + have hCΓ := hCs.trans hsub + have hNA := boundaryDrawing_inside hS hs hL.1.1 hCΓ (hconf C₁ hL.1.1 hCs) + constructor + · intro v hv + obtain ⟨⟨r, ⟨hrZ, hrA⟩, hir⟩, s, ⟨hsR, hsn⟩, his⟩ := (mem_boundaryDrawing_V hS).mp hv + by_cases hsZ : s ∈ Z + · have hsA : s ∈ insideRegions Γ (ins C₁) := by + by_contra h + exact hsn ⟨hsZ, h⟩ + have hvC : v ∈ C₁.V := vertex_of_both_sides hS hs hw hsm hL hir.1 hsR (hZR hrZ) hsA.2 + (fun h => hrA ⟨hZR hrZ, h⟩) his.2.2 hir.2.2 + rcases hZ with rfl | hd + · exact hCs.1 hvC + · obtain ⟨g, hg, hvg⟩ := exists_edge_at_vertex hL.1.1 hvC + obtain ⟨a, b, ha, -, -, -, haZ, -, hga, -, -⟩ := leaf_edge_sides hS hs hw hsm hL hg + exact (mem_boundaryDrawing_V hS).mpr ⟨⟨r, hrZ, hir⟩, a, + ⟨ha, fun h => disjoint_left.mp hd h haZ⟩, hir.1, Or.inr ha, + closure_minimal hga isClosed_closure hvg⟩ + · exact (mem_boundaryDrawing_V hS).mpr ⟨⟨r, hrZ, hir⟩, s, ⟨hsR, hsZ⟩, his⟩ + · intro e he + obtain ⟨⟨r, ⟨hrZ, hrA⟩, hir⟩, s, ⟨hsR, hsn⟩, his⟩ := mem_boundaryDrawing_E.mp he + by_cases hsZ : s ∈ Z + · have hsA : s ∈ insideRegions Γ (ins C₁) := by + by_contra h + exact hsn ⟨hsZ, h⟩ + have heC : e ∈ C₁.E := by + have hm : e ∈ (boundaryDrawing Γ (insideRegions Γ (ins C₁))).E := + mem_boundaryDrawing_E.mpr ⟨⟨s, hsA, his⟩, r, ⟨hZR hrZ, hrA⟩, hir⟩ + rwa [hNA] at hm + rcases hZ with rfl | hd + · exact hCs.2 heC + · obtain ⟨a, b, ha, -, -, -, haZ, -, hga, -, -⟩ := leaf_edge_sides hS hs hw hsm hL heC + obtain ⟨x, hx⟩ := heC.1 + exact mem_boundaryDrawing_E.mpr ⟨⟨r, hrZ, hir⟩, a, + ⟨ha, fun h => disjoint_left.mp hd h haZ⟩, hir.1, ha, x, hx, hga hx⟩ + · exact mem_boundaryDrawing_E.mpr ⟨⟨r, hrZ, hir⟩, s, ⟨hsR, hsZ⟩, his⟩ + +/-- Statement (4), second part: `Z - A` is small. -/ +theorem small_diff_inside [ConnectedSpace S] {Z : Set (Set S)} (hZ : Z = Z₁ ∨ Disjoint Z Z₁) + (hZR : Z ⊆ Γ.R) + (hZs : IsSmall Γ ins k Ω ω Z) : IsSmall Γ ins k Ω ω (Z \ insideRegions Γ (ins C₁)) := by + refine theorem_5_3_proof hS hs hw hZR hZs sdiff_subset (lt_of_le_of_lt ?_ hZs.1) + refine ncard_le_ncard (inter_subset_inter_right _ ?_) + ((boundaryDrawing Γ Z).finite_V.subset inter_subset_right) + exact (boundary_diff_inside hS hs hw hsm hL hZ hZR).1 + +/-- Statement (5) of the proof of (5.4) (Graph Minors XI, page 84). -/ +theorem count_five {Z₂ Z₃ : Set (Set S)} (hR : Z₁ ∪ Z₂ ∪ Z₃ = Γ.R) (h₁₂ : Disjoint Z₁ Z₂) + (hcount : (Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Z₃).ncard + + (Ω ∩ ({v₁} \ (boundaryDrawing Γ Z₂).V)).ncard ≤ + (Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Z₂).ncard) : + (Ω ∩ (boundaryDrawing Γ (Z₂ ∪ insideRegions Γ (ins C₁))).V).ncard ≤ + (Ω ∩ (boundaryDrawing Γ Z₂).V).ncard := by + set W₂ := outerSet Γ (ins C₁) C₁.V v₁ Z₂ with hW₂ + set W₃ := outerSet Γ (ins C₁) C₁.V v₁ Z₃ with hW₃ + set X := (boundaryDrawing Γ Z₂).V with hX + set Y := (boundaryDrawing Γ (Z₂ ∪ insideRegions Γ (ins C₁))).V with hY + have hmemX := fun v => mem_boundaryDrawing_V (Γ := Γ) (Z := Z₂) (v := v) hS + have hmemY := fun v => mem_boundaryDrawing_V (Γ := Γ) + (Z := Z₂ ∪ insideRegions Γ (ins C₁)) (v := v) hS + have hCΓ : C₁.IsSubdrawing Γ := hL.1.2.1.trans (Drawing.span_isSubdrawing Γ _ _) + -- `W₂ ⊆ X - Y`. + have hW₂X : W₂ ⊆ X := by + rintro v ⟨hv, -, hall⟩ + obtain ⟨g, hg, hvg⟩ := exists_edge_at_vertex hL.1.1 hv + obtain ⟨a, b, ha, hb, -, hbn, haZ, -, hga, hgb, -⟩ := leaf_edge_sides hS hs hw hsm hL hg + have hvb := closure_minimal hgb isClosed_closure hvg + have hva := closure_minimal hga isClosed_closure hvg + exact (hmemX v).mpr ⟨⟨b, hall b hb hvb hbn, hCΓ.1 hv, Or.inr hb, hvb⟩, a, + ⟨ha, fun h => disjoint_left.mp h₁₂ haZ h⟩, hCΓ.1 hv, Or.inr ha, hva⟩ + have hW₂Y : ∀ v ∈ W₂, v ∉ Y := by + rintro v ⟨-, -, hall⟩ hvY + obtain ⟨-, s, ⟨hsR, hsn⟩, his⟩ := (hmemY v).mp hvY + have hsA : ¬ s ⊆ ins C₁ := fun h => hsn (Or.inr ⟨hsR, h⟩) + exact hsn (Or.inl (hall s hsR his.2.2 hsA)) + -- `Y - X ⊆ W₃ ∪ D`. + have hYX : ∀ v ∈ Y, v ∉ X → v ∈ W₃ ∨ v ∈ ({v₁} \ X : Set S) := by + intro v hvY hvX + obtain ⟨⟨r, hr, hir⟩, s, ⟨hsR, hsn⟩, his⟩ := (hmemY v).mp hvY + have hsZ₂ : s ∉ Z₂ := fun h => hsn (Or.inl h) + have hsA : ¬ s ⊆ ins C₁ := fun h => hsn (Or.inr ⟨hsR, h⟩) + have hrA : r ∈ insideRegions Γ (ins C₁) := by + rcases hr with h | h + · exact absurd ((hmemX v).mpr ⟨⟨r, h, hir⟩, s, ⟨hsR, hsZ₂⟩, his⟩) hvX + · exact h + have hvC : v ∈ C₁.V := vertex_of_both_sides hS hs hw hsm hL hir.1 hrA.1 hsR hrA.2 hsA + hir.2.2 his.2.2 + by_cases hvv : v = v₁ + · exact Or.inr ⟨hvv, hvX⟩ + refine Or.inl ⟨hvC, hvv, fun t ht hvt hnt => ?_⟩ + have hnZ₁ := leaf_vertex_regions hS hs hw hsm hL hvC hvv ht hvt hnt + rw [← hR] at ht + rcases ht with (h | h) | h + · exact absurd h hnZ₁ + · exact absurd ((hmemX v).mpr ⟨⟨t, h, hir.1, Or.inr (hR ▸ Or.inl (Or.inr h)), hvt⟩, s, + ⟨hsR, hsZ₂⟩, his⟩) hvX + · exact h + have hXf : X.Finite := (boundaryDrawing Γ Z₂).finite_V + have hW₂f : W₂.Finite := hXf.subset hW₂X + have hW₃f : W₃.Finite := C₁.finite_V.subset fun v hv => hv.1 + have hcover : Ω ∩ Y ⊆ ((Ω ∩ X) \ (Ω ∩ W₂)) ∪ (Ω ∩ W₃) ∪ (Ω ∩ ({v₁} \ X)) := by + rintro v ⟨hvΩ, hvY⟩ + by_cases hvX : v ∈ X + · exact Or.inl (Or.inl ⟨⟨hvΩ, hvX⟩, fun h => hW₂Y v h.2 hvY⟩) + · rcases hYX v hvY hvX with h | h + · exact Or.inl (Or.inr ⟨hvΩ, h⟩) + · exact Or.inr ⟨hvΩ, h⟩ + have hdf : ((Ω ∩ X) \ (Ω ∩ W₂)).Finite := (hXf.subset inter_subset_right).sdiff + have hsf : (Ω ∩ W₃).Finite := hW₃f.subset inter_subset_right + have htf : (Ω ∩ ({v₁} \ X)).Finite := + ((finite_singleton v₁).subset sdiff_subset).subset inter_subset_right + have h₁ := ncard_le_ncard hcover ((hdf.union hsf).union htf) + have h₂ := ncard_union_le (((Ω ∩ X) \ (Ω ∩ W₂)) ∪ (Ω ∩ W₃)) (Ω ∩ ({v₁} \ X)) + have h₃ := ncard_union_le ((Ω ∩ X) \ (Ω ∩ W₂)) (Ω ∩ W₃) + have h₄ := ncard_sdiff_add_ncard_of_subset (inter_subset_inter_right Ω hW₂X) + (hXf.subset inter_subset_right) + omega + +end Leaf + +section Main + +variable [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + (hs : IsSlope Γ k ins) (hw : IsWeighting Γ k Ω ω) + {Z₁ Z₂ Z₃ : Set (Set S)} {C₁ : Drawing S} {v₁ : S} +include hS hs hw + +/-- Statement (6) of the proof of (5.4), under the choice that the paper makes "from the symmetry" +(Graph Minors XI, page 84). -/ +theorem leaf_aux (hmin : IsMinTriple Γ ins k Ω ω Z₁ Z₂ Z₃) + (hL : IsLeafRing ins (boundaryDrawing Γ Z₁) C₁ v₁) + (h₃ : (C₁.E ∩ (boundaryDrawing Γ Z₂).E).Nonempty) + (hcount : (Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Z₃).ncard + + (Ω ∩ ({v₁} \ (boundaryDrawing Γ Z₂).V)).ncard ≤ + (Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Z₂).ncard) : + insideRegions Γ (ins C₁) ⊆ Z₁ ∧ + (boundaryDrawing Γ Z₁).E ∩ (boundaryDrawing Γ Z₃).E ⊆ C₁.E := by + obtain ⟨⟨hcov, d₁₂, d₁₃, d₂₃, s₁, s₂, s₃⟩, hmn⟩ := id hmin + have ht := hmin.triple + set A := insideRegions Γ (ins C₁) with hA + have hR₁ : Z₁ ⊆ Γ.R := fun r h => hcov ▸ Or.inl (Or.inl h) + have hR₂ : Z₂ ⊆ Γ.R := fun r h => hcov ▸ Or.inl (Or.inr h) + have hR₃ : Z₃ ⊆ Γ.R := fun r h => hcov ▸ Or.inr h + have hRA : A ⊆ Γ.R := fun r h => h.1 + have hsub : (boundaryDrawing Γ Z₁).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hconf := boundaryDrawing_isConfined hw s₁.1 + have hCs := hL.1.2.1 + have hC := hL.1.1 + have hCΓ := hCs.trans hsub + have hl := hconf C₁ hC hCs + have hNA : boundaryDrawing Γ A = C₁ := boundaryDrawing_inside hS hs hC hCΓ hl + have hEA : ∀ e, e ∈ (boundaryDrawing Γ A).E ↔ e ∈ C₁.E := fun e => by rw [hNA] + have hsame := @leaf_edge_sides S _ Γ k ω ins Ω _ hS hs hw Z₁ C₁ v₁ s₁ hL + have hsmall₁ := small_diff_inside hS hs hw s₁ hL (Or.inl rfl) hR₁ s₁ + have hsmall₂ := small_diff_inside hS hs hw s₁ hL (Or.inr d₁₂.symm) hR₂ s₂ + have hsmall₃ := small_diff_inside hS hs hw s₁ hL (Or.inr d₁₃.symm) hR₃ s₃ + have hsub₁ := boundary_diff_inside hS hs hw s₁ hL (Or.inl rfl) hR₁ + have hsub₂ := boundary_diff_inside hS hs hw s₁ hL (Or.inr d₁₂.symm) hR₂ + have hsub₃ := boundary_diff_inside hS hs hw s₁ hL (Or.inr d₁₃.symm) hR₃ + -- The edges of `N(Z₂ ∪ A)` lie in `N(Z₂) ∪ C₁`. + have hY : ∀ e ∈ (boundaryDrawing Γ (Z₂ ∪ A)).E, e ∈ (boundaryDrawing Γ Z₂).E ∨ e ∈ C₁.E := by + intro e he + obtain ⟨⟨r, hr, hir⟩, s, ⟨hsR, hsn⟩, his⟩ := mem_boundaryDrawing_E.mp he + rcases hr with h | h + · exact Or.inl (mem_boundaryDrawing_E.mpr ⟨⟨r, h, hir⟩, s, ⟨hsR, fun h' => hsn + (Or.inl h')⟩, his⟩) + · exact Or.inr ((hEA e).mp (mem_boundaryDrawing_E.mpr + ⟨⟨r, h, hir⟩, s, ⟨hsR, fun h' => hsn (Or.inr h')⟩, his⟩)) + have hfinE : (tripleE Γ Z₁ Z₂ Z₃).Finite := + ((boundaryDrawing Γ Z₁).finite_edges.union (boundaryDrawing Γ Z₂).finite_edges).union + (boundaryDrawing Γ Z₃).finite_edges + have hCK : ∀ e ∈ C₁.E, e ∈ tripleE Γ Z₁ Z₂ Z₃ := fun e he => Or.inl (Or.inl (hCs.2 he)) + have hN₂K : ∀ e ∈ (boundaryDrawing Γ Z₂).E, e ∈ tripleE Γ Z₁ Z₂ Z₃ := + fun e he => Or.inl (Or.inr he) + have hYK : ∀ e ∈ (boundaryDrawing Γ (Z₂ ∪ A)).E, e ∈ tripleE Γ Z₁ Z₂ Z₃ := fun e he => + (hY e he).elim (hN₂K e) (hCK e) + -- By the choice of `(Z₁, Z₂, Z₃)`, the set `Z₂ ∪ A` is not small. + have hnotsmall : ¬ IsSmall Γ ins k Ω ω (Z₂ ∪ A) := by + intro hsmall + have hT : IsTriple Γ ins k Ω ω (Z₁ \ A) (Z₂ ∪ A) (Z₃ \ A) := by + refine ⟨?_, ?_, ?_, ?_, hsmall₁, hsmall, hsmall₃⟩ + · ext r + rw [← hcov] + constructor + · rintro ((⟨h, -⟩ | h | h) | ⟨h, -⟩) + · exact Or.inl (Or.inl h) + · exact Or.inl (Or.inr h) + · exact hcov ▸ h.1 + · exact Or.inr h + · intro h + by_cases hrA : r ∈ A + · exact Or.inl (Or.inr (Or.inr hrA)) + · rcases h with (h | h) | h + · exact Or.inl (Or.inl ⟨h, hrA⟩) + · exact Or.inl (Or.inr (Or.inl h)) + · exact Or.inr ⟨h, hrA⟩ + · refine disjoint_left.mpr ?_ + rintro r ⟨h, hrA⟩ (h' | h') + · exact disjoint_left.mp d₁₂ h h' + · exact hrA h' + · exact disjoint_left.mpr fun r h h' => disjoint_left.mp d₁₃ h.1 h'.1 + · refine disjoint_left.mpr ?_ + rintro r (h' | h') ⟨h, hrA⟩ + · exact disjoint_left.mp d₂₃ h' h + · exact hrA h' + have hle := hmn _ _ _ hT + have hsubK : tripleE Γ (Z₁ \ A) (Z₂ ∪ A) (Z₃ \ A) ⊆ tripleE Γ Z₁ Z₂ Z₃ := by + rintro e ((he | he) | he) + · exact Or.inl (Or.inl (hsub₁.2 he)) + · exact hYK e he + · exact Or.inr (hsub₃.2 he) + obtain ⟨e₀, he₀C, he₀N⟩ := h₃ + obtain ⟨a, b, ha, hb, hai, hbn, haZ, hbZ, hea, heb, hsides⟩ := hsame he₀C + obtain ⟨⟨r, hrZ, hir⟩, -⟩ := mem_boundaryDrawing_E.mp he₀N + have hbZ₂ : b ∈ Z₂ := by + rcases hsides r hir.2.1 hir.2.2 with rfl | rfl + · exact absurd haZ (disjoint_right.mp d₁₂ hrZ) + · exact hrZ + have haA : a ∈ A := ⟨ha, hai⟩ + have hbA : b ∉ A := fun h => hbn h.2 + have hnotK : e₀ ∉ tripleE Γ (Z₁ \ A) (Z₂ ∪ A) (Z₃ \ A) := by + rintro ((he | he) | he) + · obtain ⟨⟨r', hr', hir'⟩, -⟩ := mem_boundaryDrawing_E.mp he + rcases hsides r' hir'.2.1 hir'.2.2 with rfl | rfl + · exact hr'.2 haA + · exact hbZ hr'.1 + · obtain ⟨-, r', ⟨hr'R, hr'n⟩, hir'⟩ := mem_boundaryDrawing_E.mp he + rcases hsides r' hir'.2.1 hir'.2.2 with rfl | rfl + · exact hr'n (Or.inr haA) + · exact hr'n (Or.inl hbZ₂) + · obtain ⟨⟨r', hr', hir'⟩, -⟩ := mem_boundaryDrawing_E.mp he + rcases hsides r' hir'.2.1 hir'.2.2 with rfl | rfl + · exact hr'.2 haA + · exact disjoint_left.mp d₂₃ hbZ₂ hr'.1 + have hlt := ncard_lt_ncard (⟨hsubK, fun h => hnotK (h (hCK e₀ he₀C))⟩ : + tripleE Γ (Z₁ \ A) (Z₂ ∪ A) (Z₃ \ A) ⊂ tripleE Γ Z₁ Z₂ Z₃) hfinE + omega + -- By (5) and (5.2), the rest `R(Γ) - (Z₂ ∪ A)` is small. + have hltY : (Ω ∩ (boundaryDrawing Γ (Z₂ ∪ A)).V).ncard < ω := + lt_of_le_of_lt (count_five hS hs hw s₁ hL hcov d₁₂ hcount) s₂.1 + have hRY : Z₂ ∪ A ⊆ Γ.R := union_subset hR₂ hRA + have hrest : IsSmall Γ ins k Ω ω (Γ.R \ (Z₂ ∪ A)) := + (theorem_5_2_proof hS hs hw hRY hltY).1.resolve_left hnotsmall + have hAsmall : IsSmall Γ ins k Ω ω A := by + constructor + · rw [hNA] + refine lt_of_le_of_lt (ncard_le_ncard (inter_subset_inter_right _ hCs.1) + ((boundaryDrawing Γ Z₁).finite_V.subset inter_subset_right)) s₁.1 + · intro r hr + rw [hNA] + exact ⟨C₁, hC, Drawing.IsSubdrawing.refl _, hl, hr.2⟩ + have hT₂ : IsTriple Γ ins k Ω ω A (Z₂ \ A) (Γ.R \ (Z₂ ∪ A)) := by + refine ⟨?_, ?_, ?_, ?_, hAsmall, hsmall₂, hrest⟩ + · ext r + constructor + · rintro ((h | h) | h) + · exact h.1 + · exact hR₂ h.1 + · exact h.1 + · intro h + by_cases hrA : r ∈ A + · exact Or.inl (Or.inl hrA) + · by_cases hrZ : r ∈ Z₂ + · exact Or.inl (Or.inr ⟨hrZ, hrA⟩) + · exact Or.inr ⟨h, fun h' => h'.elim hrZ hrA⟩ + · exact disjoint_left.mpr fun r h h' => h'.2 h + · exact disjoint_left.mpr fun r h h' => h'.2 (Or.inr h) + · exact disjoint_left.mpr fun r h h' => h'.2 (Or.inl h.1) + have hcompl : boundaryDrawing Γ (Γ.R \ (Z₂ ∪ A)) = boundaryDrawing Γ (Z₂ ∪ A) := + boundaryDrawing_compl hRY + have hsubT : tripleE Γ A (Z₂ \ A) (Γ.R \ (Z₂ ∪ A)) ⊆ tripleE Γ Z₁ Z₂ Z₃ := by + rintro e ((he | he) | he) + · exact hCK e ((hEA e).mp he) + · exact hN₂K e (hsub₂.2 he) + · rw [hcompl] at he + exact hYK e he + have heqT : tripleE Γ A (Z₂ \ A) (Γ.R \ (Z₂ ∪ A)) = tripleE Γ Z₁ Z₂ Z₃ := + eq_of_subset_of_ncard_le hsubT (hmn _ _ _ hT₂) hfinE + -- An edge of `K` outside `C₁` has a side in `Z₂ - A`. + have hcases' : ∀ e ∈ tripleE Γ Z₁ Z₂ Z₃, e ∉ C₁.E → + ∃ r ∈ Z₂, r ∉ A ∧ Γ.EdgeRegionIncident e r := by + intro e he heC + rw [← heqT] at he + rcases he with (he | he) | he + · exact absurd ((hEA e).mp he) heC + · obtain ⟨⟨r, hr, hir⟩, -⟩ := mem_boundaryDrawing_E.mp he + exact ⟨r, hr.1, hr.2, hir⟩ + · rw [hcompl] at he + obtain ⟨⟨r, hr, hir⟩, s, ⟨hsR, hsn⟩, his⟩ := mem_boundaryDrawing_E.mp he + have hrA : r ∉ A := fun hrA => heC ((hEA e).mp (mem_boundaryDrawing_E.mpr + ⟨⟨r, hrA, hir⟩, s, ⟨hsR, fun h' => hsn (Or.inr h')⟩, his⟩)) + exact ⟨r, hr.resolve_right hrA, hrA, hir⟩ + constructor + · -- `A ⊆ Z₁` by (5.1). + intro s hsA + by_contra hsZ + obtain ⟨e₁, he₁⟩ := IsCircuit.E_nonempty hC + obtain ⟨a, -, ha, -, hai, -, haZ, -, -, -, -⟩ := hsame he₁ + have hnonU : ∀ r ∈ Γ.R, r ⊆ ins C₁ → r ⊆ ins C₁ \ C₁.U := fun r hr hin x hx => + ⟨hin hx, fun hU => region_subset hr hx (hCΓ.U_subset hU)⟩ + obtain ⟨x, hx⟩ := region_nonempty ha + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hD : ins C₁ \ C₁.U ∈ C₁.R := + inner_mem_R hS hs hC hCΓ hl (hnonU a ha hai hx).1 (hnonU a ha hai hx).2 + obtain ⟨e, heΓ, heC, a', b', ha'Z, hb'Z, ha'D, hb'D, hia', hib'⟩ := theorem_5_1_proof hS hCΓ hD + ha + haZ hsA.1 hsZ (hnonU a ha hai) (hnonU s hsA.1 hsA.2) + have ha'A : a' ∈ A := ⟨hia'.2.1, fun y hy => (ha'D hy).1⟩ + have hb'A : b' ∈ A := ⟨hib'.2.1, fun y hy => (hb'D hy).1⟩ + have heN : e ∈ tripleE Γ Z₁ Z₂ Z₃ := Or.inl (Or.inl (mem_boundaryDrawing_E.mpr + ⟨⟨a', ha'Z, hia'⟩, b', ⟨hib'.2.1, hb'Z⟩, hib'⟩)) + obtain ⟨r, hrZ, hrA, hir⟩ := hcases' e heN heC + have hne : a' ≠ b' := fun h => hb'Z (h ▸ ha'Z) + rcases sides_of_edge hS heΓ hia'.2.1 hib'.2.1 hne + (edge_subset_closure_of_incident hS heΓ hia'.2.1 hia'.2.2) + (edge_subset_closure_of_incident hS heΓ hib'.2.1 hib'.2.2) hir.2.1 hir.2.2 with h | h + · exact hrA (h ▸ ha'A) + · exact hrA (h ▸ hb'A) + · -- The first claim of (6). + rintro e ⟨he₁, he₃⟩ + by_contra heC + obtain ⟨r, hrZ, -, hir⟩ := hcases' e (Or.inl (Or.inl he₁)) heC + obtain ⟨⟨a, haZ, hia⟩, -⟩ := mem_boundaryDrawing_E.mp he₁ + obtain ⟨⟨b, hbZ, hib⟩, -⟩ := mem_boundaryDrawing_E.mp he₃ + have hne : a ≠ b := fun h => disjoint_left.mp d₁₃ haZ (h ▸ hbZ) + rcases sides_of_edge hS hia.1 hia.2.1 hib.2.1 hne + (edge_subset_closure_of_incident hS hia.1 hia.2.1 hia.2.2) + (edge_subset_closure_of_incident hS hia.1 hib.2.1 hib.2.2) hir.2.1 hir.2.2 with h | h + · exact disjoint_left.mp d₁₂ haZ (h ▸ hrZ) + · exact disjoint_left.mp d₂₃ hrZ (h ▸ hbZ) + +/-- Statement (6) of the proof of (5.4) for a ring as in (1), with the choice made "from the +symmetry" +left open (Graph Minors XI, page 84). -/ +theorem leaf_main (hmin : IsMinTriple Γ ins k Ω ω Z₁ Z₂ Z₃) + (hL : IsLeafRing ins (boundaryDrawing Γ Z₁) C₁ v₁) : + insideRegions Γ (ins C₁) ⊆ Z₁ ∧ ∃ Zp Zq : Set (Set S), ((Zp = Z₂ ∧ Zq = Z₃) ∨ (Zp = Z₃ ∧ Zq + = Z₂)) ∧ + (C₁.E ∩ (boundaryDrawing Γ Zp).E).Nonempty ∧ + (boundaryDrawing Γ Z₁).E ∩ (boundaryDrawing Γ Zq).E ⊆ C₁.E := by + obtain ⟨hcov, d₁₂, d₁₃, d₂₃, s₁, s₂, s₃⟩ := hmin.triple + have hsame := @leaf_edge_sides S _ Γ k ω ins Ω _ hS hs hw Z₁ C₁ v₁ s₁ hL + obtain ⟨f, hf, hv₁f⟩ := exists_edge_at_vertex hL.1.1 hL.2.1 + have hCΓ : C₁.IsSubdrawing Γ := hL.1.2.1.trans (Drawing.span_isSubdrawing Γ _ _) + -- The conditions of `leaf_aux` follow from the comparison of `|W₂ ∩ Ω|` and `|W₃ ∩ Ω|`. + have horder : ∀ Y₂ Y₃ : Set (Set S), Disjoint Z₁ Y₂ → + ((Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Y₃).ncard < (Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Y₂).ncard ∨ + ((Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Y₃).ncard = (Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Y₂).ncard ∧ + f ∈ (boundaryDrawing Γ Y₂).E)) → + (C₁.E ∩ (boundaryDrawing Γ Y₂).E).Nonempty ∧ + (Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Y₃).ncard + (Ω ∩ ({v₁} \ (boundaryDrawing Γ Y₂).V)).ncard ≤ + (Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Y₂).ncard := by + intro Y₂ Y₃ hd h + rcases h with h | ⟨h, hfY⟩ + · constructor + · have hne : (Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Y₂).Nonempty := by + by_contra hemp + rw [not_nonempty_iff_eq_empty] at hemp + rw [hemp, ncard_empty] at h + omega + obtain ⟨v, -, hv, -, hall⟩ := hne + obtain ⟨g, hg, hvg⟩ := exists_edge_at_vertex hL.1.1 hv + obtain ⟨a, b, ha, hb, -, hbn, haZ, -, hga, hgb, -⟩ := hsame hg + obtain ⟨x, hx⟩ := hg.1 + have hbY := hall b hb (closure_minimal hgb isClosed_closure hvg) hbn + have hgΓ := hCΓ.2 hg + exact ⟨g, hg, mem_boundaryDrawing_E.mpr ⟨⟨b, hbY, hgΓ, hb, x, hx, hgb hx⟩, a, + ⟨ha, disjoint_left.mp hd haZ⟩, hgΓ, ha, x, hx, hga hx⟩⟩ + · have hD : (Ω ∩ ({v₁} \ (boundaryDrawing Γ Y₂).V)).ncard ≤ 1 := by + have hsub : Ω ∩ ({v₁} \ (boundaryDrawing Γ Y₂).V) ⊆ {v₁} := fun _ hx => hx.2.1 + calc _ ≤ ({v₁} : Set S).ncard := ncard_le_ncard hsub (finite_singleton _) + _ = 1 := ncard_singleton _ + omega + · refine ⟨⟨f, hf, hfY⟩, ?_⟩ + have hv₁Y : v₁ ∈ (boundaryDrawing Γ Y₂).V := by + have hm : v₁ ∈ closure f ∩ Γ.V := ⟨hv₁f, hCΓ.1 hL.2.1⟩ + rw [← (Drawing.span_isSubdrawing Γ _ _).closure_inter_V hfY] at hm + exact hm.2 + have hemp : Ω ∩ ({v₁} \ (boundaryDrawing Γ Y₂).V) = ∅ := by + ext x + simp only [mem_inter_iff, mem_sdiff, mem_singleton_iff, mem_empty_iff_false, iff_false] + rintro ⟨-, rfl, h'⟩ + exact h' hv₁Y + rw [hemp, ncard_empty] + omega + have hfN : f ∈ (boundaryDrawing Γ Z₂).E ∨ f ∈ (boundaryDrawing Γ Z₃).E := by + obtain ⟨a, b, ha, hb, -, -, haZ, hbZ, hfa, hfb, -⟩ := hsame hf + obtain ⟨x, hx⟩ := hf.1 + have hfΓ := hCΓ.2 hf + have hbR : b ∈ Z₁ ∪ Z₂ ∪ Z₃ := hcov ▸ hb + rcases hbR with (h | h) | h + · exact absurd h hbZ + · exact Or.inl (mem_boundaryDrawing_E.mpr ⟨⟨b, h, hfΓ, hb, x, hx, hfb hx⟩, a, + ⟨ha, disjoint_left.mp d₁₂ haZ⟩, hfΓ, ha, x, hx, hfa hx⟩) + · exact Or.inr (mem_boundaryDrawing_E.mpr ⟨⟨b, h, hfΓ, hb, x, hx, hfb hx⟩, a, + ⟨ha, disjoint_left.mp d₁₃ haZ⟩, hfΓ, ha, x, hx, hfa hx⟩) + have h₂₃ : (Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Z₃).ncard < (Ω ∩ outerSet Γ + (ins C₁) C₁.V v₁ Z₂).ncard ∨ + ((Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Z₃).ncard = (Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Z₂).ncard ∧ + f ∈ (boundaryDrawing Γ Z₂).E) → + insideRegions Γ (ins C₁) ⊆ Z₁ ∧ ∃ Zp Zq : Set (Set S), ((Zp = Z₂ ∧ Zq = Z₃) ∨ (Zp = Z₃ ∧ Zq + = Z₂)) ∧ + (C₁.E ∩ (boundaryDrawing Γ Zp).E).Nonempty ∧ + (boundaryDrawing Γ Z₁).E ∩ (boundaryDrawing Γ Zq).E ⊆ C₁.E := fun h => by + obtain ⟨h₁, h₂⟩ := horder Z₂ Z₃ d₁₂ h + obtain ⟨h₃, h₄⟩ := leaf_aux hS hs hw hmin hL h₁ h₂ + exact ⟨h₃, Z₂, Z₃, Or.inl ⟨rfl, rfl⟩, h₁, h₄⟩ + have h₃₂ : (Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Z₂).ncard < (Ω ∩ outerSet Γ + (ins C₁) C₁.V v₁ Z₃).ncard ∨ + ((Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Z₂).ncard = (Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Z₃).ncard ∧ + f ∈ (boundaryDrawing Γ Z₃).E) → + insideRegions Γ (ins C₁) ⊆ Z₁ ∧ ∃ Zp Zq : Set (Set S), ((Zp = Z₂ ∧ Zq = Z₃) ∨ (Zp = Z₃ ∧ Zq + = Z₂)) ∧ + (C₁.E ∩ (boundaryDrawing Γ Zp).E).Nonempty ∧ + (boundaryDrawing Γ Z₁).E ∩ (boundaryDrawing Γ Zq).E ⊆ C₁.E := fun h => by + obtain ⟨h₁, h₂⟩ := horder Z₃ Z₂ d₁₃ h + obtain ⟨h₃, h₄⟩ := leaf_aux hS hs hw hmin.swap₂₃ hL h₁ h₂ + exact ⟨h₃, Z₃, Z₂, Or.inr ⟨rfl, rfl⟩, h₁, h₄⟩ + rcases lt_trichotomy (Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Z₃).ncard + (Ω ∩ outerSet Γ (ins C₁) C₁.V v₁ Z₂).ncard with h | h | h + · exact h₂₃ (Or.inl h) + · rcases hfN with hf' | hf' + · exact h₂₃ (Or.inr ⟨h, hf'⟩) + · exact h₃₂ (Or.inr ⟨h.symm, hf'⟩) + · exact h₃₂ (Or.inl h) + +/-- The end of statement (7): if `N(Z₁)` and `N(Z₃)` have no common edge, then `N(Z₂)` captures +every +region of `Γ`, contrary to (4.4), which here takes the form of (5.2). -/ +theorem no_empty_pair (ht : IsTriple Γ ins k Ω ω Z₁ Z₂ Z₃) + (hemp : Disjoint (boundaryDrawing Γ Z₁).E (boundaryDrawing Γ Z₃).E) : False := by + obtain ⟨hcov, d₁₂, d₁₃, d₂₃, s₁, s₂, s₃⟩ := ht + have hR₁ : Z₁ ⊆ Γ.R := fun r h => hcov ▸ Or.inl (Or.inl h) + have hR₂ : Z₂ ⊆ Γ.R := fun r h => hcov ▸ Or.inl (Or.inr h) + have hR₃ : Z₃ ⊆ Γ.R := fun r h => hcov ▸ Or.inr h + have hsplit : ∀ r ∈ Γ.R, r ∈ Z₁ ∨ r ∈ Z₂ ∨ r ∈ Z₃ := fun r hr => by + have hm : r ∈ Z₁ ∪ Z₂ ∪ Z₃ := hcov ▸ hr + rcases hm with (h | h) | h + · exact Or.inl h + · exact Or.inr (Or.inl h) + · exact Or.inr (Or.inr h) + have hE₁ : (boundaryDrawing Γ Z₁).E ⊆ (boundaryDrawing Γ Z₂).E := by + intro e he + obtain ⟨⟨r, hr, hir⟩, s, ⟨hsR, hsn⟩, his⟩ := mem_boundaryDrawing_E.mp he + rcases hsplit s hsR with h | h | h + · exact absurd h hsn + · exact mem_boundaryDrawing_E.mpr ⟨⟨s, h, his⟩, r, ⟨hR₁ hr, disjoint_left.mp d₁₂ hr⟩, hir⟩ + · exact absurd (mem_boundaryDrawing_E.mpr ⟨⟨s, h, his⟩, r, + ⟨hR₁ hr, disjoint_left.mp d₁₃ hr⟩, hir⟩) (disjoint_left.mp hemp he) + have hE₃ : (boundaryDrawing Γ Z₃).E ⊆ (boundaryDrawing Γ Z₂).E := by + intro e he + obtain ⟨⟨r, hr, hir⟩, s, ⟨hsR, hsn⟩, his⟩ := mem_boundaryDrawing_E.mp he + rcases hsplit s hsR with h | h | h + · exact absurd he (disjoint_left.mp hemp (mem_boundaryDrawing_E.mpr ⟨⟨s, h, his⟩, r, + ⟨hR₃ hr, disjoint_right.mp d₁₃ hr⟩, hir⟩)) + · exact mem_boundaryDrawing_E.mpr ⟨⟨s, h, his⟩, r, ⟨hR₃ hr, disjoint_right.mp d₂₃ hr⟩, hir⟩ + · exact absurd h hsn + have hN₂ : (boundaryDrawing Γ Z₂).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hcap : ∀ {Y : Set (Set S)}, (boundaryDrawing Γ Y).E ⊆ (boundaryDrawing Γ Z₂).E → + IsSmall Γ ins k Ω ω Y → ∀ r ∈ Y, Captures ins k (boundaryDrawing Γ Z₂) r := by + rintro Y hE hY r hr + obtain ⟨C, hC, hCs, hl, hin⟩ := hY.2 r hr + exact ⟨C, hC, circuit_isSubdrawing_of_E hC (hCs.trans (Drawing.span_isSubdrawing Γ _ _)) hN₂ + (hCs.2.trans hE), hl, hin⟩ + have hcompl : boundaryDrawing Γ (Γ.R \ Z₂) = boundaryDrawing Γ Z₂ := boundaryDrawing_compl hR₂ + refine (theorem_5_2_proof hS hs hw hR₂ s₂.1).2 ⟨s₂, ?_, ?_⟩ + · rw [hcompl] + exact s₂.1 + · rintro r ⟨hr, hrn⟩ + rw [hcompl] + rcases hsplit r hr with h | h | h + · exact hcap hE₁ s₁ r h + · exact absurd h hrn + · exact hcap hE₃ s₃ r h + +omit [ConnectedSpace S] hs hw in +/-- Every edge of `N(Z)` lies on a circuit of `N(Z)` (Graph Minors XI, page 83: "every vertex of +$N(Z_1)$ has even valency and so every edge of $N(Z_1)$ is in a circuit"). -/ +theorem exists_circuit_N (Z : Set (Set S)) : + ∀ e ∈ (boundaryDrawing Γ Z).E, ∃ D : Drawing S, D.IsCircuit ∧ + D.IsSubdrawing (boundaryDrawing Γ Z) ∧ e ∈ D.E := by + intro e he + have : Nonempty S := (he.1.mono (he.2.1.trans sdiff_subset)).to_subtype.map fun x => x.1 + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + exact exists_circuit_of_even hγ (Drawing.span_isSubdrawing Γ _ _) + (fun v hv => even_nHalf hS Γ hγ hv Z) he + +/-- Statement (7) of the proof of (5.4) (Graph Minors XI, page 84): "`Z₁ = A`". -/ +theorem leaf_all_inside (hmin : IsMinTriple Γ ins k Ω ω Z₁ Z₂ Z₃) + (hL : IsLeafRing ins (boundaryDrawing Γ Z₁) C₁ v₁) : Z₁ = insideRegions Γ (ins C₁) := by + obtain ⟨hcov, d₁₂, d₁₃, d₂₃, s₁, s₂, s₃⟩ := id hmin.triple + have hR₁ : Z₁ ⊆ Γ.R := fun r h => hcov ▸ Or.inl (Or.inl h) + have hconf := boundaryDrawing_isConfined hw s₁.1 + have hs' := theorem_4_2_proof hs (Drawing.span_isSubdrawing Γ _ _ : + (boundaryDrawing Γ Z₁).IsSubdrawing Γ) + refine subset_antisymm (fun s hs₁ => ?_) (leaf_main hS hs hw hmin hL).1 + refine ⟨hR₁ hs₁, ?_⟩ + by_contra hsn + -- There is another ring, and so a second ring as in (1). + obtain ⟨D, hD, hDs, -, hin⟩ := s₁.2 s hs₁ + obtain ⟨C', hC', hle⟩ := exists_ring_above ins hD hDs + have hne : C' ≠ C₁ := fun h => hsn (h ▸ hin.trans hle) + obtain ⟨C₂, v₂, hL₂, hne₂⟩ := exists_second_leaf_ring hs' hconf + (exists_circuit_N hS Z₁) hL hC' hne + obtain ⟨-, Zp, Zq, hpq, ⟨g, hg₁, hgp⟩, hq⟩ := leaf_main hS hs hw hmin hL + obtain ⟨-, Zp', Zq', hpq', -, hq'⟩ := leaf_main hS hs hw hmin hL₂ + -- Distinct rings have no common edge. + have hdisj : Disjoint C₁.E C₂.E := ring_edge_disjoint hs' hconf hL.1 hL₂.1 hne₂ + have hg₁N : g ∈ (boundaryDrawing Γ Z₁).E := hL.1.2.1.2 hg₁ + -- The partner of `C₂` is not the partner `Zp` of `C₁`, so it is `Zq`. + have hpartner : Zq' = Zq := by + by_contra hneq + have hZq' : Zq' = Zp := by + rcases hpq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> rcases hpq' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> + first | rfl | exact absurd rfl hneq + exact disjoint_left.mp hdisj hg₁ (hq' ⟨hg₁N, hZq' ▸ hgp⟩) + have hempty : Disjoint (boundaryDrawing Γ Z₁).E (boundaryDrawing Γ Zq).E := + disjoint_left.mpr fun e h₁ h₃ => + disjoint_left.mp hdisj (hq ⟨h₁, h₃⟩) (hq' ⟨h₁, hpartner ▸ h₃⟩) + rcases hpq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact no_empty_pair hS hs hw hmin.triple hempty + · exact no_empty_pair hS hs hw hmin.triple.swap₂₃ hempty + +/-- `Z₁` is not empty (Graph Minors XI, page 82: "$Z_1 \ne \emptyset$ because otherwise a +contradiction would be obtained by taking $Z = Z_2$ +in (5.2)"). -/ +theorem IsTriple.nonempty₁ (ht : IsTriple Γ ins k Ω ω Z₁ Z₂ Z₃) : Z₁.Nonempty := by + by_contra hemp + rw [not_nonempty_iff_eq_empty] at hemp + obtain ⟨hcov, -, -, d₂₃, -, s₂, s₃⟩ := ht + subst hemp + rw [empty_union] at hcov + have hR₂ : Z₂ ⊆ Γ.R := fun r h => hcov ▸ Or.inl h + have heq : Γ.R \ Z₂ = Z₃ := by + rw [← hcov, union_sdiff_left] + exact d₂₃.symm.sdiff_eq_left + refine (theorem_5_2_proof hS hs hw hR₂ s₂.1).2 ⟨s₂, ?_⟩ + rw [heq] + exact s₃ + +/-- Statements (7) and (8) of the proof of (5.4) (Graph Minors XI, pages 84–85): `N(Z₁)` is a +circuit, +of length `< 2θ`, and `Z₁` is the set of regions in its `ins`. -/ +theorem exists_circuit_of_min (hmin : IsMinTriple Γ ins k Ω ω Z₁ Z₂ Z₃) : + (boundaryDrawing Γ Z₁).IsCircuit ∧ (boundaryDrawing Γ Z₁).length < k ∧ + Z₁ = insideRegions Γ (ins (boundaryDrawing Γ Z₁)) := by + have ht := hmin.triple + have hconf := boundaryDrawing_isConfined hw ht.s₁.1 + have hsub : (boundaryDrawing Γ Z₁).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hs' := theorem_4_2_proof hs hsub + obtain ⟨r, hr⟩ := ht.nonempty₁ hS hs hw + obtain ⟨D, hD, hDs, -, -⟩ := ht.s₁.2 r hr + obtain ⟨C, v, hL⟩ := exists_leaf_ring hs' hconf (exists_circuit_N hS Z₁) hD hDs + have hZ := leaf_all_inside hS hs hw hmin hL + have hCΓ := hL.1.2.1.trans hsub + have hl := hconf C hL.1.1 hL.1.2.1 + have hNA := boundaryDrawing_inside hS hs hL.1.1 hCΓ hl + rw [← hZ] at hNA + rw [hNA] + exact ⟨hL.1.1, hl, hZ⟩ + +omit [ConnectedSpace S] hw in +/-- The regions in `ins(C)` lie all in or all out of `ins(T)`, if `U(T)` misses the interior of +`ins(C)`. -/ +theorem inside_same_side {C T : Drawing S} (hC : C.IsCircuit) (hCs : C.IsSubdrawing Γ) + (hl : C.length < k) (hT : T.IsCircuit) (hTs : T.IsSubdrawing Γ) (hTl : T.length < k) + (hoff : ∀ e ∈ T.E, ∃ r ∈ Γ.R, e ⊆ closure r ∧ ¬ r ⊆ ins C) : + insideRegions Γ (ins C) ⊆ insideRegions Γ (ins T) ∨ + Disjoint (insideRegions Γ (ins C)) (insideRegions Γ (ins T)) := by + obtain ⟨hclT, hfrT, -⟩ := ins_facts_of_length hs hT hTs hTl + have hdis : Disjoint (ins C \ C.U) (frontier (ins T)) := by + rw [hfrT] + refine disjoint_left.mpr fun x hx hxU => ?_ + obtain ⟨g, hg, hxg⟩ : ∃ g ∈ T.E, x ∈ closure g := by + rw [T.U_eq] at hxU + rcases hxU with h | h + · exact exists_edge_at_vertex hT h + · obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h + exact ⟨g, hg, hxg⟩ + obtain ⟨r, hr, hgr, hnot⟩ := hoff g hg + exact hnot (region_subset_ins_of_closure hs hC hCs hl hr + (closure_minimal hgr isClosed_closure hxg) hx.1 hx.2) + have hnonU : ∀ r ∈ insideRegions Γ (ins C), r ⊆ ins C \ C.U := fun r hr x hx => + ⟨hr.2 hx, fun hU => region_subset hr.1 hx (hCs.U_subset hU)⟩ + rcases subset_or_disjoint_of_frontier hclT (isPreconnected_inner hS hs hC hCs hl) hdis with h | h + · exact Or.inl fun r hr => ⟨hr.1, (hnonU r hr).trans h⟩ + · refine Or.inr (disjoint_left.mpr fun r hr hr' => ?_) + obtain ⟨x, hx⟩ := region_nonempty hr.1 + exact disjoint_left.mp h (hnonU r hr hx) (hr'.2 hx) + +end Main + +/-- A subset of a union of three disjoint sets, with each in it or disjoint from it, that is neither +empty nor everything, is one of them or the complement of one of them. -/ +theorem sets_cases {α : Type*} {R Z₁ Z₂ Z₃ Y : Set α} (hc : Z₁ ∪ Z₂ ∪ Z₃ = R) (hY : Y ⊆ R) + (h₁ : Z₁ ⊆ Y ∨ Disjoint Z₁ Y) (h₂ : Z₂ ⊆ Y ∨ Disjoint Z₂ Y) (h₃ : Z₃ ⊆ Y ∨ Disjoint Z₃ Y) + (hne : Y.Nonempty) (hne' : (R \ Y).Nonempty) : + (Y = Z₁ ∨ Y = Z₂ ∨ Y = Z₃) ∨ (R \ Y = Z₁ ∨ R \ Y = Z₂ ∨ R \ Y = Z₃) := by + have hcov : ∀ r ∈ R, r ∈ Z₁ ∨ r ∈ Z₂ ∨ r ∈ Z₃ := fun r hr => by + have hm : r ∈ Z₁ ∪ Z₂ ∪ Z₃ := hc ▸ hr + rcases hm with (h | h) | h + · exact Or.inl h + · exact Or.inr (Or.inl h) + · exact Or.inr (Or.inr h) + have hsub₁ : Z₁ ⊆ R := fun r h => hc ▸ Or.inl (Or.inl h) + have hsub₂ : Z₂ ⊆ R := fun r h => hc ▸ Or.inl (Or.inr h) + have hsub₃ : Z₃ ⊆ R := fun r h => hc ▸ Or.inr h + have hone : ∀ {A B C : Set α}, (∀ r ∈ R, r ∈ A ∨ r ∈ B ∨ r ∈ C) → A ⊆ Y → Disjoint B Y → + Disjoint C Y → Y = A := fun hcv hA hB hC => subset_antisymm (fun r hr => + ((hcv r (hY hr)).resolve_right fun h => h.elim (fun h' => disjoint_left.mp hB h' hr) + fun h' => disjoint_left.mp hC h' hr)) hA + have htwo : ∀ {A B C : Set α}, (∀ r ∈ R, r ∈ A ∨ r ∈ B ∨ r ∈ C) → C ⊆ R → A ⊆ Y → B ⊆ Y → + Disjoint C Y → R \ Y = C := fun hcv hCR hA hB hC => subset_antisymm (fun r hr => by + rcases hcv r hr.1 with h | h | h + · exact absurd (hA h) hr.2 + · exact absurd (hB h) hr.2 + · exact h) fun r hr => ⟨hCR hr, disjoint_left.mp hC hr⟩ + have hc₂₁₃ : ∀ r ∈ R, r ∈ Z₂ ∨ r ∈ Z₁ ∨ r ∈ Z₃ := fun r hr => by + rcases hcov r hr with h | h | h <;> simp [h] + have hc₃₁₂ : ∀ r ∈ R, r ∈ Z₃ ∨ r ∈ Z₁ ∨ r ∈ Z₂ := fun r hr => by + rcases hcov r hr with h | h | h <;> simp [h] + rcases h₁ with h₁ | h₁ <;> rcases h₂ with h₂ | h₂ <;> rcases h₃ with h₃ | h₃ + · obtain ⟨r, hr, hrn⟩ := hne' + rcases hcov r hr with h | h | h + · exact absurd (h₁ h) hrn + · exact absurd (h₂ h) hrn + · exact absurd (h₃ h) hrn + · exact Or.inr (Or.inr (Or.inr (htwo hcov hsub₃ h₁ h₂ h₃))) + · exact Or.inr (Or.inr (Or.inl (htwo (A := Z₁) (B := Z₃) (fun r hr => by + rcases hcov r hr with h | h | h <;> simp [h]) hsub₂ h₁ h₃ h₂))) + · exact Or.inl (Or.inl (hone hcov h₁ h₂ h₃)) + · exact Or.inr (Or.inl (htwo (A := Z₂) (B := Z₃) (fun r hr => by + rcases hcov r hr with h | h | h <;> simp [h]) hsub₁ h₂ h₃ h₁)) + · exact Or.inl (Or.inr (Or.inl (hone hc₂₁₃ h₂ h₁ h₃))) + · exact Or.inl (Or.inr (Or.inr (hone hc₃₁₂ h₃ h₁ h₂))) + · obtain ⟨r, hr⟩ := hne + rcases hcov r (hY hr) with h | h | h + · exact absurd hr (disjoint_left.mp h₁ h) + · exact absurd hr (disjoint_left.mp h₂ h) + · exact absurd hr (disjoint_left.mp h₃ h) + +section Partition + +variable [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {Z₁ Z₂ Z₃ : Set (Set S)} +include hS + +omit [ConnectedSpace S] in +/-- Two parts of the partition: an edge in both of their `N` is not in the third. -/ +theorem triple_not_three (ht : IsTriple Γ ins k Ω ω Z₁ Z₂ Z₃) {e : Set S} + (h₁ : e ∈ (boundaryDrawing Γ Z₁).E) (h₂ : e ∈ (boundaryDrawing Γ Z₂).E) : + e ∉ (boundaryDrawing Γ Z₃).E := by + intro h₃ + obtain ⟨⟨a, ha, hia⟩, -⟩ := mem_boundaryDrawing_E.mp h₁ + obtain ⟨⟨b, hb, hib⟩, -⟩ := mem_boundaryDrawing_E.mp h₂ + obtain ⟨⟨c, hc, hic⟩, -⟩ := mem_boundaryDrawing_E.mp h₃ + have hne : a ≠ b := fun h => disjoint_left.mp ht.d₁₂ ha (h ▸ hb) + rcases sides_of_edge hS hia.1 hia.2.1 hib.2.1 hne + (edge_subset_closure_of_incident hS hia.1 hia.2.1 hia.2.2) + (edge_subset_closure_of_incident hS hia.1 hib.2.1 hib.2.2) hic.2.1 hic.2.2 with h | h + · exact disjoint_left.mp ht.d₁₃ ha (h ▸ hc) + · exact disjoint_left.mp ht.d₂₃ hb (h ▸ hc) + +omit [ConnectedSpace S] hS in +/-- An edge of `N(Z₁)` not in `N(Z₂)` is in `N(Z₃)`. -/ +theorem triple_third (ht : IsTriple Γ ins k Ω ω Z₁ Z₂ Z₃) {e : Set S} + (h₁ : e ∈ (boundaryDrawing Γ Z₁).E) (h₂ : e ∉ (boundaryDrawing Γ Z₂).E) : + e ∈ (boundaryDrawing Γ Z₃).E := by + obtain ⟨⟨a, ha, hia⟩, s, ⟨hsR, hsn⟩, his⟩ := mem_boundaryDrawing_E.mp h₁ + have hm : s ∈ Z₁ ∪ Z₂ ∪ Z₃ := ht.cover ▸ hsR + rcases hm with (h | h) | h + · exact absurd h hsn + · exact absurd (mem_boundaryDrawing_E.mpr ⟨⟨s, h, his⟩, a, + ⟨hia.2.1, disjoint_left.mp ht.d₁₂ ha⟩, hia⟩) h₂ + · exact mem_boundaryDrawing_E.mpr ⟨⟨s, h, his⟩, a, ⟨hia.2.1, disjoint_left.mp ht.d₁₃ ha⟩, hia⟩ + +/-- There is no counterexample to (5.4) with `N(Z₁, Z₂, Z₃)` minimal. -/ +theorem no_min_triple (hs : IsSlope Γ k ins) (hw : IsWeighting Γ k Ω ω) + (hmin : IsMinTriple Γ ins k Ω ω Z₁ Z₂ Z₃) : False := by + have ht := hmin.triple + obtain ⟨hc₁, hl₁, hZ₁⟩ := exists_circuit_of_min hS hs hw hmin + obtain ⟨hc₂, hl₂, hZ₂⟩ := exists_circuit_of_min hS hs hw hmin.swap₁₂ + obtain ⟨hc₃, hl₃, hZ₃⟩ := exists_circuit_of_min hS hs hw hmin.swap₂₃.swap₁₂ + have sub : ∀ Z : Set (Set S), (boundaryDrawing Γ Z).IsSubdrawing Γ := fun Z => + Drawing.span_isSubdrawing Γ _ _ + have ht₂₁₃ := ht.swap₁₂ + have ht₃₁₂ := ht.swap₂₃.swap₁₂ + have ht₃₂₁ : IsTriple Γ ins k Ω ω Z₃ Z₂ Z₁ := ht₃₁₂.swap₂₃ + have hE : ∀ e, e ∈ (boundaryDrawing Γ Z₃).E ↔ + (e ∈ (boundaryDrawing Γ Z₁).E ∧ e ∉ (boundaryDrawing Γ Z₂).E) ∨ + (e ∉ (boundaryDrawing Γ Z₁).E ∧ e ∈ (boundaryDrawing Γ Z₂).E) := by + intro e + constructor + · intro h + by_cases h₁ : e ∈ (boundaryDrawing Γ Z₁).E + · exact Or.inl ⟨h₁, fun h₂ => triple_not_three hS ht h₁ h₂ h⟩ + · exact Or.inr ⟨h₁, by + by_contra h₂ + exact h₁ (triple_third ht₃₂₁ h h₂)⟩ + · rintro (⟨h₁, h₂⟩ | ⟨h₁, h₂⟩) + · exact triple_third ht h₁ h₂ + · exact triple_third ht₂₁₃ h₂ h₁ + have hnot : ∃ e ∈ (boundaryDrawing Γ Z₁).E, e ∉ (boundaryDrawing Γ Z₂).E := by + by_contra hno + push Not at hno + have heq := circuit_E_eq_of_subset hc₂ hc₁ (sub Z₂) (sub Z₁) hno + obtain ⟨e, he⟩ := IsCircuit.E_nonempty hc₃ + rcases (hE e).mp he with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact h₂ (heq ▸ h₁) + · exact h₁ (heq ▸ h₂) + have hoffN : ∀ {X Z : Set (Set S)}, (X = Z ∨ Disjoint X Z) → + Z = insideRegions Γ (ins (boundaryDrawing Γ Z)) → ∀ e ∈ (boundaryDrawing Γ X).E, + ∃ r ∈ Γ.R, e ⊆ closure r ∧ ¬ r ⊆ ins (boundaryDrawing Γ Z) := by + intro X Z hX hZ e he + obtain ⟨⟨a, ha, hia⟩, s, ⟨hsR, hsn⟩, his⟩ := mem_boundaryDrawing_E.mp he + rcases hX with rfl | hd + · exact ⟨s, hsR, edge_subset_closure_of_incident hS his.1 hsR his.2.2, fun h => + hsn (hZ ▸ ⟨hsR, h⟩)⟩ + · exact ⟨a, hia.2.1, edge_subset_closure_of_incident hS hia.1 hia.2.1 hia.2.2, fun h => + disjoint_left.mp hd ha (hZ ▸ ⟨hia.2.1, h⟩)⟩ + have hshort : ∀ T : Drawing S, T.IsCircuit → T.IsSubdrawing Γ → + (∀ e ∈ T.E, e ∈ (boundaryDrawing Γ Z₁).E ∨ e ∈ (boundaryDrawing Γ Z₂).E) → T.length < k → + T.E = (boundaryDrawing Γ Z₁).E ∨ T.E = (boundaryDrawing Γ Z₂).E ∨ + T.E = (boundaryDrawing Γ Z₃).E := by + intro T hT hTs hTE hTl + have hNY : boundaryDrawing Γ (insideRegions Γ (ins T)) = T := + boundaryDrawing_inside hS hs hT hTs hTl + have hYR : insideRegions Γ (ins T) ⊆ Γ.R := fun r h => h.1 + have hcompl := boundaryDrawing_compl hYR + obtain ⟨e₀, he₀⟩ := IsCircuit.E_nonempty hT + obtain ⟨⟨a, ha, -, hai⟩, b, hb, -, hbn⟩ := + exists_regions_of_circuit_edge hS hs hT hTs hTl he₀ + have hside : ∀ {Z : Set (Set S)}, (Z₁ = Z ∨ Disjoint Z₁ Z) → (Z₂ = Z ∨ Disjoint Z₂ Z) → + (boundaryDrawing Γ Z).IsCircuit → (boundaryDrawing Γ Z).length < k → + Z = insideRegions Γ (ins (boundaryDrawing Γ Z)) → + Z ⊆ insideRegions Γ (ins T) ∨ Disjoint Z (insideRegions Γ (ins T)) := by + intro Z h₁ h₂ hc hl hZ + have := inside_same_side hS hs hc (sub Z) hl hT hTs hTl fun e he => + (hTE e he).elim (hoffN h₁ hZ e) (hoffN h₂ hZ e) + rwa [← hZ] at this + have s₁ := hside (Or.inl rfl) (Or.inr ht.d₁₂.symm) hc₁ hl₁ hZ₁ + have s₂ := hside (Or.inr ht.d₁₂) (Or.inl rfl) hc₂ hl₂ hZ₂ + have s₃ := hside (Or.inr ht.d₁₃) (Or.inr ht.d₂₃) hc₃ hl₃ hZ₃ + rcases sets_cases ht.cover hYR s₁ s₂ s₃ ⟨a, ha, hai⟩ ⟨b, hb, fun h => hbn h.2⟩ with + (h | h | h) | (h | h | h) + · exact Or.inl (by rw [← hNY, h]) + · exact Or.inr (Or.inl (by rw [← hNY, h])) + · exact Or.inr (Or.inr (by rw [← hNY, h])) + · exact Or.inl (by rw [← h, hcompl, hNY]) + · exact Or.inr (Or.inl (by rw [← h, hcompl, hNY])) + · exact Or.inr (Or.inr (by rw [← h, hcompl, hNY])) + obtain ⟨P₀, P₁, P₂, a, b, hP₀, hP₁, hP₂, sP₀, sP₁, sP₂, p₀, p₁, p₂, v₀₁, v₁₂, v₂₀, e₀₁, e₁₂, e₂₀, + h₀₁, h₁₂, h₂₀⟩ := exists_theta hc₁ hc₂ hc₃ (sub Z₁) (sub Z₂) (sub Z₃) hl₁ hl₂ hE hnot hshort + have hthree := hs.three_paths P₀ P₁ P₂ a b hP₀ hP₁ hP₂ sP₀ sP₁ sP₂ p₀ p₁ p₂ v₀₁ v₁₂ v₂₀ e₀₁ e₁₂ + e₂₀ + (h₁₂ ▸ hl₂) (h₂₀ ▸ hl₃) (h₀₁ ▸ hl₁) + rw [h₀₁, h₁₂, h₂₀] at hthree + have key : ∀ {Z Z' : Set (Set S)}, Z.Nonempty → Disjoint Z Z' → + Z = insideRegions Γ (ins (boundaryDrawing Γ Z)) → + Z' = insideRegions Γ (ins (boundaryDrawing Γ Z')) → + ¬ ins (boundaryDrawing Γ Z) ⊆ ins (boundaryDrawing Γ Z') := by + intro Z Z' ⟨r, hr⟩ hd hZ hZ' hsub + have hrZ : r ∈ insideRegions Γ (ins (boundaryDrawing Γ Z)) := hZ ▸ hr + have hrZ' : r ∈ insideRegions Γ (ins (boundaryDrawing Γ Z')) := ⟨hrZ.1, hrZ.2.trans hsub⟩ + exact disjoint_left.mp hd hr (hZ' ▸ hrZ') + have n₁ := ht.nonempty₁ hS hs hw + have n₂ := ht₂₁₃.nonempty₁ hS hs hw + have n₃ := ht₃₁₂.nonempty₁ hS hs hw + rcases hthree with ⟨h, -⟩ | ⟨h, -⟩ | ⟨h, -⟩ + · exact key n₃ ht.d₂₃.symm hZ₃ hZ₂ h + · exact key n₂ ht.d₂₃ hZ₂ hZ₃ h + · exact key n₂ ht.d₁₂.symm hZ₂ hZ₁ h + +/-- **(5.4)** of Graph Minors XI (page 82): "If $(Z_1, Z_2, Z_3)$ is a partition of $R(\Gamma)$, +then one of $Z_1, Z_2, Z_3$ is not +small." -/ +theorem theorem_5_4_proof (hs : IsSlope Γ k ins) (hw : IsWeighting Γ k Ω ω) : + PartitionNotSmall Γ ins k Ω ω := by + classical + intro Z₁ Z₂ Z₃ hc d₁₂ d₁₃ d₂₃ ⟨s₁, s₂, s₃⟩ + have hex : ∃ n, ∃ Y₁ Y₂ Y₃, IsTriple Γ ins k Ω ω Y₁ Y₂ Y₃ ∧ (tripleE Γ Y₁ Y₂ Y₃).ncard = n := + ⟨_, Z₁, Z₂, Z₃, ⟨hc, d₁₂, d₁₃, d₂₃, s₁, s₂, s₃⟩, rfl⟩ + obtain ⟨Y₁, Y₂, Y₃, hT, hn⟩ := Nat.find_spec hex + refine no_min_triple hS hs hw (Z₁ := Y₁) (Z₂ := Y₂) (Z₃ := Y₃) ⟨hT, fun Y₁' Y₂' Y₃' hT' => ?_⟩ + rw [hn] + exact Nat.find_min' hex ⟨Y₁', Y₂', Y₃', hT', rfl⟩ + +/-- **(5.5)** of Graph Minors XI (page 86): "If $Z_1, Z_2, Z_3 \subseteq R(\Gamma)$ are small, then +$Z_1 \cup Z_2 \cup Z_3 \ne +R(\Gamma)$." -/ +theorem theorem_5_5_proof (hs : IsSlope Γ k ins) (hw : IsWeighting Γ k Ω ω) + (h₁ : IsSmall Γ ins k Ω ω Z₁) (h₂ : IsSmall Γ ins k Ω ω Z₂) (h₃ : IsSmall Γ ins k Ω ω Z₃) : + Z₁ ∪ Z₂ ∪ Z₃ ≠ Γ.R := + theorem_5_5_of_partition hS hs hw (theorem_5_4_proof hS hs hw) h₁ h₂ h₃ + +end Partition + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section6.lean b/LeanPool/GraphMinor/GM11/Section6.lean new file mode 100644 index 0000000000..1aaea657c7 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section6.lean @@ -0,0 +1,560 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section8 +public import LeanPool.GraphMinor.GM11.DrawingTopology +public import LeanPool.GraphMinor.GM11.Section6Pretangle +public import LeanPool.GraphMinor.GM11.NormalNoncover +public import LeanPool.GraphMinor.GM11.Fan +public import LeanPool.GraphMinor.GM11.PlaneFacts +public import LeanPool.GraphMinor.Surface.DiscsInSurface +public import LeanPool.GraphMinor.Surface.DiscUnion +public import LeanPool.GraphMinor.Surface.SphereDisc +public import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Graph Minors XI, Section 6: the slope derived from a tangle + +Graph Minors XI calls `ins` "the derived slope" of a respectful pretangle, without proof that it is +a +slope. This file proves it (`isSlope_of_derived`). Both axioms come from the same remark. If closed +discs `Δ₁, Δ₂, Δ₃` bounded by circuits of `Γ'` cover `Σ`, then `Γ ∩ Δ₁`, `Γ ∩ Δ₂`, `Γ ∩ Δ₃` cover +`Γ`, +which the second tangle axiom forbids (`not_cover`). This uses that an edge of `Γ` misses `U(Γ')`. + +For the first slope axiom, let `U(C₁) ⊆ ins(C₂)`. Then `U(C₁)` bounds a closed disc in `ins(C₂)`. It +is +`ins(C₁)`, or else `ins(C₁)` and `ins(C₂)` cover `Σ`. For the second slope axiom, suppose that each +of +the three paths leaves the disc bounded by the other two. Two of the discs meet in a path, so that +their union is a closed disc, and it covers `Σ` together with the third (`theta_cover`). +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface Metric Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] + +section Tangle + +variable [T1Space S] {Γ : PaintingOrDrawing S} {Γ' : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + +omit [T1Space S] in +/-- Three sets `Γ ∩ Δ_i` cover `Γ` if the sets `Δ_i` are closed, cover `Σ`, and each has frontier in +`U(Γ')`. By the second tangle axiom they are not all first parts of members of `T`. -/ +theorem not_cover (hT : IsPretangle Γ.toHypergraph θ T) (hrad : Γ.U ∩ Γ'.U = Γ.V) + {Δ₁ Δ₂ Δ₃ : Set S} (c₁ : IsClosed Δ₁) (c₂ : IsClosed Δ₂) (c₃ : IsClosed Δ₃) + (b₁ : frontier Δ₁ ⊆ Γ'.U) (b₂ : frontier Δ₂ ⊆ Γ'.U) (b₃ : frontier Δ₃ ⊆ Γ'.U) + (m₁ : (Γ.inter Δ₁, Γ.interOutside Δ₁) ∈ T) (m₂ : (Γ.inter Δ₂, Γ.interOutside Δ₂) ∈ T) + (m₃ : (Γ.inter Δ₃, Γ.interOutside Δ₃) ∈ T) (hcov : Δ₁ ∪ Δ₂ ∪ Δ₃ = univ) : False := + not_cover_of_radial_frontiers hT hrad c₁ c₂ c₃ b₁ b₂ b₃ m₁ m₂ m₃ hcov + +/-- The discs of short circuits of `Γ'` form a slope, if they are monotone and, in a sphere, three +of them do not +cover the surface. -/ +theorem isSlope_of_mono [ConnectedSpace S] {Γ' : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + (hS : IsClosedSurface S) + (hk : 2 ≤ k) + (hd : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < k → IsClosedDisc (ins C) + ∧ subBd (ins C) = C.U) + (hmono : ∀ C₁ C₂ : Drawing S, C₁.IsCircuit → C₁.IsSubdrawing Γ' → C₁.length < k → + C₂.IsCircuit → C₂.IsSubdrawing Γ' → C₂.length < k → C₁.U ⊆ ins C₂ → ins C₁ ⊆ ins C₂) + (htheta : IsSphere S → ∀ C₀, C₀.IsCircuit → C₀.IsSubdrawing Γ' → C₀.length < k → + ∀ C₁, C₁.IsCircuit → C₁.IsSubdrawing Γ' → C₁.length < k → + ∀ C₂, C₂.IsCircuit → C₂.IsSubdrawing Γ' → C₂.length < k → ins C₀ ∪ ins C₁ ∪ ins C₂ ≠ univ) : + IsSlope Γ' k ins := by + have : T2Space S := hS.2.1 + have hfr : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < k → + IsClosedDisc (ins C) ∧ frontier (ins C) = C.U ∧ IsClosed (ins C) := by + intro C h s l + obtain ⟨d, b⟩ := hd C h s l + rw [subBd_eq_frontier] at b + exact ⟨d, b, d.isCompact.isClosed⟩ + refine ⟨hk, fun C h s l => (hd C h s l).1, fun C h s l => (hd C h s l).2, hmono, ?_⟩ + intro P₀ P₁ P₂ a b hP₀ hP₁ hP₂ s₀ s₁ s₂ p₀ p₁ p₂ v₀₁ v₁₂ v₂₀ e₀₁ e₁₂ e₂₀ l₀ l₁ l₂ + have hab := ne_of_isPathBetween hP₀ p₀ + have supU : ∀ {P Q : Drawing S}, P.IsSubdrawing Γ' → Q.IsSubdrawing Γ' → + (Γ'.sup P Q).U = P.U ∪ Q.U := by + intro P Q hP hQ + rw [Drawing.U_eq, Drawing.sup_V hP hQ, Drawing.sup_E hP hQ, P.U_eq, Q.U_eq, biUnion_union] + ext x + simp only [mem_union] + tauto + have circ : ∀ {P Q : Drawing S}, P.IsPathBetween a b → Q.IsPathBetween a b → + P.IsSubdrawing Γ' → Q.IsSubdrawing Γ' → P.V ∩ Q.V = {a, b} → Disjoint P.E Q.E → + (Γ'.sup P Q).IsCircuit ∧ (Γ'.sup P Q).IsSubdrawing Γ' := fun hP hQ sP sQ v e => + ⟨Drawing.isCircuit_sup hP hQ sP sQ hab v e, Drawing.sup_isSubdrawing Γ' _ _⟩ + obtain ⟨c₀, ss₀⟩ := circ hP₁ hP₂ s₁ s₂ v₁₂ e₁₂ + obtain ⟨c₁, ss₁⟩ := circ hP₂ hP₀ s₂ s₀ v₂₀ e₂₀ + obtain ⟨c₂, ss₂⟩ := circ hP₀ hP₁ s₀ s₁ v₀₁ e₀₁ + obtain ⟨d₀, f₀, cl₀⟩ := hfr _ c₀ ss₀ l₀ + obtain ⟨d₁, f₁, cl₁⟩ := hfr _ c₁ ss₁ l₁ + obtain ⟨d₂, f₂, cl₂⟩ := hfr _ c₂ ss₂ l₂ + have f₀' := f₀ + have f₁' := f₁ + have f₂' := f₂ + rw [supU s₁ s₂] at f₀ + rw [supU s₂ s₀] at f₁ + rw [supU s₀ s₁] at f₂ + have sub : ∀ {Δ F : Set S}, IsClosed Δ → frontier Δ = F → F ⊆ Δ := fun c h + => h ▸ c.frontier_subset + have sb₀ := sub cl₀ f₀ + have sb₁ := sub cl₁ f₁ + have sb₂ := sub cl₂ f₂ + by_cases h₀ : P₀.U ⊆ ins (Γ'.sup P₁ P₂) + · refine Or.inl ⟨hmono _ _ c₁ ss₁ l₁ c₀ ss₀ l₀ ?_, hmono _ _ c₂ ss₂ l₂ c₀ ss₀ l₀ ?_⟩ + · rw [supU s₂ s₀] + exact union_subset (subset_union_right.trans sb₀) h₀ + · rw [supU s₀ s₁] + exact union_subset h₀ (subset_union_left.trans sb₀) + by_cases h₁ : P₁.U ⊆ ins (Γ'.sup P₂ P₀) + · refine Or.inr (Or.inl ⟨hmono _ _ c₀ ss₀ l₀ c₁ ss₁ l₁ ?_, hmono _ _ c₂ ss₂ l₂ c₁ ss₁ l₁ ?_⟩) + · rw [supU s₁ s₂] + exact union_subset h₁ (subset_union_left.trans sb₁) + · rw [supU s₀ s₁] + exact union_subset (subset_union_right.trans sb₁) h₁ + by_cases h₂ : P₂.U ⊆ ins (Γ'.sup P₀ P₁) + · refine Or.inr (Or.inr ⟨hmono _ _ c₀ ss₀ l₀ c₂ ss₂ l₂ ?_, hmono _ _ c₁ ss₁ l₁ c₂ ss₂ l₂ ?_⟩) + · rw [supU s₁ s₂] + exact union_subset (subset_union_right.trans sb₂) h₂ + · rw [supU s₂ s₀] + exact union_subset h₂ (subset_union_left.trans sb₂) + exfalso + obtain ⟨dU, hbd, hne⟩ := theta_union hS (isLine_of_isPathBetween hP₀ hab) + (isLine_of_isPathBetween hP₁ hab) + (isLine_of_isPathBetween hP₂ hab) (by rw [U_inter_of_disjoint s₀ s₁ e₀₁, v₀₁]) + (by rw [U_inter_of_disjoint s₁ s₂ e₁₂, v₁₂]) (by rw [U_inter_of_disjoint s₂ s₀ e₂₀, v₂₀]) + d₀ d₁ d₂ f₀ f₁ f₂ h₀ h₁ h₂ + by_cases hsph : IsSphere S + · refine htheta hsph _ c₀ ss₀ l₀ _ c₁ ss₁ l₁ _ c₂ ss₂ l₂ ?_ + rw [cover_of_discBd_eq hS dU d₂ hbd hne] + · exact hne (eq_of_discBd_eq (IsClosedSurface.isSurface hS) hsph dU d₂ hbd) + +/-- `ins` is a slope in `Γ'`: the slope "derived" from `T` (Graph Minors XI, Section 6, page 87). -/ +theorem isSlope_of_derived [ConnectedSpace S] (hS : IsClosedSurface S) + (hT : IsPretangle Γ.toHypergraph θ T) (hrad : Γ.U ∩ Γ'.U = Γ.V) + (hd : IsDerivedSlope Γ Γ' θ T ins) : IsSlope Γ' (2 * θ) ins := by + have : T2Space S := hS.2.1 + have hfr : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < 2 * θ → + IsClosedDisc (ins C) ∧ frontier (ins C) = C.U ∧ IsClosed (ins C) ∧ + frontier (ins C) ⊆ Γ'.U ∧ (Γ.inter (ins C), Γ.interOutside (ins C)) ∈ T := by + intro C h s l + obtain ⟨d, b, m⟩ := hd C h s l + rw [subBd_eq_frontier] at b + exact ⟨d, b, d.isCompact.isClosed, b ▸ s.U_subset, m⟩ + have hmono : ∀ C₁ C₂ : Drawing S, C₁.IsCircuit → C₁.IsSubdrawing Γ' → C₁.length < 2 * θ → + C₂.IsCircuit → C₂.IsSubdrawing Γ' → C₂.length < 2 * θ → C₁.U ⊆ ins C₂ → + ins C₁ ⊆ ins C₂ := by + intro C₁ C₂ h₁ s₁ l₁ h₂ s₂ l₂ hsub + obtain ⟨d₁, f₁, c₁, b₁, m₁⟩ := hfr C₁ h₁ s₁ l₁ + obtain ⟨d₂, f₂, c₂, b₂, m₂⟩ := hfr C₂ h₂ s₂ l₂ + obtain ⟨Δ, ⟨hΔD, dΔ, bΔ, -⟩, -⟩ := disc_oArc (ins C₂) (discBd (ins C₁)) d₂ + (by rw [← IsClosedDisc.frontier_eq_discBd hS d₁, f₁]; exact hsub) (d₁.isOArc_discBd) + by_cases heq : ins C₁ = Δ + · exact heq ▸ hΔD + · exfalso + have hcov := cover_of_discBd_eq hS d₁ dΔ bΔ.symm heq + refine not_cover hT hrad c₁ c₂ c₂ b₁ b₂ b₂ m₁ m₂ m₂ (eq_univ_of_univ_subset ?_) + rw [← hcov] + exact fun x hx => hx.elim (fun h => Or.inl (Or.inl h)) fun h => Or.inr (hΔD h) + refine isSlope_of_mono hS (by have := hT.one_le; omega) (fun C h s l => ⟨(hd C h s l).1, + (hd C h s l).2.1⟩) hmono ?_ + rintro - C₀ h₀ s₀ l₀ C₁ h₁ s₁ l₁ C₂ h₂ s₂ l₂ hcov + obtain ⟨-, -, cl₀, b₀, m₀⟩ := hfr C₀ h₀ s₀ l₀ + obtain ⟨-, -, cl₁, b₁, m₁⟩ := hfr C₁ h₁ s₁ l₁ + obtain ⟨-, -, cl₂, b₂, m₂⟩ := hfr C₂ h₂ s₂ l₂ + exact not_cover hT hrad cl₀ cl₁ cl₂ b₀ b₁ b₂ m₀ m₁ m₂ hcov + +omit [T1Space S] in +/-- A vertex common to `Γ ∩ Δ` and `Γ ∩ closure (Σ − Δ)` is a vertex of the circuit `C` that bounds +`Δ`, since edges of `Γ'` contain no vertex of `Γ`. -/ +theorem inter_outside_vertex (hV : Γ.V ⊆ Γ'.V) {C : Drawing S} (hCs : C.IsSubdrawing Γ') + {Δ : Set S} (hb : frontier Δ = C.U) {x : S} + (hx : x ∈ (Γ.inter Δ ∩ Γ.interOutside Δ).vertexSet) : x ∈ C.V ∩ Γ.V := by + obtain ⟨⟨hxV, hxΔ⟩, -, hxc⟩ := hx + have hxf : x ∈ C.U := by + rw [← hb, frontier_eq_closure_inter_closure] + exact ⟨subset_closure hxΔ, by rwa [compl_eq_univ_sdiff]⟩ + have hxV' : x ∈ Γ.V := Γ.toHypergraph_vertexSet ▸ hxV + by_contra hn + have hxC : x ∉ C.V := fun h => hn ⟨h, hxV'⟩ + obtain ⟨f, hf, hxef⟩ := C.exists_edge_of_mem hxf hxC + exact ((hCs.2 hf).2.1 hxef).2 (hV hxV') + +omit [T1Space S] in +/-- (ii) implies (i) in (6.3) of Graph Minors XI (page 89). The hypothesis `hiso` says that `Γ` has +no +isolated vertices. -/ +theorem mem_of_circuits [T2Space S] (hT : IsPretangle Γ.toHypergraph θ T) (hVs : Γ.V ⊆ Γ'.V) + (hd : IsDerivedSlope Γ Γ' θ T ins) (hiso : ∀ v ∈ Γ.V, ∃ e ∈ Γ.E, v ∈ closure e) + {A B : Hypergraph S (Set S)} (hsep : Γ.toHypergraph.IsSeparation A B) + (hord : separationOrder A B < θ) {k : ℕ} {C : Fin k → Drawing S} + (hC : ∀ i, (C i).IsCircuit ∧ (C i).IsSubdrawing Γ' ∧ (C i).length < 2 * θ ∧ + (C i).V ∩ Γ.V ⊆ (A ∩ B).vertexSet) + (hin : ∀ e ∈ A.edgeSet, ∃ i, e ⊆ ins (C i)) : (A, B) ∈ T := by + rcases hT.axiom1 hsep hord with h | hBA + · exact h + exfalso + -- The pair `(A ∩ B, Γ)` is in `T`. + have hinf : (A ∩ B) ≤ Γ.toHypergraph := by + refine le_trans ?_ hsep.left_le + refine ⟨inter_subset_left, inter_subset_left, fun e he => ?_⟩ + have h₀ : (A ∩ B).edgeSet = ∅ := hsep.edgeSet_inter_eq + rw [h₀] at he + exact absurd he (notMem_empty e) + have hE₀ : (A ∩ B).edgeSet = ∅ := hsep.edgeSet_inter_eq + have hsep₀ : Γ.toHypergraph.IsSeparation (A ∩ B) Γ.toHypergraph := by + refine ⟨hinf, le_rfl, ?_, ?_⟩ + · exact le_antisymm (by + refine ⟨union_subset hinf.vertexSet_subset subset_rfl, + union_subset hinf.edgeSet_subset subset_rfl, fun e he => ?_⟩ + rcases he with he | he + · rw [hE₀] at he + exact absurd he (notMem_empty e) + · ext v + constructor + · exact fun h => Or.inr h + · rintro (h | h) + · exact absurd ((A ∩ B).edge_mem_of_inc h) (by rw [hE₀]; exact notMem_empty e) + · exact h) + (Hypergraph.IsSubhypergraph.mk subset_union_right subset_union_right fun e he => by + ext v + constructor + · rintro (h | h) + · exact absurd ((A ∩ B).edge_mem_of_inc h) (by rw [hE₀]; exact notMem_empty e) + · exact h + · exact fun h => Or.inr h) + · have : ((A ∩ B) ∩ Γ.toHypergraph).edgeSet ⊆ ∅ := fun e he => hE₀ ▸ he.1 + exact subset_empty_iff.mp this + have hord₀ : separationOrder (A ∩ B) Γ.toHypergraph < θ := by + refine lt_of_le_of_lt (ncard_le_ncard inter_subset_left (A ∩ B).vertexSet_finite) hord + have hm₀ : (A ∩ B, Γ.toHypergraph) ∈ T := by + rcases hT.axiom1 hsep₀ hord₀ with h | h + · exact h + · have heq : Γ.toHypergraph ∪ Γ.toHypergraph ∪ Γ.toHypergraph = Γ.toHypergraph := by + rw [GM10.union_self, GM10.union_self] + exact absurd heq (hT.axiom2 h h h) + classical + let L : List (Hypergraph S (Set S) × Hypergraph S (Set S)) := + (A ∩ B, Γ.toHypergraph) :: + (List.finRange k).map fun i => (Γ.inter (ins (C i)), Γ.interOutside (ins (C i))) + have hcirc : ∀ i, IsClosed (ins (C i)) ∧ frontier (ins (C i)) = (C i).U ∧ + (Γ.inter (ins (C i)), Γ.interOutside (ins (C i))) ∈ T := fun i => by + obtain ⟨c, s, l, -⟩ := hC i + obtain ⟨d, b, m⟩ := hd _ c s l + exact ⟨d.isCompact.isClosed, by rwa [subBd_eq_frontier] at b, m⟩ + have hmem : ∀ i, (Γ.inter (ins (C i)), Γ.interOutside (ins (C i))) ∈ L := fun i => + List.mem_cons_of_mem _ (List.mem_map.mpr ⟨i, List.mem_finRange i, rfl⟩) + refine theorem_6_2_proof hT hBA L ?_ ?_ ?_ ?_ + · intro p hp + rcases List.mem_cons.mp hp with rfl | hp + · exact hm₀ + · obtain ⟨i, -, rfl⟩ := List.mem_map.mp hp + exact (hcirc i).2.2 + · intro p hp x hx + rw [GM10.inter_comm B A] + rcases List.mem_cons.mp hp with rfl | hp + · exact hx.1 + · obtain ⟨i, -, rfl⟩ := List.mem_map.mp hp + exact (hC i).2.2.2 (inter_outside_vertex hVs (hC i).2.1 (hcirc i).2.1 hx) + · intro v hv + by_cases hvB : v ∈ B.vertexSet + · exact ⟨_, List.mem_cons_self .., ⟨hv, hvB⟩⟩ + have hvΓ : v ∈ Γ.V := Γ.toHypergraph_vertexSet ▸ hsep.left_le.vertexSet_subset hv + obtain ⟨e, he, hve⟩ := hiso v hvΓ + have hinc : Γ.toHypergraph.Inc e v := PaintingOrDrawing.toHypergraph_inc.mpr ⟨he, hvΓ, hve⟩ + rw [← hsep.union_eq] at hinc + rcases hinc with hinc | hinc + · obtain ⟨i, hi⟩ := hin e (A.edge_mem_of_inc hinc) + exact ⟨_, hmem i, hvΓ, (hcirc i).1.closure_subset_iff.mpr hi hve⟩ + · exact absurd (B.vertex_mem_of_inc hinc) hvB + · intro e he + obtain ⟨i, hi⟩ := hin e he + refine ⟨_, hmem i, ?_, hi⟩ + have : e ∈ Γ.toHypergraph.edgeSet := hsep.left_le.edgeSet_subset he + exact Γ.toHypergraph_edgeSet ▸ this + +omit [T1Space S] in +/-- In a bipartite walk, about half of the vertices lie in one side `X`. -/ +theorem two_mul_count_le {G : Drawing S} (X : Set S) [DecidablePred (· ∈ X)] + (hb : ∀ e x y, G.toGraph.IsLink e x y → (x ∈ X ↔ y ∉ X)) {u v : S} + (W : GraphWalk G.toGraph u v) : + W.length + (if v ∈ X then 1 else 0) ≤ + 2 * (W.support.tail.countP (· ∈ X)) + (if u ∈ X then 1 else 0) := by + induction W with + | nil _ => simp [GraphWalk.length, GraphWalk.edges, GraphWalk.support] + | @cons a y b e hl r ih => + have h₁ := hb e a y hl + have hsup : (GraphWalk.cons hl r).support.tail = r.support := rfl + have hsup₂ : r.support = y :: r.support.tail := by + cases r <;> rfl + have hlen : (GraphWalk.cons hl r).length = r.length + 1 := rfl + rw [hsup, hlen] + rw [hsup₂, List.countP_cons] + by_cases hy : y ∈ X + · have ha : a ∉ X := fun h => (h₁.mp h) hy + simp only [hy, ha, ite_true, ite_false, decide_true] at ih ⊢ + omega + · have ha : a ∈ X := h₁.mpr hy + simp only [hy, ha, ite_true, ite_false, decide_false] at ih ⊢ + omega + +omit [T1Space S] in +/-- Half the length of a circuit of a radial drawing is the number of its vertices in `Γ`. So +`(V(Γ), θ)` is a weighting of `Γ'` for the slope order `2θ`. -/ +theorem isWeighting_radial (hθ : 1 ≤ θ) (hV : Γ.V ⊆ Γ'.V) + (hbip : ∀ e x y, Γ'.toGraph.IsLink e x y → (x ∈ Γ.V ↔ y ∉ Γ.V)) : + IsWeighting Γ' (2 * θ) Γ.V θ := by + classical + refine ⟨hV, hθ, fun C hC hCs hl => ?_⟩ + obtain ⟨u, W, ⟨hnd, hed⟩, -, hCV, hCE⟩ := hC + have hlen : C.length = W.length := by + rw [Drawing.length, hCE] + have h : {e | e ∈ W.edges} = (W.edges.toFinset : Set (Set S)) := by + ext x + simp + rw [h, ncard_coe_finset, List.toFinset_card_of_nodup hed] + rfl + have hb' : ∀ e x y, C.toGraph.IsLink e x y → (x ∈ Γ.V ↔ y ∉ Γ.V) := by + intro e x y hl' + refine hbip e x y ⟨hCs.2 hl'.1, hCs.1 hl'.2.1, hCs.1 hl'.2.2.1, ?_⟩ + rw [← hCs.closure_inter_V hl'.1] + exact hl'.2.2.2 + have hc := two_mul_count_le Γ.V hb' W + have hcard : W.support.tail.countP (· ∈ Γ.V) ≤ (Γ.V ∩ C.V).ncard := by + have hf : (W.support.tail.filter (· ∈ Γ.V)).Nodup := hnd.filter _ + have hsub : ((W.support.tail.filter (· ∈ Γ.V)).toFinset : Set S) ⊆ Γ.V ∩ C.V := by + intro x hx + have hx' : x ∈ W.support.tail ∧ x ∈ Γ.V := by simpa using hx + refine ⟨hx'.2, ?_⟩ + rw [hCV] + exact List.mem_of_mem_tail hx'.1 + have := ncard_le_ncard hsub (C.finite_V.subset fun x hx => hx.2) + rw [ncard_coe_finset, List.toFinset_card_of_nodup hf] at this + rwa [List.countP_eq_length_filter] + omega + +/-- What Graph Minors XI (Section 3, page 75) says of a radial drawing without proof: "every region +of $\Gamma'$ includes a unique edge of $\Gamma$", and, as its proof of (6.5) (page 91) uses, the +vertices of `Γ` on +the closure of a region of `Γ'` are the ends of that edge. -/ +def RegionFacts (Γ : PaintingOrDrawing S) (Γ' : Drawing S) : Prop := + (∀ s ∈ Γ'.R, ∃ e ∈ Γ.E, e ⊆ s) ∧ (∀ s ∈ Γ'.R, ∀ e ∈ Γ.E, ∀ f ∈ Γ.E, e ⊆ s → f ⊆ s → e = f) ∧ + ∀ s ∈ Γ'.R, ∀ e ∈ Γ.E, e ⊆ s → ∀ v ∈ Γ.V, v ∈ closure s → v ∈ closure e + +omit [T1Space S] in +/-- A radial drawing is bipartite, by condition (iii) of its definition. -/ +theorem bipartite_of_preRadial (hrad : Γ.IsPreRadialDrawing Γ') : + ∀ e x y, Γ'.toGraph.IsLink e x y → (x ∈ Γ.V ↔ y ∉ Γ.V) := by + intro e x y hl + obtain ⟨v, hv, w, ⟨-, hw⟩, hcap⟩ := hrad.2.2.2.2.1 e hl.1 + have heq : ({x, y} : Set S) = {v, w} := hl.2.2.2.symm.trans hcap + have hx : x ∈ ({v, w} : Set S) := heq ▸ mem_insert x _ + have hy : y ∈ ({v, w} : Set S) := heq ▸ mem_insert_of_mem x rfl + have hv' : v ∈ ({x, y} : Set S) := heq ▸ mem_insert v _ + have hw' : w ∈ ({x, y} : Set S) := heq ▸ mem_insert_of_mem v rfl + rcases hx with rfl | rfl + · rcases hw' with rfl | rfl + · exact absurd hv hw + · exact ⟨fun _ => hw, fun _ => hv⟩ + · rcases hy with rfl | rfl + · exact ⟨fun h => absurd h hw, fun h => absurd hv h⟩ + · rcases hv' with rfl | rfl <;> exact absurd hv hw + +omit [T1Space S] in +/-- A vertex of `Γ` lies in the closure of a region of `Γ'`, so it is not isolated, by +`RegionFacts`. -/ +theorem exists_edge_of_regionFacts [ConnectedSpace S] (hS : IsClosedSurface S) + (hf : RegionFacts Γ Γ') {v : S} (hv : v ∈ Γ.V) : ∃ e ∈ Γ.E, v ∈ closure e := by + have : T2Space S := hS.2.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hfin := finite_R hS Γ' + have hdense : v ∈ closure (⋃₀ Γ'.R) := by + refine mem_closure_iff.mpr fun O hO hvO => ?_ + obtain ⟨y, hyO, hyU⟩ := exists_notMem_U (Γ := Γ') hS hO ⟨v, hvO⟩ + obtain ⟨s, hs, hys⟩ := exists_region_of_notMem hyU + exact ⟨y, hyO, s, hs, hys⟩ + rw [hfin.closure_sUnion] at hdense + obtain ⟨s, hs, hvs⟩ := mem_iUnion₂.mp hdense + obtain ⟨e, he, hes⟩ := hf.1 s hs + exact ⟨e, he, hf.2.2 s hs e he hes v hv hvs⟩ + +section Sep + +variable {A B : Hypergraph S (Set S)} + +omit [T1Space S] in +/-- With `RegionFacts`, each region of `Γ'` includes an edge of exactly one side of a separation. -/ +theorem compl_regions (hf : RegionFacts Γ Γ') (hsep : Γ.toHypergraph.IsSeparation A B) : + Γ'.R \ PaintingOrDrawing.regionsIncludingEdge Γ' A = + PaintingOrDrawing.regionsIncludingEdge Γ' B := by + have hE : (A ∩ B).edgeSet = ∅ := hsep.edgeSet_inter_eq + have hA : ∀ {e}, e ∈ A.edgeSet → e ∈ Γ.E := fun h => + Γ.toHypergraph_edgeSet ▸ hsep.left_le.edgeSet_subset h + have hB : ∀ {e}, e ∈ B.edgeSet → e ∈ Γ.E := fun h => + Γ.toHypergraph_edgeSet ▸ hsep.right_le.edgeSet_subset h + ext s + constructor + · rintro ⟨hs, hn⟩ + obtain ⟨e, he, hes⟩ := hf.1 s hs + have he' : e ∈ (A ∪ B).edgeSet := by + rw [hsep.union_eq] + exact Γ.toHypergraph_edgeSet ▸ he + rcases he' with h | h + · exact absurd ⟨hs, e, h, hes⟩ hn + · exact ⟨hs, e, h, hes⟩ + · rintro ⟨hs, e, he, hes⟩ + refine ⟨hs, ?_⟩ + rintro ⟨-, f, hfa, hfs⟩ + have := hf.2.1 s hs f (hA hfa) e (hB he) hfs hes + subst this + have : f ∈ (A ∩ B).edgeSet := ⟨hfa, he⟩ + rw [hE] at this + exact notMem_empty _ this + +omit [T1Space S] in +/-- With `RegionFacts`, a vertex of `Γ` in the closure of a region with an edge of `A` lies in `A`. +-/ +theorem mem_side (hf : RegionFacts Γ Γ') (hsep : Γ.toHypergraph.IsSeparation A B) {v : S} + (hv : v ∈ Γ.V) {s : Set S} (hs : s ∈ PaintingOrDrawing.regionsIncludingEdge Γ' A) + (hvs : v ∈ closure s) : v ∈ A.vertexSet := by + obtain ⟨hR, e, he, hes⟩ := hs + have heΓ : e ∈ Γ.E := Γ.toHypergraph_edgeSet ▸ hsep.left_le.edgeSet_subset he + have hinc : Γ.toHypergraph.Inc e v := + PaintingOrDrawing.toHypergraph_inc.mpr ⟨heΓ, hv, hf.2.2 s hR e heΓ hes v hv hvs⟩ + rw [← hsep.union_eq] at hinc + rcases hinc with hinc | hinc + · exact A.vertex_mem_of_inc hinc + · have : e ∈ (A ∩ B).edgeSet := ⟨he, B.edge_mem_of_inc hinc⟩ + rw [show (A ∩ B).edgeSet = ∅ from hsep.edgeSet_inter_eq] at this + exact absurd this (notMem_empty _) + +/-- With `RegionFacts`, the vertices of `Γ` in `N(Z(A))` lie in `A ∩ B`. -/ +theorem boundary_vertex (hS : IsClosedSurface S) (hf : RegionFacts Γ Γ') + (hsep : Γ.toHypergraph.IsSeparation A B) {v : S} (hv : v ∈ Γ.V) + (hN : v ∈ (boundaryDrawing Γ' (PaintingOrDrawing.regionsIncludingEdge Γ' A)).V) : + v ∈ (A ∩ B).vertexSet := by + have : T2Space S := hS.2.1 + obtain ⟨⟨r, hr, hir⟩, s, hs, his⟩ := (mem_boundaryDrawing_V hS).mp hN + rw [compl_regions hf hsep] at hs + exact ⟨mem_side hf hsep hv hr hir.2.2, mem_side hf hsep.symm hv hs his.2.2⟩ + +/-- If `Z(A)` is small then (ii) of (6.3) holds. -/ +theorem circuits_of_small (hS : IsClosedSurface S) (hf : RegionFacts Γ Γ') + (hrad : Γ.U ∩ Γ'.U = Γ.V) (hsep : Γ.toHypergraph.IsSeparation A B) + (hsm : IsSmall Γ' ins (2 * θ) Γ.V θ (PaintingOrDrawing.regionsIncludingEdge Γ' A)) : + ∃ (k : ℕ) (C : Fin k → Drawing S), + (∀ i : Fin k, (C i).IsCircuit ∧ (C i).IsSubdrawing Γ' ∧ (C i).length < 2 * θ ∧ + (C i).V ∩ Γ.V ⊆ (A ∩ B).vertexSet) ∧ + ∀ e ∈ A.edgeSet, ∃ i : Fin k, e ⊆ ins (C i) := by + have : T2Space S := hS.2.1 + set N := boundaryDrawing Γ' (PaintingOrDrawing.regionsIncludingEdge Γ' A) with hN + have hNs : N.IsSubdrawing Γ' := Drawing.span_isSubdrawing Γ' _ _ + have hex : ∀ e : A.edgeSet, ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing N ∧ + C.length < 2 * θ ∧ e.1 ⊆ ins C := by + intro e + have heΓ : e.1 ∈ Γ.E := Γ.toHypergraph_edgeSet ▸ hsep.left_le.edgeSet_subset e.2 + obtain ⟨hp, hd, hU, x, hx⟩ := Γ.edge_props heΓ + have hoff : ∀ y ∈ e.1, y ∉ Γ'.U := fun y hy hyU => by + have : y ∈ Γ.U ∩ Γ'.U := ⟨hU hy, hyU⟩ + rw [hrad] at this + exact disjoint_left.mp hd hy this + have hr : connectedComponentIn (univ \ Γ'.U) x ∈ Γ'.R := + (mem_R_iff Γ').mpr ⟨x, hoff x hx, rfl⟩ + have hsub : e.1 ⊆ connectedComponentIn (univ \ Γ'.U) x := + hp.subset_connectedComponentIn hx fun y hy => ⟨mem_univ y, hoff y hy⟩ + obtain ⟨C, hC, hCs, hl, hin⟩ := hsm.2 _ ⟨hr, e.1, e.2, hsub⟩ + exact ⟨C, hC, hCs, hl, hsub.trans hin⟩ + choose C' hC' using hex + have : Fintype A.edgeSet := A.edgeSet_finite.fintype + refine ⟨Fintype.card A.edgeSet, fun i => C' ((Fintype.equivFin _).symm i), fun i => ?_, ?_⟩ + · obtain ⟨c, s, l, -⟩ := hC' ((Fintype.equivFin _).symm i) + refine ⟨c, s.trans hNs, l, fun x hx => ?_⟩ + exact boundary_vertex hS hf hsep hx.2 (s.1 hx.1) + · intro e he + refine ⟨Fintype.equivFin _ ⟨e, he⟩, ?_⟩ + have := (hC' ⟨e, he⟩).2.2.2 + simpa using this + +/-- Exactly one of `Z(A)`, `Z(B)` is small, by (5.2), for a separation of order `< θ`. -/ +theorem small_or_small (hS : IsClosedSurface S) [ConnectedSpace S] (hf : RegionFacts Γ Γ') + (hsl : IsSlope Γ' (2 * θ) ins) (hw : IsWeighting Γ' (2 * θ) Γ.V θ) + (hsep : Γ.toHypergraph.IsSeparation A B) (hord : separationOrder A B < θ) : + (IsSmall Γ' ins (2 * θ) Γ.V θ (PaintingOrDrawing.regionsIncludingEdge Γ' A) ∨ + IsSmall Γ' ins (2 * θ) Γ.V θ (PaintingOrDrawing.regionsIncludingEdge Γ' B)) ∧ + ¬ (IsSmall Γ' ins (2 * θ) Γ.V θ (PaintingOrDrawing.regionsIncludingEdge Γ' A) ∧ + IsSmall Γ' ins (2 * θ) Γ.V θ (PaintingOrDrawing.regionsIncludingEdge Γ' B)) := by + have : T2Space S := hS.2.1 + have hsub : Γ.V ∩ (boundaryDrawing Γ' (PaintingOrDrawing.regionsIncludingEdge Γ' A)).V ⊆ + (A ∩ B).vertexSet := fun x hx => boundary_vertex hS hf hsep hx.1 hx.2 + have hlt := lt_of_le_of_lt (ncard_le_ncard hsub (A ∩ B).vertexSet_finite) hord + have hregions : PaintingOrDrawing.regionsIncludingEdge Γ' A ⊆ Γ'.R := fun _ hr => hr.1 + have := theorem_5_2_proof hS hsl hw hregions hlt + rwa [compl_regions hf hsep] at this + +end Sep + +/-- (6.3) of Graph Minors XI (page 89), from `RegionFacts`. -/ +theorem theorem_6_3_of_regionFacts [ConnectedSpace S] (hS : IsClosedSurface S) + (hT : IsPretangle Γ.toHypergraph θ T) (hrad : Γ.IsPreRadialDrawing Γ') + (hd : IsDerivedSlope Γ Γ' θ T ins) (hf : RegionFacts Γ Γ') : + (∀ A B : Hypergraph S (Set S), Γ.toHypergraph.IsSeparation A B → separationOrder A B < θ → + ((A, B) ∈ T ↔ + ∃ (k : ℕ) (C : Fin k → Drawing S), + (∀ i : Fin k, (C i).IsCircuit ∧ (C i).IsSubdrawing Γ' ∧ (C i).length < 2 * θ ∧ + (C i).V ∩ Γ.V ⊆ (A ∩ B).vertexSet) ∧ + ∀ e ∈ A.edgeSet, ∃ i : Fin k, e ⊆ ins (C i))) ∧ + T = inducedPretangle Γ Γ' θ ins := by + have : T2Space S := hS.2.1 + have hr₁ : Γ.U ∩ Γ'.U = Γ.V := hrad.1 + have hVs : Γ.V ⊆ Γ'.V := hrad.2.1 + have hsl := isSlope_of_derived hS hT hr₁ hd + have hw : IsWeighting Γ' (2 * θ) Γ.V θ := + isWeighting_radial hT.one_le hVs (bipartite_of_preRadial hrad) + have hiso : ∀ v ∈ Γ.V, ∃ e ∈ Γ.E, v ∈ closure e := fun v hv => + exists_edge_of_regionFacts hS hf hv + -- If `Z(A)` is small then `(A, B) ∈ T`. + have hsmall : ∀ {A B : Hypergraph S (Set S)}, Γ.toHypergraph.IsSeparation A B → + separationOrder A B < θ → + IsSmall Γ' ins (2 * θ) Γ.V θ (PaintingOrDrawing.regionsIncludingEdge Γ' A) → (A, B) ∈ T := by + intro A B hsep hord hsm + obtain ⟨k, C, hC, hin⟩ := circuits_of_small hS hf hr₁ hsep hsm + exact mem_of_circuits hT hVs hd hiso hsep hord hC hin + -- If `(A, B) ∈ T` then `Z(A)` is small. + have hmem : ∀ {A B : Hypergraph S (Set S)}, Γ.toHypergraph.IsSeparation A B → + separationOrder A B < θ → (A, B) ∈ T → + IsSmall Γ' ins (2 * θ) Γ.V θ (PaintingOrDrawing.regionsIncludingEdge Γ' A) := by + intro A B hsep hord hAB + refine (small_or_small hS hf hsl hw hsep hord).1.resolve_right fun hsm => ?_ + have hBA := hsmall hsep.symm (by rwa [GM10.separationOrder_comm]) hsm + refine hT.axiom2 hAB hBA hBA ?_ + rw [GM10.union_assoc, GM10.union_self, hsep.union_eq] + refine ⟨fun A B hsep hord => ⟨fun h => ?_, ?_⟩, ?_⟩ + · exact circuits_of_small hS hf hr₁ hsep (hmem hsep hord h) + · rintro ⟨k, C, hC, hin⟩ + exact mem_of_circuits hT hVs hd hiso hsep hord hC hin + · ext p + constructor + · intro hp + have hs := hT.isSeparation (A := p.1) (B := p.2) hp + have ho := hT.order_lt (A := p.1) (B := p.2) hp + exact ⟨hs, ho, hmem hs ho hp⟩ + · rintro ⟨hs, ho, hsm⟩ + exact hsmall hs ho hsm + +end Tangle + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section64.lean b/LeanPool/GraphMinor/GM11/Section64.lean new file mode 100644 index 0000000000..eca2c58efc --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section64.lean @@ -0,0 +1,280 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Theorem63 +public import LeanPool.GraphMinor.GM11.Theorem75 + +/-! +# Graph Minors XI, (6.4): the first part + +This file proves claims (1) and (3) of the proof of (6.4), and the existence of the derived slope. + +Claim (1) says that if `(A, B) ∈ T` then `U(A)` includes no non-null-homotopic `O`-arc. The paper +goes through (3.1) +and (7.3). We use (7.5) instead. The union of the circuits of (6.3) lies in a closed disc `Δ`, by +(7.5), and so +each `ins(Cᵢ)` lies in `Δ`, since `Σ` is not a sphere. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] + +section Null + +variable [ConnectedSpace S] + +/-- If each circuit of `N` is null-homotopic, then `U(N)` lies in a closed disc, by (7.5). -/ +theorem exists_disc_of_circuits (hS : IsClosedSurface S) (N : Drawing S) + (hnull : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing N → IsNullHomotopicOArc C.U) : + ∃ Δ, IsClosedDisc Δ ∧ N.U ⊆ Δ := by + have : T2Space S := hS.2.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hc := N.isClosed_U + have hn : IsNice N.U := ⟨N, isGammaNice_of_frontier (Drawing.IsSubdrawing.refl N) subset_rfl + (hc.frontier_eq.subset.trans sdiff_subset)⟩ + have hu : N.U ≠ univ := by + obtain ⟨x⟩ : Nonempty S := inferInstance + obtain ⟨y, -, hy⟩ := exists_notMem_U (Γ := N) hS isOpen_univ ⟨x, mem_univ x⟩ + exact fun h => hy (h ▸ mem_univ y) + obtain ⟨Δ, hΔ, -, hsub⟩ := theorem_7_5_proof hS hc hn hu finite_empty (disjoint_empty _) + (fun F hF hO => by + obtain ⟨C, hC, hCs, rfl⟩ := exists_circuit_of_oArc hO hF + rw [sdiff_empty] + exact hnull C hC hCs) + exact ⟨Δ, hΔ, hsub⟩ + +/-- A closed disc of `Σ` whose boundary lies in a closed disc `Δ` lies in `Δ`, if `Σ` is not a +sphere. -/ +theorem disc_subset_of_bd (hS : IsClosedSurface S) (hns : ¬ IsSphere S) {D Δ : Set S} + (hD : IsClosedDisc D) + (hΔ : IsClosedDisc Δ) (hsub : discBd D ⊆ Δ) : D ⊆ Δ := by + obtain ⟨E, ⟨hEΔ, hE, hb, -⟩, -⟩ := disc_oArc Δ (discBd D) hΔ hsub (IsClosedDisc.isOArc_discBd hD) + rw [eq_of_discBd_eq (IsClosedSurface.isSurface hS) hns hD hE hb.symm] + exact hEΔ + +omit [ConnectedSpace S] in +/-- An `O`-arc in the union of a finite set and the edges of a family inside a closed disc lies in +the disc. -/ +theorem oArc_subset_of_edges [T2Space S] {F Δ V₀ : Set S} {E₀ : Set (Set S)} (hF : IsOArc F) + (hΔ : IsClosed Δ) (hV : V₀.Finite) (hE : ∀ e ∈ E₀, e ⊆ Δ) (hsub : F ⊆ V₀ ∪ ⋃₀ E₀) : F ⊆ Δ := by + have hin : F \ V₀ ⊆ Δ := by + rintro x ⟨hx, hxV⟩ + obtain ⟨e, he, hxe⟩ := (hsub hx).resolve_left hxV + exact hE e he hxe + obtain ⟨x, hx, hxV⟩ := (infinite_of_isOArc hF).exists_notMem_finite hV + intro y hy + by_contra hyn + have hcov : F ⊆ Δ ∪ (V₀ \ Δ) := fun z hz => by + by_cases hzΔ : z ∈ Δ + · exact Or.inl hzΔ + · have hzV : z ∈ V₀ := by + by_contra h + exact hzΔ (hin ⟨hz, h⟩) + exact Or.inr ⟨hzV, hzΔ⟩ + obtain ⟨z, -, hz₁, -, hz₂⟩ := isPreconnected_closed_iff.mp hF.isPreconnected _ _ hΔ + (hV.subset sdiff_subset).isClosed hcov ⟨x, hx, hin ⟨hx, hxV⟩⟩ ⟨y, hy, + (hcov hy).resolve_left hyn⟩ + exact hz₂ hz₁ + +end Null + +variable {Γ : PaintingOrDrawing S} {Γ' : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + +omit [TopologicalSpace S] in +/-- The first vertex of a closed walk of positive length comes again later. -/ +theorem mem_tail_of_closed {α β : Type*} {G : Graph α β} {u : α} (W : GraphWalk G u u) + (hpos : 0 < W.length) {x : α} + (hx : x ∈ W.support) : x ∈ W.support.tail := by + rw [W.support_eq_cons, List.mem_cons] at hx + rcases hx with rfl | hx + · cases W with + | nil _ => simp [GraphWalk.length, GraphWalk.edges] at hpos + | cons hl r => exact r.end_mem_support + · exact hx + +/-- In a circuit of a bipartite drawing, at most half of the length lies on one side. -/ +theorem two_mul_ncard_le_length {G : Drawing S} (X : Set S) (hb : ∀ e x y, G.toGraph.IsLink e x y → + (x ∈ X ↔ y ∉ X)) + {C : Drawing S} (hC : C.IsCircuit) (hCs : C.IsSubdrawing G) : 2 * (X ∩ C.V).ncard ≤ C.length + := by + classical + obtain ⟨u, W, ⟨hnd, hed⟩, hpos, hCV, hCE⟩ := hC + have hlen : C.length = W.length := by + rw [Drawing.length, hCE] + have h : {e | e ∈ W.edges} = (W.edges.toFinset : Set (Set S)) := by + ext x + simp + rw [h, ncard_coe_finset, List.toFinset_card_of_nodup hed] + rfl + have hb' : ∀ e x y, C.toGraph.IsLink e x y → (x ∈ Xᶜ ↔ y ∉ Xᶜ) := by + intro e x y hl + have h := hb e x y ⟨hCs.2 hl.1, hCs.1 hl.2.1, hCs.1 hl.2.2.1, by + rw [← hCs.closure_inter_V hl.1] + exact hl.2.2.2⟩ + simp only [mem_compl_iff, not_not] + tauto + have hc := two_mul_count_le Xᶜ hb' W + have htail : W.support.tail.length = W.length := by + rw [List.length_tail, length_support] + rfl + have hsum : W.support.tail.countP (· ∈ X) + W.support.tail.countP (· ∈ Xᶜ) = W.length := by + rw [← htail, List.length_eq_countP_add_countP (fun x => decide (x ∈ X))] + congr 1 + have hmem : ∀ x ∈ W.support, x ∈ W.support.tail := fun _ hx => mem_tail_of_closed W hpos hx + have hcard : (X ∩ C.V).ncard ≤ W.support.tail.countP (· ∈ X) := by + have hsub : X ∩ C.V ⊆ ((W.support.tail.filter (· ∈ X)).toFinset : Set S) := by + rintro x ⟨hxX, hxV⟩ + rw [hCV] at hxV + simpa using ⟨hmem x hxV, hxX⟩ + have := ncard_le_ncard hsub (Finset.finite_toSet _) + rw [ncard_coe_finset, List.toFinset_card_of_nodup (hnd.filter _)] at this + rwa [List.countP_eq_length_filter] + omega + +variable [ConnectedSpace S] + +omit [ConnectedSpace S] in +/-- The derived slope exists: for each short circuit `C` of `Γ'`, the set `U(C)` is a normal `O`-arc +with fewer than `θ` +vertices of `Γ`, so that a respectful set `T` gives a closed disc. -/ +theorem exists_derivedSlope_of_preRadial [T2Space S] (hresp : Γ.IsRespectful θ T) + (hrad : Γ.IsPreRadialDrawing Γ') : + ∃ ins, IsDerivedSlope Γ Γ' θ T ins := by + classical + have hb := bipartite_of_preRadial hrad + have hex : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < 2 * θ → + ∃ Δ, IsClosedDisc Δ ∧ subBd Δ = C.U ∧ (Γ.inter Δ, Γ.interOutside Δ) ∈ T := by + intro C hC hCs hl + have hUs : C.U ⊆ Γ'.U := hCs.U_subset + have hsub : C.U ∩ Γ.V ⊆ Γ.V ∩ C.V := by + rintro x ⟨hxC, hxV⟩ + refine ⟨hxV, ?_⟩ + by_contra hn + obtain ⟨e, he, hxe⟩ := C.exists_edge_of_mem hxC hn + exact ((hCs.2 he).2.1 hxe).2 (hrad.2.1 hxV) + have hcard : (C.U ∩ Γ.V).ncard < θ := by + have h₁ := two_mul_ncard_le_length Γ.V hb hC hCs + have h₂ := ncard_le_ncard hsub (C.finite_V.subset inter_subset_right) + omega + refine hresp.2 C.U (IsCircuit.isOArc_U hC) ?_ hcard + rintro x ⟨hxC, hxU⟩ + rw [← hrad.1] + exact ⟨hxU, hUs hxC⟩ + refine ⟨fun C => if h : C.IsCircuit ∧ C.IsSubdrawing Γ' ∧ C.length < 2 * θ then + (hex C h.1 h.2.1 h.2.2).choose else ∅, fun C hC hCs hl => ?_⟩ + have h : C.IsCircuit ∧ C.IsSubdrawing Γ' ∧ C.length < 2 * θ := ⟨hC, hCs, hl⟩ + simp only [h, and_self, dite_true] + exact (hex C hC hCs hl).choose_spec + +omit [ConnectedSpace S] in +/-- A respectful tangle on a closed surface gives a derived slope in any pre-radial drawing. -/ +theorem exists_derivedSlope [T2Space S] (_hS : IsClosedSurface S) (hresp : Γ.IsRespectful θ T) + (hrad : Γ.IsPreRadialDrawing Γ') : + ∃ ins, IsDerivedSlope Γ Γ' θ T ins := + exists_derivedSlope_of_preRadial hresp hrad + +omit [ConnectedSpace S] in +/-- A short circuit of `Γ'` bounds a disc in a slope, so it is null-homotopic. -/ +theorem null_of_disc [T2Space S] {D Δ : Set S} (hD : IsOArc D) (d : IsClosedDisc Δ) (b : subBd Δ + = D) : + IsNullHomotopicOArc D := by + refine isNullHomotopicOArcIn_of_subset_disc hD (subset_univ _) d ?_ + rw [← b, subBd_eq_frontier] + exact (IsClosedDisc.isCompact d).isClosed.frontier_subset + +omit [ConnectedSpace S] in +/-- A short circuit of `Γ'` is null-homotopic. -/ +theorem null_of_short [T2Space S] {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} (hd : IsDerivedSlope Γ Γ' θ T ins) {D : Drawing S} (hD : D.IsCircuit) + (hDs : D.IsSubdrawing Γ') (hl : D.length < 2 * θ) : IsNullHomotopicOArc D.U := by + obtain ⟨d, b, -⟩ := hd D hD hDs hl + exact null_of_disc (IsCircuit.isOArc_U hD) d b + +omit [ConnectedSpace S] in +/-- A circuit of `Γ'` with few vertices in `Γ` is short, and so it is null-homotopic. -/ +theorem null_of_few [T2Space S] {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S + (Set S))} {ins : Drawing S → Set S} + (hw : IsWeighting Γ' (2 * θ) Γ.V θ) (hd : IsDerivedSlope Γ Γ' θ T ins) {D : Drawing S} + (hD : D.IsCircuit) + (hDs : D.IsSubdrawing Γ') (hfew : (Γ.V ∩ D.V).ncard < θ) : IsNullHomotopicOArc D.U := by + have hl : D.length < 2 * θ := by + by_contra hl + exact absurd (hw.le_ncard D hD hDs (not_lt.mp hl)) (not_le.mpr hfew) + exact null_of_short hd hD hDs hl + +omit [ConnectedSpace S] in +/-- If circuits of `Γ'` with vertices in `V(A ∩ B)` have discs that include the edges of `A`, then +every `O`-arc in +`U(A)` is null-homotopic. This is the core of claim (1) of (6.4) (page 90). -/ +theorem no_oArc_of_circuits [ConnectedSpace S] (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + (hθ : 1 ≤ θ) + (hrad : Γ.IsRadialDrawing Γ') (hd : IsDerivedSlope Γ Γ' θ T ins) {A B : Hypergraph S (Set S)} + (hord : separationOrder A B < θ) {k : ℕ} {C : Fin k → Drawing S} + (hC : ∀ i : Fin k, (C i).IsCircuit ∧ (C i).IsSubdrawing Γ' ∧ (C i).length < 2 * θ ∧ + (C i).V ∩ Γ.V ⊆ (A ∩ B).vertexSet) (hcov : ∀ e ∈ A.edgeSet, ∃ i : Fin k, e ⊆ ins (C i)) + {F : Set S} (hF : IsOArc F) (hFA : F ⊆ PaintingOrDrawing.underlying A) : IsNullHomotopicOArc F + := by + have : T2Space S := hS.2.1 + have hw : IsWeighting Γ' (2 * θ) Γ.V θ := isWeighting_radial hθ hrad.2.1.2.1 + (bipartite_of_preRadial hrad.2.1) + let N : Drawing S := Γ'.span (⋃ i, (C i).V) (⋃ i, (C i).E) + have hNs : N.IsSubdrawing Γ' := Drawing.span_isSubdrawing Γ' _ _ + have hCN : ∀ i, (C i).IsSubdrawing N := fun i => by + refine ⟨fun x hx => Or.inl ⟨mem_iUnion.mpr ⟨i, hx⟩, (hC i).2.1.1 hx⟩, fun e he => ?_⟩ + change e ∈ (Γ'.span _ _).E + rw [Γ'.span_E] + exact ⟨mem_iUnion.mpr ⟨i, he⟩, (hC i).2.1.2 he⟩ + have hNV : N.V ∩ Γ.V ⊆ (A ∩ B).vertexSet := by + rintro x ⟨hx | hx, hxV⟩ + · obtain ⟨i, hi⟩ := mem_iUnion.mp hx.1 + exact (hC i).2.2.2 ⟨hi, hxV⟩ + · obtain ⟨e, ⟨he, -⟩, hxe⟩ := mem_iUnion₂.mp hx + obtain ⟨i, hi⟩ := mem_iUnion.mp he + have hxi : x ∈ closure e ∩ (C i).V := by + rw [(hC i).2.1.closure_inter_V hi] + exact hxe + exact (hC i).2.2.2 ⟨hxi.2, hxV⟩ + obtain ⟨Δ, hΔ, hNΔ⟩ := exists_disc_of_circuits hS N fun D hD hDs => + null_of_few hw hd hD (hDs.trans hNs) ((ncard_le_ncard (fun x (hx : x ∈ Γ.V ∩ D.V) => + hNV ⟨hDs.1 hx.2, hx.1⟩) (A ∩ B).vertexSet_finite).trans_lt hord) + have hsub : ∀ i, ins (C i) ⊆ Δ := fun i => by + obtain ⟨d, b, -⟩ := hd (C i) (hC i).1 (hC i).2.1 (hC i).2.2.1 + refine disc_subset_of_bd hS hns d hΔ ?_ + rw [← IsClosedDisc.frontier_eq_discBd hS d, ← subBd_eq_frontier, b] + exact (hCN i).U_subset.trans hNΔ + have hFΔ : F ⊆ Δ := oArc_subset_of_edges hF (IsClosedDisc.isCompact hΔ).isClosed + A.vertexSet_finite + (fun e he => by + obtain ⟨i, hi⟩ := hcov e he + exact hi.trans (hsub i)) hFA + exact isNullHomotopicOArcIn_of_subset_disc hF (subset_univ _) hΔ hFΔ + +/-- **Claim (1) of (6.4)** (page 90). -/ +theorem no_oArc_of_mem (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + (hE : Γ.E.Nonempty) (hT2 : Γ.IsTwoCell) (hT : IsPretangle Γ.toHypergraph θ T) + (hresp : Γ.IsRespectful θ T) + (hrad : Γ.IsRadialDrawing Γ') (hd : IsDerivedSlope Γ Γ' θ T ins) {A B : Hypergraph S (Set S)} + (hsep : Γ.toHypergraph.IsSeparation A B) (hord : separationOrder A B < θ) (hmem : (A, B) ∈ T) + {F : Set S} (hF : IsOArc F) (hFA : F ⊆ PaintingOrDrawing.underlying A) : IsNullHomotopicOArc F + := by + have : T2Space S := hS.2.1 + obtain ⟨k, C, hC, hcov⟩ := ((theorem_6_3_proof S hS inferInstance Γ Γ' θ T ins hT2 hE hT hresp + hrad hd).1 A B hsep hord).mp hmem + exact no_oArc_of_circuits hS hns hT.one_le hrad hd hord hC hcov hF hFA + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section64b.lean b/LeanPool/GraphMinor/GM11/Section64b.lean new file mode 100644 index 0000000000..d84e8d19e2 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section64b.lean @@ -0,0 +1,485 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section64 +public import LeanPool.GraphMinor.GM11.StarChart + +/-! +# Claim (2) of (6.4) of Graph Minors XI, for drawings + +Graph Minors XI, (6.4), pages 90–91. Let `(A, B)` be a separation of a 2-cell drawing `Γ` in a +surface that is not a +sphere. The paper shows that `Γ \ V(A ∩ B)` is 1-representative, "similar" to the case of paintings, +and then uses +(7.5). Here is the same proof with the steps written out. + +`Q` is `U(Γ)` with a small piece of each edge removed near `V(A ∩ B)`. If each `O`-arc of `U(Γ) - +V(A ∩ B)` is +null-homotopic, then (7.5) gives a closed disc that contains `Q`. The outside of the disc lies in +the union of the +regions of `Γ` and small discs around the points of `V(A ∩ B)`. That union is flat by +`flat_iUnion_cover`: its pieces +are joined along edges of `Γ'` at `V(A ∩ B)`, whose circuits are null-homotopic since they are +short. This contradicts +`not_flat_compl_disc`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] + +theorem cl_symm_trans_symm {a b c : S} (f : Cl a b) (g : Cl b c) : (f.trans g).symm + = g.symm.trans f.symm := by + induction f using Path.Homotopic.Quotient.ind with | mk f => ?_ + induction g using Path.Homotopic.Quotient.ind with | mk g => ?_ + simp only [← Path.Homotopic.Quotient.mk_trans, ← Path.Homotopic.Quotient.mk_symm, Path.trans_symm] + +/-- In a line, each point other than the first end is joined to the last end, off the first end. -/ +theorem joinedIn_line {L : Set S} {x y p : S} (hL : IsLineWithEnds L x y) (hp : p ∈ L) + (hpx : p ≠ x) : + JoinedIn (L \ {x}) p y := by + obtain ⟨f, h0, h1⟩ := hL + have hne : (f.symm ⟨p, hp⟩ : I) ≠ 0 := fun h => hpx (by + have := f.apply_symm_apply ⟨p, hp⟩ + rw [h] at this + rw [← h0, this]) + set a : I := f.symm ⟨p, hp⟩ with ha + have ha0 : 0 < a.1 := lt_of_le_of_ne a.2.1 fun h => hne (Subtype.ext h.symm) + let m : I → I := fun t => ⟨a.1 + t.1 * (1 - a.1), by + have := t.2.1 + have := a.2.2 + have := a.2.1 + nlinarith, by + have := t.2.2 + have := a.2.2 + nlinarith⟩ + have hm : Continuous m := Continuous.subtype_mk (by fun_prop) _ + refine ⟨⟨⟨fun t => (f (m t)).1, by fun_prop⟩, ?_, ?_⟩, fun t => ⟨(f (m t)).2, ?_⟩⟩ + · have : m 0 = a := Subtype.ext (by simp [m]) + simp [this, ha] + · have : m 1 = 1 := Subtype.ext (by simp [m]) + simp [this, h1] + · intro h + have h' : f (m t) = f 0 := Subtype.ext (by rw [h0]; exact h) + have := congrArg Subtype.val (f.injective h') + have ht := t.2.1 + have ht1 := a.2.2 + simp only [m] at this + simp at this + nlinarith + +section Sep + +variable {Γ : PaintingOrDrawing S} {A B : Hypergraph S (Set S)} + +/-- `U(A)` is the union of `V(A)` and the closures of the edges of `A`. -/ +theorem underlying_eq (hcl : ∀ e ∈ Γ.E, closure e \ Γ.V ⊆ e) (hA : A ≤ Γ.toHypergraph) : + PaintingOrDrawing.underlying A = A.vertexSet ∪ ⋃ e ∈ A.edgeSet, closure e := by + apply subset_antisymm + · rintro x (hx | ⟨e, he, hxe⟩) + · exact Or.inl hx + · exact Or.inr (mem_iUnion₂.mpr ⟨e, he, subset_closure hxe⟩) + · rintro x (hx | hx) + · exact Or.inl hx + obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + have heG : e ∈ Γ.E := Γ.toHypergraph_edgeSet ▸ hA.edgeSet_subset he + by_cases hxV : x ∈ Γ.V + · have hinc : Γ.toHypergraph.Inc e x := PaintingOrDrawing.toHypergraph_inc.mpr ⟨heG, hxV, hxe⟩ + have : x ∈ A.ends e := by + rw [← hA.ends_eq e he] + exact hinc + exact Or.inl (A.vertex_mem_of_inc this) + · exact Or.inr ⟨e, he, hcl e heG ⟨hxe, hxV⟩⟩ + +theorem isClosed_underlying [T2Space S] (hcl : ∀ e ∈ Γ.E, closure e \ Γ.V ⊆ e) (hA : A + ≤ Γ.toHypergraph) : + IsClosed (PaintingOrDrawing.underlying A) := by + rw [underlying_eq hcl hA] + exact A.vertexSet_finite.isClosed.union (A.edgeSet_finite.isClosed_biUnion fun _ _ + => isClosed_closure) + +theorem U_subset_underlying (hmem : ∀ x ∈ Γ.U, x ∉ Γ.V → ∃ e ∈ Γ.E, x ∈ e) + (hsep : Γ.toHypergraph.IsSeparation A B) : + Γ.U ⊆ PaintingOrDrawing.underlying A ∪ PaintingOrDrawing.underlying B := by + have hV : A.vertexSet ∪ B.vertexSet = Γ.V := (congrArg Hypergraph.vertexSet hsep.union_eq).trans + Γ.toHypergraph_vertexSet + have hE : A.edgeSet ∪ B.edgeSet = Γ.E := (congrArg Hypergraph.edgeSet hsep.union_eq).trans + Γ.toHypergraph_edgeSet + intro x hx + by_cases hxV : x ∈ Γ.V + · rw [← hV] at hxV + exact hxV.imp Or.inl Or.inl + obtain ⟨e, he, hxe⟩ := hmem x hx hxV + rw [← hE] at he + exact he.imp (fun h => Or.inr ⟨e, h, hxe⟩) fun h => Or.inr ⟨e, h, hxe⟩ + +theorem underlying_inter (hdis : ∀ e ∈ Γ.E, ∀ f ∈ Γ.E, ∀ x, x ∈ e → x ∈ f → e = f) + (hEV : ∀ e ∈ Γ.E, ∀ x ∈ e, x ∉ Γ.V) + (hsep : Γ.toHypergraph.IsSeparation A B) : + PaintingOrDrawing.underlying A ∩ PaintingOrDrawing.underlying B ⊆ (A ∩ B).vertexSet := by + have hAV : ∀ x ∈ A.vertexSet, x ∈ Γ.V := fun x hx => Γ.toHypergraph_vertexSet ▸ + hsep.left_le.vertexSet_subset hx + have hBV : ∀ x ∈ B.vertexSet, x ∈ Γ.V := fun x hx => Γ.toHypergraph_vertexSet ▸ + hsep.right_le.vertexSet_subset hx + have hAE : ∀ e ∈ A.edgeSet, e ∈ Γ.E := fun e he => Γ.toHypergraph_edgeSet ▸ + hsep.left_le.edgeSet_subset he + have hBE : ∀ e ∈ B.edgeSet, e ∈ Γ.E := fun e he => Γ.toHypergraph_edgeSet ▸ + hsep.right_le.edgeSet_subset he + rintro x ⟨hx | ⟨e, he, hxe⟩, hx' | ⟨f, hf, hxf⟩⟩ + · exact ⟨hx, hx'⟩ + · exact absurd (hAV x hx) (hEV f (hBE f hf) x hxf) + · exact absurd (hBV x hx') (hEV e (hAE e he) x hxe) + · have : e = f := hdis e (hAE e he) f (hBE f hf) x hxe hxf + subst this + have h₀ : (A ∩ B).edgeSet = ∅ := hsep.edgeSet_inter_eq + exact absurd (show e ∈ (A ∩ B).edgeSet from ⟨he, hf⟩) (by rw [h₀]; exact notMem_empty e) + +end Sep + +section Main + +variable [ConnectedSpace S] {Γ Γ' : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + +private theorem old_vertices_in_star_neighborhood + {S : Type u} + [TopologicalSpace S] [T2Space S] + {Γ : Drawing S} + {Γ' : Drawing S} + (hS : IsClosedSurface S) + {G₀ : Drawing S} + (hG₀ : G₀.IsSubdrawing Γ') + {S₀ : Set S} + (hS₀V : S₀ ⊆ Γ.V) + (hpre : PreRad (PaintingOrDrawing.drawing Γ) Γ') + (hV'V : Γ.V ⊆ Γ'.V) : + let edges := {e | e ∈ G₀.E ∧ ∃ s ∈ S₀, s ∈ closure e} + Γ.V ∩ (G₀.span (S₀ ∪ G₀.V \ Γ.V) edges).V ⊆ S₀ := by + intro edges + rintro x ⟨hxV, (hx | hx)⟩ + · rcases hx.1 with h | h + · exact h + · exact absurd hxV h.2 + · obtain ⟨e, ⟨⟨heE, s, hs, hse⟩, -⟩, hxe⟩ := mem_iUnion₂.mp hx + obtain ⟨v, hv, r, hr, w, hw, hwV, hcap, -⟩ := spoke_ends hpre hS (hG₀.2 heE) + have hw' : w ∉ Γ.V := fun h => region_subset hr hw (Γ.V_subset_U h) + have hv' : ∀ z ∈ Γ.V, z ∈ closure e ∩ Γ'.V → z = v := fun z hz hzc => by + rw [hcap] at hzc + rcases hzc with rfl | rfl + · rfl + · exact absurd hz hw' + rw [hv' x hxV ⟨hxe.1, hV'V hxV⟩, ← hv' s (hS₀V hs) ⟨hse, hV'V (hS₀V hs)⟩] + exact hs + +/-- The regions of `Γ`, and a small open set around each vertex of a small set `S₀ ⊆ V(Γ)`, form a +flat set, if short +circuits of `Γ'` are null-homotopic. This is the core of claim (2) of (6.4) (pages 90–91). -/ +theorem exists_flat_regions_of_sub (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) + (hrad : (PaintingOrDrawing.drawing Γ).IsRadialDrawing Γ') (hθ : 1 ≤ θ) {G₀ : Drawing S} + (hG₀ : G₀.IsSubdrawing Γ') + {R₀ : Set (Set S)} (hR₀ : R₀ ⊆ Γ.R) (hspoke : ∀ h ∈ Γ'.E, ∀ r ∈ R₀, h ⊆ r → h ∈ G₀.E) + (hhubV : ∀ r ∈ R₀, ∀ c ∈ r, c ∈ Γ'.V → c ∈ G₀.V) + (hnull : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing G₀ → C.length < 2 * θ + → IsNullHomotopicOArc C.U) + {S₀ : Set S} (hS₀V : S₀ ⊆ Γ.V) (hS₀G : S₀ ⊆ G₀.V) (hS₀f : S₀.Finite) (hord : S₀.ncard < θ) : + ∃ D : S → Set S, (∀ s ∈ S₀, IsOpen (D s)) ∧ (∀ s ∈ S₀, s ∈ D s) ∧ + Flat ((⋃ r ∈ R₀, r) ∪ ⋃ s ∈ S₀, D s) := by + classical + have ht2 : T2Space S := hS.2.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hpre : PreRad (PaintingOrDrawing.drawing Γ) Γ' := ⟨hrad.1, hrad.2.1⟩ + have hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ' := hrad.2.2 + have hV'V : Γ.V ⊆ Γ'.V := hrad.2.1.2.1 + obtain ⟨γ, hγ⟩ := exists_edgePar (radialUnion hpre) + obtain ⟨Sep, hSep, hdisj⟩ := hS₀f.t2_separation + have hgood : ∀ s ∈ S₀, ∃ D : Set S, IsOpen D ∧ s ∈ D ∧ D ⊆ Sep s ∧ IsSimplyConnectedSet D ∧ + ∀ r ∈ Γ.R, ∀ y, y ∈ r → y ∈ D → y ∉ (radialUnion hpre).U → ∃ k : halfEdges + (radialUnion hpre) γ s, + k.1.1 ∈ Γ'.E ∧ ∃ t : I, 0 < t ∧ (∀ u, u ≤ t → spoke γ k.1 u ∈ D) ∧ spoke γ k.1 t ∈ r ∧ + JoinedIn (r ∩ D) y (spoke γ k.1 t) := fun s hs => by + have hsV := hS₀V hs + have hsH : s ∈ (radialUnion hpre).V := by + rw [radialUnion_V] + exact hV'V hsV + have h2 := two_half_edges hpre hS hmax hE hγ hsV + obtain ⟨next, ρ, P, W, Q, τ, hsec⟩ := exists_sectors hS (radialUnion hpre) hγ hsH h2 + obtain ⟨Φ, hΦ⟩ := exists_isPolar_of_sectors hS hγ hsH h2 + obtain ⟨D, hDo, hsD, hDsub, hDs, hstar⟩ := exists_star_nbhd hΦ ((IsSectors.isOpen hsec).inter + (hSep s).2) + ⟨IsSectors.mem hsec, (hSep s).1⟩ + exact ⟨D, hDo, hsD, fun x hx => (hDsub hx).2, hDs, fun r hr y hy hyD hyU => + sector_join hpre hS hmax hE hγ hsV hsec hΦ hDo hsD (fun x hx => + (hDsub hx).1) hstar hr hy hyD hyU⟩ + choose! D hDo hsD hDsub hDs hDjoin using hgood + -- The flat set `Z`: the edges of `Γ'` at `S₀`, and the vertices of `Γ'` in regions. + let Es : Set (Set S) := {h | h ∈ G₀.E ∧ ∃ s ∈ S₀, s ∈ closure h} + let N : Drawing S := G₀.span (S₀ ∪ (G₀.V \ Γ.V)) Es + have hNs : N.IsSubdrawing G₀ := Drawing.span_isSubdrawing G₀ _ _ + have hcloZ : ∀ h, h ∈ G₀.E → ∀ s ∈ S₀, s ∈ closure h → closure h ⊆ N.U := fun h hh s hs hsh x hx + => + Or.inr (mem_iUnion₂.mpr ⟨h, ⟨⟨hh, s, hs, hsh⟩, hh⟩, hx⟩) + have hsZ : ∀ s ∈ S₀, s ∈ N.U := fun s hs => Or.inl (Or.inl ⟨Or.inl hs, hS₀G hs⟩) + have hcZ : ∀ {r c}, r ∈ R₀ → c ∈ r → c ∈ Γ'.V → c ∈ N.U := fun hr hc hcV => + Or.inl (Or.inl ⟨Or.inr ⟨hhubV _ hr _ hc hcV, fun h => region_subset (hR₀ hr) hc + (Γ.V_subset_U h)⟩, + hhubV _ hr _ hc hcV⟩) + have hNV : Γ.V ∩ N.V ⊆ S₀ := by + exact old_vertices_in_star_neighborhood (S := S) (Γ := Γ) (Γ' := Γ') hS (G₀ := G₀) hG₀ (S₀ := + S₀) hS₀V hpre hV'V + have hweight : IsWeighting Γ' (2 * θ) (PaintingOrDrawing.drawing Γ).V θ := + isWeighting_radial hθ hV'V (bipartite_of_preRadial hrad.2.1) + have hZf : Flat N.U := by + refine flat_univ_iff.mp (flat_of_null_oArcs (Γ := N) hS N.isClosed_U ?_ + (subset_univ _) fun F hFZ hF => ?_) + · exact isGammaNice_of_frontier (Drawing.IsSubdrawing.refl N) subset_rfl + (N.isClosed_U.frontier_eq.subset.trans sdiff_subset) + · obtain ⟨C, hC, hCs, rfl⟩ := exists_circuit_of_oArc hF hFZ + refine hnull C hC (hCs.trans hNs) (not_le.mp fun hl => ?_) + exact absurd (hweight.le_ncard C hC ((hCs.trans hNs).trans hG₀) hl) + (not_le.mpr ((ncard_le_ncard + (fun x (hx : x ∈ (PaintingOrDrawing.drawing Γ).V ∩ C.V) => + hNV ⟨hx.1, hCs.1 hx.2⟩) hS₀f).trans_lt hord)) + -- The triangle at a point of `r ∩ D s`. + have htri' : ∀ r ∈ R₀, ∀ c ∈ r, c ∈ Γ'.V → ∀ s ∈ S₀, ∀ y, y ∈ r → y ∈ D s → + ∃ (f : Cl c y) (g : Cl y s), Arw r f ∧ Arw (D s) g ∧ Arw N.U (f.trans g) := by + intro r hr c hc hcV s hs y hy hyD + have hBo : IsOpen (r ∩ D s) := (region_isOpen (hR₀ hr)).inter (hDo s hs) + have hco := hBo.connectedComponentIn (x := y) + have hpc := isPathConnected_of_isOpen hS hco isPreconnected_connectedComponentIn + ⟨y, mem_connectedComponentIn ⟨hy, hyD⟩⟩ + obtain ⟨y₀, hy₀, hy₀U⟩ := exists_notMem_U (Γ := radialUnion hpre) hS hco + ⟨y, mem_connectedComponentIn ⟨hy, hyD⟩⟩ + have hy₀B := connectedComponentIn_subset _ _ hy₀ + have hj₀ : JoinedIn (r ∩ D s) y y₀ := (hpc.joinedIn y (mem_connectedComponentIn ⟨hy, hyD⟩) y₀ + hy₀).mono + (connectedComponentIn_subset _ _) + obtain ⟨k, hkE, t, ht, hle, htr, hj₁⟩ := hDjoin s hs r (hR₀ hr) y₀ hy₀B.1 hy₀B.2 hy₀U + have hj := hj₀.trans hj₁ + set p := spoke γ k.1 t with hp + let β : Cl y p := Cl.mk hj.somePath + have hβ : Arw (r ∩ D s) β := ⟨hj.somePath, fun u => hj.somePath_mem u, rfl⟩ + have hkH : k.1.1 ∈ (radialUnion hpre).E := k.2.1 + have hsc : s ∈ closure k.1.1 := by + have := end_mem_closure hγ hkH k.1.2 + rwa [k.2.2] at this + obtain ⟨v, hv, r₁, hr₁, w, hw, hwV, hcap, hsub⟩ := spoke_ends hpre hS hkE + have hsv : s = v := by + have : s ∈ closure k.1.1 ∩ Γ'.V := ⟨hsc, hV'V (hS₀V hs)⟩ + rw [hcap] at this + rcases this with h | h + · exact h + · exact absurd (hS₀V hs) (fun h' => region_subset hr₁ hw (Γ.V_subset_U (h ▸ h'))) + subst hsv + have hpe : p ∈ k.1.1 := spoke_mem_edge hγ hkH ht + obtain rfl : r₁ = r := region_eq_of_mem hr₁ (hR₀ hr) (hsub hpe) htr + have hkG : k.1.1 ∈ G₀.E := hspoke _ hkE _ hr hsub + obtain rfl : w = c := hub_unique hpre hr₁ hc hcV hw hwV + have hsw : s ≠ w := fun h => region_subset hr₁ hc (Γ.V_subset_U (h ▸ hv)) + have hline : IsLineWithEnds (closure k.1.1) s w := by + rcases Γ'.edge_cond k.1.1 hkE with ⟨a, b, hab, hc', hL⟩ | ⟨a, hc', -⟩ + · rw [hcap] at hc' + rcases (Set.pair_eq_pair_iff.mp hc') with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hL + · exact IsLineWithEnds.symm hL + · rw [hcap] at hc' + have h₁ : s ∈ ({a} : Set S) := hc' ▸ mem_insert _ _ + have h₂ : w ∈ ({a} : Set S) := hc' ▸ mem_insert_of_mem _ rfl + exact absurd (h₁.trans h₂.symm) hsw + have hsub' : closure k.1.1 \ {s} ⊆ r₁ ∩ N.U := by + rintro z ⟨hz, hzs⟩ + refine ⟨?_, hcloZ _ hkG s hs hsc hz⟩ + by_cases hzV : z ∈ Γ'.V + · have : z ∈ closure k.1.1 ∩ Γ'.V := ⟨hz, hzV⟩ + rw [hcap] at this + rcases this with h | h + · exact absurd h hzs + · exact (mem_singleton_iff.mp h) ▸ hw + · exact hsub ((Γ'.closure_diff_V hkE).subset ⟨hz, hzV⟩) + have hps : p ≠ s := fun h => edge_notMem_V hkE hpe (h ▸ hV'V hv) + have hja := (joinedIn_line hline (subset_closure hpe) hps).symm.mono hsub' + let a : Cl w p := Cl.mk hja.somePath + have ha : Arw (r₁ ∩ N.U) a := ⟨hja.somePath, fun u => hja.somePath_mem u, rfl⟩ + have hspc := continuous_spoke hγ hkH + have hspoke' : ∀ u : I, spoke γ k.1 u ∈ closure k.1.1 := fun u => by + rcases eq_or_lt_of_le (unitInterval.nonneg u) with h0 | h0 + · have h0' : u = 0 := Subtype.ext h0.symm + rw [h0', spoke_zero] + exact end_mem_closure hγ hkH _ + · exact subset_closure (spoke_mem_edge hγ hkH h0) + let q : Path p s := ⟨⟨fun u => spoke γ k.1 (σ u * t), hspc.comp (by fun_prop)⟩, by simp [hp], by + simp only [unitInterval.symm_one, zero_mul, spoke_zero] + exact k.2.2⟩ + have hq : Arw (D s ∩ N.U) (Cl.mk q) := ⟨q, fun u => ⟨hle _ unitInterval.mul_le_right, + hcloZ _ hkG s hs hsc (hspoke' _)⟩, rfl⟩ + refine ⟨a.trans β.symm, β.trans (Cl.mk q), (ha.mono inter_subset_left).trans + (hβ.symm.mono inter_subset_left), + (hβ.mono inter_subset_right).trans (hq.mono inter_subset_left), ?_⟩ + have : (a.trans β.symm).trans (β.trans (Cl.mk q)) = a.trans (Cl.mk q) := by + rw [cl_assoc, cl_symm_trans_left] + rw [this] + exact (ha.mono inter_subset_right).trans (hq.mono inter_subset_right) + -- The pieces. + have hhub : ∀ r ∈ R₀, ∃ c, c ∈ r ∧ c ∈ Γ'.V := fun r hr => (hrad.2.1.2.2.1 r (hR₀ hr)).exists + choose! hub hubr hubV using hhub + let ι := {r // r ∈ R₀} ⊕ {s // s ∈ S₀} + let O : ι → Set S := Sum.elim (fun r => r.1) fun s => D s.1 + let b : ι → S := Sum.elim (fun r => hub r.1) fun s => s.1 + have hOd : ∀ r ∈ R₀, IsSimplyConnectedSet r := fun r hr => IsOpenDisc.isSimplyConnectedSet + (hrad.1.2 r (hR₀ hr)) + have hfl : Flat (⋃ i, O i) := by + refine flat_iUnion_cover hZf O b ?_ ?_ ?_ ?_ ?_ + · rintro (r | s) + · exact region_isOpen (hR₀ r.2) + · exact hDo s.1 s.2 + · rintro (r | s) + · exact hubr r.1 r.2 + · exact hsD s.1 s.2 + · rintro (r | s) + · exact (hOd r.1 r.2).1 + · exact (hDs s.1 s.2).1 + · rintro (r | s) + · exact IsSimplyConnectedSet.flat (hOd r.1 r.2) + · exact IsSimplyConnectedSet.flat (hDs s.1 s.2) + · rintro (r | s) (r' | s') y hy hy' + · obtain rfl : r = r' := Subtype.ext (region_eq_of_mem (hR₀ r.2) (hR₀ r'.2) hy hy') + have hj := (hOd r.1 r.2).1.joinedIn _ (hubr r.1 r.2) y hy + refine ⟨Cl.mk hj.somePath, (Cl.mk hj.somePath).symm, ⟨_, hj.somePath_mem, rfl⟩, + Arw.symm ⟨_, hj.somePath_mem, rfl⟩, ?_⟩ + have h : Arw N.U ((Cl.mk hj.somePath).trans (Cl.mk hj.somePath).symm) := by + rw [cl_trans_symm] + exact arw_refl (hcZ r.2 (hubr r.1 r.2) (hubV r.1 r.2)) + exact h + · exact htri' r.1 r.2 _ (hubr r.1 r.2) (hubV r.1 r.2) s'.1 s'.2 y hy hy' + · obtain ⟨f, g, hf, hg, hw⟩ := htri' r'.1 r'.2 _ (hubr r'.1 r'.2) + (hubV r'.1 r'.2) s.1 s.2 y hy' hy + refine ⟨g.symm, f.symm, hg.symm, hf.symm, ?_⟩ + have h : Arw N.U (g.symm.trans f.symm) := by + rw [← cl_symm_trans_symm] + exact hw.symm + exact h + · obtain rfl : s = s' := Subtype.ext (by + by_contra hne + exact disjoint_left.mp (hdisj s.2 s'.2 hne) (hDsub _ s.2 hy) (hDsub _ s'.2 hy')) + have hj := (hDs s.1 s.2).1.joinedIn _ (hsD s.1 s.2) y hy + refine ⟨Cl.mk hj.somePath, (Cl.mk hj.somePath).symm, ⟨_, hj.somePath_mem, rfl⟩, + Arw.symm ⟨_, hj.somePath_mem, rfl⟩, ?_⟩ + have h : Arw N.U ((Cl.mk hj.somePath).trans (Cl.mk hj.somePath).symm) := by + rw [cl_trans_symm] + exact arw_refl (hsZ s.1 s.2) + exact h + refine ⟨D, hDo, hsD, ?_⟩ + have hK : (⋃ r ∈ R₀, r) ∪ (⋃ s ∈ S₀, D s) = ⋃ i, O i := by + ext x + simp only [mem_union, mem_iUnion] + constructor + · rintro (⟨r, hr, hx⟩ | ⟨s, hs, hx⟩) + · exact ⟨Sum.inl ⟨r, hr⟩, hx⟩ + · exact ⟨Sum.inr ⟨s, hs⟩, hx⟩ + · rintro ⟨r | s, hx⟩ + · exact Or.inl ⟨r.1, r.2, hx⟩ + · exact Or.inr ⟨s.1, s.2, hx⟩ + rw [hK] + exact hfl + +/-- `exists_flat_regions_of_sub` for all regions of `Γ` and all edges of `Γ'`. -/ +theorem exists_flat_regions (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) + (hrad : (PaintingOrDrawing.drawing Γ).IsRadialDrawing Γ') (hθ : 1 ≤ θ) + (hnull : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < 2 * θ + → IsNullHomotopicOArc C.U) + {S₀ : Set S} (hS₀V : S₀ ⊆ Γ.V) (hS₀f : S₀.Finite) (hord : S₀.ncard < θ) : + ∃ D : S → Set S, (∀ s ∈ S₀, IsOpen (D s)) ∧ (∀ s ∈ S₀, s ∈ D s) ∧ + Flat ((⋃ r ∈ Γ.R, r) ∪ ⋃ s ∈ S₀, D s) := + exists_flat_regions_of_sub hS hE hrad hθ (Drawing.IsSubdrawing.refl Γ') Subset.rfl (fun _ h _ _ _ + => h) + (fun _ _ _ _ h => h) hnull hS₀V (hS₀V.trans hrad.2.1.2.1) hS₀f hord + +/-- Flat neighborhoods of the separating vertices and null-homotopy on one side force an essential +circle in the other side outside the separator. -/ +theorem exists_oArc_of_flat_regions + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) (Γ : Drawing S) {A B : Hypergraph S (Set S)} + (hsep : Γ.toHypergraph.IsSeparation A B) + (hflat : ∃ D : S → Set S, (∀ s ∈ (A ∩ B).vertexSet, IsOpen (D s)) ∧ (∀ s ∈ + (A ∩ B).vertexSet, s ∈ D s) ∧ + Flat ((⋃ r ∈ Γ.R, r) ∪ ⋃ s ∈ (A ∩ B).vertexSet, D s)) + (hA : ∀ F : Set S, F ⊆ PaintingOrDrawing.underlying A → IsOArc F → IsNullHomotopicOArc F) : + ∃ F : Set S, IsOArc F ∧ F ⊆ PaintingOrDrawing.underlying B \ PaintingOrDrawing.underlying A ∧ + ¬ IsNullHomotopicOArc F := by + by_contra hno + push Not at hno + have ht2 : T2Space S := hS.2.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hS₀V : (A ∩ B).vertexSet ⊆ Γ.V := fun x hx => hsep.left_le.vertexSet_subset hx.1 + obtain ⟨D, hDo, hsD, hfl⟩ := hflat + obtain ⟨γ₀, hγ₀⟩ := exists_edgePar Γ + obtain ⟨Q, hQc, hQn, hQU, hQc'⟩ := exists_cut_edges hγ₀ hS₀V hDo hsD + have hcl : ∀ e ∈ (PaintingOrDrawing.drawing Γ).E, closure e \ (PaintingOrDrawing.drawing Γ).V ⊆ e + := fun e he => + (Γ.closure_diff_V he).subset + have hAc := isClosed_underlying (Γ := PaintingOrDrawing.drawing Γ) hcl hsep.left_le + have hBc := isClosed_underlying (Γ := PaintingOrDrawing.drawing Γ) hcl hsep.right_le + have hcov := U_subset_underlying (Γ := PaintingOrDrawing.drawing Γ) + (fun x hx hxV => Γ.exists_edge_of_mem hx hxV) hsep + have hint := underlying_inter (Γ := PaintingOrDrawing.drawing Γ) + (fun e he f hf x hxe hxf => Γ.edge_eq_of_mem he hf hxe hxf) (fun e he x hx + => edge_notMem_V he hx) hsep + have hu : Q ≠ univ := fun h => by + obtain ⟨z, -, hz⟩ := exists_notMem_U (Γ := Γ) hS isOpen_univ univ_nonempty + exact hz (hQU (h ▸ mem_univ z)).1 + obtain ⟨Δ, hΔ, -, hQΔ⟩ := theorem_7_5_proof hS hQc hQn hu finite_empty + (disjoint_empty _) fun F hFQ hF => by + rw [sdiff_empty] + have hFA : F ⊆ PaintingOrDrawing.underlying A ∪ PaintingOrDrawing.underlying B := fun x hx => + hcov (hQU (hFQ hx)).1 + by_cases hFa : F ⊆ PaintingOrDrawing.underlying A + · exact hA F hFa hF + · refine hno F hF fun x hx => ?_ + have hFB : F ⊆ PaintingOrDrawing.underlying B := by + obtain ⟨a, ha, haA⟩ := not_subset.mp hFa + by_contra hFb + obtain ⟨c, hc, hcB⟩ := not_subset.mp hFb + obtain ⟨z, hzF, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp hF.isPreconnected _ _ hAc hBc hFA + ⟨c, hc, (hFA hc).resolve_right hcB⟩ ⟨a, ha, (hFA ha).resolve_left haA⟩ + exact (hQU (hFQ hzF)).2 (hint ⟨hz₁, hz₂⟩) + refine ⟨hFB hx, fun hxA => ?_⟩ + exact (hQU (hFQ hx)).2 (hint ⟨hxA, hFB hx⟩) + refine not_flat_compl_disc hS hns hΔ (fun x hx => ?_) hfl + have hxQ : x ∉ Q := fun h => hx (hQΔ h) + by_cases hxU : x ∈ Γ.U + · obtain ⟨s, hs, hxs⟩ := mem_iUnion₂.mp (hQc' ⟨hxU, hxQ⟩) + exact Or.inr (mem_iUnion₂.mpr ⟨s, hs, hxs⟩) + · obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem hxU + exact Or.inl (mem_iUnion₂.mpr ⟨r, hr, hxr⟩) + +/-- **Claim (2) of (6.4)** (pages 90–91), for a drawing. -/ +theorem exists_oArc_of_null (hS : IsClosedSurface S) (hns : ¬ IsSphere S) (hE : Γ.E.Nonempty) + (hrad : (PaintingOrDrawing.drawing Γ).IsRadialDrawing Γ') (hθ : 1 ≤ θ) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing Γ) Γ' θ T ins) {A B : Hypergraph S (Set S)} + (hsep : Γ.toHypergraph.IsSeparation A B) (hord : separationOrder A B < θ) + (hA : ∀ F : Set S, F ⊆ PaintingOrDrawing.underlying A → IsOArc F → IsNullHomotopicOArc F) : + ∃ F : Set S, IsOArc F ∧ F ⊆ PaintingOrDrawing.underlying B \ PaintingOrDrawing.underlying A ∧ + ¬ IsNullHomotopicOArc F := by + have : T2Space S := hS.2.1 + have hnull : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < 2 * θ + → IsNullHomotopicOArc C.U := + fun C hC hCs hl => null_of_short hd hC hCs hl + have hS₀V : (A ∩ B).vertexSet ⊆ Γ.V := fun x hx => hsep.left_le.vertexSet_subset hx.1 + have hflat := exists_flat_regions hS hE hrad hθ hnull hS₀V + (A ∩ B).vertexSet_finite hord + exact exists_oArc_of_flat_regions hS hns Γ hsep hflat hA + +end Main + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section6Pretangle.lean b/LeanPool/GraphMinor/GM11/Section6Pretangle.lean new file mode 100644 index 0000000000..880b352583 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section6Pretangle.lean @@ -0,0 +1,105 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +public import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Graph Minors XI, (6.2): a lemma on pretangles + +This file proves (6.2) of Graph Minors XI: if `(A, B)` is in a pretangle `𝒯`, then finitely many +members of `𝒯`, with their separating sets inside `V(A ∩ B)`, cannot cover `B`. The proof grows +`A` one step at a time and stays in `𝒯` by the first two tangle axioms, as the paper does. +-/ + +public section + +namespace GraphMinor.GM11 + +open Hypergraph GraphMinor.GM10 + +variable {α β : Type*} + +/-- The induction of (6.2): adding the members of a list to `(A, B)` one at a time stays in `𝒯`. -/ +private theorem exists_mem_of_list {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsPretangle G θ 𝒯) + {W : Set α} (hWfin : W.Finite) (hW : W.ncard < θ) + (L : List (Hypergraph α β × Hypergraph α β)) (hL : ∀ p ∈ L, p ∈ 𝒯) + (hLW : ∀ p ∈ L, (p.1 ∩ p.2).vertexSet ⊆ W) : + ∀ {A B : Hypergraph α β}, (A, B) ∈ 𝒯 → (A ∩ B).vertexSet ⊆ W → + ∃ A' B', (A', B') ∈ 𝒯 ∧ A.vertexSet ⊆ A'.vertexSet ∧ A.edgeSet ⊆ A'.edgeSet ∧ + (∀ p ∈ L, p.1.vertexSet ⊆ A'.vertexSet ∧ p.1.edgeSet ⊆ A'.edgeSet) := by + induction L with + | nil => + intro A B h _ + exact ⟨A, B, h, Set.Subset.rfl, Set.Subset.rfl, by simp⟩ + | cons p L ih => + intro A B h hABW + have hp : p ∈ 𝒯 := hL p (by simp) + have hsep₁ := h𝒯.isSeparation h + have hsep₂ : G.IsSeparation p.1 p.2 := h𝒯.isSeparation (A := p.1) (B := p.2) hp + have hsep : G.IsSeparation (A ∪ p.1) (B ∩ p.2) := hsep₁.union_inter hsep₂ + have hsubW : ((A ∪ p.1) ∩ (B ∩ p.2)).vertexSet ⊆ W := by + rintro v ⟨hv | hv, hvB, hvp⟩ + · exact hABW ⟨hv, hvB⟩ + · exact hLW p (by simp) ⟨hv, hvp⟩ + have hord : separationOrder (A ∪ p.1) (B ∩ p.2) < θ := + lt_of_le_of_lt (Set.ncard_le_ncard hsubW hWfin) hW + have hmem : (A ∪ p.1, B ∩ p.2) ∈ 𝒯 := by + rcases h𝒯.axiom1 hsep hord with h' | h' + · exact h' + · exact absurd hsep.union_eq (h𝒯.axiom2 h (show (p.1, p.2) ∈ 𝒯 from hp) h') + obtain ⟨A', B', hmem', hV, hE, hrest⟩ := ih (fun q hq => hL q (by simp [hq])) + (fun q hq => hLW q (by simp [hq])) hmem hsubW + refine ⟨A', B', hmem', fun v hv => hV (Or.inl hv), fun e he => hE (Or.inl he), ?_⟩ + intro q hq + rcases List.mem_cons.mp hq with rfl | hq + · exact ⟨fun v hv => hV (Or.inr hv), fun e he => hE (Or.inr he)⟩ + · exact hrest q hq + +/-- Graph Minors XI, (6.2) (page 89): +"(6.2) *Let $\mathscr{T}$ be a pretangle in a hypergraph $G$, and let $(A, B) \in \mathscr{T}$. Then +there do not exist $(A_1, B_2), \dots, (A_k, B_k) \in \mathscr{T}$ such that +$V(A_i \cap B_i) \subseteq V(A \cap B)$ ($1 \le i \le k$) and $B \subseteq A_1 \cup \cdots \cup +A_k$.*" +(Here $(A_1, B_2)$ in the paper is a misprint for $(A_1, B_1)$.) -/ +theorem theorem_6_2_proof {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsPretangle G θ 𝒯) + {A B : Hypergraph α β} (hAB : (A, B) ∈ 𝒯) + (L : List (Hypergraph α β × Hypergraph α β)) (hL : ∀ p ∈ L, p ∈ 𝒯) + (hLW : ∀ p ∈ L, (p.1 ∩ p.2).vertexSet ⊆ (A ∩ B).vertexSet) + (hV : ∀ v ∈ B.vertexSet, ∃ p ∈ L, v ∈ p.1.vertexSet) + (hE : ∀ e ∈ B.edgeSet, ∃ p ∈ L, e ∈ p.1.edgeSet) : False := by + have hsep := h𝒯.isSeparation hAB + have hWfin : (A ∩ B).vertexSet.Finite := + (G.vertexSet_finite.subset hsep.left_le.vertexSet_subset).subset Set.inter_subset_left + obtain ⟨A', B', hmem, hAV, hAE, hrest⟩ := exists_mem_of_list h𝒯 hWfin (h𝒯.order_lt hAB) L hL hLW + hAB subset_rfl + have hsep' := h𝒯.isSeparation hmem + have hEq : A' = G := by + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hsep'.left_le le_rfl ?_ ?_ + · refine hsep'.left_le.vertexSet_subset.antisymm ?_ + intro v hv + have hv' : v ∈ (A ∪ B).vertexSet := hsep.union_eq ▸ hv + rcases hv' with h | h + · exact hAV h + · obtain ⟨p, hp, hvp⟩ := hV v h + exact (hrest p hp).1 hvp + · refine hsep'.left_le.edgeSet_subset.antisymm ?_ + intro e he + have he' : e ∈ (A ∪ B).edgeSet := hsep.union_eq ▸ he + rcases he' with h | h + · exact hAE h + · obtain ⟨p, hp, hep⟩ := hE e h + exact (hrest p hp).2 hep + apply h𝒯.axiom2 hmem hmem hmem + rw [hEq, union_self, union_self] + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section7.lean b/LeanPool/GraphMinor/GM11/Section7.lean new file mode 100644 index 0000000000..24a45a37bb --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section7.lean @@ -0,0 +1,248 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import Mathlib.Topology.UnitInterval + +/-! +# Graph Minors XI, Section 7: some topological lemmas + +This file proves the point-set lemmas of Section 7 of Graph Minors XI that need no input on +surfaces: (7.7), which says that two subsets with connected, disjoint boundaries are nested, and +(7.10), which cuts an arc-connected set along a closed set with arc-connected boundary. + +The boundary `bd(X)` of the paper is `subBd X`, which is the frontier of `X`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +theorem subBd_eq_frontier (X : Set S) : subBd X = frontier X := by + rw [frontier_eq_closure_inter_closure, subBd, compl_eq_univ_sdiff] + +/-- A set with empty frontier, in a connected space, is empty or everything. -/ +private theorem eq_empty_or_univ_of_frontier [ConnectedSpace S] {X : Set S} + (h : frontier X = ∅) : X = ∅ ∨ X = univ := + isClopen_iff.mp (isClopen_iff_frontier_eq_empty.mpr h) + +/-- A preconnected set that misses `frontier Y`, and that meets the complement of `closure Y`, +misses `closure Y`. -/ +private theorem preconnected_subset_compl_closure {F Y : Set S} (hF : IsPreconnected F) + (hd : Disjoint F (frontier Y)) {z : S} (hzF : z ∈ F) (hz : z ∉ closure Y) : + Disjoint F (closure Y) := by + have hcover : F ⊆ interior Y ∪ (closure Y)ᶜ := by + intro x hx + by_cases hxc : x ∈ closure Y + · left + by_contra hxi + exact disjoint_left.mp hd hx ⟨hxc, hxi⟩ + · exact Or.inr hxc + have hdisj : Disjoint (interior Y) (closure Y)ᶜ := + disjoint_left.mpr fun x hx hx' => hx' (subset_closure (interior_subset hx)) + have hsub : F ⊆ (closure Y)ᶜ := by + have := hF.subset_right_of_subset_union isOpen_interior isClosed_closure.isOpen_compl hdisj + hcover ⟨z, hzF, hz⟩ + exact this + exact disjoint_left.mpr fun x hx hx' => hsub hx hx' + +/-- The main case of (7.7). -/ +private theorem nested_aux [ConnectedSpace S] {X Y : Set S} + (hX : IsPreconnected (frontier X)) (hY : IsPreconnected (frontier Y)) + (hne : (X ∩ Y).Nonempty) (hun : X ∪ Y ≠ univ) (hdisj : Disjoint (frontier X) (frontier Y)) + {z : S} (hzX : z ∈ frontier X) (hzY : z ∈ closure Yᶜ) : Y ⊆ X := by + have hzY' : z ∉ closure Y := fun h => disjoint_left.mp hdisj hzX ⟨h, by + rw [closure_compl] at hzY; exact hzY⟩ + have hF1 : Disjoint (frontier X) (closure Y) := + preconnected_subset_compl_closure hX hdisj hzX hzY' + by_contra hYX + obtain ⟨y, hyY, hyX⟩ := not_subset.mp hYX + obtain ⟨x, hxX, hxY⟩ := hne + have hclX : closure X = interior X ∪ frontier X := by + rw [frontier, union_sdiff_self, union_eq_self_of_subset_left interior_subset_closure] + have hclY : closure Y = interior Y ∪ frontier Y := by + rw [frontier, union_sdiff_self, union_eq_self_of_subset_left interior_subset_closure] + -- `frontier Y` is not empty, else `Y` would be everything. + have hYne : (frontier Y).Nonempty := by + rw [nonempty_iff_ne_empty] + intro h + rcases eq_empty_or_univ_of_frontier h with h | h + · exact (h ▸ hyY : y ∈ (∅ : Set S)) + · exact hun (by rw [h, union_univ]) + have hdis2 : Disjoint (interior X) (closure X)ᶜ := + disjoint_left.mpr fun x hx hx' => hx' (subset_closure (interior_subset hx)) + have hcover : frontier Y ⊆ interior X ∪ (closure X)ᶜ := by + intro w hw + by_cases hwc : w ∈ closure X + · left + by_contra hwi + exact disjoint_left.mp hdisj ⟨hwc, hwi⟩ hw + · exact Or.inr hwc + rcases (isPreconnected_iff_subset_of_disjoint.mp hY) _ _ isOpen_interior + isClosed_closure.isOpen_compl hcover (by + rw [disjoint_iff_inter_eq_empty.mp hdis2] + simp) with hin | hout + · -- `bd(Y)` lies inside `X`: the part of `closure Y` outside `X` is open and closed. + have hA : IsClopen (closure Y \ interior X) := by + refine ⟨isClosed_closure.sdiff isOpen_interior, ?_⟩ + have hEq : closure Y \ interior X = interior Y ∩ (closure X)ᶜ := by + ext w + constructor + · rintro ⟨hw1, hw2⟩ + have hw3 : w ∉ closure X := by + intro h + rw [hclX] at h + rcases h with h | h + · exact hw2 h + · exact disjoint_left.mp hF1 h hw1 + refine ⟨?_, hw3⟩ + rw [hclY] at hw1 + rcases hw1 with h | h + · exact h + · exact absurd (hin h) hw2 + · rintro ⟨hw1, hw2⟩ + exact ⟨interior_subset_closure hw1, fun h => hw2 (interior_subset_closure h)⟩ + rw [hEq] + exact isOpen_interior.inter isClosed_closure.isOpen_compl + rcases isClopen_iff.mp hA with h | h + · have : y ∈ closure Y \ interior X := + ⟨subset_closure hyY, fun h' => hyX (interior_subset h')⟩ + rw [h] at this + exact this + · have hx' : x ∈ closure Y \ interior X := h ▸ mem_univ x + have hxc : x ∈ closure X := subset_closure hxX + rw [hclX] at hxc + rcases hxc with h' | h' + · exact hx'.2 h' + · exact disjoint_left.mp hF1 h' hx'.1 + · -- `bd(Y)` lies outside `X`: the part of `closure Y` inside `X` is open and closed. + have hA : IsClopen (closure Y ∩ closure X) := by + refine ⟨isClosed_closure.inter isClosed_closure, ?_⟩ + have hEq : closure Y ∩ closure X = interior Y ∩ interior X := by + ext w + constructor + · rintro ⟨hw1, hw2⟩ + have hw3 : w ∈ interior X := by + rw [hclX] at hw2 + rcases hw2 with h | h + · exact h + · exact absurd hw1 (disjoint_left.mp hF1 h) + refine ⟨?_, hw3⟩ + rw [hclY] at hw1 + rcases hw1 with h | h + · exact h + · exact absurd (interior_subset_closure hw3) (hout h) + · rintro ⟨hw1, hw2⟩ + exact ⟨interior_subset_closure hw1, interior_subset_closure hw2⟩ + rw [hEq] + exact isOpen_interior.inter isOpen_interior + rcases isClopen_iff.mp hA with h | h + · have : x ∈ closure Y ∩ closure X := ⟨subset_closure hxY, subset_closure hxX⟩ + rw [h] at this + exact this + · have hy' : y ∈ closure Y ∩ closure X := h ▸ mem_univ y + have hyc := hy'.2 + rw [hclX] at hyc + rcases hyc with h' | h' + · exact hyX (interior_subset h') + · exact disjoint_left.mp hF1 h' hy'.1 + +/-- Graph Minors XI, (7.7) (page 94): "If $\Sigma$ is connected, $X, Y \subseteq \Sigma$ and +$bd(X)$, $bd(Y)$ are both arc-wise +connected, and $X \cap Y \ne \emptyset$, $X \cup Y \ne \Sigma$, and $bd(X) \cap bd(Y) = +\emptyset$, then either $X \subseteq Y$ or $Y \subseteq X$." We assume only that the two boundaries +are preconnected. -/ +theorem theorem_7_7_proof [ConnectedSpace S] {X Y : Set S} + (hX : IsPreconnected (subBd X)) (hY : IsPreconnected (subBd Y)) + (hne : (X ∩ Y).Nonempty) (hun : X ∪ Y ≠ univ) (hdisj : Disjoint (subBd X) (subBd Y)) : + X ⊆ Y ∨ Y ⊆ X := by + simp only [subBd_eq_frontier] at hX hY hdisj + -- There exists `z ∈ bd(X ∪ Y)`, since `∅ ≠ X ∪ Y ≠ Σ`. + have hfr : (frontier (X ∪ Y)).Nonempty := by + rw [nonempty_iff_ne_empty] + intro h + rcases eq_empty_or_univ_of_frontier h with h | h + · obtain ⟨x, hx, -⟩ := hne + have : x ∈ X ∪ Y := Or.inl hx + rw [h] at this + exact this + · exact hun h + obtain ⟨z, hz⟩ := hfr + rcases frontier_union_subset X Y hz with ⟨hz1, hz2⟩ | ⟨hz1, hz2⟩ + · exact Or.inr (nested_aux hX hY hne hun hdisj hz1 hz2) + · refine Or.inl (nested_aux hY hX ?_ ?_ hdisj.symm hz2 hz1) + · rwa [inter_comm] + · rwa [union_comm] + +/-- Graph Minors XI, (7.10) (page 95): "If $X \subseteq \Sigma$ is arc-wise connected, $Y \subseteq +\Sigma$ is closed, $bd(Y)$ is +arc-wise connected, and $\emptyset \ne bd(Y) \subseteq X$, then $X \cap Y$ is arc-wise +connected." -/ +theorem theorem_7_10_proof {X Y : Set S} (hX : IsPathConnected X) (hY : IsClosed Y) + (hb : IsPathConnected (subBd Y)) (hsub : subBd Y ⊆ X) : IsPathConnected (X ∩ Y) := by + have hbY : subBd Y ⊆ Y := fun x hx => hY.closure_subset_iff.mpr subset_rfl hx.1 + have hbin : subBd Y ⊆ X ∩ Y := subset_inter hsub hbY + obtain ⟨y₀, hy₀⟩ := hb.nonempty + refine ⟨y₀, hbin hy₀, fun {x} hx => ?_⟩ + suffices JoinedIn (X ∩ Y) x y₀ from this.symm + -- Follow a path in `X` from `x` to `y₀`, up to the first point where it leaves `Y`. + obtain ⟨γ, hγ⟩ := hX.joinedIn x hx.1 y₀ (hsub hy₀) + by_cases hstay : ∀ t, γ t ∈ Y + · exact ⟨γ, fun t => ⟨hγ t, hstay t⟩⟩ + · set B : Set I := {t | γ t ∉ Y} with hB + have hBne : B.Nonempty := not_forall.mp hstay + have hBopen : IsOpen B := hY.isOpen_compl.preimage γ.continuous + set α : I := sInf B with hα + have hbelow : ∀ t, t < α → γ t ∈ Y := by + intro t ht + by_contra h + exact not_lt.mpr (sInf_le h) ht + have hαcl : α ∈ closure B := by + exact csInf_mem_closure hBne (OrderBot.bddBelow B) + have hγα : γ α ∈ closure Yᶜ := by + have : γ '' closure B ⊆ closure (γ '' B) := image_closure_subset_closure_image γ.continuous + refine closure_mono ?_ (this ⟨α, hαcl, rfl⟩) + rintro _ ⟨t, ht, rfl⟩ + exact ht + have hαY : γ α ∈ Y := by + by_cases h0 : α = 0 + · rw [h0, γ.source] + exact hx.2 + · have hlt : (0 : I) < α := bot_lt_iff_ne_bot.mpr h0 + have hcl : α ∈ closure (Iio α) := by + rw [closure_Iio' (show (Iio α).Nonempty from ⟨0, hlt⟩)] + exact self_mem_Iic + have : γ '' closure (Iio α) ⊆ closure (γ '' Iio α) := + image_closure_subset_closure_image γ.continuous + refine hY.closure_subset_iff.mpr ?_ (this ⟨α, hcl, rfl⟩) + rintro _ ⟨t, ht, rfl⟩ + exact hbelow t ht + have hαb : γ α ∈ subBd Y := ⟨subset_closure hαY, by + rwa [← compl_eq_univ_sdiff]⟩ + have hj1 : JoinedIn (X ∩ Y) x (γ α) := by + refine ⟨⟨⟨fun t => γ (α * t), ?_⟩, ?_, ?_⟩, fun t => ⟨hγ _, ?_⟩⟩ + · exact γ.continuous.comp (continuous_const.mul continuous_id) + · simp + · simp + · change γ (α * t) ∈ Y + rcases (unitInterval.mul_le_left (x := α) (y := t)).lt_or_eq with h | h + · exact hbelow _ h + · rw [h] + exact hαY + have hj2 : JoinedIn (X ∩ Y) (γ α) y₀ := (hb.joinedIn _ hαb _ hy₀).mono hbin + exact hj1.trans hj2 + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section79.lean b/LeanPool/GraphMinor/GM11/Section79.lean new file mode 100644 index 0000000000..77c6efdcca --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section79.lean @@ -0,0 +1,170 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Nice73 + +/-! +# Graph Minors XI, (7.9) + +`theorem_7_9` is (7.9) of the paper, for closed sets, by way of `nice_73`. The paper says that at +most +one disc in `Σ` bounded by an `O`-arc misses a given point, since `Σ` is connected. This is +`disc_unique`. Two +discs with the same boundary either have the same interior, or their union is open as well as +closed, by the +two sides of the `O`-arc. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [ConnectedSpace S] + +/-- At most one disc bounded by an `O`-arc misses a given point. -/ +theorem disc_unique (hS : IsClosedSurface S) {F Δ₁ Δ₂ : Set S} (hF : IsOArc F) + (h₁ : IsClosedDisc Δ₁) + (h₂ : IsClosedDisc Δ₂) (hb₁ : discBd Δ₁ = F) (hb₂ : discBd Δ₂ = F) {z : S} (hz₁ : z ∉ Δ₁) + (hz₂ : z ∉ Δ₂) : + Δ₁ = Δ₂ := by + classical + have hT2 : T2Space S := hS.2.1 + have hi₁ : IsOpen (Δ₁ \ F) := by + have := interior_eq_sdiff_discBd hS h₁ + rw [hb₁] at this + exact this ▸ isOpen_interior + have hi₂ : IsOpen (Δ₂ \ F) := by + have := interior_eq_sdiff_discBd hS h₂ + rw [hb₂] at this + exact this ▸ isOpen_interior + have hp₁ : IsPreconnected (Δ₁ \ F) := by + have := (isOpenDisc_interior hS h₁).isPathConnected.isConnected.isPreconnected + rwa [hb₁] at this + have hp₂ : IsPreconnected (Δ₂ \ F) := by + have := (isOpenDisc_interior hS h₂).isPathConnected.isConnected.isPreconnected + rwa [hb₂] at this + have hF₁ : F ⊆ Δ₁ := hb₁ ▸ discBd_subset Δ₁ + have hF₂ : F ⊆ Δ₂ := hb₂ ▸ discBd_subset Δ₂ + have hc₁ := h₁.isCompact.isClosed + have hc₂ := h₂.isCompact.isClosed + -- A preconnected set that misses `F` and meets the inside of a disc lies in it. + have hin : ∀ {Δ A : Set S}, IsClosed Δ → IsOpen (Δ \ F) → IsPreconnected A → Disjoint A F → + (A ∩ (Δ \ F)).Nonempty → A ⊆ Δ \ F := by + intro Δ A hc hi hA hdis hne + refine hA.subset_left_of_subset_union hi hc.isOpen_compl + (disjoint_left.mpr fun x hx hx' => hx' hx.1) (fun x hx => ?_) hne + by_cases hxΔ : x ∈ Δ + · exact Or.inl ⟨hxΔ, disjoint_left.mp hdis hx⟩ + · exact Or.inr hxΔ + by_cases hmeet : ((Δ₁ \ F) ∩ (Δ₂ \ F)).Nonempty + · have hs₁ := hin hc₂ hi₂ hp₁ (disjoint_left.mpr fun x hx => hx.2) hmeet + have hs₂ := hin hc₁ hi₁ hp₂ (disjoint_left.mpr fun x hx => hx.2) (by rwa [inter_comm]) + apply subset_antisymm + · intro x hx + by_cases hxF : x ∈ F + · exact hF₂ hxF + · exact (hs₁ ⟨hx, hxF⟩).1 + · intro x hx + by_cases hxF : x ∈ F + · exact hF₁ hxF + · exact (hs₂ ⟨hx, hxF⟩).1 + exfalso + have hlcl : ∀ {Δ y}, IsClosedDisc Δ → discBd Δ = F → y ∈ F → y ∈ closure (Δ \ F) := by + intro Δ y hd hb hy + have := discBd_subset_closure hd (hb ▸ hy) + rwa [hb] at this + have hopen : IsOpen (Δ₁ ∪ Δ₂) := by + rw [isOpen_iff_mem_nhds] + intro y hy + by_cases hyF : y ∈ F + · obtain ⟨a, haF, hay⟩ : ∃ a ∈ F, a ≠ y := + ((infinite_of_isOArc hF).sdiff (finite_singleton y)).nonempty.imp fun _ h => ⟨h.1, h.2⟩ + obtain ⟨D, hDU, hDV⟩ := exists_loop_drawing hF haF + have hyV : y ∉ D.V := by + rw [hDV] + exact fun h => hay h.symm + obtain ⟨e, he, hye⟩ := D.exists_edge_of_mem (hDU ▸ hyF) hyV + obtain ⟨W, A₁, A₂, -, -, hWo, hyW, -, hcov, hA₁, hA₂, hdis₁, hdis₂, -⟩ := + exists_edge_sides_split hS D he hye + rw [hDU] at hcov hdis₁ hdis₂ + have hside : ∀ {Δ : Set S}, IsClosed Δ → IsOpen (Δ \ F) → y ∈ closure (Δ \ F) → + (A₁ ⊆ Δ \ F ∧ (A₁ ∩ (Δ \ F)).Nonempty) ∨ (A₂ ⊆ Δ \ F ∧ (A₂ ∩ (Δ \ F)).Nonempty) := by + intro Δ hc hi hcl + obtain ⟨q, hqW, hqi⟩ := mem_closure_iff.mp hcl W hWo hyW + rcases hcov ⟨hqW, hqi.2⟩ with hq | hq + · exact Or.inl ⟨hin hc hi hA₁ hdis₁ ⟨q, hq, hqi⟩, q, hq, hqi⟩ + · exact Or.inr ⟨hin hc hi hA₂ hdis₂ ⟨q, hq, hqi⟩, q, hq, hqi⟩ + have hsub : W ⊆ Δ₁ ∪ Δ₂ := by + intro x hx + by_cases hxF : x ∈ F + · exact Or.inl (hF₁ hxF) + · rcases hside hc₁ hi₁ (hlcl h₁ hb₁ hyF) with ⟨s₁, n₁⟩ | ⟨s₁, n₁⟩ <;> + rcases hside hc₂ hi₂ (hlcl h₂ hb₂ hyF) with ⟨s₂, n₂⟩ | ⟨s₂, n₂⟩ + · obtain ⟨z, hz, _⟩ := n₁ + exact (hmeet ⟨z, s₁ hz, s₂ hz⟩).elim + · rcases hcov ⟨hx, hxF⟩ with h' | h' + · exact Or.inl (s₁ h').1 + · exact Or.inr (s₂ h').1 + · rcases hcov ⟨hx, hxF⟩ with h' | h' + · exact Or.inr (s₂ h').1 + · exact Or.inl (s₁ h').1 + · obtain ⟨z, hz, _⟩ := n₁ + exact (hmeet ⟨z, s₁ hz, s₂ hz⟩).elim + exact Filter.mem_of_superset (hWo.mem_nhds hyW) hsub + · rcases hy with hy | hy + · exact Filter.mem_of_superset (hi₁.mem_nhds ⟨hy, hyF⟩) fun x hx => Or.inl hx.1 + · exact Filter.mem_of_superset (hi₂.mem_nhds ⟨hy, hyF⟩) fun x hx => Or.inr hx.1 + have hclopen : IsClopen (Δ₁ ∪ Δ₂) := ⟨hc₁.union hc₂, hopen⟩ + have hne : (Δ₁ ∪ Δ₂).Nonempty := by + obtain ⟨y, hy⟩ := (infinite_of_isOArc hF).nonempty + exact ⟨y, Or.inl (hF₁ hy)⟩ + have := hclopen.eq_univ hne + have hzm : z ∈ Δ₁ ∪ Δ₂ := this ▸ mem_univ z + exact hzm.elim hz₁ hz₂ + +/-- **(7.9)** of Graph Minors XI (page 95): "If $\Sigma$ is connected, $X, Y \subseteq \Sigma$ are +simply-connected, and $X \cap Y \ne +\emptyset$ is arc-wise connected and nice, and $X \cup Y \ne \Sigma$, then $X \cap Y$ is +simply-connected." We ask that +`X ∩ Y` be closed, for `nice_73`. -/ +theorem theorem_7_9_proof (hS : IsClosedSurface S) + {Γ : Drawing S} {X Y : Set S} (hXs : IsSimplyConnectedSet X) (hYs : IsSimplyConnectedSet Y) + (hc : IsClosed (X ∩ Y)) (hn : IsGammaNice Γ (X ∩ Y)) (hp : IsPathConnected (X ∩ Y)) + (hu : X ∪ Y ≠ univ) : IsSimplyConnectedSet (X ∩ Y) := by + have hT2 : T2Space S := hS.2.1 + refine ⟨hp, fun φ hφ => ?_⟩ + by_contra hnot + obtain ⟨F, hF, hFφ, hFn⟩ := nice_73 S hS Γ _ hc hn φ hφ hnot + obtain ⟨z, hz⟩ := (ne_univ_iff_exists_notMem _).mp hu + have hbounded : ∀ {T : Set S}, IsSimplyConnectedSet T → F ⊆ T → ∃ Δ : Set S, Δ ⊆ T + ∧ IsClosedDisc Δ ∧ + discBd Δ = F := by + intro T hT hFT + have hnull : IsNullHomotopicOArcIn T F := by + obtain ⟨ψ⟩ := id hF + refine ⟨ψ, hT.2 _ ?_⟩ + rintro _ ⟨x, rfl⟩ + exact hFT (ψ x).2 + obtain ⟨Δ, hΔ, hd, hb⟩ := theorem_7_2_proof hS hF hFT hnull + refine ⟨Δ, hΔ, hd, ?_⟩ + rw [subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hS hd] at hb + exact hb + obtain ⟨Δ₁, h₁, hd₁, hb₁⟩ := hbounded hXs ((hFφ.trans hφ).trans inter_subset_left) + obtain ⟨Δ₂, h₂, hd₂, hb₂⟩ := hbounded hYs ((hFφ.trans hφ).trans inter_subset_right) + have heq := disc_unique hS hF hd₁ hd₂ hb₁ hb₂ (fun h => hz (Or.inl (h₁ h))) fun h => hz (Or.inr + (h₂ h)) + exact hFn (isNullHomotopicOArcIn_of_subset_disc hF (subset_inter h₁ (heq ▸ h₂)) hd₁ + (hb₁ ▸ discBd_subset Δ₁)) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section7b.lean b/LeanPool/GraphMinor/GM11/Section7b.lean new file mode 100644 index 0000000000..388cf5195f --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section7b.lean @@ -0,0 +1,154 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Epstein +public import LeanPool.GraphMinor.GM11.Section7 +public import LeanPool.GraphMinor.GM11.Section6 +public import LeanPool.GraphMinor.GM11.Section3 +public import LeanPool.GraphMinor.Surface.Disc + +/-! +# Graph Minors XI, Section 7: lemmas on simply-connected sets + +`theorem_7_2`, `theorem_7_8` and `theorem_7_11` are (7.2), (7.8) and (7.11) of the paper. The last +two +rest on (3.1), so they carry its local hypothesis `IsLocalDeformationRetract`: see `theorem_3_1` and +the correction to (3.1) in `corrections/GM11.md`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The compact-surface case of Graph Minors XI, (7.1), page 93. A null-homotopic `O`-arc +disjoint from the boundary of a connected compact surface bounds a disc in that surface. +The paper cites D. B. A. Epstein, *Curves on 2-manifolds and isotopies*, Acta Math. 115 (1966) +83–107, Theorem 1.7, which applies to connected triangulable 2-manifolds. -/ +theorem theorem_7_1_proof [ConnectedSpace S] (hS : IsSurface S) + {F : Set S} (hF : IsOArc F) (hbd : Disjoint F (bd S)) (hn : IsNullHomotopicOArcIn univ F) : + ∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F := by + obtain ⟨Δ, -, hd, hb⟩ := (epstein S univ F hS inferInstance hF (subset_univ F) hbd).1 hn + exact ⟨Δ, hd, hb⟩ + +/-- Robertson and Seymour, Graph Minors XI, (7.2), page 93. An `O`-arc null-homotopic in `Z` +bounds a disc in `Z`. This is the closed-surface form of the first clause of +`GraphMinor.Surface.EpsteinStatement`. -/ +theorem theorem_7_2_proof [ConnectedSpace S] (hS : IsClosedSurface S) + {Z F : Set S} (hF : IsOArc F) (hFZ : F ⊆ Z) (hn : IsNullHomotopicOArcIn Z F) : + ∃ Δ : Set S, Δ ⊆ Z ∧ IsClosedDisc Δ ∧ subBd Δ = F := by + have : T2Space S := hS.2.1 + have hbd : Disjoint F (bd S) := disjoint_left.mpr fun x _ hx => hx (hS.2.2 x) + obtain ⟨Δ, hΔ, hd, hb⟩ := (epstein S Z F (IsClosedSurface.isSurface hS) inferInstance hF hFZ + hbd).1 hn + refine ⟨Δ, hΔ, hd, ?_⟩ + rw [subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hS hd, hb] + +/-- A curve null-homotopic in `Y ⊆ Z`, homotopic in `Z` to a given curve. -/ +theorem null_of_homotopic {Y Z : Set S} (hYZ : Y ⊆ Z) {φ φ' : C(Circle, S)} + (hh : ClosedCurvesHomotopicIn Z φ φ') (hn : ClosedCurveIsNullHomotopicIn Y φ') : + ClosedCurveIsNullHomotopicIn Z φ := by + obtain ⟨c, hc, hh'⟩ := hn + exact ⟨c, hYZ hc, hh.trans (hh'.mono hYZ)⟩ + +/-- The conclusion of (3.1): each curve in `X ∪ Y` is homotopic in `X ∪ Y` to a curve in `Y`. -/ +def CanPush (X Y : Set S) : Prop := + ∀ φ : C(Circle, S), range φ ⊆ X ∪ Y → + ∃ φ' : C(Circle, S), range φ' ⊆ Y ∧ ClosedCurvesHomotopicIn (X ∪ Y) φ φ' + +/-- **(7.8)** of Graph Minors XI (page 94): "If $X, Y \subseteq \Sigma$ are closed and +simply-connected and $X \cap Y \ne \emptyset$ is +arc-wise connected, then $X \cup Y$ is simply-connected." The hypothesis `hpush` is the +conclusion of (3.1). `theorem_3_1_proof` gives it for a tame intersection, and `nice_31` for nice +sets. -/ +theorem theorem_7_8_proof {X Y : Set S} (hsX : IsSimplyConnectedSet X) + (hsY : IsSimplyConnectedSet Y) (hL : IsPathConnected (X ∩ Y)) + (hpush : CanPush X Y) : IsSimplyConnectedSet (X ∪ Y) := by + obtain ⟨z, hz⟩ := hL.nonempty + refine ⟨hsX.1.union hsY.1 ⟨z, hz⟩, fun φ hφ => ?_⟩ + obtain ⟨φ', hr, hh⟩ := hpush φ hφ + exact null_of_homotopic subset_union_right hh (hsY.2 φ' hr) + +/-- `X` with the discs of the list `L` added. -/ +def withDiscs (X : Set S) (L : List (Set S)) : Set S := X ∪ ⋃ Y ∈ L, Y + +/-- **(7.11)** of Graph Minors XI (page 95): "If $X \subseteq \Sigma$ is closed and arc-wise +connected and $Y_1, \dots, Y_r \subseteq +\Sigma$ are closed discs with boundary in $X$, and $Z = X \cup Y_1 \cup \dots \cup Y_r$, and +every continuous $\phi \colon S^1 \to X$ is null-homotopic in $Z$, then every continuous +$\phi \colon S^1 \to Z$ is null-homotopic in $Z$." +We also record that `Z` is arc-wise connected, as the induction shows. The hypothesis `hpush` is the +conclusion of (3.1), for the steps of the paper's induction. -/ +theorem theorem_7_11_proof (hS : IsClosedSurface S) {X : Set S} (hX : IsClosed X) + (hp : IsPathConnected X) {L : List (Set S)} (hL : ∀ Y ∈ L, IsClosedDisc Y ∧ frontier Y ⊆ X) + (hpush : ∀ Y L', (Y :: L') <:+ L → IsPathConnected (Y ∩ withDiscs X L') → + CanPush Y (withDiscs X L')) + (hnull : ∀ φ : C(Circle, S), range φ ⊆ X → + ClosedCurveIsNullHomotopicIn (withDiscs X L) φ) : + IsSimplyConnectedSet (withDiscs X L) := by + have : T2Space S := hS.2.1 + have key : ∀ L', L' <:+ L → IsClosed (withDiscs X L') ∧ IsPathConnected (withDiscs X L') ∧ + ∀ φ : C(Circle, S), range φ ⊆ withDiscs X L' → + ClosedCurveIsNullHomotopicIn (withDiscs X L) φ := by + intro L' + induction L' with + | nil => + intro _ + have heq : withDiscs X [] = X := by simp [withDiscs] + rw [heq] + exact ⟨hX, hp, hnull⟩ + | cons Y L' ih => + intro hs + obtain ⟨hc, hpc, hn⟩ := ih ((List.suffix_cons Y L').trans hs) + obtain ⟨hd, hf⟩ := hL Y (hs.subset List.mem_cons_self) + have heq : withDiscs X (Y :: L') = Y ∪ withDiscs X L' := by + ext x + simp only [withDiscs, List.mem_cons, iUnion_iUnion_eq_or_left, mem_union] + tauto + have hYc : IsClosed Y := hd.isCompact.isClosed + have hfs : frontier Y ⊆ withDiscs X L' := hf.trans subset_union_left + have hfp : IsPathConnected (frontier Y) := by + rw [IsClosedDisc.frontier_eq_discBd hS hd] + obtain ⟨f⟩ := IsClosedDisc.isOArc_discBd hd + have : discBd Y = range fun x : Circle => (f x).1 := by + ext y + constructor + · intro hy + obtain ⟨x, hx⟩ := f.surjective ⟨y, hy⟩ + exact ⟨x, by simp [hx]⟩ + · rintro ⟨x, rfl⟩ + exact (f x).2 + rw [this] + exact isPathConnected_range (by fun_prop) + have hcap : IsPathConnected (withDiscs X L' ∩ Y) := + theorem_7_10_proof hpc hYc (subBd_eq_frontier Y ▸ hfp) (subBd_eq_frontier Y ▸ hfs) + rw [inter_comm] at hcap + rw [heq] + refine ⟨hYc.union hc, ?_, fun φ hφ => ?_⟩ + · obtain ⟨z, hz⟩ := hcap.nonempty + exact (IsClosedDisc.isSimplyConnectedSet hd).1.union hpc ⟨z, hz⟩ + · obtain ⟨φ', hr, hh⟩ := hpush Y L' hs hcap φ hφ + have hsub : Y ∪ withDiscs X L' ⊆ withDiscs X L := by + rw [← heq] + intro x hx + rcases hx with hx | hx + · exact Or.inl hx + · obtain ⟨W, hW, hxW⟩ := mem_iUnion₂.mp hx + exact Or.inr (mem_iUnion₂.mpr ⟨W, hs.subset hW, hxW⟩) + obtain ⟨c, hc', hh'⟩ := hn φ' hr + exact ⟨c, hc', (hh.mono hsub).trans hh'⟩ + exact ⟨(key L List.suffix_rfl).2.1, (key L List.suffix_rfl).2.2⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section8.lean b/LeanPool/GraphMinor/GM11/Section8.lean new file mode 100644 index 0000000000..a89859126d --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section8.lean @@ -0,0 +1,205 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section5c + +/-! +# Graph Minors XI, Section 8: the regions in `ins(W)` + +`theorem_8_2` is statement (8.2): three closed walks of length `< 2θ` do not cover `Σ` by their sets +`ins(W)`. The proof is the paper's. The set `Z` of regions in `ins(W)` is small with respect to the +weighting `(V(Γ), 2θ)`, and (5.5) applies. The paper derives "small" from (4.5). We use (5.2) and +(4.4) +instead: if the complement of `Z` were small, then the region outside `ins(W)` would be captured. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A list has at most as many distinct entries as its length. -/ +theorem ncard_mem_list_le {α : Type*} (l : List α) : {x | x ∈ l}.ncard ≤ l.length := by + classical + have h : {x | x ∈ l} = (l.toFinset : Set α) := by + ext x + simp + rw [h, ncard_coe_finset] + exact List.toFinset_card_le l + +/-- A circuit has as many vertices as edges. -/ +theorem IsCircuit.length_le_ncard_V {C : Drawing S} (hC : C.IsCircuit) : + C.length ≤ C.V.ncard := by + classical + obtain ⟨u, W, ⟨hnd, hed⟩, hpos, hV, hE⟩ := hC + have hl : C.length = W.edges.length := by + rw [Drawing.length, hE] + have h : {e | e ∈ W.edges} = (W.edges.toFinset : Set (Set S)) := by + ext x + simp + rw [h, ncard_coe_finset, List.toFinset_card_of_nodup hed] + have hsub : (W.support.tail.toFinset : Set S) ⊆ C.V := by + intro x hx + rw [hV] + exact List.mem_of_mem_tail (by simpa using hx) + have hle := ncard_le_ncard hsub C.finite_V + rw [ncard_coe_finset, List.toFinset_card_of_nodup hnd, List.length_tail, + length_support] at hle + rw [hl] + simpa [GraphWalk.length] using hle + +variable [T2Space S] {Γ : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + +omit [T2Space S] in +/-- `(V(Γ), 2θ)` is a weighting of `Γ`. -/ +theorem isWeighting_vertices (hk : 1 ≤ k) : IsWeighting Γ k Γ.V k where + subset := subset_rfl + one_le := hk + le_ncard C hC hCs hl := by + have heq : Γ.V ∩ C.V = C.V := inter_eq_right.mpr hCs.1 + rw [heq] + exact hl.trans (IsCircuit.length_le_ncard_V hC) + +variable [ConnectedSpace S] (hS : IsClosedSurface S) + (hs : IsSlope Γ k ins) +include hS hs + +/-- The regions in `ins(W)` form a small set, for a closed walk `W` of length `< 2θ` (Graph Minors +XI, +proof of (8.2), page 96). -/ +theorem small_of_walk {u : S} (W : GraphWalk Γ.toGraph u u) (hW : W.length < k) : + IsSmall Γ ins k Γ.V k (insideRegions Γ (insWalk ins Γ W)) := by + have hk := hs.two_le + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hw : IsWeighting Γ k Γ.V k := isWeighting_vertices (by omega) + set D := walkDrawing Γ W with hD + set X := insWalk ins Γ W with hX + set Z := insideRegions Γ X with hZ + have hDs : D.IsSubdrawing Γ := walkDrawing_isSubdrawing Γ W + have hconfD : IsConfined k D := by + intro C _ hCs + have hle : C.length ≤ W.edges.length := by + refine (ncard_le_ncard ?_ (W.edges.finite_toSet)).trans (ncard_mem_list_le W.edges) + intro e he + have h := hCs.2 he + rw [hD, walkDrawing_E] at h + exact h + exact lt_of_le_of_lt hle hW + have hXeq : X = D.U ∪ ⋃ C ∈ {C : Drawing S | C.IsCircuit ∧ C.IsSubdrawing D}, ins C := rfl + have hfinC : {C : Drawing S | C.IsCircuit ∧ C.IsSubdrawing D}.Finite := by + refine Set.Finite.of_finite_image (f := fun C : Drawing S => (C.V, C.E)) ?_ ?_ + · refine (D.finite_V.finite_subsets.prod D.finite_edges.finite_subsets).subset ?_ + rintro _ ⟨C, ⟨-, hs'⟩, rfl⟩ + exact ⟨hs'.1, hs'.2⟩ + · intro C _ C' _ h + exact Drawing.ext_of_V_E (congrArg Prod.fst h) (congrArg Prod.snd h) + have hXcl : IsClosed X := by + rw [hXeq] + refine D.isClosed_U.union (hfinC.isClosed_biUnion fun C hC => ?_) + exact (hs.isClosedDisc C hC.1 (hC.2.trans hDs) (hconfD C hC.1 hC.2)).isClosed + -- A point in the closures of a region in `X` and a region not in `X` lies on `U(W)`. + have hpt : ∀ r ∈ Z, ∀ s ∈ Γ.R, s ∉ Z → ∀ p, p ∈ closure r → p ∈ closure s → p ∈ D.U := by + intro r hr s hsR hsn p hpr hps + have hpX : p ∈ X := hXcl.closure_subset_iff.mpr hr.2 hpr + rw [hXeq] at hpX + rcases hpX with h | h + · exact h + · obtain ⟨C, ⟨hC, hCs⟩, hpC⟩ := mem_iUnion₂.mp h + have hl := hconfD C hC hCs + by_contra hpU + have hpCU : p ∉ C.U := fun h' => hpU (hCs.U_subset h') + have hin := region_subset_ins_of_closure hs hC (hCs.trans hDs) hl hsR hps hpC hpCU + exact hsn ⟨hsR, fun x hx => Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, hCs⟩, hin hx⟩)⟩ + have hN : (boundaryDrawing Γ Z).IsSubdrawing D := by + constructor + · intro v hv + obtain ⟨⟨r, hr, hir⟩, s, ⟨hsR, hsn⟩, his⟩ := (mem_boundaryDrawing_V hS).mp hv + have hvU := hpt r hr s hsR hsn v hir.2.2 his.2.2 + by_contra hvD + obtain ⟨g, hg, hvg⟩ := D.exists_edge_of_mem hvU hvD + exact ((hDs.2 hg).2.1 hvg).2 hir.1 + · intro e he + obtain ⟨⟨r, hr, hir⟩, s, ⟨hsR, hsn⟩, -, -, p, hpe, hps⟩ := mem_boundaryDrawing_E.mp he + have her := edge_subset_closure_of_incident hS hir.1 hr.1 hir.2.2 + have hpU := hpt r hr s hsR hsn p (her hpe) hps + have hpV : p ∉ D.V := fun h => (hir.1.2.1 hpe).2 (hDs.1 h) + obtain ⟨g, hg, hpg⟩ := D.exists_edge_of_mem hpU hpV + rw [Γ.edge_eq_of_mem hir.1 (hDs.2 hg) hpe hpg] + exact hg + have hlt : (Γ.V ∩ (boundaryDrawing Γ Z).V).ncard < k := by + have h₁ : (Γ.V ∩ (boundaryDrawing Γ Z).V).ncard ≤ D.V.ncard := + ncard_le_ncard (fun x hx => hN.1 hx.2) D.finite_V + have h₂ : D.V.ncard ≤ max 1 W.length := by + rw [hD, walkDrawing_V] + cases hW' : W with + | nil h => + have : {x | x ∈ (GraphWalk.nil h).support} = ({u} : Set S) := by + ext x + simp + rw [this, ncard_singleton] + exact le_max_left _ _ + | @cons a y b e hl r => + have heq : {x | x ∈ (GraphWalk.cons hl r).support} = {x | x ∈ r.support} := by + ext x + constructor + · intro hx + rcases List.mem_cons.mp hx with rfl | hx + · exact r.end_mem_support + · exact hx + · exact fun hx => List.mem_cons_of_mem _ hx + rw [heq] + refine (ncard_mem_list_le r.support).trans ?_ + rw [length_support] + simp [GraphWalk.length] + have h₃ : max 1 W.length < k := max_lt (by omega) hW + omega + have hZR : Z ⊆ Γ.R := fun r h => h.1 + refine (theorem_5_2_proof hS hs hw hZR hlt).1.resolve_right fun hsm => ?_ + -- Outside `ins(W)` there is a region of `Γ`, which then would be captured. + have hr₀ := theorem_4_4_proof hS hs hDs hconfD + obtain ⟨y, hy, hyU⟩ := exists_notMem_U (Γ := Γ) hS (region_isOpen hr₀) (region_nonempty hr₀) + obtain ⟨s, hsR, hys⟩ := exists_region_of_notMem hyU + have hsZ : s ∉ Z := fun h => hy.2 (h.2 hys) + obtain ⟨C, hC, hCs, -, hin⟩ := hsm.2 s ⟨hsR, hsZ⟩ + rw [boundaryDrawing_compl hZR] at hCs + refine hy.2 ?_ + have hmem : y ∈ ins C := hin hys + exact Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, hCs.trans hN⟩, hmem⟩) + +/-- **(8.2)** of Graph Minors XI (page 96): +"(8.2) *Let $W_1, W_2, W_3$ be closed walks of $\Gamma$, each of length $<2\theta$. Then there is a +region $r$ of $\Gamma$ with $r \notin \mathrm{ins}(W_1) \cup \mathrm{ins}(W_2) \cup +\mathrm{ins}(W_3)$.*" +(Here $r \notin \dots$ in the paper means $r \not\subseteq \dots$; we prove that $r$ lies in none of +the three, which is what the paper's proof gives.) -/ +theorem theorem_8_2_proof {u₁ u₂ u₃ : S} (W₁ : GraphWalk Γ.toGraph u₁ u₁) + (W₂ : GraphWalk Γ.toGraph u₂ u₂) (W₃ : GraphWalk Γ.toGraph u₃ u₃) (h₁ : W₁.length < k) + (h₂ : W₂.length < k) (h₃ : W₃.length < k) : + ∃ r ∈ Γ.R, ¬ r ⊆ insWalk ins Γ W₁ ∧ ¬ r ⊆ insWalk ins Γ W₂ ∧ ¬ r ⊆ insWalk ins Γ W₃ := by + have hk := hs.two_le + have hw : IsWeighting Γ k Γ.V k := isWeighting_vertices (by omega) + have hne := theorem_5_5_proof hS hs hw (small_of_walk hS hs W₁ h₁) + (small_of_walk hS hs W₂ h₂) (small_of_walk hS hs W₃ h₃) + by_contra hno + push Not at hno + refine hne (subset_antisymm ?_ fun r hr => ?_) + · refine union_subset (union_subset ?_ ?_) ?_ <;> exact fun r h => h.1 + · by_cases a₁ : r ⊆ insWalk ins Γ W₁ + · exact Or.inl (Or.inl ⟨hr, a₁⟩) + · by_cases a₂ : r ⊆ insWalk ins Γ W₂ + · exact Or.inl (Or.inr ⟨hr, a₂⟩) + · exact Or.inr ⟨hr, hno r hr a₁ a₂⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section81.lean b/LeanPool/GraphMinor/GM11/Section81.lean new file mode 100644 index 0000000000..2cfc2c5f46 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section81.lean @@ -0,0 +1,345 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.CollarCut +public import LeanPool.GraphMinor.GM11.Restraints +public import LeanPool.GraphMinor.GM11.PerimeterWalk +public import LeanPool.GraphMinor.Surface.Crossing + +/-! +# Graph Minors XI, (8.1) + +`theorem_8_1` is (8.1) of the paper: two arc-wise connected subsets of `X` whose ends alternate +along a +perimeter walk of `X` must meet. We state it for times along the collar of the perimeter walk, so it +covers +the vertices of the walk and the other points of `bd(X)`. + +The proof in the paper joins the four points to a new point outside `X`, and uses that `O`-arcs in a +disc do +not cross once. We use the same fact in the form `disc_crossing`, for the disc bounded by a circle +of the +collar (`exists_disc_of_collar`), inside the sphere obtained from an open disc around `X`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval OnePoint + +universe u + +/-- A connected set that misses an `O`-arc in a sphere lies in one of the two discs bounded by the +`O`-arc. -/ +theorem exists_disc_of_collar {S : Type u} [TopologicalSpace S] + (hS : IsClosedSurface S) + (hsph : IsSphere S) {W J : Set S} (hJ : IsOArc J) (hWp : IsPreconnected W) + (hWJ : Disjoint W J) : + ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = J ∧ W ⊆ Δ := by + have hT2 : T2Space S := hS.2.1 + obtain ⟨Δ₁, Δ₂, -, hΔ₁, hΔ₂, hb₁, hb₂, hcup, hcap, -, -⟩ := sphere_disc S hsph J hJ + have hint₁ : IsOpen (Δ₁ \ J) := by + have := interior_eq_sdiff_discBd hS hΔ₁ + rw [hb₁] at this + exact this ▸ isOpen_interior + have hint₂ : IsOpen (Δ₂ \ J) := by + have := interior_eq_sdiff_discBd hS hΔ₂ + rw [hb₂] at this + exact this ▸ isOpen_interior + have hcover : W ⊆ (Δ₁ \ J) ∪ (Δ₂ \ J) := by + intro x hx + have hxJ : x ∉ J := disjoint_left.mp hWJ hx + have : x ∈ Δ₁ ∪ Δ₂ := hcup ▸ mem_univ x + exact this.elim (fun h => Or.inl ⟨h, hxJ⟩) fun h => Or.inr ⟨h, hxJ⟩ + have hdis : Disjoint (Δ₁ \ J) (Δ₂ \ J) := disjoint_left.mpr fun x h₁ h₂ => h₁.2 + (hcap ▸ ⟨h₁.1, h₂.1⟩) + rcases hWp.subset_or_subset hint₁ hint₂ hdis hcover with h | h + · exact ⟨Δ₁, hΔ₁, hb₁, fun x hx => (h hx).1⟩ + · exact ⟨Δ₂, hΔ₂, hb₂, fun x hx => (h hx).1⟩ + +/-- A connected subset of the circle that misses two points does not meet both arcs between them. -/ +theorem circle_no_cross {s₁ s₂ s₃ s₄ : ℝ} (h₁₂ : s₁ < s₂) (h₂₃ : s₂ < s₃) (h₃₄ : s₃ < s₄) + (h₄ : s₄ < s₁ + 1) + {C : Set Circle} (hC : IsPreconnected C) (hC₁ : circlePt s₁ ∉ C) (hC₃ : circlePt s₃ ∉ C) + (h₂ : circlePt s₂ ∈ C) (h₄' : circlePt s₄ ∈ C) : False := by + have hI : ∀ {t}, s₁ ≤ t → t < s₁ + 1 → t ∈ Ico s₁ (s₁ + 1) := fun h h' => ⟨h, h'⟩ + have hdis : Disjoint (circlePt '' Ioo s₁ s₃) (circlePt '' Ioo s₃ (s₁ + 1)) := by + refine disjoint_left.mpr ?_ + rintro _ ⟨t, ht, rfl⟩ ⟨t', ht', he⟩ + have := circlePt_injOn (hI (by linarith [ht'.1]) ht'.2) (hI ht.1.le (by linarith [ht.2])) he + linarith [ht.2, ht'.1] + have hcov : C ⊆ (circlePt '' Ioo s₁ s₃) ∪ (circlePt '' Ioo s₃ (s₁ + 1)) := by + intro z hz + obtain ⟨t, ht, rfl⟩ := exists_circlePt_time s₁ z + have hn₁ : t ≠ s₁ := fun h => hC₁ (h ▸ hz) + have hn₃ : t ≠ s₃ := fun h => hC₃ (h ▸ hz) + rcases lt_or_gt_of_ne hn₃ with h | h + · exact Or.inl ⟨t, ⟨lt_of_le_of_ne ht.1 hn₁.symm, h⟩, rfl⟩ + · exact Or.inr ⟨t, ⟨h, ht.2⟩, rfl⟩ + rcases hC.subset_or_subset (isOpenMap_circlePt _ isOpen_Ioo) (isOpenMap_circlePt _ isOpen_Ioo) + hdis hcov with + h | h + · exact disjoint_left.mp hdis (h h₄') ⟨s₄, ⟨h₃₄, h₄⟩, rfl⟩ + · exact disjoint_left.mp hdis ⟨s₂, ⟨h₁₂, h₂₃⟩, rfl⟩ (h h₂) + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {X A : Set S} + +private theorem embedded_collar_pairs_cross {T : Type u} [TopologicalSpace T] + {k : Circle → T} {B : Set T} (hkemb : IsEmbedding k) (hB : B = k '' univ) + {s₁ s₂ s₃ s₄ : ℝ} (h₁₂' : s₁ < s₂) (h₂₃' : s₂ < s₃) (h₃₄' : s₃ < s₄) + (h₄₁' : s₄ < s₁ + 1) : + PairsCrossOn B (k (circlePt s₁)) (k (circlePt s₃)) (k (circlePt s₂)) (k (circlePt s₄)) := by + have h13 : s₁ < s₃ := h₁₂'.trans h₂₃' + have h24 : s₂ < s₄ := h₂₃'.trans h₃₄' + have h14 : s₁ < s₄ := h13.trans h₃₄' + have hm₁ : s₁ ∈ Ico s₁ (s₁ + 1) := ⟨le_rfl, by linarith⟩ + have hm₂ : s₂ ∈ Ico s₁ (s₁ + 1) := ⟨h₁₂'.le, by linarith⟩ + have hm₃ : s₃ ∈ Ico s₁ (s₁ + 1) := ⟨h13.le, by linarith⟩ + have hm₄ : s₄ ∈ Ico s₁ (s₁ + 1) := ⟨h14.le, h₄₁'⟩ + have hkne : ∀ {s s' : ℝ}, s ∈ Ico s₁ (s₁ + 1) → s' ∈ Ico s₁ (s₁ + 1) → s ≠ s' → + k (circlePt s) ≠ k (circlePt s') := + fun hs hs' hne he => hne (circlePt_injOn hs hs' (hkemb.injective he)) + have hkmem : ∀ s, k (circlePt s) ∈ B := fun s => hB ▸ mem_image_of_mem _ (mem_univ _) + refine ⟨hkmem _, hkmem _, hkmem _, hkmem _, hkne hm₁ hm₃ h13.ne, hkne hm₂ hm₄ h24.ne, + hkne hm₁ hm₂ h₁₂'.ne, hkne hm₁ hm₄ h14.ne, hkne hm₃ hm₂ h₂₃'.ne', hkne hm₃ hm₄ h₃₄'.ne, ?_⟩ + intro he + set C₀ := B \ {k (circlePt s₁), k (circlePt s₃)} with hC₀ + have hb₀ : k (circlePt s₂) ∈ C₀ := ⟨hkmem _, by + rintro (h' | h') + · exact hkne hm₂ hm₁ h₁₂'.ne' h' + · exact hkne hm₂ hm₃ h₂₃'.ne h'⟩ + have hd₀ : k (circlePt s₄) ∈ C₀ := ⟨hkmem _, by + rintro (h' | h') + · exact hkne hm₄ hm₁ h14.ne' h' + · exact hkne hm₄ hm₃ h₃₄'.ne' h'⟩ + have hsub₀ : connectedComponentIn C₀ (k (circlePt s₂)) ⊆ C₀ := connectedComponentIn_subset _ _ + have hpre : IsPreconnected (k ⁻¹' connectedComponentIn C₀ (k (circlePt s₂))) := by + rw [← hkemb.isInducing.isPreconnected_image, image_preimage_eq_of_subset] + · exact isPreconnected_connectedComponentIn + · intro y hy + have := (hsub₀ hy).1 + rw [hB] at this + obtain ⟨z, -, rfl⟩ := this + exact mem_range_self z + refine circle_no_cross h₁₂' h₂₃' h₃₄' h₄₁' hpre (fun hm => (hsub₀ hm).2 (Or.inl rfl)) + (fun hm => (hsub₀ hm).2 (Or.inr rfl)) (mem_connectedComponentIn hb₀) ?_ + change k (circlePt s₄) ∈ connectedComponentIn C₀ (k (circlePt s₂)) + rw [he] + exact mem_connectedComponentIn hd₀ + +/-- **(8.1)** of Graph Minors XI (page 96), for a collar `h` of a closed, simply-connected, nice set +`X` with +`X ≠ ∅, Σ`: "if $A, B \subseteq X$ are arc-wise connected and $v_{i_1}, v_{i_3} \in A$ and $v_{i_2}, +v_{i_4} \in B$, then $A \cap B \ne \emptyset$". Here the points `v_i` are points `h(e^{2π i s_j}, +0)` of the circle of the collar. -/ +theorem theorem_8_1_proof (hS : IsClosedSurface S) (hA : IsOpenDisc A) (hXA : X ⊆ A) + (hXp : IsPathConnected X) {h : C(Circle × I, S)} (hinj : InjOn h {p | 0 < p.2}) + (hoff : ∀ p : Circle × I, 0 < p.2 → h p ∉ X) (hbot : ∀ z, h (z, 0) ∈ X) + {s₁ s₂ s₃ s₄ : ℝ} (h₁₂ : s₁ ≤ s₂) (h₂₃ : s₂ ≤ s₃) (h₃₄ : s₃ ≤ s₄) + (h₄₁ : s₄ ≤ s₁ + 1) {P Q : Set S} (hP : IsPathConnected P) (hQ : IsPathConnected Q) + (hPX : P ⊆ X) + (hQX : Q ⊆ X) (hP₁ : h (circlePt s₁, 0) ∈ P) (hP₃ : h (circlePt s₃, 0) ∈ P) + (hQ₂ : h (circlePt s₂, 0) ∈ Q) (hQ₄ : h (circlePt s₄, 0) ∈ Q) : (P ∩ Q).Nonempty := by + classical + rcases eq_or_lt_of_le h₁₂ with rfl | h₁₂' + · exact ⟨_, hP₁, hQ₂⟩ + rcases eq_or_lt_of_le h₂₃ with rfl | h₂₃' + · exact ⟨_, hP₃, hQ₂⟩ + rcases eq_or_lt_of_le h₃₄ with rfl | h₃₄' + · exact ⟨_, hP₃, hQ₄⟩ + rcases eq_or_lt_of_le h₄₁ with he | h₄₁' + · refine ⟨_, hP₁, ?_⟩ + have : circlePt s₄ = circlePt s₁ := by + rw [he] + simp only [circlePt, mul_add, mul_one, Circle.exp_add, Circle.exp_two_pi] + rwa [this] at hQ₄ + -- The collar, low enough to lie in `A`. + have hK : CompactSpace S := hS.1 + have hX₀ : (univ : Set Circle) ×ˢ ({0} : Set I) ⊆ h ⁻¹' A := by + rintro ⟨z, t⟩ ⟨-, ht⟩ + obtain rfl : t = 0 := ht + exact hXA (hbot z) + obtain ⟨U₁, V₁, -, hV₁, hU₁, h0V₁, hUV⟩ := generalized_tube_lemma isCompact_univ + isCompact_singleton + (hA.1.preimage h.continuous) hX₀ + obtain ⟨ε, hε, hsm⟩ := exists_small (hV₁.mem_nhds (h0V₁ rfl)) + have hlow : ∀ z, ∀ t : I, t ≤ ε → h (z, t) ∈ A := fun z t ht => hUV (mk_mem_prod (hU₁ + (mem_univ z)) (hsm t ht)) + have hPC : PathConnectedSpace I := isPathConnected_iff_pathConnectedSpace.mp + ((convex_Icc (0 : ℝ) 1).isPathConnected ⟨0, by simp⟩) + -- The rays of the collar. + let ray : ℝ → Set S := fun s => (fun u : I => h (circlePt s, u * ε)) '' univ + have hrayp : ∀ s, IsPathConnected (ray s) := fun s => isPathConnected_univ.image (by fun_prop) + have hray₀ : ∀ s, h (circlePt s, 0) ∈ ray s := fun s => ⟨0, mem_univ _, by simp⟩ + have hrayε : ∀ s, h (circlePt s, ε) ∈ ray s := fun s => ⟨1, mem_univ _, by simp⟩ + have hrayt : ∀ s, ∀ y ∈ ray s, ∃ t : I, t ≤ ε ∧ y = h (circlePt s, t) := by + rintro s _ ⟨u, -, rfl⟩ + exact ⟨u * ε, unitInterval.mul_le_right, rfl⟩ + have hrayX : ∀ s, ∀ y ∈ ray s, y ∈ X → y = h (circlePt s, 0) := by + intro s y hy hyX + obtain ⟨t, -, rfl⟩ := hrayt s y hy + have ht : t = 0 := by + by_contra hne + exact hoff _ (unitInterval.pos_iff_ne_zero.mpr hne) hyX + rw [ht] + have hpt : ∀ {s₁' s₂' : ℝ}, s₁' ∈ Ico s₁ (s₁ + 1) → s₂' ∈ Ico s₁ (s₁ + 1) → s₁' ≠ s₂' → + circlePt s₁' ≠ circlePt s₂' := fun h₁ h₂ hne he => hne (circlePt_injOn h₁ h₂ he) + have h13 : s₁ < s₃ := h₁₂'.trans h₂₃' + have h14 : s₁ < s₄ := h13.trans h₃₄' + have hm₁ : s₁ ∈ Ico s₁ (s₁ + 1) := ⟨le_rfl, by linarith⟩ + have hm₂ : s₂ ∈ Ico s₁ (s₁ + 1) := ⟨h₁₂, by linarith⟩ + have hm₃ : s₃ ∈ Ico s₁ (s₁ + 1) := ⟨by linarith, by linarith⟩ + have hm₄ : s₄ ∈ Ico s₁ (s₁ + 1) := ⟨by linarith, h₄₁'⟩ + -- The set `X` with the part of the collar below height `ε`. + obtain ⟨x₀, hx₀⟩ := hXp.nonempty + let T : Circle → Set S := fun z => X ∪ (fun u : I => h (z, u)) '' Iio ε + have hTp : ∀ z, IsPreconnected (T z) := by + intro z + refine hXp.isConnected.isPreconnected.union' ?_ ((isPreconnected_Iio).image _ (by fun_prop)) + exact ⟨h (z, 0), hbot z, 0, hε, rfl⟩ + have hW : IsPreconnected (⋃ z, T z) := isPreconnected_iUnion + ⟨x₀, mem_iInter.mpr fun z => Or.inl hx₀⟩ hTp + let J : Set S := range fun z : Circle => h (z, ε) + have hWJ : Disjoint (⋃ z, T z) J := by + refine disjoint_left.mpr ?_ + rintro _ hy ⟨z', rfl⟩ + obtain ⟨z, hy⟩ := mem_iUnion.mp hy + change h (z', ε) ∈ T z at hy + rcases hy with hy | ⟨u, hu, hue⟩ + · exact hoff _ hε hy + · have hu' : u < ε := hu + by_cases hu0 : u = 0 + · subst hu0 + refine hoff (z', ε) hε ?_ + have : h (z, 0) = h (z', ε) := hue + rw [← this] + exact hbot z + · have := hinj (unitInterval.pos_iff_ne_zero.mpr hu0 : (0 : I) < u) hε hue + exact hu'.ne (congrArg Prod.snd this) + -- The sphere. + have hsph := isSphere_onePoint hA + obtain ⟨hS', hconn'⟩ := IsSphere.isClosedSurface hsph + have hT2' : T2Space (OnePoint A) := hS'.2.1 + have hf : Continuous (collapse A) := continuous_collapse hA.1 + let f := collapse A + have hinjA : InjOn f A := by + intro x hx y hy he + change collapse A x = collapse A y at he + rw [collapse_of_mem hx, collapse_of_mem hy] at he + exact congrArg Subtype.val (OnePoint.coe_injective he) + let k : Circle → OnePoint A := fun z => f (h (z, ε)) + have hkc : Continuous k := hf.comp (by fun_prop) + have hki : Function.Injective k := by + intro z z' he + have := hinj hε hε (hinjA (hlow z ε le_rfl) (hlow z' ε le_rfl) he) + exact congrArg Prod.fst this + have hkemb := (hkc.isClosedEmbedding hki).isEmbedding + have hJ' : IsOArc (k '' univ) := + isOArc_image ⟨(Homeomorph.Set.univ Circle).symm⟩ hkc.continuousOn hki.injOn + have hWA : (⋃ z, T z) ⊆ A := by + refine iUnion_subset fun z => ?_ + rintro y (hy | ⟨u, hu, rfl⟩) + · exact hXA hy + · exact hlow z u (le_of_lt hu) + have hJA : J ⊆ A := by + rintro _ ⟨z, rfl⟩ + exact hlow z ε le_rfl + have hdisf : Disjoint (f '' ⋃ z, T z) (k '' univ) := by + refine disjoint_left.mpr ?_ + rintro _ ⟨y, hy, rfl⟩ ⟨z, -, he⟩ + have := hinjA (hJA ⟨z, rfl⟩) (hWA hy) he + exact disjoint_left.mp hWJ hy ⟨z, this⟩ + obtain ⟨Δ, hΔ, hbΔ, hsubΔ⟩ := exists_disc_of_collar hS' hsph hJ' (hW.image f hf.continuousOn) + hdisf + have hJΔ : k '' univ ⊆ Δ := by + rw [← hbΔ] + exact discBd_subset Δ + have hlowΔ : ∀ z, ∀ t : I, t ≤ ε → f (h (z, t)) ∈ Δ := by + intro z t ht + rcases eq_or_lt_of_le ht with rfl | hlt + · exact hJΔ ⟨z, mem_univ _, rfl⟩ + · exact hsubΔ ⟨_, mem_iUnion.mpr ⟨z, Or.inr ⟨t, hlt, rfl⟩⟩, rfl⟩ + have hXΔ : ∀ y ∈ X, f y ∈ Δ := fun y hy => hsubΔ ⟨y, mem_iUnion.mpr ⟨Classical.arbitrary _, + Or.inl hy⟩, rfl⟩ + let A₀ : Set S := P ∪ ray s₁ ∪ ray s₃ + let B₀ : Set S := Q ∪ ray s₂ ∪ ray s₄ + have hA₀ : IsPathConnected A₀ := + (hP.union (hrayp s₁) ⟨_, hP₁, hray₀ s₁⟩).union (hrayp s₃) ⟨_, Or.inl hP₃, hray₀ s₃⟩ + have hB₀ : IsPathConnected B₀ := + (hQ.union (hrayp s₂) ⟨_, hQ₂, hray₀ s₂⟩).union (hrayp s₄) ⟨_, Or.inl hQ₄, hray₀ s₄⟩ + have hrayΔ : ∀ s, ∀ y ∈ ray s, f y ∈ Δ := fun s y hy => by + obtain ⟨t, ht, rfl⟩ := hrayt s y hy + exact hlowΔ _ t ht + have hrayA : ∀ s, ∀ y ∈ ray s, y ∈ A := fun s y hy => by + obtain ⟨t, ht, rfl⟩ := hrayt s y hy + exact hlow _ t ht + have hA₀Δ : f '' A₀ ⊆ Δ := by + rintro _ ⟨y, (((hy | hy) | hy)), rfl⟩ + · exact hXΔ y (hPX hy) + · exact hrayΔ _ y hy + · exact hrayΔ _ y hy + have hB₀Δ : f '' B₀ ⊆ Δ := by + rintro _ ⟨y, (((hy | hy) | hy)), rfl⟩ + · exact hXΔ y (hQX hy) + · exact hrayΔ _ y hy + · exact hrayΔ _ y hy + have hA₀A : A₀ ⊆ A := by + rintro y ((hy | hy) | hy) + · exact hXA (hPX hy) + · exact hrayA _ y hy + · exact hrayA _ y hy + have hB₀A : B₀ ⊆ A := by + rintro y ((hy | hy) | hy) + · exact hXA (hQX hy) + · exact hrayA _ y hy + · exact hrayA _ y hy + have hcross := embedded_collar_pairs_cross hkemb hbΔ h₁₂' h₂₃' h₃₄' h₄₁' + obtain ⟨y, ⟨p, hp, rfl⟩, ⟨q, hq, hpq⟩⟩ := disc_crossing.of_isPathConnected Δ (f '' A₀) + (f '' B₀) _ _ _ _ hΔ + hA₀Δ hB₀Δ (hA₀.image hf) (hB₀.image hf) ⟨_, Or.inl (Or.inr (hrayε s₁)), rfl⟩ + ⟨_, Or.inr (hrayε s₃), rfl⟩ ⟨_, Or.inl (Or.inr (hrayε s₂)), rfl⟩ ⟨_, Or.inr + (hrayε s₄), rfl⟩ hcross + obtain rfl : q = p := hinjA (hB₀A hq) (hA₀A hp) hpq + have hP' : ∀ s, h (circlePt s, 0) ∈ P → q ∈ ray s → q ∈ Q → (P ∩ Q).Nonempty := fun s h₁ h₂ h₃ => + ⟨q, by rwa [hrayX s q h₂ (hQX h₃)], h₃⟩ + have hQ' : ∀ s, h (circlePt s, 0) ∈ Q → q ∈ ray s → q ∈ P → (P ∩ Q).Nonempty := fun s h₁ h₂ h₃ => + ⟨q, h₃, by rwa [hrayX s q h₂ (hPX h₃)]⟩ + have hRR : ∀ {s s' : ℝ}, h (circlePt s, 0) ∈ P → h (circlePt s', 0) ∈ Q + → circlePt s ≠ circlePt s' → + q ∈ ray s → q ∈ ray s' → (P ∩ Q).Nonempty := by + intro s s' h₁ h₂ hne hs hs' + obtain ⟨t, -, ht⟩ := hrayt s q hs + obtain ⟨t', -, ht'⟩ := hrayt s' q hs' + by_cases ht0 : t = 0 + · have hqX : q ∈ X := by + rw [ht, ht0] + exact hbot _ + exact ⟨q, by rwa [hrayX s q hs hqX], by rwa [hrayX s' q hs' hqX]⟩ + · have hpos : (0 : I) < t := unitInterval.pos_iff_ne_zero.mpr ht0 + by_cases ht'0 : t' = 0 + · refine (hoff (circlePt s, t) hpos ?_).elim + rw [← ht, ht', ht'0] + exact hbot _ + · have hpos' : (0 : I) < t' := unitInterval.pos_iff_ne_zero.mpr ht'0 + have := hinj hpos hpos' (ht.symm.trans ht') + exact (hne (congrArg Prod.fst this)).elim + rcases hp with (hp | hp) | hp <;> rcases hq with (hq | hq) | hq + · exact ⟨q, hp, hq⟩ + · exact hQ' _ hQ₂ hq hp + · exact hQ' _ hQ₄ hq hp + · exact hP' _ hP₁ hp hq + · exact hRR hP₁ hQ₂ (hpt hm₁ hm₂ h₁₂'.ne) hp hq + · exact hRR hP₁ hQ₄ (hpt hm₁ hm₄ h14.ne) hp hq + · exact hP' _ hP₃ hp hq + · exact hRR hP₃ hQ₂ (hpt hm₃ hm₂ h₂₃'.ne') hp hq + · exact hRR hP₃ hQ₄ (hpt hm₃ hm₄ h₃₄'.ne) hp hq + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section810.lean b/LeanPool/GraphMinor/GM11/Section810.lean new file mode 100644 index 0000000000..1c5297fb4c --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section810.lean @@ -0,0 +1,538 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section810Connected + +/-! +# Graph Minors XI, (8.10), (8.11) and (8.12) + +`theorem_8_10` is (8.10) of the paper, for a union that is not empty. An empty union is not arc-wise +connected +in our definition, since Mathlib's path-connected sets are not empty. The proof is the paper's. The +connected case is `theorem_8_10_connected`; here the general case is reduced to it. `compPts Γ w` is +the point set of the component of `Γ` at the vertex `w`, and `Γ ∩ compPts Γ w` is connected. As the +paper says, the union `Z` is the union of the sets `Z_w` of restraints with boundary in one +component, any two of these are nested by (7.7) and (8.4), so `Z` is one of them, and +`restraint_down`, `restraint_up` turn it into the union for that component. + +`theorem_8_11` and `theorem_8_12` follow the paper. The paper applies (8.10) to `Γ ∩ X` in the proof +of (8.11). +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] {Γ : Drawing S} + +variable {k K : ℕ} {ins : Drawing S → Set S} + +/-! ## The components of `Γ`, for the general case of (8.10) -/ + +omit [T2Space S] [ConnectedSpace S] in +/-- Two vertices in the closure of one edge are joined by a walk. -/ +theorem nonempty_walk_of_edge {e : Set S} (he : e ∈ Γ.E) {p q : S} (hp : p ∈ closure e ∩ Γ.V) + (hq : q ∈ closure e ∩ Γ.V) : Nonempty (GraphWalk Γ.toGraph p q) := by + have hlink : ∀ {x y : S}, closure e ∩ Γ.V = {x, y} → ∀ {p q : S}, p ∈ closure e ∩ Γ.V → + q ∈ closure e ∩ Γ.V → Nonempty (GraphWalk Γ.toGraph p q) := by + intro x y hxy p q hp hq + have hx : x ∈ closure e ∩ Γ.V := by rw [hxy]; exact Or.inl rfl + have hy : y ∈ closure e ∩ Γ.V := by rw [hxy]; exact Or.inr rfl + have hl : Γ.toGraph.IsLink e x y := ⟨he, hx.2, hy.2, hxy⟩ + have hl' : Γ.toGraph.IsLink e y x := ⟨he, hy.2, hx.2, by rw [hxy, pair_comm]⟩ + rw [hxy] at hp hq + rcases hp with rfl | rfl <;> rcases hq with rfl | rfl + · exact ⟨.nil hx.2⟩ + · exact ⟨.cons hl (.nil hy.2)⟩ + · exact ⟨.cons hl' (.nil hx.2)⟩ + · exact ⟨.nil hy.2⟩ + rcases Γ.edge_cond e he with ⟨x, y, -, hcap, -⟩ | ⟨x, hcap, -⟩ + · exact hlink hcap hp hq + · exact hlink (x := x) (y := x) (by rw [hcap, pair_eq_singleton]) hp hq + +/-- The vertices joined to `w` by a walk. -/ +def reachV (Γ : Drawing S) (w : S) : Set S := {x | x ∈ Γ.V ∧ Nonempty (GraphWalk Γ.toGraph w x)} + +/-- The point set of the component of `Γ` that contains the vertex `w`: the vertices joined to `w` +by a walk, +and the closures of the edges at them. -/ +def compPts (Γ : Drawing S) (w : S) : Set S := + reachV Γ w ∪ ⋃ e ∈ {e | e ∈ Γ.E ∧ ∃ y ∈ reachV Γ w, y ∈ closure e}, closure e + +omit [T2Space S] [ConnectedSpace S] in +theorem reachV_trans {w x y : S} (hx : x ∈ reachV Γ w) (hy : y ∈ reachV Γ x) : y ∈ reachV Γ w := by + obtain ⟨-, ⟨W₁⟩⟩ := hx + obtain ⟨hyV, ⟨W₂⟩⟩ := hy + exact ⟨hyV, ⟨W₁.append W₂⟩⟩ + +omit [T2Space S] [ConnectedSpace S] in +theorem reachV_symm {w x : S} (hw : w ∈ Γ.V) (hx : x ∈ reachV Γ w) : w ∈ reachV Γ x := by + obtain ⟨-, ⟨W⟩⟩ := hx + exact ⟨hw, ⟨W.reverse⟩⟩ + +omit [T2Space S] [ConnectedSpace S] in +theorem self_mem_reachV {w : S} (hw : w ∈ Γ.V) : w ∈ reachV Γ w := ⟨hw, ⟨.nil hw⟩⟩ + +omit [T2Space S] [ConnectedSpace S] in +/-- A vertex of `Γ` in `compPts Γ w` is joined to `w`. -/ +theorem mem_reachV_of_mem_compPts {w x : S} (hx : x ∈ compPts Γ w) (hxV : x ∈ Γ.V) : x ∈ reachV Γ w + := by + rcases hx with hx | hx + · exact hx + obtain ⟨e, ⟨he, y, hy, hye⟩, hxe⟩ := mem_iUnion₂.mp hx + obtain ⟨W⟩ := nonempty_walk_of_edge he ⟨hye, hy.1⟩ ⟨hxe, hxV⟩ + exact reachV_trans hy ⟨hxV, ⟨W⟩⟩ + +omit [T2Space S] [ConnectedSpace S] in +/-- The points of a walk from `w` lie in `compPts Γ w`. -/ +theorem walkPts_subset_compPts {w y : S} (W : GraphWalk Γ.toGraph w y) : walkPts W ⊆ compPts Γ w + := by + have key : ∀ {a b : S} (W : GraphWalk Γ.toGraph a b), a ∈ reachV Γ w → + (∀ x ∈ W.support, x ∈ reachV Γ w) ∧ ∀ e ∈ W.edges, e ∈ Γ.E ∧ ∃ y ∈ reachV Γ w, y ∈ closure e + := by + intro a b W + induction W with + | nil h => + exact fun ha => ⟨fun x hx => (List.mem_singleton.mp hx).symm ▸ ha, + fun e he => by simp [GraphWalk.edges] at he⟩ + | @cons a' b' c' e hl rest ih => + intro ha + have hac : a' ∈ closure e := by + have : a' ∈ closure e ∩ Γ.V := by rw [hl.2.2.2]; exact Or.inl rfl + exact this.1 + have hb : b' ∈ reachV Γ w := reachV_trans ha ⟨hl.2.2.1, ⟨.cons hl (.nil hl.2.2.1)⟩⟩ + obtain ⟨h₁, h₂⟩ := ih hb + refine ⟨fun x hx => ?_, fun f hf => ?_⟩ + · rcases List.mem_cons.mp hx with rfl | hx + · exact ha + · exact h₁ x hx + · rcases List.mem_cons.mp hf with rfl | hf + · exact ⟨hl.1, a', ha, hac⟩ + · exact h₂ f hf + have hw : w ∈ reachV Γ w := self_mem_reachV (W.mem_vertexSet_of_mem_support W.start_mem_support) + obtain ⟨h₁, h₂⟩ := key W hw + rintro x (hx | ⟨e, he, hxe⟩) + · exact Or.inl (h₁ x hx) + · exact Or.inr (mem_iUnion₂.mpr ⟨e, h₂ e he, hxe⟩) + +omit [ConnectedSpace S] in +/-- `compPts Γ w` is closed. -/ +theorem isClosed_compPts (w : S) : IsClosed (compPts Γ w) := by + have hv : (reachV Γ w).Finite := Γ.finite_V.subset fun _ hx => hx.1 + have he : {e ∈ Γ.E | ∃ y ∈ reachV Γ w, y ∈ closure e}.Finite := + Γ.finite_edges.subset fun _ h => h.1 + exact hv.isClosed.union (he.isClosed_biUnion fun _ _ => isClosed_closure) + +omit [T2Space S] [ConnectedSpace S] in +/-- Two components that meet are equal. -/ +theorem compPts_eq_of_meet {w w' : S} (hw' : w' ∈ Γ.V) + (h : (compPts Γ w ∩ compPts Γ w').Nonempty) : compPts Γ w = compPts Γ w' := by + have hrw : ∀ {a b : S}, b ∈ reachV Γ a → reachV Γ a = reachV Γ b := by + intro a b hb + have ha : a ∈ Γ.V := by + obtain ⟨hbV, ⟨W⟩⟩ := hb + exact W.mem_vertexSet_of_mem_support W.start_mem_support + ext x + exact ⟨fun hx => reachV_trans (reachV_symm ha hb) hx, fun hx => reachV_trans hb hx⟩ + suffices hw'w : w' ∈ reachV Γ w by + simp only [compPts, hrw hw'w] + obtain ⟨x, hx, hx'⟩ := h + by_cases hxV : x ∈ Γ.V + · exact reachV_trans (mem_reachV_of_mem_compPts hx hxV) + (reachV_symm hw' (mem_reachV_of_mem_compPts hx' hxV)) + have hedge : ∀ {a : S}, x ∈ compPts Γ a → ∃ e ∈ Γ.E, x ∈ e ∧ ∃ y ∈ reachV Γ a, y ∈ closure e := by + intro a hxa + rcases hxa with hxa | hxa + · exact absurd hxa.1 hxV + obtain ⟨e, ⟨he, y, hy, hye⟩, hxe⟩ := mem_iUnion₂.mp hxa + refine ⟨e, he, ?_, y, hy, hye⟩ + rw [← Γ.closure_diff_V he] + exact ⟨hxe, hxV⟩ + obtain ⟨e, he, hxe, y, hy, hye⟩ := hedge hx + obtain ⟨e', he', hxe', y', hy', hye'⟩ := hedge hx' + obtain rfl := Γ.edge_eq_of_mem he he' hxe hxe' + obtain ⟨W⟩ := nonempty_walk_of_edge he ⟨hye, hy.1⟩ ⟨hye', hy'.1⟩ + exact reachV_trans (reachV_trans hy ⟨hy'.1, ⟨W⟩⟩) (reachV_symm hw' hy') + +omit [ConnectedSpace S] in +/-- The component `Γ ∩ compPts Γ w` is connected. -/ +theorem isConnected_interSet_compPts {w : S} (hw : w ∈ Γ.V) : + (Γ.interSet (compPts Γ w)).IsConnected := by + have hT := isClosed_compPts (Γ := Γ) w + have hsub : (Γ.interSet (compPts Γ w)).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hdown : ∀ x ∈ reachV Γ w, Nonempty (GraphWalk (Γ.interSet (compPts Γ w)).toGraph w x) := by + rintro x ⟨-, ⟨W⟩⟩ + have hpts := walkPts_subset_compPts W + obtain ⟨W', -, -⟩ := hsub.exists_walk_down W + (fun y hy => (mem_interSet_V_iff hT).mpr ⟨W.mem_vertexSet_of_mem_support hy, hpts + (Or.inl hy)⟩) + (fun e he => by + have hE : ∀ {a b : S} (W' : GraphWalk Γ.toGraph a b), ∀ f ∈ W'.edges, f ∈ Γ.E := by + intro a b W' + induction W' with + | nil => simp [GraphWalk.edges] + | cons hl rest ih => + intro f hf + rcases List.mem_cons.mp hf with rfl | hf + · exact hl.1 + · exact ih f hf + have heE : e ∈ Γ.E := hE W e he + exact mem_interSet_E_iff.mpr ⟨heE, fun y hy => hpts (Or.inr ⟨e, he, subset_closure hy⟩)⟩) + exact ⟨W'⟩ + have hV : ∀ x ∈ (Γ.interSet (compPts Γ w)).V, x ∈ reachV Γ w := fun x hx => by + obtain ⟨h₁, h₂⟩ := (mem_interSet_V_iff hT).mp hx + exact mem_reachV_of_mem_compPts h₂ h₁ + refine ⟨⟨w, (mem_interSet_V_iff hT).mpr ⟨hw, Or.inl (self_mem_reachV hw)⟩⟩, fun x hx y hy => ?_⟩ + obtain ⟨W₁⟩ := hdown x (hV x hx) + obtain ⟨W₂⟩ := hdown y (hV y hy) + exact ⟨W₁.reverse.append W₂⟩ + +/-- **(8.10)** of Graph Minors XI (pages 100–102): "Let $c \in \Sigma$, let $0 \le k < 2\theta$, and +let $Z$ +be the union of all restraints $X$ with $l(X) \le k$ and $c \in X$. Then $Z$ is simply-connected." +We ask +that the union is not empty, because the empty set is not arc-wise connected in our definition. The +proof +reduces to one component of `Γ`, as the paper does, and then applies `theorem_8_10_connected`. -/ +theorem theorem_8_10_proof (hS : IsClosedSurface S) + (hs : IsSlope Γ K ins) {c : S} (hne : (restraintUnion Γ ins K c k).Nonempty) : + IsSimplyConnectedSet (restraintUnion Γ ins K c k) := by + classical + set Z := restraintUnion Γ ins K c k with hZdef + -- `Z_w` is the union of the restraints in `Z` with boundary in the component of `w`. + let Zw : S → Set S := fun w => restraintUnion (Γ.interSet (compPts Γ w)) ins K c k + have hmemZw : ∀ w x, x ∈ Zw w ↔ ∃ X, (IsRestraint Γ ins K X ∧ perimeterWalkLength Γ X ≤ k + ∧ c ∈ X) ∧ + frontier X ⊆ compPts Γ w ∧ x ∈ X := by + intro w x + constructor + · intro hx + obtain ⟨X, ⟨hX, hl, hc⟩, hxX⟩ := mem_iUnion₂.mp hx + obtain ⟨hX', hf, hl'⟩ := restraint_up hS (isClosed_compPts w) hX + exact ⟨X, ⟨hX', hl' ▸ hl, hc⟩, hf, hxX⟩ + · rintro ⟨X, ⟨hX, hl, hc⟩, hf, hxX⟩ + obtain ⟨hX', hl'⟩ := restraint_down hS (isClosed_compPts w) hX hf + exact mem_iUnion₂.mpr ⟨X, ⟨hX', hl'.symm ▸ hl, hc⟩, hxX⟩ + -- Every restraint has connected boundary, which lies in one component. + have hbd : ∀ X, IsRestraint Γ ins K X → ∃ w ∈ Γ.V, frontier X ⊆ compPts Γ w ∧ + IsPreconnected (frontier X) := by + intro X hX + obtain ⟨u₀, W₀, -, -, -, -, hd⟩ := hX.exists_walk hS + have hf : frontier X = walkPts W₀ := by + rw [walkPts_eq, hd, frontier_interSet hS hX.isClosed hX.isGammaNice] + refine ⟨u₀, W₀.mem_vertexSet_of_mem_support W₀.start_mem_support, + hf ▸ walkPts_subset_compPts W₀, ?_⟩ + rw [hf] + exact (isPathConnected_walk_U W₀).isConnected.isPreconnected + -- "Then $Z = Z_1 \cup \dots \cup Z_t$, since every restraint has connected boundary." + have hZ : Z = ⋃ w ∈ Γ.V, Zw w := by + ext x + constructor + · intro hx + obtain ⟨X, hX, hxX⟩ := mem_iUnion₂.mp hx + obtain ⟨w, hw, hf, -⟩ := hbd X hX.1 + exact mem_iUnion₂.mpr ⟨w, hw, (hmemZw w x).mpr ⟨X, hX, hf, hxX⟩⟩ + · intro hx + obtain ⟨w, -, hxw⟩ := mem_iUnion₂.mp hx + obtain ⟨X, hX, -, hxX⟩ := (hmemZw w x).mp hxw + exact mem_iUnion₂.mpr ⟨X, hX, hxX⟩ + -- "We claim that either $Z_i \subseteq Z_j$ or $Z_j \subseteq Z_i$." + have hcmp : ∀ w ∈ Γ.V, ∀ w' ∈ Γ.V, Zw w ⊆ Zw w' ∨ Zw w' ⊆ Zw w := by + intro w hw w' hw' + by_cases hmeet : (compPts Γ w ∩ compPts Γ w').Nonempty + · left + simp only [Zw, compPts_eq_of_meet hw' hmeet, subset_rfl] + by_contra! hno + obtain ⟨a, haw, haw'⟩ := not_subset.mp hno.1 + obtain ⟨b, hbw', hbw⟩ := not_subset.mp hno.2 + obtain ⟨X, hX, hfX, haX⟩ := (hmemZw w a).mp haw + obtain ⟨Y, hY, hfY, hbY⟩ := (hmemZw w' b).mp hbw' + obtain ⟨-, -, -, hXp⟩ := hbd X hX.1 + obtain ⟨-, -, -, hYp⟩ := hbd Y hY.1 + have hXY := theorem_7_7_proof (X := X) (Y := Y) + (by rw [subBd_eq_frontier]; exact hXp) + (by rw [subBd_eq_frontier]; exact hYp) ⟨c, hX.2.2, hY.2.2⟩ + (fun h => theorem_8_4_proof hS hs hX.1 hY.1 hX.1 (by rw [union_right_comm, union_self, h])) + (by + rw [subBd_eq_frontier, subBd_eq_frontier] + exact disjoint_iff_inter_eq_empty.mpr (subset_empty_iff.mp fun x hx => + hmeet ⟨x, hfX hx.1, hfY hx.2⟩)) + rcases hXY with h | h + · exact haw' ((hmemZw w' a).mpr ⟨Y, hY, hfY, h haX⟩) + · exact hbw ((hmemZw w b).mpr ⟨X, hX, hfX, h hbY⟩) + -- "Hence there exists $i$ with $Z = Z_i$." + have hVne : Γ.V.Nonempty := by + obtain ⟨z, hz⟩ := hne + obtain ⟨X, hX, -⟩ := mem_iUnion₂.mp hz + obtain ⟨w, hw, -⟩ := hbd X hX.1 + exact ⟨w, hw⟩ + obtain ⟨w, hw, hmax⟩ := Set.Finite.exists_maximalFor Zw Γ.V Γ.finite_V hVne + have hZw : Z = Zw w := by + rw [hZ] + refine subset_antisymm (iUnion₂_subset fun w' hw' => ?_) (subset_iUnion₂_of_subset w hw + subset_rfl) + rcases hcmp w' hw' w hw with h | h + · exact h + · exact hmax hw' h + -- "by the argument above when $\Gamma$ is connected, the union of $\mathrm{ins}'$-restraints ... + -- is + -- simply-connected." + rw [hZw] at hne ⊢ + exact theorem_8_10_connected hS (theorem_4_2_proof hs (Drawing.span_isSubdrawing Γ _ _)) + (isConnected_interSet_compPts hw) hne + +/-- **(8.10)** of Graph Minors XI (page 100), with no hypothesis: "Then $Z$ is simply-connected." +The paper's definition (page 76) holds for the empty set. Mathlib's path-connected sets are not +empty, so the conclusion is written as "$Z$ is empty or simply-connected". -/ +theorem theorem_8_10_empty_or (hS : IsClosedSurface S) (hs : IsSlope Γ K ins) (c : S) (k : ℕ) : + restraintUnion Γ ins K c k = ∅ ∨ IsSimplyConnectedSet (restraintUnion Γ ins K c k) := by + rcases (restraintUnion Γ ins K c k).eq_empty_or_nonempty with h | h + · exact Or.inl h + · exact Or.inr (theorem_8_10_proof hS hs h) + + +/-- **(8.11)** of Graph Minors XI (page 101): "Let $c \in \Sigma$, let $0 \le k < 2\theta$, and let +$Z$ be the union of all restraints $X$ +with $l(X) \le k$ and $c \in X$. Then for any restraint $Y$ with $c \in Y$, if $bd(Y) +\subseteq Z$ then $Y \subseteq Z$." -/ +theorem theorem_8_11_proof (hS : IsClosedSurface S) + (hs : IsSlope Γ K ins) {c : S} {Y : Set S} (hY : IsRestraint Γ ins K Y) (hc : c ∈ Y) + (hbd : frontier Y ⊆ restraintUnion Γ ins K c k) : Y ⊆ restraintUnion Γ ins K c k := by + by_contra hnot + set Z := restraintUnion Γ ins K c k with hZdef + have hZc : IsClosed Z := isClosed_restraintUnion hS c k + have hZn : IsGammaNice Γ Z := isGammaNice_restraintUnion c k + have hZne : Z.Nonempty := by + obtain ⟨y, hy⟩ := nonempty_frontier_iff.mpr ⟨hY.nonempty, hY.ne_univ⟩ + exact ⟨y, hbd hy⟩ + obtain ⟨z₀, hz₀⟩ := hZne + obtain ⟨X₀, hX₀, -⟩ := mem_iUnion₂.mp hz₀ + have hcZ : c ∈ Z := mem_iUnion₂.mpr ⟨X₀, hX₀, hX₀.2.2⟩ + have hZs : IsSimplyConnectedSet Z := theorem_8_10_proof hS hs ⟨c, hcZ⟩ + obtain ⟨y, hyY, hyZ⟩ := not_subset.mp hnot + have hZu : Z ≠ univ := fun h => hyZ (h ▸ mem_univ y) + have hZconn := isConnected_compl hS hZc hZn hZs ⟨c, hcZ⟩ hZu + -- A connected set that meets `T` and misses `bd(T)` lies in `T`. + have hin : ∀ {C T : Set S}, IsPreconnected C → Disjoint C (frontier T) → (C ∩ T).Nonempty → C ⊆ T + := by + intro C T hC hd hne x hx + by_contra hxT + obtain ⟨w, hw, hwf⟩ := meets_frontier hC hne hx hxT + exact disjoint_left.mp hd hw hwf + have hZY : Zᶜ ⊆ Y := hin hZconn.isPreconnected + (disjoint_left.mpr fun x hx hxf => hx (hbd hxf)) ⟨y, hyZ, hyY⟩ + obtain ⟨X, hX, hYX, -⟩ := exists_extreme hS hY + have hr := hX.1 + have hXc := hr.isClosed + have hZX : Zᶜ ⊆ X := hZY.trans hYX + have hXZ : Xᶜ ⊆ Z := fun x hx => by + by_contra hxZ + exact hx (hZX hxZ) + have hXconn := isConnected_compl hS hXc hr.isGammaNice hr.isSimplyConnected hr.nonempty hr.ne_univ + -- The set `Z'` of the paper, which is the set `Z` of `Γ ∩ X`. + have hcX := hYX hc + have hZ' : restraintUnion (Γ.interSet X) ins K c k = Z ∩ X := by + apply subset_antisymm + · refine iUnion₂_subset fun T hT x hx => ?_ + obtain ⟨hT', hf, hl⟩ := restraint_up hS hXc hT.1 + refine ⟨mem_iUnion₂.mpr ⟨T, ⟨hT', hl ▸ hT.2.1, hT.2.2⟩, hx⟩, ?_⟩ + by_contra hxX + have hsub : Xᶜ ⊆ T := hin hXconn.isPreconnected + (disjoint_left.mpr fun w hw hwf => hw (hf hwf)) ⟨x, hxX, hx⟩ + have hcov : X ∪ T ∪ T = univ := by + refine eq_univ_of_forall fun w => ?_ + by_cases hw : w ∈ X + · exact Or.inl (Or.inl hw) + · exact Or.inr (hsub hw) + exact theorem_8_4_proof hS hs hr hT' hT' hcov + · rintro z ⟨hzZ, hzX⟩ + obtain ⟨T, hT, hzT⟩ := mem_iUnion₂.mp hzZ + obtain ⟨X', hX', hl⟩ := exists_optimal hT.1 hT.2.2 hzT + have hsub : X' ⊆ X := theorem_8_9_proof hS hs hX' hX hcX hzX + obtain ⟨h₁, h₂⟩ := restraint_down hS hXc hX'.1 + (hX'.1.isClosed.frontier_subset.trans hsub) + exact mem_iUnion₂.mpr ⟨X', ⟨h₁, by rw [h₂]; exact hl.trans hT.2.1, hX'.2.1⟩, hX'.2.2.1⟩ + have hs' : IsSlope (Γ.interSet X) K ins := theorem_4_2_proof hs interSet_isSub + have hsimp : IsSimplyConnectedSet (Z ∩ X) := by + have := theorem_8_10_proof hS hs' (c := c) (k := k) + (by rw [hZ']; exact ⟨c, hcZ, hcX⟩) + rwa [hZ'] at this + have hIne : (Z ∩ X).Nonempty := ⟨c, hcZ, hcX⟩ + have hIu : Z ∩ X ≠ univ := fun h => hZu (eq_univ_of_univ_subset (h ▸ inter_subset_left)) + have hIconn := isConnected_compl hS (hZc.inter hXc) (hZn.inter hr.isGammaNice) hsimp hIne hIu + obtain ⟨x, hxX⟩ := (ne_univ_iff_exists_notMem _).mp hr.ne_univ + have hne' : (Z ∩ X)ᶜ ∩ Zᶜ ∈ {A : Set S | A.Nonempty} := ⟨y, fun h => hyZ h.1, hyZ⟩ + have hsub := hIconn.isPreconnected.subset_left_of_subset_union hZc.isOpen_compl hXc.isOpen_compl + (disjoint_left.mpr fun w h₁ h₂ => h₂ (hZX h₁)) + (fun w hw => by + by_cases hwZ : w ∈ Z + · exact Or.inr fun hwX => hw ⟨hwZ, hwX⟩ + · exact Or.inl hwZ) hne' + exact hsub (fun h => hxX h.2 : x ∈ (Z ∩ X)ᶜ) (hXZ hxX) + +omit [ConnectedSpace S] in +/-- Each non-empty open set has a point off `U(Γ)`. -/ +theorem exists_off_U (hS : IsClosedSurface S) (Γ : Drawing S) {O : Set S} (hO : IsOpen O) + (hne : O.Nonempty) : + (O \ Γ.U).Nonempty := by + obtain ⟨x, hx⟩ := hne + obtain ⟨D, -, hD, -, -, -, hDO, -⟩ := exists_closedDisc_nbhd hS hO hx + have hinf : (D \ Γ.V).Infinite := + ((infinite_of_isOArc hD.isOArc_discBd).mono (discBd_subset D)).sdiff Γ.finite_V + obtain ⟨p, hpD, hpV⟩ := hinf.nonempty + have hpO := hDO hpD + by_cases hpU : p ∈ Γ.U + · obtain ⟨e, he, hpe⟩ := Γ.exists_edge_of_mem hpU hpV + obtain ⟨W, A₁, -, -, hpW, -, -, -, -, hd₁, -, hc₁, -⟩ := + exists_edge_sides hS Γ he hpe + obtain ⟨q, hqO, hqA⟩ := mem_closure_iff.mp (hc₁ ⟨hpe, hpW⟩) O hO hpO + exact ⟨q, hqO, disjoint_left.mp hd₁ hqA⟩ + · exact ⟨p, hpO, hpU⟩ + +/-- Each point of the frontier of a closed nice set `T` is in the closure of a region outside `T`. +-/ +theorem exists_region_outside (hS : IsClosedSurface S) {T : Set S} (hTc : IsClosed T) + (hTn : IsGammaNice Γ T) + {b : S} (hb : b ∈ closure Tᶜ) : ∃ r ∈ Γ.R, r ⊆ Tᶜ ∧ b ∈ closure r := by + classical + have hfin : {r | r ∈ Γ.R ∧ r ⊆ Tᶜ}.Finite := (finite_R hS Γ).subset fun r hr => hr.1 + have hsub : Tᶜ ⊆ closure (⋃ r ∈ {r | r ∈ Γ.R ∧ r ⊆ Tᶜ}, r) := by + intro x hx + refine mem_closure_iff.mpr fun O hO hxO => ?_ + obtain ⟨y, ⟨hyO, hyT⟩, hyU⟩ := exists_off_U hS Γ (hO.inter hTc.isOpen_compl) ⟨x, hxO, hx⟩ + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem hyU + have hrT : r ⊆ Tᶜ := fun w hw hwT => hyT (nice_region hTn hr ⟨w, hw, hwT⟩ hyr) + exact ⟨y, hyO, mem_iUnion₂.mpr ⟨r, ⟨hr, hrT⟩, hyr⟩⟩ + have hb' := closure_minimal hsub isClosed_closure hb + rw [hfin.closure_biUnion] at hb' + obtain ⟨r, hr, hbr⟩ := mem_iUnion₂.mp hb' + exact ⟨r, hr.1, hr.2, hbr⟩ + +/-- The restraints through `c` with `l(X) = 0` are `{c}`, so that `Z₀ ≠ Σ`, as in the proof of +(8.12). -/ +theorem restraintUnion_zero_ne_univ (hS : IsClosedSurface S) + (hs : IsSlope Γ K ins) (c : S) : + restraintUnion Γ ins K c 0 ≠ univ := by + classical + intro hall + obtain ⟨X, hX, -⟩ := mem_iUnion₂.mp (hall ▸ mem_univ c : c ∈ restraintUnion Γ ins K c 0) + have hone : ∀ T, IsRestraint Γ ins K T → perimeterWalkLength Γ T ≤ 0 → c ∈ T → T ⊆ {c} := by + intro T hT hl hc x hx + obtain ⟨u, W, -, hlen, -, -, hd⟩ := hT.exists_walk hS + have hl0 : W.length = 0 := by omega + have hins := theorem_8_3_proof hS hs hT + rw [subBd_eq_frontier, ← hd] at hins + have hsup : ∀ y ∈ T, y = u := by + intro y hy + rw [← hins] at hy + have hed : W.edges = [] := List.length_eq_zero_iff.mp hl0 + have hE : ∀ e, e ∉ (walkDrawing Γ W).E := fun e => by + rw [walkDrawing_E] + simp [hed] + rcases hy with hy | hy + · rcases (mem_walkDrawing_U Γ W).mp hy with h | ⟨e, he, -⟩ + · cases W with + | nil _ => simpa [GraphWalk.support] using h + | cons _ _ => simp [GraphWalk.edges] at hed + · simp [hed] at he + · obtain ⟨C, ⟨hC, hCs⟩, -⟩ := mem_iUnion₂.mp hy + obtain ⟨e, he⟩ := IsCircuit.E_nonempty hC + exact (hE e (hCs.2 he)).elim + rw [mem_singleton_iff, hsup x hx, hsup c hc] + refine hX.1.ne_univ (eq_univ_of_forall fun y => ?_) + obtain ⟨T, hT, hyT⟩ := mem_iUnion₂.mp (hall ▸ mem_univ y : y ∈ restraintUnion Γ ins K c 0) + obtain rfl : y = c := hone T hT.1 hT.2.1 hT.2.2 hyT + exact hX.2.2 + +/-- **(8.12)** of Graph Minors XI (page 102): "If $c \in \Sigma$, there is a region $r$ of $\Gamma$ +such that there is no restraint $X$ +with $c \in X$ and $r \subseteq X$." -/ +theorem theorem_8_12_proof (hS : IsClosedSurface S) + (hs : IsSlope Γ K ins) (c : S) : + ∃ r ∈ Γ.R, ∀ X : Set S, IsRestraint Γ ins K X → ¬ (c ∈ X ∧ r ⊆ X) := by + classical + let Z : ℕ → Set S := fun k => restraintUnion Γ ins K c k + -- Choose `k` largest with `k < 2θ` and `Z_k ≠ Σ`. + have hK0 : 0 < K := by + have := hs.two_le + omega + have hex : ∃ k, K - 1 - k < K ∧ Z (K - 1 - k) ≠ univ := by + refine ⟨K - 1, by omega, ?_⟩ + have h0 : K - 1 - (K - 1) = 0 := by omega + rw [h0] + exact restraintUnion_zero_ne_univ hS hs c + obtain ⟨hkK, hkZ⟩ := Nat.find_spec hex + set k := K - 1 - Nat.find hex with hk + have hbig : ∀ m, k < m → m < K → Z m = univ := by + intro m hm hmK + by_contra hne + have hle := Nat.find_min' hex (m := K - 1 - m) ⟨by omega, by + have : K - 1 - (K - 1 - m) = m := by omega + rw [this] + exact hne⟩ + omega + have hZc : ∀ m, IsClosed (Z m) := fun m => isClosed_restraintUnion hS c m + have hZn : ∀ m, IsGammaNice Γ (Z m) := fun m => isGammaNice_restraintUnion c m + have hmem : ∀ {m T}, IsRestraint Γ ins K T → perimeterWalkLength Γ T ≤ m → c ∈ T → T ⊆ Z m := + fun {m T} hT hl hc x hx => mem_iUnion₂.mpr ⟨T, ⟨hT, hl, hc⟩, hx⟩ + obtain ⟨y₀, hy₀⟩ := (ne_univ_iff_exists_notMem _).mp hkZ + obtain ⟨y, ⟨-, hyZ⟩, hyU⟩ := exists_off_U hS Γ (isOpen_univ.inter (hZc k).isOpen_compl) ⟨y₀, + mem_univ _, hy₀⟩ + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem hyU + have hrZ : r ⊆ (Z k)ᶜ := fun w hw hwZ => hyZ (nice_region (hZn k) hr ⟨w, hw, hwZ⟩ hyr) + refine ⟨r, hr, fun X₀ hX₀ ⟨hcX₀, hrX₀⟩ => ?_⟩ + have hlX₀ := hX₀.length_lt + have hk1 : k + 1 < K := by + by_contra hge + have hle : perimeterWalkLength Γ X₀ ≤ k := by omega + exact hrZ hyr (hmem hX₀ hle hcX₀ (hrX₀ hyr)) + have hall := hbig (k + 1) (by omega) hk1 + -- A point off `Z_k` is in a restraint with `l ≤ k + 1`. + have hopt : ∀ z, z ∉ Z k → ∃ X', IsOptimalRestraint Γ ins K c z X' ∧ perimeterWalkLength Γ X' + = k + 1 := by + intro z hz + obtain ⟨T, hT, hzT⟩ := mem_iUnion₂.mp (hall ▸ mem_univ z : z ∈ Z (k + 1)) + obtain ⟨X', hX', hl⟩ := exists_optimal hT.1 hT.2.2 hzT + refine ⟨X', hX', le_antisymm (hl.trans hT.2.1) ?_⟩ + by_contra hlt + exact hz (hmem hX'.1 (by omega) hX'.2.1 hX'.2.2.1) + obtain ⟨T, hT, hyT⟩ := mem_iUnion₂.mp (hall ▸ mem_univ y : y ∈ Z (k + 1)) + obtain ⟨X, hX, hTX, hl⟩ := exists_extreme hS hT.1 + have hcX : c ∈ X := hTX hT.2.2 + have hyX : y ∈ X := hTX hyT + -- `bd(X) ⊄ Z_k`, by (8.11). + have hb : ¬ frontier X ⊆ Z k := fun hsub => + hyZ (theorem_8_11_proof hS hs hX.1 hcX hsub hyX) + obtain ⟨b, hbf, hbZ⟩ := not_subset.mp hb + have hbcl : b ∈ closure Xᶜ := by + rw [frontier_eq_closure_inter_closure] at hbf + exact hbf.2 + obtain ⟨r', hr', hr'X, hbr'⟩ := exists_region_outside hS hX.1.isClosed hX.1.isGammaNice hbcl + have hr'Z : r' ⊆ (Z k)ᶜ := fun w hw hwZ => + hbZ (closure_minimal (nice_region (hZn k) hr' ⟨w, hw, hwZ⟩) (hZc k) hbr') + obtain ⟨w, hw⟩ := region_nonempty hr' + obtain ⟨X', hX', hl'⟩ := hopt w (hr'Z hw) + have hr'X' : r' ⊆ X' := nice_region hX'.1.isGammaNice hr' ⟨w, hw, hX'.2.2.1⟩ + have hbX' : b ∈ X' := closure_minimal hr'X' hX'.1.isClosed hbr' + -- `X'` is `c, b`-optimal. + have hopt' : IsOptimalRestraint Γ ins K c b X' := by + refine ⟨hX'.1, hX'.2.1, hbX', fun U hU hcU hbU => ?_⟩ + rw [hl'] + by_contra hlt + exact hbZ (hmem hU (by omega) hcU hbU) + have hsub := theorem_8_9_proof hS hs hopt' hX hcX + (hX.1.isClosed.frontier_subset hbf) + exact hr'X hw (hsub (hr'X' hw)) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section810Connected.lean b/LeanPool/GraphMinor/GM11/Section810Connected.lean new file mode 100644 index 0000000000..6ff7d1ae7b --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section810Connected.lean @@ -0,0 +1,410 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section810Paths +public import LeanPool.GraphMinor.GM11.Theorem64 + +/-! +# Graph Minors XI, (8.10), when `Γ` is connected + +`restraintUnion` is the set `Z` of (8.10), the union of all restraints `X` with `l(X) ≤ k` and `c ∈ +X`. +`theorem_8_10_connected` is (8.10) for a connected drawing `Γ`, by the paper's argument (pages +101–102). +`restraint_down` and `restraint_up` compare the restraints of `Γ ∩ T` with those of `Γ`: the proof +of (8.10) +uses them for a component of `Γ`, and the proof of (8.11) for `Γ ∩ X`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] {Γ : Drawing S} + +/-- The set `Z` of (8.10): the union of all restraints `X` with `l(X) ≤ k` and `c ∈ X`. -/ +def restraintUnion (Γ : Drawing S) (ins : Drawing S → Set S) (K : ℕ) (c : S) (k : ℕ) : Set S := + ⋃ X ∈ {X : Set S | IsRestraint Γ ins K X ∧ perimeterWalkLength Γ X ≤ k ∧ c ∈ X}, X + +variable {k K : ℕ} {ins : Drawing S → Set S} + +omit [ConnectedSpace S] in +/-- There is a smallest restraint through `a` and `b`. -/ +theorem exists_optimal {a b : S} {X : Set S} (hX : IsRestraint Γ ins k X) (ha : a ∈ X) + (hb : b ∈ X) : + ∃ X', IsOptimalRestraint Γ ins k a b X' ∧ perimeterWalkLength Γ X' ≤ perimeterWalkLength Γ X + := by + classical + have hex : ∃ n, ∃ Y, IsRestraint Γ ins k Y ∧ a ∈ Y ∧ b ∈ Y ∧ perimeterWalkLength Γ Y = n := + ⟨_, X, hX, ha, hb, rfl⟩ + obtain ⟨Y, hY, h₁, h₂, hl⟩ := Nat.find_spec hex + refine ⟨Y, ⟨hY, h₁, h₂, fun Z hZ h₃ h₄ => ?_⟩, ?_⟩ + · rw [hl] + exact Nat.find_min' hex ⟨Z, hZ, h₃, h₄, rfl⟩ + · rw [hl] + exact Nat.find_min' hex ⟨X, hX, ha, hb, rfl⟩ + +/-- `Z` is closed, as a finite union of closed sets. -/ +theorem isClosed_restraintUnion (hS : IsClosedSurface S) (c : S) (k : ℕ) : + IsClosed (restraintUnion Γ ins K c k) := by + have hfin : {X | IsRestraint Γ ins K X ∧ perimeterWalkLength Γ X ≤ k ∧ c ∈ X}.Finite := + (finite_nice hS Γ).subset fun X hX => hX.1.isGammaNice + exact hfin.isClosed_biUnion fun X hX => hX.1.isClosed + +omit [ConnectedSpace S] in +/-- `Z` is nice. -/ +theorem isGammaNice_restraintUnion (c : S) (k : ℕ) : IsGammaNice Γ (restraintUnion Γ ins K c k) + := by + refine isGammaNice_of_sat fun a ha ⟨y, hya, hy⟩ => ?_ + obtain ⟨X, hX, hyX⟩ := mem_iUnion₂.mp hy + exact (nice_atom hX.1.isGammaNice ha ⟨y, hya, hyX⟩).trans fun z hz => mem_iUnion₂.mpr ⟨X, hX, hz⟩ + +omit [T2Space S] [ConnectedSpace S] in +/-- The vertices of `Γ ∩ T`, for a closed set `T`. -/ +theorem mem_interSet_V_iff [T2Space S] {T : Set S} (hT : IsClosed T) {x : S} : + x ∈ (Γ.interSet T).V ↔ x ∈ Γ.V ∧ x ∈ T := + ⟨fun h => ⟨(interSet_isSub (Γ := Γ)).1 h, interSet_U_subset hT ((Γ.interSet T).V_subset_U h)⟩, + fun h => mem_interSet_V h.1 h.2⟩ + +omit [T2Space S] [ConnectedSpace S] in +theorem mem_interSet_E_iff [T2Space S] {T e : Set S} : e ∈ (Γ.interSet T).E ↔ e ∈ Γ.E ∧ e ⊆ T := by + change e ∈ (Γ.span _ _).E ↔ _ + rw [Γ.span_E] + exact ⟨fun h => h.1, fun h => ⟨h, h.1⟩⟩ + +omit [ConnectedSpace S] in +/-- `(Γ ∩ X) ∩ F = Γ ∩ F`, for `F ⊆ X`. -/ +theorem interSet_interSet {X F : Set S} (hXc : IsClosed X) (hFc : IsClosed F) (hFX : F ⊆ X) : + (Γ.interSet X).interSet F = Γ.interSet F := by + apply Drawing.ext_of_V_E + · ext x + rw [mem_interSet_V_iff hFc, mem_interSet_V_iff hXc, mem_interSet_V_iff hFc] + exact ⟨fun h => ⟨h.1.1, h.2⟩, fun h => ⟨⟨h.1, hFX h.2⟩, h.2⟩⟩ + · ext e + rw [mem_interSet_E_iff, mem_interSet_E_iff, mem_interSet_E_iff] + exact ⟨fun h => ⟨h.1.1, h.2⟩, fun h => ⟨⟨h.1, h.2.trans hFX⟩, h.2⟩⟩ + +omit [ConnectedSpace S] in +/-- `l(T)` is the same in `Γ ∩ X` as in `Γ`, when `bd(T) ⊆ X`. -/ +theorem perimeterSum_interSet (hS : IsClosedSurface S) {X T : Set S} (hTc : IsClosed T) + (hTn : IsGammaNice Γ T) (hf : frontier T ⊆ X) : perimeterSum (Γ.interSet X) T + = perimeterSum Γ T := by + classical + unfold perimeterSum + refine Finset.sum_subset (fun e he => ?_) fun e he hen => ?_ + · exact Γ.finite_edges.mem_toFinset.mpr (mem_interSet_E_iff.mp ((Γ.interSet + X).finite_edges.mem_toFinset.mp he)).1 + · have heΓ := Γ.finite_edges.mem_toFinset.mp he + unfold perimeterCount + have hno : ¬ (e ∩ frontier T).Nonempty := by + rintro ⟨y, hye, hy⟩ + exact hen ((Γ.interSet X).finite_edges.mem_toFinset.mpr + (mem_interSet_E_iff.mpr ⟨heΓ, (edge_subset_frontier hS hTc hTn heΓ hye hy).trans hf⟩)) + simp [hno] + +/-- A restraint of `Γ` with boundary in `X` is a restraint of `Γ ∩ X`, with the same `l`. -/ +theorem restraint_down (hS : IsClosedSurface S) + {X T : Set S} (hXc : IsClosed X) (hT : IsRestraint Γ ins k T) + (hf : frontier T ⊆ X) : + IsRestraint (Γ.interSet X) ins k T ∧ + perimeterWalkLength (Γ.interSet X) T = perimeterWalkLength Γ T := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hTc := hT.isClosed + have hTn := hT.isGammaNice + have hn' : IsGammaNice (Γ.interSet X) T := by + refine isGammaNice_of_frontier (N := Γ.interSet (frontier T)) ?_ + ((interSet_U_subset isClosed_frontier).trans hTc.frontier_subset) + (frontier_interSet hS hTc hTn).ge + refine ⟨fun x hx => ?_, fun f hf' => ?_⟩ + · obtain ⟨h₁, h₂⟩ := (mem_interSet_V_iff isClosed_frontier).mp hx + exact (mem_interSet_V_iff hXc).mpr ⟨h₁, hf h₂⟩ + · obtain ⟨h₁, h₂⟩ := mem_interSet_E_iff.mp hf' + exact mem_interSet_E_iff.mpr ⟨h₁, h₂.trans hf⟩ + have hl : perimeterWalkLength (Γ.interSet X) T = perimeterWalkLength Γ T := by + rw [perimeterWalkLength_eq hS hTc hn' hT.isSimplyConnected hT.nonempty hT.ne_univ, + perimeterWalkLength_eq hS hTc hTn hT.isSimplyConnected hT.nonempty hT.ne_univ, + perimeterSum_interSet hS hTc hTn hf] + refine ⟨⟨hT.nonempty, hTc, hT.isSimplyConnected, hn', hl ▸ hT.length_lt, ?_⟩, hl⟩ + rw [subBd_eq_frontier, interSet_interSet hXc isClosed_frontier hf, ← subBd_eq_frontier] + exact hT.compl_not_subset + +/-- A restraint of `Γ ∩ X` is a restraint of `Γ` with boundary in `X`, with the same `l`. -/ +theorem restraint_up (hS : IsClosedSurface S) + {X T : Set S} (hXc : IsClosed X) + (hT : IsRestraint (Γ.interSet X) ins k T) : + IsRestraint Γ ins k T ∧ frontier T ⊆ X ∧ + perimeterWalkLength Γ T = perimeterWalkLength (Γ.interSet X) T := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hTc := hT.isClosed + have hTn := hT.isGammaNice + have hfU := frontier_interSet hS hTc hTn + have hf : frontier T ⊆ X := by + rw [← hfU] + exact (interSet_isSub (Γ := Γ.interSet X)).U_subset.trans (interSet_U_subset hXc) + have hn' : IsGammaNice Γ T := by + refine isGammaNice_of_frontier (N := (Γ.interSet X).interSet (frontier T)) + (interSet_isSub.trans interSet_isSub) + ((interSet_U_subset isClosed_frontier).trans hTc.frontier_subset) hfU.ge + have hl : perimeterWalkLength Γ T = perimeterWalkLength (Γ.interSet X) T := by + rw [perimeterWalkLength_eq hS hTc hn' hT.isSimplyConnected hT.nonempty hT.ne_univ, + perimeterWalkLength_eq hS hTc hTn hT.isSimplyConnected hT.nonempty hT.ne_univ, + perimeterSum_interSet hS hTc hn' hf] + refine ⟨⟨hT.nonempty, hTc, hT.isSimplyConnected, hn', hl ▸ hT.length_lt, ?_⟩, hf, hl⟩ + have := hT.compl_not_subset + rw [subBd_eq_frontier, interSet_interSet hXc isClosed_frontier hf, ← subBd_eq_frontier] at this + exact this + +/-! ## The connected case -/ + +omit [ConnectedSpace S] in +/-- An `O`-arc in `U(Γ)` meets `V(Γ)`. Otherwise it would lie in one edge, since an `O`-arc minus a +point +is path-connected, and an edge includes no `O`-arc. -/ +theorem exists_vertex_of_oArc [ConnectedSpace S] {F : Set S} (hF : IsOArc F) (hFU : F ⊆ Γ.U) : + ∃ v ∈ F, v ∈ Γ.V := by + classical + by_contra! h + have hin : ∀ p ∈ F, ∃ e ∈ Γ.E, F \ {p} ⊆ e := by + intro p hp + have hc := isPathConnected_oArc_diff hF hp + have hsub : F \ {p} ⊆ Γ.U \ Γ.V := fun x hx => ⟨hFU hx.1, h x hx.1⟩ + obtain ⟨y, hy⟩ := hc.nonempty + obtain ⟨e, he, hye⟩ := Γ.exists_edge_of_mem (hsub hy).1 (hsub hy).2 + have hun : IsPathConnected (e ∪ (F \ {p})) := he.2.2.1.union hc ⟨y, hye, hy⟩ + have := he.2.2.2 _ (union_subset he.2.1 hsub) hun subset_union_left + exact ⟨e, he, by rw [← this]; exact subset_union_right⟩ + obtain ⟨p, q, r, hp, hq, hr, hpq, hpr, hqr⟩ : + ∃ p q r, p ∈ F ∧ q ∈ F ∧ r ∈ F ∧ p ≠ q ∧ p ≠ r ∧ q ≠ r := by + obtain ⟨t, ht, h3⟩ := (infinite_of_isOArc hF).exists_subset_card_eq 3 + obtain ⟨p, q, r, hpq, hpr, hqr, hpqr⟩ := Finset.card_eq_three.mp h3 + rw [hpqr] at ht + exact ⟨p, q, r, ht (by simp), ht (by simp), ht (by simp), hpq, hpr, hqr⟩ + obtain ⟨e, he, hpe⟩ := hin p hp + obtain ⟨e', he', hqe⟩ := hin q hq + have hee : e = e' := Γ.edge_eq_of_mem he he' (hpe ⟨hr, hpr.symm⟩) (hqe ⟨hr, hqr.symm⟩) + subst hee + refine not_oArc_subset_edge he hF fun x hx => ?_ + by_cases hxp : x = p + · exact hqe ⟨hx, hxp ▸ hpq⟩ + · exact hpe ⟨hx, hxp⟩ + +/-- A parametrization of the circle from `[0, 1]` meets a finite set at finitely many times. -/ +theorem finite_arcParam_preimage (z : Circle) {B : Set Circle} (hB : B.Finite) : + {t : I | arcParam z t ∈ B}.Finite := by + refine hB.preimage' fun b _ => ?_ + rcases (arcParam z ⁻¹' {b}).eq_empty_or_nonempty with h | ⟨t₀, ht₀⟩ + · rw [h] + exact finite_empty + refine (finite_singleton t₀ |>.insert 0 |>.insert 1).subset fun t ht => ?_ + have e : arcParam z t = arcParam z t₀ := ht.trans ht₀.symm + rcases arcParam_eq_iff z e with h | ⟨h, -⟩ | ⟨h, -⟩ + · exact Or.inr (Or.inr h) + · exact Or.inr (Or.inl h) + · exact Or.inl h + +/-- **(8.10)** of Graph Minors XI (pages 100–101), when `Γ` is connected, by the paper's argument. +-/ +theorem theorem_8_10_connected (hS : IsClosedSurface S) (hs : IsSlope Γ K ins) (hΓ : Γ.IsConnected) + {c : S} (hne : (restraintUnion Γ ins K c k).Nonempty) : + IsSimplyConnectedSet (restraintUnion Γ ins K c k) := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + set Z := restraintUnion Γ ins K c k with hZdef + have hZc : IsClosed Z := isClosed_restraintUnion hS c k + have hZn : IsGammaNice Γ Z := isGammaNice_restraintUnion c k + have hmemZ : ∀ x, x ∈ Z → ∃ X, IsRestraint Γ ins K X ∧ perimeterWalkLength Γ X ≤ k ∧ c ∈ X + ∧ x ∈ X := by + intro x hx + obtain ⟨X, hX, hxX⟩ := mem_iUnion₂.mp hx + exact ⟨X, hX.1, hX.2.1, hX.2.2, hxX⟩ + have hsubZ : ∀ X, IsRestraint Γ ins K X → perimeterWalkLength Γ X ≤ k → c ∈ X → X ⊆ Z := + fun X h₁ h₂ h₃ x hx => mem_iUnion₂.mpr ⟨X, ⟨h₁, h₂, h₃⟩, hx⟩ + obtain ⟨u, huV, hu⟩ := exists_vertex_mem_nice hS hΓ.1 c + have huZ : u ∈ Z := by + obtain ⟨z, hz⟩ := hne + obtain ⟨X, hX, hl, hc, -⟩ := hmemZ z hz + exact hsubZ X hX hl hc (hu X hX.isClosed hX.isGammaNice hc) + let uZ : Z := ⟨u, huZ⟩ + -- "For each $v \in V(\Gamma) \cap Z$, let $X_v$ be a $c, v$-optimal restraint", and the walk + -- `P_v`. + have hP : ∀ x : Z, x.1 ∈ Γ.V → ∃ X : Set S, ∃ p : Path x uZ, + IsOptimalRestraint Γ ins K c x.1 X ∧ ∀ t, (p t).1 ∈ X ∩ Γ.U := by + intro x hx + obtain ⟨X', hX', hl', hc', hxX'⟩ := hmemZ x.1 x.2 + obtain ⟨X, hX, hl⟩ := exists_optimal hX' hc' hxX' + have hXZ : X ⊆ Z := hsubZ X hX.1 (hl.trans hl') hX.2.1 + have huX : u ∈ X := hu X hX.1.isClosed hX.1.isGammaNice hX.2.1 + obtain ⟨p, hp⟩ := joinedIn_of_restraint hS hΓ hX.1 hx hX.2.2.1 huV huX + exact ⟨X, pathCod p x.2 huZ fun t => hXZ (hp t).1, hX, fun t => hp t⟩ + choose Xv pv hXv using hP + let f : ∀ x : Z, x.1 ∈ Γ.V → Cl x uZ := fun x hx => Cl.mk (pv x hx) + have hrange : ∀ {a b d : Z} (p : Path a b) (q : Path b d) (A : Set S), (∀ t, (p t).1 ∈ A) → + (∀ t, (q t).1 ∈ A) → ∀ t, ((p.trans q) t).1 ∈ A := by + intro a b d p q A hp hq t + have : (p.trans q) t ∈ range p ∪ range q := by + rw [← Path.trans_range] + exact mem_range_self t + rcases this with ⟨v, hv⟩ | ⟨v, hv⟩ + · rw [← hv]; exact hp v + · rw [← hv]; exact hq v + -- Claim (1). + have h1 : ∀ e ∈ Γ.E, e ⊆ Z → ∀ (x y : Z) (hx : x.1 ∈ Γ.V) (hy : y.1 ∈ Γ.V) (q : Path x y), + (∀ t, (q t).1 ∈ closure e) → Cl.mk q = (f x hx).trans (f y hy).symm := by + intro e he heZ x y hx hy q hq + obtain ⟨z, hz⟩ := he.1 + obtain ⟨X', hX', hl', hc', hzX'⟩ := hmemZ z (heZ hz) + -- "Let $X$ be a $c, e$-extreme restraint." + obtain ⟨X, hXe, hX'X, hl⟩ := exists_extreme hS hX' + have heX : closure e ⊆ X := + closure_minimal ((nice_edge hX'.isGammaNice he ⟨z, hz, hzX'⟩).trans hX'X) hXe.1.isClosed + have hXZ : X ⊆ Z := hsubZ X hXe.1 (hl.trans hl') (hX'X hc') + have hxX : x.1 ∈ X := heX (by simpa using hq 0) + have hyX : y.1 ∈ X := heX (by simpa using hq 1) + -- "$X_{v_1} \subseteq X$ by (8.9)." + have hsx : Xv x hx ⊆ X := theorem_8_9_proof hS hs (hXv x hx).1 hXe (hX'X hc') hxX + have hsy : Xv y hy ⊆ X := theorem_8_9_proof hS hs (hXv y hy).1 hXe (hX'X hc') hyX + have huX : u ∈ X := hu X hXe.1.isClosed hXe.1.isGammaNice (hX'X hc') + have hflat := homotopic_of_mem hXe.1.isSimplyConnected hXZ (q.trans (pv y hy)) (pv x hx) hxX huX + (hrange q (pv y hy) X (fun t => heX (hq t)) fun t => hsy ((hXv y hy).2 t).1) + fun t => hsx ((hXv x hx).2 t).1 + have key : (Cl.mk q).trans (f y hy) = f x hx := by + rw [← Path.Homotopic.Quotient.mk_trans] + exact Path.Homotopic.Quotient.eq.mpr hflat + rw [← key, cl_assoc, cl_trans_symm, cl_trans_refl] + -- Claim (2), for an `O`-arc of `U(Γ ∩ Z)`. + have hnullF : ∀ F, IsOArc F → F ⊆ Γ.U → F ⊆ Z → IsNullHomotopicOArcIn Z F := by + intro F hF hFU hFZ + obtain ⟨v, hvF, hvV⟩ := exists_vertex_of_oArc hF hFU + obtain ⟨ψ⟩ := hF + let z : Circle := ψ.symm ⟨v, hvF⟩ + let φ : C(Circle, S) := ⟨fun x => (ψ x).1, continuous_subtype_val.comp ψ.continuous⟩ + have hφz : φ z = v := by simp [φ, z] + let a : Z := ⟨v, hFZ hvF⟩ + let γ : Path a a := + ⟨⟨fun t => ⟨φ (arcParam z t), hFZ (ψ _).2⟩, by fun_prop⟩, + Subtype.ext (by simpa [arcParam_apply] using hφz), + Subtype.ext (by simpa [arcParam_apply] using hφz)⟩ + have hγ : ∀ t, (γ t).1 = φ (arcParam z t) := fun t => rfl + have hfin : {t : I | (γ t).1 ∈ Γ.V}.Finite := by + have hB : {w : Circle | φ w ∈ Γ.V}.Finite := + Γ.finite_V.preimage fun w _ w' _ h => ψ.injective (Subtype.ext h) + exact finite_arcParam_preimage z hB + have hcl := cl_path_of_edges (Γ := Γ) (fun e he hne => nice_edge hZn he hne) f h1 γ + (fun t => hFU (ψ _).2) hfin hvV hvV + rw [cl_trans_symm] at hcl + refine ⟨ψ, v, hFZ hvF, closedCurvesHomotopicIn_of_path z φ (ContinuousMap.const _ v) γ + (Path.refl a) hγ (fun _ => rfl) (Path.Homotopic.Quotient.eq.mp hcl)⟩ + -- "$Z$ is the union of $U(\Gamma \cap Z)$ with some closed discs with boundary in $U(\Gamma \cap + -- Z)$." + let X₀ : Set S := Z ∩ Γ.U + have hX₀c : IsClosed X₀ := hZc.inter Γ.isClosed_U + have hUn : IsGammaNice Γ Γ.U := + isGammaNice_of_frontier (Drawing.IsSubdrawing.refl Γ) subset_rfl Γ.isClosed_U.frontier_subset + have hX₀n : IsGammaNice Γ X₀ := hZn.inter hUn + -- "$U(\Gamma \cap Z)$ is arc-wise connected": every point is joined to `u` along the walks `P_v`. + have hX₀p : IsPathConnected X₀ := by + have hv : ∀ x : Z, ∀ hx : x.1 ∈ Γ.V, JoinedIn X₀ x.1 u := fun x hx => + ⟨(pv x hx).map continuous_subtype_val, fun t => ⟨(pv x hx t).2, ((hXv x hx).2 t).2⟩⟩ + refine ⟨u, ⟨huZ, Γ.V_subset_U huV⟩, fun {x} hx => ?_⟩ + by_cases hxV : x ∈ Γ.V + · exact (hv ⟨x, hx.1⟩ hxV).symm + obtain ⟨e, he, hxe⟩ := Γ.exists_edge_of_mem hx.2 hxV + have heZ : closure e ⊆ Z := closure_minimal (nice_edge hZn he ⟨x, hxe, hx.1⟩) hZc + obtain ⟨w, hw⟩ : ∃ w, w ∈ closure e ∩ Γ.V := by + rcases Γ.edge_cond e he with ⟨w, w', hww, hcap, -⟩ | ⟨w, hcap, -⟩ + · exact ⟨w, by rw [hcap]; exact Or.inl rfl⟩ + · exact ⟨w, by rw [hcap]; exact rfl⟩ + have hj : JoinedIn X₀ x w := + ((isPathConnected_closure_edge he).joinedIn x (subset_closure hxe) w hw.1).mono + fun y hy => ⟨heZ hy, Γ.closure_subset_U he hy⟩ + exact (hj.trans (hv ⟨w, heZ hw.1⟩ hw.2)).symm + let Cs : Set (Drawing S) := {C | ∃ X, (IsRestraint Γ ins K X ∧ perimeterWalkLength Γ X ≤ k + ∧ c ∈ X) ∧ + C.IsCircuit ∧ C.IsSubdrawing (Γ.interSet (frontier X))} + have hCs : Cs.Finite := (finite_circuits Γ).subset fun C ⟨X, _, hC, hCs⟩ => + ⟨hC, hCs.trans (Drawing.span_isSubdrawing Γ _ _)⟩ + let L : List (Set S) := hCs.toFinset.toList.map ins + have hmemL : ∀ Y ∈ L, ∃ C ∈ Cs, ins C = Y := by + intro Y hY + obtain ⟨C, hC, rfl⟩ := List.mem_map.mp hY + exact ⟨C, hCs.mem_toFinset.mp (Finset.mem_toList.mp hC), rfl⟩ + have hCfacts : ∀ C ∈ Cs, IsClosedDisc (ins C) ∧ frontier (ins C) ⊆ X₀ ∧ IsGammaNice Γ (ins C) ∧ + ins C ⊆ Z := by + rintro C ⟨X, hX, hC, hCX⟩ + have hCΓ : C.IsSubdrawing Γ := hCX.trans (Drawing.span_isSubdrawing Γ _ _) + have hl : C.length < K := hX.1.isConfined hS C hC hCX + have hf := ins_slope_facts hS hs hC hCΓ hl + have h83 := theorem_8_3_proof hS hs hX.1 + rw [subBd_eq_frontier] at h83 + have hXZ := hsubZ X hX.1 hX.2.1 hX.2.2 + refine ⟨hs.isClosedDisc C hC hCΓ hl, ?_, hf.2.2, ?_⟩ + · rw [hf.1] + intro y hy + have hy' := hCX.U_subset hy + exact ⟨hXZ (hX.1.isClosed.frontier_subset (interSet_U_subset isClosed_frontier hy')), + hCΓ.U_subset hy⟩ + · refine subset_trans ?_ (h83 ▸ hXZ) + exact (subset_biUnion_of_mem (u := ins) (show C ∈ {C | C.IsCircuit ∧ + C.IsSubdrawing (Γ.interSet (frontier X))} from ⟨hC, hCX⟩)).trans subset_union_right + have heq : Z = withDiscs X₀ L := by + apply subset_antisymm + · intro x hx + obtain ⟨X, hX, hl, hc, hxX⟩ := hmemZ x hx + have h83 := theorem_8_3_proof hS hs hX + rw [subBd_eq_frontier] at h83 + rw [← h83] at hxX + rcases hxX with hxU | hxC + · exact Or.inl ⟨hx, (Drawing.span_isSubdrawing Γ _ _).U_subset hxU⟩ + · obtain ⟨C, ⟨hC, hCX⟩, hxC⟩ := mem_iUnion₂.mp hxC + have hCm : C ∈ Cs := ⟨X, ⟨hX, hl, hc⟩, hC, hCX⟩ + exact Or.inr (mem_iUnion₂.mpr ⟨ins C, List.mem_map.mpr ⟨C, Finset.mem_toList.mpr + (hCs.mem_toFinset.mpr hCm), rfl⟩, hxC⟩) + · rintro x (hx | hx) + · exact hx.1 + · obtain ⟨Y, hY, hxY⟩ := mem_iUnion₂.mp hx + obtain ⟨C, hC, rfl⟩ := hmemL Y hY + exact (hCfacts C hC).2.2.2 hxY + have hsub : ∀ L' : List (Set S), (∀ Y ∈ L', Y ∈ L) → + IsClosed (withDiscs X₀ L') ∧ IsGammaNice Γ (withDiscs X₀ L') := by + intro L' hL' + have hY : ∀ Y ∈ L', IsClosedDisc Y ∧ IsGammaNice Γ Y := fun Y hY' => by + obtain ⟨C, hC, rfl⟩ := hmemL Y (hL' Y hY') + exact ⟨(hCfacts C hC).1, (hCfacts C hC).2.2.1⟩ + refine ⟨hX₀c.union (L'.finite_toSet.isClosed_biUnion fun Y hY' => + (hY Y hY').1.isCompact.isClosed), + isGammaNice_of_sat fun a ha hne => ?_⟩ + obtain ⟨x, hxa, hx | hx⟩ := hne + · exact (nice_atom hX₀n ha ⟨x, hxa, hx⟩).trans subset_union_left + · obtain ⟨Y, hY', hxY⟩ := mem_iUnion₂.mp hx + refine (nice_atom (hY Y hY').2 ha ⟨x, hxa, hxY⟩).trans ?_ + exact (subset_biUnion_of_mem (u := id) (s := {Y | Y ∈ L'}) hY').trans subset_union_right + -- "so $Z$ is simply-connected, from (2), (7.3), and (7.11)." + rw [heq] + refine theorem_7_11_proof hS hX₀c hX₀p (fun Y hY => ?_) ?_ ?_ + · obtain ⟨C, hC, rfl⟩ := hmemL Y hY + exact ⟨(hCfacts C hC).1, (hCfacts C hC).2.1⟩ + · intro Y L' hsuf hcap + have hsubL : ∀ W ∈ Y :: L', W ∈ L := fun W hW => hsuf.subset hW + obtain ⟨C, hC, rfl⟩ := hmemL Y (hsubL Y List.mem_cons_self) + have hL' := hsub L' fun W hW => hsubL W (List.mem_cons_of_mem _ hW) + exact nice_31 S hS Γ _ _ (hCfacts C hC).1.isCompact.isClosed hL'.1 (hCfacts C hC).2.2.1 hL'.2 + (IsClosedDisc.isSimplyConnectedSet (hCfacts C hC).1) hcap + · intro φ hφ + rw [← heq] + by_contra hnot + obtain ⟨F, hF, hFφ, hFn⟩ := nice_73 S hS Γ Z hZc hZn φ (hφ.trans inter_subset_left) hnot + exact hFn (hnullF F hF (fun x hx => (hφ (hFφ hx)).2) fun x hx => (hφ (hFφ hx)).1) + + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section810Paths.lean b/LeanPool/GraphMinor/GM11/Section810Paths.lean new file mode 100644 index 0000000000..307ed97627 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section810Paths.lean @@ -0,0 +1,321 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section89 + +/-! +# Paths along a drawing, for the proof of (8.10) + +The proof of (8.10) in Graph Minors XI (pages 101–102) joins each vertex `v` of `Γ ∩ Z` to a fixed +vertex `u` +by a walk `P_v`, and shows that a closed walk of `Γ ∩ Z` is null-homotopic in `Z` because each of +its edges +`e` with ends `v₁, v₂` is homotopic to `P_{v₁} + P_{v₂}⁻¹` (claim (1)), so that the sum telescopes +(claim (2)). This file has the tools. + +* `cl_path_eq` is the telescoping sum, for a path cut at finitely many points. We work with homotopy + classes of paths (`Cl`), in which the sum is associative. +* `cl_path_of_edges` is claim (2) for a path that runs along `Γ`: if claim (1) holds for every piece + of + the path that lies in the closure of one edge, then the path is homotopic to `P_a + P_b⁻¹`. +* `exists_vertex_mem_nice` gives the vertex `u` of the paper: a vertex in every closed nice set that + contains `c`. +* `joinedIn_of_restraint` is the paper's reason for the walk `P_v`: "Since $\Gamma \cap bd(X_v)$ is + connected and so is $\Gamma$, and $u, v \in X_v$, there is a simple walk $P_v$ of $\Gamma$ from + $v$ to + $u$ with $U(P_v) \subseteq X_v$." We keep only the curve of the walk, which is what the proof + uses. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +/-! ## The telescoping sum -/ + +section Telescope + +variable {T : Type*} [TopologicalSpace T] + +/-- **The telescoping sum along a path.** The points `x` with `P x` carry classes `f x` of paths +from +`x` to a fixed point `c`. If `γ` meets such points only finitely often, and each piece of `γ` +between +two consecutive such points is homotopic to `f x + (f y)⁻¹`, then so is every piece of `γ` between +two +such points. -/ +theorem cl_subpath_eq {c a b : T} (P : T → Prop) (f : ∀ x, P x → Cl x c) (γ : Path a b) + (hfin : {t : I | P (γ t)}.Finite) + (hstep : ∀ s t : I, s < t → ∀ (hs : P (γ s)) (ht : P (γ t)), (∀ r, s < r → r < t → ¬ P (γ r)) → + Cl.mk (γ.subpath s t) = (f _ hs).trans (f _ ht).symm) + {s t : I} (hst : s ≤ t) (hs : P (γ s)) (ht : P (γ t)) : + Cl.mk (γ.subpath s t) = (f _ hs).trans (f _ ht).symm := by + classical + suffices key : ∀ n : ℕ, ∀ s t : I, s ≤ t → ∀ (hs : P (γ s)) (ht : P (γ t)), + {r : I | s < r ∧ r < t ∧ P (γ r)}.ncard = n → + Cl.mk (γ.subpath s t) = (f _ hs).trans (f _ ht).symm from key _ s t hst hs ht rfl + intro n + induction n using Nat.strong_induction_on with + | _ n ih => + intro s t hst hs ht hn + by_cases hex : ∃ r, s < r ∧ r < t ∧ P (γ r) + · obtain ⟨r, hsr, hrt, hr⟩ := hex + have hfin' : {r' : I | s < r' ∧ r' < t ∧ P (γ r')}.Finite := hfin.subset fun r' h => h.2.2 + have h₁ : {r' : I | s < r' ∧ r' < r ∧ P (γ r')}.ncard < n := by + rw [← hn] + refine ncard_lt_ncard ⟨fun r' h => ⟨h.1, h.2.1.trans hrt, h.2.2⟩, fun h => ?_⟩ hfin' + exact lt_irrefl r (h ⟨hsr, hrt, hr⟩).2.1 + have h₂ : {r' : I | r < r' ∧ r' < t ∧ P (γ r')}.ncard < n := by + rw [← hn] + refine ncard_lt_ncard ⟨fun r' h => ⟨hsr.trans h.1, h.2.1, h.2.2⟩, fun h => ?_⟩ hfin' + exact lt_irrefl r (h ⟨hsr, hrt, hr⟩).1 + have e := Path.Homotopic.mk_subpath_trans_mk_subpath γ s r t + change (Cl.mk (γ.subpath s r)).trans (Cl.mk (γ.subpath r t)) = Cl.mk (γ.subpath s t) at e + rw [← e, ih _ h₁ s r hsr.le hs hr rfl, ih _ h₂ r t hrt.le hr ht rfl, cl_assoc, + ← cl_assoc (f _ hr).symm, cl_symm_trans, cl_refl_trans] + · push Not at hex + rcases hst.lt_or_eq with hlt | rfl + · exact hstep s t hlt hs ht fun r h₁ h₂ => hex r h₁ h₂ + · rw [Path.subpath_self, cl_trans_symm] + rfl + +/-- `cl_subpath_eq` for the whole path. -/ +theorem cl_path_eq {c a b : T} (P : T → Prop) (f : ∀ x, P x → Cl x c) (γ : Path a b) + (hfin : {t : I | P (γ t)}.Finite) + (hstep : ∀ s t : I, s < t → ∀ (hs : P (γ s)) (ht : P (γ t)), (∀ r, s < r → r < t → ¬ P (γ r)) → + Cl.mk (γ.subpath s t) = (f _ hs).trans (f _ ht).symm) + (ha : P a) (hb : P b) : + Cl.mk γ = (f a ha).trans (f b hb).symm := by + rcases γ with ⟨g, rfl, rfl⟩ + have h := cl_subpath_eq P f ⟨g, rfl, rfl⟩ hfin hstep zero_le_one ha hb + rwa [Path.subpath_zero_one] at h + +end Telescope + +/-! ## Paths that run along a drawing -/ + +variable {S : Type u} [TopologicalSpace S] + +/-- **Claim (2) of (8.10), for a path along `Γ`.** Let `Z ⊆ Σ` be a union of atoms, and let each +vertex +`x ∈ Z` carry a class `f x` of paths in `Z` from `x` to `c`. Suppose that every path in `Z` between +two +vertices that stays in the closure of an edge `e ⊆ Z` is homotopic to `f x + (f y)⁻¹` (claim (1)). +Then so is every path in `Z` between vertices that stays in `U(Γ)` and meets `V(Γ)` only finitely +often. -/ +theorem cl_path_of_edges {Γ : Drawing S} {Z : Set S} {c : Z} + (hZe : ∀ e ∈ Γ.E, (e ∩ Z).Nonempty → e ⊆ Z) + (f : ∀ x : Z, x.1 ∈ Γ.V → Cl x c) + (h1 : ∀ e ∈ Γ.E, e ⊆ Z → ∀ (x y : Z) (hx : x.1 ∈ Γ.V) (hy : y.1 ∈ Γ.V) (q : Path x y), + (∀ u, (q u).1 ∈ closure e) → Cl.mk q = (f x hx).trans (f y hy).symm) + {a b : Z} (γ : Path a b) (hU : ∀ t, (γ t).1 ∈ Γ.U) (hfin : {t : I | (γ t).1 ∈ Γ.V}.Finite) + (ha : a.1 ∈ Γ.V) (hb : b.1 ∈ Γ.V) : + Cl.mk γ = (f a ha).trans (f b hb).symm := by + refine cl_path_eq (fun x : Z => x.1 ∈ Γ.V) f γ hfin (fun s t hst hs ht hno => ?_) ha hb + let g : ℝ → S := fun x => (γ.extend x).1 + have hg : Continuous g := continuous_subtype_val.comp γ.continuous_extend + have hgI : ∀ r : I, g r = (γ r).1 := fun r => by simp [g] + have hst' : (s : ℝ) < t := hst + let A := g '' Ioo (s : ℝ) t + have hAc : IsPathConnected A := + ((convex_Ioo (s : ℝ) t).isPathConnected (nonempty_Ioo.mpr hst')).image hg + have hmem : ∀ x ∈ Ioo (s : ℝ) t, ∃ r : I, s < r ∧ r < t ∧ g x = (γ r).1 := by + intro x hx + refine ⟨⟨x, s.2.1.trans hx.1.le, hx.2.le.trans t.2.2⟩, hx.1, hx.2, ?_⟩ + rw [← hgI] + have hAUV : A ⊆ Γ.U \ Γ.V := by + rintro _ ⟨x, hx, rfl⟩ + obtain ⟨r, h₁, h₂, he⟩ := hmem x hx + rw [he] + exact ⟨hU r, hno r h₁ h₂⟩ + obtain ⟨y, hy⟩ := hAc.nonempty + obtain ⟨e, he, hye⟩ := Γ.exists_edge_of_mem (hAUV hy).1 (hAUV hy).2 + have hAe : A ⊆ e := by + have hun : IsPathConnected (e ∪ A) := he.2.2.1.union hAc ⟨y, hye, hy⟩ + have := he.2.2.2 (e ∪ A) (union_subset he.2.1 hAUV) hun subset_union_left + rw [← this] + exact subset_union_right + have hAZ : A ⊆ Z := by + rintro _ ⟨x, hx, rfl⟩ + obtain ⟨r, -, -, he⟩ := hmem x hx + rw [he] + exact (γ r).2 + have heZ : e ⊆ Z := hZe e he ⟨y, hye, hAZ hy⟩ + refine h1 e he heZ _ _ hs ht _ fun u => ?_ + have hu : (γ.subpath s t) u ∈ γ '' Icc s t := by + rw [← Path.range_subpath_of_le _ _ _ hst.le] + exact mem_range_self u + obtain ⟨r, hr, hru⟩ := hu + rw [← hru, ← hgI] + have hr' : (r : ℝ) ∈ closure (Ioo (s : ℝ) t) := by + rw [closure_Ioo hst'.ne] + exact hr + exact closure_mono hAe (image_closure_subset_closure_image hg (mem_image_of_mem g hr')) + +/-! ## The vertex `u` -/ + +variable [T2Space S] + +omit [T2Space S] in +/-- **The vertex `u` of the proof of (8.10).** "Choose $u \in V(\Gamma)$ such that $u = c$ if +$c \in V(\Gamma)$, $u \in \bar{e}$ if $c \in e$ for some edge $e$ of $\Gamma$, $u \in \bar{r}$ if +$c \in r$ for some region $r$ of $\Gamma$." Such a `u` lies in every closed nice set that contains +`c`. -/ +theorem exists_vertex_mem_nice [ConnectedSpace S] (hS : IsClosedSurface S) {Γ : Drawing S} + (hV : Γ.V.Nonempty) (c : S) : + ∃ u ∈ Γ.V, ∀ X : Set S, IsClosed X → IsGammaNice Γ X → c ∈ X → u ∈ X := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hedge : ∀ e ∈ Γ.E, ∃ u ∈ Γ.V, u ∈ closure e := by + intro e he + rcases Γ.edge_cond e he with ⟨u, v, -, hcap, -⟩ | ⟨u, hcap, -⟩ + · have : u ∈ closure e ∩ Γ.V := by rw [hcap]; exact Or.inl rfl + exact ⟨u, this.2, this.1⟩ + · have : u ∈ closure e ∩ Γ.V := by rw [hcap]; exact rfl + exact ⟨u, this.2, this.1⟩ + by_cases hcV : c ∈ Γ.V + · exact ⟨c, hcV, fun X _ _ hc => hc⟩ + by_cases hcU : c ∈ Γ.U + · obtain ⟨e, he, hce⟩ := Γ.exists_edge_of_mem hcU hcV + obtain ⟨u, hu, hue⟩ := hedge e he + refine ⟨u, hu, fun X hXc hXn hc => ?_⟩ + exact closure_minimal (nice_edge hXn he ⟨c, hce, hc⟩) hXc hue + obtain ⟨r, hr, hcr⟩ := exists_region_of_notMem hcU + have hro : IsOpen r := region_isOpen hr + have hrne : r ≠ univ := by + obtain ⟨v, hv⟩ := hV + intro h + exact region_subset hr (h ▸ mem_univ v) (Γ.V_subset_U hv) + obtain ⟨p, hp⟩ := nonempty_frontier_iff.mpr ⟨⟨c, hcr⟩, hrne⟩ + have hpr : p ∈ closure r := frontier_subset_closure hp + have hpU : p ∈ Γ.U := by + rcases closure_region_subset hr hpr with h | h + · exact absurd h (hro.frontier_eq ▸ hp).2 + · exact h + have key : ∃ u ∈ Γ.V, u ∈ closure r := by + by_cases hpV : p ∈ Γ.V + · exact ⟨p, hpV, hpr⟩ + obtain ⟨e, he, hpe⟩ := Γ.exists_edge_of_mem hpU hpV + obtain ⟨u, hu, hue⟩ := hedge e he + have her : e ⊆ closure r := edge_subset_closure_of_incident hS he hr ⟨p, hpe, hpr⟩ + exact ⟨u, hu, closure_minimal her isClosed_closure hue⟩ + obtain ⟨u, hu, hur⟩ := key + refine ⟨u, hu, fun X hXc hXn hc => ?_⟩ + exact closure_minimal (nice_region hXn hr ⟨c, hcr, hc⟩) hXc hur + +/-! ## The walks `P_v` -/ + +omit [T2Space S] in +/-- The points of a walk lie in `U(Γ)`. -/ +theorem walk_pts_subset_U {Γ : Drawing S} {x y : S} (W : GraphWalk Γ.toGraph x y) : + {z | z ∈ W.support ∨ ∃ e ∈ W.edges, z ∈ closure e} ⊆ Γ.U := by + rintro z (hz | ⟨e, he, hz⟩) + · exact Γ.V_subset_U (W.mem_vertexSet_of_mem_support hz) + · have hE : ∀ {x' y' : S} (W' : GraphWalk Γ.toGraph x' y'), ∀ f ∈ W'.edges, f ∈ Γ.E := by + intro x' y' W' + induction W' with + | nil => simp [GraphWalk.edges] + | cons hl rest ih => + intro f hf + rcases List.mem_cons.mp hf with rfl | hf + · exact hl.1 + · exact ih f hf + exact Γ.closure_subset_U (hE W e he) hz + +/-- The curve of a walk: the ends of a walk whose points lie in `T` are joined in `T ∩ U(Γ)`. -/ +theorem joinedIn_of_walk [ConnectedSpace S] {Γ : Drawing S} {T : Set S} {x y : S} + (W : GraphWalk Γ.toGraph x y) (hT : {z | z ∈ W.support ∨ ∃ e ∈ W.edges, z ∈ closure e} ⊆ T) : + JoinedIn (T ∩ Γ.U) x y := + ((isPathConnected_walk_U W).joinedIn x (Or.inl W.start_mem_support) y + (Or.inl W.end_mem_support)).mono fun _ hz => ⟨hT hz, walk_pts_subset_U W hz⟩ + +omit [T2Space S] in +/-- A walk of `Γ` from a vertex of a closed nice set `X` to a vertex of `bd(X)` can be cut so that +it stays +in `X`: it can only leave `X` through `bd(X)`. -/ +theorem exists_walk_to_frontier {Γ : Drawing S} {X : Set S} (hXc : IsClosed X) + (hXn : IsGammaNice Γ X) + {w y : S} (W : GraphWalk Γ.toGraph w y) (hw : w ∈ X) (hy : y ∈ frontier X) : + ∃ y' ∈ frontier X, ∃ W' : GraphWalk Γ.toGraph w y', + {z | z ∈ W'.support ∨ ∃ e ∈ W'.edges, z ∈ closure e} ⊆ X := by + induction W with + | @nil a ha => + refine ⟨a, hy, .nil ha, ?_⟩ + rintro z (hz | ⟨e, he, -⟩) + · simp only [GraphWalk.support_nil, List.mem_singleton] at hz + rw [hz] + exact hw + · simp [GraphWalk.edges] at he + | @cons a b d e hl rest ih => + by_cases hwf : a ∈ frontier X + · refine ⟨a, hwf, .nil hl.2.1, ?_⟩ + rintro z (hz | ⟨e, he, -⟩) + · have hz' : z = a := List.mem_singleton.mp hz + exact hz'.symm ▸ hw + · simp [GraphWalk.edges] at he + have hint : a ∈ interior X := by + by_contra h + exact hwf ⟨subset_closure hw, h⟩ + have hac : a ∈ closure e := by + have : a ∈ closure e ∩ Γ.V := by rw [hl.2.2.2]; exact Or.inl rfl + exact this.1 + have hbc : b ∈ closure e := by + have : b ∈ closure e ∩ Γ.V := by rw [hl.2.2.2]; exact Or.inr rfl + exact this.1 + obtain ⟨z, hzi, hze⟩ := mem_closure_iff.mp hac _ isOpen_interior hint + have heX : closure e ⊆ X := closure_minimal (nice_edge hXn hl.1 ⟨z, hze, interior_subset hzi⟩) + hXc + obtain ⟨y', hy', W', hW'⟩ := ih (heX hbc) hy + refine ⟨y', hy', .cons hl W', ?_⟩ + rintro x (hx | ⟨f, hf, hx⟩) + · rcases List.mem_cons.mp hx with rfl | hx + · exact hw + · exact hW' (Or.inl hx) + · rcases List.mem_cons.mp hf with rfl | hf + · exact heX hx + · exact hW' (Or.inr ⟨f, hf, hx⟩) + +/-- **The walks `P_v` of (8.10).** If `Γ` is connected and `X` is a restraint, then any two vertices +of +`X` are joined by a curve in `X ∩ U(Γ)`: each is joined to `Γ ∩ bd(X)` inside `X`, and `Γ ∩ bd(X)` +is +connected. -/ +theorem joinedIn_of_restraint [ConnectedSpace S] (hS : IsClosedSurface S) {Γ : Drawing S} + {ins : Drawing S → Set S} {k : ℕ} (hΓ : Γ.IsConnected) {X : Set S} (hr : IsRestraint Γ ins k X) + {v w : S} (hv : v ∈ Γ.V) (hvX : v ∈ X) (hw : w ∈ Γ.V) (hwX : w ∈ X) : + JoinedIn (X ∩ Γ.U) v w := by + have hXc := hr.isClosed + have hXn := hr.isGammaNice + have hsub : (Γ.interSet (frontier X)).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hfU : (Γ.interSet (frontier X)).U ⊆ frontier X := interSet_U_subset isClosed_frontier + obtain ⟨u₀, W₀, -, -, -, -, hd⟩ := hr.exists_walk hS + have hu₀ : u₀ ∈ (Γ.interSet (frontier X)).V := by + rw [← hd, walkDrawing_V] + exact W₀.start_mem_support + have hu₀f : u₀ ∈ frontier X := hfU ((Γ.interSet (frontier X)).V_subset_U hu₀) + have hbd : ∀ y ∈ frontier X, y ∈ Γ.V → JoinedIn (X ∩ Γ.U) y u₀ := by + intro y hy hyV + have hy' : y ∈ (Γ.interSet (frontier X)).V := mem_interSet_V hyV hy + obtain ⟨W⟩ := exists_walk_in_bd hS hr hy' hu₀ + refine (joinedIn_of_walk W (T := frontier X) fun z hz => hfU (walk_pts_subset_U W hz)).mono ?_ + rintro z ⟨h₁, h₂⟩ + exact ⟨hXc.frontier_subset h₁, hsub.U_subset h₂⟩ + have hto : ∀ x ∈ Γ.V, x ∈ X → JoinedIn (X ∩ Γ.U) x u₀ := by + intro x hx hxX + obtain ⟨W⟩ := hΓ.2 x hx u₀ (hsub.1 hu₀) + obtain ⟨y, hy, W', hW'⟩ := exists_walk_to_frontier hXc hXn W hxX hu₀f + exact (joinedIn_of_walk W' hW').trans (hbd y hy (W'.mem_vertexSet_of_mem_support + W'.end_mem_support)) + exact (hto v hv hvX).trans (hto w hw hwX).symm + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section85.lean b/LeanPool/GraphMinor/GM11/Section85.lean new file mode 100644 index 0000000000..94da7c2072 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section85.lean @@ -0,0 +1,403 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Nice73 + +/-! +# Graph Minors XI, (8.5) + +`theorem_8_5` says that `ins(W)` is a restraint with `l(ins(W)) ≤ l(W)`, for a closed walk `W` of +length +`< 2θ`. `isSimplyConnected_insOf` gives simple connectivity by way of (7.3) and (3.1), which are +`nice_73` and `nice_31`. + +The proof in the paper says that any `O`-arc in `U(W)` bounds a disc in `ins(W)`. This needs that an +`O`-arc +in a drawing is a circuit, which is `exists_circuit_of_oArc`. The count of edges in `l(ins(W)) ≤ +l(W)` is +`perimeterCount_le`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A walk with one use of `e` splits at that use. -/ +theorem exists_split_at_edge [DecidableEq (Set S)] {Γ : Drawing S} {e : Set S} {a b : S} + (W : GraphWalk Γ.toGraph a b) (he : W.edges.count e = 1) : + ∃ (p q : S) (P : GraphWalk Γ.toGraph a p) (Q : GraphWalk Γ.toGraph q b), + Γ.toGraph.IsLink e p q ∧ e ∉ P.edges ∧ e ∉ Q.edges := by + induction W with + | nil h => simp [GraphWalk.edges] at he + | @cons a c b f hl rest ih => + by_cases hfe : f = e + · subst hfe + refine ⟨a, c, .nil hl.2.1, rest, hl, by simp [GraphWalk.edges], ?_⟩ + have : (f :: rest.edges).count f = 1 := he + rw [List.count_cons_self] at this + exact List.count_eq_zero.mp (by omega) + · have h' : rest.edges.count e = 1 := by + have : (f :: rest.edges).count e = 1 := he + rwa [List.count_cons_of_ne hfe] at this + obtain ⟨p, q, P, Q, hlk, hP, hQ⟩ := ih h' + refine ⟨p, q, .cons hl P, Q, hlk, ?_, hQ⟩ + simp only [GraphWalk.edges, List.mem_cons, not_or] + exact ⟨fun h => hfe h.symm, hP⟩ + +variable [T2Space S] + +/-- An edge used once by a closed walk lies on a circuit of the walk, since the rest of the walk +joins its +ends. -/ +theorem exists_circuit_of_count_one {Γ : Drawing S} (hγ' : ∃ γ, EdgePar Γ γ) [DecidableEq (Set S)] + {u : S} (W : GraphWalk Γ.toGraph u u) {e : Set S} (he : W.edges.count e = 1) : + ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing (walkDrawing Γ W) ∧ e ∈ C.E := by + obtain ⟨γ, hγ⟩ := hγ' + let G := walkDrawing Γ W + have hG : G.IsSubdrawing Γ := walkDrawing_isSubdrawing Γ W + have heW : e ∈ W.edges := List.count_pos_iff.mp (by omega) + have heG : e ∈ G.E := by + change e ∈ (walkDrawing Γ W).E + rw [walkDrawing_E] + exact heW + obtain ⟨W', -, hW'⟩ := hG.exists_walk_down W + (fun x hx => by + change x ∈ (walkDrawing Γ W).V + rw [walkDrawing_V] + exact hx) + (fun f hf => by + change f ∈ (walkDrawing Γ W).E + rw [walkDrawing_E] + exact hf) + obtain ⟨p, q, P, Q, hlk, hP, hQ⟩ := exists_split_at_edge W' (by rw [hW']; exact he) + let R := Q.append P + have hRe : e ∉ R.edges := by + simp only [R, GraphWalk.edges_append, List.mem_append, not_or] + exact ⟨hQ, hP⟩ + have hDG : (G.deleteEdge e).IsSubdrawing G := deleteEdge_isSubdrawing G e + obtain ⟨R', -, hR'⟩ := hDG.exists_walk_down R + (fun x hx => by + rw [deleteEdge_V] + exact mem_V_of_mem_support R hx) + (fun f hf => by + rw [deleteEdge_E] + exact ⟨mem_E_of_mem_edges R hf, fun h => hRe (mem_singleton_iff.mp h ▸ hf)⟩) + have hlink := isLink_ends hγ hG heG false + have hpair : ({p, q} : Set S) = {γ e (endOf false), γ e (endOf true)} := by + rw [← hlk.2.2.2] + exact hlink.2.2.2 + have hreach : Nonempty (GraphWalk (G.deleteEdge e).toGraph (γ e (endOf false)) (γ e + (endOf true))) := by + rcases Set.pair_eq_pair_iff.mp hpair with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · rw [← h₁, ← h₂] + exact ⟨R'.reverse⟩ + · rw [← h₁, ← h₂] + exact ⟨R'⟩ + exact exists_circuit_of_reach hγ hG heG hreach + +variable {Γ : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + +omit [T2Space S] in +theorem insOf_mono {D₁ D₂ : Drawing S} (h : D₁.IsSubdrawing D₂) : insOf ins D₁ ⊆ insOf ins D₂ := by + rintro x (hx | hx) + · exact Or.inl (h.U_subset hx) + · obtain ⟨C, hC, hxC⟩ := mem_iUnion₂.mp hx + exact Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC.1, hC.2.trans h⟩, hxC⟩) + +omit [T2Space S] in +/-- A drawing has finitely many circuits. -/ +theorem finite_circuits (D : Drawing S) : {C : Drawing S | C.IsCircuit ∧ C.IsSubdrawing D}.Finite + := by + refine Set.Finite.of_finite_image (f := fun C : Drawing S => (C.V, C.E)) ?_ ?_ + · refine (D.finite_V.finite_subsets.prod D.finite_edges.finite_subsets).subset ?_ + rintro _ ⟨C, ⟨-, hs'⟩, rfl⟩ + exact ⟨hs'.1, hs'.2⟩ + · intro C _ C' _ h + exact Drawing.ext_of_V_E (congrArg Prod.fst h) (congrArg Prod.snd h) + +/-- `Γ | W` is confined, for a closed walk of length `< 2θ`. -/ +theorem isConfined_walk {u v : S} (W : GraphWalk Γ.toGraph u v) (hW : W.length < k) : + IsConfined k (walkDrawing Γ W) := by + intro C _ hCs + have hle : C.length ≤ W.edges.length := by + refine (ncard_le_ncard ?_ (W.edges.finite_toSet)).trans (ncard_mem_list_le W.edges) + intro e he + have h := hCs.2 he + rwa [walkDrawing_E] at h + exact lt_of_le_of_lt hle hW + +theorem interSet_U_subset {T : Set S} (hT : IsClosed T) : (Γ.interSet T).U ⊆ T := by + rw [Drawing.U_eq] + have hE : ∀ f, f ∈ (Γ.interSet T).E → f ⊆ T := fun f hf => by + change f ∈ (Γ.span _ _).E at hf + rw [Γ.span_E] at hf + exact hf.1.2 + rintro x (hx | hx) + · rcases hx with ⟨⟨-, hx⟩, -⟩ | hx + · exact hx + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + exact closure_minimal hf.1.2 hT hxf.1 + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + exact closure_minimal (hE f hf) hT hxf + +/-- If `T ⊆ U(D)` then `Γ ∩ T` is a subdrawing of `D`. -/ +theorem interSet_isSubdrawing {D : Drawing S} {T : Set S} (hD : D.IsSubdrawing Γ) + (hTc : IsClosed T) (hT : T ⊆ D.U) : (Γ.interSet T).IsSubdrawing D := by + have hH : (Γ.interSet T).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + refine ⟨fun x hx => ?_, fun f hf => ?_⟩ + · have hxU : x ∈ D.U := hT (interSet_U_subset hTc ((Γ.interSet T).V_subset_U hx)) + have hxV : x ∈ Γ.V := hH.1 hx + rw [D.U_eq] at hxU + rcases hxU with h | h + · exact h + · obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h + exact (hD.closure_inter_V hg ▸ (⟨hxg, hxV⟩ : x ∈ closure g ∩ Γ.V) : x ∈ closure g ∩ D.V).2 + · have hfΓ := hH.2 hf + have hfT : f ⊆ T := by + change f ∈ (Γ.span _ _).E at hf + rw [Γ.span_E] at hf + exact hf.1.2 + obtain ⟨y, hy⟩ := hfΓ.1 + have hyV : y ∉ D.V := fun h => (hfΓ.2.1 hy).2 (hD.1 h) + obtain ⟨g, hg, hyg⟩ := D.exists_edge_of_mem (hT (hfT hy)) hyV + obtain rfl := Γ.edge_eq_of_mem hfΓ (hD.2 hg) hy hyg + exact hg + +/-- `U(D) ⊆ ins(D)` and the frontier of `ins(D)` is in `U(D)`, for confined `D`. -/ +theorem frontier_insOf_subset (hs : IsSlope Γ k ins) {D : Drawing S} (hD : D.IsSubdrawing Γ) + (hconf : IsConfined k D) : IsClosed (insOf ins D) ∧ frontier (insOf ins D) ⊆ D.U := by + have hcl : IsClosed (insOf ins D) := D.isClosed_U.union ((finite_circuits D).isClosed_biUnion + fun C hC => (hs.isClosedDisc C hC.1 (hC.2.trans hD) (hconf C hC.1 hC.2)).isClosed) + refine ⟨hcl, fun x hx => ?_⟩ + by_contra hxU + have hxZ : x ∈ insOf ins D := hcl.frontier_subset hx + rcases hxZ with h | h + · exact hxU h + obtain ⟨C, hC, hxC⟩ := mem_iUnion₂.mp h + have hsm := hconf C hC.1 hC.2 + have hb := hs.subBd_eq C hC.1 (hC.2.trans hD) hsm + rw [subBd_eq_frontier] at hb + have hint : x ∈ interior (ins C) := by + by_contra hni + exact hxU (hC.2.U_subset (hb ▸ ⟨subset_closure hxC, hni⟩)) + refine hx.2 (interior_mono ?_ hint) + exact subset_biUnion_of_mem (u := ins) hC |>.trans subset_union_right + +variable [ConnectedSpace S] (hS : IsClosedSurface S) +include hS + +omit [ConnectedSpace S] in +/-- `ins(D)` is nice, for confined `D`. -/ +theorem isGammaNice_insOf (hs : IsSlope Γ k ins) {D : Drawing S} (hD : D.IsSubdrawing Γ) + (hconf : IsConfined k D) : IsGammaNice Γ (insOf ins D) := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + exact isGammaNice_of_frontier hD subset_union_left (frontier_insOf_subset hs hD hconf).2 + +omit [ConnectedSpace S] in +/-- `ins(C)` is nice and bounded by `U(C)`, for a circuit `C` of length `< 2θ`. -/ +theorem ins_slope_facts (hs : IsSlope Γ k ins) {C : Drawing S} (hC : C.IsCircuit) + (hCs : C.IsSubdrawing Γ) + (hl : C.length < k) : frontier (ins C) = C.U ∧ C.U ⊆ ins C ∧ IsGammaNice Γ (ins C) := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hb := hs.subBd_eq C hC hCs hl + rw [subBd_eq_frontier] at hb + have hsub : C.U ⊆ ins C := by + rw [← hb] + exact (hs.isClosedDisc C hC hCs hl).isCompact.isClosed.frontier_subset + exact ⟨hb, hsub, isGammaNice_of_frontier hCs hsub hb.subset⟩ + +/-- `ins(D)` is simply-connected, for confined `D` with `U(D)` arc-wise connected. The paper shows +this +inside the proof of (8.5), by (7.3) and repeated use of (3.1). -/ +theorem isSimplyConnected_insOf + (hs : IsSlope Γ k ins) {D : Drawing S} (hD : D.IsSubdrawing Γ) (hconf : IsConfined k D) + (hpc : IsPathConnected D.U) : IsSimplyConnectedSet (insOf ins D) := by + classical + obtain ⟨hZc, -⟩ := frontier_insOf_subset hs hD hconf + have hZn := isGammaNice_insOf hS hs hD hconf + have hUn : IsGammaNice Γ D.U := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + exact isGammaNice_of_frontier hD subset_rfl D.isClosed_U.frontier_subset + let L : List (Set S) := (finite_circuits D).toFinset.toList.map ins + have hmem : ∀ Y ∈ L, ∃ C : Drawing S, (C.IsCircuit ∧ C.IsSubdrawing D) ∧ ins C = Y := by + intro Y hY + obtain ⟨C, hC, rfl⟩ := List.mem_map.mp hY + exact ⟨C, (finite_circuits D).mem_toFinset.mp (Finset.mem_toList.mp hC), rfl⟩ + have hfacts : ∀ Y ∈ L, IsClosedDisc Y ∧ frontier Y ⊆ D.U ∧ IsGammaNice Γ Y := by + intro Y hY + obtain ⟨C, ⟨hC, hCs⟩, rfl⟩ := hmem Y hY + have hl := hconf C hC hCs + have hf := ins_slope_facts hS hs hC (hCs.trans hD) hl + exact ⟨hs.isClosedDisc C hC (hCs.trans hD) hl, hf.1.subset.trans hCs.U_subset, hf.2.2⟩ + have heq : insOf ins D = withDiscs D.U L := by + refine congrArg (D.U ∪ ·) ?_ + ext x + simp only [mem_iUnion₂, mem_ofPred_eq, exists_prop] + constructor + · rintro ⟨C, hC, hx⟩ + exact ⟨ins C, List.mem_map.mpr ⟨C, Finset.mem_toList.mpr ((finite_circuits + D).mem_toFinset.mpr hC), + rfl⟩, hx⟩ + · rintro ⟨Y, hY, hx⟩ + obtain ⟨C, hC, rfl⟩ := hmem Y hY + exact ⟨C, hC, hx⟩ + have hsub : ∀ L' : List (Set S), (∀ Y ∈ L', Y ∈ L) → + IsClosed (withDiscs D.U L') ∧ IsGammaNice Γ (withDiscs D.U L') := by + intro L' hL' + refine ⟨D.isClosed_U.union (L'.finite_toSet.isClosed_biUnion fun Y hY => + (hfacts Y (hL' Y hY)).1.isCompact.isClosed), isGammaNice_of_sat fun a ha hne => ?_⟩ + obtain ⟨x, hxa, hx | hx⟩ := hne + · exact (nice_atom hUn ha ⟨x, hxa, hx⟩).trans subset_union_left + · obtain ⟨Y, hY, hxY⟩ := mem_iUnion₂.mp hx + refine (nice_atom (hfacts Y (hL' Y hY)).2.2 ha ⟨x, hxa, hxY⟩).trans ?_ + exact (subset_biUnion_of_mem (u := id) (s := {Y | Y ∈ L'}) hY).trans subset_union_right + rw [heq] + refine theorem_7_11_proof hS D.isClosed_U hpc (fun Y hY => ⟨(hfacts Y hY).1, + (hfacts Y hY).2.1⟩) ?_ ?_ + · intro Y L' hsuf hcap + have hsubL : ∀ Z ∈ Y :: L', Z ∈ L := fun Z hZ => hsuf.subset hZ + have hYL := hsubL Y List.mem_cons_self + have hL' := hsub L' fun Z hZ => hsubL Z (List.mem_cons_of_mem _ hZ) + exact nice_31 S hS Γ Y _ (hfacts Y hYL).1.isCompact.isClosed hL'.1 (hfacts Y hYL).2.2 hL'.2 + (IsClosedDisc.isSimplyConnectedSet (hfacts Y hYL).1) hcap + · intro φ hφ + by_contra hnot + have hZ := hsub L fun _ h => h + obtain ⟨F, hF, hFφ, hFn⟩ := nice_73 S hS Γ _ hZ.1 hZ.2 φ (hφ.trans subset_union_left) hnot + obtain ⟨C, hC, hCs, rfl⟩ := exists_circuit_of_oArc hF (hFφ.trans hφ) + have hl := hconf C hC hCs + have hf := ins_slope_facts hS hs hC (hCs.trans hD) hl + refine hFn (isNullHomotopicOArcIn_of_subset_disc hF ?_ (hs.isClosedDisc C hC + (hCs.trans hD) hl) hf.2.1) + rw [← heq] + exact subset_biUnion_of_mem (u := ins) (show C ∈ {C | C.IsCircuit + ∧ C.IsSubdrawing D} from ⟨hC, hCs⟩) + |>.trans subset_union_right + +/-- The count behind `l(ins(W)) ≤ l(W)`, in the proof of (8.5). A perimeter walk of `ins(W)` uses +only +edges of `W`, and if it uses an edge twice then `W` does too. For otherwise the edge is on a circuit +`C` of +`Γ | W`, and `ins(C)` has points on both sides of it, so the complement of `ins(W)` cannot be on +both +sides. -/ +theorem perimeterCount_le (hs : IsSlope Γ k ins) {u : S} (W : GraphWalk Γ.toGraph u u) + (hW : W.length < k) {e : Set S} (he : e ∈ Γ.E) : + perimeterCount (insWalk ins Γ W) e ≤ edgeCount W.edges e := by + classical + let G := walkDrawing Γ W + have hG : G.IsSubdrawing Γ := walkDrawing_isSubdrawing Γ W + have hconf : IsConfined k G := isConfined_walk W hW + obtain ⟨hcl, hfr⟩ := frontier_insOf_subset hs hG hconf + change frontier (insWalk ins Γ W) ⊆ G.U at hfr + unfold perimeterCount + by_cases hne : (e ∩ frontier (insWalk ins Γ W)).Nonempty + swap + · simp only [hne, ite_false] + exact Nat.zero_le _ + obtain ⟨y, hye, hyf⟩ := id hne + simp only [hne, ite_true] + have hyV : y ∉ G.V := fun h => (he.2.1 hye).2 (hG.1 h) + obtain ⟨g, hg, hyg⟩ := G.exists_edge_of_mem (hfr hyf) hyV + obtain rfl := Γ.edge_eq_of_mem he (hG.2 hg) hye hyg + have heW : e ∈ W.edges := by + have h : e ∈ (walkDrawing Γ W).E := hg + rwa [walkDrawing_E] at h + have hpos : 1 ≤ edgeCount W.edges e := List.count_pos_iff.mpr heW + by_cases h2 : IsTwoSided (insWalk ins Γ W)ᶜ e + swap + · simpa only [h2, ite_false] using hpos + simp only [h2, ite_true] + by_contra hlt + have hone : edgeCount W.edges e = 1 := by omega + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + obtain ⟨C, hC, hCs, heC⟩ := exists_circuit_of_count_one ⟨γ, hγ⟩ W hone + have hl := hconf C hC hCs + have hd := hs.isClosedDisc C hC (hCs.trans hG) hl + have hf := ins_slope_facts hS hs hC (hCs.trans hG) hl + have hbd : discBd (ins C) = C.U := by + rw [← IsClosedDisc.frontier_eq_discBd hS hd, hf.1] + have heb : e ⊆ discBd (ins C) := by + rw [hbd] + exact subset_closure.trans (C.closure_subset_U heC) + obtain ⟨y', hy'e, hy'⟩ := h2 + obtain ⟨w, hwO, hwi⟩ := mem_closure_iff.mp (discBd_subset_closure hd + (heb hy'e)) _ isOpen_interior hy' + rcases interior_subset hwO with h | h + · refine h (Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, hCs⟩, hwi.1⟩)) + · exact hwi.2 (heb h) + + +/-- **(8.5)** of Graph Minors XI (page 97): "Let $W$ be a closed walk in $\Gamma$ of length $< +2\theta$. Then $\mathrm{ins}(W)$ is a +restraint and $l(\mathrm{ins}(W)) \le l(W)$." -/ +theorem theorem_8_5_proof (hs : IsSlope Γ k ins) {u : S} (W : GraphWalk Γ.toGraph u u) + (hW : W.length < k) : + IsRestraint Γ ins k (insWalk ins Γ W) ∧ perimeterWalkLength Γ (insWalk ins Γ W) ≤ W.length := by + classical + let G := walkDrawing Γ W + have hG : G.IsSubdrawing Γ := walkDrawing_isSubdrawing Γ W + have hconf : IsConfined k G := isConfined_walk W hW + obtain ⟨hcl, hfr⟩ := frontier_insOf_subset hs hG hconf + have hn := isGammaNice_insOf hS hs hG hconf + have hUeq : G.U = {x | x ∈ W.support ∨ ∃ e ∈ W.edges, x ∈ closure e} := by + ext x + exact mem_walkDrawing_U Γ W + have hsc : IsSimplyConnectedSet (insOf ins G) := + isSimplyConnected_insOf hS hs hG hconf (hUeq ▸ isPathConnected_walk_U W) + have hne : (insOf ins G).Nonempty := + ⟨u, Or.inl ((mem_walkDrawing_U Γ W).mpr (Or.inl W.start_mem_support))⟩ + have hu : insOf ins G ≠ univ := by + intro h + obtain ⟨r, -, hr, -, -⟩ := theorem_8_2_proof hS hs W W W hW hW hW + exact hr (subset_of_subset_of_eq (subset_univ r) h.symm) + have hle : perimeterWalkLength Γ (insOf ins G) ≤ W.length := by + rw [perimeterWalkLength_eq hS hcl hn hsc hne hu, length_eq_sum W] + exact Finset.sum_le_sum fun e he => perimeterCount_le hS hs W hW + (Γ.finite_edges.mem_toFinset.mp he) + refine ⟨⟨hne, hcl, hsc, hn, hle.trans_lt hW, fun h => hu ?_⟩, hle⟩ + have hsub : (Γ.interSet (subBd (insOf ins G))).IsSubdrawing G := by + rw [subBd_eq_frontier] + exact interSet_isSubdrawing hG isClosed_frontier hfr + refine eq_univ_of_forall fun x => ?_ + by_contra hx + exact hx (insOf_mono hsub (h ⟨mem_univ x, hx⟩)) + +/-- **(8.6)** of Graph Minors XI (page 97): "If $X, Y$ are restraints, and $X \cup Y$ is +simply-connected and $l(X \cup Y) < 2\theta$, +then $X \cup Y$ is a restraint." -/ +theorem theorem_8_6_proof (hs : IsSlope Γ k ins) {X Y : Set S} (hX : IsRestraint Γ ins k X) + (hY : IsRestraint Γ ins k Y) (hsc : IsSimplyConnectedSet (X ∪ Y)) + (hl : perimeterWalkLength Γ (X ∪ Y) < k) : IsRestraint Γ ins k (X ∪ Y) := by + have hc : IsClosed (X ∪ Y) := hX.isClosed.union hY.isClosed + have hn : IsGammaNice Γ (X ∪ Y) := hX.isGammaNice.union hY.isGammaNice + have hne : (X ∪ Y).Nonempty := hX.nonempty.mono subset_union_left + have h₁ : X ∪ Y ∪ X ≠ univ := theorem_8_4_proof hS hs hX hY hX + have hu : X ∪ Y ≠ univ := fun h => h₁ (by rw [h, univ_union]) + obtain ⟨u', W, hW, hlen, -, hcount⟩ := exists_minimal_perimeterWalk hS hc hn hsc hne hu + have hd := walkDrawing_eq hS hc hn hW hcount + have hZ := (theorem_8_5_proof hS hs W (hlen ▸ hl)).1 + have h₂ := theorem_8_4_proof hS hs hX hY hZ + refine ⟨hne, hc, hsc, hn, hl, fun hsub => h₂ ?_⟩ + refine eq_univ_of_forall fun x => ?_ + by_cases hx : x ∈ X ∪ Y + · exact Or.inl hx + · refine Or.inr ?_ + have hmem := hsub ⟨mem_univ x, hx⟩ + rw [subBd_eq_frontier, ← hd] at hmem + exact hmem + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section87.lean b/LeanPool/GraphMinor/GM11/Section87.lean new file mode 100644 index 0000000000..559b402d43 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section87.lean @@ -0,0 +1,815 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section85 +public import LeanPool.GraphMinor.GM11.CollarCut + +/-! +# Graph Minors XI, (8.7) + +`theorem_8_7` says that a walk `P` outside an extreme restraint `X`, between two points of `bd(X)`, +is longer +than some walk of `Γ ∩ bd(X)` between the same points. + +We follow the proof in the paper. `exists_split_perimeter` cuts a shortest perimeter walk at the +ends of `P`. +It gives the walks `W₁, W₂` of the paper and the components `Δ₁, Δ₂`, by means of `exists_cut`. +`ins_side` is the step that `ins(P + W⁻¹)` includes one of `Δ₁, Δ₂`, and `no_cover` is the step that +it does +not include the far one. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] {Γ : Drawing S} + +/-- The point set `U(Γ | W)` of a walk. -/ +def walkPts {u v : S} (W : GraphWalk Γ.toGraph u v) : Set S := + {x | x ∈ W.support ∨ ∃ e ∈ W.edges, x ∈ closure e} + +theorem mem_walkPts_append {u v w : S} (A : GraphWalk Γ.toGraph u v) (B : GraphWalk Γ.toGraph v w) + {x : S} : + x ∈ walkPts (A.append B) ↔ x ∈ walkPts A ∨ x ∈ walkPts B := by + simp only [walkPts, mem_ofPred_eq, GraphWalk.mem_support_append, GraphWalk.edges_append, + List.mem_append] + constructor + · rintro ((h | h) | ⟨e, he | he, hx⟩) + · exact Or.inl (Or.inl h) + · exact Or.inr (Or.inl h) + · exact Or.inl (Or.inr ⟨e, he, hx⟩) + · exact Or.inr (Or.inr ⟨e, he, hx⟩) + · rintro ((h | ⟨e, he, hx⟩) | (h | ⟨e, he, hx⟩)) + · exact Or.inl (Or.inl h) + · exact Or.inr ⟨e, Or.inl he, hx⟩ + · exact Or.inl (Or.inr h) + · exact Or.inr ⟨e, Or.inr he, hx⟩ + +theorem mem_walkPts_reverse {u v : S} (A : GraphWalk Γ.toGraph u v) {x : S} : + x ∈ walkPts A.reverse ↔ x ∈ walkPts A := by + simp [walkPts, GraphWalk.support_reverse, GraphWalk.edges_reverse] + +/-- A walk along a curve splits at each time at which the curve is at a vertex. -/ +theorem runs_split {φ : ℝ → S} {u v : S} (W : GraphWalk Γ.toGraph u v) : + ∀ {a b : ℝ}, RunsAlongOn Γ φ a b W → ∀ t ∈ Icc a b, φ t ∈ Γ.V → + ∃ (x : S) (W₁ : GraphWalk Γ.toGraph u x) (W₂ : GraphWalk Γ.toGraph x v), φ t = x ∧ + W = W₁.append W₂ ∧ RunsAlongOn Γ φ a t W₁ ∧ RunsAlongOn Γ φ t b W₂ := by + induction W with + | @nil u hv => + rintro a b ⟨rfl, hu⟩ t ⟨h₁, h₂⟩ - + obtain rfl : t = a := le_antisymm h₂ h₁ + exact ⟨u, .nil hv, .nil hv, hu, rfl, ⟨rfl, hu⟩, ⟨rfl, hu⟩⟩ + | @cons u y v e hlink rest ih => + rintro a b ⟨c, hac, hu, hin, him, hrest⟩ t ht hV + rcases lt_or_ge t c with htc | htc + · rcases eq_or_lt_of_le ht.1 with rfl | hat + · exact ⟨u, .nil hlink.2.1, .cons hlink rest, hu, rfl, ⟨rfl, hu⟩, ⟨c, hac, hu, hin, him, + hrest⟩⟩ + · have hm : φ t ∈ e := him ▸ mem_image_of_mem φ ⟨hat, htc⟩ + exact ((hlink.1.2.1 hm).2 hV).elim + · obtain ⟨x, W₁, W₂, hx, rfl, h₁, h₂⟩ := ih hrest t ⟨htc, ht.2⟩ hV + exact ⟨x, .cons hlink W₁, W₂, hx, rfl, ⟨c, hac, hu, hin, him, h₁⟩, h₂⟩ + +/-- A curve along a walk visits the vertices at finitely many times. -/ +theorem runs_finite {φ : ℝ → S} {u v : S} (W : GraphWalk Γ.toGraph u v) : + ∀ {a b : ℝ}, RunsAlongOn Γ φ a b W → {t | t ∈ Icc a b ∧ φ t ∈ Γ.V}.Finite := by + induction W with + | nil hv => + rintro a b ⟨rfl, -⟩ + refine (finite_singleton a).subset ?_ + rintro t ⟨⟨h₁, h₂⟩, -⟩ + exact le_antisymm h₂ h₁ + | @cons u y v e hlink rest ih => + rintro a b ⟨c, hac, hu, hin, him, hrest⟩ + refine ((ih hrest).insert a).subset ?_ + rintro t ⟨ht, hV⟩ + rcases lt_or_ge t c with htc | htc + · rcases eq_or_lt_of_le ht.1 with rfl | hat + · exact Or.inl rfl + · have hm : φ t ∈ e := him ▸ mem_image_of_mem φ ⟨hat, htc⟩ + exact ((hlink.1.2.1 hm).2 hV).elim + · exact Or.inr ⟨⟨htc, ht.2⟩, hV⟩ + +/-- A point of a curve along a walk is a point of the walk. -/ +theorem runs_pts {φ : ℝ → S} {u v : S} (W : GraphWalk Γ.toGraph u v) {a b : ℝ} + (h : RunsAlongOn Γ φ a b W) {t : ℝ} (ht : t ∈ Icc a b) : φ t ∈ walkPts W := by + by_cases hV : φ t ∈ Γ.V + · exact Or.inl (runs_vertex W h t ht hV) + · obtain ⟨e, he, hm⟩ := runs_mem W h t ht hV + exact Or.inr ⟨e, he, subset_closure hm⟩ + +theorem mem_V_of_mem_U' {D : Drawing S} (hD : D.IsSubdrawing Γ) {x : S} (hxU : x ∈ D.U) + (hxV : x ∈ Γ.V) : x ∈ D.V := by + rw [D.U_eq] at hxU + rcases hxU with h | h + · exact h + · obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h + exact (hD.closure_inter_V hg ▸ (⟨hxg, hxV⟩ : x ∈ closure g ∩ Γ.V) : x ∈ closure g ∩ D.V).2 + +variable [T2Space S] + +/-- **The split of a perimeter walk.** Let `ψ` be a path outside `X` from `a` to `b`, with `a ≠ b` +in `bd(X)`. +Then there are walks `R₁, R₂` from `a` to `b` in `bd(X)`, of total length `l(X)`, as in the proof of +(8.7), +and two components of `Σ − (X ∪ L)`. The boundary `bd(X)` lies in the points of `R₁` and the closure +of the +second component, and it also lies in the points of `R₂` and the closure of the first. Each +component with a +limit point in `X − L` is one of the two. -/ +theorem exists_split_perimeter [ConnectedSpace S] (hS : IsClosedSurface S) + {X : Set S} (hXc : IsClosed X) (hXn : IsGammaNice Γ X) + (hXs : IsSimplyConnectedSet X) (hne : X.Nonempty) (hu : X ≠ univ) {a b : S} (hab : a ≠ b) + (haV : a ∈ Γ.V) (hbV : b ∈ Γ.V) {ψ : I → S} (hψ : Continuous ψ) (hψ0 : ψ 0 = a) (hψ1 : ψ 1 = b) + (ha : a ∈ frontier X) (hb : b ∈ frontier X) (hψX : ∀ t ∈ Ioo (0 : I) 1, ψ t ∉ X) : + ∃ (R₁ R₂ : GraphWalk Γ.toGraph a b) (y₁ y₂ : S), y₁ ∈ (X ∪ range ψ)ᶜ ∧ y₂ ∈ (X ∪ range ψ)ᶜ ∧ + R₁.length + R₂.length = perimeterWalkLength Γ X ∧ + walkPts R₁ ⊆ frontier X ∧ walkPts R₂ ⊆ frontier X ∧ + (∀ e ∈ R₁.edges, e ⊆ frontier X) ∧ (∀ e ∈ R₂.edges, e ⊆ frontier X) ∧ + frontier X ⊆ walkPts R₁ ∪ closure (connectedComponentIn (X ∪ range ψ)ᶜ y₂) ∧ + frontier X ⊆ walkPts R₂ ∪ closure (connectedComponentIn (X ∪ range ψ)ᶜ y₁) ∧ + ∀ y ∈ (X ∪ range ψ)ᶜ, ∀ x ∈ closure (connectedComponentIn (X ∪ range ψ)ᶜ y), x ∈ X + → x ∉ range ψ → + connectedComponentIn (X ∪ range ψ)ᶜ y = connectedComponentIn (X ∪ range ψ)ᶜ y₁ ∨ + connectedComponentIn (X ∪ range ψ)ᶜ y = connectedComponentIn (X ∪ range ψ)ᶜ y₂ := by + classical + obtain ⟨u₀, W, hper, hlen, -, hcount⟩ := exists_minimal_perimeterWalk hS hXc hXn hXs hne hu + have hwd := walkDrawing_eq hS hXc hXn hper hcount + obtain ⟨h, hinj, hoff, hrng, hop, hrun⟩ := hper + rw [subBd_eq_frontier] at hrng + have hbot : ∀ z, h (z, 0) ∈ X := fun z => hXc.frontier_subset (hrng ▸ mem_range_self z) + have hrun' : RunsAlongOn Γ (collarCurve h) 0 1 W := by + rcases hrun with ⟨-, hc⟩ | ⟨-, hr⟩ + · exfalso + obtain ⟨z₁, hz₁⟩ := hrng.superset ha + obtain ⟨z₂, hz₂⟩ := hrng.superset hb + exact hab (hz₁.symm.trans ((hc z₁).trans ((hc z₂).symm.trans hz₂))) + · exact hr + let φ : ℝ → S := collarCurve h + have hφ : ∀ t, φ t = h (circlePt t, 0) := fun _ => rfl + have hperiod : ∀ t, φ (t + 1) = φ t := fun t => by + simp only [hφ, circlePt] + congr 2 + rw [mul_add, mul_one, Circle.exp_add, Circle.exp_two_pi, mul_one] + have hfinite : ∀ v ∈ Γ.V, {z : Circle | h (z, 0) = v}.Finite := by + intro v hv + refine ((runs_finite W hrun').image circlePt).subset ?_ + intro z hz + obtain ⟨t, ht, rfl⟩ := exists_circlePt_time 0 z + have hz' : φ t = v := hz + refine ⟨t, ⟨⟨ht.1, by linarith [ht.2]⟩, ?_⟩, rfl⟩ + rwa [show collarCurve h t = v from hz'] + have haX : a ∈ X := hXc.frontier_subset ha + have hbX : b ∈ X := hXc.frontier_subset hb + have hsymI : ∀ {t : I}, t ∈ Ioo (0 : I) 1 → unitInterval.symm t ∈ Ioo (0 : I) 1 := by + intro t ht + have h₁ : (0 : ℝ) < t := ht.1 + have h₂ : (t : ℝ) < 1 := ht.2 + constructor + · change (0 : ℝ) < 1 - t + linarith + · change 1 - (t : ℝ) < 1 + linarith + obtain ⟨z₀, hz₀, hl₀⟩ := exists_end_limit hinj hoff hbot hop hψ hψX (by rw [hψ0]; exact haX) + (by rw [hψ0]; exact hfinite a haV) + obtain ⟨z₁, hz₁, hl₁'⟩ := exists_end_limit (ψ := ψ ∘ unitInterval.symm) hinj hoff hbot hop + (hψ.comp continuous_symm) + (fun t ht => hψX _ (hsymI ht)) + (by simpa [hψ1] using hbX) (by simpa [hψ1] using hfinite b hbV) + have hz₁' : h (z₁, 0) = b := by simpa [hψ1] using hz₁ + rw [hψ0] at hz₀ + have hl₁ : ∀ N ∈ 𝓝 ((z₁, 0) : Circle × I), ∃ s : I, s < 1 ∧ ∀ s' ∈ Ioo s (1 : I), + collarInv h (ψ s') ∈ N := by + intro N hN + obtain ⟨s, hs, hsub⟩ := hl₁' N hN + have hs₁ : (0 : ℝ) < s := hs + refine ⟨unitInterval.symm s, ?_, fun s' hs' => ?_⟩ + · change 1 - (s : ℝ) < 1 + linarith + · have h₁ : 1 - (s : ℝ) < s' := hs'.1 + have h₂ : (s' : ℝ) < 1 := hs'.2 + have := hsub (unitInterval.symm s') ⟨by + change (0 : ℝ) < 1 - s' + linarith, by + change 1 - (s' : ℝ) < s + linarith⟩ + simpa using this + obtain ⟨τ₀, hτ₀, rfl⟩ := exists_circlePt_time 0 z₀ + obtain ⟨τ₁, hτ₁, rfl⟩ := exists_circlePt_time 0 z₁ + have hτ : τ₀ ≠ τ₁ := by + rintro rfl + exact hab (hz₀.symm.trans hz₁') + have hφ₀ : φ τ₀ = a := hz₀ + have hφ₁ : φ τ₁ = b := hz₁' + have hsplit : ∀ (lo hi : ℝ) (x y : S), 0 ≤ lo → lo < hi → hi < 1 → φ lo = x → φ hi = y → x ∈ Γ.V + → y ∈ Γ.V → + ∃ (B : GraphWalk Γ.toGraph x y) (D : GraphWalk Γ.toGraph y x), B.length + D.length = W.length + ∧ + (∀ z, z ∈ walkPts B → z ∈ walkPts W) ∧ (∀ z, z ∈ walkPts D → z ∈ walkPts W) ∧ + (∀ e ∈ B.edges, e ∈ W.edges) ∧ (∀ e ∈ D.edges, e ∈ W.edges) ∧ + (∀ t ∈ Icc lo hi, φ t ∈ walkPts B) ∧ (∀ t ∈ Icc hi (lo + 1), φ t ∈ walkPts D) := by + intro lo hi x y hlo hlh hhi hx hy hxV hyV + subst hx hy + obtain ⟨x', A, rest, hx', heq, hA, hrest⟩ := runs_split W hrun' lo ⟨hlo, by linarith⟩ hxV + obtain rfl : x' = φ lo := hx'.symm + obtain ⟨y', B, D, hy', heq₂, hB, hD⟩ := runs_split rest hrest hi ⟨hlh.le, hhi.le⟩ hyV + obtain rfl : y' = φ hi := hy'.symm + subst heq₂ + refine ⟨B, D.append A, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [heq] + simp only [GraphWalk.length_append] + omega + · intro z hz + rw [heq, mem_walkPts_append, mem_walkPts_append] + exact Or.inr (Or.inl hz) + · intro z hz + rw [heq, mem_walkPts_append, mem_walkPts_append] + rcases (mem_walkPts_append _ _).mp hz with h' | h' + · exact Or.inr (Or.inr h') + · exact Or.inl h' + · intro e he + rw [heq] + simp [GraphWalk.edges_append, he] + · intro e he + rw [heq] + rw [GraphWalk.edges_append, List.mem_append] at he + simp only [GraphWalk.edges_append, List.mem_append] + tauto + · exact fun t ht => runs_pts B hB ht + · intro t ht + rw [mem_walkPts_append] + rcases le_total t 1 with h₁ | h₁ + · exact Or.inl (runs_pts D hD ⟨ht.1, h₁⟩) + · refine Or.inr ?_ + have := runs_pts A hA (t := t - 1) ⟨by linarith, by linarith [ht.2]⟩ + have heqp : φ (t - 1) = φ t := by + have h₂ := hperiod (t - 1) + rwa [sub_add_cancel, eq_comm] at h₂ + have h₃ : φ (t - 1) ∈ walkPts A := this + rwa [heqp] at h₃ + have hWf : ∀ z ∈ walkPts W, z ∈ frontier X := by + intro z hz + have h₁ : z ∈ (walkDrawing Γ W).U := (mem_walkDrawing_U Γ W).mpr hz + rw [hwd] at h₁ + exact interSet_U_subset isClosed_frontier h₁ + have hWe : ∀ e ∈ W.edges, e ⊆ frontier X := by + intro e he + have h₁ : e ∈ (walkDrawing Γ W).E := by + rw [walkDrawing_E] + exact he + rw [hwd] at h₁ + change e ∈ (Γ.span _ _).E at h₁ + rw [Γ.span_E] at h₁ + exact h₁.1.2 + have hcov : ∀ lo hi : ℝ, lo < hi → hi < lo + 1 → ∀ {A₁ A₂ : Set S}, + (∀ t ∈ Icc lo hi, φ t ∈ A₁) → (∀ t ∈ Icc hi (lo + 1), φ t ∈ A₂) → frontier X ⊆ A₁ ∪ A₂ := by + intro lo hi h₁ h₂ A₁ A₂ ha₁ ha₂ x hx + obtain ⟨z, rfl⟩ := hrng.superset hx + obtain ⟨t, ht, rfl⟩ := exists_circlePt_time lo z + rcases le_total t hi with h' | h' + · exact Or.inl (ha₁ t ⟨ht.1, h'⟩) + · exact Or.inr (ha₂ t ⟨h', ht.2.le⟩) + have hψr₀ : h (circlePt τ₀, 0) ∈ range ψ := ⟨0, by rw [hψ0]; exact hz₀.symm⟩ + have hψr₁ : h (circlePt τ₁, 0) ∈ range ψ := ⟨1, by rw [hψ1]; exact hz₁'.symm⟩ + have hl₁₁ : (0 : ℝ) ≤ τ₀ ∧ τ₀ < 1 ∧ 0 ≤ τ₁ ∧ τ₁ < 1 := ⟨hτ₀.1, by linarith [hτ₀.2], hτ₁.1, by + linarith [hτ₁.2]⟩ + have hψ0X : ψ 0 ∈ X := by rw [hψ0]; exact haX + have hψ1X : ψ 1 ∈ X := by rw [hψ1]; exact hbX + rcases lt_or_gt_of_ne hτ with hlt | hlt + · obtain ⟨y₁, hy₁, y₂, hy₂, hc₁, hc₂, hcomp⟩ := exists_cut hinj hoff hbot hop hψ hψX hψ0X hψ1X + hl₀ hl₁ + hψr₀ hψr₁ hlt (by linarith [hl₁₁.2.2.2, hl₁₁.1]) (Or.inl ⟨rfl, rfl⟩) + obtain ⟨B, D, hlenBD, hB, hD, hBe, hDe, hB₁, hD₁⟩ := hsplit τ₀ τ₁ a b hl₁₁.1 hlt hl₁₁.2.2.2 hφ₀ + hφ₁ haV hbV + refine ⟨B, D.reverse, y₁, y₂, hy₁, hy₂, ?_, fun z hz => hWf z (hB z hz), fun z hz => hWf z (hD z + ((mem_walkPts_reverse D).mp hz)), fun e he => hWe e (hBe e he), fun e he => hWe e + (hDe e ?_), ?_, ?_, hcomp⟩ + · rw [GraphWalk.length_reverse, hlenBD, hlen] + · rw [GraphWalk.edges_reverse] at he + exact List.mem_reverse.mp he + · exact hcov τ₀ τ₁ hlt (by linarith [hl₁₁.2.2.2, hl₁₁.1]) hB₁ hc₂ + · refine (hcov τ₀ τ₁ hlt (by linarith [hl₁₁.2.2.2, hl₁₁.1]) hc₁ + (fun t ht => (mem_walkPts_reverse D).mpr (hD₁ t ht))).trans ?_ + rw [union_comm] + · obtain ⟨y₁, hy₁, y₂, hy₂, hc₁, hc₂, hcomp⟩ := exists_cut hinj hoff hbot hop hψ hψX hψ0X hψ1X + hl₀ hl₁ + hψr₀ hψr₁ hlt (by linarith [hl₁₁.2.1, hl₁₁.2.2.1]) (Or.inr ⟨rfl, rfl⟩) + obtain ⟨B, D, hlenBD, hB, hD, hBe, hDe, hB₁, hD₁⟩ := hsplit τ₁ τ₀ b a hl₁₁.2.2.1 hlt hl₁₁.2.1 + hφ₁ hφ₀ hbV haV + refine ⟨B.reverse, D, y₁, y₂, hy₁, hy₂, ?_, fun z hz => hWf z (hB z + ((mem_walkPts_reverse B).mp hz)), fun z hz => hWf z (hD z hz), fun e he => hWe e (hBe e ?_), + fun e he => hWe e (hDe e he), ?_, ?_, hcomp⟩ + · rw [GraphWalk.length_reverse, hlenBD, hlen] + · rw [GraphWalk.edges_reverse] at he + exact List.mem_reverse.mp he + · exact hcov τ₁ τ₀ hlt (by linarith [hl₁₁.2.1, hl₁₁.2.2.1]) + (fun t ht => (mem_walkPts_reverse B).mpr (hB₁ t ht)) hc₂ + · refine (hcov τ₁ τ₀ hlt (by linarith [hl₁₁.2.1, hl₁₁.2.2.1]) hc₁ hD₁).trans ?_ + rw [union_comm] + +/-- `walkPts` is the point set of the walk's drawing. -/ +theorem walkPts_eq {u v : S} (W : GraphWalk Γ.toGraph u v) : walkPts W = (walkDrawing Γ W).U := by + ext x + exact (mem_walkDrawing_U Γ W).symm + +omit [T2Space S] in +theorem length_pos_of_ne {u v : S} (W : GraphWalk Γ.toGraph u v) (h : u ≠ v) : 0 < W.length := by + cases W with + | nil _ => exact absurd rfl h + | cons _ _ => simp [GraphWalk.length, GraphWalk.edges] + +omit [T2Space S] in +theorem exists_support_eq {u v : S} (W : GraphWalk Γ.toGraph u v) : ∃ l, W.support = u :: l := by + cases W with + | nil _ => exact ⟨[], rfl⟩ + | cons _ r => exact ⟨r.support, rfl⟩ + +omit [T2Space S] in +/-- A point in the closure of a component of an open set, inside the open set, is in the component. +-/ +theorem mem_comp_of_closure [LocallyConnectedSpace S] {Y : Set S} (hY : IsOpen Y) {q x : S} + (hx : x ∈ closure (connectedComponentIn Y q)) (hxY : x ∈ Y) : x ∈ connectedComponentIn Y q := by + obtain ⟨t, ht₁, ht₂⟩ := mem_closure_iff.mp hx _ hY.connectedComponentIn + (mem_connectedComponentIn hxY) + rw [connectedComponentIn_eq ht₂, ← connectedComponentIn_eq ht₁] + exact mem_connectedComponentIn hxY + +variable {k : ℕ} {ins : Drawing S → Set S} + +/-- **The step that `ins(P + W⁻¹)` includes a component.** Let `P` be a simple walk from `a` to `b` +outside +`X`, and `R` a walk from `a` to `b` in `X`. Let `y` be a point of `U(P)` outside `X`. Then each +neighbourhood +of `y` contains a point `q` of `Σ − (X ∪ U(P))` whose component is in `ins(P + R⁻¹)`, and this +component has a +limit point in `X − U(P)`. -/ +theorem ins_side (hS : IsClosedSurface S) (hs : IsSlope Γ k ins) {X : Set S} + (hXc : IsClosed X) {a b : S} (hab : a ≠ b) {P R : GraphWalk Γ.toGraph a b} + (hP : P.IsSimple) (hPe : ∀ e ∈ P.edges, ¬ e ⊆ X) (hPv : ∀ x ∈ P.support, x ∈ X → x = a ∨ x = b) + (hRX : walkPts R ⊆ X) (hRe : ∀ e ∈ R.edges, e ⊆ X) (hlen : (P.append R.reverse).length < k) + {y : S} (hyL : y ∈ walkPts P) (hyX : y ∉ X) {O : Set S} (hO : IsOpen O) (hyO : y ∈ O) : + ∃ q ∈ O, q ∈ (X ∪ walkPts P)ᶜ ∧ + connectedComponentIn (X ∪ walkPts P)ᶜ q ⊆ insWalk ins Γ (P.append R.reverse) ∧ + ∃ x ∈ closure (connectedComponentIn (X ∪ walkPts P)ᶜ q), x ∈ X ∧ x ∉ walkPts P := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨R', hR's, hR'v, hR'e⟩ := GraphWalk.exists_isSimple R + have hR'pts : ∀ x ∈ walkPts R', x ∈ walkPts R := by + rintro x (hx | ⟨e, he, hx⟩) + · exact Or.inl (hR'v x hx) + · exact Or.inr ⟨e, hR'e e he, hx⟩ + let Q := P.append R'.reverse + have hRpos : 0 < R'.length := length_pos_of_ne R' hab + have hQs : Q.IsSimpleClosed := by + obtain ⟨l₁, hl₁⟩ := exists_support_eq P + obtain ⟨l₂, hl₂⟩ := exists_support_eq R'.reverse + have hPn : (a :: l₁).Nodup := hl₁ ▸ hP + have hRn : (b :: l₂).Nodup := hl₂ ▸ hR's.reverse + refine ⟨?_, ?_⟩ + · rw [GraphWalk.support_append, hl₁, hl₂] + change (l₁ ++ l₂).Nodup + refine List.nodup_append.mpr ⟨(List.nodup_cons.mp hPn).2, (List.nodup_cons.mp hRn).2, ?_⟩ + intro x hx y' hy' hxy + subst hxy + have hxP : x ∈ P.support := by + rw [hl₁] + exact List.mem_cons_of_mem _ hx + have hxR : x ∈ walkPts R := by + refine hR'pts x (Or.inl ?_) + have : x ∈ R'.reverse.support := by + rw [hl₂] + exact List.mem_cons_of_mem _ hy' + rw [GraphWalk.support_reverse] at this + exact List.mem_reverse.mp this + rcases hPv x hxP (hRX hxR) with rfl | rfl + · exact (List.nodup_cons.mp hPn).1 hx + · exact (List.nodup_cons.mp hRn).1 hy' + · rw [GraphWalk.edges_append] + refine List.nodup_append.mpr ⟨hP.edges_nodup, hR's.reverse.edges_nodup, ?_⟩ + intro e he e' he' hee + subst hee + rw [GraphWalk.edges_reverse] at he' + exact hPe e he (hRe e (hR'e e (List.mem_reverse.mp he'))) + have hQpos : 0 < Q.length := by + rw [GraphWalk.length_append, GraphWalk.length_reverse] + omega + let G := walkDrawing Γ (P.append R.reverse) + have hG : G.IsSubdrawing Γ := walkDrawing_isSubdrawing Γ _ + have hconf : IsConfined k G := isConfined_walk _ hlen + have hCG : (walkDrawing Γ Q).IsSubdrawing G := by + constructor + · change _ ⊆ (walkDrawing Γ (P.append R.reverse)).V + rw [walkDrawing_V, walkDrawing_V] + intro x hx + change x ∈ (P.append R.reverse).support + rcases (GraphWalk.mem_support_append _ _).mp hx with h | h + · exact (GraphWalk.mem_support_append _ _).mpr (Or.inl h) + · refine (GraphWalk.mem_support_append _ _).mpr (Or.inr ?_) + rw [GraphWalk.support_reverse] at h ⊢ + exact List.mem_reverse.mpr (hR'v x (List.mem_reverse.mp h)) + · change _ ⊆ (walkDrawing Γ (P.append R.reverse)).E + rw [walkDrawing_E, walkDrawing_E] + intro e he + change e ∈ (P.append R.reverse).edges + have he' : e ∈ Q.edges := he + simp only [Q, GraphWalk.edges_append, List.mem_append, GraphWalk.edges_reverse, + List.mem_reverse] at he' ⊢ + exact he'.imp id (hR'e e) + have hC : (walkDrawing Γ Q).IsCircuit := isCircuit_walkDrawing Γ hQs hQpos + let C := walkDrawing Γ Q + have hl := hconf C hC hCG + have hCΓ : C.IsSubdrawing Γ := hCG.trans hG + have hd := hs.isClosedDisc C hC hCΓ hl + obtain ⟨hf, hCins, -⟩ := ins_slope_facts hS hs hC hCΓ hl + have hbd : discBd (ins C) = C.U := by + rw [← IsClosedDisc.frontier_eq_discBd hS hd, hf] + have hCU : C.U = walkPts Q := (walkPts_eq Q).symm + have hLC : walkPts P ⊆ discBd (ins C) := by + rw [hbd, hCU] + exact fun x hx => (mem_walkPts_append _ _).mpr (Or.inl hx) + have hCXL : discBd (ins C) ⊆ X ∪ walkPts P := by + rw [hbd, hCU] + intro x hx + rcases (mem_walkPts_append _ _).mp hx with h | h + · exact Or.inr h + · exact Or.inl (hRX (hR'pts x ((mem_walkPts_reverse R').mp h))) + have hLc : IsClosed (walkPts P) := by + rw [walkPts_eq] + exact Drawing.isClosed_U _ + have hYo : IsOpen (X ∪ walkPts P)ᶜ := (hXc.union hLc).isOpen_compl + have hint := interior_eq_sdiff_discBd hS hd + have hIo : IsOpen (ins C \ discBd (ins C)) := hint ▸ isOpen_interior + have hIc := discBd_subset_closure hd (hLC hyL) + obtain ⟨w, ⟨hwO, hwX⟩, hwI⟩ := mem_closure_iff.mp hIc _ (hO.inter hXc.isOpen_compl) ⟨hyO, hyX⟩ + obtain ⟨q, ⟨⟨hqO, hqX⟩, hqI⟩, hqU⟩ := exists_notMem_U (Γ := walkDrawing Γ P) hS + ((hO.inter hXc.isOpen_compl).inter hIo) ⟨w, ⟨hwO, hwX⟩, hwI⟩ + rw [← walkPts_eq] at hqU + have hqY : q ∈ (X ∪ walkPts P)ᶜ := fun h => h.elim hqX hqU + have hQ'o := hYo.connectedComponentIn (x := q) + have hQ'Y : connectedComponentIn (X ∪ walkPts P)ᶜ q ⊆ (X ∪ walkPts P)ᶜ + := connectedComponentIn_subset _ _ + have hQ'p : IsPreconnected (connectedComponentIn (X ∪ walkPts P)ᶜ q) + := isPreconnected_connectedComponentIn + have hsubI : connectedComponentIn (X ∪ walkPts P)ᶜ q ⊆ ins C \ discBd (ins C) := by + refine hQ'p.subset_left_of_subset_union hIo hd.isCompact.isClosed.isOpen_compl + (disjoint_left.mpr fun x hx hx' => hx' hx.1) (fun x hx => ?_) + ⟨q, mem_connectedComponentIn hqY, hqI⟩ + by_cases hxi : x ∈ ins C + · exact Or.inl ⟨hxi, fun hb => hQ'Y hx (hCXL hb)⟩ + · exact Or.inr hxi + have hinsZ : ins C ⊆ insWalk ins Γ (P.append R.reverse) := fun x hx => + Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, hCG⟩, hx⟩) + refine ⟨q, hqO, hqY, fun x hx => hinsZ (hsubI hx).1, ?_⟩ + by_contra hno + push Not at hno + have hIp : IsPreconnected (ins C \ discBd (ins C)) := + (isOpenDisc_interior hS hd).isPathConnected.isConnected.isPreconnected + have hIQ : ins C \ discBd (ins C) ⊆ connectedComponentIn (X ∪ walkPts P)ᶜ q := by + refine hIp.subset_of_closure_inter_subset hQ'o ⟨q, hqI, mem_connectedComponentIn hqY⟩ ?_ + rintro x ⟨hx₁, hx₂⟩ + have hxL : x ∉ walkPts P := fun h => hx₂.2 (hLC h) + have hxX : x ∉ X := fun h => hxL (hno x hx₁ h) + exact mem_comp_of_closure hYo hx₁ (fun h => h.elim hxX hxL) + -- A point of an edge of `R'`. + obtain ⟨e, he⟩ : ∃ e, e ∈ R'.edges := by + by_contra hn + push Not at hn + have hnil : R'.edges = [] := List.eq_nil_iff_forall_not_mem.mpr hn + have : R'.length = 0 := by simp [GraphWalk.length, hnil] + omega + have heΓ := mem_E_of_mem_edges R' he + obtain ⟨r, hr⟩ := heΓ.1 + have hrX : r ∈ X := hRe e (hR'e e he) hr + have hrC : r ∈ discBd (ins C) := by + rw [hbd, hCU] + refine (mem_walkPts_append _ _).mpr (Or.inr ((mem_walkPts_reverse R').mpr (Or.inr ⟨e, he, + subset_closure hr⟩))) + have hrL : r ∉ walkPts P := by + have hrV : r ∉ Γ.V := (heΓ.2.1 hr).2 + rintro (h | ⟨f, hf, hrf⟩) + · exact hrV (mem_V_of_mem_support P h) + · have hfΓ := mem_E_of_mem_edges P hf + have hrf' : r ∈ f := by + rw [← Γ.closure_diff_V hfΓ] + exact ⟨hrf, hrV⟩ + obtain rfl := Γ.edge_eq_of_mem heΓ hfΓ hr hrf' + exact hPe e hf (hRe e (hR'e e he)) + exact hrL (hno r (closure_mono hIQ (discBd_subset_closure hd hrC)) hrX) + +/-- A restraint `X` such that each restraint `Y ⊇ X` with `l(Y) + d ≤ l(X)` is `X`. With `d = 0` +this says that `X` +is extreme. With `d = 1` it says that no restraint `Y ⊇ X` has `l(Y) < l(X)`, which is the +hypothesis of (8.13). -/ +def IsNearExtreme (Γ : Drawing S) (ins : Drawing S → Set S) (k d : ℕ) (X : Set S) : Prop := + IsRestraint Γ ins k X ∧ ∀ Y : Set S, IsRestraint Γ ins k Y → X ⊆ Y → + perimeterWalkLength Γ Y + d ≤ perimeterWalkLength Γ X → Y = X + +theorem IsExtremeRestraint.near {X : Set S} (h : IsExtremeRestraint Γ ins k X) : + IsNearExtreme Γ ins k 0 X := h + +theorem IsExtremeRestraint.near_one {X : Set S} (h : IsExtremeRestraint Γ ins k X) : + IsNearExtreme Γ ins k 1 X := + ⟨h.1, fun Y hY hXY hl => h.2 Y hY hXY (by omega)⟩ + +/-- **The step that `ins(P + W⁻¹)` does not include the far component.** If a restraint `X₁` with +`l(X₁) ≤ l(X)` +contains `bd(X)` and a point outside the extreme restraint `X`, then we have a contradiction. -/ +theorem no_cover [ConnectedSpace S] (hS : IsClosedSurface S) + (hs : IsSlope Γ k ins) {X X₁ : Set S} {d : ℕ} + (hX : IsNearExtreme Γ ins k d X) (hX₁ : IsRestraint Γ ins k X₁) + (hl : perimeterWalkLength Γ X₁ + d ≤ perimeterWalkLength Γ X) (hbd : frontier X ⊆ X₁) {y : S} + (hy : y ∈ X₁) (hyX : y ∉ X) : False := by + have hr := hX.1 + have h₄ := theorem_8_4_proof hS hs hr hX₁ hX₁ + obtain ⟨w, hw⟩ := (ne_univ_iff_exists_notMem _).mp h₄ + have hwX : w ∉ X := fun h => hw (Or.inl (Or.inl h)) + have hwX₁ : w ∉ X₁ := fun h => hw (Or.inr h) + have hc := isConnected_compl hS hX₁.isClosed hX₁.isGammaNice hX₁.isSimplyConnected hX₁.nonempty + hX₁.ne_univ + have hsub : X₁ᶜ ⊆ (closure X)ᶜ := by + refine hc.isPreconnected.subset_right_of_subset_union isOpen_interior + isClosed_closure.isOpen_compl + (disjoint_left.mpr fun x hx hx' => hx' (subset_closure (interior_subset hx))) (fun x hx => ?_) + ⟨w, hwX₁, ?_⟩ + · by_cases hxc : x ∈ closure X + · refine Or.inl ?_ + by_contra hni + exact hx (hbd ⟨hxc, hni⟩) + · exact Or.inr hxc + · rw [hr.isClosed.closure_eq] + exact hwX + have hXX₁ : X ⊆ X₁ := by + intro x hx + by_contra hn + exact hsub hn (subset_closure hx) + have heq := hX.2 X₁ hX₁ hXX₁ hl + exact hyX (heq ▸ hy) + +private theorem walk_points_inter_nice_set + {S : Type u} + [TopologicalSpace S] + {Γ : Drawing S} + [T2Space S] + {X : Set S} + {a : S} + {b : S} + (hXn : IsGammaNice Γ X) + (P₁ : GraphWalk Γ.toGraph a b) + (hP₁e' : ∀ e ∈ P₁.edges, ¬e ⊆ X) + (hPv₁ : ∀ x ∈ P₁.support, x ∈ X → x = a ∨ x = b) : + ∀ z ∈ walkPts P₁, z ∈ X → z = a ∨ z = b := by + rintro z (hz | ⟨g, hg, hzg⟩) hzX + · exact hPv₁ z hz hzX + · by_cases hzV : z ∈ Γ.V + · have hzU : z ∈ (walkDrawing Γ P₁).U := (mem_walkDrawing_U Γ P₁).mpr (Or.inr ⟨g, hg, hzg⟩) + have hzD := mem_V_of_mem_U' (walkDrawing_isSubdrawing Γ P₁) hzU hzV + rw [walkDrawing_V] at hzD + exact hPv₁ z hzD hzX + · have hgΓ := mem_E_of_mem_edges P₁ hg + have hz' : z ∈ g := by + rw [← Γ.closure_diff_V hgΓ] + exact ⟨hzg, hzV⟩ + exact (hP₁e' g hg (nice_atom hXn (Or.inl (Or.inr hgΓ)) ⟨z, hz', hzX⟩)).elim + +/-- The proof of (8.7) for a restraint `X` with `IsNearExtreme Γ ins k d X`. It finds a walk with +length less than the length of `P` plus `d`. -/ +theorem exists_walk_near [ConnectedSpace S] (hS : IsClosedSurface S) + (hs : IsSlope Γ k ins) {X : Set S} {d : ℕ} (hX : IsNearExtreme Γ ins k d X) {a b : S} + (ha : a ∈ (Γ.interSet (subBd X)).V) (hb : b ∈ (Γ.interSet (subBd X)).V) (hab : a ≠ b) + (P : GraphWalk Γ.toGraph a b) (hPe : ∀ e ∈ P.edges, ¬ e ⊆ X) + (hPv : ∀ x ∈ P.support, x ∈ X → x = a ∨ x = b) : + ∃ R : GraphWalk (Γ.interSet (subBd X)).toGraph a b, R.length < P.length + d := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hr := hX.1 + have hXc := hr.isClosed + have hXn := hr.isGammaNice + have hsb := subBd_eq_frontier X + rw [hsb] at ha hb ⊢ + have hH : (Γ.interSet (frontier X)).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have haV := hH.1 ha + have hbV := hH.1 hb + have haf : a ∈ frontier X := interSet_U_subset isClosed_frontier (Drawing.V_subset_U _ ha) + have hbf : b ∈ frontier X := interSet_U_subset isClosed_frontier (Drawing.V_subset_U _ hb) + have haX := hXc.frontier_subset haf + have hbX := hXc.frontier_subset hbf + obtain ⟨P₁, hP₁, hP₁v, hP₁e⟩ := GraphWalk.exists_isSimple P + have hlen₁ : P₁.length ≤ P.length := (hP₁.edges_nodup.subperm hP₁e).length_le + have hP₁e' : ∀ e ∈ P₁.edges, ¬ e ⊆ X := fun e he => hPe e (hP₁e e he) + have hPv₁ : ∀ x ∈ P₁.support, x ∈ X → x = a ∨ x = b := fun x hx => hPv x (hP₁v x hx) + have hline : IsLineWithEnds (walkPts P₁) a b := by + have := walk_isLine Γ P₁ hP₁ hab + have heq : walkPts P₁ = {x | x ∈ P₁.support} ∪ ⋃ e ∈ {e | e ∈ P₁.edges}, closure e := by + ext x + simp [walkPts] + rwa [heq] + have hLX : ∀ z ∈ walkPts P₁, z ∈ X → z = a ∨ z = b := by + exact walk_points_inter_nice_set (S := S) (Γ := Γ) (X := X) (a := a) (b := b) hXn P₁ hP₁e' + hPv₁ + obtain ⟨f, hf0, hf1⟩ := id hline + let ψ : I → S := fun t => (f t).1 + have hψc : Continuous ψ := continuous_subtype_val.comp f.continuous + have hrψ : range ψ = walkPts P₁ := by + ext y + exact ⟨by rintro ⟨t, rfl⟩; exact (f t).2, fun hy => ⟨f.symm ⟨y, hy⟩, by simp [ψ]⟩⟩ + have hψinj : Function.Injective ψ := fun s t h => f.injective (Subtype.ext h) + have hψX : ∀ t ∈ Ioo (0 : I) 1, ψ t ∉ X := by + intro t ht hm + rcases hLX (ψ t) (hrψ ▸ mem_range_self t) hm with h | h + · exact ht.1.ne' (hψinj (h.trans hf0.symm)) + · exact ht.2.ne (hψinj (h.trans hf1.symm)) + obtain ⟨R₁, R₂, y₁, y₂, hy₁, hy₂, hsum, hR₁f, hR₂f, hR₁e, hR₂e, hcov₁, hcov₂, hcomp⟩ := + exists_split_perimeter hS hXc hXn hr.isSimplyConnected hr.nonempty hr.ne_univ hab haV hbV hψc + hf0 hf1 + haf hbf hψX + rw [hrψ] at hy₁ hy₂ hcov₁ hcov₂ hcomp + have htrans : ∀ R : GraphWalk Γ.toGraph a b, walkPts R ⊆ frontier X → + (∀ e ∈ R.edges, e ⊆ frontier X) → + R.length < P.length + d → + ∃ R' : GraphWalk (Γ.interSet (frontier X)).toGraph a b, R'.length < P.length + d := by + intro R hf he hl + obtain ⟨R', -, hR'⟩ := hH.exists_walk_down R + (fun x hx => Or.inl ⟨⟨mem_V_of_mem_support R hx, hf (Or.inl hx)⟩, mem_V_of_mem_support R hx⟩) + (fun e hee => by + change e ∈ (Γ.span _ _).E + rw [Γ.span_E] + have heΓ := mem_E_of_mem_edges R hee + exact ⟨⟨heΓ, he e hee⟩, heΓ⟩) + refine ⟨R', ?_⟩ + rw [GraphWalk.length, hR'] + exact hl + by_cases h₁ : R₁.length < P₁.length + d + · exact htrans R₁ hR₁f hR₁e (by omega) + by_cases h₂ : R₂.length < P₁.length + d + · exact htrans R₂ hR₂f hR₂e (by omega) + exfalso + push Not at h₁ h₂ + have hlk := hr.length_lt + let Y := (X ∪ walkPts P₁)ᶜ + have hLc : IsClosed (walkPts P₁) := by + rw [walkPts_eq] + exact Drawing.isClosed_U _ + have hYo : IsOpen Y := (hXc.union hLc).isOpen_compl + -- The main step, for each of `R₁`, `R₂`. + have hgen : ∀ (R : GraphWalk Γ.toGraph a b) (d₁ d₂ : Set S), walkPts R ⊆ frontier X → + (∀ e ∈ R.edges, e ⊆ frontier X) → P₁.length + R.length + d ≤ perimeterWalkLength Γ X → + frontier X ⊆ walkPts R ∪ closure d₂ → + (∀ q ∈ Y, ∀ x ∈ closure (connectedComponentIn Y q), x ∈ X → x ∉ walkPts P₁ → + connectedComponentIn Y q = d₁ ∨ connectedComponentIn Y q = d₂) → + IsRestraint Γ ins k (insWalk ins Γ (P₁.append R.reverse)) ∧ + ∀ y ∈ walkPts P₁, y ∉ X → ∀ O : Set S, IsOpen O → y ∈ O → + ∃ q ∈ O, q ∈ Y ∧ connectedComponentIn Y q = d₁ ∧ connectedComponentIn Y q ≠ d₂ ∧ + connectedComponentIn Y q ⊆ insWalk ins Γ (P₁.append R.reverse) := by + intro R d₁ d₂ hRf hRe hlenR hcov hdich + have hlw₀ : (P₁.append R.reverse).length + d ≤ perimeterWalkLength Γ X := by + rw [GraphWalk.length_append, GraphWalk.length_reverse] + exact hlenR + have hlw : (P₁.append R.reverse).length ≤ perimeterWalkLength Γ X := by omega + obtain ⟨hrw, hlr⟩ := theorem_8_5_proof hS hs (P₁.append R.reverse) (hlw.trans_lt hlk) + refine ⟨hrw, fun y hyL hyX O hO hyO => ?_⟩ + obtain ⟨q, hqO, hqY, hsub, x, hx, hxX, hxL⟩ := ins_side hS hs hXc hab hP₁ hP₁e' hPv₁ + (hRf.trans hXc.frontier_subset) (fun e he => (hRe e he).trans hXc.frontier_subset) + (hlw.trans_lt hlk) hyL hyX hO hyO + have hUsub : ∀ z ∈ walkPts (P₁.append R.reverse), z ∈ insWalk ins Γ (P₁.append R.reverse) + := fun z hz => + Or.inl ((walkPts_eq _).subset hz) + have hne : connectedComponentIn Y q ≠ d₂ := by + intro he + have hcl : closure d₂ ⊆ insWalk ins Γ (P₁.append R.reverse) := + closure_minimal (he ▸ hsub) hrw.isClosed + refine no_cover hS hs hX hrw (by omega) (fun z hz => ?_) + (hUsub y ((mem_walkPts_append _ _).mpr (Or.inl hyL))) hyX + rcases hcov hz with h' | h' + · exact hUsub z ((mem_walkPts_append _ _).mpr (Or.inr ((mem_walkPts_reverse R).mpr h'))) + · exact hcl h' + rcases hdich q hqY x hx hxX hxL with h' | h' + · exact ⟨q, hqO, hqY, h', hne, hsub⟩ + · exact (hne h').elim + obtain ⟨hr₁, hg₁⟩ := hgen R₁ _ _ hR₁f hR₁e (by omega) hcov₁ hcomp + obtain ⟨hr₂, hg₂⟩ := hgen R₂ _ _ hR₂f hR₂e (by omega) hcov₂ fun q hq x hx hxX hxL => + (hcomp q hq x hx hxX hxL).symm + -- A point of the line outside `X`. + let t₀ : I := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht₀ : t₀ ∈ Ioo (0 : I) 1 := ⟨by + change (0 : ℝ) < 1 / 2 + norm_num, by + change (1 / 2 : ℝ) < 1 + norm_num⟩ + have hy₀L : ψ t₀ ∈ walkPts P₁ := hrψ ▸ mem_range_self t₀ + have hy₀X := hψX t₀ ht₀ + obtain ⟨q₁, -, hq₁Y, hq₁, -, hq₁s⟩ := hg₁ _ hy₀L hy₀X univ isOpen_univ (mem_univ _) + obtain ⟨q₂, -, hq₂Y, hq₂, -, hq₂s⟩ := hg₂ _ hy₀L hy₀X univ isOpen_univ (mem_univ _) + have h₄ := theorem_8_4_proof hS hs hr hr₁ hr₂ + obtain ⟨w, hw⟩ := (ne_univ_iff_exists_notMem _).mp h₄ + have hwX : w ∉ X := fun h => hw (Or.inl (Or.inl h)) + have hwX₁ : w ∉ insWalk ins Γ (P₁.append R₁.reverse) := fun h => hw (Or.inl (Or.inr h)) + have hwX₂ : w ∉ insWalk ins Γ (P₁.append R₂.reverse) := fun h => hw (Or.inr h) + have hwL : w ∉ walkPts P₁ := fun h => + hwX₁ (Or.inl ((walkPts_eq _).subset ((mem_walkPts_append _ _).mpr (Or.inl h)))) + have hwY : w ∈ Y := fun h => h.elim hwX hwL + have hwQ : w ∈ connectedComponentIn Y w := mem_connectedComponentIn hwY + have hne₁ : connectedComponentIn Y w ≠ connectedComponentIn Y y₁ := fun he => + hwX₁ (hq₁s (hq₁ ▸ he ▸ hwQ)) + have hne₂ : connectedComponentIn Y w ≠ connectedComponentIn Y y₂ := fun he => + hwX₂ (hq₂s (hq₂ ▸ he ▸ hwQ)) + have hno : ∀ x ∈ closure (connectedComponentIn Y w), x ∈ X → x ∈ walkPts P₁ := by + intro x hx hxX + by_contra hxL + exact (hcomp w hwY x hx hxX hxL).elim hne₁ hne₂ + have hM := isConnected_compl hS hXc hXn hr.isSimplyConnected hr.nonempty hr.ne_univ + have hQo : IsOpen (connectedComponentIn Y w) := hYo.connectedComponentIn + obtain ⟨y', hy'c, hy'X, hy'Q⟩ : ∃ y' ∈ closure (connectedComponentIn Y w), y' ∉ X ∧ + y' ∉ connectedComponentIn Y w := by + by_contra hall + push Not at hall + have hsub := hM.isPreconnected.subset_of_closure_inter_subset hQo ⟨w, hwX, hwQ⟩ + fun x hx => hall x hx.1 hx.2 + exact connectedComponentIn_subset _ _ (hsub hy₀X) (Or.inr hy₀L) + have hy'L : y' ∈ walkPts P₁ := by + by_contra hn + exact hy'Q (mem_comp_of_closure hYo hy'c (fun h => h.elim hy'X hn)) + -- The two sides of the line near `y'`. + have he₀ : walkPts P₁ \ {a, b} ∈ (lineDrawing hline hab).E := by + rw [lineDrawing_E] + rfl + have hy'e : y' ∈ walkPts P₁ \ {a, b} := ⟨hy'L, by + rintro (rfl | rfl) + · exact hy'X haX + · exact hy'X hbX⟩ + obtain ⟨W', A₁, A₂, -, -, hW'o, hy'W', -, hcover, hA₁p, hA₂p, hA₁U, hA₂U, -, -, -, -, -, -, -, -, + hA₁X, hA₂X⟩ := + exists_edge_sides_off hS (lineDrawing hline hab) he₀ hy'e hXc hy'X + have hAY : ∀ {A : Set S}, Disjoint A (lineDrawing hline hab).U → Disjoint A X → A ⊆ Y := by + intro A h₁ h₂ x hx hm + rcases hm with hm | hm + · exact disjoint_left.mp h₂ hx hm + · exact disjoint_left.mp h₁ hx hm + have hside : ∀ q ∈ W', q ∈ Y → (q ∈ A₁ ∧ A₁ ⊆ connectedComponentIn Y q) ∨ + (q ∈ A₂ ∧ A₂ ⊆ connectedComponentIn Y q) := by + intro q hqW hqY + have hqL : q ∉ (lineDrawing hline hab).U := fun h => hqY (Or.inr h) + rcases hcover ⟨hqW, hqL⟩ with h' | h' + · exact Or.inl ⟨h', hA₁p.subset_connectedComponentIn h' (hAY hA₁U hA₁X)⟩ + · exact Or.inr ⟨h', hA₂p.subset_connectedComponentIn h' (hAY hA₂U hA₂X)⟩ + obtain ⟨q₀, hq₀W, hq₀Q⟩ := mem_closure_iff.mp hy'c W' hW'o hy'W' + have hq₀Y : q₀ ∈ Y := connectedComponentIn_subset _ _ hq₀Q + have hq₀e := connectedComponentIn_eq hq₀Q + obtain ⟨q₃, hq₃W, hq₃Y, hq₃, hq₃n, -⟩ := hg₁ _ hy'L hy'X W' hW'o hy'W' + obtain ⟨q₄, hq₄W, hq₄Y, hq₄, hq₄n, -⟩ := hg₂ _ hy'L hy'X W' hW'o hy'W' + have hsame : ∀ {A : Set S} {q q' : S}, A.Nonempty → A ⊆ connectedComponentIn Y q → + A ⊆ connectedComponentIn Y q' → connectedComponentIn Y q = connectedComponentIn Y q' := by + rintro A q q' ⟨x, hx⟩ h₁ h₂ + exact (connectedComponentIn_eq (h₁ hx)).trans (connectedComponentIn_eq (h₂ hx)).symm + have hn₀₃ : connectedComponentIn Y q₀ ≠ connectedComponentIn Y q₃ := by + rw [← hq₀e, hq₃] + exact hne₁ + have hn₀₄ : connectedComponentIn Y q₀ ≠ connectedComponentIn Y q₄ := by + rw [← hq₀e, hq₄] + exact hne₂ + have hn₃₄ : connectedComponentIn Y q₃ ≠ connectedComponentIn Y q₄ := by + rw [hq₄] + exact hq₃n + rcases hside q₀ hq₀W hq₀Y with ⟨m₀, s₀⟩ | ⟨m₀, s₀⟩ <;> + rcases hside q₃ hq₃W hq₃Y with ⟨m₃, s₃⟩ | ⟨m₃, s₃⟩ <;> + rcases hside q₄ hq₄W hq₄Y with ⟨m₄, s₄⟩ | ⟨m₄, s₄⟩ <;> + first + | exact hn₀₃ (hsame ⟨_, m₀⟩ s₀ s₃) + | exact hn₀₄ (hsame ⟨_, m₀⟩ s₀ s₄) + | exact hn₃₄ (hsame ⟨_, m₃⟩ s₃ s₄) + +/-- **(8.7)** of Graph Minors XI (page 98): "Let $X$ be an extreme restraint, and let $a, b \in +V(\Gamma \cap bd(X))$ be distinct. Let +$P$ be a walk in $\Gamma$ from $a$ to $b$, such that no edge or internal vertex of $P$ is in +$X$. Then there is a walk of $\Gamma \cap bd(X)$ from $a$ to $b$ which is shorter than $P$." -/ +theorem theorem_8_7_proof [ConnectedSpace S] (hS : IsClosedSurface S) + (hs : IsSlope Γ k ins) {X : Set S} (hX : IsExtremeRestraint Γ ins k X) {a b : S} + (ha : a ∈ (Γ.interSet (subBd X)).V) (hb : b ∈ (Γ.interSet (subBd X)).V) (hab : a ≠ b) + (P : GraphWalk Γ.toGraph a b) (hPe : ∀ e ∈ P.edges, ¬ e ⊆ X) + (hPv : ∀ x ∈ P.support, x ∈ X → x = a ∨ x = b) : + ∃ R : GraphWalk (Γ.interSet (subBd X)).toGraph a b, R.length < P.length := + exists_walk_near hS hs hX.near ha hb hab P hPe hPv + +/-- (8.7), with `bd(X)` written as the frontier of `X`, for `IsNearExtreme`. -/ +theorem exists_walk_near' [ConnectedSpace S] (hS : IsClosedSurface S) + (hs : IsSlope Γ k ins) {X : Set S} {d : ℕ} (hX : IsNearExtreme Γ ins k d X) {a b : S} + (ha : a ∈ (Γ.interSet (frontier X)).V) (hb : b ∈ (Γ.interSet (frontier X)).V) (hab : a ≠ b) + (P : GraphWalk Γ.toGraph a b) (hPe : ∀ e ∈ P.edges, ¬ e ⊆ X) + (hPv : ∀ x ∈ P.support, x ∈ X → x = a ∨ x = b) : + ∃ R : GraphWalk (Γ.interSet (frontier X)).toGraph a b, R.length < P.length + d := by + have := exists_walk_near hS hs hX (by rwa [subBd_eq_frontier]) (by rwa [subBd_eq_frontier]) + hab P hPe hPv + rwa [subBd_eq_frontier] at this + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section88.lean b/LeanPool/GraphMinor/GM11/Section88.lean new file mode 100644 index 0000000000..f756e234fa --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section88.lean @@ -0,0 +1,920 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section87 +public import LeanPool.GraphMinor.GM11.Section81 +public import LeanPool.GraphMinor.GM11.Section79 + +/-! +# Graph Minors XI, (8.8) + +`theorem_8_8` says that the intersection and the union of two meeting extreme restraints are +simply-connected. +We follow the proof in the paper. The main step is `isPathConnected_inter`: the intersection is +arc-wise +connected. The walk lemmas come first. `runs_times` gives the vertices `v_i` of a perimeter walk as +points of +the collar, so that (8.1) applies to them. `exists_shortest` gives the walks `Q₁, Q₂` of the paper, +and +`walk_off` gives `U(Q₁) ∩ X₂ = {a₁, b₁}`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] {Γ : Drawing S} + +/-- The steps of a curve along a walk. -/ +theorem runs_times {φ : ℝ → S} {u v : S} (W : GraphWalk Γ.toGraph u v) : + ∀ {a b : ℝ}, RunsAlongOn Γ φ a b W → ∃ x : ℕ → ℝ, x 0 = a ∧ x W.length = b ∧ + (∀ i < W.length, x i < x (i + 1)) ∧ (∀ i ≤ W.length, φ (x i) ∈ W.support) ∧ + (∀ y ∈ W.support, ∃ i ≤ W.length, φ (x i) = y) ∧ + (∀ i < W.length, ∃ e ∈ W.edges, φ '' Ioo (x i) (x (i + 1)) = e) ∧ + ∀ e ∈ W.edges, ∃ i < W.length, φ '' Ioo (x i) (x (i + 1)) = e := by + induction W with + | nil hv => + rintro a b ⟨rfl, hu⟩ + refine ⟨fun _ => a, rfl, rfl, fun i hi => ?_, fun i _ => ?_, fun y hy => ⟨0, le_rfl, ?_⟩, + fun i hi => ?_, + fun e he => ?_⟩ + · simp [GraphWalk.length, GraphWalk.edges] at hi + · simp [GraphWalk.support, hu] + · simpa [GraphWalk.support, hu, eq_comm] using hy + · simp [GraphWalk.length, GraphWalk.edges] at hi + · simp [GraphWalk.edges] at he + | @cons u y v e hlink rest ih => + rintro a b ⟨c, hac, hu, -, him, hrest⟩ + obtain ⟨x, h0, h1, hstep, hsup, hall, hedge, hedge'⟩ := ih hrest + have hlen : (GraphWalk.cons hlink rest).length = rest.length + 1 := rfl + refine ⟨fun i => Nat.casesOn i a x, rfl, by rw [hlen]; exact h1, ?_, ?_, ?_, ?_, ?_⟩ + · rintro (_ | i) hi + · change a < x 0 + rw [h0] + exact hac + · rw [hlen] at hi + exact hstep i (by omega) + · rintro (_ | i) hi + · change φ a ∈ _ + rw [hu] + exact List.mem_cons_self + · rw [hlen] at hi + exact List.mem_cons_of_mem _ (hsup i (by omega)) + · intro z hz + rcases List.mem_cons.mp hz with rfl | hz + · exact ⟨0, Nat.zero_le _, hu⟩ + · obtain ⟨i, hi, he⟩ := hall z hz + exact ⟨i + 1, by rw [hlen]; omega, he⟩ + · rintro (_ | i) hi + · refine ⟨e, List.mem_cons_self, ?_⟩ + change φ '' Ioo a (x 0) = e + rw [h0] + exact him + · rw [hlen] at hi + obtain ⟨f, hf, hfe⟩ := hedge i (by omega) + exact ⟨f, List.mem_cons_of_mem _ hf, hfe⟩ + · intro f hf + rcases List.mem_cons.mp hf with rfl | hf + · refine ⟨0, by rw [hlen]; omega, ?_⟩ + change φ '' Ioo a (x 0) = _ + rw [h0] + exact him + · obtain ⟨i, hi, hfe⟩ := hedge' f hf + exact ⟨i + 1, by rw [hlen]; omega, hfe⟩ + +/-- Two vertices of a closed walk are joined by a walk. -/ +theorem exists_walk_of_mem_support {α β : Type*} {G : Graph α β} {u a b : α} + (W : GraphWalk G u u) (ha : a ∈ W.support) (hb : b ∈ W.support) : Nonempty (GraphWalk G a b) + := by + classical + obtain ⟨A, B, rfl⟩ := GraphWalk.exists_append_of_mem W ha + have hb' : b ∈ (B.append A).support := by + rcases (GraphWalk.mem_support_append _ _).mp hb with h | h + · exact (GraphWalk.mem_support_append _ _).mpr (Or.inr h) + · exact (GraphWalk.mem_support_append _ _).mpr (Or.inl h) + obtain ⟨P, -, -⟩ := GraphWalk.exists_append_of_mem (B.append A) hb' + exact ⟨P⟩ + +/-- A simple walk from a vertex to itself has no edges. -/ +theorem edges_eq_nil_of_isSimple {α β : Type*} {G : Graph α β} {u : α} {W : GraphWalk G u u} + (hW : W.IsSimple) : W.edges = [] := by + cases W with + | nil _ => rfl + | cons hl r => + exact ((List.nodup_cons.mp hW).1 r.end_mem_support).elim + +/-- **A shortest walk between two disjoint sets.** It is simple, and it meets the two sets only at +its +ends. -/ +theorem exists_shortest {α β : Type*} {G : Graph α β} {A B : Set α} + (hne : ∃ a ∈ A, ∃ b ∈ B, Nonempty (GraphWalk G a b)) : + ∃ a ∈ A, ∃ b ∈ B, ∃ Q : GraphWalk G a b, Q.IsSimple ∧ + (∀ a' ∈ A, ∀ b' ∈ B, ∀ Q' : GraphWalk G a' b', Q.length ≤ Q'.length) ∧ + (∀ x ∈ Q.support, x ∈ A → x = a) ∧ (∀ x ∈ Q.support, x ∈ B → x = b) := by + classical + have hP : ∃ n, ∃ a ∈ A, ∃ b ∈ B, ∃ Q : GraphWalk G a b, Q.length = n := by + obtain ⟨a, ha, b, hb, ⟨Q⟩⟩ := hne + exact ⟨_, a, ha, b, hb, Q, rfl⟩ + obtain ⟨a, ha, b, hb, Q₀, hQ₀⟩ := Nat.find_spec hP + have hmin : ∀ a' ∈ A, ∀ b' ∈ B, ∀ Q' : GraphWalk G a' b', Q₀.length ≤ Q'.length := by + intro a' ha' b' hb' Q' + rw [hQ₀] + exact Nat.find_min' hP ⟨a', ha', b', hb', Q', rfl⟩ + obtain ⟨Q, hQs, hQv, hQe⟩ := GraphWalk.exists_isSimple Q₀ + have hle : Q.length ≤ Q₀.length := (hQs.edges_nodup.subperm hQe).length_le + have hminQ : ∀ a' ∈ A, ∀ b' ∈ B, ∀ Q' : GraphWalk G a' b', Q.length ≤ Q'.length := + fun a' ha' b' hb' Q' => hle.trans (hmin a' ha' b' hb' Q') + have hpos : ∀ {p q : α} (W : GraphWalk G p q), p ≠ q → 0 < W.length := by + intro p q W hpq + cases W with + | nil _ => exact absurd rfl hpq + | cons _ _ => simp [GraphWalk.length, GraphWalk.edges] + refine ⟨a, ha, b, hb, Q, hQs, hminQ, ?_, ?_⟩ + · intro x hx hxA + by_contra hne + obtain ⟨P₁, P₂, rfl⟩ := GraphWalk.exists_append_of_mem Q hx + have h₁ := hminQ x hxA b hb P₂ + have h₂ := hpos P₁ (Ne.symm hne) + rw [GraphWalk.length_append] at h₁ + omega + · intro x hx hxB + by_contra hne + obtain ⟨P₁, P₂, rfl⟩ := GraphWalk.exists_append_of_mem Q hx + have h₁ := hminQ a ha x hxB P₁ + have h₂ := hpos P₂ hne + rw [GraphWalk.length_append] at h₁ + omega + +variable [T2Space S] {T : Set S} + +omit [T2Space S] in +/-- A walk from a point of a closed nice set `T` with no vertex on `bd(T)` except its last stays in +`T`. -/ +theorem walk_in (hTc : IsClosed T) (hTn : IsGammaNice Γ T) {w b : S} (Q : GraphWalk Γ.toGraph w b) : + Q.IsSimple → (∀ x ∈ Q.support, x ≠ b → x ∉ frontier T) → w ∈ T → + (∀ e ∈ Q.edges, e ⊆ T) ∧ ∀ x ∈ Q.support, x ∈ T := by + induction Q with + | nil _ => + intro _ _ hw + refine ⟨fun e he => by simp [GraphWalk.edges] at he, fun x hx => ?_⟩ + obtain rfl : x = _ := by simpa [GraphWalk.support] using hx + exact hw + | @cons w y b e hl r ih => + intro hs hfr hw + have hne : w ≠ b := fun h => (List.nodup_cons.mp hs).1 (h ▸ r.end_mem_support) + have hwf := hfr w List.mem_cons_self hne + have hwi : w ∈ interior T := by + by_contra hni + exact hwf ⟨subset_closure hw, hni⟩ + have hecl : w ∈ closure e := by + have : w ∈ closure e ∩ Γ.V := by + rw [hl.2.2.2] + exact Or.inl rfl + exact this.1 + have hycl : y ∈ closure e := by + have : y ∈ closure e ∩ Γ.V := by + rw [hl.2.2.2] + exact Or.inr rfl + exact this.1 + obtain ⟨z, hzi, hze⟩ := mem_closure_iff.mp hecl _ isOpen_interior hwi + have heT : e ⊆ T := nice_atom hTn (Or.inl (Or.inr hl.1)) ⟨z, hze, interior_subset hzi⟩ + have hyT : y ∈ T := closure_minimal heT hTc hycl + obtain ⟨h₁, h₂⟩ := ih hs.of_cons (fun x hx hxb => hfr x (List.mem_cons_of_mem _ hx) hxb) hyT + refine ⟨?_, ?_⟩ + · intro f hf + rcases List.mem_cons.mp hf with rfl | hf + · exact heT + · exact h₁ f hf + · intro x hx + rcases List.mem_cons.mp hx with rfl | hx + · exact hw + · exact h₂ x hx + +omit [T2Space S] in +/-- A walk from a point outside a closed nice set `T` with no vertex on `bd(T)` except its last has +no edge +in `T`, and no vertex in `T` except its last. -/ +theorem walk_out (hTn : IsGammaNice Γ T) (hTc : IsClosed T) {w b : S} + (Q : GraphWalk Γ.toGraph w b) : + Q.IsSimple → (∀ x ∈ Q.support, x ≠ b → x ∉ frontier T) → w ∉ T → + (∀ e ∈ Q.edges, ¬ e ⊆ T) ∧ ∀ x ∈ Q.support, x ≠ b → x ∉ T := by + induction Q with + | nil _ => + intro _ _ hw + refine ⟨fun e he => by simp [GraphWalk.edges] at he, fun x hx => ?_⟩ + obtain rfl : x = _ := by simpa [GraphWalk.support] using hx + exact fun _ => hw + | @cons w y b e hl r ih => + intro hs hfr hw + have hne : w ≠ b := fun h => (List.nodup_cons.mp hs).1 (h ▸ r.end_mem_support) + have hecl : w ∈ closure e := by + have : w ∈ closure e ∩ Γ.V := by + rw [hl.2.2.2] + exact Or.inl rfl + exact this.1 + have hycl : y ∈ closure e := by + have : y ∈ closure e ∩ Γ.V := by + rw [hl.2.2.2] + exact Or.inr rfl + exact this.1 + have heT : ¬ e ⊆ T := fun h => hw (closure_minimal h hTc hecl) + by_cases hyb : y = b + · subst hyb + have hnil := edges_eq_nil_of_isSimple hs.of_cons + refine ⟨fun f hf => ?_, fun x hx hxb => ?_⟩ + · rcases List.mem_cons.mp hf with rfl | hf + · exact heT + · rw [hnil] at hf + simp at hf + · rcases List.mem_cons.mp hx with rfl | hx + · exact hw + · have hr : r.support = [y] := by + cases r with + | nil _ => rfl + | cons _ _ => simp [GraphWalk.edges] at hnil + rw [hr] at hx + exact (hxb (List.mem_singleton.mp hx)).elim + have hyf := hfr y (List.mem_cons_of_mem _ r.start_mem_support) hyb + have hyT : y ∉ T := by + intro hyT + have hyi : y ∈ interior T := by + by_contra hni + exact hyf ⟨subset_closure hyT, hni⟩ + obtain ⟨z, hzi, hze⟩ := mem_closure_iff.mp hycl _ isOpen_interior hyi + exact heT (nice_atom hTn (Or.inl (Or.inr hl.1)) ⟨z, hze, interior_subset hzi⟩) + obtain ⟨h₁, h₂⟩ := ih hs.of_cons (fun x hx hxb => hfr x (List.mem_cons_of_mem _ hx) hxb) hyT + refine ⟨?_, ?_⟩ + · intro f hf + rcases List.mem_cons.mp hf with rfl | hf + · exact heT + · exact h₁ f hf + · intro x hx hxb + rcases List.mem_cons.mp hx with rfl | hx + · exact hw + · exact h₂ x hx hxb + +omit [T2Space S] in +/-- A simple walk from a vertex in a closed nice set `T`, with no inner vertex on `bd(T)`, and with +an edge +not in `T`, has no edge in `T` and meets `T` only at its ends (up to its last vertex). This is the +step +`U(Q₁) ∩ X₂ = {a₁, b₁}` in the proof of (8.8). -/ +theorem walk_off (hTc : IsClosed T) (hTn : IsGammaNice Γ T) {a b : S} (Q : GraphWalk Γ.toGraph a b) + (hs : Q.IsSimple) (hab : a ≠ b) (hfr : ∀ x ∈ Q.support, x ∈ frontier T → x = a ∨ x = b) + (ha : a ∈ T) + (hno : ¬ ∀ e ∈ Q.edges, e ⊆ T) : + (∀ e ∈ Q.edges, ¬ e ⊆ T) ∧ ∀ x ∈ Q.support, x ∈ T → x = a ∨ x = b := by + cases Q with + | nil _ => exact absurd rfl hab + | @cons _ y _ e hl r => + have hanot : a ∉ r.support := (List.nodup_cons.mp hs).1 + have hr : ∀ x ∈ r.support, x ≠ b → x ∉ frontier T := by + intro x hx hxb hxf + rcases hfr x (List.mem_cons_of_mem _ hx) hxf with rfl | h + · exact hanot hx + · exact hxb h + have hycl : y ∈ closure e := by + have : y ∈ closure e ∩ Γ.V := by + rw [hl.2.2.2] + exact Or.inr rfl + exact this.1 + by_cases heT : e ⊆ T + · have hyT : y ∈ T := closure_minimal heT hTc hycl + obtain ⟨h₁, -⟩ := walk_in hTc hTn r hs.of_cons hr hyT + refine (hno fun f hf => ?_).elim + rcases List.mem_cons.mp hf with rfl | hf + · exact heT + · exact h₁ f hf + by_cases hyb : y = b + · subst hyb + have hnil := edges_eq_nil_of_isSimple hs.of_cons + have hrs : r.support = [y] := by + cases r with + | nil _ => rfl + | cons _ _ => simp [GraphWalk.edges] at hnil + refine ⟨fun f hf => ?_, fun x hx _ => ?_⟩ + · rcases List.mem_cons.mp hf with rfl | hf + · exact heT + · rw [hnil] at hf + simp at hf + · rcases List.mem_cons.mp hx with rfl | hx + · exact Or.inl rfl + · rw [hrs] at hx + exact Or.inr (List.mem_singleton.mp hx) + have hyf := hr y r.start_mem_support hyb + have hyT : y ∉ T := by + intro hyT + have hyi : y ∈ interior T := by + by_contra hni + exact hyf ⟨subset_closure hyT, hni⟩ + obtain ⟨z, hzi, hze⟩ := mem_closure_iff.mp hycl _ isOpen_interior hyi + exact heT (nice_atom hTn (Or.inl (Or.inr hl.1)) ⟨z, hze, interior_subset hzi⟩) + obtain ⟨h₁, h₂⟩ := walk_out hTn hTc r hs.of_cons hr hyT + refine ⟨fun f hf => ?_, fun x hx hxT => ?_⟩ + · rcases List.mem_cons.mp hf with rfl | hf + · exact heT + · exact h₁ f hf + · rcases List.mem_cons.mp hx with rfl | hx + · exact Or.inl rfl + · by_contra hn + push Not at hn + exact h₂ x hx hn.2 hxT + +omit [T2Space S] in +/-- If all edges of a walk from a point of a closed set are in the set, then so are its vertices. -/ +theorem support_mem_of_edges (hTc : IsClosed T) {a b : S} (Q : GraphWalk Γ.toGraph a b) : + (∀ e ∈ Q.edges, e ⊆ T) → a ∈ T → ∀ x ∈ Q.support, x ∈ T := by + induction Q with + | nil _ => + intro _ ha x hx + obtain rfl : x = _ := by simpa [GraphWalk.support] using hx + exact ha + | @cons a y b e hl r ih => + intro he ha x hx + have hycl : y ∈ closure e := by + have : y ∈ closure e ∩ Γ.V := by + rw [hl.2.2.2] + exact Or.inr rfl + exact this.1 + have hyT : y ∈ T := closure_minimal (he e List.mem_cons_self) hTc hycl + rcases List.mem_cons.mp hx with rfl | hx + · exact ha + · exact ih (fun f hf => he f (List.mem_cons_of_mem _ hf)) hyT x hx + +variable [ConnectedSpace S] {k : ℕ} {ins : Drawing S → Set S} + +/-- `Γ ∩ bd(X)` is connected, for a restraint `X`: this is the reason the walks `Q₁, Q₂` exist in +the proof +of (8.8). -/ +theorem exists_walk_in_bd (hS : IsClosedSurface S) + {X : Set S} (hr : IsRestraint Γ ins k X) {a b : S} + (ha : a ∈ (Γ.interSet (frontier X)).V) (hb : b ∈ (Γ.interSet (frontier X)).V) : + Nonempty (GraphWalk (Γ.interSet (frontier X)).toGraph a b) := by + classical + obtain ⟨u, W, -, -, -, -, hwd⟩ := hr.exists_walk hS + have hH : (walkDrawing Γ W).IsSubdrawing Γ := walkDrawing_isSubdrawing Γ W + obtain ⟨W', hs, -⟩ := hH.exists_walk_down W + (fun x hx => by + rw [walkDrawing_V] + exact hx) + (fun e he => by + rw [walkDrawing_E] + exact he) + have hmem : ∀ {x}, x ∈ (Γ.interSet (frontier X)).V → x ∈ W'.support := by + intro x hx + rw [← hwd, walkDrawing_V] at hx + rw [hs] + exact hx + have hw : Nonempty (GraphWalk (walkDrawing Γ W).toGraph a b) := + exists_walk_of_mem_support W' (hmem ha) (hmem hb) + rwa [hwd] at hw + +omit [T2Space S] [ConnectedSpace S] in +/-- **The first step of (8.8).** A point of `X₁ ∩ X₂` is joined in `X₁ ∩ X₂` to a point of `bd(X₁)`, +unless +`X₂ ⊆ X₁`. -/ +theorem exists_joined_frontier {X₁ X₂ : Set S} (hc₁ : IsClosed X₁) (hp₂ : IsPathConnected X₂) + (hsub : ¬ X₂ ⊆ X₁) + {x : S} (hx : x ∈ X₁ ∩ X₂) : ∃ p ∈ frontier X₁, p ∈ pathComponentIn (X₁ ∩ X₂) x := by + obtain ⟨b, hb₂, hbn⟩ : ∃ b ∈ X₂, b ∉ pathComponentIn (X₁ ∩ X₂) x := by + by_contra hall + push Not at hall + exact hsub fun y hy => (pathComponentIn_subset (hall y hy)).1 + obtain ⟨γ, hγ⟩ := hp₂.joinedIn x hx.2 b hb₂ + let T₀ : Set I := γ ⁻¹' X₁ᶜ + have hT₀o : IsOpen T₀ := hc₁.isOpen_compl.preimage γ.continuous + have hT₀ne : T₀.Nonempty := by + by_contra hemp + have hall : ∀ t, γ t ∈ X₁ := fun t => by + by_contra hn + exact hemp ⟨t, hn⟩ + exact hbn ⟨γ, fun t => ⟨hall t, hγ t⟩⟩ + obtain ⟨α, hα, hleast⟩ := isClosed_closure.isCompact.exists_isLeast (hT₀ne.mono subset_closure) + have hbelow : ∀ r, r < α → γ r ∈ X₁ := fun r hr => by + by_contra hn + exact not_le.mpr hr (hleast (subset_closure hn)) + have hαX : γ α ∈ X₁ := by + by_contra hn + have hαT : α ∈ T₀ := hn + have hα0 : (0 : I) < α := by + refine unitInterval.pos_iff_ne_zero.mpr fun h0 => hn ?_ + rw [h0, γ.source] + exact hx.1 + have hne : (nhdsWithin α (Iio α)).NeBot := nhdsLT_neBot_of_exists_lt ⟨0, hα0⟩ + have hmem : T₀ ∩ Iio α ∈ nhdsWithin α (Iio α) := + Filter.inter_mem (mem_nhdsWithin_of_mem_nhds (hT₀o.mem_nhds hαT)) self_mem_nhdsWithin + obtain ⟨r, hr₁, hr₂⟩ := Filter.nonempty_of_mem hmem + exact hr₁ (hbelow r hr₂) + have hfr : γ α ∈ frontier X₁ := by + rw [frontier_eq_closure_inter_closure] + refine ⟨subset_closure hαX, ?_⟩ + exact image_closure_subset_closure_image γ.continuous (mem_image_of_mem _ hα) |> fun h => + closure_mono (image_preimage_subset _ _) h + refine ⟨γ α, hfr, ?_⟩ + refine ⟨⟨⟨fun t => γ (t * α), by fun_prop⟩, by simp, by simp⟩, fun t => ⟨?_, hγ _⟩⟩ + have hle : t * α ≤ α := unitInterval.mul_le_right + rcases eq_or_lt_of_le hle with he | hlt + · change γ (t * α) ∈ X₁ + rw [he] + exact hαX + · exact hbelow _ hlt + +omit [ConnectedSpace S] in +theorem interSet_isSub : (Γ.interSet T).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + +omit [ConnectedSpace S] in +theorem mem_interSet_V {y : S} (hy : y ∈ Γ.V) (hT : y ∈ T) : y ∈ (Γ.interSet T).V + := Or.inl ⟨⟨hy, hT⟩, hy⟩ + +omit [ConnectedSpace S] in +theorem edge_subset_of_interSet {a b : S} (Q : GraphWalk (Γ.interSet T).toGraph a b) {e : Set S} + (he : e ∈ Q.edges) : e ∈ Γ.E ∧ e ⊆ T := by + have h₁ : e ∈ (Γ.span _ _).E := mem_E_of_mem_edges Q he + rw [Γ.span_E] at h₁ + exact h₁.1 + +omit [ConnectedSpace S] in +omit [T2Space S] in +/-- A point of a nice set `T` in the closure of an edge not in `T` is on `bd(T)`. -/ +theorem frontier_of_edge_off (hTn : IsGammaNice Γ T) {e : Set S} (he : e ∈ Γ.E) + (hoff : ¬ e ⊆ T) {w : S} + (hw : w ∈ closure e) (hwT : w ∈ T) : w ∈ frontier T := by + refine ⟨subset_closure hwT, fun hi => hoff ?_⟩ + obtain ⟨z, hzi, hze⟩ := mem_closure_iff.mp hw _ isOpen_interior hi + exact nice_atom hTn (Or.inl (Or.inr he)) ⟨z, hze, interior_subset hzi⟩ + +/-- A walk with all its edges in a closed set `T` joins its ends in `T`. -/ +theorem joined_of_walk (hTc : IsClosed T) {a b : S} (Q : GraphWalk Γ.toGraph a b) : + (∀ e ∈ Q.edges, e ⊆ T) → a ∈ T → b ∈ pathComponentIn T a := by + induction Q with + | nil _ => + intro _ ha + exact mem_pathComponentIn_self ha + | @cons a y b e hl r ih => + intro he ha + have hin : ∀ {x}, x ∈ closure e ∩ Γ.V → x ∈ closure e := fun h => h.1 + have hacl : a ∈ closure e := hin (by rw [hl.2.2.2]; exact Or.inl rfl) + have hycl : y ∈ closure e := hin (by rw [hl.2.2.2]; exact Or.inr rfl) + have heT : e ⊆ T := he e List.mem_cons_self + have hsub : closure e ⊆ T := closure_minimal heT hTc + have hy : y ∈ pathComponentIn T a := + (isPathConnected_closure_edge hl.1).subset_pathComponentIn hacl hsub hycl + have := ih (fun f hf => he f (List.mem_cons_of_mem _ hf)) (hsub hycl) + rwa [pathComponentIn_congr hy] at this + +omit [T2Space S] [ConnectedSpace S] in +/-- **The steps (2) and (3) of (8.8).** Let `v₀, …, v_n` be points of `X`, in cyclic order, in the +sense that +two connected subsets of `X` through alternate points meet. Let `J ⊆ X`. Among the components of +`J`, choose +one, say `D`, whose first and last indices `i, j` are closest. Then no component of `J` meets +`{v_i, …, v_j}` and also a `v_q` with `q` outside of `i, …, j`, the two sets of points are disjoint, +and the +only component that meets `{v_i, …, v_j}` is `D`. -/ +theorem exists_interval {J X : Set S} (hJX : J ⊆ X) {n : ℕ} {v : ℕ → S} (hvX : ∀ p ≤ n, v p ∈ X) + (hne : ∃ p ≤ n, v p ∈ J) + (hcross : ∀ p q r s, p ≤ q → q ≤ r → r ≤ s → s ≤ n → ∀ P Q : Set S, IsPathConnected P + → IsPathConnected Q → + P ⊆ X → Q ⊆ X → v p ∈ P → v r ∈ P → v q ∈ Q → v s ∈ Q → (P ∩ Q).Nonempty) : + ∃ i j, i ≤ j ∧ j ≤ n ∧ v i ∈ J ∧ v j ∈ pathComponentIn J (v i) ∧ + (∀ q ≤ n, v q ∈ pathComponentIn J (v i) → i ≤ q ∧ q ≤ j) ∧ + (∀ p q, i ≤ p → p ≤ j → q ≤ n → ¬ (i ≤ q ∧ q ≤ j) → v p ≠ v q ∧ v q ∉ pathComponentIn J + (v p)) ∧ + ∀ p, i ≤ p → p ≤ j → v p ∈ J → v p ∈ pathComponentIn J (v i) := by + classical + let Good : ℕ → ℕ → Prop := fun i j => i ≤ j ∧ j ≤ n ∧ v i ∈ J ∧ v j ∈ pathComponentIn J (v i) ∧ + ∀ q ≤ n, v q ∈ pathComponentIn J (v i) → i ≤ q ∧ q ≤ j + have hgood : ∀ m ≤ n, v m ∈ J → ∃ i j, Good i j ∧ pathComponentIn J (v i) = pathComponentIn J + (v m) := by + intro m hm hmJ + let F := (Finset.range (n + 1)).filter fun q => v q ∈ pathComponentIn J (v m) + have hmF : m ∈ F := Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), + mem_pathComponentIn_self hmJ⟩ + have hF : F.Nonempty := ⟨m, hmF⟩ + have hmin := (Finset.mem_filter.mp (F.min'_mem hF)) + have hmax := (Finset.mem_filter.mp (F.max'_mem hF)) + have hc : pathComponentIn J (v (F.min' hF)) = pathComponentIn J (v m) + := pathComponentIn_congr hmin.2 + refine ⟨F.min' hF, F.max' hF, ⟨F.min'_le_max' hF, ?_, pathComponentIn_subset hmin.2, ?_, ?_⟩, + hc⟩ + · have := Finset.mem_range.mp hmax.1 + omega + · rw [hc] + exact hmax.2 + · intro q hq hqc + rw [hc] at hqc + have hqF : q ∈ F := Finset.mem_filter.mpr ⟨Finset.mem_range.mpr (by omega), hqc⟩ + exact ⟨F.min'_le q hqF, F.le_max' q hqF⟩ + have hex : ∃ d, ∃ i j, Good i j ∧ j - i = d := by + obtain ⟨m, hm, hmJ⟩ := hne + obtain ⟨i, j, hG, -⟩ := hgood m hm hmJ + exact ⟨_, i, j, hG, rfl⟩ + obtain ⟨i, j, hG, hd⟩ := Nat.find_spec hex + have hmin : ∀ a b, Good a b → j - i ≤ b - a := fun a b h => by + rw [hd] + exact Nat.find_min' hex ⟨a, b, h, rfl⟩ + obtain ⟨hij, hjn, hiJ, hjD, hrange⟩ := hG + have hsub : pathComponentIn J (v i) ⊆ X := pathComponentIn_subset.trans hJX + have hDp : IsPathConnected (pathComponentIn J (v i)) := isPathConnected_pathComponentIn hiJ + have hself : v i ∈ pathComponentIn J (v i) := mem_pathComponentIn_self hiJ + have hmeet : ∀ p q, i ≤ p → p ≤ j → q ≤ n → ¬ (i ≤ q ∧ q ≤ j) → ∀ P : Set S, IsPathConnected P + → P ⊆ X → + v p ∈ P → v q ∈ P → (P ∩ pathComponentIn J (v i)).Nonempty := by + intro p q hp hp' hq hout P hP hPX hpP hqP + by_cases hqi : q < i + · exact hcross q i p j hqi.le hp hp' hjn P _ hP hDp hPX hsub hqP hpP hself hjD + · have hjq : j ≤ q := by omega + have := hcross i p j q hp hp' hjq hq _ P hDp hP hsub hPX hself hjD hpP hqP + rwa [inter_comm] at this + have hsep : ∀ p q, i ≤ p → p ≤ j → q ≤ n → ¬ (i ≤ q ∧ q ≤ j) → + v p ≠ v q ∧ v q ∉ pathComponentIn J (v p) := by + intro p q hp hp' hq hout + constructor + · intro he + obtain ⟨z, hz, hzD⟩ := hmeet p q hp hp' hq hout {v p} (isPathConnected_singleton _) + (singleton_subset_iff.mpr (hvX p (by omega))) rfl he.symm + obtain rfl : z = v p := hz + exact hout (hrange q hq (he ▸ hzD)) + · intro hqc + have hpJ : v p ∈ J := by + by_contra hn + have : pathComponentIn J (v p) = ∅ := by + by_contra hne' + exact hn (pathComponentIn_nonempty_iff.mp (nonempty_iff_ne_empty.mpr hne')) + rw [this] at hqc + exact hqc + obtain ⟨z, hz, hzD⟩ := hmeet p q hp hp' hq hout _ (isPathConnected_pathComponentIn hpJ) + (pathComponentIn_subset.trans hJX) (mem_pathComponentIn_self hpJ) hqc + have heq : pathComponentIn J (v p) = pathComponentIn J (v i) := + (pathComponentIn_congr hz).symm.trans (pathComponentIn_congr hzD) + exact hout (hrange q hq (heq ▸ hqc)) + refine ⟨i, j, hij, hjn, hiJ, hjD, hrange, hsep, fun p hp hp' hpJ => ?_⟩ + by_contra hn + have hpn : p ≤ n := by omega + obtain ⟨a, b, ⟨hab, hbn, haJ, hbD, hr⟩, hcomp⟩ := hgood p hpn hpJ + have hpc : v p ∈ pathComponentIn J (v a) := by + rw [hcomp] + exact mem_pathComponentIn_self hpJ + obtain ⟨hap, hpb⟩ := hr p hpn hpc + have hnotD : ∀ {z}, z ∈ pathComponentIn J (v a) → z ∉ pathComponentIn J (v i) := by + intro z hz hzD + have : pathComponentIn J (v a) = pathComponentIn J (v i) := + (pathComponentIn_congr hz).symm.trans (pathComponentIn_congr hzD) + exact hn (this ▸ hpc) + have hane : a ≠ i := fun h => hnotD (mem_pathComponentIn_self haJ) (h ▸ hself) + have hbne : b ≠ j := fun h => hnotD hbD (h ▸ hjD) + by_cases ha : a < i + · refine (hsep p a hp hp' (by omega) (by omega)).2 ?_ + rw [← hcomp] + exact mem_pathComponentIn_self haJ + by_cases hb : j < b + · refine (hsep p b hp hp' hbn (by omega)).2 ?_ + rw [← hcomp] + exact hbD + have := hmin a b ⟨hab, hbn, haJ, hbD, hr⟩ + omega + +/-- The vertices `v₀, …, v_n` and edges of a perimeter walk of a restraint, with the properties that +the +proof of (8.8) needs. The last property comes from (8.1). -/ +theorem exists_vertices (hS : IsClosedSurface S) + {X : Set S} (hr : IsRestraint Γ ins k X) : + ∃ (n : ℕ) (v : ℕ → S), v 0 = v n ∧ (∀ p ≤ n, v p ∈ (Γ.interSet (frontier X)).V) ∧ + (∀ y ∈ (Γ.interSet (frontier X)).V, ∃ p ≤ n, v p = y) ∧ + (∀ p < n, ∃ e ∈ Γ.E, e ⊆ frontier X ∧ v p ∈ closure e ∧ v (p + 1) ∈ closure e) ∧ + (∀ y ∈ frontier X, (∃ p ≤ n, v p = y) ∨ ∃ p < n, ∃ e ∈ Γ.E, e ⊆ frontier X ∧ y ∈ e + ∧ v p ∈ closure e) ∧ + ∀ p q r s, p ≤ q → q ≤ r → r ≤ s → s ≤ n → ∀ P Q : Set S, IsPathConnected P + → IsPathConnected Q → + P ⊆ X → Q ⊆ X → v p ∈ P → v r ∈ P → v q ∈ Q → v s ∈ Q → (P ∩ Q).Nonempty := by + classical + obtain ⟨u, W, hW, -, -, -, hwd⟩ := hr.exists_walk hS + obtain ⟨h, hinj, hoff, hrng, -, hcase⟩ := hW + rw [subBd_eq_frontier] at hrng + have hXc := hr.isClosed + have hXs := hr.isSimplyConnected + have hfX : frontier X ⊆ X := hXc.frontier_subset + have hbot : ∀ z, h (z, 0) ∈ X := fun z => hfX (hrng ▸ mem_range_self z) + obtain ⟨A, hA, hXA⟩ := exists_openDisc_around hS hXc hr.isGammaNice hXs hr.ne_univ + let φ : ℝ → S := fun t => h (circlePt t, 0) + have hφc : Continuous φ := h.continuous.comp (continuous_circlePt.prodMk continuous_const) + have hper : φ 1 = φ 0 := by + change h (circlePt 1, 0) = h (circlePt 0, 0) + simp [circlePt] + have hrun : ∃ b : ℝ, (b = 0 ∨ b = 1) ∧ RunsAlongOn Γ φ 0 b W := by + rcases hcase with ⟨hl, hc⟩ | ⟨-, hrun⟩ + · cases W with + | nil _ => exact ⟨0, Or.inl rfl, rfl, hc _⟩ + | cons _ _ => simp [GraphWalk.length, GraphWalk.edges] at hl + · exact ⟨1, Or.inr rfl, hrun⟩ + obtain ⟨b, hb, hrun⟩ := hrun + obtain ⟨x, hx0, hxn, hstep, hsup, hall, hedge, hedge'⟩ := runs_times W hrun + have hmono : ∀ {p q}, p ≤ q → q ≤ W.length → x p ≤ x q := by + intro p q hpq + induction q, hpq using Nat.le_induction with + | base => exact fun _ => le_rfl + | succ q hq ih => + intro hl + exact (ih (by omega)).trans (hstep q (by omega)).le + have hx0' : ∀ {p}, p ≤ W.length → 0 ≤ x p := fun hp => hx0 ▸ hmono (Nat.zero_le _) hp + have hxb : ∀ {p}, p ≤ W.length → x p ≤ 1 := fun hp => by + have := hmono hp le_rfl + rw [hxn] at this + rcases hb with rfl | rfl + · exact this.trans zero_le_one + · exact this + have hV : ∀ y, y ∈ (Γ.interSet (frontier X)).V ↔ y ∈ W.support := by + intro y + rw [← hwd, walkDrawing_V] + rfl + have hE : ∀ e ∈ W.edges, e ∈ Γ.E ∧ e ⊆ frontier X := by + intro e he + have h₁ : e ∈ (walkDrawing Γ W).E := by + rw [walkDrawing_E] + exact he + rw [hwd] at h₁ + change e ∈ (Γ.span _ _).E at h₁ + rw [Γ.span_E] at h₁ + exact h₁.1 + have hcl : ∀ p < W.length, ∀ e, φ '' Ioo (x p) (x (p + 1)) = e → φ (x p) ∈ closure e ∧ + φ (x (p + 1)) ∈ closure e := by + rintro p hp _ rfl + have hlt := hstep p hp + have hsub : φ '' Icc (x p) (x (p + 1)) ⊆ closure (φ '' Ioo (x p) (x (p + 1))) := by + rw [← closure_Ioo hlt.ne] + exact image_closure_subset_closure_image hφc + exact ⟨hsub ⟨_, left_mem_Icc.mpr hlt.le, rfl⟩, hsub ⟨_, right_mem_Icc.mpr hlt.le, rfl⟩⟩ + refine ⟨W.length, fun p => φ (x p), ?_, fun p hp => (hV _).mpr (hsup p hp), + fun y hy => hall y ((hV y).mp hy), + fun p hp => ?_, fun y hy => ?_, ?_⟩ + · change φ (x 0) = φ (x W.length) + rw [hx0, hxn] + rcases hb with rfl | rfl + · rfl + · exact hper.symm + · obtain ⟨e, he, hee⟩ := hedge p hp + exact ⟨e, (hE e he).1, (hE e he).2, hcl p hp e hee⟩ + · have hy' : y ∈ (walkDrawing Γ W).U := by + rw [hwd, frontier_interSet hS hXc hr.isGammaNice] + exact hy + rcases (mem_walkDrawing_U Γ W).mp hy' with hys | ⟨e, he, hye⟩ + · exact Or.inl (hall y hys) + by_cases hyV : y ∈ Γ.V + · exact Or.inl (hall y ((hV y).mp (mem_interSet_V hyV hy))) + · have hye' : y ∈ e := by + have : y ∈ closure e \ Γ.V := ⟨hye, hyV⟩ + rwa [Γ.closure_diff_V (hE e he).1] at this + obtain ⟨p, hp, hpe⟩ := hedge' e he + exact Or.inr ⟨p, hp, e, (hE e he).1, (hE e he).2, hye', (hcl p hp e hpe).1⟩ + · intro p q r s hpq hqr hrs hsn P Q hP hQ hPX hQX hpP hrP hqQ hsQ + have hrn : r ≤ W.length := by omega + have hqn : q ≤ W.length := by omega + have hpn : p ≤ W.length := by omega + refine theorem_8_1_proof hS hA hXA hXs.1 hinj hoff hbot (hmono hpq hqn) (hmono hqr hrn) + (hmono hrs hsn) ?_ + hP hQ hPX hQX hpP hrP hqQ hsQ + linarith [hxb hsn, hx0' hpn] + +/-- **The step of (8.7) in (8.8).** Let `X` be a restraint as in `IsNearExtreme`, and `Q` a simple +walk in `Γ ∩ T` +between two vertices of `Γ ∩ bd(X)`, with no inner vertex on `bd(X)`, and with some edge not in `X`. +Then some walk +of `Γ ∩ bd(X)` between the ends of `Q` has length less than that of `Q` plus `d`. -/ +theorem exists_shorter (hS : IsClosedSurface S) + (hs : IsSlope Γ k ins) {X : Set S} {d : ℕ} (hX : IsNearExtreme Γ ins k d X) {a b : S} + (ha : a ∈ (Γ.interSet (frontier X)).V) (hb : b ∈ (Γ.interSet (frontier X)).V) (hab : a ≠ b) + (hHa : a ∈ X) (Q : GraphWalk (Γ.interSet T).toGraph a b) (hQ : Q.IsSimple) + (hfr : ∀ x ∈ Q.support, x ∈ frontier X → x = a ∨ x = b) (hno : ¬ ∀ e ∈ Q.edges, e ⊆ X) : + ∃ R : GraphWalk (Γ.interSet (frontier X)).toGraph a b, R.length < Q.length + d := by + obtain ⟨Q', hsup, hed⟩ := (interSet_isSub (Γ := Γ) (T := T)).exists_walk_up Q + have hs' : Q'.IsSimple := by + unfold GraphWalk.IsSimple + rw [hsup] + exact hQ + obtain ⟨h₁, h₂⟩ := walk_off hX.1.isClosed hX.1.isGammaNice Q' hs' hab (by rwa [hsup]) hHa + (by rwa [hed]) + obtain ⟨R, hR⟩ := exists_walk_near' hS hs hX ha hb hab Q' h₁ h₂ + refine ⟨R, ?_⟩ + have hl : Q'.length = Q.length := by simp [GraphWalk.length, hed] + omega + +/-- The first part of (8.8) of Graph Minors XI (page 98): "`X₁ ∩ X₂` is arc-wise connected". The +proof gives +more: it needs that `X₂` is extreme, and of `X₁` only that no restraint `Y ⊇ X₁` has `l(Y) < l(X₁)`. +-/ +theorem isPathConnected_inter (hS : IsClosedSurface S) + (hs : IsSlope Γ k ins) {X₁ X₂ : Set S} (h₁ : IsNearExtreme Γ ins k 1 X₁) + (h₂ : IsExtremeRestraint Γ ins k X₂) (hne : (X₁ ∩ X₂).Nonempty) : IsPathConnected (X₁ ∩ X₂) + := by + classical + have r₁ := h₁.1 + have r₂ := h₂.1 + have c₁ := r₁.isClosed + have c₂ := r₂.isClosed + have n₂ := r₂.isGammaNice + by_cases hsub : X₂ ⊆ X₁ + · rw [inter_eq_right.mpr hsub] + exact r₂.isSimplyConnected.1 + obtain ⟨n, v, hcyc, hvV, hVv, hedge, hcov, hcross⟩ := exists_vertices hS r₁ + have hJc : IsClosed (X₁ ∩ X₂) := c₁.inter c₂ + have hf₁ : frontier X₁ ⊆ X₁ := c₁.frontier_subset + have hf₂ : frontier X₂ ⊆ X₂ := c₂.frontier_subset + have hvf : ∀ p ≤ n, v p ∈ frontier X₁ := fun p hp => + interSet_U_subset isClosed_frontier ((Γ.interSet (frontier X₁)).V_subset_U (hvV p hp)) + have hvΓ : ∀ p ≤ n, v p ∈ Γ.V := fun p hp => (interSet_isSub (Γ := Γ)).1 (hvV p hp) + have hstepJ : ∀ e ∈ Γ.E, e ⊆ frontier X₁ → e ⊆ X₂ → ∀ {a b : S}, a ∈ closure e → b ∈ closure e → + b ∈ pathComponentIn (X₁ ∩ X₂) a := fun e he h h' a b ha hb => + (isPathConnected_closure_edge he).subset_pathComponentIn ha + (subset_inter (closure_minimal (h.trans hf₁) c₁) (closure_minimal h' c₂)) hb + -- The step (1): each component contains a vertex of the perimeter walk. + have hone : ∀ x ∈ X₁ ∩ X₂, ∃ p ≤ n, v p ∈ X₁ ∩ X₂ ∧ v p ∈ pathComponentIn (X₁ ∩ X₂) x := by + intro x hx + obtain ⟨y, hyf, hyc⟩ := exists_joined_frontier c₁ r₂.isSimplyConnected.1 hsub hx + have hyJ := pathComponentIn_subset hyc + rcases hcov y hyf with ⟨p, hp, rfl⟩ | ⟨p, hp, e, he, hef, hye, hpe⟩ + · exact ⟨p, hp, hyJ, hyc⟩ + · have heX : e ⊆ X₂ := nice_atom n₂ (Or.inl (Or.inr he)) ⟨y, hye, hyJ.2⟩ + have h₃ := hstepJ e he hef heX (subset_closure hye) hpe + rw [pathComponentIn_congr hyc] at h₃ + exact ⟨p, by omega, pathComponentIn_subset h₃, h₃⟩ + obtain ⟨p₀, hp₀, hv₀, -⟩ := hone _ hne.some_mem + obtain ⟨i, j, hij, hjn, hiJ, hjD, hrange, hsep, hin⟩ := exists_interval inter_subset_left + (fun p hp => hf₁ (hvf p hp)) ⟨p₀, hp₀, hv₀⟩ hcross + have hself := mem_pathComponentIn_self hiJ + suffices hall : ∀ p ≤ n, v p ∈ X₁ ∩ X₂ → v p ∈ pathComponentIn (X₁ ∩ X₂) (v i) by + have heq : pathComponentIn (X₁ ∩ X₂) (v i) = X₁ ∩ X₂ := by + refine subset_antisymm pathComponentIn_subset fun x hx => ?_ + obtain ⟨p, hp, hpJ, hpc⟩ := hone x hx + rw [← pathComponentIn_congr (hall p hp hpJ), pathComponentIn_congr hpc] + exact mem_pathComponentIn_self hx + rw [← heq] + exact isPathConnected_pathComponentIn hiJ + by_cases hend : i = 0 ∨ j = n + · have h0 : v 0 ∈ pathComponentIn (X₁ ∩ X₂) (v i) := by + rcases hend with h | h + · exact h ▸ hself + · rw [hcyc, ← h] + exact hjD + have hnD : v n ∈ pathComponentIn (X₁ ∩ X₂) (v i) := hcyc ▸ h0 + have hi0 := (hrange 0 (Nat.zero_le _) h0).1 + have hjn' := (hrange n le_rfl hnD).2 + exact fun p hp hpJ => hin p (by omega) (by omega) hpJ + push Not at hend + obtain ⟨hi0, hjn'⟩ := hend + -- The step (4). + obtain ⟨e₁, he₁, hf₁e, ha₁, hb₁⟩ := hedge (i - 1) (by omega) + have hi1 : i - 1 + 1 = i := by omega + rw [hi1] at hb₁ + have hoff₁ : ¬ e₁ ⊆ X₂ := fun h => by + have := (hrange (i - 1) (by omega) (hstepJ e₁ he₁ hf₁e h hb₁ ha₁)).1 + omega + obtain ⟨e₂, he₂, hf₂e, ha₂, hb₂⟩ := hedge j (by omega) + have hoff₂ : ¬ e₂ ⊆ X₂ := fun h => by + have h₃ := hstepJ e₂ he₂ hf₂e h ha₂ hb₂ + rw [pathComponentIn_congr hjD] at h₃ + have := (hrange (j + 1) (by omega) h₃).2 + omega + -- The sets `Z₁, Z₂`. + let Z₁ : Set S := {y | y ∈ Γ.V ∧ y ∈ frontier X₁ ∧ y ∈ frontier X₂ ∧ ∃ p, i ≤ p ∧ p ≤ j ∧ v p = y} + let Z₂ : Set S := {y | y ∈ Γ.V ∧ y ∈ frontier X₁ ∧ y ∈ frontier X₂ ∧ ∃ q ≤ n, ¬ (i ≤ q ∧ q ≤ j) + ∧ v q = y} + have hdis : Disjoint Z₁ Z₂ := by + refine disjoint_left.mpr ?_ + rintro y ⟨-, -, -, p, hp, hp', rfl⟩ ⟨-, -, -, q, hq, hout, he⟩ + exact (hsep p q hp hp' hq hout).1 he.symm + have hsepZ : ∀ a ∈ Z₁, ∀ b ∈ Z₂, b ∉ pathComponentIn (X₁ ∩ X₂) a := by + rintro _ ⟨-, -, -, p, hp, hp', rfl⟩ _ ⟨-, -, -, q, hq, hout, rfl⟩ + exact (hsep p q hp hp' hq hout).2 + have hclass : ∀ y ∈ Γ.V, y ∈ frontier X₁ → y ∈ frontier X₂ → y ∈ Z₁ ∨ y ∈ Z₂ := by + intro y hyV hy₁ hy₂ + obtain ⟨p, hp, rfl⟩ := hVv y (mem_interSet_V hyV hy₁) + by_cases hin' : i ≤ p ∧ p ≤ j + · exact Or.inl ⟨hyV, hy₁, hy₂, p, hin'.1, hin'.2, rfl⟩ + · exact Or.inr ⟨hyV, hy₁, hy₂, p, hp, hin', rfl⟩ + have hZ₁ : v i ∈ Z₁ := ⟨hvΓ i (by omega), hvf i (by omega), + frontier_of_edge_off n₂ he₁ hoff₁ hb₁ hiJ.2, i, le_rfl, hij, rfl⟩ + have hZ₂ : ¬ Z₂.Nonempty := by + rintro ⟨b, hb⟩ + have hVZ : ∀ {T' : Set S} {y}, y ∈ Γ.V → y ∈ T' → y ∈ (Γ.interSet T').V := fun h h' + => mem_interSet_V h h' + obtain ⟨a₁, ha₁', b₁, hb₁', Q₁, hs₁, hm₁, hA₁, hB₁⟩ := exists_shortest + (G := (Γ.interSet (frontier X₁)).toGraph) ⟨v i, hZ₁, b, hb, + exists_walk_in_bd hS r₁ (hVZ hZ₁.1 hZ₁.2.1) (hVZ hb.1 hb.2.1)⟩ + obtain ⟨a₂, ha₂', b₂, hb₂', Q₂, hs₂, hm₂, hA₂, hB₂⟩ := exists_shortest + (G := (Γ.interSet (frontier X₂)).toGraph) ⟨v i, hZ₁, b, hb, + exists_walk_in_bd hS r₂ (hVZ hZ₁.1 hZ₁.2.2.1) (hVZ hb.1 hb.2.2.1)⟩ + have hne₁ : a₁ ≠ b₁ := fun h => disjoint_left.mp hdis ha₁' (h ▸ hb₁') + have hne₂ : a₂ ≠ b₂ := fun h => disjoint_left.mp hdis ha₂' (h ▸ hb₂') + have hno₁ : ¬ ∀ e ∈ Q₁.edges, e ⊆ X₂ := by + intro hall + obtain ⟨Q', -, hed⟩ := (interSet_isSub (Γ := Γ) (T := frontier X₁)).exists_walk_up Q₁ + refine hsepZ a₁ ha₁' b₁ hb₁' (joined_of_walk hJc Q' (fun e he => ?_) ⟨hf₁ ha₁'.2.1, + hf₂ ha₁'.2.2.1⟩) + rw [hed] at he + exact subset_inter ((edge_subset_of_interSet Q₁ he).2.trans hf₁) (hall e he) + have hno₂ : ¬ ∀ e ∈ Q₂.edges, e ⊆ X₁ := by + intro hall + obtain ⟨Q', -, hed⟩ := (interSet_isSub (Γ := Γ) (T := frontier X₂)).exists_walk_up Q₂ + refine hsepZ a₂ ha₂' b₂ hb₂' (joined_of_walk hJc Q' (fun e he => ?_) ⟨hf₁ ha₂'.2.1, + hf₂ ha₂'.2.2.1⟩) + rw [hed] at he + exact subset_inter (hall e he) ((edge_subset_of_interSet Q₂ he).2.trans hf₂) + have hfr₁ : ∀ x ∈ Q₁.support, x ∈ frontier X₂ → x = a₁ ∨ x = b₁ := by + intro x hx hxf + have hxV := mem_V_of_mem_support Q₁ hx + rcases hclass x ((interSet_isSub (Γ := Γ)).1 hxV) + (interSet_U_subset isClosed_frontier ((Γ.interSet (frontier X₁)).V_subset_U hxV)) hxf with + h | h + · exact Or.inl (hA₁ x hx h) + · exact Or.inr (hB₁ x hx h) + have hfr₂ : ∀ x ∈ Q₂.support, x ∈ frontier X₁ → x = a₂ ∨ x = b₂ := by + intro x hx hxf + have hxV := mem_V_of_mem_support Q₂ hx + rcases hclass x ((interSet_isSub (Γ := Γ)).1 hxV) hxf + (interSet_U_subset isClosed_frontier ((Γ.interSet (frontier X₂)).V_subset_U hxV)) with h | h + · exact Or.inl (hA₂ x hx h) + · exact Or.inr (hB₂ x hx h) + obtain ⟨R₂, hR₂⟩ := exists_shorter hS hs h₂.near (hVZ ha₁'.1 ha₁'.2.2.1) + (hVZ hb₁'.1 hb₁'.2.2.1) hne₁ (hf₂ ha₁'.2.2.1) Q₁ hs₁ hfr₁ hno₁ + obtain ⟨R₁, hR₁⟩ := exists_shorter hS hs h₁ (hVZ ha₂'.1 ha₂'.2.1) + (hVZ hb₂'.1 hb₂'.2.1) hne₂ (hf₁ ha₂'.2.1) Q₂ hs₂ hfr₂ hno₂ + have := hm₂ a₁ ha₁' b₁ hb₁' R₂ + have := hm₁ a₂ ha₂' b₂ hb₂' R₁ + omega + have hnoZ : ∀ q ≤ n, ¬ (i ≤ q ∧ q ≤ j) → v q ∉ frontier X₂ := fun q hq hout hqf => + hZ₂ ⟨v q, hvΓ q hq, hvf q hq, hqf, q, hq, hout, rfl⟩ + have hstep : ∀ {e w}, e ∈ Γ.E → ¬ e ⊆ X₂ → w ∈ closure e → w ∉ frontier X₂ → w ∉ X₂ := + fun he hoff hw hwf hwX => hwf (frontier_of_edge_off n₂ he hoff hw hwX) + have hdown : ∀ d q, q + d + 1 = i → v q ∉ X₂ := by + intro d + induction d with + | zero => + intro q hq + obtain rfl : q = i - 1 := by omega + exact hstep he₁ hoff₁ ha₁ (hnoZ _ (by omega) (by omega)) + | succ d ih => + intro q hq + have hy := ih (q + 1) (by omega) + obtain ⟨e, he, -, hqe, hqe'⟩ := hedge q (by omega) + exact hstep he (fun h => hy (closure_minimal h c₂ hqe')) hqe (hnoZ _ (by omega) (by omega)) + have hup : ∀ d, j + 1 + d ≤ n → v (j + 1 + d) ∉ X₂ := by + intro d + induction d with + | zero => + intro hq + exact hstep he₂ hoff₂ hb₂ (hnoZ _ (by omega) (by omega)) + | succ d ih => + intro hq + have hy := ih (by omega) + obtain ⟨e, he, -, hqe, hqe'⟩ := hedge (j + 1 + d) (by omega) + exact hstep he (fun h => hy (closure_minimal h c₂ hqe)) hqe' (hnoZ _ (by omega) (by omega)) + intro p hp hpJ + by_cases hin' : i ≤ p ∧ p ≤ j + · exact hin p hin'.1 hin'.2 hpJ + by_cases hpi : p < i + · exact (hdown (i - p - 1) p (by omega) hpJ.2).elim + · have heq : j + 1 + (p - j - 1) = p := by omega + have := hup (p - j - 1) (by omega) + rw [heq] at this + exact (this hpJ.2).elim + +/-- The proof of (8.8), for `X₁` as in `isPathConnected_inter`. -/ +theorem simplyConnected_inter_union (hS : IsClosedSurface S) + (hs : IsSlope Γ k ins) {X₁ X₂ : Set S} (h₁ : IsNearExtreme Γ ins k 1 X₁) + (h₂ : IsExtremeRestraint Γ ins k X₂) (hne : (X₁ ∩ X₂).Nonempty) : + IsSimplyConnectedSet (X₁ ∩ X₂) ∧ IsSimplyConnectedSet (X₁ ∪ X₂) := by + have r₁ := h₁.1 + have r₂ := h₂.1 + have hp := isPathConnected_inter hS hs h₁ h₂ hne + have hu : IsSimplyConnectedSet (X₁ ∪ X₂) := theorem_7_8_proof r₁.isSimplyConnected + r₂.isSimplyConnected hp + (nice_31 S hS Γ X₁ X₂ r₁.isClosed r₂.isClosed r₁.isGammaNice r₂.isGammaNice + r₁.isSimplyConnected hp) + have hne' : X₁ ∪ X₂ ≠ univ := by + have := theorem_8_4_proof hS hs r₁ r₂ r₂ + rwa [union_assoc, union_self] at this + exact ⟨theorem_7_9_proof hS r₁.isSimplyConnected r₂.isSimplyConnected + (r₁.isClosed.inter r₂.isClosed) + (r₁.isGammaNice.inter r₂.isGammaNice) hp hne', hu⟩ + +/-- **(8.8)** of Graph Minors XI (page 98): "If $X_1, X_2$ are extreme restraints and $X_1 \cap X_2 +\ne \emptyset$ then $X_1 \cap X_2$ +and $X_1 \cup X_2$ are simply-connected." -/ +theorem theorem_8_8_proof (hS : IsClosedSurface S) + (hs : IsSlope Γ k ins) {X₁ X₂ : Set S} (h₁ : IsExtremeRestraint Γ ins k X₁) + (h₂ : IsExtremeRestraint Γ ins k X₂) (hne : (X₁ ∩ X₂).Nonempty) : + IsSimplyConnectedSet (X₁ ∩ X₂) ∧ IsSimplyConnectedSet (X₁ ∪ X₂) := + simplyConnected_inter_union hS hs (h₁.near_one) h₂ hne + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section89.lean b/LeanPool/GraphMinor/GM11/Section89.lean new file mode 100644 index 0000000000..eeb0edac6b --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section89.lean @@ -0,0 +1,368 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section88 + +/-! +# Graph Minors XI, (8.9) + +`theorem_8_9` is (8.9) of the paper. Its proof uses the step (2): "Any edge of $\Gamma$ contributes +at least as much +to the right side of this inequality as it does to the left." The paper does not spell this out, and +we prove +it in `perimeterCount_union_inter` by counting the sides of an edge that lie outside a set: +`perimeterCount_eq` +says that `perimeterCount T e` is this number, when `e ⊆ T`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] {Γ : Drawing S} + +omit [ConnectedSpace S] in +omit [T2Space S] in +/-- A connected set off `U(Γ)` lies in a closed nice set, as soon as it meets it. -/ +theorem side_subset {A T : Set S} (hTn : IsGammaNice Γ T) (hA : IsPreconnected A) + (hdis : Disjoint A Γ.U) + (hne : (A ∩ T).Nonempty) : A ⊆ T := by + obtain ⟨a, haA, haT⟩ := hne + have haU : a ∉ Γ.U := disjoint_left.mp hdis haA + obtain ⟨r, hr, har⟩ := exists_region_of_notMem haU + have hAr : A ⊆ r := by + obtain ⟨c, hc, rfl⟩ := hr + have hsub : connectedComponentIn (univ \ Γ.U) a = connectedComponentIn (univ \ Γ.U) c := + (connectedComponentIn_eq har).symm + rw [← hsub] + exact hA.subset_connectedComponentIn haA fun x hx => ⟨mem_univ x, disjoint_left.mp hdis hx⟩ + exact hAr.trans (nice_region hTn hr ⟨a, har, haT⟩) + +omit [ConnectedSpace S] in +/-- A point of an edge is in the interior of `Tᶜ ∪ e` as soon as one point of the edge is. -/ +theorem mem_interior_of_isTwoSided (hS : IsClosedSurface S) {T : Set S} (hTn : IsGammaNice Γ T) + {e : Set S} (he : e ∈ Γ.E) (h2 : IsTwoSided Tᶜ e) : e ⊆ interior (Tᶜ ∪ e) := by + let B := interior (Tᶜ ∪ e) + let O : Set S := ⋃₀ {W | IsOpen W ∧ Disjoint (W ∩ e) B} + have hO : IsOpen O := isOpen_sUnion fun W hW => hW.1 + have hsub : e ⊆ B ∪ O := by + intro y hy + by_cases hyI : y ∈ B + · exact Or.inl hyI + obtain ⟨W, A₁, A₂, hW, hyW, hWe, hcov, hA₁, hA₂, hd₁, hd₂, hc₁, hc₂⟩ := + exists_edge_sides hS Γ he hy + have hin : ¬ (Disjoint A₁ T ∧ Disjoint A₂ T) := by + rintro ⟨h₁, h₂⟩ + refine hyI (mem_interior.mpr ⟨W, fun x hx => ?_, hW, hyW⟩) + by_cases hxU : x ∈ Γ.U + · exact Or.inr (hWe ⟨hx, hxU⟩) + · rcases hcov ⟨hx, hxU⟩ with h | h + · exact Or.inl (disjoint_left.mp h₁ h) + · exact Or.inl (disjoint_left.mp h₂ h) + have hside : ∃ A, IsPreconnected A ∧ Disjoint A Γ.U ∧ e ∩ W ⊆ closure A ∧ (A ∩ T).Nonempty := by + by_cases h₁ : (A₁ ∩ T).Nonempty + · exact ⟨A₁, hA₁, hd₁, hc₁, h₁⟩ + · have h₂ : (A₂ ∩ T).Nonempty := by + by_contra h₂ + exact hin ⟨disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp h₁), + disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp h₂)⟩ + exact ⟨A₂, hA₂, hd₂, hc₂, h₂⟩ + obtain ⟨A, hA, hdA, hcA, hne⟩ := hside + have hAT := side_subset hTn hA hdA hne + refine Or.inr (mem_sUnion.mpr ⟨W, ⟨hW, disjoint_left.mpr ?_⟩, hyW⟩) + rintro x ⟨hxW, hxe⟩ hxI + obtain ⟨q, hqI, hqA⟩ := mem_closure_iff.mp (hcA ⟨hxe, hxW⟩) B isOpen_interior hxI + rcases interior_subset hqI with h | h + · exact h (hAT hqA) + · exact disjoint_left.mp hdA hqA ((he.2.1 h).1) + have hdis : e ∩ (B ∩ O) = ∅ := by + refine eq_empty_of_forall_notMem ?_ + rintro x ⟨hxe, hxI, hxO⟩ + obtain ⟨W, hW, hxW⟩ := mem_sUnion.mp hxO + exact disjoint_left.mp hW.2 ⟨hxW, hxe⟩ hxI + have hpre : IsPreconnected e := he.2.2.1.isConnected.isPreconnected + rcases isPreconnected_iff_subset_of_disjoint.mp hpre B O isOpen_interior hO hsub hdis with h | h + · exact h + · obtain ⟨z, hze, hzI⟩ := h2 + obtain ⟨W, hW, hzW⟩ := mem_sUnion.mp (h hze) + exact (disjoint_left.mp hW.2 ⟨hzW, hze⟩ hzI).elim + +open Classical in +omit [ConnectedSpace S] in +/-- `perimeterCount T e` counts the sides of `e` outside `T`, for an edge `e ⊆ T`. -/ +theorem perimeterCount_eq (hS : IsClosedSurface S) {T : Set S} (hTc : IsClosed T) + (hTn : IsGammaNice Γ T) + {e W A₁ A₂ : Set S} (he : e ∈ Γ.E) {p : S} (hp : p ∈ e) (hW : IsOpen W) (hpW : p ∈ W) + (hWe : W ∩ Γ.U ⊆ e) (hcov : W \ Γ.U ⊆ A₁ ∪ A₂) (hA₁ : IsPreconnected A₁) + (hA₂ : IsPreconnected A₂) + (hd₁ : Disjoint A₁ Γ.U) (hd₂ : Disjoint A₂ Γ.U) (hc₁ : e ∩ W ⊆ closure A₁) + (hc₂ : e ∩ W ⊆ closure A₂) : + perimeterCount T e = if e ⊆ T then (if A₁ ⊆ T then 0 else 1) + (if A₂ ⊆ T then 0 else 1) else 0 + := by + have hout : ∀ {A}, IsPreconnected A → Disjoint A Γ.U → ¬ A ⊆ T → Disjoint A T := by + intro A hA hd hn + refine disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp fun hne => hn ?_) + exact side_subset hTn hA hd hne + have hfr : ∀ {A}, Disjoint A T → p ∈ closure A → p ∈ T → p ∈ frontier T := by + intro A hd hpA hpT + refine ⟨subset_closure hpT, fun hi => ?_⟩ + obtain ⟨q, hqi, hqA⟩ := mem_closure_iff.mp hpA _ isOpen_interior hi + exact disjoint_left.mp hd hqA (interior_subset hqi) + have hp₁ : p ∈ closure A₁ := hc₁ ⟨hp, hpW⟩ + have hp₂ : p ∈ closure A₂ := hc₂ ⟨hp, hpW⟩ + unfold perimeterCount + by_cases heT : e ⊆ T + · have hpT := heT hp + simp only [heT, ite_true] + by_cases h₁ : A₁ ⊆ T <;> by_cases h₂ : A₂ ⊆ T + · have hWT : W ⊆ T := by + intro x hx + by_cases hxU : x ∈ Γ.U + · exact heT (hWe ⟨hx, hxU⟩) + · rcases hcov ⟨hx, hxU⟩ with h | h + · exact h₁ h + · exact h₂ h + have hne : ¬ (e ∩ frontier T).Nonempty := by + rintro ⟨y, hye, hy⟩ + exact (edge_subset_frontier hS hTc hTn he hye hy hp).2 (mem_interior.mpr ⟨W, hWT, hW, hpW⟩) + simp [h₁, h₂, hne] + · have hne : (e ∩ frontier T).Nonempty := ⟨p, hp, hfr (hout hA₂ hd₂ h₂) hp₂ hpT⟩ + have hno : ¬ IsTwoSided Tᶜ e := fun h2 => by + obtain ⟨q, hqi, hqA⟩ := mem_closure_iff.mp hp₁ _ isOpen_interior + (mem_interior_of_isTwoSided hS hTn he h2 hp) + rcases interior_subset hqi with h | h + · exact h (h₁ hqA) + · exact disjoint_left.mp hd₁ hqA ((he.2.1 h).1) + simp [h₁, h₂, hne, hno] + · have hne : (e ∩ frontier T).Nonempty := ⟨p, hp, hfr (hout hA₁ hd₁ h₁) hp₁ hpT⟩ + have hno : ¬ IsTwoSided Tᶜ e := fun h2 => by + obtain ⟨q, hqi, hqA⟩ := mem_closure_iff.mp hp₂ _ isOpen_interior + (mem_interior_of_isTwoSided hS hTn he h2 hp) + rcases interior_subset hqi with h | h + · exact h (h₂ hqA) + · exact disjoint_left.mp hd₂ hqA ((he.2.1 h).1) + simp [h₁, h₂, hne, hno] + · have hne : (e ∩ frontier T).Nonempty := ⟨p, hp, hfr (hout hA₁ hd₁ h₁) hp₁ hpT⟩ + have hyes : IsTwoSided Tᶜ e := by + refine ⟨p, hp, mem_interior.mpr ⟨W, fun x hx => ?_, hW, hpW⟩⟩ + by_cases hxU : x ∈ Γ.U + · exact Or.inr (hWe ⟨hx, hxU⟩) + · rcases hcov ⟨hx, hxU⟩ with h | h + · exact Or.inl (disjoint_left.mp (hout hA₁ hd₁ h₁) h) + · exact Or.inl (disjoint_left.mp (hout hA₂ hd₂ h₂) h) + simp [h₁, h₂, hne, hyes] + · have hne : ¬ (e ∩ frontier T).Nonempty := by + rintro ⟨y, hye, hy⟩ + exact heT (nice_atom hTn (Or.inl (Or.inr he)) ⟨y, hye, hTc.frontier_subset hy⟩) + simp [heT, hne] + +omit [ConnectedSpace S] in +/-- The inequality (2) in the proof of (8.9), for one edge. -/ +theorem perimeterCount_union_inter (hS : IsClosedSurface S) {X Y : Set S} (hXc : IsClosed X) + (hYc : IsClosed Y) + (hXn : IsGammaNice Γ X) (hYn : IsGammaNice Γ Y) {e : Set S} (he : e ∈ Γ.E) : + perimeterCount (X ∪ Y) e + perimeterCount (X ∩ Y) e ≤ perimeterCount X e + perimeterCount Y e + := by + classical + obtain ⟨p, hp⟩ := he.1 + obtain ⟨W, A₁, A₂, hW, hpW, hWe, hcov, hA₁, hA₂, hd₁, hd₂, hc₁, hc₂⟩ := + exists_edge_sides hS Γ he hp + have hne₁ : A₁.Nonempty := (closure_nonempty_iff.mp ⟨p, hc₁ ⟨hp, hpW⟩⟩) + have hne₂ : A₂.Nonempty := (closure_nonempty_iff.mp ⟨p, hc₂ ⟨hp, hpW⟩⟩) + have hcnt : ∀ {T : Set S}, IsClosed T → IsGammaNice Γ T → perimeterCount T e = + if e ⊆ T then (if A₁ ⊆ T then 0 else 1) + (if A₂ ⊆ T then 0 else 1) else 0 := + fun hc hn => perimeterCount_eq hS hc hn he hp hW hpW hWe hcov hA₁ hA₂ hd₁ hd₂ hc₁ hc₂ + have hunion : ∀ {A : Set S}, (IsPreconnected A ∧ Disjoint A Γ.U ∧ A.Nonempty) ∨ A = e → + (A ⊆ X ∪ Y ↔ A ⊆ X ∨ A ⊆ Y) := by + intro A hA + refine ⟨fun h => ?_, fun h => h.elim (fun h' => h'.trans subset_union_left) + fun h' => h'.trans subset_union_right⟩ + have hmeet : ∀ {T}, IsGammaNice Γ T → (A ∩ T).Nonempty → A ⊆ T := by + intro T hT hne + rcases hA with ⟨hp', hd, -⟩ | rfl + · exact side_subset hT hp' hd hne + · exact nice_atom hT (Or.inl (Or.inr he)) hne + have hAne : A.Nonempty := by + rcases hA with ⟨-, -, h⟩ | rfl + · exact h + · exact he.1 + obtain ⟨a, ha⟩ := hAne + rcases h ha with h' | h' + · exact Or.inl (hmeet hXn ⟨a, ha, h'⟩) + · exact Or.inr (hmeet hYn ⟨a, ha, h'⟩) + have u₀ := hunion (A := e) (Or.inr rfl) + have u₁ := hunion (A := A₁) (Or.inl ⟨hA₁, hd₁, hne₁⟩) + have u₂ := hunion (A := A₂) (Or.inl ⟨hA₂, hd₂, hne₂⟩) + rw [hcnt (hXc.union hYc) (hXn.union hYn), hcnt (hXc.inter hYc) (hXn.inter hYn), hcnt hXc hXn, + hcnt hYc hYn] + simp only [u₀, u₁, u₂, subset_inter_iff] + by_cases a : e ⊆ X <;> by_cases b : e ⊆ Y <;> by_cases c₁ : A₁ ⊆ X <;> by_cases c₂ : A₁ ⊆ Y <;> + by_cases d₁ : A₂ ⊆ X <;> by_cases d₂ : A₂ ⊆ Y <;> simp [a, b, c₁, c₂, d₁, d₂] + +variable {k : ℕ} {ins : Drawing S → Set S} + +/-- There are only finitely many `Γ`-nice sets. -/ +theorem finite_nice (hS : IsClosedSurface S) (Γ : Drawing S) : {X | IsGammaNice Γ X}.Finite := by + have hfin : Γ.A.Finite := + ((Γ.finite_V.image _).union Γ.finite_edges).union (finite_R hS Γ) + refine (hfin.finite_subsets.image sUnion).subset ?_ + rintro X ⟨𝒜, h𝒜, rfl⟩ + exact ⟨𝒜, h𝒜, rfl⟩ + +/-- Each restraint `X` lies in an extreme restraint `Y` with `l(Y) ≤ l(X)`. -/ +theorem exists_extreme (hS : IsClosedSurface S) {X : Set S} (hX : IsRestraint Γ ins k X) : + ∃ Y, IsExtremeRestraint Γ ins k Y ∧ X ⊆ Y ∧ perimeterWalkLength Γ Y ≤ perimeterWalkLength Γ X + := by + have hfin : {Y | IsRestraint Γ ins k Y ∧ X ⊆ Y ∧ perimeterWalkLength Γ Y + ≤ perimeterWalkLength Γ X}.Finite := + (finite_nice hS Γ).subset fun Y hY => hY.1.isGammaNice + obtain ⟨Y, hY⟩ := hfin.exists_maximal ⟨X, hX, subset_rfl, le_rfl⟩ + refine ⟨Y, ⟨hY.1.1, fun Z hZ hYZ hl => ?_⟩, hY.1.2.1, hY.1.2.2⟩ + have hm : Z ∈ {Y | IsRestraint Γ ins k Y ∧ X ⊆ Y ∧ perimeterWalkLength Γ Y + ≤ perimeterWalkLength Γ X} := + ⟨hZ, hY.1.2.1.trans hYZ, hl.trans hY.1.2.2⟩ + exact subset_antisymm (hY.2 hm hYZ) hYZ + +/-- The inequality (2) in the proof of (8.9): `l(X ∪ Y) + l(X ∩ Y) ≤ l(X) + l(Y)`. -/ +theorem perimeterWalkLength_union_inter (hS : IsClosedSurface S) + {X Y : Set S} (r₁ : IsRestraint Γ ins k X) + (r₂ : IsRestraint Γ ins k Y) (hinter : IsSimplyConnectedSet (X ∩ Y)) + (hunion : IsSimplyConnectedSet (X ∪ Y)) (hne : (X ∩ Y).Nonempty) (hu : X ∪ Y ≠ univ) : + perimeterWalkLength Γ (X ∪ Y) + perimeterWalkLength Γ (X ∩ Y) ≤ + perimeterWalkLength Γ X + perimeterWalkLength Γ Y := by + have hc := r₁.isClosed.inter r₂.isClosed + have hn := r₁.isGammaNice.inter r₂.isGammaNice + have hIU : X ∩ Y ≠ univ := fun h => r₁.ne_univ (eq_univ_of_univ_subset (h ▸ inter_subset_left)) + have hneUnion : (X ∪ Y).Nonempty := hne.mono (inter_subset_left.trans subset_union_left) + rw [perimeterWalkLength_eq hS (r₁.isClosed.union r₂.isClosed) + (r₁.isGammaNice.union r₂.isGammaNice) hunion hneUnion hu, + perimeterWalkLength_eq hS hc hn hinter hne hIU, + perimeterWalkLength_eq hS r₁.isClosed r₁.isGammaNice r₁.isSimplyConnected r₁.nonempty + r₁.ne_univ, + perimeterWalkLength_eq hS r₂.isClosed r₂.isGammaNice r₂.isSimplyConnected r₂.nonempty + r₂.ne_univ] + unfold perimeterSum + rw [← Finset.sum_add_distrib, ← Finset.sum_add_distrib] + exact Finset.sum_le_sum fun e he => perimeterCount_union_inter hS r₁.isClosed r₂.isClosed + r₁.isGammaNice + r₂.isGammaNice (Γ.finite_edges.mem_toFinset.mp he) + +/-- The intersection of two restraints is a restraint, if it is simply-connected and short. This is +the subproof +of (1) in the proof of (8.9). -/ +theorem isRestraint_inter (hS : IsClosedSurface S) (hs : IsSlope Γ k ins) + {X Y : Set S} (r₁ : IsRestraint Γ ins k X) (r₂ : IsRestraint Γ ins k Y) + (hinter : IsSimplyConnectedSet (X ∩ Y)) (hne : (X ∩ Y).Nonempty) + (hlt : perimeterWalkLength Γ (X ∩ Y) < k) : IsRestraint Γ ins k (X ∩ Y) := by + have hXU : X ≠ univ := r₁.ne_univ + have hIU : X ∩ Y ≠ univ := fun h => hXU (eq_univ_of_univ_subset (h ▸ inter_subset_left)) + have hc := r₁.isClosed.inter r₂.isClosed + have hn := r₁.isGammaNice.inter r₂.isGammaNice + refine ⟨hne, hc, hinter, hn, hlt, ?_⟩ + intro hcov + obtain ⟨u₁, W₁, hW₁, hl₁, -, hcnt₁⟩ := exists_minimal_perimeterWalk hS hc hn hinter hne hIU + obtain ⟨u, W, -, -, hl₀, -, hd⟩ := r₁.exists_walk hS + have hd₁ := walkDrawing_eq hS hc hn hW₁ hcnt₁ + obtain ⟨r, hr, h₁, h₂, -⟩ := theorem_8_2_proof hS hs W₁ W W (hl₁ ▸ hlt) hl₀ hl₀ + rw [insWalk_eq hS hs r₁ hd] at h₂ + refine h₁ fun x hxr => ?_ + have hxX : x ∉ X := fun hx => h₂ (nice_region r₁.isGammaNice hr ⟨x, hxr, hx⟩) + have := hcov ⟨mem_univ x, fun hx => hxX hx.1⟩ + rwa [subBd_eq_frontier, ← hd₁] at this + +/-- **(8.9)** of Graph Minors XI (page 100): "Let $a, b \in \Sigma$, let $X'$ be an $a, b$-optimal +restraint, and let $X$ be an extreme +restraint with $a, b \in X$. Then $X' \subseteq X$." -/ +theorem theorem_8_9_proof (hS : IsClosedSurface S) + (hs : IsSlope Γ k ins) {a b : S} {X X' : Set S} (hX' : IsOptimalRestraint Γ ins k a b X') + (hX : IsExtremeRestraint Γ ins k X) (ha : a ∈ X) (hb : b ∈ X) : X' ⊆ X := by + classical + obtain ⟨Y, hY, hsub, hl⟩ := exists_extreme hS hX'.1 + refine hsub.trans ?_ + have hopt : ∀ Z, IsRestraint Γ ins k Z → a ∈ Z → b ∈ Z → perimeterWalkLength Γ Y + ≤ perimeterWalkLength Γ Z := + fun Z hZ h₁ h₂ => hl.trans (hX'.2.2.2 Z hZ h₁ h₂) + have ra := hsub hX'.2.1 + have rb := hsub hX'.2.2.1 + obtain ⟨hinter, hunion⟩ := theorem_8_8_proof hS hs hX hY ⟨a, ha, ra⟩ + have hu : X ∪ Y ≠ univ := by + have := theorem_8_4_proof hS hs hX.1 hY.1 hY.1 + rwa [union_assoc, union_self] at this + have r₁ := hX.1 + have r₂ := hY.1 + have hXU : X ≠ univ := r₁.ne_univ + have hIU : X ∩ Y ≠ univ := fun h => hXU (eq_univ_of_univ_subset (h ▸ inter_subset_left)) + have hc := r₁.isClosed.inter r₂.isClosed + have hn := r₁.isGammaNice.inter r₂.isGammaNice + -- The step (1). + have h1 : perimeterWalkLength Γ Y ≤ perimeterWalkLength Γ (X ∩ Y) := by + by_cases hlt : perimeterWalkLength Γ (X ∩ Y) < k + · exact hopt _ (isRestraint_inter hS hs r₁ r₂ hinter ⟨a, ha, ra⟩ hlt) ⟨ha, ra⟩ ⟨hb, rb⟩ + · have := r₂.length_lt + omega + -- The step (2). + have h2 := perimeterWalkLength_union_inter hS r₁ r₂ hinter hunion ⟨a, ha, ra⟩ hu + have h3 : perimeterWalkLength Γ (X ∪ Y) ≤ perimeterWalkLength Γ X := by omega + have hrest := theorem_8_6_proof hS hs r₁ r₂ hunion (lt_of_le_of_lt h3 r₁.length_lt) + have := hX.2 _ hrest subset_union_left h3 + exact union_eq_left.mp this + +/-- **(8.13)** of Graph Minors XI (page 103): "Let $a, b \in \Sigma$ with $\{a, b\} \cap U(\Gamma) +\subseteq V(\Gamma)$; and let $X$ be a +restraint with $a, b \in X$. Suppose that there is no restraint $Y$ with $X \subseteq Y$ and +$l(Y) < l(X)$. Then $X$ includes an $a, b$-optimal restraint." + +The paper subdivides the edges, so that `X` becomes extreme in the new drawing, and applies (8.9) +there. There is a +shorter proof, in which `{a, b} ∩ U(Γ) ⊆ V(Γ)` is not used. Let `E` be an extreme `a, b`-optimal +restraint. The proof +of (8.8) needs that one of the two restraints is extreme, and of the other only what we know of `X` +(`simplyConnected_inter_union`). Then `l(X ∪ E) + l(X ∩ E) ≤ l(X) + l(E)` and `l(X) ≤ l(X ∪ E)`, and +so `X ∩ E` is +`a, b`-optimal. -/ +theorem theorem_8_13_proof (hS : IsClosedSurface S) (hs : IsSlope Γ k ins) {a b : S} + {X : Set S} (hX : IsRestraint Γ ins k X) (ha : a ∈ X) (hb : b ∈ X) + (hmax : ∀ Y : Set S, IsRestraint Γ ins k Y → X ⊆ Y → + ¬ perimeterWalkLength Γ Y < perimeterWalkLength Γ X) : + ∃ Y : Set S, Y ⊆ X ∧ IsOptimalRestraint Γ ins k a b Y := by + classical + -- An `a, b`-optimal restraint, of smallest length. + have hex : ∃ n, ∃ Y, IsRestraint Γ ins k Y ∧ a ∈ Y ∧ b ∈ Y ∧ perimeterWalkLength Γ Y = n := + ⟨_, X, hX, ha, hb, rfl⟩ + obtain ⟨Y₀, hY₀, ha₀, hb₀, hl₀⟩ := Nat.find_spec hex + have hmin : ∀ Z, IsRestraint Γ ins k Z → a ∈ Z → b ∈ Z → perimeterWalkLength Γ Y₀ + ≤ perimeterWalkLength Γ Z := + fun Z h₁ h₂ h₃ => hl₀ ▸ Nat.find_min' hex ⟨Z, h₁, h₂, h₃, rfl⟩ + obtain ⟨E, hE, hsub, hl⟩ := exists_extreme hS hY₀ + have ra := hsub ha₀ + have rb := hsub hb₀ + have hnear : IsNearExtreme Γ ins k 1 X := ⟨hX, fun Y hY hXY hle => (hmax Y hY hXY + (by omega)).elim⟩ + have hne : (X ∩ E).Nonempty := ⟨a, ha, ra⟩ + obtain ⟨hinter, hunion⟩ := simplyConnected_inter_union hS hs hnear hE hne + have hu : X ∪ E ≠ univ := by + have := theorem_8_4_proof hS hs hX hE.1 hE.1 + rwa [union_assoc, union_self] at this + have h2 := perimeterWalkLength_union_inter hS hX hE.1 hinter hunion hne hu + have h3 : perimeterWalkLength Γ X ≤ perimeterWalkLength Γ (X ∪ E) := by + by_cases hlt : perimeterWalkLength Γ (X ∪ E) < k + · exact not_lt.mp (hmax _ (theorem_8_6_proof hS hs hX hE.1 hunion hlt) subset_union_left) + · have := hX.length_lt + omega + have h4 : perimeterWalkLength Γ (X ∩ E) ≤ perimeterWalkLength Γ E := by omega + have hr := isRestraint_inter hS hs hX hE.1 hinter hne (lt_of_le_of_lt h4 hE.1.length_lt) + exact ⟨X ∩ E, inter_subset_left, hr, ⟨ha, ra⟩, ⟨hb, rb⟩, fun Z h₁ h₂ h₃ => + h4.trans (hl.trans (hmin Z h₁ h₂ h₃))⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section91.lean b/LeanPool/GraphMinor/GM11/Section91.lean new file mode 100644 index 0000000000..9065b72392 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section91.lean @@ -0,0 +1,304 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section810 +public import LeanPool.GraphMinor.GM14.Defs + +/-! +# Graph Minors XI, (9.1) + +The paper states the triangle inequality (9.1) for atoms of a drawing `Γ` with a slope. +`theorem_9_1_proof` extends it to `twiceDistance` on sets with a nonempty middle set. +`tangleMetric_triangle` extends the inequality to arbitrary sets using the radial drawing of a +respectful tangle. On atoms, it uses their corresponding atoms in that drawing. +`tangleMetric_le_one` bounds the distance from a vertex to an incident region by one. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval +open GraphMinor.GM14 (IsCorrespondingAtom tangleMetric HasTangleMetric) + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] {Γ : Drawing S} + {K : ℕ} {ins : Drawing S → Set S} + +/-- Two intersecting restraints whose combined perimeter is below `K` fit inside a restraint +whose perimeter is at most their sum. This is the short-distance step of XI (9.1), page 104, +after enlarging to extreme restraints. The paper's slope order `θ` corresponds to `K = 2 * θ`. -/ +theorem exists_restraint_union (hS : IsClosedSurface S) + (hs : IsSlope Γ K ins) {X Y : Set S} (hX : IsRestraint Γ ins K X) (hY : IsRestraint Γ ins K Y) + (hne : (X ∩ Y).Nonempty) (hl : perimeterWalkLength Γ X + perimeterWalkLength Γ Y < K) : + ∃ T, IsRestraint Γ ins K T ∧ X ⊆ T ∧ Y ⊆ T ∧ + perimeterWalkLength Γ T ≤ perimeterWalkLength Γ X + perimeterWalkLength Γ Y := by + obtain ⟨X', eX, sX, lX⟩ := exists_extreme hS hX + obtain ⟨Y', eY, sY, lY⟩ := exists_extreme hS hY + have hne' : (X' ∩ Y').Nonempty := hne.mono (inter_subset_inter sX sY) + obtain ⟨hinter, hunion⟩ := theorem_8_8_proof hS hs eX eY hne' + have hu : X' ∪ Y' ≠ univ := by + have := theorem_8_4_proof hS hs eX.1 eY.1 eY.1 + rwa [union_assoc, union_self] at this + have h2 := perimeterWalkLength_union_inter hS eX.1 eY.1 hinter hunion hne' hu + have hle : perimeterWalkLength Γ (X' ∪ Y') ≤ perimeterWalkLength Γ X + perimeterWalkLength Γ Y + := by omega + exact ⟨X' ∪ Y', theorem_8_6_proof hS hs eX.1 eY.1 hunion (lt_of_le_of_lt hle hl), + sX.trans subset_union_left, sY.trans subset_union_right, hle⟩ + +/-- The triangle inequality for `twiceDistance` extends XI (9.1), page 104, from atoms to sets +with a nonempty middle set. In the paper's atom case `twiceDistance` is twice its distance `d`. -/ +theorem theorem_9_1_proof (hS : IsClosedSurface S) + (hs : IsSlope Γ K ins) {a b c : Set S} (hb : b.Nonempty) : + twiceDistance Γ ins K a c ≤ twiceDistance Γ ins K a b + twiceDistance Γ ins K b c := by + classical + have hle : ∀ x y, twiceDistance Γ ins K x y ≤ K := by + intro x y + unfold twiceDistance + split_ifs with h₁ h₂ + · exact Nat.zero_le _ + · obtain ⟨X, hX, hx, hy⟩ := h₂ + have : sInf {t | ∃ X, IsRestraint Γ ins K X ∧ x ⊆ X ∧ y ⊆ X ∧ perimeterWalkLength Γ X = t} ≤ + perimeterWalkLength Γ X := Nat.sInf_le ⟨X, hX, hx, hy, rfl⟩ + exact this.trans hX.length_lt.le + · exact le_rfl + by_cases hac : a = c + · subst hac + simp [twiceDistance] + by_cases hab : a = b + · subst hab + simp [twiceDistance] + by_cases hbc : b = c + · subst hbc + simp [twiceDistance] + by_cases h₁ : ∃ X, IsRestraint Γ ins K X ∧ a ⊆ X ∧ b ⊆ X + swap + · have : twiceDistance Γ ins K a b = K := by + simp [twiceDistance, hab, h₁] + rw [this] + exact (hle a c).trans (Nat.le_add_right _ _) + by_cases h₂ : ∃ X, IsRestraint Γ ins K X ∧ b ⊆ X ∧ c ⊆ X + swap + · have : twiceDistance Γ ins K b c = K := by + simp [twiceDistance, hbc, h₂] + rw [this] + exact (hle a c).trans (Nat.le_add_left _ _) + have hmem₁ := Nat.sInf_mem (s := {t | ∃ X, IsRestraint Γ ins K X ∧ a ⊆ X ∧ b ⊆ X + ∧ perimeterWalkLength Γ X = t}) + (by obtain ⟨X, h, h', h''⟩ := h₁; exact ⟨_, X, h, h', h'', rfl⟩) + have hmem₂ := Nat.sInf_mem (s := {t | ∃ X, IsRestraint Γ ins K X ∧ b ⊆ X ∧ c ⊆ X + ∧ perimeterWalkLength Γ X = t}) + (by obtain ⟨X, h, h', h''⟩ := h₂; exact ⟨_, X, h, h', h'', rfl⟩) + have e₁ : twiceDistance Γ ins K a b = + sInf {t | ∃ X, IsRestraint Γ ins K X ∧ a ⊆ X ∧ b ⊆ X ∧ perimeterWalkLength Γ X = t} := by + simp [twiceDistance, hab, h₁] + have e₂ : twiceDistance Γ ins K b c = + sInf {t | ∃ X, IsRestraint Γ ins K X ∧ b ⊆ X ∧ c ⊆ X ∧ perimeterWalkLength Γ X = t} := by + simp [twiceDistance, hbc, h₂] + rw [e₁, e₂] + obtain ⟨X, hX, hxa, hxb, hlX⟩ := hmem₁ + obtain ⟨Y, hY, hyb, hyc, hlY⟩ := hmem₂ + rw [← hlX, ← hlY] + by_cases hlt : perimeterWalkLength Γ X + perimeterWalkLength Γ Y < K + swap + · exact (hle a c).trans (by omega) + obtain ⟨z, hz⟩ := hb + obtain ⟨T, hT, hXT, hYT, hl⟩ := exists_restraint_union hS hs hX hY ⟨z, hxb hz, hyb hz⟩ hlt + refine le_trans ?_ hl + have hex : ∃ T', IsRestraint Γ ins K T' ∧ a ⊆ T' ∧ c ⊆ T' := + ⟨T, hT, hxa.trans hXT, hyc.trans hYT⟩ + have e₃ : twiceDistance Γ ins K a c = + sInf {t | ∃ X, IsRestraint Γ ins K X ∧ a ⊆ X ∧ c ⊆ X ∧ perimeterWalkLength Γ X = t} := by + simp [twiceDistance, hac, hex] + rw [e₃] + exact Nat.sInf_le ⟨T, hT, hxa.trans hXT, hyc.trans hYT, rfl⟩ + +/-! ## The metric of a respectful tangle -/ + +section Tangle + +variable {H D : Drawing S} {θ k : ℕ} {x y : Set S} + +omit [T2Space S] [ConnectedSpace S] in +/-- A walk in a radial drawing has even length if its ends are on the same side of the bipartition. +-/ +theorem even_length_of_preRadial (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing D) {u v : + S} + (W : GraphWalk D.toGraph u v) : (u ∈ H.V ↔ v ∈ H.V) ↔ Even W.length := by + have hb := bipartite_of_preRadial hrad + induction W with + | nil _ => simp [GraphWalk.length, GraphWalk.edges] + | @cons x y z e hl r ih => + have hlen : (GraphWalk.cons hl r).length = r.length + 1 := rfl + have hx : x ∈ H.V ↔ y ∉ H.V := hb _ _ _ hl + have key : (x ∈ H.V ↔ z ∈ H.V) ↔ ¬ (y ∈ H.V ↔ z ∈ H.V) := by tauto + rw [hlen, Nat.even_add_one] + exact key.trans (not_congr ih) + +omit [T2Space S] [ConnectedSpace S] in +theorem even_length_of_closed (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing D) {u : S} + (W : GraphWalk D.toGraph u u) : Even W.length := (even_length_of_preRadial hrad W).mp Iff.rfl + +/-- The pairs of the definition of `tangleMetric`. -/ +def MetricWitness (H D : Drawing S) (ins : Drawing S → Set S) (θ : ℕ) (x y : Set S) (k : ℕ) : Prop + := + ∃ (u : S) (W : GraphWalk D.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H D x x' ∧ IsCorrespondingAtom H D y y' ∧ + W.length < 2 * θ ∧ W.length = 2 * k ∧ x' ⊆ insWalk ins D W ∧ y' ⊆ insWalk ins D W + +omit [T2Space S] [ConnectedSpace S] in +/-- A short closed walk whose interior contains both radial atoms bounds their distance. -/ +theorem tangleMetric_le_of_walk [T1Space S] {u : S} (W : GraphWalk D.toGraph u u) + {x' y' : Set S} (hx : IsCorrespondingAtom H D x x') (hy : IsCorrespondingAtom H D y y') + (hl : W.length < 2 * θ) (hk : W.length = 2 * k) + (hxW : x' ⊆ insWalk ins D W) (hyW : y' ⊆ insWalk ins D W) : + tangleMetric H D ins θ x y ≤ k := by + classical + unfold tangleMetric + split_ifs with hxy hw + · exact Nat.zero_le _ + · exact Nat.sInf_le ⟨u, W, x', y', hx, hy, hl, hk, hxW, hyW⟩ + · exact (hw ⟨u, W, x', y', hx, hy, hl, hxW, hyW⟩).elim + +omit [ConnectedSpace S] in +theorem tangleMetric_le (hk : MetricWitness H D ins θ x y k) : tangleMetric H D ins θ x y ≤ k := by + obtain ⟨u, W, x', y', hx, hy, hl, heven, hxW, hyW⟩ := hk + exact tangleMetric_le_of_walk W hx hy hl heven hxW hyW + +omit [ConnectedSpace S] in +/-- The metric is `θ`, or it comes from a closed walk. -/ +theorem tangleMetric_cases (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing D) {x y : Set S} + (hne : x ≠ y) : tangleMetric H D ins θ x y = θ ∨ + (tangleMetric H D ins θ x y < θ ∧ + MetricWitness H D ins θ x y (tangleMetric H D ins θ x y)) := by + classical + unfold tangleMetric + simp only [hne, ite_false] + split_ifs with h₁ + · right + have hset : {k : ℕ | MetricWitness H D ins θ x y k}.Nonempty := by + obtain ⟨u, W, x', y', hx, hy, hl, h₃, h₄⟩ := h₁ + obtain ⟨k, hk⟩ := even_length_of_closed hrad W + exact ⟨k, u, W, x', y', hx, hy, hl, by omega, h₃, h₄⟩ + have hm := Nat.sInf_mem hset + refine ⟨?_, hm⟩ + obtain ⟨u, W, x', y', hx, hy, hl, hk, -, -⟩ := hm + have heq : sInf {k : ℕ | MetricWitness H D ins θ x y k} = _ := rfl + change sInf {k : ℕ | MetricWitness H D ins θ x y k} < θ + omega + · exact Or.inl rfl + +omit [ConnectedSpace S] in +theorem tangleMetric_le_order (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing D) + (x y : Set S) : + tangleMetric H D ins θ x y ≤ θ := by + by_cases hne : x = y + · simp [tangleMetric, hne] + · rcases tangleMetric_cases (ins := ins) (θ := θ) hrad hne with h | h + · exact h.le + · exact h.1.le + +omit [T2Space S] [ConnectedSpace S] in +/-- Two atoms that correspond to one atom meet. -/ +theorem corresponding_meet (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing D) {x x₁ x₂ : + Set S} + (h₁ : IsCorrespondingAtom H D x x₁) (h₂ : IsCorrespondingAtom H D x x₂) : (x₁ ∩ x₂).Nonempty + := by + have hne : ∀ r ∈ H.R, ∀ w ∈ r, w ∉ H.U := fun r hr w hw => region_subset hr hw + obtain ⟨-, -, h₁⟩ := h₁ + obtain ⟨-, -, h₂⟩ := h₂ + rcases h₁ with ⟨v, hv, rfl, rfl⟩ | ⟨he, -, hsub⟩ | ⟨hr, w, hw, rfl⟩ <;> + rcases h₂ with ⟨v', hv', h₃, rfl⟩ | ⟨he', -, hsub'⟩ | ⟨hr', w', hw', rfl⟩ + · exact ⟨v, rfl, by simpa using singleton_eq_singleton_iff.mp h₃⟩ + · exact ((he'.2.1 (rfl : v ∈ ({v} : Set S))).2 hv).elim + · exact (hne _ hr' v rfl (H.V_subset_U hv)).elim + · exact ((he.2.1 (h₃ ▸ rfl : v' ∈ x)).2 hv').elim + · obtain ⟨z, hz⟩ := he.1 + exact ⟨z, hsub hz, hsub' hz⟩ + · obtain ⟨z, hz⟩ := he.1 + exact (hne _ hr' z hz (he.2.1 hz).1).elim + · exact (hne _ hr v' (h₃ ▸ rfl) (H.V_subset_U hv')).elim + · obtain ⟨z, hz⟩ := he'.1 + exact (hne _ hr z hz (he'.2.1 hz).1).elim + · obtain ⟨c, -, hu⟩ := hrad.2.2.1 x hr + have h₃ : w = c := hu w ⟨hw.2, hw.1⟩ + have h₄ : w' = c := hu w' ⟨hw'.2, hw'.1⟩ + exact ⟨w, rfl, by rw [h₃, ← h₄]; rfl⟩ + +/-- The triangle inequality from XI (9.1), page 104, extended to arbitrary sets for the radial +metric of a respectful tangle. The paper states the inequality for atoms. -/ +theorem tangleMetric_triangle (hS : IsClosedSurface S) + (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing D) (hs : IsSlope D (2 * θ) ins) + (a b c : Set S) : + tangleMetric H D ins θ a c ≤ tangleMetric H D ins θ a b + tangleMetric H D ins θ b c := by + by_cases hac : a = c + · simp [tangleMetric, hac] + by_cases hab : a = b + · subst hab + simp [tangleMetric] + by_cases hbc : b = c + · subst hbc + simp [tangleMetric] + have hle := tangleMetric_le_order (ins := ins) (θ := θ) hrad a c + rcases tangleMetric_cases (ins := ins) (θ := θ) hrad hab with h₁ | ⟨-, W₁⟩ + · omega + rcases tangleMetric_cases (ins := ins) (θ := θ) hrad hbc with h₂ | ⟨-, W₂⟩ + · omega + set k₁ := tangleMetric H D ins θ a b + set k₂ := tangleMetric H D ins θ b c + by_cases hlt : θ ≤ k₁ + k₂ + · omega + obtain ⟨u₁, W₁, a', b₁, ha₁, hb₁, hl₁, hk₁, hsa, hsb₁⟩ := W₁ + obtain ⟨u₂, W₂, b₂, c', hb₂, hc₂, hl₂, hk₂, hsb₂, hsc⟩ := W₂ + obtain ⟨hX, lX⟩ := theorem_8_5_proof hS hs W₁ hl₁ + obtain ⟨hY, lY⟩ := theorem_8_5_proof hS hs W₂ hl₂ + obtain ⟨z, hz₁, hz₂⟩ := corresponding_meet hrad hb₁ hb₂ + obtain ⟨T, hT, hXT, hYT, hl⟩ := exists_restraint_union hS hs hX hY + ⟨z, hsb₁ hz₁, hsb₂ hz₂⟩ (by omega) + obtain ⟨u, W, -, hlen, hlK, -, hd⟩ := hT.exists_walk hS + have hins := insWalk_eq hS hs hT hd + obtain ⟨k, hk⟩ := even_length_of_closed hrad W + have hwit : MetricWitness H D ins θ a c k := + ⟨u, W, a', c', ha₁, hc₂, hlK, by omega, by rw [hins]; exact hsa.trans hXT, by + rw [hins]; exact hsc.trans hYT⟩ + have := tangleMetric_le hwit + omega + +/-- A vertex and a region at it have distance at most one, if there is an edge. -/ +theorem tangleMetric_le_one (hS : IsClosedSurface S) (hrad : (PaintingOrDrawing.drawing + H).IsRadialDrawing D) + (hE : H.E.Nonempty) {v : S} {r : Set S} (hv : v ∈ H.V) (hr : r ∈ H.R) + (hvr : v ∈ closure r) : tangleMetric H D ins θ {v} r ≤ 1 := by + have hP := hrad.2.1 + by_cases hθ2 : θ ≤ 1 + · exact (tangleMetric_le_order hP _ _).trans hθ2 + obtain ⟨c, ⟨hcr, hcV⟩, -⟩ := hP.2.2.1 r hr + obtain ⟨e, he, hcap⟩ := exists_spoke_at ⟨hrad.1, hP⟩ hrad.2.2 hS hE hr hcr hcV hv hvr + have hvD : v ∈ D.V := hP.2.1 hv + have hl : D.toGraph.IsLink e v c := ⟨he, hvD, hcV, hcap⟩ + have hl' : D.toGraph.IsLink e c v := ⟨he, hcV, hvD, by rw [Set.pair_comm]; exact hcap⟩ + let W : GraphWalk D.toGraph v v := GraphWalk.cons hl (GraphWalk.cons hl' (GraphWalk.nil hvD)) + have hU : ∀ y ∈ W.support, y ∈ insWalk ins D W := fun y hy => + Or.inl ((mem_walkDrawing_U D W).mpr (Or.inl hy)) + refine tangleMetric_le ⟨v, W, {v}, {c}, ⟨Or.inl (Or.inl ⟨v, hv, rfl⟩), Or.inl (Or.inl ⟨v, hvD, + rfl⟩), + Or.inl ⟨v, hv, rfl, rfl⟩⟩, ⟨Or.inr hr, Or.inl (Or.inl ⟨c, hcV, rfl⟩), + Or.inr (Or.inr ⟨hr, c, ⟨hcV, hcr⟩, rfl⟩)⟩, ?_, rfl, ?_, ?_⟩ + · change 2 < 2 * θ + omega + · rintro y rfl + exact hU _ (by simp [W, GraphWalk.support]) + · rintro y rfl + exact hU _ (by simp [W, GraphWalk.support]) + +end Tangle + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Section92.lean b/LeanPool/GraphMinor/GM11/Section92.lean new file mode 100644 index 0000000000..6efd4892e4 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Section92.lean @@ -0,0 +1,1103 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Ties + +/-! +# Graph Minors XI, (9.2) + +`theorem_9_2` is (9.2) of the paper: any two atoms in a restraint `Y` lie together in a tie `X ⊆ Y` +with +`l(X) ≤ l(Y)`. The proof follows the paper. Each atom `a` gets a set `A ⊇ a`, which is a closed disc +`ins(C)` with `C` in `Γ ∩ bd(Y)`, or the closure of an edge used twice by the perimeter walk of `Y`, +or +a vertex of `bd(Y)`. We call the triple a *piece* (`IsPiece`), and `exists_piece` finds it. The +paper's +cases for two pieces `A` and `B` are then, in order: their interiors meet, they share at least two +points, they share one point, or they are disjoint. + +Each tie is `ins(W)` for a closed walk `W` no longer than the perimeter walk of `Y`, so it is a +restraint by (8.5) (`tie_of_walk`). The count of the length is a count of how many times each edge +is +used, compared with `perimeterCount`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + {Γ : Drawing S} {ins : Drawing S → Set S} {k : ℕ} {Y : Set S} + +/-- `A` is the set that the proof of (9.2) attaches to an atom in `Y`, and `G` is the part of +`Γ ∩ bd(Y)` around it: the circuit bounding the disc `A`, or an edge with its two ends, or a vertex. +-/ +structure IsPiece (Γ : Drawing S) (ins : Drawing S → Set S) (k : ℕ) (Y A : Set S) (G : Drawing S) : + Prop where + sub : G.IsSubdrawing (Γ.interSet (frontier Y)) + subY : A ⊆ Y + absorbing : IsAbsorbing Γ ins k A + U_sub : G.U ⊆ A + sub_ins : A ⊆ insOf ins G + rest : A \ G.U ⊆ interior Y + Vne : G.V.Nonempty + walk : ∀ v ∈ G.V, ∃ Z : GraphWalk Γ.toGraph v v, walkDrawing Γ Z = G ∧ + ∀ e ∈ Γ.E, edgeCount Z.edges e ≤ perimeterCount Y e + block : IsBlock G + kind : (G.IsCircuit ∧ A = ins G) ∨ + (∃ (e : Set S) (u v : S), u ≠ v ∧ e ∈ Γ.E ∧ closure e ∩ Γ.V = {u, v} ∧ G.V = {u, v} ∧ G.E = {e} + ∧ + A = closure e ∧ A ⊆ G.U) ∨ + (∃ v, G.V = {v} ∧ G.E = ∅ ∧ A = {v} ∧ G.U = {v}) + +omit [T2Space S] [ConnectedSpace S] in +theorem one_le_perimeterCount {e : Set S} (he : e ∈ Γ.E) (hf : e ⊆ frontier Y) : 1 + ≤ perimeterCount Y e := by + classical + obtain ⟨x, hx⟩ := he.1 + have hn : (e ∩ frontier Y).Nonempty := ⟨x, hx, hf hx⟩ + unfold perimeterCount + simp only [hn, ite_true] + split_ifs <;> omega + +omit [TopologicalSpace S] [T2Space S] [ConnectedSpace S] in +theorem length_le_of_edgeCount {L L' : List (Set S)} (h : ∀ e, edgeCount L e ≤ edgeCount L' e) : + L.length ≤ L'.length := by + classical + refine (List.subperm_ext_iff.mpr fun x _ => ?_).length_le + have := h x + unfold edgeCount at this + convert this + +omit [TopologicalSpace S] [T2Space S] [ConnectedSpace S] in +theorem edges_length {G : Graph S (Set S)} {a b : S} (W : GraphWalk G a b) : + W.edges.length = W.length := by + induction W with + | nil _ => rfl + | cons _ _ ih => simp [ih] + +omit [T2Space S] [ConnectedSpace S] in +/-- A point of two subdrawings of `Γ` is a vertex of both, or lies on an edge of both. -/ +theorem U_inter_cases {G H : Drawing S} (hG : G.IsSubdrawing Γ) (hH : H.IsSubdrawing Γ) {x : S} + (hxG : x ∈ G.U) (hxH : x ∈ H.U) : (x ∈ G.V ∧ x ∈ H.V) ∨ ∃ e ∈ G.E, e ∈ H.E ∧ x ∈ e := by + have hc : ∀ {D : Drawing S}, x ∈ D.U → x ∈ D.V ∨ ∃ e ∈ D.E, x ∈ e := fun {D} hx => by + by_cases h : x ∈ D.V + · exact Or.inl h + · obtain ⟨e, he, hxe⟩ := D.exists_edge_of_mem hx h + exact Or.inr ⟨e, he, hxe⟩ + rcases hc hxG with h₁ | ⟨e, he, hxe⟩ <;> rcases hc hxH with h₂ | ⟨f, hf, hxf⟩ + · exact Or.inl ⟨h₁, h₂⟩ + · exact (edge_notMem_V (hH.2 hf) hxf (hG.1 h₁)).elim + · exact (edge_notMem_V (hG.2 he) hxe (hH.1 h₂)).elim + · obtain rfl : e = f := Γ.edge_eq_of_mem (hG.2 he) (hH.2 hf) hxe hxf + exact Or.inr ⟨e, he, hf, hxe⟩ + +variable (hS : IsClosedSurface S) + +include hS in +theorem insOf_frontier (hs : IsSlope Γ k ins) (hY : IsRestraint Γ ins k Y) : + insOf ins (Γ.interSet (frontier Y)) = Y := by + have := theorem_8_3_proof hS hs hY + rwa [subBd_eq_frontier] at this + +include hS in +/-- A circuit of `Γ ∩ bd(Y)` gives a piece. -/ +theorem piece_of_circuit (hs : IsSlope Γ k ins) (hY : IsRestraint Γ ins k Y) {C : Drawing S} + (hC : C.IsCircuit) (hCs : C.IsSubdrawing (Γ.interSet (frontier Y))) : + IsPiece Γ ins k Y (ins C) C := by + classical + have hl := hY.isConfined hS C hC hCs + have hCΓ : C.IsSubdrawing Γ := hCs.trans interSet_isSub + obtain ⟨hfr, hU, -⟩ := ins_slope_facts hS hs hC hCΓ hl + have hsubY : ins C ⊆ Y := by + rw [← insOf_frontier hS hs hY] + exact fun x hx => Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, hCs⟩, hx⟩) + have hcl : IsClosed (ins C) := (hs.isClosedDisc C hC hCΓ hl).isCompact.isClosed + refine ⟨hCs, hsubY, isAbsorbing_ins hs hC hCΓ hl, hU, + fun x hx => Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, ⟨Subset.rfl, Subset.rfl⟩⟩, hx⟩), ?_, ?_, ?_, + isBlock_of_isCircuit hC, Or.inl ⟨hC, rfl⟩⟩ + · rintro x ⟨hx, hxU⟩ + refine interior_mono hsubY ?_ + by_contra hxi + exact hxU (hfr ▸ (⟨subset_closure hx, hxi⟩ : x ∈ closure (ins C) \ interior (ins C))) + · obtain ⟨u, W, -, -, hV, -⟩ := hC + exact ⟨u, by rw [hV]; exact W.start_mem_support⟩ + · intro v hv + obtain ⟨W, hW, -, hV, hE⟩ := exists_walk_at hC hv + obtain ⟨Z, hsu, hed⟩ := hCΓ.exists_walk_up W + refine ⟨Z, Drawing.ext_of_V_E ?_ ?_, fun e he => ?_⟩ + · rw [walkDrawing_V, hV, hsu] + · rw [walkDrawing_E, hE, hed] + · by_cases hm : e ∈ Z.edges + · have heC : e ∈ C.E := by + rw [hE, ← hed] + exact hm + have hnd : Z.edges.Nodup := hed ▸ hW.2 + have h₁ : edgeCount Z.edges e = 1 := by + unfold edgeCount + convert List.count_eq_one_of_mem hnd hm + rw [h₁] + exact one_le_perimeterCount he (mem_interSet_E_iff.mp (hCs.2 heC)).2 + · rw [edgeCount_eq_zero hm] + exact Nat.zero_le _ + +omit [ConnectedSpace S] in +/-- A vertex of `bd(Y)` gives a piece. -/ +theorem piece_of_vertex (hY : IsRestraint Γ ins k Y) {v : S} (hv : v ∈ Γ.V) (hf : v ∈ frontier Y) : + IsPiece Γ ins k Y {v} (walkDrawing Γ (GraphWalk.nil (G := Γ.toGraph) hv)) := by + set G := walkDrawing Γ (GraphWalk.nil (G := Γ.toGraph) hv) with hG + have hsu : (GraphWalk.nil (G := Γ.toGraph) hv).support = [v] := rfl + have hed : (GraphWalk.nil (G := Γ.toGraph) hv).edges = [] := rfl + have hV : G.V = {v} := by + rw [hG, walkDrawing_V, hsu] + ext x + simp + have hE : G.E = ∅ := by + rw [hG, walkDrawing_E, hed] + ext x + simp + have hU : G.U = {v} := by + rw [Drawing.U_eq, hV, hE] + simp + have hvY : v ∈ Y := hY.isClosed.frontier_subset hf + refine ⟨⟨fun x hx => ?_, fun e he => ?_⟩, singleton_subset_iff.mpr hvY, ?_, hU.subset, + fun x hx => Or.inl (hU ▸ hx), ?_, ⟨v, by rw [hV]; rfl⟩, ?_, isBlock_of_subsingleton + (by rw [hE]; simp), + Or.inr (Or.inr ⟨v, hV, hE, rfl, hU⟩)⟩ + · rw [hV] at hx + obtain rfl : x = v := hx + exact mem_interSet_V hv hf + · rw [hE] at he + exact he.elim + · exact IsArm.isAbsorbing (p := v) (Or.inl rfl) + · rintro x ⟨hx, hxU⟩ + exact (hxU (hU ▸ hx)).elim + · intro w hw + rw [hV] at hw + obtain rfl : w = v := hw + refine ⟨GraphWalk.nil hv, rfl, fun e _ => ?_⟩ + have : edgeCount (GraphWalk.nil (G := Γ.toGraph) hv).edges e = 0 := + edgeCount_eq_zero (by rw [hed]; simp) + omega + +omit [ConnectedSpace S] in +/-- An edge of `bd(Y)` that the perimeter walk of `Y` uses twice, with two ends, gives a piece. -/ +theorem piece_of_edge (hY : IsRestraint Γ ins k Y) {e : Set S} (he : e ∈ Γ.E) {u v : S} + (huv : u ≠ v) + (hcap : closure e ∩ Γ.V = {u, v}) (hf : e ⊆ frontier Y) (hc : 2 ≤ perimeterCount Y e) : + ∃ G, IsPiece Γ ins k Y (closure e) G := by + classical + have hl : Γ.toGraph.IsLink e u v := by + have hu : u ∈ closure e ∩ Γ.V := by rw [hcap]; simp + have hv : v ∈ closure e ∩ Γ.V := by rw [hcap]; simp + exact ⟨he, hu.2, hv.2, hcap⟩ + have hl' : Γ.toGraph.IsLink e v u := hl.symm + have hclf : closure e ⊆ frontier Y := closure_minimal hf isClosed_frontier + let Zu : GraphWalk Γ.toGraph u u := .cons hl (.cons hl' (.nil hl.2.1)) + let Zv : GraphWalk Γ.toGraph v v := .cons hl' (.cons hl (.nil hl.2.2.1)) + have hsu : Zu.support = [u, v, u] := rfl + have hed : Zu.edges = [e, e] := rfl + have hsv : Zv.support = [v, u, v] := rfl + have hedv : Zv.edges = [e, e] := rfl + set G := walkDrawing Γ Zu with hG + have hV : G.V = {u, v} := by + rw [hG, walkDrawing_V, hsu] + ext x + change x ∈ [u, v, u] ↔ x ∈ ({u, v} : Set S) + simp only [List.mem_cons, List.not_mem_nil, or_false, mem_insert_iff, mem_singleton_iff] + tauto + have hE : G.E = {e} := by + rw [hG, walkDrawing_E, hed] + ext x + simp + have hU : G.U = closure e := by + ext x + rw [hG, mem_walkDrawing_U] + constructor + · rintro (h | ⟨f, hf, hx⟩) + · have hu : u ∈ closure e ∩ Γ.V := by rw [hcap]; simp + have hv : v ∈ closure e ∩ Γ.V := by rw [hcap]; simp + rw [hsu] at h + simp only [List.mem_cons, List.not_mem_nil, or_false] at h + rcases h with rfl | rfl | rfl + · exact hu.1 + · exact hv.1 + · exact hu.1 + · obtain rfl : f = e := by + rw [hed] at hf + simpa using hf + exact hx + · exact fun hx => Or.inr ⟨e, by rw [hed]; simp, hx⟩ + have hYc := hY.isClosed + have hcountZ : ∀ {w : S} (Z : GraphWalk Γ.toGraph w w), Z.edges = [e, e] → ∀ f ∈ Γ.E, + edgeCount Z.edges f ≤ perimeterCount Y f := by + intro w Z hZ f _ + rw [hZ] + by_cases hfe : f = e + · subst hfe + have : edgeCount [f, f] f = 2 := by simp [edgeCount] + omega + · have : edgeCount [e, e] f = 0 := edgeCount_eq_zero (by simpa using hfe) + omega + have hLu : IsLineWithEnds (closure e) u v := isLine_closure he huv hcap + have hArm : ∀ {w}, w ∈ G.V → IsArm (closure e) w := by + intro w hw + rw [hV] at hw + rcases hw with rfl | hw + · exact Or.inr ⟨v, hLu⟩ + · obtain rfl : w = v := hw + exact Or.inr ⟨u, IsLineWithEnds.symm hLu⟩ + refine ⟨G, ⟨fun x hx => ?_, fun f hf => ?_⟩, hclf.trans hYc.frontier_subset, ?_, hU.subset, + fun x hx => Or.inl (hU ▸ hx), ?_, ⟨u, by rw [hV]; simp⟩, ?_, + isBlock_of_subsingleton (by rw [hE]; simp), Or.inr (Or.inl ⟨e, u, v, huv, he, hcap, hV, hE, + rfl, hU.superset⟩)⟩ + · have hm : x ∈ closure e ∩ Γ.V := by + rw [hcap] + rwa [hV] at hx + exact mem_interSet_V hm.2 (hclf hm.1) + · rw [hE] at hf + obtain rfl : f = e := hf + exact mem_interSet_E_iff.mpr ⟨he, hclf.trans' subset_closure⟩ + · exact IsArm.isAbsorbing (hArm (by rw [hV]; simp : u ∈ G.V)) + · rintro x ⟨hx, hxU⟩ + exact (hxU (hU ▸ hx)).elim + · intro w hw + rw [hV] at hw + rcases hw with rfl | hw + · exact ⟨Zu, rfl, hcountZ Zu rfl⟩ + · obtain rfl : w = v := hw + refine ⟨Zv, Drawing.ext_of_V_E ?_ ?_, hcountZ Zv rfl⟩ + · rw [walkDrawing_V, hV, hsv] + ext x + change x ∈ [w, u, w] ↔ x ∈ ({u, w} : Set S) + simp only [List.mem_cons, List.not_mem_nil, or_false, mem_insert_iff, mem_singleton_iff] + tauto + · rw [walkDrawing_E, hE, hedv] + ext x + simp + + +include hS in +/-- **The set attached to an atom.** The first paragraph of the proof of (9.2). -/ +theorem exists_piece (hs : IsSlope Γ k ins) (hY : IsRestraint Γ ins k Y) {a : Set S} (ha : a ∈ Γ.A) + (haY : a ⊆ Y) : ∃ A G, IsPiece Γ ins k Y A G ∧ a ⊆ A := by + classical + have hconf := hY.isConfined hS + by_cases hcirc : ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing (Γ.interSet (frontier Y)) ∧ + (a ∩ ins C).Nonempty + · obtain ⟨C, hC, hCs, hne⟩ := hcirc + have hCΓ : C.IsSubdrawing Γ := hCs.trans interSet_isSub + obtain ⟨-, -, hnice⟩ := ins_slope_facts hS hs hC hCΓ (hconf C hC hCs) + exact ⟨ins C, C, piece_of_circuit hS hs hY hC hCs, nice_atom hnice ha hne⟩ + push Not at hcirc + have hoff : ∀ x ∈ a, x ∈ (Γ.interSet (frontier Y)).U := by + intro x hx + have hxY := haY hx + rw [← insOf_frontier hS hs hY] at hxY + rcases hxY with h | h + · exact h + · obtain ⟨C, ⟨hC, hCs⟩, hxC⟩ := mem_iUnion₂.mp h + have := hcirc C hC hCs + exact (this.subset ⟨hx, hxC⟩).elim + have hUfr : (Γ.interSet (frontier Y)).U ⊆ frontier Y := interSet_U_subset isClosed_frontier + have hUΓ : (Γ.interSet (frontier Y)).U ⊆ Γ.U := (interSet_isSub (Γ := Γ)).U_subset + rcases ha with (⟨v, hv, rfl⟩ | he) | hr + · have hvf := hUfr (hoff v rfl) + exact ⟨{v}, _, piece_of_vertex hY hv hvf, Subset.rfl⟩ + · obtain ⟨x, hx⟩ := he.1 + have hxf := hUfr (hoff x hx) + have hef : a ⊆ frontier Y := edge_subset_frontier hS hY.isClosed hY.isGammaNice he hx hxf + have hclf : closure a ⊆ frontier Y := closure_minimal hef isClosed_frontier + obtain ⟨u, v, hl⟩ := (Γ.toGraph.edge_mem_iff_exists_isLink a).mp he + by_cases huv : u = v + · subst huv + -- A loop of `bd(Y)` is a circuit, and then the first case applies. + let W : GraphWalk Γ.toGraph u u := .cons hl (.nil hl.2.1) + have hWsu : W.support = [u, u] := rfl + have hWed : W.edges = [a] := rfl + have hWc : (walkDrawing Γ W).IsCircuit := isCircuit_walkDrawing Γ + (W := W) ⟨by rw [hWsu]; simp, by rw [hWed]; simp⟩ (by simp [W]) + have hWs : (walkDrawing Γ W).IsSubdrawing (Γ.interSet (frontier Y)) := by + refine ⟨fun y hy => ?_, fun f hf => ?_⟩ + · rw [walkDrawing_V] at hy + obtain rfl : y = u := by + rw [hWsu] at hy + simpa using hy + have hu : y ∈ closure a ∩ Γ.V := by rw [hl.2.2.2]; simp + exact mem_interSet_V hu.2 (hclf hu.1) + · rw [walkDrawing_E] at hf + obtain rfl : f = a := by + rw [hWed] at hf + simpa using hf + exact mem_interSet_E_iff.mpr ⟨he, hef⟩ + obtain ⟨-, hUi, -⟩ := ins_slope_facts hS hs hWc (hWs.trans interSet_isSub) (hconf _ hWc hWs) + have hxU : x ∈ (walkDrawing Γ W).U := + (mem_walkDrawing_U Γ W).mpr (Or.inr ⟨a, by rw [hWed]; simp, subset_closure hx⟩) + exact ((hcirc _ hWc hWs).subset ⟨hx, hUi hxU⟩).elim + · -- Each side of the edge lies outside `Y`, so the perimeter walk uses it twice. + obtain ⟨O, A₁, A₂, hO, hxO, hOe, hcov, c₁, c₂, d₁, d₂, h₁, h₂⟩ := + exists_edge_sides hS Γ he hx + have hside : ∀ {B : Set S}, IsPreconnected B → Disjoint B Γ.U → a ∩ O ⊆ closure B → ¬ B ⊆ Y + := by + intro B hB hd hcl hsub + obtain ⟨z, -, hzB⟩ := mem_closure_iff.mp (hcl ⟨hx, hxO⟩) univ isOpen_univ (mem_univ _) + have hzY := hsub hzB + rw [← insOf_frontier hS hs hY] at hzY + rcases hzY with h | h + · exact disjoint_left.mp hd hzB (hUΓ h) + · obtain ⟨C, ⟨hC, hCs⟩, hzC⟩ := mem_iUnion₂.mp h + have hCΓ : C.IsSubdrawing Γ := hCs.trans interSet_isSub + have hl' := hconf C hC hCs + obtain ⟨-, -, hnice⟩ := ins_slope_facts hS hs hC hCΓ hl' + have hBC : B ⊆ ins C := side_subset hnice hB hd ⟨z, hzB, hzC⟩ + have hcl' : IsClosed (ins C) := (hs.isClosedDisc C hC hCΓ hl').isCompact.isClosed + exact (hcirc C hC hCs).subset ⟨hx, closure_minimal hBC hcl' (hcl ⟨hx, hxO⟩)⟩ + have hcount := perimeterCount_eq hS hY.isClosed hY.isGammaNice he hx hO hxO hOe hcov c₁ c₂ d₁ + d₂ h₁ h₂ + have hn₁ := hside c₁ d₁ h₁ + have hn₂ := hside c₂ d₂ h₂ + have haY' : a ⊆ Y := haY + simp only [haY', hn₁, hn₂, ite_true, ite_false] at hcount + obtain ⟨G, hG⟩ := piece_of_edge hY he huv hl.2.2.2 hef (by omega) + exact ⟨closure a, G, hG, subset_closure⟩ + · obtain ⟨x, hx⟩ := region_nonempty hr + exact (region_subset hr hx (hUΓ (hoff x hx))).elim + +/-- Two parts `G`, `H` of `Γ ∩ bd(Y)` are joined inside the budget of `Y`: there are closed walks +around them, and a walk `Q` +between them, with `|Z₁| + |Z₂| + 2|Q| ≤ l(Y)`. -/ +def IsPieceLink (Γ : Drawing S) (Y : Set S) (G H : Drawing S) : Prop := + ∃ (a b : S) (Q : GraphWalk Γ.toGraph a b) (Z₁ : GraphWalk Γ.toGraph a a) + (Z₂ : GraphWalk Γ.toGraph b b), a ∈ G.V ∧ b ∈ H.V ∧ + walkDrawing Γ Z₁ = G ∧ walkDrawing Γ Z₂ = H ∧ Z₁.length + Z₂.length + 2 * Q.length + ≤ perimeterWalkLength Γ Y + +include hS in +/-- A set `X ⊆ Y` of the shape of a tie is a tie, if it is `ins(Z)` for a closed walk `Z` no longer +than the perimeter walk of `Y`. -/ +theorem tie_of_walk (hs : IsSlope Γ k ins) (hY : IsRestraint Γ ins k Y) {X : Set S} {u : S} + (Z : GraphWalk Γ.toGraph u u) (hlen : Z.length ≤ perimeterWalkLength Γ Y) + (hU : (walkDrawing Γ Z).U ⊆ X) (hab : IsAbsorbing Γ ins k X) (hsup : X ⊆ insWalk ins Γ Z) + (hsh : IsTieShape X) (hXY : X ⊆ Y) : + IsTie Γ ins k X ∧ X ⊆ Y ∧ perimeterWalkLength Γ X ≤ perimeterWalkLength Γ Y := by + have hk : Z.length < k := hlen.trans_lt hY.length_lt + have heq : insWalk ins Γ Z = X := Subset.antisymm (insWalk_subset Z hk hab hU) hsup + have h := theorem_8_5_proof hS hs Z hk + rw [heq] at h + exact ⟨⟨h.1, hsh⟩, hXY, h.2.trans hlen⟩ + +include hS in +/-- The length of a closed walk that uses each edge at most `perimeterCount Y e` times. -/ +theorem length_le_of_count (hY : IsRestraint Γ ins k Y) {L : List (Set S)} (hLE : ∀ e ∈ L, e ∈ Γ.E) + (hL : ∀ e ∈ Γ.E, edgeCount L e ≤ perimeterCount Y e) : L.length ≤ perimeterWalkLength Γ Y := by + obtain ⟨u, W, -, hlen, -, hcnt, -⟩ := hY.exists_walk hS + rw [← hlen] + have : L.length ≤ W.edges.length := length_le_of_edgeCount fun e => by + by_cases he : e ∈ Γ.E + · rw [hcnt e he] + exact hL e he + · rw [edgeCount_eq_zero fun h => he (hLE e h)] + exact Nat.zero_le _ + rwa [edges_length] at this + +include hS in +/-- A piece that is not a disc is an arm at each of its vertices. -/ +theorem IsPiece.shape (hs : IsSlope Γ k ins) (hY : IsRestraint Γ ins k Y) {A : Set S} {G : Drawing + S} + (hP : IsPiece Γ ins k Y A G) : IsClosedDisc A ∨ ∀ v ∈ G.V, IsArm A v := by + rcases hP.kind with ⟨hC, rfl⟩ | ⟨e, u, v, huv, he, hcap, hV, -, rfl, -⟩ | ⟨v, hV, -, rfl, -⟩ + · have hGs : G.IsSubdrawing Γ := hP.sub.trans interSet_isSub + exact Or.inl (hs.isClosedDisc G hC hGs (hY.isConfined hS G hC hP.sub)) + · refine Or.inr fun w hw => ?_ + have hL : IsLineWithEnds (closure e) u v := isLine_closure he huv hcap + rw [hV] at hw + rcases hw with rfl | hw + · exact Or.inr ⟨v, hL⟩ + · obtain rfl : w = v := hw + exact Or.inr ⟨u, IsLineWithEnds.symm hL⟩ + · refine Or.inr fun w hw => ?_ + rw [hV] at hw + obtain rfl : w = v := hw + exact Or.inl rfl + +include hS in +/-- A piece alone is a tie. -/ +theorem tie_of_piece (hs : IsSlope Γ k ins) (hY : IsRestraint Γ ins k Y) {A : Set S} {G : Drawing S} + (hP : IsPiece Γ ins k Y A G) : + IsTie Γ ins k A ∧ A ⊆ Y ∧ perimeterWalkLength Γ A ≤ perimeterWalkLength Γ Y := by + obtain ⟨v, hv⟩ := hP.Vne + obtain ⟨Z, hZ, hcnt⟩ := hP.walk v hv + have hlen : Z.length ≤ perimeterWalkLength Γ Y := by + have := length_le_of_count hS hY (fun e he => mem_E_of_mem_edges Z he) hcnt + rwa [edges_length] at this + have hsh : IsTieShape A := by + rcases hP.shape hS hs hY with h | h + · exact Or.inr (Or.inr (Or.inl h)) + · exact (h v hv).isTieShape + refine tie_of_walk hS hs hY Z hlen (hZ ▸ hP.U_sub) hP.absorbing ?_ hsh hP.subY + rw [insWalk, hZ] + exact hP.sub_ins + +omit [TopologicalSpace S] [T2Space S] [ConnectedSpace S] in +private theorem pair_eq {u v x y : S} (hx : x ∈ ({u, v} : Set S)) (hy : y ∈ ({u, v} : Set S)) + (hxy : x ≠ y) : ({u, v} : Set S) = {x, y} := by + rcases hx with rfl | hx <;> rcases hy with rfl | hy + · exact (hxy rfl).elim + · rw [mem_singleton_iff.mp hy] + · rw [mem_singleton_iff.mp hx, pair_comm] + · exact (hxy ((mem_singleton_iff.mp hx).trans (mem_singleton_iff.mp hy).symm)).elim + +omit [T2Space S] [ConnectedSpace S] in +/-- A vertex of `Γ` on a subdrawing is a vertex of the subdrawing. -/ +theorem mem_V_of_mem_U {G : Drawing S} (hG : G.IsSubdrawing Γ) {x : S} (hx : x ∈ G.U) + (hV : x ∈ Γ.V) : + x ∈ G.V := by + by_contra h + obtain ⟨e, he, hxe⟩ := G.exists_edge_of_mem hx h + exact edge_notMem_V (hG.2 he) hxe hV + +omit [T2Space S] [ConnectedSpace S] in +/-- A simple walk that meets `T` only in `c` has no edge whose closure lies in `T`. -/ +theorem edge_off {a b c : S} {S' : GraphWalk Γ.toGraph a b} (hS' : S'.IsSimple) {T : Set S} + (h : ∀ x ∈ S'.support, x ∈ T → x = c) {e : Set S} (he : e ∈ S'.edges) + (hT : closure e ⊆ T) : False := by + obtain ⟨x, y, W₁, hl, W₂, hW⟩ := exists_split_edge S' he + have hx : x ∈ S'.support := by + rw [hW] + exact (GraphWalk.mem_support_append _ _).mpr (Or.inl W₁.end_mem_support) + have hy : y ∈ S'.support := by + rw [hW] + exact (GraphWalk.mem_support_append _ _).mpr (Or.inr (by simp [W₂.start_mem_support])) + have hxe : x ∈ closure e ∩ Γ.V := by rw [hl.2.2.2]; simp + have hye : y ∈ closure e ∩ Γ.V := by rw [hl.2.2.2]; simp + have hxy : x = y := (h x hx (hT hxe.1)).trans (h y hy (hT hye.1)).symm + have hnd : (W₁.append (.cons hl W₂)).support.Nodup := hW ▸ hS' + rw [GraphWalk.support_append] at hnd + exact (List.nodup_append.mp hnd).2.2 x W₁.end_mem_support y W₂.start_mem_support hxy + +omit [ConnectedSpace S] in +/-- A vertex of a piece that holds two points lies on an edge of the piece. -/ +theorem IsPiece.vertex_on_edge {A : Set S} {G : Drawing S} (hP : IsPiece Γ ins k Y A G) {x y : S} + (hxy : x ≠ y) (hx : x ∈ G.U) (hy : y ∈ G.U) {v : S} (hv : v ∈ G.V) : ∃ e ∈ G.E, v ∈ closure e + := by + rcases hP.kind with ⟨hC, -⟩ | ⟨e, u, w, -, -, hcap, hV, hE, -, -⟩ | ⟨w, -, -, -, hU⟩ + · obtain ⟨W, -, hpos, -, hE⟩ := exists_walk_at hC hv + cases W with + | nil _ => simp at hpos + | @cons _ w _ e hl r => + refine ⟨e, by rw [hE]; simp, ?_⟩ + have : v ∈ closure e ∩ G.V := by rw [hl.2.2.2]; simp + exact this.1 + · refine ⟨e, by rw [hE]; rfl, ?_⟩ + have hvΓ : v ∈ closure e ∩ Γ.V := by + rw [hcap, ← hV] + exact hv + exact hvΓ.1 + · rw [hU] at hx hy + exact (hxy (hx.trans hy.symm)).elim + +include hS in +/-- The interiors of two pieces: if they meet, the first piece lies in the second. -/ +private theorem star_subset (hs : IsSlope Γ k ins) (hY : IsRestraint Γ ins k Y) {A B : Set S} + {G H : Drawing S} (hP : IsPiece Γ ins k Y A G) (hQ : IsPiece Γ ins k Y B H) {x : S} + (hxA : x ∈ A) + (hxG : x ∉ G.U) (hxB : x ∈ B) (hxH : x ∉ H.U) : A ⊆ B := by + have hconf := hY.isConfined hS + have hdisc : ∀ {A : Set S} {G : Drawing S}, IsPiece Γ ins k Y A G → (∃ x ∈ A, x ∉ G.U) → + IsClosedDisc A ∧ frontier A = G.U ∧ discBd A = G.U := by + intro A G hP ⟨x, hxA, hxG⟩ + rcases hP.kind with ⟨hC, rfl⟩ | ⟨-, -, -, -, -, -, -, -, -, hU⟩ | ⟨v, -, -, rfl, hU⟩ + · have hGs : G.IsSubdrawing Γ := hP.sub.trans interSet_isSub + have hl := hconf G hC hP.sub + have hD := hs.isClosedDisc G hC hGs hl + obtain ⟨hfr, -, -⟩ := ins_slope_facts hS hs hC hGs hl + exact ⟨hD, hfr, by rw [← IsClosedDisc.frontier_eq_discBd hS hD, hfr]⟩ + · exact (hxG (hU hxA)).elim + · exact (hxG (hU ▸ hxA)).elim + obtain ⟨hdA, -, hbA⟩ := hdisc hP ⟨x, hxA, hxG⟩ + obtain ⟨hdB, hfB, -⟩ := hdisc hQ ⟨x, hxB, hxH⟩ + have hBc : IsClosed B := hdB.isCompact.isClosed + have hstar : IsPreconnected (A \ discBd A) := + (isPathConnected_disc_sdiff hdA inter_subset_left).isConnected.isPreconnected + have hsplit : ∀ {y}, y ∉ frontier B → y ∈ interior B ∪ Bᶜ := fun {y} hy => by + by_cases hyB : y ∈ B + · refine Or.inl ?_ + by_contra hi + exact hy ⟨subset_closure hyB, hi⟩ + · exact Or.inr hyB + have hmem : A \ discBd A ⊆ interior B := by + refine hstar.subset_left_of_subset_union isOpen_interior hBc.isOpen_compl + (disjoint_left.mpr fun y h₁ h₂ => h₂ (interior_subset h₁)) (fun y hy => hsplit ?_) ?_ + · intro hy' + rw [hfB] at hy' + have h₁ : y ∈ interior Y := hP.rest ⟨hy.1, by rw [← hbA]; exact hy.2⟩ + have h₂ : y ∈ frontier Y := interSet_U_subset isClosed_frontier (hQ.sub.U_subset hy') + exact h₂.2 h₁ + · refine ⟨x, ⟨hxA, by rw [hbA]; exact hxG⟩, ?_⟩ + by_contra hi + exact hxH (hfB ▸ (⟨subset_closure hxB, hi⟩ : x ∈ frontier B)) + intro y hy + by_cases hyb : y ∈ discBd A + · exact closure_minimal (hmem.trans interior_subset) hBc (discBd_subset_closure hdA hyb) + · exact interior_subset (hmem ⟨hy, hyb⟩) + +include hS in +/-- The case of (9.2) with two pieces that share at least two points. -/ +theorem piece_of_two_points (hs : IsSlope Γ k ins) (hY : IsRestraint Γ ins k Y) {A B : Set S} + {G H : Drawing S} (hP : IsPiece Γ ins k Y A G) (hQ : IsPiece Γ ins k Y B H) {x y : S} + (hxy : x ≠ y) + (hxG : x ∈ G.U) (hxH : x ∈ H.U) (hyG : y ∈ G.U) (hyH : y ∈ H.U) : + ∃ X K, IsPiece Γ ins k Y X K ∧ A ⊆ X ∧ B ⊆ X := by + classical + have hGΓ : G.IsSubdrawing Γ := hP.sub.trans interSet_isSub + have hHΓ : H.IsSubdrawing Γ := hQ.sub.trans interSet_isSub + obtain ⟨v₀, hv₁, hv₂⟩ : ∃ v, v ∈ G.V ∧ v ∈ H.V := by + rcases U_inter_cases hGΓ hHΓ hxG hxH with h | ⟨e, he₁, he₂, -⟩ + · exact ⟨x, h⟩ + · obtain ⟨p, q, hl⟩ := (G.toGraph.edge_mem_iff_exists_isLink e).mp he₁ + have hp : p ∈ closure e ∩ G.V := by rw [hl.2.2.2]; simp + refine ⟨p, hp.2, ?_⟩ + have : p ∈ closure e ∩ H.V := by + rw [hHΓ.closure_inter_V he₂] + exact ⟨hp.1, hGΓ.1 hp.2⟩ + exact this.2 + obtain ⟨Z₁, hZ₁, -⟩ := hP.walk v₀ hv₁ + obtain ⟨Z₂, hZ₂, -⟩ := hQ.walk v₀ hv₂ + have hed : ∀ {K : Drawing S} {A' : Set S} (Z : GraphWalk Γ.toGraph v₀ v₀), IsPiece Γ ins k Y A' K + → + walkDrawing Γ Z = K → x ∈ K.U → y ∈ K.U → ∀ z ∈ Z.support, ∃ e ∈ Z.edges, z ∈ closure e := by + intro K A' Z hR hZ hx hy z hz + have hzV : z ∈ K.V := by + rw [← hZ, walkDrawing_V] + exact hz + obtain ⟨e, he, hze⟩ := hR.vertex_on_edge hxy hx hy hzV + rw [← hZ, walkDrawing_E] at he + exact ⟨e, he, hze⟩ + have hns := isNonSeparable_walk Z₁ Z₂ (hZ₁ ▸ hP.block) (hZ₂ ▸ hQ.block) (hed Z₁ hP hZ₁ hxG hyG) + (hed Z₂ hQ hZ₂ hxH hyH) hxy (hZ₁ ▸ hxG) (hZ₂ ▸ hxH) (hZ₁ ▸ hyG) (hZ₂ ▸ hyH) + set D := walkDrawing Γ (Z₁.append Z₂) with hD + have hs₁ : G.IsSubdrawing D := hZ₁ ▸ walkDrawing_mono + (fun z h => (GraphWalk.mem_support_append _ _).mpr (Or.inl h)) + (fun e h => by rw [GraphWalk.edges_append]; exact List.mem_append.mpr (Or.inl h)) + have hs₂ : H.IsSubdrawing D := hZ₂ ▸ walkDrawing_mono + (fun z h => (GraphWalk.mem_support_append _ _).mpr (Or.inr h)) + (fun e h => by rw [GraphWalk.edges_append]; exact List.mem_append.mpr (Or.inr h)) + have hDsub : D.IsSubdrawing (Γ.interSet (frontier Y)) := by + refine ⟨fun z hz => ?_, fun e he => ?_⟩ + · rw [hD, walkDrawing_V] at hz + rcases (GraphWalk.mem_support_append _ _).mp hz with h | h + · exact hP.sub.1 (by rw [← hZ₁, walkDrawing_V]; exact h) + · exact hQ.sub.1 (by rw [← hZ₂, walkDrawing_V]; exact h) + · rw [hD, walkDrawing_E, mem_ofPred_eq, GraphWalk.edges_append, List.mem_append] at he + rcases he with h | h + · exact hP.sub.2 (by rw [← hZ₁, walkDrawing_E]; exact h) + · exact hQ.sub.2 (by rw [← hZ₂, walkDrawing_E]; exact h) + have hDΓ : D.IsSubdrawing Γ := hDsub.trans interSet_isSub + have hconf := hY.isConfined hS + have hconfD : IsConfined k D := fun C hC hCs => hconf C hC (hCs.trans hDsub) + by_cases hc : ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing D + · obtain ⟨C₁, hC₁, hC₁s⟩ := hc + obtain ⟨m, hm⟩ := ((finite_circuits D).image ins).exists_maximal ⟨ins C₁, C₁, ⟨hC₁, hC₁s⟩, rfl⟩ + obtain ⟨C, ⟨hC, hCs⟩, rfl⟩ := hm.1 + have heq := theorem_4_3_iii hs hDΓ hconfD hC hCs + (fun C' h₁ h₂ h₃ => hm.2 ⟨C', ⟨h₁, h₂⟩, rfl⟩ h₃) hns + exact ⟨ins C, C, piece_of_circuit hS hs hY hC (hCs.trans hDsub), + heq ▸ hP.sub_ins.trans (insOf_mono hs₁), heq ▸ hQ.sub_ins.trans (insOf_mono hs₂)⟩ + push Not at hc + have hkind : ∀ {A' : Set S} {K : Drawing S}, IsPiece Γ ins k Y A' K → K.IsSubdrawing D → x ∈ K.U → + y ∈ K.U → ∃ (e : Set S) (u v : S), e ∈ Γ.E ∧ closure e ∩ Γ.V = {u, v} ∧ K.V = {u, v} ∧ + K.E = {e} ∧ A' = closure e := by + intro A' K hR hKs hx hy + rcases hR.kind with ⟨hC, -⟩ | ⟨e, u, v, -, he, hcap, hV, hE, hA', -⟩ | ⟨w, -, -, -, hU⟩ + · exact (hc K hC hKs).elim + · exact ⟨e, u, v, he, hcap, hV, hE, hA'⟩ + · rw [hU] at hx hy + exact (hxy (hx.trans hy.symm)).elim + obtain ⟨e, u₁, v₁, he, hcap₁, hV₁, hE₁, rfl⟩ := hkind hP hs₁ hxG hyG + obtain ⟨f, u₂, v₂, hf, hcap₂, hV₂, hE₂, rfl⟩ := hkind hQ hs₂ hxH hyH + by_cases hef : e = f + · subst hef + exact ⟨closure e, G, hP, Subset.rfl, Subset.rfl⟩ + have hv : ∀ {z}, z ∈ G.U → z ∈ H.U → z ∈ G.V ∧ z ∈ H.V := fun {z} h₁ h₂ => by + rcases U_inter_cases hGΓ hHΓ h₁ h₂ with h | ⟨g, hg₁, hg₂, -⟩ + · exact h + · rw [hE₁] at hg₁ + rw [hE₂] at hg₂ + exact (hef ((mem_singleton_iff.mp hg₁).symm.trans (mem_singleton_iff.mp hg₂))).elim + have hx' := hv hxG hxH + have hy' := hv hyG hyH + have hcap₁' : closure e ∩ Γ.V = {x, y} := + hcap₁.trans (pair_eq (hV₁ ▸ hx'.1) (hV₁ ▸ hy'.1) hxy) + have hcap₂' : closure f ∩ Γ.V = {y, x} := + hcap₂.trans (pair_eq (hV₂ ▸ hy'.2) (hV₂ ▸ hx'.2) hxy.symm) + have hl₁ : Γ.toGraph.IsLink e x y := ⟨he, hGΓ.1 hx'.1, hGΓ.1 hy'.1, hcap₁'⟩ + have hl₂ : Γ.toGraph.IsLink f y x := ⟨hf, hGΓ.1 hy'.1, hGΓ.1 hx'.1, hcap₂'⟩ + let W : GraphWalk Γ.toGraph x x := .cons hl₁ (.cons hl₂ (.nil hl₂.2.2.1)) + have hsu : W.support = [x, y, x] := rfl + have hed' : W.edges = [e, f] := rfl + have hWc : (walkDrawing Γ W).IsCircuit := isCircuit_walkDrawing Γ (W := W) + ⟨by rw [hsu]; simpa using hxy.symm, by rw [hed']; simpa using hef⟩ (by simp [W]) + refine (hc _ hWc ⟨fun z hz => ?_, fun g hg => ?_⟩).elim + · rw [walkDrawing_V, hsu] at hz + have hz' : z = x ∨ z = y ∨ z = x := by simpa using hz + rcases hz' with rfl | rfl | rfl + · exact hs₁.1 hx'.1 + · exact hs₁.1 hy'.1 + · exact hs₁.1 hx'.1 + · rw [walkDrawing_E, hed'] at hg + have hg' : g = e ∨ g = f := by simpa using hg + rcases hg' with rfl | rfl + · exact hs₁.2 (by rw [hE₁]; rfl) + · exact hs₂.2 (by rw [hE₂]; rfl) + +include hS in +/-- The case of (9.2) with two pieces that share exactly one point. -/ +private theorem tie_of_one_point (hs : IsSlope Γ k ins) (hY : IsRestraint Γ ins k Y) {A B : Set S} + {G H : Drawing S} (hP : IsPiece Γ ins k Y A G) (hQ : IsPiece Γ ins k Y B H) {p : S} + (hpG : p ∈ G.V) (hpH : p ∈ H.V) (hAB : A ∩ B = {p}) (hdis : ∀ e ∈ G.E, e ∉ H.E) : + (∃ X, (IsTie Γ ins k X ∧ X ⊆ Y ∧ perimeterWalkLength Γ X ≤ perimeterWalkLength Γ Y) ∧ A ⊆ X + ∧ B ⊆ X) ∧ + IsPieceLink Γ Y G H := by + classical + obtain ⟨Z₁, hZ₁, hc₁⟩ := hP.walk p hpG + obtain ⟨Z₂, hZ₂, hc₂⟩ := hQ.walk p hpH + have hEZ₁ : ∀ e, e ∈ Z₁.edges ↔ e ∈ G.E := fun e => by rw [← hZ₁, walkDrawing_E]; rfl + have hEZ₂ : ∀ e, e ∈ Z₂.edges ↔ e ∈ H.E := fun e => by rw [← hZ₂, walkDrawing_E]; rfl + have hlen : (Z₁.append Z₂).length ≤ perimeterWalkLength Γ Y := by + rw [← edges_length] + refine length_le_of_count hS hY (fun e he => mem_E_of_mem_edges _ he) fun e he => ?_ + rw [GraphWalk.edges_append] + have hadd : edgeCount (Z₁.edges ++ Z₂.edges) e = edgeCount Z₁.edges e + edgeCount Z₂.edges e + := by + simp [edgeCount, List.count_append] + rw [hadd] + by_cases h : e ∈ Z₂.edges + · rw [edgeCount_eq_zero fun h' => hdis e ((hEZ₁ e).mp h') ((hEZ₂ e).mp h)] + simpa using hc₂ e he + · rw [edgeCount_eq_zero h] + simpa using hc₁ e he + have hs₁ : G.IsSubdrawing (walkDrawing Γ (Z₁.append Z₂)) := hZ₁ ▸ walkDrawing_mono + (fun z h => (GraphWalk.mem_support_append _ _).mpr (Or.inl h)) + (fun e h => by rw [GraphWalk.edges_append]; exact List.mem_append.mpr (Or.inl h)) + have hs₂ : H.IsSubdrawing (walkDrawing Γ (Z₁.append Z₂)) := hZ₂ ▸ walkDrawing_mono + (fun z h => (GraphWalk.mem_support_append _ _).mpr (Or.inr h)) + (fun e h => by rw [GraphWalk.edges_append]; exact List.mem_append.mpr (Or.inr h)) + have hsh : IsTieShape (A ∪ B) := by + rcases hP.shape hS hs hY with hd₁ | ha₁ <;> rcases hQ.shape hS hs hY with hd₂ | ha₂ + · refine Or.inr (Or.inr (Or.inr (Or.inl ⟨A, B, hd₁, hd₂, ?_, ?_, rfl⟩))) + · rw [hAB] + simp + · rw [hAB] + exact finite_singleton p + · exact (ha₂ p hpH).isTieShape_disc hd₁ hAB + · rw [union_comm] + exact (ha₁ p hpG).isTieShape_disc hd₂ (by rw [inter_comm, hAB]) + · exact (ha₁ p hpG).isTieShape_union (ha₂ p hpH) hAB + refine ⟨⟨A ∪ B, tie_of_walk hS hs hY (Z₁.append Z₂) hlen ?_ + (hP.absorbing.union hQ.absorbing hAB.subset) ?_ hsh (union_subset hP.subY hQ.subY), + subset_union_left, subset_union_right⟩, p, p, .nil ((hP.sub.trans interSet_isSub).1 hpG), Z₁, + Z₂, hpG, hpH, hZ₁, hZ₂, ?_⟩ + · intro z hz + rcases mem_U_append.mp hz with h | h + · exact Or.inl (hP.U_sub (hZ₁ ▸ h)) + · exact Or.inr (hQ.U_sub (hZ₂ ▸ h)) + · exact union_subset (hP.sub_ins.trans (insOf_mono hs₁)) (hQ.sub_ins.trans (insOf_mono hs₂)) + · have h₁ : (Z₁.append Z₂).length = Z₁.length + Z₂.length := GraphWalk.length_append _ _ + have h₂ : (GraphWalk.nil ((hP.sub.trans interSet_isSub).1 hpG) : GraphWalk Γ.toGraph p + p).length = 0 := rfl + omega + +include hS in +/-- The case of (9.2) with two disjoint pieces, joined by a line `F` with ends `a`, `b` along a +simple +walk `Q` of `Γ ∩ bd(Y)`. The list `L` holds the edges of the other segment of the perimeter walk, +which +is no shorter than `Q`. -/ +private theorem tie_of_line (hs : IsSlope Γ k ins) (hY : IsRestraint Γ ins k Y) {A B : Set S} + {G H : Drawing S} (hP : IsPiece Γ ins k Y A G) (hQ : IsPiece Γ ins k Y B H) (hAB : Disjoint A B) + {a b : S} (ha : a ∈ G.V) (hb : b ∈ H.V) (Q : GraphWalk Γ.toGraph a b) (hQs : Q.IsSimple) + (hQA : ∀ x ∈ Q.support, x ∈ A → x = a) (hQB : ∀ x ∈ Q.support, x ∈ B → x = b) + (hQsub : (walkDrawing Γ Q).IsSubdrawing (Γ.interSet (frontier Y))) {L : List (Set S)} + (hLlen : Q.length ≤ L.length) (hLE : ∀ e ∈ L, e ∈ Γ.E) (hLG : ∀ e ∈ L, e ∉ G.E ∧ e ∉ H.E) + (hcount : ∀ e ∈ Γ.E, edgeCount Q.edges e + edgeCount L e ≤ perimeterCount Y e) : + (∃ X, (IsTie Γ ins k X ∧ X ⊆ Y ∧ perimeterWalkLength Γ X ≤ perimeterWalkLength Γ Y) ∧ A ⊆ X + ∧ B ⊆ X) ∧ + IsPieceLink Γ Y G H := by + classical + obtain ⟨Z₁, hZ₁, hc₁⟩ := hP.walk a ha + obtain ⟨Z₂, hZ₂, hc₂⟩ := hQ.walk b hb + have hEZ₁ : ∀ e, e ∈ Z₁.edges ↔ e ∈ G.E := fun e => by rw [← hZ₁, walkDrawing_E]; rfl + have hEZ₂ : ∀ e, e ∈ Z₂.edges ↔ e ∈ H.E := fun e => by rw [← hZ₂, walkDrawing_E]; rfl + have haA : a ∈ A := hP.U_sub (G.V_subset_U ha) + have hbB : b ∈ B := hQ.U_sub (H.V_subset_U hb) + have hne : a ≠ b := fun h => disjoint_left.mp hAB haA (h ▸ hbB) + have hGΓ : G.IsSubdrawing Γ := hP.sub.trans interSet_isSub + have hHΓ : H.IsSubdrawing Γ := hQ.sub.trans interSet_isSub + have hGcl : ∀ e ∈ G.E, closure e ⊆ A := fun e he => (G.closure_subset_U he).trans hP.U_sub + have hHcl : ∀ e ∈ H.E, closure e ⊆ B := fun e he => (H.closure_subset_U he).trans hQ.U_sub + have hQG : ∀ e ∈ Q.edges, e ∉ G.E := fun e he hG => edge_off hQs hQA he (hGcl e hG) + have hQH : ∀ e ∈ Q.edges, e ∉ H.E := fun e he hG => edge_off hQs hQB he (hHcl e hG) + have hGH : ∀ e ∈ G.E, e ∉ H.E := fun e h₁ h₂ => by + obtain ⟨x, hx⟩ := (hGΓ.2 h₁).1 + exact disjoint_left.mp hAB (hGcl e h₁ (subset_closure hx)) (hHcl e h₂ (subset_closure hx)) + -- The closed walk around `A`, along `Q`, around `B` and back along `Q`. + set Z := Z₁.append (Q.append (Z₂.append Q.reverse)) with hZ + have hlen : Z.length ≤ perimeterWalkLength Γ Y := by + have hM : (Z₁.edges ++ Z₂.edges ++ Q.edges ++ L).length ≤ perimeterWalkLength Γ Y := by + refine length_le_of_count hS hY ?_ fun e he => ?_ + · intro e he + simp only [List.mem_append] at he + rcases he with ((h | h) | h) | h + · exact mem_E_of_mem_edges _ h + · exact mem_E_of_mem_edges _ h + · exact mem_E_of_mem_edges _ h + · exact hLE e h + · have hadd : edgeCount (Z₁.edges ++ Z₂.edges ++ Q.edges ++ L) e = + edgeCount Z₁.edges e + edgeCount Z₂.edges e + edgeCount Q.edges e + edgeCount L e := by + simp only [edgeCount, List.count_append] + rw [hadd] + by_cases h₁ : e ∈ G.E + · rw [edgeCount_eq_zero (l := Z₂.edges) fun h => hGH e h₁ ((hEZ₂ e).mp h), + edgeCount_eq_zero (l := Q.edges) fun h => hQG e h h₁, + edgeCount_eq_zero (l := L) fun h => (hLG e h).1 h₁] + simpa using hc₁ e he + · by_cases h₂ : e ∈ H.E + · rw [edgeCount_eq_zero (l := Z₁.edges) fun h => h₁ ((hEZ₁ e).mp h), + edgeCount_eq_zero (l := Q.edges) fun h => hQH e h h₂, + edgeCount_eq_zero (l := L) fun h => (hLG e h).2 h₂] + simpa using hc₂ e he + · rw [edgeCount_eq_zero (l := Z₁.edges) fun h => h₁ ((hEZ₁ e).mp h), + edgeCount_eq_zero (l := Z₂.edges) fun h => h₂ ((hEZ₂ e).mp h)] + simpa using hcount e he + simp only [List.length_append, edges_length] at hM + have hZl : Z.length = Z₁.length + (Q.length + (Z₂.length + Q.length)) := by + simp [hZ, GraphWalk.length_append, GraphWalk.length_reverse] + omega + set F : Set S := (walkDrawing Γ Q).U with hF + have hFeq : F = {x | x ∈ Q.support} ∪ ⋃ e ∈ {e | e ∈ Q.edges}, closure e := by + ext x + rw [hF, mem_walkDrawing_U] + simp + have hL : IsLineWithEnds F a b := hFeq ▸ walk_isLine Γ Q hQs hne + have hFfr : F ⊆ frontier Y := hQsub.U_subset.trans (interSet_U_subset isClosed_frontier) + have hFΓ := walkDrawing_isSubdrawing Γ Q + have hmeet : ∀ {T : Set S} {K : Drawing S} {c : S}, IsPiece Γ ins k Y T K → + (∀ e ∈ Q.edges, e ∉ K.E) → + (∀ x ∈ Q.support, x ∈ T → x = c) → c ∈ F → c ∈ T → F ∩ T = {c} := by + intro T K c hR hE hO hcF hcT + refine Subset.antisymm ?_ (singleton_subset_iff.mpr ⟨hcF, hcT⟩) + rintro x ⟨hxF, hxT⟩ + have hxK : x ∈ K.U := by + by_contra hn + have h₁ : x ∈ interior Y := hR.rest ⟨hxT, hn⟩ + exact (hFfr hxF).2 h₁ + rcases U_inter_cases hFΓ (hR.sub.trans interSet_isSub) hxF hxK with h | ⟨e, he₁, he₂, -⟩ + · refine hO x ?_ hxT + rw [walkDrawing_V] at h + exact h.1 + · rw [walkDrawing_E] at he₁ + exact (hE e he₁ he₂).elim + have haF : a ∈ F := IsLineWithEnds.left_mem hL + have hbF : b ∈ F := IsLineWithEnds.right_mem hL + have hFA : F ∩ A = {a} := hmeet hP hQG hQA haF haA + have hFB : F ∩ B = {b} := hmeet hQ hQH hQB hbF hbB + have hsh : IsTieShape (A ∪ (F ∪ B)) := by + have hAFB : A ∩ (B ∪ F) = {a} := by + rw [inter_union_distrib_left, disjoint_iff_inter_eq_empty.mp hAB, empty_union, inter_comm, + hFA] + have hBFA : B ∩ (A ∪ F) = {b} := by + rw [inter_union_distrib_left, inter_comm B A, disjoint_iff_inter_eq_empty.mp hAB, empty_union, + inter_comm, hFB] + rcases hP.shape hS hs hY with hd₁ | ha₁ <;> rcases hQ.shape hS hs hY with hd₂ | ha₂ + · refine Or.inr (Or.inr (Or.inr (Or.inr (Or.inr ⟨A, B, F, a, b, hd₁, hd₂, hAB, hL, hFA, hFB, + ?_⟩)))) + rw [← union_assoc, union_right_comm A F B] + · have h₁ : IsArm (B ∪ F) a := (ha₂ b hb).extend (IsLineWithEnds.symm hL) + (by rw [inter_comm, hFB]) + rw [union_comm F B] + exact h₁.isTieShape_disc hd₁ hAFB + · have h₁ : IsArm (A ∪ F) b := (ha₁ a ha).extend hL (by rw [inter_comm, hFA]) + have : A ∪ (F ∪ B) = B ∪ (A ∪ F) := by + rw [← union_assoc, union_comm] + rw [this] + exact h₁.isTieShape_disc hd₂ hBFA + · have h₁ : IsArm (A ∪ F) b := (ha₁ a ha).extend hL (by rw [inter_comm, hFA]) + have : A ∪ (F ∪ B) = (A ∪ F) ∪ B := by + rw [union_assoc] + rw [this] + exact h₁.isTieShape_union (ha₂ b hb) (by rw [inter_comm, hBFA]) + have hab₂ : IsAbsorbing Γ ins k (F ∪ B) := + (IsArm.isAbsorbing (p := a) (Or.inr ⟨b, hL⟩)).union hQ.absorbing hFB.subset + have hab : IsAbsorbing Γ ins k (A ∪ (F ∪ B)) := hP.absorbing.union hab₂ (p := a) (by + rintro x ⟨hxA, hxF | hxB⟩ + · have : x ∈ F ∩ A := ⟨hxF, hxA⟩ + rwa [hFA] at this + · exact (disjoint_left.mp hAB hxA hxB).elim) + have hUZ : ∀ z, z ∈ (walkDrawing Γ Z).U ↔ z ∈ (walkDrawing Γ Z₁).U ∨ z ∈ F ∨ + z ∈ (walkDrawing Γ Z₂).U ∨ z ∈ F := fun z => by + rw [hZ, mem_U_append, mem_U_append, mem_U_append, mem_U_reverse] + have hs₁ : G.IsSubdrawing (walkDrawing Γ Z) := hZ₁ ▸ walkDrawing_mono + (fun z h => (GraphWalk.mem_support_append _ _).mpr (Or.inl h)) + (fun e h => by rw [hZ, GraphWalk.edges_append]; exact List.mem_append.mpr (Or.inl h)) + have hs₂ : H.IsSubdrawing (walkDrawing Γ Z) := hZ₂ ▸ walkDrawing_mono + (fun z h => (GraphWalk.mem_support_append _ _).mpr (Or.inr + ((GraphWalk.mem_support_append _ _).mpr (Or.inr ((GraphWalk.mem_support_append _ _).mpr + (Or.inl h)))))) + (fun e h => by + rw [hZ, GraphWalk.edges_append, GraphWalk.edges_append, GraphWalk.edges_append] + simp [h]) + have hFZ : F ⊆ (walkDrawing Γ Z).U := fun z hz => (hUZ z).mpr (Or.inr (Or.inl hz)) + have hlink : IsPieceLink Γ Y G H := ⟨a, b, Q, Z₁, Z₂, ha, hb, hZ₁, hZ₂, by + have hZl : Z.length = Z₁.length + (Q.length + (Z₂.length + Q.length)) := by + simp [hZ, GraphWalk.length_append, GraphWalk.length_reverse] + omega⟩ + refine ⟨⟨A ∪ (F ∪ B), tie_of_walk hS hs hY Z hlen ?_ hab ?_ hsh ?_, + subset_union_left, subset_union_right.trans subset_union_right⟩, hlink⟩ + · intro z hz + rcases (hUZ z).mp hz with h | h | h | h + · exact Or.inl (hP.U_sub (hZ₁ ▸ h)) + · exact Or.inr (Or.inl h) + · exact Or.inr (Or.inr (hQ.U_sub (hZ₂ ▸ h))) + · exact Or.inr (Or.inl h) + · refine union_subset (hP.sub_ins.trans (insOf_mono hs₁)) + (union_subset (hFZ.trans subset_union_left) (hQ.sub_ins.trans (insOf_mono hs₂))) + · exact union_subset hP.subY (union_subset (hFfr.trans hY.isClosed.frontier_subset) hQ.subY) + +include hS in +/-- The case of (9.2) with two disjoint pieces: the two segments of the perimeter walk from `A` to +`B`, and the shorter of them gives the line. The paper takes the segments minimizing the total +length. +We only need that they do not overlap and that each meets `A ∪ B` at its ends only. -/ +private theorem tie_of_disjoint (hs : IsSlope Γ k ins) (hY : IsRestraint Γ ins k Y) {A B : Set S} + {G H : Drawing S} (hP : IsPiece Γ ins k Y A G) (hQ : IsPiece Γ ins k Y B H) + (hAB : Disjoint A B) : + (∃ X, (IsTie Γ ins k X ∧ X ⊆ Y ∧ perimeterWalkLength Γ X ≤ perimeterWalkLength Γ Y) ∧ A ⊆ X + ∧ B ⊆ X) ∧ + IsPieceLink Γ Y G H := by + classical + obtain ⟨u, W, -, -, -, hcnt, hdraw⟩ := hY.exists_walk hS + have hGΓ : G.IsSubdrawing Γ := hP.sub.trans interSet_isSub + have hHΓ : H.IsSubdrawing Γ := hQ.sub.trans interSet_isSub + have hVW : ∀ {x}, x ∈ (Γ.interSet (frontier Y)).V → x ∈ W.support := fun {x} hx => by + rw [← hdraw, walkDrawing_V] at hx + exact hx + obtain ⟨a₀, ha₀⟩ := hP.Vne + obtain ⟨b₀, hb₀⟩ := hQ.Vne + have ha₀A : a₀ ∈ A := hP.U_sub (G.V_subset_U ha₀) + have hb₀B : b₀ ∈ B := hQ.U_sub (H.V_subset_U hb₀) + obtain ⟨P₁, P₂, hW⟩ := W.exists_append_of_mem (hVW (hP.sub.1 ha₀)) + have hb₁ : b₀ ∈ (P₂.append P₁).support := by + have h := hVW (hQ.sub.1 hb₀) + rw [hW] at h + exact (GraphWalk.mem_support_append _ _).mpr ((GraphWalk.mem_support_append _ _).mp h).symm + obtain ⟨Q₁, Q₂, hR⟩ := (P₂.append P₁).exists_append_of_mem hb₁ + have hsupp : ∀ {x}, x ∈ Q₁.support ∨ x ∈ Q₂.support → x ∈ W.support := fun {x} h => by + have h₁ : x ∈ (P₂.append P₁).support := by + rw [hR] + exact (GraphWalk.mem_support_append _ _).mpr h + rw [hW] + exact (GraphWalk.mem_support_append _ _).mpr ((GraphWalk.mem_support_append _ _).mp h₁).symm + have hcountW : ∀ e, edgeCount Q₁.edges e + edgeCount Q₂.edges e = edgeCount W.edges e := fun e + => by + have h₁ : (P₂.append P₁).edges = Q₁.edges ++ Q₂.edges := by rw [hR, GraphWalk.edges_append] + have h₂ : W.edges = P₁.edges ++ P₂.edges := by rw [hW, GraphWalk.edges_append] + rw [GraphWalk.edges_append] at h₁ + have h₃ := congrArg (fun l => List.count e l) h₁ + simp only [List.count_append] at h₃ + rw [h₂] + simp only [edgeCount, List.count_append] + omega + obtain ⟨a₁, ha₁, b₁, hb₁', T₁, hT₁, hT₁s, hT₁A, hT₁B⟩ := exists_crossing A B Q₁ ha₀A hb₀B + obtain ⟨a₂, ha₂, b₂, hb₂', T₂, hT₂, hT₂s, hT₂A, hT₂B⟩ := exists_crossing A B Q₂.reverse ha₀A hb₀B + obtain ⟨S₁, hS₁, hS₁s, hS₁e⟩ := GraphWalk.exists_isSimple T₁ + obtain ⟨S₂, hS₂, hS₂s, hS₂e⟩ := GraphWalk.exists_isSimple T₂ + have hc₁ : ∀ e, edgeCount S₁.edges e ≤ edgeCount Q₁.edges e := fun e => by + have h₁ := hT₁.count_le e + by_cases he : e ∈ S₁.edges + · have h₂ : edgeCount S₁.edges e = 1 := by + unfold edgeCount + convert List.count_eq_one_of_mem hS₁.edges_nodup he + have h₃ : 0 < T₁.edges.count e := List.count_pos_iff.mpr (hS₁e e he) + unfold edgeCount at h₂ ⊢ + convert_to _ ≤ Q₁.edges.count e + omega + · rw [edgeCount_eq_zero he] + exact Nat.zero_le _ + have hc₂ : ∀ e, edgeCount S₂.edges e ≤ edgeCount Q₂.edges e := fun e => by + have h₁ := hT₂.count_le e + rw [GraphWalk.edges_reverse, List.count_reverse] at h₁ + by_cases he : e ∈ S₂.edges + · have h₂ : edgeCount S₂.edges e = 1 := by + unfold edgeCount + convert List.count_eq_one_of_mem hS₂.edges_nodup he + have h₃ : 0 < T₂.edges.count e := List.count_pos_iff.mpr (hS₂e e he) + unfold edgeCount at h₂ ⊢ + convert_to _ ≤ Q₂.edges.count e + omega + · rw [edgeCount_eq_zero he] + exact Nat.zero_le _ + have hs₁W : ∀ {x}, x ∈ S₁.support → x ∈ W.support := fun {x} h => hsupp (Or.inl (hT₁s x + (hS₁s x h))) + have hs₂W : ∀ {x}, x ∈ S₂.support → x ∈ W.support := fun {x} h => hsupp (Or.inr (by + have := hT₂s x (hS₂s x h) + rw [GraphWalk.support_reverse] at this + exact List.mem_reverse.mp this)) + have hsubW : ∀ {c d : S} (R : GraphWalk Γ.toGraph c d), (∀ x ∈ R.support, x ∈ W.support) → + (∀ e ∈ R.edges, e ∈ W.edges) → (walkDrawing Γ R).IsSubdrawing (Γ.interSet (frontier Y)) := by + intro c d R h₁ h₂ + have := walkDrawing_mono (Z := R) (Z' := W) h₁ h₂ + rwa [hdraw] at this + have hedW : ∀ e, 0 < edgeCount Q₁.edges e ∨ 0 < edgeCount Q₂.edges e → e ∈ W.edges := fun e h + => by + have h₁ := hcountW e + have h₂ : 0 < edgeCount W.edges e := by omega + by_contra hn + rw [edgeCount_eq_zero hn] at h₂ + omega + have hposn : ∀ {l : List (Set S)} {e}, e ∈ l → 0 < edgeCount l e := fun {l e} h => by + unfold edgeCount + exact List.count_pos_iff.mpr h + have hs₁E : ∀ e ∈ S₁.edges, e ∈ W.edges := fun e he => + hedW e (Or.inl ((hposn he).trans_le (hc₁ e))) + have hs₂E : ∀ e ∈ S₂.edges, e ∈ W.edges := fun e he => + hedW e (Or.inr ((hposn he).trans_le (hc₂ e))) + have hsub₁ := hsubW S₁ (fun x h => hs₁W h) hs₁E + have hsub₂ := hsubW S₂ (fun x h => hs₂W h) hs₂E + have hend : ∀ {T : Set S} {K : Drawing S} {x : S}, IsPiece Γ ins k Y T K → x ∈ T → x ∈ W.support + → x ∈ K.V := by + intro T K x hR hxT hx + have hxV : x ∈ (walkDrawing Γ W).V := by + rw [walkDrawing_V] + exact hx + rw [hdraw] at hxV + have hxf : x ∈ frontier Y := + interSet_U_subset isClosed_frontier ((Γ.interSet (frontier Y)).V_subset_U hxV) + have hxU : x ∈ K.U := by + by_contra hn + exact hxf.2 (hR.rest ⟨hxT, hn⟩) + exact mem_V_of_mem_U (hR.sub.trans interSet_isSub) hxU ((interSet_isSub (Γ := Γ)).1 hxV) + have hoffA : ∀ {a b : S} {R : GraphWalk Γ.toGraph a b} {T : Set S} {c : S}, IsPiece Γ ins k Y T G + → R.IsSimple → + (∀ x ∈ R.support, x ∈ T → x = c) → ∀ e ∈ R.edges, e ∉ G.E := by + intro a b R T c hR hs' hO e he hG + exact edge_off hs' hO he ((G.closure_subset_U hG).trans hR.U_sub) + have hoffB : ∀ {a b : S} {R : GraphWalk Γ.toGraph a b} {T : Set S} {c : S}, IsPiece Γ ins k Y T H + → R.IsSimple → + (∀ x ∈ R.support, x ∈ T → x = c) → ∀ e ∈ R.edges, e ∉ H.E := by + intro a b R T c hR hs' hO e he hG + exact edge_off hs' hO he ((H.closure_subset_U hG).trans hR.U_sub) + have hO₁A : ∀ x ∈ S₁.support, x ∈ A → x = a₁ := fun x h => hT₁A x (hS₁s x h) + have hO₁B : ∀ x ∈ S₁.support, x ∈ B → x = b₁ := fun x h => hT₁B x (hS₁s x h) + have hO₂A : ∀ x ∈ S₂.support, x ∈ A → x = a₂ := fun x h => hT₂A x (hS₂s x h) + have hO₂B : ∀ x ∈ S₂.support, x ∈ B → x = b₂ := fun x h => hT₂B x (hS₂s x h) + rcases le_total S₁.length S₂.length with hle | hle + · refine tie_of_line hS hs hY hP hQ hAB (hend hP ha₁ (hs₁W S₁.start_mem_support)) + (hend hQ hb₁' (hs₁W S₁.end_mem_support)) S₁ hS₁ hO₁A hO₁B hsub₁ (L := S₂.edges) + (by rwa [edges_length]) (fun e he => mem_E_of_mem_edges S₂ he) + (fun e he => ⟨hoffA hP hS₂ hO₂A e he, hoffB hQ hS₂ hO₂B e he⟩) fun e he => ?_ + rw [← hcnt e he, ← hcountW] + exact Nat.add_le_add (hc₁ e) (hc₂ e) + · refine tie_of_line hS hs hY hP hQ hAB (hend hP ha₂ (hs₂W S₂.start_mem_support)) + (hend hQ hb₂' (hs₂W S₂.end_mem_support)) S₂ hS₂ hO₂A hO₂B hsub₂ (L := S₁.edges) + (by rwa [edges_length]) (fun e he => mem_E_of_mem_edges S₁ he) + (fun e he => ⟨hoffA hP hS₁ hO₁A e he, hoffB hQ hS₁ hO₁B e he⟩) fun e he => ?_ + rw [← hcnt e he, ← hcountW, add_comm] + exact Nat.add_le_add (hc₁ e) (hc₂ e) + +include hS in +/-- The proof of (9.2) of Graph Minors XI: either one piece holds `a` and `b`, or there are two +pieces, joined inside the budget +of `Y`. -/ +theorem exists_pieces (hs : IsSlope Γ k ins) {a b : Set S} (ha : a ∈ Γ.A) (hb : b ∈ Γ.A) + (hY : IsRestraint Γ ins k Y) (haY : a ⊆ Y) (hbY : b ⊆ Y) : + (∃ A G, IsPiece Γ ins k Y A G ∧ a ⊆ A ∧ b ⊆ A) ∨ + ∃ A G B H, IsPiece Γ ins k Y A G ∧ IsPiece Γ ins k Y B H ∧ a ⊆ A ∧ b ⊆ B ∧ + (∃ X, (IsTie Γ ins k X ∧ X ⊆ Y ∧ perimeterWalkLength Γ X ≤ perimeterWalkLength Γ Y) ∧ A ⊆ X + ∧ B ⊆ X) ∧ + IsPieceLink Γ Y G H := by + obtain ⟨A, G, hP, haA⟩ := exists_piece hS hs hY ha haY + obtain ⟨B, H, hQ, hbB⟩ := exists_piece hS hs hY hb hbY + have hfinish : ((∃ X, (IsTie Γ ins k X ∧ X ⊆ Y ∧ perimeterWalkLength Γ X + ≤ perimeterWalkLength Γ Y) ∧ A ⊆ X ∧ B ⊆ X) ∧ + IsPieceLink Γ Y G H) → ∃ A G B H, IsPiece Γ ins k Y A G ∧ IsPiece Γ ins k Y B H ∧ a ⊆ A + ∧ b ⊆ B ∧ + (∃ X, (IsTie Γ ins k X ∧ X ⊆ Y ∧ perimeterWalkLength Γ X ≤ perimeterWalkLength Γ Y) ∧ A ⊆ X + ∧ B ⊆ X) ∧ + IsPieceLink Γ Y G H := fun h => ⟨A, G, B, H, hP, hQ, haA, hbB, h.1, h.2⟩ + have hGΓ : G.IsSubdrawing Γ := hP.sub.trans interSet_isSub + have hHΓ : H.IsSubdrawing Γ := hQ.sub.trans interSet_isSub + by_cases h₁ : ∃ x, x ∈ A ∧ x ∉ G.U ∧ x ∈ B ∧ x ∉ H.U + · obtain ⟨x, hxA, hxG, hxB, hxH⟩ := h₁ + have hAB : A = B := Subset.antisymm (star_subset hS hs hY hP hQ hxA hxG hxB hxH) + (star_subset hS hs hY hQ hP hxB hxH hxA hxG) + subst hAB + exact Or.inl ⟨A, G, hP, haA, hbB⟩ + push Not at h₁ + have hin : ∀ {x}, x ∈ A → x ∈ B → x ∈ G.U ∧ x ∈ H.U := fun {x} hxA hxB => by + have hfr : ∀ {D : Drawing S}, D.IsSubdrawing (Γ.interSet (frontier Y)) → x ∈ D.U + → x ∈ frontier Y := + fun hD hx => interSet_U_subset isClosed_frontier (hD.U_subset hx) + by_cases hxG : x ∈ G.U + · refine ⟨hxG, ?_⟩ + by_contra hxH + exact (hfr hP.sub hxG).2 (hQ.rest ⟨hxB, hxH⟩) + · by_cases hxH : x ∈ H.U + · exact ((hfr hQ.sub hxH).2 (hP.rest ⟨hxA, hxG⟩)).elim + · exact (hxH (h₁ x hxA hxG hxB)).elim + by_cases h₂ : ∃ x y, x ≠ y ∧ x ∈ A ∧ x ∈ B ∧ y ∈ A ∧ y ∈ B + · obtain ⟨x, y, hxy, hxA, hxB, hyA, hyB⟩ := h₂ + obtain ⟨X, K, hK, hAX, hBX⟩ := piece_of_two_points hS hs hY hP hQ hxy (hin hxA hxB).1 + (hin hxA hxB).2 + (hin hyA hyB).1 (hin hyA hyB).2 + exact Or.inl ⟨X, K, hK, haA.trans hAX, hbB.trans hBX⟩ + push Not at h₂ + by_cases h₃ : (A ∩ B).Nonempty + · obtain ⟨p, hpA, hpB⟩ := h₃ + have hdis : ∀ e ∈ G.E, e ∉ H.E := by + intro e he₁ he₂ + obtain ⟨q, q', hl⟩ := (G.toGraph.edge_mem_iff_exists_isLink e).mp he₁ + have hq : q ∈ closure e ∩ G.V := by rw [hl.2.2.2]; simp + obtain ⟨z, hz⟩ := (hGΓ.2 he₁).1 + have hzq : z ≠ q := fun h => edge_notMem_V (hGΓ.2 he₁) hz (hGΓ.1 (h ▸ hq.2)) + have hm₁ : ∀ {w}, w ∈ closure e → w ∈ A ∧ w ∈ B := fun hw => + ⟨hP.U_sub (G.closure_subset_U he₁ hw), hQ.U_sub (H.closure_subset_U he₂ hw)⟩ + exact h₂ z q hzq (hm₁ (subset_closure hz)).1 (hm₁ (subset_closure hz)).2 (hm₁ hq.1).1 + (hm₁ hq.1).2 + have hAB : A ∩ B = {p} := by + refine Subset.antisymm ?_ (singleton_subset_iff.mpr ⟨hpA, hpB⟩) + rintro x ⟨hxA, hxB⟩ + by_contra hxp + exact h₂ x p hxp hxA hxB hpA hpB + obtain ⟨hpG, hpH⟩ := hin hpA hpB + rcases U_inter_cases hGΓ hHΓ hpG hpH with ⟨h₄, h₅⟩ | ⟨e, he₁, he₂, -⟩ + · exact Or.inr <| hfinish (tie_of_one_point hS hs hY hP hQ h₄ h₅ hAB hdis) + · exact (hdis e he₁ he₂).elim + · exact Or.inr <| hfinish (tie_of_disjoint hS hs hY hP hQ + (disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp h₃))) + + +include hS in +/-- **(9.2)** of Graph Minors XI (page 105): "Let $a, b \in A(\Gamma)$ and let $Y$ be a restraint +with $a, b \subseteq Y$. Then there is a +tie $X$ with $a, b \subseteq X \subseteq Y$ and $l(X) \le l(Y)$." -/ +theorem theorem_9_2_proof (hs : IsSlope Γ k ins) {a b : Set S} (ha : a ∈ Γ.A) (hb : b ∈ Γ.A) + (hY : IsRestraint Γ ins k Y) (haY : a ⊆ Y) (hbY : b ⊆ Y) : + ∃ X, IsTie Γ ins k X ∧ a ⊆ X ∧ b ⊆ X ∧ X ⊆ Y ∧ + perimeterWalkLength Γ X ≤ perimeterWalkLength Γ Y := by + rcases exists_pieces hS hs ha hb hY haY hbY with ⟨A, G, hP, haA, hbA⟩ | ⟨A, G, B, H, -, -, haA, + hbB, ⟨X, h⟩, -⟩ + · obtain ⟨h₁, h₂, h₃⟩ := tie_of_piece hS hs hY hP + exact ⟨A, h₁, haA, hbA, h₂, h₃⟩ + · exact ⟨X, h.1.1, haA.trans h.2.1, hbB.trans h.2.2, h.1.2.1, h.1.2.2⟩ +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Separate.lean b/LeanPool/GraphMinor/GM11/Separate.lean new file mode 100644 index 0000000000..895a57810d --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Separate.lean @@ -0,0 +1,181 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section5c +public import LeanPool.GraphMinor.GM11.Section6 +public import LeanPool.GraphMinor.GM11.ForestRegions +public import LeanPool.GraphMinor.Surface.SphereDisc +public import LeanPool.GraphMinor.Surface.DiscGrow +public import LeanPool.GraphMinor.GM11.RadialBasics +public import LeanPool.GraphMinor.GM11.DrawingTopology + +/-! +# Points that a drawing in a sphere does not separate + +`IsCircuit.isOArc_U` says that the point set of a circuit is an `O`-arc. `same_region_of_discs` is +the main +result: if every `O`-arc of a drawing in a sphere bounds a disc in a set `Q`, then the points +outside `Q` +lie in one region. This is the part of (7.6) of Graph Minors XI needed for a perimeter walk: the +paper gets +it from Graph Minors VII, (11.10), for a surface with two holes. We use circuits of `N(Z)` instead. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +variable [ConnectedSpace S] + +/-- **Two points outside `Q`.** If every `O`-arc of a drawing `M` in a sphere bounds a disc inside a +set +`Q ⊇ U(M)`, then any two points outside `Q` lie in one region of `M`. -/ +theorem same_region_of_discs (hS : IsClosedSurface S) (hsph : IsSphere S) {Q : Set S} {a b : S} + (ha : a ∉ Q) (hb : b ∉ Q) : + ∀ (k : ℕ) (M : Drawing S), M.E.ncard = k → M.U ⊆ Q → + (∀ F, IsOArc F → F ⊆ M.U → ∃ Δ, IsClosedDisc Δ ∧ Δ ⊆ Q ∧ discBd Δ = F) → + ∃ r ∈ M.R, a ∈ r ∧ b ∈ r := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + intro k + induction k using Nat.strong_induction_on with + | _ k ih => + intro M hk hMQ hdisc + have haU : a ∉ M.U := fun h => ha (hMQ h) + have hbU : b ∉ M.U := fun h => hb (hMQ h) + obtain ⟨p, hp, hap⟩ := exists_region_of_notMem haU + obtain ⟨q, hq, hbq⟩ := exists_region_of_notMem hbU + by_cases hpq : p = q + · exact ⟨p, hp, hap, hpq ▸ hbq⟩ + exfalso + by_cases hcirc : ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing M + swap + · push Not at hcirc + exact hpq (region_eq_of_noCircuit hS (fun C h₁ h₂ => hcirc C h₁ h₂) hp hq) + obtain ⟨C₀, hC₀, hC₀s⟩ := hcirc + obtain ⟨e, he₀⟩ := IsCircuit.E_nonempty hC₀ + have he : e ∈ M.E := hC₀s.2 he₀ + -- Delete `e`: the two points are then in one region. + have hlt : (M.deleteEdge e).E.ncard < k := by + rw [deleteEdge_E, ← hk] + exact ncard_lt_ncard (sdiff_singleton_ssubset.mpr he) M.finite_edges + have hsubD := deleteEdge_isSubdrawing M e + obtain ⟨r', hr', har', hbr'⟩ := ih _ hlt (M.deleteEdge e) rfl (hsubD.U_subset.trans hMQ) + fun F hF hFU => hdisc F hF (hFU.trans hsubD.U_subset) + have hinc : ∀ {p₁ p₂ : Set S} {x y : S}, p₁ ∈ M.R → p₂ ∈ M.R → p₁ ≠ p₂ → x ∈ p₁ → y ∈ p₂ → + x ∈ r' → y ∈ r' → (e ∩ closure p₁).Nonempty := by + intro p₁ p₂ x y h₁ h₂ hne hx hy hxr hyr + by_contra hdis + have hdisj : Disjoint e (closure p₁) := disjoint_iff_inter_eq_empty.mpr + (not_nonempty_iff_eq_empty.mp hdis) + have hreg := region_deleteEdge_of_not_incident he h₁ hdisj + obtain rfl := region_eq_of_mem hreg hr' hx hxr + exact hne (region_eq_of_mem h₁ h₂ hyr hy) + have hincp := hinc hp hq hpq hap hbq har' hbr' + have hincq := hinc hq hp (Ne.symm hpq) hbq hap hbr' har' + have hp₁ : M.EdgeRegionIncident e p := ⟨he, hp, hincp⟩ + have hq₁ : M.EdgeRegionIncident e q := ⟨he, hq, hincq⟩ + have heN : e ∈ (boundaryDrawing M {p}).E := mem_boundaryDrawing_E.mpr + ⟨⟨p, rfl, hp₁⟩, q, ⟨hq, fun h => hpq (mem_singleton_iff.mp h).symm⟩, hq₁⟩ + obtain ⟨C, hC, hCN, heC⟩ := exists_circuit_N hS {p} e heN + have hCM : C.IsSubdrawing M := hCN.trans (Drawing.span_isSubdrawing M _ _) + have hF := IsCircuit.isOArc_U hC + obtain ⟨Δ₁, Δ₂, -, hΔ₁, hΔ₂, hb₁, hb₂, hcup, hcap, -, huniq⟩ := sphere_disc S hsph C.U hF + have hint₁ := IsClosedDisc.isOpen_discInt hman hΔ₁ + have hint₂ := IsClosedDisc.isOpen_discInt hman hΔ₂ + have hdint : Disjoint (discInt Δ₁) (discInt Δ₂) := by + refine disjoint_left.mpr ?_ + rintro x ⟨h₁, h₂⟩ ⟨h₃, -⟩ + exact h₂ (by + rw [hb₁, ← hcap] + exact ⟨h₁, h₃⟩) + have hcover : (C.U)ᶜ ⊆ discInt Δ₁ ∪ discInt Δ₂ := by + intro x hx + have hxu : x ∈ Δ₁ ∪ Δ₂ := hcup ▸ mem_univ x + rcases hxu with h | h + · exact Or.inl ⟨h, by rwa [hb₁]⟩ + · exact Or.inr ⟨h, by rwa [hb₂]⟩ + have hsplit : ∀ t ∈ M.R, t ⊆ discInt Δ₁ ∨ t ⊆ discInt Δ₂ := by + intro t ht + have hdisU : t ⊆ (C.U)ᶜ := fun x hx hxC => region_subset ht hx (hCM.U_subset hxC) + exact (region_isPreconnected ht).subset_or_subset hint₁ hint₂ + hdint (hdisU.trans hcover) + obtain ⟨y, hye⟩ := he.1 + have hyF : y ∈ C.U := C.closure_subset_U heC (subset_closure hye) + obtain ⟨W, A₁, A₂, hW, hyW, hWU, hWcov, c₁, c₂, d₁, d₂, h₁, h₂⟩ := + exists_edge_sides hS M he hye + -- Each side lies in `p` or `q`, and all points near `y` off `U(M)` lie in `p ∪ q`. + have hyp : y ∈ closure p := edge_subset_closure_of_incident hS he hp hincp hye + have hyq : y ∈ closure q := edge_subset_closure_of_incident hS he hq hincq hye + obtain ⟨u₁, huW, hup⟩ := mem_closure_iff.mp hyp W hW hyW + obtain ⟨u₂, huW', huq⟩ := mem_closure_iff.mp hyq W hW hyW + have hreg : ∀ {A : Set S}, IsPreconnected A → Disjoint A M.U → ∀ {x}, x ∈ A → x ∈ p → A ⊆ p := + fun hA hd _ hx hxp => subset_region hp hA hd hx hxp + have hreg' : ∀ {A : Set S}, IsPreconnected A → Disjoint A M.U → ∀ {x}, x ∈ A → x ∈ q → A ⊆ q := + fun hA hd _ hx hxp => subset_region hq hA hd hx hxp + have hnear : W \ M.U ⊆ p ∪ q := by + have hupU : u₁ ∈ W \ M.U := ⟨huW, region_subset hp hup⟩ + have huqU : u₂ ∈ W \ M.U := ⟨huW', region_subset hq huq⟩ + have hdis : Disjoint p q := by + refine disjoint_left.mpr fun x hxp hxq => hpq (region_eq_of_mem hp hq hxp hxq) + rcases hWcov hupU with a₁ | a₁ <;> rcases hWcov huqU with a₂ | a₂ + · have hs := hreg c₁ d₁ a₁ hup + exact (disjoint_left.mp hdis (hs a₂) huq).elim + · have hs₁ := hreg c₁ d₁ a₁ hup + have hs₂ := hreg' c₂ d₂ a₂ huq + exact fun x hx => (hWcov hx).elim (fun h => Or.inl (hs₁ h)) fun h => Or.inr (hs₂ h) + · have hs₁ := hreg c₂ d₂ a₁ hup + have hs₂ := hreg' c₁ d₁ a₂ huq + exact fun x hx => (hWcov hx).elim (fun h => Or.inr (hs₂ h)) fun h => Or.inl (hs₁ h) + · have hs := hreg c₂ d₂ a₁ hup + exact (disjoint_left.mp hdis (hs a₂) huq).elim + -- Near `y` there are points inside each of the two discs. + have hnearInt : ∀ {Δ : Set S}, IsClosedDisc Δ → discBd Δ = C.U → ∃ z ∈ discInt Δ, z ∈ p ∪ q + := by + intro Δ hΔ hbd + have hyΔ : y ∈ Δ := discBd_subset Δ (hbd ▸ hyF) + obtain ⟨w, hwW, hwI⟩ := mem_closure_iff.mp (IsClosedDisc.subset_closure_discInt hΔ hyΔ) W hW + hyW + obtain ⟨z, ⟨hzW, hzI⟩, hzU⟩ := exists_notMem_U (Γ := M) hS + (hW.inter (IsClosedDisc.isOpen_discInt hman hΔ)) ⟨w, hwW, hwI⟩ + exact ⟨z, hzI, hnear ⟨hzW, hzU⟩⟩ + obtain ⟨z₁, hz₁, hz₁r⟩ := hnearInt hΔ₁ hb₁ + obtain ⟨z₂, hz₂, hz₂r⟩ := hnearInt hΔ₂ hb₂ + have hpart : (p ⊆ discInt Δ₁ ∧ q ⊆ discInt Δ₂) ∨ (p ⊆ discInt Δ₂ ∧ q ⊆ discInt Δ₁) := by + have hno : ∀ {t}, t ⊆ discInt Δ₁ → t ⊆ discInt Δ₂ → ∀ x ∈ t, False := fun h₃ h₄ x hx => + disjoint_left.mp hdint (h₃ hx) (h₄ hx) + rcases hsplit p hp with h₃ | h₃ <;> rcases hsplit q hq with h₄ | h₄ + · exfalso + rcases hz₂r with h₅ | h₅ + · exact disjoint_left.mp hdint (h₃ h₅) hz₂ + · exact disjoint_left.mp hdint (h₄ h₅) hz₂ + · exact Or.inl ⟨h₃, h₄⟩ + · exact Or.inr ⟨h₃, h₄⟩ + · exfalso + rcases hz₁r with h₅ | h₅ + · exact disjoint_left.mp hdint hz₁ (h₃ h₅) + · exact disjoint_left.mp hdint hz₁ (h₄ h₅) + obtain ⟨Δ, hΔ, hΔQ, hΔb⟩ := hdisc C.U hF hCM.U_subset + have hnot : ∀ {x}, x ∉ Q → x ∉ Δ := fun hx h => hx (hΔQ h) + rcases huniq Δ hΔ hΔb with rfl | rfl + · rcases hpart with ⟨h₃, -⟩ | ⟨-, h₃⟩ + · exact hnot ha (h₃ hap).1 + · exact hnot hb (h₃ hbq).1 + · rcases hpart with ⟨-, h₃⟩ | ⟨h₃, -⟩ + · exact hnot hb (h₃ hbq).1 + · exact hnot ha (h₃ hap).1 + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Solid.lean b/LeanPool/GraphMinor/GM11/Solid.lean new file mode 100644 index 0000000000..638dbfff39 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Solid.lean @@ -0,0 +1,444 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Corners +public import LeanPool.GraphMinor.GM11.LeafNbhd +public import LeanPool.GraphMinor.GM11.ForestRegions +public import LeanPool.GraphMinor.GM11.NiceSets +public import LeanPool.GraphMinor.GM11.DrawingOps +public import LeanPool.GraphMinor.GM11.Section5b +public import LeanPool.GraphMinor.Surface.ArcInPath + +/-! +# Closed nice sets are solid + +Graph Minors XI, Section 7 (page 93), applies Graph Minors VII, (11.10), to nice sets, and so it +needs them +to be solid. The paper does not say why they are. This file proves it (`isSolid_of_nice`). + +We show that a closed nice set `X` is connected in the small at each point `x`: points of `X` near +`x` are +joined to `x` by a path in `X` near `x` (`LocJoin`). It is enough to do this for the closure of each +vertex, +edge and region, since `X` is a finite union of these. The closure of an edge is a curve. At a +vertex of +degree at least two, the sectors of `exists_sectors` give straight paths into a region. At a vertex +of +degree at most one, a whole neighbourhood lies in the closure of the one region there. A point in an +edge +becomes a vertex after we add it, and this does not change the regions. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A closed surface is locally path-connected, because it is a quotient of a union of open discs. +-/ +theorem IsClosedSurface.locallyPathConnectedSpace (hS : IsClosedSurface S) : + LocallyPathConnectedSpace S := by + choose V hV hxV h using hS.2.2 + have hball : LocallyPathConnectedSpace OpenUnitDisc := + IsOpen.locallyPathConnectedSpace Metric.isOpen_ball + have hlp : ∀ x, LocallyPathConnectedSpace (V x) := fun x => by + obtain ⟨e⟩ := h x + exact e.symm.locallyPathConnectedSpace + let f : (Σ x, V x) → S := fun p => p.2.1 + have hf : Continuous f := continuous_sigma fun _ => continuous_subtype_val + have ho : IsOpenMap f := isOpenMap_sigma.mpr fun i => (hV i).isOpenEmbedding_subtypeVal.isOpenMap + exact (ho.isQuotientMap hf fun x => ⟨⟨x, x, hxV x⟩, rfl⟩).locallyPathConnectedSpace + +/-- Points of `Y` near `x` are joined to `x` by paths in `Y` near `x`. -/ +def LocJoin (Y : Set S) (x : S) : Prop := + ∀ A : Set S, IsOpen A → x ∈ A → ∃ N : Set S, IsOpen N ∧ x ∈ N ∧ ∀ y ∈ Y ∩ N, JoinedIn (Y ∩ A) x y + +/-- A curve is connected in the small. -/ +theorem locJoin_range [T2Space S] {f : I → S} (hf : Continuous f) {x : S} (hx : x ∈ range f) : + LocJoin (range f) x := by + have hlp : LocallyPathConnectedSpace I := + (IsQuotientMap.of_inverse continuous_subtype_val continuous_projIcc + (projIcc_val (zero_le_one' ℝ))).locallyPathConnectedSpace + intro A hA hxA + have hO : IsOpen (f ⁻¹' A) := hA.preimage hf + let T : Set I := ⋃ s ∈ f ⁻¹' {x}, pathComponentIn (f ⁻¹' A) s + have hT : IsOpen T := isOpen_biUnion fun s _ => hO.pathComponentIn s + have hK : IsClosed (f '' Tᶜ) := (hT.isClosed_compl.isCompact.image hf).isClosed + have hx' : x ∉ f '' Tᶜ := by + rintro ⟨t, ht, rfl⟩ + exact ht (mem_biUnion rfl (mem_pathComponentIn_self hxA)) + refine ⟨_, hK.isOpen_compl, hx', ?_⟩ + rintro y ⟨⟨t, rfl⟩, hy⟩ + have htT : t ∈ T := by + by_contra h + exact hy (mem_image_of_mem f h) + obtain ⟨s, hs, hst⟩ := mem_iUnion₂.mp htT + obtain rfl : f s = x := hs + have hj : JoinedIn (f ⁻¹' A) s t := hst + exact ⟨(hj.somePath).map hf, fun u => ⟨mem_range_self _, hj.somePath_mem u⟩⟩ + +/-- Connected in the small at every point gives locally arc-connected. -/ +theorem isLocallyArcConnected_of_locJoin [T2Space S] {X : Set S} (h : ∀ x ∈ X, LocJoin X x) : + IsLocallyArcConnected X := by + intro x hx A hA hxA + let C := pathComponentIn (X ∩ A) x + have hC : C ⊆ X ∩ A := pathComponentIn_subset + have hxC : x ∈ C := mem_pathComponentIn_self ⟨hx, hxA⟩ + choose! N hNo hNm hNj using fun c (hc : c ∈ C) => h c (hC hc).1 A hA (hC hc).2 + refine ⟨(⋃ c ∈ C, N c) ∩ A, inter_subset_right, ⟨mem_biUnion hxC (hNm x hxC), hxA⟩, + (isOpen_biUnion hNo).inter hA, ?_⟩ + have heq : X ∩ ((⋃ c ∈ C, N c) ∩ A) = C := by + apply subset_antisymm + · rintro y ⟨hyX, hyN, -⟩ + obtain ⟨c, hc, hyc⟩ := mem_iUnion₂.mp hyN + have h₁ : JoinedIn (X ∩ A) x c := hc + exact h₁.trans (hNj c hc y ⟨hyX, hyc⟩) + · intro y hy + obtain ⟨c, hc⟩ : ∃ c, y = c := ⟨y, rfl⟩ + exact ⟨(hC hy).1, mem_biUnion hy (hNm y hy), (hC hy).2⟩ + rw [heq] + intro a ha b hb hab + have hpc : IsPathConnected C := isPathConnected_pathComponentIn ⟨hx, hxA⟩ + have hj := hpc.joinedIn a ha b hb + obtain ⟨e, hec, hei, he0, he1, hsub⟩ := exists_arc_of_path (γ := hj.somePath) + hj.somePath.continuous + (by simpa using hab) + have hc : CompactSpace (range e) := isCompact_iff_compactSpace.mp (isCompact_range hec) + refine ⟨range e, ?_, ?_⟩ + · rintro _ ⟨t, rfl⟩ + obtain ⟨u, hu⟩ := hsub (mem_range_self t) + exact hu ▸ hj.somePath_mem u + · have hjb : Function.Bijective (rangeFactorization e) := + ⟨fun x y hxy => hei (congrArg Subtype.val hxy), rangeFactorization_surjective⟩ + refine ⟨(Continuous.subtype_mk hec _).homeoOfEquivCompactToT2 + (f := Equiv.ofBijective _ hjb), ?_, ?_⟩ + · exact he0.trans (by simp) + · exact he1.trans (by simp) + +/-- A point `x` on the boundary of a closed disc `Q` is reached from each interior point of `Q` near +`x` +by a straight path, in the chart of `Q`, that stays in the interior of `Q` and near `x`. -/ +theorem exists_disc_approach {Q : Set S} (hQ : IsClosedDisc Q) {x : S} + (hx : x ∈ discBd Q) {O : Set S} + (hO : IsOpen O) (hxO : x ∈ O) : + ∃ N : Set S, IsOpen N ∧ x ∈ N ∧ ∀ y ∈ N ∩ Q, y ∉ discBd Q → + ∃ p : Path x y, ∀ t, p t = x ∨ p t ∈ (O ∩ Q) \ discBd Q := by + obtain ⟨φ⟩ := id hQ + have hbd := disc_boundary Q φ + rw [hbd] at hx + obtain ⟨c, hc, rfl⟩ := hx + let G : ClosedUnitDisc → S := fun z => (φ z).1 + have hG : Continuous G := continuous_subtype_val.comp φ.continuous + have hGi : Function.Injective G := fun a b h => φ.injective (Subtype.ext h) + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp (hO.preimage hG) c hxO + have hopen : IsOpen (φ '' Metric.ball c δ) := φ.isOpenMap _ Metric.isOpen_ball + obtain ⟨N, hN, hNeq⟩ := isOpen_induced_iff.mp hopen + have hcN : G c ∈ N := by + have : φ c ∈ Subtype.val ⁻¹' N := hNeq ▸ mem_image_of_mem φ (Metric.mem_ball_self hδ) + exact this + refine ⟨N, hN, hcN, ?_⟩ + rintro y ⟨hyN, hyQ⟩ hyb + have hmem : (⟨y, hyQ⟩ : Q) ∈ φ '' Metric.ball c δ := hNeq ▸ hyN + obtain ⟨p, hp, hpy⟩ := hmem + have hpy' : G p = y := congrArg Subtype.val hpy + have hc1 : ‖c.1‖ = 1 := by simpa [UnitCircle] using hc + have hp1 : ‖p.1‖ < 1 := by + have hle : ‖p.1‖ ≤ 1 := by simpa [ClosedUnitDisc] using p.2 + refine lt_of_le_of_ne hle fun h => hyb ?_ + rw [hbd] + exact ⟨p, by simpa [UnitCircle] using h, hpy'⟩ + have hnorm : ∀ t : I, ‖(1 - t.1) • c.1 + t.1 • p.1‖ ≤ (1 - t.1) + t.1 * ‖p.1‖ := by + intro t + have h₁ : 0 ≤ 1 - t.1 := by linarith [t.2.2] + calc ‖(1 - t.1) • c.1 + t.1 • p.1‖ ≤ ‖(1 - t.1) • c.1‖ + ‖t.1 • p.1‖ := norm_add_le _ _ + _ = (1 - t.1) + t.1 * ‖p.1‖ := by + rw [norm_smul, norm_smul, hc1, Real.norm_of_nonneg h₁, Real.norm_of_nonneg t.2.1, mul_one] + let seg : I → ClosedUnitDisc := fun t => ⟨(1 - t.1) • c.1 + t.1 • p.1, by + have h₂ := hnorm t + have h₃ : t.1 * ‖p.1‖ ≤ t.1 := by nlinarith [t.2.1, t.2.2] + have : ‖(1 - t.1) • c.1 + t.1 • p.1‖ ≤ 1 := by linarith + simpa [ClosedUnitDisc] using this⟩ + have hseg : Continuous seg := by + refine Continuous.subtype_mk ?_ _ + fun_prop + have hs0 : seg 0 = c := Subtype.ext (by simp [seg]) + have hs1 : seg 1 = p := Subtype.ext (by simp [seg]) + have hdist : ∀ t, seg t ∈ Metric.ball c δ := by + intro t + have hp' : dist p c < δ := hp + rw [Metric.mem_ball, Subtype.dist_eq] + have heq : (seg t).1 - c.1 = t.1 • (p.1 - c.1) := by + change (1 - t.1) • c.1 + t.1 • p.1 - c.1 = _ + rw [smul_sub, sub_smul, one_smul] + abel + rw [dist_eq_norm, heq, norm_smul, Real.norm_of_nonneg t.2.1, ← dist_eq_norm, ← Subtype.dist_eq] + nlinarith [t.2.1, t.2.2, dist_nonneg (x := p) (y := c)] + subst hpy' + let P : Path (G c) (G p) := ⟨⟨fun t => G (seg t), hG.comp hseg⟩, by simp [hs0], by simp [hs1]⟩ + refine ⟨P, fun t => ?_⟩ + by_cases ht : t = 0 + · left + subst ht + exact P.source + right + refine ⟨⟨hball (hdist t), (φ (seg t)).2⟩, fun hin => ?_⟩ + rw [hbd] at hin + obtain ⟨z, hz, hzs⟩ := hin + have hzeq : z = seg t := hGi hzs + have hz1 : ‖(seg t).1‖ = 1 := by + rw [← hzeq] + simpa [UnitCircle] using hz + have htpos : 0 < t.1 := lt_of_le_of_ne t.2.1 fun h => ht (Subtype.ext h.symm) + have h₄ := hnorm t + have h₅ : ‖(seg t).1‖ = ‖(1 - t.1) • c.1 + t.1 • p.1‖ := rfl + nlinarith + +variable [T2Space S] [ConnectedSpace S] + +omit [ConnectedSpace S] in +/-- The closure of an edge is connected in the small. -/ +theorem locJoin_edge {Γ : Drawing S} {e : Set S} (he : e ∈ Γ.E) {γ : Set S → I → S} + (hγ : EdgePar Γ γ) + {x : S} (hx : x ∈ closure e) : LocJoin (closure e) x := by + have hcl : closure e = range (γ e) := by + apply subset_antisymm + · refine closure_minimal ?_ (isCompact_range (hγ.cont e he)).isClosed + intro y hy + obtain ⟨t, -, rfl⟩ := (hγ.image e he).superset hy + exact mem_range_self t + · rintro _ ⟨t, rfl⟩ + have ht : t ∈ closure (Ioo (0 : I) 1) := by + rw [closure_Ioo (zero_ne_one' I)] + exact ⟨t.2.1, t.2.2⟩ + have := image_closure_subset_closure_image (hγ.cont e he) (mem_image_of_mem _ ht) + rwa [hγ.image e he] at this + rw [hcl] at hx ⊢ + exact locJoin_range (hγ.cont e he) hx + +omit [ConnectedSpace S] in +/-- At a vertex with at most one half-edge, a whole neighbourhood lies in the closure of each region +that has the vertex in its closure. -/ +theorem exists_nbhd_of_few (hS : IsClosedSurface S) {Γ : Drawing S} {γ : Set S → I → S} + (hγ : EdgePar Γ γ) {x : S} (hxV : x ∈ Γ.V) (h2 : ¬ 2 ≤ Nat.card (halfEdges Γ γ x)) {r : Set S} + (hr : r ∈ Γ.R) (hxr : x ∈ closure r) : ∃ Z : Set S, IsOpen Z ∧ x ∈ Z ∧ Z ⊆ closure r := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hfin : Finite (halfEdges Γ γ x) := (finite_halfEdges Γ γ x).to_subtype + have hss : Subsingleton (halfEdges Γ γ x) := + Finite.card_le_one_iff_subsingleton.mp (by omega) + have key : ∃ Z : Set S, IsOpen Z ∧ x ∈ Z ∧ ∀ a ∈ Z, a ∉ Γ.U → ∀ b ∈ Z, b ∉ Γ.U → + ∃ A : Set S, IsPreconnected A ∧ Disjoint A Γ.U ∧ a ∈ A ∧ b ∈ A := by + rcases isEmpty_or_nonempty (halfEdges Γ γ x) with h0 | ⟨⟨k⟩⟩ + · have hno : ∀ g ∈ Γ.E, x ∉ closure g := by + intro g hg hxg + obtain ⟨b, hb⟩ := exists_end_eq hγ hg hxV hxg + exact h0.false ⟨(g, b), hg, hb⟩ + have hop : IsOpen (Γ.U \ {x})ᶜ := by + have hcl : IsClosed (Γ.U \ {x}) := by + have heq : Γ.U \ {x} = (Γ.V \ {x}) ∪ ⋃ g ∈ Γ.E, closure g := by + ext y + rw [Γ.U_eq] + constructor + · rintro ⟨hy | hy, hyx⟩ + · exact Or.inl ⟨hy, hyx⟩ + · exact Or.inr hy + · rintro (⟨hy, hyx⟩ | hy) + · exact ⟨Or.inl hy, hyx⟩ + · refine ⟨Or.inr hy, fun h => ?_⟩ + obtain ⟨g, hg, hyg⟩ := mem_iUnion₂.mp hy + exact hno g hg (mem_singleton_iff.mp h ▸ hyg) + rw [heq] + exact (Γ.finite_V.subset sdiff_subset).isClosed.union + (Γ.finite_edges.isClosed_biUnion fun _ _ => isClosed_closure) + exact hcl.isOpen_compl + obtain ⟨Z, hZ, hxZ, hZO, hconn, -⟩ := exists_punctured_nbhd hS hop (by + rintro ⟨-, h⟩ + exact h rfl) + have hoff : Disjoint (Z \ {x}) Γ.U := disjoint_left.mpr fun y hy hyU => + hZO hy.1 ⟨hyU, hy.2⟩ + refine ⟨Z, hZ, hxZ, fun a ha hau b hb hbu => ⟨Z \ {x}, hconn, hoff, ⟨ha, ?_⟩, ⟨hb, ?_⟩⟩⟩ + · exact fun h => hau (mem_singleton_iff.mp h ▸ Γ.V_subset_U hxV) + · exact fun h => hbu (mem_singleton_iff.mp h ▸ Γ.V_subset_U hxV) + · obtain ⟨Z, hZ, hxZ, h⟩ := exists_single_nbhd hS hγ k fun l => Subsingleton.elim l k + refine ⟨Z, hZ, hxZ, fun a ha hau b hb hbu => ?_⟩ + obtain ⟨A, h₁, h₂, h₃, h₄, -⟩ := h a ha hau b hb hbu + exact ⟨A, h₁, h₂, h₃, h₄⟩ + obtain ⟨Z, hZ, hxZ, hsame⟩ := key + refine ⟨Z, hZ, hxZ, fun y hy => mem_closure_iff.mpr fun O hO hyO => ?_⟩ + obtain ⟨z, hzZ, hzr⟩ := mem_closure_iff.mp hxr Z hZ hxZ + have hzU := region_subset hr hzr + obtain ⟨w, ⟨hwO, hwZ⟩, hwU⟩ := exists_notMem_U (Γ := Γ) hS (hO.inter hZ) + ⟨y, hyO, hy⟩ + obtain ⟨A, h₁, h₂, h₃, h₄⟩ := hsame z hzZ hzU w hwZ hwU + exact ⟨w, hwO, subset_region hr h₁ h₂ h₃ hzr h₄⟩ + +/-- The closure of a region is connected in the small at a vertex. -/ +theorem locJoin_region_vertex (hS : IsClosedSurface S) {Γ : Drawing S} {r : Set S} (hr : r ∈ Γ.R) + {x : S} (hxV : x ∈ Γ.V) (hxr : x ∈ closure r) : LocJoin (closure r) x := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hlp : LocallyPathConnectedSpace S := IsClosedSurface.locallyPathConnectedSpace hS + intro A hA hxA + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + -- The points of the drawing near `x`. + have hA' : ∀ g ∈ {g | g ∈ Γ.E ∧ x ∈ closure g}, ∃ N : Set S, IsOpen N ∧ x ∈ N ∧ + ∀ y ∈ closure g ∩ N, JoinedIn (closure g ∩ A) x y := fun g hg => + locJoin_edge hg.1 hγ hg.2 A hA hxA + choose! Ng hNo hNm hNj using hA' + have hfin₁ : {g | g ∈ Γ.E ∧ x ∈ closure g}.Finite := Γ.finite_edges.subset fun _ h => h.1 + have hfin₂ : {g | g ∈ Γ.E ∧ x ∉ closure g}.Finite := Γ.finite_edges.subset fun _ h => h.1 + let N₁ : Set S := (⋂ g ∈ {g | g ∈ Γ.E ∧ x ∈ closure g}, Ng g) ∩ + (⋂ g ∈ {g | g ∈ Γ.E ∧ x ∉ closure g}, (closure g)ᶜ) ∩ (Γ.V \ {x})ᶜ + have hN₁ : IsOpen N₁ := + ((hfin₁.isOpen_biInter hNo).inter (hfin₂.isOpen_biInter fun _ _ => + isClosed_closure.isOpen_compl)).inter + (Γ.finite_V.subset sdiff_subset).isClosed.isOpen_compl + have hxN₁ : x ∈ N₁ := + ⟨⟨mem_iInter₂.mpr hNm, mem_iInter₂.mpr fun g hg => hg.2⟩, fun h => h.2 rfl⟩ + have hjx : JoinedIn (closure r ∩ A) x x := JoinedIn.refl ⟨hxr, hxA⟩ + have hstep₁ : ∀ y ∈ closure r ∩ N₁, y ∈ Γ.U → JoinedIn (closure r ∩ A) x y := by + rintro y ⟨hyr, ⟨hy₁, hy₂⟩, hy₃⟩ hyU + by_cases hyx : y = x + · exact hyx ▸ hjx + have hyV : y ∉ Γ.V := fun h => hy₃ ⟨h, hyx⟩ + rw [Γ.U_eq] at hyU + obtain ⟨g, hg, hyg⟩ := mem_iUnion₂.mp (hyU.resolve_left hyV) + have hyge : y ∈ g := (Γ.closure_diff_V hg).subset ⟨hyg, hyV⟩ + have hgsub := edge_subset_closure_of_incident hS hg hr ⟨y, hyge, hyr⟩ + have hcl : closure g ⊆ closure r := closure_minimal hgsub isClosed_closure + have hxg : x ∈ closure g := by + by_contra h + exact mem_iInter₂.mp hy₂ g ⟨hg, h⟩ hyg + refine (hNj g ⟨hg, hxg⟩ y ⟨hyg, mem_iInter₂.mp hy₁ g ⟨hg, hxg⟩⟩).mono ?_ + exact inter_subset_inter_left _ hcl + -- The points of `r` near `x`. + have hstep₂ : ∃ N₂ : Set S, IsOpen N₂ ∧ x ∈ N₂ ∧ ∀ y ∈ r ∩ N₂, JoinedIn (closure r ∩ A) x y := by + by_cases h2 : 2 ≤ Nat.card (halfEdges Γ γ x) + · obtain ⟨next, ρ, P, W, Q, τ, hs⟩ := exists_sectors hS Γ hγ hxV h2 + have hfin : Finite (halfEdges Γ γ x) := (finite_halfEdges Γ γ x).to_subtype + have hWA : IsOpen (W ∩ A) := (IsSectors.isOpen hs).inter hA + have hxWA : x ∈ W ∩ A := ⟨IsSectors.mem hs, hxA⟩ + choose N hNo' hNm' hNp using fun k => + exists_disc_approach (IsSectors.disc hs k) (IsSectors.bd hs k) hWA hxWA + refine ⟨(W ∩ A) ∩ ⋂ k, N k, hWA.inter (isOpen_iInter_of_finite hNo'), + ⟨hxWA, mem_iInter.mpr hNm'⟩, ?_⟩ + rintro y ⟨hyr, hyW, hyN⟩ + obtain ⟨k, hk⟩ := mem_iUnion.mp (IsSectors.cover hs ⟨hyW.1, region_subset hr hyr⟩) + have hrk : r = ρ k := region_eq_of_mem hr ((IsSectors.corners hs).region k) hyr + (IsSectors.sub hs k hk) + have hyb : y ∉ discBd (Q k) := fun h => + region_subset hr hyr (IsSectors.bdU hs k ⟨hyW.1, h⟩) + obtain ⟨p, hp⟩ := hNp k y ⟨mem_iInter.mp hyN k, IsSectors.subQ hs k hk⟩ hyb + refine ⟨p, fun t => ?_⟩ + rcases hp t with h | h + · rw [h] + exact ⟨hxr, hxA⟩ + · have hin : p t ∈ P k := IsSectors.inside hs k ⟨⟨h.1.1.1, h.1.2⟩, h.2⟩ + have hρ : p t ∈ r := hrk ▸ IsSectors.sub hs k hin + exact ⟨subset_closure hρ, h.1.1.2⟩ + · obtain ⟨Z, hZ, hxZ, hZr⟩ := exists_nbhd_of_few hS hγ hxV h2 hr hxr + refine ⟨pathComponentIn (Z ∩ A) x, (hZ.inter hA).pathComponentIn x, + mem_pathComponentIn_self ⟨hxZ, hxA⟩, ?_⟩ + rintro y ⟨-, hy⟩ + have hj : JoinedIn (Z ∩ A) x y := hy + exact hj.mono (inter_subset_inter_left _ hZr) + obtain ⟨N₂, hN₂, hxN₂, h₂⟩ := hstep₂ + refine ⟨N₁ ∩ N₂, hN₁.inter hN₂, ⟨hxN₁, hxN₂⟩, ?_⟩ + rintro y ⟨hyr, hy₁, hy₂⟩ + by_cases hyU : y ∈ Γ.U + · exact hstep₁ y ⟨hyr, hy₁⟩ hyU + · exact h₂ y ⟨(closure_region_subset hr hyr).resolve_right hyU, hy₂⟩ + +/-- The closure of a region is connected in the small. -/ +theorem locJoin_region (hS : IsClosedSurface S) {Γ : Drawing S} {r : Set S} (hr : r ∈ Γ.R) {x : S} + (hxr : x ∈ closure r) : LocJoin (closure r) x := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hlp : LocallyPathConnectedSpace S := IsClosedSurface.locallyPathConnectedSpace hS + by_cases hxU : x ∈ Γ.U + · by_cases hxV : x ∈ Γ.V + · exact locJoin_region_vertex hS hr hxV hxr + classical + have hxU' := hxU + rw [Γ.U_eq] at hxU' + obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp (hxU'.resolve_left hxV) + have hxee : x ∈ e := (Γ.closure_diff_V he).subset ⟨hxe, hxV⟩ + choose! c hc using fun g (hg : g ∈ Γ.E) => (hg.1 : g.Nonempty) + let m : Set S → S := fun g => if g = e then x else c g + have hm : ∀ g ∈ Γ.E, m g ∈ g := by + intro g hg + by_cases h : g = e + · simp only [m, h, ite_true] + exact hxee + · simp only [m, h, ite_false] + exact hc g hg + obtain ⟨D, hDU, hDV⟩ := exists_added_vertices Γ hm + have hxD : x ∈ D.V := by + rw [hDV] + refine Or.inr ⟨e, he, ?_⟩ + simp [m] + have hrD : r ∈ D.R := (mem_R_iff D).mpr (by + rw [hDU] + exact (mem_R_iff Γ).mp hr) + exact locJoin_region_vertex hS hrD hxD hxr + · have hxr' : x ∈ r := (closure_region_subset hr hxr).resolve_right hxU + intro A hA hxA + refine ⟨pathComponentIn (r ∩ A) x, ((region_isOpen hr).inter hA).pathComponentIn x, + mem_pathComponentIn_self ⟨hxr', hxA⟩, ?_⟩ + rintro y ⟨-, hy⟩ + have hj : JoinedIn (r ∩ A) x y := hy + exact hj.mono (inter_subset_inter_left _ subset_closure) + +/-- **A closed nice set is solid.** -/ +theorem isSolid_of_nice (hS : IsClosedSurface S) {Γ : Drawing S} {X : Set S} (hc : IsClosed X) + (hn : IsGammaNice Γ X) : IsSolid X := by + refine ⟨isLocallyArcConnected_of_locJoin ?_, hc⟩ + obtain ⟨𝒜, h𝒜, hX⟩ := hn + have hfin : Γ.A.Finite := + ((Γ.finite_V.image _).union Γ.finite_edges).union (finite_R hS Γ) + have hfin𝒜 := hfin.subset h𝒜 + have hsub : ∀ a ∈ 𝒜, closure a ⊆ X := fun a ha => + closure_minimal (fun y hy => hX ▸ mem_sUnion.mpr ⟨a, ha, hy⟩) hc + have hatom : ∀ a ∈ 𝒜, ∀ x ∈ closure a, LocJoin (closure a) x := by + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + intro a ha x hx + rcases h𝒜 ha with (⟨v, -, rfl⟩ | he) | hr + · intro A _ hxA + refine ⟨univ, isOpen_univ, mem_univ _, ?_⟩ + rintro y ⟨hy, -⟩ + have h₁ : x = v := by simpa using hx + have h₂ : y = v := by simpa using hy + subst h₁ + subst h₂ + exact JoinedIn.refl ⟨hx, hxA⟩ + · exact locJoin_edge he hγ hx + · exact locJoin_region hS hr hx + intro x hx A hA hxA + have hA' : ∀ a ∈ {a | a ∈ 𝒜 ∧ x ∈ closure a}, ∃ N : Set S, IsOpen N ∧ x ∈ N ∧ + ∀ y ∈ closure a ∩ N, JoinedIn (closure a ∩ A) x y := fun a ha => + hatom a ha.1 x ha.2 A hA hxA + choose! N hNo hNm hNj using hA' + have hfin₁ : {a | a ∈ 𝒜 ∧ x ∈ closure a}.Finite := hfin𝒜.subset fun _ h => h.1 + have hfin₂ : {a | a ∈ 𝒜 ∧ x ∉ closure a}.Finite := hfin𝒜.subset fun _ h => h.1 + refine ⟨_, (hfin₁.isOpen_biInter hNo).inter + (hfin₂.isOpen_biInter fun _ _ => isClosed_closure.isOpen_compl), + ⟨mem_iInter₂.mpr hNm, mem_iInter₂.mpr fun a ha => ha.2⟩, ?_⟩ + rintro y ⟨hyX, hy₁, hy₂⟩ + obtain ⟨a, ha, hya⟩ := mem_sUnion.mp (hX ▸ hyX : y ∈ ⋃₀ 𝒜) + have hxa : x ∈ closure a := by + by_contra h + exact mem_iInter₂.mp hy₂ a ⟨ha, h⟩ (subset_closure hya) + have hmem : a ∈ {a | a ∈ 𝒜 ∧ x ∈ closure a} := ⟨ha, hxa⟩ + exact (hNj a hmem y ⟨subset_closure hya, mem_iInter₂.mp hy₁ a hmem⟩).mono + (inter_subset_inter_left _ (hsub a ha)) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/SphereRegion.lean b/LeanPool/GraphMinor/GM11/SphereRegion.lean new file mode 100644 index 0000000000..b3a5648ffe --- /dev/null +++ b/LeanPool/GraphMinor/GM11/SphereRegion.lean @@ -0,0 +1,147 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Separate +public import LeanPool.GraphMinor.GM11.RegionCount +public import LeanPool.GraphMinor.GM11.PaintingRegions +public import LeanPool.GraphMinor.Surface.Disc + +/-! +# The outside of a set in a sphere + +Let `Q` be a closed connected set in a sphere, and `D` a drawing with `U(D) = bd(Q)` whose `O`-arcs +bound +discs in `Q`. Then the complement of `Q` is a region of `D` and an open disc, and `D` is 2-cell +(`sphere_outside`). This gives the walk around `Q` by `exists_region_walk`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [ConnectedSpace S] + +omit [ConnectedSpace S] in +/-- A connected set that misses an `O`-arc in a sphere misses one of the two discs that the arc +bounds. -/ +theorem exists_disc_missing (hS : IsClosedSurface S) (hsph : IsSphere S) {F T : Set S} + (hF : IsOArc F) + (hT : IsPreconnected T) (hTF : Disjoint T F) : ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = F + ∧ Disjoint Δ T := by + have hT2 : T2Space S := hS.2.1 + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + obtain ⟨Δ₁, Δ₂, -, hΔ₁, hΔ₂, hb₁, hb₂, hcup, hcap, -, -⟩ := sphere_disc S hsph F hF + have hint₁ := IsClosedDisc.isOpen_discInt hman hΔ₁ + have hint₂ := IsClosedDisc.isOpen_discInt hman hΔ₂ + have hdint : Disjoint (discInt Δ₁) (discInt Δ₂) := by + refine disjoint_left.mpr ?_ + rintro x ⟨h₁, h₂⟩ ⟨h₃, -⟩ + exact h₂ (by + rw [hb₁, ← hcap] + exact ⟨h₁, h₃⟩) + have hcover : T ⊆ discInt Δ₁ ∪ discInt Δ₂ := by + intro x hx + have hxF : x ∉ F := disjoint_left.mp hTF hx + have hxu : x ∈ Δ₁ ∪ Δ₂ := hcup ▸ mem_univ x + rcases hxu with h | h + · exact Or.inl ⟨h, by rwa [hb₁]⟩ + · exact Or.inr ⟨h, by rwa [hb₂]⟩ + rcases hT.subset_or_subset hint₁ hint₂ hdint hcover with h | h + · refine ⟨Δ₂, hΔ₂, hb₂, disjoint_left.mpr fun x hx hxT => ?_⟩ + have h₁ := h hxT + exact h₁.2 (by + rw [hb₁, ← hcap] + exact ⟨h₁.1, hx⟩) + · refine ⟨Δ₁, hΔ₁, hb₁, disjoint_left.mpr fun x hx hxT => ?_⟩ + have h₁ := h hxT + exact h₁.2 (by + rw [hb₂, ← hcap] + exact ⟨hx, h₁.1⟩) + +/-- **The outside of a closed connected set `Q` in a sphere.** -/ +theorem sphere_outside (hS : IsClosedSurface S) (hsph : IsSphere S) {Q : Set S} (hQc : IsClosed Q) + (hQp : IsPreconnected Q) (hQne : Q.Nonempty) (hQu : Q ≠ univ) {D : Drawing S} (hU : D.U + = frontier Q) + (hdisc : ∀ F, IsOArc F → F ⊆ D.U → ∃ Δ, IsClosedDisc Δ ∧ Δ ⊆ Q ∧ discBd Δ = F) : + Qᶜ ∈ D.R ∧ IsOpenDisc Qᶜ ∧ (PaintingOrDrawing.drawing D).IsTwoCell := by + have hT2 : T2Space S := hS.2.1 + have hK : CompactSpace S := hS.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hUQ : D.U ⊆ Q := by + rw [hU] + exact hQc.frontier_subset + obtain ⟨a, ha⟩ : ∃ a, a ∉ Q := by + by_contra h + push Not at h + exact hQu (eq_univ_of_forall h) + have haU : a ∉ D.U := fun h => ha (hUQ h) + obtain ⟨p, hp, hap⟩ := exists_region_of_notMem haU + have hsub : Qᶜ ⊆ p := by + intro b hb + obtain ⟨r, hr, har, hbr⟩ := same_region_of_discs hS hsph ha hb _ D rfl hUQ hdisc + obtain rfl := region_eq_of_mem hr hp har hap + exact hbr + have hpsub : p ⊆ Qᶜ := by + have hdis : p ⊆ interior Q ∪ Qᶜ := by + intro x hx + by_cases hxQ : x ∈ Q + · refine Or.inl ?_ + by_contra hint + exact region_subset hp hx (hU ▸ (⟨subset_closure hxQ, hint⟩ : x ∈ frontier Q)) + · exact Or.inr hxQ + have hdj : Disjoint (interior Q) Qᶜ := + disjoint_left.mpr fun x hx h => h (interior_subset hx) + rcases (region_isPreconnected hp).subset_or_subset isOpen_interior hQc.isOpen_compl hdj hdis + with h | h + · exact (ha (interior_subset (h hap))).elim + · exact h + have hpeq : p = Qᶜ := subset_antisymm hpsub hsub + have hreg : Qᶜ ∈ D.R := hpeq ▸ hp + have hcompl : IsConnected Qᶜ := ⟨⟨a, ha⟩, hpeq ▸ region_isPreconnected hp⟩ + have hopen : ∀ {Y : Set S}, IsConnected Y → IsOpen Y → Y ≠ univ → + (∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) → + IsOpenDisc Y := by + intro Y h₁ h₂ h₃ h₄ + rcases open_disc S Y hS inferInstance h₁ h₂ h₄ with h | h + · exact (h₃ h.2).elim + · exact h + have hdiscQ : IsOpenDisc Qᶜ := by + refine hopen hcompl hQc.isOpen_compl (fun h => ?_) fun F hF hO => ?_ + · obtain ⟨x, hx⟩ := hQne + exact (h ▸ mem_univ x : x ∈ Qᶜ) hx + · obtain ⟨Δ, h₁, h₂, h₃⟩ := exists_disc_missing hS hsph hO hQp + (disjoint_left.mpr fun x hx hxF => hF hxF hx) + exact ⟨Δ, fun x hx hxQ => disjoint_left.mp h₃ hx hxQ, h₁, h₂⟩ + have hfr : IsPreconnected D.U := by + rw [hU, ← frontier_compl] + exact isPreconnected_frontier hdiscQ + have hUne : D.U.Nonempty := by + rw [hU] + exact nonempty_frontier_iff.mpr ⟨hQne, fun h => hQu h⟩ + refine ⟨hreg, hdiscQ, inferInstance, fun q hq => ?_⟩ + have hq' : q ∈ D.R := hq + refine hopen ⟨region_nonempty hq', region_isPreconnected hq'⟩ (region_isOpen hq') (fun h => ?_) + fun F hF hO => ?_ + · obtain ⟨x, hx⟩ := hUne + exact region_subset hq' (h ▸ mem_univ x) hx + · obtain ⟨Δ, h₁, h₂, h₃⟩ := exists_disc_missing hS hsph hO hfr + (disjoint_left.mpr fun x hx hxF => region_subset hq' (hF hxF) hx) + obtain ⟨z, hz⟩ : F.Nonempty := by + obtain ⟨φ⟩ := hO + exact ⟨(φ 1).1, (φ 1).2⟩ + have hzΔ : z ∈ Δ := discBd_subset Δ (h₂ ▸ hz) + refine ⟨Δ, subset_region hq' (IsClosedDisc.isPathConnected h₁).isConnected.isPreconnected h₃ + hzΔ (hF hz), h₁, h₂⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/SplitEdge.lean b/LeanPool/GraphMinor/GM11/SplitEdge.lean new file mode 100644 index 0000000000..ca6981e9d4 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/SplitEdge.lean @@ -0,0 +1,310 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.DrawingOps +public import LeanPool.GraphMinor.GM11.Rotation + +/-! +# Splitting each edge at a new vertex + +`exists_split` adds one new vertex in each edge of a drawing. An edge `e` splits at its new vertex +`m e` +into two edges `A e` and `B e` of the new drawing, none of which is a loop, and these are all the +edges of +the new drawing. The point set does not change, and so neither do the regions. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- The piece of a curve over an open interval of parameters is path connected. -/ +theorem isPathConnected_image_Ioo {γ : I → S} (hγ : Continuous γ) {a b : I} (hab : a < b) : + IsPathConnected (γ '' Ioo a b) := by + let g : ℝ → S := fun x => γ (projIcc 0 1 zero_le_one x) + have hg : Continuous g := hγ.comp continuous_projIcc + have heq : γ '' Ioo a b = g '' Ioo a.1 b.1 := by + ext x + constructor + · rintro ⟨t, ht, rfl⟩ + exact ⟨t.1, ⟨ht.1, ht.2⟩, by simp [g]⟩ + · rintro ⟨t, ht, rfl⟩ + have hm : t ∈ Icc (0 : ℝ) 1 := ⟨a.2.1.trans ht.1.le, ht.2.le.trans b.2.2⟩ + refine ⟨⟨t, hm⟩, ⟨ht.1, ht.2⟩, ?_⟩ + simp only [g, projIcc_of_mem zero_le_one hm] + rw [heq] + exact ((convex_Ioo a.1 b.1).isPathConnected (nonempty_Ioo.mpr hab)).image hg + +/-- The closure of the piece of a curve over an open interval is the piece over the closed interval. +-/ +theorem closure_image_Ioo {γ : I → S} (hγ : Continuous γ) {a b : I} (hab : a < b) : + closure (γ '' Ioo a b) = γ '' Icc a b := by + have hcl : IsClosed (γ '' Icc a b) := (isCompact_Icc.image hγ).isClosed + apply subset_antisymm + · exact closure_minimal (image_mono Ioo_subset_Icc_self) hcl + · rw [← closure_Ioo hab.ne] + exact image_closure_subset_closure_image hγ + +variable {D D₂ : Drawing S} + +/-- One half of an edge is an edge of the new drawing. -/ +private theorem piece_mem {m : Set S → S} (hm : ∀ e ∈ D.E, m e ∈ e) (hU : D₂.U = D.U) + (hV : D₂.V = D.V ∪ m '' D.E) {e : Set S} (he : e ∈ D.E) {γ : I → S} (hγ : Continuous γ) + (h0 : γ 0 ∈ D.V) (h1 : γ 1 ∈ D.V) (hi : InjOn γ (Ioo 0 1)) (him : γ '' Ioo 0 1 = e) + {t₀ : I} (ht₀ : t₀ ∈ Ioo (0 : I) 1) (hγt : γ t₀ = m e) {a b : I} (hab : a < b) (ha : 0 ≤ a) + (hb : b ≤ 1) (hne : t₀ ∉ Ioo a b) (hend : (a = 0 ∧ b = t₀) ∨ (a = t₀ ∧ b = 1)) : + γ '' Ioo a b ∈ D₂.E := by + have hsub : Ioo a b ⊆ Ioo (0 : I) 1 := Ioo_subset_Ioo ha hb + have hoff : ∀ s ∈ Ioo (0 : I) 1, s ≠ t₀ → γ s ∈ D₂.U \ D₂.V := by + intro s hs hst + have hse : γ s ∈ e := him ▸ mem_image_of_mem γ hs + have hsU : γ s ∈ D.U \ D.V := he.2.1 hse + rw [hU, hV] + refine ⟨hsU.1, ?_⟩ + rintro (h | ⟨f, hf, hfe⟩) + · exact hsU.2 h + · have hee : f = e := D.edge_eq_of_mem hf he (hfe ▸ hm f hf) hse + subst hee + exact hst (hi hs ht₀ (hfe.symm.trans hγt.symm)) + have hsubF : γ '' Ioo a b ⊆ D₂.U \ D₂.V := by + rintro _ ⟨s, hs, rfl⟩ + exact hoff s (hsub hs) fun h => hne (h ▸ hs) + refine ⟨(nonempty_Ioo.mpr hab).image γ, hsubF, isPathConnected_image_Ioo hγ hab, ?_⟩ + intro C hCF hCp hsubC + obtain ⟨s₀, hs₀⟩ := nonempty_Ioo.mpr hab + have hs₀e : γ s₀ ∈ e := him ▸ mem_image_of_mem γ (hsub hs₀) + have hF : D₂.U \ D₂.V ⊆ D.U \ D.V := by + rw [hU, hV] + exact fun x hx => ⟨hx.1, fun h => hx.2 (Or.inl h)⟩ + have hCe : C ⊆ e := by + have hunion : IsPathConnected (e ∪ C) := + he.2.2.1.union hCp ⟨γ s₀, hs₀e, hsubC (mem_image_of_mem γ hs₀)⟩ + have := he.2.2.2 _ (union_subset he.2.1 (hCF.trans hF)) hunion subset_union_left + exact this ▸ subset_union_right + have hmC : m e ∉ C := fun h => (hCF h).2 (hV ▸ Or.inr ⟨e, he, rfl⟩) + -- `C` lies in one of the two closed halves. + have hcl₁ : IsClosed (γ '' Icc 0 t₀) := (isCompact_Icc.image hγ).isClosed + have hcl₂ : IsClosed (γ '' Icc t₀ 1) := (isCompact_Icc.image hγ).isClosed + have hcov : C ⊆ γ '' Icc 0 t₀ ∪ γ '' Icc t₀ 1 := by + intro x hx + obtain ⟨s, hs, rfl⟩ := him ▸ hCe hx + rcases le_total s t₀ with h | h + · exact Or.inl ⟨s, ⟨hs.1.le, h⟩, rfl⟩ + · exact Or.inr ⟨s, ⟨h, hs.2.le⟩, rfl⟩ + have hIoo : ∀ {u : I}, γ u ∈ e → u ∈ Ioo (0 : I) 1 := by + intro u hu + have hnV := (he.2.1 hu).2 + refine ⟨unitInterval.pos_iff_ne_zero.mpr fun h => hnV (by rw [h]; exact h0), + lt_of_le_of_ne (unitInterval.le_one u) fun h => hnV (by rw [h]; exact h1)⟩ + have hdisj : ∀ x ∈ C, x ∈ γ '' Icc 0 t₀ → x ∈ γ '' Icc t₀ 1 → False := by + rintro _ hx ⟨s, hs, rfl⟩ ⟨s', hs', hss⟩ + have heq := hi (hIoo (hss ▸ hCe hx)) (hIoo (hCe hx)) hss + have hst : s = t₀ := le_antisymm hs.2 (heq ▸ hs'.1) + rw [hst, hγt] at hx + exact hmC hx + have hpre := hCp.isConnected.isPreconnected + have hwhich : C ⊆ γ '' Icc 0 t₀ ∨ C ⊆ γ '' Icc t₀ 1 := by + by_contra hnot + push Not at hnot + obtain ⟨hn₁, hn₂⟩ := hnot + obtain ⟨x, hxC, hx₁⟩ := not_subset.mp hn₁ + obtain ⟨y, hyC, hy₂⟩ := not_subset.mp hn₂ + have hxb : x ∈ γ '' Icc t₀ 1 := (hcov hxC).resolve_left hx₁ + have hyb : y ∈ γ '' Icc 0 t₀ := (hcov hyC).resolve_right hy₂ + obtain ⟨z, hz, hz₁, hz₂⟩ := (isPreconnected_closed_iff.mp hpre) _ _ hcl₁ hcl₂ hcov ⟨y, hyC, + hyb⟩ ⟨x, hxC, hxb⟩ + exact hdisj z hz hz₁ hz₂ + apply subset_antisymm _ hsubC + have hs₀C : γ s₀ ∈ C := hsubC (mem_image_of_mem γ hs₀) + -- A point of `C` in a closed half, with parameter in `Ioo 0 1`. + have hpar : ∀ {K : Set I} {x : S}, x ∈ C → x ∈ γ '' K → ∃ u ∈ K, u ∈ Ioo (0 : I) 1 ∧ γ u = x := by + rintro K _ hx ⟨u, hu, rfl⟩ + exact ⟨u, hu, hIoo (hCe hx), rfl⟩ + intro x hx + have hne' : x ≠ γ t₀ := fun h => hmC (by rw [← hγt, ← h]; exact hx) + have hneu : ∀ u, γ u = x → u ≠ t₀ := fun u hu h => hne' (by rw [← hu, h]) + rcases hend with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rcases hwhich with h | h + · obtain ⟨u, hu, hu₀, rfl⟩ := hpar hx (h hx) + exact ⟨u, ⟨hu₀.1, lt_of_le_of_ne hu.2 (hneu u rfl)⟩, rfl⟩ + · obtain ⟨u, hu, hu₀, hue⟩ := hpar hs₀C (h hs₀C) + obtain rfl := hi hu₀ (hsub hs₀) hue + exact (not_lt.mpr hu.1 hs₀.2).elim + · rcases hwhich with h | h + · obtain ⟨u, hu, hu₀, hue⟩ := hpar hs₀C (h hs₀C) + obtain rfl := hi hu₀ (hsub hs₀) hue + exact (not_lt.mpr hu.2 hs₀.1).elim + · obtain ⟨u, hu, hu₀, rfl⟩ := hpar hx (h hx) + exact ⟨u, ⟨lt_of_le_of_ne hu.1 (Ne.symm (hneu u rfl)), hu₀.2⟩, rfl⟩ + +/-- **Splitting each edge at a new vertex.** Each edge `e` splits into edges `A e`, `B e` at the new +vertex `m e`, and these are all the new edges. Each closure meets the new vertices in two distinct +points +`x, m e` or `m e, y`, where `x, y` are the ends of `e`. -/ +theorem exists_split_at [Nonempty S] (D : Drawing S) (m : Set S → S) (hm₀ : ∀ e ∈ D.E, m e ∈ e) : + ∃ (D₂ : Drawing S) (A B : Set S → Set S) (x y : Set S → S), D₂.U = D.U ∧ D₂.V = D.V ∪ m '' D.E ∧ + (∀ e ∈ D.E, A e ∈ D₂.E ∧ B e ∈ D₂.E ∧ m e ∈ e ∧ m e ∉ A e ∧ m e ∉ B e ∧ Disjoint (A e) (B e) ∧ + e = A e ∪ {m e} ∪ B e ∧ x e ∈ D.V ∧ y e ∈ D.V ∧ closure e ∩ D.V = {x e, y e} ∧ + closure (A e) ∩ D₂.V = {x e, m e} ∧ closure (B e) ∩ D₂.V = {m e, y e}) ∧ + ∀ g ∈ D₂.E, ∃ e ∈ D.E, g = A e ∨ g = B e := by + classical + have key : ∀ e ∈ D.E, ∃ (γ : I → S) (t₀ : I), Continuous γ ∧ γ 0 ∈ D.V ∧ γ 1 ∈ D.V ∧ + InjOn γ (Ioo 0 1) ∧ γ '' Ioo 0 1 = e ∧ t₀ ∈ Ioo (0 : I) 1 ∧ γ t₀ = m e := by + intro e he + obtain ⟨γ, hc, h0, h1, hi, him⟩ := exists_edge_param D he + have hme : m e ∈ γ '' Ioo 0 1 := him.symm ▸ hm₀ e he + obtain ⟨t, ht, htm⟩ := hme + exact ⟨γ, t, hc, h0, h1, hi, him, ht, htm⟩ + choose! γ t₀ hc h0 h1 hi him ht htm using key + have hm : ∀ e ∈ D.E, m e ∈ e := hm₀ + obtain ⟨D₂, hU, hV⟩ := exists_added_vertices D hm + let A : Set S → Set S := fun e => γ e '' Ioo 0 (t₀ e) + let B : Set S → Set S := fun e => γ e '' Ioo (t₀ e) 1 + have hAE : ∀ e ∈ D.E, A e ∈ D₂.E := fun e he => piece_mem hm hU hV he (hc e he) (h0 e he) + (h1 e he) + (hi e he) (him e he) (ht e he) (htm e he) (ht e he).1 bot_le (unitInterval.le_one _) (fun h + => lt_irrefl _ h.2) + (Or.inl ⟨rfl, rfl⟩) + have hBE : ∀ e ∈ D.E, B e ∈ D₂.E := fun e he => piece_mem hm hU hV he (hc e he) (h0 e he) + (h1 e he) + (hi e he) (him e he) (ht e he) (htm e he) (ht e he).2 (unitInterval.nonneg _) le_rfl (fun h + => lt_irrefl _ h.1) + (Or.inr ⟨rfl, rfl⟩) + have hAsub : ∀ e ∈ D.E, Ioo 0 (t₀ e) ⊆ Ioo (0 : I) 1 := fun e he => Ioo_subset_Ioo_right + (ht e he).2.le + have hBsub : ∀ e ∈ D.E, Ioo (t₀ e) 1 ⊆ Ioo (0 : I) 1 := fun e he => Ioo_subset_Ioo_left + (ht e he).1.le + have hsplit : ∀ e ∈ D.E, e = A e ∪ {m e} ∪ B e := by + intro e he + apply subset_antisymm + · intro p hp + obtain ⟨s, hs, rfl⟩ := him e he ▸ hp + rcases lt_trichotomy s (t₀ e) with h | h | h + · exact Or.inl (Or.inl ⟨s, ⟨hs.1, h⟩, rfl⟩) + · exact Or.inl (Or.inr (by rw [h]; exact htm e he)) + · exact Or.inr ⟨s, ⟨h, hs.2⟩, rfl⟩ + · have hsub : ∀ s ∈ Ioo (0 : I) 1, γ e s ∈ e := fun s hs => by + have := mem_image_of_mem (γ e) hs + rwa [him e he] at this + rintro _ ((⟨s, hs, rfl⟩ | rfl) | ⟨s, hs, rfl⟩) + · exact hsub s (hAsub e he hs) + · exact hm e he + · exact hsub s (hBsub e he hs) + have hmA : ∀ e ∈ D.E, m e ∉ A e := by + rintro e he ⟨s, hs, hse⟩ + exact hs.2.ne (hi e he (hAsub e he hs) (ht e he) (hse.trans (htm e he).symm)) + have hmB : ∀ e ∈ D.E, m e ∉ B e := by + rintro e he ⟨s, hs, hse⟩ + exact hs.1.ne' (hi e he (hBsub e he hs) (ht e he) (hse.trans (htm e he).symm)) + have hAB : ∀ e ∈ D.E, Disjoint (A e) (B e) := by + intro e he + refine disjoint_left.mpr ?_ + rintro _ ⟨s, hs, rfl⟩ ⟨s', hs', hse⟩ + have := hi e he (hBsub e he hs') (hAsub e he hs) hse + exact absurd (hs.2.trans hs'.1) (by rw [this]; exact lt_irrefl _) + have hVm : ∀ e ∈ D.E, m e ∈ D₂.V := fun e he => hV ▸ Or.inr ⟨e, he, rfl⟩ + have hclA : ∀ e ∈ D.E, closure (A e) ∩ D₂.V = {γ e 0, m e} := by + intro e he + have hcl := closure_image_Ioo (hc e he) (ht e he).1 + apply subset_antisymm + · rintro p ⟨hp, hpV⟩ + rw [hcl] at hp + obtain ⟨s, hs, rfl⟩ := hp + by_cases h0' : s = 0 + · simp [h0'] + by_cases h1' : s = t₀ e + · simp [h1', htm e he] + exact (((hAE e he).2.1 ⟨s, ⟨unitInterval.pos_iff_ne_zero.mpr h0', lt_of_le_of_ne hs.2 h1'⟩, + rfl⟩).2 + hpV).elim + · rw [hcl] + rintro _ (rfl | rfl) + · exact ⟨⟨0, ⟨le_rfl, (ht e he).1.le⟩, rfl⟩, hV ▸ Or.inl (h0 e he)⟩ + · exact ⟨⟨t₀ e, ⟨(ht e he).1.le, le_rfl⟩, htm e he⟩, hVm e he⟩ + have hclB : ∀ e ∈ D.E, closure (B e) ∩ D₂.V = {m e, γ e 1} := by + intro e he + have hcl := closure_image_Ioo (hc e he) (ht e he).2 + apply subset_antisymm + · rintro p ⟨hp, hpV⟩ + rw [hcl] at hp + obtain ⟨s, hs, rfl⟩ := hp + by_cases h0' : s = t₀ e + · simp [h0', htm e he] + by_cases h1' : s = 1 + · simp [h1'] + exact (((hBE e he).2.1 ⟨s, ⟨lt_of_le_of_ne hs.1 (Ne.symm h0'), lt_of_le_of_ne hs.2 h1'⟩, + rfl⟩).2 + hpV).elim + · rw [hcl] + rintro _ (rfl | rfl) + · exact ⟨⟨t₀ e, ⟨le_rfl, (ht e he).2.le⟩, htm e he⟩, hVm e he⟩ + · exact ⟨⟨1, ⟨(ht e he).2.le, le_rfl⟩, rfl⟩, hV ▸ Or.inl (h1 e he)⟩ + have hclE : ∀ e ∈ D.E, closure e ∩ D.V = {γ e 0, γ e 1} := by + intro e he + have hcl : closure e = γ e '' Icc 0 1 := by + conv_lhs => rw [← him e he] + exact closure_image_Ioo (hc e he) zero_lt_one + apply subset_antisymm + · rintro p ⟨hp, hpV⟩ + rw [hcl] at hp + obtain ⟨s, hs, rfl⟩ := hp + by_cases h0' : s = 0 + · simp [h0'] + by_cases h1' : s = 1 + · simp [h1'] + have hmem : γ e s ∈ e := by + have := mem_image_of_mem (γ e) (show s ∈ Ioo (0 : I) 1 from + ⟨unitInterval.pos_iff_ne_zero.mpr h0', lt_of_le_of_ne hs.2 h1'⟩) + rwa [him e he] at this + exact ((he.2.1 hmem).2 hpV).elim + · rw [hcl] + rintro _ (rfl | rfl) + · exact ⟨⟨0, ⟨le_rfl, zero_le_one⟩, rfl⟩, h0 e he⟩ + · exact ⟨⟨1, ⟨zero_le_one, le_rfl⟩, rfl⟩, h1 e he⟩ + refine ⟨D₂, A, B, fun e => γ e 0, fun e => γ e 1, hU, hV, fun e he => ⟨hAE e he, hBE e he, + hm e he, + hmA e he, hmB e he, hAB e he, hsplit e he, h0 e he, h1 e he, hclE e he, hclA e he, hclB e he⟩, + ?_⟩ + intro g hg + obtain ⟨z, hz⟩ := hg.1 + have hzF := hg.2.1 hz + have hzU : z ∈ D.U := hU ▸ hzF.1 + have hzV : z ∉ D.V := fun h => hzF.2 (hV ▸ Or.inl h) + rw [D.U_eq] at hzU + obtain ⟨e, he, hze⟩ := mem_iUnion₂.mp (hzU.resolve_left hzV) + have hzee : z ∈ e := D.closure_diff_V he ▸ (⟨hze, hzV⟩ : z ∈ closure e \ D.V) + refine ⟨e, he, ?_⟩ + rw [hsplit e he] at hzee + rcases hzee with (h | h) | h + · exact Or.inl (D₂.edge_eq_of_mem hg (hAE e he) hz h) + · exact (hzF.2 (by rw [mem_singleton_iff.mp h]; exact hVm e he)).elim + · exact Or.inr (D₂.edge_eq_of_mem hg (hBE e he) hz h) + +/-- `exists_split_at`, with the point `m e` chosen freely. -/ +theorem exists_split [Nonempty S] (D : Drawing S) : + ∃ (D₂ : Drawing S) (A B : Set S → Set S) (m x y : Set S → S), D₂.U = D.U ∧ D₂.V + = D.V ∪ m '' D.E ∧ + (∀ e ∈ D.E, A e ∈ D₂.E ∧ B e ∈ D₂.E ∧ m e ∈ e ∧ m e ∉ A e ∧ m e ∉ B e ∧ Disjoint (A e) (B e) ∧ + e = A e ∪ {m e} ∪ B e ∧ x e ∈ D.V ∧ y e ∈ D.V ∧ closure e ∩ D.V = {x e, y e} ∧ + closure (A e) ∩ D₂.V = {x e, m e} ∧ closure (B e) ∩ D₂.V = {m e, y e}) ∧ + ∀ g ∈ D₂.E, ∃ e ∈ D.E, g = A e ∨ g = B e := by + have key : ∀ e ∈ D.E, ∃ x, x ∈ e := fun e he => he.1 + choose! m hm using key + obtain ⟨D₂, A, B, x, y, h⟩ := exists_split_at D m hm + exact ⟨D₂, A, B, m, x, y, h⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/SquareChart.lean b/LeanPool/GraphMinor/GM11/SquareChart.lean new file mode 100644 index 0000000000..8e523208d9 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/SquareChart.lean @@ -0,0 +1,468 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collar +public import LeanPool.GraphMinor.Surface.Cap +public import LeanPool.GraphMinor.GM11.Defs +public import Mathlib.Analysis.Complex.Convex + +/-! +# Coordinates on a closed disc with three sides + +Let `D` be a closed disc in a surface whose boundary is three lines that form a triangle. We give +coordinates on `D` by the unit square: the bottom of the square is the first line, the left and +right sides +are the two other lines, and the top is collapsed to the point where these two meet +(`exists_square_chart`). The boundary map is prescribed, so such charts of neighbouring discs agree +on a +common side. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval Metric + +universe u + +/-- The triangle with vertices `0`, `1` and `1/2 + i`. -/ +def tri : Set ℂ := {z | 0 ≤ z.im ∧ z.im ≤ 1 ∧ z.im / 2 ≤ z.re ∧ z.re ≤ 1 - z.im / 2} + +theorem isClosed_tri : IsClosed tri := by + have h₁ : Continuous fun z : ℂ => z.im := Complex.continuous_im + have h₂ : Continuous fun z : ℂ => z.re := Complex.continuous_re + exact (isClosed_le continuous_const h₁).inter ((isClosed_le h₁ continuous_const).inter + ((isClosed_le (h₁.div_const 2) h₂).inter (isClosed_le h₂ (continuous_const.sub + (h₁.div_const 2))))) + +theorem convex_tri : Convex ℝ tri := by + intro x hx y hy a b ha hb hab + obtain ⟨x₁, x₂, x₃, x₄⟩ := hx + obtain ⟨y₁, y₂, y₃, y₄⟩ := hy + have e₁ : (a • x + b • y).im = a * x.im + b * y.im := by simp + have e₂ : (a • x + b • y).re = a * x.re + b * y.re := by simp + have hb' : b = 1 - a := by linarith + subst hb' + refine ⟨?_, ?_, ?_, ?_⟩ <;> rw [e₁] <;> try rw [e₂] + · positivity + · nlinarith + · nlinarith + · nlinarith + +theorem tri_subset_ball : tri ⊆ ball (0 : ℂ) 3 := by + rintro z ⟨h₁, h₂, h₃, h₄⟩ + rw [mem_ball, dist_zero_right] + have := Complex.norm_le_abs_re_add_abs_im z + have h₅ : |z.re| ≤ 1 := abs_le.mpr ⟨by linarith, by linarith⟩ + have h₆ : |z.im| ≤ 1 := abs_le.mpr ⟨by linarith, by linarith⟩ + linarith + +theorem mem_interior_tri {z : ℂ} (h₁ : 0 < z.im) (h₃ : z.im / 2 < z.re) (h₄ : z.re < 1 - z.im / 2) : + z ∈ interior tri := by + have hO : IsOpen {w : ℂ | 0 < w.im ∧ w.im / 2 < w.re ∧ w.re < 1 - w.im / 2} := by + have c₁ : Continuous fun z : ℂ => z.im := Complex.continuous_im + have c₂ : Continuous fun z : ℂ => z.re := Complex.continuous_re + exact (isOpen_lt continuous_const c₁).inter ((isOpen_lt (c₁.div_const 2) c₂).inter + (isOpen_lt c₂ (continuous_const.sub (c₁.div_const 2)))) + refine mem_interior.mpr ⟨_, ?_, hO, h₁, h₃, h₄⟩ + rintro w ⟨a₁, a₂, a₃⟩ + exact ⟨a₁.le, by linarith, a₂.le, a₃.le⟩ + +/-- A point of `tri` on one of the three sides is not an interior point. -/ +theorem notMem_interior_tri {z : ℂ} (h : z.im = 0 ∨ z.re = z.im / 2 ∨ z.re = 1 - z.im / 2) : + z ∉ interior tri := by + intro hz + obtain ⟨ε, hε, hb⟩ := Metric.isOpen_iff.mp isOpen_interior z hz + have hin : ∀ w, ‖w‖ = ε / 2 → z + w ∈ tri := fun w hw => + interior_subset (hb (by simp [dist_eq_norm, hw]; linarith)) + rcases h with h | h | h + · have := (hin (⟨0, -(ε / 2)⟩ : ℂ) (by + rw [Complex.norm_def, Complex.normSq_mk] + simp only [mul_zero, zero_add, neg_mul_neg] + rw [Real.sqrt_mul_self (by positivity)])).1 + simp [h] at this + linarith + · have := (hin (⟨-(ε / 2), 0⟩ : ℂ) (by + rw [Complex.norm_def, Complex.normSq_mk] + simp only [mul_zero, add_zero, neg_mul_neg] + rw [Real.sqrt_mul_self (by positivity)])).2.2.1 + simp at this + linarith + · have := (hin (⟨ε / 2, 0⟩ : ℂ) (by + rw [Complex.norm_def, Complex.normSq_mk] + simp only [mul_zero, add_zero] + rw [Real.sqrt_mul_self (by positivity)])).2.2.2 + simp at this + linarith + +theorem mem_frontier_tri {z : ℂ} : z ∈ frontier tri ↔ + z ∈ tri ∧ (z.im = 0 ∨ z.re = z.im / 2 ∨ z.re = 1 - z.im / 2) := by + rw [frontier, isClosed_tri.closure_eq] + constructor + · rintro ⟨hz, hn⟩ + refine ⟨hz, ?_⟩ + by_contra hc + push Not at hc + obtain ⟨h₁, h₂, h₃⟩ := hc + obtain ⟨a₁, -, a₃, a₄⟩ := hz + exact hn (mem_interior_tri (lt_of_le_of_ne a₁ h₁.symm) (lt_of_le_of_ne a₃ h₂.symm) + (lt_of_le_of_ne a₄ h₃)) + · rintro ⟨hz, h⟩ + exact ⟨hz, notMem_interior_tri h⟩ + +theorem tri_disc : IsClosedDisc tri ∧ discBd tri = frontier tri := + isClosedDisc_of_convex convex_tri ⟨⟨1 / 2, 1 / 2⟩, mem_interior_tri (by norm_num) (by norm_num) + (by norm_num)⟩ (isBounded_ball.subset tri_subset_ball) isClosed_tri + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- The point of `tri` at height `t`, at the place `u` between its two sides. -/ +noncomputable def triPoint (u t : I) : ℂ := ⟨t.1 / 2 + (1 - t.1) * u.1, t.1⟩ + +theorem continuous_triPoint : Continuous fun p : I × I => triPoint p.1 p.2 := by + have h₁ : Continuous fun p : I × I => (p.1.1 : ℝ) := continuous_subtype_val.comp continuous_fst + have h₂ : Continuous fun p : I × I => (p.2.1 : ℝ) := continuous_subtype_val.comp continuous_snd + have : (fun p : I × I => triPoint p.1 p.2) = fun p => + Complex.equivRealProdCLM.symm (p.2.1 / 2 + (1 - p.2.1) * p.1.1, p.2.1) := by + funext p + apply Complex.ext <;> simp [triPoint] + rw [this] + exact Complex.equivRealProdCLM.symm.continuous.comp ((by fun_prop : Continuous fun p : I × I => + (p.2.1 / 2 + (1 - p.2.1) * p.1.1 : ℝ)).prodMk h₂) + +theorem triPoint_mem (u t : I) : triPoint u t ∈ tri := by + have ha := u.2.1 + have hb := u.2.2 + have hc := t.2.1 + have hd := t.2.2 + refine ⟨hc, hd, ?_, ?_⟩ <;> simp only [triPoint] + · nlinarith + · nlinarith + +theorem exists_triPoint {z : ℂ} (hz : z ∈ tri) : ∃ u t, triPoint u t = z := by + obtain ⟨h₁, h₂, h₃, h₄⟩ := hz + let t : I := ⟨z.im, h₁, h₂⟩ + by_cases h1 : z.im = 1 + · refine ⟨0, t, Complex.ext ?_ (by simp [triPoint, t])⟩ + simp only [triPoint, t, h1] + rw [h1] at h₃ h₄ + norm_num + linarith + · have hp : 0 < 1 - z.im := by + have : z.im < 1 := lt_of_le_of_ne h₂ h1 + linarith + let u : I := ⟨(z.re - z.im / 2) / (1 - z.im), div_nonneg (by linarith) hp.le, by + rw [div_le_one hp] + linarith⟩ + refine ⟨u, t, Complex.ext ?_ (by simp [triPoint, t])⟩ + simp only [triPoint, t, u] + field_simp + ring + +theorem triPoint_inj {u t u' t' : I} (ht : t.1 < 1) (h : triPoint u t = triPoint u' t') : + u = u' ∧ t = t' := by + have h₂ : t.1 = t'.1 := congrArg Complex.im h + have h₁ : t.1 / 2 + (1 - t.1) * u.1 = t'.1 / 2 + (1 - t'.1) * u'.1 := congrArg Complex.re h + rw [← h₂] at h₁ + have h₃ : (1 - t.1) * u.1 = (1 - t.1) * u'.1 := by linarith + have h₄ : u.1 = u'.1 := mul_left_cancel₀ (by linarith) h₃ + exact ⟨Subtype.ext h₄, Subtype.ext h₂⟩ + +/-- A homeomorphism between the triangle and a closed disc with a given boundary map. -/ +theorem exists_tri_map {D : Set S} (hD : IsClosedDisc D) {D' : Set S} (hD' : IsClosedDisc D') + (hin : D ⊆ D' \ discBd D') {β : ℂ → S} (hβc : ContinuousOn β (frontier tri)) + (hβi : InjOn β (frontier tri)) (hβs : β '' frontier tri = discBd D) : + ∃ ψ : ℂ → S, ContinuousOn ψ tri ∧ InjOn ψ tri ∧ ψ '' tri = D ∧ ∀ z ∈ frontier tri, ψ z = β z + := by + classical + obtain ⟨hT, hTb⟩ := tri_disc + obtain ⟨p₁⟩ := hT.isOArc_discBd + have hmem : ∀ w, β (p₁ w).1 ∈ discBd D := fun w => + hβs ▸ mem_image_of_mem β (hTb ▸ (p₁ w).2) + let f : Circle → discBd D := fun w => ⟨β (p₁ w).1, hmem w⟩ + have hfc : Continuous f := by + refine Continuous.subtype_mk (hβc.comp_continuous ?_ ?_) _ + · exact continuous_subtype_val.comp p₁.continuous + · exact fun w => hTb ▸ (p₁ w).2 + have hfi : Function.Injective f := by + intro a b h + have h₁ := hβi (hTb ▸ (p₁ a).2) (hTb ▸ (p₁ b).2) (congrArg Subtype.val h) + exact p₁.injective (Subtype.ext h₁) + have hfs : Function.Surjective f := by + rintro ⟨x, hx⟩ + rw [← hβs] at hx + obtain ⟨z, hz, rfl⟩ := hx + refine ⟨p₁.symm ⟨z, hTb.symm ▸ hz⟩, Subtype.ext ?_⟩ + simp [f] + let p₂ : Circle ≃ₜ discBd D := + (Equiv.ofBijective f ⟨hfi, hfs⟩).toHomeomorphOfContinuousClosed hfc + (hfc.isClosedMap) + obtain ⟨c₂, c₂', h₁, -, -, -, h₅, -, h₇, -, h₉⟩ := exists_disc_collar hD hD' hin p₂ + have hbig := isClosedDisc_of_convex (convex_closedBall (0 : ℂ) 3) + (by rw [interior_closedBall _ (by norm_num)]; exact ⟨0, by simp⟩) isBounded_closedBall + isClosed_closedBall + have hbd3 : discBd (closedBall (0 : ℂ) 3) = sphere 0 3 := by + rw [hbig.2, frontier_closedBall _ (by norm_num)] + have hTin : tri ⊆ closedBall (0 : ℂ) 3 \ discBd (closedBall (0 : ℂ) 3) := by + intro z hz + have := tri_subset_ball hz + refine ⟨ball_subset_closedBall this, ?_⟩ + rw [hbd3] + intro h + rw [mem_ball, dist_zero_right] at this + rw [mem_sphere, dist_zero_right] at h + linarith + obtain ⟨c₁, c₁', g₁, g₂, g₃, g₄, g₅, g₆, g₇, -, g₉⟩ := exists_disc_collar hT hbig.1 hTin p₁ + have hsub12 : closedBall (0 : ℂ) 1 ⊆ closedBall 0 2 := closedBall_subset_closedBall (by norm_num) + have hin₁ : ∀ z ∈ tri, c₁' z ∈ closedBall (0 : ℂ) 1 ∧ c₁ (c₁' z) = z := by + intro z hz + rw [← g₇] at hz + obtain ⟨w, hw, rfl⟩ := hz + rw [g₅ (hsub12 hw)] + exact ⟨hw, rfl⟩ + have hsub3 : tri ⊆ closedBall (0 : ℂ) 3 := fun z hz => (hTin hz).1 + refine ⟨fun z => c₂ (c₁' z), ?_, ?_, ?_, ?_⟩ + · exact (h₁.mono hsub12).comp (g₂.mono hsub3) fun z hz => (hin₁ z hz).1 + · intro z hz z' hz' h + have h₃ := h₅.injOn (hsub12 (hin₁ z hz).1) (hsub12 (hin₁ z' hz').1) h + rw [← (hin₁ z hz).2, ← (hin₁ z' hz').2, h₃] + · ext x + constructor + · rintro ⟨z, hz, rfl⟩ + exact h₇ ▸ mem_image_of_mem c₂ (hin₁ z hz).1 + · intro hx + rw [← h₇] at hx + obtain ⟨w, hw, rfl⟩ := hx + refine ⟨c₁ w, g₇ ▸ mem_image_of_mem c₁ hw, ?_⟩ + simp only + rw [g₅ (hsub12 hw)] + · intro z hz + obtain ⟨w, hw⟩ := p₁.surjective ⟨z, hTb.symm ▸ hz⟩ + have hzw : c₁ w = z := by rw [g₉, hw] + have hwb : (w : ℂ) ∈ closedBall (0 : ℂ) 2 := by simp + simp only + rw [← hzw, g₅ hwb, h₉, g₉] + rfl + +/-- Clamp a real number to the unit interval. -/ +noncomputable def clamp (x : ℝ) : I := projIcc 0 1 zero_le_one x + +theorem clamp_coe (u : I) : clamp u.1 = u := by + simp [clamp] + +theorem continuous_clamp : Continuous clamp := by + change Continuous (projIcc (0 : ℝ) 1 zero_le_one) + exact continuous_projIcc + +theorem clamp_of_mem {x : ℝ} (h₀ : 0 ≤ x) (h₁ : x ≤ 1) : (clamp x).1 = x := by + simp [clamp, projIcc_of_mem zero_le_one (show x ∈ Icc (0 : ℝ) 1 from ⟨h₀, h₁⟩)] + +/-- **Coordinates on a closed disc with three sides.** -/ +theorem exists_square_chart {D : Set S} (hD : IsClosedDisc D) (hman : ∀ x : S, IsInteriorPoint x) + {ε ℓ₀ ℓ₁ : I → S} (hε : Continuous ε) (h₀ : Continuous ℓ₀) (h₁ : Continuous ℓ₁) + (iε : Function.Injective ε) (i₀ : Function.Injective ℓ₀) (i₁ : Function.Injective ℓ₁) + (e00 : ε 0 = ℓ₀ 0) (e10 : ε 1 = ℓ₁ 0) (e11 : ℓ₀ 1 = ℓ₁ 1) + (m₀ : ∀ s t, ε s = ℓ₀ t → s = 0 ∧ t = 0) (m₁ : ∀ s t, ε s = ℓ₁ t → s = 1 ∧ t = 0) + (m₂ : ∀ s t, ℓ₀ s = ℓ₁ t → s = 1 ∧ t = 1) + (hbd : discBd D = range ε ∪ range ℓ₀ ∪ range ℓ₁) : + ∃ G : I × I → S, Continuous G ∧ (∀ u, G (u, 0) = ε u) ∧ (∀ t, G (0, t) = ℓ₀ t) ∧ + (∀ t, G (1, t) = ℓ₁ t) ∧ (∀ u, G (u, 1) = ℓ₀ 1) ∧ InjOn G {p | p.2 < 1} ∧ range G = D ∧ + (∀ p : I × I, 0 < p.1 → p.1 < 1 → 0 < p.2 → p.2 < 1 → G p ∉ discBd D) := by + classical + have hmanP : ∀ x : S, IsManifoldPoint x := fun x => (hman x).isManifoldPoint + obtain ⟨D', hD', hin, -⟩ := exists_disc_around hmanP hD (fun x _ => hman x) isOpen_univ + (subset_univ _) + let β : ℂ → S := fun z => + if z.im = 0 then ε (clamp z.re) else if z.re = z.im / 2 then ℓ₀ (clamp z.im) else ℓ₁ + (clamp z.im) + have hbot : ∀ z : ℂ, z.im = 0 → β z = ε (clamp z.re) := fun z h => by simp [β, h] + have hzero : clamp 0 = 0 := by + have := clamp_coe (0 : I) + simpa using this + have hone : clamp 1 = 1 := by + have := clamp_coe (1 : I) + simpa using this + have hlft : ∀ z : ℂ, z.re = z.im / 2 → β z = ℓ₀ (clamp z.im) := fun z h => by + by_cases h0 : z.im = 0 + · have hr : z.re = 0 := by rw [h, h0]; simp + rw [hbot z h0, hr, h0, hzero, e00] + · simp [β, h0, h] + have hrgt : ∀ z : ℂ, z.re = 1 - z.im / 2 → β z = ℓ₁ (clamp z.im) := fun z h => by + by_cases h0 : z.im = 0 + · have hr : z.re = 1 := by rw [h, h0]; simp + rw [hbot z h0, hr, h0, hzero, hone, e10] + · by_cases h2 : z.re = z.im / 2 + · have hi : z.im = 1 := by linarith + rw [hlft z h2, hi, hone, e11] + · simp [β, h0, h2] + let Bot : Set ℂ := {z | z ∈ tri ∧ z.im = 0} + let Lft : Set ℂ := {z | z ∈ tri ∧ z.re = z.im / 2} + let Rgt : Set ℂ := {z | z ∈ tri ∧ z.re = 1 - z.im / 2} + have cre : Continuous fun z : ℂ => z.re := Complex.continuous_re + have cim : Continuous fun z : ℂ => z.im := Complex.continuous_im + have cBot : IsClosed Bot := isClosed_tri.inter (isClosed_eq cim continuous_const) + have cLft : IsClosed Lft := isClosed_tri.inter (isClosed_eq cre (cim.div_const 2)) + have cRgt : IsClosed Rgt := isClosed_tri.inter (isClosed_eq cre (continuous_const.sub + (cim.div_const 2))) + have hfr : frontier tri = Bot ∪ Lft ∪ Rgt := by + ext z + rw [mem_frontier_tri] + constructor + · rintro ⟨hz, h | h | h⟩ + · exact Or.inl (Or.inl ⟨hz, h⟩) + · exact Or.inl (Or.inr ⟨hz, h⟩) + · exact Or.inr ⟨hz, h⟩ + · rintro ((⟨hz, h⟩ | ⟨hz, h⟩) | ⟨hz, h⟩) + · exact ⟨hz, Or.inl h⟩ + · exact ⟨hz, Or.inr (Or.inl h)⟩ + · exact ⟨hz, Or.inr (Or.inr h)⟩ + have hβc : ContinuousOn β (frontier tri) := by + rw [hfr] + refine ContinuousOn.union_of_isClosed (ContinuousOn.union_of_isClosed ?_ ?_ cBot cLft) ?_ + (cBot.union cLft) cRgt + · exact (hε.comp (continuous_clamp.comp cre)).continuousOn.congr fun z hz => hbot z hz.2 + · exact (h₀.comp (continuous_clamp.comp cim)).continuousOn.congr fun z hz => hlft z hz.2 + · exact (h₁.comp (continuous_clamp.comp cim)).continuousOn.congr fun z hz => hrgt z hz.2 + -- Points of the sides, from their coordinates. + have hreb : ∀ {z : ℂ}, z ∈ tri → 0 ≤ z.re ∧ z.re ≤ 1 := fun ⟨a, _, c, d⟩ + => ⟨by linarith, by linarith⟩ + have ceq : ∀ {x y : ℝ}, 0 ≤ x → x ≤ 1 → 0 ≤ y → y ≤ 1 → clamp x = clamp y → x = y := by + intro x y a b c d h + have := congrArg Subtype.val h + rwa [clamp_of_mem a b, clamp_of_mem c d] at this + have hclamp0 : ∀ {x : ℝ}, 0 ≤ x → x ≤ 1 → clamp x = 0 → x = 0 := fun a b h => + ceq a b le_rfl zero_le_one (h.trans hzero.symm) + have hclamp1 : ∀ {x : ℝ}, 0 ≤ x → x ≤ 1 → clamp x = 1 → x = 1 := fun a b h => + ceq a b zero_le_one le_rfl (h.trans hone.symm) + have hβi : InjOn β (frontier tri) := by + rw [hfr] + rintro z ((⟨hz, a⟩ | ⟨hz, a⟩) | ⟨hz, a⟩) w ((⟨hw, b⟩ | ⟨hw, b⟩) | ⟨hw, b⟩) h + · rw [hbot z a, hbot w b] at h + exact Complex.ext (ceq (hreb hz).1 (hreb hz).2 (hreb hw).1 (hreb hw).2 (iε h)) + (a.trans b.symm) + · rw [hbot z a, hlft w b] at h + obtain ⟨h₃, h₄⟩ := m₀ _ _ h + have i₄ := hclamp0 hw.1 hw.2.1 h₄ + have r₃ := hclamp0 (hreb hz).1 (hreb hz).2 h₃ + exact Complex.ext (by rw [r₃, b, i₄]; simp) (by rw [a, i₄]) + · rw [hbot z a, hrgt w b] at h + obtain ⟨h₃, h₄⟩ := m₁ _ _ h + have i₄ := hclamp0 hw.1 hw.2.1 h₄ + have r₃ := hclamp1 (hreb hz).1 (hreb hz).2 h₃ + exact Complex.ext (by rw [r₃, b, i₄]; simp) (by rw [a, i₄]) + · rw [hlft z a, hbot w b] at h + obtain ⟨h₃, h₄⟩ := m₀ _ _ h.symm + have i₄ := hclamp0 hz.1 hz.2.1 h₄ + have r₃ := hclamp0 (hreb hw).1 (hreb hw).2 h₃ + exact Complex.ext (by rw [r₃, a, i₄]; simp) (by rw [b, i₄]) + · rw [hlft z a, hlft w b] at h + have i₃ := ceq hz.1 hz.2.1 hw.1 hw.2.1 (i₀ h) + exact Complex.ext (by rw [a, b, i₃]) i₃ + · rw [hlft z a, hrgt w b] at h + obtain ⟨h₃, h₄⟩ := m₂ _ _ h + have i₃ := hclamp1 hz.1 hz.2.1 h₃ + have i₄ := hclamp1 hw.1 hw.2.1 h₄ + exact Complex.ext (by rw [a, b, i₃, i₄]; norm_num) (i₃.trans i₄.symm) + · rw [hrgt z a, hbot w b] at h + obtain ⟨h₃, h₄⟩ := m₁ _ _ h.symm + have i₄ := hclamp0 hz.1 hz.2.1 h₄ + have r₃ := hclamp1 (hreb hw).1 (hreb hw).2 h₃ + exact Complex.ext (by rw [r₃, a, i₄]; simp) (by rw [b, i₄]) + · rw [hrgt z a, hlft w b] at h + obtain ⟨h₃, h₄⟩ := m₂ _ _ h.symm + have i₃ := hclamp1 hz.1 hz.2.1 h₄ + have i₄ := hclamp1 hw.1 hw.2.1 h₃ + exact Complex.ext (by rw [a, b, i₃, i₄]; norm_num) (i₃.trans i₄.symm) + · rw [hrgt z a, hrgt w b] at h + have i₃ := ceq hz.1 hz.2.1 hw.1 hw.2.1 (i₁ h) + exact Complex.ext (by rw [a, b, i₃]) i₃ + have hmemb : ∀ u : I, ((u.1 : ℂ)) ∈ tri := fun u => by + refine ⟨by simp, by simp, by simpa using u.2.1, by simpa using u.2.2⟩ + have hmeml : ∀ t : I, triPoint 0 t ∈ tri := fun t => triPoint_mem _ _ + have hmemr : ∀ t : I, triPoint 1 t ∈ tri := fun t => triPoint_mem _ _ + have lre : ∀ t : I, (triPoint 0 t).re = (triPoint 0 t).im / 2 := fun t => by simp [triPoint] + have rre : ∀ t : I, (triPoint 1 t).re = 1 - (triPoint 1 t).im / 2 := fun t => by + simp [triPoint] + ring + have him : ∀ u t : I, (triPoint u t).im = t.1 := fun _ _ => rfl + have bim : ∀ t : I, triPoint t 0 = (t.1 : ℂ) := fun t => Complex.ext (by simp [triPoint]) + (by simp [triPoint]) + have hβs : β '' frontier tri = discBd D := by + rw [hbd, hfr] + apply subset_antisymm + · rintro _ ⟨z, (⟨hz, a⟩ | ⟨hz, a⟩) | ⟨hz, a⟩, rfl⟩ + · rw [hbot z a] + exact Or.inl (Or.inl ⟨_, rfl⟩) + · rw [hlft z a] + exact Or.inl (Or.inr ⟨_, rfl⟩) + · rw [hrgt z a] + exact Or.inr ⟨_, rfl⟩ + · rintro x ((⟨t, rfl⟩ | ⟨t, rfl⟩) | ⟨t, rfl⟩) + · refine ⟨t.1, Or.inl (Or.inl ⟨hmemb t, by simp⟩), ?_⟩ + rw [hbot _ (by simp)] + simp [clamp_coe] + · refine ⟨triPoint 0 t, Or.inl (Or.inr ⟨hmeml t, lre t⟩), ?_⟩ + rw [hlft _ (lre t), him, clamp_coe] + · refine ⟨triPoint 1 t, Or.inr ⟨hmemr t, rre t⟩, ?_⟩ + rw [hrgt _ (rre t), him, clamp_coe] + obtain ⟨ψ, hψc, hψi, hψs, hψb⟩ := exists_tri_map hD hD' hin hβc hβi hβs + have hfrm : ∀ {z}, z ∈ Bot ∪ Lft ∪ Rgt → z ∈ frontier tri := fun h => hfr ▸ h + refine ⟨fun p => ψ (triPoint p.1 p.2), ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · exact hψc.comp_continuous continuous_triPoint fun p => triPoint_mem _ _ + · intro u + have hz : (u.1 : ℂ) ∈ Bot := ⟨hmemb u, by simp⟩ + simp only + rw [bim, hψb _ (hfrm (Or.inl (Or.inl hz))), hbot _ hz.2] + simp [clamp_coe] + · intro t + simp only + rw [hψb _ (hfrm (Or.inl (Or.inr ⟨hmeml t, lre t⟩))), hlft _ (lre t), him, clamp_coe] + · intro t + simp only + rw [hψb _ (hfrm (Or.inr ⟨hmemr t, rre t⟩)), hrgt _ (rre t), him, clamp_coe] + · intro u + have heq : triPoint u 1 = triPoint 0 1 := Complex.ext (by simp [triPoint]) rfl + simp only + rw [heq, hψb _ (hfrm (Or.inl (Or.inr ⟨hmeml 1, lre 1⟩))), hlft _ (lre 1), him, clamp_coe] + · rintro ⟨u, t⟩ ht ⟨u', t'⟩ ht' h + obtain ⟨a, b⟩ := triPoint_inj ht (hψi (triPoint_mem _ _) (triPoint_mem _ _) h) + exact Prod.ext a b + · ext x + constructor + · rintro ⟨p, rfl⟩ + exact hψs ▸ mem_image_of_mem ψ (triPoint_mem _ _) + · intro hx + rw [← hψs] at hx + obtain ⟨z, hz, rfl⟩ := hx + obtain ⟨u, t, rfl⟩ := exists_triPoint hz + exact ⟨(u, t), rfl⟩ + · rintro ⟨u, t⟩ hu0 hu1 ht0 ht1 hmem + rw [← hβs] at hmem + obtain ⟨z, hz, hze⟩ := hmem + have hzt : z ∈ tri := frontier_subset_closure (s := tri) hz |> fun h + => isClosed_tri.closure_eq ▸ h + rw [← hψb z hz] at hze + have heq := hψi hzt (triPoint_mem _ _) hze + have hmem' := mem_frontier_tri.mp hz + rw [heq] at hmem' + have u₀ : (0 : ℝ) < u.1 := hu0 + have u₁ : u.1 < 1 := hu1 + have t₀ : (0 : ℝ) < t.1 := ht0 + have t₁ : t.1 < 1 := ht1 + rcases hmem'.2 with h | h | h + · simp only [triPoint] at h + linarith + · simp only [triPoint] at h + nlinarith + · simp only [triPoint] at h + nlinarith + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/StarChart.lean b/LeanPool/GraphMinor/GM11/StarChart.lean new file mode 100644 index 0000000000..b0da31415e --- /dev/null +++ b/LeanPool/GraphMinor/GM11/StarChart.lean @@ -0,0 +1,239 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.CutEdges +public import LeanPool.GraphMinor.GM11.LocalCone +public import LeanPool.GraphMinor.GM11.RadialFacts + +/-! +# Small star-shaped neighbourhoods of a vertex of the union of a drawing and a radial drawing + +`exists_star_nbhd`: a polar chart gives arbitrarily small open sets around its centre that are +star-shaped, and so +simply-connected. `sector_join`: in such a set around a vertex `s` of `Γ`, each point `y` off `U(Γ ∪ +Γ')` in a region `r` +of `Γ` is joined to an edge of `Γ'` at `s`, inside `r` and inside the set. This uses that edges of +`Γ` and `Γ'` +alternate around `s`. The proof of (6.4) of Graph Minors XI (pages 90–91) needs this to pass a curve +across `s`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- A set of a surface that is preconnected and lies in an open set: two of its points are joined in +that open set. -/ +theorem joinedIn_of_isPreconnected (hS : IsClosedSurface S) {B G : Set S} (hG : IsOpen G) + (hB : IsPreconnected B) + (hsub : B ⊆ G) {a b : S} (ha : a ∈ B) (hb : b ∈ B) : JoinedIn G a b := by + have := IsClosedSurface.locallyConnectedSpace hS + have hco := hG.connectedComponentIn (x := a) + have hpc := isPathConnected_of_isOpen hS hco isPreconnected_connectedComponentIn ⟨a, + mem_connectedComponentIn (hsub ha)⟩ + have hsubc : B ⊆ connectedComponentIn G a := hB.subset_connectedComponentIn ha hsub + exact (hpc.joinedIn a (hsubc ha) b (hsubc hb)).mono (connectedComponentIn_subset G a) + +/-- Small star-shaped open sets around the centre of a polar chart. -/ +theorem exists_star_nbhd {Γ : Drawing S} {z : S} {Φ : C(ClosedUnitDisc, S)} + (hp : IsPolar Γ z Φ) {O : Set S} + (hO : IsOpen O) (hz : z ∈ O) : ∃ D : Set S, IsOpen D ∧ z ∈ D ∧ D ⊆ O ∧ IsSimplyConnectedSet D ∧ + ∀ y ∈ D, ∃ x, Φ x = y ∧ ∀ c : I, Φ (discScale c x) ∈ D := by + let O' : Set S := O ∩ interior (range Φ) + have hO' : IsOpen O' := hO.inter isOpen_interior + let T : Set ClosedUnitDisc := {x | ∀ c : I, Φ (discScale c x) ∈ O'} + have hcont : Continuous fun p : I × ClosedUnitDisc => Φ (discScale p.1 p.2) := + Φ.continuous.comp continuous_discScale + have hTo : IsOpen T := by + have hcl : IsClosed ((fun p : I × ClosedUnitDisc => Φ (discScale p.1 p.2)) ⁻¹' O'ᶜ) := + hO'.isClosed_compl.preimage hcont + have := isClosedMap_snd_of_compactSpace (X := I) (Y := ClosedUnitDisc) _ hcl + convert this.isOpen_compl using 1 + ext x + simp only [T, mem_ofPred_eq, mem_compl_iff, mem_image, mem_preimage, Prod.exists, + exists_eq_right, not_exists, + not_not] + have hT : ∀ x ∈ T, ∀ c : I, discScale c x ∈ T := fun x hx c c' => by + have : discScale c' (discScale c x) = discScale (c' * c) x := Subtype.ext (by + simp [discScale, mul_smul]) + rw [this] + exact hx _ + have hc : polarCentre ∈ T := fun c => by + have : discScale c polarCentre = polarCentre := Subtype.ext (by simp [discScale, polarCentre]) + rw [this, hp.centre] + exact ⟨hz, hp.nhd⟩ + have hemb := (Φ.continuous.isClosedEmbedding hp.inj).isEmbedding + obtain ⟨G, hG, hGT⟩ := hemb.isInducing.isOpen_iff.mp hTo + have hTO : ∀ x ∈ T, Φ x ∈ O' := fun x hx => by + simpa [discScale_one] using hx 1 + have hD : Φ '' T = G ∩ O' := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + exact ⟨(hGT ▸ hx : x ∈ Φ ⁻¹' G), hTO x hx⟩ + · rintro ⟨hyG, hyO⟩ + obtain ⟨x, rfl⟩ := interior_subset hyO.2 + exact ⟨x, (hGT ▸ (hyG : x ∈ Φ ⁻¹' G) : x ∈ T), rfl⟩ + refine ⟨Φ '' T, hD ▸ hG.inter hO', ⟨_, hc, hp.centre⟩, ?_, isSimplyConnected_star hp.inj hT ⟨_, + hc⟩, ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + exact (hTO x hx).1 + · rintro _ ⟨x, hx, rfl⟩ + exact ⟨x, rfl, fun c => ⟨_, hT x hx c, rfl⟩⟩ + +variable [ConnectedSpace S] {Γ Γ' : Drawing S} (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') + (hS : IsClosedSurface S) + +include hrad hS + +/-- **The sectors at a vertex.** The point `y` of a star-shaped set `D` around the vertex `s` of `Γ` +lies in a region +`r` of `Γ`, and off `U(Γ ∪ Γ')`. Then `y` is joined in `r ∩ D` to a point of an edge of `Γ'` at `s`. +-/ +theorem sector_join (hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ') (hE : Γ.E.Nonempty) {γ : Set S + → I → S} + (hγ : EdgePar (radialUnion hrad) γ) {s : S} (hs : s ∈ Γ.V) + {next : halfEdges (radialUnion hrad) γ s → halfEdges (radialUnion hrad) γ s} + {ρ P Q : halfEdges (radialUnion hrad) γ s → Set S} {W : Set S} {τ : halfEdges + (radialUnion hrad) γ s → I} + (hsec : IsSectors (radialUnion hrad) γ s next ρ P W Q τ) {Φ : C(ClosedUnitDisc, S)} + (hΦ : IsPolar (radialUnion hrad) s Φ) {D : Set S} (hDo : IsOpen D) (hsD : s ∈ D) (hDW : D ⊆ W) + (hstar : ∀ y ∈ D, ∃ x, Φ x = y ∧ ∀ c : I, Φ (discScale c x) ∈ D) {r : Set S} + (hr : r ∈ Γ.R) {y : S} + (hy : y ∈ r) (hyD : y ∈ D) (hyU : y ∉ (radialUnion hrad).U) : + ∃ k : halfEdges (radialUnion hrad) γ s, k.1.1 ∈ Γ'.E ∧ ∃ t : I, 0 < t ∧ (∀ u, u ≤ t + → spoke γ k.1 u ∈ D) ∧ + spoke γ k.1 t ∈ r ∧ JoinedIn (r ∩ D) y (spoke γ k.1 t) := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hcor := IsSectors.corners hsec + have hsU : s ∈ (radialUnion hrad).U := (radialUnion hrad).V_subset_U (by + rw [radialUnion_V] + exact radial_V hrad hs) + obtain ⟨x₀, rfl, hray⟩ := hstar y hyD + have hx₀ : x₀ ≠ polarCentre := fun h => hyU (by rw [h, hΦ.centre]; exact hsU) + obtain ⟨k, hyk⟩ := mem_iUnion.mp (IsSectors.cover hsec ⟨hDW hyD, hyU⟩) + have hR := IsCorners.region hcor k + have hyρ : Φ x₀ ∈ ρ k := IsSectors.sub hsec k hyk + -- `ρ k` lies in `r`. + obtain ⟨r', hr', hρr'⟩ := exists_region_of_sub hrad hR + have hrr : r' = r := region_eq_of_mem hr' hr (hρr' hyρ) hy + subst hrr + -- The points of the ray. + let g : I → S := fun c => Φ (discScale c x₀) + have hg : Continuous g := (Φ.continuous.comp continuous_discScale).comp + (Continuous.prodMk continuous_id continuous_const) + have hg0 : g 0 = s := by simp only [g, discScale_zero, hΦ.centre] + have hg1 : g 1 = Φ x₀ := by simp only [g, discScale_one] + have hgρ : ∀ c, 0 < c → g c ∈ ρ k := fun c hc => by + obtain ⟨a, ha, h₁, h₂⟩ := hΦ.ray x₀ hx₀ c hc + rcases ha with (⟨v, hv, rfl⟩ | ha) | ha + · exact absurd (mem_singleton_iff.mp h₁ ▸ (radialUnion hrad).V_subset_U hv) hyU + · exact absurd ((ha.2.1 h₁).1) hyU + · rwa [region_eq_of_mem ha hR h₁ hyρ] at h₂ + let Ray : Set S := g '' Ioi 0 + have hRayc : IsPreconnected Ray := (isPreconnected_Ioi.image g hg.continuousOn) + have hRayU : ∀ z ∈ Ray, z ∉ (radialUnion hrad).U ∧ z ∈ D := by + rintro _ ⟨c, hc, rfl⟩ + exact ⟨region_subset hR (hgρ c hc), hray c⟩ + let In : halfEdges (radialUnion hrad) γ s → Set S := fun j => W ∩ (interior (Q j)) + have hIn : ∀ j, IsOpen (In j) := fun j => (IsSectors.isOpen hsec).inter isOpen_interior + have hint : ∀ j, Q j \ discBd (Q j) = interior (Q j) := fun j => by + have hd := IsSectors.disc hsec j + have := IsClosedDisc.frontier_eq_discBd hS hd + rw [← this, frontier, (IsClosedDisc.isCompact hd).isClosed.closure_eq] + ext x + constructor + · rintro ⟨h₁, h₂⟩ + by_contra h + exact h₂ ⟨h₁, h⟩ + · exact fun h => ⟨interior_subset h, fun h' => h'.2 h⟩ + have hcov : ∀ z ∈ Ray, ∃ j, z ∈ In j := fun z hz => by + obtain ⟨hzU, hzD⟩ := hRayU z hz + obtain ⟨j, hj⟩ := mem_iUnion.mp (IsSectors.cover hsec ⟨hDW hzD, hzU⟩) + refine ⟨j, hDW hzD, ?_⟩ + rw [← hint j] + exact ⟨IsSectors.subQ hsec j hj, fun h => hzU (IsSectors.bdU hsec j ⟨hDW hzD, h⟩)⟩ + have hdisj : ∀ z ∈ Ray, ∀ j j', z ∈ In j → z ∈ In j' → j = j' := fun z hz j j' h h' => by + by_contra hne + exact (hRayU z hz).1 (IsSectors.inter hsec j j' hne ⟨interior_subset h.2, interior_subset h'.2⟩) + have hy1 : Φ x₀ ∈ In k := by + obtain ⟨j, hj⟩ := hcov (Φ x₀) ⟨1, zero_lt_one, hg1⟩ + refine ⟨hDW hyD, ?_⟩ + rw [← hint k] + exact ⟨IsSectors.subQ hsec k hyk, fun h => hyU (IsSectors.bdU hsec k ⟨hDW hyD, h⟩)⟩ + have hRayk : Ray ⊆ In k := by + intro z hz + by_contra hzk + obtain ⟨j, hj⟩ := hcov z hz + obtain ⟨w, hw, hw₁, hw₂⟩ := hRayc (In k) (⋃ j, ⋃ _ : j ≠ k, In j) (hIn k) + (isOpen_iUnion fun j => isOpen_iUnion fun _ => hIn j) (fun w hw => by + obtain ⟨j, hj⟩ := hcov w hw + by_cases hjk : j = k + · exact Or.inl (hjk ▸ hj) + · exact Or.inr (mem_iUnion₂.mpr ⟨j, hjk, hj⟩)) ⟨_, ⟨1, zero_lt_one, hg1⟩, hy1⟩ + ⟨z, hz, mem_iUnion₂.mpr ⟨j, fun h => hzk (h ▸ hj), hj⟩⟩ + obtain ⟨j', hj', hw₂'⟩ := mem_iUnion₂.mp hw₂ + exact hj' (hdisj w hw j' k hw₂' hw₁) + -- The side of the sector near `s`. + obtain ⟨A, W', hW', hsW', hAc, hAQ, hAb, hAD, hin, hcl⟩ := exists_half_nbhd + (IsSectors.disc hsec k) + hDo.isClosed_compl (IsSectors.bd hsec k) (fun h => h hsD) + have hAD' : A ⊆ D := fun a ha => by + by_contra h + exact disjoint_left.mp hAD ha h + have hAρ : A ⊆ r' := fun a ha => + hρr' (IsSectors.sub hsec k (IsSectors.inside hsec k ⟨⟨hDW (hAD' ha), hAQ ha⟩, disjoint_left.mp + hAb ha⟩)) + -- A point of the ray in `A`. + obtain ⟨u, hu, -, hule⟩ := exists_pos_le hg hW' (by rw [hg0]; exact hsW') (zero_lt_one' I) + have hzRay : g u ∈ Ray := ⟨u, hu, rfl⟩ + have hzA : g u ∈ A := by + refine hin ⟨⟨hule u le_rfl, interior_subset (hRayk hzRay).2⟩, ?_⟩ + exact fun h => (hRayU _ hzRay).1 (IsSectors.bdU hsec k ⟨(hRayk hzRay).1, h⟩) + -- The corner has an edge of `Γ'`. + have hedge : ∃ j : halfEdges (radialUnion hrad) γ s, j.1.1 ∈ Γ'.E ∧ ∀ t, t ≤ τ j + → spoke γ j.1 t ∈ discBd (Q k) := by + rcases corner_has_spoke hrad hS hmax hE hγ hs hsec k with h | h + · exact ⟨k, h, IsSectors.left hsec k⟩ + · exact ⟨next k, h, IsSectors.right hsec k⟩ + obtain ⟨j, hjE, hjb⟩ := hedge + have hjs : spoke γ j.1 0 = s := by rw [spoke_zero]; exact j.2.2 + obtain ⟨t, ht, htτ, htle⟩ := exists_pos_le (continuous_spoke hγ j.2.1) (hW'.inter hDo) + (by rw [hjs]; exact ⟨hsW', hsD⟩) (IsSectors.pos hsec j) + have hptcl : spoke γ j.1 t ∈ closure A := hcl ⟨(htle t le_rfl).1, hjb t htτ⟩ + have hpte := spoke_mem_edge hγ j.2.1 ht + obtain ⟨-, -, r₁, hr₁, -, -, -, -, hsub⟩ := spoke_ends hrad hS hjE + obtain ⟨a, ha₁, ha⟩ := mem_closure_iff.mp hptcl r₁ (region_isOpen hr₁) (hsub hpte) + obtain rfl : r₁ = r' := region_eq_of_mem hr₁ hr' ha₁ (hAρ ha) + have hptr : spoke γ j.1 t ∈ r₁ := hsub hpte + refine ⟨j, hjE, t, ht, fun v hv => (htle v hv).2, hptr, ?_⟩ + -- Joining. + have hB₁ : IsPreconnected (insert (spoke γ j.1 t) A) := + hAc.subset_closure (subset_insert _ _) (insert_subset hptcl subset_closure) + have hB : IsPreconnected (Ray ∪ insert (spoke γ j.1 t) A) := + hRayc.union (g u) hzRay (Or.inr hzA) hB₁ + refine joinedIn_of_isPreconnected hS ((region_isOpen hr₁).inter hDo) hB ?_ (Or.inl ⟨1, + zero_lt_one, hg1⟩) + (Or.inr (mem_insert _ _)) + rintro z (hz | rfl | hz) + · obtain ⟨c, hc, rfl⟩ := hz + exact ⟨hρr' (hgρ c hc), hray c⟩ + · exact ⟨hptr, (htle t le_rfl).2⟩ + · exact ⟨hAρ hz, hAD' hz⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Theorem61.lean b/LeanPool/GraphMinor/GM11/Theorem61.lean new file mode 100644 index 0000000000..4ac2f4824a --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Theorem61.lean @@ -0,0 +1,307 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PaintingFlat +public import LeanPool.GraphMinor.GM11.Theorem63 +public import LeanPool.GraphMinor.GM11.Section5c +public import LeanPool.GraphMinor.GM11.GlueDiscs + +/-! +# Theorem (6.1) of Graph Minors XI + +Graph Minors XI, (6.1), page 87: the pretangle induced from a slope is a respectful pretangle, and +the slope is derived +from it. + +The first and third parts follow the paper. For respectfulness we take another route. In a sphere, +each `O`-arc bounds two discs that are each other's outside, so the first tangle axiom picks one of +them. In any other +surface, a `Γ`-normal `O`-arc `F` with `|F ∩ V(Γ)| < θ` lies in the flat set of +`exists_flat_regions`, so it is +null-homotopic and bounds a disc `Δ`. Claims (1) and (2) of (6.4) then decide that `(Γ ∩ Δ, Γ ∩ +closure (Σ - Δ)) ∈ 𝒯`. +So we do not need the step of the paper that perturbs `F` onto a circuit of `Γ'`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +section Sep + +variable {Γ : PaintingOrDrawing S} + +omit [T2Space S] in +/-- For a closed set `X`, `Γ ∩ X` is a subhypergraph of `Γ`. -/ +theorem inter_le {X : Set S} (hX : IsClosed X) : + Γ.inter X ≤ Γ.toHypergraph where + vertexSet_subset := fun _ h => Γ.toHypergraph_vertexSet ▸ h.1 + edgeSet_subset := fun _ h => Γ.toHypergraph_edgeSet ▸ h.1 + ends_eq := fun e he => by + ext v + exact ⟨fun h => ⟨h, he.2, hX.closure_subset_iff.mpr he.2 + (PaintingOrDrawing.toHypergraph_inc.mp h).2.2⟩, fun h => h.1⟩ + +omit [T2Space S] in +/-- A closed set whose frontier is `Γ`-normal gives a separation of `Γ`. -/ +theorem isSeparation_inter {Δ : Set S} (hΔ : IsClosed Δ) (hn : frontier Δ ∩ Γ.U ⊆ Γ.V) : + Γ.toHypergraph.IsSeparation (Γ.inter Δ) + (Γ.interOutside Δ) := by + have hcov : ∀ x, x ∈ Δ ∨ x ∈ closure (univ \ Δ) := fun x => by + by_cases hx : x ∈ Δ + · exact Or.inl hx + · exact Or.inr (subset_closure ⟨mem_univ x, hx⟩) + have hedge : ∀ e ∈ Γ.E, e ⊆ Δ ∨ e ⊆ closure (univ \ Δ) := fun e he => by + by_cases heΔ : e ⊆ Δ + · exact Or.inl heΔ + · right + obtain ⟨x, hx, hxΔ⟩ := not_subset.mp heΔ + have hsu : e ⊆ interior Δ ∪ Δᶜ := fun y hy => by + by_cases hyi : y ∈ Δ + · refine Or.inl ?_ + by_contra hn' + have hyf : y ∈ frontier Δ := ⟨subset_closure hyi, hn'⟩ + exact disjoint_left.mp (Γ.edge_props he).2.1 hy (hn ⟨hyf, (Γ.edge_props he).2.2.1 hy⟩) + · exact Or.inr hyi + have hec : IsPreconnected e := (Γ.edge_props he).1 + have := hec.subset_right_of_subset_union isOpen_interior hΔ.isOpen_compl + (disjoint_left.mpr fun x h₁ h₂ => h₂ (interior_subset h₁)) hsu ⟨x, hx, hxΔ⟩ + exact fun y hy => subset_closure ⟨mem_univ y, this hy⟩ + refine ⟨inter_le hΔ, inter_le isClosed_closure, ?_, ?_⟩ + · apply Hypergraph.ext + · change (Γ.V ∩ Δ) ∪ (Γ.V ∩ closure (univ \ Δ)) = Γ.toHypergraph.vertexSet + rw [Γ.toHypergraph_vertexSet] + ext x + constructor + · rintro (h | h) <;> exact h.1 + · intro h + exact (hcov x).imp (fun h' => ⟨h, h'⟩) fun h' => ⟨h, h'⟩ + · change {e | e ∈ Γ.E ∧ e ⊆ Δ} ∪ {e | e ∈ Γ.E ∧ e ⊆ closure (univ \ Δ)} = Γ.toHypergraph.edgeSet + rw [Γ.toHypergraph_edgeSet] + ext e + constructor + · rintro (h | h) <;> exact h.1 + · intro h + exact (hedge e h).imp (fun h' => ⟨h, h'⟩) fun h' => ⟨h, h'⟩ + · funext e v + apply propext + change (Γ.toHypergraph.Inc e v ∧ e ⊆ Δ ∧ v ∈ Δ) ∨ + (Γ.toHypergraph.Inc e v ∧ e ⊆ closure (univ \ Δ) ∧ v ∈ closure + (univ \ Δ)) ↔ Γ.toHypergraph.Inc e v + constructor + · rintro (h | h) <;> exact h.1 + · intro h + have hi := PaintingOrDrawing.toHypergraph_inc.mp h + rcases hedge e hi.1 with h' | h' + · exact Or.inl ⟨h, h', hΔ.closure_subset_iff.mpr h' hi.2.2⟩ + · exact Or.inr ⟨h, h', isClosed_closure.closure_subset_iff.mpr h' hi.2.2⟩ + · refine eq_empty_of_forall_notMem fun e he => ?_ + obtain ⟨⟨he₁, h₁⟩, ⟨-, h₂⟩⟩ := he + obtain ⟨y, hy⟩ := (Γ.edge_props he₁).2.2.2 + have hyf : y ∈ frontier Δ := by + rw [frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] + exact ⟨subset_closure (h₁ hy), h₂ hy⟩ + exact disjoint_left.mp (Γ.edge_props he₁).2.1 hy (hn ⟨hyf, (Γ.edge_props he₁).2.2.1 hy⟩) + +omit [T2Space S] in +/-- The vertices common to the two sides lie on the frontier. -/ +theorem inter_outside_subset {Δ : Set S} {x : S} + (hx : x ∈ (Γ.inter Δ ∩ Γ.interOutside Δ).vertexSet) : + x ∈ frontier Δ ∩ Γ.V := by + obtain ⟨⟨hxV, hxΔ⟩, -, hxc⟩ := hx + refine ⟨?_, hxV⟩ + rw [frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] + exact ⟨subset_closure hxΔ, hxc⟩ + +end Sep + +variable [ConnectedSpace S] {Γ : PaintingOrDrawing S} {Γ' : Drawing S} {θ : ℕ} {ins : Drawing S + → Set S} + +/-- `RegionFacts` for a painting or drawing. -/ +theorem regionFacts_any (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) (hrad : Γ.IsRadialDrawing Γ') : + RegionFacts Γ Γ' := by + cases Γ with + | painting Γ => exact regionFacts_of_painting ⟨hrad.1, hrad.2.1⟩ hrad.2.2 hS hE + | drawing Γ => exact regionFacts_of_radial ⟨hrad.1, hrad.2.1⟩ hS hrad.2.2 hE + +/-- **Graph Minors XI, (6.1)** (page 87), the first part: the set induced from a slope is a +pretangle. -/ +theorem isPretangle_induced (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) + (hrad : Γ.IsRadialDrawing Γ') (hθ : 1 ≤ θ) (hsl : IsSlope Γ' (2 * θ) ins) : + IsPretangle Γ.toHypergraph θ (inducedPretangle Γ Γ' θ ins) := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hf : RegionFacts Γ Γ' := regionFacts_any hS hE hrad + have hw : IsWeighting Γ' (2 * θ) Γ.V θ := isWeighting_radial hθ hrad.2.1.2.1 + (bipartite_of_preRadial hrad.2.1) + refine ⟨hθ, fun A B h => h.1, fun A B h => h.2.1, fun A B hsep hord => ?_, + fun A₁ B₁ A₂ B₂ A₃ B₃ h₁ h₂ h₃ hU => ?_⟩ + · rcases (small_or_small hS hf hsl hw hsep hord).1 with h | h + · exact Or.inl ⟨hsep, hord, h⟩ + · exact Or.inr ⟨hsep.symm, by rwa [GM10.separationOrder_comm], h⟩ + · refine theorem_5_5_proof hS hsl hw h₁.2.2 h₂.2.2 h₃.2.2 ?_ + ext s + constructor + · rintro ((h | h) | h) <;> exact h.1 + · intro hs + obtain ⟨e, he, hes⟩ := hf.1 s hs + have he' : e ∈ (A₁ ∪ A₂ ∪ A₃).edgeSet := by + rw [hU] + exact Γ.toHypergraph_edgeSet ▸ he + rcases he' with (h | h) | h + · exact Or.inl (Or.inl ⟨hs, e, h, hes⟩) + · exact Or.inl (Or.inr ⟨hs, e, h, hes⟩) + · exact Or.inr ⟨hs, e, h, hes⟩ + +/-- **Graph Minors XI, (6.1)** (page 87), the last part: "`ins` is the slope derived from `𝒯`". -/ +theorem isDerivedSlope_induced (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) + (hrad : Γ.IsRadialDrawing Γ') (hsl : IsSlope Γ' (2 * θ) ins) : + IsDerivedSlope Γ Γ' θ (inducedPretangle Γ Γ' θ ins) ins := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hf : RegionFacts Γ Γ' := regionFacts_any hS hE hrad + intro C hC hCs hl + have hd := hsl.isClosedDisc C hC hCs hl + have hb := hsl.subBd_eq C hC hCs hl + refine ⟨hd, hb, ?_⟩ + have hfr : frontier (ins C) = C.U := by rw [← subBd_eq_frontier, hb] + have hcl := (IsClosedDisc.isCompact hd).isClosed + have hsep := isSeparation_inter (Γ := Γ) hcl (by + rw [hfr] + rintro x ⟨hx, hxU⟩ + exact hrad.2.1.1.subset ⟨hxU, hCs.U_subset hx⟩) + have hord : separationOrder (Γ.inter (ins C)) + (Γ.interOutside (ins C)) < θ := by + have h₁ := two_mul_ncard_le_length Γ.V (bipartite_of_preRadial hrad.2.1) hC hCs + have h₂ : (Γ.V ∩ C.V).Finite := C.finite_V.subset inter_subset_right + have h₃ := ncard_le_ncard (s := (Γ.inter (ins C) ∩ + Γ.interOutside (ins C)).vertexSet) (fun x hx => by + have := inter_outside_vertex hrad.2.1.2.1 hCs hfr hx + exact ⟨this.2, this.1⟩) h₂ + rw [separationOrder] + omega + refine ⟨hsep, hord, ?_⟩ + have hZ : PaintingOrDrawing.regionsIncludingEdge Γ' (Γ.inter (ins C)) = + insideRegions Γ' (ins C) := by + ext s + constructor + · rintro ⟨hs, e, he, hes⟩ + obtain ⟨y, hy⟩ := (Γ.edge_props he.1).2.2.2 + refine ⟨hs, (region_subset_or_disjoint hsl hC hCs hl hs).resolve_right fun h => ?_⟩ + exact disjoint_left.mp h (hes hy) (he.2 hy) + · rintro ⟨hs, hsi⟩ + obtain ⟨e, he, hes⟩ := hf.1 s hs + exact ⟨hs, e, ⟨he, hes.trans hsi⟩, hes⟩ + have hN := boundaryDrawing_inside hS hsl hC hCs hl + rw [hZ] + refine ⟨?_, ?_⟩ + · rw [hN] + have h₁ := two_mul_ncard_le_length Γ.V (bipartite_of_preRadial hrad.2.1) hC hCs + change (Γ.V ∩ C.V).ncard < θ + omega + · rintro r ⟨-, hr⟩ + rw [hN] + exact ⟨C, hC, Drawing.IsSubdrawing.refl C, hl, hr⟩ + +/-- **Graph Minors XI, (6.1)** (page 87), the middle part: the pretangle induced from a slope is +respectful. -/ +theorem isRespectful_induced (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) + (hrad : Γ.IsRadialDrawing Γ') (hθ : 1 ≤ θ) (hsl : IsSlope Γ' (2 * θ) ins) : + Γ.IsRespectful θ (inducedPretangle Γ Γ' θ ins) := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hf : RegionFacts Γ Γ' := regionFacts_any hS hE hrad + have hVf : Γ.V.Finite := Γ.toHypergraph_vertexSet ▸ Γ.toHypergraph.vertexSet_finite + have hT := isPretangle_induced hS hE hrad hθ hsl + have hd := isDerivedSlope_induced hS hE hrad hsl + refine ⟨inferInstance, fun F hF hN hk => ?_⟩ + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + -- A closed disc bounded by `F` gives a separation of small order. + have hsepΔ : ∀ Δ : Set S, IsClosedDisc Δ → discBd Δ = F → + Γ.toHypergraph.IsSeparation (Γ.inter Δ) + (Γ.interOutside Δ) ∧ + separationOrder (Γ.inter Δ) (Γ.interOutside Δ) < θ := by + intro Δ hΔ hb + have hfr : frontier Δ = F := by rw [IsClosedDisc.frontier_eq_discBd hS hΔ, hb] + refine ⟨isSeparation_inter (IsClosedDisc.isCompact hΔ).isClosed (by rw [hfr]; exact hN), ?_⟩ + refine (ncard_le_ncard (fun x hx => ?_) (hVf.subset inter_subset_right)).trans_lt hk + rw [← hfr] + exact inter_outside_subset hx + have hbd : ∀ Δ : Set S, IsClosedDisc Δ → subBd Δ = discBd Δ := fun Δ hΔ => by + rw [subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hS hΔ] + by_cases hsph : IsSphere S + · obtain ⟨Δ₁, Δ₂, -, hΔ₁, hΔ₂, hb₁, hb₂, hcup, hcap, -, -⟩ := sphere_disc S hsph F hF + have hout : ∀ {Δ Δ' : Set S}, IsClosedDisc Δ → IsClosedDisc Δ' → discBd Δ' = F → Δ ∪ Δ' = univ + → Δ ∩ Δ' = F → + closure (univ \ Δ) = Δ' := fun {Δ Δ'} h h' hb' hu hi => by + apply Subset.antisymm + · refine closure_minimal (fun x hx => ?_) (IsClosedDisc.isCompact h').isClosed + exact ((hu.ge (mem_univ x)).resolve_left hx.2) + · refine (IsClosedDisc.subset_closure_discInt h').trans (closure_mono fun x hx => ?_) + refine ⟨mem_univ x, fun hxΔ => hx.2 ?_⟩ + rw [hb', ← hi] + exact ⟨hxΔ, hx.1⟩ + have h₁₂ := hout hΔ₁ hΔ₂ hb₂ hcup hcap + have h₂₁ := hout hΔ₂ hΔ₁ hb₁ (by rw [union_comm, hcup]) (by rw [inter_comm, hcap]) + obtain ⟨hsep, hord⟩ := hsepΔ Δ₁ hΔ₁ hb₁ + rcases hT.axiom1 hsep hord with h | h + · exact ⟨Δ₁, hΔ₁, (hbd _ hΔ₁).trans hb₁, h⟩ + · refine ⟨Δ₂, hΔ₂, (hbd _ hΔ₂).trans hb₂, ?_⟩ + have e₁ : Γ.interOutside Δ₁ = Γ.inter Δ₂ := by + rw [PaintingOrDrawing.interOutside, h₁₂] + have e₂ : Γ.interOutside Δ₂ = Γ.inter Δ₁ := by + rw [PaintingOrDrawing.interOutside, h₂₁] + rw [e₂] + rwa [e₁] at h + · have hnull : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < 2 * θ + → IsNullHomotopicOArc C.U := + fun C hC hCs hl => null_of_short hd hC hCs hl + obtain ⟨D, -, hsD, hfl⟩ := exists_flat_of_not_sphere hS hsph hE hrad hθ hnull (S₀ + := F ∩ Γ.V) inter_subset_right + (hVf.subset inter_subset_right) hk + have hFK : F ⊆ (⋃ r ∈ Γ.R, r) ∪ ⋃ s ∈ F ∩ Γ.V, D s := fun x hx => by + by_cases hxU : x ∈ Γ.U + · have hxV : x ∈ F ∩ Γ.V := ⟨hx, hN ⟨hx, hxU⟩⟩ + exact Or.inr (mem_iUnion₂.mpr ⟨x, hxV, hsD x hxV⟩) + · obtain ⟨r, hr, hxr⟩ := exists_mem_region hxU + exact Or.inl (mem_iUnion₂.mpr ⟨r, hr, hxr⟩) + have hFn := null_of_flat hfl hF hFK + have hbdS : Disjoint F (bd S) := disjoint_left.mpr fun x _ hx => hx (hS.2.2 x) + obtain ⟨Δ, -, hΔ, hb⟩ := (epstein S univ F (IsClosedSurface.isSurface hS) inferInstance hF + (subset_univ _) + hbdS).1 hFn + obtain ⟨hsep, hord⟩ := hsepΔ Δ hΔ hb + refine ⟨Δ, hΔ, (hbd _ hΔ).trans hb, ?_⟩ + refine (hT.axiom1 hsep hord).resolve_right fun hBA => ?_ + have hUA : PaintingOrDrawing.underlying (Γ.inter Δ) ⊆ Δ := by + rintro x (hx | hx) + · exact hx.2 + · obtain ⟨e, he, hxe⟩ := hx + exact he.2 hxe + obtain ⟨F', hF', hsub, hnn⟩ := exists_oArc_of_null_any hS hsph hE hrad hθ hd hsep hord fun G hG + hGo => + isNullHomotopicOArcIn_of_subset_disc hGo (subset_univ _) hΔ (hG.trans hUA) + obtain ⟨k', C, hC, hcov⟩ := circuits_of_small hS hf hrad.2.1.1 hsep.symm hBA.2.2 + exact hnn (no_oArc_of_circuits hS hsph hθ hrad hd hBA.2.1 hC hcov hF' fun x hx => (hsub hx).1) + +/-- **Graph Minors XI, (6.1)** (page 87). -/ +theorem theorem_6_1_proof (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) + (hrad : Γ.IsRadialDrawing Γ') (hθ : 1 ≤ θ) (hsl : IsSlope Γ' (2 * θ) ins) : + IsPretangle Γ.toHypergraph θ (inducedPretangle Γ Γ' θ ins) ∧ + Γ.IsRespectful θ (inducedPretangle Γ Γ' θ ins) ∧ + IsDerivedSlope Γ Γ' θ (inducedPretangle Γ Γ' θ ins) ins := + ⟨isPretangle_induced hS hE hrad hθ hsl, isRespectful_induced hS hE hrad hθ hsl, + isDerivedSlope_induced hS hE hrad hsl⟩ + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Theorem63.lean b/LeanPool/GraphMinor/GM11/Theorem63.lean new file mode 100644 index 0000000000..bbe23d49f1 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Theorem63.lean @@ -0,0 +1,49 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PaintingFacts +public import LeanPool.GraphMinor.GM14.Cited + +/-! +# Graph Minors XI, (6.3) + +The paper states without proof (Section 3, page 75): "every region of $\Gamma'$ includes a unique +edge of +$\Gamma$", "unless $|V(\Gamma)| = 1$ and $E(\Gamma) = \emptyset$", and adds: "We omit the proofs of +these assertions, which +are elementary but rather tedious." The same sentence is used for the vertices on the closure of a +region (proof of (6.5), page 91). + +This is `regionFacts_of_radial` for a drawing and `regionFacts_of_painting` for a painting. With +them, +`theorem_6_3` proves `GM14.GM11Theorem63Statement` with no hypothesis, by the paper's proof. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open GraphMinor.Surface + +universe u + +/-- **(6.3)** of Graph Minors XI (page 89). -/ +theorem theorem_6_3_proof : GM14.GM11Theorem63Statement.{u} := by + intro S _ _ hS hc Γ Γ' θ T ins _ hE hT _ hrad hd + have : T2Space S := hS.2.1 + cases Γ with + | drawing Γ => + exact theorem_6_3_of_regionFacts hS hT hrad.2.1 hd (regionFacts_of_radial ⟨hrad.1, + hrad.2.1⟩ hS hrad.2.2 hE) + | painting Γ => + exact theorem_6_3_of_regionFacts hS hT hrad.2.1 hd (regionFacts_of_painting ⟨hrad.1, + hrad.2.1⟩ hrad.2.2 hS hE) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Theorem64.lean b/LeanPool/GraphMinor/GM11/Theorem64.lean new file mode 100644 index 0000000000..89fdddfe26 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Theorem64.lean @@ -0,0 +1,272 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PaintingFlat +public import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Theorem (6.4) of Graph Minors XI + +Graph Minors XI, (6.4), page 90. Claims (1) and (2) of the proof are in `Section64.lean` and +`Section64b.lean`. + +`edge_nonempty` is the first line of the proof: "Since $\Gamma$ is 2-cell and $\Sigma$ is not a +sphere, it follows that +$E(\Gamma) \ne \emptyset$." + +For the last sentence, the paper shows that `U(K_e)` includes no non-null-homotopic `O`-arc when `e` +has few ends. +We use (2) in place of that: if `(Γ \ e, K_e) ∈ 𝒯`, then (1) and (2) give a non-null-homotopic +`O`-arc in +`U(K_e) - U(Γ \ e) ⊆ e`, and an edge includes no `O`-arc. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- A finite set in a `T₁` space is flat, since each path in it is constant. -/ +theorem flat_of_finite [T1Space S] {Z : Set S} (hZ : Z.Finite) : Flat Z := by + have hconst : ∀ {a b : S} (p : Path a b), (∀ u, p u ∈ Z) → ∀ u, p u = a := fun {a b} p hp u => by + by_contra hu + obtain ⟨z, -, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp (isPreconnected_range p.continuous) {a} + (Z \ {a}) + isClosed_singleton (hZ.subset sdiff_subset).isClosed (fun x hx => by + obtain ⟨v, rfl⟩ := hx + by_cases h : p v = a + · exact Or.inl h + · exact Or.inr ⟨hp v, h⟩) ⟨a, ⟨0, by simp⟩, rfl⟩ ⟨p u, ⟨u, rfl⟩, hp u, hu⟩ + exact hz₂.2 hz₁ + intro a b p q hp hq + have : p = q := Path.ext (funext fun u => (hconst p hp u).trans (hconst q hq u).symm) + rw [this] + +variable [T2Space S] [ConnectedSpace S] + +/-- An edge of a drawing includes no `O`-arc. -/ +theorem not_oArc_subset_edge {Γ : Drawing S} {e F : Set S} (he : e ∈ Γ.E) (hF : IsOArc F) + (hFe : F ⊆ e) : False := by + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + have hc := hγ.cont e he + have hFc : IsCompact F := isCompact_of_isOArc hF + have hP : IsCompact (γ e ⁻¹' F) := (hFc.isClosed.preimage hc).isCompact + obtain ⟨x, hx⟩ := (infinite_of_isOArc hF).nonempty + obtain ⟨t, ht, rfl⟩ : x ∈ γ e '' Ioo 0 1 := (hγ.image e he).symm ▸ hFe hx + have hne : (γ e ⁻¹' F).Nonempty := ⟨t, hx⟩ + obtain ⟨a, ha, hale⟩ := hP.exists_isLeast hne + obtain ⟨b, hb, hble⟩ := hP.exists_isGreatest hne + have hIoo : ∀ u, u ∈ γ e ⁻¹' F → u ∈ Ioo (0 : I) 1 := fun u hu => by + constructor + · refine lt_of_le_of_ne (unitInterval.nonneg u) fun h => ?_ + exact edge_notMem_V he (hFe hu) (h ▸ hγ.zero e he) + · refine lt_of_le_of_ne (unitInterval.le_one u) fun h => ?_ + exact edge_notMem_V he (hFe hu) (h.symm ▸ hγ.one e he) + have hab : a.1 ≤ b.1 := hale hb + have hne' : a.1 ≠ b.1 := fun h => by + have hsub : F ⊆ {γ e a} := fun y hy => by + obtain ⟨u, -, rfl⟩ : y ∈ γ e '' Ioo 0 1 := (hγ.image e he).symm ▸ hFe hy + have h₁ : a.1 ≤ u.1 := hale hy + have h₂ : u.1 ≤ b.1 := hble hy + have : u = a := Subtype.ext (by linarith) + rw [this] + rfl + exact (infinite_of_isOArc hF) ((finite_singleton _).subset hsub) + let m : I → I := fun u => ⟨a.1 + u.1 * (b.1 - a.1), by + have := u.2.1; have := a.2.1; nlinarith, by + have := u.2.2; have := b.2.2; nlinarith⟩ + have hm : Continuous m := Continuous.subtype_mk (by fun_prop) _ + have hmI : ∀ u, m u ∈ Ioo (0 : I) 1 := fun u => by + have ha₀ := hIoo a ha + have hb₀ := hIoo b hb + have h₁ : a.1 ≤ (m u).1 := by + have := u.2.1 + simp only [m] + nlinarith + have h₂ : (m u).1 ≤ b.1 := by + have := u.2.2 + simp only [m] + nlinarith + exact ⟨lt_of_lt_of_le ha₀.1 h₁, lt_of_le_of_lt h₂ hb₀.2⟩ + have hinj : Function.Injective (fun u => γ e (m u)) := fun u v h => by + have h₁ := hγ.inj e he (hmI u) (hmI v) h + have h₂ : a.1 + u.1 * (b.1 - a.1) = a.1 + v.1 * (b.1 - a.1) := congrArg Subtype.val h₁ + have h₃ : b.1 - a.1 ≠ 0 := sub_ne_zero.mpr (Ne.symm hne') + exact Subtype.ext (mul_right_cancel₀ h₃ (add_left_cancel h₂)) + refine not_oArc_subset_arc (hc.comp hm) hinj hF fun y hy => ?_ + obtain ⟨u, -, rfl⟩ : y ∈ γ e '' Ioo 0 1 := (hγ.image e he).symm ▸ hFe hy + have h₁ : a.1 ≤ u.1 := hale hy + have h₂ : u.1 ≤ b.1 := hble hy + have hd : 0 < b.1 - a.1 := sub_pos.mpr (lt_of_le_of_ne hab hne') + refine ⟨⟨(u.1 - a.1) / (b.1 - a.1), div_nonneg (by linarith) hd.le, + (div_le_one hd).mpr (by linarith)⟩, ?_⟩ + have : m ⟨(u.1 - a.1) / (b.1 - a.1), div_nonneg (by linarith) hd.le, (div_le_one hd).mpr + (by linarith)⟩ = u := + Subtype.ext (by + simp only [m] + field_simp + ring) + exact congrArg (γ e) this + +/-- The first line of the proof of (6.4) (page 90). -/ +theorem edge_nonempty (hS : IsClosedSurface S) (hns : ¬ IsSphere S) {Γ : Drawing S} + (hT2 : (PaintingOrDrawing.drawing Γ).IsTwoCell) : Γ.E.Nonempty := by + classical + by_contra hE + have hE' : Γ.E = ∅ := not_nonempty_iff_eq_empty.mp hE + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hUV : Γ.U = Γ.V := by + rw [Γ.U_eq, hE'] + simp + obtain ⟨z, -, hz⟩ := exists_notMem_U (Γ := Γ) hS isOpen_univ univ_nonempty + obtain ⟨r, hr, hzr⟩ := exists_region_of_notMem hz + have hr' : Γ.Vᶜ ⊆ r := by + have hcn : IsPreconnected (univ \ Γ.V) := isPreconnected_sdiff_finite hS isOpen_univ + isPreconnected_univ Γ.finite_V + have : Γ.Vᶜ = univ \ Γ.V := by simp [compl_eq_univ_sdiff] + rw [this] + exact subset_region hr hcn (disjoint_left.mpr fun x hx h => hx.2 (hUV ▸ h)) ⟨mem_univ _, + hUV ▸ hz⟩ hzr + obtain ⟨Sep, hSep, hdisj⟩ := Γ.finite_V.t2_separation + have hgood : ∀ s ∈ Γ.V, ∃ E : Set S, IsOpen E ∧ s ∈ E ∧ E ⊆ Sep s ∧ IsSimplyConnectedSet E + := fun s _ => by + obtain ⟨D, D', hD, hD'o, hsD', hD'D, hDO, hb⟩ := exists_closedDisc_nbhd hS (hSep s).2 (hSep s).1 + have hD' : D' = D \ discBd D := by + rw [← hb] + ext x + constructor + · exact fun h => ⟨hD'D h, fun h' => h'.2 h⟩ + · rintro ⟨h₁, h₂⟩ + by_contra h + exact h₂ ⟨h₁, h⟩ + exact ⟨D', hD'o, hsD', hD'D.trans hDO, IsOpenDisc.isSimplyConnectedSet + (hD' ▸ isOpenDisc_interior hS hD)⟩ + choose! E hEo hsE hESep hEs using hgood + let O : {s // s ∈ Γ.V} → Set S := fun s => E s.1 + have hfl : Flat (⋃ s, O s) := by + refine flat_iUnion_cover (flat_of_finite Γ.finite_V) O Subtype.val (fun s => hEo s.1 s.2) + (fun s => hsE s.1 s.2) + (fun s => (hEs s.1 s.2).1) (fun s => IsSimplyConnectedSet.flat (hEs s.1 s.2)) fun i j y hy + hy' => ?_ + obtain rfl : i = j := Subtype.ext (by + by_contra hne + exact disjoint_left.mp (hdisj i.2 j.2 hne) (hESep _ i.2 hy) (hESep _ j.2 hy')) + have hj := (hEs i.1 i.2).1.joinedIn _ (hsE i.1 i.2) y hy + refine ⟨Cl.mk hj.somePath, (Cl.mk hj.somePath).symm, ⟨_, hj.somePath_mem, rfl⟩, + Arw.symm ⟨_, hj.somePath_mem, rfl⟩, ?_⟩ + rw [cl_trans_symm] + exact arw_refl i.2 + have hcpt : CompactSpace S := hS.1 + have hCc : IsCompact (⋃ s, O s)ᶜ := (isOpen_iUnion fun s : {s // s ∈ Γ.V} + => hEo s.1 s.2).isClosed_compl.isCompact + have hCr : (⋃ s, O s)ᶜ ⊆ r := fun x hx => hr' fun hxV => hx (mem_iUnion.mpr ⟨⟨x, hxV⟩, hsE x hxV⟩) + obtain ⟨Δ, hΔ, -, hCΔ⟩ := exists_closedDisc_of_isCompact (hT2.2 r hr) hCc hCr + exact not_flat_compl_disc hS hns hΔ (fun x hx => by + by_contra h + exact hx (hCΔ h)) hfl + +variable {Γ : PaintingOrDrawing S} {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + +/-- An `O`-arc in an edge of a painting or drawing is null-homotopic. For a drawing there is no such +`O`-arc, and a cell +has a closed disc as its closure. -/ +theorem null_of_subset_edge {e F : Set S} (he : e ∈ Γ.E) (hF : IsOArc F) + (hFe : F ⊆ e) : IsNullHomotopicOArc F := by + cases Γ with + | painting Γ => + exact isNullHomotopicOArcIn_of_subset_disc hF (subset_univ _) (Cell.isClosedDisc_closure he) + (hFe.trans subset_closure) + | drawing Γ => exact (not_oArc_subset_edge he hF hFe).elim + +/-- The first line of the proof of (6.4) (page 90), for a painting or drawing. A painting with no +cell has the same +regions as the drawing of its vertices. -/ +theorem edge_nonempty_any (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + (hT2 : Γ.IsTwoCell) : Γ.E.Nonempty := by + cases Γ with + | drawing Γ => exact edge_nonempty hS hns hT2 + | painting Γ => + by_contra hE + have hE' : Γ.E = ∅ := not_nonempty_iff_eq_empty.mp hE + have hUV : Γ.U = Γ.V := by + refine subset_antisymm (fun x hx => ?_) Γ.V_subset_U + rcases Cell.mem_V_or_cell Γ hx with h | ⟨e, he, -⟩ + · exact h + · rw [hE'] at he + exact he.elim + let D : Drawing S := pointsDrawing Γ.finite_V + have hDU : D.U = Γ.U := by rw [hUV]; simp [D, pointsDrawing] + have hDE : D.E = ∅ := by + refine eq_empty_of_forall_notMem ?_ + rintro C ⟨⟨x, hx⟩, hsub, -⟩ + have := hsub hx + exact this.2 this.1 + have hR : D.R = Γ.R := by + change componentsIn (univ \ D.U) = componentsIn (univ \ Γ.U) + rw [hDU] + have := edge_nonempty hS hns (Γ := D) ⟨hT2.1, fun r hr => hT2.2 r (show r ∈ Γ.R from hR ▸ hr)⟩ + rw [hDE] at this + exact this.ne_empty rfl + +omit [T2Space S] in +/-- **Graph Minors XI, (6.4)** (page 90). -/ +theorem theorem_6_4_proof (hS : IsClosedSurface S) (hns : ¬ IsSphere S) (hT2 : Γ.IsTwoCell) + (hT : IsPretangle Γ.toHypergraph θ T) (hresp : Γ.IsRespectful θ T) : + (∀ A B : Hypergraph S (Set S), Γ.toHypergraph.IsSeparation A B → separationOrder A B < θ → + ((A, B) ∈ T ↔ ∀ F : Set S, F ⊆ PaintingOrDrawing.underlying A → IsOArc F + → IsNullHomotopicOArc F) ∧ + ((A, B) ∈ T ↔ ∃ F : Set S, IsOArc F ∧ + F ⊆ PaintingOrDrawing.underlying B \ PaintingOrDrawing.underlying A + ∧ ¬ IsNullHomotopicOArc F)) ∧ + GM10.IsTangle Γ.toHypergraph θ T := by + have ht2 : T2Space S := hS.2.1 + have hE : Γ.E.Nonempty := edge_nonempty_any hS hns hT2 + obtain ⟨Γ', hrad⟩ := exists_radialDrawing hS hT2 + obtain ⟨ins, hd⟩ := exists_derivedSlope hS hresp hrad.2.1 + have h₁ : ∀ {A B : Hypergraph S (Set S)}, Γ.toHypergraph.IsSeparation A B + → separationOrder A B < θ → (A, B) ∈ T → + ∀ F : Set S, F ⊆ PaintingOrDrawing.underlying A → IsOArc F → IsNullHomotopicOArc F := + fun hsep hord hm F hFA hF => no_oArc_of_mem hS hns hE hT2 hT hresp hrad hd hsep hord hm hF hFA + have h₂ : ∀ {A B : Hypergraph S (Set S)}, Γ.toHypergraph.IsSeparation A B + → separationOrder A B < θ → + (∀ F : Set S, F ⊆ PaintingOrDrawing.underlying A → IsOArc F → IsNullHomotopicOArc F) → + ∃ F : Set S, IsOArc F ∧ F ⊆ PaintingOrDrawing.underlying B \ PaintingOrDrawing.underlying A ∧ + ¬ IsNullHomotopicOArc F := + fun hsep hord hA => exists_oArc_of_null_any hS hns hE hrad hT.one_le hd hsep hord hA + have h₃ : ∀ {A B : Hypergraph S (Set S)}, Γ.toHypergraph.IsSeparation A B + → separationOrder A B < θ → + (∃ F : Set S, IsOArc F ∧ F ⊆ PaintingOrDrawing.underlying B \ PaintingOrDrawing.underlying A ∧ + ¬ IsNullHomotopicOArc F) → (A, B) ∈ T := fun hsep hord ⟨F, hF, hFB, hn⟩ => by + refine (hT.axiom1 hsep hord).resolve_right fun hm => hn ?_ + exact h₁ hsep.symm (by rwa [GM10.separationOrder_comm]) hm F (hFB.trans sdiff_subset) hF + refine ⟨fun A B hsep hord => ⟨⟨h₁ hsep hord, fun h => h₃ hsep hord (h₂ hsep hord h)⟩, + ⟨fun h => h₂ hsep hord (h₁ hsep hord h), h₃ hsep hord⟩⟩, ?_⟩ + refine (GM10.theorem_2_7_proof hT.one_le hT.isSeparation hT.order_lt hT.axiom1 hT.axiom2).mpr fun + e he hsize => ?_ + have hs := GM10.isSeparation_edgeHypergraph_deleteEdges he + have ho : separationOrder (GM10.edgeHypergraph Γ.toHypergraph e) (Γ.toHypergraph.deleteEdges {e}) + < θ := by + rwa [GM10.separationOrder_edgeHypergraph_deleteEdges] + refine (hT.axiom1 hs ho).resolve_right fun hm => ?_ + obtain ⟨F, hF, hFs, hnn⟩ := h₂ hs.symm (by rwa [GM10.separationOrder_comm]) (h₁ hs.symm + (by rwa [GM10.separationOrder_comm]) hm) + refine hnn (null_of_subset_edge (Γ.toHypergraph_edgeSet ▸ he) hF fun x hx => ?_) + obtain ⟨hxK, hxn⟩ := hFs hx + rcases hxK with hx' | ⟨f, hf, hxf⟩ + · exact (hxn (Or.inl (Γ.toHypergraph.vertex_mem_of_inc hx'))).elim + · obtain rfl : f = e := hf + exact hxf + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Theorem65.lean b/LeanPool/GraphMinor/GM11/Theorem65.lean new file mode 100644 index 0000000000..312e1a5f99 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Theorem65.lean @@ -0,0 +1,251 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.PaintingPerimeter +public import LeanPool.GraphMinor.GM11.Theorem63 + +/-! +# Theorem (6.5) of Graph Minors XI + +Graph Minors XI, (6.5), pages 91–92. `theorem_6_5_painting` is the paper's statement for a painting. +`theorem_6_5` is the paper's statement for a drawing, with one correction. The converse, that an +even slope comes from a tangle, needs `θ ≠ 2` or that `Γ` has no loop (see the correction to (6.5) +in `corrections/GM11.md`). For one vertex and one loop in the sphere, at `θ = 2`, the empty slope is +even and `Γ` has no tangle of order 2. + +Both follow from `tangle_iff_even`, the paper's proof. It uses two bounds on the perimeter of a +region of `Γ'`, which +are proved separately for drawings and for paintings. The first is that the perimeter of `r` has +length at least twice +the number of ends of the edge in `r`. The second is the fact that the converse needs: an edge with +fewer than `θ` ends +lies in a region with perimeter of length less than `2θ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] {Γ' : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + +/-- **The proof of (6.5)** (pages 91–92), from the two bounds on perimeters. -/ +theorem tangle_iff_even {Γ : PaintingOrDrawing S} (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) + (hT : IsPretangle Γ.toHypergraph θ T) (hresp : Γ.IsRespectful θ T) (hrad : Γ.IsRadialDrawing Γ') + (hd : IsDerivedSlope Γ Γ' θ T ins) (hF : RegionFacts Γ Γ') + (hlow : ∀ s ∈ Γ'.R, 2 * (Γ.V ∩ closure s).ncard ≤ perimeterLength Γ' s) : + (GM10.IsTangle Γ.toHypergraph θ T → IsEvenSlope Γ' (2 * θ) ins) ∧ + ((∀ s ∈ Γ'.R, ∀ e ∈ Γ.E, e ⊆ s → GM10.edgeSize Γ.toHypergraph e < θ + → perimeterLength Γ' s < 2 * θ) → + IsEvenSlope Γ' (2 * θ) ins → GM10.IsTangle Γ.toHypergraph θ T) := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hex, -, -⟩ := hF + have ht := theorem_6_3_proof S hS inferInstance Γ Γ' θ T ins hrad.1 hE hT hresp hrad hd + constructor + · intro hTt s hs hlen + obtain ⟨e, he, hes⟩ := hex s hs + have heE : e ∈ Γ.toHypergraph.edgeSet := Γ.toHypergraph_edgeSet ▸ he + have hsize : GM10.edgeSize Γ.toHypergraph e < θ := by + have h₁ := hlow s hs + have hsub : Γ.toHypergraph.ends e ⊆ Γ.V ∩ closure s := fun v hv => by + obtain ⟨-, hv₁, hv₂⟩ := PaintingOrDrawing.toHypergraph_inc.mp hv + exact ⟨hv₁, closure_mono hes hv₂⟩ + have hfin : Γ.V.Finite := Γ.toHypergraph_vertexSet ▸ Γ.toHypergraph.vertexSet_finite + have h₂ := ncard_le_ncard hsub (hfin.subset inter_subset_left) + have : GM10.edgeSize Γ.toHypergraph e = (Γ.toHypergraph.ends e).ncard := rfl + omega + have hm := (GM10.theorem_2_7_proof hT.one_le hT.isSeparation hT.order_lt hT.axiom1 + hT.axiom2).mp hTt e heE hsize + have hsep := GM10.isSeparation_edgeHypergraph_deleteEdges (G := Γ.toHypergraph) heE + have hord : separationOrder (GM10.edgeHypergraph Γ.toHypergraph e) + (Γ.toHypergraph.deleteEdges {e}) < θ := by + rwa [GM10.separationOrder_edgeHypergraph_deleteEdges] + obtain ⟨k, C, hC, hcov⟩ := (ht.1 _ _ hsep hord).mp hm + obtain ⟨i, hi⟩ := hcov e rfl + obtain ⟨hcir, hsub, hl, -⟩ := hC i + refine ⟨C i, hcir, hsub, hl, ?_⟩ + obtain ⟨d, b, -⟩ := hd (C i) hcir hsub hl + have hfr : frontier (ins (C i)) ⊆ Γ'.U := by + rw [← subBd_eq_frontier, b] + exact hsub.U_subset + have hc := (IsClosedDisc.isCompact d).isClosed + obtain ⟨y, hy⟩ := (Γ.edge_props he).2.2.2 + have hsu : s ⊆ interior (ins (C i)) ∪ (ins (C i))ᶜ := fun x hx => by + by_cases hxi : x ∈ ins (C i) + · refine Or.inl ?_ + by_contra hn + exact region_subset hs hx (hfr ⟨subset_closure hxi, hn⟩) + · exact Or.inr hxi + have hyi : y ∈ interior (ins (C i)) := (hsu (hes hy)).resolve_right fun h => h (hi hy) + have := (region_isPreconnected hs).subset_left_of_subset_union isOpen_interior hc.isOpen_compl + (disjoint_left.mpr fun x h₁ h₂ => h₂ (interior_subset h₁)) hsu ⟨y, hes hy, hyi⟩ + exact this.trans interior_subset + · intro hup hev + by_contra hnt + have hne := mt (GM10.theorem_2_7_proof hT.one_le hT.isSeparation hT.order_lt hT.axiom1 + hT.axiom2).mpr hnt + push Not at hne + obtain ⟨e, he, hsize, hnm⟩ := hne + have heE' : e ∈ Γ.E := Γ.toHypergraph_edgeSet ▸ he + have heE : e ∈ Γ.toHypergraph.edgeSet := he + have hsep := GM10.isSeparation_edgeHypergraph_deleteEdges (G := Γ.toHypergraph) heE + have hord : separationOrder (GM10.edgeHypergraph Γ.toHypergraph e) + (Γ.toHypergraph.deleteEdges {e}) < θ := by + rwa [GM10.separationOrder_edgeHypergraph_deleteEdges] + have hm := (hT.axiom1 hsep hord).resolve_left hnm + obtain ⟨hpc, hdis, hU, y, hy⟩ := Γ.edge_props heE' + have hoff : Disjoint e Γ'.U := disjoint_left.mpr fun x hx hxU => by + have : x ∈ Γ.V := hrad.2.1.1.subset ⟨hU hx, hxU⟩ + exact disjoint_left.mp hdis hx this + have hyU : y ∉ Γ'.U := disjoint_left.mp hoff hy + obtain ⟨s, hs, hys⟩ := exists_region_of_notMem hyU + have hes : e ⊆ s := subset_region hs hpc hoff hy hys + have hlen : perimeterLength Γ' s < 2 * θ := hup s hs e heE' hes hsize + obtain ⟨C, hC, hCs, hl, hsub⟩ := hev s hs hlen + obtain ⟨d, -, hm'⟩ := hd C hC hCs hl + have heΔ : closure e ⊆ ins C := closure_minimal (hes.trans hsub) (IsClosedDisc.isCompact + d).isClosed + refine hT.axiom2 hm hm' hm ?_ + apply Hypergraph.ext + · ext x + constructor + · rintro ((h | h) | h) + · exact h + · exact Γ.toHypergraph_vertexSet ▸ h.1 + · exact h + · exact fun h => Or.inl (Or.inl h) + · ext f + constructor + · rintro ((h | h) | h) + · exact h.1 + · exact Γ.toHypergraph_edgeSet ▸ h.1 + · exact h.1 + · intro hf + by_cases hfe : f = e + · exact Or.inl (Or.inr ⟨Γ.toHypergraph_edgeSet ▸ hf, hfe ▸ subset_closure.trans heΔ⟩) + · exact Or.inr ⟨hf, hfe⟩ + · funext f v + apply propext + change ((Γ.toHypergraph.Inc f v ∧ f ∉ ({e} : Set (Set S))) ∨ + (Γ.toHypergraph.Inc f v ∧ f ⊆ ins C ∧ v ∈ ins C)) ∨ (Γ.toHypergraph.Inc f v ∧ f ∉ + ({e} : Set (Set S))) ↔ + Γ.toHypergraph.Inc f v + constructor + · rintro ((h | h) | h) + · exact h.1 + · exact h.1 + · exact h.1 + · intro h + by_cases hfe : f = e + · subst hfe + exact Or.inl (Or.inr ⟨h, subset_closure.trans heΔ, heΔ + (PaintingOrDrawing.toHypergraph_inc.mp h).2.2⟩) + · exact Or.inr ⟨h, hfe⟩ + +/-- **Graph Minors XI, (6.5)** (pages 91–92), for a drawing, with the correction for loops at +`θ = 2`. -/ +theorem theorem_6_5_proof {Γ : Drawing S} (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) + (hT : IsPretangle Γ.toHypergraph θ T) + (hresp : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) (hrad : (PaintingOrDrawing.drawing + Γ).IsRadialDrawing Γ') + (hd : IsDerivedSlope (PaintingOrDrawing.drawing Γ) Γ' θ T ins) : + (GM10.IsTangle Γ.toHypergraph θ T → IsEvenSlope Γ' (2 * θ) ins) ∧ + ((θ ≠ 2 ∨ ∀ e ∈ Γ.E, ∃ x y, x ≠ y ∧ closure e ∩ Γ.V = {x, y}) → IsEvenSlope Γ' (2 * θ) ins → + GM10.IsTangle Γ.toHypergraph θ T) := by + have hpre : PreRad (PaintingOrDrawing.drawing Γ) Γ' := ⟨hrad.1, hrad.2.1⟩ + have hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ' := hrad.2.2 + have hF := regionFacts_of_radial hpre hS hmax hE + have hlow : ∀ s ∈ Γ'.R, 2 * (Γ.V ∩ closure s).ncard ≤ perimeterLength Γ' s := fun s hs => + two_mul_ends_le hpre hS hmax hE hs + have hupE : ∀ (hloop : θ ≠ 2 ∨ ∀ e ∈ Γ.E, ∃ x y, x ≠ y ∧ closure e ∩ Γ.V = {x, y}) (s) + (hs : s ∈ Γ'.R), ∀ e ∈ Γ.E, + e ⊆ s → GM10.edgeSize Γ.toHypergraph e < θ → perimeterLength Γ' s < 2 * θ := by + intro hloop s hs e heE hes hsize + have hends : (Γ.toHypergraph.ends e) = closure e ∩ Γ.V := by + ext v + exact ⟨fun h => ⟨h.2.2, h.2.1⟩, fun h => ⟨heE, h.2, h.1⟩⟩ + have hsz : GM10.edgeSize Γ.toHypergraph e = (closure e ∩ Γ.V).ncard := by + rw [GM10.edgeSize, hends] + have hθ : 3 ≤ θ := by + have hpos : 0 < (closure e ∩ Γ.V).ncard := by + refine (ncard_pos (Γ.finite_V.subset inter_subset_right)).mpr ?_ + rcases Γ.edge_cond e heE with ⟨u, v, -, hc, -⟩ | ⟨u, hc, -⟩ <;> rw [hc] <;> simp + by_contra h3 + have h2 : θ = 2 := by omega + rcases hloop with hne | hl + · exact hne h2 + · obtain ⟨x, y, hxy, hc⟩ := hl e heE + rw [hc, ncard_pair hxy] at hsz + omega + exact (perimeterLength_le_four hpre hS hmax hE hs).trans_lt (by omega) + have hmain := tangle_iff_even (Γ := PaintingOrDrawing.drawing Γ) hS hE hT hresp hrad hd hF hlow + exact ⟨hmain.1, fun hloop => hmain.2 (hupE hloop)⟩ + +/-- **Graph Minors XI, (6.5)** (pages 91–92), for a painting. Here the perimeter of `r` has length +at most twice the +number of ends of the cell in `r`, so the converse needs no correction. -/ +theorem theorem_6_5_painting {Γ : Painting S} (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) + (hT : IsPretangle (PaintingOrDrawing.painting Γ).toHypergraph θ T) + (hresp : (PaintingOrDrawing.painting Γ).IsRespectful θ T) + (hrad : (PaintingOrDrawing.painting Γ).IsRadialDrawing Γ') + (hd : IsDerivedSlope (PaintingOrDrawing.painting Γ) Γ' θ T ins) : + GM10.IsTangle (PaintingOrDrawing.painting Γ).toHypergraph θ T ↔ IsEvenSlope Γ' (2 * θ) ins := by + classical + have hpre : PreRad (PaintingOrDrawing.painting Γ) Γ' := ⟨hrad.1, hrad.2.1⟩ + have hF := regionFacts_of_painting hpre hrad.2.2 hS hE + by_cases hfree : ∃ e ∈ Γ.E, closure e ∩ Γ.V = ∅ + · -- With a cell with no end, `Γ` has no vertex, so `Γ'` has no edge. + obtain ⟨e₀, he₀, hf₀⟩ := hfree + obtain ⟨hV, -⟩ := free_cell hS hrad.1.2 he₀ hf₀ + have hE' : Γ'.E = ∅ := eq_empty_of_forall_notMem fun h hh => by + obtain ⟨v, hv, -⟩ := hrad.2.1.2.2.2.2.1 h hh + change v ∈ Γ.V at hv + rw [hV] at hv + exact hv + have hzero : ∀ s, perimeterLength Γ' s = 0 := fun s => by + have hP : (perimeter Γ' s).E = ∅ := eq_empty_of_forall_notMem fun h hh => by + have := (mem_interSet_E_iff.mp hh).1 + rw [hE'] at this + exact this + rw [perimeterLength, hP, finsum_mem_empty] + have hmain := tangle_iff_even (Γ := PaintingOrDrawing.painting Γ) hS hE hT hresp hrad hd hF + (fun s _ => by + rw [hzero s, show (PaintingOrDrawing.painting Γ).V = Γ.V from rfl, hV] + simp) + exact ⟨hmain.1, hmain.2 fun s _ e _ _ hsize => by + rw [hzero s] + omega⟩ + · have hv : ∀ e ∈ Γ.E, (closure e ∩ Γ.V).Nonempty := fun e he => by + by_contra h + exact hfree ⟨e, he, not_nonempty_iff_eq_empty.mp h⟩ + have hmain := tangle_iff_even (Γ := PaintingOrDrawing.painting Γ) hS hE hT hresp hrad hd hF + (fun s hs => two_mul_ends_le_painting hS hrad hE hv hs) + refine ⟨hmain.1, hmain.2 fun s hs e he hes hsize => ?_⟩ + have hends : (PaintingOrDrawing.painting Γ).toHypergraph.ends e = Γ.V ∩ closure e := by + ext v + constructor + · intro h + obtain ⟨-, h₁, h₂⟩ := (PaintingOrDrawing.toHypergraph_inc (Γ := PaintingOrDrawing.painting + Γ)).mp h + exact ⟨h₁, h₂⟩ + · exact fun h => (PaintingOrDrawing.toHypergraph_inc (Γ := PaintingOrDrawing.painting Γ)).mpr + ⟨he, h⟩ + have hsz : GM10.edgeSize (PaintingOrDrawing.painting Γ).toHypergraph e = + (Γ.V ∩ closure e).ncard := by + rw [GM10.edgeSize, hends] + have := perimeterLength_le_painting hS hrad hE hv hs he hes + omega + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Theorem66.lean b/LeanPool/GraphMinor/GM11/Theorem66.lean new file mode 100644 index 0000000000..8d8cb908ac --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Theorem66.lean @@ -0,0 +1,266 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Theorem61 +public import LeanPool.GraphMinor.GM11.Theorem65 + +/-! +# Theorems (6.6) and (4.1) of Graph Minors XI + +`theorem_6_6` is Graph Minors XI, (6.6), pages 92–93, with the correction for loops at `θ = 2` of +`theorem_6_5`. See the correction to (6.6) in `corrections/GM11.md`. We state it for any two +drawings with a common radial drawing, which covers the paper's dual drawings. +The printed closing sentence says "tangle" without qualification. `theorem_6_6_exists` gives the +existence equivalence for respectful tangles by taking the nonemptiness of the two types in the +bijection. + +`theorem_4_1` is Graph Minors XI, (4.1), page 78. + +The common tools are that a slope is determined by a pretangle (`derived_unique`) and that the +induced pretangle +depends only on the discs of short circuits (`induced_congr`). +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +section Congr + +variable {Γ : PaintingOrDrawing S} {Γ' : Drawing S} {θ : ℕ} {ins ins' : Drawing S → Set S} + +/-- The pretangle induced from a slope depends only on the discs of the short circuits. -/ +theorem induced_congr (h : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < 2 * θ + → ins C = ins' C) : + inducedPretangle Γ Γ' θ ins = inducedPretangle Γ Γ' θ ins' := by + have key : ∀ {i j : Drawing S → Set S}, (∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' + → C.length < 2 * θ → + i C = j C) → ∀ p, p ∈ inducedPretangle Γ Γ' θ i → p ∈ inducedPretangle Γ Γ' θ j := by + rintro i j hij p ⟨hs, ho, hc, hcap⟩ + refine ⟨hs, ho, hc, fun r hr => ?_⟩ + obtain ⟨C, hC, hCs, hl, hin⟩ := hcap r hr + refine ⟨C, hC, hCs, hl, ?_⟩ + rwa [← hij C hC (hCs.trans (Drawing.span_isSubdrawing Γ' _ _)) hl] + exact Set.ext fun p => ⟨key h p, key (fun C a b c => (h C a b c).symm) p⟩ + +variable {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + +/-- A pretangle determines the discs of its derived slope. -/ +theorem derived_unique [ConnectedSpace S] (hS : IsClosedSurface S) (hT : IsPretangle Γ.toHypergraph + θ T) + (hrad : Γ.U ∩ Γ'.U = Γ.V) (hd : IsDerivedSlope Γ Γ' θ T ins) (hd' : IsDerivedSlope Γ Γ' θ T + ins') + (C : Drawing S) (hC : C.IsCircuit) (hCs : C.IsSubdrawing Γ') (hl : C.length < 2 * θ) : ins C + = ins' C := by + obtain ⟨d, b, m⟩ := hd C hC hCs hl + obtain ⟨d', b', m'⟩ := hd' C hC hCs hl + by_contra hne + have hbd : discBd (ins C) = discBd (ins' C) := by + rw [← IsClosedDisc.frontier_eq_discBd hS d, ← IsClosedDisc.frontier_eq_discBd hS d', + ← subBd_eq_frontier, + ← subBd_eq_frontier, b, b'] + have hcov := cover_of_discBd_eq hS d d' hbd hne + have hfr : frontier (ins C) ⊆ Γ'.U := by + rw [← subBd_eq_frontier, b] + exact hCs.U_subset + have hfr' : frontier (ins' C) ⊆ Γ'.U := by + rw [← subBd_eq_frontier, b'] + exact hCs.U_subset + exact not_cover hT hrad (IsClosedDisc.isCompact d).isClosed (IsClosedDisc.isCompact d').isClosed + (IsClosedDisc.isCompact d).isClosed hfr hfr' hfr m m' m (by rw [hcov, univ_union]) + +end Congr + +/-- A tangle is a pretangle. -/ +theorem IsTangle.isPretangle {α β : Type*} {G : Hypergraph α β} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} (h : GM10.IsTangle G θ T) : IsPretangle G θ T := + ⟨h.one_le, h.isSeparation, h.order_lt, h.axiom1, h.axiom2⟩ + +variable [ConnectedSpace S] {Γ Γs Γ' : Drawing S} {θ : ℕ} + +/-- A respectful tangle in a drawing `Γ` with radial drawing `Γ'`, and the even slope derived from +it. -/ +private theorem transfer (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) (hEs : Γs.E.Nonempty) + (hrad : (PaintingOrDrawing.drawing Γ).IsRadialDrawing Γ') (hrads : + (PaintingOrDrawing.drawing Γs).IsRadialDrawing Γ') + (hloop : θ ≠ 2 ∨ ∀ e ∈ Γs.E, ∃ x y, x ≠ y ∧ closure e ∩ Γs.V = {x, y}) + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} (hT : GM10.IsTangle Γ.toHypergraph θ T) + (hresp : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) {ins : Drawing S → Set S} + (hd : IsDerivedSlope (PaintingOrDrawing.drawing Γ) Γ' θ T ins) : + GM10.IsTangle Γs.toHypergraph θ (inducedPretangle (PaintingOrDrawing.drawing Γs) Γ' θ ins) ∧ + (PaintingOrDrawing.drawing Γs).IsRespectful θ (inducedPretangle + (PaintingOrDrawing.drawing Γs) Γ' θ ins) ∧ + IsDerivedSlope (PaintingOrDrawing.drawing Γs) Γ' θ (inducedPretangle + (PaintingOrDrawing.drawing Γs) Γ' θ ins) ins := by + have hp := IsTangle.isPretangle hT + have hsl := isSlope_of_derived (Γ := PaintingOrDrawing.drawing Γ) hS hp hrad.2.1.1 hd + have hev := (theorem_6_5_proof hS hE hp hresp hrad hd).1 hT + obtain ⟨h₁, h₂, h₃⟩ := theorem_6_1_proof (Γ := PaintingOrDrawing.drawing Γs) hS hEs hrads + hT.one_le hsl + exact ⟨(theorem_6_5_proof hS hEs h₁ h₂ hrads h₃).2 hloop hev, h₂, h₃⟩ + +/-- The set of respectful tangles of order `θ` in a drawing. -/ +abbrev RespectfulTangle (Γ : Drawing S) (θ : ℕ) : Type u := + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S)) // + GM10.IsTangle Γ.toHypergraph θ T ∧ (PaintingOrDrawing.drawing Γ).IsRespectful θ T} + +/-- **Graph Minors XI, (6.6)** (pages 92–93), for drawings with a common radial drawing, with the +correction for loops at `θ = 2`: there is a bijection between respectful tangles, and the two sides +of it have the same derived slopes. -/ +theorem theorem_6_6_proof (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) (hEs : Γs.E.Nonempty) + (hrad : (PaintingOrDrawing.drawing Γ).IsRadialDrawing Γ') (hrads : + (PaintingOrDrawing.drawing Γs).IsRadialDrawing Γ') + (hloop : θ ≠ 2 ∨ (∀ e ∈ Γ.E, ∃ x y, x ≠ y ∧ closure e ∩ Γ.V = {x, y}) ∧ + ∀ e ∈ Γs.E, ∃ x y, x ≠ y ∧ closure e ∩ Γs.V = {x, y}) : + ∃ φ : RespectfulTangle Γ θ ≃ RespectfulTangle Γs θ, ∀ (T : RespectfulTangle Γ θ) + (ins : Drawing S → Set S), + IsDerivedSlope (PaintingOrDrawing.drawing Γ) Γ' θ T.1 ins ↔ + IsDerivedSlope (PaintingOrDrawing.drawing Γs) Γ' θ (φ T).1 ins := by + classical + have hl₁ : θ ≠ 2 ∨ ∀ e ∈ Γ.E, ∃ x y, x ≠ y ∧ closure e ∩ Γ.V = {x, y} := hloop.imp id (·.1) + have hl₂ : θ ≠ 2 ∨ ∀ e ∈ Γs.E, ∃ x y, x ≠ y ∧ closure e ∩ Γs.V = {x, y} := hloop.imp id (·.2) + have hex : ∀ T : RespectfulTangle Γ θ, ∃ ins, IsDerivedSlope (PaintingOrDrawing.drawing Γ) Γ' θ + T.1 ins := + fun T => exists_derivedSlope hS T.2.2 hrad.2.1 + have hexs : ∀ T : RespectfulTangle Γs θ, ∃ ins, IsDerivedSlope (PaintingOrDrawing.drawing Γs) Γ' + θ T.1 ins := + fun T => exists_derivedSlope hS T.2.2 hrads.2.1 + choose i hi using hex + choose j hj using hexs + have hind : ∀ {G : Drawing S} (hEG : G.E.Nonempty) (_ : (PaintingOrDrawing.drawing + G).IsRadialDrawing Γ') + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))), GM10.IsTangle G.toHypergraph θ T → + (PaintingOrDrawing.drawing G).IsRespectful θ T → ∀ ins, IsDerivedSlope + (PaintingOrDrawing.drawing G) Γ' θ T ins → + T = inducedPretangle (PaintingOrDrawing.drawing G) Γ' θ ins := fun {G} hEG hr T ht hre ins hd + => + (theorem_6_3_proof S hS inferInstance (PaintingOrDrawing.drawing G) Γ' θ T ins hr.1 hEG + (IsTangle.isPretangle ht) hre hr hd).2 + let f : RespectfulTangle Γ θ → RespectfulTangle Γs θ := fun T => + ⟨_, (transfer hS hE hEs hrad hrads hl₂ T.2.1 T.2.2 (hi T)).1, (transfer hS hE hEs hrad hrads + hl₂ T.2.1 T.2.2 (hi T)).2.1⟩ + let g : RespectfulTangle Γs θ → RespectfulTangle Γ θ := fun T => + ⟨_, (transfer hS hEs hE hrads hrad hl₁ T.2.1 T.2.2 (hj T)).1, (transfer hS hEs hE hrads hrad + hl₁ T.2.1 T.2.2 (hj T)).2.1⟩ + have hfd : ∀ T, IsDerivedSlope (PaintingOrDrawing.drawing Γs) Γ' θ (f T).1 (i T) := fun T => + (transfer hS hE hEs hrad hrads hl₂ T.2.1 T.2.2 (hi T)).2.2 + have hgd : ∀ T, IsDerivedSlope (PaintingOrDrawing.drawing Γ) Γ' θ (g T).1 (j T) := fun T => + (transfer hS hEs hE hrads hrad hl₁ T.2.1 T.2.2 (hj T)).2.2 + have hu : ∀ T, ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < 2 * θ → j (f T) C + = i T C := fun T => + derived_unique (Γ := PaintingOrDrawing.drawing Γs) hS (IsTangle.isPretangle + (f T).2.1) hrads.2.1.1 (hj (f T)) (hfd T) + have hv : ∀ T, ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < 2 * θ → i (g T) C + = j T C := fun T => + derived_unique (Γ := PaintingOrDrawing.drawing Γ) hS (IsTangle.isPretangle + (g T).2.1) hrad.2.1.1 (hi (g T)) (hgd T) + let φ : RespectfulTangle Γ θ ≃ RespectfulTangle Γs θ := + { toFun := f + invFun := g + left_inv := fun T => Subtype.ext ((induced_congr (hu T)).trans + (hind hE hrad T.1 T.2.1 T.2.2 (i T) (hi T)).symm) + right_inv := fun T => Subtype.ext ((induced_congr (hv T)).trans + (hind hEs hrads T.1 T.2.1 T.2.2 (j T) (hj T)).symm) } + refine ⟨φ, fun T ins => ⟨fun hd => ?_, fun hd => ?_⟩⟩ + · have hsl := isSlope_of_derived (Γ := PaintingOrDrawing.drawing Γ) hS + (IsTangle.isPretangle T.2.1) hrad.2.1.1 hd + have he : (φ T).1 = inducedPretangle (PaintingOrDrawing.drawing Γs) Γ' θ ins := + induced_congr (derived_unique (Γ := PaintingOrDrawing.drawing Γ) hS + (IsTangle.isPretangle T.2.1) hrad.2.1.1 (hi T) hd) + rw [he] + exact isDerivedSlope_induced hS hEs hrads hsl + · have hsl := isSlope_of_derived (Γ := PaintingOrDrawing.drawing Γs) hS (IsTangle.isPretangle + (φ T).2.1) hrads.2.1.1 hd + have he : T.1 = inducedPretangle (PaintingOrDrawing.drawing Γ) Γ' θ ins := + (hind hE hrad T.1 T.2.1 T.2.2 (i T) (hi T)).trans + (induced_congr (derived_unique (Γ := PaintingOrDrawing.drawing Γs) hS (IsTangle.isPretangle + (φ T).2.1) hrads.2.1.1 (hfd T) hd)) + rw [he] + exact isDerivedSlope_induced hS hE hrad hsl + +/-- The existence equivalence for respectful tangles from Graph Minors XI, (6.6), page 93. +The printed closing sentence says "tangle". The proof uses the preceding bijection of +respectful tangles. -/ +theorem theorem_6_6_exists (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) (hEs : Γs.E.Nonempty) + (hrad : (PaintingOrDrawing.drawing Γ).IsRadialDrawing Γ') (hrads : + (PaintingOrDrawing.drawing Γs).IsRadialDrawing Γ') + (hloop : θ ≠ 2 ∨ (∀ e ∈ Γ.E, ∃ x y, x ≠ y ∧ closure e ∩ Γ.V = {x, y}) ∧ + ∀ e ∈ Γs.E, ∃ x y, x ≠ y ∧ closure e ∩ Γs.V = {x, y}) : + Nonempty (RespectfulTangle Γ θ) ↔ Nonempty (RespectfulTangle Γs θ) := by + obtain ⟨φ, -⟩ := theorem_6_6_proof hS hE hEs hrad hrads hloop + exact ⟨fun ⟨T⟩ => ⟨φ T⟩, fun ⟨T⟩ => ⟨φ.symm T⟩⟩ + +/-- **Graph Minors XI, (4.1)** (page 78): a `θ`-representative 2-cell painting or drawing in a +connected surface other than +the sphere has a unique respectful tangle of order `θ`. -/ +theorem theorem_4_1_proof {Γ : PaintingOrDrawing S} (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + (hθ : 1 ≤ θ) + (hT2 : Γ.IsTwoCell) (hrep : Γ.IsRepresentative θ) : + ∃! T, GM10.IsTangle Γ.toHypergraph θ T ∧ Γ.IsRespectful θ T := by + classical + have hE : Γ.E.Nonempty := edge_nonempty_any hS hns hT2 + obtain ⟨Γ', hrad⟩ := exists_radialDrawing hS hT2 + have hb := bipartite_of_preRadial hrad.2.1 + have hbdS : ∀ F : Set S, Disjoint F (bd S) := fun F => disjoint_left.mpr fun x _ hx => hx + (hS.2.2 x) + -- Each short circuit of `Γ'` bounds a disc, since `Γ` is `θ`-representative. + have hex : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < 2 * θ → + ∃ Δ, IsClosedDisc Δ ∧ subBd Δ = C.U := by + intro C hC hCs hl + have hN : Γ.IsNormal C.U := fun x hx => + hrad.2.1.1.subset ⟨hx.2, hCs.U_subset hx.1⟩ + have hsub : C.U ∩ Γ.V ⊆ Γ.V ∩ C.V := by + rintro x ⟨hxC, hxV⟩ + refine ⟨hxV, ?_⟩ + by_contra hn + obtain ⟨e, he, hxe⟩ := C.exists_edge_of_mem hxC hn + exact ((hCs.2 he).2.1 hxe).2 (hrad.2.1.2.1 hxV) + have hk : (C.U ∩ Γ.V).ncard < θ := by + have h₁ := two_mul_ncard_le_length Γ.V hb hC hCs + have h₂ := ncard_le_ncard hsub (C.finite_V.subset inter_subset_right) + omega + have hF := IsCircuit.isOArc_U hC + obtain ⟨Δ, -, hΔ, hbΔ⟩ := (epstein S univ C.U (IsClosedSurface.isSurface hS) inferInstance hF + (subset_univ _) + (hbdS _)).1 (hrep.2 C.U hF hN hk) + exact ⟨Δ, hΔ, by rw [subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hS hΔ, hbΔ]⟩ + let ins : Drawing S → Set S := fun C => if h : C.IsCircuit ∧ C.IsSubdrawing Γ' + ∧ C.length < 2 * θ then + (hex C h.1 h.2.1 h.2.2).choose else ∅ + have hins : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → C.length < 2 * θ → + IsClosedDisc (ins C) ∧ subBd (ins C) = C.U := fun C hC hCs hl => by + have h : C.IsCircuit ∧ C.IsSubdrawing Γ' ∧ C.length < 2 * θ := ⟨hC, hCs, hl⟩ + simp only [ins, h, and_self, dite_true] + exact (hex C hC hCs hl).choose_spec + have hbd : ∀ {Δ : Set S}, IsClosedDisc Δ → discBd Δ = subBd Δ := fun hΔ => by + rw [subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hS hΔ] + have hsl : IsSlope Γ' (2 * θ) ins := by + refine isSlope_of_mono hS (by omega) hins ?_ fun h => absurd h hns + intro C₁ C₂ h₁ s₁ l₁ h₂ s₂ l₂ hsub + obtain ⟨d₁, b₁⟩ := hins C₁ h₁ s₁ l₁ + obtain ⟨d₂, -⟩ := hins C₂ h₂ s₂ l₂ + exact disc_subset_of_bd hS hns d₁ d₂ (by rw [hbd d₁, b₁]; exact hsub) + obtain ⟨h₁, h₂, h₃⟩ := theorem_6_1_proof hS hE hrad hθ hsl + refine ⟨_, ⟨(theorem_6_4_proof hS hns hT2 h₁ h₂).2, h₂⟩, fun T hT => ?_⟩ + obtain ⟨ins', hd⟩ := exists_derivedSlope hS hT.2 hrad.2.1 + have hTi := (theorem_6_3_proof S hS inferInstance Γ Γ' θ T ins' hrad.1 hE + (IsTangle.isPretangle hT.1) hT.2 hrad hd).2 + refine hTi.trans (induced_congr fun C hC hCs hl => ?_) + obtain ⟨d, b, -⟩ := hd C hC hCs hl + obtain ⟨d', b'⟩ := hins C hC hCs hl + exact eq_of_discBd_eq (IsClosedSurface.isSurface hS) hns d d' (by rw [hbd d, hbd d', b, b']) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Theorem75.lean b/LeanPool/GraphMinor/GM11/Theorem75.lean new file mode 100644 index 0000000000..3153ea15c8 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Theorem75.lean @@ -0,0 +1,754 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Nice73 +public import LeanPool.GraphMinor.GM11.PerimeterWalk +public import LeanPool.GraphMinor.GM11.RadialChord +public import LeanPool.GraphMinor.GM11.Rotation +public import LeanPool.GraphMinor.GM11.PaintingFacts +public import LeanPool.GraphMinor.GM11.Section5 + +/-! +# (7.5) of Graph Minors XI + +The paper cuts discs around the points of `Y` out of `Σ`, and applies Graph Minors VII, (11.10) to +the +result. We work in the open set `W = Σ - Y` instead. `exists_open_around` needs a connected set. So +we first join +the components of `X` by lines `T` off `X` and off `Y`, one line at a time (`exists_bridge`). An +`O`-arc in `X ∪ T` lies +in `X` (`oArc_subset_of_bridge`), and `X ∪ T` is nice, so that the hypothesis stays true. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +section Line + +variable [T2Space S] + +/-- An `O`-arc does not lie in a line. -/ +theorem not_oArc_subset_arc {e : I → S} (he : Continuous e) (hi : Function.Injective e) {F : Set S} + (hF : IsOArc F) (hsub : F ⊆ range e) : False := by + have hemb := he.isClosedEmbedding hi + have hinf := infinite_of_isOArc hF + have hFc : IsCompact F := by + obtain ⟨f⟩ := id hF + exact isCompact_iff_compactSpace.mpr f.compactSpace + have hprec : ∀ {A : Set S}, A ⊆ F → IsPreconnected A → IsPreconnected (e ⁻¹' A) := by + intro A hA hp + refine hemb.isInducing.isPreconnected_image.mp ?_ + rwa [image_preimage_eq_of_subset (hA.trans hsub)] + let C : Set I := e ⁻¹' F + have hCc : IsCompact C := (hFc.isClosed.preimage he).isCompact + have hCinf : C.Infinite := fun h => hinf ((h.image e).subset fun x hx => by + obtain ⟨t, rfl⟩ := hsub hx + exact ⟨t, hx, rfl⟩) + obtain ⟨s, hs⟩ := hCc.exists_isLeast hCinf.nonempty + obtain ⟨t, ht⟩ := hCc.exists_isGreatest hCinf.nonempty + obtain ⟨m, hm, hmn⟩ := hCinf.exists_notMem_finset {s, t} + have hms : m ≠ s := fun h => hmn (by simp [h]) + have hmt : m ≠ t := fun h => hmn (by simp [h]) + have hsm : s < m := lt_of_le_of_ne (hs.2 hm) hms.symm + have hmt' : m < t := lt_of_le_of_ne (ht.2 hm) hmt + have hc := hprec (A := F \ {e m}) sdiff_subset (isPathConnected_oArc_diff hF + hm).isConnected.isPreconnected + have hsmem : s ∈ e ⁻¹' (F \ {e m}) := ⟨hs.1, fun h => hsm.ne (hi h)⟩ + have htmem : t ∈ e ⁻¹' (F \ {e m}) := ⟨ht.1, fun h => hmt'.ne' (hi h)⟩ + exact (hc.Icc_subset hsmem htmem ⟨hsm.le, hmt'.le⟩).2 rfl + +/-- **An `O`-arc in `X₁ ∪ X₂ ∪ T` lies in `X₁ ∪ X₂`**, if the line `T` joins the disjoint closed +sets `X₁` and +`X₂`, and its inside misses them. -/ +theorem oArc_subset_of_bridge {X₁ X₂ : Set S} (h₁ : IsClosed X₁) (h₂ : IsClosed X₂) + (hd : Disjoint X₁ X₂) + {e : I → S} (he : Continuous e) (hi : Function.Injective e) (h0 : e 0 ∈ X₁) (h1 : e 1 ∈ X₂) + (hin : ∀ t, t ≠ 0 → t ≠ 1 → e t ∉ X₁ ∪ X₂) {F : Set S} (hF : IsOArc F) + (hsub : F ⊆ X₁ ∪ X₂ ∪ range e) : F ⊆ X₁ ∪ X₂ := by + by_contra hnot + obtain ⟨y, hyF, hyX⟩ := not_subset.mp hnot + -- If `e t ∈ F`, then `F - {e t}` lies on one side of `e t`. + have hside : ∀ t, t ≠ 0 → t ≠ 1 → e t ∈ F → F ⊆ X₁ ∪ e '' Iic t ∨ F ⊆ X₂ ∪ e '' Ici t := by + intro t ht0 ht1 htF + have hc₁ : IsClosed (X₁ ∪ e '' Iic t) := h₁.union (isClosed_Iic.isCompact.image he).isClosed + have hc₂ : IsClosed (X₂ ∪ e '' Ici t) := h₂.union (isClosed_Ici.isCompact.image he).isClosed + have hp := (isPathConnected_oArc_diff hF htF).isConnected.isPreconnected + have hcov : F \ {e t} ⊆ (X₁ ∪ e '' Iic t) ∪ (X₂ ∪ e '' Ici t) := by + rintro x ⟨hx, -⟩ + rcases hsub hx with (h | h) | ⟨u, rfl⟩ + · exact Or.inl (Or.inl h) + · exact Or.inr (Or.inl h) + · rcases le_total u t with h | h + · exact Or.inl (Or.inr ⟨u, h, rfl⟩) + · exact Or.inr (Or.inr ⟨u, h, rfl⟩) + have hmeet : Disjoint ((X₁ ∪ e '' Iic t) ∩ (X₂ ∪ e '' Ici t)) (F \ {e t}) := by + refine disjoint_left.mpr ?_ + rintro x ⟨h₃ | ⟨u, hu, rfl⟩, h₄ | ⟨v, hv, h'⟩⟩ ⟨-, hne⟩ + · exact disjoint_left.mp hd h₃ h₄ + · subst h' + have huv : v = 0 := by + by_contra hv0 + refine hin v hv0 ?_ (Or.inl h₃) + exact fun hv1 => absurd (hv1 ▸ h₃) (disjoint_right.mp hd h1) + rw [huv] at hv + exact ht0 (le_antisymm hv zero_le) + · have hu1 : u = 1 := by + by_contra hu1 + refine hin u ?_ hu1 (Or.inr h₄) + exact fun hu0 => absurd h₄ (hu0 ▸ disjoint_left.mp hd h0) + rw [hu1] at hu + exact ht1 (le_antisymm unitInterval.le_one' hu) + · have : u = v := hi h'.symm + subst this + exact hne (mem_singleton_iff.mpr (congrArg e (le_antisymm hu hv))) + by_contra hno + rw [not_or] at hno + have hA : (F \ {e t} ∩ (X₁ ∪ e '' Iic t)).Nonempty := by + by_contra hne + refine hno.2 fun x hx => ?_ + by_cases hxt : x = e t + · exact hxt ▸ Or.inr ⟨t, self_mem_Ici, rfl⟩ + · rcases hcov ⟨hx, hxt⟩ with h | h + · exact absurd ⟨x, ⟨hx, hxt⟩, h⟩ hne + · exact h + have hB : (F \ {e t} ∩ (X₂ ∪ e '' Ici t)).Nonempty := by + by_contra hne + refine hno.1 fun x hx => ?_ + by_cases hxt : x = e t + · exact hxt ▸ Or.inr ⟨t, self_mem_Iic, rfl⟩ + · rcases hcov ⟨hx, hxt⟩ with h | h + · exact h + · exact absurd ⟨x, ⟨hx, hxt⟩, h⟩ hne + obtain ⟨x, hx, hx'⟩ := isPreconnected_closed_iff.mp hp _ _ hc₁ hc₂ hcov hA hB + exact disjoint_left.mp hmeet hx' hx + -- If `F` lies on both sides, then it lies in the line. + have hboth : ∀ {t u : I}, F ⊆ X₁ ∪ e '' Iic t → F ⊆ X₂ ∪ e '' Ici u → False := by + intro t u hl hr + refine not_oArc_subset_arc he hi hF fun x hx => ?_ + rcases hl hx with h | ⟨v, -, rfl⟩ + · rcases hr hx with h' | ⟨v, -, rfl⟩ + · exact absurd h' (disjoint_left.mp hd h) + · exact mem_range_self v + · exact mem_range_self v + obtain ⟨t, rfl⟩ : y ∈ range e := by + rcases hsub hyF with h | h + · exact absurd h hyX + · exact h + have ht0 : t ≠ 0 := fun h => hyX (Or.inl (h ▸ h0)) + have ht1 : t ≠ 1 := fun h => hyX (Or.inr (h ▸ h1)) + -- A second such point gives both sides or a contradiction. + have hone : ∀ u, u ≠ 0 → u ≠ 1 → e u ∈ F → u = t := by + intro u hu0 hu1 huF + by_contra hne + rcases hside t ht0 ht1 hyF with h | h <;> rcases hside u hu0 hu1 huF with h' | h' + · rcases lt_or_gt_of_ne hne with hlt | hlt + · rcases h' hyF with h₃ | ⟨v, hv, h₃⟩ + · exact hyX (Or.inl h₃) + · exact absurd (hi h₃ ▸ hv) (not_le.mpr hlt) + · rcases h huF with h₃ | ⟨v, hv, h₃⟩ + · exact hin u hu0 hu1 (Or.inl h₃) + · exact absurd (hi h₃ ▸ hv) (not_le.mpr hlt) + · exact hboth h h' + · exact hboth h' h + · rcases lt_or_gt_of_ne hne with hlt | hlt + · rcases h huF with h₃ | ⟨v, hv, h₃⟩ + · exact hin u hu0 hu1 (Or.inr h₃) + · exact absurd (hi h₃ ▸ hv) (not_le.mpr hlt) + · rcases h' hyF with h₃ | ⟨v, hv, h₃⟩ + · exact hyX (Or.inr h₃) + · exact absurd (hi h₃ ▸ hv) (not_le.mpr hlt) + -- So `e t` is alone in `F` among the points off `X₁ ∪ X₂`, and it is isolated in `F`. + have hrest : F \ {e t} ⊆ X₁ ∪ X₂ := by + rintro x ⟨hx, hxt⟩ + rcases hsub hx with h | ⟨u, rfl⟩ + · exact h + · by_cases hu0 : u = 0 + · exact Or.inl (hu0 ▸ h0) + · by_cases hu1 : u = 1 + · exact Or.inr (hu1 ▸ h1) + · exact absurd (mem_singleton_iff.mpr (congrArg e (hone u hu0 hu1 hx))) hxt + have hcl : IsClosed (X₁ ∪ X₂) := h₁.union h₂ + have hp := hF.isPreconnected + have hcov : F ⊆ (X₁ ∪ X₂) ∪ {e t} := fun x hx => by + by_cases hxt : x = e t + · exact Or.inr hxt + · exact Or.inl (hrest ⟨hx, hxt⟩) + have hAne : (F ∩ (X₁ ∪ X₂)).Nonempty := by + obtain ⟨x, hx, hxt⟩ := (infinite_of_isOArc hF).exists_notMem_finset {e t} + exact ⟨x, hx, hrest ⟨hx, by simpa using hxt⟩⟩ + obtain ⟨x, -, hx₁, hx₂⟩ := isPreconnected_closed_iff.mp hp _ _ hcl isClosed_singleton hcov hAne + ⟨e t, hyF, rfl⟩ + exact hyX (hx₂ ▸ hx₁) + +end Line + +section Surface + +variable [ConnectedSpace S] + +omit [ConnectedSpace S] in +/-- A compact subset of an open disc lies in a closed disc in the open disc. -/ +theorem exists_closedDisc_of_isCompact [T2Space S] {A C : Set S} (hA : IsOpenDisc A) + (hC : IsCompact C) + (hCA : C ⊆ A) : ∃ Δ, IsClosedDisc Δ ∧ Δ ⊆ A ∧ C ⊆ Δ := by + obtain ⟨-, ⟨ψ⟩⟩ := hA + let K : Set OpenUnitDisc := ψ.symm '' (Subtype.val ⁻¹' C) + have hK : IsCompact K := by + refine IsCompact.image ?_ ψ.symm.continuous + exact (IsInducing.subtypeVal.isCompact_preimage_iff (by simpa using hCA)).mpr hC + -- A radius below `1` that bounds `K`. + obtain ⟨ρ, hρ0, hρ1, hρ⟩ : ∃ ρ : ℝ, 0 < ρ ∧ ρ < 1 ∧ ∀ x ∈ K, ‖x.1‖ ≤ ρ := by + by_cases hne : K.Nonempty + · obtain ⟨x, hx, hmax⟩ := hK.exists_isMaxOn hne (f := fun x : OpenUnitDisc => ‖x.1‖) + (by fun_prop) + have hlt : ‖x.1‖ < 1 := by simpa [OpenUnitDisc] using x.2 + exact ⟨max (1 / 2) ‖x.1‖, by positivity, max_lt (by norm_num) hlt, + fun y hy => (hmax hy).trans (le_max_right _ _)⟩ + · exact ⟨1 / 2, by norm_num, by norm_num, fun x hx => absurd ⟨x, hx⟩ hne⟩ + have hin : ∀ x : ClosedUnitDisc, ρ • x.1 ∈ OpenUnitDisc := by + intro x + have hx : ‖x.1‖ ≤ 1 := by simpa [ClosedUnitDisc] using x.2 + simp only [OpenUnitDisc, Metric.mem_ball, dist_zero_right, norm_smul, Real.norm_eq_abs, + abs_of_pos hρ0] + nlinarith [norm_nonneg x.1] + let G : ClosedUnitDisc → S := fun x => (ψ ⟨ρ • x.1, hin x⟩).1 + have hG : Continuous G := by + refine continuous_subtype_val.comp (ψ.continuous.comp (Continuous.subtype_mk ?_ _)) + fun_prop + have hGi : Function.Injective G := by + intro x y h + have h₁ := ψ.injective (Subtype.ext h) + have h₂ : ρ • x.1 = ρ • y.1 := congrArg Subtype.val h₁ + exact Subtype.ext (smul_right_injective _ hρ0.ne' h₂) + have : CompactSpace ClosedUnitDisc := isCompact_iff_compactSpace.mp (isCompact_closedBall _ _) + have hemb := hG.isClosedEmbedding hGi + refine ⟨range G, ⟨hemb.isEmbedding.toHomeomorph⟩, ?_, ?_⟩ + · rintro _ ⟨x, rfl⟩ + exact (ψ _).2 + · intro c hc + let z : OpenUnitDisc := ψ.symm ⟨c, hCA hc⟩ + have hz : z ∈ K := ⟨⟨c, hCA hc⟩, hc, rfl⟩ + have hn := hρ z hz + have hmem : ρ⁻¹ • z.1 ∈ ClosedUnitDisc := by + simp only [ClosedUnitDisc, Metric.mem_closedBall, dist_zero_right, norm_smul, norm_inv, + Real.norm_eq_abs, abs_of_pos hρ0] + rw [inv_mul_le_iff₀ hρ0] + linarith + refine ⟨⟨_, hmem⟩, ?_⟩ + have he : (⟨ρ • (ρ⁻¹ • z.1), hin ⟨_, hmem⟩⟩ : OpenUnitDisc) = z := + Subtype.ext (by simp [smul_smul, hρ0.ne']) + change (ψ ⟨ρ • (ρ⁻¹ • z.1), hin ⟨_, hmem⟩⟩).1 = c + rw [he] + simp [z] + +omit [ConnectedSpace S] in +/-- A path from a point `a` of a closed surface, into a given open set near `a`. -/ +theorem exists_path_from_point (hS : IsClosedSurface S) {O : Set S} (hO : IsOpen O) {a : S} + (ha : a ∈ O) : + ∃ g : I → S, Continuous g ∧ g 0 = a ∧ ∀ t, 0 < t → g t ∈ O \ {a} := by + have : T2Space S := hS.2.1 + obtain ⟨D, D', hD, -, ha', hsub, hDO, -⟩ := exists_closedDisc_nbhd hS hO ha + obtain ⟨φ⟩ := id hD + have haD : a ∈ D := hsub ha' + let q : ClosedUnitDisc := φ.symm ⟨a, haD⟩ + obtain ⟨u, hu⟩ : ∃ u : ClosedUnitDisc, u ≠ q := by + have h0 : (0 : EuclideanPlane) ∈ ClosedUnitDisc := by simp [ClosedUnitDisc] + have h1 : EuclideanSpace.single (0 : Fin 2) (1 : ℝ) ∈ ClosedUnitDisc := by simp [ClosedUnitDisc] + by_cases h : (⟨0, h0⟩ : ClosedUnitDisc) = q + · refine ⟨⟨_, h1⟩, fun h' => ?_⟩ + have := congrArg Subtype.val (h'.trans h.symm) + simp at this + · exact ⟨_, h⟩ + have hmem : ∀ t : I, (1 - t.1) • q.1 + t.1 • u.1 ∈ ClosedUnitDisc := by + intro t + exact (convex_closedBall (0 : EuclideanPlane) 1) q.2 u.2 (by linarith [t.2.2]) t.2.1 (by ring) + let g : I → S := fun t => (φ ⟨_, hmem t⟩).1 + refine ⟨g, ?_, ?_, ?_⟩ + · refine continuous_subtype_val.comp (φ.continuous.comp (Continuous.subtype_mk ?_ _)) + fun_prop + · have : (⟨_, hmem 0⟩ : ClosedUnitDisc) = q := Subtype.ext (by simp) + change (φ ⟨_, hmem 0⟩).1 = a + rw [this] + simp [q] + · intro t ht + refine ⟨hDO (φ _).2, fun h => hu ?_⟩ + have h₁ : φ ⟨_, hmem t⟩ = φ q := Subtype.ext (by simpa [q] using h) + have h₂ : (1 - t.1) • q.1 + t.1 • u.1 = q.1 := congrArg Subtype.val (φ.injective h₁) + have ht' : t.1 ≠ 0 := (show (0 : ℝ) < t.1 from ht).ne' + have h₃ : t.1 • (u.1 - q.1) = 0 := by + rw [smul_sub] + rw [sub_smul, one_smul] at h₂ + have : q.1 - t.1 • q.1 + t.1 • u.1 - q.1 = 0 := by rw [h₂, sub_self] + rw [← this] + abel + exact Subtype.ext (sub_eq_zero.mp ((smul_eq_zero.mp h₃).resolve_left ht')) + +/-- The two parts of a closed set. A region off `X` touches both of them, for otherwise `Σ` splits. +-/ +theorem exists_region_between (hS : IsClosedSurface S) {N : Drawing S} {X₁ X₂ : Set S} + (h₁ : IsClosed X₁) + (h₂ : IsClosed X₂) (hd : Disjoint X₁ X₂) (hN : N.U ⊆ X₁ ∪ X₂) (hne₁ : X₁.Nonempty) + (hne₂ : X₂.Nonempty) + (hreg : ∀ q ∈ N.R, q ⊆ X₁ ∪ X₂ ∨ Disjoint q (X₁ ∪ X₂)) : + ∃ q ∈ N.R, Disjoint q (X₁ ∪ X₂) ∧ (closure q ∩ X₁).Nonempty ∧ (closure q ∩ X₂).Nonempty := by + classical + have : T2Space S := hS.2.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hfin := finite_R hS N + let P : Set (Set S) := {q ∈ N.R | Disjoint q (X₁ ∪ X₂)} + have hPf : P.Finite := hfin.subset fun _ h => h.1 + let P₁ : Set (Set S) := {q ∈ P | (closure q ∩ X₁).Nonempty} + let P₂ : Set (Set S) := {q ∈ P | ¬ (closure q ∩ X₁).Nonempty} + let B₁ : Set S := X₁ ∪ ⋃ q ∈ P₁, closure q + let B₂ : Set S := X₂ ∪ ⋃ q ∈ P₂, closure q + have hP₁_finite : P₁.Finite := hPf.subset fun _ h => h.1 + have hP₂_finite : P₂.Finite := hPf.subset fun _ h => h.1 + have hB₁ : IsClosed B₁ := h₁.union (hP₁_finite.isClosed_biUnion fun _ _ => isClosed_closure) + have hB₂ : IsClosed B₂ := h₂.union (hP₂_finite.isClosed_biUnion fun _ _ => isClosed_closure) + have hcov : (univ : Set S) ⊆ B₁ ∪ B₂ := by + intro x _ + by_cases hx : x ∈ X₁ ∪ X₂ + · rcases hx with h | h + · exact Or.inl (Or.inl h) + · exact Or.inr (Or.inl h) + · have hxU : x ∉ N.U := fun h => hx (hN h) + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem hxU + have hrP : r ∈ P := by + refine ⟨hr, (hreg r hr).resolve_left fun h => hx (h hxr)⟩ + by_cases h : (closure r ∩ X₁).Nonempty + · exact Or.inl (Or.inr (mem_biUnion (show r ∈ P₁ from ⟨hrP, h⟩) (subset_closure hxr))) + · exact Or.inr (Or.inr (mem_biUnion (show r ∈ P₂ from ⟨hrP, h⟩) (subset_closure hxr))) + obtain ⟨z, -, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp isPreconnected_univ _ _ hB₁ hB₂ hcov + (by obtain ⟨x, hx⟩ := hne₁; exact ⟨x, mem_univ x, Or.inl hx⟩) + (by obtain ⟨x, hx⟩ := hne₂; exact ⟨x, mem_univ x, Or.inl hx⟩) + rcases hz₁ with hz₁ | hz₁ + · rcases hz₂ with hz₂ | hz₂ + · exact absurd hz₂ (disjoint_left.mp hd hz₁) + · obtain ⟨q, hq, hzq⟩ := mem_iUnion₂.mp hz₂ + exact absurd ⟨z, hzq, hz₁⟩ hq.2 + · obtain ⟨q, hq, hzq⟩ := mem_iUnion₂.mp hz₁ + rcases hz₂ with hz₂ | hz₂ + · exact ⟨q, hq.1.1, hq.1.2, hq.2, z, hzq, hz₂⟩ + · obtain ⟨q', hq', hzq'⟩ := mem_iUnion₂.mp hz₂ + by_cases hz : z ∈ X₁ ∪ X₂ + · rcases hz with hz | hz + · exact absurd ⟨z, hzq', hz⟩ hq'.2 + · exact ⟨q, hq.1.1, hq.1.2, hq.2, z, hzq, hz⟩ + · have hzU : z ∉ N.U := fun h => hz (hN h) + obtain ⟨r, hr, hzr⟩ := exists_region_of_notMem hzU + have hro := region_isOpen hr + obtain ⟨a, har, haq⟩ := mem_closure_iff.mp hzq r hro hzr + obtain ⟨b, hbr, hbq⟩ := mem_closure_iff.mp hzq' r hro hzr + have e₁ : r = q := region_eq_of_mem hr hq.1.1 har haq + have e₂ : r = q' := region_eq_of_mem hr hq'.1.1 hbr hbq + have e₃ : q = q' := e₁.symm.trans e₂ + exact absurd (e₃ ▸ hq.2) hq'.2 + +omit [ConnectedSpace S] in +/-- A vertex of `N` in the closure of a region off `X₁ ∪ X₂`, in the part that the closure meets. -/ +theorem exists_vertex_of_closure (hS : IsClosedSurface S) {N : Drawing S} {X₁ X₂ : Set S} + (h₁ : IsClosed X₁) + (h₂ : IsClosed X₂) (hd : Disjoint X₁ X₂) (hN : N.U ⊆ X₁ ∪ X₂) {q : Set S} (hq : q ∈ N.R) + (hdq : Disjoint q (X₁ ∪ X₂)) (hne : (closure q ∩ X₁).Nonempty) : ∃ a ∈ N.V, a ∈ closure q + ∧ a ∈ X₁ := by + have : T2Space S := hS.2.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨z, hzq, hz⟩ := hne + have hzU : z ∈ N.U := by + by_contra hzU + obtain ⟨r, hr, hzr⟩ := exists_region_of_notMem hzU + obtain ⟨a, har, haq⟩ := mem_closure_iff.mp hzq r (region_isOpen hr) hzr + have e : r = q := region_eq_of_mem hr hq har haq + exact disjoint_left.mp hdq (e ▸ hzr) (Or.inl hz) + by_cases hzV : z ∈ N.V + · exact ⟨z, hzV, hzq, hz⟩ + obtain ⟨e, he, hze⟩ := N.exists_edge_of_mem hzU hzV + have hes : e ⊆ closure q := edge_subset_closure_of_incident hS he hq ⟨z, hze, hzq⟩ + have hcl : closure e ⊆ closure q := closure_minimal hes isClosed_closure + have hp : IsPreconnected (closure e) := (he.2.2.1.isConnected.isPreconnected).closure + have hsub : closure e ⊆ X₁ ∪ X₂ := (N.closure_subset_U he).trans hN + have hin : closure e ⊆ X₁ := by + intro x hx + by_contra hxn + obtain ⟨w, -, hw₁, hw₂⟩ := isPreconnected_closed_iff.mp hp _ _ h₁ h₂ hsub ⟨z, subset_closure + hze, hz⟩ + ⟨x, hx, (hsub hx).resolve_left hxn⟩ + exact disjoint_left.mp hd hw₁ hw₂ + rcases N.edge_cond e he with ⟨u, v, -, hcap, -⟩ | ⟨u, hcap, -⟩ + · have hu : u ∈ closure e ∩ N.V := hcap ▸ mem_insert u _ + exact ⟨u, hu.2, hcl hu.1, hin hu.1⟩ + · have hu : u ∈ closure e ∩ N.V := hcap ▸ rfl + exact ⟨u, hu.2, hcl hu.1, hin hu.1⟩ + +omit [ConnectedSpace S] in +/-- A path from a vertex in the closure of a region into the region. -/ +theorem exists_path_into_region (hS : IsClosedSurface S) (N : Drawing S) {x : S} + (hx : x ∈ N.V) {p : Set S} + (hp : p ∈ N.R) (hxp : x ∈ closure p) : + ∃ g : I → S, Continuous g ∧ g 0 = x ∧ ∀ t, 0 < t → g t ∈ p := by + classical + have : T2Space S := hS.2.1 + have : Nonempty S := ⟨x⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar N + by_cases hne : (halfEdges N γ x).Nonempty + · exact exists_access hS N hγ hx hne hp hxp + -- `x` is an isolated vertex. + have hoff : ∀ f ∈ N.E, x ∉ closure f := by + intro f hf hxf + obtain ⟨c, hc⟩ := exists_end_eq hγ hf hx hxf + exact hne ⟨(f, c), hf, hc⟩ + have hcl : IsClosed ((N.V \ {x}) ∪ ⋃ e ∈ N.E, closure e) := + (N.finite_V.subset sdiff_subset).isClosed.union + (N.finite_edges.isClosed_biUnion fun _ _ => isClosed_closure) + have hxO : x ∈ ((N.V \ {x}) ∪ ⋃ e ∈ N.E, closure e)ᶜ := by + rintro (h | h) + · exact h.2 rfl + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp h + exact hoff f hf hxf + obtain ⟨Z, hZ, hxZ, hZO, hZc, -⟩ := exists_punctured_nbhd hS hcl.isOpen_compl hxO + have hdis : Disjoint (Z \ {x}) N.U := by + refine disjoint_left.mpr ?_ + rintro y ⟨hyZ, hyx⟩ hyU + rw [N.U_eq] at hyU + rcases hyU with h | h + · exact hZO hyZ (Or.inl ⟨h, hyx⟩) + · exact hZO hyZ (Or.inr h) + obtain ⟨y, hyZ, hyp⟩ := mem_closure_iff.mp hxp Z hZ hxZ + have hyx : y ≠ x := fun h => by + have := region_subset hp hyp + exact this (N.V_subset_U (h ▸ hx)) + have hsub : Z \ {x} ⊆ p := subset_region hp hZc hdis ⟨hyZ, hyx⟩ hyp + obtain ⟨g, hg, h0, ht⟩ := exists_path_from_point hS hZ hxZ + exact ⟨g, hg, h0, fun t h => hsub (ht t h)⟩ + +/-- **A line joining the two parts of `X`**, off `X` and off the finite set `Y`, between vertices of +`N`. -/ +theorem exists_bridge (hS : IsClosedSurface S) {N : Drawing S} {X₁ X₂ Y : Set S} (h₁ : IsClosed X₁) + (h₂ : IsClosed X₂) (hd : Disjoint X₁ X₂) (hN : N.U ⊆ X₁ ∪ X₂) (hne₁ : X₁.Nonempty) + (hne₂ : X₂.Nonempty) + (hreg : ∀ q ∈ N.R, q ⊆ X₁ ∪ X₂ ∨ Disjoint q (X₁ ∪ X₂)) (hY : Y.Finite) (hXY : Disjoint + (X₁ ∪ X₂) Y) : + ∃ e : I → S, Continuous e ∧ Function.Injective e ∧ e 0 ∈ N.V ∧ e 1 ∈ N.V ∧ e 0 ∈ X₁ ∧ e 1 ∈ X₂ ∧ + ∀ t, t ≠ 0 → t ≠ 1 → e t ∉ X₁ ∪ X₂ ∧ e t ∉ Y := by + have : T2Space S := hS.2.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨q, hq, hdq, hc₁, hc₂⟩ := exists_region_between hS h₁ h₂ hd hN hne₁ hne₂ hreg + obtain ⟨a, haV, haq, haX⟩ := exists_vertex_of_closure hS h₁ h₂ hd hN hq hdq hc₁ + have hN' : N.U ⊆ X₂ ∪ X₁ := by rwa [union_comm] + obtain ⟨b, hbV, hbq, hbX⟩ := exists_vertex_of_closure hS h₂ h₁ hd.symm hN' hq + (by rwa [union_comm]) hc₂ + have hab : a ≠ b := fun h => disjoint_left.mp hd haX (h ▸ hbX) + have hqo := region_isOpen hq + have hq₀ : IsPathConnected (q \ Y) := by + refine isPathConnected_of_isOpen hS (hqo.sdiff hY.isClosed) (isPreconnected_sdiff_finite hS hqo + ?_ hY) ?_ + · exact region_isPreconnected hq + · obtain ⟨g, hg, h0, ht⟩ := exists_path_into_region hS N haV hq haq + obtain ⟨u, hu, -, hs⟩ := exists_pos_le hg hY.isClosed.isOpen_compl + (h0 ▸ disjoint_left.mp hXY (Or.inl haX)) one_pos + exact ⟨g u, ht u hu, hs u le_rfl⟩ + -- Paths from `a` and `b` into `q - Y`. + have hinto : ∀ {x : S}, x ∈ N.V → x ∈ closure q → x ∉ Y → ∃ g : I → S, Continuous g ∧ g 0 = x ∧ + ∀ t, 0 < t → g t ∈ q \ Y := by + intro x hxV hxq hxY + obtain ⟨g, hg, h0, ht⟩ := exists_path_into_region hS N hxV hq hxq + obtain ⟨u, hu, -, hs⟩ := exists_pos_le hg hY.isClosed.isOpen_compl (h0 ▸ hxY) one_pos + refine ⟨fun t => g (t * u), hg.comp (by fun_prop), by simpa using h0, fun t ht₀ => ?_⟩ + have hp : 0 < t * u := show (0 : ℝ) < t.1 * u.1 from mul_pos ht₀ hu + exact ⟨ht _ hp, hs _ (unitInterval.mul_le_right)⟩ + obtain ⟨g₁, hg₁, h₁0, ht₁⟩ := hinto haV haq (disjoint_left.mp hXY (Or.inl haX)) + obtain ⟨g₂, hg₂, h₂0, ht₂⟩ := hinto hbV hbq (disjoint_left.mp hXY (Or.inr hbX)) + have haq' : a ∉ q \ Y := fun h => disjoint_left.mp hdq h.1 (Or.inl haX) + obtain ⟨e, he, hi, he0, he1, hin, -⟩ := exists_chord hq₀ hab haq' hg₁ hg₂ h₁0 h₂0 ht₁ ht₂ + refine ⟨e, he, hi, he0 ▸ haV, he1 ▸ hbV, he0 ▸ haX, he1 ▸ hbX, fun t h0' h1' => ?_⟩ + have := hin t h0' h1' + exact ⟨disjoint_left.mp hdq this.1, this.2⟩ + +theorem ncard_image_lt {α β : Type*} {A : Set α} {φ φ' : α → β} (hA : A.Finite) + (hmono : ∀ v ∈ A, ∀ w ∈ A, φ v = φ w → φ' v = φ' w) {a b : α} (ha : a ∈ A) (hb : b ∈ A) + (hne : φ a ≠ φ b) (heq : φ' a = φ' b) : (φ' '' A).ncard < (φ '' A).ncard := by + classical + have : Nonempty α := ⟨a⟩ + let B : Set β := φ '' A \ {φ b} + have hBf : B.Finite := (hA.image φ).subset sdiff_subset + choose! ρ hρ using (fun c (hc : c ∈ B) => (show ∃ v ∈ A, φ v = c from hc.1)) + have hsub : φ' '' A ⊆ (φ' ∘ ρ) '' B := by + rintro _ ⟨v, hv, rfl⟩ + by_cases h : φ v = φ b + · refine ⟨φ a, ⟨⟨a, ha, rfl⟩, hne⟩, ?_⟩ + have h₁ := hρ (φ a) ⟨⟨a, ha, rfl⟩, hne⟩ + rw [Function.comp, hmono _ h₁.1 _ ha h₁.2, heq, hmono _ hv _ hb h] + · have hc : φ v ∈ B := ⟨⟨v, hv, rfl⟩, h⟩ + refine ⟨φ v, hc, ?_⟩ + exact hmono _ (hρ _ hc).1 _ hv (hρ _ hc).2 + calc (φ' '' A).ncard ≤ ((φ' ∘ ρ) '' B).ncard := ncard_le_ncard hsub (hBf.image _) + _ ≤ B.ncard := ncard_image_le hBf + _ < (φ '' A).ncard := ncard_sdiff_singleton_lt_of_mem ⟨b, hb, rfl⟩ (hA.image φ) + +omit [ConnectedSpace S] in +/-- A connected closed locally arc-connected set is path-connected. -/ +theorem isPathConnected_of_locallyArc {X : Set S} (hl : IsLocallyArcConnected X) + (hp : IsPreconnected X) + (hne : X.Nonempty) : IsPathConnected X := by + classical + obtain ⟨x, hx⟩ := hne + have hstep : ∀ z ∈ X, ∃ A : Set S, IsOpen A ∧ z ∈ A ∧ ∀ y ∈ X ∩ A, JoinedIn X z y := by + intro z hz + obtain ⟨A, -, hzA, hA, harc⟩ := hl z hz univ isOpen_univ (mem_univ z) + refine ⟨A, hA, hzA, fun y hy => ?_⟩ + by_cases hyz : z = y + · exact hyz ▸ JoinedIn.refl hz + obtain ⟨L, hL, hline⟩ := harc z ⟨hz, hzA⟩ y hy hyz + obtain ⟨f, h0, h1⟩ := hline + have hc : Continuous fun t => (f t).1 := continuous_subtype_val.comp f.continuous + exact ⟨⟨⟨fun t => (f t).1, hc⟩, h0, h1⟩, fun t => (hL (f t).2).1⟩ + let J : Set S := {y | y ∈ X ∧ JoinedIn X x y} + choose! B hBo hBm hBj using hstep + have hsub : X ⊆ J := by + have hcov : X ⊆ (⋃ z ∈ J, B z) ∪ (⋃ z ∈ X \ J, B z) := by + intro z hz + by_cases hzJ : z ∈ J + · exact Or.inl (mem_biUnion hzJ (hBm z hz)) + · exact Or.inr (mem_biUnion ⟨hz, hzJ⟩ (hBm z hz)) + have hdis : X ∩ ((⋃ z ∈ J, B z) ∩ (⋃ z ∈ X \ J, B z)) = ∅ := by + refine subset_empty_iff.mp ?_ + rintro y ⟨hy, h₁, h₂⟩ + obtain ⟨z, hzJ, hyz⟩ := mem_iUnion₂.mp h₁ + obtain ⟨z', hz', hyz'⟩ := mem_iUnion₂.mp h₂ + exact hz'.2 ⟨hz'.1, (hzJ.2.trans (hBj z hzJ.1 y ⟨hy, hyz⟩)).trans + (hBj z' hz'.1 y ⟨hy, hyz'⟩).symm⟩ + have hopen₁ : IsOpen (⋃ z ∈ J, B z) := isOpen_biUnion fun z hz => hBo z hz.1 + have hopen₂ : IsOpen (⋃ z ∈ X \ J, B z) := isOpen_biUnion fun z hz => hBo z hz.1 + rcases isPreconnected_iff_subset_of_disjoint.mp hp _ _ hopen₁ hopen₂ hcov hdis with h | h + · intro y hy + obtain ⟨z, hzJ, hyz⟩ := mem_iUnion₂.mp (h hy) + exact ⟨hy, hzJ.2.trans (hBj z hzJ.1 y ⟨hy, hyz⟩)⟩ + · obtain ⟨z, hz, hxz⟩ := mem_iUnion₂.mp (h hx) + exact absurd ⟨hz.1, (hBj z hz.1 x ⟨hx, hxz⟩).symm⟩ hz.2 + exact ⟨x, hx, fun _ hy => (hsub hy).2⟩ + +omit [ConnectedSpace S] in +/-- In a sphere, a closed connected set other than the sphere lies in an open disc: take an `O`-arc +off +the set. -/ +theorem exists_openDisc_of_sphere (hS : IsClosedSurface S) (hsph : IsSphere S) {X : Set S} + (hXc : IsClosed X) + (hXp : IsPreconnected X) (hu : X ≠ univ) : ∃ A, IsOpenDisc A ∧ X ⊆ A := by + have : T2Space S := hS.2.1 + obtain ⟨z, hz⟩ := (ne_univ_iff_exists_notMem X).mp hu + obtain ⟨D, D', hD, -, -, -, hDX, -⟩ := exists_closedDisc_nbhd hS hXc.isOpen_compl hz + obtain ⟨F, hF⟩ : ∃ F, F = discBd D := ⟨_, rfl⟩ + have hFO : IsOArc F := hF ▸ IsClosedDisc.isOArc_discBd hD + have hFX : Disjoint X F := disjoint_left.mpr fun x hx hxF => + hDX (discBd_subset D (hF ▸ hxF)) hx + obtain ⟨Δ₁, Δ₂, -, hΔ₁, hΔ₂, hb₁, hb₂, hcup, hcap, -, -⟩ := sphere_disc S hsph F hFO + have hint₁ : IsOpen (Δ₁ \ discBd Δ₁) := (isOpenDisc_interior hS hΔ₁).1 + have hint₂ : IsOpen (Δ₂ \ discBd Δ₂) := (isOpenDisc_interior hS hΔ₂).1 + have hdis : Disjoint (Δ₁ \ discBd Δ₁) (Δ₂ \ discBd Δ₂) := disjoint_left.mpr fun x h₁ h₂ => + h₁.2 (by rw [hb₁, ← hcap]; exact ⟨h₁.1, h₂.1⟩) + have hcover : X ⊆ (Δ₁ \ discBd Δ₁) ∪ (Δ₂ \ discBd Δ₂) := fun x hx => by + have hxF : x ∉ F := disjoint_left.mp hFX hx + have hxu : x ∈ Δ₁ ∪ Δ₂ := hcup ▸ mem_univ x + rcases hxu with h' | h' + · exact Or.inl ⟨h', by rwa [hb₁]⟩ + · exact Or.inr ⟨h', by rwa [hb₂]⟩ + rcases hXp.subset_or_subset hint₁ hint₂ hdis hcover with h' | h' + · exact ⟨_, isOpenDisc_interior hS hΔ₁, h'⟩ + · exact ⟨_, isOpenDisc_interior hS hΔ₂, h'⟩ + +/-- (7.5) for a connected set. -/ +theorem closedDisc_of_connected (hS : IsClosedSurface S) {Y X : Set S} (hY : Y.Finite) + {N : Drawing S} (hXc : IsClosed X) (hNX : N.U ⊆ X) (hfr : frontier X ⊆ N.U) (hu : X ≠ univ) + (hXY : Disjoint X Y) (hall : ∀ F : Set S, F ⊆ X → IsOArc F → IsNullHomotopicOArcIn (univ \ Y) F) + (hp : IsPreconnected X) (hne : X.Nonempty) : ∃ Δ, IsClosedDisc Δ ∧ Δ ⊆ univ \ Y ∧ X ⊆ Δ := by + have : T2Space S := hS.2.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hK : CompactSpace S := hS.1 + have hn : IsGammaNice N X := isGammaNice_of_frontier (Drawing.IsSubdrawing.refl N) hNX hfr + have hl := (isSolid_of_nice hS hXc hn).1 + have hW : IsOpen (univ \ Y) := isOpen_univ.sdiff hY.isClosed + have hXW : X ⊆ univ \ Y := fun x hx => ⟨mem_univ x, disjoint_left.mp hXY hx⟩ + have hf := flat_of_null_oArcs hS hXc hn hXW hall + obtain ⟨A, hXA, hAW, h | h⟩ := exists_open_around hS hW hXW hXc hl + (isPathConnected_of_locallyArc hl hp hne) hf + · obtain ⟨A', hA', hXA'⟩ := exists_openDisc_of_sphere hS h.1 hXc hp hu + obtain ⟨Δ, hΔ, -, hXΔ⟩ := exists_closedDisc_of_isCompact hA' hXc.isCompact hXA' + exact ⟨Δ, hΔ, (subset_univ _).trans (h.2 ▸ hAW), hXΔ⟩ + · obtain ⟨Δ, hΔ, hΔA, hXΔ⟩ := exists_closedDisc_of_isCompact h hXc.isCompact hXA + exact ⟨Δ, hΔ, hΔA.trans hAW, hXΔ⟩ + +/-- The induction of (7.5): join the components of `X`. -/ +theorem closedDisc_of_invariant (hS : IsClosedSurface S) {Y : Set S} (hY : Y.Finite) + (n : ℕ) : ∀ (N : Drawing S) (X : Set S), IsClosed X → N.U ⊆ X → frontier X ⊆ N.U → X ≠ univ + → Disjoint X Y → + (∀ F : Set S, F ⊆ X → IsOArc F → IsNullHomotopicOArcIn (univ \ Y) F) → X.Nonempty → + (connectedComponentIn X '' N.V).ncard = n → ∃ Δ, IsClosedDisc Δ ∧ Δ ⊆ univ \ Y ∧ X ⊆ Δ := by + have : T2Space S := hS.2.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + induction n using Nat.strong_induction_on with + | _ n ih => + intro N X hXc hNX hfr hu hXY hall hne hn + by_cases hp : IsPreconnected X + · exact closedDisc_of_connected hS hY hXc hNX hfr hu hXY hall hp hne + -- Split `X` into two closed parts. + obtain ⟨t₁, t₂, ht₁, ht₂, hcov, hm₁, hm₂, hdis⟩ : ∃ t₁ t₂ : Set S, IsClosed t₁ ∧ IsClosed t₂ ∧ + X ⊆ t₁ ∪ t₂ ∧ (X ∩ t₁).Nonempty ∧ (X ∩ t₂).Nonempty ∧ ¬ (X ∩ (t₁ ∩ t₂)).Nonempty := by + by_contra hno + push Not at hno + exact hp (isPreconnected_closed_iff.mpr fun t t' h₁ h₂ h₃ h₄ h₅ => hno t t' h₁ h₂ h₃ h₄ h₅) + let X₁ := X ∩ t₁ + let X₂ := X ∩ t₂ + have hX₁ : IsClosed X₁ := hXc.inter ht₁ + have hX₂ : IsClosed X₂ := hXc.inter ht₂ + have hd : Disjoint X₁ X₂ := disjoint_left.mpr fun x h₁ h₂ => hdis ⟨x, h₁.1, h₁.2, h₂.2⟩ + have hXe : X₁ ∪ X₂ = X := by + ext x + constructor + · rintro (h | h) <;> exact h.1 + · intro h + rcases hcov h with h' | h' + · exact Or.inl ⟨h, h'⟩ + · exact Or.inr ⟨h, h'⟩ + have hreg : ∀ q ∈ N.R, q ⊆ X₁ ∪ X₂ ∨ Disjoint q (X₁ ∪ X₂) := by + intro q hq + rw [hXe] + have hqU : Disjoint q N.U := disjoint_left.mpr fun x hx => region_subset hq hx + have hsplit : q ⊆ interior X ∪ Xᶜ := by + intro x hx + by_cases hxX : x ∈ X + · refine Or.inl ?_ + by_contra hint + exact disjoint_left.mp hqU hx (hfr ⟨subset_closure hxX, hint⟩) + · exact Or.inr hxX + rcases (region_isPreconnected hq).subset_or_subset isOpen_interior hXc.isOpen_compl + (disjoint_left.mpr fun x h₁ h₂ => h₂ (interior_subset h₁)) hsplit with h | h + · exact Or.inl (h.trans interior_subset) + · exact Or.inr (disjoint_left.mpr fun x hx hxX => h hx hxX) + obtain ⟨e, he, hi, h0V, h1V, h0, h1, hin⟩ := exists_bridge hS hX₁ hX₂ hd + (hXe ▸ hNX) hm₁ hm₂ hreg hY (hXe ▸ hXY) + have hline : IsLineWithEnds (range e) (e 0) (e 1) := isLine_range he hi + have hab : e 0 ≠ e 1 := fun h => disjoint_left.mp hd h0 (h ▸ h1) + have hmeet : N.U ∩ (lineDrawing hline hab).U ⊆ N.V ∩ (lineDrawing hline hab).V := by + rintro _ ⟨hx, t, rfl⟩ + by_cases ht0 : t = 0 + · subst ht0 + exact ⟨h0V, Or.inl rfl⟩ + by_cases ht1 : t = 1 + · subst ht1 + exact ⟨h1V, Or.inr rfl⟩ + exact absurd (hXe ▸ hNX hx) (hin t ht0 ht1).1 + let N' := N.glue (lineDrawing hline hab) hmeet + let X' := X ∪ range e + have hX'c : IsClosed X' := hXc.union (isCompact_range he).isClosed + have hNU' : N'.U = N.U ∪ range e := rfl + have hNV' : N'.V = N.V := by + refine subset_antisymm ?_ subset_union_left + rintro x (h | rfl | rfl) + · exact h + · exact h0V + · exact h1V + have hnotS : X' ≠ univ := by + obtain ⟨z, hz⟩ := (ne_univ_iff_exists_notMem X).mp hu + obtain ⟨y, hyO, hyU⟩ := exists_notMem_U (Γ := N') hS hXc.isOpen_compl ⟨z, hz⟩ + refine (ne_univ_iff_exists_notMem _).mpr ⟨y, ?_⟩ + rintro (h | ⟨t, rfl⟩) + · exact hyO h + · exact hyU (Or.inr ⟨t, rfl⟩) + have hX'Y : Disjoint X' Y := by + refine disjoint_left.mpr ?_ + rintro _ (h | ⟨t, rfl⟩) + · exact disjoint_left.mp hXY h + · by_cases ht0 : t = 0 + · subst ht0 + exact disjoint_left.mp hXY (hXe ▸ Or.inl h0) + by_cases ht1 : t = 1 + · subst ht1 + exact disjoint_left.mp hXY (hXe ▸ Or.inr h1) + exact (hin t ht0 ht1).2 + have hall' : ∀ F : Set S, F ⊆ X' → IsOArc F → IsNullHomotopicOArcIn (univ \ Y) F := by + intro F hF hO + refine hall F ?_ hO + rw [← hXe] + refine oArc_subset_of_bridge hX₁ hX₂ hd he hi h0 h1 (fun t h₁' h₂' => (hin t h₁' h₂').1) hO ?_ + rwa [hXe] + have hlt : (connectedComponentIn X' '' N'.V).ncard < n := by + rw [← hn, hNV'] + refine ncard_image_lt N.finite_V ?_ h0V h1V ?_ ?_ + · intro v hv w hw h + have hvX : v ∈ X := hNX (N.V_subset_U hv) + have hwc : w ∈ connectedComponentIn X v := h ▸ mem_connectedComponentIn (hNX + (N.V_subset_U hw)) + have hsub : connectedComponentIn X v ⊆ connectedComponentIn X' v := + isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn hvX) (connectedComponentIn_subset _ _ |>.trans + subset_union_left) + exact (connectedComponentIn_eq (hsub hwc)) + · intro h + have hb : e 1 ∈ connectedComponentIn X (e 0) := h ▸ mem_connectedComponentIn + (hXe ▸ Or.inr h1) + have hin₁ : connectedComponentIn X (e 0) ⊆ X₁ := by + intro x hx + by_contra hxn + have hsub : connectedComponentIn X (e 0) ⊆ X₁ ∪ X₂ := + hXe ▸ connectedComponentIn_subset _ _ + obtain ⟨w, -, hw₁, hw₂⟩ := isPreconnected_closed_iff.mp + isPreconnected_connectedComponentIn _ _ hX₁ hX₂ + hsub ⟨_, mem_connectedComponentIn (hXe ▸ Or.inl h0), h0⟩ ⟨x, hx, + (hsub hx).resolve_left hxn⟩ + exact disjoint_left.mp hd hw₁ hw₂ + exact disjoint_left.mp hd (hin₁ hb) h1 + · exact connectedComponentIn_eq ((isPreconnected_range he).subset_connectedComponentIn + (mem_range_self 0) subset_union_right (mem_range_self 1)) + obtain ⟨Δ, hΔ, hΔY, hsub⟩ := ih _ hlt N' X' hX'c + (by rw [hNU']; exact union_subset_union_left _ hNX) + ((frontier_union_subset _ _).trans (union_subset + ((inter_subset_left.trans hfr).trans subset_union_left) + ((inter_subset_right.trans (frontier_subset_closure.trans + (isCompact_range he).isClosed.closure_eq.subset)).trans subset_union_right))) + hnotS hX'Y hall' (hne.mono subset_union_left) rfl + exact ⟨Δ, hΔ, hΔY, subset_union_left.trans hsub⟩ + +/-- **(7.5)** of Graph Minors XI (page 94): "If $\Sigma$ is connected, $X \subseteq \Sigma$ is +closed and nice and $X \ne \Sigma$, and $Y +\subseteq \Sigma$ is finite, and $X \cap Y = \emptyset$, and every $O$-arc in $X$ is +null-homotopic in $\Sigma - Y$, then there is a closed disc $\Delta \subseteq \Sigma - Y$ +with $X \subseteq \Delta$." -/ +theorem theorem_7_5_proof (hS : IsClosedSurface S) {X Y : Set S} (hXc : IsClosed X) + (hXn : IsNice X) (hu : X ≠ univ) (hY : Y.Finite) (hXY : Disjoint X Y) + (hall : ∀ F : Set S, F ⊆ X → IsOArc F → IsNullHomotopicOArcIn (univ \ Y) F) : + ∃ Δ, IsClosedDisc Δ ∧ Δ ⊆ univ \ Y ∧ X ⊆ Δ := by + have : T2Space S := hS.2.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + by_cases hne : X.Nonempty + · obtain ⟨Γ, hΓ⟩ := hXn + have hU := frontier_interSet hS hXc hΓ + exact closedDisc_of_invariant hS hY _ _ X hXc (hU.subset.trans hXc.frontier_subset) + hU.symm.subset hu hXY + hall hne rfl + · -- For the empty set, take a small disc off `Y`. + obtain ⟨x⟩ : Nonempty S := inferInstance + obtain ⟨D, D', hD, -, -, -, -, -⟩ := exists_closedDisc_nbhd hS isOpen_univ (mem_univ x) + obtain ⟨z, -, hz⟩ := (infinite_of_isOArc (IsClosedDisc.isOArc_discBd hD)).exists_notMem_finite + hY + obtain ⟨E, E', hE, -, -, -, hEO, -⟩ := exists_closedDisc_nbhd hS hY.isClosed.isOpen_compl hz + exact ⟨E, hE, fun y hy => ⟨mem_univ y, hEO hy⟩, by + rw [not_nonempty_iff_eq_empty.mp hne] + exact empty_subset _⟩ + +end Surface + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/ThreeCircuits.lean b/LeanPool/GraphMinor/GM11/ThreeCircuits.lean new file mode 100644 index 0000000000..d3b9619451 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/ThreeCircuits.lean @@ -0,0 +1,712 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Rings + +/-! +# Three circuits whose edges cover each other twice + +At the end of the proof of (5.4) in Graph Minors XI we have three circuits `C₁, C₂, C₃` with +`E(C₃) = E(C₁) △ E(C₂)`, and we know that they are the only circuits of length `< 2θ` inside +`C₁ ∪ C₂`. Here we show that then `C₁ ∪ C₂` is three paths with the same ends (`exists_theta`), so +that the second slope axiom applies. This file is pure graph theory. + +The proof looks at a piece `S` of `C₁`, called an *ear*, that meets `C₂` only in its ends. If some +edge of `C₁` outside `C₂` is not in `S`, then there are two disjoint ears, one of them has at most +half the length of `C₁`, and with the shorter of the two pieces of `C₂` between its ends it forms a +short circuit that is none of `C₁, C₂, C₃`. So there is one ear `S` and the rest of `C₁` lies in +`C₂`. +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] {Γ : Drawing S} + +/-- The ends of an edge of a walk lie on the walk. -/ +theorem mem_support_of_mem_closure {a b : S} (W : GraphWalk Γ.toGraph a b) {f : Set S} {x : S} + (hf : f ∈ W.edges) (hx : x ∈ closure f) (hxV : x ∈ Γ.V) : x ∈ W.support := by + induction W with + | nil h => exact absurd hf List.not_mem_nil + | @cons a v b e hl r ih => + rcases List.mem_cons.mp hf with rfl | hf + · have hm : x ∈ closure f ∩ Γ.V := ⟨hx, hxV⟩ + rw [hl.2.2.2] at hm + rcases hm with rfl | h + · exact List.mem_cons_self + · exact List.mem_cons_of_mem _ ((show x = v from h) ▸ r.start_mem_support) + · exact List.mem_cons_of_mem _ (ih hf) + +/-- A walk to `a` from another vertex has an edge at `a`. -/ +theorem exists_edge_at_end {x a : S} (W : GraphWalk Γ.toGraph x a) (hne : x ≠ a) : + ∃ f ∈ W.edges, a ∈ closure f := by + induction W with + | nil h => exact absurd rfl hne + | @cons x v a e hl r ih => + by_cases hv : v = a + · subst hv + have hm : v ∈ closure e ∩ Γ.V := by rw [hl.2.2.2]; simp + exact ⟨e, List.mem_cons_self, hm.1⟩ + · obtain ⟨f, hf, h⟩ := ih hv + exact ⟨f, List.mem_cons_of_mem _ hf, h⟩ + +/-- All edges of a circuit cannot lie on a path. -/ +theorem circuit_not_in_path {D : Drawing S} (hD : D.IsCircuit) + (hDs : D.IsSubdrawing Γ) {a b : S} + (W : GraphWalk Γ.toGraph a b) (hW : W.IsSimple) (h : ∀ e ∈ D.E, e ∈ W.edges) : False := by + obtain ⟨g, hg⟩ := IsCircuit.E_nonempty hD + induction W with + | nil _ => exact absurd (h g hg) List.not_mem_nil + | @cons a v b e hl r ih => + by_cases he : e ∈ D.E + · have hmem : ∀ x, x ∈ closure e ∩ Γ.V → x ∈ D.V := fun x hx => by + rw [← hDs.closure_inter_V he] at hx + exact hx.2 + have haD : a ∈ D.V := hmem a (by rw [hl.2.2.2]; simp) + have hvD : v ∈ D.V := hmem v (by rw [hl.2.2.2]; simp) + have hne : a ∉ r.support := (List.nodup_cons.mp hW).1 + have hat : ∀ f ∈ D.E, a ∈ closure f → f = e := by + intro f hf haf + rcases List.mem_cons.mp (h f hf) with h' | h' + · exact h' + · exact absurd (mem_support_of_mem_closure r h' haf hl.2.1) hne + obtain ⟨X, ⟨-, hed⟩, hpos, -, hE⟩ := exists_walk_at hD haD + cases X with + | nil _ => simp at hpos + | @cons a y a' g' hg' t => + have hg'D : g' ∈ D.E := by rw [hE]; exact List.mem_cons_self + have hcap : closure g' ∩ D.V = {a, y} := hg'.2.2.2 + have hag : a ∈ closure g' ∩ D.V := by rw [hcap]; simp + have hge : g' = e := hat g' hg'D hag.1 + by_cases hy : y = a + · have hv' : v ∈ closure g' ∩ D.V := ⟨hge ▸ (show v ∈ closure e ∩ Γ.V by + rw [hl.2.2.2]; simp).1, hvD⟩ + rw [hcap, hy] at hv' + have hva : v = a := by simpa using hv' + exact hne (hva ▸ r.start_mem_support) + · obtain ⟨f, hf, haf⟩ := exists_edge_at_end t hy + have hfD : f ∈ D.E := by rw [hE]; exact List.mem_cons_of_mem _ hf + have hfe : f = g' := (hat f hfD haf).trans hge.symm + exact (List.nodup_cons.mp hed).1 (hfe ▸ hf) + · exact ih hW.of_cons fun f hf => + (List.mem_cons.mp (h f hf)).resolve_left fun h' => he (h' ▸ hf) + +/-- A circuit whose edges are edges of a circuit has all its edges. -/ +theorem circuit_E_eq_of_subset {C D : Drawing S} (hC : C.IsCircuit) (hD : D.IsCircuit) + (hCs : C.IsSubdrawing Γ) (hDs : D.IsSubdrawing Γ) (h : D.E ⊆ C.E) : D.E = C.E := by + refine subset_antisymm h fun f hf => ?_ + by_contra hfD + obtain ⟨u, W, ⟨hnd, -⟩, -, -, hE⟩ := hC + obtain ⟨W', hs, he⟩ := hCs.exists_walk_up W + have hf' : f ∈ W'.edges := by + rw [he] + rw [hE] at hf + exact hf + obtain ⟨x, y, W₁, hl, W₂, rfl⟩ := exists_split_edge W' hf' + rw [← hs, GraphWalk.support_append] at hnd + have hsup : (GraphWalk.cons hl W₂).support.tail = W₂.support := rfl + rw [hsup, W₁.support_eq_cons, List.cons_append, List.tail_cons] at hnd + refine circuit_not_in_path hD hDs (W₂.append W₁) ?_ fun e heD => ?_ + · unfold GraphWalk.IsSimple + rw [GraphWalk.support_append] + exact (List.perm_append_comm.nodup_iff).mp hnd + · have heW : e ∈ (W₁.append (GraphWalk.cons hl W₂)).edges := by + have heC : e ∈ C.E := h heD + rw [hE] at heC + rw [he] + exact heC + rw [GraphWalk.edges_append] at heW ⊢ + rcases List.mem_append.mp heW with h₁ | h₁ + · exact List.mem_append_right _ h₁ + · rcases List.mem_cons.mp h₁ with rfl | h₁ + · exact absurd heD hfD + · exact List.mem_append_left _ h₁ + +/-- A circuit is determined by its edges. -/ +theorem circuit_eq_of_E {C D : Drawing S} (hC : C.IsCircuit) (hD : D.IsCircuit) + (hCs : C.IsSubdrawing Γ) (hDs : D.IsSubdrawing Γ) (h : C.E = D.E) : C = D := by + have key : ∀ {A B : Drawing S}, A.IsCircuit → A.IsSubdrawing Γ → B.IsSubdrawing Γ → A.E = B.E → + A.V ⊆ B.V := by + intro A B hA hAs hBs hAB x hx + obtain ⟨X, -, hpos, -, hE⟩ := exists_walk_at hA hx + cases X with + | nil _ => simp at hpos + | @cons a y a' g hg t => + have hgA : g ∈ A.E := by rw [hE]; exact List.mem_cons_self + have hm : x ∈ closure g ∩ A.V := by rw [hg.2.2.2]; simp + rw [hAs.closure_inter_V hgA, ← hBs.closure_inter_V (hAB ▸ hgA)] at hm + exact hm.2 + exact Drawing.ext_of_V_E (subset_antisymm (key hC hCs hDs h) (key hD hDs hCs h.symm)) h + +/-- `W₁` and `W₂` cut the circuit `C` into two pieces, from `a` to `b` and back. -/ +structure Splits (C : Drawing S) {a b : S} (W₁ : GraphWalk Γ.toGraph a b) + (W₂ : GraphWalk Γ.toGraph b a) : Prop where + s₁ : W₁.IsSimple + s₂ : W₂.IsSimple + meet : ∀ x, x ∈ W₁.support → x ∈ W₂.support → x = a ∨ x = b + edge : ∀ e ∈ W₁.edges, e ∉ W₂.edges + V : ∀ x, x ∈ C.V ↔ x ∈ W₁.support ∨ x ∈ W₂.support + E : ∀ e, e ∈ C.E ↔ e ∈ W₁.edges ∨ e ∈ W₂.edges + +namespace Splits + +variable {C : Drawing S} {a b : S} {W₁ : GraphWalk Γ.toGraph a b} {W₂ : GraphWalk Γ.toGraph b a} + +theorem swap (h : Splits C W₁ W₂) : Splits C W₂ W₁ where + s₁ := h.s₂ + s₂ := h.s₁ + meet x h₂ h₁ := (h.meet x h₁ h₂).symm + edge e h₂ h₁ := h.edge e h₁ h₂ + V x := (h.V x).trans or_comm + E e := (h.E e).trans or_comm + +theorem rev (h : Splits C W₁ W₂) : Splits C W₂.reverse W₁.reverse where + s₁ := h.s₂.reverse + s₂ := h.s₁.reverse + meet x h₂ h₁ := by + rw [GraphWalk.support_reverse, List.mem_reverse] at h₁ h₂ + exact h.meet x h₁ h₂ + edge e h₂ h₁ := by + rw [GraphWalk.edges_reverse, List.mem_reverse] at h₁ h₂ + exact h.edge e h₁ h₂ + V x := by + rw [GraphWalk.support_reverse, GraphWalk.support_reverse, List.mem_reverse, List.mem_reverse] + exact (h.V x).trans or_comm + E e := by + rw [GraphWalk.edges_reverse, GraphWalk.edges_reverse, List.mem_reverse, List.mem_reverse] + exact (h.E e).trans or_comm + +/-- The vertices on the two sides of a joint of a simple walk. -/ +theorem append_meet {c : S} {P₁ : GraphWalk Γ.toGraph a c} {P₂ : GraphWalk Γ.toGraph c b} + (hW : (P₁.append P₂).IsSimple) {y : S} (h₁ : y ∈ P₁.support) (h₂ : y ∈ P₂.support) : y = c := by + unfold GraphWalk.IsSimple at hW + rw [GraphWalk.support_append] at hW + by_contra hne + have hy : y ∈ P₂.support.tail := by + rw [P₂.support_eq_cons] at h₂ + exact (List.mem_cons.mp h₂).resolve_left hne + exact (List.nodup_append.mp hW).2.2 y h₁ y hy rfl + +theorem append_edge {c : S} {P₁ : GraphWalk Γ.toGraph a c} {P₂ : GraphWalk Γ.toGraph c b} + (hW : (P₁.append P₂).IsSimple) {e : Set S} (h₁ : e ∈ P₁.edges) (h₂ : e ∈ P₂.edges) : False := by + have hnd := hW.edges_nodup + rw [GraphWalk.edges_append] at hnd + exact (List.nodup_append.mp hnd).2.2 e h₁ e h₂ rfl + +/-- Cutting the first piece at `c`: the part from `a` to `c`, and all the rest. -/ +theorem split_left {c : S} {P₁ : GraphWalk Γ.toGraph a c} {P₂ : GraphWalk Γ.toGraph c b} + (h : Splits C (P₁.append P₂) W₂) (hca : c ≠ a) (hcb : c ≠ b) : + Splits C P₁ (P₂.append W₂) := by + have hs := isSimple_of_append h.s₁ + have hbP : b ∉ P₁.support := fun hb => hcb (append_meet h.s₁ hb P₂.end_mem_support).symm + have haP : a ∉ P₂.support := fun ha => hca (append_meet h.s₁ P₁.start_mem_support ha).symm + have hin₁ : ∀ x ∈ P₁.support, x ∈ (P₁.append P₂).support := fun x hx => + (GraphWalk.mem_support_append _ _).mpr (Or.inl hx) + have hin₂ : ∀ x ∈ P₂.support, x ∈ (P₁.append P₂).support := fun x hx => + (GraphWalk.mem_support_append _ _).mpr (Or.inr hx) + refine ⟨hs.1, isSimple_append' hs.2 h.s₂ fun y h₁ h₂ => ?_, fun x h₁ h₂ => ?_, fun e h₁ h₂ => ?_, + fun x => ?_, fun e => ?_⟩ + · exact (h.meet y (hin₂ y h₁) h₂).resolve_left fun hy => haP (hy ▸ h₁) + · rcases (GraphWalk.mem_support_append _ _).mp h₂ with h₂ | h₂ + · exact Or.inr (append_meet h.s₁ h₁ h₂) + · exact Or.inl ((h.meet x (hin₁ x h₁) h₂).resolve_right fun hx => hbP (hx ▸ h₁)) + · rw [GraphWalk.edges_append] at h₂ + rcases List.mem_append.mp h₂ with h₂ | h₂ + · exact append_edge h.s₁ h₁ h₂ + · refine h.edge e ?_ h₂ + rw [GraphWalk.edges_append] + exact List.mem_append_left _ h₁ + · rw [h.V, GraphWalk.mem_support_append, GraphWalk.mem_support_append, or_assoc] + · rw [h.E, GraphWalk.edges_append, GraphWalk.edges_append, List.mem_append, List.mem_append, + or_assoc] + +/-- Cutting the first piece at `c`: the part from `c` to `b`, and all the rest. -/ +theorem split_right {c : S} {P₁ : GraphWalk Γ.toGraph a c} {P₂ : GraphWalk Γ.toGraph c b} + (h : Splits C (P₁.append P₂) W₂) (hca : c ≠ a) (hcb : c ≠ b) : + Splits C P₂ (W₂.append P₁) := by + have hs := isSimple_of_append h.s₁ + have hbP : b ∉ P₁.support := fun hb => hcb (append_meet h.s₁ hb P₂.end_mem_support).symm + have haP : a ∉ P₂.support := fun ha => hca (append_meet h.s₁ P₁.start_mem_support ha).symm + have hin₁ : ∀ x ∈ P₁.support, x ∈ (P₁.append P₂).support := fun x hx => + (GraphWalk.mem_support_append _ _).mpr (Or.inl hx) + have hin₂ : ∀ x ∈ P₂.support, x ∈ (P₁.append P₂).support := fun x hx => + (GraphWalk.mem_support_append _ _).mpr (Or.inr hx) + refine ⟨hs.2, isSimple_append' h.s₂ hs.1 fun y h₂ h₁ => ?_, fun x h₂ h₃ => ?_, fun e h₁ h₂ => ?_, + fun x => ?_, fun e => ?_⟩ + · exact (h.meet y (hin₁ y h₁) h₂).resolve_right fun hy => hbP (hy ▸ h₁) + · rcases (GraphWalk.mem_support_append _ _).mp h₃ with h₃ | h₃ + · exact Or.inr ((h.meet x (hin₂ x h₂) h₃).resolve_left fun hx => haP (hx ▸ h₂)) + · exact Or.inl (append_meet h.s₁ h₃ h₂) + · rw [GraphWalk.edges_append] at h₂ + rcases List.mem_append.mp h₂ with h₂ | h₂ + · refine h.edge e ?_ h₂ + rw [GraphWalk.edges_append] + exact List.mem_append_right _ h₁ + · exact append_edge h.s₁ h₂ h₁ + · rw [h.V, GraphWalk.mem_support_append, GraphWalk.mem_support_append] + tauto + · rw [h.E, GraphWalk.edges_append, GraphWalk.edges_append, List.mem_append, List.mem_append] + tauto + +end Splits + +/-- A circuit splits at any two of its vertices. -/ +theorem exists_splits [T2Space S] {C : Drawing S} (hC : C.IsCircuit) (hCs : C.IsSubdrawing Γ) {a b + : S} + (ha : a ∈ C.V) (hb : b ∈ C.V) (hab : a ≠ b) : + ∃ (W₁ : GraphWalk Γ.toGraph a b) (W₂ : GraphWalk Γ.toGraph b a), Splits C W₁ W₂ := by + obtain ⟨P, Q, ⟨X, hX, hXV, hXE⟩, ⟨Y, hY, hYV, hYE⟩, hPs, hQs, -, -, hVm, hEd, hsup⟩ := + hC.exists_two_paths ha hb hab + obtain ⟨X', hs₁, he₁⟩ := (hPs.trans hCs).exists_walk_up X + obtain ⟨Y', hs₂, he₂⟩ := (hQs.trans hCs).exists_walk_up Y + have hV := congrArg Drawing.V hsup + have hE := congrArg Drawing.E hsup + rw [Drawing.sup_V hPs hQs] at hV + rw [Drawing.sup_E hPs hQs] at hE + have hmemV₁ : ∀ x, x ∈ P.V ↔ x ∈ X'.support := fun x => by rw [hXV, hs₁]; rfl + have hmemV₂ : ∀ x, x ∈ Q.V ↔ x ∈ Y'.reverse.support := fun x => by + rw [hYV, GraphWalk.support_reverse, List.mem_reverse, hs₂]; rfl + have hmemE₁ : ∀ e, e ∈ P.E ↔ e ∈ X'.edges := fun e => by rw [hXE, he₁]; rfl + have hmemE₂ : ∀ e, e ∈ Q.E ↔ e ∈ Y'.reverse.edges := fun e => by + rw [hYE, GraphWalk.edges_reverse, List.mem_reverse, he₂]; rfl + refine ⟨X', Y'.reverse, ?_, ?_, fun x h₁ h₂ => ?_, fun e h₁ h₂ => ?_, fun x => ?_, fun e => ?_⟩ + · unfold GraphWalk.IsSimple + rw [hs₁] + exact hX + · have hsimple : Y'.IsSimple := by + unfold GraphWalk.IsSimple + rw [hs₂] + exact hY + exact hsimple.reverse + · have hm : x ∈ P.V ∩ Q.V := ⟨(hmemV₁ x).mpr h₁, (hmemV₂ x).mpr h₂⟩ + rw [hVm] at hm + exact hm + · exact disjoint_left.mp hEd ((hmemE₁ e).mpr h₁) ((hmemE₂ e).mpr h₂) + · rw [← hV, mem_union, hmemV₁, hmemV₂] + · rw [← hE, mem_union, hmemE₁, hmemE₂] + +/-- `S` is an *ear* on `C₂`: a path between two vertices of `C₂` with nothing else in common. -/ +structure IsEar (C₂ : Drawing S) {a b : S} (T : GraphWalk Γ.toGraph a b) : Prop where + left : a ∈ C₂.V + right : b ∈ C₂.V + ne : a ≠ b + inner : ∀ x ∈ T.support, x ∈ C₂.V → x = a ∨ x = b + off : ∀ f ∈ T.edges, f ∉ C₂.E + +/-- Inside a piece of `C` between two vertices of `C₂`, each edge off `C₂` lies on an ear. -/ +theorem exists_ear {C C₂ : Drawing S} (hsub : C₂.IsSubdrawing Γ) {e : Set S} (he : e ∉ C₂.E) + (n : ℕ) : + ∀ {a b : S} (W₁ : GraphWalk Γ.toGraph a b) (W₂ : GraphWalk Γ.toGraph b a), Splits C W₁ W₂ → + a ∈ C₂.V → b ∈ C₂.V → a ≠ b → e ∈ W₁.edges → W₁.length = n → + ∃ (a' b' : S) (T : GraphWalk Γ.toGraph a' b') (T' : GraphWalk Γ.toGraph b' a'), + Splits C T T' ∧ IsEar C₂ T ∧ e ∈ T.edges ∧ ∀ f ∈ T.edges, f ∈ W₁.edges := by + induction n using Nat.strong_induction_on with + | _ n ih => + intro a b W₁ W₂ h ha hb hab heW hn + by_cases hc : ∃ c ∈ W₁.support, c ∈ C₂.V ∧ c ≠ a ∧ c ≠ b + · obtain ⟨c, hcW, hcC, hca, hcb⟩ := hc + obtain ⟨P₁, P₂, rfl⟩ := W₁.exists_append_of_mem hcW + have hl₁ : P₁.length ≠ 0 := fun h => hca (GraphWalk.eq_of_length_eq_zero h).symm + have hl₂ : P₂.length ≠ 0 := fun h => hcb (GraphWalk.eq_of_length_eq_zero h) + rw [GraphWalk.length_append] at hn + rw [GraphWalk.edges_append] at heW + rcases List.mem_append.mp heW with hP | hP + · obtain ⟨a', b', T, T', h₁, h₂, h₃, h₄⟩ := ih P₁.length (by omega) P₁ _ + (h.split_left hca hcb) ha hcC hca.symm hP rfl + refine ⟨a', b', T, T', h₁, h₂, h₃, fun f hf => ?_⟩ + rw [GraphWalk.edges_append] + exact List.mem_append_left _ (h₄ f hf) + · obtain ⟨a', b', T, T', h₁, h₂, h₃, h₄⟩ := ih P₂.length (by omega) P₂ _ + (h.split_right hca hcb) hcC hb hcb hP rfl + refine ⟨a', b', T, T', h₁, h₂, h₃, fun f hf => ?_⟩ + rw [GraphWalk.edges_append] + exact List.mem_append_right _ (h₄ f hf) + · push Not at hc + have hinner : ∀ x ∈ W₁.support, x ∈ C₂.V → x = a ∨ x = b := fun x hx hxC => by + by_contra hne + push Not at hne + exact hne.2 (hc x hx hxC hne.1) + refine ⟨a, b, W₁, W₂, h, ⟨ha, hb, hab, hinner, fun f hf hfC => ?_⟩, heW, fun _ h => h⟩ + obtain ⟨x, y, X, hl, Y, rfl⟩ := exists_split_edge W₁ hf + have hs := isSimple_of_append h.s₁ + have hmeet : ∀ z ∈ X.support, z ∈ Y.support → False := fun z h₁ h₂ => by + have hW : (X.append (GraphWalk.cons hl Y)).IsSimple := h.s₁ + unfold GraphWalk.IsSimple at hW + rw [GraphWalk.support_append] at hW + exact (List.nodup_append.mp hW).2.2 z h₁ z h₂ rfl + have hmemC : ∀ z, z ∈ closure f ∩ Γ.V → z ∈ C₂.V := fun z hz => by + rw [← hsub.closure_inter_V hfC] at hz + exact hz.2 + have hxC := hmemC x (by rw [hl.2.2.2]; simp) + have hyC := hmemC y (by rw [hl.2.2.2]; simp) + have hxW : x ∈ (X.append (GraphWalk.cons hl Y)).support := + (GraphWalk.mem_support_append _ _).mpr (Or.inl X.end_mem_support) + have hyW : y ∈ (X.append (GraphWalk.cons hl Y)).support := + (GraphWalk.mem_support_append _ _).mpr + (Or.inr (List.mem_cons_of_mem _ Y.start_mem_support)) + have hxa : x = a := (hinner x hxW hxC).resolve_right fun hxb => + hmeet x X.end_mem_support (hxb ▸ Y.end_mem_support) + have hyb : y = b := (hinner y hyW hyC).resolve_left fun hya => + hmeet a X.start_mem_support (hya ▸ Y.start_mem_support) + subst hxa hyb + have h₀ : X.edges = [] := by + have := hs.1.length_eq_zero + exact List.length_eq_zero_iff.mp this + have h₁ : Y.edges = [] := by + have := (GraphWalk.IsSimple.of_cons hs.2).length_eq_zero + exact List.length_eq_zero_iff.mp this + rw [GraphWalk.edges_append, h₀] at heW + simp only [GraphWalk.edges_cons, h₁, List.nil_append, List.mem_singleton] at heW + exact he (heW ▸ hfC) + +/-- A simple walk from `p` to `a` in `C` that starts on the second piece and misses `b` stays on the +second piece. -/ +theorem stays_on_piece {C : Drawing S} {a b : S} {W₁ : GraphWalk Γ.toGraph a b} + {W₂ : GraphWalk Γ.toGraph b a} (h : Splits C W₁ W₂) {p : S} + (X : GraphWalk Γ.toGraph p a) (hX : X.IsSimple) (hE : ∀ f ∈ X.edges, f ∈ C.E) + (hp : p ∈ W₂.support) (hb : b ∉ X.support) : + (∀ f ∈ X.edges, f ∈ W₂.edges) ∧ ∀ x ∈ X.support, x ∈ W₂.support := by + induction X with + | nil _ => + refine ⟨fun f hf => absurd hf List.not_mem_nil, fun x hx => ?_⟩ + rw [mem_support_nil.mp hx] + exact hp + | @cons p q a g hl r ih => + have hg : g ∈ C.E := hE g List.mem_cons_self + have hpne : p ≠ b := fun h' => hb (h' ▸ List.mem_cons_self) + have hpg : p ∈ closure g ∩ Γ.V := by rw [hl.2.2.2]; simp + have hqg : q ∈ closure g ∩ Γ.V := by rw [hl.2.2.2]; simp + have hgW : g ∈ W₂.edges := by + refine ((h.E g).mp hg).resolve_left fun hg₁ => ?_ + have hp₁ := mem_support_of_mem_closure W₁ hg₁ hpg.1 hpg.2 + have hpa : p = a := (h.meet p hp₁ hp).resolve_right hpne + exact (List.nodup_cons.mp hX).1 (hpa ▸ r.end_mem_support) + have hq := mem_support_of_mem_closure W₂ hgW hqg.1 hqg.2 + obtain ⟨h₁, h₂⟩ := ih h hX.of_cons (fun f hf => hE f (List.mem_cons_of_mem _ hf)) hq + fun h' => hb (List.mem_cons_of_mem _ h') + refine ⟨fun f hf => ?_, fun x hx => ?_⟩ + · rcases List.mem_cons.mp hf with rfl | hf + · exact hgW + · exact h₁ f hf + · rcases List.mem_cons.mp hx with rfl | hx + · exact hp + · exact h₂ x hx + +/-- A simple walk inside the second piece, with the same ends, is the second piece. -/ +theorem Splits.replace [T2Space S] {C : Drawing S} (hC : C.IsCircuit) + (hCs : C.IsSubdrawing Γ) {a b : S} + {W₁ : GraphWalk Γ.toGraph a b} {W₂ X : GraphWalk Γ.toGraph b a} (h : Splits C W₁ W₂) + (hab : a ≠ b) (hX : X.IsSimple) (hE : ∀ f ∈ X.edges, f ∈ W₂.edges) + (hV : ∀ x ∈ X.support, x ∈ W₂.support) : Splits C W₁ X := by + have hsc : (W₁.append X).IsSimpleClosed := GraphWalk.isSimpleClosed_append h.s₁ hX + (fun x h₁ h₂ => h.meet x h₁ (hV x h₂)) fun e h₁ h₂ => h.edge e h₁ (hE e h₂) + have hpos : 0 < (W₁.append X).length := by + rw [GraphWalk.length_append] + have : W₁.length ≠ 0 := fun h => hab (GraphWalk.eq_of_length_eq_zero h) + omega + have hD := isCircuit_walkDrawing Γ hsc hpos + have hDs := walkDrawing_isSubdrawing Γ (W₁.append X) + have hEsub : (walkDrawing Γ (W₁.append X)).E ⊆ C.E := by + rw [walkDrawing_E] + intro f hf + have hf' : f ∈ (W₁.append X).edges := hf + rw [GraphWalk.edges_append] at hf' + rcases List.mem_append.mp hf' with hf' | hf' + · exact (h.E f).mpr (Or.inl hf') + · exact (h.E f).mpr (Or.inr (hE f hf')) + have heq := circuit_eq_of_E hD hC hDs hCs (circuit_E_eq_of_subset hC hD hCs hDs hEsub) + refine ⟨h.s₁, hX, fun x h₁ h₂ => h.meet x h₁ (hV x h₂), fun e h₁ h₂ => h.edge e h₁ (hE e h₂), + fun x => ?_, fun e => ?_⟩ + · rw [← heq, walkDrawing_V, mem_ofPred_eq, GraphWalk.mem_support_append] + · rw [← heq, walkDrawing_E, mem_ofPred_eq, GraphWalk.edges_append, List.mem_append] + +/-- A simple walk of a circuit between two of its vertices leaves a simple walk as the rest. -/ +theorem exists_complement [T2Space S] {C : Drawing S} (hC : C.IsCircuit) + (hCs : C.IsSubdrawing Γ) {a b : S} + {W₁ : GraphWalk Γ.toGraph a b} {W₂ : GraphWalk Γ.toGraph b a} (h : Splits C W₁ W₂) (hab : a ≠ b) + (X : GraphWalk Γ.toGraph b a) (hX : X.IsSimple) (hE : ∀ f ∈ X.edges, f ∈ C.E) : + ∃ Y : GraphWalk Γ.toGraph a b, Splits C Y X := by + have main : ∀ {W₁' : GraphWalk Γ.toGraph a b} {W₂' : GraphWalk Γ.toGraph b a}, Splits C W₁' W₂' → + (∀ {q : S} {g : Set S} (hl : Γ.toGraph.IsLink g b q) (r : GraphWalk Γ.toGraph q a), + X = GraphWalk.cons hl r → g ∈ W₂'.edges) → Splits C W₁' X := by + intro W₁' W₂' h' hfirst + cases hc : X with + | nil _ => exact absurd rfl hab + | @cons b q a g hl r => + have hgW := hfirst hl r hc + subst hc + have hqg : q ∈ closure g ∩ Γ.V := by rw [hl.2.2.2]; simp + have hq := mem_support_of_mem_closure W₂' hgW hqg.1 hqg.2 + obtain ⟨h₁, h₂⟩ := stays_on_piece h' r hX.of_cons + (fun f hf => hE f (List.mem_cons_of_mem _ hf)) hq (List.nodup_cons.mp hX).1 + refine h'.replace hC hCs hab hX (fun f hf => ?_) fun x hx => ?_ + · rcases List.mem_cons.mp hf with rfl | hf + · exact hgW + · exact h₁ f hf + · rcases List.mem_cons.mp hx with rfl | hx + · exact W₂'.start_mem_support + · exact h₂ x hx + by_cases hfirst : ∀ {q : S} {g : Set S} (hl : Γ.toGraph.IsLink g b q) + (r : GraphWalk Γ.toGraph q a), X = GraphWalk.cons hl r → g ∈ W₂.edges + · exact ⟨W₁, main h hfirst⟩ + · refine ⟨W₂.reverse, main h.rev fun {q g} hl r hr => ?_⟩ + rw [GraphWalk.edges_reverse, List.mem_reverse] + by_contra hg + refine hfirst fun {q' g'} hl' r' hr' => ?_ + have hg' : g' ∈ C.E := hE g' (by rw [hr']; exact List.mem_cons_self) + rcases (h.E g').mp hg' with h₁ | h₁ + · cases hr.symm.trans hr' + exact absurd h₁ hg + · exact h₁ + +/-- The edges of a walk, as a set. -/ +def edgeSet {a b : S} (W : GraphWalk Γ.toGraph a b) : Set (Set S) := {e | e ∈ W.edges} + +theorem finite_edgeSet {a b : S} (W : GraphWalk Γ.toGraph a b) : (edgeSet W).Finite := + W.edges.finite_toSet + +/-- The two pieces of a circuit have total length that of the circuit. -/ +theorem Splits.card_add {C : Drawing S} {a b : S} {W₁ : GraphWalk Γ.toGraph a b} + {W₂ : GraphWalk Γ.toGraph b a} (h : Splits C W₁ W₂) : + (edgeSet W₁).ncard + (edgeSet W₂).ncard = C.length := by + have hE : C.E = edgeSet W₁ ∪ edgeSet W₂ := by + ext e + exact h.E e + have hdis : Disjoint (edgeSet W₁) (edgeSet W₂) := disjoint_left.mpr fun e h₁ h₂ => h.edge e h₁ h₂ + rw [Drawing.length, hE] + exact (ncard_union_eq hdis (finite_edgeSet _) (finite_edgeSet _)).symm + +/-- A short ear cannot miss an edge of `C₁` outside `C₂`: it would make a short circuit that is none +of `C₁, C₂, C₃`. -/ +theorem short_ear_false [T2Space S] {k : ℕ} {C₁ C₂ C₃ : Drawing S} (h₂ : C₂.IsCircuit) + (s₂ : C₂.IsSubdrawing Γ) (l₁ : C₁.length < k) (l₂ : C₂.length < k) + (hE : ∀ e, e ∈ C₃.E ↔ (e ∈ C₁.E ∧ e ∉ C₂.E) ∨ (e ∉ C₁.E ∧ e ∈ C₂.E)) + (hshort : ∀ T : Drawing S, T.IsCircuit → T.IsSubdrawing Γ → (∀ e ∈ T.E, e ∈ C₁.E ∨ e ∈ C₂.E) → + T.length < k → T.E = C₁.E ∨ T.E = C₂.E ∨ T.E = C₃.E) + {a b : S} (T : GraphWalk Γ.toGraph a b) (hT : T.IsSimple) (hear : IsEar C₂ T) + (hlen : 2 * (edgeSet T).ncard ≤ C₁.length) (hsub : ∀ f ∈ T.edges, f ∈ C₁.E) {f : Set S} + (hf₁ : f ∈ C₁.E) (hf₂ : f ∉ C₂.E) (hfT : f ∉ T.edges) : False := by + obtain ⟨R, R', hspl⟩ := exists_splits h₂ s₂ hear.left hear.right hear.ne + obtain ⟨R₁, R₂, hspl', hR⟩ : ∃ (R₁ : GraphWalk Γ.toGraph a b) (R₂ : GraphWalk Γ.toGraph b a), + Splits C₂ R₁ R₂ ∧ 2 * (edgeSet R₂).ncard ≤ C₂.length := by + have hc := hspl.card_add + by_cases hle : 2 * (edgeSet R').ncard ≤ C₂.length + · exact ⟨R, R', hspl, hle⟩ + · refine ⟨R'.reverse, R.reverse, hspl.rev, ?_⟩ + have hset : edgeSet R.reverse = edgeSet R := by + ext e + simp only [edgeSet, mem_ofPred_eq, GraphWalk.edges_reverse, List.mem_reverse] + rw [hset] + omega + have hsc : (T.append R₂).IsSimpleClosed := GraphWalk.isSimpleClosed_append hT hspl'.s₂ + (fun x h₁ h₂' => hear.inner x h₁ ((hspl'.V x).mpr (Or.inr h₂'))) + fun e h₁ h₂' => hear.off e h₁ ((hspl'.E e).mpr (Or.inr h₂')) + have hTpos : T.length ≠ 0 := fun h => hear.ne (GraphWalk.eq_of_length_eq_zero h) + have hpos : 0 < (T.append R₂).length := by + rw [GraphWalk.length_append] + omega + have hD := isCircuit_walkDrawing Γ hsc hpos + have hDs := walkDrawing_isSubdrawing Γ (T.append R₂) + have hDE : (walkDrawing Γ (T.append R₂)).E = edgeSet T ∪ edgeSet R₂ := by + rw [walkDrawing_E] + ext e + simp only [edgeSet, mem_ofPred_eq, mem_union, GraphWalk.edges_append, List.mem_append] + have hmem : ∀ e, e ∈ (walkDrawing Γ (T.append R₂)).E → e ∈ T.edges ∨ e ∈ R₂.edges := fun e he + => by + rw [hDE] at he + exact he + have hlenD : (walkDrawing Γ (T.append R₂)).length < k := by + have := ncard_union_le (edgeSet T) (edgeSet R₂) + rw [Drawing.length, hDE] + omega + have hin : ∀ e ∈ (walkDrawing Γ (T.append R₂)).E, e ∈ C₁.E ∨ e ∈ C₂.E := fun e he => + (hmem e he).imp (hsub e) fun h => (hspl'.E e).mpr (Or.inr h) + have hnot : f ∉ (walkDrawing Γ (T.append R₂)).E := fun h => + (hmem f h).elim hfT fun h' => hf₂ ((hspl'.E f).mpr (Or.inr h')) + rcases hshort _ hD hDs hin hlenD with h | h | h + · exact hnot (h ▸ hf₁) + · obtain ⟨e₀, he₀⟩ := List.exists_mem_of_length_pos (Nat.pos_of_ne_zero hTpos) + refine hear.off e₀ he₀ ?_ + rw [← h, hDE] + exact Or.inl he₀ + · exact hnot (h ▸ (hE f).mpr (Or.inl ⟨hf₁, hf₂⟩)) + +/-- Three circuits as in the statement are three paths with the same ends. -/ +theorem exists_theta [T2Space S] {k : ℕ} {C₁ C₂ C₃ : Drawing S} (h₁ : C₁.IsCircuit) + (h₂ : C₂.IsCircuit) (h₃ : C₃.IsCircuit) (s₁ : C₁.IsSubdrawing Γ) (s₂ : C₂.IsSubdrawing Γ) + (s₃ : C₃.IsSubdrawing Γ) (l₁ : C₁.length < k) (l₂ : C₂.length < k) + (hE : ∀ e, e ∈ C₃.E ↔ (e ∈ C₁.E ∧ e ∉ C₂.E) ∨ (e ∉ C₁.E ∧ e ∈ C₂.E)) + (hnot : ∃ e ∈ C₁.E, e ∉ C₂.E) + (hshort : ∀ T : Drawing S, T.IsCircuit → T.IsSubdrawing Γ → (∀ e ∈ T.E, e ∈ C₁.E ∨ e ∈ C₂.E) → + T.length < k → T.E = C₁.E ∨ T.E = C₂.E ∨ T.E = C₃.E) : + ∃ (P₀ P₁ P₂ : Drawing S) (a b : S), P₀.IsPathBetween a b ∧ P₁.IsPathBetween a b ∧ + P₂.IsPathBetween a b ∧ P₀.IsSubdrawing Γ ∧ P₁.IsSubdrawing Γ ∧ P₂.IsSubdrawing Γ ∧ + 0 < P₀.length ∧ 0 < P₁.length ∧ 0 < P₂.length ∧ + P₀.V ∩ P₁.V = {a, b} ∧ P₁.V ∩ P₂.V = {a, b} ∧ P₂.V ∩ P₀.V = {a, b} ∧ + Disjoint P₀.E P₁.E ∧ Disjoint P₁.E P₂.E ∧ Disjoint P₂.E P₀.E ∧ + Γ.sup P₀ P₁ = C₁ ∧ Γ.sup P₁ P₂ = C₂ ∧ Γ.sup P₂ P₀ = C₃ := by + obtain ⟨e, he₁, he₂⟩ := hnot + -- The circuits `C₁` and `C₂` have a common edge, since otherwise `C₁` lies inside `C₃`. + obtain ⟨g, hg₁, hg₂⟩ : ∃ g ∈ C₁.E, g ∈ C₂.E := by + by_contra hno + push Not at hno + have hsub : C₁.E ⊆ C₃.E := fun x hx => (hE x).mpr (Or.inl ⟨hx, hno x hx⟩) + have heq := circuit_E_eq_of_subset h₃ h₁ s₃ s₁ hsub + obtain ⟨y, hy⟩ := IsCircuit.E_nonempty h₂ + have hy₁ : y ∉ C₁.E := fun h => hno y h hy + exact hy₁ (heq ▸ (hE y).mpr (Or.inr ⟨hy₁, hy⟩)) + -- Its ends are distinct, as `C₁` is not a single loop. + obtain ⟨x, y, hl, hxy⟩ : ∃ (x y : S) (_ : C₁.toGraph.IsLink g x y), x ≠ y := by + obtain ⟨u, W, -, -, -, hEC⟩ := id h₁ + have hgW : g ∈ W.edges := by + rw [hEC] at hg₁ + exact hg₁ + obtain ⟨x, y, -, hl, -, -⟩ := exists_split_edge W hgW + refine ⟨x, y, hl, ?_⟩ + rintro rfl + have hloop : closure g ∩ C₁.V = {x} := by + rw [hl.2.2.2] + simp + have hone := IsCircuit.E_eq_of_loop h₁ hg₁ hloop + rw [hone] at he₁ + exact he₂ ((show e = g from he₁) ▸ hg₂) + have hmem₂ : ∀ z, z ∈ closure g ∩ C₁.V → z ∈ C₂.V := fun z hz => by + rw [s₁.closure_inter_V hg₁, ← s₂.closure_inter_V hg₂] at hz + exact hz.2 + have hxg : x ∈ closure g ∩ C₁.V := by rw [hl.2.2.2]; simp + have hyg : y ∈ closure g ∩ C₁.V := by rw [hl.2.2.2]; simp + -- Cut `C₁` at the ends of `g`, and take an ear through `e`. + obtain ⟨a₀, b₀, W₁, W₂, hspl₀, ha₀, hb₀, hab₀, heW⟩ : + ∃ (a₀ b₀ : S) (W₁ : GraphWalk Γ.toGraph a₀ b₀) (W₂ : GraphWalk Γ.toGraph b₀ a₀), + Splits C₁ W₁ W₂ ∧ a₀ ∈ C₂.V ∧ b₀ ∈ C₂.V ∧ a₀ ≠ b₀ ∧ e ∈ W₁.edges := by + obtain ⟨W₁, W₂, hspl⟩ := exists_splits h₁ s₁ hxg.2 hyg.2 hxy + rcases (hspl.E e).mp he₁ with h | h + · exact ⟨x, y, W₁, W₂, hspl, hmem₂ x hxg, hmem₂ y hyg, hxy, h⟩ + · exact ⟨y, x, W₂, W₁, hspl.swap, hmem₂ y hyg, hmem₂ x hxg, hxy.symm, h⟩ + obtain ⟨a, b, T, T', hspl, hear, heT, -⟩ := + exists_ear s₂ he₂ _ W₁ W₂ hspl₀ ha₀ hb₀ hab₀ heW rfl + -- All of the rest of `C₁` lies in `C₂`. + have hrest : ∀ f ∈ T'.edges, f ∈ C₂.E := by + intro f hfT + by_contra hf + obtain ⟨a', b', Q, Q', hspl', hear', hfQ, hsubQ⟩ := + exists_ear s₂ hf _ T' T hspl.swap hear.right hear.left hear.ne.symm hfT rfl + have hdis : Disjoint (edgeSet T) (edgeSet Q) := + disjoint_left.mpr fun x hx hxQ => hspl.edge x hx (hsubQ x hxQ) + have hcard : (edgeSet T).ncard + (edgeSet Q).ncard ≤ C₁.length := by + rw [← ncard_union_eq hdis (finite_edgeSet _) (finite_edgeSet _)] + refine ncard_le_ncard ?_ C₁.finite_edges + rintro x (hx | hx) + · exact (hspl.E x).mpr (Or.inl hx) + · exact (hspl'.E x).mpr (Or.inl hx) + by_cases hle : 2 * (edgeSet T).ncard ≤ C₁.length + · exact short_ear_false h₂ s₂ l₁ l₂ hE hshort T hspl.s₁ hear hle + (fun x hx => (hspl.E x).mpr (Or.inl hx)) ((hspl'.E f).mpr (Or.inl hfQ)) hf + fun h => hspl.edge f h hfT + · exact short_ear_false h₂ s₂ l₁ l₂ hE hshort Q hspl'.s₁ hear' (by omega) + (fun x hx => (hspl'.E x).mpr (Or.inl hx)) he₁ he₂ fun h => hspl.edge e heT (hsubQ e h) + obtain ⟨R, R', hspl₂⟩ := exists_splits h₂ s₂ hear.left hear.right hear.ne + obtain ⟨Y, hY⟩ := exists_complement h₂ s₂ hspl₂ hear.ne T' hspl.s₂ hrest + have mv₀ : ∀ x, x ∈ (walkDrawing Γ T).V ↔ x ∈ T.support := fun x => by rw [walkDrawing_V]; rfl + have mv₁ : ∀ x, x ∈ (walkDrawing Γ T'.reverse).V ↔ x ∈ T'.support := fun x => by + rw [walkDrawing_V] + change x ∈ T'.reverse.support ↔ _ + rw [GraphWalk.support_reverse, List.mem_reverse] + have mv₂ : ∀ x, x ∈ (walkDrawing Γ Y).V ↔ x ∈ Y.support := fun x => by rw [walkDrawing_V]; rfl + have me₀ : ∀ x, x ∈ (walkDrawing Γ T).E ↔ x ∈ T.edges := fun x => by rw [walkDrawing_E]; rfl + have me₁ : ∀ x, x ∈ (walkDrawing Γ T'.reverse).E ↔ x ∈ T'.edges := fun x => by + rw [walkDrawing_E] + change x ∈ T'.reverse.edges ↔ _ + rw [GraphWalk.edges_reverse, List.mem_reverse] + have me₂ : ∀ x, x ∈ (walkDrawing Γ Y).E ↔ x ∈ Y.edges := fun x => by rw [walkDrawing_E]; rfl + have hP₀ := walkDrawing_isPathBetween Γ hspl.s₁ + have hP₁ := walkDrawing_isPathBetween Γ hspl.s₂.reverse + have hP₂ := walkDrawing_isPathBetween Γ hY.s₁ + have sP₀ := walkDrawing_isSubdrawing Γ T + have sP₁ := walkDrawing_isSubdrawing Γ T'.reverse + have sP₂ := walkDrawing_isSubdrawing Γ Y + have hpos : ∀ (W : GraphWalk Γ.toGraph a b), 0 < (walkDrawing Γ W).length := fun W => by + have hl : W.length ≠ 0 := fun h => hear.ne (GraphWalk.eq_of_length_eq_zero h) + obtain ⟨e₀, he₀⟩ := List.exists_mem_of_length_pos (Nat.pos_of_ne_zero hl) + have hm : e₀ ∈ (walkDrawing Γ W).E := by + rw [walkDrawing_E] + exact he₀ + exact (ncard_pos (walkDrawing Γ W).finite_edges).mpr ⟨e₀, hm⟩ + have hV₀₁ : (walkDrawing Γ T).V ∩ (walkDrawing Γ T'.reverse).V = {a, b} := by + ext x + rw [mem_inter_iff, mv₀, mv₁] + constructor + · exact fun h => hspl.meet x h.1 h.2 + · rintro (rfl | rfl) + · exact ⟨T.start_mem_support, T'.end_mem_support⟩ + · exact ⟨T.end_mem_support, T'.start_mem_support⟩ + have hV₁₂ : (walkDrawing Γ T'.reverse).V ∩ (walkDrawing Γ Y).V = {a, b} := by + ext x + rw [mem_inter_iff, mv₁, mv₂] + constructor + · exact fun h => hY.meet x h.2 h.1 + · rintro (rfl | rfl) + · exact ⟨T'.end_mem_support, Y.start_mem_support⟩ + · exact ⟨T'.start_mem_support, Y.end_mem_support⟩ + have hV₂₀ : (walkDrawing Γ Y).V ∩ (walkDrawing Γ T).V = {a, b} := by + ext x + rw [mem_inter_iff, mv₂, mv₀] + constructor + · exact fun h => hear.inner x h.2 ((hY.V x).mpr (Or.inl h.1)) + · rintro (rfl | rfl) + · exact ⟨Y.start_mem_support, T.start_mem_support⟩ + · exact ⟨Y.end_mem_support, T.end_mem_support⟩ + have hE₀₁ : Disjoint (walkDrawing Γ T).E (walkDrawing Γ T'.reverse).E := + disjoint_left.mpr fun x h₁ h₂ => hspl.edge x ((me₀ x).mp h₁) ((me₁ x).mp h₂) + have hE₁₂ : Disjoint (walkDrawing Γ T'.reverse).E (walkDrawing Γ Y).E := + disjoint_left.mpr fun x h₁ h₂ => hY.edge x ((me₂ x).mp h₂) ((me₁ x).mp h₁) + have hE₂₀ : Disjoint (walkDrawing Γ Y).E (walkDrawing Γ T).E := + disjoint_left.mpr fun x h₁ h₂ => + hear.off x ((me₀ x).mp h₂) ((hY.E x).mpr (Or.inl ((me₂ x).mp h₁))) + refine ⟨walkDrawing Γ T, walkDrawing Γ T'.reverse, walkDrawing Γ Y, a, b, hP₀, hP₁, hP₂, sP₀, sP₁, + sP₂, hpos _, hpos _, ?_, hV₀₁, hV₁₂, hV₂₀, hE₀₁, hE₁₂, hE₂₀, ?_, ?_, ?_⟩ + · exact hpos _ + · refine Drawing.ext_of_V_E ?_ ?_ + · rw [Drawing.sup_V sP₀ sP₁] + ext x + rw [mem_union, mv₀, mv₁, hspl.V] + · rw [Drawing.sup_E sP₀ sP₁] + ext x + rw [mem_union, me₀, me₁, hspl.E] + · refine Drawing.ext_of_V_E ?_ ?_ + · rw [Drawing.sup_V sP₁ sP₂] + ext x + rw [mem_union, mv₁, mv₂, hY.V, or_comm] + · rw [Drawing.sup_E sP₁ sP₂] + ext x + rw [mem_union, me₁, me₂, hY.E, or_comm] + · have hcirc := Drawing.isCircuit_sup (Γ := Γ) hP₂ hP₀ sP₂ sP₀ hear.ne hV₂₀ hE₂₀ + refine circuit_eq_of_E hcirc h₃ (Drawing.sup_isSubdrawing _ _ _) s₃ ?_ + rw [Drawing.sup_E sP₂ sP₀] + ext x + rw [mem_union, me₂, me₀, hE] + constructor + · rintro (hx | hx) + · refine Or.inr ⟨fun hx₁ => ?_, (hY.E x).mpr (Or.inl hx)⟩ + rcases (hspl.E x).mp hx₁ with h | h + · exact hear.off x h ((hY.E x).mpr (Or.inl hx)) + · exact hY.edge x hx h + · exact Or.inl ⟨(hspl.E x).mpr (Or.inl hx), hear.off x hx⟩ + · rintro (⟨hx₁, hx₂⟩ | ⟨hx₁, hx₂⟩) + · exact Or.inr (((hspl.E x).mp hx₁).resolve_right fun h => hx₂ (hrest x h)) + · exact Or.inl (((hY.E x).mp hx₂).resolve_right fun h => + hx₁ ((hspl.E x).mpr (Or.inr h))) + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Ties.lean b/LeanPool/GraphMinor/GM11/Ties.lean new file mode 100644 index 0000000000..734fffc693 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Ties.lean @@ -0,0 +1,579 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section810 + +/-! +# Tools for the ties of Graph Minors XI, Section 9 + +The proof of (9.2) builds its tie `X` from closed discs, a line, and an edge or a vertex, glued at +single points. This file has the facts about such gluing that need no drawing: an `O`-arc in a union +of +two closed sets that meet in at most one point lies in one of them (`IsOArc.subset_or_subset`), a +line +contains no `O`-arc (`not_isOArc_of_subset_line`), and the gluing of lines (`IsArm`). It also has +the +choice of a segment of a walk from a set `A` to a set `B` (`exists_crossing`), and the notion of a +set that holds `ins(C)` for each circuit `C` drawn in it (`IsAbsorbing`). +-/ + +@[expose] public section + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- An `O`-arc in the union of two closed sets that meet in at most the point `p` lies in one of +them, since removing one point from an `O`-arc leaves a connected set. -/ +theorem IsOArc.subset_or_subset {J P Q : Set S} {p : S} (hJ : IsOArc J) (hP : IsClosed P) + (hQ : IsClosed Q) (hsub : J ⊆ P ∪ Q) (hPQ : P ∩ Q ⊆ {p}) : J ⊆ P ∨ J ⊆ Q := by + obtain ⟨f⟩ := id hJ + have hT : IsPreconnected (J \ {p}) := by + by_cases hp : p ∈ J + · have heq : J \ {p} = (fun w => (f w).1) '' {f.symm ⟨p, hp⟩}ᶜ := by + ext x + constructor + · rintro ⟨hx, hxp⟩ + refine ⟨f.symm ⟨x, hx⟩, fun h => hxp ?_, by simp⟩ + have := f.symm.injective h + exact congrArg Subtype.val this + · rintro ⟨w, hw, rfl⟩ + refine ⟨(f w).2, fun h => hw ?_⟩ + have : f w = ⟨p, hp⟩ := Subtype.ext h + simp [← this] + rw [heq] + exact (Circle.isPathConnected_compl_singleton _).isConnected.isPreconnected.image _ + (by fun_prop : Continuous fun w => (f w).1).continuousOn + · have : J \ {p} = J := by + ext x + exact ⟨fun h => h.1, fun h => ⟨h, fun e => hp (e ▸ h)⟩⟩ + rw [this] + exact hJ.isPreconnected + have hcl : J ⊆ closure (J \ {p}) := by + have hd : J ⊆ closure (J \ {p}) ∪ {p} := fun x hx => by + by_cases h : x = p + · exact Or.inr h + · exact Or.inl (subset_closure ⟨hx, h⟩) + by_cases hp : p ∈ closure (J \ {p}) + · intro x hx + rcases hd hx with h | h + · exact h + · exact (mem_singleton_iff.mp h) ▸ hp + · rcases isPreconnected_iff_subset_of_disjoint_closed.mp hJ.isPreconnected _ _ isClosed_closure + isClosed_singleton hd (by + ext x + simp only [mem_inter_iff, mem_singleton_iff, mem_empty_iff_false, iff_false] + rintro ⟨-, h, rfl⟩ + exact hp h) with h | h + · exact h + · exact ((infinite_of_isOArc hJ).mono h (finite_singleton p)).elim + have hcov : J \ {p} ⊆ P ∪ Q := sdiff_subset.trans hsub + have hdis : (J \ {p}) ∩ (P ∩ Q) = ∅ := by + ext x + simp only [mem_inter_iff, mem_empty_iff_false, iff_false] + rintro ⟨⟨-, hx⟩, h⟩ + exact hx (hPQ h) + rcases isPreconnected_iff_subset_of_disjoint_closed.mp hT P Q hP hQ hcov hdis with h | h + · exact Or.inl (hcl.trans (closure_minimal h hP)) + · exact Or.inr (hcl.trans (closure_minimal h hQ)) + +/-- A line contains no `O`-arc: three points of the `O`-arc lie in order along the line, and the +middle one cuts the line into two closed pieces, which meet only there. -/ +theorem not_isOArc_of_subset_line {L J : Set S} (hL : IsLine L) (hJ : IsOArc J) (h : J ⊆ L) : False + := by + classical + obtain ⟨f⟩ := hL + let g : I → S := fun t => (f t).1 + have hg : Continuous g := by fun_prop + have hginj : Function.Injective g := fun a b hab => f.injective (Subtype.ext hab) + have hrange : ∀ x ∈ L, ∃ t, g t = x := fun x hx => ⟨f.symm ⟨x, hx⟩, by simp [g]⟩ + have hinf : (g ⁻¹' J).Infinite := by + intro hfin + refine infinite_of_isOArc hJ ((hfin.image g).subset fun x hx => ?_) + obtain ⟨t, rfl⟩ := hrange x (h hx) + exact ⟨t, hx, rfl⟩ + obtain ⟨s, hs, hcard⟩ := hinf.exists_subset_card_eq 3 + let e := s.orderEmbOfFin hcard + have hmem : ∀ i, g (e i) ∈ J := fun i => hs (s.orderEmbOfFin_mem hcard i) + have h01 : e 0 < e 1 := e.strictMono (by decide) + have h12 : e 1 < e 2 := e.strictMono (by decide) + have hclosed : ∀ T : Set I, IsClosed T → IsClosed (g '' T) := fun T hT => + (hT.isCompact.image hg).isClosed + rcases IsOArc.subset_or_subset (p := g (e 1)) hJ (hclosed (Iic (e 1)) isClosed_Iic) + (hclosed (Ici (e 1)) isClosed_Ici) (fun x hx => by + obtain ⟨t, rfl⟩ := hrange x (h hx) + rcases le_total t (e 1) with ht | ht + · exact Or.inl ⟨t, ht, rfl⟩ + · exact Or.inr ⟨t, ht, rfl⟩) (by + rintro _ ⟨⟨a, ha, rfl⟩, ⟨b, hb, hab⟩⟩ + obtain rfl := hginj hab + exact congrArg g (le_antisymm ha hb)) with hc | hc + · obtain ⟨t, ht, hte⟩ := hc (hmem 2) + exact absurd (ht.trans_lt h12) (by rw [hginj hte]; exact lt_irrefl _) + · obtain ⟨t, ht, hte⟩ := hc (hmem 0) + exact absurd (h01.trans_le ht) (by rw [hginj hte]; exact lt_irrefl _) + +/-- `T` is the point `p`, or a line with `p` as an end. The sets `A` of (9.2) that are not discs are +of this kind, and so is `A` with the line `F` added. -/ +def IsArm (T : Set S) (p : S) : Prop := T = {p} ∨ ∃ q, IsLineWithEnds T p q + +omit [T2Space S] in +theorem IsLineWithEnds.left_mem {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : a ∈ L := by + obtain ⟨f, h₀, -⟩ := h + exact h₀ ▸ (f 0).2 + +omit [T2Space S] in +theorem IsLineWithEnds.right_mem {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : b ∈ L := by + obtain ⟨f, -, h₁⟩ := h + exact h₁ ▸ (f 1).2 + +omit [T2Space S] in +theorem IsLineWithEnds.isLine {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : IsLine L := by + obtain ⟨f, -, -⟩ := h + exact ⟨f⟩ + +theorem IsArm.isClosed {T : Set S} {p : S} (h : IsArm T p) : IsClosed T := by + rcases h with rfl | ⟨q, f, -, -⟩ + · exact isClosed_singleton + · have hc : IsCompact (range fun t : I => (f t).1) := isCompact_range (by fun_prop) + have : (range fun t : I => (f t).1) = T := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (f t).2 + · intro hx + exact ⟨f.symm ⟨x, hx⟩, by simp⟩ + exact this ▸ hc.isClosed + +/-- Adding at the end `p` of an arm a line from `p` to `b` gives an arm with end `b`. -/ +theorem IsArm.extend {T F : Set S} {p b : S} (hT : IsArm T p) (hF : IsLineWithEnds F p b) + (h : T ∩ F = {p}) : IsArm (T ∪ F) b := by + rcases hT with rfl | ⟨q, hq⟩ + · have : ({p} : Set S) ∪ F = F := union_eq_right.mpr (singleton_subset_iff.mpr + (IsLineWithEnds.left_mem hF)) + rw [this] + exact Or.inr ⟨p, IsLineWithEnds.symm hF⟩ + · exact Or.inr ⟨q, IsLineWithEnds.symm (IsLineWithEnds.union hq hF h)⟩ + +/-- The six shapes of a tie (Graph Minors XI, page 104). -/ +def IsTieShape (X : Set S) : Prop := + X.ncard = 1 ∧ X.Finite ∨ + IsLine X ∨ + IsClosedDisc X ∨ + (∃ D₁ D₂ : Set S, IsClosedDisc D₁ ∧ IsClosedDisc D₂ ∧ (D₁ ∩ D₂).ncard = 1 ∧ + (D₁ ∩ D₂).Finite ∧ X = D₁ ∪ D₂) ∨ + (∃ (D F : Set S) (a b : S), IsClosedDisc D ∧ IsLineWithEnds F a b ∧ F ∩ D = {a} ∧ + X = D ∪ F) ∨ + (∃ (D₁ D₂ F : Set S) (a b : S), IsClosedDisc D₁ ∧ IsClosedDisc D₂ ∧ Disjoint D₁ D₂ ∧ + IsLineWithEnds F a b ∧ F ∩ D₁ = {a} ∧ F ∩ D₂ = {b} ∧ X = D₁ ∪ D₂ ∪ F) + +omit [T2Space S] in +theorem IsArm.isTieShape {T : Set S} {p : S} (h : IsArm T p) : IsTieShape T := by + rcases h with rfl | ⟨q, hq⟩ + · exact Or.inl ⟨by simp, by simp⟩ + · exact Or.inr (Or.inl (IsLineWithEnds.isLine hq)) + +/-- Two arms with the same end, which meet only there, form a point or a line. -/ +theorem IsArm.isTieShape_union {T T' : Set S} {p : S} (h : IsArm T p) (h' : IsArm T' p) + (hi : T ∩ T' = {p}) : IsTieShape (T ∪ T') := by + rcases h with rfl | ⟨q, hq⟩ + · have : p ∈ T' := by + have : p ∈ ({p} : Set S) ∩ T' := by rw [hi]; rfl + exact this.2 + rw [union_eq_right.mpr (singleton_subset_iff.mpr this)] + exact h'.isTieShape + · rcases h' with rfl | ⟨q', hq'⟩ + · rw [union_eq_left.mpr (singleton_subset_iff.mpr (IsLineWithEnds.left_mem hq))] + exact Or.inr (Or.inl (IsLineWithEnds.isLine hq)) + · exact Or.inr (Or.inl (IsLineWithEnds.isLine (IsLineWithEnds.union hq hq' hi))) + +omit [T2Space S] in +/-- A closed disc and an arm that meet only at the end of the arm have the shape of a tie. -/ +theorem IsArm.isTieShape_disc {D T : Set S} {p : S} (hD : IsClosedDisc D) (h : IsArm T p) + (hi : D ∩ T = {p}) : IsTieShape (D ∪ T) := by + have hp : p ∈ D ∩ T := by rw [hi]; rfl + rcases h with rfl | ⟨q, hq⟩ + · rw [union_eq_left.mpr (singleton_subset_iff.mpr hp.1)] + exact Or.inr (Or.inr (Or.inl hD)) + · exact Or.inr (Or.inr (Or.inr (Or.inr (Or.inl ⟨D, T, p, q, hD, hq, by rw [inter_comm, hi], + rfl⟩)))) + +section Crossing + +variable {α β : Type*} {G : Graph α β} + +/-- If a walk meets `A`, then it has a final segment that starts in `A` and meets `A` in no other +vertex. -/ +theorem exists_last_in (A : Set α) {a b : α} (T : GraphWalk G a b) (h : ∃ x ∈ T.support, x ∈ A) : + ∃ a' ∈ A, ∃ T' : GraphWalk G a' b, T'.edges.Sublist T.edges ∧ (∀ x ∈ T'.support, x ∈ T.support) + ∧ + ∀ x ∈ T'.support, x ∈ A → x = a' := by + induction T with + | nil hu => + obtain ⟨x, hx, hxA⟩ := h + obtain rfl : x = _ := by simpa using hx + exact ⟨_, hxA, .nil hu, List.Sublist.refl _, fun _ hy => hy, fun y hy _ => by simpa using hy⟩ + | @cons u v w e hl r ih => + by_cases hr : ∃ x ∈ r.support, x ∈ A + · obtain ⟨a', ha', T', h₁, h₂, h₃⟩ := ih hr + refine ⟨a', ha', T', h₁.trans (List.sublist_cons_self _ _), fun x hx => ?_, h₃⟩ + exact List.mem_cons_of_mem _ (h₂ x hx) + · push Not at hr + obtain ⟨x, hx, hxA⟩ := h + have hu : u ∈ A := by + rcases List.mem_cons.mp hx with rfl | hx + · exact hxA + · exact (hr x hx hxA).elim + refine ⟨u, hu, .cons hl r, List.Sublist.refl _, fun _ hy => hy, fun y hy hyA => ?_⟩ + rcases List.mem_cons.mp hy with rfl | hy + · rfl + · exact (hr y hy hyA).elim + +/-- **A crossing.** A walk from a vertex of `A` to a vertex of `B` has a segment from `A` to `B` +that +meets `A` only in its first vertex and `B` only in its last vertex. -/ +theorem exists_crossing (A B : Set α) {a b : α} (T : GraphWalk G a b) (ha : a ∈ A) (hb : b ∈ B) : + ∃ a' ∈ A, ∃ b' ∈ B, ∃ T' : GraphWalk G a' b', T'.edges.Sublist T.edges ∧ + (∀ x ∈ T'.support, x ∈ T.support) ∧ (∀ x ∈ T'.support, x ∈ A → x = a') ∧ + ∀ x ∈ T'.support, x ∈ B → x = b' := by + obtain ⟨a', ha', T₁, h₁, h₂, h₃⟩ := exists_last_in A T ⟨a, T.start_mem_support, ha⟩ + obtain ⟨b', hb', T₂, h₄, h₅, h₆⟩ := exists_last_in B T₁.reverse + ⟨b, T₁.reverse.start_mem_support, hb⟩ + have hs : ∀ x ∈ T₂.reverse.support, x ∈ T₂.support := fun x hx => by + rw [GraphWalk.support_reverse] at hx + exact List.mem_reverse.mp hx + have hs' : ∀ x ∈ T₂.support, x ∈ T₁.support := fun x hx => by + have := h₅ x hx + rw [GraphWalk.support_reverse] at this + exact List.mem_reverse.mp this + refine ⟨a', ha', b', hb', T₂.reverse, ?_, fun x hx => h₂ x (hs' x (hs x hx)), + fun x hx hxA => h₃ x (hs' x (hs x hx)) hxA, fun x hx hxB => h₆ x (hs x hx) hxB⟩ + rw [GraphWalk.edges_reverse] + rw [GraphWalk.edges_reverse] at h₄ + have := h₄.reverse + rw [List.reverse_reverse] at this + exact this.trans h₁ + +end Crossing + +section Absorbing + +variable {Γ : Drawing S} {ins : Drawing S → Set S} {k : ℕ} + +/-- `X` is closed and holds `ins(C)` for each circuit `C` drawn in `X`. Closed discs `ins(C)` have +this +property, and so do lines. -/ +def IsAbsorbing (Γ : Drawing S) (ins : Drawing S → Set S) (k : ℕ) (X : Set S) : Prop := + IsClosed X ∧ ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ → C.length < k → C.U ⊆ X → ins C ⊆ X + +theorem IsAbsorbing.union {A B : Set S} {p : S} (hA : IsAbsorbing Γ ins k A) + (hB : IsAbsorbing Γ ins k B) (h : A ∩ B ⊆ {p}) : IsAbsorbing Γ ins k (A ∪ B) := by + refine ⟨hA.1.union hB.1, fun C hC hs hl hU => ?_⟩ + rcases IsOArc.subset_or_subset (IsCircuit.isOArc_U hC) hA.1 hB.1 hU h with h' | h' + · exact (hA.2 C hC hs hl h').trans subset_union_left + · exact (hB.2 C hC hs hl h').trans subset_union_right + +theorem IsArm.isAbsorbing {T : Set S} {p : S} (h : IsArm T p) : IsAbsorbing Γ ins k T := by + refine ⟨h.isClosed, fun C hC _ _ hU => ?_⟩ + exfalso + rcases h with rfl | ⟨q, hq⟩ + · exact (infinite_of_isOArc (IsCircuit.isOArc_U hC)).mono hU (finite_singleton p) + · exact not_isOArc_of_subset_line (IsLineWithEnds.isLine hq) (IsCircuit.isOArc_U hC) hU + +theorem isAbsorbing_ins (hs : IsSlope Γ k ins) {C : Drawing S} (hC : C.IsCircuit) + (hCs : C.IsSubdrawing Γ) (hl : C.length < k) : IsAbsorbing Γ ins k (ins C) := + ⟨(hs.isClosedDisc C hC hCs hl).isCompact.isClosed, fun C' hC' hs' hl' hU => + hs.monotone C' C hC' hs' hl' hC hCs hl hU⟩ + +/-- `ins(W)` lies in an absorbing set that holds `W`. -/ +theorem insWalk_subset {X : Set S} {u : S} (Z : GraphWalk Γ.toGraph u u) (hZ : Z.length < k) + (hX : IsAbsorbing Γ ins k X) (hU : (walkDrawing Γ Z).U ⊆ X) : insWalk ins Γ Z ⊆ X := by + rintro x (hx | hx) + · exact hU hx + · obtain ⟨C, ⟨hC, hCs⟩, hxC⟩ := mem_iUnion₂.mp hx + exact hX.2 C hC (hCs.trans (walkDrawing_isSubdrawing Γ Z)) (isConfined_walk Z hZ C hC hCs) + (hCs.U_subset.trans hU) hxC + +end Absorbing + +section Block + +variable {D : Drawing S} {H₁ H₂ H : Hypergraph S (Set S)} + +omit [T2Space S] in +private theorem end_mem (hle : H ≤ D.toHypergraph) {e : Set S} {v : S} (he : e ∈ H.edgeSet) + (hv : v ∈ D.V) (hve : v ∈ closure e) : v ∈ H.vertexSet := by + have hl : H.IsSubhypergraph D.toHypergraph := hle + have : v ∈ D.toHypergraph.ends e := ⟨hl.edgeSet_subset he, hv, hve⟩ + rw [hl.ends_eq e he] at this + exact H.vertex_mem_of_inc this + +omit [T2Space S] in +private theorem mem_sides (hsep : D.toHypergraph.IsSeparation H₁ H₂) {e : Set S} (he : e ∈ D.E) : + e ∈ H₁.edgeSet ∨ e ∈ H₂.edgeSet := by + have : e ∈ (H₁ ∪ H₂).edgeSet := by + rw [hsep.union_eq] + exact he + exact this + +omit [T2Space S] in +private theorem not_mem_both (hsep : D.toHypergraph.IsSeparation H₁ H₂) {e : Set S} + (h₁ : e ∈ H₁.edgeSet) (h₂ : e ∈ H₂.edgeSet) : False := by + have : e ∈ (H₁ ∩ H₂).edgeSet := ⟨h₁, h₂⟩ + rw [hsep.edgeSet_inter_eq] at this + exact this + +omit [T2Space S] in +/-- All edges of a walk lie on one side of a separation of order one, if the cut vertex `p` is not +an +inner vertex of the walk. -/ +private theorem same_side (hsep : D.toHypergraph.IsSeparation H₁ H₂) {p : S} + (hp : ∀ x, x ∈ H₁.vertexSet → x ∈ H₂.vertexSet → x = p) {a b : S} + (R : GraphWalk D.toGraph a b) + (hR : ∀ (x : S) (R₁ : GraphWalk D.toGraph a x) (R₂ : GraphWalk D.toGraph x b), R = R₁.append R₂ + → + 0 < R₁.length → 0 < R₂.length → x ≠ p) : + (∀ e ∈ R.edges, e ∈ H₁.edgeSet) ∨ (∀ e ∈ R.edges, e ∈ H₂.edgeSet) := by + induction R with + | nil _ => exact Or.inl (by simp) + | @cons a c b e hl r ih => + have ih' := ih fun x R₁ R₂ hr h₁ h₂ => + hR x (.cons hl R₁) R₂ (by subst hr; rfl) (by simp) h₂ + cases r with + | nil hc => + rcases mem_sides hsep hl.1 with h | h + · exact Or.inl (by simpa using h) + · exact Or.inr (by simpa using h) + | @cons c d b f hl' r' => + have hcp : c ≠ p := hR c (.cons hl (.nil hl.2.2.1)) (.cons hl' r') rfl (by simp) (by simp) + have hce : c ∈ closure e := (hl.2.2.2.symm ▸ (Or.inr rfl : c ∈ ({a, c} : Set S)) : + c ∈ closure e ∩ D.V).1 + have hcf : c ∈ closure f := (hl'.2.2.2.symm ▸ (Or.inl rfl : c ∈ ({c, d} : Set S)) : + c ∈ closure f ∩ D.V).1 + have hcV : c ∈ D.V := hl.2.2.1 + rcases ih' with h | h + · have hfm : f ∈ H₁.edgeSet := h f (by simp) + have hc₁ := end_mem hsep.left_le hfm hcV hcf + refine Or.inl fun g hg => ?_ + rcases List.mem_cons.mp hg with rfl | hg + · rcases mem_sides hsep hl.1 with h' | h' + · exact h' + · exact (hcp (hp c hc₁ (end_mem hsep.right_le h' hcV hce))).elim + · exact h g hg + · have hfm : f ∈ H₂.edgeSet := h f (by simp) + have hc₂ := end_mem hsep.right_le hfm hcV hcf + refine Or.inr fun g hg => ?_ + rcases List.mem_cons.mp hg with rfl | hg + · rcases mem_sides hsep hl.1 with h' | h' + · exact (hcp (hp c (end_mem hsep.left_le h' hcV hce) hc₂)).elim + · exact h' + · exact h g hg + +/-- `G` is a block: in each drawing that holds `G`, all edges of `G` lie on one side of each +separation of order one. -/ +def IsBlock (G : Drawing S) : Prop := + ∀ (D : Drawing S) (H₁ H₂ : Hypergraph S (Set S)), G.IsSubdrawing D → D.toHypergraph.IsSeparation + H₁ H₂ → + Hypergraph.separationOrder H₁ H₂ = 1 → (∀ e ∈ G.E, e ∈ H₁.edgeSet) ∨ (∀ e ∈ G.E, e ∈ H₂.edgeSet) + +omit [T2Space S] in +theorem isBlock_of_subsingleton {G : Drawing S} (hG : G.E.Subsingleton) : IsBlock G := by + intro D H₁ H₂ hs hsep _ + by_cases hne : G.E.Nonempty + · obtain ⟨e, he⟩ := hne + rcases mem_sides hsep (hs.2 he) with h | h + · exact Or.inl fun f hf => hG hf he ▸ h + · exact Or.inr fun f hf => hG hf he ▸ h + · exact Or.inl fun f hf => (hne ⟨f, hf⟩).elim + +omit [T2Space S] in +private theorem end_mem_tail {α β : Type*} {G : Graph α β} {a b : α} (R : GraphWalk G a b) + (h : 0 < R.length) : b ∈ R.support.tail := by + cases R with + | nil _ => simp at h + | cons _ r => simpa using r.end_mem_support + +omit [T2Space S] in +/-- A circuit is a block: it can be cut only at two vertices. -/ +theorem isBlock_of_isCircuit {C : Drawing S} (hC : C.IsCircuit) : IsBlock C := by + intro D H₁ H₂ hs hsep hord + obtain ⟨p, hp⟩ := ncard_eq_one.mp hord + have hpp : ∀ x, x ∈ H₁.vertexSet → x ∈ H₂.vertexSet → x = p := fun x h₁ h₂ => by + have : x ∈ (H₁ ∩ H₂).vertexSet := ⟨h₁, h₂⟩ + rw [hp] at this + exact this + have hsimple : ∀ v (W : GraphWalk C.toGraph v v), W.IsSimpleClosed → C.E = {e | e ∈ W.edges} → + C.V = {x | x ∈ W.support} → (p ∈ C.V → v = p) → + (∀ e ∈ C.E, e ∈ H₁.edgeSet) ∨ (∀ e ∈ C.E, e ∈ H₂.edgeSet) := by + intro v W hW hE hV hvp + obtain ⟨W', hsu, hed⟩ := hs.exists_walk_up W + have := same_side hsep hpp W' (fun x R₁ R₂ hr h₁ h₂ hxp => by + subst hxp + have hxs : x ∈ W'.support := by + rw [hr] + exact (GraphWalk.mem_support_append _ _).mpr (Or.inr R₂.start_mem_support) + have hvx : v = x := hvp (by rw [hV]; rw [hsu] at hxs; exact hxs) + subst hvx + have hnd : W'.support.tail.Nodup := by + rw [hsu] + exact hW.1 + rw [hr, GraphWalk.support_append, R₁.support_eq_cons] at hnd + simp only [List.cons_append, List.tail_cons] at hnd + exact (List.nodup_append.mp hnd).2.2 _ (end_mem_tail R₁ h₁) _ (end_mem_tail R₂ h₂) rfl) + rw [hed] at this + rcases this with h | h + · exact Or.inl fun e he => h e (by rw [hE] at he; exact he) + · exact Or.inr fun e he => h e (by rw [hE] at he; exact he) + by_cases hpC : p ∈ C.V + · obtain ⟨W, hW, -, hV, hE⟩ := exists_walk_at hC hpC + exact hsimple p W hW hE hV fun _ => rfl + · obtain ⟨v, W, hW, -, hV, hE⟩ := hC + exact hsimple v W hW hE hV fun h => (hpC h).elim + +variable {Γ : Drawing S} + +theorem walkDrawing_mono {u v u' v' : S} {Z : GraphWalk Γ.toGraph u v} {Z' : GraphWalk Γ.toGraph u' + v'} + (hs : ∀ x ∈ Z.support, x ∈ Z'.support) (he : ∀ e ∈ Z.edges, e ∈ Z'.edges) : + (walkDrawing Γ Z).IsSubdrawing (walkDrawing Γ Z') := by + refine ⟨?_, ?_⟩ + · rw [walkDrawing_V, walkDrawing_V] + exact hs + · rw [walkDrawing_E, walkDrawing_E] + exact he + +/-- A point of `Γ | W` is a vertex of `W` or lies on an edge of `W`. -/ +theorem walk_U_cases {u v : S} {W : GraphWalk Γ.toGraph u v} {z : S} (hz : z ∈ + (walkDrawing Γ W).U) : + z ∈ W.support ∨ ∃ e ∈ W.edges, z ∈ e := by + by_cases hV : z ∈ (walkDrawing Γ W).V + · rw [walkDrawing_V] at hV + exact Or.inl hV + · rcases (mem_walkDrawing_U Γ W).mp hz with h | ⟨e, he, hze⟩ + · exact Or.inl h + · have he' : e ∈ (walkDrawing Γ W).E := by + rw [walkDrawing_E] + exact he + exact Or.inr ⟨e, he, (walkDrawing Γ W).closure_diff_V he' ▸ ⟨hze, hV⟩⟩ + +theorem mem_U_append {u v w : S} {P : GraphWalk Γ.toGraph u v} {Q : GraphWalk Γ.toGraph v w} {x : + S} : + x ∈ (walkDrawing Γ (P.append Q)).U ↔ x ∈ (walkDrawing Γ P).U ∨ x ∈ (walkDrawing Γ Q).U := by + rw [GraphWalk.drawing_U_append, mem_union] + +theorem mem_U_reverse {u v : S} {P : GraphWalk Γ.toGraph u v} {x : S} : + x ∈ (walkDrawing Γ P.reverse).U ↔ x ∈ (walkDrawing Γ P).U := by + simp only [mem_walkDrawing_U, GraphWalk.support_reverse, GraphWalk.edges_reverse, + List.mem_reverse] + +/-- Two blocks that share two points, each with an edge at each vertex, form a non-separable +drawing. -/ +theorem isNonSeparable_walk {v₀ : S} (Z₁ Z₂ : GraphWalk Γ.toGraph v₀ v₀) + (hb₁ : IsBlock (walkDrawing Γ Z₁)) (hb₂ : IsBlock (walkDrawing Γ Z₂)) + (hv₁ : ∀ x ∈ Z₁.support, ∃ e ∈ Z₁.edges, x ∈ closure e) + (hv₂ : ∀ x ∈ Z₂.support, ∃ e ∈ Z₂.edges, x ∈ closure e) {x y : S} (hxy : x ≠ y) + (hx₁ : x ∈ (walkDrawing Γ Z₁).U) (hx₂ : x ∈ (walkDrawing Γ Z₂).U) + (hy₁ : y ∈ (walkDrawing Γ Z₁).U) (hy₂ : y ∈ (walkDrawing Γ Z₂).U) : + (walkDrawing Γ (Z₁.append Z₂)).IsNonSeparable := by + classical + set Z := Z₁.append Z₂ with hZ + have hEZ : ∀ e, e ∈ Z.edges ↔ e ∈ Z₁.edges ∨ e ∈ Z₂.edges := fun e => by + rw [hZ, GraphWalk.edges_append, List.mem_append] + have hSZ : ∀ x, x ∈ Z.support ↔ x ∈ Z₁.support ∨ x ∈ Z₂.support := fun x => + GraphWalk.mem_support_append _ _ + have hs₁ := walkDrawing_mono (Z := Z₁) (Z' := Z) (fun x h => (hSZ x).mpr (Or.inl h)) + (fun e h => (hEZ e).mpr (Or.inl h)) + have hs₂ := walkDrawing_mono (Z := Z₂) (Z' := Z) (fun x h => (hSZ x).mpr (Or.inr h)) + (fun e h => (hEZ e).mpr (Or.inr h)) + have hZsub := walkDrawing_isSubdrawing Γ Z + refine ⟨⟨⟨v₀, by rw [walkDrawing_V]; exact Z.start_mem_support⟩, ?_⟩, ?_⟩ + · intro a ha b hb + rw [walkDrawing_V] at ha hb + obtain ⟨Z', hsZ, -⟩ := hZsub.exists_walk_down Z + (by rw [walkDrawing_V]; exact fun _ h => h) (by rw [walkDrawing_E]; exact fun _ h => h) + exact exists_walk_of_mem_support Z' (hsZ ▸ ha) (hsZ ▸ hb) + intro H₁ H₂ hsep hord hne₁ hne₂ + obtain ⟨p, hp⟩ := ncard_eq_one.mp hord + have hpp : ∀ x, x ∈ H₁.vertexSet → x ∈ H₂.vertexSet → x = p := fun x h₁ h₂ => by + have : x ∈ (H₁ ∩ H₂).vertexSet := ⟨h₁, h₂⟩ + rw [hp] at this + exact this + have hall : ∀ {H H' : Hypergraph S (Set S)}, H' ≤ (walkDrawing Γ Z).toHypergraph → + (∀ e, e ∈ H.edgeSet → e ∈ H'.edgeSet → False) → + (∀ e ∈ (walkDrawing Γ Z).E, e ∈ H.edgeSet ∨ e ∈ H'.edgeSet) → + (∀ e ∈ (walkDrawing Γ Z₁).E, e ∈ H.edgeSet) → (∀ e ∈ (walkDrawing Γ Z₂).E, e ∈ H.edgeSet) → + H'.edgeSet.Nonempty → False := by + intro H H' hle hnb _ h₁ h₂ ⟨e, he⟩ + have hl : H'.IsSubhypergraph (walkDrawing Γ Z).toHypergraph := hle + have heZ : e ∈ Z.edges := by + have := hl.edgeSet_subset he + change e ∈ (walkDrawing Γ Z).E at this + rwa [walkDrawing_E] at this + rcases (hEZ e).mp heZ with h | h + · exact hnb e (h₁ e (by rw [walkDrawing_E]; exact h)) he + · exact hnb e (h₂ e (by rw [walkDrawing_E]; exact h)) he + -- A point of both blocks is a vertex of both, when the blocks lie on opposite sides. + have hcommon : ∀ {H H' : Hypergraph S (Set S)}, (∀ e, e ∈ H.edgeSet → e ∈ H'.edgeSet → False) → + (∀ e ∈ (walkDrawing Γ Z₁).E, e ∈ H.edgeSet) → (∀ e ∈ (walkDrawing Γ Z₂).E, e ∈ H'.edgeSet) → + ∀ z, z ∈ (walkDrawing Γ Z₁).U → z ∈ (walkDrawing Γ Z₂).U → z ∈ Z₁.support ∧ z ∈ Z₂.support + := by + intro H H' hnb h₁ h₂ z hz₁ hz₂ + rcases walk_U_cases hz₁ with hz₁ | ⟨e, he, hze⟩ <;> rcases walk_U_cases hz₂ with hz₂ | ⟨f, hf, + hzf⟩ + · exact ⟨hz₁, hz₂⟩ + · exact (edge_notMem_V (mem_E_of_mem_edges Z₂ hf) hzf (mem_V_of_mem_support Z₁ hz₁)).elim + · exact (edge_notMem_V (mem_E_of_mem_edges Z₁ he) hze (mem_V_of_mem_support Z₂ hz₂)).elim + · obtain rfl : e = f := Γ.edge_eq_of_mem (mem_E_of_mem_edges Z₁ he) + (mem_E_of_mem_edges Z₂ hf) hze hzf + exact (hnb e (h₁ e (by rw [walkDrawing_E]; exact he)) + (h₂ e (by rw [walkDrawing_E]; exact hf))).elim + have hVin : ∀ {W : GraphWalk Γ.toGraph v₀ v₀} {H : Hypergraph S (Set S)}, H ≤ + (walkDrawing Γ Z).toHypergraph → + (∀ e ∈ W.edges, e ∈ H.edgeSet) → (∀ x ∈ W.support, ∃ e ∈ W.edges, x ∈ closure e) → + (∀ x ∈ W.support, x ∈ Z.support) → ∀ x ∈ W.support, x ∈ H.vertexSet := by + intro W H hle hE hv hsu x hx + obtain ⟨e, he, hxe⟩ := hv x hx + exact end_mem hle (hE e he) (by rw [walkDrawing_V]; exact hsu x hx) hxe + have hnb : ∀ e, e ∈ H₁.edgeSet → e ∈ H₂.edgeSet → False := fun e h₁ h₂ => not_mem_both hsep h₁ h₂ + have hnb' : ∀ e, e ∈ H₂.edgeSet → e ∈ H₁.edgeSet → False := fun e h₁ h₂ => not_mem_both hsep h₂ h₁ + have hcov : ∀ e ∈ (walkDrawing Γ Z).E, e ∈ H₁.edgeSet ∨ e ∈ H₂.edgeSet := fun e he => + mem_sides hsep he + have hcov' : ∀ e ∈ (walkDrawing Γ Z).E, e ∈ H₂.edgeSet ∨ e ∈ H₁.edgeSet := fun e he => + (mem_sides hsep he).symm + have hS₁ : ∀ x ∈ Z₁.support, x ∈ Z.support := fun x h => (hSZ x).mpr (Or.inl h) + have hS₂ : ∀ x ∈ Z₂.support, x ∈ Z.support := fun x h => (hSZ x).mpr (Or.inr h) + have hE' : ∀ {W : GraphWalk Γ.toGraph v₀ v₀} {H : Hypergraph S (Set S)}, + (∀ e ∈ (walkDrawing Γ W).E, e ∈ H.edgeSet) → ∀ e ∈ W.edges, e ∈ H.edgeSet := fun h e he => + h e (by rw [walkDrawing_E]; exact he) + rcases hb₁ _ H₁ H₂ hs₁ hsep hord with h₁ | h₁ <;> rcases hb₂ _ H₁ H₂ hs₂ hsep hord with h₂ | h₂ + · exact hall hsep.right_le hnb hcov h₁ h₂ hne₂ + · obtain ⟨a₁, a₂⟩ := hcommon hnb h₁ h₂ x hx₁ hx₂ + obtain ⟨b₁, b₂⟩ := hcommon hnb h₁ h₂ y hy₁ hy₂ + have hx' := hpp x (hVin hsep.left_le (hE' h₁) hv₁ hS₁ x a₁) (hVin hsep.right_le + (hE' h₂) hv₂ hS₂ x a₂) + have hy' := hpp y (hVin hsep.left_le (hE' h₁) hv₁ hS₁ y b₁) (hVin hsep.right_le + (hE' h₂) hv₂ hS₂ y b₂) + exact hxy (hx'.trans hy'.symm) + · obtain ⟨a₁, a₂⟩ := hcommon hnb' h₁ h₂ x hx₁ hx₂ + obtain ⟨b₁, b₂⟩ := hcommon hnb' h₁ h₂ y hy₁ hy₂ + have hx' := hpp x (hVin hsep.left_le (hE' h₂) hv₂ hS₂ x a₂) (hVin hsep.right_le + (hE' h₁) hv₁ hS₁ x a₁) + have hy' := hpp y (hVin hsep.left_le (hE' h₂) hv₂ hS₂ y b₂) (hVin hsep.right_le + (hE' h₁) hv₁ hS₁ y b₁) + exact hxy (hx'.trans hy'.symm) + · exact hall hsep.left_le hnb' hcov' h₁ h₂ hne₁ + +end Block + +end GraphMinor.GM11 diff --git a/LeanPool/GraphMinor/GM11/Walks.lean b/LeanPool/GraphMinor/GM11/Walks.lean new file mode 100644 index 0000000000..fa8f54d857 --- /dev/null +++ b/LeanPool/GraphMinor/GM11/Walks.lean @@ -0,0 +1,706 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs + +/-! +# Walks, paths and circuits of drawings + +Graph Minors XI uses freely the elementary facts about walks, paths and circuits of a drawing. This +file proves those we need: + +- a subdrawing is determined by its vertices and edges (`Drawing.ext_of_V_E`), and the point set + of a drawing is the union of its vertices and the closures of its edges (`Drawing.U_eq`); +- a subdrawing has the same links as the drawing (`Drawing.isLink_iff_of_isSubdrawing`), so walks + pass to subdrawings (`GraphWalk.exists_transfer`); +- splitting a walk at a vertex, and rotating a closed walk; +- two internally disjoint paths with the same ends form a circuit (`Drawing.isCircuit_sup`), and + two vertices split a circuit into two such paths (`Drawing.IsCircuit.exists_two_paths`). +-/ + +public section + +namespace GraphMinor.Surface + +open Set Topology Graph + +universe u + +variable {S : Type u} [TopologicalSpace S] + +namespace GraphWalk + +variable {α : Type u} {β : Type*} {G G' : Graph α β} + +@[simp] theorem support_nil {v : α} (h : v ∈ V(G)) : (GraphWalk.nil h).support = [v] := rfl +@[simp] theorem edges_nil {v : α} (h : v ∈ V(G)) : (GraphWalk.nil h).edges = [] := rfl +@[simp] theorem support_cons {u v w : α} {e : β} (h : G.IsLink e u v) (r : GraphWalk G v w) : + (GraphWalk.cons h r).support = u :: r.support := rfl +@[simp] theorem edges_cons {u v w : α} {e : β} (h : G.IsLink e u v) (r : GraphWalk G v w) : + (GraphWalk.cons h r).edges = e :: r.edges := rfl +@[simp] theorem length_nil {v : α} (h : v ∈ V(G)) : (GraphWalk.nil h).length = 0 := rfl +@[simp] theorem length_cons {u v w : α} {e : β} (h : G.IsLink e u v) (r : GraphWalk G v w) : + (GraphWalk.cons h r).length = r.length + 1 := by + simp [length] + +theorem start_mem_support {u v : α} (W : GraphWalk G u v) : u ∈ W.support := by + cases W <;> simp + +theorem end_mem_support {u v : α} (W : GraphWalk G u v) : v ∈ W.support := by + induction W with + | nil h => simp + | cons h r ih => simp [ih] + +theorem support_ne_nil {u v : α} (W : GraphWalk G u v) : W.support ≠ [] := + List.ne_nil_of_mem W.start_mem_support + +theorem head_support {u v : α} (W : GraphWalk G u v) : W.support.head W.support_ne_nil = u := by + cases W <;> simp + +theorem support_eq_cons {u v : α} (W : GraphWalk G u v) : W.support = u :: W.support.tail := by + cases W <;> simp + +theorem mem_vertexSet_of_mem_support {u v : α} (W : GraphWalk G u v) {x : α} + (hx : x ∈ W.support) : x ∈ V(G) := by + induction W with + | nil h => + simp only [support_nil, List.mem_singleton] at hx + exact hx ▸ h + | cons h r ih => + rcases List.mem_cons.mp hx with rfl | hx + · exact h.left_mem + · exact ih hx + +theorem support_append {u v w : α} (W : GraphWalk G u v) (W' : GraphWalk G v w) : + (W.append W').support = W.support ++ W'.support.tail := by + induction W with + | nil h => + change W'.support = _ + exact W'.support_eq_cons + | cons h r ih => simp [append, ih] + +theorem edges_append {u v w : α} (W : GraphWalk G u v) (W' : GraphWalk G v w) : + (W.append W').edges = W.edges ++ W'.edges := by + induction W with + | nil h => rfl + | cons h r ih => simp [append, ih] + +theorem mem_support_append {u v w x : α} (W : GraphWalk G u v) (W' : GraphWalk G v w) : + x ∈ (W.append W').support ↔ x ∈ W.support ∨ x ∈ W'.support := by + rw [support_append, List.mem_append] + constructor + · rintro (h | h) + · exact Or.inl h + · exact Or.inr (List.mem_of_mem_tail h) + · rintro (h | h) + · exact Or.inl h + · rw [W'.support_eq_cons] at h + rcases List.mem_cons.mp h with rfl | h + · exact Or.inl W.end_mem_support + · exact Or.inr h + +theorem eq_of_length_eq_zero {u v : α} {W : GraphWalk G u v} (h : W.length = 0) : u = v := by + cases W with + | nil _ => rfl + | cons h' r => simp at h + +theorem length_append {u v w : α} (W : GraphWalk G u v) (W' : GraphWalk G v w) : + (W.append W').length = W.length + W'.length := by + simp [length, edges_append] + +theorem support_reverse {u v : α} (W : GraphWalk G u v) : W.reverse.support = W.support.reverse + := by + induction W with + | nil h => rfl + | cons h r ih => simp [reverse, support_append, ih] + +theorem edges_reverse {u v : α} (W : GraphWalk G u v) : W.reverse.edges = W.edges.reverse := by + induction W with + | nil h => rfl + | cons h r ih => simp [reverse, edges_append, ih] + +theorem length_reverse {u v : α} (W : GraphWalk G u v) : W.reverse.length = W.length := by + simp [length, edges_reverse] + +/-- A walk can be split at any of its vertices. -/ +theorem exists_append_of_mem {u v x : α} (W : GraphWalk G u v) (hx : x ∈ W.support) : + ∃ (W₁ : GraphWalk G u x) (W₂ : GraphWalk G x v), W = W₁.append W₂ := by + induction W with + | nil h => + simp only [support_nil, List.mem_singleton] at hx + subst hx + exact ⟨.nil h, .nil h, rfl⟩ + | cons h r ih => + rcases List.mem_cons.mp hx with rfl | hx + · exact ⟨.nil h.left_mem, .cons h r, rfl⟩ + · obtain ⟨W₁, W₂, rfl⟩ := ih hx + exact ⟨.cons h W₁, W₂, rfl⟩ + +/-- The ends of an edge of a walk are vertices of the walk. -/ +theorem left_mem_support_of_mem_edges {u v : α} (W : GraphWalk G u v) {e : β} (he : e ∈ W.edges) + {x y : α} (hl : G.IsLink e x y) : x ∈ W.support := by + induction W with + | nil h => simp at he + | cons h r ih => + rcases List.mem_cons.mp he with rfl | he + · rcases hl.left_eq_or_eq h with rfl | rfl + · simp + · simp [r.start_mem_support] + · simp [ih he] + +theorem IsSimple.of_cons {u v w : α} {e : β} {h : G.IsLink e u v} {r : GraphWalk G v w} + (hW : (GraphWalk.cons h r).IsSimple) : r.IsSimple := + (List.nodup_cons.mp hW).2 + +theorem IsSimple.edges_nodup {u v : α} {W : GraphWalk G u v} (hW : W.IsSimple) : W.edges.Nodup := by + induction W with + | nil h => simp + | cons h r ih => + refine List.nodup_cons.mpr ⟨fun he => ?_, ih hW.of_cons⟩ + exact (List.nodup_cons.mp hW).1 (r.left_mem_support_of_mem_edges he h) + +theorem IsSimple.reverse {u v : α} {W : GraphWalk G u v} (hW : W.IsSimple) : W.reverse.IsSimple + := by + unfold GraphWalk.IsSimple at * + rw [support_reverse] + exact List.nodup_reverse.mpr hW + +/-- A simple walk with equal ends has length zero. -/ +theorem IsSimple.length_eq_zero {u : α} {W : GraphWalk G u u} (hW : W.IsSimple) : W.length = 0 := by + cases W with + | nil h => rfl + | cons h r => exact absurd r.end_mem_support (List.nodup_cons.mp hW).1 + +/-- Walks pass to a graph that has the links used by the walk. -/ +theorem exists_transfer {u v : α} (W : GraphWalk G u v) + (hl : ∀ e x y, e ∈ W.edges → G.IsLink e x y → G'.IsLink e x y) + (hV : ∀ x ∈ W.support, x ∈ V(G')) : + ∃ W' : GraphWalk G' u v, W'.support = W.support ∧ W'.edges = W.edges := by + induction W with + | nil h => exact ⟨.nil (hV _ (by simp)), rfl, rfl⟩ + | cons h r ih => + obtain ⟨W', hs, he⟩ := ih (fun e x y he hxy => hl e x y (by simp [he]) hxy) + (fun x hx => hV x (by simp [hx])) + exact ⟨.cons (hl _ _ _ (by simp) h) W', by simp [hs], by simp [he]⟩ + +/-- `W₁ + W₂` is simple-closed if `W₁` from `a` to `b` and `W₂` from `b` to `a` are simple and +have only their ends and no edge in common. -/ +theorem isSimpleClosed_append {a b : α} {W₁ : GraphWalk G a b} {W₂ : GraphWalk G b a} + (h₁ : W₁.IsSimple) (h₂ : W₂.IsSimple) + (hV : ∀ x, x ∈ W₁.support → x ∈ W₂.support → x = a ∨ x = b) + (hE : ∀ e, e ∈ W₁.edges → e ∉ W₂.edges) : (W₁.append W₂).IsSimpleClosed := by + constructor + · rw [support_append, W₁.support_eq_cons, List.cons_append, List.tail_cons] + have ht₁ : W₁.support.tail.Nodup := List.Nodup.tail h₁ + have ht₂ : W₂.support.tail.Nodup := List.Nodup.tail h₂ + refine List.nodup_append.mpr ⟨ht₁, ht₂, ?_⟩ + intro x hx y hy hxy + subst hxy + have hx' : x ∈ W₁.support := by + rw [W₁.support_eq_cons] + exact List.mem_cons_of_mem _ hx + have hx₂ : x ∈ W₂.support := by + rw [W₂.support_eq_cons] + exact List.mem_cons_of_mem _ hy + rcases hV x hx' hx₂ with rfl | rfl + · have h : W₁.support.Nodup := h₁ + rw [W₁.support_eq_cons] at h + exact (List.nodup_cons.mp h).1 hx + · have h : W₂.support.Nodup := h₂ + rw [W₂.support_eq_cons] at h + exact (List.nodup_cons.mp h).1 hy + · rw [edges_append] + exact List.nodup_append.mpr ⟨h₁.edges_nodup, h₂.edges_nodup, fun e he f hf hef => + hE e he (hef ▸ hf)⟩ + +/-- Split a simple closed walk at two distinct vertices. The two pieces preserve the support +and edges, and their tails and edge lists are jointly nodup. -/ +theorem exists_circuit_split {u a b : α} (W : GraphWalk G u u) + (hnd : W.support.tail.Nodup) (hed : W.edges.Nodup) + (ha : a ∈ W.support) (hb : b ∈ W.support) (hab : a ≠ b) : + ∃ (R₁ : GraphWalk G a b) (R₂ : GraphWalk G b a), + R₁.IsSimple ∧ R₂.IsSimple ∧ (R₁.support.tail ++ R₂.support.tail).Nodup ∧ + (R₁.edges ++ R₂.edges).Nodup ∧ + (∀ x, x ∈ (R₁.append R₂).support ↔ x ∈ W.support) ∧ + (∀ e, e ∈ (R₁.append R₂).edges ↔ e ∈ W.edges) := by + obtain ⟨W₁, W₂, rfl⟩ := W.exists_append_of_mem ha + set Rot := W₂.append W₁ with hRot + have hmemRot : ∀ x, x ∈ Rot.support ↔ x ∈ (W₁.append W₂).support := by + intro x + rw [hRot, GraphWalk.mem_support_append, GraphWalk.mem_support_append, or_comm] + have hmemE : ∀ e, e ∈ Rot.edges ↔ e ∈ (W₁.append W₂).edges := by + intro e + rw [hRot, GraphWalk.edges_append, GraphWalk.edges_append, List.mem_append, List.mem_append, + or_comm] + have htail : Rot.support.tail.Nodup := by + have h1 : (W₁.append W₂).support.tail = W₁.support.tail ++ W₂.support.tail := by + rw [GraphWalk.support_append, W₁.support_eq_cons]; simp + have h2 : Rot.support.tail = W₂.support.tail ++ W₁.support.tail := by + rw [hRot, GraphWalk.support_append, W₂.support_eq_cons]; simp + rw [h2] + rw [h1] at hnd + exact (List.perm_append_comm.nodup_iff).mp hnd + have hedRot : Rot.edges.Nodup := by + rw [hRot, GraphWalk.edges_append] + rw [GraphWalk.edges_append] at hed + exact (List.perm_append_comm.nodup_iff).mp hed + obtain ⟨R₁, R₂, hR⟩ := Rot.exists_append_of_mem ((hmemRot b).mpr hb) + have htail' : (R₁.support.tail ++ R₂.support.tail).Nodup := by + have : Rot.support.tail = R₁.support.tail ++ R₂.support.tail := by + rw [hR, GraphWalk.support_append, R₁.support_eq_cons]; simp + rwa [this] at htail + have hdisjT := List.nodup_append.mp htail' + have hbt₁ : b ∈ R₁.support.tail := by + have h := R₁.end_mem_support + rw [R₁.support_eq_cons] at h + exact (List.mem_cons.mp h).resolve_left hab.symm + have hat₂ : a ∈ R₂.support.tail := by + have h := R₂.end_mem_support + rw [R₂.support_eq_cons] at h + exact (List.mem_cons.mp h).resolve_left hab + have hS₁ : R₁.IsSimple := by + unfold GraphWalk.IsSimple + rw [R₁.support_eq_cons] + exact List.nodup_cons.mpr ⟨fun h => hdisjT.2.2 a h a hat₂ rfl, hdisjT.1⟩ + have hS₂ : R₂.IsSimple := by + unfold GraphWalk.IsSimple + rw [R₂.support_eq_cons] + exact List.nodup_cons.mpr ⟨fun h => hdisjT.2.2 b hbt₁ b h rfl, hdisjT.2.1⟩ + have hedR : (R₁.edges ++ R₂.edges).Nodup := by + rw [hR, GraphWalk.edges_append] at hedRot + exact hedRot + refine ⟨R₁, R₂, hS₁, hS₂, htail', hedR, ?_, ?_⟩ + · simpa only [← hR] using hmemRot + · simpa only [← hR] using hmemE + +/-- Lift two simple paths with matching ends to a simple closed walk in one graph. -/ +theorem isSimpleClosed_append_of_lifts {H K : Graph α β} {a b : α} + {W₁ : GraphWalk H a b} {W₂ : GraphWalk K a b} {X₁ : GraphWalk G a b} {X₂ : GraphWalk G b a} + (hW₁ : W₁.IsSimple) (hW₂ : W₂.IsSimple) + (hs₁ : X₁.support = W₁.support) (hs₂ : X₂.support = W₂.reverse.support) + (he₁ : X₁.edges = W₁.edges) (he₂ : X₂.edges = W₂.reverse.edges) + (hV : {x | x ∈ W₁.support} ∩ {x | x ∈ W₂.support} = {a, b}) + (hE : Disjoint {e | e ∈ W₁.edges} {e | e ∈ W₂.edges}) : + (X₁.append X₂).IsSimpleClosed := by + have hX₁ : X₁.IsSimple := by unfold GraphWalk.IsSimple; rw [hs₁]; exact hW₁ + have hX₂ : X₂.IsSimple := by unfold GraphWalk.IsSimple; rw [hs₂]; exact hW₂.reverse + apply isSimpleClosed_append hX₁ hX₂ + · intro x hx₁ hx₂ + rw [hs₁] at hx₁ + rw [hs₂, support_reverse, List.mem_reverse] at hx₂ + have hx : x ∈ {x | x ∈ W₁.support} ∩ {x | x ∈ W₂.support} := ⟨hx₁, hx₂⟩ + rwa [hV] at hx + · intro e he₁' he₂' + rw [he₁] at he₁' + rw [he₂, edges_reverse, List.mem_reverse] at he₂' + exact Set.disjoint_left.mp hE he₁' he₂' + +/-- Each part of a simple concatenation is a simple walk. -/ +theorem simple_parts_of_append {a x b : α} {W₁ : GraphWalk G a x} + {W₂ : GraphWalk G x b} (h : (W₁.append W₂).IsSimple) : + W₁.IsSimple ∧ W₂.IsSimple := by + have hs : (W₁.support ++ W₂.support.tail).Nodup := by + have h' : (W₁.append W₂).support.Nodup := h + rwa [GraphWalk.support_append] at h' + have hd := List.nodup_append.mp hs + refine ⟨hd.1, ?_⟩ + unfold GraphWalk.IsSimple + rw [W₂.support_eq_cons] + exact List.nodup_cons.mpr ⟨fun hx => hd.2.2 x W₁.end_mem_support x hx rfl, hd.2.1⟩ + +/-- An occurrence of an edge splits the walk at that edge. -/ +theorem split_at_edge {a b : α} (W : GraphWalk G a b) {e : β} (he : e ∈ W.edges) : + ∃ (x y : α) (h : G.IsLink e x y) (W₁ : GraphWalk G a x) (W₂ : GraphWalk G y b), + W = W₁.append (.cons h W₂) := by + induction W with + | nil h => simp at he + | cons h r ih => + rcases List.mem_cons.mp he with rfl | he + · exact ⟨_, _, h, .nil h.left_mem, r, rfl⟩ + · obtain ⟨x, y, h', W₁, W₂, rfl⟩ := ih he + exact ⟨x, y, h', .cons h W₁, W₂, rfl⟩ + +end GraphWalk + +namespace Drawing + +variable (Γ : Drawing S) + +/-- Every point of `U(Γ)` outside `V(Γ)` lies on an edge. -/ +theorem exists_edge_of_mem {x : S} (hx : x ∈ Γ.U) (hxV : x ∉ Γ.V) : ∃ e ∈ Γ.E, x ∈ e := by + have hxF : x ∈ Γ.U \ Γ.V := ⟨hx, hxV⟩ + exact ⟨pathComponentIn (Γ.U \ Γ.V) x, + GraphMinor.Surface.mem_arcComponentsIn_of_mem hxF, mem_pathComponentIn_self hxF⟩ + +/-- `U(Γ)` is the union of `V(Γ)` and the closures of the edges. -/ +theorem U_eq : Γ.U = Γ.V ∪ ⋃ e ∈ Γ.E, closure e := by + apply subset_antisymm + · intro x hx + by_cases hxV : x ∈ Γ.V + · exact Or.inl hxV + · obtain ⟨e, he, hxe⟩ := Γ.exists_edge_of_mem hx hxV + exact Or.inr (mem_iUnion₂.mpr ⟨e, he, subset_closure hxe⟩) + · refine union_subset Γ.V_subset_U (iUnion₂_subset fun e he => Γ.closure_subset_U he) + +variable {Γ} + +/-- A drawing is determined by its vertices and edges. -/ +theorem ext_of_V_E {Γ₁ Γ₂ : Drawing S} (hV : Γ₁.V = Γ₂.V) (hE : Γ₁.E = Γ₂.E) : Γ₁ = Γ₂ := by + have hU : Γ₁.U = Γ₂.U := by rw [Γ₁.U_eq, Γ₂.U_eq, hV, hE] + cases Γ₁ + cases Γ₂ + simp only at hU hV + subst hU hV + rfl + +theorem IsSubdrawing.refl (Γ : Drawing S) : Γ.IsSubdrawing Γ := ⟨subset_rfl, subset_rfl⟩ + +theorem IsSubdrawing.trans {Γ₁ Γ₂ Γ₃ : Drawing S} (h₁ : Γ₁.IsSubdrawing Γ₂) + (h₂ : Γ₂.IsSubdrawing Γ₃) : Γ₁.IsSubdrawing Γ₃ := + ⟨h₁.1.trans h₂.1, h₁.2.trans h₂.2⟩ + +theorem IsSubdrawing.U_subset {Γ₁ Γ₂ : Drawing S} (h : Γ₁.IsSubdrawing Γ₂) : Γ₁.U ⊆ Γ₂.U := by + rw [Γ₁.U_eq, Γ₂.U_eq] + exact union_subset_union h.1 (biUnion_subset_biUnion_left h.2) + +/-- An edge of a subdrawing has the same ends in the subdrawing as in the drawing. -/ +theorem IsSubdrawing.closure_inter_V {Γ₁ Γ₂ : Drawing S} (h : Γ₁.IsSubdrawing Γ₂) {e : Set S} + (he : e ∈ Γ₁.E) : closure e ∩ Γ₁.V = closure e ∩ Γ₂.V := by + have h₁ := Γ₁.closure_diff_V he + have h₂ := Γ₂.closure_diff_V (h.2 he) + ext x + constructor + · rintro ⟨hx, hxV⟩ + exact ⟨hx, h.1 hxV⟩ + · rintro ⟨hx, hxV⟩ + refine ⟨hx, ?_⟩ + by_contra hx₁ + have : x ∈ e := by rw [← h₁]; exact ⟨hx, hx₁⟩ + exact (by rw [← h₂] at this; exact this.2 : x ∉ Γ₂.V) hxV + +theorem IsSubdrawing.isLink_iff {Γ₁ Γ₂ : Drawing S} (h : Γ₁.IsSubdrawing Γ₂) {e : Set S} + (he : e ∈ Γ₁.E) {x y : S} : Γ₁.toGraph.IsLink e x y ↔ Γ₂.toGraph.IsLink e x y := by + constructor + · rintro ⟨_, hx, hy, hc⟩ + exact ⟨h.2 he, h.1 hx, h.1 hy, by rw [← h.closure_inter_V he, hc]⟩ + · rintro ⟨_, _, _, hc⟩ + have hc' : closure e ∩ Γ₁.V = {x, y} := by rw [h.closure_inter_V he, hc] + have hx : x ∈ closure e ∩ Γ₁.V := by rw [hc']; simp + have hy : y ∈ closure e ∩ Γ₁.V := by rw [hc']; simp + exact ⟨he, hx.2, hy.2, hc'⟩ + +/-- The graph of a subdrawing is a subgraph of the graph of the drawing. -/ +theorem IsSubdrawing.toGraph_le {Γ₁ Γ₂ : Drawing S} (h : Γ₁.IsSubdrawing Γ₂) : + Γ₁.toGraph ≤ Γ₂.toGraph := + ⟨h.1, fun _ _ _ he => (h.isLink_iff he.1).mp he⟩ + +theorem toGraph_isLink_mem {Γ : Drawing S} {e : Set S} {x y : S} (h : Γ.toGraph.IsLink e x y) : + e ∈ Γ.E := h.1 + +/-- A walk of a subdrawing is a walk of the drawing. -/ +theorem IsSubdrawing.exists_walk_up {Γ₁ Γ₂ : Drawing S} (h : Γ₁.IsSubdrawing Γ₂) {u v : S} + (W : GraphWalk Γ₁.toGraph u v) : + ∃ W' : GraphWalk Γ₂.toGraph u v, W'.support = W.support ∧ W'.edges = W.edges := + W.exists_transfer (fun _ _ _ _ hl => (h.isLink_iff hl.1).mp hl) + (fun _ hx => h.1 (W.mem_vertexSet_of_mem_support hx)) + +/-- A walk of the drawing, with its vertices and edges in a subdrawing, is a walk of the +subdrawing. -/ +theorem IsSubdrawing.exists_walk_down {Γ₁ Γ₂ : Drawing S} (h : Γ₁.IsSubdrawing Γ₂) {u v : S} + (W : GraphWalk Γ₂.toGraph u v) (hV : ∀ x ∈ W.support, x ∈ Γ₁.V) + (hE : ∀ e ∈ W.edges, e ∈ Γ₁.E) : + ∃ W' : GraphWalk Γ₁.toGraph u v, W'.support = W.support ∧ W'.edges = W.edges := + W.exists_transfer (fun _ _ _ he hl => (h.isLink_iff (hE _ he)).mpr hl) hV + +variable [T1Space S] + +theorem span_isSubdrawing (Γ : Drawing S) (V' : Set S) (E' : Set (Set S)) : + (Γ.span V' E').IsSubdrawing Γ := by + refine ⟨Γ.spanV_subset V' E', ?_⟩ + rw [Γ.span_E] + exact inter_subset_right + +theorem sup_isSubdrawing (Γ Γ₁ Γ₂ : Drawing S) : (Γ.sup Γ₁ Γ₂).IsSubdrawing Γ := + span_isSubdrawing Γ _ _ + +theorem sup_V {Γ Γ₁ Γ₂ : Drawing S} (h₁ : Γ₁.IsSubdrawing Γ) (h₂ : Γ₂.IsSubdrawing Γ) : + (Γ.sup Γ₁ Γ₂).V = Γ₁.V ∪ Γ₂.V := by + apply subset_antisymm + · rintro x (⟨hx, -⟩ | hx) + · exact hx + · obtain ⟨e, ⟨he, -⟩, hxe, hxV⟩ := mem_iUnion₂.mp hx + rcases he with he | he + · have : x ∈ closure e ∩ Γ₁.V := by rw [h₁.closure_inter_V he]; exact ⟨hxe, hxV⟩ + exact Or.inl this.2 + · have : x ∈ closure e ∩ Γ₂.V := by rw [h₂.closure_inter_V he]; exact ⟨hxe, hxV⟩ + exact Or.inr this.2 + · intro x hx + refine Or.inl ⟨hx, ?_⟩ + rcases hx with hx | hx + · exact h₁.1 hx + · exact h₂.1 hx + +theorem sup_E {Γ Γ₁ Γ₂ : Drawing S} (h₁ : Γ₁.IsSubdrawing Γ) (h₂ : Γ₂.IsSubdrawing Γ) : + (Γ.sup Γ₁ Γ₂).E = Γ₁.E ∪ Γ₂.E := by + rw [sup, Γ.span_E] + exact inter_eq_left.mpr (union_subset h₁.2 h₂.2) + +/-- The union of subdrawings has the union of their point sets. -/ +theorem sup_U {Γ Γ₁ Γ₂ : Drawing S} (h₁ : Γ₁.IsSubdrawing Γ) (h₂ : Γ₂.IsSubdrawing Γ) : + (Γ.sup Γ₁ Γ₂).U = Γ₁.U ∪ Γ₂.U := by + rw [Drawing.U_eq, Drawing.sup_V h₁ h₂, Drawing.sup_E h₁ h₂, Γ₁.U_eq, Γ₂.U_eq, + biUnion_union, union_union_union_comm] + +theorem le_sup_left {Γ Γ₁ Γ₂ : Drawing S} (h₁ : Γ₁.IsSubdrawing Γ) (h₂ : Γ₂.IsSubdrawing Γ) : + Γ₁.IsSubdrawing (Γ.sup Γ₁ Γ₂) := + ⟨by rw [sup_V h₁ h₂]; exact subset_union_left, by rw [sup_E h₁ h₂]; exact subset_union_left⟩ + +theorem le_sup_right {Γ Γ₁ Γ₂ : Drawing S} (h₁ : Γ₁.IsSubdrawing Γ) (h₂ : Γ₂.IsSubdrawing Γ) : + Γ₂.IsSubdrawing (Γ.sup Γ₁ Γ₂) := + ⟨by rw [sup_V h₁ h₂]; exact subset_union_right, by rw [sup_E h₁ h₂]; exact subset_union_right⟩ + +end Drawing + +end GraphMinor.Surface + +namespace GraphMinor.GM11 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +theorem walkDrawing_isSubdrawing (Γ : Drawing S) {u v : S} (W : GraphWalk Γ.toGraph u v) : + (walkDrawing Γ W).IsSubdrawing Γ := + Drawing.span_isSubdrawing Γ _ _ + +theorem walkDrawing_V (Γ : Drawing S) {u v : S} (W : GraphWalk Γ.toGraph u v) : + (walkDrawing Γ W).V = {x | x ∈ W.support} := by + apply subset_antisymm + · rintro x (⟨hx, -⟩ | hx) + · exact hx + · obtain ⟨e, ⟨he, heE⟩, hxe, hxV⟩ := mem_iUnion₂.mp hx + obtain ⟨a, b, hab⟩ := (Γ.toGraph.edge_mem_iff_exists_isLink e).mp heE + have hxab : x ∈ closure e ∩ Γ.V := ⟨hxe, hxV⟩ + rw [hab.2.2.2] at hxab + rcases hxab with rfl | hxab + · exact W.left_mem_support_of_mem_edges he hab + · exact (mem_singleton_iff.mp hxab) ▸ W.left_mem_support_of_mem_edges he hab.symm + · intro x hx + exact Or.inl ⟨hx, W.mem_vertexSet_of_mem_support hx⟩ + +theorem walkDrawing_E (Γ : Drawing S) {u v : S} (W : GraphWalk Γ.toGraph u v) : + (walkDrawing Γ W).E = {e | e ∈ W.edges} := by + rw [walkDrawing, Γ.span_E] + refine inter_eq_left.mpr fun e he => ?_ + induction W with + | nil h => simp at he + | cons h r ih => + rcases List.mem_cons.mp he with rfl | he + · exact h.1 + · exact ih he + +/-- The point set of `Γ | W`: the vertices of `W` and the closures of its edges. -/ +theorem mem_walkDrawing_U (Γ : Drawing S) {u v : S} (W : GraphWalk Γ.toGraph u v) {x : S} : + x ∈ (walkDrawing Γ W).U ↔ x ∈ W.support ∨ ∃ e ∈ W.edges, x ∈ closure e := by + rw [Drawing.U_eq, walkDrawing_V, walkDrawing_E] + simp + +/-- The point set of a concatenated walk is the union of the point +sets of the two walks. -/ +theorem _root_.GraphMinor.Surface.GraphWalk.drawing_U_append + (K : Drawing S) {u v w : S} + (P : GraphWalk K.toGraph u v) (Q : GraphWalk K.toGraph v w) : + (walkDrawing K (P.append Q)).U = (walkDrawing K P).U ∪ (walkDrawing K Q).U := by + ext x + simp only [mem_walkDrawing_U, GraphWalk.mem_support_append, GraphWalk.edges_append, + List.mem_append, mem_union] + constructor + · rintro ((h | h) | ⟨e, (he | he), hxe⟩) + · exact Or.inl (Or.inl h) + · exact Or.inr (Or.inl h) + · exact Or.inl (Or.inr ⟨e, he, hxe⟩) + · exact Or.inr (Or.inr ⟨e, he, hxe⟩) + · rintro ((h | ⟨e, he, hxe⟩) | (h | ⟨e, he, hxe⟩)) + · exact Or.inl (Or.inl h) + · exact Or.inr ⟨e, Or.inl he, hxe⟩ + · exact Or.inl (Or.inr h) + · exact Or.inr ⟨e, Or.inr he, hxe⟩ + +/-- A zero-edge walk has just its vertex as point set. -/ +theorem _root_.GraphMinor.Surface.GraphWalk.drawing_U_nil + (K : Drawing S) {u : S} (hu : u ∈ K.V) : + (walkDrawing K (GraphWalk.nil hu)).U = {u} := by + ext x + simp only [mem_walkDrawing_U, GraphWalk.support, GraphWalk.edges, List.mem_singleton, + List.not_mem_nil, false_and, exists_false, or_false, mem_singleton_iff] + +/-- An edge step adds exactly its edge closure to the point set. -/ +theorem _root_.GraphMinor.Surface.GraphWalk.drawing_U_cons + (K : Drawing S) {u v w : S} {e : Set S} + (hl : K.toGraph.IsLink e u v) (P : GraphWalk K.toGraph v w) : + (walkDrawing K (GraphWalk.cons hl P)).U = closure e ∪ (walkDrawing K P).U := by + have hu : u ∈ closure e := by + have h : u ∈ closure e ∩ K.V := hl.2.2.2.symm ▸ Or.inl rfl + exact h.1 + ext x + simp only [mem_walkDrawing_U, GraphWalk.support, GraphWalk.edges, List.mem_cons, mem_union] + constructor + · rintro ((rfl | h) | ⟨f, (rfl | hf), hxf⟩) + · exact Or.inl hu + · exact Or.inr (Or.inl h) + · exact Or.inl hxf + · exact Or.inr (Or.inr ⟨f, hf, hxf⟩) + · rintro (h | h | ⟨f, hf, hxf⟩) + · exact Or.inr ⟨e, Or.inl rfl, h⟩ + · exact Or.inl (Or.inr h) + · exact Or.inr ⟨f, Or.inr hf, hxf⟩ + +/-- A two-edge region visit has the two edge closures as its whole +point set. -/ +theorem _root_.GraphMinor.Surface.GraphWalk.drawing_U_two_edges + (K : Drawing S) + {u v w : S} {e e' : Set S} (hl : K.toGraph.IsLink e u v) (hl' : K.toGraph.IsLink e' v w) : + (walkDrawing K (GraphWalk.cons hl (GraphWalk.cons hl' (.nil hl'.right_mem)))).U = + closure e ∪ closure e' := by + rw [GraphWalk.drawing_U_cons, GraphWalk.drawing_U_cons, + GraphWalk.drawing_U_nil K (u := w) hl'.right_mem] + have hw : w ∈ closure e' := by + have h : w ∈ closure e' ∩ K.V := hl'.2.2.2.symm ▸ Or.inr rfl + exact h.1 + rw [union_eq_left.mpr (singleton_subset_iff.mpr hw)] + +/-- A walk drawing has a preconnected point set. -/ +theorem _root_.GraphMinor.Surface.GraphWalk.drawing_U_isPreconnected + (Γ : Drawing S) {u v : S} (W : GraphWalk Γ.toGraph u v) : + IsPreconnected (walkDrawing Γ W).U := by + induction W with + | nil ha => + rw [GraphWalk.drawing_U_nil Γ ha] + exact isPreconnected_singleton + | @cons a b c e h R ih => + rw [GraphWalk.drawing_U_cons] + have hclosure : IsPreconnected (closure e) := h.1.2.2.1.isConnected.isPreconnected.closure + have hb : b ∈ closure e ∩ Γ.V := by + rw [h.2.2.2] + exact .inr rfl + exact hclosure.union b hb.1 ((mem_walkDrawing_U Γ R).mpr (.inl R.start_mem_support)) ih + +/-- `Γ | W` is a path, for a simple walk `W`. -/ +theorem walkDrawing_isPathBetween (Γ : Drawing S) {u v : S} {W : GraphWalk Γ.toGraph u v} + (hW : W.IsSimple) : (walkDrawing Γ W).IsPathBetween u v := by + obtain ⟨W', hs, he⟩ := (walkDrawing_isSubdrawing Γ W).exists_walk_down W + (by rw [walkDrawing_V]; exact fun x hx => hx) (by rw [walkDrawing_E]; exact fun e he => he) + refine ⟨W', by unfold GraphWalk.IsSimple; rw [hs]; exact hW, ?_, ?_⟩ + · rw [walkDrawing_V, hs] + · rw [walkDrawing_E, he] + +end GraphMinor.GM11 + +namespace GraphMinor.Surface.Drawing + +open Set Topology GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +/-- Graph Minors XI, Section 4: two paths with the same two ends, with no other common vertex and +no common edge, form a circuit. -/ +theorem isCircuit_sup {Γ P Q : Drawing S} {a b : S} (hP : P.IsPathBetween a b) + (hQ : Q.IsPathBetween a b) (hPs : P.IsSubdrawing Γ) (hQs : Q.IsSubdrawing Γ) (hab : a ≠ b) + (hV : P.V ∩ Q.V = {a, b}) (hE : Disjoint P.E Q.E) : (Γ.sup P Q).IsCircuit := by + obtain ⟨W₁, hW₁, hV₁, hE₁⟩ := hP + obtain ⟨W₂, hW₂, hV₂, hE₂⟩ := hQ + have hl := le_sup_left hPs hQs + have hr := le_sup_right hPs hQs + obtain ⟨X₁, hs₁, he₁⟩ := hl.exists_walk_up W₁ + obtain ⟨X₂, hs₂, he₂⟩ := hr.exists_walk_up W₂.reverse + have hmem₂ : ∀ x, x ∈ X₂.support ↔ x ∈ W₂.support := by + intro x + rw [hs₂, GraphWalk.support_reverse, List.mem_reverse] + have hmemE₂ : ∀ e, e ∈ X₂.edges ↔ e ∈ W₂.edges := by + intro e + rw [he₂, GraphWalk.edges_reverse, List.mem_reverse] + have hsc := GraphWalk.isSimpleClosed_append_of_lifts hW₁ hW₂ hs₁ hs₂ he₁ he₂ + (by simpa only [hV₁, hV₂] using hV) (by simpa only [hE₁, hE₂] using hE) + refine ⟨a, X₁.append X₂, hsc, ?_, ?_, ?_⟩ + · rw [GraphWalk.length_append] + have : X₁.length ≠ 0 := fun h => hab (GraphWalk.eq_of_length_eq_zero h) + omega + · rw [sup_V hPs hQs, hV₁, hV₂] + ext x + simp only [mem_union, mem_ofPred_eq, GraphWalk.mem_support_append, hmem₂, hs₁] + · rw [sup_E hPs hQs, hE₁, hE₂] + ext e + simp only [mem_union, mem_ofPred_eq, GraphWalk.edges_append, List.mem_append, hmemE₂, he₁] + +/-- The two parts of a circuit between two of its vertices. Graph Minors XI, proof of (4.3) +(page 80): "let $P_1$, $P_2$ be the two paths of $C$ between $a$ and $b$". -/ +theorem IsCircuit.exists_two_paths {C : Drawing S} (hC : C.IsCircuit) {a b : S} (ha : a ∈ C.V) + (hb : b ∈ C.V) (hab : a ≠ b) : + ∃ P Q : Drawing S, P.IsPathBetween a b ∧ Q.IsPathBetween a b ∧ P.IsSubdrawing C ∧ + Q.IsSubdrawing C ∧ 0 < P.length ∧ 0 < Q.length ∧ P.V ∩ Q.V = {a, b} ∧ Disjoint P.E Q.E ∧ + C.sup P Q = C := by + obtain ⟨u, W, ⟨hnd, hed⟩, -, hV, hE⟩ := hC + rw [hV] at ha hb + obtain ⟨R₁, R₂, hS₁, hS₂, htail, hedR, hmemRot, hmemE⟩ := + GraphWalk.exists_circuit_split W hnd hed ha hb hab + have hdisjT := List.nodup_append.mp htail + have hedD := List.nodup_append.mp hedR + have hP₀ := walkDrawing_isPathBetween C hS₁ + have hQ₀ := walkDrawing_isPathBetween C hS₂.reverse + have hPs := walkDrawing_isSubdrawing C R₁ + have hQs := walkDrawing_isSubdrawing C R₂.reverse + have hlenpos : ∀ {x y : S} (R : GraphWalk C.toGraph x y), x ≠ y → + 0 < (walkDrawing C R).length := by + intro x y R hxy + have hne : R.edges ≠ [] := by + intro h + have : R.length = 0 := by simp [GraphWalk.length, h] + exact hxy (GraphWalk.eq_of_length_eq_zero this) + obtain ⟨e, he⟩ := List.exists_mem_of_ne_nil _ hne + have hfin : (walkDrawing C R).E.Finite := (walkDrawing C R).finite_edges + refine Set.ncard_pos hfin |>.mpr ⟨e, ?_⟩ + rw [walkDrawing_E] + exact he + refine ⟨_, _, hP₀, hQ₀, hPs, hQs, hlenpos _ hab, hlenpos _ hab, ?_, ?_, ?_⟩ + · rw [walkDrawing_V, walkDrawing_V] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.support_reverse, List.mem_reverse, + mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨h₁, h₂⟩ + rw [R₁.support_eq_cons] at h₁ + rw [R₂.support_eq_cons] at h₂ + rcases List.mem_cons.mp h₁ with h₁ | h₁ + · exact Or.inl h₁ + · rcases List.mem_cons.mp h₂ with h₂ | h₂ + · exact Or.inr h₂ + · exact (hdisjT.2.2 x h₁ x h₂ rfl).elim + · rintro (rfl | rfl) + · exact ⟨R₁.start_mem_support, R₂.end_mem_support⟩ + · exact ⟨R₁.end_mem_support, R₂.start_mem_support⟩ + · rw [walkDrawing_E, walkDrawing_E] + refine disjoint_left.mpr fun e he₁ he₂ => ?_ + simp only [mem_ofPred_eq, GraphWalk.edges_reverse, List.mem_reverse] at he₁ he₂ + exact hedD.2.2 e he₁ e he₂ rfl + · apply ext_of_V_E + · rw [sup_V hPs hQs, walkDrawing_V, walkDrawing_V, hV] + ext x + simp only [mem_union, mem_ofPred_eq, GraphWalk.support_reverse, List.mem_reverse] + rw [← hmemRot x, GraphWalk.mem_support_append] + · rw [sup_E hPs hQs, walkDrawing_E, walkDrawing_E, hE] + ext e + simp only [mem_union, mem_ofPred_eq, GraphWalk.edges_reverse, List.mem_reverse] + rw [← hmemE e, GraphWalk.edges_append, List.mem_append] + +end GraphMinor.Surface.Drawing diff --git a/LeanPool/GraphMinor/GM12/Bridge.lean b/LeanPool/GraphMinor/GM12/Bridge.lean new file mode 100644 index 0000000000..66364672df --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Bridge.lean @@ -0,0 +1,304 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Cited +public import LeanPool.GraphMinor.GM12.Cited +public import LeanPool.GraphMinor.GM16.Cited +public import LeanPool.GraphMinor.GM19.Cited +import LeanPool.GraphMinor.GM12.Section3Theorem +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM12.Section4 +import LeanPool.GraphMinor.GM12.Section4Monotone +import LeanPool.GraphMinor.GM12.Section4Theorem45 +import LeanPool.GraphMinor.GM12.Section4Theorem44 +import LeanPool.GraphMinor.GM12.Section4Theorem43 +import LeanPool.GraphMinor.GM12.Section4DrawnGraph +import LeanPool.GraphMinor.GM12.Section4MetricExistence +import LeanPool.GraphMinor.GM12.Section4SpanControl +import LeanPool.GraphMinor.Minor.Basic +import Mathlib.Data.Fintype.EquivFin + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Graph Minors XII results in later papers + +This file matches XII's proved results to the statements used by later +papers. No other XII file imports it. +-/ + +public section + +namespace GraphMinor.GM12 + +universe u v w + +/-- Graph Minors XII, (3.2), pages 245--248, in the exact form used +by XIX. The boundary conventions agree for each prescribed closed disc. -/ +theorem gm19_theorem32 + : GM19.GM12Theorem32Statement.{u} := by + intro S _ _ hS hConn t z + let : T2Space S := hS.2.1 + let : ConnectedSpace S := hConn + obtain ⟨η, hηpos, hmain⟩ := theorem_3_2_proof hS t z + refine ⟨η, hηpos, ?_⟩ + intro Δ Γ θ T d p Zs hΔ hdis hcount hcover hdisZ hfeasible horder hm hsep hfree + have hb : ∀ i, Surface.subBd (Δ i) = Surface.discBd (Δ i) := fun i => + (GM11.subBd_eq_frontier (Δ i)).trans (GM11.IsClosedDisc.frontier_eq_discBd hS (hΔ i).1) + have hZeq : (⋃ i, Γ.V ∩ Surface.subBd (Δ i)) = discBoundaryVertices Γ Δ := by + simp_rw [hb] + rfl + have hΔ' : ∀ i, Surface.IsClosedDisc (Δ i) ∧ Γ.U ∩ Δ i = Γ.V ∩ Surface.discBd (Δ i) := by + intro i + exact ⟨(hΔ i).1, by simpa only [hb i] using (hΔ i).2⟩ + have hfree' : ∀ i, GM10.IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ Surface.discBd (Δ i)) := by + intro i + simpa only [hb i] using hfree i + have hresult := hmain Δ Γ θ T d p Zs hΔ' hdis (by simpa only [hZeq] using hcount) + (hcover.trans hZeq) hdisZ hfeasible horder hm hsep hfree' + rwa [← hZeq] at hresult + +/-- Graph Minors XII, (4.1), page 248, in the exact form used by XV. -/ +theorem gm15_theorem41 : GM15.GM12Theorem41Statement.{u} := by + exact @theorem_4_1_proof + +open Set Graph Hypergraph + +private theorem clique_inc {p : ℕ} {x y z : Fin p} (hxy : x ≠ y) : + (GM16.completeGraph p).Inc s(x, y) z ↔ z = x ∨ z = y := by + constructor + · rintro ⟨w, _, heq⟩ + rcases Sym2.eq_iff.mp heq with ⟨h, _⟩ | ⟨_, h⟩ + · exact Or.inl h.symm + · exact Or.inr h.symm + · rintro (rfl | rfl) + · exact ⟨y, hxy, rfl⟩ + · exact ⟨x, hxy.symm, Sym2.eq_swap⟩ + +/-- Every finite multigraph is a minor of a finite complete graph. Use a +central vertex for each target vertex and two separate end vertices for +each target edge. The branches are stars at their central vertices. This +also represents loops and parallel edges. -/ +private theorem exists_completeGraph_minor {γ δ : Type*} (L : Graph γ δ) + (hV : L.vertexSet.Finite) (hE : L.edgeSet.Finite) : + ∃ p : ℕ, 1 ≤ p ∧ IsIsoMinor L (GM16.completeGraph p) := by + classical + let : Fintype L.vertexSet := hV.fintype + let : Fintype L.edgeSet := hE.fintype + let I := L.vertexSet ⊕ (L.edgeSet × Bool) + let p := Fintype.card I + 1 + let tag : I → Fin p := fun z => ⟨(Fintype.equivFin I z).val, + Nat.lt_succ_of_lt (Fintype.equivFin I z).isLt⟩ + have htag : Function.Injective tag := by + intro x y h + have hval : (Fintype.equivFin I x).val = (Fintype.equivFin I y).val := + congrArg (fun z : Fin p => z.val) h + exact (Fintype.equivFin I).injective (Fin.ext hval) + have hend : ∀ e : L.edgeSet, ∃ x y, L.IsLink e.val x y := fun e => + L.exists_isLink_of_mem_edgeSet e.property + choose left right hlink using hend + let owner : I → γ := Sum.elim Subtype.val (fun t => if t.2 then right t.1 else left t.1) + let core (v : L.vertexSet) : Fin p := tag (Sum.inl v) + let port (e : L.edgeSet) (b : Bool) : Fin p := tag (Sum.inr (e, b)) + let a : γ → Set (Fin p) := fun v => tag '' {z | owner z = v} + let b : δ → Sym2 (Fin p) := fun e => if he : e ∈ L.edgeSet then + s(port ⟨e, he⟩ false, port ⟨e, he⟩ true) else s(⟨0, Nat.zero_lt_succ _⟩, ⟨0, Nat.zero_lt_succ + _⟩) + have hmem : ∀ z v, tag z ∈ a v ↔ owner z = v := by + intro z v + constructor + · rintro ⟨w, hw, heq⟩ + exact htag heq ▸ hw + · intro hz + exact ⟨z, hz, rfl⟩ + have hport : ∀ e : L.edgeSet, port e false ≠ port e true := by + intro e heq + have := htag heq + let portSide : I → Bool + | .inl _ => false + | .inr t => t.2 + exact Bool.false_ne_true (congrArg portSide this) + have hcore : ∀ v : L.vertexSet, ∀ e : L.edgeSet, ∀ k, core v ≠ port e k := by + intro v e k heq + exact Sum.inl_ne_inr (htag heq) + have hdisj : ∀ u ∈ L.vertexSet, ∀ v ∈ L.vertexSet, u ≠ v → Disjoint (a u) (a v) := by + intro u _ v _ huv + apply Set.disjoint_left.mpr + rintro x ⟨z, hz, rfl⟩ hx + exact huv (hz.symm.trans ((hmem z v).mp hx)) + have hb : ∀ e (he : e ∈ L.edgeSet), b e = s(port ⟨e, he⟩ false, port ⟨e, he⟩ true) := + fun e he => dite_eq_left he + have hinc : ∀ e (he : e ∈ L.edgeSet) v, + (∃ x ∈ a v, (GM16.completeGraph p).Inc (b e) x) ↔ + v = left ⟨e, he⟩ ∨ v = right ⟨e, he⟩ := by + intro e he v + rw [hb e he] + simp only [clique_inc (hport ⟨e, he⟩)] + constructor + · rintro ⟨x, hx, rfl | rfl⟩ + · exact Or.inl ((hmem _ v).mp hx).symm + · exact Or.inr ((hmem _ v).mp hx).symm + · rintro (rfl | rfl) + · exact ⟨port ⟨e, he⟩ false, (hmem _ _).mpr rfl, Or.inl rfl⟩ + · exact ⟨port ⟨e, he⟩ true, (hmem _ _).mpr rfl, Or.inr rfl⟩ + have hm : IsMinorModel L (GM16.completeGraph p) a b := by + refine { + vertex_nonempty := ?_ + vertex_subset := fun _ _ _ _ => mem_univ _ + edge_mem := ?_ + vertex_disjoint := hdisj + edge_injOn := ?_ + inc_iff := ?_ + isLoopAt_iff := ?_ + connected := ?_ } + · intro v hv + exact ⟨core ⟨v, hv⟩, (hmem _ _).mpr rfl⟩ + · intro e he + rw [hb e he] + exact ⟨_, _, hport ⟨e, he⟩, rfl⟩ + · intro e he f hf hef + rw [hb e he, hb f hf] at hef + rcases Sym2.eq_iff.mp hef with ⟨h, _⟩ | ⟨h, _⟩ + · have h' := htag h + exact congrArg (fun z : I => match z with | .inl _ => e | .inr t => t.1.val) h' + · have h' := htag h + exact congrArg (fun z : I => match z with | .inl _ => e | .inr t => t.1.val) h' + · intro v _ e he + rw [hinc e he] + constructor + · intro hv + exact hv.eq_or_eq_of_isLink (hlink ⟨e, he⟩) + · rintro (rfl | rfl) + · exact (hlink ⟨e, he⟩).inc_left + · exact (hlink ⟨e, he⟩).inc_right + · intro v _ e he + rw [hb e he] + constructor + · intro hl x hx + have hl' := hlink ⟨e, he⟩ + have hlv := hl.eq_of_inc hl'.inc_left + have hrv := hl.eq_of_inc hl'.inc_right + rcases (clique_inc (hport ⟨e, he⟩)).mp hx with rfl | rfl + · exact (hmem _ _).mpr hlv.symm + · exact (hmem _ _).mpr hrv.symm + · intro hall + have hlv := (hmem _ v).mp (hall _ ((clique_inc (hport ⟨e, he⟩)).mpr (Or.inl rfl))) + have hrv := (hmem _ v).mp (hall _ ((clique_inc (hport ⟨e, he⟩)).mpr (Or.inr rfl))) + change left ⟨e, he⟩ = v at hlv + change right ⟨e, he⟩ = v at hrv + have hl := hlink ⟨e, he⟩ + rw [hlv, hrv] at hl + exact hl + · intro v hv + let K := ((GM16.completeGraph p).induce (a v)).deleteEdges (b '' L.edgeSet) + have hcm : core ⟨v, hv⟩ ∈ a v := (hmem _ _).mpr rfl + have hreach : ∀ x ∈ a v, Relation.ReflTransGen K.Adj x (core ⟨v, hv⟩) ∧ + Relation.ReflTransGen K.Adj (core ⟨v, hv⟩) x := by + intro x hx + by_cases hxc : x = core ⟨v, hv⟩ + · subst x + exact ⟨.refl, .refl⟩ + have hn : s(x, core ⟨v, hv⟩) ∉ b '' L.edgeSet := by + rintro ⟨e, he, heq⟩ + rw [hb e he] at heq + rcases Sym2.eq_iff.mp heq with ⟨_, h⟩ | ⟨h, _⟩ + · exact hcore ⟨v, hv⟩ ⟨e, he⟩ true h.symm + · exact hcore ⟨v, hv⟩ ⟨e, he⟩ false h.symm + have hadj : K.Adj x (core ⟨v, hv⟩) := ⟨s(x, core ⟨v, hv⟩), ⟨⟨hxc, rfl⟩, hx, hcm⟩, hn⟩ + exact ⟨.single hadj, .single hadj.symm⟩ + refine ⟨K, ?_, rfl, ⟨core ⟨v, hv⟩, hcm⟩, ?_⟩ + · exact ⟨subset_univ _, fun _ _ _ h => ⟨h.1.1, h.2⟩⟩ + · intro x hx y hy + exact (hreach x hx).1.trans (hreach y hy).2 + refine ⟨p, Nat.succ_le_succ (Nat.zero_le _), ?_⟩ + exact isIsoMinor_of_isMinorModel L (GM16.completeGraph p) hV hE + (Set.toFinite _) (Set.toFinite _) a b hm + +/-- The finite-graph consequence of XII (4.2) used by XVI, with exactly +the cited conclusion. A sufficiently large complete graph contains the +given finite multigraph as a minor. -/ +theorem gm16_theorem42 : GM16.GM12Theorem42Statement.{u, v} := by + intro γ δ L hV hE + obtain ⟨p, hp, hminor⟩ := exists_completeGraph_minor L hV hE + refine ⟨p, ?_⟩ + intro α β G θ T hT hc + have : NeZero p := ⟨Nat.ne_zero_of_lt hp⟩ + have : Nonempty (Fin p) := ⟨⟨0, hp⟩⟩ + have hc' := hc + obtain ⟨_, b, _⟩ := hc' + let : Nonempty β := ⟨b s((0 : Fin p), 0)⟩ + exact theorem_4_2_proof hT.finite_V hT.finite_E (Set.toFinite _) (Set.toFinite _) hminor hc + +/-- XII (4.3), pages 249--251, with exactly the span conclusion +cited by XVI. The drawing embedding transfers every branch and +joining edge, and the controlling-tangle condition transfers the +small-side exclusion. The cited hypotheses are VII (7.5), (5.1), +and (5.5). -/ +theorem gm16_theorem43 + : GM16.GM12Theorem43Statement.{u, v, w} := by + intro S _ _ α' β' L hS hConn hVL hEL hdraw + let : ConnectedSpace S := hConn + obtain ⟨ν, edgeOf, hν, hline, hloop, hmeet, hon⟩ := hdraw + obtain ⟨D, _, _⟩ := exists_graphDrawing_of_edge_curves L hVL hEL ν edgeOf hν hline hloop hmeet hon + obtain ⟨N, hN, hmain⟩ := theorem_4_3_drawing hS D + refine ⟨N, hN, ?_⟩ + intro α β G θstar Tstar H η θ T hTstar hNo hθ hSpan + obtain ⟨d, hd⟩ := exists_metric_of_respectful_drawing_tangle hS hSpan.isRespectful + have hc := hmain H θ T d hd hθ + exact hNo (controlsMinor_of_controlling_drawing_tangle η hSpan.isControlling hc) + +/-- XII (4.4), pages 251--252, with exactly the span conclusion +cited by XVI. All branch, path, feasibility, and control steps are +proved; the statement hypotheses are VII (7.5), (5.1), and (5.5). -/ +theorem gm16_theorem44 + : GM16.GM12Theorem44Statement.{u, v, w} := by + intro S _ _ hS hConn p + let : ConnectedSpace S := hConn + obtain ⟨N, hN, hmain⟩ := theorem_4_4_span hS p + refine ⟨N, hN, ?_⟩ + dsimp only + intro α β G θstar θ Tstar H η T d s t P hSpan hm hθ hends hs ht hdisj hfar hP hPP + exact hmain G θstar θ Tstar H η T d s t P hSpan.isControlling hm hθ hends hs ht hdisj hfar hP hPP + +/-- Graph Minors XII (4.5), pages 252--253, in the exact independent-eye +span form used by XV. The only statement hypotheses are the cited +VII (7.5), (5.1), and (5.5). -/ +theorem gm15_theorem45 + : GM15.GM12Theorem45Statement.{u, v, w} := by + intro S _ _ hS hConn p + let : ConnectedSpace S := hConn + obtain ⟨k, N, hN, hmain⟩ := theorem_4_5_span hS p + refine ⟨k, N, ?_⟩ + intro α β G θstar Tstar H η θ T d hSpan hm hpθ hNθ heyes + obtain ⟨r, P, Q, hri, heye, hdist, hdisj⟩ := heyes + have hfar : ∀ i j, i ≠ j → N ≤ d (r i) (r j) := by + intro i j hij + rw [hdist i j hij] + exact hNθ + exact hmain G θstar θ Tstar H η T d hSpan.isControlling hm hNθ r P Q hri heye hfar hdisj + +/-- Unconditional proof of `GM19.GM12Theorem32Statement`. -/ +theorem gm19_theorem32_proved : GM19.GM12Theorem32Statement.{u} := + gm19_theorem32 + +/-- Unconditional proof of `GM16.GM12Theorem43Statement`. -/ +theorem gm16_theorem43_proved : GM16.GM12Theorem43Statement.{u, v, w} := + gm16_theorem43 + +/-- Unconditional proof of `GM16.GM12Theorem44Statement`. -/ +theorem gm16_theorem44_proved : GM16.GM12Theorem44Statement.{u, v, w} := + gm16_theorem44 + +/-- Unconditional proof of `GM15.GM12Theorem45Statement`. -/ +theorem gm15_theorem45_proved : GM15.GM12Theorem45Statement.{u, v, w} := + gm15_theorem45 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Cited.lean b/LeanPool/GraphMinor/GM12/Cited.lean new file mode 100644 index 0000000000..470b074593 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Cited.lean @@ -0,0 +1,114 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Cited +public import LeanPool.GraphMinor.GM07.Defs + +/-! +# Earlier results used for distance and connecting subdrawings + +The closed-walk restraint theorem is cited in its original form. The statement of XI (8.12) +is already kept in `GM14.Cited` and is used from there. VII (7.5) is +kept over its original proper graphs and forests for the reduction in XII (3.1). +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set GraphMinor.Surface GraphMinor.GM11 + +universe u + +/-- Graph Minors XI, (8.5), page 97: +"Let $W$ be a closed walk in $\Gamma$ of length $< 2\theta$. Then $\mathrm{ins}(W)$ is a +restraint and $l(\mathrm{ins}(W)) \le l(W)$." -/ +def GM11Theorem85Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ (Γ : Drawing S) (two_theta : ℕ) (ins : Drawing S → Set S), + IsSlope Γ two_theta ins → + ∀ (u : S) (W : GraphWalk Γ.toGraph u u), W.length < two_theta → + IsRestraint Γ ins two_theta (insWalk ins Γ W) ∧ + perimeterWalkLength Γ (insWalk ins Γ W) ≤ W.length + + +/-- Graph Minors XI, (8.13), page 103: +"Let $a, b \in \Sigma$ with $\{a, b\} \cap U(\Gamma) \subseteq V(\Gamma)$; and let $X$ be a +restraint with $a, b \in X$. Suppose that there is no restraint $Y$ with $X \subseteq Y$ and +$l(Y) < l(X)$. Then $X$ includes an $a, b$-optimal restraint." -/ +def GM11Theorem813Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ (Γ : Drawing S) (two_theta : ℕ) (ins : Drawing S → Set S), + IsSlope Γ two_theta ins → + ∀ (a b : S) (X : Set S), {a, b} ∩ Γ.U ⊆ Γ.V → + IsRestraint Γ ins two_theta X → a ∈ X → b ∈ X → + (∀ Y : Set S, IsRestraint Γ ins two_theta Y → X ⊆ Y → + ¬ perimeterWalkLength Γ Y < perimeterWalkLength Γ X) → + ∃ Y : Set S, Y ⊆ X ∧ IsOptimalRestraint Γ ins two_theta a b Y + +/-- Graph Minors XI, (7.2), page 93: +"If $\Sigma$ is a connected surface, $Z \subseteq \Sigma$, and $F \subseteq Z$ is an $O$-arc +null-homotopic in $Z$, then $F$ bounds a disc $\Delta \subseteq Z$." -/ +def GM11Theorem72Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ Z F : Set S, IsOArc F → F ⊆ Z → IsNullHomotopicOArcIn Z F → + ∃ Δ : Set S, Δ ⊆ Z ∧ IsClosedDisc Δ ∧ subBd Δ = F + +/-- Graph Minors VII, (7.5), page 240: +"Let $\Sigma \cong \Sigma(a, b, c)$, where $3a + 3b + c \ge 3$. Let $k \ge 0$ be an integer, +and let $v = v(\Sigma(a, b, c+1), k)$. Let $G$ be a boundary-linked proper graph in $\Sigma$ +with $\alpha(G) \ge 42kv$ and with $|V(G) \cap bd(\Sigma)| \le 2k - 2c - 2$. Let $H$ be a +forest in $\Sigma$ with $V(G) \cap bd(\Sigma) = V(H) \cap bd(\Sigma)$. Then $H$ is +$G$-feasible." +The boundary-count inequality is written with addition so that natural +subtraction does not allow a negative upper bound. -/ +def GM07Theorem75Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsSurface S → + ∀ a b c : ℕ, 3 ≤ 3 * a + 3 * b + c → Nonempty (S ≃ₜ SurfaceModel a b c) → + ∀ k : ℕ, ∀ G : Drawing S, G.IsProper → GM07.IsBoundaryLinked G → + 42 * k * GM07.vModel a b (c + 1) k ≤ GM07.alpha G → + (G.V ∩ bd S).ncard + 2 * c + 2 ≤ 2 * k → + ∀ H : Drawing S, GM07.IsSurfaceForest H → G.V ∩ bd S = H.V ∩ bd S → + GM07.IsGFeasible G H + +/-- Graph Minors VII, (5.1), page 230: +"If $\Sigma$ is connected and $X \subseteq \Sigma$ is solid and $X \ne \Sigma$, then $X$ is +planar if and only if every $O$-arc included in $X$ is null-homotopic." -/ +def GM07Theorem51Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S], IsSurface S → ConnectedSpace S → + ∀ X : Set S, IsSolid X → X ≠ univ → + (IsPlanar X ↔ ∀ F : Set S, IsOArc F → F ⊆ X → IsNullHomotopicOArc F) + +/-- Graph Minors VII, (5.2), page 230: +"If $X \subseteq \Sigma$ is solid and $X$ is planar in $\Sigma + \hat{C}$, where $C$ is a +cuff, then $X$ surrounds $C$ in $\Sigma$ if and only if some $O$-arc included in $X$ +surrounds $C$." -/ +def GM07Theorem52Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S], IsSurface S → + ∀ C X : Set S, IsCuff C → IsSolid X → GM07.IsPlanarInCappedCuff C X → + (GM07.SurroundsCuff X C ↔ + ∃ F : Set S, IsOArc F ∧ F ⊆ X ∧ GM07.SurroundsCuff F C) + +/-- Graph Minors VII, (5.5), page 231: +"Let $G$ be a proper graph in a connected surface $\Sigma$, and let $Z$ be the closure of the +union of some of the regions of $G$, with $Z \ne \Sigma$. Then $Z$ is planar if and only if +every $G$-normal $O$-arc included in $Z$ is null-homotopic." -/ +def GM07Theorem55Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S], IsSurface S → ConnectedSpace S → + ∀ G : Drawing S, G.IsProper → ∀ R : Set (Set S), R ⊆ G.R → + closure (⋃₀ R) ≠ univ → + (IsPlanar (closure (⋃₀ R)) ↔ + ∀ F : Set S, G.IsNormal F → IsOArc F → F ⊆ closure (⋃₀ R) → IsNullHomotopicOArc F) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Defs.lean b/LeanPool/GraphMinor/GM12/Defs.lean new file mode 100644 index 0000000000..83b6de75ac --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Defs.lean @@ -0,0 +1,284 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.GM10.Defs + +/-! +# Definitions of Graph Minors XII + +This file formalizes the definitions of N. Robertson and P. D. Seymour, *Graph Minors. XII. Distance +on a surface*, J. Combin. Theory Ser. B 64 (1995) 240–272. Everything is stated over the actual +drawings of `GraphMinor/Surface/Defs.lean`. + +Graph Minors XIV restates the definitions of Section 1 of this paper, and the project keeps one copy +of them, in `GraphMinor/GM14/Defs.lean`. We use those directly: + +- A respectful tangle is `GM14.IsRespectfulDrawingTangle`, or its parts `GM10.IsTangle` and + `GM11.PaintingOrDrawing.IsRespectful` for a drawing that need not be 2-cell, as in Section 5. +- The metric of a respectful tangle is `GM14.HasTangleMetric`, built from `GM14.tangleMetric`, which + is `d(a(c₁), a(c₂))` of the paper. The paper's distance is half the length of a closed walk of a + bipartite drawing, and so it is an integer. +- The radial drawing is `GM11.PaintingOrDrawing.IsRadialDrawing`, the definition of Graph Minors XI. + This paper replaces the last two conditions of that definition by: "for every $v \in V(\Gamma)$, + the edges + of $K \cup \Gamma$ incident with $v$ belong alternately to $\Gamma$ and to $K$ (in their cyclic + order around + $v$)". When `E(Γ) ≠ ∅` both say that each corner of `Γ` at `v` holds exactly one edge of `K`. +- Free sets are `GM10.IsFreeSet`. + +This file adds the rest: + +- **Section 2:** the length of a closed curve (`curveLength`) and its traces (`IsTrace`). +- **Section 3:** the statement (*) (`HasConnectingSubdrawings`) and the feasibility condition + (`IsTopologicallyFeasible`). +- **Section 4:** the tangle in `G` induced by a tangle in a subgraph (`inducedBySubgraph`) and + control + of a minor (`ControlsMinor`). +- **Section 5:** the cut of a surface along `O`-arcs and its capped side (`IsCappedSplit`), handles + and crosscaps (`IsHandleSplit`, `IsCrosscapSplit`), `Γ ∩ Σ̂₁` (`IsCappedDrawing`), and the tangle + induced across the cut (`inducedAcross`). +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 Hypergraph + +universe u v + +section Main + +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +/-! ## Section 2 -/ + +/-- The closed curve `φ : S¹ → Σ` as a function of the real parameter `t`, with period `1`. -/ +noncomputable def periodicCurve (φ : C(Circle, S)) : ℝ → S := + fun t => φ (Circle.exp (2 * Real.pi * t)) + +/-- The *length* of `φ` with respect to `Γ` (Graph Minors XII, Section 2, page 243): "If $\{x \in +S^1 \colon \phi(x) \in U(\Gamma)\}$ is finite, we call its cardinality the +*length* of $\phi$" -/ +noncomputable def curveLength (Γ : Drawing S) (φ : C(Circle, S)) : ℕ := + {x | φ x ∈ Γ.U}.ncard + +/-- `φ` has finite length, with `|φ|` `Γ`-normal: the setting of the definition of a trace (Graph +Minors XII, Section 2, page 243). -/ +def IsNormalCurve (Γ : Drawing S) (φ : C(Circle, S)) : Prop := + {x | φ x ∈ Γ.U}.Finite ∧ Γ.IsNormal (range φ) + +/-- The curve `ξ` follows `f` on `[h, c]` for its first part, and then traces the edge `e` of `K` to +`w`. This is `φ_e` of the definition of a trace (Graph Minors XII, Section 2, page 243): "the +restriction of $\phi$ to the portion of $I_{i-1}$ between $h$ and $x_i$, concatenated +with a curve tracing $e$ from $v_{2i}$ to $v_{2i-1}$". -/ +def IsEntryCurve (f : ℝ → S) (h c : ℝ) (e : Set S) (w : S) (ξ : Curve S) : Prop := + ∃ s : unitInterval, 0 < s ∧ s < 1 ∧ + (∀ t : unitInterval, t ≤ s → ξ t = f (h + t.1 / s.1 * (c - h))) ∧ + InjOn ξ (Ioo s 1) ∧ ξ '' Ioo s 1 = e ∧ ξ 1 = w + +/-- The edge `e`, from the vertex `v` to the point `w` of the region `r`, *enters `v` in the same +way +as* `f` on `(a, c)`, with `f(c) = v` (Graph Minors XII, Section 2, page 243, (iii)): "choose $h \in +I_{i-1}$ ... $\phi_e$ is homotopic in $r_{2i-1} \cup \{v_{2i}\}$ to a curve in +$r_{2i-1}$". The paper +says that the choice of `h` does not matter. -/ +def EntersLike (f : ℝ → S) (a c : ℝ) (e r : Set S) (v w : S) : Prop := + ∃ h ∈ Ioo a c, ∃ ξ ρ : Curve S, IsEntryCurve f h c e w ξ ∧ range ρ ⊆ r ∧ + CurvesHomotopicIn (r ∪ {v}) ξ ρ + +/-- The edge `e` *leaves `v` in the same way as* `f` on `(a, c)`, with `f(a) = v` (Graph Minors XII, +Section 2, page 243, (iv)): this is (iii) for the curve run backwards. -/ +def LeavesLike (f : ℝ → S) (a c : ℝ) (e r : Set S) (v w : S) : Prop := + EntersLike (fun t => f (-t)) (-c) (-a) e r v w + +/-- The closed walk from `u` to `v` of `K` follows `f` from `a` to `b`, in steps of two edges: each +step of the walk goes from a vertex of `Γ` at parameter `a` through the vertex `w` of `K` in a +region +`r` of `Γ` to a vertex of `Γ` at parameter `c`, where `f` maps `(a, c)` into `r`. -/ +def TraceSteps (Γ K : Drawing S) (f : ℝ → S) : (a b : ℝ) → {u v : S} → + GraphWalk K.toGraph u v → Prop + | a, b, u, _, .nil _ => a = b ∧ f a = u ∧ u ∈ Γ.V + | _, _, _, _, .cons _ (.nil _) => False + | a, b, u, _, .cons (e := e) (v := w) _ (.cons (e := e') (v := x) _ rest) => + ∃ c, a < c ∧ f a = u ∧ u ∈ Γ.V ∧ f c = x ∧ w ∈ K.V ∧ ∃ r ∈ Γ.R, w ∈ r ∧ + (∀ t ∈ Ioo a c, f t ∈ r) ∧ LeavesLike f a c e r u w ∧ EntersLike f a c e' r x w ∧ + TraceSteps Γ K f c b rest + +/-- `W` is a *trace* of `φ` in `K` (Graph Minors XII, Section 2, page 243). Here `φ` has finite +length and `|φ|` is `Γ`-normal. If `φ` has length `0`, "its only trace is the zero-edge walk with +one vertex $v$, where $v \in V(K)$ is the vertex +of $K$ in the region of $\Gamma$ including $|\phi|$". If `φ` has +length `n > 0`, then `W` has `2n` edges, and is built from the points `x₁, …, x_n` of `S¹` that `φ` +maps to `V(Γ)`, in their order on the circle, as in `TraceSteps`. In the paper, (ii) reads "the +region of $\Gamma$ including $\{\phi(x) \colon x \in I_i", but `I_i` lies between `x_i` and +`x_{i+1}` and (iii) uses +`I_{i-1}` for the same region, so (ii) must be read with `I_{i-1}`, and this is what we state. -/ +def IsTrace (Γ K : Drawing S) (φ : C(Circle, S)) {u : S} (W : GraphWalk K.toGraph u u) : Prop := + IsNormalCurve Γ φ ∧ + ((curveLength Γ φ = 0 ∧ W.length = 0 ∧ u ∈ K.V ∧ ∃ r ∈ Γ.R, range φ ⊆ r ∧ u ∈ r) ∨ + (0 < curveLength Γ φ ∧ W.length = 2 * curveLength Γ φ ∧ + ∃ a, TraceSteps Γ K (periodicCurve φ) a (a + 1) W)) + +/-! ## Section 3 -/ + +/-- A subdrawing is *connected*: any two of its vertices are joined by a walk. -/ +def IsConnectedDrawing (H : Drawing S) : Prop := + ∀ a ∈ H.V, ∀ b ∈ H.V, Nonempty (GraphWalk H.toGraph a b) + +/-- The statement (*) (Graph Minors XII, Section 3, page 245): "There are mutually disjoint, +connected subdrawings $H_1, \dots, H_p$ of $\Gamma$ with +$V(H_j) \cap Z = Z_j$ $(1 \le j \le p)$." -/ +def HasConnectingSubdrawings (Γ : Drawing S) {p : ℕ} (Z : Set S) (Zs : Fin p → Set S) : Prop := + ∃ H : Fin p → Drawing S, (∀ j, (H j).IsSubdrawing Γ) ∧ (∀ j, IsConnectedDrawing (H j)) ∧ + (∀ i j, i ≠ j → Disjoint (H i).V (H j).V) ∧ ∀ j, (H j).V ∩ Z = Zs j + +/-- The *topological feasibility condition* (Graph Minors XII, Section 3, page 245): "There exist +mutually disjoint closed discs $D_1, \dots, D_p \subseteq \Sigma$ such that +$$D_j \cap (\Delta_1 \cup \dots \cup \Delta_t) = Z_j \quad (1 \le j \le p).$$" -/ +def IsTopologicallyFeasible {t p : ℕ} (Δ : Fin t → Set S) (Zs : Fin p → Set S) : Prop := + ∃ D : Fin p → Set S, (∀ j, IsClosedDisc (D j)) ∧ (∀ i j, i ≠ j → Disjoint (D i) (D j)) ∧ + ∀ j, D j ∩ ⋃ i, Δ i = Zs j + +/-! ## Section 5 -/ + +/-- The closed annulus `1 ≤ x² + y² ≤ 2` of the definition of a handle. -/ +def ClosedAnnulus : Set EuclideanPlane := + {p | 1 ≤ p 0 ^ 2 + p 1 ^ 2 ∧ p 0 ^ 2 + p 1 ^ 2 ≤ 2} + +/-- The Möbius band: the square `[0, 1] × [0, 1]` with `(0, y)` glued to `(1, 1 - y)`. -/ +abbrev mobiusSetoid : Setoid (unitInterval × unitInterval) := Surface.mobiusSetoid + +/-- The data of (5.3) (Graph Minors XII, Section 5, pages 254–255): +"Let $\Sigma$ be a connected surface, and let $C_1, \dots, C_t$ be mutually disjoint $O$-arcs in +$\Sigma$. Let $\Sigma_1, \Sigma_2$ be 2-manifolds with boundary, such that +$\Sigma_1 \cup \Sigma_2 = \Sigma$ and +$$\Sigma_1 \cap \Sigma_2 = bd(\Sigma_1) = bd(\Sigma_2) = C_1 \cup \dots \cup C_t.$$ +Let $\hat{\Sigma}_1$ be a surface with $\Sigma_1 \subseteq \hat{\Sigma}_1$, such that each $C_i$ +bounds an open disc $D_i \subseteq \hat{\Sigma}_1$, and $D_1, \dots, D_t$ are mutually disjoint, +and $\hat{\Sigma}_1 - \Sigma_1 = D_1 \cup \dots \cup D_t$." The surface `Σ̂₁` is another space `T`, +and `ι` is the inclusion `Σ₁ ⊆ Σ̂₁`, a topological embedding. -/ +structure IsCappedSplit {T : Type v} [TopologicalSpace T] {t : ℕ} (C : Fin t → Set S) + (P₁ P₂ : Set S) (ι : P₁ → T) (D : Fin t → Set T) : Prop where + /-- `Σ` is a connected surface. -/ + surface : IsClosedSurface S ∧ ConnectedSpace S + /-- Each `C_i` is an `O`-arc. -/ + isOArc : ∀ i, IsOArc (C i) + /-- The `C_i` are mutually disjoint. -/ + disjoint : ∀ i j, i ≠ j → Disjoint (C i) (C j) + /-- `Σ₁` is a 2-manifold with boundary. -/ + manifold₁ : IsSurface P₁ + /-- `Σ₂` is a 2-manifold with boundary. -/ + manifold₂ : IsSurface P₂ + /-- `Σ₁ ∪ Σ₂ = Σ`. -/ + union : P₁ ∪ P₂ = univ + /-- `Σ₁ ∩ Σ₂ = C₁ ∪ ⋯ ∪ C_t`. -/ + inter : P₁ ∩ P₂ = ⋃ i, C i + /-- `bd(Σ₁) = C₁ ∪ ⋯ ∪ C_t`. -/ + bd₁ : (↑) '' bd P₁ = ⋃ i, C i + /-- `bd(Σ₂) = C₁ ∪ ⋯ ∪ C_t`. -/ + bd₂ : (↑) '' bd P₂ = ⋃ i, C i + /-- `Σ̂₁` is a surface. -/ + surface_hat : IsClosedSurface T + /-- The inclusion `Σ₁ ⊆ Σ̂₁`. -/ + isEmbedding : IsEmbedding ι + /-- Each `D_i` is an open disc. -/ + isOpenDisc : ∀ i, IsOpenDisc (D i) + /-- Each `C_i` bounds `D_i`. -/ + bounds : ∀ i, subBd (D i) = ι '' ((↑) ⁻¹' C i) + /-- The `D_i` are mutually disjoint. -/ + disjoint_D : ∀ i j, i ≠ j → Disjoint (D i) (D j) + /-- `Σ̂₁ − Σ₁ = D₁ ∪ ⋯ ∪ D_t`. -/ + compl : (range ι)ᶜ = ⋃ i, D i + +/-- `Σ₂` is a *handle* of `Σ` (Graph Minors XII, Section 5, page 254): +"If $t = 2$, $\hat{\Sigma}_1$ is connected, and $\Sigma_2$ is homeomorphic to +$\{(x, y) \colon 1 \le x^2 + y^2 \le 2\}$ we say $\Sigma_2$ is a handle of $\Sigma$." -/ +def IsHandleSplit {T : Type v} [TopologicalSpace T] (C : Fin 2 → Set S) (P₁ P₂ : Set S) + (ι : P₁ → T) (D : Fin 2 → Set T) : Prop := + IsCappedSplit C P₁ P₂ ι D ∧ ConnectedSpace T ∧ Nonempty (P₂ ≃ₜ ClosedAnnulus) + +/-- `Σ₂` is a *crosscap* of `Σ` (Graph Minors XII, Section 5, page 254): +"if $t = 1$, $\hat{\Sigma}_1$ is connected, and $\Sigma_2$ is homeomorphic to a Möbius band, we say +that $\Sigma_2$ is a crosscap of $\Sigma$." -/ +def IsCrosscapSplit {T : Type v} [TopologicalSpace T] (C : Fin 1 → Set S) (P₁ P₂ : Set S) + (ι : P₁ → T) (D : Fin 1 → Set T) : Prop := + IsCappedSplit C P₁ P₂ ι D ∧ ConnectedSpace T ∧ Nonempty (P₂ ≃ₜ Quotient mobiusSetoid) + +/-- `Γ₁` is `Γ ∩ Σ̂₁` (Graph Minors XII, Section 5, page 255), a drawing in `Σ̂₁`: its point set and +vertex set are those of `Γ` in `Σ₁`, moved by the inclusion `ι`. -/ +def IsCappedDrawing {T : Type v} [TopologicalSpace T] {P₁ : Set S} (ι : P₁ → T) (Γ : Drawing S) + (Γ₁ : Drawing T) : Prop := + Γ₁.U = ι '' ((↑) ⁻¹' Γ.U) ∧ Γ₁.V = ι '' ((↑) ⁻¹' Γ.V) + +/-- The tangle in `Γ` induced by a tangle `𝒯₁` in `Γ ∩ Σ̂₁` (Graph Minors XII, Section 5, pages +253–255; the definition is on page 248): the separations `(A, B)` of `Γ` of order `< θ` such that +`(A ∩ Γ₁, B ∩ Γ₁) ∈ 𝒯₁`. The drawing `Γ₁` lives in another space, so `A ∩ Γ₁` is compared with a +member of +`𝒯₁` through the inclusion `ι`: same vertices and same edges of `Γ₁`, moved by `ι`. -/ +def inducedAcross {T : Type v} [TopologicalSpace T] {P₁ : Set S} (ι : P₁ → T) (Γ : Drawing S) + (Γ₁ : Drawing T) (θ : ℕ) (𝒯₁ : Set (Hypergraph T (Set T) × Hypergraph T (Set T))) : + Set (Hypergraph S (Set S) × Hypergraph S (Set S)) := + {p | Γ.toHypergraph.IsSeparation p.1 p.2 ∧ separationOrder p.1 p.2 < θ ∧ + ∃ q ∈ 𝒯₁, + q.1.vertexSet = ι '' ((↑) ⁻¹' p.1.vertexSet) ∧ q.2.vertexSet = ι '' ((↑) ⁻¹' p.2.vertexSet) ∧ + (∀ e ∈ Γ₁.E, e ∈ q.1.edgeSet ↔ ∃ f ∈ p.1.edgeSet, e = ι '' ((↑) ⁻¹' f)) ∧ + (∀ e ∈ Γ₁.E, e ∈ q.2.edgeSet ↔ ∃ f ∈ p.2.edgeSet, e = ι '' ((↑) ⁻¹' f))} + +end Main + +/-! ## Section 4 -/ + +/-- The tangle in `G` *induced* by a tangle `𝒯'` in a subgraph `G'` (Graph Minors XII, Section 4, +page 248): "Let $\mathscr{T}$ be the set of all separations $(A, B)$ of $G$ of order $< \theta$ such +that $(A \cap G', B \cap G') \in \mathscr{T}'$." -/ +abbrev inducedBySubgraph {α β : Type*} (G G' : Hypergraph α β) (θ : ℕ) + (𝒯' : Set (Hypergraph α β × Hypergraph α β)) : Set (Hypergraph α β × Hypergraph α β) := + GM10.inducedTangleFromSubgraph G G' θ 𝒯' + +/-- A subhypergraph is *connected*: any two of its vertices are joined in its skeleton. -/ +def IsConnectedSub {α β : Type*} (H : Hypergraph α β) : Prop := + ∀ a ∈ H.vertexSet, ∀ b ∈ H.vertexSet, H.skeleton.Reachable a b + +/-- `𝒯` *controls an `L` minor* of `G` (Graph Minors XII, Section 4, page 249): there is a function +`α` with domain `V(L) ∪ E(L)` such that +"(i) for each $v \in V(L)$, $\alpha(v)$ is a non-null connected subgraph of $G$, and +$\alpha(u), \alpha(v)$ are disjoint for all distinct $u, v \in V(L)$ (ii) for each $e \in +E(L)$ with distinct ends $u, v$, $\alpha(e)$ is an edge of $G$ with ends in $V(\alpha(u))$ +and in $V(\alpha(v))$ (iii) for each loop $e \in E(L)$ with end $v$, $\alpha(e)$ is an edge +of $G$ not in $E(\alpha(v))$ with both ends in $V(\alpha(v))$ (iv) for distinct $e, f \in +E(L)$, $\alpha(e) \ne \alpha(f)$ (v) $\mathscr{T}$ has order $\ge |V(L)|$, and there is no +$(A, B) \in \mathscr{T}$ of order $< |V(L)|$ such that $V(\alpha(v)) \subseteq V(A)$ for +some $v \in V(L)$." -/ +def ControlsMinor {α β γ δ : Type*} (G : Hypergraph α β) (θ : ℕ) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (L : Graph γ δ) : Prop := + ∃ (a : γ → Hypergraph α β) (b : δ → β), + (∀ v ∈ L.vertexSet, (a v).IsSubhypergraph G ∧ (a v).vertexSet.Nonempty ∧ IsConnectedSub (a v)) ∧ + (∀ u ∈ L.vertexSet, ∀ v ∈ L.vertexSet, u ≠ v → Disjoint (a u).vertexSet (a v).vertexSet) ∧ + (∀ e u v, L.IsLink e u v → u ≠ v → b e ∈ G.edgeSet ∧ + (∃ x ∈ (a u).vertexSet, G.Inc (b e) x) ∧ ∃ y ∈ (a v).vertexSet, G.Inc (b e) y) ∧ + (∀ e v, L.IsLink e v v → b e ∈ G.edgeSet ∧ b e ∉ (a v).edgeSet ∧ + ∀ x, G.Inc (b e) x → x ∈ (a v).vertexSet) ∧ + (∀ e ∈ L.edgeSet, ∀ f ∈ L.edgeSet, e ≠ f → b e ≠ b f) ∧ + L.vertexSet.ncard ≤ θ ∧ + ∀ A B : Hypergraph α β, (A, B) ∈ 𝒯 → separationOrder A B < L.vertexSet.ncard → + ∀ v ∈ L.vertexSet, ¬ (a v).vertexSet ⊆ A.vertexSet + +/-- The points of the list `l` occur in this order on the circle `F`, going once around it. This is +what the papers mean by "numbered in order on `F`" (Graph Minors XII, Section 6, page 257). It also +says what an opposite pair is in (5.2), page 254: on a list of `2θ` points in order, the `i`-th +point and +the `(i + θ)`-th point. -/ +def IsListedInOrderOn {X : Type*} [TopologicalSpace X] (F : Set X) (l : List X) : Prop := + ∃ (f : Circle ≃ₜ F) (t : ℕ → ℝ), StrictMono t ∧ (∀ i < l.length, t i < t 0 + 2 * Real.pi) ∧ + ∀ (i : ℕ) (h : i < l.length), ((f (Circle.exp (t i)) : F) : X) = l[i] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Induced.lean b/LeanPool/GraphMinor/GM12/Induced.lean new file mode 100644 index 0000000000..74e130f974 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Induced.lean @@ -0,0 +1,91 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Tangles induced by subgraphs + +This file supplies the assertion following (4.1) of Graph Minors XII, page 248. +Intersect a separation with the subgraph, then apply each tangle axiom there. +The argument works for hypergraphs as well as graphs. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Hypergraph GM10 + +variable {α β : Type*} {G H A B : Hypergraph α β} + +/-- Intersecting both sides of a separation with a subgraph gives a separation +of that subgraph, as used in Graph Minors XII, Section 4, page 248. -/ +theorem separation_inter_subgraph (hs : G.IsSeparation A B) (hH : H ≤ G) : + H.IsSeparation (A ∩ H) (B ∩ H) := + GM10.restrictSeparationToSubgraph hs hH + +/-- Restriction does not increase the order of a separation. -/ +theorem separationOrder_inter_subgraph_le (A B H : Hypergraph α β) : + separationOrder (A ∩ H) (B ∩ H) ≤ separationOrder A B := + GM10.separationOrder_restrict_subgraph_le A B H + +/-- Graph Minors XII, Section 4, page 248: the tangle induced by a tangle in a +subgraph is a tangle of the same order. Each axiom follows by intersection with +that subgraph. -/ +theorem inducedBySubgraph_isTangle {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} + (hH : H ≤ G) (hT : IsTangle H θ T) : + IsTangle G θ (inducedBySubgraph G H θ T) := + GM10.isTangle_inducedTangleFromSubgraph hH hT + +/-- The free boundary vertices exclude any induced small side containing them. +This is the contradiction in claim (2) of the proof of Graph Minors XII, (6.1), +page 258, after the enclosing walk has supplied its separation. -/ +theorem free_set_not_subset_induced_small_side {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} {X : Set α} + (hfree : IsFreeSet H T θ X) + (hmem : (A, B) ∈ inducedBySubgraph G H θ T) + (horder : separationOrder A B < X.ncard) : ¬ X ⊆ A.vertexSet := by + intro hXA + have hXAH : X ⊆ (A ∩ H).vertexSet := fun _ hx => ⟨hXA hx, hfree.1 hx⟩ + have hbound := hfree.2.2 hmem.2.2 hXAH + exact (not_lt_of_ge (hbound.trans (separationOrder_inter_subgraph_le A B H))) horder + +/-- Control of a minor in a subgraph gives control in the whole graph for the +induced tangle. This justifies the reduction to the drawing in the proof of +Graph Minors XII, (4.3), page 249. -/ +theorem controlsMinor_inducedBySubgraph {γ δ : Type*} {L : Graph γ δ} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} (hH : H ≤ G) + (hc : ControlsMinor H θ T L) : + ControlsMinor G θ (inducedBySubgraph G H θ T) L := by + obtain ⟨a, b, ha, hdisj, hlink, hloop, hinj, hcard, hcontrol⟩ := hc + refine ⟨a, b, ?_, hdisj, ?_, ?_, hinj, hcard, ?_⟩ + · intro v hv + have hvH : a v ≤ H := (ha v hv).1 + exact ⟨hvH.trans hH, (ha v hv).2⟩ + · intro e u v he huv + obtain ⟨heH, hxH, hyH⟩ := hlink e u v he huv + obtain ⟨x, hx, hxe⟩ := hxH + obtain ⟨y, hy, hye⟩ := hyH + refine ⟨hH.edgeSet_subset heH, ⟨x, hx, ?_⟩, ⟨y, hy, ?_⟩⟩ + · exact (inc_iff_of_le hH heH).mp hxe + · exact (inc_iff_of_le hH heH).mp hye + · intro e v he + obtain ⟨heH, hen, hend⟩ := hloop e v he + exact ⟨hH.edgeSet_subset heH, hen, + fun x hx => hend x ((inc_iff_of_le hH heH).mpr hx)⟩ + · intro A B hm ho v hv hsub + apply hcontrol (A ∩ H) (B ∩ H) hm.2.2 + (lt_of_le_of_lt (separationOrder_inter_subgraph_le A B H) ho) v hv + exact fun x hx => ⟨hsub hx, (ha v hv).1.vertexSet_subset hx⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/MetricRadial.lean b/LeanPool/GraphMinor/GM12/MetricRadial.lean new file mode 100644 index 0000000000..0235ba6de8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/MetricRadial.lean @@ -0,0 +1,116 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.GM12.Section4WalkMetric +import LeanPool.GraphMinor.GM11.Separate +import LeanPool.GraphMinor.GM11.Section64 + +/-! +# The metric of a tangle does not depend on the radial drawing + +Graph Minors XII, Section 1 (page 242), defines the metric $d$ of a respectful tangle from a radial +drawing $K$ of $\Gamma$, and the proof of (6.1) (page 258) chooses a special $K$. The paper does not +say +that $d$ is the same for every $K$. Graph Minors XI, Section 3 (page 75), says that a radial drawing +is +unique up to homeomorphisms of $\Sigma$ that fix $U(\Gamma)$, and omits the proof. We prove the fact +about $d$ that is needed, by (7.7)(ii) of XII applied with $\Gamma' = \Gamma$ +(`tangleMetric_eq_of_radial`). +The proof of (7.7) uses only (1.2) and (2.1), and so it does not depend on (6.1). + +* `exists_derivedSlope`: every radial drawing has a slope derived from the tangle, as on page 87 of + XI. +* `inducedBySubgraph_self`: the tangle that a tangle induces in its own graph is itself. +* `HasTangleMetric.eq`: two metrics of one tangle agree on the atoms. +* `HasTangleMetric.of_radial`: so the metric may be computed in any radial drawing. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- **A derived slope in any radial drawing.** For a respectful tangle `T` of order `θ`, each +circuit +`C` of a radial drawing with length `< 2θ` gives a `Γ`-normal `O`-arc `U(C)` with fewer than `θ` +vertices of `Γ`, so it bounds the closed disc of respectfulness (Graph Minors XI, Section 6, +page 87). -/ +theorem exists_derivedSlope {H K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsRespectfulDrawingTangle H θ T) (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) : + ∃ ins : Drawing S → Set S, IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins := + GM11.exists_derivedSlope_of_preRadial hT.2.2 hK.2.1 + +omit [TopologicalSpace S] [T2Space S] in +/-- The intersection of a subhypergraph with the hypergraph is the subhypergraph. -/ +theorem inter_eq_left_of_le {α β : Type*} {A G : Hypergraph α β} (h : A ≤ G) : A ∩ G = A := by + refine Hypergraph.ext (Set.inter_eq_left.mpr h.vertexSet_subset) + (Set.inter_eq_left.mpr h.edgeSet_subset) ?_ + funext e v + apply propext + refine ⟨fun hv => hv.1, fun hv => ⟨hv, ?_⟩⟩ + have he : e ∈ A.edgeSet := A.edge_mem_of_inc hv + have : v ∈ G.ends e := by + rw [h.ends_eq e he] + exact hv + exact this + +omit [TopologicalSpace S] [T2Space S] in +/-- **The tangle that a tangle induces in its own graph is itself.** -/ +theorem inducedBySubgraph_self {α β : Type*} {G : Hypergraph α β} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} (hT : IsTangle G θ T) : + inducedBySubgraph G G θ T = T := by + ext ⟨A, B⟩ + constructor + · rintro ⟨hs, -, hm⟩ + rwa [inter_eq_left_of_le hs.left_le, inter_eq_left_of_le hs.right_le] at hm + · intro hm + have hs := hT.isSeparation hm + refine ⟨hs, hT.order_lt hm, ?_⟩ + rwa [inter_eq_left_of_le hs.left_le, inter_eq_left_of_le hs.right_le] + +/-- **Two metrics of one tangle agree.** If `d` and `d'` are both metrics of the respectful tangle +`T` +in `H`, computed from two radial drawings, then they agree on the atoms of `H`. This is (7.7)(ii) of +Graph Minors XII with `Γ' = Γ`, applied both ways. -/ +theorem HasTangleMetric.eq (hS : IsClosedSurface S) [ConnectedSpace S] {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {d d' : Set S → Set S → ℕ} + (hd : HasTangleMetric H θ T d) (hd' : HasTangleMetric H θ T d') : + ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = d' x y := by + have hind : T = inducedBySubgraph H.toHypergraph H.toHypergraph θ T := + (inducedBySubgraph_self hd.1.2.1).symm + have hsub : H.IsSubdrawing H := ⟨subset_rfl, subset_rfl⟩ + intro x hx y hy + have h1 := (theorem_7_7_proof hS hd hsub hd.1.1 le_rfl hd').2 rfl hind x hx y hy x hx y hy + subset_rfl subset_rfl + have h2 := (theorem_7_7_proof hS hd' hsub hd.1.1 le_rfl hd).2 rfl hind x hx y hy x hx y hy + subset_rfl subset_rfl + omega + +/-- **The metric may be computed in any radial drawing.** For the metric `d` of a respectful tangle +and any radial drawing `K`, there is a slope `ins` in `K` derived from the tangle, and `d` is the +distance computed from `K` and `ins`. -/ +theorem HasTangleMetric.of_radial (hS : IsClosedSurface S) [ConnectedSpace S] {H K : Drawing S} + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {d : Set S → Set S → ℕ} + (hd : HasTangleMetric H θ T d) (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) : + ∃ ins : Drawing S → Set S, IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins ∧ + ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = tangleMetric H K ins θ x y := by + obtain ⟨ins, hins⟩ := exists_derivedSlope hd.1 hK + have hd' : HasTangleMetric H θ T (tangleMetric H K ins θ) := + ⟨hd.1, K, ins, hK, hins, fun _ _ _ _ => rfl⟩ + exact ⟨ins, hins, HasTangleMetric.eq hS hd hd'⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section1.lean b/LeanPool/GraphMinor/GM12/Section1.lean new file mode 100644 index 0000000000..d0edaa2524 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section1.lean @@ -0,0 +1,222 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM11.Section4c +import LeanPool.GraphMinor.GM11.Theorem63 + +/-! +# Graph Minors XII, Section 1: atoms and closed walks + +This file proves (1.1) from Graph Minors XI, (6.3), choosing one circuit for each edge +of the small side. It also proves that the tangle metric vanishes on the diagonal, and +"the easy observation" of Graph Minors XII, Section 1, page 242, which is (3.1) of +Graph Minors XIV: for a closed walk `W` of a radial drawing `K` of length `< 2θ` and an atom `c` of +`Γ`, the corresponding atom of `K` lies in `ins(W)` exactly when `c` meets `ins(W)` +(`corresponding_atom_subset_iff`). + +An edge of `Γ` misses `U(K)`, so its region of `K` lies inside or outside each `ins(C)`. A region +`c` +of `Γ` meets `U(L)`, for a subdrawing `L` of `K`, only if `L` has the vertex of `K` in `c`. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T1Space S] {Γ K : Drawing S} + +/-- Graph Minors XII, (1.1), page 242. A small side belongs to the tangle exactly when each +of its edges lies inside a radial circuit whose original vertices lie in the separator. +This is the drawing case of Graph Minors XI, (6.3). The finite family required there is obtained +by choosing one circuit for each edge of the small side. -/ +theorem theorem_1_1_proof (hS : IsClosedSurface S) [ConnectedSpace S] + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} (hT : IsRespectfulDrawingTangle Γ θ T) + (hE : Γ.E.Nonempty) (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + {A B : Hypergraph S (Set S)} (hAB : Γ.toHypergraph.IsSeparation A B) + (ho : separationOrder A B < θ) : + (A, B) ∈ T ↔ ∀ e ∈ A.edgeSet, ∃ C : Drawing S, + C.IsCircuit ∧ C.IsSubdrawing K ∧ C.length < 2 * θ ∧ + C.V ∩ Γ.V ⊆ (A ∩ B).vertexSet ∧ e ⊆ ins C := by + classical + have hp : IsPretangle Γ.toHypergraph θ T := + ⟨hT.2.1.one_le, hT.2.1.isSeparation, hT.2.1.order_lt, + hT.2.1.axiom1, hT.2.1.axiom2⟩ + have h := (GM11.theorem_6_3_proof S hS inferInstance (.drawing Γ) K θ T ins + hT.1 hE hp hT.2.2 hK hd).1 A B hAB ho + constructor + · intro hm e he + obtain ⟨k, C, hC, hc⟩ := h.mp hm + obtain ⟨i, hi⟩ := hc e he + exact ⟨C i, (hC i).1, (hC i).2.1, (hC i).2.2.1, (hC i).2.2.2, hi⟩ + · intro hc + let : Fintype A.edgeSet := A.edgeSet_finite.fintype + let q := Fintype.equivFin A.edgeSet + have hex : ∀ e : A.edgeSet, ∃ C : Drawing S, + C.IsCircuit ∧ C.IsSubdrawing K ∧ C.length < 2 * θ ∧ + C.V ∩ Γ.V ⊆ (A ∩ B).vertexSet ∧ e.val ⊆ ins C := + fun e => hc e.val e.property + choose C hC using hex + apply h.mpr + refine ⟨Fintype.card A.edgeSet, fun i => C (q.symm i), ?_, ?_⟩ + · intro i + exact ⟨(hC _).1, (hC _).2.1, (hC _).2.2.1, (hC _).2.2.2.1⟩ + · intro e he + refine ⟨q ⟨e, he⟩, ?_⟩ + simpa only [Equiv.symm_apply_apply] using (hC ⟨e, he⟩).2.2.2.2 + +/-- The metric of a respectful tangle vanishes on each atom paired with itself. -/ +theorem metric_self {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hd : HasTangleMetric Γ θ T d) + {a : Set S} (ha : a ∈ Γ.A) : d a a = 0 := by + obtain ⟨_, K, ins, _, _, h⟩ := hd + rw [h a ha a ha] + simp only [tangleMetric, ↓reduceIte] + +omit [T1Space S] in +/-- If a subdrawing `L` of `K` has a point in a region `c` of `Γ`, it has the vertex of `K` in `c`: +an edge of `K` in `c` has an end off `V(Γ)`, and that end lies in `c`. -/ +theorem vertex_of_mem_region [LocallyConnectedSpace S] + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) {c : Set S} (hc : c ∈ Γ.R) + {L : Drawing S} (hL : L.IsSubdrawing K) {x w : S} (hxL : x ∈ L.U) (hxc : x ∈ c) (hw : w ∈ c) + (hwK : w ∈ K.V) : w ∈ L.V := by + obtain ⟨hUU, hVV, huniq, -, hbip, -⟩ := hK + have hUU' : Γ.U ∩ K.U = Γ.V := hUU + have hVV' : Γ.V ⊆ K.V := hVV + have huniq' : ∀ r ∈ Γ.R, ∃! w, w ∈ r ∧ w ∈ K.V := huniq + have heq : ∀ y ∈ c, y ∈ K.V → y = w := fun y hy hyK => + (huniq' c hc).unique ⟨hy, hyK⟩ ⟨hw, hwK⟩ + by_cases hxV : x ∈ L.V + · rw [← heq x hxc (hL.1 hxV)] + exact hxV + obtain ⟨e, he, hxe⟩ := L.exists_edge_of_mem hxL hxV + have heK := hL.2 he + obtain ⟨v, hv, w', hw', hcap⟩ := hbip e heK + have hedis : Disjoint e Γ.U := disjoint_left.mpr fun y hy hyU => by + have hyK : y ∈ K.U := (heK.2.1 hy).1 + have : y ∈ Γ.U ∩ K.U := ⟨hyU, hyK⟩ + rw [hUU'] at this + exact (heK.2.1 hy).2 (hVV' this) + have hsub : e ⊆ c := subset_region hc + (show IsPathConnected e from heK.2.2.1).isConnected.isPreconnected hedis hxe hxc + have hw'mem : w' ∈ closure e ∩ K.V := by rw [hcap]; simp + have hw'U : w' ∉ Γ.U := fun h => by + have : w' ∈ Γ.U ∩ K.U := ⟨h, K.V_subset_U hw'mem.2⟩ + rw [hUU'] at this + exact hw'.2 this + have hw'c : w' ∈ c := by + rcases closure_region_subset hc (closure_mono hsub hw'mem.1) with h | h + · exact h + · exact absurd h hw'U + rw [← heq w' hw'c hw'mem.2] + exact ((hL.closure_inter_V he).symm ▸ hw'mem : w' ∈ closure e ∩ L.V).2 + +omit [T1Space S] in +/-- A preconnected set that meets a closed set `D` and misses its frontier lies in `D`. -/ +theorem subset_of_disjoint_frontier {A D : Set S} (hA : IsPreconnected A) (hD : IsClosed D) + (hdis : Disjoint A (frontier D)) {x : S} (hx : x ∈ A) (hxD : x ∈ D) : A ⊆ D := by + have hcov : A ⊆ interior D ∪ Dᶜ := by + intro y hy + by_cases hyD : y ∈ D + · refine Or.inl ?_ + by_contra h + exact disjoint_left.mp hdis hy ⟨subset_closure hyD, h⟩ + · exact Or.inr hyD + have hxi : x ∈ interior D := (hcov hx).resolve_right (fun h => h hxD) + intro y hy + by_contra hyD + obtain ⟨z, -, hz₁, hz₂⟩ := hA _ _ isOpen_interior hD.isOpen_compl hcov ⟨x, hx, hxi⟩ ⟨y, hy, hyD⟩ + exact hz₂ (interior_subset hz₁) + +/-- The observation of Graph Minors XII, Section 1, page 242, which is Graph Minors XIV, (3.1): "for +a closed walk $W$ in $K$ of length $<2\theta$, and for $c \in A(\Gamma)$, $a(c) +\subseteq ins(W)$ if and only if $c \cap ins(W) \ne \emptyset$." -/ +theorem corresponding_atom_subset_iff (hS : IsClosedSurface S) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + (hd : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) {c c' : Set S} + (hc : IsCorrespondingAtom Γ K c c') {u : S} (W : GraphWalk K.toGraph u u) + (hl : W.length < 2 * θ) : + c' ⊆ insWalk ins K W ↔ (c ∩ insWalk ins K W).Nonempty := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have : T2Space S := hS.2.1 + have hP := hK.2.1 + have hLs : (walkDrawing K W).IsSubdrawing K := walkDrawing_isSubdrawing K W + -- A circuit of `K | W` has a disc as its inside. + have hdisc : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing (walkDrawing K W) → + IsClosed (ins C) ∧ frontier (ins C) = C.U ∧ C.U ⊆ ins C := by + intro C hC hCs + have hlen : C.length < 2 * θ := by + refine lt_of_le_of_lt ?_ hl + have hsub : C.E ⊆ {e | e ∈ W.edges} := by + have := hCs.2 + rwa [walkDrawing_E] at this + calc C.E.ncard ≤ ({e | e ∈ W.edges} : Set (Set S)).ncard := + Set.ncard_le_ncard hsub (List.finite_toSet _) + _ ≤ W.edges.length := by + rw [show ({e | e ∈ W.edges} : Set (Set S)) = ↑W.edges.toFinset by ext; simp, + Set.ncard_coe_finset] + exact List.toFinset_card_le _ + _ = W.length := rfl + obtain ⟨h₁, h₂, -⟩ := hd C hC (hCs.trans hLs) hlen + have hcl : IsClosed (ins C) := h₁.isClosed + have hfr : frontier (ins C) = C.U := by rw [subBd_eq_frontier', h₂] + exact ⟨hcl, hfr, hfr ▸ hcl.frontier_subset⟩ + constructor + · intro h + obtain ⟨-, -, hcase⟩ := hc + rcases hcase with ⟨v, -, rfl, rfl⟩ | ⟨he, hr, hsub⟩ | ⟨hr, v, hv, rfl⟩ + · exact ⟨v, rfl, h rfl⟩ + · obtain ⟨x, hx⟩ := he.1 + exact ⟨x, hx, h (hsub hx)⟩ + · exact ⟨v, hv.2, h rfl⟩ + · rintro ⟨x, hxc, hxW⟩ + obtain ⟨-, -, hcase⟩ := hc + rcases hcase with ⟨v, -, rfl, rfl⟩ | ⟨he, hr, hsub⟩ | ⟨hr, w, hw, rfl⟩ + · exact singleton_subset_iff.mpr (by rwa [mem_singleton_iff.mp hxc] at hxW) + · -- An edge of `Γ` misses `U(K)`. + have hUU : Γ.U ∩ K.U = Γ.V := hP.1 + have hxK : x ∉ K.U := fun h => by + have hxU : x ∈ Γ.U := (he.2.1 hxc).1 + have : x ∈ Γ.U ∩ K.U := ⟨hxU, h⟩ + rw [hUU] at this + exact (he.2.1 hxc).2 this + have hdisr : Disjoint c' K.U := disjoint_left.mpr fun y hy hyU => region_subset hr hy hyU + rcases hxW with hx | hx + · exact absurd (hLs.U_subset hx) hxK + · obtain ⟨C, ⟨hC, hCs⟩, hxC⟩ := mem_iUnion₂.mp hx + obtain ⟨hcl, hfr, -⟩ := hdisc C hC hCs + have hd' : Disjoint c' (frontier (ins C)) := by + rw [hfr] + exact hdisr.mono_right (hCs.trans hLs).U_subset + have hin := subset_of_disjoint_frontier (region_isPreconnected hr) hcl hd' (hsub hxc) hxC + exact fun y hy => Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, hCs⟩, hin hy⟩) + · refine singleton_subset_iff.mpr ?_ + rcases hxW with hx | hx + · exact Or.inl ((walkDrawing K W).V_subset_U + (vertex_of_mem_region hP hr hLs hx hxc hw.2 hw.1)) + · obtain ⟨C, ⟨hC, hCs⟩, hxC⟩ := mem_iUnion₂.mp hx + obtain ⟨hcl, hfr, hUin⟩ := hdisc C hC hCs + refine Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, hCs⟩, ?_⟩) + by_cases hwC : w ∈ C.V + · exact hUin (C.V_subset_U hwC) + · refine subset_of_disjoint_frontier (region_isPreconnected hr) hcl ?_ hxc hxC hw.2 + rw [hfr] + refine disjoint_left.mpr fun y hy hyC => hwC ?_ + exact vertex_of_mem_region hP hr (hCs.trans hLs) hyC hy hw.2 hw.1 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section1b.lean b/LeanPool/GraphMinor/GM12/Section1b.lean new file mode 100644 index 0000000000..272ad8adc3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section1b.lean @@ -0,0 +1,127 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +import LeanPool.GraphMinor.GM14.RadialAtoms + +public import LeanPool.GraphMinor.GM12.Section1 +public import LeanPool.GraphMinor.GM12.Cited +import LeanPool.GraphMinor.GM11.RadialFacts +import LeanPool.GraphMinor.GM11.PaintingFacts +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.Section91 + +/-! +# Graph Minors XII, (1.2): a distant edge + +Choose a point in the corresponding radial atom and apply XI (8.12). The radial region it +provides contains an original edge. XI (8.5) rules out a short closed walk containing both atoms. +If this edge is the starting atom, choose another edge in its place. + +The last step requires at least two edges. This corrects XII (1.2), which fails for the single +edge drawing on the sphere with its respectful tangle of order two. XIV (7.1) includes this +hypothesis. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +omit [T1Space S] in +private theorem atom_nonempty {Γ : Drawing S} {x : Set S} (hx : x ∈ Γ.A) : x.Nonempty := by + rcases hx with (⟨v, -, rfl⟩ | hx) | hx + · exact singleton_nonempty v + · exact hx.1 + · exact region_nonempty hx + +omit [T1Space S] in +/-- Every atom of the original drawing has a unique corresponding +atom in its radial drawing. -/ +theorem existsUnique_correspondingAtom {H K : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) {x : Set S} (hx : x ∈ H.A) : + ∃! x' : Set S, IsCorrespondingAtom H K x x' := + GM14.existsUnique_correspondingAtom hK hx + +/-- An edge whose corresponding radial region rules out short walks between its atom and +the starting atom. When the edge is the starting atom, the same obstruction works for +every other atom. -/ +theorem exists_edge_for_metric_eq_order (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hMetric : HasTangleMetric H θ T d) (hE : H.E.Nonempty) {z : Set S} (hz : z ∈ H.A) : + ∃ e ∈ H.E, ∀ y ∈ H.A, z ≠ y → (y = e ∨ z = e) → d z y = θ := by + have : T2Space S := hS.2.1 + have : ConnectedSpace S := hConn + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hResp, K, ins, hK, hd, hd_eq⟩ := hMetric + have hsl : IsSlope K (2 * θ) ins := + GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) hS (⟨hResp.2.1.one_le, + hResp.2.1.isSeparation, hResp.2.1.order_lt, + hResp.2.1.axiom1, hResp.2.1.axiom2⟩ : IsPretangle H.toHypergraph θ T) hK.2.1.1 hd + have hrf := GM11.regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hE + obtain ⟨z', hz', hz'_uniq⟩ := existsUnique_correspondingAtom hK hz + obtain ⟨c, hc⟩ := atom_nonempty hz'.2.1 + obtain ⟨r₁, hr₁, hno₁⟩ := GM11.theorem_8_12_proof hS hsl c + obtain ⟨e₁, he₁, he₁r₁⟩ := hrf.1 r₁ hr₁ + have he₁_corr : IsCorrespondingAtom H K e₁ r₁ := + ⟨Or.inl (Or.inr he₁), Or.inr hr₁, Or.inr (Or.inl ⟨he₁, hr₁, he₁r₁⟩)⟩ + refine ⟨e₁, he₁, fun y hy hne hEndpoint => ?_⟩ + rw [hd_eq z hz y hy] + rcases GM11.tangleMetric_cases (ins := ins) (θ := θ) hK.2.1 hne with h | ⟨_, hw⟩ + · exact h + exfalso + obtain ⟨_, W, z₁, y₁, hz₁, hy₁, hW, _, hzW, hyW⟩ := hw + have hzEq : z₁ = z' := hz'_uniq z₁ hz₁ + have hrW : r₁ ⊆ insWalk ins K W := by + rcases hEndpoint with he | he + · have hyCorr : IsCorrespondingAtom H K y r₁ := he.symm ▸ he₁_corr + have hyEq : y₁ = r₁ := (existsUnique_correspondingAtom hK hy).unique hy₁ hyCorr + exact hyEq ▸ hyW + · have hzCorr : IsCorrespondingAtom H K z r₁ := he.symm ▸ he₁_corr + have hzRadial : z₁ = r₁ := (existsUnique_correspondingAtom hK hz).unique hz₁ hzCorr + exact hzRadial ▸ hzW + exact hno₁ _ (GM11.theorem_8_5_proof hS hsl W hW).1 + ⟨hzW (hzEq.symm ▸ hc), hrW⟩ + +/-- When a second edge is available if needed, every atom has an edge at distance equal to +the order of the tangle. -/ +theorem exists_edge_dist_eq_theta_of_metric (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hMetric : HasTangleMetric H θ T d) (hE : H.E.Nonempty) + {z : Set S} (hz : z ∈ H.A) (hzE : 2 ≤ H.E.ncard ∨ z ∉ H.E) : + ∃ e ∈ H.E, d z e = θ := by + obtain ⟨e, he, hDist⟩ := exists_edge_for_metric_eq_order hS hConn hMetric hE hz + by_cases hze : z = e + · have hTwo : 2 ≤ H.E.ncard := hzE.resolve_right (fun h => h (hze.symm ▸ he)) + obtain ⟨e', he', hne⟩ := exists_ne_of_one_lt_ncard (s := H.E) (by omega) z + exact ⟨e', he', hDist _ (Or.inl (Or.inr he')) hne.symm (Or.inr hze)⟩ + · exact ⟨e, he, hDist _ (Or.inl (Or.inr he)) hze (Or.inl rfl)⟩ + +/-- Graph Minors XII, (1.2), page 242, with the necessary hypothesis that there are at least +two edges, as in XIV (7.1). The proof uses the established XI (8.5) and (8.12). -/ +theorem theorem_1_2_proof (hS : IsClosedSurface S) [ConnectedSpace S] + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hd : HasTangleMetric Γ θ T d) + (hE : 2 ≤ Γ.E.ncard) {c : Set S} (hc : c ∈ Γ.A) : + ∃ e ∈ Γ.E, d c e = θ := by + have he : Γ.E.Nonempty := (Set.ncard_pos Γ.finite_edges).mp (lt_of_lt_of_le (by decide) hE) + exact exists_edge_dist_eq_theta_of_metric hS inferInstance hd he hc (Or.inl hE) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2.lean b/LeanPool/GraphMinor/GM12/Section2.lean new file mode 100644 index 0000000000..e5d7296966 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2.lean @@ -0,0 +1,41 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs + +/-! +# Graph Minors XII, Section 2: trace length + +The first assertion of (2.1) follows from the definition of a trace: its length is twice +the number of crossings of the original drawing. Restricting traces to simple closed curves +is the topological step needed for the next part of the paper's proof. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +omit [T1Space S] in +/-- The first assertion of Graph Minors XII, (2.1), page 243: `ins(W)` is defined, +since the trace has length less than twice the tangle order. -/ +theorem theorem_2_1_length {Γ K : Drawing S} {φ : C(Circle, S)} {u : S} + {W : GraphWalk K.toGraph u u} (hW : IsTrace Γ K φ W) + {θ : ℕ} (hφ : curveLength Γ φ < θ) : W.length < 2 * θ := by + rcases hW.2 with ⟨_, hlen, _⟩ | ⟨_, hlen, _⟩ + · omega + · omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2ApproachShrink.lean b/LeanPool/GraphMinor/GM12/Section2ApproachShrink.lean new file mode 100644 index 0000000000..462abdbfa2 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2ApproachShrink.lean @@ -0,0 +1,118 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2SectorEntry +import LeanPool.GraphMinor.GM11.RadialCorners +import LeanPool.GraphMinor.GM12.Section2SpokePaths + +/-! +# Shortening an approach before comparing its entry + +For the entry definition on XII page 243, one may choose the starting +point as close to the vertex as needed. Continuity puts a terminal +segment of the approach inside the sector neighbourhood used for the +entry comparison. No injectivity of the approach is required. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface unitInterval + +/-- An approach through a sector and a spoke germ in the same sector +have an entry comparison after shortening the approach. -/ +theorem entry_comparison_from_sector_approach {S : Type*} [TopologicalSpace S] + {D W r Z : Set S} {a v b : Z} (F : Path a v) (β : Path (F 1) b) + (hD : IsClosedDisc D) (hv : v.val ∈ discBd D) + (hW : IsOpen W) (hvW : v.val ∈ W) + (hlocal : ((D \ discBd D) ∩ W) ∪ {v.val} ⊆ Z) + (hregion : (D \ discBd D) ∩ W ⊆ r) + (hvr : v.val ∉ r) + (hF : ∀ t, t < 1 → (F t).val ∈ r ∩ (D \ discBd D)) + (hβr : ∀ t, 0 < t → (β t).val ∈ r) + (hgerm : ∃ ε : I, 0 < ε ∧ + ∀ t, 0 < t → t ≤ ε → (β t).val ∈ D \ discBd D) : + ∃ t : I, t < 1 ∧ ∃ ρ : Path (F t) b, + (∀ s, (ρ s).val ∈ r) ∧ ((F.subpath t 1).trans β).Homotopic ρ := by + have hv' : (F 1).val ∈ discBd D := by rw [F.target]; exact hv + have hvW' : (F 1).val ∈ W := by rw [F.target]; exact hvW + have hlocal' : ((D \ discBd D) ∩ W) ∪ {(F 1).val} ⊆ Z := by rw [F.target]; exact hlocal + obtain ⟨N, hN, hvN, hcompare⟩ := + exists_sector_entry_neighbourhood hD hv' hW hvW' hlocal' hregion + let half : I := ⟨1 / 2, by norm_num, by norm_num⟩ + obtain ⟨δ, hδ, hδhalf, hδN⟩ := GM11.exists_pos_le + (continuous_subtype_val.comp F.symm.continuous) hN (by simpa only [Function.comp_apply, + Path.symm_apply, unitInterval.symm_zero] using hvN) + (show (0 : I) < half by change (0 : ℝ) < 1 / 2; norm_num) + let t : I := σ δ + have ht : t < 1 := by + change (1 - δ.val : ℝ) < 1 + exact sub_lt_self _ hδ + have hne : F t ≠ F 1 := by + intro h + have hm := (hF t ht).1 + rw [h, F.target] at hm + exact hvr hm + have hp : ∀ s, ((F.subpath t 1) s).val ∈ ((N ∩ D) \ discBd D) ∪ {(F 1).val} := by + intro s + let u : I := Icc.convexComb t 1 s + by_cases hu : u = 1 + · right + change (F u).val ∈ {(F 1).val} + rw [hu] + exact mem_singleton _ + · left + have hu1 : u < 1 := lt_of_le_of_ne u.property.2 hu + have htu : t ≤ u := by + change t.val ≤ (1 - s.val) * t.val + s.val * 1 + nlinarith [s.property.1, t.property.2] + have hback : σ u ≤ δ := by + change 1 - u.val ≤ δ.val + have htu' : 1 - δ.val ≤ u.val := htu + linarith + have hNmem : (F u).val ∈ N := by + have hm := hδN (σ u) hback + simpa only [Function.comp_apply, Path.symm_apply, unitInterval.symm_symm] using hm + exact ⟨⟨hNmem, (hF u hu1).2.1⟩, (hF u hu1).2.2⟩ + obtain ⟨ρ, hρ, hhom⟩ := hcompare (F.subpath t 1) β hne hp hβr hgerm + exact ⟨t, ht, ρ, hρ, hhom⟩ + +/-- A surface path with a germ in the entering sector gives the path +comparison in the region with its vertex added. -/ +theorem entry_comparison_from_surface_germ {S : Type*} [TopologicalSpace S] + {D W r : Set S} {v c : S} (hc : c ∈ r) + {a : (r ∪ {v} : Set S)} + (F : Path a (⟨v, Or.inr rfl⟩ : (r ∪ {v} : Set S))) (β : Path v c) + (hD : IsClosedDisc D) (hv : v ∈ discBd D) + (hW : IsOpen W) (hvW : v ∈ W) + (hregion : (D \ discBd D) ∩ W ⊆ r) (hvr : v ∉ r) + (hF : ∀ t, t < 1 → (F t).val ∈ r ∩ (D \ discBd D)) + (hβr : ∀ t, 0 < t → β t ∈ r) + (hgerm : ∃ ε : I, 0 < ε ∧ ∀ t, 0 < t → t ≤ ε → β t ∈ D \ discBd D) : + ∃ q : Path (F 1) (⟨c, Or.inl hc⟩ : (r ∪ {v} : Set S)), + (∀ t, (q t).val = β t) ∧ ∃ t : I, t < 1 ∧ + ∃ ρ : Path (F t) (⟨c, Or.inl hc⟩ : (r ∪ {v} : Set S)), + (∀ s, (ρ s).val ∈ r) ∧ ((F.subpath t 1).trans q).Homotopic ρ := by + obtain ⟨q₀, hq₀⟩ := exists_path_in_region_vertex hc β hβr + let q := q₀.cast F.target rfl + have hq : ∀ t, (q t).val = β t := hq₀ + have hlocal : ((D \ discBd D) ∩ W) ∪ {v} ⊆ r ∪ {v} := by + intro x hx + rcases hx with hx | hx + · exact Or.inl (hregion hx) + · exact Or.inr hx + obtain ⟨t, ht, ρ, hρ, hhom⟩ := entry_comparison_from_sector_approach F q hD hv hW hvW + hlocal hregion hvr hF (fun t ht => hq t ▸ hβr t ht) (by + obtain ⟨ε, hε, hεβ⟩ := hgerm + exact ⟨ε, hε, fun t ht htε => hq t ▸ hεβ t ht htε⟩) + exact ⟨q, hq, t, ht, ρ, hρ, hhom⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2ArcComponents.lean b/LeanPool/GraphMinor/GM12/Section2ArcComponents.lean new file mode 100644 index 0000000000..53739ee472 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2ArcComponents.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import Mathlib.Topology.Connected.Basic + +/-! +# Components after removing the common ends of two arcs + +In Case 2 of XII (2.1), page 244, a chord cuts a circle into two arcs. +The two open arcs are precisely the components of the circle minus the +chord ends. The general lemma here treats two closed sets whose +intersection is removed: each remaining connected piece is a whole +component of their union. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +private theorem component_eq_closed_piece {S : Type*} [TopologicalSpace S] + {A B F : Set S} (hA : IsClosed A) (hB : IsClosed B) (hAB : A ∩ B ⊆ F) + (hconn : IsPreconnected (A \ F)) {x : S} (hx : x ∈ A \ F) : + connectedComponentIn ((A ∪ B) \ F) x = A \ F := by + let T := (A ∪ B) \ F + have hxT : x ∈ T := ⟨Or.inl hx.1, hx.2⟩ + have hsub : A \ F ⊆ T := fun _ h => ⟨Or.inl h.1, h.2⟩ + apply Subset.antisymm + · intro y hy + have hyT := connectedComponentIn_subset T x hy + refine ⟨?_, hyT.2⟩ + by_contra hyA + have hyB := hyT.1.resolve_left hyA + obtain ⟨z, hzC, hzA, hzB⟩ := isPreconnected_closed_iff.mp + isPreconnected_connectedComponentIn A B hA hB + (fun z hz => (connectedComponentIn_subset T x hz).1) + ⟨x, mem_connectedComponentIn hxT, hx.1⟩ ⟨y, hy, hyB⟩ + exact (connectedComponentIn_subset T x hzC).2 (hAB ⟨hzA, hzB⟩) + · exact hconn.subset_connectedComponentIn hx hsub + +/-- If two closed sets meet only in the removed set, their nonempty +preconnected remainders are exactly the components of the punctured +union. Applied to two arcs and their ends, this identifies the two +boundary pieces in the disc-cutting step of XII (2.1), Case 2. -/ +theorem componentsIn_union_sdiff {S : Type*} [TopologicalSpace S] + {A B F : Set S} (hA : IsClosed A) (hB : IsClosed B) (hAB : A ∩ B ⊆ F) + (hAc : IsPreconnected (A \ F)) (hBc : IsPreconnected (B \ F)) + (hAne : (A \ F).Nonempty) (hBne : (B \ F).Nonempty) : + componentsIn ((A ∪ B) \ F) = {A \ F, B \ F} := by + ext C + constructor + · rintro ⟨x, hx, rfl⟩ + rcases hx.1 with hxA | hxB + · exact Or.inl (component_eq_closed_piece hA hB hAB hAc ⟨hxA, hx.2⟩) + · right + have heq : connectedComponentIn ((A ∪ B) \ F) x = B \ F := by + rw [union_comm] + exact component_eq_closed_piece hB hA (fun _ hz => hAB ⟨hz.2, hz.1⟩) hBc ⟨hxB, hx.2⟩ + exact mem_singleton_iff.mpr heq + · rintro (rfl | hC) + · obtain ⟨x, hx⟩ := hAne + exact ⟨x, ⟨Or.inl hx.1, hx.2⟩, + component_eq_closed_piece hA hB hAB hAc hx⟩ + · obtain rfl := mem_singleton_iff.mp hC + obtain ⟨x, hx⟩ := hBne + refine ⟨x, ⟨Or.inr hx.1, hx.2⟩, ?_⟩ + rw [union_comm] + exact component_eq_closed_piece hB hA (fun _ hz => hAB ⟨hz.2, hz.1⟩) hBc hx + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2ArcGermChart.lean b/LeanPool/GraphMinor/GM12/Section2ArcGermChart.lean new file mode 100644 index 0000000000..ce04bd0e61 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2ArcGermChart.lean @@ -0,0 +1,91 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2StraightArcChart +public import LeanPool.GraphMinor.GM12.Section2RayChartPatch + +/-! +# An isolated arc end has a ray chart + +For the leaf-entry patch on XII page 243, remove the other edges and +the far part of the incident edge from a neighbourhood of the leaf. +The drawing there is exactly the initial part of one arc. Straight +coordinates identify this arc with an increasing real interval. +Restrict the chart to points before its far endpoint and to the chosen +neighbourhood. The drawing is then exactly the positive real ray, +so the slit-patch construction applies. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Complex Surface + +/-- A set which agrees near an arc's initial endpoint with that arc +has an open ray chart at the endpoint. -/ +theorem exists_ray_chart_of_arc_germ + {S : Type*} [TopologicalSpace S] + (hman : ∀ x : S, IsManifoldPoint x) + {R : ℝ} {U : Set S} {h : S → ℂ} {g : ℂ → S} + (c : BallChart R U h g) {a : unitInterval → S} (ha : IsArcMap a) (hU : range a ⊆ U) + {B W : Set S} (haB : range a ⊆ B) (hW : IsOpen W) (haW : a 0 ∈ W) + (hBW : B ∩ W ⊆ range a) : + ∃ (O : Set ℂ) (K : ℂ → S) (q : ℂ), + IsOpen O ∧ ContinuousOn K O ∧ InjOn K O ∧ + (∀ V : Set ℂ, IsOpen V → V ⊆ O → IsOpen (K '' V)) ∧ + q ∈ O ∧ q.im = 0 ∧ K q = a 0 ∧ + ∀ z ∈ O, K z ∈ B ↔ z.im = 0 ∧ q.re ≤ z.re := by + obtain ⟨O, K, θ, hO, hK, hi, ho, hθc, hθm, hθ⟩ := + exists_straight_arc_chart hman c ha hU + let O' := (O ∩ K ⁻¹' W) ∩ {z : ℂ | z.re < θ 1} + have hO' : IsOpen O' := + (hK.isOpen_inter_preimage hO hW).inter (isOpen_Iio.preimage continuous_re) + have hsub : O' ⊆ O := inter_subset_left.trans inter_subset_left + have hqW : K (θ 0) ∈ W := by rw [(hθ 0).2]; exact haW + have hqO : ((θ 0 : ℝ) : ℂ) ∈ O' := + ⟨⟨(hθ 0).1, hqW⟩, by simpa using hθm zero_lt_one⟩ + refine ⟨O', K, (θ 0 : ℂ), hO', hK.mono hsub, hi.mono hsub, + fun V hV hVO => ho V hV (hVO.trans hsub), hqO, by simp, (hθ 0).2, ?_⟩ + intro z hz + constructor + · intro hzB + obtain ⟨t, ht⟩ := hBW ⟨hzB, hz.1.2⟩ + have he : K z = K (θ t) := ht.symm.trans (hθ t).2.symm + have hzθ : z = (θ t : ℂ) := hi (hsub hz) (hθ t).1 he + rw [hzθ] + exact ⟨by simp, by simpa using hθm.monotone (unitInterval.nonneg t)⟩ + · rintro ⟨hzim, hzr⟩ + have hzr' : θ 0 ≤ z.re := by simpa using hzr + have hzI : z.re ∈ Icc (θ 0) (θ 1) := ⟨hzr', hz.2.le⟩ + obtain ⟨t, _, ht⟩ := intermediate_value_Icc (show (0 : unitInterval) ≤ 1 from zero_le_one) + hθc.continuousOn hzI + have hθz : (θ t : ℂ) = z := Complex.ext (by simpa using ht) (by simpa using hzim.symm) + have hKz : K z = a t := by rw [← hθz]; exact (hθ t).2 + exact hKz.symm ▸ haB (mem_range_self t) + +/-- The ray chart at an isolated arc end yields a simply connected +patch with path-connected puncture and the required local coverage. -/ +theorem exists_slit_patch_of_arc_germ + {S : Type*} [TopologicalSpace S] [T2Space S] + (hman : ∀ x : S, IsManifoldPoint x) + {R : ℝ} {U : Set S} {h : S → ℂ} {g : ℂ → S} + (c : BallChart R U h g) {a : unitInterval → S} (ha : IsArcMap a) (hU : range a ⊆ U) + {B W : Set S} (haB : range a ⊆ B) (hW : IsOpen W) (haW : a 0 ∈ W) + (hBW : B ∩ W ⊆ range a) : + ∃ N X : Set S, IsOpen N ∧ a 0 ∈ N ∧ a 0 ∈ X ∧ + IsSimplyConnectedSet X ∧ IsPathConnected (X \ {a 0}) ∧ + X ⊆ Bᶜ ∪ {a 0} ∧ N \ B ⊆ X := by + obtain ⟨O, K, q, hO, hK, hi, ho, hq, hqim, hKq, hB⟩ := + exists_ray_chart_of_arc_germ hman c ha hU haB hW haW hBW + have hpatch := exists_slit_patch_of_ray_chart hO hK hi ho hq hqim hB + rwa [hKq] at hpatch + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2ArcHomotopy.lean b/LeanPool/GraphMinor/GM12/Section2ArcHomotopy.lean new file mode 100644 index 0000000000..b39303c87a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2ArcHomotopy.lean @@ -0,0 +1,179 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.Section3 +import Mathlib.AlgebraicTopology.FundamentalGroupoid.Basic + +/-! +# Two homotopic arcs bound a null-homotopic circle + +The uniqueness part of the entry-edge definition in XII, page 243, +compares the paths along two spokes. If the paths are homotopic and +otherwise disjoint, their union is a null-homotopic circle. This file +proves the path-to-circle step. It uses the usual traversal of the first +arc followed by the reverse of the second, with its endpoints identified. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Two injective arcs with common ends and no other intersection +form a closed traversal with no repeated parameter except its ends. -/ +theorem joined_loop_eq {X : Type*} [TopologicalSpace X] {a b : X} + (p q : Path a b) (hp : Function.Injective p) (hq : Function.Injective q) + (hcross : ∀ s t, p s = q t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) + {s t : unitInterval} (heq : (p.trans q.symm) s = (p.trans q.symm) t) : + s = t ∨ (s = 0 ∧ t = 1) ∨ (s = 1 ∧ t = 0) := by + by_cases hs : (s : ℝ) ≤ 1 / 2 <;> by_cases ht : (t : ℝ) ≤ 1 / 2 + · simp only [Path.trans_apply, hs, ht, ↓reduceDIte] at heq + have h := congrArg Subtype.val (hp heq) + left + apply Subtype.ext + dsimp only at h + linarith + · simp only [Path.trans_apply, hs, ht, ↓reduceDIte, Path.symm_apply] at heq + rcases hcross _ _ heq with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · have h₁' := congrArg Subtype.val h₁ + have h₂' := congrArg Subtype.val h₂ + simp only [unitInterval.coe_symm_eq, Icc.coe_zero] at h₁' h₂' + right; left + constructor + · apply Subtype.ext + change (s : ℝ) = 0 + linarith + · apply Subtype.ext + change (t : ℝ) = 1 + linarith + · have h₁' := congrArg Subtype.val h₁ + have h₂' := congrArg Subtype.val h₂ + simp only [unitInterval.coe_symm_eq, Icc.coe_one] at h₁' h₂' + left + apply Subtype.ext + linarith + · simp only [Path.trans_apply, hs, ht, ↓reduceDIte, Path.symm_apply] at heq + rcases hcross _ _ heq.symm with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · have h₁' := congrArg Subtype.val h₁ + have h₂' := congrArg Subtype.val h₂ + simp only [unitInterval.coe_symm_eq, Icc.coe_zero] at h₁' h₂' + right; right + constructor + · apply Subtype.ext + change (s : ℝ) = 1 + linarith + · apply Subtype.ext + change (t : ℝ) = 0 + linarith + · have h₁' := congrArg Subtype.val h₁ + have h₂' := congrArg Subtype.val h₂ + simp only [unitInterval.coe_symm_eq, Icc.coe_one] at h₁' h₂' + left + apply Subtype.ext + linarith + · simp only [Path.trans_apply, hs, ht, ↓reduceDIte, Path.symm_apply] at heq + have h := congrArg Subtype.val (hq heq) + simp only [unitInterval.coe_symm_eq] at h + left + apply Subtype.ext + linarith + +/-- The union of two injective homotopic paths with common ends and no +other intersections is a null-homotopic `O`-arc. This is the homotopy +step used to distinguish entry spokes in XII, page 243. -/ +theorem nullHomotopic_union_of_homotopic_arcs {X : Type*} + [TopologicalSpace X] [T2Space X] {a b : X} (p q : Path a b) + (hp : Function.Injective p) (hq : Function.Injective q) + (hcross : ∀ s t, p s = q t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) + (hh : p.Homotopic q) : IsNullHomotopicOArcIn univ (range p ∪ range q) := by + let loop := p.trans q.symm + let γ : C(Circle, X) := loopLift 1 loop.toContinuousMap (by simp) + have hγi : Function.Injective γ := by + intro z w heq + obtain ⟨s, rfl⟩ := arcParam_surjective 1 z + obtain ⟨t, rfl⟩ := arcParam_surjective 1 w + have hst := heq + simp only [γ, loopLift_apply] at hst + change (p.trans q.symm) s = (p.trans q.symm) t at hst + rcases joined_loop_eq p q hp hq hcross hst with h | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact congrArg (arcParam 1) h + · simp only [arcParam_zero, arcParam_one] + · simp only [arcParam_zero, arcParam_one] + have hrange : range γ = range p ∪ range q := by + have heq : range γ = range loop := by + ext x + constructor + · rintro ⟨z, rfl⟩ + obtain ⟨s, rfl⟩ := arcParam_surjective 1 z + exact ⟨s, (loopLift_apply 1 _ _ s).symm⟩ + · rintro ⟨s, rfl⟩ + exact ⟨arcParam 1 s, loopLift_apply 1 _ _ s⟩ + rw [heq, Path.trans_range, Path.symm_range] + have hnull : ClosedCurveIsNullHomotopicIn univ γ := by + obtain ⟨H⟩ := (hh.hcomp (Path.Homotopic.refl q.symm)).trans (Path.Homotopic.trans_symm q) + let F : C(unitInterval × unitInterval, X) := ⟨fun z => H (z.2, z.1), by fun_prop⟩ + have hends : ∀ t, F (0, t) = F (1, t) := by intro t; simp [F] + refine ⟨a, mem_univ _, cylinderLift 1 F hends, fun _ => mem_univ _, ?_, ?_⟩ + · intro z + obtain ⟨s, rfl⟩ := arcParam_surjective 1 z + rw [cylinderLift_apply] + change H (0, s) = loopLift 1 loop.toContinuousMap _ (arcParam 1 s) + rw [H.apply_zero, loopLift_apply] + · intro z + obtain ⟨s, rfl⟩ := arcParam_surjective 1 z + rw [cylinderLift_apply] + change H (1, s) = a + simp + let φ : Circle ≃ₜ (range p ∪ range q : Set X) := + (γ.continuous.isClosedEmbedding hγi).isEmbedding.toHomeomorph.trans + (Homeomorph.setCongr hrange) + refine ⟨φ, ?_⟩ + have heq : (⟨fun z => (φ z).val, continuous_subtype_val.comp φ.continuous⟩ : C(Circle, X)) = γ + := by + ext z + rfl + rw [heq] + exact hnull + +/-- Map a null-homotopic circle through a topological embedding. This +lets path homotopies in a subspace be used in the ambient surface. -/ +theorem nullHomotopic_oArc_image {X Y : Type*} + [TopologicalSpace X] [TopologicalSpace Y] [T2Space Y] + {f : X → Y} (hf : IsEmbedding f) {Z F : Set X} + (hF : IsNullHomotopicOArcIn Z F) : + IsNullHomotopicOArcIn (f '' Z) (f '' F) := by + obtain ⟨φ, c, hc, H, hHZ, hH0, hH1⟩ := hF + let γ : C(Circle, Y) := ⟨fun z => f (φ z).val, + hf.continuous.comp (continuous_subtype_val.comp φ.continuous)⟩ + have hγi : Function.Injective γ := + (hf.comp (IsEmbedding.subtypeVal.comp φ.isEmbedding)).injective + have hrange : range γ = f '' F := by + ext y + constructor + · rintro ⟨z, rfl⟩ + exact ⟨(φ z).val, (φ z).property, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨φ.symm ⟨x, hx⟩, by simp [γ]⟩ + let e : Circle ≃ₜ (f '' F : Set Y) := + (γ.continuous.isClosedEmbedding hγi).isEmbedding.toHomeomorph.trans + (Homeomorph.setCongr hrange) + refine ⟨e, f c, ⟨c, hc, rfl⟩, ?_, ?_, ?_, ?_⟩ + · exact ⟨fun z => f (H z), hf.continuous.comp H.continuous⟩ + · intro z + exact ⟨H z, hHZ z, rfl⟩ + · intro z + change f (H (z, 0)) = γ z + exact congrArg f (hH0 z) + · intro z + exact congrArg f (hH1 z) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2BacktrackInside.lean b/LeanPool/GraphMinor/GM12/Section2BacktrackInside.lean new file mode 100644 index 0000000000..2042b780cb --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2BacktrackInside.lean @@ -0,0 +1,112 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2InsideHomotopy +public import LeanPool.GraphMinor.GM12.Section2NormalNoncover +public import LeanPool.GraphMinor.GM12.Section2Zero +import LeanPool.GraphMinor.GM11.LocalCone +import LeanPool.GraphMinor.GM11.Walks + +/-! +# The inside in the one-visit backtracking case + +In Case 1 of XII (2.1), page 244, a trace may go along one spoke +and return along the same spoke. A deformation to that line makes +the original circle null-homotopic in its region together with its +boundary vertex. A point of the drawing outside the selected disc +is also outside that set. The two-point contraction criterion then +puts the selected disc in that set. Its only possible atoms are +the region and the boundary vertex, both met by the trace. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A selected boundary disc lies in the region with its boundary +vertex restored whenever its embedded boundary contracts there. +This is the inside assertion in XII (2.1), Case 1's backtracking case. -/ +theorem selected_disc_subset_region_vertex_of_null + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) + {φ : C(Circle, S)} (hφ : IsEmbedding φ) (hn : Γ.IsNormal (range φ)) + {r D : Set S} {v : S} (hr : r ∈ Γ.R) (hvφ : v ∈ range φ) + (hD : IsClosedDisc D) (hbd : subBd D = range φ) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + (hnull : ClosedCurveIsNullHomotopicIn (r ∪ {v}) φ) : D ⊆ r ∪ {v} := by + have hnf : (PaintingOrDrawing.drawing Γ).IsNormal (frontier D) := by + rw [← subBd_eq_frontier, hbd] + exact hn + obtain ⟨q, hqΓ, hqD, _⟩ := exists_support_point_outside_two_small_sides + (Γ := .drawing Γ) hT hD.isCompact.isClosed hD.isCompact.isClosed hnf hnf hm hm + have hvD : v ∈ D := by + have hvb : v ∈ subBd D := hbd.symm ▸ hvφ + exact hD.isCompact.isClosed.closure_subset_iff.mpr subset_rfl hvb.1 + have hqZ : q ∉ r ∪ {v} := by + rintro (hqr | hqv) + · exact region_subset hr hqr hqΓ + · exact hqD (hqv.symm ▸ hvD) + intro p hpD + by_contra hpZ + have hZpair : r ∪ {v} ⊆ ({p, q} : Set S)ᶜ := by + intro x hx hpair + simp only [mem_insert_iff, mem_singleton_iff] at hpair + rcases hpair with hxp | hxq + · exact hpZ (hxp ▸ hx) + · exact hqZ (hxq ▸ hx) + obtain ⟨c, hc, H⟩ := hnull + have hnPair : ClosedCurveIsNullHomotopicIn ({p, q} : Set S)ᶜ φ := + ⟨c, hZpair hc, H.mono hZpair⟩ + exact ((curve_null_in_pair_compl_iff_not_mem_disc hS hφ hD hbd hqD).mp hnPair) hpD + +/-- Deformation to a line in the region with its boundary vertex +restored supplies the contraction used in the backtracking case. -/ +theorem selected_disc_subset_region_vertex_of_line_deformation + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) + {φ ψ : C(Circle, S)} (hφ : IsEmbedding φ) (hn : Γ.IsNormal (range φ)) + {r D L : Set S} {v : S} (hr : r ∈ Γ.R) (hvφ : v ∈ range φ) + (hD : IsClosedDisc D) (hbd : subBd D = range φ) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + (hL : IsLine L) (hLZ : L ⊆ r ∪ {v}) (hψL : range ψ ⊆ L) + (hh : ClosedCurvesHomotopicIn (r ∪ {v}) φ ψ) : D ⊆ r ∪ {v} := by + apply selected_disc_subset_region_vertex_of_null hS hT hφ hn hr hvφ hD hbd hm + exact GM11.null_of_homotopic hLZ hh ((GM11.IsLine.isSimplyConnected hL).2 ψ hψL) + +/-- Every atom meeting a disc contained in a region and one drawing +vertex meets any trace containing that vertex and the region's hub. -/ +theorem meets_insWalk_of_subset_region_vertex + {S : Type*} [TopologicalSpace S] [T1Space S] {Γ K : Drawing S} + {r D c : Set S} {v w u : S} (hr : r ∈ Γ.R) + (hD : D ⊆ r ∪ {v}) (hc : c ∈ Γ.A) (hcD : (c ∩ D).Nonempty) + (W : GraphWalk K.toGraph u u) (hvW : v ∈ W.support) (hwW : w ∈ W.support) (hw : w ∈ r) + (ins : Drawing S → Set S) : (c ∩ insWalk ins K W).Nonempty := by + have recorded : ∀ x ∈ W.support, x ∈ insWalk ins K W := by + intro x hx + apply Or.inl + apply (walkDrawing K W).V_subset_U + rw [walkDrawing_V] + exact hx + obtain ⟨x, hxc, hxD⟩ := hcD + rcases hD hxD with hxr | hxv + · have hcr := atom_eq_region_of_meets hc hr ⟨x, hxc, hxr⟩ + exact ⟨w, hcr.symm ▸ hw, recorded w hwW⟩ + · have hvc : v ∈ c := hxv ▸ hxc + exact ⟨v, hvc, recorded v hvW⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2Case1.lean b/LeanPool/GraphMinor/GM12/Section2Case1.lean new file mode 100644 index 0000000000..d37e07d77e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2Case1.lean @@ -0,0 +1,126 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2DeformationConclusion +public import LeanPool.GraphMinor.GM12.Section2PartitionDeformation +public import LeanPool.GraphMinor.GM12.Section2TraceSubdivision +import LeanPool.GraphMinor.GM12.Section2VisitCarrier +import LeanPool.GraphMinor.GM12.Section2DistinctVisits +import LeanPool.GraphMinor.GM12.Section2DistinctRegionPaths +import LeanPool.GraphMinor.GM12.Section2TraceDeterminacy +import LeanPool.GraphMinor.GM12.Section2TraceImage +import LeanPool.GraphMinor.GM12.Section2PeriodicHits +import LeanPool.GraphMinor.GM12.Section2 + +/-! +# Case 1 of Graph Minors XII (2.1) + +If every region intersection of the original simple circle is +connected, its ordered region visits are distinct. Deform each +visit to its two spokes and join these deformations around the +circle. Trace determinacy identifies the resulting drawing with +the original trace. The joined curve is embedded unless a visit +backtracks along one spoke. Such a visit has equal ends, so the +original embedded circle has only one vertex visit and the whole +trace is a line. Apply the selected-inside comparison in the circle +case, and the contraction argument in the line case. This follows +Case 1 on page 244, making its continuous deformation explicit. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM07 + +/-- Graph Minors XII, (2.1), Case 1, page 244. If each region +intersection of the embedded original curve is preconnected, every +atom meeting its selected inside meets the trace inside. -/ +theorem theorem_2_1_case1 + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + {φ : C(Circle, S)} (hφ : IsEmbedding φ) {u : S} (W : GraphWalk K.toGraph u u) + (hW : IsTrace Γ K φ W) (hpos : 0 < curveLength Γ φ) (hlen : curveLength Γ φ < θ) + (hconn : ∀ r ∈ Γ.R, IsPreconnected (range φ ∩ r)) + {D c : Set S} (hD : IsClosedDisc D) (hbdD : subBd D = range φ) + (hmD : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + (hc : c ∈ Γ.A) (hcD : (c ∩ D).Nonempty) : + (c ∩ insWalk ins K W).Nonempty := by + obtain ⟨n, t, r, hn, ht, hperiod, _, hΓ, hsteps, hr, hfr⟩ := exists_trace_subdivision W hW hpos + obtain ⟨Z, hφZ, hrZ, hZorig, hZregion⟩ := exists_region_visit_carrier t hperiod hΓ r hr hfr + have hfu := (traceSteps_parameters W hsteps).2.1 + have hdeform := exists_partition_trace_deformation hS hK hE hφZ hn t ht hperiod hΓ r hr hrZ hfr + rw [hfu] at hdeform + obtain ⟨δ, hmatch, Q, hQ, _, hψUQ, hh, hδ0, hδ1, hδr, halt⟩ := hdeform + let ψ := concatLoop hn δ hmatch + have hWQ := traceSteps_drawing_unique hS inferInstance hK (periodicCurve_continuous φ) W Q hsteps + hQ + have hψU : range ψ = (walkDrawing K W).U := hψUQ.trans (congrArg Drawing.U hWQ.symm) + have hZΓ : Z ∩ Γ.U ⊆ range ψ := by + intro x hx + have hxW := trace_vertex_in_image W hW (hZorig hx).1 (hZorig hx).2 + have hxU : x ∈ (walkDrawing K W).U := by + apply (walkDrawing K W).V_subset_U + rw [walkDrawing_V] + exact hxW + exact hψU.symm ▸ hxU + have hZR : ∀ R ∈ Γ.R, (Z ∩ R).Nonempty → (range ψ ∩ R).Nonempty := by + intro R hR hmeet + obtain ⟨i, hRi⟩ := hZregion R hR hmeet + subst R + let half : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + refine ⟨δ i half, ?_, hδr i half (by change (0 : ℝ) < 1 / 2; norm_num) + (by change (1 / 2 : ℝ) < 1; norm_num)⟩ + change δ i half ∈ range (concatLoop hn δ hmatch) + rw [range_concatLoop] + exact mem_iUnion.mpr ⟨i, half, rfl⟩ + have hVi := vertex_visits_injective hφ.injective t ht hperiod + by_cases hall : ∀ i, InjOn (δ i) (Ico (0 : unitInterval) 1) + · have hRi := region_visits_injective hφ hconn t ht hperiod hΓ r hr hfr + have hψ := concatLoop_isEmbedding_of_distinct_regions hn (fun i => hΓ i.castSucc) + hVi hr hRi δ hall hδ0 hδr hmatch + exact meets_insWalk_of_embedded_trace_deformation hS hT hK hd hφ hψ hW.1.2 W + (theorem_2_1_length hW hlen) hψU hD hbdD hmD hh hZΓ hZR hc hcD + · obtain ⟨i, hi⟩ := not_forall.mp hall + rcases halt i with h | ⟨heq, L, hL, hδL, _⟩ + · exact (hi h).elim + · have hn1 : n = 1 := by + by_contra hn1 + have hn2 : 2 ≤ n := by omega + have hnext := hVi (heq.trans (periodic_value_succ_eq_next (periodicCurve_periodic φ) hn t + hperiod i)) + exact finNext_ne_of_two_le hn2 i hnext.symm + have hji : ∀ j : Fin n, j = i := by + intro j + apply Fin.ext + have hj := j.isLt + have hi := i.isLt + omega + have hψL : range ψ = L := by + change range (concatLoop hn δ hmatch) = L + rw [range_concatLoop] + have hu : (⋃ j, range (δ j)) = range (δ i) := by + ext x + constructor + · intro hx + obtain ⟨j, hj⟩ := mem_iUnion.mp hx + exact hji j ▸ hj + · intro hx + exact mem_iUnion.mpr ⟨i, hx⟩ + exact hu.trans hδL + exact meets_insWalk_of_line_trace_deformation hS hT hφ hW.1.2 W hψU hD hbdD hmD + hh hL hψL (fun x hx => (hZorig hx).1) hZΓ hZR hc hcD ins + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2Case2Induction.lean b/LeanPool/GraphMinor/GM12/Section2Case2Induction.lean new file mode 100644 index 0000000000..84ba6633fb --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2Case2Induction.lean @@ -0,0 +1,62 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2Case2Trace +import LeanPool.GraphMinor.GM12.Section2WalkInside + +/-! +# The inductive conclusion in Case 2 of XII (2.1) + +Apply the inductive hypothesis to the smaller circle and trace +constructed by the theta-disc argument. Its selected inside still +meets the chosen atom. Its trace drawing is contained in the original +trace drawing, so monotonicity of walk insides gives the conclusion +for the original curve. This is the last step of Case 2 on page 244. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Case 2 of XII (2.1), page 244, from the inductive assertion for +all strictly smaller positive lengths. -/ +theorem theorem_2_1_case2 + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + {φ : C(Circle, S)} (hφi : Function.Injective φ) (hF : IsOArc (range φ)) + {u : S} (W : GraphWalk K.toGraph u u) (hW : IsTrace Γ K φ W) + (hcount : curveLength Γ φ < θ) + {r Δ C : Set S} (hr : r ∈ Γ.R) (hdisconn : ¬ IsPreconnected (range φ ∩ r)) + (hΔ : IsClosedDisc Δ) (hbd : subBd Δ = range φ) + (hm : ((PaintingOrDrawing.drawing Γ).inter Δ, + (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T) + (hC : (C ∩ Δ).Nonempty) + {ins : Drawing S → Set S} + (hInd : ∀ (ψ : C(Circle, S)), IsEmbedding ψ → + 0 < curveLength Γ ψ → curveLength Γ ψ < curveLength Γ φ → + ∀ (v : S) (P : GraphWalk K.toGraph v v), IsTrace Γ K ψ P → + ∀ D : Set S, IsClosedDisc D → subBd D = range ψ → + ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T → + (C ∩ D).Nonempty → (C ∩ insWalk ins K P).Nonempty) : + (C ∩ insWalk ins K W).Nonempty := by + obtain ⟨ψ, D, v, P, hψemb, hP, hψpos, hsmall, hD, hbdD, hmD, hCD, hsub⟩ := + theorem_2_1_case2_smaller_trace hS hK hE hT hrespect hφi hF W hW hcount + hr hdisconn hΔ hbd hm hC + exact meets_insWalk_of_subdrawing ins K W P hsub + (hInd ψ hψemb hψpos hsmall v P hP D hD hbdD hmD hCD) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2Case2Inside.lean b/LeanPool/GraphMinor/GM12/Section2Case2Inside.lean new file mode 100644 index 0000000000..45589ccc3d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2Case2Inside.lean @@ -0,0 +1,110 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2ThetaConstruction +public import LeanPool.GraphMinor.GM12.Section2ThetaDiscs +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# The smaller selected inside in Case 2 of XII (2.1) + +When a simple normal circle visits a region in more than one component, +the minimal chord produces two smaller normal circles. Respectfulness +selects discs for them. The second tangle axiom and the theta-disc union +relation show that an atom meeting the original selected disc meets +one of these smaller selected discs. This is the geometric reduction +before applying induction to their traces. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The geometric induction reduction in Case 2 of Graph Minors XII, +(2.1), page 244. A repeated region gives a strictly smaller normal circle +whose tangle-selected disc still meets the specified atom. -/ +theorem theorem_2_1_case2_smaller_inside {S : Type*} [TopologicalSpace S] + [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + {F Δ C r : Set S} (hF : IsOArc F) (hFn : Γ.IsNormal F) + (hcount : (F ∩ Γ.V).ncard < θ) (hr : r ∈ Γ.R) + (hdisconn : ¬ IsPreconnected (F ∩ r)) + (hΔ : IsClosedDisc Δ) (hbd : subBd Δ = F) + (hm : ((PaintingOrDrawing.drawing Γ).inter Δ, + (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T) + (hC : (C ∩ Δ).Nonempty) : + ∃ F' Δ' : Set S, IsOArc F' ∧ Γ.IsNormal F' ∧ + (F' ∩ Γ.V).ncard < (F ∩ Γ.V).ncard ∧ IsClosedDisc Δ' ∧ subBd Δ' = F' ∧ + ((PaintingOrDrawing.drawing Γ).inter Δ', + (PaintingOrDrawing.drawing Γ).interOutside Δ') ∈ T ∧ (C ∩ Δ').Nonempty ∧ + (F' ∩ Γ.V).Nonempty ∧ + ∃ L : Set S, IsClosed L ∧ Disjoint L Γ.V ∧ F' ⊆ F ∪ L := by + obtain ⟨L, A, B, a, b, hL, hA, hB, hABF, hLA, hLB, hAB, hLr, + hLAo, hLBo, hLAn, hLBn, hAV, hBV⟩ := + exists_theta_of_disconnected_region_intersection hS hr hF hFn hdisconn + have hLU : Disjoint L Γ.U := Set.disjoint_left.mpr fun z hz => region_subset hr (hLr hz) + have hLV : Disjoint L Γ.V := hLU.mono_right Γ.V_subset_U + have hABV : Disjoint (A ∩ B) Γ.V := by + apply Set.disjoint_left.mpr + intro z hz hzV + have hend : z ∈ ({a, b} : Set S) := hAB ▸ hz + have hzL : z ∈ L := (hLA.symm ▸ hend).1 + exact Set.disjoint_left.mp hLV hzL hzV + have hsmall := chord_circle_vertex_counts_lt Γ.finite_V hLV hABV hAV hBV + have hcLA : ((L ∪ A) ∩ Γ.V).ncard < (F ∩ Γ.V).ncard := by + rw [union_comm L A, ← hABF] + exact hsmall.1 + have hcLB : ((L ∪ B) ∩ Γ.V).ncard < (F ∩ Γ.V).ncard := by + rw [union_comm L B, ← hABF] + exact hsmall.2 + obtain ⟨Δ₁, hd₁, hb₁, hm₁⟩ := hrespect.2 (L ∪ B) hLBo hLBn (hcLB.trans hcount) + obtain ⟨Δ₂, hd₂, hb₂, hm₂⟩ := hrespect.2 (L ∪ A) hLAo hLAn (hcLA.trans hcount) + have frontier_bd : ∀ {D : Set S}, IsClosedDisc D → subBd D = discBd D := by + intro D hd + rw [subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hS hd] + have f₀ : discBd Δ = A ∪ B := (frontier_bd hΔ).symm.trans (hbd.trans hABF.symm) + have f₁ : discBd Δ₁ = B ∪ L := + (frontier_bd hd₁).symm.trans (hb₁.trans (union_comm L B)) + have f₂ : discBd Δ₂ = L ∪ A := (frontier_bd hd₂).symm.trans hb₂ + have n₀ : (PaintingOrDrawing.drawing Γ).IsNormal (discBd Δ) := by + rw [f₀, hABF] + exact hFn + have n₁ : (PaintingOrDrawing.drawing Γ).IsNormal (discBd Δ₁) := by + rw [← frontier_bd hd₁, hb₁] + exact hLBn + have n₂ : (PaintingOrDrawing.drawing Γ).IsNormal (discBd Δ₂) := by + rw [f₂] + exact hLAn + have hiBL : B ∩ L = {a, b} := (inter_comm B L).trans hLB + have hmeet := theorem_2_1_case2_disc_step (Γ := PaintingOrDrawing.drawing Γ) hS hT hL hA hB hLA + hAB hiBL + hΔ hd₁ hd₂ f₀ f₁ f₂ n₀ n₁ n₂ hm hm₁ hm₂ hC + rcases hmeet with hmeet | hmeet + · refine ⟨L ∪ B, Δ₁, hLBo, hLBn, hcLB, hd₁, hb₁, hm₁, hmeet, + hBV.mono (inter_subset_inter_left Γ.V subset_union_right), + L, hL.isCompact.isClosed, hLV, ?_⟩ + intro x hx + rcases hx with hx | hx + · exact Or.inr hx + · exact Or.inl (hABF ▸ Or.inr hx) + · refine ⟨L ∪ A, Δ₂, hLAo, hLAn, hcLA, hd₂, hb₂, hm₂, hmeet, + hAV.mono (inter_subset_inter_left Γ.V subset_union_right), + L, hL.isCompact.isClosed, hLV, ?_⟩ + intro x hx + rcases hx with hx | hx + · exact Or.inr hx + · exact Or.inl (hABF ▸ Or.inl hx) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2Case2Trace.lean b/LeanPool/GraphMinor/GM12/Section2Case2Trace.lean new file mode 100644 index 0000000000..46a6d9f237 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2Case2Trace.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2Case2Inside +public import LeanPool.GraphMinor.GM12.Section2ChordTraceRestriction +import LeanPool.GraphMinor.GM12.Section2TraceExistence +import LeanPool.GraphMinor.GM12.Section2CurveCounts + +/-! +# The smaller trace in Case 2 of XII (2.1) + +A repeated region gives the two circles formed by a minimal region +chord. The theta-disc argument selects a smaller circle whose inside +still meets the chosen atom. Parameterize that circle injectively +and construct its trace. The chord avoids all drawing vertices, so +the chord trace restriction theorem makes this trace a subdrawing +of the original trace. Its positive, strictly smaller curve length +is precisely what the induction in XII (2.1), page 244, needs. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The full smaller-curve and smaller-trace construction in Case 2 +of XII (2.1), page 244. The selected inside still meets the specified +set, and the trace lies in the original trace drawing. -/ +theorem theorem_2_1_case2_smaller_trace + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + {φ : C(Circle, S)} (hφi : Function.Injective φ) (hF : IsOArc (range φ)) + {u : S} (W : GraphWalk K.toGraph u u) (hW : IsTrace Γ K φ W) + (hcount : curveLength Γ φ < θ) + {r Δ C : Set S} (hr : r ∈ Γ.R) (hdisconn : ¬ IsPreconnected (range φ ∩ r)) + (hΔ : IsClosedDisc Δ) (hbd : subBd Δ = range φ) + (hm : ((PaintingOrDrawing.drawing Γ).inter Δ, + (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T) + (hC : (C ∩ Δ).Nonempty) : + ∃ (ψ : C(Circle, S)) (Δ' : Set S) (v : S) (P : GraphWalk K.toGraph v v), + IsEmbedding ψ ∧ IsTrace Γ K ψ P ∧ + 0 < curveLength Γ ψ ∧ curveLength Γ ψ < curveLength Γ φ ∧ + IsClosedDisc Δ' ∧ subBd Δ' = range ψ ∧ + ((PaintingOrDrawing.drawing Γ).inter Δ', + (PaintingOrDrawing.drawing Γ).interOutside Δ') ∈ T ∧ + (C ∩ Δ').Nonempty ∧ (walkDrawing K P).IsSubdrawing (walkDrawing K W) := by + have hφlength := curveLength_eq_vertex_count φ hφi hW.1.2 + have hcount' : (range φ ∩ Γ.V).ncard < θ := hφlength ▸ hcount + obtain ⟨F', Δ', hF', hn', hsmall, hΔ', hbd', hm', hC', hFV', L, hL, hLV, hsub⟩ := + theorem_2_1_case2_smaller_inside hS hT hrespect hF hW.1.2 hcount' hr hdisconn hΔ hbd hm hC + obtain ⟨H⟩ := hF' + let ψ : C(Circle, S) := ⟨fun t => (H t).val, continuous_subtype_val.comp H.continuous⟩ + have hψrange : range ψ = F' := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (H t).property + · intro hx + refine ⟨H.symm ⟨x, hx⟩, ?_⟩ + exact congrArg Subtype.val (H.apply_symm_apply ⟨x, hx⟩) + have hψemb : IsEmbedding ψ := IsEmbedding.subtypeVal.comp H.isEmbedding + have hψn : Γ.IsNormal (range ψ) := hψrange.symm ▸ hn' + have hψ : IsNormalCurve Γ ψ := isNormalCurve_of_injective ψ hψemb.injective hψn + have hψlength : curveLength Γ ψ = (F' ∩ Γ.V).ncard := by + rw [curveLength_eq_vertex_count ψ hψemb.injective hψn, hψrange] + have hψpos : 0 < curveLength Γ ψ := by + rw [hψlength] + exact (Set.ncard_pos (Γ.finite_V.subset inter_subset_right)).mpr hFV' + obtain ⟨v, P, hP⟩ := exists_trace hS hK hE hψ + have hPpos : 0 < P.length := by + rcases hP.2 with ⟨hzero, _⟩ | ⟨_, hlen, _⟩ + · exact (not_lt_of_ge hzero.le hψpos).elim + · omega + have hsub' : range ψ ⊆ range φ ∪ L := hψrange.symm ▸ hsub + refine ⟨ψ, Δ', v, P, hψemb, hP, hψpos, ?_, hΔ', hbd'.trans hψrange.symm, + hm', hC', trace_isSubdrawing_of_range_subset_union hS hK hE W P hW hP hPpos hL hLV hsub'⟩ + rw [hψlength, hφlength] + exact hsmall + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2ChordGap.lean b/LeanPool/GraphMinor/GM12/Section2ChordGap.lean new file mode 100644 index 0000000000..c9ee62ca1f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2ChordGap.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# The minimal chord in the second case of XII (2.1) + +On page 244, the proof joins two components of the curve in one region +and takes a minimal line between them. Along an arc joining two disjoint +closed sets, first take the first point of the second set, then the last +point of the first set before it. The open segment between these points +misses both sets. Applied to one component and the union of the others, +this gives the required minimal line. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Along a continuous curve from one disjoint closed set to another, +there is an interval with its ends in the two sets and its interior +outside both. Only closedness of their parameter preimages is needed. -/ +theorem exists_parameter_gap {S : Type*} {g : unitInterval → S} {A B : Set S} + (hA : IsClosed (g ⁻¹' A)) (hB : IsClosed (g ⁻¹' B)) + (hdis : Disjoint A B) (h0 : g 0 ∈ A) (h1 : g 1 ∈ B) : + ∃ a b : unitInterval, a < b ∧ g a ∈ A ∧ g b ∈ B ∧ + ∀ t ∈ Ioo a b, g t ∉ A ∪ B := by + obtain ⟨b, hb, hbmin⟩ := hB.isCompact.exists_isLeast ⟨1, h1⟩ + have h0b : (0 : unitInterval) ≤ b := b.property.1 + have hAc : IsCompact ((g ⁻¹' A) ∩ Iic b) := (hA.inter isClosed_Iic).isCompact + obtain ⟨a, ⟨ha, hab⟩, hamax⟩ := hAc.exists_isGreatest ⟨0, h0, h0b⟩ + have hab' : a < b := lt_of_le_of_ne hab (by + intro heq + exact Set.disjoint_left.mp hdis ha (heq.symm ▸ hb)) + refine ⟨a, b, hab', ha, hb, ?_⟩ + intro t ht hmem + rcases hmem with htA | htB + · exact ht.1.not_ge (hamax ⟨htA, ht.2.le⟩) + · exact ht.2.not_ge (hbmin htB) + +/-- The minimal-line construction in Case 2 of XII (2.1), page 244. +An arc in the region joining two disjoint closed pieces of the curve +contains a subline whose interior misses the curve. -/ +theorem exists_minimal_region_chord {S : Type*} [TopologicalSpace S] [T2Space S] + {r F A B : Set S} {g : unitInterval → S} (hg : Continuous g) + (hinj : Function.Injective g) (hgr : range g ⊆ r) + (hcover : F ∩ r ⊆ A ∪ B) + (hA : IsClosed (g ⁻¹' A)) (hB : IsClosed (g ⁻¹' B)) + (hdis : Disjoint A B) (h0 : g 0 ∈ A) (h1 : g 1 ∈ B) : + ∃ (L : Set S) (a b : S), IsLineWithEnds L a b ∧ L ⊆ r ∧ + a ∈ A ∧ b ∈ B ∧ a ≠ b ∧ Disjoint (L \ {a, b}) F := by + obtain ⟨s, t, hst, hsA, htB, hgap⟩ := exists_parameter_gap hA hB hdis h0 h1 + refine ⟨g '' Icc s t, g s, g t, isLine_piece hg hinj hst, + (image_subset_range _ _).trans hgr, hsA, htB, ?_, Set.disjoint_left.mpr ?_⟩ + · exact fun h => hst.ne (hinj h) + · rintro x ⟨⟨u, hu, rfl⟩, hends⟩ huF + have hus : s < u := lt_of_le_of_ne hu.1 (by + intro heq + exact hends (Or.inl (congrArg g heq.symm))) + have hut : u < t := lt_of_le_of_ne hu.2 (by + intro heq + exact hends (Or.inr (congrArg g heq))) + exact hgap u ⟨hus, hut⟩ (hcover ⟨huF, hgr (mem_range_self u)⟩) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2ChordTraceRestriction.lean b/LeanPool/GraphMinor/GM12/Section2ChordTraceRestriction.lean new file mode 100644 index 0000000000..7500bcee51 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2ChordTraceRestriction.lean @@ -0,0 +1,129 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2LocalImageRestriction +import LeanPool.GraphMinor.GM12.Section2PeriodicHits +import LeanPool.GraphMinor.GM11.Section4 +import LeanPool.GraphMinor.GM11.Walks + +/-! +# The smaller trace after adding a region chord + +In Case 2 of XII (2.1), page 244, each smaller circle lies in the +original circle together with a closed region chord. The chord misses +the drawing vertices. Hence every entry and exit of its trace is +already recorded in the original trace. A positive-length walk has +no isolated support vertex, so edge containment also gives vertex +containment. This proves the subdrawing inclusion needed after the +inductive hypothesis. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +private theorem support_subset_of_edges_subset + {α β : Type*} {G : Graph α β} {u v x y : α} + (W : GraphWalk G u v) (P : GraphWalk G x y) (hpos : 0 < P.length) + (hE : ∀ e ∈ P.edges, e ∈ W.edges) : ∀ z ∈ P.support, z ∈ W.support := by + cases hPcase : P with + | nil hx => + rw [hPcase] at hpos + simp only [GraphWalk.length_nil, lt_self_iff_false] at hpos + | @cons _ _ _ e₀ hl rest => + rw [hPcase] at hE hpos + have he := hE e₀ (by simp only [GraphWalk.edges, List.mem_cons]; exact Or.inl trivial) + intro z hz + simp only [GraphWalk.support, List.mem_cons] at hz + rcases hz with rfl | hz + · exact W.left_mem_support_of_mem_edges he hl + · cases hrestcase : rest with + | nil hy => + rw [hrestcase] at hz + have hzy : z = y := by simpa only [GraphWalk.support, List.mem_singleton] using hz + subst z + exact W.left_mem_support_of_mem_edges he hl.symm + | cons hl' tail => + rw [hrestcase] at hz hE + exact support_subset_of_edges_subset W (GraphWalk.cons hl' tail) + (by simp only [GraphWalk.length_cons]; omega) + (fun e he => hE e (by + simp only [GraphWalk.edges, List.mem_cons] at he ⊢ + exact Or.inr he)) z hz +termination_by P.length +decreasing_by + simp_all only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +private theorem traceSteps_edges_subset_off_closed_set + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {φ : C(Circle, S)} {u : S} (W : GraphWalk K.toGraph u u) (hW : IsTrace Γ K φ W) + {L : Set S} (hL : IsClosed L) (hLV : Disjoint L Γ.V) + {g : ℝ → S} (hg : Continuous g) (himage : ∀ t, g t ∈ range φ ∪ L) + {a b : ℝ} {v z : S} (P : GraphWalk K.toGraph v z) (hP : TraceSteps Γ K g a b P) : + ∀ e ∈ P.edges, e ∈ W.edges := by + cases hPcase : P with + | nil hv => simp only [GraphWalk.edges, List.not_mem_nil, false_implies, implies_true] + | cons hlink rest => + rw [hPcase] at hP + cases hrestcase : rest with + | nil hv => rw [hrestcase] at hP; exact hP.elim + | cons hlink' tail => + rw [hrestcase] at hP + obtain ⟨c, hac, hga, hv, hgc, hwK, r, hr, hwr, hgr, hleave, henter, htail⟩ := hP + have hx := (traceSteps_parameters tail htail).2.2.1 + have hfirst := trace_mem_edges_of_leaving_off_closed_set hS hK hE W hW hL hLV hv hr + ⟨hwr, hwK⟩ hlink.1 hg hac hga hgr (fun t _ => himage t) hleave + have hsecond := trace_mem_edges_of_entry_off_closed_set hS hK hE W hW hL hLV hx hr + ⟨hwr, hwK⟩ hlink'.1 hg hac hgc hgr (fun t _ => himage t) henter + have hrest := traceSteps_edges_subset_off_closed_set hS hK hE W hW hL hLV hg himage tail htail + intro e he + simp only [GraphWalk.edges, List.mem_cons] at he + rcases he with rfl | rfl | he + · exact hfirst + · exact hsecond + · exact hrest e he +termination_by P.length +decreasing_by + simp_all only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +/-- A positive-length trace of a curve in the original image together +with a closed chord avoiding drawing vertices is a subdrawing of +the original trace, as required in XII (2.1), Case 2, page 244. -/ +theorem trace_isSubdrawing_of_range_subset_union + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {φ ψ : C(Circle, S)} {u v : S} + (W : GraphWalk K.toGraph u u) (P : GraphWalk K.toGraph v v) + (hW : IsTrace Γ K φ W) (hP : IsTrace Γ K ψ P) (hpos : 0 < P.length) + {L : Set S} (hL : IsClosed L) (hLV : Disjoint L Γ.V) + (hsub : range ψ ⊆ range φ ∪ L) : + (walkDrawing K P).IsSubdrawing (walkDrawing K W) := by + have hmem : ∀ e ∈ P.edges, e ∈ W.edges := by + rcases hP.2 with ⟨_, hlen, _⟩ | ⟨_, _, a, hsteps⟩ + · exact (not_lt_of_ge hlen.le hpos).elim + · exact traceSteps_edges_subset_off_closed_set hS hK hE W hW hL hLV + (periodicCurve_continuous ψ) + (fun t => hsub (mem_range_self (Circle.exp (2 * Real.pi * t)))) P hsteps + refine ⟨?_, ?_⟩ + · intro z hz + rw [walkDrawing_V] at hz ⊢ + exact support_subset_of_edges_subset W P hpos hmem z hz + · intro e he + rw [walkDrawing_E] at he ⊢ + exact hmem e he + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2CirclePeriod.lean b/LeanPool/GraphMinor/GM12/Section2CirclePeriod.lean new file mode 100644 index 0000000000..4afb5a61ea --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2CirclePeriod.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Analysis.SpecialFunctions.Complex.Circle +import Mathlib.Algebra.Field.Periodic + +/-! +# One real period parametrizes the circle once + +The trace definition of XII, page 243, uses a period of a closed curve. +The map `t ↦ exp(2πt)` is periodic with period one and restricts to a +bijection from every half-open interval of length one onto the circle. +This identifies its real-parameter vertex hits with its circle hits. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- The circle parameter used by XII's periodic curve has period one. -/ +theorem circle_parameter_periodic : + Function.Periodic (fun t : ℝ => Circle.exp (2 * Real.pi * t)) 1 := by + intro t + change Circle.exp (2 * Real.pi * (t + 1)) = Circle.exp (2 * Real.pi * t) + rw [mul_add, mul_one] + exact Circle.periodic_exp _ + +/-- The real circle parameter is injective on each half-open period. -/ +theorem circle_parameter_injOn (a : ℝ) : + InjOn (fun t : ℝ => Circle.exp (2 * Real.pi * t)) (Ico a (a + 1)) := by + intro x hx y hy hxy + have hpos : 0 < 2 * Real.pi := Real.two_pi_pos + have hmem : ∀ t ∈ Ico a (a + 1), + 2 * Real.pi * t ∈ Ico (2 * Real.pi * a) (2 * Real.pi * (a + 1)) := by + intro t ht + exact ⟨mul_le_mul_of_nonneg_left ht.1 hpos.le, mul_lt_mul_of_pos_left ht.2 hpos⟩ + have heq := Circle.exp_injOn_Ico (a := 2 * Real.pi * a) (b := 2 * Real.pi * (a + 1)) + (by ring_nf; exact le_rfl) (hmem x hx) (hmem y hy) hxy + exact mul_left_cancel₀ (ne_of_gt hpos) heq + +/-- Each half-open real period parametrizes the whole circle exactly once. -/ +theorem circle_parameter_bijOn (a : ℝ) : + BijOn (fun t : ℝ => Circle.exp (2 * Real.pi * t)) (Ico a (a + 1)) univ := by + refine ⟨fun _ _ => mem_univ _, circle_parameter_injOn a, ?_⟩ + intro z _ + obtain ⟨θ, hθ⟩ := Circle.exp_surjective z + let t := θ / (2 * Real.pi) + have ht : Circle.exp (2 * Real.pi * t) = z := by + rw [mul_div_cancel₀ _ (ne_of_gt Real.two_pi_pos)] + exact hθ + obtain ⟨s, hs, hts⟩ := circle_parameter_periodic.exists_mem_Ico (by norm_num : (0 : ℝ) < 1) t a + exact ⟨s, hs, hts.symm.trans ht⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2CommonCornerEntry.lean b/LeanPool/GraphMinor/GM12/Section2CommonCornerEntry.lean new file mode 100644 index 0000000000..dab9cc0498 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2CommonCornerEntry.lean @@ -0,0 +1,123 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM12.Section2EntryAtPath +import LeanPool.GraphMinor.GM12.Section2CommonPatchSpokes +import LeanPool.GraphMinor.GM12.Section2SpokeUniqueness +import LeanPool.GraphMinor.GM12.Section2EntryEnds +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM12.Section2EntryPaths + +/-! +# Entry edges agree for approaches in the same corner + +For trace restriction in XII (2.1), pages 243--244, the original +curve and its simple subcurve can use different parameterizations. +Read their entry witnesses on normalized terminal paths. If these +paths lie in the same simply connected corner patch, joining their +starts inside the punctured patch makes their spokes homotopic. +The radial spoke uniqueness theorem then identifies the edges. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- Different approaches through one corner patch have the same +entry edge. This is the local comparison needed for the image +restriction argument in XII (2.1), pages 243--244. -/ +theorem entersLike_edge_eq_of_common_patch + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {r e e' X : Set S} {v w : S} (hr : r ∈ Γ.R) (hv : v ∈ Γ.V) + (hw : w ∈ r ∩ K.V) (he : e ∈ K.E) (he' : e' ∈ K.E) + (hX : IsSimplyConnectedSet X) (hXZ : X ⊆ r ∪ {v}) + (hpuncture : IsPathConnected (X \ {v})) (hXR : X \ {v} ⊆ r) + {f g : ℝ → S} (hf : Continuous f) (hg : Continuous g) + {a c b d s t : ℝ} (hs : s ∈ Ioo a c) (ht : t ∈ Ioo b d) + (hfc : f c = v) (hgd : g d = v) + (hfr : ∀ z ∈ Ioo a c, f z ∈ r) (hgr : ∀ z ∈ Ioo b d, g z ∈ r) + (hentry : EntersLike f a c e r v w) (hentry' : EntersLike g b d e' r v w) + {x y : (r ∪ {v} : Set S)} + (F : Path x (⟨v, Or.inr rfl⟩ : (r ∪ {v} : Set S))) + (G : Path y (⟨v, Or.inr rfl⟩ : (r ∪ {v} : Set S))) + (hF : ∀ z, (F z).val = f (s + z.val * (c - s))) + (hG : ∀ z, (G z).val = g (t + z.val * (d - t))) + (hFX : ∀ z, (F z).val ∈ X) (hGX : ∀ z, (G z).val ∈ X) + (hx : x.val ∈ X \ {v}) (hy : y.val ∈ X \ {v}) : e = e' := by + have hvE : v ∉ e := fun hz => (he.2.1 hz).2 (hK.2.1.2.1 hv) + have hwE : w ∉ e := fun hz => (he.2.1 hz).2 hw.2 + have hvE' : v ∉ e' := fun hz => (he'.2.1 hz).2 (hK.2.1.2.1 hv) + have hwE' : w ∉ e' := fun hz => (he'.2.1 hz).2 hw.2 + have hvw : v ≠ w := fun h => region_subset hr (h.symm ▸ hw.1) (Γ.V_subset_U hv) + obtain ⟨β, ρ, hβ, hβrange, _, hρ, hhom⟩ := + entry_comparison_at_path_start (hK.1.2 r hr) hw.1 hvE hwE hvw + hf hs hfc hfr hentry F hF + obtain ⟨β', ρ', hβ', hβrange', _, hρ', hhom'⟩ := + entry_comparison_at_path_start (hK.1.2 r hr) hw.1 hvE' hwE' hvw + hg ht hgd hgr hentry' G hG + have hh := spokes_homotopic_of_common_ambient_patch hX + (hK.1.2 r hr).isSimplyConnectedSet hXZ subset_union_left hpuncture hXR + F G β β' hFX hGX hx hy ρ ρ' hρ hρ' hhom hhom' + have hends := (entersLike_isLink hS ⟨hK.1, hK.2.1⟩ hr hv hw.1 hw.2 he hfc hentry).2.2.2 + have hends' := (entersLike_isLink hS ⟨hK.1, hK.2.1⟩ hr hv hw.1 hw.2 he' hgd hentry').2.2.2 + apply spoke_eq_of_paths_homotopic hS hConn hK.2.1 hr hv hw he he' hends hends' + β β' _ _ hβrange hβrange' hh + · intro z z' hzz + exact hβ (congrArg Subtype.val hzz) + · intro z z' hzz + exact hβ' (congrArg Subtype.val hzz) + +private theorem normalized_terminal_path + {S : Type*} [TopologicalSpace S] {r X : Set S} {v : S} + {f : ℝ → S} (hf : Continuous f) {a c s : ℝ} (hs : s ∈ Ioo a c) + (hfc : f c = v) (hfr : ∀ z ∈ Ioo a c, f z ∈ r) + (hX : ∀ z ∈ Icc s c, f z ∈ X) (hv : v ∉ r) : + ∃ (x : (r ∪ {v} : Set S)) + (F : Path x (⟨v, Or.inr rfl⟩ : (r ∪ {v} : Set S))), + (∀ z, (F z).val = f (s + z.val * (c - s))) ∧ + (∀ z, (F z).val ∈ X) ∧ x.val ∈ X \ {v} := by + obtain ⟨F, hF, -⟩ := exists_affine_approach_path hs.2 hf.continuousOn hfc + (fun t ht => hfr t ⟨hs.1.trans_le ht.1, ht.2⟩) + refine ⟨_, F, hF, fun t => ?_, hX s ⟨le_rfl, hs.2.le⟩, ?_⟩ + · rw [hF] + exact hX _ (affine_approach_parameter_mem_Icc hs.2.le t) + · intro heq + exact hv (heq ▸ hfr s hs) + +/-- The common-corner comparison expressed directly on terminal real +intervals. Only the terminal parts of the two approaches need to lie +in the patch; their earlier portions may differ arbitrarily. -/ +theorem entersLike_edge_eq_of_common_terminal_patch + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {r e e' X : Set S} {v w : S} (hr : r ∈ Γ.R) (hv : v ∈ Γ.V) + (hw : w ∈ r ∩ K.V) (he : e ∈ K.E) (he' : e' ∈ K.E) + (hX : IsSimplyConnectedSet X) (hXZ : X ⊆ r ∪ {v}) + (hpuncture : IsPathConnected (X \ {v})) (hXR : X \ {v} ⊆ r) + {f g : ℝ → S} (hf : Continuous f) (hg : Continuous g) + {a c b d s t : ℝ} (hs : s ∈ Ioo a c) (ht : t ∈ Ioo b d) + (hfc : f c = v) (hgd : g d = v) + (hfr : ∀ z ∈ Ioo a c, f z ∈ r) (hgr : ∀ z ∈ Ioo b d, g z ∈ r) + (hentry : EntersLike f a c e r v w) (hentry' : EntersLike g b d e' r v w) + (hfX : ∀ z ∈ Icc s c, f z ∈ X) (hgX : ∀ z ∈ Icc t d, g z ∈ X) : e = e' := by + have hvr : v ∉ r := fun hz => region_subset hr hz (Γ.V_subset_U hv) + obtain ⟨x, F, hF, hFX, hx⟩ := normalized_terminal_path hf hs hfc hfr hfX hvr + obtain ⟨y, G, hG, hGX, hy⟩ := normalized_terminal_path hg ht hgd hgr hgX hvr + exact entersLike_edge_eq_of_common_patch hS hConn hK hr hv hw he he' + hX hXZ hpuncture hXR hf hg hs ht hfc hgd hfr hgr hentry hentry' + F G hF hG hFX hGX hx hy + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2CommonPatchSpokes.lean b/LeanPool/GraphMinor/GM12/Section2CommonPatchSpokes.lean new file mode 100644 index 0000000000..7cb90f87b0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2CommonPatchSpokes.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2PathHomotopy +import LeanPool.GraphMinor.GM12.Section2SectorHomotopy + +/-! +# Comparing spokes after different approaches in one patch + +In the positive-length restriction step of XII (2.1), pages 243--244, +the simple subcurve may approach a vertex along a different path from +the original curve. If both approaches lie in one corner patch, join +their starting points in the punctured patch. Simple connectedness +makes the two approaches agree after this prefix. Their entry +comparisons then lie in the same simply connected region. Cancelling +the common approach proves that the two spokes are homotopic. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Entry comparisons for different approaches through the same +simply connected patch make the terminal spokes homotopic. The +puncture is used to join the two starting points inside the region. -/ +theorem spokes_homotopic_of_common_patch + {Z : Type*} [TopologicalSpace Z] {X R : Set Z} {v a b w : Z} + (hX : IsSimplyConnectedSet X) (hR : IsSimplyConnectedSet R) + (hpuncture : IsPathConnected (X \ {v})) (hXR : X \ {v} ⊆ R) + (p : Path a v) (q : Path b v) (α β : Path v w) + (hpX : ∀ t, p t ∈ X) (hqX : ∀ t, q t ∈ X) + (ha : a ∈ X \ {v}) (hb : b ∈ X \ {v}) + (ρ : Path a w) (σ : Path b w) + (hρ : ∀ t, ρ t ∈ R) (hσ : ∀ t, σ t ∈ R) + (hentry : (p.trans α).Homotopic ρ) (hentry' : (q.trans β).Homotopic σ) : + α.Homotopic β := by + obtain ⟨ℓ, hℓ⟩ := hpuncture.joinedIn a ha b hb + have hpq : p.Homotopic (ℓ.trans q) := by + apply paths_homotopic_of_range_in_simplyConnected hX p (ℓ.trans q) hpX + intro t + rw [Path.trans_apply] + split_ifs + · exact (hℓ _).1 + · exact hqX _ + have hsecond : (p.trans β).Homotopic (ℓ.trans σ) := + (hpq.hcomp (Path.Homotopic.refl β)).trans + ((Path.Homotopic.trans_assoc ℓ q β).trans + ((Path.Homotopic.refl ℓ).hcomp hentry')) + have hmiddle : ρ.Homotopic (ℓ.trans σ) := by + apply paths_homotopic_of_range_in_simplyConnected hR ρ (ℓ.trans σ) hρ + intro t + rw [Path.trans_apply] + split_ifs + · exact hXR (hℓ _) + · exact hσ _ + exact path_homotopic_cancel_left p α β (hentry.trans (hmiddle.trans hsecond.symm)) + +/-- The common-patch comparison in an ambient surface, with paths +read in a region together with its boundary vertex. Chart patches +need only be simply connected in the ambient surface. -/ +theorem spokes_homotopic_of_common_ambient_patch + {S : Type*} [TopologicalSpace S] {Z X R : Set S} {v a b w : Z} + (hX : IsSimplyConnectedSet X) (hR : IsSimplyConnectedSet R) + (hXZ : X ⊆ Z) (hRZ : R ⊆ Z) + (hpuncture : IsPathConnected (X \ {v.val})) (hXR : X \ {v.val} ⊆ R) + (p : Path a v) (q : Path b v) (α β : Path v w) + (hpX : ∀ t, (p t).val ∈ X) (hqX : ∀ t, (q t).val ∈ X) + (ha : a.val ∈ X \ {v.val}) (hb : b.val ∈ X \ {v.val}) + (ρ : Path a w) (σ : Path b w) + (hρ : ∀ t, (ρ t).val ∈ R) (hσ : ∀ t, (σ t).val ∈ R) + (hentry : (p.trans α).Homotopic ρ) (hentry' : (q.trans β).Homotopic σ) : + α.Homotopic β := by + obtain ⟨ℓ₀, hℓ₀⟩ := hpuncture.joinedIn a.val ha b.val hb + let ℓ : Path a b := { + toFun := fun t => ⟨ℓ₀ t, hXZ (hℓ₀ t).1⟩ + continuous_toFun := ℓ₀.continuous.subtype_mk _ + source' := Subtype.ext ℓ₀.source + target' := Subtype.ext ℓ₀.target } + have hpq : p.Homotopic (ℓ.trans q) := by + apply paths_homotopic_in_subspace_of_patch hX hXZ p (ℓ.trans q) hpX + intro t + rw [Path.trans_apply] + split_ifs + · exact (hℓ₀ _).1 + · exact hqX _ + have hsecond : (p.trans β).Homotopic (ℓ.trans σ) := + (hpq.hcomp (Path.Homotopic.refl β)).trans + ((Path.Homotopic.trans_assoc ℓ q β).trans + ((Path.Homotopic.refl ℓ).hcomp hentry')) + have hmiddle : ρ.Homotopic (ℓ.trans σ) := by + apply paths_homotopic_in_subspace_of_patch hR hRZ ρ (ℓ.trans σ) hρ + intro t + rw [Path.trans_apply] + split_ifs + · exact hXR (hℓ₀ _) + · exact hσ _ + exact path_homotopic_cancel_left p α β (hentry.trans (hmiddle.trans hsecond.symm)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2ConnectedRegionArc.lean b/LeanPool/GraphMinor/GM12/Section2ConnectedRegionArc.lean new file mode 100644 index 0000000000..65873983e1 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2ConnectedRegionArc.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import Mathlib.Topology.Maps.Basic +import LeanPool.GraphMinor.GM11.Regions +import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# A connected region intersection has only one curve interval + +In Case 1 of XII (2.1), page 244, each visited region occurs once. +For an embedded original circle, pull its connected intersection with +a region back to the parameter circle. The open parameter arc of one +visit is relatively both open and closed in this intersection: its +closed arc adds only the two drawing vertices, which are outside the +region. Connectedness therefore puts the whole intersection in that +one parameter arc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- If the image of an embedded circle meets a region in a preconnected +set, every region parameter lies in any one open visit arc bounded by +drawing vertices. This is the distinct-region-visit step in XII (2.1). -/ +theorem preimage_region_subset_parameter_arc + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} + {φ : C(Circle, S)} (hφ : IsEmbedding φ) {r : Set S} (hr : r ∈ Γ.R) + (hconn : IsPreconnected (range φ ∩ r)) {a c : ℝ} (hac : a < c) + (ha : periodicCurve φ a ∈ Γ.V) (hc : periodicCurve φ c ∈ Γ.V) + (hfr : ∀ t ∈ Ioo a c, periodicCurve φ t ∈ r) : + φ ⁻¹' r ⊆ (fun t : ℝ => Circle.exp (2 * Real.pi * t)) '' Ioo a c := by + let B : Set Circle := φ ⁻¹' r + let E : ℝ → Circle := fun t => Circle.exp (2 * Real.pi * t) + let O := E '' Ioo a c + let D := E '' Icc a c + have hE : Continuous E := by fun_prop + have hEopen : IsOpenMap E := isLocalHomeomorph_circleExp.isOpenMap.comp + (Homeomorph.mulLeft₀ (2 * Real.pi) (ne_of_gt Real.two_pi_pos)).isOpenMap + have hO : IsOpen O := hEopen _ isOpen_Ioo + have hD : IsClosed D := (isCompact_Icc.image hE).isClosed + have hOD : O ⊆ D := image_mono Ioo_subset_Icc_self + have hφB : φ '' B = range φ ∩ r := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨mem_range_self z, hz⟩ + · rintro ⟨⟨z, rfl⟩, hz⟩ + exact ⟨z, hz, rfl⟩ + have hB : IsPreconnected B := hφ.isInducing.isPreconnected_image.mp (hφB.symm ▸ hconn) + have hBO : (B ∩ O).Nonempty := by + let m := (a + c) / 2 + have hm : m ∈ Ioo a c := ⟨by dsimp [m]; linarith, by dsimp [m]; linarith⟩ + exact ⟨E m, hfr m hm, m, hm, rfl⟩ + have hBDoff : Disjoint B (D \ O) := by + apply disjoint_left.mpr + rintro z hzB ⟨⟨t, ht, rfl⟩, htO⟩ + by_cases hta : t = a + · subst t + exact region_subset hr hzB (Γ.V_subset_U ha) + · by_cases htc : t = c + · subst t + exact region_subset hr hzB (Γ.V_subset_U hc) + · exact htO ⟨t, ⟨lt_of_le_of_ne ht.1 (Ne.symm hta), lt_of_le_of_ne ht.2 htc⟩, rfl⟩ + intro z hzB + by_contra hzO + have hcover : B ⊆ D ∪ Oᶜ := by + intro x _ + by_cases hx : x ∈ O + · exact Or.inl (hOD hx) + · exact Or.inr hx + obtain ⟨x, hxB, hxD, hxO⟩ := isPreconnected_closed_iff.mp hB D Oᶜ hD hO.isClosed_compl + hcover (hBO.mono (inter_subset_inter_right B hOD)) ⟨z, hzB, hzO⟩ + exact disjoint_left.mp hBDoff hxB ⟨hxD, hxO⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2CornerAccumulation.lean b/LeanPool/GraphMinor/GM12/Section2CornerAccumulation.lean new file mode 100644 index 0000000000..9d8d89ba79 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2CornerAccumulation.lean @@ -0,0 +1,124 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TraceGerms +public import LeanPool.GraphMinor.GM12.Section2TerminalSectors +import LeanPool.GraphMinor.GM12.Section2SectorEntryEquality +import LeanPool.GraphMinor.GM12.Section2PeriodGermSelection +import LeanPool.GraphMinor.GM11.RadialRegions +import LeanPool.GraphMinor.GM11.Walks + +/-! +# An accumulating corner is recorded by the trace + +For the image restriction in XII (2.1), pages 243--244, lift the +subcurve's corner approach to a parameter of the original curve. +At an interior parameter its two recorded region visits enter two +sectors. Distinct sectors meet only in the drawing, so accumulation +in the chosen corner forces one of these two sectors to be that +corner. The common-sector entry comparison identifies the edge. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- At an interior trace parameter, an accumulating corner determines +an edge already in the trace. The incoming comparison curve may be +different from the original curve. -/ +theorem traceSteps_mem_edges_of_corner_accumulation + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {γ : Set S → unitInterval → S} {v : S} (hv : v ∈ Γ.V) + {next : halfEdges Γ γ v → halfEdges Γ γ v} + {ρ P Q : halfEdges Γ γ v → Set S} {N : Set S} + {τ : halfEdges Γ γ v → unitInterval} + (hsec : IsSectors Γ γ v next ρ P N Q τ) + (hcover : N \ Γ.U ⊆ ⋃ k, Q k) (k : halfEdges Γ γ v) + {f g : ℝ → S} (hf : Continuous f) (hg : Continuous g) + {a b : ℝ} {u z : S} (W : GraphWalk K.toGraph u z) + (hW : TraceSteps Γ K f a b W) {s : ℝ} (hs : s ∈ Ioo a b) (hfs : f s = v) + (hscl : s ∈ closure (Icc a b ∩ f ⁻¹' (Q k \ Γ.U))) + {c d c₀ : ℝ} (hcc₀ : c ≤ c₀) (hc₀d : c₀ < d) (hgd : g d = v) + {e : Set S} {w : S} (hw : w ∈ ρ k ∩ K.V) (he : e ∈ K.E) + (hgr : ∀ t ∈ Ioo c d, g t ∈ ρ k) + (hgQ : ∀ t ∈ Ioo c₀ d, g t ∈ Q k \ discBd (Q k)) + (hentry : EntersLike g c d e (ρ k) v w) : e ∈ W.edges := by + have hrad : PreRad (.drawing Γ) K := ⟨hK.1, hK.2.1⟩ + have hrk : ρ k ∈ Γ.R := hsec.corners.region k + have hregion : (Q k \ discBd (Q k)) ∩ N ⊆ ρ k := by + intro x hx + exact hsec.sub k (hsec.inside k ⟨⟨hx.2, hx.1.1⟩, hx.1.2⟩) + have compare : ∀ (F : ℝ → S), Continuous F → ∀ (p q h : ℝ), p < h → h < q → + F q = v → ∀ (r₀ e₀ : Set S) (w₀ : S), r₀ ∈ Γ.R → w₀ ∈ r₀ ∩ K.V → e₀ ∈ K.E → + (∀ t ∈ Ioo p q, F t ∈ r₀) → EntersLike F p q e₀ r₀ v w₀ → + (∀ t ∈ Ico h q, F t ∈ ρ k ∩ (Q k \ discBd (Q k))) → e = e₀ := by + intro F hF p q h hph hhq hFq r₀ e₀ w₀ hr₀ hw₀ he₀ hFr hentry₀ hFQ + let m := (h + q) / 2 + have hhm : h < m := by dsimp [m]; linarith + have hmq : m < q := by dsimp [m]; linarith + have hrr : r₀ = ρ k := region_eq_of_mem hr₀ hrk + (hFr m ⟨hph.trans hhm, hmq⟩) (hFQ m ⟨hhm.le, hmq⟩).1 + subst r₀ + have hww := hub_unique hrad hrk hw.1 hw.2 hw₀.1 hw₀.2 + subst w₀ + exact entersLike_edge_eq_of_common_sector hS hConn hK hrk hv hw he he₀ + (hsec.disc k) (hsec.bd k) hsec.isOpen hsec.mem hregion hg hF + hcc₀ hc₀d hph.le hhq hgd hFq hgr hFr hgQ + (fun t ht => (hFQ t ⟨ht.1.le, ht.2⟩).2) hentry hentry₀ + obtain ⟨p, wL, rL, eL, _, hps, hwL, hrL, hwLr, heLW, hfL, hentryL⟩ := + traceSteps_exists_incoming_germ W hW ⟨hs.1, hs.2.le⟩ (hfs.symm ▸ hv) + obtain ⟨q, wR, rR, eR, _, hsq, hwR, hrR, hwRr, heRW, hfR, hentryR⟩ := + traceSteps_exists_outgoing_germ W hW ⟨hs.1.le, hs.2⟩ (hfs.symm ▸ hv) + rw [hfs] at hentryL hentryR + obtain ⟨i, hL, hpL, hLi⟩ := exists_terminal_sector_of_approach hsec hcover hf hps hfs + (fun t ht => region_subset hrL (hfL t ht)) + have hneg : Continuous (fun t => f (-t)) := hf.comp continuous_neg + have hfneg : (fun t => f (-t)) (-s) = v := by simpa only [neg_neg] using hfs + have hfRneg : ∀ t ∈ Ioo (-q) (-s), f (-t) ∈ rR := by + intro t ht + exact hfR (-t) ⟨by linarith [ht.2], by linarith [ht.1]⟩ + obtain ⟨j, hR, hqR, hRj⟩ := exists_terminal_sector_of_approach hsec hcover hneg + (neg_lt_neg hsq) hfneg (fun t ht => region_subset hrR (hfRneg t ht)) + let ε := min ((s - hL) / 2) ((-hR - s) / 2) + have hε : 0 < ε := lt_min (by linarith [hpL.2]) (by linarith [hqR.2]) + have hεL : ε ≤ (s - hL) / 2 := min_le_left _ _ + have hεR : ε ≤ (-hR - s) / 2 := min_le_right _ _ + have hdis : Pairwise (fun i j => Disjoint (Q i \ Γ.U) (Q j \ Γ.U)) := by + intro i j hij + exact disjoint_left.mpr (fun x hxi hxj => hxi.2 (hsec.inter i j hij ⟨hxi.1, hxj.1⟩)) + have hnot : f s ∉ Q k \ Γ.U := fun hx => hx.2 (hfs.symm ▸ Γ.V_subset_U hv) + have hlabel : k = i ∨ k = j := side_label_of_closure_preimage hdis hε hnot hscl + (fun t _ ht => by + have hh : hL < t := by linarith [ht.1] + exact ⟨(hLi t ⟨hh.le, ht.2⟩).2.1, + region_subset hrL (hfL t ⟨hpL.1.trans hh, ht.2⟩)⟩) + (fun t _ ht => by + have hh : hR < -t := by linarith [ht.2] + have hts : -t < -s := neg_lt_neg ht.1 + exact ⟨by simpa only [neg_neg] using (hRj (-t) ⟨hh.le, hts⟩).2.1, + region_subset hrR (hfR t ⟨ht.1, by linarith [hqR.1]⟩)⟩) + have edge_mem : ∀ e₀ ∈ W.edges, e₀ ∈ K.E := by + intro e₀ he₀ + exact (walkDrawing_isSubdrawing K W).2 (by rw [walkDrawing_E]; exact he₀) + rcases hlabel with hki | hkj + · subst i + have heq := compare f hf p s hL hpL.1 hpL.2 hfs rL eL wL hrL + ⟨hwLr, hwL⟩ (edge_mem eL heLW) hfL hentryL hLi + exact heq.symm ▸ heLW + · subst j + have heq := compare (fun t => f (-t)) hneg (-q) (-s) hR hqR.1 hqR.2 hfneg rR eR wR hrR + ⟨hwRr, hwR⟩ (edge_mem eR heRW) hfRneg hentryR hRj + exact heq.symm ▸ heRW + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2Corners.lean b/LeanPool/GraphMinor/GM12/Section2Corners.lean new file mode 100644 index 0000000000..42b5efb114 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2Corners.lean @@ -0,0 +1,148 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM11.Rotation +public import LeanPool.GraphMinor.GM11.Corners +import LeanPool.GraphMinor.GM11.RadialCorners +import LeanPool.GraphMinor.Surface.DiscArcs +import Mathlib.Topology.Connected.Basic + +/-! +# The corner entered by a normal curve + +For the omitted entry-edge lemma in XII, page 243, a curve approaching a +vertex stays in one corner near that vertex. The closed sector discs of +XI cover a neighbourhood off the drawing, and distinct sectors meet only +in the drawing. A connected curve segment off the drawing must therefore +stay in one sector. This file proves that local step without assumptions +about a tangle or its inside function. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- In a finite closed cover, a connected set cannot move from one piece +to another when it avoids all intersections between distinct pieces. -/ +theorem preconnected_subset_closed_piece {α ι : Type*} [TopologicalSpace α] [Finite ι] + {A : Set α} (hA : IsPreconnected A) (Q : ι → Set α) (hQ : ∀ i, IsClosed (Q i)) + (hcover : A ⊆ ⋃ i, Q i) + (hdisj : ∀ i j, i ≠ j → Disjoint A (Q i ∩ Q j)) + {i : ι} (hAi : (A ∩ Q i).Nonempty) : A ⊆ Q i := by + classical + let V : Set α := ⋃ j : {j // j ≠ i}, Q j.val + have hV : IsClosed V := isClosed_iUnion_of_finite (fun j => hQ j.val) + have hcov : A ⊆ Q i ∪ V := by + intro x hx + obtain ⟨j, hj⟩ := mem_iUnion.mp (hcover hx) + by_cases hji : j = i + · exact Or.inl (hji ▸ hj) + · exact Or.inr (mem_iUnion.mpr ⟨⟨j, hji⟩, hj⟩) + intro y hy + by_contra hyi + have hyV : y ∈ V := (hcov hy).resolve_left hyi + obtain ⟨x, hxA, hxi, hxV⟩ := + isPreconnected_closed_iff.mp hA (Q i) V (hQ i) hV hcov hAi ⟨y, hy, hyV⟩ + obtain ⟨j, hxj⟩ := mem_iUnion.mp hxV + exact Set.disjoint_left.mp (hdisj i j.val (Ne.symm j.property)) hxA ⟨hxi, hxj⟩ + +universe u +variable {S : Type u} [TopologicalSpace S] + +/-- The local corner step for the entry-edge definition of XII, page 243. +If a continuous curve leaves a vertex and immediately stays off the +drawing, some positive initial segment lies in one closed sector disc. +The hypothesis on the number of half-edges is the setting of XI's +rotation-sector lemma. -/ +theorem exists_initial_sector (hS : IsClosedSurface S) (Γ : Drawing S) + {γ : Set S → unitInterval → S} (hγ : EdgePar Γ γ) {v : S} + (hv : v ∈ Γ.V) (h2 : 2 ≤ Nat.card (halfEdges Γ γ v)) + {g : unitInterval → S} (hg : Continuous g) (hg0 : g 0 = v) + (hoff : ∀ t, 0 < t → g t ∉ Γ.U) : + ∃ (Q : halfEdges Γ γ v → Set S), (∀ k, IsClosedDisc (Q k)) ∧ + (∀ k, v ∈ discBd (Q k)) ∧ ∃ (k : halfEdges Γ γ v) (ε : unitInterval), + 0 < ε ∧ ∀ t, t ≤ ε → g t ∈ Q k := by + have : T2Space S := hS.2.1 + have : Fintype (halfEdges Γ γ v) := (finite_halfEdges Γ γ v).fintype + obtain ⟨next, P, W, Q, hW, hvW, _, _, _, _, _, _, hcov, _, hQ, hQQ, _, _, _⟩ := + exists_rotation_sectors hS Γ hγ hv h2 + obtain ⟨ε, hε, _, hεW⟩ := exists_pos_le hg hW (hg0 ▸ hvW) (a := 1) zero_lt_one + let A : Set S := g '' Ioc (0 : unitInterval) ε + have hA : IsPreconnected A := isPreconnected_Ioc.image g hg.continuousOn + have hAQ : A ⊆ ⋃ k, Q k := by + rintro x ⟨t, ht, rfl⟩ + obtain ⟨k, hk⟩ := mem_iUnion.mp (hcov ⟨hεW t ht.2, hoff t ht.1⟩) + exact mem_iUnion.mpr ⟨k, (hQ k).2.2.1 hk⟩ + have hdisj : ∀ i j, i ≠ j → Disjoint A (Q i ∩ Q j) := by + intro i j hij + apply Set.disjoint_left.mpr + rintro x ⟨t, ht, rfl⟩ hx + exact hoff t ht.1 (hQQ i j hij hx) + have hεA : g ε ∈ A := ⟨ε, ⟨hε, le_rfl⟩, rfl⟩ + obtain ⟨k, hk⟩ := mem_iUnion.mp (hAQ hεA) + have hsub : A ⊆ Q k := preconnected_subset_closed_piece hA Q + (fun i => (hQ i).1.isClosed) hAQ hdisj ⟨g ε, hεA, hk⟩ + refine ⟨Q, fun i => (hQ i).1, fun i => (hQ i).2.1, k, ε, hε, ?_⟩ + intro t ht + by_cases ht0 : t = 0 + · rw [ht0, hg0] + exact Surface.discBd_subset _ (hQ k).2.1 + · exact hsub ⟨t, ⟨unitInterval.pos_iff_ne_zero.mpr ht0, ht⟩, rfl⟩ + +/-- Once sectors are fixed, the entering segment determines one of their +corner regions. The extra cover condition is the cover supplied by XI's +rotation construction. The zero endpoint lies on the sector boundary, +while all positive points lie in its corner region. -/ +theorem initially_in_given_corner [T2Space S] {Γ : Drawing S} + {γ : Set S → unitInterval → S} {v : S} + {next : halfEdges Γ γ v → halfEdges Γ γ v} + {ρ P Q : halfEdges Γ γ v → Set S} {W : Set S} + {τ : halfEdges Γ γ v → unitInterval} + (hsec : IsSectors Γ γ v next ρ P W Q τ) + (hcover : W \ Γ.U ⊆ ⋃ k, Q k) + {g : unitInterval → S} (hg : Continuous g) (hg0 : g 0 = v) + (hoff : ∀ t, 0 < t → g t ∉ Γ.U) : + ∃ (k : halfEdges Γ γ v) (ε : unitInterval), 0 < ε ∧ + (∀ t, t ≤ ε → g t ∈ Q k) ∧ + ∀ t, 0 < t → t ≤ ε → g t ∈ ρ k := by + have : Fintype (halfEdges Γ γ v) := (finite_halfEdges Γ γ v).fintype + obtain ⟨ε, hε, _, hεW⟩ := exists_pos_le hg hsec.isOpen (hg0 ▸ hsec.mem) + (a := 1) zero_lt_one + let A : Set S := g '' Ioc (0 : unitInterval) ε + have hA : IsPreconnected A := isPreconnected_Ioc.image g hg.continuousOn + have hAQ : A ⊆ ⋃ k, Q k := by + rintro x ⟨t, ht, rfl⟩ + exact hcover ⟨hεW t ht.2, hoff t ht.1⟩ + have hdisj : ∀ i j, i ≠ j → Disjoint A (Q i ∩ Q j) := by + intro i j hij + apply Set.disjoint_left.mpr + rintro x ⟨t, ht, rfl⟩ hx + exact hoff t ht.1 (hsec.inter i j hij hx) + have hεA : g ε ∈ A := ⟨ε, ⟨hε, le_rfl⟩, rfl⟩ + obtain ⟨k, hk⟩ := mem_iUnion.mp (hAQ hεA) + have hsub : A ⊆ Q k := preconnected_subset_closed_piece hA Q + (fun i => (hsec.disc i).isClosed) hAQ hdisj ⟨g ε, hεA, hk⟩ + have hpos : ∀ t, 0 < t → t ≤ ε → g t ∈ P k := by + intro t ht htε + apply hsec.inside k + refine ⟨⟨hεW t htε, hsub ⟨t, ⟨ht, htε⟩, rfl⟩⟩, ?_⟩ + intro hbd + exact hoff t ht (hsec.bdU k ⟨hεW t htε, hbd⟩) + refine ⟨k, ε, hε, ?_, fun t ht htε => hsec.sub k (hpos t ht htε)⟩ + intro t ht + by_cases ht0 : t = 0 + · rw [ht0, hg0] + exact Surface.discBd_subset _ (hsec.bd k) + · exact hsub ⟨t, ⟨unitInterval.pos_iff_ne_zero.mpr ht0, ht⟩, rfl⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2CurveCounts.lean b/LeanPool/GraphMinor/GM12/Section2CurveCounts.lean new file mode 100644 index 0000000000..bf9ac32b20 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2CurveCounts.lean @@ -0,0 +1,154 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import Mathlib.Data.Set.Card + +/-! +# The length decrease for the two curves cut off by a chord + +Case 2 of XII (2.1), page 244, applies induction to one of the circles +formed by the chord. The chord misses the original drawing. Each of +the two original arcs contains a vertex, and they share no vertex. +Thus either new circle contains strictly fewer vertices than the +original circle. For an embedded normal curve these counts are exactly +the lengths used in the paper. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- For an injective normal curve, its length counts the vertices in +its image. Injectivity identifies parameter hits with their images, +and normality turns hits of the drawing into hits of its vertex set. -/ +theorem curveLength_eq_vertex_count {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} (φ : C(Circle, S)) (hinj : Function.Injective φ) + (hnormal : Γ.IsNormal (range φ)) : + curveLength Γ φ = (range φ ∩ Γ.V).ncard := by + have heq : φ '' {t | φ t ∈ Γ.U} = range φ ∩ Γ.V := by + ext x + constructor + · rintro ⟨t, ht, rfl⟩ + exact ⟨mem_range_self t, hnormal ⟨mem_range_self t, ht⟩⟩ + · rintro ⟨⟨t, rfl⟩, ht⟩ + exact ⟨t, Γ.V_subset_U ht, rfl⟩ + change {t | φ t ∈ Γ.U}.ncard = _ + rw [← heq] + exact (Set.ncard_image_of_injective _ hinj).symm + +/-- The distinct drawing vertices in a normal curve image number +at most its parameter hits. This gives the length bound in the +simple-subcurve reduction of XII (2.1), pages 243--244. -/ +theorem vertex_count_le_curveLength {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} {φ : C(Circle, S)} (hφ : IsNormalCurve Γ φ) : + (range φ ∩ Γ.V).ncard ≤ curveLength Γ φ := by + have himage : φ '' {t | φ t ∈ Γ.U} = range φ ∩ Γ.V := by + ext x + constructor + · rintro ⟨t, ht, rfl⟩ + exact ⟨mem_range_self t, hφ.2 ⟨mem_range_self t, ht⟩⟩ + · rintro ⟨⟨t, rfl⟩, ht⟩ + exact ⟨t, Γ.V_subset_U ht, rfl⟩ + change (range φ ∩ Γ.V).ncard ≤ {t | φ t ∈ Γ.U}.ncard + rw [← himage] + exact Set.ncard_image_le hφ.1 + +/-- A chord missing the vertices adds none to either new circle. If +the other original arc contains a vertex not on this arc, the new +circle has a strictly smaller vertex count. -/ +theorem chord_circle_vertex_count_lt {S : Type*} {A B L V : Set S} + (hV : V.Finite) (hLV : Disjoint L V) (hABV : Disjoint (A ∩ B) V) + (hB : (B ∩ V).Nonempty) : ((A ∪ L) ∩ V).ncard < ((A ∪ B) ∩ V).ncard := by + have htarget : (A ∪ L) ∩ V = A ∩ V := by + rw [union_inter_distrib_right, Set.disjoint_iff_inter_eq_empty.mp hLV, union_empty] + rw [htarget] + apply Set.ncard_lt_ncard _ (hV.subset inter_subset_right) + refine ⟨fun x hx => ⟨Or.inl hx.1, hx.2⟩, ?_⟩ + intro hback + obtain ⟨x, hxB, hxV⟩ := hB + have hxA : x ∈ A := (hback ⟨Or.inr hxB, hxV⟩).1 + exact Set.disjoint_left.mp hABV ⟨hxA, hxB⟩ hxV + +/-- Both circles formed by the chord have smaller vertex counts when +each of the two original arcs contains a vertex. This is the numerical +induction step in XII (2.1), Case 2, page 244. -/ +theorem chord_circle_vertex_counts_lt {S : Type*} {A B L V : Set S} + (hV : V.Finite) (hLV : Disjoint L V) (hABV : Disjoint (A ∩ B) V) + (hA : (A ∩ V).Nonempty) (hB : (B ∩ V).Nonempty) : + ((A ∪ L) ∩ V).ncard < ((A ∪ B) ∩ V).ncard ∧ + ((B ∪ L) ∩ V).ncard < ((A ∪ B) ∩ V).ncard := by + refine ⟨chord_circle_vertex_count_lt hV hLV hABV hB, ?_⟩ + have hBA : Disjoint (B ∩ A) V := by rwa [inter_comm] + have h := chord_circle_vertex_count_lt hV hLV hBA hA + rwa [union_comm B A] at h + +/-- An embedded curve with normal image has finite length, since its +hits inject into the finite vertex set of the drawing. -/ +theorem isNormalCurve_of_injective {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} (φ : C(Circle, S)) (hinj : Function.Injective φ) + (hnormal : Γ.IsNormal (range φ)) : IsNormalCurve Γ φ := by + refine ⟨?_, hnormal⟩ + have hfinite : (φ ⁻¹' Γ.V).Finite := Set.Finite.preimage hinj.injOn Γ.finite_V + exact hfinite.subset fun t ht => hnormal ⟨mem_range_self t, ht⟩ + +/-- Replacing part of an embedded normal curve by a chord off the +drawing preserves normality and finite length. -/ +theorem isNormalCurve_of_chord_replacement {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} (φ ψ : C(Circle, S)) (hψ : Function.Injective ψ) + (hφ : Γ.IsNormal (range φ)) {L : Set S} (hL : Disjoint L Γ.U) + (hsub : range ψ ⊆ range φ ∪ L) : IsNormalCurve Γ ψ := by + apply isNormalCurve_of_injective ψ hψ + rintro x ⟨hxψ, hxU⟩ + rcases hsub hxψ with hxφ | hxL + · exact hφ ⟨hxφ, hxU⟩ + · exact (Set.disjoint_left.mp hL hxL hxU).elim + +/-- The smaller circle has strictly smaller length, in the exact +length definition of XII (2.1), Case 2. The omitted original arc must +contain a vertex, and the chord meets no point of the drawing. -/ +theorem curveLength_lt_of_chord_replacement {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} (φ ψ : C(Circle, S)) + (hφi : Function.Injective φ) (hψi : Function.Injective ψ) + (hφ : Γ.IsNormal (range φ)) {A B L : Set S} + (hφrange : range φ = A ∪ B) (hψrange : range ψ = A ∪ L) + (hL : Disjoint L Γ.U) (hABV : Disjoint (A ∩ B) Γ.V) + (hB : (B ∩ Γ.V).Nonempty) : curveLength Γ ψ < curveLength Γ φ := by + have hψ : IsNormalCurve Γ ψ := isNormalCurve_of_chord_replacement φ ψ hψi hφ hL (by + rw [hφrange, hψrange] + exact union_subset (fun _ hx => Or.inl (Or.inl hx)) (fun _ hx => Or.inr hx)) + rw [curveLength_eq_vertex_count ψ hψi hψ.2, curveLength_eq_vertex_count φ hφi hφ, + hψrange, hφrange] + have hLV : Disjoint L Γ.V := hL.mono_right Γ.V_subset_U + exact chord_circle_vertex_count_lt Γ.finite_V hLV hABV hB + +/-- Parameterize a normal circle injectively, retaining its exact +curve length as the number of drawing vertices on the circle. -/ +theorem exists_normal_curve_of_oArc {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} {F : Set S} (hF : IsOArc F) (hn : Γ.IsNormal F) : + ∃ φ : C(Circle, S), IsEmbedding φ ∧ range φ = F ∧ IsNormalCurve Γ φ ∧ + curveLength Γ φ = (Γ.V ∩ F).ncard := by + obtain ⟨H⟩ := hF + let φ : C(Circle, S) := ⟨fun t => (H t).val, continuous_subtype_val.comp H.continuous⟩ + have hrange : range φ = F := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (H t).property + · intro hx + exact ⟨H.symm ⟨x, hx⟩, congrArg Subtype.val (H.apply_symm_apply ⟨x, hx⟩)⟩ + have hemb : IsEmbedding φ := IsEmbedding.subtypeVal.comp H.isEmbedding + have hnormal : Γ.IsNormal (range φ) := hrange.symm ▸ hn + refine ⟨φ, hemb, hrange, isNormalCurve_of_injective φ hemb.injective hnormal, ?_⟩ + rw [curveLength_eq_vertex_count φ hemb.injective hnormal, hrange, inter_comm] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2CyclicDeformation.lean b/LeanPool/GraphMinor/GM12/Section2CyclicDeformation.lean new file mode 100644 index 0000000000..67d8e9e6ec --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2CyclicDeformation.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2CyclicReparametrization +import LeanPool.GraphMinor.GM07.Section11c + +/-! +# Gluing the region deformations around the circle + +For XII (2.1), Case 1, page 244, the homotopies of successive region +paths fix their common endpoints. They therefore match at every +time and join to a closed-curve homotopy. First read the original +curve on its chosen real region intervals, then join their deformations. +The whole construction stays in the prescribed union of visited +regions and vertices. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM07 + +/-- Homotopies of cyclic pieces fixing their ends glue to a homotopy +of their concatenated closed curves. -/ +theorem concatLoop_homotopic_of_relative_piece_homotopies + {S : Type*} [TopologicalSpace S] {Z : Set S} {n : ℕ} (hn : 0 < n) + (γ δ : Fin n → C(unitInterval, S)) + (hγmatch : ∀ i, γ i 1 = γ (finNext hn i) 0) + (hδmatch : ∀ i, δ i 1 = δ (finNext hn i) 0) + (hpiece : ∀ i, CurvesHomotopicIn Z (γ i) (δ i)) : + ClosedCurvesHomotopicIn Z (concatLoop hn γ hγmatch) (concatLoop hn δ hδmatch) := by + choose H hHZ hH0 hH1 hleft _ hright _ using hpiece + apply concatLoop_homotopic hn γ δ hγmatch hδmatch H hHZ hH0 hH1 + intro i s + exact (hright i s).trans ((hγmatch i).trans (hleft (finNext hn i) s).symm) + +/-- The region-by-region deformation in XII (2.1), Case 1, assembled +from real curve intervals and relative-endpoint homotopies of them. -/ +theorem closedCurve_homotopic_to_deformed_real_pieces + {S : Type*} [TopologicalSpace S] {φ : C(Circle, S)} {Z : Set S} + (hφZ : range φ ⊆ Z) {n : ℕ} (hn : 0 < n) (a b : Fin n → ℝ) + (hstep : ∀ i, b i = a (finNext hn i) + if i.val + 1 = n then 1 else 0) + (γ δ : Fin n → C(unitInterval, S)) + (hγ : ∀ i t, γ i t = periodicCurve φ (a i + t.val * (b i - a i))) + (hγmatch : ∀ i, γ i 1 = γ (finNext hn i) 0) + (hδmatch : ∀ i, δ i 1 = δ (finNext hn i) 0) + (hpiece : ∀ i, CurvesHomotopicIn Z (γ i) (δ i)) : + ClosedCurvesHomotopicIn Z φ (concatLoop hn δ hδmatch) := by + have hfirst := closedCurve_homotopic_to_cyclic_real_pieces hφZ hn a b hstep γ hγ hγmatch + have hsecond := concatLoop_homotopic_of_relative_piece_homotopies hn γ δ hγmatch hδmatch hpiece + exact GM07.closedCurvesHomotopicIn_trans' hfirst hsecond + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2CyclicEmbedding.lean b/LeanPool/GraphMinor/GM12/Section2CyclicEmbedding.lean new file mode 100644 index 0000000000..ef90aff70e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2CyclicEmbedding.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section11b +import LeanPool.GraphMinor.GM12.Section2CirclePeriod + +/-! +# Simplicity of a circle assembled from cyclic region paths + +For Case 1 of XII (2.1), page 244, assemble the two-spoke paths of +the successive region visits into a closed curve. If distinct paths +have disjoint images after removing their final endpoints, and each +remaining parameterization is injective, the assembled curve is +injective. Represent every circle parameter in exactly one half-open +piece of the cyclic chain and compare those two representations. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM07 + +/-- Every point of a concatenated cyclic chain has a representation +in one of its half-open parameter pieces, including its circle +parameter as well as its image value. -/ +theorem concatLoop_point_representation + {S : Type*} [TopologicalSpace S] {n : ℕ} (hn : 0 < n) + (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) (z : Circle) : + ∃ (i : Fin n) (t : unitInterval), t.val < 1 ∧ + z = Circle.exp (2 * Real.pi * ((i.val : ℝ) + t.val) / (n : ℝ)) ∧ + concatLoop hn γ hmatch z = γ i t := by + obtain ⟨u, hu, huz⟩ := (circle_parameter_bijOn 0).surjOn (mem_univ z) + have hnpos : (0 : ℝ) < n := by exact_mod_cast hn + let y := u * (n : ℝ) + have hy0 : 0 ≤ y := mul_nonneg hu.1 hnpos.le + have hyn : y < n := by + dsimp only [y] + have hu1 : u < 1 := by simpa only [zero_add] using hu.2 + exact mul_lt_of_lt_one_left hnpos hu1 + have hfloor0 : 0 ≤ ⌊y⌋ := Int.floor_nonneg.mpr hy0 + have hfloorn : ⌊y⌋ < (n : ℤ) := by + rw [Int.floor_lt] + exact_mod_cast hyn + let i : Fin n := ⟨⌊y⌋.toNat, by omega⟩ + let t : unitInterval := unitFract y + have ht : t.val < 1 := Int.fract_lt_one y + have hity : (i.val : ℝ) + t.val = y := by + have hfloor : (i.val : ℤ) = ⌊y⌋ := Int.toNat_of_nonneg hfloor0 + change ((i.val : ℤ) : ℝ) + Int.fract y = y + rw [hfloor, Int.floor_add_fract] + have hz : z = Circle.exp (2 * Real.pi * ((i.val : ℝ) + t.val) / (n : ℝ)) := by + rw [hity] + have heq : 2 * Real.pi * y / (n : ℝ) = 2 * Real.pi * u := by + dsimp only [y] + rw [← mul_assoc, mul_div_cancel_right₀ _ (ne_of_gt hnpos)] + rw [heq] + exact huz.symm + refine ⟨i, t, ht, hz, ?_⟩ + rw [hz] + exact concatLoop_exp_piece hn γ hmatch i t + +/-- Half-open pieces with no repeated image point assemble to a +simple closed curve. This gives the simplicity step for the cyclic +region paths in XII (2.1), Case 1, page 244. -/ +theorem concatLoop_injective_of_halfopen_pieces + {S : Type*} [TopologicalSpace S] {n : ℕ} (hn : 0 < n) + (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) + (hsep : ∀ (i j : Fin n) (s t : unitInterval), s.val < 1 → t.val < 1 → + γ i s = γ j t → i = j ∧ s = t) : + Function.Injective (concatLoop hn γ hmatch) := by + intro z z' hzz + obtain ⟨i, s, hs, hz, hγ⟩ := concatLoop_point_representation hn γ hmatch z + obtain ⟨j, t, ht, hz', hγ'⟩ := concatLoop_point_representation hn γ hmatch z' + rw [hγ, hγ'] at hzz + obtain ⟨rfl, rfl⟩ := hsep i j s t hs ht hzz + exact hz.trans hz'.symm + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2CyclicHitParameters.lean b/LeanPool/GraphMinor/GM12/Section2CyclicHitParameters.lean new file mode 100644 index 0000000000..cee5286413 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2CyclicHitParameters.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section11b + +/-! +# Cyclic endpoint identities for the hit parameters + +The trace subdivision in XII, page 243, lists its first vertex again +one period later at the end. Thus the end of a real interval is the +start of the cyclically next interval, except that the last end has +one period added. These identities make the corresponding vertex +paths and homotopies join around the circle. +-/ + +public section + +namespace GraphMinor.GM12 + +open GM07 + +/-- Consecutive endpoints of a one-period subdivision match cyclically, +with one period added only at the last interval. -/ +theorem cyclic_step_of_period_endpoints + {n : ℕ} (hn : 0 < n) (t : Fin (n + 1) → ℝ) + (hperiod : t (Fin.last n) = t 0 + 1) (i : Fin n) : + t i.succ = t (finNext hn i).castSucc + if i.val + 1 = n then 1 else 0 := by + by_cases hlast : i.val + 1 = n + · have hnext : (finNext hn i).castSucc = (0 : Fin (n + 1)) := Fin.ext (by + change (i.val + 1) % n = 0 + rw [hlast, Nat.mod_self]) + have hi : i.succ = Fin.last n := Fin.ext hlast + rw [hi, hnext, hperiod] + simp only [hlast, ↓reduceIte] + · have hlt : i.val + 1 < n := lt_of_le_of_ne (Nat.succ_le_of_lt i.isLt) hlast + have hi : (finNext hn i).castSucc = i.succ := Fin.ext (by + change (i.val + 1) % n = i.val + 1 + exact Nat.mod_eq_of_lt hlt) + rw [hi] + simp only [hlast, ↓reduceIte, add_zero] + +/-- A periodic curve takes the same value at the last endpoint of +one interval and the first endpoint of the cyclically next one. -/ +theorem periodic_value_succ_eq_next + {S : Type*} {f : ℝ → S} (hper : Function.Periodic f 1) + {n : ℕ} (hn : 0 < n) (t : Fin (n + 1) → ℝ) + (hperiod : t (Fin.last n) = t 0 + 1) (i : Fin n) : + f (t i.succ) = f (t (finNext hn i).castSucc) := by + rw [cyclic_step_of_period_endpoints hn t hperiod i] + split_ifs + · exact hper _ + · simp only [add_zero] + +/-- The next index of a cyclic list with at least two entries is +never the current index. -/ +theorem finNext_ne_of_two_le {n : ℕ} (hn : 2 ≤ n) (i : Fin n) : + finNext (by omega : 0 < n) i ≠ i := by + intro heq + have hval := congrArg Fin.val heq + change (i.val + 1) % n = i.val at hval + by_cases hlast : i.val + 1 = n + · rw [hlast, Nat.mod_self] at hval + omega + · have hlt : i.val + 1 < n := lt_of_le_of_ne (Nat.succ_le_of_lt i.isLt) hlast + rw [Nat.mod_eq_of_lt hlt] at hval + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2CyclicReparametrization.lean b/LeanPool/GraphMinor/GM12/Section2CyclicReparametrization.lean new file mode 100644 index 0000000000..2cafe6edd5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2CyclicReparametrization.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section11b +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM12.Section2PeriodicHits + +/-! +# Joining the original region intervals around the circle + +For Case 1 of XII (2.1), page 244, the original curve can be read +as the cyclic concatenation of its region intervals. Interpolate +between the uniform circle parameters and the chosen real interval +parameters. At every joining endpoint the two parameters agree, +except at the last join, where both differ by one period. Thus the +interpolation is a homotopy of closed curves, entirely in the original +curve image. The origin of its real parameter may vary freely. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM07 + +/-- Concatenating arbitrary consecutive real intervals of one period +is homotopic to the original circle parameterization, with the homotopy +contained in that curve's image. -/ +theorem closedCurve_homotopic_to_cyclic_real_pieces + {S : Type*} [TopologicalSpace S] {φ : C(Circle, S)} {Z : Set S} + (hφZ : range φ ⊆ Z) {n : ℕ} (hn : 0 < n) (a b : Fin n → ℝ) + (hstep : ∀ i, b i = a (finNext hn i) + if i.val + 1 = n then 1 else 0) + (γ : Fin n → C(unitInterval, S)) + (hγ : ∀ i t, γ i t = periodicCurve φ (a i + t.val * (b i - a i))) + (hmatch : ∀ i, γ i 1 = γ (finNext hn i) 0) : + ClosedCurvesHomotopicIn Z φ (concatLoop hn γ hmatch) := by + let H : Fin n → C(unitInterval × unitInterval, S) := fun i => + ⟨fun p => periodicCurve φ ((1 - p.2.val) * (((i.val : ℝ) + p.1.val) / (n : ℝ)) + + p.2.val * (a i + p.1.val * (b i - a i))), + (periodicCurve_continuous φ).comp (by fun_prop)⟩ + have hHZ : ∀ i p, H i p ∈ Z := fun i p => hφZ (mem_range_self _) + have hH0 : ∀ i t, H i (t, 0) = curvePiece hn φ i t := by + intro i t + change periodicCurve φ ((1 - (0 : unitInterval).val) * (((i.val : ℝ) + t.val) / (n : ℝ)) + + (0 : unitInterval).val * (a i + t.val * (b i - a i))) = _ + simp only [Icc.coe_zero, sub_zero, one_mul, zero_mul, add_zero] + change φ (Circle.exp (2 * Real.pi * (((i.val : ℝ) + t.val) / (n : ℝ)))) = _ + rw [← mul_div_assoc] + rfl + have hH1 : ∀ i t, H i (t, 1) = γ i t := by + intro i t + rw [hγ] + change periodicCurve φ ((1 - (1 : unitInterval).val) * (((i.val : ℝ) + t.val) / (n : ℝ)) + + (1 : unitInterval).val * (a i + t.val * (b i - a i))) = _ + simp only [Icc.coe_one, sub_self, zero_mul, one_mul, zero_add] + have hHmatch : ∀ i s, H i (1, s) = H (finNext hn i) (0, s) := by + intro i s + change periodicCurve φ ((1 - s.val) * (((i.val : ℝ) + 1) / (n : ℝ)) + + s.val * (a i + 1 * (b i - a i))) = + periodicCurve φ ((1 - s.val) * ((((finNext hn i).val : ℝ) + 0) / (n : ℝ)) + + s.val * (a (finNext hn i) + 0 * (b (finNext hn i) - a (finNext hn i)))) + by_cases hlast : i.val + 1 = n + · have hnext : (finNext hn i).val = 0 := by simp only [finNext, hlast, Nat.mod_self] + have hnreal : (i.val : ℝ) + 1 = (n : ℝ) := by exact_mod_cast hlast + have hnne : (n : ℝ) ≠ 0 := by exact_mod_cast hn.ne' + rw [hnext, Nat.cast_zero, hnreal, div_self hnne, hstep i] + simp only [hlast, ↓reduceIte] + calc + periodicCurve φ _ = periodicCurve φ (s.val * a (finNext hn i) + 1) := + congrArg (periodicCurve φ) (by ring) + _ = periodicCurve φ (s.val * a (finNext hn i)) := periodicCurve_periodic φ _ + _ = periodicCurve φ _ := congrArg (periodicCurve φ) (by ring) + · have hlt : i.val + 1 < n := lt_of_le_of_ne (Nat.succ_le_of_lt i.isLt) hlast + have hnext : (finNext hn i).val = i.val + 1 := by simp only [finNext, Nat.mod_eq_of_lt hlt] + rw [hstep i] + simp only [hlast, ↓reduceIte] + rw [hnext, Nat.cast_add, Nat.cast_one] + congr 1 + ring + have hh := concatLoop_homotopic hn (curvePiece hn φ) γ (curvePiece_match hn φ) hmatch + H hHZ hH0 hH1 hHmatch + rw [concatLoop_curvePiece] at hh + exact hh + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2DeformationConclusion.lean b/LeanPool/GraphMinor/GM12/Section2DeformationConclusion.lean new file mode 100644 index 0000000000..2a722455bd --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2DeformationConclusion.lean @@ -0,0 +1,134 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2DeformationInside +public import LeanPool.GraphMinor.GM12.Section2BacktrackInside +import LeanPool.GraphMinor.GM11.OArcCircuit +import LeanPool.GraphMinor.GM11.Section85 + +/-! +# The two conclusions of the trace deformation + +In XII (2.1), Case 1, page 244, the deformed trace is either a +simple circle or a backtracking line. In the circle case its circuit +inside is one of the sets in the walk inside, and region deformation +preserves atom incidence with the selected boundary disc. In the line +case the original boundary contracts in the deformation set. A drawing +point outside the selected disc forces that disc into this set. Every +atom met by the set is met by the deformed trace itself. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A deformation carrier with no new drawing points or region visits +meets only atoms already met by the final curve. -/ +theorem atom_meets_image_of_carrier_controls + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} {Z : Set S} {ψ : C(Circle, S)} + (hZΓ : Z ∩ Γ.U ⊆ range ψ) + (hZR : ∀ r ∈ Γ.R, (Z ∩ r).Nonempty → (range ψ ∩ r).Nonempty) + {c : Set S} (hc : c ∈ Γ.A) (hcZ : (c ∩ Z).Nonempty) : + (c ∩ range ψ).Nonempty := by + obtain ⟨x, hxc, hxZ⟩ := hcZ + rcases hc with (⟨v, hv, rfl⟩ | he) | hr + · exact ⟨x, hxc, hZΓ ⟨hxZ, Γ.V_subset_U (hxc ▸ hv)⟩⟩ + · exact ⟨x, hxc, hZΓ ⟨hxZ, (he.2.1 hxc).1⟩⟩ + · obtain ⟨y, hyψ, hyc⟩ := hZR c hr ⟨x, hxZ, hxc⟩ + exact ⟨y, hyc, hyψ⟩ + +/-- The simple-circle alternative in XII (2.1), Case 1. The circuit +with this circle as point set contributes its selected disc to the +walk inside, and the deformation comparison transfers atom incidence. -/ +theorem meets_insWalk_of_embedded_trace_deformation + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + {φ ψ : C(Circle, S)} (hφ : IsEmbedding φ) (hψ : IsEmbedding ψ) + (hnφ : Γ.IsNormal (range φ)) {u : S} (W : GraphWalk K.toGraph u u) + (hshort : W.length < 2 * θ) (hψU : range ψ = (walkDrawing K W).U) + {D Z c : Set S} (hD : IsClosedDisc D) (hbdD : subBd D = range φ) + (hmD : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + (hh : ClosedCurvesHomotopicIn Z φ ψ) (hZΓ : Z ∩ Γ.U ⊆ range ψ) + (hZR : ∀ r ∈ Γ.R, (Z ∩ r).Nonempty → (range ψ ∩ r).Nonempty) + (hc : c ∈ Γ.A) (hcD : (c ∩ D).Nonempty) : + (c ∩ insWalk ins K W).Nonempty := by + have hF : IsOArc (range ψ) := ⟨hψ.toHomeomorph⟩ + obtain ⟨C, hC, hCs, hCU⟩ := exists_circuit_of_oArc hF hψU.subset + have hCK := hCs.trans (walkDrawing_isSubdrawing K W) + have hCl := isConfined_walk W hshort C hC hCs + obtain ⟨hE, hbdE, hmE⟩ := hd C hC hCK hCl + have hnψ : Γ.IsNormal (range ψ) := by + intro x hx + have hxK : x ∈ K.U := (walkDrawing_isSubdrawing K W).U_subset (hψU ▸ hx.1) + exact hK.2.1.1.subset ⟨hx.2, hxK⟩ + have hmeet := atom_meets_disc_of_region_deformation hS hT hφ hψ hD hE hbdD + (hbdE.trans hCU) hnφ hnψ hmD hmE hh hZΓ hZR hc hcD + obtain ⟨x, hxc, hxE⟩ := hmeet + exact ⟨x, hxc, Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, hCs⟩, hxE⟩)⟩ + +/-- The line alternative in XII (2.1), Case 1. Contraction in the +controlled carrier puts the selected disc there, and each atom of +that carrier is already met by the trace. -/ +theorem meets_insWalk_of_line_trace_deformation + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) + {φ ψ : C(Circle, S)} (hφ : IsEmbedding φ) (hnφ : Γ.IsNormal (range φ)) + {u : S} (W : GraphWalk K.toGraph u u) (hψU : range ψ = (walkDrawing K W).U) + {D Z L c : Set S} (hD : IsClosedDisc D) (hbdD : subBd D = range φ) + (hmD : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + (hh : ClosedCurvesHomotopicIn Z φ ψ) (hL : IsLine L) (hψL : range ψ = L) + (hZorig : Z ∩ Γ.U ⊆ range φ) (hZΓ : Z ∩ Γ.U ⊆ range ψ) + (hZR : ∀ r ∈ Γ.R, (Z ∩ r).Nonempty → (range ψ ∩ r).Nonempty) + (hc : c ∈ Γ.A) (hcD : (c ∩ D).Nonempty) (ins : Drawing S → Set S) : + (c ∩ insWalk ins K W).Nonempty := by + have hnDf : (PaintingOrDrawing.drawing Γ).IsNormal (frontier D) := by + rw [← subBd_eq_frontier, hbdD] + exact hnφ + obtain ⟨q, hqΓ, hqD, _⟩ := exists_support_point_outside_two_small_sides + (Γ := .drawing Γ) hT hD.isCompact.isClosed hD.isCompact.isClosed hnDf hnDf hmD hmD + have hφD : range φ ⊆ D := by + intro x hx + have hxb : x ∈ subBd D := hbdD.symm ▸ hx + exact hD.isCompact.isClosed.closure_subset_iff.mpr subset_rfl hxb.1 + have hqZ : q ∉ Z := fun hq => hqD (hφD (hZorig ⟨hq, hqΓ⟩)) + have hψZ : range ψ ⊆ Z := by + obtain ⟨H, hHZ, _, hH1⟩ := hh + rintro x ⟨z, rfl⟩ + exact hH1 z ▸ hHZ (z, 1) + have hLZ : L ⊆ Z := hψL ▸ hψZ + have hn : ClosedCurveIsNullHomotopicIn Z φ := GM11.null_of_homotopic hLZ hh + ((GM11.IsLine.isSimplyConnected hL).2 ψ hψL.subset) + have hDZ : D ⊆ Z := by + intro p hpD + by_contra hpZ + have hZpair : Z ⊆ ({p, q} : Set S)ᶜ := by + intro x hx hpair + simp only [mem_insert_iff, mem_singleton_iff] at hpair + rcases hpair with hxp | hxq + · exact hpZ (hxp ▸ hx) + · exact hqZ (hxq ▸ hx) + obtain ⟨z, hz, H⟩ := hn + have hnpair : ClosedCurveIsNullHomotopicIn ({p, q} : Set S)ᶜ φ := ⟨z, hZpair hz, H.mono hZpair⟩ + exact ((curve_null_in_pair_compl_iff_not_mem_disc hS hφ hD hbdD hqD).mp hnpair) hpD + obtain ⟨x, hxc, hxψ⟩ := atom_meets_image_of_carrier_controls hZΓ hZR hc + (hcD.mono (inter_subset_inter_right c hDZ)) + exact ⟨x, hxc, Or.inl (hψU ▸ hxψ)⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2DeformationInside.lean b/LeanPool/GraphMinor/GM12/Section2DeformationInside.lean new file mode 100644 index 0000000000..eb90c7ccf8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2DeformationInside.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2InsideHomotopy +public import LeanPool.GraphMinor.GM12.Section2NormalNoncover +import LeanPool.GraphMinor.GM11.Regions + +/-! +# Region deformations preserve the atoms met by selected insides + +In Case 1 of XII (2.1), page 244, the curve is deformed to its +simple trace through its visited regions and boundary vertices. +An atom met by this deformation is either met by the final curve, +or is a visited region, which the final curve also meets. For an +atom missed by the final curve, the homotopy avoids that atom. +A drawing point outside both selected discs is avoided too. The +two-point inside comparison then transfers every inside incidence. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The inside-incidence conclusion of the deformation step in +XII (2.1), Case 1. The homotopy may use the visited regions and +the final curve's drawing vertices, and no other drawing points. -/ +theorem atom_meets_disc_of_region_deformation + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) + {φ ψ : C(Circle, S)} (hφ : IsEmbedding φ) (hψ : IsEmbedding ψ) + {D E : Set S} (hD : IsClosedDisc D) (hE : IsClosedDisc E) + (hbdD : subBd D = range φ) (hbdE : subBd E = range ψ) + (hnD : Γ.IsNormal (range φ)) (hnE : Γ.IsNormal (range ψ)) + (hmD : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + (hmE : ((PaintingOrDrawing.drawing Γ).inter E, + (PaintingOrDrawing.drawing Γ).interOutside E) ∈ T) + {Z : Set S} (hh : ClosedCurvesHomotopicIn Z φ ψ) + (hZΓ : Z ∩ Γ.U ⊆ range ψ) + (hZR : ∀ r ∈ Γ.R, (Z ∩ r).Nonempty → (range ψ ∩ r).Nonempty) + {c : Set S} (hc : c ∈ Γ.A) (hcD : (c ∩ D).Nonempty) : + (c ∩ E).Nonempty := by + have hnDf : (PaintingOrDrawing.drawing Γ).IsNormal (frontier D) := by + rw [← subBd_eq_frontier, hbdD] + exact hnD + have hnEf : (PaintingOrDrawing.drawing Γ).IsNormal (frontier E) := by + rw [← subBd_eq_frontier, hbdE] + exact hnE + obtain ⟨q, hqΓ, hqD, hqE⟩ := exists_support_point_outside_two_small_sides (Γ := .drawing Γ) hT + hD.isCompact.isClosed hE.isCompact.isClosed hnDf hnEf hmD hmE + have hψE : range ψ ⊆ E := by + intro x hx + have hxb : x ∈ subBd E := hbdE.symm ▸ hx + exact hE.isCompact.isClosed.closure_subset_iff.mpr subset_rfl hxb.1 + by_cases hmeet : (c ∩ range ψ).Nonempty + · exact hmeet.mono (inter_subset_inter_right c hψE) + · have hqZ : q ∉ Z := fun hq => hqE (hψE (hZΓ ⟨hq, hqΓ⟩)) + have hZc : Disjoint Z c := by + apply disjoint_left.mpr + intro x hxZ hxc + rcases hc with (⟨v, hv, rfl⟩ | he) | hr + · have hxΓ : x ∈ Γ.U := Γ.V_subset_U (hxc ▸ hv) + exact hmeet ⟨x, hxc, hZΓ ⟨hxZ, hxΓ⟩⟩ + · have hxΓ : x ∈ Γ.U := (he.2.1 hxc).1 + exact hmeet ⟨x, hxc, hZΓ ⟨hxZ, hxΓ⟩⟩ + · obtain ⟨y, hyψ, hyr⟩ := hZR c hr ⟨x, hxZ, hxc⟩ + exact hmeet ⟨y, hyr, hyψ⟩ + obtain ⟨p, hpc, hpD⟩ := hcD + have hZpair : Z ⊆ ({p, q} : Set S)ᶜ := by + intro x hx hpair + simp only [mem_insert_iff, mem_singleton_iff] at hpair + rcases hpair with hxp | hxq + · exact disjoint_left.mp hZc hx (hxp.symm ▸ hpc) + · exact hqZ (hxq ▸ hx) + exact ⟨p, hpc, (mem_disc_iff_of_boundary_homotopy hS hφ hψ hD hE hbdD hbdE + hqD hqE (hh.mono hZpair)).mp hpD⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2DiscChordSplit.lean b/LeanPool/GraphMinor/GM12/Section2DiscChordSplit.lean new file mode 100644 index 0000000000..3d6ee071f6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2DiscChordSplit.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2ArcComponents +public import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Cutting a disc along a chord with prescribed boundary arcs + +In Case 2 of XII (2.1), page 244, the three lines of a theta graph +bound three circles. If one line lies in the disc bounded by the other +two, the disc-cutting theorem gives two subdiscs. Identifying the two +components of the punctured boundary identifies their boundaries. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +private theorem line_interior_nonempty {S : Type*} [TopologicalSpace S] + {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) : (L \ {a, b}).Nonempty := + Surface.IsLineWithEnds.nonempty_sdiff hL + +private theorem remove_ends_union {S : Type*} {A L F : Set S} (hF : F ⊆ L) : + (A \ F) ∪ L = A ∪ L := by + ext x + constructor + · rintro (hx | hx) + · exact Or.inl hx.1 + · exact Or.inr hx + · rintro (hx | hx) + · by_cases hxF : x ∈ F + · exact Or.inr (hF hxF) + · exact Or.inl ⟨hx, hxF⟩ + · exact Or.inr hx + +/-- Cutting a disc along a line joining the common ends of its two +boundary arcs gives subdiscs whose intersection is the cutting line. -/ +theorem disc_split_with_boundary_arcs_inter {S : Type*} [TopologicalSpace S] [T2Space S] + {D L A B : Set S} {a b : S} (hD : IsClosedDisc D) + (hL : IsLineWithEnds L a b) (hA : IsLineWithEnds A a b) (hB : IsLineWithEnds B a b) + (hAB : A ∩ B = {a, b}) (hLA : L ∩ A = {a, b}) (hLB : L ∩ B = {a, b}) + (hbd : discBd D = A ∪ B) (hLD : L ⊆ D) (hab : a ≠ b) : + ∃ E₁ E₂ : Set S, IsClosedDisc E₁ ∧ IsClosedDisc E₂ ∧ E₁ ∪ E₂ = D ∧ E₁ ∩ E₂ = L ∧ + discBd E₁ = A ∪ L ∧ discBd E₂ = B ∪ L := by + have hcap : L ∩ discBd D = {a, b} := by + rw [hbd, inter_union_distrib_left, hLA, hLB, union_self] + obtain ⟨C₁, C₂, E₁, E₂, _, hcomponents, hE₁, hE₂, hU, hI, hb₁, hb₂, _⟩ := + disc_iArc D L a b hD hLD hab hL hcap + have hcomp : componentsIn (discBd D \ {a, b}) = {A \ {a, b}, B \ {a, b}} := by + rw [hbd] + exact componentsIn_union_sdiff hA.isCompact.isClosed hB.isCompact.isClosed hAB.subset + (GraphMinor.GM11.IsLineWithEnds.isPreconnected_sdiff_pair hA) + (GraphMinor.GM11.IsLineWithEnds.isPreconnected_sdiff_pair hB) + (line_interior_nonempty hA) (line_interior_nonempty hB) + have hend : ({a, b} : Set S) ⊆ L := by + intro x hx + exact (hLA.symm ▸ hx).1 + have hpair : ({C₁, C₂} : Set (Set S)) = {A \ {a, b}, B \ {a, b}} := + hcomponents.symm.trans hcomp + rcases Set.pair_eq_pair_iff.mp hpair with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact ⟨E₁, E₂, hE₁, hE₂, hU, hI, + hb₁.trans (h₁ ▸ remove_ends_union hend), hb₂.trans (h₂ ▸ remove_ends_union hend)⟩ + · exact ⟨E₂, E₁, hE₂, hE₁, (union_comm _ _).trans hU, (inter_comm _ _).trans hI, + hb₂.trans (h₂ ▸ remove_ends_union hend), hb₁.trans (h₁ ▸ remove_ends_union hend)⟩ + +/-- Cutting a disc along a line joining the common ends of its two +boundary arcs gives subdiscs bounded by that line and each boundary arc. -/ +theorem disc_split_with_boundary_arcs {S : Type*} [TopologicalSpace S] [T2Space S] + {D L A B : Set S} {a b : S} (hD : IsClosedDisc D) + (hL : IsLineWithEnds L a b) (hA : IsLineWithEnds A a b) (hB : IsLineWithEnds B a b) + (hAB : A ∩ B = {a, b}) (hLA : L ∩ A = {a, b}) (hLB : L ∩ B = {a, b}) + (hbd : discBd D = A ∪ B) (hLD : L ⊆ D) (hab : a ≠ b) : + ∃ E₁ E₂ : Set S, IsClosedDisc E₁ ∧ IsClosedDisc E₂ ∧ E₁ ∪ E₂ = D ∧ + discBd E₁ = A ∪ L ∧ discBd E₂ = B ∪ L := by + obtain ⟨E₁, E₂, hE₁, hE₂, hU, _, hb₁, hb₂⟩ := + disc_split_with_boundary_arcs_inter hD hL hA hB hAB hLA hLB hbd hLD hab + exact ⟨E₁, E₂, hE₁, hE₂, hU, hb₁, hb₂⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2DistinctRegionPaths.lean b/LeanPool/GraphMinor/GM12/Section2DistinctRegionPaths.lean new file mode 100644 index 0000000000..df8ef9b004 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2DistinctRegionPaths.lean @@ -0,0 +1,81 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2CyclicEmbedding +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.Regions + +/-! +# Distinct region visits give a simple cyclic curve + +In Case 1 of XII (2.1), page 244, the original vertex visits are +distinct and the successive region visits are distinct. A two-spoke +path has its endpoints at those vertices and its other points in +its region. Two half-open paths can therefore meet only when their +region labels agree, or when both parameters are their common +initial vertex. Injectivity within each path completes the argument. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM07 + +/-- Paths with distinct initial drawing vertices and distinct region +interiors have disjoint half-open images, provided each half-open path is +injective. This is the simplicity test in XII (2.1), Case 1. -/ +theorem halfopen_separation_of_distinct_regions + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} {ι : Type*} + {v : ι → S} (hv : ∀ i, v i ∈ Γ.V) (hvi : Function.Injective v) + {r : ι → Set S} (hr : ∀ i, r i ∈ Γ.R) (hri : Function.Injective r) + (γ : ι → C(unitInterval, S)) (hγi : ∀ i, InjOn (γ i) (Ico (0 : unitInterval) 1)) + (hγ0 : ∀ i, γ i 0 = v i) + (hγr : ∀ i t, 0 < t.val → t.val < 1 → γ i t ∈ r i) : + ∀ (i j : ι) (s t : unitInterval), s.val < 1 → t.val < 1 → + γ i s = γ j t → i = j ∧ s = t := by + intro i j s t hs ht heq + have hij : i = j := by + by_cases hs0 : s = 0 + · by_cases ht0 : t = 0 + · rw [hs0, ht0, hγ0 i, hγ0 j] at heq + exact hvi heq + · rw [hs0, hγ0 i] at heq + have htpos : 0 < t.val := unitInterval.pos_iff_ne_zero.mpr ht0 + exact (region_subset (hr j) (hγr j t htpos ht) + (heq ▸ Γ.V_subset_U (hv i))).elim + · have hspos : 0 < s.val := unitInterval.pos_iff_ne_zero.mpr hs0 + by_cases ht0 : t = 0 + · rw [ht0, hγ0 j] at heq + exact (region_subset (hr i) (hγr i s hspos hs) + (heq.symm ▸ Γ.V_subset_U (hv j))).elim + · have htpos : 0 < t.val := unitInterval.pos_iff_ne_zero.mpr ht0 + exact hri (region_eq_of_mem (hr i) (hr j) (hγr i s hspos hs) + (heq.symm ▸ hγr j t htpos ht)) + subst j + exact ⟨rfl, hγi i ⟨s.property.1, hs⟩ ⟨t.property.1, ht⟩ heq⟩ + +/-- Cyclic paths in distinct regions assemble to an embedded circle +when their drawing vertices are distinct and each half-open path is injective. -/ +theorem concatLoop_isEmbedding_of_distinct_regions + {S : Type*} [TopologicalSpace S] [T2Space S] {Γ : Drawing S} + {n : ℕ} (hn : 0 < n) + {v : Fin n → S} (hv : ∀ i, v i ∈ Γ.V) (hvi : Function.Injective v) + {r : Fin n → Set S} (hr : ∀ i, r i ∈ Γ.R) (hri : Function.Injective r) + (γ : Fin n → C(unitInterval, S)) (hγi : ∀ i, InjOn (γ i) (Ico (0 : unitInterval) 1)) + (hγ0 : ∀ i, γ i 0 = v i) + (hγr : ∀ i t, 0 < t.val → t.val < 1 → γ i t ∈ r i) + (hmatch : ∀ i : Fin n, γ i 1 = γ (finNext hn i) 0) : + IsEmbedding (concatLoop hn γ hmatch) := by + have hinj := concatLoop_injective_of_halfopen_pieces hn γ hmatch + (halfopen_separation_of_distinct_regions hv hvi hr hri γ hγi hγ0 hγr) + exact (concatLoop hn γ hmatch).continuous.isClosedEmbedding hinj |>.isEmbedding + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2DistinctVisits.lean b/LeanPool/GraphMinor/GM12/Section2DistinctVisits.lean new file mode 100644 index 0000000000..56dcebc73d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2DistinctVisits.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2ConnectedRegionArc +import LeanPool.GraphMinor.GM12.Section2CirclePeriod + +/-! +# Distinct vertices and regions in the first trace case + +For Case 1 of XII (2.1), page 244, list the vertex parameters in +one closed real period. The original circle is embedded, so all +initial vertex images are distinct. If each region intersection is +preconnected, its whole parameter preimage lies in any one visit +arc. Two intervals assigned to that region would therefore overlap, +contrary to their parameter order. Thus the region labels are also +distinct, as required for the simple trace circle. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +private theorem parameter_in_period {n : ℕ} (t : Fin (n + 1) → ℝ) (ht : StrictMono t) + (hperiod : t (Fin.last n) = t 0 + 1) (i : Fin n) : + t i.castSucc ∈ Ico (t 0) (t 0 + 1) := by + refine ⟨ht.monotone (Fin.zero_le _), ?_⟩ + rw [← hperiod] + apply ht + change i.val < n + exact i.isLt + +/-- Initial vertex images of an ordered one-period subdivision of +an embedded circle are distinct. -/ +theorem vertex_visits_injective + {S : Type*} [TopologicalSpace S] {φ : C(Circle, S)} (hφ : Function.Injective φ) + {n : ℕ} (t : Fin (n + 1) → ℝ) (ht : StrictMono t) + (hperiod : t (Fin.last n) = t 0 + 1) : + Function.Injective (fun i : Fin n => periodicCurve φ (t i.castSucc)) := by + intro i j hij + have hpar := circle_parameter_injOn (t 0) (parameter_in_period t ht hperiod i) + (parameter_in_period t ht hperiod j) (hφ hij) + have hfin := ht.injective hpar + exact Fin.ext (congrArg (fun k : Fin (n + 1) => k.val) hfin) + +/-- If every region intersection with an embedded circle is +preconnected, the regions of its successive normal intervals are +distinct. This supplies the region condition of XII (2.1), Case 1. -/ +theorem region_visits_injective + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} + {φ : C(Circle, S)} (hφ : IsEmbedding φ) + (hconn : ∀ r ∈ Γ.R, IsPreconnected (range φ ∩ r)) + {n : ℕ} (t : Fin (n + 1) → ℝ) (ht : StrictMono t) + (hperiod : t (Fin.last n) = t 0 + 1) + (hΓ : ∀ i, periodicCurve φ (t i) ∈ Γ.V) + (r : Fin n → Set S) (hr : ∀ i, r i ∈ Γ.R) + (hfr : ∀ i s, s ∈ Ioo (t i.castSucc) (t i.succ) → periodicCurve φ s ∈ r i) : + Function.Injective r := by + intro i j hij + let m := (t j.castSucc + t j.succ) / 2 + have hjlt := ht j.castSucc_lt_succ + have hm : m ∈ Ioo (t j.castSucc) (t j.succ) := + ⟨by dsimp [m]; linarith, by dsimp [m]; linarith⟩ + have hmr : periodicCurve φ m ∈ r i := hij.symm ▸ hfr j m hm + obtain ⟨s, hs, hsm⟩ := preimage_region_subset_parameter_arc hφ (hr i) (hconn _ (hr i)) + (ht i.castSucc_lt_succ) (hΓ _) (hΓ _) (hfr i) hmr + have in_period : ∀ (k : Fin n) x, x ∈ Ioo (t k.castSucc) (t k.succ) → + x ∈ Ico (t 0) (t 0 + 1) := by + intro k x hx + refine ⟨(ht.monotone (Fin.zero_le _)).trans hx.1.le, ?_⟩ + have hupper := hx.2.trans_le (ht.monotone (Fin.le_last _)) + simpa only [hperiod] using hupper + have hsm' := circle_parameter_injOn (t 0) (in_period i s hs) (in_period j m hm) hsm + have hmi : m ∈ Ioo (t i.castSucc) (t i.succ) := hsm' ▸ hs + by_contra hne + rcases lt_or_gt_of_ne hne with hlt | hgt + · have hle : i.succ ≤ j.castSucc := by change i.val + 1 ≤ j.val; omega + have := ht.monotone hle + exact (not_lt_of_ge (this.trans hm.1.le) hmi.2).elim + · have hle : j.succ ≤ i.castSucc := by change j.val + 1 ≤ i.val; omega + have := ht.monotone hle + exact (not_lt_of_ge (this.trans hmi.1.le) hm.2).elim + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2EntryAtPath.lean b/LeanPool/GraphMinor/GM12/Section2EntryAtPath.lean new file mode 100644 index 0000000000..a22eed782b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2EntryAtPath.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2EntryIndependence +import LeanPool.GraphMinor.GM12.Section2EntryComparison + +/-! +# Reading an entry comparison at a prescribed starting path + +For the corner comparison in XII (2.1), pages 243--244, move an entry +witness to a chosen point of its approach. Normalize it against the +path from that point to the vertex. The resulting spoke has the exact +edge closure and interior image, and its concatenation with the +approach is homotopic to a path in the region. Endpoint casts express +this comparison with the original path's endpoints. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Read an entry witness as a spoke-path comparison for a normalized +approach starting at any prescribed interior parameter. -/ +theorem entry_comparison_at_path_start + {S : Type*} [TopologicalSpace S] [T2Space S] + {r e : Set S} {v w : S} (hcell : IsOpenDisc r) (hw : w ∈ r) + (hvE : v ∉ e) (hwE : w ∉ e) (hvw : v ≠ w) + {f : ℝ → S} (hf : Continuous f) {a c h₀ : ℝ} (hh₀ : h₀ ∈ Ioo a c) + (hfc : f c = v) (hfr : ∀ t ∈ Ioo a c, f t ∈ r) + (hentry : EntersLike f a c e r v w) + {x : (r ∪ {v} : Set S)} + (F : Path x (⟨v, Or.inr rfl⟩ : (r ∪ {v} : Set S))) + (hF : ∀ t, (F t).val = f (h₀ + t.val * (c - h₀))) : + ∃ (β : Path (⟨v, Or.inr rfl⟩ : (r ∪ {v} : Set S)) ⟨w, Or.inl hw⟩) + (ρ : Path x (⟨w, Or.inl hw⟩ : (r ∪ {v} : Set S))), + Function.Injective (fun t => (β t).val) ∧ + range (fun t => (β t).val) = closure e ∧ + (fun t => (β t).val) '' Ioo (0 : unitInterval) 1 = e ∧ + (∀ t, (ρ t).val ∈ r) ∧ (F.trans β).Homotopic ρ := by + obtain ⟨ξ, ρ₀, hξ, hρ₀, hhom⟩ := entersLike_witness_at hcell hw hvE hwE hvw + hf hfc hfr hentry hh₀ + have hstart : h₀ = h₀ + (0 : unitInterval).val * (c - h₀) := by simp + obtain ⟨β₀, σ₀, hβi, hβrange, hβe, hσr, hcompare⟩ := + compare_entry_to_approach hw F hF hstart hfc hvE hwE hvw hξ hρ₀ hhom + let β := β₀.cast F.target.symm rfl + let ρ := σ₀.cast F.source.symm rfl + have hleft : ((F.subpath 0 1).trans β₀).cast F.source.symm rfl = F.trans β := by + rw [Path.cast_trans _ _ _ F.target.symm _, Path.subpath_zero_one] + rfl + have hcompare' := hcompare.pathCast F.source.symm rfl + rw [hleft] at hcompare' + exact ⟨β, ρ, hβi, hβrange, hβe, hσr, hcompare'⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2EntryAtPathInSubspace.lean b/LeanPool/GraphMinor/GM12/Section2EntryAtPathInSubspace.lean new file mode 100644 index 0000000000..785573017b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2EntryAtPathInSubspace.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2EntryAtPath + +/-! +# Entry comparisons in a larger subspace + +For the region deformation in XII (2.1), page 244, both ends of a +region visit must be present in one subspace. Lift a single approach +to the region together with its own limiting vertex, read its entry +comparison there, and map that comparison into the larger subspace. +The prescribed approach path is retained exactly. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Read an entry comparison in any subspace containing the region +and the entering vertex. The terminal spoke retains its exact edge +closure and interior image. -/ +theorem entry_comparison_at_path_start_in_subspace + {S : Type*} [TopologicalSpace S] [T2Space S] + {r e Z : Set S} {v w : S} (hcell : IsOpenDisc r) (hw : w ∈ r) + (hZ : r ∪ {v} ⊆ Z) (hvE : v ∉ e) (hwE : w ∉ e) (hvw : v ≠ w) + {f : ℝ → S} (hf : Continuous f) {a c h₀ : ℝ} (hh₀ : h₀ ∈ Ioo a c) + (hfc : f c = v) (hfr : ∀ t ∈ Ioo a c, f t ∈ r) + (hentry : EntersLike f a c e r v w) + {x : Z} (F : Path x (⟨v, hZ (Or.inr rfl)⟩ : Z)) + (hFsmall : ∀ t, (F t).val ∈ r ∪ {v}) + (hF : ∀ t, (F t).val = f (h₀ + t.val * (c - h₀))) : + ∃ (β : Path (⟨v, hZ (Or.inr rfl)⟩ : Z) ⟨w, hZ (Or.inl hw)⟩) + (ρ : Path x (⟨w, hZ (Or.inl hw)⟩ : Z)), + Function.Injective (fun t => (β t).val) ∧ + range (fun t => (β t).val) = closure e ∧ + (fun t => (β t).val) '' Ioo (0 : unitInterval) 1 = e ∧ + (∀ t, (ρ t).val ∈ r) ∧ (F.trans β).Homotopic ρ := by + let x₀ : (r ∪ {v} : Set S) := ⟨x.val, (congrArg Subtype.val F.source) ▸ hFsmall 0⟩ + let F₀ : Path x₀ (⟨v, Or.inr rfl⟩ : (r ∪ {v} : Set S)) := { + toFun := fun t => ⟨(F t).val, hFsmall t⟩ + continuous_toFun := (continuous_subtype_val.comp F.continuous).subtype_mk _ + source' := by + apply Subtype.ext + change (F 0).val = x.val + exact congrArg (fun z : Z => z.val) F.source + target' := by + apply Subtype.ext + change (F 1).val = v + exact congrArg (fun z : Z => z.val) F.target } + obtain ⟨β₀, ρ₀, hβ, hβrange, hβe, hρ, hhom⟩ := + entry_comparison_at_path_start hcell hw hvE hwE hvw hf hh₀ hfc hfr hentry F₀ hF + let J : C((r ∪ {v} : Set S), Z) := + ⟨fun z => ⟨z.val, hZ z.property⟩, continuous_subtype_val.subtype_mk _⟩ + have hFmap : F₀.map J.continuous = F := by ext t; rfl + have hm := hhom.map J + rw [Path.map_trans, hFmap] at hm + exact ⟨β₀.map J.continuous, ρ₀.map J.continuous, hβ, hβrange, hβe, hρ, hm⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2EntryComparison.lean b/LeanPool/GraphMinor/GM12/Section2EntryComparison.lean new file mode 100644 index 0000000000..b2ee675935 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2EntryComparison.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import Mathlib.Topology.Subpath +import LeanPool.GraphMinor.GM12.Section2EntryNormalization +import LeanPool.GraphMinor.GM12.Section2EntryPaths +import LeanPool.GraphMinor.GM12.Section2PathHomotopy + +/-! +# Comparing an entry curve with a common approach + +XII, page 243, allows the starting point of an entry curve to vary. +Lift the entry curve and its comparison curve to the region together +with its boundary vertex. Normalize the approach and read off the +terminal spoke. The comparison path stays in the region, which is the +information needed to cancel two approaches starting at different times. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Normalize one entry-curve witness against a fixed approach path. +Its terminal path is an injective parametrization of the spoke closure. +The normalized entry remains homotopic to a path in the region. -/ +theorem compare_entry_to_approach {S : Type*} [TopologicalSpace S] [T2Space S] + {r e : Set S} {v w : S} (hw : w ∈ r) {a b : (r ∪ {v} : Set S)} + (F : Path a b) {f : ℝ → S} {h₀ h c : ℝ} {s : unitInterval} + (hF : ∀ t, (F t).val = f (h₀ + t.val * (c - h₀))) + (hstart : h = h₀ + s.val * (c - h₀)) (hfc : f c = v) + (hvE : v ∉ e) (hwE : w ∉ e) (hvw : v ≠ w) + {ξ ρ : Curve S} (hentry : IsEntryCurve f h c e w ξ) + (hρ : range ρ ⊆ r) (hh : CurvesHomotopicIn (r ∪ {v}) ξ ρ) : + ∃ (β : Path (F 1) (⟨w, Or.inl hw⟩ : (r ∪ {v} : Set S))) + (σ : Path (F s) (⟨w, Or.inl hw⟩ : (r ∪ {v} : Set S))), + Function.Injective (fun t => (β t).val) ∧ + range (fun t => (β t).val) = closure e ∧ + (fun t => (β t).val) '' Ioo (0 : unitInterval) 1 = e ∧ + (∀ t, (σ t).val ∈ r) ∧ ((F.subpath s 1).trans β).Homotopic σ := by + obtain ⟨τ, hτ0, hτ1, hfirst, hinj, himage, hξ1⟩ := hentry + have hξ0 : ξ 0 = f h := by + simpa only [Icc.coe_zero, zero_div, zero_mul, add_zero] using hfirst 0 (bot_le) + have hξτ : ξ τ = v := by + rw [hfirst τ le_rfl, div_self (ne_of_gt hτ0), one_mul] + convert hfc using 1 + congr 1 + ring + have hFs : (F s).val = f h := by rw [hF, hstart] + have hξZ : ∀ t, ξ t ∈ r ∪ {v} := by + obtain ⟨H, hHZ, hH0, _, _⟩ := hh + intro t + exact hH0 t ▸ hHZ (t, 0) + have heq0 : ξ 0 = ρ 0 := by + obtain ⟨H, _, _, _, h0, h0', _⟩ := hh + exact (h0 0).symm.trans (h0' 0) + have heq1 : ξ 1 = ρ 1 := by + obtain ⟨H, _, _, _, _, _, h1, h1'⟩ := hh + exact (h1 0).symm.trans (h1' 0) + let P : Path (F s) (⟨w, Or.inl hw⟩ : (r ∪ {v} : Set S)) := { + toFun := fun t => ⟨ξ t, hξZ t⟩ + continuous_toFun := ξ.continuous.subtype_mk _ + source' := Subtype.ext (hξ0.trans hFs.symm) + target' := Subtype.ext hξ1 } + let σ : Path (F s) (⟨w, Or.inl hw⟩ : (r ∪ {v} : Set S)) := { + toFun := fun t => ⟨ρ t, Or.inl (hρ (mem_range_self t))⟩ + continuous_toFun := ρ.continuous.subtype_mk _ + source' := Subtype.ext (heq0.symm.trans (hξ0.trans hFs.symm)) + target' := Subtype.ext (heq1.symm.trans hξ1) } + have hPval : ∀ t, (P t).val = ξ t := fun _ => rfl + have hPσ : P.Homotopic σ := paths_homotopic_of_curvesHomotopicIn P σ hh + obtain ⟨β, hβval, hβhom⟩ := normalize_entry_approach + (fun x : (r ∪ {v} : Set S) => x.val) Subtype.val_injective F hF hstart + P ξ hPval hτ0 hfirst + have hβeq : (fun t => (β t).val) = (fun t => ((P.subpath τ 1) t).val) := by + funext t + exact hβval t + have hβinj : Function.Injective (fun t => (β t).val) := by + rw [hβeq] + apply entry_terminal_injective (fun x : (r ∪ {v} : Set S) => x.val) P ξ hPval + hτ1 himage hinj + · change ξ τ ∉ e + rwa [hξτ] + · change ξ 1 ∉ e + rwa [hξ1] + · change ξ τ ≠ ξ 1 + rwa [hξτ, hξ1] + have hβint : (fun t => (β t).val) '' Ioo (0 : unitInterval) 1 = e := by + rw [hβeq] + exact entry_subpath_interior _ P ξ hPval hτ1 himage + have hβrange : range (fun t => (β t).val) = closure e := by + have h := path_range_eq_closure_interior (β.map continuous_subtype_val) + change range (fun t => (β t).val) = closure ((fun t => (β t).val) '' Ioo + (0 : unitInterval) 1) at h + rwa [hβint] at h + exact ⟨β, σ, hβinj, hβrange, hβint, fun t => hρ (mem_range_self t), hβhom.trans hPσ⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2EntryConstruction.lean b/LeanPool/GraphMinor/GM12/Section2EntryConstruction.lean new file mode 100644 index 0000000000..05ad491161 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2EntryConstruction.lean @@ -0,0 +1,86 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import Mathlib.Topology.Path + +/-! +# Constructing an entry curve from two paths + +For the entry-edge definition of XII, page 243, concatenate the affine +approach to the vertex with a parametrization of the spoke. The joining +time is one half. This file checks the exact parametrization, including +injectivity and the image of the second half. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The normalized approach followed by a spoke path is an entry curve +in the exact sense of the definition on XII page 243. -/ +theorem isEntryCurve_trans {S : Type*} [TopologicalSpace S] + {f : ℝ → S} {h c : ℝ} {x v w : S} (p : Path x v) (q : Path v w) + (hp : ∀ t : unitInterval, p t = f (h + t.val * (c - h))) + (hq : Function.Injective q) {e : Set S} + (hqe : q '' Ioo (0 : unitInterval) 1 = e) : + IsEntryCurve f h c e w (p.trans q).toContinuousMap := by + let s : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + refine ⟨s, by change (0 : ℝ) < 1 / 2; norm_num, by change (1 / 2 : ℝ) < 1; norm_num, ?_, ?_, ?_, + ?_⟩ + · intro t ht + change (p.trans q) t = _ + have ht' : (t : ℝ) ≤ 1 / 2 := ht + rw [Path.trans_apply, dite_eq_left ht', hp] + congr 1 + change h + (2 * t.val) * (c - h) = h + t.val / (1 / 2) * (c - h) + ring + · intro x hx y hy heq + change (p.trans q) x = (p.trans q) y at heq + have hx' : ¬ (x : ℝ) ≤ 1 / 2 := not_le.mpr hx.1 + have hy' : ¬ (y : ℝ) ≤ 1 / 2 := not_le.mpr hy.1 + simp only [Path.trans_apply, hx', hy', ↓reduceDIte] at heq + have h := congrArg Subtype.val (hq heq) + apply Subtype.ext + dsimp only at h + linarith + · change (fun t => (p.trans q) t) '' Ioo s 1 = e + rw [← hqe] + ext z + constructor + · rintro ⟨t, ht, rfl⟩ + have ht' : ¬ (t : ℝ) ≤ 1 / 2 := not_le.mpr ht.1 + change (p.trans q) t ∈ q '' Ioo (0 : unitInterval) 1 + rw [Path.trans_apply, dite_eq_right ht'] + refine ⟨_, ⟨?_, ?_⟩, rfl⟩ + · change (0 : ℝ) < 2 * t.val - 1 + have hlt : (1 / 2 : ℝ) < t := ht.1 + linarith + · change 2 * t.val - 1 < 1 + have hlt : (t : ℝ) < 1 := ht.2 + linarith + · rintro ⟨t, ht, rfl⟩ + let u : unitInterval := ⟨(t.val + 1) / 2, by have := t.property.1; linarith, + by have := t.property.2; linarith⟩ + have hu0 : s < u := by + change (1 / 2 : ℝ) < (t.val + 1) / 2; have ht0 : (0 : ℝ) < t := ht.1; linarith + have hu1 : u < 1 := by change (t.val + 1) / 2 < 1; have ht1 : (t : ℝ) < 1 := ht.2; linarith + refine ⟨u, ⟨hu0, hu1⟩, ?_⟩ + change (p.trans q) u = q t + rw [Path.trans_apply, dite_eq_right (not_le.mpr (show (1 / 2 : ℝ) < u from hu0))] + apply congrArg q + apply Subtype.ext + change 2 * ((t.val + 1) / 2) - 1 = t.val + ring + · exact (p.trans q).target + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2EntryEnds.lean b/LeanPool/GraphMinor/GM12/Section2EntryEnds.lean new file mode 100644 index 0000000000..9d343aaad9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2EntryEnds.lean @@ -0,0 +1,84 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM12.Section2SpokePaths + +/-! +# The endpoints of an entry edge + +In XII's trace definition, page 243, an entry curve follows the approach +to a vertex and then traces a radial edge to a region hub. Continuity +puts both points in the closure of that edge. The radial endpoint +properties identify them as its two graph ends. This allows entry +existence to construct actual two-edge graph-walk steps. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The joining vertex and terminal hub of an entry curve lie in the +closure of the edge it traces. -/ +theorem entryCurve_ends_mem_closure {S : Type*} [TopologicalSpace S] + {f : ℝ → S} {h c : ℝ} {e : Set S} {v w : S} {ξ : Curve S} + (hfc : f c = v) (hξ : IsEntryCurve f h c e w ξ) : + v ∈ closure e ∧ w ∈ closure e := by + obtain ⟨s, hs, hs1, hfirst, _, himage, hlast⟩ := hξ + have hξs : ξ s = v := by + have hh := hfirst s le_rfl + have hs0 : s.val ≠ 0 := ne_of_gt (show (0 : ℝ) < s.val from hs) + simpa only [div_self hs0, one_mul, add_sub_cancel, hfc] using hh + have hmap : ∀ t ∈ closure (Ioo s (1 : unitInterval)), ξ t ∈ closure e := by + intro t ht + exact map_mem_closure ξ.continuous ht (t := e) fun u hu => himage ▸ mem_image_of_mem ξ hu + have hscl : s ∈ closure (Ioo s (1 : unitInterval)) := by + rw [closure_Ioo hs1.ne] + exact ⟨le_rfl, hs1.le⟩ + have h1cl : (1 : unitInterval) ∈ closure (Ioo s (1 : unitInterval)) := by + rw [closure_Ioo hs1.ne] + exact ⟨hs1.le, le_rfl⟩ + exact ⟨hξs ▸ hmap s hscl, hlast ▸ hmap 1 h1cl⟩ + +/-- An entry edge has precisely the original vertex and the region +hub as its two graph ends. This recovers the graph-link data from the +curve form of the entry definition in XII, page 243. -/ +theorem entersLike_isLink {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hrad : PreRad (.drawing Γ) K) {r e : Set S} (hr : r ∈ Γ.R) + {v w : S} (hv : v ∈ Γ.V) (hw : w ∈ r) (hwV : w ∈ K.V) (he : e ∈ K.E) + {f : ℝ → S} {a c : ℝ} (hfc : f c = v) + (hentry : EntersLike f a c e r v w) : K.toGraph.IsLink e v w := by + obtain ⟨h, _, ξ, _, hξ, _, _⟩ := hentry + obtain ⟨hve, hwe⟩ := entryCurve_ends_mem_closure hfc hξ + have her := spoke_subset_region hS hrad hr he hw hwV hwe + have : Nonempty S := ⟨v⟩ + obtain ⟨η, hη⟩ := exists_edgePar K + obtain ⟨b, hb⟩ := exists_end_eq hη he (radial_V hrad hv) hve + let i : halfEdges K η v := ⟨(e, b), he, hb⟩ + have hpoint : spoke η i.val 1 ∈ r := her (spoke_mem_edge hη (x := i.val) he one_pos) + have hcap := spoke_ends_of_halfEdge_point hS hrad hη hv i hr hw hwV one_pos hpoint + exact ⟨he, radial_V hrad hv, hwV, hcap⟩ + +/-- The same graph-endpoint conclusion for the outgoing edge, obtained +by reversing the real parameter as in the leaving-edge definition. -/ +theorem leavesLike_isLink {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hrad : PreRad (.drawing Γ) K) {r e : Set S} (hr : r ∈ Γ.R) + {v w : S} (hv : v ∈ Γ.V) (hw : w ∈ r) (hwV : w ∈ K.V) (he : e ∈ K.E) + {f : ℝ → S} {a c : ℝ} (hfa : f a = v) + (hentry : LeavesLike f a c e r v w) : K.toGraph.IsLink e v w := by + exact entersLike_isLink hS hrad hr hv hw hwV he + (by simpa only [neg_neg] using hfa) hentry + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2EntryExistence.lean b/LeanPool/GraphMinor/GM12/Section2EntryExistence.lean new file mode 100644 index 0000000000..c43e2a3b3c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2EntryExistence.lean @@ -0,0 +1,62 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2SectorExistence +import LeanPool.GraphMinor.GM12.Section2EntryPaths + +/-! +# Entry-edge existence with an explicit entering sector + +This file connects the local existence proof to the real parameters in +XII's trace definition, page 243. Normalize a terminal interval of the +curve to a path. The entering-spoke comparison supplies a shorter +interval and a homotopy. Its affine parametrization gives an exact +`EntersLike` witness. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The omitted entry-edge existence assertion in XII, page 243, for a +curve whose terminal interval is in a specified sector. -/ +theorem exists_entersLike_of_sector {S : Type*} [TopologicalSpace S] + [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {Γ K : Drawing S} (hrad : PreRad (.drawing Γ) K) + (hmax : RadMax (.drawing Γ) K) (hE : Γ.E.Nonempty) + {γ : Set S → unitInterval → S} {v : S} (hv : v ∈ Γ.V) + {next : halfEdges Γ γ v → halfEdges Γ γ v} + {ρ P Q : halfEdges Γ γ v → Set S} {W : Set S} + {τ : halfEdges Γ γ v → unitInterval} + (hsec : IsSectors Γ γ v next ρ P W Q τ) + (hcover : W \ Γ.U ⊆ ⋃ k, Q k) (k : halfEdges Γ γ v) + {w : S} (hw : w ∈ ρ k) (hwV : w ∈ K.V) + {f : ℝ → S} {a c h₀ : ℝ} (hh₀ : h₀ ∈ Ioo a c) + (hf : ContinuousOn f (Icc h₀ c)) (hfc : f c = v) + (hinside : ∀ t ∈ Ico h₀ c, f t ∈ ρ k ∩ (Q k \ discBd (Q k))) : + ∃ e ∈ K.E, EntersLike f a c e (ρ k) v w := by + obtain ⟨F, hFval, -⟩ := exists_affine_approach_path hh₀.2 hf hfc + (fun t ht => (hinside t ht).1) + have hF : ∀ t, t < 1 → (F t).val ∈ ρ k ∩ (Q k \ discBd (Q k)) := by + intro t ht + rw [hFval] + exact hinside _ (affine_approach_parameter_mem_Ico hh₀.2 ht) + obtain ⟨e, he, q, hqi, hqe, t, ht, ρpath, hρpath, hhom⟩ := + exists_entry_comparison_in_sector hS hrad hmax hE hv hsec hcover k hw hwV F hF + let h := h₀ + t.val * (c - h₀) + have htime := affine_approach_parameter_mem_Ico hh₀.2 ht + have hh : h ∈ Ioo a c := ⟨hh₀.1.trans_le htime.1, htime.2⟩ + have hp : ∀ s : unitInterval, ((F.subpath t 1) s).val = f (h + s.val * (c - h)) := + affine_approach_subpath_apply F hFval t + exact ⟨e, he, entersLike_of_path_comparison hh rfl (F.subpath t 1) q ρpath hp hqi hqe hρpath hhom⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2EntryImageRestriction.lean b/LeanPool/GraphMinor/GM12/Section2EntryImageRestriction.lean new file mode 100644 index 0000000000..3665a75f01 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2EntryImageRestriction.lean @@ -0,0 +1,117 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2CornerAccumulation +public import LeanPool.GraphMinor.GM12.Section2LeafTraceRestriction +import LeanPool.GraphMinor.GM12.Section2TraceTranslation +import LeanPool.GraphMinor.GM12.Section2SectorCover +import LeanPool.GraphMinor.GM12.Section2PeriodGermSelection +import LeanPool.GraphMinor.GM12.Section2CirclePeriod +import LeanPool.GraphMinor.GM12.Section2PeriodicHits +import LeanPool.GraphMinor.GM11.RadialRegions + +/-! +# Entry edges are preserved by inclusion of curve images + +For XII (2.1), pages 243--244, an approach in the smaller curve +image enters a corner at its limiting vertex. Compactness lifts +this corner's accumulation to an original parameter. Read two +periods of the original trace and choose the lifted parameter in +the middle period, so both adjacent visits are available. The +corner-accumulation lemma identifies a recorded edge. Leaves have +only one corner and are covered by the leaf restriction lemma. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- Every entry along an approach contained in a traced curve image +uses one of that trace's edges, for a drawing with an edge. This is +the edge part of the restriction step of XII (2.1), pages 243--244. -/ +theorem trace_mem_edges_of_entry_in_image + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {φ : C(Circle, S)} {u : S} (W : GraphWalk K.toGraph u u) (hW : IsTrace Γ K φ W) + {v w : S} (hv : v ∈ Γ.V) {r e : Set S} (hr : r ∈ Γ.R) + (hw : w ∈ r ∩ K.V) (he : e ∈ K.E) + {g : ℝ → S} (hg : Continuous g) {c d : ℝ} (hcd : c < d) (hgd : g d = v) + (hgr : ∀ t ∈ Ioo c d, g t ∈ r) (himage : ∀ t ∈ Icc c d, g t ∈ range φ) + (hentry : EntersLike g c d e r v w) : e ∈ W.edges := by + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + by_cases h2 : 2 ≤ Nat.card (halfEdges Γ γ v) + · obtain ⟨next, ρ, P, N, Q, τ, hsec, hcover⟩ := + exists_sectors_with_cover hS Γ hγ hv h2 + obtain ⟨k, c₀, hcc₀, hgQ⟩ := exists_terminal_sector_of_approach hsec hcover hg hcd hgd + (fun t ht => region_subset hr (hgr t ht)) + let m := (c₀ + d) / 2 + have hm : m ∈ Ioo c₀ d := ⟨by dsimp [m]; linarith [hcc₀.2], by dsimp [m]; linarith [hcc₀.2]⟩ + have hrρ : r = ρ k := region_eq_of_mem hr (hsec.corners.region k) + (hgr m ⟨hcc₀.1.trans hm.1, hm.2⟩) (hgQ m ⟨hm.1.le, hm.2⟩).1 + subst r + rcases hW.2 with ⟨_, _, _, r₀, hr₀, hφr₀, _⟩ | ⟨_, _, a, hsteps⟩ + · exact (region_subset hr₀ (hφr₀ (himage d ⟨hcd.le, le_rfl⟩)) + (hgd.symm ▸ Γ.V_subset_U hv)).elim + · have htwo := traceSteps_two_periods (periodicCurve_periodic φ) W hsteps + have hfiniteImage : ∀ t ∈ Ioo c₀ d, + g t ∈ periodicCurve φ '' Icc (a + 1 / 2) (a + 3 / 2) ∩ (Q k \ Γ.U) := by + intro t ht + obtain ⟨z, hz⟩ := himage t ⟨(hcc₀.1.trans ht.1).le, ht.2.le⟩ + obtain ⟨p, hp, hpz⟩ := (circle_parameter_bijOn (a + 1 / 2)).surjOn (mem_univ z) + refine ⟨⟨p, ⟨hp.1, by linarith [hp.2]⟩, (congrArg φ hpz).trans hz⟩, + (hgQ t ⟨ht.1.le, ht.2⟩).2.1, ?_⟩ + exact region_subset (hsec.corners.region k) (hgr t ⟨hcc₀.1.trans ht.1, ht.2⟩) + obtain ⟨s, hs, hfs, hscl⟩ := exists_period_parameter_of_approach + (periodicCurve_continuous φ) hg hcc₀.2 hgd hfiniteImage + have hscl' : s ∈ closure (Icc a (a + 2) ∩ periodicCurve φ ⁻¹' (Q k \ Γ.U)) := by + apply closure_mono (s := Icc (a + 1 / 2) (a + 3 / 2) ∩ periodicCurve φ ⁻¹' + (Q k \ Γ.U)) _ hscl + intro t ht + exact ⟨⟨by linarith [ht.1.1], by linarith [ht.1.2]⟩, ht.2⟩ + have heW := traceSteps_mem_edges_of_corner_accumulation hS inferInstance hK hv hsec hcover k + (periodicCurve_continuous φ) hg (W.append W) htwo + ⟨by linarith [hs.1], by linarith [hs.2]⟩ hfs hscl' + hcc₀.1.le hcc₀.2 hgd hw he hgr (fun t ht => (hgQ t ⟨ht.1.le, ht.2⟩).2) hentry + simpa only [GraphWalk.edges_append, List.mem_append, or_self] using heW + · obtain ⟨e₀, he₀, hvcl⟩ := exists_edge_at (show PreRad (.drawing Γ) K from ⟨hK.1, hK.2.1⟩) hS hE + hv + obtain ⟨b, hb⟩ := exists_end_eq hγ he₀ hv hvcl + let : Finite (halfEdges Γ γ v) := (finite_halfEdges Γ γ v).to_subtype + let : Nonempty (halfEdges Γ γ v) := ⟨⟨(e₀, b), he₀, hb⟩⟩ + have hpos : 0 < Nat.card (halfEdges Γ γ v) := Nat.card_pos + have hcard : Nat.card (halfEdges Γ γ v) = 1 := by omega + have hvφ : v ∈ range φ := hgd ▸ himage d ⟨hcd.le, le_rfl⟩ + exact trace_mem_edges_of_entry_at_leaf hS inferInstance hK hγ hv hcard W hW hvφ + hg hcd hgd hr hw he hgr hentry + +/-- The outgoing version of image restriction follows by reversing +the approaching function and its real interval. -/ +theorem trace_mem_edges_of_leaving_in_image + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {φ : C(Circle, S)} {u : S} (W : GraphWalk K.toGraph u u) (hW : IsTrace Γ K φ W) + {v w : S} (hv : v ∈ Γ.V) {r e : Set S} (hr : r ∈ Γ.R) + (hw : w ∈ r ∩ K.V) (he : e ∈ K.E) + {g : ℝ → S} (hg : Continuous g) {c d : ℝ} (hcd : c < d) (hgc : g c = v) + (hgr : ∀ t ∈ Ioo c d, g t ∈ r) (himage : ∀ t ∈ Icc c d, g t ∈ range φ) + (hleave : LeavesLike g c d e r v w) : e ∈ W.edges := by + apply trace_mem_edges_of_entry_in_image hS hK hE W hW hv hr hw he + (hg.comp continuous_neg) (neg_lt_neg hcd) + (by simpa only [Function.comp_apply, neg_neg] using hgc) _ _ hleave + · intro t ht + exact hgr (-t) ⟨by linarith [ht.2], by linarith [ht.1]⟩ + · intro t ht + exact himage (-t) ⟨by linarith [ht.2], by linarith [ht.1]⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2EntryIndependence.lean b/LeanPool/GraphMinor/GM12/Section2EntryIndependence.lean new file mode 100644 index 0000000000..104524806b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2EntryIndependence.lean @@ -0,0 +1,118 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM12.Section2EntryComparison +import LeanPool.GraphMinor.GM12.Section2EntryConstruction +import LeanPool.GraphMinor.GM12.Section2PathHomotopy +import LeanPool.GraphMinor.Surface.Disc +import LeanPool.GraphMinor.GM12.Section2EntryPaths + +/-! +# The entry edge does not depend on its starting point + +XII, page 243, omits the proof that the entry choice is independent of +where the approach is started. Normalize one entry witness on a common +approach. Comparisons inside the open-disc region can be moved to any +other starting time. Concatenating the normalized approach with the same +spoke then gives the required entry witness at that time. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Starting-point independence in XII's entry-edge definition, page 243. +Once an entry edge has a witness, every starting point in the approach +interval has a witness for that same edge. -/ +theorem entersLike_witness_at {S : Type*} [TopologicalSpace S] [T2Space S] + {r e : Set S} {v w : S} (hcell : IsOpenDisc r) (hw : w ∈ r) + (hvE : v ∉ e) (hwE : w ∉ e) (hvw : v ≠ w) + {f : ℝ → S} (hf : Continuous f) {a c : ℝ} (hfc : f c = v) + (hfr : ∀ t ∈ Ioo a c, f t ∈ r) (hentry : EntersLike f a c e r v w) + {hNew : ℝ} (hNewIn : hNew ∈ Ioo a c) : + ∃ ξ ρ : Curve S, IsEntryCurve f hNew c e w ξ ∧ range ρ ⊆ r ∧ + CurvesHomotopicIn (r ∪ {v}) ξ ρ := by + classical + obtain ⟨h, hh, ξ, ρ, hξ, hρ, hhom⟩ := hentry + let h₀ : ℝ := min h hNew + have h₀a : a < h₀ := lt_min hh.1 hNewIn.1 + have h₀c : h₀ < c := lt_of_le_of_lt (min_le_left _ _) hh.2 + have hpos : 0 < c - h₀ := sub_pos.mpr h₀c + obtain ⟨F, hFval, hFinside⟩ := + exists_affine_approach_path h₀c hf.continuousOn hfc + (fun t ht => hfr t ⟨h₀a.trans_le ht.1, ht.2⟩) + let s : unitInterval := ⟨(h - h₀) / (c - h₀), + div_nonneg (sub_nonneg.mpr (min_le_left _ _)) hpos.le, + (div_le_one hpos).mpr (by linarith [hh.2])⟩ + let s' : unitInterval := ⟨(hNew - h₀) / (c - h₀), + div_nonneg (sub_nonneg.mpr (min_le_right _ _)) hpos.le, + (div_le_one hpos).mpr (by linarith [hNewIn.2])⟩ + have hs : s < 1 := (div_lt_one hpos).mpr (by linarith [hh.2]) + have hs' : s' < 1 := (div_lt_one hpos).mpr (by linarith [hNewIn.2]) + have hstart : h = h₀ + s.val * (c - h₀) := by + change h = h₀ + (h - h₀) / (c - h₀) * (c - h₀) + field_simp [ne_of_gt hpos] + ring + have hstart' : hNew = h₀ + s'.val * (c - h₀) := by + change hNew = h₀ + (hNew - h₀) / (c - h₀) * (c - h₀) + field_simp [ne_of_gt hpos] + ring + obtain ⟨β, σ, hβinj, _, hβint, hσr, hβhom⟩ := compare_entry_to_approach + hw F hFval hstart hfc hvE hwE hvw hξ hρ hhom + let R : Set (r ∪ {v} : Set S) := (Subtype.val : (r ∪ {v} : Set S) → S) ⁻¹' r + have hR : IsSimplyConnectedSet R := + (openDisc_in_subspace hcell (show r ⊆ r ∪ {v} from subset_union_left)).isSimplyConnectedSet + obtain ⟨σNew, hσNew, hβNew⟩ := terminal_entry_from_any_time hR F + (fun t ht => hFinside t ht) hw β hs hs' σ hσr hβhom + let j : (r ∪ {v} : Set S) → S := Subtype.val + let p := (F.subpath s' 1).map (show Continuous j from continuous_subtype_val) + let q := β.map (show Continuous j from continuous_subtype_val) + have hp : ∀ t : unitInterval, p t = f (hNew + t.val * (c - hNew)) := by + intro t + change (F.subpath s' 1 t).val = _ + rw [hstart'] + exact affine_approach_subpath_apply F hFval s' t + have hentryNew := isEntryCurve_trans p q hp hβinj hβint + let ξNew : Curve S := (((F.subpath s' 1).trans β).map + (show Continuous j from continuous_subtype_val)).toContinuousMap + let ρNew : Curve S := (σNew.map (show Continuous j from continuous_subtype_val)).toContinuousMap + refine ⟨ξNew, ρNew, ?_, ?_, ?_⟩ + · dsimp only [ξNew] + rw [Path.map_trans] + exact hentryNew + · rintro x ⟨t, rfl⟩ + exact hσNew t + · exact curvesHomotopicIn_of_paths_homotopic hβNew + +/-- Entry is unchanged after discarding an initial portion of the +region interval. This is the interval form of the starting-point +independence asserted on XII page 243. -/ +theorem entersLike_iff_tail_interval + {S : Type*} [TopologicalSpace S] [T2Space S] + {r e : Set S} {v w : S} (hcell : IsOpenDisc r) (hw : w ∈ r) + (hvE : v ∉ e) (hwE : w ∉ e) (hvw : v ≠ w) + {f : ℝ → S} (hf : Continuous f) {a a' c : ℝ} (haa' : a ≤ a') (ha'c : a' < c) + (hfc : f c = v) (hfr : ∀ t ∈ Ioo a c, f t ∈ r) : + EntersLike f a c e r v w ↔ EntersLike f a' c e r v w := by + constructor + · intro he + let h := (a' + c) / 2 + have hh : h ∈ Ioo a' c := ⟨by dsimp [h]; linarith, by dsimp [h]; linarith⟩ + have hhOld : h ∈ Ioo a c := ⟨haa'.trans_lt hh.1, hh.2⟩ + obtain ⟨ξ, ρ, hξ, hρ, hhom⟩ := entersLike_witness_at hcell hw hvE hwE hvw + hf hfc hfr he hhOld + exact ⟨h, hh, ξ, ρ, hξ, hρ, hhom⟩ + · rintro ⟨h, hh, ξ, ρ, hξ, hρ, hhom⟩ + exact ⟨h, ⟨haa'.trans_lt hh.1, hh.2⟩, ξ, ρ, hξ, hρ, hhom⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2EntryNormalization.lean b/LeanPool/GraphMinor/GM12/Section2EntryNormalization.lean new file mode 100644 index 0000000000..39d280aa26 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2EntryNormalization.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import Mathlib.Topology.Subpath +import LeanPool.GraphMinor.GM12.Section2EntryPaths +import LeanPool.GraphMinor.GM12.Section2PathHomotopy + +/-! +# Normalizing the approach in an entry curve + +The two entry curves compared in XII, page 243, may start at different +points of the same approach. Put that approach on the unit interval. +Splitting each entry curve at its joining time gives its terminal spoke +and a subpath of the common approach. Concatenation changes only the +parametrization, up to a homotopy fixing the endpoints. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Split an entry curve into a subpath of a fixed approach and its +terminal spoke. The approach's earlier starting time is explicit, so +this lemma applies when two entry curves start at different points. -/ +theorem normalize_entry_approach {S X : Type*} [TopologicalSpace S] [TopologicalSpace X] + (j : X → S) (hj : Function.Injective j) {a b w : X} (F : Path a b) + {f : ℝ → S} {h₀ h c : ℝ} {s : unitInterval} + (hF : ∀ t, j (F t) = f (h₀ + t.val * (c - h₀))) + (hstart : h = h₀ + s.val * (c - h₀)) + (P : Path (F s) w) (ξ : Curve S) (hP : ∀ t, j (P t) = ξ t) + {τ : unitInterval} (hτ : 0 < τ) + (hfirst : ∀ t : unitInterval, t ≤ τ → ξ t = f (h + t.val / τ.val * (c - h))) : + ∃ β : Path (F 1) w, + (∀ t, j (β t) = ξ (Icc.convexComb τ 1 t)) ∧ + ((F.subpath s 1).trans β).Homotopic P := by + have hjoin : P τ = F 1 := by + apply hj + rw [hP, hfirst τ le_rfl, hF] + have hτ' : τ.val ≠ 0 := ne_of_gt hτ + simp only [div_self hτ', one_mul, Icc.coe_one] + congr 1 + ring + let β₀ : Path (P τ) w := (P.subpath τ 1).cast rfl P.target.symm + let β : Path (F 1) w := β₀.cast hjoin.symm rfl + let α : Path (F s) (P τ) := (F.subpath s 1).cast rfl hjoin + have hα : ∀ t, α t = (P.subpath 0 τ) t := by + intro t + apply hj + change j ((F.subpath s 1) t) = j ((P.subpath 0 τ) t) + rw [entry_subpath_prefix j P ξ hP hτ hfirst] + change j (F (Icc.convexComb s 1 t)) = _ + rw [hF] + congr 1 + simp only [Icc.coe_convexComb, Icc.coe_one] + rw [hstart] + ring + have hβ₀ : ∀ t, β₀ t = (P.subpath τ 1) t := fun _ => rfl + have hsplit := split_path_homotopic P τ α β₀ hα hβ₀ + refine ⟨β, ?_, ?_⟩ + · intro t + change j (P (Icc.convexComb τ 1 t)) = _ + exact hP _ + · have heq : (F.subpath s 1).trans β = α.trans β₀ := by + ext t + simp only [Path.trans_apply] + split_ifs <;> rfl + rw [heq] + exact hsplit + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2EntryPatch.lean b/LeanPool/GraphMinor/GM12/Section2EntryPatch.lean new file mode 100644 index 0000000000..cc087dfe40 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2EntryPatch.lean @@ -0,0 +1,111 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2PathHomotopy +public import LeanPool.GraphMinor.GM12.Section2SectorHomotopy + +/-! +# Closing an entry curve inside its corner + +For the omitted entry-edge existence assertion on XII page 243, the +incoming curve and a spoke can be compared in a small corner patch. +Its punctured part joins their nearby points without passing through the +vertex. Simple connectivity then replaces their concatenation by that +joining path. The rest of the spoke already lies in the region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- A spoke whose initial segment lies in the same simply-connected +corner patch as an incoming path satisfies the homotopy condition of the +entry definition. The punctured patch supplies a replacement path in +the region, and the spoke beyond the patch stays in that region. -/ +theorem entry_homotopy_of_patch {Z : Type*} [TopologicalSpace Z] + {X R : Set Z} {v a b : Z} (hX : IsSimplyConnectedSet X) + (hpuncture : IsPathConnected (X \ {v})) (hXR : X \ {v} ⊆ R) + (p : Path a v) (β : Path v b) (hp : ∀ t, p t ∈ X) + (ha : a ∈ X \ {v}) (s : unitInterval) + (hs : β s ∈ X \ {v}) + (hβ : ∀ t, (β.subpath 0 s) t ∈ X) + (htail : ∀ t, (β.subpath s 1) t ∈ R) : + ∃ ρ : Path a b, (∀ t, ρ t ∈ R) ∧ (p.trans β).Homotopic ρ := by + let α : Path v (β s) := (β.subpath 0 s).cast β.source.symm rfl + let τ : Path (β s) b := (β.subpath s 1).cast rfl β.target.symm + obtain ⟨σ, hσ⟩ := hpuncture.joinedIn a ha (β s) hs + have hfirst : (p.trans α).Homotopic σ := by + apply paths_homotopic_of_range_in_simplyConnected hX + · intro t + rw [Path.trans_apply] + split_ifs + · exact hp _ + · exact hβ _ + · intro t + exact (hσ t).1 + have hsplit : (α.trans τ).Homotopic β := + split_path_homotopic β s α τ (fun _ => rfl) (fun _ => rfl) + refine ⟨σ.trans τ, ?_, ?_⟩ + · intro t + rw [Path.trans_apply] + split_ifs + · exact hXR (hσ _) + · exact htail _ + · exact ((Path.Homotopic.refl p).hcomp hsplit.symm).trans + ((Path.Homotopic.trans_assoc p α τ).symm.trans + (hfirst.hcomp (Path.Homotopic.refl τ))) + +/-- The common-patch criterion with the patch in the surface and paths +in a subspace, as required when that subspace is a region with one +boundary vertex added. -/ +theorem entry_homotopy_of_ambient_patch {S : Type*} [TopologicalSpace S] + {Z X : Set S} {R : Set Z} {v a b : Z} + (hX : IsSimplyConnectedSet X) (hXZ : X ⊆ Z) + (hpuncture : IsPathConnected (X \ {v.val})) + (hXR : ∀ z : Z, z.val ∈ X \ {v.val} → z ∈ R) + (p : Path a v) (β : Path v b) (hp : ∀ t, (p t).val ∈ X) + (ha : a.val ∈ X \ {v.val}) (s : unitInterval) + (hs : (β s).val ∈ X \ {v.val}) + (hβ : ∀ t, ((β.subpath 0 s) t).val ∈ X) + (htail : ∀ t, (β.subpath s 1) t ∈ R) : + ∃ ρ : Path a b, (∀ t, ρ t ∈ R) ∧ (p.trans β).Homotopic ρ := by + let α : Path v (β s) := (β.subpath 0 s).cast β.source.symm rfl + let τ : Path (β s) b := (β.subpath s 1).cast rfl β.target.symm + obtain ⟨σ₀, hσ₀⟩ := hpuncture.joinedIn a.val ha (β s).val hs + let σ : Path a (β s) := { + toFun := fun t => ⟨σ₀ t, hXZ (hσ₀ t).1⟩ + continuous_toFun := σ₀.continuous.subtype_mk _ + source' := Subtype.ext σ₀.source + target' := Subtype.ext σ₀.target } + have hσ : ∀ t, σ t ∈ R := fun t => hXR (σ t) (hσ₀ t) + have hfirst : (p.trans α).Homotopic σ := by + apply paths_homotopic_in_subspace_of_patch hX hXZ + · intro t + rw [Path.trans_apply] + split_ifs + · exact hp _ + · exact hβ _ + · intro t + exact (hσ₀ t).1 + have hsplit : (α.trans τ).Homotopic β := + split_path_homotopic β s α τ (fun _ => rfl) (fun _ => rfl) + refine ⟨σ.trans τ, ?_, ?_⟩ + · intro t + rw [Path.trans_apply] + split_ifs + · exact hσ _ + · exact htail _ + · exact ((Path.Homotopic.refl p).hcomp hsplit.symm).trans + ((Path.Homotopic.trans_assoc p α τ).symm.trans + (hfirst.hcomp (Path.Homotopic.refl τ))) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2EntryPaths.lean b/LeanPool/GraphMinor/GM12/Section2EntryPaths.lean new file mode 100644 index 0000000000..ee9e2cd918 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2EntryPaths.lean @@ -0,0 +1,238 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import Mathlib.Topology.Subpath +import Mathlib.Topology.Instances.Real.Lemmas + +/-! +# Reading an entry curve as two paths + +The definition on XII page 243 first follows the given curve and then +traverses a spoke. Splitting at its joining time gives the affine approach +path and an injective path whose range is the spoke closure. These lemmas +supply that parametrization step without choosing a different trace. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- The affine parameter of a unit-interval path lies in its real interval. -/ +theorem affine_approach_parameter_mem_Icc {h c : ℝ} (hh : h ≤ c) (t : unitInterval) : + h + t.val * (c - h) ∈ Icc h c := by + have hpos := sub_nonneg.mpr hh + refine ⟨le_add_of_nonneg_right (mul_nonneg t.property.1 hpos), ?_⟩ + have hle := mul_le_of_le_one_left hpos t.property.2 + linarith + +/-- Before the final time the affine parameter lies strictly before the endpoint. -/ +theorem affine_approach_parameter_mem_Ico {h c : ℝ} (hh : h < c) + {t : unitInterval} (ht : t < 1) : h + t.val * (c - h) ∈ Ico h c := by + refine ⟨(affine_approach_parameter_mem_Icc hh.le t).1, ?_⟩ + have hlt := mul_lt_of_lt_one_left (sub_pos.mpr hh) ht + linarith + +/-- An approach in a region with a terminal boundary vertex gives a path in their union. -/ +theorem exists_affine_approach_path {S : Type*} [TopologicalSpace S] {r : Set S} {v : S} + {f : ℝ → S} {h c : ℝ} (hh : h < c) (hf : ContinuousOn f (Icc h c)) (hfc : f c = v) + (hinside : ∀ q ∈ Ico h c, f q ∈ r) : + ∃ F : Path (⟨f h, Or.inl (hinside h ⟨le_rfl, hh⟩)⟩ : (r ∪ {v} : Set S)) + ⟨v, Or.inr (mem_singleton v)⟩, + (∀ t : unitInterval, (F t).val = f (h + t.val * (c - h))) ∧ + ∀ t : unitInterval, t < 1 → (F t).val ∈ r := by + let m : unitInterval → ℝ := fun t => h + t.val * (c - h) + have hm : Continuous m := by fun_prop + have hmI : ∀ t, m t ∈ Icc h c := affine_approach_parameter_mem_Icc hh.le + have hmR : ∀ t : unitInterval, t < 1 → f (m t) ∈ r := + fun t ht => hinside _ (affine_approach_parameter_mem_Ico hh ht) + have hmem : ∀ t : unitInterval, f (m t) ∈ r ∪ {v} := by + intro t + rcases eq_or_lt_of_le t.2.2 with ht | ht + · have ht1 : t = 1 := Subtype.ext ht + exact Or.inr (by simp [m, ht1, hfc]) + · exact Or.inl (hmR t ht) + let F : Path (⟨f h, Or.inl (hinside h ⟨le_rfl, hh⟩)⟩ : (r ∪ {v} : Set S)) + ⟨v, Or.inr (mem_singleton v)⟩ := { + toFun := fun t => ⟨f (m t), hmem t⟩ + continuous_toFun := (hf.comp_continuous hm hmI).subtype_mk _ + source' := Subtype.ext (by simp [m]) + target' := Subtype.ext (by simpa only [m, Icc.coe_one, one_mul, add_sub_cancel] using hfc) } + exact ⟨F, fun _ => rfl, hmR⟩ + +/-- A terminal subpath has the same affine parametrization starting at the chosen time. -/ +theorem affine_approach_subpath_apply {S X : Type*} [TopologicalSpace X] {a b : X} + (F : Path a b) {j : X → S} {f : ℝ → S} {h₀ c : ℝ} + (hF : ∀ t : unitInterval, j (F t) = f (h₀ + t.val * (c - h₀))) (s t : unitInterval) : + let h := h₀ + s.val * (c - h₀) + j ((F.subpath s 1) t) = f (h + t.val * (c - h)) := by + change j (F (Icc.convexComb s 1 t)) = _ + rw [hF] + congr 1 + simp only [Icc.coe_convexComb, Icc.coe_one] + ring + +private theorem convexComb_tail_image_Ioo {s : unitInterval} (hs : s < 1) : + Icc.convexComb s 1 '' Ioo (0 : unitInterval) 1 = Ioo s 1 := by + ext u + constructor + · rintro ⟨t, ht, rfl⟩ + change s < Icc.convexComb s 1 t ∧ Icc.convexComb s 1 t < 1 + have hs' : (s : ℝ) < 1 := hs + have ht0 : (0 : ℝ) < t := ht.1 + have ht1 : (t : ℝ) < 1 := ht.2 + constructor + · change (s : ℝ) < (1 - t.val) * s.val + t.val * 1 + nlinarith + · change (1 - t.val) * s.val + t.val * 1 < 1 + nlinarith + · intro hu + have hs' : (s : ℝ) < 1 := hs + have hu0 : (s : ℝ) < u := hu.1 + have hu1 : (u : ℝ) < 1 := hu.2 + let x : ℝ := ((u : ℝ) - s) / (1 - s) + have hx0 : 0 < x := div_pos (sub_pos.mpr hu0) (sub_pos.mpr hs') + have hx1 : x < 1 := (div_lt_one (sub_pos.mpr hs')).mpr (by linarith) + refine ⟨⟨x, hx0.le, hx1.le⟩, ⟨hx0, hx1⟩, ?_⟩ + apply Subtype.ext + change (1 - x) * s + x * 1 = u + dsimp only [x] + field_simp [ne_of_gt (sub_pos.mpr hs')] + ring + +/-- Splitting at the entry curve's joining time gives the prescribed +approach, now parametrized on the full unit interval. -/ +theorem entry_subpath_prefix {S X : Type*} [TopologicalSpace S] [TopologicalSpace X] + (j : X → S) {a b : X} (P : Path a b) (ξ : Curve S) + (hP : ∀ t, j (P t) = ξ t) {f : ℝ → S} {h c : ℝ} {s : unitInterval} + (hs : 0 < s) + (hfirst : ∀ t : unitInterval, t ≤ s → ξ t = f (h + t.val / s.val * (c - h))) : + ∀ t : unitInterval, j ((P.subpath 0 s) t) = f (h + t.val * (c - h)) := by + intro t + change j (P (Icc.convexComb 0 s t)) = _ + rw [hP, hfirst] + · congr 1 + have hs' : (s : ℝ) ≠ 0 := ne_of_gt hs + change h + ((1 - t.val) * 0 + t.val * s.val) / s.val * (c - h) = _ + field_simp [hs'] + ring + · change (1 - t.val) * 0 + t.val * s.val ≤ s.val + simp only [mul_zero, zero_add] + exact mul_le_of_le_one_left s.property.1 t.property.2 + +/-- The interior of the terminal subpath is exactly the edge in the +entry-curve definition. -/ +theorem entry_subpath_interior {S X : Type*} [TopologicalSpace S] [TopologicalSpace X] + (j : X → S) {a b : X} (P : Path a b) (ξ : Curve S) + (hP : ∀ t, j (P t) = ξ t) {s : unitInterval} (hs : s < 1) + {e : Set S} (himage : ξ '' Ioo s 1 = e) : + (fun t => j ((P.subpath s 1) t)) '' Ioo (0 : unitInterval) 1 = e := by + calc + _ = ξ '' (Icc.convexComb s 1 '' Ioo (0 : unitInterval) 1) := by + rw [Set.image_image] + congr 1 + funext t + exact hP _ + _ = e := by rw [convexComb_tail_image_Ioo hs, himage] + +/-- The range of a continuous path is the closure of its interior image. +The endpoint images follow by continuity, and compactness closes the range. -/ +theorem path_range_eq_closure_interior {S : Type*} [TopologicalSpace S] [T2Space S] + {a b : S} (P : Path a b) : + range P = closure (P '' Ioo (0 : unitInterval) 1) := by + apply subset_antisymm + · have hpre : IsClosed {t : unitInterval | P t ∈ closure (P '' Ioo (0 : unitInterval) 1)} := + isClosed_closure.preimage P.continuous + have hsub : Ioo (0 : unitInterval) 1 ⊆ {t | P t ∈ closure (P '' Ioo (0 : unitInterval) 1)} := + fun t ht => subset_closure (mem_image_of_mem P ht) + have hcl := closure_minimal hsub hpre + rw [closure_Ioo (show (0 : unitInterval) ≠ 1 from zero_ne_one)] at hcl + rintro x ⟨t, rfl⟩ + exact hcl ⟨t.property.1, t.property.2⟩ + · exact closure_minimal (image_subset_range _ _) (isCompact_range P.continuous).isClosed + +/-- An injective interior extends to an injective parametrization of an +arc when its two distinct endpoint values are outside the interior image. -/ +theorem injective_of_injective_interior {S : Type*} (q : unitInterval → S) + (hinj : InjOn q (Ioo (0 : unitInterval) 1)) + (h0 : q 0 ∉ q '' Ioo (0 : unitInterval) 1) + (h1 : q 1 ∉ q '' Ioo (0 : unitInterval) 1) (hne : q 0 ≠ q 1) : + Function.Injective q := by + have eq0 : ∀ t, q t = q 0 → t = 0 := by + intro t ht + by_cases ht0 : t = 0 + · exact ht0 + by_cases ht1 : t = 1 + · exact (hne (ht1 ▸ ht).symm).elim + exact (h0 ⟨t, ⟨unitInterval.pos_iff_ne_zero.mpr ht0, + lt_of_le_of_ne t.property.2 ht1⟩, ht⟩).elim + have eq1 : ∀ t, q t = q 1 → t = 1 := by + intro t ht + by_cases ht1 : t = 1 + · exact ht1 + by_cases ht0 : t = 0 + · exact (hne (ht0 ▸ ht)).elim + exact (h1 ⟨t, ⟨unitInterval.pos_iff_ne_zero.mpr ht0, + lt_of_le_of_ne t.property.2 ht1⟩, ht⟩).elim + intro s t hst + by_cases hs0 : s = 0 + · subst s + exact (eq0 t hst.symm).symm + by_cases hs1 : s = 1 + · subst s + exact (eq1 t hst.symm).symm + by_cases ht0 : t = 0 + · subst t + exact eq0 s hst + by_cases ht1 : t = 1 + · subst t + exact eq1 s hst + exact hinj ⟨unitInterval.pos_iff_ne_zero.mpr hs0, lt_of_le_of_ne s.property.2 hs1⟩ + ⟨unitInterval.pos_iff_ne_zero.mpr ht0, lt_of_le_of_ne t.property.2 ht1⟩ hst + +/-- The terminal piece of an entry curve is an injective spoke path, +including its two endpoints. -/ +theorem entry_terminal_injective {S X : Type*} [TopologicalSpace S] [TopologicalSpace X] + (j : X → S) {a b : X} (P : Path a b) (ξ : Curve S) + (hP : ∀ t, j (P t) = ξ t) {s : unitInterval} (hs : s < 1) + {e : Set S} (himage : ξ '' Ioo s 1 = e) (hinj : InjOn ξ (Ioo s 1)) + (h0 : j (P s) ∉ e) (h1 : j (P 1) ∉ e) (hne : j (P s) ≠ j (P 1)) : + Function.Injective (fun t => j ((P.subpath s 1) t)) := by + let q : unitInterval → S := fun t => j ((P.subpath s 1) t) + have hqi : q '' Ioo (0 : unitInterval) 1 = e := entry_subpath_interior j P ξ hP hs himage + apply injective_of_injective_interior q + · intro u hu v hv heq + have hmem : ∀ t ∈ Ioo (0 : unitInterval) 1, Icc.convexComb s 1 t ∈ Ioo s 1 := by + intro t ht + rw [← convexComb_tail_image_Ioo hs] + exact mem_image_of_mem _ ht + have hξeq : ξ (Icc.convexComb s 1 u) = ξ (Icc.convexComb s 1 v) := by + rw [← hP, ← hP] + exact heq + have hparams := congrArg Subtype.val (hinj (hmem u hu) (hmem v hv) hξeq) + simp only [Icc.coe_convexComb, Icc.coe_one] at hparams + apply Subtype.ext + have hs' : (s : ℝ) < 1 := hs + nlinarith + · rw [hqi] + change j ((P.subpath s 1) 0) ∉ e + rw [(P.subpath s 1).source] + exact h0 + · rw [hqi] + change j ((P.subpath s 1) 1) ∉ e + rw [(P.subpath s 1).target] + exact h1 + · change j ((P.subpath s 1) 0) ≠ j ((P.subpath s 1) 1) + rw [(P.subpath s 1).source, (P.subpath s 1).target] + exact hne + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2EntryUnique.lean b/LeanPool/GraphMinor/GM12/Section2EntryUnique.lean new file mode 100644 index 0000000000..b2c4faf62b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2EntryUnique.lean @@ -0,0 +1,124 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM12.Cited +import LeanPool.GraphMinor.GM12.Section2EntryComparison +import LeanPool.GraphMinor.GM12.Section2PathHomotopy +import LeanPool.GraphMinor.GM12.Section2SpokeUniqueness +import LeanPool.GraphMinor.Surface.Disc +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.Section7b +import LeanPool.GraphMinor.GM12.Section2EntryPaths + +/-! +# Uniqueness of the entry edge + +This file proves the uniqueness assertion omitted in XII, page 243. +Start the approach before both chosen entry starting points. Normalize +each entry as that approach followed by its spoke. The two comparison +paths lie in the open-disc region, so they are homotopic. Cancelling +the common approach makes the spokes homotopic. XI (7.2) and the +pre-radial condition then force the edges to be equal. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +universe u + +/-- The uniqueness part of the entry-edge definition of XII, page 243, +including comparisons whose witnesses choose different starting points. +The proof uses the proved XI (7.2), over its original objects. -/ +theorem entersLike_edge_unique + {S : Type u} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {r e e' : Set S} {v w : S} (hr : r ∈ Γ.R) (hv : v ∈ Γ.V) + (hw : w ∈ r ∩ K.V) (he : e ∈ K.E) (he' : e' ∈ K.E) + (hends : closure e ∩ K.V = {v, w}) (hends' : closure e' ∩ K.V = {v, w}) + {f : ℝ → S} (hf : Continuous f) {a c : ℝ} (hfc : f c = v) + (hfr : ∀ t ∈ Ioo a c, f t ∈ r) + (hentry : EntersLike f a c e r v w) (hentry' : EntersLike f a c e' r v w) : e = e' := by + classical + obtain ⟨h, hh, ξ, ρ, hξ, hρ, hhom⟩ := hentry + obtain ⟨h', hh', ξ', ρ', hξ', hρ', hhom'⟩ := hentry' + let h₀ : ℝ := min h h' + have h₀a : a < h₀ := lt_min hh.1 hh'.1 + have h₀c : h₀ < c := lt_of_le_of_lt (min_le_left _ _) hh.2 + have hpos : 0 < c - h₀ := sub_pos.mpr h₀c + obtain ⟨F, hFval, hFinside⟩ := + exists_affine_approach_path h₀c hf.continuousOn hfc + (fun t ht => hfr t ⟨h₀a.trans_le ht.1, ht.2⟩) + let s : unitInterval := ⟨(h - h₀) / (c - h₀), + div_nonneg (sub_nonneg.mpr (min_le_left _ _)) hpos.le, + (div_le_one hpos).mpr (by linarith [hh.2])⟩ + let s' : unitInterval := ⟨(h' - h₀) / (c - h₀), + div_nonneg (sub_nonneg.mpr (min_le_right _ _)) hpos.le, + (div_le_one hpos).mpr (by linarith [hh'.2])⟩ + have hs : s < 1 := (div_lt_one hpos).mpr (by linarith [hh.2]) + have hs' : s' < 1 := (div_lt_one hpos).mpr (by linarith [hh'.2]) + have hstart : h = h₀ + s.val * (c - h₀) := by + change h = h₀ + (h - h₀) / (c - h₀) * (c - h₀) + field_simp [ne_of_gt hpos] + ring + have hstart' : h' = h₀ + s'.val * (c - h₀) := by + change h' = h₀ + (h' - h₀) / (c - h₀) * (c - h₀) + field_simp [ne_of_gt hpos] + ring + have hvE : v ∉ e := fun hx => (he.2.1 hx).2 (hK.2.1.2.1 hv) + have hwE : w ∉ e := fun hx => (he.2.1 hx).2 hw.2 + have hvE' : v ∉ e' := fun hx => (he'.2.1 hx).2 (hK.2.1.2.1 hv) + have hwE' : w ∉ e' := fun hx => (he'.2.1 hx).2 hw.2 + have hvw : v ≠ w := fun h => region_subset hr (h.symm ▸ hw.1) (Γ.V_subset_U hv) + obtain ⟨β, σ, hβinj, hβrange, _, hσr, hβhom⟩ := compare_entry_to_approach + hw.1 F hFval hstart hfc hvE hwE hvw hξ hρ hhom + obtain ⟨β', σ', hβinj', hβrange', _, hσr', hβhom'⟩ := compare_entry_to_approach + hw.1 F hFval hstart' hfc hvE' hwE' hvw hξ' hρ' hhom' + let R : Set (r ∪ {v} : Set S) := (Subtype.val : (r ∪ {v} : Set S) → S) ⁻¹' r + have hR : IsSimplyConnectedSet R := + (openDisc_in_subspace (hK.1.2 r hr) (show r ⊆ r ∪ {v} from + subset_union_left)).isSimplyConnectedSet + have hββ' : β.Homotopic β' := terminal_paths_homotopic_of_entries hR F + (fun t ht => hFinside t ht) β β' hs hs' σ σ' hσr hσr' hβhom hβhom' + apply spoke_eq_of_paths_homotopic hS hConn hK.2.1 hr hv hw he he' hends hends' + (β.cast F.target.symm rfl) (β'.cast F.target.symm rfl) + · intro x y hxy + exact hβinj (congrArg Subtype.val hxy) + · intro x y hxy + exact hβinj' (congrArg Subtype.val hxy) + · exact hβrange + · exact hβrange' + · exact hββ'.pathCast F.target.symm rfl + +/-- The leaving edge is unique as well: reverse the real parameter and +apply entry uniqueness. This is the outgoing half of the omitted +uniqueness assertion in XII's trace definition, page 243. -/ +theorem leavesLike_edge_unique + {S : Type u} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {r e e' : Set S} {v w : S} (hr : r ∈ Γ.R) (hv : v ∈ Γ.V) + (hw : w ∈ r ∩ K.V) (he : e ∈ K.E) (he' : e' ∈ K.E) + (hends : closure e ∩ K.V = {v, w}) (hends' : closure e' ∩ K.V = {v, w}) + {f : ℝ → S} (hf : Continuous f) {a c : ℝ} (hfa : f a = v) + (hfr : ∀ t ∈ Ioo a c, f t ∈ r) + (hleave : LeavesLike f a c e r v w) (hleave' : LeavesLike f a c e' r v w) : e = e' := by + apply entersLike_edge_unique hS hConn hK hr hv hw he he' hends hends' + (hf.comp continuous_neg) (by simpa only [Function.comp_apply, neg_neg] using hfa) _ hleave + hleave' + intro t ht + apply hfr + constructor <;> linarith [ht.1, ht.2] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2EntryWitness.lean b/LeanPool/GraphMinor/GM12/Section2EntryWitness.lean new file mode 100644 index 0000000000..a2aeb2fcf6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2EntryWitness.lean @@ -0,0 +1,68 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2EntryConstruction +public import LeanPool.GraphMinor.GM12.Section2SectorHomotopy +import LeanPool.GraphMinor.Surface.Disc + +/-! +# Entry witnesses and replacement across a parallel disc + +In XII's entry definition on page 243, a normalized approach followed +by an edge parametrization gives the required entry curve. A path +homotopy in the region with its vertex added gives the stated curve +homotopy. The second lemma replaces a chord by a parallel spoke using +the disc between them. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Convert a relative-endpoint path comparison into the exact entry +witness required by the definition in XII, page 243. -/ +theorem entersLike_of_path_comparison {S : Type*} [TopologicalSpace S] + {f : ℝ → S} {a c h : ℝ} (hh : h ∈ Ioo a c) + {e r : Set S} {v w : S} {x y z : (r ∪ {v} : Set S)} + (hz : z.val = w) (p : Path x y) (q : Path y z) (ρ : Path x z) + (hp : ∀ t : unitInterval, (p t).val = f (h + t.val * (c - h))) + (hqinj : Function.Injective (fun t => (q t).val)) + (hqe : (fun t => (q t).val) '' Ioo (0 : unitInterval) 1 = e) + (hρ : ∀ t, (ρ t).val ∈ r) (hhom : (p.trans q).Homotopic ρ) : + EntersLike f a c e r v w := by + let j : (r ∪ {v} : Set S) → S := Subtype.val + let p' := p.map (show Continuous j from continuous_subtype_val) + let q' := q.map (show Continuous j from continuous_subtype_val) + let ξ : Curve S := ((p.trans q).map + (show Continuous j from continuous_subtype_val)).toContinuousMap + let σ : Curve S := (ρ.map (show Continuous j from continuous_subtype_val)).toContinuousMap + refine ⟨h, hh, ξ, σ, ?_, ?_, curvesHomotopicIn_of_paths_homotopic hhom⟩ + · have hentry := isEntryCurve_trans p' q' hp hqinj hqe + dsimp only [ξ] + rw [Path.map_trans] + exact hz ▸ hentry + · rintro x ⟨t, rfl⟩ + exact hρ t + +/-- The disc between a chord and a radial spoke gives a homotopy in the +region with the boundary vertex added. Prefixing by an approach preserves +any entry comparison already obtained for the chord. -/ +theorem entry_comparison_replace_in_disc {S : Type*} [TopologicalSpace S] + {Z Δ : Set S} (hΔ : IsClosedDisc Δ) (hΔZ : Δ ⊆ Z) + {a v w : Z} (p : Path a v) (q β : Path v w) (ρ : Path a w) + (hq : ∀ t, (q t).val ∈ Δ) (hβ : ∀ t, (β t).val ∈ Δ) + (hentry : (p.trans q).Homotopic ρ) : (p.trans β).Homotopic ρ := by + have hparallel : β.Homotopic q := + paths_homotopic_in_subspace_of_patch hΔ.isSimplyConnectedSet hΔZ β q hβ hq + exact ((Path.Homotopic.refl p).hcomp hparallel).trans hentry + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2FreeSectorChord.lean b/LeanPool/GraphMinor/GM12/Section2FreeSectorChord.lean new file mode 100644 index 0000000000..9cfcc482a4 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2FreeSectorChord.lean @@ -0,0 +1,121 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2SectorSpoke +public import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# A parallel spoke obtained from a free entering sector + +For the free-neighbourhood case of the omitted entry assertion in XII, +page 243, start a path in the sector interior. It stays in one region +of the union with the radial drawing. That region approaches the hub. +A chord through the region retains the initial sector germ, and radial +maximality gives a spoke and a disc between that spoke and the chord. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 unitInterval + +/-- A continuous approach staying off a drawing stays in one region. -/ +theorem exists_region_of_approach {S : Type*} [TopologicalSpace S] + (H : Drawing S) {g : I → S} (hg : Continuous g) + (hoff : ∀ t, 0 < t → g t ∉ H.U) : + ∃ p ∈ H.R, ∀ t, 0 < t → g t ∈ p := by + obtain ⟨p, hp, hg1⟩ := exists_region_of_notMem (hoff 1 one_pos) + let A : Set S := g '' Ioc (0 : I) 1 + have hA : IsPreconnected A := isPreconnected_Ioc.image g hg.continuousOn + have hdis : Disjoint A H.U := Set.disjoint_left.mpr fun _ hx hxU => by + obtain ⟨t, ht, rfl⟩ := hx + exact hoff t ht.1 hxU + have hsub : A ⊆ p := subset_region hp hA hdis ⟨1, ⟨one_pos, le_rfl⟩, rfl⟩ hg1 + exact ⟨p, hp, fun t ht => hsub ⟨t, ⟨ht, t.property.2⟩, rfl⟩⟩ + +/-- A radial-free sector germ gives a chord to the hub and a parallel +radial edge. The chord retains its germ in the prescribed sector. -/ +theorem exists_parallel_spoke_at_free_sector {S : Type*} [TopologicalSpace S] + [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {Γ K : Drawing S} (hrad : PreRad (.drawing Γ) K) + (hmax : RadMax (.drawing Γ) K) (hE : Γ.E.Nonempty) + {γ : Set S → I → S} {v : S} (hv : v ∈ Γ.V) + {next : halfEdges Γ γ v → halfEdges Γ γ v} + {ρ P Q : halfEdges Γ γ v → Set S} {W : Set S} + {τ : halfEdges Γ γ v → I} + (hsec : IsSectors Γ γ v next ρ P W Q τ) (k : halfEdges Γ γ v) + {c : S} (hc : c ∈ ρ k) (hcV : c ∈ K.V) + {O : Set S} (hO : IsOpen O) (hvO : v ∈ O) + (hfree : Disjoint ((O ∩ Q k) \ Γ.U) K.U) : + ∃ (e : Set S), e ∈ K.E ∧ closure e ∩ K.V = {v, c} ∧ + ∃ u : I → S, Continuous u ∧ Function.Injective u ∧ u 0 = v ∧ u 1 = c ∧ + (∀ t, t ≠ 0 → t ≠ 1 → u t ∈ ρ k) ∧ + (∃ N : Set S, IsOpen N ∧ v ∈ N ∧ + ∀ t, 0 < t → u t ∈ N → u t ∈ Q k \ discBd (Q k)) ∧ + ∃ Δ : Set S, IsClosedDisc Δ ∧ Δ ⊆ ρ k ∪ {v} ∧ + subBd Δ = closure e ∪ range u := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have : Nonempty S := ⟨v⟩ + have hr := hsec.corners.region k + obtain ⟨g, hg, _, hg0, hgt⟩ := exists_path_into_disc (hsec.disc k) (hsec.bd k) + (hO.inter hsec.isOpen) ⟨hvO, hsec.mem⟩ + have hgr : ∀ t, 0 < t → g t ∈ ρ k := by + intro t ht + obtain ⟨htW, htQ, htbd⟩ := hgt t ht + exact hsec.sub k (hsec.inside k ⟨⟨htW.2, htQ⟩, htbd⟩) + have hgoff : ∀ t, 0 < t → g t ∉ (radialUnion hrad).U := by + intro t ht + have hΓ : g t ∉ Γ.U := region_subset hr (hgr t ht) + have hK : g t ∉ K.U := Set.disjoint_left.mp hfree + ⟨⟨(hgt t ht).1.1, (hgt t ht).2.1⟩, hΓ⟩ + rintro (h | h) + · exact hΓ h + · exact hK h + obtain ⟨p, hp, hgp⟩ := exists_region_of_approach (radialUnion hrad) hg hgoff + obtain ⟨r, hr', hpr⟩ := exists_region_of_sub hrad hp + have hrr : r = ρ k := region_eq_of_mem hr' hr (hpr (hgp 1 one_pos)) (hgr 1 one_pos) + have hpr' : p ⊆ ρ k := hrr ▸ hpr + have hcp : c ∈ closure p := hub_mem_closure hrad hS hr hp hpr' hc hcV + obtain ⟨η, hη⟩ := exists_edgePar (radialUnion hrad) + have hcH : c ∈ (radialUnion hrad).V := by rw [radialUnion_V]; exact hcV + obtain ⟨g₂, hg₂, hg₂0, hg₂p⟩ := exists_access hS (radialUnion hrad) hη hcH + (exists_half_at_hub hrad hS hmax hE hη hr hc hcV) hp hcp + have hvnot : v ∉ ρ k := fun h => region_subset hr h (Γ.V_subset_U hv) + have hvc : v ≠ c := fun h => hvnot (h.symm ▸ hc) + obtain ⟨y, hy⟩ := region_nonempty hp + have hppath : IsPathConnected p := + isPathConnected_of_isOpen hS (region_isOpen hp) (region_isPreconnected hp) ⟨y, hy⟩ + obtain ⟨u, hu, hui, hu0, hu1, hup, N, hN, hvN, hNg⟩ := + exists_chord hppath hvc (fun h => hvnot (hpr' h)) hg hg₂ hg0 hg₂0 hgp hg₂p + have hline : IsLineWithEnds (range u) c v := by + have h := isLine_range hu hui + rw [hu0, hu1] at h + exact GraphMinor.GM11.IsLineWithEnds.symm h + have hsubp : range u \ {c, v} ⊆ p := by + rintro _ ⟨⟨t, rfl⟩, ht⟩ + exact hup t (fun h => ht (Or.inr (by rw [h, hu0]; rfl))) + (fun h => ht (Or.inl (by rw [h, hu1]))) + have hKU : Disjoint (range u \ {c, v}) K.U := Set.disjoint_left.mpr fun x hx hxK => + region_subset hp (hsubp hx) (Or.inr hxK) + obtain ⟨e, he, hcap, Δ, hΔ, hΔr, hbd⟩ := + parallel_of_line hrad hmax hS hr hc hcV hv hline hvc.symm (hsubp.trans hpr') hKU + refine ⟨e, he, hcap, u, hu, hui, hu0, hu1, fun t ht0 ht1 => hpr' (hup t ht0 ht1), + ⟨N, hN, hvN, ?_⟩, Δ, hΔ, hΔr, hbd⟩ + intro t ht htN + obtain ⟨s, hs⟩ := hNg t htN + have hs0 : 0 < s := by + apply unitInterval.pos_iff_ne_zero.mpr + intro hs0 + have hut : u t = u 0 := by rw [← hs, hs0, hg0, hu0] + exact ht.ne' (hui hut) + exact hs ▸ ⟨(hgt s hs0).2.1, (hgt s hs0).2.2⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2HalfEdgeNeighbourhood.lean b/LeanPool/GraphMinor/GM12/Section2HalfEdgeNeighbourhood.lean new file mode 100644 index 0000000000..f5cb09a7f4 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2HalfEdgeNeighbourhood.lean @@ -0,0 +1,42 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Rotation + +/-! +# A drawing near a vertex consists of its short half-edges + +For the entry-edge construction of XII page 243, it is useful to remove +all but prescribed positive initial pieces of the incident edges. +The remaining parts are compact and miss the vertex. Their complement +is the required neighbourhood. The proof also applies to isolated +vertices and loops. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 unitInterval + +/-- Prescribed positive initial pieces of every half-edge cover the +drawing in a neighbourhood of the vertex, together with the vertex +itself. Compact edge remainders can all be excluded at once. -/ +theorem exists_halfEdge_neighbourhood {S : Type*} [TopologicalSpace S] [T2Space S] + (Γ : Drawing S) {γ : Set S → I → S} (hγ : EdgePar Γ γ) {v : S} (hv : v ∈ Γ.V) + (τ : halfEdges Γ γ v → I) (hτ0 : ∀ i, 0 < τ i) : + ∃ O : Set S, IsOpen O ∧ v ∈ O ∧ + O ∩ Γ.U ⊆ {v} ∪ ⋃ i : halfEdges Γ γ v, spoke γ i.val '' Icc 0 (τ i) := by + obtain ⟨K, hKclosed, hvK, hUsub⟩ := exists_closed_drawingAwayFromSpokes hγ hv τ hτ0 + refine ⟨Kᶜ, hKclosed.isOpen_compl, hvK, ?_⟩ + intro x hx + exact (hUsub hx.2).resolve_left hx.1 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2HitOrder.lean b/LeanPool/GraphMinor/GM12/Section2HitOrder.lean new file mode 100644 index 0000000000..9ada9b04b3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2HitOrder.lean @@ -0,0 +1,60 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Data.Finset.Sort +public import Mathlib.Data.Set.Card + +/-! +# Ordering the finitely many hit parameters + +The trace construction in XII, page 243, lists the vertex hits in their +order along the parameter interval. A finite set in a linear order has +an increasing enumeration. If it contains the two interval endpoints, +those are its first and last entries. The number of intervening +intervals is one less than the number of entries. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- Enumerate a finite set in an interval in increasing order, retaining +its endpoints and cardinality. This supplies the ordered parameters +used in the trace construction of XII, page 243. -/ +theorem exists_ordered_interval_enumeration {α : Type*} [LinearOrder α] + {H : Set α} (hH : H.Finite) {a b : α} (hsub : H ⊆ Icc a b) + (ha : a ∈ H) (hb : b ∈ H) : + ∃ (n : ℕ) (t : Fin (n + 1) → α), StrictMono t ∧ t 0 = a ∧ t (Fin.last n) = b ∧ + range t = H ∧ n + 1 = H.ncard := by + classical + let s := hH.toFinset + have hpos : 0 < s.card := Finset.card_pos.mpr ⟨a, hH.mem_toFinset.mpr ha⟩ + let n := s.card - 1 + have hcard : s.card = n + 1 := by dsimp only [n]; omega + let t : Fin (n + 1) ↪o α := s.orderEmbOfFin hcard + have ht : StrictMono t := t.strictMono + have hrange : range t = H := (Finset.range_orderEmbOfFin s hcard).trans hH.coe_toFinset + have ha' : a ∈ range t := hrange.symm ▸ ha + have hb' : b ∈ range t := hrange.symm ▸ hb + obtain ⟨i, hi⟩ := ha' + obtain ⟨j, hj⟩ := hb' + have hfirst : t 0 = a := le_antisymm + ((ht.monotone (Fin.zero_le i)).trans_eq hi) + (hsub (hrange ▸ mem_range_self 0)).1 + have hlast : t (Fin.last n) = b := le_antisymm + (hsub (hrange ▸ mem_range_self (Fin.last n))).2 + (hj ▸ ht.monotone (Fin.le_last j)) + refine ⟨n, t, ht, hfirst, hlast, hrange, ?_⟩ + rw [Set.ncard_eq_toFinset_card H hH] + exact hcard.symm + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2ImageGermCover.lean b/LeanPool/GraphMinor/GM12/Section2ImageGermCover.lean new file mode 100644 index 0000000000..2b722c3dbc --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2ImageGermCover.lean @@ -0,0 +1,83 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Topology.ContinuousOn +public import Mathlib.Topology.Compactness.Compact +public import Mathlib.Topology.Separation.Hausdorff + +/-! +# Local image coverage from neighbourhoods of a fibre + +For the positive-length trace restriction in XII (2.1), pages 243--244, +all sufficiently near curve-image points come from neighbourhoods of +the parameters mapping to the chosen vertex. The complement of those +parameter neighbourhoods is compact. Its image is closed and misses +the vertex, so deleting that image gives the required neighbourhood. +This lets finitely many entering and leaving corner germs control +the whole curve image near the vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology + +/-- Near a point of the target, every image point of a compact source +comes from any prescribed open neighbourhood of that point's fibre. -/ +theorem exists_image_neighbourhood_from_fibre_cover + {A S : Type*} [TopologicalSpace A] [CompactSpace A] + [TopologicalSpace S] [T2Space S] {f : A → S} (hf : Continuous f) + {v : S} {U : Set A} (hU : IsOpen U) (hcover : f ⁻¹' {v} ⊆ U) : + ∃ N : Set S, IsOpen N ∧ v ∈ N ∧ range f ∩ N ⊆ f '' U := by + let N := (f '' Uᶜ)ᶜ + have hNc : IsOpen N := ((hU.isClosed_compl.isCompact).image hf).isClosed.isOpen_compl + have hvN : v ∈ N := by + rintro ⟨z, hz, he⟩ + exact hz (hcover (show z ∈ f ⁻¹' {v} from he)) + refine ⟨N, hNc, hvN, ?_⟩ + rintro x ⟨⟨z, rfl⟩, hzN⟩ + by_cases hz : z ∈ U + · exact ⟨z, hz, rfl⟩ + · exact (hzN ⟨z, hz, rfl⟩).elim + +/-- If the curve image lies in a set near every parameter over a +point, its whole image lies in that set near the point. -/ +theorem exists_image_neighbourhood_of_fibre_germs + {A S : Type*} [TopologicalSpace A] [CompactSpace A] + [TopologicalSpace S] [T2Space S] {f : A → S} (hf : Continuous f) + {v : S} {V : Set S} + (hgerm : ∀ z, f z = v → f ⁻¹' V ∈ nhds z) : + ∃ N : Set S, IsOpen N ∧ v ∈ N ∧ range f ∩ N ⊆ V := by + have hcover : f ⁻¹' {v} ⊆ interior (f ⁻¹' V) := by + intro z hz + exact mem_interior_iff_mem_nhds.mpr (hgerm z hz) + obtain ⟨N, hN, hvN, hsub⟩ := exists_image_neighbourhood_from_fibre_cover hf isOpen_interior hcover + refine ⟨N, hN, hvN, hsub.trans ?_⟩ + rintro x ⟨z, hz, rfl⟩ + exact interior_subset (s := f ⁻¹' V) hz + +/-- If a part of the image accumulates at a point, it accumulates +at some parameter over that point. Compactness makes the image +of the closed parameter accumulation set closed. -/ +theorem exists_fibre_point_in_closure_preimage + {A S : Type*} [TopologicalSpace A] [CompactSpace A] + [TopologicalSpace S] [T2Space S] {f : A → S} (hf : Continuous f) + {v : S} {B : Set S} (hv : v ∈ closure (range f ∩ B)) : + ∃ a : A, f a = v ∧ a ∈ closure (f ⁻¹' B) := by + have hclosed : IsClosed (f '' closure (f ⁻¹' B)) := + (isClosed_closure.isCompact.image hf).isClosed + have hsub : range f ∩ B ⊆ f '' closure (f ⁻¹' B) := by + rintro z ⟨⟨a, rfl⟩, ha⟩ + exact ⟨a, subset_closure ha, rfl⟩ + obtain ⟨a, ha, hav⟩ := (closure_minimal hsub hclosed) hv + exact ⟨a, hav, ha⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2InsideHomotopy.lean b/LeanPool/GraphMinor/GM12/Section2InsideHomotopy.lean new file mode 100644 index 0000000000..86a17169a1 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2InsideHomotopy.lean @@ -0,0 +1,105 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section7b +import LeanPool.GraphMinor.GM12.Section3DiscUniqueness +import LeanPool.GraphMinor.GM07.Section11c + +/-! +# Comparing disc insides through a homotopy avoiding two points + +For the deformation step in XII (2.1), Case 1, page 244, keep a +point outside both chosen discs fixed. A second point lies outside +one disc precisely when its boundary contracts without meeting +either point. By Graph Minors XI (7.2), a contracting boundary bounds +a disc avoiding the points, and the common outside point makes that +disc the original one. A homotopy avoiding both points therefore +preserves membership of the second point in the two chosen insides. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM07 + +/-- With a fixed point outside a boundary disc, contraction avoiding +that point and a second point detects whether the second point is +outside the disc. -/ +theorem curve_null_in_pair_compl_iff_not_mem_disc + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {φ : C(Circle, S)} (hφ : IsEmbedding φ) + {D : Set S} (hD : IsClosedDisc D) (hbd : subBd D = range φ) + {p q : S} (hq : q ∉ D) : + ClosedCurveIsNullHomotopicIn ({p, q} : Set S)ᶜ φ ↔ p ∉ D := by + constructor + · intro hn + have hF : IsOArc (range φ) := ⟨hφ.toHomeomorph⟩ + have hnF : IsNullHomotopicOArcIn ({p, q} : Set S)ᶜ (range φ) := ⟨hφ.toHomeomorph, hn⟩ + have hFZ : range φ ⊆ ({p, q} : Set S)ᶜ := by + obtain ⟨c, hc, H, hH, hH0, _⟩ := hn + rintro x ⟨z, rfl⟩ + rw [← hH0 z] + exact hH (z, 0) + obtain ⟨D', hD'Z, hD', hbd'⟩ := GM11.theorem_7_2_proof hS hF hFZ hnF + have hfront : subBd D = discBd D := + (subBd_eq_frontier D).trans (IsClosedDisc.frontier_eq_discBd hS hD) + have hfront' : subBd D' = discBd D' := + (subBd_eq_frontier D').trans (IsClosedDisc.frontier_eq_discBd hS hD') + have hb : discBd D = discBd D' := + hfront.symm.trans (hbd.trans (hbd'.symm.trans hfront')) + have hq' : q ∉ D' := fun hx => hD'Z hx (Or.inr rfl) + have hnotcover : D ∪ D' ≠ univ := by + intro heq + rcases (heq.symm ▸ mem_univ q : q ∈ D ∪ D') with h | h + · exact hq h + · exact hq' h + have heq := eq_of_discBd_eq_of_union_ne_univ (fun x => (hS.2.2 x).isManifoldPoint) hD hD' hb + hnotcover + intro hp + exact hD'Z (heq ▸ hp) (Or.inl rfl) + · intro hp + have hDZ : D ⊆ ({p, q} : Set S)ᶜ := by + intro x hx hpair + simp only [mem_insert_iff, mem_singleton_iff] at hpair + rcases hpair with hxp | hxq + · exact hp (hxp ▸ hx) + · exact hq (hxq ▸ hx) + have hφD : range φ ⊆ D := by + intro x hx + have hxb : x ∈ subBd D := hbd.symm ▸ hx + exact hD.isCompact.isClosed.closure_subset_iff.mpr subset_rfl hxb.1 + obtain ⟨c, hc, H⟩ := hD.isSimplyConnectedSet.2 φ hφD + exact ⟨c, hDZ hc, H.mono hDZ⟩ + +/-- The inside comparison used in XII (2.1), Case 1: homotopic +boundary parameterizations avoiding two points give the same inside +membership, provided one of the points lies outside both discs. -/ +theorem mem_disc_iff_of_boundary_homotopy + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {φ ψ : C(Circle, S)} + (hφ : IsEmbedding φ) (hψ : IsEmbedding ψ) + {D E : Set S} (hD : IsClosedDisc D) (hE : IsClosedDisc E) + (hbdD : subBd D = range φ) (hbdE : subBd E = range ψ) + {p q : S} (hqD : q ∉ D) (hqE : q ∉ E) + (hh : ClosedCurvesHomotopicIn ({p, q} : Set S)ᶜ φ ψ) : p ∈ D ↔ p ∈ E := by + have hnot : p ∉ D ↔ p ∉ E := by + constructor + · intro hp + apply (curve_null_in_pair_compl_iff_not_mem_disc hS hψ hE hbdE hqE).mp + exact GM11.null_of_homotopic subset_rfl (GM07.ClosedCurvesHomotopicIn.symm hh) + ((curve_null_in_pair_compl_iff_not_mem_disc hS hφ hD hbdD hqD).mpr hp) + · intro hp + apply (curve_null_in_pair_compl_iff_not_mem_disc hS hφ hD hbdD hqD).mp + exact GM11.null_of_homotopic subset_rfl hh + ((curve_null_in_pair_compl_iff_not_mem_disc hS hψ hE hbdE hqE).mpr hp) + exact not_iff_not.mp hnot + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2IntervalCoverage.lean b/LeanPool/GraphMinor/GM12/Section2IntervalCoverage.lean new file mode 100644 index 0000000000..ac13005b26 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2IntervalCoverage.lean @@ -0,0 +1,57 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Order.Interval.Set.LinearOrder +public import Mathlib.Data.Fin.Basic + +/-! +# Points of a finite parameter subdivision + +The trace definition in XII, page 243, lists all vertex parameters +and the intervening open intervals. Every point between the first +and last parameters is either an entry of the list or belongs to +one of those intervals. Remove the first interval and repeat to +prove this coverage. It is used to read the original curve image +as its vertex visits together with its region visits. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- A finite real-parameter subdivision covers its closed interval +by its entries and its successive open intervals. The assertion +holds in any linear order. -/ +theorem mem_range_or_mem_successive_open_interval + {α : Type*} [LinearOrder α] {n : ℕ} (t : Fin (n + 1) → α) + {s : α} (hs : s ∈ Icc (t 0) (t (Fin.last n))) : + s ∈ range t ∨ ∃ i : Fin n, s ∈ Ioo (t i.castSucc) (t i.succ) := by + induction n with + | zero => + left + exact ⟨0, (le_antisymm hs.2 hs.1).symm⟩ + | succ n ih => + by_cases hs0 : s = t 0 + · exact Or.inl ⟨0, hs0.symm⟩ + · by_cases hs1 : s = t (0 : Fin (n + 1)).succ + · exact Or.inl ⟨(0 : Fin (n + 1)).succ, hs1.symm⟩ + · by_cases hst : s ≤ t (0 : Fin (n + 1)).succ + · exact Or.inr ⟨0, lt_of_le_of_ne hs.1 (Ne.symm hs0), lt_of_le_of_ne hst hs1⟩ + · let t' : Fin (n + 1) → α := fun i => t i.succ + have hs' : s ∈ Icc (t' 0) (t' (Fin.last n)) := + ⟨(lt_of_not_ge hst).le, hs.2⟩ + rcases ih t' hs' with h | ⟨i, hi⟩ + · obtain ⟨i, hi⟩ := h + exact Or.inl ⟨i.succ, hi⟩ + · exact Or.inr ⟨i.succ, hi⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2LeafArcData.lean b/LeanPool/GraphMinor/GM12/Section2LeafArcData.lean new file mode 100644 index 0000000000..7ce59564d7 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2LeafArcData.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM11.Corners +import LeanPool.GraphMinor.Surface.ArcTools + +/-! +# The unique edge at a leaf + +For the omitted entry-edge lemma on XII page 243, a vertex with one +half-edge has one incident non-loop edge. Every other edge closure +misses the vertex. A loop would supply two distinct half-edges there. +The incident edge closure is therefore a line with the leaf as one end. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A one-half-edge vertex has a unique incident edge closure, and +that closure is a line starting at the vertex. -/ +theorem exists_incident_line_at_leaf + {S : Type*} [TopologicalSpace S] [T2Space S] + (Γ : Drawing S) {γ : Set S → unitInterval → S} (hγ : EdgePar Γ γ) + {v : S} (hv : v ∈ Γ.V) (hcard : Nat.card (halfEdges Γ γ v) = 1) : + ∃ (e : Set S) (u : S), e ∈ Γ.E ∧ u ≠ v ∧ + closure e ∩ Γ.V = {v, u} ∧ IsLineWithEnds (closure e) v u ∧ + ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f := by + obtain ⟨hss, hne⟩ := Nat.card_eq_one_iff_unique.mp hcard + obtain ⟨⟨⟨e, b⟩, he, hb⟩⟩ := hne + have hleaf : ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f := by + intro f hf hfe hvf + obtain ⟨b', hb'⟩ := exists_end_eq hγ hf hv hvf + have heq := congrArg (fun k : halfEdges Γ γ v => k.val.1) + (hss.elim ⟨(f, b'), hf, hb'⟩ ⟨(e, b), he, hb⟩) + exact hfe heq + have hvcl : v ∈ closure e := hb ▸ end_mem_closure hγ he b + rcases Γ.edge_cond e he with ⟨u, w, huw, hcap, hL⟩ | ⟨u, hcap, _⟩ + · have hvends : v ∈ ({u, w} : Set S) := hcap ▸ (show v ∈ closure e ∩ Γ.V from ⟨hvcl, hv⟩) + rcases hvends with rfl | rfl + · exact ⟨e, w, he, huw.symm, hcap, hL, hleaf⟩ + · exact ⟨e, u, he, huw, by simpa only [pair_comm] using hcap, hL.symm, hleaf⟩ + · have hend : ∀ c, γ e (endOf c) = v := by + intro c + have h₁ : γ e (endOf c) ∈ closure e ∩ Γ.V := by + refine ⟨end_mem_closure hγ he c, ?_⟩ + cases c + · exact hγ.zero e he + · exact hγ.one e he + have h₂ : v ∈ closure e ∩ Γ.V := ⟨hvcl, hv⟩ + rw [hcap] at h₁ h₂ + exact h₁.trans h₂.symm + have heq := congrArg (fun k : halfEdges Γ γ v => k.val.2) + (hss.elim ⟨(e, true), he, hend true⟩ ⟨(e, false), he, hend false⟩) + simp at heq + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2LeafEntryEquality.lean b/LeanPool/GraphMinor/GM12/Section2LeafEntryEquality.lean new file mode 100644 index 0000000000..245efdda82 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2LeafEntryEquality.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TerminalPatch +public import LeanPool.GraphMinor.GM11.RadialCorners +import LeanPool.GraphMinor.GM12.Section2LeafEntryPatchProof +import LeanPool.GraphMinor.GM11.Regions + +/-! +# A leaf has one incident region and one entry corner + +For trace restriction in XII (2.1), pages 243--244, the leaf case +has no sector choice. The punctured normal patch is connected and +lies in any incident region, so two incident regions agree. Any two +approaches in that region enter through this patch and hence have +the same entry edge. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- At a vertex with one half-edge, two regions whose closures contain +the vertex agree. The normal leaf patch meets both regions. -/ +theorem region_eq_of_leaf_in_closures + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {Γ : Drawing S} {γ : Set S → unitInterval → S} (hγ : EdgePar Γ γ) + {v : S} (hv : v ∈ Γ.V) (hcard : Nat.card (halfEdges Γ γ v) = 1) + {r r' : Set S} (hr : r ∈ Γ.R) (hr' : r' ∈ Γ.R) + (hvr : v ∈ closure r) (hvr' : v ∈ closure r') : r = r' := by + obtain ⟨N, X, hN, hvN, _, _, _, hXZ, hcover⟩ := + leafEntryPatch S hS hConn Γ γ hγ v hv hcard r hr hvr + obtain ⟨z, hzN, hzr'⟩ := mem_closure_iff.mp hvr' N hN hvN + have hzoff : z ∉ Γ.U := region_subset hr' hzr' + have hzv : z ∉ ({v} : Set S) := fun hz => hzoff (hz ▸ Γ.V_subset_U hv) + have hzr : z ∈ r := (hXZ (hcover ⟨hzN, hzoff⟩)).resolve_right hzv + exact region_eq_of_mem hr hr' hzr hzr' + +/-- Two continuous normal approaches to a leaf have the same entry +edge. This handles the one-corner case in the restriction step of +XII (2.1), without any relation between their parameterizations. -/ +theorem entersLike_edge_eq_at_leaf + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {γ : Set S → unitInterval → S} (hγ : EdgePar Γ γ) + {v w : S} (hv : v ∈ Γ.V) (hcard : Nat.card (halfEdges Γ γ v) = 1) + {r e e' : Set S} (hr : r ∈ Γ.R) (hw : w ∈ r ∩ K.V) + (he : e ∈ K.E) (he' : e' ∈ K.E) + {f g : ℝ → S} (hf : Continuous f) (hg : Continuous g) + {a c b d : ℝ} (hac : a < c) (hbd : b < d) + (hfc : f c = v) (hgd : g d = v) + (hfr : ∀ z ∈ Ioo a c, f z ∈ r) (hgr : ∀ z ∈ Ioo b d, g z ∈ r) + (hentry : EntersLike f a c e r v w) (hentry' : EntersLike g b d e' r v w) : e = e' := by + have hccl : c ∈ closure (Ioo a c) := by + rw [closure_Ioo hac.ne] + exact ⟨hac.le, le_rfl⟩ + have hvr : v ∈ closure r := by + rw [← hfc] + exact closure_mono (image_subset_iff.mpr hfr) + (image_closure_subset_closure_image hf ⟨c, hccl, rfl⟩) + obtain ⟨N, X, hN, hvN, hvX, hX, hpuncture, hXZ, hcover⟩ := + leafEntryPatch S hS hConn Γ γ hγ v hv hcard r hr hvr + exact entersLike_edge_eq_of_normal_patch hS hConn hK hr hv hw he he' + hN hvN hvX hX hXZ hpuncture hcover hf hg hac hbd hfc hgd hfr hgr hentry hentry' + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2LeafEntryExistence.lean b/LeanPool/GraphMinor/GM12/Section2LeafEntryExistence.lean new file mode 100644 index 0000000000..a19ffeed16 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2LeafEntryExistence.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2PatchEntersLike +public import LeanPool.GraphMinor.GM12.Section2LeafEntryPatchProof +public import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM12.Section2SpokePaths +import LeanPool.GraphMinor.GM11.RadialRegions + +/-! +# Entry-edge existence at leaves + +The omitted entry-edge assertion on XII page 243 holds at a leaf as +well as in a sector. The approaching curve puts the vertex in the +closure of its region. Radial maximality supplies a spoke to that +region's hub. Both the incoming curve and this spoke enter the proved +leaf patch. The patch comparison yields the exact entry witness. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The entry edge exists at a vertex with exactly one half-edge. +This closes the leaf case of the omitted assertion on XII page 243. -/ +theorem exists_entersLike_of_one_halfEdge + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} (hrad : PreRad (.drawing Γ) K) + (hmax : RadMax (.drawing Γ) K) (hE : Γ.E.Nonempty) + {γ : Set S → unitInterval → S} (hγ : EdgePar Γ γ) + {v : S} (hv : v ∈ Γ.V) (hcard : Nat.card (halfEdges Γ γ v) = 1) + {r : Set S} (hr : r ∈ Γ.R) {w : S} (hw : w ∈ r) (hwV : w ∈ K.V) + {f : ℝ → S} (hf : Continuous f) {a c : ℝ} (hac : a < c) (hfc : f c = v) + (hinside : ∀ t ∈ Ioo a c, f t ∈ r) : + ∃ e ∈ K.E, EntersLike f a c e r v w := by + have hccl : c ∈ closure (Ioo a c) := by + rw [closure_Ioo hac.ne] + exact ⟨hac.le, le_rfl⟩ + have hvr : v ∈ closure r := by + rw [← hfc] + exact closure_mono (image_subset_iff.mpr hinside) + (image_closure_subset_closure_image hf ⟨c, hccl, rfl⟩) + obtain ⟨N, X, hN, hvN, hvX, hX, hpuncture, hXZ, hcover⟩ := + leafEntryPatch S hS inferInstance Γ γ hγ v hv hcard r hr hvr + obtain ⟨e, he, hcap⟩ := exists_spoke_at hrad hmax hS hE hr hw hwV hv hvr + obtain ⟨η, hη⟩ := exists_edgePar K + have hvK : v ∈ K.V := radial_V hrad hv + have hvcl : v ∈ closure e := (hcap.symm ▸ (show v ∈ ({v, w} : Set S) from Or.inl rfl)).1 + have hwcl : w ∈ closure e := (hcap.symm ▸ (show w ∈ ({v, w} : Set S) from Or.inr rfl)).1 + obtain ⟨b, hb⟩ := exists_end_eq hη he hvK hvcl + let i : halfEdges K η v := ⟨(e, b), he, hb⟩ + have hvw : v ≠ w := fun heq => region_subset hr (heq.symm ▸ hw) (Γ.V_subset_U hv) + obtain ⟨β, hβi, _, hβe, _⟩ := exists_spoke_path_from_halfEdge hη i hvw hwV hcap + have hβr := path_positive_in_region β hw hβe (spoke_subset_region hS hrad hr he hw hwV hwcl) + exact ⟨e, he, entersLike_of_normal_patch hr hv hw hN hvN hvX hX hpuncture hXZ hcover + β hβi hβe hβr hf hac hfc hinside⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2LeafEntryPatchProof.lean b/LeanPool/GraphMinor/GM12/Section2LeafEntryPatchProof.lean new file mode 100644 index 0000000000..bf4d8201be --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2LeafEntryPatchProof.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2LeafPatch +import LeanPool.GraphMinor.GM12.Section2LeafSlitPatch +import LeanPool.GraphMinor.GM11.Regions + +/-! +# The leaf entry patch + +The omitted entry-edge lemma of XII, page 243, requires the incoming +curve and spoke to be compared in the incident region with the leaf +restored. The slit patch at the unique incident edge has a connected +puncture off the drawing. Since the leaf is in the region's closure, +that puncture meets the region and therefore lies wholly in it. This +proves the patch statement at leaves, including its local coverage. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +universe u + +/-- The leaf patch needed in the omitted entry-edge existence proof +on XII page 243. The punctured slit patch lies in the incident region, +and its contraction restores the leaf point. -/ +theorem leafEntryPatch : LeafEntryPatchStatement.{u} := by + intro S _ _ hS _ Γ γ hγ v hv hcard r hr hvr + obtain ⟨e, w, he, _, _, hL, hleaf⟩ := exists_incident_line_at_leaf Γ hγ hv hcard + obtain ⟨N, X, hN, hvN, hvX, hsimple, hpath, hXoff, hcover⟩ := + exists_slit_patch_at_leaf_line hS Γ he hL hleaf + have hdis : Disjoint (X \ {v}) Γ.U := disjoint_left.mpr (by + intro x hx hxU + rcases hXoff hx.1 with hxoff | hxv + · exact hxoff hxU + · exact hx.2 hxv) + obtain ⟨x, hxN, hxr⟩ := mem_closure_iff.mp hvr N hN hvN + have hxoff : x ∉ Γ.U := region_subset hr hxr + have hxX : x ∈ X := hcover ⟨hxN, hxoff⟩ + have hxv : x ≠ v := fun heq => hxoff (heq.symm ▸ Γ.V_subset_U hv) + have hYr : X \ {v} ⊆ r := subset_region hr hpath.isConnected.isPreconnected hdis ⟨hxX, hxv⟩ hxr + refine ⟨N, X, hN, hvN, hvX, hsimple, hpath, ?_, hcover⟩ + intro y hy + by_cases hyv : y = v + · exact Or.inr hyv + · exact Or.inl (hYr ⟨hy, hyv⟩) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2LeafPatch.lean b/LeanPool/GraphMinor/GM12/Section2LeafPatch.lean new file mode 100644 index 0000000000..05a485a94d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2LeafPatch.lean @@ -0,0 +1,47 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM11.Rotation + +/-! +# The local patch needed at a leaf + +The omitted entry-edge existence proof of XII, page 243, also applies +at a leaf. A neighbourhood with the incident edge removed, and its +leaf vertex restored, needs a simply-connected patch. The punctured +patch must stay path connected so that incoming points can be joined +to points on the radial spoke without passing through the vertex. +This file states that local topological claim separately. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +universe u + +/-- The local patch claim needed in the leaf case of the omitted entry +lemma of XII, page 243. This is a topological step of that proof, rather +than a cited result of another paper. The other valencies are handled +by sector patches or by exclusion of isolated vertices. -/ +def LeafEntryPatchStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ (Γ : Drawing S) (γ : Set S → unitInterval → S), EdgePar Γ γ → + ∀ v ∈ Γ.V, Nat.card (halfEdges Γ γ v) = 1 → + ∀ r ∈ Γ.R, v ∈ closure r → + ∃ N X : Set S, IsOpen N ∧ v ∈ N ∧ v ∈ X ∧ + IsSimplyConnectedSet X ∧ IsPathConnected (X \ {v}) ∧ + X ⊆ r ∪ {v} ∧ N \ Γ.U ⊆ X + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2LeafSlitPatch.lean b/LeanPool/GraphMinor/GM12/Section2LeafSlitPatch.lean new file mode 100644 index 0000000000..c7f40c5601 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2LeafSlitPatch.lean @@ -0,0 +1,94 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2ArcGermChart +public import LeanPool.GraphMinor.GM12.Section2LeafArcData +import LeanPool.GraphMinor.GM11.RadialCorners +import LeanPool.GraphMinor.Surface.ArcErase +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# A slit patch at a drawing leaf + +For the entry-edge lemma of XII, page 243, isolate a short initial +part of the leaf edge in a surface chart. The other vertices, other +edge closures, and the far part of this edge form a closed set missing +the leaf. In its complement the drawing agrees with the short arc. +The arc-germ chart and slit-ball contraction then give the required +simply connected patch, with path-connected puncture. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric Surface GM11 + +/-- An incident line isolated from all other edges at its initial +vertex has a simply connected slit patch at that vertex. -/ +theorem exists_slit_patch_at_leaf_line + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (Γ : Drawing S) + {e : Set S} (he : e ∈ Γ.E) {u v : S} (hL : IsLineWithEnds (closure e) v u) + (hleaf : ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f) : + ∃ N X : Set S, IsOpen N ∧ v ∈ N ∧ v ∈ X ∧ + IsSimplyConnectedSet X ∧ IsPathConnected (X \ {v}) ∧ + X ⊆ Γ.Uᶜ ∪ {v} ∧ N \ Γ.U ⊆ X := by + obtain ⟨a, ha, harange, ha0, _⟩ := hL.exists_arc + obtain ⟨U, h, g, c, _, hg0⟩ := (hS.2.2 v).exists_ballChart + isOpen_univ (mem_univ v) (by norm_num : (0 : ℝ) < 1) + have hvU : v ∈ U := hg0 ▸ c.gm (mem_ball_self (by norm_num : (0 : ℝ) < 1)) + obtain ⟨τ, hτ, _, hτU⟩ := exists_pos_le ha.1 c.isOpen (ha0.symm ▸ hvU) + (by norm_num : (0 : unitInterval) < 1) + let a' := subArc a 0 τ + have ha' : IsArcMap a' := ha.sub (Ne.symm hτ.ne') + have ha'0 : a' 0 = v := (subArc_zero a 0 τ).trans ha0 + have ha'range : range a' = a '' Icc 0 τ := range_subArc a (unitInterval.nonneg τ) + have ha'U : range a' ⊆ U := by + rw [ha'range] + rintro _ ⟨t, ht, rfl⟩ + exact hτU t ht.2 + have ha'Γ : range a' ⊆ Γ.U := + (range_subArc_subset a 0 τ).trans (harange.le.trans (Γ.closure_subset_U he)) + let T := ((Γ.V \ {v}) ∪ ⋃ f ∈ Γ.E \ {e}, closure f) ∪ a '' Icc τ 1 + have hTc : IsClosed T := by + refine ((Γ.finite_V.subset sdiff_subset).isClosed.union + ((Γ.finite_edges.subset sdiff_subset).isClosed_biUnion (fun _ _ + => isClosed_closure))).union ?_ + exact (isCompact_Icc.image ha.1).isClosed + have hvT : v ∉ T := by + rintro ((hvV | hvE) | hvA) + · exact hvV.2 rfl + · obtain ⟨f, hf, hvf⟩ := mem_iUnion₂.mp hvE + exact hleaf f hf.1 (fun heq => hf.2 heq) hvf + · obtain ⟨t, ht, htv⟩ := hvA + have ht0 : t = 0 := ha.2 (htv.trans ha0.symm) + exact hτ.not_ge (ht0 ▸ ht.1) + have hΓgerm : Γ.U ∩ Tᶜ ⊆ range a' := by + rintro x ⟨hxU, hxT⟩ + by_cases hxV : x ∈ Γ.V + · by_cases hxv : x = v + · exact ⟨0, ha'0.trans hxv.symm⟩ + · exact (hxT (Or.inl (Or.inl ⟨hxV, hxv⟩))).elim + · obtain ⟨f, hf, hxf⟩ := Γ.exists_edge_of_mem hxU hxV + have hfe : f = e := by + by_contra hn + exact hxT (Or.inl (Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hn⟩, subset_closure hxf⟩))) + have hxe : x ∈ closure e := hfe ▸ subset_closure hxf + obtain ⟨t, ht⟩ := harange.symm ▸ hxe + by_cases htτ : t ≤ τ + · rw [ha'range] + exact ⟨t, ⟨unitInterval.nonneg t, htτ⟩, ht⟩ + · exact (hxT (Or.inr ⟨t, ⟨(lt_of_not_ge htτ).le, unitInterval.le_one t⟩, ht⟩)).elim + have hpatch := exists_slit_patch_of_arc_germ (fun x => (hS.2.2 x).isManifoldPoint) + c ha' ha'U ha'Γ hTc.isOpen_compl (ha'0.symm ▸ hvT) hΓgerm + rwa [ha'0] at hpatch + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2LeafTraceRestriction.lean b/LeanPool/GraphMinor/GM12/Section2LeafTraceRestriction.lean new file mode 100644 index 0000000000..117e8eedf8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2LeafTraceRestriction.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2LeafEntryEquality +public import LeanPool.GraphMinor.GM12.Section2TraceGerms +import LeanPool.GraphMinor.GM12.Section2CirclePeriod +import LeanPool.GraphMinor.GM12.Section2PeriodicHits +import LeanPool.GraphMinor.GM11.RadialRegions +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Trace restriction at a leaf + +For XII (2.1), pages 243--244, consider an entry edge of the +restricted curve at a leaf visited by the original trace. Locate +an incoming recorded visit of the original trace. Both approach +regions have the leaf in their closure, so they agree. Their hubs +agree as well. The one-corner entry comparison identifies the edges, +which proves edge containment at this vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +private theorem approach_mem_closure + {S : Type*} [TopologicalSpace S] {f : ℝ → S} (hf : Continuous f) + {a b : ℝ} (hab : a < b) {r : Set S} (hfr : ∀ t ∈ Ioo a b, f t ∈ r) : + f b ∈ closure r := by + have hb : b ∈ closure (Ioo a b) := by + rw [closure_Ioo hab.ne] + exact ⟨hab.le, le_rfl⟩ + exact closure_mono (image_subset_iff.mpr hfr) + (image_closure_subset_closure_image hf ⟨b, hb, rfl⟩) + +/-- Every entry edge of another normal curve at a visited leaf is +already in the original trace. No shared parameterization of the +two approaches is required. -/ +theorem traceSteps_mem_edges_of_entry_at_leaf + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {γ : Set S → unitInterval → S} (hγ : EdgePar Γ γ) + {v : S} (hv : v ∈ Γ.V) (hcard : Nat.card (halfEdges Γ γ v) = 1) + {f g : ℝ → S} (hf : Continuous f) (hg : Continuous g) + {a b : ℝ} {u z : S} (W : GraphWalk K.toGraph u z) + (hW : TraceSteps Γ K f a b W) {s : ℝ} (hs : s ∈ Ioc a b) (hfs : f s = v) + {c d : ℝ} (hcd : c < d) (hgd : g d = v) + {r e : Set S} {w : S} (hr : r ∈ Γ.R) (hw : w ∈ r ∩ K.V) + (he : e ∈ K.E) (hgr : ∀ t ∈ Ioo c d, g t ∈ r) + (hentry : EntersLike g c d e r v w) : e ∈ W.edges := by + obtain ⟨p, w₀, r₀, e₀, _, hps, hw₀, hr₀, hw₀r, he₀W, hfr₀, hentry₀⟩ := + traceSteps_exists_incoming_germ W hW hs (hfs.symm ▸ hv) + rw [hfs] at hentry₀ + have hvr : v ∈ closure r := hgd ▸ approach_mem_closure hg hcd hgr + have hvr₀ : v ∈ closure r₀ := hfs ▸ approach_mem_closure hf hps hfr₀ + have hrr := region_eq_of_leaf_in_closures hS hConn hγ hv hcard hr₀ hr hvr₀ hvr + subst r₀ + have hww := hub_unique (show PreRad (.drawing Γ) K from ⟨hK.1, hK.2.1⟩) + hr hw.1 hw.2 hw₀r hw₀ + subst w + have he₀ : e₀ ∈ K.E := (walkDrawing_isSubdrawing K W).2 (by + rw [walkDrawing_E] + exact he₀W) + have heq := entersLike_edge_eq_at_leaf hS hConn hK hγ hv hcard hr + ⟨hw₀r, hw₀⟩ he he₀ hg hf hcd hps hgd hfs hgr hfr₀ hentry hentry₀ + exact heq.symm ▸ he₀W + +/-- The leaf part of trace restriction for closed-curve traces: +any entry at a leaf in the original curve image uses a recorded edge. -/ +theorem trace_mem_edges_of_entry_at_leaf + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {γ : Set S → unitInterval → S} (hγ : EdgePar Γ γ) + {v : S} (hv : v ∈ Γ.V) (hcard : Nat.card (halfEdges Γ γ v) = 1) + {φ : C(Circle, S)} {u : S} (W : GraphWalk K.toGraph u u) + (hW : IsTrace Γ K φ W) (hvφ : v ∈ range φ) + {g : ℝ → S} (hg : Continuous g) {c d : ℝ} (hcd : c < d) (hgd : g d = v) + {r e : Set S} {w : S} (hr : r ∈ Γ.R) (hw : w ∈ r ∩ K.V) + (he : e ∈ K.E) (hgr : ∀ t ∈ Ioo c d, g t ∈ r) + (hentry : EntersLike g c d e r v w) : e ∈ W.edges := by + obtain ⟨z, hz⟩ := hvφ + rcases hW.2 with ⟨_, _, _, r₀, hr₀, hφr₀, _⟩ | ⟨_, _, a, hsteps⟩ + · exact (region_subset hr₀ (hφr₀ (mem_range_self z)) + (hz.symm ▸ Γ.V_subset_U hv)).elim + · obtain ⟨s, hs, hsz⟩ := (circle_parameter_bijOn a).surjOn (mem_univ z) + have hfs : periodicCurve φ s = v := (congrArg φ hsz).trans hz + have hex : ∃ t ∈ Ioc a (a + 1), periodicCurve φ t = v := by + by_cases hsa : s = a + · have hp := traceSteps_parameters W hsteps + refine ⟨a + 1, ⟨by linarith, le_rfl⟩, ?_⟩ + exact hp.2.2.2.1.trans (hp.2.1.symm.trans (hsa ▸ hfs)) + · exact ⟨s, ⟨lt_of_le_of_ne hs.1 (Ne.symm hsa), hs.2.le⟩, hfs⟩ + obtain ⟨t, ht, hft⟩ := hex + exact traceSteps_mem_edges_of_entry_at_leaf hS hConn hK hγ hv hcard + (periodicCurve_continuous φ) hg W hsteps ht hft hcd hgd hr hw he hgr hentry + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2LocalImageRestriction.lean b/LeanPool/GraphMinor/GM12/Section2LocalImageRestriction.lean new file mode 100644 index 0000000000..8049069fce --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2LocalImageRestriction.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2EntryImageRestriction +import LeanPool.GraphMinor.GM12.Section2TerminalPatch +import LeanPool.GraphMinor.GM12.Section2EntryIndependence +import LeanPool.GraphMinor.GM11.Regions + +/-! +# Restriction needs image inclusion only near vertex visits + +In Case 2 of XII (2.1), page 244, the smaller circle contains a +new chord in a region. The chord is closed and misses every drawing +vertex. Near a vertex the smaller curve therefore still lies in the +original curve image. Shorten each entry interval to that part and +apply the image-entry restriction theorem. This records its edge +without requiring the new chord to lie in the original image. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- To preserve an entry edge it suffices that a terminal interval +of the approach lie in the original curve image. -/ +theorem trace_mem_edges_of_entry_locally_in_image + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {φ : C(Circle, S)} {u : S} (W : GraphWalk K.toGraph u u) (hW : IsTrace Γ K φ W) + {v w : S} (hv : v ∈ Γ.V) {r e : Set S} (hr : r ∈ Γ.R) + (hw : w ∈ r ∩ K.V) (he : e ∈ K.E) + {g : ℝ → S} (hg : Continuous g) {c d c₀ : ℝ} (hc₀ : c₀ ∈ Ioo c d) (hgd : g d = v) + (hgr : ∀ t ∈ Ioo c d, g t ∈ r) (himage : ∀ t ∈ Icc c₀ d, g t ∈ range φ) + (hentry : EntersLike g c d e r v w) : e ∈ W.edges := by + have hvE : v ∉ e := fun hz => (he.2.1 hz).2 (hK.2.1.2.1 hv) + have hwE : w ∉ e := fun hz => (he.2.1 hz).2 hw.2 + have hvw : v ≠ w := fun h => region_subset hr (h.symm ▸ hw.1) (Γ.V_subset_U hv) + have hentry₀ := (entersLike_iff_tail_interval (hK.1.2 r hr) hw.1 hvE hwE hvw + hg hc₀.1.le hc₀.2 hgd hgr).mp hentry + exact trace_mem_edges_of_entry_in_image hS hK hE W hW hv hr hw he hg hc₀.2 hgd + (fun t ht => hgr t ⟨hc₀.1.trans ht.1, ht.2⟩) himage hentry₀ + +/-- Adding a closed set disjoint from drawing vertices to the curve +image creates no new trace entry edges. This applies to the region +chord in Case 2 of XII (2.1), page 244. -/ +theorem trace_mem_edges_of_entry_off_closed_set + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {φ : C(Circle, S)} {u : S} (W : GraphWalk K.toGraph u u) (hW : IsTrace Γ K φ W) + {L : Set S} (hL : IsClosed L) (hLV : Disjoint L Γ.V) + {v w : S} (hv : v ∈ Γ.V) {r e : Set S} (hr : r ∈ Γ.R) + (hw : w ∈ r ∩ K.V) (he : e ∈ K.E) + {g : ℝ → S} (hg : Continuous g) {c d : ℝ} (hcd : c < d) (hgd : g d = v) + (hgr : ∀ t ∈ Ioo c d, g t ∈ r) (himage : ∀ t ∈ Icc c d, g t ∈ range φ ∪ L) + (hentry : EntersLike g c d e r v w) : e ∈ W.edges := by + have hvL : v ∉ L := fun hz => disjoint_left.mp hLV hz hv + have hvφ : v ∈ range φ := (hgd ▸ himage d ⟨hcd.le, le_rfl⟩).resolve_right hvL + have hcover : Lᶜ ∩ (range φ ∪ L) ⊆ range φ := fun _ hz => hz.2.resolve_right hz.1 + obtain ⟨c₀, hc₀, hlocal⟩ := exists_terminal_interval_in_patch hg hcd hgd + (fun t ht => himage t ⟨ht.1.le, ht.2.le⟩) hL.isOpen_compl hvL hvφ hcover + exact trace_mem_edges_of_entry_locally_in_image hS hK hE W hW hv hr hw he + hg hc₀ hgd hgr hlocal hentry + +/-- The outgoing version of closed-set avoidance is the incoming +version for the reversed real interval. -/ +theorem trace_mem_edges_of_leaving_off_closed_set + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {φ : C(Circle, S)} {u : S} (W : GraphWalk K.toGraph u u) (hW : IsTrace Γ K φ W) + {L : Set S} (hL : IsClosed L) (hLV : Disjoint L Γ.V) + {v w : S} (hv : v ∈ Γ.V) {r e : Set S} (hr : r ∈ Γ.R) + (hw : w ∈ r ∩ K.V) (he : e ∈ K.E) + {g : ℝ → S} (hg : Continuous g) {c d : ℝ} (hcd : c < d) (hgc : g c = v) + (hgr : ∀ t ∈ Ioo c d, g t ∈ r) (himage : ∀ t ∈ Icc c d, g t ∈ range φ ∪ L) + (hleave : LeavesLike g c d e r v w) : e ∈ W.edges := by + apply trace_mem_edges_of_entry_off_closed_set hS hK hE W hW hL hLV hv hr hw he + (hg.comp continuous_neg) (neg_lt_neg hcd) + (by simpa only [Function.comp_apply, neg_neg] using hgc) _ _ hleave + · intro t ht + exact hgr (-t) ⟨by linarith [ht.2], by linarith [ht.1]⟩ + · intro t ht + exact himage (-t) ⟨by linarith [ht.2], by linarith [ht.1]⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2MinimalChord.lean b/LeanPool/GraphMinor/GM12/Section2MinimalChord.lean new file mode 100644 index 0000000000..09a2adf99b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2MinimalChord.lean @@ -0,0 +1,111 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2ChordGap +import LeanPool.GraphMinor.Surface.ArcInPath + +/-! +# A minimal line between components of a closed set in a region + +In Case 2 of XII (2.1), page 244, the intersection of the circle with +a region is not connected. Separate that relatively closed set into +two closed pieces, join points of those pieces through the region, +and select the gap between the last point of the first piece and the +first point of the second. Its ends belong to different components. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The minimal line required in Case 2 of XII (2.1), page 244, exists +in any path-connected region where the intersection with the closed +curve is disconnected. No finiteness of its components is needed. -/ +theorem exists_minimal_chord_between_components {S : Type*} [TopologicalSpace S] [T2Space S] + {r F : Set S} (hr : IsPathConnected r) (hF : IsClosed F) + (hdisconn : ¬ IsPreconnected (F ∩ r)) : + ∃ (L : Set S) (a b : S), IsLineWithEnds L a b ∧ L ⊆ r ∧ + a ∈ F ∩ r ∧ b ∈ F ∩ r ∧ Disjoint (L \ {a, b}) F ∧ + connectedComponentIn (F ∩ r) a ≠ connectedComponentIn (F ∩ r) b := by + classical + let A : Set r := (Subtype.val : r → S) ⁻¹' F + have hA : IsClosed A := hF.preimage continuous_subtype_val + have hnot : ¬ IsPreconnected A := by + intro hp + have hm := hp.image Subtype.val continuous_subtype_val.continuousOn + rw [Subtype.image_preimage_coe, inter_comm] at hm + exact hdisconn hm + rw [isPreconnected_closed_iff] at hnot + push Not at hnot + obtain ⟨U, V, hU, hV, hcover, hAU, hAV, hnone⟩ := hnot + let C := A ∩ U + let D := A ∩ V + have hC : IsClosed C := hA.inter hU + have hD : IsClosed D := hA.inter hV + have hCD : Disjoint C D := Set.disjoint_left.mpr fun z hzC hzD => by + have hm : z ∈ A ∩ (U ∩ V) := ⟨hzC.1, hzC.2, hzD.2⟩ + rw [hnone] at hm + exact hm + obtain ⟨x, hx⟩ := hAU + obtain ⟨y, hy⟩ := hAV + have hxy : x ≠ y := fun h => Set.disjoint_left.mp hCD hx (h.symm ▸ hy) + have : PathConnectedSpace r := isPathConnected_iff_pathConnectedSpace.mp hr + let p := PathConnectedSpace.somePath x y + obtain ⟨g, hg, hgi, hg0, hg1, _⟩ := exists_arc_of_path p.continuous (by + rw [p.source, p.target] + exact hxy) + have h0 : g 0 ∈ C := by rw [hg0, p.source]; exact hx + have h1 : g 1 ∈ D := by rw [hg1, p.target]; exact hy + obtain ⟨s, t, hst, hsC, htD, hgap⟩ := exists_parameter_gap (hC.preimage hg) + (hD.preimage hg) hCD h0 h1 + let q : unitInterval → S := fun u => (g u).val + have hq : Continuous q := continuous_subtype_val.comp hg + have hqi : Function.Injective q := Subtype.val_injective.comp hgi + have hsF : q s ∈ F ∩ r := ⟨hsC.1, (g s).property⟩ + have htF : q t ∈ F ∩ r := ⟨htD.1, (g t).property⟩ + refine ⟨q '' Icc s t, q s, q t, isLine_piece hq hqi hst, ?_, hsF, htF, + Set.disjoint_left.mpr ?_, ?_⟩ + · rintro z ⟨u, _, rfl⟩ + exact (g u).property + · rintro z ⟨⟨u, hu, rfl⟩, hends⟩ huF + have hsu : s < u := lt_of_le_of_ne hu.1 (by + intro heq + exact hends (Or.inl (congrArg q heq.symm))) + have hut : u < t := lt_of_le_of_ne hu.2 (by + intro heq + exact hends (Or.inr (congrArg q heq))) + have huA : g u ∈ A := huF + rcases hcover huA with huU | huV + · exact hgap u ⟨hsu, hut⟩ (Or.inl ⟨huA, huU⟩) + · exact hgap u ⟨hsu, hut⟩ (Or.inr ⟨huA, huV⟩) + · intro heq + let K := connectedComponentIn (F ∩ r) (q s) + have hKsub : K ⊆ F ∩ r := connectedComponentIn_subset _ _ + have hKr : K ⊆ r := fun z hz => (hKsub hz).2 + have hpre : IsPreconnected ((Subtype.val : r → S) ⁻¹' K) := by + apply IsInducing.subtypeVal.isPreconnected_image.mp + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hKr] + exact isPreconnected_connectedComponentIn + have hKtoA : ∀ z : r, z.val ∈ K → z ∈ A := fun z hz => (hKsub hz).1 + have hKcov : (Subtype.val : r → S) ⁻¹' K ⊆ U ∪ V := fun z hz => hcover (hKtoA z hz) + have hsK : (g s).val ∈ K := mem_connectedComponentIn hsF + have htK : (g t).val ∈ K := by + change q t ∈ connectedComponentIn (F ∩ r) (q s) + rw [heq] + exact mem_connectedComponentIn htF + obtain ⟨z, hzK, hzU, hzV⟩ := isPreconnected_closed_iff.mp hpre U V hU hV hKcov + ⟨g s, hsK, hsC.2⟩ ⟨g t, htK, htD.2⟩ + have hm : z ∈ A ∩ (U ∩ V) := ⟨hKtoA z hzK, hzU, hzV⟩ + rw [hnone] at hm + exact hm + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2NonemptyEdges.lean b/LeanPool/GraphMinor/GM12/Section2NonemptyEdges.lean new file mode 100644 index 0000000000..9cb0d63fd8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2NonemptyEdges.lean @@ -0,0 +1,37 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Positive-length curves below a tangle order need a drawing edge + +The geometric trace lemmas use an edge of the original drawing. +In XII (2.1), a positive curve length below the tangle order makes +that order at least two. X (2.3) then excludes an edgeless graph: +three copies of any small side would already cover its edge set. +This separates the geometric argument from the zero-length case. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Hypergraph GM10 + +/-- A tangle of order at least two lives in a hypergraph with an edge. +Apply X (2.3) to three copies of the empty small side. -/ +theorem edges_nonempty_of_tangle_order_two + {α β : Type*} {G : Hypergraph α β} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} + (hT : IsTangle G θ T) (hθ : 2 ≤ θ) : G.edgeSet.Nonempty := + GM10.IsTangle.edgeSet_nonempty_of_two_le hT hθ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2NormalEntry.lean b/LeanPool/GraphMinor/GM12/Section2NormalEntry.lean new file mode 100644 index 0000000000..e43ebd5670 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2NormalEntry.lean @@ -0,0 +1,54 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2EntryExistence +import LeanPool.GraphMinor.GM12.Section2SectorCover +import LeanPool.GraphMinor.GM12.Section2TerminalSectors + +/-! +# An entering edge for a normal approach at a vertex of degree at least two + +For the omitted entry lemma on XII page 243, a normal approach stays in +one sector near its endpoint. Normalize the approach in reverse, use +the closed sector cover and connectedness to choose the sector, then +apply the entry-edge existence theorem for that sector. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The entry edge exists at a vertex with at least two half-edges. +This proves that case of the omitted assertion in XII's trace definition, +page 243, directly from a normal approach and radial maximality. -/ +theorem exists_entersLike_of_two_halfEdges {S : Type*} [TopologicalSpace S] + [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {Γ K : Drawing S} (hrad : PreRad (.drawing Γ) K) + (hmax : RadMax (.drawing Γ) K) (hE : Γ.E.Nonempty) + {γ : Set S → unitInterval → S} (hγ : EdgePar Γ γ) + {v : S} (hv : v ∈ Γ.V) (h2 : 2 ≤ Nat.card (halfEdges Γ γ v)) + {r : Set S} (hr : r ∈ Γ.R) {w : S} (hw : w ∈ r) (hwV : w ∈ K.V) + {f : ℝ → S} (hf : Continuous f) {a c : ℝ} (hac : a < c) (hfc : f c = v) + (hinside : ∀ t ∈ Ioo a c, f t ∈ r) : + ∃ e ∈ K.E, EntersLike f a c e r v w := by + obtain ⟨next, ρ, P, W, Q, τ, hsec, hcover⟩ := + exists_sectors_with_cover hS Γ hγ hv h2 + obtain ⟨k, h, hh, hlocal⟩ := exists_terminal_sector_of_approach hsec hcover hf hac hfc + (fun t ht => region_subset hr (hinside t ht)) + have hρr : ρ k = r := region_eq_of_mem (hsec.corners.region k) hr + (hlocal h ⟨le_rfl, hh.2⟩).1 (hinside h hh) + have hwρ : w ∈ ρ k := hρr.symm ▸ hw + obtain ⟨e, he, hentry⟩ := exists_entersLike_of_sector hS hrad hmax hE hv hsec hcover k hwρ hwV + hh hf.continuousOn hfc hlocal + exact ⟨e, he, hρr ▸ hentry⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2NormalEntryExistence.lean b/LeanPool/GraphMinor/GM12/Section2NormalEntryExistence.lean new file mode 100644 index 0000000000..36f9a51dda --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2NormalEntryExistence.lean @@ -0,0 +1,72 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2NormalEntry +public import LeanPool.GraphMinor.GM12.Section2LeafEntryExistence + +/-! +# Entry and exit edges for every normal approach + +The omitted assertion in the trace definition on XII page 243 holds +at every vertex of a nondegenerate 2-cell drawing. Such a vertex has +an incident edge. If it has two or more half-edges, use its entering +sector. Otherwise it has exactly one half-edge and the proved leaf +patch applies. Reversing the real parameter gives the exit assertion. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- Every continuous approach through one region has an entering +radial edge. This proves existence in the omitted lemma on XII page 243, +including the leaf case. -/ +theorem exists_entersLike + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} (hrad : PreRad (.drawing Γ) K) + (hmax : RadMax (.drawing Γ) K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r : Set S} (hr : r ∈ Γ.R) + {w : S} (hw : w ∈ r) (hwV : w ∈ K.V) + {f : ℝ → S} (hf : Continuous f) {a c : ℝ} (hac : a < c) (hfc : f c = v) + (hinside : ∀ t ∈ Ioo a c, f t ∈ r) : + ∃ e ∈ K.E, EntersLike f a c e r v w := by + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + by_cases h2 : 2 ≤ Nat.card (halfEdges Γ γ v) + · exact exists_entersLike_of_two_halfEdges hS hrad hmax hE hγ hv h2 hr hw hwV hf hac hfc hinside + · obtain ⟨e, he, hvcl⟩ := exists_edge_at hrad hS hE hv + obtain ⟨b, hb⟩ := exists_end_eq hγ he hv hvcl + let : Finite (halfEdges Γ γ v) := (finite_halfEdges Γ γ v).to_subtype + let : Nonempty (halfEdges Γ γ v) := ⟨⟨(e, b), he, hb⟩⟩ + have hpos : 0 < Nat.card (halfEdges Γ γ v) := Nat.card_pos + have hcard : Nat.card (halfEdges Γ γ v) = 1 := by omega + exact exists_entersLike_of_one_halfEdge hS hrad hmax hE hγ hv hcard hr hw hwV hf hac hfc hinside + +/-- Reversing the real parameter gives the leaving edge in the +omitted trace-definition lemma of XII, page 243. -/ +theorem exists_leavesLike + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} (hrad : PreRad (.drawing Γ) K) + (hmax : RadMax (.drawing Γ) K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r : Set S} (hr : r ∈ Γ.R) + {w : S} (hw : w ∈ r) (hwV : w ∈ K.V) + {f : ℝ → S} (hf : Continuous f) {a c : ℝ} (hac : a < c) (hfa : f a = v) + (hinside : ∀ t ∈ Ioo a c, f t ∈ r) : + ∃ e ∈ K.E, LeavesLike f a c e r v w := by + change ∃ e ∈ K.E, EntersLike (fun t => f (-t)) (-c) (-a) e r v w + apply exists_entersLike hS hrad hmax hE hv hr hw hwV + (hf.comp continuous_neg) (by linarith : -c < -a) + · simpa only [Function.comp_apply, neg_neg] using hfa + · intro t ht + apply hinside + constructor <;> linarith [ht.1, ht.2] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2NormalNoncover.lean b/LeanPool/GraphMinor/GM12/Section2NormalNoncover.lean new file mode 100644 index 0000000000..3ffad96b33 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2NormalNoncover.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section6 + +/-! +# Three small sides bounded by normal curves cannot cover the surface + +Case 2 of XII (2.1), page 244, applies the second tangle axiom to the +three discs of a theta graph. Normality puts each graph edge wholly +inside or outside every disc. A cover of the surface would therefore +make the three small sides cover the entire graph, contradicting that +axiom. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +variable {S : Type*} [TopologicalSpace S] {Γ : PaintingOrDrawing S} + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + +/-- An edge lies wholly inside or outside a closed set with normal +frontier, because it is connected and misses the frontier. -/ +theorem edge_subset_or_disjoint_of_normal_frontier {Δ : Set S} (hΔ : IsClosed Δ) + (hb : Γ.IsNormal (frontier Δ)) {e : Set S} (he : e ∈ Γ.E) : + e ⊆ Δ ∨ Disjoint e Δ := + GM11.edge_subset_or_disjoint_of_normal_frontier hΔ hb he + +/-- The second tangle axiom excludes three small closed sides with +normal frontiers covering the surface. This is the non-cover step in +Case 2 of XII (2.1), page 244. -/ +theorem not_support_subset_of_normal_frontiers (hT : IsPretangle Γ.toHypergraph θ T) + {Δ₁ Δ₂ Δ₃ : Set S} (c₁ : IsClosed Δ₁) (c₂ : IsClosed Δ₂) (c₃ : IsClosed Δ₃) + (b₁ : Γ.IsNormal (frontier Δ₁)) (b₂ : Γ.IsNormal (frontier Δ₂)) (b₃ : Γ.IsNormal (frontier Δ₃)) + (m₁ : (Γ.inter Δ₁, Γ.interOutside Δ₁) ∈ T) (m₂ : (Γ.inter Δ₂, Γ.interOutside Δ₂) ∈ T) + (m₃ : (Γ.inter Δ₃, Γ.interOutside Δ₃) ∈ T) (hcov : Γ.U ⊆ Δ₁ ∪ Δ₂ ∪ Δ₃) : False := + GM11.not_support_subset_of_normal_frontiers hT c₁ c₂ c₃ b₁ b₂ b₃ m₁ m₂ m₃ hcov + +/-- Three small closed sides with normal frontiers cannot cover the +surface. This is the non-cover step in XII (2.1), Case 2, page 244. -/ +theorem not_cover_of_normal_frontiers (hT : IsPretangle Γ.toHypergraph θ T) + {Δ₁ Δ₂ Δ₃ : Set S} (c₁ : IsClosed Δ₁) (c₂ : IsClosed Δ₂) (c₃ : IsClosed Δ₃) + (b₁ : Γ.IsNormal (frontier Δ₁)) (b₂ : Γ.IsNormal (frontier Δ₂)) (b₃ : Γ.IsNormal (frontier Δ₃)) + (m₁ : (Γ.inter Δ₁, Γ.interOutside Δ₁) ∈ T) (m₂ : (Γ.inter Δ₂, Γ.interOutside Δ₂) ∈ T) + (m₃ : (Γ.inter Δ₃, Γ.interOutside Δ₃) ∈ T) (hcov : Δ₁ ∪ Δ₂ ∪ Δ₃ = univ) : False := by + apply not_support_subset_of_normal_frontiers hT c₁ c₂ c₃ b₁ b₂ b₃ m₁ m₂ m₃ + rw [hcov] + exact subset_univ _ + +/-- Two small sides bounded by normal frontiers leave a point of the +original drawing outside both. This supplies the common outside point +in the deformation comparison of XII (2.1), Case 1, page 244. -/ +theorem exists_support_point_outside_two_small_sides + (hT : IsPretangle Γ.toHypergraph θ T) + {D E : Set S} (hD : IsClosed D) (hE : IsClosed E) + (hnD : Γ.IsNormal (frontier D)) (hnE : Γ.IsNormal (frontier E)) + (hmD : (Γ.inter D, Γ.interOutside D) ∈ T) + (hmE : (Γ.inter E, Γ.interOutside E) ∈ T) : + ∃ q ∈ Γ.U, q ∉ D ∧ q ∉ E := by + have hnot : ¬ Γ.U ⊆ D ∪ E := by + intro hsub + apply not_support_subset_of_normal_frontiers hT hD hE hE hnD hnE hnE hmD hmE hmE + intro x hx + exact Or.inl (hsub hx) + obtain ⟨q, hq, hqnot⟩ := Set.not_subset.mp hnot + exact ⟨q, hq, fun h => hqnot (Or.inl h), fun h => hqnot (Or.inr h)⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2PartitionDeformation.lean b/LeanPool/GraphMinor/GM12/Section2PartitionDeformation.lean new file mode 100644 index 0000000000..969b63cbd2 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2PartitionDeformation.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2SingleVisitDeformation +public import LeanPool.GraphMinor.GM12.Section2CyclicDeformation +public import LeanPool.GraphMinor.GM12.Section2CyclicHitParameters +import LeanPool.GraphMinor.GM12.Section2TracePartitionCarrier +import LeanPool.GraphMinor.GM12.Section2PeriodicHits +import LeanPool.GraphMinor.GM11.RadialRegions + +/-! +# Assembling the actual trace deformation + +For XII (2.1), Case 1, page 244, apply the single-visit deformation +to every real interval of the trace subdivision. The endpoints match +cyclically. Glue the homotopies, and assemble the two-edge walks while +retaining their point sets. The resulting closed curve has exactly +the point set of the resulting trace walk. Each piece is injective +on its half-open interval or is a backtracking line at one vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM07 + +/-- The finite assembly of the deformation used in XII (2.1), Case 1. +It retains the real trace steps, exact point set, endpoint and region +data, and the simplicity or backtracking alternative of every piece. -/ +theorem exists_partition_trace_deformation + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {φ : C(Circle, S)} {Z : Set S} (hφZ : range φ ⊆ Z) + {n : ℕ} (hn : 0 < n) (t : Fin (n + 1) → ℝ) (ht : StrictMono t) + (hperiod : t (Fin.last n) = t 0 + 1) (hΓ : ∀ i, periodicCurve φ (t i) ∈ Γ.V) + (r : Fin n → Set S) (hr : ∀ i, r i ∈ Γ.R) (hrZ : ∀ i, r i ⊆ Z) + (hfr : ∀ i s, s ∈ Ioo (t i.castSucc) (t i.succ) → periodicCurve φ s ∈ r i) : + ∃ (δ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i, δ i 1 = δ (finNext hn i) 0) + (W : GraphWalk K.toGraph (periodicCurve φ (t 0)) (periodicCurve φ (t 0))), + TraceSteps Γ K (periodicCurve φ) (t 0) (t 0 + 1) W ∧ W.length = 2 * n ∧ + range (concatLoop hn δ hmatch) = (walkDrawing K W).U ∧ + ClosedCurvesHomotopicIn Z φ (concatLoop hn δ hmatch) ∧ + (∀ i, δ i 0 = periodicCurve φ (t i.castSucc)) ∧ + (∀ i, δ i 1 = periodicCurve φ (t i.succ)) ∧ + (∀ i s, 0 < s.val → s.val < 1 → δ i s ∈ r i) ∧ + ∀ i, InjOn (δ i) (Ico (0 : unitInterval) 1) ∨ + (periodicCurve φ (t i.castSucc) = periodicCurve φ (t i.succ) ∧ + ∃ L : Set S, IsLine L ∧ range (δ i) = L ∧ L ⊆ r i ∪ {periodicCurve φ (t i.castSucc)}) + := by + let γ : Fin n → C(unitInterval, S) := fun i => + ⟨fun s => periodicCurve φ (t i.castSucc + s.val * (t i.succ - t i.castSucc)), + (periodicCurve_continuous φ).comp (by fun_prop)⟩ + have hγ : ∀ i s, γ i s = periodicCurve φ (t i.castSucc + s.val * (t i.succ - t i.castSucc)) + := fun _ _ => rfl + have hγZ : ∀ i, range (γ i) ⊆ Z := by + rintro i x ⟨s, rfl⟩ + exact hφZ (mem_range_self _) + have hvisit : ∀ i : Fin n, + ∃ (δ : C(unitInterval, S)) + (W : GraphWalk K.toGraph (periodicCurve φ (t i.castSucc)) (periodicCurve φ (t i.succ))), + TraceSteps Γ K (periodicCurve φ) (t i.castSucc) (t i.succ) W ∧ + W.length = 2 ∧ range δ = (walkDrawing K W).U ∧ CurvesHomotopicIn Z (γ i) δ ∧ + δ 0 = periodicCurve φ (t i.castSucc) ∧ δ 1 = periodicCurve φ (t i.succ) ∧ + (∀ s, 0 < s.val → s.val < 1 → δ s ∈ r i) ∧ + (InjOn δ (Ico (0 : unitInterval) 1) ∨ + (periodicCurve φ (t i.castSucc) = periodicCurve φ (t i.succ) ∧ + ∃ L : Set S, IsLine L ∧ range δ = L ∧ L ⊆ r i ∪ {periodicCurve φ (t i.castSucc)})) := by + intro i + exact exists_single_visit_deformation hS hK hE (periodicCurve_continuous φ) + (ht i.castSucc_lt_succ) (hΓ _) (hΓ _) (hr i) (hrZ i) (hfr i) (γ i) (hγ i) (hγZ i) + choose δ Wi htrace hlen hcarrier hrel hδ0 hδ1 hδr halt using hvisit + have hmatch : ∀ i, δ i 1 = δ (finNext hn i) 0 := by + intro i + exact (hδ1 i).trans ((periodic_value_succ_eq_next (periodicCurve_periodic φ) hn t hperiod + i).trans + (hδ0 (finNext hn i)).symm) + have hγmatch : ∀ i, γ i 1 = γ (finNext hn i) 0 := by + intro i + simp only [hγ, Icc.coe_one, one_mul, add_sub_cancel, Icc.coe_zero, zero_mul, add_zero] + exact periodic_value_succ_eq_next (periodicCurve_periodic φ) hn t hperiod i + have hh := closedCurve_homotopic_to_deformed_real_pieces hφZ hn + (fun i => t i.castSucc) (fun i => t i.succ) + (cyclic_step_of_period_endpoints hn t hperiod) γ δ hγ hγmatch hmatch hrel + have hassembly := exists_traceSteps_of_partition_with_carrier t hΓ + (fun i => radial_V (show PreRad (.drawing Γ) K from ⟨hK.1, hK.2.1⟩) (hΓ i)) + (fun i => range (δ i)) (fun i => ⟨Wi i, htrace i, hlen i, (hcarrier i).symm⟩) + rw [hperiod, periodicCurve_periodic φ (t 0)] at hassembly + obtain ⟨W, hW, hWlen, hWU⟩ := hassembly + have hstart : periodicCurve φ (t 0) ∈ ⋃ i, range (δ i) := by + let i : Fin n := ⟨0, hn⟩ + exact mem_iUnion.mpr ⟨i, 0, hδ0 i⟩ + have hWU' : (walkDrawing K W).U = ⋃ i, range (δ i) := + hWU.trans (union_eq_right.mpr (singleton_subset_iff.mpr hstart)) + exact ⟨δ, hmatch, W, hW, hWlen, (range_concatLoop hn δ hmatch).trans hWU'.symm, + hh, hδ0, hδ1, hδr, halt⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2PatchEntersLike.lean b/LeanPool/GraphMinor/GM12/Section2PatchEntersLike.lean new file mode 100644 index 0000000000..f642c267ac --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2PatchEntersLike.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2EntryWitness +public import LeanPool.GraphMinor.GM12.Section2PatchEntryComparison +import LeanPool.GraphMinor.GM12.Section2SpokePaths +import LeanPool.GraphMinor.GM12.Section2EntryPaths + +/-! +# The exact entry witness from a normal patch + +For the omitted entry lemma of XII, page 243, normalize a terminal +real interval of the approaching curve to a path. Compare that path +with the supplied spoke inside the normal patch. The shortened +parameter interval is again affine, so the comparison supplies exactly +the entry curve and region homotopy in `EntersLike`. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A simply connected normal patch turns a spoke through its region +into an `EntersLike` witness for any continuous approach in that region. -/ +theorem entersLike_of_normal_patch + {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} {r N X : Set S} (hr : r ∈ Γ.R) {v w : S} + (hv : v ∈ Γ.V) (hw : w ∈ r) + (hN : IsOpen N) (hvN : v ∈ N) (hvX : v ∈ X) + (hX : IsSimplyConnectedSet X) (hpuncture : IsPathConnected (X \ {v})) + (hXZ : X ⊆ r ∪ {v}) (hcover : N \ Γ.U ⊆ X) + (β : Path v w) (hβi : Function.Injective β) {e : Set S} + (hβe : β '' Ioo (0 : unitInterval) 1 = e) (hβr : ∀ t, 0 < t → β t ∈ r) + {f : ℝ → S} (hf : Continuous f) {a c : ℝ} (hac : a < c) (hfc : f c = v) + (hinside : ∀ t ∈ Ioo a c, f t ∈ r) : EntersLike f a c e r v w := by + let h₀ := (a + c) / 2 + have hh₀ : h₀ ∈ Ioo a c := ⟨by dsimp [h₀]; linarith, by dsimp [h₀]; linarith⟩ + obtain ⟨F, hFval, hF⟩ := exists_affine_approach_path hh₀.2 hf.continuousOn hfc + (fun t ht => hinside t ⟨hh₀.1.trans_le ht.1, ht.2⟩) + obtain ⟨q₀, hq₀⟩ := exists_path_in_region_vertex hw β hβr + let q := q₀.cast F.target rfl + have hq : ∀ t, (q t).val = β t := hq₀ + obtain ⟨t, ht, ρ, hρ, hhom⟩ := entry_comparison_from_normal_patch hr hv hN hvN hvX + hX hpuncture hXZ hcover F q hF (fun t ht => hq t ▸ hβr t ht) + let h := h₀ + t.val * (c - h₀) + have htime := affine_approach_parameter_mem_Ico hh₀.2 ht + have hh : h ∈ Ioo a c := ⟨hh₀.1.trans_le htime.1, htime.2⟩ + have hp : ∀ s : unitInterval, ((F.subpath t 1) s).val = f (h + s.val * (c - h)) := + affine_approach_subpath_apply F hFval t + have hqi : Function.Injective (fun t => (q t).val) := by + intro s t he + change (q s).val = (q t).val at he + rw [hq, hq] at he + exact hβi he + have hqe : (fun t => (q t).val) '' Ioo (0 : unitInterval) 1 = e := by + rw [show (fun t => (q t).val) = β from funext hq] + exact hβe + exact entersLike_of_path_comparison hh rfl (F.subpath t 1) q ρ hp hqi hqe hρ hhom + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2PatchEntryComparison.lean b/LeanPool/GraphMinor/GM12/Section2PatchEntryComparison.lean new file mode 100644 index 0000000000..38afb3d24f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2PatchEntryComparison.lean @@ -0,0 +1,110 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2EntryPatch +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# Comparing entries inside a normal patch + +For the omitted entry lemma on XII page 243, shorten the approaching +path until it lies in the patch. Shorten the beginning of a spoke in +the same way. Both pieces lie in the simply connected patch and have +ends in its path-connected puncture. Replace their concatenation by +a path in that puncture, then append the rest of the spoke in the +region. This gives the entry comparison without a sector assumption. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 unitInterval + +/-- A normal patch at a vertex compares any incoming region path +with any spoke leaving through that region, after shortening the +incoming path. -/ +theorem entry_comparison_from_normal_patch + {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} {r N X : Set S} (hr : r ∈ Γ.R) {v : S} + (hv : v ∈ Γ.V) (hN : IsOpen N) (hvN : v ∈ N) (hvX : v ∈ X) + (hX : IsSimplyConnectedSet X) (hpuncture : IsPathConnected (X \ {v})) + (hXZ : X ⊆ r ∪ {v}) (hcover : N \ Γ.U ⊆ X) + {a : (r ∪ {v} : Set S)} {b : (r ∪ {v} : Set S)} + (F : Path a (⟨v, Or.inr rfl⟩ : (r ∪ {v} : Set S))) (β : Path (F 1) b) + (hF : ∀ t, t < 1 → (F t).val ∈ r) + (hβ : ∀ t, 0 < t → (β t).val ∈ r) : + ∃ t : I, t < 1 ∧ ∃ ρ : Path (F t) b, + (∀ s, (ρ s).val ∈ r) ∧ ((F.subpath t 1).trans β).Homotopic ρ := by + have hvr : v ∉ r := fun h => region_subset hr h (Γ.V_subset_U hv) + have hF1 : (F 1).val = v := congrArg Subtype.val F.target + obtain ⟨δ, hδ, _, hδN⟩ := exists_pos_le + (continuous_subtype_val.comp F.symm.continuous) hN + (by simpa only [Function.comp_apply, Path.symm_apply, symm_zero, hF1] using hvN) + (show (0 : I) < 1 from zero_lt_one) + let t : I := σ δ + have ht : t < 1 := by change (1 - δ.val : ℝ) < 1; exact sub_lt_self _ hδ + have hterminal : ∀ u : I, t ≤ u → (F u).val ∈ N := by + intro u htu + have hback : σ u ≤ δ := by + change 1 - u.val ≤ δ.val + have htu' : 1 - δ.val ≤ u.val := htu + linarith + have hm := hδN (σ u) hback + simpa only [Function.comp_apply, Path.symm_apply, symm_symm] using hm + have hpX : ∀ s : I, ((F.subpath t 1) s).val ∈ X := by + intro s + let u := Icc.convexComb t 1 s + change (F u).val ∈ X + by_cases hu : u = 1 + · rw [hu, hF1] + exact hvX + · exact hcover ⟨hterminal u (Icc.le_convexComb (le_one t) s), + region_subset hr (hF u (lt_of_le_of_ne u.property.2 hu))⟩ + have haX : (F t).val ∈ X \ {(F 1).val} := by + refine ⟨?_, ?_⟩ + · exact (congrArg Subtype.val (F.subpath t 1).source) ▸ hpX 0 + · intro he + have hm := hF t ht + rw [mem_singleton_iff.mp he, hF1] at hm + exact hvr hm + obtain ⟨s, hs, _, hsN⟩ := exists_pos_le + (continuous_subtype_val.comp β.continuous) hN + (by change (β 0).val ∈ N; rw [β.source, hF1]; exact hvN) + (show (0 : I) < 1 from zero_lt_one) + have hβX : ∀ u : I, u ≤ s → (β u).val ∈ X := by + intro u hus + by_cases hu : u = 0 + · rw [hu, β.source, hF1] + exact hvX + · exact hcover ⟨hsN u hus, region_subset hr (hβ u (pos_iff_ne_zero.mpr hu))⟩ + have hsX : (β s).val ∈ X \ {(F 1).val} := by + refine ⟨hβX s le_rfl, ?_⟩ + intro he + have hm := hβ s hs + rw [mem_singleton_iff.mp he, hF1] at hm + exact hvr hm + have hprefix : ∀ u : I, ((β.subpath 0 s) u).val ∈ X := + fun u => hβX _ (Icc.convexComb_le (nonneg s) u) + have htail : ∀ u : I, ((β.subpath s 1) u).val ∈ r := + fun u => hβ _ (hs.trans_le (Icc.le_convexComb (le_one s) u)) + have hpuncture' : IsPathConnected (X \ {(F 1).val}) := by rwa [hF1] + have hXR : ∀ z : (r ∪ {v} : Set S), z.val ∈ X \ {(F 1).val} → z.val ∈ r := by + intro z hz + rcases hXZ hz.1 with hzr | hzv + · exact hzr + · exact (hz.2 (hF1.symm ▸ hzv)).elim + obtain ⟨ρ, hρ, hhom⟩ := entry_homotopy_of_ambient_patch (R := Subtype.val ⁻¹' r) + hX hXZ hpuncture' hXR + (F.subpath t 1) β hpX haX s hsX hprefix htail + exact ⟨t, ht, ρ, hρ, hhom⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2PathHomotopy.lean b/LeanPool/GraphMinor/GM12/Section2PathHomotopy.lean new file mode 100644 index 0000000000..33ab337e71 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2PathHomotopy.lean @@ -0,0 +1,236 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import Mathlib.Topology.Homotopy.Path +import LeanPool.GraphMinor.GM11.Section3 +import Mathlib.AlgebraicTopology.FundamentalGroupoid.Basic +public import Mathlib.Topology.Subpath + +/-! +# Cancelling the approach to an entry vertex + +For XII's entry-edge definition, page 243, entry curves follow a common +approach to the vertex and then a radial spoke. A homotopy of the entry +curves therefore gives a homotopy of the spokes after cancelling the +common approach. The lemmas here also let the approach start at different +points: its earlier part stays in the open-disc region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- The paper's relative-endpoint curve homotopy agrees with a path +homotopy in the subspace containing its image. -/ +theorem paths_homotopic_of_curvesHomotopicIn {S : Type*} [TopologicalSpace S] + {Z : Set S} {x y : Z} (p q : Path x y) + (h : CurvesHomotopicIn Z + ⟨fun t => (p t).val, continuous_subtype_val.comp p.continuous⟩ + ⟨fun t => (q t).val, continuous_subtype_val.comp q.continuous⟩) : p.Homotopic q := by + obtain ⟨H, hZ, h0, h1, hleft, _, hright, _⟩ := h + refine ⟨{ + toFun := fun z => ⟨H (z.2, z.1), hZ (z.2, z.1)⟩ + continuous_toFun := (H.continuous.comp (continuous_snd.prodMk continuous_fst)).subtype_mk _ + map_zero_left := fun t => Subtype.ext (h0 t) + map_one_left := fun t => Subtype.ext (h1 t) + prop' := ?_ }⟩ + intro t s hs + rcases hs with rfl | hs + · exact Subtype.ext (hleft t) + · have hs1 : s = 1 := mem_singleton_iff.mp hs + subst s + exact Subtype.ext (hright t) + +/-- Read a subspace path homotopy as the paper's relative-endpoint +homotopy of ambient curves. -/ +theorem curvesHomotopicIn_of_paths_homotopic {S : Type*} [TopologicalSpace S] + {Z : Set S} {x y : Z} {p q : Path x y} (h : p.Homotopic q) : + CurvesHomotopicIn Z + ⟨fun t => (p t).val, continuous_subtype_val.comp p.continuous⟩ + ⟨fun t => (q t).val, continuous_subtype_val.comp q.continuous⟩ := by + obtain ⟨H⟩ := h + refine ⟨⟨fun z => (H (z.2, z.1)).val, + continuous_subtype_val.comp (H.continuous.comp (continuous_snd.prodMk continuous_fst))⟩, + fun z => (H (z.2, z.1)).property, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro t + exact congrArg Subtype.val (H.apply_zero t) + · intro t + exact congrArg Subtype.val (H.apply_one t) + · intro t + exact congrArg Subtype.val (H.eq_fst t (Or.inl rfl)) + · intro t + exact congrArg Subtype.val (H.eq_snd t (Or.inl rfl)) + · intro t + exact congrArg Subtype.val (H.eq_fst t (Or.inr (mem_singleton 1))) + · intro t + exact congrArg Subtype.val (H.eq_snd t (Or.inr (mem_singleton 1))) + +/-- Path homotopies can be cancelled on the left. The inverse approach +followed by the approach contracts, leaving the two terminal paths. -/ +theorem path_homotopic_cancel_left {X : Type*} [TopologicalSpace X] {a b c : X} + (r : Path a b) (p q : Path b c) (h : (r.trans p).Homotopic (r.trans q)) : + p.Homotopic q := by + have reduce : ∀ s : Path b c, (r.symm.trans (r.trans s)).Homotopic s := by + intro s + exact (Path.Homotopic.trans_assoc r.symm r s).symm.trans + (((Path.Homotopic.symm_trans r).hcomp (Path.Homotopic.refl s)).trans + (Path.Homotopic.refl_trans s)) + exact (reduce p).symm.trans (((Path.Homotopic.refl r.symm).hcomp h).trans (reduce q)) + +/-- Paths contained in a simply-connected subset with the same ends are +homotopic in the ambient space. Lift both paths to the subset first. -/ +theorem paths_homotopic_of_range_in_simplyConnected {X : Type*} [TopologicalSpace X] + {R : Set X} (hR : IsSimplyConnectedSet R) {x y : X} (p q : Path x y) + (hp : ∀ t, p t ∈ R) (hq : ∀ t, q t ∈ R) : p.Homotopic q := by + have hx : x ∈ R := p.source ▸ hp 0 + have hy : y ∈ R := p.target ▸ hp 1 + let pR : Path (⟨x, hx⟩ : R) ⟨y, hy⟩ := { + toFun := fun t => ⟨p t, hp t⟩ + continuous_toFun := p.continuous.subtype_mk _ + source' := Subtype.ext p.source + target' := Subtype.ext p.target } + let qR : Path (⟨x, hx⟩ : R) ⟨y, hy⟩ := { + toFun := fun t => ⟨q t, hq t⟩ + continuous_toFun := q.continuous.subtype_mk _ + source' := Subtype.ext q.source + target' := Subtype.ext q.target } + have h := (hR.pathsHomotopic pR qR).map (⟨Subtype.val, continuous_subtype_val⟩ : C(R, X)) + exact h + +/-- The normalized entry curves may start at different times along one +approach. If each is homotopic to a path in a simply-connected region, +their terminal spokes are homotopic. This is the common-approach step in +the omitted entry-edge uniqueness argument of XII, page 243. -/ +theorem terminal_paths_homotopic_of_entries {X : Type*} [TopologicalSpace X] + {R : Set X} (hR : IsSimplyConnectedSet R) {a b c : X} (F : Path a b) + (hF : ∀ t : unitInterval, t < 1 → F t ∈ R) + (p q : Path (F 1) c) {s t : unitInterval} (hs : s < 1) (ht : t < 1) + (ρ : Path (F s) c) (σ : Path (F t) c) + (hρ : ∀ u, ρ u ∈ R) (hσ : ∀ u, σ u ∈ R) + (hp : ((F.subpath s 1).trans p).Homotopic ρ) + (hq : ((F.subpath t 1).trans q).Homotopic σ) : p.Homotopic q := by + have prepend : ∀ (u : unitInterval) (r : Path (F 1) c) (τ : Path (F u) c), + ((F.subpath u 1).trans r).Homotopic τ → + ((F.subpath 0 1).trans r).Homotopic ((F.subpath 0 u).trans τ) := by + intro u r τ h + exact ((Path.Homotopic.subpath_trans_subpath F 0 u 1).hcomp + (Path.Homotopic.refl r)).symm.trans + ((Path.Homotopic.trans_assoc _ _ _).trans ((Path.Homotopic.refl _).hcomp h)) + have initial : ∀ (u : unitInterval), u < 1 → ∀ z, (F.subpath 0 u) z ∈ R := by + intro u hu z + apply hF + change Icc.convexComb 0 u z < 1 + apply lt_of_le_of_lt (show Icc.convexComb 0 u z ≤ u from ?_) hu + change (1 - (z : ℝ)) * 0 + z * u ≤ u + simp only [mul_zero, zero_add] + exact mul_le_of_le_one_left u.property.1 z.property.2 + have hleft := prepend s p ρ hp + have hright := prepend t q σ hq + have hmiddle : ((F.subpath 0 s).trans ρ).Homotopic ((F.subpath 0 t).trans σ) := by + apply paths_homotopic_of_range_in_simplyConnected hR + · intro z + rw [Path.trans_apply] + split_ifs + · exact initial s hs _ + · exact hρ _ + · intro z + rw [Path.trans_apply] + split_ifs + · exact initial t ht _ + · exact hσ _ + exact path_homotopic_cancel_left _ p q (hleft.trans (hmiddle.trans hright.symm)) + +/-- Split a path at one time and read the two pieces with their original +endpoints. The concatenation is homotopic to the original path. -/ +theorem split_path_homotopic {X : Type*} [TopologicalSpace X] {a b : X} + (P : Path a b) (s : unitInterval) (α : Path a (P s)) (β : Path (P s) b) + (hα : ∀ t, α t = (P.subpath 0 s) t) + (hβ : ∀ t, β t = (P.subpath s 1) t) : (α.trans β).Homotopic P := by + have h := (Path.Homotopic.subpath_trans_subpath P 0 s 1).pathCast + P.source.symm P.target.symm + have hleft : (((P.subpath 0 s).trans (P.subpath s 1)).cast + P.source.symm P.target.symm) = α.trans β := by + ext t + change ((P.subpath 0 s).trans (P.subpath s 1)) t = (α.trans β) t + simp only [Path.trans_apply] + split_ifs + · exact (hα _).symm + · exact (hβ _).symm + have hright : (P.subpath 0 1).cast P.source.symm P.target.symm = P := by + ext t + simp only [Path.subpath_zero_one, Path.cast_coe] + rw [hleft, hright] at h + exact h + +/-- An open disc contained in a larger set is also an open disc in that +subspace. Its parametrization is unchanged, with the extra membership +proof attached to each point. -/ +theorem openDisc_in_subspace {S : Type*} [TopologicalSpace S] {r Z : Set S} + (hr : IsOpenDisc r) (hsub : r ⊆ Z) : + IsOpenDisc ((Subtype.val : Z → S) ⁻¹' r) := by + let R : Set Z := (Subtype.val : Z → S) ⁻¹' r + let e : r ≃ₜ R := { + toFun := fun x => ⟨⟨x.val, hsub x.property⟩, x.property⟩ + invFun := fun x => ⟨x.val.val, x.property⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl + continuous_toFun := (continuous_subtype_val.subtype_mk _).subtype_mk _ + continuous_invFun := (continuous_subtype_val.comp continuous_subtype_val).subtype_mk _ } + refine ⟨hr.1.preimage continuous_subtype_val, ?_⟩ + obtain ⟨f⟩ := hr.2 + exact ⟨f.trans e⟩ + +/-- An entry comparison at one point of the approach gives a comparison +at every earlier or later point before the vertex. Extend both comparisons +to the start of the approach and cancel that initial segment. -/ +theorem terminal_entry_from_any_time {X : Type*} [TopologicalSpace X] + {R : Set X} (hR : IsSimplyConnectedSet R) {a b c : X} (F : Path a b) + (hF : ∀ u : unitInterval, u < 1 → F u ∈ R) (hc : c ∈ R) + (p : Path (F 1) c) {s t : unitInterval} (hs : s < 1) (ht : t < 1) + (ρ : Path (F s) c) (hρ : ∀ u, ρ u ∈ R) + (hp : ((F.subpath s 1).trans p).Homotopic ρ) : + ∃ σ : Path (F t) c, (∀ u, σ u ∈ R) ∧ + ((F.subpath t 1).trans p).Homotopic σ := by + obtain ⟨σ, hσ⟩ := hR.1.joinedIn (F t) (hF t ht) c hc + have initial : ∀ (u : unitInterval), u < 1 → ∀ z, (F.subpath 0 u) z ∈ R := by + intro u hu z + apply hF + change Icc.convexComb 0 u z < 1 + apply lt_of_le_of_lt (show Icc.convexComb 0 u z ≤ u from ?_) hu + change (1 - z.val) * 0 + z.val * u.val ≤ u.val + simp only [mul_zero, zero_add] + exact mul_le_of_le_one_left u.property.1 z.property.2 + have hfirst : ((F.subpath 0 1).trans p).Homotopic ((F.subpath 0 s).trans ρ) := + ((Path.Homotopic.subpath_trans_subpath F 0 s 1).hcomp + (Path.Homotopic.refl p)).symm.trans + ((Path.Homotopic.trans_assoc _ _ _).trans ((Path.Homotopic.refl _).hcomp hp)) + have hsecond : ((F.subpath 0 1).trans p).Homotopic + ((F.subpath 0 t).trans ((F.subpath t 1).trans p)) := + ((Path.Homotopic.subpath_trans_subpath F 0 t 1).hcomp + (Path.Homotopic.refl p)).symm.trans (Path.Homotopic.trans_assoc _ _ _) + have hmiddle : ((F.subpath 0 s).trans ρ).Homotopic ((F.subpath 0 t).trans σ) := by + apply paths_homotopic_of_range_in_simplyConnected hR + · intro z + rw [Path.trans_apply] + split_ifs + · exact initial s hs _ + · exact hρ _ + · intro z + rw [Path.trans_apply] + split_ifs + · exact initial t ht _ + · exact hσ _ + exact ⟨σ, hσ, path_homotopic_cancel_left _ _ _ + (hsecond.symm.trans (hfirst.trans hmiddle))⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2PeriodGermSelection.lean b/LeanPool/GraphMinor/GM12/Section2PeriodGermSelection.lean new file mode 100644 index 0000000000..1921e7d4fe --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2PeriodGermSelection.lean @@ -0,0 +1,113 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2ImageGermCover +public import Mathlib.Topology.Order.Basic +public import Mathlib.Topology.Instances.Real.Lemmas + +/-! +# Selecting a side of a parameter over an image limit + +For the restriction step of XII (2.1), pages 243--244, a subcurve +approaching a vertex through a corner makes that corner accumulate +in the original curve image. A closed parameter period is compact, +so this accumulation lifts to a parameter over the vertex. A nearby +parameter different from it lies on one of its two sides. This +selects one of the original incoming or outgoing region germs. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology + +/-- Lift image accumulation to a parameter in a prescribed compact +real interval. The lifted parameter is a limit of parameters whose +images lie in the chosen set. -/ +theorem exists_period_parameter_in_closure_preimage + {S : Type*} [TopologicalSpace S] [T2Space S] + {f : ℝ → S} (hf : Continuous f) {a b : ℝ} {v : S} {B : Set S} + (hv : v ∈ closure (f '' Icc a b ∩ B)) : + ∃ s ∈ Icc a b, f s = v ∧ s ∈ closure (Icc a b ∩ f ⁻¹' B) := by + let A := Icc a b + let : CompactSpace A := isCompact_iff_compactSpace.mp isCompact_Icc + let g : A → S := fun t => f t.val + have hg : Continuous g := hf.comp continuous_subtype_val + have hgrange : range g = f '' Icc a b := by + ext z + constructor + · rintro ⟨s, rfl⟩ + exact ⟨s.val, s.property, rfl⟩ + · rintro ⟨s, hs, rfl⟩ + exact ⟨⟨s, hs⟩, rfl⟩ + obtain ⟨s, hgs, hscl⟩ := exists_fibre_point_in_closure_preimage hg (hgrange.symm ▸ hv) + refine ⟨s.val, s.property, hgs, ?_⟩ + have hval := image_closure_subset_closure_image + (f := (Subtype.val : A → ℝ)) continuous_subtype_val ⟨s, hscl, rfl⟩ + apply closure_mono (t := Icc a b ∩ f ⁻¹' B) _ hval + rintro z ⟨t, ht, rfl⟩ + exact ⟨t.property, ht⟩ + +/-- Accumulation at a parameter whose image is outside `B` selects +a nearby parameter on one of its two sides. The side hypotheses +can be the two recorded sector germs of a trace. -/ +theorem exists_side_meeting_of_closure_preimage + {S : Type*} {f : ℝ → S} {C : Set ℝ} {B L R : Set S} + {s ε : ℝ} (hε : 0 < ε) (hfs : f s ∉ B) + (hs : s ∈ closure (C ∩ f ⁻¹' B)) + (hL : ∀ t ∈ C, t ∈ Ioo (s - ε) s → f t ∈ L) + (hR : ∀ t ∈ C, t ∈ Ioo s (s + ε) → f t ∈ R) : + (B ∩ L).Nonempty ∨ (B ∩ R).Nonempty := by + obtain ⟨t, htN, htC, htB⟩ := mem_closure_iff.mp hs (Ioo (s - ε) (s + ε)) + isOpen_Ioo ⟨by linarith, by linarith⟩ + have hts : t ≠ s := fun heq => hfs (heq ▸ htB) + rcases lt_or_gt_of_ne hts with hlt | hgt + · exact Or.inl ⟨f t, htB, hL t htC ⟨htN.1, hlt⟩⟩ + · exact Or.inr ⟨f t, htB, hR t htC ⟨hgt, htN.2⟩⟩ + +/-- Apply compact-period selection to a continuous approach whose +image lies in the original period and in a chosen corner. -/ +theorem exists_period_parameter_of_approach + {S : Type*} [TopologicalSpace S] [T2Space S] + {f g : ℝ → S} (hf : Continuous f) (hg : Continuous g) + {a b c d : ℝ} (hcd : c < d) {v : S} (hgd : g d = v) {B : Set S} + (himage : ∀ t ∈ Ioo c d, g t ∈ f '' Icc a b ∩ B) : + ∃ s ∈ Icc a b, f s = v ∧ s ∈ closure (Icc a b ∩ f ⁻¹' B) := by + apply exists_period_parameter_in_closure_preimage hf + have hd : d ∈ closure (Ioo c d) := by + rw [closure_Ioo hcd.ne] + exact ⟨hcd.le, le_rfl⟩ + rw [← hgd] + have hsub : g '' Ioo c d ⊆ f '' Icc a b ∩ B := by + rintro _ ⟨t, ht, rfl⟩ + exact himage t ht + exact closure_mono hsub (image_closure_subset_closure_image hg ⟨d, hd, rfl⟩) + +/-- When local sides lie in disjoint labelled corner sets, an +accumulating corner must be one of those two labels. -/ +theorem side_label_of_closure_preimage + {S ι : Type*} {f : ℝ → S} {C : Set ℝ} {Q : ι → Set S} + (hdis : Pairwise (fun i j => Disjoint (Q i) (Q j))) {i j k : ι} + {s ε : ℝ} (hε : 0 < ε) (hfs : f s ∉ Q k) + (hs : s ∈ closure (C ∩ f ⁻¹' Q k)) + (hL : ∀ t ∈ C, t ∈ Ioo (s - ε) s → f t ∈ Q i) + (hR : ∀ t ∈ C, t ∈ Ioo s (s + ε) → f t ∈ Q j) : k = i ∨ k = j := by + rcases exists_side_meeting_of_closure_preimage hε hfs hs hL hR with hleft | hright + · left + by_contra hki + obtain ⟨z, hzk, hzi⟩ := hleft + exact disjoint_left.mp (hdis hki) hzk hzi + · right + by_contra hkj + obtain ⟨z, hzk, hzj⟩ := hright + exact disjoint_left.mp (hdis hkj) hzk hzj + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2PeriodicHits.lean b/LeanPool/GraphMinor/GM12/Section2PeriodicHits.lean new file mode 100644 index 0000000000..d1efada909 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2PeriodicHits.lean @@ -0,0 +1,84 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM12.Section2CirclePeriod + +/-! +# Counting vertex hits in one real period + +The trace definition in XII, page 243, counts hits on the circle. +A half-open real period parametrizes the circle bijectively and hence +has the same number of hits. Starting a closed period at a hit adds +one further copy of that endpoint. This gives the number of intervals +used to construct the trace. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- The real extension of a closed curve is continuous. -/ +theorem periodicCurve_continuous {S : Type*} [TopologicalSpace S] (φ : C(Circle, S)) : + Continuous (periodicCurve φ) := by + exact φ.continuous.comp (Circle.exp.continuous.comp (by fun_prop)) + +/-- The real extension used in XII's trace definition has period one. -/ +theorem periodicCurve_periodic {S : Type*} [TopologicalSpace S] (φ : C(Circle, S)) : + Function.Periodic (periodicCurve φ) 1 := circle_parameter_periodic.comp φ + +/-- A half-open real period has the same finite number of hits as the +circle, namely the curve length of XII, page 243. -/ +theorem periodicCurve_halfopen_hits {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} {φ : C(Circle, S)} (hφ : IsNormalCurve Γ φ) (a : ℝ) : + {t | t ∈ Ico a (a + 1) ∧ periodicCurve φ t ∈ Γ.U}.Finite ∧ + {t | t ∈ Ico a (a + 1) ∧ periodicCurve φ t ∈ Γ.U}.ncard = curveLength Γ φ := by + let P : Set Circle := {z | φ z ∈ Γ.U} + let H : Set ℝ := {t | t ∈ Ico a (a + 1) ∧ periodicCurve φ t ∈ Γ.U} + let q : ℝ → Circle := fun t => Circle.exp (2 * Real.pi * t) + have hbij : BijOn q H P := by + refine ⟨fun t ht => ht.2, (circle_parameter_injOn a).mono (fun _ ht => ht.1), ?_⟩ + intro z hz + obtain ⟨t, ht, htz⟩ := (circle_parameter_bijOn a).surjOn (mem_univ z) + refine ⟨t, ⟨ht, ?_⟩, htz⟩ + change φ (q t) ∈ Γ.U + change q t = z at htz + rw [htz] + exact hz + exact ⟨hbij.finite_iff_finite.mpr hφ.1, hbij.ncard_eq⟩ + +/-- A closed period starting at a hit has one extra endpoint hit. Its +ordered hits therefore bound exactly `curveLength Γ φ` intervals. -/ +theorem periodicCurve_closed_hits {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} {φ : C(Circle, S)} (hφ : IsNormalCurve Γ φ) {a : ℝ} + (ha : periodicCurve φ a ∈ Γ.U) : + {t | t ∈ Icc a (a + 1) ∧ periodicCurve φ t ∈ Γ.U}.Finite ∧ + {t | t ∈ Icc a (a + 1) ∧ periodicCurve φ t ∈ Γ.U}.ncard = curveLength Γ φ + 1 := by + let H : Set ℝ := {t | t ∈ Ico a (a + 1) ∧ periodicCurve φ t ∈ Γ.U} + have hperiod : periodicCurve φ (a + 1) = periodicCurve φ a := periodicCurve_periodic φ a + have heq : {t | t ∈ Icc a (a + 1) ∧ periodicCurve φ t ∈ Γ.U} = insert (a + 1) H := by + ext t + constructor + · rintro ⟨ht, htU⟩ + by_cases he : t = a + 1 + · exact Or.inl he + · exact Or.inr ⟨⟨ht.1, lt_of_le_of_ne ht.2 he⟩, htU⟩ + · rintro (he | ht) + · subst t + exact ⟨⟨by linarith, le_rfl⟩, hperiod.symm ▸ ha⟩ + · exact ⟨⟨ht.1.1, ht.1.2.le⟩, ht.2⟩ + obtain ⟨hH, hcard⟩ := periodicCurve_halfopen_hits hφ a + rw [heq] + refine ⟨hH.insert _, ?_⟩ + rw [Set.ncard_insert_of_notMem (show a + 1 ∉ H from fun ht => ht.1.2.false) hH, hcard] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2RayChartPatch.lean b/LeanPool/GraphMinor/GM12/Section2RayChartPatch.lean new file mode 100644 index 0000000000..bbf8531e4a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2RayChartPatch.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2SlitBall +public import LeanPool.GraphMinor.GM12.Section2StarChart +import LeanPool.GraphMinor.Surface.Gluing + +/-! +# A simply connected patch beside the end of a ray + +For the leaf-entry patch on XII page 243, assume coordinates identify +the drawing with the positive real ray. Map a slit ball back to the +surface, keeping its tip. The ball's star contraction proves simple +connectedness, and the punctured slit ball stays path-connected. +The chart is open, so all sufficiently near points off the drawing +belong to this patch. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric Surface + +/-- Open injective coordinates identifying a closed-set germ with a +ray supply the required contractible slit patch at its endpoint. -/ +theorem exists_slit_patch_of_ray_chart + {S : Type*} [TopologicalSpace S] [T2Space S] + {O : Set ℂ} {K : ℂ → S} (hO : IsOpen O) (hK : ContinuousOn K O) (hi : InjOn K O) + (ho : ∀ W : Set ℂ, IsOpen W → W ⊆ O → IsOpen (K '' W)) + {q : ℂ} (hq : q ∈ O) (hqim : q.im = 0) {B : Set S} + (hB : ∀ z ∈ O, K z ∈ B ↔ z.im = 0 ∧ q.re ≤ z.re) : + ∃ N X : Set S, IsOpen N ∧ K q ∈ N ∧ K q ∈ X ∧ + IsSimplyConnectedSet X ∧ IsPathConnected (X \ {K q}) ∧ + X ⊆ Bᶜ ∪ {K q} ∧ N \ B ⊆ X := by + classical + obtain ⟨ε, hε, hεO⟩ := Metric.isOpen_iff.mp hO q hq + let δ := ε / 2 + have hδ : 0 < δ := half_pos hε + have hδle : δ < ε := by dsimp [δ]; linarith + have hclosed : closedBall q δ ⊆ O := (closedBall_subset_ball hδle).trans hεO + have hball : ball q δ ⊆ O := ball_subset_closedBall.trans hclosed + let A := ball q δ ∩ {z : ℂ | z.im ≠ 0 ∨ z.re ≤ q.re} + have hqA : q ∈ A := ⟨mem_ball_self hδ, Or.inr le_rfl⟩ + have hAO : A ⊆ O := inter_subset_left.trans hball + have hAclosed : A ⊆ closedBall q δ := inter_subset_left.trans ball_subset_closedBall + obtain ⟨k, hkc, hkinv⟩ := exists_inv_of_compactOn (isCompact_closedBall q δ) + (hK.mono hclosed) (hi.mono hclosed) + have hsimple : IsSimplyConnectedSet (K '' A) := image_starConvex_isSimplyConnected + (hK.mono hAO) (hkc.mono (image_mono hAclosed)) + (fun z hz => hkinv (hAclosed hz)) (starConvex_slit_ball_tip hqim hδ) hqA + have hpunct : (K '' A) \ {K q} = K '' (A \ {q}) := by + ext x + constructor + · rintro ⟨⟨z, hz, rfl⟩, hzne⟩ + exact ⟨z, ⟨hz, fun he => hzne (congrArg K he)⟩, rfl⟩ + · rintro ⟨z, ⟨hz, hzne⟩, rfl⟩ + refine ⟨⟨z, hz, rfl⟩, ?_⟩ + intro he + exact hzne (hi (hAO hz) hq he) + have hpath : IsPathConnected ((K '' A) \ {K q}) := by + rw [hpunct] + exact (isPathConnected_slit_ball_puncture hqim hδ).image' + (hK.mono (sdiff_subset.trans hAO)) + refine ⟨K '' ball q δ, K '' A, ho _ isOpen_ball hball, + mem_image_of_mem K (mem_ball_self hδ), mem_image_of_mem K hqA, hsimple, hpath, ?_, ?_⟩ + · rintro x ⟨z, hz, rfl⟩ + by_cases hzB : K z ∈ B + · have hray := (hB z (hAO hz)).mp hzB + have hzre : z.re = q.re := by + rcases hz.2 with hzim | hzre + · exact (hzim hray.1).elim + · exact le_antisymm hzre hray.2 + have hzq : z = q := Complex.ext hzre (hray.1.trans hqim.symm) + exact Or.inr (congrArg K hzq) + · exact Or.inl hzB + · rintro x ⟨⟨z, hzball, rfl⟩, hzB⟩ + refine ⟨z, ⟨hzball, ?_⟩, rfl⟩ + by_cases hzim : z.im = 0 + · right + have hn : ¬ q.re ≤ z.re := fun hle => hzB ((hB z (hball hzball)).mpr ⟨hzim, hle⟩) + exact (lt_of_not_ge hn).le + · exact Or.inl hzim + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2RegionComponents.lean b/LeanPool/GraphMinor/GM12/Section2RegionComponents.lean new file mode 100644 index 0000000000..b7a0411f90 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2RegionComponents.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2CurveCounts +import LeanPool.GraphMinor.GM11.Regions + +/-! +# Arcs between different visits to one region contain vertices + +Case 2 of XII (2.1), page 244, joins two different components of the +curve's intersection with a region. Each of the two arcs of the original +circle between the chord ends must contain a vertex. Otherwise that arc +would avoid the drawing, stay in the same region, and join the two +components inside their intersection. This supplies the strict length +reduction used by the induction. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A preconnected part of a normal set joining different components +of its intersection with a region contains a vertex of the drawing. +This is the reason both original arcs in XII (2.1), Case 2 contain +vertices. -/ +theorem vertices_nonempty_of_distinct_region_components {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} {r F A : Set S} (hr : r ∈ Γ.R) (hF : Γ.IsNormal F) + (hA : IsPreconnected A) (hAF : A ⊆ F) + {x y : S} (hxA : x ∈ A) (hyA : y ∈ A) (hxr : x ∈ r) + (hdiff : connectedComponentIn (F ∩ r) x ≠ connectedComponentIn (F ∩ r) y) : + (A ∩ Γ.V).Nonempty := by + by_contra hnone + have hoff : Disjoint A Γ.U := Set.disjoint_left.mpr fun z hz hzU => + hnone ⟨z, hz, hF ⟨hAF hz, hzU⟩⟩ + have hAr : A ⊆ r := subset_region hr hA hoff hxA hxr + have hsub : A ⊆ F ∩ r := fun _ hz => ⟨hAF hz, hAr hz⟩ + have hyCC := hA.subset_connectedComponentIn hxA hsub hyA + exact hdiff (connectedComponentIn_eq hyCC) + +/-- The two original arcs between chord ends in different region +components both contain vertices. -/ +theorem both_arcs_meet_vertices {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} {r F A B : Set S} {x y : S} + (hr : r ∈ Γ.R) (hF : Γ.IsNormal F) + (hA : IsLineWithEnds A x y) (hB : IsLineWithEnds B x y) + (hAF : A ⊆ F) (hBF : B ⊆ F) (hxr : x ∈ r) + (hdiff : connectedComponentIn (F ∩ r) x ≠ connectedComponentIn (F ∩ r) y) : + (A ∩ Γ.V).Nonempty ∧ (B ∩ Γ.V).Nonempty := by + have facts : ∀ {L : Set S}, IsLineWithEnds L x y → + IsPreconnected L ∧ x ∈ L ∧ y ∈ L := by + intro L hL + obtain ⟨f, hf0, hf1⟩ := hL + have hc : IsPreconnected L := by + have heq : (fun t => (f t).val) '' univ = L := by + ext z + constructor + · rintro ⟨t, _, rfl⟩; exact (f t).property + · intro hz + obtain ⟨t, ht⟩ := f.surjective ⟨z, hz⟩ + exact ⟨t, mem_univ _, congrArg Subtype.val ht⟩ + rw [← heq] + exact isPreconnected_univ.image _ (continuous_subtype_val.comp f.continuous).continuousOn + exact ⟨hc, hf0 ▸ (f 0).property, hf1 ▸ (f 1).property⟩ + obtain ⟨hAc, hxA, hyA⟩ := facts hA + obtain ⟨hBc, hxB, hyB⟩ := facts hB + exact ⟨vertices_nonempty_of_distinct_region_components hr hF hAc hAF hxA hyA hxr hdiff, + vertices_nonempty_of_distinct_region_components hr hF hBc hBF hxB hyB hxr hdiff⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2RegionIntervals.lean b/LeanPool/GraphMinor/GM12/Section2RegionIntervals.lean new file mode 100644 index 0000000000..3719228bea --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2RegionIntervals.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.Regions + +/-! +# The regions between consecutive vertex parameters + +In the trace definition of XII, page 243, each open interval between +consecutive hits of the drawing lies in one region. A strictly ordered +enumeration leaves no further hit between consecutive entries, and the +continuous image of that interval is preconnected and misses the drawing. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Consecutive entries of a strictly ordered enumeration of all hits +of a drawing bound an interval with no further hit. -/ +theorem no_hit_between_consecutive_parameters {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} {f : ℝ → S} {n : ℕ} (t : Fin (n + 1) → ℝ) (ht : StrictMono t) + (hcover : ∀ s ∈ Icc (t 0) (t (Fin.last n)), f s ∈ Γ.U → s ∈ range t) + (i : Fin n) : ∀ s ∈ Ioo (t i.castSucc) (t i.succ), f s ∉ Γ.U := by + intro s hs hsU + have hs0 : t 0 ≤ s := (ht.monotone (Fin.zero_le i.castSucc)).trans hs.1.le + have hsn : s ≤ t (Fin.last n) := hs.2.le.trans (ht.monotone (Fin.le_last i.succ)) + obtain ⟨j, hj⟩ := hcover s ⟨hs0, hsn⟩ hsU + have hij : i.castSucc < j := ht.lt_iff_lt.mp (hj.symm ▸ hs.1) + have hji : j < i.succ := ht.lt_iff_lt.mp (hj.symm ▸ hs.2) + have hij' : i.val < j.val := hij + have hji' : j.val < i.val + 1 := hji + omega + +/-- A continuous curve interval missing the drawing lies in one region. +This justifies the region assigned to each trace step in XII, page 243. -/ +theorem exists_region_of_open_interval {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} {f : ℝ → S} (hf : Continuous f) {a b : ℝ} (hab : a < b) + (hoff : ∀ t ∈ Ioo a b, f t ∉ Γ.U) : + ∃ r ∈ Γ.R, ∀ t ∈ Ioo a b, f t ∈ r := by + let m := (a + b) / 2 + have hm : m ∈ Ioo a b := ⟨by dsimp [m]; linarith, by dsimp [m]; linarith⟩ + obtain ⟨r, hr, hmr⟩ := exists_region_of_notMem (hoff m hm) + have hconn : IsPreconnected (f '' Ioo a b) := isPreconnected_Ioo.image f hf.continuousOn + have hdis : Disjoint (f '' Ioo a b) Γ.U := Set.disjoint_left.mpr fun z hz hzU => by + obtain ⟨t, ht, rfl⟩ := hz + exact hoff t ht hzU + have hsub := subset_region hr hconn hdis ⟨m, hm, rfl⟩ hmr + exact ⟨r, hr, fun t ht => hsub ⟨t, ht, rfl⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2RegionPathDeformation.lean b/LeanPool/GraphMinor/GM12/Section2RegionPathDeformation.lean new file mode 100644 index 0000000000..f0ff0b70d3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2RegionPathDeformation.lean @@ -0,0 +1,119 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2EntryAtPathInSubspace +public import LeanPool.GraphMinor.GM12.Section2RegionVisitHomotopy +import LeanPool.GraphMinor.Surface.Disc + +/-! +# Deforming a real region interval with fixed ends + +For XII (2.1), Case 1, page 244, split a region visit at its midpoint. +The entry and reversed exit comparisons start at that midpoint. +Read both in the region with both boundary vertices restored. The +single-visit path algebra replaces the visit by its two spokes while +fixing its ends. All spoke parameterizations retain their exact edge +closures and interiors. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- An actual real region interval deforms to the two spokes supplied +by its exit and entry conditions, inside any subspace containing the +region and its two ends. -/ +theorem region_path_homotopic_to_spokes + {S : Type*} [TopologicalSpace S] [T2Space S] + {r Z e e' : Set S} (hcell : IsOpenDisc r) {u v w : S} + (hrZ : r ⊆ Z) (huZ : u ∈ Z) (hvZ : v ∈ Z) (hw : w ∈ r) + (huE : u ∉ e) (hwE : w ∉ e) (huw : u ≠ w) + (hvE : v ∉ e') (hwE' : w ∉ e') (hvw : v ≠ w) + {f : ℝ → S} (hf : Continuous f) {a c : ℝ} (hac : a < c) + (hfa : f a = u) (hfc : f c = v) (hfr : ∀ t ∈ Ioo a c, f t ∈ r) + (hleave : LeavesLike f a c e r u w) (henter : EntersLike f a c e' r v w) + (P : Path (⟨u, huZ⟩ : Z) ⟨v, hvZ⟩) + (hP : ∀ t, (P t).val = f (a + t.val * (c - a))) : + ∃ (α : Path (⟨u, huZ⟩ : Z) ⟨w, hrZ hw⟩) + (β : Path (⟨v, hvZ⟩ : Z) ⟨w, hrZ hw⟩), + Function.Injective (fun t => (α t).val) ∧ Function.Injective (fun t => (β t).val) ∧ + range (fun t => (α t).val) = closure e ∧ range (fun t => (β t).val) = closure e' ∧ + (fun t => (α t).val) '' Ioo (0 : unitInterval) 1 = e ∧ + (fun t => (β t).val) '' Ioo (0 : unitInterval) 1 = e' ∧ + P.Homotopic (α.trans β.symm) := by + let half : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + let m := (a + c) / 2 + have hm : m ∈ Ioo a c := ⟨by dsimp [m]; linarith, by dsimp [m]; linarith⟩ + let L : Path (⟨u, huZ⟩ : Z) (P half) := (P.subpath 0 half).cast P.source.symm rfl + let F : Path (P half) (⟨v, hvZ⟩ : Z) := (P.subpath half 1).cast rfl P.target.symm + let G := L.symm + have hF : ∀ t, (F t).val = f (m + t.val * (c - m)) := by + intro t + change (P (Icc.convexComb half 1 t)).val = _ + rw [hP] + congr 1 + simp only [Icc.coe_convexComb, Icc.coe_one] + dsimp only [half, m] + ring + have hG : ∀ t, (G t).val = f (m + t.val * (a - m)) := by + intro t + change (P (Icc.convexComb 0 half (unitInterval.symm t))).val = _ + rw [hP] + congr 1 + simp only [Icc.coe_convexComb, Icc.coe_zero, mul_zero, zero_add] + change a + (1 - t.val) * (1 / 2) * (c - a) = _ + dsimp only [m] + ring + have hFsmall : ∀ t, (F t).val ∈ r ∪ {v} := by + intro t + by_cases ht : t = 1 + · subst t; rw [F.target]; exact Or.inr rfl + · left + rw [hF] + have ht1 : t.val < 1 := unitInterval.lt_one_iff_ne_one.mpr ht + apply hfr + constructor <;> nlinarith [t.property.1, hm.1, hm.2] + have hGsmall : ∀ t, (G t).val ∈ r ∪ {u} := by + intro t + by_cases ht : t = 1 + · subst t; rw [G.target]; exact Or.inr rfl + · left + rw [hG] + have ht1 : t.val < 1 := unitInterval.lt_one_iff_ne_one.mpr ht + apply hfr + constructor <;> nlinarith [t.property.1, hm.1, hm.2] + have hZr : r ∪ {v} ⊆ Z := union_subset hrZ (singleton_subset_iff.mpr hvZ) + have hZl : r ∪ {u} ⊆ Z := union_subset hrZ (singleton_subset_iff.mpr huZ) + obtain ⟨β, ρ, hβi, hβrange, hβe, hρ, hβhom⟩ := + entry_comparison_at_path_start_in_subspace hcell hw hZr hvE hwE' hvw hf hm + hfc hfr henter F hFsmall hF + have hfm : -m ∈ Ioo (-c) (-a) := ⟨neg_lt_neg hm.2, neg_lt_neg hm.1⟩ + have hGneg : ∀ t, (G t).val = (fun z => f (-z)) (-m + t.val * (-a - -m)) := by + intro t + rw [hG] + congr 1 + ring + obtain ⟨α, σ, hαi, hαrange, hαe, hσ, hαhom⟩ := + entry_comparison_at_path_start_in_subspace hcell hw hZl huE hwE huw + (hf.comp continuous_neg) hfm (by simpa only [Function.comp_apply, neg_neg] using hfa) + (fun t ht => hfr (-t) ⟨by linarith [ht.2], by linarith [ht.1]⟩) + hleave G hGsmall hGneg + have hR := openDisc_in_subspace hcell hrZ + have hvisit := region_visit_homotopic_to_spokes hR.isSimplyConnectedSet + G F α β σ ρ hσ hρ hαhom hβhom + have hsplit : (L.trans F).Homotopic P := + split_path_homotopic P half L F (fun _ => rfl) (fun _ => rfl) + have hGL : G.symm = L := Path.symm_symm L + rw [hGL] at hvisit + exact ⟨α, β, hαi, hβi, hαrange, hβrange, hαe, hβe, hsplit.symm.trans hvisit⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2RegionVisitHomotopy.lean b/LeanPool/GraphMinor/GM12/Section2RegionVisitHomotopy.lean new file mode 100644 index 0000000000..356c7d9a99 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2RegionVisitHomotopy.lean @@ -0,0 +1,56 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2PathHomotopy + +/-! +# Deforming one region visit to its two spokes + +In Case 1 of XII (2.1), page 244, cut a region visit at an interior +point. Reverse its first half so that both approaches start at that +point. The exit and entry comparisons continue these approaches +along their spokes to the region hub. Their comparison paths lie +in the simply connected region, so they are homotopic. Cancelling +the two approach halves leaves a homotopy from the original visit +to the two-spoke path, with both ends fixed. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The path algebra for the paper's deformation of a single region +visit. Both entry comparison paths are in one simply connected region, +so the original two halves deform to the two spokes through its hub. -/ +theorem region_visit_homotopic_to_spokes + {X : Type*} [TopologicalSpace X] {R : Set X} + (hR : IsSimplyConnectedSet R) {x u v w : X} + (G : Path x u) (F : Path x v) (β : Path u w) (α : Path v w) + (σ ρ : Path x w) (hσ : ∀ t, σ t ∈ R) (hρ : ∀ t, ρ t ∈ R) + (hleft : (G.trans β).Homotopic σ) (hright : (F.trans α).Homotopic ρ) : + (G.symm.trans F).Homotopic (β.trans α.symm) := by + have hσρ := paths_homotopic_of_range_in_simplyConnected hR σ ρ hσ hρ + have hentry : (G.trans β).Homotopic (F.trans α) := hleft.trans (hσρ.trans hright.symm) + have hcancel : (G.symm.trans (G.trans β)).Homotopic β := + (Path.Homotopic.trans_assoc G.symm G β).symm.trans + (((Path.Homotopic.symm_trans G).hcomp (Path.Homotopic.refl β)).trans + (Path.Homotopic.refl_trans β)) + have hβ : β.Homotopic ((G.symm.trans F).trans α) := + hcancel.symm.trans (((Path.Homotopic.refl G.symm).hcomp hentry).trans + (Path.Homotopic.trans_assoc G.symm F α).symm) + have hreduce : (((G.symm.trans F).trans α).trans α.symm).Homotopic (G.symm.trans F) := + (Path.Homotopic.trans_assoc (G.symm.trans F) α α.symm).trans + (((Path.Homotopic.refl (G.symm.trans F)).hcomp (Path.Homotopic.trans_symm α)).trans + (Path.Homotopic.trans_refl (G.symm.trans F))) + exact ((hβ.hcomp (Path.Homotopic.refl α.symm)).trans hreduce).symm + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2SectorContraction.lean b/LeanPool/GraphMinor/GM12/Section2SectorContraction.lean new file mode 100644 index 0000000000..878e69f9a8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2SectorContraction.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscArcs +public import Mathlib.Analysis.Convex.Star +import Mathlib.Analysis.Convex.Topology +import Mathlib.Analysis.Convex.PathConnected + +/-! +# Contracting a sector at its boundary vertex + +For the entry-edge existence argument on XII page 243, an incoming curve +must be compared inside one corner. In disc coordinates, the open disc +together with one boundary point is star-convex at that point. Intersecting +with a small ball preserves this property. A chart carries the resulting +contraction back to a simply-connected patch of the sector. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric Surface + +/-- Adding one point of the closed unit disc to the open unit disc gives +a set star-convex at that point. A positive contribution from an interior +point puts the combination in the interior. -/ +theorem starConvex_insert_unitBall {q : ℂ} (hq : q ∈ closedBall 0 1) : + StarConvex ℝ q (insert q (ball (0 : ℂ) 1)) := by + intro x hx a b ha hb hab + rcases hx with rfl | hx + · rw [← add_smul, hab, one_smul] + exact mem_insert _ _ + · by_cases hb0 : b = 0 + · have ha1 : a = 1 := by linarith + simp only [hb0, ha1, one_smul, zero_smul, add_zero] + exact mem_insert _ _ + · apply Or.inr + have hx' : x ∈ interior (closedBall (0 : ℂ) 1) := by + rw [interior_closedBall (0 : ℂ) (by norm_num : (1 : ℝ) ≠ 0)] + exact hx + have h := (convex_closedBall (0 : ℂ) (1 : ℝ)).combo_self_interior_mem_interior + hq hx' ha (lt_of_le_of_ne hb (Ne.symm hb0)) hab + simpa only [interior_closedBall (0 : ℂ) (by norm_num : (1 : ℝ) ≠ 0)] using h + +/-- A disc chart carries a star-convex subset of its coordinate disc to +a simply-connected set. Straight segments to the star centre contract +every loop, and lie in the same subset throughout. -/ +theorem chart_image_starConvex_isSimplyConnected {S : Type*} [TopologicalSpace S] + {D : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart D h g) + {A : Set ℂ} {q : ℂ} (hA : A ⊆ closedBall 0 1) + (hstar : StarConvex ℝ q A) (hq : q ∈ A) : IsSimplyConnectedSet (g '' A) := by + refine ⟨(hstar.isPathConnected hq).image' (c.gc.mono hA), ?_⟩ + intro φ hφ + have hφD : ∀ z, φ z ∈ D := fun z => c.g_subset hA (hφ (mem_range_self z)) + have hθ : Continuous (fun z => h (φ z)) := c.hc.comp_continuous φ.continuous hφD + have hθA : ∀ z, h (φ z) ∈ A := by + intro z + obtain ⟨x, hx, hxeq⟩ := hφ (mem_range_self z) + rw [← hxeq, c.hg (hA hx)] + exact hx + let κ : Circle × unitInterval → ℂ := fun z => z.2.val • q + (1 - z.2.val) • h (φ z.1) + have hκc : Continuous κ := by + exact ((continuous_subtype_val.comp continuous_snd).smul continuous_const).add + ((continuous_const.sub (continuous_subtype_val.comp continuous_snd)).smul + (hθ.comp continuous_fst)) + have hκA : ∀ z, κ z ∈ A := fun z => + hstar (hθA z.1) z.2.property.1 (sub_nonneg.mpr z.2.property.2) (by ring) + let Ψ : C(Circle × unitInterval, S) := ⟨fun z => g (κ z), + c.gc.comp_continuous hκc (fun z => hA (hκA z))⟩ + refine ⟨g q, mem_image_of_mem g hq, Ψ, + (fun z => mem_image_of_mem g (hκA z)), ?_, ?_⟩ + · intro z + change g ((0 : ℝ) • q + (1 - 0) • h (φ z)) = φ z + simp only [zero_smul, sub_zero, one_smul, zero_add] + exact c.gh (hφD z) + · intro z + change g ((1 : ℝ) • q + (1 - 1) • h (φ z)) = g q + simp + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2SectorCover.lean b/LeanPool/GraphMinor/GM12/Section2SectorCover.lean new file mode 100644 index 0000000000..160b0c9a84 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2SectorCover.lean @@ -0,0 +1,41 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Corners + +/-! +# Retaining the neighbourhood cover in the sector construction + +For the entry definition of XII page 243, one needs both the sector +properties and their cover of the neighbourhood off the drawing. This +is XI's rotation-sector construction, with the cover retained in the +conclusion when its connected pieces are assigned their regions. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 unitInterval + +universe u +variable {S : Type u} [TopologicalSpace S] + +/-- XI's sector construction with its cover of the neighbourhood off +the drawing retained, for use in XII's entry-edge existence proof. -/ +theorem exists_sectors_with_cover (hS : IsClosedSurface S) (Γ : Drawing S) {γ : Set S → I → S} + (hγ : EdgePar Γ γ) {v : S} + (hv : v ∈ Γ.V) (h2 : 2 ≤ Nat.card (halfEdges Γ γ v)) : + ∃ next ρ P W Q τ, IsSectors Γ γ v next ρ P W Q τ ∧ W \ Γ.U ⊆ ⋃ k, Q k := by + obtain ⟨next, ρ, P, W, Q, τ, h⟩ := GM11.exists_sectors hS Γ hγ hv h2 + refine ⟨next, ρ, P, W, Q, τ, h, ?_⟩ + exact h.cover.trans (iUnion_mono h.subQ) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2SectorEntry.lean b/LeanPool/GraphMinor/GM12/Section2SectorEntry.lean new file mode 100644 index 0000000000..d50463bb7c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2SectorEntry.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2EntryPatch +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# The entry condition for a spoke in the entering sector + +In the omitted assertion on XII page 243, a spoke in the same local +corner as the incoming curve has the required entry homotopy. Shrink +the sector patch, follow the spoke only until it leaves the patch, and +apply the common-patch criterion. This isolates the selection of the +spoke from the homotopy argument. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- A spoke entering the same sector as the approaching path satisfies +the entry homotopy condition of XII, page 243. The paths are read in the +region with its boundary vertex added. -/ +theorem exists_sector_entry_neighbourhood {S : Type*} [TopologicalSpace S] + {D W r Z : Set S} {v : Z} + (hD : IsClosedDisc D) (hv : v.val ∈ discBd D) + (hW : IsOpen W) (hvW : v.val ∈ W) + (hlocal : ((D \ discBd D) ∩ W) ∪ {v.val} ⊆ Z) + (hregion : (D \ discBd D) ∩ W ⊆ r) : + ∃ N : Set S, IsOpen N ∧ v.val ∈ N ∧ + ∀ {a b : Z} (p : Path a v) (β : Path v b), + a ≠ v → + (∀ t, (p t).val ∈ ((N ∩ D) \ discBd D) ∪ {v.val}) → + (∀ t, 0 < t → (β t).val ∈ r) → + (∃ ε : unitInterval, 0 < ε ∧ + ∀ t, 0 < t → t ≤ ε → (β t).val ∈ D \ discBd D) → + ∃ ρ : Path a b, (∀ t, (ρ t).val ∈ r) ∧ (p.trans β).Homotopic ρ := by + obtain ⟨N, X, hN, hvN, hvX, hX, hXlocal, hnear, hpuncture⟩ := + exists_simplyConnected_sector_patch_with_puncture hD hv hW hvW + refine ⟨N, hN, hvN, ?_⟩ + intro a b p β hav hp hβr hgerm + obtain ⟨ε, hε, hεD⟩ := hgerm + have hβN : (β 0).val ∈ N := by rw [β.source]; exact hvN + obtain ⟨s, hs, hsε, hsN⟩ := GM11.exists_pos_le + (continuous_subtype_val.comp β.continuous) hN hβN hε + have hXsub : X ⊆ Z := fun _ hx => hlocal (hXlocal hx) + have hXR : ∀ z : Z, z.val ∈ X \ {v.val} → z.val ∈ r := by + intro z hz + rcases hXlocal hz.1 with hzlocal | hzv + · exact hregion hzlocal + · exact (hz.2 hzv).elim + have hpX : ∀ t, (p t).val ∈ X := by + intro t + rcases hp t with ht | ht + · exact hnear ht + · exact mem_singleton_iff.mp ht ▸ hvX + have haX : a.val ∈ X \ {v.val} := by + refine ⟨p.source ▸ hpX 0, ?_⟩ + intro hav' + exact hav (Subtype.ext (mem_singleton_iff.mp hav')) + have hsX : (β s).val ∈ X \ {v.val} := by + have hsD := hεD s hs hsε + refine ⟨hnear ⟨⟨hsN s le_rfl, hsD.1⟩, hsD.2⟩, ?_⟩ + intro hsv + exact hsD.2 (mem_singleton_iff.mp hsv ▸ hv) + have hprefix : ∀ t, ((β.subpath 0 s) t).val ∈ X := by + intro t + change (β (Icc.convexComb 0 s t)).val ∈ X + have hle : Icc.convexComb 0 s t ≤ s := by + change (1 - t.val) * 0 + t.val * s.val ≤ s.val + simp only [mul_zero, zero_add] + exact mul_le_of_le_one_left s.property.1 t.property.2 + by_cases ht0 : Icc.convexComb 0 s t = 0 + · rw [ht0, β.source] + exact hvX + · have hpos := unitInterval.pos_iff_ne_zero.mpr ht0 + have hmem := hεD _ hpos (hle.trans hsε) + exact hnear ⟨⟨hsN _ hle, hmem.1⟩, hmem.2⟩ + have htail : ∀ t, ((β.subpath s 1) t).val ∈ r := by + intro t + apply hβr + change (0 : ℝ) < (1 - t.val) * s.val + t.val * 1 + have hle : s.val ≤ (1 - t.val) * s.val + t.val * 1 := by + nlinarith [t.property.1, s.property.2] + exact lt_of_lt_of_le hs hle + exact entry_homotopy_of_ambient_patch (R := Subtype.val ⁻¹' r) + hX hXsub hpuncture hXR p β hpX haX s hsX hprefix htail + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2SectorEntryEquality.lean b/LeanPool/GraphMinor/GM12/Section2SectorEntryEquality.lean new file mode 100644 index 0000000000..47ae9c3e4f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2SectorEntryEquality.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TerminalPatch +import LeanPool.GraphMinor.GM12.Section2SectorPatch + +/-! +# The entering sector determines the entry edge + +For image restriction in XII (2.1), pages 243--244, two curves +entering a vertex through the same sector must use the same spoke. +Shrink both approaches into the simply connected patch of that +closed sector disc. Their entry comparisons agree by the common +patch lemma, regardless of the curves' parameterizations. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- Two normal approaches through the same closed-disc sector have +the same entry edge. Only the local inclusion of the sector interior +in the region is used; the curves themselves can be different. -/ +theorem entersLike_edge_eq_of_common_sector + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {r e e' D W : Set S} {v w : S} (hr : r ∈ Γ.R) (hv : v ∈ Γ.V) + (hw : w ∈ r ∩ K.V) (he : e ∈ K.E) (he' : e' ∈ K.E) + (hD : IsClosedDisc D) (hvD : v ∈ discBd D) + (hW : IsOpen W) (hvW : v ∈ W) (hregion : (D \ discBd D) ∩ W ⊆ r) + {f g : ℝ → S} (hf : Continuous f) (hg : Continuous g) + {a c b d a₀ b₀ : ℝ} (haa₀ : a ≤ a₀) (ha₀c : a₀ < c) + (hbb₀ : b ≤ b₀) (hb₀d : b₀ < d) + (hfc : f c = v) (hgd : g d = v) + (hfr : ∀ z ∈ Ioo a c, f z ∈ r) (hgr : ∀ z ∈ Ioo b d, g z ∈ r) + (hfD : ∀ z ∈ Ioo a₀ c, f z ∈ D \ discBd D) + (hgD : ∀ z ∈ Ioo b₀ d, g z ∈ D \ discBd D) + (hentry : EntersLike f a c e r v w) (hentry' : EntersLike g b d e' r v w) : e = e' := by + obtain ⟨N, X, hN, hvN, hvX, hX, hlocal, hnear, hpuncture⟩ := + exists_simplyConnected_sector_patch_with_puncture hD hvD hW hvW + have hcover : N ∩ (D \ discBd D) ⊆ X := by + intro z hz + exact hnear ⟨⟨hz.1, hz.2.1⟩, hz.2.2⟩ + obtain ⟨s, hs, hfX⟩ := exists_terminal_interval_in_patch hf ha₀c hfc hfD hN hvN hvX hcover + obtain ⟨t, ht, hgX⟩ := exists_terminal_interval_in_patch hg hb₀d hgd hgD hN hvN hvX hcover + have hXZ : X ⊆ r ∪ {v} := by + intro z hz + rcases hlocal hz with hz | hz + · exact Or.inl (hregion hz) + · exact Or.inr hz + have hXR : X \ {v} ⊆ r := fun _ hz => (hXZ hz.1).resolve_right hz.2 + exact entersLike_edge_eq_of_common_terminal_patch hS hConn hK hr hv hw he he' + hX hXZ hpuncture hXR hf hg ⟨haa₀.trans_lt hs.1, hs.2⟩ ⟨hbb₀.trans_lt ht.1, ht.2⟩ hfc hgd hfr + hgr hentry hentry' hfX hgX + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2SectorExistence.lean b/LeanPool/GraphMinor/GM12/Section2SectorExistence.lean new file mode 100644 index 0000000000..9931978827 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2SectorExistence.lean @@ -0,0 +1,168 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2ApproachShrink +public import LeanPool.GraphMinor.GM12.Section2FreeSectorChord +public import LeanPool.GraphMinor.GM12.Section2EntryWitness +import LeanPool.GraphMinor.GM12.Section2SpokePaths + +/-! +# Existence of an entering spoke in a fixed sector + +This proves the geometric existence step of the omitted entry assertion +on XII page 243 for a specified sector of the original drawing. If a +radial half-edge enters the sector, use its full spoke path. Otherwise +construct a chord in the radial-free sector and replace it by its +parallel spoke across the disc supplied by radial maximality. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 unitInterval + +/-- A spoke parametrization retains its injectivity and exact edge image +when read in the region with its vertex added. -/ +private theorem lift_spoke_comparison {S : Type*} [TopologicalSpace S] + {r e : Set S} {v c : S} (hc : c ∈ r) + {x : (r ∪ {v} : Set S)} + (F : Path x (⟨v, Or.inr rfl⟩ : (r ∪ {v} : Set S))) + (β : Path v c) (hβi : Function.Injective β) + (hβe : β '' Ioo (0 : I) 1 = e) (hβr : ∀ t, 0 < t → β t ∈ r) : + ∃ q : Path (F 1) (⟨c, Or.inl hc⟩ : (r ∪ {v} : Set S)), + (∀ t, (q t).val = β t) ∧ Function.Injective (fun t => (q t).val) ∧ + (fun t => (q t).val) '' Ioo (0 : I) 1 = e := by + obtain ⟨q₀, hq₀⟩ := exists_path_in_region_vertex hc β hβr + let q := q₀.cast F.target rfl + have hq : ∀ t, (q t).val = β t := hq₀ + refine ⟨q, hq, ?_, ?_⟩ + · intro s t h + change (q s).val = (q t).val at h + rw [hq, hq] at h + exact hβi h + · have heq : (fun t => (q t).val) = β := funext hq + rw [heq] + exact hβe + +/-- Existence of an entering spoke for an approach in a fixed sector. +This is the existence part of the omitted lemma in the trace definition +of XII, page 243, with the sector data made explicit. -/ +theorem exists_entry_comparison_in_sector {S : Type*} [TopologicalSpace S] + [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {Γ K : Drawing S} (hrad : PreRad (.drawing Γ) K) + (hmax : RadMax (.drawing Γ) K) (hE : Γ.E.Nonempty) + {γ : Set S → I → S} {v : S} (hv : v ∈ Γ.V) + {next : halfEdges Γ γ v → halfEdges Γ γ v} + {ρ P Q : halfEdges Γ γ v → Set S} {W : Set S} + {τ : halfEdges Γ γ v → I} + (hsec : IsSectors Γ γ v next ρ P W Q τ) + (hcover : W \ Γ.U ⊆ ⋃ k, Q k) (k : halfEdges Γ γ v) + {c : S} (hc : c ∈ ρ k) (hcV : c ∈ K.V) + {x : (ρ k ∪ {v} : Set S)} + (F : Path x (⟨v, Or.inr rfl⟩ : (ρ k ∪ {v} : Set S))) + (hF : ∀ t, t < 1 → (F t).val ∈ ρ k ∩ (Q k \ discBd (Q k))) : + ∃ e ∈ K.E, + ∃ q : Path (F 1) (⟨c, Or.inl hc⟩ : (ρ k ∪ {v} : Set S)), + Function.Injective (fun t => (q t).val) ∧ + (fun t => (q t).val) '' Ioo (0 : I) 1 = e ∧ + ∃ t : I, t < 1 ∧ ∃ ρpath : Path (F t) (⟨c, Or.inl hc⟩ : (ρ k ∪ {v} : Set S)), + (∀ s, (ρpath s).val ∈ ρ k) ∧ ((F.subpath t 1).trans q).Homotopic ρpath := by + have : Nonempty S := ⟨v⟩ + obtain ⟨η, hη⟩ := exists_edgePar K + have hr := hsec.corners.region k + have hvr : v ∉ ρ k := fun h => region_subset hr h (Γ.V_subset_U hv) + have hvc : v ≠ c := fun h => hvr (h.symm ▸ hc) + have hregion : (Q k \ discBd (Q k)) ∩ W ⊆ ρ k := by + rintro z ⟨⟨hzQ, hzbd⟩, hzW⟩ + exact hsec.sub k (hsec.inside k ⟨⟨hzW, hzQ⟩, hzbd⟩) + have hoff : ∀ i : halfEdges K η v, ∀ t : I, 0 < t → spoke η i.val t ∉ Γ.U := by + intro i t ht hΓ + have he : spoke η i.val t ∈ i.val.1 := spoke_mem_edge hη i.property.1 ht + have hKV : spoke η i.val t ∈ K.V := radial_V hrad + (radial_inter hrad ▸ ⟨hΓ, K.closure_subset_U i.property.1 (subset_closure he)⟩) + exact edge_notMem_V i.property.1 he hKV + rcases sector_spoke_or_free_neighbourhood hη hv (radial_V hrad hv) hsec hcover hoff k with + ⟨i, ε, hε, hεQ⟩ | ⟨O, hO, hvO, hfree⟩ + · have hgi : Continuous (spoke η i.val) := + (hη.cont i.val.1 i.property.1).comp (continuous_halfPar i.val.2) + have hgi0 : spoke η i.val 0 = v := by rw [spoke_zero]; exact i.property.2 + obtain ⟨δ, hδ, hδε, hδW⟩ := exists_pos_le hgi hsec.isOpen + (hgi0.symm ▸ hsec.mem) hε + have hδr : spoke η i.val δ ∈ ρ k := hregion ⟨hεQ δ hδ hδε, hδW δ le_rfl⟩ + have hcap := spoke_ends_of_halfEdge_point hS hrad hη hv i hr hc hcV hδ hδr + obtain ⟨β, hβi, hβrange, hβe, hβhalf⟩ := + exists_spoke_path_from_halfEdge hη i hvc hcV hcap + have hce : c ∈ closure i.val.1 := by + have hm : c ∈ closure i.val.1 ∩ K.V := hcap.symm ▸ (Or.inr rfl) + exact hm.1 + have hβr := path_positive_in_region β hc hβe + (spoke_subset_region hS hrad hr i.property.1 hc hcV hce) + have hgerm : ∃ ζ : I, 0 < ζ ∧ ∀ t, 0 < t → t ≤ ζ → β t ∈ Q k \ discBd (Q k) := by + refine ⟨halfT ε, halfT_pos hε, ?_⟩ + intro t ht htε + obtain ⟨s, hsε, hst⟩ := exists_halfT_eq htε + have hs : 0 < s := by + apply unitInterval.pos_iff_ne_zero.mpr + intro hs0 + have ht0 : t = 0 := by + rw [hs0] at hst + have hz : halfT 0 = 0 := Subtype.ext (by simp [halfT]) + exact hst.symm.trans hz + exact ht.ne' ht0 + rw [← hst, ← hβhalf] + exact hεQ s hs hsε + obtain ⟨q, hq, t, ht, ρpath, hρpath, hhom⟩ := entry_comparison_from_surface_germ hc F β + (hsec.disc k) (hsec.bd k) hsec.isOpen hsec.mem hregion hvr hF hβr hgerm + refine ⟨i.val.1, i.property.1, q, ?_, ?_, t, ht, ρpath, hρpath, hhom⟩ + · intro s t h + change (q s).val = (q t).val at h + rw [hq, hq] at h + exact hβi h + · rw [show (fun t => (q t).val) = β from funext hq] + exact hβe + · obtain ⟨e, he, hcap, u, hu, hui, hu0, hu1, hur, ⟨N, hN, hvN, hNgerm⟩, Δ, hΔ, hΔr, hbd⟩ := + exists_parallel_spoke_at_free_sector hS hrad hmax hE hv hsec k hc hcV hO hvO hfree + let β : Path v c := ⟨⟨u, hu⟩, hu0, hu1⟩ + have hβr : ∀ t, 0 < t → β t ∈ ρ k := by + intro t ht + by_cases ht1 : t = 1 + · rw [ht1, β.target]; exact hc + · exact hur t ht.ne' ht1 + obtain ⟨ε, hε, _, hεN⟩ := exists_pos_le hu hN (hu0.symm ▸ hvN) (a := 1) one_pos + have hgerm : ∃ ζ : I, 0 < ζ ∧ ∀ t, 0 < t → t ≤ ζ → β t ∈ Q k \ discBd (Q k) := + ⟨ε, hε, fun t ht htε => hNgerm t ht (hεN t htε)⟩ + obtain ⟨q, hq, t, ht, ρpath, hρpath, hhom⟩ := entry_comparison_from_surface_germ hc F β + (hsec.disc k) (hsec.bd k) hsec.isOpen hsec.mem hregion hvr hF hβr hgerm + obtain ⟨b, hb⟩ := exists_end_eq hη he (radial_V hrad hv) (by + have hm : v ∈ closure e ∩ K.V := hcap.symm ▸ (Or.inl rfl) + exact hm.1) + let i : halfEdges K η v := ⟨(e, b), he, hb⟩ + obtain ⟨β', hβ'i, hβ'range, hβ'e, _⟩ := exists_spoke_path_from_halfEdge hη i hvc hcV hcap + have hce : c ∈ closure e := by + have hm : c ∈ closure e ∩ K.V := hcap.symm ▸ (Or.inr rfl) + exact hm.1 + have hβ'r := path_positive_in_region β' hc hβ'e (spoke_subset_region hS hrad hr he hc hcV hce) + obtain ⟨q', hq', hq'i, hq'e⟩ := lift_spoke_comparison hc F β' hβ'i hβ'e hβ'r + have hΔsub : closure e ∪ range u ⊆ Δ := by + rw [← hbd] + rw [subBd_eq_frontier] + exact frontier_subset_iff_isClosed.mpr hΔ.isClosed + have hqΔ : ∀ s, (q s).val ∈ Δ := fun s => hΔsub (Or.inr (hq s ▸ mem_range_self s)) + have hq'Δ : ∀ s, (q' s).val ∈ Δ := by + intro s + apply hΔsub + left + rw [hq' s] + exact hβ'range ▸ mem_range_self s + have hfinal := entry_comparison_replace_in_disc hΔ hΔr (F.subpath t 1) q q' ρpath hqΔ hq'Δ hhom + exact ⟨e, he, q', hq'i, hq'e, t, ht, ρpath, hρpath, hfinal⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2SectorHomotopy.lean b/LeanPool/GraphMinor/GM12/Section2SectorHomotopy.lean new file mode 100644 index 0000000000..d2495f06b6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2SectorHomotopy.lean @@ -0,0 +1,91 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2SectorPatch +public import LeanPool.GraphMinor.GM12.Section2PathHomotopy +import LeanPool.GraphMinor.GM11.Section3 + +/-! +# Replacing paths in a corner near its vertex + +The entry-edge construction on XII page 243 needs to replace an approach +by a path in the same corner. A small patch of a sector disc is simply +connected even when the approach touches its boundary vertex tangentially. +Lift paths to that patch and map the resulting homotopy into the corner +with its vertex added. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- A simply-connected subset of a subspace gives homotopies in that +subspace. The inclusion condition is used to map the homotopy back. -/ +theorem paths_homotopic_in_subspace_of_patch {S : Type*} [TopologicalSpace S] + {X Z : Set S} (hX : IsSimplyConnectedSet X) (hXZ : X ⊆ Z) + {a b : Z} (p q : Path a b) + (hp : ∀ t, (p t).val ∈ X) (hq : ∀ t, (q t).val ∈ X) : + p.Homotopic q := by + have ha : a.val ∈ X := p.source ▸ hp 0 + have hb : b.val ∈ X := p.target ▸ hp 1 + let pX : Path (⟨a.val, ha⟩ : X) ⟨b.val, hb⟩ := { + toFun := fun t => ⟨(p t).val, hp t⟩ + continuous_toFun := (continuous_subtype_val.comp p.continuous).subtype_mk _ + source' := by + apply Subtype.ext + change (p 0).val = a.val + exact congrArg Subtype.val p.source + target' := by + apply Subtype.ext + change (p 1).val = b.val + exact congrArg Subtype.val p.target } + let qX : Path (⟨a.val, ha⟩ : X) ⟨b.val, hb⟩ := { + toFun := fun t => ⟨(q t).val, hq t⟩ + continuous_toFun := (continuous_subtype_val.comp q.continuous).subtype_mk _ + source' := by + apply Subtype.ext + change (q 0).val = a.val + exact congrArg Subtype.val q.source + target' := by + apply Subtype.ext + change (q 1).val = b.val + exact congrArg Subtype.val q.target } + let inclusion : C(X, Z) := ⟨fun x => ⟨x.val, hXZ x.property⟩, + continuous_subtype_val.subtype_mk _⟩ + exact (hX.pathsHomotopic pX qX).map inclusion + +/-- Two sufficiently short paths in a sector with its boundary vertex +added are homotopic in any subspace containing the sector interior near +that vertex. This is the local replacement step in the entry definition +of Graph Minors XII, page 243. -/ +theorem exists_sector_path_replacement {S : Type*} [TopologicalSpace S] + {D W Z : Set S} (hD : IsClosedDisc D) {v : S} (hv : v ∈ discBd D) + (hW : IsOpen W) (hvW : v ∈ W) + (hZ : ((D \ discBd D) ∩ W) ∪ {v} ⊆ Z) : + ∃ N : Set S, IsOpen N ∧ v ∈ N ∧ + ∀ {a b : Z} (p q : Path a b), + (∀ t, (p t).val ∈ ((N ∩ D) \ discBd D) ∪ {v}) → + (∀ t, (q t).val ∈ ((N ∩ D) \ discBd D) ∪ {v}) → + p.Homotopic q := by + obtain ⟨N, X, hN, hvN, hvX, hX, hXZ, hNX⟩ := + exists_simplyConnected_sector_patch hD hv hW hvW + refine ⟨N, hN, hvN, ?_⟩ + intro a b p q hp hq + have hsub : ((N ∩ D) \ discBd D) ∪ {v} ⊆ X := by + intro x hx + rcases hx with hx | hx + · exact hNX hx + · exact mem_singleton_iff.mp hx ▸ hvX + exact paths_homotopic_in_subspace_of_patch hX (fun _ hx => hZ (hXZ hx)) p q + (fun t => hsub (hp t)) (fun t => hsub (hq t)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2SectorPatch.lean b/LeanPool/GraphMinor/GM12/Section2SectorPatch.lean new file mode 100644 index 0000000000..963310e40d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2SectorPatch.lean @@ -0,0 +1,124 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.GM12.Section2SectorContraction +import Mathlib.Analysis.Convex.PathConnected + +/-! +# A simply-connected patch at a sector vertex + +For the entry-edge construction on XII page 243, shrink a closed sector +near its boundary vertex. In disc coordinates, take the open unit disc +with that one boundary point, intersected with a small ball around the +point. It contracts to the boundary point and contains all interior +points of the sector sufficiently near the vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric Surface + +/-- Near a boundary point of a closed disc there is a simply-connected +patch that contains the nearby disc interior and no other boundary +point. The whole patch can be kept in a prescribed neighbourhood. -/ +theorem exists_simplyConnected_sector_patch_with_puncture {S : Type*} [TopologicalSpace S] + {D W : Set S} (hD : IsClosedDisc D) {v : S} (hv : v ∈ discBd D) + (hW : IsOpen W) (hvW : v ∈ W) : + ∃ N X : Set S, IsOpen N ∧ v ∈ N ∧ v ∈ X ∧ IsSimplyConnectedSet X ∧ + X ⊆ ((D \ discBd D) ∩ W) ∪ {v} ∧ (N ∩ D) \ discBd D ⊆ X ∧ + IsPathConnected (X \ {v}) := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hvD : v ∈ D := Surface.discBd_subset D hv + let q := h v + have hq : q ∈ closedBall (0 : ℂ) 1 := c.hm hvD + have hgq : g q = v := c.gh hvD + have hpre : g ⁻¹' W ∈ 𝓝[closedBall (0 : ℂ) 1] q := + (c.gc q hq).preimage_mem_nhdsWithin (hW.mem_nhds (hgq.symm ▸ hvW)) + obtain ⟨δ, hδ, hδW⟩ := Metric.mem_nhdsWithin_iff.mp hpre + let A : Set ℂ := insert q (ball (0 : ℂ) 1) ∩ ball q δ + have hqA : q ∈ A := ⟨mem_insert _ _, mem_ball_self hδ⟩ + have hA : A ⊆ closedBall (0 : ℂ) 1 := by + intro x hx + rcases hx.1 with rfl | hx + · exact hq + · exact ball_subset_closedBall hx + have hstar : StarConvex ℝ q A := + (starConvex_insert_unitBall hq).inter ((convex_ball q δ) (mem_ball_self hδ)) + have hX : IsSimplyConnectedSet (g '' A) := chart_image_starConvex_isSimplyConnected c hA hstar hqA + have hpreH : h ⁻¹' ball q δ ∈ 𝓝[D] v := + (c.hc v hvD).preimage_mem_nhdsWithin (isOpen_ball.mem_nhds (mem_ball_self hδ)) + obtain ⟨U, hU, hUsub⟩ := mem_nhdsWithin_iff_exists_mem_nhds_inter.mp hpreH + obtain ⟨N, hNU, hN, hvN⟩ := mem_nhds_iff.mp hU + refine ⟨N ∩ W, g '' A, hN.inter hW, ⟨hvN, hvW⟩, + ⟨q, hqA, hgq⟩, hX, ?_, ?_, ?_⟩ + · rintro x ⟨z, hz, rfl⟩ + by_cases hzq : z = q + · right + exact mem_singleton_iff.mpr (hzq ▸ hgq) + · left + have hzball : z ∈ ball (0 : ℂ) 1 := hz.1.resolve_left hzq + refine ⟨⟨c.gm (hA hz), ?_⟩, hδW ⟨hz.2, hA hz⟩⟩ + intro hbd + have hzbd : z ∈ sphere (0 : ℂ) 1 := by + have hm : h (g z) ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem h hbd + rwa [c.hg (hA hz)] at hm + exact (mem_ball.mp hzball).ne (mem_sphere.mp hzbd) + · rintro x ⟨⟨⟨hxN, _⟩, hxD⟩, hxBd⟩ + have hxball : h x ∈ ball q δ := hUsub ⟨hNU hxN, hxD⟩ + have hxnot : h x ∉ sphere (0 : ℂ) 1 := by + intro hsph + have hm : g (h x) ∈ discBd D := c.g_sphere ▸ mem_image_of_mem g hsph + exact hxBd (c.gh hxD ▸ hm) + have hxunit : h x ∈ ball (0 : ℂ) 1 := by + rw [← closedBall_sdiff_sphere] + exact ⟨c.hm hxD, hxnot⟩ + exact ⟨h x, ⟨Or.inr hxunit, hxball⟩, c.gh hxD⟩ + · let B : Set ℂ := ball (0 : ℂ) 1 ∩ ball q δ + have hqcl : q ∈ closure (ball (0 : ℂ) 1) := by + rw [closure_ball (0 : ℂ) (by norm_num : (1 : ℝ) ≠ 0)] + exact hq + obtain ⟨z, hzδ, hzunit⟩ := mem_closure_iff.mp hqcl (ball q δ) + isOpen_ball (mem_ball_self hδ) + have hB : IsPathConnected B := + ((convex_ball (0 : ℂ) 1).inter (convex_ball q δ)).isPathConnected ⟨z, hzunit, hzδ⟩ + have heq : (g '' A) \ {v} = g '' B := by + ext x + constructor + · rintro ⟨⟨z, hz, rfl⟩, hzv⟩ + refine ⟨z, ⟨?_, hz.2⟩, rfl⟩ + rcases hz.1 with hzq | hzball + · exact (hzv (mem_singleton_iff.mpr (hzq ▸ hgq))).elim + · exact hzball + · rintro ⟨z, hz, rfl⟩ + refine ⟨⟨z, ⟨Or.inr hz.1, hz.2⟩, rfl⟩, ?_⟩ + intro hzv + have hbd : g z ∈ discBd D := mem_singleton_iff.mp hzv ▸ hv + have hsph : z ∈ sphere (0 : ℂ) 1 := by + have hm : h (g z) ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem h hbd + rwa [c.hg (ball_subset_closedBall hz.1)] at hm + exact (mem_ball.mp hz.1).ne (mem_sphere.mp hsph) + rw [heq] + exact hB.image' (c.gc.mono (fun _ hx => ball_subset_closedBall hx.1)) + +/-- A sector has a simply-connected patch at a boundary vertex containing +all sufficiently near interior points and lying in a prescribed neighbourhood. -/ +theorem exists_simplyConnected_sector_patch {S : Type*} [TopologicalSpace S] + {D W : Set S} (hD : IsClosedDisc D) {v : S} (hv : v ∈ discBd D) + (hW : IsOpen W) (hvW : v ∈ W) : + ∃ N X : Set S, IsOpen N ∧ v ∈ N ∧ v ∈ X ∧ IsSimplyConnectedSet X ∧ + X ⊆ ((D \ discBd D) ∩ W) ∪ {v} ∧ (N ∩ D) \ discBd D ⊆ X := by + obtain ⟨N, X, hN, hvN, hvX, hX, hsub, hnear, _⟩ := + exists_simplyConnected_sector_patch_with_puncture hD hv hW hvW + exact ⟨N, X, hN, hvN, hvX, hX, hsub, hnear⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2SectorSpoke.lean b/LeanPool/GraphMinor/GM12/Section2SectorSpoke.lean new file mode 100644 index 0000000000..27a999955e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2SectorSpoke.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2Corners +public import LeanPool.GraphMinor.GM12.Section2HalfEdgeNeighbourhood +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# A spoke in a corner, or a neighbourhood free of spokes + +For the entry-edge existence assertion on XII page 243, compare the +short radial half-edges with the sectors of the original drawing. +Each half-edge enters one sector. If none enters the prescribed sector, +compactness removes all the other parts of the radial drawing from a +small neighbourhood. A chord in that sector can then be chosen away +from the radial drawing. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 unitInterval + +/-- Either a half-edge has its germ in the prescribed sector interior, +or the sector off the original drawing misses the second drawing in a +neighbourhood of the vertex. The second drawing's half-edges are assumed +to stay off the original drawing, as radial spokes do. -/ +theorem sector_spoke_or_free_neighbourhood {S : Type*} [TopologicalSpace S] [T2Space S] + {Γ K : Drawing S} {γ η : Set S → I → S} (hη : EdgePar K η) + {v : S} (hvΓ : v ∈ Γ.V) (hvK : v ∈ K.V) + {next : halfEdges Γ γ v → halfEdges Γ γ v} + {ρ P Q : halfEdges Γ γ v → Set S} {W : Set S} + {τ : halfEdges Γ γ v → I} + (hsec : IsSectors Γ γ v next ρ P W Q τ) + (hcover : W \ Γ.U ⊆ ⋃ k, Q k) + (hoff : ∀ i : halfEdges K η v, ∀ t : I, 0 < t → spoke η i.val t ∉ Γ.U) + (k : halfEdges Γ γ v) : + (∃ (i : halfEdges K η v) (ε : I), 0 < ε ∧ + ∀ t, 0 < t → t ≤ ε → spoke η i.val t ∈ Q k \ discBd (Q k)) ∨ + (∃ O : Set S, IsOpen O ∧ v ∈ O ∧ Disjoint ((O ∩ Q k) \ Γ.U) K.U) := by + classical + have hg : ∀ i : halfEdges K η v, Continuous (spoke η i.val) := + fun i => (hη.cont i.val.1 i.property.1).comp (continuous_halfPar i.val.2) + have hg0 : ∀ i : halfEdges K η v, spoke η i.val 0 = v := by + intro i + rw [spoke_zero] + exact i.property.2 + have hchoice : ∀ i : halfEdges K η v, + ∃ (j : halfEdges Γ γ v) (ε : I), 0 < ε ∧ + ∀ t, t ≤ ε → spoke η i.val t ∈ Q j := by + intro i + obtain ⟨j, ε, hε, hQ, _⟩ := + initially_in_given_corner hsec hcover (hg i) (hg0 i) (hoff i) + exact ⟨j, ε, hε, hQ⟩ + choose j ε hε hQ using hchoice + by_cases hex : ∃ i, j i = k + · left + obtain ⟨i, hi⟩ := hex + obtain ⟨δ, hδ, hδε, hδW⟩ := exists_pos_le (hg i) hsec.isOpen + ((hg0 i).symm ▸ hsec.mem) (hε i) + refine ⟨i, δ, hδ, ?_⟩ + intro t ht htδ + refine ⟨hi ▸ hQ i t (htδ.trans hδε), ?_⟩ + intro hbd + exact hoff i t ht (hsec.bdU k ⟨hδW t htδ, hbd⟩) + · right + obtain ⟨O, hO, hvO, hOK⟩ := exists_halfEdge_neighbourhood K hη hvK ε hε + refine ⟨O, hO, hvO, Set.disjoint_left.mpr ?_⟩ + intro x hx hxK + rcases hOK ⟨hx.1.1, hxK⟩ with hxv | hxspoke + · exact hx.2 (mem_singleton_iff.mp hxv ▸ Γ.V_subset_U hvΓ) + · obtain ⟨i, t, ht, htx⟩ := mem_iUnion.mp hxspoke + have ht0 : 0 < t := by + apply unitInterval.pos_iff_ne_zero.mpr + intro htzero + have hxv : x = v := by rw [htzero, hg0 i] at htx; exact htx.symm + exact hx.2 (hxv ▸ Γ.V_subset_U hvΓ) + have hxi : x ∈ Q (j i) := htx ▸ hQ i t ht.2 + exact hx.2 (hsec.inter k (j i) (fun h => hex ⟨i, h.symm⟩) ⟨hx.1.2, hxi⟩) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2Simple.lean b/LeanPool/GraphMinor/GM12/Section2Simple.lean new file mode 100644 index 0000000000..2e7e62d9aa --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2Simple.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2Case1 +public import LeanPool.GraphMinor.GM12.Section2Case2Induction +import LeanPool.GraphMinor.GM12.Section2NonemptyEdges +import LeanPool.GraphMinor.GM11.Theorem66 + +/-! +# Graph Minors XII (2.1) for simple closed curves + +Induct on the length of the embedded normal curve. The zero-length +case stays in one region. At positive length the tangle has order at +least two and hence the drawing has an edge. If every region intersection +is connected, apply Case 1. Otherwise the theta-disc construction of +Case 2 gives a smaller positive-length curve and a trace subdrawing. +Apply the induction and inside monotonicity exactly as on page 244. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +private theorem simple_trace_inside_aux + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + {c : Set S} (hc : c ∈ Γ.A) (n : ℕ) + {φ : C(Circle, S)} (hφ : IsEmbedding φ) {u : S} (W : GraphWalk K.toGraph u u) + (hW : IsTrace Γ K φ W) (hn : curveLength Γ φ = n) (hlen : curveLength Γ φ < θ) + {D : Set S} (hD : IsClosedDisc D) (hbdD : subBd D = range φ) + (hmD : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + (hcD : (c ∩ D).Nonempty) : (c ∩ insWalk ins K W).Nonempty := by + induction n using Nat.strong_induction_on generalizing φ u D with + | ind n ih => + have hF : IsOArc (range φ) := ⟨hφ.toHomeomorph⟩ + by_cases hzero : curveLength Γ φ = 0 + · exact theorem_2_1_zero hS hT hK.1 hW hzero hF subset_rfl hD hbdD hmD hc hcD + · have hpos : 0 < curveLength Γ φ := Nat.pos_of_ne_zero hzero + have hθ : 2 ≤ θ := by omega + have hE : Γ.E.Nonempty := edges_nonempty_of_tangle_order_two hT hθ + have hpT := GM11.IsTangle.isPretangle hT + by_cases hconn : ∀ r ∈ Γ.R, IsPreconnected (range φ ∩ r) + · exact theorem_2_1_case1 hS hpT hK hE hd hφ W hW hpos hlen hconn hD hbdD hmD hc hcD + · push Not at hconn + obtain ⟨r, hr, hdisconn⟩ := hconn + apply theorem_2_1_case2 hS hK hE hpT hrespect hφ.injective hF W hW hlen + hr hdisconn hD hbdD hmD hcD + intro ψ hψ _ hsmall v P hP E hE' hbdE hmE hcE + have hsmalln : curveLength Γ ψ < n := hn ▸ hsmall + exact ih (curveLength Γ ψ) hsmalln hψ P hP rfl (hsmall.trans hlen) hE' hbdE hmE hcE + +/-- Graph Minors XII, (2.1), pages 243--244, for an embedded normal +closed curve. The selected disc is its inside and every atom meeting +it meets the inside of any trace of that curve. -/ +theorem theorem_2_1_simple + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + {φ : C(Circle, S)} (hφ : IsEmbedding φ) {u : S} (W : GraphWalk K.toGraph u u) + (hW : IsTrace Γ K φ W) (hlen : curveLength Γ φ < θ) + {D c : Set S} (hD : IsClosedDisc D) (hbdD : subBd D = range φ) + (hmD : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + (hc : c ∈ Γ.A) (hcD : (c ∩ D).Nonempty) : + (c ∩ insWalk ins K W).Nonempty := + simple_trace_inside_aux hS hT hrespect hK hd hc (curveLength Γ φ) hφ W hW rfl hlen hD hbdD hmD hcD + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2SingleVisitDeformation.lean b/LeanPool/GraphMinor/GM12/Section2SingleVisitDeformation.lean new file mode 100644 index 0000000000..8b41286bb4 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2SingleVisitDeformation.lean @@ -0,0 +1,134 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2RegionPathDeformation +public import LeanPool.GraphMinor.GM12.Section2TraceComposition +import LeanPool.GraphMinor.GM12.Section2NormalEntryExistence +import LeanPool.GraphMinor.GM12.Section2SpokePairTopology +import LeanPool.GraphMinor.GM12.Section2SpokePaths +import LeanPool.GraphMinor.GM12.Section2WalkCarriers +import LeanPool.GraphMinor.GM11.RadialRegions + +/-! +# The full deformation data for one region visit + +For Case 1 of XII (2.1), page 244, choose the radial hub and the +entry and exit edges of one real region interval. Deform that interval +to the two spoke paths and record the corresponding two-edge walk. +Their point sets agree exactly. The new path is injective on its +half-open interval, unless both ends and both edges agree. In that +case its point set is a line in the region with the boundary vertex +restored. These are the two alternatives used in Case 1. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Deform a single region visit, retaining its exact two-edge trace +and its simplicity or backtracking alternative. -/ +theorem exists_single_visit_deformation + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {f : ℝ → S} (hf : Continuous f) {a c : ℝ} (hac : a < c) + (ha : f a ∈ Γ.V) (hc : f c ∈ Γ.V) {r Z : Set S} (hr : r ∈ Γ.R) (hrZ : r ⊆ Z) + (hfr : ∀ t ∈ Ioo a c, f t ∈ r) + (γ : C(unitInterval, S)) (hγ : ∀ t, γ t = f (a + t.val * (c - a))) + (hγZ : range γ ⊆ Z) : + ∃ (δ : C(unitInterval, S)) (W : GraphWalk K.toGraph (f a) (f c)), + TraceSteps Γ K f a c W ∧ W.length = 2 ∧ range δ = (walkDrawing K W).U ∧ + CurvesHomotopicIn Z γ δ ∧ δ 0 = f a ∧ δ 1 = f c ∧ + (∀ t, 0 < t.val → t.val < 1 → δ t ∈ r) ∧ + (InjOn δ (Ico (0 : unitInterval) 1) ∨ + (f a = f c ∧ ∃ L : Set S, IsLine L ∧ range δ = L ∧ L ⊆ r ∪ {f a})) := by + have hrad : PreRad (.drawing Γ) K := ⟨hK.1, hK.2.1⟩ + obtain ⟨w, ⟨hwr, hwK⟩, _⟩ := hrad.2.2.2.1 r hr + obtain ⟨e, he, hleave⟩ := exists_leavesLike hS hrad hK.2.2 hE ha hr hwr hwK hf hac rfl hfr + obtain ⟨e', he', henter⟩ := exists_entersLike hS hrad hK.2.2 hE hc hr hwr hwK hf hac rfl hfr + have hl := leavesLike_isLink hS hrad hr ha hwr hwK he rfl hleave + have hl' := entersLike_isLink hS hrad hr hc hwr hwK he' rfl henter + have hγ0 : γ 0 = f a := by simpa only [Icc.coe_zero, zero_mul, add_zero] using hγ 0 + have hγ1 : γ 1 = f c := by simpa only [Icc.coe_one, one_mul, add_sub_cancel] using hγ 1 + have haZ : f a ∈ Z := hγ0 ▸ hγZ (mem_range_self 0) + have hcZ : f c ∈ Z := hγ1 ▸ hγZ (mem_range_self 1) + let P : Path (⟨f a, haZ⟩ : Z) ⟨f c, hcZ⟩ := { + toFun := fun t => ⟨γ t, hγZ (mem_range_self t)⟩ + continuous_toFun := γ.continuous.subtype_mk _ + source' := Subtype.ext hγ0 + target' := Subtype.ext hγ1 } + have haE : f a ∉ e := fun hz => (he.2.1 hz).2 (hK.2.1.2.1 ha) + have hcE' : f c ∉ e' := fun hz => (he'.2.1 hz).2 (hK.2.1.2.1 hc) + have hwE : w ∉ e := fun hz => (he.2.1 hz).2 hwK + have hwE' : w ∉ e' := fun hz => (he'.2.1 hz).2 hwK + have haw : f a ≠ w := fun heq => region_subset hr (heq.symm ▸ hwr) (Γ.V_subset_U ha) + have hcw : f c ≠ w := fun heq => region_subset hr (heq.symm ▸ hwr) (Γ.V_subset_U hc) + obtain ⟨α, β, hαi, hβi, hαrange, hβrange, hαe, hβe, hhom⟩ := + region_path_homotopic_to_spokes (hK.1.2 r hr) hrZ haZ hcZ hwr haE hwE haw + hcE' hwE' hcw hf hac rfl rfl hfr hleave henter P hγ + let p : Path (f a) w := α.map continuous_subtype_val + let q : Path (f c) w := β.map continuous_subtype_val + let δ : C(unitInterval, S) := (p.trans q.symm).toContinuousMap + let W : GraphWalk K.toGraph (f a) (f c) := .cons hl (.cons hl'.symm (.nil hl'.left_mem)) + have hW : TraceSteps Γ K f a c W := + ⟨c, hac, rfl, ha, rfl, hwK, r, hr, hwr, hfr, hleave, henter, rfl, rfl, hc⟩ + have hδrange : range δ = closure e ∪ closure e' := by + change range (p.trans q.symm) = _ + rw [Path.trans_range, Path.symm_range] + exact congrArg₂ Set.union hαrange hβrange + have hwcl : w ∈ closure e := hαrange ▸ ⟨1, congrArg Subtype.val α.target⟩ + have hwcl' : w ∈ closure e' := hβrange ▸ ⟨1, congrArg Subtype.val β.target⟩ + have her : e ⊆ r := spoke_subset_region hS hrad hr he hwr hwK hwcl + have he'r : e' ⊆ r := spoke_subset_region hS hrad hr he' hwr hwK hwcl' + have hpr := path_positive_in_region p hwr hαe her + have hqr := path_positive_in_region q hwr hβe he'r + refine ⟨δ, W, hW, rfl, ?_, ?_, (p.trans q.symm).source, (p.trans q.symm).target, + ?_, ?_⟩ + · rw [hδrange] + exact (walkDrawing_U_two_edges K hl hl'.symm).symm + · have H := curvesHomotopicIn_of_paths_homotopic hhom + have hleft : (⟨fun t => (P t).val, continuous_subtype_val.comp P.continuous⟩ : C(unitInterval, + S)) = γ := rfl + have hright : (⟨fun t => ((α.trans β.symm) t).val, + continuous_subtype_val.comp (α.trans β.symm).continuous⟩ : C(unitInterval, S)) = δ := by + ext t + change ((α.trans β.symm) t).val = (p.trans q.symm) t + rw [Path.trans_apply, Path.trans_apply] + split_ifs <;> rfl + rw [hleft, hright] at H + exact H + · intro t ht0 ht1 + exact spoke_pair_path_interior_subset p q hpr hqr t ⟨ht0, ht1⟩ + · by_cases hacv : f a = f c + · by_cases hee : e = e' + · right + refine ⟨hacv, closure e, ?_, ?_, ?_⟩ + · have hpemb : IsEmbedding p := p.continuous.isClosedEmbedding hαi |>.isEmbedding + exact ⟨hpemb.toHomeomorph.trans (Homeomorph.setCongr hαrange)⟩ + · rw [hδrange, ← hee, union_self] + · intro x hx + obtain ⟨t, rfl⟩ := hαrange.symm ▸ hx + by_cases ht : t = 0 + · right + change (α t).val = f a + rw [ht] + exact congrArg (fun z : Z => z.val) α.source + · exact Or.inl (hpr t (unitInterval.pos_iff_ne_zero.mpr ht)) + · left + let q' : Path (f a) w := q.cast hacv rfl + exact parallel_spoke_pair_path_halfopen_injective he he' hee hl.2.2.2 + p q' hαi hβi hαrange hβrange + · left + exact (spoke_pair_path_injective he he' hl.2.2.2 hl'.2.2.2 hacv haw + p q hαi hβi hαrange hβrange).injOn + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2SlitBall.lean b/LeanPool/GraphMinor/GM12/Section2SlitBall.lean new file mode 100644 index 0000000000..e99d4b9644 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2SlitBall.lean @@ -0,0 +1,121 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Analysis.Convex.Star +public import Mathlib.Topology.Instances.Complex +public import Mathlib.Topology.Connected.PathConnected +import Mathlib.Analysis.Convex.Topology +import Mathlib.Analysis.Complex.Basic +import Mathlib.Analysis.Normed.Module.Convex +import Mathlib.Analysis.Convex.PathConnected +import Mathlib.Tactic.Linarith + +/-! +# A slit ball at the end of a straight arc + +For the leaf-entry patch on XII page 243, straighten the incident arc +near its end. The local complement is a ball with the positive real +ray removed and its origin restored. It is star-convex at that origin. +After the origin is removed too, it is star-convex at a negative real +point. Thus the patch contracts to its leaf and its puncture stays +path-connected. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric + +/-- A ball slit along the positive real ray, with its tip retained, +is star-convex at that tip. -/ +theorem starConvex_slit_ball_tip + {q : ℂ} (hq : q.im = 0) {δ : ℝ} (hδ : 0 < δ) : + StarConvex ℝ q (ball q δ ∩ {z : ℂ | z.im ≠ 0 ∨ z.re ≤ q.re}) := by + intro x hx a b ha hb hab + refine ⟨(convex_ball q δ) (mem_ball_self hδ) hx.1 ha hb hab, ?_⟩ + change (a • q + b • x).im ≠ 0 ∨ (a • q + b • x).re ≤ q.re + by_cases hb0 : b = 0 + · right + have ha1 : a = 1 := by linarith + simp only [hb0, ha1, one_smul, zero_smul, add_zero] + exact le_rfl + · rcases hx.2 with hxim | hxre + · left + simpa only [Complex.add_im, Complex.smul_im, smul_eq_mul, hq, mul_zero, zero_add] + using mul_ne_zero hb0 hxim + · right + simp only [Complex.add_re, Complex.smul_re, smul_eq_mul] + have hmul := mul_nonneg hb (sub_nonneg.mpr hxre) + have hsum : a * q.re + b * q.re = q.re := by rw [← add_mul, hab, one_mul] + nlinarith only [hmul, hsum] + +/-- The punctured slit ball is star-convex at every negative real +point in the ball. -/ +theorem starConvex_slit_ball_negative + {q w : ℂ} (hwim : w.im = 0) (hwre : w.re < q.re) + {δ : ℝ} (hwball : w ∈ ball q δ) : + StarConvex ℝ w (ball q δ ∩ {z : ℂ | z.im ≠ 0 ∨ z.re < q.re}) := by + intro x hx a b ha hb hab + refine ⟨(convex_ball q δ) hwball hx.1 ha hb hab, ?_⟩ + change (a • w + b • x).im ≠ 0 ∨ (a • w + b • x).re < q.re + by_cases hb0 : b = 0 + · right + have ha1 : a = 1 := by linarith + simpa only [hb0, ha1, one_smul, zero_smul, add_zero] using hwre + · rcases hx.2 with hxim | hxre + · left + simpa only [Complex.add_im, Complex.smul_im, smul_eq_mul, hwim, mul_zero, zero_add] + using mul_ne_zero hb0 hxim + · right + simp only [Complex.add_re, Complex.smul_re, smul_eq_mul] + have hbpos : 0 < b := lt_of_le_of_ne hb (Ne.symm hb0) + have hmul₁ := mul_pos hbpos (sub_pos.mpr hxre) + have hmul₂ := mul_nonneg ha (sub_nonneg.mpr hwre.le) + have hsum : a * q.re + b * q.re = q.re := by rw [← add_mul, hab, one_mul] + nlinarith only [hmul₁, hmul₂, hsum] + +/-- Removing the tip from the slit ball leaves a path-connected set. -/ +theorem isPathConnected_slit_ball_puncture + {q : ℂ} (hq : q.im = 0) {δ : ℝ} (hδ : 0 < δ) : + IsPathConnected ((ball q δ ∩ {z : ℂ | z.im ≠ 0 ∨ z.re ≤ q.re}) \ {q}) := by + let w : ℂ := q - (δ / 2 : ℝ) + have hwim : w.im = 0 := by simp only [w, Complex.sub_im, Complex.ofReal_im, sub_zero, hq] + have hwre : w.re < q.re := by + change (q - (δ / 2 : ℝ)).re < q.re + simp only [Complex.sub_re, Complex.ofReal_re] + linarith + have hwball : w ∈ ball q δ := by + rw [mem_ball, dist_eq_norm] + have heq : w - q = -((δ / 2 : ℝ) : ℂ) := by dsimp [w]; abel + rw [heq, norm_neg, Complex.norm_real, Real.norm_eq_abs, abs_of_pos (half_pos hδ)] + linarith + have hpath : IsPathConnected (ball q δ ∩ {z : ℂ | z.im ≠ 0 ∨ z.re < q.re}) := + (starConvex_slit_ball_negative hwim hwre hwball).isPathConnected ⟨hwball, Or.inr hwre⟩ + have heq : (ball q δ ∩ {z : ℂ | z.im ≠ 0 ∨ z.re ≤ q.re}) \ {q} = + ball q δ ∩ {z : ℂ | z.im ≠ 0 ∨ z.re < q.re} := by + ext z + constructor + · rintro ⟨⟨hzball, hzim | hzre⟩, hzne⟩ + · exact ⟨hzball, Or.inl hzim⟩ + · refine ⟨hzball, ?_⟩ + by_cases hzim : z.im = 0 + · right + apply lt_of_le_of_ne hzre + intro he + have hzq : z = q := Complex.ext he (hzim.trans hq.symm) + exact hzne hzq + · exact Or.inl hzim + · rintro ⟨hzball, hzim | hzre⟩ + · exact ⟨⟨hzball, Or.inl hzim⟩, fun he => hzim (he ▸ hq)⟩ + · exact ⟨⟨hzball, Or.inr hzre.le⟩, fun he => hzre.ne (congrArg Complex.re he)⟩ + exact heq.symm ▸ hpath + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2SpokePairTopology.lean b/LeanPool/GraphMinor/GM12/Section2SpokePairTopology.lean new file mode 100644 index 0000000000..6476747f92 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2SpokePairTopology.lean @@ -0,0 +1,155 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM12.Section2ArcHomotopy +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.Walks + +/-! +# A two-spoke region path is an arc + +For Case 1 of XII (2.1), page 244, a visit with different boundary +vertices uses two different radial edges. Their closures meet only +at the region hub. Concatenating the injective spoke parameterizations +therefore gives an injective path. Its interior stays in the region +when both spokes have their positive parts there. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Concatenate two injective paths which meet only at the prescribed +joining endpoint. -/ +theorem path_trans_injective_of_only_join + {X : Type*} [TopologicalSpace X] {a b c : X} (p : Path a b) (q : Path b c) + (hp : Function.Injective p) (hq : Function.Injective q) + (hcross : ∀ s t, p s = q t → s = 1 ∧ t = 0) : Function.Injective (p.trans q) := by + intro s t heq + by_cases hs : s.val ≤ 1 / 2 <;> by_cases ht : t.val ≤ 1 / 2 + · simp only [Path.trans_apply, hs, ht, ↓reduceDIte] at heq + have h := congrArg Subtype.val (hp heq) + apply Subtype.ext + dsimp only at h + linarith + · simp only [Path.trans_apply, hs, ht, ↓reduceDIte] at heq + have h := congrArg Subtype.val (hcross _ _ heq).2 + change 2 * t.val - 1 = 0 at h + exact (ht (by linarith)).elim + · simp only [Path.trans_apply, hs, ht, ↓reduceDIte] at heq + have h := congrArg Subtype.val (hcross _ _ heq.symm).2 + change 2 * s.val - 1 = 0 at h + exact (hs (by linarith)).elim + · simp only [Path.trans_apply, hs, ht, ↓reduceDIte] at heq + have h := congrArg Subtype.val (hq heq) + apply Subtype.ext + dsimp only at h + linarith + +/-- Two spokes to one hub, from distinct drawing vertices, form an +injective two-edge path. Their closures can meet only at the hub. -/ +theorem spoke_pair_path_injective + {S : Type*} [TopologicalSpace S] {K : Drawing S} + {e e' : Set S} {u v w : S} (he : e ∈ K.E) (he' : e' ∈ K.E) + (hends : closure e ∩ K.V = {u, w}) (hends' : closure e' ∩ K.V = {v, w}) + (huv : u ≠ v) (huw : u ≠ w) + (p : Path u w) (q : Path v w) (hp : Function.Injective p) (hq : Function.Injective q) + (hpr : range p = closure e) (hqr : range q = closure e') : + Function.Injective (p.trans q.symm) := by + have hee : e ≠ e' := by + intro heq + have hu : u ∈ closure e' ∩ K.V := by + rw [← heq, hends] + exact Or.inl rfl + rw [hends'] at hu + rcases hu with hu | hu + · exact huv hu + · exact huw hu + have hcross : ∀ s t, p s = q t → s = 1 ∧ t = 1 := by + intro s t heq + have hxE : p s ∈ closure e := hpr ▸ mem_range_self s + have hxE' : p s ∈ closure e' := heq.symm ▸ (hqr ▸ mem_range_self t) + have hxV : p s ∈ K.V := by + by_contra hn + have hxe : p s ∈ e := K.closure_diff_V he ▸ ⟨hxE, hn⟩ + have hxe' : p s ∈ e' := K.closure_diff_V he' ▸ ⟨hxE', hn⟩ + exact hee (K.edge_eq_of_mem he he' hxe hxe') + have hxw : p s = w := by + have hx : p s ∈ ({u, w} : Set S) := hends ▸ ⟨hxE, hxV⟩ + rcases hx with hx | hx + · have hx' : u ∈ ({v, w} : Set S) := hx ▸ (hends' ▸ ⟨hxE', hxV⟩) + rcases hx' with h | h + · exact (huv h).elim + · exact (huw h).elim + · exact hx + exact ⟨hp (hxw.trans p.target.symm), hq (heq.symm.trans (hxw.trans q.target.symm))⟩ + have hqs : Function.Injective q.symm := by + intro s t heq + have h := hq heq + have h' := congrArg unitInterval.symm h + simpa only [unitInterval.symm_symm] using h' + apply path_trans_injective_of_only_join p q.symm hp hqs + intro s t heq + obtain ⟨hs, ht⟩ := hcross s (unitInterval.symm t) heq + refine ⟨hs, ?_⟩ + have h := congrArg unitInterval.symm ht + simpa only [unitInterval.symm_symm, unitInterval.symm_one] using h + +/-- Two distinct parallel spokes form a simple closed traversal: +its only repeated parameter pair is the initial and final endpoint. +Hence it is injective on its half-open parameter interval. -/ +theorem parallel_spoke_pair_path_halfopen_injective + {S : Type*} [TopologicalSpace S] {K : Drawing S} + {e e' : Set S} {u w : S} (he : e ∈ K.E) (he' : e' ∈ K.E) (hee : e ≠ e') + (hends : closure e ∩ K.V = {u, w}) + (p q : Path u w) (hp : Function.Injective p) (hq : Function.Injective q) + (hpr : range p = closure e) (hqr : range q = closure e') : + InjOn (p.trans q.symm) (Ico (0 : unitInterval) 1) := by + have hcross : ∀ s t, p s = q t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + intro s t heq + have hxE : p s ∈ closure e := hpr ▸ mem_range_self s + have hxE' : p s ∈ closure e' := heq.symm ▸ (hqr ▸ mem_range_self t) + have hxV : p s ∈ K.V := by + by_contra hn + have hxe : p s ∈ e := K.closure_diff_V he ▸ ⟨hxE, hn⟩ + have hxe' : p s ∈ e' := K.closure_diff_V he' ▸ ⟨hxE', hn⟩ + exact hee (K.edge_eq_of_mem he he' hxe hxe') + have hx : p s ∈ ({u, w} : Set S) := hends ▸ ⟨hxE, hxV⟩ + rcases hx with hx | hx + · exact Or.inl ⟨hp (hx.trans p.source.symm), hq (heq.symm.trans (hx.trans q.source.symm))⟩ + · exact Or.inr ⟨hp (hx.trans p.target.symm), hq (heq.symm.trans (hx.trans q.target.symm))⟩ + intro s hs t ht heq + rcases joined_loop_eq p q hp hq hcross heq with h | h | h + · exact h + · exact ((ne_of_lt ht.2) h.2).elim + · exact ((ne_of_lt hs.2) h.1).elim + +/-- The interior of a two-spoke path stays in the region if the +positive part of each spoke stays there. -/ +theorem spoke_pair_path_interior_subset + {S : Type*} [TopologicalSpace S] {u v w : S} (p : Path u w) (q : Path v w) + {r : Set S} (hp : ∀ t, 0 < t.val → p t ∈ r) (hq : ∀ t, 0 < t.val → q t ∈ r) : + ∀ t ∈ Ioo (0 : unitInterval) 1, (p.trans q.symm) t ∈ r := by + intro t ht + rw [Path.trans_apply] + split_ifs with h + · apply hp + change 0 < 2 * t.val + have ht0 : 0 < t.val := ht.1 + linarith + · apply hq + change 0 < 1 - (2 * t.val - 1) + have ht1 : t.val < 1 := ht.2 + linarith + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2SpokePaths.lean b/LeanPool/GraphMinor/GM12/Section2SpokePaths.lean new file mode 100644 index 0000000000..30b2044577 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2SpokePaths.lean @@ -0,0 +1,150 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialFaces + +/-! +# Paths along radial spokes + +For the entry definition of XII page 243, an edge must be traced once +from the boundary vertex to the hub. A radial edge has distinct ends, +so XI's full edge parametrization is injective. Its open parameter +interval maps exactly to the edge, and every positive point lies in +the hub's region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 unitInterval + +/-- An injective parametrization of an edge closure with its two ends +as endpoints maps the open interval exactly onto the edge. -/ +theorem path_interior_image_of_edge_closure {S : Type*} [TopologicalSpace S] + {K : Drawing S} {e : Set S} (he : e ∈ K.E) {v c : S} + (hcap : closure e ∩ K.V = {v, c}) (hv : v ∈ K.V) (hc : c ∈ K.V) + (β : Path v c) (hinj : Function.Injective β) (hrange : range β = closure e) : + β '' Ioo (0 : I) 1 = e := by + apply Set.Subset.antisymm + · rintro x ⟨t, ht, rfl⟩ + have hcl : β t ∈ closure e := hrange ▸ mem_range_self t + have hnot : β t ∉ K.V := by + intro hV + have hm : β t ∈ ({v, c} : Set S) := hcap ▸ ⟨hcl, hV⟩ + rcases hm with h | h + · exact ht.1.ne' (hinj (h.trans β.source.symm)) + · exact ht.2.ne (hinj (h.trans β.target.symm)) + exact (K.closure_diff_V he).subset ⟨hcl, hnot⟩ + · intro x hx + have hxcl : x ∈ range β := hrange.symm ▸ subset_closure hx + obtain ⟨t, rfl⟩ := hxcl + refine ⟨t, ⟨?_, ?_⟩, rfl⟩ + · apply unitInterval.pos_iff_ne_zero.mpr + intro ht + rw [ht, β.source] at hx + exact edge_notMem_V he hx hv + · apply unitInterval.lt_one_iff_ne_one.mpr + intro ht + rw [ht, β.target] at hx + exact edge_notMem_V he hx hc + +/-- A radial edge incident with the hub of a region lies in that region. -/ +theorem spoke_subset_region {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hrad : PreRad (.drawing Γ) K) {r e : Set S} (hr : r ∈ Γ.R) + (he : e ∈ K.E) {c : S} (hc : c ∈ r) (hcV : c ∈ K.V) + (hce : c ∈ closure e) : e ⊆ r := by + obtain ⟨v, hv, r', hr', w, hw, hwV, hcap, her⟩ := spoke_ends hrad hS he + have hm : c ∈ ({v, w} : Set S) := hcap ▸ ⟨hce, hcV⟩ + have hcw : c = w := by + rcases hm with h | h + · exact (notMem_V_of_mem_region hr hc (h.symm ▸ hv)).elim + · exact h + have hrr : r' = r := region_eq_of_mem hr' hr (hcw ▸ hw) hc + exact hrr ▸ her + +/-- A half-edge at the original vertex extends to an injective spoke +path to the hub. The supplied half-edge is its first half. -/ +theorem exists_spoke_path_from_halfEdge {S : Type*} [TopologicalSpace S] [T2Space S] + {K : Drawing S} {η : Set S → I → S} (hη : EdgePar K η) + {v c : S} (i : halfEdges K η v) (hvc : v ≠ c) (hc : c ∈ K.V) + (hcap : closure i.val.1 ∩ K.V = {v, c}) : + ∃ β : Path v c, Function.Injective β ∧ range β = closure i.val.1 ∧ + β '' Ioo (0 : I) 1 = i.val.1 ∧ ∀ t, spoke η i.val t = β (halfT t) := by + have hce : c ∈ closure i.val.1 := by + have hm : c ∈ closure i.val.1 ∩ K.V := hcap.symm ▸ (Or.inr rfl) + exact hm.1 + obtain ⟨G, hG, hGi, hG0, hG1, hGrange, hGspoke⟩ := exists_edge_path hη i hvc hc hce + let β : Path v c := ⟨⟨G, hG⟩, hG0, hG1⟩ + have hv : v ∈ K.V := i.property.2 ▸ end_mem_V hη i.property.1 i.val.2 + exact ⟨β, hGi, hGrange, + path_interior_image_of_edge_closure i.property.1 hcap hv hc β hGi hGrange, hGspoke⟩ + +/-- The sector of a positive half-edge point determines the hub end of +that radial edge. The other end is its original vertex. -/ +theorem spoke_ends_of_halfEdge_point {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hrad : PreRad (.drawing Γ) K) {η : Set S → I → S} (hη : EdgePar K η) + {v c : S} (hv : v ∈ Γ.V) (i : halfEdges K η v) + {r : Set S} (hr : r ∈ Γ.R) (hc : c ∈ r) (hcV : c ∈ K.V) + {t : I} (ht : 0 < t) (htr : spoke η i.val t ∈ r) : + closure i.val.1 ∩ K.V = {v, c} := by + obtain ⟨v', hv', r', hr', w, hw, hwV, hcap, her⟩ := spoke_ends hrad hS i.property.1 + have hpoint : spoke η i.val t ∈ i.val.1 := spoke_mem_edge hη i.property.1 ht + have hrr : r' = r := region_eq_of_mem hr' hr (her hpoint) htr + subst r' + have hwc : w = c := hub_unique hrad hr hc hcV hw hwV + subst w + have hvcl : v ∈ closure i.val.1 := by + have hm := end_mem_closure hη i.property.1 i.val.2 + rw [i.property.2] at hm + exact hm + have hvm : v ∈ ({v', c} : Set S) := hcap ▸ ⟨hvcl, radial_V hrad hv⟩ + have hvv : v = v' := by + rcases hvm with h | h + · exact h + · exact (notMem_V_of_mem_region hr hc (h ▸ hv)).elim + exact hvv ▸ hcap + +/-- Read a spoke path in the region with its initial vertex added. +The underlying parametrization, its injectivity, and its edge image are +preserved. -/ +theorem exists_path_in_region_vertex {S : Type*} [TopologicalSpace S] + {r : Set S} {v c : S} (hc : c ∈ r) (β : Path v c) + (hβ : ∀ t, 0 < t → β t ∈ r) : + ∃ q : Path (⟨v, Or.inr rfl⟩ : (r ∪ {v} : Set S)) ⟨c, Or.inl hc⟩, + ∀ t, (q t).val = β t := by + have hmem : ∀ t, β t ∈ r ∪ {v} := by + intro t + by_cases ht : t = 0 + · right + rw [ht, β.source] + exact mem_singleton _ + · exact Or.inl (hβ t (unitInterval.pos_iff_ne_zero.mpr ht)) + exact ⟨{ + toFun := fun t => ⟨β t, hmem t⟩ + continuous_toFun := β.continuous.subtype_mk _ + source' := Subtype.ext β.source + target' := Subtype.ext β.target }, fun _ => rfl⟩ + +/-- Every positive point of a path parametrizing an edge in a region +lies in the region, provided its terminal endpoint does too. -/ +theorem path_positive_in_region {S : Type*} [TopologicalSpace S] + {r e : Set S} {v c : S} (β : Path v c) (hc : c ∈ r) + (hinterior : β '' Ioo (0 : I) 1 = e) (her : e ⊆ r) : + ∀ t, 0 < t → β t ∈ r := by + intro t ht + by_cases ht1 : t = 1 + · rw [ht1, β.target] + exact hc + · exact her (hinterior ▸ mem_image_of_mem β ⟨ht, unitInterval.lt_one_iff_ne_one.mpr ht1⟩) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2SpokeUniqueness.lean b/LeanPool/GraphMinor/GM12/Section2SpokeUniqueness.lean new file mode 100644 index 0000000000..629b1886ee --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2SpokeUniqueness.lean @@ -0,0 +1,101 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Cited +import LeanPool.GraphMinor.GM11.Section7b +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM12.Section2ArcHomotopy +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Homotopy distinguishes radial spokes + +For the omitted uniqueness argument in XII, page 243, two different +spokes with the same ends form a circle. If their paths were homotopic +in the region together with the original vertex, this circle would be +null-homotopic there. XI (7.2) would then give a closed disc there, +contrary to condition (iv) of the pre-radial drawing. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +universe u + +/-- The homotopy part of entry-edge uniqueness in XII, page 243. Two +spokes from the same vertex into a region cannot be homotopic there +unless they are the same edge. XI (7.2) is used over its own surface +and circle, before the radial condition excludes the resulting disc. -/ +theorem spoke_eq_of_paths_homotopic + {S : Type u} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + {r e f : Set S} {v w : S} (hr : r ∈ Γ.R) (hv : v ∈ Γ.V) + (hw : w ∈ r ∩ K.V) (he : e ∈ K.E) (hf : f ∈ K.E) + (hendsE : closure e ∩ K.V = {v, w}) (hendsF : closure f ∩ K.V = {v, w}) + (p q : Path (⟨v, Or.inr (mem_singleton v)⟩ : (r ∪ {v} : Set S)) ⟨w, Or.inl hw.1⟩) + (hp : Function.Injective p) (hq : Function.Injective q) + (hpRange : range (fun t => (p t).val) = closure e) + (hqRange : range (fun t => (q t).val) = closure f) + (hh : p.Homotopic q) : e = f := by + have h72 : GM11Theorem72Statement.{u} := by + intro T _ _ hT hconn Z F hF hFZ hn + let := hconn + exact GM11.theorem_7_2_proof hT hF hFZ hn + by_contra hef + have hcross : ∀ s t, p s = q t → + (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + intro s t hst + have hxE : (p s).val ∈ closure e := hpRange ▸ mem_range_self s + have hxF : (p s).val ∈ closure f := hst ▸ (hqRange ▸ mem_range_self t) + have hxV : (p s).val ∈ K.V := by + by_contra hx + have hxe : (p s).val ∈ e := K.closure_diff_V he ▸ ⟨hxE, hx⟩ + have hxf : (p s).val ∈ f := K.closure_diff_V hf ▸ ⟨hxF, hx⟩ + exact hef (K.edge_eq_of_mem he hf hxe hxf) + have hxends : (p s).val ∈ ({v, w} : Set S) := hendsE ▸ ⟨hxE, hxV⟩ + rcases hxends with hx | hx + · have hp0 : p s = p 0 := Subtype.ext (hx.trans (congrArg Subtype.val p.source).symm) + have hq0 : q t = q 0 := Subtype.ext + ((congrArg Subtype.val hst).symm.trans (hx.trans (congrArg Subtype.val q.source).symm)) + exact Or.inl ⟨hp hp0, hq hq0⟩ + · have hxw : (p s).val = w := mem_singleton_iff.mp hx + have hp1 : p s = p 1 := Subtype.ext (hxw.trans (congrArg Subtype.val p.target).symm) + have hq1 : q t = q 1 := Subtype.ext + ((congrArg Subtype.val hst).symm.trans (hxw.trans (congrArg Subtype.val q.target).symm)) + exact Or.inr ⟨hp hp1, hq hq1⟩ + have hn := nullHomotopic_union_of_homotopic_arcs p q hp hq hcross hh + have hmap := nullHomotopic_oArc_image (f := fun x : (r ∪ {v} : Set S) => x.val) + IsEmbedding.subtypeVal hn + have himg : (fun x : (r ∪ {v} : Set S) => x.val) '' (range p ∪ range q) = closure e ∪ closure f + := by + rw [Set.image_union, ← Set.range_comp, ← Set.range_comp] + exact congrArg₂ Set.union hpRange hqRange + have huniv : (fun x : (r ∪ {v} : Set S) => x.val) '' univ = r ∪ {v} := by + ext x + simp + rw [himg, huniv] at hmap + have hsub : closure e ∪ closure f ⊆ r ∪ {v} := by + rintro x (hx | hx) + · rw [← hpRange] at hx + obtain ⟨t, rfl⟩ := hx + exact (p t).property + · rw [← hqRange] at hx + obtain ⟨t, rfl⟩ := hx + exact (q t).property + have hO : IsOArc (closure e ∪ closure f) := ⟨hmap.choose⟩ + obtain ⟨Δ, hΔsub, hΔ, hΔbd⟩ := h72 S hS hConn _ _ hO hsub hmap + exact hK.2.2.2.2.2 e he f hf hef v hv r hr w hw hendsE hendsF + ⟨Δ, hΔ, hΔsub, hΔbd⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2StarChart.lean b/LeanPool/GraphMinor/GM12/Section2StarChart.lean new file mode 100644 index 0000000000..9c476275b6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2StarChart.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import Mathlib.Analysis.Convex.Star +import Mathlib.Analysis.Convex.PathConnected + +/-! +# Contracting star-convex chart patches + +For the leaf-entry patch of XII, page 243, the slit coordinate ball +is star-convex at the restored leaf point. A chart carries its +straight-line contraction to the surface. A continuous chart inverse +lifts each loop, so the contraction stays inside the chosen patch. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- A chart image of a star-convex patch is simply connected. The +inverse conditions are needed only on that patch. -/ +theorem image_starConvex_isSimplyConnected + {S : Type*} [TopologicalSpace S] {j : S → ℂ} {g : ℂ → S} {A : Set ℂ} {q : ℂ} + (hg : ContinuousOn g A) (hj : ContinuousOn j (g '' A)) + (hinv : ∀ z ∈ A, j (g z) = z) (hstar : StarConvex ℝ q A) (hq : q ∈ A) : + IsSimplyConnectedSet (g '' A) := by + refine ⟨(hstar.isPathConnected hq).image' hg, ?_⟩ + intro φ hφ + have hθ : Continuous (fun z => j (φ z)) := + hj.comp_continuous φ.continuous (fun z => hφ (mem_range_self z)) + have hθA : ∀ z, j (φ z) ∈ A := by + intro z + obtain ⟨w, hw, he⟩ := hφ (mem_range_self z) + rw [← he, hinv w hw] + exact hw + let κ : Circle × unitInterval → ℂ := fun z => + z.2.val • q + (1 - z.2.val) • j (φ z.1) + have hκc : Continuous κ := by + exact ((continuous_subtype_val.comp continuous_snd).smul continuous_const).add + ((continuous_const.sub (continuous_subtype_val.comp continuous_snd)).smul + (hθ.comp continuous_fst)) + have hκA : ∀ z, κ z ∈ A := fun z => hstar (hθA z.1) + z.2.property.1 (sub_nonneg.mpr z.2.property.2) (by ring) + let H : C(Circle × unitInterval, S) := + ⟨fun z => g (κ z), hg.comp_continuous hκc hκA⟩ + refine ⟨g q, mem_image_of_mem g hq, H, fun z => mem_image_of_mem g (hκA z), ?_, ?_⟩ + · intro z + change g ((0 : ℝ) • q + (1 - (0 : ℝ)) • j (φ z)) = φ z + simp only [sub_zero, one_smul, zero_smul, zero_add] + obtain ⟨w, hw, he⟩ := hφ (mem_range_self z) + rw [← he, hinv w hw] + · intro z + change g ((1 : ℝ) • q + (1 - (1 : ℝ)) • j (φ z)) = g q + simp + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2StraightArcChart.lean b/LeanPool/GraphMinor/GM12/Section2StraightArcChart.lean new file mode 100644 index 0000000000..4c0b749e99 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2StraightArcChart.lean @@ -0,0 +1,81 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscMerge +import LeanPool.GraphMinor.Surface.ArcDisc + +/-! +# Straight coordinates for an arc in a surface chart + +For the leaf-entry patch of XII, page 243, an incident edge is first +restricted to a chart. Straighten its plane image and use polar strip +coordinates around the unit circle. Composing with the surface chart +puts the original arc on a real interval. This version allows an +arbitrary universe for the ambient surface; the plane straightening +itself still takes place in the complex plane. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric Complex Surface + +/-- An arc contained in a ball chart has open injective coordinates +in which it is an increasing real interval. -/ +theorem exists_straight_arc_chart + {S : Type*} [TopologicalSpace S] + (hman : ∀ x : S, IsManifoldPoint x) + {R : ℝ} {U : Set S} {h : S → ℂ} {g : ℂ → S} + (c : BallChart R U h g) {a : unitInterval → S} (ha : IsArcMap a) (hU : range a ⊆ U) : + ∃ (O : Set ℂ) (K : ℂ → S) (θ : unitInterval → ℝ), + IsOpen O ∧ ContinuousOn K O ∧ InjOn K O ∧ + (∀ W : Set ℂ, IsOpen W → W ⊆ O → IsOpen (K '' W)) ∧ + Continuous θ ∧ StrictMono θ ∧ ∀ t, (θ t : ℂ) ∈ O ∧ K (θ t) = a t := by + have hac : Continuous (fun t => h (a t)) := + c.hc.comp_continuous ha.1 (fun t => hU (mem_range_self t)) + have hai : Function.Injective (fun t => h (a t)) := by + intro s t he + apply ha.2 + have he' := congrArg g he + simpa only [c.gh (hU (mem_range_self s)), c.gh (hU (mem_range_self t))] using he' + obtain ⟨G, θ, hθc, hθm, hθr, hGa⟩ := exists_straight (a := fun t => h (a t)) ⟨hac, hai⟩ + let P : ℂ → ℂ := fun z => G.symm (((1 + z.im : ℝ) : ℂ) * exp ((z.re : ℂ) * I)) + have hPc : Continuous P := by + dsimp [P] + fun_prop + let O : Set ℂ := {z | z.re ∈ Ioo (-Real.pi) Real.pi ∧ z.im ∈ Ioo (-1 : ℝ) 1 ∧ P z ∈ ball 0 R} + have hOo : IsOpen O := + (isOpen_Ioo.preimage continuous_re).inter + ((isOpen_Ioo.preimage continuous_im).inter (isOpen_ball.preimage hPc)) + have hKc : ContinuousOn (fun z => g (P z)) O := + c.gc.comp hPc.continuousOn (fun _ hz => hz.2.2) + have hKi : InjOn (fun z => g (P z)) O := by + intro z hz w hw he + have h1 : P z = P w := by + have he' := congrArg h he + simpa only [c.hg hz.2.2, c.hg hw.2.2] using he' + have h2 := exp_strip_inj hz.1 hw.1 (by linarith [hz.2.1.1]) + (by linarith [hw.2.1.1]) (G.symm.injective h1) + exact Complex.ext h2.1 h2.2 + refine ⟨O, fun z => g (P z), θ, hOo, hKc, hKi, ?_, hθc, hθm, ?_⟩ + · intro W hW hWO + exact isOpen_image_of_manifold hW (hKc.mono hWO) (hKi.mono hWO) (fun _ _ => hman _) + · intro t + have hP : P (θ t) = h (a t) := by + simp only [P, ofReal_re, ofReal_im, add_zero, ofReal_one, one_mul] + rw [← hGa, G.symm_apply_apply] + refine ⟨⟨by simpa using hθr t, by simp, ?_⟩, ?_⟩ + · rw [hP] + exact c.hm (hU (mem_range_self t)) + · simp only [hP] + exact c.gh (hU (mem_range_self t)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TangleTraceExistence.lean b/LeanPool/GraphMinor/GM12/Section2TangleTraceExistence.lean new file mode 100644 index 0000000000..9cb9559050 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TangleTraceExistence.lean @@ -0,0 +1,47 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TraceExistence +import LeanPool.GraphMinor.GM12.Section2NonemptyEdges +import LeanPool.GraphMinor.GM12.Section2Zero + +/-! +# Traces below a tangle order + +In XII (2.1) and the proof of (3.2), pages 243--246, the normal +curve length is below the tangle order. A zero-length curve has its +one-vertex trace without an edge assumption. At positive length, +the tangle order is at least two and X (2.3) supplies a drawing edge, +so the full trace construction applies. +-/ + +public section + +namespace GraphMinor.GM12 + +open Surface GM11 + +/-- Every normal finite-length curve below a tangle order has a trace, +including the case where the drawing has no edges. -/ +theorem exists_trace_of_curveLength_lt_tangle_order + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {φ : C(Circle, S)} (hφ : IsNormalCurve Γ φ) (hlen : curveLength Γ φ < θ) : + ∃ (u : S) (W : GraphWalk K.toGraph u u), IsTrace Γ K φ W := by + by_cases hzero : curveLength Γ φ = 0 + · exact exists_trace_of_length_zero hK hφ hzero + · have hθ : 2 ≤ θ := by omega + have hE : Γ.E.Nonempty := edges_nonempty_of_tangle_order_two hT hθ + exact exists_trace hS hK hE hφ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TerminalPatch.lean b/LeanPool/GraphMinor/GM12/Section2TerminalPatch.lean new file mode 100644 index 0000000000..98613d3e57 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TerminalPatch.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2CommonCornerEntry +import LeanPool.GraphMinor.GM11.Regions + +/-! +# Shortening real approaches into a corner patch + +For the local comparison in XII (2.1), pages 243--244, continuity +puts the end of each approach in the chosen neighbourhood of its +vertex. Its other points are in the region, so local coverage puts +them in the corner patch. The common-patch comparison then applies +without requiring normalized paths in its hypotheses. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A terminal real interval lies in a patch whenever the patch +contains the region part of a neighbourhood of the limiting vertex. -/ +theorem exists_terminal_interval_in_patch + {S : Type*} [TopologicalSpace S] {f : ℝ → S} (hf : Continuous f) + {a c : ℝ} (hac : a < c) {r N X : Set S} {v : S} + (hfc : f c = v) (hfr : ∀ t ∈ Ioo a c, f t ∈ r) + (hN : IsOpen N) (hvN : v ∈ N) (hvX : v ∈ X) (hcover : N ∩ r ⊆ X) : + ∃ s ∈ Ioo a c, ∀ t ∈ Icc s c, f t ∈ X := by + obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.mp + ((hN.preimage hf).mem_nhds (hfc.symm ▸ hvN)) + let δ := min ((c - a) / 2) (ε / 2) + have hδ : 0 < δ := lt_min (by linarith) (by linarith) + have hδa : δ ≤ (c - a) / 2 := min_le_left _ _ + have hδε : δ ≤ ε / 2 := min_le_right _ _ + refine ⟨c - δ, ⟨by linarith, by linarith⟩, ?_⟩ + intro t ht + by_cases htc : t = c + · simpa only [htc, hfc] using hvX + · apply hcover + refine ⟨hball ?_, hfr t ⟨by linarith [ht.1], lt_of_le_of_ne ht.2 htc⟩⟩ + change dist t c < ε + rw [Real.dist_eq] + exact abs_lt.mpr ⟨by linarith [ht.1], by linarith [ht.2]⟩ + +/-- Two approaches in a region have the same entry edge if a normal +patch covers that region near their common limiting vertex. -/ +theorem entersLike_edge_eq_of_normal_patch + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {r e e' N X : Set S} {v w : S} (hr : r ∈ Γ.R) (hv : v ∈ Γ.V) + (hw : w ∈ r ∩ K.V) (he : e ∈ K.E) (he' : e' ∈ K.E) + (hN : IsOpen N) (hvN : v ∈ N) (hvX : v ∈ X) + (hX : IsSimplyConnectedSet X) (hXZ : X ⊆ r ∪ {v}) + (hpuncture : IsPathConnected (X \ {v})) (hcover : N \ Γ.U ⊆ X) + {f g : ℝ → S} (hf : Continuous f) (hg : Continuous g) + {a c b d : ℝ} (hac : a < c) (hbd : b < d) + (hfc : f c = v) (hgd : g d = v) + (hfr : ∀ z ∈ Ioo a c, f z ∈ r) (hgr : ∀ z ∈ Ioo b d, g z ∈ r) + (hentry : EntersLike f a c e r v w) (hentry' : EntersLike g b d e' r v w) : e = e' := by + have hNr : N ∩ r ⊆ X := fun _ hz => hcover ⟨hz.1, region_subset hr hz.2⟩ + obtain ⟨s, hs, hfX⟩ := exists_terminal_interval_in_patch hf hac hfc hfr hN hvN hvX hNr + obtain ⟨t, ht, hgX⟩ := exists_terminal_interval_in_patch hg hbd hgd hgr hN hvN hvX hNr + have hXR : X \ {v} ⊆ r := by + intro z hz + exact (hXZ hz.1).resolve_right hz.2 + exact entersLike_edge_eq_of_common_terminal_patch hS hConn hK hr hv hw he he' + hX hXZ hpuncture hXR hf hg hs ht hfc hgd hfr hgr hentry hentry' hfX hgX + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TerminalSectors.lean b/LeanPool/GraphMinor/GM12/Section2TerminalSectors.lean new file mode 100644 index 0000000000..f68b5a554e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TerminalSectors.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2Corners +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# The terminal sector of a real normal approach + +For trace restriction in XII (2.1), pages 243--244, fix one sector +system at the common vertex. Every incoming or reversed outgoing +approach stays in one of these sectors near that vertex. Normalize +the approach backwards and apply the connected-sector selection +lemma, retaining a terminal real interval in the sector interior. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A continuous normal approach has a terminal interval in one +of the prescribed sector interiors and in that corner's region. -/ +theorem exists_terminal_sector_of_approach + {S : Type*} [TopologicalSpace S] [T2Space S] {Γ : Drawing S} + {γ : Set S → unitInterval → S} {v : S} + {next : halfEdges Γ γ v → halfEdges Γ γ v} + {ρ P Q : halfEdges Γ γ v → Set S} {W : Set S} + {τ : halfEdges Γ γ v → unitInterval} + (hsec : IsSectors Γ γ v next ρ P W Q τ) + (hcover : W \ Γ.U ⊆ ⋃ k, Q k) + {f : ℝ → S} (hf : Continuous f) {a c : ℝ} (hac : a < c) (hfc : f c = v) + (hoff : ∀ t ∈ Ioo a c, f t ∉ Γ.U) : + ∃ (k : halfEdges Γ γ v) (h : ℝ), h ∈ Ioo a c ∧ + ∀ t ∈ Ico h c, f t ∈ ρ k ∩ (Q k \ discBd (Q k)) := by + let h₀ := (a + c) / 2 + have hh₀ : h₀ ∈ Ioo a c := ⟨by dsimp [h₀]; linarith, by dsimp [h₀]; linarith⟩ + have hpos : 0 < c - h₀ := sub_pos.mpr hh₀.2 + let g : unitInterval → S := fun t => f (c - t.val * (c - h₀)) + have hg : Continuous g := hf.comp (by fun_prop) + have hg0 : g 0 = v := by simpa only [g, Icc.coe_zero, zero_mul, sub_zero] using hfc + have hgoff : ∀ t, 0 < t → g t ∉ Γ.U := by + intro t ht + apply hoff + constructor + · have hle := mul_le_of_le_one_left hpos.le t.property.2 + linarith [hh₀.1] + · have hp := mul_pos (show (0 : ℝ) < t.val from ht) hpos + linarith + obtain ⟨k, ε, hε, hεQ, hερ⟩ := initially_in_given_corner hsec hcover hg hg0 hgoff + obtain ⟨δ, hδ, hδε, hδW⟩ := GM11.exists_pos_le hg hsec.isOpen + (hg0.symm ▸ hsec.mem) hε + let h := c - δ.val * (c - h₀) + have hh : h ∈ Ioo a c := by + constructor + · have hle := mul_le_of_le_one_left hpos.le δ.property.2 + dsimp only [h] + linarith [hh₀.1] + · have hp := mul_pos (show (0 : ℝ) < δ.val from hδ) hpos + dsimp only [h] + linarith + have hlocal : ∀ t ∈ Ico h c, f t ∈ ρ k ∩ (Q k \ discBd (Q k)) := by + intro t ht + let s : unitInterval := ⟨(c - t) / (c - h₀), + div_nonneg (sub_nonneg.mpr ht.2.le) hpos.le, by + apply (div_le_one hpos).mpr + have hle := mul_le_of_le_one_left hpos.le δ.property.2 + dsimp only [h] at ht + linarith [ht.1]⟩ + have hs : 0 < s := div_pos (sub_pos.mpr ht.2) hpos + have hsδ : s ≤ δ := by + change (c - t) / (c - h₀) ≤ δ.val + apply (div_le_iff₀ hpos).mpr + dsimp only [h] at ht + linarith [ht.1] + have hgs : g s = f t := by + change f (c - (c - t) / (c - h₀) * (c - h₀)) = f t + congr 1 + field_simp [ne_of_gt hpos] + ring + have hQ : g s ∈ Q k := hεQ s (hsδ.trans hδε) + have hnot : g s ∉ discBd (Q k) := fun hbd => + hgoff s hs (hsec.bdU k ⟨hδW s hsδ, hbd⟩) + rw [← hgs] + exact ⟨hερ s hs (hsδ.trans hδε), hQ, hnot⟩ + exact ⟨k, h, hh, hlocal⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2Theorem.lean b/LeanPool/GraphMinor/GM12/Section2Theorem.lean new file mode 100644 index 0000000000..5a46067451 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2Theorem.lean @@ -0,0 +1,86 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2Simple +import LeanPool.GraphMinor.GM12.Section2 +import LeanPool.GraphMinor.GM12.Section2TraceEdgeRestriction +import LeanPool.GraphMinor.GM12.Section2CurveCounts +import LeanPool.GraphMinor.GM12.Section2NonemptyEdges +import LeanPool.GraphMinor.GM12.Section2WalkInside + +/-! +# Graph Minors XII (2.1): the trace contains every relevant inside atom + +A trace has twice the length of its original normal curve, so its +inside is defined below the tangle order. For an embedded circle +in the image, parameterize it injectively. Its length is at most +the original curve length, since its drawing vertices are a subset +of the original image's drawing vertices. The restriction theorem +puts its trace inside the original trace. Apply the simple-curve +induction and monotonicity of walk insides. If the original curve +has length zero, use the region argument directly. This follows +the reduction and the two-case induction on pages 243--244. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Graph Minors XII, (2.1), pages 243--244. The trace is short enough +for its inside to be defined. Every atom meeting the tangle-selected +disc bounded by a circle in the original image meets that trace inside. +The selected disc explicitly represents `ins(F)` from the paper. -/ +theorem theorem_2_1_proof + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + {φ : C(Circle, S)} {u : S} (W : GraphWalk K.toGraph u u) + (hW : IsTrace Γ K φ W) (hlen : curveLength Γ φ < θ) + {F D c : Set S} (hF : IsOArc F) (hFφ : F ⊆ range φ) + (hD : IsClosedDisc D) (hbdD : subBd D = F) + (hmD : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + (hc : c ∈ Γ.A) (hcD : (c ∩ D).Nonempty) : + W.length < 2 * θ ∧ (c ∩ insWalk ins K W).Nonempty := by + refine ⟨theorem_2_1_length hW hlen, ?_⟩ + by_cases hzero : curveLength Γ φ = 0 + · exact theorem_2_1_zero hS hT hK.1 hW hzero hF hFφ hD hbdD hmD hc hcD + · have hpos : 0 < curveLength Γ φ := Nat.pos_of_ne_zero hzero + have hθ : 2 ≤ θ := by omega + have hE : Γ.E.Nonempty := edges_nonempty_of_tangle_order_two hT hθ + obtain ⟨H⟩ := hF + let ψ : C(Circle, S) := ⟨fun t => (H t).val, continuous_subtype_val.comp H.continuous⟩ + have hψrange : range ψ = F := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (H t).property + · intro hx + exact ⟨H.symm ⟨x, hx⟩, congrArg Subtype.val (H.apply_symm_apply ⟨x, hx⟩)⟩ + have hψemb : IsEmbedding ψ := IsEmbedding.subtypeVal.comp H.isEmbedding + have hsub : range ψ ⊆ range φ := hψrange ▸ hFφ + have hψn : Γ.IsNormal (range ψ) := fun x hx => hW.1.2 ⟨hsub hx.1, hx.2⟩ + have hψ : IsNormalCurve Γ ψ := isNormalCurve_of_injective ψ hψemb.injective hψn + have hψlen : curveLength Γ ψ ≤ curveLength Γ φ := by + rw [curveLength_eq_vertex_count ψ hψemb.injective hψn] + exact (Set.ncard_le_ncard (inter_subset_inter_left Γ.V hsub) + (Γ.finite_V.subset inter_subset_right)).trans (vertex_count_le_curveLength hW.1) + obtain ⟨v, P, hP, hPW⟩ := exists_trace_subdrawing_of_range_subset hS hK hE W hW hψ hsub + have hmeet := theorem_2_1_simple hS hT hrespect hK hd hψemb P hP + (hψlen.trans_lt hlen) hD (hbdD.trans hψrange.symm) hmD hc hcD + exact meets_insWalk_of_subdrawing ins K W P hPW hmeet + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2ThetaConstruction.lean b/LeanPool/GraphMinor/GM12/Section2ThetaConstruction.lean new file mode 100644 index 0000000000..cad76b9f9e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2ThetaConstruction.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2MinimalChord +public import LeanPool.GraphMinor.GM12.Section2RegionComponents +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.Surface.DiscMerge +import LeanPool.GraphMinor.GM11.RadialBasics + +/-! +# The theta graph in Case 2 of XII (2.1) + +On page 244, the proof cuts the original circle along a minimal chord +in a region visited more than once. The chord and the two original +arcs form a theta graph. The two new circles are normal, and each +original arc contains a drawing vertex because the chord ends lie in +different components of the region intersection. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The complete theta-graph construction of XII (2.1), Case 2, page +244. The two original arcs each contain vertices, while the chord lies +in a region and hence misses the drawing. -/ +theorem exists_theta_of_disconnected_region_intersection {S : Type*} [TopologicalSpace S] + [T2Space S] (hS : IsClosedSurface S) {Γ : Drawing S} {r F : Set S} + (hr : r ∈ Γ.R) (hF : IsOArc F) (hnormal : Γ.IsNormal F) + (hdisconn : ¬ IsPreconnected (F ∩ r)) : + ∃ (L A B : Set S) (a b : S), + IsLineWithEnds L a b ∧ IsLineWithEnds A a b ∧ IsLineWithEnds B a b ∧ + A ∪ B = F ∧ L ∩ A = {a, b} ∧ L ∩ B = {a, b} ∧ A ∩ B = {a, b} ∧ + L ⊆ r ∧ IsOArc (L ∪ A) ∧ IsOArc (L ∪ B) ∧ + Γ.IsNormal (L ∪ A) ∧ Γ.IsNormal (L ∪ B) ∧ + (A ∩ Γ.V).Nonempty ∧ (B ∩ Γ.V).Nonempty := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hrpath : IsPathConnected r := isPathConnected_of_isOpen hS + (region_isOpen hr) (region_isPreconnected hr) (region_nonempty hr) + obtain ⟨L, a, b, hL, hLr, ha, hb, hgap, hdiff⟩ := + exists_minimal_chord_between_components hrpath hF.isCompact.isClosed hdisconn + have hab : a ≠ b := by + intro heq + exact hdiff (congrArg (connectedComponentIn (F ∩ r)) heq) + obtain ⟨f, g, hfg, hf0, hf1, hfgF⟩ := hF.exists_arcs ha.1 hb.1 hab + let A := range f + let B := range g + have hA : IsLineWithEnds A a b := by + have hh := isLine_range hfg.arc_left.1 hfg.arc_left.2 + rw [hf0, hf1] at hh + exact hh + have hB : IsLineWithEnds B a b := by + have hh := isLine_range hfg.arc_right.1 hfg.arc_right.2 + rw [hfg.zero, hfg.one, hf0, hf1] at hh + exact hh + have hAF : A ⊆ F := fun x hx => hfgF ▸ Or.inl hx + have hBF : B ⊆ F := fun x hx => hfgF ▸ Or.inr hx + have hAB : A ∩ B = {a, b} := by + have hh := hfg.inter + rwa [hf0, hf1] at hh + have hend : ∀ {C : Set S}, IsLineWithEnds C a b → ({a, b} : Set S) ⊆ C := by + intro C hC + obtain ⟨p, hp0, hp1⟩ := hC + rintro x (rfl | rfl) + · exact hp0 ▸ (p 0).property + · exact hp1 ▸ (p 1).property + have hcap : ∀ C : Set S, C ⊆ F → ({a, b} : Set S) ⊆ C → L ∩ C = {a, b} := by + intro C hCF hendC + apply Subset.antisymm + · intro x hx + by_contra hxends + exact Set.disjoint_left.mp hgap ⟨hx.1, hxends⟩ (hCF hx.2) + · intro x hx + exact ⟨hend hL hx, hendC hx⟩ + have hLA : L ∩ A = {a, b} := hcap A hAF (hend hA) + have hLB : L ∩ B = {a, b} := hcap B hBF (hend hB) + have hnorm : ∀ C : Set S, C ⊆ F → Γ.IsNormal (L ∪ C) := by + intro C hCF x hx + rcases hx.1 with hxL | hxC + · exact (region_subset hr (hLr hxL) hx.2).elim + · exact hnormal ⟨hCF hxC, hx.2⟩ + obtain ⟨hAV, hBV⟩ := both_arcs_meet_vertices hr hnormal hA hB hAF hBF ha.2 hdiff + exact ⟨L, A, B, a, b, hL, hA, hB, hfgF, hLA, hLB, hAB, hLr, + isOArc_union hL hA hLA.subset, isOArc_union hL hB hLB.subset, + hnorm A hAF, hnorm B hBF, hAV, hBV⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2ThetaDiscs.lean b/LeanPool/GraphMinor/GM12/Section2ThetaDiscs.lean new file mode 100644 index 0000000000..932ca8ea1f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2ThetaDiscs.lean @@ -0,0 +1,148 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2DiscChordSplit +import LeanPool.GraphMinor.GM12.Section2NormalNoncover + +/-! +# The union relation for the three insides of a theta graph + +In Case 2 of XII (2.1), page 244, the second tangle axiom rules out +covering the surface by the three selected discs. XI's theta-cover +lemma then puts one of the three lines in its opposite disc. Cutting +that disc along the line gives two subdiscs. Each is the selected disc +with the same boundary, since choosing the other disc would cover the +surface. Hence one selected disc is the union of the other two. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +private theorem line_ends_ne {S : Type*} [TopologicalSpace S] {L : Set S} {a b : S} + (h : IsLineWithEnds L a b) : a ≠ b := by + obtain ⟨f, hf0, hf1⟩ := h + intro hab + have heq : f 0 = f 1 := Subtype.ext (hf0.trans (hab.trans hf1.symm)) + exact zero_ne_one (f.injective heq) + +/-- If one line of a theta graph lies in its opposite disc, and the +three chosen discs do not cover the surface, that disc is the union of +the other two. This is the disc-cutting step in XII (2.1), Case 2. -/ +theorem theta_disc_union_of_chord_inside {S : Type*} [TopologicalSpace S] + [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {A₀ A₁ A₂ Δ₀ Δ₁ Δ₂ : Set S} {a b : S} + (l₀ : IsLineWithEnds A₀ a b) (l₁ : IsLineWithEnds A₁ a b) (l₂ : IsLineWithEnds A₂ a b) + (i₀₁ : A₀ ∩ A₁ = {a, b}) (i₁₂ : A₁ ∩ A₂ = {a, b}) (i₂₀ : A₂ ∩ A₀ = {a, b}) + (d₀ : IsClosedDisc Δ₀) (d₁ : IsClosedDisc Δ₁) (d₂ : IsClosedDisc Δ₂) + (f₀ : discBd Δ₀ = A₁ ∪ A₂) (f₁ : discBd Δ₁ = A₂ ∪ A₀) (f₂ : discBd Δ₂ = A₀ ∪ A₁) + (hinside : A₀ ⊆ Δ₀) (hnot : Δ₀ ∪ Δ₁ ∪ Δ₂ ≠ univ) : Δ₀ = Δ₁ ∪ Δ₂ := by + obtain ⟨E₁, E₂, hE₁, hE₂, hU, hb₁, hb₂⟩ := disc_split_with_boundary_arcs d₀ l₀ l₁ l₂ + i₁₂ i₀₁ (by rw [inter_comm]; exact i₂₀) f₀ hinside (line_ends_ne l₀) + have hE₁sub : E₁ ⊆ Δ₀ := fun _ hx => hU ▸ Or.inl hx + have hE₂sub : E₂ ⊆ Δ₀ := fun _ hx => hU ▸ Or.inr hx + have he₂ : E₂ = Δ₁ := by + by_contra hne + have hcov := cover_of_discBd_eq hS hE₂ d₁ (hb₂.trans f₁.symm) hne + apply hnot + apply Set.Subset.antisymm (subset_univ _) + intro x _ + have hm : x ∈ E₂ ∪ Δ₁ := hcov.symm ▸ mem_univ x + rcases hm with hx | hx + · exact Or.inl (Or.inl (hE₂sub hx)) + · exact Or.inl (Or.inr hx) + have he₁ : E₁ = Δ₂ := by + by_contra hne + have hbd : discBd E₁ = discBd Δ₂ := hb₁.trans ((union_comm _ _).trans f₂.symm) + have hcov := cover_of_discBd_eq hS hE₁ d₂ hbd hne + apply hnot + apply Set.Subset.antisymm (subset_univ _) + intro x _ + have hm : x ∈ E₁ ∪ Δ₂ := hcov.symm ▸ mem_univ x + rcases hm with hx | hx + · exact Or.inl (Or.inl (hE₁sub hx)) + · exact Or.inr hx + rw [he₁, he₂, union_comm] at hU + exact hU.symm + +/-- The theta-disc union assertion used in Case 2 of XII (2.1), page 244: +if the three insides do not cover the surface, one is the union of the +other two. -/ +theorem theta_disc_union_of_not_cover {S : Type*} [TopologicalSpace S] + [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {A₀ A₁ A₂ Δ₀ Δ₁ Δ₂ : Set S} {a b : S} + (l₀ : IsLineWithEnds A₀ a b) (l₁ : IsLineWithEnds A₁ a b) (l₂ : IsLineWithEnds A₂ a b) + (i₀₁ : A₀ ∩ A₁ = {a, b}) (i₁₂ : A₁ ∩ A₂ = {a, b}) (i₂₀ : A₂ ∩ A₀ = {a, b}) + (d₀ : IsClosedDisc Δ₀) (d₁ : IsClosedDisc Δ₁) (d₂ : IsClosedDisc Δ₂) + (f₀ : discBd Δ₀ = A₁ ∪ A₂) (f₁ : discBd Δ₁ = A₂ ∪ A₀) (f₂ : discBd Δ₂ = A₀ ∪ A₁) + (hnot : Δ₀ ∪ Δ₁ ∪ Δ₂ ≠ univ) : + Δ₀ = Δ₁ ∪ Δ₂ ∨ Δ₁ = Δ₂ ∪ Δ₀ ∨ Δ₂ = Δ₀ ∪ Δ₁ := by + by_cases h₀ : A₀ ⊆ Δ₀ + · exact Or.inl (theta_disc_union_of_chord_inside hS l₀ l₁ l₂ i₀₁ i₁₂ i₂₀ d₀ d₁ d₂ f₀ f₁ f₂ h₀ + hnot) + by_cases h₁ : A₁ ⊆ Δ₁ + · right; left + apply theta_disc_union_of_chord_inside hS l₁ l₂ l₀ i₁₂ i₂₀ i₀₁ d₁ d₂ d₀ f₁ f₂ f₀ h₁ + simpa only [union_assoc, union_left_comm, union_comm] using hnot + by_cases h₂ : A₂ ⊆ Δ₂ + · right; right + apply theta_disc_union_of_chord_inside hS l₂ l₀ l₁ i₂₀ i₀₁ i₁₂ d₂ d₀ d₁ f₂ f₀ f₁ h₂ + simpa only [union_assoc, union_left_comm, union_comm] using hnot + apply (hnot ?_).elim + apply theta_cover hS l₀ l₁ l₂ i₀₁ i₁₂ i₂₀ d₀ d₁ d₂ _ _ _ h₀ h₁ h₂ + · rw [IsClosedDisc.frontier_eq_discBd hS d₀, f₀] + · rw [IsClosedDisc.frontier_eq_discBd hS d₁, f₁] + · rw [IsClosedDisc.frontier_eq_discBd hS d₂, f₂] + +/-- An atom meeting one inside of such a theta graph meets at least one +of the other two, as used before applying the induction in XII (2.1). -/ +theorem meets_one_of_theta_disc_union {S : Type*} {C D₀ D₁ D₂ : Set S} + (hunion : D₀ = D₁ ∪ D₂ ∨ D₁ = D₂ ∪ D₀ ∨ D₂ = D₀ ∪ D₁) + (hC : (C ∩ D₀).Nonempty) : (C ∩ D₁).Nonempty ∨ (C ∩ D₂).Nonempty := by + obtain ⟨x, hxC, hx₀⟩ := hC + rcases hunion with h | h | h + · rw [h] at hx₀ + rcases hx₀ with hx₁ | hx₂ + · exact Or.inl ⟨x, hxC, hx₁⟩ + · exact Or.inr ⟨x, hxC, hx₂⟩ + · exact Or.inl ⟨x, hxC, h.symm ▸ Or.inr hx₀⟩ + · exact Or.inr ⟨x, hxC, h.symm ▸ Or.inl hx₀⟩ + +/-- The tangle and theta-disc step of Case 2 in Graph Minors XII, (2.1), +page 244. An atom meeting the original selected inside meets one of the +two smaller selected insides. The second tangle axiom supplies non-cover. -/ +theorem theorem_2_1_case2_disc_step {S : Type*} [TopologicalSpace S] + [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {Γ : PaintingOrDrawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) + {A₀ A₁ A₂ Δ₀ Δ₁ Δ₂ C : Set S} {a b : S} + (l₀ : IsLineWithEnds A₀ a b) (l₁ : IsLineWithEnds A₁ a b) (l₂ : IsLineWithEnds A₂ a b) + (i₀₁ : A₀ ∩ A₁ = {a, b}) (i₁₂ : A₁ ∩ A₂ = {a, b}) (i₂₀ : A₂ ∩ A₀ = {a, b}) + (d₀ : IsClosedDisc Δ₀) (d₁ : IsClosedDisc Δ₁) (d₂ : IsClosedDisc Δ₂) + (f₀ : discBd Δ₀ = A₁ ∪ A₂) (f₁ : discBd Δ₁ = A₂ ∪ A₀) (f₂ : discBd Δ₂ = A₀ ∪ A₁) + (n₀ : Γ.IsNormal (discBd Δ₀)) (n₁ : Γ.IsNormal (discBd Δ₁)) (n₂ : Γ.IsNormal (discBd Δ₂)) + (m₀ : (Γ.inter Δ₀, Γ.interOutside Δ₀) ∈ T) + (m₁ : (Γ.inter Δ₁, Γ.interOutside Δ₁) ∈ T) + (m₂ : (Γ.inter Δ₂, Γ.interOutside Δ₂) ∈ T) + (hC : (C ∩ Δ₀).Nonempty) : (C ∩ Δ₁).Nonempty ∨ (C ∩ Δ₂).Nonempty := by + have hnot : Δ₀ ∪ Δ₁ ∪ Δ₂ ≠ univ := by + intro hcov + exact not_cover_of_normal_frontiers hT d₀.isCompact.isClosed d₁.isCompact.isClosed + d₂.isCompact.isClosed + (by rwa [IsClosedDisc.frontier_eq_discBd hS d₀]) + (by rwa [IsClosedDisc.frontier_eq_discBd hS d₁]) + (by rwa [IsClosedDisc.frontier_eq_discBd hS d₂]) m₀ m₁ m₂ hcov + exact meets_one_of_theta_disc_union + (theta_disc_union_of_not_cover hS l₀ l₁ l₂ i₀₁ i₁₂ i₂₀ d₀ d₁ d₂ f₀ f₁ f₂ hnot) hC + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TraceComposition.lean b/LeanPool/GraphMinor/GM12/Section2TraceComposition.lean new file mode 100644 index 0000000000..b17befe784 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TraceComposition.lean @@ -0,0 +1,73 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM12.Section2EntryEnds +public import LeanPool.GraphMinor.GM11.Walks + +/-! +# Concatenating trace intervals + +The trace construction in XII, page 243, appends the two radial edges +for each region interval. Trace steps concatenate whenever their real +parameter intervals meet. The proof removes the first two edges of +the first sequence and appends to its remaining sequence. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Concatenate trace steps on adjacent real parameter intervals. -/ +theorem traceSteps_append {S : Type*} [TopologicalSpace S] + {Γ K : Drawing S} {f : ℝ → S} {a b c : ℝ} {u v w : S} + (W : GraphWalk K.toGraph u v) (W' : GraphWalk K.toGraph v w) + (hW : TraceSteps Γ K f a b W) (hW' : TraceSteps Γ K f b c W') : + TraceSteps Γ K f a c (W.append W') := by + cases hWcase : W with + | nil hv => + rw [hWcase] at hW + have hab : a = b := hW.1 + exact hab.symm ▸ hW' + | cons hl rest => + rw [hWcase] at hW + cases hrestcase : rest with + | nil hv => rw [hrestcase] at hW; exact hW.elim + | cons hl₂ rest => + rw [hrestcase] at hW + obtain ⟨d, had, hfa, hu, hfd, hwK, r, hr, hwr, hfr, hleave, henter, ht⟩ := hW + exact ⟨d, had, hfa, hu, hfd, hwK, r, hr, hwr, hfr, hleave, henter, + traceSteps_append rest W' ht hW'⟩ +termination_by W.length +decreasing_by + rw [hWcase, hrestcase] + simp only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +/-- Construct the two radial edges of a trace for one region interval +from the entry and exit witnesses of XII, page 243. -/ +theorem exists_traceSteps_two_edges {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hrad : GM11.PreRad (.drawing Γ) K) {f : ℝ → S} {a c : ℝ} (hac : a < c) + {u x w : S} (hfa : f a = u) (hu : u ∈ Γ.V) (hfc : f c = x) (hx : x ∈ Γ.V) + {r e e' : Set S} (hr : r ∈ Γ.R) (hw : w ∈ r) (hwK : w ∈ K.V) + (hfr : ∀ t ∈ Ioo a c, f t ∈ r) (he : e ∈ K.E) (he' : e' ∈ K.E) + (hleave : LeavesLike f a c e r u w) (henter : EntersLike f a c e' r x w) : + ∃ W : GraphWalk K.toGraph u x, + TraceSteps Γ K f a c W ∧ W.length = 2 ∧ W.edges = [e, e'] ∧ W.support = [u, w, x] := by + have hl := leavesLike_isLink hS hrad hr hu hw hwK he hfa hleave + have hl' := entersLike_isLink hS hrad hr hx hw hwK he' hfc henter + let W : GraphWalk K.toGraph u x := .cons hl (.cons hl'.symm (.nil hl'.left_mem)) + refine ⟨W, ?_, rfl, rfl, rfl⟩ + exact ⟨c, hac, hfa, hu, hfc, hwK, r, hr, hw, hfr, hleave, henter, rfl, hfc, hx⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TraceConstruction.lean b/LeanPool/GraphMinor/GM12/Section2TraceConstruction.lean new file mode 100644 index 0000000000..b92cf4fdbb --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TraceConstruction.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TracePartition +public import LeanPool.GraphMinor.GM12.Section2NormalEntryExistence +import LeanPool.GraphMinor.GM12.Section2RegionIntervals + +/-! +# Constructing trace steps from ordered hits + +For XII's trace definition on page 243, each consecutive pair of vertex +parameters bounds a curve segment in one region. Choose its radial hub, +then the entering and leaving edges, and concatenate the resulting +two-edge walks. The entry and exit lemmas include leaves, so every +vertex hit is covered. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Construct the trace walk over an ordered enumeration of vertex hits. +There are two +edges for each interval between successive hits, as required in XII's +trace definition, page 243. -/ +theorem exists_traceSteps_of_enumerated_hits {S : Type*} [TopologicalSpace S] + [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {Γ K : Drawing S} (hrad : PreRad (.drawing Γ) K) + (hmax : RadMax (.drawing Γ) K) (hE : Γ.E.Nonempty) + {f : ℝ → S} (hf : Continuous f) {n : ℕ} (t : Fin (n + 1) → ℝ) (ht : StrictMono t) + (hΓ : ∀ i, f (t i) ∈ Γ.V) + (hcover : ∀ s ∈ Icc (t 0) (t (Fin.last n)), f s ∈ Γ.U → s ∈ range t) : + ∃ W : GraphWalk K.toGraph (f (t 0)) (f (t (Fin.last n))), + TraceSteps Γ K f (t 0) (t (Fin.last n)) W ∧ W.length = 2 * n := by + apply exists_traceSteps_of_partition t hΓ (fun i => radial_V hrad (hΓ i)) + intro i + have hac : t i.castSucc < t i.succ := ht i.castSucc_lt_succ + have hoff := no_hit_between_consecutive_parameters t ht hcover i + obtain ⟨r, hr, hfr⟩ := exists_region_of_open_interval hf hac hoff + obtain ⟨w, ⟨hwr, hwK⟩, _⟩ := hrad.2.2.2.1 r hr + obtain ⟨e', he', henter⟩ := exists_entersLike hS hrad hmax hE + (hΓ i.succ) hr hwr hwK hf hac rfl hfr + obtain ⟨e, he, hleave⟩ := exists_leavesLike hS hrad hmax hE + (hΓ i.castSucc) hr hwr hwK hf hac rfl hfr + obtain ⟨W, hW, hlength, _, _⟩ := exists_traceSteps_two_edges hS hrad hac rfl (hΓ i.castSucc) + rfl (hΓ i.succ) hr hwr hwK hfr he he' hleave henter + exact ⟨W, hW, hlength⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TraceDeterminacy.lean b/LeanPool/GraphMinor/GM12/Section2TraceDeterminacy.lean new file mode 100644 index 0000000000..403f971d6c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TraceDeterminacy.lean @@ -0,0 +1,121 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TraceParameters +public import LeanPool.GraphMinor.GM12.Section2EntryUnique +import LeanPool.GraphMinor.GM11.RadialRegions + +/-! +# A trace is determined by its parameter interval + +For XII's trace definition on page 243, the next vertex visit is fixed +by normality. Its intervening region determines the radial hub, and +entry and exit uniqueness determine the two edges. Removing that pair +and repeating proves equality of the vertex and edge lists of traces +on the same interval. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +universe u + +/-- On a fixed real parameter interval, two sequences of trace steps +have the same edge and vertex lists. Entry-edge uniqueness uses the +proved XI (7.2), so no statement hypothesis remains. -/ +theorem traceSteps_walk_lists_unique + {S : Type u} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {f : ℝ → S} (hf : Continuous f) {a b : ℝ} {u v : S} + (W W' : GraphWalk K.toGraph u v) + (hW : TraceSteps Γ K f a b W) (hW' : TraceSteps Γ K f a b W') : + W.edges = W'.edges ∧ W.support = W'.support := by + cases hWcase : W with + | nil hv => + rw [hWcase] at hW + have hab : a = b := hW.1 + cases hW'case : W' with + | nil hv' => exact ⟨rfl, rfl⟩ + | cons hl' rest' => + rw [hW'case] at hW' + cases hrest'case : rest' with + | nil hv' => rw [hrest'case] at hW'; exact hW'.elim + | cons hl₂' rest' => + rw [hrest'case] at hW' + obtain ⟨c', hac', _, _, _, _, r', hr', _, _, _, _, ht'⟩ := hW' + have hcb := (traceSteps_parameters rest' ht').1 + exact (not_lt_of_ge (hab ▸ hcb) hac').elim + | @cons _ w _ e hl rest => + rw [hWcase] at hW + cases hrestcase : rest with + | nil hv => rw [hrestcase] at hW; exact hW.elim + | @cons _ x _ e₂ hl₂ rest => + rw [hrestcase] at hW + obtain ⟨c, hac, hfa, hu, hfc, hwK, r, hr, hwr, hfr, hleave, henter, ht⟩ := hW + obtain ⟨hcb, _, hx, _, _⟩ := traceSteps_parameters rest ht + cases hW'case : W' with + | nil hv' => + rw [hW'case] at hW' + have hab : a = b := hW'.1 + exact (not_lt_of_ge (hab ▸ hcb) hac).elim + | @cons _ w' _ e' hl' rest' => + rw [hW'case] at hW' + cases hrest'case : rest' with + | nil hv' => rw [hrest'case] at hW'; exact hW'.elim + | @cons _ x' _ e₂' hl₂' rest' => + rw [hrest'case] at hW' + obtain ⟨c', hac', hfa', hu', hfc', hwK', r', hr', hwr', hfr', hleave', henter', ht'⟩ + := hW' + have hx' := (traceSteps_parameters rest' ht').2.2.1 + have hcc : c = c' := next_vertex_parameter_unique hac hac' + (hfc.symm ▸ hx) (hfc'.symm ▸ hx') hr hr' hfr hfr' + subst c' + have hxx : x = x' := hfc.symm.trans hfc' + cases hxx + have hmid : (a + c) / 2 ∈ Ioo a c := ⟨by linarith, by linarith⟩ + have hrr : r = r' := region_eq_of_mem hr hr' (hfr _ hmid) (hfr' _ hmid) + subst r' + have hrad : PreRad (.drawing Γ) K := ⟨hK.1, hK.2.1⟩ + have hww : w' = w := hub_unique hrad hr hwr hwK hwr' hwK' + subst w' + have heq := leavesLike_edge_unique hS hConn hK hr hu ⟨hwr, hwK⟩ + hl.1 hl'.1 hl.2.2.2 hl'.2.2.2 hf hfa hfr hleave hleave' + have heq₂ := entersLike_edge_unique hS hConn hK hr hx ⟨hwr, hwK⟩ + hl₂.1 hl₂'.1 (hl₂.2.2.2.trans (pair_comm _ _)) + (hl₂'.2.2.2.trans (pair_comm _ _)) hf hfc hfr henter henter' + obtain ⟨hedges, hvertices⟩ := traceSteps_walk_lists_unique hS hConn hK hf rest _ ht ht' + simp only [GraphWalk.edges, GraphWalk.support, heq, heq₂, hedges, hvertices, and_self] +termination_by W.length +decreasing_by + rw [hWcase, hrestcase] + simp only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +/-- Trace steps on the same parameter interval give the same underlying +subdrawing. This is the drawing form of trace determinacy used when +comparing restrictions of curves. -/ +theorem traceSteps_drawing_unique + {S : Type u} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {f : ℝ → S} (hf : Continuous f) {a b : ℝ} {u v : S} + (W W' : GraphWalk K.toGraph u v) + (hW : TraceSteps Γ K f a b W) (hW' : TraceSteps Γ K f a b W') : + walkDrawing K W = walkDrawing K W' := by + obtain ⟨he, hv⟩ := traceSteps_walk_lists_unique hS hConn hK hf W W' hW hW' + apply Drawing.ext_of_V_E + · rw [walkDrawing_V, walkDrawing_V, hv] + · rw [walkDrawing_E, walkDrawing_E, he] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TraceEdgeRestriction.lean b/LeanPool/GraphMinor/GM12/Section2TraceEdgeRestriction.lean new file mode 100644 index 0000000000..0331634052 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TraceEdgeRestriction.lean @@ -0,0 +1,116 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2EntryImageRestriction +public import LeanPool.GraphMinor.GM12.Section2TraceVertexRestriction +import LeanPool.GraphMinor.GM12.Section2TraceExistence +import LeanPool.GraphMinor.GM12.Section2PeriodicHits +import LeanPool.GraphMinor.GM11.Section4 + +/-! +# Trace drawings shrink when curve images shrink + +For the restriction step of XII (2.1), pages 243--244, every edge +of the smaller trace is an entry or an exit along a region visit. +The image-entry restriction theorem puts it in the original trace. +The already proved vertex containment supplies the other part of +subdrawing containment. Trace existence then gives the desired +trace of a smaller normal curve. The result here assumes that the +original drawing has an edge. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +private theorem traceSteps_edges_subset_of_image + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {φ : C(Circle, S)} {u : S} (W : GraphWalk K.toGraph u u) (hW : IsTrace Γ K φ W) + {g : ℝ → S} (hg : Continuous g) (himage : ∀ t, g t ∈ range φ) + {a b : ℝ} {v z : S} (P : GraphWalk K.toGraph v z) (hP : TraceSteps Γ K g a b P) : + ∀ e ∈ P.edges, e ∈ W.edges := by + cases hPcase : P with + | nil hv => simp only [GraphWalk.edges, List.not_mem_nil, false_implies, implies_true] + | cons hlink rest => + rw [hPcase] at hP + cases hrestcase : rest with + | nil hv => rw [hrestcase] at hP; exact hP.elim + | cons hlink' tail => + rw [hrestcase] at hP + obtain ⟨c, hac, hga, hv, hgc, hwK, r, hr, hwr, hgr, hleave, henter, htail⟩ := hP + have hx := (traceSteps_parameters tail htail).2.2.1 + have hfirst := trace_mem_edges_of_leaving_in_image hS hK hE W hW hv hr + ⟨hwr, hwK⟩ hlink.1 hg hac hga hgr (fun t _ => himage t) hleave + have hsecond := trace_mem_edges_of_entry_in_image hS hK hE W hW hx hr + ⟨hwr, hwK⟩ hlink'.1 hg hac hgc hgr (fun t _ => himage t) henter + have hrest := traceSteps_edges_subset_of_image hS hK hE W hW hg himage tail htail + intro e he + simp only [GraphWalk.edges, List.mem_cons] at he + rcases he with rfl | rfl | he + · exact hfirst + · exact hsecond + · exact hrest e he +termination_by P.length +decreasing_by + simp_all only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +/-- The edge part of trace restriction in XII (2.1), pages 243--244, +for drawings with an edge. The smaller curve need not be injective. -/ +theorem trace_edges_subset_of_range_subset + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {φ ψ : C(Circle, S)} {u v : S} + (W : GraphWalk K.toGraph u u) (P : GraphWalk K.toGraph v v) + (hW : IsTrace Γ K φ W) (hP : IsTrace Γ K ψ P) (hsub : range ψ ⊆ range φ) : + (walkDrawing K P).E ⊆ (walkDrawing K W).E := by + rcases hP.2 with ⟨_, hlen, _⟩ | ⟨_, _, a, hsteps⟩ + · intro e he + rw [walkDrawing_E, (support_of_length_zero hlen).2] at he + exact (List.not_mem_nil he).elim + · have hmem := traceSteps_edges_subset_of_image hS hK hE W hW + (periodicCurve_continuous ψ) + (fun t => hsub (mem_range_self (Circle.exp (2 * Real.pi * t)))) P hsteps + intro e he + rw [walkDrawing_E] at he ⊢ + exact hmem e he + +/-- Both vertices and edges of a trace of a smaller curve image +belong to the original trace drawing, as used in XII (2.1). -/ +theorem trace_isSubdrawing_of_range_subset + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {φ ψ : C(Circle, S)} {u v : S} + (W : GraphWalk K.toGraph u u) (P : GraphWalk K.toGraph v v) + (hW : IsTrace Γ K φ W) (hP : IsTrace Γ K ψ P) (hsub : range ψ ⊆ range φ) : + (walkDrawing K P).IsSubdrawing (walkDrawing K W) := + ⟨trace_vertices_subset_of_range_subset hK W P hW hP hsub, + trace_edges_subset_of_range_subset hS hK hE W P hW hP hsub⟩ + +/-- Existence and containment of the trace under image restriction, +for the nonempty-edge case of the restriction step in XII (2.1). -/ +theorem exists_trace_subdrawing_of_range_subset + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {φ ψ : C(Circle, S)} {u : S} (W : GraphWalk K.toGraph u u) + (hW : IsTrace Γ K φ W) (hψ : IsNormalCurve Γ ψ) (hsub : range ψ ⊆ range φ) : + ∃ (v : S) (P : GraphWalk K.toGraph v v), IsTrace Γ K ψ P ∧ + (walkDrawing K P).IsSubdrawing (walkDrawing K W) := by + obtain ⟨v, P, hP⟩ := exists_trace hS hK hE hψ + exact ⟨v, P, hP, trace_isSubdrawing_of_range_subset hS hK hE W P hW hP hsub⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TraceExistence.lean b/LeanPool/GraphMinor/GM12/Section2TraceExistence.lean new file mode 100644 index 0000000000..41e8169070 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TraceExistence.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TraceConstruction +import LeanPool.GraphMinor.GM12.Section2HitOrder +import LeanPool.GraphMinor.GM12.Section2PeriodicHits +import LeanPool.GraphMinor.GM12.Section2CirclePeriod +import LeanPool.GraphMinor.GM12.Section2Zero + +/-! +# Existence of traces for every normal finite-length curve + +For XII's trace definition on page 243, order the hits in one closed +real period starting at a hit. Their number is the curve length plus +one, so the construction over consecutive intervals has twice the +curve length as its number of edges. Periodicity closes the walk. +Zero-length curves use their region's radial hub. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Every normal finite-length curve has a trace in the radial drawing. +This proves trace existence in XII, page 243, including the +exact length and real-parameter conditions in `IsTrace`. -/ +theorem exists_trace {S : Type*} [TopologicalSpace S] + [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hE : Γ.E.Nonempty) + {φ : C(Circle, S)} (hφ : IsNormalCurve Γ φ) : + ∃ (u : S) (W : GraphWalk K.toGraph u u), IsTrace Γ K φ W := by + by_cases hzero : curveLength Γ φ = 0 + · exact exists_trace_of_length_zero hK hφ hzero + have hpos : 0 < curveLength Γ φ := Nat.pos_of_ne_zero hzero + obtain ⟨z, hz⟩ := (Set.ncard_pos hφ.1).mp hpos + obtain ⟨a, _, haz⟩ := (circle_parameter_bijOn 0).surjOn (mem_univ z) + have haU : periodicCurve φ a ∈ Γ.U := by + change φ (Circle.exp (2 * Real.pi * a)) ∈ Γ.U + change Circle.exp (2 * Real.pi * a) = z at haz + rw [haz] + exact hz + let H : Set ℝ := {s | s ∈ Icc a (a + 1) ∧ periodicCurve φ s ∈ Γ.U} + obtain ⟨hH, hHcard⟩ := periodicCurve_closed_hits hφ haU + have hperiod : periodicCurve φ (a + 1) = periodicCurve φ a := periodicCurve_periodic φ a + have haH : a ∈ H := ⟨⟨le_rfl, by linarith⟩, haU⟩ + have hbH : a + 1 ∈ H := ⟨⟨by linarith, le_rfl⟩, hperiod.symm ▸ haU⟩ + obtain ⟨n, t, ht, ht0, htlast, htrange, hcard⟩ := + exists_ordered_interval_enumeration hH (fun _ hs => hs.1) haH hbH + have hΓ : ∀ i, periodicCurve φ (t i) ∈ Γ.V := by + intro i + have hiH : t i ∈ H := by + change t i ∈ {s | s ∈ Icc a (a + 1) ∧ periodicCurve φ s ∈ Γ.U} + rw [← htrange] + exact mem_range_self i + exact hφ.2 ⟨mem_range_self _, hiH.2⟩ + have hcover : ∀ s ∈ Icc (t 0) (t (Fin.last n)), periodicCurve φ s ∈ Γ.U → s ∈ range t := by + intro s hs hsU + rw [ht0, htlast] at hs + have hsH : s ∈ H := ⟨hs, hsU⟩ + exact htrange.symm ▸ hsH + have hn : n = curveLength Γ φ := by omega + have hpre : PreRad (.drawing Γ) K := ⟨hK.1, hK.2.1⟩ + have hex := exists_traceSteps_of_enumerated_hits hS hpre hK.2.2 hE + (periodicCurve_continuous φ) t ht hΓ hcover + have hclosed : ∃ W : GraphWalk K.toGraph (periodicCurve φ a) (periodicCurve φ a), + TraceSteps Γ K (periodicCurve φ) a (a + 1) W ∧ W.length = 2 * curveLength Γ φ := by + obtain ⟨W, hW, hlen⟩ := hex + have hlen' : W.length = 2 * curveLength Γ φ := hlen.trans (congrArg (fun n => 2 * n) hn) + have hex' : ∃ W : GraphWalk K.toGraph (periodicCurve φ (t 0)) (periodicCurve φ (t + (Fin.last n))), + TraceSteps Γ K (periodicCurve φ) (t 0) (t (Fin.last n)) W ∧ + W.length = 2 * curveLength Γ φ := ⟨W, hW, hlen'⟩ + rw [ht0, htlast, hperiod] at hex' + exact hex' + obtain ⟨W, hW, hlength⟩ := hclosed + exact ⟨periodicCurve φ a, W, hφ, Or.inr ⟨hpos, hlength, a, hW⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TraceGerms.lean b/LeanPool/GraphMinor/GM12/Section2TraceGerms.lean new file mode 100644 index 0000000000..30a63c3168 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TraceGerms.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TraceParameters +import LeanPool.GraphMinor.GM12.Section2TraceReverse +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.Walks + +/-! +# The two region germs at a trace vertex parameter + +For XII (2.1), pages 243--244, each parameter over a drawing vertex +has a recorded region visit on either side within the trace interval. +Locate the incoming visit by removing earlier visits. Reversing the +walk locates the outgoing visit. The endpoints of the whole interval +need only the side which lies inside that interval. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A noninitial vertex parameter has an incoming recorded region +interval and its entry edge belongs to the trace. -/ +theorem traceSteps_exists_incoming_germ + {S : Type*} [TopologicalSpace S] {Γ K : Drawing S} {f : ℝ → S} + {a b : ℝ} {u v : S} (W : GraphWalk K.toGraph u v) (hW : TraceSteps Γ K f a b W) + {s : ℝ} (hs : s ∈ Ioc a b) (hfs : f s ∈ Γ.V) : + ∃ (d : ℝ) (w : S) (r e : Set S), + a ≤ d ∧ d < s ∧ w ∈ K.V ∧ r ∈ Γ.R ∧ w ∈ r ∧ e ∈ W.edges ∧ + (∀ t ∈ Ioo d s, f t ∈ r) ∧ EntersLike f d s e r (f s) w := by + cases hWcase : W with + | nil hu => + rw [hWcase] at hW + exact (not_lt_of_ge (hs.2.trans_eq hW.1.symm) hs.1).elim + | cons hlink rest => + rw [hWcase] at hW + cases hrestcase : rest with + | nil hu => rw [hrestcase] at hW; exact hW.elim + | @cons _ x _ e hlink' tail => + rw [hrestcase] at hW + obtain ⟨c, hac, hfa, hu, hfc, hwK, r, hr, hwr, hfr, _, henter, htail⟩ := hW + have hcs : c ≤ s := by + by_contra hn + exact region_subset hr (hfr s ⟨hs.1, lt_of_not_ge hn⟩) (Γ.V_subset_U hfs) + by_cases hsc : s = c + · subst s + refine ⟨a, _, r, e, le_rfl, hac, hwK, hr, hwr, ?_, hfr, ?_⟩ + · simp only [GraphWalk.edges, List.mem_cons] + exact Or.inr (Or.inl trivial) + · simpa only [hfc] using henter + · obtain ⟨d, w, r, e, hcd, hds, hw, hr, hwr, he, hfr, henter⟩ := + traceSteps_exists_incoming_germ tail htail + ⟨lt_of_le_of_ne hcs (Ne.symm hsc), hs.2⟩ hfs + refine ⟨d, w, r, e, hac.le.trans hcd, hds, hw, hr, hwr, ?_, hfr, henter⟩ + simp only [GraphWalk.edges, List.mem_cons] + exact Or.inr (Or.inr he) +termination_by W.length +decreasing_by + simp_all only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +/-- A nonterminal vertex parameter has an outgoing recorded region +interval and its leaving edge belongs to the trace. -/ +theorem traceSteps_exists_outgoing_germ + {S : Type*} [TopologicalSpace S] {Γ K : Drawing S} {f : ℝ → S} + {a b : ℝ} {u v : S} (W : GraphWalk K.toGraph u v) (hW : TraceSteps Γ K f a b W) + {s : ℝ} (hs : s ∈ Ico a b) (hfs : f s ∈ Γ.V) : + ∃ (d : ℝ) (w : S) (r e : Set S), + d ≤ b ∧ s < d ∧ w ∈ K.V ∧ r ∈ Γ.R ∧ w ∈ r ∧ e ∈ W.edges ∧ + (∀ t ∈ Ioo s d, f t ∈ r) ∧ LeavesLike f s d e r (f s) w := by + obtain ⟨d, w, r, e, hbd, hds, hw, hr, hwr, he, hfr, hentry⟩ := + traceSteps_exists_incoming_germ W.reverse (traceSteps_reverse W hW) + (s := -s) ⟨neg_lt_neg hs.2, neg_le_neg hs.1⟩ (by simpa only [neg_neg] using hfs) + refine ⟨-d, w, r, e, ?_, ?_, hw, hr, hwr, ?_, ?_, ?_⟩ + · linarith + · linarith + · simpa only [GraphWalk.edges_reverse, List.mem_reverse] using he + · intro t ht + simpa only [neg_neg] using hfr (-t) ⟨by linarith [ht.2], by linarith [ht.1]⟩ + · simpa only [LeavesLike, neg_neg] using hentry + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TraceImage.lean b/LeanPool/GraphMinor/GM12/Section2TraceImage.lean new file mode 100644 index 0000000000..4af26a3af2 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TraceImage.lean @@ -0,0 +1,59 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TraceVisits +import LeanPool.GraphMinor.GM12.Section2CirclePeriod +import LeanPool.GraphMinor.GM11.Regions + +/-! +# The trace records atoms met by the curve image + +The restriction step of XII (2.1), pages 243--244, uses points of the +curve image rather than a fixed real parameter. Represent each such +point in the trace's one-period interval. The trace-step visit lemmas +then record its vertex or region. A zero-length trace records the +unique region directly. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A drawing vertex in the image of a traced curve is a vertex of +the trace walk. -/ +theorem trace_vertex_in_image + {S : Type*} [TopologicalSpace S] {Γ K : Drawing S} {φ : C(Circle, S)} + {u : S} (W : GraphWalk K.toGraph u u) (hW : IsTrace Γ K φ W) + {x : S} (hxφ : x ∈ range φ) (hxV : x ∈ Γ.V) : x ∈ W.support := by + obtain ⟨z, rfl⟩ := hxφ + rcases hW.2 with ⟨_, _, _, r, hr, hφr, _⟩ | ⟨_, _, a, hsteps⟩ + · exact (region_subset hr (hφr (mem_range_self z)) (Γ.V_subset_U hxV)).elim + · obtain ⟨s, hs, hsz⟩ := (circle_parameter_bijOn a).surjOn (mem_univ z) + have heq : periodicCurve φ s = φ z := congrArg φ hsz + exact heq ▸ traceSteps_vertex_visit W hsteps ⟨hs.1, hs.2.le⟩ (heq.symm ▸ hxV) + +/-- A region met by the image of a traced curve contains a walk +vertex, its recorded radial hub. -/ +theorem trace_region_in_image + {S : Type*} [TopologicalSpace S] {Γ K : Drawing S} {φ : C(Circle, S)} + {u : S} (W : GraphWalk K.toGraph u u) (hW : IsTrace Γ K φ W) + {r : Set S} (hr : r ∈ Γ.R) (hmeet : (range φ ∩ r).Nonempty) : + ∃ w ∈ W.support, w ∈ r := by + obtain ⟨x, ⟨z, rfl⟩, hzr⟩ := hmeet + rcases hW.2 with ⟨_, _, _, r', hr', hφr', hur'⟩ | ⟨_, _, a, hsteps⟩ + · have hrr : r' = r := region_eq_of_mem hr' hr (hφr' (mem_range_self z)) hzr + exact ⟨u, W.start_mem_support, hrr ▸ hur'⟩ + · obtain ⟨s, hs, hsz⟩ := (circle_parameter_bijOn a).surjOn (mem_univ z) + have heq : periodicCurve φ s = φ z := congrArg φ hsz + exact traceSteps_region_visit W hsteps ⟨hs.1, hs.2.le⟩ hr (heq.symm ▸ hzr) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TraceParameters.lean b/LeanPool/GraphMinor/GM12/Section2TraceParameters.lean new file mode 100644 index 0000000000..31d4887ed0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TraceParameters.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.Regions + +/-! +# Parameter endpoints of trace steps + +The trace definition in XII, page 243, divides a period of the curve +at its visits to vertices. This file records that each sequence of +steps has the stated endpoint images and nondecreasing parameter +bounds. It also proves uniqueness of the next vertex parameter: a +normal region segment cannot contain another vertex visit. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A sequence of trace steps has the claimed endpoint images, both +endpoints in the original vertex set, and nondecreasing parameter +bounds. This follows by removing the first two edges at each step. -/ +theorem traceSteps_parameters {S : Type*} [TopologicalSpace S] + {Γ K : Drawing S} {f : ℝ → S} {a b : ℝ} {u v : S} + (W : GraphWalk K.toGraph u v) (hW : TraceSteps Γ K f a b W) : + a ≤ b ∧ f a = u ∧ u ∈ Γ.V ∧ f b = v ∧ v ∈ Γ.V := by + cases hWcase : W with + | nil hv => + rw [hWcase] at hW + obtain ⟨rfl, hfu, hu⟩ := hW + exact ⟨le_rfl, hfu, hu, hfu, hu⟩ + | cons hlink rest => + rw [hWcase] at hW + cases hrestcase : rest with + | nil hv => + rw [hrestcase] at hW + exact hW.elim + | cons hlink' rest => + rw [hrestcase] at hW + obtain ⟨c, hac, hfa, hu, _, _, r, hr, _, _, _, _, hrest⟩ := hW + obtain ⟨hcb, _, _, hfb, hv⟩ := traceSteps_parameters rest hrest + exact ⟨hac.le.trans hcb, hfa, hu, hfb, hv⟩ +termination_by W.length +decreasing_by + simp_all only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +/-- The next vertex parameter of a region segment is unique. A smaller +candidate would place a vertex in the open region segment of the other +candidate, which normality excludes. -/ +theorem next_vertex_parameter_unique {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} {f : ℝ → S} {a c c' : ℝ} + (hac : a < c) (hac' : a < c') + (hc : f c ∈ Γ.V) (hc' : f c' ∈ Γ.V) + {r r' : Set S} (hr : r ∈ Γ.R) (hr' : r' ∈ Γ.R) + (hf : ∀ t ∈ Ioo a c, f t ∈ r) (hf' : ∀ t ∈ Ioo a c', f t ∈ r') : c = c' := by + apply le_antisymm + · by_contra hle + have hlt : c' < c := lt_of_not_ge hle + exact region_subset hr (hf c' ⟨hac', hlt⟩) (Γ.V_subset_U hc') + · by_contra hle + have hlt : c < c' := lt_of_not_ge hle + exact region_subset hr' (hf' c ⟨hac, hlt⟩) (Γ.V_subset_U hc) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TracePartition.lean b/LeanPool/GraphMinor/GM12/Section2TracePartition.lean new file mode 100644 index 0000000000..2786f2afba --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TracePartition.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TraceComposition + +/-! +# Assembling a trace over its ordered vertex parameters + +The trace in XII, page 243, concatenates one two-edge walk for each +region interval between consecutive vertex parameters. This file proves +that finite assembly, including the length count. It separates the +ordering of the parameters from the geometric construction of each +individual step. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Assemble trace steps over consecutive entries of a finite parameter +list. Each interval contributes exactly two edges, so the full walk +has twice the number of intervals as its length. -/ +theorem exists_traceSteps_of_partition {S : Type*} [TopologicalSpace S] + {Γ K : Drawing S} {f : ℝ → S} {n : ℕ} (t : Fin (n + 1) → ℝ) + (hΓ : ∀ i, f (t i) ∈ Γ.V) (hK : ∀ i, f (t i) ∈ K.V) + (hsteps : ∀ i : Fin n, + ∃ W : GraphWalk K.toGraph (f (t i.castSucc)) (f (t i.succ)), + TraceSteps Γ K f (t i.castSucc) (t i.succ) W ∧ W.length = 2) : + ∃ W : GraphWalk K.toGraph (f (t 0)) (f (t (Fin.last n))), + TraceSteps Γ K f (t 0) (t (Fin.last n)) W ∧ W.length = 2 * n := by + induction n with + | zero => + refine ⟨.nil (hK 0), ?_, rfl⟩ + exact ⟨rfl, rfl, hΓ 0⟩ + | succ n ih => + let t' : Fin (n + 1) → ℝ := fun i => t i.succ + have hsteps' : ∀ i : Fin n, + ∃ W : GraphWalk K.toGraph (f (t' i.castSucc)) (f (t' i.succ)), + TraceSteps Γ K f (t' i.castSucc) (t' i.succ) W ∧ W.length = 2 := by + intro i + exact hsteps i.succ + obtain ⟨Wtail, htail, htailLength⟩ := ih t' (fun i => hΓ i.succ) (fun i => hK i.succ) hsteps' + obtain ⟨Wfirst, hfirst, hfirstLength⟩ := hsteps 0 + refine ⟨Wfirst.append Wtail, traceSteps_append Wfirst Wtail hfirst htail, ?_⟩ + have hl := GraphWalk.length_append Wfirst Wtail + rw [hfirstLength, htailLength] at hl + exact hl.trans (by omega) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TracePartitionCarrier.lean b/LeanPool/GraphMinor/GM12/Section2TracePartitionCarrier.lean new file mode 100644 index 0000000000..29898517a0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TracePartitionCarrier.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TracePartition +public import LeanPool.GraphMinor.GM12.Section2WalkCarriers + +/-! +# Keeping the point set when assembling region visits + +For Case 1 of XII (2.1), page 244, assemble the two-edge walks of +the region visits while retaining their point sets. Concatenation +unions these sets. The initial and joining vertices already belong +to the first walk's point set, so the resulting trace has exactly +the union of the prescribed region-path point sets, together with +its initial vertex in the zero-interval case. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- Assemble the trace steps and retain the union of the point sets +of the individual two-edge region visits. -/ +theorem exists_traceSteps_of_partition_with_carrier + {S : Type*} [TopologicalSpace S] [T1Space S] {Γ K : Drawing S} {f : ℝ → S} + {n : ℕ} (t : Fin (n + 1) → ℝ) + (hΓ : ∀ i, f (t i) ∈ Γ.V) (hK : ∀ i, f (t i) ∈ K.V) (C : Fin n → Set S) + (hsteps : ∀ i : Fin n, + ∃ W : GraphWalk K.toGraph (f (t i.castSucc)) (f (t i.succ)), + TraceSteps Γ K f (t i.castSucc) (t i.succ) W ∧ W.length = 2 ∧ + (walkDrawing K W).U = C i) : + ∃ W : GraphWalk K.toGraph (f (t 0)) (f (t (Fin.last n))), + TraceSteps Γ K f (t 0) (t (Fin.last n)) W ∧ W.length = 2 * n ∧ + (walkDrawing K W).U = {f (t 0)} ∪ ⋃ i, C i := by + induction n with + | zero => + refine ⟨.nil (hK 0), ⟨rfl, rfl, hΓ 0⟩, rfl, ?_⟩ + rw [walkDrawing_U_nil K (hK 0)] + simp only [iUnion_of_empty, union_empty] + | succ n ih => + let t' : Fin (n + 1) → ℝ := fun i => t i.succ + let C' : Fin n → Set S := fun i => C i.succ + have hsteps' : ∀ i : Fin n, + ∃ W : GraphWalk K.toGraph (f (t' i.castSucc)) (f (t' i.succ)), + TraceSteps Γ K f (t' i.castSucc) (t' i.succ) W ∧ W.length = 2 ∧ + (walkDrawing K W).U = C' i := fun i => hsteps i.succ + obtain ⟨Q, hQ, hQlen, hQU⟩ := ih t' (fun i => hΓ i.succ) (fun i => hK i.succ) C' hsteps' + have hhead := hsteps (0 : Fin (n + 1)) + simp only [Fin.castSucc_zero] at hhead + obtain ⟨P, hP, hPlen, hPU⟩ := hhead + have hstart : f (t 0) ∈ C 0 := by + rw [← hPU] + apply (walkDrawing K P).V_subset_U + rw [walkDrawing_V] + exact P.start_mem_support + have hend : f (t' 0) ∈ C 0 := by + rw [← hPU] + apply (walkDrawing K P).V_subset_U + rw [walkDrawing_V] + exact P.end_mem_support + have hunion : (⋃ i : Fin (n + 1), C i) = C 0 ∪ ⋃ i : Fin n, C i.succ := by + ext x + simp only [mem_iUnion, mem_union] + constructor + · rintro ⟨i, hi⟩ + obtain rfl | ⟨j, rfl⟩ := Fin.eq_zero_or_eq_succ i + · exact Or.inl hi + · exact Or.inr ⟨j, hi⟩ + · rintro (hi | ⟨j, hj⟩) + · exact ⟨0, hi⟩ + · exact ⟨j.succ, hj⟩ + refine ⟨P.append Q, traceSteps_append P Q hP hQ, ?_, ?_⟩ + · rw [GraphWalk.length_append P Q, hPlen, hQlen] + omega + · rw [walkDrawing_U_append K P Q, hPU, hQU] + change C 0 ∪ ({f (t' 0)} ∪ ⋃ i : Fin n, C i.succ) = + {f (t 0)} ∪ ⋃ i : Fin (n + 1), C i + rw [← union_assoc, union_eq_left.mpr (singleton_subset_iff.mpr hend), hunion, + ← union_assoc, union_eq_right.mpr (singleton_subset_iff.mpr hstart)] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TraceReverse.lean b/LeanPool/GraphMinor/GM12/Section2TraceReverse.lean new file mode 100644 index 0000000000..f75c0ee70b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TraceReverse.lean @@ -0,0 +1,73 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TraceComposition +import LeanPool.GraphMinor.GM12.Section2TraceParameters + +/-! +# Reversing trace steps + +The entry and exit rules of XII, page 243, exchange when the +parameter runs backwards. Reverse the remaining walk first, then +append the reversed pair for the first region visit. This proves +that the reversed walk traces the reversed parameter interval. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +private theorem append_assoc {α β : Type*} {G : Graph α β} + {a b c d : α} (P : GraphWalk G a b) (Q : GraphWalk G b c) (R : GraphWalk G c d) : + (P.append Q).append R = P.append (Q.append R) := by + induction P with + | nil _ => rfl + | cons _ _ ih => exact congrArg (GraphWalk.cons _) (ih Q) + +/-- Reversing the parameter and the walk preserves trace steps. -/ +theorem traceSteps_reverse + {S : Type*} [TopologicalSpace S] {Γ K : Drawing S} {f : ℝ → S} + {a b : ℝ} {u v : S} (W : GraphWalk K.toGraph u v) (hW : TraceSteps Γ K f a b W) : + TraceSteps Γ K (fun t => f (-t)) (-b) (-a) W.reverse := by + cases hWcase : W with + | nil hu => + rw [hWcase] at hW + obtain ⟨rfl, hfa, huΓ⟩ := hW + exact ⟨rfl, by simpa only [neg_neg] using hfa, huΓ⟩ + | cons hlink rest => + rw [hWcase] at hW + cases hrestcase : rest with + | nil hu => rw [hrestcase] at hW; exact hW.elim + | cons hlink' tail => + rw [hrestcase] at hW + obtain ⟨c, hac, hfa, hu, hfc, hwK, r, hr, hwr, hfr, hleave, henter, htail⟩ := hW + have htail' := traceSteps_reverse tail htail + let P := GraphWalk.cons hlink'.symm (GraphWalk.cons hlink.symm (.nil hlink.left_mem)) + have hP : TraceSteps Γ K (fun t => f (-t)) (-c) (-a) P := by + refine ⟨-a, neg_lt_neg hac, ?_, (traceSteps_parameters tail htail).2.2.1, ?_, hwK, + r, hr, hwr, ?_, ?_, hleave, rfl, ?_, hu⟩ + · simpa only [neg_neg] using hfc + · simpa only [neg_neg] using hfa + · intro t ht + exact hfr (-t) ⟨by linarith [ht.2], by linarith [ht.1]⟩ + · simpa only [LeavesLike, neg_neg] using henter + · simpa only [neg_neg] using hfa + change TraceSteps Γ K (fun t => f (-t)) (-b) (-a) + ((tail.reverse.append _).append _) + rw [append_assoc] + exact traceSteps_append tail.reverse P htail' hP +termination_by W.length +decreasing_by + simp_all only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TraceSubdivision.lean b/LeanPool/GraphMinor/GM12/Section2TraceSubdivision.lean new file mode 100644 index 0000000000..d48a18cd3b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TraceSubdivision.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TraceParameters +public import LeanPool.GraphMinor.GM12.Section2HitOrder +import LeanPool.GraphMinor.GM12.Section2RegionIntervals +import LeanPool.GraphMinor.GM12.Section2PeriodicHits + +/-! +# Extracting the cyclic region subdivision of a trace + +For XII (2.1), Case 1, page 244, enumerate the drawing hits in the +closed real period already used by the trace. Its endpoints are hits, +and only the last repeats a circle parameter. Consecutive hits bound +normal intervals in single regions. This gives the ordered subdivision, +its length, and its region labels while retaining the original trace. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A positive-length trace supplies an ordered cyclic list of vertex +parameters and the regions of all successive intervals. -/ +theorem exists_trace_subdivision + {S : Type*} [TopologicalSpace S] {Γ K : Drawing S} + {φ : C(Circle, S)} {u : S} (W : GraphWalk K.toGraph u u) + (hW : IsTrace Γ K φ W) (hpos : 0 < curveLength Γ φ) : + ∃ (n : ℕ) (t : Fin (n + 1) → ℝ) (r : Fin n → Set S), + 0 < n ∧ StrictMono t ∧ t (Fin.last n) = t 0 + 1 ∧ n = curveLength Γ φ ∧ + (∀ i, periodicCurve φ (t i) ∈ Γ.V) ∧ + TraceSteps Γ K (periodicCurve φ) (t 0) (t 0 + 1) W ∧ + (∀ i, r i ∈ Γ.R) ∧ + ∀ i s, s ∈ Ioo (t i.castSucc) (t i.succ) → periodicCurve φ s ∈ r i := by + rcases hW.2 with ⟨hzero, _⟩ | ⟨_, _, a, hsteps⟩ + · exact (not_lt_of_ge hzero.le hpos).elim + · have haU : periodicCurve φ a ∈ Γ.U := + Γ.V_subset_U ((traceSteps_parameters W hsteps).2.1.symm ▸ (traceSteps_parameters W + hsteps).2.2.1) + let H : Set ℝ := {s | s ∈ Icc a (a + 1) ∧ periodicCurve φ s ∈ Γ.U} + obtain ⟨hH, hHcard⟩ := periodicCurve_closed_hits hW.1 haU + have hperiod : periodicCurve φ (a + 1) = periodicCurve φ a := periodicCurve_periodic φ a + have haH : a ∈ H := ⟨⟨le_rfl, by linarith⟩, haU⟩ + have hbH : a + 1 ∈ H := ⟨⟨by linarith, le_rfl⟩, hperiod.symm ▸ haU⟩ + obtain ⟨n, t, ht, ht0, htlast, htrange, hcard⟩ := + exists_ordered_interval_enumeration hH (fun _ hs => hs.1) haH hbH + have hΓ : ∀ i, periodicCurve φ (t i) ∈ Γ.V := by + intro i + have hiH : t i ∈ H := htrange.subset (mem_range_self i) + exact hW.1.2 ⟨mem_range_self _, hiH.2⟩ + have hcover : ∀ s ∈ Icc (t 0) (t (Fin.last n)), periodicCurve φ s ∈ Γ.U → s ∈ range t := by + intro s hs hsU + rw [ht0, htlast] at hs + exact htrange.symm ▸ (show s ∈ H from ⟨hs, hsU⟩) + have hregions : ∀ i : Fin n, ∃ r ∈ Γ.R, + ∀ s ∈ Ioo (t i.castSucc) (t i.succ), periodicCurve φ s ∈ r := by + intro i + exact exists_region_of_open_interval (periodicCurve_continuous φ) (ht i.castSucc_lt_succ) + (no_hit_between_consecutive_parameters t ht hcover i) + choose r hr hfr using hregions + have hlength : n = curveLength Γ φ := by omega + refine ⟨n, t, r, hlength.symm ▸ hpos, ht, ?_, hlength, hΓ, ?_, hr, hfr⟩ + · rw [ht0, htlast] + · simpa only [ht0] using hsteps + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TraceTranslation.lean b/LeanPool/GraphMinor/GM12/Section2TraceTranslation.lean new file mode 100644 index 0000000000..11183649fb --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TraceTranslation.lean @@ -0,0 +1,94 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TraceComposition + +/-! +# Translating trace parameter intervals + +The trace of XII, page 243, does not depend on the real origin used +to parameterize the circle. Translate entry witnesses and each region +interval by the same amount. For a periodic curve, this also permits +two successive copies of a closed trace to be read on one interval. +The latter avoids one-sided endpoints in the local restriction proof. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Translating the parameter origin preserves an entry witness. -/ +theorem entersLike_translate + {S : Type*} [TopologicalSpace S] {f g : ℝ → S} {δ : ℝ} + (hfg : ∀ t, g (t + δ) = f t) {a c : ℝ} {e r : Set S} {v w : S} + (hentry : EntersLike f a c e r v w) : + EntersLike g (a + δ) (c + δ) e r v w := by + obtain ⟨h, hh, ξ, ρ, hξ, hρ, hhom⟩ := hentry + obtain ⟨s, hs, hs1, hprefix, hi, he, hw⟩ := hξ + refine ⟨h + δ, ⟨by linarith [hh.1], by linarith [hh.2]⟩, + ξ, ρ, ⟨s, hs, hs1, ?_, hi, he, hw⟩, hρ, hhom⟩ + intro t ht + rw [hprefix t ht] + have heq : h + δ + t.val / s.val * (c + δ - (h + δ)) = + (h + t.val / s.val * (c - h)) + δ := by ring + rw [heq, hfg] + +/-- Translate every recorded region visit by the same amount. -/ +theorem traceSteps_translate + {S : Type*} [TopologicalSpace S] {Γ K : Drawing S} {f g : ℝ → S} {δ : ℝ} + (hfg : ∀ t, g (t + δ) = f t) {a b : ℝ} {u v : S} + (W : GraphWalk K.toGraph u v) (hW : TraceSteps Γ K f a b W) : + TraceSteps Γ K g (a + δ) (b + δ) W := by + cases hWcase : W with + | nil hu => + rw [hWcase] at hW + exact ⟨congrArg (fun t => t + δ) hW.1, (hfg a).trans hW.2.1, hW.2.2⟩ + | cons hlink rest => + rw [hWcase] at hW + cases hrestcase : rest with + | nil hu => rw [hrestcase] at hW; exact hW.elim + | cons hlink' tail => + rw [hrestcase] at hW + obtain ⟨c, hac, hfa, hu, hfc, hwK, r, hr, hwr, hfr, hleave, henter, htail⟩ := hW + refine ⟨c + δ, by linarith [hac], (hfg a).trans hfa, hu, + (hfg c).trans hfc, hwK, r, hr, hwr, ?_, ?_, entersLike_translate hfg henter, + traceSteps_translate hfg tail htail⟩ + · intro t ht + have hval : g t = f (t - δ) := by simpa only [sub_add_cancel] using hfg (t - δ) + rw [hval] + exact hfr (t - δ) ⟨by linarith [ht.1], by linarith [ht.2]⟩ + · have hneg : ∀ t, g (-(t + -δ)) = f (-t) := by + intro t + have harg : -(t + -δ) = -t + δ := by ring + rw [harg, hfg] + have hle := entersLike_translate (g := fun t => g (-t)) (δ := -δ) hneg hleave + simpa only [LeavesLike, neg_add_rev, add_comm] using hle +termination_by W.length +decreasing_by + simp_all only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +/-- Two copies of a one-period closed trace give trace steps on two +periods of the same periodic curve. -/ +theorem traceSteps_two_periods + {S : Type*} [TopologicalSpace S] {Γ K : Drawing S} {f : ℝ → S} + (hper : Function.Periodic f 1) {a : ℝ} {u : S} + (W : GraphWalk K.toGraph u u) (hW : TraceSteps Γ K f a (a + 1) W) : + TraceSteps Γ K f a (a + 2) (W.append W) := by + have hW' := traceSteps_translate hper W hW + have hW'' : TraceSteps Γ K f (a + 1) (a + 2) W := by + have heq : (a + 1) + 1 = a + 2 := by ring + rw [heq] at hW' + exact hW' + exact traceSteps_append W W hW hW'' + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TraceVertexRestriction.lean b/LeanPool/GraphMinor/GM12/Section2TraceVertexRestriction.lean new file mode 100644 index 0000000000..a72c6679ec --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TraceVertexRestriction.lean @@ -0,0 +1,115 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TraceImage +import LeanPool.GraphMinor.GM11.RadialRegions +import LeanPool.GraphMinor.GM11.Section4 + +/-! +# Vertex containment under restriction of the curve image + +For the restriction step in XII (2.1), pages 243--244, a trace vertex +is either an original vertex visited by the curve, or the radial hub +of a region visited by the curve. Both visits remain visits of the +original curve when images are included. The original trace records +them, and uniqueness of each region's hub identifies the middle walk +vertices. Thus every vertex of the restricted trace is already in +the original trace. No injectivity of the restricted curve is needed. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +private theorem traceSteps_support_property + {S : Type*} [TopologicalSpace S] {Γ K : Drawing S} {f : ℝ → S} {P : S → Prop} + {a b : ℝ} {u v : S} (W : GraphWalk K.toGraph u v) (hW : TraceSteps Γ K f a b W) + (hV : ∀ s ∈ Icc a b, f s ∈ Γ.V → P (f s)) + (hR : ∀ r ∈ Γ.R, ∀ w ∈ K.V, w ∈ r → (∃ s ∈ Ioo a b, f s ∈ r) → P w) : + ∀ x ∈ W.support, P x := by + cases hWcase : W with + | nil hv => + rw [hWcase] at hW + obtain ⟨hab, hfa, hu⟩ := hW + intro x hx + have hxu : x = u := by simpa only [GraphWalk.support, List.mem_singleton] using hx + subst x + exact hfa ▸ hV a ⟨le_rfl, hab.le⟩ (hfa.symm ▸ hu) + | @cons _ w _ e hlink rest => + rw [hWcase] at hW + cases hrestcase : rest with + | nil hv => rw [hrestcase] at hW; exact hW.elim + | cons hlink' tail => + rw [hrestcase] at hW + obtain ⟨c, hac, hfa, hu, _, hwK, r, hr, hwr, hfr, _, _, htail⟩ := hW + have hcb : c ≤ b := (traceSteps_parameters tail htail).1 + have hPu : P u := hfa ▸ hV a ⟨le_rfl, hac.le.trans hcb⟩ (hfa.symm ▸ hu) + have hmid : (a + c) / 2 ∈ Ioo a c := ⟨by linarith, by linarith⟩ + have hPw : P w := hR r hr w hwK hwr + ⟨(a + c) / 2, ⟨hmid.1, hmid.2.trans_le hcb⟩, hfr _ hmid⟩ + have htailP := traceSteps_support_property tail htail + (fun s hs hsV => hV s ⟨hac.le.trans hs.1, hs.2⟩ hsV) + (fun r hr w hw hwr hs => hR r hr w hw hwr (by + obtain ⟨s, hs, hfs⟩ := hs + exact ⟨s, ⟨hac.trans hs.1, hs.2⟩, hfs⟩)) + intro x hx + simp only [GraphWalk.support, List.mem_cons] at hx + rcases hx with rfl | rfl | hx + · exact hPu + · exact hPw + · exact htailP x hx +termination_by W.length +decreasing_by + simp_all only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +/-- The vertex part of trace restriction in XII (2.1), pages 243--244. +For any two traced normal curves with included images, the second +trace's vertex set is included in the first trace's vertex set. -/ +theorem trace_vertices_subset_of_range_subset + {S : Type*} [TopologicalSpace S] [T1Space S] {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {φ ψ : C(Circle, S)} {u v : S} + (W : GraphWalk K.toGraph u u) (W' : GraphWalk K.toGraph v v) + (hW : IsTrace Γ K φ W) (hW' : IsTrace Γ K ψ W') (hsub : range ψ ⊆ range φ) : + (walkDrawing K W').V ⊆ (walkDrawing K W).V := by + have hrad : PreRad (.drawing Γ) K := ⟨hK.1, hK.2.1⟩ + have hhub : ∀ r ∈ Γ.R, ∀ w ∈ K.V, w ∈ r → (range ψ ∩ r).Nonempty → + w ∈ (walkDrawing K W).V := by + intro r hr w hwK hwr hmeet + have hmeet' : (range φ ∩ r).Nonempty := hmeet.mono (inter_subset_inter_left r hsub) + obtain ⟨z, hzW, hzr⟩ := trace_region_in_image W hW hr hmeet' + have hzdraw : z ∈ (walkDrawing K W).V := by rw [walkDrawing_V]; exact hzW + have hzK : z ∈ K.V := (walkDrawing_isSubdrawing K W).1 hzdraw + have hwz : w = z := hub_unique hrad hr hzr hzK hwr hwK + exact hwz.symm ▸ hzdraw + rcases hW'.2 with ⟨_, hlen, hvK, r, hr, hψr, hvr⟩ | ⟨_, _, a, hsteps⟩ + · have hvdraw : v ∈ (walkDrawing K W).V := hhub r hr v hvK hvr + ⟨ψ 1, mem_range_self 1, hψr (mem_range_self 1)⟩ + intro x hx + rw [walkDrawing_V, (support_of_length_zero hlen).1] at hx + have hxv : x = v := by simpa only [List.mem_singleton, mem_ofPred_eq] using hx + exact hxv.symm ▸ hvdraw + · have hP := traceSteps_support_property (P := fun x => x ∈ (walkDrawing K W).V) W' hsteps + (fun s _ hsV => by + rw [walkDrawing_V] + exact trace_vertex_in_image W hW + (hsub (mem_range_self (Circle.exp (2 * Real.pi * s)))) hsV) + (fun r hr w hw hwr hs => by + obtain ⟨s, _, hsr⟩ := hs + exact hhub r hr w hw hwr ⟨periodicCurve ψ s, + mem_range_self (Circle.exp (2 * Real.pi * s)), hsr⟩) + intro x hx + rw [walkDrawing_V] at hx + exact hP x hx + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2TraceVisits.lean b/LeanPool/GraphMinor/GM12/Section2TraceVisits.lean new file mode 100644 index 0000000000..f169343b07 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2TraceVisits.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2TraceParameters +import LeanPool.GraphMinor.GM11.Regions + +/-! +# Every visited vertex and region occurs in the trace + +For the restriction step in XII (2.1), pages 243--244, a trace records +every vertex visit and every intervening region. On each two-edge +step, the open parameter interval misses drawing vertices and the +middle walk vertex is the hub of that interval's region. Induction +through the steps therefore records all vertex and region visits +of the original curve. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- Every drawing vertex visited during trace steps is a vertex of +the trace walk. -/ +theorem traceSteps_vertex_visit + {S : Type*} [TopologicalSpace S] {Γ K : Drawing S} {f : ℝ → S} + {a b : ℝ} {u v : S} (W : GraphWalk K.toGraph u v) + (hW : TraceSteps Γ K f a b W) {s : ℝ} (hs : s ∈ Icc a b) (hfs : f s ∈ Γ.V) : + f s ∈ W.support := by + cases hWcase : W with + | nil hv => + rw [hWcase] at hW + obtain ⟨hab, hfa, _⟩ := hW + have hsa : s = a := le_antisymm (hs.2.trans_eq hab.symm) hs.1 + have heq : f s = u := (congrArg f hsa).trans hfa + rw [heq] + exact GraphWalk.start_mem_support _ + | cons hlink rest => + rw [hWcase] at hW + cases hrestcase : rest with + | nil hv => rw [hrestcase] at hW; exact hW.elim + | cons hlink' tail => + rw [hrestcase] at hW + obtain ⟨c, hac, hfa, _, _, _, r, hr, _, hfr, _, _, htail⟩ := hW + by_cases hsa : s = a + · have heq : f s = u := (congrArg f hsa).trans hfa + rw [heq] + exact GraphWalk.start_mem_support _ + · by_cases hsc : s < c + · have has : a < s := lt_of_le_of_ne hs.1 (Ne.symm hsa) + exact (region_subset hr (hfr s ⟨has, hsc⟩) (Γ.V_subset_U hfs)).elim + · have hm := traceSteps_vertex_visit tail htail ⟨le_of_not_gt hsc, hs.2⟩ hfs + simp only [GraphWalk.support, List.mem_cons] + exact Or.inr (Or.inr hm) +termination_by W.length +decreasing_by + simp_all only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +/-- Every region visited during trace steps contains a walk vertex, +namely the hub of one of the visited parameter intervals. -/ +theorem traceSteps_region_visit + {S : Type*} [TopologicalSpace S] {Γ K : Drawing S} {f : ℝ → S} + {a b : ℝ} {u v : S} (W : GraphWalk K.toGraph u v) + (hW : TraceSteps Γ K f a b W) {s : ℝ} (hs : s ∈ Icc a b) + {r : Set S} (hr : r ∈ Γ.R) (hfs : f s ∈ r) : + ∃ w ∈ W.support, w ∈ r := by + cases hWcase : W with + | nil hv => + rw [hWcase] at hW + obtain ⟨hab, hfa, hu⟩ := hW + have hsa : s = a := le_antisymm (hs.2.trans_eq hab.symm) hs.1 + have heq : f s = u := (congrArg f hsa).trans hfa + exact (region_subset hr hfs (heq.symm ▸ Γ.V_subset_U hu)).elim + | @cons _ w _ e hlink rest => + rw [hWcase] at hW + cases hrestcase : rest with + | nil hv => rw [hrestcase] at hW; exact hW.elim + | cons hlink' tail => + rw [hrestcase] at hW + obtain ⟨c, hac, hfa, hu, _, _, r', hr', hwr', hfr', _, _, htail⟩ := hW + by_cases hsc : s < c + · have has : a < s := lt_of_le_of_ne hs.1 (by + intro heq + have hfaU : f s ∈ Γ.U := by rw [← heq, hfa]; exact Γ.V_subset_U hu + exact region_subset hr hfs hfaU) + have hrr : r' = r := region_eq_of_mem hr' hr (hfr' s ⟨has, hsc⟩) hfs + refine ⟨w, ?_, hrr ▸ hwr'⟩ + simp only [GraphWalk.support, List.mem_cons] + exact Or.inr (Or.inl trivial) + · obtain ⟨z, hz, hzr⟩ := traceSteps_region_visit tail htail ⟨le_of_not_gt hsc, hs.2⟩ hr hfs + refine ⟨z, ?_, hzr⟩ + simp only [GraphWalk.support, List.mem_cons] + exact Or.inr (Or.inr hz) +termination_by W.length +decreasing_by + simp_all only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2VisitCarrier.lean b/LeanPool/GraphMinor/GM12/Section2VisitCarrier.lean new file mode 100644 index 0000000000..449648b4b4 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2VisitCarrier.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM12.Section2CirclePeriod +import LeanPool.GraphMinor.GM12.Section2IntervalCoverage +import LeanPool.GraphMinor.GM11.Regions + +/-! +# The set used by the trace deformation + +For Case 1 of XII (2.1), page 244, the deformation stays in the +visited regions together with the original drawing vertices. The +parameter subdivision covers the original curve by those pieces. +Its union meets the drawing only at those original vertices, and +any region met by this union is one of the listed regions. These +are precisely the controls needed by the selected-inside comparison. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- Choose the union of visited regions and original vertex images, +retaining its coverage and its drawing-atom controls. -/ +theorem exists_region_visit_carrier + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} {φ : C(Circle, S)} + {n : ℕ} (t : Fin (n + 1) → ℝ) (hperiod : t (Fin.last n) = t 0 + 1) + (hΓ : ∀ i, periodicCurve φ (t i) ∈ Γ.V) + (r : Fin n → Set S) (hr : ∀ i, r i ∈ Γ.R) + (hfr : ∀ i s, s ∈ Ioo (t i.castSucc) (t i.succ) → periodicCurve φ s ∈ r i) : + ∃ Z : Set S, range φ ⊆ Z ∧ (∀ i, r i ⊆ Z) ∧ + Z ∩ Γ.U ⊆ range φ ∩ Γ.V ∧ + ∀ R ∈ Γ.R, (Z ∩ R).Nonempty → ∃ i, R = r i := by + let Z := (range φ ∩ Γ.V) ∪ ⋃ i, r i + have hφZ : range φ ⊆ Z := by + rintro x ⟨z, rfl⟩ + obtain ⟨s, hs, hsz⟩ := (circle_parameter_bijOn (t 0)).surjOn (mem_univ z) + have heq : periodicCurve φ s = φ z := congrArg φ hsz + rw [← heq] + have hs' : s ∈ Icc (t 0) (t (Fin.last n)) := ⟨hs.1, hperiod.symm ▸ hs.2.le⟩ + rcases mem_range_or_mem_successive_open_interval t hs' with ⟨i, hi⟩ | ⟨i, hi⟩ + · exact Or.inl ⟨mem_range_self _, hi ▸ hΓ i⟩ + · exact Or.inr (mem_iUnion.mpr ⟨i, hfr i s hi⟩) + refine ⟨Z, hφZ, fun i x hx => Or.inr (mem_iUnion.mpr ⟨i, hx⟩), ?_, ?_⟩ + · rintro x ⟨(hx | hx), hxΓ⟩ + · exact hx + · obtain ⟨i, hi⟩ := mem_iUnion.mp hx + exact (region_subset (hr i) hi hxΓ).elim + · intro R hR hmeet + obtain ⟨x, hxZ, hxR⟩ := hmeet + rcases hxZ with hx | hx + · exact (region_subset hR hxR (Γ.V_subset_U hx.2)).elim + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hx + exact ⟨i, region_eq_of_mem hR (hr i) hxR hxi⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2WalkCarriers.lean b/LeanPool/GraphMinor/GM12/Section2WalkCarriers.lean new file mode 100644 index 0000000000..4d5cdd1b03 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2WalkCarriers.lean @@ -0,0 +1,59 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Walks + +/-! +# Point sets of concatenated trace walks + +For the assembly in XII (2.1), Case 1, page 244, concatenating +walks unions their point sets. A single edge step adds its closure, +and a two-edge region visit has precisely the union of its two edge +closures as point set. These identities identify the circle assembled +from the deformed region paths with the trace drawing's point set. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The point set of a concatenated walk is the union of the point +sets of the two walks. -/ +theorem walkDrawing_U_append + {S : Type*} [TopologicalSpace S] [T1Space S] (K : Drawing S) {u v w : S} + (P : GraphWalk K.toGraph u v) (Q : GraphWalk K.toGraph v w) : + (walkDrawing K (P.append Q)).U = (walkDrawing K P).U ∪ (walkDrawing K Q).U := + GraphWalk.drawing_U_append K P Q + +/-- A zero-edge walk has just its vertex as point set. -/ +theorem walkDrawing_U_nil + {S : Type*} [TopologicalSpace S] [T1Space S] (K : Drawing S) {u : S} (hu : u ∈ K.V) : + (walkDrawing K (GraphWalk.nil hu)).U = {u} := + GraphWalk.drawing_U_nil K hu + +/-- An edge step adds exactly its edge closure to the point set. -/ +theorem walkDrawing_U_cons + {S : Type*} [TopologicalSpace S] [T1Space S] (K : Drawing S) {u v w : S} {e : Set S} + (hl : K.toGraph.IsLink e u v) (P : GraphWalk K.toGraph v w) : + (walkDrawing K (GraphWalk.cons hl P)).U = closure e ∪ (walkDrawing K P).U := + GraphWalk.drawing_U_cons K hl P + +/-- A two-edge region visit has the two edge closures as its whole +point set. -/ +theorem walkDrawing_U_two_edges + {S : Type*} [TopologicalSpace S] [T1Space S] (K : Drawing S) + {u v w : S} {e e' : Set S} (hl : K.toGraph.IsLink e u v) (hl' : K.toGraph.IsLink e' v w) : + (walkDrawing K (GraphWalk.cons hl (GraphWalk.cons hl' (.nil hl'.right_mem)))).U = + closure e ∪ closure e' := + GraphWalk.drawing_U_two_edges K hl hl' + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2WalkInside.lean b/LeanPool/GraphMinor/GM12/Section2WalkInside.lean new file mode 100644 index 0000000000..8943f76e35 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2WalkInside.lean @@ -0,0 +1,60 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Passing from a smaller trace to a larger trace + +The restriction and induction steps of XII (2.1), pages 243--244, use +that the inside of a trace subdrawing is contained in the inside of +the original trace. Both insides contain their supports and the selected +insides of their circuits. A circuit of the smaller subdrawing is a +circuit of the larger one, which gives the inclusion directly. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The inside operation is monotone under inclusion of drawings, +since its definition takes the union over their circuits. -/ +theorem insOf_mono {S : Type*} [TopologicalSpace S] + (ins : Drawing S → Set S) {H K : Drawing S} (hsub : H.IsSubdrawing K) : + insOf ins H ⊆ insOf ins K := by + intro x hx + rcases hx with hx | hx + · exact Or.inl (hsub.U_subset hx) + · obtain ⟨C, hC, hxC⟩ := mem_iUnion₂.mp hx + exact Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC.1, hC.2.trans hsub⟩, hxC⟩) + +/-- The inside of a trace whose underlying drawing is a subdrawing of +another trace is contained in the latter's inside. This is the last +inclusion in the restriction and induction steps of XII (2.1). -/ +theorem insWalk_mono {S : Type*} [TopologicalSpace S] [T1Space S] + (ins : Drawing S → Set S) (K : Drawing S) {u v : S} + (W : GraphWalk K.toGraph u u) (W' : GraphWalk K.toGraph v v) + (hsub : (walkDrawing K W').IsSubdrawing (walkDrawing K W)) : + insWalk ins K W' ⊆ insWalk ins K W := insOf_mono ins hsub + +/-- An atom meeting the inside of a smaller trace also meets the inside +of the original trace, as used after induction in XII (2.1), Case 2. -/ +theorem meets_insWalk_of_subdrawing {S : Type*} [TopologicalSpace S] [T1Space S] + (ins : Drawing S → Set S) (K : Drawing S) {u v : S} + (W : GraphWalk K.toGraph u u) (W' : GraphWalk K.toGraph v v) + (hsub : (walkDrawing K W').IsSubdrawing (walkDrawing K W)) + {C : Set S} (hC : (C ∩ insWalk ins K W').Nonempty) : + (C ∩ insWalk ins K W).Nonempty := + hC.mono (inter_subset_inter_right C (insWalk_mono ins K W W' hsub)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section2Zero.lean b/LeanPool/GraphMinor/GM12/Section2Zero.lean new file mode 100644 index 0000000000..ddb72ddb6f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section2Zero.lean @@ -0,0 +1,121 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.Section7 + +/-! +# Zero-length traces + +The zero-length case of XII (2.1), pages 243--244, needs a separate +argument. The curve lies in one region. Any circle in its image bounds +a disc inside that region. This is also the disc selected by the tangle: +a different disc with the same boundary would contain the whole drawing, +contrary to the third tangle condition. The only atom meeting the disc +is that region, which contains the zero-length trace vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM10 GM11 Hypergraph + +universe u +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +omit [T1Space S] in +/-- A normal curve of length zero has the zero-edge trace from the +unique radial vertex of its region, as defined in XII, page 243. -/ +theorem exists_trace_of_length_zero {Γ K : Drawing S} {φ : C(Circle, S)} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hφ : IsNormalCurve Γ φ) (hzero : curveLength Γ φ = 0) : + ∃ (u : S) (W : GraphWalk K.toGraph u u), IsTrace Γ K φ W := by + have hemp : {x | φ x ∈ Γ.U} = ∅ := (Set.ncard_eq_zero hφ.1).mp hzero + have hoff : ∀ x, φ x ∉ Γ.U := by + intro x hx + exact Set.notMem_empty x (hemp ▸ hx) + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem (hoff 1) + have hsub : range φ ⊆ r := subset_region hr + (isPreconnected_range φ.continuous) (Set.disjoint_left.mpr (by rintro y ⟨x, rfl⟩; exact hoff x)) + ⟨1, rfl⟩ hxr + obtain ⟨u, ⟨hur, huK⟩, _⟩ := hK.2.1.2.2.1 r hr + exact ⟨u, .nil huK, hφ, Or.inl ⟨hzero, rfl, huK, r, hr, hsub, hur⟩⟩ + +omit [T1Space S] in +/-- An atom meeting a region is that region, since distinct atoms +are disjoint. Used in the zero and backtracking cases of XII (2.1). -/ +theorem atom_eq_region_of_meets {Γ : Drawing S} {c r : Set S} + (hc : c ∈ Γ.A) (hr : r ∈ Γ.R) (hcr : (c ∩ r).Nonempty) : c = r := by + obtain ⟨x, hxc, hxr⟩ := hcr + rcases hc with (⟨v, hv, rfl⟩ | hc) | hc + · exact (region_subset hr hxr (Γ.V_subset_U (mem_singleton_iff.mp hxc ▸ hv))).elim + · exact (region_subset hr hxr (hc.2.1 hxc).1).elim + · exact region_eq_of_mem hc hr hxc hxr + +omit [T1Space S] in +/-- A tangle-selected disc bounded by a circle in a region lies inside +that region. Choosing the other disc would put every drawing vertex +on the small side. This supplies the zero-length case of XII (2.1). -/ +theorem selected_disc_subset_region [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph θ T) {r F Δ : Set S} + (hr : r ∈ Γ.R) (hcell : IsOpenDisc r) (hF : IsOArc F) (hFr : F ⊆ r) + (hΔ : IsClosedDisc Δ) (hb : subBd Δ = F) + (hm : ((PaintingOrDrawing.drawing Γ).inter Δ, + (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T) : Δ ⊆ r := by + obtain ⟨D, hDr, hD, hbd⟩ := exists_disc_in_openDisc hcell hF hFr + have hbdΔ : discBd Δ = F := by + rw [← IsClosedDisc.frontier_eq_discBd hS hΔ, ← subBd_eq_frontier] + exact hb + by_cases heq : Δ = D + · exact heq ▸ hDr + have hcov : Δ ∪ D = univ := cover_of_discBd_eq hS hΔ hD (hbdΔ.trans hbd.symm) heq + exfalso + apply hT.axiom3 hm + ext x + change (x ∈ Γ.V ∧ x ∈ Δ) ↔ x ∈ Γ.V + refine ⟨fun h => h.1, fun hx => ⟨hx, ?_⟩⟩ + have hxUD : x ∈ Δ ∪ D := hcov ▸ mem_univ x + exact hxUD.resolve_right (fun hxD => region_subset hr (hDr hxD) (Γ.V_subset_U hx)) + +/-- Graph Minors XII, (2.1), zero-length case, pages 243--244. Every +atom meeting a tangle-selected disc bounded by a circle in the curve's +image meets the inside of the trace. -/ +theorem theorem_2_1_zero [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph θ T) + (hcell : (PaintingOrDrawing.drawing Γ).IsTwoCell) + {φ : C(Circle, S)} {u : S} {W : GraphWalk K.toGraph u u} + (hW : IsTrace Γ K φ W) (hzero : curveLength Γ φ = 0) + {ins : Drawing S → Set S} {F Δ c : Set S} + (hF : IsOArc F) (hFφ : F ⊆ range φ) (hΔ : IsClosedDisc Δ) + (hb : subBd Δ = F) + (hm : ((PaintingOrDrawing.drawing Γ).inter Δ, + (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T) + (hc : c ∈ Γ.A) (hcΔ : (c ∩ Δ).Nonempty) : + (c ∩ insWalk ins K W).Nonempty := by + rcases hW.2 with h | h + · obtain ⟨_, _, _, r, hr, hφr, hur⟩ := h + have hΔr := selected_disc_subset_region hS hT hr (hcell.2 r hr) hF + (hFφ.trans hφr) hΔ hb hm + have hcr : c = r := atom_eq_region_of_meets hc hr + (hcΔ.mono (inter_subset_inter_right c hΔr)) + refine ⟨u, hcr.symm ▸ hur, Or.inl ?_⟩ + apply (walkDrawing K W).V_subset_U + rw [walkDrawing_V] + exact W.start_mem_support + · exact (Nat.ne_of_gt h.1 hzero).elim + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3AddNormalCircle.lean b/LeanPool/GraphMinor/GM12/Section3AddNormalCircle.lean new file mode 100644 index 0000000000..9ff71ce46f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3AddNormalCircle.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.ArcDrawings +import LeanPool.GraphMinor.GM11.RadialBasics + +/-! +# Adding a normal circle to a drawing + +In the one-cuff candidate-existence argument used by XII (3.1), +page 245, add the prescribed disc boundary to the drawing. Mark every +original vertex on the circle and one additional circle point. The +circle drawing then meets the original drawing only at common +vertices, so their union is a drawing. Any set normal to this union +is normal to the original drawing as well. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A normal circle can be added to a drawing without weakening +normality for the original drawing. -/ +theorem exists_drawing_add_normal_oArc + {S : Type*} [TopologicalSpace S] [T2Space S] + (Γ : Drawing S) {F : Set S} (hF : IsOArc F) (hn : Γ.IsNormal F) : + ∃ G : Drawing S, G.U = Γ.U ∪ F ∧ + ∀ X, G.IsNormal X → Γ.IsNormal X := by + classical + obtain ⟨e⟩ := hF + let x := (e 1).val + have hx : x ∈ F := (e 1).property + let A := insert x (Γ.V ∩ F) + have hA : A.Finite := (Γ.finite_V.subset inter_subset_left).insert x + have hAF : A ⊆ F := by + rintro z (rfl | hz) + · exact hx + · exact hz.2 + obtain ⟨D, hDU, hDV⟩ := exists_drawing_on_oArc ⟨e⟩ hA ⟨x, mem_insert x _⟩ hAF + have hmeet : Γ.U ∩ D.U ⊆ Γ.V ∩ D.V := by + intro z hz + have hzF : z ∈ F := hDU ▸ hz.2 + have hzV := hn ⟨hzF, hz.1⟩ + exact ⟨hzV, hDV.symm ▸ (show z ∈ A from Or.inr ⟨hzV, hzF⟩)⟩ + let G := Γ.glue D hmeet + refine ⟨G, ?_, ?_⟩ + · change Γ.U ∪ D.U = Γ.U ∪ F + rw [hDU] + · intro X hnX z hz + have hzG : z ∈ G.U := Or.inl hz.2 + have hzV : z ∈ Γ.V ∪ D.V := hnX ⟨hz.1, hzG⟩ + rcases hzV with hzV | hzD + · exact hzV + · have hzF := hAF (hDV ▸ hzD) + exact hn ⟨hzF, hz.2⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3Alpha.lean b/LeanPool/GraphMinor/GM12/Section3Alpha.lean new file mode 100644 index 0000000000..0803de5f5b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3Alpha.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import Mathlib.Order.ConditionallyCompleteLattice.Basic +import Mathlib.Data.Set.Card + +/-! +# Minimum vertex counts in the reduction to VII + +XII (3.1), page 245, uses the main theorem of VII and its Section 8 +characterization of the parameter alpha by normal schismatic sets. +This file supplies the minimum-count steps of that reduction. The +minimum in VII's definition is attained as soon as a candidate exists, +and a bound on the vertex count of every candidate bounds alpha. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The minimum defining VII's alpha is attained if there is a +candidate. This is the minimum-count step used in XII (3.1), page 245. -/ +theorem exists_alpha_candidate_at_minimum {S : Type*} [TopologicalSpace S] + (G : Drawing S) (hex : ∃ X : Set S, GM07.IsAlphaCandidate G X) : + ∃ X : Set S, GM07.IsAlphaCandidate G X ∧ (X ∩ G.V).ncard = GM07.alpha G := by + have hne : {n : ℕ | ∃ X : Set S, GM07.IsAlphaCandidate G X ∧ (X ∩ G.V).ncard = n}.Nonempty := by + obtain ⟨X, hX⟩ := hex + exact ⟨(X ∩ G.V).ncard, X, hX, rfl⟩ + exact csInf_mem hne + +/-- A lower bound for all candidate vertex counts is a lower bound +for VII's alpha. Candidate existence is needed because natural-number +infimum assigns zero to the empty set. -/ +theorem alpha_ge_of_candidate_counts {S : Type*} [TopologicalSpace S] + (G : Drawing S) {N : ℕ} (hex : ∃ X : Set S, GM07.IsAlphaCandidate G X) + (hbound : ∀ X : Set S, GM07.IsAlphaCandidate G X → N ≤ (X ∩ G.V).ncard) : + N ≤ GM07.alpha G := by + obtain ⟨X, hX, hcount⟩ := exists_alpha_candidate_at_minimum G hex + exact hcount ▸ hbound X hX + +/-- Once every alpha candidate contains a normal schismatic set, +a vertex bound for the latter gives the alpha bound required by VII +(7.5). The containment step is the unnumbered argument of VII Section 8, +which XII (3.1) invokes on page 245. -/ +theorem alpha_ge_of_schismatic_counts {S : Type*} [TopologicalSpace S] + (G : Drawing S) {N : ℕ} (hex : ∃ X : Set S, GM07.IsAlphaCandidate G X) + (hcontains : ∀ X : Set S, GM07.IsAlphaCandidate G X → + ∃ Y : Set S, Y ⊆ X ∧ GM07.IsSchismatic Y ∧ G.IsNormal Y) + (hbound : ∀ Y : Set S, GM07.IsSchismatic Y → G.IsNormal Y → N ≤ (Y ∩ G.V).ncard) : + N ≤ GM07.alpha G := by + apply alpha_ge_of_candidate_counts G hex + intro X hX + obtain ⟨Y, hYX, hY, hYn⟩ := hcontains X hX + exact (hbound Y hY hYn).trans + (Set.ncard_le_ncard (inter_subset_inter_left G.V hYX) (G.finite_V.subset inter_subset_right)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3AlphaEmptyClasses.lean b/LeanPool/GraphMinor/GM12/Section3AlphaEmptyClasses.lean new file mode 100644 index 0000000000..95f766278c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3AlphaEmptyClasses.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3AlphaReduction +public import LeanPool.GraphMinor.GM12.Section3EmptyClasses +import Mathlib.Data.Fintype.EquivFin + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# The alpha reduction for arbitrary partition families + +XII (3.1), page 245, asks for connecting subdrawings for a partition. +The interface also permits empty parts. Enumerate the nonempty parts, +apply the proved alpha reduction to them, then restore the empty parts +with empty subdrawings. The feasibility discs restrict to the same +subfamily, so no extra geometric assumption is needed. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +universe u + +/-- The final application of VII for XII (3.1), allowing empty parts +in the disjoint family used to state the partition. The hypotheses are +those of the alpha reduction, with no nonemptiness requirement on parts. -/ +theorem connecting_subdrawings_of_alpha_bound_allowing_empty + {S : Type u} [TopologicalSpace S] [T2Space S] {t p : ℕ} + (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : Fin t → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (havoid : ∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) + (Zs : Fin p → Set S) (hcover : ⋃ j, Zs j = discBoundaryVertices Γ Δ) + (hdisZ : ∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) + (hfeasible : IsTopologicallyFeasible Δ Zs) + (hbound : ∀ F : Set S, Γ.IsNormal F → IsOArc F → F ⊆ discComplement Δ → + ∀ D : Set S, IsClosedDisc D → discBd D = F → + ∀ i, (∀ j, Δ j ⊆ D ↔ j = i) → + (Γ.V ∩ discBd (Δ i)).ncard ≤ (Γ.V ∩ F).ncard) + (a b c z : ℕ) (hcomplex : 3 ≤ 3 * a + 3 * b + c) + (hmodel : Nonempty (discComplement Δ ≃ₜ SurfaceModel a b c)) + (hcount : (discBoundaryVertices Γ Δ).ncard ≤ z) + (hα : 42 * (z + c + 1) * GM07.vModel a b (c + 1) (z + c + 1) ≤ + GM07.alpha (drawingInSubspace Γ (discComplement Δ) + (drawing_support_subset_discComplement hS Γ Δ hΔ hdisj havoid))) : + HasConnectingSubdrawings Γ (discBoundaryVertices Γ Δ) Zs := by + classical + let I := {j : Fin p // (Zs j).Nonempty} + let := Fintype.ofFinite I + let q := Fintype.card I + let e : I ≃ Fin q := Fintype.equivFin I + let f : Fin q → Fin p := fun j => (e.symm j).val + have hf : Function.Injective f := by + intro i j hij + exact e.symm.injective (Subtype.ext hij) + have hcover' : (⋃ j, Zs (f j)) = discBoundaryVertices Γ Δ := by + rw [← hcover] + apply Subset.antisymm + · intro x hx + obtain ⟨j, hj⟩ := mem_iUnion.mp hx + exact mem_iUnion.mpr ⟨f j, hj⟩ + · intro x hx + obtain ⟨j, hj⟩ := mem_iUnion.mp hx + let k : I := ⟨j, x, hj⟩ + refine mem_iUnion.mpr ⟨e k, ?_⟩ + simpa only [f, e.symm_apply_apply] using hj + have hfeasible' : IsTopologicallyFeasible Δ (fun j => Zs (f j)) := by + obtain ⟨D, hD, hDD, hDZ⟩ := hfeasible + exact ⟨fun j => D (f j), fun j => hD (f j), + fun i j hij => hDD (f i) (f j) (fun he => hij (hf he)), fun j => hDZ (f j)⟩ + apply hasConnectingSubdrawings_of_nonempty_restriction e + exact connecting_subdrawings_of_alpha_bound hS Γ Δ hΔ hdisj havoid + (fun j => Zs (f j)) hcover' (fun j => (e.symm j).property) + (fun i j hij => hdisZ (f i) (f j) (fun he => hij (hf he))) + hfeasible' hbound a b c z hcomplex hmodel hcount hα + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3AlphaReduction.lean b/LeanPool/GraphMinor/GM12/Section3AlphaReduction.lean new file mode 100644 index 0000000000..c97ee83cc3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3AlphaReduction.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ForestBound +public import LeanPool.GraphMinor.GM12.Section3BoundaryLinked +import LeanPool.GraphMinor.GM12.Section3FeasibilityForest +import LeanPool.GraphMinor.GM12.Section3ForestAlphaReduction + +/-! +# The final reduction of XII (3.1) to VII + +Once the alpha bound and the surface model are known, apply VII (7.5) +to the actual punctured drawing and feasibility forest. Boundary +linkage follows from XII (3.1)(v). The feasible forest preserves its +boundary connection classes, giving connected subdrawings. Finally, +include them back into the original surface. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +universe u + +/-- The application of VII (7.5) in XII (3.1), page 245, after the +alpha estimate and the surface model have been established. All drawing, +forest, boundary-linkage and ambient-transfer steps are proved here. -/ +theorem connecting_subdrawings_of_alpha_bound + {S : Type u} [TopologicalSpace S] [T2Space S] {t p : ℕ} + (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : Fin t → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (havoid : ∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) + (Zs : Fin p → Set S) (hcover : ⋃ j, Zs j = discBoundaryVertices Γ Δ) + (_hne : ∀ j, (Zs j).Nonempty) + (hdisZ : ∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) + (hfeasible : IsTopologicallyFeasible Δ Zs) + (hbound : ∀ F : Set S, Γ.IsNormal F → IsOArc F → F ⊆ discComplement Δ → + ∀ D : Set S, IsClosedDisc D → discBd D = F → + ∀ i, (∀ j, Δ j ⊆ D ↔ j = i) → + (Γ.V ∩ discBd (Δ i)).ncard ≤ (Γ.V ∩ F).ncard) + (a b c z : ℕ) (hcomplex : 3 ≤ 3 * a + 3 * b + c) + (hmodel : Nonempty (discComplement Δ ≃ₜ SurfaceModel a b c)) + (hcount : (discBoundaryVertices Γ Δ).ncard ≤ z) + (hα : 42 * (z + c + 1) * GM07.vModel a b (c + 1) (z + c + 1) ≤ + GM07.alpha (drawingInSubspace Γ (discComplement Δ) + (drawing_support_subset_discComplement hS Γ Δ hΔ hdisj havoid))) : + HasConnectingSubdrawings Γ (discBoundaryVertices Γ Δ) Zs := by + let Z := discBoundaryVertices Γ Δ + have hZs : ∀ j, Zs j ⊆ Z := by + intro j x hx + change x ∈ discBoundaryVertices Γ Δ + rw [← hcover] + exact mem_iUnion.mpr ⟨j, hx⟩ + have hZsV : ∀ j, Zs j ⊆ Γ.V := by + intro j x hx + obtain ⟨i, hxi⟩ := mem_iUnion.mp (hZs j hx) + exact hxi.1 + have hZsBd : ∀ j, Zs j ⊆ ⋃ i, discBd (Δ i) := by + intro j x hx + obtain ⟨i, hxi⟩ := mem_iUnion.mp (hZs j hx) + exact mem_iUnion.mpr ⟨i, hxi.2⟩ + obtain ⟨H, hHF, hHB, hclasses⟩ := exists_feasibility_forest hS Δ hΔ hdisj Zs + (fun j => Γ.finite_V.subset (hZsV j)) hZsBd hfeasible + exact connecting_subdrawings_of_alpha_bound_of_forest hS Γ Δ hΔ hdisj havoid Zs hcover + hdisZ H hHF hHB hclasses hbound a b c z hcomplex hmodel hcount hα + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3AmbientDrawing.lean b/LeanPool/GraphMinor/GM12/Section3AmbientDrawing.lean new file mode 100644 index 0000000000..9ac6602970 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3AmbientDrawing.lean @@ -0,0 +1,85 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM12.Section3SubtypeComponents + +/-! +# Returning a drawing from a closed subspace to the surface + +After VII is applied in the punctured surface of XII (3.1), page 245, +its subdrawings must be read in the original surface. The punctured +surface is closed, so inclusion preserves closed supports and edge +closures. Arc-components and their line or circle parametrizations +then give the ambient drawing with the same vertices and edges. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Read a drawing of a closed subspace in the ambient space. This is +the return from Sigma-star to Sigma in XII (3.1), page 245. -/ +def drawingFromClosedSubspace {S : Type*} [TopologicalSpace S] + (C : Set S) (hC : IsClosed C) (H : Drawing C) : Drawing S where + U := (Subtype.val : C → S) '' H.U + V := (Subtype.val : C → S) '' H.V + V_subset_U := image_mono H.V_subset_U + isClosed_U := hC.isClosedEmbedding_subtypeVal.isClosedMap _ H.isClosed_U + finite_V := H.finite_V.image Subtype.val + finite_edges := by + rw [← image_sdiff Subtype.val_injective, arcComponentsIn_subtype_image] + exact H.finite_edges.image _ + edge_cond := by + intro e' he' + rw [← image_sdiff Subtype.val_injective, arcComponentsIn_subtype_image] at he' + obtain ⟨e, he, rfl⟩ := he' + have hcl := hC.isClosedEmbedding_subtypeVal.closure_image_eq e + have hcap : closure ((Subtype.val : C → S) '' e) ∩ (Subtype.val : C → S) '' H.V = + (Subtype.val : C → S) '' (closure e ∩ H.V) := by + rw [hcl, ← image_inter Subtype.val_injective] + rcases H.edge_cond e he with ⟨v, w, hvw, hends, hL⟩ | ⟨v, hends, hO⟩ + · left + refine ⟨v.val, w.val, fun h => hvw (Subtype.ext h), ?_, ?_⟩ + · rw [hcap, hends, image_pair] + · rw [hcl] + obtain ⟨f, hf0, hf1⟩ := hL + refine ⟨f.trans (IsEmbedding.subtypeVal.homeomorphImage (closure e)), ?_, ?_⟩ + · exact congrArg Subtype.val hf0 + · exact congrArg Subtype.val hf1 + · right + refine ⟨v.val, ?_, ?_⟩ + · rw [hcap, hends, image_singleton] + · rw [hcl] + obtain ⟨f⟩ := hO + exact ⟨f.trans (IsEmbedding.subtypeVal.homeomorphImage (closure e))⟩ + +/-- Support of a drawing returned from a closed subspace. -/ +theorem drawingFromClosedSubspace_U {S : Type*} [TopologicalSpace S] + (C : Set S) (hC : IsClosed C) (H : Drawing C) : + (drawingFromClosedSubspace C hC H).U = (Subtype.val : C → S) '' H.U := by rfl + +/-- Vertices of a drawing returned from a closed subspace. -/ +theorem drawingFromClosedSubspace_V {S : Type*} [TopologicalSpace S] + (C : Set S) (hC : IsClosed C) (H : Drawing C) : + (drawingFromClosedSubspace C hC H).V = (Subtype.val : C → S) '' H.V := by rfl + +/-- Edges of a drawing returned from a closed subspace. -/ +theorem drawingFromClosedSubspace_E {S : Type*} [TopologicalSpace S] + (C : Set S) (hC : IsClosed C) (H : Drawing C) : + (drawingFromClosedSubspace C hC H).E = + (image (Subtype.val : C → S)) '' H.E := by + change arcComponentsIn ((Subtype.val : C → S) '' H.U \ (Subtype.val : C → S) '' H.V) = _ + rw [← image_sdiff Subtype.val_injective, arcComponentsIn_subtype_image] + rfl + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3AmbientFeasibilityForest.lean b/LeanPool/GraphMinor/GM12/Section3AmbientFeasibilityForest.lean new file mode 100644 index 0000000000..78d650c5b8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3AmbientFeasibilityForest.lean @@ -0,0 +1,109 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3FeasibilityDiscs +public import LeanPool.GraphMinor.GM12.Section3DiscStarForest +import LeanPool.GraphMinor.GM12.Section3FiniteDrawingUnion +import LeanPool.GraphMinor.GM12.Section3DisjointFamilyWalks +import LeanPool.GraphMinor.GM11.Walks + +/-! +# A feasibility forest in the original surface + +For the auxiliary-disc step of XII (3.2), page 247, construct the +boundary-connection forest before choosing the third disc. Draw a +finite star inside each topological feasibility disc. Their supports +are disjoint, so their union is a forest. It meets the prescribed +discs exactly at the prescribed vertices and has exactly the required +boundary connection classes. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The feasibility forest of XII (3.1), retained in the original +surface to choose the auxiliary disc of (3.2), page 247. -/ +theorem exists_ambient_feasibility_forest + {S : Type*} [TopologicalSpace S] [T2Space S] {t p : ℕ} + (hS : IsClosedSurface S) (Δ : Fin t → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdis : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (Zs : Fin p → Set S) (hfin : ∀ j, (Zs j).Finite) + (hZ : ∀ j, Zs j ⊆ ⋃ i, discBd (Δ i)) (hfeasible : IsTopologicallyFeasible Δ Zs) : + ∃ K : Drawing S, IsGraphForest K.toGraph ∧ + K.U ∩ ⋃ i, Δ i = ⋃ j, Zs j ∧ K.V ∩ ⋃ i, Δ i = ⋃ j, Zs j ∧ + ∀ j, ∀ x ∈ Zs j, ∀ y ∈ K.V ∩ ⋃ i, Δ i, + Nonempty (GraphWalk K.toGraph x y) ↔ y ∈ Zs j := by + classical + obtain ⟨D, hD, hDD, hcontact⟩ := hfeasible + have hlocal : ∀ j, ∃ H : Drawing S, H.U ⊆ D j ∧ IsGraphForest H.toGraph ∧ + IsConnectedDrawing H ∧ Zs j ⊆ H.V := by + intro j + have hZbd := feasibility_contacts_subset_discBd hS Δ hΔ hdis (hD j) (hcontact j) (hZ j) + obtain ⟨H, c, _, hUD, hV, _, hF, hC⟩ := exists_connected_forest_in_disc (hD j) (hfin j) hZbd + refine ⟨H, hUD, hF, hC, ?_⟩ + rw [hV] + exact subset_insert _ _ + choose H hHU hHF hHC hZV using hlocal + have hdisU : Pairwise (fun i j => Disjoint (H i).U (H j).U) := + fun i j hij => (hDD i j hij).mono (hHU i) (hHU j) + obtain ⟨K, hKU, hKV, hKE⟩ := exists_finite_disjoint_drawing_union H hdisU + have hsub : ∀ i, (H i).IsSubdrawing K := by + intro i + constructor + · intro x hx + rw [hKV] + exact mem_iUnion.mpr ⟨i, hx⟩ + · intro e he + rw [hKE] + exact mem_iUnion.mpr ⟨i, he⟩ + have hdisV : Pairwise (fun i j => Disjoint (H i).V (H j).V) := + fun i j hij => (hdisU hij).mono (H i).V_subset_U (H j).V_subset_U + have hF : IsGraphForest K.toGraph := isGraphForest_of_disjoint_family_cover H K + hsub hdisV hKV.subset hKE.subset hHF + have hHUcap : ∀ j, (H j).U ∩ ⋃ i, Δ i = Zs j := by + intro j + apply Subset.antisymm + · intro x hx + exact (hcontact j).subset ⟨hHU j hx.1, hx.2⟩ + · intro x hx + exact ⟨(H j).V_subset_U (hZV j hx), ((hcontact j).symm.subset hx).2⟩ + have hKUcap : K.U ∩ ⋃ i, Δ i = ⋃ j, Zs j := by + ext x + constructor + · rintro ⟨hx, hxΔ⟩ + rw [hKU] at hx + obtain ⟨j, hxj⟩ := mem_iUnion.mp hx + exact mem_iUnion.mpr ⟨j, (hHUcap j).subset ⟨hxj, hxΔ⟩⟩ + · intro hx + obtain ⟨j, hxj⟩ := mem_iUnion.mp hx + refine ⟨K.V_subset_U ((hsub j).1 (hZV j hxj)), ?_⟩ + exact ((hcontact j).symm.subset hxj).2 + have hKVcap : K.V ∩ ⋃ i, Δ i = ⋃ j, Zs j := by + apply Subset.antisymm + · exact (inter_subset_inter_left _ K.V_subset_U).trans hKUcap.subset + · intro x hx + obtain ⟨j, hxj⟩ := mem_iUnion.mp hx + exact ⟨(hsub j).1 (hZV j hxj), ((hcontact j).symm.subset hxj).2⟩ + refine ⟨K, hF, hKUcap, hKVcap, ?_⟩ + intro j x hx y hy + constructor + · rintro ⟨W⟩ + have hyH := (walk_stays_in_disjoint_family H K hsub hdisV hKE.subset j W (hZV j hx)).1 + y W.end_mem_support + exact (hHUcap j).subset ⟨(H j).V_subset_U hyH, hy.2⟩ + · intro hyj + obtain ⟨W⟩ := hHC j x (hZV j hx) y (hZV j hyj) + obtain ⟨W', _, _⟩ := (hsub j).exists_walk_up W + exact ⟨W'⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3AmbientTransfer.lean b/LeanPool/GraphMinor/GM12/Section3AmbientTransfer.lean new file mode 100644 index 0000000000..d1b60ce602 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3AmbientTransfer.lean @@ -0,0 +1,135 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM12.Section3AmbientDrawing +public import LeanPool.GraphMinor.GM12.Section3SubspaceDrawing +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Returning connected subdrawings from the punctured surface + +XII (3.1), page 245, applies VII in Sigma-star and needs connected +subdrawings of the original drawing in Sigma. Inclusion of the closed +subspace maps edges and graph walks, preserves connectedness and vertex +disjointness, and preserves the prescribed intersections with the +boundary vertex set. This file proves that final ambient transfer. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A subdrawing of the restricted drawing becomes a subdrawing of +the original drawing when returned to the ambient space. -/ +theorem drawingFromClosedSubspace_isSubdrawing {S : Type*} [TopologicalSpace S] + (Γ : Drawing S) (C : Set S) (hC : IsClosed C) (hUC : Γ.U ⊆ C) + {H : Drawing C} (hH : H.IsSubdrawing (drawingInSubspace Γ C hUC)) : + (drawingFromClosedSubspace C hC H).IsSubdrawing Γ := by + constructor + · rw [drawingFromClosedSubspace_V] + rintro x ⟨y, hy, rfl⟩ + have hm := hH.1 hy + rw [drawingInSubspace_V] at hm + exact hm + · rw [drawingFromClosedSubspace_E] + rintro e ⟨e', he', rfl⟩ + have hm := hH.2 he' + rw [drawingInSubspace_E] at hm + obtain ⟨E, hE, hpreE⟩ := hm + have hEC : E ⊆ C := fun x hx => hUC (hE.2.1 hx).1 + have himage : (Subtype.val : C → S) '' e' = E := by + rw [← hpreE, Subtype.image_preimage_coe, inter_eq_right.mpr hEC] + exact himage.symm ▸ hE + +/-- A link maps through inclusion of the closed ambient subspace. -/ +theorem isLink_drawingFromClosedSubspace {S : Type*} [TopologicalSpace S] + (C : Set S) (hC : IsClosed C) (H : Drawing C) + {e : Set C} {x y : C} (hl : H.toGraph.IsLink e x y) : + (drawingFromClosedSubspace C hC H).toGraph.IsLink + ((Subtype.val : C → S) '' e) x.val y.val := by + refine ⟨?_, ?_, ?_, ?_⟩ + · rw [drawingFromClosedSubspace_E] + exact ⟨e, hl.1, rfl⟩ + · rw [drawingFromClosedSubspace_V] + exact ⟨x, hl.2.1, rfl⟩ + · rw [drawingFromClosedSubspace_V] + exact ⟨y, hl.2.2.1, rfl⟩ + · rw [drawingFromClosedSubspace_V, hC.isClosedEmbedding_subtypeVal.closure_image_eq, + ← image_inter Subtype.val_injective, hl.2.2.2, image_pair] + +/-- A graph walk in the closed subspace gives an ambient graph walk +between the same points. -/ +theorem exists_walk_drawingFromClosedSubspace {S : Type*} [TopologicalSpace S] + (C : Set S) (hC : IsClosed C) (H : Drawing C) {x y : C} (W : GraphWalk H.toGraph x y) : + Nonempty (GraphWalk (drawingFromClosedSubspace C hC H).toGraph x.val y.val) := by + induction W with + | nil hx => + refine ⟨.nil ?_⟩ + change _ ∈ (drawingFromClosedSubspace C hC H).V + rw [drawingFromClosedSubspace_V] + exact ⟨_, hx, rfl⟩ + | cons hl rest ih => + obtain ⟨R⟩ := ih + exact ⟨.cons (isLink_drawingFromClosedSubspace C hC H hl) R⟩ + +/-- Connectedness is preserved when a drawing in a closed subspace +is read in the ambient space. -/ +theorem isConnectedDrawing_drawingFromClosedSubspace {S : Type*} [TopologicalSpace S] + (C : Set S) (hC : IsClosed C) {H : Drawing C} (hH : IsConnectedDrawing H) : + IsConnectedDrawing (drawingFromClosedSubspace C hC H) := by + intro x hx y hy + rw [drawingFromClosedSubspace_V] at hx hy + obtain ⟨x', hx', rfl⟩ := hx + obtain ⟨y', hy', rfl⟩ := hy + obtain ⟨W⟩ := hH x' hx' y' hy' + exact exists_walk_drawingFromClosedSubspace C hC H W + +/-- The connected subdrawings obtained in Sigma-star give the exact +connected-subdrawing conclusion in Sigma of XII (3.1), page 245. -/ +theorem hasConnectingSubdrawings_from_closed_subspace {S : Type*} [TopologicalSpace S] + (Γ : Drawing S) (C : Set S) (hC : IsClosed C) (hUC : Γ.U ⊆ C) + {p : ℕ} {Z : Set S} {Zs : Fin p → Set S} (hZs : ∀ j, Zs j ⊆ C) + (hconnect : HasConnectingSubdrawings (drawingInSubspace Γ C hUC) + ((Subtype.val : C → S) ⁻¹' Z) (fun j => (Subtype.val : C → S) ⁻¹' Zs j)) : + HasConnectingSubdrawings Γ Z Zs := by + obtain ⟨H, hsub, hconn, hdisj, hboundary⟩ := hconnect + let K : Fin p → Drawing S := fun j => drawingFromClosedSubspace C hC (H j) + refine ⟨K, fun j => drawingFromClosedSubspace_isSubdrawing Γ C hC hUC (hsub j), + fun j => isConnectedDrawing_drawingFromClosedSubspace C hC (hconn j), ?_, ?_⟩ + · intro i j hij + apply Set.disjoint_left.mpr + intro x hxi hxj + rw [drawingFromClosedSubspace_V] at hxi hxj + obtain ⟨y, hy, hyx⟩ := hxi + obtain ⟨z, hz, hzx⟩ := hxj + have hyz : y = z := Subtype.ext (hyx.trans hzx.symm) + exact Set.disjoint_left.mp (hdisj i j hij) hy (hyz.symm ▸ hz) + · intro j + ext x + constructor + · rintro ⟨hxK, hxZ⟩ + rw [drawingFromClosedSubspace_V] at hxK + obtain ⟨y, hy, rfl⟩ := hxK + have hm : y ∈ (H j).V ∩ (Subtype.val : C → S) ⁻¹' Z := ⟨hy, hxZ⟩ + rw [hboundary j] at hm + exact hm + · intro hx + let y : C := ⟨x, hZs j hx⟩ + have hm : y ∈ (H j).V ∩ (Subtype.val : C → S) ⁻¹' Z := by + rw [hboundary j] + exact hx + refine ⟨?_, hm.2⟩ + rw [drawingFromClosedSubspace_V] + exact ⟨y, hm.1, rfl⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3AuxiliaryDisc.lean b/LeanPool/GraphMinor/GM12/Section3AuxiliaryDisc.lean new file mode 100644 index 0000000000..eb5c5baa6c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3AuxiliaryDisc.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3DiscRegion +import LeanPool.GraphMinor.GM11.Section4c +import LeanPool.GraphMinor.Surface.DiscMerge +import LeanPool.GraphMinor.Surface.Cap + +/-! +# Placing the auxiliary disc away from a forest + +For the two-disc case of XII (3.2), page 247, choose an interior +point of the intermediate region outside the feasibility forest. +A drawing contains no open subset of the surface, so such a point +exists. A small coordinate disc stays in that region and misses +the forest. The unique-region lemma makes it disjoint from the +original prescribed discs as well. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 Metric + +private theorem exists_closed_disc_subset_open + {S : Type*} [TopologicalSpace S] (hS : IsClosedSurface S) + {W : Set S} (hW : IsOpen W) (hne : W.Nonempty) : + ∃ E : Set S, IsClosedDisc E ∧ E ⊆ W := by + obtain ⟨x, hx⟩ := hne + obtain ⟨U, h, g, c, hUW, _⟩ := (hS.2.2 x).exists_ballChart hW hx (R := 2) (by norm_num) + have hsub : closedBall (0 : ℂ) 1 ⊆ ball 0 2 := closedBall_subset_ball (by norm_num) + have hD : IsClosedDisc (closedBall (0 : ℂ) 1) := + (isClosedDisc_of_convex (convex_closedBall 0 1) (by + rw [interior_closedBall _ one_ne_zero] + exact ⟨0, by simp⟩) isBounded_closedBall isClosed_closedBall).1 + refine ⟨g '' closedBall 0 1, (c.image_disc hD hsub).1, ?_⟩ + rintro y ⟨z, hz, rfl⟩ + exact hUW (c.gm (hsub hz)) + +/-- An auxiliary disc inside a third region can be chosen disjoint +from a given drawing, in particular from the feasibility forest. +This is the disc-placement step of XII (3.2), page 247. -/ +theorem exists_auxiliary_disc_in_region + {S ι : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (Γ K : Drawing S) (Δ r : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (havoid : ∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) + (hr : ∀ i, r i ∈ Γ.R) (hrΔ : ∀ i, (r i ∩ Δ i).Nonempty) + {q : Set S} (hq : q ∈ Γ.R) (hne : ∀ i, q ≠ r i) : + ∃ E : Set S, IsClosedDisc E ∧ E ⊆ q ∧ Disjoint E Γ.U ∧ + Disjoint E K.U ∧ ∀ i, Disjoint E (Δ i) := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨x, hxq, hxK⟩ := exists_notMem_U (Γ := K) hS (region_isOpen hq) (region_nonempty hq) + obtain ⟨E, hE, hEW⟩ := exists_closed_disc_subset_open hS + ((region_isOpen hq).inter K.isClosed_U.isOpen_compl) ⟨x, hxq, hxK⟩ + have hEq : E ⊆ q := fun _ hx => (hEW hx).1 + refine ⟨E, hE, hEq, Set.disjoint_left.mpr (fun x hx => region_subset hq (hEq hx)), + Set.disjoint_left.mpr (fun x hx => (hEW hx).2), ?_⟩ + intro i + exact (region_disjoint_disc_of_ne hS (hΔ i) (havoid i) (hr i) hq (hrΔ i) (hne i)).mono_left hEq + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3BarbellCircles.lean b/LeanPool/GraphMinor/GM12/Section3BarbellCircles.lean new file mode 100644 index 0000000000..295a3de4d6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3BarbellCircles.lean @@ -0,0 +1,83 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CirclePairGraph +import LeanPool.GraphMinor.GM12.Section3BridgeSeparation +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.Surface.DiscMerge + +/-! +# Circles inside the first two-loop shape + +In the Section 8 argument used by XII (3.1), page 245, the joining +edge of the first two-loop shape is a bridge. The finite-graph edge-or +lemma says that a circle either contains that edge or misses its open +part. Containing it contradicts connectedness after deleting the +midpoint. A circle missing its open part lies in the disjoint union +of the two original circles and hence in one of them. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- Every circle in the first two-loop shape is contained in one of +its two original circles. The joining line cannot belong to a circle. -/ +theorem oArc_subset_disjoint_circle_or + {S : Type*} [TopologicalSpace S] [T2Space S] {F A P Z : Set S} {a b : S} + (hF : IsOArc F) (hA : IsOArc A) (hdis : Disjoint F A) + (hP : IsLineWithEnds P a b) (ha : a ∈ F) (hb : b ∈ A) + (hPF : P ∩ F = {a}) (hPA : P ∩ A = {b}) + (hZ : IsOArc Z) (hZY : Z ⊆ F ∪ A ∪ P) : Z ⊆ F ∨ Z ⊆ A := by + have hFc : IsClosed F := hF.isCompact.isClosed + have hAc : IsClosed A := hA.isCompact.isClosed + have hnoP : ¬ P ⊆ Z := by + intro hPZ + obtain ⟨p, U, V, hUc, hVc, hcover, hinter, haU, haV, hbV, hbU⟩ := + exists_closed_separation_of_joining_line hF hA hdis hP ha hb hPF hPA + have hp : p ∈ U ∩ V := hinter.symm ▸ mem_singleton p + have haZ : a ∈ Z \ {p} := + ⟨hPZ hP.left_mem, fun hap => haV (hap.symm ▸ hp.2)⟩ + have hbZ : b ∈ Z \ {p} := + ⟨hPZ hP.right_mem, fun hbp => hbU (hbp.symm ▸ hp.1)⟩ + have hsub : Z \ {p} ⊆ U ∪ V := by + intro x hx + rw [hcover] + exact hZY hx.1 + have hmiss : ∀ x ∈ Z \ {p}, x ∈ U → x ∉ V := by + intro x hx hxU hxV + exact hx.2 (hinter ▸ (show x ∈ U ∩ V from ⟨hxU, hxV⟩)) + rcases subset_or_subset_of_closed (hZ.twoConn p) hUc hVc hsub hmiss with hZU | hZV + · exact hbU (hZU hbZ) + · exact haV (hZV haZ) + obtain ⟨V, E, hG, hgr, hPE, hPV⟩ := + exists_graph_of_disjoint_circles_with_joining_line hF hA hdis hP ha hb hPF hPA + have hZG : Z ⊆ gr V E := hZY.trans hgr.symm.le + have hgap : Disjoint (P \ V) Z := (hG.edge_or hZ hZG hPE).resolve_left hnoP + have hZA : Z ⊆ F ∪ A := by + intro x hxZ + rcases hZY hxZ with hxFA | hxP + · exact hxFA + · by_cases hxFA : x ∈ F ∪ A + · exact hxFA + · have hxV : x ∉ V := by + intro hxV + have hx : x ∈ P ∩ V := ⟨hxP, hxV⟩ + rw [hPV] at hx + rcases hx with hxa | hxb + · exact hxFA (Or.inl (hxa.symm ▸ ha)) + · exact hxFA (Or.inr (hxb.symm ▸ hb)) + exact False.elim (Set.disjoint_left.mp hgap ⟨hxP, hxV⟩ hxZ) + exact subset_or_subset_of_closed hZ.isPreconnected hFc hAc hZA + (fun x _ hxF hxA => Set.disjoint_left.mp hdis hxF hxA) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3BarbellSchismatic.lean b/LeanPool/GraphMinor/GM12/Section3BarbellSchismatic.lean new file mode 100644 index 0000000000..8cd41a2de0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3BarbellSchismatic.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CircleObstructions +import LeanPool.GraphMinor.GM12.Section3BarbellCircles + +/-! +# The first two-loop obstruction is schismatic + +In the Section 8 argument used by XII (3.1), page 245, the two original +loops are near-planar but their joined set is not. Every circle in +that set lies in one original loop, so it is near-planar. This proves +the minimal-circle clause of the schismatic definition and closes the +disjoint-selected-circle case of extraction. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A first two-loop shape with near-planar loops and a whole set +which is not near-planar is schismatic in VII's exact definition. -/ +theorem isSchismatic_x1_of_nearPlanar_loops + {S : Type*} [TopologicalSpace S] [T2Space S] {F A P : Set S} {a b : S} + (hF : IsOArc F) (hA : IsOArc A) (hdis : Disjoint F A) + (hP : IsLineWithEnds P a b) (ha : a ∈ F) (hb : b ∈ A) + (hPF : P ∩ F = {a}) (hPA : P ∩ A = {b}) + (hnearF : GM07.IsNearPlanar F) (hnearA : GM07.IsNearPlanar A) + (hnot : ¬ GM07.IsNearPlanar (F ∪ A ∪ P)) : GM07.IsSchismatic (F ∪ A ∪ P) := by + refine ⟨Or.inr (Or.inl ⟨F, A, P, a, b, hF, hA, hdis, hP, ha, hb, hPF, hPA, rfl⟩), hnot, ?_⟩ + intro Z hZ hZY + rcases oArc_subset_disjoint_circle_or hF hA hdis hP ha hb hPF hPA hZ hZY.1 with hZF | hZA + · exact isNearPlanar_mono hZF hnearF + · exact isNearPlanar_mono hZA hnearA + +/-- Disjoint selected circles around distinct cuffs give a schismatic +first two-loop set inside the original connected solid candidate. -/ +theorem exists_schismatic_x1_of_disjoint_surrounding_subcircles + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + {X F A : Set (discComplement Δ)} (hX : IsSolid X) (hconn : IsConnected X) + {i j : ι} (hij : i ≠ j) (hF : IsOArc F) (hA : IsOArc A) + (hFX : F ⊆ X) (hAX : A ⊆ X) (hFA : Disjoint F A) + (hsi : GM07.SurroundsCuff F (Subtype.val ⁻¹' discBd (Δ i))) + (hsj : GM07.SurroundsCuff A (Subtype.val ⁻¹' discBd (Δ j))) : + ∃ Y : Set (discComplement Δ), Y ⊆ X ∧ GM07.IsSchismatic Y := by + have harc := isArcConnected_of_isConnected_isLocallyArcConnected hconn hX.1 + obtain ⟨P, a, b, hP, hPX, ha, hb, _, hPF, hPA⟩ := + exists_joining_line_between_disjoint_circles harc hF hA hFX hAX hFA + have hnot : ¬ GM07.IsNearPlanar (F ∪ A ∪ P) := + not_isNearPlanar_of_distinct_surrounding_subcircles hS Δ hΔ hdisj hcase hij hF hA + (subset_union_left.trans subset_union_left) (subset_union_right.trans subset_union_left) hsi + hsj + refine ⟨F ∪ A ∪ P, union_subset (union_subset hFX hAX) hPX, ?_⟩ + exact isSchismatic_x1_of_nearPlanar_loops hF hA hFA hP ha hb hPF hPA + (Or.inr ⟨_, hsi.1, hsi.2.1⟩) (Or.inr ⟨_, hsj.1, hsj.2.1⟩) hnot + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3BoundaryEquality.lean b/LeanPool/GraphMinor/GM12/Section3BoundaryEquality.lean new file mode 100644 index 0000000000..a2ef16ece8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3BoundaryEquality.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3PuncturedBoundary +import LeanPool.GraphMinor.Surface.DiscMerge +import LeanPool.GraphMinor.Surface.DiscsInSurface +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# The exact boundary of the punctured surface + +For XII (3.1), page 245, Sigma-star has precisely the prescribed disc +boundaries as its manifold boundary. A subspace interior chart has +ambient open image by invariance of domain. At a disc boundary point, +every ambient neighbourhood meets the disc interior, so such a chart +cannot stay in Sigma-star. Together with the opposite inclusion, this +identifies the boundary and the exact boundary vertex set. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 Metric + +/-- An interior point of a subspace of a closed surface is an ambient +interior point of that subspace. This is invariance of domain applied +to its open-disc chart. -/ +theorem interiorPoint_subspace_mem_interior {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {C : Set S} {x : C} (hx : IsInteriorPoint x) : + x.val ∈ interior C := by + obtain ⟨U, h, g, hc, _, hg0⟩ := hx.exists_ballChart isOpen_univ (mem_univ x) (R := 1) one_pos + have hg : ContinuousOn (fun z => (g z).val) (ball (0 : ℂ) 1) := + continuous_subtype_val.comp_continuousOn hc.gc + have hgi : InjOn (fun z => (g z).val) (ball (0 : ℂ) 1) := by + intro z hz z' hz' heq + exact hc.hg.injOn hz hz' (Subtype.ext heq) + have hopen : IsOpen ((fun z => (g z).val) '' ball (0 : ℂ) 1) := + isOpen_image_of_manifold isOpen_ball hg hgi (fun _ _ => (hS.2.2 _).isManifoldPoint) + apply mem_interior.mpr + refine ⟨(fun z => (g z).val) '' ball (0 : ℂ) 1, ?_, hopen, ?_⟩ + · rintro y ⟨z, _, rfl⟩ + exact (g z).property + · exact ⟨0, mem_ball_self one_pos, congrArg Subtype.val hg0⟩ + +/-- A point of a removed disc boundary cannot be an ambient interior +point of Sigma-star, since that disc is the closure of its interior. -/ +theorem disc_boundary_not_mem_interior_discComplement {S ι : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + {i : ι} {x : S} (hx : x ∈ discBd (Δ i)) : x ∉ interior (discComplement Δ) := by + intro hxint + have hxcl : x ∈ closure (Δ i \ frontier (Δ i)) := + IsClosedDisc.subset_closure_diff_frontier hS (hΔ i) (Surface.discBd_subset _ hx) + obtain ⟨y, hyC, hyD⟩ := mem_closure_iff.mp hxcl (interior (discComplement Δ)) isOpen_interior + hxint + have hyBd := discComplement_inter_disc_subset_boundary hS Δ hΔ i ⟨interior_subset hyC, hyD.1⟩ + have hyFront : y ∈ frontier (Δ i) := by + rwa [IsClosedDisc.frontier_eq_discBd hS (hΔ i)] + exact hyD.2 hyFront + +/-- The manifold boundary of Sigma-star is exactly the part of the +union of disc boundaries lying in it. This identifies the boundary in +XII (3.1), page 245. -/ +theorem discComplement_boundary_eq {S ι : Type*} [TopologicalSpace S] + [T2Space S] [Finite ι] (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) : + bd (discComplement Δ) = (Subtype.val : discComplement Δ → S) ⁻¹' ⋃ i, discBd (Δ i) := by + apply Subset.antisymm (discComplement_boundary_subset hS Δ hΔ) + intro x hx + obtain ⟨i, hxi⟩ := mem_iUnion.mp hx + intro hxint + exact disc_boundary_not_mem_interior_discComplement hS Δ hΔ hxi + (interiorPoint_subspace_mem_interior hS hxint) + +/-- Boundary vertices of the punctured drawing map to exactly the set +Z used by XII (3.1), pages 244--245. Disjointness keeps every prescribed +disc boundary in Sigma-star. -/ +theorem drawingInDiscComplement_boundary_vertices_eq {S ι : Type*} [TopologicalSpace S] + [T2Space S] [Finite ι] (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hUC : Γ.U ⊆ discComplement Δ) : + (Subtype.val : discComplement Δ → S) '' + ((drawingInSubspace Γ (discComplement Δ) hUC).V ∩ bd (discComplement Δ)) = + discBoundaryVertices Γ Δ := by + apply Subset.antisymm (drawingInDiscComplement_boundary_vertices_subset hS Γ Δ hΔ hUC) + intro x hx + obtain ⟨i, hxV, hxBd⟩ := mem_iUnion.mp hx + have hxC : x ∈ discComplement Δ := disc_boundary_subset_discComplement hS Δ hΔ hdisj i hxBd + let y : discComplement Δ := ⟨x, hxC⟩ + refine ⟨y, ⟨?_, ?_⟩, rfl⟩ + · rw [drawingInSubspace_V] + exact hxV + · rw [discComplement_boundary_eq hS Δ hΔ] + exact mem_iUnion.mpr ⟨i, hxBd⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3BoundaryLinked.lean b/LeanPool/GraphMinor/GM12/Section3BoundaryLinked.lean new file mode 100644 index 0000000000..1dae2696fc --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3BoundaryLinked.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SurroundingDisc +public import LeanPool.GraphMinor.GM12.Section3PuncturedBoundary +import LeanPool.GraphMinor.GM12.Section3PuncturedCuffs +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs + +/-! +# Boundary linkage from XII (3.1)(v) + +Condition (v) of XII (3.1), page 245, bounds the vertex count on a +circle enclosing one prescribed disc. A circle surrounding a cuff in +VII bounds precisely such a disc. The drawing and its vertex counts +are unchanged by inclusion into the original surface, so condition +(v) gives boundary linkage of the drawing in Sigma-star. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Condition (v) of XII (3.1), page 245, implies boundary linkage in +VII's exact sense for the actual drawing in Sigma-star. -/ +theorem drawingInDiscComplement_isBoundaryLinked + {S : Type*} {ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (havoid : ∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) + (hbound : ∀ F : Set S, Γ.IsNormal F → IsOArc F → F ⊆ discComplement Δ → + ∀ D : Set S, IsClosedDisc D → discBd D = F → + ∀ i, (∀ j, Δ j ⊆ D ↔ j = i) → + (Γ.V ∩ discBd (Δ i)).ncard ≤ (Γ.V ∩ F).ncard) : + GM07.IsBoundaryLinked (drawingInSubspace Γ (discComplement Δ) + (drawing_support_subset_discComplement hS Γ Δ hΔ hdisj havoid)) := by + let C := discComplement Δ + let hUC := drawing_support_subset_discComplement hS Γ Δ hΔ hdisj havoid + let G := drawingInSubspace Γ C hUC + refine ⟨drawingInDiscComplement_isProper hS Γ Δ hΔ hdisj havoid, ?_⟩ + intro K hK F hn hF hs + rw [discComplement_cuffs_eq hS Δ hΔ hdisj] at hK + obtain ⟨i, rfl⟩ := hK + obtain ⟨D, hD, hbd, hone⟩ := + surrounding_bounds_disc_including_exactly_one hS Δ hΔ hdisj i hF hs + have hnorm := drawingInSubspace_isNormal_image Γ C hUC hn + have hFo : IsOArc ((Subtype.val : C → S) '' F) := by + obtain ⟨φ⟩ := hF + exact ⟨φ.trans (IsEmbedding.subtypeVal.homeomorphImage F)⟩ + have hcount := hbound _ hnorm hFo (by rintro x ⟨y, _, rfl⟩; exact y.property) + D hD hbd i hone + have hbimage : (Subtype.val : C → S) '' (Subtype.val ⁻¹' discBd (Δ i)) = discBd (Δ i) := by + rw [Subtype.image_preimage_coe] + exact inter_eq_right.mpr (disc_boundary_subset_discComplement hS Δ hΔ hdisj i) + have hleft := drawingInSubspace_image_vertices_inter Γ C hUC (Subtype.val ⁻¹' discBd (Δ i)) + rw [hbimage] at hleft + have hright := drawingInSubspace_image_vertices_inter Γ C hUC F + rw [← hleft, ← hright, ncard_image_of_injective _ Subtype.val_injective, + ncard_image_of_injective _ Subtype.val_injective] at hcount + exact hcount + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3BranchRelabel.lean b/LeanPool/GraphMinor/GM12/Section3BranchRelabel.lean new file mode 100644 index 0000000000..8188952efe --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3BranchRelabel.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ThreeBranchCount + +/-! +# Relabelling the three branches by their surrounding cuffs + +Condition (iv) of XII (3.1), page 245, pairs each branch with the disc +bounded by the other two. The surrounding-cuff classification need not +use this indexing. Relabel the branches by their cuff permutation. +The union, normality and vertex count stay the same, while each +opposite pair now surrounds the prescribed cuff with that index. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A bijection of branch indices also bijects the indices excluding +one chosen index. -/ +theorem iUnion_except_comp_equiv + {S ι κ : Type*} (e : ι ≃ κ) (P : ι → Set S) (i : κ) : + (⋃ j : {j : κ // j ≠ i}, P (e.symm j.val)) = + ⋃ j : {j : ι // j ≠ e.symm i}, P j.val := by + ext x + constructor + · intro hx + obtain ⟨j, hj⟩ := mem_iUnion.mp hx + exact mem_iUnion.mpr ⟨⟨e.symm j.val, fun he => j.property (e.symm.injective he)⟩, hj⟩ + · intro hx + obtain ⟨j, hj⟩ := mem_iUnion.mp hx + have hji : e j.val ≠ i := by + intro he + apply j.property + apply e.injective + rw [he, e.apply_symm_apply] + refine mem_iUnion.mpr ⟨⟨e j.val, hji⟩, ?_⟩ + simpa only [e.symm_apply_apply] using hj + +/-- The bound of XII (3.1)(iv) is unchanged when branches are indexed +by the permutation of the cuffs their opposite circles surround. -/ +theorem three_branch_vertex_count_gt_relabelled + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hsphere : IsSphere S) (Γ : Drawing S) + (Δ : Fin 3 → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hUC : Γ.U ⊆ discComplement Δ) (N : ℕ) + (hbound : IsSphere S → ∀ (P D : Fin 3 → Set S) (a b : S), a ≠ b → + Γ.IsNormal (⋃ i, P i) → (∀ i, IsLineWithEnds (P i) a b) → + (∀ i j, i ≠ j → P i ∩ P j = {a, b}) → (⋃ i, P i) ⊆ discComplement Δ → + (∀ i, IsClosedDisc (D i) ∧ + discBd (D i) = ⋃ j : {j // j ≠ i}, P j.val ∧ Δ i ⊆ D i ∧ ¬ P i ⊆ D i) → + N < (Γ.V ∩ ⋃ i, P i).ncard) + (P : Fin 3 → Set (discComplement Δ)) {a b : discComplement Δ} (hab : a ≠ b) + (hP : ∀ i, IsLineWithEnds (P i) a b) + (hcap : ∀ i j, i ≠ j → P i ∩ P j = {a, b}) + (hQ : ∀ i, IsOArc (⋃ j : {j // j ≠ i}, P j.val)) + (e : Fin 3 ≃ Fin 3) + (hs : ∀ i, GM07.SurroundsCuff (⋃ j : {j // j ≠ i}, P j.val) + (Subtype.val ⁻¹' discBd (Δ (e i)))) + (hn : (drawingInSubspace Γ (discComplement Δ) hUC).IsNormal (⋃ i, P i)) + (hnot : ¬ GM07.IsNearPlanar (⋃ i, P i)) : + N < ((drawingInSubspace Γ (discComplement Δ) hUC).V ∩ ⋃ i, P i).ncard := by + let A : Fin 3 → Set (discComplement Δ) := fun i => P (e.symm i) + have hU : (⋃ i, A i) = ⋃ i, P i := e.symm.surjective.iUnion_comp P + have hO : ∀ i, (⋃ j : {j // j ≠ i}, A j.val) = + ⋃ j : {j // j ≠ e.symm i}, P j.val := fun i => iUnion_except_comp_equiv e P i + have hQ' : ∀ i, IsOArc (⋃ j : {j // j ≠ i}, A j.val) := by + intro i + rw [hO] + exact hQ (e.symm i) + have hs' : ∀ i, GM07.SurroundsCuff (⋃ j : {j // j ≠ i}, A j.val) + (Subtype.val ⁻¹' discBd (Δ i)) := by + intro i + rw [hO] + simpa only [e.apply_symm_apply] using hs (e.symm i) + have hnormal : (drawingInSubspace Γ (discComplement Δ) hUC).IsNormal (⋃ i, A i) := by + rw [hU] + exact hn + have hnot' : ¬ GM07.IsNearPlanar (⋃ i, A i) := by rw [hU]; exact hnot + have hbig := three_branch_vertex_count_gt hS hsphere Γ Δ hΔ hdisj hUC N hbound A hab + (fun i => hP (e.symm i)) + (fun i j hij => hcap (e.symm i) (e.symm j) (fun he => hij (e.symm.injective he))) + hQ' hs' hnormal hnot' + rw [hU] at hbig + exact hbig + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3BridgeSeparation.lean b/LeanPool/GraphMinor/GM12/Section3BridgeSeparation.lean new file mode 100644 index 0000000000..b0382accc9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3BridgeSeparation.lean @@ -0,0 +1,126 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.Surface.DiscMerge + +/-! +# Cutting the bridge of the first two-loop shape + +For the Section 8 argument used by XII (3.1), page 245, cut the joining +line at its midpoint. The first circle together with the first half +and the second circle together with the second half are closed sets +meeting only at that midpoint. The attachment points lie on opposite +sides. A circle containing the bridge would therefore become disconnected +when its midpoint is removed. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Cutting the joining line of two disjoint circles gives a closed +separation whose intersection is one point and whose sides separate +the two attachment points. -/ +theorem exists_closed_separation_of_joining_line + {S : Type*} [TopologicalSpace S] [T2Space S] {F A P : Set S} {a b : S} + (hF : IsOArc F) (hA : IsOArc A) (hdis : Disjoint F A) + (hP : IsLineWithEnds P a b) (ha : a ∈ F) (hb : b ∈ A) + (hPF : P ∩ F = {a}) (hPA : P ∩ A = {b}) : + ∃ p U V, IsClosed U ∧ IsClosed V ∧ U ∪ V = F ∪ A ∪ P ∧ U ∩ V = {p} ∧ + a ∈ U ∧ a ∉ V ∧ b ∈ V ∧ b ∉ U := by + obtain ⟨φ, hφ0, hφ1⟩ := hP + let g : unitInterval → S := fun s => (φ s).val + have hgc : Continuous g := continuous_subtype_val.comp φ.continuous + have hgi : Function.Injective g := fun s t he => φ.injective (Subtype.ext he) + have hg0 : g 0 = a := hφ0 + have hg1 : g 1 = b := hφ1 + have hgP : range g = P := by + ext x + constructor + · rintro ⟨s, rfl⟩ + exact (φ s).property + · intro hx + exact ⟨φ.symm ⟨x, hx⟩, congrArg Subtype.val (φ.apply_symm_apply ⟨x, hx⟩)⟩ + let t : unitInterval := ⟨1 / 2, by constructor <;> norm_num⟩ + have ht0 : (0 : unitInterval) < t := by change (0 : ℝ) < 1 / 2; norm_num + have ht1 : t < (1 : unitInterval) := by change (1 / 2 : ℝ) < 1; norm_num + let L := g '' Iic t + let R := g '' Ici t + have hLc : IsClosed L := (isClosed_Iic.isCompact.image hgc).isClosed + have hRc : IsClosed R := (isClosed_Ici.isCompact.image hgc).isClosed + have hLa : a ∈ L := ⟨0, ht0.le, hg0⟩ + have hRb : b ∈ R := ⟨1, ht1.le, hg1⟩ + have hRa : a ∉ R := by + rintro ⟨s, hs, hgs⟩ + have hs0 := hgi (hgs.trans hg0.symm) + rw [hs0] at hs + exact ht0.not_ge hs + have hLb : b ∉ L := by + rintro ⟨s, hs, hgs⟩ + have hs1 := hgi (hgs.trans hg1.symm) + rw [hs1] at hs + exact ht1.not_ge hs + have hLP : L ⊆ P := (image_subset_range _ _).trans hgP.le + have hRP : R ⊆ P := (image_subset_range _ _).trans hgP.le + have hFR : Disjoint F R := by + apply Set.disjoint_left.mpr + intro x hxF hxR + have hx : x ∈ P ∩ F := ⟨hRP hxR, hxF⟩ + rw [hPF] at hx + have hxa : x = a := hx + exact hRa (hxa ▸ hxR) + have hLA : Disjoint L A := by + apply Set.disjoint_left.mpr + intro x hxL hxA + have hx : x ∈ P ∩ A := ⟨hLP hxL, hxA⟩ + rw [hPA] at hx + have hxb : x = b := hx + exact hLb (hxb ▸ hxL) + have hLR : L ∩ R = {g t} := by + apply Subset.antisymm + · rintro x ⟨⟨s, hs, rfl⟩, ⟨r, hr, he⟩⟩ + have hrs := hgi he + have hts : t ≤ s := hrs ▸ hr + exact congrArg g (le_antisymm hs hts) + · intro x hx + rw [show x = g t from hx] + exact ⟨⟨t, le_rfl, rfl⟩, ⟨t, le_rfl, rfl⟩⟩ + have hcover : L ∪ R = P := by + apply Subset.antisymm (union_subset hLP hRP) + intro x hx + obtain ⟨s, rfl⟩ := hgP.symm ▸ hx + rcases le_total s t with hst | hts + · exact Or.inl ⟨s, hst, rfl⟩ + · exact Or.inr ⟨s, hts, rfl⟩ + refine ⟨g t, F ∪ L, A ∪ R, hF.isCompact.isClosed.union hLc, + hA.isCompact.isClosed.union hRc, ?_, ?_, Or.inl ha, ?_, Or.inl hb, ?_⟩ + · rw [← hcover] + ac_rfl + · apply Subset.antisymm + · rintro x ⟨hxF | hxL, hxA | hxR⟩ + · exact False.elim (Set.disjoint_left.mp hdis hxF hxA) + · exact False.elim (Set.disjoint_left.mp hFR hxF hxR) + · exact False.elim (Set.disjoint_left.mp hLA hxL hxA) + · exact hLR ▸ (show x ∈ L ∩ R from ⟨hxL, hxR⟩) + · intro x hx + have hxLR : x ∈ L ∩ R := hLR.symm ▸ hx + exact ⟨Or.inr hxLR.1, Or.inr hxLR.2⟩ + · rintro (haA | haR) + · exact Set.disjoint_left.mp hdis ha haA + · exact hRa haR + · rintro (hbF | hbL) + · exact Set.disjoint_left.mp hdis hbF hb + · exact hLb hbL + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CandidateExistence.lean b/LeanPool/GraphMinor/GM12/Section3CandidateExistence.lean new file mode 100644 index 0000000000..39ca451e1d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CandidateExistence.lean @@ -0,0 +1,62 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3OneCuffCandidate +public import LeanPool.GraphMinor.GM12.Section3TwoCuffCandidate + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Existence of the alpha minimum's candidates + +For XII (3.1), page 245, a nonempty deletion family has either one +member or two distinct members. The one-disc case is on a surface +other than the sphere and uses a normal essential circle. In the +other case, two cuff circles and a normal joining line give a +candidate. Thus the alpha estimate no longer needs an existence +hypothesis about the drawing. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +universe u + +/-- Alpha candidates exist for every nonempty disc deletion family +in the setup of XII (3.1). The geometric construction proves existence +rather than adding it to the drawing or surface data. -/ +theorem exists_alphaCandidate_in_discComplement + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {t : ℕ} (ht : t ≠ 0) + (hcase : ¬ IsSphere S ∨ 3 ≤ t) (Γ : Drawing S) (Δ : Fin t → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (havoid : ∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) : + ∃ X, GM07.IsAlphaCandidate (drawingInSubspace Γ (discComplement Δ) + (drawing_support_subset_discComplement hS Γ Δ hΔ hdisj havoid)) X := by + by_cases ht1 : t = 1 + · subst t + have hns : ¬ IsSphere S := by + rcases hcase with hns | hthree + · exact hns + · exact (by omega : False).elim + exact exists_alphaCandidate_one_disc_of_not_sphere hS hns Γ Δ hΔ hdisj havoid + · have htwo : 2 ≤ t := by omega + let i : Fin t := ⟨0, by omega⟩ + let j : Fin t := ⟨1, by omega⟩ + have hij : i ≠ j := fun he => Nat.zero_ne_one (congrArg Fin.val he) + have hcase' : ¬ IsSphere S ∨ 3 ≤ Nat.card (Fin t) := by rwa [Nat.card_fin] + exact exists_alphaCandidate_of_two_prescribed_cuffs hS Γ Δ hΔ hdisj hcase' havoid hij + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CapComparison.lean b/LeanPool/GraphMinor/GM12/Section3CapComparison.lean new file mode 100644 index 0000000000..1600dce9da --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CapComparison.lean @@ -0,0 +1,122 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM12.Section3DiscBoundaryExtension +import LeanPool.GraphMinor.GM12.Section3GlueHomeomorph +import LeanPool.GraphMinor.Surface.DiscMerge +import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! +# Comparing choices of a cap + +For XII (3.1), page 245, near-planarity in the explicitly filled +surface must agree with near-planarity in every cap used by VII. +The identity on the original surface induces a map of cap boundaries. +Extend that map over the discs and glue along the common boundary. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +universe u + +/-- Two caps of the same cuff are homeomorphic by a map agreeing with +the identity on the uncapped surface. -/ +theorem cappedCuff_homeomorph + {S S₁ S₂ : Type u} [TopologicalSpace S] [TopologicalSpace S₁] [TopologicalSpace S₂] + (hS : IsSurface S) {C : Set S} {j₁ : S → S₁} {j₂ : S → S₂} + {D₁ : Set S₁} {D₂ : Set S₂} + (h₁ : GM07.IsCappedCuff C S₁ j₁ D₁) (h₂ : GM07.IsCappedCuff C S₂ j₂ D₂) : + ∃ H : S₁ ≃ₜ S₂, ∀ x : S, H (j₁ x) = j₂ x := by + let : CompactSpace S := hS.1 + let : CompactSpace S₁ := h₁.isSurface.1 + let : T2Space S₁ := h₁.isSurface.2.1 + let : T2Space S₂ := h₂.isSurface.2.1 + let e₁ := h₁.isEmbedding.toHomeomorph + let e₂ := h₂.isEmbedding.toHomeomorph + let f := e₁.symm.trans e₂ + have hf : ∀ x, (f ⟨j₁ x, mem_range_self x⟩).val = j₂ x := by + intro x + change j₂ (e₁.symm ⟨j₁ x, mem_range_self x⟩) = j₂ x + rw [IsEmbedding.toHomeomorph_symm_apply] + let q₁ : C ≃ₜ discBd D₁ := (h₁.isEmbedding.homeomorphImage C).trans + (Homeomorph.setCongr h₁.discBd_eq.symm) + let q₂ : C ≃ₜ discBd D₂ := (h₂.isEmbedding.homeomorphImage C).trans + (Homeomorph.setCongr h₂.discBd_eq.symm) + let p := q₁.symm.trans q₂ + obtain ⟨g, hg⟩ := exists_disc_homeomorph_extending_boundary h₁.isClosedDisc h₂.isClosedDisc p + have hmem₁ : ∀ x, j₁ x ∈ D₁ ↔ x ∈ C := by + intro x + constructor + · intro hx + have hxI : j₁ x ∈ range j₁ ∩ D₁ := ⟨mem_range_self x, hx⟩ + rw [h₁.inter_eq] at hxI + obtain ⟨y, hy, he⟩ := hxI + exact h₁.isEmbedding.injective he ▸ hy + · intro hx + apply discBd_subset D₁ + rw [h₁.discBd_eq] + exact mem_image_of_mem j₁ hx + have hmem₂ : ∀ x, j₂ x ∈ D₂ ↔ x ∈ C := by + intro x + constructor + · intro hx + have hxI : j₂ x ∈ range j₂ ∩ D₂ := ⟨mem_range_self x, hx⟩ + rw [h₂.inter_eq] at hxI + obtain ⟨y, hy, he⟩ := hxI + exact h₂.isEmbedding.injective he ▸ hy + · intro hx + apply discBd_subset D₂ + rw [h₂.discBd_eq] + exact mem_image_of_mem j₂ hx + have hcross : ∀ x : range j₁, (f x).val ∈ D₂ ↔ x.val ∈ D₁ := by + rintro ⟨_, x, rfl⟩ + rw [hf, hmem₁, hmem₂] + have hagree : ∀ (x : range j₁) (hx : x.val ∈ D₁), + (f x).val = (g ⟨x.val, hx⟩).val := by + rintro ⟨_, x, rfl⟩ hx + have hxC := (hmem₁ x).mp hx + have hxB : j₁ x ∈ discBd D₁ := h₁.discBd_eq.symm ▸ mem_image_of_mem j₁ hxC + rw [hf, hg ⟨j₁ x, hxB⟩] + have hq : q₁.symm ⟨j₁ x, hxB⟩ = ⟨x, hxC⟩ := by + apply q₁.injective + rw [q₁.apply_symm_apply] + exact Subtype.ext rfl + change j₂ x = j₂ (q₁.symm ⟨j₁ x, hxB⟩).val + rw [hq] + obtain ⟨H, hH, _⟩ := exists_homeomorph_of_two_closed_pieces + (isCompact_range h₁.isEmbedding.continuous).isClosed h₁.isClosedDisc.isCompact.isClosed + h₁.union_eq h₂.union_eq f g hcross hagree + exact ⟨H, fun x => (hH ⟨j₁ x, mem_range_self x⟩).trans (hf x)⟩ + +/-- Planarity in one cap gives planarity in every cap, as required by +VII's definition. The comparison homeomorphism fixes the original +surface pointwise. -/ +theorem isPlanarInCappedCuff_of_one_cap + {S S₁ : Type u} [TopologicalSpace S] [TopologicalSpace S₁] + (hS : IsSurface S) {C X : Set S} {j₁ : S → S₁} {D₁ : Set S₁} + (h₁ : GM07.IsCappedCuff C S₁ j₁ D₁) (hX : GM11.IsPlanar (j₁ '' X)) : + GM07.IsPlanarInCappedCuff C X := by + refine ⟨h₁.cuff, ⟨S₁, inferInstance, j₁, D₁, h₁, hX⟩, ?_⟩ + intro S₂ _ j₂ D₂ h₂ + obtain ⟨H, hH⟩ := cappedCuff_homeomorph hS h₁ h₂ + obtain ⟨E, hE, hXE⟩ := hX + have hdisc : IsClosedDisc (H '' E) := by + obtain ⟨φ⟩ := hE + exact ⟨φ.trans (H.isEmbedding.homeomorphImage E)⟩ + refine ⟨H '' E, hdisc, ?_⟩ + rintro y ⟨x, hx, rfl⟩ + exact ⟨j₁ x, hXE (mem_image_of_mem j₁ hx), hH x⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CapOneDisc.lean b/LeanPool/GraphMinor/GM12/Section3CapOneDisc.lean new file mode 100644 index 0000000000..034f9482ce --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CapOneDisc.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3FillOneDisc +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM12.Section3PuncturedCuffs +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs + +/-! +# Capping a prescribed cuff + +In the reduction of XII (3.1), page 245, to VII, a cuff of Sigma-star +is capped by putting its deleted disc back. The space with all other +discs removed supplies the cap, with its inclusion into the original +surface unchanged on points. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Filling one deleted disc gives a capped surface in the precise +sense used for surrounding curves in VII. Both inclusions fix points +of the original surface. -/ +theorem exists_cap_discComplement_cuff + {S : Type*} {ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) (i : ι) : + ∃ j : discComplement Δ → discComplement (fun k : {k // k ≠ i} => Δ k.val), + GM07.IsCappedCuff ((Subtype.val : discComplement Δ → S) ⁻¹' discBd (Δ i)) + (discComplement (fun k : {k // k ≠ i} => Δ k.val)) j + (Subtype.val ⁻¹' Δ i) ∧ ∀ x, (j x).val = x.val := by + let C := discComplement Δ + let T := discComplement (fun k : {k // k ≠ i} => Δ k.val) + have hT : T = C ∪ Δ i := discComplement_except_eq_union Δ hΔ hdisj i + have hCT : C ⊆ T := by rw [hT]; exact subset_union_left + have hDT : Δ i ⊆ T := by rw [hT]; exact subset_union_right + let j : C → T := Set.inclusion hCT + have hdisc := isClosedDisc_subtype_preimage hDT (hΔ i) + have hbdImage : (Subtype.val : T → S) ⁻¹' discBd (Δ i) = + j '' ((Subtype.val : C → S) ⁻¹' discBd (Δ i)) := by + ext x + constructor + · intro hx + refine ⟨⟨x.val, disc_boundary_subset_discComplement hS Δ hΔ hdisj i hx⟩, hx, ?_⟩ + rfl + · rintro ⟨y, hy, rfl⟩ + exact hy + refine ⟨j, ?_, fun _ => rfl⟩ + constructor + · change (Subtype.val ⁻¹' discBd (Δ i)) ∈ cuffs C + rw [discComplement_cuffs_eq hS Δ hΔ hdisj] + exact mem_range_self i + · exact discComplement_isSurface hS _ (fun k => hΔ k.val) + (fun a b hab => hdisj (fun he => hab (Subtype.ext he))) + · exact IsEmbedding.inclusion hCT + · exact hdisc.1 + · exact hdisc.2.trans hbdImage + · ext x + constructor + · intro _ + trivial + · intro _ + have hx : x.val ∈ T := x.property + rw [hT] at hx + rcases hx with hxC | hxD + · exact Or.inl ⟨⟨x.val, hxC⟩, rfl⟩ + · exact Or.inr hxD + · ext x + constructor + · rintro ⟨⟨y, rfl⟩, hxD⟩ + apply mem_image_of_mem j + exact discComplement_inter_disc_subset_boundary hS Δ hΔ i ⟨y.property, hxD⟩ + · rintro ⟨y, hy, rfl⟩ + exact ⟨⟨y, rfl⟩, discBd_subset (Δ i) hy⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CapTopology.lean b/LeanPool/GraphMinor/GM12/Section3CapTopology.lean new file mode 100644 index 0000000000..c46bb58d7e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CapTopology.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.Disc +import LeanPool.GraphMinor.Surface.PasteDisc + +/-! +# Connectedness and the added interior of a cap + +The planar criterion used in the Section 8 argument of VII applies +inside a connected cap. Adding a disc to a connected surface preserves +connectedness because the disc meets its cuff. The added disc interior +is outside the original surface, so any subset of the original surface +has proper image in the cap. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +universe u + +/-- The proved disc-pasting theorem supplies a cap of every cuff. -/ +theorem exists_cappedCuff + {S : Type u} [TopologicalSpace S] (hS : IsSurface S) {C : Set S} (hC : IsCuff C) : + ∃ (T : Type u) (_ : TopologicalSpace T) (j : S → T) (D : Set T), + GM07.IsCappedCuff C T j D := by + obtain ⟨T, tT, j, D, hT, hj, hD, hcover, hinter, hbd, _⟩ := paste_disc S C hS hC + exact ⟨T, tT, j, D, hC, hT, hj.isEmbedding, hD, hbd, hcover, hinter⟩ + +/-- Capping a cuff of a connected surface leaves the surface connected. -/ +theorem cappedCuff_connectedSpace + {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] [ConnectedSpace S] + {C : Set S} {j : S → T} {D : Set T} (hcap : GM07.IsCappedCuff C T j D) : + ConnectedSpace T := by + have hC : C.Nonempty := by + obtain ⟨x, hx, heq⟩ := hcap.cuff + exact ⟨x, heq ▸ mem_connectedComponentIn hx⟩ + obtain ⟨x, hxC⟩ := hC + have hxD : j x ∈ D := by + apply discBd_subset D + rw [hcap.discBd_eq] + exact mem_image_of_mem j hxC + have hconn : IsConnected (range j ∪ D) := + (isConnected_range hcap.isEmbedding.continuous).union + ⟨j x, mem_range_self x, hxD⟩ hcap.isClosedDisc.isPathConnected.isConnected + rw [hcap.union_eq] at hconn + exact connectedSpace_iff_univ.mpr hconn + +/-- The original surface omits the interior of the disc added in a cap. -/ +theorem cappedCuff_range_ne_univ + {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] + {C : Set S} {j : S → T} {D : Set T} (hcap : GM07.IsCappedCuff C T j D) : + range j ≠ univ := by + intro heq + obtain ⟨x, hx⟩ := hcap.isClosedDisc.nonempty_discInt + have hxR : x ∈ range j := heq.symm ▸ mem_univ x + have hxB : x ∈ range j ∩ D := ⟨hxR, hx.1⟩ + rw [hcap.inter_eq, ← hcap.discBd_eq] at hxB + exact hx.2 hxB + +/-- Compactness makes the inclusion into a cap a closed embedding. -/ +theorem cappedCuff_isClosedEmbedding + {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] + (hS : IsSurface S) {C : Set S} {j : S → T} {D : Set T} + (hcap : GM07.IsCappedCuff C T j D) : IsClosedEmbedding j := by + let : CompactSpace S := hS.1 + let : T2Space T := hcap.isSurface.2.1 + exact hcap.isEmbedding.continuous.isClosedEmbedding hcap.isEmbedding.injective + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ChordDichotomy.lean b/LeanPool/GraphMinor/GM12/Section3ChordDichotomy.lean new file mode 100644 index 0000000000..cfffe06791 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ChordDichotomy.lean @@ -0,0 +1,100 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ThetaSchismatic +public import LeanPool.GraphMinor.GM12.Section3CircleSchismatic +import LeanPool.GraphMinor.GM12.Section3PuncturedCuffs +import LeanPool.GraphMinor.GM11.RadialChord + +/-! +# A chord either gives a schism or stays planar in the same cap + +In the extraction used by XII (3.1), page 245, fix a circle surrounding +a prescribed cuff and add a chord whose interior misses the circle. +The union has three branches. If a pair of branches is not near-planar, +that pair is schismatic. If all pairs are near-planar but the whole +union is not, the union is schismatic. In the remaining case, its cap +must be the original circle's cuff, by uniqueness of that cuff. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- Adding one chord to a surrounding circle either supplies a +schismatic subset or gives a set planar after filling the same cuff. -/ +theorem schismatic_or_planarInCappedCuff_of_chord + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + {i : ι} {F L : Set (discComplement Δ)} {u v : discComplement Δ} + (hF : IsOArc F) (hL : IsLineWithEnds L u v) (huv : u ≠ v) + (hLF : L ∩ F = {u, v}) + (hsF : GM07.SurroundsCuff F (Subtype.val ⁻¹' discBd (Δ i))) : + (∃ Y, Y ⊆ F ∪ L ∧ GM07.IsSchismatic Y) ∨ + GM07.IsPlanarInCappedCuff (Subtype.val ⁻¹' discBd (Δ i)) (F ∪ L) := by + classical + by_cases hnear : GM07.IsNearPlanar (F ∪ L) + · right + rcases hnear with hp | ⟨C, hC, hpC⟩ + · exact (hsF.2.2 (isPlanar_mono subset_union_left hp)).elim + · have hC' := hC + rw [discComplement_cuffs_eq hS Δ hΔ hdisj] at hC' + obtain ⟨k, rfl⟩ := hC' + have hsFk : GM07.SurroundsCuff F (Subtype.val ⁻¹' discBd (Δ k)) := + ⟨hC, isPlanarInCappedCuff_mono subset_union_left hpC, hsF.2.2⟩ + have hik := surrounding_cuff_index_unique hS Δ hΔ hdisj hcase hF hsF hsFk + exact hik.symm ▸ hpC + · left + have huF : u ∈ F := (hLF.symm ▸ (show u ∈ ({u, v} : Set (discComplement Δ)) by simp)).2 + have hvF : v ∈ F := (hLF.symm ▸ (show v ∈ ({u, v} : Set (discComplement Δ)) by simp)).2 + obtain ⟨p, q, hpq, hp0, hp1, hpqF⟩ := hF.exists_arcs huF hvF huv + have hP : IsLineWithEnds (range p) u v := by + have h := isLine_range hpq.arc_left.1 hpq.arc_left.2 + rwa [hp0, hp1] at h + have hQ : IsLineWithEnds (range q) u v := by + have h := isLine_range hpq.arc_right.1 hpq.arc_right.2 + rwa [hpq.zero, hpq.one, hp0, hp1] at h + have hPQ : range p ∩ range q = {u, v} := by + simpa only [hp0, hp1] using hpq.inter + have hPF : range p ⊆ F := hpqF ▸ subset_union_left + have hQF : range q ⊆ F := hpqF ▸ subset_union_right + have hcap : ∀ B, IsLineWithEnds B u v → B ⊆ F → L ∩ B = {u, v} := by + intro B hB hBF + apply Subset.antisymm + · intro x hx + exact hLF ▸ (show x ∈ L ∩ F from ⟨hx.1, hBF hx.2⟩) + · rintro x (rfl | rfl) + · exact ⟨hL.left_mem, hB.left_mem⟩ + · exact ⟨hL.right_mem, hB.right_mem⟩ + have hLP := hcap (range p) hP hPF + have hLQ := hcap (range q) hQ hQF + have hsubP : L ∪ range p ⊆ F ∪ L := union_subset subset_union_right + (hPF.trans subset_union_left) + have hsubQ : L ∪ range q ⊆ F ∪ L := union_subset subset_union_right + (hQF.trans subset_union_left) + by_cases hnLP : GM07.IsNearPlanar (L ∪ range p) + · by_cases hnLQ : GM07.IsNearPlanar (L ∪ range q) + · have hun : L ∪ range p ∪ range q = F ∪ L := by + rw [union_assoc, hpqF, union_comm] + refine ⟨F ∪ L, subset_rfl, ?_⟩ + rw [← hun] + apply isSchismatic_x3_of_nearPlanar_pairs huv hL hP hQ hLP hLQ hPQ hnLP hnLQ + · exact hpqF.symm ▸ (Or.inr ⟨_, hsF.1, hsF.2.1⟩) + · exact hun.symm ▸ hnear + · exact ⟨_, hsubQ, isSchismatic_oArc + (isOArc_union_of_lines_inter_eq_ends hL hQ hLQ) hnLQ⟩ + · exact ⟨_, hsubP, isSchismatic_oArc + (isOArc_union_of_lines_inter_eq_ends hL hP hLP) hnLP⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CircleCoordinates.lean b/LeanPool/GraphMinor/GM12/Section3CircleCoordinates.lean new file mode 100644 index 0000000000..65414748f2 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CircleCoordinates.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Analysis.Complex.Norm +import Mathlib.Analysis.SpecialFunctions.Sqrt +import Mathlib.Analysis.Complex.Basic + +/-! +# Straight coordinates near a circle boundary + +For the local surface charts needed by XII (3.1), page 245, subtract +the height of the right semicircle from the real coordinate. This is +a homeomorphism of the plane. Near the point one, it sends the outside +of the unit disc to the right half-plane and the circle to its boundary +line. Rotation supplies the same coordinates at every circle point. +-/ + +public section + +namespace GraphMinor.GM12 + +/-- Subtract the right semicircle's real coordinate. Its inverse adds +that coordinate back, while leaving the imaginary coordinate unchanged. -/ +@[expose] noncomputable def circleBoundaryShear : ℂ ≃ₜ ℂ where + toFun z := z - (Real.sqrt (1 - z.im ^ 2) : ℂ) + invFun w := w + (Real.sqrt (1 - w.im ^ 2) : ℂ) + left_inv z := by simp + right_inv z := by simp + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop + +/-- Real coordinate in the circle boundary chart. -/ +theorem circleBoundaryShear_re (z : ℂ) : + (circleBoundaryShear z).re = z.re - Real.sqrt (1 - z.im ^ 2) := by rfl + +/-- The imaginary coordinate is unchanged by the circle boundary chart. -/ +theorem circleBoundaryShear_im (z : ℂ) : (circleBoundaryShear z).im = z.im := by + change (z - (Real.sqrt (1 - z.im ^ 2) : ℂ)).im = z.im + simp only [Complex.sub_im, Complex.ofReal_im, sub_zero] + +/-- On the right side of the plane, near the horizontal diameter, +the outside of the unit disc maps to the right half-plane. -/ +theorem circleBoundaryShear_outside_iff {z : ℂ} (hzre : 0 < z.re) (hzim : |z.im| < 1) : + 1 ≤ ‖z‖ ↔ 0 ≤ (circleBoundaryShear z).re := by + have himsq : z.im ^ 2 < 1 := by + have h := abs_lt.mp hzim + nlinarith [h.1, h.2] + have hspos : 0 < Real.sqrt (1 - z.im ^ 2) := Real.sqrt_pos.mpr (sub_pos.mpr himsq) + have hsq : Real.sqrt (1 - z.im ^ 2) ^ 2 = 1 - z.im ^ 2 := Real.sq_sqrt (by linarith) + have hnorm : ‖z‖ ^ 2 = z.re ^ 2 + z.im ^ 2 := by + rw [Complex.sq_norm, Complex.normSq_apply] + ring + rw [circleBoundaryShear_re] + constructor + · intro h + nlinarith [norm_nonneg z] + · intro h + nlinarith [norm_nonneg z] + +/-- The unit circle maps to the boundary line of the right half-plane +in these local coordinates. -/ +theorem circleBoundaryShear_circle_iff {z : ℂ} (hzre : 0 < z.re) (hzim : |z.im| < 1) : + ‖z‖ = 1 ↔ (circleBoundaryShear z).re = 0 := by + have himsq : z.im ^ 2 < 1 := by + have h := abs_lt.mp hzim + nlinarith [h.1, h.2] + have hspos : 0 < Real.sqrt (1 - z.im ^ 2) := Real.sqrt_pos.mpr (sub_pos.mpr himsq) + have hsq : Real.sqrt (1 - z.im ^ 2) ^ 2 = 1 - z.im ^ 2 := Real.sq_sqrt (by linarith) + have hnorm : ‖z‖ ^ 2 = z.re ^ 2 + z.im ^ 2 := by + rw [Complex.sq_norm, Complex.normSq_apply] + ring + rw [circleBoundaryShear_re] + constructor + · intro h + rw [h] at hnorm + nlinarith + · intro h + nlinarith [norm_nonneg z] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CircleCount.lean b/LeanPool/GraphMinor/GM12/Section3CircleCount.lean new file mode 100644 index 0000000000..f2732e3ea6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CircleCount.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3NearPlanarCircle +public import LeanPool.GraphMinor.GM12.Section3SubspaceDrawing + +/-! +# The circle case of the alpha bound + +Condition (i) of XII (3.1), page 245, forces every small normal circle +in Sigma-star to be near-planar. A normal circle which is not +near-planar must therefore meet more than N vertices. Inclusion keeps +normality and the vertex count unchanged. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The circle case of the schismatic vertex bound in the reduction +of XII (3.1), page 245, to VII (7.5). -/ +theorem normal_oArc_vertex_count_gt + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hUC : Γ.U ⊆ discComplement Δ) (N : ℕ) + (hsmall : ∀ F : Set S, Γ.IsNormal F → IsOArc F → F ⊆ discComplement Δ → + (Γ.V ∩ F).ncard ≤ N → + ∃ D : Set S, IsClosedDisc D ∧ discBd D = F ∧ + ∀ i j, Δ i ⊆ D → Δ j ⊆ D → i = j) + {F : Set (discComplement Δ)} + (hn : (drawingInSubspace Γ (discComplement Δ) hUC).IsNormal F) + (hF : IsOArc F) (hnot : ¬ GM07.IsNearPlanar F) : + N < ((drawingInSubspace Γ (discComplement Δ) hUC).V ∩ F).ncard := by + have hcount : ((drawingInSubspace Γ (discComplement Δ) hUC).V ∩ F).ncard = + (Γ.V ∩ (Subtype.val : discComplement Δ → S) '' F).ncard := by + rw [← drawingInSubspace_image_vertices_inter Γ (discComplement Δ) hUC F, + ncard_image_of_injective _ Subtype.val_injective] + have hFo : IsOArc ((Subtype.val : discComplement Δ → S) '' F) := by + obtain ⟨φ⟩ := hF + exact ⟨φ.trans (Topology.IsEmbedding.subtypeVal.homeomorphImage F)⟩ + by_contra hle + have hle' : ((drawingInSubspace Γ (discComplement Δ) hUC).V ∩ F).ncard ≤ N := + Nat.le_of_not_gt hle + rw [hcount] at hle' + obtain ⟨D, hD, hbd, hone⟩ := hsmall _ + (drawingInSubspace_isNormal_image Γ (discComplement Δ) hUC hn) hFo + (by rintro x ⟨y, _, rfl⟩; exact y.property) hle' + exact hnot (isNearPlanar_of_bounds_disc_including_at_most_one hS Δ hΔ hdisj hD hbd hone) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CircleExterior.lean b/LeanPool/GraphMinor/GM12/Section3CircleExterior.lean new file mode 100644 index 0000000000..2807842728 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CircleExterior.lean @@ -0,0 +1,93 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3HalfPlaneCharts +public import LeanPool.GraphMinor.GM12.Section3CircleCoordinates +import LeanPool.GraphMinor.Surface.Gluing + +/-! +# Surface charts on the outside of a circle + +For the boundary charts in XII (3.1), page 245, circle coordinates +identify a neighbourhood outside a deleted disc with the outside of +the unit circle. The semicircle coordinate change sends that set to +a half-plane. Rotation gives the same chart at every unit-circle point. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- The outside of the unit circle has a half-plane chart wherever +the point is on the right side and its imaginary coordinate is small. -/ +theorem isManifoldPoint_circleExterior_right + {z : {w : ℂ // 1 ≤ ‖w‖}} (hzre : 0 < z.val.re) (hzim : |z.val.im| < 1) : + IsManifoldPoint z := by + let Y : Set ℂ := {w | 1 ≤ ‖w‖} + let M : Set ℂ := {w | 0 < w.re ∧ |w.im| < 1} + let U : Set Y := (Subtype.val : Y → ℂ) ⁻¹' M + have hM : IsOpen M := (isOpen_lt continuous_const Complex.continuous_re).inter + (isOpen_lt Complex.continuous_im.abs continuous_const) + have hU : IsOpen U := hM.preimage continuous_subtype_val + have hzU : z ∈ U := ⟨hzre, hzim⟩ + let E : U ≃ₜ (M ∩ Y : Set ℂ) := { + toFun := fun w => ⟨w.val.val, ⟨w.property, w.val.property⟩⟩ + invFun := fun w => ⟨⟨w.val, w.property.2⟩, w.property.1⟩ + left_inv _ := rfl + right_inv _ := rfl + continuous_toFun := by + apply Continuous.subtype_mk + exact continuous_subtype_val.comp continuous_subtype_val + continuous_invFun := by + apply Continuous.subtype_mk + apply Continuous.subtype_mk + exact continuous_subtype_val } + have himage : circleBoundaryShear '' (M ∩ Y) = (circleBoundaryShear '' M) ∩ halfPlane := by + ext w + constructor + · rintro ⟨v, ⟨hvM, hvY⟩, rfl⟩ + exact ⟨⟨v, hvM, rfl⟩, (circleBoundaryShear_outside_iff hvM.1 hvM.2).mp hvY⟩ + · rintro ⟨⟨v, hvM, rfl⟩, hvhalf⟩ + exact ⟨v, ⟨hvM, (circleBoundaryShear_outside_iff hvM.1 hvM.2).mpr hvhalf⟩, rfl⟩ + let e := E.trans ((circleBoundaryShear.image (M ∩ Y)).trans (Homeomorph.setCongr himage)) + exact isManifoldPoint_of_complex_halfPlane_chart hU hzU + (circleBoundaryShear.isOpenMap _ hM) e + +/-- Every point of the unit circle has a surface chart on its exterior. +This is the local model for a cuff of Sigma-star in XII (3.1), page 245. -/ +theorem isManifoldPoint_circleExterior_boundary + {z : {w : ℂ // 1 ≤ ‖w‖}} (hz : ‖z.val‖ = 1) : IsManifoldPoint z := by + have hz0 : z.val ≠ 0 := by + intro heq + rw [heq, norm_zero] at hz + exact zero_ne_one hz + let ρ := z.val⁻¹ + have hρ0 : ρ ≠ 0 := inv_ne_zero hz0 + have hρ : ‖ρ‖ = 1 := by rw [norm_inv, hz, inv_one] + have hρinv : ‖ρ⁻¹‖ = 1 := by rw [norm_inv, hρ, inv_one] + let R : {w : ℂ // 1 ≤ ‖w‖} ≃ₜ {w : ℂ // 1 ≤ ‖w‖} := { + toFun := fun w => ⟨ρ * w.val, by simpa only [norm_mul, hρ, one_mul] using w.property⟩ + invFun := fun w => ⟨ρ⁻¹ * w.val, by simpa only [norm_mul, hρinv, one_mul] using w.property⟩ + left_inv w := Subtype.ext (by simp only [← mul_assoc, inv_mul_cancel₀ hρ0, one_mul]) + right_inv w := Subtype.ext (by simp only [← mul_assoc, mul_inv_cancel₀ hρ0, one_mul]) + continuous_toFun := by + apply Continuous.subtype_mk + exact continuous_const.mul continuous_subtype_val + continuous_invFun := by + apply Continuous.subtype_mk + exact continuous_const.mul continuous_subtype_val } + have hRz : (R z).val = 1 := inv_mul_cancel₀ hz0 + have hm : IsManifoldPoint (R z) := isManifoldPoint_circleExterior_right + (by rw [hRz]; norm_num) (by rw [hRz]; norm_num) + exact (isManifoldPoint_iff_of_isOpenEmbedding R.isOpenEmbedding).mp hm + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CircleInclusion.lean b/LeanPool/GraphMinor/GM12/Section3CircleInclusion.lean new file mode 100644 index 0000000000..47fa0dc179 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CircleInclusion.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.Collar +import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# A circle contains no proper circle + +For the circle case of the schismatic definition used by XII (3.1), +page 245, a circle has no proper subset which is a circle. A continuous +injection of the standard circle into itself is onto: if it omitted +a point, rotate that point to minus one and use the continuous argument +as an injective real coordinate. The proved no-embedding theorem for +the circle and the line excludes that coordinate. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- A continuous injective self-map of the circle is onto. Omitting +one point would give a continuous injective argument coordinate in the line. -/ +theorem circle_surjective_of_continuous_injective + {f : Circle → Circle} (hf : Continuous f) (hi : Function.Injective f) : Function.Surjective f + := by + classical + by_contra hn + obtain ⟨c, hc⟩ : ∃ c : Circle, ∀ z, f z ≠ c := by + simpa only [Function.Surjective, not_forall, not_exists] using hn + let ρ : Circle := -c⁻¹ + have hρc : ρ * c = -1 := by simp [ρ] + have hneg : ∀ z, ρ * f z ≠ -1 := by + intro z he + exact hc z (mul_left_cancel (he.trans hρc.symm)) + have hslit : ∀ z, ((ρ * f z : Circle) : ℂ) ∈ Complex.slitPlane := by + intro z + rw [Complex.mem_slitPlane_iff_arg] + refine ⟨?_, Circle.coe_ne_zero _⟩ + intro he + apply hneg z + apply Circle.injective_arg + simpa only [Circle.coe_neg, Circle.coe_one, Complex.arg_neg_one] using he + let k : Circle → ℝ := fun z => Complex.arg ((ρ * f z : Circle) : ℂ) + have hmul : Continuous (fun z => ((ρ * f z : Circle) : ℂ)) := + continuous_subtype_val.comp (continuous_const.mul hf) + have hargc : ContinuousOn Complex.arg Complex.slitPlane := + fun z hz => (Complex.continuousAt_arg hz).continuousWithinAt + have hk : Continuous k := continuousOn_univ.mp + (hargc.comp hmul.continuousOn (fun z _ => hslit z)) + have hki : Function.Injective k := by + intro z w he + exact hi (mul_left_cancel (Circle.injective_arg he)) + exact not_injective_circle_real hk hki + +/-- A circle contained in another circle is equal to it. -/ +theorem oArc_eq_of_subset + {S : Type*} [TopologicalSpace S] {Z F : Set S} + (hZ : IsOArc Z) (hF : IsOArc F) (hZF : Z ⊆ F) : Z = F := by + obtain ⟨φZ⟩ := hZ + obtain ⟨φF⟩ := hF + let k : Circle → Circle := fun z => φF.symm ⟨(φZ z).val, hZF (φZ z).property⟩ + have hk : Continuous k := φF.symm.continuous.comp + ((continuous_subtype_val.comp φZ.continuous).subtype_mk _) + have hki : Function.Injective k := by + intro z w he + have hv := congrArg φF he + change φF (φF.symm _) = φF (φF.symm _) at hv + simp only [Homeomorph.apply_symm_apply] at hv + have hvS : (φZ z).val = (φZ w).val := congrArg (Subtype.val : F → S) hv + exact φZ.injective (Subtype.ext hvS) + have hks := circle_surjective_of_continuous_injective hk hki + apply Subset.antisymm hZF + intro x hxF + obtain ⟨z, hz⟩ := hks (φF.symm ⟨x, hxF⟩) + have hv := congrArg φF hz + change φF (φF.symm _) = φF (φF.symm _) at hv + simp only [Homeomorph.apply_symm_apply] at hv + have hval : (φZ z).val = x := congrArg (Subtype.val : F → S) hv + exact hval ▸ (φZ z).property + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CircleLoops.lean b/LeanPool/GraphMinor/GM12/Section3CircleLoops.lean new file mode 100644 index 0000000000..fe41854f91 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CircleLoops.lean @@ -0,0 +1,123 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CurveMultiplicity +import LeanPool.GraphMinor.GM12.Section2CirclePeriod +import Mathlib.Tactic.FinCases + +/-! +# Short curves through two meeting circles + +For XII (3.1)(iii) in the proof of (3.2), page 246, parameterize +each circle once from their common point. Their two loop paths join +to a closed curve covering their union. Each path is injective before +its final endpoint, so its piece index is a two-valued visit label. +The multiplicity bound gives length at most twice the number of +drawing vertices in the union. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM07 + +/-- Parameterize a circle once from a prescribed point, with no +repetition before the final endpoint. -/ +theorem exists_circle_loop_based_at + {S : Type*} [TopologicalSpace S] {F : Set S} (hF : IsOArc F) {p : S} (hp : p ∈ F) : + ∃ γ : C(unitInterval, S), γ 0 = p ∧ γ 1 = p ∧ range γ = F ∧ + InjOn γ (Ico (0 : unitInterval) 1) := by + obtain ⟨H⟩ := hF + let a : Circle := H.symm ⟨p, hp⟩ + let J : Circle ≃ₜ F := (Homeomorph.mulLeft a).trans H + have hJ1 : (J 1).val = p := by + change (H (a * 1)).val = p + simp only [mul_one, a, H.apply_symm_apply] + let γ : C(unitInterval, S) := + ⟨fun t => (J (Circle.exp (2 * Real.pi * t.val))).val, by fun_prop⟩ + have hγ0 : γ 0 = p := by + change (J (Circle.exp (2 * Real.pi * (0 : ℝ)))).val = p + simpa only [mul_zero, Circle.exp_zero] using hJ1 + have hγ1 : γ 1 = p := by + change (J (Circle.exp (2 * Real.pi * (1 : ℝ)))).val = p + simpa only [mul_one, Circle.exp_two_pi] using hJ1 + have hrange : range γ = F := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (J _).property + · intro hx + obtain ⟨t, ht, htJ⟩ := (circle_parameter_bijOn 0).surjOn (mem_univ (J.symm ⟨x, hx⟩)) + let u : unitInterval := ⟨t, ht.1, by simpa only [zero_add] using ht.2.le⟩ + refine ⟨u, ?_⟩ + change (J (Circle.exp (2 * Real.pi * t))).val = x + change Circle.exp (2 * Real.pi * t) = J.symm ⟨x, hx⟩ at htJ + rw [htJ, J.apply_symm_apply] + have hinj : InjOn γ (Ico (0 : unitInterval) 1) := by + intro s hs t ht heq + have hcircle := J.injective (Subtype.ext heq) + have hs' : s.val < 1 := hs.2 + have ht' : t.val < 1 := ht.2 + have hreal := circle_parameter_injOn 0 ⟨s.property.1, by simpa only [zero_add] using hs'⟩ + ⟨t.property.1, by simpa only [zero_add] using ht'⟩ hcircle + exact Subtype.ext hreal + exact ⟨γ, hγ0, hγ1, hrange, hinj⟩ + +/-- Two normal circles with a common point lie in one normal closed +curve of length at most twice their union's drawing vertex count. +This is the short-curve construction for XII (3.1)(iii), page 246. -/ +theorem exists_short_curve_covering_two_meeting_circles + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} {A B : Set S} + (hA : IsOArc A) (hB : IsOArc B) (hn : Γ.IsNormal (A ∪ B)) + {p : S} (hpA : p ∈ A) (hpB : p ∈ B) : + ∃ φ : C(Circle, S), IsNormalCurve Γ φ ∧ range φ = A ∪ B ∧ + curveLength Γ φ ≤ 2 * (Γ.V ∩ (A ∪ B)).ncard := by + obtain ⟨α, hα0, hα1, hαrange, hαi⟩ := exists_circle_loop_based_at hA hpA + obtain ⟨β, hβ0, hβ1, hβrange, hβi⟩ := exists_circle_loop_based_at hB hpB + let γ : Fin 2 → C(unitInterval, S) := fun i => if i = 0 then α else β + have hmatch : ∀ i : Fin 2, γ i 1 = γ (finNext (by decide : 0 < 2) i) 0 := by + intro i + fin_cases i <;> simp [γ, finNext, hα0, hα1, hβ0, hβ1] + have hγX : ∀ i, range (γ i) ⊆ A ∪ B := by + intro i + fin_cases i + · change range α ⊆ A ∪ B + rw [hαrange] + exact subset_union_left + · change range β ⊆ A ∪ B + rw [hβrange] + exact subset_union_right + have hγi : ∀ i, InjOn (γ i) (Ico (0 : unitInterval) 1) := by + intro i + fin_cases i + · exact hαi + · exact hβi + have hsep : ∀ (i j : Fin 2) (s t : unitInterval), s.val < 1 → t.val < 1 → + γ i s = γ j t → (i : Fin 2) = j → i = j ∧ s = t := by + intro i j s t hs ht heq hij + subst j + exact ⟨rfl, hγi i ⟨s.property.1, hs⟩ ⟨t.property.1, ht⟩ heq⟩ + obtain ⟨hφ, hlen⟩ := concatLoop_length_le_of_piece_labels hn (by decide : 0 < 2) γ hmatch hγX + (fun i _ => i) hsep + have hrange : range (concatLoop (by decide : 0 < 2) γ hmatch) = A ∪ B := by + rw [range_concatLoop] + ext x + constructor + · intro hx + obtain ⟨i, hi⟩ := mem_iUnion.mp hx + exact hγX i hi + · rintro (hx | hx) + · exact mem_iUnion.mpr ⟨0, hαrange.symm ▸ hx⟩ + · exact mem_iUnion.mpr ⟨1, hβrange.symm ▸ hx⟩ + refine ⟨_, hφ, hrange, ?_⟩ + simpa only [inter_comm] using hlen + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CircleObstructions.lean b/LeanPool/GraphMinor/GM12/Section3CircleObstructions.lean new file mode 100644 index 0000000000..9afa3c71b7 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CircleObstructions.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3JoiningCircles +public import LeanPool.GraphMinor.GM12.Section3SurroundingUnique + +/-! +# Two-loop obstructions inside a solid set + +In the Section 8 reduction used in XII (3.1), page 245, disjoint +selected circles surrounding distinct cuffs give the first two-loop +shape. Connectedness and local arc-connectedness supply its joining +line. The two distinct cuffs make the resulting set not near-planar. +Circles meeting at one point give the second two-loop shape directly. +Everything stays in the original candidate, preserving its vertex bound. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- Disjoint surrounding subcircles of a connected solid set give an +actual first two-loop obstruction contained in that set. -/ +theorem exists_x1_obstruction_of_disjoint_surrounding_subcircles + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + {X F A : Set (discComplement Δ)} (hX : IsSolid X) (hconn : IsConnected X) + {i j : ι} (hij : i ≠ j) (hF : IsOArc F) (hA : IsOArc A) + (hFX : F ⊆ X) (hAX : A ⊆ X) (hFA : Disjoint F A) + (hsi : GM07.SurroundsCuff F (Subtype.val ⁻¹' discBd (Δ i))) + (hsj : GM07.SurroundsCuff A (Subtype.val ⁻¹' discBd (Δ j))) : + ∃ Y : Set (discComplement Δ), Y ⊆ X ∧ GM07.IsX1Arc Y ∧ ¬ GM07.IsNearPlanar Y := by + have harc := isArcConnected_of_isConnected_isLocallyArcConnected hconn hX.1 + obtain ⟨P, a, b, hP, hPX, ha, hb, _, hPF, hPA⟩ := + exists_joining_line_between_disjoint_circles harc hF hA hFX hAX hFA + let Y := F ∪ A ∪ P + have hYX : Y ⊆ X := union_subset (union_subset hFX hAX) hPX + have hshape : GM07.IsX1Arc Y := + ⟨F, A, P, a, b, hF, hA, hFA, hP, ha, hb, hPF, hPA, rfl⟩ + have hnot : ¬ GM07.IsNearPlanar Y := + not_isNearPlanar_of_distinct_surrounding_subcircles hS Δ hΔ hdisj hcase hij hF hA + (subset_union_left.trans subset_union_left) (subset_union_right.trans subset_union_left) hsi + hsj + exact ⟨Y, hYX, hshape, hnot⟩ + +/-- Selected circles meeting at one point and surrounding distinct +cuffs give a second two-loop obstruction inside their containing set. -/ +theorem exists_x2_obstruction_of_meeting_surrounding_subcircles + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + {X F A : Set (discComplement Δ)} {u : discComplement Δ} + {i j : ι} (hij : i ≠ j) (hF : IsOArc F) (hA : IsOArc A) + (hFX : F ⊆ X) (hAX : A ⊆ X) (hFA : F ∩ A = {u}) + (hsi : GM07.SurroundsCuff F (Subtype.val ⁻¹' discBd (Δ i))) + (hsj : GM07.SurroundsCuff A (Subtype.val ⁻¹' discBd (Δ j))) : + ∃ Y : Set (discComplement Δ), Y ⊆ X ∧ GM07.IsX2Arc Y ∧ ¬ GM07.IsNearPlanar Y := by + refine ⟨F ∪ A, union_subset hFX hAX, ⟨F, A, u, hF, hA, hFA, rfl⟩, ?_⟩ + exact not_isNearPlanar_of_distinct_surrounding_subcircles hS Δ hΔ hdisj hcase hij hF hA + subset_union_left subset_union_right hsi hsj + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CirclePairGraph.lean b/LeanPool/GraphMinor/GM12/Section3CirclePairGraph.lean new file mode 100644 index 0000000000..096df8ff8c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CirclePairGraph.lean @@ -0,0 +1,125 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.SurfaceGraph +public import LeanPool.GraphMinor.GM12.Section3MeetingDiscs +import LeanPool.GraphMinor.Surface.ArcErase +import LeanPool.GraphMinor.Surface.DiscMerge + +/-! +# A finite graph presentation of two disjoint circles + +The first two-loop shape in VII Section 8, used by XII (3.1), page 245, +is a finite graph. Start with its two attachment vertices. Adding each +disjoint circle meets the existing carrier once, so its remaining part +is path-connected. The proved curve-addition construction supplies the +finite graph while retaining both attachment vertices. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +private theorem finConn_oArc_diff_of_inter_singleton + {S : Type*} [TopologicalSpace S] {F Q : Set S} {a : S} + (hF : IsOArc F) (hinter : F ∩ Q = {a}) : FinConn (F \ Q) := by + have ha : a ∈ F ∩ Q := hinter.symm ▸ mem_singleton a + have heq : F \ Q = F \ {a} := by + ext x + constructor + · rintro ⟨hxF, hxQ⟩ + refine ⟨hxF, ?_⟩ + intro hxa + exact hxQ (hxa.symm ▸ ha.2) + · rintro ⟨hxF, hxa⟩ + refine ⟨hxF, fun hxQ => ?_⟩ + exact hxa (hinter ▸ (show x ∈ F ∩ Q from ⟨hxF, hxQ⟩)) + rw [heq] + exact finConn_of_isPreconnected (isPathConnected_oArc_diff hF ha.1).isConnected.isPreconnected + +/-- Two disjoint circles have a finite graph presentation containing +chosen attachment vertices in its vertex set. -/ +theorem exists_graph_of_disjoint_circle_pair + {S : Type*} [TopologicalSpace S] [T2Space S] {F A : Set S} {a b : S} + (hF : IsOArc F) (hA : IsOArc A) (hdis : Disjoint F A) (ha : a ∈ F) (hb : b ∈ A) : + ∃ V E, {a, b} ⊆ V ∧ IsGraph V E ∧ gr V E = F ∪ A := by + have h0 : IsGraph ({a, b} : Set S) ∅ := by + refine ⟨(finite_singleton b).insert a, finite_empty, ?_, ?_⟩ + · intro e he + exact False.elim he + · intro e he + exact False.elim he + have hgr0 : gr ({a, b} : Set S) ∅ = {a, b} := by simp [gr] + have hinterF : F ∩ gr ({a, b} : Set S) ∅ = {a} := by + rw [hgr0] + apply Subset.antisymm + · rintro x ⟨hxF, hxa | hxb⟩ + · exact hxa + · exact False.elim (Set.disjoint_left.mp hdis hxF (hxb.symm ▸ hb)) + · intro x hx + have hxa : x = a := hx + rw [hxa] + exact ⟨ha, Or.inl rfl⟩ + obtain ⟨V₁, E₁, hV₁, hG₁, hgr₁, _⟩ := + h0.add_curve hF (finConn_oArc_diff_of_inter_singleton hF hinterF) + have hinterA : A ∩ gr V₁ E₁ = {b} := by + rw [hgr₁, hgr0] + apply Subset.antisymm + · rintro x ⟨hxA, (hxa | hxb) | hxF⟩ + · exact False.elim (Set.disjoint_left.mp hdis (hxa.symm ▸ ha) hxA) + · exact hxb + · exact False.elim (Set.disjoint_left.mp hdis hxF hxA) + · intro x hx + have hxb : x = b := hx + rw [hxb] + exact ⟨hb, Or.inl (Or.inr rfl)⟩ + obtain ⟨V₂, E₂, hV₂, hG₂, hgr₂, _⟩ := + hG₁.add_curve hA (finConn_oArc_diff_of_inter_singleton hA hinterA) + refine ⟨V₂, E₂, hV₁.trans hV₂, hG₂, ?_⟩ + rw [hgr₂, hgr₁, hgr0] + apply Subset.antisymm + · rintro x (((hxa | hxb) | hxF) | hxA) + · exact Or.inl (hxa.symm ▸ ha) + · exact Or.inr (hxb.symm ▸ hb) + · exact Or.inl hxF + · exact Or.inr hxA + · rintro x (hxF | hxA) + · exact Or.inl (Or.inr hxF) + · exact Or.inr hxA + +/-- The first two-loop shape is a finite graph in which the joining +line is one edge and meets the vertex set only at its two ends. -/ +theorem exists_graph_of_disjoint_circles_with_joining_line + {S : Type*} [TopologicalSpace S] [T2Space S] {F A P : Set S} {a b : S} + (hF : IsOArc F) (hA : IsOArc A) (hdis : Disjoint F A) + (hP : IsLineWithEnds P a b) (ha : a ∈ F) (hb : b ∈ A) + (hPF : P ∩ F = {a}) (hPA : P ∩ A = {b}) : + ∃ V E, IsGraph V E ∧ gr V E = F ∪ A ∪ P ∧ P ∈ E ∧ P ∩ V = {a, b} := by + obtain ⟨V, E, hverts, hG, hgr⟩ := exists_graph_of_disjoint_circle_pair hF hA hdis ha hb + have hab : a ≠ b := fun he => Set.disjoint_left.mp hdis ha (he.symm ▸ hb) + have haV : a ∈ V := hverts (Or.inl rfl) + have hbV : b ∈ V := hverts (Or.inr rfl) + have hinter : P ∩ gr V E = {a, b} := by + rw [hgr, inter_union_distrib_left, hPF, hPA, singleton_union] + obtain ⟨hG', hgr'⟩ := hG.add_arc hab hP haV hbV hinter + refine ⟨V, insert P E, hG', ?_, Or.inl rfl, ?_⟩ + · rw [hgr', hgr] + · apply Subset.antisymm + · rintro x ⟨hxP, hxV⟩ + exact hinter ▸ (show x ∈ P ∩ gr V E from ⟨hxP, Or.inl hxV⟩) + · rintro x (hxa | hxb) + · rw [hxa] + exact ⟨hP.left_mem, haV⟩ + · rw [hxb] + exact ⟨hP.right_mem, hbV⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CircleSchismatic.lean b/LeanPool/GraphMinor/GM12/Section3CircleSchismatic.lean new file mode 100644 index 0000000000..511d183b26 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CircleSchismatic.lean @@ -0,0 +1,39 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.GM12.Section3CircleInclusion + +/-! +# The circle case of the schismatic definition + +For VII Section 8, used in XII (3.1), page 245, a circle which is not +near-planar is schismatic. It contains no proper subset which is a +circle, so the minimal-circle clause follows from the circle inclusion +theorem. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A circle which is not near-planar is schismatic, since every +circle contained in it is equal to it. -/ +theorem isSchismatic_oArc + {S : Type*} [TopologicalSpace S] {F : Set S} + (hF : IsOArc F) (hnot : ¬ GM07.IsNearPlanar F) : GM07.IsSchismatic F := by + refine ⟨Or.inl hF, hnot, ?_⟩ + intro Z hZ hZF + have heq : Z = F := oArc_eq_of_subset hZ hF hZF.1 + exact False.elim (hZF.2 heq.symm.le) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ClosedComponents.lean b/LeanPool/GraphMinor/GM12/Section3ClosedComponents.lean new file mode 100644 index 0000000000..350468f529 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ClosedComponents.lean @@ -0,0 +1,56 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM12.Section2Corners + +/-! +# Components of a finite disjoint closed family + +The punctured surface in XII (3.1), page 245, has the disc boundaries +as its cuffs. Each is connected and closed, and the finite family is +disjoint. A connected component of the union must stay in one member, +while that whole connected member belongs to the component. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- The connected components of the union of a finite disjoint family +of nonempty closed preconnected sets are exactly its members. -/ +theorem componentsIn_iUnion_disjoint_closed {S ι : Type*} [TopologicalSpace S] [Finite ι] + (Q : ι → Set S) (hclosed : ∀ i, IsClosed (Q i)) + (hconn : ∀ i, IsPreconnected (Q i)) (hne : ∀ i, (Q i).Nonempty) + (hdisj : Pairwise (fun i j => Disjoint (Q i) (Q j))) : + componentsIn (⋃ i, Q i) = range Q := by + have hcomponent : ∀ i, ∀ x ∈ Q i, connectedComponentIn (⋃ j, Q j) x = Q i := by + intro i x hx + have hxU : x ∈ ⋃ j, Q j := mem_iUnion.mpr ⟨i, hx⟩ + apply Subset.antisymm + · apply preconnected_subset_closed_piece isPreconnected_connectedComponentIn Q hclosed + (connectedComponentIn_subset _ _) _ ⟨x, mem_connectedComponentIn hxU, hx⟩ + intro j k hjk + apply Set.disjoint_left.mpr + intro y _ hy + exact Set.disjoint_left.mp (hdisj hjk) hy.1 hy.2 + · exact (hconn i).subset_connectedComponentIn hx (subset_iUnion Q i) + ext E + constructor + · rintro ⟨x, hx, rfl⟩ + obtain ⟨i, hxi⟩ := mem_iUnion.mp hx + exact ⟨i, (hcomponent i x hxi).symm⟩ + · rintro ⟨i, rfl⟩ + obtain ⟨x, hx⟩ := hne i + exact ⟨x, mem_iUnion.mpr ⟨i, hx⟩, hcomponent i x hx⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ClosedCoverPaths.lean b/LeanPool/GraphMinor/GM12/Section3ClosedCoverPaths.lean new file mode 100644 index 0000000000..0aed710b53 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ClosedCoverPaths.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Topology.Connected.PathConnected +import Mathlib.Topology.Separation.Regular + +/-! +# Joining representatives through a finite closed cover + +The normal-connection construction in the existence argument for the +minimum used by XII (3.1), page 245, uses closures of drawing regions. +A finite closed cover of a connected space has connected intersection +data: splitting its members into reachable and unreachable classes +would give two disjoint closed sets covering the space. If meeting +cover members have their representatives joined in a prescribed set, +all representatives are joined in that set. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- Paths between representatives of intersecting members of a finite +closed cover extend to paths between every pair of representatives. -/ +theorem joinedIn_of_finite_closed_cover + {S ι : Type*} [TopologicalSpace S] [ConnectedSpace S] [Finite ι] + {N : Set S} (C : ι → Set S) (z : ι → S) + (hC : ∀ i, IsClosed (C i)) (hne : ∀ i, (C i).Nonempty) + (hcover : (⋃ i, C i) = univ) (hz : ∀ i, z i ∈ N) + (hjoin : ∀ i j, (C i ∩ C j).Nonempty → JoinedIn N (z i) (z j)) : + ∀ i j, JoinedIn N (z i) (z j) := by + classical + intro i j + by_contra hn + let A := {k | JoinedIn N (z i) (z k)} + let X := ⋃ k ∈ A, C k + let Y := ⋃ k ∈ Aᶜ, C k + have hX : IsClosed X := (Set.toFinite A).isClosed_biUnion (fun k _ => hC k) + have hY : IsClosed Y := (Set.toFinite Aᶜ).isClosed_biUnion (fun k _ => hC k) + have hcov : (univ : Set S) ⊆ X ∪ Y := by + intro x _ + obtain ⟨k, hk⟩ := mem_iUnion.mp (hcover.symm ▸ mem_univ x) + by_cases hkA : k ∈ A + · exact Or.inl (mem_iUnion₂.mpr ⟨k, hkA, hk⟩) + · exact Or.inr (mem_iUnion₂.mpr ⟨k, hkA, hk⟩) + obtain ⟨x, hx⟩ := hne i + obtain ⟨y, hy⟩ := hne j + have hxX : x ∈ X := mem_iUnion₂.mpr ⟨i, JoinedIn.refl (hz i), hx⟩ + have hyY : y ∈ Y := mem_iUnion₂.mpr ⟨j, hn, hy⟩ + obtain ⟨w, _, hwX, hwY⟩ := isPreconnected_closed_iff.mp + (isPreconnected_univ : IsPreconnected (univ : Set S)) X Y hX hY hcov + ⟨x, mem_univ x, hxX⟩ ⟨y, mem_univ y, hyY⟩ + obtain ⟨k, hkA, hwk⟩ := mem_iUnion₂.mp hwX + obtain ⟨l, hlA, hwl⟩ := mem_iUnion₂.mp hwY + exact hlA (hkA.trans (hjoin k l ⟨w, hwk, hwl⟩)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CollarChart.lean b/LeanPool/GraphMinor/GM12/Section3CollarChart.lean new file mode 100644 index 0000000000..4aeab05b92 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CollarChart.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collar + +/-! +# Coordinates on the inner disc of a collar + +In XII (3.1), page 245, a collar of each deleted disc supplies coordinates +near its boundary. The collar maps the unit circle onto that boundary. +Restricting its inverse maps therefore gives a chart of the inner disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Surface + +/-- The boundary parametrization in a disc collar identifies the unit +sphere exactly with the boundary of the inner disc. -/ +theorem collar_image_unit_sphere {S : Type*} [TopologicalSpace S] + {D : Set S} (p : Circle ≃ₜ discBd D) {c : ℂ → S} + (hp : ∀ w : Circle, c w = (p w).val) : + c '' sphere 0 1 = discBd D := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + let w : Circle := ⟨z, by simpa [Submonoid.unitSphere] using + (mem_sphere_zero_iff_norm.mp hz)⟩ + exact hp w ▸ (p w).property + · intro hx + obtain ⟨w, hw⟩ := p.surjective ⟨x, hx⟩ + refine ⟨w, ?_, ?_⟩ + · exact mem_sphere_zero_iff_norm.mpr (Circle.norm_coe w) + · exact (hp w).trans (congrArg Subtype.val hw) + +/-- Restriction of the collar coordinates to its inner disc is a disc +chart. The left inverse on the larger disc ensures that its inverse +sends precisely the inner boundary to the unit sphere. -/ +theorem collar_inner_isChart {S : Type*} [TopologicalSpace S] + {D E : Set S} {c : ℂ → S} {c' : S → ℂ} + (hDE : D ⊆ E) + (hc : ContinuousOn c (closedBall 0 2)) (hc' : ContinuousOn c' E) + (hl : LeftInvOn c' c (closedBall 0 2)) + (hr : RightInvOn c' c E) (hD : c '' closedBall 0 1 = D) + (p : Circle ≃ₜ discBd D) (hp : ∀ w : Circle, c w = (p w).val) : + IsChart D c' c := by + have h12 : closedBall (0 : ℂ) 1 ⊆ closedBall 0 2 := + closedBall_subset_closedBall (by norm_num) + have hsmall : LeftInvOn c' c (closedBall 0 1) := hl.mono h12 + refine ⟨hc'.mono hDE, hc.mono h12, ?_, ?_, hr.mono hDE, hsmall, ?_⟩ + · rintro x hx + obtain ⟨z, hz, rfl⟩ := hD.symm ▸ hx + rw [hsmall hz] + exact hz + · intro z hz + rw [← hD] + exact mem_image_of_mem c hz + · rw [← collar_image_unit_sphere p hp, hsmall.mono sphere_subset_closedBall |>.image_image] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CollarComplement.lean b/LeanPool/GraphMinor/GM12/Section3CollarComplement.lean new file mode 100644 index 0000000000..485ff3920b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CollarComplement.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CollarChart +public import LeanPool.GraphMinor.GM12.Section3PuncturedBoundary +import LeanPool.GraphMinor.Surface.DiscsInSurface + +/-! +# The punctured surface in collar coordinates + +For XII (3.1), page 245, a collar of one deleted disc is chosen to miss +all the others. In this collar, the remaining surface consists exactly +of points outside the open unit disc. This follows from the exact +boundary parametrization, including points on the unit circle. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Surface + +/-- In a collar missing the other discs, membership in Sigma-star is +exactly the inequality defining the outside of the unit circle. -/ +theorem collar_mem_discComplement_iff {S ι : Type*} [TopologicalSpace S] + [T2Space S] [Finite ι] (hS : IsClosedSurface S) + (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (i : ι) {E : Set S} {c : ℂ → S} {c' : S → ℂ} + (hcE : MapsTo c (closedBall 0 2) E) + (hmiss : ∀ j, j ≠ i → Disjoint E (Δ j)) + (hl : LeftInvOn c' c (closedBall 0 2)) + (himage : c '' closedBall 0 1 = Δ i) + (p : Circle ≃ₜ discBd (Δ i)) (hp : ∀ w : Circle, c w = (p w).val) + {z : ℂ} (hz : z ∈ closedBall 0 2) : + c z ∈ discComplement Δ ↔ 1 ≤ ‖z‖ := by + have hsphere := collar_image_unit_sphere p hp + have h12 : closedBall (0 : ℂ) 1 ⊆ closedBall 0 2 := + closedBall_subset_closedBall (by norm_num) + constructor + · intro hx + by_contra hn + have hn' : ‖z‖ < 1 := lt_of_not_ge hn + have hz1 : z ∈ closedBall (0 : ℂ) 1 := mem_closedBall_zero_iff.mpr hn'.le + have hxD : c z ∈ Δ i := himage ▸ mem_image_of_mem c hz1 + have hxB := discComplement_inter_disc_subset_boundary hS Δ hΔ i ⟨hx, hxD⟩ + obtain ⟨w, hw, he⟩ := hsphere.symm ▸ hxB + have hwz : w = z := hl.injOn (h12 (sphere_subset_closedBall hw)) hz he + have hnorm : ‖z‖ = 1 := hwz ▸ mem_sphere_zero_iff_norm.mp hw + exact hn'.ne hnorm + · intro hn + by_cases heq : ‖z‖ = 1 + · apply disc_boundary_subset_discComplement hS Δ hΔ hdisj i + rw [← hsphere] + exact mem_image_of_mem c (mem_sphere_zero_iff_norm.mpr heq) + · apply subset_closure + intro hx + obtain ⟨j, hj⟩ := mem_iUnion.mp hx + by_cases hji : j = i + · subst j + obtain ⟨w, hw, he⟩ := himage.symm ▸ hj + have hwz : w = z := hl.injOn (h12 hw) hz he + have hz1 : ‖z‖ ≤ 1 := hwz ▸ mem_closedBall_zero_iff.mp hw + exact heq (le_antisymm hz1 hn) + · exact Set.disjoint_left.mp (hmiss j hji) (hcE hz) hj + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CollarManifold.lean b/LeanPool/GraphMinor/GM12/Section3CollarManifold.lean new file mode 100644 index 0000000000..4ce46057a0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CollarManifold.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CollarComplement +public import LeanPool.GraphMinor.GM12.Section3CircleExterior +public import LeanPool.GraphMinor.GM12.Section3RestrictedCharts +import LeanPool.GraphMinor.Surface.DiscsInSurface + +/-! +# Surface charts at a deleted disc boundary + +In XII (3.1), page 245, the collar of a deleted disc identifies the +remaining surface with the circle exterior. The collar is open near +the inner circle by invariance of domain. Restricting this open map +transfers the half-plane chart to the remaining surface. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Topology Surface + +/-- A collar avoiding all other deleted discs supplies a surface chart +at each point of its inner boundary. -/ +theorem isManifoldPoint_discComplement_of_collar + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (i : ι) {E : Set S} {c : ℂ → S} {c' : S → ℂ} + (hc : ContinuousOn c (closedBall 0 2)) (hc' : ContinuousOn c' E) + (hcE : MapsTo c (closedBall 0 2) E) + (hmiss : ∀ j, j ≠ i → Disjoint E (Δ j)) + (hl : LeftInvOn c' c (closedBall 0 2)) + (himage : c '' closedBall 0 1 = Δ i) + (p : Circle ≃ₜ discBd (Δ i)) (hp : ∀ w : Circle, c w = (p w).val) + (w : Circle) : + IsManifoldPoint (⟨c w, disc_boundary_subset_discComplement hS Δ hΔ hdisj i + (hp w ▸ (p w).property)⟩ : discComplement Δ) := by + let M : Set ℂ := ball 0 2 + have hMsub : M ⊆ closedBall (0 : ℂ) 2 := ball_subset_closedBall + have himsub : c '' M ⊆ E := image_subset_iff.mpr (hcE.mono hMsub Subset.rfl) + obtain ⟨f, hf⟩ := exists_homeomorph_image (hc.mono hMsub) (hc'.mono himsub) + (hl.mono hMsub) + have hopen : IsOpen (c '' M) := isOpen_image_of_manifold isOpen_ball + (hc.mono hMsub) (hl.injOn.mono hMsub) (fun _ _ => (hS.2.2 _).isManifoldPoint) + let e : M → S := fun z => c z.val + have heq : e = Subtype.val ∘ f := by + funext z + exact (hf z).symm + have he : IsOpenEmbedding e := by + rw [heq] + exact hopen.isOpenEmbedding_subtypeVal.comp f.isOpenEmbedding + have hwM : (w : ℂ) ∈ M := by + rw [mem_ball_zero_iff, Circle.norm_coe] + norm_num + have hmem : ∀ z : M, e z ∈ discComplement Δ ↔ 1 ≤ ‖z.val‖ := fun z => + collar_mem_discComplement_iff hS Δ hΔ hdisj i hcE hmiss hl himage p hp (hMsub z.property) + exact isManifoldPoint_of_open_coordinate_model (Y := {z : ℂ | 1 ≤ ‖z‖}) isOpen_ball he hmem + (z := ⟨w, hwM⟩) (by change 1 ≤ ‖(w : ℂ)‖; rw [Circle.norm_coe]) + (isManifoldPoint_circleExterior_boundary (Circle.norm_coe w)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CompleteChordCarrier.lean b/LeanPool/GraphMinor/GM12/Section3CompleteChordCarrier.lean new file mode 100644 index 0000000000..26ec99ecef --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CompleteChordCarrier.lean @@ -0,0 +1,101 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3RerouteCarrier +public import LeanPool.GraphMinor.GM12.Section3ParameterGaps +import LeanPool.GraphMinor.GM12.Section3SubpathIntervals + +/-! +# Retaining finitely many complete chords + +For the circle extraction used by XII (3.1), page 245, the local +reroutings retain finitely many outer pieces of an injective path. +Extend each such piece to the complete gap at its partition endpoint. +Both ends of the original path lie on the solid set, so every gap has +two contact endpoints. The homotopic path therefore lies in the solid +set together with finitely many complete chords, whose interiors miss +that set. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- An injective path with both ends on a solid set is homotopic to a +path in that set together with finitely many complete original chords. +Degenerate chords are allowed and consist of contact points. -/ +theorem exists_homotopic_path_in_finite_complete_chords + {S : Type*} [TopologicalSpace S] (hS : IsSurface S) {F : Set S} + (hF : IsSolid F) {a b : S} (p : Path a b) (hpi : Function.Injective p) + (ha : a ∈ F) (hb : b ∈ F) : + ∃ (n : ℕ) (l r : Fin n → unitInterval) (q : Path a b), p.Homotopic q ∧ + range q ⊆ F ∪ ⋃ i : Fin n, p '' Icc (l i) (r i) ∧ + ∀ i, l i ≤ r i ∧ p (l i) ∈ F ∧ p (r i) ∈ F ∧ + Disjoint (p '' Ioo (l i) (r i)) F := by + classical + obtain ⟨n, t, s, u, q, _, _, hmono, hpq, hcarrier, hpieces⟩ := + exists_global_homotopic_reroute_carrier hS hF p ha + let K := p ⁻¹' F + have hK : IsClosed K := hF.2.preimage p.continuous + have h0 : (0 : unitInterval) ∈ K := by change p 0 ∈ F; rwa [p.source] + have h1 : (1 : unitInterval) ∈ K := by change p 1 ∈ F; rwa [p.target] + have hex : ∀ i : Fin (n + 1), ∃ l r, + l ≤ t i ∧ t i ≤ r ∧ l ∈ K ∧ r ∈ K ∧ Disjoint (Ioo l r) K := by + intro i + obtain ⟨l, r, hl, hr, hlK, hrK, hgap, _⟩ := exists_parameter_gap_or_contact hK h0 h1 (t i) + exact ⟨l, r, hl, hr, hlK, hrK, hgap⟩ + choose l r hlt htr hlK hrK hgap using hex + refine ⟨n + 1, l, r, q, hpq, ?_, ?_⟩ + · intro x hx + have hx' : x ∈ F ∪ range q := Or.inr hx + rw [hcarrier] at hx' + rcases hx' with hxF | hxparts + · exact Or.inl hxF + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxparts + have hti : t i.castSucc ≤ t i.succ := hmono (Fin.castSucc_le_succ i) + rcases hxi with hxleft | hxright + · have hleq := range_left_outer_subpath p hti (s i) + rw [hleq] at hxleft + obtain ⟨z, hz, rfl⟩ := hxleft + have hcontact : ∀ w ∈ Icc (t i.castSucc) (Icc.convexComb (t i.castSucc) (t i.succ) (s i)), + w ∈ K → w = Icc.convexComb (t i.castSucc) (t i.succ) (s i) := by + intro w hw hwK + have hwleft : p w ∈ range ((p.subpath (t i.castSucc) (t i.succ)).subpath 0 (s i)) := + hleq.symm ▸ (show p w ∈ p '' Icc (t i.castSucc) + (Icc.convexComb (t i.castSucc) (t i.succ) (s i)) from ⟨w, hw, rfl⟩) + have he := mem_singleton_iff.mp ((hpieces i).2.1 ⟨hwleft, hwK⟩) + exact hpi he + rcases parameter_segment_subset_contacts_union_gap_left + (hlt i.castSucc) (htr i.castSucc) (hrK i.castSucc) hcontact hz with hzK | hzgap + · exact Or.inl hzK + · exact Or.inr (mem_iUnion.mpr ⟨i.castSucc, z, hzgap, rfl⟩) + · have hreq := range_right_outer_subpath p hti (u i) + rw [hreq] at hxright + obtain ⟨z, hz, rfl⟩ := hxright + have hcontact : ∀ w ∈ Icc (Icc.convexComb (t i.castSucc) (t i.succ) (u i)) (t i.succ), + w ∈ K → w = Icc.convexComb (t i.castSucc) (t i.succ) (u i) := by + intro w hw hwK + have hwright : p w ∈ range ((p.subpath (t i.castSucc) (t i.succ)).subpath (u i) 1) := + hreq.symm ▸ (show p w ∈ p '' Icc + (Icc.convexComb (t i.castSucc) (t i.succ) (u i)) (t i.succ) from ⟨w, hw, rfl⟩) + have he := mem_singleton_iff.mp ((hpieces i).2.2 ⟨hwright, hwK⟩) + exact hpi he + rcases parameter_segment_subset_contacts_union_gap_right + (hlt i.succ) (htr i.succ) (hlK i.succ) hcontact hz with hzK | hzgap + · exact Or.inl hzK + · exact Or.inr (mem_iUnion.mpr ⟨i.succ, z, hzgap, rfl⟩) + · intro i + refine ⟨(hlt i).trans (htr i), hlK i, hrK i, disjoint_left.mpr ?_⟩ + rintro x ⟨z, hz, rfl⟩ hzF + exact disjoint_left.mp (hgap i) hz hzF + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3Components.lean b/LeanPool/GraphMinor/GM12/Section3Components.lean new file mode 100644 index 0000000000..b7be3cfe41 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3Components.lean @@ -0,0 +1,128 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Connected subdrawings selected by their vertex classes + +The conclusion of XII (3.1), page 245, asks for connected subdrawings +with prescribed boundary vertices. The forest supplied by VII has the +same boundary-connection classes as the feasible forest. This file +constructs the connected subdrawing of a drawing containing a chosen +vertex. Its vertices are exactly the vertices reachable from that point. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The vertices reachable from a chosen vertex form a connected +subdrawing. This supplies the component subdrawings in the reduction +from VII's feasible forest to the conclusion of XII (3.1). -/ +theorem exists_connected_subdrawing_of_reachability {S : Type*} [TopologicalSpace S] + [T1Space S] (H : Drawing S) {z : S} (hz : z ∈ H.V) : + ∃ C : Drawing S, C.IsSubdrawing H ∧ IsConnectedDrawing C ∧ z ∈ C.V ∧ + C.V = {y | Nonempty (GraphWalk H.toGraph z y)} := by + let R : Set S := {y | Nonempty (GraphWalk H.toGraph z y)} + let E : Set (Set S) := {e | ∃ p q, p ∈ R ∧ q ∈ R ∧ H.toGraph.IsLink e p q} + let C := H.span R E + have hRV : R ⊆ H.V := by + rintro x ⟨W⟩ + exact W.mem_vertexSet_of_mem_support W.end_mem_support + have hEH : E ⊆ H.E := by + rintro e ⟨p, q, _, _, hl⟩ + exact hl.1 + have hCV : C.V = R := by + apply Subset.antisymm + · rintro x (⟨hx, _⟩ | hx) + · exact hx + · obtain ⟨e, ⟨he, _⟩, hxe, hxV⟩ := mem_iUnion₂.mp hx + obtain ⟨p, q, hp, hq, hl⟩ := he + have hm : x ∈ ({p, q} : Set S) := hl.2.2.2 ▸ ⟨hxe, hxV⟩ + rcases hm with h | h + · exact h ▸ hp + · exact h ▸ hq + · intro x hx + exact Or.inl ⟨hx, hRV hx⟩ + have hCE : C.E = E := (H.span_E R E).trans (inter_eq_left.mpr hEH) + have hsub : C.IsSubdrawing H := H.span_isSubdrawing R E + have reach_support : ∀ {x y : S}, x ∈ R → ∀ (W : GraphWalk H.toGraph x y), + ∀ v ∈ W.support, v ∈ R := by + rintro x y ⟨P⟩ W v hv + obtain ⟨Q, _, _⟩ := W.exists_append_of_mem hv + exact ⟨P.append Q⟩ + refine ⟨C, hsub, ?_, ?_, hCV⟩ + swap + · rw [hCV] + exact ⟨.nil hz⟩ + intro x hx y hy + have hxR : x ∈ R := hCV ▸ hx + have hyR : y ∈ R := hCV ▸ hy + let P := Classical.choice hxR + let Q := Classical.choice hyR + let W := P.reverse.append Q + have hV : ∀ v ∈ W.support, v ∈ C.V := fun v hv => hCV.symm ▸ reach_support hxR W v hv + have hE : ∀ e ∈ W.edges, e ∈ C.E := by + intro e he + have heH : e ∈ H.E := (walkDrawing_isSubdrawing H W).2 (by rw [walkDrawing_E]; exact he) + obtain ⟨p, q, hl⟩ := (H.toGraph.edge_mem_iff_exists_isLink e).mp heH + rw [hCE] + exact ⟨p, q, reach_support hxR W p (W.left_mem_support_of_mem_edges he hl), + reach_support hxR W q (W.left_mem_support_of_mem_edges he hl.symm), hl⟩ + obtain ⟨W', _, _⟩ := hsub.exists_walk_down W hV hE + exact ⟨W'⟩ + +/-- Boundary-connection classes in a subdrawing give the disjoint +connected subdrawings required by XII (3.1), page 245. Each prescribed +nonempty class selects one component of the feasible forest. -/ +theorem hasConnectingSubdrawings_of_connection_classes {S : Type*} [TopologicalSpace S] + [T1Space S] {Γ H : Drawing S} (hH : H.IsSubdrawing Γ) + {p : ℕ} {Z : Set S} {Zs : Fin p → Set S} (hZH : Z ⊆ H.V) + (hZs : ∀ j, Zs j ⊆ Z) (hne : ∀ j, (Zs j).Nonempty) + (hdis : ∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) + (hclasses : ∀ j, ∀ x ∈ Zs j, ∀ y ∈ Z, + Nonempty (GraphWalk H.toGraph x y) ↔ y ∈ Zs j) : + HasConnectingSubdrawings Γ Z Zs := by + classical + choose z hz using hne + have hex : ∀ j, ∃ C : Drawing S, C.IsSubdrawing H ∧ IsConnectedDrawing C ∧ + z j ∈ C.V ∧ C.V = {y | Nonempty (GraphWalk H.toGraph (z j) y)} := by + intro j + exact exists_connected_subdrawing_of_reachability H (hZH (hZs j (hz j))) + choose C hCH hCc hzC hCV using hex + refine ⟨C, fun j => (hCH j).trans hH, hCc, ?_, ?_⟩ + · intro i j hij + apply Set.disjoint_left.mpr + intro x hxi hxj + have hPi : Nonempty (GraphWalk H.toGraph (z i) x) := by rw [hCV i] at hxi; exact hxi + have hPj : Nonempty (GraphWalk H.toGraph (z j) x) := by rw [hCV j] at hxj; exact hxj + obtain ⟨Pi⟩ := hPi + obtain ⟨Pj⟩ := hPj + have hzji : z j ∈ Zs i := (hclasses i (z i) (hz i) (z j) (hZs j (hz j))).mp + ⟨Pi.append Pj.reverse⟩ + exact Set.disjoint_left.mp (hdis i j hij) hzji (hz j) + · intro j + ext y + constructor + · rintro ⟨hyC, hyZ⟩ + have hyR : Nonempty (GraphWalk H.toGraph (z j) y) := by rw [hCV j] at hyC; exact hyC + exact (hclasses j (z j) (hz j) y hyZ).mp hyR + · intro hy + have hyZ := hZs j hy + refine ⟨?_, hyZ⟩ + have hyR := (hclasses j (z j) (hz j) y hyZ).mpr hy + rw [hCV j] + exact hyR + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ConvexPatch.lean b/LeanPool/GraphMinor/GM12/Section3ConvexPatch.lean new file mode 100644 index 0000000000..afb75958de --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ConvexPatch.lean @@ -0,0 +1,68 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import Mathlib.Analysis.Convex.Basic +import Mathlib.Analysis.Convex.PathConnected + +/-! +# Simply connected convex chart patches + +The local rerouting in the circle-intersection step used by XII (3.1), +page 245, must preserve the homotopy in the surface. A convex part of +a chart is simply connected after mapping back. Lift each loop with +the chart inverse and contract it by straight segments to one point. +This works for half-plane charts as well as interior charts. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- A convex patch mapped by a chart with continuous inverse is +simply connected. The stated inverse condition is needed only on the +chosen convex patch. -/ +theorem image_convex_isSimplyConnected + {S : Type*} [TopologicalSpace S] {j : S → ℂ} {g : ℂ → S} {A : Set ℂ} + (hg : ContinuousOn g A) (hj : ContinuousOn j (g '' A)) + (hinv : ∀ z ∈ A, j (g z) = z) (hconvex : Convex ℝ A) {q : ℂ} (hq : q ∈ A) : + IsSimplyConnectedSet (g '' A) := by + refine ⟨(hconvex.isPathConnected ⟨q, hq⟩).image' hg, ?_⟩ + intro φ hφ + have hθ : Continuous (fun z => j (φ z)) := + hj.comp_continuous φ.continuous (fun z => hφ (mem_range_self z)) + have hθA : ∀ z, j (φ z) ∈ A := by + intro z + obtain ⟨w, hw, he⟩ := hφ (mem_range_self z) + rw [← he, hinv w hw] + exact hw + let κ : Circle × unitInterval → ℂ := fun z => + (1 - z.2.val) • j (φ z.1) + z.2.val • q + have hκc : Continuous κ := by + exact ((continuous_const.sub (continuous_subtype_val.comp continuous_snd)).smul + (hθ.comp continuous_fst)).add + ((continuous_subtype_val.comp continuous_snd).smul continuous_const) + have hκA : ∀ z, κ z ∈ A := fun z => hconvex (hθA z.1) hq + (sub_nonneg.mpr z.2.property.2) z.2.property.1 (by ring) + let H : C(Circle × unitInterval, S) := + ⟨fun z => g (κ z), hg.comp_continuous hκc hκA⟩ + refine ⟨g q, mem_image_of_mem g hq, H, fun z => mem_image_of_mem g (hκA z), ?_, ?_⟩ + · intro z + change g ((1 - (0 : ℝ)) • j (φ z) + (0 : ℝ) • q) = φ z + simp only [sub_zero, one_smul, zero_smul, add_zero] + obtain ⟨w, hw, he⟩ := hφ (mem_range_self z) + rw [← he, hinv w hw] + · intro z + change g ((1 - (1 : ℝ)) • j (φ z) + (1 : ℝ) • q) = g q + simp + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CuffSurrounds.lean b/LeanPool/GraphMinor/GM12/Section3CuffSurrounds.lean new file mode 100644 index 0000000000..7a4d743fe1 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CuffSurrounds.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SurroundingUnique +import LeanPool.GraphMinor.GM12.Section3CapComparison +import LeanPool.GraphMinor.GM12.Section3CapTopology +import LeanPool.GraphMinor.GM12.Section3PuncturedSurface +import LeanPool.GraphMinor.GM12.Section3PuncturedCuffs +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.GM12.Section3DiscUniqueness + +/-! +# Each prescribed cuff surrounds itself + +For alpha-candidate existence in XII (3.1), page 245, a prescribed +cuff is planar after its deleted disc is filled. It is not planar +before filling: a disc bounded by that cuff would give a second disc +with the same boundary as the deleted disc. Disc uniqueness identifies +them, contradicting the missing interior. In the sphere case a point +in another deleted disc prevents the two discs from covering the sphere. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Under the surface condition of XII (3.1), each prescribed cuff +is a surrounding circle for that same cuff. -/ +theorem surroundsCuff_prescribed_boundary + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) (i : ι) : + GM07.SurroundsCuff ((Subtype.val : discComplement Δ → S) ⁻¹' discBd (Δ i)) + ((Subtype.val : discComplement Δ → S) ⁻¹' discBd (Δ i)) := by + classical + let F := (Subtype.val : discComplement Δ → S) ⁻¹' discBd (Δ i) + have hF : IsOArc F := isOArc_subtype_preimage + (disc_boundary_subset_discComplement hS Δ hΔ hdisj i) (hΔ i).isOArc_discBd + have hC : IsCuff F := by + change F ∈ cuffs (discComplement Δ) + rw [discComplement_cuffs_eq hS Δ hΔ hdisj] + exact ⟨i, rfl⟩ + have hsurface := discComplement_isSurface hS Δ hΔ hdisj + obtain ⟨T, tT, j, D, hcap⟩ := exists_cappedCuff hsurface hC + let := tT + have hpF : GM07.IsPlanarInCappedCuff F F := by + apply isPlanarInCappedCuff_of_one_cap hsurface hcap + exact ⟨D, hcap.isClosedDisc, hcap.discBd_eq ▸ Surface.discBd_subset D⟩ + refine ⟨hC, hpF, ?_⟩ + intro hp + obtain ⟨E, hE, hFE⟩ := hp + obtain ⟨B, hBprop, _⟩ := disc_oArc E F hE hFE hF + have hB := hBprop.2.1 + have hbB := hBprop.2.2.1 + obtain ⟨hBamb, hbd⟩ := isClosedDisc_subtype_image hB + let B' := (Subtype.val : discComplement Δ → S) '' B + have hB'C : B' ⊆ discComplement Δ := by rintro _ ⟨x, _, rfl⟩; exact x.property + have hbd' : discBd B' = discBd (Δ i) := by + rw [hbd, hbB] + change Subtype.val '' (Subtype.val ⁻¹' discBd (Δ i)) = discBd (Δ i) + rw [Subtype.image_preimage_coe, inter_eq_right.mpr (disc_boundary_subset_discComplement hS Δ hΔ + hdisj i)] + have heq : B' = Δ i := by + rcases hcase with hns | hthree + · exact Surface.eq_of_discBd_eq + ⟨hS.1, hS.2.1, fun x => (hS.2.2 x).isManifoldPoint⟩ hns hBamb (hΔ i) hbd' + · let := Fintype.ofFinite ι + have hthree' : 3 ≤ Fintype.card ι := by simpa only [Nat.card_eq_fintype_card] using hthree + obtain ⟨k, hki, _⟩ := ENat.exists_ne_ne_of_three_le + (by rw [ENat.card_eq_coe_fintype_card]; exact_mod_cast hthree') i i + obtain ⟨x, hx⟩ := (hΔ k).nonempty_discInt + have hnotcover : B' ∪ Δ i ≠ univ := by + intro hc + have hxin : x ∈ B' ∪ Δ i := hc.symm ▸ mem_univ x + rcases hxin with hxB | hxi + · exact hx.2 (discComplement_inter_disc_subset_boundary hS Δ hΔ k ⟨hB'C hxB, hx.1⟩) + · exact disjoint_left.mp (hdisj hki) hx.1 hxi + exact eq_of_discBd_eq_of_union_ne_univ (fun x => (hS.2.2 x).isManifoldPoint) + hBamb (hΔ i) hbd' hnotcover + obtain ⟨x, hx⟩ := (hΔ i).nonempty_discInt + have hxB : x ∈ B' := heq.symm ▸ hx.1 + exact hx.2 (discComplement_inter_disc_subset_boundary hS Δ hΔ i ⟨hB'C hxB, hx.1⟩) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3CurveMultiplicity.lean b/LeanPool/GraphMinor/GM12/Section3CurveMultiplicity.lean new file mode 100644 index 0000000000..ce96dfe5de --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3CurveMultiplicity.lean @@ -0,0 +1,94 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2CyclicEmbedding +public import LeanPool.GraphMinor.GM12.Defs +import Mathlib.Data.Set.Card + +/-! +# Counting hits of the short curves in XII (3.2) + +For conditions (3.1)(ii)--(iii), the proof of XII (3.2), page 246, +traverses two circles and any joining line so that no drawing vertex +is visited more than twice. Label the visits with two labels, making +the pair consisting of the image point and its label injective. Hits +then inject into the drawing vertices of the shape times the label +set. A cyclic chain can be counted using the unique half-open +parameter piece of each circle parameter. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM07 + +/-- A normal curve whose visits can be distinguished by `m` labels +has length at most `m` times the number of drawing vertices in its +prescribed image set. The labelled injection also proves finiteness +of its parameter hit set. -/ +theorem normal_curve_length_le_of_fibre_labels + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} {φ : C(Circle, S)} + {X : Set S} (hX : Γ.IsNormal X) (hφX : range φ ⊆ X) + {m : ℕ} (label : Circle → Fin m) + (hinj : Function.Injective (fun z => (φ z, label z))) : + IsNormalCurve Γ φ ∧ curveLength Γ φ ≤ m * (X ∩ Γ.V).ncard := by + let H : Set Circle := {z | φ z ∈ Γ.U} + let F : Circle → S × Fin m := fun z => (φ z, label z) + let Y : Set (S × Fin m) := (X ∩ Γ.V) ×ˢ univ + have hY : Y.Finite := (Γ.finite_V.subset inter_subset_right).prod (Set.toFinite univ) + have hmaps : MapsTo F H Y := by + intro z hz + have hx : φ z ∈ X := hφX (mem_range_self z) + exact ⟨⟨hx, hX ⟨hx, hz⟩⟩, mem_univ _⟩ + have hfinite : H.Finite := (hY.preimage hinj.injOn).subset hmaps + have hn : Γ.IsNormal (range φ) := fun x hx => hX ⟨hφX hx.1, hx.2⟩ + have hcard := Set.ncard_le_ncard_of_injOn F hmaps hinj.injOn hY + have hbound : H.ncard ≤ m * (X ∩ Γ.V).ncard := by + change H.ncard ≤ ((X ∩ Γ.V) ×ˢ (univ : Set (Fin m))).ncard at hcard + rw [Set.ncard_prod, Set.ncard_univ, Nat.card_fin] at hcard + simpa only [Nat.mul_comm] using hcard + exact ⟨⟨hfinite, hn⟩, hbound⟩ + +/-- Count a cyclic chain by labels on its half-open parameter pieces. +Equal image points with the same label must come from the same piece +and parameter. This is the two-visit counting mechanism in XII (3.2). -/ +theorem concatLoop_length_le_of_piece_labels + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} {X : Set S} + (hX : Γ.IsNormal X) {n : ℕ} (hn : 0 < n) + (γ : Fin n → C(unitInterval, S)) + (hmatch : ∀ i, γ i 1 = γ (finNext hn i) 0) + (hγX : ∀ i, range (γ i) ⊆ X) + {m : ℕ} (label : Fin n → unitInterval → Fin m) + (hsep : ∀ (i j : Fin n) (s t : unitInterval), s.val < 1 → t.val < 1 → + γ i s = γ j t → label i s = label j t → i = j ∧ s = t) : + IsNormalCurve Γ (concatLoop hn γ hmatch) ∧ + curveLength Γ (concatLoop hn γ hmatch) ≤ m * (X ∩ Γ.V).ncard := by + classical + let φ := concatLoop hn γ hmatch + choose i t ht hz hφ using (fun z => concatLoop_point_representation hn γ hmatch z) + let L : Circle → Fin m := fun z => label (i z) (t z) + have hinj : Function.Injective (fun z => (φ z, L z)) := by + intro z z' heq + have hpoint := congrArg Prod.fst heq + have hlabel := congrArg Prod.snd heq + change concatLoop hn γ hmatch z = concatLoop hn γ hmatch z' at hpoint + rw [hφ z, hφ z'] at hpoint + change label (i z) (t z) = label (i z') (t z') at hlabel + obtain ⟨hi, htime⟩ := hsep (i z) (i z') (t z) (t z') (ht z) (ht z') hpoint hlabel + apply (hz z).trans + rw [hi, htime] + exact (hz z').symm + have hφX : range φ ⊆ X := by + rw [range_concatLoop] + exact iUnion_subset hγX + exact normal_curve_length_le_of_fibre_labels hX hφX L hinj + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DiscBoundaryExtension.lean b/LeanPool/GraphMinor/GM12/Section3DiscBoundaryExtension.lean new file mode 100644 index 0000000000..9d48198d9a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DiscBoundaryExtension.lean @@ -0,0 +1,99 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.Schoenflies +import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! +# Extending a map of disc boundaries + +The capped surfaces used in XII (3.1), page 245, are independent of +which disc is pasted onto a cuff. The local ingredient is that a +homeomorphism of disc boundaries extends to the discs. Disc charts +reduce this to the extension theorem for the unit circle. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Topology Surface + +private def chartHomeomorph {S : Type*} [TopologicalSpace S] + {D : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart D h g) : + D ≃ₜ closedBall (0 : ℂ) 1 where + toFun x := ⟨h x.val, c.hm x.property⟩ + invFun z := ⟨g z.val, c.gm z.property⟩ + left_inv x := Subtype.ext (c.gh x.property) + right_inv z := Subtype.ext (c.hg z.property) + continuous_toFun := (continuousOn_iff_continuous_domRestrict.mp c.hc).subtype_mk _ + continuous_invFun := (continuousOn_iff_continuous_domRestrict.mp c.gc).subtype_mk _ + +private theorem chart_mem_sphere_iff {S : Type*} [TopologicalSpace S] + {D : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart D h g) (x : D) : + x.val ∈ discBd D ↔ h x.val ∈ sphere (0 : ℂ) 1 := by + constructor + · intro hx + rw [← c.bd] + exact mem_image_of_mem h hx + · intro hx + rw [← c.bd] at hx + obtain ⟨y, hy, he⟩ := hx + have hyx := c.gh.injOn (discBd_subset D hy) x.property he + exact hyx ▸ hy + +private def chartBoundaryHomeomorph {S : Type*} [TopologicalSpace S] + {D : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart D h g) : + discBd D ≃ₜ sphere (0 : ℂ) 1 where + toFun x := ⟨h x.val, (chart_mem_sphere_iff c ⟨x.val, discBd_subset D x.property⟩).mp x.property⟩ + invFun z := ⟨g z.val, by rw [← c.g_sphere]; exact mem_image_of_mem g z.property⟩ + left_inv x := Subtype.ext (c.gh (discBd_subset D x.property)) + right_inv z := Subtype.ext (c.hg (sphere_subset_closedBall z.property)) + continuous_toFun := (continuousOn_iff_continuous_domRestrict.mp (c.hc.mono + (discBd_subset D))).subtype_mk _ + continuous_invFun := (continuousOn_iff_continuous_domRestrict.mp (c.gc.mono + sphere_subset_closedBall)).subtype_mk _ + +/-- A homeomorphism of the boundaries of two closed discs extends to +a homeomorphism of the discs, agreeing at every boundary point. -/ +theorem exists_disc_homeomorph_extending_boundary + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + {D : Set S} {E : Set T} (hD : IsClosedDisc D) (hE : IsClosedDisc E) + (p : discBd D ≃ₜ discBd E) : + ∃ f : D ≃ₜ E, ∀ x : discBd D, + (f ⟨x.val, discBd_subset D x.property⟩).val = (p x).val := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + obtain ⟨h', g', c'⟩ := hE.exists_isChart + let b := (chartBoundaryHomeomorph c).symm.trans (p.trans (chartBoundaryHomeomorph c')) + obtain ⟨h₀, k₀, m, hm⟩ := exists_bdMatch b + obtain ⟨o⟩ := oArc_sphere + obtain ⟨H, hH⟩ := exists_homeomorph_closedInner ⟨o⟩ ⟨o⟩ m + let B : Set ℂ := closedBall 0 1 + let q : B ≃ₜ closedInner (sphere (0 : ℂ) 1) := Homeomorph.setCongr closedInner_sphere.symm + let f := (chartHomeomorph c).trans (q.trans (H.trans (q.symm.trans (chartHomeomorph c').symm))) + refine ⟨f, fun x => ?_⟩ + have hx : h x.val ∈ sphere (0 : ℂ) 1 := + (chart_mem_sphere_iff c ⟨x.val, discBd_subset D x.property⟩).mp x.property + have hcoord : (H (q (chartHomeomorph c ⟨x.val, discBd_subset D x.property⟩))).val = + h' (p x).val := by + rw [hH _ hx] + change h₀ (h x.val) = h' (p x).val + rw [hm ⟨h x.val, hx⟩] + have heq : (chartBoundaryHomeomorph c).symm ⟨h x.val, hx⟩ = x := by + apply Subtype.ext + exact c.gh (discBd_subset D x.property) + change h' (p ((chartBoundaryHomeomorph c).symm ⟨h x.val, hx⟩)).val = _ + rw [heq] + change g' (H (q (chartHomeomorph c ⟨x.val, discBd_subset D x.property⟩))).val = _ + rw [hcoord] + exact c'.gh (discBd_subset E (p x).property) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DiscChainBoundary.lean b/LeanPool/GraphMinor/GM12/Section3DiscChainBoundary.lean new file mode 100644 index 0000000000..2117f19287 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DiscChainBoundary.lean @@ -0,0 +1,55 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.Defs + +/-! +# Boundary vertices among the terms of a disc chain + +In the VI (3.6) chain reduction used by XII (3.2), pages 247--248, +only the first and last terms can be peripheral. Thus any vertex +term on the surface boundary is one of the two chain endpoints. +This ensures that the normal carrier built from internal region +curves meets the surface boundary only at those endpoints. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM06 + +/-- Boundary vertices occurring in a VI chain are its endpoints. -/ +theorem disc_chain_boundary_vertex_eq_endpoint + {S : Type*} [TopologicalSpace S] {G : Drawing S} {x y v : S} + {A : List (ChainTerm S)} (hA : IsXYChain G x y A) + (hv : Sum.inl v ∈ A) (hvb : v ∈ bd S) : v = x ∨ v = y := by + obtain ⟨i, hi, he⟩ := List.mem_iff_getElem.mp hv + have hper : (A[i]).IsPeripheral G := by + rw [he] + exact ⟨hA.valid (.inl v) hv, hvb⟩ + rcases (hA.peripheral_iff ⟨i, hi⟩).mp hper with hfirst | hlast + · change i = 0 at hfirst + have hhead : A.head hA.ne_nil = Sum.inl v := by + rw [List.head_eq_getElem_zero] + simpa only [hfirst] using he + have h := hA.head_matches + rw [hhead] at h + exact Or.inl h + · change i + 1 = A.length at hlast + have hlast' : A.getLast hA.ne_nil = Sum.inl v := by + rw [List.getLast_eq_getElem] + have hi' : i = A.length - 1 := by omega + simpa only [hi'] using he + have h := hA.last_matches + rw [hlast'] at h + exact Or.inr h + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DiscChainCarrier.lean b/LeanPool/GraphMinor/GM12/Section3DiscChainCarrier.lean new file mode 100644 index 0000000000..b22aef3be3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DiscChainCarrier.lean @@ -0,0 +1,226 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.Defs +import LeanPool.GraphMinor.GM06.RegionCurve +import LeanPool.GraphMinor.GM12.Section3InternalRegionCurve +import LeanPool.GraphMinor.GM12.Section3DiscChainBoundary +import LeanPool.GraphMinor.GM11.Regions +import Mathlib.Analysis.Convex.PathConnected + +/-! +# A path-connected normal carrier of a disc chain + +To apply VI (3.6) in the last case of XII (3.2), pages 247--248, +realize each vertex term by its point and each region term by a +path between its incident vertices or boundary endpoints. Adjacent +pieces meet, so their finite union is path connected. It meets the +drawing only at vertex terms of the chain. This supplies the carrier +from which to extract a normal separator line. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM06 + +universe u + +private theorem isPathConnected_biUnion_fin {S : Type u} [TopologicalSpace S] + (m : ℕ) (hm : 0 < m) (K : Fin m → Set S) + (hconn : ∀ i : Fin m, IsPathConnected (K i)) + (hinter : ∀ i : Fin m, ∀ h : i.1 + 1 < m, (K i ∩ K ⟨i.1 + 1, h⟩).Nonempty) : + IsPathConnected (⋃ i : Fin m, K i) := by + induction m with + | zero => omega + | succ n ih => + rcases Nat.eq_zero_or_pos n with rfl | hn + · have h_eq : (⋃ i : Fin 1, K i) = K ⟨0, zero_lt_one⟩ := by + ext z + simp only [mem_iUnion] + constructor + · rintro ⟨i, hi⟩ + have : i = ⟨0, zero_lt_one⟩ := Fin.ext (by omega) + rwa [← this] + · intro hz + exact ⟨⟨0, zero_lt_one⟩, hz⟩ + rw [h_eq] + exact hconn ⟨0, zero_lt_one⟩ + · let K' : Fin n → Set S := fun j => K ⟨j.1, Nat.lt_succ_of_lt j.2⟩ + have hconn' : ∀ j : Fin n, IsPathConnected (K' j) := fun j => hconn _ + have hinter' : ∀ j : Fin n, ∀ h : j.1 + 1 < n, (K' j ∩ K' ⟨j.1 + 1, h⟩).Nonempty := by + intro j h + exact hinter ⟨j.1, Nat.lt_succ_of_lt j.2⟩ (Nat.lt_succ_of_lt h) + have ih_res := ih hn K' hconn' hinter' + have hunion : (⋃ i : Fin (n + 1), K i) = (⋃ j : Fin n, K' j) ∪ K ⟨n, Nat.lt_succ_self n⟩ := by + ext z + simp only [mem_iUnion, mem_union, K'] + constructor + · rintro ⟨i, hi⟩ + rcases Nat.lt_or_eq_of_le (Nat.le_of_lt_succ i.2) with hlt | heq + · exact Or.inl ⟨⟨i.1, hlt⟩, hi⟩ + · right + have : i = ⟨n, Nat.lt_succ_self n⟩ := Fin.ext heq + rwa [← this] + · rintro (⟨j, hj⟩ | hn_mem) + · exact ⟨⟨j.1, Nat.lt_succ_of_lt j.2⟩, hj⟩ + · exact ⟨⟨n, Nat.lt_succ_self n⟩, hn_mem⟩ + rw [hunion] + refine ih_res.union (hconn ⟨n, Nat.lt_succ_self n⟩) ?_ + let j_last : Fin n := ⟨n - 1, Nat.sub_lt hn zero_lt_one⟩ + have h_step : j_last.1 + 1 < n + 1 := by + dsimp [j_last]; omega + have h_non := hinter ⟨j_last.1, Nat.lt_succ_of_lt j_last.2⟩ h_step + rcases h_non with ⟨z, hz1, hz2⟩ + refine ⟨z, mem_iUnion.mpr ⟨j_last, hz1⟩, ?_⟩ + have h_idx : (⟨j_last.1 + 1, h_step⟩ : Fin (n + 1)) = ⟨n, Nat.lt_succ_self n⟩ := by + ext; dsimp [j_last]; omega + rwa [← h_idx] + +/-- Realize a VI (3.6) chain by a compact path-connected normal +carrier, for its application in XII (3.2), pages 247--248. -/ +theorem exists_path_connected_carrier_of_disc_chain + {S : Type u} [TopologicalSpace S] {G : Drawing S} {x y : S} {A : List (ChainTerm S)} + (hDisc : IsClosedDiscSpace S) (hProper : G.IsProper) + (hChain : IsXYChain G x y A) : + ∃ F : Set S, IsCompact F ∧ IsPathConnected F ∧ x ∈ F ∧ y ∈ F ∧ + (F ∩ G.U ⊆ {v ∈ G.V | Sum.inl v ∈ A}) ∧ F ∩ bd S ⊆ {x, y} := by + let : PathConnectedSpace unitInterval := isPathConnected_iff_pathConnectedSpace.mp + ((convex_Icc (0 : ℝ) 1).isPathConnected ⟨0, by simp⟩) + have hm : 0 < A.length := List.length_pos_of_ne_nil hChain.ne_nil + let leftPt := ChainTerm.leftEndpoint A x + let rightPt := ChainTerm.rightEndpoint A y + have h_left_closure := hChain.leftEndpoint_mem_closure + have h_right_closure := hChain.rightEndpoint_mem_closure + have hleftBd : ∀ i, leftPt i ∈ bd S → leftPt i = x ∨ leftPt i = y := by + intro i hb + rcases hir : A[i.1]'i.2 with v | r + · simp only [leftPt, ChainTerm.leftEndpoint, hir] at hb ⊢ + exact disc_chain_boundary_vertex_eq_endpoint hChain (hir ▸ List.getElem_mem i.2) hb + · by_cases hi0 : i.val = 0 + · left + dsimp only [leftPt, ChainTerm.leftEndpoint] + rw [hir] + simp only [hi0, ↓reduceIte] + · rcases hprev : A[i.val - 1]'(Nat.lt_of_le_of_lt (Nat.sub_le _ _) i.2) with v | r' + · simp only [leftPt, ChainTerm.leftEndpoint, hir, hi0, hprev, ite_false] at hb ⊢ + exact disc_chain_boundary_vertex_eq_endpoint hChain + (hprev ▸ List.getElem_mem (Nat.lt_of_le_of_lt (Nat.sub_le _ _) i.2)) hb + · simp [leftPt, ChainTerm.leftEndpoint, hir, hi0, hprev] + have hrightBd : ∀ i, rightPt i ∈ bd S → rightPt i = x ∨ rightPt i = y := by + intro i hb + rcases hir : A[i.1]'i.2 with v | r + · simp only [rightPt, ChainTerm.rightEndpoint, hir] at hb ⊢ + exact disc_chain_boundary_vertex_eq_endpoint hChain (hir ▸ List.getElem_mem i.2) hb + · by_cases hi1 : i.val + 1 = A.length + · simp [rightPt, ChainTerm.rightEndpoint, hir, hi1] + · rcases hnext : A[i.val + 1]'(Nat.lt_of_le_of_ne (Nat.succ_le_of_lt i.2) hi1) with v | r' + · simp only [rightPt, ChainTerm.rightEndpoint, hir, hi1, hnext] at hb ⊢ + exact disc_chain_boundary_vertex_eq_endpoint hChain + (hnext ▸ List.getElem_mem (Nat.lt_of_le_of_ne (Nat.succ_le_of_lt i.2) hi1)) hb + · simp [rightPt, ChainTerm.rightEndpoint, hir, hi1, hnext] + have hK_exists : ∀ i : Fin A.length, + ∃ K : Set S, IsCompact K ∧ IsPathConnected K ∧ leftPt i ∈ K ∧ rightPt i ∈ K ∧ + (K ∩ G.U ⊆ {v ∈ G.V | Sum.inl v ∈ A}) ∧ K ∩ bd S ⊆ {x, y} := by + intro i + rcases hir : A[i.1]'i.2 with v | r + · refine ⟨{v}, isCompact_singleton, isPathConnected_singleton v, ?_, ?_, ?_, ?_⟩ + · simp [leftPt, ChainTerm.leftEndpoint, hir] + · simp [rightPt, ChainTerm.rightEndpoint, hir] + · intro z hz + have hzv : z = v := mem_singleton_iff.mp hz.1 + subst hzv + have hvV : z ∈ G.V := by + have hv := hChain.valid (A[i.1]'i.2) (List.getElem_mem i.2) + simpa [hir, ChainTerm.IsValid] using hv + refine ⟨hvV, ?_⟩ + have hmem : A[i.1]'i.2 ∈ A := List.getElem_mem i.2 + rwa [hir] at hmem + · intro z hz + have hzv : z = v := hz.1 + subst z + exact disc_chain_boundary_vertex_eq_endpoint hChain (hir ▸ List.getElem_mem i.2) hz.2 + · have hrR : r ∈ G.R := by + have hv := hChain.valid (A[i.1]'i.2) (List.getElem_mem i.2) + simpa [hir, ChainTerm.IsValid] using hv + obtain ⟨hl_cl, hl_U⟩ := h_left_closure i r hir + obtain ⟨hr_cl, hr_U⟩ := h_right_closure i r hir + obtain ⟨γ, hγ0, hγ1, hγ_int⟩ := + exists_internal_region_curve G hDisc hProper r hrR (leftPt i) hl_cl (rightPt i) hr_cl + refine ⟨range γ, isCompact_range γ.continuous, isPathConnected_range γ.continuous, + ⟨0, hγ0⟩, ⟨1, hγ1⟩, ?_, ?_⟩ + · rintro z ⟨⟨t, rfl⟩, htU⟩ + by_cases ht0 : (t : ℝ) = 0 + · have hteq : t = 0 := Subtype.ext ht0 + rw [hteq, hγ0] at htU ⊢ + exact hl_U htU + · by_cases ht1 : (t : ℝ) = 1 + · have hteq : t = 1 := Subtype.ext ht1 + rw [hteq, hγ1] at htU ⊢ + exact hr_U htU + · have h_ioo : (t : ℝ) ∈ Ioo (0 : ℝ) 1 := + ⟨lt_of_le_of_ne t.2.1 (Ne.symm ht0), lt_of_le_of_ne t.2.2 ht1⟩ + have h_in_r : γ t ∈ r := (hγ_int t h_ioo.1 h_ioo.2).1 + exfalso + exact not_mem_U_of_mem_region G hrR h_in_r htU + · rintro z ⟨⟨t, rfl⟩, htbd⟩ + by_cases ht0 : t = 0 + · rw [ht0, hγ0] at htbd ⊢ + exact hleftBd i htbd + by_cases ht1 : t = 1 + · rw [ht1, hγ1] at htbd ⊢ + exact hrightBd i htbd + have ht0' : 0 < t.val := lt_of_le_of_ne t.property.1 (fun h => ht0 (Subtype.ext h.symm)) + have ht1' : t.val < 1 := lt_of_le_of_ne t.property.2 (fun h => ht1 (Subtype.ext h)) + exact False.elim ((hγ_int t ht0' ht1').2 htbd) + choose K hK_comp hK_conn hK_left hK_right hK_sub hK_bd using hK_exists + refine ⟨⋃ i : Fin A.length, K i, isCompact_iUnion hK_comp, ?_, ?_, ?_, ?_, ?_⟩ + · refine isPathConnected_biUnion_fin A.length hm K hK_conn ?_ + intro i hi + refine ⟨rightPt i, hK_right i, ?_⟩ + change ChainTerm.rightEndpoint A y i ∈ K ⟨i.1 + 1, hi⟩ + rw [hChain.endpoints_eq i hi] + exact hK_left ⟨i.1 + 1, hi⟩ + · refine mem_iUnion.mpr ⟨⟨0, hm⟩, ?_⟩ + have hhead : A.head hChain.ne_nil = A[0]'hm := List.head_eq_getElem_zero _ + have hmatch := hChain.head_matches + rw [hhead] at hmatch + rcases hir0 : A[0]'hm with v | r + · rw [hir0] at hmatch + change v = x at hmatch + have hleft : leftPt ⟨0, hm⟩ = x := by simp [leftPt, ChainTerm.leftEndpoint, hir0, hmatch] + rw [← hleft]; exact hK_left ⟨0, hm⟩ + · have hleft : leftPt ⟨0, hm⟩ = x := by simp [leftPt, ChainTerm.leftEndpoint, hir0] + rw [← hleft]; exact hK_left ⟨0, hm⟩ + · let i_last : Fin A.length := ⟨A.length - 1, Nat.sub_lt hm zero_lt_one⟩ + refine mem_iUnion.mpr ⟨i_last, ?_⟩ + have hlast : A.getLast hChain.ne_nil = A[i_last.1]'i_last.2 := by + rw [List.getLast_eq_getElem] + have hmatch := hChain.last_matches + rw [hlast] at hmatch + rcases hir_last : A[i_last.1]'i_last.2 with v | r + · rw [hir_last] at hmatch + change v = y at hmatch + have hright : rightPt i_last = y := by + simp [rightPt, ChainTerm.rightEndpoint, hir_last, hmatch] + rw [← hright]; exact hK_right i_last + · have hi1 : i_last.1 + 1 = A.length := by dsimp [i_last]; omega + have hright : rightPt i_last = y := by simp [rightPt, ChainTerm.rightEndpoint, hir_last, hi1] + rw [← hright]; exact hK_right i_last + · rintro z ⟨hz_u, hzU⟩ + rcases mem_iUnion.mp hz_u with ⟨i, hzi⟩ + exact hK_sub i ⟨hzi, hzU⟩ + · rintro z ⟨hz, hzb⟩ + obtain ⟨i, hi⟩ := mem_iUnion.mp hz + exact hK_bd i ⟨hi, hzb⟩ + + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DiscChainChord.lean b/LeanPool/GraphMinor/GM12/Section3DiscChainChord.lean new file mode 100644 index 0000000000..3cf049c554 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DiscChainChord.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3DiscChainCarrier +import LeanPool.GraphMinor.Surface.ArcInPath +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.GM06.RegionLocal + +/-! +# A proper normal chord from a disc chain + +For the VI (3.6) application in XII (3.2), pages 247--248, +extract an arc from a path in the chain carrier. The carrier meets +the disc boundary only at the two endpoints, so the arc is proper. +Its drawing vertices are among the vertex terms of the chain. +Repeated terms only increase chain length, giving the required +vertex-count bound. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM06 + +universe u + +/-- A VI chain between distinct boundary points supplies the proper +normal line used in the one-disc case of XII (3.2), with no more +drawing vertices than the length of the chain. -/ +theorem exists_normal_chord_of_disc_chain + {S : Type*} [TopologicalSpace S] {G : Drawing S} {x y : S} + {A : List (ChainTerm S)} (hDisc : IsClosedDiscSpace S) (hProper : G.IsProper) + (hA : IsXYChain G x y A) (hxy : x ≠ y) (hxB : x ∈ bd S) (hyB : y ∈ bd S) : + ∃ L : Set S, IsLineWithEnds L x y ∧ G.IsNormal L ∧ L ∩ bd S = {x, y} ∧ + (G.V ∩ L).ncard ≤ chainLength A := by + let : T2Space S := t2Space_of_isClosedDiscSpace hDisc + obtain ⟨F, _, hF, hxF, hyF, hFU, hFB⟩ := + exists_path_connected_carrier_of_disc_chain hDisc hProper hA + obtain ⟨p, hp⟩ := hF.joinedIn x hxF y hyF + obtain ⟨g, hg, hgi, hg0, hg1, hgr⟩ := exists_arc_of_path p.continuous (by + rw [p.source, p.target] + exact hxy) + have hgF : range g ⊆ F := by + intro z hz + obtain ⟨t, rfl⟩ := hgr hz + exact hp t + have hg0' : g 0 = x := hg0.trans p.source + have hg1' : g 1 = y := hg1.trans p.target + have hL : IsLineWithEnds (range g) x y := by + simpa only [hg0', hg1'] using (IsArcMap.isLineWithEnds ⟨hg, hgi⟩) + have hn : G.IsNormal (range g) := fun z hz => (hFU ⟨hgF hz.1, hz.2⟩).1 + have hcap : range g ∩ bd S = {x, y} := by + apply Subset.antisymm + · exact fun z hz => hFB ⟨hgF hz.1, hz.2⟩ + · intro z hz + rcases hz with rfl | rfl + · exact ⟨⟨0, hg0'⟩, hxB⟩ + · exact ⟨⟨1, hg1'⟩, hyB⟩ + have hcount : (G.V ∩ range g).ncard ≤ chainLength A := by + apply (Set.ncard_le_ncard (t := {v : S | Sum.inl v ∈ A}) ?_ (finite_inl_mem A)).trans + (ncard_inl_mem_le_chainLength A) + intro z hz + exact (hFU ⟨hgF hz.2, G.V_subset_U hz.1⟩).2 + exact ⟨range g, hL, hn, hcap, hcount⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DiscChainRedundancy.lean b/LeanPool/GraphMinor/GM12/Section3DiscChainRedundancy.lean new file mode 100644 index 0000000000..749fa42389 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DiscChainRedundancy.lean @@ -0,0 +1,83 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3DiscChainChord +import LeanPool.GraphMinor.GM06.Section2Count +import LeanPool.GraphMinor.GM11.Regions + +/-! +# The VI chain condition from a proper-normal-chord bound + +In the one-disc case of XII (3.2), pages 247--248, a VI chain +between distinct boundary points supplies a proper normal chord. +Its drawing vertex count is at most the chain length. A bound on +the division count by every such chord therefore gives nonnegative +chain redundancy. When both endpoints agree, the division count is +zero or one. In the latter case the boundary endpoint itself must +be a vertex term of the chain, so its length is at least one. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM06 GM11 + +private theorem chainLength_pos_of_vertex_endpoint + {S : Type*} [TopologicalSpace S] {G : Drawing S} {x y : S} + {A : List (ChainTerm S)} (hA : IsXYChain G x y A) (hxV : x ∈ G.V) : + 0 < chainLength A := by + have hhead := hA.head_matches + have hmem : Sum.inl x ∈ A := by + rcases he : A.head hA.ne_nil with v | r + · rw [he] at hhead + change v = x at hhead + have h := List.head_mem hA.ne_nil + rw [he, hhead] at h + exact h + · rw [he] at hhead + have hr : r ∈ G.R := by + have hvalid := hA.valid (A.head hA.ne_nil) (List.head_mem hA.ne_nil) + rwa [he] at hvalid + exact False.elim (region_subset hr hhead (G.V_subset_U hxV)) + have hfiltered : Sum.inl x ∈ A.filter (fun t => decide t.IsVertex) := by + exact List.mem_filter.mpr ⟨hmem, by rfl⟩ + apply List.length_pos_of_ne_nil + intro he + rw [he] at hfiltered + exact List.not_mem_nil hfiltered + +/-- The chain-redundancy step of the VI (3.6) application in XII +(3.2), pages 247--248. Every required chord bound is used on the +proper normal chord extracted from the given chain. -/ +theorem chainRedundancy_nonneg_of_normal_chord_bound + {S : Type*} [TopologicalSpace S] {G : Drawing S} {Δ : Set (Set S)} + (hDisc : IsClosedDiscSpace S) (hProper : G.IsProper) + (hΔ : IsDivision Δ) (hUnion : divisionUnion Δ = G.V ∩ bd S) + (hchord : ∀ (x y : S), x ∈ bd S → y ∈ bd S → x ≠ y → + ∀ L : Set S, IsLineWithEnds L x y → G.IsNormal L → L ∩ bd S = {x, y} → + divisionCount (bd S) Δ x y ≤ (G.V ∩ L).ncard) + {x y : S} {A : List (ChainTerm S)} (hxB : x ∈ bd S) (hyB : y ∈ bd S) + (hA : IsXYChain G x y A) : 0 ≤ chainRedundancy G Δ x y A := by + have hbound : divisionCount (bd S) Δ x y ≤ chainLength A := by + by_cases hxy : x = y + · subst y + by_cases hxΔ : x ∈ divisionUnion Δ + · rw [divisionCount_self_eq_one_of_mem hΔ hxΔ] + exact chainLength_pos_of_vertex_endpoint hA ((hUnion ▸ hxΔ).1) + · rw [divisionCount_self_eq_zero_of_not_mem hxΔ] + exact Nat.zero_le _ + · obtain ⟨L, hL, hn, hcap, hlen⟩ := + exists_normal_chord_of_disc_chain hDisc hProper hA hxy hxB hyB + exact (hchord x y hxB hyB hxy L hL hn hcap).trans hlen + unfold chainRedundancy + exact sub_nonneg.mpr (by exact_mod_cast hbound) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DiscChordDivision.lean b/LeanPool/GraphMinor/GM12/Section3DiscChordDivision.lean new file mode 100644 index 0000000000..098db3bfab --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DiscChordDivision.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3DivisionArcCount +import LeanPool.GraphMinor.GM06.Section3Dual +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# The division-count form of the normal-chord inequality + +For VI (3.6) in the one-disc case of XII (3.2), pages 247--248, +split the boundary circle into its two arcs between the chord ends. +Every counted division part meets each arc, so the division count +is at most both arc vertex counts. The proved minimum-arc chord +inequality then bounds it by the chord vertex count. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM06 + +/-- The minimum-arc chord inequality gives the division-count chord +bound used in the VI (3.6) application in XII (3.2). -/ +theorem divisionCount_le_of_normal_chord_min_bound + {S : Type*} [TopologicalSpace S] (G : Drawing S) (hDisc : IsClosedDiscSpace S) + {Δ : Set (Set S)} (hΔ : IsDivision Δ) (hUnion : divisionUnion Δ = G.V ∩ bd S) + (hmin : ∀ (x y : S) (A B P : Set S), IsLineWithEnds A x y → IsLineWithEnds B x y → + IsLineWithEnds P x y → A ∩ B = {x, y} → A ∩ P = {x, y} → B ∩ P = {x, y} → + bd S = A ∪ B → P ∩ bd S = {x, y} → G.IsNormal P → + min (G.V ∩ A).ncard (G.V ∩ B).ncard ≤ (G.V ∩ P).ncard) + {x y : S} (hx : x ∈ bd S) (hy : y ∈ bd S) (hxy : x ≠ y) + (P : Set S) (hP : IsLineWithEnds P x y) (hcap : P ∩ bd S = {x, y}) (hn : G.IsNormal P) : + divisionCount (bd S) Δ x y ≤ (G.V ∩ P).ncard := by + let : T2Space S := GM06.t2Space_of_isClosedDiscSpace hDisc + obtain ⟨a, b, hab, ha0, ha1, hrange⟩ := hDisc.isOArc_bd.exists_arcs hx hy hxy + have hb0 : b 0 = x := hab.3.trans ha0 + have hb1 : b 1 = y := hab.4.trans ha1 + have hA : IsLineWithEnds (range a) x y := by + simpa only [ha0, ha1] using hab.1.isLineWithEnds + have hB : IsLineWithEnds (range b) x y := by + simpa only [hb0, hb1] using hab.2.isLineWithEnds + have hAB : range a ∩ range b = {x, y} := by simpa only [ha0, ha1] using hab.inter + have hAbd : range a ⊆ bd S := subset_union_left.trans hrange.subset + have hBbd : range b ⊆ bd S := subset_union_right.trans hrange.subset + have hAP : range a ∩ P = {x, y} := by + apply Subset.antisymm + · exact fun z hz => hcap.subset ⟨hz.2, hAbd hz.1⟩ + · intro z hz + rcases hz with rfl | rfl + · exact ⟨⟨0, ha0⟩, (hcap.symm.subset (Or.inl rfl)).1⟩ + · exact ⟨⟨1, ha1⟩, (hcap.symm.subset (Or.inr rfl)).1⟩ + have hBP : range b ∩ P = {x, y} := by + apply Subset.antisymm + · exact fun z hz => hcap.subset ⟨hz.2, hBbd hz.1⟩ + · intro z hz + rcases hz with rfl | rfl + · exact ⟨⟨0, hb0⟩, (hcap.symm.subset (Or.inl rfl)).1⟩ + · exact ⟨⟨1, hb1⟩, (hcap.symm.subset (Or.inr rfl)).1⟩ + have hC : IsOArc (range a ∪ range b) := hrange.symm ▸ hDisc.isOArc_bd + have hU : divisionUnion Δ ⊆ G.V := hUnion.subset.trans inter_subset_left + have hcountA := divisionCount_le_boundary_arc_count G.finite_V hΔ hU hC hA hB + have hcountB := divisionCount_le_boundary_arc_count G.finite_V hΔ hU + ((union_comm (range a) (range b)) ▸ hC) hB hA + rw [hrange] at hcountA + rw [union_comm (range b) (range a), hrange] at hcountB + exact (le_min hcountA hcountB).trans + (hmin x y (range a) (range b) P hA hB hP hAB hAP hBP hrange.symm hcap hn) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DiscCrossFree.lean b/LeanPool/GraphMinor/GM12/Section3DiscCrossFree.lean new file mode 100644 index 0000000000..6f917754aa --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DiscCrossFree.lean @@ -0,0 +1,73 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3FeasibilityDiscs +public import LeanPool.GraphMinor.GM06.Defs +import LeanPool.GraphMinor.GM06.Section3Dual +import LeanPool.GraphMinor.Surface.Disc +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs + +/-! +# Topological feasibility gives a cross-free disc partition + +For the application of VI (3.6) in XII (3.2), page 247, read the +topological feasibility discs in the complementary closed disc. +If two partition parts cross on its boundary, their feasibility +discs meet by the disc-crossing theorem. Their prescribed +disjointness excludes this. Thus the partition is cross-free. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM06 + +/-- Disjoint closed discs containing the partition parts exclude +crossing parts on the boundary of a closed disc space. -/ +theorem isCrossFree_of_disjoint_enclosing_discs + {S : Type*} [TopologicalSpace S] {p : ℕ} (hDisc : IsClosedDiscSpace S) + (Zs D : Fin p → Set S) (hD : ∀ j, IsClosedDisc (D j)) + (hdis : ∀ i j, i ≠ j → Disjoint (D i) (D j)) (hZ : ∀ j, Zs j ⊆ D j) : + GM06.IsCrossFree (bd S) (range Zs) := by + rintro ⟨δ, hδ, δ', hδ', hne, a, ha, c, hc, b, hb, d, hd, hcross⟩ + obtain ⟨i, rfl⟩ := hδ + obtain ⟨j, rfl⟩ := hδ' + have hij : i ≠ j := fun h => hne (congrArg Zs h) + have hmeet := GM06.discCrossing_of_isClosedDiscSpace hDisc + (hD i).isCompact (hD j).isCompact + (hD i).isPathConnected.isConnected (hD j).isPathConnected.isConnected + (hZ i ha) (hZ i hc) (hZ j hb) (hZ j hd) hcross + obtain ⟨x, hxi, hxj⟩ := hmeet + exact Set.disjoint_left.mp (hdis i j hij) hxi hxj + +/-- The topological feasibility condition of XII (3.2) gives the +cross-free hypothesis of VI (3.6) when the punctured surface is a +closed disc. -/ +theorem isCrossFree_of_topological_feasible_in_discComplement + {S : Type*} [TopologicalSpace S] [T2Space S] {t p : ℕ} + (hS : IsClosedSurface S) (Δ : Fin t → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdis : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) (Zs : Fin p → Set S) + (hZ : ∀ j, Zs j ⊆ ⋃ i, discBd (Δ i)) (hfeasible : IsTopologicallyFeasible Δ Zs) + (hDisc : GM06.IsClosedDiscSpace (discComplement Δ)) : + GM06.IsCrossFree (bd (discComplement Δ)) + (range (fun j => (Subtype.val : discComplement Δ → S) ⁻¹' Zs j)) := by + obtain ⟨D, hD, hDD, hcontact⟩ := hfeasible + have hDC : ∀ j, D j ⊆ discComplement Δ := fun j => + feasibility_disc_subset_discComplement hS Δ hΔ hdis (hcontact j) (hZ j) + apply isCrossFree_of_disjoint_enclosing_discs hDisc _ + (fun j => (Subtype.val : discComplement Δ → S) ⁻¹' D j) + (fun j => (isClosedDisc_subtype_preimage (hDC j) (hD j)).1) + · intro i j hij + exact (hDD i j hij).preimage Subtype.val + · intro j x hx + exact ((hcontact j).symm.subset hx).1 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DiscInteriorPush.lean b/LeanPool/GraphMinor/GM12/Section3DiscInteriorPush.lean new file mode 100644 index 0000000000..e081f26348 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DiscInteriorPush.lean @@ -0,0 +1,154 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import Mathlib.Topology.ContinuousMap.Basic +import Mathlib.Topology.MetricSpace.HausdorffDistance +import Mathlib.Analysis.Convex.PathConnected + +/-! +# Moving an entry curve into the interior of a disc + +For the VI (3.6) application in XII (3.2), pages 247--248, +region paths must avoid the surface boundary between their ends. +In unit-disc coordinates, move each point a small distance radially +inward. The distance to the complement of the open region controls +the move. Multiplying this distance by the time parameter fixes the +initial point, even when that point is outside the open region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface Metric + +private theorem exists_continuous_safe_radius + {O : Set EuclideanPlane} (hO : IsOpen O) : + ∃ ε : EuclideanPlane → ℝ, Continuous ε ∧ + (∀ z, 0 ≤ ε z ∧ ε z ≤ 1 / 2) ∧ + ∀ z ∈ O, 0 < ε z ∧ ∀ w, dist w z ≤ ε z → w ∈ O := by + by_cases hempty : Oᶜ = ∅ + · refine ⟨fun _ => 1 / 2, continuous_const, fun _ => ⟨by norm_num, le_rfl⟩, ?_⟩ + intro z _ + refine ⟨by norm_num, fun w _ => ?_⟩ + by_contra hw + exact Set.notMem_empty w (hempty ▸ hw) + · have hne : Oᶜ.Nonempty := Set.nonempty_iff_ne_empty.mpr hempty + let ε : EuclideanPlane → ℝ := fun z => min (1 / 2) (infDist z Oᶜ / 2) + have hc : Continuous ε := continuous_const.min ((continuous_infDist_pt Oᶜ).div_const 2) + refine ⟨ε, hc, fun z => ⟨le_min (by norm_num) (div_nonneg infDist_nonneg (by norm_num)), + min_le_left _ _⟩, ?_⟩ + intro z hz + have hd : 0 < infDist z Oᶜ := (infDist_pos_iff_notMem_closure hne).mp (by + rw [hO.isClosed_compl.closure_eq] + exact not_not.mpr hz) + have hepos : 0 < ε z := lt_min (by norm_num) (half_pos hd) + refine ⟨hepos, ?_⟩ + intro w hw + by_contra hwO + have hbound := infDist_le_dist_of_mem (x := z) (s := Oᶜ) (y := w) hwO + have hsmall : ε z < infDist z Oᶜ := (min_le_right _ _).trans_lt (half_lt_self hd) + rw [dist_comm z w] at hbound + exact (hw.trans_lt hsmall).not_ge hbound + +/-- An entry curve in a relatively open part of the closed unit disc +can be moved radially inward while fixing its initial point. -/ +theorem exists_interior_disc_entry + {O : Set EuclideanPlane} (hO : IsOpen O) (f : C(unitInterval, ClosedUnitDisc)) + (hfO : ∀ t : unitInterval, 0 < t.val → (f t).val ∈ O) : + ∃ g : C(unitInterval, ClosedUnitDisc), g 0 = f 0 ∧ + ∀ t : unitInterval, 0 < t.val → (g t).val ∈ O ∧ ‖(g t).val‖ < 1 := by + obtain ⟨ε, hεc, hε, hεO⟩ := exists_continuous_safe_radius hO + let ρ : unitInterval → ℝ := fun t => t.val * ε (f t).val + have hρ : ∀ t, 0 ≤ ρ t ∧ ρ t ≤ ε (f t).val ∧ ρ t ≤ 1 / 2 := by + intro t + have hle : ρ t ≤ ε (f t).val := mul_le_of_le_one_left (hε _).1 t.property.2 + exact ⟨mul_nonneg t.property.1 (hε _).1, hle, hle.trans (hε _).2⟩ + have hfN : ∀ t, ‖(f t).val‖ ≤ 1 := fun t => mem_closedBall_zero_iff.mp (f t).property + let a : unitInterval → EuclideanPlane := fun t => (1 - ρ t) • (f t).val + have haN : ∀ t, ‖a t‖ ≤ 1 - ρ t := by + intro t + have hcoef : 0 ≤ 1 - ρ t := by linarith [(hρ t).2.2] + simpa only [a, norm_smul, Real.norm_eq_abs, abs_of_nonneg hcoef, mul_one] using + mul_le_mul_of_nonneg_left (hfN t) hcoef + have haD : ∀ t, a t ∈ ClosedUnitDisc := by + intro t + apply mem_closedBall_zero_iff.mpr + exact (haN t).trans (sub_le_self _ (hρ t).1) + let g : C(unitInterval, ClosedUnitDisc) := ⟨fun t => ⟨a t, haD t⟩, by + apply Continuous.subtype_mk + dsimp only [a, ρ] + exact (continuous_const.sub (continuous_subtype_val.mul + (hεc.comp (continuous_subtype_val.comp f.continuous)))).smul + (continuous_subtype_val.comp f.continuous)⟩ + refine ⟨g, ?_, ?_⟩ + · apply Subtype.ext + change a 0 = (f 0).val + simp only [a, ρ, Icc.coe_zero, zero_mul, sub_zero, one_smul] + · intro t ht + have hpos : 0 < ρ t := mul_pos ht (hεO _ (hfO t ht)).1 + have hdist : dist (a t) (f t).val ≤ ε (f t).val := by + have hdiff : a t - (f t).val = -(ρ t) • (f t).val := by + dsimp only [a] + rw [sub_smul, one_smul, sub_sub_cancel_left, neg_smul] + rw [dist_eq_norm, hdiff, norm_smul, Real.norm_eq_abs, abs_neg, abs_of_nonneg (hρ t).1] + exact (mul_le_of_le_one_right (hρ t).1 (hfN t)).trans (hρ t).2.1 + exact ⟨(hεO _ (hfO t ht)).2 _ hdist, (haN t).trans_lt (sub_lt_self 1 hpos)⟩ + + +/-- Move the interior of a disc curve off the disc boundary, keeping +both endpoints fixed and staying in its prescribed open set. -/ +theorem exists_interior_disc_curve + {O : Set EuclideanPlane} (hO : IsOpen O) (f : C(unitInterval, ClosedUnitDisc)) + (hfO : ∀ t : unitInterval, 0 < t.val → t.val < 1 → (f t).val ∈ O) : + ∃ g : C(unitInterval, ClosedUnitDisc), g 0 = f 0 ∧ g 1 = f 1 ∧ + ∀ t : unitInterval, 0 < t.val → t.val < 1 → (g t).val ∈ O ∧ ‖(g t).val‖ < 1 := by + obtain ⟨ε, hεc, hε, hεO⟩ := exists_continuous_safe_radius hO + let ρ : unitInterval → ℝ := fun t => (t.val * (1 - t.val)) * ε (f t).val + have hρ : ∀ t, 0 ≤ ρ t ∧ ρ t ≤ ε (f t).val ∧ ρ t ≤ 1 / 2 := by + intro t + have hc0 : 0 ≤ t.val * (1 - t.val) := mul_nonneg t.property.1 (sub_nonneg.mpr t.property.2) + have hc1 : t.val * (1 - t.val) ≤ 1 := by nlinarith [t.property.1, t.property.2] + have hle : ρ t ≤ ε (f t).val := mul_le_of_le_one_left (hε _).1 hc1 + exact ⟨mul_nonneg hc0 (hε _).1, hle, hle.trans (hε _).2⟩ + have hfN : ∀ t, ‖(f t).val‖ ≤ 1 := fun t => mem_closedBall_zero_iff.mp (f t).property + let a : unitInterval → EuclideanPlane := fun t => (1 - ρ t) • (f t).val + have haN : ∀ t, ‖a t‖ ≤ 1 - ρ t := by + intro t + have hcoef : 0 ≤ 1 - ρ t := by linarith [(hρ t).2.2] + simpa only [a, norm_smul, Real.norm_eq_abs, abs_of_nonneg hcoef, mul_one] using + mul_le_mul_of_nonneg_left (hfN t) hcoef + have haD : ∀ t, a t ∈ ClosedUnitDisc := by + intro t + apply mem_closedBall_zero_iff.mpr + exact (haN t).trans (sub_le_self _ (hρ t).1) + let g : C(unitInterval, ClosedUnitDisc) := ⟨fun t => ⟨a t, haD t⟩, by + apply Continuous.subtype_mk + dsimp only [a, ρ] + fun_prop⟩ + refine ⟨g, ?_, ?_, ?_⟩ + · apply Subtype.ext + change a 0 = (f 0).val + simp only [a, ρ, Icc.coe_zero, zero_mul, sub_zero, one_smul] + · apply Subtype.ext + change a 1 = (f 1).val + simp only [a, ρ, Icc.coe_one, sub_self, mul_zero, zero_mul, sub_zero, one_smul] + · intro t ht ht1 + have hpos : 0 < ρ t := mul_pos (mul_pos ht (sub_pos.mpr ht1)) (hεO _ (hfO t ht ht1)).1 + have hdist : dist (a t) (f t).val ≤ ε (f t).val := by + have hdiff : a t - (f t).val = -(ρ t) • (f t).val := by + dsimp only [a] + rw [sub_smul, one_smul, sub_sub_cancel_left, neg_smul] + rw [dist_eq_norm, hdiff, norm_smul, Real.norm_eq_abs, abs_neg, abs_of_nonneg (hρ t).1] + exact (mul_le_of_le_one_right (hρ t).1 (hfN t)).trans (hρ t).2.1 + exact ⟨(hεO _ (hfO t ht ht1)).2 _ hdist, (haN t).trans_lt (sub_lt_self 1 hpos)⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DiscRegion.lean b/LeanPool/GraphMinor/GM12/Section3DiscRegion.lean new file mode 100644 index 0000000000..0465e26dc4 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DiscRegion.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.Regions +public import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# The region meeting a prescribed disc + +In XII (3.2), pages 246--247, the drawing meets each prescribed +disc only at boundary vertices. The disc interior is connected and +misses the drawing, so it lies in one region. The whole disc lies +in that region's closure. Any other region, being open and disjoint +from the first, misses the whole disc. This justifies the region +chosen for each prescription and the auxiliary-disc placement. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A closed disc meeting the drawing only in its boundary vertices +lies in the closure of one region, and no other region meets it. -/ +theorem exists_unique_region_meeting_disc + {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {D : Set S} (hD : IsClosedDisc D) + (havoid : Γ.U ∩ D = Γ.V ∩ discBd D) : + ∃ r ∈ Γ.R, discInt D ⊆ r ∧ D ⊆ closure r ∧ + ∀ s ∈ Γ.R, (s ∩ D).Nonempty → s = r := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hIU : Disjoint (discInt D) Γ.U := Set.disjoint_left.mpr fun x hx hxU => + hx.2 (havoid.subset ⟨hxU, hx.1⟩).2 + obtain ⟨x, hx⟩ := hD.nonempty_discInt + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem (Set.disjoint_left.mp hIU hx) + have hIr : discInt D ⊆ r := subset_region hr hD.isPreconnected_discInt hIU hx hxr + have hDr : D ⊆ closure r := hD.subset_closure_discInt.trans (closure_mono hIr) + refine ⟨r, hr, hIr, hDr, ?_⟩ + intro s hs hmeet + obtain ⟨y, hys, hyD⟩ := hmeet + obtain ⟨z, hzs, hzr⟩ := mem_closure_iff.mp (hDr hyD) s (region_isOpen hs) hys + exact region_eq_of_mem hs hr hzs hzr + +/-- Distinct regions avoid a disc whose interior lies in the first +region, as used in the auxiliary-disc step of XII (3.2), page 247. -/ +theorem region_disjoint_disc_of_ne + {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {D r s : Set S} (hD : IsClosedDisc D) + (havoid : Γ.U ∩ D = Γ.V ∩ discBd D) (hr : r ∈ Γ.R) (hs : s ∈ Γ.R) + (hrD : (r ∩ D).Nonempty) (hne : s ≠ r) : Disjoint s D := by + obtain ⟨r', _, _, _, huniq⟩ := exists_unique_region_meeting_disc hS hD havoid + have hrr' := huniq r hr hrD + exact Set.disjoint_left.mpr fun x hxs hxD => hne ((huniq s hs ⟨x, hxs, hxD⟩).trans hrr'.symm) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DiscStarForest.lean b/LeanPool/GraphMinor/GM12/Section3DiscStarForest.lean new file mode 100644 index 0000000000..f098e4331b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DiscStarForest.lean @@ -0,0 +1,105 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM12.Section3DiscStarLines +import LeanPool.GraphMinor.GM12.Section3StarDrawingForest +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# A connected forest inside a feasibility disc + +For XII (3.1), page 245, draw a star from an interior centre to the +finite prescribed boundary set of a feasibility disc. The line and +drawing constructions give a forest. Every leaf is joined to the +centre by one edge, proving connectedness. Only the prescribed leaves +lie on the disc boundary. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A finite boundary set of a closed disc can be connected by a +forest drawing inside it, meeting the disc boundary exactly in that +set. This is the local forest used for XII (3.1), page 245. -/ +theorem exists_connected_forest_in_disc + {S : Type*} [TopologicalSpace S] [T2Space S] + {D Z : Set S} (hD : IsClosedDisc D) (hZ : Z.Finite) (hZD : Z ⊆ discBd D) : + ∃ (H : Drawing S) (c : S), c ∈ discInt D ∧ H.U ⊆ D ∧ H.V = insert c Z ∧ + H.U ∩ discBd D = Z ∧ IsGraphForest H.toGraph ∧ IsConnectedDrawing H := by + obtain ⟨c, hc, L, hlines, hmeet⟩ := exists_star_lines_in_disc hD hZD + have hcZ : c ∉ Z := fun h => hc.2 (hZD h) + obtain ⟨H, hU, hV, hE, hforest⟩ := exists_forest_drawing_of_finite_star hZ c L + (fun a ha => (hlines a ha).1) hmeet hcZ + have hUD : H.U ⊆ D := by + rw [hU] + apply union_subset + · exact singleton_subset_iff.mpr hc.1 + · exact iUnion₂_subset fun a ha => (hlines a ha).2.1 + have hboundary : H.U ∩ discBd D = Z := by + apply Subset.antisymm + · rintro x ⟨hxH, hxB⟩ + rw [hU] at hxH + rcases hxH with hxC | hxL + · have hxc : x = c := hxC + exact False.elim (hc.2 (hxc ▸ hxB)) + · obtain ⟨a, ha⟩ := mem_iUnion.mp hxL + obtain ⟨haZ, hxa⟩ := mem_iUnion.mp ha + have hx : x ∈ L a ∩ discBd D := ⟨hxa, hxB⟩ + rw [(hlines a haZ).2.2] at hx + exact (show x = a from hx) ▸ haZ + · intro x hxZ + refine ⟨?_, hZD hxZ⟩ + rw [hU] + exact Or.inr (mem_iUnion.mpr ⟨x, mem_iUnion.mpr ⟨hxZ, (hlines x hxZ).1.right_mem⟩⟩) + have hlinks : ∀ a ∈ Z, H.toGraph.IsLink (L a \ {c, a}) c a := by + intro a ha + have hinter : L a ∩ insert c Z = {c, a} := by + apply Subset.antisymm + · rintro x ⟨hxL, hxV⟩ + rcases hxV with hxc | hxZ + · exact Or.inl hxc + · have hx : x ∈ L a ∩ discBd D := ⟨hxL, hZD hxZ⟩ + rw [(hlines a ha).2.2] at hx + exact Or.inr hx + · rintro x (hxc | hxa) + · subst x + exact ⟨(hlines a ha).1.left_mem, Or.inl rfl⟩ + · subst x + exact ⟨(hlines a ha).1.right_mem, Or.inr ha⟩ + refine ⟨?_, ?_, ?_, ?_⟩ + · rw [hE] + exact mem_image_of_mem (fun a => L a \ {c, a}) ha + · rw [hV] + exact Or.inl rfl + · rw [hV] + exact Or.inr ha + · rw [closure_sdiff_pair (hlines a ha).1, hV, hinter] + have hcentre : c ∈ H.V := hV.symm ▸ (show c ∈ insert c Z from Or.inl rfl) + have hwalk : ∀ x ∈ H.V, Nonempty (GraphWalk H.toGraph c x) := by + intro x hx + have hxV : x ∈ H.V := hx + rw [hV] at hx + rcases hx with hxc | hxZ + · rw [hxc] + exact ⟨.nil hcentre⟩ + · exact ⟨.cons (hlinks x hxZ) (.nil hxV)⟩ + refine ⟨H, c, hc, hUD, hV, hboundary, hforest, ?_⟩ + intro a ha b hb + obtain ⟨W₁⟩ := hwalk a ha + obtain ⟨W₂⟩ := hwalk b hb + exact ⟨W₁.reverse.append W₂⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DiscStarLines.lean b/LeanPool/GraphMinor/GM12/Section3DiscStarLines.lean new file mode 100644 index 0000000000..eba967ca60 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DiscStarLines.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3RadialLines +public import LeanPool.GraphMinor.Surface.DiscArcs +public import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Lines from a disc centre to its boundary + +For XII (3.1), page 245, disc coordinates carry the unit-disc radii +to a feasibility disc. Each resulting line joins the chosen centre +to its prescribed boundary point, stays in the disc, and has no other +boundary contact. Distinct lines meet only at the centre. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Surface + +/-- Disc charts give an internally disjoint star of lines to any set +of prescribed boundary points. Finiteness is needed only when making +the resulting drawing. -/ +theorem exists_star_lines_in_disc + {S : Type*} [TopologicalSpace S] + {D Z : Set S} (hD : IsClosedDisc D) (hZ : Z ⊆ discBd D) : + ∃ c ∈ discInt D, ∃ L : S → Set S, + (∀ a ∈ Z, IsLineWithEnds (L a) c a ∧ L a ⊆ D ∧ L a ∩ discBd D = {a}) ∧ + ∀ a ∈ Z, ∀ b ∈ Z, a ≠ b → L a ∩ L b = {c} := by + obtain ⟨h, g, chart⟩ := hD.exists_isChart + let L : S → Set S := fun a => g '' radialLine (h a) + have hnorm : ∀ a ∈ Z, ‖h a‖ = 1 := by + intro a ha + apply mem_sphere_zero_iff_norm.mp + rw [← chart.bd] + exact mem_image_of_mem h (hZ ha) + have hrad : ∀ a ∈ Z, radialLine (h a) ⊆ closedBall 0 1 := + fun a ha => radialLine_subset_unitDisc (hnorm a ha) + have hcentre : g 0 ∈ discInt D := by + rw [chart.discInt_eq] + exact ⟨0, by simp, rfl⟩ + refine ⟨g 0, hcentre, L, ?_, ?_⟩ + · intro a ha + have haD : a ∈ D := discBd_subset D (hZ ha) + have hga : g (h a) = a := chart.gh haD + have hcont : ContinuousOn h (g '' radialLine (h a)) := + chart.hc.mono (chart.g_subset (hrad a ha)) + obtain ⟨e, he⟩ := exists_homeomorph_image (chart.gc.mono (hrad a ha)) hcont + (chart.hg.mono (hrad a ha)) + obtain ⟨φ, hφ0, hφ1⟩ := isLineWithEnds_radialLine (hnorm a ha) + have hline : IsLineWithEnds (L a) (g 0) a := by + refine ⟨φ.trans e, ?_, ?_⟩ + · change (e (φ 0)).val = g 0 + rw [he, hφ0] + · change (e (φ 1)).val = a + rw [he, hφ1, hga] + refine ⟨hline, chart.g_subset (hrad a ha), ?_⟩ + change g '' radialLine (h a) ∩ discBd D = {a} + rw [← chart.g_sphere, ← chart.g_inter (hrad a ha) sphere_subset_closedBall, + radialLine_inter_unitCircle (hnorm a ha), image_singleton, hga] + · intro a ha b hb hab + have hne : h a ≠ h b := by + intro he + exact hab (chart.gh.injOn (discBd_subset D (hZ ha)) (discBd_subset D (hZ hb)) he) + change g '' radialLine (h a) ∩ g '' radialLine (h b) = {g 0} + rw [← chart.g_inter (hrad a ha) (hrad b hb), + radialLine_inter_radialLine (hnorm a ha) (hnorm b hb) hne, image_singleton] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DiscUniqueness.lean b/LeanPool/GraphMinor/GM12/Section3DiscUniqueness.lean new file mode 100644 index 0000000000..e811640688 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DiscUniqueness.lean @@ -0,0 +1,49 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscsInSurface + +/-! +# Disc uniqueness when the two discs do not cover the surface + +In XII (3.1), page 245, the sphere case is handled by a point outside +the enclosing discs. Two distinct discs with the same boundary would +form a sphere embedded in the original connected surface. Invariance +of domain makes that sphere open and closed, hence onto. The outside +point therefore ensures uniqueness just as nonsphericity does. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology OnePoint Surface + +/-- An injective continuous sphere map fills a connected surface. +Invariance of domain gives openness of its compact image. -/ +theorem range_sphere_map_eq_univ + {S : Type*} [TopologicalSpace S] [T2Space S] [PreconnectedSpace S] + (hman : ∀ x : S, IsManifoldPoint x) {T : OnePoint EuclideanPlane → S} + (hT : Continuous T) (hi : Function.Injective T) : range T = univ := by + exact Surface.isSphereMap_range_eq_univ hman hT hi + +/-- Two closed discs with the same boundary coincide if their union +does not fill the connected surface. -/ +theorem eq_of_discBd_eq_of_union_ne_univ + {S : Type*} [TopologicalSpace S] [T2Space S] [PreconnectedSpace S] + (hman : ∀ x : S, IsManifoldPoint x) {Δ₁ Δ₂ : Set S} + (h₁ : IsClosedDisc Δ₁) (h₂ : IsClosedDisc Δ₂) + (hb : discBd Δ₁ = discBd Δ₂) (hnotcover : Δ₁ ∪ Δ₂ ≠ univ) : Δ₁ = Δ₂ := by + rcases Surface.eq_or_inter_eq_discBd_of_discBd_eq hman h₁ h₂ hb with heq | hinter + · exact heq + · obtain ⟨T, hT, hi, hcov⟩ := exists_sphere_map h₁ h₂ hb hinter + exact (hnotcover (hcov.symm.trans (range_sphere_map_eq_univ hman hT hi))).elim + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DiscVI.lean b/LeanPool/GraphMinor/GM12/Section3DiscVI.lean new file mode 100644 index 0000000000..9b1a507970 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DiscVI.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3DiscChordDivision +public import LeanPool.GraphMinor.GM12.Section3VIConnections +import LeanPool.GraphMinor.GM12.Section3DiscChainRedundancy +import LeanPool.GraphMinor.GM12.Section3DualPointSet +import LeanPool.GraphMinor.GM06.DualExists +import LeanPool.GraphMinor.GM06.Section2Dual + +/-! +# Applying VI (3.6) after the normal-chord inequality + +The final case of XII (3.2), pages 247--248, uses VI (3.6). +The boundary parts form a division. Choose a dual point in every +boundary segment. The minimum-arc chord bound gives the division +count bound, and the chain-carrier lemmas give nonnegative chain +redundancy. VI (3.6) then supplies a realization. Its components +are the desired connected subdrawings. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM06 + +/-- The application of VI (3.6) in XII (3.2), pages 247--248, +after the cross-free and minimum-arc chord conditions are established. -/ +theorem connecting_subdrawings_of_disc_chord_bound + {S : Type*} [TopologicalSpace S] (G : Drawing S) (hDisc : IsClosedDiscSpace S) + (hProper : G.IsProper) {p : ℕ} (Zs : Fin p → Set S) + (hne : ∀ j, (Zs j).Nonempty) (hcover : (⋃ j, Zs j) = G.V ∩ bd S) + (hdis : ∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) + (hCF : GM06.IsCrossFree (bd S) (range Zs)) + (hmin : ∀ (x y : S) (A B P : Set S), IsLineWithEnds A x y → IsLineWithEnds B x y → + IsLineWithEnds P x y → A ∩ B = {x, y} → A ∩ P = {x, y} → B ∩ P = {x, y} → + bd S = A ∪ B → P ∩ bd S = {x, y} → G.IsNormal P → + min (G.V ∩ A).ncard (G.V ∩ B).ncard ≤ (G.V ∩ P).ncard) : + HasConnectingSubdrawings G (G.V ∩ bd S) Zs := by + let : T2Space S := GM06.t2Space_of_isClosedDiscSpace hDisc + have hΔ : IsDivision (range Zs) := by + refine ⟨finite_range Zs, ?_, ?_⟩ + · rintro δ ⟨j, rfl⟩ + exact hne j + · rintro δ ⟨i, rfl⟩ δ' ⟨j, rfl⟩ hij + exact hdis i j (fun he => hij (congrArg Zs he)) + have hUnion : divisionUnion (range Zs) = G.V ∩ bd S := by + rw [divisionUnion, Set.sUnion_range] + exact hcover + obtain ⟨U, hU⟩ := exists_dual_point_set (bd S) (divisionUnion (range Zs)) + have hUB : U ⊆ bd S := (GM06.isDualPointSet_subset_diff hU).trans sdiff_subset + have hVB : divisionUnion (range Zs) ⊆ bd S := hUnion.subset.trans inter_subset_right + have hchord : ∀ (x y : S), x ∈ bd S → y ∈ bd S → x ≠ y → + ∀ P : Set S, IsLineWithEnds P x y → G.IsNormal P → P ∩ bd S = {x, y} → + divisionCount (bd S) (range Zs) x y ≤ (G.V ∩ P).ncard := by + intro x y hx hy hxy P hP hn hcap + exact divisionCount_le_of_normal_chord_min_bound G hDisc hΔ hUnion hmin hx hy hxy P hP hcap hn + have hfeas : GM06.IsFeasible G.toGraph (range Zs) := by + apply (GM06.theorem_3_6_proof G (range Zs) U hDisc hProper hΔ hUnion hU).mpr + refine ⟨hCF, ?_⟩ + intro x hx y hy A hA + exact chainRedundancy_nonneg_of_normal_chord_bound hDisc hProper hΔ hUnion hchord + (hx.elim (fun h => hUB h) (fun h => hVB h)) (hy.elim (fun h => hUB h) (fun h => hVB h)) hA + have hconnect := hasConnectingSubdrawings_of_vi_feasible G Zs hne hdis hfeas + rwa [hcover] at hconnect + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DiscVIEmpty.lean b/LeanPool/GraphMinor/GM12/Section3DiscVIEmpty.lean new file mode 100644 index 0000000000..2d7976b973 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DiscVIEmpty.lean @@ -0,0 +1,73 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3DiscVI +public import LeanPool.GraphMinor.GM12.Section3EmptyClasses +import Mathlib.Data.Fintype.EquivFin +import LeanPool.GraphMinor.GM06.RegionLocal + +/-! +# Empty parts in the disc application of VI (3.6) + +The partition interface for XII (3.2), page 247, permits empty +parts. Apply the proved VI reduction to its nonempty parts. Their +union, disjointness, and cross-free property are preserved. Restore +the empty parts with empty subdrawings. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM06 + +/-- The VI (3.6) application in XII (3.2), allowing empty partition +parts in the connected-subdrawing interface. -/ +theorem connecting_subdrawings_of_disc_chord_bound_allowing_empty + {S : Type*} [TopologicalSpace S] (G : Drawing S) (hDisc : IsClosedDiscSpace S) + (hProper : G.IsProper) {p : ℕ} (Zs : Fin p → Set S) + (hcover : (⋃ j, Zs j) = G.V ∩ bd S) + (hdis : ∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) + (hCF : GM06.IsCrossFree (bd S) (range Zs)) + (hmin : ∀ (x y : S) (A B P : Set S), IsLineWithEnds A x y → IsLineWithEnds B x y → + IsLineWithEnds P x y → A ∩ B = {x, y} → A ∩ P = {x, y} → B ∩ P = {x, y} → + bd S = A ∪ B → P ∩ bd S = {x, y} → G.IsNormal P → + min (G.V ∩ A).ncard (G.V ∩ B).ncard ≤ (G.V ∩ P).ncard) : + HasConnectingSubdrawings G (G.V ∩ bd S) Zs := by + classical + let : T2Space S := GM06.t2Space_of_isClosedDiscSpace hDisc + let I := {j : Fin p // (Zs j).Nonempty} + let := Fintype.ofFinite I + let q := Fintype.card I + let e : I ≃ Fin q := Fintype.equivFin I + let f : Fin q → Fin p := fun j => (e.symm j).val + have hf : Function.Injective f := by + intro i j hij + exact e.symm.injective (Subtype.ext hij) + have hcover' : (⋃ j, Zs (f j)) = G.V ∩ bd S := by + rw [← hcover] + apply Subset.antisymm + · intro x hx + obtain ⟨j, hj⟩ := mem_iUnion.mp hx + exact mem_iUnion.mpr ⟨f j, hj⟩ + · intro x hx + obtain ⟨j, hj⟩ := mem_iUnion.mp hx + let k : I := ⟨j, x, hj⟩ + refine mem_iUnion.mpr ⟨e k, ?_⟩ + simpa only [f, e.symm_apply_apply] using hj + have hCF' : GM06.IsCrossFree (bd S) (range (fun j => Zs (f j))) := by + rintro ⟨δ, ⟨i, hi⟩, δ', ⟨j, hj⟩, hne, a, ha, c, hc, b, hb, d, hd, hcross⟩ + exact hCF ⟨δ, ⟨f i, hi⟩, δ', ⟨f j, hj⟩, hne, a, ha, c, hc, b, hb, d, hd, hcross⟩ + apply hasConnectingSubdrawings_of_nonempty_restriction e + exact connecting_subdrawings_of_disc_chord_bound G hDisc hProper (fun j => Zs (f j)) + (fun j => (e.symm j).property) hcover' + (fun i j hij => hdis (f i) (f j) (fun he => hij (hf he))) hCF' hmin + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DisjointEnclosingDiscs.lean b/LeanPool/GraphMinor/GM12/Section3DisjointEnclosingDiscs.lean new file mode 100644 index 0000000000..4458006f71 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DisjointEnclosingDiscs.lean @@ -0,0 +1,112 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SurroundingDisc +import LeanPool.GraphMinor.Surface.DiscsInSurface +import LeanPool.GraphMinor.GM12.Section3DiscUniqueness +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.DiscMerge + +/-! +# Disjoint enclosing discs away from the sphere + +For the first two-loop shape in XII (3.1), page 245, disjoint circles +surrounding distinct cuffs bound disjoint discs. On a surface other +than the sphere, disc uniqueness proves this: nested boundaries force +nested discs, which would enclose both prescribed deleted discs. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Two discs which do not cover the surface and have disjoint +boundaries are disjoint unless one includes the other. -/ +theorem disjoint_discs_of_disjoint_boundaries_of_not_nested_of_noncover + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) + {D E : Set S} (hD : IsClosedDisc D) (hE : IsClosedDisc E) + (hbd : Disjoint (discBd D) (discBd E)) + (hDE : ¬ D ⊆ E) (hED : ¬ E ⊆ D) (hcover : D ∪ E ≠ univ) : Disjoint D E := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hbE : Disjoint (discBd E) D := by + rcases hD.side hman hE.isOArc_discBd.isPreconnected hbd.symm with hin | hout + · obtain ⟨E', hE', _⟩ := disc_oArc D (discBd E) hD + (hin.trans (discInt_subset D)) hE.isOArc_discBd + have hcover' : E ∪ E' ≠ univ := by + intro he + apply hcover + apply eq_univ_of_univ_subset + rw [← he] + exact union_subset subset_union_right (hE'.1.trans subset_union_left) + have heq : E = E' := eq_of_discBd_eq_of_union_ne_univ hman hE hE'.2.1 + hE'.2.2.1.symm hcover' + exact False.elim (hED (heq ▸ hE'.1)) + · exact hout + rcases hE.side hman hD.isPathConnected.isConnected.isPreconnected hbE.symm with hin | hout + · exact False.elim (hDE (hin.trans (discInt_subset E))) + · exact hout + +/-- On a surface other than the sphere, two discs with disjoint +boundaries are disjoint unless one includes the other. -/ +theorem disjoint_discs_of_disjoint_boundaries_of_not_nested + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + {D E : Set S} (hD : IsClosedDisc D) (hE : IsClosedDisc E) + (hbd : Disjoint (discBd D) (discBd E)) + (hDE : ¬ D ⊆ E) (hED : ¬ E ⊆ D) : Disjoint D E := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hsurf : IsSurface S := ⟨hS.1, hS.2.1, hman⟩ + have hbE : Disjoint (discBd E) D := by + rcases hD.side hman hE.isOArc_discBd.isPreconnected hbd.symm with hin | hout + · obtain ⟨E', hE', _⟩ := disc_oArc D (discBd E) hD + (hin.trans (discInt_subset D)) hE.isOArc_discBd + have heq : E = E' := eq_of_discBd_eq hsurf hns hE hE'.2.1 hE'.2.2.1.symm + exact False.elim (hED (heq ▸ hE'.1)) + · exact hout + rcases hE.side hman hD.isPathConnected.isConnected.isPreconnected hbE.symm with hin | hout + · exact False.elim (hDE (hin.trans (discInt_subset E))) + · exact hout + +/-- Disjoint circles surrounding distinct prescribed cuffs bound +disjoint enclosing discs when the original surface is not a sphere. +These are the discs required by XII (3.1)(ii). -/ +theorem exists_disjoint_surrounding_discs + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {i j : ι} (hij : i ≠ j) {F₁ F₂ : Set (discComplement Δ)} + (hF₁ : IsOArc F₁) (hF₂ : IsOArc F₂) (hFF : Disjoint F₁ F₂) + (hs₁ : GM07.SurroundsCuff F₁ (Subtype.val ⁻¹' discBd (Δ i))) + (hs₂ : GM07.SurroundsCuff F₂ (Subtype.val ⁻¹' discBd (Δ j))) : + ∃ D E : Set S, IsClosedDisc D ∧ IsClosedDisc E ∧ + discBd D = (Subtype.val : discComplement Δ → S) '' F₁ ∧ + discBd E = (Subtype.val : discComplement Δ → S) '' F₂ ∧ + (∀ k, Δ k ⊆ D ↔ k = i) ∧ (∀ k, Δ k ⊆ E ↔ k = j) ∧ Disjoint D E := by + obtain ⟨D, hD, hbD, honeD⟩ := + surrounding_bounds_disc_including_exactly_one hS Δ hΔ hdisj i hF₁ hs₁ + obtain ⟨E, hE, hbE, honeE⟩ := + surrounding_bounds_disc_including_exactly_one hS Δ hΔ hdisj j hF₂ hs₂ + refine ⟨D, E, hD, hE, hbD, hbE, honeD, honeE, ?_⟩ + apply disjoint_discs_of_disjoint_boundaries_of_not_nested hS hns hD hE + · rw [hbD, hbE] + apply Set.disjoint_left.mpr + rintro x ⟨y, hy, rfl⟩ ⟨z, hz, he⟩ + have hzy := Subtype.val_injective he + exact Set.disjoint_left.mp hFF hy (hzy ▸ hz) + · intro hDE + exact hij ((honeE i).mp (((honeD i).mpr rfl).trans hDE)) + · intro hED + exact hij (((honeD j).mp (((honeE j).mpr rfl).trans hED)).symm) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DisjointFamilyWalks.lean b/LeanPool/GraphMinor/GM12/Section3DisjointFamilyWalks.lean new file mode 100644 index 0000000000..f5317ec56a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DisjointFamilyWalks.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Walks in disjoint unions of drawings + +For the feasibility forest in XII (3.1), page 245, every walk stays +in its starting local forest. An edge in another component would put +its first endpoint in two disjoint vertex sets. Thus acyclicity and +boundary connection classes pass from the local forests to their union. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A walk in a drawing covered by disjoint subdrawings stays in the +component containing its first vertex. -/ +theorem walk_stays_in_disjoint_family + {S ι : Type*} [TopologicalSpace S] (H : ι → Drawing S) (K : Drawing S) + (hsub : ∀ i, (H i).IsSubdrawing K) + (hdis : Pairwise (fun i j => Disjoint (H i).V (H j).V)) + (hE : K.E ⊆ ⋃ i, (H i).E) (i : ι) + {u v : S} (W : GraphWalk K.toGraph u v) (hu : u ∈ (H i).V) : + (∀ x ∈ W.support, x ∈ (H i).V) ∧ (∀ e ∈ W.edges, e ∈ (H i).E) := by + revert hu + induction W with + | nil huK => + intro hu + constructor + · intro x hx + exact (List.mem_singleton.mp hx) ▸ hu + · intro e he + exact False.elim (List.not_mem_nil he) + | @cons u v w e he rest ih => + intro hu + have hei : e ∈ (H i).E := by + obtain ⟨j, hej⟩ := mem_iUnion.mp (hE he.1) + by_cases hji : j = i + · exact hji ▸ hej + · have hjlink := ((hsub j).isLink_iff hej).mpr he + exact False.elim (Set.disjoint_left.mp (hdis (Ne.symm hji)) hu hjlink.2.1) + have hilink := ((hsub i).isLink_iff hei).mpr he + obtain ⟨hrestV, hrestE⟩ := ih hilink.2.2.1 + constructor + · intro x hx + rcases List.mem_cons.mp hx with hxu | hxrest + · exact hxu ▸ hu + · exact hrestV x hxrest + · intro f hf + rcases List.mem_cons.mp hf with hfe | hfrest + · exact hfe ▸ hei + · exact hrestE f hfrest + +/-- A drawing covered by a disjoint family of forest subdrawings is +itself a forest, because each closed walk stays in one member. -/ +theorem isGraphForest_of_disjoint_family_cover + {S ι : Type*} [TopologicalSpace S] (H : ι → Drawing S) (K : Drawing S) + (hsub : ∀ i, (H i).IsSubdrawing K) + (hdis : Pairwise (fun i j => Disjoint (H i).V (H j).V)) + (hV : K.V ⊆ ⋃ i, (H i).V) (hE : K.E ⊆ ⋃ i, (H i).E) + (hforest : ∀ i, IsGraphForest (H i).toGraph) : IsGraphForest K.toGraph := by + intro u W hW + have hu : u ∈ K.V := W.mem_vertexSet_of_mem_support W.start_mem_support + obtain ⟨i, hui⟩ := mem_iUnion.mp (hV hu) + obtain ⟨hWV, hWE⟩ := walk_stays_in_disjoint_family H K hsub hdis hE i W hui + obtain ⟨W', hs, he⟩ := (hsub i).exists_walk_down W hWV hWE + have hW' : W'.IsSimpleClosed := by + change W'.support.tail.Nodup ∧ W'.edges.Nodup + rw [hs, he] + exact hW + have hzero := hforest i u W' hW' + change W.edges.length = 0 + rw [← he] + exact hzero + +/-- A connected member of a disjoint family gives exactly one +boundary connection class in their union drawing. -/ +theorem walk_iff_mem_boundary_class_of_disjoint_family + {S ι : Type*} [TopologicalSpace S] (H : ι → Drawing S) (K : Drawing S) + (hsub : ∀ i, (H i).IsSubdrawing K) + (hdis : Pairwise (fun i j => Disjoint (H i).V (H j).V)) + (hE : K.E ⊆ ⋃ i, (H i).E) (i : ι) (hconn : IsConnectedDrawing (H i)) + {x y : S} (hx : x ∈ (H i).V ∩ bd S) (hy : y ∈ K.V ∩ bd S) : + Nonempty (GraphWalk K.toGraph x y) ↔ y ∈ (H i).V ∩ bd S := by + constructor + · rintro ⟨W⟩ + have hWV := (walk_stays_in_disjoint_family H K hsub hdis hE i W hx.1).1 + exact ⟨hWV y W.end_mem_support, hy.2⟩ + · intro hyi + obtain ⟨W⟩ := hconn x hx.1 y hyi.1 + obtain ⟨W', _, _⟩ := (hsub i).exists_walk_up W + exact ⟨W'⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DistinctCompleteChords.lean b/LeanPool/GraphMinor/GM12/Section3DistinctCompleteChords.lean new file mode 100644 index 0000000000..1c51b20853 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DistinctCompleteChords.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CompleteChordCarrier + +/-! +# Distinct complete chords meet only on the base + +For the extraction used by XII (3.1), page 245, remove degenerate +chords and repeated endpoint pairs from the finite chord carrier. +Two remaining parameter gaps cannot overlap away from their contact +endpoints: such an overlap forces both pairs of endpoints to coincide. +Injectivity transfers this fact to the original path. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The finite complete-chord reduction can be chosen with distinct +nondegenerate parameter intervals. Different chords meet only in the +solid base. -/ +theorem exists_homotopic_path_in_distinct_complete_chords + {S : Type*} [TopologicalSpace S] (hS : IsSurface S) {F : Set S} + (hF : IsSolid F) {a b : S} (p : Path a b) (hpi : Function.Injective p) + (ha : a ∈ F) (hb : b ∈ F) : + ∃ (J : Finset (unitInterval × unitInterval)) (q : Path a b), + p.Homotopic q ∧ range q ⊆ F ∪ ⋃ g ∈ J, p '' Icc g.1 g.2 ∧ + (∀ g ∈ J, g.1 < g.2 ∧ p g.1 ∈ F ∧ p g.2 ∈ F ∧ + Disjoint (p '' Ioo g.1 g.2) F) ∧ + ∀ g ∈ J, ∀ h ∈ J, g ≠ h → (p '' Icc g.1 g.2) ∩ (p '' Icc h.1 h.2) ⊆ F := by + classical + obtain ⟨n, l, r, q, hpq, hq, hdata⟩ := + exists_homotopic_path_in_finite_complete_chords hS hF p hpi ha hb + let J := ((Finset.univ : Finset (Fin n)).filter (fun i => l i < r i)).image (fun i => (l i, r i)) + have hvalid : ∀ g ∈ J, g.1 < g.2 ∧ p g.1 ∈ F ∧ p g.2 ∈ F ∧ + Disjoint (p '' Ioo g.1 g.2) F := by + intro g hg + obtain ⟨i, hi, rfl⟩ := Finset.mem_image.mp hg + exact ⟨(Finset.mem_filter.mp hi).2, (hdata i).2⟩ + refine ⟨J, q, hpq, ?_, hvalid, ?_⟩ + · intro x hx + rcases hq hx with hxF | hxJ + · exact Or.inl hxF + · obtain ⟨i, z, hz, rfl⟩ := mem_iUnion.mp hxJ + by_cases hlt : l i < r i + · exact Or.inr (mem_iUnion₂.mpr ⟨(l i, r i), Finset.mem_image.mpr + ⟨i, Finset.mem_filter.mpr ⟨Finset.mem_univ i, hlt⟩, rfl⟩, z, hz, rfl⟩) + · have heq : l i = r i := le_antisymm (hdata i).1 (le_of_not_gt hlt) + have hzl : z = l i := le_antisymm (hz.2.trans_eq heq.symm) hz.1 + exact Or.inl (hzl.symm ▸ (hdata i).2.1) + · intro g hg h hh hne x hx + obtain ⟨z, hz, rfl⟩ := hx.1 + obtain ⟨w, hw, he⟩ := hx.2 + have hwz : w = z := hpi he + have hz' : z ∈ Icc h.1 h.2 := hwz ▸ hw + have hgap : Disjoint (Ioo g.1 g.2) (p ⁻¹' F) := disjoint_left.mpr (by + intro t ht htF + exact disjoint_left.mp (hvalid g hg).2.2.2 ⟨t, ht, rfl⟩ htF) + have hgap' : Disjoint (Ioo h.1 h.2) (p ⁻¹' F) := disjoint_left.mpr (by + intro t ht htF + exact disjoint_left.mp (hvalid h hh).2.2.2 ⟨t, ht, rfl⟩ htF) + exact parameter_gaps_intersection_subset_contacts (hvalid g hg).2.1 (hvalid g hg).2.2.1 + (hvalid h hh).2.1 (hvalid h hh).2.2.1 hgap hgap' hne ⟨hz, hz'⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DivisionArcCount.lean b/LeanPool/GraphMinor/GM12/Section3DivisionArcCount.lean new file mode 100644 index 0000000000..a53c3e7040 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DivisionArcCount.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.Defs +import LeanPool.GraphMinor.GM06.Section2Dual +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# Bounding a division count by either boundary arc + +For the VI (3.6) reduction in XII (3.2), pages 247--248, +each division part counted between two boundary points meets both +closed boundary arcs. A part containing an endpoint meets each arc +there. A crossing part has points on opposite sides of the two +endpoints. Choosing one point on an arc from each counted part is +injective, since division parts are disjoint. Thus the division count +is at most the number of prescribed vertices on either arc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM06 GM11 + +private theorem crossing_pair_meets_boundary_arc + {S : Type*} [TopologicalSpace S] {A B : Set S} {x y u v : S} + (hC : IsOArc (A ∪ B)) (hA : IsLineWithEnds A x y) (hB : IsLineWithEnds B x y) + (hc : CrossesOn (A ∪ B) u v x y) : u ∈ A ∨ v ∈ A := by + by_contra hn + push Not at hn + have hend : ({x, y} : Set S) ⊆ A := by + obtain ⟨f, hf0, hf1⟩ := hA + intro z hz + rcases hz with rfl | rfl + · exact hf0 ▸ (f 0).property + · exact hf1 ▸ (f 1).property + rcases GM06.CrossesOn.comm hC hc with ⟨_, hu, _, hv, _, _, _, _, _, _, hcomp⟩ + have huB : u ∈ B := hu.resolve_left hn.1 + have hvB : v ∈ B := hv.resolve_left hn.2 + have huI : u ∈ B \ {x, y} := ⟨huB, fun h => hn.1 (hend h)⟩ + have hvI : v ∈ B \ {x, y} := ⟨hvB, fun h => hn.2 (hend h)⟩ + have hsub : B \ {x, y} ⊆ (A ∪ B) \ {x, y} := fun z hz => ⟨Or.inr hz.1, hz.2⟩ + have hvComp := (GM11.IsLineWithEnds.isPreconnected_sdiff_pair hB).subset_connectedComponentIn + huI hsub hvI + exact hcomp (connectedComponentIn_eq hvComp) + +/-- The VI division count between the ends of two boundary arcs is +bounded by the vertex count of either arc, as needed in XII (3.2). -/ +theorem divisionCount_le_boundary_arc_count + {S : Type*} [TopologicalSpace S] {V A B : Set S} {x y : S} {Δ : Set (Set S)} + (hV : V.Finite) (hΔ : IsDivision Δ) (hΔV : divisionUnion Δ ⊆ V) + (hC : IsOArc (A ∪ B)) (hA : IsLineWithEnds A x y) (hB : IsLineWithEnds B x y) : + divisionCount (A ∪ B) Δ x y ≤ (V ∩ A).ncard := by + classical + let Cnt : Set (Set S) := {δ ∈ Δ | (δ ∩ {x, y}).Nonempty ∨ + ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn (A ∪ B) u v x y} + have hend : ({x, y} : Set S) ⊆ A := by + obtain ⟨f, hf0, hf1⟩ := hA + intro z hz + rcases hz with rfl | rfl + · exact hf0 ▸ (f 0).property + · exact hf1 ▸ (f 1).property + have hhit : ∀ δ ∈ Cnt, ∃ v, v ∈ δ ∧ v ∈ A := by + rintro δ ⟨_, hδ⟩ + rcases hδ with ⟨v, hvδ, hvend⟩ | ⟨u, huδ, v, hvδ, hcross⟩ + · exact ⟨v, hvδ, hend hvend⟩ + · rcases crossing_pair_meets_boundary_arc hC hA hB hcross with huA | hvA + · exact ⟨u, huδ, huA⟩ + · exact ⟨v, hvδ, hvA⟩ + choose f hfδ hfA using hhit + let g : Set S → S := fun δ => if h : δ ∈ Cnt then f δ h else x + have hmaps : MapsTo g Cnt (V ∩ A) := by + intro δ hδ + simp only [g, hδ, ↓reduceDIte] + exact ⟨hΔV (mem_sUnion_of_mem (hfδ δ hδ) hδ.1), hfA δ hδ⟩ + have hinj : InjOn g Cnt := by + intro δ₁ hδ₁ δ₂ hδ₂ heq + simp only [g, hδ₁, hδ₂, ↓reduceDIte] at heq + by_contra hne + exact Set.disjoint_left.mp (hΔ.2.2 hδ₁.1 hδ₂.1 hne) (hfδ δ₁ hδ₁) + (heq.symm ▸ hfδ δ₂ hδ₂) + exact Set.ncard_le_ncard_of_injOn g hmaps hinj (hV.inter_of_left A) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3DualPointSet.lean b/LeanPool/GraphMinor/GM12/Section3DualPointSet.lean new file mode 100644 index 0000000000..9c484e743d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3DualPointSet.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.Defs +import LeanPool.GraphMinor.GM06.Section3Main + +/-! +# Choosing the dual boundary points for VI (3.6) + +The VI (3.6) application in XII (3.2), page 247, needs one point +in each boundary segment between consecutive prescribed vertices. +Choose a point in every segment. Different segments are disjoint, +so the set of chosen points meets each segment exactly once. +When the prescribed vertex set is empty, use the empty set instead. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM06 + +/-- A dual point set exists for a boundary and its prescribed +vertices, as needed to apply VI (3.6) in XII (3.2). -/ +theorem exists_dual_point_set + {S : Type*} [TopologicalSpace S] (C V : Set S) : + ∃ U : Set S, GM06.IsDualPointSet C V U := by + classical + by_cases hV : V = ∅ + · refine ⟨∅, fun _ => rfl, ?_⟩ + intro hne + exact False.elim (hne.ne_empty hV) + · let I := {s : Set S // s ∈ segmentsOf C V} + have hex : ∀ s : I, ∃ x, x ∈ s.val := fun s => GM06.segment_nonempty s.property + choose f hf using hex + refine ⟨range f, ?_, ?_⟩ + · intro he + exact False.elim (hV he) + · intro _ + constructor + · rintro x ⟨s, rfl⟩ + obtain ⟨⟨a, ha, hsa⟩, _⟩ := s.property + have hsx := hf s + rw [← hsa] at hsx + exact connectedComponentIn_subset _ _ hsx + · intro s hs + have hcap : range f ∩ s = {f ⟨s, hs⟩} := by + apply Subset.antisymm + · rintro x ⟨⟨t, rfl⟩, hxs⟩ + have hts : t.val = s := by + by_contra hne + exact Set.disjoint_left.mp (GM06.disjoint_of_mem_segmentsOf_ne t.property hs hne) + (hf t) hxs + have ht : t = (⟨s, hs⟩ : I) := Subtype.ext hts + exact congrArg f ht + · intro x hx + have hxe : x = f (⟨s, hs⟩ : I) := hx + subst x + exact ⟨mem_range_self _, hf (⟨s, hs⟩ : I)⟩ + rw [hcap, Set.ncard_singleton] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3EmptyBoundaryDisc.lean b/LeanPool/GraphMinor/GM12/Section3EmptyBoundaryDisc.lean new file mode 100644 index 0000000000..3b9130517a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3EmptyBoundaryDisc.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3PuncturedBoundary +import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# Adding a disc disjoint from the drawing + +The auxiliary disc in XII (3.2), page 247, has no boundary vertices. +Adding it to the prescribed family preserves the boundary vertex +union. A forest disjoint from that disc also keeps its contact set. +These are the set identities needed in the two-disc reduction. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The auxiliary disc has no drawing vertices on its boundary. -/ +theorem boundary_vertices_eq_empty_of_disc_disjoint + {S : Type*} [TopologicalSpace S] (Γ : Drawing S) {E : Set S} + (hE : Disjoint E Γ.U) : Γ.V ∩ discBd E = ∅ := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro x hx + exact Set.disjoint_left.mp hE (Surface.discBd_subset E hx.2) (Γ.V_subset_U hx.1) + +/-- Adding an empty-boundary disc does not change the prescribed +boundary vertex set in XII (3.2), page 247. -/ +theorem discBoundaryVertices_fin_cons_of_disjoint + {S : Type*} [TopologicalSpace S] {t : ℕ} (Γ : Drawing S) (Δ : Fin t → Set S) + {E : Set S} (hE : Disjoint E Γ.U) : + discBoundaryVertices Γ (Fin.cons E Δ) = discBoundaryVertices Γ Δ := by + have hVE := boundary_vertices_eq_empty_of_disc_disjoint Γ hE + ext x + simp only [discBoundaryVertices, mem_iUnion, Fin.exists_fin_succ, Fin.cons_zero, Fin.cons_succ] + exact or_iff_right (fun hx => Set.notMem_empty x (hVE ▸ hx)) + +/-- A drawing avoiding the auxiliary disc keeps its contacts with +the enlarged prescribed family. -/ +theorem drawing_contact_fin_cons_of_disjoint + {S : Type*} [TopologicalSpace S] {t : ℕ} (K : Drawing S) (Δ : Fin t → Set S) + {E : Set S} (hE : Disjoint E K.U) : + (K.U ∩ ⋃ i : Fin (t + 1), (Fin.cons E Δ : Fin (t + 1) → Set S) i) = (K.U ∩ ⋃ i, Δ i) ∧ + (K.V ∩ ⋃ i : Fin (t + 1), (Fin.cons E Δ : Fin (t + 1) → Set S) i) = (K.V ∩ ⋃ i, Δ i) := by + have hU : K.U ∩ E = ∅ := hE.symm.inter_eq + have hV : K.V ∩ E = ∅ := (hE.mono_right K.V_subset_U).symm.inter_eq + have hUnion : (⋃ i : Fin (t + 1), (Fin.cons E Δ : Fin (t + 1) → Set S) i) = E ∪ ⋃ i, Δ i := by + ext x + simp only [mem_iUnion, Fin.exists_fin_succ, Fin.cons_zero, Fin.cons_succ, mem_union] + constructor + · rw [hUnion, inter_union_distrib_left, hU, empty_union] + · rw [hUnion, inter_union_distrib_left, hV, empty_union] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3EmptyClasses.lean b/LeanPool/GraphMinor/GM12/Section3EmptyClasses.lean new file mode 100644 index 0000000000..5ef38e8070 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3EmptyClasses.lean @@ -0,0 +1,130 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Empty classes in the connecting-subdrawing statement + +The partition in XII (3.1) and (3.2), pages 245--246, is stated in the +interfaces as a disjoint family whose union is the prescribed vertex +set. Such a family may include empty parts. Prove the connecting result +for its nonempty parts, then assign the empty subdrawing to each empty +part. This also proves the vacuous case with no prescribed vertices. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The empty subdrawing is connected in the vertex-walk definition +used in the connecting-subdrawing statement. -/ +theorem exists_empty_connected_subdrawing + {S : Type*} [TopologicalSpace S] [T1Space S] (Γ : Drawing S) : + ∃ H : Drawing S, H.IsSubdrawing Γ ∧ IsConnectedDrawing H ∧ H.V = ∅ := by + let H := Γ.span ∅ ∅ + have hV : H.V = ∅ := by simp [H, Drawing.span_V, Drawing.spanV] + refine ⟨H, Γ.span_isSubdrawing _ _, ?_, hV⟩ + intro x hx + rw [hV] at hx + exact hx.elim + +/-- Connecting the nonempty classes suffices for the conclusion (*) +of XII Section 3. The empty classes receive empty subdrawings. -/ +theorem hasConnectingSubdrawings_of_nonempty_classes + {S : Type*} [TopologicalSpace S] [T1Space S] + {Γ : Drawing S} {p : ℕ} {Z : Set S} {Zs : Fin p → Set S} + (H : {j : Fin p // (Zs j).Nonempty} → Drawing S) + (hsub : ∀ j, (H j).IsSubdrawing Γ) + (hconn : ∀ j, IsConnectedDrawing (H j)) + (hdis : ∀ i j, i ≠ j → Disjoint (H i).V (H j).V) + (hboundary : ∀ j, (H j).V ∩ Z = Zs j.val) : + HasConnectingSubdrawings Γ Z Zs := by + classical + obtain ⟨O, hOsub, hOconn, hOV⟩ := exists_empty_connected_subdrawing Γ + let K : Fin p → Drawing S := fun j => if h : (Zs j).Nonempty then H ⟨j, h⟩ else O + refine ⟨K, ?_, ?_, ?_, ?_⟩ + · intro j + dsimp only [K] + split + · exact hsub _ + · exact hOsub + · intro j + dsimp only [K] + split + · exact hconn _ + · exact hOconn + · intro i j hij + dsimp only [K] + split <;> split + · exact hdis _ _ (fun he => hij (congrArg Subtype.val he)) + · rw [hOV] + exact disjoint_empty _ + · rw [hOV] + exact empty_disjoint _ + · rw [hOV] + exact empty_disjoint _ + · intro j + dsimp only [K] + split + · exact hboundary _ + · rename_i hj + rw [hOV, empty_inter] + exact (Set.not_nonempty_iff_eq_empty.mp hj).symm + +/-- An enumeration of the nonempty partition parts can be used in +(*) and extended to the original family. -/ +theorem hasConnectingSubdrawings_of_nonempty_restriction + {S : Type*} [TopologicalSpace S] [T1Space S] + {Γ : Drawing S} {p q : ℕ} {Z : Set S} {Zs : Fin p → Set S} + (e : {j : Fin p // (Zs j).Nonempty} ≃ Fin q) + (hc : HasConnectingSubdrawings Γ Z (fun j => Zs (e.symm j).val)) : + HasConnectingSubdrawings Γ Z Zs := by + obtain ⟨H, hsub, hconn, hdis, hboundary⟩ := hc + exact hasConnectingSubdrawings_of_nonempty_classes (fun j => H (e j)) + (fun j => hsub (e j)) (fun j => hconn (e j)) + (fun i j hij => hdis (e i) (e j) (fun he => hij (e.injective he))) + (fun j => by simpa only [e.symm_apply_apply] using hboundary (e j)) + +/-- When the prescribed union is empty, empty subdrawings give (*). +This includes the case `t = 0` in XII (3.2), page 247. -/ +theorem hasConnectingSubdrawings_of_empty_union + {S : Type*} [TopologicalSpace S] [T1Space S] + (Γ : Drawing S) {p : ℕ} (Zs : Fin p → Set S) (hZs : (⋃ j, Zs j) = ∅) : + HasConnectingSubdrawings Γ ∅ Zs := by + obtain ⟨O, hsub, hconn, hOV⟩ := exists_empty_connected_subdrawing Γ + refine ⟨fun _ => O, fun _ => hsub, fun _ => hconn, ?_, ?_⟩ + · intro i j _ + rw [hOV] + exact empty_disjoint _ + · intro j + rw [inter_empty] + apply (Set.eq_empty_iff_forall_notMem.mpr ?_).symm + intro x hx + have : x ∈ ⋃ j, Zs j := mem_iUnion.mpr ⟨j, hx⟩ + rw [hZs] at this + exact this + +/-- Graph Minors XII, (3.2), the case of no deleted discs, page 247. +The prescribed boundary union is empty, so every partition part is +empty and the empty subdrawings give the desired conclusion. -/ +theorem theorem_3_2_zero_discs + {S : Type*} [TopologicalSpace S] [T1Space S] + (Γ : Drawing S) (Δ : Fin 0 → Set S) {p : ℕ} (Zs : Fin p → Set S) + (hcover : (⋃ j, Zs j) = ⋃ i, Γ.V ∩ subBd (Δ i)) : + HasConnectingSubdrawings Γ (⋃ i, Γ.V ∩ subBd (Δ i)) Zs := by + have hZ : (⋃ i, Γ.V ∩ subBd (Δ i)) = ∅ := by simp + rw [hZ] at hcover ⊢ + exact hasConnectingSubdrawings_of_empty_union Γ Zs hcover + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3EnclosingBranches.lean b/LeanPool/GraphMinor/GM12/Section3EnclosingBranches.lean new file mode 100644 index 0000000000..ae16d74957 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3EnclosingBranches.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3PartialPlanarity +public import LeanPool.GraphMinor.GM12.Section3SurroundingDisc + +/-! +# Enclosing discs exclude the opposite branch + +For XII (3.1)(iv), page 245, each pair of branches surrounds one cuff. +Its enclosing disc cannot also contain the opposite branch: then the +whole set would be planar in that partial fill and therefore near-planar. +The argument works for any decomposition into a surrounding circle and +its complementary part. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The enclosing discs for surrounding circles exclude the +complementary parts of a set which is not near-planar. This supplies +the opposite-branch condition in XII (3.1)(iv). -/ +theorem exists_enclosing_discs_excluding_complementary_parts + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {X : Set (discComplement Δ)} (P Q : ι → Set (discComplement Δ)) + (hcover : ∀ i, Q i ∪ P i = X) + (hQ : ∀ i, IsOArc (Q i)) + (hs : ∀ i, GM07.SurroundsCuff (Q i) (Subtype.val ⁻¹' discBd (Δ i))) + (hnot : ¬ GM07.IsNearPlanar X) : + ∃ D : ι → Set S, ∀ i, IsClosedDisc (D i) ∧ + discBd (D i) = (Subtype.val : discComplement Δ → S) '' Q i ∧ + Δ i ⊆ D i ∧ ¬ (Subtype.val : discComplement Δ → S) '' P i ⊆ D i := by + classical + choose D hD hbd hinc hDT using fun i => + surrounding_bounds_disc_including_deleted_disc hS Δ hΔ hdisj i (hQ i) (hs i) + refine ⟨D, fun i => ⟨hD i, hbd i, hinc i, ?_⟩⟩ + intro hP + apply hnot + apply isNearPlanar_of_image_subset_disc_in_partial_fill hS Δ hΔ hdisj i (hD i) (hDT i) + rw [← hcover i, image_union] + apply union_subset _ hP + rw [← hbd i] + exact discBd_subset (D i) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3Extraction.lean b/LeanPool/GraphMinor/GM12/Section3Extraction.lean new file mode 100644 index 0000000000..9371680235 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3Extraction.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ExtractionReduction +public import LeanPool.GraphMinor.GM12.Section3Alpha +import LeanPool.GraphMinor.GM12.Section3MeetingCircleExtraction + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Extraction from a solid connected set + +The Section 8 argument of VII used by XII (3.1), page 245, reduces a +solid connected set which is not near-planar to a schismatic subset. +The selected-circle argument handles circles, disjoint loops and loops +meeting once. The remaining intersection case follows by the proved +complete-chord homotopy reduction. Thus the only external input here +is the cited planar criterion VII (5.1). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +universe u v + +/-- Assemble the schismatic extraction used in XII (3.1) from the +proved selection cases and complete-chord intersection extraction. -/ +theorem exists_schismatic_subset_of_solid + {S : Type u} {ι : Type v} [TopologicalSpace S] [T2Space S] + [ConnectedSpace S] [Finite ι] [Nonempty ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + {X : Set (discComplement Δ)} (hX : IsSolid X) (hconn : IsConnected X) + (hnot : ¬ GM07.IsNearPlanar X) : + ∃ Y : Set (discComplement Δ), Y ⊆ X ∧ GM07.IsSchismatic Y := by + rcases schismatic_extraction_or_larger_circle_intersection hS Δ hΔ hdisj + hcase hX hconn hnot with h | ⟨F, A, i, j, hF, hA, hFX, hAX, hij, hsF, hsA, hne, hmany⟩ + · exact h + · classical + obtain ⟨x, hx⟩ := hne + have hex : ∃ y ∈ F ∩ A, y ≠ x := by + by_contra hn + apply hmany x + apply Subset.antisymm + · intro y hy + have heq : y = x := by + by_contra hne + exact hn ⟨y, hy, hne⟩ + exact mem_singleton_iff.mpr heq + · exact singleton_subset_iff.mpr hx + obtain ⟨y, hy, hyx⟩ := hex + obtain ⟨Y, hYFA, hY⟩ := exists_schismatic_subset_of_meeting_surrounding_circles hS Δ hΔ hdisj + hcase hij hF hA hsF hsA hx hy (Ne.symm hyx) + exact ⟨Y, hYFA.trans (union_subset hFX hAX), hY⟩ + +/-- The minimum-count step of XII (3.1) after solid-set extraction. +Normality passes to the extracted subset, and its vertex count is at +most that of the original alpha candidate. The remaining inputs are +candidate existence and the bounds for +the schismatic shapes. -/ +theorem alpha_ge_of_solid_extraction + {S : Type u} {ι : Type v} [TopologicalSpace S] [T2Space S] + [ConnectedSpace S] [Finite ι] [Nonempty ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + (G : Drawing (discComplement Δ)) (N : ℕ) + (hex : ∃ X, GM07.IsAlphaCandidate G X) + (hbound : ∀ Y, GM07.IsSchismatic Y → G.IsNormal Y → N ≤ (Y ∩ G.V).ncard) : + N ≤ GM07.alpha G := by + apply alpha_ge_of_schismatic_counts G hex ?_ hbound + intro X hX + obtain ⟨Y, hYX, hY⟩ := exists_schismatic_subset_of_solid + hS Δ hΔ hdisj hcase hX.1 hX.2.1 hX.2.2.2 + exact ⟨Y, hYX, hY, fun _ hy => hX.2.2.1 ⟨hYX hy.1, hy.2⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ExtractionReduction.lean b/LeanPool/GraphMinor/GM12/Section3ExtractionReduction.lean new file mode 100644 index 0000000000..8c1ab7addc --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ExtractionReduction.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SubcircleSelection +public import LeanPool.GraphMinor.GM12.Section3CircleSchismatic +public import LeanPool.GraphMinor.GM12.Section3Punctured +import LeanPool.GraphMinor.GM12.Section3BarbellSchismatic +import LeanPool.GraphMinor.GM12.Section3MeetingLoopSchismatic +import LeanPool.GraphMinor.GM12.Section3PuncturedCuffs +import LeanPool.GraphMinor.GM12.Section3PuncturedSurface + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# The remaining intersection case in schismatic extraction + +The Section 8 reduction used by XII (3.1), page 245, selects either +a circle which is not near-planar or circles surrounding distinct cuffs. +The circle, disjoint-circle and single-intersection cases now yield +schismatic subsets. This theorem assembles those proved cases and +leaves precisely the case of two selected circles with a larger +intersection, which must be reduced to the three-branch shape or a +new circle. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +universe u + +/-- Reduction of the Section 8 extraction argument to selected +surrounding circles whose intersection is neither empty nor one point. +Every other selection case supplies a schismatic subset. -/ +theorem schismatic_extraction_or_larger_circle_intersection + {S : Type u} {ι : Type*} [TopologicalSpace S] [T2Space S] + [ConnectedSpace S] [Finite ι] [Nonempty ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + {X : Set (discComplement Δ)} (hX : IsSolid X) (hconn : IsConnected X) + (hnot : ¬ GM07.IsNearPlanar X) : + (∃ Y : Set (discComplement Δ), Y ⊆ X ∧ GM07.IsSchismatic Y) ∨ + ∃ (F A : Set (discComplement Δ)) (i j : ι), + IsOArc F ∧ IsOArc A ∧ F ⊆ X ∧ A ⊆ X ∧ i ≠ j ∧ + GM07.SurroundsCuff F (Subtype.val ⁻¹' discBd (Δ i)) ∧ + GM07.SurroundsCuff A (Subtype.val ⁻¹' discBd (Δ j)) ∧ + (F ∩ A).Nonempty ∧ ∀ u, F ∩ A ≠ {u} := by + classical + let : ConnectedSpace (discComplement Δ) := + Subtype.connectedSpace (discComplement_isConnected hS Δ hΔ hdisj) + have hsurface := discComplement_isSurface hS Δ hΔ hdisj + have hcuff := discComplement_cuffs_nonempty hS Δ hΔ hdisj + rcases exists_non_nearplanar_circle_or_distinct_surrounding_circles hsurface hcuff hX hnot with + ⟨F, hF, hFX, hnotF⟩ | ⟨F, A, C, C', hF, hA, hFX, hAX, hC, hC', hCC', hsF, hsA⟩ + · exact Or.inl ⟨F, hFX, isSchismatic_oArc hF hnotF⟩ + · have hCi : C ∈ cuffs (discComplement Δ) := hC + rw [discComplement_cuffs_eq hS Δ hΔ hdisj] at hCi + obtain ⟨i, rfl⟩ := hCi + have hCj : C' ∈ cuffs (discComplement Δ) := hC' + rw [discComplement_cuffs_eq hS Δ hΔ hdisj] at hCj + obtain ⟨j, rfl⟩ := hCj + have hij : i ≠ j := by + intro he + apply hCC' + rw [he] + by_cases hdis : Disjoint F A + · exact Or.inl (exists_schismatic_x1_of_disjoint_surrounding_subcircles + hS Δ hΔ hdisj hcase hX hconn hij hF hA hFX hAX hdis hsF hsA) + · by_cases hpoint : ∃ u, F ∩ A = {u} + · obtain ⟨u, hu⟩ := hpoint + exact Or.inl (exists_schismatic_x2_of_meeting_surrounding_subcircles + hS Δ hΔ hdisj hcase hij hF hA hFX hAX hu hsF hsA) + · have hne : (F ∩ A).Nonempty := by + by_contra hn + exact hdis (Set.disjoint_iff_inter_eq_empty.mpr (Set.not_nonempty_iff_eq_empty.mp hn)) + exact Or.inr ⟨F, A, i, j, hF, hA, hFX, hAX, hij, hsF, hsA, hne, + fun u hu => hpoint ⟨u, hu⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3FeasibilityDiscs.lean b/LeanPool/GraphMinor/GM12/Section3FeasibilityDiscs.lean new file mode 100644 index 0000000000..ac6471b391 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3FeasibilityDiscs.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3PuncturedCuffs +public import LeanPool.GraphMinor.GM12.Section3PuncturedSurface +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs +import LeanPool.GraphMinor.Surface.DiscMerge + +/-! +# Feasibility discs in the punctured surface + +In XII (3.1), page 245, each topological feasibility disc meets the +deleted discs only at its prescribed boundary vertices. Consequently +it lies in Sigma-star. A closed disc in a surface can meet the surface +boundary only on its own boundary. Thus the prescribed vertices lie +on the feasibility disc boundary, where a finite star can be drawn. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A closed disc in a surface meets the surface boundary only on its +own boundary, since each point of its interior is an interior point +of the surface. -/ +theorem disc_inter_surface_boundary_subset_discBd + {S : Type*} [TopologicalSpace S] (hS : IsSurface S) + {D : Set S} (hD : IsClosedDisc D) : D ∩ bd S ⊆ discBd D := by + intro x hx + by_contra hn + exact hx.2 (isInteriorPoint_of_mem_discInt hS.2.2 hD ⟨hx.1, hn⟩) + +/-- A feasibility disc remains in Sigma-star when all its contacts +with the deleted discs belong to their retained boundaries. -/ +theorem feasibility_disc_subset_discComplement + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {D Z : Set S} (hcontact : D ∩ ⋃ i, Δ i = Z) + (hZ : Z ⊆ ⋃ i, discBd (Δ i)) : D ⊆ discComplement Δ := by + intro x hxD + by_cases hx : x ∈ ⋃ i, Δ i + · have hxZ : x ∈ Z := hcontact ▸ ⟨hxD, hx⟩ + obtain ⟨i, hxi⟩ := mem_iUnion.mp (hZ hxZ) + exact disc_boundary_subset_discComplement hS Δ hΔ hdisj i hxi + · exact subset_closure hx + +/-- The prescribed contacts of a feasibility disc lie on its own +boundary, as needed for the star in XII (3.1). -/ +theorem feasibility_contacts_subset_discBd + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {D Z : Set S} (hD : IsClosedDisc D) (hcontact : D ∩ ⋃ i, Δ i = Z) + (hZ : Z ⊆ ⋃ i, discBd (Δ i)) : Z ⊆ discBd D := by + have hDC := feasibility_disc_subset_discComplement hS Δ hΔ hdisj hcontact hZ + have hdisc := isClosedDisc_subtype_preimage hDC hD + intro x hxZ + have hxD : x ∈ D := (hcontact.symm ▸ hxZ).1 + let y : discComplement Δ := ⟨x, hDC hxD⟩ + have hyB : y ∈ bd (discComplement Δ) := by + rw [discComplement_boundary_eq hS Δ hΔ] + exact hZ hxZ + have hyD : y ∈ (Subtype.val : discComplement Δ → S) ⁻¹' D := hxD + have hy := disc_inter_surface_boundary_subset_discBd + (discComplement_isSurface hS Δ hΔ hdisj) hdisc.1 ⟨hyD, hyB⟩ + rw [hdisc.2] at hy + exact hy + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3FeasibilityForest.lean b/LeanPool/GraphMinor/GM12/Section3FeasibilityForest.lean new file mode 100644 index 0000000000..8e836f3b62 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3FeasibilityForest.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3FeasibilityForests +import LeanPool.GraphMinor.GM12.Section3SurfaceForestUnion +import LeanPool.GraphMinor.GM12.Section3DisjointFamilyWalks + +/-! +# The feasibility forest with its boundary classes + +For XII (3.1), page 245, combine the disjoint local forests into one +proper surface forest. Its boundary vertex set is the union of the +prescribed partition parts. A walk stays in one local forest, while +each local forest is connected. Thus its boundary connection classes +are exactly the prescribed parts. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Topological feasibility supplies the actual forest needed by +VII (7.5) in the proof of XII (3.1), including its exact boundary +vertex set and connection classes. -/ +theorem exists_feasibility_forest + {S : Type*} [TopologicalSpace S] [T2Space S] {t p : ℕ} + (hS : IsClosedSurface S) (Δ : Fin t → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (Zs : Fin p → Set S) (hfin : ∀ j, (Zs j).Finite) + (hZ : ∀ j, Zs j ⊆ ⋃ i, discBd (Δ i)) + (hfeasible : IsTopologicallyFeasible Δ Zs) : + ∃ K : Drawing (discComplement Δ), GM07.IsSurfaceForest K ∧ + K.V ∩ bd (discComplement Δ) = Subtype.val ⁻¹' ⋃ j, Zs j ∧ + ∀ j, ∀ x ∈ (Subtype.val : discComplement Δ → S) ⁻¹' Zs j, + ∀ y ∈ K.V ∩ bd (discComplement Δ), + Nonempty (GraphWalk K.toGraph x y) ↔ y.val ∈ Zs j := by + obtain ⟨H, hH, hdis⟩ := exists_disjoint_feasibility_forests hS Δ hΔ hdisj Zs hfin hZ hfeasible + obtain ⟨K, hK, _, hV, hE, hsub⟩ := + exists_disjoint_surface_forest_union H (fun j => (hH j).1) hdis + have hdisV : Pairwise (fun i j => Disjoint (H i).V (H j).V) := by + intro i j hij + exact (hdis i j hij).mono (H i).V_subset_U (H j).V_subset_U + have hboundary : K.V ∩ bd (discComplement Δ) = Subtype.val ⁻¹' ⋃ j, Zs j := by + ext x + constructor + · rintro ⟨hxV, hxB⟩ + rw [hV] at hxV + obtain ⟨j, hxj⟩ := mem_iUnion.mp hxV + have hx : x ∈ (H j).V ∩ bd (discComplement Δ) := ⟨hxj, hxB⟩ + rw [(hH j).2.2] at hx + exact mem_iUnion.mpr ⟨j, hx⟩ + · intro hx + obtain ⟨j, hxj⟩ := mem_iUnion.mp hx + have hx : x ∈ (H j).V ∩ bd (discComplement Δ) := by + rw [(hH j).2.2] + exact hxj + exact ⟨(hsub j).1 hx.1, hx.2⟩ + refine ⟨K, hK, hboundary, ?_⟩ + intro j x hx y hy + have hxH : x ∈ (H j).V ∩ bd (discComplement Δ) := by + rw [(hH j).2.2] + exact hx + have hiff := walk_iff_mem_boundary_class_of_disjoint_family H K hsub hdisV hE.le + j (hH j).2.1 hxH hy + rw [(hH j).2.2] at hiff + exact hiff + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3FeasibilityForests.lean b/LeanPool/GraphMinor/GM12/Section3FeasibilityForests.lean new file mode 100644 index 0000000000..b921688453 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3FeasibilityForests.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ProperDiscForest +public import LeanPool.GraphMinor.GM12.Section3PuncturedSurface +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs +import LeanPool.GraphMinor.GM12.Section3BoundaryEquality +import LeanPool.GraphMinor.GM12.Section3FeasibilityDiscs + +/-! +# Disjoint local forests from topological feasibility + +The discs in the topological feasibility condition of XII (3.1), +page 245, lie in Sigma-star. Read each disc there and draw its proper +connected star. Its boundary vertices are the prescribed part of the +partition. Since each star stays in its own disc, their supports are +pairwise disjoint. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Topological feasibility supplies a disjoint family of actual +proper connected forests in Sigma-star, with the prescribed boundary +vertex sets, for XII (3.1), page 245. -/ +theorem exists_disjoint_feasibility_forests + {S : Type*} [TopologicalSpace S] [T2Space S] {t p : ℕ} + (hS : IsClosedSurface S) (Δ : Fin t → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (Zs : Fin p → Set S) (hfin : ∀ j, (Zs j).Finite) + (hZ : ∀ j, Zs j ⊆ ⋃ i, discBd (Δ i)) + (hfeasible : IsTopologicallyFeasible Δ Zs) : + ∃ H : Fin p → Drawing (discComplement Δ), + (∀ j, GM07.IsSurfaceForest (H j) ∧ IsConnectedDrawing (H j) ∧ + (H j).V ∩ bd (discComplement Δ) = Subtype.val ⁻¹' Zs j) ∧ + ∀ i j, i ≠ j → Disjoint (H i).U (H j).U := by + classical + let C := discComplement Δ + obtain ⟨D, hD, hDD, hcontact⟩ := hfeasible + have hDC : ∀ j, D j ⊆ C := fun j => + feasibility_disc_subset_discComplement hS Δ hΔ hdisj (hcontact j) (hZ j) + have hlocal : ∀ j : Fin p, ∃ H : Drawing C, + H.U ⊆ Subtype.val ⁻¹' D j ∧ GM07.IsSurfaceForest H ∧ + IsConnectedDrawing H ∧ H.V ∩ bd C = Subtype.val ⁻¹' Zs j := by + intro j + have hdisc := isClosedDisc_subtype_preimage (hDC j) (hD j) + apply exists_proper_connected_forest_in_disc (discComplement_isSurface hS Δ hΔ hdisj) + hdisc.1 ((hfin j).preimage Subtype.val_injective.injOn) + · intro x hx + have hxD : x.val ∈ D j := ((hcontact j).symm ▸ hx).1 + exact hxD + · intro x hx + rw [discComplement_boundary_eq hS Δ hΔ] + exact hZ j hx + · rintro x ⟨hxD, hxB⟩ + rw [discComplement_boundary_eq hS Δ hΔ] at hxB + obtain ⟨i, hxi⟩ := mem_iUnion.mp hxB + exact hcontact j ▸ (show x.val ∈ D j ∩ ⋃ i, Δ i from + ⟨hxD, mem_iUnion.mpr ⟨i, discBd_subset _ hxi⟩⟩) + choose H hHU hHF hHC hHV using hlocal + refine ⟨H, fun j => ⟨hHF j, hHC j, hHV j⟩, ?_⟩ + intro i j hij + apply Set.disjoint_left.mpr + intro x hxi hxj + exact Set.disjoint_left.mp (hDD i j hij) (hHU i hxi) (hHU j hxj) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3FillOneDisc.lean b/LeanPool/GraphMinor/GM12/Section3FillOneDisc.lean new file mode 100644 index 0000000000..e47db357c0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3FillOneDisc.lean @@ -0,0 +1,62 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3PuncturedSurface + +/-! +# Filling one of the deleted discs + +To compare the cuffs in XII (3.1), page 245, with the capped surfaces +of VII, fill one disc and retain the other deletions. The resulting +space is exactly the union of Sigma-star and that disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Omitting one disc from the deletion fills exactly that disc. -/ +theorem discComplement_except_eq_union + {S ι : Type*} [TopologicalSpace S] [T2Space S] + (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) (i : ι) : + discComplement (fun j : {j // j ≠ i} => Δ j.val) = discComplement Δ ∪ Δ i := by + classical + let B : Set S := ⋃ j : {j // j ≠ i}, Δ j.val + have hsmall : (⋃ j, Δ j)ᶜ ⊆ Bᶜ := by + intro x hx hB + obtain ⟨j, hj⟩ := mem_iUnion.mp hB + exact hx (mem_iUnion.mpr ⟨j.val, hj⟩) + apply Subset.antisymm + · intro x hx + by_cases hxi : x ∈ Δ i + · exact Or.inr hxi + · left + apply mem_closure_iff.mpr + intro O hO hxO + obtain ⟨y, hyO, hyB⟩ := mem_closure_iff.mp hx + (O ∩ (Δ i)ᶜ) (hO.inter (hΔ i).isCompact.isClosed.isOpen_compl) ⟨hxO, hxi⟩ + refine ⟨y, hyO.1, ?_⟩ + intro hy + obtain ⟨j, hj⟩ := mem_iUnion.mp hy + by_cases hji : j = i + · exact hyO.2 (hji ▸ hj) + · exact hyB (mem_iUnion.mpr ⟨⟨j, hji⟩, hj⟩) + · intro x hx + rcases hx with hx | hx + · exact closure_mono hsmall hx + · apply subset_closure + intro hxB + obtain ⟨j, hj⟩ := mem_iUnion.mp hxB + exact Set.disjoint_left.mp (hdisj j.property.symm) hx hj + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3FillingConnected.lean b/LeanPool/GraphMinor/GM12/Section3FillingConnected.lean new file mode 100644 index 0000000000..398c8099fa --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3FillingConnected.lean @@ -0,0 +1,94 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Topology.Connected.Clopen + +/-! +# Connectedness after removing disjoint discs + +The space used in XII (3.1), page 245, remains connected. A closed +separation of that space would extend across each deleted disc, +because its intersection with the remaining space is connected. +Finitely many closed fillings would then separate the original space. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology + +/-- Removing finitely many disjoint closed fillings preserves +preconnectedness when each filling meets the remaining closed set +in a preconnected set. -/ +theorem isPreconnected_of_finite_fillings + {S ι : Type*} [TopologicalSpace S] [PreconnectedSpace S] [Finite ι] + {C : Set S} (hC : IsClosed C) (D : ι → Set S) + (hD : ∀ i, IsClosed (D i)) + (hdisj : Pairwise (fun i j => Disjoint (D i) (D j))) + (hbd : ∀ i, IsPreconnected (C ∩ D i)) + (hcover : univ ⊆ C ∪ ⋃ i, D i) : IsPreconnected C := by + classical + apply (isPreconnected_iff_subset_of_fully_disjoint_closed hC).mpr + intro A B hA hB hAB hdisAB + have choices : ∀ i, C ∩ D i ⊆ A ∨ C ∩ D i ⊆ B := by + intro i + apply isPreconnected_iff_subset_of_disjoint_closed.mp (hbd i) A B hA hB + · exact inter_subset_left.trans hAB + · rw [hdisAB.inter_eq, inter_empty] + let P : ι → Prop := fun i => C ∩ D i ⊆ A + let A' : Set S := (C ∩ A) ∪ ⋃ i : {i // P i}, D i.val + let B' : Set S := (C ∩ B) ∪ ⋃ i : {i // ¬ P i}, D i.val + have hA' : IsClosed A' := (hC.inter hA).union + (isClosed_iUnion_of_finite fun i => hD i.val) + have hB' : IsClosed B' := (hC.inter hB).union + (isClosed_iUnion_of_finite fun i => hD i.val) + have hcover' : univ ⊆ A' ∪ B' := by + intro x _ + rcases hcover (mem_univ x) with hxC | hxD + · rcases hAB hxC with hxA | hxB + · exact Or.inl (Or.inl ⟨hxC, hxA⟩) + · exact Or.inr (Or.inl ⟨hxC, hxB⟩) + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxD + by_cases hi : P i + · exact Or.inl (Or.inr (mem_iUnion.mpr ⟨⟨i, hi⟩, hxi⟩)) + · exact Or.inr (Or.inr (mem_iUnion.mpr ⟨⟨i, hi⟩, hxi⟩)) + have hdis' : Disjoint A' B' := by + apply Set.disjoint_left.mpr + intro x hxA hxB + rcases hxA with hxA | hxA <;> rcases hxB with hxB | hxB + · exact Set.disjoint_left.mp hdisAB hxA.2 hxB.2 + · obtain ⟨j, hxj⟩ := mem_iUnion.mp hxB + have hjB := (choices j.val).resolve_left j.property + exact Set.disjoint_left.mp hdisAB hxA.2 (hjB ⟨hxA.1, hxj⟩) + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxA + exact Set.disjoint_left.mp hdisAB (i.property ⟨hxB.1, hxi⟩) hxB.2 + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxA + obtain ⟨j, hxj⟩ := mem_iUnion.mp hxB + by_cases hij : i.val = j.val + · exact j.property (hij ▸ i.property) + · exact Set.disjoint_left.mp (hdisj hij) hxi hxj + have hwhole := isPreconnected_iff_subset_of_disjoint_closed.mp + isPreconnected_univ A' B' hA' hB' hcover' (by rw [hdis'.inter_eq, inter_empty]) + rcases hwhole with hwhole | hwhole + · left + intro x hxC + rcases hwhole (mem_univ x) with hxA | hxD + · exact hxA.2 + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxD + exact i.property ⟨hxC, hxi⟩ + · right + intro x hxC + rcases hwhole (mem_univ x) with hxB | hxD + · exact hxB.2 + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxD + exact (choices i.val).resolve_left i.property ⟨hxC, hxi⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3FiniteChordHomotopy.lean b/LeanPool/GraphMinor/GM12/Section3FiniteChordHomotopy.lean new file mode 100644 index 0000000000..e71b9b7fa5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3FiniteChordHomotopy.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ReplaceChordHomotopy + +/-! +# Removing finitely many homotopically redundant chords + +For the extraction used by XII (3.1), page 245, complete gaps of an +injective path have disjoint interiors. If each chord is homotopic to +a path in the first circle, remove the chords one at a time. The +one-chord pasting lemma preserves the homotopy of any path in the +carrier. After the finite induction, the resulting path stays in +the first circle. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- Finitely many chords, meeting one another only in the closed base, +can all be removed from a path when each is homotopic into the base. -/ +theorem exists_homotopic_path_in_base_of_finite_chords + {S ι : Type*} [TopologicalSpace S] [T2Space S] + {F : Set S} (hF : IsClosed F) (a b : ι → S) + (c r : ∀ i, Path (a i) (b i)) + (hci : ∀ i, Function.Injective (c i)) + (hmeet : ∀ i, range (c i) ∩ F ⊆ {a i, b i}) + (hdisj : ∀ i j, i ≠ j → range (c i) ∩ range (c j) ⊆ F) + (hcr : ∀ i, (c i).Homotopic (r i)) (hrF : ∀ i, range (r i) ⊆ F) + (K : Finset ι) {x y : S} (q : Path x y) (hx : x ∈ F) (hy : y ∈ F) + (hq : range q ⊆ F ∪ ⋃ i ∈ K, range (c i)) : + ∃ q' : Path x y, q.Homotopic q' ∧ range q' ⊆ F := by + classical + induction K using Finset.induction_on generalizing q with + | empty => + refine ⟨q, Path.Homotopic.refl q, ?_⟩ + simpa only [Finset.notMem_empty, iUnion_of_empty, iUnion_empty, union_empty] using hq + | @insert i K hi ih => + let B := F ∪ ⋃ k ∈ K, range (c k) + have hBc : IsClosed B := hF.union (isClosed_biUnion_finset + (fun k _ => (isCompact_range (c k).continuous).isClosed)) + have hFB : F ⊆ B := subset_union_left + have hmeetB : range (c i) ∩ B ⊆ {a i, b i} := by + rintro z ⟨hzi, hzF | hzK⟩ + · exact hmeet i ⟨hzi, hzF⟩ + · obtain ⟨k, hk, hzk⟩ := mem_iUnion₂.mp hzK + have hik : i ≠ k := fun he => hi (he.symm ▸ hk) + exact hmeet i ⟨hzi, hdisj i k hik ⟨hzi, hzk⟩⟩ + have hqB : range q ⊆ B ∪ range (c i) := by + intro z hz + rcases hq hz with hzF | hzK + · exact Or.inl (Or.inl hzF) + · obtain ⟨k, hk, hzk⟩ := mem_iUnion₂.mp hzK + rcases Finset.mem_insert.mp hk with rfl | hk + · exact Or.inr hzk + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨k, hk, hzk⟩)) + have hrB : range (r i) ⊆ (ContinuousMap.id S) '' B := by + simpa only [ContinuousMap.coe_id, image_id] using (hrF i).trans hFB + obtain ⟨q', hqq', hq'⟩ := exists_homotopic_path_after_replacing_chord hBc + (c i) (hci i) hmeetB (ContinuousMap.id S) (r i) (hcr i) hrB q hqB (hFB hx) (hFB hy) + change q.Homotopic q' at hqq' + have hq'B : range q' ⊆ B := by + simpa only [ContinuousMap.coe_id, image_id] using hq' + obtain ⟨q'', hq'q'', hq''⟩ := ih q' hq'B + exact ⟨q'', hqq'.trans hq'q'', hq''⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3FiniteDrawingUnion.lean b/LeanPool/GraphMinor/GM12/Section3FiniteDrawingUnion.lean new file mode 100644 index 0000000000..42a35d9275 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3FiniteDrawingUnion.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.GM11.PaintingCells + +/-! +# Finite disjoint unions of drawings + +The forests in the feasibility discs of XII (3.1), page 245, have +pairwise disjoint supports. Their finite union is a drawing, obtained +by gluing one component at a time. Its support, vertices and edges +are exactly the unions of those of the components. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A finite family of drawings with disjoint supports has a drawing +as its union, with the expected support, vertex and edge sets. -/ +theorem exists_finite_disjoint_drawing_union + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (H : ι → Drawing S) (hdis : Pairwise (fun i j => Disjoint (H i).U (H j).U)) : + ∃ K : Drawing S, K.U = ⋃ i, (H i).U ∧ K.V = ⋃ i, (H i).V ∧ K.E = ⋃ i, (H i).E := by + classical + have hfinite : ∀ I : Set ι, I.Finite → ∃ K : Drawing S, + K.U = ⋃ i ∈ I, (H i).U ∧ K.V = ⋃ i ∈ I, (H i).V ∧ K.E = ⋃ i ∈ I, (H i).E := by + intro I hI + induction I, hI using Set.Finite.induction_on with + | empty => + refine ⟨pointsDrawing finite_empty, ?_, ?_, ?_⟩ + · change ∅ = ⋃ i ∈ (∅ : Set ι), (H i).U + simp + · change ∅ = ⋃ i ∈ (∅ : Set ι), (H i).V + simp + · change arcComponentsIn (∅ \ ∅ : Set S) = ⋃ i ∈ (∅ : Set ι), (H i).E + simp only [Set.sdiff_self, Set.biUnion_empty] + ext e + constructor + · rintro ⟨⟨x, hx⟩, hsub, _⟩ + exact hsub hx + · intro he + exact False.elim he + | @insert a I ha hI ih => + obtain ⟨K, hU, hV, hE⟩ := ih + have hcap : K.U ∩ (H a).U ⊆ K.V ∩ (H a).V := by + rintro x ⟨hxK, hxa⟩ + rw [hU] at hxK + obtain ⟨i, hi⟩ := mem_iUnion.mp hxK + obtain ⟨hiI, hxi⟩ := mem_iUnion.mp hi + have hia : i ≠ a := by + intro he + exact ha (he ▸ hiI) + exact False.elim (Set.disjoint_left.mp (hdis hia) hxi hxa) + refine ⟨K.glue (H a) hcap, ?_, ?_, ?_⟩ + · change K.U ∪ (H a).U = _ + rw [hU, biUnion_insert, union_comm] + · change K.V ∪ (H a).V = _ + rw [hV, biUnion_insert, union_comm] + · rw [Drawing.glue_E, hE, biUnion_insert, union_comm] + obtain ⟨K, hU, hV, hE⟩ := hfinite univ (Set.toFinite _) + refine ⟨K, ?_, ?_, ?_⟩ + · simpa only [Set.biUnion_univ] using hU + · simpa only [Set.biUnion_univ] using hV + · simpa only [Set.biUnion_univ] using hE + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3FiniteGraphSolid.lean b/LeanPool/GraphMinor/GM12/Section3FiniteGraphSolid.lean new file mode 100644 index 0000000000..2c81447770 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3FiniteGraphSolid.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.SurfaceGraph +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM12.Section3SolidConnections +import Mathlib.Topology.Algebra.Module.LocallyConvex +import LeanPool.GraphMinor.Surface.ArcErase +import LeanPool.GraphMinor.Surface.DiscMerge + +/-! +# Finite graph carriers are solid + +The Section 8 reduction of VII used in XII (3.1), page 245, applies +the planar criterion to its finite graph shapes. Parametrize each +edge by a closed interval and include the finitely many vertices. +The resulting map from a finite disjoint union is a compact quotient. +Local path-connectedness passes to the quotient, giving the paper's +local arc-connectedness. The finite graph carrier is also closed. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A finite graph carrier is solid, with local arc-connectedness +proved through its compact interval parametrizations. -/ +theorem isSolid_gr_of_isGraph + {S : Type*} [TopologicalSpace S] [T2Space S] + {V : Set S} {E : Set (Set S)} (h : Surface.IsGraph V E) : IsSolid (gr V E) := by + classical + let : Fintype V := h.fin.fintype + let : Fintype E := h.fine.fintype + let : LocallyPathConnectedSpace unitInterval := (convex_Icc (0 : ℝ) 1).locallyPathConnectedSpace + have hpar : ∀ e : E, Nonempty (unitInterval ≃ₜ e.val) := by + intro e + obtain ⟨a, b, _, hL, _⟩ := h.edge e.val e.property + obtain ⟨φ, _, _⟩ := hL + exact ⟨φ⟩ + let φ : ∀ e : E, unitInterval ≃ₜ e.val := fun e => Classical.choice (hpar e) + let M := (Σ _ : E, unitInterval) ⊕ V + let f : M → gr V E := fun m => match m with + | .inl ⟨e, t⟩ => ⟨(φ e t).val, Or.inr ⟨e.val, e.property, (φ e t).property⟩⟩ + | .inr v => ⟨v.val, Or.inl v.property⟩ + have hfcval : Continuous (fun m : M => (f m).val) := by + apply continuous_sum_dom.mpr + constructor + · apply continuous_sigma + intro e + change Continuous (fun t : unitInterval => (φ e t).val) + exact continuous_subtype_val.comp (φ e).continuous + · change Continuous (fun v : V => v.val) + exact continuous_subtype_val + have hfc : Continuous f := hfcval.subtype_mk _ + have hfs : Function.Surjective f := by + intro y + rcases y.property with hyV | hyE + · exact ⟨.inr ⟨y.val, hyV⟩, rfl⟩ + · obtain ⟨e, he, hye⟩ := hyE + let z : E := ⟨e, he⟩ + refine ⟨.inl ⟨z, (φ z).symm ⟨y.val, hye⟩⟩, ?_⟩ + apply Subtype.ext + change (φ z ((φ z).symm ⟨y.val, hye⟩)).val = y.val + exact congrArg Subtype.val ((φ z).apply_symm_apply ⟨y.val, hye⟩) + have hquot := hfc.isClosedMap.isQuotientMap hfc hfs + let : LocallyPathConnectedSpace (gr V E) := hquot.locallyPathConnectedSpace + exact ⟨isLocallyArcConnected_of_locallyPathConnectedSpace, h.isClosed_gr⟩ + +/-- A circle is solid. Its finite graph presentation comes from the +proved curve-addition construction, so its local arc-connectedness +uses the same compact quotient argument as other finite shapes. -/ +theorem isSolid_oArc + {S : Type*} [TopologicalSpace S] [T2Space S] {F : Set S} (hF : IsOArc F) : IsSolid F := by + have h0 : gr (∅ : Set S) ∅ = ∅ := by simp [gr] + have hfin : FinConn (F \ gr (∅ : Set S) ∅) := by + rw [h0, sdiff_empty] + exact finConn_of_isPreconnected hF.isPreconnected + obtain ⟨V, E, _, hG, hcarrier, _⟩ := isGraph_empty.add_curve hF hfin + rw [h0, empty_union] at hcarrier + have hsolid := isSolid_gr_of_isGraph hG + exact hcarrier ▸ hsolid + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3FiniteReroute.lean b/LeanPool/GraphMinor/GM12/Section3FiniteReroute.lean new file mode 100644 index 0000000000..b59a3d4a9e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3FiniteReroute.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3RerouteCover +public import LeanPool.GraphMinor.GM12.Section3RerouteContacts + +/-! +# Finitely many homotopy-preserving reroutings + +For the circle-intersection step used by XII (3.1), page 245, apply +the first/last-contact replacement on each member of a finite patch +partition. A piece missing the closed set is retained. Every new piece +is homotopic to the original one and, after adjoining the closed set, +its carrier consists of at most two original outer subpaths. Each +outer subpath meets the closed set only at its attachment endpoint. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A path piece either misses the closed set or has a first/last +replacement. In both cases two outer subpaths describe the new carrier, +and their intersections with the set are confined to their ends. -/ +theorem exists_homotopic_reroute_piece + {S : Type*} [TopologicalSpace S] {F U V : Set S} + (hF : IsClosed F) (hV : IsSimplyConnectedSet V) (hUV : U ⊆ V) + (hFU : IsArcConnected (F ∩ U)) {a b : S} (p : Path a b) (hpU : range p ⊆ U) : + ∃ (s t : unitInterval) (q : Path a b), s ≤ t ∧ p.Homotopic q ∧ + F ∪ range q = F ∪ range (p.subpath 0 s) ∪ range (p.subpath t 1) ∧ + range (p.subpath 0 s) ∩ F ⊆ {p s} ∧ range (p.subpath t 1) ∩ F ⊆ {p t} := by + classical + by_cases hmeet : (p ⁻¹' F).Nonempty + · obtain ⟨s, t, q, hst, hh, heq, hl, hr⟩ := + exists_homotopic_reroute_with_outer_pieces hF hV hUV hFU p hpU hmeet + exact ⟨s, t, q, hst, hh, heq, hl.le, hr.le⟩ + · refine ⟨1, 1, p, le_rfl, Path.Homotopic.refl p, ?_, ?_, ?_⟩ + · rw [Path.subpath_zero_one, Path.subpath_self, Path.refl_range] + change F ∪ range p = F ∪ range p ∪ {p 1} + have hsub : ({p 1} : Set S) ⊆ F ∪ range p := + singleton_subset_iff.mpr (Or.inr (mem_range_self 1)) + exact (Set.union_eq_left.mpr hsub).symm + · rw [Path.subpath_zero_one] + change range p ∩ F ⊆ {p 1} + rintro x ⟨⟨r, rfl⟩, hrF⟩ + exact (hmeet ⟨r, hrF⟩).elim + · rw [Path.subpath_self, Path.refl_range] + exact inter_subset_left + +/-- A finite partition of a path admits simultaneous local reroutings +with preserved homotopies and only finitely many retained outer +subpaths. No approximation leaves the original path union the solid set. -/ +theorem exists_finite_homotopic_reroutes + {S : Type*} [TopologicalSpace S] (hS : IsSurface S) {F : Set S} + (hF : IsSolid F) {a b : S} (p : Path a b) : + ∃ (n : ℕ) (t : Fin (n + 1) → unitInterval) (s u : Fin n → unitInterval) + (q : ∀ i : Fin n, Path (p (t i.castSucc)) (p (t i.succ))), + t 0 = 0 ∧ t (Fin.last n) = 1 ∧ Monotone t ∧ ∀ i : Fin n, + s i ≤ u i ∧ (p.subpath (t i.castSucc) (t i.succ)).Homotopic (q i) ∧ + F ∪ range (q i) = F ∪ range ((p.subpath (t i.castSucc) (t i.succ)).subpath 0 (s i)) ∪ + range ((p.subpath (t i.castSucc) (t i.succ)).subpath (u i) 1) ∧ + range ((p.subpath (t i.castSucc) (t i.succ)).subpath 0 (s i)) ∩ F ⊆ + {(p.subpath (t i.castSucc) (t i.succ)) (s i)} ∧ + range ((p.subpath (t i.castSucc) (t i.succ)).subpath (u i) 1) ∩ F ⊆ + {(p.subpath (t i.castSucc) (t i.succ)) (u i)} := by + classical + obtain ⟨n, t, ht0, htlast, hmono, hpieces⟩ := exists_finite_reroute_partition hS hF p + have hlocal : ∀ i : Fin n, ∃ (s u : unitInterval) + (q : Path (p (t i.castSucc)) (p (t i.succ))), + s ≤ u ∧ (p.subpath (t i.castSucc) (t i.succ)).Homotopic q ∧ + F ∪ range q = F ∪ range ((p.subpath (t i.castSucc) (t i.succ)).subpath 0 s) ∪ + range ((p.subpath (t i.castSucc) (t i.succ)).subpath u 1) ∧ + range ((p.subpath (t i.castSucc) (t i.succ)).subpath 0 s) ∩ F ⊆ + {(p.subpath (t i.castSucc) (t i.succ)) s} ∧ + range ((p.subpath (t i.castSucc) (t i.succ)).subpath u 1) ∩ F ⊆ + {(p.subpath (t i.castSucc) (t i.succ)) u} := by + intro i + obtain ⟨U, V, _, hUV, hsc, hArc, hpU⟩ := hpieces i + exact exists_homotopic_reroute_piece hF.2 hsc hUV hArc _ hpU + choose s u q hst hh heq hl hr using hlocal + exact ⟨n, t, s, u, q, ht0, htlast, hmono, fun i => ⟨hst i, hh i, heq i, hl i, hr i⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ForestAlphaReduction.lean b/LeanPool/GraphMinor/GM12/Section3ForestAlphaReduction.lean new file mode 100644 index 0000000000..5e321f3f7d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ForestAlphaReduction.lean @@ -0,0 +1,120 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ForestBound +public import LeanPool.GraphMinor.GM12.Section3BoundaryLinked +import LeanPool.GraphMinor.GM12.Section3ForestEmptyClasses +import LeanPool.GraphMinor.GM12.Section3ForestConnections +import LeanPool.GraphMinor.GM12.Section3AmbientTransfer +import LeanPool.GraphMinor.GM12.Section3BoundaryEquality + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# The alpha reduction with a supplied feasibility forest + +For the auxiliary-disc step of XII (3.2), page 247, keep the +boundary-connection forest when adding an empty-boundary disc. +The VII (7.5) reduction works directly with this forest. No new +choice of topological feasibility discs is required. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +universe u + +/-- The VII (7.5) application in XII (3.1), with the boundary +connection forest supplied explicitly for use in XII (3.2). -/ +theorem connecting_subdrawings_of_alpha_bound_of_forest + {S : Type u} [TopologicalSpace S] [T2Space S] {t p : ℕ} + (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : Fin t → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (havoid : ∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) + (Zs : Fin p → Set S) (hcover : ⋃ j, Zs j = discBoundaryVertices Γ Δ) + (hdisZ : ∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) + (H : Drawing (discComplement Δ)) (hHF : GM07.IsSurfaceForest H) + (hHB : H.V ∩ bd (discComplement Δ) = Subtype.val ⁻¹' ⋃ j, Zs j) + (hclasses : ∀ j, ∀ x ∈ (Subtype.val : discComplement Δ → S) ⁻¹' Zs j, + ∀ y ∈ H.V ∩ bd (discComplement Δ), + Nonempty (GraphWalk H.toGraph x y) ↔ y.val ∈ Zs j) + (hbound : ∀ F : Set S, Γ.IsNormal F → IsOArc F → F ⊆ discComplement Δ → + ∀ D : Set S, IsClosedDisc D → discBd D = F → + ∀ i, (∀ j, Δ j ⊆ D ↔ j = i) → + (Γ.V ∩ discBd (Δ i)).ncard ≤ (Γ.V ∩ F).ncard) + (a b c z : ℕ) (hcomplex : 3 ≤ 3 * a + 3 * b + c) + (hmodel : Nonempty (discComplement Δ ≃ₜ SurfaceModel a b c)) + (hcount : (discBoundaryVertices Γ Δ).ncard ≤ z) + (hα : 42 * (z + c + 1) * GM07.vModel a b (c + 1) (z + c + 1) ≤ + GM07.alpha (drawingInSubspace Γ (discComplement Δ) + (drawing_support_subset_discComplement hS Γ Δ hΔ hdisj havoid))) : + HasConnectingSubdrawings Γ (discBoundaryVertices Γ Δ) Zs := by + let C := discComplement Δ + let Z := discBoundaryVertices Γ Δ + let hUC := drawing_support_subset_discComplement hS Γ Δ hΔ hdisj havoid + let G := drawingInSubspace Γ C hUC + have hZs : ∀ j, Zs j ⊆ Z := by + intro j x hx + change x ∈ discBoundaryVertices Γ Δ + rw [← hcover] + exact mem_iUnion.mpr ⟨j, hx⟩ + have hZsV : ∀ j, Zs j ⊆ Γ.V := by + intro j x hx + obtain ⟨i, hxi⟩ := mem_iUnion.mp (hZs j hx) + exact hxi.1 + have hZsBd : ∀ j, Zs j ⊆ ⋃ i, discBd (Δ i) := by + intro j x hx + obtain ⟨i, hxi⟩ := mem_iUnion.mp (hZs j hx) + exact mem_iUnion.mpr ⟨i, hxi.2⟩ + have hZsC : ∀ j, Zs j ⊆ C := by + intro j x hx + obtain ⟨i, hxi⟩ := mem_iUnion.mp (hZsBd j hx) + exact disc_boundary_subset_discComplement hS Δ hΔ hdisj i hxi + have hHB' : H.V ∩ bd C = (Subtype.val : C → S) ⁻¹' Z := by + rw [hcover] at hHB + exact hHB + have hGBimage := drawingInDiscComplement_boundary_vertices_eq hS Γ Δ hΔ hdisj hUC + have hGB : G.V ∩ bd C = (Subtype.val : C → S) ⁻¹' Z := by + ext x + constructor + · intro hx + change x.val ∈ discBoundaryVertices Γ Δ + rw [← hGBimage] + exact mem_image_of_mem Subtype.val hx + · intro hx + change x.val ∈ discBoundaryVertices Γ Δ at hx + rw [← hGBimage] at hx + obtain ⟨y, hy, he⟩ := hx + have hyx : y = x := Subtype.ext he + exact hyx ▸ hy + have hlinked := drawingInDiscComplement_isBoundaryLinked hS Γ Δ hΔ hdisj havoid hbound + have hcountG : (G.V ∩ bd C).ncard ≤ z := + (drawingInDiscComplement_boundary_vertex_count hS Γ Δ hΔ hUC).trans hcount + have hfeas := feasible_forest_of_large_alpha (discComplement_isSurface hS Δ hΔ hdisj) + hcomplex hmodel G H hlinked hcountG hα hHF (hGB.trans hHB'.symm) + have hparts : ∀ j, (Subtype.val : C → S) ⁻¹' Zs j ⊆ H.V ∩ bd C := by + intro j x hx + rw [hHB'] + exact hZs j hx + have hparts_dis : ∀ i j, i ≠ j → Disjoint + ((Subtype.val : C → S) ⁻¹' Zs i) (Subtype.val ⁻¹' Zs j) := by + intro i j hij + exact (hdisZ i j hij).preimage Subtype.val + have hconnect := hasConnectingSubdrawings_of_feasible_forest_allowing_empty hfeas hparts + hparts_dis hclasses + rw [hHB'] at hconnect + exact hasConnectingSubdrawings_from_closed_subspace Γ C isClosed_closure hUC hZsC hconnect + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ForestBound.lean b/LeanPool/GraphMinor/GM12/Section3ForestBound.lean new file mode 100644 index 0000000000..e2ef171e69 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ForestBound.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Cited + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# The forest bound used in XII (3.1) + +The reduction of XII (3.1), page 245, uses VII (7.5) after removing the +prescribed discs. With at most z boundary vertices and c cuffs, choose +k = z + c + 1. This satisfies VII's boundary-count inequality. Its alpha +threshold then gives feasibility for any forest with the same boundary +vertices. The geometric work in XII must establish this alpha bound +from conditions (i)--(iv), and boundary linkage from condition (v). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +universe u + +/-- Apply VII (7.5), page 240, with a parameter depending only on the +surface and the boundary vertex bound, as needed for XII (3.1), page 245. +The integer `k = z + c + 1` ensures the required boundary-count bound. -/ +theorem feasible_forest_of_large_alpha {S : Type u} [TopologicalSpace S] [T1Space S] + (hS : IsSurface S) + {a b c z : ℕ} (hcomplex : 3 ≤ 3 * a + 3 * b + c) + (hmodel : Nonempty (S ≃ₜ SurfaceModel a b c)) + (G H : Drawing S) (hlinked : GM07.IsBoundaryLinked G) + (hcount : (G.V ∩ bd S).ncard ≤ z) + (hα : 42 * (z + c + 1) * GM07.vModel a b (c + 1) (z + c + 1) ≤ GM07.alpha G) + (hH : GM07.IsSurfaceForest H) (hboundary : G.V ∩ bd S = H.V ∩ bd S) : + GM07.IsGFeasible G H := by + apply GraphMinor.GM07.gm07_theorem_7_5 S hS a b c hcomplex hmodel (z + c + 1) G hlinked.1 hlinked + hα + · omega + · exact hH + · exact hboundary + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ForestConnections.lean b/LeanPool/GraphMinor/GM12/Section3ForestConnections.lean new file mode 100644 index 0000000000..14a586b842 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ForestConnections.lean @@ -0,0 +1,113 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM11.Section4b +import LeanPool.GraphMinor.GM12.Section3HomeoWalks +public import LeanPool.GraphMinor.GM12.Section3Components + +/-! +# Boundary vertices and connections of feasible forests + +The reduction of XII (3.1), page 245, uses a forest feasible by VII +(7.5). Forest homotopy preserves its boundary vertex set and which +boundary vertices are connected. The definition uses simple paths; +removing repeated vertices from a walk gives the same connection +relation for arbitrary walks. A homeomorphism fixing the boundary +also preserves the boundary vertex set. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM07 GM11 + +/-- A homeomorphism fixing the surface boundary does not change the +boundary vertex set of a drawing. -/ +theorem mapDrawingHomeo_boundary_vertices {S : Type*} [TopologicalSpace S] + (α : S ≃ₜ S) (H : Drawing S) (hfix : ∀ x ∈ bd S, α x = x) : + (mapDrawingHomeo α H).V ∩ bd S = H.V ∩ bd S := by + ext x + constructor + · rintro ⟨⟨y, hy, hyx⟩, hxBd⟩ + have hyEq : y = x := α.injective (hyx.trans (hfix x hxBd).symm) + exact ⟨hyEq ▸ hy, hxBd⟩ + · rintro ⟨hxV, hxBd⟩ + exact ⟨⟨x, hxV, hfix x hxBd⟩, hxBd⟩ + +/-- Homoplastic forests have the same boundary vertices. This is the +boundary-set part of the feasible-forest reduction in XII (3.1). -/ +theorem forestsHomoplastic_boundary_vertices {S : Type*} [TopologicalSpace S] + {H H' : Drawing S} (h : ForestsHomoplastic H H') : + H.V ∩ bd S = H'.V ∩ bd S := by + obtain ⟨α, hfix, hhom⟩ := h + exact (mapDrawingHomeo_boundary_vertices α H hfix).symm.trans hhom.2.2.2.2.1 + +/-- Forest homotopy preserves boundary connectivity expressed by +arbitrary graph walks. The definition gives simple paths, and every +walk has a simple subwalk with the same ends. -/ +theorem forestsHomotopic_walk_iff {S : Type*} [TopologicalSpace S] + {H H' : Drawing S} (h : ForestsHomotopic H H') + {s t : S} (hs : s ∈ H.V ∩ bd S) (ht : t ∈ H.V ∩ bd S) : + Nonempty (GraphWalk H.toGraph s t) ↔ Nonempty (GraphWalk H'.toGraph s t) := by + classical + have hbd := h.2.2.2.2.1 + by_cases hst : s = t + · subst t + have hs' : s ∈ H'.V ∩ bd S := hbd ▸ hs + exact iff_of_true ⟨.nil hs.1⟩ ⟨.nil hs'.1⟩ + have hsimple := (h.2.2.2.2.2 s hs t ht hst).1 + constructor + · rintro ⟨W⟩ + obtain ⟨P, hP, _, _⟩ := GraphMinor.GM11.GraphWalk.exists_isSimple W + obtain ⟨Q, _⟩ := hsimple.mp ⟨P, hP⟩ + exact ⟨Q⟩ + · rintro ⟨W⟩ + obtain ⟨P, hP, _, _⟩ := GraphMinor.GM11.GraphWalk.exists_isSimple W + obtain ⟨Q, _⟩ := hsimple.mpr ⟨P, hP⟩ + exact ⟨Q⟩ + +/-- Homoplasty preserves the boundary-connection classes of a forest, +including the boundary-fixing homeomorphism in VII's definition. -/ +theorem forestsHomoplastic_walk_iff {S : Type*} [TopologicalSpace S] + {H H' : Drawing S} (h : ForestsHomoplastic H H') + {s t : S} (hs : s ∈ H.V ∩ bd S) (ht : t ∈ H.V ∩ bd S) : + Nonempty (GraphWalk H.toGraph s t) ↔ Nonempty (GraphWalk H'.toGraph s t) := by + obtain ⟨α, hfix, hhom⟩ := h + have hsmap : s ∈ (mapDrawingHomeo α H).V ∩ bd S := by + rw [mapDrawingHomeo_boundary_vertices α H hfix] + exact hs + have htmap : t ∈ (mapDrawingHomeo α H).V ∩ bd S := by + rw [mapDrawingHomeo_boundary_vertices α H hfix] + exact ht + have hmap := walk_mapDrawingHomeo_iff α H (x := s) (y := t) + rw [hfix s hs.2, hfix t ht.2] at hmap + exact hmap.symm.trans (forestsHomotopic_walk_iff hhom hsmap htmap) + +/-- A feasible forest with the prescribed boundary classes supplies +the connected subdrawings in XII (3.1), page 245. Homoplasty preserves +its classes, and the component-selection theorem makes them disjoint. -/ +theorem hasConnectingSubdrawings_of_feasible_forest {S : Type*} [TopologicalSpace S] + [T1Space S] {Γ H : Drawing S} (hfeasible : IsGFeasible Γ H) + {p : ℕ} {Zs : Fin p → Set S} (hZs : ∀ j, Zs j ⊆ H.V ∩ bd S) + (hne : ∀ j, (Zs j).Nonempty) + (hdis : ∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) + (hclasses : ∀ j, ∀ x ∈ Zs j, ∀ y ∈ H.V ∩ bd S, + Nonempty (GraphWalk H.toGraph x y) ↔ y ∈ Zs j) : + HasConnectingSubdrawings Γ (H.V ∩ bd S) Zs := by + obtain ⟨H', _, hhom, hsub⟩ := hfeasible + have hboundary := forestsHomoplastic_boundary_vertices hhom + apply hasConnectingSubdrawings_of_connection_classes hsub + (fun x hx => (hboundary ▸ hx).1) hZs hne hdis + intro j x hx y hy + exact (forestsHomoplastic_walk_iff hhom (hZs j hx) hy).symm.trans (hclasses j x hx y hy) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ForestEmptyClasses.lean b/LeanPool/GraphMinor/GM12/Section3ForestEmptyClasses.lean new file mode 100644 index 0000000000..85eba2fc54 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ForestEmptyClasses.lean @@ -0,0 +1,54 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ForestConnections +public import LeanPool.GraphMinor.GM12.Section3EmptyClasses +import Mathlib.Data.Fintype.EquivFin + +/-! +# Feasible-forest connections with empty partition parts + +The forest form of the VII reduction used in XII (3.1) and (3.2) +permits empty boundary parts. Apply the connection lemma to the +nonempty parts, then restore the empty parts with empty drawings. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM07 + +/-- A feasible forest realizes its boundary connection classes even +when some partition parts are empty. -/ +theorem hasConnectingSubdrawings_of_feasible_forest_allowing_empty + {S : Type*} [TopologicalSpace S] [T1Space S] {Γ H : Drawing S} + (hfeasible : IsGFeasible Γ H) {p : ℕ} {Zs : Fin p → Set S} + (hparts : ∀ j, Zs j ⊆ H.V ∩ bd S) + (hdis : ∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) + (hclasses : ∀ j, ∀ x ∈ Zs j, ∀ y ∈ H.V ∩ bd S, + Nonempty (GraphWalk H.toGraph x y) ↔ y ∈ Zs j) : + HasConnectingSubdrawings Γ (H.V ∩ bd S) Zs := by + classical + let I := {j : Fin p // (Zs j).Nonempty} + let := Fintype.ofFinite I + let q := Fintype.card I + let e : I ≃ Fin q := Fintype.equivFin I + let f : Fin q → Fin p := fun j => (e.symm j).val + have hf : Function.Injective f := by + intro i j hij + exact e.symm.injective (Subtype.ext hij) + apply hasConnectingSubdrawings_of_nonempty_restriction e + exact hasConnectingSubdrawings_of_feasible_forest hfeasible (fun j => hparts (f j)) + (fun j => (e.symm j).property) + (fun i j hij => hdis (f i) (f j) (fun he => hij (hf he))) + (fun j => hclasses (f j)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ForestTransport.lean b/LeanPool/GraphMinor/GM12/Section3ForestTransport.lean new file mode 100644 index 0000000000..b1a1f225f4 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ForestTransport.lean @@ -0,0 +1,164 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3AmbientTransfer +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs + +/-! +# Forests under inclusion of a closed subspace + +The auxiliary-disc step in XII (3.2), page 247, reads the same +forest in a smaller surface. An injective map of vertices and edges +preserves simple closed walks and their lengths. Thus a forest in +the ambient surface stays a forest when its support is read in a +subspace. The walk transport also keeps boundary connections. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +private theorem exists_walk_of_link_map + {α β α' β' : Type*} {G : Graph α β} {G' : Graph α' β'} + (f : α → α') (g : β → β') + (hV : ∀ x ∈ G.vertexSet, f x ∈ G'.vertexSet) + (hL : ∀ {e x y}, G.IsLink e x y → G'.IsLink (g e) (f x) (f y)) + {x y : α} (W : GraphWalk G x y) : + ∃ W' : GraphWalk G' (f x) (f y), W'.support = W.support.map f ∧ + W'.edges = W.edges.map g := by + induction W with + | nil hx => exact ⟨.nil (hV _ hx), rfl, rfl⟩ + | cons he R ih => + obtain ⟨R', hs, he'⟩ := ih + exact ⟨.cons (hL he) R', congrArg (List.cons _) hs, congrArg (List.cons _) he'⟩ + +/-- An injective map of vertices and edges into a forest has no +nontrivial simple closed walks. -/ +theorem isGraphForest_of_injective_link_map + {α β α' β' : Type*} {G : Graph α β} {G' : Graph α' β'} + (f : α → α') (g : β → β') (hf : Function.Injective f) (hg : Function.Injective g) + (hV : ∀ x ∈ G.vertexSet, f x ∈ G'.vertexSet) + (hL : ∀ {e x y}, G.IsLink e x y → G'.IsLink (g e) (f x) (f y)) + (hforest : IsGraphForest G') : IsGraphForest G := by + intro x W hW + obtain ⟨W', hs, he⟩ := exists_walk_of_link_map f g hV hL W + have hsmap : (W.support.map f).tail = W.support.tail.map f := by + cases W.support <;> rfl + have hW' : W'.IsSimpleClosed := by + constructor + · rw [hs, hsmap] + exact hW.1.map hf + · rw [he] + exact hW.2.map hg + have hlen := hforest (f x) W' hW' + change W'.edges.length = 0 at hlen + rw [he, List.length_map] at hlen + exact hlen + +/-- Including a drawing restricted to a closed subspace recovers +its original vertex and edge sets. -/ +theorem drawingFromClosedSubspace_drawingInSubspace + {S : Type*} [TopologicalSpace S] + (Γ : Drawing S) (C : Set S) (hC : IsClosed C) (hUC : Γ.U ⊆ C) : + drawingFromClosedSubspace C hC (drawingInSubspace Γ C hUC) = Γ := by + apply Drawing.ext_of_V_E + · rw [drawingFromClosedSubspace_V, drawingInSubspace_V, Subtype.image_preimage_coe] + exact inter_eq_right.mpr (Γ.V_subset_U.trans hUC) + · rw [drawingFromClosedSubspace_E, drawingInSubspace_E, image_image] + have heq : ∀ e ∈ Γ.E, (Subtype.val : C → S) '' (Subtype.val ⁻¹' e) = e := by + intro e he + rw [Subtype.image_preimage_coe] + exact inter_eq_right.mpr (fun _ hx => hUC (he.2.1 hx).1) + ext e + constructor + · rintro ⟨e', he', he'e⟩ + change (Subtype.val : C → S) '' (Subtype.val ⁻¹' e') = e at he'e + rw [heq e' he'] at he'e + exact he'e ▸ he' + · intro he + exact ⟨e, he, heq e he⟩ + +/-- A link lifts when the entire drawing is read in a subspace. -/ +theorem isLink_drawingInSubspace + {S : Type*} [TopologicalSpace S] (Γ : Drawing S) + (C : Set S) (hUC : Γ.U ⊆ C) {e : Set S} {x y : C} + (hl : Γ.toGraph.IsLink e x.val y.val) : + (drawingInSubspace Γ C hUC).toGraph.IsLink (Subtype.val ⁻¹' e) x y := by + refine ⟨?_, ?_, ?_, ?_⟩ + · rw [drawingInSubspace_E] + exact ⟨e, hl.1, rfl⟩ + · rw [drawingInSubspace_V] + exact hl.2.1 + · rw [drawingInSubspace_V] + exact hl.2.2.1 + · rw [drawingInSubspace_V, closure_subtype_preimage + (fun z hz => hUC (hl.1.2.1 hz).1), ← preimage_inter, hl.2.2.2] + ext z + simp only [mem_preimage, mem_insert_iff, mem_singleton_iff, Subtype.ext_iff] + +/-- A walk lifts to the subspace containing the drawing support. -/ +theorem exists_walk_drawingInSubspace + {S : Type*} [TopologicalSpace S] (Γ : Drawing S) + (C : Set S) (hUC : Γ.U ⊆ C) {x y : S} (W : GraphWalk Γ.toGraph x y) + (hx : x ∈ C) (hy : y ∈ C) : + Nonempty (GraphWalk (drawingInSubspace Γ C hUC).toGraph ⟨x, hx⟩ ⟨y, hy⟩) := by + induction W with + | nil hxV => + exact ⟨.nil (by + change (⟨_, hx⟩ : C) ∈ (drawingInSubspace Γ C hUC).V + rw [drawingInSubspace_V] + exact hxV)⟩ + | @cons x z y e hl R ih => + have hz : z ∈ C := hUC (Γ.V_subset_U hl.2.2.1) + obtain ⟨R'⟩ := ih hz hy + exact ⟨.cons (isLink_drawingInSubspace Γ C hUC hl) R'⟩ + +/-- Reading a drawing in a closed subspace preserves graph +connections between its vertices. -/ +theorem walk_drawingInSubspace_iff + {S : Type*} [TopologicalSpace S] + (Γ : Drawing S) (C : Set S) (hC : IsClosed C) (hUC : Γ.U ⊆ C) {x y : C} : + Nonempty (GraphWalk (drawingInSubspace Γ C hUC).toGraph x y) ↔ + Nonempty (GraphWalk Γ.toGraph x.val y.val) := by + constructor + · rintro ⟨W⟩ + have h := exists_walk_drawingFromClosedSubspace C hC (drawingInSubspace Γ C hUC) W + rwa [drawingFromClosedSubspace_drawingInSubspace Γ C hC hUC] at h + · rintro ⟨W⟩ + exact exists_walk_drawingInSubspace Γ C hUC W x.property y.property + +/-- A forest remains a forest on reading its support in a closed +subspace. This supplies the no-circuit part of the auxiliary-disc +step in XII (3.2), page 247. -/ +theorem isGraphForest_drawingInSubspace + {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} (hforest : IsGraphForest Γ.toGraph) + (C : Set S) (hC : IsClosed C) (hUC : Γ.U ⊆ C) : + IsGraphForest (drawingInSubspace Γ C hUC).toGraph := by + let H := drawingInSubspace Γ C hUC + have hback := drawingFromClosedSubspace_drawingInSubspace Γ C hC hUC + apply isGraphForest_of_injective_link_map (G' := Γ.toGraph) (Subtype.val : C → S) + (Set.image Subtype.val) + Subtype.val_injective (Set.image_injective.mpr Subtype.val_injective) + · intro x hx + change x ∈ (drawingInSubspace Γ C hUC).V at hx + rw [drawingInSubspace_V] at hx + exact hx + · intro e x y hl + have h := isLink_drawingFromClosedSubspace C hC H hl + rw [hback] at h + exact h + · exact hforest + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3FreeBoundary.lean b/LeanPool/GraphMinor/GM12/Section3FreeBoundary.lean new file mode 100644 index 0000000000..8e99c946fa --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3FreeBoundary.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.Theorem61 +import LeanPool.GraphMinor.Surface.DiscMerge + +/-! +# Free boundary vertices give the enclosing-circle bound + +To verify (3.1)(v) in the proof of XII (3.2), page 247, the enclosed +boundary vertices are free and lie on the small side selected by the +tangle. Their number is at most the separation order. The common +vertices of that separation lie on the enclosing circle, which gives +the required bound. The disc on the small side is the enclosing disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM10 GM11 Hypergraph + +/-- The free-set step in the verification of XII (3.1)(v) in the proof +of (3.2), page 247. The tangle separation for the enclosing disc has +all common vertices on its frontier. -/ +theorem free_set_card_le_frontier_of_selected_disc + {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {X D : Set S} (hfree : IsFreeSet Γ.toHypergraph T θ X) + (hXD : X ⊆ D) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) : + X.ncard ≤ (Γ.V ∩ frontier D).ncard := by + have hXA : X ⊆ ((PaintingOrDrawing.drawing Γ).inter D).vertexSet := + fun x hx => ⟨hfree.1 hx, hXD hx⟩ + apply (hfree.2.2 hm hXA).trans + apply Set.ncard_le_ncard ?_ (Γ.finite_V.subset inter_subset_left) + intro x hx + have hh := inter_outside_subset hx + exact ⟨hh.2, hh.1⟩ + +/-- The prescribed free boundary has at most as many vertices as a +circle enclosing its disc and selected by the tangle. This is precisely +the counting implication used for XII (3.1)(v), page 247. -/ +theorem boundary_vertex_count_le_of_free_of_selected_disc + {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {δ D : Set S} (hD : IsClosedDisc D) (hδD : δ ⊆ D) + (hfree : IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd δ)) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) : + (Γ.V ∩ discBd δ).ncard ≤ (Γ.V ∩ discBd D).ncard := by + rw [← IsClosedDisc.frontier_eq_discBd hS hD] + exact free_set_card_le_frontier_of_selected_disc hfree + (fun _ hx => hδD (Surface.discBd_subset δ hx.2)) hm + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3GeometricAlpha.lean b/LeanPool/GraphMinor/GM12/Section3GeometricAlpha.lean new file mode 100644 index 0000000000..257bc5fed3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3GeometricAlpha.lean @@ -0,0 +1,81 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SchismaticBounds +public import LeanPool.GraphMinor.GM12.Section3Extraction + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# The alpha estimate from the four geometric conditions + +The reduction of XII (3.1), page 245, to VII (7.5) uses the minimum +over normal schismatic sets. The preceding proofs bound every such +set from conditions (i)--(iv). Extraction and minimum attainment then +give the alpha bound. Candidate existence stays explicit, so this theorem does not claim to +close the numbered result. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +universe u + +/-- Conditions (i)--(iv) of XII (3.1) give the alpha estimate after +candidate existence. +Every shape, cuff-label and numerical count step is proved. -/ +theorem alpha_gt_of_geometric_conditions + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + {t : ℕ} [Nonempty (Fin t)] + (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : Fin t → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ t) (hUC : Γ.U ⊆ discComplement Δ) (N : ℕ) + (hsmall : ∀ F : Set S, Γ.IsNormal F → IsOArc F → F ⊆ discComplement Δ → + (Γ.V ∩ F).ncard ≤ N → + ∃ D : Set S, IsClosedDisc D ∧ discBd D = F ∧ + ∀ i j, Δ i ⊆ D → Δ j ⊆ D → i = j) + (hii : ∀ (A B P D E : Set S) (u v : S), + Γ.IsNormal (A ∪ B ∪ P) → IsOArc A → IsOArc B → IsLineWithEnds P u v → + u ∈ A → v ∈ B → P ∩ A = {u} → P ∩ B = {v} → + A ∪ B ∪ P ⊆ discComplement Δ → IsClosedDisc D → IsClosedDisc E → + discBd D = A → discBd E = B → Disjoint D E → + (∃ i, ∀ l, Δ l ⊆ D ↔ l = i) → (∃ j, ∀ l, Δ l ⊆ E ↔ l = j) → + N < (Γ.V ∩ (A ∪ B ∪ P)).ncard) + (hiii : ∀ A B D E : Set S, + Γ.IsNormal (A ∪ B) → IsOArc A → IsOArc B → A ∪ B ⊆ discComplement Δ → + IsClosedDisc D → IsClosedDisc E → discBd D = A → discBd E = B → + (D ∩ E).ncard = 1 → + (∃ i, ∀ l, Δ l ⊆ D ↔ l = i) → (∃ j, ∀ l, Δ l ⊆ E ↔ l = j) → + N < (Γ.V ∩ (A ∪ B)).ncard) + (hiv : ∀ ht : t = 3, IsSphere S → ∀ (P D : Fin 3 → Set S) (a b : S), a ≠ b → + Γ.IsNormal (⋃ i, P i) → (∀ i, IsLineWithEnds (P i) a b) → + (∀ i j, i ≠ j → P i ∩ P j = {a, b}) → (⋃ i, P i) ⊆ discComplement Δ → + (∀ i, IsClosedDisc (D i) ∧ + discBd (D i) = ⋃ j : {j // j ≠ i}, P j.val ∧ Δ (Fin.cast ht.symm i) ⊆ D i ∧ ¬ P i ⊆ D i) → + N < (Γ.V ∩ ⋃ i, P i).ncard) + (hex : ∃ X, GM07.IsAlphaCandidate (drawingInSubspace Γ (discComplement Δ) hUC) X) : + N < GM07.alpha (drawingInSubspace Γ (discComplement Δ) hUC) := by + have hcase' : ¬ IsSphere S ∨ 3 ≤ Nat.card (Fin t) := by + rw [Nat.card_fin] + exact hcase + apply Nat.lt_of_succ_le + apply alpha_ge_of_solid_extraction hS Δ hΔ hdisj hcase' + (drawingInSubspace Γ (discComplement Δ) hUC) (N + 1) hex + intro Y hY hn + rw [inter_comm Y] + exact Nat.succ_le_of_lt (normal_schismatic_vertex_count_gt hS Γ Δ hΔ hdisj hcase hUC + N hsmall hii hiii hiv hY hn) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3GeometricReduction.lean b/LeanPool/GraphMinor/GM12/Section3GeometricReduction.lean new file mode 100644 index 0000000000..7bc49ed1c5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3GeometricReduction.lean @@ -0,0 +1,101 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3UniformAlphaReduction +public import LeanPool.GraphMinor.GM12.Section3GeometricAlpha +import LeanPool.GraphMinor.GM12.Section3CandidateExistence + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Connecting subdrawings from the geometric conditions + +Choose the uniform threshold supplied by the fixed surface model and +VII (7.5). Conditions (i)--(iv) give its alpha estimate, condition (v) +gives boundary linkage, and topological feasibility supplies the forest. +Alpha candidates are supplied by the proved one-cuff and two-cuff +constructions. The zero-disc case uses empty connecting subdrawings. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +universe u + +/-- Graph Minors VII, (7.5), proved unconditionally from `GM07.gm07_theorem_7_5`. -/ +theorem gm07_theorem_7_5_proved : GM07Theorem75Statement.{u} := + GM07.gm07_theorem_7_5 + +/-- Graph Minors XII, (3.1), page 245. The geometric conditions +(i)--(vi) give disjoint connected subdrawings for the prescribed +boundary partition, with one threshold for all drawings and disc +placements on the fixed surface. -/ +theorem theorem_3_1_proof + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (t z : ℕ) (hcase : ¬ IsSphere S ∨ 3 ≤ t) : + ∃ N : ℕ, ∀ (Γ : Drawing S) (Δ : Fin t → Set S) + (_hΔ : ∀ i, IsClosedDisc (Δ i)) + (_hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (_havoid : ∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) + (p : ℕ) (Zs : Fin p → Set S) + (_hsmall : ∀ F : Set S, Γ.IsNormal F → IsOArc F → F ⊆ discComplement Δ → + (Γ.V ∩ F).ncard ≤ N → + ∃ D : Set S, IsClosedDisc D ∧ discBd D = F ∧ + ∀ i j, Δ i ⊆ D → Δ j ⊆ D → i = j) + (_hii : ∀ (A B P D E : Set S) (u v : S), + Γ.IsNormal (A ∪ B ∪ P) → IsOArc A → IsOArc B → IsLineWithEnds P u v → + u ∈ A → v ∈ B → P ∩ A = {u} → P ∩ B = {v} → + A ∪ B ∪ P ⊆ discComplement Δ → IsClosedDisc D → IsClosedDisc E → + discBd D = A → discBd E = B → Disjoint D E → + (∃ i, ∀ l, Δ l ⊆ D ↔ l = i) → (∃ j, ∀ l, Δ l ⊆ E ↔ l = j) → + N < (Γ.V ∩ (A ∪ B ∪ P)).ncard) + (_hiii : ∀ A B D E : Set S, + Γ.IsNormal (A ∪ B) → IsOArc A → IsOArc B → A ∪ B ⊆ discComplement Δ → + IsClosedDisc D → IsClosedDisc E → discBd D = A → discBd E = B → + (D ∩ E).ncard = 1 → + (∃ i, ∀ l, Δ l ⊆ D ↔ l = i) → (∃ j, ∀ l, Δ l ⊆ E ↔ l = j) → + N < (Γ.V ∩ (A ∪ B)).ncard) + (_hiv : ∀ ht : t = 3, IsSphere S → ∀ (P D : Fin 3 → Set S) (a b : S), a ≠ b → + Γ.IsNormal (⋃ i, P i) → (∀ i, IsLineWithEnds (P i) a b) → + (∀ i j, i ≠ j → P i ∩ P j = {a, b}) → (⋃ i, P i) ⊆ discComplement Δ → + (∀ i, IsClosedDisc (D i) ∧ + discBd (D i) = ⋃ j : {j // j ≠ i}, P j.val ∧ Δ (Fin.cast ht.symm i) ⊆ D i ∧ ¬ P i ⊆ D i) → + N < (Γ.V ∩ ⋃ i, P i).ncard), + (⋃ j, Zs j) = discBoundaryVertices Γ Δ → + (∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) → + IsTopologicallyFeasible Δ Zs → + (∀ F : Set S, Γ.IsNormal F → IsOArc F → F ⊆ discComplement Δ → + ∀ D : Set S, IsClosedDisc D → discBd D = F → + ∀ i, (∀ j, Δ j ⊆ D ↔ j = i) → + (Γ.V ∩ discBd (Δ i)).ncard ≤ (Γ.V ∩ F).ncard) → + (discBoundaryVertices Γ Δ).ncard ≤ z → + HasConnectingSubdrawings Γ (discBoundaryVertices Γ Δ) Zs := by + by_cases ht : t = 0 + · subst t + refine ⟨0, ?_⟩ + intro Γ Δ hΔ hdisj havoid p Zs _ _ _ _ hcover _ _ _ _ + have hZ : discBoundaryVertices Γ Δ = ∅ := by simp [discBoundaryVertices] + rw [hZ] at hcover ⊢ + exact hasConnectingSubdrawings_of_empty_union Γ Zs hcover + · let : Nonempty (Fin t) := ⟨⟨0, Nat.pos_of_ne_zero ht⟩⟩ + obtain ⟨N, hN⟩ := exists_uniform_connecting_alpha_threshold hS t z hcase + refine ⟨N, ?_⟩ + intro Γ Δ hΔ hdisj havoid p Zs hsmall hii hiii hiv hcover hdisZ hfeasible hbound hcount + have hUC := drawing_support_subset_discComplement hS Γ Δ hΔ hdisj havoid + have hα := alpha_gt_of_geometric_conditions hS Γ Δ hΔ hdisj hcase hUC N + hsmall hii hiii hiv + (exists_alphaCandidate_in_discComplement hS ht hcase Γ Δ hΔ hdisj havoid) + exact hN Γ Δ hΔ hdisj havoid p Zs hcover hdisZ hfeasible hbound hcount (Nat.le_of_lt hα) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3GlueHomeomorph.lean b/LeanPool/GraphMinor/GM12/Section3GlueHomeomorph.lean new file mode 100644 index 0000000000..b0eb6dad79 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3GlueHomeomorph.lean @@ -0,0 +1,102 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Topology.Homeomorph.Lemmas +import Mathlib.Topology.Compactness.Compact + +/-! +# Gluing two compatible homeomorphisms + +The comparison of caps in XII (3.1), page 245, glues a map of the +original surface to a map of the added disc. Agreement on their +intersection gives continuity. The intersection condition gives +injectivity, and the two target pieces give surjectivity. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology + +/-- Compatible homeomorphisms of two closed pieces glue to a +homeomorphism of compact Hausdorff spaces. -/ +theorem exists_homeomorph_of_two_closed_pieces + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + [CompactSpace S] [T2Space T] + {A B : Set S} {A' B' : Set T} (hA : IsClosed A) (hB : IsClosed B) + (hcover : A ∪ B = univ) (hcover' : A' ∪ B' = univ) + (f : A ≃ₜ A') (g : B ≃ₜ B') + (hcross : ∀ x : A, (f x).val ∈ B' ↔ x.val ∈ B) + (hagree : ∀ (x : A) (hx : x.val ∈ B), (f x).val = (g ⟨x.val, hx⟩).val) : + ∃ H : S ≃ₜ T, (∀ x : A, H x.val = (f x).val) ∧ + ∀ x : B, H x.val = (g x).val := by + classical + have hmem : ∀ x, x ∈ A ∨ x ∈ B := by + intro x + change x ∈ A ∪ B + rw [hcover] + trivial + let F : S → T := fun x => if hx : x ∈ A then (f ⟨x, hx⟩).val + else (g ⟨x, (hmem x).resolve_left hx⟩).val + have hFA : ∀ x : A, F x.val = (f x).val := fun x => by simp only [F, dite_eq_left x.property] + have hFB : ∀ x : B, F x.val = (g x).val := by + intro x + by_cases hx : x.val ∈ A + · exact (hFA ⟨x.val, hx⟩).trans (hagree ⟨x.val, hx⟩ x.property) + · simp only [F, dite_eq_right hx] + have hFcA : ContinuousOn F A := by + apply continuousOn_iff_continuous_domRestrict.mpr + change Continuous (fun x : A => F x.val) + have heq : (fun x : A => F x.val) = fun x => (f x).val := funext hFA + rw [heq] + exact continuous_subtype_val.comp f.continuous + have hFcB : ContinuousOn F B := by + apply continuousOn_iff_continuous_domRestrict.mpr + change Continuous (fun x : B => F x.val) + have heq : (fun x : B => F x.val) = fun x => (g x).val := funext hFB + rw [heq] + exact continuous_subtype_val.comp g.continuous + have hFc : Continuous F := by + have hc := hFcA.union_of_isClosed hFcB hA hB + rw [hcover] at hc + exact continuousOn_univ.mp hc + have hinjA : ∀ (x : A) (y : S), F x.val = F y → x.val = y := by + intro x y he + by_cases hy : y ∈ A + · rw [hFA x, hFA ⟨y, hy⟩] at he + exact congrArg Subtype.val (f.injective (Subtype.ext he)) + · have hyB := (hmem y).resolve_left hy + rw [hFA x, hFB ⟨y, hyB⟩] at he + have hxB := (hcross x).mp (he ▸ (g ⟨y, hyB⟩).property) + have hg : (g ⟨x.val, hxB⟩).val = (g ⟨y, hyB⟩).val := + (hagree x hxB).symm.trans he + exact congrArg Subtype.val (g.injective (Subtype.ext hg)) + have hi : Function.Injective F := by + intro x y he + by_cases hx : x ∈ A + · exact hinjA ⟨x, hx⟩ y he + · by_cases hy : y ∈ A + · exact (hinjA ⟨y, hy⟩ x he.symm).symm + · rw [hFB ⟨x, (hmem x).resolve_left hx⟩, hFB ⟨y, (hmem y).resolve_left hy⟩] at he + exact congrArg Subtype.val (g.injective (Subtype.ext he)) + have hs : Function.Surjective F := by + intro y + have hy : y ∈ A' ∪ B' := hcover'.symm ▸ mem_univ y + rcases hy with hy | hy + · refine ⟨(f.symm ⟨y, hy⟩).val, ?_⟩ + rw [hFA] + exact congrArg Subtype.val (f.apply_symm_apply ⟨y, hy⟩) + · refine ⟨(g.symm ⟨y, hy⟩).val, ?_⟩ + rw [hFB] + exact congrArg Subtype.val (g.apply_symm_apply ⟨y, hy⟩) + exact ⟨hFc.homeoOfEquivCompactToT2 (f := Equiv.ofBijective F ⟨hi, hs⟩), hFA, hFB⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3HalfPlaneCharts.lean b/LeanPool/GraphMinor/GM12/Section3HalfPlaneCharts.lean new file mode 100644 index 0000000000..508973dbe9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3HalfPlaneCharts.lean @@ -0,0 +1,59 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Cuffs + +/-! +# Reading complex half-plane charts as surface charts + +For the punctured surface of XII (3.1), page 245, the remaining local +charts are charts at the prescribed disc boundaries. Circle coordinates +are naturally written in the complex plane. A chart onto the intersection +of an open complex set with the right half-plane gives the half-space +chart required by the definition of a surface. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- A complex half-plane chart is a manifold-with-boundary chart. +The coordinate change is the fixed real-linear identification of the +complex plane with the Euclidean plane. -/ +theorem isManifoldPoint_of_complex_halfPlane_chart {X : Type*} [TopologicalSpace X] + {U : Set X} {x : X} (hU : IsOpen U) (hxU : x ∈ U) {O : Set ℂ} (hO : IsOpen O) + (e : U ≃ₜ (O ∩ halfPlane : Set ℂ)) : IsManifoldPoint x := by + let V : Set (EuclideanHalfSpace 2) := {v | complexPlane.symm v.val ∈ O} + have hV : IsOpen V := hO.preimage (complexPlane.symm.continuous.comp continuous_subtype_val) + let E : (O ∩ halfPlane : Set ℂ) ≃ₜ V := { + toFun := fun z => ⟨⟨complexPlane z.val, by + rw [complexPlane_zero] + exact z.property.2⟩, by + change complexPlane.symm (complexPlane z.val) ∈ O + rw [complexPlane.symm_apply_apply] + exact z.property.1⟩ + invFun := fun v => ⟨complexPlane.symm v.val.val, ⟨v.property, by + change 0 ≤ (complexPlane.symm v.val.val).re + rw [← complexPlane_zero, complexPlane.apply_symm_apply] + exact v.val.property⟩⟩ + left_inv := fun z => Subtype.ext (complexPlane.symm_apply_apply z.val) + right_inv := fun v => Subtype.ext (Subtype.ext (complexPlane.apply_symm_apply v.val.val)) + continuous_toFun := by + apply Continuous.subtype_mk + apply Continuous.subtype_mk + exact complexPlane.continuous.comp continuous_subtype_val + continuous_invFun := by + apply Continuous.subtype_mk + exact complexPlane.symm.continuous.comp (continuous_subtype_val.comp continuous_subtype_val) } + exact ⟨U, V, hU, hV, hxU, ⟨e.trans E⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3HomeoWalks.lean b/LeanPool/GraphMinor/GM12/Section3HomeoWalks.lean new file mode 100644 index 0000000000..cb1163b740 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3HomeoWalks.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Graph walks under homeomorphisms of drawings + +In the reduction of XII (3.1), page 245, VII supplies a forest up to +homoplasty. Its boundary-fixing homeomorphism preserves connectivity. +Map every edge and vertex of a walk through the homeomorphism. Mapping +back by the inverse gives the converse, so the boundary connection +classes are unchanged. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM07 GM11 + +/-- The edges of the homeomorphic image are the images of the edges. -/ +theorem mapDrawingHomeo_edges {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (α : S ≃ₜ T) (H : Drawing S) : + (mapDrawingHomeo α H).E = (image α) '' H.E := by + change arcComponentsIn (α '' H.U \ α '' H.V) = (image α) '' arcComponentsIn (H.U \ H.V) + rw [← image_sdiff α.injective, arcComponentsIn_image_homeo] + +/-- A graph link maps to a link of the image drawing. -/ +theorem isLink_mapDrawingHomeo {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (α : S ≃ₜ T) (H : Drawing S) {e : Set S} {x y : S} (hl : H.toGraph.IsLink e x y) : + (mapDrawingHomeo α H).toGraph.IsLink (α '' e) (α x) (α y) := by + refine ⟨?_, ⟨x, hl.2.1, rfl⟩, ⟨y, hl.2.2.1, rfl⟩, ?_⟩ + · rw [mapDrawingHomeo_edges] + exact ⟨e, hl.1, rfl⟩ + · change closure (α '' e) ∩ α '' H.V = {α x, α y} + rw [← α.image_closure, ← Set.image_inter α.injective, hl.2.2.2, image_pair] + +/-- A walk maps to a walk of the image drawing with the image vertex +list. In particular, graph connectivity is preserved. -/ +theorem exists_walk_mapDrawingHomeo {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (α : S ≃ₜ T) (H : Drawing S) {x y : S} (W : GraphWalk H.toGraph x y) : + ∃ W' : GraphWalk (mapDrawingHomeo α H).toGraph (α x) (α y), + W'.support = W.support.map α := by + induction W with + | nil hx => + exact ⟨.nil ⟨_, hx, rfl⟩, rfl⟩ + | cons hl rest ih => + obtain ⟨R, hR⟩ := ih + exact ⟨.cons (isLink_mapDrawingHomeo α H hl) R, + congrArg (List.cons _) hR⟩ + +/-- Mapping a drawing by a homeomorphism and its inverse recovers it. -/ +theorem mapDrawingHomeo_symm {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (α : S ≃ₜ T) (H : Drawing S) : + mapDrawingHomeo α.symm (mapDrawingHomeo α H) = H := by + apply Drawing.ext_of_V_E + · change α.symm '' (α '' H.V) = H.V + rw [image_image] + simp only [α.symm_apply_apply] + exact Set.image_id _ + · rw [mapDrawingHomeo_edges, mapDrawingHomeo_edges, image_image] + have hset : ∀ E : Set S, α.symm '' (α '' E) = E := by + intro E + rw [image_image] + simp only [α.symm_apply_apply] + exact Set.image_id _ + simp only [hset] + exact Set.image_id _ + +/-- Connectivity of vertices is equivalent to connectivity of their +images under a homeomorphism of drawings. This is the homeomorphism +part of the boundary-class transfer in XII (3.1). -/ +theorem walk_mapDrawingHomeo_iff {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (α : S ≃ₜ T) (H : Drawing S) {x y : S} : + Nonempty (GraphWalk (mapDrawingHomeo α H).toGraph (α x) (α y)) ↔ + Nonempty (GraphWalk H.toGraph x y) := by + constructor + · rintro ⟨W⟩ + obtain ⟨R, _⟩ := exists_walk_mapDrawingHomeo α.symm (mapDrawingHomeo α H) W + have hR : Nonempty (GraphWalk (mapDrawingHomeo α.symm (mapDrawingHomeo α H)).toGraph + (α.symm (α x)) (α.symm (α y))) := ⟨R⟩ + rw [mapDrawingHomeo_symm, α.symm_apply_apply, α.symm_apply_apply] at hR + exact hR + · rintro ⟨W⟩ + obtain ⟨R, _⟩ := exists_walk_mapDrawingHomeo α H W + exact ⟨R⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3IntermediateRegion.lean b/LeanPool/GraphMinor/GM12/Section3IntermediateRegion.lean new file mode 100644 index 0000000000..e75d5813d0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3IntermediateRegion.lean @@ -0,0 +1,94 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM11.Section5 + +/-! +# An intermediate region between two distant regions + +For the two-disc sphere case of XII (3.2), page 247, follow the +regions from the first prescribed region to the second. XI (5.1) +supplies the step leaving the regions at distance less than the +chosen threshold. The two regions at this step share an edge and +therefore an end vertex. Their distance is at most two. The region +after this step has distance between the threshold and threshold +plus one, and the triangle inequality separates it from the other +prescribed region as well. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM14 + +/-- The intermediate region chosen in the two-disc case of XII +(3.2), page 247. -/ +theorem exists_intermediate_region + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ η : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + (hη : 1 ≤ η) {r₁ r₂ : Set S} (hr₁ : r₁ ∈ Γ.R) (hr₂ : r₂ ∈ Γ.R) + (hfar : 2 * η + 1 ≤ d r₁ r₂) : + ∃ r ∈ Γ.R, η ≤ d r₁ r ∧ d r₁ r ≤ η + 1 ∧ η ≤ d r₂ r := by + have h91 := GM11.gm15_theorem_9_1 Γ θ T d hS inferInstance hm + have hrefl := h91.2.1 + have hsym := h91.2.2.2.1 + have htri := h91.2.2.2.2.1 + have hvr := h91.2.2.2.2.2.1 + let O := Γ.span ∅ ∅ + have hOU : O.U = ∅ := by simp [O, Drawing.span_U, Drawing.spanU, Drawing.spanV] + have hOR : univ ∈ O.R := by + obtain ⟨x, _⟩ := region_nonempty hr₁ + apply (mem_R_iff O).mpr + refine ⟨x, by simp [hOU], ?_⟩ + simp only [hOU, sdiff_empty] + simp only [connectedComponentIn_univ, PreconnectedSpace.connectedComponent_eq_univ] + let Z : Set (Set S) := {r | d r₁ r < η} + have hr₁Z : r₁ ∈ Z := by + change d r₁ r₁ < η + rw [hrefl r₁ (Or.inr hr₁)] + exact hη + have hr₂Z : r₂ ∉ Z := by + change ¬ d r₁ r₂ < η + omega + obtain ⟨e, he, _, a, b, haZ, hbZ, _, _, hea, heb⟩ := + GM11.theorem_5_1_proof hS (Γ.span_isSubdrawing ∅ ∅) hOR hr₁ hr₁Z hr₂ hr₂Z + (subset_univ _) (subset_univ _) + obtain ⟨v, hvV, hve⟩ : ∃ v ∈ Γ.V, v ∈ closure e := by + rcases Γ.edge_cond e he with ⟨v, w, _, hcap, _⟩ | ⟨v, hcap, _⟩ + · have hv : v ∈ closure e ∩ Γ.V := hcap.symm.subset (by simp) + exact ⟨v, hv.2, hv.1⟩ + · have hv : v ∈ closure e ∩ Γ.V := hcap.symm.subset (by simp) + exact ⟨v, hv.2, hv.1⟩ + have hva : v ∈ closure a := (closure_minimal (edge_subset_closure_of_incident hS hea.1 hea.2.1 + hea.2.2) + isClosed_closure) hve + have hvb : v ∈ closure b := (closure_minimal (edge_subset_closure_of_incident hS heb.1 heb.2.1 + heb.2.2) + isClosed_closure) hve + have hvA : ({v} : Set S) ∈ Γ.A := Or.inl (Or.inl ⟨v, hvV, rfl⟩) + have hstep : d a b ≤ 2 := by + have h := htri a (Or.inr hea.2.1) {v} hvA b (Or.inr heb.2.1) + rw [hsym a (Or.inr hea.2.1) {v} hvA] at h + exact h.trans (Nat.add_le_add (hvr ⟨e, he⟩ v hvV a hea.2.1 hva) + (hvr ⟨e, he⟩ v hvV b heb.2.1 hvb)) + have hab := htri r₁ (Or.inr hr₁) a (Or.inr hea.2.1) b (Or.inr heb.2.1) + have hbr : η ≤ d r₁ b := Nat.le_of_not_gt hbZ + have har : d r₁ a < η := haZ + have hupper : d r₁ b ≤ η + 1 := by omega + have hback := htri r₁ (Or.inr hr₁) b (Or.inr heb.2.1) r₂ (Or.inr hr₂) + rw [hsym b (Or.inr heb.2.1) r₂ (Or.inr hr₂)] at hback + exact ⟨b, heb.2.1, hbr, hupper, by omega⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3InternalRegionCurve.lean b/LeanPool/GraphMinor/GM12/Section3InternalRegionCurve.lean new file mode 100644 index 0000000000..2645456983 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3InternalRegionCurve.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.Defs +import LeanPool.GraphMinor.GM06.RegionCurve +import LeanPool.GraphMinor.GM06.RegionLocal +import LeanPool.GraphMinor.GM12.Section3DiscInteriorPush +import LeanPool.GraphMinor.Surface.InvarianceOfDomain + +/-! +# Region curves which avoid the disc boundary internally + +For the VI chain reduction in XII (3.2), pages 247--248, begin +with the region curve provided by VI's region-access construction. +Use closed-unit-disc coordinates and push the curve radially inward +by a continuous amount controlled by the distance to the complement +of the region. The amount vanishes at both endpoints. Thus the ends +stay fixed, while every other point stays in the region and avoids +the surface boundary. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM06 + +/-- A region of a proper disc drawing has curves between its closure +points whose internal points avoid the disc boundary. This is used +to turn VI chains into the normal chords in XII (3.2). -/ +theorem exists_internal_region_curve + {S : Type*} [TopologicalSpace S] (G : Drawing S) + (hDisc : IsClosedDiscSpace S) (hProper : G.IsProper) + (r : Set S) (hr : r ∈ G.R) (p : S) (hp : p ∈ closure r) + (q : S) (hq : q ∈ closure r) : + ∃ γ : C(unitInterval, S), γ 0 = p ∧ γ 1 = q ∧ + ∀ t : unitInterval, 0 < t.val → t.val < 1 → γ t ∈ r ∧ γ t ∉ bd S := by + obtain ⟨γ, hγ0, hγ1, hγr⟩ := GM06.exists_region_curve G hDisc hProper r hr p hp q hq + obtain ⟨e⟩ := hDisc + have hopen : IsOpen (e ⁻¹' r) := (GM06.isOpen_region ⟨e⟩ G hr).preimage e.continuous + obtain ⟨O, hO, hOeq⟩ := isOpen_induced_iff.mp hopen + let f : C(unitInterval, ClosedUnitDisc) := ⟨e.symm ∘ γ, e.symm.continuous.comp γ.continuous⟩ + have hfO : ∀ t : unitInterval, 0 < t.val → t.val < 1 → (f t).val ∈ O := by + intro t ht0 ht1 + change f t ∈ (Subtype.val : ClosedUnitDisc → EuclideanPlane) ⁻¹' O + rw [hOeq] + change e (e.symm (γ t)) ∈ r + rw [e.apply_symm_apply] + exact hγr t ⟨ht0, ht1⟩ + obtain ⟨g, hg0, hg1, hg⟩ := exists_interior_disc_curve hO f hfO + let ψ : C(unitInterval, S) := ⟨e ∘ g, e.continuous.comp g.continuous⟩ + have hψ0 : ψ 0 = p := by + change e (g 0) = p + rw [hg0] + change e (e.symm (γ 0)) = p + rw [e.apply_symm_apply, hγ0] + have hψ1 : ψ 1 = q := by + change e (g 1) = q + rw [hg1] + change e (e.symm (γ 1)) = q + rw [e.apply_symm_apply, hγ1] + refine ⟨ψ, hψ0, hψ1, ?_⟩ + intro t ht0 ht1 + obtain ⟨hgtO, hgtN⟩ := hg t ht0 ht1 + have hψr : ψ t ∈ r := by + change g t ∈ e ⁻¹' r + rw [← hOeq] + exact hgtO + refine ⟨hψr, ?_⟩ + intro hψbd + have hbd := image_bd_homeomorph e + rw [bd_closedUnitDisc] at hbd + rw [← hbd] at hψbd + obtain ⟨z, hz, hze⟩ := hψbd + have hzg : z = g t := e.injective hze + have hnorm : ‖(g t).val‖ = 1 := by + rw [← hzg] + have hz' : z.val ∈ UnitCircle := hz + exact mem_sphere_zero_iff_norm.mp hz' + exact hgtN.ne hnorm + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3JoinedCircleCondition.lean b/LeanPool/GraphMinor/GM12/Section3JoinedCircleCondition.lean new file mode 100644 index 0000000000..662036eaa7 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3JoinedCircleCondition.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SelectedSmallDisc +import LeanPool.GraphMinor.GM12.Section3JoinedCircleLoops +import LeanPool.GraphMinor.GM11.OArcCircuit + +/-! +# The joined-circle condition in XII (3.2) + +For condition (3.1)(ii), traverse the two circles and the line +joining them, using the line in both directions. If their union +has at most N drawing vertices, the curve has length at most 2N. +Claim (1) then forces the enclosed prescribed discs to agree, +contradicting disjointness of the two enclosing discs. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM14 + +/-- Condition (3.1)(ii) in the proof of XII (3.2), page 246. -/ +theorem joined_circle_vertex_count_gt + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ η : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + (hη : η ≤ θ) (Δ r : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) (hr : ∀ i, r i ∈ Γ.R) + (hrΔ : ∀ i, (r i ∩ Δ i).Nonempty) + (hsep : ∀ i j, i ≠ j → η ≤ tangleMetric Γ K ins θ (r i) (r j)) + {N : ℕ} (hN : 2 * N < η) {A B P D E : Set S} {u v : S} + (hn : Γ.IsNormal (A ∪ B ∪ P)) (hA : IsOArc A) (hB : IsOArc B) + (hP : IsLineWithEnds P u v) (hu : u ∈ A) (hv : v ∈ B) + (hPA : P ∩ A = {u}) (hPB : P ∩ B = {v}) + (hstar : A ∪ B ∪ P ⊆ discComplement Δ) (hD : IsClosedDisc D) (hE : IsClosedDisc E) + (hbD : discBd D = A) (hbE : discBd E = B) (hdis : Disjoint D E) + (hi : ∃ i, ∀ l, Δ l ⊆ D ↔ l = i) (hj : ∃ j, ∀ l, Δ l ⊆ E ↔ l = j) : + N < (Γ.V ∩ (A ∪ B ∪ P)).ncard := by + by_contra hlarge + have hsmall := Nat.le_of_not_gt hlarge + have hNη : N < η := (Nat.le_mul_of_pos_left N (by decide : 0 < 2)).trans_lt hN + have hAfin : (Γ.V ∩ (A ∪ B ∪ P)).Finite := Γ.finite_V.inter_of_left _ + have hAlen : (Γ.V ∩ A).ncard < η := + (Set.ncard_le_ncard (inter_subset_inter_right Γ.V (subset_union_left.trans subset_union_left)) + hAfin).trans_lt + (hsmall.trans_lt hNη) + have hBlen : (Γ.V ∩ B).ncard < η := + (Set.ncard_le_ncard (inter_subset_inter_right Γ.V (subset_union_right.trans subset_union_left)) + hAfin).trans_lt + (hsmall.trans_lt hNη) + obtain ⟨i, hi⟩ := hi + obtain ⟨j, hj⟩ := hj + have honeD : ∀ k l, Δ k ⊆ D → Δ l ⊆ D → k = l := by + intro k l hk hl + exact (hi k).mp hk |>.trans ((hi l).mp hl).symm + have honeE : ∀ k l, Δ k ⊆ E → Δ l ⊆ E → k = l := by + intro k l hk hl + exact (hj k).mp hk |>.trans ((hj l).mp hl).symm + have hmD := small_disc_is_selected_of_at_most_one_prescribed_disc hS hT hrespect hK hd + hη Δ r hΔ hcase hr hrΔ hsep hA (fun _ hx => hn ⟨Or.inl (Or.inl hx.1), hx.2⟩) hAlen + (subset_union_left.trans (subset_union_left.trans hstar)) hD hbD honeD + have hmE := small_disc_is_selected_of_at_most_one_prescribed_disc hS hT hrespect hK hd + hη Δ r hΔ hcase hr hrΔ hsep hB (fun _ hx => hn ⟨Or.inl (Or.inr hx.1), hx.2⟩) hBlen + (subset_union_right.trans (subset_union_left.trans hstar)) hE hbE honeE + have hAB : Disjoint A B := hdis.mono (hbD ▸ Surface.discBd_subset D) + (hbE ▸ Surface.discBd_subset E) + obtain ⟨φ, hφ, hrange, hlen⟩ := exists_short_curve_covering_joined_circles hA hB hP + hAB hu hv hPA hPB hn + have hlenη : curveLength Γ φ < η := + hlen.trans_lt ((Nat.mul_le_mul_left 2 hsmall).trans_lt hN) + have hsubD : subBd D = A := (subBd_eq_frontier D).trans + ((IsClosedDisc.frontier_eq_discBd hS hD).trans hbD) + have hsubE : subBd E = B := (subBd_eq_frontier E).trans + ((IsClosedDisc.frontier_eq_discBd hS hE).trans hbE) + have hij := short_curve_enclosing_discs_indices_eq hS hT hrespect hK hd hη Δ r hr hrΔ hsep + hφ hlenη hA hB (subset_union_left.trans (subset_union_left.trans hrange.symm.subset)) + (subset_union_right.trans (subset_union_left.trans hrange.symm.subset)) hD hE hsubD hsubE hmD + hmE + ((hi i).mpr rfl) ((hj j).mpr rfl) + obtain ⟨x, _, hx⟩ := hrΔ i + exact Set.disjoint_left.mp hdis ((hi i).mpr rfl hx) ((hj i).mpr hij hx) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3JoinedCircleLoops.lean b/LeanPool/GraphMinor/GM12/Section3JoinedCircleLoops.lean new file mode 100644 index 0000000000..cdae33176c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3JoinedCircleLoops.lean @@ -0,0 +1,127 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CircleLoops +import Mathlib.Tactic.FinCases + +/-! +# A short curve through two circles joined by a line + +The construction for XII (3.1)(ii), used on page 246 in (3.2), +traverses the first circle, the joining line, the second circle, +and the joining line backwards. Each image point is visited at +most twice. At the first joining point the first circle receives +the second visit label, since the forward joining line starts there. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM07 + +/-- The short normal curve used for condition (3.1)(ii) in the +proof of XII (3.2), page 246. -/ +theorem exists_short_curve_covering_joined_circles + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} {A B P : Set S} {u v : S} + (hA : IsOArc A) (hB : IsOArc B) (hP : IsLineWithEnds P u v) + (hAB : Disjoint A B) (hu : u ∈ A) (hv : v ∈ B) + (hPA : P ∩ A = {u}) (hPB : P ∩ B = {v}) + (hn : Γ.IsNormal (A ∪ B ∪ P)) : + ∃ φ : C(Circle, S), IsNormalCurve Γ φ ∧ range φ = A ∪ B ∪ P ∧ + curveLength Γ φ ≤ 2 * (Γ.V ∩ (A ∪ B ∪ P)).ncard := by + classical + obtain ⟨α, hα0, hα1, hαr, hαi⟩ := exists_circle_loop_based_at hA hu + obtain ⟨β, hβ0, hβ1, hβr, hβi⟩ := exists_circle_loop_based_at hB hv + obtain ⟨H, hH0, hH1⟩ := hP + let q : C(unitInterval, S) := ⟨fun t => (H t).val, by fun_prop⟩ + let q' : C(unitInterval, S) := ⟨fun t => q (unitInterval.symm t), by fun_prop⟩ + have hq0 : q 0 = u := hH0 + have hq1 : q 1 = v := hH1 + have hqi : Function.Injective q := fun s t h => H.injective (Subtype.ext h) + have hqr : range q = P := by + ext x + exact ⟨fun ⟨t, ht⟩ => ht ▸ (H t).property, + fun hx => ⟨H.symm ⟨x, hx⟩, congrArg Subtype.val (H.apply_symm_apply _)⟩⟩ + have haq : ∀ s t : unitInterval, s.val < 1 → α s = q t → s = 0 ∧ t = 0 := by + intro s t hs heq + have hp : q t = u := hPA.subset ⟨hqr.subset (mem_range_self t), + heq ▸ hαr.subset (mem_range_self s)⟩ + exact ⟨hαi ⟨s.property.1, hs⟩ (by simp) (heq.trans (hp.trans hα0.symm)), + hqi (hp.trans hq0.symm)⟩ + have hbq : ∀ s t : unitInterval, s.val < 1 → β s = q t → s = 0 ∧ t = 1 := by + intro s t hs heq + have hp : q t = v := hPB.subset ⟨hqr.subset (mem_range_self t), + heq ▸ hβr.subset (mem_range_self s)⟩ + exact ⟨hβi ⟨s.property.1, hs⟩ (by simp) (heq.trans (hp.trans hβ0.symm)), + hqi (hp.trans hq1.symm)⟩ + have hab : ∀ s t : unitInterval, α s ≠ β t := by + intro s t heq + exact Set.disjoint_left.mp hAB (hαr.subset (mem_range_self s)) + (heq.symm ▸ hβr.subset (mem_range_self t)) + let γ : Fin 4 → C(unitInterval, S) := ![α, q, β, q'] + let L : Fin 4 → unitInterval → Fin 2 := fun i t => + if i = 0 then (if t = 0 then 1 else 0) else if i = 3 then 1 else 0 + have hmatch : ∀ i, γ i 1 = γ (finNext (by decide : 0 < 4) i) 0 := by + intro i + fin_cases i <;> simp [γ, q', finNext, hα0, hα1, hβ0, hβ1, hq0, hq1] + have hsep : ∀ (i j : Fin 4) (s t : unitInterval), s.val < 1 → t.val < 1 → + γ i s = γ j t → L i s = L j t → i = j ∧ s = t := by + intro i j s t hs ht heq hl + have hs1 : s ≠ 1 := fun h => by subst s; exact (lt_irrefl (1 : ℝ)) hs + have ht1 : t ≠ 1 := fun h => by subst t; exact (lt_irrefl (1 : ℝ)) ht + fin_cases i <;> fin_cases j + · exact ⟨rfl, hαi ⟨s.property.1, hs⟩ ⟨t.property.1, ht⟩ heq⟩ + · obtain ⟨rfl, rfl⟩ := haq s t hs heq + simp [L] at hl + · exact False.elim (hab s t heq) + · have h := (haq s (unitInterval.symm t) hs heq).2 + have ht0 := congrArg unitInterval.symm h + simp only [unitInterval.symm_symm, unitInterval.symm_zero] at ht0 + exact False.elim (ht1 ht0) + · obtain ⟨rfl, rfl⟩ := haq t s ht heq.symm + simp [L] at hl + · exact ⟨rfl, hqi heq⟩ + · exact False.elim (hs1 (hbq t s ht heq.symm).2) + · simp [L] at hl + · exact False.elim (hab t s heq.symm) + · exact False.elim (ht1 (hbq s t hs heq).2) + · exact ⟨rfl, hβi ⟨s.property.1, hs⟩ ⟨t.property.1, ht⟩ heq⟩ + · simp [L] at hl + · have h := (haq t (unitInterval.symm s) ht heq.symm).2 + have hs0 := congrArg unitInterval.symm h + simp only [unitInterval.symm_symm, unitInterval.symm_zero] at hs0 + exact False.elim (hs1 hs0) + · simp [L] at hl + · simp [L] at hl + · refine ⟨rfl, ?_⟩ + have h := congrArg unitInterval.symm (hqi heq) + simpa only [unitInterval.symm_symm] using h + have hγX : ∀ i, range (γ i) ⊆ A ∪ B ∪ P := by + intro i + fin_cases i + · exact hαr.subset.trans (subset_union_left.trans subset_union_left) + · exact hqr.subset.trans subset_union_right + · exact hβr.subset.trans (subset_union_right.trans subset_union_left) + · intro x hx + obtain ⟨t, rfl⟩ := hx + exact Or.inr (hqr.subset (mem_range_self (unitInterval.symm t))) + obtain ⟨hφ, hlen⟩ := concatLoop_length_le_of_piece_labels hn (by decide : 0 < 4) γ hmatch hγX L + hsep + have hrange : range (concatLoop (by decide : 0 < 4) γ hmatch) = A ∪ B ∪ P := by + rw [range_concatLoop] + apply Subset.antisymm (iUnion_subset hγX) + rintro x ((hx | hx) | hx) + · exact mem_iUnion.mpr ⟨0, hαr.symm.subset hx⟩ + · exact mem_iUnion.mpr ⟨2, hβr.symm.subset hx⟩ + · exact mem_iUnion.mpr ⟨1, hqr.symm.subset hx⟩ + exact ⟨_, hφ, hrange, by simpa only [inter_comm] using hlen⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3JoiningCircles.lean b/LeanPool/GraphMinor/GM12/Section3JoiningCircles.lean new file mode 100644 index 0000000000..dd0d312a1a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3JoiningCircles.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SolidConnections +import LeanPool.GraphMinor.GM12.Section2ChordGap +import LeanPool.GraphMinor.Surface.DiscMerge +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# A joining line between disjoint circles + +In the Section 8 argument of VII used in XII (3.1), page 245, two +disjoint circles in the connected solid set can be joined by a line. +Take the first hit of the second circle and the last preceding hit +of the first. The resulting subline meets either circle only at its +corresponding endpoint, giving the first two-loop shape. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Two disjoint circles in an arc-connected set have a joining line +whose only contacts with them are its two ends. -/ +theorem exists_joining_line_between_disjoint_circles + {S : Type*} [TopologicalSpace S] [T2Space S] {X A B : Set S} + (hX : IsArcConnected X) (hA : IsOArc A) (hB : IsOArc B) + (hAX : A ⊆ X) (hBX : B ⊆ X) (hdis : Disjoint A B) : + ∃ (P : Set S) (a b : S), IsLineWithEnds P a b ∧ P ⊆ X ∧ a ∈ A ∧ b ∈ B ∧ + a ≠ b ∧ P ∩ A = {a} ∧ P ∩ B = {b} := by + have hAc : IsClosed A := hA.isCompact.isClosed + have hBc : IsClosed B := hB.isCompact.isClosed + obtain ⟨φA⟩ := hA + obtain ⟨φB⟩ := hB + let a₀ := (φA 1).val + let b₀ := (φB 1).val + have ha₀ : a₀ ∈ A := (φA 1).property + have hb₀ : b₀ ∈ B := (φB 1).property + have hab₀ : a₀ ≠ b₀ := fun he => Set.disjoint_left.mp hdis ha₀ (he.symm ▸ hb₀) + obtain ⟨L, hLX, φ, hφ0, hφ1⟩ := hX a₀ (hAX ha₀) b₀ (hBX hb₀) hab₀ + let g : unitInterval → S := fun t => (φ t).val + have hgc : Continuous g := continuous_subtype_val.comp φ.continuous + have hgi : Function.Injective g := fun t s he => φ.injective (Subtype.ext he) + have hgX : range g ⊆ X := by + rintro x ⟨t, rfl⟩ + exact hLX (φ t).property + have h0 : g 0 ∈ A := by change (φ 0).val ∈ A; rw [hφ0]; exact ha₀ + have h1 : g 1 ∈ B := by change (φ 1).val ∈ B; rw [hφ1]; exact hb₀ + obtain ⟨P, a, b, hP, hPX, ha, hb, hab, hgap⟩ := exists_minimal_region_chord hgc hgi hgX + (F := A ∪ B) inter_subset_left (hAc.preimage hgc) + (hBc.preimage hgc) hdis h0 h1 + refine ⟨P, a, b, hP, hPX, ha, hb, hab, ?_, ?_⟩ + · apply Subset.antisymm + · rintro x ⟨hxP, hxA⟩ + by_cases hxa : x = a + · exact hxa + · have hxb : x ≠ b := by + intro he + exact Set.disjoint_left.mp hdis hxA (he.symm ▸ hb) + exact False.elim (Set.disjoint_left.mp hgap ⟨hxP, fun hx => hx.elim hxa hxb⟩ (Or.inl hxA)) + · intro x hx + have hxa : x = a := hx + rw [hxa] + exact ⟨hP.left_mem, ha⟩ + · apply Subset.antisymm + · rintro x ⟨hxP, hxB⟩ + by_cases hxb : x = b + · exact hxb + · have hxa : x ≠ a := by + intro he + exact Set.disjoint_left.mp hdis (he.symm ▸ ha) hxB + exact False.elim (Set.disjoint_left.mp hgap ⟨hxP, fun hx => hx.elim hxa hxb⟩ (Or.inr hxB)) + · intro x hx + have hxb : x = b := hx + rw [hxb] + exact ⟨hP.right_mem, hb⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3LocalReroute.lean b/LeanPool/GraphMinor/GM12/Section3LocalReroute.lean new file mode 100644 index 0000000000..ba8318676d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3LocalReroute.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +public import Mathlib.Topology.Subpath +import LeanPool.GraphMinor.GM12.Section3SolidConnections +import LeanPool.GraphMinor.GM12.Section2PathHomotopy +import Mathlib.Topology.Order.Compact + +/-! +# A local rerouting that preserves homotopy + +The circle-intersection step of the Section 8 argument used by XII +(3.1), page 245, needs a finite graph inside the original solid set. +On a short path piece, take its first and last contacts with a closed +set whose part in the patch is arc-connected. Replace the portion +between those contacts by a path in that set. Both paths stay in a +simply connected patch, so the replacement preserves the homotopy. +The two retained outer portions have no other contacts with the set. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Reroute between the first and last contacts with a closed set +inside one simply connected patch. The joining path stays in the set, +the homotopy stays in the patch, and the retained outer portions have +no other contacts. -/ +theorem exists_homotopic_local_reroute + {S : Type*} [TopologicalSpace S] {F U V : Set S} + (hF : IsClosed F) (hV : IsSimplyConnectedSet V) (hUV : U ⊆ V) + (hFU : IsArcConnected (F ∩ U)) {a b : S} (p : Path a b) + (hpU : range p ⊆ U) (hmeet : (p ⁻¹' F).Nonempty) : + ∃ (s t : unitInterval) (m : Path (p s) (p t)), + s ≤ t ∧ p s ∈ F ∧ p t ∈ F ∧ range m ⊆ F ∩ U ∧ + (p.subpath 0 1).Homotopic ((p.subpath 0 s).trans (m.trans (p.subpath t 1))) ∧ + (∀ r, r < s → p r ∉ F) ∧ (∀ r, t < r → p r ∉ F) := by + have hK : IsCompact (p ⁻¹' F) := (hF.preimage p.continuous).isCompact + obtain ⟨s, hs⟩ := hK.exists_isLeast hmeet + obtain ⟨t, ht⟩ := hK.exists_isGreatest hmeet + have hsF : p s ∈ F := hs.1 + have htF : p t ∈ F := ht.1 + have hsU : p s ∈ U := hpU (mem_range_self s) + have htU : p t ∈ U := hpU (mem_range_self t) + have hpath : IsPathConnected (F ∩ U) := + isPathConnected_of_isArcConnected hFU ⟨p s, hsF, hsU⟩ + obtain ⟨m, hm⟩ := hpath.joinedIn (p s) ⟨hsF, hsU⟩ (p t) ⟨htF, htU⟩ + have hmrange : range m ⊆ F ∩ U := by rintro x ⟨r, rfl⟩; exact hm r + have hsub : ∀ r r', range (p.subpath r r') ⊆ V := by + intro r r' + rw [Path.range_subpath] + exact (image_subset_range _ _).trans (hpU.trans hUV) + have hmr : range m ⊆ V := (hmrange.trans inter_subset_right).trans hUV + have hqr : range ((p.subpath 0 s).trans (m.trans (p.subpath t 1))) ⊆ V := by + rw [Path.trans_range, Path.trans_range] + exact union_subset (hsub 0 s) (union_subset hmr (hsub t 1)) + refine ⟨s, t, m, hs.2 ht.1, hsF, htF, hmrange, + paths_homotopic_of_range_in_simplyConnected hV _ _ + (fun r => hsub 0 1 (mem_range_self r)) (fun r => hqr (mem_range_self r)), ?_, ?_⟩ + · intro r hrs hrF + exact (not_le_of_gt hrs) (hs.2 hrF) + · intro r htr hrF + exact (not_le_of_gt htr) (ht.2 hrF) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3LoopCuffClassification.lean b/LeanPool/GraphMinor/GM12/Section3LoopCuffClassification.lean new file mode 100644 index 0000000000..fd4a471a29 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3LoopCuffClassification.lean @@ -0,0 +1,86 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3TwoCircleCuffs +public import LeanPool.GraphMinor.GM12.Section3BarbellCircles +public import LeanPool.GraphMinor.GM12.Section3MeetingLoopSchismatic +import LeanPool.GraphMinor.GM12.Section3SchismaticCandidate +import LeanPool.GraphMinor.GM11.PaintingFacts + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Surrounding cuffs for the two-loop schismatic shapes + +VII Section 8, page 241, used by XII (3.1), page 245, asserts that +the two circles in its first two schismatic shapes surround distinct +cuffs. For disjoint loops the other loop proves each is proper. For +loops meeting once, each loop has a point other than their common +vertex, so each is again proper. The proved circle classifications +then reduce both shapes to the common two-circle cuff argument. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +universe u + +/-- The two loops of a schismatic barbell surround distinct cuffs, +as asserted in VII Section 8, page 241. -/ +theorem surrounding_cuffs_of_schismatic_x1 + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsSurface S) (hcuffs : (cuffs S).Nonempty) + {F A P : Set S} {a b : S} + (hF : IsOArc F) (hA : IsOArc A) (hdis : Disjoint F A) + (hP : IsLineWithEnds P a b) (ha : a ∈ F) (hb : b ∈ A) + (hPF : P ∩ F = {a}) (hPA : P ∩ A = {b}) + (hX : GM07.IsSchismatic (F ∪ A ∪ P)) : + ∃ C D : Set S, GM07.SurroundsCuff F C ∧ GM07.SurroundsCuff A D ∧ C ≠ D := by + let := hS.1 + have hFX : F ⊂ F ∪ A ∪ P := by + refine ⟨subset_union_left.trans subset_union_left, ?_⟩ + intro hsub + exact Set.disjoint_left.mp hdis (hsub (Or.inl (Or.inr hb))) hb + have hAX : A ⊂ F ∪ A ∪ P := by + refine ⟨subset_union_right.trans subset_union_left, ?_⟩ + intro hsub + exact Set.disjoint_left.mp hdis ha (hsub (Or.inl (Or.inl ha))) + exact surrounding_cuffs_of_two_circle_cover hS hcuffs + (solid_connected_of_schismatic hX).1 hF hA hFX hAX + (fun Z hZ hZX => oArc_subset_disjoint_circle_or hF hA hdis hP ha hb hPF hPA hZ hZX) hX + +/-- The two loops of a schismatic one-vertex two-loop shape surround +distinct cuffs, as asserted in VII Section 8, page 241. -/ +theorem surrounding_cuffs_of_schismatic_x2 + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsSurface S) (hcuffs : (cuffs S).Nonempty) + {F A : Set S} {a : S} (hF : IsOArc F) (hA : IsOArc A) (hcap : F ∩ A = {a}) + (hX : GM07.IsSchismatic (F ∪ A)) : + ∃ C D : Set S, GM07.SurroundsCuff F C ∧ GM07.SurroundsCuff A D ∧ C ≠ D := by + let := hS.1 + obtain ⟨x, hxA, hxa⟩ := (infinite_of_isOArc hA).exists_notMem_finite (finite_singleton a) + obtain ⟨y, hyF, hya⟩ := (infinite_of_isOArc hF).exists_notMem_finite (finite_singleton a) + have hFX : F ⊂ F ∪ A := by + refine ⟨subset_union_left, ?_⟩ + intro hsub + exact hxa (hcap ▸ (show x ∈ F ∩ A from ⟨hsub (Or.inr hxA), hxA⟩)) + have hAX : A ⊂ F ∪ A := by + refine ⟨subset_union_right, ?_⟩ + intro hsub + exact hya (hcap ▸ (show y ∈ F ∩ A from ⟨hyF, hsub (Or.inl hyF)⟩)) + exact surrounding_cuffs_of_two_circle_cover hS hcuffs + (solid_connected_of_schismatic hX).1 hF hA hFX hAX + (fun Z hZ hZX => oArc_subset_meeting_circle_or hF hA hcap hZ hZX) hX + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3LoopSchismaticCount.lean b/LeanPool/GraphMinor/GM12/Section3LoopSchismaticCount.lean new file mode 100644 index 0000000000..cda1781f6d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3LoopSchismaticCount.lean @@ -0,0 +1,109 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3TwoLoopCount +public import LeanPool.GraphMinor.GM12.Section3MeetingLoopCount +public import LeanPool.GraphMinor.GM12.Section3LoopCuffClassification +import LeanPool.GraphMinor.GM12.Section3PuncturedCuffs +import LeanPool.GraphMinor.GM12.Section3PuncturedSurface + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Vertex bounds for the schismatic two-loop shapes + +Conditions (ii) and (iii) of XII (3.1), page 245, apply to the two-loop +schismatic shapes. Their distinguished loops surround distinct cuffs +by the proved Section 8 classification. Read these cuffs as prescribed +disc boundaries, then use the enclosing-disc vertex bounds. The cuff +labels are obtained by proof rather than supplied as extra hypotheses. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +universe u + +/-- Condition (ii) of XII (3.1) bounds every normal schismatic first two-loop shape. -/ +theorem two_loop_vertex_count_gt_of_schismatic + {S : Type u} {ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + [Nonempty ι] + (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) (hUC : Γ.U ⊆ discComplement Δ) + (N : ℕ) + (hbound : ∀ (A B P D E : Set S) (u v : S), + Γ.IsNormal (A ∪ B ∪ P) → IsOArc A → IsOArc B → IsLineWithEnds P u v → + u ∈ A → v ∈ B → P ∩ A = {u} → P ∩ B = {v} → + A ∪ B ∪ P ⊆ discComplement Δ → IsClosedDisc D → IsClosedDisc E → + discBd D = A → discBd E = B → Disjoint D E → + (∃ i, ∀ l, Δ l ⊆ D ↔ l = i) → (∃ j, ∀ l, Δ l ⊆ E ↔ l = j) → + N < (Γ.V ∩ (A ∪ B ∪ P)).ncard) + {F₁ F₂ P : Set (discComplement Δ)} {u v : discComplement Δ} + (hF₁ : IsOArc F₁) (hF₂ : IsOArc F₂) (hFF : Disjoint F₁ F₂) + (hP : IsLineWithEnds P u v) (hu : u ∈ F₁) (hv : v ∈ F₂) + (hP₁ : P ∩ F₁ = {u}) (hP₂ : P ∩ F₂ = {v}) + (hX : GM07.IsSchismatic (F₁ ∪ F₂ ∪ P)) + (hn : (drawingInSubspace Γ (discComplement Δ) hUC).IsNormal (F₁ ∪ F₂ ∪ P)) : + N < ((drawingInSubspace Γ (discComplement Δ) hUC).V ∩ (F₁ ∪ F₂ ∪ P)).ncard := by + let : ConnectedSpace (discComplement Δ) := + Subtype.connectedSpace (discComplement_isConnected hS Δ hΔ hdisj) + obtain ⟨C, D, hs₁, hs₂, hCD⟩ := surrounding_cuffs_of_schismatic_x1 + (discComplement_isSurface hS Δ hΔ hdisj) (discComplement_cuffs_nonempty hS Δ hΔ hdisj) + hF₁ hF₂ hFF hP hu hv hP₁ hP₂ hX + have hc := hs₁.1 + have hd := hs₂.1 + rw [discComplement_cuffs_eq hS Δ hΔ hdisj] at hc hd + obtain ⟨i, rfl⟩ := hc + obtain ⟨j, rfl⟩ := hd + have hij : i ≠ j := fun he => hCD (congrArg (fun l => Subtype.val ⁻¹' discBd (Δ l)) he) + exact two_loop_vertex_count_gt hS Γ Δ hΔ hdisj hcase hUC N hbound hij + hF₁ hF₂ hFF hP hu hv hP₁ hP₂ hs₁ hs₂ hn + +/-- Condition (iii) of XII (3.1) bounds every normal schismatic meeting-loop shape. -/ +theorem meeting_loop_vertex_count_gt_of_schismatic + {S : Type u} {ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + [Nonempty ι] + (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) (hUC : Γ.U ⊆ discComplement Δ) + (N : ℕ) + (hbound : ∀ A B D E : Set S, + Γ.IsNormal (A ∪ B) → IsOArc A → IsOArc B → A ∪ B ⊆ discComplement Δ → + IsClosedDisc D → IsClosedDisc E → discBd D = A → discBd E = B → + (D ∩ E).ncard = 1 → + (∃ i, ∀ l, Δ l ⊆ D ↔ l = i) → (∃ j, ∀ l, Δ l ⊆ E ↔ l = j) → + N < (Γ.V ∩ (A ∪ B)).ncard) + {F₁ F₂ : Set (discComplement Δ)} {u : discComplement Δ} + (hF₁ : IsOArc F₁) (hF₂ : IsOArc F₂) (hcap : F₁ ∩ F₂ = {u}) + (hX : GM07.IsSchismatic (F₁ ∪ F₂)) + (hn : (drawingInSubspace Γ (discComplement Δ) hUC).IsNormal (F₁ ∪ F₂)) : + N < ((drawingInSubspace Γ (discComplement Δ) hUC).V ∩ (F₁ ∪ F₂)).ncard := by + let : ConnectedSpace (discComplement Δ) := + Subtype.connectedSpace (discComplement_isConnected hS Δ hΔ hdisj) + obtain ⟨C, D, hs₁, hs₂, hCD⟩ := surrounding_cuffs_of_schismatic_x2 + (discComplement_isSurface hS Δ hΔ hdisj) (discComplement_cuffs_nonempty hS Δ hΔ hdisj) + hF₁ hF₂ hcap hX + have hc := hs₁.1 + have hd := hs₂.1 + rw [discComplement_cuffs_eq hS Δ hΔ hdisj] at hc hd + obtain ⟨i, rfl⟩ := hc + obtain ⟨j, rfl⟩ := hd + have hij : i ≠ j := fun he => hCD (congrArg (fun l => Subtype.val ⁻¹' discBd (Δ l)) he) + exact meeting_loop_vertex_count_gt hS Γ Δ hΔ hdisj hcase hUC N hbound hij + hF₁ hF₂ hcap hs₁ hs₂ hn + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ManifoldPatch.lean b/LeanPool/GraphMinor/GM12/Section3ManifoldPatch.lean new file mode 100644 index 0000000000..6e4d59aa81 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ManifoldPatch.lean @@ -0,0 +1,65 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.GM12.Section3ConvexPatch + +/-! +# Simply connected patches at manifold points + +The homotopy-preserving circle rerouting used in the Section 8 argument +for XII (3.1), page 245, needs small simply connected patches. Restrict +a half-plane chart to a ball about the chosen point. The intersection +of the ball and half-plane is convex. Mapping it back gives an open +simply connected neighbourhood, including at boundary points. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric Surface + +/-- Every manifold point, including a boundary point, has an open +simply connected neighbourhood obtained from a convex half-plane patch. -/ +theorem exists_simplyConnected_patch_of_isManifoldPoint + {S : Type*} [TopologicalSpace S] {x : S} (hx : IsManifoldPoint x) : + ∃ V : Set S, IsOpen V ∧ x ∈ V ∧ IsSimplyConnectedSet V := by + obtain ⟨U, O, j, k, hU, hO, hxU, hj, hk, hm, hk', hl, hr⟩ := hx.exists_chart + let z := j x + have hz : z ∈ O ∩ halfPlane := hm hxU + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp hO z hz.1 + let A : Set ℂ := ball z δ ∩ halfPlane + have hA : A ⊆ O ∩ halfPlane := fun _ hw => ⟨hball hw.1, hw.2⟩ + have himage : k '' A ⊆ U := by + rintro y ⟨w, hw, rfl⟩ + exact hk' (hA hw) + have hhalf : Convex ℝ halfPlane := + (convex_Ici (0 : ℝ)).linear_preimage Complex.reCLM.toLinearMap + have hsimp : IsSimplyConnectedSet (k '' A) := image_convex_isSimplyConnected + (hk.mono hA) (hj.mono himage) (fun w hw => hr (hA hw)) + ((convex_ball z δ).inter hhalf) ⟨mem_ball_self hδ, hz.2⟩ + have heq : k '' A = U ∩ j ⁻¹' ball z δ := by + ext y + constructor + · rintro ⟨w, hw, rfl⟩ + refine ⟨hk' (hA hw), ?_⟩ + change j (k w) ∈ ball z δ + rw [hr (hA hw)] + exact hw.1 + · rintro ⟨hyU, hyball⟩ + exact ⟨j y, ⟨hyball, (hm hyU).2⟩, hl hyU⟩ + refine ⟨k '' A, ?_, ?_, hsimp⟩ + · rw [heq] + exact hj.isOpen_inter_preimage hU isOpen_ball + · exact ⟨z, ⟨mem_ball_self hδ, hz.2⟩, hl hxU⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3MeetingCircleCondition.lean b/LeanPool/GraphMinor/GM12/Section3MeetingCircleCondition.lean new file mode 100644 index 0000000000..3544e38be6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3MeetingCircleCondition.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SelectedSmallDisc +import LeanPool.GraphMinor.GM12.Section3CircleLoops +import LeanPool.GraphMinor.GM12.Section3MeetingDiscBoundaries +import LeanPool.GraphMinor.GM11.OArcCircuit + +/-! +# The meeting-circle condition in XII (3.2) + +For condition (3.1)(iii), traverse each of the two boundary circles +from their common point. If their union has at most N drawing +vertices, the resulting curve has length at most 2N. Claim (1) +forces both enclosed prescribed discs to have the same index. +That prescribed disc cannot fit in the singleton intersection. +This supplies the omitted construction on page 246. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM14 + +/-- Condition (3.1)(iii) in the proof of XII (3.2), page 246. -/ +theorem meeting_circle_vertex_count_gt + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ η : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + (hη : η ≤ θ) (Δ r : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) (hr : ∀ i, r i ∈ Γ.R) + (hrΔ : ∀ i, (r i ∩ Δ i).Nonempty) + (hsep : ∀ i j, i ≠ j → η ≤ tangleMetric Γ K ins θ (r i) (r j)) + {N : ℕ} (hN : 2 * N < η) {A B D E : Set S} + (hn : Γ.IsNormal (A ∪ B)) (hA : IsOArc A) (hB : IsOArc B) + (hstar : A ∪ B ⊆ discComplement Δ) (hD : IsClosedDisc D) (hE : IsClosedDisc E) + (hbD : discBd D = A) (hbE : discBd E = B) (hcap : (D ∩ E).ncard = 1) + (hi : ∃ i, ∀ l, Δ l ⊆ D ↔ l = i) (hj : ∃ j, ∀ l, Δ l ⊆ E ↔ l = j) : + N < (Γ.V ∩ (A ∪ B)).ncard := by + by_contra hlarge + have hsmall := Nat.le_of_not_gt hlarge + have hNη : N < η := (Nat.le_mul_of_pos_left N (by decide : 0 < 2)).trans_lt hN + have hAfin : (Γ.V ∩ (A ∪ B)).Finite := Γ.finite_V.inter_of_left _ + have hAlen : (Γ.V ∩ A).ncard < η := + (Set.ncard_le_ncard (inter_subset_inter_right Γ.V subset_union_left) hAfin).trans_lt + (hsmall.trans_lt hNη) + have hBlen : (Γ.V ∩ B).ncard < η := + (Set.ncard_le_ncard (inter_subset_inter_right Γ.V subset_union_right) hAfin).trans_lt + (hsmall.trans_lt hNη) + obtain ⟨i, hi⟩ := hi + obtain ⟨j, hj⟩ := hj + have honeD : ∀ k l, Δ k ⊆ D → Δ l ⊆ D → k = l := by + intro k l hk hl + exact (hi k).mp hk |>.trans ((hi l).mp hl).symm + have honeE : ∀ k l, Δ k ⊆ E → Δ l ⊆ E → k = l := by + intro k l hk hl + exact (hj k).mp hk |>.trans ((hj l).mp hl).symm + have hmD := small_disc_is_selected_of_at_most_one_prescribed_disc hS hT hrespect hK hd + hη Δ r hΔ hcase hr hrΔ hsep hA (fun _ hx => hn ⟨Or.inl hx.1, hx.2⟩) hAlen + (subset_union_left.trans hstar) hD hbD honeD + have hmE := small_disc_is_selected_of_at_most_one_prescribed_disc hS hT hrespect hK hd + hη Δ r hΔ hcase hr hrΔ hsep hB (fun _ hx => hn ⟨Or.inr hx.1, hx.2⟩) hBlen + (subset_union_right.trans hstar) hE hbE honeE + obtain ⟨p, hp⟩ := Set.ncard_eq_one.mp hcap + have hpbd := (disc_boundaries_inter_of_singleton_intersection hS hD hE hp).1 + obtain ⟨φ, hφ, hrange, hlen⟩ := exists_short_curve_covering_two_meeting_circles hA hB hn + (hbD ▸ hpbd.1) (hbE ▸ hpbd.2) + have hlenη : curveLength Γ φ < η := + hlen.trans_lt ((Nat.mul_le_mul_left 2 hsmall).trans_lt hN) + have hsubD : subBd D = A := (subBd_eq_frontier D).trans + ((IsClosedDisc.frontier_eq_discBd hS hD).trans hbD) + have hsubE : subBd E = B := (subBd_eq_frontier E).trans + ((IsClosedDisc.frontier_eq_discBd hS hE).trans hbE) + have hij := short_curve_enclosing_discs_indices_eq hS hT hrespect hK hd hη Δ r hr hrΔ hsep + hφ hlenη hA hB (subset_union_left.trans hrange.symm.subset) + (subset_union_right.trans hrange.symm.subset) hD hE hsubD hsubE hmD hmE + ((hi i).mpr rfl) ((hj j).mpr rfl) + have hsub : Δ i ⊆ {p} := by + intro x hx + exact hp.subset ⟨(hi i).mpr rfl hx, (hj i).mpr hij hx⟩ + have hinf : (Δ i).Infinite := (infinite_of_isOArc (hΔ i).isOArc_discBd).mono + (Surface.discBd_subset _) + exact hinf (finite_singleton p |>.subset hsub) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3MeetingCircleExtraction.lean b/LeanPool/GraphMinor/GM12/Section3MeetingCircleExtraction.lean new file mode 100644 index 0000000000..3e9232ffb0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3MeetingCircleExtraction.lean @@ -0,0 +1,137 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ChordDichotomy +public import LeanPool.GraphMinor.GM12.Section3PathIntoCircle +public import LeanPool.GraphMinor.GM12.Section3PlanarHomotopicCircle +import LeanPool.GraphMinor.GM12.Section3PuncturedSurface +import LeanPool.GraphMinor.GM12.Section3PuncturedCuffs +import LeanPool.GraphMinor.GM11.RadialCorners + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Schismatic extraction from meeting surrounding circles + +The intersection step used by XII (3.1), page 245, follows the +unnumbered criterion in VII Section 8, page 241. Suppose that no +schismatic subset exists. Every complete chord of the second circle +is then planar together with the first circle after filling its cuff, +by the chord dichotomy. Finite complete-chord rerouting moves each of +the two arcs of the second circle into the first circle in that cap. +The second circle is null-homotopic there, so VII (5.1) makes it planar. +It would surround the first circle's cuff, contrary to cuff uniqueness. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +universe u + +/-- Two circles surrounding distinct prescribed cuffs and meeting in +at least two points contain a schismatic subset. No finiteness or +connectedness assumption on their intersection is needed. -/ +theorem exists_schismatic_subset_of_meeting_surrounding_circles + {S : Type u} {ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + {i j : ι} (hij : i ≠ j) {F A : Set (discComplement Δ)} + (hF : IsOArc F) (hA : IsOArc A) + (hsF : GM07.SurroundsCuff F (Subtype.val ⁻¹' discBd (Δ i))) + (hsA : GM07.SurroundsCuff A (Subtype.val ⁻¹' discBd (Δ j))) + {x y : discComplement Δ} (hx : x ∈ F ∩ A) (hy : y ∈ F ∩ A) (hxy : x ≠ y) : + ∃ Y, Y ⊆ F ∪ A ∧ GM07.IsSchismatic Y := by + classical + by_contra hn + have hno : ∀ Y, Y ⊆ F ∪ A → ¬ GM07.IsSchismatic Y := fun Y hY hs => hn ⟨Y, hY, hs⟩ + let : ConnectedSpace (discComplement Δ) := + Subtype.connectedSpace (discComplement_isConnected hS Δ hΔ hdisj) + have hsurface := discComplement_isSurface hS Δ hΔ hdisj + obtain ⟨T, tT, jcap, D, hcap⟩ := exists_cappedCuff hsurface hsF.1 + let := tT + let : T2Space T := hcap.isSurface.2.1 + have hconnT : ConnectedSpace T := cappedCuff_connectedSpace hcap + let J : C(discComplement Δ, T) := ⟨jcap, hcap.isEmbedding.continuous⟩ + have hJF : IsPlanar (jcap '' F) := hsF.2.1.2.2 T jcap D hcap + obtain ⟨f, g, hfg, hf0, hf1, hfgA⟩ := hA.exists_arcs hx.2 hy.2 hxy + let p : Path x y := { + toFun := f + continuous_toFun := hfg.arc_left.1 + source' := hf0 + target' := hf1 } + let q : Path x y := { + toFun := g + continuous_toFun := hfg.arc_right.1 + source' := hfg.zero.trans hf0 + target' := hfg.one.trans hf1 } + have hpA : range p ⊆ A := hfgA ▸ subset_union_left + have hqA : range q ⊆ A := hfgA ▸ subset_union_right + have hchord : ∀ (γ : Path x y), Function.Injective γ → range γ ⊆ A → + ∀ l r : unitInterval, l < r → γ l ∈ F → γ r ∈ F → + Disjoint (γ '' Ioo l r) F → IsPlanar (jcap '' (F ∪ γ '' Icc l r)) := by + intro γ hγi hγA l r hlr hlF hrF hgap + have hL : IsLineWithEnds (γ '' Icc l r) (γ l) (γ r) := + isLine_piece γ.continuous hγi hlr + have huv : γ l ≠ γ r := fun he => hlr.ne (hγi he) + have hLF : (γ '' Icc l r) ∩ F = {γ l, γ r} := by + apply Subset.antisymm + · rintro z ⟨⟨t, ht, rfl⟩, htF⟩ + by_cases htl : t = l + · exact Or.inl (congrArg γ htl) + · by_cases htr : t = r + · exact Or.inr (congrArg γ htr) + · exact (disjoint_left.mp hgap + ⟨t, ⟨lt_of_le_of_ne ht.1 (Ne.symm htl), lt_of_le_of_ne ht.2 htr⟩, rfl⟩ htF).elim + · rintro z (rfl | rfl) + · exact ⟨hL.left_mem, hlF⟩ + · exact ⟨hL.right_mem, hrF⟩ + rcases schismatic_or_planarInCappedCuff_of_chord hS Δ hΔ hdisj hcase + hF hL huv hLF hsF with ⟨Y, hY, hsY⟩ | hpC + · have hLA : γ '' Icc l r ⊆ A := (image_subset_range _ _).trans hγA + exact (hno Y (hY.trans (union_subset subset_union_left (hLA.trans subset_union_right))) + hsY).elim + · exact hpC.2.2 T jcap D hcap + obtain ⟨r, hpr, hrF⟩ := exists_homotopic_path_in_circle_of_planar_chords + hsurface hF p hfg.arc_left.2 hx.1 hy.1 J hcap.isEmbedding (hchord p hfg.arc_left.2 hpA) + obtain ⟨s, hqs, hsF'⟩ := exists_homotopic_path_in_circle_of_planar_chords + hsurface hF q hfg.arc_right.2 hx.1 hy.1 J hcap.isEmbedding (hchord q hfg.arc_right.2 hqA) + have hPQ : IsTwoArcs (p.map J.continuous) (q.map J.continuous) := by + refine ⟨⟨(p.map J.continuous).continuous, hcap.isEmbedding.injective.comp hfg.arc_left.2⟩, + ⟨(q.map J.continuous).continuous, hcap.isEmbedding.injective.comp hfg.arc_right.2⟩, + congrArg jcap hfg.zero, congrArg jcap hfg.one, ?_⟩ + intro a b he + exact hfg.meet a b (hcap.isEmbedding.injective he) + have hAeq : range (p.map J.continuous) ∪ range (q.map J.continuous) = jcap '' A := by + change range (jcap ∘ p) ∪ range (jcap ∘ q) = _ + rw [range_comp, range_comp, ← image_union] + exact congrArg (fun Z => jcap '' Z) hfgA + have hnull := null_circle_of_homotopic_paths_in_planar_set + (p.map J.continuous) (q.map J.continuous) r s hPQ hAeq hpr hqs + (union_subset hrF hsF') hJF + have hAo : IsOArc (jcap '' A) := by + obtain ⟨e⟩ := hA + exact ⟨e.trans (hcap.isEmbedding.homeomorphImage A)⟩ + have hproper : jcap '' A ≠ univ := by + intro heq + apply cappedCuff_range_ne_univ hcap + apply Set.eq_univ_of_univ_subset + rw [← heq] + exact image_subset_range _ _ + have hplanA := planar_oArc_of_null hcap.isSurface hconnT hAo hproper hnull + have hpAi := isPlanarInCappedCuff_of_one_cap hsurface hcap hplanA + have hsAi : GM07.SurroundsCuff A (Subtype.val ⁻¹' discBd (Δ i)) := ⟨hsF.1, hpAi, hsA.2.2⟩ + exact hij (surrounding_cuff_index_unique hS Δ hΔ hdisj hcase hA hsAi hsA) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3MeetingDiscBoundaries.lean b/LeanPool/GraphMinor/GM12/Section3MeetingDiscBoundaries.lean new file mode 100644 index 0000000000..7d8aa00327 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3MeetingDiscBoundaries.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.Disc +import LeanPool.GraphMinor.GM11.OArcCircuit + +/-! +# Two discs meeting once meet on both boundaries + +For XII (3.1)(iii) in the proof of (3.2), page 246, the two boundary +circles need a common base point. If a single intersection point +were interior to one disc, its intersection with the other disc +would be a relatively open singleton. That other disc is connected +and has another point, so this singleton cannot also be relatively +closed. Thus the point lies on both boundaries. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +private theorem mem_discBd_of_singleton_intersection + {S : Type*} [TopologicalSpace S] [T2Space S] (hS : IsClosedSurface S) + {D E : Set S} (hD : IsClosedDisc D) (hE : IsClosedDisc E) {p : S} + (hcap : D ∩ E = {p}) (hpD : p ∈ D) (hpE : p ∈ E) : p ∈ discBd D := by + by_contra hpB + have hpI : p ∈ discInt D := ⟨hpD, hpB⟩ + have hEinf : E.Infinite := (infinite_of_isOArc hE.isOArc_discBd).mono (Surface.discBd_subset E) + obtain ⟨y, hyE, hyp⟩ := hEinf.exists_notMem_finite (finite_singleton p) + have hcover : E ⊆ discInt D ∪ ({p} : Set S)ᶜ := by + intro x _ + by_cases hxp : x = p + · exact Or.inl (hxp.symm ▸ hpI) + · exact Or.inr hxp + have hopen : IsOpen (discInt D) := hD.isOpen_discInt (fun x => (hS.2.2 x).isManifoldPoint) + obtain ⟨x, hxE, hxI, hxp⟩ := hE.isPathConnected.isConnected.isPreconnected + (discInt D) ({p} : Set S)ᶜ hopen isClosed_singleton.isOpen_compl hcover + ⟨p, hpE, hpI⟩ ⟨y, hyE, hyp⟩ + exact hxp (hcap.subset ⟨hxI.1, hxE⟩) + +/-- Two closed discs with singleton intersection have exactly the +same singleton as the intersection of their boundary circles. -/ +theorem disc_boundaries_inter_of_singleton_intersection + {S : Type*} [TopologicalSpace S] [T2Space S] (hS : IsClosedSurface S) + {D E : Set S} (hD : IsClosedDisc D) (hE : IsClosedDisc E) {p : S} + (hcap : D ∩ E = {p}) : + p ∈ discBd D ∩ discBd E ∧ discBd D ∩ discBd E = {p} := by + have hp : p ∈ D ∩ E := hcap.symm.subset (mem_singleton p) + have hpD := mem_discBd_of_singleton_intersection hS hD hE hcap hp.1 hp.2 + have hpE := mem_discBd_of_singleton_intersection hS hE hD ((inter_comm E D).trans hcap) hp.2 hp.1 + refine ⟨⟨hpD, hpE⟩, Subset.antisymm ?_ ?_⟩ + · intro x hx + exact hcap.subset ⟨Surface.discBd_subset D hx.1, Surface.discBd_subset E hx.2⟩ + · intro x hx + have hxp : x = p := hx + subst x + exact ⟨hpD, hpE⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3MeetingDiscs.lean b/LeanPool/GraphMinor/GM12/Section3MeetingDiscs.lean new file mode 100644 index 0000000000..a3ef6323f3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3MeetingDiscs.lean @@ -0,0 +1,113 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3DiscUniqueness +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.DiscMerge +import LeanPool.GraphMinor.Surface.Circle + +/-! +# Discs whose boundaries meet at one point + +For XII (3.1)(iii), page 245, two surrounding circles meet at one +point. Removing that point leaves each circle connected. Disc +separation and uniqueness then show that nonnested enclosing discs +meet only at that point. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +variable {S : Type*} [TopologicalSpace S] + +/-- Removing one point from a circle leaves a path-connected set. -/ +theorem isPathConnected_oArc_diff {F : Set S} (hF : IsOArc F) {u : S} (hu : u ∈ F) : + IsPathConnected (F \ {u}) := + hF.isPathConnected_sdiff_singleton hu + +private theorem discInt_disjoint_of_boundaries_meet_once + [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {D E : Set S} {u : S} (hD : IsClosedDisc D) (hE : IsClosedDisc E) + (hcap : discBd D ∩ discBd E = {u}) + (hDE : ¬ D ⊆ E) (hED : ¬ E ⊆ D) + (hcase : ¬ IsSphere S ∨ D ∪ E ≠ univ) : Disjoint (discInt D) E := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hu : u ∈ discBd D ∩ discBd E := hcap.symm ▸ mem_singleton u + have hmiss : Disjoint (discBd E \ {u}) (discBd D) := by + apply Set.disjoint_left.mpr + intro x hxE hxD + have hx : x ∈ discBd D ∩ discBd E := ⟨hxD, hxE.1⟩ + rw [hcap] at hx + exact hxE.2 hx + have hout : Disjoint (discBd E \ {u}) D := by + rcases hD.side hman (isPathConnected_oArc_diff hE.isOArc_discBd hu.2).isConnected.isPreconnected + hmiss with hin | hout + · have hbED : discBd E ⊆ D := by + intro x hx + by_cases hxu : x = u + · exact hxu ▸ discBd_subset D hu.1 + · exact (hin ⟨hx, hxu⟩).1 + obtain ⟨E', hE', _⟩ := disc_oArc D (discBd E) hD hbED hE.isOArc_discBd + have heq : E = E' := by + rcases hcase with hns | hnoncover + · exact eq_of_discBd_eq ⟨hS.1, hS.2.1, hman⟩ hns hE hE'.2.1 hE'.2.2.1.symm + · apply eq_of_discBd_eq_of_union_ne_univ hman hE hE'.2.1 hE'.2.2.1.symm + intro he + apply hnoncover + apply eq_univ_of_univ_subset + rw [← he] + exact union_subset subset_union_right (hE'.1.trans subset_union_left) + exact False.elim (hED (heq ▸ hE'.1)) + · exact hout + have hmiss' : Disjoint (discInt D) (discBd E) := by + apply Set.disjoint_left.mpr + intro x hxD hxE + by_cases hxu : x = u + · exact hxD.2 (hxu ▸ hu.1) + · exact Set.disjoint_left.mp hout ⟨hxE, hxu⟩ hxD.1 + rcases hE.side hman hD.isPreconnected_discInt hmiss' with hin | hout + · apply False.elim + apply hDE + apply hD.subset_closure_discInt.trans + rw [← hE.isClosed.closure_eq] + exact closure_mono (hin.trans (discInt_subset E)) + · exact hout + +/-- Nonnested enclosing discs whose boundaries meet at one point +meet exactly at that point, provided the surface is not a sphere or +the discs do not cover it. This is the disc intersection in (3.1)(iii). -/ +theorem discs_inter_eq_singleton_of_boundaries_meet_once + [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {D E : Set S} {u : S} (hD : IsClosedDisc D) (hE : IsClosedDisc E) + (hcap : discBd D ∩ discBd E = {u}) + (hDE : ¬ D ⊆ E) (hED : ¬ E ⊆ D) + (hcase : ¬ IsSphere S ∨ D ∪ E ≠ univ) : D ∩ E = {u} := by + have hDI := discInt_disjoint_of_boundaries_meet_once hS hD hE hcap hDE hED hcase + have hcase' : ¬ IsSphere S ∨ E ∪ D ≠ univ := by + simpa only [union_comm] using hcase + have hcap' : discBd E ∩ discBd D = {u} := by rw [inter_comm, hcap] + have hEI := discInt_disjoint_of_boundaries_meet_once hS hE hD hcap' hED hDE hcase' + apply Subset.antisymm + · intro x hx + have hxD : x ∈ discBd D := by + by_contra hn + exact Set.disjoint_left.mp hDI ⟨hx.1, hn⟩ hx.2 + have hxE : x ∈ discBd E := by + by_contra hn + exact Set.disjoint_left.mp hEI ⟨hx.2, hn⟩ hx.1 + exact hcap ▸ (show x ∈ discBd D ∩ discBd E from ⟨hxD, hxE⟩) + · intro x hx + have hxB : x ∈ discBd D ∩ discBd E := hcap.symm ▸ hx + exact ⟨discBd_subset D hxB.1, discBd_subset E hxB.2⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3MeetingLoopCount.lean b/LeanPool/GraphMinor/GM12/Section3MeetingLoopCount.lean new file mode 100644 index 0000000000..a161c65819 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3MeetingLoopCount.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3MeetingSurrounding +public import LeanPool.GraphMinor.GM12.Section3SubspaceDrawing + +/-! +# The meeting-loop vertex bound + +Condition (iii) of XII (3.1), page 245, applies to two circles whose +enclosing discs meet once. The preceding construction supplies these +discs for circles surrounding distinct cuffs. Normality and vertex +counts transfer through the inclusion into the original surface. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Topology + +/-- The vertex bound for two surrounding circles meeting at one +point, from condition (iii) of XII (3.1), page 245. -/ +theorem meeting_loop_vertex_count_gt + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) (hUC : Γ.U ⊆ discComplement Δ) + (N : ℕ) + (hbound : ∀ A B D E : Set S, + Γ.IsNormal (A ∪ B) → IsOArc A → IsOArc B → A ∪ B ⊆ discComplement Δ → + IsClosedDisc D → IsClosedDisc E → discBd D = A → discBd E = B → + (D ∩ E).ncard = 1 → + (∃ i, ∀ l, Δ l ⊆ D ↔ l = i) → (∃ j, ∀ l, Δ l ⊆ E ↔ l = j) → + N < (Γ.V ∩ (A ∪ B)).ncard) + {i j : ι} (hij : i ≠ j) + {F₁ F₂ : Set (discComplement Δ)} {u : discComplement Δ} + (hF₁ : IsOArc F₁) (hF₂ : IsOArc F₂) (hcap : F₁ ∩ F₂ = {u}) + (hs₁ : GM07.SurroundsCuff F₁ (Subtype.val ⁻¹' discBd (Δ i))) + (hs₂ : GM07.SurroundsCuff F₂ (Subtype.val ⁻¹' discBd (Δ j))) + (hn : (drawingInSubspace Γ (discComplement Δ) hUC).IsNormal (F₁ ∪ F₂)) : + N < ((drawingInSubspace Γ (discComplement Δ) hUC).V ∩ (F₁ ∪ F₂)).ncard := by + let C := discComplement Δ + let a : C → S := Subtype.val + obtain ⟨D, E, hD, hE, hbD, hbE, honeD, honeE, hDE⟩ := + exists_meeting_surrounding_discs hS Δ hΔ hdisj hcase hij hF₁ hF₂ hcap hs₁ hs₂ + have hA : IsOArc (a '' F₁) := by + obtain ⟨φ⟩ := hF₁ + exact ⟨φ.trans (IsEmbedding.subtypeVal.homeomorphImage F₁)⟩ + have hB : IsOArc (a '' F₂) := by + obtain ⟨φ⟩ := hF₂ + exact ⟨φ.trans (IsEmbedding.subtypeVal.homeomorphImage F₂)⟩ + have hnormal := drawingInSubspace_isNormal_image Γ C hUC hn + rw [image_union] at hnormal + have hsupport : a '' F₁ ∪ a '' F₂ ⊆ C := by + rintro x (⟨y, _, rfl⟩ | ⟨y, _, rfl⟩) <;> exact y.property + have hmeet : (D ∩ E).ncard = 1 := by rw [hDE, ncard_singleton] + have hbig := hbound (a '' F₁) (a '' F₂) D E hnormal hA hB hsupport + hD hE hbD hbE hmeet ⟨i, honeD⟩ ⟨j, honeE⟩ + have hcount := congrArg Set.ncard + (drawingInSubspace_image_vertices_inter Γ C hUC (F₁ ∪ F₂)) + rw [ncard_image_of_injective _ Subtype.val_injective, image_union] at hcount + rw [hcount] + exact hbig + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3MeetingLoopSchismatic.lean b/LeanPool/GraphMinor/GM12/Section3MeetingLoopSchismatic.lean new file mode 100644 index 0000000000..333315c48e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3MeetingLoopSchismatic.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CircleObstructions +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.Surface.DiscMerge + +/-! +# The second two-loop obstruction is schismatic + +For VII Section 8, used by XII (3.1), page 245, circles inside two +loops meeting once stay in a single loop. Remove the common point +and use connectedness of the punctured circle to choose a side. +Restoring the point does not change that side, since it belongs to +both loops. Near-planarity of each loop then proves the minimal-circle +clause for the second schismatic shape. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A circle inside two loops meeting once is contained in one loop. -/ +theorem oArc_subset_meeting_circle_or + {S : Type*} [TopologicalSpace S] [T2Space S] {F A Z : Set S} {u : S} + (hF : IsOArc F) (hA : IsOArc A) (hcap : F ∩ A = {u}) + (hZ : IsOArc Z) (hZY : Z ⊆ F ∪ A) : Z ⊆ F ∨ Z ⊆ A := by + have hu : u ∈ F ∩ A := hcap.symm ▸ mem_singleton u + have hcover : Z \ {u} ⊆ F ∪ A := sdiff_subset.trans hZY + have hmiss : ∀ x ∈ Z \ {u}, x ∈ F → x ∉ A := by + intro x hx hxF hxA + exact hx.2 (hcap ▸ (show x ∈ F ∩ A from ⟨hxF, hxA⟩)) + rcases subset_or_subset_of_closed (hZ.twoConn u) hF.isCompact.isClosed hA.isCompact.isClosed + hcover hmiss with hZF | hZA + · left + intro x hx + by_cases hxu : x = u + · exact hxu.symm ▸ hu.1 + · exact hZF ⟨hx, hxu⟩ + · right + intro x hx + by_cases hxu : x = u + · exact hxu.symm ▸ hu.2 + · exact hZA ⟨hx, hxu⟩ + +/-- Two near-planar loops meeting once form a schismatic set whenever +their union is not near-planar. -/ +theorem isSchismatic_x2_of_nearPlanar_loops + {S : Type*} [TopologicalSpace S] [T2Space S] {F A : Set S} {u : S} + (hF : IsOArc F) (hA : IsOArc A) (hcap : F ∩ A = {u}) + (hnearF : GM07.IsNearPlanar F) (hnearA : GM07.IsNearPlanar A) + (hnot : ¬ GM07.IsNearPlanar (F ∪ A)) : GM07.IsSchismatic (F ∪ A) := by + refine ⟨Or.inr (Or.inr (Or.inl ⟨F, A, u, hF, hA, hcap, rfl⟩)), hnot, ?_⟩ + intro Z hZ hZY + rcases oArc_subset_meeting_circle_or hF hA hcap hZ hZY.1 with hZF | hZA + · exact isNearPlanar_mono hZF hnearF + · exact isNearPlanar_mono hZA hnearA + +/-- Selected circles meeting once around distinct prescribed cuffs +supply a schismatic second two-loop set inside their containing set. -/ +theorem exists_schismatic_x2_of_meeting_surrounding_subcircles + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + {X F A : Set (discComplement Δ)} {u : discComplement Δ} + {i j : ι} (hij : i ≠ j) (hF : IsOArc F) (hA : IsOArc A) + (hFX : F ⊆ X) (hAX : A ⊆ X) (hFA : F ∩ A = {u}) + (hsi : GM07.SurroundsCuff F (Subtype.val ⁻¹' discBd (Δ i))) + (hsj : GM07.SurroundsCuff A (Subtype.val ⁻¹' discBd (Δ j))) : + ∃ Y : Set (discComplement Δ), Y ⊆ X ∧ GM07.IsSchismatic Y := by + refine ⟨F ∪ A, union_subset hFX hAX, ?_⟩ + have hnot := not_isNearPlanar_of_distinct_surrounding_subcircles hS Δ hΔ hdisj hcase hij hF hA + subset_union_left subset_union_right hsi hsj + exact isSchismatic_x2_of_nearPlanar_loops hF hA hFA + (Or.inr ⟨_, hsi.1, hsi.2.1⟩) (Or.inr ⟨_, hsj.1, hsj.2.1⟩) hnot + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3MeetingSurrounding.lean b/LeanPool/GraphMinor/GM12/Section3MeetingSurrounding.lean new file mode 100644 index 0000000000..30bd07217b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3MeetingSurrounding.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ThirdDisc +import LeanPool.GraphMinor.GM12.Section3MeetingDiscs + +/-! +# Enclosing discs for circles meeting once + +For XII (3.1)(iii), page 245, two circles surrounding distinct cuffs +meet at one point. Their enclosing discs cannot be nested. On the +sphere, a third deleted disc supplies an outside point. The disc +intersection lemma then identifies their intersection exactly. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Surrounding circles meeting once have enclosing discs meeting +at that same point, under the surface assumption of XII (3.1). -/ +theorem exists_meeting_surrounding_discs + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + {i j : ι} (hij : i ≠ j) {F₁ F₂ : Set (discComplement Δ)} {u : discComplement Δ} + (hF₁ : IsOArc F₁) (hF₂ : IsOArc F₂) (hcap : F₁ ∩ F₂ = {u}) + (hs₁ : GM07.SurroundsCuff F₁ (Subtype.val ⁻¹' discBd (Δ i))) + (hs₂ : GM07.SurroundsCuff F₂ (Subtype.val ⁻¹' discBd (Δ j))) : + ∃ D E : Set S, IsClosedDisc D ∧ IsClosedDisc E ∧ + discBd D = (Subtype.val : discComplement Δ → S) '' F₁ ∧ + discBd E = (Subtype.val : discComplement Δ → S) '' F₂ ∧ + (∀ l, Δ l ⊆ D ↔ l = i) ∧ (∀ l, Δ l ⊆ E ↔ l = j) ∧ D ∩ E = {u.val} := by + classical + obtain ⟨D, hD, hbD, hiD, hDT⟩ := + surrounding_bounds_disc_including_deleted_disc hS Δ hΔ hdisj i hF₁ hs₁ + obtain ⟨E, hE, hbE, hjE, hET⟩ := + surrounding_bounds_disc_including_deleted_disc hS Δ hΔ hdisj j hF₂ hs₂ + have honeD := included_disc_iff_of_subset_partial_fill hS Δ hΔ hiD hDT + have honeE := included_disc_iff_of_subset_partial_fill hS Δ hΔ hjE hET + have hcase' : ¬ IsSphere S ∨ D ∪ E ≠ univ := by + rcases hcase with hns | hthree + · exact Or.inl hns + · right + let := Fintype.ofFinite ι + have hthree' : 3 ≤ Fintype.card ι := by + simpa only [Nat.card_eq_fintype_card] using hthree + obtain ⟨k, hki, hkj⟩ := ENat.exists_ne_ne_of_three_le + (by rw [ENat.card_eq_coe_fintype_card]; exact_mod_cast hthree') i j + exact union_ne_univ_of_subset_partial_fills hS Δ hΔ hki hkj hDT hET + refine ⟨D, E, hD, hE, hbD, hbE, honeD, honeE, ?_⟩ + apply discs_inter_eq_singleton_of_boundaries_meet_once hS hD hE + · rw [hbD, hbE, ← image_inter Subtype.val_injective, hcap, image_singleton] + · intro hDE + exact hij ((honeE i).mp (hiD.trans hDE)) + · intro hED + exact hij (((honeD j).mp (hjE.trans hED)).symm) + · exact hcase' + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ModelComplexity.lean b/LeanPool/GraphMinor/GM12/Section3ModelComplexity.lean new file mode 100644 index 0000000000..dcb9e17401 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ModelComplexity.lean @@ -0,0 +1,105 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3PuncturedModel +import LeanPool.GraphMinor.Surface.NormalWord +import LeanPool.GraphMinor.Surface.Classification +import LeanPool.GraphMinor.Surface.ModelCriterion + +/-! +# The complexity condition for applying VII + +The surface theorem used in XII (3.1), page 245, requires complexity +at least three. The excluded cases are a sphere with at most two holes. +We identify the model with no handles, cross-caps or holes directly +from its quotient definition. The hypothesis of XII (3.1) then gives +the required complexity bound. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- With no identifications or deletions, the model is the sphere. +The map sends the class of a point to that same point. -/ +theorem isSphere_model_zero : IsSphere (SurfaceModel 0 0 0) := by + have hr : ∀ x y : modelBase (2 * 0 + 0 + 0), + ModelGlue 0 0 (2 * 0 + 0 + 0) x y → x.val = y.val := by + intro x y h + cases h <;> omega + let f : SurfaceModel 0 0 0 → OnePoint EuclideanPlane := Quot.lift Subtype.val hr + have hf : Continuous f := continuous_quot_lift hr continuous_subtype_val + have hi : Function.Injective f := by + intro x y + refine Quot.inductionOn x ?_ + intro p + refine Quot.inductionOn y ?_ + intro q hpq + exact congrArg (Quot.mk _) (Subtype.ext hpq) + have hs : Function.Surjective f := by + intro x + exact ⟨Quot.mk _ ⟨x, by simp [modelBase]⟩, rfl⟩ + let := (isSurface_model 0 0 0).1.1 + exact ⟨hf.homeoOfEquivCompactToT2 (f := Equiv.ofBijective f ⟨hi, hs⟩)⟩ + +/-- The sphere exception in XII (3.1) is exactly what ensures the +complexity required by VII for the punctured model. -/ +theorem model_complexity_of_not_sphere_or_three_discs + {S : Type*} [TopologicalSpace S] {a b t : ℕ} + (e : S ≃ₜ SurfaceModel a b 0) (hcase : ¬ IsSphere S ∨ 3 ≤ t) : + 3 ≤ 3 * a + 3 * b + t := by + rcases hcase with hn | ht + · by_contra h + have ha : a = 0 := by omega + have hb : b = 0 := by omega + subst a + subst b + obtain ⟨eM⟩ := isSphere_model_zero + exact hn ⟨e.trans eM⟩ + · omega + +/-- A connected closed surface has a model with no cuffs. -/ +theorem exists_closed_surface_model + {S : Type*} [TopologicalSpace S] [ConnectedSpace S] (hS : IsClosedSurface S) : + ∃ a b : ℕ, Nonempty (S ≃ₜ SurfaceModel a b 0) := by + have hsurf : IsSurface S := + ⟨hS.1, hS.2.1, fun x => (hS.2.2 x).isManifoldPoint⟩ + obtain ⟨a, b, c, ⟨e⟩⟩ := classification S hsurf inferInstance + have hbd : bd S = ∅ := Set.eq_empty_iff_forall_notMem.mpr + (fun x hx => hx (hS.2.2 x)) + obtain ⟨ht, f, hf⟩ := presents_ew a b c + let := ht + have hc : c = 0 := by + calc + c = (cuffs (SurfaceModel a b c)).ncard := (ncard_cuffs hf).symm + _ = (cuffs S).ncard := (ncard_cuffs_congr e).symm + _ = 0 := by simp [cuffs, hbd, componentsIn] + exact ⟨a, b, ⟨hc ▸ e⟩⟩ + +/-- The parameters needed by VII in XII (3.1) depend only on the +original surface and the number of discs. This supplies both the model +and its complexity for every allowed placement of the discs. -/ +theorem exists_uniform_discComplement_model + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (t : ℕ) (hcase : ¬ IsSphere S ∨ 3 ≤ t) : + ∃ a b : ℕ, 3 ≤ 3 * a + 3 * b + t ∧ + ∀ Δ : Fin t → Set S, (∀ i, IsClosedDisc (Δ i)) → + Pairwise (fun i j => Disjoint (Δ i) (Δ j)) → + Nonempty (discComplement Δ ≃ₜ SurfaceModel a b t) := by + obtain ⟨a, b, ⟨e⟩⟩ := exists_closed_surface_model hS + refine ⟨a, b, model_complexity_of_not_sphere_or_three_discs e hcase, ?_⟩ + intro Δ hΔ hd + exact Eq.mp (congrArg + (fun n => Nonempty (discComplement Δ ≃ₜ SurfaceModel a b n)) (Nat.card_fin t)) + (discComplement_model_of_closed_model hS Δ hΔ hd e) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3NearPlanarAmbient.lean b/LeanPool/GraphMinor/GM12/Section3NearPlanarAmbient.lean new file mode 100644 index 0000000000..c5fc6e34c0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3NearPlanarAmbient.lean @@ -0,0 +1,52 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CapOneDisc +public import LeanPool.GraphMinor.GM12.Section3SubspaceDrawing +import LeanPool.GraphMinor.GM12.Section3PuncturedCuffs +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs + +/-! +# Near-planar sets are planar after all deleted discs are filled + +In the candidate-existence step used by XII (3.1), page 245, a +near-planar set in the punctured surface becomes planar in the +original closed surface. If it is already planar, include its +containing disc. Otherwise fill its one cuff first, use the containing +disc in that partial fill, and include that disc in the closed surface. +Both inclusions preserve the points of the original set. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A near-planar set in the disc complement is planar in the original +surface, since each actual single-cuff cap includes in that surface. -/ +theorem isPlanar_image_of_isNearPlanar_discComplement + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {X : Set (discComplement Δ)} (hnear : GM07.IsNearPlanar X) : + IsPlanar ((Subtype.val : discComplement Δ → S) '' X) := by + rcases hnear with ⟨D, hD, hXD⟩ | ⟨C, hC, hpC⟩ + · exact ⟨Subtype.val '' D, (isClosedDisc_subtype_image hD).1, image_mono hXD⟩ + · have hC' := hC + rw [discComplement_cuffs_eq hS Δ hΔ hdisj] at hC' + obtain ⟨i, rfl⟩ := hC' + obtain ⟨j, hj, hjval⟩ := exists_cap_discComplement_cuff hS Δ hΔ hdisj i + obtain ⟨D, hD, hXD⟩ := hpC.2.2 _ j (Subtype.val ⁻¹' Δ i) hj + refine ⟨Subtype.val '' D, (isClosedDisc_subtype_image hD).1, ?_⟩ + rintro x ⟨y, hy, rfl⟩ + exact ⟨j y, hXD (mem_image_of_mem j hy), hjval y⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3NearPlanarCircle.lean b/LeanPool/GraphMinor/GM12/Section3NearPlanarCircle.lean new file mode 100644 index 0000000000..b509bd63c3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3NearPlanarCircle.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CapOneDisc +public import LeanPool.GraphMinor.GM12.Section3CapComparison +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Small circles are near-planar + +Condition (i) of XII (3.1), page 245, says that a small normal circle +bounds a disc enclosing at most one deleted disc. If it encloses none, +the bounded disc remains in Sigma-star. If it encloses one, it remains +after that cuff is filled. Cap independence then proves near-planarity +in the exact sense of VII. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A bounded disc whose boundary remains in Sigma-star lies wholly +there if it includes none of the deleted discs. Connectedness of each +deleted disc's interior excludes a partial crossing of that disc. -/ +theorem disc_subset_discComplement_of_no_deleted_disc + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {D : Set S} (hD : IsClosedDisc D) (hbd : discBd D ⊆ discComplement Δ) + (hno : ∀ i, ¬ Δ i ⊆ D) : D ⊆ discComplement Δ := by + have hout : ∀ i, Disjoint (discInt (Δ i)) D := by + intro i + have hdis : Disjoint (discInt (Δ i)) (discBd D) := by + apply Set.disjoint_left.mpr + intro x hxI hxB + exact hxI.2 (discComplement_inter_disc_subset_boundary hS Δ hΔ i ⟨hbd hxB, hxI.1⟩) + rcases hD.side (fun x => (hS.2.2 x).isManifoldPoint) + (hΔ i).isPreconnected_discInt hdis with hin | hout + · apply False.elim + apply hno i + apply (hΔ i).subset_closure_discInt.trans + rw [← hD.isClosed.closure_eq] + exact closure_mono (hin.trans (discInt_subset D)) + · exact hout + intro x hxD + by_cases hx : x ∈ ⋃ i, Δ i + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hx + have hxb : x ∈ discBd (Δ i) := by + by_contra hn + exact Set.disjoint_left.mp (hout i) ⟨hxi, hn⟩ hxD + exact disc_boundary_subset_discComplement hS Δ hΔ hdisj i hxb + · exact subset_closure hx + +/-- The topological conclusion of XII (3.1)(i) makes its circle +near-planar in Sigma-star. At most one cuff needs to be filled. -/ +theorem isNearPlanar_of_bounds_disc_including_at_most_one + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {F : Set (discComplement Δ)} {D : Set S} (hD : IsClosedDisc D) + (hbd : discBd D = (Subtype.val : discComplement Δ → S) '' F) + (hone : ∀ i j, Δ i ⊆ D → Δ j ⊆ D → i = j) : GM07.IsNearPlanar F := by + classical + let C := discComplement Δ + have hbC : discBd D ⊆ C := by + rw [hbd] + rintro x ⟨y, _, rfl⟩ + exact y.property + by_cases hex : ∃ i, Δ i ⊆ D + · obtain ⟨i, hi⟩ := hex + let T := discComplement (fun k : {k // k ≠ i} => Δ k.val) + have hCT : C ⊆ T := by + change C ⊆ discComplement (fun k : {k // k ≠ i} => Δ k.val) + rw [discComplement_except_eq_union Δ hΔ hdisj i] + exact subset_union_left + have hDT : D ⊆ T := disc_subset_discComplement_of_no_deleted_disc hS + (fun k : {k // k ≠ i} => Δ k.val) (fun k => hΔ k.val) + (fun a b hab => hdisj (fun he => hab (Subtype.ext he))) hD (hbC.trans hCT) + (fun k hk => k.property (hone k.val i hk hi)) + obtain ⟨j, hj, hjval⟩ := exists_cap_discComplement_cuff hS Δ hΔ hdisj i + have hplan : IsPlanar (j '' F) := by + refine ⟨Subtype.val ⁻¹' D, (isClosedDisc_subtype_preimage hDT hD).1, ?_⟩ + rintro y ⟨x, hx, rfl⟩ + change (j x).val ∈ D + rw [hjval] + exact discBd_subset D (hbd.symm ▸ mem_image_of_mem Subtype.val hx) + have hp := isPlanarInCappedCuff_of_one_cap (discComplement_isSurface hS Δ hΔ hdisj) hj hplan + exact Or.inr ⟨_, hj.cuff, hp⟩ + · have hDC := disc_subset_discComplement_of_no_deleted_disc hS Δ hΔ hdisj hD hbC + (fun i hi => hex ⟨i, hi⟩) + left + refine ⟨Subtype.val ⁻¹' D, (isClosedDisc_subtype_preimage hDC hD).1, ?_⟩ + intro x hx + exact discBd_subset D (hbd.symm ▸ mem_image_of_mem Subtype.val hx) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3NormalEssentialCircle.lean b/LeanPool/GraphMinor/GM12/Section3NormalEssentialCircle.lean new file mode 100644 index 0000000000..28d5b3cae6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3NormalEssentialCircle.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Cited +import LeanPool.GraphMinor.GM12.Section3AddNormalCircle +import LeanPool.GraphMinor.GM12.Section3OutsideDiscRegions +import LeanPool.GraphMinor.GM12.Section3ThetaSphere +import LeanPool.GraphMinor.GM11.Section6 + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# A normal essential circle outside one disc + +For the one-cuff minimum-existence step used by XII (3.1), page 245, +add the deleted disc's normal boundary to the drawing. Its complement +is the closure of a union of regions. This complement is not planar: +on a surface other than the sphere, a containing disc would also +contain the deleted disc, and hence fill the whole closed surface. +The normal-circle criterion VII (5.5), page 231, therefore supplies a +normal circle in the complement which is not null-homotopic. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +universe u + +/-- On a closed surface other than the sphere, the complement of one +disc contains a normal non-null-homotopic circle whenever its boundary +is normal. This uses cited VII (5.5) over its original drawing. -/ +theorem exists_normal_nonnull_oArc_outside_disc + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) (Γ : Drawing S) + {D : Set S} (hD : IsClosedDisc D) (hnD : Γ.IsNormal (discBd D)) : + ∃ F : Set S, IsOArc F ∧ Γ.IsNormal F ∧ F ⊆ closure Dᶜ ∧ ¬ IsNullHomotopicOArc F := by + classical + obtain ⟨G, hGU, hnorm⟩ := exists_drawing_add_normal_oArc Γ hD.isOArc_discBd hnD + have hclosed : IsClosed D := hD.isCompact.isClosed + have hbd : frontier D ⊆ G.U := by + rw [IsClosedDisc.frontier_eq_discBd hS hD, hGU] + exact subset_union_right + let R := {r ∈ G.R | Disjoint r D} + have hZ : closure Dᶜ = closure (⋃₀ R) := + closure_compl_eq_closure_outside_regions hS G hclosed hbd + have hproper : closure Dᶜ ≠ univ := by + intro heq + obtain ⟨x, hx⟩ := hD.nonempty_discInt + have hxZ : x ∈ closure Dᶜ := heq.symm ▸ mem_univ x + have hxfr : x ∈ frontier D := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure hx.1, hxZ⟩ + exact hx.2 (IsClosedDisc.frontier_eq_discBd hS hD ▸ hxfr) + have hnotplanar : ¬ IsPlanar (closure Dᶜ) := by + rintro ⟨E, hE, hZE⟩ + have hbdE : discBd D ⊆ E := by + intro x hx + have hxfr : x ∈ frontier D := (IsClosedDisc.frontier_eq_discBd hS hD).symm ▸ hx + rw [frontier_eq_closure_inter_closure] at hxfr + exact hZE hxfr.2 + have hDE := disc_subset_of_boundary_subset_disc_of_not_sphere hS hns hD hE hbdE + apply closed_disc_ne_univ hS hE + apply Set.eq_univ_of_univ_subset + intro x _ + by_cases hx : x ∈ D + · exact hDE hx + · exact hZE (subset_closure hx) + have hGproper : G.IsProper := by + rintro x ⟨hx, _⟩ + exact (hx (hS.2.2 x)).elim + have hcriterion := GraphMinor.GM07.gm07_theorem_5_5 S ⟨hS.1, hS.2.1, fun x => + (hS.2.2 x).isManifoldPoint⟩ + inferInstance G hGproper R (fun _ hr => hr.1) (hZ ▸ hproper) + have hnall : ¬ ∀ F : Set S, G.IsNormal F → IsOArc F → + F ⊆ closure Dᶜ → IsNullHomotopicOArc F := by + intro hall + apply hnotplanar + rw [hZ] + exact hcriterion.mpr (fun F hn hF hFZ => hall F hn hF (hZ.symm ▸ hFZ)) + push Not at hnall + obtain ⟨F, hnF, hF, hFZ, hnull⟩ := hnall + exact ⟨F, hF, hnorm F hnF, hFZ, hnull⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3NormalPathConnected.lean b/LeanPool/GraphMinor/GM12/Section3NormalPathConnected.lean new file mode 100644 index 0000000000..a2a575f378 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3NormalPathConnected.lean @@ -0,0 +1,84 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3NormalRegionPaths +import LeanPool.GraphMinor.GM12.Section3ClosedCoverPaths +import LeanPool.GraphMinor.GM11.Section4c +import LeanPool.GraphMinor.GM11.Section5b + +/-! +# Paths avoiding all edge interiors + +For the candidate-existence step used by XII (3.1), page 245, +closures of drawing regions form a finite closed cover of the surface. +Drawing carriers have empty interior, so this cover misses no point. +The region-path lemma joins representatives of meeting cover members +normally. Connectedness of the surface joins all representatives. +Every allowed point is either in a region or an incident vertex, +so the whole complement of the open edges is path-connected. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- In a connected closed surface, drawing vertices and points outside +the drawing form a path-connected set. Equivalently, any two points +outside the open edges can be joined by a normal path. -/ +theorem isPathConnected_normal_points + {S : Type*} [TopologicalSpace S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) : IsPathConnected (Γ.Uᶜ ∪ Γ.V) := by + classical + let : T2Space S := hS.2.1 + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let I := {r : Set S // r ∈ Γ.R} + let : Fintype I := (finite_R hS Γ).fintype + have hcover : (⋃ i : I, closure i.val) = univ := by + apply Set.eq_univ_of_univ_subset + intro x _ + have hxdense : x ∈ closure (⋃₀ Γ.R) := by + apply mem_closure_iff.mpr + intro O hO hxO + obtain ⟨y, hyO, hyU⟩ := exists_notMem_U (Γ := Γ) hS hO ⟨x, hxO⟩ + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem hyU + exact ⟨y, hyO, r, hr, hyr⟩ + rw [(finite_R hS Γ).closure_sUnion] at hxdense + obtain ⟨r, hr, hxr⟩ := mem_iUnion₂.mp hxdense + exact mem_iUnion.mpr ⟨⟨r, hr⟩, hxr⟩ + have hex : ∀ i : I, i.val.Nonempty := fun i => region_nonempty i.property + choose z hz using hex + have hzN : ∀ i : I, z i ∈ Γ.Uᶜ ∪ Γ.V := + fun i => Or.inl (region_subset i.property (hz i)) + have hjoin : ∀ i j : I, JoinedIn (Γ.Uᶜ ∪ Γ.V) (z i) (z j) := + joinedIn_of_finite_closed_cover (fun i : I => closure i.val) z + (fun _ => isClosed_closure) (fun i => ⟨z i, subset_closure (hz i)⟩) hcover hzN + (fun i j hm => joinedIn_normal_points_of_meeting_region_closures hS Γ + i.property j.property (hz i) (hz j) hm) + have hanchor : ∀ x ∈ Γ.Uᶜ ∪ Γ.V, ∃ i : I, JoinedIn (Γ.Uᶜ ∪ Γ.V) x (z i) := by + intro x hx + rcases hx with hxU | hxV + · obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem hxU + let i : I := ⟨r, hr⟩ + refine ⟨i, joinedIn_normal_points_of_meeting_region_closures hS Γ hr hr hxr (hz i) ?_⟩ + exact ⟨x, subset_closure hxr, subset_closure hxr⟩ + · obtain ⟨i, hxi⟩ := mem_iUnion.mp (hcover.symm ▸ mem_univ x) + exact ⟨i, joinedIn_normal_points_of_vertex_region hS Γ i.property hxV hxi (hz i)⟩ + apply isPathConnected_iff.mpr + constructor + · obtain ⟨x, _, hxU⟩ := exists_notMem_U (Γ := Γ) hS isOpen_univ Set.univ_nonempty + exact ⟨x, Or.inl hxU⟩ + · intro x hx y hy + obtain ⟨i, hxi⟩ := hanchor x hx + obtain ⟨j, hyj⟩ := hanchor y hy + exact hxi.trans ((hjoin i j).trans hyj.symm) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3NormalPuncturedPaths.lean b/LeanPool/GraphMinor/GM12/Section3NormalPuncturedPaths.lean new file mode 100644 index 0000000000..7825977352 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3NormalPuncturedPaths.lean @@ -0,0 +1,110 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3NormalPathConnected +public import LeanPool.GraphMinor.GM12.Section3Punctured +import LeanPool.GraphMinor.GM12.Section3PushPathOutside +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# Normal paths in the punctured surface + +For candidate existence in XII (3.1), page 245, start with a normal +path in the closed surface. Push it outside each deleted disc in turn. +Disc boundaries are normal by the prescribed intersection condition. +Their pairwise disjointness ensures that adding a new boundary does +not enter any interior already excluded. The finite iteration gives +a normal path in the actual disc complement. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +private theorem isPathConnected_oArc + {S : Type*} [TopologicalSpace S] {F : Set S} (hF : IsOArc F) : IsPathConnected F := by + obtain ⟨e⟩ := hF + have heq : range (fun t : Circle => (e t).val) = F := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (e t).property + · intro hx + exact ⟨e.symm ⟨x, hx⟩, congrArg Subtype.val (e.apply_symm_apply _)⟩ + rw [← heq] + exact isPathConnected_range (continuous_subtype_val.comp e.continuous) + +/-- Any two allowed points in the punctured surface have a normal +joining path there. The drawing may have arbitrary regions. -/ +theorem exists_normal_path_in_discComplement + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (havoid : ∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) + {a b : S} (ha : a ∈ discComplement Δ) (hb : b ∈ discComplement Δ) + (haN : a ∈ Γ.Uᶜ ∪ Γ.V) (hbN : b ∈ Γ.Uᶜ ∪ Γ.V) : + ∃ q : Path a b, range q ⊆ discComplement Δ ∧ Γ.IsNormal (range q) := by + classical + let := Fintype.ofFinite ι + have hCout : ∀ i, discComplement Δ ⊆ (interior (Δ i))ᶜ := by + intro i + apply closure_minimal + · intro x hx hxi + exact hx (mem_iUnion.mpr ⟨i, interior_subset hxi⟩) + · exact isOpen_interior.isClosed_compl + have hfrontN : ∀ i, frontier (Δ i) ⊆ Γ.Uᶜ ∪ Γ.V := by + intro i x hx + by_cases hxU : x ∈ Γ.U + · have hxD : x ∈ Δ i := (hΔ i).isCompact.isClosed.frontier_subset hx + exact Or.inr ((havoid i ▸ (show x ∈ Γ.U ∩ Δ i from ⟨hxU, hxD⟩)).1) + · exact Or.inl hxU + have hfrontpath : ∀ i, IsPathConnected (frontier (Δ i)) := by + intro i + rw [IsClosedDisc.frontier_eq_discBd hS (hΔ i)] + exact isPathConnected_oArc (hΔ i).isOArc_discBd + obtain ⟨p, hp⟩ := (isPathConnected_normal_points hS Γ).joinedIn a haN b hbN + have hex : ∀ J : Finset ι, ∃ q : Path a b, + range q ⊆ Γ.Uᶜ ∪ Γ.V ∧ ∀ i ∈ J, range q ⊆ (interior (Δ i))ᶜ := by + intro J + induction J using Finset.induction_on with + | empty => + exact ⟨p, by rintro _ ⟨t, rfl⟩; exact hp t, by simp⟩ + | @insert i J hi ih => + obtain ⟨q, hqN, hqout⟩ := ih + obtain ⟨r, hr, hrout⟩ := exists_path_outside_interior_of_pathConnected_frontier + (hΔ i).isCompact.isClosed (hfrontpath i) q (hCout i ha) (hCout i hb) + refine ⟨r, hr.trans (union_subset hqN (hfrontN i)), ?_⟩ + intro j hj + rcases Finset.mem_insert.mp hj with rfl | hj + · exact hrout + · intro x hx hxin + rcases hr hx with hxq | hxfr + · exact hqout j hj hxq hxin + · have hji : i ≠ j := fun he => hi (he.symm ▸ hj) + exact disjoint_left.mp (hdisj hji) + ((hΔ i).isCompact.isClosed.frontier_subset hxfr) (interior_subset hxin) + obtain ⟨q, hqN, hqout⟩ := hex Finset.univ + refine ⟨q, ?_, ?_⟩ + · intro x hx + by_cases hxD : x ∈ ⋃ i, Δ i + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxD + apply mem_discComplement_of_mem_frontier Δ (fun i => (hΔ i).isCompact.isClosed) hdisj hxi + rw [(hΔ i).isCompact.isClosed.frontier_eq] + exact ⟨hxi, hqout i (Finset.mem_univ i) hx⟩ + · exact subset_closure hxD + · rintro x ⟨hx, hxU⟩ + rcases hqN hx with hxnot | hxV + · exact (hxnot hxU).elim + · exact hxV + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3NormalRegionPaths.lean b/LeanPool/GraphMinor/GM12/Section3NormalRegionPaths.lean new file mode 100644 index 0000000000..4fa3b8d263 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3NormalRegionPaths.lean @@ -0,0 +1,101 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import Mathlib.Topology.Connected.PathConnected +import LeanPool.GraphMinor.GM11.Theorem75 +import LeanPool.GraphMinor.GM11.RadialRegions + +/-! +# Normal connections through regions + +To construct the normal sets used in the minimum for XII (3.1), +page 245, join points through drawing regions and their incident +vertices. A vertex in the closure of a region has an approach path +whose other points lie in that region. Two regions whose closures +meet either coincide or share an incident vertex: an intersection +in an edge extends along that edge to an end. Thus points in these +regions can be joined without crossing edge interiors. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A vertex incident with a region joins any point of that region +through points outside the drawing and drawing vertices. -/ +theorem joinedIn_normal_points_of_vertex_region + {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) + {r : Set S} (hr : r ∈ Γ.R) {x y : S} + (hx : x ∈ Γ.V) (hxr : x ∈ closure r) (hy : y ∈ r) : + JoinedIn (Γ.Uᶜ ∪ Γ.V) x y := by + let : T2Space S := hS.2.1 + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨g, hgc, hg0, hgr⟩ := exists_path_into_region hS Γ hx hr hxr + let p : Path x (g 1) := { + toFun := g + continuous_toFun := hgc + source' := hg0 + target' := rfl } + have hp : JoinedIn (Γ.Uᶜ ∪ Γ.V) x (g 1) := by + refine ⟨p, ?_⟩ + intro t + by_cases ht : t = 0 + · exact Or.inr (by change g t ∈ Γ.V; rwa [ht, hg0]) + · have htr : g t ∈ r := hgr t (lt_of_le_of_ne (unitInterval.nonneg t) (Ne.symm ht)) + exact Or.inl (region_subset hr htr) + have hrp : IsPathConnected r := isPathConnected_of_isOpen hS + (region_isOpen hr) (region_isPreconnected hr) (region_nonempty hr) + have hrN : r ⊆ Γ.Uᶜ ∪ Γ.V := fun _ hz => Or.inl (region_subset hr hz) + exact hp.trans ((hrp.joinedIn (g 1) (hgr 1 zero_lt_one) y hy).mono hrN) + +/-- Points in regions with intersecting closures can be joined +normally, using a common incident vertex when the regions differ. -/ +theorem joinedIn_normal_points_of_meeting_region_closures + {S : Type*} [TopologicalSpace S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) + {r s : Set S} (hr : r ∈ Γ.R) (hs : s ∈ Γ.R) + {x y : S} (hx : x ∈ r) (hy : y ∈ s) (hmeet : (closure r ∩ closure s).Nonempty) : + JoinedIn (Γ.Uᶜ ∪ Γ.V) x y := by + let : T2Space S := hS.2.1 + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨z, hzr, hzs⟩ := hmeet + by_cases hzU : z ∈ Γ.U + · have hex : ∃ v ∈ Γ.V, v ∈ closure r ∩ closure s := by + by_cases hzV : z ∈ Γ.V + · exact ⟨z, hzV, hzr, hzs⟩ + · obtain ⟨e, he, hze⟩ := Γ.exists_edge_of_mem hzU hzV + have her := edge_subset_closure_of_incident hS he hr ⟨z, hze, hzr⟩ + have hes := edge_subset_closure_of_incident hS he hs ⟨z, hze, hzs⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + refine ⟨γ e 0, ?_, ?_, ?_⟩ + · exact end_mem_V hγ he false + · exact closure_minimal her isClosed_closure (end_mem_closure hγ he false) + · exact closure_minimal hes isClosed_closure (end_mem_closure hγ he false) + obtain ⟨v, hv, hvr, hvs⟩ := hex + exact (joinedIn_normal_points_of_vertex_region hS Γ hr hv hvr hx).symm.trans + (joinedIn_normal_points_of_vertex_region hS Γ hs hv hvs hy) + · obtain ⟨t, ht, hzt⟩ := exists_region_of_notMem hzU + have heqr : t = r := by + obtain ⟨w, hwt, hwr⟩ := mem_closure_iff.mp hzr t (region_isOpen ht) hzt + exact region_eq_of_mem ht hr hwt hwr + have heqs : t = s := by + obtain ⟨w, hwt, hws⟩ := mem_closure_iff.mp hzs t (region_isOpen ht) hzt + exact region_eq_of_mem ht hs hwt hws + have hrs : r = s := heqr.symm.trans heqs + have hrp : IsPathConnected r := isPathConnected_of_isOpen hS + (region_isOpen hr) (region_isPreconnected hr) (region_nonempty hr) + have hrN : r ⊆ Γ.Uᶜ ∪ Γ.V := fun _ hz => Or.inl (region_subset hr hz) + exact (hrp.joinedIn x hx y (hrs.symm ▸ hy)).mono hrN + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3OneCuffCandidate.lean b/LeanPool/GraphMinor/GM12/Section3OneCuffCandidate.lean new file mode 100644 index 0000000000..62221d874c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3OneCuffCandidate.lean @@ -0,0 +1,101 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3NormalEssentialCircle +public import LeanPool.GraphMinor.GM12.Section3SubspaceDrawing +import LeanPool.GraphMinor.GM12.Section3NearPlanarAmbient +public import LeanPool.GraphMinor.GM12.Section3Punctured +import LeanPool.GraphMinor.GM12.Section3PuncturedSurface +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs +import LeanPool.GraphMinor.GM12.Section3CircleSchismatic +import LeanPool.GraphMinor.GM12.Section3SchismaticCandidate +import LeanPool.GraphMinor.GM12.Section3FiniteGraphSolid +import LeanPool.GraphMinor.GM11.Section6 + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# An alpha candidate with one prescribed cuff + +In the one-disc case of XII (3.1), page 245, the original surface +is not a sphere. VII (5.5) supplies a normal non-null-homotopic circle +outside the deleted disc. Any near-planar set in the punctured surface +is planar in the original surface after filling its cuff. The circle +therefore cannot be near-planar. As a normal schismatic circle, it is +an alpha candidate. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +universe u + +/-- The one-disc case of alpha-candidate existence in XII (3.1). +The only external inputs are the original VII (5.1) and (5.5). -/ +theorem exists_alphaCandidate_one_disc_of_not_sphere + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) (Γ : Drawing S) (Δ : Fin 1 → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (havoid : ∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) : + ∃ X, GM07.IsAlphaCandidate (drawingInSubspace Γ (discComplement Δ) + (drawing_support_subset_discComplement hS Γ Δ hΔ hdisj havoid)) X := by + have hnD : Γ.IsNormal (discBd (Δ 0)) := by + rintro x ⟨hxB, hxU⟩ + exact ((havoid 0 ▸ (show x ∈ Γ.U ∩ Δ 0 from + ⟨hxU, Surface.discBd_subset (Δ 0) hxB⟩)).1) + obtain ⟨F, hF, hnF, hFout, hnonnull⟩ := + exists_normal_nonnull_oArc_outside_disc hS hns Γ (hΔ 0) hnD + have hCeq : discComplement Δ = closure (Δ 0)ᶜ := by + have hΔeq : (⋃ i, Δ i) = Δ 0 := by + ext x + constructor + · intro hx + obtain ⟨i, hi⟩ := mem_iUnion.mp hx + have hi0 : i = 0 := Subsingleton.elim i 0 + exact hi0 ▸ hi + · intro hx + exact mem_iUnion.mpr ⟨0, hx⟩ + rw [discComplement, hΔeq] + have hFC : F ⊆ discComplement Δ := hCeq.symm ▸ hFout + let X := (Subtype.val : discComplement Δ → S) ⁻¹' F + have hX : IsOArc X := isOArc_subtype_preimage hFC hF + have himage : (Subtype.val : discComplement Δ → S) '' X = F := by + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hFC] + have hUC := drawing_support_subset_discComplement hS Γ Δ hΔ hdisj havoid + have hnormal : (drawingInSubspace Γ (discComplement Δ) hUC).IsNormal X := by + rintro x ⟨hx, hxU⟩ + rw [drawingInSubspace_U] at hxU + rw [drawingInSubspace_V] + exact hnF ⟨hx, hxU⟩ + have hnotnear : ¬ GM07.IsNearPlanar X := by + intro hnear + have hp := isPlanar_image_of_isNearPlanar_discComplement hS Δ hΔ hdisj hnear + rw [himage] at hp + have hproper : F ≠ univ := by + intro heq + obtain ⟨x, hx⟩ := (hΔ 0).nonempty_discInt + have hxF : x ∈ F := heq.symm ▸ mem_univ x + have hxfr : x ∈ frontier (Δ 0) := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure hx.1, hFout hxF⟩ + exact hx.2 (IsClosedDisc.frontier_eq_discBd hS (hΔ 0) ▸ hxfr) + apply hnonnull + exact (GraphMinor.GM07.gm07_theorem_5_1 S ⟨hS.1, hS.2.1, fun x => + (hS.2.2 x).isManifoldPoint⟩ inferInstance + F (isSolid_oArc hF) hproper).mp hp F hF subset_rfl + let : CompactSpace (discComplement Δ) := (discComplement_isSurface hS Δ hΔ hdisj).1 + exact ⟨X, alphaCandidate_of_normal_schismatic (isSchismatic_oArc hX hnotnear) hnormal⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3OneDisc.lean b/LeanPool/GraphMinor/GM12/Section3OneDisc.lean new file mode 100644 index 0000000000..594429f517 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3OneDisc.lean @@ -0,0 +1,100 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3OneDiscComplement +public import LeanPool.GraphMinor.GM12.Section3SphereChordTransfer +import LeanPool.GraphMinor.GM12.Section3DiscVIEmpty +import LeanPool.GraphMinor.GM12.Section3DiscCrossFree +import LeanPool.GraphMinor.GM12.Section3BoundaryEquality +import LeanPool.GraphMinor.GM12.Section3AmbientTransfer +import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# The one-disc sphere case of XII (3.2) + +Read the drawing in the complementary closed disc. Topological +feasibility makes its boundary partition cross-free. The tangle +and freeness give the normal-chord inequality there, as proved on +the sphere and preserved by inclusion. The VI (3.6) reduction now +gives the connected subdrawings. Include them back into the sphere. +This completes the last case on pages 247--248. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM06 + +/-- Graph Minors XII (3.2), pages 247--248, for one prescribed disc +on the sphere. Freeness already bounds the prescribed vertex count +by the tangle order, as used in the paper's argument. -/ +theorem theorem_3_2_one_disc + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (hs : IsSphere S) (Γ : Drawing S) {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) (Δ : Fin 1 → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) (havoid : ∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) + {p : ℕ} (Zs : Fin p → Set S) (hcover : (⋃ j, Zs j) = discBoundaryVertices Γ Δ) + (hdisZ : ∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) (hfeasible : IsTopologicallyFeasible Δ Zs) + (hfree : GM10.IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd (Δ 0))) : + HasConnectingSubdrawings Γ (discBoundaryVertices Γ Δ) Zs := by + have hdis : Pairwise (fun i j => Disjoint (Δ i) (Δ j)) := by + intro i j hij + exact False.elim (hij (Subsingleton.elim _ _)) + let C := discComplement Δ + let hUC := drawing_support_subset_discComplement hS Γ Δ hΔ hdis havoid + let G := drawingInSubspace Γ C hUC + have hDisc : GM06.IsClosedDiscSpace C := isClosedDiscSpace_discComplement_one hS hs Δ hΔ + have hGproper : G.IsProper := drawingInDiscComplement_isProper hS Γ Δ hΔ hdis havoid + have hZbd : ∀ j, Zs j ⊆ ⋃ i, discBd (Δ i) := by + intro j x hx + have hxZ := hcover.subset (mem_iUnion.mpr ⟨j, hx⟩) + obtain ⟨i, hi⟩ := mem_iUnion.mp hxZ + exact mem_iUnion.mpr ⟨i, hi.2⟩ + have hZC : ∀ j, Zs j ⊆ C := by + intro j x hx + obtain ⟨i, hi⟩ := mem_iUnion.mp (hZbd j hx) + exact disc_boundary_subset_discComplement hS Δ hΔ hdis i hi + have hGB : G.V ∩ bd C = (Subtype.val : C → S) ⁻¹' discBoundaryVertices Γ Δ := by + dsimp only [G, C] + rw [drawingInSubspace_V, discComplement_boundary_eq hS Δ hΔ] + ext x + simp only [mem_inter_iff, mem_preimage, mem_iUnion, discBoundaryVertices] + constructor + · rintro ⟨hv, i, hi⟩ + exact ⟨i, hv, hi⟩ + · rintro ⟨i, hv, hi⟩ + exact ⟨hv, i, hi⟩ + have hcoverC : (⋃ j, (Subtype.val : C → S) ⁻¹' Zs j) = G.V ∩ bd C := by + rw [hGB, ← hcover] + ext x + simp only [mem_iUnion, mem_preimage] + have hCF := isCrossFree_of_topological_feasible_in_discComplement hS Δ hΔ hdis Zs + hZbd hfeasible hDisc + have hunionBd : (⋃ i, discBd (Δ i)) = discBd (Δ 0) := by + ext x + simp only [mem_iUnion, Fin.exists_fin_one] + have hbdC : bd C = (Subtype.val : C → S) ⁻¹' discBd (Δ 0) := by + have h := discComplement_boundary_eq hS Δ hΔ + rw [hunionBd] at h + exact h + have hCΔ : C ∩ Δ 0 = discBd (Δ 0) := by + apply Subset.antisymm (discComplement_inter_disc_subset_boundary hS Δ hΔ 0) + intro x hx + exact ⟨disc_boundary_subset_discComplement hS Δ hΔ hdis 0 hx, Surface.discBd_subset _ hx⟩ + have hconnect := connecting_subdrawings_of_disc_chord_bound_allowing_empty G hDisc hGproper + (fun j => (Subtype.val : C → S) ⁻¹' Zs j) hcoverC + (fun i j hij => (hdisZ i j hij).preimage Subtype.val) hCF + (sphere_chord_bound_in_complement hS hs Γ hT (hΔ 0) (havoid 0) hfree C hUC hbdC hCΔ) + rw [hGB] at hconnect + exact hasConnectingSubdrawings_from_closed_subspace Γ C isClosed_closure hUC hZC hconnect + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3OneDiscComplement.lean b/LeanPool/GraphMinor/GM12/Section3OneDiscComplement.lean new file mode 100644 index 0000000000..4b58e048da --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3OneDiscComplement.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3PuncturedBoundary +public import LeanPool.GraphMinor.GM06.Defs +public import LeanPool.GraphMinor.Surface.TopologyStatements +import LeanPool.GraphMinor.Surface.SphereDisc +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# The complement of one prescribed disc on the sphere + +For the last case of XII (3.2), page 247, the punctured surface is +a closed disc. The sphere-disc theorem gives the disc on the other +side of the prescribed boundary circle. It is the closure of the +prescribed disc's complement, and has that same boundary circle. +Thus VI (3.6) applies to the drawing in this complementary disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- On the sphere, the closed complement of a closed disc is a closed +disc with the same boundary, as used in XII (3.2), page 247. -/ +theorem isClosedDisc_closure_compl_of_sphere + {S : Type*} [TopologicalSpace S] [T2Space S] (hS : IsClosedSurface S) (hs : IsSphere S) + {Δ : Set S} (hΔ : IsClosedDisc Δ) : + IsClosedDisc (closure (univ \ Δ)) ∧ discBd (closure (univ \ Δ)) = discBd Δ := by + obtain ⟨D, E, _, hD, hE, hbD, hbE, hU, hcap, _, huniq⟩ := + sphere_disc S hs (discBd Δ) hΔ.isOArc_discBd + have hex : ∃ E : Set S, IsClosedDisc E ∧ discBd E = discBd Δ ∧ + Δ ∪ E = univ ∧ Δ ∩ E = discBd Δ := by + rcases huniq Δ hΔ rfl with h | h + · exact ⟨E, hE, hbE, h ▸ hU, h ▸ hcap⟩ + · refine ⟨D, hD, hbD, ?_, ?_⟩ + · rw [h, union_comm] + exact hU + · exact (congrArg (fun X : Set S => X ∩ D) h).trans + ((inter_comm E D).trans hcap) + obtain ⟨E, hE, hbE, hU, hcap⟩ := hex + have hCE : closure (univ \ Δ) = E := by + apply Subset.antisymm + · apply closure_minimal _ hE.isCompact.isClosed + intro x hx + have h := hU.symm.subset (mem_univ x) + exact h.resolve_left hx.2 + · intro x hxE + by_cases hxΔ : x ∈ Δ + · have hxB := hcap.subset ⟨hxΔ, hxE⟩ + rw [← IsClosedDisc.frontier_eq_discBd hS hΔ, frontier_eq_closure_inter_closure, + compl_eq_univ_sdiff] at hxB + exact hxB.2 + · exact subset_closure ⟨mem_univ _, hxΔ⟩ + rw [hCE] + exact ⟨hE, hbE⟩ + +/-- The punctured sphere with one deleted disc is a closed disc +space, in the original objects of VI (3.6). -/ +theorem isClosedDiscSpace_discComplement_one + {S : Type*} [TopologicalSpace S] [T2Space S] (hS : IsClosedSurface S) (hs : IsSphere S) + (Δ : Fin 1 → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) : + GM06.IsClosedDiscSpace (discComplement Δ) := by + have hsingle : (⋃ i, Δ i) = Δ 0 := by + ext x + simp only [mem_iUnion, Fin.exists_fin_one] + have hcomp : discComplement Δ = closure (univ \ Δ 0) := by + rw [discComplement, hsingle, compl_eq_univ_sdiff] + change Nonempty (ClosedUnitDisc ≃ₜ discComplement Δ) + rw [hcomp] + exact (isClosedDisc_closure_compl_of_sphere hS hs (hΔ 0)).1 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3OutsideDiscRegions.lean b/LeanPool/GraphMinor/GM12/Section3OutsideDiscRegions.lean new file mode 100644 index 0000000000..6b94f468f9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3OutsideDiscRegions.lean @@ -0,0 +1,60 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.CircuitRegions +import LeanPool.GraphMinor.GM11.Section4c + +/-! +# The outside of a disc as a union of regions + +For the one-cuff candidate-existence argument used by XII (3.1), +page 245, add the disc boundary to the drawing. Each region meeting +the outside of the disc stays outside, since a connected region +cannot cross the boundary. Drawing carriers have empty interior, so +the outside regions are dense in the outside of the disc. Their +union therefore has the required disc complement as its closure. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- When a closed set's frontier belongs to a drawing, the closure +of its complement is the closure of the union of outside regions. -/ +theorem closure_compl_eq_closure_outside_regions + {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) (G : Drawing S) {D : Set S} (hD : IsClosed D) + (hbd : frontier D ⊆ G.U) : + closure Dᶜ = closure (⋃₀ {r ∈ G.R | Disjoint r D}) := by + let : T2Space S := hS.2.1 + apply Subset.antisymm + · apply closure_minimal + · intro x hx + apply mem_closure_iff.mpr + intro O hO hxO + obtain ⟨y, hy, hyU⟩ := exists_notMem_U (Γ := G) hS + (hO.inter hD.isOpen_compl) ⟨x, hxO, hx⟩ + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem hyU + have hdis : Disjoint r D := by + have hrf : Disjoint r (frontier D) := disjoint_left.mpr + (fun z hz hzfr => region_subset hr hz (hbd hzfr)) + rcases subset_or_disjoint_of_frontier hD (region_isPreconnected hr) hrf with hin | hout + · exact (hy.2 (hin hyr)).elim + · exact hout + exact ⟨y, hy.1, r, ⟨hr, hdis⟩, hyr⟩ + · exact isClosed_closure + · apply closure_mono + rintro x ⟨r, ⟨_, hdis⟩, hxr⟩ + exact disjoint_left.mp hdis hxr + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ParameterGaps.lean b/LeanPool/GraphMinor/GM12/Section3ParameterGaps.lean new file mode 100644 index 0000000000..3b150a35de --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ParameterGaps.lean @@ -0,0 +1,144 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import Mathlib.Topology.Order.Compact + +/-! +# Gaps between contacts with a closed set + +For the finite chord reduction in the extraction used by XII (3.1), +page 245, put the two ends of an injective path on the first circle. +At a parameter outside the circle, take the last contact before it +and the first contact after it. The resulting interval is a complete +chord. A retained initial or final piece with no intervening contact +lies in this same chord. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- A closed subset of the unit interval containing both ends has a +maximal open gap around each point of its complement. -/ +theorem exists_closed_parameter_gap + {K : Set unitInterval} (hK : IsClosed K) (h0 : 0 ∈ K) (h1 : 1 ∈ K) + {t : unitInterval} (ht : t ∉ K) : + ∃ a b, a < t ∧ t < b ∧ a ∈ K ∧ b ∈ K ∧ Disjoint (Ioo a b) K := by + obtain ⟨a, ⟨ha, hat⟩, hmax⟩ := + (hK.inter isClosed_Iic).isCompact.exists_isGreatest + (show (K ∩ Iic t).Nonempty from ⟨0, h0, unitInterval.nonneg t⟩) + obtain ⟨b, ⟨hb, htb⟩, hmin⟩ := + (hK.inter isClosed_Ici).isCompact.exists_isLeast + (show (K ∩ Ici t).Nonempty from ⟨1, h1, unitInterval.le_one t⟩) + have hat' : a < t := lt_of_le_of_ne hat (fun he => ht (he ▸ ha)) + have htb' : t < b := lt_of_le_of_ne htb (fun he => ht (he.symm ▸ hb)) + refine ⟨a, b, hat', htb', ha, hb, disjoint_left.mpr ?_⟩ + intro z hz hzK + rcases le_total z t with hzt | htz + · exact hz.1.not_ge (hmax ⟨hzK, hzt⟩) + · exact hz.2.not_ge (hmin ⟨hzK, htz⟩) + +/-- An interval starting inside a gap and meeting the closed set only +possibly at its final point cannot run past the end of that gap. -/ +theorem parameter_segment_subset_gap_of_final_contact + {K : Set unitInterval} {a b t v : unitInterval} + (hat : a ≤ t) (htb : t < b) (hb : b ∈ K) + (hcontact : ∀ z ∈ Icc t v, z ∈ K → z = v) : Icc t v ⊆ Icc a b := by + have hvb : v ≤ b := by + by_contra hn + have hbv : b < v := lt_of_not_ge hn + exact hbv.ne (hcontact b ⟨htb.le, hbv.le⟩ hb) + exact Icc_subset_Icc hat hvb + +/-- The reversed interval version: a retained final piece meeting the +closed set only possibly at its initial point stays in the same gap. -/ +theorem parameter_segment_subset_gap_of_initial_contact + {K : Set unitInterval} {a b t v : unitInterval} + (hat : a < t) (htb : t ≤ b) (ha : a ∈ K) + (hcontact : ∀ z ∈ Icc v t, z ∈ K → z = v) : Icc v t ⊆ Icc a b := by + have hav : a ≤ v := by + by_contra hn + have hva : v < a := lt_of_not_ge hn + exact hva.ne' (hcontact a ⟨hva.le, hat.le⟩ ha) + exact Icc_subset_Icc hav htb + +/-- A contact is represented by a degenerate interval; every other +parameter is represented by the complete gap containing it. -/ +theorem exists_parameter_gap_or_contact + {K : Set unitInterval} (hK : IsClosed K) (h0 : 0 ∈ K) (h1 : 1 ∈ K) + (t : unitInterval) : + ∃ a b, a ≤ t ∧ t ≤ b ∧ a ∈ K ∧ b ∈ K ∧ Disjoint (Ioo a b) K ∧ + (t ∈ K → a = t ∧ b = t) := by + by_cases ht : t ∈ K + · exact ⟨t, t, le_rfl, le_rfl, ht, ht, by simp, fun _ => ⟨rfl, rfl⟩⟩ + · obtain ⟨a, b, hat, htb, ha, hb, hgap⟩ := exists_closed_parameter_gap hK h0 h1 ht + exact ⟨a, b, hat.le, htb.le, ha, hb, hgap, fun h => (ht h).elim⟩ + +/-- A retained initial segment belongs to the contact set or to the +complete gap at its initial parameter. -/ +theorem parameter_segment_subset_contacts_union_gap_left + {K : Set unitInterval} {a b t v : unitInterval} + (hat : a ≤ t) (htb : t ≤ b) (hb : b ∈ K) + (hcontact : ∀ z ∈ Icc t v, z ∈ K → z = v) : + Icc t v ⊆ K ∪ Icc a b := by + by_cases ht : t ∈ K + · intro z hz + have htv : t = v := hcontact t ⟨le_rfl, hz.1.trans hz.2⟩ ht + have hzt : z = t := le_antisymm (hz.2.trans_eq htv.symm) hz.1 + exact Or.inl (hzt.symm ▸ ht) + · have htb' : t < b := lt_of_le_of_ne htb (fun he => ht (he.symm ▸ hb)) + exact (parameter_segment_subset_gap_of_final_contact hat htb' hb hcontact).trans + subset_union_right + +/-- A retained final segment belongs to the contact set or to the +complete gap at its final parameter. -/ +theorem parameter_segment_subset_contacts_union_gap_right + {K : Set unitInterval} {a b t v : unitInterval} + (hat : a ≤ t) (htb : t ≤ b) (ha : a ∈ K) + (hcontact : ∀ z ∈ Icc v t, z ∈ K → z = v) : + Icc v t ⊆ K ∪ Icc a b := by + by_cases ht : t ∈ K + · intro z hz + have htv : t = v := hcontact t ⟨hz.1.trans hz.2, le_rfl⟩ ht + have hzt : z = t := le_antisymm hz.2 (htv.trans_le hz.1) + exact Or.inl (hzt.symm ▸ ht) + · have hat' : a < t := lt_of_le_of_ne hat (fun he => ht (he ▸ ha)) + exact (parameter_segment_subset_gap_of_initial_contact hat' htb ha hcontact).trans + subset_union_right + +/-- Distinct complete gaps meet only at contacts. Non-contact points +in two closed gap intervals force both endpoint pairs to coincide. -/ +theorem parameter_gaps_intersection_subset_contacts + {K : Set unitInterval} {a b c d : unitInterval} + (ha : a ∈ K) (hb : b ∈ K) (hc : c ∈ K) (hd : d ∈ K) + (hgap : Disjoint (Ioo a b) K) (hgap' : Disjoint (Ioo c d) K) + (hne : (a, b) ≠ (c, d)) : Icc a b ∩ Icc c d ⊆ K := by + rintro x ⟨hx, hx'⟩ + by_contra hxK + have hax : a < x := lt_of_le_of_ne hx.1 (fun he => hxK (he ▸ ha)) + have hxb : x < b := lt_of_le_of_ne hx.2 (fun he => hxK (he.symm ▸ hb)) + have hcx : c < x := lt_of_le_of_ne hx'.1 (fun he => hxK (he ▸ hc)) + have hxd : x < d := lt_of_le_of_ne hx'.2 (fun he => hxK (he.symm ▸ hd)) + have hac : a = c := by + rcases lt_trichotomy a c with hac | hac | hca + · exact (disjoint_left.mp hgap ⟨hac, hcx.trans hxb⟩ hc).elim + · exact hac + · exact (disjoint_left.mp hgap' ⟨hca, hax.trans hxd⟩ ha).elim + have hbd : b = d := by + rcases lt_trichotomy b d with hbd | hbd | hdb + · exact (disjoint_left.mp hgap' ⟨hcx.trans hxb, hbd⟩ hb).elim + · exact hbd + · exact (disjoint_left.mp hgap ⟨hax.trans hxd, hdb⟩ hd).elim + exact hne (Prod.ext hac hbd) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3PartialPlanarity.lean b/LeanPool/GraphMinor/GM12/Section3PartialPlanarity.lean new file mode 100644 index 0000000000..b433703c1f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3PartialPlanarity.lean @@ -0,0 +1,51 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CapOneDisc +public import LeanPool.GraphMinor.GM12.Section3CapComparison +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs + +/-! +# Planarity inside a partial fill + +For the three-branch case of XII (3.1), page 245, a disc enclosing one +cuff cannot contain the whole schismatic set. Any set contained in +such a disc would be planar after that cuff is filled, hence near-planar. +The constructed cap and cap independence prove this for arbitrary sets. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A set lying in a disc in a partial fill is near-planar in the +original punctured surface. The cap is constructed rather than assumed. -/ +theorem isNearPlanar_of_image_subset_disc_in_partial_fill + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) (i : ι) + {X : Set (discComplement Δ)} {D : Set S} (hD : IsClosedDisc D) + (hDT : D ⊆ discComplement (fun k : {k // k ≠ i} => Δ k.val)) + (hXD : (Subtype.val : discComplement Δ → S) '' X ⊆ D) : + GM07.IsNearPlanar X := by + obtain ⟨j, hj, hjval⟩ := exists_cap_discComplement_cuff hS Δ hΔ hdisj i + have hp : IsPlanar (j '' X) := by + refine ⟨Subtype.val ⁻¹' D, (isClosedDisc_subtype_preimage hDT hD).1, ?_⟩ + rintro y ⟨x, hx, rfl⟩ + change (j x).val ∈ D + rw [hjval] + exact hXD (mem_image_of_mem Subtype.val hx) + exact Or.inr ⟨_, hj.cuff, + isPlanarInCappedCuff_of_one_cap (discComplement_isSurface hS Δ hΔ hdisj) hj hp⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3PathConcatenation.lean b/LeanPool/GraphMinor/GM12/Section3PathConcatenation.lean new file mode 100644 index 0000000000..b74509aefe --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3PathConcatenation.lean @@ -0,0 +1,110 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Topology.Subpath +import Mathlib.Data.Fintype.Pi + +/-! +# Concatenating the local reroutings + +The finite local replacements in the circle-intersection step used by +XII (3.1), page 245, preserve the global path homotopy. Concatenation +preserves the homotopies of its pieces, and the concatenation of the +original subpaths is homotopic to the original path. Its range stays +in the union of the new piece ranges and the initial point. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- A finite path concatenation stays in any set containing its start +and the ranges of all of its pieces. This also covers the empty family. -/ +theorem range_path_concat_subset + {S : Type*} [TopologicalSpace S] {n : ℕ} (v : Fin (n + 1) → S) + (q : ∀ i : Fin n, Path (v i.castSucc) (v i.succ)) {X : Set S} + (hv : v 0 ∈ X) (hq : ∀ i, range (q i) ⊆ X) : range (Path.concat v q) ⊆ X := by + induction n with + | zero => + rw [Path.concat_zero] + rintro x ⟨r, rfl⟩ + exact hv + | succ n ih => + have hbound : range ((Path.concat (v ∘ Fin.castSucc) (fun i => q i.castSucc)).trans + (q (Fin.last n))) ⊆ X := by + rw [Path.trans_range] + exact union_subset (ih (v ∘ Fin.castSucc) (fun i => q i.castSucc) hv + (fun i => hq i.castSucc)) (hq (Fin.last n)) + have heq := congrArg (fun γ : Path (v 0) (v (Fin.last (n + 1))) => range γ) + (Path.concat_succ v q) + exact heq.subset.trans hbound + +/-- The exact range of a finite path concatenation is its starting +point together with the ranges of its pieces. -/ +theorem range_path_concat + {S : Type*} [TopologicalSpace S] {n : ℕ} (v : Fin (n + 1) → S) + (q : ∀ i : Fin n, Path (v i.castSucc) (v i.succ)) : + range (Path.concat v q) = {v 0} ∪ ⋃ i, range (q i) := by + induction n with + | zero => + rw [Path.concat_zero, Path.refl_range] + simp only [iUnion_of_empty, union_empty] + | succ n ih => + have heq := congrArg (fun γ : Path (v 0) (v (Fin.last (n + 1))) => range γ) + (Path.concat_succ v q) + calc + range (Path.concat v q) = range (Path.concat (v ∘ Fin.castSucc) (fun i => q i.castSucc)) ∪ + range (q (Fin.last n)) := heq.trans (Path.trans_range _ _) + _ = ({v 0} ∪ ⋃ i : Fin n, range (q i.castSucc)) ∪ range (q (Fin.last n)) := + congrArg (fun X => X ∪ range (q (Fin.last n))) (ih (v ∘ Fin.castSucc) (fun i + => q i.castSucc)) + _ = {v 0} ∪ ⋃ i : Fin (n + 1), range (q i) := by + rw [Set.iUnion_fin_add_one_eq_iUnion_castSucc] + exact union_assoc _ _ _ + +/-- Homotopies of finitely many subpath replacements concatenate to +a homotopy of the original path with its original endpoints. -/ +theorem exists_homotopic_path_with_piecewise_range + {S : Type*} [TopologicalSpace S] {a b : S} (p : Path a b) + {n : ℕ} (t : Fin (n + 1) → unitInterval) (ht0 : t 0 = 0) (ht1 : t (Fin.last n) = 1) + (q : ∀ i : Fin n, Path (p (t i.castSucc)) (p (t i.succ))) + (hh : ∀ i, (p.subpath (t i.castSucc) (t i.succ)).Homotopic (q i)) : + ∃ r : Path a b, p.Homotopic r ∧ range r = {p 0} ∪ ⋃ i, range (q i) := by + let c := Path.concat (p ∘ t) q + have hsource : a = p (t 0) := by rw [ht0, p.source] + have htarget : b = p (t (Fin.last n)) := by rw [ht1, p.target] + let r : Path a b := c.cast hsource htarget + have hsub := Path.Homotopic.concat_subpath p t + have hcomp := Path.Homotopic.concat_hcomp (p ∘ t) + (fun i => p.subpath (t i.castSucc) (t i.succ)) q hh + have hcast := (hsub.symm.trans hcomp).pathCast hsource htarget + have heq : ((p.subpath (t 0) (t (Fin.last n))).cast hsource htarget) = p := by + ext s + change (p.subpath (t 0) (t (Fin.last n))) s = p s + rw [ht0, ht1, Path.subpath_zero_one] + rfl + rw [heq] at hcast + refine ⟨r, hcast, ?_⟩ + change range c = _ + simpa only [Function.comp_apply, ht0] using range_path_concat (p ∘ t) q + +/-- The range-bound form of the finite fixed-end homotopy concatenation. -/ +theorem exists_homotopic_path_of_piecewise_reroutes + {S : Type*} [TopologicalSpace S] {a b : S} (p : Path a b) + {n : ℕ} (t : Fin (n + 1) → unitInterval) (ht0 : t 0 = 0) (ht1 : t (Fin.last n) = 1) + (q : ∀ i : Fin n, Path (p (t i.castSucc)) (p (t i.succ))) + (hh : ∀ i, (p.subpath (t i.castSucc) (t i.succ)).Homotopic (q i)) : + ∃ r : Path a b, p.Homotopic r ∧ range r ⊆ {p 0} ∪ ⋃ i, range (q i) := by + obtain ⟨r, hr, heq⟩ := exists_homotopic_path_with_piecewise_range p t ht0 ht1 q hh + exact ⟨r, hr, heq.le⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3PathIntoCircle.lean b/LeanPool/GraphMinor/GM12/Section3PathIntoCircle.lean new file mode 100644 index 0000000000..715c80aab5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3PathIntoCircle.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3DistinctCompleteChords +public import LeanPool.GraphMinor.GM12.Section3PlanarChordHomotopy +import LeanPool.GraphMinor.GM12.Section3FiniteChordHomotopy +import LeanPool.GraphMinor.GM12.Section3FiniteGraphSolid + +/-! +# Moving a path into a circle using its planar chords + +For the extraction used by XII (3.1), page 245, first replace the +injective path by a homotopic path in the circle and finitely many +complete chords. Planarity of each chord together with the circle +makes that chord homotopic into the circle. Their interiors are +disjoint, so finite chord removal moves the entire path into the +circle without changing its fixed-end homotopy class. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- If every complete chord of an injective path is planar together +with the circle after an embedding, the image path is homotopic into +the image circle. -/ +theorem exists_homotopic_path_in_circle_of_planar_chords + {S T : Type*} [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] + (hS : IsSurface S) {F : Set S} (hF : IsOArc F) + {a b : S} (p : Path a b) (hpi : Function.Injective p) (ha : a ∈ F) (hb : b ∈ F) + (j : C(S, T)) (hj : IsEmbedding j) + (hchord : ∀ l r : unitInterval, l < r → p l ∈ F → p r ∈ F → + Disjoint (p '' Ioo l r) F → IsPlanar (j '' (F ∪ p '' Icc l r))) : + ∃ r : Path (j a) (j b), (p.map j.continuous).Homotopic r ∧ range r ⊆ j '' F := by + classical + obtain ⟨J, q, hpq, hq, hvalid, hdisj⟩ := + exists_homotopic_path_in_distinct_complete_chords hS (isSolid_oArc hF) p hpi ha hb + let I := {g : unitInterval × unitInterval // g ∈ J} + let : Fintype I := J.finite_toSet.fintype + let c₀ : ∀ i : I, Path (p i.val.1) (p i.val.2) := fun i => p.subpath i.val.1 i.val.2 + let c : ∀ i : I, Path (j (p i.val.1)) (j (p i.val.2)) := fun i => (c₀ i).map j.continuous + have hc₀i : ∀ i : I, Function.Injective (c₀ i) := by + intro i + exact hpi.comp (lerpI_injective (hvalid i.val i.property).1.ne) + have hci : ∀ i : I, Function.Injective (c i) := fun i => hj.injective.comp (hc₀i i) + have hc₀range : ∀ i : I, range (c₀ i) = p '' Icc i.val.1 i.val.2 := + fun i => Path.range_subpath_of_le p _ _ (hvalid i.val i.property).1.le + have hcrange : ∀ i : I, range (c i) = j '' (p '' Icc i.val.1 i.val.2) := by + intro i + change range (j ∘ c₀ i) = _ + rw [range_comp, hc₀range] + have hex : ∀ i : I, ∃ r : Path (j (p i.val.1)) (j (p i.val.2)), + (c i).Homotopic r ∧ range r ⊆ j '' F := by + intro i + have hi := hvalid i.val i.property + have hplan := hchord i.val.1 i.val.2 hi.1 hi.2.1 hi.2.2.1 hi.2.2.2 + rw [← hc₀range i] at hplan + exact exists_homotopic_path_in_oArc_of_planar_chord hF (c₀ i) (hc₀i i) + hi.2.1 hi.2.2.1 j hplan + choose r hcr hrF using hex + have hmeet : ∀ i : I, range (c i) ∩ (j '' F) ⊆ {j (p i.val.1), j (p i.val.2)} := by + intro i z hz + rw [hcrange] at hz + obtain ⟨w, ⟨t, ht, rfl⟩, rfl⟩ := hz.1 + obtain ⟨v, hvF, he⟩ := hz.2 + have hpF : p t ∈ F := (hj.injective he) ▸ hvF + have hi := hvalid i.val i.property + by_cases htl : t = i.val.1 + · exact Or.inl (congrArg (fun t => j (p t)) htl) + · by_cases htr : t = i.val.2 + · exact Or.inr (congrArg (fun t => j (p t)) htr) + · have htopen : t ∈ Ioo i.val.1 i.val.2 := + ⟨lt_of_le_of_ne ht.1 (Ne.symm htl), lt_of_le_of_ne ht.2 htr⟩ + exact (disjoint_left.mp hi.2.2.2 ⟨t, htopen, rfl⟩ hpF).elim + have hdisj' : ∀ i k : I, i ≠ k → range (c i) ∩ range (c k) ⊆ j '' F := by + intro i k hik z hz + rw [hcrange i, hcrange k] at hz + obtain ⟨v, hv, rfl⟩ := hz.1 + obtain ⟨w, hw, he⟩ := hz.2 + have hwv : w = v := hj.injective he + have hiv : i.val ≠ k.val := fun he => hik (Subtype.ext he) + exact ⟨v, hdisj i.val i.property k.val k.property hiv ⟨hv, hwv ▸ hw⟩, rfl⟩ + have hq' : range (q.map j.continuous) ⊆ + (j '' F) ∪ ⋃ i ∈ (Finset.univ : Finset I), range (c i) := by + rintro z ⟨t, rfl⟩ + rcases hq (mem_range_self t) with htF | htJ + · exact Or.inl ⟨q t, htF, rfl⟩ + · obtain ⟨g, hg, htg⟩ := mem_iUnion₂.mp htJ + let i : I := ⟨g, hg⟩ + exact Or.inr (mem_iUnion₂.mpr ⟨i, Finset.mem_univ i, + (hcrange i).symm ▸ (show j (q t) ∈ j '' (p '' Icc g.1 g.2) from ⟨q t, htg, rfl⟩)⟩) + obtain ⟨r', hqr', hr'⟩ := exists_homotopic_path_in_base_of_finite_chords + (hF.isCompact.image j.continuous).isClosed (fun i : I => j (p i.val.1)) + (fun i : I => j (p i.val.2)) c r hci hmeet hdisj' hcr hrF Finset.univ + (q.map j.continuous) ⟨a, ha, rfl⟩ ⟨b, hb, rfl⟩ hq' + exact ⟨r', (hpq.map j).trans hqr', hr'⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3PlanarChordHomotopy.lean b/LeanPool/GraphMinor/GM12/Section3PlanarChordHomotopy.lean new file mode 100644 index 0000000000..e50e37655c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3PlanarChordHomotopy.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ThetaHomotopy +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.GM12.Section3PlanarityMaps + +/-! +# A planar chord is homotopic into its circle + +In the extraction used by XII (3.1), page 245, a cap making the first +circle and a chord planar also makes the chord homotopic to one arc +of that circle. Choose an arc between the chord endpoints and apply +the fixed-end homotopy inside the containing disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A planar image of a circle and injective chord makes that chord +homotopic to a path in the image of the circle. -/ +theorem exists_homotopic_path_in_oArc_of_planar_chord + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + {F : Set S} (hF : IsOArc F) {a b : S} (c : Path a b) + (hci : Function.Injective c) (ha : a ∈ F) (hb : b ∈ F) (j : C(S, T)) + (hplan : IsPlanar (j '' (F ∪ range c))) : + ∃ r : Path (j a) (j b), (c.map j.continuous).Homotopic r ∧ range r ⊆ j '' F := by + have hab : a ≠ b := by + intro heq + have he : c 0 = c 1 := c.source.trans (heq.trans c.target.symm) + exact zero_ne_one (hci he) + obtain ⟨f, g, hfg, hf0, hf1, hfgF⟩ := hF.exists_arcs ha hb hab + let r₀ : Path a b := { + toFun := f + continuous_toFun := hfg.arc_left.1 + source' := hf0 + target' := hf1 } + let r := r₀.map j.continuous + have hr₀ : range r₀ ⊆ F := hfgF ▸ subset_union_left + have hr : range r ⊆ j '' F := by + change range (j ∘ r₀) ⊆ j '' F + rw [range_comp] + exact image_mono hr₀ + refine ⟨r, paths_homotopic_of_planar_union (c.map j.continuous) r + (isPlanar_mono ?_ hplan), hr⟩ + apply union_subset + · change range (j ∘ c) ⊆ j '' (F ∪ range c) + rw [range_comp] + exact image_mono subset_union_right + · exact hr.trans (image_mono subset_union_left) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3PlanarHomotopicCircle.lean b/LeanPool/GraphMinor/GM12/Section3PlanarHomotopicCircle.lean new file mode 100644 index 0000000000..aac61e7727 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3PlanarHomotopicCircle.lean @@ -0,0 +1,112 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Cited +public import LeanPool.GraphMinor.Surface.DiscGrow +public import LeanPool.GraphMinor.GM12.Section3CapTopology +public import LeanPool.GraphMinor.GM12.Section3CapComparison +public import LeanPool.GraphMinor.GM12.Section3CircleInclusion +import LeanPool.GraphMinor.GM12.Section3ThetaHomotopy +import LeanPool.GraphMinor.GM12.Section3PlanarityMaps +import LeanPool.GraphMinor.GM12.Section3FiniteGraphSolid +import LeanPool.GraphMinor.GM12.Section2ArcHomotopy + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Reading a preserved circle homotopy inside a cap + +The finite graph in the circle-intersection step used by XII (3.1), +page 245, retains two fixed-end path homotopies from the second circle. +If the new paths lie in a planar set, they are homotopic through its +containing disc. The original circle is therefore null-homotopic. +VII (5.1) makes a proper null-homotopic circle planar. In a cap, +properness follows from the added disc interior, and cap comparison +supplies the universal planarity condition. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +universe u + +/-- A proper null-homotopic circle is planar, by VII (5.1). +Its only subcircle is itself, and circles are solid. -/ +theorem planar_oArc_of_null + {S : Type u} [TopologicalSpace S] (hS : IsSurface S) (hconn : ConnectedSpace S) + {A : Set S} (hA : IsOArc A) (hproper : A ≠ univ) (hnull : IsNullHomotopicOArc A) : + IsPlanar A := by + let := hS.2.1 + apply (GraphMinor.GM07.gm07_theorem_5_1 S hS hconn A (isSolid_oArc hA) hproper).mpr + intro Z hZ hZA + rw [oArc_eq_of_subset hZ hA hZA] + exact hnull + +/-- If the two arcs of a circle are homotopic to paths in one planar +set, the original circle is null-homotopic. -/ +theorem null_circle_of_homotopic_paths_in_planar_set + {S : Type*} [TopologicalSpace S] [T2Space S] + {x y : S} (p q r s : Path x y) (hPQ : IsTwoArcs p q) {A G : Set S} + (hAeq : range p ∪ range q = A) (hpr : p.Homotopic r) (hqs : q.Homotopic s) + (hpaths : range r ∪ range s ⊆ G) (hplan : IsPlanar G) : IsNullHomotopicOArc A := by + have hrs := paths_homotopic_of_planar_union r s (isPlanar_mono hpaths hplan) + have hpq : p.Homotopic q := hpr.trans (hrs.trans hqs.symm) + have hnull := nullHomotopic_union_of_homotopic_arcs p q hPQ.arc_left.2 hPQ.arc_right.2 hPQ.meet + hpq + rw [hAeq] at hnull + exact hnull + +/-- Preserving the two arc homotopies of a circle inside a set makes +planarity of that set in a cap imply planarity of the original circle +in the same cap. -/ +theorem planarInCappedCuff_of_homotopic_paths + {S : Type u} [TopologicalSpace S] [ConnectedSpace S] (hS : IsSurface S) + {x y : S} (p q r s : Path x y) (hPQ : IsTwoArcs p q) {A G C : Set S} + (hA : IsOArc A) (hAeq : range p ∪ range q = A) + (hpr : p.Homotopic r) (hqs : q.Homotopic s) (hpaths : range r ∪ range s ⊆ G) + (hplan : GM07.IsPlanarInCappedCuff C G) : GM07.IsPlanarInCappedCuff C A := by + obtain ⟨T, tT, j, D, hcap⟩ := exists_cappedCuff hS hplan.1 + let := tT + let : T2Space T := hcap.isSurface.2.1 + have hconn : ConnectedSpace T := cappedCuff_connectedSpace hcap + let J : C(S, T) := ⟨j, hcap.isEmbedding.continuous⟩ + have hrange : ∀ v : Path x y, range (v.map J.continuous) = j '' range v := + fun v => Set.range_comp j v + have hPQ' : IsTwoArcs (p.map J.continuous) (q.map J.continuous) := by + refine ⟨⟨(p.map J.continuous).continuous, hcap.isEmbedding.injective.comp hPQ.arc_left.2⟩, + ⟨(q.map J.continuous).continuous, hcap.isEmbedding.injective.comp hPQ.arc_right.2⟩, + congrArg j hPQ.zero, congrArg j hPQ.one, ?_⟩ + intro a b he + exact hPQ.meet a b (hcap.isEmbedding.injective he) + have hAeq' : range (p.map J.continuous) ∪ range (q.map J.continuous) = j '' A := by + rw [hrange, hrange, ← image_union, hAeq] + have hpaths' : range (r.map J.continuous) ∪ range (s.map J.continuous) ⊆ j '' G := by + rw [hrange, hrange, ← image_union] + exact image_mono hpaths + have hnull := null_circle_of_homotopic_paths_in_planar_set + (p.map J.continuous) (q.map J.continuous) (r.map J.continuous) (s.map J.continuous) + hPQ' hAeq' (hpr.map J) (hqs.map J) hpaths' (hplan.2.2 T j D hcap) + have hAo : IsOArc (j '' A) := by + obtain ⟨e⟩ := hA + exact ⟨e.trans (hcap.isEmbedding.homeomorphImage A)⟩ + have hproper : j '' A ≠ univ := by + intro heq + apply cappedCuff_range_ne_univ hcap + apply Set.eq_univ_of_univ_subset + rw [← heq] + exact image_subset_range _ _ + exact isPlanarInCappedCuff_of_one_cap hS hcap + (planar_oArc_of_null hcap.isSurface hconn hAo hproper hnull) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3PlanarityMaps.lean b/LeanPool/GraphMinor/GM12/Section3PlanarityMaps.lean new file mode 100644 index 0000000000..eca78e2061 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3PlanarityMaps.lean @@ -0,0 +1,72 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CapTopology +public import LeanPool.GraphMinor.GM12.Section3CapComparison +import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! +# Planarity under inclusion and embeddings + +For the Section 8 argument of VII used in XII (3.1), page 245, +planarity and near-planarity pass to subsets. Embeddings carry a +containing disc to a containing disc. In particular, a planar set is +planar after any chosen cuff is filled. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +universe u + +/-- A subset of a planar set lies in the same containing disc. -/ +theorem isPlanar_mono {S : Type*} [TopologicalSpace S] {X Y : Set S} + (hXY : X ⊆ Y) (hY : IsPlanar Y) : IsPlanar X := by + obtain ⟨D, hD, hYD⟩ := hY + exact ⟨D, hD, hXY.trans hYD⟩ + +/-- An embedding carries a planar set into the image of its containing disc. -/ +theorem isPlanar_image_isEmbedding + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + {j : S → T} (hj : IsEmbedding j) {X : Set S} (hX : IsPlanar X) : IsPlanar (j '' X) := by + obtain ⟨D, hD, hXD⟩ := hX + obtain ⟨φ⟩ := hD + exact ⟨j '' D, ⟨φ.trans (hj.homeomorphImage D)⟩, image_mono hXD⟩ + +/-- Planarity after filling a cuff passes to subsets in every cap. -/ +theorem isPlanarInCappedCuff_mono + {S : Type u} [TopologicalSpace S] {C X Y : Set S} + (hXY : X ⊆ Y) (hY : GM07.IsPlanarInCappedCuff C Y) : GM07.IsPlanarInCappedCuff C X := by + refine ⟨hY.1, ?_, ?_⟩ + · obtain ⟨T, tT, j, D, hcap, hp⟩ := hY.2.1 + exact ⟨T, tT, j, D, hcap, isPlanar_mono (image_mono hXY) hp⟩ + · intro T _ j D hcap + exact isPlanar_mono (image_mono hXY) (hY.2.2 T j D hcap) + +/-- Near-planarity passes to subsets, retaining the same containing +disc or the same cuff. -/ +theorem isNearPlanar_mono + {S : Type u} [TopologicalSpace S] {X Y : Set S} + (hXY : X ⊆ Y) (hY : GM07.IsNearPlanar Y) : GM07.IsNearPlanar X := by + rcases hY with hp | ⟨C, hC, hp⟩ + · exact Or.inl (isPlanar_mono hXY hp) + · exact Or.inr ⟨C, hC, isPlanarInCappedCuff_mono hXY hp⟩ + +/-- A planar set remains planar after any existing cuff is filled. -/ +theorem isPlanarInCappedCuff_of_isPlanar + {S : Type u} [TopologicalSpace S] (hS : IsSurface S) + {C X : Set S} (hC : IsCuff C) (hX : IsPlanar X) : GM07.IsPlanarInCappedCuff C X := by + obtain ⟨T, tT, j, D, hcap⟩ := exists_cappedCuff hS hC + exact isPlanarInCappedCuff_of_one_cap hS hcap (isPlanar_image_isEmbedding hcap.isEmbedding hX) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ProperDiscForest.lean b/LeanPool/GraphMinor/GM12/Section3ProperDiscForest.lean new file mode 100644 index 0000000000..6ba68fe61b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ProperDiscForest.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3DiscStarForest +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM12.Section3FeasibilityDiscs +import LeanPool.GraphMinor.Surface.DiscMerge + +/-! +# Proper forests in boundary-contact discs + +For XII (3.1), page 245, each feasibility disc lies in Sigma-star and +meets its surface boundary only at prescribed contacts. The constructed +star is therefore proper, and its boundary vertex set is exactly the +prescribed set. Its interior centre is not a surface boundary point. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A disc whose contacts with the surface boundary form a finite set +carries a connected proper forest with exactly those boundary vertices. +This is the local forest required for XII (3.1), page 245. -/ +theorem exists_proper_connected_forest_in_disc + {S : Type*} [TopologicalSpace S] [T2Space S] (hS : IsSurface S) + {D Z : Set S} (hD : IsClosedDisc D) (hZ : Z.Finite) + (hZD : Z ⊆ D) (hZB : Z ⊆ bd S) (hDB : D ∩ bd S ⊆ Z) : + ∃ H : Drawing S, H.U ⊆ D ∧ GM07.IsSurfaceForest H ∧ + IsConnectedDrawing H ∧ H.V ∩ bd S = Z := by + have hZdisc : Z ⊆ discBd D := fun x hx => + disc_inter_surface_boundary_subset_discBd hS hD ⟨hZD hx, hZB hx⟩ + obtain ⟨H, c, hc, hUD, hV, hboundary, hforest, hconn⟩ := + exists_connected_forest_in_disc hD hZ hZdisc + have hcB : c ∉ bd S := by + intro hcb + exact hcb (isInteriorPoint_of_mem_discInt hS.2.2 hD hc) + have hproper : H.IsProper := by + rintro x ⟨hxB, hxU⟩ + have hxZ := hDB ⟨hUD hxU, hxB⟩ + rw [hV] + exact Or.inr hxZ + have hvertices : H.V ∩ bd S = Z := by + rw [hV] + apply Subset.antisymm + · rintro x ⟨hxV, hxB⟩ + rcases hxV with hxc | hxZ + · exact False.elim (hcB (hxc ▸ hxB)) + · exact hxZ + · intro x hxZ + exact ⟨Or.inr hxZ, hZB hxZ⟩ + exact ⟨H, hUD, ⟨hproper, hforest⟩, hconn, hvertices⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3Punctured.lean b/LeanPool/GraphMinor/GM12/Section3Punctured.lean new file mode 100644 index 0000000000..909caa8a17 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3Punctured.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# The surface with the prescribed discs removed + +XII Section 3, page 245, writes Sigma-star for the closure of the +complement of the disjoint discs. Their boundaries remain in this +closure. The drawing also remains there, because its only points in +each disc are vertices on that disc's boundary. These inclusions are +the first step in reading the drawing as a proper graph for VII (7.5). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The closure of the complement of the discs, denoted Sigma-star in +Graph Minors XII, Section 3, page 245. -/ +@[expose] def discComplement {S ι : Type*} [TopologicalSpace S] (Δ : ι → Set S) : Set S := + closure (⋃ i, Δ i)ᶜ + +/-- The boundary vertex set denoted Z in XII, Section 3, pages 244--245: +the union of the original vertices on the prescribed disc boundaries. -/ +@[expose] def discBoundaryVertices {S ι : Type*} [TopologicalSpace S] + (Γ : Drawing S) (Δ : ι → Set S) : Set S := ⋃ i, Γ.V ∩ discBd (Δ i) + +/-- A boundary point of one closed member of a finite disjoint family +is approached from outside the whole family. Exclude the other closed +members before approaching from outside the chosen member. -/ +theorem mem_discComplement_of_mem_frontier {S ι : Type*} [TopologicalSpace S] [Finite ι] + (Δ : ι → Set S) (hclosed : ∀ i, IsClosed (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {i : ι} {x : S} (hxi : x ∈ Δ i) (hfront : x ∈ frontier (Δ i)) : + x ∈ discComplement Δ := by + classical + let B : Set S := ⋃ j : {j // j ≠ i}, Δ j.val + have hB : IsClosed B := isClosed_iUnion_of_finite fun j => hclosed j.val + have hxB : x ∉ B := by + intro hx + obtain ⟨j, hxj⟩ := mem_iUnion.mp hx + exact Set.disjoint_left.mp (hdisj j.property.symm) hxi hxj + have hxout : x ∈ closure (Δ i)ᶜ := by + rw [frontier_eq_closure_inter_closure] at hfront + exact hfront.2 + apply mem_closure_iff.mpr + intro O hO hxO + obtain ⟨y, hyO, hyout⟩ := mem_closure_iff.mp hxout (O ∩ Bᶜ) + (hO.inter hB.isOpen_compl) ⟨hxO, hxB⟩ + refine ⟨y, hyO.1, ?_⟩ + intro hyunion + obtain ⟨j, hyj⟩ := mem_iUnion.mp hyunion + by_cases hji : j = i + · exact hyout (hji ▸ hyj) + · exact hyO.2 (mem_iUnion.mpr ⟨⟨j, hji⟩, hyj⟩) + +/-- Every prescribed disc boundary remains in the surface Sigma-star +of XII (3.1), page 245. -/ +theorem disc_boundary_subset_discComplement {S ι : Type*} [TopologicalSpace S] + [T2Space S] [Finite ι] (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) (i : ι) : + discBd (Δ i) ⊆ discComplement Δ := by + intro x hx + apply mem_discComplement_of_mem_frontier Δ (fun j => (hΔ j).isCompact.isClosed) hdisj + (Surface.discBd_subset _ hx) + rwa [IsClosedDisc.frontier_eq_discBd hS (hΔ i)] + +/-- The drawing in the setup of XII (3.1), pages 244--245, is supported +in Sigma-star. The hypothesis that it meets each disc only at boundary +vertices is used at every point lying in a prescribed disc. -/ +theorem drawing_support_subset_discComplement {S ι : Type*} [TopologicalSpace S] + [T2Space S] [Finite ι] (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (havoid : ∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) : Γ.U ⊆ discComplement Δ := by + intro x hx + by_cases hxD : x ∈ ⋃ i, Δ i + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxD + have hxb : x ∈ Γ.V ∩ discBd (Δ i) := havoid i ▸ ⟨hx, hxi⟩ + exact disc_boundary_subset_discComplement hS Δ hΔ hdisj i hxb.2 + · exact subset_closure hxD + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3PuncturedBoundary.lean b/LeanPool/GraphMinor/GM12/Section3PuncturedBoundary.lean new file mode 100644 index 0000000000..09a201d7d9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3PuncturedBoundary.lean @@ -0,0 +1,118 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3Punctured +public import LeanPool.GraphMinor.GM12.Section3SubspaceDrawing +import LeanPool.GraphMinor.Surface.DiscMerge +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# Properness of the drawing in the punctured surface + +In XII (3.1), page 245, every boundary point of Sigma-star lies on one +of the removed disc boundaries. Away from those discs the inclusion is +locally an open embedding into the original closed surface, so every +such point is an interior point. The original drawing meets the disc +boundaries only at vertices, which makes the new drawing proper. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A point of Sigma-star lying in one removed disc is on its boundary. +The closure of the common complement is also in the closure of that +disc's complement. -/ +theorem discComplement_inter_disc_subset_boundary {S ι : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) (i : ι) : + discComplement Δ ∩ Δ i ⊆ discBd (Δ i) := by + intro x hx + have hsub : (⋃ j, Δ j)ᶜ ⊆ (Δ i)ᶜ := compl_subset_compl.mpr (subset_iUnion Δ i) + have hxout : x ∈ closure (Δ i)ᶜ := closure_mono hsub hx.1 + have hxfront : x ∈ frontier (Δ i) := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure hx.2, hxout⟩ + rwa [IsClosedDisc.frontier_eq_discBd hS (hΔ i)] at hxfront + +/-- The manifold boundary of Sigma-star is contained in the union of +the prescribed disc boundaries. The reverse identification of cuffs +is a separate geometric step. -/ +theorem discComplement_boundary_subset {S ι : Type*} [TopologicalSpace S] + [T2Space S] [Finite ι] (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) : + bd (discComplement Δ) ⊆ (Subtype.val : discComplement Δ → S) ⁻¹' ⋃ i, discBd (Δ i) := by + classical + intro x hxBd + by_contra hx + have hxout : x.val ∉ ⋃ i, Δ i := by + intro hxD + obtain ⟨i, hxi⟩ := mem_iUnion.mp hxD + exact hx (mem_iUnion.mpr ⟨i, discComplement_inter_disc_subset_boundary hS Δ hΔ i ⟨x.property, + hxi⟩⟩) + let O : Set S := (⋃ i, Δ i)ᶜ + have hO : IsOpen O := (isClosed_iUnion_of_finite fun i => (hΔ i).isCompact.isClosed).isOpen_compl + have hOC : O ⊆ discComplement Δ := subset_closure + have hsource : IsInteriorPoint (⟨x.val, hxout⟩ : O) := + (isInteriorPoint_iff_of_isOpenEmbedding hO.isOpenEmbedding_subtypeVal).mp (hS.2.2 x.val) + have htarget : IsInteriorPoint x := + isInteriorPoint_of_isOpenEmbedding (isOpenEmbedding_inclusion_of_isOpen hO hOC) hsource + exact hxBd htarget + +/-- The drawing in Sigma-star is proper, as required to apply VII in +XII (3.1), page 245. The disc-avoidance condition puts every support +point on its boundary in the vertex set. -/ +theorem drawingInDiscComplement_isProper {S ι : Type*} [TopologicalSpace S] + [T2Space S] [Finite ι] (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (havoid : ∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) : + (drawingInSubspace Γ (discComplement Δ) + (drawing_support_subset_discComplement hS Γ Δ hΔ hdisj havoid)).IsProper := by + let hUC := drawing_support_subset_discComplement hS Γ Δ hΔ hdisj havoid + rintro x ⟨hxBd, hxU⟩ + rw [drawingInSubspace_U] at hxU + obtain ⟨i, hxi⟩ := mem_iUnion.mp (discComplement_boundary_subset hS Δ hΔ hxBd) + have hm : x.val ∈ Γ.V ∩ discBd (Δ i) := havoid i ▸ + (show x.val ∈ Γ.U ∩ Δ i from ⟨hxU, Surface.discBd_subset _ hxi⟩) + rw [drawingInSubspace_V] + exact hm.1 + +/-- Boundary vertices of the drawing in Sigma-star map into the set Z +of the setup of XII (3.1), pages 244--245. -/ +theorem drawingInDiscComplement_boundary_vertices_subset {S ι : Type*} [TopologicalSpace S] + [T2Space S] [Finite ι] (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) (hUC : Γ.U ⊆ discComplement Δ) : + (Subtype.val : discComplement Δ → S) '' + ((drawingInSubspace Γ (discComplement Δ) hUC).V ∩ bd (discComplement Δ)) ⊆ + discBoundaryVertices Γ Δ := by + rintro x ⟨y, ⟨hyV, hyBd⟩, rfl⟩ + rw [drawingInSubspace_V] at hyV + obtain ⟨i, hxi⟩ := mem_iUnion.mp (discComplement_boundary_subset hS Δ hΔ hyBd) + exact mem_iUnion.mpr ⟨i, hyV, hxi⟩ + +/-- The punctured drawing has no more boundary vertices than the set +Z in XII (3.1), page 245, so the same vertex-count bound can be used +in VII (7.5). -/ +theorem drawingInDiscComplement_boundary_vertex_count {S ι : Type*} [TopologicalSpace S] + [T2Space S] [Finite ι] (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) (hUC : Γ.U ⊆ discComplement Δ) : + ((drawingInSubspace Γ (discComplement Δ) hUC).V ∩ bd (discComplement Δ)).ncard ≤ + (discBoundaryVertices Γ Δ).ncard := by + have hfinite : (discBoundaryVertices Γ Δ).Finite := Γ.finite_V.subset (by + intro x hx + obtain ⟨i, hi⟩ := mem_iUnion.mp hx + exact hi.1) + have hsub := drawingInDiscComplement_boundary_vertices_subset hS Γ Δ hΔ hUC + exact (Set.ncard_image_of_injective _ Subtype.val_injective).symm.le.trans + (Set.ncard_le_ncard hsub hfinite) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3PuncturedCuffs.lean b/LeanPool/GraphMinor/GM12/Section3PuncturedCuffs.lean new file mode 100644 index 0000000000..50aa30523b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3PuncturedCuffs.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3BoundaryEquality +import LeanPool.GraphMinor.GM12.Section3ClosedComponents +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs +import LeanPool.GraphMinor.Surface.DiscMerge + +/-! +# The cuffs of the punctured surface + +The surface Sigma-star in XII (3.1), page 245, has one cuff for each +removed disc. Its boundary is the union of those circles, which are +closed, connected and pairwise disjoint. Their preimages under inclusion +are therefore exactly the boundary components. Distinct discs give +distinct cuffs, so their number is the number of prescribed discs. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- The cuffs of Sigma-star are precisely the prescribed disc +boundaries read in that subspace, as used in XII (3.1), page 245. -/ +theorem discComplement_cuffs_eq {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) : + cuffs (discComplement Δ) = + range (fun i => (Subtype.val : discComplement Δ → S) ⁻¹' discBd (Δ i)) := by + let Q : ι → Set (discComplement Δ) := fun i => (Subtype.val : discComplement Δ → S) ⁻¹' discBd + (Δ i) + have hQO : ∀ i, IsOArc (Q i) := fun i => isOArc_subtype_preimage + (disc_boundary_subset_discComplement hS Δ hΔ hdisj i) (hΔ i).isOArc_discBd + have hclosed : ∀ i, IsClosed (Q i) := fun i => + (hΔ i).isOArc_discBd.isCompact.isClosed.preimage continuous_subtype_val + have hconn : ∀ i, IsPreconnected (Q i) := fun i => (hQO i).isPreconnected + have hne : ∀ i, (Q i).Nonempty := by + intro i + obtain ⟨f⟩ := hQO i + exact ⟨(f 1).val, (f 1).property⟩ + have hpair : Pairwise (fun i j => Disjoint (Q i) (Q j)) := by + intro i j hij + apply Set.disjoint_left.mpr + intro x hxi hxj + exact Set.disjoint_left.mp (hdisj hij) (Surface.discBd_subset _ hxi) + (Surface.discBd_subset _ hxj) + change componentsIn (bd (discComplement Δ)) = range Q + rw [discComplement_boundary_eq hS Δ hΔ, preimage_iUnion] + exact componentsIn_iUnion_disjoint_closed Q hclosed hconn hne hpair + +/-- There is exactly one cuff per prescribed disc in Sigma-star. +This gives the cuff count in the application of VII (7.5) for XII (3.1). -/ +theorem discComplement_cuff_count {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) : + (cuffs (discComplement Δ)).ncard = Nat.card ι := by + let Q : ι → Set (discComplement Δ) := fun i => (Subtype.val : discComplement Δ → S) ⁻¹' discBd + (Δ i) + have hQi : Function.Injective Q := by + intro i j heq + by_contra hij + obtain ⟨f⟩ := (hΔ i).isOArc_discBd + let z := (f 1).val + have hz : z ∈ discBd (Δ i) := (f 1).property + have hzC : z ∈ discComplement Δ := disc_boundary_subset_discComplement hS Δ hΔ hdisj i hz + let x : discComplement Δ := ⟨z, hzC⟩ + have hxi : x ∈ Q i := hz + have hxj : x ∈ Q j := heq ▸ hxi + exact Set.disjoint_left.mp (hdisj hij) (Surface.discBd_subset _ hz) + (Surface.discBd_subset _ hxj) + rw [discComplement_cuffs_eq hS Δ hΔ hdisj] + exact Set.ncard_range_of_injective hQi + +/-- Removing a nonempty family of prescribed discs leaves at least +one cuff, as needed for applying the capped planar criterion in XII (3.1). -/ +theorem discComplement_cuffs_nonempty + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] [Nonempty ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) : + (cuffs (discComplement Δ)).Nonempty := by + obtain ⟨i⟩ := (inferInstance : Nonempty ι) + refine ⟨Subtype.val ⁻¹' discBd (Δ i), ?_⟩ + rw [discComplement_cuffs_eq hS Δ hΔ hdisj] + exact mem_range_self i + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3PuncturedForest.lean b/LeanPool/GraphMinor/GM12/Section3PuncturedForest.lean new file mode 100644 index 0000000000..3b91961f95 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3PuncturedForest.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ForestTransport +public import LeanPool.GraphMinor.GM12.Section3FeasibilityDiscs +public import LeanPool.GraphMinor.GM12.Section3PuncturedSurface +import LeanPool.GraphMinor.GM12.Section3PuncturedBoundary + +/-! +# Reading an ambient boundary-connection forest in the punctured surface + +In XII (3.2), page 247, the auxiliary disc avoids the forest, so +adding it changes neither the forest's prescribed contacts nor its +boundary connections. This file reads any such ambient forest in +the complement of the prescribed discs. The contact equations prove +properness and identify its boundary vertices. Walk transfer retains +the connection classes, and injective inclusion retains the forest +property. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- An ambient forest meeting the prescribed discs exactly at its +boundary classes is the feasibility forest in their complement. +This permits the auxiliary disc in XII (3.2), page 247. -/ +theorem exists_punctured_forest_of_ambient + {S : Type*} [TopologicalSpace S] [T2Space S] {t p : ℕ} + (hS : IsClosedSurface S) (Δ : Fin t → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdis : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (Zs : Fin p → Set S) (K : Drawing S) (hF : IsGraphForest K.toGraph) + (hU : K.U ∩ ⋃ i, Δ i = ⋃ j, Zs j) (hV : K.V ∩ ⋃ i, Δ i = ⋃ j, Zs j) + (hZ : (⋃ j, Zs j) ⊆ ⋃ i, discBd (Δ i)) + (hclasses : ∀ j, ∀ x ∈ Zs j, ∀ y ∈ K.V ∩ ⋃ i, Δ i, + Nonempty (GraphWalk K.toGraph x y) ↔ y ∈ Zs j) : + ∃ H : Drawing (discComplement Δ), GM07.IsSurfaceForest H ∧ + H.V ∩ bd (discComplement Δ) = Subtype.val ⁻¹' ⋃ j, Zs j ∧ + ∀ j, ∀ x ∈ (Subtype.val : discComplement Δ → S) ⁻¹' Zs j, + ∀ y ∈ H.V ∩ bd (discComplement Δ), + Nonempty (GraphWalk H.toGraph x y) ↔ y.val ∈ Zs j := by + let C := discComplement Δ + have hKC : K.U ⊆ C := feasibility_disc_subset_discComplement hS Δ hΔ hdis hU hZ + let H := drawingInSubspace K C hKC + have hbd : ∀ x : C, x ∈ bd C ↔ x.val ∈ ⋃ i, discBd (Δ i) := by + intro x + exact (congrArg (fun F : Set C => x ∈ F) (discComplement_boundary_eq hS Δ hΔ)) |> of_eq + have hbdΔ : (⋃ i, discBd (Δ i)) ⊆ ⋃ i, Δ i := by + intro x hx + obtain ⟨i, hi⟩ := mem_iUnion.mp hx + exact mem_iUnion.mpr ⟨i, Surface.discBd_subset _ hi⟩ + have hHV : ∀ x : C, x ∈ H.V ↔ x.val ∈ K.V := by + intro x + dsimp only [H] + rw [drawingInSubspace_V] + rfl + have hHU : ∀ x : C, x ∈ H.U ↔ x.val ∈ K.U := by + intro x + dsimp only [H] + rw [drawingInSubspace_U] + rfl + have hproper : H.IsProper := by + intro x hx + have hxZ := hU.subset ⟨(hHU x).mp hx.2, hbdΔ ((hbd x).mp hx.1)⟩ + exact (hHV x).mpr (hV.symm.subset hxZ).1 + have hboundary : H.V ∩ bd C = (Subtype.val : C → S) ⁻¹' ⋃ j, Zs j := by + ext x + constructor + · intro hx + exact hV.subset ⟨(hHV x).mp hx.1, hbdΔ ((hbd x).mp hx.2)⟩ + · intro hx + exact ⟨(hHV x).mpr (hV.symm.subset hx).1, (hbd x).mpr (hZ hx)⟩ + refine ⟨H, ⟨hproper, isGraphForest_drawingInSubspace hF C isClosed_closure hKC⟩, + hboundary, ?_⟩ + intro j x hx y hy + exact (walk_drawingInSubspace_iff K C isClosed_closure hKC).trans + (hclasses j x.val hx y.val ⟨(hHV y).mp hy.1, hbdΔ ((hbd y).mp hy.2)⟩) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3PuncturedModel.lean b/LeanPool/GraphMinor/GM12/Section3PuncturedModel.lean new file mode 100644 index 0000000000..10c0732fdf --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3PuncturedModel.lean @@ -0,0 +1,115 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CapOneDisc +public import LeanPool.GraphMinor.GM12.Section3PuncturedCuffs +public import LeanPool.GraphMinor.Surface.TopologyStatements +import LeanPool.GraphMinor.GM12.Section3CapTopology +import LeanPool.GraphMinor.Surface.Classification +import LeanPool.GraphMinor.Surface.ModelCriterion +import LeanPool.GraphMinor.Surface.PasteModel + +/-! +# Model parameters of the punctured surface + +The application of VII in XII (3.1), page 245, uses the surface obtained +by deleting the prescribed disc interiors. Its number of cuffs is the +number of discs. Filling a prescribed cuff preserves the handle and +cross-cap parameters and removes one cuff, by the surface pasting theorem. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- The last parameter of a model for Sigma-star is exactly the number +of deleted discs, as used in the application of VII for XII (3.1). -/ +theorem discComplement_model_cuff_parameter + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {a b c : ℕ} (e : discComplement Δ ≃ₜ SurfaceModel a b c) : + c = Nat.card ι := by + obtain ⟨ht, f, hf⟩ := presents_ew a b c + let := ht + exact (ncard_cuffs hf).symm.trans + ((ncard_cuffs_congr e).symm.trans (discComplement_cuff_count hS Δ hΔ hdisj)) + +/-- Filling one prescribed disc preserves both genus parameters of a +model for Sigma-star. This implements one capping step in XII (3.1). -/ +theorem discComplement_model_fill_one + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {a b c : ℕ} (e : discComplement Δ ≃ₜ SurfaceModel a b c) (i : ι) : + 0 < c ∧ Nonempty + (discComplement (fun k : {k // k ≠ i} => Δ k.val) ≃ₜ SurfaceModel a b (c - 1)) := by + obtain ⟨j, hj, _⟩ := exists_cap_discComplement_cuff hS Δ hΔ hdisj i + have hC := discComplement_isSurface hS Δ hΔ hdisj + exact paste_model hC hj.cuff hj.isSurface + (cappedCuff_isClosedEmbedding hC hj) hj.isClosedDisc + hj.union_eq hj.inter_eq hj.discBd_eq e + +/-- Filling all prescribed discs recovers the original surface with +unchanged handle and cross-cap parameters. This relates the model used +in VII to the fixed surface of XII (3.1). -/ +theorem discComplement_model_fill_all + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {a b c : ℕ} (e : discComplement Δ ≃ₜ SurfaceModel a b c) : + Nonempty (S ≃ₜ SurfaceModel a b 0) := by + classical + induction hn : Nat.card ι using Nat.strong_induction_on generalizing ι c with + | ind n ih => + cases isEmpty_or_nonempty ι with + | inl hempty => + let := hempty + have hc : c = 0 := by + simpa using discComplement_model_cuff_parameter hS Δ hΔ hdisj e + have hC : discComplement Δ = univ := by simp [discComplement] + exact ⟨((Homeomorph.Set.univ S).symm.trans + (Homeomorph.setCongr hC).symm).trans (hc ▸ e)⟩ + | inr hne => + obtain ⟨i⟩ := hne + let := Fintype.ofFinite ι + have hlt : Nat.card {k : ι // k ≠ i} < n := by + rw [← hn, Nat.card_eq_fintype_card, Nat.card_eq_fintype_card] + exact Fintype.card_lt_of_injective_of_notMem Subtype.val Subtype.val_injective + (b := i) (by rintro ⟨x, hx⟩; exact x.property hx) + obtain ⟨_, e'⟩ := discComplement_model_fill_one hS Δ hΔ hdisj e i + exact ih _ hlt (fun k : {k : ι // k ≠ i} => Δ k.val) + (fun k => hΔ k.val) + (fun k l hkl => hdisj (fun he => hkl (Subtype.ext he))) e'.some rfl + +/-- A model of the original closed surface fixes both genus parameters +for every placement of the deleted discs. Only the cuff count changes. +Thus the model in the application of VII for XII (3.1) can be chosen +independently of the drawing and of the placement of the discs. -/ +theorem discComplement_model_of_closed_model + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {a₀ b₀ : ℕ} (e₀ : S ≃ₜ SurfaceModel a₀ b₀ 0) : + Nonempty (discComplement Δ ≃ₜ SurfaceModel a₀ b₀ (Nat.card ι)) := by + have hC := discComplement_isSurface hS Δ hΔ hdisj + have hconn := Subtype.connectedSpace (discComplement_isConnected hS Δ hΔ hdisj) + obtain ⟨a, b, c, ⟨e⟩⟩ := classification _ hC hconn + have hc := discComplement_model_cuff_parameter hS Δ hΔ hdisj e + obtain ⟨eS⟩ := discComplement_model_fill_all hS Δ hΔ hdisj e + obtain ⟨_, hgenus, hcross⟩ := + (modelCriterion.2 a b 0 a₀ b₀ 0).mp ⟨eS.symm.trans e₀⟩ + obtain ⟨eM⟩ := (modelCriterion.2 a b c a₀ b₀ (Nat.card ι)).mpr + ⟨hc, hgenus, hcross⟩ + exact ⟨e.trans eM⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3PuncturedSurface.lean b/LeanPool/GraphMinor/GM12/Section3PuncturedSurface.lean new file mode 100644 index 0000000000..f18e925be6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3PuncturedSurface.lean @@ -0,0 +1,128 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CollarManifold +import LeanPool.GraphMinor.GM12.Section3FillingConnected +import LeanPool.GraphMinor.Surface.DiscMerge + +/-! +# The remaining space is a surface + +XII (3.1), page 245, applies the surface theorem of VII to the closure +of the complement of disjoint discs. Near each disc boundary a collar +avoiding the other discs gives a half-plane chart. Away from the discs, +the inclusion into the original surface is open. Closedness supplies +compactness, so these charts prove the required surface assertion. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Boundary points of the prescribed discs are manifold points of the +remaining space, using collars chosen to avoid all the other discs. -/ +theorem isManifoldPoint_discComplement_boundary + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {x : discComplement Δ} {i : ι} (hx : x.val ∈ discBd (Δ i)) : + IsManifoldPoint x := by + classical + let B : Set S := ⋃ j : {j // j ≠ i}, Δ j.val + have hB : IsClosed B := isClosed_iUnion_of_finite fun j => (hΔ j.val).isCompact.isClosed + have hsub : discBd (Δ i) ⊆ Bᶜ := by + intro y hy hmem + obtain ⟨j, hj⟩ := mem_iUnion.mp hmem + exact Set.disjoint_left.mp (hdisj j.property.symm) (discBd_subset _ hy) hj + obtain ⟨E, hE, hDE, hEB⟩ := exists_disc_around + (fun y => (hS.2.2 y).isManifoldPoint) (hΔ i) + (fun y _ => hS.2.2 y) hB.isOpen_compl hsub + have hmiss : ∀ j, j ≠ i → Disjoint E (Δ j) := by + intro j hji + apply Set.disjoint_left.mpr + intro y hyE hyj + rcases hEB hyE with hyD | hyB + · exact Set.disjoint_left.mp (hdisj hji.symm) hyD hyj + · exact hyB (mem_iUnion.mpr ⟨⟨j, hji⟩, hyj⟩) + obtain ⟨p⟩ := (hΔ i).isOArc_discBd + obtain ⟨c, c', hc, hc', hcE, _, hl, _, himage, _, hp⟩ := + exists_disc_collar (hΔ i) hE hDE p + obtain ⟨w, hw⟩ := p.surjective ⟨x.val, hx⟩ + have hval : c w = x.val := (hp w).trans (congrArg Subtype.val hw) + have hm := isManifoldPoint_discComplement_of_collar hS Δ hΔ hdisj i + hc hc' hcE hmiss hl himage p hp w + have heq : (⟨c w, disc_boundary_subset_discComplement hS Δ hΔ hdisj i + (hp w ▸ (p w).property)⟩ : discComplement Δ) = x := Subtype.ext hval + exact heq ▸ hm + +/-- The space Sigma-star used in XII (3.1), page 245, is a compact +surface with boundary. No surface structure on it is assumed. -/ +theorem discComplement_isSurface + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) : + IsSurface (discComplement Δ) := by + let : CompactSpace S := hS.1 + have : CompactSpace (discComplement Δ) := + isCompact_iff_compactSpace.mp isClosed_closure.isCompact + refine ⟨inferInstance, inferInstance, fun x => ?_⟩ + by_cases hx : x.val ∈ ⋃ i, Δ i + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hx + exact isManifoldPoint_discComplement_boundary hS Δ hΔ hdisj + (discComplement_inter_disc_subset_boundary hS Δ hΔ i ⟨x.property, hxi⟩) + · let O : Set S := (⋃ i, Δ i)ᶜ + have hO : IsOpen O := + (isClosed_iUnion_of_finite fun i => (hΔ i).isCompact.isClosed).isOpen_compl + have hOC : O ⊆ discComplement Δ := subset_closure + have hm : IsManifoldPoint (⟨x.val, hx⟩ : O) := + (isManifoldPoint_iff_of_isOpenEmbedding hO.isOpenEmbedding_subtypeVal).mp + (hS.2.2 x.val).isManifoldPoint + exact isManifoldPoint_of_isOpenEmbedding + (isOpenEmbedding_inclusion_of_isOpen hO hOC) hm + +/-- Removing the disc interiors preserves connectedness in XII (3.1), +page 245. Each closed disc meets the remaining space in its connected +boundary, so a separation would extend to the original surface. -/ +theorem discComplement_isConnected + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) : + IsConnected (discComplement Δ) := by + have hmeet : ∀ i, discComplement Δ ∩ Δ i = discBd (Δ i) := by + intro i + apply Subset.antisymm (discComplement_inter_disc_subset_boundary hS Δ hΔ i) + intro x hx + exact ⟨disc_boundary_subset_discComplement hS Δ hΔ hdisj i hx, + discBd_subset _ hx⟩ + have hcover : univ ⊆ discComplement Δ ∪ ⋃ i, Δ i := by + intro x _ + by_cases hx : x ∈ ⋃ i, Δ i + · exact Or.inr hx + · exact Or.inl (subset_closure hx) + have hpre : IsPreconnected (discComplement Δ) := + isPreconnected_of_finite_fillings isClosed_closure Δ + (fun i => (hΔ i).isCompact.isClosed) hdisj + (fun i => by rw [hmeet i]; exact (hΔ i).isOArc_discBd.isPreconnected) + hcover + obtain ⟨x⟩ := (inferInstance : Nonempty S) + have hne : (discComplement Δ).Nonempty := by + rcases hcover (mem_univ x) with hxC | hxD + · exact ⟨x, hxC⟩ + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxD + obtain ⟨p⟩ := (hΔ i).isOArc_discBd + exact ⟨(p 1).val, disc_boundary_subset_discComplement hS Δ hΔ hdisj i (p 1).property⟩ + exact ⟨hne, hpre⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3PushPathOutside.lean b/LeanPool/GraphMinor/GM12/Section3PushPathOutside.lean new file mode 100644 index 0000000000..2254f01312 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3PushPathOutside.lean @@ -0,0 +1,113 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Topology.Subpath +public import Mathlib.Topology.Connected.PathConnected +import Mathlib.Topology.Order.Compact + +/-! +# Pushing a path outside a closed set + +The normal-connection construction used by XII (3.1), page 245, +keeps paths outside the deleted disc interiors. Take the first and +last contacts with a closed disc. Since the path ends are outside its +interior, these contacts lie on its frontier. Replace the intervening +part by a path in that frontier. The two remaining outer pieces miss +the interior, and the new carrier uses only the old path and frontier. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +private theorem first_contact_not_interior + {S : Type*} [TopologicalSpace S] {D : Set S} {a b : S} (p : Path a b) + (ha : a ∉ interior D) {s : unitInterval} + (hs : IsLeast (p ⁻¹' D) s) : p s ∉ interior D := by + intro hsi + by_cases hs0 : s = 0 + · exact ha (by rwa [hs0, p.source] at hsi) + · have hspos : (0 : unitInterval) < s := + lt_of_le_of_ne (unitInterval.nonneg s) (Ne.symm hs0) + have hscl : s ∈ closure (Iio s) := by + rw [closure_Iio' (⟨0, hspos⟩ : (Iio s).Nonempty)] + exact le_rfl + obtain ⟨t, htO, hts⟩ := mem_closure_iff.mp hscl (p ⁻¹' interior D) + (isOpen_interior.preimage p.continuous) hsi + exact hts.not_ge (hs.2 (interior_subset (s := D) htO)) + +private theorem last_contact_not_interior + {S : Type*} [TopologicalSpace S] {D : Set S} {a b : S} (p : Path a b) + (hb : b ∉ interior D) {t : unitInterval} + (ht : IsGreatest (p ⁻¹' D) t) : p t ∉ interior D := by + intro hti + by_cases ht1 : t = 1 + · exact hb (by rwa [ht1, p.target] at hti) + · have htlt : t < (1 : unitInterval) := lt_of_le_of_ne (unitInterval.le_one t) ht1 + have htcl : t ∈ closure (Ioi t) := by + rw [closure_Ioi' (⟨1, htlt⟩ : (Ioi t).Nonempty)] + exact le_rfl + obtain ⟨s, hsO, hts⟩ := mem_closure_iff.mp htcl (p ⁻¹' interior D) + (isOpen_interior.preimage p.continuous) hti + exact hts.not_ge (ht.2 (interior_subset (s := D) hsO)) + +/-- A path with ends outside the interior of a closed set can be +pushed outside that interior when the frontier is path-connected. +Only frontier points are added to its carrier. -/ +theorem exists_path_outside_interior_of_pathConnected_frontier + {S : Type*} [TopologicalSpace S] {D : Set S} (hD : IsClosed D) + (hfront : IsPathConnected (frontier D)) {a b : S} (p : Path a b) + (ha : a ∉ interior D) (hb : b ∉ interior D) : + ∃ q : Path a b, range q ⊆ range p ∪ frontier D ∧ range q ⊆ (interior D)ᶜ := by + by_cases hmeet : (p ⁻¹' D).Nonempty + · obtain ⟨s, hs⟩ := (hD.preimage p.continuous).isCompact.exists_isLeast hmeet + obtain ⟨t, ht⟩ := (hD.preimage p.continuous).isCompact.exists_isGreatest hmeet + have hsout := first_contact_not_interior p ha hs + have htout := last_contact_not_interior p hb ht + have hsfr : p s ∈ frontier D := by rw [hD.frontier_eq]; exact ⟨hs.1, hsout⟩ + have htfr : p t ∈ frontier D := by rw [hD.frontier_eq]; exact ⟨ht.1, htout⟩ + obtain ⟨m, hm⟩ := hfront.joinedIn (p s) hsfr (p t) htfr + let q₀ := (p.subpath 0 s).trans (m.trans (p.subpath t 1)) + let q : Path a b := q₀.cast p.source.symm p.target.symm + have hqr : range q = range (p.subpath 0 s) ∪ (range m ∪ range (p.subpath t 1)) := by + change range q₀ = _ + rw [Path.trans_range, Path.trans_range] + have hsub : ∀ r r', range (p.subpath r r') ⊆ range p := by + intro r r' + rw [Path.range_subpath] + exact image_subset_range _ _ + refine ⟨q, ?_, ?_⟩ + · rw [hqr] + exact union_subset ((hsub 0 s).trans subset_union_left) + (union_subset ((by rintro _ ⟨z, rfl⟩; exact hm z : range m ⊆ frontier D).trans + subset_union_right) + ((hsub t 1).trans subset_union_left)) + · rw [hqr] + apply union_subset + · rw [Path.range_subpath_of_le p 0 s (unitInterval.nonneg s)] + rintro _ ⟨r, hr, rfl⟩ hri + rcases eq_or_lt_of_le hr.2 with rfl | hrs + · exact hsout hri + · exact hrs.not_ge (hs.2 (interior_subset (s := D) hri)) + · apply union_subset + · rintro _ ⟨r, rfl⟩ hri + exact (hm r).2 hri + · rw [Path.range_subpath_of_le p t 1 (unitInterval.le_one t)] + rintro _ ⟨r, hr, rfl⟩ hri + rcases eq_or_lt_of_le hr.1 with he | htr + · exact htout (he.symm ▸ hri) + · exact htr.not_ge (ht.2 (interior_subset (s := D) hri)) + · refine ⟨p, subset_union_left, ?_⟩ + rintro _ ⟨t, rfl⟩ hti + exact hmeet ⟨t, interior_subset (s := D) hti⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3RadialLines.lean b/LeanPool/GraphMinor/GM12/Section3RadialLines.lean new file mode 100644 index 0000000000..399c031cd7 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3RadialLines.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import Mathlib.Analysis.Complex.Norm +import LeanPool.GraphMinor.GM11.RadialChord +import Mathlib.Analysis.Complex.Basic + +/-! +# Radial lines in the unit disc + +For the stars in the feasibility discs of XII (3.1), page 245, +join the origin to each prescribed point of the unit circle. Norms +recover the parameter on each line. Thus distinct lines meet only +at the origin, and each meets the unit circle only at its endpoint. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The closed radial line from the origin to a complex point. -/ +@[expose] noncomputable def radialLine (z : ℂ) : Set ℂ := + range (fun t : unitInterval => t.val • z) + +private theorem radialLine_norm {z : ℂ} (hz : ‖z‖ = 1) (t : unitInterval) : + ‖t.val • z‖ = t.val := by + rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg t.property.1, hz, mul_one] + +/-- A radius to a unit-circle point is a line with the stated ends. -/ +theorem isLineWithEnds_radialLine {z : ℂ} (hz : ‖z‖ = 1) : + IsLineWithEnds (radialLine z) 0 z := by + have hc : Continuous (fun t : unitInterval => t.val • z) := continuous_subtype_val.smul + continuous_const + have hi : Function.Injective (fun t : unitInterval => t.val • z) := by + intro t s he + apply Subtype.ext + have hn := congrArg norm he + rwa [radialLine_norm hz, radialLine_norm hz] at hn + simpa only [radialLine, Set.Icc.coe_zero, Set.Icc.coe_one, zero_smul, one_smul] + using GM11.isLine_range hc hi + +/-- The radial line stays in the closed unit disc. -/ +theorem radialLine_subset_unitDisc {z : ℂ} (hz : ‖z‖ = 1) : + radialLine z ⊆ Metric.closedBall 0 1 := by + rintro x ⟨t, rfl⟩ + rw [mem_closedBall_zero_iff, radialLine_norm hz] + exact t.property.2 + +/-- A radial line meets the unit circle only at its outer endpoint. -/ +theorem radialLine_inter_unitCircle {z : ℂ} (hz : ‖z‖ = 1) : + radialLine z ∩ Metric.sphere 0 1 = {z} := by + apply Subset.antisymm + · rintro x ⟨⟨t, rfl⟩, hx⟩ + have ht : t.val = 1 := by + have hn := mem_sphere_zero_iff_norm.mp hx + rwa [radialLine_norm hz] at hn + simpa only [ht, one_smul] using (mem_singleton z) + · intro x hx + rw [show x = z from hx] + exact ⟨⟨1, one_smul ℝ z⟩, mem_sphere_zero_iff_norm.mpr hz⟩ + +/-- Distinct unit-circle endpoints give radial lines intersecting +exactly at their common centre. -/ +theorem radialLine_inter_radialLine {z w : ℂ} (hz : ‖z‖ = 1) (hw : ‖w‖ = 1) + (hzw : z ≠ w) : radialLine z ∩ radialLine w = {0} := by + apply Subset.antisymm + · rintro x ⟨⟨t, rfl⟩, ⟨s, he⟩⟩ + have hst : s.val = t.val := by + have hn := congrArg norm he + rwa [radialLine_norm hw, radialLine_norm hz] at hn + have hst' : s = t := Subtype.ext hst + cases hst' + by_cases ht : t.val = 0 + · simpa only [ht, zero_smul] using (mem_singleton (0 : ℂ)) + · have hinv := congrArg (fun x : ℂ => t.val⁻¹ • x) he + have hwz : w = z := by + simpa only [smul_smul, inv_mul_cancel₀ ht, one_smul] using hinv + exact False.elim (hzw hwz.symm) + · rintro x rfl + exact ⟨⟨0, zero_smul ℝ z⟩, ⟨0, zero_smul ℝ w⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ReplaceChordHomotopy.lean b/LeanPool/GraphMinor/GM12/Section3ReplaceChordHomotopy.lean new file mode 100644 index 0000000000..0309d927be --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ReplaceChordHomotopy.lean @@ -0,0 +1,138 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Topology.Homotopy.Path +import LeanPool.GraphMinor.Surface.Gluing +import Mathlib.Topology.Piecewise + +/-! +# Replacing a chord inside an arbitrary path + +The finite-chord reduction used by XII (3.1), page 245, replaces one +chord at a time. A fixed-end homotopy of the chord to a path in the +remaining closed set extends to paths in their union: use the chord +homotopy on the chord and keep the remaining set fixed. These maps +agree at the attachment endpoints. Pasting over two closed sets proves +continuity, including paths which traverse the chord many times. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Replace a chord in any path through its union with a closed set. +The new path lies in the image of the closed set and is homotopic to +the image of the original path, with both ends fixed. -/ +theorem exists_homotopic_path_after_replacing_chord + {S T : Type*} [TopologicalSpace S] [T2Space S] [TopologicalSpace T] + {B : Set S} (hB : IsClosed B) {u v a b : S} + (c : Path u v) (hci : Function.Injective c) + (hmeet : range c ∩ B ⊆ {u, v}) + (j : C(S, T)) (r : Path (j u) (j v)) + (hcr : (c.map j.continuous).Homotopic r) (hrB : range r ⊆ j '' B) + (q : Path a b) (hq : range q ⊆ B ∪ range c) (ha : a ∈ B) (hb : b ∈ B) : + ∃ q' : Path (j a) (j b), (q.map j.continuous).Homotopic q' ∧ range q' ⊆ j '' B := by + classical + obtain ⟨k, hkc, hkc_inv⟩ := exists_inv_of_compactOn isCompact_univ + c.continuous.continuousOn hci.injOn + rw [image_univ] at hkc + have hki : ∀ t : unitInterval, k (c t) = t := fun t => hkc_inv (mem_univ t) + have hck : ∀ x ∈ range c, c (k x) = x := by + rintro _ ⟨t, rfl⟩ + rw [hki] + obtain ⟨H⟩ := hcr + let A : Set (unitInterval × unitInterval) := {z | q z.2 ∈ B} + let D : Set (unitInterval × unitInterval) := {z | q z.2 ∈ range c} + have hAc : IsClosed A := hB.preimage (q.continuous.comp continuous_snd) + have hDc : IsClosed D := (isCompact_range c.continuous).isClosed.preimage + (q.continuous.comp continuous_snd) + have hAD : Aᶜ ⊆ D := by + intro z hz + rcases hq (mem_range_self z.2) with hzB | hzC + · exact (hz hzB).elim + · exact hzC + have hcl : closure Aᶜ ⊆ D := closure_minimal hAD hDc + let f : unitInterval × unitInterval → T := fun z => j (q z.2) + let g : unitInterval × unitInterval → T := fun z => H (z.1, k (q z.2)) + have hfc : Continuous f := j.continuous.comp (q.continuous.comp continuous_snd) + have hkq : ContinuousOn (fun z : unitInterval × unitInterval => k (q z.2)) D := + hkc.comp (q.continuous.comp continuous_snd).continuousOn (fun _ hz => hz) + have hgc : ContinuousOn g D := + H.continuous.comp_continuousOn (continuous_fst.continuousOn.prodMk hkq) + have hfg : ∀ z ∈ A ∩ D, f z = g z := by + intro z hz + have hend := hmeet ⟨hz.2, hz.1⟩ + rcases hend with hu | hv + · have hku : k (q z.2) = 0 := by rw [hu, ← c.source, hki] + change j (q z.2) = H (z.1, k (q z.2)) + rw [hku, H.source, hu] + · have hkv : k (q z.2) = 1 := by rw [hv, ← c.target, hki] + change j (q z.2) = H (z.1, k (q z.2)) + rw [hkv, H.target, hv] + let F : unitInterval × unitInterval → T := A.piecewise f g + have hfr : frontier A ⊆ closure Aᶜ := by + rw [← frontier_compl A] + exact frontier_subset_closure + have hFc : Continuous F := continuous_piecewise (fun z hz => + hfg z ⟨hAc.frontier_subset hz, hcl (hfr hz)⟩) + hfc.continuousOn (hgc.mono hcl) + have hsource : ∀ t : unitInterval, F (t, 0) = j a := by + intro t + have hm : (t, (0 : unitInterval)) ∈ A := by change q 0 ∈ B; rwa [q.source] + change A.piecewise f g (t, 0) = j a + rw [piecewise_eq_of_mem A f g hm] + exact congrArg j q.source + have htarget : ∀ t : unitInterval, F (t, 1) = j b := by + intro t + have hm : (t, (1 : unitInterval)) ∈ A := by change q 1 ∈ B; rwa [q.target] + change A.piecewise f g (t, 1) = j b + rw [piecewise_eq_of_mem A f g hm] + exact congrArg j q.target + let q' : Path (j a) (j b) := { + toFun := fun t => F (1, t) + continuous_toFun := hFc.comp (continuous_const.prodMk continuous_id) + source' := hsource 1 + target' := htarget 1 } + refine ⟨q', ⟨{ + toFun := F + continuous_toFun := hFc + map_zero_left := ?_ + map_one_left := fun _ => rfl + prop' := ?_ }⟩, ?_⟩ + · intro t + by_cases ht : (0, t) ∈ A + · exact piecewise_eq_of_mem A f g ht + · have htD := hAD ht + change A.piecewise f g (0, t) = j (q t) + rw [piecewise_eq_of_notMem A f g ht] + change H (0, k (q t)) = j (q t) + rw [H.apply_zero] + exact congrArg j (hck (q t) htD) + · intro t s hs + rcases hs with rfl | hs + · exact (hsource t).trans (congrArg j q.source.symm) + · have hs1 : s = 1 := mem_singleton_iff.mp hs + subst s + exact (htarget t).trans (congrArg j q.target.symm) + · rintro _ ⟨t, rfl⟩ + change F (1, t) ∈ j '' B + by_cases ht : (1, t) ∈ A + · change A.piecewise f g (1, t) ∈ j '' B + rw [piecewise_eq_of_mem A f g ht] + exact ⟨q t, ht, rfl⟩ + · change A.piecewise f g (1, t) ∈ j '' B + rw [piecewise_eq_of_notMem A f g ht] + change H (1, k (q t)) ∈ j '' B + rw [H.apply_one] + exact hrB (mem_range_self _) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3RerouteCarrier.lean b/LeanPool/GraphMinor/GM12/Section3RerouteCarrier.lean new file mode 100644 index 0000000000..a7579a68bf --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3RerouteCarrier.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3FiniteReroute +public import LeanPool.GraphMinor.GM12.Section3PathConcatenation + +/-! +# The exact carrier of the global rerouting + +For the circle-intersection step used by XII (3.1), page 245, the +rerouted path starts on the first circle. Its concatenation visits all +the retained outer pieces. After adjoining the first circle, the new +carrier is exactly the union of those finitely many original subpaths. +This equality lets the finite graph construction preserve connectedness +as well as the homotopy class. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- If the original path starts in the solid set, adjoining that set +to the rerouted path gives exactly the finite union of retained outer +subpaths, with singleton attachment bounds. -/ +theorem exists_global_homotopic_reroute_carrier + {S : Type*} [TopologicalSpace S] (hS : IsSurface S) {F : Set S} + (hF : IsSolid F) {a b : S} (p : Path a b) (ha : a ∈ F) : + ∃ (n : ℕ) (t : Fin (n + 1) → unitInterval) (s u : Fin n → unitInterval) (q : Path a b), + t 0 = 0 ∧ t (Fin.last n) = 1 ∧ Monotone t ∧ p.Homotopic q ∧ + F ∪ range q = F ∪ ⋃ i : Fin n, + (range ((p.subpath (t i.castSucc) (t i.succ)).subpath 0 (s i)) ∪ + range ((p.subpath (t i.castSucc) (t i.succ)).subpath (u i) 1)) ∧ + ∀ i : Fin n, s i ≤ u i ∧ + range ((p.subpath (t i.castSucc) (t i.succ)).subpath 0 (s i)) ∩ F ⊆ + {(p.subpath (t i.castSucc) (t i.succ)) (s i)} ∧ + range ((p.subpath (t i.castSucc) (t i.succ)).subpath (u i) 1) ∩ F ⊆ + {(p.subpath (t i.castSucc) (t i.succ)) (u i)} := by + obtain ⟨n, t, s, u, r, ht0, htlast, hmono, hpieces⟩ := exists_finite_homotopic_reroutes hS hF p + obtain ⟨q, hpq, hq⟩ := exists_homotopic_path_with_piecewise_range p t ht0 htlast r + (fun i => (hpieces i).2.1) + refine ⟨n, t, s, u, q, ht0, htlast, hmono, hpq, ?_, + fun i => ⟨(hpieces i).1, (hpieces i).2.2.2.1, (hpieces i).2.2.2.2⟩⟩ + have hp0 : p 0 ∈ F := p.source.symm ▸ ha + rw [hq] + apply Subset.antisymm + · rintro x (hxF | hx0 | hxr) + · exact Or.inl hxF + · exact Or.inl (mem_singleton_iff.mp hx0 ▸ hp0) + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxr + have hxparts := (hpieces i).2.2.1 ▸ (show x ∈ F ∪ range (r i) from Or.inr hxi) + rcases hxparts with (hxF | hxL) | hxR + · exact Or.inl hxF + · exact Or.inr (mem_iUnion.mpr ⟨i, Or.inl hxL⟩) + · exact Or.inr (mem_iUnion.mpr ⟨i, Or.inr hxR⟩) + · rintro x (hxF | hxparts) + · exact Or.inl hxF + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxparts + have hxlocal : x ∈ F ∪ range (r i) := (hpieces i).2.2.1.symm ▸ + (show x ∈ F ∪ range ((p.subpath (t i.castSucc) (t i.succ)).subpath 0 (s i)) ∪ + range ((p.subpath (t i.castSucc) (t i.succ)).subpath (u i) 1) from + hxi.elim (fun h => Or.inl (Or.inr h)) Or.inr) + rcases hxlocal with hxF | hxr + · exact Or.inl hxF + · exact Or.inr (Or.inr (mem_iUnion.mpr ⟨i, hxr⟩)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3RerouteContacts.lean b/LeanPool/GraphMinor/GM12/Section3RerouteContacts.lean new file mode 100644 index 0000000000..56d5e9a2fb --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3RerouteContacts.lean @@ -0,0 +1,106 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3LocalReroute +import LeanPool.GraphMinor.GM12.Section2PathHomotopy + +/-! +# The retained pieces of a local rerouting + +In the finite-graph construction for the circle-intersection step used +by XII (3.1), page 245, a first/last-contact replacement retains only +two outer subpaths. Each meets the closed set in one endpoint. Adding +the rerouted path to that set gives exactly the same carrier as adding +these two retained pieces. Thus the homotopy can be kept while the +new material is given by finitely many original subarcs. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The initial subpath up to the first contact meets the set exactly +at that contact. -/ +theorem first_contact_subpath_inter_eq + {S : Type*} [TopologicalSpace S] {F : Set S} {a b : S} (p : Path a b) + {s : unitInterval} (hsF : p s ∈ F) (hfirst : ∀ r, r < s → p r ∉ F) : + range (p.subpath 0 s) ∩ F = {p s} := by + rw [Path.range_subpath_of_le p 0 s (unitInterval.nonneg s)] + apply Subset.antisymm + · rintro x ⟨⟨r, ⟨_, hrs⟩, rfl⟩, hrF⟩ + rcases eq_or_lt_of_le hrs with rfl | hrs + · rfl + · exact (hfirst r hrs hrF).elim + · intro x hx + have he : x = p s := hx + rw [he] + exact ⟨⟨s, ⟨unitInterval.nonneg s, le_rfl⟩, rfl⟩, hsF⟩ + +/-- The final subpath after the last contact meets the set exactly +at that contact. -/ +theorem last_contact_subpath_inter_eq + {S : Type*} [TopologicalSpace S] {F : Set S} {a b : S} (p : Path a b) + {t : unitInterval} (htF : p t ∈ F) (hlast : ∀ r, t < r → p r ∉ F) : + range (p.subpath t 1) ∩ F = {p t} := by + rw [Path.range_subpath_of_le p t 1 (unitInterval.le_one t)] + apply Subset.antisymm + · rintro x ⟨⟨r, ⟨htr, _⟩, rfl⟩, hrF⟩ + rcases eq_or_lt_of_le htr with h | htr + · exact congrArg p h.symm + · exact (hlast r htr hrF).elim + · intro x hx + have he : x = p t := hx + rw [he] + exact ⟨⟨t, ⟨le_rfl, unitInterval.le_one t⟩, rfl⟩, htF⟩ + +/-- A local rerouting with the original endpoints preserves homotopy. +After adjoining the closed set, its carrier is exactly that of the two +retained outer subpaths, each attached at a single point. -/ +theorem exists_homotopic_reroute_with_outer_pieces + {S : Type*} [TopologicalSpace S] {F U V : Set S} + (hF : IsClosed F) (hV : IsSimplyConnectedSet V) (hUV : U ⊆ V) + (hFU : GM11.IsArcConnected (F ∩ U)) {a b : S} (p : Path a b) + (hpU : range p ⊆ U) (hmeet : (p ⁻¹' F).Nonempty) : + ∃ (s t : unitInterval) (q : Path a b), s ≤ t ∧ p.Homotopic q ∧ + F ∪ range q = F ∪ range (p.subpath 0 s) ∪ range (p.subpath t 1) ∧ + range (p.subpath 0 s) ∩ F = {p s} ∧ range (p.subpath t 1) ∩ F = {p t} := by + obtain ⟨s, t, m, hst, hsF, htF, hm, _, hfirst, hlast⟩ := + exists_homotopic_local_reroute hF hV hUV hFU p hpU hmeet + let q₀ := (p.subpath 0 s).trans (m.trans (p.subpath t 1)) + let q : Path a b := q₀.cast p.source.symm p.target.symm + have hqr : range q = range (p.subpath 0 s) ∪ (range m ∪ range (p.subpath t 1)) := by + change range q₀ = _ + rw [Path.trans_range, Path.trans_range] + have hsub : ∀ r r', range (p.subpath r r') ⊆ V := by + intro r r' + rw [Path.range_subpath] + exact (image_subset_range _ _).trans (hpU.trans hUV) + have hqV : range q ⊆ V := by + rw [hqr] + exact union_subset (hsub 0 s) (union_subset ((hm.trans inter_subset_right).trans hUV) + (hsub t 1)) + refine ⟨s, t, q, hst, paths_homotopic_of_range_in_simplyConnected hV p q + (fun r => hUV (hpU (mem_range_self r))) (fun r => hqV (mem_range_self r)), ?_, + first_contact_subpath_inter_eq p hsF hfirst, last_contact_subpath_inter_eq p htF hlast⟩ + rw [hqr] + apply Subset.antisymm + · rintro x (hxF | hxL | hxM | hxR) + · exact Or.inl (Or.inl hxF) + · exact Or.inl (Or.inr hxL) + · exact Or.inl (Or.inl (hm hxM).1) + · exact Or.inr hxR + · rintro x ((hxF | hxL) | hxR) + · exact Or.inl hxF + · exact Or.inr (Or.inl hxL) + · exact Or.inr (Or.inr (Or.inr hxR)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3RerouteCover.lean b/LeanPool/GraphMinor/GM12/Section3RerouteCover.lean new file mode 100644 index 0000000000..fc8039f554 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3RerouteCover.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3LocalReroute +public import LeanPool.GraphMinor.GM12.Section3ManifoldPatch +import LeanPool.GraphMinor.Surface.Cuffs + +/-! +# A finite partition into rerouting patches + +The circle-intersection step used by XII (3.1), page 245, replaces +short curve pieces while staying in the original union. A solid set is +arc-connected in a small open neighbourhood of each of its points. +Shrink inside a simply connected manifold patch. Off the solid set, +use its closedness to choose a disjoint neighbourhood. Pull this open +cover back to the unit interval and take a finite monotone partition. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Near each point, a solid set is arc-connected in an open subset +of a simply connected manifold patch. Away from the set this condition +holds for the empty intersection. -/ +theorem exists_reroute_patch_of_solid + {S : Type*} [TopologicalSpace S] (hS : IsSurface S) {F : Set S} + (hF : IsSolid F) (x : S) : + ∃ U V : Set S, IsOpen U ∧ x ∈ U ∧ U ⊆ V ∧ + IsSimplyConnectedSet V ∧ IsArcConnected (F ∩ U) := by + obtain ⟨V, hV, hxV, hsc⟩ := exists_simplyConnected_patch_of_isManifoldPoint (hS.2.2 x) + by_cases hxF : x ∈ F + · obtain ⟨U, hUV, hxU, hU, hArc⟩ := hF.1 x hxF V hV hxV + exact ⟨U, V, hU, hxU, hUV, hsc, hArc⟩ + · refine ⟨V ∩ Fᶜ, V, hV.inter hF.2.isOpen_compl, ⟨hxV, hxF⟩, + inter_subset_left, hsc, ?_⟩ + intro a ha + exact (ha.2.2 ha.1).elim + +/-- Every path has a finite monotone partition whose pieces stay in +rerouting patches for a fixed solid set. Each patch supplies the two +premises needed for homotopy-preserving first/last-contact replacement. -/ +theorem exists_finite_reroute_partition + {S : Type*} [TopologicalSpace S] (hS : IsSurface S) {F : Set S} + (hF : IsSolid F) {a b : S} (p : Path a b) : + ∃ (n : ℕ) (t : Fin (n + 1) → unitInterval), t 0 = 0 ∧ t (Fin.last n) = 1 ∧ + Monotone t ∧ ∀ i : Fin n, ∃ U V : Set S, + IsOpen U ∧ U ⊆ V ∧ IsSimplyConnectedSet V ∧ IsArcConnected (F ∩ U) ∧ + range (p.subpath (t i.castSucc) (t i.succ)) ⊆ U := by + classical + choose U V hU hxU hUV hsc hArc using exists_reroute_patch_of_solid hS hF + let O : S → Set unitInterval := fun x => p ⁻¹' U x + have hO : ∀ x, IsOpen (O x) := fun x => (hU x).preimage p.continuous + have hcover : (univ : Set unitInterval) ⊆ ⋃ x, O x := by + intro r _ + exact mem_iUnion.mpr ⟨p r, hxU (p r)⟩ + obtain ⟨t, ht0, hmono, ⟨n, hn⟩, hpieces⟩ := + exists_monotone_Icc_subset_open_cover_unitInterval hO hcover + let s : Fin (n + 1) → unitInterval := fun i => t i.val + refine ⟨n, s, ht0, hn n le_rfl, fun i j hij => hmono hij, ?_⟩ + intro i + obtain ⟨x, hx⟩ := hpieces i.val + refine ⟨U x, V x, hU x, hUV x, hsc x, hArc x, ?_⟩ + have hle : s i.castSucc ≤ s i.succ := hmono (Nat.le_succ i.val) + rw [Path.range_subpath_of_le p _ _ hle] + rintro y ⟨r, hr, rfl⟩ + exact hx hr + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3RestrictedCharts.lean b/LeanPool/GraphMinor/GM12/Section3RestrictedCharts.lean new file mode 100644 index 0000000000..1d89f1d8b5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3RestrictedCharts.lean @@ -0,0 +1,59 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Gluing +import Mathlib.Topology.LocalAtTarget + +/-! +# Restricting a chart to the punctured surface + +In XII (3.1), page 245, collar coordinates identify the remaining +surface with a local part of the circle exterior. This lemma transfers +a manifold chart through that local identification. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- An open coordinate map transfers a local surface model to a +subspace whenever membership agrees in those coordinates. -/ +theorem isManifoldPoint_of_open_coordinate_model + {X S : Type*} [TopologicalSpace X] [TopologicalSpace S] + {M Y : Set X} {C : Set S} (hM : IsOpen M) + {e : M → S} (he : IsOpenEmbedding e) + (hmem : ∀ z : M, e z ∈ C ↔ z.val ∈ Y) + {z : M} (hzY : z.val ∈ Y) (hz : IsManifoldPoint (⟨z.val, hzY⟩ : Y)) : + IsManifoldPoint (⟨e z, (hmem z).mpr hzY⟩ : C) := by + let A : Set Y := Subtype.val ⁻¹' M + have hA : IsOpen A := hM.preimage continuous_subtype_val + let F : (e ⁻¹' C) ≃ₜ A := { + toFun := fun w => ⟨⟨w.val.val, (hmem w.val).mp w.property⟩, w.val.property⟩ + invFun := fun w => ⟨⟨w.val.val, w.property⟩, (hmem _).mpr w.val.property⟩ + left_inv _ := rfl + right_inv _ := rfl + continuous_toFun := by + apply Continuous.subtype_mk + apply Continuous.subtype_mk + exact continuous_subtype_val.comp continuous_subtype_val + continuous_invFun := by + apply Continuous.subtype_mk + apply Continuous.subtype_mk + exact continuous_subtype_val.comp continuous_subtype_val } + let w : e ⁻¹' C := ⟨z, (hmem z).mpr hzY⟩ + have hwA : IsManifoldPoint (F w) := + (isManifoldPoint_iff_of_isOpenEmbedding hA.isOpenEmbedding_subtypeVal).mp hz + have hw : IsManifoldPoint w := + (isManifoldPoint_iff_of_isOpenEmbedding F.isOpenEmbedding).mp hwA + exact isManifoldPoint_of_isOpenEmbedding (he.restrictPreimage C) hw + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SchismaticBounds.lean b/LeanPool/GraphMinor/GM12/Section3SchismaticBounds.lean new file mode 100644 index 0000000000..2e444c130b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SchismaticBounds.lean @@ -0,0 +1,93 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CircleCount +public import LeanPool.GraphMinor.GM12.Section3LoopSchismaticCount +public import LeanPool.GraphMinor.GM12.Section3ThetaSchismaticCount + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Conditions (i)--(iv) bound every normal schismatic set + +In XII (3.1), page 245, the four geometric conditions handle the four +schismatic shapes of VII Section 8. The circle case uses (i), the two +loop cases use (ii) and (iii), and the theta case uses (iv). The theta +classification proves that its deletion count is three, allowing that +last condition to be applied. All shape and cuff classifications are +proved before this case split. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +universe u + +/-- Conditions (i)--(iv) of XII (3.1), page 245, force every normal +schismatic set in Sigma-star to meet more than `N` vertices. +The equality argument in condition (iv) just reads the deletion family +as a three-element family in the case where that condition applies. -/ +theorem normal_schismatic_vertex_count_gt + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + {t : ℕ} [Nonempty (Fin t)] + (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : Fin t → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ t) (hUC : Γ.U ⊆ discComplement Δ) (N : ℕ) + (hsmall : ∀ F : Set S, Γ.IsNormal F → IsOArc F → F ⊆ discComplement Δ → + (Γ.V ∩ F).ncard ≤ N → + ∃ D : Set S, IsClosedDisc D ∧ discBd D = F ∧ + ∀ i j, Δ i ⊆ D → Δ j ⊆ D → i = j) + (hii : ∀ (A B P D E : Set S) (u v : S), + Γ.IsNormal (A ∪ B ∪ P) → IsOArc A → IsOArc B → IsLineWithEnds P u v → + u ∈ A → v ∈ B → P ∩ A = {u} → P ∩ B = {v} → + A ∪ B ∪ P ⊆ discComplement Δ → IsClosedDisc D → IsClosedDisc E → + discBd D = A → discBd E = B → Disjoint D E → + (∃ i, ∀ l, Δ l ⊆ D ↔ l = i) → (∃ j, ∀ l, Δ l ⊆ E ↔ l = j) → + N < (Γ.V ∩ (A ∪ B ∪ P)).ncard) + (hiii : ∀ A B D E : Set S, + Γ.IsNormal (A ∪ B) → IsOArc A → IsOArc B → A ∪ B ⊆ discComplement Δ → + IsClosedDisc D → IsClosedDisc E → discBd D = A → discBd E = B → + (D ∩ E).ncard = 1 → + (∃ i, ∀ l, Δ l ⊆ D ↔ l = i) → (∃ j, ∀ l, Δ l ⊆ E ↔ l = j) → + N < (Γ.V ∩ (A ∪ B)).ncard) + (hiv : ∀ ht : t = 3, IsSphere S → ∀ (P D : Fin 3 → Set S) (a b : S), a ≠ b → + Γ.IsNormal (⋃ i, P i) → (∀ i, IsLineWithEnds (P i) a b) → + (∀ i j, i ≠ j → P i ∩ P j = {a, b}) → (⋃ i, P i) ⊆ discComplement Δ → + (∀ i, IsClosedDisc (D i) ∧ + discBd (D i) = ⋃ j : {j // j ≠ i}, P j.val ∧ Δ (Fin.cast ht.symm i) ⊆ D i ∧ ¬ P i ⊆ D i) → + N < (Γ.V ∩ ⋃ i, P i).ncard) + {X : Set (discComplement Δ)} (hX : GM07.IsSchismatic X) + (hn : (drawingInSubspace Γ (discComplement Δ) hUC).IsNormal X) : + N < ((drawingInSubspace Γ (discComplement Δ) hUC).V ∩ X).ncard := by + have hcase' : ¬ IsSphere S ∨ 3 ≤ Nat.card (Fin t) := by + rw [Nat.card_fin] + exact hcase + have hshape := hX.1 + rcases hshape with hF | h1 | h2 | h3 + · exact normal_oArc_vertex_count_gt hS Γ Δ hΔ hdisj hUC N hsmall hn hF hX.2.1 + · obtain ⟨A, B, P, a, b, hA, hB, hAB, hP, ha, hb, hPA, hPB, rfl⟩ := h1 + exact two_loop_vertex_count_gt_of_schismatic hS Γ Δ hΔ hdisj hcase' hUC N hii + hA hB hAB hP ha hb hPA hPB hX hn + · obtain ⟨A, B, a, hA, hB, hAB, rfl⟩ := h2 + exact meeting_loop_vertex_count_gt_of_schismatic hS Γ Δ hΔ hdisj hcase' hUC N hiii + hA hB hAB hX hn + · obtain ⟨P, Q, R, a, b, hab, hP, hQ, hR, hPQ, hPR, hQR, rfl⟩ := h3 + have ht : t = 3 := (Nat.card_fin t).symm.trans + (sphere_card_three_of_schismatic_theta hS Δ hΔ hdisj hab hP hQ hR hPQ hPR hQR hX).2 + subst t + exact three_branch_vertex_count_gt_of_schismatic hS Γ Δ hΔ hdisj hUC N (hiv rfl) + hab hP hQ hR hPQ hPR hQR hX hn + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SchismaticCandidate.lean b/LeanPool/GraphMinor/GM12/Section3SchismaticCandidate.lean new file mode 100644 index 0000000000..ef72b0d67c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SchismaticCandidate.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM12.Section3SolidUnion +import LeanPool.GraphMinor.GM12.Section3FiniteGraphSolid +import LeanPool.GraphMinor.Surface.SurfaceGraph +import Mathlib.Analysis.Convex.Contractible + +/-! +# Schismatic sets are alpha candidates + +The alternative minimum in VII Section 8, page 241, used by XII +(3.1), page 245, goes in both directions. Extraction gives the lower +bound. For the other direction, every schismatic shape is solid and +connected. Its constituent lines and circles are solid, finite unions +preserve solidity, and the specified attachments give connectedness. +Thus a normal schismatic set is itself an alpha candidate. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +private theorem connected_line + {S : Type*} [TopologicalSpace S] {L : Set S} (hL : IsLine L) : IsConnected L := by + obtain ⟨e⟩ := hL + let : ContractibleSpace unitInterval := (convex_Icc (0 : ℝ) 1).contractibleSpace ⟨0, by simp⟩ + let : PathConnectedSpace L := e.pathConnectedSpace + exact (isPathConnected_iff_pathConnectedSpace.mpr inferInstance).isConnected + +private theorem connected_circle + {S : Type*} [TopologicalSpace S] {F : Set S} (hF : IsOArc F) : IsConnected F := by + obtain ⟨e⟩ := hF + let : PathConnectedSpace F := e.pathConnectedSpace + exact (isPathConnected_iff_pathConnectedSpace.mpr inferInstance).isConnected + +/-- Every schismatic shape is solid and connected, as required for the +alternative definition of alpha in VII Section 8, page 241. -/ +theorem solid_connected_of_schismatic + {S : Type*} [TopologicalSpace S] [T2Space S] [CompactSpace S] + {X : Set S} (hX : GM07.IsSchismatic X) : IsSolid X ∧ IsConnected X := by + rcases hX.1 with hF | h1 | h2 | h3 + · exact ⟨isSolid_oArc hF, connected_circle hF⟩ + · obtain ⟨A, B, P, u, v, hA, hB, _, hP, hu, hv, _, _, rfl⟩ := h1 + have hL : IsLine P := ⟨hP.choose⟩ + have hAP := (connected_circle hA).union ⟨u, hu, hP.left_mem⟩ (connected_line hL) + have hAPB := hAP.union ⟨v, Or.inr hP.right_mem, hv⟩ (connected_circle hB) + rw [union_right_comm] at hAPB + exact ⟨isSolid_union (isSolid_union (isSolid_oArc hA) (isSolid_oArc hB)) (isSolid_line hL), + hAPB⟩ + · obtain ⟨A, B, u, hA, hB, hcap, rfl⟩ := h2 + have hu : u ∈ A ∩ B := hcap.symm ▸ mem_singleton u + exact ⟨isSolid_union (isSolid_oArc hA) (isSolid_oArc hB), + (connected_circle hA).union ⟨u, hu⟩ (connected_circle hB)⟩ + · obtain ⟨P, Q, R, u, v, _, hP, hQ, hR, _, _, _, rfl⟩ := h3 + have hPL : IsLine P := ⟨hP.choose⟩ + have hQL : IsLine Q := ⟨hQ.choose⟩ + have hRL : IsLine R := ⟨hR.choose⟩ + have hPQ := (connected_line hPL).union ⟨u, hP.left_mem, hQ.left_mem⟩ (connected_line hQL) + exact ⟨isSolid_union (isSolid_union (isSolid_line hPL) (isSolid_line hQL)) (isSolid_line hRL), + hPQ.union ⟨u, Or.inl hP.left_mem, hR.left_mem⟩ (connected_line hRL)⟩ + +/-- A normal schismatic set is an alpha candidate, not merely a subset +of one. This is one direction of VII Section 8's alternative minimum. -/ +theorem alphaCandidate_of_normal_schismatic + {S : Type*} [TopologicalSpace S] [T2Space S] [CompactSpace S] + {G : Drawing S} {X : Set S} (hX : GM07.IsSchismatic X) (hn : G.IsNormal X) : + GM07.IsAlphaCandidate G X := by + obtain ⟨hs, hc⟩ := solid_connected_of_schismatic hX + exact ⟨hs, hc, hn, hX.2.1⟩ + +/-- Each normal schismatic vertex count bounds alpha above, as used +in the alternative minimum of VII Section 8, page 241. -/ +theorem alpha_le_normal_schismatic_count + {S : Type*} [TopologicalSpace S] [T2Space S] [CompactSpace S] + {G : Drawing S} {X : Set S} (hX : GM07.IsSchismatic X) (hn : G.IsNormal X) : + GM07.alpha G ≤ (X ∩ G.V).ncard := by + exact Nat.sInf_le ⟨X, alphaCandidate_of_normal_schismatic hX hn, rfl⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SelectedSmallDisc.lean b/LeanPool/GraphMinor/GM12/Section3SelectedSmallDisc.lean new file mode 100644 index 0000000000..68c1da8486 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SelectedSmallDisc.lean @@ -0,0 +1,91 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ShortCurve +public import LeanPool.GraphMinor.GM12.Section3SmallDiscUnique +import LeanPool.GraphMinor.GM12.Section2CurveCounts + +/-! +# Selecting the small discs in the proof of XII (3.2) + +Claim (1) puts at most one prescribed disc in the selected inside +of a short normal circle. For claim (2), compare any other disc +bounded by that circle and enclosing at most one prescribed disc. +Outside the sphere-with-at-most-two-discs cases the proved disc +uniqueness lemma makes the two discs equal. Thus the other disc is +selected by the tangle as well. These are the first two claims on +page 246. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM14 + +/-- The selected inside of a short normal circle includes at most +one separated prescribed disc, by claim (1) of XII (3.2), page 246. -/ +theorem selected_disc_includes_at_most_one_prescribed_disc + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ η : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + (hη : η ≤ θ) (Δ r : ι → Set S) (hr : ∀ i, r i ∈ Γ.R) + (hrΔ : ∀ i, (r i ∩ Δ i).Nonempty) + (hsep : ∀ i j, i ≠ j → η ≤ tangleMetric Γ K ins θ (r i) (r j)) + {F D : Set S} (hF : IsOArc F) (hn : Γ.IsNormal F) + (hlen : (Γ.V ∩ F).ncard < η) (hD : IsClosedDisc D) (hbd : subBd D = F) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) : + ∀ i j, Δ i ⊆ D → Δ j ⊆ D → i = j := by + obtain ⟨φ, _, hφrange, hφ, hφlen⟩ := exists_normal_curve_of_oArc hF hn + have hlenφ : curveLength Γ φ < η := hφlen ▸ hlen + intro i j hi hj + exact short_curve_enclosing_discs_indices_eq hS hT hrespect hK hd hη Δ r hr hrΔ hsep + hφ hlenφ hF hF hφrange.symm.subset hφrange.symm.subset hD hD hbd hbd hm hm hi hj + +/-- Claim (2) in the proof of Graph Minors XII (3.2), page 246. +A short normal circle in the punctured surface selects any disc that +it bounds which includes at most one prescribed disc, in the allowed +surface cases. -/ +theorem small_disc_is_selected_of_at_most_one_prescribed_disc + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ η : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + (hη : η ≤ θ) (Δ r : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) (hr : ∀ i, r i ∈ Γ.R) + (hrΔ : ∀ i, (r i ∩ Δ i).Nonempty) + (hsep : ∀ i j, i ≠ j → η ≤ tangleMetric Γ K ins θ (r i) (r j)) + {F D : Set S} (hF : IsOArc F) (hn : Γ.IsNormal F) + (hlen : (Γ.V ∩ F).ncard < η) (hFstar : F ⊆ discComplement Δ) + (hD : IsClosedDisc D) (hbdD : discBd D = F) + (honeD : ∀ i j, Δ i ⊆ D → Δ j ⊆ D → i = j) : + ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T := by + have hlenθ : (F ∩ Γ.V).ncard < θ := by + rw [inter_comm] + exact hlen.trans_le hη + obtain ⟨E, hE, hbdE, hmE⟩ := hrespect.2 F hF hn hlenθ + have honeE := selected_disc_includes_at_most_one_prescribed_disc hS hT hrespect hK hd + hη Δ r hr hrΔ hsep hF hn hlen hE hbdE hmE + have hbE : discBd E = F := + (IsClosedDisc.frontier_eq_discBd hS hE).symm.trans ((subBd_eq_frontier E).symm.trans hbdE) + have heq := eq_of_discBd_eq_of_at_most_one_deleted_disc hS Δ hΔ hcase hD hE + (hbdD.trans hbE.symm) (hbdD.symm ▸ hFstar) honeD honeE + simpa only [heq] using hmE + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SeparatedDiscs.lean b/LeanPool/GraphMinor/GM12/Section3SeparatedDiscs.lean new file mode 100644 index 0000000000..935f6c356a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SeparatedDiscs.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3GeometricReduction +public import LeanPool.GraphMinor.GM12.Section3SmallCircleConditions +public import LeanPool.GraphMinor.GM12.Section3MeetingCircleCondition +public import LeanPool.GraphMinor.GM12.Section3JoinedCircleCondition +public import LeanPool.GraphMinor.GM12.Section3ThetaCondition + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Separated free discs outside the small sphere cases + +This assembles the first case of XII (3.2), pages 246--247. +Choose the geometric threshold from (3.1), increasing it to the +total boundary bound if needed, and take twice that bound plus one. +The short-circle, joined-circle, meeting-circle, and theta-face +lemmas verify the geometric conditions. Freeness gives the remaining +boundary inequality, so (3.1) supplies the connected subdrawings. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM14 + +universe u + +/-- Graph Minors XII (3.2), pages 246--247, when the surface is not +a sphere or there are at least three prescribed discs. The regions +and radial metric are displayed explicitly. -/ +theorem theorem_3_2_of_not_sphere_or_three_le + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (t z : ℕ) (hcase : ¬ IsSphere S ∨ 3 ≤ t) : + ∃ η : ℕ, 1 ≤ η ∧ ∀ (Γ K : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (ins : Drawing S → Set S) (Δ r : Fin t → Set S) (p : ℕ) (Zs : Fin p → Set S), + GM10.IsTangle Γ.toHypergraph θ T → + (PaintingOrDrawing.drawing Γ).IsRespectful θ T → + (PaintingOrDrawing.drawing Γ).IsRadialDrawing K → + IsDerivedSlope (.drawing Γ) K θ T ins → η ≤ θ → + (∀ i, IsClosedDisc (Δ i)) → Pairwise (fun i j => Disjoint (Δ i) (Δ j)) → + (∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) → + (∀ i, r i ∈ Γ.R) → (∀ i, (r i ∩ Δ i).Nonempty) → + (∀ i j, i ≠ j → η ≤ tangleMetric Γ K ins θ (r i) (r j)) → + (∀ i, GM10.IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd (Δ i))) → + (discBoundaryVertices Γ Δ).ncard ≤ z → + (⋃ j, Zs j) = discBoundaryVertices Γ Δ → + (∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) → IsTopologicallyFeasible Δ Zs → + HasConnectingSubdrawings Γ (discBoundaryVertices Γ Δ) Zs := by + obtain ⟨N, hN⟩ := theorem_3_1_proof hS t z hcase + let η := 2 * max N z + 1 + have h2N : 2 * N < η := Nat.lt_succ_of_le (Nat.mul_le_mul_left 2 (le_max_left N z)) + have hNη : N < η := (Nat.le_mul_of_pos_left N (by decide : 0 < 2)).trans_lt h2N + have hzη : z ≤ η := (le_max_right N z).trans + ((Nat.le_mul_of_pos_left (max N z) (by decide : 0 < 2)).trans (Nat.le_succ _)) + refine ⟨η, Nat.succ_le_succ (Nat.zero_le _), ?_⟩ + intro Γ K θ T ins Δ r p Zs hT hrespect hK hd hη hΔ hdis havoid hr hrΔ hsep hfree + hcount hcover hdisZ hfeasible + have hcase' : ¬ IsSphere S ∨ 3 ≤ Nat.card (Fin t) := by simpa only [Nat.card_fin] using hcase + apply hN Γ Δ hΔ hdis havoid p Zs + · intro F hn hF _ hsmall + exact small_circle_bounds_at_most_one_prescribed_disc hS hT hrespect hK hd hη hNη + Δ r hr hrΔ hsep hF hn hsmall + · intro A B P D E u v hn hA hB hP hu hv hPA hPB hstar hD hE hbD hbE hDE hi hj + exact joined_circle_vertex_count_gt hS hT hrespect hK hd hη Δ r hΔ hcase' hr hrΔ hsep + h2N hn hA hB hP hu hv hPA hPB hstar hD hE hbD hbE hDE hi hj + · intro A B D E hn hA hB hstar hD hE hbD hbE hcap hi hj + exact meeting_circle_vertex_count_gt hS hT hrespect hK hd hη Δ r hΔ hcase' hr hrΔ hsep + h2N hn hA hB hstar hD hE hbD hbE hcap hi hj + · intro ht _ P D a b _ hn hP hPP hstar hDs + subst t + apply theta_vertex_count_gt hS hT hrespect hK hd hη Δ r hΔ hr hrΔ hsep hNη P D + hn hP hPP hstar (fun i => (hDs i).1) (fun i => (hDs i).2.1) + · intro i + simpa only [Fin.cast_refl, id_eq] using (hDs i).2.2.1 + · exact fun i => (hDs i).2.2.2 + · exact hcover + · exact hdisZ + · exact hfeasible + · intro F hn hF hstar D hD hbD i hi + exact free_boundary_count_le_of_enclosing_disc hS hT hrespect hK hd hη hzη Δ r hΔ + hcase' hr hrΔ hsep hcount hfree hF hn hstar hD hbD i hi + · exact hcount + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SeparatedMetric.lean b/LeanPool/GraphMinor/GM12/Section3SeparatedMetric.lean new file mode 100644 index 0000000000..756d637d65 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SeparatedMetric.lean @@ -0,0 +1,73 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SeparatedDiscs +import LeanPool.GraphMinor.GM11.Regions + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Separated free discs stated using a tangle metric + +Each prescribed disc has an interior point outside the drawing, +since it meets the drawing only on its boundary. Choose the region +containing that point, unpack the radial description of the metric, +and apply the proved nonsphere-or-three-disc case of XII (3.2). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM14 + +universe u + +/-- The first case of XII (3.2), pages 246--247, with the radial +drawing hidden in the hypothesis that `d` is the tangle metric. -/ +theorem theorem_3_2_separated_metric + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (t z : ℕ) (hcase : ¬ IsSphere S ∨ 3 ≤ t) : + ∃ η : ℕ, 1 ≤ η ∧ ∀ (Δ : Fin t → Set S) (Γ : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (p : ℕ) (Zs : Fin p → Set S), + (∀ i, IsClosedDisc (Δ i) ∧ Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) → + Pairwise (fun i j => Disjoint (Δ i) (Δ j)) → + (discBoundaryVertices Γ Δ).ncard ≤ z → + (⋃ j, Zs j) = discBoundaryVertices Γ Δ → + (∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) → IsTopologicallyFeasible Δ Zs → + η ≤ θ → HasTangleMetric Γ θ T d → + (∀ i j, i ≠ j → ∀ ri ∈ Γ.R, (ri ∩ Δ i).Nonempty → + ∀ rj ∈ Γ.R, (rj ∩ Δ j).Nonempty → η ≤ d ri rj) → + (∀ i, GM10.IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd (Δ i))) → + HasConnectingSubdrawings Γ (discBoundaryVertices Γ Δ) Zs := by + obtain ⟨η, hηpos, hη⟩ := theorem_3_2_of_not_sphere_or_three_le hS t z hcase + refine ⟨η, hηpos, ?_⟩ + intro Δ Γ θ T d p Zs hΔ hdis hcount hcover hdisZ hfeasible horder hmetric hsep hfree + have hregion : ∀ i, ∃ r ∈ Γ.R, (r ∩ Δ i).Nonempty := by + intro i + obtain ⟨x, hx⟩ := (hΔ i).1.nonempty_discInt + have hxU : x ∉ Γ.U := by + intro hxU + exact hx.2 (((hΔ i).2.subset ⟨hxU, hx.1⟩).2) + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem hxU + exact ⟨r, hr, x, hxr, hx.1⟩ + choose r hr hrΔ using hregion + obtain ⟨hT, K, ins, hK, hd, heq⟩ := hmetric + have hsep' : ∀ i j, i ≠ j → η ≤ tangleMetric Γ K ins θ (r i) (r j) := by + intro i j hij + rw [← heq (r i) (Or.inr (hr i)) (r j) (Or.inr (hr j))] + exact hsep i j hij (r i) (hr i) (hrΔ i) (r j) (hr j) (hrΔ j) + exact hη Γ K θ T ins Δ r p Zs hT.2.1 hT.2.2 hK hd horder + (fun i => (hΔ i).1) hdis (fun i => (hΔ i).2) hr hrΔ hsep' hfree + hcount hcover hdisZ hfeasible + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ShortCurve.lean b/LeanPool/GraphMinor/GM12/Section3ShortCurve.lean new file mode 100644 index 0000000000..41c17cd7c5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ShortCurve.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ShortTrace +public import LeanPool.GraphMinor.GM12.Section2Theorem +import LeanPool.GraphMinor.GM12.Section2TangleTraceExistence + +/-! +# A short normal curve cannot enclose two separated prescribed discs + +Claim (1) in the proof of XII (3.2), page 246, takes a trace of the +short normal curve. Each prescribed region meets a selected inside +bounded by a circle in that curve's image. XII (2.1) makes both regions +meet the trace inside. This trace has length twice the curve length, +so the radial metric is below the prescribed separation threshold. +The two disc indices must therefore agree. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM14 + +/-- Claim (1) in the proof of Graph Minors XII (3.2), page 246. +Selected insides of circles in one short normal curve cannot include +two prescribed discs whose regions are sufficiently separated. -/ +theorem short_curve_enclosing_discs_indices_eq + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ η : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + (hη : η ≤ θ) (Δ r : ι → Set S) (hr : ∀ i, r i ∈ Γ.R) + (hrΔ : ∀ i, (r i ∩ Δ i).Nonempty) + (hsep : ∀ i j, i ≠ j → η ≤ tangleMetric Γ K ins θ (r i) (r j)) + {φ : C(Circle, S)} (hφ : IsNormalCurve Γ φ) (hlen : curveLength Γ φ < η) + {F₁ F₂ D₁ D₂ : Set S} (hF₁ : IsOArc F₁) (hF₂ : IsOArc F₂) + (hF₁φ : F₁ ⊆ range φ) (hF₂φ : F₂ ⊆ range φ) + (hD₁ : IsClosedDisc D₁) (hD₂ : IsClosedDisc D₂) + (hbd₁ : subBd D₁ = F₁) (hbd₂ : subBd D₂ = F₂) + (hm₁ : ((PaintingOrDrawing.drawing Γ).inter D₁, + (PaintingOrDrawing.drawing Γ).interOutside D₁) ∈ T) + (hm₂ : ((PaintingOrDrawing.drawing Γ).inter D₂, + (PaintingOrDrawing.drawing Γ).interOutside D₂) ∈ T) + {i j : ι} (hi : Δ i ⊆ D₁) (hj : Δ j ⊆ D₂) : i = j := by + have hlenθ : curveLength Γ φ < θ := hlen.trans_le hη + obtain ⟨u, W, hW⟩ := exists_trace_of_curveLength_lt_tangle_order hS hT hK hφ hlenθ + have hiD : (r i ∩ D₁).Nonempty := (hrΔ i).mono (inter_subset_inter_right (r i) hi) + have hjD : (r j ∩ D₂).Nonempty := (hrΔ j).mono (inter_subset_inter_right (r j) hj) + have hiW := (theorem_2_1_proof hS hT hrespect hK hd W hW hlenθ hF₁ hF₁φ hD₁ hbd₁ hm₁ + (Or.inr (hr i)) hiD).2 + have hjW := (theorem_2_1_proof hS hT hrespect hK hd W hW hlenθ hF₂ hF₂φ hD₂ hbd₂ hm₂ + (Or.inr (hr j)) hjD).2 + exact short_trace_meeting_separated_regions hS hK hd hη r hr hsep hW hlen hiW hjW + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ShortTrace.lean b/LeanPool/GraphMinor/GM12/Section3ShortTrace.lean new file mode 100644 index 0000000000..ac86c1410f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ShortTrace.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2 +public import LeanPool.GraphMinor.GM12.Section4WalkMetric + +/-! +# A short trace cannot meet two separated regions + +Claim (1) in the proof of XII (3.2), page 246, applies (2.1) to make +the two prescribed regions meet the inside of one trace. The trace +then witnesses distance less than the separation threshold. This file +proves that metric step. The atom-transfer assertion of (2.1) is not +assumed or asserted here: the two intersections are explicit inputs. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM14 Hypergraph + +/-- A trace has twice the length of its original curve, including +in the zero-length case of the definition on XII, page 243. -/ +theorem trace_length_eq_two_mul_curveLength + {S : Type*} [TopologicalSpace S] {Γ K : Drawing S} {φ : C(Circle, S)} + {u : S} {W : GraphWalk K.toGraph u u} (hW : IsTrace Γ K φ W) : + W.length = 2 * curveLength Γ φ := by + rcases hW.2 with h | h + · rw [h.1, mul_zero, h.2.1] + · exact h.2.1 + +/-- The metric step of claim (1) in XII (3.2), page 246. Once (2.1) +has made two prescribed regions meet the trace inside, their prescribed +separation forces their indices to agree. -/ +theorem short_trace_meeting_separated_regions + {S ι : Type*} [TopologicalSpace S] [T1Space S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ η : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + (hη : η ≤ θ) (r : ι → Set S) (hr : ∀ i, r i ∈ Γ.R) + (hsep : ∀ i j, i ≠ j → η ≤ tangleMetric Γ K ins θ (r i) (r j)) + {φ : C(Circle, S)} {u : S} {W : GraphWalk K.toGraph u u} + (hW : IsTrace Γ K φ W) (hlen : curveLength Γ φ < η) + {i j : ι} (hi : (r i ∩ insWalk ins K W).Nonempty) + (hj : (r j ∩ insWalk ins K W).Nonempty) : i = j := by + obtain ⟨v, ⟨hvr, hvK⟩, _⟩ := hK.2.1.2.2.1 (r i) (hr i) + obtain ⟨w, ⟨hwr, hwK⟩, _⟩ := hK.2.1.2.2.1 (r j) (hr j) + have hc : ∀ k x, x ∈ K.V → x ∈ r k → IsCorrespondingAtom Γ K (r k) {x} := by + intro k x hxK hxr + exact ⟨Or.inr (hr k), Or.inl (Or.inl ⟨x, hxK, rfl⟩), + Or.inr (Or.inr ⟨hr k, x, ⟨hxK, hxr⟩, rfl⟩)⟩ + have hl : W.length < 2 * θ := theorem_2_1_length hW (hlen.trans_le hη) + have hiW := (corresponding_atom_subset_iff hS hK hd (hc i v hvK hvr) W hl).mpr hi + have hjW := (corresponding_atom_subset_iff hS hK hd (hc j w hwK hwr) W hl).mpr hj + have hdW := tangleMetric_le_of_walk (hc i v hvK hvr) (hc j w hwK hwr) + W hl (trace_length_eq_two_mul_curveLength hW) hiW hjW + by_contra hij + exact (not_lt_of_ge (hsep i j hij)) (hdW.trans_lt hlen) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SmallCircleConditions.lean b/LeanPool/GraphMinor/GM12/Section3SmallCircleConditions.lean new file mode 100644 index 0000000000..4de4e1c5ec --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SmallCircleConditions.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SelectedSmallDisc +public import LeanPool.GraphMinor.GM12.Section3FreeBoundary + +/-! +# The small-circle and free-boundary conditions of XII (3.1) + +In the proof of XII (3.2), pages 246--247, respectfulness gives the +selected inside of a short normal circle. Claim (1) says that it +contains at most one prescribed disc, verifying (3.1)(i). For (v), +claim (2) selects a disc enclosing exactly one prescription, and +freeness bounds the boundary vertices by its separation order. If +the enclosing circle is not short, the total prescribed vertex bound +already proves the inequality. Choose the uniform threshold at least +that total bound when applying these lemmas. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM14 GM10 + +/-- Verification of XII (3.1)(i) in the proof of (3.2), page 246: +a normal circle with at most `N` drawing vertices bounds a disc +including at most one prescribed disc when `N < η`. -/ +theorem small_circle_bounds_at_most_one_prescribed_disc + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ η N : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + (hη : η ≤ θ) (hN : N < η) (Δ r : ι → Set S) (hr : ∀ i, r i ∈ Γ.R) + (hrΔ : ∀ i, (r i ∩ Δ i).Nonempty) + (hsep : ∀ i j, i ≠ j → η ≤ tangleMetric Γ K ins θ (r i) (r j)) + {F : Set S} (hF : IsOArc F) (hn : Γ.IsNormal F) (hcount : (Γ.V ∩ F).ncard ≤ N) : + ∃ D : Set S, IsClosedDisc D ∧ discBd D = F ∧ + ∀ i j, Δ i ⊆ D → Δ j ⊆ D → i = j := by + have hshort : (Γ.V ∩ F).ncard < η := hcount.trans_lt hN + have hlenθ : (F ∩ Γ.V).ncard < θ := by rw [Set.inter_comm]; exact hshort.trans_le hη + obtain ⟨D, hD, hbd, hm⟩ := hrespect.2 F hF hn hlenθ + refine ⟨D, hD, ?_, selected_disc_includes_at_most_one_prescribed_disc hS hT hrespect hK hd + hη Δ r hr hrΔ hsep hF hn hshort hD hbd hm⟩ + exact (IsClosedDisc.frontier_eq_discBd hS hD).symm.trans ((subBd_eq_frontier D).symm.trans hbd) + +/-- Verification of XII (3.1)(v) in the proof of (3.2), page 247. +Short enclosing circles are tangle-selected by claim (2), so freeness +bounds their vertex count. Long circles are covered by the total +prescribed boundary bound. -/ +theorem free_boundary_count_le_of_enclosing_disc + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ η z : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + (hη : η ≤ θ) (hzη : z ≤ η) (Δ r : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) (hr : ∀ i, r i ∈ Γ.R) + (hrΔ : ∀ i, (r i ∩ Δ i).Nonempty) + (hsep : ∀ i j, i ≠ j → η ≤ tangleMetric Γ K ins θ (r i) (r j)) + (hsmall : (discBoundaryVertices Γ Δ).ncard ≤ z) + (hfree : ∀ i, IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd (Δ i))) + {F D : Set S} (hF : IsOArc F) (hn : Γ.IsNormal F) (hFstar : F ⊆ discComplement Δ) + (hD : IsClosedDisc D) (hbd : discBd D = F) (i : ι) + (hexact : ∀ j, Δ j ⊆ D ↔ j = i) : + (Γ.V ∩ discBd (Δ i)).ncard ≤ (Γ.V ∩ F).ncard := by + by_cases hshort : (Γ.V ∩ F).ncard < η + · have hone : ∀ j k, Δ j ⊆ D → Δ k ⊆ D → j = k := by + intro j k hj hk + exact ((hexact j).mp hj).trans ((hexact k).mp hk).symm + have hm := small_disc_is_selected_of_at_most_one_prescribed_disc hS hT hrespect hK hd + hη Δ r hΔ hcase hr hrΔ hsep hF hn hshort hFstar hD hbd hone + have hb := boundary_vertex_count_le_of_free_of_selected_disc hS hD + ((hexact i).mpr rfl) (hfree i) hm + simpa only [hbd] using hb + · have hfinite : (discBoundaryVertices Γ Δ).Finite := Γ.finite_V.subset (by + intro x hx + obtain ⟨j, hj⟩ := mem_iUnion.mp hx + exact hj.1) + have hsub : Γ.V ∩ discBd (Δ i) ⊆ discBoundaryVertices Γ Δ := + fun _ hx => mem_iUnion.mpr ⟨i, hx⟩ + exact (Set.ncard_le_ncard hsub hfinite).trans + (hsmall.trans (hzη.trans (le_of_not_gt hshort))) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SmallDiscUnique.lean b/LeanPool/GraphMinor/GM12/Section3SmallDiscUnique.lean new file mode 100644 index 0000000000..1fe3199941 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SmallDiscUnique.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3PuncturedBoundary +public import LeanPool.GraphMinor.Surface.TopologyStatements +import LeanPool.GraphMinor.GM12.Section3DiscUniqueness +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Uniqueness of a disc enclosing at most one deletion + +Claim (2) in XII (3.2), page 246, compares two discs with the same +boundary in Sigma-star. On a surface other than a sphere, disc +uniqueness applies directly. With at least three deleted discs, the +two proposed discs cannot cover the surface: each deletion would be +on one side, but each side contains at most one deletion. This proves +the topological comparison needed for the tangle-selected disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- If two discs cover the surface and the first boundary lies in +Sigma-star, every deleted disc is wholly in one of them. Its connected +interior avoids that boundary, and closedness restores its boundary. -/ +theorem deleted_disc_subset_one_of_cover + {S ι : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + {D E : Set S} (hD : IsClosedDisc D) (hE : IsClosedDisc E) + (hbd : discBd D ⊆ discComplement Δ) (hcover : D ∪ E = univ) (i : ι) : + Δ i ⊆ D ∨ Δ i ⊆ E := by + have hdis : Disjoint (discInt (Δ i)) (discBd D) := by + apply Set.disjoint_left.mpr + intro x hxI hxB + exact hxI.2 (discComplement_inter_disc_subset_boundary hS Δ hΔ i + ⟨hbd hxB, hxI.1⟩) + rcases hD.side (fun x => (hS.2.2 x).isManifoldPoint) + (hΔ i).isPreconnected_discInt hdis with hin | hout + · apply Or.inl + have hcl : closure (discInt (Δ i)) ⊆ D := by + rw [← hD.isClosed.closure_eq] + exact closure_mono (hin.trans (discInt_subset D)) + exact (hΔ i).subset_closure_discInt.trans hcl + · apply Or.inr + have hIE : discInt (Δ i) ⊆ E := by + intro x hx + have hDE : x ∈ D ∪ E := hcover.symm ▸ mem_univ x + exact hDE.resolve_left (fun hxD => Set.disjoint_left.mp hout hx hxD) + have hcl : closure (discInt (Δ i)) ⊆ E := by + rw [← hE.isClosed.closure_eq] + exact closure_mono hIE + exact (hΔ i).subset_closure_discInt.trans hcl + +/-- The topological uniqueness step of claim (2) in XII (3.2), page +246. Two discs bounded in Sigma-star and enclosing at most one +prescribed deletion each must agree in the allowed surface cases. -/ +theorem eq_of_discBd_eq_of_at_most_one_deleted_disc + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + {D E : Set S} (hD : IsClosedDisc D) (hE : IsClosedDisc E) + (hb : discBd D = discBd E) (hbd : discBd D ⊆ discComplement Δ) + (honeD : ∀ i j, Δ i ⊆ D → Δ j ⊆ D → i = j) + (honeE : ∀ i j, Δ i ⊆ E → Δ j ⊆ E → i = j) : D = E := by + rcases hcase with hns | hthree + · exact Surface.eq_of_discBd_eq + ⟨hS.1, hS.2.1, fun x => (hS.2.2 x).isManifoldPoint⟩ hns hD hE hb + · apply eq_of_discBd_eq_of_union_ne_univ (fun x => (hS.2.2 x).isManifoldPoint) hD hE hb + intro hcover + let I : Set ι := {i | Δ i ⊆ D} + let J : Set ι := {i | Δ i ⊆ E} + have hI : I.ncard ≤ 1 := (Set.ncard_le_one (Set.toFinite _)).mpr fun i hi j hj + => honeD i j hi hj + have hJ : J.ncard ≤ 1 := (Set.ncard_le_one (Set.toFinite _)).mpr fun i hi j hj + => honeE i j hi hj + have hIJ : I ∪ J = univ := Set.eq_univ_iff_forall.mpr + (fun i => deleted_disc_subset_one_of_cover hS Δ hΔ hD hE hbd hcover i) + have hc := Set.ncard_union_le I J + rw [hIJ, Set.ncard_univ] at hc + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SolidConnections.lean b/LeanPool/GraphMinor/GM12/Section3SolidConnections.lean new file mode 100644 index 0000000000..f45353edf1 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SolidConnections.lean @@ -0,0 +1,138 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import Mathlib.Topology.Connected.LocallyPathConnected +import LeanPool.GraphMinor.Surface.ArcInPath +import LeanPool.GraphMinor.GM11.RadialChord + +/-! +# Connections inside a connected solid set + +The Section 8 argument of VII used in XII (3.1), page 245, joins its +selected circles inside the solid set. The paper's local +arc-connectedness definition gives path-connected neighbourhoods in +the subspace. Connectedness then gives paths between all its points, +and the arc-in-a-path theorem removes repeated parts of those paths. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Filter Surface GM11 + +/-- A nonempty arc-connected set is path-connected by parametrizing +the line between each pair of distinct points. -/ +theorem isPathConnected_of_isArcConnected + {S : Type*} [TopologicalSpace S] {X : Set S} + (hX : IsArcConnected X) (hne : X.Nonempty) : IsPathConnected X := by + apply isPathConnected_iff.mpr + refine ⟨hne, ?_⟩ + intro a ha b hb + by_cases hab : a = b + · rw [hab] + exact JoinedIn.refl hb + · obtain ⟨L, hLX, φ, hφ0, hφ1⟩ := hX a ha b hb hab + let p : Path a b := { + toFun := fun t => (φ t).val + continuous_toFun := continuous_subtype_val.comp φ.continuous + source' := hφ0 + target' := hφ1 } + exact ⟨p, fun t => hLX (φ t).property⟩ + +/-- The paper's local arc-connectedness condition gives a locally +path-connected subspace. The neighbourhoods are pulled back from the +ambient open sets in its definition. -/ +theorem locallyPathConnectedSpace_of_isLocallyArcConnected + {S : Type*} [TopologicalSpace S] {X : Set S} (hX : IsLocallyArcConnected X) : + LocallyPathConnectedSpace X := by + constructor + intro x + rw [hasBasis_self] + intro O hO + obtain ⟨U, hUO, hU, hxU⟩ := mem_nhds_iff.mp hO + obtain ⟨A, hA, hpre⟩ := IsInducing.subtypeVal.isOpen_iff.mp hU + have hxA : x.val ∈ A := by + change x ∈ (Subtype.val : X → S) ⁻¹' A + rw [hpre] + exact hxU + obtain ⟨A', hA'sub, hxA', hA', hArc⟩ := hX x.val x.property A hA hxA + have hpath : IsPathConnected ((Subtype.val : X → S) ⁻¹' A') := by + apply IsInducing.subtypeVal.isPathConnected_iff.mpr + rw [Subtype.image_preimage_coe] + exact isPathConnected_of_isArcConnected hArc ⟨x.val, x.property, hxA'⟩ + refine ⟨Subtype.val ⁻¹' A', (hA'.preimage continuous_subtype_val).mem_nhds hxA', hpath, ?_⟩ + intro y hy + apply hUO + rw [← hpre] + exact hA'sub hy + +/-- A path-connected subset of a Hausdorff space is arc-connected, +by taking an arc inside each joining path. -/ +theorem isArcConnected_of_isPathConnected + {S : Type*} [TopologicalSpace S] [T2Space S] {X : Set S} + (hpath : IsPathConnected X) : IsArcConnected X := by + intro a ha b hb hab + obtain ⟨p, hp⟩ := hpath.joinedIn a ha b hb + obtain ⟨e, hec, hei, he0, he1, heSub⟩ := exists_arc_of_path p.continuous + (by rw [p.source, p.target]; exact hab) + have hline := GM11.isLine_range hec hei + rw [he0, he1, p.source, p.target] at hline + refine ⟨range e, ?_, hline⟩ + apply heSub.trans + rintro x ⟨t, rfl⟩ + exact hp t + +/-- A connected locally arc-connected set in a Hausdorff space is +arc-connected. This supplies the joining lines in the schismatic +argument used by XII (3.1), page 245. -/ +theorem isArcConnected_of_isConnected_isLocallyArcConnected + {S : Type*} [TopologicalSpace S] [T2Space S] {X : Set S} + (hconn : IsConnected X) (hloc : IsLocallyArcConnected X) : IsArcConnected X := by + let : LocallyPathConnectedSpace X := locallyPathConnectedSpace_of_isLocallyArcConnected hloc + let : ConnectedSpace X := Subtype.connectedSpace hconn + let : PathConnectedSpace X := PathConnectedSpace.of_locallyPathConnectedSpace + have hpath : IsPathConnected X := isPathConnected_iff_pathConnectedSpace.mpr inferInstance + exact isArcConnected_of_isPathConnected hpath + +/-- Local path-connectedness of a subspace gives the paper's ambient +local arc-connectedness condition in a Hausdorff space. -/ +theorem isLocallyArcConnected_of_locallyPathConnectedSpace + {S : Type*} [TopologicalSpace S] [T2Space S] {X : Set S} + [LocallyPathConnectedSpace X] : IsLocallyArcConnected X := by + intro x hx A hA hxA + let y : X := ⟨x, hx⟩ + have hU : IsOpen ((Subtype.val : X → S) ⁻¹' A) := hA.preimage continuous_subtype_val + obtain ⟨W, ⟨hW, hyW, hpath⟩, hWU⟩ := + (isOpen_isPathConnected_basis y).mem_iff.mp (hU.mem_nhds hxA) + obtain ⟨B, hB, hpre⟩ := IsInducing.subtypeVal.isOpen_iff.mp hW + have hxB : x ∈ B := by + change y ∈ (Subtype.val : X → S) ⁻¹' B + rw [hpre] + exact hyW + refine ⟨B ∩ A, inter_subset_right, ⟨hxB, hxA⟩, hB.inter hA, ?_⟩ + have himage : (Subtype.val : X → S) '' W = X ∩ (B ∩ A) := by + ext z + constructor + · rintro ⟨w, hw, rfl⟩ + have hwB : w.val ∈ B := by + change w ∈ (Subtype.val : X → S) ⁻¹' B + rw [hpre] + exact hw + exact ⟨w.property, hwB, hWU hw⟩ + · rintro ⟨hzX, hzB, hzA⟩ + refine ⟨⟨z, hzX⟩, ?_, rfl⟩ + rw [← hpre] + exact hzB + rw [← himage] + exact isArcConnected_of_isPathConnected (hpath.image continuous_subtype_val) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SolidEmbedding.lean b/LeanPool/GraphMinor/GM12/Section3SolidEmbedding.lean new file mode 100644 index 0000000000..4124afcd3c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SolidEmbedding.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! +# Solid sets under closed embeddings + +The Section 8 argument of VII used in XII (3.1), page 245, applies +the planar criterion inside a capped surface. A closed embedding +preserves a solid set: closedness passes through the closed map, and +open neighbourhoods pull back to the original space. Arc connections +map to arc connections by the embedding. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- An embedding preserves arc-connectedness by mapping each line +homeomorphically onto its image. -/ +theorem isArcConnected_image_isEmbedding + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + {j : S → T} (hj : IsEmbedding j) {X : Set S} (hX : IsArcConnected X) : + IsArcConnected (j '' X) := by + rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ hab + have hab' : a ≠ b := fun he => hab (congrArg j he) + obtain ⟨L, hLX, φ, hφ0, hφ1⟩ := hX a ha b hb hab' + refine ⟨j '' L, image_mono hLX, φ.trans (hj.homeomorphImage L), ?_, ?_⟩ + · exact congrArg j hφ0 + · exact congrArg j hφ1 + +/-- A circle contained in an embedding's range pulls back to a +circle in the source. The map is the inverse of inclusion on that set. -/ +theorem isOArc_preimage_isEmbedding + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + {j : S → T} (hj : IsEmbedding j) {F : Set T} + (hF : IsOArc F) (hFrange : F ⊆ range j) : IsOArc (j ⁻¹' F) := by + let e : (j ⁻¹' F) ≃ₜ F := (hj.homeomorphImage (j ⁻¹' F)).trans + (Homeomorph.setCongr (image_preimage_eq_of_subset hFrange)) + obtain ⟨φ⟩ := hF + exact ⟨φ.trans e.symm⟩ + +/-- A closed embedding preserves the solid sets used in VII's alpha +parameter. Every local arc-connected neighbourhood is the pullback of +an ambient open neighbourhood. -/ +theorem isSolid_image_isClosedEmbedding + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + {j : S → T} (hj : IsClosedEmbedding j) {X : Set S} (hX : IsSolid X) : + IsSolid (j '' X) := by + refine ⟨?_, hj.isClosedMap X hX.2⟩ + rintro _ ⟨x, hxX, rfl⟩ O hO hxO + obtain ⟨A, hAsub, hxA, hA, hArc⟩ := hX.1 x hxX (j ⁻¹' O) + (hO.preimage hj.continuous) hxO + obtain ⟨B, hB, hpre⟩ := hj.isEmbedding.isInducing.isOpen_iff.mp hA + have hxB : j x ∈ B := by + change x ∈ j ⁻¹' B + rw [hpre] + exact hxA + refine ⟨B ∩ O, inter_subset_right, ⟨hxB, hxO⟩, hB.inter hO, ?_⟩ + have himage : j '' (X ∩ A) = j '' X ∩ (B ∩ O) := by + ext y + constructor + · rintro ⟨z, ⟨hzX, hzA⟩, rfl⟩ + have hzB : j z ∈ B := by + change z ∈ j ⁻¹' B + rw [hpre] + exact hzA + exact ⟨mem_image_of_mem j hzX, hzB, hAsub hzA⟩ + · rintro ⟨⟨z, hzX, rfl⟩, hzB, hzO⟩ + have hzA : z ∈ A := by + rw [← hpre] + exact hzB + exact ⟨z, ⟨hzX, hzA⟩, rfl⟩ + rw [← himage] + exact isArcConnected_image_isEmbedding hj.isEmbedding hArc + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SolidPlanarity.lean b/LeanPool/GraphMinor/GM12/Section3SolidPlanarity.lean new file mode 100644 index 0000000000..d370ee1a18 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SolidPlanarity.lean @@ -0,0 +1,99 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Cited +public import LeanPool.GraphMinor.GM12.Section3CapTopology +public import LeanPool.GraphMinor.GM12.Section3CapComparison +import LeanPool.GraphMinor.GM12.Section3SolidEmbedding +import LeanPool.GraphMinor.Surface.DiscsInSurface + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Planar criteria for the schismatic argument + +The unnumbered Section 8 argument of VII used in XII (3.1), page 245, +uses VII (5.1) both in the original surface and in a cap. A planar +circle is null-homotopic because it lies in a disc. In a cap, solidity +passes through the closed embedding and the image is a proper subset. +Thus circles planar after one fixed cuff is filled make the whole +solid set planar after that same filling. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +universe u + +/-- VII (5.1) makes a proper solid set planar if all its circles are +planar. The discs containing those circles contract their parametrizations. -/ +theorem planar_of_all_subcircles_planar + {S : Type u} [TopologicalSpace S] (hS : IsSurface S) (hconn : ConnectedSpace S) + {X : Set S} (hX : IsSolid X) (hproper : X ≠ univ) + (hcircles : ∀ F : Set S, IsOArc F → F ⊆ X → IsPlanar F) : IsPlanar X := by + apply (GraphMinor.GM07.gm07_theorem_5_1 S hS hconn X hX hproper).mpr + intro F hF hFX + obtain ⟨D, hD, hFD⟩ := hcircles F hF hFX + exact isNullHomotopicOArcIn_of_subset_disc hF (subset_univ D) hD hFD + +/-- A proper solid nonplanar set contains a nonplanar circle, by +VII (5.1). This is the first circle-selection step of Section 8. -/ +theorem exists_nonplanar_subcircle_of_not_planar + {S : Type u} [TopologicalSpace S] (hS : IsSurface S) (hconn : ConnectedSpace S) + {X : Set S} (hX : IsSolid X) (hproper : X ≠ univ) (hnot : ¬ IsPlanar X) : + ∃ F : Set S, IsOArc F ∧ F ⊆ X ∧ ¬ IsPlanar F := by + by_contra hn + apply hnot + apply planar_of_all_subcircles_planar hS hconn hX hproper + intro F hF hFX + by_contra hnotF + exact hn ⟨F, hF, hFX, hnotF⟩ + +/-- If every circle of a solid set is planar after filling one fixed +cuff, then the whole set is planar after filling that cuff. This applies +VII (5.1) in the actual cap, with all its hypotheses proved. -/ +theorem planarInCappedCuff_of_all_subcircles + {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] [ConnectedSpace S] + (hS : IsSurface S) {C X : Set S} {j : S → T} {D : Set T} + (hcap : GM07.IsCappedCuff C T j D) (hX : IsSolid X) + (hcircles : ∀ F : Set S, IsOArc F → F ⊆ X → GM07.IsPlanarInCappedCuff C F) : + GM07.IsPlanarInCappedCuff C X := by + have hconn : ConnectedSpace T := cappedCuff_connectedSpace hcap + have hjclosed := cappedCuff_isClosedEmbedding hS hcap + have hsolid : IsSolid (j '' X) := isSolid_image_isClosedEmbedding hjclosed hX + have hproper : j '' X ≠ univ := by + intro heq + apply cappedCuff_range_ne_univ hcap + apply eq_univ_of_univ_subset + rw [← heq] + rintro y ⟨x, _, rfl⟩ + exact mem_range_self x + have hplan : IsPlanar (j '' X) := by + apply planar_of_all_subcircles_planar hcap.isSurface hconn hsolid hproper + intro F hF hFX + have hFrange : F ⊆ range j := by + intro y hy + obtain ⟨x, _, rfl⟩ := hFX hy + exact mem_range_self x + have hpreF := isOArc_preimage_isEmbedding hcap.isEmbedding hF hFrange + have hpreX : j ⁻¹' F ⊆ X := by + intro x hx + obtain ⟨y, hy, he⟩ := hFX hx + exact hcap.isEmbedding.injective he ▸ hy + have hp := (hcircles (j ⁻¹' F) hpreF hpreX).2.2 T j D hcap + rw [image_preimage_eq_of_subset hFrange] at hp + exact hp + exact isPlanarInCappedCuff_of_one_cap hS hcap hplan + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SolidUnion.lean b/LeanPool/GraphMinor/GM12/Section3SolidUnion.lean new file mode 100644 index 0000000000..2d38866de4 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SolidUnion.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM12.Section3SolidConnections +import Mathlib.Topology.Algebra.Module.LocallyConvex + +/-! +# Solid unions and lines + +The schismatic shapes in the Section 8 argument used by XII (3.1), +page 245, are finite unions of circles and lines. A line is solid by +its interval chart. In a compact Hausdorff space a union of two solid +sets is solid: the map from their disjoint sum onto the union is a +compact quotient, so local path-connectedness passes to the union. +The subspace criterion converts this back to the paper's local +arc-connectedness condition. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A line is solid. Its interval chart supplies both compactness and +local path-connectedness. -/ +theorem isSolid_line + {S : Type*} [TopologicalSpace S] [T2Space S] {L : Set S} (hL : IsLine L) : + IsSolid L := by + obtain ⟨φ⟩ := hL + let : LocallyPathConnectedSpace unitInterval := + (convex_Icc (0 : ℝ) 1).locallyPathConnectedSpace + let : LocallyPathConnectedSpace L := φ.locallyPathConnectedSpace + let : CompactSpace L := φ.compactSpace + have hc : IsCompact L := isCompact_iff_compactSpace.mpr inferInstance + exact ⟨isLocallyArcConnected_of_locallyPathConnectedSpace, hc.isClosed⟩ + +/-- A union of two solid sets in a compact Hausdorff space is solid. +This supplies the finite-union step for schismatic shapes. -/ +theorem isSolid_union + {S : Type*} [TopologicalSpace S] [T2Space S] [CompactSpace S] + {X Y : Set S} (hX : IsSolid X) (hY : IsSolid Y) : IsSolid (X ∪ Y) := by + let : CompactSpace X := isCompact_iff_compactSpace.mp hX.2.isCompact + let : CompactSpace Y := isCompact_iff_compactSpace.mp hY.2.isCompact + let : LocallyPathConnectedSpace X := locallyPathConnectedSpace_of_isLocallyArcConnected hX.1 + let : LocallyPathConnectedSpace Y := locallyPathConnectedSpace_of_isLocallyArcConnected hY.1 + let f : X ⊕ Y → ↥(X ∪ Y) := Sum.elim + (fun x => ⟨x.val, Or.inl x.property⟩) (fun y => ⟨y.val, Or.inr y.property⟩) + have hfc : Continuous f := by + apply continuous_sum_dom.mpr + constructor <;> exact continuous_subtype_val.subtype_mk _ + have hfs : Function.Surjective f := by + intro z + rcases z.property with hz | hz + · exact ⟨.inl ⟨z.val, hz⟩, rfl⟩ + · exact ⟨.inr ⟨z.val, hz⟩, rfl⟩ + have hquot := hfc.isClosedMap.isQuotientMap hfc hfs + let : LocallyPathConnectedSpace ↥(X ∪ Y) := hquot.locallyPathConnectedSpace + exact ⟨isLocallyArcConnected_of_locallyPathConnectedSpace, hX.2.union hY.2⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SphereChordBound.lean b/LeanPool/GraphMinor/GM12/Section3SphereChordBound.lean new file mode 100644 index 0000000000..29f2871edf --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SphereChordBound.lean @@ -0,0 +1,81 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SphereSideDisc +public import LeanPool.GraphMinor.GM12.Section3SphereSeparatorCount +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# The normal-chord bound for the one-disc sphere case + +For XII (3.2), pages 247--248, a chord outside the prescribed disc +and the two boundary arcs form a theta graph. Choose the side disc +opposite each boundary arc. These two discs, together with the +prescribed disc, cover the sphere. Since the drawing meets the +prescribed disc only at its boundary, the two new discs already +cover the drawing. The unselected-side count gives the chord bound +needed for VI (3.6). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The complete normal-line inequality in the last case of XII +(3.2), pages 247--248, with the two boundary arcs displayed. -/ +theorem normal_chord_vertex_count_ge_min + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (hs : IsSphere S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) {Δ A B P : Set S} {a b : S} + (hΔ : IsClosedDisc Δ) (hbΔ : discBd Δ = A ∪ B) + (havoid : Γ.U ∩ Δ = Γ.V ∩ discBd Δ) + (hfree : GM10.IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd Δ)) + (hA : IsLineWithEnds A a b) (hB : IsLineWithEnds B a b) (hP : IsLineWithEnds P a b) + (hAB : A ∩ B = {a, b}) (hAP : A ∩ P = {a, b}) (hBP : B ∩ P = {a, b}) + (hPΔ : P ∩ Δ = {a, b}) (hnP : Γ.IsNormal P) : + min (Γ.V ∩ A).ncard (Γ.V ∩ B).ncard ≤ (Γ.V ∩ P).ncard := by + obtain ⟨D, hD, hbD, _, hnA, houtD⟩ := exists_sphere_theta_side_disc hS hs hA hB hP hAB hAP hBP + obtain ⟨E, hE, hbE, _, hnB, houtE⟩ := exists_sphere_theta_side_disc hS hs hB hA hP + ((inter_comm B A).trans hAB) hBP hAP + have hnPΔ : ¬ P ⊆ Δ := by + intro hsub + obtain ⟨x, hxP, hxne⟩ := line_sdiff_ends_nonempty hP + exact hxne (hPΔ.subset ⟨hxP, hsub hxP⟩) + have hcov := GM11.theta_cover hS hP hA hB + ((inter_comm P A).trans hAP) hAB hBP hΔ hD hE + ((IsClosedDisc.frontier_eq_discBd hS hΔ).trans hbΔ) + ((IsClosedDisc.frontier_eq_discBd hS hD).trans hbD) + ((IsClosedDisc.frontier_eq_discBd hS hE).trans (hbE.trans (union_comm A P))) hnPΔ hnA hnB + have hΓcov : Γ.U ⊆ D ∪ E := by + intro x hx + have hxcover : x ∈ Δ ∪ D ∪ E := hcov.symm.subset (mem_univ x) + rcases hxcover with (hxΔ | hxD) | hxE + · have hxBd := (havoid.subset ⟨hx, hxΔ⟩).2 + rw [hbΔ] at hxBd + rcases hxBd with hxA | hxB + · exact Or.inr (Surface.discBd_subset E (hbE.symm.subset (Or.inl hxA))) + · exact Or.inl (Surface.discBd_subset D (hbD.symm.subset (Or.inl hxB))) + · exact Or.inl hxD + · exact Or.inr hxE + have hn : Γ.IsNormal (A ∪ B ∪ P) := by + intro x hx + rcases hx.1 with hxAB | hxP + · have hxBd : x ∈ discBd Δ := hbΔ.symm.subset hxAB + exact (havoid.subset ⟨hx.2, Surface.discBd_subset Δ hxBd⟩).1 + · exact hnP ⟨hxP, hx.2⟩ + apply sphere_separator_vertex_count_ge_min hS hT (hbΔ ▸ hfree) hAB hAP hBP hn hD hE + hbD hbE hΓcov (fun _ hx => houtD hx.2) + intro x hx + exact houtE (hx.2.elim Or.inr Or.inl) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SphereChordTransfer.lean b/LeanPool/GraphMinor/GM12/Section3SphereChordTransfer.lean new file mode 100644 index 0000000000..e573a48603 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SphereChordTransfer.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SphereChordBound +public import LeanPool.GraphMinor.GM12.Section3SubspaceDrawing +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs +import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# The sphere chord bound in the complementary disc + +The one-disc case of XII (3.2), pages 247--248, applies VI in +the complementary disc, while the tangle lives on the original +sphere drawing. Include the two boundary arcs and the normal chord +into the sphere. Their intersections, endpoints, and drawing vertex +counts are preserved by this inclusion. The sphere chord theorem +therefore gives exactly the minimum-arc inequality used in VI. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Read the normal-chord inequality of XII (3.2), pages 247--248, +in the complementary closed disc where VI (3.6) is applied. -/ +theorem sphere_chord_bound_in_complement + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (hs : IsSphere S) (Γ : Drawing S) {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) {Δ : Set S} + (hΔ : IsClosedDisc Δ) (havoid : Γ.U ∩ Δ = Γ.V ∩ discBd Δ) + (hfree : GM10.IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd Δ)) + (C : Set S) (hUC : Γ.U ⊆ C) (hbdC : bd C = (Subtype.val : C → S) ⁻¹' discBd Δ) + (hCΔ : C ∩ Δ = discBd Δ) + (x y : C) (A B P : Set C) (hA : IsLineWithEnds A x y) (hB : IsLineWithEnds B x y) + (hP : IsLineWithEnds P x y) (hAB : A ∩ B = {x, y}) (hAP : A ∩ P = {x, y}) + (hBP : B ∩ P = {x, y}) (hbd : bd C = A ∪ B) (hcap : P ∩ bd C = {x, y}) + (hn : (drawingInSubspace Γ C hUC).IsNormal P) : + min ((drawingInSubspace Γ C hUC).V ∩ A).ncard + ((drawingInSubspace Γ C hUC).V ∩ B).ncard ≤ + ((drawingInSubspace Γ C hUC).V ∩ P).ncard := by + let f : C → S := Subtype.val + have hbdΔC : discBd Δ ⊆ C := hCΔ.symm.subset.trans inter_subset_left + have hbimage : f '' bd C = discBd Δ := by + rw [hbdC, Subtype.image_preimage_coe] + exact inter_eq_right.mpr hbdΔC + have hbd' : discBd Δ = f '' A ∪ f '' B := + hbimage.symm.trans ((congrArg (Set.image f) hbd).trans (image_union f A B)) + have himageInter : ∀ {L M : Set C}, L ∩ M = {x, y} → + f '' L ∩ f '' M = {x.val, y.val} := by + intro L M hLM + rw [← image_inter Subtype.val_injective, hLM, image_pair] + have hPΔ : f '' P ∩ Δ = {x.val, y.val} := by + apply Subset.antisymm + · rintro z ⟨⟨w, hw, rfl⟩, hwΔ⟩ + have hwBd : w.val ∈ discBd Δ := hCΔ.subset ⟨w.property, hwΔ⟩ + have hwB : w ∈ bd C := hbdC.symm ▸ hwBd + rcases hcap.subset ⟨hw, hwB⟩ with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + · intro z hz + rcases hz with rfl | rfl + · have hx := hcap.symm.subset (Or.inl rfl) + refine ⟨⟨x, hx.1, rfl⟩, ?_⟩ + exact Surface.discBd_subset Δ (hbdC.subset hx.2) + · have hy := hcap.symm.subset (Or.inr rfl) + refine ⟨⟨y, hy.1, rfl⟩, ?_⟩ + exact Surface.discBd_subset Δ (hbdC.subset hy.2) + have hcount := normal_chord_vertex_count_ge_min hS hs hT hΔ hbd' havoid hfree + (isLineWithEnds_subtype_image hA) (isLineWithEnds_subtype_image hB) + (isLineWithEnds_subtype_image hP) (himageInter hAB) (himageInter hAP) (himageInter hBP) + hPΔ (drawingInSubspace_isNormal_image Γ C hUC hn) + have hcounts : ∀ Q : Set C, (Γ.V ∩ f '' Q).ncard = ((drawingInSubspace Γ C hUC).V ∩ Q).ncard := by + intro Q + rw [← drawingInSubspace_image_vertices_inter Γ C hUC Q, + Set.ncard_image_of_injective _ Subtype.val_injective] + rw [hcounts A, hcounts B, hcounts P] at hcount + exact hcount + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SphereSeparatorCount.lean b/LeanPool/GraphMinor/GM12/Section3SphereSeparatorCount.lean new file mode 100644 index 0000000000..fdd5c83fc5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SphereSeparatorCount.lean @@ -0,0 +1,105 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3UnselectedBoundary +import LeanPool.GraphMinor.GM12.Section2NormalNoncover +import LeanPool.GraphMinor.GM11.Theorem66 +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# The separator inequality in the one-disc sphere case + +In XII (3.2), pages 247--248, a normal line and the two arcs of +the prescribed boundary determine two discs covering the drawing. +The second tangle axiom leaves at least one disc unselected. The +free boundary vertices lie on its reverse side, so the unselected +boundary lemma bounds their total number by its boundary count. +Cancel the common arc and common ends. The line has at least as +many vertices as one of the two prescribed arcs, hence at least +the smaller of their two counts. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +private theorem vertex_count_le_of_union_count_le + {S : Type*} [TopologicalSpace S] (Γ : Drawing S) {A B P : Set S} + (hcap : A ∩ B = A ∩ P) + (hcount : (Γ.V ∩ (A ∪ B)).ncard ≤ (Γ.V ∩ (A ∪ P)).ncard) : + (Γ.V ∩ B).ncard ≤ (Γ.V ∩ P).ncard := by + have hcommon : (Γ.V ∩ A) ∩ (Γ.V ∩ B) = (Γ.V ∩ A) ∩ (Γ.V ∩ P) := by + have h₁ : (Γ.V ∩ A) ∩ (Γ.V ∩ B) = Γ.V ∩ (A ∩ B) := by + ext x + simp only [mem_inter_iff] + tauto + have h₂ : (Γ.V ∩ A) ∩ (Γ.V ∩ P) = Γ.V ∩ (A ∩ P) := by + ext x + simp only [mem_inter_iff] + tauto + rw [h₁, h₂, hcap] + have h₁ := Set.ncard_union_add_ncard_inter (Γ.V ∩ A) (Γ.V ∩ B) + (Γ.finite_V.inter_of_left A) (Γ.finite_V.inter_of_left B) + have h₂ := Set.ncard_union_add_ncard_inter (Γ.V ∩ A) (Γ.V ∩ P) + (Γ.finite_V.inter_of_left A) (Γ.finite_V.inter_of_left P) + rw [hcommon] at h₁ + rw [inter_union_distrib_left, inter_union_distrib_left] at hcount + omega + +/-- The normal-line vertex inequality used to apply VI (3.6) in +XII (3.2), pages 247--248. The two side discs and the reverse-side +containments are displayed explicitly. -/ +theorem sphere_separator_vertex_count_ge_min + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) {A B P D E Q : Set S} + (hfree : GM10.IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ (A ∪ B))) + (hAB : A ∩ B = Q) (hAP : A ∩ P = Q) (hBP : B ∩ P = Q) + (hn : Γ.IsNormal (A ∪ B ∪ P)) + (hD : IsClosedDisc D) (hE : IsClosedDisc E) + (hbD : discBd D = B ∪ P) (hbE : discBd E = A ∪ P) + (hcover : Γ.U ⊆ D ∪ E) + (houtsideD : Γ.V ∩ (A ∪ B) ⊆ closure (univ \ D)) + (houtsideE : Γ.V ∩ (A ∪ B) ⊆ closure (univ \ E)) : + min (Γ.V ∩ A).ncard (Γ.V ∩ B).ncard ≤ (Γ.V ∩ P).ncard := by + let G : PaintingOrDrawing S := .drawing Γ + have hfD : frontier D = B ∪ P := (IsClosedDisc.frontier_eq_discBd hS hD).trans hbD + have hfE : frontier E = A ∪ P := (IsClosedDisc.frontier_eq_discBd hS hE).trans hbE + have hnD : G.IsNormal (frontier D) := by + rw [hfD] + intro x hx + exact hn ⟨hx.1.elim (fun h => Or.inl (Or.inr h)) Or.inr, hx.2⟩ + have hnE : G.IsNormal (frontier E) := by + rw [hfE] + intro x hx + exact hn ⟨hx.1.elim (fun h => Or.inl (Or.inl h)) Or.inr, hx.2⟩ + have hnot : (G.inter D, G.interOutside D) ∉ T ∨ (G.inter E, G.interOutside E) ∉ T := by + by_cases hmD : (G.inter D, G.interOutside D) ∈ T + · right + intro hmE + exact not_support_subset_of_normal_frontiers (Γ := G) (GM11.IsTangle.isPretangle hT) + hD.isCompact.isClosed hE.isCompact.isClosed hE.isCompact.isClosed hnD hnE hnE + hmD hmE hmE (fun x hx => Or.inl (hcover hx)) + · exact Or.inl hmD + rcases hnot with hnDsel | hnEsel + · have hcount := free_set_card_le_frontier_of_not_selected hT hfree hD.isCompact.isClosed hnD + houtsideD hnDsel + rw [hfD, union_comm A B] at hcount + have hcap : B ∩ A = B ∩ P := (inter_comm B A).trans (hAB.trans hBP.symm) + exact (min_le_left _ _).trans (vertex_count_le_of_union_count_le Γ hcap hcount) + · have hcount := free_set_card_le_frontier_of_not_selected hT hfree hE.isCompact.isClosed hnE + houtsideE hnEsel + rw [hfE] at hcount + exact (min_le_right _ _).trans (vertex_count_le_of_union_count_le Γ (hAB.trans hAP.symm) hcount) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SphereSideDisc.lean b/LeanPool/GraphMinor/GM12/Section3SphereSideDisc.lean new file mode 100644 index 0000000000..1cb1ca632f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SphereSideDisc.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.Surface.TopologyStatements +import LeanPool.GraphMinor.Surface.SphereDisc +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM12.Section3ThetaCircles +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Choosing the side of a theta circle opposite its third arc + +For the one-disc sphere case of XII (3.2), page 247, each union +of the separator line with one boundary arc bounds a disc which +misses the other arc except at its ends. The interior of that other +arc is connected and misses the circle. Of the two sphere discs, +choose the one not containing a point of that arc interior. The +whole arc interior then stays outside the chosen disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +private theorem exists_sphere_disc_disjoint_connected + {S : Type*} [TopologicalSpace S] [T2Space S] (hS : IsClosedSurface S) (hs : IsSphere S) + {F C : Set S} (hF : IsOArc F) (hC : IsPreconnected C) (hne : C.Nonempty) + (hCF : Disjoint C F) : + ∃ D : Set S, IsClosedDisc D ∧ discBd D = F ∧ Disjoint C D := by + obtain ⟨D, E, _, hD, hE, hbD, hbE, _, hcap, _, _⟩ := sphere_disc S hs F hF + obtain ⟨x, hx⟩ := hne + have chooseSide : ∀ D : Set S, IsClosedDisc D → discBd D = F → x ∉ D → + Disjoint C D := by + intro D hD hb hxD + have hfr : frontier D = F := by + rw [IsClosedDisc.frontier_eq_discBd hS hD, hb] + apply (subset_or_disjoint_of_frontier hD.isCompact.isClosed hC (hfr.symm ▸ hCF)).resolve_left + exact fun hsub => hxD (hsub hx) + by_cases hxD : x ∈ D + · have hxE : x ∉ E := fun hxE => Set.disjoint_left.mp hCF hx (hcap.subset ⟨hxD, hxE⟩) + exact ⟨E, hE, hbE, chooseSide E hE hbE hxE⟩ + · exact ⟨D, hD, hbD, chooseSide D hD hbD hxD⟩ + +/-- A line has a point other than its two ends. -/ +theorem line_sdiff_ends_nonempty {S : Type*} [TopologicalSpace S] + {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) : (L \ {a, b}).Nonempty := + Surface.IsLineWithEnds.nonempty_sdiff hL + +/-- The side disc used for a boundary arc and separator line in +XII (3.2), page 247. Its opposite arc meets it only at the common ends. -/ +theorem exists_sphere_theta_side_disc + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hs : IsSphere S) + {A B P : Set S} {a b : S} (hA : IsLineWithEnds A a b) + (hB : IsLineWithEnds B a b) (hP : IsLineWithEnds P a b) + (hAB : A ∩ B = {a, b}) (hAP : A ∩ P = {a, b}) (hBP : B ∩ P = {a, b}) : + ∃ D : Set S, IsClosedDisc D ∧ discBd D = B ∪ P ∧ + A ∩ D = {a, b} ∧ ¬ A ⊆ D ∧ A ∪ B ⊆ closure (univ \ D) := by + have hC : Disjoint (A \ {a, b}) (B ∪ P) := by + apply Set.disjoint_left.mpr + intro x hx hxF + rcases hxF with hxB | hxP + · exact hx.2 (hAB.subset ⟨hx.1, hxB⟩) + · exact hx.2 (hAP.subset ⟨hx.1, hxP⟩) + have hne := line_sdiff_ends_nonempty hA + obtain ⟨D, hD, hbD, hCD⟩ := exists_sphere_disc_disjoint_connected hS hs + (isOArc_union_of_lines_inter_eq_ends hB hP hBP) + (GM11.IsLineWithEnds.isPreconnected_sdiff_pair hA) hne hC + have hend : ({a, b} : Set S) ⊆ B := fun x hx => (hAB.symm.subset hx).2 + have hBD : B ⊆ discBd D := by rw [hbD]; exact subset_union_left + have hcap : A ∩ D = {a, b} := by + apply Subset.antisymm + · intro x hx + by_contra hxn + exact Set.disjoint_left.mp hCD ⟨hx.1, hxn⟩ hx.2 + · intro x hx + exact ⟨(hAB.symm.subset hx).1, Surface.discBd_subset D (hBD (hend hx))⟩ + have hnot : ¬ A ⊆ D := by + intro hsub + obtain ⟨x, hx⟩ := hne + exact Set.disjoint_left.mp hCD hx (hsub hx.1) + have hf : discBd D ⊆ closure (univ \ D) := by + rw [← IsClosedDisc.frontier_eq_discBd hS hD] + rw [frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] + exact inter_subset_right + refine ⟨D, hD, hbD, hcap, hnot, ?_⟩ + rintro x (hxA | hxB) + · by_cases hxD : x ∈ D + · have hxend := hcap.subset ⟨hxA, hxD⟩ + exact hf (hBD (hend hxend)) + · exact subset_closure ⟨mem_univ _, hxD⟩ + · exact hf (hBD hxB) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3StarDrawing.lean b/LeanPool/GraphMinor/GM12/Section3StarDrawing.lean new file mode 100644 index 0000000000..64afd95db5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3StarDrawing.lean @@ -0,0 +1,102 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM11.PaintingCells + +/-! +# Drawing a finite star + +For the forest in XII (3.1), page 245, finitely many lines join a +centre to the prescribed points in a feasibility disc. Lines with +distinct ends meet only at the centre. Glue their line drawings one +at a time, retaining exact formulas for support, vertices and edges. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- Finitely many lines meeting only at their common centre form a +drawing, with exactly their open interiors as edges. -/ +theorem exists_drawing_of_finite_star + {S : Type*} [TopologicalSpace S] [T2Space S] + {Z : Set S} (hZ : Z.Finite) (c : S) (L : S → Set S) + (hline : ∀ a ∈ Z, IsLineWithEnds (L a) c a) + (hmeet : ∀ a ∈ Z, ∀ b ∈ Z, a ≠ b → L a ∩ L b = {c}) + (hcZ : c ∉ Z) : + ∃ H : Drawing S, H.U = {c} ∪ ⋃ a ∈ Z, L a ∧ H.V = insert c Z ∧ + H.E = (fun a => L a \ {c, a}) '' Z := by + revert hline hmeet hcZ + induction Z, hZ using Set.Finite.induction_on with + | empty => + intro _ _ _ + refine ⟨pointsDrawing (finite_singleton c), ?_, ?_, ?_⟩ + · change {c} = {c} ∪ ⋃ a ∈ (∅ : Set S), L a + simp + · change {c} = insert c (∅ : Set S) + ext x + simp only [mem_singleton_iff, mem_insert_iff, mem_empty_iff_false, or_false] + · change arcComponentsIn ({c} \ {c}) = (fun a => L a \ {c, a}) '' ∅ + rw [Set.sdiff_self, image_empty] + ext e + constructor + · rintro ⟨⟨x, hx⟩, hsub, _⟩ + exact hsub hx + · intro he + exact False.elim he + | @insert a Z ha hZ ih => + intro hline hmeet hcZ + obtain ⟨H, hU, hV, hE⟩ := ih + (fun b hb => hline b (mem_insert_of_mem a hb)) + (fun b hb d hd hbd => hmeet b (mem_insert_of_mem a hb) d (mem_insert_of_mem a hd) hbd) + (fun hc => hcZ (mem_insert_of_mem a hc)) + have hca : c ≠ a := by + intro he + exact hcZ (mem_insert_iff.mpr (Or.inl he)) + let K := lineDrawing (hline a (Or.inl rfl)) hca + have hK_U : K.U = L a := rfl + have hK_V : K.V = {c, a} := rfl + have hK_E : K.E = {L a \ {c, a}} := lineDrawing_E _ _ + have hcap : H.U ∩ K.U ⊆ {c} := by + rintro x ⟨hxH, hxK⟩ + rw [hU] at hxH + rw [hK_U] at hxK + rcases hxH with hxC | hxL + · exact hxC + · obtain ⟨b, hb⟩ := mem_iUnion.mp hxL + obtain ⟨hbZ, hxb⟩ := mem_iUnion.mp hb + have hba : b ≠ a := by + intro he + exact ha (he ▸ hbZ) + have hx : x ∈ L b ∩ L a := ⟨hxb, hxK⟩ + rw [hmeet b (mem_insert_of_mem a hbZ) a (Or.inl rfl) hba] at hx + exact hx + have hglue : H.U ∩ K.U ⊆ H.V ∩ K.V := by + intro x hx + have hxc : x = c := hcap hx + subst x + rw [hV, hK_V] + exact ⟨Or.inl rfl, Or.inl rfl⟩ + refine ⟨H.glue K hglue, ?_, ?_, ?_⟩ + · change H.U ∪ K.U = _ + rw [hU, hK_U, biUnion_insert] + ac_rfl + · change H.V ∪ K.V = _ + rw [hV, hK_V] + ext x + simp only [mem_union, mem_insert_iff, mem_singleton_iff] + tauto + · rw [Drawing.glue_E, hE, hK_E, image_insert_eq, union_singleton] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3StarDrawingForest.lean b/LeanPool/GraphMinor/GM12/Section3StarDrawingForest.lean new file mode 100644 index 0000000000..12ec88a915 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3StarDrawingForest.lean @@ -0,0 +1,94 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3StarDrawing +public import LeanPool.GraphMinor.GM12.Section3StarForest +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.Surface.SurfaceGraph +import Mathlib.Data.Set.Insert + +/-! +# The finite star drawing is a forest + +The drawing in XII (3.1), page 245, has one open line per prescribed +leaf. Its edge closures meet the vertex set exactly at the centre and +that leaf. Thus every edge joins the centre to a leaf, and the leaf +has no second incident edge. The star forest lemma applies. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The actual drawing of a finite family of lines meeting only at +one centre has no circuits. -/ +theorem isGraphForest_star_drawing + {S : Type*} [TopologicalSpace S] [T2Space S] + {Z : Set S} (c : S) (L : S → Set S) + (hline : ∀ a ∈ Z, IsLineWithEnds (L a) c a) + (hmeet : ∀ a ∈ Z, ∀ b ∈ Z, a ≠ b → L a ∩ L b = {c}) + (hcZ : c ∉ Z) (H : Drawing S) (hV : H.V = insert c Z) + (hE : H.E = (fun a => L a \ {c, a}) '' Z) : IsGraphForest H.toGraph := by + have hinter : ∀ a ∈ Z, L a ∩ insert c Z = {c, a} := by + intro a ha + apply Subset.antisymm + · rintro x ⟨hxL, hxV⟩ + rcases hxV with hxc | hxZ + · exact Or.inl hxc + · by_cases hxa : x = a + · exact Or.inr hxa + · have hx : x ∈ L a ∩ L x := ⟨hxL, (hline x hxZ).right_mem⟩ + rw [hmeet a ha x hxZ (Ne.symm hxa)] at hx + exact Or.inl hx + · rintro x (hxc | hxa) + · subst x + exact ⟨(hline a ha).left_mem, Or.inl rfl⟩ + · subst x + exact ⟨(hline a ha).right_mem, Or.inr ha⟩ + have hlinks : ∀ {e x y}, H.toGraph.IsLink e x y → + ∃ a ∈ Z, e = L a \ {c, a} ∧ ((x = c ∧ y = a) ∨ (x = a ∧ y = c)) := by + intro e x y he + have hem : e ∈ H.E := he.1 + rw [hE] at hem + obtain ⟨a, ha, hea⟩ := hem + have hend := he.2.2.2 + rw [← hea, closure_sdiff_pair (hline a ha), hV, hinter a ha] at hend + refine ⟨a, ha, hea.symm, ?_⟩ + exact pair_eq_pair_iff.mp hend.symm + apply isGraphForest_of_star H.toGraph c + · intro e x y he + obtain ⟨a, ha, _, hends⟩ := hlinks he + rcases hends with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨fun heq => hcZ (heq ▸ ha), Or.inl rfl⟩ + · exact ⟨fun heq => hcZ (heq ▸ ha), Or.inr rfl⟩ + · intro x hxc e f y z he hf + obtain ⟨a, ha, hea, hendsa⟩ := hlinks he + obtain ⟨b, hb, hfb, hendsb⟩ := hlinks hf + have hxa : x = a := hendsa.resolve_left (fun h => hxc h.1) |>.1 + have hxb : x = b := hendsb.resolve_left (fun h => hxc h.1) |>.1 + rw [hea, hfb, hxa.symm.trans hxb] + +/-- A finite star of lines supplies a drawing with the stated support +and vertex set and with no circuits, for the feasibility forest of +XII (3.1), page 245. -/ +theorem exists_forest_drawing_of_finite_star + {S : Type*} [TopologicalSpace S] [T2Space S] + {Z : Set S} (hZ : Z.Finite) (c : S) (L : S → Set S) + (hline : ∀ a ∈ Z, IsLineWithEnds (L a) c a) + (hmeet : ∀ a ∈ Z, ∀ b ∈ Z, a ≠ b → L a ∩ L b = {c}) + (hcZ : c ∉ Z) : + ∃ H : Drawing S, H.U = {c} ∪ ⋃ a ∈ Z, L a ∧ H.V = insert c Z ∧ + H.E = (fun a => L a \ {c, a}) '' Z ∧ IsGraphForest H.toGraph := by + obtain ⟨H, hU, hV, hE⟩ := exists_drawing_of_finite_star hZ c L hline hmeet hcZ + exact ⟨H, hU, hV, hE, isGraphForest_star_drawing c L hline hmeet hcZ H hV hE⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3StarForest.lean b/LeanPool/GraphMinor/GM12/Section3StarForest.lean new file mode 100644 index 0000000000..337cf7e629 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3StarForest.lean @@ -0,0 +1,68 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.Walks + +/-! +# A star has no circuits + +The topological feasibility discs in XII (3.1), page 245, can carry +stars connecting their prescribed boundary vertices. Each edge joins +the centre to a leaf, and a leaf has only one incident edge. A closed +simple walk would either repeat that edge immediately or revisit the +centre. This proves the forest part of the construction. +-/ + +public section + +namespace GraphMinor.GM12 + +open Surface GM11 + +/-- A loopless graph whose edges join one centre to leaves, each with +at most one incident edge, is a forest. This is the combinatorial +part of the star construction in XII (3.1), page 245. -/ +theorem isGraphForest_of_star + {α β : Type*} (G : Graph α β) (c : α) + (hshape : ∀ {e x y}, G.IsLink e x y → x ≠ y ∧ (x = c ∨ y = c)) + (hunique : ∀ x, x ≠ c → ∀ {e f y z}, + G.IsLink e x y → G.IsLink f x z → e = f) : IsGraphForest G := by + intro u W hW + cases W with + | nil hu => rfl + | cons he rest => + cases rest with + | nil hv => exact False.elim ((hshape he).1 rfl) + | cons hf tail => + rename_i v e w f + change (v :: tail.support).Nodup ∧ (e :: f :: tail.edges).Nodup at hW + have hef : e ≠ f := by + intro heq + exact (List.nodup_cons.mp hW.2).1 (List.mem_cons.mpr (Or.inl heq)) + by_cases huc : u = c + · have hvc : v ≠ c := by + intro hvc + exact (hshape he).1 (huc.trans hvc.symm) + exact False.elim (hef (hunique v hvc he.symm hf)) + · have hvc : v = c := (hshape he).2.resolve_left huc + have hwc : w ≠ c := by + intro hwc + exact (hshape hf).1 (hvc.trans hwc.symm) + cases tail with + | nil hu => exact False.elim (hef (hunique u huc he hf.symm)) + | cons ht tailrest => + have htc : _ = c := (hshape ht).2.resolve_left hwc + have hmem : v ∈ tailrest.support := by + rw [hvc, ← htc] + exact GraphMinor.Surface.GraphWalk.start_mem_support tailrest + exact False.elim ((List.nodup_cons.mp hW.1).1 (List.mem_cons_of_mem w hmem)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SubcircleSelection.lean b/LeanPool/GraphMinor/GM12/Section3SubcircleSelection.lean new file mode 100644 index 0000000000..f74bc81391 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SubcircleSelection.lean @@ -0,0 +1,117 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SolidPlanarity +public import LeanPool.GraphMinor.GM12.Section3PlanarityMaps +import LeanPool.GraphMinor.GM12.Section3SolidEmbedding + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Selecting circles in a solid set which is not near-planar + +The Section 8 argument of VII used in XII (3.1), page 245, begins +with nonplanar circles. Apply the planar criterion in a cap to obtain +one even when the solid set fills the original surface. If every such +circle is near-planar, choose one surrounding a cuff. The uniform-cuff +criterion forces another circle which is not planar in that cap. +It either is not near-planar or surrounds a different cuff. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +universe u + +/-- A solid set which is not near-planar contains a nonplanar circle +when the connected surface has a cuff. The proof uses a cap to make +the image a proper subset before applying VII (5.1). -/ +theorem exists_nonplanar_subcircle_with_cuff + {S : Type u} [TopologicalSpace S] [ConnectedSpace S] + (hS : IsSurface S) (hCuff : (cuffs S).Nonempty) + {X : Set S} (hX : IsSolid X) (hnot : ¬ GM07.IsNearPlanar X) : + ∃ F : Set S, IsOArc F ∧ F ⊆ X ∧ ¬ IsPlanar F := by + obtain ⟨C, hC⟩ := hCuff + obtain ⟨T, tT, j, D, hcap⟩ := exists_cappedCuff hS hC + have hconn := cappedCuff_connectedSpace hcap + have hsolid := isSolid_image_isClosedEmbedding (cappedCuff_isClosedEmbedding hS hcap) hX + have hproper : j '' X ≠ univ := by + intro heq + apply cappedCuff_range_ne_univ hcap + apply eq_univ_of_univ_subset + rw [← heq] + rintro y ⟨x, _, rfl⟩ + exact mem_range_self x + have hnotplan : ¬ IsPlanar (j '' X) := by + intro hp + exact hnot (Or.inr ⟨C, hC, isPlanarInCappedCuff_of_one_cap hS hcap hp⟩) + obtain ⟨F, hF, hFX, hnotF⟩ := exists_nonplanar_subcircle_of_not_planar + hcap.isSurface hconn hsolid hproper hnotplan + have hFrange : F ⊆ range j := by + intro y hy + obtain ⟨x, _, rfl⟩ := hFX hy + exact mem_range_self x + have hpreF := isOArc_preimage_isEmbedding hcap.isEmbedding hF hFrange + have hpreX : j ⁻¹' F ⊆ X := by + intro x hx + obtain ⟨y, hy, he⟩ := hFX hx + exact hcap.isEmbedding.injective he ▸ hy + refine ⟨j ⁻¹' F, hpreF, hpreX, ?_⟩ + intro hp + have himage := isPlanar_image_isEmbedding hcap.isEmbedding hp + rw [image_preimage_eq_of_subset hFrange] at himage + exact hnotF himage + +/-- The first selection step of VII Section 8: a solid set which is +not near-planar contains either a circle which is not near-planar or +two circles surrounding distinct cuffs. Their intersection patterns +are handled separately when constructing the schismatic shapes. -/ +theorem exists_non_nearplanar_circle_or_distinct_surrounding_circles + {S : Type u} [TopologicalSpace S] [ConnectedSpace S] + (hS : IsSurface S) (hCuff : (cuffs S).Nonempty) + {X : Set S} (hX : IsSolid X) (hnot : ¬ GM07.IsNearPlanar X) : + (∃ F : Set S, IsOArc F ∧ F ⊆ X ∧ ¬ GM07.IsNearPlanar F) ∨ + ∃ F A C C' : Set S, IsOArc F ∧ IsOArc A ∧ F ⊆ X ∧ A ⊆ X ∧ + IsCuff C ∧ IsCuff C' ∧ C ≠ C' ∧ GM07.SurroundsCuff F C ∧ GM07.SurroundsCuff A C' := by + classical + obtain ⟨F, hF, hFX, hnotF⟩ := exists_nonplanar_subcircle_with_cuff hS hCuff hX hnot + by_cases hnearF : GM07.IsNearPlanar F + · rcases hnearF with hpF | ⟨C, hC, hpFC⟩ + · exact False.elim (hnotF hpF) + · obtain ⟨T, tT, j, D, hcap⟩ := exists_cappedCuff hS hC + have hex : ∃ A : Set S, IsOArc A ∧ A ⊆ X ∧ ¬ GM07.IsPlanarInCappedCuff C A := by + by_contra hn + apply hnot + right + refine ⟨C, hC, planarInCappedCuff_of_all_subcircles hS hcap hX ?_⟩ + intro A hA hAX + by_contra hnotA + exact hn ⟨A, hA, hAX, hnotA⟩ + obtain ⟨A, hA, hAX, hnotAC⟩ := hex + by_cases hnearA : GM07.IsNearPlanar A + · rcases hnearA with hpA | ⟨C', hC', hpAC'⟩ + · exact False.elim (hnotAC (isPlanarInCappedCuff_of_isPlanar hS hC hpA)) + · have hnotA : ¬ IsPlanar A := fun hpA => + hnotAC (isPlanarInCappedCuff_of_isPlanar hS hC hpA) + have hCC' : C ≠ C' := by + intro he + apply hnotAC + rw [he] + exact hpAC' + exact Or.inr ⟨F, A, C, C', hF, hA, hFX, hAX, hC, hC', hCC', + ⟨hC, hpFC, hnotF⟩, ⟨hC', hpAC', hnotA⟩⟩ + · exact Or.inl ⟨A, hA, hAX, hnearA⟩ + · exact Or.inl ⟨F, hF, hFX, hnearF⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SubgraphDrawing.lean b/LeanPool/GraphMinor/GM12/Section3SubgraphDrawing.lean new file mode 100644 index 0000000000..bb9cb8e61d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SubgraphDrawing.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Reading an abstract subgraph as a subdrawing + +VI (3.6), applied in XII (3.2), page 247, gives an abstract forest +subgraph. Retain its vertices and edges in the drawing. Every end +of a retained edge is already a retained vertex, so this span adds +no vertices. Its graph links are exactly those of the abstract +subgraph. This permits the return from VI's objects to XII's +connected subdrawings. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 Graph + +/-- Every abstract subgraph of a drawing is the graph of a subdrawing, +with the same vertices and edges. -/ +theorem exists_subdrawing_of_subgraph + {S : Type*} [TopologicalSpace S] [T1Space S] (Γ : Drawing S) + (H : Graph S (Set S)) (hH : H ≤ Γ.toGraph) : + ∃ D : Drawing S, D.IsSubdrawing Γ ∧ D.V = H.vertexSet ∧ D.toGraph = H := by + let D := Γ.span H.vertexSet H.edgeSet + have hDV : D.V = H.vertexSet := by + apply Subset.antisymm + · rintro x (hx | hx) + · exact hx.1 + · obtain ⟨e, ⟨heH, _⟩, hxcl, hxV⟩ := mem_iUnion₂.mp hx + obtain ⟨u, v, hl⟩ := (H.edge_mem_iff_exists_isLink e).mp heH + have hlG := hH.isLink_mono hl + have hxends : x ∈ ({u, v} : Set S) := hlG.2.2.2 ▸ ⟨hxcl, hxV⟩ + rcases hxends with rfl | rfl + · exact hl.left_mem + · exact hl.right_mem + · intro x hx + exact Or.inl ⟨hx, hH.vertexSet_mono hx⟩ + have hDE : D.E = H.edgeSet := (Γ.span_E _ _).trans (inter_eq_left.mpr hH.edgeSet_mono) + have hsub : D.IsSubdrawing Γ := Γ.span_isSubdrawing _ _ + refine ⟨D, hsub, hDV, ?_⟩ + apply Graph.ext hDV + intro e x y + constructor + · intro hl + have heH : e ∈ H.edgeSet := hDE ▸ hl.1 + exact (hH.isLink_iff heH).mpr ((hsub.isLink_iff hl.1).mp hl) + · intro hl + have heD : e ∈ D.E := hDE.symm ▸ hl.edge_mem + exact (hsub.isLink_iff heD).mpr (hH.isLink_mono hl) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SubpathIntervals.lean b/LeanPool/GraphMinor/GM12/Section3SubpathIntervals.lean new file mode 100644 index 0000000000..2b67dd859f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SubpathIntervals.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Topology.Subpath +import Mathlib.Tactic.Ring + +/-! +# Original parameters of retained outer subpaths + +The homotopic rerouting used in the Section 8 reduction for XII (3.1), +page 245, produces outer subpaths of partition subpaths. Affine +reparametrization identifies them with closed intervals of the original +path. This makes the finite-graph subarc construction apply directly. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- Taking a subpath of a subpath composes its affine parameters. -/ +theorem subpath_subpath_eq + {S : Type*} [TopologicalSpace S] {a b : S} (p : Path a b) + (u v r s : unitInterval) : + (p.subpath u v).subpath r s = + p.subpath (Icc.convexComb u v r) (Icc.convexComb u v s) := by + ext t + change p (Icc.convexComb u v (Icc.convexComb r s t)) = + p (Icc.convexComb (Icc.convexComb u v r) (Icc.convexComb u v s) t) + apply congrArg p + apply Subtype.ext + simp only [Icc.coe_convexComb] + ring + +/-- The left outer subpath is the corresponding initial closed +interval of the original path. -/ +theorem range_left_outer_subpath + {S : Type*} [TopologicalSpace S] {a b : S} (p : Path a b) + {u v : unitInterval} (huv : u ≤ v) (r : unitInterval) : + range ((p.subpath u v).subpath 0 r) = p '' Icc u (Icc.convexComb u v r) := by + have heq := congrArg (fun γ : Path ((p.subpath u v) 0) ((p.subpath u v) r) => range γ) + (subpath_subpath_eq p u v 0 r) + have hle : Icc.convexComb u v 0 ≤ Icc.convexComb u v r := by + rw [Icc.convexComb_zero] + exact Icc.le_convexComb huv r + exact heq.trans ((Path.range_subpath_of_le p _ _ hle).trans + (congrArg (fun z => p '' Icc z (Icc.convexComb u v r)) (Icc.convexComb_zero u v))) + +/-- The right outer subpath is the corresponding final closed +interval of the original path. -/ +theorem range_right_outer_subpath + {S : Type*} [TopologicalSpace S] {a b : S} (p : Path a b) + {u v : unitInterval} (huv : u ≤ v) (r : unitInterval) : + range ((p.subpath u v).subpath r 1) = p '' Icc (Icc.convexComb u v r) v := by + have heq := congrArg (fun γ : Path ((p.subpath u v) r) ((p.subpath u v) 1) => range γ) + (subpath_subpath_eq p u v r 1) + have hle : Icc.convexComb u v r ≤ Icc.convexComb u v 1 := by + rw [Icc.convexComb_one] + exact Icc.convexComb_le huv r + exact heq.trans ((Path.range_subpath_of_le p _ _ hle).trans + (congrArg (fun z => p '' Icc (Icc.convexComb u v r) z) (Icc.convexComb_one u v))) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SubspaceArcs.lean b/LeanPool/GraphMinor/GM12/Section3SubspaceArcs.lean new file mode 100644 index 0000000000..fd6d0eaea6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SubspaceArcs.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! +# Lines and circles in a smaller ambient space + +When XII (3.1), page 245, reads its drawing in the punctured surface, +its edge closures remain lines or circles. Restricting the ambient +space to a set containing an arc does not change that arc as a +topological space. The homeomorphism is the identity on its points. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +private def setHomeomorphInSubspace {S : Type*} [TopologicalSpace S] + {L C : Set S} (hLC : L ⊆ C) : + L ≃ₜ ((Subtype.val : C → S) ⁻¹' L) where + toFun x := ⟨⟨x.val, hLC x.property⟩, x.property⟩ + invFun x := ⟨x.val.val, x.property⟩ + left_inv _ := rfl + right_inv _ := rfl + continuous_toFun := (continuous_subtype_val.subtype_mk _).subtype_mk _ + continuous_invFun := (continuous_subtype_val.comp continuous_subtype_val).subtype_mk _ + +/-- A line with its two endpoints remains a line in a subspace that +contains the whole line. -/ +theorem isLineWithEnds_subtype_preimage {S : Type*} [TopologicalSpace S] + {L C : Set S} (hLC : L ⊆ C) {v w : C} + (hL : IsLineWithEnds L v.val w.val) : + IsLineWithEnds ((Subtype.val : C → S) ⁻¹' L) v w := by + obtain ⟨f, hf0, hf1⟩ := hL + refine ⟨f.trans (setHomeomorphInSubspace hLC), ?_, ?_⟩ + · apply Subtype.ext + exact hf0 + · apply Subtype.ext + exact hf1 + +/-- A line and its endpoints are preserved on inclusion from a +subspace into the original surface. -/ +theorem isLineWithEnds_subtype_image {S : Type*} [TopologicalSpace S] + {C : Set S} {L : Set C} {v w : C} (hL : IsLineWithEnds L v w) : + IsLineWithEnds ((Subtype.val : C → S) '' L) v.val w.val := by + obtain ⟨f, hf0, hf1⟩ := hL + refine ⟨f.trans (Topology.IsEmbedding.subtypeVal.homeomorphImage L), ?_, ?_⟩ + · exact congrArg Subtype.val hf0 + · exact congrArg Subtype.val hf1 + +/-- A circle remains a circle in a subspace containing it. -/ +theorem isOArc_subtype_preimage {S : Type*} [TopologicalSpace S] + {L C : Set S} (hLC : L ⊆ C) (hL : IsOArc L) : + IsOArc ((Subtype.val : C → S) ⁻¹' L) := by + obtain ⟨f⟩ := hL + exact ⟨f.trans (setHomeomorphInSubspace hLC)⟩ + +/-- A closed disc in a containing subspace has the same boundary, +read through the inclusion. The homeomorphism fixes every point. -/ +theorem isClosedDisc_subtype_preimage {S : Type*} [TopologicalSpace S] + {D C : Set S} (hDC : D ⊆ C) (hD : IsClosedDisc D) : + IsClosedDisc ((Subtype.val : C → S) ⁻¹' D) ∧ + discBd ((Subtype.val : C → S) ⁻¹' D) = + (Subtype.val : C → S) ⁻¹' discBd D := by + obtain ⟨φ⟩ := hD + let ψ := φ.trans (setHomeomorphInSubspace hDC) + refine ⟨⟨ψ⟩, ?_⟩ + rw [disc_boundary _ ψ, disc_boundary _ φ] + ext x + constructor + · rintro ⟨w, hw, rfl⟩ + exact ⟨w, hw, rfl⟩ + · rintro ⟨w, hw, he⟩ + exact ⟨w, hw, Subtype.ext he⟩ + +/-- Including a closed disc from a subspace into the ambient space +preserves its disc structure and its boundary. -/ +theorem isClosedDisc_subtype_image {S : Type*} [TopologicalSpace S] + {C : Set S} {D : Set C} (hD : IsClosedDisc D) : + IsClosedDisc ((Subtype.val : C → S) '' D) ∧ + discBd ((Subtype.val : C → S) '' D) = + (Subtype.val : C → S) '' discBd D := by + obtain ⟨φ⟩ := hD + let e := IsEmbedding.subtypeVal.homeomorphImage D + refine ⟨⟨φ.trans e⟩, ?_⟩ + rw [disc_boundary _ (φ.trans e), disc_boundary _ φ, image_image] + rfl + +/-- Closure in a smaller ambient space is the preimage of ambient +closure when the original set is wholly in the subspace. -/ +theorem closure_subtype_preimage {S : Type*} [TopologicalSpace S] + {L C : Set S} (hLC : L ⊆ C) : + closure ((Subtype.val : C → S) ⁻¹' L) = (Subtype.val : C → S) ⁻¹' closure L := by + rw [IsInducing.subtypeVal.closure_eq_preimage_closure_image, Subtype.image_preimage_coe, + inter_eq_right.mpr hLC] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SubspaceDrawing.lean b/LeanPool/GraphMinor/GM12/Section3SubspaceDrawing.lean new file mode 100644 index 0000000000..b2d3fdfb6c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SubspaceDrawing.lean @@ -0,0 +1,136 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM12.Section3SubtypeComponents +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs +import LeanPool.GraphMinor.GM11.Defs + +/-! +# Reading a drawing in a subspace containing its support + +For XII (3.1), page 245, the original drawing is also a graph in the +punctured surface. Pull its support and vertex set back along inclusion. +Its edges are the same arc-components, and their closures remain lines +or circles with the same endpoints. This constructs that drawing without +adding any geometric assumption beyond containment of its support. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +private theorem subtype_preimage_pair {S : Type*} {C : Set S} (v w : C) : + (Subtype.val : C → S) ⁻¹' {v.val, w.val} = {v, w} := by + ext x + simp only [mem_preimage, mem_insert_iff, mem_singleton_iff, Subtype.ext_iff] + +private theorem subtype_preimage_singleton {S : Type*} {C : Set S} (v : C) : + (Subtype.val : C → S) ⁻¹' {v.val} = {v} := by + ext x + simp only [mem_preimage, mem_singleton_iff, Subtype.ext_iff] + +/-- A drawing whose support is in a subspace can be read as a drawing +of that subspace. XII (3.1), page 245, uses this for Sigma-star. -/ +def drawingInSubspace {S : Type*} [TopologicalSpace S] (Γ : Drawing S) + (C : Set S) (hUC : Γ.U ⊆ C) : Drawing C where + U := (Subtype.val : C → S) ⁻¹' Γ.U + V := (Subtype.val : C → S) ⁻¹' Γ.V + V_subset_U := preimage_mono Γ.V_subset_U + isClosed_U := Γ.isClosed_U.preimage continuous_subtype_val + finite_V := Set.Finite.preimage Subtype.val_injective.injOn Γ.finite_V + finite_edges := by + rw [← preimage_sdiff, arcComponentsIn_subtype_preimage (sdiff_subset.trans hUC)] + exact Γ.finite_edges.image _ + edge_cond := by + intro e' he' + rw [← preimage_sdiff, arcComponentsIn_subtype_preimage (sdiff_subset.trans hUC)] at he' + obtain ⟨e, he, rfl⟩ := he' + have heC : e ⊆ C := fun x hx => hUC (he.2.1 hx).1 + have hclC : closure e ⊆ C := (Γ.closure_subset_U he).trans hUC + have hcl := closure_subtype_preimage heC + rcases Γ.edge_cond e he with ⟨v, w, hvw, hcap, hL⟩ | ⟨v, hcap, hO⟩ + · have hv : v ∈ Γ.V := by + have hm : v ∈ closure e ∩ Γ.V := hcap.symm ▸ (Or.inl rfl) + exact hm.2 + have hw : w ∈ Γ.V := by + have hm : w ∈ closure e ∩ Γ.V := hcap.symm ▸ (Or.inr rfl) + exact hm.2 + let v' : C := ⟨v, hUC (Γ.V_subset_U hv)⟩ + let w' : C := ⟨w, hUC (Γ.V_subset_U hw)⟩ + left + refine ⟨v', w', fun h => hvw (congrArg Subtype.val h), ?_, ?_⟩ + · rw [hcl, ← preimage_inter, hcap] + exact subtype_preimage_pair v' w' + · rw [hcl] + exact isLineWithEnds_subtype_preimage hclC hL + · have hv : v ∈ Γ.V := by + have hm : v ∈ closure e ∩ Γ.V := hcap.symm ▸ mem_singleton v + exact hm.2 + let v' : C := ⟨v, hUC (Γ.V_subset_U hv)⟩ + right + refine ⟨v', ?_, ?_⟩ + · rw [hcl, ← preimage_inter, hcap] + exact subtype_preimage_singleton v' + · rw [hcl] + exact isOArc_subtype_preimage hclC hO + +/-- Support of the drawing read in the smaller ambient space. -/ +theorem drawingInSubspace_U {S : Type*} [TopologicalSpace S] + (Γ : Drawing S) (C : Set S) (hUC : Γ.U ⊆ C) : + (drawingInSubspace Γ C hUC).U = (Subtype.val : C → S) ⁻¹' Γ.U := by rfl + +/-- Vertex set of the drawing read in the smaller ambient space. -/ +theorem drawingInSubspace_V {S : Type*} [TopologicalSpace S] + (Γ : Drawing S) (C : Set S) (hUC : Γ.U ⊆ C) : + (drawingInSubspace Γ C hUC).V = (Subtype.val : C → S) ⁻¹' Γ.V := by rfl + +/-- Edges of the drawing read in the smaller ambient space. -/ +theorem drawingInSubspace_E {S : Type*} [TopologicalSpace S] + (Γ : Drawing S) (C : Set S) (hUC : Γ.U ⊆ C) : + (drawingInSubspace Γ C hUC).E = + (fun E : Set S => (Subtype.val : C → S) ⁻¹' E) '' Γ.E := by + change arcComponentsIn ((Subtype.val : C → S) ⁻¹' Γ.U \ (Subtype.val : C → S) ⁻¹' Γ.V) = _ + rw [← preimage_sdiff, arcComponentsIn_subtype_preimage (sdiff_subset.trans hUC)] + rfl + +/-- Vertex intersections are unchanged on inclusion into the original +surface. This also identifies their finite cardinalities. -/ +theorem drawingInSubspace_image_vertices_inter + {S : Type*} [TopologicalSpace S] (Γ : Drawing S) + (C : Set S) (hUC : Γ.U ⊆ C) (F : Set C) : + (Subtype.val : C → S) '' ((drawingInSubspace Γ C hUC).V ∩ F) = + Γ.V ∩ (Subtype.val : C → S) '' F := by + rw [drawingInSubspace_V] + ext x + constructor + · rintro ⟨y, ⟨hyV, hyF⟩, rfl⟩ + exact ⟨hyV, y, hyF, rfl⟩ + · rintro ⟨hxV, y, hyF, rfl⟩ + exact ⟨y, ⟨hxV, hyF⟩, rfl⟩ + +/-- A normal set in the smaller ambient space remains normal after +inclusion in the original drawing. -/ +theorem drawingInSubspace_isNormal_image + {S : Type*} [TopologicalSpace S] (Γ : Drawing S) + (C : Set S) (hUC : Γ.U ⊆ C) {F : Set C} + (hn : (drawingInSubspace Γ C hUC).IsNormal F) : + Γ.IsNormal ((Subtype.val : C → S) '' F) := by + rintro x ⟨⟨y, hy, rfl⟩, hyU⟩ + have hyG : y ∈ (drawingInSubspace Γ C hUC).U := by + rw [drawingInSubspace_U] + exact hyU + have hyV := hn ⟨hy, hyG⟩ + rw [drawingInSubspace_V] at hyV + exact hyV + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SubtypeComponents.lean b/LeanPool/GraphMinor/GM12/Section3SubtypeComponents.lean new file mode 100644 index 0000000000..21deed786f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SubtypeComponents.lean @@ -0,0 +1,117 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs + +/-! +# Edges when a drawing is read in a smaller ambient space + +In XII (3.1), page 245, the drawing is read in the surface left after +removing the prescribed discs. Its support remains in that surface. +Path components of a subset do not change when the ambient space is +restricted to a set containing it. This file proves that fact for the +arc-component definition used by drawings. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Arc-components pull back unchanged to an ambient subspace containing +the whole set. This identifies the edges of XII's drawing in Sigma-star. -/ +theorem arcComponentsIn_subtype_preimage {S : Type*} [TopologicalSpace S] + {F C : Set S} (hFC : F ⊆ C) : + arcComponentsIn ((Subtype.val : C → S) ⁻¹' F) = + (fun E : Set S => (Subtype.val : C → S) ⁻¹' E) '' arcComponentsIn F := by + ext D + constructor + · rintro ⟨hne, hsub, hpc, hmax⟩ + let E : Set S := Subtype.val '' D + have hEF : E ⊆ F := by + rintro x ⟨y, hy, rfl⟩ + exact hsub hy + refine ⟨E, ⟨hne.image Subtype.val, hEF, hpc.image continuous_subtype_val, ?_⟩, ?_⟩ + · intro E' hE'F hE'pc hEE' + have hpre : (Subtype.val : C → S) ⁻¹' E' = D := by + apply hmax + · exact preimage_mono hE'F + · exact hE'pc.preimage_coe (hE'F.trans hFC) + · intro x hx + exact hEE' ⟨x, hx, rfl⟩ + ext x + constructor + · intro hx + let y : C := ⟨x, hFC (hE'F hx)⟩ + have hy : y ∈ D := hpre ▸ hx + exact ⟨y, hy, rfl⟩ + · exact fun hx => hEE' hx + · ext x + simp only [mem_preimage, E, mem_image] + constructor + · rintro ⟨y, hy, heq⟩ + exact (Subtype.ext heq : y = x) ▸ hy + · intro hx + exact ⟨x, hx, rfl⟩ + · rintro ⟨E, ⟨hne, hEF, hpc, hmax⟩, rfl⟩ + refine ⟨?_, preimage_mono hEF, hpc.preimage_coe (hEF.trans hFC), ?_⟩ + · obtain ⟨x, hx⟩ := hne + exact ⟨⟨x, hFC (hEF hx)⟩, hx⟩ + · intro D' hD'F hD'pc hDD' + have hEeq : Subtype.val '' D' = E := by + apply hmax + · rintro x ⟨y, hy, rfl⟩ + exact hD'F hy + · exact hD'pc.image continuous_subtype_val + · intro x hx + let y : C := ⟨x, hFC (hEF hx)⟩ + exact ⟨y, hDD' hx, rfl⟩ + ext x + constructor + · intro hx + have hm : x.val ∈ Subtype.val '' D' := ⟨x, hx, rfl⟩ + rw [hEeq] at hm + exact hm + · exact fun hx => hDD' hx + +/-- Arc-components of a set in a subspace map to exactly the +arc-components of its image in the ambient space. This is the reverse +transfer needed after applying VII to the punctured drawing. -/ +theorem arcComponentsIn_subtype_image {S : Type*} [TopologicalSpace S] + {C : Set S} (F : Set C) : + arcComponentsIn ((Subtype.val : C → S) '' F) = + (image (Subtype.val : C → S)) '' arcComponentsIn F := by + have hsub : (Subtype.val : C → S) '' F ⊆ C := by + rintro x ⟨y, _, rfl⟩ + exact y.property + have hpre : (Subtype.val : C → S) ⁻¹' ((Subtype.val : C → S) '' F) = F := by + ext x + simp + have htransfer := arcComponentsIn_subtype_preimage hsub + rw [hpre] at htransfer + ext E + constructor + · intro hE + have hEC : E ⊆ C := hE.2.1.trans hsub + have hEpre : (Subtype.val : C → S) ⁻¹' E ∈ arcComponentsIn F := by + rw [htransfer] + exact ⟨E, hE, rfl⟩ + refine ⟨(Subtype.val : C → S) ⁻¹' E, hEpre, ?_⟩ + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hEC] + · rintro ⟨E', hE', rfl⟩ + rw [htransfer] at hE' + obtain ⟨D, hD, hpreD⟩ := hE' + have hDC : D ⊆ C := hD.2.1.trans hsub + have himage : (Subtype.val : C → S) '' E' = D := by + rw [← hpreD, Subtype.image_preimage_coe, inter_eq_right.mpr hDC] + exact himage.symm ▸ hD + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SurfaceForestUnion.lean b/LeanPool/GraphMinor/GM12/Section3SurfaceForestUnion.lean new file mode 100644 index 0000000000..73c0b128ed --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SurfaceForestUnion.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +import LeanPool.GraphMinor.GM12.Section3FiniteDrawingUnion +import LeanPool.GraphMinor.GM12.Section3DisjointFamilyWalks + +/-! +# The union of disjoint surface forests + +The local forests of XII (3.1), page 245, combine into one proper +surface forest. The drawing union has exact vertex and edge formulas. +Properness holds in each component, and the walk containment lemma +passes the forest property to the union. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A finite disjoint family of proper surface forests combines into +a proper surface forest, with exact support, vertex and edge sets. -/ +theorem exists_disjoint_surface_forest_union + {S ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (H : ι → Drawing S) (hF : ∀ i, GM07.IsSurfaceForest (H i)) + (hdis : Pairwise (fun i j => Disjoint (H i).U (H j).U)) : + ∃ K : Drawing S, GM07.IsSurfaceForest K ∧ K.U = ⋃ i, (H i).U ∧ + K.V = ⋃ i, (H i).V ∧ K.E = ⋃ i, (H i).E ∧ ∀ i, (H i).IsSubdrawing K := by + obtain ⟨K, hU, hV, hE⟩ := exists_finite_disjoint_drawing_union H hdis + have hsub : ∀ i, (H i).IsSubdrawing K := by + intro i + constructor + · intro x hx + rw [hV] + exact mem_iUnion.mpr ⟨i, hx⟩ + · intro e he + rw [hE] + exact mem_iUnion.mpr ⟨i, he⟩ + have hdisV : Pairwise (fun i j => Disjoint (H i).V (H j).V) := by + intro i j hij + exact (hdis hij).mono (H i).V_subset_U (H j).V_subset_U + have hproper : K.IsProper := by + rintro x ⟨hxB, hxU⟩ + rw [hU] at hxU + obtain ⟨i, hxi⟩ := mem_iUnion.mp hxU + rw [hV] + exact mem_iUnion.mpr ⟨i, (hF i).1 ⟨hxB, hxi⟩⟩ + have hforest : IsGraphForest K.toGraph := isGraphForest_of_disjoint_family_cover H K + hsub hdisV (hV.le) (hE.le) (fun i => (hF i).2) + exact ⟨K, ⟨hproper, hforest⟩, hU, hV, hE, hsub⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SurroundingDisc.lean b/LeanPool/GraphMinor/GM12/Section3SurroundingDisc.lean new file mode 100644 index 0000000000..7aefae1604 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SurroundingDisc.lean @@ -0,0 +1,127 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CapOneDisc +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Surrounding curves bound discs after filling a cuff + +For XII (3.1)(v), page 245, a curve surrounding a cuff in VII's sense +must be read as a curve in the original surface. Fill that cuff by its +deleted disc. Planarity in the capped surface supplies a containing +disc, and the disc Jordan theorem supplies the disc bounded by the +curve. Inclusion then returns that disc to the original surface. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A circle surrounding a prescribed cuff bounds a disc in the +original surface which avoids the interiors of all other deleted discs. -/ +theorem surrounding_bounds_disc_in_partial_fill + {S : Type*} {ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (i : ι) {F : Set (discComplement Δ)} (hF : IsOArc F) + (hs : GM07.SurroundsCuff F (Subtype.val ⁻¹' discBd (Δ i))) : + ∃ D : Set S, IsClosedDisc D ∧ + discBd D = (Subtype.val : discComplement Δ → S) '' F ∧ + D ⊆ discComplement (fun k : {k // k ≠ i} => Δ k.val) := by + let C := discComplement Δ + let T := discComplement (fun k : {k // k ≠ i} => Δ k.val) + obtain ⟨j, hj, hjval⟩ := exists_cap_discComplement_cuff hS Δ hΔ hdisj i + obtain ⟨E, hE, hFE⟩ := hs.2.1.2.2 T j (Subtype.val ⁻¹' Δ i) hj + have hjoarc : IsOArc (j '' F) := by + obtain ⟨φ⟩ := hF + exact ⟨φ.trans (hj.isEmbedding.homeomorphImage F)⟩ + obtain ⟨D, hD, _⟩ := disc_oArc E (j '' F) hE hFE hjoarc + have hamb := isClosedDisc_subtype_image hD.2.1 + refine ⟨Subtype.val '' D, hamb.1, ?_, ?_⟩ + · rw [hamb.2, hD.2.2.1, image_image] + exact image_congr fun x _ => hjval x + · rintro x ⟨y, _, rfl⟩ + exact y.property + +/-- The disc bounded by a surrounding circle contains the deleted +disc of its cuff. If it did not, it would lie in Sigma-star and make +the circle planar there, contrary to the definition of surrounding. -/ +theorem surrounding_bounds_disc_including_deleted_disc + {S : Type*} {ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (i : ι) {F : Set (discComplement Δ)} (hF : IsOArc F) + (hs : GM07.SurroundsCuff F (Subtype.val ⁻¹' discBd (Δ i))) : + ∃ D : Set S, IsClosedDisc D ∧ + discBd D = (Subtype.val : discComplement Δ → S) '' F ∧ + Δ i ⊆ D ∧ D ⊆ discComplement (fun k : {k // k ≠ i} => Δ k.val) := by + obtain ⟨D, hD, hbd, hDT⟩ := surrounding_bounds_disc_in_partial_fill hS Δ hΔ hdisj i hF hs + refine ⟨D, hD, hbd, ?_, hDT⟩ + have hdis : Disjoint (discInt (Δ i)) (discBd D) := by + apply Set.disjoint_left.mpr + intro x hxI hxB + rw [hbd] at hxB + obtain ⟨y, hy, rfl⟩ := hxB + exact hxI.2 (discComplement_inter_disc_subset_boundary hS Δ hΔ i ⟨y.property, hxI.1⟩) + rcases hD.side (fun x => (hS.2.2 x).isManifoldPoint) + (hΔ i).isPreconnected_discInt hdis with hin | hout + · have hcl : closure (discInt (Δ i)) ⊆ D := by + rw [← hD.isClosed.closure_eq] + exact closure_mono (hin.trans (discInt_subset D)) + exact (hΔ i).subset_closure_discInt.trans hcl + · have hDC : D ⊆ discComplement Δ := by + intro x hxD + have hxT := hDT hxD + rw [discComplement_except_eq_union Δ hΔ hdisj i] at hxT + rcases hxT with hxC | hxi + · exact hxC + · by_cases hxb : x ∈ discBd (Δ i) + · exact disc_boundary_subset_discComplement hS Δ hΔ hdisj i hxb + · exact False.elim (Set.disjoint_left.mp hout ⟨hxi, hxb⟩ hxD) + have hp : IsPlanar F := by + refine ⟨Subtype.val ⁻¹' D, (isClosedDisc_subtype_preimage hDC hD).1, ?_⟩ + intro y hy + exact discBd_subset D (hbd.symm ▸ mem_image_of_mem Subtype.val hy) + exact False.elim (hs.2.2 hp) + +/-- The disc bounded by a surrounding circle includes exactly the +deleted disc of its cuff. The other deleted discs have interior points +outside the partially filled surface. -/ +theorem surrounding_bounds_disc_including_exactly_one + {S : Type*} {ι : Type*} [TopologicalSpace S] [T2Space S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (i : ι) {F : Set (discComplement Δ)} (hF : IsOArc F) + (hs : GM07.SurroundsCuff F (Subtype.val ⁻¹' discBd (Δ i))) : + ∃ D : Set S, IsClosedDisc D ∧ + discBd D = (Subtype.val : discComplement Δ → S) '' F ∧ + ∀ j, Δ j ⊆ D ↔ j = i := by + obtain ⟨D, hD, hbd, hiD, hDT⟩ := + surrounding_bounds_disc_including_deleted_disc hS Δ hΔ hdisj i hF hs + refine ⟨D, hD, hbd, fun j => ⟨?_, ?_⟩⟩ + · intro hjD + by_contra hji + obtain ⟨y, hy⟩ := (hΔ j).nonempty_discInt + have hyT := hDT (hjD hy.1) + have hyB := discComplement_inter_disc_subset_boundary hS + (fun k : {k // k ≠ i} => Δ k.val) (fun k => hΔ k.val) ⟨j, hji⟩ ⟨hyT, hy.1⟩ + exact hy.2 hyB + · rintro rfl + exact hiD + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3SurroundingUnique.lean b/LeanPool/GraphMinor/GM12/Section3SurroundingUnique.lean new file mode 100644 index 0000000000..03f5152c9f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3SurroundingUnique.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ThirdDisc +public import LeanPool.GraphMinor.GM12.Section3PlanarityMaps +import LeanPool.GraphMinor.GM12.Section3PuncturedCuffs +import LeanPool.GraphMinor.Surface.DiscsInSurface +import LeanPool.GraphMinor.GM12.Section3DiscUniqueness + +/-! +# A surrounding circle identifies its cuff + +Under the surface assumption of XII (3.1), page 245, a circle cannot +surround two prescribed cuffs. The two enclosing discs have the same +boundary. They coincide by disc uniqueness, using a third deleted disc +as an outside point in the sphere case. Their exact enclosed-disc +sets identify the cuff. Consequently, a set containing circles around +distinct cuffs cannot be near-planar. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A circle surrounds at most one prescribed cuff under the surface +condition of XII (3.1), page 245. -/ +theorem surrounding_cuff_index_unique + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + {i j : ι} {F : Set (discComplement Δ)} (hF : IsOArc F) + (hsi : GM07.SurroundsCuff F (Subtype.val ⁻¹' discBd (Δ i))) + (hsj : GM07.SurroundsCuff F (Subtype.val ⁻¹' discBd (Δ j))) : i = j := by + classical + obtain ⟨D, hD, hbD, hiD, hDT⟩ := + surrounding_bounds_disc_including_deleted_disc hS Δ hΔ hdisj i hF hsi + obtain ⟨E, hE, hbE, hjE, hET⟩ := + surrounding_bounds_disc_including_deleted_disc hS Δ hΔ hdisj j hF hsj + have hbd : discBd D = discBd E := hbD.trans hbE.symm + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have heq : D = E := by + rcases hcase with hns | hthree + · exact eq_of_discBd_eq ⟨hS.1, hS.2.1, hman⟩ hns hD hE hbd + · let := Fintype.ofFinite ι + have hthree' : 3 ≤ Fintype.card ι := by + simpa only [Nat.card_eq_fintype_card] using hthree + obtain ⟨k, hki, hkj⟩ := ENat.exists_ne_ne_of_three_le + (by rw [ENat.card_eq_coe_fintype_card]; exact_mod_cast hthree') i j + exact eq_of_discBd_eq_of_union_ne_univ hman hD hE hbd + (union_ne_univ_of_subset_partial_fills hS Δ hΔ hki hkj hDT hET) + have hiE : Δ i ⊆ E := heq ▸ hiD + exact (included_disc_iff_of_subset_partial_fill hS Δ hΔ hjE hET i).mp hiE + +/-- Circles surrounding distinct cuffs prevent a containing set from +being near-planar. Filling a single cuff cannot make both circles planar. -/ +theorem not_isNearPlanar_of_distinct_surrounding_subcircles + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + {i j : ι} (hij : i ≠ j) {F A X : Set (discComplement Δ)} + (hF : IsOArc F) (hA : IsOArc A) (hFX : F ⊆ X) (hAX : A ⊆ X) + (hsi : GM07.SurroundsCuff F (Subtype.val ⁻¹' discBd (Δ i))) + (hsj : GM07.SurroundsCuff A (Subtype.val ⁻¹' discBd (Δ j))) : + ¬ GM07.IsNearPlanar X := by + intro hnear + rcases hnear with hp | ⟨C, hC, hpC⟩ + · exact hsi.2.2 (isPlanar_mono hFX hp) + · have hC' := hC + rw [discComplement_cuffs_eq hS Δ hΔ hdisj] at hC' + obtain ⟨k, rfl⟩ := hC' + have hsFk : GM07.SurroundsCuff F (Subtype.val ⁻¹' discBd (Δ k)) := + ⟨hC, isPlanarInCappedCuff_mono hFX hpC, hsi.2.2⟩ + have hsAk : GM07.SurroundsCuff A (Subtype.val ⁻¹' discBd (Δ k)) := + ⟨hC, isPlanarInCappedCuff_mono hAX hpC, hsj.2.2⟩ + have hik := surrounding_cuff_index_unique hS Δ hΔ hdisj hcase hF hsi hsFk + have hjk := surrounding_cuff_index_unique hS Δ hΔ hdisj hcase hA hsj hsAk + exact hij (hik.trans hjk.symm) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3Theorem.lean b/LeanPool/GraphMinor/GM12/Section3Theorem.lean new file mode 100644 index 0000000000..03b7b39754 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3Theorem.lean @@ -0,0 +1,93 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SeparatedMetric +public import LeanPool.GraphMinor.GM12.Section3TwoDiscs +public import LeanPool.GraphMinor.GM12.Section3OneDisc +import LeanPool.GraphMinor.GM12.Section3EmptyClasses +import LeanPool.GraphMinor.GM12.Section3DiscRegion +import Mathlib.Tactic.IntervalCases + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Graph Minors XII, (3.2) + +For a nonspherical surface or at least three prescribed discs, the +five geometric checks give (3.1). For two discs, choose a separated +intermediate region and add an empty-boundary disc away from the +feasibility forest. For one disc on the sphere, freeness gives the +normal-chord inequality and VI (3.6) gives the connections. With no +discs, the prescribed vertex set is empty. These are the cases of +the proof on pages 246--248. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM14 + +universe u + +/-- Graph Minors XII, (3.2), pages 245--248. A uniform separation +threshold for the prescribed regions and free boundary vertices +ensures disjoint connected subdrawings realizing every topologically +feasible boundary partition. -/ +theorem theorem_3_2_proof + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (t z : ℕ) : + ∃ η : ℕ, 1 ≤ η ∧ ∀ (Δ : Fin t → Set S) (Γ : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (p : ℕ) (Zs : Fin p → Set S), + (∀ i, IsClosedDisc (Δ i) ∧ Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) → + Pairwise (fun i j => Disjoint (Δ i) (Δ j)) → + (discBoundaryVertices Γ Δ).ncard ≤ z → + (⋃ j, Zs j) = discBoundaryVertices Γ Δ → + (∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) → IsTopologicallyFeasible Δ Zs → + η ≤ θ → HasTangleMetric Γ θ T d → + (∀ i j, i ≠ j → ∀ ri ∈ Γ.R, (ri ∩ Δ i).Nonempty → + ∀ rj ∈ Γ.R, (rj ∩ Δ j).Nonempty → η ≤ d ri rj) → + (∀ i, GM10.IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd (Δ i))) → + HasConnectingSubdrawings Γ (discBoundaryVertices Γ Δ) Zs := by + by_cases hcase : ¬ IsSphere S ∨ 3 ≤ t + · exact theorem_3_2_separated_metric hS t z hcase + · have hs : IsSphere S := by + by_contra hn + exact hcase (Or.inl hn) + have ht : t ≤ 2 := by + by_contra hn + exact hcase (Or.inr (by omega)) + interval_cases t + · refine ⟨1, le_rfl, ?_⟩ + intro Δ Γ θ T d p Zs _ _ _ hcover _ _ _ _ _ _ + have hZ : discBoundaryVertices Γ Δ = ∅ := by simp [discBoundaryVertices] + rw [hZ] at hcover ⊢ + exact hasConnectingSubdrawings_of_empty_union Γ Zs hcover + · refine ⟨max 1 z, le_max_left _ _, ?_⟩ + intro Δ Γ θ T d p Zs hΔ _ _ hcover hdisZ hfeas _ hm _ hfree + exact theorem_3_2_one_disc hS hs Γ hm.1.2.1 Δ (fun i => (hΔ i).1) + (fun i => (hΔ i).2) Zs hcover hdisZ hfeas (hfree 0) + · obtain ⟨η, hηpos, htwo⟩ := theorem_3_2_two_discs hS z + refine ⟨η, hηpos, ?_⟩ + intro Δ Γ θ T d p Zs hΔ hdis hcount hcover hdisZ hfeas horder hm hsep hfree + have hreg : ∀ i, ∃ r ∈ Γ.R, (r ∩ Δ i).Nonempty := by + intro i + obtain ⟨r, hr, hInt, _, _⟩ := exists_unique_region_meeting_disc hS (hΔ i).1 (hΔ i).2 + obtain ⟨x, hx⟩ := (hΔ i).1.nonempty_discInt + exact ⟨r, hr, x, hInt hx, hx.1⟩ + choose r hr hrΔ using hreg + exact htwo Γ θ T d Δ r p Zs hm horder (fun i => (hΔ i).1) hdis + (fun i => (hΔ i).2) hr hrΔ + (fun i j hij => hsep i j hij (r i) (hr i) (hrΔ i) (r j) (hr j) (hrΔ j)) + hfree hcount hcover hdisZ hfeas + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThetaCircles.lean b/LeanPool/GraphMinor/GM12/Section3ThetaCircles.lean new file mode 100644 index 0000000000..0378c96a82 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThetaCircles.lean @@ -0,0 +1,153 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.SurfaceGraph +public import LeanPool.GraphMinor.GM12.Section3CircleInclusion +import LeanPool.GraphMinor.GM11.Ties + +/-! +# Circles in the three-branch shape + +The third schismatic shape in VII Section 8, used by XII (3.1), page +245, consists of three lines with common ends and otherwise disjoint. +It is a finite graph with exactly those lines as edges. A circle either +contains a whole branch or misses its interior. It must contain two +branches, since a circle cannot lie in a line. The two branches already +form a circle, so they are the entire circle under consideration. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Three internally disjoint lines with common distinct ends form +a finite graph whose edges are precisely the three branches. -/ +theorem isGraph_three_branches + {S : Type*} [TopologicalSpace S] {P Q R : Set S} {u v : S} (huv : u ≠ v) + (hP : IsLineWithEnds P u v) (hQ : IsLineWithEnds Q u v) (hR : IsLineWithEnds R u v) + (hPQ : P ∩ Q = {u, v}) (hPR : P ∩ R = {u, v}) (hQR : Q ∩ R = {u, v}) : + IsGraph ({u, v} : Set S) {P, Q, R} := by + have he : ∀ L : Set S, IsLineWithEnds L u v → L ∩ {u, v} = {u, v} := by + intro L hL + apply inter_eq_right.mpr + rintro x (hxu | hxv) + · exact hxu.symm ▸ hL.left_mem + · exact hxv.symm ▸ hL.right_mem + refine ⟨(finite_singleton v).insert u, ((finite_singleton R).insert Q).insert P, ?_, ?_⟩ + · rintro L (rfl | rfl | rfl) + · exact ⟨u, v, huv, hP, he _ hP⟩ + · exact ⟨u, v, huv, hQ, he _ hQ⟩ + · exact ⟨u, v, huv, hR, he _ hR⟩ + · rintro L (rfl | rfl | rfl) M (rfl | rfl | rfl) hne + · exact (hne rfl).elim + · exact hPQ.le + · exact hPR.le + · rw [inter_comm] + exact hPQ.le + · exact (hne rfl).elim + · exact hQR.le + · rw [inter_comm] + exact hPR.le + · rw [inter_comm] + exact hQR.le + · exact (hne rfl).elim + +private theorem not_circle_of_misses_two_branches + {S : Type*} [TopologicalSpace S] [T2Space S] + {L M N Z : Set S} {u v : S} (hL : IsLineWithEnds L u v) (hZ : IsOArc Z) + (hcover : Z ⊆ L ∪ M ∪ N) + (hM : Disjoint (M \ {u, v}) Z) (hN : Disjoint (N \ {u, v}) Z) : False := by + apply GM11.not_isOArc_of_subset_line ⟨hL.choose⟩ hZ + intro x hxZ + have hends : x ∈ ({u, v} : Set S) → x ∈ L := by + rintro (hxu | hxv) + · exact hxu.symm ▸ hL.left_mem + · exact hxv.symm ▸ hL.right_mem + rcases hcover hxZ with (hxL | hxM) | hxN + · exact hxL + · by_cases hxV : x ∈ ({u, v} : Set S) + · exact hends hxV + · exact (Set.disjoint_left.mp hM ⟨hxM, hxV⟩ hxZ).elim + · by_cases hxV : x ∈ ({u, v} : Set S) + · exact hends hxV + · exact (Set.disjoint_left.mp hN ⟨hxN, hxV⟩ hxZ).elim + +/-- Two lines with common distinct ends and no other common point +form a circle. The parametrizations agree at their ends and nowhere +else, so the two-arc circle construction applies. -/ +theorem isOArc_union_of_lines_inter_eq_ends + {S : Type*} [TopologicalSpace S] [T2Space S] + {P Q : Set S} {u v : S} + (hP : IsLineWithEnds P u v) (hQ : IsLineWithEnds Q u v) + (hPQ : P ∩ Q = {u, v}) : IsOArc (P ∪ Q) := by + obtain ⟨φ, hφ0, hφ1⟩ := hP + obtain ⟨ψ, hψ0, hψ1⟩ := hQ + let a : unitInterval → S := fun t => (φ t).val + let b : unitInterval → S := fun t => (ψ t).val + have ha : IsArcMap a := ⟨continuous_subtype_val.comp φ.continuous, + fun s t he => φ.injective (Subtype.ext he)⟩ + have hb : IsArcMap b := ⟨continuous_subtype_val.comp ψ.continuous, + fun s t he => ψ.injective (Subtype.ext he)⟩ + have hi : ∀ s t, a s = b t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + intro s t he + have hx : a s ∈ P ∩ Q := ⟨(φ s).property, he.symm ▸ (ψ t).property⟩ + rw [hPQ] at hx + rcases hx with hxu | hxv + · exact Or.inl ⟨ha.2 (hxu.trans hφ0.symm), hb.2 (he.symm.trans (hxu.trans hψ0.symm))⟩ + · exact Or.inr ⟨ha.2 (hxv.trans hφ1.symm), hb.2 (he.symm.trans (hxv.trans hψ1.symm))⟩ + have ho := oArc_of_two_arcs ha hb (hφ0.trans hψ0.symm) (hφ1.trans hψ1.symm) hi + have hrP : range a = P := (φ.surjective.range_comp Subtype.val).trans Subtype.range_val + have hrQ : range b = Q := (ψ.surjective.range_comp Subtype.val).trans Subtype.range_val + rw [hrP, hrQ] at ho + exact ho + +/-- The only circles in the three-branch shape are its three pairs +of branches. This proves the circle-classification step needed for the +minimal-circle clause of VII's third schismatic shape. -/ +theorem oArc_eq_pair_of_three_branches + {S : Type*} [TopologicalSpace S] [T2Space S] + {P Q R Z : Set S} {u v : S} (huv : u ≠ v) + (hP : IsLineWithEnds P u v) (hQ : IsLineWithEnds Q u v) (hR : IsLineWithEnds R u v) + (hPQ : P ∩ Q = {u, v}) (hPR : P ∩ R = {u, v}) (hQR : Q ∩ R = {u, v}) + (hZ : IsOArc Z) (hZY : Z ⊆ P ∪ Q ∪ R) : + Z = P ∪ Q ∨ Z = P ∪ R ∨ Z = Q ∪ R := by + classical + have hoPQ := isOArc_union_of_lines_inter_eq_ends hP hQ hPQ + have hoPR := isOArc_union_of_lines_inter_eq_ends hP hR hPR + have hoQR := isOArc_union_of_lines_inter_eq_ends hQ hR hQR + have hG := isGraph_three_branches huv hP hQ hR hPQ hPR hQR + have hZG : Z ⊆ gr ({u, v} : Set S) {P, Q, R} := by + intro x hx + rcases hZY hx with (hxP | hxQ) | hxR + · exact Or.inr ⟨P, Or.inl rfl, hxP⟩ + · exact Or.inr ⟨Q, Or.inr (Or.inl rfl), hxQ⟩ + · exact Or.inr ⟨R, Or.inr (Or.inr rfl), hxR⟩ + have hm : ∀ L ∈ ({P, Q, R} : Set (Set S)), ¬ L ⊆ Z → Disjoint (L \ {u, v}) Z := + fun L hL hn => (hG.edge_or hZ hZG hL).resolve_left hn + by_cases hPZ : P ⊆ Z + · by_cases hQZ : Q ⊆ Z + · exact Or.inl (oArc_eq_of_subset hoPQ hZ (union_subset hPZ hQZ)).symm + · by_cases hRZ : R ⊆ Z + · exact Or.inr (Or.inl (oArc_eq_of_subset hoPR hZ (union_subset hPZ hRZ)).symm) + · exact (not_circle_of_misses_two_branches hP hZ hZY + (hm Q (Or.inr (Or.inl rfl)) hQZ) (hm R (Or.inr (Or.inr rfl)) hRZ)).elim + · by_cases hQZ : Q ⊆ Z + · by_cases hRZ : R ⊆ Z + · exact Or.inr (Or.inr (oArc_eq_of_subset hoQR hZ (union_subset hQZ hRZ)).symm) + · have hcover : Z ⊆ Q ∪ P ∪ R := by rwa [union_comm Q P] + exact (not_circle_of_misses_two_branches hQ hZ hcover + (hm P (Or.inl rfl) hPZ) (hm R (Or.inr (Or.inr rfl)) hRZ)).elim + · have hcover : Z ⊆ R ∪ P ∪ Q := by rwa [union_assoc, union_comm R (P ∪ Q)] + exact (not_circle_of_misses_two_branches hR hZ hcover + (hm P (Or.inl rfl) hPZ) (hm Q (Or.inr (Or.inl rfl)) hQZ)).elim + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThetaClassification.lean b/LeanPool/GraphMinor/GM12/Section3ThetaClassification.lean new file mode 100644 index 0000000000..b8cbbf316a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThetaClassification.lean @@ -0,0 +1,134 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ThetaSurrounding +public import LeanPool.GraphMinor.GM12.Section3ThetaCover +public import LeanPool.GraphMinor.GM12.Section3ThetaSphere +import LeanPool.GraphMinor.GM12.Section3PuncturedCuffs +import LeanPool.GraphMinor.GM12.Section3PuncturedSurface +import LeanPool.GraphMinor.GM12.Section3SurroundingDisc +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# The third schismatic shape occurs on the three-cuff sphere + +VII Section 8, page 241, used by XII (3.1), page 245, places the third +schismatic shape on the sphere with three cuffs. Its pair circles +surround distinct prescribed cuffs. Their enclosing discs cover the +original surface and exhaust its deletions. The covering-disc sphere +criterion then identifies the original surface as a sphere. This file +assembles those facts for the actual punctured surface. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +universe u + +/-- Three branch-pair circles surrounding distinct prescribed cuffs +force the original surface to be a sphere with exactly three deletions. -/ +theorem sphere_card_three_of_surrounding_theta + {S : Type u} {ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {P Q R : Set (discComplement Δ)} {a b : discComplement Δ} (hab : a ≠ b) + (hP : IsLineWithEnds P a b) (hQ : IsLineWithEnds Q a b) (hR : IsLineWithEnds R a b) + (hPQ : P ∩ Q = {a, b}) (hPR : P ∩ R = {a, b}) (hQR : Q ∩ R = {a, b}) + {i j k : ι} (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) + (hsPQ : GM07.SurroundsCuff (P ∪ Q) (Subtype.val ⁻¹' discBd (Δ i))) + (hsPR : GM07.SurroundsCuff (P ∪ R) (Subtype.val ⁻¹' discBd (Δ j))) + (hsQR : GM07.SurroundsCuff (Q ∪ R) (Subtype.val ⁻¹' discBd (Δ k))) : + IsSphere S ∧ Nat.card ι = 3 := by + let C := discComplement Δ + let f : C → S := Subtype.val + let P' := f '' P + let Q' := f '' Q + let R' := f '' R + obtain ⟨D₀, hD₀, hb₀, hone₀⟩ := surrounding_bounds_disc_including_exactly_one hS Δ hΔ hdisj k + (isOArc_union_of_lines_inter_eq_ends hQ hR hQR) hsQR + obtain ⟨D₁, hD₁, hb₁, hone₁⟩ := surrounding_bounds_disc_including_exactly_one hS Δ hΔ hdisj j + (isOArc_union_of_lines_inter_eq_ends hP hR hPR) hsPR + obtain ⟨D₂, hD₂, hb₂, hone₂⟩ := surrounding_bounds_disc_including_exactly_one hS Δ hΔ hdisj i + (isOArc_union_of_lines_inter_eq_ends hP hQ hPQ) hsPQ + have hbd₀ : discBd D₀ = Q' ∪ R' := hb₀.trans (image_union f Q R) + have hbd₁ : discBd D₁ = R' ∪ P' := hb₁.trans ((image_union f P R).trans (union_comm _ _)) + have hbd₂ : discBd D₂ = P' ∪ Q' := hb₂.trans (image_union f P Q) + have hp : IsLineWithEnds P' a.val b.val := isLineWithEnds_subtype_image hP + have hq : IsLineWithEnds Q' a.val b.val := isLineWithEnds_subtype_image hQ + have hr : IsLineWithEnds R' a.val b.val := isLineWithEnds_subtype_image hR + have hi : ∀ L M : Set C, L ∩ M = {a, b} → f '' L ∩ f '' M = {a.val, b.val} := by + intro L M hLM + rw [← image_inter Subtype.val_injective, hLM, image_pair] + have hcover := theta_disc_cover_of_distinct_enclosed_labels hS Δ hp hq hr + (hi P Q hPQ) (hi P R hPR) (hi Q R hQR) hD₀ hD₁ hD₂ hbd₀ hbd₁ hbd₂ + hjk.symm hik.symm hij.symm ((hone₀ k).mpr rfl) ((hone₁ j).mpr rfl) ((hone₂ i).mpr rfl) + (fun l => (hone₀ l).mp) (fun l => (hone₁ l).mp) (fun l => (hone₂ l).mp) + have hsub : P' ∪ Q' ∪ R' ⊆ C := by + rintro x ((⟨y, _, rfl⟩ | ⟨y, _, rfl⟩) | ⟨y, _, rfl⟩) <;> exact y.property + have hproper : P' ∪ Q' ∪ R' ≠ univ := by + intro heq + obtain ⟨x, hx⟩ := (hΔ i).nonempty_discInt + have hxC := hsub (heq.symm ▸ mem_univ x) + exact hx.2 (discComplement_inter_disc_subset_boundary hS Δ hΔ i ⟨hxC, hx.1⟩) + have hbdsub : ∀ D : Set S, discBd D = Q' ∪ R' ∨ discBd D = R' ∪ P' ∨ discBd D = P' ∪ Q' → + discBd D ⊆ C := by + intro D hD + rcases hD with h | h | h + · rw [h] + exact (union_subset (subset_union_right.trans subset_union_left) subset_union_right).trans + hsub + · rw [h] + exact (union_subset subset_union_right (subset_union_left.trans subset_union_left)).trans hsub + · rw [h] + exact subset_union_left.trans hsub + have hex := deletion_labels_exhaust_of_three_disc_cover hS Δ hΔ hD₀ hD₁ hD₂ + (hbdsub D₀ (Or.inl hbd₀)) (hbdsub D₁ (Or.inr (Or.inl hbd₁))) + (hbdsub D₂ (Or.inr (Or.inr hbd₂))) hcover + (fun l => (hone₀ l).mp) (fun l => (hone₁ l).mp) (fun l => (hone₂ l).mp) + exact ⟨isSphere_of_covering_theta_discs hS (fun he => hab (Subtype.ext he)) hp hq hr + (hi P Q hPQ) (hi P R hPR) (hi Q R hQR) hproper hD₀ hD₁ hD₂ hbd₀ hbd₁ hbd₂ hcover, + card_eq_three_of_exhausting_labels hjk.symm hik.symm hij.symm hex⟩ + +/-- The sphere and three-cuff assertion for a schismatic theta in VII +Section 8, page 241, in the actual punctured surface used by XII (3.1). +The three surrounding labels are obtained from the proved cuff theorem. -/ +theorem sphere_card_three_of_schismatic_theta + {S : Type u} {ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + [Finite ι] [Nonempty ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {P Q R : Set (discComplement Δ)} {a b : discComplement Δ} (hab : a ≠ b) + (hP : IsLineWithEnds P a b) (hQ : IsLineWithEnds Q a b) (hR : IsLineWithEnds R a b) + (hPQ : P ∩ Q = {a, b}) (hPR : P ∩ R = {a, b}) (hQR : Q ∩ R = {a, b}) + (hX : GM07.IsSchismatic (P ∪ Q ∪ R)) : IsSphere S ∧ Nat.card ι = 3 := by + let : ConnectedSpace (discComplement Δ) := + Subtype.connectedSpace (discComplement_isConnected hS Δ hΔ hdisj) + obtain ⟨C₁, C₂, C₃, hs₁, hs₂, hs₃, h12, h13, h23⟩ := + surrounding_pairs_of_schismatic_theta (discComplement_isSurface hS Δ hΔ hdisj) + (discComplement_cuffs_nonempty hS Δ hΔ hdisj) hab hP hQ hR hPQ hPR hQR hX + have hc₁ := hs₁.1 + have hc₂ := hs₂.1 + have hc₃ := hs₃.1 + rw [discComplement_cuffs_eq hS Δ hΔ hdisj] at hc₁ hc₂ hc₃ + obtain ⟨i, rfl⟩ := hc₁ + obtain ⟨j, rfl⟩ := hc₂ + obtain ⟨k, rfl⟩ := hc₃ + exact sphere_card_three_of_surrounding_theta hS Δ hΔ hdisj hab hP hQ hR hPQ hPR hQR + (fun he => h12 (congrArg (fun l => Subtype.val ⁻¹' discBd (Δ l)) he)) + (fun he => h13 (congrArg (fun l => Subtype.val ⁻¹' discBd (Δ l)) he)) + (fun he => h23 (congrArg (fun l => Subtype.val ⁻¹' discBd (Δ l)) he)) hs₁ hs₂ hs₃ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThetaCondition.lean b/LeanPool/GraphMinor/GM12/Section3ThetaCondition.lean new file mode 100644 index 0000000000..da4a4a7bc8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThetaCondition.lean @@ -0,0 +1,129 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SelectedSmallDisc +import LeanPool.GraphMinor.GM12.Section3ThetaFaceIntersection +import LeanPool.GraphMinor.GM12.Section2NormalNoncover +import LeanPool.GraphMinor.GM11.Theorem66 +import Mathlib.Tactic.FinCases + +/-! +# The theta-face condition in XII (3.2) + +Condition (3.1)(iv) follows by selecting all three face discs. +Their pairwise intersections are boundary arcs in the punctured +surface, so no face contains another prescribed disc. Claim (2) +selects the faces, while the theta-cover lemma says that they cover +the surface. The second tangle axiom excludes this cover. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM14 + +/-- Condition (3.1)(iv) in the proof of XII (3.2), page 246. -/ +theorem theta_vertex_count_gt + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ η : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + (hη : η ≤ θ) (Δ r : Fin 3 → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hr : ∀ i, r i ∈ Γ.R) + (hrΔ : ∀ i, (r i ∩ Δ i).Nonempty) + (hsep : ∀ i j, i ≠ j → η ≤ tangleMetric Γ K ins θ (r i) (r j)) + {N : ℕ} (hN : N < η) (P D : Fin 3 → Set S) {a b : S} + (hn : Γ.IsNormal (⋃ i, P i)) (hP : ∀ i, IsLineWithEnds (P i) a b) + (hij : ∀ i j, i ≠ j → P i ∩ P j = {a, b}) + (hstar : (⋃ i, P i) ⊆ discComplement Δ) + (hD : ∀ i, IsClosedDisc (D i)) + (hbd : ∀ i, discBd (D i) = ⋃ j : {j // j ≠ i}, P j.val) + (hin : ∀ i, Δ i ⊆ D i) (hout : ∀ i, ¬ P i ⊆ D i) : + N < (Γ.V ∩ ⋃ i, P i).ncard := by + by_contra hlarge + have hsmall := Nat.le_of_not_gt hlarge + have hb0 : discBd (D 0) = P 1 ∪ P 2 := by + rw [hbd] + ext x + simp [Fin.exists_fin_succ] + have hb1 : discBd (D 1) = P 2 ∪ P 0 := by + rw [hbd] + ext x + simp [Fin.exists_fin_succ, or_comm] + have hb2 : discBd (D 2) = P 0 ∪ P 1 := by + rw [hbd] + ext x + simp [Fin.exists_fin_succ] + have hf0 := (IsClosedDisc.frontier_eq_discBd hS (hD 0)).trans hb0 + have hf1 := (IsClosedDisc.frontier_eq_discBd hS (hD 1)).trans hb1 + have hf2 := (IsClosedDisc.frontier_eq_discBd hS (hD 2)).trans hb2 + have hi01 := hij 0 1 (by decide) + have hi12 := hij 1 2 (by decide) + have hi20 := hij 2 0 (by decide) + have h01 := theta_face_disc_intersection hS (hP 0) (hP 1) hi01 hi12 hi20 + (hD 0) (hD 1) hf0 hf1 (hout 0) (hout 1) + have h12 := theta_face_disc_intersection hS (hP 1) (hP 2) hi12 hi20 hi01 + (hD 1) (hD 2) hf1 hf2 (hout 1) (hout 2) + have h20 := theta_face_disc_intersection hS (hP 2) (hP 0) hi20 hi01 hi12 + (hD 2) (hD 0) hf2 hf0 (hout 2) (hout 0) + have hcap : ∀ i j, i ≠ j → D i ∩ D j ⊆ ⋃ k, P k := by + intro i j hne + fin_cases i <;> fin_cases j + all_goals try exact False.elim (hne rfl) + · change D 0 ∩ D 1 ⊆ _ + rw [h01]; exact subset_iUnion P 2 + · change D 0 ∩ D 2 ⊆ _ + rw [Set.inter_comm, h20]; exact subset_iUnion P 1 + · change D 1 ∩ D 0 ⊆ _ + rw [Set.inter_comm, h01]; exact subset_iUnion P 2 + · change D 1 ∩ D 2 ⊆ _ + rw [h12]; exact subset_iUnion P 0 + · change D 2 ∩ D 0 ⊆ _ + rw [h20]; exact subset_iUnion P 1 + · change D 2 ∩ D 1 ⊆ _ + rw [Set.inter_comm, h12]; exact subset_iUnion P 0 + have hone : ∀ i j, Δ j ⊆ D i → j = i := by + intro i j hj + by_contra hne + obtain ⟨x, hx⟩ := (hΔ j).nonempty_discInt + have hxC := hstar (hcap i j (Ne.symm hne) ⟨hj hx.1, hin j hx.1⟩) + exact hx.2 (discComplement_inter_disc_subset_boundary hS Δ hΔ j ⟨hxC, hx.1⟩) + have hbsub : ∀ i, discBd (D i) ⊆ ⋃ j, P j := by + intro i + rw [hbd] + intro x hx + obtain ⟨j, hj⟩ := mem_iUnion.mp hx + exact mem_iUnion.mpr ⟨j.val, hj⟩ + have hnorm : ∀ i, Γ.IsNormal (discBd (D i)) := fun i _ hx => hn ⟨hbsub i hx.1, hx.2⟩ + have hlen : ∀ i, (Γ.V ∩ discBd (D i)).ncard < η := by + intro i + exact (Set.ncard_le_ncard (inter_subset_inter_right Γ.V (hbsub i)) + (Γ.finite_V.inter_of_left _)).trans_lt (hsmall.trans_lt hN) + have hm : ∀ i, ((PaintingOrDrawing.drawing Γ).inter (D i), + (PaintingOrDrawing.drawing Γ).interOutside (D i)) ∈ T := by + intro i + exact small_disc_is_selected_of_at_most_one_prescribed_disc hS hT hrespect hK hd + hη Δ r hΔ (Or.inr (by simp)) hr hrΔ hsep (hD i).isOArc_discBd (hnorm i) (hlen i) + ((hbsub i).trans hstar) (hD i) rfl + (fun j k hj hk => (hone i j hj).trans (hone i k hk).symm) + have hcover := GM11.theta_cover hS (hP 0) (hP 1) (hP 2) hi01 hi12 hi20 + (hD 0) (hD 1) (hD 2) hf0 hf1 hf2 (hout 0) (hout 1) (hout 2) + exact not_cover_of_normal_frontiers (Γ := PaintingOrDrawing.drawing Γ) + (GM11.IsTangle.isPretangle hT) + (hD 0).isCompact.isClosed (hD 1).isCompact.isClosed (hD 2).isCompact.isClosed + (by rw [hf0, ← hb0]; exact hnorm 0) + (by rw [hf1, ← hb1]; exact hnorm 1) + (by rw [hf2, ← hb2]; exact hnorm 2) (hm 0) (hm 1) (hm 2) hcover + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThetaCover.lean b/LeanPool/GraphMinor/GM12/Section3ThetaCover.lean new file mode 100644 index 0000000000..467fb00b77 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThetaCover.lean @@ -0,0 +1,106 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2ThetaDiscs +public import LeanPool.GraphMinor.GM12.Section3PuncturedBoundary +public import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Enclosing theta discs cover and exhaust the deletions + +For the third schismatic shape in VII Section 8, used by XII (3.1), +page 245, the three pair circles surround distinct deleted discs. If +their enclosing discs did not cover the surface, one would be the union +of the other two, contradicting its unique enclosed deletion. Coverage +then puts every deletion in one of these three discs. Its connected +interior avoids each boundary, so meeting a disc means lying wholly +in it. The three cuff labels therefore exhaust the deletion family. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Distinct unique enclosed labels exclude each possible disc-union +relation for a theta, so the three enclosing discs cover the surface. -/ +theorem theta_disc_cover_of_distinct_enclosed_labels + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Δ : ι → Set S) + {P Q R D₀ D₁ D₂ : Set S} {a b : S} + (hP : IsLineWithEnds P a b) (hQ : IsLineWithEnds Q a b) (hR : IsLineWithEnds R a b) + (hPQ : P ∩ Q = {a, b}) (hPR : P ∩ R = {a, b}) (hQR : Q ∩ R = {a, b}) + (hD₀ : IsClosedDisc D₀) (hD₁ : IsClosedDisc D₁) (hD₂ : IsClosedDisc D₂) + (hb₀ : discBd D₀ = Q ∪ R) (hb₁ : discBd D₁ = R ∪ P) (hb₂ : discBd D₂ = P ∪ Q) + {i j k : ι} (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) + (hi : Δ i ⊆ D₀) (hj : Δ j ⊆ D₁) (hk : Δ k ⊆ D₂) + (hone₀ : ∀ l, Δ l ⊆ D₀ → l = i) (hone₁ : ∀ l, Δ l ⊆ D₁ → l = j) + (hone₂ : ∀ l, Δ l ⊆ D₂ → l = k) : D₀ ∪ D₁ ∪ D₂ = univ := by + classical + by_contra hnot + have hRP : R ∩ P = {a, b} := (inter_comm R P).trans hPR + rcases theta_disc_union_of_not_cover hS hP hQ hR hPQ hQR hRP hD₀ hD₁ hD₂ + hb₀ hb₁ hb₂ hnot with h | h | h + · exact hij (hone₀ j (by rw [h]; exact hj.trans subset_union_left)).symm + · exact hjk (hone₁ k (by rw [h]; exact hk.trans subset_union_left)).symm + · exact hik (hone₂ i (by rw [h]; exact hi.trans subset_union_left)) + +/-- A deletion whose interior meets an enclosing disc lies wholly +in that disc, since the enclosing boundary stays in Sigma-star. -/ +theorem deleted_disc_subset_of_interior_meets_disc + {S ι : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + {D : Set S} (hD : IsClosedDisc D) (hbd : discBd D ⊆ discComplement Δ) + (i : ι) (hmeet : (discInt (Δ i) ∩ D).Nonempty) : Δ i ⊆ D := by + have hdis : Disjoint (discInt (Δ i)) (discBd D) := by + apply Set.disjoint_left.mpr + intro x hxI hxB + exact hxI.2 (discComplement_inter_disc_subset_boundary hS Δ hΔ i ⟨hbd hxB, hxI.1⟩) + rcases hD.side (fun x => (hS.2.2 x).isManifoldPoint) (hΔ i).isPreconnected_discInt hdis with hin + | hout + · have hcl : closure (discInt (Δ i)) ⊆ D := by + rw [← hD.isClosed.closure_eq] + exact closure_mono (hin.trans (discInt_subset D)) + exact (hΔ i).subset_closure_discInt.trans hcl + · exact (Set.not_nonempty_iff_eq_empty.mpr (Set.disjoint_iff_inter_eq_empty.mp hout) hmeet).elim + +/-- Three covering enclosing discs, each with its unique prescribed +deletion, leave no fourth deletion label. -/ +theorem deletion_labels_exhaust_of_three_disc_cover + {S ι : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + {D₀ D₁ D₂ : Set S} (hD₀ : IsClosedDisc D₀) (hD₁ : IsClosedDisc D₁) (hD₂ : IsClosedDisc D₂) + (hb₀ : discBd D₀ ⊆ discComplement Δ) (hb₁ : discBd D₁ ⊆ discComplement Δ) + (hb₂ : discBd D₂ ⊆ discComplement Δ) (hcover : D₀ ∪ D₁ ∪ D₂ = univ) + {i j k : ι} (hone₀ : ∀ l, Δ l ⊆ D₀ → l = i) (hone₁ : ∀ l, Δ l ⊆ D₁ → l = j) + (hone₂ : ∀ l, Δ l ⊆ D₂ → l = k) : ∀ l, l = i ∨ l = j ∨ l = k := by + intro l + obtain ⟨x, hx⟩ := (hΔ l).nonempty_discInt + have hxD : x ∈ D₀ ∪ D₁ ∪ D₂ := hcover.symm ▸ mem_univ x + rcases hxD with (hx₀ | hx₁) | hx₂ + · exact Or.inl (hone₀ l (deleted_disc_subset_of_interior_meets_disc hS Δ hΔ hD₀ hb₀ l ⟨x, hx, + hx₀⟩)) + · exact Or.inr (Or.inl (hone₁ l + (deleted_disc_subset_of_interior_meets_disc hS Δ hΔ hD₁ hb₁ l ⟨x, hx, hx₁⟩))) + · exact Or.inr (Or.inr (hone₂ l + (deleted_disc_subset_of_interior_meets_disc hS Δ hΔ hD₂ hb₂ l ⟨x, hx, hx₂⟩))) + +/-- Three distinct labels exhausting a finite family give exactly +three members. -/ +theorem card_eq_three_of_exhausting_labels + {ι : Type*} [Finite ι] {i j k : ι} (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) + (hex : ∀ l, l = i ∨ l = j ∨ l = k) : Nat.card ι = 3 := by + have hu : (univ : Set ι) = {i, j, k} := Set.ext fun l => + ⟨fun _ => hex l, fun _ => mem_univ l⟩ + have hi : i ∉ ({j, k} : Set ι) := fun h => h.elim hij hik + rw [← Set.ncard_univ, hu, Set.ncard_insert_of_notMem hi, Set.ncard_pair hjk] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThetaCuffs.lean b/LeanPool/GraphMinor/GM12/Section3ThetaCuffs.lean new file mode 100644 index 0000000000..c93b0c0779 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThetaCuffs.lean @@ -0,0 +1,100 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ThetaPlanarity +public import LeanPool.GraphMinor.GM12.Section3CapTopology +public import LeanPool.GraphMinor.GM12.Section3CapComparison + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Distinct cuff labels on the third schismatic shape + +VII Section 8, page 241, used by XII (3.1), page 245, says that the +pair circles of a schismatic three-branch shape surround distinct +cuffs. If two pairs became planar after filling the same cuff, their +common branch would make the whole shape planar in that cap. The +original shape misses the new disc interior, so the proper-set premise +of VII (5.1) holds there. Cap comparison returns the result to VII's +universal definition of planarity after filling a cuff. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +universe u + +private theorem line_image_embedding + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + {j : S → T} (hj : IsEmbedding j) {P : Set S} {a b : S} + (hP : IsLineWithEnds P a b) : IsLineWithEnds (j '' P) (j a) (j b) := by + obtain ⟨φ, hφ0, hφ1⟩ := hP + exact ⟨φ.trans (hj.homeomorphImage P), congrArg j hφ0, congrArg j hφ1⟩ + +/-- Filling one cuff makes the whole three-branch shape planar if it +makes two pair circles planar. This is the common-cuff exclusion used +in VII Section 8's classification of the third schismatic shape. -/ +theorem planarInCappedCuff_three_branches_of_two_pairs + {S : Type u} [TopologicalSpace S] [ConnectedSpace S] (hS : IsSurface S) + {P Q R C : Set S} {a b : S} (hab : a ≠ b) + (hP : IsLineWithEnds P a b) (hQ : IsLineWithEnds Q a b) (hR : IsLineWithEnds R a b) + (hPQ : P ∩ Q = {a, b}) (hPR : P ∩ R = {a, b}) (hQR : Q ∩ R = {a, b}) + (hpPQ : GM07.IsPlanarInCappedCuff C (P ∪ Q)) + (hpPR : GM07.IsPlanarInCappedCuff C (P ∪ R)) : + GM07.IsPlanarInCappedCuff C (P ∪ Q ∪ R) := by + obtain ⟨T, tT, j, D, hcap⟩ := exists_cappedCuff hS hpPQ.1 + let := tT + have hconn : ConnectedSpace T := cappedCuff_connectedSpace hcap + have hp : GM11.IsPlanar (j '' P ∪ j '' Q) := by + rw [← image_union] + exact hpPQ.2.2 T j D hcap + have hq : GM11.IsPlanar (j '' P ∪ j '' R) := by + rw [← image_union] + exact hpPR.2.2 T j D hcap + have hi : ∀ L M : Set S, L ∩ M = {a, b} → j '' L ∩ j '' M = {j a, j b} := by + intro L M hLM + rw [← image_inter hcap.isEmbedding.injective, hLM, image_pair] + have hproper : j '' P ∪ j '' Q ∪ j '' R ≠ univ := by + rw [← image_union, ← image_union] + intro heq + apply cappedCuff_range_ne_univ hcap + apply Set.eq_univ_of_univ_subset + rw [← heq] + exact image_subset_range _ _ + have hplan := planar_three_branches_of_two_planar_pairs hcap.isSurface hconn + (fun he => hab (hcap.isEmbedding.injective he)) + (line_image_embedding hcap.isEmbedding hP) (line_image_embedding hcap.isEmbedding hQ) + (line_image_embedding hcap.isEmbedding hR) (hi P Q hPQ) (hi P R hPR) (hi Q R hQR) + hproper hp hq + apply isPlanarInCappedCuff_of_one_cap hS hcap + simpa only [image_union] using hplan + +/-- Two pair circles of a non-near-planar theta cannot be planar in +caps of the same cuff. Hence the cuff labels in VII Section 8's third +schismatic shape are distinct whenever they exist. -/ +theorem cuff_ne_of_planar_pair_circles + {S : Type u} [TopologicalSpace S] [ConnectedSpace S] (hS : IsSurface S) + {P Q R C C' : Set S} {a b : S} (hab : a ≠ b) + (hP : IsLineWithEnds P a b) (hQ : IsLineWithEnds Q a b) (hR : IsLineWithEnds R a b) + (hPQ : P ∩ Q = {a, b}) (hPR : P ∩ R = {a, b}) (hQR : Q ∩ R = {a, b}) + (hnot : ¬ GM07.IsNearPlanar (P ∪ Q ∪ R)) + (hpPQ : GM07.IsPlanarInCappedCuff C (P ∪ Q)) + (hpPR : GM07.IsPlanarInCappedCuff C' (P ∪ R)) : C ≠ C' := by + intro heq + subst C' + have hp := planarInCappedCuff_three_branches_of_two_pairs hS hab hP hQ hR + hPQ hPR hQR hpPQ hpPR + exact hnot (Or.inr ⟨C, hp.1, hp⟩) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThetaFaceIntersection.lean b/LeanPool/GraphMinor/GM12/Section3ThetaFaceIntersection.lean new file mode 100644 index 0000000000..8a8f2d93a3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThetaFaceIntersection.lean @@ -0,0 +1,40 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section6 + +/-! +# Intersections of adjacent theta-face discs + +The proof of XII (3.2), page 246, uses the three faces bounded +by pairs of theta arcs. Two adjacent face discs meet in their +common boundary arc. The proof separates each opposite arc from +its disc, then separates the interiors of the two discs. This is +the same separation argument used in XI's theta-union lemma. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Adjacent theta-face discs intersect exactly in their common +boundary arc, as used to check XII (3.1)(iv) in (3.2). -/ +theorem theta_face_disc_intersection {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {A₀ A₁ A₂ Δ₀ Δ₁ : Set S} {a b : S} + (l₀ : IsLineWithEnds A₀ a b) (l₁ : IsLineWithEnds A₁ a b) + (i₀₁ : A₀ ∩ A₁ = {a, b}) (i₁₂ : A₁ ∩ A₂ = {a, b}) (i₂₀ : A₂ ∩ A₀ = {a, b}) + (d₀ : IsClosedDisc Δ₀) (d₁ : IsClosedDisc Δ₁) + (f₀ : frontier Δ₀ = A₁ ∪ A₂) (f₁ : frontier Δ₁ = A₂ ∪ A₀) + (h₀ : ¬ A₀ ⊆ Δ₀) (h₁ : ¬ A₁ ⊆ Δ₁) : Δ₀ ∩ Δ₁ = A₂ := + (theta_disc_intersection hS l₀ l₁ i₀₁ i₁₂ i₂₀ d₀ d₁ f₀ f₁ h₀ h₁).1 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThetaHomotopy.lean b/LeanPool/GraphMinor/GM12/Section3ThetaHomotopy.lean new file mode 100644 index 0000000000..10ac2506da --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThetaHomotopy.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM12.Section2ArcHomotopy +import LeanPool.GraphMinor.Surface.Disc + +/-! +# Two planar pair circles determine the third homotopy + +For the three-branch shape in VII Section 8, used by XII (3.1), page +245, two pair circles lying in discs make their common branch homotopic +to each other branch. Transitivity makes the other two branches +homotopic. Traversing one and returning along the other therefore +gives a null-homotopic third circle. This spells out the path argument +behind the planarity comparisons for the third schismatic shape. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +private theorem path_of_line + {S : Type*} [TopologicalSpace S] {L : Set S} {u v : S} + (hL : IsLineWithEnds L u v) : + ∃ p : Path u v, Function.Injective p ∧ range p = L := by + obtain ⟨e, he0, he1⟩ := hL + let p : Path u v := { + toFun := fun t => (e t).val + continuous_toFun := continuous_subtype_val.comp e.continuous + source' := he0 + target' := he1 } + exact ⟨p, fun s t he => e.injective (Subtype.ext he), + (e.surjective.range_comp Subtype.val).trans Subtype.range_val⟩ + +/-- Two paths whose ranges lie in one closed disc are homotopic with +fixed ends. The disc's relative-endpoint curve homotopy gives the path +homotopy after exchanging its two parameters. -/ +theorem paths_homotopic_of_planar_union + {S : Type*} [TopologicalSpace S] {u v : S} (p q : Path u v) + (hplan : IsPlanar (range p ∪ range q)) : p.Homotopic q := by + obtain ⟨D, hD, hsub⟩ := hplan + have hcurves := hD.curvesHomotopicIn + (fun _ hx => hsub (Or.inl hx)) (fun _ hx => hsub (Or.inr hx)) + (p.source.trans q.source.symm) (p.target.trans q.target.symm) + obtain ⟨H, _, h0, h1, hleft, _, hright, _⟩ := hcurves + refine ⟨{ + toFun := fun z => H (z.2, z.1) + continuous_toFun := H.continuous.comp (continuous_snd.prodMk continuous_fst) + map_zero_left := h0 + map_one_left := h1 + prop' := ?_ }⟩ + intro t s hs + rcases hs with rfl | hs + · exact hleft t + · have hs1 : s = 1 := mem_singleton_iff.mp hs + subst s + exact hright t + +/-- If two pair circles of three branches are planar, the third is +null-homotopic. The homotopies through the common branch are composed +with their ends fixed. -/ +theorem third_pair_null_of_two_planar_pairs + {S : Type*} [TopologicalSpace S] [T2Space S] + {P Q R : Set S} {u v : S} + (hP : IsLineWithEnds P u v) (hQ : IsLineWithEnds Q u v) (hR : IsLineWithEnds R u v) + (hQR : Q ∩ R = {u, v}) + (hplanPQ : IsPlanar (P ∪ Q)) (hplanPR : IsPlanar (P ∪ R)) : + IsNullHomotopicOArc (Q ∪ R) := by + obtain ⟨p, _, hp⟩ := path_of_line hP + obtain ⟨q, hqi, hq⟩ := path_of_line hQ + obtain ⟨r, hri, hr⟩ := path_of_line hR + have hpq : p.Homotopic q := paths_homotopic_of_planar_union p q (by rwa [hp, hq]) + have hpr : p.Homotopic r := paths_homotopic_of_planar_union p r (by rwa [hp, hr]) + have hcross : ∀ s t, q s = r t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + intro s t he + have hxQ : q s ∈ Q := hq ▸ mem_range_self s + have hxR : q s ∈ R := he.symm ▸ (hr ▸ mem_range_self t) + have hx : q s ∈ ({u, v} : Set S) := hQR ▸ (show q s ∈ Q ∩ R from ⟨hxQ, hxR⟩) + rcases hx with hxu | hxv + · exact Or.inl ⟨hqi (hxu.trans q.source.symm), hri (he.symm.trans (hxu.trans r.source.symm))⟩ + · exact Or.inr ⟨hqi (hxv.trans q.target.symm), hri (he.symm.trans (hxv.trans r.target.symm))⟩ + have hnull := nullHomotopic_union_of_homotopic_arcs q r hqi hri hcross (hpq.symm.trans hpr) + rw [hq, hr] at hnull + exact hnull + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThetaPlanarity.lean b/LeanPool/GraphMinor/GM12/Section3ThetaPlanarity.lean new file mode 100644 index 0000000000..092597e4e6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThetaPlanarity.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Cited +public import LeanPool.GraphMinor.GM12.Section3ThetaCircles +import LeanPool.GraphMinor.GM12.Section3ThetaHomotopy +import LeanPool.GraphMinor.GM12.Section3SolidUnion +import LeanPool.GraphMinor.Surface.DiscsInSurface + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Planarity from two pair circles + +In the third schismatic shape of VII Section 8, used by XII (3.1), +page 245, the first two pair circles generate the homotopies of the +third. If both are planar, the third is null-homotopic. Every circle +in the shape is one of these pairs, so VII (5.1) makes the whole proper +solid shape planar. This supplies the comparison needed when two +pair circles are planar after filling the same cuff. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +universe u + +/-- Two planar pair circles make the whole proper three-branch shape +planar, by the relative-endpoint path argument and VII (5.1), page 230. -/ +theorem planar_three_branches_of_two_planar_pairs + {S : Type u} [TopologicalSpace S] (hS : IsSurface S) (hconn : ConnectedSpace S) + {P Q R : Set S} {u v : S} (huv : u ≠ v) + (hP : IsLineWithEnds P u v) (hQ : IsLineWithEnds Q u v) (hR : IsLineWithEnds R u v) + (hPQ : P ∩ Q = {u, v}) (hPR : P ∩ R = {u, v}) (hQR : Q ∩ R = {u, v}) + (hproper : P ∪ Q ∪ R ≠ univ) + (hplanPQ : IsPlanar (P ∪ Q)) (hplanPR : IsPlanar (P ∪ R)) : + IsPlanar (P ∪ Q ∪ R) := by + let := hS.1 + let := hS.2.1 + have hsolid := isSolid_union (isSolid_union (isSolid_line ⟨hP.choose⟩) + (isSolid_line ⟨hQ.choose⟩)) (isSolid_line ⟨hR.choose⟩) + apply (GraphMinor.GM07.gm07_theorem_5_1 S hS hconn (P ∪ Q ∪ R) hsolid hproper).mpr + intro F hF hFX + rcases oArc_eq_pair_of_three_branches huv hP hQ hR hPQ hPR hQR hF hFX with h | h | h + · rw [h] + obtain ⟨D, hD, hFD⟩ := hplanPQ + exact isNullHomotopicOArcIn_of_subset_disc + (isOArc_union_of_lines_inter_eq_ends hP hQ hPQ) (subset_univ D) hD hFD + · rw [h] + obtain ⟨D, hD, hFD⟩ := hplanPR + exact isNullHomotopicOArcIn_of_subset_disc + (isOArc_union_of_lines_inter_eq_ends hP hR hPR) (subset_univ D) hD hFD + · rw [h] + exact third_pair_null_of_two_planar_pairs hP hQ hR hQR hplanPQ hplanPR + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThetaProperPairs.lean b/LeanPool/GraphMinor/GM12/Section3ThetaProperPairs.lean new file mode 100644 index 0000000000..83830eb52b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThetaProperPairs.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ThetaSchismatic + +/-! +# Each pair circle is proper in a theta + +For VII Section 8's third schismatic shape, used by XII (3.1), page +245, the minimal-circle clause applies to each pair of branches. The +opposite line has a midpoint which is neither end, so it cannot lie in +the pair. Thus each pair is a proper subset, and all three pair circles +of a schismatic theta are near-planar. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +private theorem line_not_subset_ends + {S : Type*} [TopologicalSpace S] {L : Set S} {u v : S} + (hL : IsLineWithEnds L u v) : ¬ L ⊆ {u, v} := by + obtain ⟨e, he0, he1⟩ := hL + let t : unitInterval := ⟨1 / 2, by norm_num⟩ + have ht0 : t ≠ 0 := by + intro h + have hv := congrArg Subtype.val h + norm_num [t] at hv + have ht1 : t ≠ 1 := by + intro h + have hv := congrArg Subtype.val h + norm_num [t] at hv + intro hsub + rcases hsub (e t).property with htu | htv + · exact ht0 (e.injective (Subtype.ext (htu.trans he0.symm))) + · exact ht1 (e.injective (Subtype.ext (htv.trans he1.symm))) + +/-- The opposite branch has an interior point outside the other two, +so their union is a proper subset of all three branches. -/ +theorem pair_strict_subset_three_branches + {S : Type*} [TopologicalSpace S] {P Q R : Set S} {u v : S} + (hR : IsLineWithEnds R u v) + (hPR : P ∩ R = {u, v}) (hQR : Q ∩ R = {u, v}) : + P ∪ Q ⊂ P ∪ Q ∪ R := by + refine ⟨subset_union_left, ?_⟩ + intro hsub + apply line_not_subset_ends hR + intro x hx + rcases hsub (Or.inr hx) with hxP | hxQ + · exact hPR ▸ (show x ∈ P ∩ R from ⟨hxP, hx⟩) + · exact hQR ▸ (show x ∈ Q ∩ R from ⟨hxQ, hx⟩) + +/-- All three pair circles of a schismatic theta are near-planar. +This discharges the proper-subset premise in VII Section 8's definition. -/ +theorem nearPlanar_pairs_of_schismatic_theta + {S : Type*} [TopologicalSpace S] [T2Space S] + {P Q R : Set S} {u v : S} + (hP : IsLineWithEnds P u v) (hQ : IsLineWithEnds Q u v) (hR : IsLineWithEnds R u v) + (hPQ : P ∩ Q = {u, v}) (hPR : P ∩ R = {u, v}) (hQR : Q ∩ R = {u, v}) + (hX : GM07.IsSchismatic (P ∪ Q ∪ R)) : + GM07.IsNearPlanar (P ∪ Q) ∧ GM07.IsNearPlanar (P ∪ R) ∧ GM07.IsNearPlanar (Q ∪ R) := by + have hQP : Q ∩ P = {u, v} := (inter_comm Q P).trans hPQ + have hRP : R ∩ P = {u, v} := (inter_comm R P).trans hPR + have hRQ : R ∩ Q = {u, v} := (inter_comm R Q).trans hQR + refine ⟨hX.2.2 _ (isOArc_union_of_lines_inter_eq_ends hP hQ hPQ) + (pair_strict_subset_three_branches hR hPR hQR), ?_, ?_⟩ + · apply hX.2.2 _ (isOArc_union_of_lines_inter_eq_ends hP hR hPR) + simpa only [union_right_comm] using pair_strict_subset_three_branches hQ hPQ hRQ + · apply hX.2.2 _ (isOArc_union_of_lines_inter_eq_ends hQ hR hQR) + simpa only [union_assoc, union_left_comm, union_comm] using + pair_strict_subset_three_branches hP hQP hRP + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThetaSchismatic.lean b/LeanPool/GraphMinor/GM12/Section3ThetaSchismatic.lean new file mode 100644 index 0000000000..43c2befead --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThetaSchismatic.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ThetaCircles +public import LeanPool.GraphMinor.GM12.Section3SurroundingUnique + +/-! +# The third schismatic shape + +For the three-branch shape of VII Section 8, used by XII (3.1), page +245, its circles are exactly the three pairs of branches. If those +pairs are near-planar but their whole union is not, the union is +schismatic. In particular, this applies when the pairs surround cuffs +and two of those cuffs are distinct. The distinct-cuff criterion proves +non-near-planarity of the whole union. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Three branches form a schismatic set when all three circles are +near-planar and the full union is not. The circle classification proves +the entire minimal-circle clause of VII Section 8, page 241. -/ +theorem isSchismatic_x3_of_nearPlanar_pairs + {S : Type*} [TopologicalSpace S] [T2Space S] + {P Q R : Set S} {u v : S} (huv : u ≠ v) + (hP : IsLineWithEnds P u v) (hQ : IsLineWithEnds Q u v) (hR : IsLineWithEnds R u v) + (hPQ : P ∩ Q = {u, v}) (hPR : P ∩ R = {u, v}) (hQR : Q ∩ R = {u, v}) + (hnPQ : GM07.IsNearPlanar (P ∪ Q)) (hnPR : GM07.IsNearPlanar (P ∪ R)) + (hnQR : GM07.IsNearPlanar (Q ∪ R)) + (hnot : ¬ GM07.IsNearPlanar (P ∪ Q ∪ R)) : GM07.IsSchismatic (P ∪ Q ∪ R) := by + refine ⟨Or.inr (Or.inr (Or.inr ⟨P, Q, R, u, v, huv, hP, hQ, hR, hPQ, hPR, hQR, rfl⟩)), + hnot, ?_⟩ + intro Z hZ hZY + rcases oArc_eq_pair_of_three_branches huv hP hQ hR hPQ hPR hQR hZ hZY.1 with h | h | h + · exact h ▸ hnPQ + · exact h ▸ hnPR + · exact h ▸ hnQR + +/-- Surrounding pairs with two distinct cuff labels supply the third +schismatic shape inside the actual punctured surface of XII (3.1). +No planarity or minimality assertion is included as data. -/ +theorem isSchismatic_x3_of_surrounding_pairs + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + {P Q R : Set (discComplement Δ)} {u v : discComplement Δ} (huv : u ≠ v) + (hP : IsLineWithEnds P u v) (hQ : IsLineWithEnds Q u v) (hR : IsLineWithEnds R u v) + (hPQ : P ∩ Q = {u, v}) (hPR : P ∩ R = {u, v}) (hQR : Q ∩ R = {u, v}) + {i j k : ι} (hij : i ≠ j) + (hsPQ : GM07.SurroundsCuff (P ∪ Q) (Subtype.val ⁻¹' discBd (Δ i))) + (hsPR : GM07.SurroundsCuff (P ∪ R) (Subtype.val ⁻¹' discBd (Δ j))) + (hsQR : GM07.SurroundsCuff (Q ∪ R) (Subtype.val ⁻¹' discBd (Δ k))) : + GM07.IsSchismatic (P ∪ Q ∪ R) := by + have hnot := not_isNearPlanar_of_distinct_surrounding_subcircles hS Δ hΔ hdisj hcase hij + (isOArc_union_of_lines_inter_eq_ends hP hQ hPQ) + (isOArc_union_of_lines_inter_eq_ends hP hR hPR) + (X := P ∪ Q ∪ R) subset_union_left + (union_subset (subset_union_left.trans subset_union_left) subset_union_right) hsPQ hsPR + exact isSchismatic_x3_of_nearPlanar_pairs huv hP hQ hR hPQ hPR hQR + (Or.inr ⟨_, hsPQ.1, hsPQ.2.1⟩) (Or.inr ⟨_, hsPR.1, hsPR.2.1⟩) + (Or.inr ⟨_, hsQR.1, hsQR.2.1⟩) hnot + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThetaSchismaticCount.lean b/LeanPool/GraphMinor/GM12/Section3ThetaSchismaticCount.lean new file mode 100644 index 0000000000..cb53cd2091 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThetaSchismaticCount.lean @@ -0,0 +1,149 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3BranchRelabel +public import LeanPool.GraphMinor.GM12.Section3ThetaClassification +import LeanPool.GraphMinor.GM12.Section3PuncturedCuffs +import LeanPool.GraphMinor.GM12.Section3PuncturedSurface + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# The vertex bound for a schismatic theta + +Condition (iv) of XII (3.1), page 245, applies to every normal +schismatic theta. Its three pair circles surround distinct cuffs by +the proved classification. Index the opposite branches by those cuffs +and apply the three-branch bound. The branch permutation preserves +the union and hence the vertex count. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +universe u + +private theorem injective_triple {ι : Type*} {i j k : ι} + (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) : Function.Injective (![i, j, k]) := by + intro a b h + fin_cases a <;> fin_cases b <;> simp_all + +/-- Condition (iv) of XII (3.1) bounds every normal schismatic theta +when the prescribed deletion family is indexed by three elements. -/ +theorem three_branch_vertex_count_gt_of_schismatic + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) + (Δ : Fin 3 → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hUC : Γ.U ⊆ discComplement Δ) (N : ℕ) + (hbound : IsSphere S → ∀ (P D : Fin 3 → Set S) (a b : S), a ≠ b → + Γ.IsNormal (⋃ i, P i) → (∀ i, IsLineWithEnds (P i) a b) → + (∀ i j, i ≠ j → P i ∩ P j = {a, b}) → (⋃ i, P i) ⊆ discComplement Δ → + (∀ i, IsClosedDisc (D i) ∧ + discBd (D i) = ⋃ j : {j // j ≠ i}, P j.val ∧ Δ i ⊆ D i ∧ ¬ P i ⊆ D i) → + N < (Γ.V ∩ ⋃ i, P i).ncard) + {P Q R : Set (discComplement Δ)} {a b : discComplement Δ} (hab : a ≠ b) + (hP : IsLineWithEnds P a b) (hQ : IsLineWithEnds Q a b) (hR : IsLineWithEnds R a b) + (hPQ : P ∩ Q = {a, b}) (hPR : P ∩ R = {a, b}) (hQR : Q ∩ R = {a, b}) + (hX : GM07.IsSchismatic (P ∪ Q ∪ R)) + (hn : (drawingInSubspace Γ (discComplement Δ) hUC).IsNormal (P ∪ Q ∪ R)) : + N < ((drawingInSubspace Γ (discComplement Δ) hUC).V ∩ (P ∪ Q ∪ R)).ncard := by + let : ConnectedSpace (discComplement Δ) := + Subtype.connectedSpace (discComplement_isConnected hS Δ hΔ hdisj) + have hsphere := (sphere_card_three_of_schismatic_theta hS Δ hΔ hdisj + hab hP hQ hR hPQ hPR hQR hX).1 + obtain ⟨C₁, C₂, C₃, hs₁, hs₂, hs₃, h12, h13, h23⟩ := + surrounding_pairs_of_schismatic_theta (discComplement_isSurface hS Δ hΔ hdisj) + (discComplement_cuffs_nonempty hS Δ hΔ hdisj) hab hP hQ hR hPQ hPR hQR hX + have hc₁ := hs₁.1 + have hc₂ := hs₂.1 + have hc₃ := hs₃.1 + rw [discComplement_cuffs_eq hS Δ hΔ hdisj] at hc₁ hc₂ hc₃ + obtain ⟨i, rfl⟩ := hc₁ + obtain ⟨j, rfl⟩ := hc₂ + obtain ⟨k, rfl⟩ := hc₃ + have hij : i ≠ j := fun he => h12 (congrArg (fun l => Subtype.val ⁻¹' discBd (Δ l)) he) + have hik : i ≠ k := fun he => h13 (congrArg (fun l => Subtype.val ⁻¹' discBd (Δ l)) he) + have hjk : j ≠ k := fun he => h23 (congrArg (fun l => Subtype.val ⁻¹' discBd (Δ l)) he) + let B : Fin 3 → Set (discComplement Δ) := ![P, Q, R] + let f : Fin 3 → Fin 3 := ![k, j, i] + have hfi : Function.Injective f := injective_triple hjk.symm hik.symm hij.symm + let e : Fin 3 ≃ Fin 3 := Equiv.ofBijective f ⟨hfi, Finite.surjective_of_injective hfi⟩ + have hU : (⋃ l, B l) = P ∪ Q ∪ R := by + ext x + simp [B, Fin.exists_fin_succ, or_assoc] + have hO₀ : (⋃ l : {l : Fin 3 // l ≠ 0}, B l.val) = Q ∪ R := by + ext x + simp [B, Fin.exists_fin_succ] + have hO₁ : (⋃ l : {l : Fin 3 // l ≠ 1}, B l.val) = P ∪ R := by + ext x + simp [B, Fin.exists_fin_succ] + have hO₂ : (⋃ l : {l : Fin 3 // l ≠ 2}, B l.val) = P ∪ Q := by + ext x + simp [B, Fin.exists_fin_succ] + have hline : ∀ l, IsLineWithEnds (B l) a b := by + intro l + fin_cases l + · exact hP + · exact hQ + · exact hR + have hmeet : ∀ l m, l ≠ m → B l ∩ B m = {a, b} := by + intro l m hlm + fin_cases l <;> fin_cases m + · exact (hlm rfl).elim + · exact hPQ + · exact hPR + · exact (inter_comm Q P).trans hPQ + · exact (hlm rfl).elim + · exact hQR + · exact (inter_comm R P).trans hPR + · exact (inter_comm R Q).trans hQR + · exact (hlm rfl).elim + have hcircles : ∀ l, IsOArc (⋃ m : {m // m ≠ l}, B m.val) := by + intro l + fin_cases l + · change IsOArc (⋃ m : {m : Fin 3 // m ≠ 0}, B m.val) + rw [hO₀] + exact isOArc_union_of_lines_inter_eq_ends hQ hR hQR + · change IsOArc (⋃ m : {m : Fin 3 // m ≠ 1}, B m.val) + rw [hO₁] + exact isOArc_union_of_lines_inter_eq_ends hP hR hPR + · change IsOArc (⋃ m : {m : Fin 3 // m ≠ 2}, B m.val) + rw [hO₂] + exact isOArc_union_of_lines_inter_eq_ends hP hQ hPQ + have hs : ∀ l, GM07.SurroundsCuff (⋃ m : {m // m ≠ l}, B m.val) + (Subtype.val ⁻¹' discBd (Δ (e l))) := by + intro l + fin_cases l + · change GM07.SurroundsCuff (⋃ m : {m : Fin 3 // m ≠ 0}, B m.val) + (Subtype.val ⁻¹' discBd (Δ k)) + rw [hO₀] + exact hs₃ + · change GM07.SurroundsCuff (⋃ m : {m : Fin 3 // m ≠ 1}, B m.val) + (Subtype.val ⁻¹' discBd (Δ j)) + rw [hO₁] + exact hs₂ + · change GM07.SurroundsCuff (⋃ m : {m : Fin 3 // m ≠ 2}, B m.val) + (Subtype.val ⁻¹' discBd (Δ i)) + rw [hO₂] + exact hs₁ + have hnB : (drawingInSubspace Γ (discComplement Δ) hUC).IsNormal (⋃ l, B l) := by + rwa [hU] + have hnotB : ¬ GM07.IsNearPlanar (⋃ l, B l) := by rw [hU]; exact hX.2.1 + have hbig := three_branch_vertex_count_gt_relabelled hS hsphere Γ Δ hΔ hdisj hUC N hbound + B hab hline hmeet hcircles e hs hnB hnotB + rw [hU] at hbig + exact hbig + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThetaSphere.lean b/LeanPool/GraphMinor/GM12/Section3ThetaSphere.lean new file mode 100644 index 0000000000..ec821265d6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThetaSphere.lean @@ -0,0 +1,100 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ThetaPlanarity +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.Surface.DiscsInSurface + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Three theta discs covering the surface force a sphere + +The third schismatic shape in VII Section 8, used by XII (3.1), page +245, occurs only on a sphere with three cuffs. For the sphere assertion, +fill the cuffs and consider its three enclosing discs. Two pair circles +are planar, so VII (5.1) puts the whole proper theta in one disc. On a +surface other than a sphere, uniqueness of bounded discs then puts all +three enclosing discs in that disc. They cannot cover a closed surface. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +universe u + +/-- A closed disc cannot fill a closed surface: its boundary is a +circle, whereas the frontier of the whole surface is empty. -/ +theorem closed_disc_ne_univ + {S : Type*} [TopologicalSpace S] (hS : IsClosedSurface S) + {D : Set S} (hD : IsClosedDisc D) : D ≠ univ := by + intro heq + have hb : discBd D = ∅ := by + rw [← IsClosedDisc.frontier_eq_discBd hS hD, heq, frontier_univ] + obtain ⟨e⟩ := hD.isOArc_discBd + exact hb.subset (e 1).property + +/-- On a surface other than a sphere, a disc whose boundary lies in +another disc lies in that disc. Jordan inside the latter disc and +uniqueness in the original surface give the inclusion. -/ +theorem disc_subset_of_boundary_subset_disc_of_not_sphere + {S : Type*} [TopologicalSpace S] [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + {D B : Set S} (hD : IsClosedDisc D) (hB : IsClosedDisc B) + (hbd : discBd D ⊆ B) : D ⊆ B := by + obtain ⟨E, hE, _⟩ := disc_oArc B (discBd D) hB hbd hD.isOArc_discBd + have hsurf : IsSurface S := ⟨hS.1, hS.2.1, fun x => (hS.2.2 x).isManifoldPoint⟩ + have heq : D = E := Surface.eq_of_discBd_eq hsurf hns hD hE.2.1 hE.2.2.1.symm + exact heq ▸ hE.1 + +/-- A proper theta whose three pair circles bound discs covering a +connected closed surface forces that surface to be a sphere. This is +the closed-surface step in VII Section 8's third-shape classification. -/ +theorem isSphere_of_covering_theta_discs + {S : Type u} [TopologicalSpace S] [ConnectedSpace S] + (hS : IsClosedSurface S) + {P Q R D₀ D₁ D₂ : Set S} {a b : S} (hab : a ≠ b) + (hP : IsLineWithEnds P a b) (hQ : IsLineWithEnds Q a b) (hR : IsLineWithEnds R a b) + (hPQ : P ∩ Q = {a, b}) (hPR : P ∩ R = {a, b}) (hQR : Q ∩ R = {a, b}) + (hproper : P ∪ Q ∪ R ≠ univ) + (hD₀ : IsClosedDisc D₀) (hD₁ : IsClosedDisc D₁) (hD₂ : IsClosedDisc D₂) + (hb₀ : discBd D₀ = Q ∪ R) (hb₁ : discBd D₁ = R ∪ P) (hb₂ : discBd D₂ = P ∪ Q) + (hcover : D₀ ∪ D₁ ∪ D₂ = univ) : IsSphere S := by + classical + by_contra hns + have hsurf : IsSurface S := ⟨hS.1, hS.2.1, fun x => (hS.2.2 x).isManifoldPoint⟩ + have hpPQ : GM11.IsPlanar (P ∪ Q) := ⟨D₂, hD₂, hb₂ ▸ Surface.discBd_subset D₂⟩ + have hpPR : GM11.IsPlanar (P ∪ R) := by + refine ⟨D₁, hD₁, ?_⟩ + rw [union_comm, ← hb₁] + exact Surface.discBd_subset D₁ + obtain ⟨B, hB, hXB⟩ := planar_three_branches_of_two_planar_pairs hsurf inferInstance + hab hP hQ hR hPQ hPR hQR hproper hpPQ hpPR + have hsub : ∀ D : Set S, IsClosedDisc D → discBd D ⊆ P ∪ Q ∪ R → D ⊆ B := by + intro D hD hb + exact disc_subset_of_boundary_subset_disc_of_not_sphere hS hns hD hB (hb.trans hXB) + have hs₀ : D₀ ⊆ B := hsub D₀ hD₀ (by + rw [hb₀] + exact union_subset (subset_union_right.trans subset_union_left) subset_union_right) + have hs₁ : D₁ ⊆ B := hsub D₁ hD₁ (by + rw [hb₁] + exact union_subset subset_union_right (subset_union_left.trans subset_union_left)) + have hs₂ : D₂ ⊆ B := hsub D₂ hD₂ (by rw [hb₂]; exact subset_union_left) + apply closed_disc_ne_univ hS hB + apply Set.eq_univ_of_univ_subset + rw [← hcover] + exact union_subset (union_subset hs₀ hs₁) hs₂ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThetaSurrounding.lean b/LeanPool/GraphMinor/GM12/Section3ThetaSurrounding.lean new file mode 100644 index 0000000000..520d3d6edf --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThetaSurrounding.lean @@ -0,0 +1,112 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ThetaProperPairs +public import LeanPool.GraphMinor.GM12.Section3ThetaCuffs +import LeanPool.GraphMinor.GM12.Section3PlanarityMaps + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# The three surrounding cuff labels + +VII Section 8, page 241, used by XII (3.1), page 245, asserts that +each pair circle of a schismatic theta surrounds a cuff, and the three +cuffs are distinct. The pairs are near-planar by minimality. None is +planar: combine it with a second near-planar pair in one cap to make +the whole theta near-planar. The common-cuff exclusion then makes +the three labels distinct. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +universe u + +/-- A planar pair cannot occur in a non-near-planar theta when a +second pair is near-planar and the surface has a cuff. -/ +theorem not_planar_pair_of_not_nearPlanar_theta + {S : Type u} [TopologicalSpace S] [ConnectedSpace S] (hS : IsSurface S) + (hcuffs : (cuffs S).Nonempty) + {P Q R : Set S} {a b : S} (hab : a ≠ b) + (hP : IsLineWithEnds P a b) (hQ : IsLineWithEnds Q a b) (hR : IsLineWithEnds R a b) + (hPQ : P ∩ Q = {a, b}) (hPR : P ∩ R = {a, b}) (hQR : Q ∩ R = {a, b}) + (hnot : ¬ GM07.IsNearPlanar (P ∪ Q ∪ R)) (hnearPR : GM07.IsNearPlanar (P ∪ R)) : + ¬ IsPlanar (P ∪ Q) := by + intro hplanPQ + have hex : ∃ C, GM07.IsPlanarInCappedCuff C (P ∪ R) := by + rcases hnearPR with hp | ⟨C, _, hp⟩ + · obtain ⟨C, hC⟩ := hcuffs + exact ⟨C, isPlanarInCappedCuff_of_isPlanar hS hC hp⟩ + · exact ⟨C, hp⟩ + obtain ⟨C, hpPR⟩ := hex + have hpPQ := isPlanarInCappedCuff_of_isPlanar hS hpPR.1 hplanPQ + have hpX := planarInCappedCuff_three_branches_of_two_pairs hS hab hP hQ hR + hPQ hPR hQR hpPQ hpPR + exact hnot (Or.inr ⟨C, hpX.1, hpX⟩) + +private theorem surrounds_of_nearPlanar_not_planar + {S : Type u} [TopologicalSpace S] {F : Set S} + (hn : GM07.IsNearPlanar F) (hp : ¬ IsPlanar F) : + ∃ C : Set S, GM07.SurroundsCuff F C := by + rcases hn with hn | ⟨C, hC, hn⟩ + · exact (hp hn).elim + · exact ⟨C, hC, hn, hp⟩ + +/-- The surrounding-cuff assertion for the third schismatic shape +in VII Section 8, page 241. Each pair surrounds a cuff, and those three +cuffs are pairwise distinct. The sphere and cuff-count classification +is a separate topological step. -/ +theorem surrounding_pairs_of_schismatic_theta + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsSurface S) (hcuffs : (cuffs S).Nonempty) + {P Q R : Set S} {a b : S} (hab : a ≠ b) + (hP : IsLineWithEnds P a b) (hQ : IsLineWithEnds Q a b) (hR : IsLineWithEnds R a b) + (hPQ : P ∩ Q = {a, b}) (hPR : P ∩ R = {a, b}) (hQR : Q ∩ R = {a, b}) + (hX : GM07.IsSchismatic (P ∪ Q ∪ R)) : + ∃ C₁ C₂ C₃ : Set S, + GM07.SurroundsCuff (P ∪ Q) C₁ ∧ GM07.SurroundsCuff (P ∪ R) C₂ ∧ + GM07.SurroundsCuff (Q ∪ R) C₃ ∧ C₁ ≠ C₂ ∧ C₁ ≠ C₃ ∧ C₂ ≠ C₃ := by + obtain ⟨hnPQ, hnPR, hnQR⟩ := nearPlanar_pairs_of_schismatic_theta hP hQ hR hPQ hPR hQR hX + have hQP : Q ∩ P = {a, b} := (inter_comm Q P).trans hPQ + have hRP : R ∩ P = {a, b} := (inter_comm R P).trans hPR + have hRQ : R ∩ Q = {a, b} := (inter_comm R Q).trans hQR + have hnPQR := hX.2.1 + have hnPRQ : ¬ GM07.IsNearPlanar (P ∪ R ∪ Q) := by rwa [union_right_comm] + have hnQRP : ¬ GM07.IsNearPlanar (Q ∪ R ∪ P) := by + simpa only [union_assoc, union_left_comm, union_comm] using hnPQR + have hnpPQ := not_planar_pair_of_not_nearPlanar_theta hS hcuffs hab hP hQ hR + hPQ hPR hQR hnPQR hnPR + have hnpPR := not_planar_pair_of_not_nearPlanar_theta hS hcuffs hab hP hR hQ + hPR hPQ hRQ hnPRQ hnPQ + have hnQP : GM07.IsNearPlanar (Q ∪ P) := by rwa [union_comm] + have hnpQR := not_planar_pair_of_not_nearPlanar_theta hS hcuffs hab hQ hR hP + hQR hQP hRP hnQRP hnQP + obtain ⟨C₁, hs₁⟩ := surrounds_of_nearPlanar_not_planar hnPQ hnpPQ + obtain ⟨C₂, hs₂⟩ := surrounds_of_nearPlanar_not_planar hnPR hnpPR + obtain ⟨C₃, hs₃⟩ := surrounds_of_nearPlanar_not_planar hnQR hnpQR + have h12 := cuff_ne_of_planar_pair_circles hS hab hP hQ hR hPQ hPR hQR hnPQR + hs₁.2.1 hs₂.2.1 + have hpQP : GM07.IsPlanarInCappedCuff C₁ (Q ∪ P) := by simpa only [union_comm] using hs₁.2.1 + have hnQPR : ¬ GM07.IsNearPlanar (Q ∪ P ∪ R) := by rwa [union_comm Q P] + have h13 := cuff_ne_of_planar_pair_circles hS hab hQ hP hR hQP hQR hPR hnQPR + hpQP hs₃.2.1 + have hpRP : GM07.IsPlanarInCappedCuff C₂ (R ∪ P) := by simpa only [union_comm] using hs₂.2.1 + have hpRQ : GM07.IsPlanarInCappedCuff C₃ (R ∪ Q) := by simpa only [union_comm] using hs₃.2.1 + have hnRPQ : ¬ GM07.IsNearPlanar (R ∪ P ∪ Q) := by + simpa only [union_assoc, union_left_comm, union_comm] using hnPQR + have h23 := cuff_ne_of_planar_pair_circles hS hab hR hP hQ hRP hRQ hPQ hnRPQ hpRP hpRQ + exact ⟨C₁, C₂, C₃, hs₁, hs₂, hs₃, h12, h13, h23⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThirdDisc.lean b/LeanPool/GraphMinor/GM12/Section3ThirdDisc.lean new file mode 100644 index 0000000000..9c5f6c0121 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThirdDisc.lean @@ -0,0 +1,148 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3DisjointEnclosingDiscs +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# A third disc prevents coverage + +In the sphere case of XII (3.1), page 245, at least three discs are +prescribed. The interior of a third disc is outside the partial fills +of the first two cuffs. It therefore supplies a point outside both +enclosing discs, so the noncoverage form of disc uniqueness applies. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Filling one cuff leaves the interiors of all other prescribed +discs outside the partially filled surface. -/ +theorem discInt_disjoint_partial_fill + {S ι : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) {i k : ι} (hki : k ≠ i) : + Disjoint (discInt (Δ k)) (discComplement (fun j : {j // j ≠ i} => Δ j.val)) := by + apply Set.disjoint_left.mpr + intro x hxI hxC + have hxB := discComplement_inter_disc_subset_boundary hS + (fun j : {j // j ≠ i} => Δ j.val) (fun j => hΔ j.val) ⟨k, hki⟩ ⟨hxC, hxI.1⟩ + exact hxI.2 hxB + +/-- A set in the partial fill includes precisely the filled disc, +provided it includes that disc at all. -/ +theorem included_disc_iff_of_subset_partial_fill + {S ι : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + {i : ι} {D : Set S} (hiD : Δ i ⊆ D) + (hDT : D ⊆ discComplement (fun j : {j // j ≠ i} => Δ j.val)) : + ∀ k, Δ k ⊆ D ↔ k = i := by + intro k + constructor + · intro hkD + by_contra hki + obtain ⟨x, hx⟩ := (hΔ k).nonempty_discInt + exact Set.disjoint_left.mp (discInt_disjoint_partial_fill hS Δ hΔ hki) + hx (hDT (hkD hx.1)) + · rintro rfl + exact hiD + +/-- Two sets in distinct partial fills cannot cover the original +surface when a third deleted disc is present. -/ +theorem union_ne_univ_of_subset_partial_fills + {S ι : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + {i j k : ι} (hki : k ≠ i) (hkj : k ≠ j) {D E : Set S} + (hDT : D ⊆ discComplement (fun l : {l // l ≠ i} => Δ l.val)) + (hET : E ⊆ discComplement (fun l : {l // l ≠ j} => Δ l.val)) : D ∪ E ≠ univ := by + intro heq + obtain ⟨x, hx⟩ := (hΔ k).nonempty_discInt + have hxDE : x ∈ D ∪ E := heq.symm ▸ mem_univ x + rcases hxDE with hxD | hxE + · exact Set.disjoint_left.mp (discInt_disjoint_partial_fill hS Δ hΔ hki) hx (hDT hxD) + · exact Set.disjoint_left.mp (discInt_disjoint_partial_fill hS Δ hΔ hkj) hx (hET hxE) + +/-- A third deleted disc makes the enclosing discs of two distinct +cuffs disjoint, even when the original surface is a sphere. -/ +theorem exists_disjoint_surrounding_discs_of_third_disc + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + {i j k : ι} (hij : i ≠ j) (hki : k ≠ i) (hkj : k ≠ j) + {F₁ F₂ : Set (discComplement Δ)} + (hF₁ : IsOArc F₁) (hF₂ : IsOArc F₂) (hFF : Disjoint F₁ F₂) + (hs₁ : GM07.SurroundsCuff F₁ (Subtype.val ⁻¹' discBd (Δ i))) + (hs₂ : GM07.SurroundsCuff F₂ (Subtype.val ⁻¹' discBd (Δ j))) : + ∃ D E : Set S, IsClosedDisc D ∧ IsClosedDisc E ∧ + discBd D = (Subtype.val : discComplement Δ → S) '' F₁ ∧ + discBd E = (Subtype.val : discComplement Δ → S) '' F₂ ∧ + (∀ l, Δ l ⊆ D ↔ l = i) ∧ (∀ l, Δ l ⊆ E ↔ l = j) ∧ Disjoint D E := by + obtain ⟨D, hD, hbD, hiD, hDT⟩ := + surrounding_bounds_disc_including_deleted_disc hS Δ hΔ hdisj i hF₁ hs₁ + obtain ⟨E, hE, hbE, hjE, hET⟩ := + surrounding_bounds_disc_including_deleted_disc hS Δ hΔ hdisj j hF₂ hs₂ + have hnoD : ¬ Δ j ⊆ D := by + intro hjD + obtain ⟨x, hx⟩ := (hΔ j).nonempty_discInt + exact Set.disjoint_left.mp (discInt_disjoint_partial_fill hS Δ hΔ hij.symm) + hx (hDT (hjD hx.1)) + have hnoE : ¬ Δ i ⊆ E := by + intro hiE + obtain ⟨x, hx⟩ := (hΔ i).nonempty_discInt + exact Set.disjoint_left.mp (discInt_disjoint_partial_fill hS Δ hΔ hij) + hx (hET (hiE hx.1)) + have hcover := union_ne_univ_of_subset_partial_fills hS Δ hΔ hki hkj hDT hET + refine ⟨D, E, hD, hE, hbD, hbE, + included_disc_iff_of_subset_partial_fill hS Δ hΔ hiD hDT, + included_disc_iff_of_subset_partial_fill hS Δ hΔ hjE hET, ?_⟩ + apply disjoint_discs_of_disjoint_boundaries_of_not_nested_of_noncover hS hD hE + · rw [hbD, hbE] + apply Set.disjoint_left.mpr + rintro x ⟨y, hy, rfl⟩ ⟨z, hz, he⟩ + exact Set.disjoint_left.mp hFF hy (Subtype.val_injective he ▸ hz) + · intro hDE + exact hnoE (hiD.trans hDE) + · intro hED + exact hnoD (hjE.trans hED) + · exact hcover + +/-- Under the topological assumption of XII (3.1), disjoint circles +surrounding distinct prescribed cuffs have disjoint enclosing discs. +This includes both the nonsphere case and the sphere with three or +more prescribed discs. -/ +theorem exists_disjoint_surrounding_discs_of_surface_condition + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Δ : ι → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + {i j : ι} (hij : i ≠ j) {F₁ F₂ : Set (discComplement Δ)} + (hF₁ : IsOArc F₁) (hF₂ : IsOArc F₂) (hFF : Disjoint F₁ F₂) + (hs₁ : GM07.SurroundsCuff F₁ (Subtype.val ⁻¹' discBd (Δ i))) + (hs₂ : GM07.SurroundsCuff F₂ (Subtype.val ⁻¹' discBd (Δ j))) : + ∃ D E : Set S, IsClosedDisc D ∧ IsClosedDisc E ∧ + discBd D = (Subtype.val : discComplement Δ → S) '' F₁ ∧ + discBd E = (Subtype.val : discComplement Δ → S) '' F₂ ∧ + (∀ l, Δ l ⊆ D ↔ l = i) ∧ (∀ l, Δ l ⊆ E ↔ l = j) ∧ Disjoint D E := by + classical + rcases hcase with hns | hthree + · exact exists_disjoint_surrounding_discs hS hns Δ hΔ hdisj hij hF₁ hF₂ hFF hs₁ hs₂ + · let := Fintype.ofFinite ι + have hthree' : 3 ≤ Fintype.card ι := by + simpa only [Nat.card_eq_fintype_card] using hthree + have hex : ∃ k : ι, k ≠ i ∧ k ≠ j := ENat.exists_ne_ne_of_three_le + (by rw [ENat.card_eq_coe_fintype_card]; exact_mod_cast hthree') i j + obtain ⟨k, hki, hkj⟩ := hex + exact exists_disjoint_surrounding_discs_of_third_disc hS Δ hΔ hdisj hij hki hkj + hF₁ hF₂ hFF hs₁ hs₂ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThreeBranchCount.lean b/LeanPool/GraphMinor/GM12/Section3ThreeBranchCount.lean new file mode 100644 index 0000000000..bf63e7456a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThreeBranchCount.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3EnclosingBranches +public import LeanPool.GraphMinor.GM12.Section3SubspaceDrawing +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs + +/-! +# The three-branch vertex bound + +Condition (iv) of XII (3.1), page 245, bounds three branches on the +sphere when their three circles surround the three prescribed cuffs. +The enclosing-disc construction excludes each opposite branch. +Inclusion preserves lines, intersections, normality and vertex counts, +so the original condition applies directly. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The vertex bound for the three-branch shape from XII (3.1)(iv), +page 245. The other two branches form each surrounding circle. -/ +theorem three_branch_vertex_count_gt + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hsphere : IsSphere S) (Γ : Drawing S) + (Δ : Fin 3 → Set S) (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hUC : Γ.U ⊆ discComplement Δ) (N : ℕ) + (hbound : IsSphere S → ∀ (P D : Fin 3 → Set S) (a b : S), a ≠ b → + Γ.IsNormal (⋃ i, P i) → (∀ i, IsLineWithEnds (P i) a b) → + (∀ i j, i ≠ j → P i ∩ P j = {a, b}) → (⋃ i, P i) ⊆ discComplement Δ → + (∀ i, IsClosedDisc (D i) ∧ + discBd (D i) = ⋃ j : {j // j ≠ i}, P j.val ∧ Δ i ⊆ D i ∧ ¬ P i ⊆ D i) → + N < (Γ.V ∩ ⋃ i, P i).ncard) + (P : Fin 3 → Set (discComplement Δ)) {a b : discComplement Δ} (hab : a ≠ b) + (hP : ∀ i, IsLineWithEnds (P i) a b) + (hcap : ∀ i j, i ≠ j → P i ∩ P j = {a, b}) + (hQ : ∀ i, IsOArc (⋃ j : {j // j ≠ i}, P j.val)) + (hs : ∀ i, GM07.SurroundsCuff (⋃ j : {j // j ≠ i}, P j.val) + (Subtype.val ⁻¹' discBd (Δ i))) + (hn : (drawingInSubspace Γ (discComplement Δ) hUC).IsNormal (⋃ i, P i)) + (hnot : ¬ GM07.IsNearPlanar (⋃ i, P i)) : + N < ((drawingInSubspace Γ (discComplement Δ) hUC).V ∩ ⋃ i, P i).ncard := by + let C := discComplement Δ + let Q : Fin 3 → Set C := fun i => ⋃ j : {j // j ≠ i}, P j.val + have hcover : ∀ i, Q i ∪ P i = ⋃ j, P j := by + intro i + ext x + constructor + · rintro (hxQ | hxP) + · obtain ⟨j, hj⟩ := mem_iUnion.mp hxQ + exact mem_iUnion.mpr ⟨j.val, hj⟩ + · exact mem_iUnion.mpr ⟨i, hxP⟩ + · intro hx + obtain ⟨j, hj⟩ := mem_iUnion.mp hx + by_cases hji : j = i + · exact Or.inr (hji ▸ hj) + · exact Or.inl (mem_iUnion.mpr ⟨⟨j, hji⟩, hj⟩) + obtain ⟨D, hD⟩ := exists_enclosing_discs_excluding_complementary_parts hS Δ hΔ hdisj + P Q hcover hQ hs hnot + let R : Fin 3 → Set S := fun i => (Subtype.val : C → S) '' P i + have hnormal := drawingInSubspace_isNormal_image Γ C hUC hn + rw [image_iUnion] at hnormal + have hcap' : ∀ i j, i ≠ j → R i ∩ R j = {a.val, b.val} := by + intro i j hij + change Subtype.val '' P i ∩ Subtype.val '' P j = _ + rw [← image_inter Subtype.val_injective, hcap i j hij, image_pair] + have hsupport : (⋃ i, R i) ⊆ C := by + intro x hx + obtain ⟨i, y, hy, rfl⟩ := mem_iUnion.mp hx + exact y.property + have hdiscs : ∀ i, IsClosedDisc (D i) ∧ + discBd (D i) = ⋃ j : {j // j ≠ i}, R j.val ∧ Δ i ⊆ D i ∧ ¬ R i ⊆ D i := by + intro i + refine ⟨(hD i).1, ?_, (hD i).2.2.1, (hD i).2.2.2⟩ + rw [(hD i).2.1] + exact image_iUnion + have hbig := hbound hsphere R D a.val b.val + (fun he => hab (Subtype.ext he)) hnormal + (fun i => isLineWithEnds_subtype_image (hP i)) hcap' hsupport hdiscs + have hcount := congrArg Set.ncard + (drawingInSubspace_image_vertices_inter Γ C hUC (⋃ i, P i)) + rw [ncard_image_of_injective _ Subtype.val_injective, image_iUnion] at hcount + rw [hcount] + exact hbig + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3ThreeDiscsForest.lean b/LeanPool/GraphMinor/GM12/Section3ThreeDiscsForest.lean new file mode 100644 index 0000000000..ccb8b007ee --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3ThreeDiscsForest.lean @@ -0,0 +1,109 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3GeometricReduction +public import LeanPool.GraphMinor.GM12.Section3ForestAlphaReduction +import LeanPool.GraphMinor.GM12.Section3CandidateExistence +public import LeanPool.GraphMinor.GM12.Section3SmallCircleConditions +public import LeanPool.GraphMinor.GM12.Section3MeetingCircleCondition +public import LeanPool.GraphMinor.GM12.Section3JoinedCircleCondition +public import LeanPool.GraphMinor.GM12.Section3ThetaCondition + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# The three-disc case with a supplied feasibility forest + +In the two-disc case of XII (3.2), page 247, add an auxiliary disc +away from the boundary-connection forest. The three-disc argument +then uses this same forest in the VII reduction. This file records +that form of the argument, using the five geometric checks already +proved for (3.2). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM14 + +universe u + +/-- The three-disc case of XII (3.2), with the forest used in the +VII (7.5) reduction supplied explicitly. -/ +theorem theorem_3_2_three_discs_of_forest + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (z : ℕ) : + ∃ η : ℕ, 1 ≤ η ∧ ∀ (Γ K : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (ins : Drawing S → Set S) (Δ r : Fin 3 → Set S) (p : ℕ) (Zs : Fin p → Set S), + GM10.IsTangle Γ.toHypergraph θ T → + (PaintingOrDrawing.drawing Γ).IsRespectful θ T → + (PaintingOrDrawing.drawing Γ).IsRadialDrawing K → + IsDerivedSlope (.drawing Γ) K θ T ins → η ≤ θ → + (∀ i, IsClosedDisc (Δ i)) → Pairwise (fun i j => Disjoint (Δ i) (Δ j)) → + (∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) → + (∀ i, r i ∈ Γ.R) → (∀ i, (r i ∩ Δ i).Nonempty) → + (∀ i j, i ≠ j → η ≤ tangleMetric Γ K ins θ (r i) (r j)) → + (∀ i, GM10.IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd (Δ i))) → + (discBoundaryVertices Γ Δ).ncard ≤ z → + (⋃ j, Zs j) = discBoundaryVertices Γ Δ → + (∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) → ∀ (H : Drawing (discComplement Δ)), + GM07.IsSurfaceForest H → + H.V ∩ bd (discComplement Δ) = Subtype.val ⁻¹' ⋃ j, Zs j → + (∀ j, ∀ x ∈ (Subtype.val : discComplement Δ → S) ⁻¹' Zs j, + ∀ y ∈ H.V ∩ bd (discComplement Δ), + Nonempty (GraphWalk H.toGraph x y) ↔ y.val ∈ Zs j) → + HasConnectingSubdrawings Γ (discBoundaryVertices Γ Δ) Zs := by + have hcase : ¬ IsSphere S ∨ 3 ≤ 3 := Or.inr le_rfl + obtain ⟨a, b, hcomplex, hmodel⟩ := exists_uniform_discComplement_model hS 3 hcase + let N := 42 * (z + 3 + 1) * GM07.vModel a b (3 + 1) (z + 3 + 1) + let η := 2 * max N z + 1 + have h2N : 2 * N < η := Nat.lt_succ_of_le (Nat.mul_le_mul_left 2 (le_max_left N z)) + have hNη : N < η := (Nat.le_mul_of_pos_left N (by decide : 0 < 2)).trans_lt h2N + have hzη : z ≤ η := (le_max_right N z).trans + ((Nat.le_mul_of_pos_left (max N z) (by decide : 0 < 2)).trans (Nat.le_succ _)) + refine ⟨η, Nat.succ_le_succ (Nat.zero_le _), ?_⟩ + intro Γ K θ T ins Δ r p Zs hT hrespect hK hd hη hΔ hdis havoid hr hrΔ hsep hfree + hcount hcover hdisZ H hHF hHB hclasses + have hcase' : ¬ IsSphere S ∨ 3 ≤ Nat.card (Fin 3) := by simpa only [Nat.card_fin] using hcase + have hbound : ∀ F : Set S, Γ.IsNormal F → IsOArc F → F ⊆ discComplement Δ → + ∀ D : Set S, IsClosedDisc D → discBd D = F → + ∀ i, (∀ j, Δ j ⊆ D ↔ j = i) → + (Γ.V ∩ discBd (Δ i)).ncard ≤ (Γ.V ∩ F).ncard := by + intro F hn hF hstar D hD hbD i hi + exact free_boundary_count_le_of_enclosing_disc hS hT hrespect hK hd hη hzη Δ r hΔ + hcase' hr hrΔ hsep hcount hfree hF hn hstar hD hbD i hi + apply connecting_subdrawings_of_alpha_bound_of_forest hS Γ Δ hΔ hdis havoid Zs + hcover hdisZ H hHF hHB hclasses hbound a b 3 z hcomplex (hmodel Δ hΔ hdis) hcount + apply Nat.le_of_lt + have hUC := drawing_support_subset_discComplement hS Γ Δ hΔ hdis havoid + apply alpha_gt_of_geometric_conditions hS Γ Δ hΔ hdis hcase hUC N + · intro F hn hF _ hsmall + exact small_circle_bounds_at_most_one_prescribed_disc hS hT hrespect hK hd hη hNη + Δ r hr hrΔ hsep hF hn hsmall + · intro A B P D E u v hn hA hB hP hu hv hPA hPB hstar hD hE hbD hbE hDE hi hj + exact joined_circle_vertex_count_gt hS hT hrespect hK hd hη Δ r hΔ hcase' hr hrΔ hsep + h2N hn hA hB hP hu hv hPA hPB hstar hD hE hbD hbE hDE hi hj + · intro A B D E hn hA hB hstar hD hE hbD hbE hcap hi hj + exact meeting_circle_vertex_count_gt hS hT hrespect hK hd hη Δ r hΔ hcase' hr hrΔ hsep + h2N hn hA hB hstar hD hE hbD hbE hcap hi hj + · intro ht _ P D a b _ hn hP hPP hstar hDs + apply theta_vertex_count_gt hS hT hrespect hK hd hη Δ r hΔ hr hrΔ hsep hNη P D + hn hP hPP hstar (fun i => (hDs i).1) (fun i => (hDs i).2.1) + · intro i + have hcast : Fin.cast ht.symm i = i := Fin.ext rfl + simpa only [hcast] using (hDs i).2.2.1 + · exact fun i => (hDs i).2.2.2 + · exact exists_alphaCandidate_in_discComplement hS (by decide : 3 ≠ 0) + hcase Γ Δ hΔ hdis havoid + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3TwoCircleCuffs.lean b/LeanPool/GraphMinor/GM12/Section3TwoCircleCuffs.lean new file mode 100644 index 0000000000..3b843c88c9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3TwoCircleCuffs.lean @@ -0,0 +1,100 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SolidPlanarity +import LeanPool.GraphMinor.GM12.Section3PlanarityMaps + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Cuff labels for shapes with two circles + +For the first two schismatic shapes in VII Section 8, used by XII +(3.1), page 245, every circle lies in one of two distinguished loops. +If both loops are planar in the same cap, VII (5.1) makes the whole +solid shape planar in that cap. Minimality makes the two loops +near-planar. Neither can be planar, and their surrounding cuffs must +be distinct, since either possibility would make the whole shape +near-planar. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +universe u + +/-- If every circle in a solid set lies in one of two sets, planarity +of those sets in one cap makes the whole solid set planar there. -/ +theorem planarInCappedCuff_of_two_circle_cover + {S : Type u} [TopologicalSpace S] [ConnectedSpace S] (hS : IsSurface S) + {X F A C : Set S} (hX : IsSolid X) + (hcover : ∀ Z : Set S, IsOArc Z → Z ⊆ X → Z ⊆ F ∨ Z ⊆ A) + (hpF : GM07.IsPlanarInCappedCuff C F) (hpA : GM07.IsPlanarInCappedCuff C A) : + GM07.IsPlanarInCappedCuff C X := by + obtain ⟨T, tT, j, D, hcap⟩ := exists_cappedCuff hS hpF.1 + let := tT + apply planarInCappedCuff_of_all_subcircles hS hcap hX + intro Z hZ hZX + rcases hcover Z hZ hZX with hZF | hZA + · exact isPlanarInCappedCuff_mono hZF hpF + · exact isPlanarInCappedCuff_mono hZA hpA + +/-- A non-near-planar solid set covered by two circle types cannot +have one type planar when the other is near-planar. -/ +theorem not_planar_of_two_circle_cover + {S : Type u} [TopologicalSpace S] [ConnectedSpace S] (hS : IsSurface S) + (hcuffs : (cuffs S).Nonempty) {X F A : Set S} (hX : IsSolid X) + (hcover : ∀ Z : Set S, IsOArc Z → Z ⊆ X → Z ⊆ F ∨ Z ⊆ A) + (hnot : ¬ GM07.IsNearPlanar X) (hnA : GM07.IsNearPlanar A) : ¬ IsPlanar F := by + intro hpF + have hex : ∃ C, GM07.IsPlanarInCappedCuff C A := by + rcases hnA with hpA | ⟨C, _, hpA⟩ + · obtain ⟨C, hC⟩ := hcuffs + exact ⟨C, isPlanarInCappedCuff_of_isPlanar hS hC hpA⟩ + · exact ⟨C, hpA⟩ + obtain ⟨C, hpA⟩ := hex + have hpFC := isPlanarInCappedCuff_of_isPlanar hS hpA.1 hpF + have hpX := planarInCappedCuff_of_two_circle_cover hS hX hcover hpFC hpA + exact hnot (Or.inr ⟨C, hpX.1, hpX⟩) + +/-- Two proper distinguished loops containing all circles of a +schismatic shape surround distinct cuffs. This supplies the common +argument for VII Section 8's first two shapes, page 241. -/ +theorem surrounding_cuffs_of_two_circle_cover + {S : Type u} [TopologicalSpace S] [ConnectedSpace S] (hS : IsSurface S) + (hcuffs : (cuffs S).Nonempty) {X F A : Set S} (hsolid : IsSolid X) + (hF : IsOArc F) (hA : IsOArc A) (hFX : F ⊂ X) (hAX : A ⊂ X) + (hcover : ∀ Z : Set S, IsOArc Z → Z ⊆ X → Z ⊆ F ∨ Z ⊆ A) + (hX : GM07.IsSchismatic X) : + ∃ C D : Set S, GM07.SurroundsCuff F C ∧ GM07.SurroundsCuff A D ∧ C ≠ D := by + have hnF := hX.2.2 F hF hFX + have hnA := hX.2.2 A hA hAX + have hnpF := not_planar_of_two_circle_cover hS hcuffs hsolid hcover hX.2.1 hnA + have hnpA := not_planar_of_two_circle_cover hS hcuffs hsolid + (fun Z hZ hZX => (hcover Z hZ hZX).symm) hX.2.1 hnF + obtain ⟨C, hC, hpF⟩ : ∃ C, C ∈ cuffs S ∧ GM07.IsPlanarInCappedCuff C F := by + rcases hnF with hp | ⟨C, hC, hp⟩ + · exact (hnpF hp).elim + · exact ⟨C, hC, hp⟩ + obtain ⟨D, hD, hpA⟩ : ∃ D, D ∈ cuffs S ∧ GM07.IsPlanarInCappedCuff D A := by + rcases hnA with hp | ⟨D, hD, hp⟩ + · exact (hnpA hp).elim + · exact ⟨D, hD, hp⟩ + refine ⟨C, D, ⟨hC, hpF, hnpF⟩, ⟨hD, hpA, hnpA⟩, ?_⟩ + intro heq + subst D + have hpX := planarInCappedCuff_of_two_circle_cover hS hsolid hcover hpF hpA + exact hX.2.1 (Or.inr ⟨C, hpX.1, hpX⟩) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3TwoCuffCandidate.lean b/LeanPool/GraphMinor/GM12/Section3TwoCuffCandidate.lean new file mode 100644 index 0000000000..af98befc8a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3TwoCuffCandidate.lean @@ -0,0 +1,122 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3CuffSurrounds +public import LeanPool.GraphMinor.GM12.Section3SubspaceDrawing +import LeanPool.GraphMinor.GM12.Section3NormalPuncturedPaths +import LeanPool.GraphMinor.GM12.Section3SolidUnion +import LeanPool.GraphMinor.GM12.Section3FiniteGraphSolid +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs +import LeanPool.GraphMinor.GM12.Section3PuncturedSurface +import LeanPool.GraphMinor.Surface.ArcInPath +import LeanPool.GraphMinor.GM11.RadialChord +import Mathlib.Analysis.Convex.Contractible + +/-! +# An alpha candidate joining two prescribed cuffs + +For the minimum-existence step used by XII (3.1), page 245, choose +one point on each of two distinct prescribed cuffs. A normal path in +the punctured surface joins them. Erasing repeated portions gives a +normal line there. Its union with the two cuffs is solid and connected, +and cannot be near-planar because the two cuff circles surround +distinct cuffs. This gives an actual alpha candidate. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +private theorem connected_oArc + {S : Type*} [TopologicalSpace S] {F : Set S} (hF : IsOArc F) : IsConnected F := by + obtain ⟨e⟩ := hF + let : PathConnectedSpace F := e.pathConnectedSpace + exact (isPathConnected_iff_pathConnectedSpace.mpr inferInstance).isConnected + +/-- Two distinct prescribed cuffs supply a normal solid connected +set which is not near-planar, for any drawing in the setup of XII (3.1). -/ +theorem exists_alphaCandidate_of_two_prescribed_cuffs + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) + (havoid : ∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) + {i j : ι} (hij : i ≠ j) : + ∃ X, GM07.IsAlphaCandidate (drawingInSubspace Γ (discComplement Δ) + (drawing_support_subset_discComplement hS Γ Δ hΔ hdisj havoid)) X := by + classical + let C := discComplement Δ + have hsurf := discComplement_isSurface hS Δ hΔ hdisj + let : CompactSpace C := hsurf.1 + let F : ι → Set C := fun k => Subtype.val ⁻¹' discBd (Δ k) + have hF : ∀ k, IsOArc (F k) := fun k => isOArc_subtype_preimage + (disc_boundary_subset_discComplement hS Δ hΔ hdisj k) (hΔ k).isOArc_discBd + obtain ⟨e⟩ := hF i + obtain ⟨f⟩ := hF j + let x : C := (e 1).val + let y : C := (f 1).val + have hx : x ∈ F i := (e 1).property + have hy : y ∈ F j := (f 1).property + have hxy : x.val ≠ y.val := by + intro heq + exact disjoint_left.mp (hdisj hij) (Surface.discBd_subset (Δ i) hx) + (heq.symm ▸ Surface.discBd_subset (Δ j) hy) + have hboundaryN : ∀ k, discBd (Δ k) ⊆ Γ.Uᶜ ∪ Γ.V := by + intro k z hz + by_cases hzU : z ∈ Γ.U + · exact Or.inr ((havoid k ▸ (show z ∈ Γ.U ∩ Δ k from + ⟨hzU, Surface.discBd_subset (Δ k) hz⟩)).1) + · exact Or.inl hzU + obtain ⟨q, hqC, hqN⟩ := exists_normal_path_in_discComplement hS Γ Δ hΔ hdisj havoid + x.property y.property (hboundaryN i hx) (hboundaryN j hy) + obtain ⟨g, hgc, hgi, hg0, hg1, hgq⟩ := exists_arc_of_path q.continuous + (by rw [q.source, q.target]; exact hxy) + have hgC : range g ⊆ C := hgq.trans hqC + let gC : unitInterval → C := fun t => ⟨g t, hgC (mem_range_self t)⟩ + have hgCc : Continuous gC := hgc.subtype_mk _ + have hgCi : Function.Injective gC := fun a b he => hgi (congrArg Subtype.val he) + have hL : IsLineWithEnds (range gC) x y := by + have h := isLine_range hgCc hgCi + have h0 : gC 0 = x := Subtype.ext (hg0.trans q.source) + have h1 : gC 1 = y := Subtype.ext (hg1.trans q.target) + rwa [h0, h1] at h + have hLL : IsLine (range gC) := ⟨hL.choose⟩ + have hLconn : IsConnected (range gC) := isConnected_range hgCc + let X := F i ∪ range gC ∪ F j + have hsolid : IsSolid X := isSolid_union + (isSolid_union (isSolid_oArc (hF i)) (isSolid_line hLL)) (isSolid_oArc (hF j)) + have hconn : IsConnected X := + ((connected_oArc (hF i)).union ⟨x, hx, hL.left_mem⟩ hLconn).union + ⟨y, Or.inr hL.right_mem, hy⟩ (connected_oArc (hF j)) + have hUC := drawing_support_subset_discComplement hS Γ Δ hΔ hdisj havoid + have hnormal : (drawingInSubspace Γ C hUC).IsNormal X := by + rintro z ⟨(hzF | hzL) | hzF, hzU⟩ + · rw [drawingInSubspace_U] at hzU + rw [drawingInSubspace_V] + exact ((havoid i ▸ (show z.val ∈ Γ.U ∩ Δ i from + ⟨hzU, Surface.discBd_subset (Δ i) hzF⟩)).1) + · rw [drawingInSubspace_U] at hzU + rw [drawingInSubspace_V] + obtain ⟨t, rfl⟩ := hzL + exact hqN ⟨hgq (mem_range_self t), hzU⟩ + · rw [drawingInSubspace_U] at hzU + rw [drawingInSubspace_V] + exact ((havoid j ▸ (show z.val ∈ Γ.U ∩ Δ j from + ⟨hzU, Surface.discBd_subset (Δ j) hzF⟩)).1) + refine ⟨X, hsolid, hconn, hnormal, ?_⟩ + exact not_isNearPlanar_of_distinct_surrounding_subcircles hS Δ hΔ hdisj hcase hij + (hF i) (hF j) (subset_union_left.trans subset_union_left) subset_union_right + (surroundsCuff_prescribed_boundary hS Δ hΔ hdisj hcase i) + (surroundsCuff_prescribed_boundary hS Δ hΔ hdisj hcase j) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3TwoDiscs.lean b/LeanPool/GraphMinor/GM12/Section3TwoDiscs.lean new file mode 100644 index 0000000000..e5bf24492b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3TwoDiscs.lean @@ -0,0 +1,166 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ThreeDiscsForest +public import LeanPool.GraphMinor.GM12.Section3IntermediateRegion +import LeanPool.GraphMinor.GM12.Section3AmbientFeasibilityForest +import LeanPool.GraphMinor.GM12.Section3AuxiliaryDisc +import LeanPool.GraphMinor.GM12.Section3PuncturedForest +import LeanPool.GraphMinor.GM12.Section3EmptyBoundaryDisc +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM10.Section12 +import Mathlib.Tactic.FinCases + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# The two-disc case of XII (3.2) + +Choose the three-disc threshold and double it, then add one. +The intermediate-region lemma finds a region separated from both +prescribed regions by the original threshold. Draw the feasibility +forest first and place an auxiliary disc in that region away from +the forest. The new disc has no drawing vertices on its boundary. +The same forest retains its boundary connections, so the proved +three-disc case gives the required connected subdrawings. This is +the argument on page 247, with the auxiliary-disc avoidance made +explicit. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM14 + +universe u + +/-- Graph Minors XII (3.2), page 247, for two prescribed discs. +The two prescribed regions are displayed explicitly. -/ +theorem theorem_3_2_two_discs + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (z : ℕ) : + ∃ η : ℕ, 1 ≤ η ∧ ∀ (Γ : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (Δ r : Fin 2 → Set S) (p : ℕ) (Zs : Fin p → Set S), + HasTangleMetric Γ θ T d → η ≤ θ → + (∀ i, IsClosedDisc (Δ i)) → Pairwise (fun i j => Disjoint (Δ i) (Δ j)) → + (∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) → + (∀ i, r i ∈ Γ.R) → (∀ i, (r i ∩ Δ i).Nonempty) → + (∀ i j, i ≠ j → η ≤ d (r i) (r j)) → + (∀ i, GM10.IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd (Δ i))) → + (discBoundaryVertices Γ Δ).ncard ≤ z → + (⋃ j, Zs j) = discBoundaryVertices Γ Δ → + (∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) → IsTopologicallyFeasible Δ Zs → + HasConnectingSubdrawings Γ (discBoundaryVertices Γ Δ) Zs := by + obtain ⟨η', hη'pos, hthree⟩ := theorem_3_2_three_discs_of_forest hS z + refine ⟨2 * η' + 1, Nat.succ_le_succ (Nat.zero_le _), ?_⟩ + intro Γ θ T d Δ r p Zs hm horder hΔ hdis havoid hr hrΔ hsep hfree hcount hcover hdisZ hfeasible + have hfar := hsep 0 1 (by decide) + obtain ⟨q, hq, hq0, _, hq1⟩ := exists_intermediate_region hS hm hη'pos (hr 0) (hr 1) hfar + have hqfar : ∀ i : Fin 2, η' ≤ d (r i) q := by + intro i + fin_cases i + · exact hq0 + · exact hq1 + have h91 := GM11.gm15_theorem_9_1 Γ θ T d hS inferInstance hm + have hqne : ∀ i, q ≠ r i := by + intro i heq + have h := hqfar i + rw [heq, h91.2.1 (r i) (Or.inr (hr i))] at h + exact (Nat.not_succ_le_zero _ (hη'pos.trans h)) + have hZV : ∀ j, Zs j ⊆ Γ.V := by + intro j x hx + have hxZ : x ∈ discBoundaryVertices Γ Δ := hcover.subset (mem_iUnion.mpr ⟨j, hx⟩) + obtain ⟨i, hi⟩ := mem_iUnion.mp hxZ + exact hi.1 + have hZbd : ∀ j, Zs j ⊆ ⋃ i, discBd (Δ i) := by + intro j x hx + have hxZ : x ∈ discBoundaryVertices Γ Δ := hcover.subset (mem_iUnion.mpr ⟨j, hx⟩) + obtain ⟨i, hi⟩ := mem_iUnion.mp hxZ + exact mem_iUnion.mpr ⟨i, hi.2⟩ + obtain ⟨F, hFF, hFU, hFV, hFclasses⟩ := exists_ambient_feasibility_forest hS Δ hΔ hdis Zs + (fun j => Γ.finite_V.subset (hZV j)) hZbd hfeasible + obtain ⟨E, hE, hEq, hEU, hEF, hED⟩ := exists_auxiliary_disc_in_region hS Γ F Δ r hΔ + havoid hr hrΔ hq hqne + let Δ' : Fin 3 → Set S := Fin.cons E Δ + let r' : Fin 3 → Set S := Fin.cons q r + have hΔ' : ∀ i, IsClosedDisc (Δ' i) := Fin.forall_fin_succ.mpr ⟨hE, hΔ⟩ + have hdis' : Pairwise (fun i j => Disjoint (Δ' i) (Δ' j)) := by + intro i j + refine Fin.cases ?_ (fun i => ?_) i + · refine Fin.cases ?_ (fun j => ?_) j + · intro hij + exact False.elim (hij rfl) + · intro _ + exact hED j + · refine Fin.cases ?_ (fun j => ?_) j + · intro _ + exact (hED i).symm + · intro hij + exact hdis (fun he => hij (congrArg Fin.succ he)) + have hVE : Γ.V ∩ discBd E = ∅ := boundary_vertices_eq_empty_of_disc_disjoint Γ hEU + have havoid' : ∀ i, Γ.U ∩ Δ' i = Γ.V ∩ discBd (Δ' i) := by + refine Fin.forall_fin_succ.mpr ⟨?_, havoid⟩ + exact hEU.symm.inter_eq.trans hVE.symm + have hr' : ∀ i, r' i ∈ Γ.R := Fin.forall_fin_succ.mpr ⟨hq, hr⟩ + have hrΔ' : ∀ i, (r' i ∩ Δ' i).Nonempty := by + refine Fin.forall_fin_succ.mpr ⟨?_, hrΔ⟩ + obtain ⟨x, hx⟩ := hE.nonempty_discInt + exact ⟨x, hEq hx.1, hx.1⟩ + have hsep' : ∀ i j, i ≠ j → η' ≤ d (r' i) (r' j) := by + intro i j + refine Fin.cases ?_ (fun i => ?_) i + · refine Fin.cases ?_ (fun j => ?_) j + · intro hij + exact False.elim (hij rfl) + · intro _ + change η' ≤ d q (r j) + rw [h91.2.2.2.1 q (Or.inr hq) (r j) (Or.inr (hr j))] + exact hqfar j + · refine Fin.cases ?_ (fun j => ?_) j + · intro _ + exact hqfar i + · intro hij + change η' ≤ d (r i) (r j) + exact (Nat.le_add_right η' η' |>.trans (Nat.le_succ _)).trans + (by simpa only [two_mul] using hsep i j (fun he => hij (congrArg Fin.succ he))) + have hfree' : ∀ i, GM10.IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd (Δ' i)) := by + refine Fin.forall_fin_succ.mpr ⟨?_, hfree⟩ + change GM10.IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd E) + rw [hVE] + exact GM10.isFreeSet_empty _ _ _ + have hZeq : discBoundaryVertices Γ Δ' = discBoundaryVertices Γ Δ := + discBoundaryVertices_fin_cons_of_disjoint Γ Δ hEU + have hcontacts := drawing_contact_fin_cons_of_disjoint F Δ hEF + have hZbd' : (⋃ j, Zs j) ⊆ ⋃ i, discBd (Δ' i) := by + intro x hx + obtain ⟨j, hj⟩ := mem_iUnion.mp hx + obtain ⟨i, hi⟩ := mem_iUnion.mp (hZbd j hj) + exact mem_iUnion.mpr ⟨i.succ, hi⟩ + have hclasses' : ∀ j, ∀ x ∈ Zs j, ∀ y ∈ F.V ∩ ⋃ i, Δ' i, + Nonempty (GraphWalk F.toGraph x y) ↔ y ∈ Zs j := by + intro j x hx y hy + exact hFclasses j x hx y (hcontacts.2.subset hy) + obtain ⟨H, hHF, hHB, hclasses⟩ := exists_punctured_forest_of_ambient hS Δ' hΔ' hdis' Zs F hFF + (hcontacts.1.trans hFU) (hcontacts.2.trans hFV) hZbd' hclasses' + obtain ⟨hT, K, ins, hK, hd, heq⟩ := hm + have hsepmetric : ∀ i j, i ≠ j → η' ≤ tangleMetric Γ K ins θ (r' i) (r' j) := by + intro i j hij + rw [← heq (r' i) (Or.inr (hr' i)) (r' j) (Or.inr (hr' j))] + exact hsep' i j hij + have hηorder : η' ≤ θ := (Nat.le_add_right η' η' |>.trans (Nat.le_succ _)).trans + (by simpa only [two_mul] using horder) + have hresult := hthree Γ K θ T ins Δ' r' p Zs hT.2.1 hT.2.2 hK hd hηorder hΔ' hdis' havoid' + hr' hrΔ' hsepmetric hfree' (hZeq ▸ hcount) (hcover.trans hZeq.symm) hdisZ H hHF hHB hclasses + rwa [hZeq] at hresult + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3TwoLoopCount.lean b/LeanPool/GraphMinor/GM12/Section3TwoLoopCount.lean new file mode 100644 index 0000000000..ea95929d3f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3TwoLoopCount.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3ThirdDisc +public import LeanPool.GraphMinor.GM12.Section3SubspaceDrawing +import LeanPool.GraphMinor.GM12.Section3SubspaceArcs + +/-! +# The two-loop vertex bound + +Condition (ii) of XII (3.1), page 245, applies to two disjoint circles +and a joining line. When the circles surround distinct cuffs, the +preceding disc construction gives disjoint enclosing discs, each +including exactly one prescribed disc. Inclusion preserves the line, +its ends, normality and the vertex count, so condition (ii) gives the +required bound for this shape. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Topology + +/-- The vertex bound for two disjoint surrounding circles joined by +a line, the first two-loop shape in the reduction of XII (3.1). The +ambient hypothesis is condition (ii), with the enclosing discs and +line endpoints written explicitly. -/ +theorem two_loop_vertex_count_gt + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (Γ : Drawing S) (Δ : ι → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hcase : ¬ IsSphere S ∨ 3 ≤ Nat.card ι) (hUC : Γ.U ⊆ discComplement Δ) + (N : ℕ) + (hbound : ∀ (A B P D E : Set S) (u v : S), + Γ.IsNormal (A ∪ B ∪ P) → IsOArc A → IsOArc B → IsLineWithEnds P u v → + u ∈ A → v ∈ B → P ∩ A = {u} → P ∩ B = {v} → + A ∪ B ∪ P ⊆ discComplement Δ → IsClosedDisc D → IsClosedDisc E → + discBd D = A → discBd E = B → Disjoint D E → + (∃ i, ∀ l, Δ l ⊆ D ↔ l = i) → (∃ j, ∀ l, Δ l ⊆ E ↔ l = j) → + N < (Γ.V ∩ (A ∪ B ∪ P)).ncard) + {i j : ι} (hij : i ≠ j) + {F₁ F₂ P : Set (discComplement Δ)} {u v : discComplement Δ} + (hF₁ : IsOArc F₁) (hF₂ : IsOArc F₂) (hFF : Disjoint F₁ F₂) + (hP : IsLineWithEnds P u v) (hu : u ∈ F₁) (hv : v ∈ F₂) + (hP₁ : P ∩ F₁ = {u}) (hP₂ : P ∩ F₂ = {v}) + (hs₁ : GM07.SurroundsCuff F₁ (Subtype.val ⁻¹' discBd (Δ i))) + (hs₂ : GM07.SurroundsCuff F₂ (Subtype.val ⁻¹' discBd (Δ j))) + (hn : (drawingInSubspace Γ (discComplement Δ) hUC).IsNormal (F₁ ∪ F₂ ∪ P)) : + N < ((drawingInSubspace Γ (discComplement Δ) hUC).V ∩ (F₁ ∪ F₂ ∪ P)).ncard := by + let C := discComplement Δ + let a : C → S := Subtype.val + obtain ⟨D, E, hD, hE, hbD, hbE, honeD, honeE, hDE⟩ := + exists_disjoint_surrounding_discs_of_surface_condition hS Δ hΔ hdisj hcase + hij hF₁ hF₂ hFF hs₁ hs₂ + have hA : IsOArc (a '' F₁) := by + obtain ⟨φ⟩ := hF₁ + exact ⟨φ.trans (IsEmbedding.subtypeVal.homeomorphImage F₁)⟩ + have hB : IsOArc (a '' F₂) := by + obtain ⟨φ⟩ := hF₂ + exact ⟨φ.trans (IsEmbedding.subtypeVal.homeomorphImage F₂)⟩ + have hnormal := drawingInSubspace_isNormal_image Γ C hUC hn + rw [image_union, image_union] at hnormal + have hPA : a '' P ∩ a '' F₁ = {u.val} := by + rw [← image_inter Subtype.val_injective, hP₁, image_singleton] + have hPB : a '' P ∩ a '' F₂ = {v.val} := by + rw [← image_inter Subtype.val_injective, hP₂, image_singleton] + have hsupport : a '' F₁ ∪ a '' F₂ ∪ a '' P ⊆ C := by + rintro x ((⟨y, _, rfl⟩ | ⟨y, _, rfl⟩) | ⟨y, _, rfl⟩) <;> exact y.property + have hbig := hbound (a '' F₁) (a '' F₂) (a '' P) D E u.val v.val + hnormal hA hB (isLineWithEnds_subtype_image hP) + (mem_image_of_mem a hu) (mem_image_of_mem a hv) hPA hPB hsupport + hD hE hbD hbE hDE ⟨i, honeD⟩ ⟨j, honeE⟩ + have hcount := congrArg Set.ncard + (drawingInSubspace_image_vertices_inter Γ C hUC (F₁ ∪ F₂ ∪ P)) + rw [ncard_image_of_injective _ Subtype.val_injective, image_union, image_union] at hcount + rw [hcount] + exact hbig + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3UniformAlphaReduction.lean b/LeanPool/GraphMinor/GM12/Section3UniformAlphaReduction.lean new file mode 100644 index 0000000000..939f406f8f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3UniformAlphaReduction.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3AlphaEmptyClasses +public import LeanPool.GraphMinor.GM12.Section3ModelComplexity + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# A uniform alpha threshold for the connecting subdrawings + +The application of VII in XII (3.1), page 245, chooses its threshold +from the fixed surface, the number of deleted discs and the boundary +vertex bound. The punctured surface has fixed model parameters, so +VII's numerical threshold is independent of the drawing and of the +disc placement. The alpha estimate is the remaining input here. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +universe u + +/-- The uniform numerical choice in the application of VII (7.5) for +XII (3.1). All model, complexity, forest and boundary-linkage requirements +are discharged. Only the alpha bound remains as a hypothesis. -/ +theorem exists_uniform_connecting_alpha_threshold + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (t z : ℕ) (hcase : ¬ IsSphere S ∨ 3 ≤ t) : + ∃ N : ℕ, ∀ (Γ : Drawing S) (Δ : Fin t → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (havoid : ∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i)) + (p : ℕ) (Zs : Fin p → Set S), + (⋃ j, Zs j) = discBoundaryVertices Γ Δ → + (∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) → + IsTopologicallyFeasible Δ Zs → + (∀ F : Set S, Γ.IsNormal F → IsOArc F → F ⊆ discComplement Δ → + ∀ D : Set S, IsClosedDisc D → discBd D = F → + ∀ i, (∀ j, Δ j ⊆ D ↔ j = i) → + (Γ.V ∩ discBd (Δ i)).ncard ≤ (Γ.V ∩ F).ncard) → + (discBoundaryVertices Γ Δ).ncard ≤ z → + N ≤ GM07.alpha (drawingInSubspace Γ (discComplement Δ) + (drawing_support_subset_discComplement hS Γ Δ hΔ hdisj havoid)) → + HasConnectingSubdrawings Γ (discBoundaryVertices Γ Δ) Zs := by + obtain ⟨a, b, hcomplex, hmodel⟩ := exists_uniform_discComplement_model hS t hcase + refine ⟨42 * (z + t + 1) * GM07.vModel a b (t + 1) (z + t + 1), ?_⟩ + intro Γ Δ hΔ hd ha p Zs hcover hdisZ hfeasible hbound hcount hα + exact connecting_subdrawings_of_alpha_bound_allowing_empty hS Γ Δ hΔ hd ha Zs + hcover hdisZ hfeasible hbound a b t z hcomplex (hmodel Δ hΔ hd) hcount hα + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3UnselectedBoundary.lean b/LeanPool/GraphMinor/GM12/Section3UnselectedBoundary.lean new file mode 100644 index 0000000000..14309ecc00 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3UnselectedBoundary.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.Theorem61 + +/-! +# A free set outside an unselected disc bounds its boundary + +For the one-disc sphere case of XII (3.2), pages 247--248, take a +disc which is not a small side of the tangle. If its boundary has +at least the tangle order, the free-set size bound suffices. Otherwise +the first tangle axiom selects the reverse separation. Freeness of +the prescribed vertices on that reverse side bounds them by the +separation order, which is at most the boundary vertex count. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM10 GM11 Hypergraph + +/-- The unselected-side counting step in the one-disc case of +Graph Minors XII (3.2), pages 247--248. -/ +theorem free_set_card_le_frontier_of_not_selected + {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GM10.IsTangle Γ.toHypergraph θ T) {Z D : Set S} + (hfree : IsFreeSet Γ.toHypergraph T θ Z) (hD : IsClosed D) + (hn : Γ.IsNormal (frontier D)) + (hZ : Z ⊆ closure (univ \ D)) + (hnot : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∉ T) : + Z.ncard ≤ (Γ.V ∩ frontier D).ncard := by + let G : PaintingOrDrawing S := .drawing Γ + have hord : separationOrder (G.inter D) (G.interOutside D) ≤ (Γ.V ∩ frontier D).ncard := by + apply Set.ncard_le_ncard ?_ (Γ.finite_V.subset inter_subset_left) + intro x hx + have h := inter_outside_subset hx + exact ⟨h.2, h.1⟩ + by_cases hlong : θ ≤ (Γ.V ∩ frontier D).ncard + · exact hfree.2.1.trans hlong + · have hshort : separationOrder (G.inter D) (G.interOutside D) < θ := + hord.trans_lt (Nat.lt_of_not_ge hlong) + have hsep := isSeparation_inter (Γ := G) hD hn + have hm := (hT.axiom1 hsep hshort).resolve_left hnot + have hZB : Z ⊆ (G.interOutside D).vertexSet := fun x hx => ⟨hfree.1 hx, hZ hx⟩ + have hbound := hfree.2.2 hm hZB + rw [separationOrder_comm] at hbound + exact hbound.trans hord + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section3VIConnections.lean b/LeanPool/GraphMinor/GM12/Section3VIConnections.lean new file mode 100644 index 0000000000..60d35eea47 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section3VIConnections.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section3SubgraphDrawing +public import LeanPool.GraphMinor.GM06.Defs +import LeanPool.GraphMinor.GM06.Section3Basic + +/-! +# Returning a VI realization as connected subdrawings + +The application of VI (3.6) in XII (3.2), page 247, supplies a +forest realization of the boundary partition. Each part belongs +to its own graph component. Read those components as subdrawings. +Their vertex sets are disjoint, and a component meets the full +prescribed vertex set exactly in its own part. Thus the realization +has precisely the connected-subdrawing conclusion of XII. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM06 Graph + +/-- A VI realization of nonempty disjoint partition parts gives +the connecting subdrawings required in XII (3.2), page 247. -/ +theorem hasConnectingSubdrawings_of_vi_feasible + {S : Type*} [TopologicalSpace S] [T1Space S] (Γ : Drawing S) {p : ℕ} + (Zs : Fin p → Set S) (hne : ∀ i, (Zs i).Nonempty) + (hdis : ∀ i j, i ≠ j → Disjoint (Zs i) (Zs j)) + (hf : GM06.IsFeasible Γ.toGraph (range Zs)) : + HasConnectingSubdrawings Γ (⋃ j, Zs j) Zs := by + obtain ⟨H, _, _, hHG, _, C, hCin, hC, _⟩ := hf + have hZmem : ∀ j, Zs j ∈ range Zs := fun j => mem_range_self j + have hZne : ∀ i j, i ≠ j → Zs i ≠ Zs j := by + intro i j hij heq + obtain ⟨x, hx⟩ := hne i + exact Set.disjoint_left.mp (hdis i j hij) hx (heq ▸ hx) + have hCne : ∀ i j, i ≠ j → C (Zs i) ≠ C (Zs j) := + fun i j hij heq => hZne i j hij (hCin (hZmem i) (hZmem j) heq) + have hex : ∀ j, ∃ D : Drawing S, D.IsSubdrawing Γ ∧ D.V = (C (Zs j)).vertexSet ∧ + D.toGraph = C (Zs j) := fun j => exists_subdrawing_of_subgraph Γ (C (Zs j)) + ((hC (Zs j) (hZmem j)).1.1.trans hHG) + choose D hsub hV hG using hex + refine ⟨D, hsub, ?_, ?_, ?_⟩ + · intro j x hx y hy + rw [hV] at hx hy + have hconn := (hC (Zs j) (hZmem j)).1.2.1.2 x hx y hy + change Nonempty (GraphWalk (D j).toGraph x y) + rw [hG] + exact hconn + · intro i j hij + rw [hV, hV] + exact (hC (Zs i) (hZmem i)).1.disjoint_vertexSet_of_ne + (hC (Zs j) (hZmem j)).1 (hCne i j hij) + · intro j + ext x + constructor + · rintro ⟨hxD, hxZ⟩ + obtain ⟨i, hxi⟩ := mem_iUnion.mp hxZ + by_cases hij : i = j + · exact hij ▸ hxi + · have hxCi := (hC (Zs i) (hZmem i)).2 hxi + have hxCj : x ∈ (C (Zs j)).vertexSet := hV j ▸ hxD + exact False.elim (Set.disjoint_left.mp + ((hC (Zs i) (hZmem i)).1.disjoint_vertexSet_of_ne + (hC (Zs j) (hZmem j)).1 (hCne i j hij)) hxCi hxCj) + · intro hx + exact ⟨(hV j).symm ▸ (hC (Zs j) (hZmem j)).2 hx, mem_iUnion.mpr ⟨j, hx⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4.lean b/LeanPool/GraphMinor/GM12/Section4.lean new file mode 100644 index 0000000000..dc124c33c4 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM12.Section1 +import LeanPool.GraphMinor.GM12.Section4Distance +import LeanPool.GraphMinor.GM12.Section4Separation +import LeanPool.GraphMinor.GM12.Section4PathFacts +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# Graph Minors XII, (4.1): paths on a small side + +Move the path edges to the small side using X (2.9). By XII (1.1), each +edge is enclosed by a short radial circuit whose original vertices lie +in the separator. Their closed insides cover the nontrivial path. +The circuit-chain calculation bounds the distance by twice the separator +size. The zero-length case follows from the metric's value on the diagonal. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM10 GM11 GM14 Hypergraph + +universe u + +/-- Graph Minors XII, (4.1), page 248. A path whose vertices lie on a +small side has endpoint distance at most twice the separation order. -/ +theorem theorem_4_1_proof {S : Type u} [TopologicalSpace S] [T2Space S] + (Γ P : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (A B : Hypergraph S (Set S)) (u v : S) + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + (hMetric : HasTangleMetric Γ θ T d) + (hu : u ∈ Γ.V) (hv : v ∈ Γ.V) + (hP : P.IsPathBetween u v) (hPs : P.IsSubdrawing Γ) + (hAB : (A, B) ∈ T) (hPV : P.V ⊆ A.vertexSet) : + d {u} {v} ≤ 2 * separationOrder A B := by + classical + let : ConnectedSpace S := hConn + by_cases huv : u = v + · subst v + rw [metric_self hMetric (Or.inl (Or.inl ⟨u, hu, rfl⟩))] + exact Nat.zero_le _ + obtain ⟨hResp, K, ins, hK, hd, heq⟩ := hMetric + have hE : Γ.E.Nonempty := by + obtain ⟨W, _, _, hPE⟩ := hP + cases W with + | nil _ => exact (huv rfl).elim + | @cons a b c e h r => + exact ⟨e, hPs.2 (hPE ▸ List.mem_cons_self)⟩ + have hmove := tangle_move_subhypergraph hResp.2.1 hAB + (subdrawing_toHypergraph_le hPs) hPV + let A' := A ∪ P.toHypergraph + let B' := B.deleteEdges P.E + have hm : (A', B') ∈ T := hmove.1 + have horder : separationOrder A' B' = separationOrder A B := hmove.2 + have hcircuits := (theorem_1_1_proof hS hResp hE hK hd + (hResp.2.1.isSeparation hm) (hResp.2.1.order_lt hm)).mp hm + have hex : ∀ e : P.E, ∃ C : Drawing S, + C.IsCircuit ∧ C.IsSubdrawing K ∧ C.length < 2 * θ ∧ + C.V ∩ Γ.V ⊆ (A' ∩ B').vertexSet ∧ (e : Set S) ⊆ ins C := by + intro e + exact hcircuits e.val (Or.inr e.property) + choose C hC using hex + have : Finite P.E := P.finite_edges.to_subtype + have hcover : P.U ⊆ ⋃ e, ins (C e) := path_subset_edge_cover hP huv + (fun e => ins (C e)) (fun e => (hd _ (hC e).1 (hC e).2.1 (hC e).2.2.1).1.isClosed) + (fun e => (hC e).2.2.2.2) + have hpre : IsPreconnected P.U := by + obtain ⟨f, _⟩ := isLine_of_isPathBetween hP huv + have h_eq : P.U = (fun z => (f z).val) '' univ := by + ext x + exact ⟨fun hx => ⟨f.symm ⟨x, hx⟩, mem_univ _, by simp⟩, + fun ⟨z, _, hz⟩ => hz ▸ (f z).property⟩ + rw [h_eq] + exact isPreconnected_univ.image _ (continuous_subtype_val.comp f.continuous).continuousOn + have huP : u ∈ P.U := by + obtain ⟨W, _, hV, _⟩ := hP + apply P.V_subset_U + rw [hV] + exact W.start_mem_support + have hvP : v ∈ P.U := by + obtain ⟨W, _, hV, _⟩ := hP + apply P.V_subset_U + rw [hV] + exact W.end_mem_support + have hbound := distance_le_twice_separator_of_circuit_cover + (⟨hResp.2.1.one_le, hResp.2.1.isSeparation, hResp.2.1.order_lt, + hResp.2.1.axiom1, hResp.2.1.axiom2⟩ : IsPretangle Γ.toHypergraph θ T) + hK hd C (fun e => (hC e).1) (fun e => (hC e).2.1) + (fun e => (hC e).2.2.1) (A' ∩ B').vertexSet_finite (fun e => (hC e).2.2.2.1) + hpre hcover huP hvP hu hv + rw [heq {u} (Or.inl (Or.inl ⟨u, hu, rfl⟩)) {v} (Or.inl (Or.inl ⟨v, hv, rfl⟩))] + exact hbound.trans_eq (congrArg (2 * ·) horder) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4AdjacentSubdivisionPieces.lean b/LeanPool/GraphMinor/GM12/Section4AdjacentSubdivisionPieces.lean new file mode 100644 index 0000000000..343d68ab5d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4AdjacentSubdivisionPieces.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SubdivisionArcIncidence +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# The two pieces at an internal cut + +At a new vertex of the subdivision in XII (4.5), page 252, +the two adjacent pieces are portions of the same simple arc. +Any intersection is a cut, and each piece contains only its two +endpoint cuts. Injectivity of the cut map leaves exactly their +shared endpoint as the intersection. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Two different adjacent pieces meet exactly at each internal +cut. This gives the noncrossing pair at each new vertex required +by XII (4.5)(vii), page 252. -/ +theorem exists_adjacent_pieces_at_internal_cut {k : ℕ} + (w : Fin (k + 1) → ℂ) (P : Fin k → Set ℂ) (hw : Function.Injective w) + (hline : ∀ i, IsLineWithEnds (P i) (w i.castSucc) (w i.succ)) + (hinter : ∀ i j, i ≠ j → P i ∩ P j ⊆ range w) + (hvertex : ∀ i, P i ∩ range w = {w i.castSucc, w i.succ}) (j : Fin (k - 1)) : + ∃ i l : Fin k, i ≠ l ∧ P i ∩ P l = {w ⟨j.val + 1, by have := j.isLt; omega⟩} := by + let i : Fin k := ⟨j.val, by have := j.isLt; omega⟩ + let l : Fin k := ⟨j.val + 1, by have := j.isLt; omega⟩ + let r : Fin (k + 1) := ⟨j.val + 1, by have := j.isLt; omega⟩ + have hil : i ≠ l := by + intro h + have hval := congrArg Fin.val h + change j.val = j.val + 1 at hval + omega + refine ⟨i, l, hil, ?_⟩ + ext x + constructor + · intro hx + obtain ⟨q, rfl⟩ := hinter i l hil hx + have hend : ∀ s, w q ∈ P s → q.val = s.val ∨ q.val = s.val + 1 := by + intro s hs + have hends : w q ∈ ({w s.castSucc, w s.succ} : Set ℂ) := + hvertex s ▸ And.intro hs (mem_range_self q) + exact hends.elim (fun h => Or.inl (congrArg Fin.val (hw h))) + (fun h => Or.inr (congrArg Fin.val (hw h))) + have hqi := hend i hx.1 + have hql := hend l hx.2 + change q.val = j.val ∨ q.val = j.val + 1 at hqi + change q.val = j.val + 1 ∨ q.val = j.val + 1 + 1 at hql + have hqr : q = r := by + apply Fin.ext + change q.val = j.val + 1 + omega + exact congrArg w hqr + · rintro rfl + have heq1 : i.succ = r := Fin.ext rfl + have heq2 : l.castSucc = r := Fin.ext rfl + have hi := (hline i).right_mem + have hl := (hline l).left_mem + rw [heq1] at hi + rw [heq2] at hl + exact ⟨hi, hl⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4AmbientMotion.lean b/LeanPool/GraphMinor/GM12/Section4AmbientMotion.lean new file mode 100644 index 0000000000..2ba863e339 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4AmbientMotion.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.GM12.Section4ArcMotion +import LeanPool.GraphMinor.Surface.Classification +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.Surface.Wedge + +/-! +# Endpoint motion in an arbitrary closed connected surface + +The ambient motion used for XII (4.3), claim (7), page 251, is +invariant under homeomorphisms. Carry the arc and the forbidden +closed set to a surface model, perform the strip slide, and +conjugate the resulting homeomorphism back. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- An ambient homeomorphism moves one end of an arc to the other +and fixes any closed set disjoint from the arc. -/ +theorem exists_ambient_endpoint_motion + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {a : unitInterval → S} (ha : IsArcMap a) + {F : Set S} (hF : IsClosed F) (havoid : Disjoint (range a) F) : + ∃ e : S ≃ₜ S, e (a 1) = a 0 ∧ ∀ x ∈ F, e x = x := by + let : CompactSpace S := hS.1 + have hsurf : IsSurface S := ⟨hS.1, hS.2.1, fun x => (hS.2.2 x).isManifoldPoint⟩ + obtain ⟨n, m, c, ⟨e⟩⟩ := classification S hsurf inferInstance + let : T2Space (SurfaceModel n m c) := e.t2Space + have hM : IsClosedSurface (SurfaceModel n m c) := by + refine ⟨e.compactSpace, e.t2Space, ?_⟩ + intro x + have hx := (isInteriorPoint_homeomorph_iff e (e.symm x)).mpr (hS.2.2 (e.symm x)) + simpa only [e.apply_symm_apply] using hx + let a' : unitInterval → SurfaceModel n m c := fun t => e (a t) + let F' : Set (SurfaceModel n m c) := e.symm ⁻¹' F + have ha' : IsArcMap a' := ⟨e.continuous.comp ha.1, e.injective.comp ha.2⟩ + have hF' : IsClosed F' := hF.preimage e.symm.continuous + have havoid' : Disjoint (range a') F' := by + apply Set.disjoint_left.mpr + rintro _ ⟨t, rfl⟩ hx + have hx' : a t ∈ F := by simpa only [F', a', mem_preimage, e.symm_apply_apply] using hx + exact Set.disjoint_left.mp havoid (mem_range_self t) hx' + obtain ⟨g, hgend, hgfix⟩ := exists_endpoint_motion_of_arc hM ha' hF' havoid' + refine ⟨(e.trans g).trans e.symm, ?_, ?_⟩ + · change e.symm (g (e (a 1))) = a 0 + rw [show g (e (a 1)) = e (a 0) from hgend, e.symm_apply_apply] + · intro x hx + change e.symm (g (e x)) = x + rw [hgfix (e x) (by simpa only [F', mem_preimage, e.symm_apply_apply] using hx), + e.symm_apply_apply] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ArcComplement.lean b/LeanPool/GraphMinor/GM12/Section4ArcComplement.lean new file mode 100644 index 0000000000..dff338a587 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ArcComplement.lean @@ -0,0 +1,62 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.ArcDrawings +import LeanPool.GraphMinor.GM11.ForestRegions +import LeanPool.GraphMinor.GM11.Ties +import LeanPool.GraphMinor.GM11.Separate +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# A simple arc does not separate a closed surface + +The target-region disc preparation in XII (4.5), page 253, +uses that a proper closed subset of a circle cannot separate +the surface. First prove the corresponding fact for an arc. +Put a one-edge drawing on the arc. It contains no circuit, +since a simple closed curve cannot lie in a line. The forest +complement lemma then proves its complement is connected. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The complement of a simple arc in a connected closed +surface is preconnected. This is used to prove the full +boundary of a non-dense disc region in XII (4.5), page 253. -/ +theorem isPreconnected_compl_of_arc {S : Type*} [TopologicalSpace S] + [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) : IsPreconnected Lᶜ := by + classical + obtain ⟨g, hg, -, hg0, hg1⟩ := hL.exists_arc + have hab : a ≠ b := by + intro heq + have h01 : g 0 = g 1 := hg0.trans (heq.trans hg1.symm) + exact (show (0 : unitInterval) ≠ 1 by norm_num) (hg.2 h01) + have hends : ({a, b} : Set S) ⊆ L := by + rintro z (rfl | rfl) + · exact hL.left_mem + · exact hL.right_mem + obtain ⟨D, hDU, -⟩ := GM11.exists_drawing_on_line 2 hL hab (Set.toFinite ({a, b} : Set S)) + (by simp) (by simp) hends (by rw [ncard_pair hab]) + have hno : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing D → False := by + intro C hC hCD + exact GM11.not_isOArc_of_subset_line (GM11.IsLineWithEnds.isLine hL) + (GM11.IsCircuit.isOArc_U hC) (hCD.U_subset.trans hDU.subset) + have h := GM11.isPreconnected_compl_of_noCircuit hS D hno + simpa only [hDU] using h + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ArcMeetingParameters.lean b/LeanPool/GraphMinor/GM12/Section4ArcMeetingParameters.lean new file mode 100644 index 0000000000..d8baec7614 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ArcMeetingParameters.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import Mathlib.Order.Fin.Basic +import Mathlib.Data.Finset.Sort +import Mathlib.Data.Set.Finite.Range + +/-! +# Ordering finitely many meetings on an edge arc + +In XII (4.5), page 252, subdivide an edge according to its finite +nonempty set of crossings. Pull these points back through an arc +parametrization and sort the resulting finite subset of the unit +interval. Because the endpoints are not crossings, all sorted +parameters lie strictly between zero and one. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A finite nonempty set of interior points of an edge arc has +strictly increasing parameters. These are the crossing parameters +used for the subdivision in XII (4.5), page 252. -/ +theorem exists_ordered_arc_meeting_parameters {E X : Set ℂ} {a b : ℂ} + (hE : IsLineWithEnds E a b) (hX : X.Finite) (hXne : X.Nonempty) + (hXE : X ⊆ E) (haX : a ∉ X) (hbX : b ∉ X) : + ∃ k : ℕ, 0 < k ∧ ∃ φ : unitInterval ≃ₜ E, + (φ 0).val = a ∧ (φ 1).val = b ∧ + ∃ t : Fin k → unitInterval, StrictMono t ∧ + (∀ i, 0 < (t i : ℝ) ∧ (t i : ℝ) < 1) ∧ + X = range (fun i => (φ (t i)).val) := by + classical + obtain ⟨φ, hφ0, hφ1⟩ := hE + let Y : Set E := Subtype.val ⁻¹' X + have hY : Y.Finite := hX.preimage Subtype.val_injective.injOn + let T : Set unitInterval := φ ⁻¹' Y + have hT : T.Finite := hY.preimage φ.injective.injOn + have hTne : T.Nonempty := by + obtain ⟨x, hx⟩ := hXne + refine ⟨φ.symm ⟨x, hXE hx⟩, ?_⟩ + change (φ (φ.symm ⟨x, hXE hx⟩)).val ∈ X + rw [φ.apply_symm_apply] + exact hx + let : Fintype T := hT.fintype + let k := Fintype.card T + let σ : Fin k ≃o T := Fintype.orderIsoFinOfCardEq _ rfl + have hk : 0 < k := Fintype.card_pos_iff.mpr ⟨⟨hTne.choose, hTne.choose_spec⟩⟩ + let t : Fin k → unitInterval := fun i => (σ i).val + have ht : StrictMono t := fun _ _ hij => σ.strictMono hij + have ht01 : ∀ i, 0 < (t i : ℝ) ∧ (t i : ℝ) < 1 := by + intro i + have hmem : (φ (t i)).val ∈ X := (σ i).property + have hzero : (t i : ℝ) ≠ 0 := by + intro h + have heq : t i = 0 := Subtype.ext h + rw [heq, hφ0] at hmem + exact haX hmem + have hone : (t i : ℝ) ≠ 1 := by + intro h + have heq : t i = 1 := Subtype.ext h + rw [heq, hφ1] at hmem + exact hbX hmem + exact ⟨lt_of_le_of_ne (t i).property.1 (Ne.symm hzero), + lt_of_le_of_ne (t i).property.2 hone⟩ + refine ⟨k, hk, φ, hφ0, hφ1, t, ht, ht01, ?_⟩ + apply Subset.antisymm + · intro x hx + let u : unitInterval := φ.symm ⟨x, hXE hx⟩ + have hu : u ∈ T := by + change (φ (φ.symm ⟨x, hXE hx⟩)).val ∈ X + rw [φ.apply_symm_apply] + exact hx + refine ⟨σ.symm ⟨u, hu⟩, ?_⟩ + change (φ (σ (σ.symm ⟨u, hu⟩)).val).val = x + rw [σ.apply_symm_apply] + change (φ (φ.symm ⟨x, hXE hx⟩)).val = x + rw [φ.apply_symm_apply] + · rintro x ⟨i, rfl⟩ + exact (σ i).property + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ArcMotion.lean b/LeanPool/GraphMinor/GM12/Section4ArcMotion.lean new file mode 100644 index 0000000000..3026b6621a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ArcMotion.lean @@ -0,0 +1,60 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.GM12.Section4StripMotion +import LeanPool.GraphMinor.Surface.ArcDisc +import LeanPool.GraphMinor.Surface.Wedge + +/-! +# Ambient motion along an arc + +For XII (4.3), claim (7), page 251, straighten an arc in a disc +chart and slide its last endpoint to its first. Taking the strip +inside the complement of a closed forbidden set makes the motion +fix that set pointwise. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Metric + +/-- Move one endpoint of an arc to the other while fixing a closed +set disjoint from the arc. -/ +theorem exists_endpoint_motion_of_arc + {S : Type} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {a : unitInterval → S} (ha : IsArcMap a) + {F : Set S} (hF : IsClosed F) (havoid : Disjoint (range a) F) : + ∃ e : S ≃ₜ S, e (a 1) = a 0 ∧ ∀ x ∈ F, e x = x := by + let : CompactSpace S := hS.1 + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + obtain ⟨E, hE, haE⟩ := Surface.exists_disc_of_arc hS ha + obtain ⟨h, g, c⟩ := hE.exists_isChart + have hbc : BallChart 1 (g '' ball 0 1) h g := by + refine ⟨c.isOpen_image_ball hman, c.hc.mono ?_, c.gc.mono ball_subset_closedBall, + ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact c.gm (ball_subset_closedBall hz) + · rintro _ ⟨z, hz, rfl⟩ + rwa [c.hg (ball_subset_closedBall hz)] + · exact fun z hz => ⟨z, hz, rfl⟩ + · rintro _ ⟨z, hz, rfl⟩ + rw [c.hg (ball_subset_closedBall hz)] + · exact fun z hz => c.hg (ball_subset_closedBall hz) + have haU : range a ⊆ g '' ball 0 1 := by + rw [← c.discInt_eq] + exact haE + obtain ⟨O, K, θ, hK, hθc, hθm, hθK⟩ := + Surface.exists_stripChart hman hbc ha haU + exact exists_endpoint_motion_of_strip hK hθc hθm hθK hF havoid + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ArcSubdivision.lean b/LeanPool/GraphMinor/GM12/Section4ArcSubdivision.lean new file mode 100644 index 0000000000..978ef9fcc5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ArcSubdivision.lean @@ -0,0 +1,224 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4ArcSubintervals +public import LeanPool.GraphMinor.GM12.Section4SubdivisionCover + +/-! +# Subdividing an arc into pieces with one marked meeting each + +For XII (4.5), page 252, use the midpoint cuts between the ordered +meeting parameters. The cut images give the subdivision vertices, +and the intervening arc portions give the new edges. Each portion +is a simple arc containing exactly its assigned meeting. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +universe u + +/-- A subdivision vertex at a midpoint cut, in XII (4.5), page 252. -/ +@[expose] noncomputable def arcSubdivisionVertex {S : Type u} + {k : ℕ} (g : unitInterval → S) (t : Fin k → unitInterval) (i : Fin (k + 1)) : S := + extI g (subdivisionCut (fun j => (t j : ℝ)) i) + +/-- An arc portion between consecutive midpoint cuts, in the +subdivision of XII (4.5), page 252. -/ +@[expose] noncomputable def arcSubdivisionPiece {S : Type u} + {k : ℕ} (g : unitInterval → S) (t : Fin k → unitInterval) (i : Fin k) : Set S := + range (pieceA g (subdivisionCut (fun j => (t j : ℝ)) i.castSucc) + (subdivisionCut (fun j => (t j : ℝ)) i.succ)) + +/-- Each new edge is a simple arc with its two cut images as ends. -/ +theorem arcSubdivisionPiece_isLine {S : Type u} [TopologicalSpace S] [T2Space S] + {k : ℕ} (hk : 0 < k) {g : unitInterval → S} (hg : IsArcMap g) + (t : Fin k → unitInterval) (ht : StrictMono t) + (ht01 : ∀ i, 0 < (t i : ℝ) ∧ (t i : ℝ) < 1) (i : Fin k) : + IsLineWithEnds (arcSubdivisionPiece g t i) + (arcSubdivisionVertex g t i.castSucc) (arcSubdivisionVertex g t i.succ) := by + exact isLineWithEnds_pieceA hg + (subdivisionCut_mem_Icc hk (fun j => (t j : ℝ)) ht ht01 i.castSucc).1 + ((subdivisionCut_strictMono (fun j => (t j : ℝ)) ht ht01) Fin.castSucc_lt_succ) + (subdivisionCut_mem_Icc hk (fun j => (t j : ℝ)) ht ht01 i.succ).2 + +/-- A marked meeting lies on exactly its assigned subdivision +piece, as required by XII (4.5), page 252. -/ +theorem marked_mem_arcSubdivisionPiece_iff {S : Type u} + {k : ℕ} (hk : 0 < k) {g : unitInterval → S} (hg : Function.Injective g) + (t : Fin k → unitInterval) (ht : StrictMono t) + (ht01 : ∀ i, 0 < (t i : ℝ) ∧ (t i : ℝ) < 1) (i j : Fin k) : + g (t j) ∈ arcSubdivisionPiece g t i ↔ j = i := by + rw [arcSubdivisionPiece, mem_range_pieceA_iff hg + (subdivisionCut_mem_Icc hk (fun j => (t j : ℝ)) ht ht01 i.castSucc).1 + ((subdivisionCut_strictMono (fun j => (t j : ℝ)) ht ht01) Fin.castSucc_lt_succ).le + (subdivisionCut_mem_Icc hk (fun j => (t j : ℝ)) ht ht01 i.succ).2] + exact crossing_mem_subdivisionInterval_iff (fun j => (t j : ℝ)) ht ht01 j i + +/-- Each subdivision piece meets the marked set in exactly one +point. This is the geometric one-meeting-per-edge assertion in +XII (4.5), page 252. -/ +theorem arcSubdivisionPiece_inter_marked {S : Type u} + {k : ℕ} (hk : 0 < k) {g : unitInterval → S} (hg : Function.Injective g) + (t : Fin k → unitInterval) (ht : StrictMono t) + (ht01 : ∀ i, 0 < (t i : ℝ) ∧ (t i : ℝ) < 1) (i : Fin k) : + arcSubdivisionPiece g t i ∩ range (fun j => g (t j)) = {g (t i)} := by + ext x + constructor + · rintro ⟨hx, j, rfl⟩ + have hji := (marked_mem_arcSubdivisionPiece_iff hk hg t ht ht01 i j).mp hx + subst j + rfl + · rintro rfl + exact ⟨(marked_mem_arcSubdivisionPiece_iff hk hg t ht ht01 i i).mpr rfl, ⟨i, rfl⟩⟩ + +/-- Distinct cuts give distinct subdivision vertices. -/ +theorem arcSubdivisionVertex_injective {S : Type u} + {k : ℕ} (hk : 0 < k) {g : unitInterval → S} (hg : Function.Injective g) + (t : Fin k → unitInterval) (ht : StrictMono t) + (ht01 : ∀ i, 0 < (t i : ℝ) ∧ (t i : ℝ) < 1) : + Function.Injective (arcSubdivisionVertex g t) := by + intro i j hij + apply (subdivisionCut_strictMono (fun j => (t j : ℝ)) ht ht01).injective + exact extI_injOn hg (subdivisionCut_mem_Icc hk (fun j => (t j : ℝ)) ht ht01 i) + (subdivisionCut_mem_Icc hk (fun j => (t j : ℝ)) ht ht01 j) hij + +/-- No subdivision vertex is one of the marked meetings. -/ +theorem arcSubdivisionVertex_not_mem_marked {S : Type u} + {k : ℕ} (hk : 0 < k) {g : unitInterval → S} (hg : Function.Injective g) + (t : Fin k → unitInterval) (ht : StrictMono t) + (ht01 : ∀ i, 0 < (t i : ℝ) ∧ (t i : ℝ) < 1) (i : Fin (k + 1)) : + arcSubdivisionVertex g t i ∉ range (fun j => g (t j)) := by + rintro ⟨j, hj⟩ + have heq : subdivisionCut (fun j => (t j : ℝ)) i = (t j : ℝ) := + extI_injOn hg (subdivisionCut_mem_Icc hk (fun j => (t j : ℝ)) ht ht01 i) + (t j).property (hj.symm.trans (extI_coe g (t j)).symm) + exact subdivisionCut_ne_crossing (fun j => (t j : ℝ)) ht ht01 i j heq + +/-- The first subdivision vertex is the original first endpoint. -/ +theorem arcSubdivisionVertex_zero {S : Type u} + {k : ℕ} (g : unitInterval → S) (t : Fin k → unitInterval) : + arcSubdivisionVertex g t 0 = g 0 := by + rw [arcSubdivisionVertex, subdivisionCut_zero] + exact extI_coe g 0 + +/-- The last subdivision vertex is the original last endpoint. -/ +theorem arcSubdivisionVertex_last {S : Type u} + {k : ℕ} (hk : 0 < k) (g : unitInterval → S) (t : Fin k → unitInterval) : + arcSubdivisionVertex g t (Fin.last k) = g 1 := by + rw [arcSubdivisionVertex, subdivisionCut_last hk] + exact extI_coe g 1 + +/-- The subdivision pieces cover the whole original arc. -/ +theorem iUnion_arcSubdivisionPieces {S : Type u} + {k : ℕ} (hk : 0 < k) {g : unitInterval → S} (hg : Function.Injective g) + (t : Fin k → unitInterval) (ht : StrictMono t) + (ht01 : ∀ i, 0 < (t i : ℝ) ∧ (t i : ℝ) < 1) : + (⋃ i, arcSubdivisionPiece g t i) = range g := by + apply Subset.antisymm + · intro x hx + obtain ⟨i, hi⟩ := mem_iUnion.mp hx + exact range_pieceA_subset_range g _ _ hi + · rintro x ⟨u, rfl⟩ + obtain ⟨i, hi⟩ := exists_subdivisionInterval_of_mem_Icc hk (fun j => + (t j : ℝ)) ht ht01 u.property + refine mem_iUnion.mpr ⟨i, ?_⟩ + exact (mem_range_pieceA_iff hg + (subdivisionCut_mem_Icc hk (fun j => (t j : ℝ)) ht ht01 i.castSucc).1 + ((subdivisionCut_strictMono (fun j => (t j : ℝ)) ht ht01) Fin.castSucc_lt_succ).le + (subdivisionCut_mem_Icc hk (fun j => (t j : ℝ)) ht ht01 i.succ).2 u).mpr hi + +/-- Two different subdivision pieces can meet only at a cut +vertex. This gives the edge-incidence condition for the subdivision +in XII (4.5), page 252. -/ +theorem arcSubdivisionPieces_inter_subset_vertices {S : Type u} + {k : ℕ} (hk : 0 < k) {g : unitInterval → S} (hg : Function.Injective g) + (t : Fin k → unitInterval) (ht : StrictMono t) + (ht01 : ∀ i, 0 < (t i : ℝ) ∧ (t i : ℝ) < 1) + {i j : Fin k} (hij : i ≠ j) : + arcSubdivisionPiece g t i ∩ arcSubdivisionPiece g t j ⊆ range (arcSubdivisionVertex g t) := by + intro x hx + obtain ⟨u, rfl⟩ := range_pieceA_subset_range g _ _ hx.1 + have hmem : ∀ l, g u ∈ arcSubdivisionPiece g t l → + (u : ℝ) ∈ Icc (subdivisionCut (fun j => (t j : ℝ)) l.castSucc) + (subdivisionCut (fun j => (t j : ℝ)) l.succ) := by + intro l hl + exact (mem_range_pieceA_iff hg + (subdivisionCut_mem_Icc hk (fun j => (t j : ℝ)) ht ht01 l.castSucc).1 + ((subdivisionCut_strictMono (fun j => (t j : ℝ)) ht ht01) Fin.castSucc_lt_succ).le + (subdivisionCut_mem_Icc hk (fun j => (t j : ℝ)) ht ht01 l.succ).2 u).mp hl + have hmi := hmem i hx.1 + have hmj := hmem j hx.2 + have hmono := (subdivisionCut_strictMono (fun j => (t j : ℝ)) ht ht01).monotone + rcases lt_or_gt_of_ne hij with hlt | hgt + · have hsep := hmono (show i.succ ≤ j.castSucc by change i.val + 1 ≤ j.val; omega) + have hueq := le_antisymm hmi.2 (hsep.trans hmj.1) + refine ⟨i.succ, ?_⟩ + change extI g (subdivisionCut (fun j => (t j : ℝ)) i.succ) = g u + rw [← hueq] + exact extI_coe g u + · have hsep := hmono (show j.succ ≤ i.castSucc by change j.val + 1 ≤ i.val; omega) + have hueq := le_antisymm hmj.2 (hsep.trans hmi.1) + refine ⟨j.succ, ?_⟩ + change extI g (subdivisionCut (fun j => (t j : ℝ)) j.succ) = g u + rw [← hueq] + exact extI_coe g u + +/-- A subdivision piece contains exactly its two endpoint cuts +from the full cut set. This gives the exact vertex incidence in +XII (4.5)'s subdivision, page 252. -/ +theorem cut_mem_arcSubdivisionPiece_iff {S : Type u} + {k : ℕ} (hk : 0 < k) {g : unitInterval → S} (hg : Function.Injective g) + (t : Fin k → unitInterval) (ht : StrictMono t) + (ht01 : ∀ i, 0 < (t i : ℝ) ∧ (t i : ℝ) < 1) + (i : Fin k) (j : Fin (k + 1)) : + arcSubdivisionVertex g t j ∈ arcSubdivisionPiece g t i ↔ j = i.castSucc ∨ j = i.succ := by + have hcuts := subdivisionCut_strictMono (fun j => (t j : ℝ)) ht ht01 + have hbound := subdivisionCut_mem_Icc hk (fun j => (t j : ℝ)) ht ht01 + rw [arcSubdivisionVertex, extI_of_mem g (hbound j), arcSubdivisionPiece, + mem_range_pieceA_iff hg (hbound i.castSucc).1 + (hcuts Fin.castSucc_lt_succ).le (hbound i.succ).2] + constructor + · intro hmem + have hlo : i.castSucc ≤ j := le_of_not_gt fun h => (not_le_of_gt (hcuts h)) hmem.1 + have hhi : j ≤ i.succ := le_of_not_gt fun h => (not_le_of_gt (hcuts h)) hmem.2 + have hcases : j.val = i.val ∨ j.val = i.val + 1 := by + change i.val ≤ j.val at hlo + change j.val ≤ i.val + 1 at hhi + omega + exact hcases.elim (fun h => Or.inl (Fin.ext h)) (fun h => Or.inr (Fin.ext h)) + · rintro (rfl | rfl) + · exact ⟨le_rfl, (hcuts Fin.castSucc_lt_succ).le⟩ + · exact ⟨(hcuts Fin.castSucc_lt_succ).le, le_rfl⟩ + +/-- The marked vertex set of each new edge is exactly its two +consecutive cuts. -/ +theorem arcSubdivisionPiece_inter_vertices {S : Type u} + {k : ℕ} (hk : 0 < k) {g : unitInterval → S} (hg : Function.Injective g) + (t : Fin k → unitInterval) (ht : StrictMono t) + (ht01 : ∀ i, 0 < (t i : ℝ) ∧ (t i : ℝ) < 1) (i : Fin k) : + arcSubdivisionPiece g t i ∩ range (arcSubdivisionVertex g t) = + {arcSubdivisionVertex g t i.castSucc, arcSubdivisionVertex g t i.succ} := by + ext x + constructor + · rintro ⟨hx, j, rfl⟩ + rcases (cut_mem_arcSubdivisionPiece_iff hk hg t ht ht01 i j).mp hx with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + · rintro (rfl | rfl) + · exact ⟨(cut_mem_arcSubdivisionPiece_iff hk hg t ht ht01 i i.castSucc).mpr (Or.inl rfl), + ⟨i.castSucc, rfl⟩⟩ + · exact ⟨(cut_mem_arcSubdivisionPiece_iff hk hg t ht ht01 i i.succ).mpr (Or.inr rfl), + ⟨i.succ, rfl⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ArcSubintervals.lean b/LeanPool/GraphMinor/GM12/Section4ArcSubintervals.lean new file mode 100644 index 0000000000..10062b0d4b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ArcSubintervals.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Closed subintervals of an edge arc + +The subdivision step in XII (4.5), page 252, takes the portions +of an arc between successive cuts. The affine parametrization +`pieceA` gives each portion as a simple arc. Injectivity of the +original parametrization says exactly which original parameters +belong to each portion. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +universe u + +/-- Membership in an arc portion is exactly membership of the +original parameter in the corresponding closed interval. This +transfers the one-crossing interval calculation in XII (4.5), page 252. -/ +theorem mem_range_pieceA_iff {S : Type u} + {g : unitInterval → S} (hg : Function.Injective g) + {a b : ℝ} (ha : 0 ≤ a) (hab : a ≤ b) (hb : b ≤ 1) (t : unitInterval) : + g t ∈ range (pieceA g a b) ↔ (t : ℝ) ∈ Icc a b := by + rw [range_pieceA g ha hab hb] + constructor + · rintro ⟨q, hq, heq⟩ + have hq01 : q ∈ Icc (0 : ℝ) 1 := ⟨ha.trans hq.1, hq.2.trans hb⟩ + have hqt : q = (t : ℝ) := extI_injOn hg hq01 t.property + (heq.trans (extI_coe g t).symm) + simpa only [hqt] using hq + · intro ht + exact ⟨t, ht, extI_coe g t⟩ + +/-- Every portion of an arc lies on the original arc. -/ +theorem range_pieceA_subset_range {S : Type u} + (g : unitInterval → S) (a b : ℝ) : range (pieceA g a b) ⊆ range g := by + rintro x ⟨t, rfl⟩ + exact ⟨_, rfl⟩ + +/-- A nondegenerate portion of a simple arc is a line with the +selected cut points as ends, as needed in XII (4.5), page 252. -/ +theorem isLineWithEnds_pieceA {S : Type u} [TopologicalSpace S] [T2Space S] + {g : unitInterval → S} (hg : IsArcMap g) + {a b : ℝ} (ha : 0 ≤ a) (hab : a < b) (hb : b ≤ 1) : + IsLineWithEnds (range (pieceA g a b)) (extI g a) (extI g b) := by + have h := (isArcMap_pieceA hg ha hab hb).isLineWithEnds + simpa only [pieceA_zero, pieceA_one] using h + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4AttachedBranches.lean b/LeanPool/GraphMinor/GM12/Section4AttachedBranches.lean new file mode 100644 index 0000000000..6a8070c82d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4AttachedBranches.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM12.Section4BranchUnions +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Attaching disjoint path pieces to branches + +XII (4.4), page 252, defines each clique branch by adding its +assigned shortened paths to the connected subdrawing. Form these +finite unions explicitly. Every path piece meets its own branch +and avoids all other branches. Different path pieces are disjoint. +These facts give both connectivity and pairwise disjointness of +the enlarged branches. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Hypergraph GM10 + +/-- A finite union of subhypergraphs remains a subhypergraph. -/ +theorem biUnion_le_of_each_le + {α β ι : Type*} {G : Hypergraph α β} (B : ι → Hypergraph α β) (F : Finset ι) + (hB : ∀ i ∈ F, B i ≤ G) : Hypergraph.biUnion F B ≤ G := by + refine ⟨?_, ?_, ?_⟩ + · intro x hx + obtain ⟨i, hi, hxi⟩ := mem_iUnion₂.mp hx + exact (hB i hi).vertexSet_subset hxi + · intro e he + obtain ⟨i, hi, hei⟩ := mem_iUnion₂.mp he + exact (hB i hi).edgeSet_subset hei + · intro e he + obtain ⟨i, hi, hei⟩ := mem_iUnion₂.mp he + ext x + constructor + · intro hix + exact ⟨i, hi, (inc_iff_of_le (hB i hi) hei).mpr hix⟩ + · rintro ⟨j, hj, hjx⟩ + exact (inc_iff_of_le (hB j hj) ((B j).edge_mem_of_inc hjx)).mp hjx + +/-- Add disjoint connected pieces to their assigned nonempty +connected branches, as in XII (4.4), page 252. -/ +theorem exists_branches_with_attached_pieces + {α β ι κ : Type*} [Finite ι] {G : Hypergraph α β} + (A : κ → Hypergraph α β) (B : ι → Hypergraph α β) (owner : ι → κ) + (hA : ∀ v, A v ≤ G ∧ (A v).vertexSet.Nonempty ∧ IsConnectedSub (A v)) + (hAA : ∀ v w, v ≠ w → Disjoint (A v).vertexSet (A w).vertexSet) + (hB : ∀ i, B i ≤ G ∧ IsConnectedSub (B i)) + (hBB : ∀ i j, i ≠ j → Disjoint (B i).vertexSet (B j).vertexSet) + (hmeet : ∀ i, ((A (owner i)).vertexSet ∩ (B i).vertexSet).Nonempty) + (hcross : ∀ i v, v ≠ owner i → Disjoint (B i).vertexSet (A v).vertexSet) : + ∃ C : κ → Hypergraph α β, + (∀ v, C v ≤ G ∧ (C v).vertexSet.Nonempty ∧ IsConnectedSub (C v)) ∧ + (∀ v w, v ≠ w → Disjoint (C v).vertexSet (C w).vertexSet) ∧ + (∀ v, A v ≤ C v) ∧ ∀ i, B i ≤ C (owner i) := by + classical + let indexFintype := Fintype.ofFinite ι + let F : κ → Finset ι := fun v => Finset.univ.filter (fun i => owner i = v) + let C : κ → Hypergraph α β := fun v => A v ∪ Hypergraph.biUnion (F v) B + have hF : ∀ i v, i ∈ F v ↔ owner i = v := by intro i v; simp [F] + have hCle : ∀ v, C v ≤ G := fun v => + union_le (hA v).1 (biUnion_le_of_each_le B (F v) (fun i _ => (hB i).1)) + have hAC : ∀ v, A v ≤ C v := fun v => + le_union_left (hA v).1 (biUnion_le_of_each_le B (F v) (fun i _ => (hB i).1)) + have hBC : ∀ i, B i ≤ C (owner i) := by + intro i + apply (le_iff_of_le (hB i).1 (hCle (owner i))).mpr + exact ⟨fun x hx => Or.inr (mem_iUnion₂.mpr ⟨i, (hF i _).mpr rfl, hx⟩), + fun e he => Or.inr (mem_iUnion₂.mpr ⟨i, (hF i _).mpr rfl, he⟩)⟩ + refine ⟨C, ?_, ?_, hAC, hBC⟩ + · intro v + refine ⟨hCle v, (hA v).2.1.mono (hAC v).vertexSet_subset, ?_⟩ + apply isConnectedSub_union_biUnion (A v) B (F v) (hA v).2.1 (hA v).2.2 + (fun i _ => (hB i).2) + intro i hi + have hown := (hF i v).mp hi + exact hown ▸ hmeet i + · intro v w hvw + apply Set.disjoint_left.mpr + intro x hxv hxw + rcases hxv with hxA | hxB <;> rcases hxw with hyA | hyB + · exact Set.disjoint_left.mp (hAA v w hvw) hxA hyA + · obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.mp hyB + have hjw := (hF j w).mp hj + exact Set.disjoint_left.mp (hcross j v (fun h => hvw (h.trans hjw))) hxj hxA + · obtain ⟨i, hi, hxi⟩ := mem_iUnion₂.mp hxB + have hiv := (hF i v).mp hi + exact Set.disjoint_left.mp (hcross i w (fun h => hvw (h.trans hiv).symm)) hxi hyA + · obtain ⟨i, hi, hxi⟩ := mem_iUnion₂.mp hxB + obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.mp hyB + have hiv := (hF i v).mp hi + have hjw := (hF j w).mp hj + have hij : i ≠ j := fun h => hvw (hiv.symm.trans (h ▸ hjw)) + exact Set.disjoint_left.mp (hBB i j hij) hxi hxj + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4BranchImage.lean b/LeanPool/GraphMinor/GM12/Section4BranchImage.lean new file mode 100644 index 0000000000..6624aecdba --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4BranchImage.lean @@ -0,0 +1,72 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM16.HypergraphImage + +/-! +# Relabelling the branches of a controlled minor + +For the embedded-graph form of XII (4.3), page 249, the branch +hypergraphs must be carried through vertex and edge maps that are +injective on the actual drawing. Subhypergraph inclusion survives +such a relabelling. A skeleton walk maps to a skeleton walk because +its adjacent vertices are distinct actual vertices. Thus connected +nonempty branches stay connected and nonempty. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Hypergraph GM16 + +/-- Relabelling preserves inclusion when the edge map is injective +on the actual edge set of the larger hypergraph. -/ +theorem imageHypergraph_mono_on + {α β γ δ : Type*} (f : α → γ) (g : β → δ) + {A H : Hypergraph α β} (hg : InjOn g H.edgeSet) (hAH : A ≤ H) : + imageHypergraph f g A ≤ imageHypergraph f g H := by + refine ⟨image_mono hAH.vertexSet_subset, image_mono hAH.edgeSet_subset, ?_⟩ + rintro _ ⟨e, he, rfl⟩ + ext v + constructor + · rintro ⟨e₀, v₀, hi, heq, hv⟩ + have he₀ : e₀ = e := hg (H.edge_mem_of_inc hi) (hAH.edgeSet_subset he) heq + subst e₀ + have hia : A.Inc e v₀ := (Set.ext_iff.mp (hAH.ends_eq e he) v₀).mp hi + exact ⟨e, v₀, hia, rfl, hv⟩ + · rintro ⟨e₀, v₀, hi, heq, hv⟩ + have hiH : H.Inc e₀ v₀ := (Set.ext_iff.mp (hAH.ends_eq e₀ (A.edge_mem_of_inc hi)) v₀).mpr hi + exact ⟨e₀, v₀, hiH, heq, hv⟩ + +/-- Connected branches stay connected after relabelling by a map +injective on their actual vertices. -/ +theorem isConnectedSub_imageHypergraph + {α β γ δ : Type*} (f : α → γ) (g : β → δ) + {A : Hypergraph α β} (hf : InjOn f A.vertexSet) (hA : IsConnectedSub A) : + IsConnectedSub (imageHypergraph f g A) := by + have hwalk : ∀ {x y : α}, A.skeleton.Walk x y → + (imageHypergraph f g A).skeleton.Reachable (f x) (f y) := by + intro x y W + induction W with + | nil => exact .refl _ + | @cons x y z hxy W ih => + obtain ⟨hne, e, hex, hey⟩ := hxy + have hneq : f x ≠ f y := fun h => hne (hf (A.vertex_mem_of_inc hex) + (A.vertex_mem_of_inc hey) h) + have hadj : (imageHypergraph f g A).skeleton.Adj (f x) (f y) := + ⟨hneq, g e, ⟨e, x, hex, rfl, rfl⟩, ⟨e, y, hey, rfl, rfl⟩⟩ + exact hadj.reachable.trans ih + rintro _ ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩ + obtain ⟨W⟩ := hA x hx y hy + exact hwalk W + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4BranchUnions.lean b/LeanPool/GraphMinor/GM12/Section4BranchUnions.lean new file mode 100644 index 0000000000..cb52bf9a53 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4BranchUnions.lean @@ -0,0 +1,91 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Joining path pieces to a connected branch + +XII (4.4), page 252, adds shortened external paths to a connected +subdrawing. Each added path meets that subdrawing at its assigned +endpoint. Carry a walk from each point of a path to that endpoint, +and then through the original branch. This proves connectivity of +the whole finite union. The graph-path lemmas below supply the +same connectivity for each shortened path. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Hypergraph GM10 GM09 + +/-- A graph walk gives reachability in the associated hypergraph's +skeleton, including when a walk step is a loop. -/ +theorem graphWalk_skeleton_reachable + {α β : Type*} {G : Graph α β} (hV : G.vertexSet.Finite) (hE : G.edgeSet.Finite) + {x y : α} (W : GraphWalk G x y) : + (Hypergraph.ofGraph G hV hE).skeleton.Reachable x y := by + induction W with + | nil => exact .refl _ + | @cons x z y e hl W ih => + by_cases hxz : x = z + · subst z + exact ih + · have hadj : (Hypergraph.ofGraph G hV hE).skeleton.Adj x z := + ⟨hxz, e, hl.inc_left, hl.inc_right⟩ + exact hadj.reachable.trans ih + +/-- A finite graph traced by a path is connected as a hypergraph. -/ +theorem isConnectedSub_of_graph_path + {α β : Type*} {G P : Graph α β} (hV : P.vertexSet.Finite) (hE : P.edgeSet.Finite) + {a b : α} (hP : IsGraphPathWithEnds G P a b) : + IsConnectedSub (Hypergraph.ofGraph P hV hE) := by + obtain ⟨_, W, _, hWV, _⟩ := hP + intro x hx y hy + have hxW : x ∈ W.support := by change x ∈ P.vertexSet at hx; rw [hWV] at hx; exact hx + have hyW : y ∈ W.support := by change y ∈ P.vertexSet at hy; rw [hWV] at hy; exact hy + obtain ⟨Px, _, _⟩ := W.exists_append_of_mem hxW + obtain ⟨Py, _, _⟩ := W.exists_append_of_mem hyW + exact graphWalk_skeleton_reachable hV hE (Px.reverse.append Py) + +/-- Adding finitely many connected pieces, each meeting a fixed +nonempty connected branch, preserves connectivity. -/ +theorem isConnectedSub_union_biUnion + {α β ι : Type*} (A : Hypergraph α β) (B : ι → Hypergraph α β) (F : Finset ι) + (hne : A.vertexSet.Nonempty) (hA : IsConnectedSub A) + (hB : ∀ i ∈ F, IsConnectedSub (B i)) + (hmeet : ∀ i ∈ F, (A.vertexSet ∩ (B i).vertexSet).Nonempty) : + IsConnectedSub (A ∪ Hypergraph.biUnion F B) := by + let U := A ∪ Hypergraph.biUnion F B + have hmonoA : A.skeleton ≤ U.skeleton := by + intro x y hxy + obtain ⟨hne, e, hex, hey⟩ := hxy + exact ⟨hne, e, Or.inl hex, Or.inl hey⟩ + have hmonoB : ∀ i ∈ F, (B i).skeleton ≤ U.skeleton := by + intro i hi x y hxy + obtain ⟨hne, e, hex, hey⟩ := hxy + exact ⟨hne, e, Or.inr ⟨i, hi, hex⟩, Or.inr ⟨i, hi, hey⟩⟩ + obtain ⟨c, hc⟩ := hne + have hreach : ∀ x ∈ U.vertexSet, U.skeleton.Reachable x c := by + intro x hx + rcases hx with hxA | hxB + · exact SimpleGraph.Reachable.mono hmonoA (hA x hxA c hc) + · obtain ⟨i, hi, hxi⟩ := mem_iUnion₂.mp hxB + obtain ⟨z, hzA, hzB⟩ := hmeet i hi + exact (SimpleGraph.Reachable.mono (hmonoB i hi) (hB i hi x hxi z hzB)).trans + (SimpleGraph.Reachable.mono hmonoA (hA z hzA c hc)) + intro x hx y hy + exact (hreach x hx).trans (hreach y hy).symm + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ChordAvoidance.lean b/LeanPool/GraphMinor/GM12/Section4ChordAvoidance.lean new file mode 100644 index 0000000000..6fbd40e066 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ChordAvoidance.lean @@ -0,0 +1,122 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CircleAvoidance + +/-! +# Choosing a chord off old crossings + +The crossing drawing in XII (4.5), page 253, can be built by choosing +circle ports successively. Once the first end is fixed away from the +old crossing points, exclude the finitely many lines from that end +to those points when choosing the second end. The new chord then +misses all the old crossing points. Distinct supporting lines have +at most one common point, so the set of old crossings is finite. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Surface EuclideanGeometry + +/-- Distinct supporting lines of chords meet in at most one point. -/ +theorem subsingleton_inter_of_ne_lines {a b c d : ℂ} + (hne : line[ℝ, a, b] ≠ line[ℝ, c, d]) : + ((line[ℝ, a, b] : Set ℂ) ∩ (line[ℝ, c, d] : Set ℂ)).Subsingleton := by + intro x hx y hy + by_contra hxy + apply hne + exact (affineSpan_pair_eq_of_mem_of_mem_of_ne hx.1 hy.1 hxy).symm.trans + (affineSpan_pair_eq_of_mem_of_mem_of_ne hx.2 hy.2 hxy) + +/-- The second port can be placed in a prescribed open circle arc +so that the whole supporting line misses a finite set of points. +This is the exclusion of old crossings in XII (4.5), page 253. -/ +theorem exists_chord_line_avoiding_finite_set + {X : Set ℂ} (hX : X.Finite) {a : ℂ} (ha : ‖a‖ = 1) (haX : a ∉ X) + {u v : ℝ} (huv : u < v) (hlen : v ≤ u + 1) : + ∃ t ∈ Ioo u v, (ee t : ℂ) ≠ a ∧ + Disjoint (line[ℝ, a, (ee t : ℂ)] : Set ℂ) X := by + classical + let Y := insert a X + let : Fintype Y := (hX.insert a).fintype + obtain ⟨t, ht, havoid⟩ := exists_circle_port_avoiding_lines + (fun _ : Y => a) (fun x : Y => (x : ℂ)) (fun _ => ha) huv hlen + have hba : (ee t : ℂ) ≠ a := by + intro h + apply havoid ⟨a, mem_insert a X⟩ + rw [h] + exact left_mem_affineSpan_pair _ _ _ + refine ⟨t, ht, hba, disjoint_left.mpr ?_⟩ + intro x hx hxX + have hxa : x ≠ a := fun h => haX (h ▸ hxX) + have heq := affineSpan_pair_eq_of_right_mem_of_ne hx hxa + apply havoid ⟨x, mem_insert_of_mem a hxX⟩ + change (ee t : ℂ) ∈ line[ℝ, a, x] + rw [heq] + exact right_mem_affineSpan_pair _ _ _ + +/-- Add one chord to finitely many distinct supporting lines, with +its ends in prescribed short circle arcs. The new line is distinct +from the old lines and passes through none of their pairwise +intersections. These are the finite-intersection and no-triple- +crossing conditions in XII (4.5), page 253. -/ +theorem exists_chord_avoiding_old_crossings {ι : Type*} [Finite ι] + (a b : ι → ℂ) (ha : ∀ i, ‖a i‖ = 1) + (hne : ∀ i j, i ≠ j → line[ℝ, a i, b i] ≠ line[ℝ, a j, b j]) + {u v w z : ℝ} (huv : u < v) (huvlen : v ≤ u + 1) + (hwz : w < z) (hwzlen : z ≤ w + 1) : + ∃ s ∈ Ioo u v, ∃ t ∈ Ioo w z, + (ee s : ℂ) ≠ (ee t : ℂ) ∧ + (∀ i, line[ℝ, (ee s : ℂ), (ee t : ℂ)] ≠ line[ℝ, a i, b i]) ∧ + (∀ i, a i ∉ (line[ℝ, (ee s : ℂ), (ee t : ℂ)] : Set ℂ) ∧ + b i ∉ (line[ℝ, (ee s : ℂ), (ee t : ℂ)] : Set ℂ)) ∧ + ∀ i j, i ≠ j → Disjoint + (line[ℝ, (ee s : ℂ), (ee t : ℂ)] : Set ℂ) + ((line[ℝ, a i, b i] : Set ℂ) ∩ (line[ℝ, a j, b j] : Set ℂ)) := by + classical + let X : Set ℂ := ⋃ i, ⋃ j, if i = j then ∅ else + (line[ℝ, a i, b i] : Set ℂ) ∩ (line[ℝ, a j, b j] : Set ℂ) + have hX : X.Finite := by + refine finite_iUnion fun i => finite_iUnion fun j => ?_ + split_ifs with hij + · exact finite_empty + · exact (subsingleton_inter_of_ne_lines (hne i j hij)).finite + let B : Set ℂ := ⋃ i, sphere (0 : ℂ) 1 ∩ (line[ℝ, a i, b i] : Set ℂ) + have hB : B.Finite := finite_iUnion fun i => finite_unit_circle_inter_line (ha i) + obtain ⟨s, hs, hsbad⟩ := exists_circle_port_avoiding_finite_set (hX.union hB) huv huvlen + have hsX : (ee s : ℂ) ∉ X := fun h => hsbad (Or.inl h) + have hsline : ∀ i, (ee s : ℂ) ∉ (line[ℝ, a i, b i] : Set ℂ) := by + intro i hi + exact hsbad (Or.inr (mem_iUnion.mpr ⟨i, ⟨by simp, hi⟩⟩)) + let Y : Set ℂ := X ∪ range a ∪ range b + have hY : Y.Finite := (hX.union (finite_range a)).union (finite_range b) + have hsY : (ee s : ℂ) ∉ Y := by + rintro ((hx | ⟨i, hi⟩) | ⟨i, hi⟩) + · exact hsX hx + · exact hsline i (hi ▸ left_mem_affineSpan_pair ℝ (a i) (b i)) + · exact hsline i (hi ▸ right_mem_affineSpan_pair ℝ (a i) (b i)) + obtain ⟨t, ht, hts, hdisj⟩ := exists_chord_line_avoiding_finite_set hY + (by simp) hsY hwz hwzlen + refine ⟨s, hs, t, ht, hts.symm, ?_, ?_, ?_⟩ + · intro i heq + apply hsline i + rw [← heq] + exact left_mem_affineSpan_pair _ _ _ + · intro i + exact ⟨fun h => disjoint_left.mp hdisj h (Or.inl (Or.inr (mem_range_self i))), + fun h => disjoint_left.mp hdisj h (Or.inr (mem_range_self i))⟩ + · intro i j hij + apply hdisj.mono_right + intro x hx + exact Or.inl (Or.inl (mem_iUnion.mpr ⟨i, mem_iUnion.mpr ⟨j, by simpa [hij] using hx⟩⟩)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ChordCrossing.lean b/LeanPool/GraphMinor/GM12/Section4ChordCrossing.lean new file mode 100644 index 0000000000..7d088b95a7 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ChordCrossing.lean @@ -0,0 +1,124 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Lunes +public import LeanPool.GraphMinor.Surface.CircleMove +import LeanPool.GraphMinor.Surface.Crossing + +/-! +# Alternating circle ports force a chord crossing + +For the crossing drawing of XII (4.5), page 253, put the ends of +one chord at angles minus delta and delta. The other chord has one +end between them and one outside that arc. Cosine puts these ends +on opposite sides of the vertical line through the first ends. +The crossing lemma for the unit disc then gives an intersection. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Surface + +/-- A normalized pair of chords with alternating circle ends +intersects. This is the crossing test used in XII (4.5), page 253. -/ +theorem alternating_unit_chords_inter + {δ β γ : ℝ} (hδ : 0 < δ) (hδπ : δ < Real.pi) + (hβ : |β| < δ) (hγ : δ < γ) (hγ' : γ < 2 * Real.pi - δ) : + (segment ℝ (eC (-δ)) (eC δ) ∩ segment ℝ (eC β) (eC γ)).Nonempty := by + have hcomp : IsCompact (segment ℝ (eC (-δ)) (eC δ)) := by + rw [segment_eq_image_lineMap] + exact isCompact_Icc.image (AffineMap.lineMap_continuous (p := eC (-δ)) (q := eC δ)) + have hball : ∀ t : ℝ, eC t ∈ closedBall (0 : ℂ) 1 := by + intro t + simp [norm_eC] + have hline : ∀ z : ℂ, ‖z‖ = 1 → z.re = Real.cos δ → + z = eC (-δ) ∨ z = eC δ := by + intro z hz hre + have hsq : z.im * z.im = Real.sin δ * Real.sin δ := by + have h1 := Complex.sq_norm z + rw [Complex.normSq_apply, hz, hre] at h1 + have h2 := Real.sin_sq_add_cos_sq δ + nlinarith + have hfac : (z.im - Real.sin δ) * (z.im + Real.sin δ) = 0 := by + linear_combination hsq + rcases mul_eq_zero.mp hfac with h | h + · right + apply Complex.ext + · simpa only [eC_re] using hre + · rw [eC_im] + linarith + · left + apply Complex.ext + · simpa only [eC_re, Real.cos_neg] using hre + · rw [eC_im, Real.sin_neg] + linarith + apply crossing_of_vertical_line hcomp + (convex_segment _ _).isPreconnected (convex_segment _ _).isPreconnected + ((convex_closedBall (0 : ℂ) 1).segment_subset (hball _) (hball _)) + ((convex_closedBall (0 : ℂ) 1).segment_subset (hball _) (hball _)) + (left_mem_segment _ _ _) (right_mem_segment _ _ _) + (left_mem_segment _ _ _) (right_mem_segment _ _ _) + (norm_eC _) (norm_eC _) hline + · rw [eC_re] + exact (cos_arc hδ hδπ).2.1 hβ + · rw [eC_re] + exact (cos_arc hδ hδπ).2.2.2 hγ hγ' + +private theorem eC_mul (a b : ℝ) : eC a * eC b = eC (a + b) := by + change ((Circle.exp a * Circle.exp b : Circle) : ℂ) = (Circle.exp (a + b) : ℂ) + rw [Circle.exp_add] + +private theorem mul_mem_segment (m : ℂ) {a b x : ℂ} (hx : x ∈ segment ℝ a b) : + m * x ∈ segment ℝ (m * a) (m * b) := by + obtain ⟨r, s, hr, hs, hrs, rfl⟩ := hx + refine ⟨r, s, hr, hs, hrs, ?_⟩ + simp only [mul_add, mul_smul_comm] + +/-- Chords whose four circle ends alternate in a full turn +intersect. This is the unnormalized crossing test for XII (4.5), +page 253. -/ +theorem ordered_unit_chords_inter {a b c d : ℝ} + (hab : a < b) (hbc : b < c) (hcd : c < d) (hda : d < a + 2 * Real.pi) : + (segment ℝ (eC a) (eC c) ∩ segment ℝ (eC b) (eC d)).Nonempty := by + let μ := (a + c) / 2 + let δ := (c - a) / 2 + obtain ⟨x, hx, hx'⟩ := alternating_unit_chords_inter + (δ := δ) (β := b - μ) (γ := d - μ) + (by dsimp [δ]; linarith) + (by dsimp [δ]; linarith) + (by rw [abs_lt]; dsimp [δ, μ]; constructor <;> linarith) + (by dsimp [δ, μ]; linarith) + (by dsimp [δ, μ]; linarith) + refine ⟨eC μ * x, ?_, ?_⟩ + · have h := mul_mem_segment (eC μ) hx + rw [eC_mul, eC_mul] at h + rw [show μ + -δ = a by dsimp [μ, δ]; ring, + show μ + δ = c by dsimp [μ, δ]; ring] at h + exact h + · have h := mul_mem_segment (eC μ) hx' + rw [eC_mul, eC_mul] at h + simpa only [add_sub_cancel] using h + +/-- The same crossing test in the full-turn parametrization used +when choosing the circle ports for XII (4.5), page 253. -/ +theorem ordered_chords_inter {a b c d : ℝ} + (hab : a < b) (hbc : b < c) (hcd : c < d) (hda : d < a + 1) : + (segment ℝ (ee a : ℂ) (ee c : ℂ) ∩ segment ℝ (ee b : ℂ) (ee d : ℂ)).Nonempty := by + change (segment ℝ (eC (2 * Real.pi * a)) (eC (2 * Real.pi * c)) ∩ + segment ℝ (eC (2 * Real.pi * b)) (eC (2 * Real.pi * d))).Nonempty + apply ordered_unit_chords_inter + · exact mul_lt_mul_of_pos_left hab (by positivity) + · exact mul_lt_mul_of_pos_left hbc (by positivity) + · exact mul_lt_mul_of_pos_left hcd (by positivity) + · nlinarith [Real.pi_pos] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ChordFamily.lean b/LeanPool/GraphMinor/GM12/Section4ChordFamily.lean new file mode 100644 index 0000000000..25d37542a8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ChordFamily.lean @@ -0,0 +1,111 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4ChordAvoidance + +/-! +# A finite family of chords in general position + +For XII (4.5), page 253, prescribe an open circle arc for each end +of each chord. Add the chords one at a time, excluding old crossing +points. Their supporting lines are distinct, and no three of them +meet. The intervals for the ends can be made disjoint when choosing +the ports of the graph drawing. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +private theorem exists_castSucc_of_ne_last {n : ℕ} (i : Fin (n + 1)) + (hi : i ≠ Fin.last n) : ∃ j : Fin n, j.castSucc = i := by + refine Fin.lastCases ?_ (fun j => ?_) i hi + · intro h + exact (h rfl).elim + · intro _ + exact ⟨j, rfl⟩ + +/-- The finite chord selection used for the crossing drawing of +XII (4.5), page 253. Ends lie in their prescribed arcs, supporting +lines are distinct, and three distinct supporting lines never meet. -/ +theorem exists_chord_family_in_arcs (n : ℕ) + (u v w z : Fin n → ℝ) (huv : ∀ i, u i < v i) (hlen : ∀ i, v i ≤ u i + 1) + (hwz : ∀ i, w i < z i) (hlen' : ∀ i, z i ≤ w i + 1) : + ∃ s t : Fin n → ℝ, + (∀ i, s i ∈ Ioo (u i) (v i) ∧ t i ∈ Ioo (w i) (z i) ∧ + (ee (s i) : ℂ) ≠ (ee (t i) : ℂ)) ∧ + (∀ i j, i ≠ j → line[ℝ, (ee (s i) : ℂ), (ee (t i) : ℂ)] ≠ + line[ℝ, (ee (s j) : ℂ), (ee (t j) : ℂ)]) ∧ + ∀ i j k, i ≠ j → j ≠ k → i ≠ k → ∀ x : ℂ, + ¬ (x ∈ line[ℝ, (ee (s i) : ℂ), (ee (t i) : ℂ)] ∧ + x ∈ line[ℝ, (ee (s j) : ℂ), (ee (t j) : ℂ)] ∧ + x ∈ line[ℝ, (ee (s k) : ℂ), (ee (t k) : ℂ)]) := by + classical + induction n with + | zero => + exact ⟨Fin.elim0, Fin.elim0, fun i => i.elim0, fun i => i.elim0, fun i => i.elim0⟩ + | succ n ih => + obtain ⟨s, t, hst, hne, hthree⟩ := ih + (fun i => u i.castSucc) (fun i => v i.castSucc) + (fun i => w i.castSucc) (fun i => z i.castSucc) + (fun i => huv i.castSucc) (fun i => hlen i.castSucc) + (fun i => hwz i.castSucc) (fun i => hlen' i.castSucc) + obtain ⟨s₀, hs₀, t₀, ht₀, hst₀, hnew, _, hcross⟩ := + exists_chord_avoiding_old_crossings + (fun i => (ee (s i) : ℂ)) (fun i => (ee (t i) : ℂ)) + (by intro i; simp) hne (huv (Fin.last n)) (hlen (Fin.last n)) + (hwz (Fin.last n)) (hlen' (Fin.last n)) + refine ⟨Fin.snoc s s₀, Fin.snoc t t₀, ?_, ?_, ?_⟩ + · intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simpa using And.intro hs₀ (And.intro ht₀ hst₀) + · simpa using hst j + · intro i j hij + by_cases hi : i = Fin.last n + · subst i + obtain ⟨j, rfl⟩ := exists_castSucc_of_ne_last j hij.symm + simpa using hnew j + · obtain ⟨i, rfl⟩ := exists_castSucc_of_ne_last i hi + by_cases hj : j = Fin.last n + · subst j + simpa using (hnew i).symm + · obtain ⟨j, rfl⟩ := exists_castSucc_of_ne_last j hj + simpa using hne i j (fun h => hij (congrArg Fin.castSucc h)) + · intro i j k hij hjk hik x hx + by_cases hi : i = Fin.last n + · subst i + obtain ⟨j, rfl⟩ := exists_castSucc_of_ne_last j hij.symm + obtain ⟨k, rfl⟩ := exists_castSucc_of_ne_last k hik.symm + have h := hcross j k (fun h => hjk (congrArg Fin.castSucc h)) + exact Set.disjoint_left.mp h (by simpa using hx.1) + ⟨by simpa using hx.2.1, by simpa using hx.2.2⟩ + · obtain ⟨i, rfl⟩ := exists_castSucc_of_ne_last i hi + by_cases hj : j = Fin.last n + · subst j + obtain ⟨k, rfl⟩ := exists_castSucc_of_ne_last k hjk.symm + have h := hcross i k (fun h => hik (congrArg Fin.castSucc h)) + exact Set.disjoint_left.mp h (by simpa using hx.2.1) + ⟨by simpa using hx.1, by simpa using hx.2.2⟩ + · obtain ⟨j, rfl⟩ := exists_castSucc_of_ne_last j hj + by_cases hk : k = Fin.last n + · subst k + have h := hcross i j (fun h => hij (congrArg Fin.castSucc h)) + exact Set.disjoint_left.mp h (by simpa using hx.2.2) + ⟨by simpa using hx.1, by simpa using hx.2.1⟩ + · obtain ⟨k, rfl⟩ := exists_castSucc_of_ne_last k hk + apply hthree i j k + (fun h => hij (congrArg Fin.castSucc h)) + (fun h => hjk (congrArg Fin.castSucc h)) + (fun h => hik (congrArg Fin.castSucc h)) x + simpa using hx + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ChordGeometry.lean b/LeanPool/GraphMinor/GM12/Section4ChordGeometry.lean new file mode 100644 index 0000000000..6ada82cc84 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ChordGeometry.lean @@ -0,0 +1,137 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4ChordFamily +public import LeanPool.GraphMinor.Surface.Defs +public import Mathlib.Analysis.Convex.Segment +import LeanPool.GraphMinor.Surface.Lunes +import Mathlib.Analysis.Convex.StrictConvexSpace +import Mathlib.Analysis.Convex.Between + +/-! +# Chord arcs and their intersections + +In the crossing construction of XII (4.5), page 253, a straight +chord is a simple arc. Strict convexity puts its interior inside +the open unit disc. Distinct supporting lines give finite pairwise +intersections, and the choice of supporting lines rules out triple +intersections of the arcs as well. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Surface + +/-- A chord with distinct unit circle ends is a line whose only +unit circle points are its ends. This separates the chord from the +outer vertex pieces in XII (4.5), page 253. -/ +theorem unit_chord_geometry {a b : ℂ} (ha : ‖a‖ = 1) (hb : ‖b‖ = 1) (hab : a ≠ b) : + IsLineWithEnds (segment ℝ a b) a b ∧ + segment ℝ a b ⊆ closedBall 0 1 ∧ + segment ℝ a b ∩ sphere 0 1 = {a, b} := by + have haD : a ∈ closedBall (0 : ℂ) 1 := by simp [ha] + have hbD : b ∈ closedBall (0 : ℂ) 1 := by simp [hb] + refine ⟨isLineWithEnds_segment hab, (convex_closedBall (0 : ℂ) 1).segment_subset haD hbD, ?_⟩ + ext x + constructor + · rintro ⟨hx, hxs⟩ + by_cases hxa : x = a + · exact Or.inl hxa + by_cases hxb : x = b + · exact Or.inr hxb + have hxi := mem_openSegment_of_ne_left_right (fun h => hxa h.symm) (fun h => hxb h.symm) hx + have hxB := openSegment_subset_ball_of_ne haD hbD hab hxi + have hn := mem_sphere_zero_iff_norm.mp hxs + exact False.elim ((not_lt_of_ge (le_of_eq hn.symm)) (mem_ball_zero_iff.mp hxB)) + · rintro (rfl | rfl) + · exact ⟨left_mem_segment _ _ _, by simp [ha]⟩ + · exact ⟨right_mem_segment _ _ _, by simp [hb]⟩ + +/-- Distinct chord supporting lines give finite intersections of +the chord arcs, as required by XII (4.5)(ii), page 253. -/ +theorem finite_chord_inter_of_ne_lines {a b c d : ℂ} + (hne : line[ℝ, a, b] ≠ line[ℝ, c, d]) : + (segment ℝ a b ∩ segment ℝ c d).Finite := by + apply (subsingleton_inter_of_ne_lines hne).finite.subset + intro x hx + exact ⟨(line[ℝ, a, b]).convex.segment_subset + (left_mem_affineSpan_pair _ _ _) (right_mem_affineSpan_pair _ _ _) hx.1, + (line[ℝ, c, d]).convex.segment_subset + (left_mem_affineSpan_pair _ _ _) (right_mem_affineSpan_pair _ _ _) hx.2⟩ + +/-- A supporting line through two distinct unit circle points has +no third unit circle point. -/ +theorem unit_circle_mem_line_iff {a b x : ℂ} + (ha : ‖a‖ = 1) (hb : ‖b‖ = 1) (hab : a ≠ b) (hx : ‖x‖ = 1) : + x ∈ line[ℝ, a, b] ↔ x = a ∨ x = b := by + let s : EuclideanGeometry.Sphere ℂ := ⟨0, 1⟩ + have ha' : a ∈ s := by simpa [s, EuclideanGeometry.mem_sphere] using ha + have hb' : b ∈ s := by simpa [s, EuclideanGeometry.mem_sphere] using hb + have hx' : x ∈ s := by simpa [s, EuclideanGeometry.mem_sphere] using hx + have hbsec := (s.eq_or_eq_secondInter_iff_mem_of_mem_affineSpan_pair ha' + (right_mem_affineSpan_pair ℝ a b)).mpr hb' + have hsec : b = s.secondInter a (b - a) := hbsec.resolve_left (fun h => hab h.symm) + change b = s.secondInter a (b -ᵥ a) at hsec + constructor + · intro hline + have h := (s.eq_or_eq_secondInter_iff_mem_of_mem_affineSpan_pair ha' hline).mpr hx' + rwa [← hsec] at h + · rintro (rfl | rfl) + · exact left_mem_affineSpan_pair _ _ _ + · exact right_mem_affineSpan_pair _ _ _ + +/-- Chords with four distinct unit circle ends meet only in the +open disc. Thus every meeting is away from the ports in the +crossing construction of XII (4.5), page 253. -/ +theorem unit_chord_inter_subset_openBall {a b c d : ℂ} + (ha : ‖a‖ = 1) (hb : ‖b‖ = 1) (hc : ‖c‖ = 1) (hd : ‖d‖ = 1) + (hab : a ≠ b) (hcd : c ≠ d) + (hac : a ≠ c) (had : a ≠ d) (hbc : b ≠ c) (hbd : b ≠ d) : + segment ℝ a b ∩ segment ℝ c d ⊆ ball 0 1 := by + intro x hx + have hgeom := unit_chord_geometry ha hb hab + have hn : ‖x‖ ≤ 1 := mem_closedBall_zero_iff.mp (hgeom.2.1 hx.1) + refine mem_ball_zero_iff.mpr (lt_of_le_of_ne hn ?_) + intro heq + have hxs : x ∈ sphere (0 : ℂ) 1 := mem_sphere_zero_iff_norm.mpr heq + have habx : x = a ∨ x = b := show x ∈ ({a, b} : Set ℂ) from hgeom.2.2 ▸ And.intro hx.1 hxs + have hcdx : x = c ∨ x = d := + show x ∈ ({c, d} : Set ℂ) from + (unit_chord_geometry hc hd hcd).2.2 ▸ And.intro hx.2 hxs + rcases habx with rfl | rfl + · exact hcdx.elim hac had + · exact hcdx.elim hbc hbd + +/-- A unit chord is exactly the part of its supporting line in +the unit disc. Thus near an interior meeting the source edges +are straight lines, as used for the crossing discs of XII (4.5), +page 253. -/ +theorem unit_chord_eq_line_inter_closedBall {a b : ℂ} + (ha : ‖a‖ = 1) (hb : ‖b‖ = 1) (hab : a ≠ b) : + (line[ℝ, a, b] : Set ℂ) ∩ closedBall 0 1 = segment ℝ a b := by + apply Subset.antisymm + · rintro z ⟨hzline, hzD⟩ + let s : EuclideanGeometry.Sphere ℂ := ⟨0, 1⟩ + have ha' : a ∈ s := by simpa [s, EuclideanGeometry.mem_sphere] using ha + have hb' : b ∈ s := by simpa [s, EuclideanGeometry.mem_sphere] using hb + have hcol : Collinear ℝ ({a, z, b} : Set ℂ) := by + rw [Set.insert_comm] + exact collinear_insert_of_mem_affineSpan_pair hzline + have hz' : dist z s.center ≤ s.radius := mem_closedBall.mp hzD + exact (EuclideanGeometry.wbtw_of_collinear_of_dist_center_le_radius hcol ha' hz' hb' + hab).mem_segment + · intro z hz + exact ⟨(line[ℝ, a, b]).convex.segment_subset + (left_mem_affineSpan_pair _ _ _) (right_mem_affineSpan_pair _ _ _) hz, + (unit_chord_geometry ha hb hab).2.1 hz⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ChordSeparation.lean b/LeanPool/GraphMinor/GM12/Section4ChordSeparation.lean new file mode 100644 index 0000000000..5e5d93806d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ChordSeparation.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Lunes +public import LeanPool.GraphMinor.Surface.CircleMove + +/-! +# Nonalternating circle ports give disjoint chords + +In XII (4.5), page 253, the two chosen incident Hamilton edges +must not cross each other. For two nonalternating pairs of ports, +the chord of one pair lies on a line and the chord of the other +pair lies strictly on one side of that line. The linear function +`gf` gives the separating inequality. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +private theorem gf_eq_on_segment {μ r : ℝ} {a b x : ℂ} + (ha : gf μ a = r) (hb : gf μ b = r) (hx : x ∈ segment ℝ a b) : + gf μ x = r := by + obtain ⟨s, t, _, _, hst, rfl⟩ := hx + rw [gf_add, gf_smul, gf_smul, ha, hb, ← add_mul, hst, one_mul] + +private theorem gf_lt_on_segment {μ r : ℝ} {a b x : ℂ} + (ha : gf μ a < r) (hb : gf μ b < r) (hx : x ∈ segment ℝ a b) : + gf μ x < r := by + refine lt_of_le_of_ne (gf_segment_le ha.le hb.le hx) ?_ + intro heq + rcases gf_segment_eq ha.le hb.le hx heq with rfl | rfl | h + · exact ha.ne heq + · exact hb.ne heq + · exact ha.ne h.1 + +/-- Nonalternating pairs of circle ports have disjoint chords. +This is the separation test for XII (4.5)(vii), page 253. -/ +theorem ordered_unit_chords_disjoint {a c b d : ℝ} + (hac : a < c) (hcb : c < b) (hbd : b < d) (hda : d < a + 2 * Real.pi) : + Disjoint (segment ℝ (eC a) (eC c)) (segment ℝ (eC b) (eC d)) := by + let μ := (a + c) / 2 + let δ := (c - a) / 2 + have hδ : 0 < δ := by dsimp [δ]; linarith + have hδπ : δ < Real.pi := by dsimp [δ]; linarith + have hga : gf μ (eC a) = Real.cos δ := by + rw [gf_eC, show a - μ = -δ by dsimp [μ, δ]; ring, Real.cos_neg] + have hgc : gf μ (eC c) = Real.cos δ := by + rw [gf_eC, show c - μ = δ by dsimp [μ, δ]; ring] + have hgb : gf μ (eC b) < Real.cos δ := by + rw [gf_eC] + apply (cos_arc hδ hδπ).2.2.2 + · dsimp [δ, μ]; linarith + · dsimp [δ, μ]; linarith + have hgd : gf μ (eC d) < Real.cos δ := by + rw [gf_eC] + apply (cos_arc hδ hδπ).2.2.2 + · dsimp [δ, μ]; linarith + · dsimp [δ, μ]; linarith + apply disjoint_left.mpr + intro x hx hx' + exact (gf_lt_on_segment hgb hgd hx').ne (gf_eq_on_segment hga hgc hx) + +/-- The nonalternation test in the full-turn parametrization used +for the circle ports of XII (4.5), page 253. -/ +theorem ordered_chords_disjoint {a c b d : ℝ} + (hac : a < c) (hcb : c < b) (hbd : b < d) (hda : d < a + 1) : + Disjoint (segment ℝ (ee a : ℂ) (ee c : ℂ)) + (segment ℝ (ee b : ℂ) (ee d : ℂ)) := by + change Disjoint (segment ℝ (eC (2 * Real.pi * a)) (eC (2 * Real.pi * c))) + (segment ℝ (eC (2 * Real.pi * b)) (eC (2 * Real.pi * d))) + apply ordered_unit_chords_disjoint + · exact mul_lt_mul_of_pos_left hac (by positivity) + · exact mul_lt_mul_of_pos_left hcb (by positivity) + · exact mul_lt_mul_of_pos_left hbd (by positivity) + · nlinarith [Real.pi_pos] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CircleAvoidance.lean b/LeanPool/GraphMinor/GM12/Section4CircleAvoidance.lean new file mode 100644 index 0000000000..742d6a5940 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CircleAvoidance.lean @@ -0,0 +1,86 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CircleMove +public import Mathlib.Geometry.Euclidean.Sphere.SecondInter + +/-! +# Choosing circle ports off finitely many lines + +For the crossing drawing in XII (4.5), page 253, a new circle port +must avoid the lines through old ports and old crossing points. +A line through a point of a sphere meets that sphere in at most two +points. Every open circle arc of length less than a turn is infinite, +so finitely many such lines cannot cover it. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Surface EuclideanGeometry + +/-- A line through a unit circle point has only finitely many unit +circle points. This is the finite exclusion used in the crossing +construction for XII (4.5), page 253. -/ +theorem finite_unit_circle_inter_line {a q : ℂ} (ha : ‖a‖ = 1) : + (sphere (0 : ℂ) 1 ∩ (line[ℝ, a, q] : Set ℂ)).Finite := by + let s : EuclideanGeometry.Sphere ℂ := ⟨0, 1⟩ + have ha' : a ∈ s := by simpa [s, EuclideanGeometry.mem_sphere, dist_zero_right] using ha + refine (toFinite ({a, s.secondInter a (q - a)} : Set ℂ)).subset ?_ + intro z hz + have hz' : z ∈ s := by + simpa [s, EuclideanGeometry.mem_sphere] using hz.1 + exact (s.eq_or_eq_secondInter_iff_mem_of_mem_affineSpan_pair ha' hz.2).mpr hz' + +/-- The circle parametrization is injective on an interval shorter +than one full turn. -/ +theorem ee_injOn_short_interval {a b : ℝ} (hab : b ≤ a + 1) : + InjOn ee (Ioo a b) := by + intro x hx y hy hxy + obtain ⟨m, hm⟩ := ee_eq_iff.mp hxy + have hmlo : (-1 : ℝ) < (m : ℝ) := by linarith [hx.1, hy.2] + have hmhi : (m : ℝ) < 1 := by linarith [hx.2, hy.1] + have hlo : (-1 : ℤ) < m := by exact_mod_cast hmlo + have hhi : m < (1 : ℤ) := by exact_mod_cast hmhi + have hm0 : m = 0 := by omega + simpa [hm0] using hm + +/-- A short open circle arc contains a point outside any finite +set, including a finite set of old ports. -/ +theorem exists_circle_port_avoiding_finite_set {B : Set ℂ} (hB : B.Finite) + {u v : ℝ} (huv : u < v) (hlen : v ≤ u + 1) : + ∃ t ∈ Ioo u v, (ee t : ℂ) ∉ B := by + have hi : InjOn (fun t : ℝ => (ee t : ℂ)) (Ioo u v) := by + intro x hx y hy hxy + exact ee_injOn_short_interval hlen hx hy (Subtype.ext hxy) + obtain ⟨z, ⟨t, ht, rfl⟩, hz⟩ := + (Set.Infinite.image hi (Ioo_infinite huv)).exists_notMem_finite hB + exact ⟨t, ht, hz⟩ + +/-- Choose a port in any prescribed short open circle arc while +avoiding finitely many lines through existing circle ports. This +supplies the finite avoidance step in XII (4.5), page 253. -/ +theorem exists_circle_port_avoiding_lines {ι : Type*} [Finite ι] + (a q : ι → ℂ) (ha : ∀ i, ‖a i‖ = 1) + {u v : ℝ} (huv : u < v) (hlen : v ≤ u + 1) : + ∃ t ∈ Ioo u v, ∀ i, (ee t : ℂ) ∉ (line[ℝ, a i, q i] : Set ℂ) := by + classical + let B : Set ℂ := ⋃ i, sphere (0 : ℂ) 1 ∩ (line[ℝ, a i, q i] : Set ℂ) + have hB : B.Finite := finite_iUnion fun i => finite_unit_circle_inter_line (ha i) + have hi : InjOn (fun t : ℝ => (ee t : ℂ)) (Ioo u v) := by + intro x hx y hy hxy + exact ee_injOn_short_interval hlen hx hy (Subtype.ext hxy) + have hinf := Set.Infinite.image hi (Ioo_infinite huv) + obtain ⟨z, ⟨t, ht, rfl⟩, hz⟩ := hinf.exists_notMem_finite hB + refine ⟨t, ht, fun i hi => hz ?_⟩ + exact mem_iUnion.mpr ⟨i, ⟨by simp, hi⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CircleInterpolation.lean b/LeanPool/GraphMinor/GM12/Section4CircleInterpolation.lean new file mode 100644 index 0000000000..b72102bc68 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CircleInterpolation.lean @@ -0,0 +1,131 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CircleMove +public import Mathlib.Analysis.Complex.Circle +import LeanPool.GraphMinor.Surface.PushOff + +/-! +# Matching three marked positions on a circle + +The four boundary marks in XII (4.5), claim (1), page 253, must +keep their cyclic order. Fix one mark and write the other three +at increasing positions between zero and one. Move the last mark +first, then the middle, then the first. Each piecewise linear tent +map fixes the marks already placed. Their composite is increasing, +fixes zero and one, and hence induces the required orientation +preserving circle homeomorphism. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +private theorem tentMap_strictMono {a l w t : ℝ} + (hal : a < l) (hlt : l < t) (haw : a < w) (hwt : w < t) : + StrictMono (tentMap a l w t) := by + have hc : Continuous (tentMap a l w t) := by unfold tentMap tent; fun_prop + have hi : Function.Injective (tentMap a l w t) := + Function.LeftInverse.injective (g := tentMap a w l t) + (fun r => tentMap_inv hal hlt haw hwt) + have ha : tentMap a l w t a = a := by rw [tentMap, tent_low hal hlt le_rfl]; ring + have ht : tentMap a l w t t = t := by rw [tentMap, tent_high hal hlt le_rfl]; ring + rcases hc.strictMono_of_inj hi with hm | hm + · exact hm + · have h := hm (hal.trans hlt) + rw [ha, ht] at h + exact False.elim (not_lt_of_ge (hal.trans hlt).le h) + +private theorem tentMap_fixed_left {a l w t x : ℝ} + (hal : a < l) (hlt : l < t) (hx : x ≤ a) : tentMap a l w t x = x := by + rw [tentMap, tent_low hal hlt hx, mul_zero, add_zero] + +private theorem tentMap_fixed_right {a l w t x : ℝ} + (hal : a < l) (hlt : l < t) (hx : t ≤ x) : tentMap a l w t x = x := by + rw [tentMap, tent_high hal hlt hx, mul_zero, add_zero] + +private theorem tentMap_pivot {a l w t : ℝ} + (hal : a < l) (hlt : l < t) : tentMap a l w t l = w := by + rw [tentMap, tent_left hal hlt hal.le le_rfl, div_self (sub_pos.mpr hal).ne', mul_one] + ring + +/-- Match two increasing triples inside the unit interval by a +continuous strictly increasing map fixing both ends. -/ +theorem exists_three_point_interpolation + {a b c a' b' c' : ℝ} (ha : 0 < a) (hab : a < b) (hbc : b < c) (hc : c < 1) + (ha' : 0 < a') (hab' : a' < b') (hbc' : b' < c') (hc' : c' < 1) : + ∃ τ : ℝ → ℝ, Continuous τ ∧ StrictMono τ ∧ τ 0 = 0 ∧ τ 1 = 1 ∧ + τ a = a' ∧ τ b = b' ∧ τ c = c' := by + let f₃ := tentMap 0 c c' 1 + have h₃m : StrictMono f₃ := tentMap_strictMono (ha.trans (hab.trans hbc)) hc + (ha'.trans (hab'.trans hbc')) hc' + have h₃c : Continuous f₃ := by unfold f₃ tentMap tent; fun_prop + have h₃0 : f₃ 0 = 0 := tentMap_fixed_left (ha.trans (hab.trans hbc)) hc le_rfl + have h₃1 : f₃ 1 = 1 := tentMap_fixed_right (ha.trans (hab.trans hbc)) hc le_rfl + have h₃c' : f₃ c = c' := tentMap_pivot (ha.trans (hab.trans hbc)) hc + let b₃ := f₃ b + have hb₃ : 0 < b₃ := by have h := h₃m (ha.trans hab); rwa [h₃0] at h + have hb₃c : b₃ < c' := by have h := h₃m hbc; rwa [h₃c'] at h + let f₂ := tentMap 0 b₃ b' c' + have h₂m : StrictMono f₂ := tentMap_strictMono hb₃ hb₃c (ha'.trans hab') hbc' + have h₂c : Continuous f₂ := by unfold f₂ tentMap tent; fun_prop + have h₂0 : f₂ 0 = 0 := tentMap_fixed_left hb₃ hb₃c le_rfl + have h₂1 : f₂ 1 = 1 := tentMap_fixed_right hb₃ hb₃c hc'.le + have h₂c' : f₂ c' = c' := tentMap_fixed_right hb₃ hb₃c le_rfl + have h₂b' : f₂ b₃ = b' := tentMap_pivot hb₃ hb₃c + let a₂ := f₂ (f₃ a) + have ha₂ : 0 < a₂ := by + have h₁ : 0 < f₃ a := by have h := h₃m ha; rwa [h₃0] at h + have h := h₂m h₁ + rwa [h₂0] at h + have ha₂b : a₂ < b' := by + have h := h₂m (h₃m hab) + rwa [h₂b'] at h + let f₁ := tentMap 0 a₂ a' b' + have h₁m : StrictMono f₁ := tentMap_strictMono ha₂ ha₂b ha' hab' + have h₁c : Continuous f₁ := by unfold f₁ tentMap tent; fun_prop + have h₁0 : f₁ 0 = 0 := tentMap_fixed_left ha₂ ha₂b le_rfl + have h₁1 : f₁ 1 = 1 := tentMap_fixed_right ha₂ ha₂b (hbc'.trans hc').le + have h₁b' : f₁ b' = b' := tentMap_fixed_right ha₂ ha₂b le_rfl + have h₁c' : f₁ c' = c' := tentMap_fixed_right ha₂ ha₂b hbc'.le + refine ⟨fun x => f₁ (f₂ (f₃ x)), h₁c.comp (h₂c.comp h₃c), h₁m.comp (h₂m.comp h₃m), + ?_, ?_, ?_, ?_, ?_⟩ + · change f₁ (f₂ (f₃ 0)) = 0 + rw [h₃0, h₂0, h₁0] + · change f₁ (f₂ (f₃ 1)) = 1 + rw [h₃1, h₂1, h₁1] + · exact tentMap_pivot ha₂ ha₂b + · change f₁ (f₂ b₃) = b' + rw [h₂b', h₁b'] + · change f₁ (f₂ (f₃ c)) = c' + rw [h₃c', h₂c', h₁c'] + +/-- Fix the circle point at zero and match three further cyclically +ordered marks. This is the local boundary adjustment in XII (4.5). -/ +theorem exists_circle_three_point_move + {a b c a' b' c' : ℝ} (ha : 0 < a) (hab : a < b) (hbc : b < c) (hc : c < 1) + (ha' : 0 < a') (hab' : a' < b') (hbc' : b' < c') (hc' : c' < 1) : + ∃ h : Circle ≃ₜ Circle, PreservesCircleOrientation h ∧ h 1 = 1 ∧ + h (ee a) = ee a' ∧ h (ee b) = ee b' ∧ h (ee c) = ee c' := by + obtain ⟨τ, hτc, hτm, hτ0, hτ1, hτa, hτb, hτc'⟩ := + exists_three_point_interpolation ha hab hbc hc ha' hab' hbc' hc' + obtain ⟨h, ho, hh⟩ := exists_circle_homeo hτc.continuousOn (hτm.strictMonoOn _) + (by rw [hτ0, hτ1]; norm_num) + refine ⟨h, ho, ?_, ?_, ?_, ?_⟩ + · have h0 := hh 0 ⟨le_rfl, zero_le_one⟩ + rw [hτ0] at h0 + simpa [ee] using h0 + · rw [hh a ⟨ha.le, (hab.trans (hbc.trans hc)).le⟩, hτa] + · rw [hh b ⟨(ha.trans hab).le, (hbc.trans hc).le⟩, hτb] + · rw [hh c ⟨(ha.trans (hab.trans hbc)).le, hc.le⟩, hτc'] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CirclePortIntervals.lean b/LeanPool/GraphMinor/GM12/Section4CirclePortIntervals.lean new file mode 100644 index 0000000000..9ca8c8f1ff --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CirclePortIntervals.lean @@ -0,0 +1,55 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CircleMove +public import Mathlib.Order.Fin.Basic +import LeanPool.GraphMinor.GM12.Section4OrderedPortIntervals + +/-! +# Ordered circle arcs in prescribed vertex neighborhoods + +The circle centers of the vertex blocks in XII (4.5), page 253, +are chosen within one full turn. Pull the open vertex neighborhoods +back to the angle line, and choose ordered intervals there. Every +choice of a port inside its interval stays in its vertex +neighborhood and keeps the prescribed order. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Choose ordered port intervals inside the assigned open vertex +neighborhoods, with all intervals in one full turn. These intervals +can be passed to the general-position chord selection for XII (4.5), +page 253. -/ +theorem exists_ordered_circle_port_intervals {n : ℕ} (c : Fin n → ℝ) + (hc : Monotone c) (hc01 : ∀ i, c i ∈ Ioo 0 1) + (O : Fin n → Set ℂ) (hO : ∀ i, IsOpen (O i)) + (hcO : ∀ i, (ee (c i) : ℂ) ∈ O i) : + ∃ u v : Fin n → ℝ, + (∀ i, 0 ≤ u i ∧ u i < v i ∧ v i ≤ 1 ∧ + ∀ t ∈ Ioo (u i) (v i), (ee t : ℂ) ∈ O i) ∧ + ∀ i j, i < j → v i < u j := by + let U : Fin n → Set ℝ := fun i => Ioo 0 1 ∩ (fun t : ℝ => (ee t : ℂ)) ⁻¹' O i + have hU : ∀ i, IsOpen (U i) := fun i => + isOpen_Ioo.inter ((hO i).preimage continuous_ee.subtype_val) + have hcU : ∀ i, c i ∈ U i := fun i => ⟨hc01 i, hcO i⟩ + obtain ⟨u, v, huv, horder⟩ := exists_ordered_port_intervals c hc U hU hcU + refine ⟨u, v, ?_, horder⟩ + intro i + have hsub : Ioo (u i) (v i) ⊆ Ioo (0 : ℝ) 1 := + (huv i).2.trans inter_subset_left + have hbounds := (Ioo_subset_Ioo_iff (huv i).1).mp hsub + exact ⟨hbounds.1, (huv i).1, hbounds.2, fun t ht => ((huv i).2 ht).2⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CircleQuad.lean b/LeanPool/GraphMinor/GM12/Section4CircleQuad.lean new file mode 100644 index 0000000000..bf958198a9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CircleQuad.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CircleMove +public import Mathlib.Analysis.Complex.Circle +import LeanPool.GraphMinor.GM12.Section4CircleInterpolation +import LeanPool.GraphMinor.GM12.Section4DiscTwist + +/-! +# Matching four cyclically ordered circle marks + +XII (4.5), claim (1), page 253, uses the cyclic order at a crossing. +Rotate the first source and target marks to one. Match the remaining +three increasing positions inside a full turn by the interpolation +map, then undo the target rotation. The resulting homeomorphism +keeps orientation and sends all four marks to their assigned marks. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +private theorem ee_sub (x y : ℝ) : (ee x)⁻¹ * ee y = ee (y - x) := by + unfold ee + rw [← Circle.exp_neg, ← Circle.exp_add] + congr 1 + ring + +private theorem ee_restore (x y : ℝ) : ee x * ee (y - x) = ee y := by + rw [← ee_sub x y, mul_inv_cancel_left] + +/-- The ordered four-point circle adjustment used at crossings in +XII (4.5), claim (1), page 253. The parameters span less than one +full turn on both circles. -/ +theorem exists_circle_four_point_move + {a₀ a₁ a₂ a₃ b₀ b₁ b₂ b₃ : ℝ} + (ha₀₁ : a₀ < a₁) (ha₁₂ : a₁ < a₂) (ha₂₃ : a₂ < a₃) (ha₃ : a₃ < a₀ + 1) + (hb₀₁ : b₀ < b₁) (hb₁₂ : b₁ < b₂) (hb₂₃ : b₂ < b₃) (hb₃ : b₃ < b₀ + 1) : + ∃ h : Circle ≃ₜ Circle, PreservesCircleOrientation h ∧ + h (ee a₀) = ee b₀ ∧ h (ee a₁) = ee b₁ ∧ + h (ee a₂) = ee b₂ ∧ h (ee a₃) = ee b₃ := by + obtain ⟨g, hg, hg0, hg1, hg2, hg3⟩ := exists_circle_three_point_move + (a := a₁ - a₀) (b := a₂ - a₀) (c := a₃ - a₀) + (a' := b₁ - b₀) (b' := b₂ - b₀) (c' := b₃ - b₀) + (by linarith) (by linarith) (by linarith) (by linarith) + (by linarith) (by linarith) (by linarith) (by linarith) + let h := (Homeomorph.mulLeft (ee a₀)⁻¹).trans (g.trans (Homeomorph.mulLeft (ee b₀))) + have ho : PreservesCircleOrientation h := + PreservesCircleOrientation.comp + (PreservesCircleOrientation.comp (preservesCircleOrientation_mul (ee b₀)) hg) + (preservesCircleOrientation_mul _) + refine ⟨h, ho, ?_, ?_, ?_, ?_⟩ + · change ee b₀ * g ((ee a₀)⁻¹ * ee a₀) = ee b₀ + rw [inv_mul_cancel, hg0, mul_one] + · change ee b₀ * g ((ee a₀)⁻¹ * ee a₁) = ee b₁ + rw [ee_sub, hg1, ee_restore] + · change ee b₀ * g ((ee a₀)⁻¹ * ee a₂) = ee b₂ + rw [ee_sub, hg2, ee_restore] + · change ee b₀ * g ((ee a₀)⁻¹ * ee a₃) = ee b₃ + rw [ee_sub, hg3, ee_restore] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CircleQuadTransfer.lean b/LeanPool/GraphMinor/GM12/Section4CircleQuadTransfer.lean new file mode 100644 index 0000000000..b45dcb8f88 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CircleQuadTransfer.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CircleQuad +import LeanPool.GraphMinor.GM19.CircleLift +import LeanPool.GraphMinor.GM12.Section4DiscTwist + +/-! +# Matching a transported crossing quadruple + +For XII (4.5), claim (1), page 253, an ambient disc match may +keep or reverse the boundary direction. After either case, +a boundary twist preserving direction can send its four +crossing marks to the prescribed four marks, allowing the +second and fourth marks to exchange places. Both choices +preserve the two opposite pairs. Use the increasing or +decreasing lift of the inverse circle map to distinguish +the cases, then apply the ordered four-point adjustment. +-/ + +public section + +namespace GraphMinor.GM12 + +open Surface + +private theorem inv_ee (t : ℝ) : (ee t)⁻¹ = ee (-t) := by + unfold ee + rw [← Circle.exp_neg] + congr 1 + ring + +private theorem inv_ee_quarter : (ee (1 / 4))⁻¹ = ee (3 / 4) := by + rw [inv_ee] + apply ee_eq_iff.mpr + exact ⟨-1, by norm_num⟩ + +private theorem inv_ee_half : (ee (1 / 2))⁻¹ = ee (1 / 2) := by + rw [inv_ee] + apply ee_eq_iff.mpr + exact ⟨-1, by norm_num⟩ + +private theorem inv_ee_three_quarters : (ee (3 / 4))⁻¹ = ee (1 / 4) := by + rw [inv_ee] + apply ee_eq_iff.mpr + exact ⟨-1, by norm_num⟩ + +/-- A circle homeomorphism's transported quarter-turn marks +can be matched to four ordered marks by a direction-preserving +map, either in the stated order or with the second and fourth +exchanged. This is the opposite-pair matching needed in +XII (4.5), claim (1), page 253. -/ +theorem exists_circle_quad_transfer (τ : Circle ≃ₜ Circle) + {b₀ b₁ b₂ b₃ : ℝ} (hb₀₁ : b₀ < b₁) (hb₁₂ : b₁ < b₂) + (hb₂₃ : b₂ < b₃) (hb₃ : b₃ < b₀ + 1) : + ∃ g : Circle ≃ₜ Circle, PreservesCircleOrientation g ∧ + ((g (τ (ee 0)) = ee b₀ ∧ g (τ (ee (1 / 4))) = ee b₁ ∧ + g (τ (ee (1 / 2))) = ee b₂ ∧ g (τ (ee (3 / 4))) = ee b₃) ∨ + (g (τ (ee 0)) = ee b₀ ∧ g (τ (ee (1 / 4))) = ee b₃ ∧ + g (τ (ee (1 / 2))) = ee b₂ ∧ g (τ (ee (3 / 4))) = ee b₁)) := by + obtain ⟨ψ, hψ, hψ0, hψ1, hψ2, hψ3⟩ := exists_circle_four_point_move + (a₀ := 0) (a₁ := 1 / 4) (a₂ := 1 / 2) (a₃ := 3 / 4) + (by norm_num) (by norm_num) (by norm_num) (by norm_num) hb₀₁ hb₁₂ hb₂₃ hb₃ + obtain ⟨L, hLc, hLm, hLe⟩ := GM19.exists_circle_lift τ.symm + rcases hLm with hmono | hanti + · have hbase : PreservesCircleOrientation τ.symm := ⟨L, hLc, hmono, hLe⟩ + refine ⟨τ.symm.trans ψ, PreservesCircleOrientation.comp hψ hbase, Or.inl ?_⟩ + change ψ (τ.symm (τ (ee 0))) = _ ∧ ψ (τ.symm (τ (ee (1 / 4)))) = _ ∧ + ψ (τ.symm (τ (ee (1 / 2)))) = _ ∧ ψ (τ.symm (τ (ee (3 / 4)))) = _ + simpa only [τ.symm_apply_apply] using And.intro hψ0 (And.intro hψ1 (And.intro hψ2 hψ3)) + · let base := τ.symm.trans (Homeomorph.inv Circle) + have hbase : PreservesCircleOrientation base := by + refine ⟨(fun t => -L t), hLc.neg, (fun a b hab => neg_lt_neg (hanti hab)), ?_⟩ + intro t + change (τ.symm (Circle.exp t))⁻¹ = Circle.exp (-L t) + rw [hLe, Circle.exp_neg] + refine ⟨base.trans ψ, PreservesCircleOrientation.comp hψ hbase, Or.inr ?_⟩ + change ψ ((τ.symm (τ (ee 0)))⁻¹) = _ ∧ ψ ((τ.symm (τ (ee (1 / 4))))⁻¹) = _ ∧ + ψ ((τ.symm (τ (ee (1 / 2))))⁻¹) = _ ∧ ψ ((τ.symm (τ (ee (3 / 4))))⁻¹) = _ + simp only [τ.symm_apply_apply, inv_ee_quarter, inv_ee_half, inv_ee_three_quarters] + have h0 : (ee 0)⁻¹ = ee 0 := by simp [ee] + rw [h0] + exact ⟨hψ0, hψ3, hψ2, hψ1⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CircleSubsetArc.lean b/LeanPool/GraphMinor/GM12/Section4CircleSubsetArc.lean new file mode 100644 index 0000000000..aca43e3ced --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CircleSubsetArc.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Closed subsets of a circle inside an arc + +For the region preparation in XII (4.5), page 253, a proper +closed part of a circle with two distinct points lies in a +simple arc. Cut out the open complementary arc around a point +outside the closed set, and keep the other arc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A compact proper part of a simple closed curve, with at +least two points, lies in a simple arc of that curve. -/ +theorem exists_arc_containing_compact_circle_subset + {S : Type*} [TopologicalSpace S] [T2Space S] + {C F : Set S} (hC : IsOArc C) (hF : IsCompact F) + (hFC : F ⊆ C) (hne : F.Nontrivial) {p : S} + (hp : p ∈ C) (hpF : p ∉ F) : + ∃ L : Set S, ∃ a b : S, + IsLineWithEnds L a b ∧ F ⊆ L ∧ L ⊆ C := by + obtain ⟨φ⟩ := hC + let T : Set Circle := (fun w : Circle => (φ w).val) ⁻¹' F + have hTc : IsClosed T := hF.isClosed.preimage + (continuous_subtype_val.comp φ.continuous) + let z : Circle := φ.symm ⟨p, hp⟩ + have hz : z ∉ T := by simpa [T, z] using hpF + obtain ⟨x, hx, y, hy, hxy⟩ := hne + let u : Circle := φ.symm ⟨x, hFC hx⟩ + let v : Circle := φ.symm ⟨y, hFC hy⟩ + have hu : u ∈ T := by simpa [T, u] using hx + have hv : v ∈ T := by simpa [T, v] using hy + have huv : u ≠ v := fun h => hxy + (congrArg Subtype.val (φ.symm.injective h)) + obtain ⟨a, b, hab, hr, ha, hb, hint, -⟩ := + exists_circle_chord hTc hz hu hv huv + have hTb : T ⊆ range b := by + intro w hw + have hwab : w ∈ range a ∪ range b := hr.symm ▸ mem_univ w + rcases hwab with ⟨t, rfl⟩ | hw + · by_cases h0 : t = 0 + · subst t + exact ⟨0, hab.3⟩ + by_cases h1 : t = 1 + · subst t + exact ⟨1, hab.4⟩ + exact False.elim (hint t h0 h1 hw) + · exact hw + let g : unitInterval → S := fun t => (φ (b t)).val + have hg : IsArcMap g := + ⟨(continuous_subtype_val.comp φ.continuous).comp hab.2.1, + fun s t h => hab.2.2 (φ.injective (Subtype.ext h))⟩ + refine ⟨range g, g 0, g 1, hg.isLineWithEnds, ?_, ?_⟩ + · intro w hw + have hwT : φ.symm ⟨w, hFC hw⟩ ∈ T := by simpa [T] using hw + obtain ⟨t, ht⟩ := hTb hwT + exact ⟨t, by simp [g, ht]⟩ + · rintro w ⟨t, rfl⟩ + exact (φ (b t)).property + + +/-- The same arc containment, including a one-point closed set. -/ +theorem exists_arc_containing_nonempty_compact_circle_subset + {S : Type*} [TopologicalSpace S] [T2Space S] + {C F : Set S} (hC : IsOArc C) (hF : IsCompact F) + (hFC : F ⊆ C) (hne : F.Nonempty) {p : S} + (hp : p ∈ C) (hpF : p ∉ F) : + ∃ L : Set S, ∃ a b : S, + IsLineWithEnds L a b ∧ F ⊆ L ∧ L ⊆ C := by + rcases F.subsingleton_or_nontrivial with hs | hn + · obtain ⟨q, hq⟩ := hne + have hqp : q ≠ p := fun h => hpF (h ▸ hq) + obtain ⟨a, b, hab, ha, hb, hr⟩ := hC.exists_arcs (hFC hq) hp hqp + refine ⟨range a, a 0, a 1, hab.1.isLineWithEnds, ?_, ?_⟩ + · intro w hw + exact ⟨0, ha.trans (hs hq hw)⟩ + · exact subset_union_left.trans hr.subset + · exact exists_arc_containing_compact_circle_subset hC hF hFC hn hp hpF + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CircuitAtomDistance.lean b/LeanPool/GraphMinor/GM12/Section4CircuitAtomDistance.lean new file mode 100644 index 0000000000..ae7b2a1361 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CircuitAtomDistance.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section1b +import LeanPool.GraphMinor.GM12.Section4CircuitWalk +import LeanPool.GraphMinor.GM12.Section4WalkMetric +import LeanPool.GraphMinor.GM11.Section4 + +/-! +# Atoms meeting a short circuit inside are close + +Claim (1) in XII (4.3), page 250, puts a nonfree edge and one of +the chosen distant edges in the inside of a radial circuit of length +two. Traverse that circuit once. The corresponding atoms lie in +the walk inside by XII's corresponding-atom lemma, so the traversal +witnesses their distance. Its half-length is the number of original +vertices on the radial circuit. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM14 + +/-- Atoms meeting the inside of a short radial circuit have distance +at most half the circuit length. This is the metric step of claim +(1) in XII (4.3), page 250. -/ +theorem atom_distance_le_circuit_vertex_count + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K C : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + (hC : C.IsCircuit) (hCs : C.IsSubdrawing K) (hCl : C.length < 2 * θ) + {x y : Set S} (hx : x ∈ Γ.A) (hy : y ∈ Γ.A) + (hxC : (x ∩ ins C).Nonempty) (hyC : (y ∩ ins C).Nonempty) : + tangleMetric Γ K ins θ x y ≤ (C.V ∩ Γ.V).ncard := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨x', hx', _⟩ := existsUnique_correspondingAtom hK hx + obtain ⟨y', hy', _⟩ := existsUnique_correspondingAtom hK hy + have hCcopy := hC + obtain ⟨u, U, _, _, hV, _⟩ := hCcopy + have huC : u ∈ C.V := hV ▸ U.start_mem_support + obtain ⟨W, hWC, hlen⟩ := circuit_walk_at hC hCs huC + have hshort : W.length < 2 * θ := hlen ▸ hCl + have hins : ins C ⊆ insWalk ins K W := by + intro z hz + exact Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, by rw [hWC]; exact ⟨subset_rfl, subset_rfl⟩⟩, hz⟩) + have hxW := (corresponding_atom_subset_iff hS hK hd hx' W hshort).mpr + (hxC.mono (inter_subset_inter_right x hins)) + have hyW := (corresponding_atom_subset_iff hS hK hd hy' W hshort).mpr + (hyC.mono (inter_subset_inter_right y hins)) + exact tangleMetric_le_of_walk hx' hy' W hshort + (hlen.trans (circuit_length_eq_two_mul_ncard hK.2.1 hC hCs).1) hxW hyW + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CircuitMeet.lean b/LeanPool/GraphMinor/GM12/Section4CircuitMeet.lean new file mode 100644 index 0000000000..8e8243029f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CircuitMeet.lean @@ -0,0 +1,126 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.Section7 +import LeanPool.GraphMinor.GM11.Separate + +/-! +# Intersections of maximal circuit insides + +The circuit-chain distance calculation of XII (4.1), page 248, can be +witnessed by a closed walk along the circuit boundaries. To join those +walks, retain maximal circuit insides. Two such insides that meet have +boundaries that meet: otherwise XI (7.7) makes them nested. The second +tangle condition rules out their covering the surface. Subdrawings of one drawing +whose point sets meet have a vertex in common. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM10 GM11 GM14 + +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +private theorem preconnected_oArc {F : Set S} (hF : IsOArc F) : IsPreconnected F := + GraphMinor.Surface.IsOArc.isPreconnected hF + +omit [T2Space S] in +/-- A point of a subdrawing that is an ambient vertex is a vertex of the +subdrawing. An edge closure has the same ends in both drawings. -/ +theorem subdrawing_vertex_of_mem_U {C K : Drawing S} (hs : C.IsSubdrawing K) + {x : S} (hx : x ∈ C.U) (hxK : x ∈ K.V) : x ∈ C.V := by + rw [C.U_eq] at hx + rcases hx with hx | hx + · exact hx + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + have hm : x ∈ closure e ∩ C.V := by + rw [hs.closure_inter_V he] + exact ⟨hxe, hxK⟩ + exact hm.2 + +omit [T2Space S] in +/-- Two subdrawings with a common point have a common vertex. If that +point is in an edge, both drawings contain that edge and its ends. -/ +theorem subdrawings_common_vertex {C D K : Drawing S} + (hC : C.IsSubdrawing K) (hD : D.IsSubdrawing K) + (h : (C.U ∩ D.U).Nonempty) : (C.V ∩ D.V).Nonempty := by + obtain ⟨x, hxC, hxD⟩ := h + by_cases hxK : x ∈ K.V + · exact ⟨x, subdrawing_vertex_of_mem_U hC hxC hxK, + subdrawing_vertex_of_mem_U hD hxD hxK⟩ + obtain ⟨e, heC, hxe⟩ := C.exists_edge_of_mem hxC (fun hx => hxK (hC.1 hx)) + obtain ⟨f, hfD, hxf⟩ := D.exists_edge_of_mem hxD (fun hx => hxK (hD.1 hx)) + have hef : e = f := K.edge_eq_of_mem (hC.2 heC) (hD.2 hfD) hxe hxf + subst f + obtain ⟨y, z, hl⟩ := C.toGraph.exists_isLink_of_mem_edgeSet heC + have hy : y ∈ closure e := by + have : y ∈ closure e ∩ C.V := by rw [hl.2.2.2]; simp + exact this.1 + have hm : y ∈ closure e ∩ D.V := by + rw [hD.closure_inter_V hfD] + exact ⟨hy, hC.1 hl.left_mem⟩ + exact ⟨y, hl.left_mem, hm.2⟩ + +/-- Overlapping maximal circuit insides have a common boundary vertex. +This supplies insertion points for the closed-walk form of the first +inequality in XII (4.1), page 248. -/ +theorem common_vertex_of_maximal_insides [ConnectedSpace S] + {Γ K C D : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} + (hT : IsPretangle Γ.toHypergraph θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + (hC : C.IsCircuit) (hCs : C.IsSubdrawing K) (hCl : C.length < 2 * θ) + (hD : D.IsCircuit) (hDs : D.IsSubdrawing K) (hDl : D.length < 2 * θ) + (hmaxC : ins C ⊆ ins D → ins D ⊆ ins C) + (hmaxD : ins D ⊆ ins C → ins C ⊆ ins D) + (hmeet : (ins C ∩ ins D).Nonempty) : (C.V ∩ D.V).Nonempty := by + obtain ⟨hdiscC, hbdC, hmC⟩ := hd C hC hCs hCl + obtain ⟨hdiscD, hbdD, hmD⟩ := hd D hD hDs hDl + have hneq : ins C ∪ ins D ≠ univ := by + intro heq + have hfrC : frontier (ins C) ⊆ K.U := by + rw [← subBd_eq_frontier, hbdC] + exact hCs.U_subset + have hfrD : frontier (ins D) ⊆ K.U := by + rw [← subBd_eq_frontier, hbdD] + exact hDs.U_subset + apply not_cover (Γ := .drawing Γ) (Γ' := K) hT hK.2.1.1 hdiscC.isClosed hdiscD.isClosed + hdiscD.isClosed + hfrC hfrD hfrD hmC hmD hmD + rw [Set.union_assoc, Set.union_self, heq] + apply subdrawings_common_vertex hCs hDs + by_contra hn + have hdisj : Disjoint (subBd (ins C)) (subBd (ins D)) := by + rw [hbdC, hbdD] + exact disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp hn) + have hpreC : IsPreconnected (subBd (ins C)) := by + rw [hbdC] + exact preconnected_oArc (IsCircuit.isOArc_U hC) + have hpreD : IsPreconnected (subBd (ins D)) := by + rw [hbdD] + exact preconnected_oArc (IsCircuit.isOArc_U hD) + have heq : ins C = ins D := by + rcases theorem_7_7_proof hpreC hpreD hmeet hneq hdisj with h | h + · exact subset_antisymm h (hmaxC h) + · exact subset_antisymm (hmaxD h) h + have hUeq : C.U = D.U := hbdC.symm.trans ((congrArg subBd heq).trans hbdD) + obtain ⟨u, W, _, _, hV, _⟩ := hC + have hu : u ∈ C.U := C.V_subset_U (hV ▸ W.start_mem_support) + exact hn ⟨u, hu, hUeq ▸ hu⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CircuitWalk.lean b/LeanPool/GraphMinor/GM12/Section4CircuitWalk.lean new file mode 100644 index 0000000000..5354cbc064 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CircuitWalk.lean @@ -0,0 +1,116 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.Section4 +import Mathlib.Algebra.BigOperators.Fin + +/-! +# Traversing a chain of radial circuits + +For the first distance inequality of XII (4.1), page 248, the circuit +costs may be added by traversing their boundaries. Insert a circuit walk +at a vertex shared with the walk already built. No edge traversal is +added except those of the new circuit, so the lengths add exactly. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- Insert a closed walk at a vertex of another closed walk. The result +contains both drawings and has the sum of their lengths. -/ +theorem splice_closed_walks {K : Drawing S} {u v : S} + (W : GraphWalk K.toGraph u u) (V : GraphWalk K.toGraph v v) + (hv : v ∈ W.support) : + ∃ R : GraphWalk K.toGraph u u, R.length = W.length + V.length ∧ + (walkDrawing K W).IsSubdrawing (walkDrawing K R) ∧ + (walkDrawing K V).IsSubdrawing (walkDrawing K R) := by + obtain ⟨W₁, W₂, rfl⟩ := W.exists_append_of_mem hv + refine ⟨W₁.append (V.append W₂), ?_, ?_, ?_⟩ + · simp only [GraphWalk.length_append] + omega + · constructor + · intro x hx + simp only [walkDrawing_V, mem_ofPred_eq, GraphWalk.mem_support_append] at hx ⊢ + exact hx.elim Or.inl (fun h => Or.inr (Or.inr h)) + · intro e he + simp only [walkDrawing_E, mem_ofPred_eq, GraphWalk.edges_append, List.mem_append] at he ⊢ + exact he.elim Or.inl (fun h => Or.inr (Or.inr h)) + · constructor + · intro x hx + simp only [walkDrawing_V, mem_ofPred_eq, GraphWalk.mem_support_append] at hx ⊢ + exact Or.inr (Or.inl hx) + · intro e he + simp only [walkDrawing_E, mem_ofPred_eq, GraphWalk.edges_append, List.mem_append] at he ⊢ + exact Or.inr (Or.inl he) + +/-- A circuit can be traversed once from any of its vertices, as a walk +of the ambient drawing. -/ +theorem circuit_walk_at {K C : Drawing S} (hC : C.IsCircuit) + (hCs : C.IsSubdrawing K) {x : S} (hx : x ∈ C.V) : + ∃ W : GraphWalk K.toGraph x x, walkDrawing K W = C ∧ W.length = C.length := by + obtain ⟨W₀, ⟨_, hnd⟩, _, hV, hE⟩ := exists_walk_at hC hx + obtain ⟨W, hs, he⟩ := hCs.exists_walk_up W₀ + refine ⟨W, Drawing.ext_of_V_E ?_ ?_, ?_⟩ + · rw [walkDrawing_V, hs, hV] + · rw [walkDrawing_E, he, hE] + · rw [Drawing.length, hE, ← he] + have heq : {e | e ∈ W.edges} = (W.edges.toFinset : Set (Set S)) := by + ext e + simp + rw [heq, ncard_coe_finset, List.toFinset_card_of_nodup (he ▸ hnd)] + rfl + +/-- Traverse each circuit of a chain once. Adjacent boundaries share a +vertex, so insertion gives one closed walk covering every circuit. -/ +theorem closed_walk_covering_circuit_chain {K : Drawing S} {n : ℕ} + (C : Fin (n + 1) → Drawing S) + (hC : ∀ i, (C i).IsCircuit) (hs : ∀ i, (C i).IsSubdrawing K) + (hmeet : ∀ i : Fin n, ((C i.castSucc).V ∩ (C i.succ).V).Nonempty) : + ∃ (u : S) (W : GraphWalk K.toGraph u u), + W.length = ∑ i, (C i).length ∧ + ∀ i, (C i).IsSubdrawing (walkDrawing K W) := by + induction n with + | zero => + obtain ⟨u, W₀, _, _, hV, _⟩ := hC 0 + have hu : u ∈ (C 0).V := hV ▸ W₀.start_mem_support + obtain ⟨W, hW, hlen⟩ := circuit_walk_at (hC 0) (hs 0) hu + refine ⟨u, W, ?_, ?_⟩ + · simpa using hlen + · intro i + have hi : i = 0 := Fin.eq_zero i + subst i + rw [hW] + exact ⟨subset_rfl, subset_rfl⟩ + | succ n ih => + obtain ⟨u, W, hlen, hcover⟩ := ih (fun i => C i.succ) + (fun i => hC i.succ) (fun i => hs i.succ) (fun i => hmeet i.succ) + obtain ⟨x, hx, hx'⟩ := hmeet 0 + have hxW : x ∈ W.support := by + simpa only [walkDrawing_V, mem_ofPred_eq] using (hcover 0).1 hx' + obtain ⟨V, hV, hVlen⟩ := circuit_walk_at (hC 0) (hs 0) hx + obtain ⟨R, hRlen, hWR, hVR⟩ := splice_closed_walks W V hxW + refine ⟨u, R, ?_, ?_⟩ + · rw [hRlen, hlen, hVlen] + conv_rhs => rw [Fin.sum_univ_succ] + exact Nat.add_comm _ _ + · intro i + refine Fin.cases ?_ (fun j => ?_) i + · rw [← hV] + exact hVR + · exact ⟨(hcover j).1.trans hWR.1, (hcover j).2.trans hWR.2⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ClippedHalfEdges.lean b/LeanPool/GraphMinor/GM12/Section4ClippedHalfEdges.lean new file mode 100644 index 0000000000..8b063aeb76 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ClippedHalfEdges.lean @@ -0,0 +1,121 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CrossingVertexDiscs +public import LeanPool.GraphMinor.GM12.Section4ResidualArc +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Clipping the half-edges outside the crossing discs + +For XII (4.5), claim (1), page 253, split each subdivided edge +at its crossing and clip each half between its vertex disc and +the crossing-disc set. The residual arcs meet the two closed +sets only at their ends. Every meeting of different half-edges +was either an original vertex or a crossing. Both types of +points lie in the interiors of the sets removed, so the +residual arcs are disjoint. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Topology + +/-- The half-edges of a crossing drawing give disjoint residual +arcs between their vertex discs and the crossing-disc set. +This proves the residual-arc step of XII (4.5), claim (1), +page 253. -/ +theorem exists_clipped_halfedge_family + {S V ι : Type*} [TopologicalSpace S] [T2Space S] [Finite V] [Finite ι] + (hS : IsClosedSurface S) (v : V → S) (hinj : Function.Injective v) + (owner : ι → V) (x : ι → S) (L : ι → Set S) + (hL : ∀ i, IsLineWithEnds (L i) (v (owner i)) (x i)) + (hLV : ∀ i w, v w ∈ L i → w = owner i) + (hLL : ∀ i j, i ≠ j → L i ∩ L j ⊆ range v ∪ range x) + (Z : Set S) (hZ : IsClosed Z) (hvZ : ∀ w, v w ∉ Z) + (hxZ : ∀ i, x i ∈ interior Z) : + ∃ (A : V → Set S) (b : ι → unitInterval → S), + (∀ w, IsClosedDisc (A w)) ∧ + (∀ w z, w ≠ z → Disjoint (A w) (A z)) ∧ + (∀ w, Disjoint (A w) Z) ∧ + (∀ i, IsArcMap (b i)) ∧ + (∀ i j, i ≠ j → Disjoint (range (b i)) (range (b j))) ∧ + (∀ i, b i 0 ∈ discBd (A (owner i))) ∧ + (∀ i, b i 1 ∈ Z) ∧ + (∀ i, range (b i) ∩ (Z ∪ ⋃ w, A w) = {b i 0, b i 1}) ∧ + (∀ i, range (b i) ⊆ L i) ∧ (∀ i, b i 1 ∈ frontier Z) := by + classical + obtain ⟨A, hA, hAA, hAZ, hAL⟩ := exists_crossing_vertex_disc_family hS v hinj owner L + (fun i => (hL i).isCompact.isClosed) hLV Z hZ hvZ + let C := ⋃ w, A w + have hC : IsClosed C := isClosed_iUnion_of_finite (fun w => (hA w).1.isClosed) + have hCZ : Disjoint C Z := disjoint_left.mpr (by + rintro z hz hzZ + obtain ⟨w, hw⟩ := mem_iUnion.mp hz + exact disjoint_left.mp (hAZ w) hw hzZ) + have hvC : ∀ w, v w ∈ interior C := fun w => + interior_mono (subset_iUnion A w) (hA w).2 + have hex : ∀ i, ∃ b : unitInterval → S, IsArcMap b ∧ range b ⊆ L i ∧ + b 0 ∈ frontier C ∧ b 1 ∈ frontier Z ∧ + range b ∩ C = {b 0} ∧ range b ∩ Z = {b 1} := by + intro i + obtain ⟨a, ha, har, ha0, ha1⟩ := (hL i).exists_arc + obtain ⟨b, hb, hba, hb0, hb1, hbC, hbZ⟩ := exists_residual_arc_between_closed_sets ha + hC hZ hCZ (ha0 ▸ interior_subset (hvC (owner i))) (ha1 ▸ interior_subset (hxZ i)) + exact ⟨b, hb, hba.trans har.subset, hb0, hb1, hbC, hbZ⟩ + choose b hb hsub hb0 hb1 hbC hbZ using hex + have hb1Z : ∀ i, b i 1 ∈ Z := fun i => + ((hbZ i).symm.subset (mem_singleton _)).2 + have hb0A : ∀ i, b i 0 ∈ A (owner i) := by + intro i + have hb0C : b i 0 ∈ C := ((hbC i).symm.subset (mem_singleton _)).2 + obtain ⟨w, hw⟩ := mem_iUnion.mp hb0C + by_cases hwo : w = owner i + · exact hwo ▸ hw + · exact False.elim (disjoint_left.mp (hAL w i hwo) hw (hsub i (mem_range_self 0))) + have hb0bd : ∀ i, b i 0 ∈ discBd (A (owner i)) := by + intro i + rw [← GM11.IsClosedDisc.frontier_eq_discBd hS (hA (owner i)).1] + refine ⟨subset_closure (hb0A i), ?_⟩ + intro hint + exact (hb0 i).2 (interior_mono (subset_iUnion A (owner i)) hint) + have hmissV : ∀ i, Disjoint (range (b i)) (range v) := by + intro i + apply disjoint_left.mpr + rintro z hzb ⟨w, hw⟩ + have hzC : z ∈ C := hw ▸ interior_subset (hvC w) + have hz0 : z = b i 0 := mem_singleton_iff.mp ((hbC i).subset ⟨hzb, hzC⟩) + exact (hb0 i).2 (hz0 ▸ (hw ▸ hvC w)) + have hmissX : ∀ i, Disjoint (range (b i)) (range x) := by + intro i + apply disjoint_left.mpr + rintro z hzb ⟨j, hj⟩ + have hzZ : z ∈ Z := hj ▸ interior_subset (hxZ j) + have hz1 : z = b i 1 := mem_singleton_iff.mp ((hbZ i).subset ⟨hzb, hzZ⟩) + exact (hb1 i).2 (hz1 ▸ (hj ▸ hxZ j)) + have hbb : ∀ i j, i ≠ j → Disjoint (range (b i)) (range (b j)) := by + intro i j hij + apply disjoint_left.mpr + intro z hzi hzj + rcases hLL i j hij ⟨hsub i hzi, hsub j hzj⟩ with hzV | hzX + · exact disjoint_left.mp (hmissV i) hzi hzV + · exact disjoint_left.mp (hmissX i) hzi hzX + refine ⟨A, b, (fun w => (hA w).1), hAA, hAZ, hb, hbb, hb0bd, hb1Z, ?_, hsub, hb1⟩ + intro i + change range (b i) ∩ (Z ∪ C) = _ + rw [inter_union_distrib_left, hbZ i, hbC i] + exact pair_comm _ _ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CliqueControlMonotone.lean b/LeanPool/GraphMinor/GM12/Section4CliqueControlMonotone.lean new file mode 100644 index 0000000000..674deab784 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CliqueControlMonotone.lean @@ -0,0 +1,72 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM16.Defs + +/-! +# Restricting a controlled complete-graph minor + +The small-parameter reduction in XII (4.5), page 252, can use +a larger complete graph. Retain the branches indexed by the +first vertices and the joining edges between those branches. +The smaller vertex count preserves the separation exclusion. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Hypergraph + +/-- Restrict the branches of a controlled clique minor to its +first vertices. This supplies the small-parameter reduction +in XII (4.5), page 252. -/ +theorem controlsMinor_completeGraph_mono + {α β : Type*} {G : Hypergraph α β} {θ p q : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} (hpq : p ≤ q) + (hc : ControlsMinor G θ T (GM16.completeGraph q)) : + ControlsMinor G θ T (GM16.completeGraph p) := by + obtain ⟨A, b, hA, hAA, hlink, hloop, hbinj, hθ, hcontrol⟩ := hc + let f : Fin p → Fin q := Fin.castLE hpq + have hf : Function.Injective f := Fin.castLE_injective hpq + have hmapE : ∀ e ∈ (GM16.completeGraph p).edgeSet, + Sym2.map f e ∈ (GM16.completeGraph q).edgeSet := by + rintro e ⟨x, y, hxy, rfl⟩ + exact ⟨f x, f y, (fun h => hxy (hf h)), rfl⟩ + have hcardp : (GM16.completeGraph p).vertexSet.ncard = p := by + change (univ : Set (Fin p)).ncard = p + simp + have hcardq : (GM16.completeGraph q).vertexSet.ncard = q := by + change (univ : Set (Fin q)).ncard = q + simp + refine ⟨fun v => A (f v), fun e => b (Sym2.map f e), + fun v _ => hA (f v) (mem_univ _), + fun v _ w _ hvw => hAA (f v) (mem_univ _) (f w) (mem_univ _) + (fun h => hvw (hf h)), ?_, ?_, ?_, ?_, ?_⟩ + · intro e u v hl huv + exact hlink (Sym2.map f e) (f u) (f v) + ⟨(fun h => hl.1 (hf h)), congrArg (Sym2.map f) hl.2⟩ (fun h => huv (hf h)) + · intro e v hl + exact False.elim (hl.1 rfl) + · intro e he g hg heg heq + have h := hbinj _ (hmapE e he) _ (hmapE g hg) + (fun h => heg (Sym2.map.injective hf h)) + exact h heq + · rw [hcardp] + exact hpq.trans (hcardq ▸ hθ) + · intro C D hCD hord v hv + apply hcontrol C D hCD + · rw [hcardq] + rw [hcardp] at hord + exact hord.trans_le hpq + · exact mem_univ _ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CliqueCrossingArcs.lean b/LeanPool/GraphMinor/GM12/Section4CliqueCrossingArcs.lean new file mode 100644 index 0000000000..2ea8937c87 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CliqueCrossingArcs.lean @@ -0,0 +1,94 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CliqueCrossingLabels +public import LeanPool.GraphMinor.GM12.Section4PortDrawing +import LeanPool.GraphMinor.GM12.Section4PortOrdering +import LeanPool.GraphMinor.GM12.Section4CliqueHamiltonArcs + +/-! +# A finite clique drawn by crossing arcs + +This assembles the source drawing in XII (4.5), pages 252--253. +Label the clique ports by ordered pairs of distinct vertices. +Sort them into vertex blocks with the Hamilton priorities, choose +arcs in general position, and convert their port positions to +vertex-pair coordinates. The crossing tests give a different +crossing edge for every edge. All witnesses are constructed here. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Surface + +/-- The finite crossing-arc construction for the source clique +in XII (4.5), pages 252--253. The arcs are simple, avoid nonincident +vertices, meet pairwise finitely, and have no triple meeting away +from vertices. Every edge has a different crossing edge. -/ +theorem exists_clique_crossing_arcs {p : ℕ} (hp : 4 ≤ p) : + ∃ ψ : (Fin (p * (p - 1) / 2) × Bool) ≃ {q : Fin p × Fin p // q.1 ≠ q.2}, + (∀ i b, (ψ (i, !b)).val = ((ψ (i, b)).val.2, (ψ (i, b)).val.1)) ∧ + ∃ (v : Fin p → ℂ) (s : Fin (p * (p - 1) / 2) × Bool → ℝ) + (E : Fin (p * (p - 1) / 2) → Set ℂ) (F : Fin p → Fin p → ℝ), + Function.Injective v ∧ (∀ i, 1 < ‖v i‖) ∧ + Function.Injective (fun x => (ee (s x) : ℂ)) ∧ (∀ x, s x ∈ Ioo 0 1) ∧ + (∀ i, IsLineWithEnds (E i) (v (ψ (i, false)).val.1) (v (ψ (i, true)).val.1)) ∧ + (∀ i j, v j ∈ E i ↔ j = (ψ (i, false)).val.1 ∨ j = (ψ (i, true)).val.1) ∧ + (∀ i, E i ∩ closedBall 0 1 = segment ℝ (ee (s (i, false)) : ℂ) (ee (s (i, true)) : ℂ)) ∧ + (∀ i j, i ≠ j → (E i ∩ E j).Finite) ∧ + (∀ i j, i ≠ j → E i ∩ E j ⊆ + (segment ℝ (ee (s (i, false)) : ℂ) (ee (s (i, true)) : ℂ) ∩ + segment ℝ (ee (s (j, false)) : ℂ) (ee (s (j, true)) : ℂ)) ∪ range v) ∧ + (∀ i j k, i ≠ j → j ≠ k → i ≠ k → E i ∩ E j ∩ E k ⊆ range v) ∧ + (∀ i, ∃ j, j ≠ i ∧ ∃ x : ℂ, x ∈ E i ∩ E j ∧ x ∉ range v) ∧ + (∀ w, ∃ i j, i ≠ j ∧ E i ∩ E j = {v w}) ∧ + (∀ v w, F v w ∈ Ioo 0 1) ∧ + (∀ v w i j, v < i → F v w < F i j) ∧ + (∀ v w z, hamiltonPortPriority v w < hamiltonPortPriority v z → F v w < F v z) ∧ + ∀ v w (hvw : v ≠ w), F v w = s (ψ.symm ⟨(v, w), hvw⟩) := by + obtain ⟨ψ, hψ⟩ := exists_clique_port_bijection p + let κ := fun x => (ψ x).val.1 + let priority := fun x => hamiltonPortPriority (ψ x).val.1 (ψ x).val.2 + obtain ⟨ρ, hρ, hρblocks, hρpriority⟩ := exists_port_ordering κ priority + have hκ : ∀ i, κ (i, false) ≠ κ (i, true) := by + intro i + have hflip := congrArg Prod.fst (hψ i false) + change (ψ (i, true)).val.1 = (ψ (i, false)).val.2 at hflip + change (ψ (i, false)).val.1 ≠ (ψ (i, true)).val.1 + rw [hflip] + exact (ψ (i, false)).property + obtain ⟨v, s, E, hvinj, hvnorm, hsinj, hs, hsorder, hEline, hEvertex, hEdisc, + _, hEfinite, hEinter, hEtriple, _⟩ := exists_port_edge_arcs κ hκ ρ hρ + have hsblocks : ∀ x y, (ψ x).val.1 < (ψ y).val.1 → s x < s y := + fun x y hxy => hsorder x y (hρblocks x y hxy) + have hspriority : ∀ x y, (ψ x).val.1 = (ψ y).val.1 → + hamiltonPortPriority (ψ x).val.1 (ψ x).val.2 < + hamiltonPortPriority (ψ y).val.1 (ψ y).val.2 → s x < s y := + fun x y hsame hlt => hsorder x y (hρpriority x y hsame hlt) + obtain ⟨F, hF, hFblocks, hFpriority, hcoord⟩ := + exists_clique_port_matrix hp ψ s hs hsblocks hspriority + have hcross : ∀ i, ∃ j, j ≠ i ∧ ∃ x : ℂ, x ∈ E i ∩ E j ∧ x ∉ range v := by + intro i + obtain ⟨j, hji, x, hxi, hxj⟩ := + every_labelled_clique_chord_has_crossing hp ψ hψ s F hF hFblocks hFpriority hcoord i + have hxEi : x ∈ E i ∩ closedBall (0 : ℂ) 1 := hEdisc i ▸ hxi + have hxEj : x ∈ E j ∩ closedBall (0 : ℂ) 1 := hEdisc j ▸ hxj + refine ⟨j, hji, x, ⟨hxEi.1, hxEj.1⟩, ?_⟩ + rintro ⟨k, rfl⟩ + exact (not_le_of_gt (hvnorm k)) (mem_closedBall_zero_iff.mp hxEi.2) + exact ⟨ψ, hψ, v, s, E, F, hvinj, hvnorm, hsinj, hs, hEline, hEvertex, + hEdisc, hEfinite, hEinter, hEtriple, hcross, + fun w => exists_two_incident_Hamilton_arcs (by omega : 3 ≤ p) ψ hψ s v E + hEvertex hEinter F hF hFblocks hFpriority hcoord w, + hF, hFblocks, hFpriority, hcoord⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CliqueCrossingLabels.lean b/LeanPool/GraphMinor/GM12/Section4CliqueCrossingLabels.lean new file mode 100644 index 0000000000..800fed9153 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CliqueCrossingLabels.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CliquePortCoordinates + +/-! +# Crossing witnesses with the original edge labels + +For XII (4.5), page 252, a crossing witness found using vertex +pairs must be another edge of the same finite clique. Invert the +port bijection to recover its edge label. Its new endpoint lies +outside the original pair, so the recovered edge label differs +from the original one. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Each labelled clique chord has a differently labelled crossing +chord. This transfers condition (vi) of XII (4.5), page 252, from +vertex pairs to the actual finite edge labels. -/ +theorem every_labelled_clique_chord_has_crossing {p : ℕ} (hp : 4 ≤ p) + (ψ : (Fin (p * (p - 1) / 2) × Bool) ≃ {q : Fin p × Fin p // q.1 ≠ q.2}) + (hψ : ∀ i b, (ψ (i, !b)).val = ((ψ (i, b)).val.2, (ψ (i, b)).val.1)) + (s : Fin (p * (p - 1) / 2) × Bool → ℝ) (F : Fin p → Fin p → ℝ) + (hF : ∀ v w, F v w ∈ Ioo 0 1) + (hblocks : ∀ v w i j, v < i → F v w < F i j) + (hpriority : ∀ v w z, hamiltonPortPriority v w < hamiltonPortPriority v z → F v w < F v z) + (hcoord : ∀ v w (hvw : v ≠ w), F v w = s (ψ.symm ⟨(v, w), hvw⟩)) + (i : Fin (p * (p - 1) / 2)) : + ∃ j : Fin (p * (p - 1) / 2), j ≠ i ∧ + (segment ℝ (ee (s (i, false)) : ℂ) (ee (s (i, true)) : ℂ) ∩ + segment ℝ (ee (s (j, false)) : ℂ) (ee (s (j, true)) : ℂ)).Nonempty := by + let v := (ψ (i, false)).val.1 + let w := (ψ (i, false)).val.2 + obtain ⟨x, y, hxy, hyv, hyw, _, hcross⟩ := + every_clique_chord_has_crossing hp F hF hblocks hpriority (ψ (i, false)).property + let q := ψ.symm ⟨(x, y), hxy⟩ + let j := q.1 + let b := q.2 + have hpair : (ψ (j, b)).val = (x, y) := + congrArg Subtype.val (ψ.apply_symm_apply ⟨(x, y), hxy⟩) + have hji : j ≠ i := by + intro hji + rw [hji] at hpair + cases hb : b + · rw [hb] at hpair + exact hyw (congrArg Prod.snd hpair).symm + · rw [hb] at hpair + have hflip := congrArg Prod.snd (hψ i false) + change (ψ (i, true)).val.2 = v at hflip + exact hyv ((congrArg Prod.snd hpair).symm.trans hflip) + have hfirst := clique_port_chord_eq_matrix ψ hψ s F hcoord i false + have hsecond := clique_port_chord_eq_matrix ψ hψ s F hcoord j b + rw [show (ψ (j, b)).val.1 = x from congrArg Prod.fst hpair, + show (ψ (j, b)).val.2 = y from congrArg Prod.snd hpair] at hsecond + exact ⟨j, hji, by rw [hfirst, hsecond]; exact hcross⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CliqueCrossingSource.lean b/LeanPool/GraphMinor/GM12/Section4CliqueCrossingSource.lean new file mode 100644 index 0000000000..e8d1cf1356 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CliqueCrossingSource.lean @@ -0,0 +1,113 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CliquePortGraph +public import LeanPool.GraphMinor.GM12.Section4SubdivisionCrossingModel +public import LeanPool.GraphMinor.GM12.Section4SubdivisionMeetings +public import LeanPool.GraphMinor.GM12.Section4SubdivisionIntersections +public import LeanPool.GraphMinor.GM12.Section4SubdivisionNoncrossing +import LeanPool.GraphMinor.GM12.Section4CliqueCrossingArcs +import LeanPool.GraphMinor.GM12.Section4FamilySubdivision +import LeanPool.GraphMinor.GM12.Section4CrossingMultiplicity + +/-! +# The complete one-crossing source for the clique minor + +This assembles the source construction of XII (4.5), pages +252--253, with no construction step as a hypothesis. Draw the +clique using the Hamilton-cycle port order, subdivide between +successive crossings, and identify the shared original ends. +The resulting finite graph has the clique as a minor, every +edge crosses exactly once, and every vertex has two incident +edges which do not cross each other. Every crossing has the +local straight-line model used to choose its small disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Graph + +/-- The actual finite one-crossing source graph and all its +geometric properties in XII (4.5), pages 252--253. The graph, +subdivision, clique minor, crossing count, noncrossing incident +pairs, and local coordinates are all constructed here. -/ +theorem exists_clique_one_crossing_source {p : ℕ} (hp : 4 ≤ p) : + ∃ (W F : Type) (L : Graph W F) (v : W → ℂ) (ends : F × Bool → W) (P : F → Set ℂ), + Finite W ∧ Finite F ∧ IsIsoMinor (GM16.completeGraph p) L ∧ Function.Injective v ∧ + L.vertexSet = univ ∧ L.edgeSet = univ ∧ + (∀ e, L.IsLink e (ends (e, false)) (ends (e, true))) ∧ + (∀ e, IsLineWithEnds (P e) (v (ends (e, false))) (v (ends (e, true)))) ∧ + (∀ e w, v w ∈ P e ↔ w = ends (e, false) ∨ w = ends (e, true)) ∧ + (∀ e f, e ≠ f → (P e ∩ P f).Finite) ∧ + (∀ e f g, e ≠ f → f ≠ g → e ≠ g → P e ∩ P f ∩ P g ⊆ range v) ∧ + (∀ e, ∃ x ∈ edgeMeetingPoints v P, P e ∩ edgeMeetingPoints v P = {x}) ∧ + (∀ w, ∃ e f, e ≠ f ∧ P e ∩ P f = {v w}) ∧ + (edgeMeetingPoints v P).Finite ∧ 2 ≤ (edgeMeetingPoints v P).ncard ∧ Nat.card F = 2 * + (edgeMeetingPoints v P).ncard ∧ + ∀ x ∈ edgeMeetingPoints v P, ∃ e f, e ≠ f ∧ x ∈ P e ∩ P f ∧ + ∃ (A : ℂ ≃L[ℝ] ℂ) (U : Set ℂ), IsOpen U ∧ x ∈ U ∧ + P e ∩ U = (line[ℝ, x, x + A 1] : Set ℂ) ∩ U ∧ + P f ∩ U = (line[ℝ, x, x + A Complex.I] : Set ℂ) ∩ U := by + classical + obtain ⟨ψ, hψ, V, s, E, _, hV, _, hs, _, hEline, hEvertex, hchord, hfinite, + hEinter, htriple, hcross, htwo, _, _, _, _⟩ := exists_clique_crossing_arcs hp + let κ := fun q => (ψ q).val.1 + obtain ⟨k, hk, w, P, hw, hw0, hwlast, hPline, hcover, hmeet, havoid, hinter, hPvertices, + _, hcount⟩ := exists_family_one_meeting_subdivision V κ E hEline hfinite htriple hcross + let W := SubdivisionVertex p (p * (p - 1) / 2) k + let F := Σ e : Fin (p * (p - 1) / 2), Fin (k e) + let L := subdivisionGraph κ k + let v := subdivisionPosition V k w + let P' := subdivisionEdgeArc k P + let ends : F × Bool → W := fun q => + if q.2 then subdivisionVertexAt κ k q.1.1 q.1.2.succ + else subdivisionVertexAt κ k q.1.1 q.1.2.castSucc + have hmem := family_cut_mem_original_edge E k hk w P hPline hcover + have hinternal := internal_family_cut_not_mem_vertices V κ E k w hw hw0 hwlast hmem hEvertex + have hvinj := subdivisionPosition_injective V E k w hV hw hmem havoid hinternal + have hM := edgeMeetingPoints_subdivision_eq V κ E k hk w P hw0 hwlast hPline hcover havoid hinter + have hMfinite : (edgeMeetingPoints v P').Finite := by + rw [hM] + exact finite_edgeMeetingPoints V E hfinite + refine ⟨W, F, L, v, ends, P', inferInstance, inferInstance, + completeGraph_isIsoMinor_port_subdivision ψ hψ k hk, hvinj, rfl, rfl, + ?_, ?_, ?_, ?_, ?_, ?_, ?_, hMfinite, ?_, ?_, ?_⟩ + · intro e + exact subdivisionGraph_isLink κ k e.1 e.2 + · intro e + exact subdivisionEdgeArc_isLine V κ k hk w P hw0 hwlast hPline e + · intro e z + change subdivisionPosition V k w z ∈ subdivisionEdgeArc k P e ↔ + z = subdivisionVertexAt κ k e.1 e.2.castSucc ∨ z = subdivisionVertexAt κ k e.1 e.2.succ + rw [subdivisionEdgeArc_vertex_inc_iff V κ E k hk w P hV hw hw0 hwlast hPline hcover + havoid hPvertices hEvertex, subdivisionGraph_inc_iff] + · intro e f hef + exact finite_subdivisionEdgeArc_inter E k w P hcover hinter hfinite hef + · exact subdivisionEdgeArcs_triple_subset_vertices V κ E k hk w P hw0 hwlast hcover hinter htriple + · exact subdivisionEdgeArc_one_meeting V κ E k hk w P hw0 hwlast hPline hcover havoid hinter hmeet + · exact subdivision_has_two_noncrossing_arcs V E k w P hw hPline hcover hinter hPvertices htwo + · let z : W := Sum.inl ⟨0, by omega⟩ + obtain ⟨e, f, _, hef⟩ := subdivision_has_two_noncrossing_arcs V E k w P hw + hPline hcover hinter hPvertices htwo z + exact two_le_ncard_meetings_of_noncrossing_pair v P' hMfinite + (subdivisionEdgeArc_one_meeting V κ E k hk w P hw0 hwlast hPline hcover havoid hinter hmeet) + hef + · rw [Nat.card_eq_fintype_card, hM] + exact hcount + · intro x hx + have hxold : x ∈ edgeMeetingPoints V E := hM ▸ hx + obtain ⟨e, f, i, j, hef, hxP, A, U, hU, hxU, hl, hr⟩ := + exists_subdivision_crossing_model V E s hs hchord hEinter k w P hPline hcover havoid hinter + hxold + exact ⟨⟨e, i⟩, ⟨f, j⟩, (fun h => hef (congrArg Sigma.fst h)), hxP, A, U, hU, hxU, hl, hr⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CliqueEdges.lean b/LeanPool/GraphMinor/GM12/Section4CliqueEdges.lean new file mode 100644 index 0000000000..7e328d82e3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CliqueEdges.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM12.Section4PairEnumeration + +/-! +# The clique edge enumeration and its ordered ends + +In XII (4.4), page 251, each path label stands for one pair of +clique vertices. Sending a pair with smaller endpoint first to its +unordered pair is a bijection with the edges of the complete graph. +This keeps the path labels aligned with the actual target edge +labels when the enlarged branches form a controlled minor. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph + +/-- The smaller endpoint in the enumeration by larger endpoint. -/ +@[expose] def cliquePairLower {p : ℕ} (e : Σ j : Fin p, Fin j.val) : Fin p := + ⟨e.2.val, e.2.isLt.trans e.1.isLt⟩ + +theorem cliquePairLower_lt {p : ℕ} (e : Σ j : Fin p, Fin j.val) : + cliquePairLower e < e.1 := e.2.isLt + +/-- The lower and upper endpoints determine the sorted clique edge. -/ +theorem cliquePair_ends_injective {p : ℕ} : + Function.Injective (fun e : Σ j : Fin p, Fin j.val => (cliquePairLower e, e.1)) := by + rintro ⟨j, i⟩ ⟨k, l⟩ heq + have hupper : j = k := congrArg Prod.snd heq + subst k + have hlower := congrArg (fun q : Fin p × Fin p => q.1.val) heq + have hil : i = l := Fin.ext hlower + subst l + rfl + +/-- The sorted pairs are in bijection with the actual edge set of +the clique, as in XII (4.4), page 251. -/ +noncomputable def cliquePairEdgeEquiv (p : ℕ) : + (Σ j : Fin p, Fin j.val) ≃ (GM16.completeGraph p).edgeSet := by + let f : (Σ j : Fin p, Fin j.val) → (GM16.completeGraph p).edgeSet := fun e => + ⟨s(cliquePairLower e, e.1), cliquePairLower e, e.1, (cliquePairLower_lt e).ne, rfl⟩ + have hf : Function.Injective f := by + intro e e' heq + have hpair := congrArg Subtype.val heq + rcases Sym2.eq_iff.mp hpair with ⟨hl, hu⟩ | ⟨hl, hu⟩ + · exact cliquePair_ends_injective (Prod.ext hl hu) + · have he := cliquePairLower_lt e + have he' := cliquePairLower_lt e' + rw [hl, hu] at he + exact False.elim (lt_asymm he he') + have hs : Function.Surjective f := by + rintro ⟨e, x, y, hxy, he⟩ + subst e + rcases lt_or_gt_of_ne hxy with hlt | hgt + · refine ⟨⟨y, ⟨x.val, hlt⟩⟩, Subtype.ext ?_⟩ + rfl + · refine ⟨⟨x, ⟨y.val, hgt⟩⟩, Subtype.ext ?_⟩ + exact Sym2.eq_swap + exact Equiv.ofBijective f ⟨hf, hs⟩ + +/-- The complete graph's edge labels can be matched with the path +indices, retaining the corresponding ordered vertex pair. -/ +noncomputable def cliqueEdgeEnumeration (p : ℕ) : + Fin (p * (p - 1) / 2) ≃ (GM16.completeGraph p).edgeSet := + (Classical.choice (nonempty_clique_pair_enumeration p)).trans (cliquePairEdgeEquiv p) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CliqueHamiltonArcs.lean b/LeanPool/GraphMinor/GM12/Section4CliqueHamiltonArcs.lean new file mode 100644 index 0000000000..a5e72a5ac8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CliqueHamiltonArcs.lean @@ -0,0 +1,99 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CliquePortCoordinates +public import LeanPool.GraphMinor.GM12.Section4HamiltonChordSeparation + +/-! +# The two Hamilton edge arcs at each vertex + +In XII (4.5), page 252, each vertex has two incident edges that +do not cross. Their Hamilton chords are disjoint. Any other +intersection of their complete arcs is an outer vertex, and their +only common endpoint is the chosen vertex. Thus their complete +arcs meet exactly at that vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The incoming and outgoing Hamilton edge arcs meet exactly +at their common vertex. This verifies condition (vii) of the source +construction in XII (4.5), page 252, for the complete edge arcs. -/ +theorem exists_two_incident_Hamilton_arcs {p : ℕ} (hp : 3 ≤ p) + (ψ : (Fin (p * (p - 1) / 2) × Bool) ≃ {q : Fin p × Fin p // q.1 ≠ q.2}) + (hψ : ∀ i b, (ψ (i, !b)).val = ((ψ (i, b)).val.2, (ψ (i, b)).val.1)) + (s : Fin (p * (p - 1) / 2) × Bool → ℝ) + (V : Fin p → ℂ) (E : Fin (p * (p - 1) / 2) → Set ℂ) + (hEvertex : ∀ i j, V j ∈ E i ↔ j = (ψ (i, false)).val.1 ∨ j = (ψ (i, true)).val.1) + (hEinter : ∀ i j, i ≠ j → E i ∩ E j ⊆ + (segment ℝ (ee (s (i, false)) : ℂ) (ee (s (i, true)) : ℂ) ∩ + segment ℝ (ee (s (j, false)) : ℂ) (ee (s (j, true)) : ℂ)) ∪ range V) + (F : Fin p → Fin p → ℝ) (hF : ∀ v w, F v w ∈ Ioo 0 1) + (hblocks : ∀ v w i j, v < i → F v w < F i j) + (hpriority : ∀ v w z, hamiltonPortPriority v w < hamiltonPortPriority v z → F v w < F v z) + (hcoord : ∀ v w (hvw : v ≠ w), F v w = s (ψ.symm ⟨(v, w), hvw⟩)) (v : Fin p) : + ∃ i j : Fin (p * (p - 1) / 2), i ≠ j ∧ E i ∩ E j = {V v} := by + let pre := (finRotate p).symm v + let next := finRotate p v + have hvpre : v ≠ pre := Ne.symm (finRotate_predecessor_ne_self_of_two_le (by omega : 2 ≤ p) v) + have hvnext : v ≠ next := Ne.symm (finRotate_ne_self_of_two_le (by omega : 2 ≤ p) v) + let q := ψ.symm ⟨(v, pre), hvpre⟩ + let r := ψ.symm ⟨(v, next), hvnext⟩ + let i := q.1 + let j := r.1 + have hq : (ψ (i, q.2)).val = (v, pre) := + congrArg Subtype.val (ψ.apply_symm_apply ⟨(v, pre), hvpre⟩) + have hr : (ψ (j, r.2)).val = (v, next) := + congrArg Subtype.val (ψ.apply_symm_apply ⟨(v, next), hvnext⟩) + have hfirst := clique_port_chord_eq_matrix ψ hψ s F hcoord i q.2 + have hsecond := clique_port_chord_eq_matrix ψ hψ s F hcoord j r.2 + rw [show (ψ (i, q.2)).val.1 = v from congrArg Prod.fst hq, + show (ψ (i, q.2)).val.2 = pre from congrArg Prod.snd hq] at hfirst + rw [show (ψ (j, r.2)).val.1 = v from congrArg Prod.fst hr, + show (ψ (j, r.2)).val.2 = next from congrArg Prod.snd hr] at hsecond + have hdisj := hamilton_matrix_chords_disjoint hp F hF hblocks hpriority v + rw [segment_symm ℝ (ee (F pre v) : ℂ) (ee (F v pre) : ℂ), ← hfirst, ← hsecond] at hdisj + have hij : i ≠ j := by + intro heq + rw [heq] at hdisj + exact disjoint_left.mp hdisj (left_mem_segment _ _ _) (left_mem_segment _ _ _) + have hendsI := clique_port_endpoint_set ψ hψ i q.2 + have hendsJ := clique_port_endpoint_set ψ hψ j r.2 + rw [show (ψ (i, q.2)).val.1 = v from congrArg Prod.fst hq, + show (ψ (i, q.2)).val.2 = pre from congrArg Prod.snd hq] at hendsI + rw [show (ψ (j, r.2)).val.1 = v from congrArg Prod.fst hr, + show (ψ (j, r.2)).val.2 = next from congrArg Prod.snd hr] at hendsJ + have hVI : ∀ t, V t ∈ E i ↔ t ∈ ({v, pre} : Set (Fin p)) := by + intro t + rw [← hendsI] + exact hEvertex i t + have hVJ : ∀ t, V t ∈ E j ↔ t ∈ ({v, next} : Set (Fin p)) := by + intro t + rw [← hendsJ] + exact hEvertex j t + refine ⟨i, j, hij, ?_⟩ + ext x + constructor + · intro hx + rcases hEinter i j hij hx with hchord | ⟨t, rfl⟩ + · exact False.elim (disjoint_left.mp hdisj hchord.1 hchord.2) + · rcases (hVI t).mp hx.1 with htv | htpre + · exact congrArg V htv + · rcases (hVJ t).mp hx.2 with htv | htnext + · exact congrArg V htv + · exact False.elim (finRotate_predecessor_ne_successor hp v (htpre.symm.trans htnext)) + · rintro rfl + exact ⟨(hVI v).mpr (Or.inl rfl), (hVJ v).mpr (Or.inl rfl)⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CliqueLabels.lean b/LeanPool/GraphMinor/GM12/Section4CliqueLabels.lean new file mode 100644 index 0000000000..83cafb8fe3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CliqueLabels.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM12.Section4EndPartition +import LeanPool.GraphMinor.GM12.Section4CliqueEdges +import LeanPool.GraphMinor.GM12.Section4IsoIncidence +import LeanPool.GraphMinor.GM12.Section4TargetOrientation + +/-! +# Labelling and orienting the clique edges + +XII (4.4), pages 251--252, indexes the paths by the pairs of clique +vertices. Relabel the complete graph's edges with those indices and +orient them arbitrarily. When there are at least three vertices, +each vertex receives endpoints from two distinct indexed edges. +These two points supply the control bound at the end of the proof. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph + +/-- Each clique vertex has two distinct incident edges when the +clique has at least three vertices. -/ +theorem completeGraph_two_incident_edges {p : ℕ} (hp : 3 ≤ p) : + ∀ v ∈ (GM16.completeGraph p).vertexSet, + ∃ e f, e ≠ f ∧ (GM16.completeGraph p).Inc e v ∧ (GM16.completeGraph p).Inc f v := by + intro v _ + obtain ⟨w, z, hwv, hzv, hwz⟩ := exists_two_other_clique_vertices hp v + refine ⟨s(v, w), s(v, z), ?_, ⟨w, ⟨hwv.symm, rfl⟩⟩, ⟨z, ⟨hzv.symm, rfl⟩⟩⟩ + intro heq + rcases Sym2.eq_iff.mp heq with ⟨_, hwz'⟩ | ⟨hvz, _⟩ + · exact hwz hwz' + · exact hzv hvz.symm + +/-- A clique with finitely indexed oriented edges and the two-edge +end witnesses needed in XII (4.4), page 252. -/ +theorem exists_oriented_clique_labels {p : ℕ} (hp : 3 ≤ p) : + ∃ (K : Graph (Fin p) (Fin (p * (p - 1) / 2))) + (κ : Fin (p * (p - 1) / 2) × Bool → Fin p), + K.vertexSet = univ ∧ K.edgeSet = univ ∧ Nonempty (Iso K (GM16.completeGraph p)) ∧ + (∀ e v, ¬ K.IsLink e v v) ∧ + (∀ e u v, K.IsLink e u v → + (κ (e, true) = u ∧ κ (e, false) = v) ∨ + (κ (e, true) = v ∧ κ (e, false) = u)) ∧ + ∀ v ∈ K.vertexSet, ∃ i j, i ≠ j ∧ + ∃ c d : Bool, κ (i, c) = v ∧ κ (j, d) = v := by + let ε := cliqueEdgeEnumeration p + let K : Graph (Fin p) (Fin (p * (p - 1) / 2)) := { + vertexSet := univ + edgeSet := univ + IsLink := fun e u v => (GM16.completeGraph p).IsLink (ε e).val u v + isLink_symm := by intro e he; exact ⟨fun _ _ h => h.symm⟩ + eq_or_eq_of_isLink_of_isLink := by + intro e x y v w hxy hvw + exact (GM16.completeGraph p).eq_or_eq_of_isLink_of_isLink hxy hvw + edge_mem_iff_exists_isLink := by + intro e + exact ⟨fun _ => (GM16.completeGraph p).exists_isLink_of_mem_edgeSet (ε e).property, + fun _ => mem_univ e⟩ + left_mem_of_isLink := by intro e x y h; exact mem_univ x } + let eEquiv : K.edgeSet ≃ (GM16.completeGraph p).edgeSet := { + toFun := fun e => ε e.val + invFun := fun e => ⟨ε.symm e, mem_univ _⟩ + left_inv := fun e => Subtype.ext (ε.symm_apply_apply e.val) + right_inv := fun e => ε.apply_symm_apply e } + let φ : Iso K (GM16.completeGraph p) := { + vertexEquiv := Equiv.refl _ + edgeEquiv := eEquiv + isLink_iff := fun _ _ _ => Iff.rfl } + have hloop : ∀ e v, ¬ K.IsLink e v v := by + intro e v h + exact h.1 rfl + have htwo := two_incident_edges_of_iso φ (completeGraph_two_incident_edges hp) + obtain ⟨κ, hassign, hslots⟩ := exists_target_end_assignment K rfl hloop htwo + exact ⟨K, κ, rfl, rfl, ⟨φ⟩, hloop, hassign, hslots⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CliquePortCoordinates.lean b/LeanPool/GraphMinor/GM12/Section4CliquePortCoordinates.lean new file mode 100644 index 0000000000..ea4e82e330 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CliquePortCoordinates.lean @@ -0,0 +1,86 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CliquePortMatrix +public import LeanPool.GraphMinor.Surface.CircleMove +public import Mathlib.Analysis.Convex.Segment + +/-! +# Matching vertex-pair chords to edge labels + +For XII (4.5), page 252, the vertex-pair description used to find +crossings must agree with the finitely indexed edge arcs. The +port bijection and its reversal identity identify both coordinates +of each chord. The unoriented chord is independent of which port +is chosen first. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Both vertex-pair coordinates agree with the two edge-port +coordinates in XII (4.5), page 252. -/ +theorem clique_port_matrix_coordinates {p : ℕ} + (ψ : (Fin (p * (p - 1) / 2) × Bool) ≃ {q : Fin p × Fin p // q.1 ≠ q.2}) + (hψ : ∀ i b, (ψ (i, !b)).val = ((ψ (i, b)).val.2, (ψ (i, b)).val.1)) + (s : Fin (p * (p - 1) / 2) × Bool → ℝ) (F : Fin p → Fin p → ℝ) + (hF : ∀ v w (hvw : v ≠ w), F v w = s (ψ.symm ⟨(v, w), hvw⟩)) + (i : Fin (p * (p - 1) / 2)) (b : Bool) : + F (ψ (i, b)).val.1 (ψ (i, b)).val.2 = s (i, b) ∧ + F (ψ (i, b)).val.2 (ψ (i, b)).val.1 = s (i, !b) := by + have hfirst := hF (ψ (i, b)).val.1 (ψ (i, b)).val.2 (ψ (i, b)).property + have hsecond := hF (ψ (i, b)).val.2 (ψ (i, b)).val.1 (ψ (i, b)).property.symm + have hflip : ψ (i, !b) = + ⟨((ψ (i, b)).val.2, (ψ (i, b)).val.1), (ψ (i, b)).property.symm⟩ := + Subtype.ext (hψ i b) + rw [← hflip, ψ.symm_apply_apply] at hsecond + refine ⟨?_, hsecond⟩ + simpa only [Subtype.eta, ψ.symm_apply_apply] using hfirst + +/-- The chord obtained from vertex-pair coordinates is the actual +edge chord, for either choice of its first port. This keeps the +crossing witnesses aligned with edge labels in XII (4.5), page 252. -/ +theorem clique_port_chord_eq_matrix {p : ℕ} + (ψ : (Fin (p * (p - 1) / 2) × Bool) ≃ {q : Fin p × Fin p // q.1 ≠ q.2}) + (hψ : ∀ i b, (ψ (i, !b)).val = ((ψ (i, b)).val.2, (ψ (i, b)).val.1)) + (s : Fin (p * (p - 1) / 2) × Bool → ℝ) (F : Fin p → Fin p → ℝ) + (hF : ∀ v w (hvw : v ≠ w), F v w = s (ψ.symm ⟨(v, w), hvw⟩)) + (i : Fin (p * (p - 1) / 2)) (b : Bool) : + segment ℝ (ee (s (i, false)) : ℂ) (ee (s (i, true)) : ℂ) = + segment ℝ (ee (F (ψ (i, b)).val.1 (ψ (i, b)).val.2) : ℂ) + (ee (F (ψ (i, b)).val.2 (ψ (i, b)).val.1) : ℂ) := by + rw [(clique_port_matrix_coordinates ψ hψ s F hF i b).1, + (clique_port_matrix_coordinates ψ hψ s F hF i b).2] + cases b + · rfl + · exact segment_symm _ _ _ + +/-- The endpoints of an edge are the owner and neighbor of either +of its ports. This removes the arbitrary first-port choice in the +source construction for XII (4.5), page 252. -/ +theorem clique_port_endpoint_set {p : ℕ} + (ψ : (Fin (p * (p - 1) / 2) × Bool) ≃ {q : Fin p × Fin p // q.1 ≠ q.2}) + (hψ : ∀ i b, (ψ (i, !b)).val = ((ψ (i, b)).val.2, (ψ (i, b)).val.1)) + (i : Fin (p * (p - 1) / 2)) (b : Bool) : + ({(ψ (i, false)).val.1, (ψ (i, true)).val.1} : Set (Fin p)) = + {(ψ (i, b)).val.1, (ψ (i, b)).val.2} := by + cases b + · have h := congrArg Prod.fst (hψ i false) + change (ψ (i, true)).val.1 = (ψ (i, false)).val.2 at h + rw [h] + · have h := congrArg Prod.fst (hψ i true) + change (ψ (i, false)).val.1 = (ψ (i, true)).val.2 at h + rw [h] + exact pair_comm _ _ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CliquePortGraph.lean b/LeanPool/GraphMinor/GM12/Section4CliquePortGraph.lean new file mode 100644 index 0000000000..c9c655a2f1 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CliquePortGraph.lean @@ -0,0 +1,119 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CliquePorts +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM12.Section4SubdivisionGraph +import LeanPool.GraphMinor.GM12.Section4SubdivisionMinor +import LeanPool.GraphMinor.Minor.Basic + +/-! +# The complete graph encoded by the clique ports + +The source arc construction of XII (4.5), page 252, labels its +edge ends by ordered pairs of distinct vertices. Identify each +edge with the unordered pair of its two ports. Reversing the port +choice reverses the pair, and the port bijection proves that this +is a bijection with the actual edges of the complete graph. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph + +/-- The graph encoded by the finite clique port labels is +isomorphic to the actual complete graph, with the identity map on +vertices and the unordered endpoint-pair map on edges. This matches +the source graph in XII (4.5), page 252. -/ +theorem exists_clique_graph_of_ports {p : ℕ} + (ψ : (Fin (p * (p - 1) / 2) × Bool) ≃ {q : Fin p × Fin p // q.1 ≠ q.2}) + (hψ : ∀ i b, (ψ (i, !b)).val = ((ψ (i, b)).val.2, (ψ (i, b)).val.1)) : + ∃ H : Graph (Fin p) (Fin (p * (p - 1) / 2)), + H.vertexSet = univ ∧ H.edgeSet = univ ∧ Nonempty (Iso H (GM16.completeGraph p)) ∧ + ∀ e, H.IsLink e (ψ (e, false)).val.1 (ψ (e, true)).val.1 := by + let f : Fin (p * (p - 1) / 2) → (GM16.completeGraph p).edgeSet := fun e => + ⟨s((ψ (e, false)).val.1, (ψ (e, false)).val.2), + (ψ (e, false)).val.1, (ψ (e, false)).val.2, (ψ (e, false)).property, rfl⟩ + have hf : Function.Injective f := by + intro e e' heq + have hpair := congrArg Subtype.val heq + rcases Sym2.eq_iff.mp hpair with ⟨hu, hv⟩ | ⟨hu, hv⟩ + · have hports : ψ (e, false) = ψ (e', false) := Subtype.ext (Prod.ext hu hv) + exact congrArg Prod.fst (ψ.injective hports) + · have hflip := hψ e' false + change (ψ (e', true)).val = ((ψ (e', false)).val.2, (ψ (e', false)).val.1) at hflip + have hports : ψ (e, false) = ψ (e', true) := + Subtype.ext ((Prod.ext hu hv).trans hflip.symm) + exact False.elim (Bool.false_ne_true (congrArg Prod.snd (ψ.injective hports))) + have hs : Function.Surjective f := by + rintro ⟨e, v, w, hvw, he⟩ + subst e + let q := ψ.symm ⟨(v, w), hvw⟩ + let i := q.1 + let b := q.2 + have hpair : (ψ (i, b)).val = (v, w) := + congrArg Subtype.val (ψ.apply_symm_apply ⟨(v, w), hvw⟩) + refine ⟨i, Subtype.ext ?_⟩ + change s((ψ (i, false)).val.1, (ψ (i, false)).val.2) = s(v, w) + cases hb : b + · rw [hb] at hpair + exact congrArg (fun z : Fin p × Fin p => s(z.1, z.2)) hpair + · rw [hb] at hpair + have hflip := hψ i true + change (ψ (i, false)).val = ((ψ (i, true)).val.2, (ψ (i, true)).val.1) at hflip + rw [show (ψ (i, true)).val.1 = v from congrArg Prod.fst hpair, + show (ψ (i, true)).val.2 = w from congrArg Prod.snd hpair] at hflip + exact (congrArg (fun z : Fin p × Fin p => s(z.1, z.2)) hflip).trans Sym2.eq_swap + let ε := Equiv.ofBijective f ⟨hf, hs⟩ + let H : Graph (Fin p) (Fin (p * (p - 1) / 2)) := { + vertexSet := univ + edgeSet := univ + IsLink e u v := (GM16.completeGraph p).IsLink (ε e).val u v + isLink_symm := by intro e he; exact ⟨fun _ _ h => h.symm⟩ + eq_or_eq_of_isLink_of_isLink := by + intro e x y v w hxy hvw + exact (GM16.completeGraph p).eq_or_eq_of_isLink_of_isLink hxy hvw + edge_mem_iff_exists_isLink := by + intro e + exact ⟨fun _ => (GM16.completeGraph p).exists_isLink_of_mem_edgeSet (ε e).property, + fun _ => mem_univ e⟩ + left_mem_of_isLink := by intro e x y h; exact mem_univ x } + let eEquiv : H.edgeSet ≃ (GM16.completeGraph p).edgeSet := { + toFun := fun e => ε e.val + invFun := fun e => ⟨ε.symm e, mem_univ _⟩ + left_inv := fun e => Subtype.ext (ε.symm_apply_apply e.val) + right_inv := fun e => ε.apply_symm_apply e } + let φ : Iso H (GM16.completeGraph p) := { + vertexEquiv := Equiv.refl _ + edgeEquiv := eEquiv + isLink_iff := fun _ _ _ => Iff.rfl } + refine ⟨H, rfl, rfl, ⟨φ⟩, ?_⟩ + intro e + have hflip := congrArg Prod.fst (hψ e false) + change (ψ (e, true)).val.1 = (ψ (e, false)).val.2 at hflip + change (GM16.completeGraph p).IsLink (ε e).val (ψ (e, false)).val.1 (ψ (e, true)).val.1 + rw [hflip] + exact ⟨(ψ (e, false)).property, rfl⟩ + +/-- The actual complete graph is isomorphic to a minor of the +subdivision encoded by the clique ports. This is the clique-minor +assertion in XII (4.5), page 252. -/ +theorem completeGraph_isIsoMinor_port_subdivision {p : ℕ} + (ψ : (Fin (p * (p - 1) / 2) × Bool) ≃ {q : Fin p × Fin p // q.1 ≠ q.2}) + (hψ : ∀ i b, (ψ (i, !b)).val = ((ψ (i, b)).val.2, (ψ (i, b)).val.1)) + (k : Fin (p * (p - 1) / 2) → ℕ) (hk : ∀ e, 0 < k e) : + IsIsoMinor (GM16.completeGraph p) (subdivisionGraph (fun x => (ψ x).val.1) k) := by + obtain ⟨H, _, _, ⟨φ⟩, hlink⟩ := exists_clique_graph_of_ports ψ hψ + exact φ.symm.isIsoMinor_left + (isIsoMinor_subdivision H (fun x => (ψ x).val.1) hlink k hk) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CliquePortMatrix.lean b/LeanPool/GraphMinor/GM12/Section4CliquePortMatrix.lean new file mode 100644 index 0000000000..fa8d6f6489 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CliquePortMatrix.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CliquePorts +public import LeanPool.GraphMinor.GM12.Section4HamiltonCrossingWitness + +/-! +# Vertex-pair coordinates for the clique ports + +The crossing tests for XII (4.5), page 252, use a port coordinate +for each ordered pair of vertices. The edge-port bijection gives +these coordinates for distinct vertices. Give each unused diagonal +entry the coordinate of a non-Hamilton port in the same block. +This preserves the vertex-block order and Hamilton priorities, +without adding any port to the drawing. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- Rewrite an ordered clique port configuration as vertex-pair +coordinates for the crossing tests in XII (4.5), page 252. Diagonal +entries reuse a non-Hamilton port and are never edge ends. -/ +theorem exists_clique_port_matrix {p : ℕ} (hp : 4 ≤ p) + (ψ : (Fin (p * (p - 1) / 2) × Bool) ≃ {q : Fin p × Fin p // q.1 ≠ q.2}) + (s : Fin (p * (p - 1) / 2) × Bool → ℝ) (hs : ∀ x, s x ∈ Ioo 0 1) + (hblocks : ∀ x y, (ψ x).val.1 < (ψ y).val.1 → s x < s y) + (hpriority : ∀ x y, (ψ x).val.1 = (ψ y).val.1 → + hamiltonPortPriority (ψ x).val.1 (ψ x).val.2 < + hamiltonPortPriority (ψ y).val.1 (ψ y).val.2 → s x < s y) : + ∃ F : Fin p → Fin p → ℝ, + (∀ v w, F v w ∈ Ioo 0 1) ∧ + (∀ v w i j, v < i → F v w < F i j) ∧ + (∀ v w z, hamiltonPortPriority v w < hamiltonPortPriority v z → F v w < F v z) ∧ + ∀ v w (hvw : v ≠ w), F v w = s (ψ.symm ⟨(v, w), hvw⟩) := by + classical + choose τ hτv hτpre hτnext using exists_nonHamilton_neighbor hp + let ν : Fin p → Fin p → Fin p := fun v w => if v = w then τ v else w + have hν : ∀ v w, v ≠ ν v w := by + intro v w + by_cases hvw : v = w + · simpa only [ν, hvw, ↓reduceIte] using (hτv w).symm + · rw [show ν v w = w by simp only [ν, hvw, ↓reduceIte]] + exact hvw + let P : Fin p → Fin p → Fin (p * (p - 1) / 2) × Bool := + fun v w => ψ.symm ⟨(v, ν v w), hν v w⟩ + have howner : ∀ v w, (ψ (P v w)).val.1 = v := fun v w => + congrArg (fun q : {q : Fin p × Fin p // q.1 ≠ q.2} => q.val.1) + (ψ.apply_symm_apply ⟨(v, ν v w), hν v w⟩) + have hneighbor : ∀ v w, (ψ (P v w)).val.2 = ν v w := fun v w => + congrArg (fun q : {q : Fin p × Fin p // q.1 ≠ q.2} => q.val.2) + (ψ.apply_symm_apply ⟨(v, ν v w), hν v w⟩) + have hprio : ∀ v w, hamiltonPortPriority v (ν v w) = hamiltonPortPriority v w := by + intro v w + by_cases hvw : v = w + · subst w + simp only [ν, ↓reduceIte] + rw [hamiltonPortPriority_other (hτpre v) (hτnext v), + hamiltonPortPriority_other + (Ne.symm (finRotate_predecessor_ne_self_of_two_le (by omega : 2 ≤ p) v)) + (Ne.symm (finRotate_ne_self_of_two_le (by omega : 2 ≤ p) v))] + · simp only [ν, hvw, ↓reduceIte] + refine ⟨fun v w => s (P v w), fun v w => hs _, ?_, ?_, ?_⟩ + · intro v w i j hvi + exact hblocks _ _ (by simpa only [howner] using hvi) + · intro v w z hwz + apply hpriority (P v w) (P v z) (by rw [howner, howner]) + simpa only [howner, hneighbor, hprio] using hwz + · intro v w hvw + simp only [P, ν, hvw, ↓reduceIte] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CliquePorts.lean b/LeanPool/GraphMinor/GM12/Section4CliquePorts.lean new file mode 100644 index 0000000000..e2572c988e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CliquePorts.lean @@ -0,0 +1,73 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Order.Fin.Basic +public import Mathlib.Data.Bool.Basic +import LeanPool.GraphMinor.GM12.Section4CliqueEdges + +/-! +# The oriented ports of a clique + +Each edge of the clique in XII (4.5), page 252, has one port at +each of its ends. Enumerate unordered vertex pairs by their larger +endpoint, then choose which end is the current port with a Boolean +index. This gives a bijection with ordered pairs of distinct +vertices. Switching the Boolean index reverses the ordered pair. +-/ + +public section + +namespace GraphMinor.GM12 + +/-- The clique edge ports are in bijection with ordered pairs of +distinct vertices, and changing the chosen end reverses the pair. +This is the port labelling for XII (4.5), page 252. -/ +theorem exists_clique_port_bijection (p : ℕ) : + ∃ ψ : (Fin (p * (p - 1) / 2) × Bool) ≃ {q : Fin p × Fin p // q.1 ≠ q.2}, + ∀ i b, (ψ (i, !b)).val = ((ψ (i, b)).val.2, (ψ (i, b)).val.1) := by + let f : ((Σ j : Fin p, Fin j.val) × Bool) → {q : Fin p × Fin p // q.1 ≠ q.2} := + fun x => if x.2 then ⟨(x.1.1, cliquePairLower x.1), (cliquePairLower_lt x.1).ne'⟩ + else ⟨(cliquePairLower x.1, x.1.1), (cliquePairLower_lt x.1).ne⟩ + have hf : Function.Injective f := by + rintro ⟨e, b⟩ ⟨e', b'⟩ heq + have hpair := congrArg Subtype.val heq + cases b <;> cases b' + · exact Prod.ext (cliquePair_ends_injective hpair) rfl + · have hlow := cliquePairLower_lt e + have hhigh := cliquePairLower_lt e' + have h1 := congrArg Prod.fst hpair + have h2 := congrArg Prod.snd hpair + change cliquePairLower e = e'.1 at h1 + change e.1 = cliquePairLower e' at h2 + rw [h1, h2] at hlow + exact False.elim (lt_asymm hlow hhigh) + · have hlow := cliquePairLower_lt e + have hhigh := cliquePairLower_lt e' + have h1 := congrArg Prod.fst hpair + have h2 := congrArg Prod.snd hpair + change e.1 = cliquePairLower e' at h1 + change cliquePairLower e = e'.1 at h2 + rw [h1, h2] at hlow + exact False.elim (lt_asymm hlow hhigh) + · have hends : (cliquePairLower e, e.1) = (cliquePairLower e', e'.1) := + Prod.ext (congrArg Prod.snd hpair) (congrArg Prod.fst hpair) + exact Prod.ext (cliquePair_ends_injective hends) rfl + have hs : Function.Surjective f := by + rintro ⟨⟨v, w⟩, hvw⟩ + rcases lt_or_gt_of_ne hvw with hlt | hgt + · exact ⟨(⟨w, ⟨v.val, hlt⟩⟩, false), Subtype.ext rfl⟩ + · exact ⟨(⟨v, ⟨w.val, hgt⟩⟩, true), Subtype.ext rfl⟩ + let ε := Classical.choice (nonempty_clique_pair_enumeration p) + let ψ := (Equiv.prodCongr ε (Equiv.refl Bool)).trans (Equiv.ofBijective f ⟨hf, hs⟩) + refine ⟨ψ, ?_⟩ + intro i b + cases b <;> rfl + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CollarRadius.lean b/LeanPool/GraphMinor/GM12/Section4CollarRadius.lean new file mode 100644 index 0000000000..d67127d030 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CollarRadius.lean @@ -0,0 +1,26 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.JoinedCollar + +/-! +# Radius coordinates for joining two collars + +The outer-annulus radius change used in the collar construction for XII (4.3), claim (7). +-/ + +public section + +namespace GraphMinor.GM12 + +export Surface (collarOuterStep continuous_collarOuterStep collarOuterStep_norm + collarOuterStep_injOn collarOuterStep_two exists_collarOuterStep_preimage) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ConnectedSideBound.lean b/LeanPool/GraphMinor/GM12/Section4ConnectedSideBound.lean new file mode 100644 index 0000000000..a63a890ca7 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ConnectedSideBound.lean @@ -0,0 +1,72 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM12.Section4 +import LeanPool.GraphMinor.GM12.Section4EdgeRegionDistance +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM09.Basic + +/-! +# A connected branch containing distant ends cannot be small + +The final paragraph of XII (4.3), page 251, chooses two ends +of different selected edges inside one connected branch. A path +in that branch remains on the proposed small side. XII (4.1) +bounds the distance of its ends by twice the separation order. +The selected-edge distance forces that order to be large enough +to establish the control condition. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM14 Hypergraph + +/-- The connected-branch application of XII (4.1) in the final +paragraph of XII (4.3), page 251. -/ +theorem separation_order_ge_of_connected_distant_vertices + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ H : Drawing S} {θ m : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + (hH : IsConnectedDrawing H) (hHs : H.IsSubdrawing Γ) + {u v : S} (hu : u ∈ H.V) (hv : v ∈ H.V) (hfar : 2 * m ≤ d {u} {v}) + {A B : Hypergraph S (Set S)} (hAB : (A, B) ∈ T) (hHV : H.V ⊆ A.vertexSet) : + m ≤ separationOrder A B := by + obtain ⟨W₀⟩ := hH u hu v hv + obtain ⟨W, hW, _, _⟩ := GM09.exists_isSimple_subwalk W₀ + let P := walkDrawing H W + have hP : P.IsPathBetween u v := walkDrawing_isPathBetween H hW + have hPs : P.IsSubdrawing H := walkDrawing_isSubdrawing H W + have hbound := theorem_4_1_proof Γ P θ T d A B u v hS inferInstance hm (hHs.1 hu) (hHs.1 hv) + hP (hPs.trans hHs) hAB (hPs.1.trans hHV) + omega + +/-- The order bound from two distinct selected-edge ends, used to +verify control in XII (4.3), page 251. -/ +theorem separation_order_ge_of_connected_distant_edges + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ H : Drawing S} {θ m k : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + (hH : IsConnectedDrawing H) (hHs : H.IsSubdrawing Γ) + {e f : Set S} (he : e ∈ Γ.E) (hf : f ∈ Γ.E) + {u v : S} (hu : u ∈ H.V) (hv : v ∈ H.V) + (hue : u ∈ closure e) (hvf : v ∈ closure f) + (hfar : k + 4 ≤ d e f) (hk : 2 * m ≤ k) + {A B : Hypergraph S (Set S)} (hAB : (A, B) ∈ T) (hHV : H.V ⊆ A.vertexSet) : + m ≤ separationOrder A B := by + have hdist := distant_edges_endpoints_distance_ge hS hm he hf (hHs.1 hu) (hHs.1 hv) hue hvf hfar + exact separation_order_ge_of_connected_distant_vertices hS hm hH hHs hu hv + (hk.trans hdist) hAB hHV + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ContactDiscUniverses.lean b/LeanPool/GraphMinor/GM12/Section4ContactDiscUniverses.lean new file mode 100644 index 0000000000..f3fca7d9bd --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ContactDiscUniverses.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM12.Section4ParametrizedContactDisc +import LeanPool.GraphMinor.GM12.Section4SmallSurfaceCopy +import Mathlib.Topology.Homeomorph.Lemmas + +/-! +# Contact-disc shrinking in arbitrary surface universes + +The target-disc construction in XII (4.5), page 253, can be +made on a small homeomorphic copy of the closed surface. +Carry the disc, its boundary parameters, and its marks there, +shrink it, and carry the resulting disc and parameters back. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Shrink a marked disc while retaining its boundary parameters, +in any universe, as needed for XII (4.5), page 253. -/ +theorem exists_contact_disc_preserving_param_univ + {S : Type*} [TopologicalSpace S] (hS : IsClosedSurface S) + {D N : Set S} (hD : IsClosedDisc D) (φ : Circle ≃ₜ discBd D) + (hN : N ⊆ discBd D) (hfin : N.Finite) (hne : N.Nonempty) : + ∃ (Q : Set S) (p : Circle → S), IsClosedDisc Q ∧ Q ⊆ D ∧ Q ∩ discBd D = N ∧ + N ⊆ discBd Q ∧ Continuous p ∧ Function.Injective p ∧ range p = discBd Q ∧ + ∀ w, (φ w).val ∈ N → p w = (φ w).val := by + classical + obtain ⟨S₀, t₀, ⟨e⟩, hS₀⟩ := exists_small_closed_surface_copy hS + let : TopologicalSpace S₀ := t₀ + let : T2Space S₀ := hS₀.2.1 + obtain ⟨hD₀, hbd₀⟩ := hD.image e.continuous.continuousOn e.symm.continuous.continuousOn + (fun z _ => e.symm_apply_apply z) + let φ₀ : Circle ≃ₜ discBd (e '' D) := + φ.trans ((e.image (discBd D)).trans (Homeomorph.setCongr hbd₀.symm)) + have hN₀ : e '' N ⊆ discBd (e '' D) := by + rw [hbd₀] + exact image_mono hN + obtain ⟨Q₀, p₀, hQ₀, hQD₀, hQN₀, hNb₀, hpc₀, hpi₀, hpr₀, hfix₀⟩ := + exists_contact_disc_preserving_param hD₀ φ₀ hN₀ (hfin.image e) (hne.image e) + obtain ⟨hQ, hQbd⟩ := hQ₀.image e.symm.continuous.continuousOn e.continuous.continuousOn + (fun z _ => e.apply_symm_apply z) + have hQD : e.symm '' Q₀ ⊆ D := by + rintro _ ⟨z, hz, rfl⟩ + obtain ⟨w, hw, rfl⟩ := hQD₀ hz + simpa only [e.symm_apply_apply] using hw + have hQN : e.symm '' Q₀ ∩ discBd D = N := by + apply e.injective.image_injective + rw [image_inter e.injective, hbd₀.symm] + have hEq : e '' (e.symm '' Q₀) = Q₀ := by + simp only [image_image, e.apply_symm_apply, image_id'] + rw [hEq, hQN₀] + have hNb : N ⊆ discBd (e.symm '' Q₀) := by + intro x hx + rw [hQbd] + exact ⟨e x, hNb₀ (mem_image_of_mem e hx), e.symm_apply_apply x⟩ + have hpr : range (e.symm ∘ p₀) = discBd (e.symm '' Q₀) := by + rw [range_comp, hpr₀, hQbd] + refine ⟨e.symm '' Q₀, e.symm ∘ p₀, hQ, hQD, hQN, hNb, + e.symm.continuous.comp hpc₀, e.symm.injective.comp hpi₀, hpr, ?_⟩ + intro w hw + have hφ : (φ₀ w).val = e (φ w).val := rfl + have hw₀ : (φ₀ w).val ∈ e '' N := hφ.symm ▸ mem_image_of_mem e hw + change e.symm (p₀ w) = _ + rw [hfix₀ w hw₀, hφ, e.symm_apply_apply] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ContactPartitionImage.lean b/LeanPool/GraphMinor/GM12/Section4ContactPartitionImage.lean new file mode 100644 index 0000000000..83c21f5b28 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ContactPartitionImage.lean @@ -0,0 +1,65 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4EndPartition +public import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! +# Transporting contact partitions between homeomorphic spaces + +The small-surface reduction for XII (4.5) must retain its +vertex-disc witnesses and exact endpoint classes. A homeomorphism +carries discs and disjointness to their images, and its image +commutes with intersections and unions. The class of image ends +is the image of the old end class. Boundary parametrizations +transport by composition with the same homeomorphism. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A homeomorphism transports disjoint contact discs and their +exact end classes, in arbitrary universes. This carries the +small-surface construction of XII (4.5) back to the surface. -/ +theorem contact_partition_image {S T V E I : Type*} [TopologicalSpace S] [TopologicalSpace T] + (e : S ≃ₜ T) (B : V → Set S) (C : I → Set S) (ends : E → S) (κ : E → V) + (hB : ∀ w, IsClosedDisc (B w)) (hBB : Pairwise (fun w z => Disjoint (B w) (B z))) + (hcontact : ∀ w, B w ∩ (⋃ i, C i) = edgeEndClass ends κ w) : + (∀ w, IsClosedDisc (e '' B w)) ∧ + Pairwise (fun w z => Disjoint (e '' B w) (e '' B z)) ∧ + ∀ w, (e '' B w) ∩ (⋃ i, e '' C i) = edgeEndClass (e ∘ ends) κ w := by + have hclass : ∀ w, e '' edgeEndClass ends κ w = edgeEndClass (e ∘ ends) κ w := by + intro w + simp only [edgeEndClass, image_image] + rfl + refine ⟨?_, ?_, ?_⟩ + · intro w + exact ((hB w).image e.continuous.continuousOn e.symm.continuous.continuousOn + (fun z _ => e.symm_apply_apply z)).1 + · intro w z hwz + exact (disjoint_image_iff e.injective).mpr (hBB hwz) + · intro w + rw [← image_iUnion, ← image_inter e.injective, hcontact w, hclass w] + +/-- A boundary parametrization transports through a homeomorphism, +including its whole boundary image equation. -/ +theorem boundary_param_image_homeomorph {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + (e : S ≃ₜ T) {D : Set S} (hD : IsClosedDisc D) (p : Circle → S) + (hp : Continuous p ∧ Function.Injective p ∧ range p = discBd D) : + Continuous (e ∘ p) ∧ Function.Injective (e ∘ p) ∧ range (e ∘ p) = discBd (e '' D) := by + have hb := (hD.image e.continuous.continuousOn e.symm.continuous.continuousOn + (fun z _ => e.symm_apply_apply z)).2 + refine ⟨e.continuous.comp hp.1, e.injective.comp hp.2.1, ?_⟩ + rw [range_comp, hp.2.2, hb] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ControlComposition.lean b/LeanPool/GraphMinor/GM12/Section4ControlComposition.lean new file mode 100644 index 0000000000..60221a6cee --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ControlComposition.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.Minor.Model +import LeanPool.GraphMinor.GM12.Section4Model +import LeanPool.GraphMinor.GM12.Section4ModelBack +import LeanPool.GraphMinor.GM12.Section4ModelComposition +import LeanPool.GraphMinor.Minor.Basic + +/-! +# Preserving control while merging branches + +For XII (4.2), page 249, compose a target minor model with the controlled +model. A new branch is a union of old branches. It contains at least one +old branch, so it cannot lie on a small side of order below the new +vertex count. That count is at most the old vertex count because the +target model has disjoint nonempty branches. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph Hypergraph + +/-- The contraction and deletion steps of XII (4.2), page 249, given a +model of the target minor. Each new branch contains an old branch. -/ +theorem controlsMinor_of_target_model {α β γ δ γ' δ' : Type*} + {G : Graph α β} (hV : G.vertexSet.Finite) (hE : G.edgeSet.Finite) + {L : Graph γ δ} {L' : Graph γ' δ'} + {ηv : γ → Set γ'} {ηe : δ → δ'} (hm : IsMinorModel L L' ηv ηe) + (hV' : L'.vertexSet.Finite) {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} + (hc : ControlsMinor (Hypergraph.ofGraph G hV hE) θ T L') : + ControlsMinor (Hypergraph.ofGraph G hV hE) θ T L := by + obtain ⟨a, b, hmodel, hcard, hcontrol⟩ := controlsMinor_has_minorModel hV hE hc + have hcount := minorModel_vertex_ncard_le hm hV' + apply controlsMinor_of_minorModel hV hE (minorModel_comp hm hmodel) (hcount.trans hcard) + intro A B hAB ho v hv hsub + obtain ⟨w, hw⟩ := hm.vertex_nonempty v hv + apply hcontrol A B hAB (ho.trans_le hcount) w (hm.vertex_subset v hv hw) + intro x hx + exact hsub (mem_iUnion₂.mpr ⟨w, hw, hx⟩) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ConvexBoundaryParam.lean b/LeanPool/GraphMinor/GM12/Section4ConvexBoundaryParam.lean new file mode 100644 index 0000000000..d5e0b64359 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ConvexBoundaryParam.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.PlaneDisc +public import Mathlib.Analysis.Convex.GaugeRescale +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# A convex subdisc parametrization fixing its circle contacts + +For the target discs of XII (4.5), page 253, shrinking a disc +must preserve the cyclic order of the four boundary marks. +A convex set containing a neighborhood of zero is radially +homeomorphic to the unit disc. If it is contained in the unit +disc, every common unit-circle point is on both frontiers and +has gauge one for both sets. The radial homeomorphism fixes +those points, giving a boundary parametrization that retains +their original circle parameters. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Metric Topology + +/-- A closed bounded convex subset of the unit disc containing +a neighborhood of zero has a boundary parametrization fixing +all of its unit-circle contacts. This preserves the order of +the target marks when shrinking region discs in XII (4.5), +page 253. -/ +theorem exists_convex_boundary_param_fixing_circle {K : Set ℂ} + (hc : Convex ℝ K) (h0 : K ∈ 𝓝 (0 : ℂ)) (hb : Bornology.IsBounded K) + (hcl : IsClosed K) (hsub : K ⊆ closedBall 0 1) : + IsClosedDisc K ∧ ∃ p : Circle → ℂ, Continuous p ∧ Function.Injective p ∧ + range p = discBd K ∧ ∀ w : Circle, (w : ℂ) ∈ K → p w = w := by + have ht0 : closedBall (0 : ℂ) 1 ∈ 𝓝 (0 : ℂ) := closedBall_mem_nhds _ one_pos + let hbc := NormedSpace.isVonNBounded_of_isBounded ℝ hb + let hbt := NormedSpace.isVonNBounded_of_isBounded ℝ (isBounded_closedBall (x := (0 : ℂ)) (r := 1)) + let e := gaugeRescaleHomeomorph K (closedBall (0 : ℂ) 1) + hc h0 hbc (convex_closedBall 0 1) ht0 hbt + have heK : e '' K = closedBall 0 1 := by + have h := image_gaugeRescaleHomeomorph_closure hc h0 hbc (convex_closedBall (0 : ℂ) 1) ht0 hbt + rwa [hcl.closure_eq, isClosed_closedBall.closure_eq] at h + have heunit : e.symm '' closedBall 0 1 = K := by + rw [← heK, image_image] + simp + have hD := isClosedDisc_closedBall.1.image e.symm.continuous.continuousOn + e.continuous.continuousOn (fun z _ => e.apply_symm_apply z) + rw [heunit, isClosedDisc_closedBall.2] at hD + let p : Circle → ℂ := fun w => e.symm w + refine ⟨hD.1, p, e.symm.continuous.comp continuous_subtype_val, + (fun a b h => Subtype.ext (e.symm.injective h)), ?_, ?_⟩ + · ext z + constructor + · rintro ⟨w, rfl⟩ + rw [hD.2] + exact mem_image_of_mem e.symm w.property + · intro hz + rw [hD.2] at hz + obtain ⟨w, hw, rfl⟩ := hz + exact ⟨⟨w, hw⟩, rfl⟩ + · intro w hwK + have hwfront : (w : ℂ) ∈ frontier K := by + refine ⟨subset_closure hwK, ?_⟩ + intro hwint + have hwball : (w : ℂ) ∈ ball (0 : ℂ) 1 := by + have h := interior_mono hsub hwint + rwa [interior_closedBall _ one_ne_zero] at h + have hlt := mem_ball_zero_iff.mp hwball + rw [Circle.norm_coe] at hlt + exact (lt_irrefl (1 : ℝ)) hlt + have hgK : gauge K (w : ℂ) = 1 := (gauge_eq_one_iff_mem_frontier hc h0).mpr hwfront + have hgt : gauge (closedBall (0 : ℂ) 1) (w : ℂ) = 1 := by + rw [gauge_closedBall zero_le_one, Circle.norm_coe, div_one] + have hefix : e (w : ℂ) = w := by + change gaugeRescale K (closedBall (0 : ℂ) 1) (w : ℂ) = w + rw [gaugeRescale, hgK, hgt, div_one, one_smul] + apply e.injective + exact (e.apply_symm_apply (w : ℂ)).trans hefix.symm + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4Counting.lean b/LeanPool/GraphMinor/GM12/Section4Counting.lean new file mode 100644 index 0000000000..a2bd9a509c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4Counting.lean @@ -0,0 +1,100 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Data.Fintype.Basic +public import Mathlib.Data.Finset.Card +public import Mathlib.Algebra.BigOperators.Group.Finset.Basic +import Mathlib.Data.Finset.Interval +import Mathlib.Algebra.BigOperators.Group.Finset.Sigma +import Mathlib.Algebra.Order.BigOperators.Group.Finset + +/-! +# Counting the separators in a chain of radial circuits + +In the proof of Graph Minors XII, (4.1), page 248, nonconsecutive circuits +have disjoint insides. A vertex therefore belongs to at most two circuits. +Counting vertex occurrences gives twice the size of the separator as an upper bound. +-/ + +public section + +namespace GraphMinor.GM12 + +open Finset + +/-- The counting step of Graph Minors XII, (4.1), page 248. If each separator +vertex occurs in at most two sets, their total size is at most twice the +size of the separator. -/ +theorem sum_card_le_twice_separator {α ι : Type*} [DecidableEq α] [Fintype ι] + (Z : Finset α) (C : ι → Finset α) (hsub : ∀ i, C i ⊆ Z) + (hmult : ∀ x ∈ Z, (univ.filter fun i => x ∈ C i).card ≤ 2) : + ∑ i, (C i).card ≤ 2 * Z.card := by + classical + have hcard : ∀ i, (C i).card = ∑ x ∈ Z, if x ∈ C i then 1 else 0 := by + intro i + rw [← Finset.sum_filter] + have heq : Z.filter (fun x => x ∈ C i) = C i := by + ext x + simp only [mem_filter] + exact ⟨fun h => h.2, fun h => ⟨hsub i h, h⟩⟩ + rw [heq] + simp + simp_rw [hcard] + rw [Finset.sum_comm] + calc + _ = ∑ x ∈ Z, (univ.filter fun i => x ∈ C i).card := by + apply Finset.sum_congr rfl + intro x hx + rw [← Finset.sum_filter] + simp + _ ≤ ∑ _x ∈ Z, 2 := Finset.sum_le_sum hmult + _ = 2 * Z.card := by simp [Nat.mul_comm] + + +/-- A vertex occurs at most twice in a chain whose nonconsecutive members are +disjoint. This supplies the multiplicity bound in XII (4.1), page 248. -/ +theorem chain_membership_card_le_two {α : Type*} [DecidableEq α] {n : ℕ} + (C : Fin n → Finset α) + (hdisj : ∀ i j : Fin n, i.val + 1 < j.val → Disjoint (C i) (C j)) (x : α) : + (univ.filter fun i => x ∈ C i).card ≤ 2 := by + classical + have hclose : ∀ i j : Fin n, x ∈ C i → x ∈ C j → j.val ≤ i.val + 1 := by + intro i j hi hj + by_contra h + have hgap : i.val + 1 < j.val := Nat.lt_of_not_ge h + exact Finset.disjoint_left.mp (hdisj i j hgap) hi hj + apply Nat.le_of_not_gt + intro h + obtain ⟨i, j, k, hi, hj, hk, hij, hik, hjk⟩ := Finset.two_lt_card_iff.mp h + have hi' := (Finset.mem_filter.mp hi).2 + have hj' := (Finset.mem_filter.mp hj).2 + have hk' := (Finset.mem_filter.mp hk).2 + have h₁ := hclose i j hi' hj' + have h₂ := hclose j i hj' hi' + have h₃ := hclose i k hi' hk' + have h₄ := hclose k i hk' hi' + have h₅ := hclose j k hj' hk' + have h₆ := hclose k j hk' hj' + have hne₁ : i.val ≠ j.val := fun h => hij (Fin.ext h) + have hne₂ : i.val ≠ k.val := fun h => hik (Fin.ext h) + have hne₃ : j.val ≠ k.val := fun h => hjk (Fin.ext h) + omega + +/-- The bound on total separator occurrences for the circuit chain chosen in +Graph Minors XII, proof of (4.1), page 248. -/ +theorem chain_sum_card_le_twice_separator {α : Type*} {n : ℕ} + (Z : Finset α) (C : Fin n → Finset α) (hsub : ∀ i, C i ⊆ Z) + (hdisj : ∀ i j : Fin n, i.val + 1 < j.val → Disjoint (C i) (C j)) : + ∑ i, (C i).card ≤ 2 * Z.card := by + classical + exact sum_card_le_twice_separator Z C hsub + (fun x _ => chain_membership_card_le_two C hdisj x) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4Cover.lean b/LeanPool/GraphMinor/GM12/Section4Cover.lean new file mode 100644 index 0000000000..995c476407 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4Cover.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Topology.Connected.Basic +public import Mathlib.Logic.Relation +public import Mathlib.Data.Fintype.Basic +import Mathlib.Order.Minimal + +/-! +# Chains in a finite closed cover + +In Graph Minors XII, proof of (4.1), page 248, the circuit insides cover the +path. Connectedness of the path gives a chain of overlapping insides from +one endpoint to the other. This file proves the finite closed-cover part of +that argument. It does not identify the drawing's path with its cover. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- Sets in a finite closed cover of a connected set can be joined by a chain +of intersections when they both meet the connected set. This is the chain +existence step used in XII (4.1), page 248. -/ +theorem intersection_chain_of_finite_closed_cover {α ι : Type*} + [TopologicalSpace α] [Finite ι] (C : ι → Set α) (hclosed : ∀ i, IsClosed (C i)) + {P : Set α} (hP : IsPreconnected P) (hcover : P ⊆ ⋃ i, C i) + {i j : ι} (hi : (P ∩ C i).Nonempty) (hj : (P ∩ C j).Nonempty) : + Relation.ReflTransGen (fun k l => (C k ∩ C l).Nonempty) i j := by + classical + let reach : ι → Prop := Relation.ReflTransGen (fun k l => (C k ∩ C l).Nonempty) i + let U : Set α := ⋃ k : {k // reach k}, C k.val + let V : Set α := ⋃ k : {k // ¬ reach k}, C k.val + have hU : IsClosed U := isClosed_iUnion_of_finite (fun k => hclosed k.val) + have hV : IsClosed V := isClosed_iUnion_of_finite (fun k => hclosed k.val) + have hUV : P ⊆ U ∪ V := by + intro x hx + obtain ⟨k, hk⟩ := mem_iUnion.mp (hcover hx) + by_cases hr : reach k + · exact Or.inl (mem_iUnion.mpr ⟨⟨k, hr⟩, hk⟩) + · exact Or.inr (mem_iUnion.mpr ⟨⟨k, hr⟩, hk⟩) + have hiU : (P ∩ U).Nonempty := by + obtain ⟨x, hxP, hx⟩ := hi + exact ⟨x, hxP, mem_iUnion.mpr ⟨⟨i, .refl⟩, hx⟩⟩ + by_contra hnot + have hjV : (P ∩ V).Nonempty := by + obtain ⟨x, hxP, hx⟩ := hj + exact ⟨x, hxP, mem_iUnion.mpr ⟨⟨j, hnot⟩, hx⟩⟩ + obtain ⟨x, _, hxU, hxV⟩ := + isPreconnected_closed_iff.mp hP U V hU hV hUV hiU hjV + obtain ⟨k, hk⟩ := mem_iUnion.mp hxU + obtain ⟨l, hl⟩ := mem_iUnion.mp hxV + exact l.property (k.property.tail ⟨x, hk, hl⟩) + +/-- Every member of a finite family is included in a maximal member. In +XII (4.1), this lets the circuit cover be chosen without proper inclusions. -/ +theorem exists_maximal_cover_member {α ι : Type*} [Finite ι] + (C : ι → Set α) (i : ι) : + ∃ j, C i ⊆ C j ∧ ∀ k, C j ⊆ C k → C k ⊆ C j := by + let Z : Set (Set α) := {X | X ∈ Set.range C ∧ C i ⊆ X} + have hfin : Z.Finite := (Set.finite_range C).subset (fun _ h => h.1) + obtain ⟨X, hX, hmax⟩ := hfin.exists_maximal ⟨C i, ⟨⟨i, rfl⟩, subset_rfl⟩⟩ + obtain ⟨j, rfl⟩ := hX.1 + exact ⟨j, hX.2, fun k hk => hmax ⟨⟨k, rfl⟩, hX.2.trans hk⟩ hk⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CrossDiscFamily.lean b/LeanPool/GraphMinor/GM12/Section4CrossDiscFamily.lean new file mode 100644 index 0000000000..36482b3972 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CrossDiscFamily.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4LocalCrossDiscs +import Mathlib.Topology.Separation.Hausdorff + +/-! +# Disjoint discs around all crossings + +For XII (4.5), claim (1), page 253, separate the finitely many +crossing points by disjoint open neighborhoods. Intersect each +with its local straight-line neighborhood, then choose the small +coordinate disc there. The discs are disjoint, and each retains +the exact two opposite boundary contacts for both crossing arcs. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +universe u + +/-- A finite family of locally straight crossings has disjoint +small closed discs with the prescribed opposite boundary pairs, +as used in XII (4.5), claim (1), page 253. -/ +theorem exists_local_cross_disc_family {ι : Type u} [Finite ι] + (x : ι → ℂ) (hinj : Function.Injective x) (A : ι → ℂ ≃L[ℝ] ℂ) + (E F U : ι → Set ℂ) (hU : ∀ i, IsOpen (U i)) (hx : ∀ i, x i ∈ U i) + (hE : ∀ i, E i ∩ U i = (line[ℝ, x i, x i + A i 1] : Set ℂ) ∩ U i) + (hF : ∀ i, F i ∩ U i = (line[ℝ, x i, x i + A i Complex.I] : Set ℂ) ∩ U i) : + ∃ r : ι → ℝ, (∀ i, 0 < r i) ∧ ∃ D : ι → Set ℂ, + (∀ i, IsClosedDisc (D i)) ∧ (∀ i, D i ⊆ U i) ∧ + (∀ i j, i ≠ j → Disjoint (D i) (D j)) ∧ + (∀ i, E i ∩ discBd (D i) = + {x i + A i (r i • (1 : ℂ)), x i + A i ((-r i) • (1 : ℂ))}) ∧ + (∀ i, F i ∩ discBd (D i) = + {x i + A i (r i • Complex.I), x i + A i ((-r i) • Complex.I)}) ∧ + (∀ i, D i = (fun z => x i + A i z) '' Metric.closedBall 0 (r i)) := by + classical + obtain ⟨W, hW, hWdisj⟩ := (finite_range x).t2_separation + have hex : ∀ i, ∃ r : ℝ, 0 < r ∧ ∃ D : Set ℂ, + IsClosedDisc D ∧ D ⊆ U i ∩ W (x i) ∧ + E i ∩ discBd D = {x i + A i (r • (1 : ℂ)), x i + A i ((-r) • (1 : ℂ))} ∧ + F i ∩ discBd D = {x i + A i (r • Complex.I), x i + A i ((-r) • Complex.I)} ∧ + D = (fun z => x i + A i z) '' Metric.closedBall 0 r := by + intro i + apply exists_local_cross_disc (A i) (x i) ((hU i).inter (hW (x i)).2) + ⟨hx i, (hW (x i)).1⟩ + · rw [← inter_assoc, hE i, inter_assoc] + · rw [← inter_assoc, hF i, inter_assoc] + choose r hr D hD hsub hEM hFM hcoord using hex + refine ⟨r, hr, D, hD, (fun i z hz => (hsub i hz).1), ?_, hEM, hFM, hcoord⟩ + intro i j hij + exact (hWdisj (mem_range_self i) (mem_range_self j) (fun h => hij (hinj h))).mono + (fun z hz => (hsub i hz).2) (fun z hz => (hsub j hz).2) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CrossDiscMarks.lean b/LeanPool/GraphMinor/GM12/Section4CrossDiscMarks.lean new file mode 100644 index 0000000000..e5300c1c4b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CrossDiscMarks.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SmallCrossDiscs +import LeanPool.GraphMinor.GM12.Section4ChordGeometry + +/-! +# Opposite boundary marks on a crossing disc + +For the small crossing discs in XII (4.5), page 253, each of the +two straight lines meets the boundary exactly twice. A line +through the centre of a round disc meets its circle at opposite +points. The coordinate change preserves these intersection +equations. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric + +private theorem line_inter_circle_of_two_points {r : ℝ} {a b : ℂ} + (ha : ‖a‖ = r) (hb : ‖b‖ = r) (hab : a ≠ b) : + (line[ℝ, a, b] : Set ℂ) ∩ sphere 0 r = {a, b} := by + let s : EuclideanGeometry.Sphere ℂ := ⟨0, r⟩ + have ha' : a ∈ s := by simpa [s, EuclideanGeometry.mem_sphere] using ha + have hb' : b ∈ s := by simpa [s, EuclideanGeometry.mem_sphere] using hb + have hsec := (s.eq_or_eq_secondInter_iff_mem_of_mem_affineSpan_pair ha' + (right_mem_affineSpan_pair ℝ a b)).mpr hb' + have heq : b = s.secondInter a (b -ᵥ a) := hsec.resolve_left (Ne.symm hab) + ext z + constructor + · rintro ⟨hl, hz⟩ + have hz' : z ∈ s := by + simpa [s, EuclideanGeometry.mem_sphere] using mem_sphere_zero_iff_norm.mp hz + have h := (s.eq_or_eq_secondInter_iff_mem_of_mem_affineSpan_pair ha' hl).mpr hz' + rwa [← heq] at h + · rintro (rfl | rfl) + · exact ⟨left_mem_affineSpan_pair _ _ _, mem_sphere_zero_iff_norm.mpr ha⟩ + · exact ⟨right_mem_affineSpan_pair _ _ _, mem_sphere_zero_iff_norm.mpr hb⟩ + +/-- A line in a unit direction meets a positive-radius circle at +exactly the two opposite radial points. -/ +theorem unit_direction_line_inter_sphere {u : ℂ} (hu : ‖u‖ = 1) + {r : ℝ} (hr : 0 < r) : + (line[ℝ, 0, u] : Set ℂ) ∩ sphere 0 r = {r • u, (-r) • u} := by + have hu0 : u ≠ 0 := norm_ne_zero_iff.mp (by rw [hu]; exact one_ne_zero) + have hab : r • u ≠ (-r) • u := by + intro heq + have h := smul_left_injective ℝ hu0 heq + linarith + have hmem : ∀ t : ℝ, t • u ∈ line[ℝ, (0 : ℂ), u] := by + intro t + apply mem_affineSpan_pair_iff_exists_lineMap_eq.mpr + exact ⟨t, by simp [AffineMap.lineMap_apply]⟩ + have heq := affineSpan_pair_eq_of_mem_of_mem_of_ne (hmem r) (hmem (-r)) hab + rw [← heq] + apply line_inter_circle_of_two_points + · rw [norm_smul, hu, mul_one, Real.norm_eq_abs, abs_of_pos hr] + · rw [norm_smul, hu, mul_one, Real.norm_eq_abs, abs_neg, abs_of_pos hr] + · exact hab + +/-- In crossing coordinates, the line in any unit direction +meets the coordinate disc boundary at exactly two opposite +marks. This is the boundary-contact equation in XII (4.5), +page 253. -/ +theorem cross_disc_line_boundary (A : ℂ ≃L[ℝ] ℂ) (x : ℂ) + {u : ℂ} (hu : ‖u‖ = 1) {r : ℝ} (hr : 0 < r) : + (line[ℝ, x, x + A u] : Set ℂ) ∩ + Surface.discBd ((fun z => x + A z) '' closedBall 0 r) = + {x + A (r • u), x + A ((-r) • u)} := by + let h : ℂ ≃ₜ ℂ := A.toHomeomorph.trans (Homeomorph.addLeft x) + have hD : Surface.IsClosedDisc (closedBall (0 : ℂ) r) ∧ + Surface.discBd (closedBall (0 : ℂ) r) = sphere 0 r := by + have hi : interior (closedBall (0 : ℂ) r) = ball 0 r := interior_closedBall _ (ne_of_gt hr) + obtain ⟨hd, hb⟩ := Surface.isClosedDisc_of_convex (convex_closedBall (0 : ℂ) r) + (by rw [hi]; exact ⟨0, mem_ball_self hr⟩) isBounded_closedBall isClosed_closedBall + exact ⟨hd, hb.trans (frontier_closedBall _ (ne_of_gt hr))⟩ + have hb := (hD.1.image h.continuous.continuousOn h.symm.continuous.continuousOn + (fun z _ => h.symm_apply_apply z)).2 + rw [hD.2] at hb + change (line[ℝ, x, x + A u] : Set ℂ) ∩ Surface.discBd (h '' closedBall 0 r) = _ + rw [hb] + have hl : h '' (line[ℝ, 0, u] : Set ℂ) = (line[ℝ, x, x + A u] : Set ℂ) := by + change (fun z => x + A z) '' (line[ℝ, 0, u] : Set ℂ) = _ + simpa only [map_zero, add_zero] using image_line_cross_coordinates A x 0 u + rw [← hl, ← image_inter h.injective, unit_direction_line_inter_sphere hu hr, image_pair] + rfl + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CrossDiscParam.lean b/LeanPool/GraphMinor/GM12/Section4CrossDiscParam.lean new file mode 100644 index 0000000000..6f45a434b2 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CrossDiscParam.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SmallCrossDiscs + +/-! +# Parametrizing the boundary of a crossing disc + +In XII (4.5), claim (1), page 253, the boundary marks of each +crossing disc must be matched to the prescribed boundary marks. +Scale the unit circle by the radius and then apply the crossing +coordinates. This is a continuous injective parametrization of +the entire boundary, with no extra points. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Metric Surface + +/-- The circle parametrization of a coordinate crossing disc. -/ +noncomputable def crossDiscParam (A : ℂ ≃L[ℝ] ℂ) (x : ℂ) (r : ℝ) (w : Circle) : ℂ := + x + A (r • (w : ℂ)) + +/-- The scaled circle covers exactly the circle of positive radius. -/ +theorem range_scaled_circle {r : ℝ} (hr : 0 < r) : + range (fun w : Circle => r • (w : ℂ)) = sphere (0 : ℂ) r := by + ext z + constructor + · rintro ⟨w, rfl⟩ + apply mem_sphere_zero_iff_norm.mpr + rw [norm_smul, Circle.norm_coe, mul_one, Real.norm_eq_abs, abs_of_pos hr] + · intro hz + have hn : ‖r⁻¹ • z‖ = 1 := by + rw [norm_smul, mem_sphere_zero_iff_norm.mp hz, norm_inv, Real.norm_eq_abs, abs_of_pos hr] + exact inv_mul_cancel₀ (ne_of_gt hr) + refine ⟨⟨r⁻¹ • z, mem_sphere_zero_iff_norm.mpr hn⟩, ?_⟩ + change r • (r⁻¹ • z) = z + rw [smul_smul, mul_inv_cancel₀ (ne_of_gt hr), one_smul] + +/-- The coordinate circle parametrizes the entire boundary of +the crossing disc continuously and injectively. This supplies +boundary data for the disc matching in XII (4.5), page 253. -/ +theorem crossDiscParam_properties (A : ℂ ≃L[ℝ] ℂ) (x : ℂ) + {r : ℝ} (hr : 0 < r) : + Continuous (crossDiscParam A x r) ∧ Function.Injective (crossDiscParam A x r) ∧ + range (crossDiscParam A x r) = + discBd ((fun z => x + A z) '' closedBall 0 r) := by + have hc : Continuous (crossDiscParam A x r) := by + unfold crossDiscParam + fun_prop + have hinj : Function.Injective (crossDiscParam A x r) := by + intro a b hab + apply Subtype.ext + have hsm : r • (a : ℂ) = r • (b : ℂ) := A.injective (add_left_cancel hab) + exact (smul_right_injective _ (ne_of_gt hr)) hsm + let h : ℂ ≃ₜ ℂ := A.toHomeomorph.trans (Homeomorph.addLeft x) + have hD : IsClosedDisc (closedBall (0 : ℂ) r) ∧ + discBd (closedBall (0 : ℂ) r) = sphere 0 r := by + have hi : interior (closedBall (0 : ℂ) r) = ball 0 r := interior_closedBall _ (ne_of_gt hr) + obtain ⟨hd, hb⟩ := isClosedDisc_of_convex (convex_closedBall (0 : ℂ) r) + (by rw [hi]; exact ⟨0, mem_ball_self hr⟩) isBounded_closedBall isClosed_closedBall + exact ⟨hd, hb.trans (frontier_closedBall _ (ne_of_gt hr))⟩ + have hb := (hD.1.image h.continuous.continuousOn h.symm.continuous.continuousOn + (fun z _ => h.symm_apply_apply z)).2 + rw [hD.2] at hb + refine ⟨hc, hinj, ?_⟩ + change range (h ∘ (fun w : Circle => r • (w : ℂ))) = discBd (h '' closedBall 0 r) + rw [range_comp, range_scaled_circle hr, hb] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CrossDiscQuadrants.lean b/LeanPool/GraphMinor/GM12/Section4CrossDiscQuadrants.lean new file mode 100644 index 0000000000..d988efcf87 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CrossDiscQuadrants.lean @@ -0,0 +1,118 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CrossDiscParam +public import LeanPool.GraphMinor.Surface.CircleMove +import LeanPool.GraphMinor.GM12.Section4CircleAvoidance + +/-! +# Four ordered marks on a crossing disc + +In XII (4.5), claim (1), page 253, the two crossing arcs give +four boundary marks in alternating order. Parametrize them at +zero, one quarter, one half, and three quarters of a turn. The +parametrization is injective on these positions. Its opposite +pairs are the real-axis and imaginary-axis contact pairs. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Surface + +private theorem ee_quarter : (ee (1 / 4) : ℂ) = Complex.I := by + unfold ee + have he : 2 * Real.pi * (1 / 4 : ℝ) = Real.pi / 2 := by ring + rw [he, Circle.coe_exp, Complex.exp_mul_I, ← Complex.ofReal_cos, ← Complex.ofReal_sin] + simp + +private theorem ee_half : (ee (1 / 2) : ℂ) = -1 := by + unfold ee + have he : 2 * Real.pi * (1 / 2 : ℝ) = Real.pi := by ring + rw [he, Circle.coe_exp] + exact Complex.exp_pi_mul_I + +private theorem ee_three_quarters : (ee (3 / 4) : ℂ) = -Complex.I := by + unfold ee + have he : 2 * Real.pi * (3 / 4 : ℝ) = Real.pi + Real.pi / 2 := by ring + rw [he, Circle.coe_exp, Complex.ofReal_add, add_mul, Complex.exp_add, Complex.exp_pi_mul_I, + Complex.exp_mul_I, ← Complex.ofReal_cos, ← Complex.ofReal_sin] + simp + +/-- The four marks in their order in the coordinate circle. -/ +noncomputable def crossDiscMarks (A : ℂ ≃L[ℝ] ℂ) (x : ℂ) (r : ℝ) (i : Fin 4) : ℂ := + crossDiscParam A x r (ee ((i.val : ℝ) / 4)) + +/-- The four quarter-turn marks are distinct on every positive +radius crossing disc. -/ +theorem crossDiscMarks_injective (A : ℂ ≃L[ℝ] ℂ) (x : ℂ) + {r : ℝ} (hr : 0 < r) : Function.Injective (crossDiscMarks A x r) := by + intro i j hij + have he : ee ((i.val : ℝ) / 4) = ee ((j.val : ℝ) / 4) := + (crossDiscParam_properties A x hr).2.1 hij + have hi3 : (i.val : ℝ) ≤ 3 := by exact_mod_cast (show i.val ≤ 3 by omega) + have hj3 : (j.val : ℝ) ≤ 3 := by exact_mod_cast (show j.val ≤ 3 by omega) + have h := ee_injOn_short_interval (a := -(1 / 8 : ℝ)) (b := 7 / 8) (by norm_num) + (show (i.val : ℝ) / 4 ∈ Ioo (-(1 / 8 : ℝ)) (7 / 8) from + ⟨by linarith [Nat.cast_nonneg (α := ℝ) i.val], by linarith⟩) + (show (j.val : ℝ) / 4 ∈ Ioo (-(1 / 8 : ℝ)) (7 / 8) from + ⟨by linarith [Nat.cast_nonneg (α := ℝ) j.val], by linarith⟩) he + apply Fin.ext + have hv : (i.val : ℝ) = (j.val : ℝ) := by linarith + exact_mod_cast hv + +/-- The mark set has four points and is contained in the disc +boundary, as required in XII (4.5), claim (1), page 253. -/ +theorem crossDiscMarks_card_boundary (A : ℂ ≃L[ℝ] ℂ) (x : ℂ) + {r : ℝ} (hr : 0 < r) : + (range (crossDiscMarks A x r)).ncard = 4 ∧ + range (crossDiscMarks A x r) ⊆ + discBd ((fun z => x + A z) '' Metric.closedBall 0 r) := by + refine ⟨?_, ?_⟩ + · simpa using ncard_range_of_injective (crossDiscMarks_injective A x hr) + · rintro z ⟨i, rfl⟩ + rw [← (crossDiscParam_properties A x hr).2.2] + exact mem_range_self (ee ((i.val : ℝ) / 4)) + +/-- The ordered quarter-turn marks give the two opposite pairs +from the coordinate axes. -/ +theorem crossDiscMarks_values (A : ℂ ≃L[ℝ] ℂ) (x : ℂ) (r : ℝ) : + crossDiscMarks A x r 0 = x + A (r • (1 : ℂ)) ∧ + crossDiscMarks A x r 1 = x + A (r • Complex.I) ∧ + crossDiscMarks A x r 2 = x + A ((-r) • (1 : ℂ)) ∧ + crossDiscMarks A x r 3 = x + A ((-r) • Complex.I) := by + have he0 : (ee 0 : ℂ) = 1 := by simp [ee] + refine ⟨?_, ?_, ?_, ?_⟩ + · simp only [crossDiscMarks, crossDiscParam, Fin.val_zero, Nat.cast_zero, zero_div, he0] + · simp only [crossDiscMarks, crossDiscParam, Fin.val_one, Nat.cast_one, ee_quarter] + · change x + A (r • (ee (2 / 4) : ℂ)) = _ + have he2 : (2 : ℝ) / 4 = 1 / 2 := by norm_num + simp only [he2, ee_half, smul_neg, neg_smul] + · change x + A (r • (ee (3 / 4) : ℂ)) = _ + simp only [ee_three_quarters, smul_neg, neg_smul] + +/-- The literal quarter-turn boundary parameters give the real +and imaginary axis contacts of a crossing disc. -/ +theorem crossDiscParam_quarter_values (A : ℂ ≃L[ℝ] ℂ) (x : ℂ) (r : ℝ) : + crossDiscParam A x r (ee 0) = x + A (r • (1 : ℂ)) ∧ + crossDiscParam A x r (ee (1 / 4)) = x + A (r • Complex.I) ∧ + crossDiscParam A x r (ee (1 / 2)) = x + A ((-r) • (1 : ℂ)) ∧ + crossDiscParam A x r (ee (3 / 4)) = x + A ((-r) • Complex.I) := by + obtain ⟨h0, h1, h2, h3⟩ := crossDiscMarks_values A x r + refine ⟨?_, ?_, ?_, ?_⟩ + · simpa only [crossDiscMarks, Fin.val_zero, Nat.cast_zero, zero_div] using h0 + · simpa only [crossDiscMarks, Fin.val_one, Nat.cast_one] using h1 + · change crossDiscParam A x r (ee ((2 : ℝ) / 4)) = _ at h2 + have he2 : (2 : ℝ) / 4 = 1 / 2 := by norm_num + simpa only [he2] using h2 + · exact h3 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CrossingContactLocation.lean b/LeanPool/GraphMinor/GM12/Section4CrossingContactLocation.lean new file mode 100644 index 0000000000..004abcc2d5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CrossingContactLocation.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Locating the residual contacts on their crossing discs + +For XII (4.5), claim (1), page 253, the end of a residual +half-edge lies on the boundary of its own crossing disc. +Indeed, it lies in some crossing disc because it is on the +frontier of their closed union. A disc for an unrelated pair +misses the edge. Either incident edge determines that disc's +centre, and the one-crossing equation identifies it as the +edge's own crossing. The two distinct residual ends of the +edge therefore give exactly its two opposite boundary marks. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A residual contact of an edge lies on its own crossing +disc boundary. The protected-disc and one-crossing equations +exclude every other disc. This is used in XII (4.5), claim (1), +page 253. -/ +theorem crossing_contact_mem_own_boundary {S T E : Type*} + [TopologicalSpace S] [T2Space S] [Finite T] + (hS : IsClosedSurface S) (D : T → Set S) (hD : ∀ i, IsClosedDisc (D i)) + (x : T → S) (hinj : Function.Injective x) (P : E → Set S) (left right : T → E) + (hpair : ∀ i, x i ∈ P (left i) ∩ P (right i)) + (havoid : ∀ i e, e ≠ left i → e ≠ right i → Disjoint (D i) (P e)) + (e : E) (y : T) (hmeet : P e ∩ range x = {x y}) + {z : S} (hz : z ∈ P e ∩ frontier (⋃ i, D i)) : z ∈ discBd (D y) := by + classical + have hZ : IsClosed (⋃ i, D i) := isClosed_iUnion_of_finite (fun i => (hD i).isClosed) + have hzZ : z ∈ ⋃ i, D i := hZ.closure_eq ▸ hz.2.1 + obtain ⟨i, hzi⟩ := mem_iUnion.mp hzZ + have hei : e = left i ∨ e = right i := by + by_cases hl : e = left i + · exact Or.inl hl + by_cases hr : e = right i + · exact Or.inr hr + exact False.elim (disjoint_left.mp (havoid i e hl hr) hzi hz.1) + have hxiP : x i ∈ P e := hei.elim (fun h => h.symm ▸ (hpair i).1) (fun h => h.symm ▸ (hpair i).2) + have hxy : x i = x y := mem_singleton_iff.mp (hmeet.subset ⟨hxiP, mem_range_self i⟩) + have hiy : i = y := hinj hxy + have hzDy : z ∈ D y := hiy ▸ hzi + rw [← GM11.IsClosedDisc.frontier_eq_discBd hS (hD y)] + refine ⟨subset_closure hzDy, ?_⟩ + intro hint + exact hz.2.2 (interior_mono (subset_iUnion D y) hint) + +/-- Two distinct residual ends of one edge are exactly its +opposite boundary-contact pair. This is the opposite-pair +identification in XII (4.5), claim (1), page 253. -/ +theorem crossing_contact_pair_eq {S T E : Type*} + [TopologicalSpace S] [T2Space S] [Finite T] + (hS : IsClosedSurface S) (D : T → Set S) (hD : ∀ i, IsClosedDisc (D i)) + (x : T → S) (hinj : Function.Injective x) (P : E → Set S) (left right : T → E) + (hpair : ∀ i, x i ∈ P (left i) ∩ P (right i)) + (havoid : ∀ i e, e ≠ left i → e ≠ right i → Disjoint (D i) (P e)) + (e : E) (y : T) (hmeet : P e ∩ range x = {x y}) + {a b u v : S} (hbd : P e ∩ discBd (D y) = {a, b}) (huv : u ≠ v) + (hu : u ∈ P e ∩ frontier (⋃ i, D i)) (hv : v ∈ P e ∩ frontier (⋃ i, D i)) : + ({u, v} : Set S) = {a, b} := by + have hu' : u = a ∨ u = b := hbd.subset ⟨hu.1, + crossing_contact_mem_own_boundary hS D hD x hinj P left right hpair havoid e y hmeet hu⟩ + have hv' : v = a ∨ v = b := hbd.subset ⟨hv.1, + crossing_contact_mem_own_boundary hS D hD x hinj P left right hpair havoid e y hmeet hv⟩ + rcases hu' with rfl | rfl <;> rcases hv' with rfl | rfl + · exact False.elim (huv rfl) + · rfl + · exact pair_comm _ _ + · exact False.elim (huv rfl) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CrossingCount.lean b/LeanPool/GraphMinor/GM12/Section4CrossingCount.lean new file mode 100644 index 0000000000..9099329089 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CrossingCount.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CrossingPoints +public import Mathlib.Algebra.BigOperators.Group.Finset.Defs +import Mathlib.Data.Set.Card +import Mathlib.Data.Fintype.Sigma +import Mathlib.Algebra.BigOperators.Group.Finset.Basic + +/-! +# Counting the subdivided source edges + +XII (4.5), page 252, has twice as many subdivided edges as +crossings. Count incidences between an original edge and one of +its meeting points. Counting first by edges gives the sum of the +meeting counts on the edges. Counting first by meeting points +gives two incidences for each point, since no third edge passes +through it away from the vertices. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set +open scoped BigOperators + +/-- The sum of the meeting counts on the original edges is twice +the total number of meetings. Combined with one piece per meeting, +this proves the edge count in XII (4.5), page 252. -/ +theorem sum_edge_meeting_counts {m n : ℕ} (V : Fin m → ℂ) (E : Fin n → Set ℂ) + (hfinite : ∀ i j, i ≠ j → (E i ∩ E j).Finite) + (htriple : ∀ i j k, i ≠ j → j ≠ k → i ≠ k → E i ∩ E j ∩ E k ⊆ range V) : + (∑ i, (E i ∩ edgeMeetingPoints V E).ncard) = 2 * (edgeMeetingPoints V E).ncard := by + classical + let X := edgeMeetingPoints V E + let : Fintype X := (finite_edgeMeetingPoints V E hfinite).fintype + let A := Σ i : Fin n, {x : X // x.val ∈ E i} + let B := Σ x : X, {i : Fin n // x.val ∈ E i} + let swap : A ≃ B := { + toFun := fun a => ⟨a.2.val, ⟨a.1, a.2.property⟩⟩ + invFun := fun b => ⟨b.2.val, ⟨b.1, b.2.property⟩⟩ + left_inv := by rintro ⟨i, ⟨x, hx⟩⟩; rfl + right_inv := by rintro ⟨x, ⟨i, hi⟩⟩; rfl } + have hcardEdge : ∀ i, Fintype.card {x : X // x.val ∈ E i} = (E i ∩ X).ncard := by + intro i + let e : {x : X // x.val ∈ E i} ≃ ↥(E i ∩ X) := { + toFun := fun x => ⟨x.val.val, ⟨x.property, x.val.property⟩⟩ + invFun := fun x => ⟨⟨x.val, x.property.2⟩, x.property.1⟩ + left_inv := by rintro ⟨⟨x, hx⟩, hi⟩; rfl + right_inv := by rintro ⟨x, hx⟩; rfl } + calc + Fintype.card {x : X // x.val ∈ E i} = Nat.card {x : X // x.val ∈ E i} := + Nat.card_eq_fintype_card.symm + _ = Nat.card ↥(E i ∩ X) := Nat.card_congr e + _ = (E i ∩ X).ncard := Nat.card_coe_set_eq _ + have hcardPoint : ∀ x : X, Fintype.card {i : Fin n // x.val ∈ E i} = 2 := by + intro x + obtain ⟨i, j, hij, hx, hxV⟩ := x.property + have hset : {k : Fin n | x.val ∈ E k} = {i, j} := by + ext k + constructor + · intro hk + exact edge_eq_of_mem_pair_meeting V E htriple hij ⟨hx, hxV⟩ hk + · rintro (rfl | rfl) + · exact hx.1 + · exact hx.2 + calc + Fintype.card {i : Fin n // x.val ∈ E i} = ({i : Fin n | x.val ∈ E i} : Set (Fin n)).ncard := + fintypeCard_eq_ncard (s := {i : Fin n | x.val ∈ E i}) + _ = 2 := by rw [hset, ncard_pair hij] + calc + (∑ i, (E i ∩ X).ncard) = ∑ i, Fintype.card {x : X // x.val ∈ E i} := + Finset.sum_congr rfl fun i _ => (hcardEdge i).symm + _ = Fintype.card A := Fintype.card_sigma.symm + _ = Fintype.card B := Fintype.card_congr swap + _ = ∑ x : X, Fintype.card {i : Fin n // x.val ∈ E i} := Fintype.card_sigma + _ = ∑ _x : X, (2 : ℕ) := Finset.sum_congr rfl fun x _ => hcardPoint x + _ = 2 * X.ncard := by simp [fintypeCard_eq_ncard, Nat.mul_comm] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CrossingEndClasses.lean b/LeanPool/GraphMinor/GM12/Section4CrossingEndClasses.lean new file mode 100644 index 0000000000..66e91c9ad2 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CrossingEndClasses.lean @@ -0,0 +1,110 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4EndPartition +import Mathlib.Tactic.FinCases + +/-! +# Endpoint classes and the four marks at each crossing + +In XII (4.5), page 253, the edge-pair bijection identifies all +source edge ends with the four marks at each crossing. The +opposite-pair equations prove that these ends cover exactly +the union of the marked quadruples. Two noncrossing incident +edges at a vertex belong to different crossings, so that +vertex's endpoint class meets two distinct crossing discs. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- The opposite-pair equations and the edge-pair bijection +identify the full end set with all four crossing marks. This +is the endpoint cover in XII (4.5), claim (1), page 253. -/ +theorem range_ends_eq_crossing_marks {S T E : Type*} (σ : T × Bool ≃ E) + (ends : E × Bool → S) (m : T → Fin 4 → S) + (h0 : ∀ i, ({ends (σ (i, false), false), ends (σ (i, false), true)} : Set S) = {m i 0, m i 2}) + (h1 : ∀ i, ({ends (σ (i, true), false), ends (σ (i, true), true)} : Set S) = {m i 1, m i 3}) : + range ends = ⋃ i, range (m i) := by + apply Subset.antisymm + · rintro z ⟨⟨e, b⟩, rfl⟩ + obtain ⟨⟨i, c⟩, rfl⟩ := σ.surjective e + apply mem_iUnion.mpr + refine ⟨i, ?_⟩ + have hpair : ends (σ (i, c), b) ∈ + ({ends (σ (i, c), false), ends (σ (i, c), true)} : Set S) := by cases b <;> simp + cases c + · rw [h0 i] at hpair + rcases hpair with heq | heq + · exact ⟨0, heq.symm⟩ + · exact ⟨2, (mem_singleton_iff.mp heq).symm⟩ + · rw [h1 i] at hpair + rcases hpair with heq | heq + · exact ⟨1, heq.symm⟩ + · exact ⟨3, (mem_singleton_iff.mp heq).symm⟩ + · intro z hz + obtain ⟨i, j, rfl⟩ := mem_iUnion.mp hz + have hp0 : ({m i 0, m i 2} : Set S) ⊆ range ends := by + rw [← h0 i] + rintro z (rfl | rfl) <;> exact mem_range_self _ + have hp1 : ({m i 1, m i 3} : Set S) ⊆ range ends := by + rw [← h1 i] + rintro z (rfl | rfl) <;> exact mem_range_self _ + fin_cases j + · exact hp0 (Or.inl rfl) + · exact hp1 (Or.inl rfl) + · exact hp0 (Or.inr rfl) + · exact hp1 (Or.inr rfl) + +/-- Noncrossing incident edges give contacts at different +crossings. This is the two-region witness for each branch in +XII (4.5)'s final small-side bound, page 253. -/ +theorem two_crossing_classes_of_noncrossing_pairs {S V E T : Type*} + (v : V → S) (P : E → Set S) (κ : E × Bool → V) (x : T → S) + (σ : T × Bool ≃ E) (hxV : ∀ i, x i ∉ range v) + (hpair : ∀ i, x i ∈ P (σ (i, false)) ∩ P (σ (i, true))) + (hPV : ∀ e w, v w ∈ P e → w = κ (e, false) ∨ w = κ (e, true)) + (htwo : ∀ w, ∃ e f, P e ∩ P f = {v w}) : + ∀ w, ∃ i j, i ≠ j ∧ ∃ b c d e : Bool, + κ (σ (i, b), c) = w ∧ κ (σ (j, d), e) = w := by + intro w + obtain ⟨e, f, hef⟩ := htwo w + obtain ⟨⟨i, b⟩, hei⟩ := σ.surjective e + obtain ⟨⟨j, d⟩, hfj⟩ := σ.surjective f + have hxi : x i ∈ P e := by + rw [← hei] + cases b + · exact (hpair i).1 + · exact (hpair i).2 + have hxj : x j ∈ P f := by + rw [← hfj] + cases d + · exact (hpair j).1 + · exact (hpair j).2 + have hij : i ≠ j := by + intro h + have hxboth : x i ∈ P e ∩ P f := ⟨hxi, h.symm ▸ hxj⟩ + have hxw : x i = v w := mem_singleton_iff.mp (hef.subset hxboth) + exact hxV i ⟨w, hxw.symm⟩ + have hw : v w ∈ P e ∩ P f := hef.symm.subset (mem_singleton _) + obtain ⟨c, hc⟩ : ∃ c : Bool, κ (e, c) = w := by + rcases hPV e w hw.1 with h | h + · exact ⟨false, h.symm⟩ + · exact ⟨true, h.symm⟩ + obtain ⟨a, ha⟩ : ∃ a : Bool, κ (f, a) = w := by + rcases hPV f w hw.2 with h | h + · exact ⟨false, h.symm⟩ + · exact ⟨true, h.symm⟩ + exact ⟨i, j, hij, b, c, d, a, hei ▸ hc, hfj ▸ ha⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CrossingFeasibility.lean b/LeanPool/GraphMinor/GM12/Section4CrossingFeasibility.lean new file mode 100644 index 0000000000..0f10fa73c4 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CrossingFeasibility.lean @@ -0,0 +1,160 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CliqueCrossingSource +public import LeanPool.GraphMinor.GM12.Section4OneCrossingDiscSystem +public import LeanPool.GraphMinor.GM12.Section4EmbeddedOppositeContacts +public import LeanPool.GraphMinor.GM12.Section4QuadPartitionTransport +public import LeanPool.GraphMinor.GM12.Section4CrossingEndClasses +import LeanPool.GraphMinor.GM12.Section4PlaneChart +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.Surface.Wedge + +/-! +# The feasible crossing partition of XII (4.5) + +We assemble claim (1), page 253. Construct the one-crossing +subdivision of a clique, label its two edges at each crossing, +and choose the protected small crossing discs. Carry the plane +configuration into a surface chart and thicken its vertex +stars. Match the resulting four-marked disc family to any +prescribed family. The transported vertex discs witness the +feasibility condition, and the transported edge ends give the +required opposite pairs. The graph, crossing count, partition, +and all disc witnesses are constructed in the proof. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Graph Metric + +/-- The ordered-parameter form of Graph Minors XII, (4.5), claim (1), page 253: the source +subdivision supplies a feasible endpoint partition on any +prescribed disjoint four-marked discs. The witness discs are +stated explicitly so that the vertex type can be relabelled +when applying (3.2). This source construction works for `p ≥ 4`. +The paper uses it after reducing to `p ≥ 5`. -/ +theorem theorem_4_5_claim_1_ordered {S : Type} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {p : ℕ} (hp : 4 ≤ p) : + ∃ (W E : Type) (L : Graph W E) (κ : E × Bool → W) (t : ℕ) (σ : Fin t × Bool ≃ E), + Finite W ∧ Finite E ∧ IsIsoMinor (GM16.completeGraph p) L ∧ + L.vertexSet = univ ∧ L.edgeSet = univ ∧ + (∀ e, L.IsLink e (κ (e, false)) (κ (e, true))) ∧ + (∀ e, κ (e, false) ≠ κ (e, true)) ∧ 2 ≤ t ∧ + (∀ w, ∃ i j, i ≠ j ∧ ∃ b c d e : Bool, + κ (σ (i, b), c) = w ∧ κ (σ (j, d), e) = w) ∧ + ∀ (Δ : Fin t → Set S) (q : Fin t → Circle → S) (β : Fin t → Fin 4 → ℝ), + (∀ i, IsClosedDisc (Δ i)) → Pairwise (fun i j => Disjoint (Δ i) (Δ j)) → + (∀ i, Continuous (q i) ∧ Function.Injective (q i) ∧ range (q i) = discBd (Δ i)) → + (∀ i, StrictMono (β i)) → (∀ i j, β i j ∈ Ico 0 1) → + ∃ (ends : E × Bool → S) (B : W → Set S), Function.Injective ends ∧ + (∀ w, IsClosedDisc (B w)) ∧ Pairwise (fun w z => Disjoint (B w) (B z)) ∧ + (∀ w, B w ∩ (⋃ i, Δ i) = edgeEndClass ends κ w) ∧ + (∀ i, ({ends (σ (i, false), false), ends (σ (i, false), true)} : Set S) = + {q i (ee (β i 0)), q i (ee (β i 2))}) ∧ + (∀ i, ({ends (σ (i, true), false), ends (σ (i, true), true)} : Set S) = + {q i (ee (β i 1)), q i (ee (β i 3))}) := by + classical + obtain ⟨W, E, L, v, κ, P, hW, hE, hminor, hvinj, hLV, hLE, hlink, hPline, + hPV, _, htriple, hcross, htwo, hM, hMtwo, _, hlocal⟩ := exists_clique_one_crossing_source hp + have hκne : ∀ e, κ (e, false) ≠ κ (e, true) := by + intro e heq + obtain ⟨g, hg, -, hg0, hg1⟩ := (hPline e).exists_arc + have h01 : g 0 = g 1 := hg0.trans ((congrArg v heq).trans hg1.symm) + exact (show (0 : unitInterval) ≠ 1 by norm_num) (hg.2 h01) + let : Finite W := hW + let : Finite E := hE + let : Fintype W := Fintype.ofFinite W + let : Fintype E := Fintype.ofFinite E + let X := edgeMeetingPoints v P + let : Fintype X := hM.fintype + let t := Fintype.card X + let ν : Fin t ≃ X := (Fintype.equivFin X).symm + obtain ⟨σ₀, A, r, D, hpair, hpos, hD, hDD, hcentre, hDv, hDP, hleft, hright, hcoord⟩ := + exists_one_crossing_disc_system v P (fun e => (hPline e).isCompact.isClosed) + hM htriple hcross hlocal + let σ : Fin t × Bool ≃ E := (ν.prodCongr (Equiv.refl Bool)).trans σ₀ + have ht : 2 ≤ t := by + have hcard : Fintype.card X = X.ncard := fintypeCard_eq_ncard X + change 2 ≤ Fintype.card X + rw [hcard] + exact hMtwo + have hxV : ∀ x : X, x.val ∉ range v := by + intro x + obtain ⟨_, _, _, _, hx⟩ := x.property + exact hx + have htwoX := two_crossing_classes_of_noncrossing_pairs v P κ Subtype.val σ₀ hxV hpair + (fun e w hw => (hPV e w).mp hw) (fun w => by + obtain ⟨e, f, _, hef⟩ := htwo w + exact ⟨e, f, hef⟩) + have htwoFin : ∀ w, ∃ i j : Fin t, i ≠ j ∧ ∃ b c d e : Bool, + κ (σ (i, b), c) = w ∧ κ (σ (j, d), e) = w := by + intro w + obtain ⟨i, j, hij, b, c, d, e, hκi, hκj⟩ := htwoX w + refine ⟨ν.symm i, ν.symm j, (fun h => hij (ν.symm.injective h)), b, c, d, e, ?_, ?_⟩ + · simpa only [σ, Equiv.trans_apply, Equiv.prodCongr_apply, Prod.map, Equiv.refl_apply, + ν.apply_symm_apply] using hκi + · simpa only [σ, Equiv.trans_apply, Equiv.prodCongr_apply, Prod.map, Equiv.refl_apply, + ν.apply_symm_apply] using hκj + obtain ⟨f, hf⟩ := exists_plane_openEmbedding hS + obtain ⟨ends₀, B₀, hends₀, hB₀, hB₀B₀, hcontact₀, hpair₀, hpair₁⟩ := + exists_embedded_opposite_contacts hS f hf v hvinj κ P hPline + (fun e w hw => (hPV e w).mp hw) hcross hM σ₀ A r D hpair hD hcentre hDv hDP hleft hright + let C : X → Set S := fun x => f '' D x + let sourceParam : X → Circle → S := fun x w => f (crossDiscParam (A x) x.val (r x) w) + have himage : ∀ x : X, IsClosedDisc (C x) ∧ discBd (C x) = f '' discBd (D x) := + fun x => Surface.isClosedDisc_image_injOn (hD x) (hD x).isCompact hf.continuous.continuousOn + hf.injective.injOn + have hCC : Pairwise (fun x y : X => Disjoint (C x) (C y)) := + fun x y hxy => (disjoint_image_iff hf.injective).mpr (hDD x y hxy) + have hp : ∀ x : X, Continuous (sourceParam x) ∧ Function.Injective (sourceParam x) ∧ + range (sourceParam x) = discBd (C x) := by + intro x + have hp₀ := crossDiscParam_properties (A x) x.val (hpos x) + rw [← hcoord x] at hp₀ + refine ⟨hf.continuous.comp hp₀.1, hf.injective.comp hp₀.2.1, ?_⟩ + change range (f ∘ crossDiscParam (A x) x.val (r x)) = _ + rw [range_comp, hp₀.2.2, (himage x).2] + refine ⟨W, E, L, κ, t, σ, hW, hE, hminor, hLV, hLE, hlink, hκne, ht, htwoFin, ?_⟩ + intro Δ q β hΔ hΔΔ htarget hβ hβ01 + have hβ03 : ∀ x : X, β (ν.symm x) 3 < β (ν.symm x) 0 + 1 := fun x => by + linarith [(hβ01 (ν.symm x) 3).2, (hβ01 (ν.symm x) 0).1] + obtain ⟨ends, B, hinj, hB, hBB, hcontact, h0, h1⟩ := exists_quad_partition_transport hS C + (fun x : X => Δ (ν.symm x)) B₀ (fun x => (himage x).1) (fun x => hΔ (ν.symm x)) hCC + (fun x y hxy => hΔΔ (fun h => hxy (ν.symm.injective h))) hB₀ hB₀B₀ sourceParam + (fun x => q (ν.symm x)) hp (fun x => htarget (ν.symm x)) + σ₀ ends₀ κ hends₀ hcontact₀ hpair₀ hpair₁ + (fun x => β (ν.symm x) 0) (fun x => β (ν.symm x) 1) + (fun x => β (ν.symm x) 2) (fun x => β (ν.symm x) 3) + (fun x => hβ (ν.symm x) (by decide)) (fun x => hβ (ν.symm x) (by decide)) + (fun x => hβ (ν.symm x) (by decide)) hβ03 + have hunion : (⋃ x : X, Δ (ν.symm x)) = ⋃ i : Fin t, Δ i := by + ext z + constructor + · intro hz + obtain ⟨x, hx⟩ := mem_iUnion.mp hz + exact mem_iUnion.mpr ⟨ν.symm x, hx⟩ + · intro hz + obtain ⟨i, hi⟩ := mem_iUnion.mp hz + exact mem_iUnion.mpr ⟨ν i, by simpa only [ν.symm_apply_apply] using hi⟩ + refine ⟨ends, B, hinj, hB, hBB, ?_, ?_, ?_⟩ + · intro w + rw [← hunion] + exact hcontact w + · intro i + simpa only [σ, Equiv.trans_apply, Equiv.prodCongr_apply, Prod.map, Equiv.refl_apply, + ν.symm_apply_apply] using h0 (ν i) + · intro i + simpa only [σ, Equiv.trans_apply, Equiv.prodCongr_apply, Prod.map, Equiv.refl_apply, + ν.symm_apply_apply] using h1 (ν i) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CrossingFeasibilityUniverses.lean b/LeanPool/GraphMinor/GM12/Section4CrossingFeasibilityUniverses.lean new file mode 100644 index 0000000000..8aad2e7ad4 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CrossingFeasibilityUniverses.lean @@ -0,0 +1,91 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CrossingFeasibility +public import LeanPool.GraphMinor.GM12.Section4SmallSurfaceCopy +public import LeanPool.GraphMinor.GM12.Section4ContactPartitionImage + +/-! +# Crossing feasibility in arbitrary surface universes + +For XII (4.5), claim (1), page 253, perform the geometric +construction on a homeomorphic small surface. Carry each +prescribed disc and its boundary parametrization to that +surface, use the ordered crossing partition, then carry the +vertex discs and endpoints back. The homeomorphism preserves +all contact and opposite-pair equations. No size assumption +is added to the surface in the conclusion. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Graph + +/-- The ordered-parameter form of XII (4.5), claim (1), page 253, +in arbitrary surface universes. The small-copy construction +retains all graph and disc witnesses without a size hypothesis. -/ +theorem theorem_4_5_claim_1_ordered_univ {S : Type*} [TopologicalSpace S] + [ConnectedSpace S] + (hS : IsClosedSurface S) {p : ℕ} (hp : 4 ≤ p) : + ∃ (W E : Type) (L : Graph W E) (κ : E × Bool → W) (t : ℕ) (σ : Fin t × Bool ≃ E), + Finite W ∧ Finite E ∧ IsIsoMinor (GM16.completeGraph p) L ∧ + L.vertexSet = univ ∧ L.edgeSet = univ ∧ + (∀ e, L.IsLink e (κ (e, false)) (κ (e, true))) ∧ + (∀ e, κ (e, false) ≠ κ (e, true)) ∧ 2 ≤ t ∧ + (∀ w, ∃ i j, i ≠ j ∧ ∃ b c d e : Bool, + κ (σ (i, b), c) = w ∧ κ (σ (j, d), e) = w) ∧ + ∀ (Δ : Fin t → Set S) (q : Fin t → Circle → S) (β : Fin t → Fin 4 → ℝ), + (∀ i, IsClosedDisc (Δ i)) → Pairwise (fun i j => Disjoint (Δ i) (Δ j)) → + (∀ i, Continuous (q i) ∧ Function.Injective (q i) ∧ range (q i) = discBd (Δ i)) → + (∀ i, StrictMono (β i)) → (∀ i j, β i j ∈ Ico 0 1) → + ∃ (ends : E × Bool → S) (B : W → Set S), Function.Injective ends ∧ + (∀ w, IsClosedDisc (B w)) ∧ Pairwise (fun w z => Disjoint (B w) (B z)) ∧ + (∀ w, B w ∩ (⋃ i, Δ i) = edgeEndClass ends κ w) ∧ + (∀ i, ({ends (σ (i, false), false), ends (σ (i, false), true)} : Set S) = + {q i (ee (β i 0)), q i (ee (β i 2))}) ∧ + (∀ i, ({ends (σ (i, true), false), ends (σ (i, true), true)} : Set S) = + {q i (ee (β i 1)), q i (ee (β i 3))}) := by + classical + obtain ⟨S₀, tS₀, ⟨e⟩, hS₀⟩ := exists_small_closed_surface_copy hS + let : TopologicalSpace S₀ := tS₀ + let : T2Space S₀ := hS₀.2.1 + let : ConnectedSpace S₀ := e.surjective.connectedSpace e.continuous + obtain ⟨W, E, L, κ, t, σ, hW, hE, hminor, hLV, hLE, hlink, hκne, ht, htwo, hmain⟩ := + theorem_4_5_claim_1_ordered hS₀ hp + refine ⟨W, E, L, κ, t, σ, hW, hE, hminor, hLV, hLE, hlink, hκne, ht, htwo, ?_⟩ + intro Δ q β hΔ hΔΔ hq hβ hβ01 + let Δ₀ := fun i => e '' Δ i + let q₀ := fun i => e ∘ q i + have hΔ₀ : ∀ i, IsClosedDisc (Δ₀ i) := fun i => + ((hΔ i).image e.continuous.continuousOn e.symm.continuous.continuousOn + (fun z _ => e.symm_apply_apply z)).1 + have hΔΔ₀ : Pairwise (fun i j => Disjoint (Δ₀ i) (Δ₀ j)) := + fun i j hij => (disjoint_image_iff e.injective).mpr (hΔΔ hij) + have hq₀ : ∀ i, Continuous (q₀ i) ∧ Function.Injective (q₀ i) ∧ range (q₀ i) = discBd (Δ₀ i) := + fun i => boundary_param_image_homeomorph e (hΔ i) (q i) (hq i) + obtain ⟨ends₀, B₀, hinj₀, hB₀, hBB₀, hcontact₀, h0, h1⟩ := + hmain Δ₀ q₀ β hΔ₀ hΔΔ₀ hq₀ hβ hβ01 + obtain ⟨hB, hBB, hcontact⟩ := contact_partition_image e.symm B₀ Δ₀ ends₀ κ hB₀ hBB₀ hcontact₀ + refine ⟨e.symm ∘ ends₀, (fun w => e.symm '' B₀ w), e.symm.injective.comp hinj₀, + hB, hBB, ?_, ?_, ?_⟩ + · intro w + simpa only [Δ₀, image_image, e.symm_apply_apply, image_id'] using hcontact w + · intro i + have h := congrArg (fun X : Set S₀ => e.symm '' X) (h0 i) + simp only [image_pair] at h + simpa only [q₀, Function.comp_apply, e.symm_apply_apply] using h + · intro i + have h := congrArg (fun X : Set S₀ => e.symm '' X) (h1 i) + simp only [image_pair] at h + simpa only [q₀, Function.comp_apply, e.symm_apply_apply] using h + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CrossingLineModel.lean b/LeanPool/GraphMinor/GM12/Section4CrossingLineModel.lean new file mode 100644 index 0000000000..1fc74dc6cb --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CrossingLineModel.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4DistinctCrossDirections +public import LeanPool.GraphMinor.GM12.Section4ChordGeometry + +/-! +# Coordinates at a crossing of two chords + +For XII (4.5), page 253, distinct circle ports give distinct +supporting lines. At a meeting in the open unit disc, the vectors +from the meeting to one port of each chord are nonzero. Use these +vectors as the columns of the real-linear crossing coordinates. +Both complete supporting lines are then the coordinate axes. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric + +/-- Lines through disjoint pairs of unit-circle ports are distinct. +A unit-circle point of the other line would have to be one of its +two ports. -/ +theorem lines_ne_of_distinct_unit_ports {a c d : ℂ} (b : ℂ) + (ha : ‖a‖ = 1) (hc : ‖c‖ = 1) (hd : ‖d‖ = 1) + (hcd : c ≠ d) (hac : a ≠ c) (had : a ≠ d) : + line[ℝ, a, b] ≠ line[ℝ, c, d] := by + intro heq + have haL : a ∈ line[ℝ, c, d] := heq ▸ left_mem_affineSpan_pair ℝ a b + exact ((unit_circle_mem_line_iff hc hd hcd ha).mp haL).elim hac had + +/-- The two supporting lines at an interior meeting of distinct +chords are exactly the two axes of a translated continuous +real-linear equivalence, as used in XII (4.5), page 253. -/ +theorem exists_cross_coordinates_for_chords {a b c d x : ℂ} + (ha : ‖a‖ = 1) (hc : ‖c‖ = 1) + (hx : x ∈ ball (0 : ℂ) 1) + (hxa : x ∈ line[ℝ, a, b]) (hxc : x ∈ line[ℝ, c, d]) + (hne : line[ℝ, a, b] ≠ line[ℝ, c, d]) : + ∃ A : ℂ ≃L[ℝ] ℂ, + line[ℝ, x, x + A 1] = line[ℝ, a, b] ∧ + line[ℝ, x, x + A Complex.I] = line[ℝ, c, d] := by + have hnorm : ‖x‖ < 1 := mem_ball_zero_iff.mp hx + have hxa' : x ≠ a := by + intro heq + rw [heq, ha] at hnorm + exact (lt_irrefl (1 : ℝ)) hnorm + have hxc' : x ≠ c := by + intro heq + rw [heq, hc] at hnorm + exact (lt_irrefl (1 : ℝ)) hnorm + have hab : line[ℝ, x, a] = line[ℝ, a, b] := + affineSpan_pair_eq_of_mem_of_mem_of_ne hxa (left_mem_affineSpan_pair ℝ a b) hxa' + have hcd : line[ℝ, x, c] = line[ℝ, c, d] := + affineSpan_pair_eq_of_mem_of_mem_of_ne hxc (left_mem_affineSpan_pair ℝ c d) hxc' + have hax : x + (a - x) = a := by abel + have hcx : x + (c - x) = c := by abel + have hline : line[ℝ, x, x + (a - x)] ≠ line[ℝ, x, x + (c - x)] := by + simpa only [hax, hcx, hab, hcd] using hne + obtain ⟨A, hA, hA'⟩ := exists_cross_coordinates_of_distinct_lines + (sub_ne_zero.mpr (Ne.symm hxa')) (sub_ne_zero.mpr (Ne.symm hxc')) hline + refine ⟨A, ?_, ?_⟩ + · rw [hA, hax] + exact hab + · rw [hA', hcx] + exact hcd + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CrossingMultiplicity.lean b/LeanPool/GraphMinor/GM12/Section4CrossingMultiplicity.lean new file mode 100644 index 0000000000..9d2e91447c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CrossingMultiplicity.lean @@ -0,0 +1,55 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CrossingPoints +import Mathlib.Data.Set.Card + +/-! +# Distinct crossings at a noncrossing incident pair + +In XII (4.5), page 253, every source vertex has two incident +edges which do not cross each other. Each of those edges has +its own crossing. The crossing points are distinct, since a +common one would be in the two edges' intersection, which is +only their original vertex. In particular the source has at +least two crossings. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- A noncrossing incident pair forces at least two source +crossings when every edge has one crossing. This supplies the +nontrivial number of prescribed regions in XII (4.5), page 253. -/ +theorem two_le_ncard_meetings_of_noncrossing_pair {V E : Type*} + (v : V → ℂ) (P : E → Set ℂ) (hM : (edgeMeetingPoints v P).Finite) + (hcross : ∀ e, ∃ x ∈ edgeMeetingPoints v P, P e ∩ edgeMeetingPoints v P = {x}) + {w : V} {e f : E} (hinter : P e ∩ P f = {v w}) : + 2 ≤ (edgeMeetingPoints v P).ncard := by + obtain ⟨x, hxM, hxP⟩ := hcross e + obtain ⟨y, hyM, hyP⟩ := hcross f + have hxE : x ∈ P e := (hxP.symm.subset (mem_singleton _)).1 + have hyF : y ∈ P f := (hyP.symm.subset (mem_singleton _)).1 + have hxy : x ≠ y := by + intro heq + have hxv : x = v w := mem_singleton_iff.mp (hinter.subset ⟨hxE, heq.symm ▸ hyF⟩) + obtain ⟨_, _, _, _, hxV⟩ := hxM + exact hxV ⟨w, hxv.symm⟩ + have hsub : ({x, y} : Set ℂ) ⊆ edgeMeetingPoints v P := by + rintro z (rfl | rfl) + · exact hxM + · exact hyM + have h := ncard_le_ncard hsub hM + rwa [ncard_pair hxy] at h + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CrossingPairEquiv.lean b/LeanPool/GraphMinor/GM12/Section4CrossingPairEquiv.lean new file mode 100644 index 0000000000..1955d2a68e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CrossingPairEquiv.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Data.Set.Basic +import Mathlib.Data.Set.Insert + +/-! +# The bijection between edges and crossing pairs + +In XII (4.5), page 253, the edges of the subdivided source fall +into crossing pairs. Give each crossing its two incident edges. +Every edge has exactly one crossing, so two crossings cannot +supply the same edge. Conversely each edge is supplied by the +two-edge pair at its unique crossing. This gives the actual +bijection used to index the external paths by source edges. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- Edges with one crossing each are in bijection with the two +positions at every crossing. The map sends the two positions +to the two incident edges, as used to reindex the external +paths in XII (4.5), page 253. -/ +theorem exists_crossing_pair_equiv {X T E : Type*} + (x : T → X) (hinj : Function.Injective x) (P : E → Set X) (left right : T → E) + (hne : ∀ i, left i ≠ right i) + (hpair : ∀ i, x i ∈ P (left i) ∩ P (right i)) + (honly : ∀ i e, x i ∈ P e → e = left i ∨ e = right i) + (hsingle : ∀ e, ∃ i, P e ∩ range x = {x i}) : + ∃ σ : T × Bool ≃ E, ∀ i, σ (i, false) = left i ∧ σ (i, true) = right i := by + classical + let f : T × Bool → E := fun q => if q.2 then right q.1 else left q.1 + have hxf : ∀ q, x q.1 ∈ P (f q) := by + rintro ⟨i, b⟩ + cases b + · exact (hpair i).1 + · exact (hpair i).2 + have hfi : Function.Injective f := by + rintro ⟨i, b⟩ ⟨j, c⟩ heq + obtain ⟨k, hk⟩ := hsingle (f (i, b)) + have hix : x i = x k := mem_singleton_iff.mp (hk.subset ⟨hxf (i, b), mem_range_self i⟩) + have hjP : x j ∈ P (f (i, b)) := heq.symm ▸ hxf (j, c) + have hjx : x j = x k := mem_singleton_iff.mp (hk.subset ⟨hjP, mem_range_self j⟩) + have hij : i = j := hinj (hix.trans hjx.symm) + subst j + have hbc : b = c := by + cases b <;> cases c + · rfl + · exact False.elim (hne i heq) + · exact False.elim (hne i heq.symm) + · rfl + subst c + rfl + have hfs : Function.Surjective f := by + intro e + obtain ⟨i, hi⟩ := hsingle e + have hxe : x i ∈ P e := (hi.symm.subset (mem_singleton _)).1 + rcases honly i e hxe with he | he + · exact ⟨(i, false), he.symm⟩ + · exact ⟨(i, true), he.symm⟩ + exact ⟨Equiv.ofBijective f ⟨hfi, hfs⟩, fun _ => ⟨rfl, rfl⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CrossingPoints.lean b/LeanPool/GraphMinor/GM12/Section4CrossingPoints.lean new file mode 100644 index 0000000000..e01bbdf12a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CrossingPoints.lean @@ -0,0 +1,102 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4ChordGeometry +public import LeanPool.GraphMinor.Surface.CircleMove + +/-! +# The finite meeting points of the source edge arcs + +XII (4.5), pages 252--253, numbers the crossings before subdividing +the edges. In the port construction, two distinct supporting lines +meet at most once. Complete edges meet away from vertices only +where their inner chords meet. Thus each pair has at most one such +point, the whole set is finite, and no third edge passes through it. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The meetings of distinct edge arcs away from the vertices, +to be numbered in the source construction of XII (4.5), page 252. -/ +@[expose] def edgeMeetingPoints {S α β : Type*} (V : α → S) (E : β → Set S) : Set S := + {x | ∃ i j, i ≠ j ∧ x ∈ E i ∩ E j ∧ x ∉ range V} + +/-- A finite arc family with finite pairwise intersections has +only finitely many meetings away from vertices. This numbers the +meeting points in XII (4.5), page 252. -/ +theorem finite_edgeMeetingPoints {α β : Type*} [Finite β] (V : α → ℂ) (E : β → Set ℂ) + (hfinite : ∀ i j, i ≠ j → (E i ∩ E j).Finite) : + (edgeMeetingPoints V E).Finite := by + classical + let X : β → β → Set ℂ := fun i j => if i = j then ∅ else (E i ∩ E j) \ range V + have hX : (⋃ i, ⋃ j, X i j).Finite := by + refine finite_iUnion fun i => finite_iUnion fun j => ?_ + dsimp [X] + split_ifs with hij + · exact finite_empty + · exact (hfinite i j hij).sdiff + apply hX.subset + rintro x ⟨i, j, hij, hx, hxV⟩ + exact mem_iUnion.mpr ⟨i, mem_iUnion.mpr ⟨j, by simpa [X, hij] using And.intro hx hxV⟩⟩ + +/-- Two port edges meet in at most one point away from vertices. +This makes their crossing label unambiguous in XII (4.5), page 252. -/ +theorem pair_edge_meetings_subsingleton {m n : ℕ} + (V : Fin m → ℂ) (E : Fin n → Set ℂ) (s : Fin n × Bool → ℝ) + (hinj : Function.Injective (fun x => (ee (s x) : ℂ))) + (hinter : ∀ i j, i ≠ j → E i ∩ E j ⊆ + (segment ℝ (ee (s (i, false)) : ℂ) (ee (s (i, true)) : ℂ) ∩ + segment ℝ (ee (s (j, false)) : ℂ) (ee (s (j, true)) : ℂ)) ∪ range V) + {i j : Fin n} (hij : i ≠ j) : + ((E i ∩ E j) \ range V).Subsingleton := by + let a : Fin n × Bool → ℂ := fun x => (ee (s x) : ℂ) + have hab : a (i, false) ≠ a (i, true) := by + intro h + exact Bool.false_ne_true (congrArg Prod.snd (hinj h)) + have hne : line[ℝ, a (i, false), a (i, true)] ≠ line[ℝ, a (j, false), a (j, true)] := by + intro heq + have hjline : a (j, false) ∈ line[ℝ, a (i, false), a (i, true)] := by + rw [heq] + exact left_mem_affineSpan_pair _ _ _ + have hends := (unit_circle_mem_line_iff (by simp [a]) (by simp [a]) hab (by simp [a])).mp hjline + exact hends.elim (fun h => hij (congrArg Prod.fst (hinj h)).symm) + (fun h => hij (congrArg Prod.fst (hinj h)).symm) + have hsub : (E i ∩ E j) \ range V ⊆ + (line[ℝ, a (i, false), a (i, true)] : Set ℂ) ∩ + (line[ℝ, a (j, false), a (j, true)] : Set ℂ) := by + intro x hx + have hc := (hinter i j hij hx.1).resolve_right hx.2 + exact ⟨(line[ℝ, a (i, false), a (i, true)]).convex.segment_subset + (left_mem_affineSpan_pair _ _ _) (right_mem_affineSpan_pair _ _ _) hc.1, + (line[ℝ, a (j, false), a (j, true)]).convex.segment_subset + (left_mem_affineSpan_pair _ _ _) (right_mem_affineSpan_pair _ _ _) hc.2⟩ + intro x hx y hy + exact subsingleton_inter_of_ne_lines hne (hsub hx) (hsub hy) + +/-- A meeting away from vertices lies on exactly its two edge +arcs when triple meetings are confined to vertices. This is the +uniqueness of the crossing pair used in XII (4.5), page 252. -/ +theorem edge_eq_of_mem_pair_meeting {α β : Type*} + (V : α → ℂ) (E : β → Set ℂ) + (htriple : ∀ i j k, i ≠ j → j ≠ k → i ≠ k → E i ∩ E j ∩ E k ⊆ range V) + {i j k : β} (hij : i ≠ j) {x : ℂ} + (hx : x ∈ (E i ∩ E j) \ range V) (hxk : x ∈ E k) : k = i ∨ k = j := by + by_cases hki : k = i + · exact Or.inl hki + by_cases hkj : k = j + · exact Or.inr hkj + exact False.elim (hx.2 (htriple i j k hij (fun h => hkj h.symm) + (fun h => hki h.symm) ⟨hx.1, hxk⟩)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4CrossingVertexDiscs.lean b/LeanPool/GraphMinor/GM12/Section4CrossingVertexDiscs.lean new file mode 100644 index 0000000000..35be940eb2 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4CrossingVertexDiscs.lean @@ -0,0 +1,83 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.EdgeSides +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Vertex discs avoiding the other residual half-edges + +For XII (4.5), claim (1), page 253, choose small disjoint discs +at the source vertices before clipping the edge halves. Each +disc avoids the crossing-disc set and every half-edge whose +vertex owner is different. These are finitely many closed sets +missing its centre, so a small disc can be chosen in their +complement. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Topology + +/-- Small source vertex discs can avoid a prescribed closed set +and all half-edge arcs owned by other vertices. This is the +vertex-neighborhood choice for XII (4.5), claim (1), page 253. -/ +theorem exists_crossing_vertex_disc_family + {S V ι : Type*} [TopologicalSpace S] [T2Space S] [Finite V] [Finite ι] + (hS : IsClosedSurface S) (v : V → S) (hinj : Function.Injective v) + (owner : ι → V) (L : ι → Set S) (hL : ∀ i, IsClosed (L i)) + (hLV : ∀ i w, v w ∈ L i → w = owner i) + (Z : Set S) (hZ : IsClosed Z) (hvZ : ∀ w, v w ∉ Z) : + ∃ A : V → Set S, (∀ w, IsClosedDisc (A w) ∧ v w ∈ interior (A w)) ∧ + (∀ w z, w ≠ z → Disjoint (A w) (A z)) ∧ + (∀ w, Disjoint (A w) Z) ∧ + ∀ w i, w ≠ owner i → Disjoint (A w) (L i) := by + classical + let vertexFintype := Fintype.ofFinite V + let indexFintype := Fintype.ofFinite ι + obtain ⟨U, hU, hUU⟩ := (finite_range v).t2_separation + let C := fun w => Z ∪ ⋃ i, if w = owner i then ∅ else L i + have hC : ∀ w, IsClosed (C w) := by + intro w + apply hZ.union + apply isClosed_iUnion_of_finite + intro i + split_ifs <;> first | exact isClosed_empty | exact hL i + have hvC : ∀ w, v w ∉ C w := by + intro w hw + rcases hw with hz | hlines + · exact hvZ w hz + · obtain ⟨i, hi⟩ := mem_iUnion.mp hlines + by_cases hwi : w = owner i + · simp only [hwi, ↓reduceIte, mem_empty_iff_false] at hi + · have hvL : v w ∈ L i := by simpa only [hwi, ↓reduceIte] using hi + exact hwi (hLV i w hvL) + have hex : ∀ w, ∃ A : Set S, IsClosedDisc A ∧ v w ∈ interior A ∧ A ⊆ U (v w) ∩ (C w)ᶜ := by + intro w + obtain ⟨A, A', hd, ho, hp, hsub, hAU, -⟩ := GM11.exists_closedDisc_nbhd hS + ((hU (v w)).2.inter (hC w).isOpen_compl) ⟨(hU (v w)).1, hvC w⟩ + exact ⟨A, hd, mem_interior.mpr ⟨A', hsub, ho, hp⟩, hAU⟩ + choose A hA hvA hsub using hex + refine ⟨A, (fun w => ⟨hA w, hvA w⟩), ?_, ?_, ?_⟩ + · intro w z hwz + exact (hUU (mem_range_self w) (mem_range_self z) (fun h => hwz (hinj h))).mono + (fun x hx => (hsub w hx).1) (fun x hx => (hsub z hx).1) + · intro w + exact disjoint_left.mpr (fun x hx hz => (hsub w hx).2 (Or.inl hz)) + · intro w i hwi + apply disjoint_left.mpr + intro x hx hxi + apply (hsub w hx).2 + exact Or.inr (mem_iUnion.mpr ⟨i, by simpa only [hwi, ↓reduceIte] using hxi⟩) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4DiscCompression.lean b/LeanPool/GraphMinor/GM12/Section4DiscCompression.lean new file mode 100644 index 0000000000..23251b954c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4DiscCompression.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collar +import LeanPool.GraphMinor.GM12.Section4DiscEnlargement +import LeanPool.GraphMinor.GM12.Section4RadialResize +import LeanPool.GraphMinor.Surface.PushOff + +/-! +# Compressing a disc inside an assigned neighborhood + +For XII (4.3), claim (7), page 251, a source disc can be made small +before it is moved into its assigned target disc. Give the source a +collar avoiding the protected closed set. A radial change inside the +collar compresses the disc into any neighborhood of its center and +fixes the protected set pointwise. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Metric Topology + +/-- A disc disjoint from a closed protected set has a center about +which it can be compressed into any open neighborhood. -/ +theorem exists_disc_compression_center + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {D B : Set S} (hD : IsClosedDisc D) + (hB : IsClosed B) (hDB : Disjoint D B) : + ∃ p ∈ D, ∀ U : Set S, IsOpen U → p ∈ U → + ∃ e : S ≃ₜ S, e '' D ⊆ U ∧ e p = p ∧ ∀ x ∈ B, e x = x := by + obtain ⟨E, hE, hDE, hEB⟩ := exists_disc_enlargement_avoiding hS hD hB hDB + obtain ⟨pD⟩ := hD.isOArc_discBd + obtain ⟨c, c', hcc, hcc', hcm, hcm', hl, hr, hc1, hc2, _⟩ := + exists_disc_collar hD hE hDE pD + have hzero : (0 : ℂ) ∈ closedBall 0 1 := by simp + have hpD : c 0 ∈ D := hc1 ▸ mem_image_of_mem c hzero + refine ⟨c 0, hpD, ?_⟩ + intro U hU hpU + have hc0 : ContinuousAt c 0 := hcc.continuousAt (closedBall_mem_nhds _ (by norm_num)) + obtain ⟨ε, hε, hεU⟩ := Metric.mem_nhds_iff.mp (hc0.preimage_mem_nhds (hU.mem_nhds hpU)) + let w := min (ε / 2) (1 / 2 : ℝ) + have hw : 0 < w := lt_min (half_pos hε) (by norm_num) + have hwε : w < ε := (min_le_left _ _).trans_lt (by linarith) + have hwt : w < (3 / 2 : ℝ) := (min_le_right _ _).trans_lt (by norm_num) + obtain ⟨Θ, hΘfix, hΘnorm, hΘball⟩ := exists_radial_disc_resize + (show (0 : ℝ) < 1 by norm_num) (show (1 : ℝ) < 3 / 2 by norm_num) hw hwt + obtain ⟨e, hec, hefix⟩ := exists_homeomorph_of_collar + (fun x => (hS.2.2 x).isManifoldPoint) hE hcc hcc' hcm hcm' hl hr hc2 Θ hΘfix + refine ⟨e, ?_, ?_, ?_⟩ + · rintro _ ⟨x, hxD, rfl⟩ + obtain ⟨z, hz, rfl⟩ := hc1.symm ▸ hxD + rw [hec z (closedBall_subset_closedBall (by norm_num) hz)] + apply hεU + have hzw : Θ z ∈ closedBall 0 w := hΘball ▸ mem_image_of_mem Θ hz + rw [mem_ball_zero_iff] + exact (mem_closedBall_zero_iff.mp hzw).trans_lt hwε + · have hΘzero : Θ 0 = 0 := by + apply norm_eq_zero.mp + rw [hΘnorm, norm_zero, tentMap, tent_low (by norm_num) (by norm_num) le_rfl, + mul_zero, add_zero] + rw [hec 0 (by simp), hΘzero] + · intro x hx + exact hefix x (fun hxE => Set.disjoint_left.mp hEB hxE hx) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4DiscConnections.lean b/LeanPool/GraphMinor/GM12/Section4DiscConnections.lean new file mode 100644 index 0000000000..d3fcfd4bbf --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4DiscConnections.lean @@ -0,0 +1,99 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM12.Cited +public import LeanPool.GraphMinor.GM12.Section3Punctured +import LeanPool.GraphMinor.GM12.Section3Theorem +import LeanPool.GraphMinor.GM11.Regions +import Mathlib.Data.Fintype.EquivFin + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Applying the connection theorem to eye discs + +XII (4.5), page 253, applies (3.2) to the endpoint classes. +The classes can have any finite label type. Enumerate those +labels to apply (3.2), and then restore them. A disc lying in +a region closure can meet no other region, which supplies the +region-separation condition of that theorem. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM14 + +universe u + +/-- The application of XII (3.2) to discs inside prescribed +region closures, with arbitrary finite labels for the classes. -/ +theorem exists_threshold_for_disc_connections + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (t z : ℕ) : + ∃ η : ℕ, 1 ≤ η ∧ + ∀ {W : Type*} [Fintype W] (Γ : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (D r : Fin t → Set S) (Zs : W → Set S), + (∀ i, IsClosedDisc (D i) ∧ Γ.U ∩ D i = Γ.V ∩ discBd (D i)) → + Pairwise (fun i j => Disjoint (D i) (D j)) → + (discBoundaryVertices Γ D).ncard ≤ z → + (⋃ w, Zs w) = discBoundaryVertices Γ D → + Pairwise (fun v w => Disjoint (Zs v) (Zs w)) → + (∃ B : W → Set S, (∀ w, IsClosedDisc (B w)) ∧ + Pairwise (fun v w => Disjoint (B v) (B w)) ∧ + ∀ w, B w ∩ ⋃ i, D i = Zs w) → + η ≤ θ → HasTangleMetric Γ θ T d → + (∀ i, r i ∈ Γ.R ∧ D i ⊆ closure (r i)) → + (∀ i j, i ≠ j → η ≤ d (r i) (r j)) → + (∀ i, GM10.IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd (D i))) → + ∃ H : W → Drawing S, (∀ w, (H w).IsSubdrawing Γ) ∧ + (∀ w, IsConnectedDrawing (H w)) ∧ + Pairwise (fun v w => Disjoint (H v).V (H w).V) ∧ + ∀ w, (H w).V ∩ discBoundaryVertices Γ D = Zs w := by + obtain ⟨η, hη, hmain⟩ := theorem_3_2_proof hS t z + refine ⟨η, hη, ?_⟩ + intro W _ Γ θ T d D r Zs hD hDD hcount hcover hZZ hfeas hθ hm hr hfar hfree + classical + let : LocallyConnectedSpace S := GM11.IsClosedSurface.locallyConnectedSpace hS + let ν : Fin (Fintype.card W) ≃ W := (Fintype.equivFin W).symm + have hcover' : (⋃ i, Zs (ν i)) = discBoundaryVertices Γ D := by + rw [← hcover] + ext x + simp only [mem_iUnion] + exact ⟨fun ⟨i, hi⟩ => ⟨ν i, hi⟩, + fun ⟨w, hw⟩ => ⟨ν.symm w, by simpa only [ν.apply_symm_apply] using hw⟩⟩ + obtain ⟨B, hB, hBB, hBZ⟩ := hfeas + have hfeas' : IsTopologicallyFeasible D (fun i => Zs (ν i)) := + ⟨fun i => B (ν i), fun i => hB (ν i), + fun i j hij => hBB (fun h => hij (ν.injective h)), fun i => hBZ (ν i)⟩ + have hreg : ∀ i j, i ≠ j → ∀ ri ∈ Γ.R, (ri ∩ D i).Nonempty → + ∀ rj ∈ Γ.R, (rj ∩ D j).Nonempty → η ≤ d ri rj := by + intro i j hij ri hri hriD rj hrj hrjD + have heq : ∀ k (s : Set S), s ∈ Γ.R → (s ∩ D k).Nonempty → s = r k := by + intro k s hs hmeet + obtain ⟨x, hxs, hxD⟩ := hmeet + rcases GM11.closure_region_subset (hr k).1 ((hr k).2 hxD) with hxr | hxU + · exact GM11.region_eq_of_mem hs (hr k).1 hxs hxr + · exact False.elim (GM11.region_subset hs hxs hxU) + rw [heq i ri hri hriD, heq j rj hrj hrjD] + exact hfar i j hij + obtain ⟨H, hHs, hHc, hHH, hHZ⟩ := hmain D Γ θ T d (Fintype.card W) + (fun i => Zs (ν i)) hD hDD hcount hcover' + (fun i j hij => hZZ (fun h => hij (ν.injective h))) hfeas' hθ hm hreg hfree + refine ⟨fun w => H (ν.symm w), fun w => hHs _, fun w => hHc _, + fun v w hvw => hHH _ _ (fun h => hvw (ν.symm.injective h)), ?_⟩ + intro w + simpa only [ν.apply_symm_apply] using hHZ (ν.symm w) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4DiscEnlargement.lean b/LeanPool/GraphMinor/GM12/Section4DiscEnlargement.lean new file mode 100644 index 0000000000..ae58a3e671 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4DiscEnlargement.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collar + +/-! +# Enlarging disjoint discs away from a closed set + +For XII (4.3), claim (7), page 251, motions must avoid discs +already placed. Enlarge a finite disjoint family slightly, keeping +it disjoint and avoiding any prescribed closed set. At each step, +first enlarge the other discs while forbidding the current one. +Then enlarge the current disc while forbidding those enlargements. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Enlarge one disc away from a disjoint closed set. -/ +theorem exists_disc_enlargement_avoiding + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {D B : Set S} (hD : IsClosedDisc D) + (hB : IsClosed B) (hDB : Disjoint D B) : + ∃ E, IsClosedDisc E ∧ D ⊆ E \ discBd E ∧ Disjoint E B := by + obtain ⟨E, hE, hDE, hED⟩ := exists_disc_around + (fun x => (hS.2.2 x).isManifoldPoint) hD + (fun x _ => hS.2.2 x) hB.isOpen_compl + (fun x hx => Set.disjoint_left.mp hDB (discBd_subset D hx)) + refine ⟨E, hE, hDE, Set.disjoint_left.mpr ?_⟩ + intro x hxE hxB + rcases hED hxE with hxD | hxnot + · exact Set.disjoint_left.mp hDB hxD hxB + · exact hxnot hxB + +/-- Simultaneously enlarge a finite disjoint family while keeping +it disjoint and avoiding an arbitrary disjoint closed set. -/ +theorem exists_disjoint_disc_enlargements + {S ι : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {F : Set ι} (hF : F.Finite) (D : ι → Set S) + (hD : ∀ i ∈ F, IsClosedDisc (D i)) + (hDD : ∀ i ∈ F, ∀ j ∈ F, i ≠ j → Disjoint (D i) (D j)) : + ∀ B : Set S, IsClosed B → (∀ i ∈ F, Disjoint (D i) B) → + ∃ E : ι → Set S, + (∀ i ∈ F, IsClosedDisc (E i) ∧ D i ⊆ E i \ discBd (E i) ∧ Disjoint (E i) B) ∧ + ∀ i ∈ F, ∀ j ∈ F, i ≠ j → Disjoint (E i) (E j) := by + classical + revert hD hDD + induction F, hF using Set.Finite.induction_on with + | empty => + intro _ _ B _ _ + exact ⟨fun _ => ∅, by simp, by simp⟩ + | @insert i F hi hF ih => + intro hD hDD B hB hDB + have hD' := fun j hj => hD j (Or.inr hj) + have hDD' := fun j hj k hk hjk => hDD j (Or.inr hj) k (Or.inr hk) hjk + have hDB' : ∀ j ∈ F, Disjoint (D j) (B ∪ D i) := by + intro j hj + exact (hDB j (Or.inr hj)).union_right + (hDD j (Or.inr hj) i (Or.inl rfl) (fun h => hi (h ▸ hj))) + obtain ⟨E, hE, hEE⟩ := ih hD' hDD' (B ∪ D i) + (hB.union (hD i (Or.inl rfl)).isClosed) hDB' + let Z := B ∪ ⋃ j ∈ F, E j + have hZ : IsClosed Z := hB.union (hF.isClosed_biUnion fun j hj => (hE j hj).1.isClosed) + have hDiZ : Disjoint (D i) Z := by + apply Set.disjoint_left.mpr + intro x hxD hxZ + rcases hxZ with hxB | hxE + · exact Set.disjoint_left.mp (hDB i (Or.inl rfl)) hxD hxB + · obtain ⟨j, hj, hxEj⟩ := mem_iUnion₂.mp hxE + exact Set.disjoint_left.mp (hE j hj).2.2 hxEj (Or.inr hxD) + obtain ⟨Q, hQ, hDQ, hQZ⟩ := exists_disc_enlargement_avoiding hS + (hD i (Or.inl rfl)) hZ hDiZ + have hQB : Disjoint Q B := hQZ.mono_right subset_union_left + have hQE : ∀ j ∈ F, Disjoint Q (E j) := by + intro j hj + exact hQZ.mono_right (fun x hx => Or.inr (mem_iUnion₂.mpr ⟨j, hj, hx⟩)) + let E' := fun j => if j = i then Q else E j + refine ⟨E', ?_, ?_⟩ + · intro j hj + rcases hj with hji | hj + · subst j + simpa only [E', ↓reduceIte] using And.intro hQ (And.intro hDQ hQB) + · have hji : j ≠ i := fun h => hi (h ▸ hj) + have hjB : Disjoint (E j) B := (hE j hj).2.2.mono_right subset_union_left + simpa only [E', hji, ↓reduceIte] using + And.intro (hE j hj).1 (And.intro (hE j hj).2.1 hjB) + · intro j hj k hk hjk + by_cases hji : j = i + · subst j + have hki := Ne.symm hjk + simpa only [E', ↓reduceIte, hki] using hQE k (hk.resolve_left hki) + · by_cases hki : k = i + · subst k + simpa only [E', ↓reduceIte, hji] using (hQE j (hj.resolve_left hji)).symm + · simpa only [E', hji, hki, ↓reduceIte] using + hEE j (hj.resolve_left hji) k (hk.resolve_left hki) hjk + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4DiscFamilyMatch.lean b/LeanPool/GraphMinor/GM12/Section4DiscFamilyMatch.lean new file mode 100644 index 0000000000..2bcaed9638 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4DiscFamilyMatch.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collar +import LeanPool.GraphMinor.GM12.Section4MarkedDiscMatch +import LeanPool.GraphMinor.Surface.Wedge + +/-! +# Matching finite families of discs with two boundary marks + +XII (4.3), claim (7), page 251, uses one ambient homeomorphism +for all residual edges. Match the discs successively. After each +step the images of all unmatched source discs remain disjoint from +the discs already placed. The one-disc motion fixes those placed +discs pointwise, preserving their ordered boundary marks. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Match finite disjoint disc families and their ordered pairs of +distinct boundary points, as needed in XII (4.3), claim (7). -/ +theorem exists_disc_family_match + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (A B : ι → Set S) + (hA : ∀ i, IsClosedDisc (A i)) (hB : ∀ i, IsClosedDisc (B i)) + (hAA : Pairwise (fun i j => Disjoint (A i) (A j))) + (hBB : Pairwise (fun i j => Disjoint (B i) (B j))) + (a b a' b' : ι → S) + (ha : ∀ i, a i ∈ discBd (A i)) (hb : ∀ i, b i ∈ discBd (A i)) + (hab : ∀ i, a i ≠ b i) + (ha' : ∀ i, a' i ∈ discBd (B i)) (hb' : ∀ i, b' i ∈ discBd (B i)) + (hab' : ∀ i, a' i ≠ b' i) : + ∃ e : S ≃ₜ S, ∀ i, e '' A i = B i ∧ e (a i) = a' i ∧ e (b i) = b' i := by + classical + have hex : ∀ F : Set ι, F.Finite → + ∃ e : S ≃ₜ S, ∀ i ∈ F, e '' A i = B i ∧ e (a i) = a' i ∧ e (b i) = b' i := by + intro F hF + induction F, hF using Set.Finite.induction_on with + | empty => exact ⟨Homeomorph.refl S, by simp⟩ + | @insert i F hi hF ih => + obtain ⟨e, he⟩ := ih + have hnonempty : Nonempty S := ⟨a i⟩ + have himage := isClosedDisc_image_injOn (hA i) (hA i).isCompact + e.continuous.continuousOn e.injective.injOn + let D : F → Set S := fun j => B j.val + have hD : ∀ j, IsClosedDisc (D j) := fun j => hB j.val + have hDD : Pairwise (fun j k => Disjoint (D j) (D k)) := by + intro j k hjk + exact hBB (fun h => hjk (Subtype.ext h)) + have hAD : Disjoint (e '' A i) (⋃ j : F, D j) := by + apply Set.disjoint_left.mpr + rintro z ⟨x, hx, rfl⟩ hzD + obtain ⟨j, hj⟩ := mem_iUnion.mp hzD + have hjB : e x ∈ B j.val := hj + obtain ⟨y, hy, hye⟩ := (he j.val j.property).1.symm ▸ hjB + have hxy : y = x := e.injective hye + exact Set.disjoint_left.mp (hAA (show i ≠ j.val from fun hij => hi (hij ▸ j.property))) hx + (hxy ▸ hy) + have hBD : Disjoint (B i) (⋃ j : F, D j) := by + apply Set.disjoint_left.mpr + intro z hzB hzD + obtain ⟨j, hj⟩ := mem_iUnion.mp hzD + exact Set.disjoint_left.mp (hBB (show i ≠ j.val from fun hij => hi + (hij ▸ j.property))) hzB hj + have hea : e (a i) ∈ discBd (e '' A i) := himage.2 ▸ mem_image_of_mem e (ha i) + have heb : e (b i) ∈ discBd (e '' A i) := himage.2 ▸ mem_image_of_mem e (hb i) + obtain ⟨k, hkA, hka, hkb, hkfix⟩ := exists_marked_disc_match_fixing_discs + hS D hD hDD himage.1 (hB i) hAD hBD hea heb + (fun h => hab i (e.injective h)) (ha' i) (hb' i) (hab' i) + refine ⟨e.trans k, ?_⟩ + intro j hj + rcases hj with hji | hj + · subst j + refine ⟨?_, hka, hkb⟩ + change (fun x => k (e x)) '' A i = B i + simpa only [image_image] using hkA + · have hBj : k '' B j = B j := by + apply Set.Subset.antisymm + · rintro _ ⟨z, hz, rfl⟩ + rw [hkfix ⟨j, hj⟩ z hz] + exact hz + · intro z hz + exact ⟨z, hz, hkfix ⟨j, hj⟩ z hz⟩ + refine ⟨?_, ?_, ?_⟩ + · change (fun x => k (e x)) '' A j = B j + have h := congrArg (fun C => k '' C) (he j hj).1 + simpa only [image_image, hBj] using h + · change k (e (a j)) = a' j + rw [(he j hj).2.1] + exact hkfix ⟨j, hj⟩ _ (discBd_subset _ (ha' j)) + · change k (e (b j)) = b' j + rw [(he j hj).2.2] + exact hkfix ⟨j, hj⟩ _ (discBd_subset _ (hb' j)) + obtain ⟨e, he⟩ := hex univ (Set.toFinite _) + exact ⟨e, fun i => he i (mem_univ i)⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4DiscMatch.lean b/LeanPool/GraphMinor/GM12/Section4DiscMatch.lean new file mode 100644 index 0000000000..ef57d7f937 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4DiscMatch.lean @@ -0,0 +1,27 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscMatch +public import LeanPool.GraphMinor.GM12.Section4DiscTwist +public import LeanPool.GraphMinor.GM12.Section4JoinedCollars + +/-! +# Matching nested discs and adjusting boundary points + +Homeomorphisms that carry nested discs and adjust their boundaries, used in XII (4.3), claim (7). +-/ + +public section + +namespace GraphMinor.GM12 + +export Surface (exists_disc_onto_nested exists_boundary_twist) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4DiscTangency.lean b/LeanPool/GraphMinor/GM12/Section4DiscTangency.lean new file mode 100644 index 0000000000..e4a0d17335 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4DiscTangency.lean @@ -0,0 +1,130 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collar +import LeanPool.GraphMinor.GM12.Section4NormalArcDisc +import LeanPool.GraphMinor.Surface.Wedge + +/-! +# A disc touching one boundary point + +For the singleton prescriptions in XII (4.4), page 251, a source +contact disc can be attached to a connecting disc at one boundary +point. Follow an outward radius of a collar for a short distance, +avoiding a closed forbidden set. Thicken this arc while forbidding +the original disc. Only its initial endpoint remains in that disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Metric Topology + +/-- Attach a disc at one boundary point, avoiding a closed set that +does not contain that point, and retain a second boundary mark. -/ +theorem exists_disc_touching_boundary_point + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {D Z : Set S} (hD : IsClosedDisc D) + (hZ : IsClosed Z) {p : S} (hp : p ∈ discBd D) (hpZ : p ∉ Z) : + ∃ (Q : Set S) (q : S), IsClosedDisc Q ∧ Q ∩ D = {p} ∧ + Disjoint Q Z ∧ p ≠ q ∧ ({p, q} : Set S) ⊆ discBd Q := by + obtain ⟨E, hE, hDE, _⟩ := exists_disc_around (fun x => (hS.2.2 x).isManifoldPoint) + hD (fun x _ => hS.2.2 x) isOpen_univ (subset_univ _) + obtain ⟨P⟩ := hD.isOArc_discBd + obtain ⟨c, c', hcc, _, _, _, hl, _, hcD, _, hcP⟩ := exists_disc_collar hD hE hDE P + let w : Circle := P.symm ⟨p, hp⟩ + have hwP : c w = p := (hcP w).trans (congrArg Subtype.val (P.apply_symm_apply ⟨p, hp⟩)) + have hwint : (w : ℂ) ∈ interior (closedBall (0 : ℂ) 2) := + mem_interior.mpr ⟨ball 0 2, ball_subset_closedBall, isOpen_ball, + by rw [mem_ball_zero_iff, Circle.norm_coe]; norm_num⟩ + have hcAt := hcc.continuousAt (mem_interior_iff_mem_nhds.mp hwint) + have hwavoid : c w ∈ Zᶜ := by rw [hwP]; exact hpZ + obtain ⟨ε, hε, hεsub⟩ := Metric.mem_nhds_iff.mp + (hcAt.preimage_mem_nhds (hZ.isOpen_compl.mem_nhds hwavoid)) + let δ : ℝ := min (ε / 2) (1 / 2) + have hδ : 0 < δ := lt_min (half_pos hε) (by norm_num) + have hδε : δ < ε := (min_le_left _ _).trans_lt (by linarith) + let z : unitInterval → ℂ := fun t => (1 + δ * t.val : ℝ) • (w : ℂ) + have hzN : ∀ t, ‖z t‖ = 1 + δ * t.val := by + intro t + dsimp only [z] + have hnonneg : 0 ≤ 1 + δ * t.val := by + have hmul := mul_nonneg hδ.le t.property.1 + linarith + rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg hnonneg, Circle.norm_coe, mul_one] + have hz2 : ∀ t, z t ∈ closedBall 0 2 := by + intro t + rw [mem_closedBall_zero_iff, hzN] + have hmul := mul_le_mul_of_nonneg_left t.property.2 hδ.le + have hδhi := min_le_right (ε / 2) (1 / 2 : ℝ) + change δ ≤ 1 / 2 at hδhi + linarith + have hzε : ∀ t, z t ∈ ball (w : ℂ) ε := by + intro t + rw [mem_ball, dist_eq_norm] + have heq : z t - w = (δ * t.val : ℝ) • (w : ℂ) := by + dsimp only [z] + rw [add_smul, one_smul, add_sub_cancel_left] + rw [heq, norm_smul, Real.norm_eq_abs, abs_of_nonneg (mul_nonneg hδ.le t.property.1), + Circle.norm_coe, mul_one] + exact (mul_le_mul_of_nonneg_left t.property.2 hδ.le).trans_lt (by simpa using hδε) + let a : unitInterval → S := fun t => c (z t) + have hac : Continuous a := hcc.comp_continuous (by dsimp only [z]; fun_prop) hz2 + have hai : Function.Injective a := by + intro s t heq + have hst := congrArg norm (hl.injOn (hz2 s) (hz2 t) heq) + rw [hzN, hzN] at hst + apply Subtype.ext + exact mul_left_cancel₀ hδ.ne' (add_left_cancel hst) + have ha0 : a 0 = p := by + change c ((1 + δ * 0 : ℝ) • (w : ℂ)) = p + simpa only [mul_zero, add_zero, one_smul] using hwP + have haZ : ∀ t, a t ∉ Z := fun t => hεsub (hzε t) + have haD : ∀ t, a t ∈ D → t = 0 := by + intro t ht + obtain ⟨v, hv, hve⟩ := hcD.symm ▸ ht + have hvz := hl.injOn (closedBall_subset_closedBall (by norm_num) hv) (hz2 t) hve + have hle : ‖z t‖ ≤ 1 := hvz ▸ mem_closedBall_zero_iff.mp hv + rw [hzN] at hle + have ht0 : t.val = 0 := le_antisymm (by nlinarith) t.property.1 + exact Subtype.ext ht0 + have ha1D : a 1 ∉ D := fun ht => zero_ne_one (haD 1 ht).symm + let B := D ∪ Z ∪ {a 1} + have hB : IsClosed B := (hD.isClosed.union hZ).union isClosed_singleton + have hmeet : range a ∩ B ⊆ {a 0, a 1} := by + rintro _ ⟨⟨t, rfl⟩, ht⟩ + rcases ht with (htD | htZ) | ht1 + · rw [haD t htD] + exact Or.inl rfl + · exact (haZ t htZ).elim + · exact Or.inr ht1 + obtain ⟨Q, hQ, hQB, hbd, _⟩ := exists_normal_arc_disc hS ⟨hac, hai⟩ hB + (Or.inl (Or.inl (ha0.symm ▸ discBd_subset D hp))) (Or.inr (by simp)) hmeet + refine ⟨Q, a 1, hQ, ?_, ?_, ?_, ?_⟩ + · apply Set.Subset.antisymm + · intro x hx + have hends := hQB.subset ⟨hx.1, Or.inl (Or.inl hx.2)⟩ + rcases hends with hx0 | hx1 + · exact Set.mem_singleton_iff.mpr (hx0.trans ha0) + · exact False.elim (ha1D ((Set.mem_singleton_iff.mp hx1) ▸ hx.2)) + · rintro x rfl + exact ⟨discBd_subset Q (ha0 ▸ hbd (Or.inl rfl)), discBd_subset D hp⟩ + · apply Set.disjoint_left.mpr + intro x hxQ hxZ + have hends := hQB.subset ⟨hxQ, Or.inl (Or.inr hxZ)⟩ + rcases hends with hx0 | hx1 + · exact haZ 0 (hx0 ▸ hxZ) + · exact haZ 1 ((Set.mem_singleton_iff.mp hx1) ▸ hxZ) + · intro hpq + exact zero_ne_one (hai (ha0.trans hpq)) + · rwa [ha0] at hbd + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4DiscTwist.lean b/LeanPool/GraphMinor/GM12/Section4DiscTwist.lean new file mode 100644 index 0000000000..2a3316e7b6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4DiscTwist.lean @@ -0,0 +1,28 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscTwist + +/-! +# Twisting a disc + +The radius-preserving twist used to match two marked boundary points in XII (4.3), claim (7). +-/ + +public section + +namespace GraphMinor.GM12 + +export Surface (unitOf coe_unitOf norm_mul_unitOf unitOf_mul twistParam continuous_twistParam + twistParam_low twistParam_high twistMap norm_twistMap continuous_unitOf continuous_twistMap + exists_twist PreservesCircleOrientation.comp preservesCircleOrientation_mul + exists_circle_pair_move) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4DisjointArcDiscs.lean b/LeanPool/GraphMinor/GM12/Section4DisjointArcDiscs.lean new file mode 100644 index 0000000000..306354016a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4DisjointArcDiscs.lean @@ -0,0 +1,132 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.GM12.Section4NormalArcDisc +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Disjoint discs around disjoint residual arcs + +In XII (4.3), claim (7), page 251, the residual edges form +disjoint arcs whose ends lie on the vertex discs. Thicken these +arcs into mutually disjoint closed discs, meeting the vertex discs +only at the prescribed ends. In the finite induction, forbid the +next arc while constructing the earlier discs, then forbid those +discs while constructing the next one. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Disjoint residual arcs have disjoint thin discs with the same +contacts with a forbidden closed set. This supplies the source edge +discs for XII (4.3), claim (7), page 251. -/ +theorem exists_disjoint_arc_discs + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {F : Set ι} (hF : F.Finite) (a : ι → unitInterval → S) + (hArc : ∀ i ∈ F, IsArcMap (a i)) + (hdisj : ∀ i ∈ F, ∀ j ∈ F, i ≠ j → Disjoint (range (a i)) (range (a j))) : + ∀ B : Set S, IsClosed B → (∀ i ∈ F, range (a i) ∩ B = {a i 0, a i 1}) → + ∃ D : ι → Set S, + (∀ i ∈ F, IsClosedDisc (D i) ∧ D i ∩ B = {a i 0, a i 1} ∧ + ({a i 0, a i 1} : Set S) ⊆ discBd (D i) ∧ range (a i) ⊆ D i) ∧ + ∀ i ∈ F, ∀ j ∈ F, i ≠ j → Disjoint (D i) (D j) := by + classical + revert hArc hdisj + induction F, hF using Set.Finite.induction_on with + | empty => + intro _ _ B _ _ + exact ⟨fun _ => ∅, by simp, by simp⟩ + | @insert i F hi hF ih => + intro hArc hdisj B hB hcontact + have hArcF := fun j hj => hArc j (Or.inr hj) + have hdisjF := fun j hj k hk hjk => hdisj j (Or.inr hj) k (Or.inr hk) hjk + have hAi : IsClosed (range (a i)) := (isCompact_range (hArc i (Or.inl rfl)).1).isClosed + let B' : Set S := B ∪ range (a i) + have hcontact' : ∀ j ∈ F, range (a j) ∩ B' = {a j 0, a j 1} := by + intro j hj + have hji : j ≠ i := fun h => hi (h ▸ hj) + have hjiDisj := hdisj j (Or.inr hj) i (Or.inl rfl) hji + change range (a j) ∩ (B ∪ range (a i)) = _ + rw [inter_union_distrib_left, hcontact j (Or.inr hj), hjiDisj.inter_eq, union_empty] + obtain ⟨D, hD, hDD⟩ := ih hArcF hdisjF B' (hB.union hAi) hcontact' + have hendsB : ∀ j ∈ insert i F, ({a j 0, a j 1} : Set S) ⊆ B := by + intro j hj z hz + exact ((hcontact j hj).symm.subset hz).2 + have hendsArc : ∀ j, ({a j 0, a j 1} : Set S) ⊆ range (a j) := by + intro j z hz + rcases hz with hz | hz + · exact hz ▸ mem_range_self 0 + · exact (Set.mem_singleton_iff.mp hz) ▸ mem_range_self 1 + have hOldArc : ∀ j ∈ F, Disjoint (D j) (range (a i)) := by + intro j hj + apply Set.disjoint_left.mpr + intro z hzD hzA + have hzends := (hD j hj).2.1.subset ⟨hzD, Or.inr hzA⟩ + have hji : j ≠ i := fun h => hi (h ▸ hj) + exact Set.disjoint_left.mp (hdisj j (Or.inr hj) i (Or.inl rfl) hji) + (hendsArc j hzends) hzA + let Z : Set S := B ∪ ⋃ j ∈ F, D j + have hZ : IsClosed Z := hB.union (hF.isClosed_biUnion fun j hj => (hD j hj).1.isClosed) + have hmeet : range (a i) ∩ Z ⊆ {a i 0, a i 1} := by + rintro z ⟨hzA, hzZ⟩ + rcases hzZ with hzB | hzD + · exact (hcontact i (Or.inl rfl)).subset ⟨hzA, hzB⟩ + · obtain ⟨j, hj, hzDj⟩ := mem_iUnion₂.mp hzD + exact False.elim (Set.disjoint_left.mp (hOldArc j hj) hzDj hzA) + obtain ⟨Q, hQ, hQZ, hQbd, haQ⟩ := exists_normal_arc_disc hS (hArc i (Or.inl rfl)) hZ + (Or.inl (hendsB i (Or.inl rfl) (by simp))) + (Or.inl (hendsB i (Or.inl rfl) (by simp))) hmeet + have hQB : Q ∩ B = {a i 0, a i 1} := by + apply Set.Subset.antisymm + · exact fun z hz => hQZ.subset ⟨hz.1, Or.inl hz.2⟩ + · intro z hz + exact ⟨discBd_subset Q (hQbd hz), hendsB i (Or.inl rfl) hz⟩ + have hQD : ∀ j ∈ F, Disjoint Q (D j) := by + intro j hj + apply Set.disjoint_left.mpr + intro z hzQ hzD + have hzends := hQZ.subset ⟨hzQ, Or.inr (mem_iUnion₂.mpr ⟨j, hj, hzD⟩)⟩ + exact Set.disjoint_left.mp (hOldArc j hj) hzD (hendsArc i hzends) + have hDB : ∀ j ∈ F, D j ∩ B = {a j 0, a j 1} := by + intro j hj + apply Set.Subset.antisymm + · exact fun z hz => (hD j hj).2.1.subset ⟨hz.1, Or.inl hz.2⟩ + · intro z hz + exact ⟨discBd_subset (D j) ((hD j hj).2.2.1 hz), hendsB j (Or.inr hj) hz⟩ + let D' : ι → Set S := fun j => if j = i then Q else D j + refine ⟨D', ?_, ?_⟩ + · intro j hj + rcases hj with hji | hj + · subst j + simpa only [D', ↓reduceIte] using + (show IsClosedDisc Q ∧ Q ∩ B = {a i 0, a i 1} ∧ + ({a i 0, a i 1} : Set S) ⊆ discBd Q ∧ range (a i) ⊆ Q from ⟨hQ, hQB, hQbd, haQ⟩) + · have hji : j ≠ i := fun h => hi (h ▸ hj) + simpa only [D', hji, ↓reduceIte] using + (show IsClosedDisc (D j) ∧ D j ∩ B = {a j 0, a j 1} ∧ + ({a j 0, a j 1} : Set S) ⊆ discBd (D j) ∧ range (a j) ⊆ D j from + ⟨(hD j hj).1, hDB j hj, (hD j hj).2.2⟩) + · intro j hj k hk hjk + by_cases hji : j = i + · subst j + have hki : k ≠ i := Ne.symm hjk + simpa only [D', ↓reduceIte, hki] using hQD k (hk.resolve_left hki) + · have hjF : j ∈ F := hj.resolve_left hji + by_cases hki : k = i + · subst k + simpa only [D', ↓reduceIte, hji] using (hQD j hjF).symm + · simpa only [D', hji, hki, ↓reduceIte] using hDD j hjF k (hk.resolve_left hki) hjk + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4DisjointDiscs.lean b/LeanPool/GraphMinor/GM12/Section4DisjointDiscs.lean new file mode 100644 index 0000000000..5f18a74afc --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4DisjointDiscs.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collar +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.Surface.Triangulate +import Mathlib.Data.Fintype.EquivFin +import LeanPool.GraphMinor.Surface.Circle + +/-! +# Finite disjoint disc families in a closed surface + +The singleton feasibility argument in XII (4.4), page 251, starts +with one connecting disc for each partition class. Choose finitely +many distinct points on a disc boundary, separate them by disjoint +open neighborhoods, and put a smaller closed disc in each one. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A topological circle has infinitely many points, in any universe. -/ +theorem infinite_oArc {X : Type*} [TopologicalSpace X] {F : Set X} + (hF : IsOArc F) : F.Infinite := + hF.infinite + +/-- A nonempty closed surface contains any prescribed finite number +of pairwise disjoint closed discs. -/ +theorem exists_finite_disjoint_closed_discs + {S : Type*} [TopologicalSpace S] [T2Space S] [Nonempty S] + (hS : IsClosedSurface S) (p : ℕ) : + ∃ D : Fin p → Set S, (∀ i, IsClosedDisc (D i)) ∧ + ∀ i j, i ≠ j → Disjoint (D i) (D j) := by + classical + let x : S := Classical.choice inferInstance + obtain ⟨C, _, hC, _, _, _, _⟩ := exists_closedDisc_nbhd hS isOpen_univ (mem_univ x) + have : Infinite (discBd C) := (infinite_oArc hC.isOArc_discBd).to_subtype + let n : ℕ ↪ discBd C := Infinite.natEmbedding _ + let ν : Fin p → S := fun i => (n i.val).val + have hν : Function.Injective ν := by + intro i j hij + apply Fin.ext + exact n.injective (Subtype.ext hij) + obtain ⟨U, hU, hUdisj⟩ := (Set.finite_range ν).t2_separation + have hex : ∀ i : Fin p, ∃ D, IsClosedDisc D ∧ D ⊆ U (ν i) := by + intro i + obtain ⟨D, _, hD, _, _, _, hDU, _⟩ := exists_closedDisc_nbhd hS (hU (ν i)).2 (hU (ν i)).1 + exact ⟨D, hD, hDU⟩ + choose D hD hDU using hex + refine ⟨D, hD, ?_⟩ + intro i j hij + exact (hUdisj (mem_range_self i) (mem_range_self j) (fun h => hij (hν h))).mono (hDU i) (hDU j) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4Distance.lean b/LeanPool/GraphMinor/GM12/Section4Distance.lean new file mode 100644 index 0000000000..ef59f17593 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4Distance.lean @@ -0,0 +1,133 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section1 +import LeanPool.GraphMinor.GM12.Section4Cover +import LeanPool.GraphMinor.GM12.Section4ShortestChain +import LeanPool.GraphMinor.GM12.Section4Counting +import LeanPool.GraphMinor.GM12.Section4WalkMetric +import LeanPool.GraphMinor.GM12.Section4CircuitWalk +import LeanPool.GraphMinor.GM12.Section4CircuitMeet +import LeanPool.GraphMinor.GM11.Section6 +import Mathlib.Algebra.Order.BigOperators.Group.Finset + +/-! +# The circuit-chain distance calculation + +This file proves the calculation in XII (4.1), page 248. Retain maximal +insides in the finite circuit cover, then choose a shortest intersection +chain. Nonconsecutive insides are disjoint, so each separator vertex is +counted at most twice. Traverse the circuit boundaries to witness the +metric bound. This spells out the sum-of-costs inequality without needing +a separate transfer of XI's restraint metric to the radial-walk metric. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM10 GM11 GM14 Hypergraph + +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- The circuit-cover calculation in XII (4.1), page 248. The connected +set joins the two endpoints, and every circuit has its original vertices +in the same finite separator. -/ +theorem distance_le_twice_separator_of_circuit_cover + [ConnectedSpace S] {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} + (hT : IsPretangle Γ.toHypergraph θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + {ι : Type*} [Finite ι] (C : ι → Drawing S) + (hC : ∀ i, (C i).IsCircuit) (hCs : ∀ i, (C i).IsSubdrawing K) + (hCl : ∀ i, (C i).length < 2 * θ) + {Z : Set S} (hZ : Z.Finite) (hCZ : ∀ i, (C i).V ∩ Γ.V ⊆ Z) + {P : Set S} (hP : IsPreconnected P) (hcover : P ⊆ ⋃ i, ins (C i)) + {u v : S} (hu : u ∈ P) (hv : v ∈ P) (huΓ : u ∈ Γ.V) (hvΓ : v ∈ Γ.V) : + tangleMetric Γ K ins θ {u} {v} ≤ 2 * Z.ncard := by + classical + by_cases hlarge : θ ≤ 2 * Z.ncard + · exact (tangleMetric_le_order hK ins θ {u} {v}).trans hlarge + let I := {i : ι // ∀ j, ins (C i) ⊆ ins (C j) → ins (C j) ⊆ ins (C i)} + let M : I → Set S := fun i => ins (C i.val) + have hcoverM : P ⊆ ⋃ i, M i := by + intro x hx + obtain ⟨i, hi⟩ := mem_iUnion.mp (hcover hx) + obtain ⟨j, hij, hj⟩ := exists_maximal_cover_member (fun i => ins (C i)) i + exact mem_iUnion.mpr ⟨⟨j, hj⟩, hij hi⟩ + have hclosed : ∀ i : I, IsClosed (M i) := fun i => + (hd _ (hC i.val) (hCs i.val) (hCl i.val)).1.isClosed + obtain ⟨a, ha⟩ := mem_iUnion.mp (hcoverM hu) + obtain ⟨b, hb⟩ := mem_iUnion.mp (hcoverM hv) + have hreach := intersection_chain_of_finite_closed_cover M hclosed hP hcoverM + ⟨u, hu, ha⟩ ⟨v, hv, hb⟩ + obtain ⟨n, f, hf0, hflast, hmeet, hdisj⟩ := exists_irredundant_intersection_chain M hreach + let D : Fin (n + 1) → Drawing S := fun i => C (f i).val + have hDV : ∀ i : Fin n, ((D i.castSucc).V ∩ (D i.succ).V).Nonempty := by + intro i + exact common_vertex_of_maximal_insides hT hK hd + (hC _) (hCs _) (hCl _) (hC _) (hCs _) (hCl _) + ((f i.castSucc).property (f i.succ).val) ((f i.succ).property (f i.castSucc).val) (hmeet i) + have hsum : ∑ i, ((D i).V ∩ Γ.V).ncard ≤ 2 * Z.ncard := by + let F : Fin (n + 1) → Finset S := fun i => + ((D i).finite_V.subset (Set.inter_subset_left (t := Γ.V))).toFinset + have hsub : ∀ i, F i ⊆ hZ.toFinset := by + intro i x hx + exact hZ.mem_toFinset.mpr (hCZ _ (((D i).finite_V.subset (Set.inter_subset_left (t + := Γ.V))).mem_toFinset.mp hx)) + have hfd : ∀ i j : Fin (n + 1), i.val + 1 < j.val → Disjoint (F i) (F j) := by + intro i j hij + apply Finset.disjoint_left.mpr + intro x hxi hxj + have hi := ((D i).finite_V.subset (Set.inter_subset_left (t := Γ.V))).mem_toFinset.mp hxi + have hj := ((D j).finite_V.subset (Set.inter_subset_left (t := Γ.V))).mem_toFinset.mp hxj + have hin : ∀ k : Fin (n + 1), (D k).V ⊆ ins (D k) := by + intro k y hy + have hdisc := hd _ (hC _) (hCs _) (hCl (f k).val) + have hbd : subBd (ins (D k)) ⊆ ins (D k) := + GM11.subBd_subset_of_isClosed hdisc.1.isClosed + rw [hdisc.2.1] at hbd + exact hbd ((D k).V_subset_U hy) + exact Set.disjoint_left.mp (hdisj i j hij) (hin i hi.1) (hin j hj.1) + have hcount := chain_sum_card_le_twice_separator hZ.toFinset F hsub hfd + simpa only [F, ← Set.ncard_eq_toFinset_card] using hcount + obtain ⟨w, W, hWlen, hDC⟩ := closed_walk_covering_circuit_chain D + (fun i => hC (f i).val) (fun i => hCs (f i).val) hDV + have hlen : W.length = 2 * ∑ i, ((D i).V ∩ Γ.V).ncard := by + rw [hWlen, Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + exact (circuit_length_eq_two_mul_ncard hK.2.1 (hC _) (hCs _)).1 + have hshort : W.length < 2 * θ := by omega + have hcontains : ∀ i, ins (D i) ⊆ insWalk ins K W := by + intro i x hx + exact Or.inr (mem_iUnion₂.mpr ⟨D i, ⟨hC _, hDC i⟩, hx⟩) + have huD : u ∈ ins (D 0) := by + change u ∈ M (f 0) + rw [hf0] + exact ha + have hvD : v ∈ ins (D (Fin.last n)) := by + change v ∈ M (f (Fin.last n)) + rw [hflast] + exact hb + have huc : IsCorrespondingAtom Γ K {u} {u} := + ⟨Or.inl (Or.inl ⟨u, huΓ, rfl⟩), Or.inl (Or.inl ⟨u, hK.2.1.2.1 huΓ, rfl⟩), + Or.inl ⟨u, huΓ, rfl, rfl⟩⟩ + have hvc : IsCorrespondingAtom Γ K {v} {v} := + ⟨Or.inl (Or.inl ⟨v, hvΓ, rfl⟩), Or.inl (Or.inl ⟨v, hK.2.1.2.1 hvΓ, rfl⟩), + Or.inl ⟨v, hvΓ, rfl, rfl⟩⟩ + exact (tangleMetric_le_of_walk huc hvc W hshort hlen + (singleton_subset_iff.mpr (hcontains 0 huD)) + (singleton_subset_iff.mpr (hcontains (Fin.last n) hvD))).trans hsum + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4DistantEdges.lean b/LeanPool/GraphMinor/GM12/Section4DistantEdges.lean new file mode 100644 index 0000000000..3b801bf590 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4DistantEdges.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM12.Section4EdgeCircuit +import LeanPool.GraphMinor.GM12.Section2NonemptyEdges +import LeanPool.GraphMinor.GM12.Section1b +import LeanPool.GraphMinor.GM11.CitedResults + +/-! +# The two distant edges at the start of XII (4.3) + +A tangle of order at least three requires at least two drawing +edges. Otherwise the small side consisting of its only edge would +cover every edge, contrary to X (2.3). Thus the corrected edge-count +hypothesis of XII (1.2) holds in the application on page 249. +Applying (1.2) to any edge supplies the two distant edges. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM10 GM11 GM14 Hypergraph + +/-- The edge-count condition needed to apply XII (1.2) in (4.3). -/ +theorem two_le_edge_count_of_tangle_order_three + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph θ T) (hθ : 2 < θ) : 2 ≤ Γ.E.ncard := by + obtain ⟨e, he⟩ := edges_nonempty_of_tangle_order_two hT (by omega) + have hm := edge_small_side_mem_of_order_three hT hθ he + have hnot := GM10.theorem_2_3_proof hT (by omega) hm hm hm + by_contra hcard + have hcard' : Γ.E.ncard ≤ 1 := by omega + have hsingle : Γ.E = {e} := by + apply Set.Subset.antisymm + · intro f hf + exact Set.mem_singleton_iff.mpr ((Set.ncard_le_one Γ.finite_edges).mp hcard' f hf e he) + · exact Set.singleton_subset_iff.mpr he + apply hnot + simp only [GM10.union_self] + change ({e} : Set (Set S)) = Γ.E + exact hsingle.symm + +/-- The two edges chosen at the start of XII (4.3), page 249. -/ +theorem exists_two_edges_at_tangle_order_distance + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) (hθ : 2 < θ) : + ∃ g ∈ Γ.E, ∃ h ∈ Γ.E, d g h = θ := by + have hcount := two_le_edge_count_of_tangle_order_three hm.1.2.1 hθ + obtain ⟨g, hg⟩ := (Set.ncard_pos Γ.finite_edges).mp (show 0 < Γ.E.ncard by omega) + obtain ⟨h, hh, hdist⟩ := theorem_1_2_proof hS hm + hcount (Or.inl (Or.inr hg)) + exact ⟨g, hg, h, hh, hdist⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4DistinctCrossDirections.lean b/LeanPool/GraphMinor/GM12/Section4DistinctCrossDirections.lean new file mode 100644 index 0000000000..3464938701 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4DistinctCrossDirections.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4LinearCrossCoordinates +public import Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic +import Mathlib.Tactic.FieldSimp +import Mathlib.Tactic.LinearCombination + +/-! +# Distinct crossing lines have independent directions + +For the local crossing discs in XII (4.5), page 253, the two +supporting lines through a meeting are distinct. Their nonzero +directions have nonzero determinant. If the determinant vanished, +one direction would be a real multiple of the other, making the +lines equal. The coordinate equivalence then sends the axes to +the two directions. +-/ + +public section + +namespace GraphMinor.GM12 + +private theorem exists_scalar_of_cross_det_zero {u v : ℂ} (hu : u ≠ 0) + (hdet : u.re * v.im - u.im * v.re = 0) : ∃ r : ℝ, r • u = v := by + classical + by_cases hur : u.re = 0 + · have hui : u.im ≠ 0 := fun h => hu (Complex.ext hur h) + rw [hur, zero_mul, zero_sub, neg_eq_zero] at hdet + have hvr : v.re = 0 := (mul_eq_zero.mp hdet).resolve_left hui + refine ⟨v.im / u.im, Complex.ext ?_ ?_⟩ + · simp only [Complex.smul_re, smul_eq_mul, hur, mul_zero, hvr] + · rw [Complex.smul_im, smul_eq_mul] + exact div_mul_cancel₀ _ hui + · refine ⟨v.re / u.re, Complex.ext ?_ ?_⟩ + · rw [Complex.smul_re, smul_eq_mul] + exact div_mul_cancel₀ _ hur + · rw [Complex.smul_im, smul_eq_mul] + field_simp [hur] + linear_combination -hdet + +/-- Distinct lines through a common point have nonzero real +cross determinant, for any nonzero vectors defining them. -/ +theorem cross_det_ne_of_distinct_lines {x u v : ℂ} (hu : u ≠ 0) (hv : v ≠ 0) + (hne : line[ℝ, x, x + u] ≠ line[ℝ, x, x + v]) : + u.re * v.im - u.im * v.re ≠ 0 := by + intro hdet + obtain ⟨r, hr⟩ := exists_scalar_of_cross_det_zero hu hdet + have hxv : x + v ∈ line[ℝ, x, x + u] := by + apply mem_affineSpan_pair_iff_exists_lineMap_eq.mpr + refine ⟨r, ?_⟩ + rw [AffineMap.lineMap_apply] + change r • ((x + u) - x) + x = x + v + rw [add_sub_cancel_left, hr, add_comm] + have hxxv : x ≠ x + v := by + intro h + have hvzero : (0 : ℂ) = v := add_left_cancel (show x + 0 = x + v by simpa only [add_zero] using + h) + exact hv hvzero.symm + have heq := affineSpan_pair_eq_of_mem_of_mem_of_ne (left_mem_affineSpan_pair ℝ x (x + u)) hxv hxxv + exact hne heq.symm + +/-- A common meeting of two distinct lines has continuous linear +coordinates carrying the axes to their directions, as used in +XII (4.5)'s crossing discs, page 253. -/ +theorem exists_cross_coordinates_of_distinct_lines {x u v : ℂ} (hu : u ≠ 0) (hv : v ≠ 0) + (hne : line[ℝ, x, x + u] ≠ line[ℝ, x, x + v]) : + ∃ A : ℂ ≃L[ℝ] ℂ, A 1 = u ∧ A Complex.I = v := + exists_linear_cross_coordinates (cross_det_ne_of_distinct_lines hu hv hne) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4DrawingControl.lean b/LeanPool/GraphMinor/GM12/Section4DrawingControl.lean new file mode 100644 index 0000000000..35cf507565 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4DrawingControl.lean @@ -0,0 +1,99 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM12.Section4PathFacts +import LeanPool.GraphMinor.GM12.Section4ConnectedSideBound +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Turning the connecting drawings into a controlled minor + +The last paragraph of XII (4.3), page 251, uses the connected +subdrawings supplied by (3.2) as the branch subgraphs, and the +selected free edges as their joining edges. The graph links give +the two required incidences. The connected-branch order bound +supplies the remaining tangle-control condition. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM14 Hypergraph + +/-- Walk-connected drawing branches are connected as hypergraphs. -/ +theorem isConnectedSub_toHypergraph_of_connected_drawing + {S : Type*} [TopologicalSpace S] {H : Drawing S} (hH : IsConnectedDrawing H) : + IsConnectedSub H.toHypergraph := by + intro x hx y hy + obtain ⟨W⟩ := hH x hx y hy + induction W with + | nil hv => exact .refl _ + | @cons x z y e hl R ih => + by_cases hxz : x = z + · subst z + exact ih hl.right_mem hy + · have hxe : H.toHypergraph.Inc e x := by + refine ⟨hl.edge_mem, hl.left_mem, ?_⟩ + have h : x ∈ closure e ∩ H.V := by rw [hl.2.2.2]; simp + exact h.1 + have hze : H.toHypergraph.Inc e z := by + refine ⟨hl.edge_mem, hl.right_mem, ?_⟩ + have h : z ∈ closure e ∩ H.V := by rw [hl.2.2.2]; simp + exact h.1 + have hadj : H.toHypergraph.skeleton.Adj x z := ⟨hxz, e, hxe, hze⟩ + exact hadj.reachable.trans (ih hl.right_mem hy) + +/-- The branch-assembly step of XII (4.3), page 251, for a +loopless target. Each branch contains ends of two sufficiently +distant edges, which ensures the required separation-order bound. -/ +theorem controlsMinor_of_connecting_drawings + {S α β : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {L : Graph α β} {θ k : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + (H : α → Drawing S) (f : β → Set S) + (hHs : ∀ v ∈ L.vertexSet, (H v).IsSubdrawing Γ) + (hconn : ∀ v ∈ L.vertexSet, IsConnectedDrawing (H v)) + (hdisj : ∀ u ∈ L.vertexSet, ∀ v ∈ L.vertexSet, u ≠ v → Disjoint (H u).V (H v).V) + (hlinks : ∀ e u v, L.IsLink e u v → + ∃ x ∈ (H u).V, ∃ y ∈ (H v).V, Γ.toGraph.IsLink (f e) x y) + (hloopless : ∀ e v, ¬ L.IsLink e v v) + (hinj : ∀ e ∈ L.edgeSet, ∀ g ∈ L.edgeSet, e ≠ g → f e ≠ f g) + (hcard : L.vertexSet.ncard ≤ θ) (hk : 2 * L.vertexSet.ncard ≤ k) + (hwitness : ∀ v ∈ L.vertexSet, ∃ (e g : Set S) (x y : S), + e ∈ Γ.E ∧ g ∈ Γ.E ∧ x ∈ (H v).V ∧ y ∈ (H v).V ∧ + x ∈ closure e ∧ y ∈ closure g ∧ k + 4 ≤ d e g) : + ControlsMinor Γ.toHypergraph θ T L := by + refine ⟨fun v => (H v).toHypergraph, f, ?_, ?_, ?_, ?_, hinj, hcard, ?_⟩ + · intro v hv + obtain ⟨e, g, x, y, _, _, hx, _, _⟩ := hwitness v hv + exact ⟨subdrawing_toHypergraph_le (hHs v hv), ⟨x, hx⟩, + isConnectedSub_toHypergraph_of_connected_drawing (hconn v hv)⟩ + · exact hdisj + · intro e u v hl _ + obtain ⟨x, hx, y, hy, hxy⟩ := hlinks e u v hl + refine ⟨hxy.edge_mem, ⟨x, hx, ?_⟩, y, hy, ?_⟩ + · refine ⟨hxy.edge_mem, hxy.left_mem, ?_⟩ + have h : x ∈ closure (f e) ∩ Γ.V := by rw [hxy.2.2.2]; simp + exact h.1 + · refine ⟨hxy.edge_mem, hxy.right_mem, ?_⟩ + have h : y ∈ closure (f e) ∩ Γ.V := by rw [hxy.2.2.2]; simp + exact h.1 + · intro e v hl + exact False.elim (hloopless e v hl) + · intro A B hAB hord v hv hsub + obtain ⟨e, g, x, y, he, hg, hx, hy, hxe, hyg, hfar⟩ := hwitness v hv + have hbound := separation_order_ge_of_connected_distant_edges hS hm (hconn v hv) + (hHs v hv) he hg hx hy hxe hyg hfar hk hAB hsub + exact (not_lt_of_ge hbound) hord + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4DrawnGraph.lean b/LeanPool/GraphMinor/GM12/Section4DrawnGraph.lean new file mode 100644 index 0000000000..91d8024b37 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4DrawnGraph.lean @@ -0,0 +1,135 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM09.DiscDrawing + +/-! +# Turning a drawing by edge curves into a graph drawing + +The target of XII (4.3), page 249, is an abstract graph that +can be drawn in the surface. Convert its vertex points and edge +curves into a drawing with a graph isomorphism. Start with the +vertex points and add the edges one at a time, using a line for +a nonloop edge and an `O`-arc for a loop. The given intersection +conditions ensure that gluing preserves exactly the original graph. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Graph GM09 + +/-- A finite graph drawn by vertex points and disjoint edge curves +has a geometric drawing isomorphic to it, as used at the start +of XII (4.3), page 249. -/ +theorem exists_graphDrawing_of_edge_curves + {α β S : Type*} [TopologicalSpace S] [T2Space S] + (G : Graph α β) (hV : G.vertexSet.Finite) (hE : G.edgeSet.Finite) + (ν : α → S) (edgeOf : β → Set S) (hν : InjOn ν G.vertexSet) + (hline : ∀ e ∈ G.edgeSet, ∀ u v, G.IsLink e u v → u ≠ v → + IsLineWithEnds (edgeOf e) (ν u) (ν v)) + (hloop : ∀ e ∈ G.edgeSet, ∀ v, G.IsLoopAt e v → IsOArc (edgeOf e) ∧ ν v ∈ edgeOf e) + (hmeet : ∀ e ∈ G.edgeSet, ∀ f ∈ G.edgeSet, e ≠ f → + edgeOf e ∩ edgeOf f ⊆ ν '' G.vertexSet) + (hon : ∀ e ∈ G.edgeSet, ∀ v ∈ G.vertexSet, ν v ∈ edgeOf e → G.Inc e v) : + ∃ D : GraphDrawing G S, D.drawing.U = ν '' G.vertexSet ∪ ⋃ e ∈ G.edgeSet, edgeOf e ∧ + ∀ v : G.vertexSet, (D.iso.vertexEquiv v).val = ν v.val := by + classical + have hconstruct : ∀ (F : Set β), F.Finite → F ⊆ G.edgeSet → + ∃ D : GraphDrawing (G.restrict F) S, + D.drawing.U = ν '' G.vertexSet ∪ ⋃ e ∈ F, edgeOf e ∧ + ∀ v : (G.restrict F).vertexSet, (D.iso.vertexEquiv v).val = ν v.val := by + intro F hF + induction F, hF using Set.Finite.induction_on with + | empty => + intro _ + obtain ⟨D, hDU, hmap⟩ := GraphDrawing.of_edgeless (G := G.restrict ∅) hV + (show (G.restrict ∅).edgeSet = ∅ by simp) hν + refine ⟨D, ?_, hmap⟩ + simpa only [vertexSet_restrict, biUnion_empty, union_empty] using hDU + | @insert e F he hF ih => + intro hFG + have heG : e ∈ G.edgeSet := hFG (Or.inl rfl) + have hFsub : F ⊆ G.edgeSet := fun f hf => hFG (Or.inr hf) + obtain ⟨D₁, hD₁U, hmap₁⟩ := ih hFsub + obtain ⟨u, v, hlink⟩ := G.exists_isLink_of_mem_edgeSet heG + let K : Graph α β := (G.induce {u, v}).restrict {e} + have hKV : K.vertexSet = {u, v} := rfl + have hKE : K.edgeSet = {e} := by + ext f + simp only [K, edgeSet_restrict, mem_inter_iff, mem_singleton_iff, edgeSet_induce, + mem_ofPred_eq] + constructor + · exact fun h => h.2 + · intro hfe + subst f + exact ⟨⟨u, v, hlink, Or.inl rfl, Or.inr rfl⟩, rfl⟩ + have hlinkK : K.IsLink e u v := ⟨rfl, hlink, Or.inl rfl, Or.inr rfl⟩ + have hKL : K ≤ G.restrict (insert e F) := + ⟨by + rw [hKV, vertexSet_restrict] + exact pair_subset hlink.left_mem hlink.right_mem, + fun {_ _ _} hl => ⟨hl.1 ▸ (Or.inl rfl), hl.2.1⟩⟩ + have hsingle : ∃ D₂ : GraphDrawing K S, D₂.drawing.U = edgeOf e ∧ + ∀ z : K.vertexSet, (D₂.iso.vertexEquiv z).val = ν z.val := by + by_cases huv : u = v + · subst v + have hKV' : K.vertexSet = {u} := by simp [hKV] + have hshape := hloop e heG u hlink + exact GraphDrawing.of_single_loop hKV' hKE hlinkK hshape.1 hshape.2 + · exact GraphDrawing.of_single_edge hKV hKE hlinkK + (fun h => huv (hν hlink.left_mem hlink.right_mem h)) (hline e heG u v hlink huv) + obtain ⟨D₂, hD₂U, hmap₂⟩ := hsingle + have hG₁ : G.restrict F ≤ G.restrict (insert e F) := + ⟨subset_rfl, fun {_ _ _} hl => ⟨Or.inr hl.1, hl.2⟩⟩ + have hVunion : (G.restrict F).vertexSet ∪ K.vertexSet = (G.restrict (insert e F)).vertexSet + := by + rw [hKV, vertexSet_restrict, vertexSet_restrict] + exact union_eq_left.mpr (pair_subset hlink.left_mem hlink.right_mem) + have hEunion : (G.restrict F).edgeSet ∪ K.edgeSet = (G.restrict (insert e F)).edgeSet := by + rw [hKE, edgeSet_restrict, edgeSet_restrict] + ext f + simp only [mem_union, mem_inter_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro (⟨hfG, hfF⟩ | hfe) + · exact ⟨hfG, Or.inr hfF⟩ + · subst f + exact ⟨heG, Or.inl rfl⟩ + · rintro ⟨hfG, hfe | hfF⟩ + · exact Or.inr hfe + · exact Or.inl ⟨hfG, hfF⟩ + have hEdisj : Disjoint (G.restrict F).edgeSet K.edgeSet := by + rw [hKE, disjoint_singleton_right, edgeSet_restrict] + exact fun h => he h.2 + have hcontact : D₁.drawing.U ∩ D₂.drawing.U ⊆ ν '' ((G.restrict F).vertexSet ∩ K.vertexSet) + := by + rw [hD₁U, hD₂U, vertexSet_restrict, hKV] + rintro z ⟨hz₁, hz₂⟩ + have hzV : z ∈ ν '' G.vertexSet := by + rcases hz₁ with hzV | hz₁ + · exact hzV + · obtain ⟨f, hfF, hzf⟩ := mem_iUnion₂.mp hz₁ + exact hmeet f (hFsub hfF) e heG (fun hfe => he (hfe ▸ hfF)) ⟨hzf, hz₂⟩ + obtain ⟨w, hw, rfl⟩ := hzV + have hwInc := hon e heG w hw hz₂ + have hwEnds : w ∈ ({u, v} : Set α) := hwInc.eq_or_eq_of_isLink hlink + exact ⟨w, ⟨hw, hwEnds⟩, rfl⟩ + obtain ⟨D, hDU, hmap⟩ := GraphDrawing.glue hG₁ hKL hVunion hEunion hEdisj hν + D₁ D₂ hmap₁ hmap₂ hcontact + refine ⟨D, ?_, hmap⟩ + rw [hDU, hD₁U, hD₂U, biUnion_insert] + ac_rfl + obtain ⟨D, hDU, hmap⟩ := hconstruct G.edgeSet hE subset_rfl + obtain ⟨D', hD', hmap'⟩ := GraphDrawing.of_eq (Graph.restrict_self G) D hmap + exact ⟨D', hD' ▸ hDU, hmap'⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4EdgeCircuit.lean b/LeanPool/GraphMinor/GM12/Section4EdgeCircuit.lean new file mode 100644 index 0000000000..f5effcdb9f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4EdgeCircuit.lean @@ -0,0 +1,65 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section1 +import LeanPool.GraphMinor.GM12.Section4Separation +import LeanPool.GraphMinor.GM12.Section4WalkMetric +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# A short radial circuit enclosing an edge + +The edge--region distance estimate in XII (4.3), claim (5), +page 250, can be witnessed around the edge. Put the edge and its +ends on the small side of their separation, whose order is at most +two. The third tangle axiom chooses this orientation. XII (1.1) +then gives a radial circuit enclosing the edge with at most two +original vertices. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM10 GM11 GM14 Hypergraph + +/-- In order at least three, the edge with its ends is a tangle small side. +This is the orientation used to enclose an edge in XII (4.3). -/ +theorem edge_small_side_mem_of_order_three + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph θ T) (hθ : 2 < θ) + {e : Set S} (he : e ∈ Γ.E) : + (edgeHypergraph Γ.toHypergraph e, Γ.toHypergraph.deleteEdges {e}) ∈ T := + drawing_edge_small_side_mem_of_order_three hT hθ he + +/-- An edge is enclosed by a short radial circuit with at most two +original vertices, providing the local metric witness in XII (4.3). -/ +theorem exists_radial_circuit_around_edge + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsRespectfulDrawingTangle Γ θ T) (hθ : 2 < θ) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + {e : Set S} (he : e ∈ Γ.E) : + ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing K ∧ C.length < 2 * θ ∧ + (C.V ∩ Γ.V).ncard ≤ 2 ∧ e ⊆ ins C := by + have hsep := isSeparation_edgeHypergraph_deleteEdges (G := Γ.toHypergraph) he + have hord := drawing_edge_separation_order_le_two he + have hlt := hord.trans_lt hθ + have hm := edge_small_side_mem_of_order_three hT.2.1 hθ he + obtain ⟨C, hC, hCs, hCl, hCV, heC⟩ := + (theorem_1_1_proof hS hT ⟨e, he⟩ hK hd hsep hlt).mp hm e (mem_singleton e) + exact ⟨C, hC, hCs, hCl, + (ncard_le_ncard hCV (edgeHypergraph Γ.toHypergraph e ∩ + Γ.toHypergraph.deleteEdges {e}).vertexSet_finite).trans hord, heC⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4EdgeEmptyDisc.lean b/LeanPool/GraphMinor/GM12/Section4EdgeEmptyDisc.lean new file mode 100644 index 0000000000..cb1724e4a1 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4EdgeEmptyDisc.lean @@ -0,0 +1,86 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM12.Section4NormalArcDisc +import LeanPool.GraphMinor.GM12.Section4RegionArc +import LeanPool.GraphMinor.GM12.Section3DiscRegion +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.Regions + +/-! +# A disc meeting the drawing only at the ends of an edge + +XII (4.3), page 250, chooses an empty disc through the two +ends of each free edge. Choose a region incident with the edge, +join its two ends through that region, and thicken the resulting +normal arc. The disc meets that same region, and no other region +meets the disc. This also identifies the incident region needed +for the metric estimate in claim (5). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The empty-disc choice in XII (4.3), page 250. Its only drawing +points are the two ends, and it meets a region incident with the edge. -/ +theorem exists_empty_disc_at_edge + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {e : Set S} {u v : S} + (hl : Γ.toGraph.IsLink e u v) (huv : u ≠ v) : + ∃ (D r : Set S), IsClosedDisc D ∧ r ∈ Γ.R ∧ e ⊆ closure r ∧ + Γ.U ∩ D = {u, v} ∧ ({u, v} : Set S) ⊆ discBd D ∧ + Γ.U ∩ D = Γ.V ∩ discBd D ∧ (r ∩ D).Nonempty := by + obtain ⟨r, hr, her⟩ := exists_region_incident hS hl.edge_mem + have hue : u ∈ closure e := by + have h : u ∈ closure e ∩ Γ.V := by rw [hl.2.2.2]; simp + exact h.1 + have hve : v ∈ closure e := by + have h : v ∈ closure e ∩ Γ.V := by rw [hl.2.2.2]; simp + exact h.1 + have hcl : closure e ⊆ closure r := closure_minimal her isClosed_closure + obtain ⟨a, ha, ha0, ha1, har⟩ := exists_arc_through_region hS Γ hr hl.left_mem hl.right_mem huv + (hcl hue) (hcl hve) + have hmeet : range a ∩ Γ.U ⊆ {a 0, a 1} := by + rintro x ⟨hx, hxU⟩ + rcases har hx with hxr | hxends + · exact False.elim (region_subset hr hxr hxU) + · simpa only [ha0, ha1] using hxends + obtain ⟨D, hD, hDU, hends, haD⟩ := exists_normal_arc_disc hS ha Γ.isClosed_U + (ha0 ▸ Γ.V_subset_U hl.left_mem) (ha1 ▸ Γ.V_subset_U hl.right_mem) hmeet + have hUD : Γ.U ∩ D = {u, v} := by + rw [inter_comm] + simpa only [ha0, ha1] using hDU + have hbd : ({u, v} : Set S) ⊆ discBd D := by simpa only [ha0, ha1] using hends + have havoid : Γ.U ∩ D = Γ.V ∩ discBd D := by + apply Set.Subset.antisymm + · intro x hx + have hxends := hUD.subset hx + refine ⟨?_, hbd hxends⟩ + rcases hxends with rfl | hxends + · exact hl.left_mem + · exact (Set.mem_singleton_iff.mp hxends) ▸ hl.right_mem + · intro x hx + exact ⟨Γ.V_subset_U hx.1, discBd_subset D hx.2⟩ + let t : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht0 : t ≠ 0 := by intro h; have h' := congrArg Subtype.val h; norm_num [t] at h' + have ht1 : t ≠ 1 := by intro h; have h' := congrArg Subtype.val h; norm_num [t] at h' + have hatr : a t ∈ r := by + rcases har (mem_range_self t) with h | h + · exact h + · rcases h with h | h + · exact False.elim (ht0 (ha.2 (h.trans ha0.symm))) + · exact False.elim (ht1 (ha.2 ((Set.mem_singleton_iff.mp h).trans ha1.symm))) + exact ⟨D, r, hD, hr, her, hUD, hbd, havoid, a t, hatr, haD (mem_range_self t)⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4EdgeLabels.lean b/LeanPool/GraphMinor/GM12/Section4EdgeLabels.lean new file mode 100644 index 0000000000..126e9ffeec --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4EdgeLabels.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Statement +import LeanPool.GraphMinor.Minor.Basic + +/-! +# An unused edge label + +The paper's minor models are maps on the actual edge sets. The library +represents them as total maps on ambient edge types. For XII (4.2) we +may give the intermediate target an extra unused edge label, so its +ambient edge type is inhabited even when the graph has no edges. +This changes neither the graph nor its number of vertices up to isomorphism. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph + +/-- Relabel the actual edges by `some`, leaving `none` unused. The +resulting graph is isomorphic to the original and has the same vertices. -/ +theorem exists_option_edge_copy {α β : Type*} (G : Graph α β) + (hV : G.vertexSet.Finite) (hE : G.edgeSet.Finite) : + ∃ K : Graph α (Option β), Nonempty (Iso G K) ∧ + K.vertexSet = G.vertexSet ∧ K.vertexSet.Finite ∧ K.edgeSet.Finite := by + let K : Graph α (Option β) := { + vertexSet := G.vertexSet + edgeSet := Option.some '' G.edgeSet + IsLink := fun e x y => match e with | none => False | some f => G.IsLink f x y + isLink_symm := by + intro e _ + refine ⟨?_⟩ + intro x y h + cases e with + | none => exact h.elim + | some e => exact h.symm + eq_or_eq_of_isLink_of_isLink := by + intro e x y z w h₁ h₂ + cases e with + | none => exact h₁.elim + | some e => exact G.eq_or_eq_of_isLink_of_isLink h₁ h₂ + edge_mem_iff_exists_isLink := by + intro e + cases e with + | none => simp + | some e => simpa using + G.edge_mem_iff_exists_isLink e + left_mem_of_isLink := by + intro e x y h + cases e with + | none => exact h.elim + | some e => exact h.left_mem } + have φ : Iso G K := { + vertexEquiv := Equiv.refl _ + edgeEquiv := Equiv.Set.image Option.some G.edgeSet (Option.some_injective β) + isLink_iff := fun _ _ _ => Iff.rfl } + exact ⟨K, ⟨φ⟩, rfl, hV, hE.image Option.some⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4EdgeRegionDistance.lean b/LeanPool/GraphMinor/GM12/Section4EdgeRegionDistance.lean new file mode 100644 index 0000000000..eda3c5694a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4EdgeRegionDistance.lean @@ -0,0 +1,125 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM12.Section4EdgeCircuit +import LeanPool.GraphMinor.GM12.Section4CircuitAtomDistance +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM11.Section91 +import LeanPool.GraphMinor.GM11.Section7 + +/-! +# The distance from an edge to an incident region + +The local estimate in XII (4.3), claim (5), page 250, is two. +Enclose the edge in a radial circuit with at most two original +vertices. Since original edges miss radial edges and vertices, +the edge lies in the interior of the inside. A region incident +with the edge therefore meets that inside too. The circuit bounds +the distance between the two atoms by two. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM10 GM11 GM14 + +/-- The local distance bound used in XII (4.3), claim (5), page 250. +Any atom whose closure contains an edge is at distance at most two +from that edge. In particular this applies to either incident region. -/ +theorem edge_atom_distance_le_two_of_subset_closure + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + {e x : Set S} (he : e ∈ Γ.E) (hx : x ∈ Γ.A) (hsub : e ⊆ closure x) : + d e x ≤ 2 := by + obtain ⟨hT, K, ins, hK, hd, heq⟩ := hm + have heA : e ∈ Γ.A := Or.inl (Or.inr he) + rw [heq e heA x hx] + by_cases hθ : θ ≤ 2 + · exact (tangleMetric_le_order hK.2.1 e x).trans hθ + have hθ' : 2 < θ := Nat.lt_of_not_ge hθ + obtain ⟨C, hC, hCs, hCl, hcount, heC⟩ := + exists_radial_circuit_around_edge hS hT hθ' hK hd he + have hdisc := (hd C hC hCs hCl).1 + have hbd : frontier (ins C) = C.U := by + rw [← subBd_eq_frontier] + exact (hd C hC hCs hCl).2.1 + obtain ⟨z, hz⟩ := he.1 + have hzD : z ∈ interior (ins C) := by + rw [← self_sdiff_frontier] + refine ⟨heC hz, ?_⟩ + intro hfront + have hzK : z ∈ K.U := hCs.U_subset (hbd ▸ hfront) + have hzΓ : z ∈ Γ.U := (he.2.1 hz).1 + have hzV : z ∈ Γ.V := by + have hi : z ∈ (PaintingOrDrawing.drawing Γ).U ∩ K.U := ⟨hzΓ, hzK⟩ + rw [hK.2.1.1] at hi + exact hi + exact (he.2.1 hz).2 hzV + obtain ⟨w, hwD, hwx⟩ := mem_closure_iff.mp (hsub hz) (interior (ins C)) + isOpen_interior hzD + have hdist := atom_distance_le_circuit_vertex_count hS hK hd hC hCs hCl heA hx + ⟨z, hz, heC hz⟩ ⟨w, hwx, interior_subset hwD⟩ + exact hdist.trans hcount + +/-- XII (4.3), claim (5), page 250: incident regions of edges +at distance at least `k + 4` are at distance at least `k`. -/ +theorem incident_regions_distance_ge + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ k : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + {e f r s : Set S} (he : e ∈ Γ.E) (hf : f ∈ Γ.E) + (hr : r ∈ Γ.R) (hs : s ∈ Γ.R) (her : e ⊆ closure r) (hfs : f ⊆ closure s) + (hfar : k + 4 ≤ d e f) : k ≤ d r s := by + have h91 := GM11.gm15_theorem_9_1 Γ θ T d hS inferInstance hm + have hsym := h91.2.2.2.1 + have htri := h91.2.2.2.2.1 + have heA : e ∈ Γ.A := Or.inl (Or.inr he) + have hfA : f ∈ Γ.A := Or.inl (Or.inr hf) + have hrA : r ∈ Γ.A := Or.inr hr + have hsA : s ∈ Γ.A := Or.inr hs + have hlocal₁ := edge_atom_distance_le_two_of_subset_closure hS hm he hrA her + have hlocal₂ := edge_atom_distance_le_two_of_subset_closure hS hm hf hsA hfs + have ht₁ := htri e heA r hrA f hfA + have ht₂ := htri r hrA s hsA f hfA + rw [hsym s hsA f hfA] at ht₂ + omega + +/-- The endpoint estimate in the final paragraph of XII (4.3), +page 251. Ends of edges at distance at least `k + 4` are at +distance at least `k`. -/ +theorem distant_edges_endpoints_distance_ge + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ k : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + {e f : Set S} (he : e ∈ Γ.E) (hf : f ∈ Γ.E) + {u v : S} (hu : u ∈ Γ.V) (hv : v ∈ Γ.V) + (hue : u ∈ closure e) (hvf : v ∈ closure f) + (hfar : k + 4 ≤ d e f) : k ≤ d {u} {v} := by + have h91 := GM11.gm15_theorem_9_1 Γ θ T d hS inferInstance hm + have hsym := h91.2.2.2.1 + have htri := h91.2.2.2.2.1 + have heA : e ∈ Γ.A := Or.inl (Or.inr he) + have hfA : f ∈ Γ.A := Or.inl (Or.inr hf) + have huA : ({u} : Set S) ∈ Γ.A := Or.inl (Or.inl ⟨u, hu, rfl⟩) + have hvA : ({v} : Set S) ∈ Γ.A := Or.inl (Or.inl ⟨v, hv, rfl⟩) + have hlocal₁ := h91.2.2.2.2.2.2 u hu e he hue + have hlocal₂ := h91.2.2.2.2.2.2 v hv f hf hvf + have ht₁ := htri e heA {u} huA f hfA + have ht₂ := htri {u} huA {v} hvA f hfA + rw [hsym e heA {u} huA] at ht₁ + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4EmbeddedContactDiscs.lean b/LeanPool/GraphMinor/GM12/Section4EmbeddedContactDiscs.lean new file mode 100644 index 0000000000..2b44524801 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4EmbeddedContactDiscs.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4MeetingImages +public import LeanPool.GraphMinor.GM12.Section4OneCrossingContactDiscs + +/-! +# Source contact discs after embedding the plane + +For XII (4.5), claim (1), page 253, transport the planar source +and its crossing discs into a surface chart before clipping +and thickening. Compactness makes the image crossing-disc union +closed. Openness of the embedding keeps each crossing in its +interior, and injectivity preserves all one-crossing and vertex +incidence equations. The closed-surface construction then gives +the required vertex contact discs. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Carry a planar one-crossing source into a closed surface +and construct its disjoint vertex contact discs there. This is +the chart-transfer and vertex-disc step in XII (4.5), claim (1), +page 253. -/ +theorem exists_embedded_contact_discs {S V E : Type} [TopologicalSpace S] + [T2Space S] [ConnectedSpace S] [Finite V] [Finite E] + (hS : IsClosedSurface S) (f : ℂ → S) (hf : Topology.IsOpenEmbedding f) + (v : V → ℂ) (hinj : Function.Injective v) (κ : E × Bool → V) (P : E → Set ℂ) + (hP : ∀ e, IsLineWithEnds (P e) (v (κ (e, false))) (v (κ (e, true)))) + (hPV : ∀ e w, v w ∈ P e → w = κ (e, false) ∨ w = κ (e, true)) + (hcross : ∀ e, ∃ x ∈ edgeMeetingPoints v P, P e ∩ edgeMeetingPoints v P = {x}) + (Z : Set ℂ) (hZ : IsCompact Z) (hvZ : ∀ w, v w ∉ Z) + (hMZ : edgeMeetingPoints v P ⊆ interior Z) : + ∃ (q : E × Bool → S) (D : V → Set S), Function.Injective q ∧ + (∀ i, q i ∈ (f '' P i.1) ∩ frontier (f '' Z)) ∧ + (∀ w, IsClosedDisc (D w)) ∧ + (∀ w z, w ≠ z → Disjoint (D w) (D z)) ∧ + ∀ w, D w ∩ (f '' Z) = {z | ∃ i, κ i = w ∧ q i = z} := by + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + let : CompactSpace S := hS.1 + have hv' : Function.Injective (f ∘ v) := hf.injective.comp hinj + have hP' : ∀ e, IsLineWithEnds (f '' P e) ((f ∘ v) (κ (e, false))) + ((f ∘ v) (κ (e, true))) := + fun e => isLineWithEnds_image_injective f hf.continuous hf.injective (hP e) + have hPV' : ∀ e w, (f ∘ v) w ∈ f '' P e → w = κ (e, false) ∨ w = κ (e, true) := by + rintro e w ⟨z, hz, hzw⟩ + have heq : z = v w := hf.injective hzw + exact hPV e w (heq ▸ hz) + have hcross' : ∀ e, ∃ x ∈ edgeMeetingPoints (f ∘ v) (fun j => f '' P j), + (f '' P e) ∩ edgeMeetingPoints (f ∘ v) (fun j => f '' P j) = {x} := by + intro e + obtain ⟨x, hx, heq⟩ := hcross e + refine ⟨f x, ?_, one_meeting_image f hf.injective v P heq⟩ + rw [edgeMeetingPoints_image f hf.injective] + exact mem_image_of_mem f hx + have hvZ' : ∀ w, (f ∘ v) w ∉ f '' Z := by + rintro w ⟨z, hz, hzw⟩ + exact hvZ w ((hf.injective hzw) ▸ hz) + have hMZ' : edgeMeetingPoints (f ∘ v) (fun e => f '' P e) ⊆ interior (f '' Z) := by + rw [edgeMeetingPoints_image f hf.injective] + rintro _ ⟨x, hx, rfl⟩ + exact hf.isOpenMap.image_interior_subset Z (mem_image_of_mem f (hMZ hx)) + exact exists_one_crossing_contact_discs hS (f ∘ v) hv' κ (fun e => f '' P e) hP' hPV' + hcross' (f '' Z) (hZ.image hf.continuous).isClosed hvZ' hMZ' + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4EmbeddedOppositeContacts.lean b/LeanPool/GraphMinor/GM12/Section4EmbeddedOppositeContacts.lean new file mode 100644 index 0000000000..019b3db2b5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4EmbeddedOppositeContacts.lean @@ -0,0 +1,143 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4EmbeddedContactDiscs +public import LeanPool.GraphMinor.GM12.Section4CrossingContactLocation +public import LeanPool.GraphMinor.GM12.Section4CrossDiscQuadrants +public import LeanPool.GraphMinor.GM12.Section4EndPartition +import LeanPool.GraphMinor.Surface.Wedge +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Opposite endpoint classes after embedding the source + +For XII (4.5), claim (1), page 253, carry the crossing discs +and one-crossing arcs into a surface chart and form the vertex +contact discs. Each residual edge end lies on its own crossing +disc. The two ends are distinct, so their unordered pair is +exactly the corresponding opposite pair of quarter-turn marks. +This identifies the geometric contact classes with the edge +ends used later to index the external paths. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Metric + +/-- The embedded source has disjoint vertex contact discs whose +edge-end pairs are exactly the two marked opposite pairs at +each crossing. This assembles the endpoint classes in +XII (4.5), claim (1), page 253. -/ +theorem exists_embedded_opposite_contacts {S V E : Type} + [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite V] [Finite E] + (hS : IsClosedSurface S) (f : ℂ → S) (hf : Topology.IsOpenEmbedding f) + (v : V → ℂ) (hinj : Function.Injective v) (κ : E × Bool → V) (P : E → Set ℂ) + (hP : ∀ e, IsLineWithEnds (P e) (v (κ (e, false))) (v (κ (e, true)))) + (hPV : ∀ e w, v w ∈ P e → w = κ (e, false) ∨ w = κ (e, true)) + (hcross : ∀ e, ∃ x ∈ edgeMeetingPoints v P, P e ∩ edgeMeetingPoints v P = {x}) + (hM : (edgeMeetingPoints v P).Finite) + (σ : (edgeMeetingPoints v P × Bool) ≃ E) + (A : edgeMeetingPoints v P → ℂ ≃L[ℝ] ℂ) + (r : edgeMeetingPoints v P → ℝ) (D : edgeMeetingPoints v P → Set ℂ) + (hpair : ∀ x, x.val ∈ P (σ (x, false)) ∩ P (σ (x, true))) + (hD : ∀ x, IsClosedDisc (D x)) + (hcentre : ∀ x, x.val ∈ interior (D x)) (hDv : ∀ x, Disjoint (D x) (range v)) + (hDP : ∀ x e, e ≠ σ (x, false) → e ≠ σ (x, true) → Disjoint (D x) (P e)) + (hleft : ∀ x, P (σ (x, false)) ∩ discBd (D x) = + {x.val + A x (r x • (1 : ℂ)), x.val + A x ((-r x) • (1 : ℂ))}) + (hright : ∀ x, P (σ (x, true)) ∩ discBd (D x) = + {x.val + A x (r x • Complex.I), x.val + A x ((-r x) • Complex.I)}) : + ∃ (q : E × Bool → S) (B : V → Set S), Function.Injective q ∧ + (∀ w, IsClosedDisc (B w)) ∧ (∀ w z, w ≠ z → Disjoint (B w) (B z)) ∧ + (∀ w, B w ∩ (⋃ x, f '' D x) = edgeEndClass q κ w) ∧ + (∀ x, ({q (σ (x, false), false), q (σ (x, false), true)} : Set S) = + {f (crossDiscParam (A x) x.val (r x) (ee 0)), + f (crossDiscParam (A x) x.val (r x) (ee (1 / 2)))}) ∧ + (∀ x, ({q (σ (x, true), false), q (σ (x, true), true)} : Set S) = + {f (crossDiscParam (A x) x.val (r x) (ee (1 / 4))), + f (crossDiscParam (A x) x.val (r x) (ee (3 / 4)))}) := by + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + classical + let X := edgeMeetingPoints v P + let : Fintype X := hM.fintype + let Z := ⋃ x : X, D x + have hZ : IsCompact Z := isCompact_iUnion (fun x => (hD x).isCompact) + have hvZ : ∀ w, v w ∉ Z := by + intro w hw + obtain ⟨x, hx⟩ := mem_iUnion.mp hw + exact disjoint_left.mp (hDv x) hx (mem_range_self w) + have hMZ : X ⊆ interior Z := by + intro z hz + exact interior_mono (subset_iUnion D ⟨z, hz⟩) (hcentre ⟨z, hz⟩) + obtain ⟨q, B, hq, hqGeom, hB, hBB, hBcontact⟩ := exists_embedded_contact_discs + hS f hf v hinj κ P hP hPV hcross Z hZ hvZ hMZ + have hZi : f '' Z = ⋃ x : X, f '' D x := image_iUnion + have himage : ∀ x : X, IsClosedDisc (f '' D x) ∧ discBd (f '' D x) = f '' discBd (D x) := + fun x => Surface.isClosedDisc_image_injOn (hD x) (hD x).isCompact hf.continuous.continuousOn + hf.injective.injOn + have hxrange : range (Subtype.val : X → ℂ) = X := by + ext z + exact ⟨fun ⟨x, hx⟩ => hx ▸ x.property, fun hz => ⟨⟨z, hz⟩, rfl⟩⟩ + have hmeet : ∀ x : X, ∀ b : Bool, P (σ (x, b)) ∩ X = {x.val} := by + intro x b + obtain ⟨z, hz, hmeet⟩ := hcross (σ (x, b)) + have hxP : x.val ∈ P (σ (x, b)) := by + cases b + · exact (hpair x).1 + · exact (hpair x).2 + have hxz : x.val = z := mem_singleton_iff.mp (hmeet.subset ⟨hxP, x.property⟩) + rwa [← hxz] at hmeet + have hmeetImage : ∀ x : X, ∀ b : Bool, + (f '' P (σ (x, b))) ∩ range (fun y : X => f y.val) = {f x.val} := by + intro x b + change (f '' P (σ (x, b))) ∩ range (f ∘ (Subtype.val : X → ℂ)) = _ + rw [range_comp, hxrange, ← image_inter hf.injective, hmeet, image_singleton] + have hpairImage : ∀ x : X, f x.val ∈ (f '' P (σ (x, false))) ∩ (f '' P (σ (x, true))) := + fun x => ⟨mem_image_of_mem f (hpair x).1, mem_image_of_mem f (hpair x).2⟩ + have havoidImage : ∀ x : X, ∀ e, e ≠ σ (x, false) → e ≠ σ (x, true) → + Disjoint (f '' D x) (f '' P e) := fun x e hl hr => + (disjoint_image_iff hf.injective).mpr (hDP x e hl hr) + have hqgeom : ∀ i, q i ∈ (f '' P i.1) ∩ frontier (⋃ x : X, f '' D x) := by + intro i + rw [← hZi] + exact hqGeom i + refine ⟨q, B, hq, hB, hBB, ?_, ?_, ?_⟩ + · intro w + rw [← hZi] + exact hBcontact w + · intro x + obtain ⟨h0, -, h2, -⟩ := crossDiscParam_quarter_values (A x) x.val (r x) + have hbd : (f '' P (σ (x, false))) ∩ discBd (f '' D x) = + {f (crossDiscParam (A x) x.val (r x) (ee 0)), f (crossDiscParam (A x) x.val (r x) (ee + (1 / 2)))} := by + rw [(himage x).2, ← image_inter hf.injective, hleft, image_pair, h0, h2] + exact crossing_contact_pair_eq hS (fun x : X => f '' D x) (fun x => (himage x).1) + (fun x : X => f x.val) (hf.injective.comp Subtype.val_injective) + (fun e => f '' P e) (fun x => σ (x, false)) (fun x => σ (x, true)) hpairImage havoidImage + (σ (x, false)) x (hmeetImage x false) hbd + (fun h => Bool.false_ne_true (congrArg Prod.snd (hq h))) (hqgeom (σ (x, false), false)) + (hqgeom (σ (x, false), true)) + · intro x + obtain ⟨-, h1, -, h3⟩ := crossDiscParam_quarter_values (A x) x.val (r x) + have hbd : (f '' P (σ (x, true))) ∩ discBd (f '' D x) = + {f (crossDiscParam (A x) x.val (r x) (ee (1 / 4))), f (crossDiscParam (A x) x.val (r x) (ee + (3 / 4)))} := by + rw [(himage x).2, ← image_inter hf.injective, hright, image_pair, h1, h3] + exact crossing_contact_pair_eq hS (fun x : X => f '' D x) (fun x => (himage x).1) + (fun x : X => f x.val) (hf.injective.comp Subtype.val_injective) + (fun e => f '' P e) (fun x => σ (x, false)) (fun x => σ (x, true)) hpairImage havoidImage + (σ (x, true)) x (hmeetImage x true) hbd + (fun h => Bool.false_ne_true (congrArg Prod.snd (hq h))) (hqgeom (σ (x, true), false)) + (hqgeom (σ (x, true), true)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4EmptyDiscsDisjoint.lean b/LeanPool/GraphMinor/GM12/Section4EmptyDiscsDisjoint.lean new file mode 100644 index 0000000000..b2eb08bf29 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4EmptyDiscsDisjoint.lean @@ -0,0 +1,83 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM12.Section4IncidentEdges +import LeanPool.GraphMinor.GM12.Section4EdgeRegionDistance +import LeanPool.GraphMinor.GM12.Section3DiscRegion +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM11.Regions + +/-! +# Empty discs at distant edges are disjoint + +XII (4.3), page 250, uses disjoint empty discs at its chosen +edges. A common drawing point would be a common end of the two +edges, bounding their distance by four. A common point off the +drawing would put both discs in the same incident region. The +region-distance estimate rules this out too. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM14 + +/-- The disjointness assertion following XII (4.3), claim (4), +page 250, with the threshold five made explicit. -/ +theorem empty_discs_disjoint_of_edges_distant + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + {e f : Set S} {u v x y : S} + (he : Γ.toGraph.IsLink e u v) (hf : Γ.toGraph.IsLink f x y) + {D E r s : Set S} (hD : IsClosedDisc D) (hE : IsClosedDisc E) + (hDU : Γ.U ∩ D = {u, v}) (hEU : Γ.U ∩ E = {x, y}) + (hDa : Γ.U ∩ D = Γ.V ∩ discBd D) (hEa : Γ.U ∩ E = Γ.V ∩ discBd E) + (hr : r ∈ Γ.R) (hs : s ∈ Γ.R) (her : e ⊆ closure r) (hfs : f ⊆ closure s) + (hrD : (r ∩ D).Nonempty) (hsE : (s ∩ E).Nonempty) + (hfar : 5 ≤ d e f) : Disjoint D E := by + have hreg : 1 ≤ d r s := incident_regions_distance_ge hS hm he.edge_mem hf.edge_mem + hr hs her hfs hfar + have h91 := GM11.gm15_theorem_9_1 Γ θ T d hS inferInstance hm + have hrs : r ≠ s := by + intro heq + subst s + rw [h91.2.1 r (Or.inr hr)] at hreg + exact Nat.not_succ_le_zero 0 hreg + obtain ⟨r', _, _, _, huniqD⟩ := exists_unique_region_meeting_disc hS hD hDa + obtain ⟨s', _, _, _, huniqE⟩ := exists_unique_region_meeting_disc hS hE hEa + have hrr' := huniqD r hr hrD + have hss' := huniqE s hs hsE + apply Set.disjoint_left.mpr + intro z hzD hzE + by_cases hzU : z ∈ Γ.U + · have hzends := hDU.subset ⟨hzU, hzD⟩ + have hzends' := hEU.subset ⟨hzU, hzE⟩ + have hzV : z ∈ Γ.V := by + rcases hzends with rfl | hzends + · exact he.left_mem + · exact (Set.mem_singleton_iff.mp hzends) ▸ he.right_mem + have hze : z ∈ closure e := by + have h : z ∈ closure e ∩ Γ.V := by rw [he.2.2.2]; exact hzends + exact h.1 + have hzf : z ∈ closure f := by + have h : z ∈ closure f ∩ Γ.V := by rw [hf.2.2.2]; exact hzends' + exact h.1 + have hclose := incident_edges_distance_le_four hS hm he.edge_mem hf.edge_mem hzV hze hzf + omega + · obtain ⟨q, hq, hzq⟩ := exists_region_of_notMem hzU + have hqr' := huniqD q hq ⟨z, hzq, hzD⟩ + have hqs' := huniqE q hq ⟨z, hzq, hzE⟩ + exact hrs (hrr'.trans (hqr'.symm.trans (hqs'.trans hss'.symm))) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4EndPartition.lean b/LeanPool/GraphMinor/GM12/Section4EndPartition.lean new file mode 100644 index 0000000000..e77f409074 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4EndPartition.lean @@ -0,0 +1,142 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM12.Section3Punctured +import LeanPool.GraphMinor.Surface.DiscGrow +import Mathlib.Data.Set.Card + +/-! +# Partitioning the selected edge ends + +In XII (4.3), page 250, direct the target graph's edges and +assign each selected end to the corresponding target vertex. +The resulting classes partition the selected ends. Distinct +selected ends are distinct points because their discs are disjoint +and each edge has distinct ends. The total boundary set has size +at most twice the number of discs. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The class `Z_v` of XII (4.3), page 250: the selected ends +assigned to the target vertex `v` by the edge orientation. -/ +def edgeEndClass {ι κ S : Type*} (ends : ι → S) (vertexOfEnd : ι → κ) (v : κ) : Set S := + ends '' {i | vertexOfEnd i = v} + +/-- The oriented end classes cover exactly the selected ends. -/ +theorem iUnion_edgeEndClass {ι κ S : Type*} (ends : ι → S) (vertexOfEnd : ι → κ) : + ⋃ v, edgeEndClass ends vertexOfEnd v = range ends := by + ext x + constructor + · intro hx + obtain ⟨v, i, _, rfl⟩ := mem_iUnion.mp hx + exact mem_range_self i + · rintro ⟨i, rfl⟩ + exact mem_iUnion.mpr ⟨vertexOfEnd i, i, rfl, rfl⟩ + +/-- Distinct oriented end classes are disjoint when all selected +ends are distinct points. -/ +theorem disjoint_edgeEndClass {ι κ S : Type*} (ends : ι → S) (vertexOfEnd : ι → κ) + (hinj : Function.Injective ends) {u v : κ} (huv : u ≠ v) : + Disjoint (edgeEndClass ends vertexOfEnd u) (edgeEndClass ends vertexOfEnd v) := by + apply Set.disjoint_left.mpr + rintro x ⟨i, hi, hix⟩ ⟨j, hj, hjx⟩ + have hij : i = j := hinj (hix.trans hjx.symm) + subst j + exact huv (hi.symm.trans hj) + +/-- Endpoints on pairwise disjoint discs give an injective list +of selected ends, as used in XII (4.3), page 250. -/ +theorem edge_ends_injective_of_disjoint_discs + {S ι : Type*} (a b : ι → S) (Δ : ι → Set S) + (hab : ∀ i, a i ≠ b i) (ha : ∀ i, a i ∈ Δ i) (hb : ∀ i, b i ∈ Δ i) + (hdisj : ∀ i j, i ≠ j → Disjoint (Δ i) (Δ j)) : + Function.Injective (fun q : ι × Bool => if q.2 then a q.1 else b q.1) := by + intro ⟨i, c⟩ ⟨j, d⟩ heq + have hij : i = j := by + by_contra hne + have hmem₁ : (if c then a i else b i) ∈ Δ i := by cases c <;> simp [ha, hb] + have hmem₂ : (if d then a j else b j) ∈ Δ j := by cases d <;> simp [ha, hb] + change (if c then a i else b i) = (if d then a j else b j) at heq + exact Set.disjoint_left.mp (hdisj i j hne) hmem₁ (heq.symm ▸ hmem₂) + subst j + congr 1 + cases c <;> cases d + · rfl + · exact False.elim ((hab i).symm heq) + · exact False.elim (hab i heq) + · rfl + +/-- The boundary set of `t` empty two-end discs has size at most +`2t`, the parameter `z` used in XII (4.3), page 249. -/ +theorem discBoundaryVertices_ncard_le_twice + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} {t : ℕ} + (Δ : Fin t → Set S) (a b : Fin t → S) + (hbd : ∀ i, Γ.V ∩ discBd (Δ i) = {a i, b i}) : + (discBoundaryVertices Γ Δ).ncard ≤ 2 * t := by + let ends : Fin t × Bool → S := fun q => if q.2 then a q.1 else b q.1 + have hsub : discBoundaryVertices Γ Δ ⊆ ends '' univ := by + intro x hx + obtain ⟨i, hi⟩ := mem_iUnion.mp hx + rw [hbd i] at hi + rcases hi with rfl | hi + · exact ⟨(i, true), mem_univ _, rfl⟩ + · exact ⟨(i, false), mem_univ _, Set.mem_singleton_iff.mp hi |>.symm⟩ + have hcard := (ncard_le_ncard hsub (toFinite _)).trans (ncard_image_le (toFinite univ)) + simpa only [ncard_univ, Nat.card_eq_fintype_card, Fintype.card_prod, Fintype.card_fin, + Fintype.card_bool, Nat.mul_comm t 2] using hcard + +/-- For empty two-end discs, the boundary set is the range of +the selected end labels. -/ +theorem discBoundaryVertices_eq_range_ends + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} {t : ℕ} + (Δ : Fin t → Set S) (a b : Fin t → S) + (hbd : ∀ i, Γ.V ∩ discBd (Δ i) = {a i, b i}) : + discBoundaryVertices Γ Δ = + range (fun q : Fin t × Bool => if q.2 then a q.1 else b q.1) := by + ext x + constructor + · intro hx + obtain ⟨i, hi⟩ := mem_iUnion.mp hx + rw [hbd i] at hi + rcases hi with rfl | hi + · exact ⟨(i, true), rfl⟩ + · exact ⟨(i, false), (Set.mem_singleton_iff.mp hi).symm⟩ + · rintro ⟨⟨i, c⟩, rfl⟩ + apply mem_iUnion.mpr + refine ⟨i, ?_⟩ + rw [hbd i] + cases c <;> simp + +/-- Reindexing the ends and target vertices preserves their contact +classes, as used to label the source discs of XII (4.3), claim (7). -/ +theorem edgeEndClass_reindex + {ι ι' κ κ' S : Type*} (ε : ι ≃ ι') (ν : κ ≃ κ') + (ends : ι' → S) (owner : ι' → κ') (owner' : ι → κ) + (howner : ∀ i, owner (ε i) = ν (owner' i)) (v : κ) : + edgeEndClass ends owner (ν v) = edgeEndClass (ends ∘ ε) owner' v := by + ext x + constructor + · rintro ⟨i, hi, hix⟩ + refine ⟨ε.symm i, ?_, ?_⟩ + · apply ν.injective + have h := howner (ε.symm i) + rw [ε.apply_symm_apply] at h + exact h.symm.trans hi + · simpa only [Function.comp_apply, ε.apply_symm_apply] using hix + · rintro ⟨i, hi, hix⟩ + exact ⟨ε i, (howner i).trans (congrArg ν hi), hix⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ExternalPathBranches.lean b/LeanPool/GraphMinor/GM12/Section4ExternalPathBranches.lean new file mode 100644 index 0000000000..330a8886ff --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ExternalPathBranches.lean @@ -0,0 +1,124 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM12.Section4PathTruncation +import LeanPool.GraphMinor.GM12.Section4BranchUnions +import LeanPool.GraphMinor.GM12.Section4AttachedBranches +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Absorbing external paths into the clique branches + +XII (4.4), page 252, retains the terminal edge of each external +path and attaches the remaining path to its first branch. The +remaining path meets the drawn subgraph only at its first endpoint. +It therefore avoids every other branch. Disjointness of the +external paths keeps all attached pieces disjoint. The retained +edges then join the enlarged branches, and are distinct. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph Surface Hypergraph GM09 GM10 GM14 + +/-- A graph inclusion preserves its finite incidence hypergraph. -/ +theorem ofGraph_le_of_subgraph + {α β : Type*} {G Q : Graph α β} (hV : G.vertexSet.Finite) (hE : G.edgeSet.Finite) + (hQ : Q ≤ G) : + Hypergraph.ofGraph Q (hV.subset hQ.vertexSet_mono) (hE.subset hQ.edgeSet_mono) ≤ + Hypergraph.ofGraph G hV hE := by + refine ⟨hQ.vertexSet_mono, hQ.edgeSet_mono, ?_⟩ + intro e he + ext x + change G.Inc e x ↔ Q.Inc e x + constructor + · rintro ⟨y, hxy⟩ + exact ⟨y, (hQ.isLink_iff he).mpr hxy⟩ + · rintro ⟨y, hxy⟩ + exact ⟨y, (hQ.isLink_iff he).mp hxy⟩ + +/-- The enlarged branches and their joining edges in XII (4.4), +page 252, for any assignment of disjoint external paths to branches. -/ +theorem exists_branches_from_external_paths + {α β : Type*} {G F : Graph α β} (hV : G.vertexSet.Finite) (hE : G.edgeSet.Finite) + {W E : Type*} [Finite E] (A : W → Hypergraph α β) + (hA : ∀ v, A v ≤ Hypergraph.ofGraph G hV hE ∧ + (A v).vertexSet.Nonempty ∧ IsConnectedSub (A v)) + (hAA : ∀ v w, v ≠ w → Disjoint (A v).vertexSet (A w).vertexSet) + (hAF : ∀ v, (A v).vertexSet ⊆ F.vertexSet) + (P : E → Graph α β) (s r : E → α) (left right : E → W) + (hP : ∀ i, IsHPathWithEnds G F (P i) (s i) (r i)) + (hPP : ∀ i j, i ≠ j → Disjoint (P i).vertexSet (P j).vertexSet) + (hs : ∀ i, s i ∈ (A (left i)).vertexSet) + (hr : ∀ i, r i ∈ (A (right i)).vertexSet) : + ∃ (C : W → Hypergraph α β) (b : E → β), + (∀ v, C v ≤ Hypergraph.ofGraph G hV hE ∧ + (C v).vertexSet.Nonempty ∧ IsConnectedSub (C v)) ∧ + (∀ v w, v ≠ w → Disjoint (C v).vertexSet (C w).vertexSet) ∧ + (∀ v, A v ≤ C v) ∧ Function.Injective b ∧ + ∀ i, b i ∈ G.edgeSet ∧ ∃ x ∈ (C (left i)).vertexSet, + ∃ y ∈ (C (right i)).vertexSet, G.IsLink (b i) x y := by + classical + have hsplit : ∀ i, ∃ (Q : Graph α β) (b : β) (x : α), + IsGraphPathWithEnds G Q (s i) x ∧ Q ≤ P i ∧ + Q.vertexSet = (P i).vertexSet \ {r i} ∧ Q.edgeSet = (P i).edgeSet \ {b} ∧ + G.IsLink b x (r i) ∧ b ∈ (P i).edgeSet ∧ r i ∉ Q.vertexSet := + fun i => exists_path_without_last_vertex (hP i).2.1 (hP i).2.2.1 + choose Q b x hQ using hsplit + have hQG : ∀ i, Q i ≤ G := fun i => (hQ i).1.1 + let B : E → Hypergraph α β := fun i => + Hypergraph.ofGraph (Q i) (hV.subset (hQG i).vertexSet_mono) (hE.subset (hQG i).edgeSet_mono) + have hB : ∀ i, B i ≤ Hypergraph.ofGraph G hV hE ∧ IsConnectedSub (B i) := by + intro i + exact ⟨ofGraph_le_of_subgraph hV hE (hQG i), + isConnectedSub_of_graph_path _ _ (hQ i).1⟩ + have hBB : ∀ i j, i ≠ j → Disjoint (B i).vertexSet (B j).vertexSet := by + intro i j hij + exact (hPP i j hij).mono (hQ i).2.1.vertexSet_mono (hQ j).2.1.vertexSet_mono + have hBF : ∀ i, (B i).vertexSet ∩ F.vertexSet = {s i} := by + intro i + apply Set.Subset.antisymm + · rintro z ⟨hzQ, hzF⟩ + have hzP := (hQ i).2.1.vertexSet_mono hzQ + have hends := (hP i).2.2.2.2.2.1.subset ⟨hzP, hzF⟩ + rcases hends with hzs | hzr + · exact Set.mem_singleton_iff.mpr hzs + · exact False.elim ((hQ i).2.2.2.2.2.2 ((Set.mem_singleton_iff.mp hzr) ▸ hzQ)) + · rintro z rfl + exact ⟨(hQ i).1.left_mem, (hP i).2.2.2.1⟩ + have hmeet : ∀ i, ((A (left i)).vertexSet ∩ (B i).vertexSet).Nonempty := + fun i => ⟨s i, hs i, (hQ i).1.left_mem⟩ + have hcross : ∀ i v, v ≠ left i → Disjoint (B i).vertexSet (A v).vertexSet := by + intro i v hv + apply Set.disjoint_left.mpr + intro z hzB hzA + have hzs := Set.mem_singleton_iff.mp ((hBF i).subset ⟨hzB, hAF v hzA⟩) + exact Set.disjoint_left.mp (hAA v (left i) hv) hzA (hzs.symm ▸ hs i) + obtain ⟨C, hC, hCC, hAC, hBC⟩ := + exists_branches_with_attached_pieces A B left hA hAA hB hBB hmeet hcross + refine ⟨C, b, hC, hCC, hAC, ?_, ?_⟩ + · intro i j heq + by_contra hij + have hePj : b i ∈ (P j).edgeSet := heq.symm ▸ (hQ j).2.2.2.2.2.1 + have hjlink : (P j).IsLink (b i) (x i) (r i) := + ((hP j).2.1.1.isLink_iff hePj).mpr (hQ i).2.2.2.2.1 + exact Set.disjoint_left.mp (hPP i j hij) + ((hQ i).2.1.vertexSet_mono (hQ i).1.right_mem) hjlink.left_mem + · intro i + exact ⟨(hP i).2.1.1.edgeSet_mono (hQ i).2.2.2.2.2.1, + x i, (hBC i).vertexSet_subset (hQ i).1.right_mem, + r i, (hAC (right i)).vertexSet_subset (hr i), (hQ i).2.2.2.2.1⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4EyeBoundaryParameters.lean b/LeanPool/GraphMinor/GM12/Section4EyeBoundaryParameters.lean new file mode 100644 index 0000000000..e46a36c453 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4EyeBoundaryParameters.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.Surface.CircleMove +import Mathlib.Order.Fin.Basic +import Mathlib.Tactic.FinCases + +/-! +# Boundary parameters for the four vertices of an eye + +The cyclic-order assumption in XII (4.5), page 252, gives +four increasing angles on its circuit. Divide them by one +full turn to obtain the ordered parameters used by claim (1). +The original opposite pairs are retained. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM14 + +/-- The four boundary vertices of an eye have increasing +parameters in one turn, with their specified order unchanged. -/ +theorem exists_eye_boundary_parameters + {S : Type*} [TopologicalSpace S] {C : Drawing S} {a b c d : S} + (h : OccurInCircuitOrder C a b c d) : + ∃ (φ : Circle ≃ₜ C.U) (β : Fin 4 → ℝ), + StrictMono β ∧ (∀ i, β i ∈ Ico 0 1) ∧ + (φ (ee (β 0))).val = a ∧ (φ (ee (β 1))).val = b ∧ + (φ (ee (β 2))).val = c ∧ (φ (ee (β 3))).val = d := by + obtain ⟨φ, t₀, t₁, t₂, t₃, h0, h01, h12, h23, h3, ha, hb, hc, hd⟩ := h + let t : Fin 4 → ℝ := ![t₀, t₁, t₂, t₃] + have ht : StrictMono t := by + apply Fin.strictMono_iff_lt_succ.mpr + intro i + fin_cases i + · exact h01 + · exact h12 + · exact h23 + have hpi : 0 < 2 * Real.pi := Real.two_pi_pos + let β : Fin 4 → ℝ := fun i => t i / (2 * Real.pi) + have hβ : StrictMono β := fun i j hij => div_lt_div_of_pos_right (ht hij) hpi + have hβrange : ∀ i, β i ∈ Ico 0 1 := by + intro i + have hi0 : 0 ≤ t i := h0.trans (ht.monotone (Fin.zero_le i)) + have hi3 : t i < 2 * Real.pi := (ht.monotone (Fin.le_last i)).trans_lt h3 + exact ⟨div_nonneg hi0 hpi.le, (div_lt_one hpi).mpr hi3⟩ + have hee : ∀ i, ee (β i) = Circle.exp (t i) := by + intro i + unfold ee β + rw [mul_div_cancel₀ _ hpi.ne'] + refine ⟨φ, β, hβ, hβrange, ?_, ?_, ?_, ?_⟩ + · simpa only [hee, t, Matrix.cons_val_zero] using ha + · simpa [hee, t] using hb + · simpa [hee, t] using hc + · simpa [hee, t] using hd + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4EyeBranchControl.lean b/LeanPool/GraphMinor/GM12/Section4EyeBranchControl.lean new file mode 100644 index 0000000000..3b6831cf61 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4EyeBranchControl.lean @@ -0,0 +1,123 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM12.Section4EndPartition +import LeanPool.GraphMinor.GM12.Section4SpanControl +import LeanPool.GraphMinor.GM12.Section4ExternalPathBranches +import LeanPool.GraphMinor.GM12.Section4SpanBranchBound +import LeanPool.GraphMinor.GM12.Section4EyeRegionDistance + +/-! +# Controlling the branches joined through the eyes + +XII (4.5), page 253, joins the connected endpoint classes by +the external paths, retaining one edge of each path. Every +class has endpoints incident with two distinct eye regions. +Their region distance gives distant vertices in the connected +class, and (4.1) bounds any separation containing the enlarged +branch. Thus the retained edges and enlarged branches form a +controlled minor. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Hypergraph GM14 GM15 + +/-- The branch construction and separation estimate at the end +of XII (4.5), page 253, for a connected endpoint partition and +its disjoint external paths. -/ +theorem controlsMinor_of_eye_connections + {S α β W E : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + [Fintype W] [Finite E] (hS : IsClosedSurface S) + {G : Graph α β} {Γ : Drawing S} (η : SpanEmbedding Γ G) + {θstar θ t : ℕ} + {Tstar : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + (hCtrl : IsControllingTangle G Γ η θstar θ Tstar T) (hEΓ : Γ.E.Nonempty) + (L : Graph W E) (κ : E × Bool → W) (σ : Fin t × Bool ≃ E) + (hlink : ∀ e, L.IsLink e (κ (e, false)) (κ (e, true))) + (hκne : ∀ e, κ (e, false) ≠ κ (e, true)) + (htwo : ∀ w, ∃ i j, i ≠ j ∧ ∃ b c d e : Bool, + κ (σ (i, b), c) = w ∧ κ (σ (j, d), e) = w) + (r : Fin t → Set S) (hr : ∀ i, r i ∈ Γ.R) + (hfar : ∀ i j, i ≠ j → 2 * Fintype.card W + 2 ≤ d (r i) (r j)) + (hθ : Fintype.card W ≤ θ) + (ends : E × Bool → S) (hends : ∀ q, ends q ∈ Γ.V) + (hinc : ∀ i b c, ends (σ (i, b), c) ∈ closure (r i)) + (H : W → Drawing S) (hH : ∀ w, (H w).IsSubdrawing Γ) + (hHc : ∀ w, IsConnectedDrawing (H w)) + (hHH : Pairwise (fun v w => Disjoint (H v).V (H w).V)) + (hclass : ∀ w, (H w).V ∩ range ends = edgeEndClass ends κ w) + (P : E → Graph α β) + (hP : ∀ e, IsHPathWithEnds G η.imageGraph (P e) + (η.vMap (ends (e, false))) (η.vMap (ends (e, true)))) + (hPP : Pairwise (fun e f => Disjoint (P e).vertexSet (P f).vertexSet)) : + ControlsMinor (Hypergraph.ofGraph G hCtrl.isTangle_star.finite_V + hCtrl.isTangle_star.finite_E) θstar Tstar L := by + let _ := Fintype.ofFinite E + have hpoint : ∀ q, ends q ∈ (H (κ q)).V := by + intro q + have hx : ends q ∈ edgeEndClass ends κ (κ q) := ⟨q, rfl, rfl⟩ + exact ((hclass (κ q)).symm.subset hx).1 + have hHne : ∀ w, (H w).V.Nonempty := by + intro w + obtain ⟨i, j, hij, b, c, d, e, hi, hj⟩ := htwo w + exact ⟨ends (σ (i, b), c), hi ▸ hpoint _⟩ + have hTG := hCtrl.isTangle_star + obtain ⟨A, hA, hAA, hAV⟩ := exists_embedded_connecting_branches hTG.finite_V hTG.finite_E + η H hH hHne hHc (fun v w hvw => hHH hvw) + have hAF : ∀ w, (A w).vertexSet ⊆ η.imageGraph.vertexSet := by + intro w x hx + obtain ⟨y, hy, rfl⟩ := (hAV w).subset hx + exact η.bijOn_v.mapsTo ((hH w).1 hy) + have heA : ∀ q, η.vMap (ends q) ∈ (A (κ q)).vertexSet := by + intro q + rw [hAV] + exact mem_image_of_mem η.vMap (hpoint q) + obtain ⟨C, b, hC, hCC, hAC, hbinj, hjoin⟩ := exists_branches_from_external_paths + hTG.finite_V hTG.finite_E A hA hAA hAF P + (fun e => η.vMap (ends (e, false))) (fun e => η.vMap (ends (e, true))) + (fun e => κ (e, false)) (fun e => κ (e, true)) hP + (fun e f hef => hPP hef) (fun e => heA (e, false)) (fun e => heA (e, true)) + have hcard : L.vertexSet.ncard ≤ Fintype.card W := by + simpa only [Nat.card_eq_fintype_card] using ncard_le_card L.vertexSet + refine ⟨C, b, fun w _ => hC w, fun v _ w _ hvw => hCC v w hvw, ?_, ?_, + fun e _ f _ hef heq => hef (hbinj heq), hcard.trans (hθ.trans hCtrl.theta_le), ?_⟩ + · intro e u v hl huv + obtain ⟨heG, x, hx, y, hy, hxy⟩ := hjoin e + rcases (hlink e).eq_and_eq_or_eq_and_eq hl with ⟨hu, hv⟩ | ⟨hv, hu⟩ + · rw [hu] at hx + rw [hv] at hy + exact ⟨heG, ⟨x, hx, hxy.inc_left⟩, y, hy, hxy.inc_right⟩ + · rw [hv] at hx + rw [hu] at hy + exact ⟨heG, ⟨y, hy, hxy.inc_right⟩, x, hx, hxy.inc_left⟩ + · intro e w hl + have h := (hlink e).eq_and_eq_or_eq_and_eq hl + rcases h with ⟨h0, h1⟩ | ⟨h0, h1⟩ <;> + exact False.elim (hκne e (h0.trans h1.symm)) + · intro A' B' hAB hord w hw + obtain ⟨i, j, hij, c, e, f, g, hi, hj⟩ := htwo w + have hiH : ends (σ (i, c), e) ∈ (H w).V := hi ▸ hpoint _ + have hjH : ends (σ (j, f), g) ∈ (H w).V := hj ▸ hpoint _ + have hdist := incident_vertices_distant_of_regions_distant hS hm hEΓ + (hends (σ (i, c), e)) (hends (σ (j, f), g)) (hr i) (hr j) + (hinc i c e) (hinc j f g) (hfar i j hij) + exact not_subset_small_side_of_embedded_distant_drawing hS η hm hCtrl hθ + (hHc w) (hH w) hiH hjH hdist + (fun x hx => (hAC w).vertexSet_subset ((hAV w).symm.subset hx)) hAB + (hord.trans_le hcard) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4EyeConnections.lean b/LeanPool/GraphMinor/GM12/Section4EyeConnections.lean new file mode 100644 index 0000000000..412e1e3164 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4EyeConnections.lean @@ -0,0 +1,156 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Cited +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM12.Section4EndPartition +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM12.Section4CrossingFeasibilityUniverses +import LeanPool.GraphMinor.GM12.Section4OrderedEyeContactFamily +import LeanPool.GraphMinor.GM12.Section4FourContactBoundary +import LeanPool.GraphMinor.GM12.Section4DiscConnections +import LeanPool.GraphMinor.GM12.Section4CrossingEndClasses +import LeanPool.GraphMinor.GM12.Section2NonemptyEdges + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# The endpoint connections for XII (4.5) + +Choose the source subdivision and the threshold in (3.2), +with four marks per crossing. For the prescribed eye regions, +construct the ordered contact discs, apply claim (1), and then +apply (3.2) to its endpoint classes. All source geometry and +feasibility are proved before this application. The resulting +connected subdrawings contain the assigned ends of the two +external paths at each eye. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Graph GM14 + +universe u + +/-- The endpoint-connection construction following claim (1) in +XII (4.5), page 253. Its only statement hypotheses are the cited +VII (7.5), (5.1), and (5.5). -/ +theorem exists_eye_connections + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {p : ℕ} (hp : 4 ≤ p) : + ∃ (W E : Type) (L : Graph W E) (κ : E × Bool → W) (t : ℕ) + (σ : Fin t × Bool ≃ E) (N : ℕ), + Finite W ∧ Finite E ∧ IsIsoMinor (GM16.completeGraph p) L ∧ + (∀ e, L.IsLink e (κ (e, false)) (κ (e, true))) ∧ + (∀ e, κ (e, false) ≠ κ (e, true)) ∧ 2 ≤ t ∧ 2 * Nat.card W + 3 ≤ N ∧ + (∀ w, ∃ i j, i ≠ j ∧ ∃ b c d e : Bool, + κ (σ (i, b), c) = w ∧ κ (σ (j, d), e) = w) ∧ + ∀ (Γ : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (δ : Set S → Set S → ℕ) (r : Fin t → Set S) (C : Fin t → Drawing S) + (a b c d : Fin t → S), + Γ.IsTwoCell → HasTangleMetric Γ θ T δ → N ≤ θ → + (∀ i, r i ∈ Γ.R) → Function.Injective r → + (∀ i j, i ≠ j → N ≤ δ (r i) (r j)) → + (∀ i, (C i).IsCircuit) → (∀ i, (C i).IsSubdrawing Γ) → + (∀ i, (C i).U = subBd (r i)) → + (∀ i, a i ∈ (C i).V ∧ b i ∈ (C i).V ∧ c i ∈ (C i).V ∧ d i ∈ (C i).V) → + (∀ i, OccurInCircuitOrder (C i) (a i) (b i) (c i) (d i)) → + (∀ i, GM10.IsFreeSet Γ.toHypergraph T θ {a i, b i, c i, d i}) → + ∃ (ends : E × Bool → S) (H : W → Drawing S), + Function.Injective ends ∧ (∀ q, ends q ∈ Γ.V) ∧ + (∀ i b c, ends (σ (i, b), c) ∈ closure (r i)) ∧ + (∀ w, (H w).IsSubdrawing Γ) ∧ (∀ w, IsConnectedDrawing (H w)) ∧ + Pairwise (fun v w => Disjoint (H v).V (H w).V) ∧ + (∀ w, (H w).V ∩ range ends = edgeEndClass ends κ w) ∧ + (∀ i, ({ends (σ (i, false), false), ends (σ (i, false), true)} : Set S) = {a i, c i}) ∧ + (∀ i, ({ends (σ (i, true), false), ends (σ (i, true), true)} : Set S) = {b i, d i}) := by + classical + obtain ⟨W, E, L, κ, t, σ, hW, hE, hminor, hLV, hLE, hlink, hκne, ht, htwo, hsource⟩ := + theorem_4_5_claim_1_ordered_univ hS hp + let : Finite W := hW + let : Fintype W := Fintype.ofFinite W + obtain ⟨η, hη, hconnect⟩ := exists_threshold_for_disc_connections hS t (4 * t) + let N := max η (2 * Nat.card W + 3) + have hNW : 2 * Nat.card W + 3 ≤ N := le_max_right _ _ + refine ⟨W, E, L, κ, t, σ, N, hW, hE, hminor, hlink, hκne, ht, hNW, htwo, ?_⟩ + intro Γ θ T δ r C a b c d hcell hm hθ hr hri hfar hC hCG hCr hmarks horder hfree + have hN3 : 3 ≤ N := by omega + have hEΓ : Γ.E.Nonempty := edges_nonempty_of_tangle_order_two hm.1.2.1 (by omega) + obtain ⟨D, q, β, hD, hDD, hDN, hq, hβ, hβ01, hqmarks⟩ := + exists_ordered_eye_contact_family hS hcell hm hEΓ ht r C a b c d hr hri + (fun i j hij => hN3.trans (hfar i j hij)) hC hCG hCr hmarks horder + obtain ⟨ends, B, hinj, hB, hBB, hcontact, hp0, hp1⟩ := hsource D q β hD hDD hq hβ hβ01 + have hp0' : ∀ i, ({ends (σ (i, false), false), ends (σ (i, false), true)} : Set S) = {a i, c i} + := by + intro i + rw [hp0 i, (hqmarks i).1, (hqmarks i).2.2.1] + have hp1' : ∀ i, ({ends (σ (i, true), false), ends (σ (i, true), true)} : Set S) = {b i, d i} + := by + intro i + rw [hp1 i, (hqmarks i).2.1, (hqmarks i).2.2.2] + let M : Fin t → Set S := fun i => {a i, b i, c i, d i} + have hMV : ∀ i, M i ⊆ Γ.V := by + intro i x hx + rcases hx with rfl | rfl | rfl | hx + · exact (hCG i).1 (hmarks i).1 + · exact (hCG i).1 (hmarks i).2.1 + · exact (hCG i).1 (hmarks i).2.2.1 + · exact (mem_singleton_iff.mp hx) ▸ (hCG i).1 (hmarks i).2.2.2 + have hnorm := fun i => normal_disc_of_exact_boundary_contacts (hDN i).2.1 (hMV i) (hDN i).2.2 + have hbd : ∀ i, Γ.V ∩ discBd (D i) = M i := fun i => (hnorm i).2 + have hrange : range ends = ⋃ i, M i := by + have hh := range_ends_eq_crossing_marks σ ends (fun i => ![a i, b i, c i, d i]) hp0' hp1' + have hvec : ∀ i, range ![a i, b i, c i, d i] = M i := by + intro i + ext x + simp [M, or_comm, or_left_comm] + simpa only [hvec] using hh + have hZ : discBoundaryVertices Γ D = range ends := by + simp only [discBoundaryVertices, hbd, hrange] + have hendM : ∀ i b c, ends (σ (i, b), c) ∈ M i := by + intro i b' c' + have hh : ends (σ (i, b'), c') ∈ + ({ends (σ (i, b'), false), ends (σ (i, b'), true)} : Set S) := by cases c' <;> simp + cases b' + · rw [hp0' i] at hh + rcases hh with hh | hh + · rw [hh]; simp [M] + · rw [mem_singleton_iff.mp hh]; simp [M] + · rw [hp1' i] at hh + rcases hh with hh | hh + · rw [hh]; simp [M] + · rw [mem_singleton_iff.mp hh]; simp [M] + have hends : ∀ z, ends z ∈ Γ.V := by + rintro ⟨e, c'⟩ + obtain ⟨⟨i, b'⟩, rfl⟩ := σ.surjective e + exact hMV i (hendM i b' c') + have hinc : ∀ i b c, ends (σ (i, b), c) ∈ closure (r i) := by + intro i b' c' + have hmD := (hDN i).2.2 (hendM i b' c') + exact (hDN i).1 (discBd_subset _ hmD) + obtain ⟨H, hHs, hHc, hHH, hHZ⟩ := hconnect Γ θ T δ D r (edgeEndClass ends κ) + (fun i => ⟨hD i, (hnorm i).1⟩) hDD + (discBoundaryVertices_ncard_le_four D a b c d hbd) + ((iUnion_edgeEndClass ends κ).trans hZ.symm) + (fun v w hvw => disjoint_edgeEndClass ends κ hinj hvw) + ⟨B, hB, hBB, hcontact⟩ ((le_max_left _ _).trans hθ) hm + (fun i => ⟨hr i, (hDN i).1⟩) + (fun i j hij => (le_max_left _ _).trans (hfar i j hij)) + (fun i => hbd i ▸ hfree i) + refine ⟨ends, H, hinj, hends, hinc, hHs, hHc, hHH, ?_, hp0', hp1'⟩ + intro w + simpa only [hZ] using hHZ w + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4EyeContactFamily.lean b/LeanPool/GraphMinor/GM12/Section4EyeContactFamily.lean new file mode 100644 index 0000000000..22f554ad14 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4EyeContactFamily.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM12.Section4RegionContactFamily +import LeanPool.GraphMinor.GM12.Section4EyeRegionDistance +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Contact discs at distant eye regions + +For XII (4.5), page 253, distant regions have disjoint vertex +contact sets. The regions themselves are disjoint components +of the complement of the drawing. Applying the simultaneous +contact construction gives the discs required by claim (1), +retaining each given circle parametrization at every mark. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM14 + +/-- The target disc family for XII (4.5), page 253, obtained +from the two-cell drawing and region-distance assumptions. -/ +theorem exists_eye_contact_family + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} (hcell : Γ.IsTwoCell) + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) (hE : Γ.E.Nonempty) + {ι : Type*} [Nontrivial ι] (r N : ι → Set S) + (hr : ∀ i, r i ∈ Γ.R) (hri : Function.Injective r) + (hfar : ∀ i j, i ≠ j → 3 ≤ d (r i) (r j)) + (hC : ∀ i, IsOArc (frontier (r i))) + (hNV : ∀ i, N i ⊆ Γ.V) (hNb : ∀ i, N i ⊆ frontier (r i)) + (hfin : ∀ i, (N i).Finite) (hne : ∀ i, (N i).Nonempty) + (φ : ∀ i, Circle ≃ₜ frontier (r i)) : + ∃ (D : ι → Set S) (q : ι → Circle → S), + (∀ i, IsClosedDisc (D i)) ∧ + Pairwise (fun i j => Disjoint (D i) (D j)) ∧ + (∀ i, D i ⊆ closure (r i) ∧ D i ∩ Γ.U = N i ∧ N i ⊆ discBd (D i)) ∧ + (∀ i, Continuous (q i) ∧ Function.Injective (q i) ∧ range (q i) = discBd (D i)) ∧ + ∀ i w, (φ i w).val ∈ N i → q i w = (φ i w).val := by + let : LocallyConnectedSpace S := GM11.IsClosedSurface.locallyConnectedSpace hS + have hrr : Pairwise (fun i j => Disjoint (r i) (r j)) := by + intro i j hij + apply disjoint_left.mpr + intro x hxi hxj + exact hij (hri (GM11.region_eq_of_mem (hr i) (hr j) hxi hxj)) + have hrZ : ∀ i, Disjoint (r i) Γ.U := fun i => + disjoint_left.mpr (fun x hx hxu => GM11.region_subset (hr i) hx hxu) + have hbdZ : ∀ i, frontier (r i) ⊆ Γ.U := by + intro i x hx + rcases GM11.closure_region_subset (hr i) hx.1 with hxr | hxU + · exact False.elim (hx.2 ((hcell.2 _ (hr i)).1.interior_eq.symm ▸ hxr)) + · exact hxU + have hNN : Pairwise (fun i j => Disjoint (N i) (N j)) := by + intro i j hij + have hi : N i ⊆ Γ.V ∩ closure (r i) := + fun x hx => ⟨hNV i hx, frontier_subset_closure (hNb i hx)⟩ + have hj : N j ⊆ Γ.V ∩ closure (r j) := + fun x hx => ⟨hNV j hx, frontier_subset_closure (hNb j hx)⟩ + exact (vertex_closures_disjoint_of_regions_distant hS hm hE (hr i) (hr j) + (hfar i j hij)).mono hi hj + exact exists_region_contact_family hS r N Γ.U (fun i => hcell.2 _ (hr i)) hrr + hC hrZ hbdZ (fun i => (hNV i).trans Γ.V_subset_U) hNb hfin hne hNN φ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4EyePathReindex.lean b/LeanPool/GraphMinor/GM12/Section4EyePathReindex.lean new file mode 100644 index 0000000000..edbc0ffb67 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4EyePathReindex.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Reindexing the paths through the eyes + +XII (4.5), page 253, renumbers the external paths by the +crossing edges of the source graph. The endpoint partition +matches their unordered opposite pairs. Reverse a path when +its order differs from the assigned endpoint order. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set GM14 + +/-- Reverse an external path while retaining its avoidance and +endpoint conditions. -/ +theorem isHPathWithEnds_reverse {α β : Type*} {G H P : Graph α β} {a b : α} + (h : IsHPathWithEnds G H P a b) : IsHPathWithEnds G H P b a := by + refine ⟨h.1, h.2.1.symm, h.2.2.1.symm, h.2.2.2.2.1, + h.2.2.2.1, ?_, h.2.2.2.2.2.2⟩ + exact h.2.2.2.2.2.1.trans (pair_comm a b) + +/-- Unordered equality of endpoint pairs suffices for choosing +the orientation of an external path. -/ +theorem isHPathWithEnds_of_endpoint_pair_eq + {S α β : Type*} {G H P : Graph α β} (f : S → α) {a b x y : S} + (hP : IsHPathWithEnds G H P (f a) (f b)) + (hpair : ({x, y} : Set S) = {a, b}) : + IsHPathWithEnds G H P (f x) (f y) := by + rcases pair_eq_pair_iff.mp hpair with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hP + · exact isHPathWithEnds_reverse hP + +/-- Renumber disjoint external paths by their source-edge +bijection, orienting each to its assigned endpoints. This is +the renumbering step of XII (4.5), page 253. -/ +theorem exists_external_paths_reindexed + {S α β E I : Type*} {G H : Graph α β} (f : S → α) + (σ : I ≃ E) (ends : E × Bool → S) (a b : I → S) + (P : I → Graph α β) + (hP : ∀ i, IsHPathWithEnds G H (P i) (f (a i)) (f (b i))) + (hPP : Pairwise (fun i j => Disjoint (P i).vertexSet (P j).vertexSet)) + (hpairs : ∀ i, ({ends (σ i, false), ends (σ i, true)} : Set S) = {a i, b i}) : + ∃ R : E → Graph α β, + (∀ e, IsHPathWithEnds G H (R e) (f (ends (e, false))) (f (ends (e, true)))) ∧ + Pairwise (fun e g => Disjoint (R e).vertexSet (R g).vertexSet) := by + refine ⟨fun e => P (σ.symm e), ?_, ?_⟩ + · intro e + have hpair := hpairs (σ.symm e) + rw [σ.apply_symm_apply] at hpair + exact isHPathWithEnds_of_endpoint_pair_eq f (hP (σ.symm e)) hpair + · intro e g heg + exact hPP (fun h => heg (σ.symm.injective h)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4EyeRegionDistance.lean b/LeanPool/GraphMinor/GM12/Section4EyeRegionDistance.lean new file mode 100644 index 0000000000..eb31c4fa5b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4EyeRegionDistance.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM11.CitedResults + +/-! +# Distances at the eye-region boundary + +XII (4.5), page 253, loses at most two units when replacing +regions by incident vertices. The same metric estimate shows +that regions at distance at least three have no common vertex +in their closures. These facts supply disjoint contact sets +and the final branch-size estimate. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM14 + +/-- The vertex-distance estimate used in XII (4.5), page 253. -/ +theorem incident_vertices_distant_of_regions_distant + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) (hE : Γ.E.Nonempty) + {u v : S} (hu : u ∈ Γ.V) (hv : v ∈ Γ.V) + {r s : Set S} (hr : r ∈ Γ.R) (hs : s ∈ Γ.R) + (hur : u ∈ closure r) (hvs : v ∈ closure s) + {k : ℕ} (hfar : k + 2 ≤ d r s) : k ≤ d {u} {v} := by + have h91 := GM11.gm15_theorem_9_1 Γ θ T d hS inferInstance hm + have hsym := h91.2.2.2.1 + have htri := h91.2.2.2.2.1 + have hvr := h91.2.2.2.2.2.1 hE u hu r hr hur + have hvs' := h91.2.2.2.2.2.1 hE v hv s hs hvs + have huA : ({u} : Set S) ∈ Γ.A := Or.inl (Or.inl ⟨u, hu, rfl⟩) + have hvA : ({v} : Set S) ∈ Γ.A := Or.inl (Or.inl ⟨v, hv, rfl⟩) + have hrA : r ∈ Γ.A := Or.inr hr + have hsA : s ∈ Γ.A := Or.inr hs + have ht₁ := htri r hrA {u} huA s hsA + have ht₂ := htri {u} huA {v} hvA s hsA + rw [hsym r hrA {u} huA] at ht₁ + omega + +/-- Distant eye regions cannot share a drawing vertex on their +boundaries. This makes their prescribed contact sets disjoint. -/ +theorem vertex_closures_disjoint_of_regions_distant + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) (hE : Γ.E.Nonempty) + {r s : Set S} (hr : r ∈ Γ.R) (hs : s ∈ Γ.R) + (hfar : 3 ≤ d r s) : Disjoint (Γ.V ∩ closure r) (Γ.V ∩ closure s) := by + apply disjoint_left.mpr + intro u hur hus + have hd := incident_vertices_distant_of_regions_distant hS hm hE hur.1 hus.1 + hr hs hur.2 hus.2 (k := 1) hfar + have h91 := GM11.gm15_theorem_9_1 Γ θ T d hS inferInstance hm + rw [h91.2.1 {u} (Or.inl (Or.inl ⟨u, hur.1, rfl⟩))] at hd + exact Nat.not_succ_le_zero 0 hd + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4FamilyCuts.lean b/LeanPool/GraphMinor/GM12/Section4FamilyCuts.lean new file mode 100644 index 0000000000..b707888086 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4FamilyCuts.lean @@ -0,0 +1,123 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4FamilySubdivision +public import LeanPool.GraphMinor.GM12.Section4SubdivisionPositions +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# The cuts of different source edges + +In XII (4.5), page 252, the new vertices lie on their original +edges and avoid all crossings. An internal cut cannot be an old +vertex: an old edge contains only its own two old endpoints, and +the cut map is injective. These facts justify the injective global +vertex map of the subdivision. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- All cuts lie on the original edge, since consecutive pieces +cover that edge and have the cuts as ends. -/ +theorem family_cut_mem_original_edge {n : ℕ} (E : Fin n → Set ℂ) + (k : Fin n → ℕ) (hk : ∀ e, 0 < k e) + (w : ∀ e, Fin (k e + 1) → ℂ) (P : ∀ e, Fin (k e) → Set ℂ) + (hline : ∀ e i, IsLineWithEnds (P e i) (w e i.castSucc) (w e i.succ)) + (hcover : ∀ e, (⋃ i, P e i) = E e) (e : Fin n) (r : Fin (k e + 1)) : + w e r ∈ E e := by + have hsub : ∀ i, P e i ⊆ E e := by + intro i x hx + rw [← hcover e] + exact mem_iUnion.mpr ⟨i, hx⟩ + by_cases hr : r.val < k e + · let i : Fin (k e) := ⟨r.val, hr⟩ + have heq : i.castSucc = r := Fin.ext rfl + have hmem := (hline e i).left_mem + rw [heq] at hmem + exact hsub i hmem + · let i : Fin (k e) := ⟨k e - 1, by have := hk e; omega⟩ + have heq : i.succ = r := by + apply Fin.ext + change k e - 1 + 1 = r.val + have := hk e + have := r.isLt + omega + have hmem := (hline e i).right_mem + rw [heq] at hmem + exact hsub i hmem + +/-- An internal cut is not an original vertex. This uses the +original edges' exact vertex incidence and injectivity of their cut +maps, as in the subdivision of XII (4.5), page 252. -/ +theorem internal_family_cut_not_mem_vertices {m n : ℕ} + (V : Fin m → ℂ) (κ : Fin n × Bool → Fin m) (E : Fin n → Set ℂ) + (k : Fin n → ℕ) (w : ∀ e, Fin (k e + 1) → ℂ) + (hwinj : ∀ e, Function.Injective (w e)) + (hw0 : ∀ e, w e 0 = V (κ (e, false))) + (hwlast : ∀ e, w e (Fin.last (k e)) = V (κ (e, true))) + (hmem : ∀ e i, w e i ∈ E e) + (hvertex : ∀ e v, V v ∈ E e ↔ v = κ (e, false) ∨ v = κ (e, true)) + (e : Fin n) (j : Fin (k e - 1)) : + w e ⟨j.val + 1, by have := j.isLt; omega⟩ ∉ range V := by + let r : Fin (k e + 1) := ⟨j.val + 1, by have := j.isLt; omega⟩ + rintro ⟨v, hv⟩ + have hvE : V v ∈ E e := hv ▸ hmem e r + rcases (hvertex e v).mp hvE with hleft | hright + · have heq : w e r = w e 0 := hv.symm.trans ((congrArg V hleft).trans (hw0 e).symm) + have hval := congrArg Fin.val (hwinj e heq) + change j.val + 1 = 0 at hval + omega + · have heq : w e r = w e (Fin.last (k e)) := + hv.symm.trans ((congrArg V hright).trans (hwlast e).symm) + have hval := congrArg Fin.val (hwinj e heq) + change j.val + 1 = k e at hval + have := j.isLt + omega + +/-- The global subdivision vertices lying on an original edge +are exactly the cuts of that edge. Internal cuts of other edges +cannot occur there, because they would be old meetings. -/ +theorem original_edge_inter_subdivisionPositions {m n : ℕ} + (V : Fin m → ℂ) (κ : Fin n × Bool → Fin m) (E : Fin n → Set ℂ) + (k : Fin n → ℕ) (hk : ∀ e, 0 < k e) (w : ∀ e, Fin (k e + 1) → ℂ) + (hw0 : ∀ e, w e 0 = V (κ (e, false))) + (hwlast : ∀ e, w e (Fin.last (k e)) = V (κ (e, true))) + (hmem : ∀ e i, w e i ∈ E e) + (havoid : ∀ e i, w e i ∉ E e ∩ edgeMeetingPoints V E) + (hvertex : ∀ e v, V v ∈ E e ↔ v = κ (e, false) ∨ v = κ (e, true)) + (hinterior : ∀ e (j : Fin (k e - 1)), + w e ⟨j.val + 1, by have := j.isLt; omega⟩ ∉ range V) (e : Fin n) : + E e ∩ range (subdivisionPosition V k w) = range (w e) := by + ext x + constructor + · rintro ⟨hxE, z, rfl⟩ + cases z with + | inl v => + rcases (hvertex e v).mp hxE with hleft | hright + · exact ⟨0, (hw0 e).trans (congrArg V hleft).symm⟩ + · exact ⟨Fin.last (k e), (hwlast e).trans (congrArg V hright).symm⟩ + | inr q => + obtain ⟨f, j⟩ := q + let r : Fin (k f + 1) := ⟨j.val + 1, by have := j.isLt; omega⟩ + by_cases hfe : f = e + · subst f + exact ⟨r, rfl⟩ + · have hmeeting : w f r ∈ edgeMeetingPoints V E := + ⟨f, e, hfe, ⟨hmem f r, hxE⟩, hinterior f j⟩ + exact False.elim (havoid f r ⟨hmem f r, hmeeting⟩) + · rintro ⟨r, rfl⟩ + exact ⟨hmem e r, subdivisionVertexAt κ k e r, + subdivisionPosition_vertexAt V κ k hk w hw0 hwlast e r⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4FamilySubdivision.lean b/LeanPool/GraphMinor/GM12/Section4FamilySubdivision.lean new file mode 100644 index 0000000000..6dd91ec7ff --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4FamilySubdivision.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4OneMeetingSubdivision +public import LeanPool.GraphMinor.GM12.Section4CrossingCount +public import Mathlib.Data.Fintype.Sigma + +/-! +# Subdividing the full source edge family + +For XII (4.5), pages 252--253, take on each original edge its +finite nonempty set of meetings away from vertices. Apply the +one-meeting subdivision to each edge. The sum of the new edge +counts is twice the meeting count, because each meeting lies on +exactly two original edges. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface +open scoped BigOperators + +/-- Subdivide every source edge into simple pieces with one +meeting each, retaining all local cut incidences and the exact +edge count. This is the full family subdivision step in XII (4.5), +pages 252--253, before identifying shared original endpoints. -/ +theorem exists_family_one_meeting_subdivision {m n : ℕ} + (V : Fin m → ℂ) (κ : Fin n × Bool → Fin m) (E : Fin n → Set ℂ) + (hline : ∀ e, IsLineWithEnds (E e) (V (κ (e, false))) (V (κ (e, true)))) + (hfinite : ∀ i j, i ≠ j → (E i ∩ E j).Finite) + (htriple : ∀ i j k, i ≠ j → j ≠ k → i ≠ k → E i ∩ E j ∩ E k ⊆ range V) + (hcross : ∀ i, ∃ j, j ≠ i ∧ ∃ x : ℂ, x ∈ E i ∩ E j ∧ x ∉ range V) : + ∃ k : Fin n → ℕ, (∀ e, 0 < k e) ∧ + ∃ (w : ∀ e, Fin (k e + 1) → ℂ) (P : ∀ e, Fin (k e) → Set ℂ), + (∀ e, Function.Injective (w e)) ∧ + (∀ e, w e 0 = V (κ (e, false))) ∧ + (∀ e, w e (Fin.last (k e)) = V (κ (e, true))) ∧ + (∀ e i, IsLineWithEnds (P e i) (w e i.castSucc) (w e i.succ)) ∧ + (∀ e, (⋃ i, P e i) = E e) ∧ + (∀ e i, ∃ x ∈ E e ∩ edgeMeetingPoints V E, P e i ∩ (E e ∩ edgeMeetingPoints V E) = {x}) ∧ + (∀ e i, w e i ∉ E e ∩ edgeMeetingPoints V E) ∧ + (∀ e i j, i ≠ j → P e i ∩ P e j ⊆ range (w e)) ∧ + (∀ e i, P e i ∩ range (w e) = {w e i.castSucc, w e i.succ}) ∧ + (∀ e, (E e ∩ edgeMeetingPoints V E).ncard = k e) ∧ + Fintype.card (Σ e : Fin n, Fin (k e)) = 2 * (edgeMeetingPoints V E).ncard := by + classical + have hM := finite_edgeMeetingPoints V E hfinite + have hnot : ∀ v, V v ∉ edgeMeetingPoints V E := by + rintro v ⟨i, j, hij, hx, hxV⟩ + exact hxV ⟨v, rfl⟩ + have hper : ∀ e, ∃ k : ℕ, 0 < k ∧ ∃ (w : Fin (k + 1) → ℂ) (P : Fin k → Set ℂ), + Function.Injective w ∧ w 0 = V (κ (e, false)) ∧ w (Fin.last k) = V (κ (e, true)) ∧ + (∀ i, IsLineWithEnds (P i) (w i.castSucc) (w i.succ)) ∧ + (⋃ i, P i) = E e ∧ + (∀ i, ∃ x ∈ E e ∩ edgeMeetingPoints V E, P i ∩ (E e ∩ edgeMeetingPoints V E) = {x}) ∧ + (∀ i, w i ∉ E e ∩ edgeMeetingPoints V E) ∧ + (∀ i j, i ≠ j → P i ∩ P j ⊆ range w) ∧ + (∀ i, P i ∩ range w = {w i.castSucc, w i.succ}) ∧ + (E e ∩ edgeMeetingPoints V E).ncard = k := by + intro e + have hne : (E e ∩ edgeMeetingPoints V E).Nonempty := by + obtain ⟨j, hje, x, hx, hxV⟩ := hcross e + exact ⟨x, hx.1, e, j, hje.symm, hx, hxV⟩ + exact exists_one_meeting_arc_subdivision (hline e) (Set.Finite.subset hM inter_subset_right) hne + inter_subset_left (fun h => hnot _ h.2) (fun h => hnot _ h.2) + choose k hk w P hwinj hw0 hwlast hPline hPcover hPmeeting hwavoid hPinter hPvertices hcount using + hper + refine ⟨k, hk, w, P, hwinj, hw0, hwlast, hPline, hPcover, hPmeeting, hwavoid, + hPinter, hPvertices, hcount, ?_⟩ + calc + Fintype.card (Σ e : Fin n, Fin (k e)) = ∑ e, k e := by + rw [Fintype.card_sigma] + simp only [Fintype.card_fin] + _ = ∑ e, (E e ∩ edgeMeetingPoints V E).ncard := + Finset.sum_congr rfl fun e _ => (hcount e).symm + _ = 2 * (edgeMeetingPoints V E).ncard := sum_edge_meeting_counts V E hfinite htriple + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4FeasibilityTransport.lean b/LeanPool/GraphMinor/GM12/Section4FeasibilityTransport.lean new file mode 100644 index 0000000000..d3bda218e1 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4FeasibilityTransport.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import Mathlib.Topology.Homeomorph.Lemmas +import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! +# Carrying feasible discs by a homeomorphism + +In XII (4.3), claim (7), page 251, the vertex discs of a +drawing of the target graph are carried to the selected ends by +a homeomorphism of the surface. Homeomorphisms preserve the +discs, their disjointness, and their exact intersections with the +prescribed disc family. This file gives the transport calculation. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The transport calculation in XII (4.3), claim (7), page 251. +A homeomorphism carries feasible connecting discs to feasible +connecting discs, with the corresponding prescribed contacts. -/ +theorem IsTopologicallyFeasible.image + {S U : Type*} [TopologicalSpace S] [TopologicalSpace U] + {t p : ℕ} {Δ : Fin t → Set S} {Zs : Fin p → Set S} + (hf : IsTopologicallyFeasible Δ Zs) (e : S ≃ₜ U) : + IsTopologicallyFeasible (fun i => e '' Δ i) (fun v => e '' Zs v) := by + obtain ⟨D, hD, hdisj, hcontact⟩ := hf + refine ⟨fun v => e '' D v, ?_, ?_, ?_⟩ + · intro v + exact ((hD v).image e.continuous.continuousOn e.symm.continuous.continuousOn + (fun _ _ => e.symm_apply_apply _)).1 + · intro v w hvw + apply Set.disjoint_left.mpr + rintro x ⟨y, hy, hyx⟩ ⟨z, hz, hzx⟩ + have hyz : y = z := e.injective (hyx.trans hzx.symm) + exact Set.disjoint_left.mp (hdisj v w hvw) hy (hyz.symm ▸ hz) + · intro v + rw [← image_iUnion, ← Set.image_inter e.injective, hcontact v] + +/-- Specifying the images of the prescribed discs and contact +classes gives the target feasibility condition in XII (4.3). -/ +theorem topologicallyFeasible_of_homeomorph + {S U : Type*} [TopologicalSpace S] [TopologicalSpace U] + {t p : ℕ} {Δ : Fin t → Set S} {Zs : Fin p → Set S} + {Δ' : Fin t → Set U} {Zs' : Fin p → Set U} + (hf : IsTopologicallyFeasible Δ Zs) (e : S ≃ₜ U) + (hΔ : ∀ i, e '' Δ i = Δ' i) (hZ : ∀ v, e '' Zs v = Zs' v) : + IsTopologicallyFeasible Δ' Zs' := by + have he := hf.image e + have hΔ' : (fun i => e '' Δ i) = Δ' := funext hΔ + have hZ' : (fun v => e '' Zs v) = Zs' := funext hZ + rwa [hΔ', hZ'] at he + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4FeasibleControl.lean b/LeanPool/GraphMinor/GM12/Section4FeasibleControl.lean new file mode 100644 index 0000000000..f9f7bab520 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4FeasibleControl.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4EndPartition +public import LeanPool.GraphMinor.GM12.Cited +import LeanPool.GraphMinor.GM12.Section4PartitionControl +import LeanPool.GraphMinor.GM12.Section3Theorem +import LeanPool.GraphMinor.GM12.Section3DiscRegion + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Applying the connection theorem in XII (4.3) + +After claim (7), XII (4.3), page 251, applies (3.2) to the +free-edge discs and their oriented end classes. The boundary has +at most twice as many vertices as there are selected edges. Each +region meeting a disc is its chosen incident region. Thus the +connection theorem gives the required branch drawings, and the +end-partition assembly proves control. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM10 GM11 GM14 + +universe u + +/-- The application of (3.2) and subsequent branch assembly in +XII (4.3), page 251. The topological feasibility condition is an +input here, exactly as it is for (3.2). -/ +theorem exists_threshold_for_control_from_feasible_discs + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {p t : ℕ} + (L : Graph (Fin p) (Fin t)) (κ : Fin t × Bool → Fin p) + (hloopless : ∀ e v, ¬ L.IsLink e v v) + (hassign : ∀ e u v, L.IsLink e u v → + (κ (e, true) = u ∧ κ (e, false) = v) ∨ + (κ (e, true) = v ∧ κ (e, false) = u)) + (htwo : ∀ v ∈ L.vertexSet, ∃ i j, i ≠ j ∧ + ∃ c d : Bool, κ (i, c) = v ∧ κ (j, d) = v) : + ∃ k : ℕ, 1 ≤ k ∧ 2 * p ≤ k ∧ + ∀ (Γ : Drawing S) (θ : ℕ) (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (f : Fin t → Set S) (a b : Fin t → S) + (Δ r : Fin t → Set S), + HasTangleMetric Γ θ T d → k ≤ θ → + (∀ i, Γ.toGraph.IsLink (f i) (a i) (b i) ∧ a i ≠ b i) → + (∀ i, IsClosedDisc (Δ i) ∧ Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i) ∧ + Γ.V ∩ discBd (Δ i) = {a i, b i}) → + (∀ i j, i ≠ j → Disjoint (Δ i) (Δ j)) → + (∀ i j, i ≠ j → k + 4 ≤ d (f i) (f j)) → + (∀ i, r i ∈ Γ.R ∧ (r i ∩ Δ i).Nonempty) → + (∀ i j, i ≠ j → k ≤ d (r i) (r j)) → + (∀ i, IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd (Δ i))) → + IsTopologicallyFeasible Δ + (edgeEndClass (fun q : Fin t × Bool => if q.2 then a q.1 else b q.1) κ) → + ControlsMinor Γ.toHypergraph θ T L := by + obtain ⟨η, hη, h32⟩ := theorem_3_2_proof hS t (2 * t) + let k := max η (2 * p) + refine ⟨k, hη.trans (le_max_left _ _), le_max_right _ _, ?_⟩ + intro Γ θ T d f a b Δ r hm hkθ hl hΔ hdisj hsep hr hreg hfree hfeas + let ends : Fin t × Bool → S := fun q => if q.2 then a q.1 else b q.1 + have hbd : ∀ i, Γ.V ∩ discBd (Δ i) = {a i, b i} := fun i => (hΔ i).2.2 + have hZ := discBoundaryVertices_eq_range_ends Δ a b hbd + have haD : ∀ i, a i ∈ Δ i := by + intro i + exact Surface.discBd_subset (Δ i) (((hbd i).symm.subset (by simp)).2) + have hbD : ∀ i, b i ∈ Δ i := by + intro i + exact Surface.discBd_subset (Δ i) (((hbd i).symm.subset (by simp)).2) + have hinj : Function.Injective ends := edge_ends_injective_of_disjoint_discs a b Δ + (fun i => (hl i).2) haD hbD hdisj + have hcover : (⋃ v, edgeEndClass ends κ v) = discBoundaryVertices Γ Δ := + (iUnion_edgeEndClass ends κ).trans hZ.symm + have hreg' : ∀ i j, i ≠ j → ∀ ri ∈ Γ.R, (ri ∩ Δ i).Nonempty → + ∀ rj ∈ Γ.R, (rj ∩ Δ j).Nonempty → η ≤ d ri rj := by + intro i j hij ri hri hriD rj hrj hrjD + obtain ⟨q, _, _, _, huniq⟩ := exists_unique_region_meeting_disc hS (hΔ i).1 (hΔ i).2.1 + have hri' : ri = r i := (huniq ri hri hriD).trans (huniq (r i) (hr i).1 (hr i).2).symm + obtain ⟨q', _, _, _, huniq'⟩ := exists_unique_region_meeting_disc hS (hΔ j).1 (hΔ j).2.1 + have hrj' : rj = r j := (huniq' rj hrj hrjD).trans (huniq' (r j) (hr j).1 (hr j).2).symm + rw [hri', hrj'] + exact (le_max_left η (2 * p)).trans (hreg i j hij) + obtain ⟨H, hHs, hconn, hHdisj, hclasses⟩ := h32 Δ Γ θ T d p (edgeEndClass ends κ) + (fun i => ⟨(hΔ i).1, (hΔ i).2.1⟩) hdisj (discBoundaryVertices_ncard_le_twice Δ a b hbd) + hcover (fun i j hij => disjoint_edgeEndClass ends κ hinj hij) hfeas + ((le_max_left _ _).trans hkθ) hm hreg' hfree + apply controlsMinor_of_end_partition hS hm L f a b κ (fun i => (hl i).1) hsep hloopless + hassign htwo (Nat.le_trans (by omega : p ≤ k) hkθ) (le_max_right _ _) H hHs hconn hHdisj + intro v + rw [← hZ] + exact hclasses v + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4FiniteLabels.lean b/LeanPool/GraphMinor/GM12/Section4FiniteLabels.lean new file mode 100644 index 0000000000..3faf0d102c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4FiniteLabels.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Statement +import Mathlib.Data.Fintype.EquivFin +import Mathlib.Data.Set.Finite.Basic + +/-! +# Finite labels for the target graph + +In XII (4.3), pages 249--250, enumerate the target vertices and +edges before choosing one selected free edge for each target edge. +An arbitrary finite graph is isomorphic to a graph whose vertices +and edges are all the elements of two finite initial intervals. +The isomorphism sends each index to the corresponding original +vertex or edge. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- Enumerating the finite vertex and edge sets gives finite labels +for the target of XII (4.3), pages 249--250. -/ +theorem exists_finite_labels {α β : Type*} (G : Graph α β) + (hV : G.vertexSet.Finite) (hE : G.edgeSet.Finite) : + ∃ (p t : ℕ) (L : Graph (Fin p) (Fin t)), + L.vertexSet = univ ∧ L.edgeSet = univ ∧ Nonempty (Iso L G) := by + classical + let : Fintype G.vertexSet := hV.fintype + let : Fintype G.edgeSet := hE.fintype + let p := Fintype.card G.vertexSet + let t := Fintype.card G.edgeSet + let ν : Fin p ≃ G.vertexSet := (Fintype.equivFin G.vertexSet).symm + let ε : Fin t ≃ G.edgeSet := (Fintype.equivFin G.edgeSet).symm + let L : Graph (Fin p) (Fin t) := { + vertexSet := univ + edgeSet := univ + IsLink := fun e x y => G.IsLink (ε e).val (ν x).val (ν y).val + isLink_symm := by intro e he; exact ⟨fun _ _ h => h.symm⟩ + eq_or_eq_of_isLink_of_isLink := by + intro e x y v w hxy hvw + rcases G.eq_or_eq_of_isLink_of_isLink hxy hvw with h | h + · exact Or.inl (ν.injective (Subtype.ext h)) + · exact Or.inr (ν.injective (Subtype.ext h)) + edge_mem_iff_exists_isLink := by + intro e + constructor + · intro _ + obtain ⟨x, y, hxy⟩ := G.exists_isLink_of_mem_edgeSet (ε e).property + refine ⟨ν.symm ⟨x, hxy.left_mem⟩, ν.symm ⟨y, hxy.right_mem⟩, ?_⟩ + simpa only [ν.apply_symm_apply] using hxy + · exact fun _ => mem_univ _ + left_mem_of_isLink := by intro e x y h; exact mem_univ x } + let φ : Iso L G := { + vertexEquiv := (Equiv.Set.univ (Fin p)).trans ν + edgeEquiv := (Equiv.Set.univ (Fin t)).trans ε + isLink_iff := fun _ _ _ => Iff.rfl } + exact ⟨p, t, L, rfl, rfl, ⟨φ⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4FiniteLineDrawing.lean b/LeanPool/GraphMinor/GM12/Section4FiniteLineDrawing.lean new file mode 100644 index 0000000000..ec14973df3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4FiniteLineDrawing.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.PaintingCells +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM11.RadialExists + +/-! +# Drawing a finite family of graph edges + +The drawing of the loopless target in XII (4.3), pages 249--251, +may be given by vertex points and edge lines. Assemble these lines +into a drawing. Start with the vertex points and glue one line +at a time. The intersection assumptions ensure that the new line +meets the existing drawing only at its ends. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A finite family of lines with prescribed ends and disjoint +interiors forms a drawing, as used for the target in XII (4.3). -/ +theorem exists_drawing_of_finite_lines + {S ι : Type*} [TopologicalSpace S] [T2Space S] + {V : Set S} (hV : V.Finite) {E : Set ι} (hE : E.Finite) + (L : ι → Set S) (u v : ι → S) + (hline : ∀ i ∈ E, IsLineWithEnds (L i) (u i) (v i)) + (hne : ∀ i ∈ E, u i ≠ v i) + (hends : ∀ i ∈ E, L i ∩ V = {u i, v i}) + (hmeet : ∀ i ∈ E, ∀ j ∈ E, i ≠ j → L i ∩ L j ⊆ V) : + ∃ H : Drawing S, H.U = V ∪ ⋃ i ∈ E, L i ∧ H.V = V ∧ + H.E = (fun i => L i \ {u i, v i}) '' E := by + revert hline hne hends hmeet + induction E, hE using Set.Finite.induction_on with + | empty => + intro _ _ _ _ + refine ⟨pointsDrawing hV, ?_, rfl, ?_⟩ + · change V = V ∪ ⋃ i ∈ (∅ : Set ι), L i + simp + · rw [pointsDrawing_E, image_empty] + | @insert i E hi hE ih => + intro hline hne hends hmeet + obtain ⟨H, hHU, hHV, hHE⟩ := ih + (fun j hj => hline j (Or.inr hj)) (fun j hj => hne j (Or.inr hj)) + (fun j hj => hends j (Or.inr hj)) + (fun j hj k hk hjk => hmeet j (Or.inr hj) k (Or.inr hk) hjk) + let K := lineDrawing (hline i (Or.inl rfl)) (hne i (Or.inl rfl)) + have hKU : K.U = L i := rfl + have hKV : K.V = {u i, v i} := rfl + have hKE : K.E = {L i \ {u i, v i}} := lineDrawing_E _ _ + have hKiV : K.V ⊆ V := by + rw [hKV, ← hends i (Or.inl rfl)] + exact inter_subset_right + have hglue : H.U ∩ K.U ⊆ H.V ∩ K.V := by + rintro x ⟨hxH, hxK⟩ + have hxL : x ∈ L i := hxK + have hxV : x ∈ V := by + rw [hHU] at hxH + rcases hxH with hxV | hxH + · exact hxV + · obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.mp hxH + exact hmeet j (Or.inr hj) i (Or.inl rfl) + (fun heq => hi (heq ▸ hj)) ⟨hxj, hxL⟩ + refine ⟨hHV.symm ▸ hxV, ?_⟩ + rw [hKV, ← hends i (Or.inl rfl)] + exact ⟨hxL, hxV⟩ + refine ⟨H.glue K hglue, ?_, ?_, ?_⟩ + · change H.U ∪ K.U = _ + rw [hHU, hKU, biUnion_insert] + ac_rfl + · change H.V ∪ K.V = V + rw [hHV] + exact union_eq_left.mpr hKiV + · rw [Drawing.glue_E, hHE, hKE, image_insert_eq, union_singleton] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4FiniteMarkedDiscJoin.lean b/LeanPool/GraphMinor/GM12/Section4FiniteMarkedDiscJoin.lean new file mode 100644 index 0000000000..8f048bcef7 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4FiniteMarkedDiscJoin.lean @@ -0,0 +1,132 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4MarkedDiscJoin +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Joining all arms of a vertex star + +In XII (4.5), claim (1), page 253, a vertex disc and the thin +discs around its residual edge halves form a star. Attach these +arm discs one at a time. While joining the other arms, protect +the next arm as part of the closed set. It still meets the +joined disc at its original boundary point when its turn comes. +All contacts with the crossing discs stay fixed. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Finitely many pairwise disjoint discs attached at separate +boundary points of one disc can be joined inside an open set. +The construction preserves exact contacts with a closed set +avoiding all attachment points, including the boundary status +of those contacts. This thickens a vertex star in XII (4.5), +claim (1), page 253. -/ +theorem exists_finite_join_preserving_contacts {S ι : Type} [TopologicalSpace S] + (hS : IsClosedSurface S) (A U : Set S) (B : ι → Set S) (p : ι → S) + (hA : IsClosedDisc A) (hU : IsOpen U) (hAU : A ⊆ U) : + ∀ (F : Finset ι) (Z : Set S), IsClosed Z → + (∀ i ∈ F, IsClosedDisc (B i)) → + (∀ i ∈ F, ∀ j ∈ F, i ≠ j → Disjoint (B i) (B j)) → + (∀ i ∈ F, A ∩ B i = {p i}) → + (∀ i ∈ F, p i ∈ discBd A) → + (∀ i ∈ F, p i ∈ discBd (B i)) → + (∀ i ∈ F, B i ⊆ U) → (∀ i ∈ F, p i ∉ Z) → + ∃ D : Set S, IsClosedDisc D ∧ (A ∪ ⋃ i ∈ F, B i) ⊆ D ∧ D ⊆ U ∧ + D ∩ Z = (A ∪ ⋃ i ∈ F, B i) ∩ Z ∧ + (discBd A ∪ ⋃ i ∈ F, discBd (B i)) ∩ Z ⊆ discBd D := by + classical + have ht2 : T2Space S := hS.2.1 + intro F + induction F using Finset.induction_on with + | empty => + intro Z _ _ _ _ _ _ _ _ + refine ⟨A, hA, ?_, hAU, ?_, ?_⟩ + · simp + · simp + · simp + | @insert i F hi ih => + intro Z hZ hB hBB hAB hpA hpB hBU hpZ + have hiF : i ∈ insert i F := Finset.mem_insert_self i F + have hF : ∀ j ∈ F, j ∈ insert i F := fun j hj => Finset.mem_insert_of_mem hj + have hpiB : p i ∈ B i := Surface.discBd_subset _ (hpB i hiF) + have hpZ' : ∀ j ∈ F, p j ∉ Z ∪ B i := by + intro j hj hmem + rcases hmem with hz | hb + · exact hpZ j (hF j hj) hz + · have hji : j ≠ i := fun heq => hi (heq ▸ hj) + exact disjoint_left.mp (hBB j (hF j hj) i hiF hji) + (Surface.discBd_subset _ (hpB j (hF j hj))) hb + obtain ⟨D, hd, hsub, hDU, hcontact, hbd⟩ := ih (Z ∪ B i) + (hZ.union (hB i hiF).isClosed) + (fun j hj => hB j (hF j hj)) + (fun j hj k hk => hBB j (hF j hj) k (hF k hk)) + (fun j hj => hAB j (hF j hj)) (fun j hj => hpA j (hF j hj)) + (fun j hj => hpB j (hF j hj)) (fun j hj => hBU j (hF j hj)) hpZ' + have hDB : D ∩ B i = {p i} := by + apply Subset.antisymm + · rintro z ⟨hzD, hzB⟩ + have hzK : z ∈ A ∪ ⋃ j ∈ F, B j := + (show z ∈ (A ∪ ⋃ j ∈ F, B j) ∩ (Z ∪ B i) from hcontact ▸ ⟨hzD, Or.inr hzB⟩).1 + rcases hzK with hzA | hzarms + · exact (hAB i hiF).subset ⟨hzA, hzB⟩ + · obtain ⟨j, hzj⟩ := mem_iUnion.mp hzarms + obtain ⟨hjF, hzj⟩ := mem_iUnion.mp hzj + have hji : j ≠ i := fun heq => hi (heq ▸ hjF) + exact False.elim (disjoint_left.mp (hBB j (hF j hjF) i hiF hji) hzj hzB) + · intro z hz + have heq : z = p i := mem_singleton_iff.mp hz + rw [heq] + exact ⟨hsub (Or.inl (Surface.discBd_subset _ (hpA i hiF))), hpiB⟩ + have hpiD : p i ∈ discBd D := hbd ⟨Or.inl (hpA i hiF), Or.inr hpiB⟩ + obtain ⟨D', hd', hsub', hD'U, hcontact', hbd'⟩ := exists_join_preserving_contacts hS + hd (hB i hiF) hDB hpiD (hpB i hiF) hU hDU (hBU i hiF) hZ (hpZ i hiF) + have hunion : (A ∪ ⋃ j ∈ insert i F, B j) = (A ∪ ⋃ j ∈ F, B j) ∪ B i := by + simp only [Finset.set_biUnion_insert] + rw [← union_assoc] + exact union_right_comm A (B i) (⋃ j ∈ F, B j) + have hbdunion : (discBd A ∪ ⋃ j ∈ insert i F, discBd (B j)) = + (discBd A ∪ ⋃ j ∈ F, discBd (B j)) ∪ discBd (B i) := by + simp only [Finset.set_biUnion_insert] + rw [← union_assoc] + exact union_right_comm (discBd A) (discBd (B i)) (⋃ j ∈ F, discBd (B j)) + refine ⟨D', hd', ?_, hD'U, ?_, ?_⟩ + · rw [hunion] + rintro z (hz | hz) + · exact hsub' (Or.inl (hsub hz)) + · exact hsub' (Or.inr hz) + · rw [hcontact', hunion] + ext z + constructor + · rintro ⟨hz, hzZ⟩ + rcases hz with hzD | hzB + · have hzK := (show z ∈ (A ∪ ⋃ j ∈ F, B j) ∩ (Z ∪ B i) from + hcontact ▸ ⟨hzD, Or.inl hzZ⟩).1 + exact ⟨Or.inl hzK, hzZ⟩ + · exact ⟨Or.inr hzB, hzZ⟩ + · rintro ⟨hz, hzZ⟩ + rcases hz with hzK | hzB + · exact ⟨Or.inl (hsub hzK), hzZ⟩ + · exact ⟨Or.inr hzB, hzZ⟩ + · rw [hbdunion] + rintro z ⟨hz, hzZ⟩ + apply hbd' + refine ⟨?_, hzZ⟩ + rcases hz with hzold | hzB + · exact Or.inl (hbd ⟨hzold, Or.inl hzZ⟩) + · exact Or.inr hzB + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4FiniteSourceDiscs.lean b/LeanPool/GraphMinor/GM12/Section4FiniteSourceDiscs.lean new file mode 100644 index 0000000000..fb4828745f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4FiniteSourceDiscs.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4EndPartition +import LeanPool.GraphMinor.GM12.Section4SourceDiscs + +/-! +# Finite labelled source discs for topological feasibility + +In XII (4.3), claim (7), page 251, the vertex discs and +residual edge discs carry the target graph's finite labels. +Reindex the disc system by the vertex and edge enumerations. +The vertex-disc contacts become exactly the oriented end classes +used in the connection theorem. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The finite labelled source configuration for XII (4.3), claim +(7), page 251. Its end partition is topologically feasible before +the ambient homeomorphism is applied. -/ +theorem exists_finite_source_disc_system + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) {p t : ℕ} + (ν : Fin p ≃ Γ.V) (ε : Fin t ≃ Γ.E) (κ : Fin t × Bool → Fin p) + (hl : ∀ i, Γ.toGraph.IsLink (ε i).val (ν (κ (i, true))).val (ν (κ (i, false))).val) + (hne : ∀ i, κ (i, true) ≠ κ (i, false)) : + ∃ (Δ : Fin t → Set S) (a b : Fin t → S), + (∀ i, IsClosedDisc (Δ i) ∧ a i ≠ b i ∧ ({a i, b i} : Set S) ⊆ discBd (Δ i)) ∧ + (∀ i j, i ≠ j → Disjoint (Δ i) (Δ j)) ∧ + IsTopologicallyFeasible Δ + (edgeEndClass (fun q : Fin t × Bool => if q.2 then a q.1 else b q.1) κ) := by + let u : Γ.E → Γ.V := fun e => ν (κ (ε.symm e, true)) + let v : Γ.E → Γ.V := fun e => ν (κ (ε.symm e, false)) + have hl' : ∀ e, Γ.toGraph.IsLink e.val (u e).val (v e).val := by + intro e + simpa only [u, v, ε.apply_symm_apply] using hl (ε.symm e) + have hne' : ∀ e, u e ≠ v e := by + intro e heq + exact hne (ε.symm e) (ν.injective heq) + obtain ⟨D, Δ, a, b, hD, hDD, hΔ, hΔΔ, hcontact⟩ := exists_source_disc_system hS Γ u v hl' hne' + let E : Fin t × Bool ≃ Γ.E × Bool := ε.prodCongr (Equiv.refl Bool) + let ends : Γ.E × Bool → S := fun q => if q.2 then a q.1 else b q.1 + let owner : Γ.E × Bool → Γ.V := fun q => if q.2 then u q.1 else v q.1 + have howner : ∀ q, owner (E q) = ν (κ q) := by + intro ⟨i, c⟩ + cases c <;> simp [owner, E, Equiv.prodCongr_apply, Prod.map, u, v] + have hclass : ∀ w, edgeEndClass ends owner (ν w) = + edgeEndClass (fun q : Fin t × Bool => if q.2 then a (ε q.1) else b (ε q.1)) κ w := by + intro w + simpa [ends, E, Function.comp_def, Equiv.prodCongr_apply, Prod.map] using + edgeEndClass_reindex E ν ends owner κ howner w + have hunion : (⋃ i : Fin t, Δ (ε i)) = ⋃ e : Γ.E, Δ e := by + ext x + constructor + · intro hx + obtain ⟨i, hi⟩ := mem_iUnion.mp hx + exact mem_iUnion.mpr ⟨ε i, hi⟩ + · intro hx + obtain ⟨e, he⟩ := mem_iUnion.mp hx + exact mem_iUnion.mpr ⟨ε.symm e, by simpa only [ε.apply_symm_apply] using he⟩ + refine ⟨(fun i => Δ (ε i)), (fun i => a (ε i)), (fun i => b (ε i)), + (fun i => hΔ (ε i)), (fun i j hij => hΔΔ (ε i) (ε j) (fun h => hij (ε.injective h))), ?_⟩ + refine ⟨(fun w => D (ν w)), (fun w => hD (ν w)), ?_, ?_⟩ + · intro w z hwz + exact hDD (ν w) (ν z) (fun h => hwz (ν.injective h)) + · intro w + rw [hunion] + exact (hcontact (ν w)).trans (hclass w) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4FirstThreshold.lean b/LeanPool/GraphMinor/GM12/Section4FirstThreshold.lean new file mode 100644 index 0000000000..882ae7c582 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4FirstThreshold.lean @@ -0,0 +1,122 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +import Mathlib.Data.List.Basic + +/-! +# First edges reaching a distance threshold + +XII (4.3), claim (2), page 250, takes the first edge of a path +whose distance from the chosen edge reaches a given threshold. +Consecutive path edges have distance at most four. Thus the first +crossing overshoots the threshold by at most three. The list lemma +below records precisely this first-crossing argument, with a bound +on each successive value. +-/ + +public section + +namespace GraphMinor.GM12 + +/-- The first-crossing argument of XII (4.3), claim (2), page 250. +The initial value is at most the threshold plus three, and each following value increases +by at most four. -/ +theorem exists_first_threshold_edge {α : Type*} (value : α → ℕ) + (i : ℕ) : + ∀ (l : List α), + (∀ a, l.head? = some a → value a ≤ i + 3) → + (∀ (p : List α) a b (q : List α), l = p ++ a :: b :: q → + value b ≤ value a + 4) → + (∃ a ∈ l, i ≤ value a) → + ∃ (p : List α) (a : α) (q : List α), l = p ++ a :: q ∧ + (∀ b ∈ p, value b < i) ∧ i ≤ value a ∧ value a ≤ i + 3 := by + intro l + induction l with + | nil => + intro _ _ hex + obtain ⟨a, ha, _⟩ := hex + exact False.elim (List.not_mem_nil ha) + | cons a l ih => + intro hhead hstep hex + by_cases ha : i ≤ value a + · exact ⟨[], a, l, rfl, by simp, ha, by have h := hhead a rfl; omega⟩ + have halt : value a < i := Nat.lt_of_not_ge ha + have htail : ∃ b ∈ l, i ≤ value b := by + obtain ⟨b, hb, hib⟩ := hex + rcases List.mem_cons.mp hb with rfl | hb + · exact False.elim (ha hib) + · exact ⟨b, hb, hib⟩ + -- If the next edge crosses, use its predecessor. Otherwise recurse. + cases l with + | nil => + obtain ⟨b, hb, _⟩ := htail + exact False.elim (List.not_mem_nil hb) + | cons b r => + by_cases hb : i ≤ value b + · refine ⟨[a], b, r, rfl, ?_, hb, ?_⟩ + · intro c hc + exact (List.mem_singleton.mp hc) ▸ halt + · have h := hstep [] a b r rfl + omega + · have hhead' : ∀ c, (b :: r).head? = some c → value c ≤ i + 3 := by + intro c hc + have hbc : b = c := Option.some.inj hc + subst c + have h := Nat.lt_of_not_ge hb + omega + have hstep' : ∀ (p : List α) c d (q : List α), + b :: r = p ++ c :: d :: q → value d ≤ value c + 4 := by + intro p c d q heq + exact hstep (a :: p) c d q (congrArg (List.cons a) heq) + obtain ⟨p, c, q, heq, hp, hic, hci⟩ := ih hhead' hstep' htail + refine ⟨a :: p, c, q, congrArg (List.cons a) heq, ?_, hic, hci⟩ + intro d hd + rcases List.mem_cons.mp hd with rfl | hd + · exact halt + · exact hp d hd + +/-- XII (4.3), claim (2), with the initial distance bound four. -/ +theorem exists_first_threshold_edge_of_head_le_four {α : Type*} (value : α → ℕ) + {i : ℕ} (hi : 1 ≤ i) (l : List α) + (hhead : ∀ a, l.head? = some a → value a ≤ 4) + (hstep : ∀ (p : List α) a b (q : List α), l = p ++ a :: b :: q → + value b ≤ value a + 4) + (hex : ∃ a ∈ l, i ≤ value a) : + ∃ (p : List α) (a : α) (q : List α), l = p ++ a :: q ∧ + (∀ b ∈ p, value b < i) ∧ i ≤ value a ∧ value a ≤ i + 3 := by + apply exists_first_threshold_edge value i l + · intro a ha + have h := hhead a ha + omega + · exact hstep + · exact hex + +/-- XII (4.3), claim (3), page 250: thresholds separated by +`k + 7` yield edges at distance at least `k + 4`. -/ +theorem threshold_edges_distance_ge {α : Type*} (d : α → α → ℕ) + (htriangle : ∀ x y z, d x z ≤ d x y + d y z) + {g f h : α} {i j k : ℕ} (hfi : d g f ≤ i + 3) + (hhj : j ≤ d g h) (hgap : i + (k + 7) ≤ j) : k + 4 ≤ d f h := by + have ht := htriangle g f h + omega + +/-- The distance estimate in XII (4.3), claim (4), page 250: +thresholds at most `θ - 5` stay at distance at least two from +the other chosen end edge. -/ +theorem threshold_edge_distance_other_end_ge_two {α : Type*} (d : α → α → ℕ) + (htriangle : ∀ x y z, d x z ≤ d x y + d y z) + (hsymm : ∀ x y, d x y = d y x) + {g h f : α} {θ i : ℕ} (hfar : θ ≤ d g h) + (hfi : d g f ≤ i + 3) (hi : i + 5 ≤ θ) : 2 ≤ d h f := by + have ht := htriangle g f h + rw [hsymm f h] at ht + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4FourContactBoundary.lean b/LeanPool/GraphMinor/GM12/Section4FourContactBoundary.lean new file mode 100644 index 0000000000..62c40291b8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4FourContactBoundary.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM12.Section3Punctured +import LeanPool.GraphMinor.Surface.SurfaceGraph +import Mathlib.Data.Set.Card +import Mathlib.Data.Fintype.Prod + +/-! +# The boundary set of four-contact discs + +XII (4.5), page 253, uses the connection theorem with at most +four marks for each eye. Exact contact with the drawing and +boundary containment make each disc normal. Enumerating the +four marks bounds the total boundary set by four times the +number of discs. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Exact contacts lying on the disc boundary give the normality +condition required by XII (3.2). -/ +theorem normal_disc_of_exact_boundary_contacts + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} {D N : Set S} + (hcontact : D ∩ Γ.U = N) (hNV : N ⊆ Γ.V) (hNb : N ⊆ discBd D) : + Γ.U ∩ D = Γ.V ∩ discBd D ∧ Γ.V ∩ discBd D = N := by + have hbd : Γ.V ∩ discBd D = N := by + apply Subset.antisymm + · intro x hx + exact hcontact.subset ⟨discBd_subset D hx.2, Γ.V_subset_U hx.1⟩ + · exact fun x hx => ⟨hNV hx, hNb hx⟩ + exact ⟨(inter_comm _ _).trans (hcontact.trans hbd.symm), hbd⟩ + +/-- Four contacts per disc give the parameter `z = 4t` used in +XII (4.5), page 253. -/ +theorem discBoundaryVertices_ncard_le_four + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} {t : ℕ} + (D : Fin t → Set S) (a b c d : Fin t → S) + (hbd : ∀ i, Γ.V ∩ discBd (D i) = {a i, b i, c i, d i}) : + (discBoundaryVertices Γ D).ncard ≤ 4 * t := by + let marks : Fin t × Fin 4 → S := fun q => ![a q.1, b q.1, c q.1, d q.1] q.2 + have hsub : discBoundaryVertices Γ D ⊆ marks '' univ := by + intro x hx + obtain ⟨i, hi⟩ := mem_iUnion.mp hx + rw [hbd i] at hi + rcases hi with rfl | rfl | rfl | hi + · exact ⟨(i, 0), mem_univ _, rfl⟩ + · exact ⟨(i, 1), mem_univ _, rfl⟩ + · exact ⟨(i, 2), mem_univ _, rfl⟩ + · exact ⟨(i, 3), mem_univ _, (mem_singleton_iff.mp hi).symm⟩ + have hc := (ncard_le_ncard hsub (toFinite _)).trans (ncard_image_le (toFinite univ)) + simpa only [ncard_univ, Nat.card_eq_fintype_card, Fintype.card_prod, + Fintype.card_fin, Nat.mul_comm t 4] using hc + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4FreeEdgeDiscs.lean b/LeanPool/GraphMinor/GM12/Section4FreeEdgeDiscs.lean new file mode 100644 index 0000000000..6849eb0d45 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4FreeEdgeDiscs.lean @@ -0,0 +1,73 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM12.Section4SpacedFreeEdges +import LeanPool.GraphMinor.GM12.Section4EdgeEmptyDisc +import LeanPool.GraphMinor.GM12.Section4EmptyDiscsDisjoint +import LeanPool.GraphMinor.GM12.Section4EdgeRegionDistance + +/-! +# The free-edge discs for XII (4.3) + +Choose the mutually distant free edges from claims (1)--(4) and +put an empty disc through each pair of ends. The distance bound +makes these discs disjoint. Their incident regions remain far +apart by claim (5). Their boundary vertex sets are free by claim +(6), since they are exactly the ends of the chosen free edges. +This supplies the geometric and metric input to XII (3.2). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM10 GM11 GM14 + +/-- The free-edge discs of XII (4.3), page 250, including claims +(5)--(6). Topological feasibility is the remaining claim (7). -/ +theorem exists_spaced_free_edge_discs + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ k t : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + (hk : 1 ≤ k) (hθ : 5 + t * (k + 7) ≤ θ) : + ∃ (f : Fin t → Set S) (a b : Fin t → S) (Δ r : Fin t → Set S), + (∀ i, Γ.toGraph.IsLink (f i) (a i) (b i) ∧ a i ≠ b i ∧ + IsClosedDisc (Δ i) ∧ Γ.U ∩ Δ i = {a i, b i} ∧ + ({a i, b i} : Set S) ⊆ discBd (Δ i) ∧ + Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i) ∧ + IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd (Δ i)) ∧ + r i ∈ Γ.R ∧ f i ⊆ closure (r i) ∧ (r i ∩ Δ i).Nonempty) ∧ + (∀ i j, i ≠ j → Disjoint (Δ i) (Δ j)) ∧ + (∀ i j, i ≠ j → k ≤ d (r i) (r j)) ∧ + (∀ i j, i ≠ j → k + 4 ≤ d (f i) (f j)) := by + classical + obtain ⟨f, a, b, hf, hsep⟩ := exists_spaced_free_edges hS hm hθ + have hex : ∀ i : Fin t, ∃ (D r : Set S), IsClosedDisc D ∧ r ∈ Γ.R ∧ f i ⊆ closure r ∧ + Γ.U ∩ D = {a i, b i} ∧ ({a i, b i} : Set S) ⊆ discBd D ∧ + Γ.U ∩ D = Γ.V ∩ discBd D ∧ (r ∩ D).Nonempty := by + intro i + exact exists_empty_disc_at_edge hS (hf i).2.1 (hf i).2.2.1 + choose Δ r hD hr hcl hUD hbd havoid hmeet using hex + refine ⟨f, a, b, Δ, r, ?_, ?_, ?_, hsep⟩ + · intro i + refine ⟨(hf i).2.1, (hf i).2.2.1, hD i, hUD i, hbd i, havoid i, ?_, hr i, hcl i, hmeet i⟩ + rw [← havoid i, hUD i] + exact (hf i).2.2.2 + · intro i j hij + exact empty_discs_disjoint_of_edges_distant hS hm (hf i).2.1 (hf j).2.1 (hD i) (hD j) + (hUD i) (hUD j) (havoid i) (havoid j) (hr i) (hr j) (hcl i) (hcl j) (hmeet i) (hmeet j) + ((show 5 ≤ k + 4 by omega).trans (hsep i j hij)) + · intro i j hij + exact incident_regions_distance_ge hS hm (hf i).1 (hf j).1 (hr i) (hr j) (hcl i) (hcl j) + (hsep i j hij) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4FreePathEdge.lean b/LeanPool/GraphMinor/GM12/Section4FreePathEdge.lean new file mode 100644 index 0000000000..918078c22e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4FreePathEdge.lean @@ -0,0 +1,118 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section1 +import LeanPool.GraphMinor.GM12.Section4NonfreeEdgeCircuit +import LeanPool.GraphMinor.GM12.Section4PathEdgeSplit +import LeanPool.GraphMinor.GM12.Section4PathCircuitSeparation +import LeanPool.GraphMinor.GM12.Section4PathInside +import LeanPool.GraphMinor.GM12.Section4CircuitAtomDistance +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.Section7 + +/-! +# Free edges in a path between distant edges + +This proves claim (1) in XII (4.3), pages 249--250. A nonfree +path edge lies inside a radial circuit with at most one original +vertex. One of the two remaining path portions misses the circuit. +It forces its incident chosen edge into the same inside. Traversing +the circuit then bounds their distance by one, a contradiction. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM10 GM11 GM14 + +/-- Graph Minors XII (4.3), claim (1), pages 249--250: a path edge +at distance at least two from both chosen end edges has distinct +ends and those ends form a free set. -/ +theorem free_path_edge_of_distant_ends + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsRespectfulDrawingTangle Γ θ T) (hθ : 2 ≤ θ) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + {x y : S} (W : GraphWalk Γ.toGraph x y) (hW : W.IsSimple) + {g₁ g₂ : Set S} (hg₁ : g₁ ∈ Γ.E) (hg₂ : g₂ ∈ Γ.E) + (hx : x ∈ closure g₁) (hy : y ∈ closure g₂) + {f : Set S} (hf : f ∈ W.edges) + (hd₁ : 2 ≤ tangleMetric Γ K ins θ g₁ f) + (hd₂ : 2 ≤ tangleMetric Γ K ins θ g₂ f) : + ∃ a b, Γ.toGraph.IsLink f a b ∧ a ≠ b ∧ IsFreeSet Γ.toHypergraph T θ {a, b} := by + obtain ⟨a, b, P, Q, hl, _, hPQ⟩ := exists_path_edge_split W hW hf + have hab : a ≠ b := by + intro heq + exact Set.disjoint_left.mp hPQ P.end_mem_support (heq ▸ Q.start_mem_support) + refine ⟨a, b, hl, hab, ?_⟩ + by_contra hfree + obtain ⟨C, hC, hCs, hCl, _, hcount, hfC⟩ := + exists_short_radial_circuit_of_nonfree_edge hS hT hθ hK hd hl hab hfree + have hdisc := (hd C hC hCs hCl).1 + have hbd : frontier (ins C) = C.U := by + rw [← subBd_eq_frontier] + exact (hd C hC hCs hCl).2.1 + have hfcl : closure f ⊆ ins C := hdisc.isClosed.closure_subset_iff.mpr hfC + have ha : a ∈ ins C := hfcl (by + have h : a ∈ closure f ∩ Γ.V := by rw [hl.2.2.2]; simp + exact h.1) + have hb : b ∈ ins C := hfcl (by + have h : b ∈ closure f ∩ Γ.V := by rw [hl.2.2.2]; simp + exact h.1) + have hfA : f ∈ Γ.A := Or.inl (Or.inr hl.edge_mem) + have hmeetf : (f ∩ ins C).Nonempty := by + obtain ⟨z, hz⟩ := hl.edge_mem.1 + exact ⟨z, hz, hfC hz⟩ + rcases path_portion_disjoint_short_radial_circuit hK hCs hcount P Q hPQ with hP | hQ + · have hgC := incident_edge_subset_of_path_inside hK hCs hdisc.isClosed hbd P hP ha hg₁ hx + have hmeetg : (g₁ ∩ ins C).Nonempty := by + obtain ⟨z, hz⟩ := hg₁.1 + exact ⟨z, hz, hgC hz⟩ + have hdist := atom_distance_le_circuit_vertex_count hS hK hd hC hCs hCl + (Or.inl (Or.inr hg₁)) hfA hmeetg hmeetf + exact (Nat.not_succ_le_self 1) (hd₁.trans (hdist.trans hcount)) + · have hgC := incident_edge_subset_of_path_inside hK hCs hdisc.isClosed hbd Q.reverse + (by + have heq : (walkDrawing Γ Q.reverse).U = (walkDrawing Γ Q).U := by + ext z + simp only [mem_walkDrawing_U, GraphWalk.support_reverse, + GraphWalk.edges_reverse, List.mem_reverse] + rw [heq] + exact hQ) hb hg₂ hy + have hmeetg : (g₂ ∩ ins C).Nonempty := by + obtain ⟨z, hz⟩ := hg₂.1 + exact ⟨z, hz, hgC hz⟩ + have hdist := atom_distance_le_circuit_vertex_count hS hK hd hC hCs hCl + (Or.inl (Or.inr hg₂)) hfA hmeetg hmeetf + exact (Nat.not_succ_le_self 1) (hd₂.trans (hdist.trans hcount)) + +/-- Claim (1) of XII (4.3), expressed using the metric of the tangle. -/ +theorem free_path_edge_of_metric_distant_ends + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) (hθ : 2 ≤ θ) + {x y : S} (W : GraphWalk Γ.toGraph x y) (hW : W.IsSimple) + {g₁ g₂ : Set S} (hg₁ : g₁ ∈ Γ.E) (hg₂ : g₂ ∈ Γ.E) + (hx : x ∈ closure g₁) (hy : y ∈ closure g₂) + {f : Set S} (hf : f ∈ W.edges) (hd₁ : 2 ≤ d g₁ f) (hd₂ : 2 ≤ d g₂ f) : + ∃ a b, Γ.toGraph.IsLink f a b ∧ a ≠ b ∧ IsFreeSet Γ.toHypergraph T θ {a, b} := by + obtain ⟨hT, K, ins, hK, hd, heq⟩ := hm + have hfE : f ∈ Γ.E := (walkDrawing_isSubdrawing Γ W).2 + ((walkDrawing_E Γ W).symm ▸ hf) + have hfA : f ∈ Γ.A := Or.inl (Or.inr hfE) + rw [heq g₁ (Or.inl (Or.inr hg₁)) f hfA] at hd₁ + rw [heq g₂ (Or.inl (Or.inr hg₂)) f hfA] at hd₂ + exact free_path_edge_of_distant_ends hS hT hθ hK hd W hW hg₁ hg₂ hx hy hf hd₁ hd₂ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4FreeSingleton.lean b/LeanPool/GraphMinor/GM12/Section4FreeSingleton.lean new file mode 100644 index 0000000000..045a5a5746 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4FreeSingleton.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM12.Section4PathExists +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# A single drawing vertex is free + +XII (4.4), page 251, uses that each singleton boundary vertex set +is free because the drawing is connected. If a separation of order +zero has a vertex on its small side, every incident edge stays on +that side. Propagate along walks in the connected drawing. All +vertices would lie on the small side, contrary to the third tangle +axiom. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM10 GM14 Hypergraph + +/-- The singleton freeness assertion in XII (4.4), page 251. -/ +theorem isFreeSet_singleton_of_respectful_drawing + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsRespectfulDrawingTangle Γ θ T) {v : S} (hv : v ∈ Γ.V) : + IsFreeSet Γ.toHypergraph T θ {v} := by + refine ⟨singleton_subset_iff.mpr hv, ?_, ?_⟩ + · simpa only [ncard_singleton] using hT.2.1.one_le + · intro A B hmem hsub + rw [ncard_singleton] + by_contra hbound + have hzero : separationOrder A B = 0 := Nat.eq_zero_of_not_pos hbound + have hsep := hT.2.1.isSeparation hmem + have hempty : (A ∩ B).vertexSet = ∅ := + (Set.ncard_eq_zero (A ∩ B).vertexSet_finite).mp hzero + have hnotboth : ∀ x, x ∈ A.vertexSet → x ∈ B.vertexSet → False := by + intro x hxA hxB + have hx : x ∈ (A ∩ B).vertexSet := ⟨hxA, hxB⟩ + rw [hempty] at hx + exact hx.elim + have hwalk : ∀ {x y : S}, GraphWalk Γ.toGraph x y → x ∈ A.vertexSet → y ∈ A.vertexSet := by + intro x y W + induction W with + | nil => exact id + | @cons x y z e hl W ih => + intro hxA + have hxInc : Γ.toHypergraph.Inc e x := + ⟨hl.1, hl.2.1, ((hl.2.2.2).symm.subset (Or.inl rfl)).1⟩ + have hyInc : Γ.toHypergraph.Inc e y := + ⟨hl.1, hl.2.2.1, ((hl.2.2.2).symm.subset (Or.inr rfl)).1⟩ + have heAB : e ∈ A.edgeSet ∪ B.edgeSet := by rw [hsep.edgeSet_union]; exact hl.1 + apply ih + rcases heAB with heA | heB + · exact A.vertex_mem_of_inc ((inc_iff_of_le hsep.left_le heA).mpr hyInc) + · exact False.elim (hnotboth x hxA + (B.vertex_mem_of_inc ((inc_iff_of_le hsep.right_le heB).mpr hxInc))) + have hVA : Γ.V ⊆ A.vertexSet := by + intro x hx + obtain ⟨W⟩ := exists_walk_of_open_disc_regions hS hT.1.2 hv hx + exact hwalk W (hsub (mem_singleton v)) + exact hT.2.1.axiom3 hmem (hsep.left_le.vertexSet_subset.antisymm hVA) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4GeneralPositionPorts.lean b/LeanPool/GraphMinor/GM12/Section4GeneralPositionPorts.lean new file mode 100644 index 0000000000..cfc4467b85 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4GeneralPositionPorts.lean @@ -0,0 +1,84 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CirclePortIntervals +public import LeanPool.GraphMinor.GM12.Section4ChordFamily + +/-! +# Ordered ports with chords in general position + +For XII (4.5), page 253, prescribe the order of all edge ends +around the circle and an open neighborhood for each vertex block. +Choose disjoint ordered port intervals in these neighborhoods, +then choose the chords inside their intervals. The port order is +retained, the supporting lines are distinct, and no three of them +meet. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Choose all ports of a finite chord family in their assigned +order and neighborhoods, with no triple intersections of supporting +lines. This combines the order and perturbation choices for the +source crossing drawing in XII (4.5), page 253. -/ +theorem exists_ordered_general_position_ports {n : ℕ} + (ρ : (Fin n × Bool) ≃ Fin (2 * n)) + (c : Fin (2 * n) → ℝ) (hc : Monotone c) (hc01 : ∀ i, c i ∈ Ioo 0 1) + (O : Fin (2 * n) → Set ℂ) (hO : ∀ i, IsOpen (O i)) + (hcO : ∀ i, (ee (c i) : ℂ) ∈ O i) : + ∃ p : Fin n × Bool → ℝ, + (∀ x, p x ∈ Ioo 0 1 ∧ (ee (p x) : ℂ) ∈ O (ρ x)) ∧ + (∀ x y, ρ x < ρ y → p x < p y) ∧ + Function.Injective (fun x => (ee (p x) : ℂ)) ∧ + (∀ i j, i ≠ j → + line[ℝ, (ee (p (i, false)) : ℂ), (ee (p (i, true)) : ℂ)] ≠ + line[ℝ, (ee (p (j, false)) : ℂ), (ee (p (j, true)) : ℂ)]) ∧ + ∀ i j k, i ≠ j → j ≠ k → i ≠ k → ∀ x : ℂ, + ¬ (x ∈ line[ℝ, (ee (p (i, false)) : ℂ), (ee (p (i, true)) : ℂ)] ∧ + x ∈ line[ℝ, (ee (p (j, false)) : ℂ), (ee (p (j, true)) : ℂ)] ∧ + x ∈ line[ℝ, (ee (p (k, false)) : ℂ), (ee (p (k, true)) : ℂ)]) := by + obtain ⟨u, v, huv, horder⟩ := exists_ordered_circle_port_intervals c hc hc01 O hO hcO + obtain ⟨s, t, hst, hne, hthree⟩ := exists_chord_family_in_arcs n + (fun i => u (ρ (i, false))) (fun i => v (ρ (i, false))) + (fun i => u (ρ (i, true))) (fun i => v (ρ (i, true))) + (fun i => (huv _).2.1) (fun i => by linarith [(huv (ρ (i, false))).1, (huv (ρ + (i, false))).2.2.1]) + (fun i => (huv _).2.1) (fun i => by linarith [(huv (ρ (i, true))).1, (huv (ρ (i, true))).2.2.1]) + let p : Fin n × Bool → ℝ := fun x => if x.2 then t x.1 else s x.1 + have hpinterval : ∀ x, p x ∈ Ioo (u (ρ x)) (v (ρ x)) := by + rintro ⟨i, b⟩ + cases b + · exact (hst i).1 + · exact (hst i).2.1 + have hp01 : ∀ x, p x ∈ Ioo (0 : ℝ) 1 := fun x => + ⟨lt_of_le_of_lt (huv _).1 (hpinterval x).1, + lt_of_lt_of_le (hpinterval x).2 (huv _).2.2.1⟩ + have hporder : ∀ x y, ρ x < ρ y → p x < p y := fun x y hxy => + (hpinterval x).2.trans ((horder _ _ hxy).trans (hpinterval y).1) + refine ⟨p, ?_, hporder, ?_, ?_, ?_⟩ + · intro x + have hi := hpinterval x + exact ⟨hp01 x, (huv _).2.2.2 _ hi⟩ + · intro x y hxy + have hparam : p x = p y := ee_injOn_short_interval (by norm_num : (1 : ℝ) ≤ 0 + 1) + (hp01 x) (hp01 y) (Subtype.ext hxy) + apply ρ.injective + rcases lt_trichotomy (ρ x) (ρ y) with h | h | h + · exact False.elim ((hporder x y h).ne hparam) + · exact h + · exact False.elim ((hporder y x h).ne hparam.symm) + · simpa only [p, Bool.false_eq_true, ↓reduceIte] using hne + · simpa only [p, Bool.false_eq_true, ↓reduceIte] using hthree + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4HalfEdgeFeasibility.lean b/LeanPool/GraphMinor/GM12/Section4HalfEdgeFeasibility.lean new file mode 100644 index 0000000000..be7df7c6e2 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4HalfEdgeFeasibility.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4ClippedHalfEdges +public import LeanPool.GraphMinor.GM12.Section4ResidualStarDiscs + +/-! +# Feasible endpoint classes from a crossing half-edge system + +For XII (4.5), claim (1), page 253, clip the source half-edges +outside the crossing discs and thicken each vertex star. The +contacts of each resulting vertex disc are exactly the ends +assigned to that vertex. Ends of different residual half-edges +are distinct, since the residual arcs are disjoint. This gives +the source endpoint partition together with its disc witnesses. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A half-edge system meeting only at its source vertices or +inside the crossing-disc set yields disjoint vertex discs whose +contacts are exactly the assigned, distinct half-edge ends. +This combines the source clipping and thickening steps of +XII (4.5), claim (1), page 253. -/ +theorem exists_halfedge_contact_discs + {S V ι : Type} [TopologicalSpace S] [T2Space S] [NormalSpace S] [ConnectedSpace S] + [Finite V] [Finite ι] + (hS : IsClosedSurface S) (v : V → S) (hinj : Function.Injective v) + (owner : ι → V) (x : ι → S) (L : ι → Set S) + (hL : ∀ i, IsLineWithEnds (L i) (v (owner i)) (x i)) + (hLV : ∀ i w, v w ∈ L i → w = owner i) + (hLL : ∀ i j, i ≠ j → L i ∩ L j ⊆ range v ∪ range x) + (Z : Set S) (hZ : IsClosed Z) (hvZ : ∀ w, v w ∉ Z) + (hxZ : ∀ i, x i ∈ interior Z) : + ∃ q : ι → S, Function.Injective q ∧ (∀ i, q i ∈ L i ∩ frontier Z) ∧ + ∃ D : V → Set S, (∀ w, IsClosedDisc (D w)) ∧ + (∀ w z, w ≠ z → Disjoint (D w) (D z)) ∧ + ∀ w, D w ∩ Z = {z | ∃ i, owner i = w ∧ q i = z} := by + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite ι + obtain ⟨A, b, hA, hAA, hAZ, hb, hbb, hb0, hb1, hcontact, hsub, hfront⟩ := + exists_clipped_halfedge_family hS v hinj owner x L hL hLV hLL Z hZ hvZ hxZ + obtain ⟨D, hD, hDD, -, hDZ⟩ := exists_residual_star_discs hS A owner b Z hA hAA hZ hAZ + hb hbb hb0 hb1 hcontact + have hq : Function.Injective (fun i => b i 1) := by + intro i j hij + by_contra hne + exact disjoint_left.mp (hbb i j hne) (mem_range_self 1) + ⟨1, hij.symm⟩ + exact ⟨(fun i => b i 1), hq, (fun i => ⟨hsub i (mem_range_self 1), hfront i⟩), D, hD, hDD, hDZ⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4HamiltonChordCrossing.lean b/LeanPool/GraphMinor/GM12/Section4HamiltonChordCrossing.lean new file mode 100644 index 0000000000..c60f9dccf6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4HamiltonChordCrossing.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4WrappedChordCrossing +public import LeanPool.GraphMinor.GM12.Section4HamiltonPorts + +/-! +# A later port crosses the outgoing Hamilton chord + +In the source construction for XII (4.5), page 252, non-Hamilton +ports follow the outgoing Hamilton port in each vertex block. +The outgoing Hamilton chord ends in the next block. An edge from +a later port of the first block to any other block therefore +crosses it. Adding one turn handles the last vertex block. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- An edge from a later port to a different, non-successor block +crosses the outgoing Hamilton chord. This supplies the crossing +witness for Hamilton edges in XII (4.5)(vi), page 252. -/ +theorem hamilton_chord_crosses_later_port {p : ℕ} + (F : Fin p → Fin p → ℝ) (hF : ∀ v w, F v w ∈ Ioo 0 1) + (hblocks : ∀ v w i j, v < i → F v w < F i j) + {v w : Fin p} (hwv : w ≠ v) (hwnext : w ≠ finRotate p v) + (hlater : F v (finRotate p v) < F v w) : + (segment ℝ (ee (F v (finRotate p v)) : ℂ) (ee (F (finRotate p v) v) : ℂ) ∩ + segment ℝ (ee (F v w) : ℂ) (ee (F w v) : ℂ)).Nonempty := by + cases p with + | zero => exact v.elim0 + | succ q => + by_cases hvlast : v = Fin.last q + · have hnext : finRotate (q + 1) v = 0 := by rw [hvlast, finRotate_last] + have hwpos : (0 : Fin (q + 1)) < w := by + have hwzero : w ≠ 0 := by simpa only [hnext] using hwnext + change 0 < w.val + have hwval : w.val ≠ 0 := fun h => hwzero (Fin.ext h) + omega + have hwlt : w < v := by + rw [hvlast] + exact Fin.lt_last_iff_ne_last.mpr (by simpa only [← hvlast] using hwv) + have h := ordered_chords_inter hlater + (c := F (finRotate (q + 1) v) v + 1) (d := F w v + 1) + (by linarith [(hF v w).2, (hF (finRotate (q + 1) v) v).1]) + (by have hh := hblocks 0 v w v hwpos; rw [hnext]; linarith) + (by have hh := hblocks w v v (finRotate (q + 1) v) hwlt; linarith) + rw [ee_add_one, ee_add_one] at h + exact h + · have hvnext : v < finRotate (q + 1) v := (lt_finRotate_iff_ne_last v).mpr hvlast + apply chords_inter_of_inside_outside_ports hlater + (hblocks v w (finRotate (q + 1) v) v hvnext) + (hF v (finRotate (q + 1) v)).1.le (hF (finRotate (q + 1) v) v).2 + ⟨(hF w v).1.le, (hF w v).2⟩ + rcases lt_or_gt_of_ne hwv with hwlt | hvw + · exact Or.inl (hblocks w v v (finRotate (q + 1) v) hwlt) + · have hnextval := coe_finRotate_of_ne_last hvlast + have hneval : w.val ≠ (finRotate (q + 1) v).val := fun h => hwnext (Fin.ext h) + have hnextlt : finRotate (q + 1) v < w := by + change (finRotate (q + 1) v).val < w.val + have hvwval : v.val < w.val := hvw + omega + exact Or.inr (hblocks (finRotate (q + 1) v) v w v hnextlt) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4HamiltonChordSeparation.lean b/LeanPool/GraphMinor/GM12/Section4HamiltonChordSeparation.lean new file mode 100644 index 0000000000..75fe632eea --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4HamiltonChordSeparation.lean @@ -0,0 +1,102 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4ChordSeparation +public import LeanPool.GraphMinor.GM12.Section4HamiltonPorts +import Mathlib.Tactic.Ring + +/-! +# The two Hamilton chords do not cross + +The incoming port precedes the outgoing port in every vertex +block in the crossing drawing of XII (4.5), page 252. For three +successive vertex blocks, the incoming and outgoing chords at +the middle block have nonalternating ports. This remains true +when the blocks wrap around the end of the chosen full turn. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Nested pairs of circle ports also give disjoint chords. This +is the full-turn wrap case of the separation test for XII (4.5), +page 252. -/ +theorem nested_ordered_chords_disjoint {a b c d : ℝ} + (hab : a < b) (hbc : b < c) (hcd : c < d) (hda : d < a + 1) : + Disjoint (segment ℝ (ee a : ℂ) (ee d : ℂ)) + (segment ℝ (ee b : ℂ) (ee c : ℂ)) := by + have h := ordered_chords_disjoint + (a := d - 1) (c := a) (b := b) (d := c) + (by linarith) hab hbc (by linarith) + have hd : ee (d - 1) = ee d := ee_eq_iff.mpr ⟨-1, by push_cast; ring⟩ + rw [hd, segment_symm ℝ (ee d : ℂ) (ee a : ℂ)] at h + exact h + +/-- The Hamilton chords at the middle of three cyclically +successive vertex blocks are disjoint. This proves the local +noncrossing assertion used for XII (4.5)(vii), page 252. -/ +theorem hamilton_chords_disjoint_of_cyclic_order {p : ℕ} + (a b : Fin p → ℝ) (ha : ∀ i, a i ∈ Ioo 0 1) (hb : ∀ i, b i ∈ Ioo 0 1) + (hab : ∀ i, a i < b i) (hblocks : ∀ i j, i < j → b i < a j) + {u v w : Fin p} + (hcyclic : (u < v ∧ v < w) ∨ (v < w ∧ w < u) ∨ (w < u ∧ u < v)) : + Disjoint (segment ℝ (ee (b u) : ℂ) (ee (a v) : ℂ)) + (segment ℝ (ee (b v) : ℂ) (ee (a w) : ℂ)) := by + rcases hcyclic with ⟨huv, hvw⟩ | ⟨hvw, hwu⟩ | ⟨hwu, huv⟩ + · exact ordered_chords_disjoint (hblocks u v huv) (hab v) (hblocks v w hvw) + (by linarith [(hb u).1, (ha w).2]) + · have h := nested_ordered_chords_disjoint (hab v) (hblocks v w hvw) + ((hab w).trans ((hblocks w u hwu).trans (hab u))) + (by linarith [(ha v).1, (hb u).2]) + rw [segment_symm ℝ (ee (a v) : ℂ) (ee (b u) : ℂ)] at h + exact h + · have h := nested_ordered_chords_disjoint + ((hab w).trans ((hblocks w u hwu).trans (hab u))) (hblocks u v huv) (hab v) + (by linarith [(ha w).1, (hb v).2]) + rw [segment_symm ℝ (ee (a w) : ℂ) (ee (b v) : ℂ)] at h + exact h.symm + +/-- The two Hamilton chords incident with every vertex are +disjoint. This verifies the chord part of XII (4.5)(vii), page 252, +without an extra cyclic-order assumption. -/ +theorem hamilton_chords_disjoint {p : ℕ} (hp : 3 ≤ p) + (a b : Fin p → ℝ) (ha : ∀ i, a i ∈ Ioo 0 1) (hb : ∀ i, b i ∈ Ioo 0 1) + (hab : ∀ i, a i < b i) (hblocks : ∀ i j, i < j → b i < a j) (v : Fin p) : + Disjoint (segment ℝ (ee (b ((finRotate p).symm v)) : ℂ) (ee (a v) : ℂ)) + (segment ℝ (ee (b v) : ℂ) (ee (a (finRotate p v)) : ℂ)) := + hamilton_chords_disjoint_of_cyclic_order a b ha hb hab hblocks + (finRotate_neighbors_cyclic_order hp v) + +/-- The vertex-pair coordinates with Hamilton priorities give +disjoint incoming and outgoing Hamilton chords at every vertex. +This is condition (vii) for the inner chords in XII (4.5), page 252. -/ +theorem hamilton_matrix_chords_disjoint {p : ℕ} (hp : 3 ≤ p) + (F : Fin p → Fin p → ℝ) (hF : ∀ v w, F v w ∈ Ioo 0 1) + (hblocks : ∀ v w i j, v < i → F v w < F i j) + (hpriority : ∀ v w z, hamiltonPortPriority v w < hamiltonPortPriority v z → F v w < F v z) + (v : Fin p) : + Disjoint + (segment ℝ (ee (F ((finRotate p).symm v) v) : ℂ) (ee (F v ((finRotate p).symm v)) : ℂ)) + (segment ℝ (ee (F v (finRotate p v)) : ℂ) (ee (F (finRotate p v) v) : ℂ)) := by + have hlocal : ∀ i, F i ((finRotate p).symm i) < F i (finRotate p i) := by + intro i + apply hpriority + rw [hamiltonPortPriority_predecessor, hamiltonPortPriority_successor hp] + decide + have h := hamilton_chords_disjoint hp + (fun i => F i ((finRotate p).symm i)) (fun i => F i (finRotate p i)) + (fun i => hF _ _) (fun i => hF _ _) hlocal + (fun i j hij => hblocks _ _ _ _ hij) v + simpa only [Equiv.apply_symm_apply, Equiv.symm_apply_apply] using h + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4HamiltonCrossingWitness.lean b/LeanPool/GraphMinor/GM12/Section4HamiltonCrossingWitness.lean new file mode 100644 index 0000000000..8c15d1ab43 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4HamiltonCrossingWitness.lean @@ -0,0 +1,103 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4HamiltonChordCrossing +import Mathlib.Data.Finset.Card +import Mathlib.Data.Fintype.Card + +/-! +# Crossing witnesses for Hamilton chords + +For XII (4.5), page 252, each vertex of a clique on at least four +vertices has a neighbor other than itself and its two Hamilton +neighbors. Its port follows the outgoing Hamilton port. The chord +to that neighbor therefore crosses the outgoing Hamilton chord. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A clique vertex has a non-Hamilton neighbor once there are +at least four vertices. This supplies the witness for the Hamilton +edges in XII (4.5)(vi), page 252. -/ +theorem exists_nonHamilton_neighbor {p : ℕ} (hp : 4 ≤ p) (v : Fin p) : + ∃ w : Fin p, w ≠ v ∧ w ≠ (finRotate p).symm v ∧ w ≠ finRotate p v := by + classical + by_contra hnone + have hcover : (Finset.univ : Finset (Fin p)) ⊆ + {v, (finRotate p).symm v, finRotate p v} := by + intro w _ + by_cases hwv : w = v + · simp [hwv] + by_cases hwpre : w = (finRotate p).symm v + · simp [hwpre] + by_cases hwnext : w = finRotate p v + · simp [hwnext] + exact False.elim (hnone ⟨w, hwv, hwpre, hwnext⟩) + have hcard := Finset.card_le_card hcover + have hfirst := Finset.card_insert_le v ({(finRotate p).symm v, finRotate p v} : Finset (Fin p)) + have hsecond := Finset.card_insert_le ((finRotate p).symm v) ({finRotate p v} : Finset (Fin p)) + simp only [Finset.card_univ, Fintype.card_fin] at hcard + simp only [Finset.card_singleton] at hsecond + omega + +/-- With the prescribed Hamilton port priorities, every outgoing +Hamilton chord has a crossing chord. This proves the Hamilton-edge +case of XII (4.5)(vi), page 252. -/ +theorem exists_crossing_chord_for_Hamilton {p : ℕ} (hp : 4 ≤ p) + (F : Fin p → Fin p → ℝ) (hF : ∀ v w, F v w ∈ Ioo 0 1) + (hblocks : ∀ v w i j, v < i → F v w < F i j) + (hpriority : ∀ v w z, hamiltonPortPriority v w < hamiltonPortPriority v z → F v w < F v z) + (v : Fin p) : + ∃ w : Fin p, w ≠ v ∧ w ≠ (finRotate p).symm v ∧ w ≠ finRotate p v ∧ + (segment ℝ (ee (F v (finRotate p v)) : ℂ) (ee (F (finRotate p v) v) : ℂ) ∩ + segment ℝ (ee (F v w) : ℂ) (ee (F w v) : ℂ)).Nonempty := by + obtain ⟨w, hwv, hwpre, hwnext⟩ := exists_nonHamilton_neighbor hp v + have hprio := (hamiltonPortPriority_order (by omega : 3 ≤ p) hwpre hwnext).2 + exact ⟨w, hwv, hwpre, hwnext, + hamilton_chord_crosses_later_port F hF hblocks hwv hwnext + (hpriority v (finRotate p v) w hprio)⟩ + +/-- Every clique chord has a different crossing chord under the +Hamilton port priorities. The witness shares one vertex and has +its other vertex outside the original pair. This proves condition +(vi) of the source crossing construction for XII (4.5), page 252. -/ +theorem every_clique_chord_has_crossing {p : ℕ} (hp : 4 ≤ p) + (F : Fin p → Fin p → ℝ) (hF : ∀ v w, F v w ∈ Ioo 0 1) + (hblocks : ∀ v w i j, v < i → F v w < F i j) + (hpriority : ∀ v w z, hamiltonPortPriority v w < hamiltonPortPriority v z → F v w < F v z) + {v w : Fin p} (hvw : v ≠ w) : + ∃ x y : Fin p, x ≠ y ∧ y ≠ v ∧ y ≠ w ∧ (x = v ∨ x = w) ∧ + (segment ℝ (ee (F v w) : ℂ) (ee (F w v) : ℂ) ∩ + segment ℝ (ee (F x y) : ℂ) (ee (F y x) : ℂ)).Nonempty := by + by_cases hwnext : w = finRotate p v + · subst w + obtain ⟨z, hzv, _, hznext, hcross⟩ := exists_crossing_chord_for_Hamilton hp F hF hblocks + hpriority v + exact ⟨v, z, hzv.symm, hzv, hznext, Or.inl rfl, hcross⟩ + · by_cases hwpre : w = (finRotate p).symm v + · have hnextw : finRotate p w = v := by rw [hwpre, Equiv.apply_symm_apply] + obtain ⟨z, hzw, _, hznext, hcross⟩ := exists_crossing_chord_for_Hamilton hp F hF hblocks + hpriority w + have hzv : z ≠ v := by simpa only [hnextw] using hznext + rw [hnextw, segment_symm ℝ (ee (F w v) : ℂ) (ee (F v w) : ℂ)] at hcross + exact ⟨w, z, hzw.symm, hzv, hzw, Or.inr rfl, hcross⟩ + · have hprio := (hamiltonPortPriority_order (by omega : 3 ≤ p) hwpre hwnext).2 + have hcross := hamilton_chord_crosses_later_port F hF hblocks hvw.symm hwnext + (hpriority v (finRotate p v) w hprio) + obtain ⟨z, hzham, hzedge⟩ := hcross + refine ⟨v, finRotate p v, ?_, ?_, (fun h => hwnext h.symm), Or.inl rfl, z, hzedge, hzham⟩ + · exact (finRotate_ne_self_of_two_le (by omega : 2 ≤ p) v).symm + · exact finRotate_ne_self_of_two_le (by omega : 2 ≤ p) v + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4HamiltonPorts.lean b/LeanPool/GraphMinor/GM12/Section4HamiltonPorts.lean new file mode 100644 index 0000000000..a863f9b750 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4HamiltonPorts.lean @@ -0,0 +1,134 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Logic.Equiv.Fin.Rotate +public import Mathlib.Order.Fin.Basic +import Mathlib.Data.Fin.Basic + +/-! +# The two Hamilton ports at a vertex + +XII (4.5), page 252: "To see this, first draw a Hamilton circuit +without crossings, and then add the remaining edges to the drawing, +so that (i)–(vi) are satisfied. Then (vii) is satisfied too." + +Use the cyclic order of the vertices for this Hamilton circuit. +In each vertex block, put the incoming Hamilton port first and the +outgoing Hamilton port second. The other ports come after them. +For at least three vertices the two Hamilton neighbors are distinct. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +/-- Local port priorities for the Hamilton circuit in the source +crossing drawing of XII (4.5), page 252. The predecessor port comes +first, the successor port second, and all other ports after them. -/ +def hamiltonPortPriority {p : ℕ} (v w : Fin p) : ℕ := + if w = (finRotate p).symm v then 0 else if w = finRotate p v then 1 else 2 + +/-- A cyclic successor differs from its vertex when there are at +least two vertices. -/ +theorem finRotate_ne_self_of_two_le {p : ℕ} (hp : 2 ≤ p) (v : Fin p) : + finRotate p v ≠ v := by + let : NeZero p := ⟨by omega⟩ + intro h + rw [finRotate_apply] at h + have h01 : (1 : Fin p) = 0 := add_left_cancel (show v + 1 = v + 0 by simpa using h) + have hval := congrArg Fin.val h01 + have h1 : (1 : ℕ) < p := by omega + simp [Nat.mod_eq_of_lt h1] at hval + +/-- A cyclic predecessor differs from its vertex when there are +at least two vertices. -/ +theorem finRotate_predecessor_ne_self_of_two_le {p : ℕ} (hp : 2 ≤ p) (v : Fin p) : + (finRotate p).symm v ≠ v := by + intro h + have heq := congrArg (finRotate p) h + rw [Equiv.apply_symm_apply] at heq + exact finRotate_ne_self_of_two_le hp v heq.symm + +/-- The predecessor and successor in a Hamilton circuit are +distinct when the circuit has at least three vertices. -/ +theorem finRotate_predecessor_ne_successor {p : ℕ} (hp : 3 ≤ p) (v : Fin p) : + (finRotate p).symm v ≠ finRotate p v := by + let : NeZero p := ⟨by omega⟩ + intro h + have hrot := congrArg (finRotate p) h + rw [Equiv.apply_symm_apply, finRotate_apply, finRotate_apply] at hrot + have h02 : (0 : Fin p) = (1 : Fin p) + 1 := add_left_cancel + (show v + 0 = v + (1 + 1) by simpa only [add_zero, add_assoc] using hrot) + have hval := congrArg Fin.val h02 + have h2 : (2 : ℕ) < p := by omega + have h1 : (1 : ℕ) < p := by omega + simp [Fin.val_add, Nat.mod_eq_of_lt h1, Nat.mod_eq_of_lt h2] at hval + +/-- The incoming Hamilton port has first priority. -/ +theorem hamiltonPortPriority_predecessor {p : ℕ} (v : Fin p) : + hamiltonPortPriority v ((finRotate p).symm v) = 0 := by + simp only [hamiltonPortPriority, ↓reduceIte] + +/-- The outgoing Hamilton port has second priority. -/ +theorem hamiltonPortPriority_successor {p : ℕ} (hp : 3 ≤ p) (v : Fin p) : + hamiltonPortPriority v (finRotate p v) = 1 := by + simp only [hamiltonPortPriority, Ne.symm (finRotate_predecessor_ne_successor hp v), ↓reduceIte] + +/-- Every non-Hamilton port follows the two Hamilton ports. -/ +theorem hamiltonPortPriority_other {p : ℕ} {v w : Fin p} + (hpre : w ≠ (finRotate p).symm v) (hnext : w ≠ finRotate p v) : + hamiltonPortPriority v w = 2 := by + simp only [hamiltonPortPriority, hpre, hnext, ↓reduceIte] + +/-- The incoming port precedes the outgoing port, which precedes +each non-Hamilton port. These strict priorities specify the order +within each vertex block in XII (4.5), page 252. -/ +theorem hamiltonPortPriority_order {p : ℕ} (hp : 3 ≤ p) {v w : Fin p} + (hpre : w ≠ (finRotate p).symm v) (hnext : w ≠ finRotate p v) : + hamiltonPortPriority v ((finRotate p).symm v) < + hamiltonPortPriority v (finRotate p v) ∧ + hamiltonPortPriority v (finRotate p v) < hamiltonPortPriority v w := by + rw [hamiltonPortPriority_predecessor, hamiltonPortPriority_successor hp, + hamiltonPortPriority_other hpre hnext] + decide + +/-- Predecessor, vertex, and successor occur in cyclic order in +the Hamilton circuit, including its wrap at zero. -/ +theorem finRotate_neighbors_cyclic_order {p : ℕ} (hp : 3 ≤ p) (v : Fin p) : + ((finRotate p).symm v < v ∧ v < finRotate p v) ∨ + (v < finRotate p v ∧ finRotate p v < (finRotate p).symm v) ∨ + (finRotate p v < (finRotate p).symm v ∧ (finRotate p).symm v < v) := by + cases p with + | zero => omega + | succ q => + have hq : 2 ≤ q := by omega + have hprezero : (finRotate (q + 1)).symm (0 : Fin (q + 1)) = Fin.last q := by + apply (finRotate (q + 1)).injective + rw [Equiv.apply_symm_apply, finRotate_last] + by_cases hvzero : v = 0 + · subst v + right; left + rw [hprezero, finRotate_apply_zero] + have h1 : (1 : ℕ) < q + 1 := by omega + constructor <;> simp [Fin.lt_def, Nat.mod_eq_of_lt h1] + omega + · have hprev : (finRotate (q + 1)).symm v < v := + (finRotate_symm_lt_iff_ne_zero v).mpr hvzero + by_cases hvlast : v = Fin.last q + · right; right + refine ⟨?_, hprev⟩ + rw [hvlast, finRotate_last] + have hval := coe_finRotate_symm_of_ne_zero hvzero + change 0 < ((finRotate (q + 1)).symm (Fin.last q)).val + rw [← hvlast, hval, hvlast, Fin.val_last] + omega + · exact Or.inl ⟨hprev, (lt_finRotate_iff_ne_last v).mpr hvlast⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4IncidentEdges.lean b/LeanPool/GraphMinor/GM12/Section4IncidentEdges.lean new file mode 100644 index 0000000000..d69390462b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4IncidentEdges.lean @@ -0,0 +1,93 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM11.Walks +import Mathlib.Data.List.Chain + +/-! +# Distances between successive path edges + +XII (4.3), claims (2)--(4), page 250, uses the bound four for +two edges with a common end. Each edge is at distance at most two from +that end. The triangle inequality from XI (9.1) gives four. Applying +this at every vertex of a walk gives a chain of edge distances. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM14 + +/-- Two edges incident with one vertex are at distance at most four, +as used in XII (4.3), page 250. -/ +theorem incident_edges_distance_le_four + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + {e f : Set S} (he : e ∈ Γ.E) (hf : f ∈ Γ.E) + {v : S} (hv : v ∈ Γ.V) (hve : v ∈ closure e) (hvf : v ∈ closure f) : + d e f ≤ 4 := by + have h91 := GM11.gm15_theorem_9_1 Γ θ T d hS inferInstance hm + have hsym := h91.2.2.2.1 + have htri := h91.2.2.2.2.1 + have hvebound := h91.2.2.2.2.2.2 v hv e he hve + have hvfbound := h91.2.2.2.2.2.2 v hv f hf hvf + have hvA : ({v} : Set S) ∈ Γ.A := Or.inl (Or.inl ⟨v, hv, rfl⟩) + have heA : e ∈ Γ.A := Or.inl (Or.inr he) + have hfA : f ∈ Γ.A := Or.inl (Or.inr hf) + have ht := htri e heA {v} hvA f hfA + rw [hsym e heA {v} hvA] at ht + exact ht.trans (Nat.add_le_add hvebound hvfbound) + +/-- The initial edge and the edges of a walk form a chain with +successive distances at most four, as used in XII (4.3), claim (2). -/ +theorem walk_edges_distance_chain + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + {x y : S} (W : GraphWalk Γ.toGraph x y) + {e : Set S} (he : e ∈ Γ.E) (hx : x ∈ closure e) : + (e :: W.edges).IsChain (fun a b => d a b ≤ 4) := by + induction W generalizing e with + | nil hv => exact List.IsChain.singleton e + | @cons x z y f hl R ih => + rw [GraphWalk.edges_cons, List.isChain_cons_cons] + refine ⟨?_, ih hl.edge_mem ?_⟩ + · apply incident_edges_distance_le_four hS hm he hl.edge_mem hl.left_mem hx + have hx' : x ∈ closure f ∩ Γ.V := by rw [hl.2.2.2]; simp + exact hx'.1 + · have hz : z ∈ closure f ∩ Γ.V := by rw [hl.2.2.2]; simp + exact hz.1 + +/-- A nontrivial walk has a last edge incident with its terminal vertex. -/ +theorem exists_walk_edge_at_end {S : Type*} [TopologicalSpace S] + {Γ : Drawing S} {x y : S} (W : GraphWalk Γ.toGraph x y) + (hne : W.edges ≠ []) : ∃ e ∈ W.edges, y ∈ closure e := by + induction W with + | nil hv => exact False.elim (hne rfl) + | @cons x z y e hl R ih => + by_cases hR : R.edges = [] + · have hzy : z = y := by + cases R with + | nil hv => rfl + | cons h rest => simp only [GraphWalk.edges_cons, List.cons_ne_nil] at hR + refine ⟨e, List.mem_cons_self, ?_⟩ + have hz : z ∈ closure e ∩ Γ.V := by rw [hl.2.2.2]; simp + exact hzy ▸ hz.1 + · obtain ⟨f, hf, hy⟩ := ih hR + exact ⟨f, List.mem_cons_of_mem e hf, hy⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4InducedEmbedding.lean b/LeanPool/GraphMinor/GM12/Section4InducedEmbedding.lean new file mode 100644 index 0000000000..2385bc3f0b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4InducedEmbedding.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Induced +public import LeanPool.GraphMinor.GM15.Defs +import LeanPool.GraphMinor.GM12.Section4Theorem43 +import LeanPool.GraphMinor.GM12.Section4ExternalPathBranches +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# The identity embedding for an induced tangle + +XII Section 4, page 248, induces a tangle from a drawn subgraph to +its ambient graph by intersecting separations with that subgraph. +When vertex and edge names are already shared, the drawing +embedding is the identity. Its restricted separations are exactly +those intersections. Thus the induced tangle satisfies the control +relation used in the embedded versions of (4.3) and (4.4). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph Surface Hypergraph GM10 GM14 GM15 + +/-- For a literal graph inclusion of the drawing, the induced +tangle is a controlling tangle for the identity embedding. -/ +theorem exists_identity_embedding_induced_tangle + {S : Type*} [TopologicalSpace S] (Γ : Drawing S) {G : Graph S (Set S)} + (hV : G.vertexSet.Finite) (hE : G.edgeSet.Finite) (hΓG : Γ.toGraph ≤ G) + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph θ T) : + ∃ η : SpanEmbedding Γ G, η.imageGraph = Γ.toGraph ∧ (∀ x, η.vMap x = x) ∧ (∀ e, η.eMap e = e) ∧ + IsControllingTangle G Γ η θ θ + (inducedBySubgraph (Hypergraph.ofGraph G hV hE) Γ.toHypergraph θ T) T := by + let η : SpanEmbedding Γ G := { + imageGraph := Γ.toGraph + vMap := id + eMap := id + imageGraph_le := hΓG + bijOn_v := bijOn_id _ + bijOn_e := bijOn_id _ + inc_iff := by + intro e he v hv + have h := congrArg (fun H : Hypergraph S (Set S) => H.Inc e v) + (drawing_hypergraph_eq_ofGraph Γ).symm + change Γ.toGraph.Inc e v = Γ.toHypergraph.Inc e v at h + change Γ.toGraph.Inc e v ↔ v ∈ closure e + rw [h] + exact ⟨fun hi => hi.2.2, fun hi => ⟨he, hv, hi⟩⟩ } + have hsub : Γ.toHypergraph ≤ Hypergraph.ofGraph G hV hE := by + rw [drawing_hypergraph_eq_ofGraph Γ] + exact ofGraph_le_of_subgraph hV hE hΓG + have hTstar : IsGraphTangle G θ + (inducedBySubgraph (Hypergraph.ofGraph G hV hE) Γ.toHypergraph θ T) := + ⟨hV, hE, inducedBySubgraph_isTangle hsub hT⟩ + refine ⟨η, rfl, fun _ => rfl, fun _ => rfl, ⟨le_rfl, hTstar, hT, ?_⟩⟩ + intro A B hsep hord AH BH hRestr + have hAV := hRestr.2.1 + have hAE := hRestr.2.2.1 + have hBV := hRestr.2.2.2.1 + have hBE := hRestr.2.2.2.2 + change id '' AH.vertexSet = A.vertexSet ∩ Γ.V at hAV + change id '' AH.edgeSet = A.edgeSet ∩ Γ.E at hAE + change id '' BH.vertexSet = B.vertexSet ∩ Γ.V at hBV + change id '' BH.edgeSet = B.edgeSet ∩ Γ.E at hBE + rw [image_id] at hAV hAE hBV hBE + have hAH : AH = A ∩ Γ.toHypergraph := + eq_of_le_of_vertexSet_eq_of_edgeSet_eq hRestr.1.left_le + (inter_le_right hsep.left_le hsub) hAV hAE + have hBH : BH = B ∩ Γ.toHypergraph := + eq_of_le_of_vertexSet_eq_of_edgeSet_eq hRestr.1.right_le + (inter_le_right hsep.right_le hsub) hBV hBE + constructor + · intro hmem + rw [hAH, hBH] + exact hmem.2.2 + · intro hmem + refine ⟨hsep, hord, ?_⟩ + rwa [← hAH, ← hBH] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4IsoIncidence.lean b/LeanPool/GraphMinor/GM12/Section4IsoIncidence.lean new file mode 100644 index 0000000000..c7e998350f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4IsoIncidence.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Statement + +/-! +# Incidences under the target's finite relabelling + +In XII (4.3), page 249, the loopless minimum-degree-two target +is enumerated by finite vertex and edge labels. An isomorphism +preserves incidences, loops, and the existence of two distinct +incident edges. These facts transfer the replacement's properties +to its finite labelled graph. +-/ + +public section + +namespace GraphMinor.GM12 + +/-- A graph isomorphism preserves incidence, as used when labelling +the target of XII (4.3), page 249. -/ +theorem iso_inc_iff {α β γ δ : Type*} {L : Graph α β} {G : Graph γ δ} + (φ : Iso L G) (e : L.edgeSet) (v : L.vertexSet) : + L.Inc e.val v.val ↔ G.Inc (φ.edgeEquiv e).val (φ.vertexEquiv v).val := by + constructor + · rintro ⟨w, hl⟩ + exact ⟨(φ.vertexEquiv ⟨w, hl.right_mem⟩).val, + (φ.isLink_iff e v ⟨w, hl.right_mem⟩).mp hl⟩ + · rintro ⟨w, hl⟩ + let w' := φ.vertexEquiv.symm ⟨w, hl.right_mem⟩ + refine ⟨w'.val, (φ.isLink_iff e v w').mpr ?_⟩ + simpa only [w', φ.vertexEquiv.apply_symm_apply] using hl + +/-- Looplessness is preserved by graph isomorphism. -/ +theorem loopless_of_iso {α β γ δ : Type*} {L : Graph α β} {G : Graph γ δ} + (φ : Iso L G) (hG : ∀ e v, ¬ G.IsLink e v v) : + ∀ e v, ¬ L.IsLink e v v := by + intro e v hl + exact hG (φ.edgeEquiv ⟨e, hl.edge_mem⟩).val (φ.vertexEquiv ⟨v, hl.left_mem⟩).val + ((φ.isLink_iff ⟨e, hl.edge_mem⟩ ⟨v, hl.left_mem⟩ ⟨v, hl.left_mem⟩).mp hl) + +/-- The two-distinct-incident-edges condition is preserved by +isomorphism, as used for the replacement in XII (4.3), page 249. -/ +theorem two_incident_edges_of_iso {α β γ δ : Type*} {L : Graph α β} {G : Graph γ δ} + (φ : Iso L G) + (hG : ∀ v ∈ G.vertexSet, ∃ e f, e ≠ f ∧ G.Inc e v ∧ G.Inc f v) : + ∀ v ∈ L.vertexSet, ∃ e f, e ≠ f ∧ L.Inc e v ∧ L.Inc f v := by + intro v hv + obtain ⟨e, f, hef, he, hf⟩ := hG (φ.vertexEquiv ⟨v, hv⟩).val + (φ.vertexEquiv ⟨v, hv⟩).property + let e' := φ.edgeEquiv.symm ⟨e, he.edge_mem⟩ + let f' := φ.edgeEquiv.symm ⟨f, hf.edge_mem⟩ + refine ⟨e'.val, f'.val, ?_, ?_, ?_⟩ + · intro hval + have heq : e' = f' := Subtype.ext hval + have heq' := congrArg (fun q : L.edgeSet => (φ.edgeEquiv q).val) heq + exact hef (by simpa only [e', f', φ.edgeEquiv.apply_symm_apply] using heq') + · apply (iso_inc_iff φ e' ⟨v, hv⟩).mpr + simpa only [e', φ.edgeEquiv.apply_symm_apply] using he + · apply (iso_inc_iff φ f' ⟨v, hv⟩).mpr + simpa only [f', φ.edgeEquiv.apply_symm_apply] using hf + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4JoinedCollars.lean b/LeanPool/GraphMinor/GM12/Section4JoinedCollars.lean new file mode 100644 index 0000000000..f3ecb14da3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4JoinedCollars.lean @@ -0,0 +1,26 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.JoinedCollar +public import LeanPool.GraphMinor.GM12.Section4CollarRadius + +/-! +# Joining compatible inner and outer collars + +The joined collar gives the three nested discs in XII (4.3), claim (7), a common radius coordinate. +-/ + +public section + +namespace GraphMinor.GM12 + +export Surface (exists_joined_collar_coordinates) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4JoinedStarFamily.lean b/LeanPool/GraphMinor/GM12/Section4JoinedStarFamily.lean new file mode 100644 index 0000000000..9ce81a5edd --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4JoinedStarFamily.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4FiniteMarkedDiscJoin +public import Mathlib.Topology.Separation.Regular +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Disjoint joined vertex stars + +For XII (4.5), claim (1), page 253, thicken all vertex stars +without allowing different vertex discs to meet. First separate +the finitely many closed stars by disjoint open neighborhoods. +Join the arms of each star inside its own neighborhood. Each +joined disc has exactly the old star's contacts with the closed +set of crossing discs, and old boundary contacts remain on its +boundary. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +private theorem exists_disjoint_open_family {S V : Type*} [TopologicalSpace S] + [NormalSpace S] [Finite V] (K : V → Set S) (hK : ∀ v, IsClosed (K v)) + (hdisj : ∀ v w, v ≠ w → Disjoint (K v) (K w)) : + ∃ O : V → Set S, (∀ v, IsOpen (O v)) ∧ (∀ v, K v ⊆ O v) ∧ + ∀ v w, v ≠ w → Disjoint (O v) (O w) := by + classical + have hex : ∀ v w, ∃ U W : Set S, IsOpen U ∧ IsOpen W ∧ + K v ⊆ U ∧ K w ⊆ W ∧ (v ≠ w → Disjoint U W) := by + intro v w + by_cases hvw : v = w + · exact ⟨univ, univ, isOpen_univ, isOpen_univ, subset_univ _, subset_univ _, + fun h => False.elim (h hvw)⟩ + · obtain ⟨U, W, hU, hW, hv, hw, hUW⟩ := normal_separation (hK v) (hK w) (hdisj v w hvw) + exact ⟨U, W, hU, hW, hv, hw, fun _ => hUW⟩ + choose U W hU hW hKU hKW hUW using hex + let O := fun v => ⋂ w, U v w ∩ W w v + refine ⟨O, (fun v => isOpen_iInter_of_finite (fun w => (hU v w).inter (hW w v))), ?_, ?_⟩ + · intro v z hz + exact mem_iInter.mpr fun w => ⟨hKU v w hz, hKW w v hz⟩ + · intro v w hvw + exact (hUW v w hvw).mono + (fun z hz => (mem_iInter.mp hz w).1) + (fun z hz => (mem_iInter.mp hz v).2) + +/-- Disjoint finite stars of discs can be joined to disjoint +closed vertex discs, preserving their exact contacts with a +closed set. This is the vertex-disc assembly in XII (4.5), +claim (1), page 253. -/ +theorem exists_disjoint_joined_stars {S V ι : Type} [TopologicalSpace S] + [NormalSpace S] [Finite V] (hS : IsClosedSurface S) + (A : V → Set S) (B : ι → Set S) (p : ι → S) (F : V → Finset ι) + (hA : ∀ v, IsClosedDisc (A v)) (hB : ∀ v i, i ∈ F v → IsClosedDisc (B i)) + (hBB : ∀ v i, i ∈ F v → ∀ j ∈ F v, i ≠ j → Disjoint (B i) (B j)) + (hAB : ∀ v i, i ∈ F v → A v ∩ B i = {p i}) + (hpA : ∀ v i, i ∈ F v → p i ∈ discBd (A v)) + (hpB : ∀ v i, i ∈ F v → p i ∈ discBd (B i)) + (hstars : ∀ v w, v ≠ w → Disjoint + (A v ∪ ⋃ i ∈ F v, B i) (A w ∪ ⋃ i ∈ F w, B i)) + (Z : Set S) (hZ : IsClosed Z) (hpZ : ∀ v i, i ∈ F v → p i ∉ Z) : + ∃ D : V → Set S, (∀ v, IsClosedDisc (D v)) ∧ + (∀ v w, v ≠ w → Disjoint (D v) (D w)) ∧ + (∀ v, (A v ∪ ⋃ i ∈ F v, B i) ⊆ D v) ∧ + (∀ v, D v ∩ Z = (A v ∪ ⋃ i ∈ F v, B i) ∩ Z) ∧ + ∀ v, (discBd (A v) ∪ ⋃ i ∈ F v, discBd (B i)) ∩ Z ⊆ discBd (D v) := by + classical + have ht2 : T2Space S := hS.2.1 + have hclosed : ∀ v, IsClosed (A v ∪ ⋃ i ∈ F v, B i) := fun v => + (hA v).isClosed.union ((F v).finite_toSet.isClosed_biUnion (fun i hi => (hB v i hi).isClosed)) + obtain ⟨O, hO, hKO, hOO⟩ := exists_disjoint_open_family + (fun v => A v ∪ ⋃ i ∈ F v, B i) hclosed hstars + have hex : ∀ v, ∃ D : Set S, IsClosedDisc D ∧ (A v ∪ ⋃ i ∈ F v, B i) ⊆ D ∧ D ⊆ O v ∧ + D ∩ Z = (A v ∪ ⋃ i ∈ F v, B i) ∩ Z ∧ + (discBd (A v) ∪ ⋃ i ∈ F v, discBd (B i)) ∩ Z ⊆ discBd D := by + intro v + apply exists_finite_join_preserving_contacts hS (A v) (O v) B p (hA v) (hO v) + (fun z hz => hKO v (Or.inl hz)) (F v) Z hZ (hB v) (hBB v) (hAB v) (hpA v) (hpB v) + · intro i hi z hz + exact hKO v (Or.inr (mem_iUnion.mpr ⟨i, mem_iUnion.mpr ⟨hi, hz⟩⟩)) + · exact hpZ v + choose D hD hsub hDO hcontact hbd using hex + exact ⟨D, hD, (fun v w hvw => (hOO v w hvw).mono (hDO v) (hDO w)), hsub, hcontact, hbd⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4LinearCrossCoordinates.lean b/LeanPool/GraphMinor/GM12/Section4LinearCrossCoordinates.lean new file mode 100644 index 0000000000..a8818a891e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4LinearCrossCoordinates.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Analysis.Complex.Basic +import Mathlib.Tactic.FieldSimp +import Mathlib.Tactic.Ring + +/-! +# Linear coordinates for two crossing directions + +The small crossing discs in XII (4.5), page 253, use coordinates +where the two edge directions are the real and imaginary axes. +For two directions with nonzero real determinant, the map whose +columns are these directions is invertible. The explicit inverse +also proves continuity of both coordinate changes. +-/ + +public section + +namespace GraphMinor.GM12 + +/-- Two directions with nonzero real determinant are the images +of the two coordinate axes under a continuous real-linear +equivalence. This supplies the local crossing coordinates in +XII (4.5), page 253. -/ +theorem exists_linear_cross_coordinates {u v : ℂ} + (hdet : u.re * v.im - u.im * v.re ≠ 0) : + ∃ A : ℂ ≃L[ℝ] ℂ, A 1 = u ∧ A Complex.I = v := by + let D := u.re * v.im - u.im * v.re + have hD : D ≠ 0 := hdet + let L : ℂ →L[ℝ] ℂ := Complex.reCLM.smulRight u + Complex.imCLM.smulRight v + have hL : ∀ z, L z = z.re • u + z.im • v := fun _ => rfl + let r₁ : ℂ → ℝ := fun z => (v.im * z.re - v.re * z.im) / D + let r₂ : ℂ → ℝ := fun z => (u.re * z.im - u.im * z.re) / D + let R : ℂ → ℂ := fun z => ⟨r₁ z, r₂ z⟩ + have hleft : Function.LeftInverse R L := by + intro z + apply Complex.ext <;> + simp only [R, r₁, r₂, hL, Complex.add_re, Complex.add_im, + Complex.smul_re, Complex.smul_im, smul_eq_mul] <;> + field_simp [hD] <;> dsimp [D] <;> ring + have hright : Function.RightInverse R L := by + intro z + apply Complex.ext <;> + simp only [R, r₁, r₂, hL, Complex.add_re, Complex.add_im, + Complex.smul_re, Complex.smul_im, smul_eq_mul] <;> + field_simp [hD] <;> dsimp [D] <;> ring + let e : ℂ ≃ₗ[ℝ] ℂ := { + toLinearMap := L.toLinearMap + invFun := R + left_inv := hleft + right_inv := hright } + let A : ℂ ≃L[ℝ] ℂ := { + toLinearEquiv := e + continuous_toFun := L.continuous + continuous_invFun := by + change Continuous R + have hrepr : R = fun z => (r₁ z : ℂ) + (r₂ z : ℂ) * Complex.I := + funext fun z => Complex.mk_eq_add_mul_I _ _ + rw [hrepr] + dsimp [r₁, r₂] + fun_prop } + refine ⟨A, ?_, ?_⟩ + · change L 1 = u + rw [hL] + simp + · change L Complex.I = v + rw [hL] + simp + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4LocalCrossDiscs.lean b/LeanPool/GraphMinor/GM12/Section4LocalCrossDiscs.lean new file mode 100644 index 0000000000..74ae523dae --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4LocalCrossDiscs.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CrossDiscMarks +public import LeanPool.GraphMinor.GM12.Section4ChordGeometry + +/-! +# Boundary contacts for locally straight crossing arcs + +The source edges of XII (4.5), page 253, agree with straight +chords near each crossing. The part of a chord inside the open +unit disc agrees with its whole line. A sufficiently small +coordinate disc therefore meets each of the actual edge arcs +at the same two opposite boundary marks as its supporting line. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Surface + +/-- An edge whose part in the unit disc is a chord agrees with +its supporting line throughout the open unit disc. -/ +theorem edge_inter_openBall_eq_line_inter_openBall {E : Set ℂ} {a b : ℂ} + (ha : ‖a‖ = 1) (hb : ‖b‖ = 1) (hab : a ≠ b) + (hchord : E ∩ closedBall 0 1 = segment ℝ a b) : + E ∩ ball 0 1 = (line[ℝ, a, b] : Set ℂ) ∩ ball 0 1 := by + have hl := unit_chord_eq_line_inter_closedBall ha hb hab + ext z + constructor + · rintro ⟨hzE, hzB⟩ + have hz : z ∈ segment ℝ a b := hchord ▸ ⟨hzE, ball_subset_closedBall hzB⟩ + exact ⟨(show z ∈ (line[ℝ, a, b] : Set ℂ) ∩ closedBall 0 1 from hl.symm ▸ hz).1, hzB⟩ + · rintro ⟨hzL, hzB⟩ + have hz : z ∈ segment ℝ a b := hl ▸ ⟨hzL, ball_subset_closedBall hzB⟩ + exact ⟨(show z ∈ E ∩ closedBall 0 1 from hchord.symm ▸ hz).1, hzB⟩ + +private theorem restrict_inter_eq {E L U B : Set ℂ} + (h : E ∩ U = L ∩ U) (hB : B ⊆ U) : E ∩ B = L ∩ B := by + ext z + constructor + · rintro ⟨hz, hzB⟩ + exact ⟨(show z ∈ L ∩ U from h ▸ ⟨hz, hB hzB⟩).1, hzB⟩ + · rintro ⟨hz, hzB⟩ + exact ⟨(show z ∈ E ∩ U from h.symm ▸ ⟨hz, hB hzB⟩).1, hzB⟩ + +/-- Two arcs which are the coordinate lines near their crossing +have a small closed disc whose boundary contacts are exactly +the two opposite pairs. This supplies the local discs used in +XII (4.5), claim (1), page 253. -/ +theorem exists_local_cross_disc (A : ℂ ≃L[ℝ] ℂ) (x : ℂ) + {E F U : Set ℂ} (hU : IsOpen U) (hx : x ∈ U) + (hE : E ∩ U = (line[ℝ, x, x + A 1] : Set ℂ) ∩ U) + (hF : F ∩ U = (line[ℝ, x, x + A Complex.I] : Set ℂ) ∩ U) : + ∃ r : ℝ, 0 < r ∧ ∃ D : Set ℂ, + IsClosedDisc D ∧ D ⊆ U ∧ + E ∩ discBd D = {x + A (r • (1 : ℂ)), x + A ((-r) • (1 : ℂ))} ∧ + F ∩ discBd D = {x + A (r • Complex.I), x + A ((-r) • Complex.I)} ∧ + D = (fun z => x + A z) '' closedBall 0 r := by + obtain ⟨r, hr, hd, -, hsub⟩ := exists_small_cross_disc A x hU hx + let D := (fun z => x + A z) '' closedBall 0 r + have hbd : discBd D ⊆ U := (discBd_subset D).trans hsub + refine ⟨r, hr, D, hd, hsub, ?_, ?_, rfl⟩ + · exact (restrict_inter_eq hE hbd).trans + (cross_disc_line_boundary A x (by simp) hr) + · exact (restrict_inter_eq hF hbd).trans + (cross_disc_line_boundary A x Complex.norm_I hr) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4MarkedDiscJoin.lean b/LeanPool/GraphMinor/GM12/Section4MarkedDiscJoin.lean new file mode 100644 index 0000000000..c07382d75b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4MarkedDiscJoin.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.PlaneDisc +import LeanPool.GraphMinor.GM07.JoinDiscs + +/-! +# Joining source discs while preserving boundary contacts + +In the source feasibility construction of XII (4.5), claim (1), +page 253, the thin discs around residual edge halves are joined +to their vertex discs. When two discs meet at one boundary point, +round their union in a neighborhood of that point. Choose the +neighborhood inside a prescribed open set and away from the +closed set of crossing discs. This keeps all contacts with that +closed set, including their boundary status. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Joining two discs at a boundary point preserves their exact +contacts with any closed set avoiding that point. The joined +disc stays inside a prescribed open neighborhood. This is used +to thicken the vertex stars in XII (4.5), claim (1), page 253. -/ +theorem exists_join_preserving_contacts {S : Type} [TopologicalSpace S] + (hS : IsClosedSurface S) {A B U Z : Set S} {p : S} + (hA : IsClosedDisc A) (hB : IsClosedDisc B) (hAB : A ∩ B = {p}) + (hpA : p ∈ discBd A) (hpB : p ∈ discBd B) + (hU : IsOpen U) (hAU : A ⊆ U) (hBU : B ⊆ U) + (hZ : IsClosed Z) (hpZ : p ∉ Z) : + ∃ D : Set S, IsClosedDisc D ∧ A ∪ B ⊆ D ∧ D ⊆ U ∧ + D ∩ Z = (A ∪ B) ∩ Z ∧ (discBd A ∪ discBd B) ∩ Z ⊆ discBd D := by + obtain ⟨D, hd, hsub, hbound, -, hkeep, -⟩ := GM07.exists_join hS hA hB hAB hpA hpB + (hU.inter hZ.isOpen_compl) ⟨hAU (GM11.discBd_subset A hpA), hpZ⟩ + refine ⟨D, hd, hsub, ?_, ?_, ?_⟩ + · intro z hz + rcases hbound hz with h | h + · exact h.elim (fun hzA => hAU hzA) (fun hzB => hBU hzB) + · exact h.1 + · apply Subset.antisymm + · rintro z ⟨hzD, hzZ⟩ + rcases hbound hzD with hz | hz + · exact ⟨hz, hzZ⟩ + · exact False.elim (hz.2 hzZ) + · rintro z ⟨hz, hzZ⟩ + exact ⟨hsub hz, hzZ⟩ + · rintro z ⟨hz, hzZ⟩ + exact hkeep ⟨hz, fun h => h.2 hzZ⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4MarkedDiscMatch.lean b/LeanPool/GraphMinor/GM12/Section4MarkedDiscMatch.lean new file mode 100644 index 0000000000..777b5a6341 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4MarkedDiscMatch.lean @@ -0,0 +1,86 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collar +import LeanPool.GraphMinor.GM12.Section4ProtectedDiscMatch +import LeanPool.GraphMinor.GM12.Section4DiscMatch +import LeanPool.GraphMinor.GM12.Section4DiscTwist +import LeanPool.GraphMinor.GM12.Section4DiscEnlargement +import LeanPool.GraphMinor.Surface.Wedge + +/-! +# Matching a disc with two boundary marks + +XII (4.3), claim (7), page 251, requires the orientation of each +residual edge to be preserved. First match the whole disc while +fixing the previously placed discs. A circle homeomorphism sends +the two resulting boundary points to the assigned ordered pair. +Its collar extension supplies the boundary adjustment. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Match two ordered pairs of distinct boundary points as well as +their discs, fixing a disjoint protected disc family pointwise. -/ +theorem exists_marked_disc_match_fixing_discs + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (D : ι → Set S) (hD : ∀ i, IsClosedDisc (D i)) + (hDD : Pairwise (fun i j => Disjoint (D i) (D j))) + {A B : Set S} (hA : IsClosedDisc A) (hB : IsClosedDisc B) + (hAD : Disjoint A (⋃ i, D i)) (hBD : Disjoint B (⋃ i, D i)) + {a b a' b' : S} (ha : a ∈ discBd A) (hb : b ∈ discBd A) (hab : a ≠ b) + (ha' : a' ∈ discBd B) (hb' : b' ∈ discBd B) (hab' : a' ≠ b') : + ∃ e : S ≃ₜ S, e '' A = B ∧ e a = a' ∧ e b = b' ∧ + ∀ i z, z ∈ D i → e z = z := by + obtain ⟨f, hfA, hffix⟩ := exists_disc_match_fixing_discs hS D hD hDD hA hB hAD hBD + have hnonempty : Nonempty S := ⟨a⟩ + have hfbd := (isClosedDisc_image_injOn hA hA.isCompact f.continuous.continuousOn + f.injective.injOn).2 + rw [hfA] at hfbd + have hfa : f a ∈ discBd B := hfbd ▸ mem_image_of_mem f ha + have hfb : f b ∈ discBd B := hfbd ▸ mem_image_of_mem f hb + obtain ⟨p⟩ := hB.isOArc_discBd + let x := p.symm ⟨f a, hfa⟩ + let y := p.symm ⟨f b, hfb⟩ + let x' := p.symm ⟨a', ha'⟩ + let y' := p.symm ⟨b', hb'⟩ + have hxy : x ≠ y := by + intro h + exact hab (f.injective (congrArg Subtype.val (p.symm.injective h))) + have hxy' : x' ≠ y' := by + intro h + exact hab' (congrArg Subtype.val (p.symm.injective h)) + obtain ⟨q, hq, hqx, hqy⟩ := exists_circle_pair_move hxy hxy' + have hZ : IsClosed (⋃ i, D i) := isClosed_iUnion_of_finite fun i => (hD i).isClosed + obtain ⟨E, hE, hBE, hEZ⟩ := exists_disc_enlargement_avoiding hS hB hZ hBD + obtain ⟨k, hkB, hkmarks, hkfix⟩ := exists_boundary_twist + (fun z => (hS.2.2 z).isManifoldPoint) hB hE hBE p hq + have hkfa : k (f a) = a' := by + have h := hkmarks x + rw [hqx] at h + simpa only [x, x', p.apply_symm_apply] using h + have hkfb : k (f b) = b' := by + have h := hkmarks y + rw [hqy] at h + simpa only [y, y', p.apply_symm_apply] using h + refine ⟨f.trans k, ?_, hkfa, hkfb, ?_⟩ + · change (fun x => k (f x)) '' A = B + have h := congrArg (fun C => k '' C) hfA + simpa only [image_image, hkB] using h + · intro i z hz + change k (f z) = z + rw [hffix i z hz] + exact hkfix z (fun hzE => Set.disjoint_left.mp hEZ hzE (mem_iUnion.mpr ⟨i, hz⟩)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4MeetingImages.lean b/LeanPool/GraphMinor/GM12/Section4MeetingImages.lean new file mode 100644 index 0000000000..9e4c608862 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4MeetingImages.lean @@ -0,0 +1,68 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CrossingPoints +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Carrying the source crossings through an embedding + +In XII (4.5), page 252, the plane drawing is carried into the +surface. An injective map preserves every edge meeting and +creates none, including the exclusion of vertex points. Thus +the one-crossing equations transport exactly. A continuous +injective map also carries each simple edge arc to a simple +edge arc with the corresponding ends. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- An injective map preserves exactly the edge meetings away +from vertices. This carries the source crossing set into the +surface in XII (4.5), page 252. -/ +theorem edgeMeetingPoints_image {X Y V E : Type*} (f : X → Y) (hf : Function.Injective f) + (v : V → X) (P : E → Set X) : + edgeMeetingPoints (f ∘ v) (fun e => f '' P e) = f '' edgeMeetingPoints v P := by + ext z + constructor + · rintro ⟨i, j, hij, ⟨hzi, hzj⟩, hzV⟩ + obtain ⟨x, hxi, hxz⟩ := hzi + obtain ⟨y, hyj, hyz⟩ := hzj + have hyx : y = x := hf (hyz.trans hxz.symm) + have hxj : x ∈ P j := hyx ▸ hyj + refine ⟨x, ⟨i, j, hij, ⟨hxi, hxj⟩, ?_⟩, hxz⟩ + rintro ⟨w, hw⟩ + exact hzV ⟨w, (congrArg f hw).trans hxz⟩ + · rintro ⟨x, ⟨i, j, hij, hx, hxV⟩, rfl⟩ + refine ⟨i, j, hij, ⟨mem_image_of_mem _ hx.1, mem_image_of_mem _ hx.2⟩, ?_⟩ + rintro ⟨w, hw⟩ + exact hxV ⟨w, hf hw⟩ + +/-- The single-meeting equation of an edge is unchanged by an +injective map, with its selected meeting point carried along. -/ +theorem one_meeting_image {X Y V E : Type*} (f : X → Y) (hf : Function.Injective f) + (v : V → X) (P : E → Set X) {e : E} {x : X} + (h : P e ∩ edgeMeetingPoints v P = {x}) : + f '' P e ∩ edgeMeetingPoints (f ∘ v) (fun j => f '' P j) = {f x} := by + rw [edgeMeetingPoints_image f hf, ← image_inter hf, h, image_singleton] + +/-- A continuous injective map carries a simple arc to a simple +arc with the image endpoints. -/ +theorem isLineWithEnds_image_injective {X Y : Type*} [TopologicalSpace X] + [TopologicalSpace Y] [T2Space Y] (f : X → Y) (hf : Continuous f) + (hinj : Function.Injective f) {L : Set X} {a b : X} (hL : IsLineWithEnds L a b) : + IsLineWithEnds (f '' L) (f a) (f b) := + hL.image_under_injOn hf.continuousOn hinj.injOn + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4MetricExistence.lean b/LeanPool/GraphMinor/GM12/Section4MetricExistence.lean new file mode 100644 index 0000000000..ddd581fb9e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4MetricExistence.lean @@ -0,0 +1,41 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM11.RadialExists +import LeanPool.GraphMinor.GM11.Section64 + +/-! +# Choosing the metric of a respectful drawing tangle + +The hypothesis in XII (4.3), page 249, names a respectful tangle, +whose metric is used throughout the proof. Choose a radial drawing +and its derived inside function. The associated distance supplies +the metric data used by the free-edge selection argument. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM14 + +/-- The metric data associated to a respectful drawing tangle. -/ +theorem exists_metric_of_respectful_drawing_tangle + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsRespectfulDrawingTangle Γ θ T) : + ∃ d : Set S → Set S → ℕ, HasTangleMetric Γ θ T d := by + obtain ⟨K, hK⟩ := exists_radialDrawing hS hT.1 + obtain ⟨ins, hins⟩ := exists_derivedSlope_of_preRadial hT.2.2 hK.2.1 + exact ⟨tangleMetric Γ K ins θ, hT, K, ins, hK, hins, fun _ _ _ _ => rfl⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4Minor.lean b/LeanPool/GraphMinor/GM12/Section4Minor.lean new file mode 100644 index 0000000000..2e9a91c04e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4Minor.lean @@ -0,0 +1,100 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.Statement +import Mathlib.Combinatorics.Graph.Subgraph + +/-! +# Restricting a controlled minor model + +The deletion step in Graph Minors XII, (4.2), page 249, retains the branch +subgraphs and joining edges for the vertices and edges that remain. The +control condition is preserved because the target has fewer vertices. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Hypergraph + +/-- The subgraph case of Graph Minors XII, (4.2), page 249. Delete the unused +branches and joining edges from the model. This lemma does not handle edge +contractions or isomorphisms of the target. -/ +theorem theorem_4_2_subgraph {α β γ δ : Type*} {G : Hypergraph α β} + {θ : ℕ} {T : Set (Hypergraph α β × Hypergraph α β)} {L L' : Graph γ δ} + (hL : L ≤ L') (hfin : L'.vertexSet.Finite) (hc : ControlsMinor G θ T L') : + ControlsMinor G θ T L := by + obtain ⟨a, b, ha, hdisj, hlink, hloop, hinj, hcard, hcontrol⟩ := hc + have hcardL : L.vertexSet.ncard ≤ L'.vertexSet.ncard := + Set.ncard_le_ncard hL.vertexSet_mono hfin + refine ⟨a, b, ?_, ?_, ?_, ?_, ?_, hcardL.trans hcard, ?_⟩ + · intro v hv + exact ha v (hL.vertexSet_mono hv) + · intro u hu v hv huv + exact hdisj u (hL.vertexSet_mono hu) v (hL.vertexSet_mono hv) huv + · intro e u v he huv + exact hlink e u v ((hL.isLink_iff he.edge_mem).mp he) huv + · intro e v he + exact hloop e v ((hL.isLink_iff he.edge_mem).mp he) + · intro e he f hf hef + exact hinj e (hL.edgeSet_mono he) f (hL.edgeSet_mono hf) hef + · intro A B hm ho v hv + exact hcontrol A B hm (lt_of_lt_of_le ho hcardL) v (hL.vertexSet_mono hv) + +/-- The isomorphism step of Graph Minors XII, (4.2), page 249. Relabel the +branches and joining edges by the two bijections. A host edge label is needed +only to extend the edge map to unused target labels. -/ +theorem controlsMinor_of_iso {α β γ δ γ' δ' : Type*} [Nonempty β] + {G : Hypergraph α β} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} + {L : Graph γ δ} {L' : Graph γ' δ'} (φ : Iso L L') + (hc : ControlsMinor G θ T L') : ControlsMinor G θ T L := by + classical + obtain ⟨a, b, ha, hdisj, hlink, hloop, hinj, hcard, hcontrol⟩ := hc + let a' : γ → Hypergraph α β := fun v => + if hv : v ∈ L.vertexSet then a (φ.vertexEquiv ⟨v, hv⟩) else G + let b' : δ → β := fun e => + if he : e ∈ L.edgeSet then b (φ.edgeEquiv ⟨e, he⟩) else Classical.choice ‹Nonempty β› + have hcardEq : L.vertexSet.ncard = L'.vertexSet.ncard := by + simpa only [Nat.card_coe_set_eq] using Nat.card_congr φ.vertexEquiv + refine ⟨a', b', ?_, ?_, ?_, ?_, ?_, hcardEq.symm ▸ hcard, ?_⟩ + · intro v hv + simpa only [a', dite_eq_left hv] using ha _ (φ.vertexEquiv ⟨v, hv⟩).property + · intro u hu v hv huv + have hne : (φ.vertexEquiv ⟨u, hu⟩ : γ') ≠ φ.vertexEquiv ⟨v, hv⟩ := by + intro h + exact huv (congrArg Subtype.val (φ.vertexEquiv.injective (Subtype.ext h))) + simpa only [a', dite_eq_left hu, dite_eq_left hv] using + hdisj _ (φ.vertexEquiv ⟨u, hu⟩).property _ (φ.vertexEquiv ⟨v, hv⟩).property hne + · intro e u v he huv + have he' := (φ.isLink_iff ⟨e, he.edge_mem⟩ ⟨u, he.left_mem⟩ ⟨v, he.right_mem⟩).mp he + have hne : (φ.vertexEquiv ⟨u, he.left_mem⟩ : γ') ≠ φ.vertexEquiv ⟨v, he.right_mem⟩ := by + intro h + exact huv (congrArg Subtype.val (φ.vertexEquiv.injective (Subtype.ext h))) + simpa only [a', b', dite_eq_left he.edge_mem, dite_eq_left he.left_mem, + dite_eq_left he.right_mem] + using hlink _ _ _ he' hne + · intro e v he + have he' := (φ.isLink_iff ⟨e, he.edge_mem⟩ ⟨v, he.left_mem⟩ ⟨v, he.left_mem⟩).mp he + simpa only [a', b', dite_eq_left he.edge_mem, dite_eq_left he.left_mem] using hloop _ _ he' + · intro e he f hf hef + have hne : (φ.edgeEquiv ⟨e, he⟩ : δ') ≠ φ.edgeEquiv ⟨f, hf⟩ := by + intro h + exact hef (congrArg Subtype.val (φ.edgeEquiv.injective (Subtype.ext h))) + simpa only [b', dite_eq_left he, dite_eq_left hf] using + hinj _ (φ.edgeEquiv ⟨e, he⟩).property _ (φ.edgeEquiv ⟨f, hf⟩).property hne + · intro A B hm ho v hv + have ho' : separationOrder A B < L'.vertexSet.ncard := hcardEq ▸ ho + simpa only [a', dite_eq_left hv] using + hcontrol A B hm ho' _ (φ.vertexEquiv ⟨v, hv⟩).property + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4Model.lean b/LeanPool/GraphMinor/GM12/Section4Model.lean new file mode 100644 index 0000000000..ffdb4f36c1 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4Model.lean @@ -0,0 +1,139 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.Minor.Model +import LeanPool.GraphMinor.GM10.TangleLemmas +import Mathlib.Combinatorics.Graph.Subgraph + +/-! +# Controlled models as graph minor models + +The branch subgraphs in XII's definition of control give the branch sets +of a graph minor model. Joining edges do not belong to any branch: their +ends and branch disjointness force a loop at that branch, and the loop +condition excludes the edge there. Removing all joining edges therefore +leaves each branch connected. This is used for the contractions in (4.2). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph Relation Hypergraph + +private theorem link_of_inc_ne {α β : Type*} {G : Graph α β} {e : β} {x y : α} + (hx : G.Inc e x) (hy : G.Inc e y) (hne : x ≠ y) : G.IsLink e x y := by + obtain ⟨z, hxz⟩ := hx + obtain ⟨w, hyw⟩ := hy + rcases G.eq_or_eq_of_isLink_of_isLink hyw hxz.symm with rfl | rfl + · exact hxz + · exact (hne rfl).elim + +/-- Keep the branch vertex sets of a controlled minor and regard them as +a minor model. The final two conditions retain exactly the size bound and +tangle-control condition for later composition. -/ +theorem controlsMinor_has_minorModel {α β γ δ : Type*} {G : Graph α β} + (hV : G.vertexSet.Finite) (hE : G.edgeSet.Finite) {L : Graph γ δ} + {θ : ℕ} {T : Set (Hypergraph α β × Hypergraph α β)} + (hc : ControlsMinor (Hypergraph.ofGraph G hV hE) θ T L) : + ∃ (ηv : γ → Set α) (ηe : δ → β), IsMinorModel L G ηv ηe ∧ + L.vertexSet.ncard ≤ θ ∧ + ∀ A B, (A, B) ∈ T → separationOrder A B < L.vertexSet.ncard → + ∀ v ∈ L.vertexSet, ¬ ηv v ⊆ A.vertexSet := by + classical + obtain ⟨a, b, ha, hdisj, hlink, hloop, hinj, hcard, hcontrol⟩ := hc + have heq : ∀ u ∈ L.vertexSet, ∀ v ∈ L.vertexSet, ∀ x, + x ∈ (a u).vertexSet → x ∈ (a v).vertexSet → u = v := by + intro u hu v hv x hxu hxv + by_contra hne + exact Set.disjoint_left.mp (hdisj u hu v hv hne) hxu hxv + have hends : ∀ e u v, L.IsLink e u v → + ∃ x ∈ (a u).vertexSet, ∃ y ∈ (a v).vertexSet, G.IsLink (b e) x y := by + intro e u v hl + by_cases huv : u = v + · subst v + obtain ⟨heG, _, hend⟩ := hloop e u hl + obtain ⟨x, y, hxy⟩ := G.exists_isLink_of_mem_edgeSet heG + exact ⟨x, hend x hxy.inc_left, y, hend y hxy.inc_right, hxy⟩ + · obtain ⟨_, ⟨x, hx, hxe⟩, y, hy, hye⟩ := hlink e u v hl huv + exact ⟨x, hx, y, hy, link_of_inc_ne hxe hye + ((hdisj u hl.left_mem v hl.right_mem huv).ne_of_mem hx hy)⟩ + have hinc : ∀ v ∈ L.vertexSet, ∀ e ∈ L.edgeSet, + L.Inc e v ↔ ∃ x ∈ (a v).vertexSet, G.Inc (b e) x := by + intro v hv e he + constructor + · rintro ⟨w, hl⟩ + obtain ⟨x, hx, y, _, hxy⟩ := hends e v w hl + exact ⟨x, hx, hxy.inc_left⟩ + · rintro ⟨x, hx, hxe⟩ + obtain ⟨p, q, hpq⟩ := L.exists_isLink_of_mem_edgeSet he + obtain ⟨y, hy, z, hz, hyz⟩ := hends e p q hpq + rcases hxe.eq_or_eq_of_isLink hyz with rfl | rfl + · have hvp := heq v hv p hpq.left_mem x hx hy + exact hvp.symm ▸ hpq.inc_left + · have hvq := heq v hv q hpq.right_mem x hx hz + exact hvq.symm ▸ hpq.inc_right + have hloopiff : ∀ v ∈ L.vertexSet, ∀ e ∈ L.edgeSet, + L.IsLoopAt e v ↔ ∀ x, G.Inc (b e) x → x ∈ (a v).vertexSet := by + intro v hv e he + constructor + · exact fun hl => (hloop e v hl).2.2 + · intro hall + obtain ⟨p, q, hpq⟩ := L.exists_isLink_of_mem_edgeSet he + obtain ⟨x, hx, y, hy, hxy⟩ := hends e p q hpq + have hpv := heq p hpq.left_mem v hv x hx (hall x hxy.inc_left) + have hqv := heq q hpq.right_mem v hv y hy (hall y hxy.inc_right) + subst p q + exact hpq + have havoid : ∀ v ∈ L.vertexSet, ∀ e ∈ L.edgeSet, b e ∉ (a v).edgeSet := by + intro v hv e he heA + have hall : ∀ x, G.Inc (b e) x → x ∈ (a v).vertexSet := by + intro x hx + exact (a v).vertex_mem_of_inc ((GM10.inc_iff_of_le (ha v hv).1 heA).mpr hx) + exact (hloop e v ((hloopiff v hv e he).mpr hall)).2.1 heA + refine ⟨fun v => (a v).vertexSet, b, ?_, hcard, hcontrol⟩ + refine { + vertex_nonempty := fun v hv => (ha v hv).2.1 + vertex_subset := fun v hv => (ha v hv).1.vertexSet_subset + edge_mem := ?_ + vertex_disjoint := hdisj + edge_injOn := ?_ + inc_iff := hinc + isLoopAt_iff := hloopiff + connected := ?_ } + · intro e he + obtain ⟨u, v, hl⟩ := L.exists_isLink_of_mem_edgeSet he + obtain ⟨x, _, y, _, hxy⟩ := hends e u v hl + exact hxy.edge_mem + · intro e he f hf hef + by_contra hne + exact hinj e he f hf hne hef + · intro v hv + let K := (G.induce (a v).vertexSet).deleteEdges (b '' L.edgeSet) + refine ⟨K, ?_, ?_, (ha v hv).2.1, ?_⟩ + · exact ⟨(ha v hv).1.vertexSet_subset, fun _ _ _ h => ⟨h.1.1, h.2⟩⟩ + · rfl + · intro x hx y hy + obtain ⟨w⟩ := (ha v hv).2.2 x hx y hy + induction w with + | nil => exact .refl + | @cons p q r hadj rest ih => + obtain ⟨hne, e, hep, heq'⟩ := hadj + have hl : G.IsLink e p q := link_of_inc_ne + (GM10.inc_of_le (ha v hv).1 hep) (GM10.inc_of_le (ha v hv).1 heq') hne + have hn : e ∉ b '' L.edgeSet := by + rintro ⟨f, hf, rfl⟩ + exact havoid v hv f hf ((a v).edge_mem_of_inc hep) + exact Relation.ReflTransGen.head + ⟨e, ⟨hl, (a v).vertex_mem_of_inc hep, (a v).vertex_mem_of_inc heq'⟩, hn⟩ (ih + ((a v).vertex_mem_of_inc heq') hy) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ModelBack.lean b/LeanPool/GraphMinor/GM12/Section4ModelBack.lean new file mode 100644 index 0000000000..15e1e15cae --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ModelBack.lean @@ -0,0 +1,125 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.Minor.Model +import Mathlib.Combinatorics.Graph.Subgraph + +/-! +# Recovering controlled branch subgraphs from a model + +A minor model supplies connected branch subgraphs avoiding all joining +edges. Choose these subgraphs and use their vertex sets for the tangle +condition. This converts the composed models in XII (4.2), page 249, +back to the paper's definition of control. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph Relation Hypergraph + +private theorem skeleton_reachable {α β : Type*} {K : Graph α β} + (hV : K.vertexSet.Finite) (hE : K.edgeSet.Finite) {x y : α} + (h : Relation.ReflTransGen K.Adj x y) : + (Hypergraph.ofGraph K hV hE).skeleton.Reachable x y := by + induction h with + | refl => exact .refl _ + | @tail p q _ hpq ih => + by_cases heq : p = q + · subst q + exact ih + · obtain ⟨e, hl⟩ := hpq + have hstep : (Hypergraph.ofGraph K hV hE).skeleton.Adj p q := + ⟨heq, e, hl.inc_left, hl.inc_right⟩ + exact ih.trans hstep.reachable + +/-- A minor model with the paper's size and small-side conditions gives +a controlled minor. The chosen branches avoid all joining edges. -/ +theorem controlsMinor_of_minorModel {α β γ δ : Type*} {G : Graph α β} + (hV : G.vertexSet.Finite) (hE : G.edgeSet.Finite) {L : Graph γ δ} + {ηv : γ → Set α} {ηe : δ → β} (hm : IsMinorModel L G ηv ηe) + {θ : ℕ} {T : Set (Hypergraph α β × Hypergraph α β)} + (hcard : L.vertexSet.ncard ≤ θ) + (hcontrol : ∀ A B, (A, B) ∈ T → separationOrder A B < L.vertexSet.ncard → + ∀ v ∈ L.vertexSet, ¬ ηv v ⊆ A.vertexSet) : + ControlsMinor (Hypergraph.ofGraph G hV hE) θ T L := by + classical + let B : (v : γ) → v ∈ L.vertexSet → Graph α β := fun v hv => (hm.connected v hv).choose + have hB : ∀ v hv, B v hv ≤ G.deleteEdges (ηe '' L.edgeSet) ∧ + (B v hv).vertexSet = ηv v ∧ GraphConnected (B v hv) := + fun v hv => (hm.connected v hv).choose_spec + have hBG : ∀ v hv, B v hv ≤ G := fun v hv => (hB v hv).1.trans Graph.deleteEdges_le + let a : γ → Hypergraph α β := fun v => if hv : v ∈ L.vertexSet then + Hypergraph.ofGraph (B v hv) (hV.subset (hBG v hv).vertexSet_mono) + (hE.subset (hBG v hv).edgeSet_mono) + else Hypergraph.ofGraph G hV hE + have ha : ∀ v hv, a v = Hypergraph.ofGraph (B v hv) + (hV.subset (hBG v hv).vertexSet_mono) (hE.subset (hBG v hv).edgeSet_mono) := + fun v hv => dite_eq_left hv + have haV : ∀ v (_hv : v ∈ L.vertexSet), (a v).vertexSet = ηv v := by + intro v hv + rw [ha v hv] + exact (hB v hv).2.1 + refine ⟨a, ηe, ?_, ?_, ?_, ?_, ?_, hcard, ?_⟩ + · intro v hv + rw [ha v hv] + refine ⟨⟨(hBG v hv).vertexSet_mono, (hBG v hv).edgeSet_mono, ?_⟩, + (hB v hv).2.2.1, ?_⟩ + · intro e he + ext x + exact ((hBG v hv).inc_congr he).symm + · intro x hx y hy + exact skeleton_reachable _ _ ((hB v hv).2.2.2 x hx y hy) + · intro u hu v hv huv + rw [haV u hu, haV v hv] + exact hm.vertex_disjoint u hu v hv huv + · intro e u v hl _ + obtain ⟨x, hx, hxe⟩ := (hm.inc_iff u hl.left_mem e hl.edge_mem).mp hl.inc_left + obtain ⟨y, hy, hye⟩ := (hm.inc_iff v hl.right_mem e hl.edge_mem).mp hl.inc_right + rw [haV u hl.left_mem, haV v hl.right_mem] + exact ⟨hm.edge_mem e hl.edge_mem, ⟨x, hx, hxe⟩, y, hy, hye⟩ + · intro e v hl + have hv := hl.left_mem + refine ⟨hm.edge_mem e hl.edge_mem, ?_, ?_⟩ + · rw [ha v hv] + intro he + exact ((hB v hv).1.edgeSet_mono he).2 (mem_image_of_mem ηe hl.edge_mem) + · rw [haV v hv] + exact (hm.isLoopAt_iff v hv e hl.edge_mem).mp hl + · intro e he f hf hne hef + exact hne (hm.edge_injOn he hf hef) + · intro A B hmT ho v hv + rw [haV v hv] + exact hcontrol A B hmT ho v hv + +/-- Disjoint nonempty branches give an injection from the target vertices +into the host vertices, so taking a minor cannot increase their number. -/ +theorem minorModel_vertex_ncard_le {α β γ δ : Type*} {H : Graph γ δ} {G : Graph α β} + {ηv : γ → Set α} {ηe : δ → β} (hm : IsMinorModel H G ηv ηe) + (hV : G.vertexSet.Finite) : H.vertexSet.ncard ≤ G.vertexSet.ncard := by + classical + let : Finite G.vertexSet := hV.to_subtype + let f : H.vertexSet → G.vertexSet := fun v => + ⟨(hm.vertex_nonempty v.val v.property).choose, + hm.vertex_subset v.val v.property (hm.vertex_nonempty v.val v.property).choose_spec⟩ + have hinj : Function.Injective f := by + intro u v huv + apply Subtype.ext + by_contra hne + exact Set.disjoint_left.mp (hm.vertex_disjoint u.val u.property v.val v.property hne) + (hm.vertex_nonempty u.val u.property).choose_spec + (show (f u).val ∈ ηv v.val from by + rw [congrArg Subtype.val huv] + exact (hm.vertex_nonempty v.val v.property).choose_spec) + simpa only [Nat.card_coe_set_eq] using Nat.card_le_card_of_injective f hinj + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ModelComposition.lean b/LeanPool/GraphMinor/GM12/Section4ModelComposition.lean new file mode 100644 index 0000000000..15c2ec1b26 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ModelComposition.lean @@ -0,0 +1,40 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Minor.Model +import LeanPool.GraphMinor.Minor.Basic + +/-! +# Composing the branch sets of minor models + +The omitted proof of XII (4.2), page 249, merges branches along the +contractions of the target minor. This file makes that operation explicit +for models of graph minors. Its branch sets are unions of old branch sets, +which is also the inclusion needed to preserve tangle control. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +variable {α β α' β' α'' β'' : Type*} + +/-- Compose branch sets and joining edges as in the omitted proof of XII (4.2), +page 249. The new branch is the union of the old branches selected by the +first model, joined by its internal edges. -/ +theorem minorModel_comp {H : Graph α'' β''} {K : Graph α' β'} {G : Graph α β} + {ηv : α'' → Set α'} {ηe : β'' → β'} {ηv' : α' → Set α} {ηe' : β' → β} + (h₁ : IsMinorModel H K ηv ηe) (h₂ : IsMinorModel K G ηv' ηe') : + IsMinorModel H G (fun v ↦ ⋃ v' ∈ ηv v, ηv' v') (ηe' ∘ ηe) := + GraphMinor.isMinorModel_comp h₁ h₂ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4Monotone.lean b/LeanPool/GraphMinor/GM12/Section4Monotone.lean new file mode 100644 index 0000000000..8d8eb959cb --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4Monotone.lean @@ -0,0 +1,56 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.Statement +import LeanPool.GraphMinor.GM12.Section4Minor +import LeanPool.GraphMinor.GM12.Section4ControlComposition +import LeanPool.GraphMinor.GM12.Section4EdgeLabels +import LeanPool.GraphMinor.Minor.Basic + +/-! +# Graph Minors XII, (4.2): control passes to a target minor + +Compose the controlled branch model with a model of the target minor. +Each new branch contains an old branch and the new target has no more +vertices, so the small-side exclusion is preserved. + +The host edge-label type is assumed inhabited because `ControlsMinor` +uses total maps on ambient labels. `Section4AmbientEdges.lean` proves that this +assumption cannot be removed from that definition. The paper maps only +actual edges. An unused edge label on the intermediate target handles +its possible empty ambient edge type. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph Hypergraph + +/-- Graph Minors XII, (4.2), page 249. Control passes to any target minor. +The inhabited host edge-label assumption accounts for total edge maps +in `ControlsMinor`; it is automatic for drawings. -/ +theorem theorem_4_2_proof {α β γ δ γ' δ' : Type*} [Nonempty β] + {G : Graph α β} (hV : G.vertexSet.Finite) (hE : G.edgeSet.Finite) + {L : Graph γ δ} {L' : Graph γ' δ'} + (hV' : L'.vertexSet.Finite) (hE' : L'.edgeSet.Finite) + (hminor : IsIsoMinor L L') {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} + (hc : ControlsMinor (Hypergraph.ofGraph G hV hE) θ T L') : + ControlsMinor (Hypergraph.ofGraph G hV hE) θ T L := by + obtain ⟨K, ⟨φ⟩, _, hVK, _⟩ := exists_option_edge_copy L' hV' hE' + have hcK : ControlsMinor (Hypergraph.ofGraph G hV hE) θ T K := + controlsMinor_of_iso φ.symm hc + have hminorK : IsIsoMinor L K := φ.isIsoMinor_right hminor + obtain ⟨a, b, hm⟩ := exists_isMinorModel_of_isIsoMinor hminorK + exact controlsMinor_of_target_model hV hE hm hVK hcK + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4NoIsolated.lean b/LeanPool/GraphMinor/GM12/Section4NoIsolated.lean new file mode 100644 index 0000000000..3984a4436e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4NoIsolated.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RegionWalk +import LeanPool.GraphMinor.GM12.Section4PendantAugment +import LeanPool.GraphMinor.GM12.Section4SplitDrawing +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Completing the geometric target replacement + +For XII (4.3), page 249, first give every isolated vertex a +pendant edge. There are only finitely many original vertices. +New vertices are already incident with their pendant edges, and +subdrawing inclusion preserves every existing incidence. Then +subdivide all edges and add parallel copies, obtaining a loopless +drawing with at least two incident edges at every vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +private theorem inc_of_subdrawing + {S : Type*} [TopologicalSpace S] {Γ H : Drawing S} (h : Γ.IsSubdrawing H) + {e : Set S} {v : S} (he : Γ.toGraph.Inc e v) : H.toGraph.Inc e v := by + obtain ⟨w, hl⟩ := he + exact ⟨w, (h.isLink_iff hl.edge_mem).mp hl⟩ + +private theorem augment_vertices + {S : Type*} [TopologicalSpace S] [T2Space S] (hS : IsClosedSurface S) + (Γ : Drawing S) {V : Set S} (hV : V.Finite) (hsub : V ⊆ Γ.V) : + ∃ H : Drawing S, Γ.IsSubdrawing H ∧ + (∀ v ∈ V, ∃ e, H.toGraph.Inc e v) ∧ + ∀ v ∈ H.V, v ∈ Γ.V ∨ ∃ e, H.toGraph.Inc e v := by + classical + revert hsub + induction V, hV using Set.Finite.induction_on with + | empty => + intro _ + exact ⟨Γ, Drawing.IsSubdrawing.refl Γ, by simp, fun v hv => Or.inl hv⟩ + | @insert v V hv hV ih => + intro hsub + obtain ⟨K, hΓK, hdone, hnew⟩ := ih (fun x hx => hsub (Or.inr hx)) + have hvK : v ∈ K.V := hΓK.1 (hsub (Or.inl rfl)) + by_cases hvinc : ∃ e, K.toGraph.Inc e v + · refine ⟨K, hΓK, ?_, hnew⟩ + intro x hx + rcases hx with hx | hx + · exact hx ▸ hvinc + · exact hdone x hx + · obtain ⟨H, w, e, hKH, hHV, _, hl⟩ := exists_pendant_augmentation hS K hvK + (fun e he => hvinc ⟨e, he⟩) + refine ⟨H, hΓK.trans hKH, ?_, ?_⟩ + · intro x hx + rcases hx with hx | hx + · exact hx ▸ ⟨e, hl.inc_left⟩ + · obtain ⟨f, hf⟩ := hdone x hx + exact ⟨f, inc_of_subdrawing hKH hf⟩ + · intro x hx + rw [hHV] at hx + rcases hx with hx | hx + · exact Or.inr (hx ▸ ⟨e, hl.inc_right⟩) + · rcases hnew x hx with hxΓ | ⟨f, hf⟩ + · exact Or.inl hxΓ + · exact Or.inr ⟨f, inc_of_subdrawing hKH hf⟩ + +/-- The isolated-vertex augmentation in XII (4.3), page 249. +Every original vertex remains, and every resulting vertex is incident +with an edge. -/ +theorem exists_augmentation_without_isolated_vertices + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (Γ : Drawing S) : + ∃ H : Drawing S, Γ.IsSubdrawing H ∧ ∀ v ∈ H.V, ∃ e, H.toGraph.Inc e v := by + obtain ⟨H, hΓH, hdone, hnew⟩ := augment_vertices hS Γ Γ.finite_V subset_rfl + refine ⟨H, hΓH, ?_⟩ + intro v hv + rcases hnew v hv with hvΓ | hinc + · exact hdone v hvΓ + · exact hinc + +/-- The geometric construction of the loopless minimum-degree-two +replacement in XII (4.3), page 249. Pendant augmentation retains +the original as a subdrawing, subdivision records both halves of each +edge, and the final augmentation retains that subdivision. -/ +theorem exists_loopless_minimum_degree_two_replacement + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) : + ∃ (Γ₀ K H : Drawing S) (A B : Set S → Set S) (m x y : Set S → S), + Γ.IsSubdrawing Γ₀ ∧ SplitData Γ₀ K A B m x y ∧ K.IsSubdrawing H ∧ + (∀ e z, ¬ H.toGraph.IsLink e z z) ∧ + ∀ z ∈ H.V, ∃ e f, e ≠ f ∧ H.toGraph.Inc e z ∧ H.toGraph.Inc f z := by + obtain ⟨Γ₀, hΓ₀, hinc⟩ := exists_augmentation_without_isolated_vertices hS Γ + obtain ⟨K, H, A, B, m, x, y, hd, hKH, _, hloop, htwo⟩ := + exists_subdivision_in_minimum_degree_two_drawing hS Γ₀ hinc + exact ⟨Γ₀, K, H, A, B, m, x, y, hΓ₀, hd, hKH, hloop, htwo⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4NonfreeEdgeCircuit.lean b/LeanPool/GraphMinor/GM12/Section4NonfreeEdgeCircuit.lean new file mode 100644 index 0000000000..d66f32cfd8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4NonfreeEdgeCircuit.lean @@ -0,0 +1,84 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section1 +public import LeanPool.GraphMinor.GM12.Section4Separation +import LeanPool.GraphMinor.GM12.Section4WalkMetric +import LeanPool.GraphMinor.GM11.Walks + +/-! +# A nonfree path edge lies inside a radial circuit of length two + +Claim (1) in the proof of XII (4.3), pages 249--250, starts with +a nonfree edge with distinct ends. Its two ends lie on a tangle +small side of order at most one. Move the edge onto that side by +X (2.9), then apply XII (1.1). The resulting radial circuit has +at most one original vertex. Radial bipartiteness makes its length +at most two. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM10 GM11 GM14 Hypergraph + +/-- The small-separation and radial-circuit step of claim (1) in +Graph Minors XII (4.3), pages 249--250. -/ +theorem exists_short_radial_circuit_of_nonfree_edge + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsRespectfulDrawingTangle Γ θ T) (hθ : 2 ≤ θ) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + {f : Set S} {u v : S} (hl : Γ.toGraph.IsLink f u v) (huv : u ≠ v) + (hfree : ¬ IsFreeSet Γ.toHypergraph T θ {u, v}) : + ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing K ∧ C.length < 2 * θ ∧ + C.length ≤ 2 ∧ (C.V ∩ Γ.V).ncard ≤ 1 ∧ f ⊆ ins C := by + have hpairV : ({u, v} : Set S) ⊆ Γ.V := by + intro x hx + rcases hx with rfl | rfl + · exact hl.2.1 + · exact hl.2.2.1 + have hpair : ({u, v} : Set S).ncard = 2 := Set.ncard_pair huv + have hbad : ∃ A B : Hypergraph S (Set S), (A, B) ∈ T ∧ {u, v} ⊆ A.vertexSet ∧ + separationOrder A B ≤ 1 := by + by_contra hno + apply hfree + refine ⟨hpairV, hpair ▸ hθ, ?_⟩ + intro A B hm hsub + rw [hpair] + by_contra hlt + exact hno ⟨A, B, hm, hsub, by omega⟩ + obtain ⟨A, B, hm, hsub, hord⟩ := hbad + let H := edgeHypergraph Γ.toHypergraph f + have hHV : H.vertexSet ⊆ A.vertexSet := by + intro x hx + change Γ.toHypergraph.Inc f x at hx + have hxends : x ∈ ({u, v} : Set S) := hl.2.2.2 ▸ ⟨hx.2.2, hx.2.1⟩ + exact hsub hxends + have hmove := tangle_move_subhypergraph hT.2.1 hm (edgeHypergraph_le hl.1) hHV + let A' := A ∪ H + let B' := B.deleteEdges H.edgeSet + have hm' : (A', B') ∈ T := hmove.1 + have ho' : separationOrder A' B' ≤ 1 := hmove.2 ▸ hord + have hfA : f ∈ A'.edgeSet := Or.inr (mem_singleton f) + obtain ⟨C, hC, hCs, hCl, hCV, hfC⟩ := + (theorem_1_1_proof hS hT ⟨f, hl.1⟩ hK hd (hT.2.1.isSeparation hm') + (hT.2.1.order_lt hm')).mp hm' f hfA + have hcount : (C.V ∩ Γ.V).ncard ≤ 1 := + (Set.ncard_le_ncard hCV (A' ∩ B').vertexSet_finite).trans ho' + have hlen := (circuit_length_eq_two_mul_ncard hK.2.1 hC hCs).1 + refine ⟨C, hC, hCs, hCl, ?_, hcount, hfC⟩ + rw [hlen] + exact Nat.mul_le_mul_left 2 hcount + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4NormalArcDisc.lean b/LeanPool/GraphMinor/GM12/Section4NormalArcDisc.lean new file mode 100644 index 0000000000..3a423c6146 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4NormalArcDisc.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.GM12.Section4ThinArcDisc +import LeanPool.GraphMinor.Surface.Classification +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.Surface.Wedge + +/-! +# Empty discs in closed connected surfaces + +The thin-disc construction for XII (4.3), page 250, is invariant +under homeomorphisms. Apply it on a model of the surface and carry +its disc back. This permits arbitrary universes for the original +surface while the plane and arc-chart construction uses its usual +small model. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- The thin-disc construction used in XII (4.3), page 250, for +a closed connected surface in an arbitrary universe. -/ +theorem exists_normal_arc_disc + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {a : unitInterval → S} (ha : IsArcMap a) + {B : Set S} (hB : IsClosed B) (hleft : a 0 ∈ B) (hright : a 1 ∈ B) + (hmeet : range a ∩ B ⊆ {a 0, a 1}) : + ∃ D : Set S, IsClosedDisc D ∧ D ∩ B = {a 0, a 1} ∧ + ({a 0, a 1} : Set S) ⊆ discBd D ∧ range a ⊆ D := by + let : CompactSpace S := hS.1 + have hsurf : IsSurface S := ⟨hS.1, hS.2.1, fun x => (hS.2.2 x).isManifoldPoint⟩ + obtain ⟨n, m, c, ⟨e⟩⟩ := classification S hsurf inferInstance + let : T2Space (SurfaceModel n m c) := e.t2Space + have hM : IsClosedSurface (SurfaceModel n m c) := by + refine ⟨e.compactSpace, e.t2Space, ?_⟩ + intro x + have hx := (isInteriorPoint_homeomorph_iff e (e.symm x)).mpr (hS.2.2 (e.symm x)) + simpa only [e.apply_symm_apply] using hx + let a' : unitInterval → SurfaceModel n m c := fun t => e (a t) + let B' : Set (SurfaceModel n m c) := e.symm ⁻¹' B + have ha' : IsArcMap a' := ⟨e.continuous.comp ha.1, e.injective.comp ha.2⟩ + have hB' : IsClosed B' := hB.preimage e.symm.continuous + have hleft' : a' 0 ∈ B' := by simpa only [a', B', mem_preimage, e.symm_apply_apply] using hleft + have hright' : a' 1 ∈ B' := by simpa only [a', B', mem_preimage, e.symm_apply_apply] using hright + have hmeet' : range a' ∩ B' ⊆ {a' 0, a' 1} := by + rintro _ ⟨⟨t, rfl⟩, ht⟩ + have htB : a t ∈ B := by simpa only [a', B', mem_preimage, e.symm_apply_apply] using ht + rcases hmeet ⟨mem_range_self t, htB⟩ with h | h + · exact Or.inl (congrArg e h) + · exact Or.inr (Set.mem_singleton_iff.mpr (congrArg e (Set.mem_singleton_iff.mp h))) + obtain ⟨D, hD, hDB, hends, haD⟩ := exists_thin_disc_of_arc hM ha' hB' hleft' hright' hmeet' + let : Nonempty (SurfaceModel n m c) := ⟨a' 0⟩ + have himage := isClosedDisc_image_injOn hD hD.isCompact e.symm.continuous.continuousOn + e.symm.injective.injOn + refine ⟨e.symm '' D, himage.1, ?_, ?_, ?_⟩ + · apply Set.Subset.antisymm + · rintro _ ⟨⟨x, hx, rfl⟩, hxB⟩ + have hxends : x ∈ ({a' 0, a' 1} : Set (SurfaceModel n m c)) := hDB.subset ⟨hx, hxB⟩ + rcases hxends with rfl | hxends + · exact Or.inl (e.symm_apply_apply (a 0)) + · have hx1 := Set.mem_singleton_iff.mp hxends + subst x + exact Or.inr (Set.mem_singleton_iff.mpr (e.symm_apply_apply (a 1))) + · intro x hx + rcases hx with rfl | hx + · exact ⟨⟨a' 0, discBd_subset D (hends (by simp)), e.symm_apply_apply (a 0)⟩, hleft⟩ + · have hx1 := Set.mem_singleton_iff.mp hx + subst x + exact ⟨⟨a' 1, discBd_subset D (hends (by simp)), e.symm_apply_apply (a 1)⟩, hright⟩ + · rw [himage.2] + intro x hx + rcases hx with rfl | hx + · exact ⟨a' 0, hends (by simp), e.symm_apply_apply (a 0)⟩ + · have hx1 := Set.mem_singleton_iff.mp hx + subst x + exact ⟨a' 1, hends (by simp), e.symm_apply_apply (a 1)⟩ + · rintro _ ⟨t, rfl⟩ + exact ⟨a' t, haD (mem_range_self t), e.symm_apply_apply (a t)⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4NormalizedTarget.lean b/LeanPool/GraphMinor/GM12/Section4NormalizedTarget.lean new file mode 100644 index 0000000000..66417851dd --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4NormalizedTarget.lean @@ -0,0 +1,49 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import LeanPool.GraphMinor.Statement +import LeanPool.GraphMinor.GM12.Section4TargetReplacement +import LeanPool.GraphMinor.GM12.Section4FiniteLabels +import LeanPool.GraphMinor.GM12.Section4IsoIncidence +import LeanPool.GraphMinor.Minor.Basic + +/-! +# A finite labelled drawable replacement of the target + +The first reduction in XII (4.3), page 249, replaces the target +by a drawable loopless graph with at least two incident edges at +each vertex. Build that replacement, enumerate its vertices and +edges, and carry the drawing across the enumeration isomorphism. +The original graph remains a minor of the labelled replacement. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The complete target reduction in XII (4.3), page 249, when a +drawing of the original abstract graph is supplied. -/ +theorem exists_normalized_target_replacement + {α β S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {G : Graph α β} (D : GraphDrawing G S) : + ∃ (p t : ℕ) (L : Graph (Fin p) (Fin t)) (_D' : GraphDrawing L S), + L.vertexSet = univ ∧ L.edgeSet = univ ∧ IsIsoMinor G L ∧ + (∀ e v, ¬ L.IsLink e v v) ∧ + ∀ v ∈ L.vertexSet, ∃ e f, e ≠ f ∧ L.Inc e v ∧ L.Inc f v := by + obtain ⟨H, hminor, hloop, htwo⟩ := exists_loopless_minimum_degree_two_minor hS D.drawing + have hGminor : IsIsoMinor G H.toGraph := D.iso.isIsoMinor_left hminor + obtain ⟨p, t, L, hLV, hLE, ⟨φ⟩⟩ := exists_finite_labels H.toGraph H.finite_V H.finite_edges + exact ⟨p, t, L, ⟨H, φ⟩, hLV, hLE, Iso.isIsoMinor_right hGminor φ.symm, + loopless_of_iso φ hloop, two_incident_edges_of_iso φ htwo⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4OneCrossingContactDiscs.lean b/LeanPool/GraphMinor/GM12/Section4OneCrossingContactDiscs.lean new file mode 100644 index 0000000000..d6d3d7c225 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4OneCrossingContactDiscs.lean @@ -0,0 +1,57 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4OneCrossingHalfEdges +public import LeanPool.GraphMinor.GM12.Section4HalfEdgeFeasibility + +/-! +# Vertex contact discs for the one-crossing source drawing + +For XII (4.5), claim (1), page 253, select the unique crossing +of each subdivided edge and split there. The crossing points +lie inside the chosen crossing discs, while the source vertices +lie outside them. Clip and thicken the resulting half-edge +stars. This gives disjoint closed vertex discs whose contacts +with the crossing-disc union are the assigned edge-end classes. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The one-crossing source drawing has disjoint closed vertex +discs with exact, distinct edge-end contacts on the frontier +of the crossing-disc union. This proves the vertex-disc +construction in XII (4.5), claim (1), page 253. -/ +theorem exists_one_crossing_contact_discs {S V E : Type} [TopologicalSpace S] [T2Space S] + [NormalSpace S] [ConnectedSpace S] [Finite V] [Finite E] + (hS : IsClosedSurface S) (v : V → S) (hinj : Function.Injective v) (κ : E × Bool → V) (P : E + → Set S) + (hP : ∀ e, IsLineWithEnds (P e) (v (κ (e, false))) (v (κ (e, true)))) + (hPV : ∀ e w, v w ∈ P e → w = κ (e, false) ∨ w = κ (e, true)) + (hcross : ∀ e, ∃ x ∈ edgeMeetingPoints v P, P e ∩ edgeMeetingPoints v P = {x}) + (Z : Set S) (hZ : IsClosed Z) (hvZ : ∀ w, v w ∉ Z) + (hMZ : edgeMeetingPoints v P ⊆ interior Z) : + ∃ (q : E × Bool → S) (D : V → Set S), Function.Injective q ∧ + (∀ i, q i ∈ P i.1 ∩ frontier Z) ∧ (∀ w, IsClosedDisc (D w)) ∧ + (∀ w z, w ≠ z → Disjoint (D w) (D z)) ∧ + ∀ w, D w ∩ Z = {z | ∃ i, κ i = w ∧ q i = z} := by + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite E + obtain ⟨x, L, hx, hline, hsub, hvertex, hinter, -, -⟩ := + exists_one_crossing_halfedges v κ P hP hPV hcross + obtain ⟨q, hq, hqL, D, hD, hDD, hDZ⟩ := exists_halfedge_contact_discs + hS v hinj κ (fun i : E × Bool => x i.1) L + hline hvertex hinter Z hZ hvZ (fun i => hMZ (hx i.1).1) + exact ⟨q, D, hq, (fun i => ⟨hsub i (hqL i).1, (hqL i).2⟩), hD, hDD, hDZ⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4OneCrossingDiscSystem.lean b/LeanPool/GraphMinor/GM12/Section4OneCrossingDiscSystem.lean new file mode 100644 index 0000000000..8359640889 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4OneCrossingDiscSystem.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4ProtectedCrossDiscFamily +public import LeanPool.GraphMinor.GM12.Section4CrossingPoints +public import LeanPool.GraphMinor.GM12.Section4CrossingPairEquiv + +/-! +# Discs and edge labels for a one-crossing drawing + +For XII (4.5), claim (1), page 253, select the local pair of +edges and straight-line coordinates at each actual crossing. +The absence of a third edge identifies its pair uniquely. +The one-crossing equations then give a bijection from the +two positions at each crossing to the edge set. Choose the +protected discs and express all avoidance and opposite-contact +equations using that bijection. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Metric + +/-- A finite one-crossing arc configuration supplies its actual +edge-pair bijection and protected coordinate discs, including +the opposite boundary contacts. This is the labelled small-disc +system in XII (4.5), claim (1), page 253. -/ +theorem exists_one_crossing_disc_system {V E : Type*} [Finite V] [Finite E] + (v : V → ℂ) (P : E → Set ℂ) (hP : ∀ e, IsClosed (P e)) + (hM : (edgeMeetingPoints v P).Finite) + (htriple : ∀ e f g, e ≠ f → f ≠ g → e ≠ g → P e ∩ P f ∩ P g ⊆ range v) + (hcross : ∀ e, ∃ x ∈ edgeMeetingPoints v P, P e ∩ edgeMeetingPoints v P = {x}) + (hlocal : ∀ x ∈ edgeMeetingPoints v P, ∃ e f, e ≠ f ∧ x ∈ P e ∩ P f ∧ + ∃ (A : ℂ ≃L[ℝ] ℂ) (U : Set ℂ), IsOpen U ∧ x ∈ U ∧ + P e ∩ U = (line[ℝ, x, x + A 1] : Set ℂ) ∩ U ∧ + P f ∩ U = (line[ℝ, x, x + A Complex.I] : Set ℂ) ∩ U) : + ∃ (σ : (edgeMeetingPoints v P × Bool) ≃ E) + (A : edgeMeetingPoints v P → ℂ ≃L[ℝ] ℂ) + (r : edgeMeetingPoints v P → ℝ) (D : edgeMeetingPoints v P → Set ℂ), + (∀ x, x.val ∈ P (σ (x, false)) ∩ P (σ (x, true))) ∧ + (∀ x, 0 < r x) ∧ (∀ x, IsClosedDisc (D x)) ∧ + (∀ x y, x ≠ y → Disjoint (D x) (D y)) ∧ + (∀ x, x.val ∈ interior (D x)) ∧ (∀ x, Disjoint (D x) (range v)) ∧ + (∀ x e, e ≠ σ (x, false) → e ≠ σ (x, true) → Disjoint (D x) (P e)) ∧ + (∀ x, P (σ (x, false)) ∩ discBd (D x) = + {x.val + A x (r x • (1 : ℂ)), x.val + A x ((-r x) • (1 : ℂ))}) ∧ + (∀ x, P (σ (x, true)) ∩ discBd (D x) = + {x.val + A x (r x • Complex.I), x.val + A x ((-r x) • Complex.I)}) ∧ + (∀ x, D x = (fun z => x.val + A x z) '' closedBall 0 (r x)) := by + classical + let X := edgeMeetingPoints v P + let : Fintype X := hM.fintype + have hloc : ∀ x : X, ∃ e f, e ≠ f ∧ x.val ∈ P e ∩ P f ∧ + ∃ (A : ℂ ≃L[ℝ] ℂ) (U : Set ℂ), IsOpen U ∧ x.val ∈ U ∧ + P e ∩ U = (line[ℝ, x.val, x.val + A 1] : Set ℂ) ∩ U ∧ + P f ∩ U = (line[ℝ, x.val, x.val + A Complex.I] : Set ℂ) ∩ U := + fun x => hlocal x.val x.property + choose left right hne hx A U hU hxU hl hr using hloc + have hxV : ∀ x : X, x.val ∉ range v := by + intro x + obtain ⟨_, _, _, _, hnot⟩ := x.property + exact hnot + have honly : ∀ x : X, ∀ e, x.val ∈ P e → e = left x ∨ e = right x := by + intro x e hxe + exact edge_eq_of_mem_pair_meeting v P htriple (hne x) ⟨hx x, hxV x⟩ hxe + have hother : ∀ x : X, ∀ e, e ≠ left x → e ≠ right x → x.val ∉ P e := + fun x e hel her hxe => (honly x e hxe).elim hel her + have hxrange : range (Subtype.val : X → ℂ) = X := by + ext z + exact ⟨fun ⟨x, hx⟩ => hx ▸ x.property, fun hz => ⟨⟨z, hz⟩, rfl⟩⟩ + have hsingle : ∀ e, ∃ x : X, P e ∩ range (Subtype.val : X → ℂ) = {x.val} := by + intro e + obtain ⟨x, hx, hmeet⟩ := hcross e + exact ⟨⟨x, hx⟩, by rw [hxrange]; exact hmeet⟩ + obtain ⟨σ, hσ⟩ := exists_crossing_pair_equiv Subtype.val Subtype.val_injective P left right + hne hx honly hsingle + obtain ⟨r, D, hpos, hd, -, hdd, hcentre, hDv, hDP, hDL, hDR, hcoord⟩ := + exists_protected_cross_disc_family v P hP Subtype.val Subtype.val_injective left right + hxV hother A U hU hxU hl hr + refine ⟨σ, A, r, D, ?_, hpos, hd, hdd, hcentre, hDv, ?_, ?_, ?_, hcoord⟩ + · intro x + rw [(hσ x).1, (hσ x).2] + exact hx x + · intro x e hel her + apply hDP x e + · exact fun h => hel (h.trans (hσ x).1.symm) + · exact fun h => her (h.trans (hσ x).2.symm) + · intro x + rw [(hσ x).1] + exact hDL x + · intro x + rw [(hσ x).2] + exact hDR x + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4OneCrossingHalfEdges.lean b/LeanPool/GraphMinor/GM12/Section4OneCrossingHalfEdges.lean new file mode 100644 index 0000000000..42a67e2c55 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4OneCrossingHalfEdges.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SourceHalfEdges +public import LeanPool.GraphMinor.GM12.Section4CrossingPoints + +/-! +# The half-edge system of the one-crossing subdivision + +In XII (4.5), page 253, every subdivided edge contains exactly +one crossing. Select that crossing on each edge. A meeting of +two distinct edges away from the vertices is one of these +selected points, by the one-crossing equation. Split the edges +there to obtain the source half-edge system. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The actual one-crossing equations supply all the crossing +points and half-edges required by the source feasibility +construction in XII (4.5), claim (1), page 253. -/ +theorem exists_one_crossing_halfedges {S V E : Type*} [TopologicalSpace S] [T2Space S] + (v : V → S) (κ : E × Bool → V) (P : E → Set S) + (hP : ∀ e, IsLineWithEnds (P e) (v (κ (e, false))) (v (κ (e, true)))) + (hPV : ∀ e w, v w ∈ P e → w = κ (e, false) ∨ w = κ (e, true)) + (hcross : ∀ e, ∃ x ∈ edgeMeetingPoints v P, P e ∩ edgeMeetingPoints v P = {x}) : + ∃ (x : E → S) (L : E × Bool → Set S), + (∀ e, x e ∈ edgeMeetingPoints v P ∧ P e ∩ edgeMeetingPoints v P = {x e}) ∧ + (∀ i, IsLineWithEnds (L i) (v (κ i)) (x i.1)) ∧ + (∀ i, L i ⊆ P i.1) ∧ (∀ i w, v w ∈ L i → w = κ i) ∧ + (∀ i j, i ≠ j → L i ∩ L j ⊆ range v ∪ range (fun q : E × Bool => x q.1)) ∧ + (∀ e, L (e, false) ∪ L (e, true) = P e) ∧ + ∀ e, L (e, false) ∩ L (e, true) = {x e} := by + classical + choose x hx hmeet using hcross + have hxP : ∀ e, x e ∈ P e := fun e => + ((hmeet e).symm.subset (mem_singleton _)).1 + have hxV : ∀ e, x e ∉ range v := by + intro e + obtain ⟨_, _, _, _, hnot⟩ := hx e + exact hnot + have hPP : ∀ e f, e ≠ f → P e ∩ P f ⊆ range v ∪ range x := by + intro e f hef z hz + by_cases hzV : z ∈ range v + · exact Or.inl hzV + · have hzM : z ∈ edgeMeetingPoints v P := ⟨e, f, hef, hz, hzV⟩ + have hzx : z = x e := mem_singleton_iff.mp ((hmeet e).subset ⟨hz.1, hzM⟩) + exact Or.inr ⟨e, hzx.symm⟩ + obtain ⟨L, hline, hsub, hvertex, hinter, hcover, hpair⟩ := + exists_source_halfedges v κ P x hP hxP hxV hPV hPP + exact ⟨x, L, (fun e => ⟨hx e, hmeet e⟩), hline, hsub, hvertex, hinter, hcover, hpair⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4OneMeetingSubdivision.lean b/LeanPool/GraphMinor/GM12/Section4OneMeetingSubdivision.lean new file mode 100644 index 0000000000..0680c8438d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4OneMeetingSubdivision.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4ArcMeetingParameters +public import LeanPool.GraphMinor.GM12.Section4ArcSubdivision +import Mathlib.Data.Set.Card + +/-! +# Subdividing an edge at all its meetings + +XII (4.5), page 252, replaces an edge with `k` crossings by `k` +edge portions. Order the actual meeting points through the arc +homeomorphism, then apply the midpoint subdivision. The pieces +cover the original edge, have distinct cut vertices, and each +contain exactly one of the original meetings. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Subdivide an actual edge arc at a finite nonempty set of +interior meetings, giving one meeting per new edge. This proves +the per-edge geometric subdivision step in XII (4.5), page 252. -/ +theorem exists_one_meeting_arc_subdivision {E X : Set ℂ} {a b : ℂ} + (hE : IsLineWithEnds E a b) (hX : X.Finite) (hXne : X.Nonempty) + (hXE : X ⊆ E) (haX : a ∉ X) (hbX : b ∉ X) : + ∃ k : ℕ, 0 < k ∧ ∃ (w : Fin (k + 1) → ℂ) (P : Fin k → Set ℂ), + Function.Injective w ∧ w 0 = a ∧ w (Fin.last k) = b ∧ + (∀ i, IsLineWithEnds (P i) (w i.castSucc) (w i.succ)) ∧ + (⋃ i, P i) = E ∧ + (∀ i, ∃ x ∈ X, P i ∩ X = {x}) ∧ + (∀ i, w i ∉ X) ∧ + (∀ i j, i ≠ j → P i ∩ P j ⊆ range w) ∧ + (∀ i, P i ∩ range w = {w i.castSucc, w i.succ}) ∧ X.ncard = k := by + obtain ⟨k, hk, φ, hφ0, hφ1, t, ht, ht01, hXrange⟩ := + exists_ordered_arc_meeting_parameters hE hX hXne hXE haX hbX + let g : unitInterval → ℂ := fun u => (φ u).val + have hg : IsArcMap g := ⟨continuous_subtype_val.comp φ.continuous, + Subtype.val_injective.comp φ.injective⟩ + have hgrange : range g = E := by + apply Subset.antisymm + · rintro x ⟨u, rfl⟩ + exact (φ u).property + · intro x hx + exact ⟨φ.symm ⟨x, hx⟩, congrArg Subtype.val (φ.apply_symm_apply ⟨x, hx⟩)⟩ + have hXg : X = range (fun i => g (t i)) := hXrange + refine ⟨k, hk, arcSubdivisionVertex g t, arcSubdivisionPiece g t, + arcSubdivisionVertex_injective hk hg.2 t ht ht01, ?_, ?_, + fun i => arcSubdivisionPiece_isLine hk hg t ht ht01 i, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [arcSubdivisionVertex_zero] + exact hφ0 + · rw [arcSubdivisionVertex_last hk] + exact hφ1 + · exact (iUnion_arcSubdivisionPieces hk hg.2 t ht ht01).trans hgrange + · intro i + refine ⟨g (t i), hXg ▸ mem_range_self i, ?_⟩ + rw [hXg] + exact arcSubdivisionPiece_inter_marked hk hg.2 t ht ht01 i + · intro i + rw [hXg] + exact arcSubdivisionVertex_not_mem_marked hk hg.2 t ht ht01 i + · intro i j hij + exact arcSubdivisionPieces_inter_subset_vertices hk hg.2 t ht ht01 hij + · intro i + exact arcSubdivisionPiece_inter_vertices hk hg.2 t ht ht01 i + · rw [hXg] + change (range (g ∘ t)).ncard = k + rw [ncard_range_of_injective (hg.2.comp ht.injective), Nat.card_fin] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4OrderedEyeContactFamily.lean b/LeanPool/GraphMinor/GM12/Section4OrderedEyeContactFamily.lean new file mode 100644 index 0000000000..c12f289d7a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4OrderedEyeContactFamily.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.Surface.CircleMove +import LeanPool.GraphMinor.GM12.Section4EyeContactFamily +import LeanPool.GraphMinor.GM12.Section4EyeBoundaryParameters +import LeanPool.GraphMinor.GM11.Separate +import Mathlib.Order.Fin.Basic + +/-! +# Ordered contact discs for the eye data + +XII (4.5), pages 252--253, specifies the order of four vertices +on each eye circuit. Use that order to parametrize the region +boundary, then shrink the region closure while fixing the +four parameters. This gives disjoint target discs with exactly +the ordered marks required by claim (1). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM14 + +/-- The ordered target-disc preparation in XII (4.5), page 253, +from the actual circuits and vertices of the eye regions. -/ +theorem exists_ordered_eye_contact_family + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} (hcell : Γ.IsTwoCell) + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {δ : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T δ) (hE : Γ.E.Nonempty) + {t : ℕ} (ht : 2 ≤ t) (r : Fin t → Set S) (C : Fin t → Drawing S) + (a b c d : Fin t → S) (hr : ∀ i, r i ∈ Γ.R) (hri : Function.Injective r) + (hfar : ∀ i j, i ≠ j → 3 ≤ δ (r i) (r j)) + (hC : ∀ i, (C i).IsCircuit) (hCG : ∀ i, (C i).IsSubdrawing Γ) + (hCr : ∀ i, (C i).U = subBd (r i)) + (hmarks : ∀ i, a i ∈ (C i).V ∧ b i ∈ (C i).V ∧ + c i ∈ (C i).V ∧ d i ∈ (C i).V) + (horder : ∀ i, OccurInCircuitOrder (C i) (a i) (b i) (c i) (d i)) : + ∃ (D : Fin t → Set S) (q : Fin t → Circle → S) (β : Fin t → Fin 4 → ℝ), + (∀ i, IsClosedDisc (D i)) ∧ Pairwise (fun i j => Disjoint (D i) (D j)) ∧ + (∀ i, D i ⊆ closure (r i) ∧ D i ∩ Γ.U = {a i, b i, c i, d i} ∧ + ({a i, b i, c i, d i} : Set S) ⊆ discBd (D i)) ∧ + (∀ i, Continuous (q i) ∧ Function.Injective (q i) ∧ range (q i) = discBd (D i)) ∧ + (∀ i, StrictMono (β i)) ∧ (∀ i j, β i j ∈ Ico 0 1) ∧ + ∀ i, q i (ee (β i 0)) = a i ∧ q i (ee (β i 1)) = b i ∧ + q i (ee (β i 2)) = c i ∧ q i (ee (β i 3)) = d i := by + classical + let : Nontrivial (Fin t) := Fin.nontrivial_iff_two_le.mpr ht + have hCf : ∀ i, (C i).U = frontier (r i) := by + intro i + rw [hCr i, frontier_eq_closure_inter_closure, subBd, compl_eq_univ_sdiff] + have hex := fun i => exists_eye_boundary_parameters (horder i) + choose φ β hβ hβ01 ha hb hc hd using hex + let ψ : ∀ i, Circle ≃ₜ frontier (r i) := fun i => + (φ i).trans (Homeomorph.setCongr (hCf i)) + let N : Fin t → Set S := fun i => {a i, b i, c i, d i} + have hNV : ∀ i, N i ⊆ Γ.V := by + intro i x hx + rcases hx with rfl | rfl | rfl | hx + · exact (hCG i).1 (hmarks i).1 + · exact (hCG i).1 (hmarks i).2.1 + · exact (hCG i).1 (hmarks i).2.2.1 + · exact (mem_singleton_iff.mp hx) ▸ (hCG i).1 (hmarks i).2.2.2 + have hNb : ∀ i, N i ⊆ frontier (r i) := by + intro i x hx + rw [← hCf i] + rcases hx with rfl | rfl | rfl | hx + · exact (C i).V_subset_U (hmarks i).1 + · exact (C i).V_subset_U (hmarks i).2.1 + · exact (C i).V_subset_U (hmarks i).2.2.1 + · exact (mem_singleton_iff.mp hx) ▸ (C i).V_subset_U (hmarks i).2.2.2 + obtain ⟨D, q, hD, hDD, hDN, hq, hfix⟩ := exists_eye_contact_family hS hcell hm hE r N + hr hri hfar (fun i => hCf i ▸ GM11.IsCircuit.isOArc_U (hC i)) + hNV hNb (fun i => Set.toFinite (N i)) (fun i => ⟨a i, by simp [N]⟩) ψ + refine ⟨D, q, β, hD, hDD, hDN, hq, hβ, hβ01, ?_⟩ + intro i + have hψ : ∀ w, (ψ i w).val = (φ i w).val := fun _ => rfl + have hfa : q i (ee (β i 0)) = a i := by + rw [hfix i _ (by rw [hψ, ha i]; simp [N]), hψ, ha i] + have hfb : q i (ee (β i 1)) = b i := by + rw [hfix i _ (by rw [hψ, hb i]; simp [N]), hψ, hb i] + have hfc : q i (ee (β i 2)) = c i := by + rw [hfix i _ (by rw [hψ, hc i]; simp [N]), hψ, hc i] + have hfd : q i (ee (β i 3)) = d i := by + rw [hfix i _ (by rw [hψ, hd i]; simp [N]), hψ, hd i] + exact ⟨hfa, hfb, hfc, hfd⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4OrderedPortIntervals.lean b/LeanPool/GraphMinor/GM12/Section4OrderedPortIntervals.lean new file mode 100644 index 0000000000..8d0355add2 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4OrderedPortIntervals.lean @@ -0,0 +1,120 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Order.Fin.Basic +public import Mathlib.Topology.MetricSpace.Pseudo.Defs +public import Mathlib.Topology.Instances.Real.Lemmas +import Mathlib.Topology.Basic +import Mathlib.Topology.Algebra.Order.Field + +/-! +# Ordered intervals for circle ports + +The ports for XII (4.5), page 253, occur in blocks around the +vertices. Several ports may start from the same circle center. +A small positive perturbation, increasing with the port index, +puts them in strict order while retaining their assigned open +neighborhoods. Shrinking to small intervals then leaves room for +the general-position chord choices. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Topology + +/-- Split ordered, possibly equal, center parameters into strictly +ordered port parameters in prescribed open neighborhoods. This +chooses the order within the vertex blocks in XII (4.5), page 253. -/ +theorem exists_strictMono_ports_in_open {n : ℕ} (c : Fin n → ℝ) + (hc : Monotone c) (U : Fin n → Set ℝ) (hU : ∀ i, IsOpen (U i)) + (hcU : ∀ i, c i ∈ U i) : + ∃ p : Fin n → ℝ, StrictMono p ∧ ∀ i, p i ∈ U i := by + let A : Set ℝ := ⋂ i, (fun r : ℝ => c i + r * ((i : ℝ) + 1)) ⁻¹' U i + have hA : IsOpen A := isOpen_iInter_of_finite fun i => (hU i).preimage (by fun_prop) + have hzero : (0 : ℝ) ∈ A := by simpa [A] using hcU + obtain ⟨r, hr, hrA⟩ := Metric.isOpen_iff.mp hA 0 hzero + let ε := r / 2 + have hε : 0 < ε := by dsimp [ε]; linarith + have hεA : ε ∈ A := hrA (by + rw [mem_ball, Real.dist_eq, sub_zero, abs_of_pos hε] + dsimp [ε]; linarith) + refine ⟨fun i => c i + ε * ((i : ℝ) + 1), ?_, ?_⟩ + · intro i j hij + apply add_lt_add_of_le_of_lt (hc hij.le) + apply mul_lt_mul_of_pos_left _ hε + have hval : (i.val : ℝ) < (j.val : ℝ) := by exact_mod_cast hij + linarith + · intro i + exact mem_iInter.mp hεA i + +/-- Thicken a finite strictly ordered family of port parameters +to disjoint ordered intervals inside the assigned open sets. +These intervals leave room for the chord perturbations in XII +(4.5), page 253. -/ +theorem exists_ordered_intervals_in_open {n : ℕ} (p : Fin n → ℝ) + (hp : StrictMono p) (U : Fin n → Set ℝ) (hU : ∀ i, IsOpen (U i)) + (hpU : ∀ i, p i ∈ U i) : + ∃ u v : Fin n → ℝ, + (∀ i, u i < p i ∧ p i < v i ∧ Ioo (u i) (v i) ⊆ U i) ∧ + ∀ i j, i < j → v i < u j := by + classical + have hrad : ∀ i, ∃ r : ℝ, 0 < r ∧ ball (p i) r ⊆ U i := by + intro i + exact Metric.isOpen_iff.mp (hU i) (p i) (hpU i) + choose r hr hrU using hrad + let A : Set ℝ := (⋂ i, Iio (r i)) ∩ + (⋂ i, ⋂ j, if i < j then Iio ((p j - p i) / 3) else univ) + have hA : IsOpen A := by + apply IsOpen.inter (isOpen_iInter_of_finite fun _ => isOpen_Iio) + refine isOpen_iInter_of_finite fun i => isOpen_iInter_of_finite fun j => ?_ + split_ifs <;> first | exact isOpen_Iio | exact isOpen_univ + have hzero : (0 : ℝ) ∈ A := by + refine ⟨mem_iInter.mpr hr, mem_iInter.mpr fun i => mem_iInter.mpr fun j => ?_⟩ + split_ifs with hij + · change 0 < (p j - p i) / 3 + have h := hp hij + linarith + · exact mem_univ _ + obtain ⟨s, hs, hsA⟩ := Metric.isOpen_iff.mp hA 0 hzero + let ε := s / 2 + have hε : 0 < ε := by dsimp [ε]; linarith + have hεA : ε ∈ A := hsA (by + rw [mem_ball, Real.dist_eq, sub_zero, abs_of_pos hε] + dsimp [ε]; linarith) + refine ⟨fun i => p i - ε, fun i => p i + ε, ?_, ?_⟩ + · intro i + refine ⟨by linarith, by linarith, ?_⟩ + intro x hx + apply hrU i + rw [mem_ball, Real.dist_eq, abs_lt] + have hεr : ε < r i := mem_iInter.mp hεA.1 i + constructor <;> linarith [hx.1, hx.2] + · intro i j hij + have hsmall : ε < (p j - p i) / 3 := by + have h := mem_iInter.mp (mem_iInter.mp hεA.2 i) j + simpa [hij] using h + linarith + +/-- Choose strictly ordered, nonempty intervals for all ports, +allowing their assigned centers to coincide within vertex blocks. +This is the interval choice for XII (4.5), page 253. -/ +theorem exists_ordered_port_intervals {n : ℕ} (c : Fin n → ℝ) + (hc : Monotone c) (U : Fin n → Set ℝ) (hU : ∀ i, IsOpen (U i)) + (hcU : ∀ i, c i ∈ U i) : + ∃ u v : Fin n → ℝ, + (∀ i, u i < v i ∧ Ioo (u i) (v i) ⊆ U i) ∧ + ∀ i j, i < j → v i < u j := by + obtain ⟨p, hp, hpU⟩ := exists_strictMono_ports_in_open c hc U hU hcU + obtain ⟨u, v, huv, horder⟩ := exists_ordered_intervals_in_open p hp U hU hpU + exact ⟨u, v, fun i => ⟨(huv i).1.trans (huv i).2.1, (huv i).2.2⟩, horder⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4OuterPorts.lean b/LeanPool/GraphMinor/GM12/Section4OuterPorts.lean new file mode 100644 index 0000000000..1a2cd1e529 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4OuterPorts.lean @@ -0,0 +1,150 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4ChordGeometry +public import Mathlib.Analysis.Complex.Basic +import LeanPool.GraphMinor.Surface.Lunes + +/-! +# Joining a circle port to an outer vertex + +For the crossing drawing of XII (4.5), page 253, join the ports +near each vertex by straight outer pieces. The tangent line to the +unit circle at a port gives a simple test: if the vertex lies +strictly beyond that tangent, the connecting segment meets the +unit disc only at its port. Thus these pieces cannot meet the +interior chords. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Surface + +/-- An outer segment from a unit circle port to a point beyond +its tangent line meets the unit disc exactly at the port. This +keeps the vertex pieces away from the chords in XII (4.5), page 253. -/ +theorem outer_port_segment_inter_disc {a v : ℂ} (ha : ‖a‖ = 1) + (hv : 1 < ((starRingEnd ℂ) a * v).re) : + segment ℝ a v ∩ closedBall 0 1 = {a} := by + have haa : ((starRingEnd ℂ) a * a).re = 1 := by + rw [RCLike.conj_mul, ha] + norm_num + ext x + constructor + · rintro ⟨hx, hxD⟩ + obtain ⟨s, t, hs, ht, hst, rfl⟩ := hx + by_cases ht0 : t = 0 + · have hs1 : s = 1 := by simpa [ht0] using hst + simp [ht0, hs1] + · have htp : 0 < t := lt_of_le_of_ne ht (fun h => ht0 h.symm) + have hlin : ((starRingEnd ℂ) a * (s • a + t • v)).re = + s + t * ((starRingEnd ℂ) a * v).re := by + simp only [mul_add, mul_smul_comm, Complex.add_re, Complex.smul_re, smul_eq_mul, haa, + mul_one] + have hbig : 1 < ((starRingEnd ℂ) a * (s • a + t • v)).re := by + rw [hlin] + have hmul := mul_lt_mul_of_pos_left hv htp + nlinarith + have hbound := Complex.re_le_norm ((starRingEnd ℂ) a * (s • a + t • v)) + rw [norm_mul, Complex.norm_conj, ha, one_mul] at hbound + have hnorm := mem_closedBall_zero_iff.mp hxD + exact False.elim ((not_lt_of_ge (hbound.trans hnorm)) hbig) + · rintro rfl + exact ⟨left_mem_segment _ _ _, by simp [ha]⟩ + +/-- An outer port segment is a simple arc. The strict tangent +inequality also proves its two ends are distinct. -/ +theorem outer_port_segment_isLine {a v : ℂ} (ha : ‖a‖ = 1) + (hv : 1 < ((starRingEnd ℂ) a * v).re) : + IsLineWithEnds (segment ℝ a v) a v := by + apply isLineWithEnds_segment + intro h + rw [← h, RCLike.conj_mul, ha] at hv + norm_num at hv + +/-- An outer vertex piece cannot meet a chord with two other +ports. Thus all crossings between different edges in the source +drawing of XII (4.5), page 253, occur between their inner chords. -/ +theorem outer_port_segment_disjoint_chord {a v b c : ℂ} + (ha : ‖a‖ = 1) (hb : ‖b‖ = 1) (hc : ‖c‖ = 1) + (hv : 1 < ((starRingEnd ℂ) a * v).re) + (hbc : b ≠ c) (hab : a ≠ b) (hac : a ≠ c) : + Disjoint (segment ℝ a v) (segment ℝ b c) := by + apply disjoint_left.mpr + intro x hx hx' + have hgeom := unit_chord_geometry hb hc hbc + have hxa : x = a := show x ∈ ({a} : Set ℂ) from + outer_port_segment_inter_disc ha hv ▸ And.intro hx (hgeom.2.1 hx') + subst x + have hport : a = b ∨ a = c := show a ∈ ({b, c} : Set ℂ) from + hgeom.2.2 ▸ And.intro hx' (by simp [ha]) + exact hport.elim hab hac + +private theorem outer_point_not_on_port_line {a b v : ℂ} + (ha : ‖a‖ = 1) (hb : ‖b‖ = 1) + (hva : 1 < ((starRingEnd ℂ) a * v).re) + (hvb : 1 < ((starRingEnd ℂ) b * v).re) : + v ∉ line[ℝ, a, b] := by + intro hvline + obtain ⟨t, ht⟩ := mem_affineSpan_pair_iff_exists_lineMap_eq.mp hvline + have haa : ((starRingEnd ℂ) a * a).re = 1 := by + rw [RCLike.conj_mul, ha]; norm_num + have hbb : ((starRingEnd ℂ) b * b).re = 1 := by + rw [RCLike.conj_mul, hb]; norm_num + have hab : ((starRingEnd ℂ) a * b).re = ((starRingEnd ℂ) b * a).re := by + simp only [Complex.mul_re, Complex.conj_re, Complex.conj_im] + ring + have hsum : ((starRingEnd ℂ) a * v).re + ((starRingEnd ℂ) b * v).re = + 1 + ((starRingEnd ℂ) a * b).re := by + rw [← ht, AffineMap.lineMap_apply_module] + simp only [mul_add, mul_smul_comm, Complex.add_re, Complex.smul_re, smul_eq_mul, + haa, hbb, ← hab] + ring + have hbound := Complex.re_le_norm ((starRingEnd ℂ) a * b) + rw [norm_mul, Complex.norm_conj, ha, hb, one_mul] at hbound + linarith + +/-- Outer pieces joining distinct visible ports to one vertex +meet exactly at that vertex. This proves the vertex-star part of +the crossing construction in XII (4.5), page 253. -/ +theorem outer_port_segments_inter {a b v : ℂ} + (ha : ‖a‖ = 1) (hb : ‖b‖ = 1) (hab : a ≠ b) + (hva : 1 < ((starRingEnd ℂ) a * v).re) + (hvb : 1 < ((starRingEnd ℂ) b * v).re) : + segment ℝ a v ∩ segment ℝ b v = {v} := by + ext x + constructor + · rintro ⟨hxa, hxb⟩ + by_cases hxv : x = v + · exact hxv + have hxlinea : x ∈ line[ℝ, a, v] := + (line[ℝ, a, v]).convex.segment_subset + (left_mem_affineSpan_pair _ _ _) (right_mem_affineSpan_pair _ _ _) hxa + have hxlineb : x ∈ line[ℝ, b, v] := + (line[ℝ, b, v]).convex.segment_subset + (left_mem_affineSpan_pair _ _ _) (right_mem_affineSpan_pair _ _ _) hxb + have hea := affineSpan_pair_eq_of_mem_of_mem_of_ne hxlinea + (right_mem_affineSpan_pair ℝ a v) hxv + have heb := affineSpan_pair_eq_of_mem_of_mem_of_ne hxlineb + (right_mem_affineSpan_pair ℝ b v) hxv + have hbline : b ∈ line[ℝ, a, v] := by + rw [← hea, heb] + exact left_mem_affineSpan_pair _ _ _ + have heq := affineSpan_pair_eq_of_right_mem_of_ne hbline (fun h => hab h.symm) + have hvline : v ∈ line[ℝ, a, b] := by + rw [heq] + exact right_mem_affineSpan_pair _ _ _ + exact False.elim (outer_point_not_on_port_line ha hb hva hvb hvline) + · rintro rfl + exact ⟨right_mem_segment _ _ _, right_mem_segment _ _ _⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PairEnumeration.lean b/LeanPool/GraphMinor/GM12/Section4PairEnumeration.lean new file mode 100644 index 0000000000..4a072df272 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PairEnumeration.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Data.Fintype.EquivFin +public import Mathlib.Data.Fintype.Sigma +import Mathlib.Algebra.BigOperators.Intervals +import Mathlib.Algebra.BigOperators.Fin +import Mathlib.Data.Finset.Card + +/-! +# Enumerating the pairs of clique vertices + +XII (4.4), page 251, numbers the external paths by the unordered +pairs of distinct clique vertices. Write such a pair with the +smaller vertex first. Grouping pairs by their larger vertex gives +the sum `0 + 1 + ... + (p - 1)`, hence `p * (p - 1) / 2` labels. +-/ + +public section + +namespace GraphMinor.GM12 + +/-- The number of pairs of distinct vertices, represented by a +larger vertex and a smaller index, as used in XII (4.4). -/ +theorem card_ordered_clique_pairs (p : ℕ) : + Fintype.card (Σ j : Fin p, Fin j.val) = p * (p - 1) / 2 := by + rw [Fintype.card_sigma] + simp only [Fintype.card_fin] + calc + (∑ i : Fin p, i.val) = ∑ i ∈ Finset.range p, i := + Fin.sum_univ_eq_sum_range (fun i : ℕ => i) p + _ = p * (p - 1) / 2 := Finset.sum_range_id p + +/-- The path labels of XII (4.4), page 251, can be put in bijection +with the pairs of distinct clique vertices. -/ +theorem nonempty_clique_pair_enumeration (p : ℕ) : + Nonempty (Fin (p * (p - 1) / 2) ≃ Σ j : Fin p, Fin j.val) := by + exact ⟨Fintype.equivOfCardEq (by rw [Fintype.card_fin, card_ordered_clique_pairs])⟩ + +/-- A vertex of a clique with at least three vertices has two +distinct other vertices, as used in XII (4.4), page 252. -/ +theorem exists_two_other_clique_vertices {p : ℕ} (hp : 3 ≤ p) (v : Fin p) : + ∃ w z : Fin p, w ≠ v ∧ z ≠ v ∧ w ≠ z := by + classical + have hcard : 1 < (Finset.univ.erase v).card := by + rw [Finset.card_erase_of_mem (Finset.mem_univ v), Finset.card_univ, Fintype.card_fin] + omega + obtain ⟨w, hw, z, hz, hwz⟩ := Finset.one_lt_card.mp hcard + exact ⟨w, z, (Finset.mem_erase.mp hw).1, (Finset.mem_erase.mp hz).1, hwz⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ParallelAugment.lean b/LeanPool/GraphMinor/GM12/Section4ParallelAugment.lean new file mode 100644 index 0000000000..3709d241ca --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ParallelAugment.lean @@ -0,0 +1,148 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM12.Section4ParallelFamily +import LeanPool.GraphMinor.GM12.Section4FiniteLineDrawing +import LeanPool.GraphMinor.GM11.PaintingCells +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Doubling the nonloop edges of a drawing + +In the target replacement of XII (4.3), page 249, vertices +incident with one edge can be given a second incident edge by +adding a parallel copy. Assemble all the copies as a drawing and +glue them to the original. Each copy has the original two distinct +ends. Thus the augmented drawing stays loopless, and every +original edge has a distinct parallel edge in the augmentation. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The parallel-edge part of the loopless minimum-degree-two +target replacement in XII (4.3), page 249. -/ +theorem exists_parallel_edge_augmentation + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) (u v : Set S → S) + (hl : ∀ e ∈ Γ.E, Γ.toGraph.IsLink e (u e) (v e)) + (hne : ∀ e ∈ Γ.E, u e ≠ v e) : + ∃ H : Drawing S, Γ.IsSubdrawing H ∧ H.V = Γ.V ∧ + (∀ e x, ¬ H.toGraph.IsLink e x x) ∧ + ∀ e ∈ Γ.E, ∃ g ∈ H.E, g ≠ e ∧ + H.toGraph.IsLink e (u e) (v e) ∧ H.toGraph.IsLink g (u e) (v e) := by + obtain ⟨P, hP, hPP⟩ := exists_parallel_edge_family hS Γ Γ.finite_edges u v hl hne + have hPV : ∀ e ∈ Γ.E, P e ∩ Γ.V = {u e, v e} := by + intro e he + apply Set.Subset.antisymm + · exact fun x hx => (hP e he).2.1.subset ⟨hx.1, Γ.V_subset_U hx.2⟩ + · intro x hx + rcases hx with rfl | hx + · exact ⟨Surface.IsLineWithEnds.left_mem (hP e he).1, (hl e he).left_mem⟩ + · exact (Set.mem_singleton_iff.mp hx) ▸ ⟨Surface.IsLineWithEnds.right_mem (hP e he).1, + (hl e he).right_mem⟩ + obtain ⟨K, hKU, hKV, hKE⟩ := exists_drawing_of_finite_lines Γ.finite_V Γ.finite_edges P u v + (fun e he => (hP e he).1) hne hPV hPP + have hglue : Γ.U ∩ K.U ⊆ Γ.V ∩ K.V := by + rintro x ⟨hxΓ, hxK⟩ + rw [hKU] at hxK + have hxV : x ∈ Γ.V := by + rcases hxK with hxV | hxK + · exact hxV + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hxK + have hends := (hP e he).2.1.subset ⟨hxe, hxΓ⟩ + rcases hends with rfl | hends + · exact (hl e he).left_mem + · exact (Set.mem_singleton_iff.mp hends) ▸ (hl e he).right_mem + exact ⟨hxV, hKV.symm ▸ hxV⟩ + let H := Γ.glue K hglue + have hHV : H.V = Γ.V := by + change Γ.V ∪ K.V = Γ.V + rw [hKV, union_self] + have hHE : H.E = Γ.E ∪ K.E := Drawing.glue_E hglue + have hΓH : Γ.IsSubdrawing H := by + refine ⟨?_, ?_⟩ + · rw [hHV] + · rw [hHE] + exact subset_union_left + have hlink : ∀ e ∈ Γ.E, H.toGraph.IsLink (P e \ {u e, v e}) (u e) (v e) := by + intro e he + refine ⟨?_, hHV.symm ▸ (hl e he).left_mem, hHV.symm ▸ (hl e he).right_mem, ?_⟩ + · rw [hHE, hKE] + exact Or.inr ⟨e, he, rfl⟩ + · rw [closure_sdiff_pair (hP e he).1, hHV] + exact hPV e he + have hnonloop : ∀ g ∈ H.E, ∃ x y, x ≠ y ∧ H.toGraph.IsLink g x y := by + intro g hg + rw [hHE, hKE] at hg + rcases hg with hg | ⟨e, he, rfl⟩ + · exact ⟨u g, v g, hne g hg, (hΓH.isLink_iff hg).mp (hl g hg)⟩ + · exact ⟨u e, v e, hne e he, hlink e he⟩ + refine ⟨H, hΓH, hHV, ?_, ?_⟩ + · intro g x hloop + obtain ⟨y, z, hyz, hlink'⟩ := hnonloop g hloop.edge_mem + have hy : y = x := (H.toGraph.eq_or_eq_of_isLink_of_isLink hlink' hloop).elim id id + have hz : z = x := (H.toGraph.eq_or_eq_of_isLink_of_isLink hlink'.symm hloop).elim id id + exact hyz (hy.trans hz.symm) + · intro e he + refine ⟨P e \ {u e, v e}, (hlink e he).edge_mem, ?_, (hΓH.isLink_iff he).mp (hl e he), + hlink e he⟩ + intro heq + obtain ⟨x, hxe⟩ := he.1 + have hxnew : x ∈ P e \ {u e, v e} := heq.symm ▸ hxe + exact hxnew.2 ((hP e he).2.1.subset ⟨hxnew.1, (he.2.1 hxe).1⟩) + +/-- Doubling edges makes every nonisolated vertex incident with at +least two distinct edges, while preserving the vertex set and looplessness. -/ +theorem exists_minimum_degree_two_augmentation + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) + (hloopless : ∀ e x, ¬ Γ.toGraph.IsLink e x x) + (hincident : ∀ x ∈ Γ.V, ∃ e, Γ.toGraph.Inc e x) : + ∃ H : Drawing S, Γ.IsSubdrawing H ∧ H.V = Γ.V ∧ + (∀ e x, ¬ H.toGraph.IsLink e x x) ∧ + ∀ x ∈ H.V, ∃ e f, e ≠ f ∧ H.toGraph.Inc e x ∧ H.toGraph.Inc f x := by + classical + let dflt : S := Classical.arbitrary S + have hex : ∀ e : Γ.E, ∃ u v, Γ.toGraph.IsLink e.val u v := + fun e => Γ.toGraph.exists_isLink_of_mem_edgeSet e.property + choose u₀ v₀ hlink using hex + let u : Set S → S := fun e => if he : e ∈ Γ.E then u₀ ⟨e, he⟩ else dflt + let v : Set S → S := fun e => if he : e ∈ Γ.E then v₀ ⟨e, he⟩ else dflt + have hl : ∀ e ∈ Γ.E, Γ.toGraph.IsLink e (u e) (v e) := by + intro e he + simpa only [u, v, dite_eq_left he] using hlink ⟨e, he⟩ + have hne : ∀ e ∈ Γ.E, u e ≠ v e := by + intro e he heq + have h := hl e he + rw [heq] at h + exact hloopless e (v e) h + obtain ⟨H, hΓH, hHV, hHloop, hparallel⟩ := exists_parallel_edge_augmentation hS Γ u v hl hne + refine ⟨H, hΓH, hHV, hHloop, ?_⟩ + intro x hx + have hxΓ : x ∈ Γ.V := hHV ▸ hx + obtain ⟨e, hex⟩ := hincident x hxΓ + have he : e ∈ Γ.E := hex.edge_mem + obtain ⟨f, _, hfe, heH, hfH⟩ := hparallel e he + refine ⟨e, f, Ne.symm hfe, ?_, ?_⟩ + · rcases hex.eq_or_eq_of_isLink (hl e he) with hx | hx + · exact hx ▸ heH.inc_left + · exact hx ▸ heH.inc_right + · rcases hex.eq_or_eq_of_isLink (hl e he) with hx | hx + · exact hx ▸ hfH.inc_left + · exact hx ▸ hfH.inc_right + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ParallelFamily.lean b/LeanPool/GraphMinor/GM12/Section4ParallelFamily.lean new file mode 100644 index 0000000000..8c5b62e9d6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ParallelFamily.lean @@ -0,0 +1,114 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM12.Section4ParallelLine +import LeanPool.GraphMinor.GM11.EdgeSides +import LeanPool.GraphMinor.GM11.RadialCorners +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Adding all parallel edge copies without crossings + +For the minimum-degree-two replacement in XII (4.3), page 249, +add a parallel line for each nonloop edge. At each step forbid +the original drawing with that edge removed and all copies already +added. This is a closed set meeting the edge closure only at its +ends. Thus the new copy introduces no crossing with any old copy. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The simultaneous parallel-copy construction used in the target +replacement at the start of XII (4.3), page 249. -/ +theorem exists_parallel_edge_family + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) {E : Set (Set S)} (hE : E.Finite) + (u v : Set S → S) (hl : ∀ e ∈ E, Γ.toGraph.IsLink e (u e) (v e)) + (hne : ∀ e ∈ E, u e ≠ v e) : + ∃ P : Set S → Set S, + (∀ e ∈ E, IsLineWithEnds (P e) (u e) (v e) ∧ + P e ∩ Γ.U = {u e, v e} ∧ P e ∩ closure e = {u e, v e}) ∧ + (∀ e ∈ E, ∀ f ∈ E, e ≠ f → P e ∩ P f ⊆ Γ.V) := by + classical + revert hl hne + induction E, hE using Set.Finite.induction_on with + | empty => + intro _ _ + exact ⟨fun _ => ∅, by simp, by simp⟩ + | @insert e E he hE ih => + intro hl hne + obtain ⟨P, hP, hPP⟩ := ih (fun f hf => hl f (Or.inr hf)) (fun f hf => hne f (Or.inr hf)) + have hel := hl e (Or.inl rfl) + have huv := hne e (Or.inl rfl) + have hL : IsLineWithEnds (closure e) (u e) (v e) := + isLine_closure hel.edge_mem huv hel.2.2.2 + let Z : Set S := (Γ.U \ e) ∪ ⋃ f ∈ E, P f + have hZ : IsClosed Z := (isClosed_U_sdiff_edge Γ hel.edge_mem).union + (hE.isClosed_biUnion (fun f hf => (Surface.IsLineWithEnds.isCompact (hP f hf).1).isClosed)) + have hcap : closure e ∩ Z ⊆ {u e, v e} := by + rintro x ⟨hxcl, hxZ⟩ + have hxV : x ∈ Γ.V := by + rcases hxZ with hx | hx + · by_contra hxV + have hxe : x ∈ e := by rw [← Γ.closure_diff_V hel.edge_mem]; exact ⟨hxcl, hxV⟩ + exact hx.2 hxe + · obtain ⟨f, hf, hxP⟩ := mem_iUnion₂.mp hx + have hxU : x ∈ Γ.U := Γ.closure_subset_U hel.edge_mem hxcl + have hends := (hP f hf).2.1.subset ⟨hxP, hxU⟩ + rcases hends with rfl | hends + · exact (hl f (Or.inr hf)).left_mem + · exact (Set.mem_singleton_iff.mp hends) ▸ (hl f (Or.inr hf)).right_mem + exact hel.2.2.2 ▸ ⟨hxcl, hxV⟩ + obtain ⟨Q, hQ, hQZ, hQL⟩ := exists_parallel_line hS hL huv hZ hcap + have hQU : Q ∩ Γ.U = {u e, v e} := by + apply Set.Subset.antisymm + · rintro x ⟨hxQ, hxU⟩ + by_cases hxe : x ∈ e + · exact hQL.subset ⟨hxQ, subset_closure hxe⟩ + · exact hQZ ⟨hxQ, Or.inl ⟨hxU, hxe⟩⟩ + · intro x hx + rcases hx with rfl | hx + · exact ⟨hQ.left_mem, Γ.V_subset_U hel.left_mem⟩ + · exact (Set.mem_singleton_iff.mp hx) ▸ ⟨hQ.right_mem, Γ.V_subset_U hel.right_mem⟩ + have hQP : ∀ f ∈ E, Q ∩ P f ⊆ Γ.V := by + intro f hf x hx + have hends := hQZ ⟨hx.1, Or.inr (mem_iUnion₂.mpr ⟨f, hf, hx.2⟩)⟩ + rcases hends with rfl | hends + · exact hel.left_mem + · exact (Set.mem_singleton_iff.mp hends) ▸ hel.right_mem + let P' : Set S → Set S := fun f => if f = e then Q else P f + refine ⟨P', ?_, ?_⟩ + · intro f hf + rcases hf with hfe | hf + · subst f + simpa only [P', ↓reduceIte] using (show IsLineWithEnds Q (u e) (v e) ∧ + Q ∩ Γ.U = {u e, v e} ∧ Q ∩ closure e = {u e, v e} from ⟨hQ, hQU, hQL⟩) + · have hfe : f ≠ e := fun h => he (h ▸ hf) + simpa only [P', hfe, ↓reduceIte] using hP f hf + · intro f hf g hg hfg + by_cases hfe : f = e + · subst f + have hge : g ≠ e := Ne.symm hfg + have hgE : g ∈ E := hg.resolve_left hge + simpa only [P', ↓reduceIte, hge, ↓reduceIte] using hQP g hgE + · have hfE : f ∈ E := hf.resolve_left hfe + by_cases hge : g = e + · subst g + have hc : P f ∩ Q ⊆ Γ.V := fun x hx => hQP f hfE ⟨hx.2, hx.1⟩ + simpa only [P', ↓reduceIte, hfe, ↓reduceIte] using hc + · have hgE : g ∈ E := hg.resolve_left hge + simpa only [P', hfe, ↓reduceIte, hge, ↓reduceIte] using hPP f hfE g hgE hfg + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ParallelLine.lean b/LeanPool/GraphMinor/GM12/Section4ParallelLine.lean new file mode 100644 index 0000000000..a365ff0a15 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ParallelLine.lean @@ -0,0 +1,109 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.EdgeLens +import LeanPool.GraphMinor.Surface.Classification +import LeanPool.GraphMinor.Surface.InvarianceOfDomain + +/-! +# Parallel copies of target edges + +The loopless minimum-degree-two replacement at the start of XII +(4.3), page 249, may add a parallel copy of an edge inside a +thin lens. The lens avoids the rest of the drawing. One of its +boundary arcs is the new copy, with the same ends and with no +other point on the original line or the forbidden closed set. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +private theorem line_image {S U : Type*} [TopologicalSpace S] [TopologicalSpace U] [T2Space U] + {j : S → U} (hc : Continuous j) (hi : Function.Injective j) + {L : Set S} {u v : S} (hL : IsLineWithEnds L u v) : + IsLineWithEnds (j '' L) (j u) (j v) := + hL.image_under_injOn hc.continuousOn hi.injOn + +private theorem parallel_line_small + {S : Type} [TopologicalSpace S] [T2Space S] (hS : IsClosedSurface S) + {L Z : Set S} {u v : S} (hL : IsLineWithEnds L u v) (huv : u ≠ v) + (hZ : IsClosed Z) (hLZ : L ∩ Z ⊆ {u, v}) : + ∃ P : Set S, IsLineWithEnds P u v ∧ P ∩ Z ⊆ {u, v} ∧ P ∩ L = {u, v} := by + obtain ⟨D, _, _, hD, hLD, hDZ, huD, hvD, hbdL, _⟩ := exists_edge_lens hS hL huv hZ hLZ + obtain ⟨a, b, hab, ha0, ha1, hr⟩ := hD.isOArc_discBd.exists_arcs huD hvD huv + have ha : IsLineWithEnds (range a) u v := by + simpa only [ha0, ha1] using hab.1.isLineWithEnds + have haBd : range a ⊆ discBd D := fun x hx => hr ▸ Or.inl hx + have haD : range a ⊆ D := haBd.trans (discBd_subset D) + refine ⟨range a, ha, ?_, ?_⟩ + · exact fun x hx => hDZ ⟨haD hx.1, hx.2⟩ + · apply Set.Subset.antisymm + · exact fun x hx => hbdL ⟨haBd hx.1, hx.2⟩ + · intro x hx + rcases hx with rfl | hx + · exact ⟨ha.left_mem, hL.left_mem⟩ + · have hxv := Set.mem_singleton_iff.mp hx + subst x + exact ⟨ha.right_mem, hL.right_mem⟩ + +/-- A parallel copy of a line avoiding a forbidden closed set away +from its two ends, used in the target replacement of XII (4.3). -/ +theorem exists_parallel_line + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {L Z : Set S} {u v : S} + (hL : IsLineWithEnds L u v) (huv : u ≠ v) (hZ : IsClosed Z) + (hLZ : L ∩ Z ⊆ {u, v}) : + ∃ P : Set S, IsLineWithEnds P u v ∧ P ∩ Z ⊆ {u, v} ∧ P ∩ L = {u, v} := by + let : CompactSpace S := hS.1 + have hsurf : IsSurface S := ⟨hS.1, hS.2.1, fun x => (hS.2.2 x).isManifoldPoint⟩ + obtain ⟨n, m, c, ⟨e⟩⟩ := classification S hsurf inferInstance + let : T2Space (SurfaceModel n m c) := e.t2Space + have hM : IsClosedSurface (SurfaceModel n m c) := by + refine ⟨e.compactSpace, e.t2Space, ?_⟩ + intro x + have hx := (isInteriorPoint_homeomorph_iff e (e.symm x)).mpr (hS.2.2 (e.symm x)) + simpa only [e.apply_symm_apply] using hx + have hL' := line_image e.continuous e.injective hL + have hZ' : IsClosed (e.symm ⁻¹' Z) := hZ.preimage e.symm.continuous + have hLZ' : (e '' L) ∩ (e.symm ⁻¹' Z) ⊆ {e u, e v} := by + rintro _ ⟨⟨x, hxL, rfl⟩, hxZ⟩ + have hx : x ∈ Z := by simpa only [mem_preimage, e.symm_apply_apply] using hxZ + rcases hLZ ⟨hxL, hx⟩ with h | h + · exact Or.inl (congrArg e h) + · exact Or.inr (Set.mem_singleton_iff.mpr (congrArg e (Set.mem_singleton_iff.mp h))) + obtain ⟨P, hP, hPZ, hPL⟩ := parallel_line_small hM hL' (fun h => huv (e.injective h)) hZ' hLZ' + refine ⟨e.symm '' P, ?_, ?_, ?_⟩ + · have hline := line_image e.symm.continuous e.symm.injective hP + simpa only [e.symm_apply_apply] using hline + · rintro _ ⟨⟨x, hxP, rfl⟩, hxZ⟩ + have hxends := hPZ ⟨hxP, hxZ⟩ + rcases hxends with h | h + · exact Or.inl ((congrArg e.symm h).trans (e.symm_apply_apply u)) + · exact Or.inr (Set.mem_singleton_iff.mpr + ((congrArg e.symm (Set.mem_singleton_iff.mp h)).trans (e.symm_apply_apply v))) + · apply Set.Subset.antisymm + · rintro _ ⟨⟨x, hxP, rfl⟩, hxL⟩ + have hxL' : x ∈ e '' L := ⟨e.symm x, hxL, e.apply_symm_apply x⟩ + have hxends := hPL.subset ⟨hxP, hxL'⟩ + rcases hxends with h | h + · exact Or.inl ((congrArg e.symm h).trans (e.symm_apply_apply u)) + · exact Or.inr (Set.mem_singleton_iff.mpr + ((congrArg e.symm (Set.mem_singleton_iff.mp h)).trans (e.symm_apply_apply v))) + · intro x hx + rcases hx with hxu | hx + · exact hxu ▸ ⟨⟨e u, hP.left_mem, e.symm_apply_apply u⟩, hL.left_mem⟩ + · have hxv := Set.mem_singleton_iff.mp hx + exact hxv ▸ ⟨⟨e v, hP.right_mem, e.symm_apply_apply v⟩, hL.right_mem⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ParametrizedContactDisc.lean b/LeanPool/GraphMinor/GM12/Section4ParametrizedContactDisc.lean new file mode 100644 index 0000000000..b927b6b16a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ParametrizedContactDisc.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4UnitDiscContacts +import LeanPool.GraphMinor.Surface.DiscPolygon +import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# Shrinking a disc while retaining its marked parameters + +For XII (4.5), page 253, replace a region closure by a smaller +disc touching its boundary only at four prescribed vertices. +Extend the given boundary parametrization to a chart of the +disc, carry the marks to the unit circle, and use the convex +contact disc there. Its radial parametrization fixes the +marks. Carrying it back retains their original parameters, +so their order is available for the four-marked disc match. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Metric + +/-- A finite nonempty boundary contact set can be realized by +a smaller disc whose boundary parametrization agrees with the +original one at every contact. This prepares the ordered target +discs for XII (4.5), page 253. -/ +theorem exists_contact_disc_preserving_param {S : Type} [TopologicalSpace S] + {D N : Set S} (hD : IsClosedDisc D) (φ : Circle ≃ₜ discBd D) + (hN : N ⊆ discBd D) (hfin : N.Finite) (hne : N.Nonempty) : + ∃ (Q : Set S) (p : Circle → S), IsClosedDisc Q ∧ Q ⊆ D ∧ Q ∩ discBd D = N ∧ + N ⊆ discBd Q ∧ Continuous p ∧ Function.Injective p ∧ range p = discBd Q ∧ + ∀ w, (φ w).val ∈ N → p w = (φ w).val := by + obtain ⟨h, g, c, hgφ⟩ := exists_chart_extending hD φ + have hgφ' : ∀ w : Circle, g (w : ℂ) = (φ w).val := by + intro w + obtain ⟨t, rfl⟩ := Circle.exp_surjective w + exact hgφ t + let N₀ := h '' N + have hN₀ : N₀ ⊆ sphere (0 : ℂ) 1 := by + rintro _ ⟨n, hn, rfl⟩ + exact c.bd ▸ mem_image_of_mem h (hN hn) + obtain ⟨K, p₀, hK, hKsub, hKN, -, hp₀c, hp₀i, hp₀r, hp₀fix⟩ := + exists_unit_disc_contacts_with_param hN₀ (hfin.image h) (hne.image h) + have hp₀K : ∀ w, p₀ w ∈ K := fun w => discBd_subset _ (hp₀r ▸ mem_range_self w) + have hQD : g '' K ⊆ D := fun z hz => by + obtain ⟨y, hy, rfl⟩ := hz + exact c.gm (hKsub hy) + obtain ⟨hQ, hQbd⟩ := hK.image (c.gc.mono hKsub) (c.hc.mono hQD) + (fun z hz => c.hg (hKsub hz)) + have hgi : InjOn g K := by + intro z hz y hy hzy + have heq := congrArg h hzy + rwa [c.hg (hKsub hz), c.hg (hKsub hy)] at heq + let p := g ∘ p₀ + have hpc : Continuous p := c.gc.comp_continuous hp₀c (fun w => hKsub (hp₀K w)) + have hpi : Function.Injective p := fun a b hab => hp₀i (hgi (hp₀K a) (hp₀K b) hab) + have hpr : range p = discBd (g '' K) := by + rw [show p = g ∘ p₀ from rfl, range_comp, hp₀r, hQbd] + have hfix : ∀ w, (φ w).val ∈ N → p w = (φ w).val := by + intro w hw + have hwN : (w : ℂ) ∈ N₀ := by + refine ⟨(φ w).val, hw, ?_⟩ + rw [← hgφ' w] + exact c.hg (sphere_subset_closedBall w.property) + change g (p₀ w) = _ + rw [hp₀fix w hwN, hgφ'] + have hgh : ∀ n ∈ N, g (h n) = n := fun n hn => c.gh (discBd_subset D (hN hn)) + have hcontact : (g '' K) ∩ discBd D = N := by + apply Subset.antisymm + · rintro _ ⟨⟨z, hz, rfl⟩, hzBd⟩ + have hzS : z ∈ sphere (0 : ℂ) 1 := by + have h' : h (g z) ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem h hzBd + rwa [c.hg (hKsub hz)] at h' + obtain ⟨n, hn, heq⟩ := hKN.subset ⟨hz, hzS⟩ + rw [← heq, hgh n hn] + exact hn + · intro n hn + have hnK : h n ∈ K := ((hKN.symm).subset (mem_image_of_mem h hn)).1 + exact ⟨⟨h n, hnK, hgh n hn⟩, hN hn⟩ + have hNQ : N ⊆ discBd (g '' K) := by + intro n hn + let w := φ.symm ⟨n, hN hn⟩ + have hw : (φ w).val = n := congrArg Subtype.val (φ.apply_symm_apply ⟨n, hN hn⟩) + have hpw : p w = n := (hfix w (hw.symm ▸ hn)).trans hw + exact hpr ▸ (show n ∈ range p from ⟨w, hpw⟩) + exact ⟨g '' K, p, hQ, hQD, hcontact, hNQ, hpc, hpi, hpr, hfix⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PartitionControl.lean b/LeanPool/GraphMinor/GM12/Section4PartitionControl.lean new file mode 100644 index 0000000000..ac5b6e9885 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PartitionControl.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4EndPartition +import LeanPool.GraphMinor.GM12.Section4DrawingControl +import LeanPool.GraphMinor.GM11.CitedResults + +/-! +# Using the prescribed end classes as minor branches + +XII (4.3), page 251, applies (3.2) with the classes defined +by the oriented target edges. Each selected edge then joins its +two assigned branches. Since every target vertex has two distinct +incident edges, each branch contains ends of two distant selected +edges. The connected-branch estimate verifies control. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM10 GM11 GM14 Hypergraph + +/-- The assembly following the application of (3.2) in XII (4.3), +page 251, with finite vertex and edge labels. -/ +theorem controlsMinor_of_end_partition + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ k p t : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + (L : Graph (Fin p) (Fin t)) (f : Fin t → Set S) (a b : Fin t → S) + (κ : Fin t × Bool → Fin p) + (hl : ∀ i, Γ.toGraph.IsLink (f i) (a i) (b i)) + (hsep : ∀ i j, i ≠ j → k + 4 ≤ d (f i) (f j)) + (hloopless : ∀ e v, ¬ L.IsLink e v v) + (hassign : ∀ e u v, L.IsLink e u v → + (κ (e, true) = u ∧ κ (e, false) = v) ∨ + (κ (e, true) = v ∧ κ (e, false) = u)) + (htwo : ∀ v ∈ L.vertexSet, ∃ i j, i ≠ j ∧ + ∃ c d : Bool, κ (i, c) = v ∧ κ (j, d) = v) + (hpθ : p ≤ θ) (hpk : 2 * p ≤ k) + (H : Fin p → Drawing S) + (hHs : ∀ v, (H v).IsSubdrawing Γ) (hconn : ∀ v, IsConnectedDrawing (H v)) + (hdisj : ∀ u v, u ≠ v → Disjoint (H u).V (H v).V) + (hclass : ∀ v, (H v).V ∩ range (fun q : Fin t × Bool => if q.2 then a q.1 else b q.1) = + edgeEndClass (fun q : Fin t × Bool => if q.2 then a q.1 else b q.1) κ v) : + ControlsMinor Γ.toHypergraph θ T L := by + let ends : Fin t × Bool → S := fun q => if q.2 then a q.1 else b q.1 + have hmem : ∀ q, ends q ∈ (H (κ q)).V := by + intro q + have hx : ends q ∈ edgeEndClass ends κ (κ q) := ⟨q, rfl, rfl⟩ + rw [← hclass (κ q)] at hx + exact hx.1 + have hmem' : ∀ q v, κ q = v → ends q ∈ (H v).V := by + intro q v h + exact h ▸ hmem q + have hcl : ∀ q, ends q ∈ closure (f q.1) := by + intro ⟨i, c⟩ + have ha : a i ∈ closure (f i) ∩ Γ.V := by rw [(hl i).2.2.2]; simp + have hb : b i ∈ closure (f i) ∩ Γ.V := by rw [(hl i).2.2.2]; simp + cases c + · exact hb.1 + · exact ha.1 + have h91 := GM11.gm15_theorem_9_1 Γ θ T d hS inferInstance hm + have hfA : ∀ i, f i ∈ Γ.A := fun i => Or.inl (Or.inr (hl i).edge_mem) + have hinj : ∀ e ∈ L.edgeSet, ∀ g ∈ L.edgeSet, e ≠ g → f e ≠ f g := by + intro e _ g _ hne heq + have hdist := hsep e g hne + rw [heq, h91.2.1 (f g) (hfA g)] at hdist + omega + have hcard : L.vertexSet.ncard ≤ p := by + exact (Set.ncard_le_card L.vertexSet).trans_eq (Nat.card_fin p) + refine controlsMinor_of_connecting_drawings hS hm H f (fun v _ => hHs v) + (fun v _ => hconn v) (fun u _ v _ hne => hdisj u v hne) ?_ hloopless hinj + (hcard.trans hpθ) ((Nat.mul_le_mul_left 2 hcard).trans hpk) ?_ + · intro e u v he + rcases hassign e u v he with ⟨hu, hv⟩ | ⟨hv, hu⟩ + · exact ⟨a e, hmem' (e, true) u hu, b e, hmem' (e, false) v hv, hl e⟩ + · exact ⟨b e, hmem' (e, false) u hu, a e, hmem' (e, true) v hv, (hl e).symm⟩ + · intro v hv + obtain ⟨i, j, hij, c, d, hic, hjd⟩ := htwo v hv + exact ⟨f i, f j, ends (i, c), ends (j, d), (hl i).edge_mem, (hl j).edge_mem, + hmem' (i, c) v hic, hmem' (j, d) v hjd, hcl (i, c), hcl (j, d), hsep i j hij⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PathCircuitSeparation.lean b/LeanPool/GraphMinor/GM12/Section4PathCircuitSeparation.lean new file mode 100644 index 0000000000..2202036dd0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PathCircuitSeparation.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM12.Section4CircuitMeet + +/-! +# A short radial circuit misses one of two disjoint path portions + +In claim (1) of XII (4.3), pages 249--250, the two portions of the +path have disjoint vertex sets. A radial circuit with at most one +original vertex can meet at most one of these portions. The radial +intersection condition ensures that every meeting point is an original +vertex, so counting vertices suffices to separate the point sets. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The path separation step of XII (4.3), claim (1), pages 249--250. -/ +theorem path_portion_disjoint_short_radial_circuit + {S : Type*} [TopologicalSpace S] [T2Space S] {Γ K C : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hC : C.IsSubdrawing K) (hcard : (C.V ∩ Γ.V).ncard ≤ 1) + {a b c d : S} (P : GraphWalk Γ.toGraph a b) (Q : GraphWalk Γ.toGraph c d) + (hPQ : Disjoint {z | z ∈ P.support} {z | z ∈ Q.support}) : + Disjoint (walkDrawing Γ P).U C.U ∨ Disjoint (walkDrawing Γ Q).U C.U := by + have meeting_vertex {x y : S} (W : GraphWalk Γ.toGraph x y) {z : S} + (hzW : z ∈ (walkDrawing Γ W).U) (hzC : z ∈ C.U) : + z ∈ W.support ∧ z ∈ C.V ∩ Γ.V := by + have hzΓ : z ∈ Γ.U := (walkDrawing_isSubdrawing Γ W).U_subset hzW + have hzK : z ∈ K.U := hC.U_subset hzC + have hzV : z ∈ Γ.V := by + have hi : z ∈ Γ.U ∩ K.U := ⟨hzΓ, hzK⟩ + change z ∈ (PaintingOrDrawing.drawing Γ).U ∩ K.U at hi + rw [hK.2.1.1] at hi + exact hi + have hzKV : z ∈ K.V := hK.2.1.2.1 hzV + have hzWV := subdrawing_vertex_of_mem_U (walkDrawing_isSubdrawing Γ W) hzW hzV + rw [walkDrawing_V] at hzWV + exact ⟨hzWV, subdrawing_vertex_of_mem_U hC hzC hzKV, hzV⟩ + by_cases hP : Disjoint (walkDrawing Γ P).U C.U + · exact Or.inl hP + right + apply Set.disjoint_left.mpr + intro y hyQ hyC + have hy := meeting_vertex Q hyQ hyC + apply hP + apply Set.disjoint_left.mpr + intro x hxP hxC + have hx := meeting_vertex P hxP hxC + have hfin : (C.V ∩ Γ.V).Finite := C.finite_V.subset inter_subset_left + have hxy : x = y := (Set.ncard_le_one hfin).mp hcard x hx.2 y hy.2 + exact Set.disjoint_left.mp hPQ hx.1 (hxy.symm ▸ hy.1) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PathEdgeSplit.lean b/LeanPool/GraphMinor/GM12/Section4PathEdgeSplit.lean new file mode 100644 index 0000000000..2059c574ed --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PathEdgeSplit.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM11.Walks + +/-! +# The two path portions on either side of an edge + +Claim (1) in XII (4.3), pages 249--250, removes one edge of a +path and uses the two remaining portions. Split the path walk at +that edge. Since the original vertex list has no repetitions, the +supports of the two portions are disjoint. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Graph + +/-- Removing an edge of a simple path separates its vertex list +into disjoint portions, as used in XII (4.3), claim (1). -/ +theorem exists_path_edge_split + {α β : Type*} {G : Graph α β} {x y : α} (W : GraphWalk G x y) + (hW : W.IsSimple) {f : β} (hf : f ∈ W.edges) : + ∃ (a b : α) (P : GraphWalk G x a) (Q : GraphWalk G b y) (hl : G.IsLink f a b), + W = P.append (.cons hl Q) ∧ + Disjoint {z | z ∈ P.support} {z | z ∈ Q.support} := by + induction W with + | nil hx => exact False.elim (List.not_mem_nil hf) + | @cons x z y e he R ih => + have hsimple : (x :: R.support).Nodup := hW + have hxR : x ∉ R.support := (List.nodup_cons.mp hsimple).1 + have hR : R.IsSimple := (List.nodup_cons.mp hsimple).2 + by_cases hef : e = f + · subst f + refine ⟨x, z, .nil he.left_mem, R, he, rfl, ?_⟩ + apply Set.disjoint_left.mpr + intro v hvP hvQ + have hvx : v = x := List.mem_singleton.mp hvP + exact hxR (hvx ▸ hvQ) + · have hfR : f ∈ R.edges := (List.mem_cons.mp hf).resolve_left (Ne.symm hef) + obtain ⟨a, b, P, Q, hl, hsplit, hdis⟩ := ih hR hfR + refine ⟨a, b, .cons he P, Q, hl, ?_, ?_⟩ + · rw [hsplit] + rfl + · apply Set.disjoint_left.mpr + intro v hvP hvQ + rcases List.mem_cons.mp hvP with rfl | hvP + · apply hxR + rw [hsplit, GraphWalk.mem_support_append] + exact Or.inr (List.mem_cons_of_mem _ hvQ) + · exact Set.disjoint_left.mp hdis hvP hvQ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PathExists.lean b/LeanPool/GraphMinor/GM12/Section4PathExists.lean new file mode 100644 index 0000000000..148789234a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PathExists.lean @@ -0,0 +1,50 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM11.PaintingRegions +import LeanPool.GraphMinor.GM11.DrawingConnectivity + +/-! +# Paths in a drawing whose regions are discs + +The path chosen in XII (4.3), page 249, exists because the surface is connected and all +regions are open discs. The closed-split criterion gives preconnectedness of the drawing. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The walk-existence step in XII (4.3), page 249. -/ +theorem exists_walk_of_open_disc_regions + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {D : Drawing S} (hD : ∀ r ∈ D.R, IsOpenDisc r) + {a b : S} (ha : a ∈ D.V) (hb : b ∈ D.V) : Nonempty (GraphWalk D.toGraph a b) := by + classical + apply drawing_walk_of_isPreconnected_U (a := a) (b := b) ?_ ha hb + apply isPreconnected_closed_iff.mpr + intro C₁ C₂ hc₁ hc₂ hcover hne₁ hne₂ + by_contra hn + have hdis : Disjoint (D.U ∩ C₁) (D.U ∩ C₂) := by + apply disjoint_left.mpr + intro x hx hy + exact hn ⟨x, hx.1, hx.2, hy.2⟩ + have heq : (D.U ∩ C₁) ∪ (D.U ∩ C₂) = D.U := by + apply subset_antisymm (union_subset inter_subset_left inter_subset_left) + intro x hx + exact (hcover hx).elim (fun h => Or.inl ⟨hx, h⟩) (fun h => Or.inr ⟨hx, h⟩) + have hempty := eq_empty_of_split hS hD (D.isClosed_U.inter hc₁) + (D.isClosed_U.inter hc₂) hdis heq hne₁ + exact hne₂.ne_empty hempty + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PathFacts.lean b/LeanPool/GraphMinor/GM12/Section4PathFacts.lean new file mode 100644 index 0000000000..7b3e68f1d0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PathFacts.lean @@ -0,0 +1,101 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM11.Section4 + +/-! +# Path facts for the circuit cover + +In XII (4.1), page 248, circuits enclosing the edges of a nontrivial +path cover its whole point set. Their insides are closed, so they contain +the edge closures. Every vertex of a nontrivial path is an end of an edge. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 Hypergraph + +universe u +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +omit [T1Space S] in +/-- Subdrawings induce subhypergraphs, with unchanged ends on their edges. -/ +theorem subdrawing_toHypergraph_le {P K : Drawing S} (hs : P.IsSubdrawing K) : + P.toHypergraph ≤ K.toHypergraph := by + refine ⟨hs.1, hs.2, ?_⟩ + intro e he + ext x + change (e ∈ K.E ∧ x ∈ K.V ∧ x ∈ closure e) ↔ + (e ∈ P.E ∧ x ∈ P.V ∧ x ∈ closure e) + constructor + · rintro ⟨_, hx, hxe⟩ + have hm : x ∈ closure e ∩ P.V := by + rw [hs.closure_inter_V he] + exact ⟨hxe, hx⟩ + exact ⟨he, hm.2, hxe⟩ + · rintro ⟨_, hx, hxe⟩ + exact ⟨hs.2 he, hs.1 hx, hxe⟩ + +omit [T1Space S] in +private theorem link_left_closure {P : Drawing S} {e : Set S} {a b : S} + (h : P.toGraph.IsLink e a b) : a ∈ closure e := by + have hm : a ∈ closure e ∩ P.V := by rw [h.2.2.2]; simp + exact hm.1 + +omit [T1Space S] in +/-- Every vertex of a walk with at least one edge lies in an edge closure. -/ +theorem walk_vertex_in_edge_closure {P : Drawing S} {u v : S} + (W : GraphWalk P.toGraph u v) (hpos : 0 < W.length) + {x : S} (hx : x ∈ W.support) : ∃ e ∈ W.edges, x ∈ closure e := by + induction W with + | nil h => exact (Nat.lt_irrefl 0 hpos).elim + | @cons a b c e h r ih => + rcases List.mem_cons.mp hx with rfl | hx + · exact ⟨e, List.mem_cons_self, link_left_closure h⟩ + · by_cases hr : 0 < r.length + · obtain ⟨f, hf, hxf⟩ := ih hr hx + exact ⟨f, List.mem_cons_of_mem _ hf, hxf⟩ + · have hr0 : r.length = 0 := Nat.eq_zero_of_not_pos hr + obtain ⟨hs, _⟩ := support_of_length_zero hr0 + have hxb : x = b := List.mem_singleton.mp (hs ▸ hx) + subst x + exact ⟨e, List.mem_cons_self, link_left_closure h.symm⟩ + +omit [T1Space S] in +/-- Closed sets enclosing all edges of a nontrivial path cover the path, +including its vertices. This is the cover assertion in XII (4.1), page 248. -/ +theorem path_subset_edge_cover {P : Drawing S} {u v : S} + (hP : P.IsPathBetween u v) (hne : u ≠ v) + (D : P.E → Set S) (hclosed : ∀ e, IsClosed (D e)) + (hcover : ∀ e : P.E, (e : Set S) ⊆ D e) : P.U ⊆ ⋃ e, D e := by + obtain ⟨W, _, hV, hE⟩ := hP + have hpos : 0 < W.length := by + cases W with + | nil h => exact (hne rfl).elim + | cons _ _ => exact Nat.zero_lt_succ _ + have hclosure : ∀ e : P.E, closure (e : Set S) ⊆ D e := fun e => + (hclosed e).closure_subset_iff.mpr (hcover e) + intro x hx + rw [P.U_eq] at hx + rcases hx with hx | hx + · have hxW : x ∈ W.support := by + change x ∈ {x | x ∈ W.support} + rw [← hV] + exact hx + obtain ⟨e, he, hxe⟩ := walk_vertex_in_edge_closure W hpos hxW + have heP : e ∈ P.E := hE ▸ he + exact mem_iUnion.mpr ⟨⟨e, heP⟩, hclosure ⟨e, heP⟩ hxe⟩ + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact mem_iUnion.mpr ⟨⟨e, he⟩, hclosure ⟨e, he⟩ hxe⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PathInside.lean b/LeanPool/GraphMinor/GM12/Section4PathInside.lean new file mode 100644 index 0000000000..d4b366f404 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PathInside.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.NiceStatements +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM12.Section1 + +/-! +# A path portion forces its incident edge into a circuit inside + +In XII (4.3), claim (1), page 250, a path portion misses the radial +circuit and has one end in its inside. Its whole point set is then in +the interior of that inside. An original edge incident with its other +end also lies inside: it misses the radial circuit and meets the +interior near the common end. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The connected-set containment step of XII (4.3), claim (1), page 250. -/ +theorem incident_edge_subset_of_path_inside + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + {Γ K C : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hC : C.IsSubdrawing K) {D : Set S} (hD : IsClosed D) + (hbd : frontier D = C.U) {a b : S} (P : GraphWalk Γ.toGraph a b) + (hdis : Disjoint (walkDrawing Γ P).U C.U) + (hb : b ∈ D) {e : Set S} (he : e ∈ Γ.E) (ha : a ∈ closure e) : e ⊆ D := by + have hpre : IsPreconnected (walkDrawing Γ P).U := by + have heq : (walkDrawing Γ P).U = + {x | x ∈ P.support ∨ ∃ e ∈ P.edges, x ∈ closure e} := by + ext x + exact mem_walkDrawing_U Γ P + rw [heq] + exact (isPathConnected_walk_U P).isConnected.isPreconnected + have haP : a ∈ (walkDrawing Γ P).U := + (mem_walkDrawing_U Γ P).mpr (Or.inl P.start_mem_support) + have hbP : b ∈ (walkDrawing Γ P).U := + (mem_walkDrawing_U Γ P).mpr (Or.inl P.end_mem_support) + have hdis' : Disjoint (walkDrawing Γ P).U (frontier D) := hbd ▸ hdis + have hsub : (walkDrawing Γ P).U ⊆ D := + subset_of_disjoint_frontier hpre hD hdis' hbP hb + have hai : a ∈ interior D := by + rw [← self_sdiff_frontier] + exact ⟨hsub haP, fun h => Set.disjoint_left.mp hdis' haP h⟩ + have hedis : Disjoint e (frontier D) := by + rw [hbd] + apply Set.disjoint_left.mpr + intro x hxe hxC + have hxΓ : x ∈ Γ.U := (PaintingOrDrawing.edge_props (Γ := .drawing Γ) he).2.2.1 hxe + have hxK : x ∈ K.U := hC.U_subset hxC + have hxV : x ∈ Γ.V := by + have hx : x ∈ (PaintingOrDrawing.drawing Γ).U ∩ K.U := ⟨hxΓ, hxK⟩ + rw [hK.2.1.1] at hx + exact hx + exact Set.disjoint_left.mp (PaintingOrDrawing.edge_props (Γ := .drawing Γ) he).2.1 hxe hxV + obtain ⟨x, hxi, hxe⟩ := mem_closure_iff.mp ha (interior D) isOpen_interior hai + exact subset_of_disjoint_frontier (PaintingOrDrawing.edge_props (Γ := .drawing Γ) he).1 hD hedis + hxe + (interior_subset hxi) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PathThreshold.lean b/LeanPool/GraphMinor/GM12/Section4PathThreshold.lean new file mode 100644 index 0000000000..1348664c03 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PathThreshold.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM12.Section4IncidentEdges +import LeanPool.GraphMinor.GM12.Section4FirstThreshold +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM11.Walks +import Mathlib.Data.List.Chain + +/-! +# First threshold edges on the chosen path + +XII (4.3), page 250, first observes that the last edge of the +path is close to the second chosen edge. Thus the path reaches +all thresholds up to the distance of the chosen edges minus four. +The first-threshold argument then gives claim (2), including the +upper bound by the threshold plus three. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM14 + +/-- XII (4.3), claim (2), page 250, with its threshold-existence +argument. The returned prefix contains only edges below the threshold. -/ +theorem exists_first_path_threshold_edge + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + {x y : S} (W : GraphWalk Γ.toGraph x y) + {g h : Set S} (hg : g ∈ Γ.E) (hh : h ∈ Γ.E) + (hx : x ∈ closure g) (hy : y ∈ closure h) + {i : ℕ} (hi : 1 ≤ i) (hfar : i + 4 ≤ d g h) : + ∃ (p : List (Set S)) (f : Set S) (q : List (Set S)), + W.edges = p ++ f :: q ∧ (∀ e ∈ p, d g e < i) ∧ + i ≤ d g f ∧ d g f ≤ i + 3 := by + have h91 := GM11.gm15_theorem_9_1 Γ θ T d hS inferInstance hm + have htri := h91.2.2.2.2.1 + have hgA : g ∈ Γ.A := Or.inl (Or.inr hg) + have hhA : h ∈ Γ.A := Or.inl (Or.inr hh) + have hmem : ∀ e ∈ W.edges, e ∈ Γ.E := by + intro e he + exact (walkDrawing_isSubdrawing Γ W).2 ((walkDrawing_E Γ W).symm ▸ he) + have hchain := walk_edges_distance_chain hS hm W hg hx + have hhead : ∀ e, W.edges.head? = some e → d g e ≤ 4 := by + intro e he + exact hchain.rel_head? (by rw [he]; rfl) + have hstep : ∀ (p : List (Set S)) a b (q : List (Set S)), + W.edges = p ++ a :: b :: q → d g b ≤ d g a + 4 := by + intro p a b q heq + have ha : a ∈ Γ.E := hmem a (heq ▸ List.mem_append_right p List.mem_cons_self) + have hb : b ∈ Γ.E := hmem b (heq ▸ List.mem_append_right p + (List.mem_cons_of_mem a List.mem_cons_self)) + have hab : d a b ≤ 4 := + List.isChain_iff_forall_rel_of_append_cons_cons.mp hchain.tail heq + exact (htri g hgA a (Or.inl (Or.inr ha)) b (Or.inl (Or.inr hb))).trans + (Nat.add_le_add_left hab _) + have hne : W.edges ≠ [] := by + intro heq + have hxy : x = y := by + cases W with + | nil hv => rfl + | cons hl R => simp only [GraphWalk.edges_cons, List.cons_ne_nil] at heq + have hclose := incident_edges_distance_le_four hS hm hg hh (W.mem_vertexSet_of_mem_support + W.start_mem_support) hx (hxy ▸ hy) + omega + obtain ⟨e, he, hye⟩ := exists_walk_edge_at_end W hne + have heE := hmem e he + have heh := incident_edges_distance_le_four hS hm heE hh (W.mem_vertexSet_of_mem_support + W.end_mem_support) hye hy + have hlast := htri g hgA e (Or.inl (Or.inr heE)) h hhA + have hex : ∃ e ∈ W.edges, i ≤ d g e := ⟨e, he, by omega⟩ + exact exists_first_threshold_edge_of_head_le_four (d g) hi W.edges hhead hstep hex + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PathTruncation.lean b/LeanPool/GraphMinor/GM12/Section4PathTruncation.lean new file mode 100644 index 0000000000..9ad6fbacbc --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PathTruncation.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Removing the last vertex of a path + +XII (4.4), page 252, deletes the last vertex of each external path +and retains its incident edge as a joining edge. Reverse a simple +walk tracing the path. Its first edge is the retained joining edge, +and the remaining walk traces the shortened path. Simplicity +excludes the removed vertex and joining edge from that remainder. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph Surface GM09 + +/-- The path truncation used in XII (4.4), page 252. The shortened +path has exactly the old vertices except the terminal vertex, and +exactly the old edges except its incident terminal edge. -/ +theorem exists_path_without_last_vertex + {α β : Type*} {G P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) (hab : a ≠ b) : + ∃ (Q : Graph α β) (e : β) (x : α), + IsGraphPathWithEnds G Q a x ∧ Q ≤ P ∧ + Q.vertexSet = P.vertexSet \ {b} ∧ Q.edgeSet = P.edgeSet \ {e} ∧ + G.IsLink e x b ∧ e ∈ P.edgeSet ∧ b ∉ Q.vertexSet := by + obtain ⟨hPG, W, hW, hV, hE⟩ := hP + have hVr : P.vertexSet = {z | z ∈ W.reverse.support} := by + rw [hV] + ext z + simp only [mem_ofPred_eq, GraphWalk.support_reverse, List.mem_reverse] + have hEr : P.edgeSet = {e | e ∈ W.reverse.edges} := by + rw [hE] + ext e + simp only [mem_ofPred_eq, GraphWalk.edges_reverse, List.mem_reverse] + have hWr := hW.reverse + cases hrev : W.reverse with + | nil hb => exact False.elim (hab rfl) + | @cons b x a e hl R => + rw [hrev] at hVr hEr hWr + have hR : R.IsSimple := hWr.of_cons + have hbR : b ∉ R.support := (List.nodup_cons.mp hWr).1 + have heR : e ∉ R.edges := fun he => hbR (walk_isLink_mem_support R he hl).1 + let Q := walkSubgraph R + have hQ : IsGraphPathWithEnds P Q x a := isGraphPathWithEnds_walkSubgraph hR + refine ⟨Q, e, x, hQ.symm.mono hPG, hQ.1, ?_, ?_, hl.symm.mono hPG, hl.edge_mem, ?_⟩ + · rw [hVr, vertexSet_walkSubgraph] + ext z + simp only [GraphWalk.support_cons, mem_ofPred_eq, List.mem_cons, mem_sdiff, + mem_singleton_iff] + constructor + · intro hz + exact ⟨Or.inr hz, fun hzb => hbR (hzb ▸ hz)⟩ + · rintro ⟨hz, hzb⟩ + exact hz.resolve_left hzb + · rw [hEr, edgeSet_walkSubgraph] + ext f + simp only [GraphWalk.edges_cons, mem_ofPred_eq, List.mem_cons, mem_sdiff, + mem_singleton_iff] + constructor + · intro hf + exact ⟨Or.inr hf, fun hfe => heR (hfe ▸ hf)⟩ + · rintro ⟨hf, hfe⟩ + exact hf.resolve_left hfe + · simpa only [Q, vertexSet_walkSubgraph, mem_ofPred_eq] using hbR + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PendantAugment.lean b/LeanPool/GraphMinor/GM12/Section4PendantAugment.lean new file mode 100644 index 0000000000..b1a8b72ada --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PendantAugment.lean @@ -0,0 +1,84 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM12.Section4PendantLine +import LeanPool.GraphMinor.GM11.PaintingCells +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Adding a pendant edge at an isolated vertex + +The target replacement in XII (4.3), page 249, also has to +handle isolated vertices. A short line in an isolated vertex's +chart adds a new neighbour and meets the drawing only at the +original vertex. Glue its one-edge drawing to the target. Both +ends then have an incident edge. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The isolated-vertex step of the target replacement in XII +(4.3), page 249. The old drawing is retained as a subdrawing. -/ +theorem exists_pendant_augmentation + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (Γ : Drawing S) {v : S} (hv : v ∈ Γ.V) + (hiso : ∀ e, ¬ Γ.toGraph.Inc e v) : + ∃ (H : Drawing S) (w : S) (e : Set S), Γ.IsSubdrawing H ∧ + H.V = insert w Γ.V ∧ w ∉ Γ.U ∧ H.toGraph.IsLink e v w := by + have hoff : ∀ e ∈ Γ.E, v ∉ closure e := by + intro e he hve + obtain ⟨x, y, hl⟩ := Γ.toGraph.exists_isLink_of_mem_edgeSet he + have hvpair : v ∈ ({x, y} : Set S) := hl.2.2.2 ▸ ⟨hve, hv⟩ + rcases hvpair with hvx | hvy + · exact hiso e (hvx ▸ hl.inc_left) + · exact hiso e ((Set.mem_singleton_iff.mp hvy) ▸ hl.inc_right) + obtain ⟨w, L, hL, hw, hLU⟩ := exists_line_at_isolated_point hS (Γ.V_subset_U hv) + (isClosed_U_sdiff_of_isolated_vertex hoff) + have hvw : v ≠ w := fun heq => hw (heq ▸ Γ.V_subset_U hv) + let K := lineDrawing hL hvw + have hKU : K.U = L := rfl + have hKV : K.V = {v, w} := rfl + have hKE : K.E = {L \ {v, w}} := lineDrawing_E _ _ + have hglue : Γ.U ∩ K.U ⊆ Γ.V ∩ K.V := by + rintro x ⟨hxΓ, hxK⟩ + have hxv : x = v := Set.mem_singleton_iff.mp (hLU.subset ⟨hxK, hxΓ⟩) + exact hxv ▸ ⟨hv, Or.inl rfl⟩ + let H := Γ.glue K hglue + have hHE : H.E = Γ.E ∪ K.E := Drawing.glue_E hglue + have hΓH : Γ.IsSubdrawing H := ⟨subset_union_left, by rw [hHE]; exact subset_union_left⟩ + have hKH : K.IsSubdrawing H := ⟨subset_union_right, by rw [hHE]; exact subset_union_right⟩ + have hHV : H.V = insert w Γ.V := by + change Γ.V ∪ {v, w} = insert w Γ.V + ext x + simp only [mem_union, mem_insert_iff, mem_singleton_iff] + constructor + · rintro (hx | hx | hx) + · exact Or.inr hx + · exact Or.inr (hx ▸ hv) + · exact Or.inl hx + · rintro (hx | hx) + · exact Or.inr (Or.inr hx) + · exact Or.inl hx + have hlink : K.toGraph.IsLink (L \ {v, w}) v w := by + refine ⟨?_, Or.inl rfl, Or.inr rfl, ?_⟩ + · rw [hKE] + exact mem_singleton _ + · rw [closure_sdiff_pair hL] + apply inter_eq_right.mpr + exact K.V_subset_U + exact ⟨H, w, L \ {v, w}, hΓH, hHV, hw, (hKH.isLink_iff hlink.edge_mem).mp hlink⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PendantLine.lean b/LeanPool/GraphMinor/GM12/Section4PendantLine.lean new file mode 100644 index 0000000000..a2ec10555e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PendantLine.lean @@ -0,0 +1,102 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.Surface.DiscMerge +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.GM11.Walks + +/-! +# A pendant line at an isolated target vertex + +At the start of XII (4.3), page 249, an isolated target vertex +can first be given a pendant edge. Around an isolated point of a +closed set there is a chart avoiding all its other points. Draw a +short radial segment from the point in that chart. Its other end +is new, and its interior misses the closed set. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface Metric Complex + +/-- A short line from an isolated point of a set meets that set +only at its initial end, as used in XII (4.3)'s target replacement. -/ +theorem exists_line_at_isolated_point + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {B : Set S} {v : S} (hv : v ∈ B) + (hclosed : IsClosed (B \ {v})) : + ∃ (w : S) (L : Set S), IsLineWithEnds L v w ∧ w ∉ B ∧ L ∩ B = {v} := by + have hvO : v ∈ (B \ {v})ᶜ := by simp + obtain ⟨U, h, g, c, hUO, hg0⟩ := (hS.2.2 v).exists_ballChart hclosed.isOpen_compl hvO + (R := 1) (by norm_num) + let z : unitInterval → ℂ := fun t => ((t.val / 2 : ℝ) : ℂ) + have hzc : Continuous z := continuous_ofReal.comp (continuous_subtype_val.div_const 2) + have hz : ∀ t, z t ∈ ball (0 : ℂ) 1 := by + intro t + rw [mem_ball_zero_iff] + change ‖((t.val / 2 : ℝ) : ℂ)‖ < 1 + rw [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (div_nonneg t.property.1 (by norm_num))] + linarith [t.property.2] + let a : unitInterval → S := fun t => g (z t) + have hac : Continuous a := c.gc.comp_continuous hzc hz + have hai : Function.Injective a := by + intro s t heq + have heq' := congrArg h heq + change h (g (z s)) = h (g (z t)) at heq' + rw [c.hg (hz s), c.hg (hz t)] at heq' + have hr := congrArg Complex.re heq' + change s.val / 2 = t.val / 2 at hr + apply Subtype.ext + linarith + have ha0 : a 0 = v := by simpa only [a, z, Icc.coe_zero, zero_div, ofReal_zero] using hg0 + have haO : ∀ t, a t ∈ (B \ {v})ᶜ := fun t => hUO (c.gm (hz t)) + have hmeet : range a ∩ B = {v} := by + apply Set.Subset.antisymm + · rintro x ⟨⟨t, rfl⟩, hxB⟩ + by_contra hxv + exact haO t ⟨hxB, hxv⟩ + · intro x hx + have hxv := Set.mem_singleton_iff.mp hx + exact hxv ▸ ⟨⟨0, ha0⟩, hv⟩ + have ha1B : a 1 ∉ B := by + intro hB + have heq : a 1 = a 0 := (Set.mem_singleton_iff.mp (hmeet.subset ⟨mem_range_self 1, hB⟩)).trans + ha0.symm + exact (show (1 : unitInterval) ≠ 0 by norm_num) (hai heq) + refine ⟨a 1, range a, ?_, ha1B, hmeet⟩ + simpa only [ha0] using (IsArcMap.isLineWithEnds ⟨hac, hai⟩) + +/-- Removing an isolated drawing vertex leaves a closed point set. -/ +theorem isClosed_U_sdiff_of_isolated_vertex + {S : Type*} [TopologicalSpace S] [T2Space S] {Γ : Drawing S} {v : S} + (hoff : ∀ e ∈ Γ.E, v ∉ closure e) : IsClosed (Γ.U \ {v}) := by + have heq : Γ.U \ {v} = (Γ.V \ {v}) ∪ ⋃ e ∈ Γ.E, closure e := by + ext x + constructor + · rintro ⟨hxU, hxv⟩ + rw [Γ.U_eq] at hxU + rcases hxU with hxV | hxE + · exact Or.inl ⟨hxV, hxv⟩ + · exact Or.inr hxE + · rintro (hx | hx) + · exact ⟨Γ.V_subset_U hx.1, hx.2⟩ + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + refine ⟨Γ.closure_subset_U he hxe, ?_⟩ + intro hxv + have hxv' := Set.mem_singleton_iff.mp hxv + exact hoff e he (hxv' ▸ hxe) + rw [heq] + exact (Γ.finite_V.subset sdiff_subset).isClosed.union + (Γ.finite_edges.isClosed_biUnion fun _ _ => isClosed_closure) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PieceNeighborhood.lean b/LeanPool/GraphMinor/GM12/Section4PieceNeighborhood.lean new file mode 100644 index 0000000000..6258d97c68 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PieceNeighborhood.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SubdivisionArcIncidence +import LeanPool.GraphMinor.Surface.SurfaceGraph +import Mathlib.Topology.Basic + +/-! +# A neighborhood where a new edge is its old edge + +For the crossing discs in XII (4.5), page 253, the subdivided +edge near a meeting must agree with the original straight chord. +The other pieces form a finite closed set avoiding the meeting. +Its complement is an open neighborhood where the old edge and +the selected new piece agree. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +universe u v + +/-- A finite closed family agrees locally with one selected piece +at any point outside all the other pieces. -/ +theorem exists_open_unique_piece_agreement {S : Type u} [TopologicalSpace S] + {ι : Type v} [Finite ι] (P : ι → Set S) (hclosed : ∀ i, IsClosed (P i)) + (i : ι) (x : S) (hunique : ∀ j, j ≠ i → x ∉ P j) : + ∃ U : Set S, IsOpen U ∧ x ∈ U ∧ (⋃ j, P j) ∩ U = P i ∩ U := by + classical + let Z : Set S := ⋃ j, if j = i then ∅ else P j + have hZ : IsClosed Z := by + refine isClosed_iUnion_of_finite fun j => ?_ + split_ifs <;> first | exact isClosed_empty | exact hclosed j + have hxZ : x ∉ Z := by + intro hx + obtain ⟨j, hj⟩ := mem_iUnion.mp hx + by_cases hji : j = i + · have hempty : x ∈ (∅ : Set S) := by simpa only [hji, ↓reduceIte] using hj + exact hempty + · exact hunique j hji (by simpa only [hji, ↓reduceIte] using hj) + refine ⟨Zᶜ, hZ.isOpen_compl, hxZ, ?_⟩ + ext y + constructor + · rintro ⟨hy, hyZ⟩ + obtain ⟨j, hj⟩ := mem_iUnion.mp hy + by_cases hji : j = i + · exact ⟨hji ▸ hj, hyZ⟩ + · exact False.elim (hyZ (mem_iUnion.mpr ⟨j, by simpa only [hji, ↓reduceIte] using hj⟩)) + · rintro ⟨hy, hyZ⟩ + exact ⟨mem_iUnion.mpr ⟨i, hy⟩, hyZ⟩ + +/-- Near its unique meeting, a subdivision piece agrees with the +old edge. This transfers the straight-chord local model to the +new edge for the crossing discs in XII (4.5), page 253. -/ +theorem exists_open_subdivision_piece_agreement {k : ℕ} + (E M : Set ℂ) (w : Fin (k + 1) → ℂ) (P : Fin k → Set ℂ) + (hline : ∀ i, IsLineWithEnds (P i) (w i.castSucc) (w i.succ)) + (hcover : (⋃ i, P i) = E) (havoid : ∀ r, w r ∉ E ∩ M) + (hinter : ∀ i j, i ≠ j → P i ∩ P j ⊆ range w) + {i : Fin k} {x : ℂ} (hx : x ∈ P i ∩ (E ∩ M)) : + ∃ U : Set ℂ, IsOpen U ∧ x ∈ U ∧ E ∩ U = P i ∩ U := by + have hunique : ∀ j, j ≠ i → x ∉ P j := by + intro j hji hxj + obtain ⟨r, hr⟩ := hinter i j (Ne.symm hji) ⟨hx.1, hxj⟩ + apply havoid r + rw [hr] + exact hx.2 + obtain ⟨U, hU, hxU, hmatch⟩ := exists_open_unique_piece_agreement P + (fun i => (hline i).isCompact.isClosed) i x hunique + exact ⟨U, hU, hxU, hcover ▸ hmatch⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PinchedDisc.lean b/LeanPool/GraphMinor/GM12/Section4PinchedDisc.lean new file mode 100644 index 0000000000..5d5dc58d6f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PinchedDisc.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.PlaneDisc +import LeanPool.GraphMinor.Surface.Wedge +import Mathlib.Analysis.Complex.Norm + +/-! +# Thin discs with two fixed ends + +The empty discs chosen in XII (4.3), page 250, can be made +thin around a normal arc while keeping its ends fixed. In plane +coordinates, multiply the vertical coordinate of the unit disc by +a continuous width. The width may vanish at the two extreme +horizontal coordinates. It must be positive between them. This +still gives a disc, since those extreme coordinates each have only +one point in the unit disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Metric Complex + +/-- Shrinking vertical fibres by a width that is nonzero in the +open horizontal interval preserves injectivity on the closed unit disc. -/ +theorem pinched_disc_injOn (ε : ℝ → ℝ) + (hε : ∀ x ∈ Ioo (-1 : ℝ) 1, ε x ≠ 0) : + InjOn (fun z : ℂ => (z.re : ℂ) + (ε z.re * z.im : ℝ) * I) (closedBall 0 1) := by + intro z hz w hw heq + have hr : z.re = w.re := by + have h := congrArg Complex.re heq + simpa only [add_re, ofReal_re, mul_re, ofReal_im, I_re, I_im, + mul_zero, zero_mul, sub_self, add_zero] using h + have hi : ε z.re * z.im = ε w.re * w.im := by + have h := congrArg Complex.im heq + simpa only [add_im, ofReal_im, mul_im, ofReal_re, I_im, I_re, + mul_one, mul_zero, add_zero, zero_add] using h + apply Complex.ext hr + by_cases hmid : z.re ∈ Ioo (-1 : ℝ) 1 + · rw [← hr] at hi + exact mul_left_cancel₀ (hε _ hmid) hi + have hzN : ‖z‖ ≤ 1 := mem_closedBall_zero_iff.mp hz + have hwN : ‖w‖ ≤ 1 := mem_closedBall_zero_iff.mp hw + have hzR := abs_le.mp ((abs_re_le_norm z).trans hzN) + have hext : z.re = -1 ∨ z.re = 1 := by + simp only [mem_Ioo] at hmid + rcases le_or_gt z.re (-1) with h | h + · exact Or.inl (le_antisymm h hzR.1) + · exact Or.inr (le_antisymm hzR.2 (not_lt.mp (fun h' => hmid ⟨h, h'⟩))) + have habs : |z.re| = 1 := by rcases hext with h | h <;> rw [h] <;> norm_num + have hz0 : z.im = 0 := abs_re_eq_norm.mp (le_antisymm (abs_re_le_norm z) + (hzN.trans habs.ge)) + have hw0 : w.im = 0 := abs_re_eq_norm.mp (le_antisymm (abs_re_le_norm w) + (hwN.trans (by rw [← hr, habs]))) + exact hz0.trans hw0.symm + +/-- The thin image remains a closed disc even if its width vanishes +at one or both ends. This is the plane model for the empty discs +in XII (4.3), page 250. -/ +theorem isClosedDisc_pinched_disc (ε : ℝ → ℝ) (hc : Continuous ε) + (hε : ∀ x ∈ Ioo (-1 : ℝ) 1, ε x ≠ 0) : + IsClosedDisc ((fun z : ℂ => (z.re : ℂ) + (ε z.re * z.im : ℝ) * I) '' closedBall 0 1) := by + refine (isClosedDisc_image_injOn isClosedDisc_closedBall.1 (isCompact_closedBall _ _) + ?_ (pinched_disc_injOn ε hε)).1 + exact (Complex.continuous_ofReal.comp Complex.continuous_re).add + (((Complex.continuous_ofReal.comp ((hc.comp Complex.continuous_re).mul + Complex.continuous_im))).mul_const I) |>.continuousOn + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PlaneChart.lean b/LeanPool/GraphMinor/GM12/Section4PlaneChart.lean new file mode 100644 index 0000000000..dba5a8848c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PlaneChart.lean @@ -0,0 +1,43 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.Jordan +import Mathlib.Analysis.Normed.Module.Ball.Homeomorph + +/-! +# Putting the planar source configuration in a surface chart + +The proof of XII (4.5), page 252, first constructs its crossing +drawing in the plane and then in the surface. The plane is +homeomorphic to an open unit disc. Compose this homeomorphism +with the inverse of a chart at any point of the closed surface. +The result is an open embedding, so all arc, disc, intersection, +and local crossing data can be carried into the surface. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Every nonempty closed surface contains an openly embedded +copy of the plane. This carries the source configuration of +XII (4.5), page 252, into the surface before star thickening. -/ +theorem exists_plane_openEmbedding {S : Type*} [TopologicalSpace S] [Nonempty S] + (hS : IsClosedSurface S) : ∃ f : ℂ → S, Topology.IsOpenEmbedding f := by + classical + let y : S := Classical.choice inferInstance + obtain ⟨U, hU, -, ⟨h⟩⟩ := hS.2.2 y + let e : ℂ ≃ₜ U := complexPlane.toHomeomorph.trans (Homeomorph.unitBall.trans h.symm) + exact ⟨(fun z => (e z).val), hU.isOpenEmbedding_subtypeVal.comp e.isOpenEmbedding⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PortDrawing.lean b/LeanPool/GraphMinor/GM12/Section4PortDrawing.lean new file mode 100644 index 0000000000..f83979019c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PortDrawing.lean @@ -0,0 +1,150 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4GeneralPositionPorts +public import LeanPool.GraphMinor.GM12.Section4PortEdgeArc +public import LeanPool.GraphMinor.GM12.Section4PortNeighborhoods +import LeanPool.GraphMinor.GM12.Section4PortIntersections + +/-! +# Simple edge arcs from ordered vertex blocks + +For the source crossing drawing in XII (4.5), page 253, choose +separate neighborhoods at the circle centers of the vertices. +Ordered ports in each block give chords in general position. +Join each chord to the two outer vertices. The resulting edge +arcs are simple, and their portions inside the unit disc are +exactly their chords. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Surface + +/-- Construct the simple edge arcs of the port drawing used in +XII (4.5), page 253. The edge ends are prescribed by `κ`, and `ρ` +orders their vertex blocks around the circle. -/ +theorem exists_port_edge_arcs {m n : ℕ} + (κ : Fin n × Bool → Fin m) (hκ : ∀ i, κ (i, false) ≠ κ (i, true)) + (ρ : (Fin n × Bool) ≃ Fin (2 * n)) + (horder : Monotone (fun i => κ (ρ.symm i))) : + ∃ (v : Fin m → ℂ) (p : Fin n × Bool → ℝ) (E : Fin n → Set ℂ), + Function.Injective v ∧ (∀ i, 1 < ‖v i‖) ∧ + Function.Injective (fun x => (ee (p x) : ℂ)) ∧ + (∀ x, p x ∈ Ioo 0 1) ∧ + (∀ x y, ρ x < ρ y → p x < p y) ∧ + (∀ i, IsLineWithEnds (E i) (v (κ (i, false))) (v (κ (i, true)))) ∧ + (∀ i j, v j ∈ E i ↔ j = κ (i, false) ∨ j = κ (i, true)) ∧ + (∀ i, E i ∩ closedBall 0 1 = segment ℝ (ee (p (i, false)) : ℂ) (ee (p (i, true)) : ℂ)) ∧ + (∀ i j, i ≠ j → + (segment ℝ (ee (p (i, false)) : ℂ) (ee (p (i, true)) : ℂ) ∩ + segment ℝ (ee (p (j, false)) : ℂ) (ee (p (j, true)) : ℂ)).Finite) ∧ + (∀ i j, i ≠ j → (E i ∩ E j).Finite) ∧ + (∀ i j, i ≠ j → E i ∩ E j ⊆ + (segment ℝ (ee (p (i, false)) : ℂ) (ee (p (i, true)) : ℂ) ∩ + segment ℝ (ee (p (j, false)) : ℂ) (ee (p (j, true)) : ℂ)) ∪ range v) ∧ + (∀ i j k, i ≠ j → j ≠ k → i ≠ k → E i ∩ E j ∩ E k ⊆ range v) ∧ + ∀ i j k, i ≠ j → j ≠ k → i ≠ k → ∀ x ∈ closedBall (0 : ℂ) 1, + ¬ (x ∈ E i ∧ x ∈ E j ∧ x ∈ E k) := by + let ξ : Fin m → ℝ := fun i => ((i.val : ℝ) + 1) / ((m : ℝ) + 1) + have hden : 0 < (m : ℝ) + 1 := by positivity + have hξ : StrictMono ξ := by + intro i j hij + change ((i.val : ℝ) + 1) / ((m : ℝ) + 1) < + ((j.val : ℝ) + 1) / ((m : ℝ) + 1) + apply div_lt_div_of_pos_right _ hden + have hval : (i.val : ℝ) < (j.val : ℝ) := by exact_mod_cast hij + linarith + have hξ01 : ∀ i, ξ i ∈ Ioo (0 : ℝ) 1 := by + intro i + constructor + · exact div_pos (by positivity) hden + · apply (div_lt_one hden).mpr + have hi : (i.val : ℝ) < (m : ℝ) := by exact_mod_cast i.isLt + linarith + have hcenters : Function.Injective (fun i => (ee (ξ i) : ℂ)) := by + intro i j hij + apply hξ.injective + exact ee_injOn_short_interval (by norm_num : (1 : ℝ) ≤ 0 + 1) + (hξ01 i) (hξ01 j) (Subtype.ext hij) + obtain ⟨v, U, O, hU, hUdisj⟩ := exists_disjoint_outer_vertex_neighborhoods + (fun i => (ee (ξ i) : ℂ)) (by intro i; simp) hcenters + let c : Fin (2 * n) → ℝ := fun i => ξ (κ (ρ.symm i)) + let Q : Fin (2 * n) → Set ℂ := fun i => O (κ (ρ.symm i)) + obtain ⟨p, hp, hporder, hpinj, hne, hthree⟩ := exists_ordered_general_position_ports + ρ c (hξ.monotone.comp horder) (fun i => hξ01 _) + Q (fun i => (hU _).2.2.2.2.2.1) (fun i => (hU _).2.2.2.2.2.2.1) + have hpO : ∀ x, (ee (p x) : ℂ) ∈ O (κ x) := by + intro x + simpa only [Q, ρ.symm_apply_apply] using (hp x).2 + let a : Fin n → ℂ := fun i => (ee (p (i, false)) : ℂ) + let b : Fin n → ℂ := fun i => (ee (p (i, true)) : ℂ) + have hvisible : ∀ x, 1 < ((starRingEnd ℂ) (ee (p x) : ℂ) * v (κ x)).re ∧ + segment ℝ (ee (p x) : ℂ) (v (κ x)) ⊆ U (κ x) := by + intro x + exact (hU _).2.2.2.2.2.2.2.2 _ (hpO x) + have hab : ∀ i, a i ≠ b i := by + intro i hi + have h := hpinj hi + exact Bool.false_ne_true (congrArg Prod.snd h) + let E : Fin n → Set ℂ := fun i => + (segment ℝ (a i) (v (κ (i, false))) ∪ segment ℝ (a i) (b i)) ∪ + segment ℝ (b i) (v (κ (i, true))) + have hE : ∀ i, IsLineWithEnds (E i) (v (κ (i, false))) (v (κ (i, true))) ∧ + E i ∩ closedBall 0 1 = segment ℝ (a i) (b i) := by + intro i + apply port_edge_isLine (by simp [a]) (by simp [b]) (hab i) + (hvisible (i, false)).1 (hvisible (i, true)).1 + exact (hUdisj _ _ (hκ i)).mono (hvisible (i, false)).2 (hvisible (i, true)).2 + have hinside : ∀ i j k, i ≠ j → j ≠ k → i ≠ k → + ∀ x ∈ closedBall (0 : ℂ) 1, ¬ (x ∈ E i ∧ x ∈ E j ∧ x ∈ E k) := by + intro i j k hij hjk hik x hxD hx + have hline : ∀ l, x ∈ E l → x ∈ line[ℝ, a l, b l] := by + intro l hxE + have hseg : x ∈ segment ℝ (a l) (b l) := + (hE l).2 ▸ (show x ∈ E l ∩ closedBall 0 1 from ⟨hxE, hxD⟩) + exact (line[ℝ, a l, b l]).convex.segment_subset + (left_mem_affineSpan_pair _ _ _) (right_mem_affineSpan_pair _ _ _) hseg + exact hthree i j k hij hjk hik x ⟨hline i hx.1, hline j hx.2.1, hline k hx.2.2⟩ + refine ⟨v, p, E, ?_, ?_, hpinj, fun x => (hp x).1, hporder, + fun i => (hE i).1, ?_, fun i => (hE i).2, ?_, ?_, ?_, ?_, hinside⟩ + · intro i j hij + by_contra hneij + exact Set.disjoint_left.mp (hUdisj i j hneij) (hU i).2.2.2.1 + (hij ▸ (hU j).2.2.2.1) + · intro i + exact (hU i).2.2.2.2.1 + · intro i j + exact port_edge_vertex_mem_iff v κ (fun x => (ee (p x) : ℂ)) (by intro x; simp) + (fun j => (hU j).2.2.2.2.1) U (fun j => (hU j).2.2.2.1) hUdisj + (fun x => (hvisible x).2) i j + · intro i j hij + exact finite_chord_inter_of_ne_lines (hne i j hij) + · intro i j hij + exact finite_port_edge_inter v κ (fun x => (ee (p x) : ℂ)) (by intro x; simp) + hpinj (fun x => (hvisible x).1) U hUdisj (fun x => (hvisible x).2) hij (hne i j hij) + · intro i j hij + exact port_edge_inter_subset_chords_union_vertices v κ + (fun x => (ee (p x) : ℂ)) (by intro x; simp) hpinj + (fun x => (hvisible x).1) U hUdisj (fun x => (hvisible x).2) hij + · intro i j k hij hjk hik x hx + have hpair := port_edge_inter_subset_chords_union_vertices v κ + (fun x => (ee (p x) : ℂ)) (by intro x; simp) hpinj + (fun x => (hvisible x).1) U hUdisj (fun x => (hvisible x).2) hij + (show x ∈ E i ∩ E j from hx.1) + rcases hpair with hchord | hxv + · have hxD := (unit_chord_geometry (by simp [a] : ‖a i‖ = 1) (by simp [b] : ‖b i‖ = 1) + (hab i)).2.1 hchord.1 + exact False.elim (hinside i j k hij hjk hik x hxD ⟨hx.1.1, hx.1.2, hx.2⟩) + · exact hxv + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PortEdgeArc.lean b/LeanPool/GraphMinor/GM12/Section4PortEdgeArc.lean new file mode 100644 index 0000000000..ba8fdd0416 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PortEdgeArc.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4OuterPorts +import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.Surface.Lunes + +/-! +# Joining the outer pieces to an inner chord + +An edge of the crossing drawing in XII (4.5), page 253, consists +of two outer vertex pieces and one inner chord. Each outer piece +meets the chord at its own port. When the outer pieces lie in +disjoint vertex neighborhoods, their union with the chord is a +simple arc. Its intersection with the unit disc is exactly the +inner chord. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Surface + +private theorem outer_piece_inter_own_chord {a b v : ℂ} + (ha : ‖a‖ = 1) (hb : ‖b‖ = 1) + (hv : 1 < ((starRingEnd ℂ) a * v).re) : + segment ℝ a v ∩ segment ℝ a b = {a} := by + ext x + constructor + · rintro ⟨hx, hx'⟩ + have hxD : x ∈ closedBall (0 : ℂ) 1 := + (convex_closedBall (0 : ℂ) 1).segment_subset (by simp [ha]) (by simp [hb]) hx' + exact show x ∈ ({a} : Set ℂ) from + outer_port_segment_inter_disc ha hv ▸ And.intro hx hxD + · rintro rfl + exact ⟨left_mem_segment _ _ _, left_mem_segment _ _ _⟩ + +/-- Three pieces form a simple edge arc, and the part of this arc +inside the unit disc is exactly its chord. This proves the absence +of self-crossings in the port construction for XII (4.5), page 253. -/ +theorem port_edge_isLine {a b v w : ℂ} + (ha : ‖a‖ = 1) (hb : ‖b‖ = 1) (hab : a ≠ b) + (hv : 1 < ((starRingEnd ℂ) a * v).re) + (hw : 1 < ((starRingEnd ℂ) b * w).re) + (houter : Disjoint (segment ℝ a v) (segment ℝ b w)) : + IsLineWithEnds ((segment ℝ a v ∪ segment ℝ a b) ∪ segment ℝ b w) v w ∧ + ((segment ℝ a v ∪ segment ℝ a b) ∪ segment ℝ b w) ∩ closedBall 0 1 = + segment ℝ a b := by + have hfirst : IsLineWithEnds (segment ℝ a v ∪ segment ℝ a b) v b := + (outer_port_segment_isLine ha hv).symm.union (isLineWithEnds_segment hab) + (outer_piece_inter_own_chord ha hb hv) + have hlast : segment ℝ a b ∩ segment ℝ b w = {b} := by + rw [inter_comm, segment_symm ℝ a b] + exact outer_piece_inter_own_chord hb ha hw + have hmeet : (segment ℝ a v ∪ segment ℝ a b) ∩ segment ℝ b w = {b} := by + rw [union_inter_distrib_right, houter.inter_eq, empty_union, hlast] + refine ⟨hfirst.union (outer_port_segment_isLine hb hw) hmeet, ?_⟩ + ext x + constructor + · rintro ⟨(hx | hx) | hx, hxD⟩ + · have hxa : x = a := show x ∈ ({a} : Set ℂ) from + outer_port_segment_inter_disc ha hv ▸ And.intro hx hxD + exact hxa ▸ left_mem_segment ℝ a b + · exact hx + · have hxb : x = b := show x ∈ ({b} : Set ℂ) from + outer_port_segment_inter_disc hb hw ▸ And.intro hx hxD + exact hxb ▸ right_mem_segment ℝ a b + · intro hx + exact ⟨Or.inl (Or.inr hx), (convex_closedBall (0 : ℂ) 1).segment_subset + (by simp [ha]) (by simp [hb]) hx⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PortIntersections.lean b/LeanPool/GraphMinor/GM12/Section4PortIntersections.lean new file mode 100644 index 0000000000..e85ec0b81a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PortIntersections.lean @@ -0,0 +1,153 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4OuterPorts +import LeanPool.GraphMinor.Surface.Lunes + +/-! +# Intersections of complete port edge arcs + +In the crossing construction of XII (4.5), page 253, the inner +chords lie in the unit disc and the outer pieces lie in disjoint +vertex neighborhoods. Two outer pieces can meet only at their +common vertex. Hence two complete edge arcs meet only at their +chord intersections or at vertices. This gives finite pairwise +intersections once the chords are chosen in general position. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Surface + +/-- The three straight pieces of an edge in the coordinate port +construction for XII (4.5), page 253: an outer piece, the inner +chord, and the other outer piece. -/ +@[expose] noncomputable def portEdgeArc {m n : ℕ} (v : Fin m → ℂ) + (κ : Fin n × Bool → Fin m) (a : Fin n × Bool → ℂ) (i : Fin n) : Set ℂ := + (segment ℝ (a (i, false)) (v (κ (i, false))) ∪ + segment ℝ (a (i, false)) (a (i, true))) ∪ + segment ℝ (a (i, true)) (v (κ (i, true))) + +/-- Two complete port edge arcs meet only in their inner chords +or at outer vertices. This is the pairwise-intersection assertion +for the source drawing in XII (4.5), page 253. -/ +theorem port_edge_inter_subset_chords_union_vertices {m n : ℕ} + (v : Fin m → ℂ) (κ : Fin n × Bool → Fin m) (a : Fin n × Bool → ℂ) + (ha : ∀ x, ‖a x‖ = 1) (hinj : Function.Injective a) + (hvisible : ∀ x, 1 < ((starRingEnd ℂ) (a x) * v (κ x)).re) + (U : Fin m → Set ℂ) (hU : ∀ i j, i ≠ j → Disjoint (U i) (U j)) + (hsub : ∀ x, segment ℝ (a x) (v (κ x)) ⊆ U (κ x)) + {i j : Fin n} (hij : i ≠ j) : + ((segment ℝ (a (i, false)) (v (κ (i, false))) ∪ + segment ℝ (a (i, false)) (a (i, true))) ∪ + segment ℝ (a (i, true)) (v (κ (i, true)))) ∩ + ((segment ℝ (a (j, false)) (v (κ (j, false))) ∪ + segment ℝ (a (j, false)) (a (j, true))) ∪ + segment ℝ (a (j, true)) (v (κ (j, true)))) ⊆ + (segment ℝ (a (i, false)) (a (i, true)) ∩ + segment ℝ (a (j, false)) (a (j, true))) ∪ range v := by + intro x hx + have hclass : ∀ l, x ∈ + ((segment ℝ (a (l, false)) (v (κ (l, false))) ∪ + segment ℝ (a (l, false)) (a (l, true))) ∪ + segment ℝ (a (l, true)) (v (κ (l, true)))) → + (x ∈ segment ℝ (a (l, false)) (a (l, true))) ∨ + ∃ b : Bool, x ∈ segment ℝ (a (l, b)) (v (κ (l, b))) := by + intro l hl + rcases hl with (hl | hl) | hl + · exact Or.inr ⟨false, hl⟩ + · exact Or.inl hl + · exact Or.inr ⟨true, hl⟩ + have hD : ∀ l, segment ℝ (a (l, false)) (a (l, true)) ⊆ closedBall (0 : ℂ) 1 := + fun l => (convex_closedBall (0 : ℂ) 1).segment_subset (by simp [ha]) (by simp [ha]) + have hport : ∀ l b, x ∈ segment ℝ (a (l, b)) (v (κ (l, b))) → + x ∈ closedBall (0 : ℂ) 1 → x = a (l, b) := by + intro l b hxleg hxD + exact show x ∈ ({a (l, b)} : Set ℂ) from + outer_port_segment_inter_disc (ha _) (hvisible _) ▸ And.intro hxleg hxD + rcases hclass i hx.1 with hxi | ⟨bi, hxi⟩ + · rcases hclass j hx.2 with hxj | ⟨bj, hxj⟩ + · exact Or.inl ⟨hxi, hxj⟩ + · have hxeq := hport j bj hxj (hD i hxi) + have hends : a (j, bj) = a (i, false) ∨ a (j, bj) = a (i, true) := by + have hunit : a (j, bj) ∈ sphere (0 : ℂ) 1 := by simp [ha] + have hgeom := unit_chord_geometry (ha (i, false)) (ha (i, true)) + (fun h => Bool.false_ne_true (congrArg Prod.snd (hinj h))) + exact show a (j, bj) ∈ ({a (i, false), a (i, true)} : Set ℂ) from + hgeom.2.2 ▸ And.intro (hxeq ▸ hxi) hunit + exact False.elim (hends.elim + (fun h => hij (congrArg Prod.fst (hinj h)).symm) + (fun h => hij (congrArg Prod.fst (hinj h)).symm)) + · rcases hclass j hx.2 with hxj | ⟨bj, hxj⟩ + · have hxeq := hport i bi hxi (hD j hxj) + have hgeom := unit_chord_geometry (ha (j, false)) (ha (j, true)) + (fun h => Bool.false_ne_true (congrArg Prod.snd (hinj h))) + have hends : a (i, bi) = a (j, false) ∨ a (i, bi) = a (j, true) := + show a (i, bi) ∈ ({a (j, false), a (j, true)} : Set ℂ) from + hgeom.2.2 ▸ And.intro (hxeq ▸ hxj) (by simp [ha]) + exact False.elim (hends.elim + (fun h => hij (congrArg Prod.fst (hinj h))) + (fun h => hij (congrArg Prod.fst (hinj h)))) + · by_cases howner : κ (i, bi) = κ (j, bj) + · have hstar := outer_port_segments_inter (ha (i, bi)) (ha (j, bj)) + (fun h => hij (congrArg Prod.fst (hinj h))) (hvisible (i, bi)) + (howner ▸ hvisible (j, bj)) + have hmeet : x ∈ segment ℝ (a (i, bi)) (v (κ (i, bi))) ∩ + segment ℝ (a (j, bj)) (v (κ (i, bi))) := + ⟨hxi, howner.symm ▸ hxj⟩ + have hxv : x = v (κ (i, bi)) := show x ∈ ({v (κ (i, bi))} : Set ℂ) from + hstar ▸ hmeet + exact Or.inr ⟨κ (i, bi), hxv.symm⟩ + · exact False.elim (Set.disjoint_left.mp (hU _ _ howner) (hsub _ hxi) (hsub _ hxj)) + +/-- The complete port edge arcs have finite pairwise intersections +when the chord supporting lines are distinct. This proves condition +(ii) of the crossing construction in XII (4.5), page 253. -/ +theorem finite_port_edge_inter {m n : ℕ} + (v : Fin m → ℂ) (κ : Fin n × Bool → Fin m) (a : Fin n × Bool → ℂ) + (ha : ∀ x, ‖a x‖ = 1) (hinj : Function.Injective a) + (hvisible : ∀ x, 1 < ((starRingEnd ℂ) (a x) * v (κ x)).re) + (U : Fin m → Set ℂ) (hU : ∀ i j, i ≠ j → Disjoint (U i) (U j)) + (hsub : ∀ x, segment ℝ (a x) (v (κ x)) ⊆ U (κ x)) + {i j : Fin n} (hij : i ≠ j) + (hne : line[ℝ, a (i, false), a (i, true)] ≠ line[ℝ, a (j, false), a (j, true)]) : + (portEdgeArc v κ a i ∩ portEdgeArc v κ a j).Finite := by + exact ((finite_chord_inter_of_ne_lines hne).union (finite_range v)).subset + (port_edge_inter_subset_chords_union_vertices v κ a ha hinj hvisible U hU hsub hij) + +/-- A complete port edge arc passes through exactly its two +assigned outer vertices. This proves condition (i) for the source +crossing drawing in XII (4.5), page 253. -/ +theorem port_edge_vertex_mem_iff {m n : ℕ} + (v : Fin m → ℂ) (κ : Fin n × Bool → Fin m) (a : Fin n × Bool → ℂ) + (ha : ∀ x, ‖a x‖ = 1) (hvnorm : ∀ j, 1 < ‖v j‖) + (U : Fin m → Set ℂ) (hvU : ∀ j, v j ∈ U j) + (hU : ∀ i j, i ≠ j → Disjoint (U i) (U j)) + (hsub : ∀ x, segment ℝ (a x) (v (κ x)) ⊆ U (κ x)) (i : Fin n) (j : Fin m) : + v j ∈ portEdgeArc v κ a i ↔ j = κ (i, false) ∨ j = κ (i, true) := by + have howner : ∀ x, v j ∈ segment ℝ (a x) (v (κ x)) → j = κ x := by + intro x hx + by_contra hne + exact Set.disjoint_left.mp (hU j (κ x) hne) (hvU j) (hsub x hx) + constructor + · intro hj + rcases hj with (hj | hj) | hj + · exact Or.inl (howner _ hj) + · have hD : v j ∈ closedBall (0 : ℂ) 1 := + (convex_closedBall (0 : ℂ) 1).segment_subset (by simp [ha]) (by simp [ha]) hj + exact False.elim ((not_le_of_gt (hvnorm j)) (mem_closedBall_zero_iff.mp hD)) + · exact Or.inr (howner _ hj) + · rintro (rfl | rfl) + · exact Or.inl (Or.inl (right_mem_segment _ _ _)) + · exact Or.inr (right_mem_segment _ _ _) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PortNeighborhoods.lean b/LeanPool/GraphMinor/GM12/Section4PortNeighborhoods.lean new file mode 100644 index 0000000000..5f1d48e836 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PortNeighborhoods.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Analysis.Complex.Basic +public import Mathlib.Analysis.Convex.Topology +import Mathlib.Analysis.Normed.Module.Convex + +/-! +# Small neighborhoods for outer vertex pieces + +In the crossing construction of XII (4.5), page 253, choose small +disjoint convex neighborhoods around the vertex blocks on the +circle. A short outward radial move gives the vertex. The strict +tangent inequality holds at the center port and hence throughout +a smaller open neighborhood of ports. Convexity keeps every outer +piece in the chosen vertex neighborhood. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Topology + +/-- A unit circle point in an open convex neighborhood has a +nearby outer vertex and an open neighborhood of ports visible +from that vertex. This localizes the vertex stars in the crossing +construction of XII (4.5), page 253. -/ +theorem exists_outer_vertex_port_neighborhood {U : Set ℂ} (hU : IsOpen U) + (hUc : Convex ℝ U) {c : ℂ} (hc : ‖c‖ = 1) (hcU : c ∈ U) : + ∃ v : ℂ, ∃ O : Set ℂ, v ∈ U ∧ 1 < ‖v‖ ∧ IsOpen O ∧ c ∈ O ∧ O ⊆ U ∧ + ∀ a ∈ O, 1 < ((starRingEnd ℂ) a * v).re ∧ segment ℝ a v ⊆ U := by + obtain ⟨r, hr, hrU⟩ := Metric.isOpen_iff.mp hU c hcU + let v : ℂ := (1 + r / 2 : ℝ) • c + have hvdist : dist v c = r / 2 := by + rw [dist_eq_norm] + have heq : v - c = (r / 2 : ℝ) • c := by + change (1 + r / 2 : ℝ) • c - c = (r / 2 : ℝ) • c + rw [add_smul, one_smul, add_sub_cancel_left] + rw [heq, norm_smul, Real.norm_eq_abs, abs_of_pos (by linarith), hc, mul_one] + have hvU : v ∈ U := hrU (mem_ball.mpr (by rw [hvdist]; linarith)) + have hvnorm : 1 < ‖v‖ := by + change 1 < ‖(1 + r / 2 : ℝ) • c‖ + rw [norm_smul, Real.norm_eq_abs, abs_of_pos (by linarith), hc, mul_one] + linarith + have hcv : 1 < ((starRingEnd ℂ) c * v).re := by + have hcc : ((starRingEnd ℂ) c * c).re = 1 := by + rw [RCLike.conj_mul, hc]; norm_num + change 1 < ((starRingEnd ℂ) c * ((1 + r / 2 : ℝ) • c)).re + rw [mul_smul_comm, Complex.smul_re, hcc, smul_eq_mul, mul_one] + linarith + let O : Set ℂ := U ∩ {a : ℂ | 1 < ((starRingEnd ℂ) a * v).re} + have hO : IsOpen O := hU.inter (isOpen_lt continuous_const (by fun_prop)) + exact ⟨v, O, hvU, hvnorm, hO, ⟨hcU, hcv⟩, inter_subset_left, + fun a ha => ⟨ha.2, hUc.segment_subset ha.1 hvU⟩⟩ + +/-- Choose disjoint convex vertex neighborhoods and visible port +neighborhoods for any finite set of distinct unit circle centers. +This is the simultaneous local choice in the crossing construction +of XII (4.5), page 253. -/ +theorem exists_disjoint_outer_vertex_neighborhoods {ι : Type*} [Finite ι] + (c : ι → ℂ) (hc : ∀ i, ‖c i‖ = 1) (hinj : Function.Injective c) : + ∃ (v : ι → ℂ) (U O : ι → Set ℂ), + (∀ i, IsOpen (U i) ∧ Convex ℝ (U i) ∧ c i ∈ U i ∧ v i ∈ U i ∧ + 1 < ‖v i‖ ∧ IsOpen (O i) ∧ c i ∈ O i ∧ O i ⊆ U i ∧ + ∀ a ∈ O i, 1 < ((starRingEnd ℂ) a * v i).re ∧ segment ℝ a (v i) ⊆ U i) ∧ + ∀ i j, i ≠ j → Disjoint (U i) (U j) := by + classical + obtain ⟨W, hW, hWdisj⟩ := (finite_range c).t2_separation + have hball : ∀ i, ∃ r : ℝ, 0 < r ∧ ball (c i) r ⊆ W (c i) := by + intro i + exact Metric.isOpen_iff.mp (hW (c i)).2 (c i) (hW (c i)).1 + choose r hr hrW using hball + have hchoice : ∀ i, ∃ v : ℂ, ∃ O : Set ℂ, + v ∈ ball (c i) (r i) ∧ 1 < ‖v‖ ∧ IsOpen O ∧ c i ∈ O ∧ + O ⊆ ball (c i) (r i) ∧ + ∀ a ∈ O, 1 < ((starRingEnd ℂ) a * v).re ∧ segment ℝ a v ⊆ ball (c i) (r i) := by + intro i + exact exists_outer_vertex_port_neighborhood isOpen_ball (convex_ball _ _) + (hc i) (mem_ball_self (hr i)) + choose v O hv hvnorm hO hcO hOU hseg using hchoice + refine ⟨v, fun i => ball (c i) (r i), O, ?_, ?_⟩ + · intro i + exact ⟨isOpen_ball, convex_ball _ _, mem_ball_self (hr i), hv i, hvnorm i, + hO i, hcO i, hOU i, hseg i⟩ + · intro i j hij + exact (hWdisj (mem_range_self i) (mem_range_self j) (fun h => hij (hinj h))).mono + (hrW i) (hrW j) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4PortOrdering.lean b/LeanPool/GraphMinor/GM12/Section4PortOrdering.lean new file mode 100644 index 0000000000..082b1c9fda --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4PortOrdering.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Order.Fin.Basic +public import Mathlib.Data.Fintype.Prod +import Mathlib.Data.Finset.Sort +import Mathlib.Order.Prod.Lex.Basic +import Mathlib.Data.Set.Finite.Range + +/-! +# Ordering ports by vertex and local priority + +For XII (4.5), page 253, the circle ports are grouped by vertex. +Within each vertex block, place the two Hamilton ports first. +Sorting by vertex, local priority, and a distinct tie-breaking +index gives the required enumeration. The final index only breaks +ties and does not change either prescribed order. +-/ + +public section + +namespace GraphMinor.GM12 + +/-- Enumerate all ports in vertex blocks, respecting any assigned +strict local priorities. This supplies the port order for the +crossing drawing in XII (4.5), page 253. -/ +theorem exists_port_ordering {m n : ℕ} + (κ : Fin n × Bool → Fin m) (priority : Fin n × Bool → ℕ) : + ∃ ρ : (Fin n × Bool) ≃ Fin (2 * n), + Monotone (fun i => κ (ρ.symm i)) ∧ + (∀ x y, κ x < κ y → ρ x < ρ y) ∧ + ∀ x y, κ x = κ y → priority x < priority y → ρ x < ρ y := by + classical + have hcard : Fintype.card (Fin n × Bool) = 2 * n := by simp [Nat.mul_comm] + let ε : (Fin n × Bool) ≃ Fin (2 * n) := Fintype.equivFinOfCardEq hcard + let K := Fin m ×ₗ (ℕ ×ₗ Fin (2 * n)) + let key : Fin n × Bool → K := fun x => toLex (κ x, toLex (priority x, ε x)) + have hkey : Function.Injective key := by + intro x y hxy + apply ε.injective + exact congrArg (fun z : K => (ofLex (ofLex z).2).2) hxy + let τ : (Fin n × Bool) ≃ Set.range key := Equiv.ofInjective key hkey + let : Fintype (Set.range key) := (Set.finite_range key).fintype + have hcardK : Fintype.card (Set.range key) = 2 * n := + (Fintype.card_congr τ).symm.trans hcard + let σ : Fin (2 * n) ≃o Set.range key := Fintype.orderIsoFinOfCardEq _ hcardK + have hτ : ∀ z : Set.range key, key (τ.symm z) = z.val := fun z => + congrArg Subtype.val (τ.apply_symm_apply z) + refine ⟨τ.trans σ.symm.toEquiv, ?_, ?_, ?_⟩ + · intro i j hij + have h : key (τ.symm (σ i)) ≤ key (τ.symm (σ j)) := by + rw [hτ, hτ] + exact σ.monotone hij + exact (Prod.Lex.le_iff'.mp h).1 + · intro x y hxy + apply σ.symm.strictMono + change key x < key y + exact Prod.Lex.lt_iff.mpr (Or.inl hxy) + · intro x y hκ hpriority + apply σ.symm.strictMono + change key x < key y + exact Prod.Lex.lt_iff.mpr (Or.inr ⟨hκ, Prod.Lex.lt_iff.mpr (Or.inl hpriority)⟩) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ProtectedArc.lean b/LeanPool/GraphMinor/GM12/Section4ProtectedArc.lean new file mode 100644 index 0000000000..ae253029a7 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ProtectedArc.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.GM12.Section4DiscEnlargement +import LeanPool.GraphMinor.GM12.Section3NormalPuncturedPaths +import LeanPool.GraphMinor.GM11.PaintingCells +import LeanPool.GraphMinor.Surface.ArcInPath + +/-! +# Arcs outside a finite family of closed discs + +For XII (4.3), claim (7), page 251, joining arcs for an ambient +motion must avoid all discs already fixed. Enlarge those discs +slightly without capturing either endpoint. A path outside the +interiors of the enlargements avoids the original closed discs. +Removing repetitions gives the required arc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- Two distinct points outside disjoint closed discs are joined by +an arc avoiding all those discs. -/ +theorem exists_arc_avoiding_closed_discs + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (D : ι → Set S) (hD : ∀ i, IsClosedDisc (D i)) + (hDD : Pairwise (fun i j => Disjoint (D i) (D j))) + {x y : S} (hxy : x ≠ y) (hx : x ∉ ⋃ i, D i) (hy : y ∉ ⋃ i, D i) : + ∃ a : unitInterval → S, IsArcMap a ∧ a 0 = x ∧ a 1 = y ∧ + Disjoint (range a) (⋃ i, D i) := by + have hDB : ∀ i ∈ (univ : Set ι), Disjoint (D i) ({x, y} : Set S) := by + intro i _ + apply Set.disjoint_right.mpr + intro z hz hzD + rcases hz with rfl | hz + · exact hx (mem_iUnion.mpr ⟨i, hzD⟩) + · have heq := Set.mem_singleton_iff.mp hz + subst z + exact hy (mem_iUnion.mpr ⟨i, hzD⟩) + obtain ⟨E, hE, hEE⟩ := exists_disjoint_disc_enlargements hS (Set.toFinite (univ : Set ι)) D + (fun i _ => hD i) (fun i _ j _ hij => hDD hij) + {x, y} (isClosed_singleton.union isClosed_singleton) hDB + have hEdisc : ∀ i, IsClosedDisc (E i) := fun i => (hE i (mem_univ i)).1 + have hxE : x ∈ discComplement E := by + apply subset_closure + intro hxunion + obtain ⟨i, hxi⟩ := mem_iUnion.mp hxunion + exact Set.disjoint_left.mp (hE i (mem_univ i)).2.2 hxi (by simp) + have hyE : y ∈ discComplement E := by + apply subset_closure + intro hyunion + obtain ⟨i, hyi⟩ := mem_iUnion.mp hyunion + exact Set.disjoint_left.mp (hE i (mem_univ i)).2.2 hyi (by simp) + let Γ : Drawing S := pointsDrawing (Set.finite_empty : (∅ : Set S).Finite) + have hΓU : Γ.U = ∅ := rfl + have hΓV : Γ.V = ∅ := rfl + obtain ⟨q, hq, _⟩ := exists_normal_path_in_discComplement hS Γ E hEdisc + (fun i j hij => hEE i (mem_univ i) j (mem_univ j) hij) + (fun i => by rw [hΓU, hΓV, empty_inter, empty_inter]) hxE hyE + (Or.inl (by rw [hΓU]; exact notMem_empty x)) + (Or.inl (by rw [hΓU]; exact notMem_empty y)) + have hends : q 0 ≠ q 1 := by simpa only [q.source, q.target] using hxy + obtain ⟨a, hac, hai, ha0, ha1, haq⟩ := exists_arc_of_path q.continuous hends + refine ⟨a, ⟨hac, hai⟩, ha0.trans q.source, ha1.trans q.target, ?_⟩ + apply Set.disjoint_left.mpr + intro z hza hzD + obtain ⟨i, hzi⟩ := mem_iUnion.mp hzD + have hzint : z ∈ interior (E i) := by + have hz := (hE i (mem_univ i)).2.1 hzi + rw [← IsClosedDisc.frontier_eq_discBd hS (hEdisc i)] at hz + exact (mem_interior_iff_notMem_frontier hz.1).mpr hz.2 + have hCout : discComplement E ⊆ (interior (E i))ᶜ := by + apply closure_minimal + · intro w hw hwi + exact hw (mem_iUnion.mpr ⟨i, interior_subset hwi⟩) + · exact isOpen_interior.isClosed_compl + exact hCout (hq (haq hza)) hzint + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ProtectedCrossDiscFamily.lean b/LeanPool/GraphMinor/GM12/Section4ProtectedCrossDiscFamily.lean new file mode 100644 index 0000000000..a12bfa93af --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ProtectedCrossDiscFamily.lean @@ -0,0 +1,100 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CrossDiscFamily +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Crossing discs avoiding vertices and unrelated edges + +For XII (4.5), claim (1), page 253, a crossing disc must miss +all source vertices and all edges except its crossing pair. +These forbidden points and arcs form a finite closed set which +does not contain the crossing. Shrink its local straight-line +neighborhood by deleting that set before choosing the discs. +The discs retain their opposite boundary contacts and contain +their crossings in their interiors. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Crossing discs can be chosen disjoint from all vertices +and all edges outside their crossing pairs, while retaining +the exact coordinate-disc and opposite-contact equations. +This is the protected disc choice in XII (4.5), claim (1), +page 253. -/ +theorem exists_protected_cross_disc_family {V E T : Type*} + [Finite V] [Finite E] [Finite T] + (v : V → ℂ) (P : E → Set ℂ) (hP : ∀ e, IsClosed (P e)) + (x : T → ℂ) (hinj : Function.Injective x) (left right : T → E) + (hxV : ∀ i, x i ∉ range v) + (hother : ∀ i e, e ≠ left i → e ≠ right i → x i ∉ P e) + (A : T → ℂ ≃L[ℝ] ℂ) (U : T → Set ℂ) + (hU : ∀ i, IsOpen (U i)) (hxU : ∀ i, x i ∈ U i) + (hleft : ∀ i, P (left i) ∩ U i = (line[ℝ, x i, x i + A i 1] : Set ℂ) ∩ U i) + (hright : ∀ i, P (right i) ∩ U i = (line[ℝ, x i, x i + A i Complex.I] : Set ℂ) ∩ U i) : + ∃ (r : T → ℝ) (D : T → Set ℂ), (∀ i, 0 < r i) ∧ + (∀ i, IsClosedDisc (D i)) ∧ (∀ i, D i ⊆ U i) ∧ + (∀ i j, i ≠ j → Disjoint (D i) (D j)) ∧ + (∀ i, x i ∈ interior (D i)) ∧ + (∀ i, Disjoint (D i) (range v)) ∧ + (∀ i e, e ≠ left i → e ≠ right i → Disjoint (D i) (P e)) ∧ + (∀ i, P (left i) ∩ discBd (D i) = + {x i + A i (r i • (1 : ℂ)), x i + A i ((-r i) • (1 : ℂ))}) ∧ + (∀ i, P (right i) ∩ discBd (D i) = + {x i + A i (r i • Complex.I), x i + A i ((-r i) • Complex.I)}) ∧ + (∀ i, D i = (fun z => x i + A i z) '' Metric.closedBall 0 (r i)) := by + classical + let B := fun i => range v ∪ ⋃ e, if e = left i ∨ e = right i then ∅ else P e + have hB : ∀ i, IsClosed (B i) := by + intro i + apply (finite_range v).isClosed.union + apply isClosed_iUnion_of_finite + intro e + split_ifs <;> first | exact isClosed_empty | exact hP e + have hxB : ∀ i, x i ∉ B i := by + intro i hx + rcases hx with hxv | hxedges + · exact hxV i hxv + · obtain ⟨e, he⟩ := mem_iUnion.mp hxedges + by_cases h : e = left i ∨ e = right i + · simp only [h, ↓reduceIte, mem_empty_iff_false] at he + · have hxe : x i ∈ P e := by simpa only [h, ↓reduceIte] using he + exact hother i e (fun hl => h (Or.inl hl)) (fun hr => h (Or.inr hr)) hxe + let W := fun i => U i ∩ (B i)ᶜ + have hW : ∀ i, IsOpen (W i) := fun i => (hU i).inter (hB i).isOpen_compl + have hxW : ∀ i, x i ∈ W i := fun i => ⟨hxU i, hxB i⟩ + have hleftW : ∀ i, P (left i) ∩ W i = (line[ℝ, x i, x i + A i 1] : Set ℂ) ∩ W i := by + intro i + rw [show W i = U i ∩ (B i)ᶜ from rfl, ← inter_assoc, hleft i, inter_assoc] + have hrightW : ∀ i, P (right i) ∩ W i = (line[ℝ, x i, x i + A i Complex.I] : Set ℂ) ∩ W i := by + intro i + rw [show W i = U i ∩ (B i)ᶜ from rfl, ← inter_assoc, hright i, inter_assoc] + obtain ⟨r, hr, D, hd, hsub, hdd, hl, hrt, hcoord⟩ := exists_local_cross_disc_family + x hinj A (fun i => P (left i)) (fun i => P (right i)) W hW hxW hleftW hrightW + refine ⟨r, D, hr, hd, (fun i z hz => (hsub i hz).1), hdd, ?_, ?_, ?_, hl, hrt, hcoord⟩ + · intro i + rw [hcoord i] + exact cross_disc_center_mem_interior (A i) (x i) (hr i) + · intro i + exact disjoint_left.mpr (fun z hz hv => (hsub i hz).2 (Or.inl hv)) + · intro i e hel her + apply disjoint_left.mpr + intro z hz hze + apply (hsub i hz).2 + refine Or.inr (mem_iUnion.mpr ⟨e, ?_⟩) + simpa only [show ¬ (e = left i ∨ e = right i) from fun h => h.elim hel her, + ↓reduceIte] using hze + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ProtectedDiscMatch.lean b/LeanPool/GraphMinor/GM12/Section4ProtectedDiscMatch.lean new file mode 100644 index 0000000000..6bb66ff78c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ProtectedDiscMatch.lean @@ -0,0 +1,85 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collar +import LeanPool.GraphMinor.GM12.Section4DiscMatch +import LeanPool.GraphMinor.GM12.Section4DiscCompression +import LeanPool.GraphMinor.GM12.Section4DiscEnlargement +import LeanPool.GraphMinor.GM12.Section4ProtectedMotion +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.Surface.Wedge + +/-! +# Matching one disc while fixing protected discs + +For XII (4.3), claim (7), page 251, match discs one at a time. +Move a compression center of the source into the target's interior. +Compress the source before this motion so its image lies inside the +target. The nested-disc homeomorphism then expands that image onto +the target. Each motion fixes the protected discs pointwise. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Metric GM11 + +/-- Match two closed discs outside a protected disjoint disc family, +fixing every protected disc pointwise. -/ +theorem exists_disc_match_fixing_discs + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (D : ι → Set S) (hD : ∀ i, IsClosedDisc (D i)) + (hDD : Pairwise (fun i j => Disjoint (D i) (D j))) + {A B : Set S} (hA : IsClosedDisc A) (hB : IsClosedDisc B) + (hAD : Disjoint A (⋃ i, D i)) (hBD : Disjoint B (⋃ i, D i)) : + ∃ e : S ≃ₜ S, e '' A = B ∧ ∀ i z, z ∈ D i → e z = z := by + let Z := ⋃ i, D i + have hZ : IsClosed Z := isClosed_iUnion_of_finite fun i => (hD i).isClosed + obtain ⟨p, hpA, hcompress⟩ := exists_disc_compression_center hS hA hZ hAD + obtain ⟨h, g, c⟩ := hB.exists_isChart + have hBi : discInt B = interior B := by + rw [discInt, ← IsClosedDisc.frontier_eq_discBd hS hB, self_sdiff_frontier] + have hq : g 0 ∈ interior B := by + rw [← hBi, c.discInt_eq] + exact mem_image_of_mem g (by simp) + have hpZ : p ∉ ⋃ i, D i := Set.disjoint_left.mp hAD hpA + have hqZ : g 0 ∉ ⋃ i, D i := Set.disjoint_left.mp hBD (interior_subset hq) + obtain ⟨f, hfp, hffix⟩ := exists_point_motion_fixing_discs hS D hD hDD hpZ hqZ + let U := f ⁻¹' interior B + have hU : IsOpen U := isOpen_interior.preimage f.continuous + have hpU : p ∈ U := by change f p ∈ interior B; rw [hfp]; exact hq + obtain ⟨s, hsA, _, hsfix⟩ := hcompress U hU hpU + let H := s.trans f + have hHA : H '' A ⊆ interior B := by + rintro _ ⟨x, hxA, rfl⟩ + exact hsA (mem_image_of_mem s hxA) + have hHfix : ∀ i z, z ∈ D i → H z = z := by + intro i z hz + change f (s z) = z + rw [hsfix z (mem_iUnion.mpr ⟨i, hz⟩), hffix i z hz] + have hnonempty : Nonempty S := ⟨p⟩ + have hHA_disc : IsClosedDisc (H '' A) := + (isClosedDisc_image_injOn hA hA.isCompact H.continuous.continuousOn H.injective.injOn).1 + obtain ⟨E, hE, hBE, hEZ⟩ := exists_disc_enlargement_avoiding hS hB hZ hBD + have hHAB : H '' A ⊆ B \ discBd B := by + rw [← discInt, hBi] + exact hHA + obtain ⟨k, hkA, hkfix⟩ := exists_disc_onto_nested + (fun x => (hS.2.2 x).isManifoldPoint) hHA_disc hB hE hHAB hBE + refine ⟨H.trans k, ?_, ?_⟩ + · change (fun x => k (H x)) '' A = B + simpa only [image_image] using hkA + · intro i z hz + change k (H z) = z + rw [hHfix i z hz] + exact hkfix z (fun hzE => Set.disjoint_left.mp hEZ hzE (mem_iUnion.mpr ⟨i, hz⟩)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ProtectedMotion.lean b/LeanPool/GraphMinor/GM12/Section4ProtectedMotion.lean new file mode 100644 index 0000000000..edc7a38e7a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ProtectedMotion.lean @@ -0,0 +1,51 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.GM12.Section4ProtectedArc +import LeanPool.GraphMinor.GM12.Section4AmbientMotion +import LeanPool.GraphMinor.Surface.Wedge + +/-! +# Moving a point while preserving a finite family of discs + +In XII (4.3), claim (7), page 251, disc placements can be made +successively only if each new motion preserves the earlier ones. +Join two points by an arc outside the protected closed discs, then +apply the ambient endpoint motion with their union as forbidden set. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Any point outside finitely many disjoint closed discs can be +moved to any other such point, fixing all the discs pointwise. -/ +theorem exists_point_motion_fixing_discs + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (D : ι → Set S) (hD : ∀ i, IsClosedDisc (D i)) + (hDD : Pairwise (fun i j => Disjoint (D i) (D j))) + {x y : S} (hx : x ∉ ⋃ i, D i) (hy : y ∉ ⋃ i, D i) : + ∃ e : S ≃ₜ S, e x = y ∧ ∀ i z, z ∈ D i → e z = z := by + by_cases hxy : x = y + · exact ⟨Homeomorph.refl S, hxy, fun _ _ _ => rfl⟩ + obtain ⟨a, ha, ha0, ha1, havoid⟩ := + exists_arc_avoiding_closed_discs hS D hD hDD hxy hx hy + have hclosed : IsClosed (⋃ i, D i) := isClosed_iUnion_of_finite fun i => (hD i).isClosed + obtain ⟨e, hend, hfix⟩ := exists_ambient_endpoint_motion hS ha hclosed havoid + have heyx : e y = x := by rwa [ha0, ha1] at hend + refine ⟨e.symm, ?_, ?_⟩ + · exact e.symm_apply_eq.mpr heyx.symm + · intro i z hz + exact e.symm_apply_eq.mpr (hfix z (mem_iUnion.mpr ⟨i, hz⟩)).symm + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4QuadDiscFamilyMatch.lean b/LeanPool/GraphMinor/GM12/Section4QuadDiscFamilyMatch.lean new file mode 100644 index 0000000000..6e3d5396f8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4QuadDiscFamilyMatch.lean @@ -0,0 +1,118 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4QuadDiscMatch +import LeanPool.GraphMinor.GM19.MarkedMatch +import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# Matching all four-marked crossing discs + +For XII (4.5), claim (1), page 253, match the finite disc +families one disc at a time. Each new match fixes every disc +already placed, so it preserves the earlier boundary marks. +On each disc the second and fourth marks may exchange places, +which preserves the two opposite crossing pairs. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Match finite families of whole crossing discs and four +boundary marks on each, preserving the two opposite pairs. +This is the finite matching construction in XII (4.5), claim +(1), page 253. -/ +theorem exists_quad_disc_family_match {S ι : Type} + [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (A B : ι → Set S) + (hA : ∀ i, IsClosedDisc (A i)) (hB : ∀ i, IsClosedDisc (B i)) + (hAA : Pairwise (fun i j => Disjoint (A i) (A j))) + (hBB : Pairwise (fun i j => Disjoint (B i) (B j))) + (p q : ι → Circle → S) + (hp : ∀ i, Continuous (p i) ∧ Function.Injective (p i) ∧ range (p i) = discBd (A i)) + (hq : ∀ i, Continuous (q i) ∧ Function.Injective (q i) ∧ range (q i) = discBd (B i)) + (b₀ b₁ b₂ b₃ : ι → ℝ) (hb₀₁ : ∀ i, b₀ i < b₁ i) (hb₁₂ : ∀ i, b₁ i < b₂ i) + (hb₂₃ : ∀ i, b₂ i < b₃ i) (hb₃ : ∀ i, b₃ i < b₀ i + 1) : + ∃ e : S ≃ₜ S, ∀ i, e '' A i = B i ∧ + ((e (p i (ee 0)) = q i (ee (b₀ i)) ∧ e (p i (ee (1 / 4))) = q i (ee (b₁ i)) ∧ + e (p i (ee (1 / 2))) = q i (ee (b₂ i)) ∧ e (p i (ee (3 / 4))) = q i (ee (b₃ i))) ∨ + (e (p i (ee 0)) = q i (ee (b₀ i)) ∧ e (p i (ee (1 / 4))) = q i (ee (b₃ i)) ∧ + e (p i (ee (1 / 2))) = q i (ee (b₂ i)) ∧ e (p i (ee (3 / 4))) = q i (ee (b₁ i)))) := by + classical + let Good := fun (e : S ≃ₜ S) i => e '' A i = B i ∧ + ((e (p i (ee 0)) = q i (ee (b₀ i)) ∧ e (p i (ee (1 / 4))) = q i (ee (b₁ i)) ∧ + e (p i (ee (1 / 2))) = q i (ee (b₂ i)) ∧ e (p i (ee (3 / 4))) = q i (ee (b₃ i))) ∨ + (e (p i (ee 0)) = q i (ee (b₀ i)) ∧ e (p i (ee (1 / 4))) = q i (ee (b₃ i)) ∧ + e (p i (ee (1 / 2))) = q i (ee (b₂ i)) ∧ e (p i (ee (3 / 4))) = q i (ee (b₁ i)))) + change ∃ e, ∀ i, Good e i + have hex : ∀ F : Set ι, F.Finite → ∃ e : S ≃ₜ S, ∀ i ∈ F, Good e i := by + intro F hF + induction F, hF using Set.Finite.induction_on with + | empty => exact ⟨Homeomorph.refl S, by simp⟩ + | @insert i F hi hF ih => + obtain ⟨e, he⟩ := ih + have himage := (hA i).image e.continuous.continuousOn e.symm.continuous.continuousOn + (fun z _ => e.symm_apply_apply z) + let D : F → Set S := fun j => B j.val + have hD : ∀ j, IsClosedDisc (D j) := fun j => hB j.val + have hDD : Pairwise (fun j k => Disjoint (D j) (D k)) := by + intro j k hjk + exact hBB (fun h => hjk (Subtype.ext h)) + have hAD : Disjoint (e '' A i) (⋃ j : F, D j) := by + apply disjoint_left.mpr + rintro z ⟨x, hx, rfl⟩ hzD + obtain ⟨j, hj⟩ := mem_iUnion.mp hzD + have hjB : e x ∈ B j.val := hj + obtain ⟨y, hy, hye⟩ := (he j.val j.property).1.symm ▸ hjB + have hxy : y = x := e.injective hye + exact disjoint_left.mp (hAA (show i ≠ j.val from fun hij => hi (hij ▸ j.property))) hx + (hxy ▸ hy) + have hBD : Disjoint (B i) (⋃ j : F, D j) := by + apply disjoint_left.mpr + intro z hzB hzD + obtain ⟨j, hj⟩ := mem_iUnion.mp hzD + exact disjoint_left.mp (hBB (show i ≠ j.val from fun hij => hi (hij ▸ j.property))) hzB hj + have hpI : GM19.IsBdParam (A i) (p i) := hp i + have hpimage := hpI.image e (hA i) + obtain ⟨k, hkA, hkmarks, hkfix⟩ := exists_quad_disc_match_fixing_discs hS D hD hDD + himage.1 (hB i) hAD hBD (fun w => e (p i w)) (q i) hpimage (hq i) + (hb₀₁ i) (hb₁₂ i) (hb₂₃ i) (hb₃ i) + refine ⟨e.trans k, ?_⟩ + intro j hj + rcases hj with hji | hj + · subst j + refine ⟨?_, hkmarks⟩ + change (fun z => k (e z)) '' A i = B i + simpa only [image_image] using hkA + · have hBj : k '' B j = B j := by + apply Subset.antisymm + · rintro _ ⟨z, hz, rfl⟩ + rw [hkfix ⟨j, hj⟩ z hz] + exact hz + · intro z hz + exact ⟨z, hz, hkfix ⟨j, hj⟩ z hz⟩ + have hkeep : ∀ w : Circle, k (e (p j w)) = e (p j w) := by + intro w + apply hkfix ⟨j, hj⟩ + change e (p j w) ∈ B j + have hpbd : p j w ∈ discBd (A j) := (hp j).2.2 ▸ mem_range_self w + exact (he j hj).1 ▸ mem_image_of_mem e (discBd_subset _ hpbd) + refine ⟨?_, ?_⟩ + · change (fun z => k (e z)) '' A j = B j + have h := congrArg (fun C => k '' C) (he j hj).1 + simpa only [image_image, hBj] using h + · simpa only [Homeomorph.trans_apply, hkeep] using (he j hj).2 + obtain ⟨e, he⟩ := hex univ (Set.toFinite _) + exact ⟨e, fun i => he i (mem_univ i)⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4QuadDiscMatch.lean b/LeanPool/GraphMinor/GM12/Section4QuadDiscMatch.lean new file mode 100644 index 0000000000..4236aa1da0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4QuadDiscMatch.lean @@ -0,0 +1,91 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4CircleQuadTransfer +public import LeanPool.GraphMinor.Surface.Collar +import LeanPool.GraphMinor.GM12.Section4ProtectedDiscMatch +import LeanPool.GraphMinor.GM12.Section4DiscMatch +import LeanPool.GraphMinor.GM12.Section4DiscEnlargement +import LeanPool.GraphMinor.GM19.MarkedMatch +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Matching a disc with four crossing marks + +For XII (4.5), claim (1), page 253, first match the two whole +discs while fixing the protected disc family. Compare their +boundary parametrizations through this ambient map. The circle +quadruple adjustment matches the four marks, either in order +or with the second and fourth exchanged, preserving opposite +pairs in both cases. Extend it through a collar of the target +disc, chosen away from the protected family. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Match whole discs and four crossing marks, preserving the +two opposite pairs and fixing a disjoint protected disc family. +The possible reversal of the boundary direction exchanges +only the second and fourth target marks. This is the single +disc match in XII (4.5), claim (1), page 253. -/ +theorem exists_quad_disc_match_fixing_discs {S ι : Type} + [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite ι] + (hS : IsClosedSurface S) (D : ι → Set S) (hD : ∀ i, IsClosedDisc (D i)) + (hDD : Pairwise (fun i j => Disjoint (D i) (D j))) + {A B : Set S} (hA : IsClosedDisc A) (hB : IsClosedDisc B) + (hAD : Disjoint A (⋃ i, D i)) (hBD : Disjoint B (⋃ i, D i)) + (p q : Circle → S) + (hp : Continuous p ∧ Function.Injective p ∧ range p = discBd A) + (hq : Continuous q ∧ Function.Injective q ∧ range q = discBd B) + {b₀ b₁ b₂ b₃ : ℝ} (hb₀₁ : b₀ < b₁) (hb₁₂ : b₁ < b₂) + (hb₂₃ : b₂ < b₃) (hb₃ : b₃ < b₀ + 1) : + ∃ e : S ≃ₜ S, e '' A = B ∧ + ((e (p (ee 0)) = q (ee b₀) ∧ e (p (ee (1 / 4))) = q (ee b₁) ∧ + e (p (ee (1 / 2))) = q (ee b₂) ∧ e (p (ee (3 / 4))) = q (ee b₃)) ∨ + (e (p (ee 0)) = q (ee b₀) ∧ e (p (ee (1 / 4))) = q (ee b₃) ∧ + e (p (ee (1 / 2))) = q (ee b₂) ∧ e (p (ee (3 / 4))) = q (ee b₁))) ∧ + ∀ i z, z ∈ D i → e z = z := by + obtain ⟨f, hfA, hffix⟩ := exists_disc_match_fixing_discs hS D hD hDD hA hB hAD hBD + have hp' : GM19.IsBdParam A p := hp + have hq' : GM19.IsBdParam B q := hq + obtain ⟨τ, hτ⟩ := GM19.exists_circle_transfer hp' hq' f hA hfA + obtain ⟨g, hg, hmarks⟩ := exists_circle_quad_transfer τ hb₀₁ hb₁₂ hb₂₃ hb₃ + obtain ⟨qH, hqH⟩ := GM19.IsBdParam.exists_homeo hq' + have hZ : IsClosed (⋃ i, D i) := isClosed_iUnion_of_finite (fun i => (hD i).isClosed) + obtain ⟨E, hE, hBE, hEZ⟩ := exists_disc_enlargement_avoiding hS hB hZ hBD + obtain ⟨k, hkB, hkmarks, hkfix⟩ := exists_boundary_twist + (fun z => (hS.2.2 z).isManifoldPoint) hB hE hBE qH hg + have hcomp : ∀ w, (f.trans k) (p w) = q (g (τ w)) := by + intro w + change k (f (p w)) = _ + rw [← hτ w, ← hqH (τ w), hkmarks, hqH] + refine ⟨f.trans k, ?_, ?_, ?_⟩ + · change (fun z => k (f z)) '' A = B + have h := congrArg (fun C => k '' C) hfA + simpa only [image_image, hkB] using h + · rcases hmarks with ⟨h0, h1, h2, h3⟩ | ⟨h0, h1, h2, h3⟩ + · exact Or.inl ⟨(hcomp (ee 0)).trans (congrArg q h0), + (hcomp (ee (1 / 4))).trans (congrArg q h1), + (hcomp (ee (1 / 2))).trans (congrArg q h2), + (hcomp (ee (3 / 4))).trans (congrArg q h3)⟩ + · exact Or.inr ⟨(hcomp (ee 0)).trans (congrArg q h0), + (hcomp (ee (1 / 4))).trans (congrArg q h1), + (hcomp (ee (1 / 2))).trans (congrArg q h2), + (hcomp (ee (3 / 4))).trans (congrArg q h3)⟩ + · intro i z hz + change k (f z) = z + rw [hffix i z hz] + exact hkfix z (fun hzE => disjoint_left.mp hEZ hzE (mem_iUnion.mpr ⟨i, hz⟩)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4QuadPartitionTransport.lean b/LeanPool/GraphMinor/GM12/Section4QuadPartitionTransport.lean new file mode 100644 index 0000000000..f6ece498f1 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4QuadPartitionTransport.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4QuadDiscFamilyMatch +public import LeanPool.GraphMinor.GM12.Section4EndPartition + +/-! +# Transporting the source endpoint partition + +For XII (4.5), claim (1), page 253, match all four-marked +crossing discs by one ambient homeomorphism. Carry the source +vertex discs and their end classes by that map. Images preserve +their disjointness and exact contact equations. On every +crossing, the two opposite endpoint pairs become the two +prescribed opposite pairs, including when the boundary order +is reversed. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Transport a feasible source endpoint partition to prescribed +four-marked discs, preserving both opposite pairs. This is the +last ambient-map step of XII (4.5), claim (1), page 253. -/ +theorem exists_quad_partition_transport {S V E T : Type} + [TopologicalSpace S] [T2Space S] [ConnectedSpace S] [Finite T] + (hS : IsClosedSurface S) (A C : T → Set S) (B : V → Set S) + (hA : ∀ i, IsClosedDisc (A i)) (hC : ∀ i, IsClosedDisc (C i)) + (hAA : Pairwise (fun i j => Disjoint (A i) (A j))) + (hCC : Pairwise (fun i j => Disjoint (C i) (C j))) + (hB : ∀ w, IsClosedDisc (B w)) (hBB : Pairwise (fun w z => Disjoint (B w) (B z))) + (p t : T → Circle → S) + (hp : ∀ i, Continuous (p i) ∧ Function.Injective (p i) ∧ range (p i) = discBd (A i)) + (ht : ∀ i, Continuous (t i) ∧ Function.Injective (t i) ∧ range (t i) = discBd (C i)) + (σ : T × Bool ≃ E) (ends : E × Bool → S) (κ : E × Bool → V) + (hinj : Function.Injective ends) + (hcontact : ∀ w, B w ∩ (⋃ i, A i) = edgeEndClass ends κ w) + (h0 : ∀ i, ({ends (σ (i, false), false), ends (σ (i, false), true)} : Set S) = + {p i (ee 0), p i (ee (1 / 2))}) + (h1 : ∀ i, ({ends (σ (i, true), false), ends (σ (i, true), true)} : Set S) = + {p i (ee (1 / 4)), p i (ee (3 / 4))}) + (b₀ b₁ b₂ b₃ : T → ℝ) (hb₀₁ : ∀ i, b₀ i < b₁ i) (hb₁₂ : ∀ i, b₁ i < b₂ i) + (hb₂₃ : ∀ i, b₂ i < b₃ i) (hb₃ : ∀ i, b₃ i < b₀ i + 1) : + ∃ (ends' : E × Bool → S) (B' : V → Set S), Function.Injective ends' ∧ + (∀ w, IsClosedDisc (B' w)) ∧ (Pairwise (fun w z => Disjoint (B' w) (B' z))) ∧ + (∀ w, B' w ∩ (⋃ i, C i) = edgeEndClass ends' κ w) ∧ + (∀ i, ({ends' (σ (i, false), false), ends' (σ (i, false), true)} : Set S) = + {t i (ee (b₀ i)), t i (ee (b₂ i))}) ∧ + (∀ i, ({ends' (σ (i, true), false), ends' (σ (i, true), true)} : Set S) = + {t i (ee (b₁ i)), t i (ee (b₃ i))}) := by + obtain ⟨e, he⟩ := exists_quad_disc_family_match hS A C hA hC hAA hCC p t hp ht + b₀ b₁ b₂ b₃ hb₀₁ hb₁₂ hb₂₃ hb₃ + let ends' := e ∘ ends + let B' := fun w => e '' B w + have hclass : ∀ w, e '' edgeEndClass ends κ w = edgeEndClass ends' κ w := by + intro w + simp only [edgeEndClass, image_image] + rfl + have hcover : e '' (⋃ i, A i) = ⋃ i, C i := by + rw [image_iUnion] + exact iUnion_congr (fun i => (he i).1) + refine ⟨ends', B', e.injective.comp hinj, ?_, ?_, ?_, ?_, ?_⟩ + · intro w + exact ((hB w).image e.continuous.continuousOn e.symm.continuous.continuousOn + (fun z _ => e.symm_apply_apply z)).1 + · intro w z hwz + exact (disjoint_image_iff e.injective).mpr (hBB hwz) + · intro w + change (e '' B w) ∩ (⋃ i, C i) = _ + rw [← hcover, ← image_inter e.injective, hcontact w, hclass w] + · intro i + have h := congrArg (fun X : Set S => e '' X) (h0 i) + simp only [image_pair] at h + change ({e (ends (σ (i, false), false)), e (ends (σ (i, false), true))} : Set S) = _ + rw [h] + rcases (he i).2 with ⟨h0, _, h2, _⟩ | ⟨h0, _, h2, _⟩ <;> rw [h0, h2] + · intro i + have h := congrArg (fun X : Set S => e '' X) (h1 i) + simp only [image_pair] at h + change ({e (ends (σ (i, true), false)), e (ends (σ (i, true), true))} : Set S) = _ + rw [h] + rcases (he i).2 with ⟨_, h1, _, h3⟩ | ⟨_, h1, _, h3⟩ + · rw [h1, h3] + · rw [h1, h3, pair_comm] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4RadialResize.lean b/LeanPool/GraphMinor/GM12/Section4RadialResize.lean new file mode 100644 index 0000000000..6c8f19a5da --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4RadialResize.lean @@ -0,0 +1,152 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.PushOff + +/-! +# A radial change of disc radius with bounded support + +The disc motion in XII (4.3), claim (7), page 251, needs to shrink +and enlarge discs inside their collars. Apply the piecewise linear +tent map to the radius, keeping each ray fixed. Its inverse is the +tent map with the two radii exchanged. Outside the outer radius +both maps are the identity. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Metric + +private theorem tentMap_pos {l w t r : ℝ} (hl : 0 < l) (hlt : l < t) + (hw : 0 < w) (hr : 0 < r) : 0 < tentMap 0 l w t r := by + by_cases hrl : r ≤ l + · rw [tentMap, tent_left hl hlt hr.le hrl] + simp only [sub_zero] + have heq : r + (w - l) * (r / l) = w * r / l := by field_simp; ring + rw [heq] + exact div_pos (mul_pos hw hr) hl + · by_cases hrt : r ≤ t + · rw [tentMap, tent_right hl hlt (le_of_not_ge hrl) hrt] + have heq : r + (w - l) * ((t - r) / (t - l)) = + w * ((t - r) / (t - l)) + t * ((r - l) / (t - l)) := by + field_simp [sub_ne_zero.mpr hlt.ne']; ring + rw [heq] + have h1 := mul_nonneg hw.le (div_nonneg (sub_nonneg.mpr hrt) (sub_pos.mpr hlt).le) + have h2 := mul_pos (hl.trans hlt) (div_pos (sub_pos.mpr (lt_of_not_ge hrl)) (sub_pos.mpr hlt)) + exact add_pos_of_nonneg_of_pos h1 h2 + · rw [tentMap, tent_high hl hlt (le_of_not_ge hrt), mul_zero, add_zero] + exact hr + +private noncomputable def radialFactor (l w t r : ℝ) : ℝ := + tentMap 0 l w t (max l r) / max l r + +private theorem radialFactor_pos {l w t : ℝ} (hl : 0 < l) (hlt : l < t) + (hw : 0 < w) (r : ℝ) : 0 < radialFactor l w t r := + div_pos (tentMap_pos hl hlt hw (hl.trans_le (le_max_left _ _))) + (hl.trans_le (le_max_left _ _)) + +private theorem radialFactor_mul {l w t r : ℝ} (hl : 0 < l) (hlt : l < t) + (hr : 0 ≤ r) : radialFactor l w t r * r = tentMap 0 l w t r := by + by_cases hrl : r ≤ l + · simp only [radialFactor, max_eq_left hrl] + rw [tentMap, tent_left hl hlt hl.le le_rfl] + simp only [sub_zero, div_self hl.ne', mul_one] + rw [tentMap, tent_left hl hlt hr hrl] + simp only [sub_zero] + field_simp + · simp only [radialFactor, max_eq_right (le_of_not_ge hrl)] + exact div_mul_cancel₀ _ (hl.trans (lt_of_not_ge hrl)).ne' + +private theorem radialFactor_continuous {l w t : ℝ} (hl : 0 < l) : + Continuous (radialFactor l w t) := by + unfold radialFactor tentMap tent + apply Continuous.div + · fun_prop + · fun_prop + · intro r + exact (hl.trans_le (le_max_left _ _)).ne' + +private noncomputable def radialMap (l w t : ℝ) (z : ℂ) : ℂ := + radialFactor l w t ‖z‖ • z + +private theorem radialMap_norm {l w t : ℝ} (hl : 0 < l) (hlt : l < t) + (hw : 0 < w) (z : ℂ) : + ‖radialMap l w t z‖ = tentMap 0 l w t ‖z‖ := by + rw [radialMap, norm_smul, Real.norm_eq_abs, + abs_of_pos (radialFactor_pos hl hlt hw _)] + exact radialFactor_mul hl hlt (norm_nonneg z) + +private theorem radialMap_inverse {l w t : ℝ} (hl : 0 < l) (hlt : l < t) + (hw : 0 < w) (hwt : w < t) (z : ℂ) : + radialMap w l t (radialMap l w t z) = z := by + by_cases hz : z = 0 + · simp [hz, radialMap] + have hn : 0 < ‖z‖ := norm_pos_iff.mpr hz + have heq : radialFactor w l t (tentMap 0 l w t ‖z‖) * radialFactor l w t ‖z‖ = 1 := by + apply mul_right_cancel₀ hn.ne' + rw [one_mul, mul_assoc, radialFactor_mul hl hlt hn.le, + radialFactor_mul hw hwt (tentMap_pos hl hlt hw hn).le, + tentMap_inv hl hlt hw hwt] + change radialFactor w l t ‖radialMap l w t z‖ • (radialFactor l w t ‖z‖ • z) = z + rw [radialMap_norm hl hlt hw, smul_smul, heq, one_smul] + +/-- Change one positive disc radius to another, fixing all points +at or beyond a larger radius. -/ +theorem exists_radial_disc_resize {l w t : ℝ} (hl : 0 < l) (hlt : l < t) + (hw : 0 < w) (hwt : w < t) : + ∃ Θ : ℂ ≃ₜ ℂ, + (∀ z, t ≤ ‖z‖ → Θ z = z) ∧ + (∀ z, ‖Θ z‖ = tentMap 0 l w t ‖z‖) ∧ + Θ '' closedBall 0 l = closedBall 0 w := by + let Θ : ℂ ≃ₜ ℂ := { + toFun := radialMap l w t + invFun := radialMap w l t + left_inv := radialMap_inverse hl hlt hw hwt + right_inv := radialMap_inverse hw hwt hl hlt + continuous_toFun := (radialFactor_continuous hl).comp continuous_norm |>.smul continuous_id + continuous_invFun := (radialFactor_continuous hw).comp continuous_norm |>.smul + continuous_id } + have hscale : ∀ z : ℂ, ‖z‖ ≤ l → Θ z = (w / l) • z := by + intro z hz + change radialFactor l w t ‖z‖ • z = _ + congr 1 + simp only [radialFactor, max_eq_left hz, tentMap, tent_left hl hlt hl.le le_rfl, + sub_zero, div_self hl.ne', mul_one] + congr 1 + ring + refine ⟨Θ, ?_, radialMap_norm hl hlt hw, ?_⟩ + · intro z hz + change radialFactor l w t ‖z‖ • z = z + have hn : l ≤ ‖z‖ := hlt.le.trans hz + have hnpos : 0 < ‖z‖ := hl.trans_le hn + simp only [radialFactor, max_eq_right hn, tentMap, tent_high hl hlt hz, + mul_zero, add_zero, div_self hnpos.ne', one_smul] + · apply Set.Subset.antisymm + · rintro _ ⟨z, hz, rfl⟩ + rw [mem_closedBall_zero_iff] at hz ⊢ + rw [hscale z hz, norm_smul, Real.norm_eq_abs, abs_of_pos (div_pos hw hl)] + exact (mul_le_mul_of_nonneg_left hz (div_pos hw hl).le).trans_eq (div_mul_cancel₀ w hl.ne') + · intro z hz + rw [mem_closedBall_zero_iff] at hz + let v : ℂ := (l / w) • z + have hv : ‖v‖ ≤ l := by + dsimp only [v] + rw [norm_smul, Real.norm_eq_abs, abs_of_pos (div_pos hl hw)] + exact (mul_le_mul_of_nonneg_left hz (div_pos hl hw).le).trans_eq (div_mul_cancel₀ l hw.ne') + refine ⟨v, mem_closedBall_zero_iff.mpr hv, ?_⟩ + rw [hscale v hv] + dsimp only [v] + rw [smul_smul] + have heq : w / l * (l / w) = 1 := by field_simp + rw [heq, one_smul] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4RegionArc.lean b/LeanPool/GraphMinor/GM12/Section4RegionArc.lean new file mode 100644 index 0000000000..8573ace05d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4RegionArc.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CrossCut +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.Theorem75 +import LeanPool.GraphMinor.Surface.ArcInPath + +/-! +# Joining two incident vertices through a region + +The empty discs of XII (4.3), page 250, start with a normal +arc between two ends of an edge through an incident region. +Approach the region from each end, join the approach points +inside the region, and remove repetitions from the resulting path. +The resulting arc meets the drawing only at its ends. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Distinct vertices incident with one region can be joined by +an arc whose other points lie in that region. -/ +theorem exists_arc_through_region + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (Γ : Drawing S) {r : Set S} (hr : r ∈ Γ.R) + {u v : S} (hu : u ∈ Γ.V) (hv : v ∈ Γ.V) (huv : u ≠ v) + (hur : u ∈ closure r) (hvr : v ∈ closure r) : + ∃ a : unitInterval → S, IsArcMap a ∧ a 0 = u ∧ a 1 = v ∧ range a ⊆ r ∪ {u, v} := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨g, hgc, hg0, hgr⟩ := exists_path_into_region hS Γ hu hr hur + obtain ⟨h, hhc, hh0, hhr⟩ := exists_path_into_region hS Γ hv hr hvr + let p : Path u (g 1) := ⟨⟨g, hgc⟩, hg0, rfl⟩ + let q : Path v (h 1) := ⟨⟨h, hhc⟩, hh0, rfl⟩ + have hp : JoinedIn (r ∪ {u, v}) u (g 1) := by + refine ⟨p, ?_⟩ + intro t + by_cases ht : t = 0 + · exact Or.inr (Or.inl (by change g t = u; rw [ht, hg0])) + · exact Or.inl (hgr t (lt_of_le_of_ne (unitInterval.nonneg t) (Ne.symm ht))) + have hq : JoinedIn (r ∪ {u, v}) v (h 1) := by + refine ⟨q, ?_⟩ + intro t + by_cases ht : t = 0 + · exact Or.inr (Or.inr (Set.mem_singleton_iff.mpr (by change h t = v; rw [ht, hh0]))) + · exact Or.inl (hhr t (lt_of_le_of_ne (unitInterval.nonneg t) (Ne.symm ht))) + have hrp : IsPathConnected r := isPathConnected_of_isOpen hS (region_isOpen hr) + (region_isPreconnected hr) (region_nonempty hr) + have hmiddle : JoinedIn (r ∪ {u, v}) (g 1) (h 1) := + (hrp.joinedIn (g 1) (hgr 1 zero_lt_one) (h 1) (hhr 1 zero_lt_one)).mono subset_union_left + obtain ⟨w, hw⟩ := hp.trans (hmiddle.trans hq.symm) + obtain ⟨a, hac, hai, ha0, ha1, har⟩ := exists_arc_of_path w.continuous (by + rw [w.source, w.target] + exact huv) + refine ⟨a, ⟨hac, hai⟩, ha0.trans w.source, ha1.trans w.target, ?_⟩ + intro x hx + obtain ⟨t, ht⟩ := har hx + exact ht ▸ hw t + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4RegionContactDisc.lean b/LeanPool/GraphMinor/GM12/Section4RegionContactDisc.lean new file mode 100644 index 0000000000..6d13caefd6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4RegionContactDisc.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM12.Section4RegionFrontier +import LeanPool.GraphMinor.GM12.Section4ContactDiscUniverses + +/-! +# Contact discs inside eye regions + +XII (4.5), page 253, applies the feasibility construction to +four boundary vertices of each eye region. Shrink its closure +while retaining those points and their boundary parameters. +The smaller disc meets the drawing only at the chosen points, +since the region itself misses the drawing. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A non-dense disc region supplies a contact disc retaining +a given circle parametrization at a finite nonempty set of +boundary marks. The set `Z` represents the drawing. -/ +theorem exists_region_contact_disc {S : Type*} [TopologicalSpace S] + [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {r Z N : Set S} (hr : IsOpenDisc r) (hC : IsOArc (frontier r)) + (hproper : closure r ≠ univ) (hZ : Disjoint r Z) + (hNZ : N ⊆ Z) (hN : N ⊆ frontier r) + (hfin : N.Finite) (hne : N.Nonempty) + (φ : Circle ≃ₜ frontier r) : + ∃ (Q : Set S) (q : Circle → S), + IsClosedDisc Q ∧ Q ⊆ closure r ∧ Q ∩ Z = N ∧ N ⊆ discBd Q ∧ + Continuous q ∧ Function.Injective q ∧ range q = discBd Q ∧ + ∀ w, (φ w).val ∈ N → q w = (φ w).val := by + obtain ⟨hD, hDb⟩ := closedDisc_closure_of_nondense_openDisc hS hr hC hproper + let ψ : Circle ≃ₜ discBd (closure r) := + φ.trans (Homeomorph.setCongr hDb.symm) + have hND : N ⊆ discBd (closure r) := hDb.symm ▸ hN + obtain ⟨Q, q, hQ, hQD, hQN, hNb, hqc, hqi, hqr, hfix⟩ := + exists_contact_disc_preserving_param_univ hS hD ψ hND hfin hne + have hQZ : Q ∩ Z = N := by + apply Subset.antisymm + · intro x hx + have hxr : x ∉ r := fun h => disjoint_left.mp hZ h hx.2 + have hxb : x ∈ discBd (closure r) := by + rw [hDb, frontier, hr.1.interior_eq] + exact ⟨hQD hx.1, hxr⟩ + exact hQN ▸ ⟨hx.1, hxb⟩ + · intro x hx + have hxb : x ∈ Q ∩ discBd (closure r) := hQN.symm ▸ hx + exact ⟨hxb.1, hNZ hx⟩ + exact ⟨Q, q, hQ, hQD, hQZ, hNb, hqc, hqi, hqr, hfix⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4RegionContactFamily.lean b/LeanPool/GraphMinor/GM12/Section4RegionContactFamily.lean new file mode 100644 index 0000000000..0f10a59332 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4RegionContactFamily.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM12.Section4RegionContactDisc +import LeanPool.GraphMinor.GM12.Section4RegionContactSeparation + +/-! +# Simultaneous contact discs in eye regions + +The eye regions in XII (4.5), page 253, are distinct and have +pairwise disjoint marked sets. Choose a contact disc in each +region. A second region ensures that its closure is proper, +and the contact separation lemma makes all chosen discs +disjoint while retaining their original boundary parameters. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The simultaneous geometric preparation of the target discs +for XII (4.5), page 253. -/ +theorem exists_region_contact_family + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {ι : Type*} [Nontrivial ι] + (r N : ι → Set S) (Z : Set S) + (hr : ∀ i, IsOpenDisc (r i)) + (hrr : Pairwise (fun i j => Disjoint (r i) (r j))) + (hC : ∀ i, IsOArc (frontier (r i))) + (hrZ : ∀ i, Disjoint (r i) Z) + (hbdZ : ∀ i, frontier (r i) ⊆ Z) + (hNZ : ∀ i, N i ⊆ Z) (hNb : ∀ i, N i ⊆ frontier (r i)) + (hfin : ∀ i, (N i).Finite) (hne : ∀ i, (N i).Nonempty) + (hNN : Pairwise (fun i j => Disjoint (N i) (N j))) + (φ : ∀ i, Circle ≃ₜ frontier (r i)) : + ∃ (D : ι → Set S) (q : ι → Circle → S), + (∀ i, IsClosedDisc (D i)) ∧ + Pairwise (fun i j => Disjoint (D i) (D j)) ∧ + (∀ i, D i ⊆ closure (r i) ∧ D i ∩ Z = N i ∧ N i ⊆ discBd (D i)) ∧ + (∀ i, Continuous (q i) ∧ Function.Injective (q i) ∧ range (q i) = discBd (D i)) ∧ + ∀ i w, (φ i w).val ∈ N i → q i w = (φ i w).val := by + classical + have hproper : ∀ i, closure (r i) ≠ univ := by + intro i + obtain ⟨j, hji⟩ := exists_ne i + obtain ⟨f⟩ := (hr j).2 + have hrjne : (r j).Nonempty := + ⟨(f ⟨0, by simp [OpenUnitDisc]⟩).val, + (f ⟨0, by simp [OpenUnitDisc]⟩).property⟩ + exact closure_ne_univ_of_disjoint_open_nonempty (hr j).1 hrjne (hrr hji.symm) + have hex := fun i => exists_region_contact_disc hS (hr i) (hC i) (hproper i) + (hrZ i) (hNZ i) (hNb i) (hfin i) (hne i) (φ i) + choose D q hD hDr hDZ hND hqc hqi hqr hfix using hex + refine ⟨D, q, hD, ?_, fun i => ⟨hDr i, hDZ i, hND i⟩, + fun i => ⟨hqc i, hqi i, hqr i⟩, hfix⟩ + intro i j hij + exact contact_discs_disjoint_of_regions_disjoint (hr i).1 (hrr hij) (hbdZ i) + (hDr i) (hDr j) (hDZ i) (hDZ j) (hNN hij) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4RegionContactSeparation.lean b/LeanPool/GraphMinor/GM12/Section4RegionContactSeparation.lean new file mode 100644 index 0000000000..b323e2c5b6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4RegionContactSeparation.lean @@ -0,0 +1,56 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs + +/-! +# Separation of contact discs in distinct regions + +For XII (4.5), page 253, two contact discs in distinct regions +can meet only in their marked boundary sets. Disjoint marked +sets therefore give disjoint discs. A second nonempty open +region also ensures that the first region is not dense. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Another nonempty open region prevents a region from being +dense. This is the properness condition used to close eye regions. -/ +theorem closure_ne_univ_of_disjoint_open_nonempty + {S : Type*} [TopologicalSpace S] {r s : Set S} + (hs : IsOpen s) (hne : s.Nonempty) (hrs : Disjoint r s) : + closure r ≠ univ := by + intro heq + obtain ⟨x, hx⟩ := hne + exact disjoint_left.mp (hrs.closure_left hs) (heq.symm ▸ mem_univ x) hx + +/-- Contact discs lying in closures of disjoint regions are +disjoint when their boundary contact sets are disjoint. -/ +theorem contact_discs_disjoint_of_regions_disjoint + {S : Type*} [TopologicalSpace S] {r s Z D E N M : Set S} + (hr : IsOpen r) (hrs : Disjoint r s) (hbd : frontier r ⊆ Z) + (hD : D ⊆ closure r) (hE : E ⊆ closure s) + (hDN : D ∩ Z = N) (hEM : E ∩ Z = M) (hNM : Disjoint N M) : + Disjoint D E := by + apply disjoint_left.mpr + intro x hxD hxE + have hxr : x ∉ r := fun hx => + disjoint_left.mp (hrs.closure_right hr) hx (hE hxE) + have hxf : x ∈ frontier r := by + rw [frontier, hr.interior_eq] + exact ⟨hD hxD, hxr⟩ + have hxZ := hbd hxf + exact disjoint_left.mp hNM (hDN.subset ⟨hxD, hxZ⟩) (hEM.subset ⟨hxE, hxZ⟩) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4RegionFrontier.lean b/LeanPool/GraphMinor/GM12/Section4RegionFrontier.lean new file mode 100644 index 0000000000..d86e69124e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4RegionFrontier.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM12.Section4ArcComplement +import LeanPool.GraphMinor.GM12.Section4CircleSubsetArc +import LeanPool.GraphMinor.GM11.CircuitRegions +import LeanPool.GraphMinor.Surface.HoleDisc +import LeanPool.GraphMinor.GM11.PlaneFacts +import Mathlib.Topology.Connected.Clopen + +/-! +# The frontier of a region closure + +In XII (4.5), page 253, the eye regions have simple closed +boundaries. A non-dense such region has the same boundary as +its closure. Otherwise a proper compact part of the boundary +would separate the surface, whereas it lies in an arc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A proper closed set with a circle as a possible boundary +has the whole circle as its frontier, provided both sides +have points outside that circle. -/ +theorem frontier_eq_circle_of_two_sides + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {X C : Set S} + (hX : IsClosed X) + (hC : IsOArc C) (hsub : frontier X ⊆ C) + (hCX : C ⊆ X) (hin : (X \ C).Nonempty) (hout : X ≠ univ) : + frontier X = C := by + let : CompactSpace S := hS.1 + have hXC : IsCompact (frontier X) := isClosed_frontier.isCompact + apply Subset.antisymm hsub + intro p hp + by_contra hpF + have hne : (frontier X).Nonempty := nonempty_frontier_iff.mpr + ⟨hin.mono sdiff_subset, hout⟩ + obtain ⟨L, a, b, hL, hFL, hLC⟩ := + exists_arc_containing_nonempty_compact_circle_subset hC hXC hsub hne hp hpF + have hdis : Disjoint Lᶜ (frontier X) := disjoint_left.mpr + (fun z hz hzf => hz (hFL hzf)) + rcases GM11.subset_or_disjoint_of_frontier hX + (isPreconnected_compl_of_arc hS hL) hdis with h | h + · have he : Xᶜ.Nonempty := nonempty_compl.mpr hout + obtain ⟨z, hz⟩ := he + exact hz (h (fun hzL => hz (hCX (hLC hzL)))) + · obtain ⟨z, hzX, hzC⟩ := hin + exact disjoint_left.mp h (fun hzL => hzC (hLC hzL)) hzX + +/-- A non-dense open disc with a simple closed frontier has +closed-disc closure. This supplies the region discs used in +XII (4.5), page 253. -/ +theorem closedDisc_closure_of_nondense_openDisc + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {r : Set S} (hr : IsOpenDisc r) + (hC : IsOArc (frontier r)) + (hproper : closure r ≠ univ) : + IsClosedDisc (closure r) ∧ discBd (closure r) = frontier r := by + have hrne : r.Nonempty := by + obtain ⟨f⟩ := hr.2 + exact ⟨(f ⟨0, by simp [OpenUnitDisc]⟩).val, + (f ⟨0, by simp [OpenUnitDisc]⟩).property⟩ + have hfr : frontier (closure r) = frontier r := by + apply frontier_eq_circle_of_two_sides hS isClosed_closure hC + frontier_closure_subset frontier_subset_closure + · obtain ⟨x, hx⟩ := hrne + refine ⟨x, subset_closure hx, ?_⟩ + intro hxf + exact hxf.2 (hr.1.interior_eq.symm ▸ hx) + · exact hproper + have hdiff : closure r \ r = frontier r := by + rw [frontier, hr.1.interior_eq] + have hbd : Disjoint (closure r) (bd S) := by + apply disjoint_left.mpr + intro x hx hxb + exact hxb (hS.2.2 x) + have hout : ∀ x ∈ closure r \ r, x ∈ closure (closure r)ᶜ := by + intro x hx + have hxf : x ∈ frontier (closure r) := hfr.symm ▸ (hdiff ▸ hx) + rw [frontier_eq_closure_inter_closure] at hxf + exact hxf.2 + simpa only [hdiff] using closure_disc (Surface.IsClosedSurface.isSurface hS) hr hbd + (hdiff ▸ hC) hout + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ResidualArc.lean b/LeanPool/GraphMinor/GM12/Section4ResidualArc.lean new file mode 100644 index 0000000000..96b12ee6e2 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ResidualArc.lean @@ -0,0 +1,106 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.GM11.LeafNbhd +import Mathlib.Topology.Order.Compact + +/-! +# Residual edge arcs outside the vertex discs + +In XII (4.3), claim (7), page 251, remove the vertex discs +from the drawing and retain an arc for each edge. On the edge +parameter interval, take its last visit to the first closed disc, +then its first visit to the second disc after that. The retained +subarc meets each disc exactly at its corresponding end. Limits +from the intervening interval put these ends on the disc frontiers. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The residual-arc step of XII (4.3), claim (7), page 251. +An arc joining disjoint closed sets has a subarc outside both +sets except for its two frontier ends. -/ +theorem exists_residual_arc_between_closed_sets + {S : Type*} [TopologicalSpace S] + {a : unitInterval → S} (ha : IsArcMap a) {D E : Set S} + (hD : IsClosed D) (hE : IsClosed E) (hDE : Disjoint D E) + (haD : a 0 ∈ D) (haE : a 1 ∈ E) : + ∃ b : unitInterval → S, IsArcMap b ∧ range b ⊆ range a ∧ + b 0 ∈ frontier D ∧ b 1 ∈ frontier E ∧ + range b ∩ D = {b 0} ∧ range b ∩ E = {b 1} := by + let A : Set unitInterval := a ⁻¹' D + have hAc : IsCompact A := (hD.preimage ha.1).isCompact + have hAne : A.Nonempty := ⟨0, haD⟩ + let t : unitInterval := sSup A + have ht : IsGreatest A t := hAc.isGreatest_sSup hAne + have htD : a t ∈ D := ht.1 + have htne : t ≠ 1 := by + intro heq + exact Set.disjoint_left.mp hDE htD (heq ▸ haE) + have ht1 : t < 1 := lt_of_le_of_ne (unitInterval.le_one t) htne + let F : Set unitInterval := Ici t ∩ a ⁻¹' E + have hFc : IsCompact F := (isClosed_Ici.inter (hE.preimage ha.1)).isCompact + have hFne : F.Nonempty := ⟨1, unitInterval.le_one t, haE⟩ + let s : unitInterval := sInf F + have hs : IsLeast F s := hFc.isLeast_sInf hFne + have hsE : a s ∈ E := hs.1.2 + have htsne : t ≠ s := by + intro heq + exact Set.disjoint_left.mp hDE htD (heq ▸ hsE) + have hts : t < s := lt_of_le_of_ne hs.1.1 htsne + have htout : a t ∈ closure Dᶜ := by + have htcl : t ∈ closure (Ioi t) := by + rw [closure_Ioi' (a := t) ⟨(1 : unitInterval), ht1⟩] + exact le_rfl + apply map_mem_closure ha.1 htcl + intro z hz hzD + exact (not_le_of_gt hz) (ht.2 hzD) + have hsout : a s ∈ closure Eᶜ := by + have hscl : s ∈ closure (Ioo t s) := by + rw [closure_Ioo htsne] + exact ⟨hts.le, le_rfl⟩ + apply map_mem_closure ha.1 hscl + intro z hz hzE + exact (not_le_of_gt hz.2) (hs.2 ⟨hz.1.le, hzE⟩) + have htbd : a t ∈ frontier D := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure htD, htout⟩ + have hsbd : a s ∈ frontier E := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure hsE, hsout⟩ + obtain ⟨ρ, hρc, hρi, hρr, hρ0, hρ1⟩ := exists_reparam hts + let b : unitInterval → S := a ∘ ρ + have hb0 : b 0 = a t := congrArg a hρ0 + have hb1 : b 1 = a s := congrArg a hρ1 + have hρmem : ∀ z, ρ z ∈ Icc t s := fun z => hρr ▸ mem_range_self z + refine ⟨b, ⟨ha.1.comp hρc, ha.2.comp hρi⟩, ?_, hb0 ▸ htbd, hb1 ▸ hsbd, ?_, ?_⟩ + · rintro _ ⟨z, rfl⟩ + exact mem_range_self (ρ z) + · apply Set.Subset.antisymm + · rintro _ ⟨⟨z, rfl⟩, hzD⟩ + have hzt : ρ z = t := le_antisymm (ht.2 hzD) (hρmem z).1 + exact Set.mem_singleton_iff.mpr ((congrArg a hzt).trans hb0.symm) + · intro x hx + have hxb := Set.mem_singleton_iff.mp hx + exact hxb ▸ ⟨mem_range_self 0, hb0 ▸ htD⟩ + · apply Set.Subset.antisymm + · rintro _ ⟨⟨z, rfl⟩, hzE⟩ + have hzs : ρ z = s := le_antisymm (hρmem z).2 (hs.2 ⟨(hρmem z).1, hzE⟩) + exact Set.mem_singleton_iff.mpr ((congrArg a hzs).trans hb1.symm) + · intro x hx + have hxb := Set.mem_singleton_iff.mp hx + exact hxb ▸ ⟨mem_range_self 1, hb1 ▸ hsE⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ResidualStarDiscs.lean b/LeanPool/GraphMinor/GM12/Section4ResidualStarDiscs.lean new file mode 100644 index 0000000000..b88e454369 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ResidualStarDiscs.lean @@ -0,0 +1,136 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4JoinedStarFamily +public import LeanPool.GraphMinor.GM12.Section4DisjointArcDiscs +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Vertex discs from disjoint residual edge halves + +For XII (4.5), claim (1), page 253, each residual edge half +joins its vertex disc to a crossing disc. Thicken the disjoint +residual arcs to disjoint arm discs, preserving their two +endpoint contacts. Join the arms with the same vertex owner. +The resulting vertex discs meet the crossing discs exactly in +the assigned endpoint classes. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Disjoint residual arcs from vertex discs to a closed set +produce disjoint vertex discs with exactly their assigned +endpoint classes as contacts. This is the source feasibility +assembly of XII (4.5), claim (1), page 253. -/ +theorem exists_residual_star_discs {S V ι : Type} [TopologicalSpace S] + [T2Space S] [NormalSpace S] [ConnectedSpace S] [Finite V] [Finite ι] + (hS : IsClosedSurface S) (A : V → Set S) (owner : ι → V) + (a : ι → unitInterval → S) (Z : Set S) + (hA : ∀ v, IsClosedDisc (A v)) + (hAA : ∀ v w, v ≠ w → Disjoint (A v) (A w)) + (hZ : IsClosed Z) (hAZ : ∀ v, Disjoint (A v) Z) + (ha : ∀ i, IsArcMap (a i)) + (haa : ∀ i j, i ≠ j → Disjoint (range (a i)) (range (a j))) + (ha0 : ∀ i, a i 0 ∈ discBd (A (owner i))) (ha1 : ∀ i, a i 1 ∈ Z) + (hcontact : ∀ i, range (a i) ∩ (Z ∪ ⋃ v, A v) = {a i 0, a i 1}) : + ∃ D : V → Set S, (∀ v, IsClosedDisc (D v)) ∧ + (∀ v w, v ≠ w → Disjoint (D v) (D w)) ∧ + (∀ v, A v ⊆ D v) ∧ + ∀ v, D v ∩ Z = {z | ∃ i, owner i = v ∧ a i 1 = z} := by + classical + let _ := Fintype.ofFinite V + let _ := Fintype.ofFinite ι + have hC : IsClosed (Z ∪ ⋃ v, A v) := + hZ.union (isClosed_iUnion_of_finite (fun v => (hA v).isClosed)) + obtain ⟨B, hB', hBB'⟩ := exists_disjoint_arc_discs hS (finite_univ : (univ : Set ι).Finite) + a (fun i _ => ha i) (fun i _ j _ hij => haa i j hij) (Z ∪ ⋃ v, A v) hC + (fun i _ => hcontact i) + have hB := fun i => hB' i (mem_univ i) + have hBB := fun i j hij => hBB' i (mem_univ i) j (mem_univ j) hij + have hpA : ∀ i, a i 0 ∈ A (owner i) := fun i => discBd_subset _ (ha0 i) + have hpB : ∀ i, a i 0 ∈ B i := fun i => (hB i).2.2.2 (mem_range_self 0) + have hqB : ∀ i, a i 1 ∈ B i := fun i => (hB i).2.2.2 (mem_range_self 1) + have howner : ∀ i v z, z ∈ B i → z ∈ A v → owner i = v := by + intro i v z hzB hzA + have hends := (hB i).2.1.subset ⟨hzB, Or.inr (mem_iUnion.mpr ⟨v, hzA⟩)⟩ + rcases hends with hz0 | hz1 + · have hpAv : a i 0 ∈ A v := hz0 ▸ hzA + by_contra hne + exact disjoint_left.mp (hAA (owner i) v hne) (hpA i) hpAv + · have hz1' : z = a i 1 := mem_singleton_iff.mp hz1 + exact False.elim (disjoint_left.mp (hAZ v) hzA (hz1'.symm ▸ ha1 i)) + have hAB : ∀ i v, owner i = v → A v ∩ B i = {a i 0} := by + intro i v hiv + apply Subset.antisymm + · rintro z ⟨hzA, hzB⟩ + have hends := (hB i).2.1.subset ⟨hzB, Or.inr (mem_iUnion.mpr ⟨v, hzA⟩)⟩ + rcases hends with hz0 | hz1 + · exact hz0 + · have hz1' : z = a i 1 := mem_singleton_iff.mp hz1 + exact False.elim (disjoint_left.mp (hAZ v) hzA (hz1'.symm ▸ ha1 i)) + · intro z hz + have heq : z = a i 0 := mem_singleton_iff.mp hz + rw [heq] + exact ⟨hiv ▸ hpA i, hpB i⟩ + have hBZ : ∀ i, B i ∩ Z = {a i 1} := by + intro i + apply Subset.antisymm + · rintro z ⟨hzB, hzZ⟩ + have hends := (hB i).2.1.subset ⟨hzB, Or.inl hzZ⟩ + rcases hends with hz0 | hz1 + · exact False.elim (disjoint_left.mp (hAZ (owner i)) (hpA i) (hz0 ▸ hzZ)) + · exact hz1 + · intro z hz + have heq : z = a i 1 := mem_singleton_iff.mp hz + rw [heq] + exact ⟨hqB i, ha1 i⟩ + let F : V → Finset ι := fun v => Finset.univ.filter (fun i => owner i = v) + have hF : ∀ v i, i ∈ F v ↔ owner i = v := by simp [F] + have hstars : ∀ v w, v ≠ w → Disjoint (A v ∪ ⋃ i ∈ F v, B i) (A w ∪ ⋃ i ∈ F w, B i) := by + intro v w hvw + apply disjoint_left.mpr + rintro z (hzAv | hzBs) (hzAw | hzCs) + · exact disjoint_left.mp (hAA v w hvw) hzAv hzAw + · obtain ⟨j, hj, hzBj⟩ := mem_iUnion₂.mp hzCs + exact hvw ((howner j v z hzBj hzAv).symm.trans ((hF w j).mp hj)) + · obtain ⟨i, hi, hzBi⟩ := mem_iUnion₂.mp hzBs + exact hvw (((hF v i).mp hi).symm.trans (howner i w z hzBi hzAw)) + · obtain ⟨i, hi, hzBi⟩ := mem_iUnion₂.mp hzBs + obtain ⟨j, hj, hzBj⟩ := mem_iUnion₂.mp hzCs + have hij : i ≠ j := by + intro heq + exact hvw (((hF v i).mp hi).symm.trans (heq ▸ (hF w j).mp hj)) + exact disjoint_left.mp (hBB i j hij) hzBi hzBj + obtain ⟨D, hd, hdd, hsub, hDZ, -⟩ := exists_disjoint_joined_stars hS A B (fun i => a i 0) F + hA (fun _ i _ => (hB i).1) (fun _ i _ j _ hij => hBB i j hij) + (fun v i hi => hAB i v ((hF v i).mp hi)) + (fun v i hi => ((hF v i).mp hi) ▸ ha0 i) + (fun _ i _ => (hB i).2.2.1 (Or.inl rfl)) hstars Z hZ + (fun _ i _ hpZ => disjoint_left.mp (hAZ (owner i)) (hpA i) hpZ) + refine ⟨D, hd, hdd, (fun v z hz => hsub v (Or.inl hz)), ?_⟩ + intro v + rw [hDZ v] + ext z + constructor + · rintro ⟨hzK, hzZ⟩ + rcases hzK with hzA | hzBs + · exact False.elim (disjoint_left.mp (hAZ v) hzA hzZ) + · obtain ⟨i, hi, hzBi⟩ := mem_iUnion₂.mp hzBs + exact ⟨i, (hF v i).mp hi, (mem_singleton_iff.mp ((hBZ i).subset ⟨hzBi, hzZ⟩)).symm⟩ + · rintro ⟨i, hiv, hiz⟩ + rw [← hiz] + exact ⟨Or.inr (mem_iUnion₂.mpr ⟨i, (hF v i).mpr hiv, hqB i⟩), ha1 i⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4Separation.lean b/LeanPool/GraphMinor/GM12/Section4Separation.lean new file mode 100644 index 0000000000..9fd4d3866e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4Separation.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Putting a path into a small side + +At the start of Graph Minors XII, (4.1), page 248, the path has all its +vertices in the small side, but some of its edges may be on the other side. +Move those edges to the small side. Its vertex set and the separator stay +the same, and Graph Minors X, (2.9), keeps the separation in the tangle. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Hypergraph GM10 + +/-- Move a subhypergraph whose vertices already lie in the left side into +that side. This is the separation adjustment at the start of XII (4.1). -/ +theorem separation_move_subhypergraph {α β : Type*} {G A B H : Hypergraph α β} + (hs : G.IsSeparation A B) (hH : H ≤ G) (hV : H.vertexSet ⊆ A.vertexSet) : + G.IsSeparation (A ∪ H) (B.deleteEdges H.edgeSet) ∧ + (A ∪ H).vertexSet = A.vertexSet ∧ + separationOrder (A ∪ H) (B.deleteEdges H.edgeSet) = separationOrder A B := by + have hVA : (A ∪ H).vertexSet = A.vertexSet := by + rw [union_vertexSet, Set.union_eq_left.mpr hV] + refine ⟨?_, hVA, ?_⟩ + · apply (isSeparation_iff_of_le (union_le hs.left_le hH) + ((deleteEdges_le B H.edgeSet).trans hs.right_le)).mpr + refine ⟨?_, ?_, ?_⟩ + · change (A ∪ H).vertexSet ∪ B.vertexSet = G.vertexSet + rw [hVA, hs.vertexSet_union] + · ext e + change (e ∈ A.edgeSet ∨ e ∈ H.edgeSet) ∨ + (e ∈ B.edgeSet ∧ e ∉ H.edgeSet) ↔ e ∈ G.edgeSet + constructor + · rintro ((he | he) | ⟨he, _⟩) + · exact hs.left_le.edgeSet_subset he + · exact hH.edgeSet_subset he + · exact hs.right_le.edgeSet_subset he + · intro he + by_cases heH : e ∈ H.edgeSet + · exact Or.inl (Or.inr heH) + · have heAB : e ∈ A.edgeSet ∪ B.edgeSet := hs.edgeSet_union.symm ▸ he + exact heAB.elim (fun h => Or.inl (Or.inl h)) (fun h => Or.inr ⟨h, heH⟩) + · apply Set.eq_empty_iff_forall_notMem.mpr + rintro e ⟨heA | heH, heB, heH'⟩ + · exact hs.notMem_edgeSet_right heA heB + · exact heH' heH + · change ((A ∪ H).vertexSet ∩ B.vertexSet).ncard = _ + rw [hVA] + rfl + +/-- Graph Minors X, (2.9), applied as in XII (4.1), page 248: moving the +path edges leaves the separator unchanged and preserves tangle membership. -/ +theorem tangle_move_subhypergraph {α β : Type*} {G A B H : Hypergraph α β} + {θ : ℕ} {T : Set (Hypergraph α β × Hypergraph α β)} + (hT : IsTangle G θ T) (hAB : (A, B) ∈ T) (hH : H ≤ G) + (hV : H.vertexSet ⊆ A.vertexSet) : + (A ∪ H, B.deleteEdges H.edgeSet) ∈ T ∧ + separationOrder (A ∪ H) (B.deleteEdges H.edgeSet) = separationOrder A B := by + obtain ⟨hs, _, ho⟩ := separation_move_subhypergraph (hT.isSeparation hAB) hH hV + refine ⟨GraphMinor.GM10.theorem_2_9_proof hT hAB hs ?_ (Or.inl subset_rfl), ho⟩ + rw [ho] + exact hT.order_lt hAB + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ShortestChain.lean b/LeanPool/GraphMinor/GM12/Section4ShortestChain.lean new file mode 100644 index 0000000000..15c4714c78 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ShortestChain.lean @@ -0,0 +1,72 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Data.Set.Basic +public import Mathlib.Logic.Relation +import Mathlib.Combinatorics.SimpleGraph.Metric + +/-! +# Choosing a chain with no shortcuts + +Graph Minors XII, proof of (4.1), page 248, chooses a chain of circuit +insides whose nonconsecutive members are disjoint. Take a shortest chain +in the intersection graph. An intersection between nonconsecutive members +would replace at least two steps by one, contradicting shortest length. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set SimpleGraph + +/-- The shortest-chain choice in XII (4.1), page 248. The endpoints are +preserved, consecutive sets meet, and nonconsecutive sets are disjoint. -/ +theorem exists_irredundant_intersection_chain {α ι : Type*} (C : ι → Set α) + {a b : ι} (h : Relation.ReflTransGen (fun i j => (C i ∩ C j).Nonempty) a b) : + ∃ (n : ℕ) (f : Fin (n + 1) → ι), f 0 = a ∧ f (Fin.last n) = b ∧ + (∀ i : Fin n, (C (f i.castSucc) ∩ C (f i.succ)).Nonempty) ∧ + ∀ i j, i.val + 1 < j.val → Disjoint (C (f i)) (C (f j)) := by + classical + let G : SimpleGraph ι := { + Adj := fun i j => i ≠ j ∧ (C i ∩ C j).Nonempty + symm := ⟨fun {_ _} h => ⟨h.1.symm, h.2.imp (fun _ hx => hx.symm)⟩⟩ + loopless := ⟨fun _ h => h.1 rfl⟩ } + have hr : G.Reachable a b := by + induction h with + | refl => exact .refl _ + | @tail c d h hcd ih => + by_cases heq : c = d + · subst d + exact ih + · exact ih.trans (SimpleGraph.Adj.reachable (G := G) ⟨heq, hcd⟩) + obtain ⟨p, hpPath, hp⟩ := hr.exists_path_of_dist + refine ⟨p.length, fun i => p.getVert i.val, ?_, ?_, ?_, ?_⟩ + · exact p.getVert_zero + · exact p.getVert_length + · intro i + exact (p.adj_getVert_succ i.isLt).2 + · intro i j hij + apply Set.disjoint_left.mpr + intro x hxi hxj + have hi : i.val ≤ p.length := Nat.le_of_lt_succ i.isLt + have hj : j.val ≤ p.length := Nat.le_of_lt_succ j.isLt + have hne : p.getVert i.val ≠ p.getVert j.val := by + intro heq + have heq' := hpPath.getVert_injOn hi hj heq + omega + have hadj : G.Adj (p.getVert i.val) (p.getVert j.val) := ⟨hne, ⟨x, hxi, hxj⟩⟩ + have hshort := SimpleGraph.dist_le ((p.take i.val).append (hadj.toWalk.append (p.drop j.val))) + simp only [Walk.length_append, SimpleGraph.Adj.length_toWalk, Walk.take_length, + Walk.drop_length, + Nat.min_eq_left hi] at hshort + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SingletonDiscs.lean b/LeanPool/GraphMinor/GM12/Section4SingletonDiscs.lean new file mode 100644 index 0000000000..17f3f0d2dd --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SingletonDiscs.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CrossCut +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM12.Section4VertexRegion +import LeanPool.GraphMinor.GM12.Section4NormalArcDisc +import LeanPool.GraphMinor.Surface.Wedge + +/-! +# Small empty discs at selected vertices + +In XII (4.4), page 251, put a small disc at each selected vertex +that meets the drawing only there. Leave the vertex through a +region inside an assigned open neighborhood and thicken that arc. +Forbid the drawing and the complement of the neighborhood. Distinct +selected vertices have disjoint open neighborhoods, so their discs +can be chosen simultaneously disjoint. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A disc inside an assigned open neighborhood meeting the drawing +at exactly one chosen boundary vertex. -/ +theorem exists_single_vertex_disc_in_open + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) {v : S} (hv : v ∈ Γ.V) + {U : Set S} (hU : IsOpen U) (hvU : v ∈ U) : + ∃ D, IsClosedDisc D ∧ D ⊆ U ∧ Γ.U ∩ D = {v} ∧ v ∈ discBd D := by + obtain ⟨a, ha, ha0, ha1, haU, haΓ⟩ := exists_normal_arc_from_vertex_in_open hS Γ hv hU hvU + let B := Γ.U ∪ Uᶜ ∪ {a 1} + have hB : IsClosed B := (Γ.isClosed_U.union hU.isClosed_compl).union isClosed_singleton + have hmeet : range a ∩ B ⊆ {a 0, a 1} := by + rintro x ⟨hxa, hxB⟩ + rcases hxB with (hxΓ | hxU) | hx1 + · have hxv := Set.mem_singleton_iff.mp (haΓ.subset ⟨hxa, hxΓ⟩) + exact Or.inl (hxv.trans ha0.symm) + · exact False.elim (hxU (haU hxa)) + · exact Or.inr hx1 + obtain ⟨D, hD, hDB, hbd, _⟩ := exists_normal_arc_disc hS ha hB + (Or.inl (Or.inl (ha0.symm ▸ Γ.V_subset_U hv))) (Or.inr (by simp)) hmeet + refine ⟨D, hD, ?_, ?_, ha0 ▸ hbd (Or.inl rfl)⟩ + · intro x hxD + by_contra hxU + have hends := hDB.subset ⟨hxD, Or.inl (Or.inr hxU)⟩ + rcases hends with hx0 | hx1 + · exact hxU (hx0 ▸ haU (mem_range_self 0)) + · exact hxU ((Set.mem_singleton_iff.mp hx1) ▸ haU (mem_range_self 1)) + · apply Set.Subset.antisymm + · rintro x ⟨hxΓ, hxD⟩ + have hends := hDB.subset ⟨hxD, Or.inl (Or.inl hxΓ)⟩ + rcases hends with hx0 | hx1 + · exact Set.mem_singleton_iff.mpr (hx0.trans ha0) + · exact False.elim (ha1 ((Set.mem_singleton_iff.mp hx1) ▸ hxΓ)) + · rintro x rfl + exact ⟨Γ.V_subset_U hv, discBd_subset D (ha0 ▸ hbd (Or.inl rfl))⟩ + +/-- The mutually disjoint empty discs chosen in XII (4.4), page +251, with their exact boundary vertex sets. -/ +theorem exists_disjoint_single_vertex_discs + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) {t : ℕ} (z : Fin t → S) + (hz : ∀ i, z i ∈ Γ.V) (hinj : Function.Injective z) : + ∃ Δ : Fin t → Set S, + (∀ i, IsClosedDisc (Δ i) ∧ Γ.U ∩ Δ i = {z i} ∧ + z i ∈ discBd (Δ i) ∧ Γ.V ∩ discBd (Δ i) = {z i}) ∧ + ∀ i j, i ≠ j → Disjoint (Δ i) (Δ j) := by + obtain ⟨U, hU, hUdisj⟩ := (Set.finite_range z).t2_separation + have hex : ∀ i, ∃ D, IsClosedDisc D ∧ D ⊆ U (z i) ∧ + Γ.U ∩ D = {z i} ∧ z i ∈ discBd D := + fun i => exists_single_vertex_disc_in_open hS Γ (hz i) (hU (z i)).2 (hU (z i)).1 + choose Δ hΔ hsub hmeet hbd using hex + refine ⟨Δ, ?_, ?_⟩ + · intro i + refine ⟨hΔ i, hmeet i, hbd i, ?_⟩ + apply Set.Subset.antisymm + · intro x hx + exact (hmeet i).subset ⟨Γ.V_subset_U hx.1, discBd_subset _ hx.2⟩ + · rintro x rfl + exact ⟨hz i, hbd i⟩ + · intro i j hij + exact (hUdisj (mem_range_self i) (mem_range_self j) (fun h => hij (hinj h))).mono (hsub i) + (hsub j) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SingletonFeasibility.lean b/LeanPool/GraphMinor/GM12/Section4SingletonFeasibility.lean new file mode 100644 index 0000000000..a00c7a1bbd --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SingletonFeasibility.lean @@ -0,0 +1,151 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM12.Section4DisjointDiscs +import LeanPool.GraphMinor.GM12.Section4DiscTangency +import LeanPool.GraphMinor.GM12.Section4MarkedDiscMatch +import LeanPool.GraphMinor.Surface.Wedge + +/-! +# Topological feasibility of singleton prescriptions + +XII (4.4), page 251, says that topological feasibility holds when +each prescribed disc has one marked boundary point. Start with +one disjoint connecting disc for each class. Attach a new contact +disc at a fresh boundary point of its assigned connecting disc. +Match it to the next prescribed disc while fixing all prescriptions +already placed. Carry the connecting discs through this motion. +Their contact equations are preserved, and the new equation is +exactly the required singleton contact. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The singleton topological feasibility assertion in XII (4.4), +page 251, for any assignment of prescribed points to classes. -/ +theorem topologicallyFeasible_singleton_prescriptions + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {p t : ℕ} (Δ : Fin t → Set S) + (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hdisj : ∀ i j, i ≠ j → Disjoint (Δ i) (Δ j)) + (z : Fin t → S) (hz : ∀ i, z i ∈ discBd (Δ i)) (κ : Fin t → Fin p) : + IsTopologicallyFeasible Δ (fun v => z '' {i | κ i = v}) := by + classical + have hex : ∀ F : Set (Fin t), F.Finite → + ∃ D : Fin p → Set S, (∀ v, IsClosedDisc (D v)) ∧ + (∀ v w, v ≠ w → Disjoint (D v) (D w)) ∧ + ∀ v i, i ∈ F → D v ∩ Δ i = if κ i = v then {z i} else ∅ := by + intro F hF + induction F, hF using Set.Finite.induction_on with + | empty => + obtain ⟨D, hD, hDD⟩ := exists_finite_disjoint_closed_discs hS p + exact ⟨D, hD, hDD, by simp⟩ + | @insert i F hi hF ih => + obtain ⟨D, hD, hDD, hcontact⟩ := ih + let v := κ i + obtain ⟨x, hxBd, hxold⟩ := + ((infinite_oArc (hD v).isOArc_discBd).sdiff (hF.image z)).nonempty + let Z := (⋃ w : {w : Fin p // w ≠ v}, D w.val) ∪ ⋃ j ∈ F, Δ j + have hZ : IsClosed Z := + (isClosed_iUnion_of_finite fun w : {w : Fin p // w ≠ v} => (hD w.val).isClosed).union + (hF.isClosed_biUnion fun j _ => (hΔ j).isClosed) + have hxZ : x ∉ Z := by + intro hx + rcases hx with hxother | hxprior + · obtain ⟨w, hxw⟩ := mem_iUnion.mp hxother + exact Set.disjoint_left.mp (hDD v w.val w.property.symm) + (discBd_subset _ hxBd) hxw + · obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.mp hxprior + have hc := (hcontact v j hj).subset ⟨discBd_subset _ hxBd, hxj⟩ + by_cases hκ : κ j = v + · rw [ite_eq_left hκ] at hc + exact hxold ⟨j, hj, (Set.mem_singleton_iff.mp hc).symm⟩ + · rw [ite_eq_right hκ] at hc + exact hc.elim + obtain ⟨Q, q, hQ, hQD, hQZ, hxq, hQbd⟩ := + exists_disc_touching_boundary_point hS (hD v) hZ hxBd hxZ + obtain ⟨q', hq'Bd, hq'ne⟩ := + ((infinite_oArc (hΔ i).isOArc_discBd).sdiff (finite_singleton (z i))).nonempty + let P : F → Set S := fun j => Δ j.val + have hP : ∀ j, IsClosedDisc (P j) := fun j => hΔ j.val + have hPP : Pairwise (fun j k => Disjoint (P j) (P k)) := + fun j k hjk => hdisj j.val k.val (fun h => hjk (Subtype.ext h)) + have hQP : Disjoint Q (⋃ j : F, P j) := + hQZ.mono_right (by + intro a ha + obtain ⟨j, hj⟩ := mem_iUnion.mp ha + exact Or.inr (mem_iUnion₂.mpr ⟨j.val, j.property, hj⟩)) + have hΔP : Disjoint (Δ i) (⋃ j : F, P j) := by + apply Set.disjoint_left.mpr + intro a hai haP + obtain ⟨j, haj⟩ := mem_iUnion.mp haP + exact Set.disjoint_left.mp (hdisj i j.val (fun hij => hi (hij ▸ j.property))) hai haj + obtain ⟨e, heQ, hex, heq, hefix⟩ := exists_marked_disc_match_fixing_discs + hS P hP hPP hQ (hΔ i) hQP hΔP (hQbd (by simp)) (hQbd (by simp)) hxq + (hz i) hq'Bd (fun heq => hq'ne (Set.mem_singleton_iff.mpr heq.symm)) + have heΔ : ∀ j ∈ F, e '' Δ j = Δ j := by + intro j hj + apply Set.Subset.antisymm + · rintro _ ⟨a, ha, rfl⟩ + rw [hefix ⟨j, hj⟩ a ha] + exact ha + · intro a ha + exact ⟨a, ha, hefix ⟨j, hj⟩ a ha⟩ + have hnew : ∀ w, (e '' D w) ∩ Δ i = if κ i = w then {z i} else ∅ := by + intro w + rw [← heQ, ← image_inter e.injective] + by_cases hw : w = v + · subst w + rw [inter_comm, hQD, image_singleton, hex, ite_eq_left rfl] + · have hQw : Disjoint Q (D w) := hQZ.mono_right + (fun a ha => Or.inl (mem_iUnion.mpr ⟨⟨w, hw⟩, ha⟩)) + rw [hQw.symm.inter_eq, image_empty, ite_eq_right (Ne.symm hw)] + refine ⟨fun w => e '' D w, ?_, ?_, ?_⟩ + · intro w + exact ((hD w).image e.continuous.continuousOn e.symm.continuous.continuousOn + (fun a _ => e.symm_apply_apply a)).1 + · intro w w' hww' + apply Set.disjoint_left.mpr + rintro a ⟨b, hb, hba⟩ ⟨c, hc, hca⟩ + have hbc := e.injective (hba.trans hca.symm) + exact Set.disjoint_left.mp (hDD w w' hww') hb (hbc.symm ▸ hc) + · intro w j hj + rcases hj with hji | hj + · subst j + exact hnew w + · rw [← heΔ j hj, ← image_inter e.injective, hcontact w j hj] + by_cases hκ : κ j = w + · rw [ite_eq_left hκ, image_singleton, hefix ⟨j, hj⟩ _ (discBd_subset _ (hz j))] + · rw [ite_eq_right hκ, image_empty] + obtain ⟨D, hD, hDD, hcontact⟩ := hex univ (Set.toFinite _) + refine ⟨D, hD, hDD, ?_⟩ + intro v + ext x + constructor + · rintro ⟨hxD, hxΔ⟩ + obtain ⟨i, hxi⟩ := mem_iUnion.mp hxΔ + have hc := (hcontact v i (mem_univ i)).subset ⟨hxD, hxi⟩ + by_cases hκ : κ i = v + · rw [ite_eq_left hκ] at hc + exact ⟨i, hκ, (Set.mem_singleton_iff.mp hc).symm⟩ + · rw [ite_eq_right hκ] at hc + exact hc.elim + · rintro ⟨i, hi, rfl⟩ + have hc : z i ∈ D v ∩ Δ i := by + rw [hcontact v i (mem_univ i), ite_eq_left (show κ i = v from hi)] + simp + exact ⟨hc.1, mem_iUnion.mpr ⟨i, hc.2⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SmallClique.lean b/LeanPool/GraphMinor/GM12/Section4SmallClique.lean new file mode 100644 index 0000000000..43966bbd2c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SmallClique.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM12.Section4PendantLine +import LeanPool.GraphMinor.GM09.DiscDrawing + +/-! +# Drawing the small clique targets + +The small cases in XII (4.4), page 251, follow from (4.3) because +the target clique can be drawn in the surface. For at most two +vertices, use an edgeless drawing or one line inside a surface +chart. The branch construction of (4.4) also works for three and +four vertices, since each vertex then has two other vertices. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph Surface GM09 + +/-- A two-vertex clique can be drawn along a single line in any +nonempty closed surface, for the small cases of XII (4.4). -/ +theorem exists_graphDrawing_complete_two + {S : Type*} [TopologicalSpace S] [T2Space S] [Nonempty S] + (hS : IsClosedSurface S) : Nonempty (GraphDrawing (GM16.completeGraph 2) S) := by + classical + let x : S := Classical.choice inferInstance + obtain ⟨w, K, hK, hw, _⟩ := exists_line_at_isolated_point hS + (show x ∈ ({x} : Set S) by simp) (by simp) + let ν : Fin 2 → S := fun v => if v = 0 then x else w + have hν0 : ν 0 = x := by simp [ν] + have hν1 : ν 1 = w := by simp [ν] + have hV : (GM16.completeGraph 2).vertexSet = ({0, 1} : Set (Fin 2)) := by + ext v + fin_cases v <;> simp [GM16.completeGraph, GraphMinor.completeGraph] + have hE : (GM16.completeGraph 2).edgeSet = {s(0, 1)} := by + ext e + constructor + · rintro ⟨i, j, hij, rfl⟩ + fin_cases i <;> fin_cases j <;> simp_all [Sym2.eq_swap] + · intro he + have heq := Set.mem_singleton_iff.mp he + subst e + exact ⟨0, 1, by decide, rfl⟩ + have hlink : (GM16.completeGraph 2).IsLink s(0, 1) 0 1 := ⟨by decide, rfl⟩ + have hνne : ν 0 ≠ ν 1 := by + rw [hν0, hν1] + intro heq + exact hw (Set.mem_singleton_iff.mpr heq.symm) + have hKν : IsLineWithEnds K (ν 0) (ν 1) := by rwa [hν0, hν1] + obtain ⟨D, _, _⟩ := GraphDrawing.of_single_edge hV hE hlink hνne hKν + exact ⟨D⟩ + +/-- The drawable targets needed for the cases with fewer than three +clique vertices in XII (4.4). -/ +theorem exists_graphDrawing_complete_of_le_two + {S : Type*} [TopologicalSpace S] [T2Space S] [Nonempty S] + (hS : IsClosedSurface S) {p : ℕ} (hp : p ≤ 2) : + Nonempty (GraphDrawing (GM16.completeGraph p) S) := by + classical + interval_cases p + · have hE : (GM16.completeGraph 0).edgeSet = ∅ := by + ext e + constructor + · rintro ⟨v, _, _⟩ + exact Fin.elim0 v + · exact fun h => h.elim + obtain ⟨D, _, _⟩ := GraphDrawing.of_edgeless (G := GM16.completeGraph 0) (Set.toFinite _) hE + (ν := fun _ => Classical.choice ‹Nonempty S›) (fun _ _ _ _ _ => Subsingleton.elim _ _) + exact ⟨D⟩ + · have hE : (GM16.completeGraph 1).edgeSet = ∅ := by + ext e + constructor + · rintro ⟨v, w, hvw, _⟩ + exact False.elim (hvw (Subsingleton.elim _ _)) + · exact fun h => h.elim + obtain ⟨D, _, _⟩ := GraphDrawing.of_edgeless (G := GM16.completeGraph 1) (Set.toFinite _) hE + (ν := fun _ => Classical.choice ‹Nonempty S›) (fun _ _ _ _ _ => Subsingleton.elim _ _) + exact ⟨D⟩ + · exact exists_graphDrawing_complete_two hS + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SmallCrossDiscs.lean b/LeanPool/GraphMinor/GM12/Section4SmallCrossDiscs.lean new file mode 100644 index 0000000000..a9e302448d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SmallCrossDiscs.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4DistinctCrossDirections +public import LeanPool.GraphMinor.Surface.Cap + +/-! +# Small discs in crossing coordinates + +In XII (4.5), page 253, a small disc is chosen around each +crossing. A translated real-linear coordinate change sends +small round discs to closed discs inside any prescribed open +neighborhood. Their boundaries are the images of the circles, +and the two coordinate lines map to the crossing lines. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Topology + +/-- A translated real-linear equivalence takes the line through +two points to the line through their images. -/ +theorem image_line_cross_coordinates (A : ℂ ≃L[ℝ] ℂ) (x a b : ℂ) : + (fun z => x + A z) '' (line[ℝ, a, b] : Set ℂ) = + (line[ℝ, x + A a, x + A b] : Set ℂ) := by + let f : ℂ ≃ᵃ[ℝ] ℂ := A.toLinearEquiv.toAffineEquiv.trans + (AffineEquiv.constVAdd ℝ ℂ x) + have h := congrArg (fun s : AffineSubspace ℝ ℂ => (s : Set ℂ)) + (AffineSubspace.map_span (f : ℂ →ᵃ[ℝ] ℂ) ({a, b} : Set ℂ)) + rw [AffineSubspace.coe_map, image_pair] at h + exact h + +/-- The centre lies in the interior of every positive-radius +coordinate crossing disc. This keeps crossings out of the +residual edge halves in XII (4.5), page 253. -/ +theorem cross_disc_center_mem_interior (A : ℂ ≃L[ℝ] ℂ) (x : ℂ) + {r : ℝ} (hr : 0 < r) : + x ∈ interior ((fun z => x + A z) '' closedBall 0 r) := by + let h : ℂ ≃ₜ ℂ := A.toHomeomorph.trans (Homeomorph.addLeft x) + have h0 : h 0 = x := by simp [h] + apply mem_interior.mpr + refine ⟨h '' ball 0 r, image_mono ball_subset_closedBall, h.isOpenMap _ isOpen_ball, ?_⟩ + exact ⟨0, mem_ball_self hr, h0⟩ + +/-- Crossing coordinates give arbitrarily small closed discs, +with the expected boundary circle. The neighborhood is any +open set containing the crossing, so finitely many such choices +can be made within disjoint neighborhoods. -/ +theorem exists_small_cross_disc (A : ℂ ≃L[ℝ] ℂ) (x : ℂ) + {U : Set ℂ} (hU : IsOpen U) (hx : x ∈ U) : + ∃ r : ℝ, 0 < r ∧ + Surface.IsClosedDisc ((fun z => x + A z) '' closedBall 0 r) ∧ + Surface.discBd ((fun z => x + A z) '' closedBall 0 r) = + (fun z => x + A z) '' sphere 0 r ∧ + (fun z => x + A z) '' closedBall 0 r ⊆ U := by + let h : ℂ ≃ₜ ℂ := A.toHomeomorph.trans (Homeomorph.addLeft x) + have h0 : h 0 = x := by simp [h] + have hopen : IsOpen (h ⁻¹' U) := hU.preimage h.continuous + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hopen 0 (by simpa only [mem_preimage, h0] using hx) + let r := ε / 2 + have hr : 0 < r := half_pos hε + have hD : Surface.IsClosedDisc (closedBall (0 : ℂ) r) ∧ + Surface.discBd (closedBall (0 : ℂ) r) = sphere 0 r := by + have hi : interior (closedBall (0 : ℂ) r) = ball 0 r := interior_closedBall _ (ne_of_gt hr) + obtain ⟨hdisc, hbd⟩ := Surface.isClosedDisc_of_convex (convex_closedBall (0 : ℂ) r) + (by rw [hi]; exact ⟨0, mem_ball_self hr⟩) + (isBounded_closedBall) isClosed_closedBall + refine ⟨hdisc, hbd.trans ?_⟩ + exact frontier_closedBall _ (ne_of_gt hr) + obtain ⟨hd, hb⟩ := hD.1.image h.continuous.continuousOn h.symm.continuous.continuousOn + (fun z _ => h.symm_apply_apply z) + refine ⟨r, hr, hd, ?_, ?_⟩ + · exact hb.trans (congrArg (fun s : Set ℂ => h '' s) hD.2) + · rintro _ ⟨z, hz, rfl⟩ + apply hball + exact (closedBall_subset_ball (by dsimp [r]; exact half_lt_self hε)) hz + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SmallSurface.lean b/LeanPool/GraphMinor/GM12/Section4SmallSurface.lean new file mode 100644 index 0000000000..1d75557d35 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SmallSurface.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import Mathlib.Logic.Small.Basic +import Mathlib.Data.Fintype.EquivFin + +/-! +# Reducing the universe of a closed surface + +The disc constructions used for XII (4.5) may be applied on a +small copy of the surface. A compact surface has a finite cover +by charts, and each chart is homeomorphic to the open unit disc. +Thus a finite disjoint union of small chart domains maps onto +the whole surface. This proves that the surface has a small +copy, without adding a size hypothesis to the theorem. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A closed surface has a copy in the lowest type universe: +compactness gives finitely many small chart domains covering +it. This permits the finite disc constructions for XII (4.5) +to be transported across universes. -/ +theorem small_of_isClosedSurface {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) : Small.{0} S := by + classical + let : CompactSpace S := hS.1 + choose U hU hx he using hS.2.2 + have hcover : (univ : Set S) ⊆ ⋃ x, U x := fun x _ => mem_iUnion.mpr ⟨x, hx x⟩ + obtain ⟨F, hF⟩ := isCompact_univ.elim_finite_subcover U hU hcover + let I := {x : S // x ∈ F} + let : Fintype I := Fintype.ofFinite I + let : Small.{0} I := small_of_injective (Fintype.equivFin I).injective + let : ∀ i : I, Small.{0} ↥(U i.val) := fun i => + small_of_injective (Classical.choice (he i.val)).injective + apply small_of_surjective (f := fun p : Σ i : I, U i.val => p.2.val) + intro y + obtain ⟨x, hxF, hyU⟩ := mem_iUnion₂.mp (hF (mem_univ y)) + exact ⟨⟨⟨x, hxF⟩, ⟨y, hyU⟩⟩, rfl⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SmallSurfaceCopy.lean b/LeanPool/GraphMinor/GM12/Section4SmallSurfaceCopy.lean new file mode 100644 index 0000000000..4c80b9e167 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SmallSurfaceCopy.lean @@ -0,0 +1,54 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SmallSurface +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import Mathlib.Topology.Homeomorph.Lemmas + +/-! +# A homeomorphic small copy of the surface + +The geometric construction of XII (4.5) can be performed on +a small copy of the surface and carried back by a homeomorphism. +The finite chart cover proves that the surface is small. Put +the induced topology on its small model and transfer compactness, +Hausdorffness, and the interior charts through the equivalence. +This preserves the surface hypotheses without a universe bound +in the final result. +-/ + +public section + +namespace GraphMinor.GM12 + +open Surface + +/-- Every closed surface has a homeomorphic closed-surface +copy in the lowest type universe. This permits the geometric +construction of XII (4.5) to be transported to arbitrary +surface universes. -/ +theorem exists_small_closed_surface_copy {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) : + ∃ (T : Type) (t : TopologicalSpace T), + Nonempty (@Homeomorph S T inferInstance t) ∧ @IsClosedSurface T t := by + classical + let : Small.{0} S := small_of_isClosedSurface hS + let T : Type := Shrink S + let : TopologicalSpace T := TopologicalSpace.induced (equivShrink S).symm inferInstance + let e : T ≃ₜ S := (equivShrink S).symm.toHomeomorphOfIsInducing ⟨rfl⟩ + let : CompactSpace S := hS.1 + let : T2Space S := hS.2.1 + have hc : CompactSpace T := e.symm.compactSpace + have ht2 : T2Space T := e.isEmbedding.t2Space + have hi : ∀ x : T, IsInteriorPoint x := fun x => + (isInteriorPoint_homeomorph_iff e x).mp (hS.2.2 (e x)) + exact ⟨T, inferInstance, ⟨e.symm⟩, hc, ht2, hi⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SourceDiscs.lean b/LeanPool/GraphMinor/GM12/Section4SourceDiscs.lean new file mode 100644 index 0000000000..c44f183a1c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SourceDiscs.lean @@ -0,0 +1,111 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4EndPartition +import LeanPool.GraphMinor.GM12.Section4SourceResiduals +import LeanPool.GraphMinor.GM12.Section4DisjointArcDiscs +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# A source disc system for the target drawing + +For XII (4.3), claim (7), page 251, thicken the disjoint +residual edges while forbidding all vertex discs. The edge discs +are mutually disjoint and touch the vertex discs only at their +marked ends. A marked end belongs to exactly its assigned vertex +disc, since the vertex discs are disjoint. Thus their intersections +are precisely the oriented end classes used in (3.2). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The source vertex and marked edge discs in XII (4.3), claim +(7), page 251, with their exact oriented contact classes. -/ +theorem exists_source_disc_system + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) (u v : Γ.E → Γ.V) + (hl : ∀ e, Γ.toGraph.IsLink e.val (u e).val (v e).val) + (hne : ∀ e, u e ≠ v e) : + ∃ (D : Γ.V → Set S) (Δ : Γ.E → Set S) (a b : Γ.E → S), + (∀ w, IsClosedDisc (D w)) ∧ + (∀ w z, w ≠ z → Disjoint (D w) (D z)) ∧ + (∀ e, IsClosedDisc (Δ e) ∧ a e ≠ b e ∧ ({a e, b e} : Set S) ⊆ discBd (Δ e)) ∧ + (∀ e f, e ≠ f → Disjoint (Δ e) (Δ f)) ∧ + ∀ w, D w ∩ ⋃ e, Δ e = + edgeEndClass (fun q : Γ.E × Bool => if q.2 then a q.1 else b q.1) + (fun q : Γ.E × Bool => if q.2 then u q.1 else v q.1) w := by + classical + let : Finite Γ.V := Γ.finite_V.to_subtype + let : Finite Γ.E := Γ.finite_edges.to_subtype + obtain ⟨D, c, hD, hDD, hc, hcc⟩ := exists_source_residual_arc_family hS Γ u v hl hne + let B : Set S := ⋃ w, D w + have hB : IsClosed B := isClosed_iUnion_of_finite fun w => (hD w).1.isClosed + have hcontact : ∀ e : Γ.E, range (c e) ∩ B = {c e 0, c e 1} := by + intro e + apply Set.Subset.antisymm + · rintro z ⟨hzc, hzB⟩ + obtain ⟨w, hzw⟩ := mem_iUnion.mp hzB + by_cases hwu : w = u e + · subst w + exact Or.inl (Set.mem_singleton_iff.mp ((hc e).2.2.2.2.1.subset ⟨hzc, hzw⟩)) + · by_cases hwv : w = v e + · subst w + exact Or.inr (Set.mem_singleton_iff.mpr + (Set.mem_singleton_iff.mp ((hc e).2.2.2.2.2.1.subset ⟨hzc, hzw⟩))) + · exact False.elim (Set.disjoint_left.mp ((hc e).2.2.2.2.2.2.2 w hwu hwv) hzc hzw) + · intro z hz + rcases hz with hz | hz + · exact hz ▸ ⟨mem_range_self 0, mem_iUnion.mpr ⟨u e, discBd_subset _ (hc e).2.2.1⟩⟩ + · have hz' := Set.mem_singleton_iff.mp hz + exact hz' ▸ ⟨mem_range_self 1, mem_iUnion.mpr ⟨v e, discBd_subset _ (hc e).2.2.2.1⟩⟩ + obtain ⟨Δ, hΔ, hΔΔ⟩ := exists_disjoint_arc_discs hS (toFinite (univ : Set Γ.E)) c + (fun e _ => (hc e).1) (fun e _ f _ hef => hcc e f hef) B hB (fun e _ => hcontact e) + have hΔ' := fun e => hΔ e (mem_univ e) + have hΔΔ' := fun e f hef => hΔΔ e (mem_univ e) f (mem_univ f) hef + have hend0 : ∀ e, c e 0 ∈ D (u e) := fun e => discBd_subset _ (hc e).2.2.1 + have hend1 : ∀ e, c e 1 ∈ D (v e) := fun e => discBd_subset _ (hc e).2.2.2.1 + have howner0 : ∀ e w, c e 0 ∈ D w → u e = w := by + intro e w hw + by_contra hne' + exact Set.disjoint_left.mp (hDD (u e) w hne') (hend0 e) hw + have howner1 : ∀ e w, c e 1 ∈ D w → v e = w := by + intro e w hw + by_contra hne' + exact Set.disjoint_left.mp (hDD (v e) w hne') (hend1 e) hw + refine ⟨D, Δ, (fun e => c e 0), (fun e => c e 1), fun w => (hD w).1, hDD, ?_, hΔΔ', ?_⟩ + · intro e + refine ⟨(hΔ' e).1, ?_, (hΔ' e).2.2.1⟩ + intro heq + exact (show (0 : unitInterval) ≠ 1 by norm_num) ((hc e).1.2 heq) + · intro w + apply Set.Subset.antisymm + · rintro z ⟨hzw, hzΔ⟩ + obtain ⟨e, hze⟩ := mem_iUnion.mp hzΔ + have hzends := (hΔ' e).2.1.subset ⟨hze, mem_iUnion.mpr ⟨w, hzw⟩⟩ + rcases hzends with hz0 | hz1 + · exact ⟨(e, true), howner0 e w (hz0 ▸ hzw), hz0.symm⟩ + · have hz1' := Set.mem_singleton_iff.mp hz1 + exact ⟨(e, false), howner1 e w (hz1' ▸ hzw), hz1'.symm⟩ + · rintro z ⟨⟨e, b⟩, hew, hez⟩ + cases b + · change v e = w at hew + change c e 1 = z at hez + exact hez ▸ ⟨hew ▸ hend1 e, + mem_iUnion.mpr ⟨e, (hΔ' e).2.2.2 (mem_range_self 1)⟩⟩ + · change u e = w at hew + change c e 0 = z at hez + exact hez ▸ ⟨hew ▸ hend0 e, + mem_iUnion.mpr ⟨e, (hΔ' e).2.2.2 (mem_range_self 0)⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SourceHalfEdges.lean b/LeanPool/GraphMinor/GM12/Section4SourceHalfEdges.lean new file mode 100644 index 0000000000..5cbf37898f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SourceHalfEdges.lean @@ -0,0 +1,100 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Splitting the source edges at their crossings + +In XII (4.5), claim (1), page 253, every subdivided edge has +one crossing. Split its simple arc at that point and orient +both halves from their original vertex to the crossing. Each +half contains only its own original vertex. Distinct halves +meet only at original vertices or crossing points, including +the case of the two halves of the same edge. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Splitting a source arc at its interior crossing produces +its two half-edges and retains their vertex and intersection +conditions, as used in XII (4.5), claim (1), page 253. -/ +theorem exists_source_halfedges {S V E : Type*} [TopologicalSpace S] [T2Space S] + (v : V → S) (κ : E × Bool → V) (P : E → Set S) (x : E → S) + (hP : ∀ e, IsLineWithEnds (P e) (v (κ (e, false))) (v (κ (e, true)))) + (hx : ∀ e, x e ∈ P e) (hxV : ∀ e, x e ∉ range v) + (hPV : ∀ e w, v w ∈ P e → w = κ (e, false) ∨ w = κ (e, true)) + (hPP : ∀ e f, e ≠ f → P e ∩ P f ⊆ range v ∪ range x) : + ∃ L : E × Bool → Set S, + (∀ i, IsLineWithEnds (L i) (v (κ i)) (x i.1)) ∧ + (∀ i, L i ⊆ P i.1) ∧ + (∀ i w, v w ∈ L i → w = κ i) ∧ + (∀ i j, i ≠ j → L i ∩ L j ⊆ range v ∪ range (fun q : E × Bool => x q.1)) ∧ + (∀ e, L (e, false) ∪ L (e, true) = P e) ∧ + ∀ e, L (e, false) ∩ L (e, true) = {x e} := by + classical + have hex : ∀ e, ∃ A B : Set S, + IsLineWithEnds A (v (κ (e, false))) (x e) ∧ + IsLineWithEnds B (x e) (v (κ (e, true))) ∧ A ∪ B = P e ∧ A ∩ B = {x e} := by + intro e + exact (hP e).split (hx e) + (fun h => hxV e ⟨κ (e, false), h.symm⟩) + (fun h => hxV e ⟨κ (e, true), h.symm⟩) + choose A B hA hB hcover hinter using hex + let L : E × Bool → Set S := fun i => if i.2 then B i.1 else A i.1 + have hline : ∀ i, IsLineWithEnds (L i) (v (κ i)) (x i.1) := by + rintro ⟨e, b⟩ + cases b + · exact hA e + · exact (hB e).symm + have hsub : ∀ i, L i ⊆ P i.1 := by + rintro ⟨e, b⟩ z hz + rw [← hcover e] + cases b + · exact Or.inl hz + · exact Or.inr hz + have hvertex : ∀ i w, v w ∈ L i → w = κ i := by + rintro ⟨e, b⟩ w hw + have hends := hPV e w (hsub (e, b) hw) + cases b + · rcases hends with h | h + · exact h + · have hwB : v w ∈ B e := h.symm ▸ (hB e).right_mem + have hvx : v w = x e := mem_singleton_iff.mp ((hinter e).subset ⟨hw, hwB⟩) + exact False.elim (hxV e ⟨w, hvx⟩) + · rcases hends with h | h + · have hwA : v w ∈ A e := h.symm ▸ (hA e).left_mem + have hvx : v w = x e := mem_singleton_iff.mp ((hinter e).subset ⟨hwA, hw⟩) + exact False.elim (hxV e ⟨w, hvx⟩) + · exact h + refine ⟨L, hline, hsub, hvertex, ?_, hcover, hinter⟩ + rintro ⟨e, b⟩ ⟨f, c⟩ hne z hz + by_cases hef : e = f + · subst f + have hbc : b ≠ c := fun h => hne (by subst c; rfl) + have hzx : z = x e := by + cases b <;> cases c + · exact False.elim (hbc rfl) + · exact mem_singleton_iff.mp ((hinter e).subset hz) + · exact mem_singleton_iff.mp ((hinter e).subset ⟨hz.2, hz.1⟩) + · exact False.elim (hbc rfl) + exact Or.inr ⟨(e, false), hzx.symm⟩ + · rcases hPP e f hef ⟨hsub (e, b) hz.1, hsub (f, c) hz.2⟩ with hzV | hzX + · exact Or.inl hzV + · obtain ⟨g, hg⟩ := hzX + exact Or.inr ⟨(g, false), hg⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SourceResiduals.lean b/LeanPool/GraphMinor/GM12/Section4SourceResiduals.lean new file mode 100644 index 0000000000..88379b45dc --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SourceResiduals.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.GM12.Section4VertexDiscs +import LeanPool.GraphMinor.GM12.Section4ResidualArc +import LeanPool.GraphMinor.GM11.RadialCorners +import LeanPool.GraphMinor.GM11.Section7 +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# The residual edges of the target drawing + +In XII (4.3), claim (7), page 251, small vertex discs leave +a disjoint residual arc for each edge. Choose each arc between its +last visit to its first endpoint disc and its first later visit to +the other. Nonincident vertex discs miss the whole edge. The +residual arc misses the original vertices, since its disc contacts +are frontier points while the original vertices are interior +points. Different residual arcs are therefore disjoint. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The source residual-edge system of XII (4.3), claim (7), +page 251, for a loopless target drawing with oriented ends. -/ +theorem exists_source_residual_arc_family + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (Γ : Drawing S) (u v : Γ.E → Γ.V) + (hl : ∀ e, Γ.toGraph.IsLink e.val (u e).val (v e).val) + (hne : ∀ e, u e ≠ v e) : + ∃ (D : Γ.V → Set S) (b : Γ.E → unitInterval → S), + (∀ w, IsClosedDisc (D w) ∧ w.val ∈ interior (D w)) ∧ + (∀ w z, w ≠ z → Disjoint (D w) (D z)) ∧ + (∀ e, IsArcMap (b e) ∧ range (b e) ⊆ closure e.val ∧ + b e 0 ∈ discBd (D (u e)) ∧ b e 1 ∈ discBd (D (v e)) ∧ + range (b e) ∩ D (u e) = {b e 0} ∧ range (b e) ∩ D (v e) = {b e 1} ∧ + Disjoint (range (b e)) Γ.V ∧ + ∀ w, w ≠ u e → w ≠ v e → Disjoint (range (b e)) (D w)) ∧ + (∀ e f, e ≠ f → Disjoint (range (b e)) (range (b f))) := by + classical + obtain ⟨D, hD, hDD⟩ := exists_vertex_disc_family hS Γ + have hex : ∀ e : Γ.E, ∃ b : unitInterval → S, + IsArcMap b ∧ range b ⊆ closure e.val ∧ + b 0 ∈ frontier (D (u e)) ∧ b 1 ∈ frontier (D (v e)) ∧ + range b ∩ D (u e) = {b 0} ∧ range b ∩ D (v e) = {b 1} := by + intro e + have huv : (u e).val ≠ (v e).val := fun h => hne e (Subtype.ext h) + have hline := isLine_closure e.property huv (hl e).2.2.2 + obtain ⟨a, ha, har, ha0, ha1⟩ := hline.exists_arc + obtain ⟨b, hb, hba, hb0, hb1, hbD, hbE⟩ := exists_residual_arc_between_closed_sets ha + (hD (u e)).1.isClosed (hD (v e)).1.isClosed (hDD (u e) (v e) (hne e)) + (ha0 ▸ interior_subset (hD (u e)).2.1) (ha1 ▸ interior_subset (hD (v e)).2.1) + exact ⟨b, hb, hba.trans har.subset, hb0, hb1, hbD, hbE⟩ + choose b hb hsub hb0 hb1 hbD hbE using hex + have hmissV : ∀ e, Disjoint (range (b e)) Γ.V := by + intro e + apply Set.disjoint_left.mpr + intro z hzb hzV + have hzends : z ∈ ({(u e).val, (v e).val} : Set S) := (hl e).2.2.2 ▸ ⟨hsub e hzb, hzV⟩ + rcases hzends with hzu | hzv + · have hzDu : z ∈ D (u e) := hzu ▸ interior_subset (hD (u e)).2.1 + have hz0 : z = b e 0 := Set.mem_singleton_iff.mp ((hbD e).subset ⟨hzb, hzDu⟩) + have hzint : z ∈ interior (D (u e)) := hzu ▸ (hD (u e)).2.1 + exact (hb0 e).2 (hz0 ▸ hzint) + · have hzv' := Set.mem_singleton_iff.mp hzv + have hzDv : z ∈ D (v e) := hzv' ▸ interior_subset (hD (v e)).2.1 + have hz1 : z = b e 1 := Set.mem_singleton_iff.mp ((hbE e).subset ⟨hzb, hzDv⟩) + have hzint : z ∈ interior (D (v e)) := hzv' ▸ (hD (v e)).2.1 + exact (hb1 e).2 (hz1 ▸ hzint) + have hoff : ∀ e w, w ≠ u e → w ≠ v e → Disjoint (range (b e)) (D w) := by + intro e w hwu hwv + have hnot : ¬ Γ.toGraph.Inc e.val w.val := by + intro hinc + rcases hinc.eq_or_eq_of_isLink (hl e) with hw | hw + · exact hwu (Subtype.ext hw) + · exact hwv (Subtype.ext hw) + exact ((hD w).2.2.2 e.val e.property hnot).symm.mono_left (hsub e) + refine ⟨D, b, fun w => ⟨(hD w).1, (hD w).2.1⟩, hDD, ?_, ?_⟩ + · intro e + have hbd0 : b e 0 ∈ discBd (D (u e)) := by + have h := hb0 e + rwa [GM11.IsClosedDisc.frontier_eq_discBd hS (hD (u e)).1] at h + have hbd1 : b e 1 ∈ discBd (D (v e)) := by + have h := hb1 e + rwa [GM11.IsClosedDisc.frontier_eq_discBd hS (hD (v e)).1] at h + exact ⟨hb e, hsub e, hbd0, hbd1, hbD e, hbE e, hmissV e, hoff e⟩ + · intro e f hef + have hef' : e.val ≠ f.val := fun h => hef (Subtype.ext h) + apply Set.disjoint_left.mpr + intro z hze hzf + have hzV := closure_inter_subset_V e.property f.property hef' ⟨hsub e hze, hsub f hzf⟩ + exact Set.disjoint_left.mp (hmissV e) hze hzV + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SpacedFreeEdges.lean b/LeanPool/GraphMinor/GM12/Section4SpacedFreeEdges.lean new file mode 100644 index 0000000000..11b3999fb9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SpacedFreeEdges.lean @@ -0,0 +1,138 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.GM11.Defs +public import LeanPool.GraphMinor.GM10.Defs +import LeanPool.GraphMinor.GM12.Section4DistantEdges +import LeanPool.GraphMinor.GM12.Section4PathExists +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM12.Section4FreePathEdge +import LeanPool.GraphMinor.GM12.Section4PathThreshold +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Choosing mutually distant free edges + +XII (4.3), claims (3)--(4), page 250, chooses the first path +edges at thresholds `(k + 7)i`, for `1 ≤ i ≤ t`. Each first +crossing overshoots by at most three, so the chosen edges are at +pairwise distance at least `k + 4`. Their thresholds leave a gap +of two from both end edges, making them free by claim (1). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM10 GM11 GM14 + +/-- The family of free edges chosen after claims (3)--(4) in +Graph Minors XII (4.3), page 250. -/ +theorem exists_spaced_free_edges_on_path + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ k t : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + (hθ : 5 + t * (k + 7) ≤ θ) + {x y : S} (W : GraphWalk Γ.toGraph x y) (hW : W.IsSimple) + {g h : Set S} (hg : g ∈ Γ.E) (hh : h ∈ Γ.E) + (hx : x ∈ closure g) (hy : y ∈ closure h) (hfar : θ ≤ d g h) : + ∃ (f : Fin t → Set S) (a b : Fin t → S), + (∀ i, f i ∈ W.edges ∧ Γ.toGraph.IsLink (f i) (a i) (b i) ∧ + a i ≠ b i ∧ IsFreeSet Γ.toHypergraph T θ {a i, b i}) ∧ + (∀ i j, i ≠ j → k + 4 ≤ d (f i) (f j)) := by + classical + let n : Fin t → ℕ := fun i => (k + 7) * (i.val + 1) + have hn : ∀ i, 2 ≤ n i ∧ n i + 5 ≤ θ := by + intro i + have hlow := Nat.mul_le_mul_left (k + 7) (show 1 ≤ i.val + 1 by omega) + have hhigh := Nat.mul_le_mul_left (k + 7) (Nat.succ_le_of_lt i.isLt) + dsimp only [n] + rw [Nat.mul_one] at hlow + rw [Nat.mul_comm (k + 7) t] at hhigh + change (k + 7) * (i.val + 1) ≤ t * (k + 7) at hhigh + omega + have hex : ∀ i : Fin t, ∃ f ∈ W.edges, n i ≤ d g f ∧ d g f ≤ n i + 3 := by + intro i + obtain ⟨p, f, q, heq, _, hlo, hhi⟩ := exists_first_path_threshold_edge hS hm W hg hh hx hy + (show 1 ≤ n i by have h := (hn i).1; omega) + (show n i + 4 ≤ d g h by have h := (hn i).2; omega) + exact ⟨f, heq ▸ List.mem_append_right p List.mem_cons_self, hlo, hhi⟩ + choose f hf hlo hhi using hex + have h91 := GM11.gm15_theorem_9_1 Γ θ T d hS inferInstance hm + have hsym := h91.2.2.2.1 + have htri := h91.2.2.2.2.1 + have hfA : ∀ i, f i ∈ Γ.A := by + intro i + exact Or.inl (Or.inr ((walkDrawing_isSubdrawing Γ W).2 + ((walkDrawing_E Γ W).symm ▸ hf i))) + have hgA : g ∈ Γ.A := Or.inl (Or.inr hg) + have hhA : h ∈ Γ.A := Or.inl (Or.inr hh) + have hfree : ∀ i, ∃ a b, Γ.toGraph.IsLink (f i) a b ∧ a ≠ b ∧ + IsFreeSet Γ.toHypergraph T θ {a, b} := by + intro i + have hdist := htri g hgA (f i) (hfA i) h hhA + rw [hsym (f i) (hfA i) h hhA] at hdist + have hi := hn i + have hi' := hhi i + exact free_path_edge_of_metric_distant_ends hS hm (by omega) W hW hg hh hx hy (hf i) + (hi.1.trans (hlo i)) (by omega) + choose a b hl hab hfree using hfree + refine ⟨f, a, b, fun i => ⟨hf i, hl i, hab i, hfree i⟩, ?_⟩ + have hordered : ∀ i j : Fin t, i.val < j.val → k + 4 ≤ d (f i) (f j) := by + intro i j hij + have hgap := Nat.mul_le_mul_left (k + 7) + (show (i.val + 1) + 1 ≤ j.val + 1 by omega) + rw [Nat.mul_add, Nat.mul_one] at hgap + have ht := htri g hgA (f i) (hfA i) (f j) (hfA j) + have hi := hhi i + have hj := hlo j + change (k + 7) * (i.val + 1) + (k + 7) ≤ (k + 7) * (j.val + 1) at hgap + change d g (f i) ≤ (k + 7) * (i.val + 1) + 3 at hi + change (k + 7) * (j.val + 1) ≤ d g (f j) at hj + omega + intro i j hij + rcases lt_or_gt_of_ne (fun h => hij (Fin.ext h)) with hij' | hij' + · exact hordered i j hij' + · rw [hsym (f i) (hfA i) (f j) (hfA j)] + exact hordered j i hij' + +/-- The free-edge family needed for XII (4.3), page 250, with the +two distant edges and their connecting path supplied by the tangle. -/ +theorem exists_spaced_free_edges + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ k t : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + (hθ : 5 + t * (k + 7) ≤ θ) : + ∃ (f : Fin t → Set S) (a b : Fin t → S), + (∀ i, f i ∈ Γ.E ∧ Γ.toGraph.IsLink (f i) (a i) (b i) ∧ + a i ≠ b i ∧ IsFreeSet Γ.toHypergraph T θ {a i, b i}) ∧ + (∀ i j, i ≠ j → k + 4 ≤ d (f i) (f j)) := by + obtain ⟨g, hg, h, hh, hdist⟩ := exists_two_edges_at_tangle_order_distance hS hm (by omega) + obtain ⟨x, x', hlx⟩ := Γ.toGraph.exists_isLink_of_mem_edgeSet hg + obtain ⟨y, y', hly⟩ := Γ.toGraph.exists_isLink_of_mem_edgeSet hh + have hx : x ∈ closure g := by + have h : x ∈ closure g ∩ Γ.V := by rw [hlx.2.2.2]; simp + exact h.1 + have hy : y ∈ closure h := by + have h : y ∈ closure h ∩ Γ.V := by rw [hly.2.2.2]; simp + exact h.1 + obtain ⟨W₀⟩ := exists_walk_of_open_disc_regions hS hm.1.1.2 hlx.left_mem hly.left_mem + obtain ⟨W, hW, _, _⟩ := GM09.exists_isSimple_subwalk W₀ + obtain ⟨f, a, b, hf, hsep⟩ := exists_spaced_free_edges_on_path hS hm hθ W hW hg hh hx hy + (by rw [hdist]) + refine ⟨f, a, b, ?_, hsep⟩ + intro i + exact ⟨(hf i).2.1.edge_mem, (hf i).2⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SpanBranchBound.lean b/LeanPool/GraphMinor/GM12/Section4SpanBranchBound.lean new file mode 100644 index 0000000000..5d0313df9f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SpanBranchBound.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM12.Section4SpanSeparation +import LeanPool.GraphMinor.GM12.Section4ConnectedSideBound + +/-! +# The small-side bound for an enlarged embedded branch + +At the end of XII (4.4), page 252, an enlarged branch contains a +connected drawn subgraph joining two distant selected vertices. +If an ambient small side contained that branch, pull the separation +back to the drawing. Its order cannot increase. The control +condition puts it in the drawing tangle, and (4.1) gives the +contradictory lower bound on its order. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Hypergraph GM14 GM15 + +/-- The final order estimate in XII (4.4), page 252, also used in +(4.5), page 253. An enlarged branch containing a distant connected +drawn subgraph cannot lie on an ambient small side. -/ +theorem not_subset_small_side_of_embedded_distant_drawing + {S α β : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {G : Graph α β} {Γ D : Drawing S} + (η : SpanEmbedding Γ G) {θstar θ m : ℕ} + {Tstar : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) + (hC : IsControllingTangle G Γ η θstar θ Tstar T) (hmθ : m ≤ θ) + (hD : IsConnectedDrawing D) (hDΓ : D.IsSubdrawing Γ) + {u v : S} (hu : u ∈ D.V) (hv : v ∈ D.V) (hfar : 2 * m ≤ d {u} {v}) + {X : Set α} (hDX : η.vMap '' D.V ⊆ X) + {A B : Hypergraph α β} (hAB : (A, B) ∈ Tstar) (horder : separationOrder A B < m) : + ¬ X ⊆ A.vertexSet := by + intro hXA + have hsep := hC.isTangle_star.isTangle.isSeparation hAB + obtain ⟨AH, BH, hRestr, hAV, _, _, _, horderH⟩ := + exists_span_restricted_separation hC.isTangle_star.finite_V hC.isTangle_star.finite_E Γ η hsep + have hmem : (AH, BH) ∈ T := (hC.controls hsep (horder.trans_le hmθ) hRestr).mp hAB + have hDA : D.V ⊆ AH.vertexSet := by + intro x hx + rw [hAV] + exact ⟨hDΓ.1 hx, hXA (hDX (mem_image_of_mem η.vMap hx))⟩ + have hbound := separation_order_ge_of_connected_distant_vertices hS hm hD hDΓ hu hv hfar hmem hDA + exact (not_lt_of_ge (hbound.trans horderH)) horder + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SpanControl.lean b/LeanPool/GraphMinor/GM12/Section4SpanControl.lean new file mode 100644 index 0000000000..ddf1d5b32b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SpanControl.lean @@ -0,0 +1,172 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM15.Defs +import LeanPool.GraphMinor.GM12.Section4PathFacts +import LeanPool.GraphMinor.GM12.Section4DrawingControl +import LeanPool.GraphMinor.GM12.Section4BranchImage +import LeanPool.GraphMinor.GM12.Section4SpanSeparation +import LeanPool.GraphMinor.GM16.HypergraphImage +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Carrying a controlled drawing minor into its ambient graph + +The embedded-graph form of XII (4.3), page 249, relabels each branch +and joining edge through the drawing embedding. The embedding +preserves all edge ends, so the images are subhypergraphs and the +loop condition is preserved. Pull back an ambient small separation. +The controlling-tangle condition puts this separation in the drawing +tangle, where the original branch cannot lie on its small side. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph Surface Hypergraph GM10 GM11 GM14 GM15 GM16 + +private theorem span_image_hypergraph_le + {S α β : Type*} [TopologicalSpace S] {G : Graph α β} + (hV : G.vertexSet.Finite) (hE : G.edgeSet.Finite) + (H : Drawing S) (η : SpanEmbedding H G) : + imageHypergraph η.vMap η.eMap H.toHypergraph ≤ Hypergraph.ofGraph G hV hE := by + refine ⟨?_, ?_, ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + exact η.imageGraph_le.vertexSet_mono (η.bijOn_v.mapsTo hx) + · rintro _ ⟨e, he, rfl⟩ + exact η.imageGraph_le.edgeSet_mono (η.bijOn_e.mapsTo he) + · rintro _ ⟨e, he, rfl⟩ + ext x + constructor + · rintro ⟨y, hxy⟩ + have him : η.imageGraph.IsLink (η.eMap e) x y := + (η.imageGraph_le.isLink_iff (η.bijOn_e.mapsTo he)).mpr hxy + obtain ⟨v, hv, hvx⟩ := η.bijOn_v.surjOn him.left_mem + have hcl : v ∈ closure e := (η.inc_iff e he v hv).mp (hvx ▸ him.inc_left) + exact ⟨e, v, ⟨he, hv, hcl⟩, rfl, hvx⟩ + · rintro ⟨f, v, hinc, hfe, hvx⟩ + have hfe' : f = e := η.bijOn_e.injOn hinc.1 he hfe + subst f + obtain ⟨w, hlink⟩ := (η.inc_iff e he v hinc.2.1).mpr hinc.2.2 + exact ⟨w, hvx ▸ (η.imageGraph_le.isLink_iff (η.bijOn_e.mapsTo he)).mp hlink⟩ + +/-- Carry connected disjoint subdrawings through a drawing embedding, +retaining their exact vertex images for the path attachment in XII +(4.4), page 252. -/ +theorem exists_embedded_connecting_branches + {S α β : Type*} [TopologicalSpace S] {G : Graph α β} + (hV : G.vertexSet.Finite) (hE : G.edgeSet.Finite) {H : Drawing S} + (η : SpanEmbedding H G) {W : Type*} (D : W → Drawing S) + (hD : ∀ v, (D v).IsSubdrawing H) + (hne : ∀ v, (D v).V.Nonempty) (hconn : ∀ v, IsConnectedDrawing (D v)) + (hdisj : ∀ v w, v ≠ w → Disjoint (D v).V (D w).V) : + ∃ A : W → Hypergraph α β, + (∀ v, A v ≤ Hypergraph.ofGraph G hV hE ∧ + (A v).vertexSet.Nonempty ∧ IsConnectedSub (A v)) ∧ + (∀ v w, v ≠ w → Disjoint (A v).vertexSet (A w).vertexSet) ∧ + ∀ v, (A v).vertexSet = η.vMap '' (D v).V := by + let A := fun v => imageHypergraph η.vMap η.eMap (D v).toHypergraph + have hsub : ∀ v, (D v).toHypergraph ≤ H.toHypergraph := + fun v => subdrawing_toHypergraph_le (hD v) + have hImage := span_image_hypergraph_le hV hE H η + refine ⟨A, ?_, ?_, fun _ => rfl⟩ + · intro v + refine ⟨(imageHypergraph_mono_on η.vMap η.eMap η.bijOn_e.injOn (hsub v)).trans hImage, + (hne v).image η.vMap, ?_⟩ + exact isConnectedSub_imageHypergraph η.vMap η.eMap + (η.bijOn_v.injOn.mono (hD v).1) + (isConnectedSub_toHypergraph_of_connected_drawing (hconn v)) + · intro v w hvw + apply Set.disjoint_left.mpr + rintro _ ⟨x, hx, hxe⟩ ⟨y, hy, hye⟩ + have hxy := η.bijOn_v.injOn ((hD v).1 hx) ((hD w).1 hy) (hxe.trans hye.symm) + exact Set.disjoint_left.mp (hdisj v w hvw) hx (hxy.symm ▸ hy) + +/-- Transfer a controlled minor from a drawing tangle to the +ambient tangle controlling it through a drawing embedding. -/ +theorem controlsMinor_of_controlling_drawing_tangle + {S α β γ δ : Type*} [TopologicalSpace S] {G : Graph α β} {H : Drawing S} + (η : SpanEmbedding H G) {θstar θ : ℕ} + {Tstar : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hC : IsControllingTangle G H η θstar θ Tstar T) {L : Graph γ δ} + (hc : ControlsMinor H.toHypergraph θ T L) : + ControlsMinor (Hypergraph.ofGraph G hC.isTangle_star.finite_V hC.isTangle_star.finite_E) + θstar Tstar L := by + obtain ⟨a, b, ha, hdisj, hlink, hloop, hinj, hcard, hcontrol⟩ := hc + let G' := Hypergraph.ofGraph G hC.isTangle_star.finite_V hC.isTangle_star.finite_E + have hImage : imageHypergraph η.vMap η.eMap H.toHypergraph ≤ G' := + span_image_hypergraph_le hC.isTangle_star.finite_V hC.isTangle_star.finite_E H η + have hbE : ∀ e ∈ L.edgeSet, b e ∈ H.E := by + intro e he + obtain ⟨v, w, hl⟩ := L.exists_isLink_of_mem_edgeSet he + by_cases hvw : v = w + · subst w + exact (hloop e v hl).1 + · exact (hlink e v w hl hvw).1 + have hmapinc : ∀ e ∈ H.E, ∀ x, G'.Inc (η.eMap e) x ↔ + ∃ v, H.toHypergraph.Inc e v ∧ η.vMap v = x := by + intro e he x + have heImage : η.eMap e ∈ (imageHypergraph η.vMap η.eMap H.toHypergraph).edgeSet := + mem_image_of_mem η.eMap he + constructor + · intro hi + have him := (inc_iff_of_le hImage heImage).mpr hi + obtain ⟨f, v, hfv, hfe, hvx⟩ := him + have hfe' := η.bijOn_e.injOn hfv.1 he hfe + subst f + exact ⟨v, hfv, hvx⟩ + · rintro ⟨v, hi, hvx⟩ + exact (inc_iff_of_le hImage heImage).mp ⟨e, v, hi, rfl, hvx⟩ + refine ⟨fun v => imageHypergraph η.vMap η.eMap (a v), fun e => η.eMap (b e), + ?_, ?_, ?_, ?_, ?_, hcard.trans hC.theta_le, ?_⟩ + · intro v hv + refine ⟨(imageHypergraph_mono_on η.vMap η.eMap η.bijOn_e.injOn (ha v hv).1).trans hImage, + (ha v hv).2.1.image η.vMap, ?_⟩ + exact isConnectedSub_imageHypergraph η.vMap η.eMap + (η.bijOn_v.injOn.mono (ha v hv).1.vertexSet_subset) (ha v hv).2.2 + · intro u hu v hv huv + apply Set.disjoint_left.mpr + rintro _ ⟨x, hx, hxe⟩ ⟨y, hy, hye⟩ + have hxy := η.bijOn_v.injOn ((ha u hu).1.vertexSet_subset hx) + ((ha v hv).1.vertexSet_subset hy) (hxe.trans hye.symm) + exact Set.disjoint_left.mp (hdisj u hu v hv huv) hx (hxy.symm ▸ hy) + · intro e u v hl huv + obtain ⟨he, hx, hy⟩ := hlink e u v hl huv + obtain ⟨x, hx, hix⟩ := hx + obtain ⟨y, hy, hiy⟩ := hy + refine ⟨hImage.edgeSet_subset (mem_image_of_mem η.eMap he), + ⟨η.vMap x, mem_image_of_mem η.vMap hx, (hmapinc _ he _).mpr ⟨x, hix, rfl⟩⟩, + η.vMap y, mem_image_of_mem η.vMap hy, (hmapinc _ he _).mpr ⟨y, hiy, rfl⟩⟩ + · intro e v hl + obtain ⟨he, hnot, hends⟩ := hloop e v hl + refine ⟨hImage.edgeSet_subset (mem_image_of_mem η.eMap he), ?_, ?_⟩ + · rintro ⟨f, hf, hfe⟩ + have heq := η.bijOn_e.injOn ((ha v hl.left_mem).1.edgeSet_subset hf) he hfe + exact hnot (heq ▸ hf) + · intro x hix + obtain ⟨y, hiy, hyx⟩ := (hmapinc _ he x).mp hix + exact ⟨y, hends y hiy, hyx⟩ + · intro e he f hf hef heq + exact hinj e he f hf hef (η.bijOn_e.injOn (hbE e he) (hbE f hf) heq) + · intro A B hAB horder v hv hsmall + have hsep := hC.isTangle_star.isTangle.isSeparation hAB + obtain ⟨AH, BH, hRestr, hAV, _, _, _, horderH⟩ := + exists_span_restricted_separation hC.isTangle_star.finite_V hC.isTangle_star.finite_E H η hsep + have hθorder : separationOrder A B < θ := horder.trans_le hcard + have hmem : (AH, BH) ∈ T := (hC.controls hsep hθorder hRestr).mp hAB + apply hcontrol AH BH hmem (horderH.trans_lt horder) v hv + intro x hx + rw [hAV] + exact ⟨(ha v hv).1.vertexSet_subset hx, hsmall (mem_image_of_mem η.vMap hx)⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SpanSeparation.lean b/LeanPool/GraphMinor/GM12/Section4SpanSeparation.lean new file mode 100644 index 0000000000..02b5f58fed --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SpanSeparation.lean @@ -0,0 +1,132 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Defs +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Pulling a separation back through a drawing embedding + +To express XII (4.3), page 249, for an ambient graph with different +vertex and edge labels, pull each separation back to the drawing. +Restrict its vertex and edge sets along the embedding. Incidence +preservation makes the restrictions subhypergraphs. Their union +covers the drawing and their common edges are empty. Injectivity +on drawing vertices bounds the separator order. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph Surface Hypergraph GM14 GM15 GM10 + +universe u v w + +/-- Restrict an ambient separation to an embedded drawing, retaining +the exact preimage vertex and edge sets and bounding its order. -/ +theorem exists_span_restricted_separation + {S : Type w} [TopologicalSpace S] {α : Type u} {β : Type v} + {G : Graph α β} (hV : V(G).Finite) (hE : E(G).Finite) + (H : Drawing S) (η : SpanEmbedding H G) {A B : Hypergraph α β} + (hsep : (Hypergraph.ofGraph G hV hE).IsSeparation A B) : + ∃ A_H B_H : Hypergraph S (Set S), + IsRestrictedSeparation H G η A B A_H B_H ∧ + A_H.vertexSet = {v ∈ H.V | η.vMap v ∈ A.vertexSet} ∧ + A_H.edgeSet = {e ∈ H.E | η.eMap e ∈ A.edgeSet} ∧ + B_H.vertexSet = {v ∈ H.V | η.vMap v ∈ B.vertexSet} ∧ + B_H.edgeSet = {e ∈ H.E | η.eMap e ∈ B.edgeSet} ∧ + separationOrder A_H B_H ≤ separationOrder A B := by + let mkSub (X : Hypergraph α β) (hX : X ≤ Hypergraph.ofGraph G hV hE) : Hypergraph S (Set S) := + { vertexSet := {v ∈ H.V | η.vMap v ∈ X.vertexSet} + edgeSet := {e ∈ H.E | η.eMap e ∈ X.edgeSet} + Inc := fun e v => H.toHypergraph.Inc e v ∧ e ∈ H.E ∧ η.eMap e ∈ X.edgeSet + vertex_mem_of_inc := fun e v h => by + refine ⟨h.1.2.1, ?_⟩ + obtain ⟨w, hlink_im⟩ := (η.inc_iff e h.2.1 v h.1.2.1).mpr h.1.2.2 + have hlink_G : G.IsLink (η.eMap e) (η.vMap v) w := + (η.imageGraph_le.isLink_iff (η.bijOn_e.mapsTo h.2.1)).mp hlink_im + have hinc_G : (Hypergraph.ofGraph G hV hE).Inc (η.eMap e) (η.vMap v) := ⟨w, hlink_G⟩ + have hv_ends : η.vMap v ∈ X.ends (η.eMap e) := by + rw [← hX.ends_eq (η.eMap e) h.2.2] + exact hinc_G + exact X.vertex_mem_of_inc hv_ends + edge_mem_of_inc := fun _ _ h => h.2 + vertexSet_finite := H.finite_V.subset fun _ h => h.1 + edgeSet_finite := H.finite_edges.subset fun _ h => h.1 } + have hmk_le : ∀ (X : Hypergraph α β) (hX : X ≤ Hypergraph.ofGraph G hV hE), + mkSub X hX ≤ H.toHypergraph := by + intro X hX + refine ⟨fun _ h => h.1, fun _ h => h.1, fun e he => ?_⟩ + ext v + change H.toHypergraph.Inc e v ↔ H.toHypergraph.Inc e v ∧ e ∈ H.E ∧ η.eMap e ∈ X.edgeSet + exact ⟨fun h => ⟨h, he.1, he.2⟩, fun h => h.1⟩ + let A_H := mkSub A hsep.left_le + let B_H := mkSub B hsep.right_le + have hAl : A_H ≤ H.toHypergraph := hmk_le A hsep.left_le + have hBl : B_H ≤ H.toHypergraph := hmk_le B hsep.right_le + have hRestr : IsRestrictedSeparation H G η A B A_H B_H := by + refine ⟨(isSeparation_iff_of_le hAl hBl).mpr ⟨?_, ?_, ?_⟩, ?_, ?_, ?_, ?_⟩ + · ext v + change (v ∈ H.V ∧ η.vMap v ∈ A.vertexSet ∨ v ∈ H.V ∧ η.vMap v ∈ B.vertexSet) ↔ v ∈ H.V + refine ⟨by rintro (⟨hv, _⟩ | ⟨hv, _⟩) <;> exact hv, fun hv => ?_⟩ + have hvG : η.vMap v ∈ A.vertexSet ∪ B.vertexSet := by + rw [hsep.vertexSet_union] + exact η.imageGraph_le.vertexSet_mono (η.bijOn_v.mapsTo hv) + rcases hvG with hvA | hvB + · exact Or.inl ⟨hv, hvA⟩ + · exact Or.inr ⟨hv, hvB⟩ + · ext e + change (e ∈ H.E ∧ η.eMap e ∈ A.edgeSet ∨ e ∈ H.E ∧ η.eMap e ∈ B.edgeSet) ↔ e ∈ H.E + refine ⟨by rintro (⟨he, _⟩ | ⟨he, _⟩) <;> exact he, fun he => ?_⟩ + have heG : η.eMap e ∈ A.edgeSet ∪ B.edgeSet := by + rw [hsep.edgeSet_union] + exact η.imageGraph_le.edgeSet_mono (η.bijOn_e.mapsTo he) + rcases heG with heA | heB + · exact Or.inl ⟨he, heA⟩ + · exact Or.inr ⟨he, heB⟩ + · ext e + change ((e ∈ H.E ∧ η.eMap e ∈ A.edgeSet) ∧ (e ∈ H.E ∧ η.eMap e ∈ B.edgeSet)) ↔ + e ∈ (∅ : Set (Set S)) + simp only [mem_empty_iff_false, iff_false] + rintro ⟨⟨_, heA⟩, ⟨_, heB⟩⟩ + exact hsep.notMem_edgeSet_right heA heB + · ext x + refine ⟨by rintro ⟨v, ⟨hvH, hvA⟩, rfl⟩; exact ⟨hvA, η.bijOn_v.mapsTo hvH⟩, ?_⟩ + rintro ⟨hxA, hxIm⟩ + obtain ⟨v, hvH, rfl⟩ := η.bijOn_v.surjOn hxIm + exact ⟨v, ⟨hvH, hxA⟩, rfl⟩ + · ext f + refine ⟨by rintro ⟨e, ⟨heH, heA⟩, rfl⟩; exact ⟨heA, η.bijOn_e.mapsTo heH⟩, ?_⟩ + rintro ⟨hfA, hfIm⟩ + obtain ⟨e, heH, rfl⟩ := η.bijOn_e.surjOn hfIm + exact ⟨e, ⟨heH, hfA⟩, rfl⟩ + · ext x + refine ⟨by rintro ⟨v, ⟨hvH, hvB⟩, rfl⟩; exact ⟨hvB, η.bijOn_v.mapsTo hvH⟩, ?_⟩ + rintro ⟨hxB, hxIm⟩ + obtain ⟨v, hvH, rfl⟩ := η.bijOn_v.surjOn hxIm + exact ⟨v, ⟨hvH, hxB⟩, rfl⟩ + · ext f + refine ⟨by rintro ⟨e, ⟨heH, heB⟩, rfl⟩; exact ⟨heB, η.bijOn_e.mapsTo heH⟩, ?_⟩ + rintro ⟨hfB, hfIm⟩ + obtain ⟨e, heH, rfl⟩ := η.bijOn_e.surjOn hfIm + exact ⟨e, ⟨heH, hfB⟩, rfl⟩ + have hord : separationOrder A_H B_H ≤ separationOrder A B := by + have hsub_img : η.vMap '' (A_H ∩ B_H).vertexSet ⊆ (A ∩ B).vertexSet := by + rintro x ⟨v, ⟨hvA, hvB⟩, rfl⟩ + exact ⟨hvA.2, hvB.2⟩ + have hinj : InjOn η.vMap (A_H ∩ B_H).vertexSet := + η.bijOn_v.injOn.mono fun v ⟨hvA, _⟩ => hvA.1 + calc separationOrder A_H B_H + _ = (η.vMap '' (A_H ∩ B_H).vertexSet).ncard := hinj.ncard_image.symm + _ ≤ separationOrder A B := Set.ncard_le_ncard hsub_img (A ∩ B).vertexSet_finite + exact ⟨A_H, B_H, hRestr, rfl, rfl, rfl, rfl, hord⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SplitBranch.lean b/LeanPool/GraphMinor/GM12/Section4SplitBranch.lean new file mode 100644 index 0000000000..5cb3d6d373 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SplitBranch.lean @@ -0,0 +1,100 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RegionWalk +import LeanPool.GraphMinor.GM12.Section4SplitDrawing + +/-! +# Branch sets recovering a subdivided drawing + +The replacement in XII (4.3), page 249, must contain the original +graph as a minor. After subdividing each edge, contract its right +half. The branch at an original vertex consists of that vertex +and the midpoints whose right end is this vertex. Midpoints lie +in distinct original edges and never in the original vertex set, +so these branches are disjoint. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The branch obtained by contracting the right half of each +subdivided edge, in the target replacement of XII (4.3), page 249. -/ +@[expose] def splitBranch {S : Type*} [TopologicalSpace S] (Γ : Drawing S) + (m y : Set S → S) (v : S) : Set S := + insert v (m '' {e ∈ Γ.E | y e = v}) + +/-- An original vertex belongs only to its own subdivision branch. -/ +theorem mem_splitBranch_of_original_vertex_iff + {S : Type*} [TopologicalSpace S] {Γ H : Drawing S} + {A B : Set S → Set S} {m x y : Set S → S} + (hd : SplitData Γ H A B m x y) {v z : S} (hz : z ∈ Γ.V) : + z ∈ splitBranch Γ m y v ↔ z = v := by + constructor + · rintro (hzv | ⟨e, ⟨he, _⟩, hme⟩) + · exact hzv + · exact False.elim (hd.mid_notMem he (hme.symm ▸ hz)) + · intro hzv + exact Or.inl hzv + +/-- A midpoint belongs to the branch of its original right end. -/ +theorem mem_splitBranch_of_midpoint_iff + {S : Type*} [TopologicalSpace S] {Γ H : Drawing S} + {A B : Set S → Set S} {m x y : Set S → S} + (hd : SplitData Γ H A B m x y) {v : S} (hv : v ∈ Γ.V) + {e : Set S} (he : e ∈ Γ.E) : + m e ∈ splitBranch Γ m y v ↔ y e = v := by + constructor + · rintro (hmev | ⟨f, ⟨hf, hyv⟩, hmfe⟩) + · exact False.elim (hd.mid_notMem he (hmev ▸ hv)) + · have hfe : f = e := hd.mid_inj hf he hmfe + exact hfe ▸ hyv + · intro hyv + exact Or.inr ⟨e, ⟨he, hyv⟩, rfl⟩ + +/-- Every subdivision branch consists of vertices of the subdivided drawing. -/ +theorem splitBranch_subset_vertices + {S : Type*} [TopologicalSpace S] {Γ H : Drawing S} + {A B : Set S → Set S} {m x y : Set S → S} + (hd : SplitData Γ H A B m x y) {v : S} (hv : v ∈ Γ.V) : + splitBranch Γ m y v ⊆ H.V := by + rintro z (hzv | ⟨e, ⟨he, _⟩, hme⟩) + · exact hzv ▸ hd.V_sub hv + · exact hme ▸ hd.mid_V₂ he + +/-- Distinct original vertices have disjoint subdivision branches. -/ +theorem splitBranch_disjoint + {S : Type*} [TopologicalSpace S] {Γ H : Drawing S} + {A B : Set S → Set S} {m x y : Set S → S} + (hd : SplitData Γ H A B m x y) {v w : S} (hv : v ∈ Γ.V) (hw : w ∈ Γ.V) + (hvw : v ≠ w) : Disjoint (splitBranch Γ m y v) (splitBranch Γ m y w) := by + apply Set.disjoint_left.mpr + intro z hzv hzw + rcases hzv with hzv | ⟨e, ⟨he, hye⟩, hme⟩ + · have hzΓ : z ∈ Γ.V := hzv ▸ hv + exact hvw (hzv.symm.trans ((mem_splitBranch_of_original_vertex_iff hd hzΓ).mp hzw)) + · have hmid : m e ∈ splitBranch Γ m y w := hme.symm ▸ hzw + have hye' := (mem_splitBranch_of_midpoint_iff hd hw he).mp hmid + exact hvw (hye.symm.trans hye') + +/-- No right half of a subdivided edge is one of the chosen left halves. -/ +theorem split_right_notMem_left_image + {S : Type*} [TopologicalSpace S] {Γ H : Drawing S} + {A B : Set S → Set S} {m x y : Set S → S} + (hd : SplitData Γ H A B m x y) {e : Set S} (he : e ∈ Γ.E) : B e ∉ A '' Γ.E := by + rintro ⟨f, hf, hAB⟩ + have hfe : f = e := hd.edge_of_piece hf he (Or.inr (Or.inl hAB)) + subst f + exact hd.ne_AB he hAB + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SplitBranchConnected.lean b/LeanPool/GraphMinor/GM12/Section4SplitBranchConnected.lean new file mode 100644 index 0000000000..daa3fb1d53 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SplitBranchConnected.lean @@ -0,0 +1,59 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SplitBranch +public import LeanPool.GraphMinor.Minor.Model +import Mathlib.Combinatorics.Graph.Delete +import LeanPool.GraphMinor.GM12.Section4SplitDrawing + +/-! +# The contracted subdivision branches are connected + +For the minor recovering the original target in XII (4.3), +page 249, retain the right half of each edge inside the branch +of its right end. Every added midpoint joins directly to that +original vertex. The retained halves avoid every left half, which +will represent the original edges in the minor model. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 Relation + +/-- The connected branch graph for contraction of all right +halves in the target replacement of XII (4.3), page 249. -/ +theorem splitBranch_connected_subgraph + {S : Type*} [TopologicalSpace S] {Γ H : Drawing S} + {A B : Set S → Set S} {m x y : Set S → S} + (hd : SplitData Γ H A B m x y) {v : S} (hv : v ∈ Γ.V) : + ∃ K ≤ H.toGraph.deleteEdges (A '' Γ.E), + K.vertexSet = splitBranch Γ m y v ∧ GraphConnected K := by + let K := (H.toGraph.deleteEdges (A '' Γ.E)).induce (splitBranch Γ m y v) + have hcenter : v ∈ splitBranch Γ m y v := Or.inl rfl + have hreach : ∀ z ∈ splitBranch Γ m y v, ReflTransGen K.Adj v z := by + rintro z (hzv | ⟨e, ⟨he, hyv⟩, hme⟩) + · exact hzv ▸ ReflTransGen.refl + · have hmid : m e ∈ splitBranch Γ m y v := + (mem_splitBranch_of_midpoint_iff hd hv he).mpr hyv + have hl : H.toGraph.IsLink (B e) v (m e) := by + have h := (splitData_isLink_right hd he).symm + rwa [hyv] at h + have hlK : K.IsLink (B e) v (m e) := + ⟨⟨hl, split_right_notMem_left_image hd he⟩, hcenter, hmid⟩ + exact hme ▸ ReflTransGen.single ⟨B e, hlK⟩ + refine ⟨K, ?_, rfl, ⟨⟨v, hcenter⟩, ?_⟩⟩ + · apply Graph.induce_le + exact splitBranch_subset_vertices hd hv + · intro z hz w hw + exact (symm (hreach z hz)).trans (hreach w hw) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SplitDrawing.lean b/LeanPool/GraphMinor/GM12/Section4SplitDrawing.lean new file mode 100644 index 0000000000..67d5daa302 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SplitDrawing.lean @@ -0,0 +1,112 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RegionWalk +import LeanPool.GraphMinor.GM11.SplitEdge +import LeanPool.GraphMinor.GM12.Section4ParallelAugment + +/-! +# Removing loops by subdividing the target edges + +For the replacement at the start of XII (4.3), page 249, +subdivide each edge once. The new midpoint differs from both +original ends, so neither half is a loop. A vertex incident with +an original edge stays incident with one half, and every new +midpoint is incident with both halves. Thus subdivision introduces +no isolated vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- The left half-edge of a subdivision has the original left end +and its new midpoint as ends. -/ +theorem splitData_isLink_left + {S : Type*} [TopologicalSpace S] {Γ H : Drawing S} + {A B : Set S → Set S} {m x y : Set S → S} + (hd : SplitData Γ H A B m x y) {e : Set S} (he : e ∈ Γ.E) : + H.toGraph.IsLink (A e) (x e) (m e) := + ⟨hd.A_mem e he, hd.V_sub (hd.x_mem e he), hd.mid_V₂ he, hd.cap_A e he⟩ + +/-- The right half-edge of a subdivision has its new midpoint and +the original right end as ends. -/ +theorem splitData_isLink_right + {S : Type*} [TopologicalSpace S] {Γ H : Drawing S} + {A B : Set S → Set S} {m x y : Set S → S} + (hd : SplitData Γ H A B m x y) {e : Set S} (he : e ∈ Γ.E) : + H.toGraph.IsLink (B e) (m e) (y e) := + ⟨hd.B_mem e he, hd.mid_V₂ he, hd.V_sub (hd.y_mem e he), hd.cap_B e he⟩ + +/-- Subdividing every edge removes loops and preserves the absence +of isolated vertices, as used in XII (4.3), page 249. -/ +theorem splitData_loopless_and_no_isolated + {S : Type*} [TopologicalSpace S] {Γ H : Drawing S} + {A B : Set S → Set S} {m x y : Set S → S} + (hd : SplitData Γ H A B m x y) + (hincident : ∀ z ∈ Γ.V, ∃ e, Γ.toGraph.Inc e z) : + (∀ e z, ¬ H.toGraph.IsLink e z z) ∧ + ∀ z ∈ H.V, ∃ e, H.toGraph.Inc e z := by + constructor + · intro e z hloop + obtain ⟨u, v, huv, hcap⟩ := hd.noLoop e hloop.edge_mem + have hpair : ({u, v} : Set S) = {z} := hcap.symm.trans (by simpa using hloop.2.2.2) + have hu : u = z := Set.mem_singleton_iff.mp (hpair.subset (by simp)) + have hv : v = z := Set.mem_singleton_iff.mp (hpair.subset (by simp)) + exact huv (hu.trans hv.symm) + · intro z hz + rw [hd.V_eq] at hz + rcases hz with hz | ⟨e, he, rfl⟩ + · obtain ⟨e, hez⟩ := hincident z hz + have he : e ∈ Γ.E := hez.edge_mem + have hlink : Γ.toGraph.IsLink e (x e) (y e) := + ⟨he, hd.x_mem e he, hd.y_mem e he, hd.cap e he⟩ + rcases hez.eq_or_eq_of_isLink hlink with hz | hz + · exact ⟨A e, hz ▸ (splitData_isLink_left hd he).inc_left⟩ + · exact ⟨B e, hz ▸ (splitData_isLink_right hd he).inc_right⟩ + · exact ⟨A e, (splitData_isLink_left hd he).inc_right⟩ + +/-- A drawing without isolated vertices has a loopless subdivision +without isolated vertices, used before adding parallel copies in +XII (4.3), page 249. -/ +theorem exists_loopless_split_without_isolated + {S : Type*} [TopologicalSpace S] [T2Space S] [Nonempty S] + (Γ : Drawing S) (hincident : ∀ z ∈ Γ.V, ∃ e, Γ.toGraph.Inc e z) : + ∃ (H : Drawing S) (A B : Set S → Set S) (m x y : Set S → S), + SplitData Γ H A B m x y ∧ (∀ e z, ¬ H.toGraph.IsLink e z z) ∧ + ∀ z ∈ H.V, ∃ e, H.toGraph.Inc e z := by + obtain ⟨H, A, B, m, x, y, hU, hV, hprops, hall⟩ := exists_split Γ + have hd : SplitData Γ H A B m x y := by + refine ⟨hU, hV, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, hall⟩ + all_goals + intro e he + obtain ⟨hA, hB, hm, hmA, hmB, hdisj, hunion, hx, hy, hcap, hcapA, hcapB⟩ := hprops e he + assumption + exact ⟨H, A, B, m, x, y, hd, splitData_loopless_and_no_isolated hd hincident⟩ + +/-- Subdivision followed by parallel copies gives the loopless +minimum-degree-two drawing used in XII (4.3), page 249, when the +original drawing has no isolated vertices. The subdivision data +records how to recover the original edges. -/ +theorem exists_subdivision_in_minimum_degree_two_drawing + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) + (hincident : ∀ z ∈ Γ.V, ∃ e, Γ.toGraph.Inc e z) : + ∃ (K H : Drawing S) (A B : Set S → Set S) (m x y : Set S → S), + SplitData Γ K A B m x y ∧ K.IsSubdrawing H ∧ H.V = K.V ∧ + (∀ e z, ¬ H.toGraph.IsLink e z z) ∧ + ∀ z ∈ H.V, ∃ e f, e ≠ f ∧ H.toGraph.Inc e z ∧ H.toGraph.Inc f z := by + obtain ⟨K, A, B, m, x, y, hd, hloop, hinc⟩ := exists_loopless_split_without_isolated Γ hincident + obtain ⟨H, hKH, hHV, hHloop, hHinc⟩ := exists_minimum_degree_two_augmentation hS K hloop hinc + exact ⟨K, H, A, B, m, x, y, hd, hKH, hHV, hHloop, hHinc⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SplitMinorModel.lean b/LeanPool/GraphMinor/GM12/Section4SplitMinorModel.lean new file mode 100644 index 0000000000..6c3d2b8d4d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SplitMinorModel.lean @@ -0,0 +1,85 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SplitBranchConnected +import LeanPool.GraphMinor.GM12.Section4SplitDrawing + +/-! +# The original graph is a minor of its subdivision + +For the target replacement in XII (4.3), page 249, contract +the right half of every subdivided edge. The branch at an original +vertex contains its assigned midpoints. The left halves represent +the original edges. Distinct branches and distinct representing +edges stay distinct. An original loop has both ends of its left +half in one branch, exactly as required by the minor model. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- Contracting every right half recovers the original graph. +This verifies the minor requirement in XII (4.3)'s target replacement, +page 249, for subdivisions of arbitrary drawings, including loops. -/ +theorem isMinorModel_of_splitData + {S : Type*} [TopologicalSpace S] {Γ H : Drawing S} + {A B : Set S → Set S} {m x y : Set S → S} + (hd : SplitData Γ H A B m x y) : + IsMinorModel Γ.toGraph H.toGraph (splitBranch Γ m y) A := by + have hlink : ∀ e ∈ Γ.E, Γ.toGraph.IsLink e (x e) (y e) := + fun e he => ⟨he, hd.x_mem e he, hd.y_mem e he, hd.cap e he⟩ + refine { + vertex_nonempty := fun v _ => ⟨v, Or.inl rfl⟩ + vertex_subset := fun _ hv => splitBranch_subset_vertices hd hv + edge_mem := fun e he => hd.A_mem e he + vertex_disjoint := fun _ hv _ hw hne => splitBranch_disjoint hd hv hw hne + edge_injOn := ?_ + inc_iff := ?_ + isLoopAt_iff := ?_ + connected := fun _ hv => splitBranch_connected_subgraph hd hv } + · intro e he f hf hef + exact hd.edge_of_piece he hf (Or.inl hef) + · intro v hv e he + have hA := splitData_isLink_left hd he + constructor + · intro hev + rcases hev.eq_or_eq_of_isLink (hlink e he) with hve | hve + · exact ⟨v, Or.inl rfl, hve ▸ hA.inc_left⟩ + · exact ⟨m e, (mem_splitBranch_of_midpoint_iff hd hv he).mpr hve.symm, hA.inc_right⟩ + · rintro ⟨z, hz, hAz⟩ + rcases hAz.eq_or_eq_of_isLink hA with hzx | hzm + · have hxB : x e ∈ splitBranch Γ m y v := hzx ▸ hz + have hxv := (mem_splitBranch_of_original_vertex_iff hd (hd.x_mem e he)).mp hxB + exact hxv ▸ (hlink e he).inc_left + · have hmB : m e ∈ splitBranch Γ m y v := hzm ▸ hz + have hyv := (mem_splitBranch_of_midpoint_iff hd hv he).mp hmB + exact hyv ▸ (hlink e he).inc_right + · intro v hv e he + have hA := splitData_isLink_left hd he + constructor + · intro hloop z hAz + have hxv : x e = v := + (Γ.toGraph.eq_or_eq_of_isLink_of_isLink (hlink e he) hloop).elim id id + have hyv : y e = v := + (Γ.toGraph.eq_or_eq_of_isLink_of_isLink (hlink e he).symm hloop).elim id id + rcases hAz.eq_or_eq_of_isLink hA with hzx | hzm + · exact (hzx.trans hxv) ▸ (Or.inl rfl : v ∈ splitBranch Γ m y v) + · exact hzm ▸ (mem_splitBranch_of_midpoint_iff hd hv he).mpr hyv + · intro hall + have hxv := (mem_splitBranch_of_original_vertex_iff hd (hd.x_mem e he)).mp + (hall (x e) hA.inc_left) + have hyv := (mem_splitBranch_of_midpoint_iff hd hv he).mp (hall (m e) hA.inc_right) + change Γ.toGraph.IsLink e v v + simpa only [hxv, hyv] using hlink e he + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4StripMotion.lean b/LeanPool/GraphMinor/GM12/Section4StripMotion.lean new file mode 100644 index 0000000000..20c1d00418 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4StripMotion.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ArcDisc +import LeanPool.GraphMinor.GM12.Section4StripRectangle + +/-! +# Moving an arc endpoint while fixing a closed set + +The homeomorphism in XII (4.3), claim (7), page 251, must preserve +objects already placed. In straight arc coordinates, remove the +closed set to be fixed and take a thin rectangle around the arc. +The strip slide is the identity outside that rectangle, and hence +on the prescribed closed set. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Complex + +/-- Slide the last endpoint of a straightened arc to its first +endpoint, fixing a closed set disjoint from the arc. -/ +theorem exists_endpoint_motion_of_strip + {S : Type} [TopologicalSpace S] [CompactSpace S] [T2Space S] + {O : Set ℂ} {K : ℂ → S} (hK : StripChart O K) + {a : unitInterval → S} {θ : unitInterval → ℝ} + (hθc : Continuous θ) (hθm : StrictMono θ) + (hθK : ∀ t, (θ t : ℂ) ∈ O ∧ K (θ t) = a t) + {F : Set S} (hF : IsClosed F) (havoid : Disjoint (range a) F) : + ∃ e : S ≃ₜ S, e (a 1) = a 0 ∧ ∀ x ∈ F, e x = x := by + let G := O ∩ K ⁻¹' Fᶜ + have hG : IsOpen G := hK.hc.isOpen_inter_preimage hK.isOpen hF.isOpen_compl + have h01 : θ 0 < θ 1 := hθm (show (0 : unitInterval) < 1 by norm_num) + have hseg : Complex.ofReal '' Icc (θ 0) (θ 1) ⊆ G := by + rintro z ⟨r, hr, rfl⟩ + have himage := hθc.image_Icc_of_strictMono (a := 0) (b := 1) hθm + obtain ⟨t, _, ht⟩ := (himage.symm ▸ hr : r ∈ θ '' Icc 0 1) + subst r + refine ⟨(hθK t).1, ?_⟩ + change K (θ t) ∉ F + rw [(hθK t).2] + exact fun hx => Set.disjoint_left.mp havoid (mem_range_self t) hx + obtain ⟨δ, hδ, hrect⟩ := exists_strip_rectangle hG h01.le hseg + have hleft : θ 0 - δ < θ 0 := sub_lt_self _ hδ + have hright : θ 1 < θ 1 + δ := lt_add_of_pos_right _ hδ + obtain ⟨ψ, hψc, hψm, hψl, hψr, hψend, hψle⟩ := + exists_slide_fun hleft h01 hright + have hab : θ 0 - δ < θ 1 + δ := hleft.trans (h01.trans hright) + obtain ⟨e, hfix, haxis, _⟩ := exists_slide hK hab hδ + (fun z hz => (hrect hz).1) hψc hψm hψl hψr hψle + refine ⟨e, ?_, ?_⟩ + · have he := haxis (θ 1) ⟨hleft.le.trans h01.le, hright.le⟩ + rw [hψend, (hθK 1).2, (hθK 0).2] at he + exact he + · intro x hx + apply hfix + rintro ⟨z, hz, rfl⟩ + exact (hrect hz).2 hx + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4StripRectangle.lean b/LeanPool/GraphMinor/GM12/Section4StripRectangle.lean new file mode 100644 index 0000000000..0e763c0eec --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4StripRectangle.lean @@ -0,0 +1,68 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ArcDisc +import Mathlib.Topology.MetricSpace.Thickening + +/-! +# A rectangle around a compact straight arc + +For XII (4.3), claim (7), page 251, motions along arcs must have +support in an assigned open set. A compact real interval in an open +plane set has a thin rectangular neighborhood in that set. The +rectangle extends beyond both ends, so a strip slide can move one +end to the other. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Metric Complex + +/-- A compact straight arc has a rectangular neighborhood extending +past both ends inside any prescribed open neighborhood. -/ +theorem exists_strip_rectangle {O : Set ℂ} (hO : IsOpen O) + {x y : ℝ} (hxy : x ≤ y) (hseg : Complex.ofReal '' Icc x y ⊆ O) : + ∃ δ : ℝ, 0 < δ ∧ Icc (x - δ) (y + δ) ×ℂ Icc (-δ) δ ⊆ O := by + obtain ⟨ρ, hρ, htube⟩ := + (isCompact_Icc.image Complex.continuous_ofReal).exists_thickening_subset_open hO hseg + let δ := ρ / 4 + have hδ : 0 < δ := div_pos hρ (by norm_num) + refine ⟨δ, hδ, ?_⟩ + intro z hz + let r := max x (min y z.re) + have hr : r ∈ Icc x y := + ⟨le_max_left _ _, max_le hxy (min_le_left _ _)⟩ + have hzr : |z.re - r| ≤ δ := by + rw [abs_le] + constructor + · have hrle : r ≤ z.re + δ := by + apply max_le + · linarith [hz.1.1] + · exact (min_le_right _ _).trans (le_add_of_nonneg_right hδ.le) + linarith + · have hrge : z.re - δ ≤ r := by + apply le_trans _ (le_max_right _ _) + apply le_min + · linarith [hz.1.2] + · exact sub_le_self _ hδ.le + linarith + apply htube + apply mem_thickening_iff.mpr + refine ⟨(r : ℂ), ⟨r, hr, rfl⟩, ?_⟩ + rw [dist_eq_norm] + have hn := norm_le_abs_re_add_abs_im (z - (r : ℂ)) + simp only [sub_re, ofReal_re, sub_im, ofReal_im, sub_zero] at hn + have him : |z.im| ≤ δ := abs_le.mpr hz.2 + have htwo : 2 * δ < ρ := by dsimp only [δ]; linarith + exact lt_of_le_of_lt (hn.trans (add_le_add hzr him)) (by linarith) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SubdivisionArcIncidence.lean b/LeanPool/GraphMinor/GM12/Section4SubdivisionArcIncidence.lean new file mode 100644 index 0000000000..86a3567996 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SubdivisionArcIncidence.lean @@ -0,0 +1,103 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4FamilyCuts +public import LeanPool.GraphMinor.GM12.Section4SubdivisionIncidence +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Incidence of the global subdivision arc family + +In XII (4.5), page 252, the arc portions must represent the +edges of the subdivision graph. The global vertices on an old +edge are exactly its own cuts, and each portion contains exactly +its two endpoint cuts. Injectivity of the global position map +therefore identifies membership in an arc with graph incidence. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Graph + +/-- A new edge arc is its indexed portion of an original edge, +in the subdivision of XII (4.5), page 252. -/ +@[expose] def subdivisionEdgeArc {n : ℕ} (k : Fin n → ℕ) + (P : ∀ e, Fin (k e) → Set ℂ) (e : Σ f : Fin n, Fin (k f)) : Set ℂ := P e.1 e.2 + +/-- The vertex-position map and arc portions give the exact +incidence of the subdivision graph in XII (4.5), page 252. -/ +theorem subdivisionEdgeArc_vertex_inc_iff {m n : ℕ} + (V : Fin m → ℂ) (κ : Fin n × Bool → Fin m) (E : Fin n → Set ℂ) + (k : Fin n → ℕ) (hk : ∀ e, 0 < k e) + (w : ∀ e, Fin (k e + 1) → ℂ) (P : ∀ e, Fin (k e) → Set ℂ) + (hV : Function.Injective V) (hw : ∀ e, Function.Injective (w e)) + (hw0 : ∀ e, w e 0 = V (κ (e, false))) + (hwlast : ∀ e, w e (Fin.last (k e)) = V (κ (e, true))) + (hline : ∀ e i, IsLineWithEnds (P e i) (w e i.castSucc) (w e i.succ)) + (hcover : ∀ e, (⋃ i, P e i) = E e) + (havoid : ∀ e i, w e i ∉ E e ∩ edgeMeetingPoints V E) + (hPvertices : ∀ e i, P e i ∩ range (w e) = {w e i.castSucc, w e i.succ}) + (hvertex : ∀ e v, V v ∈ E e ↔ v = κ (e, false) ∨ v = κ (e, true)) + (e : Σ f : Fin n, Fin (k f)) (z : SubdivisionVertex m n k) : + subdivisionPosition V k w z ∈ subdivisionEdgeArc k P e ↔ (subdivisionGraph κ k).Inc e z := by + have hmem := family_cut_mem_original_edge E k hk w P hline hcover + have hinterior := internal_family_cut_not_mem_vertices V κ E k w hw hw0 hwlast hmem hvertex + have hinj := subdivisionPosition_injective V E k w hV hw hmem havoid hinterior + have hglobal := original_edge_inter_subdivisionPositions V κ E k hk w hw0 hwlast + hmem havoid hvertex hinterior e.1 + have hsub : P e.1 e.2 ⊆ E e.1 := by + intro x hx + rw [← hcover e.1] + exact mem_iUnion.mpr ⟨e.2, hx⟩ + have hcut : P e.1 e.2 ∩ range (subdivisionPosition V k w) = + {w e.1 e.2.castSucc, w e.1 e.2.succ} := by + calc + P e.1 e.2 ∩ range (subdivisionPosition V k w) = + P e.1 e.2 ∩ (E e.1 ∩ range (subdivisionPosition V k w)) := by + ext x + exact ⟨fun h => ⟨h.1, hsub h.1, h.2⟩, fun h => ⟨h.1, h.2.2⟩⟩ + _ = P e.1 e.2 ∩ range (w e.1) := by rw [hglobal] + _ = {w e.1 e.2.castSucc, w e.1 e.2.succ} := hPvertices e.1 e.2 + have hleft := subdivisionPosition_vertexAt V κ k hk w hw0 hwlast e.1 e.2.castSucc + have hright := subdivisionPosition_vertexAt V κ k hk w hw0 hwlast e.1 e.2.succ + rw [subdivisionGraph_inc_iff] + constructor + · intro hz + have hends : subdivisionPosition V k w z = w e.1 e.2.castSucc ∨ + subdivisionPosition V k w z = w e.1 e.2.succ := + show subdivisionPosition V k w z ∈ ({w e.1 e.2.castSucc, w e.1 e.2.succ} : Set ℂ) from + hcut ▸ And.intro hz (mem_range_self z) + exact hends.elim (fun h => Or.inl (hinj (h.trans hleft.symm))) + (fun h => Or.inr (hinj (h.trans hright.symm))) + · rintro (rfl | rfl) + · rw [hleft] + exact (hline e.1 e.2).left_mem + · rw [hright] + exact (hline e.1 e.2).right_mem + +/-- Each new edge arc is a line with the positions of its graph +endpoints as ends. -/ +theorem subdivisionEdgeArc_isLine {m n : ℕ} + (V : Fin m → ℂ) (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) (hk : ∀ e, 0 < k e) + (w : ∀ e, Fin (k e + 1) → ℂ) (P : ∀ e, Fin (k e) → Set ℂ) + (hw0 : ∀ e, w e 0 = V (κ (e, false))) + (hwlast : ∀ e, w e (Fin.last (k e)) = V (κ (e, true))) + (hline : ∀ e i, IsLineWithEnds (P e i) (w e i.castSucc) (w e i.succ)) + (e : Σ f : Fin n, Fin (k f)) : + IsLineWithEnds (subdivisionEdgeArc k P e) + (subdivisionPosition V k w (subdivisionVertexAt κ k e.1 e.2.castSucc)) + (subdivisionPosition V k w (subdivisionVertexAt κ k e.1 e.2.succ)) := by + rw [subdivisionPosition_vertexAt V κ k hk w hw0 hwlast, + subdivisionPosition_vertexAt V κ k hk w hw0 hwlast] + exact hline e.1 e.2 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SubdivisionBranchConnected.lean b/LeanPool/GraphMinor/GM12/Section4SubdivisionBranchConnected.lean new file mode 100644 index 0000000000..eabb62341b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SubdivisionBranchConnected.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SubdivisionBranches +public import LeanPool.GraphMinor.Minor.Model +public import Mathlib.Combinatorics.Graph.Delete + +/-! +# Connectivity of the subdivision contraction branches + +To recover the original graph in XII (4.5), page 252, contract +all but the first edge of each subdivided chain. From each positive +cut, follow the later cuts to the original right endpoint. These +walks stay inside its branch and use no representing first edge. +They prove that every branch is connected after those edges are +deleted. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph Relation + +/-- Each subdivision contraction branch is connected after the +representing first edges are deleted. This proves the connectivity +part of the original-graph minor in XII (4.5), page 252. -/ +theorem subdivisionBranch_connected_subgraph {m n : ℕ} + (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) (hk : ∀ e, 0 < k e) (v : Fin m) : + ∃ K ≤ (subdivisionGraph κ k).deleteEdges (range (subdivisionFirstEdge k hk)), + K.vertexSet = subdivisionBranch κ k v ∧ GraphConnected K := by + let K := ((subdivisionGraph κ k).deleteEdges (range (subdivisionFirstEdge k hk))).induce + (subdivisionBranch κ k v) + have hpositive : ∀ e, κ (e, true) = v → ∀ r : Fin (k e + 1), 0 < r.val → + ReflTransGen K.Adj (subdivisionVertexAt κ k e r) (Sum.inl v) := by + intro e howner + refine Fin.reverseInduction ?_ ?_ + · intro _ + rw [subdivisionVertexAt_last κ k e (hk e), howner] + · intro i ih hi + have hleft : subdivisionVertexAt κ k e i.castSucc ∈ subdivisionBranch κ k v := + (mem_subdivisionBranch_vertexAt_pos κ k v e i.castSucc hi).mpr howner + have hright : subdivisionVertexAt κ k e i.succ ∈ subdivisionBranch κ k v := + (mem_subdivisionBranch_vertexAt_pos κ k v e i.succ (by change 0 < i.val + 1; omega)).mpr + howner + have hlK : K.IsLink ⟨e, i⟩ (subdivisionVertexAt κ k e i.castSucc) + (subdivisionVertexAt κ k e i.succ) := + ⟨⟨subdivisionGraph_isLink κ k e i, subdivisionEdge_not_mem_firstEdges k hk e i hi⟩, + hleft, hright⟩ + exact (ReflTransGen.single ⟨⟨e, i⟩, hlK⟩).trans (ih (by change 0 < i.val + 1; omega)) + have hreach : ∀ z ∈ subdivisionBranch κ k v, ReflTransGen K.Adj z (Sum.inl v) := by + intro z hz + cases z with + | inl w => + change w = v at hz + subst w + exact ReflTransGen.refl + | inr q => + obtain ⟨e, j⟩ := q + change κ (e, true) = v at hz + have hj : j.val + 1 < k e + 1 := Nat.succ_lt_succ (lt_of_lt_of_le j.isLt (Nat.sub_le _ _)) + have h := hpositive e hz ⟨j.val + 1, hj⟩ (by change 0 < j.val + 1; omega) + rw [subdivisionVertexAt_internal] at h + exact h + refine ⟨K, ?_, rfl, ⟨⟨Sum.inl v, rfl⟩, ?_⟩⟩ + · apply Graph.induce_le + intro z _ + exact mem_univ z + · intro x hx y hy + exact (hreach x hx).trans (symm (hreach y hy)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SubdivisionBranches.lean b/LeanPool/GraphMinor/GM12/Section4SubdivisionBranches.lean new file mode 100644 index 0000000000..08d619ecdb --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SubdivisionBranches.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SubdivisionIncidence + +/-! +# The branches contracting a subdivision + +XII (4.5), page 252, uses that the subdivided graph has the +original clique as a minor. Assign every internal vertex of an +original edge to its right endpoint. Keep the first new edge to +represent the original edge. The branches are disjoint and each +later cut on an edge belongs to the branch of its right endpoint. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph + +/-- The branch at an original vertex, containing all internal +vertices assigned from right ends in the subdivision of XII (4.5), page 252. -/ +@[expose] def subdivisionBranch {m n : ℕ} (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) + (v : Fin m) : Set (SubdivisionVertex m n k) := + {x | match x with + | Sum.inl w => w = v + | Sum.inr ⟨e, _⟩ => κ (e, true) = v} + +/-- The first new edge represents the original edge after the +remaining edges are contracted, in XII (4.5), page 252. -/ +@[expose] def subdivisionFirstEdge {n : ℕ} (k : Fin n → ℕ) (hk : ∀ e, 0 < k e) + (e : Fin n) : Σ f : Fin n, Fin (k f) := ⟨e, ⟨0, hk e⟩⟩ + +theorem mem_subdivisionBranch_original {m n : ℕ} (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) + (v w : Fin m) : Sum.inl w ∈ subdivisionBranch κ k v ↔ w = v := Iff.rfl + +theorem mem_subdivisionBranch_internal {m n : ℕ} (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) + (v : Fin m) (e : Fin n) (i : Fin (k e - 1)) : + Sum.inr ⟨e, i⟩ ∈ subdivisionBranch κ k v ↔ κ (e, true) = v := Iff.rfl + +/-- Every contraction branch contains its original vertex. -/ +theorem subdivisionBranch_nonempty {m n : ℕ} (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) + (v : Fin m) : (subdivisionBranch κ k v).Nonempty := ⟨Sum.inl v, rfl⟩ + +/-- Distinct original vertices have disjoint subdivision branches. -/ +theorem subdivisionBranch_disjoint {m n : ℕ} (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) + {v w : Fin m} (hvw : v ≠ w) : Disjoint (subdivisionBranch κ k v) (subdivisionBranch κ k w) := by + apply disjoint_left.mpr + intro x hx hy + cases x with + | inl z => exact hvw (hx.symm.trans hy) + | inr q => exact hvw (hx.symm.trans hy) + +/-- Every positive cut belongs to the branch of its edge's right +endpoint, including the last cut. -/ +theorem mem_subdivisionBranch_vertexAt_pos {m n : ℕ} + (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) (v : Fin m) (e : Fin n) + (i : Fin (k e + 1)) (hi : 0 < i.val) : + subdivisionVertexAt κ k e i ∈ subdivisionBranch κ k v ↔ κ (e, true) = v := by + unfold subdivisionVertexAt + split_ifs with hzero hlast + · omega + · rfl + · rfl + +/-- The first cut belongs to the branch of its original left endpoint. -/ +theorem mem_subdivisionBranch_vertexAt_zero {m n : ℕ} + (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) (v : Fin m) (e : Fin n) : + subdivisionVertexAt κ k e 0 ∈ subdivisionBranch κ k v ↔ κ (e, false) = v := by + rw [subdivisionVertexAt_zero] + rfl + +/-- Different original edges keep different first edges. -/ +theorem subdivisionFirstEdge_injective {n : ℕ} (k : Fin n → ℕ) (hk : ∀ e, 0 < k e) : + Function.Injective (subdivisionFirstEdge k hk) := by + intro e f hef + exact congrArg Sigma.fst hef + +/-- A later edge of a subdivision chain is not a representing +first edge. Thus it remains available within its contraction branch. -/ +theorem subdivisionEdge_not_mem_firstEdges {n : ℕ} (k : Fin n → ℕ) (hk : ∀ e, 0 < k e) + (e : Fin n) (i : Fin (k e)) (hi : 0 < i.val) : + (⟨e, i⟩ : Σ f : Fin n, Fin (k f)) ∉ range (subdivisionFirstEdge k hk) := by + rintro ⟨f, hf⟩ + have hval := congrArg (fun q : Σ f : Fin n, Fin (k f) => q.2.val) hf + change 0 = i.val at hval + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SubdivisionCover.lean b/LeanPool/GraphMinor/GM12/Section4SubdivisionCover.lean new file mode 100644 index 0000000000..bfdbfeb9e0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SubdivisionCover.lean @@ -0,0 +1,83 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SubdivisionCuts +import Mathlib.Data.Nat.Find + +/-! +# The subdivision intervals cover the edge + +In XII (4.5), page 252, subdivision keeps the whole original +edge arc. For a parameter between zero and one, choose the first +cut at or above it. The preceding cut is below it, unless the +first cut is zero, in which case the first interval contains it. +Thus the closed intervals between consecutive cuts cover `[0,1]`. +-/ + +public section + +namespace GraphMinor.GM12 + +/-- Every point of the original parameter interval belongs to a +subdivision interval. This proves that the subdivision of XII +(4.5), page 252, retains the entire edge arc. -/ +theorem exists_subdivisionInterval_of_mem_Icc {k : ℕ} (hk : 0 < k) + (t : Fin k → ℝ) (ht : StrictMono t) (ht01 : ∀ i, 0 < t i ∧ t i < 1) + {x : ℝ} (hx : x ∈ Set.Icc (0 : ℝ) 1) : + ∃ i : Fin k, x ∈ Set.Icc (subdivisionCut t i.castSucc) (subdivisionCut t i.succ) := by + classical + let P : ℕ → Prop := fun r => ∃ hr : r < k + 1, x ≤ subdivisionCut t ⟨r, hr⟩ + have hex : ∃ r, P r := by + refine ⟨k, Nat.lt_succ_self k, ?_⟩ + change x ≤ subdivisionCut t (Fin.last k) + rw [subdivisionCut_last hk] + exact hx.2 + let r := Nat.find hex + obtain ⟨hrbound, hupper⟩ := Nat.find_spec hex + change x ≤ subdivisionCut t ⟨r, hrbound⟩ at hupper + by_cases hrzero : r = 0 + · have hrfin : (⟨r, hrbound⟩ : Fin (k + 1)) = 0 := Fin.ext hrzero + rw [hrfin, subdivisionCut_zero] at hupper + refine ⟨⟨0, hk⟩, ?_, ?_⟩ + · change subdivisionCut t 0 ≤ x + rw [subdivisionCut_zero] + exact hx.1 + · exact hupper.trans (subdivisionCut_mem_Icc hk t ht ht01 _).1 + · let i : Fin k := ⟨r - 1, by omega⟩ + have hright : i.succ = (⟨r, hrbound⟩ : Fin (k + 1)) := by + apply Fin.ext + change r - 1 + 1 = r + omega + refine ⟨i, ?_, ?_⟩ + · by_contra hnot + have hlt : x < subdivisionCut t i.castSucc := lt_of_not_ge hnot + have hcand : P (r - 1) := ⟨by omega, hlt.le⟩ + have hmin := Nat.find_min' hex hcand + change r ≤ r - 1 at hmin + omega + · rw [hright] + exact hupper + +/-- The union of the closed subdivision intervals is exactly the +parameter interval of the original edge in XII (4.5), page 252. -/ +theorem iUnion_subdivisionIntervals {k : ℕ} (hk : 0 < k) + (t : Fin k → ℝ) (ht : StrictMono t) (ht01 : ∀ i, 0 < t i ∧ t i < 1) : + (⋃ i : Fin k, Set.Icc (subdivisionCut t i.castSucc) (subdivisionCut t i.succ)) = + Set.Icc (0 : ℝ) 1 := by + apply Set.Subset.antisymm + · intro x hx + obtain ⟨i, hi⟩ := Set.mem_iUnion.mp hx + exact ⟨(subdivisionCut_mem_Icc hk t ht ht01 i.castSucc).1.trans hi.1, + hi.2.trans (subdivisionCut_mem_Icc hk t ht ht01 i.succ).2⟩ + · intro x hx + obtain ⟨i, hi⟩ := exists_subdivisionInterval_of_mem_Icc hk t ht ht01 hx + exact Set.mem_iUnion.mpr ⟨i, hi⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SubdivisionCrossingModel.lean b/LeanPool/GraphMinor/GM12/Section4SubdivisionCrossingModel.lean new file mode 100644 index 0000000000..af7c74a925 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SubdivisionCrossingModel.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SubdivisionStraightness +public import LeanPool.GraphMinor.GM12.Section4CrossingLineModel +public import LeanPool.GraphMinor.GM12.Section4CrossingPoints + +/-! +# The local crossing model of the subdivided source + +For XII (4.5), claim (1), page 253, an old crossing lies on two +inner chords and hence in the open unit disc. Select the new +subdivision piece on each old edge that contains the crossing. +Each piece agrees locally with its old supporting line. The +distinct supporting lines give continuous real-linear crossing +coordinates on a common open neighborhood. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Metric + +/-- Every crossing of the source subdivision has an actual +local straight-line coordinate model, derived from the chord +construction and subdivision equations. This supplies the +local input to the crossing-disc construction in XII (4.5), +claim (1), page 253. -/ +theorem exists_subdivision_crossing_model {α : Type*} {n : ℕ} + (V : α → ℂ) (E : Fin n → Set ℂ) (s : Fin n × Bool → ℝ) + (hinj : Function.Injective (fun q => (ee (s q) : ℂ))) + (hchord : ∀ e, E e ∩ closedBall 0 1 = + segment ℝ (ee (s (e, false)) : ℂ) (ee (s (e, true)) : ℂ)) + (hEinter : ∀ e f, e ≠ f → E e ∩ E f ⊆ + (segment ℝ (ee (s (e, false)) : ℂ) (ee (s (e, true)) : ℂ) ∩ + segment ℝ (ee (s (f, false)) : ℂ) (ee (s (f, true)) : ℂ)) ∪ range V) + (k : Fin n → ℕ) (w : ∀ e, Fin (k e + 1) → ℂ) (P : ∀ e, Fin (k e) → Set ℂ) + (hline : ∀ e i, IsLineWithEnds (P e i) (w e i.castSucc) (w e i.succ)) + (hcover : ∀ e, (⋃ i, P e i) = E e) + (havoid : ∀ e i, w e i ∉ E e ∩ edgeMeetingPoints V E) + (hinter : ∀ e i j, i ≠ j → P e i ∩ P e j ⊆ range (w e)) + {x : ℂ} (hx : x ∈ edgeMeetingPoints V E) : + ∃ (e f : Fin n) (i : Fin (k e)) (j : Fin (k f)), e ≠ f ∧ x ∈ P e i ∩ P f j ∧ + ∃ (A : ℂ ≃L[ℝ] ℂ) (U : Set ℂ), IsOpen U ∧ x ∈ U ∧ + P e i ∩ U = (line[ℝ, x, x + A 1] : Set ℂ) ∩ U ∧ + P f j ∩ U = (line[ℝ, x, x + A Complex.I] : Set ℂ) ∩ U := by + have hxM := hx + obtain ⟨e, f, hef, hxE, hxV⟩ := hx + let a := fun q : Fin n × Bool => (ee (s q) : ℂ) + have hab : a (e, false) ≠ a (e, true) := by + intro h + exact Bool.false_ne_true (congrArg Prod.snd (hinj h)) + have hcd : a (f, false) ≠ a (f, true) := by + intro h + exact Bool.false_ne_true (congrArg Prod.snd (hinj h)) + have hcross : ∀ b c : Bool, a (e, b) ≠ a (f, c) := by + intro b c h + exact hef (congrArg Prod.fst (hinj h)) + have hunit : ∀ q, ‖a q‖ = 1 := by intro q; simp [a] + have hxchords := (hEinter e f hef hxE).resolve_right hxV + have hxB : x ∈ ball (0 : ℂ) 1 := unit_chord_inter_subset_openBall + (hunit (e, false)) (hunit (e, true)) (hunit (f, false)) (hunit (f, true)) + hab hcd (hcross false false) (hcross false true) (hcross true false) (hcross true true) hxchords + have hxeL : x ∈ line[ℝ, a (e, false), a (e, true)] := + (line[ℝ, a (e, false), a (e, true)]).convex.segment_subset + (left_mem_affineSpan_pair _ _ _) (right_mem_affineSpan_pair _ _ _) hxchords.1 + have hxfL : x ∈ line[ℝ, a (f, false), a (f, true)] := + (line[ℝ, a (f, false), a (f, true)]).convex.segment_subset + (left_mem_affineSpan_pair _ _ _) (right_mem_affineSpan_pair _ _ _) hxchords.2 + obtain ⟨i, hxi⟩ := mem_iUnion.mp ((hcover e).symm ▸ hxE.1) + obtain ⟨j, hxj⟩ := mem_iUnion.mp ((hcover f).symm ▸ hxE.2) + obtain ⟨U, hU, hxU, hPU⟩ := exists_open_subdivision_line_agreement + (E e) (edgeMeetingPoints V E) (w e) (P e) (hline e) (hcover e) (havoid e) (hinter e) + (hunit (e, false)) (hunit (e, true)) hab (hchord e) ⟨hxi, hxE.1, hxM⟩ hxB + obtain ⟨W, hW, hxW, hPW⟩ := exists_open_subdivision_line_agreement + (E f) (edgeMeetingPoints V E) (w f) (P f) (hline f) (hcover f) (havoid f) (hinter f) + (hunit (f, false)) (hunit (f, true)) hcd (hchord f) ⟨hxj, hxE.2, hxM⟩ hxB + have hne := lines_ne_of_distinct_unit_ports (a (e, true)) (hunit (e, false)) + (hunit (f, false)) (hunit (f, true)) hcd (hcross false false) (hcross false true) + obtain ⟨A, hAe, hAf⟩ := exists_cross_coordinates_for_chords + (hunit (e, false)) (hunit (f, false)) hxB hxeL hxfL hne + refine ⟨e, f, i, j, hef, ⟨hxi, hxj⟩, A, U ∩ W, hU.inter hW, ⟨hxU, hxW⟩, ?_, ?_⟩ + · rw [← inter_assoc, hPU] + rw [← hAe, inter_assoc] + · rw [inter_comm U W, ← inter_assoc, hPW] + rw [← hAf, inter_assoc] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SubdivisionCuts.lean b/LeanPool/GraphMinor/GM12/Section4SubdivisionCuts.lean new file mode 100644 index 0000000000..fb2f202318 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SubdivisionCuts.lean @@ -0,0 +1,142 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Order.Fin.Basic +public import Mathlib.Basic.Real.Basic +public import Mathlib.Order.Interval.Set.Basic +import Mathlib.Tactic.Linarith + +/-! +# Subdivision cuts between consecutive crossings + +XII (4.5), page 252, subdivides an edge with `k` crossings `k - 1` +times so that every resulting edge has one crossing. In an arc +parametrization, list the crossing parameters in increasing order. +Use their consecutive midpoints as cuts, together with zero and +one at the ends. Each crossing lies strictly between its two cuts. +-/ + +public section + +namespace GraphMinor.GM12 + +/-- The endpoint parameters and the midpoints between consecutive +crossing parameters in the subdivision step of XII (4.5), page 252. -/ +@[expose] noncomputable def subdivisionCut {k : ℕ} (t : Fin k → ℝ) (i : Fin (k + 1)) : ℝ := + if hzero : i.val = 0 then 0 else + if hlast : i.val = k then 1 else + (t ⟨i.val - 1, by have := i.isLt; omega⟩ + + t ⟨i.val, by have := i.isLt; omega⟩) / 2 + +/-- The first subdivision cut is the first end of the arc. -/ +theorem subdivisionCut_zero {k : ℕ} (t : Fin k → ℝ) : subdivisionCut t 0 = 0 := by + simp only [subdivisionCut, Fin.val_zero, ↓reduceDIte] + +/-- With at least one crossing, the last subdivision cut is the +last end of the arc. -/ +theorem subdivisionCut_last {k : ℕ} (hk : 0 < k) (t : Fin k → ℝ) : + subdivisionCut t (Fin.last k) = 1 := by + simp only [subdivisionCut, Fin.val_last, Nat.ne_of_gt hk, ↓reduceDIte] + +/-- Each crossing lies strictly between its neighboring cuts. +This proves that cutting at the selected midpoints retains the +crossing in its own edge in XII (4.5), page 252. -/ +theorem crossing_between_subdivisionCuts {k : ℕ} (t : Fin k → ℝ) + (ht : StrictMono t) (ht01 : ∀ i, 0 < t i ∧ t i < 1) (i : Fin k) : + subdivisionCut t i.castSucc < t i ∧ t i < subdivisionCut t i.succ := by + constructor + · unfold subdivisionCut + simp only [Fin.val_castSucc] + split_ifs with hzero hlast + · exact (ht01 i).1 + · exact False.elim ((Nat.ne_of_lt i.isLt) hlast) + · have hpre : t ⟨i.val - 1, by omega⟩ < t i := by + apply ht + change i.val - 1 < i.val + omega + linarith + · have hzero : i.val + 1 ≠ 0 := by omega + have hkzero : k ≠ 0 := by omega + by_cases hlast : i.val + 1 = k + · simp only [subdivisionCut, Fin.val_succ, hlast, hkzero, ↓reduceDIte] + exact (ht01 i).2 + · simp only [subdivisionCut, Fin.val_succ, hzero, hlast, ↓reduceDIte] + have hback : (⟨i.val + 1 - 1, by omega⟩ : Fin k) = i := by + apply Fin.ext + change i.val + 1 - 1 = i.val + omega + rw [hback] + have hnext : t i < t ⟨i.val + 1, by omega⟩ := ht (by change i.val < i.val + 1; omega) + linarith + +/-- The subdivision cuts occur in strict order along the arc. -/ +theorem subdivisionCut_strictMono {k : ℕ} (t : Fin k → ℝ) + (ht : StrictMono t) (ht01 : ∀ i, 0 < t i ∧ t i < 1) : + StrictMono (subdivisionCut t) := by + apply Fin.strictMono_iff_lt_succ.mpr + intro i + exact (crossing_between_subdivisionCuts t ht ht01 i).1.trans + (crossing_between_subdivisionCuts t ht ht01 i).2 + +/-- All subdivision cuts stay in the parameter interval of the +original edge arc. -/ +theorem subdivisionCut_mem_Icc {k : ℕ} (hk : 0 < k) (t : Fin k → ℝ) + (ht : StrictMono t) (ht01 : ∀ i, 0 < t i ∧ t i < 1) (i : Fin (k + 1)) : + subdivisionCut t i ∈ Set.Icc (0 : ℝ) 1 := by + have hmono := (subdivisionCut_strictMono t ht ht01).monotone + have hlo := hmono (show (0 : Fin (k + 1)) ≤ i from Nat.zero_le i.val) + have hhi := hmono (show i ≤ Fin.last k from Nat.le_of_lt_succ i.isLt) + rw [subdivisionCut_zero] at hlo + rw [subdivisionCut_last hk] at hhi + exact ⟨hlo, hhi⟩ + +/-- Each closed subdivision interval contains exactly its assigned +crossing parameter. This is the one-crossing-per-edge assertion +in the subdivision step of XII (4.5), page 252. -/ +theorem crossing_mem_subdivisionInterval_iff {k : ℕ} (t : Fin k → ℝ) + (ht : StrictMono t) (ht01 : ∀ i, 0 < t i ∧ t i < 1) (i j : Fin k) : + t i ∈ Set.Icc (subdivisionCut t j.castSucc) (subdivisionCut t j.succ) ↔ i = j := by + have hcuts := (subdivisionCut_strictMono t ht ht01).monotone + constructor + · intro hmem + by_contra hne + rcases lt_or_gt_of_ne hne with hij | hji + · have hsep := hcuts (show i.succ ≤ j.castSucc by change i.val + 1 ≤ j.val; omega) + have hlt := (crossing_between_subdivisionCuts t ht ht01 i).2.trans_le hsep + exact (not_le_of_gt hlt) hmem.1 + · have hsep := hcuts (show j.succ ≤ i.castSucc by change j.val + 1 ≤ i.val; omega) + have hlt := hsep.trans_lt (crossing_between_subdivisionCuts t ht ht01 i).1 + exact (not_le_of_gt hlt) hmem.2 + · rintro rfl + exact ⟨(crossing_between_subdivisionCuts t ht ht01 i).1.le, + (crossing_between_subdivisionCuts t ht ht01 i).2.le⟩ + +/-- No new subdivision vertex is a crossing. The cuts lie strictly +between consecutive crossing parameters in XII (4.5), page 252. -/ +theorem subdivisionCut_ne_crossing {k : ℕ} (t : Fin k → ℝ) + (ht : StrictMono t) (ht01 : ∀ i, 0 < t i ∧ t i < 1) + (i : Fin (k + 1)) (j : Fin k) : subdivisionCut t i ≠ t j := by + intro heq + have hmono := (subdivisionCut_strictMono t ht ht01).monotone + have hlo : j.castSucc < i := by + by_contra hnot + have hle := hmono (le_of_not_gt hnot) + have hlt := hle.trans_lt (crossing_between_subdivisionCuts t ht ht01 j).1 + exact hlt.ne heq + have hhi : i < j.succ := by + by_contra hnot + have hle := hmono (le_of_not_gt hnot) + have hlt := (crossing_between_subdivisionCuts t ht ht01 j).2.trans_le hle + exact hlt.ne heq.symm + change j.val < i.val at hlo + change i.val < j.val + 1 at hhi + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SubdivisionGraph.lean b/LeanPool/GraphMinor/GM12/Section4SubdivisionGraph.lean new file mode 100644 index 0000000000..a4795928bf --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SubdivisionGraph.lean @@ -0,0 +1,93 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Combinatorics.Graph.Basic +public import Mathlib.Order.Fin.Basic +public import Mathlib.Data.Fintype.Sigma +public import Mathlib.Data.Fintype.Sum + +/-! +# The finite subdivision graph + +XII (4.5), page 252, replaces an original edge with as many new +edges as it has crossings. Keep the original vertices and add the +internal cut vertices of each edge. A new edge joins two consecutive +cuts on its original edge. The first and last cuts are identified +with the two original endpoints. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Graph + +/-- The original vertices and the internal cut vertices of the +subdivision graph in XII (4.5), page 252. -/ +abbrev SubdivisionVertex (m n : ℕ) (k : Fin n → ℕ) := Fin m ⊕ (Σ e : Fin n, Fin (k e - 1)) + +/-- The vertex at a cut on an original edge. The endpoint cuts +are the original vertices, as in XII (4.5), page 252. -/ +def subdivisionVertexAt {m n : ℕ} (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) + (e : Fin n) (i : Fin (k e + 1)) : SubdivisionVertex m n k := + if hzero : i.val = 0 then Sum.inl (κ (e, false)) else + if hlast : i.val = k e then Sum.inl (κ (e, true)) else + Sum.inr ⟨e, ⟨i.val - 1, by have := i.isLt; omega⟩⟩ + +/-- The graph obtained by replacing every original edge by its +chain of consecutive cut intervals, in XII (4.5), page 252. -/ +def subdivisionGraph {m n : ℕ} (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) : + Graph (SubdivisionVertex m n k) (Σ e : Fin n, Fin (k e)) where + vertexSet := univ + edgeSet := univ + IsLink e x y := + (x = subdivisionVertexAt κ k e.1 e.2.castSucc ∧ y = subdivisionVertexAt κ k e.1 e.2.succ) ∨ + (x = subdivisionVertexAt κ k e.1 e.2.succ ∧ y = subdivisionVertexAt κ k e.1 e.2.castSucc) + isLink_symm := by + intro e _ + refine ⟨fun x y h => ?_⟩ + exact h.elim (fun h => Or.inr ⟨h.2, h.1⟩) (fun h => Or.inl ⟨h.2, h.1⟩) + eq_or_eq_of_isLink_of_isLink := by + intro e x y v w hxy hvw + rcases hxy with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> + rcases hvw with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> + first | exact Or.inl rfl | exact Or.inr rfl + edge_mem_iff_exists_isLink := by + intro e + exact ⟨fun _ => ⟨_, _, Or.inl ⟨rfl, rfl⟩⟩, fun _ => mem_univ e⟩ + left_mem_of_isLink := by intro e x y _; exact mem_univ x + +/-- The first cut on an edge is its original first endpoint. -/ +theorem subdivisionVertexAt_zero {m n : ℕ} (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) + (e : Fin n) : subdivisionVertexAt κ k e 0 = Sum.inl (κ (e, false)) := by + simp only [subdivisionVertexAt, Fin.val_zero, ↓reduceDIte] + +/-- The last cut on a nonempty edge chain is its original last endpoint. -/ +theorem subdivisionVertexAt_last {m n : ℕ} (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) + (e : Fin n) (hk : 0 < k e) : + subdivisionVertexAt κ k e (Fin.last (k e)) = Sum.inl (κ (e, true)) := by + simp only [subdivisionVertexAt, Fin.val_last, Nat.ne_of_gt hk, ↓reduceDIte] + +/-- An internal cut is the corresponding new vertex. -/ +theorem subdivisionVertexAt_internal {m n : ℕ} (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) + (e : Fin n) (j : Fin (k e - 1)) : + subdivisionVertexAt κ k e ⟨j.val + 1, by have := j.isLt; omega⟩ = Sum.inr ⟨e, j⟩ := by + have hzero : j.val + 1 ≠ 0 := by omega + have hlast : j.val + 1 ≠ k e := by have := j.isLt; omega + simp only [subdivisionVertexAt, hzero, hlast, ↓reduceDIte, Nat.add_sub_cancel] + +/-- Each new edge joins the two consecutive cuts that define it. -/ +theorem subdivisionGraph_isLink {m n : ℕ} (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) + (e : Fin n) (i : Fin (k e)) : + (subdivisionGraph κ k).IsLink ⟨e, i⟩ + (subdivisionVertexAt κ k e i.castSucc) (subdivisionVertexAt κ k e i.succ) := + Or.inl ⟨rfl, rfl⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SubdivisionIncidence.lean b/LeanPool/GraphMinor/GM12/Section4SubdivisionIncidence.lean new file mode 100644 index 0000000000..9855c7f3e2 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SubdivisionIncidence.lean @@ -0,0 +1,84 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SubdivisionGraph + +/-! +# Vertices and incidences of the subdivision graph + +In XII (4.5), page 252, consecutive cuts are the ends of a new +edge. The cut map on one original edge is injective when its +original endpoints are distinct. Consequently the subdivision +has no loops. Its incidence relation is exactly the pair of +consecutive cut vertices used to define each edge. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph + +private def localCutIndex {m n : ℕ} (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) + (e : Fin n) : SubdivisionVertex m n k → ℕ + | Sum.inl v => if v = κ (e, false) then 0 else k e + | Sum.inr ⟨_, j⟩ => j.val + 1 + +private theorem localCutIndex_vertexAt {m n : ℕ} + (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) (e : Fin n) + (hκ : κ (e, false) ≠ κ (e, true)) (i : Fin (k e + 1)) : + localCutIndex κ k e (subdivisionVertexAt κ k e i) = i.val := by + unfold subdivisionVertexAt + split_ifs with hzero hlast + · simp only [localCutIndex, ↓reduceIte] + exact hzero.symm + · simp only [localCutIndex, Ne.symm hκ, ↓reduceIte] + exact hlast.symm + · change i.val - 1 + 1 = i.val + omega + +/-- Different cuts on one loopless original edge give different +subdivision vertices, as used in XII (4.5), page 252. -/ +theorem subdivisionVertexAt_injective {m n : ℕ} + (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) (e : Fin n) + (hκ : κ (e, false) ≠ κ (e, true)) : Function.Injective (subdivisionVertexAt κ k e) := by + intro i j hij + have hidx := congrArg (localCutIndex κ k e) hij + rw [localCutIndex_vertexAt κ k e hκ, localCutIndex_vertexAt κ k e hκ] at hidx + exact Fin.ext hidx + +/-- A new subdivision edge is incident exactly with its two +consecutive cut vertices. -/ +theorem subdivisionGraph_inc_iff {m n : ℕ} + (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) + (e : Fin n) (i : Fin (k e)) (x : SubdivisionVertex m n k) : + (subdivisionGraph κ k).Inc ⟨e, i⟩ x ↔ + x = subdivisionVertexAt κ k e i.castSucc ∨ x = subdivisionVertexAt κ k e i.succ := by + constructor + · rintro ⟨y, hxy⟩ + exact hxy.elim (fun h => Or.inl h.1) (fun h => Or.inr h.1) + · rintro (rfl | rfl) + · exact (subdivisionGraph_isLink κ k e i).inc_left + · exact (subdivisionGraph_isLink κ k e i).inc_right + +/-- Subdividing loopless edges leaves a loopless graph, as in +XII (4.5), page 252. -/ +theorem subdivisionGraph_loopless {m n : ℕ} + (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) + (hκ : ∀ e, κ (e, false) ≠ κ (e, true)) : + ∀ e x, ¬ (subdivisionGraph κ k).IsLink e x x := by + rintro ⟨e, i⟩ x hx + have hend : subdivisionVertexAt κ k e i.castSucc = subdivisionVertexAt κ k e i.succ := + hx.elim (fun h => h.1.symm.trans h.2) (fun h => h.2.symm.trans h.1) + have hi := congrArg Fin.val (subdivisionVertexAt_injective κ k e (hκ e) hend) + change i.val = i.val + 1 at hi + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SubdivisionIntersections.lean b/LeanPool/GraphMinor/GM12/Section4SubdivisionIntersections.lean new file mode 100644 index 0000000000..7738d310fa --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SubdivisionIntersections.lean @@ -0,0 +1,94 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SubdivisionArcIncidence +import Mathlib.Data.Set.Finite.Range + +/-! +# Intersections after subdivision + +The source subdivision in XII (4.5), page 252, preserves finite +pairwise intersections and excludes triple meetings away from +vertices. Pieces of different old edges inherit the old finite +intersections. Pieces of one old edge meet only at cuts. For a +triple meeting, either two pieces belong to the same old edge, +or the three old edges already meet at an old vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Distinct new edge arcs meet finitely, preserving condition +(ii) of XII (4.5)'s source construction, page 252. -/ +theorem finite_subdivisionEdgeArc_inter {n : ℕ} + (E : Fin n → Set ℂ) (k : Fin n → ℕ) + (w : ∀ e, Fin (k e + 1) → ℂ) (P : ∀ e, Fin (k e) → Set ℂ) + (hcover : ∀ e, (⋃ i, P e i) = E e) + (hinter : ∀ e i j, i ≠ j → P e i ∩ P e j ⊆ range (w e)) + (hfinite : ∀ e f, e ≠ f → (E e ∩ E f).Finite) + {q r : Σ e : Fin n, Fin (k e)} (hqr : q ≠ r) : + (subdivisionEdgeArc k P q ∩ subdivisionEdgeArc k P r).Finite := by + obtain ⟨e, i⟩ := q + obtain ⟨f, j⟩ := r + by_cases hef : e = f + · subst f + have hij : i ≠ j := fun h => hqr (by subst j; rfl) + exact (finite_range (w e)).subset (hinter e i j hij) + · apply (hfinite e f hef).subset + intro x hx + constructor + · rw [← hcover e] + exact mem_iUnion.mpr ⟨i, hx.1⟩ + · rw [← hcover f] + exact mem_iUnion.mpr ⟨j, hx.2⟩ + +/-- Triple meetings of new edge arcs occur only at subdivision +vertices. This preserves condition (iv) of XII (4.5)'s source +construction, page 252. -/ +theorem subdivisionEdgeArcs_triple_subset_vertices {m n : ℕ} + (V : Fin m → ℂ) (κ : Fin n × Bool → Fin m) (E : Fin n → Set ℂ) + (k : Fin n → ℕ) (hk : ∀ e, 0 < k e) + (w : ∀ e, Fin (k e + 1) → ℂ) (P : ∀ e, Fin (k e) → Set ℂ) + (hw0 : ∀ e, w e 0 = V (κ (e, false))) + (hwlast : ∀ e, w e (Fin.last (k e)) = V (κ (e, true))) + (hcover : ∀ e, (⋃ i, P e i) = E e) + (hinter : ∀ e i j, i ≠ j → P e i ∩ P e j ⊆ range (w e)) + (htriple : ∀ e f g, e ≠ f → f ≠ g → e ≠ g → E e ∩ E f ∩ E g ⊆ range V) : + ∀ q r s : Σ e : Fin n, Fin (k e), q ≠ r → r ≠ s → q ≠ s → + subdivisionEdgeArc k P q ∩ subdivisionEdgeArc k P r ∩ subdivisionEdgeArc k P s ⊆ + range (subdivisionPosition V k w) := by + have hcutrange : ∀ e, range (w e) ⊆ range (subdivisionPosition V k w) := by + rintro e x ⟨i, rfl⟩ + exact ⟨subdivisionVertexAt κ k e i, subdivisionPosition_vertexAt V κ k hk w hw0 hwlast e i⟩ + have hsub : ∀ e i, P e i ⊆ E e := by + intro e i x hx + rw [← hcover e] + exact mem_iUnion.mpr ⟨i, hx⟩ + rintro ⟨e, i⟩ ⟨f, j⟩ ⟨g, l⟩ hqr hrs hqs x hx + by_cases hef : e = f + · subst f + have hij : i ≠ j := fun h => hqr (by subst j; rfl) + exact hcutrange e (hinter e i j hij hx.1) + by_cases heg : e = g + · subst g + have hil : i ≠ l := fun h => hqs (by subst l; rfl) + exact hcutrange e (hinter e i l hil ⟨hx.1.1, hx.2⟩) + by_cases hfg : f = g + · subst g + have hjl : j ≠ l := fun h => hrs (by subst l; rfl) + exact hcutrange f (hinter f j l hjl ⟨hx.1.2, hx.2⟩) + · obtain ⟨v, hv⟩ := htriple e f g hef hfg heg + ⟨⟨hsub e i hx.1.1, hsub f j hx.1.2⟩, hsub g l hx.2⟩ + exact ⟨Sum.inl v, hv⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SubdivisionMeetings.lean b/LeanPool/GraphMinor/GM12/Section4SubdivisionMeetings.lean new file mode 100644 index 0000000000..b78ae42205 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SubdivisionMeetings.lean @@ -0,0 +1,101 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SubdivisionArcIncidence + +/-! +# Subdivision preserves the source meeting points + +In XII (4.5), pages 252--253, subdividing between crossings +keeps the same crossing points. Two pieces of one old edge can +meet only at cut vertices. Pieces of different old edges meet +away from new vertices only at old meetings. Conversely each old +meeting remains on pieces of its two old edges, and no cut was +chosen there. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Subdivision between the meetings creates no new meeting point +and removes none of the old ones. This identifies the crossing +points before and after the subdivision in XII (4.5), pages 252--253. -/ +theorem edgeMeetingPoints_subdivision_eq {m n : ℕ} + (V : Fin m → ℂ) (κ : Fin n × Bool → Fin m) (E : Fin n → Set ℂ) + (k : Fin n → ℕ) (hk : ∀ e, 0 < k e) + (w : ∀ e, Fin (k e + 1) → ℂ) (P : ∀ e, Fin (k e) → Set ℂ) + (hw0 : ∀ e, w e 0 = V (κ (e, false))) + (hwlast : ∀ e, w e (Fin.last (k e)) = V (κ (e, true))) + (hline : ∀ e i, IsLineWithEnds (P e i) (w e i.castSucc) (w e i.succ)) + (hcover : ∀ e, (⋃ i, P e i) = E e) + (havoid : ∀ e i, w e i ∉ E e ∩ edgeMeetingPoints V E) + (hinter : ∀ e i j, i ≠ j → P e i ∩ P e j ⊆ range (w e)) : + edgeMeetingPoints (subdivisionPosition V k w) (subdivisionEdgeArc k P) = edgeMeetingPoints V E + := by + have hmem := family_cut_mem_original_edge E k hk w P hline hcover + have hdisj := disjoint_subdivisionPositions_meetings V E k w hmem havoid + have hcutrange : ∀ e, range (w e) ⊆ range (subdivisionPosition V k w) := by + rintro e x ⟨r, rfl⟩ + exact ⟨subdivisionVertexAt κ k e r, subdivisionPosition_vertexAt V κ k hk w hw0 hwlast e r⟩ + have hsub : ∀ e i, P e i ⊆ E e := by + intro e i x hx + rw [← hcover e] + exact mem_iUnion.mpr ⟨i, hx⟩ + ext x + constructor + · rintro ⟨⟨e, i⟩, ⟨f, j⟩, hne, hx, hxV⟩ + by_cases hef : e = f + · subst f + have hij : i ≠ j := fun h => hne (by subst j; rfl) + exact False.elim (hxV (hcutrange e (hinter e i j hij hx))) + · refine ⟨e, f, hef, ⟨hsub e i hx.1, hsub f j hx.2⟩, ?_⟩ + rintro ⟨v, hv⟩ + exact hxV ⟨Sum.inl v, hv⟩ + · intro hx + obtain ⟨e, f, hef, hxEf, hxV⟩ := hx + have hxe : x ∈ ⋃ i, P e i := (hcover e).symm ▸ hxEf.1 + have hxf : x ∈ ⋃ j, P f j := (hcover f).symm ▸ hxEf.2 + obtain ⟨i, hxi⟩ := mem_iUnion.mp hxe + obtain ⟨j, hxj⟩ := mem_iUnion.mp hxf + refine ⟨⟨e, i⟩, ⟨f, j⟩, (fun h => hef (congrArg Sigma.fst h)), ⟨hxi, hxj⟩, ?_⟩ + intro hxnewV + exact disjoint_left.mp hdisj hxnewV ⟨e, f, hef, hxEf, hxV⟩ + +/-- Each new edge has exactly one of the unchanged meeting points. +This is the one-crossing-per-edge conclusion in XII (4.5), page 252. -/ +theorem subdivisionEdgeArc_one_meeting {m n : ℕ} + (V : Fin m → ℂ) (κ : Fin n × Bool → Fin m) (E : Fin n → Set ℂ) + (k : Fin n → ℕ) (hk : ∀ e, 0 < k e) + (w : ∀ e, Fin (k e + 1) → ℂ) (P : ∀ e, Fin (k e) → Set ℂ) + (hw0 : ∀ e, w e 0 = V (κ (e, false))) + (hwlast : ∀ e, w e (Fin.last (k e)) = V (κ (e, true))) + (hline : ∀ e i, IsLineWithEnds (P e i) (w e i.castSucc) (w e i.succ)) + (hcover : ∀ e, (⋃ i, P e i) = E e) + (havoid : ∀ e i, w e i ∉ E e ∩ edgeMeetingPoints V E) + (hinter : ∀ e i j, i ≠ j → P e i ∩ P e j ⊆ range (w e)) + (hmeet : ∀ e i, ∃ x ∈ E e ∩ edgeMeetingPoints V E, P e i ∩ (E e ∩ edgeMeetingPoints V E) = {x}) + (q : Σ e : Fin n, Fin (k e)) : + ∃ x ∈ edgeMeetingPoints (subdivisionPosition V k w) (subdivisionEdgeArc k P), + subdivisionEdgeArc k P q ∩ + edgeMeetingPoints (subdivisionPosition V k w) (subdivisionEdgeArc k P) = {x} := by + rw [edgeMeetingPoints_subdivision_eq V κ E k hk w P hw0 hwlast hline hcover havoid hinter] + obtain ⟨x, hx, hPx⟩ := hmeet q.1 q.2 + refine ⟨x, hx.2, ?_⟩ + have hsub : P q.1 q.2 ⊆ E q.1 := by + intro y hy + rw [← hcover q.1] + exact mem_iUnion.mpr ⟨q.2, hy⟩ + rw [← inter_assoc, inter_eq_self_of_subset_left hsub] at hPx + exact hPx + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SubdivisionMinor.lean b/LeanPool/GraphMinor/GM12/Section4SubdivisionMinor.lean new file mode 100644 index 0000000000..833ae5208b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SubdivisionMinor.lean @@ -0,0 +1,99 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SubdivisionBranchConnected +import LeanPool.GraphMinor.Minor.Basic + +/-! +# Recovering the original graph from its subdivision + +XII (4.5), page 252, uses that the source clique is a minor of +its subdivided graph. Contract the later edges of every chain +inside its right-end branch, and keep the first edge to represent +the original one. The branch membership of its two ends gives +the incidence and loop conditions of the minor model. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph + +/-- Contracting every chain except its first edge gives the +original graph. This proves the minor-model assertion for the +subdivision in XII (4.5), page 252, including possible original loops. -/ +theorem isMinorModel_subdivision {m n : ℕ} (H : Graph (Fin m) (Fin n)) + (κ : Fin n × Bool → Fin m) (hlink : ∀ e, H.IsLink e (κ (e, false)) (κ (e, true))) + (k : Fin n → ℕ) (hk : ∀ e, 0 < k e) : + IsMinorModel H (subdivisionGraph κ k) (subdivisionBranch κ k) (subdivisionFirstEdge k hk) := by + let l : Fin n → SubdivisionVertex m n k := fun e => + subdivisionVertexAt κ k e (⟨0, hk e⟩ : Fin (k e)).castSucc + let r : Fin n → SubdivisionVertex m n k := fun e => + subdivisionVertexAt κ k e (⟨0, hk e⟩ : Fin (k e)).succ + have hfirst : ∀ e, (subdivisionGraph κ k).IsLink (subdivisionFirstEdge k hk e) (l e) (r e) := + fun e => subdivisionGraph_isLink κ k e ⟨0, hk e⟩ + have hleft : ∀ e v, l e ∈ subdivisionBranch κ k v ↔ κ (e, false) = v := + fun e v => mem_subdivisionBranch_vertexAt_zero κ k v e + have hright : ∀ e v, r e ∈ subdivisionBranch κ k v ↔ κ (e, true) = v := + fun e v => mem_subdivisionBranch_vertexAt_pos κ k v e _ (by change 0 < 0 + 1; decide) + have hEall : H.edgeSet = univ := by + ext e + exact ⟨fun _ => mem_univ e, fun _ => (hlink e).edge_mem⟩ + refine { + vertex_nonempty := fun v _ => subdivisionBranch_nonempty κ k v + vertex_subset := fun _ _ _ _ => mem_univ _ + edge_mem := fun _ _ => mem_univ _ + vertex_disjoint := fun _ _ _ _ hne => subdivisionBranch_disjoint κ k hne + edge_injOn := (subdivisionFirstEdge_injective k hk).injOn + inc_iff := ?_ + isLoopAt_iff := ?_ + connected := ?_ } + · intro v _ e _ + constructor + · intro hev + rcases hev.eq_or_eq_of_isLink (hlink e) with hve | hve + · exact ⟨l e, (hleft e v).mpr hve.symm, (hfirst e).inc_left⟩ + · exact ⟨r e, (hright e v).mpr hve.symm, (hfirst e).inc_right⟩ + · rintro ⟨z, hz, hez⟩ + rcases hez.eq_or_eq_of_isLink (hfirst e) with hzl | hzr + · have hkv := (hleft e v).mp (hzl ▸ hz) + exact hkv ▸ (hlink e).inc_left + · have hkv := (hright e v).mp (hzr ▸ hz) + exact hkv ▸ (hlink e).inc_right + · intro v _ e _ + constructor + · intro hloop z hez + have hlv : κ (e, false) = v := + (H.eq_or_eq_of_isLink_of_isLink (hlink e) hloop).elim id id + have hrv : κ (e, true) = v := + (H.eq_or_eq_of_isLink_of_isLink (hlink e).symm hloop).elim id id + rcases hez.eq_or_eq_of_isLink (hfirst e) with hzl | hzr + · exact hzl ▸ (hleft e v).mpr hlv + · exact hzr ▸ (hright e v).mpr hrv + · intro hall + have hlv := (hleft e v).mp (hall (l e) (hfirst e).inc_left) + have hrv := (hright e v).mp (hall (r e) (hfirst e).inc_right) + change H.IsLink e v v + simpa only [hlv, hrv] using hlink e + · intro v _ + rw [hEall, image_univ] + exact subdivisionBranch_connected_subgraph κ k hk v + +/-- A finite graph is isomorphic to a minor of any subdivision +of its edges into nonempty chains, as used in XII (4.5), page 252. -/ +theorem isIsoMinor_subdivision {m n : ℕ} (H : Graph (Fin m) (Fin n)) + (κ : Fin n × Bool → Fin m) (hlink : ∀ e, H.IsLink e (κ (e, false)) (κ (e, true))) + (k : Fin n → ℕ) (hk : ∀ e, 0 < k e) : IsIsoMinor H (subdivisionGraph κ k) := + isIsoMinor_of_isMinorModel H (subdivisionGraph κ k) (toFinite _) (toFinite _) + (toFinite _) (toFinite _) (subdivisionBranch κ k) (subdivisionFirstEdge k hk) + (isMinorModel_subdivision H κ hlink k hk) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SubdivisionNoncrossing.lean b/LeanPool/GraphMinor/GM12/Section4SubdivisionNoncrossing.lean new file mode 100644 index 0000000000..309ccca63f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SubdivisionNoncrossing.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4AdjacentSubdivisionPieces + +/-! +# Noncrossing incident edges after subdivision + +XII (4.5), page 252, retains the property that every vertex has +two incident edges that do not cross. At an old vertex, select +pieces of its two original noncrossing edges that contain it. +At a new cut vertex, use the two adjacent pieces of the original +edge. Their intersections are exactly the selected vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- Every vertex of the subdivided arc family has two different +edge arcs meeting exactly there. This preserves condition (vii) +in the subdivision step of XII (4.5), page 252. -/ +theorem subdivision_has_two_noncrossing_arcs {m n : ℕ} + (V : Fin m → ℂ) (E : Fin n → Set ℂ) (k : Fin n → ℕ) + (w : ∀ e, Fin (k e + 1) → ℂ) (P : ∀ e, Fin (k e) → Set ℂ) + (hw : ∀ e, Function.Injective (w e)) + (hline : ∀ e i, IsLineWithEnds (P e i) (w e i.castSucc) (w e i.succ)) + (hcover : ∀ e, (⋃ i, P e i) = E e) + (hinter : ∀ e i j, i ≠ j → P e i ∩ P e j ⊆ range (w e)) + (hvertex : ∀ e i, P e i ∩ range (w e) = {w e i.castSucc, w e i.succ}) + (htwo : ∀ v, ∃ e f, e ≠ f ∧ E e ∩ E f = {V v}) + (z : SubdivisionVertex m n k) : + ∃ q r : Σ e : Fin n, Fin (k e), q ≠ r ∧ + subdivisionEdgeArc k P q ∩ subdivisionEdgeArc k P r = {subdivisionPosition V k w z} := by + have hsub : ∀ e i, P e i ⊆ E e := by + intro e i x hx + rw [← hcover e] + exact mem_iUnion.mpr ⟨i, hx⟩ + cases z with + | inl v => + obtain ⟨e, f, hef, hcross⟩ := htwo v + have hpoint : V v ∈ E e ∩ E f := hcross ▸ (show V v ∈ ({V v} : Set ℂ) from rfl) + have hxe : V v ∈ ⋃ i, P e i := (hcover e).symm ▸ hpoint.1 + have hxf : V v ∈ ⋃ j, P f j := (hcover f).symm ▸ hpoint.2 + obtain ⟨i, hxi⟩ := mem_iUnion.mp hxe + obtain ⟨j, hxj⟩ := mem_iUnion.mp hxf + refine ⟨⟨e, i⟩, ⟨f, j⟩, (fun h => hef (congrArg Sigma.fst h)), ?_⟩ + apply Subset.antisymm + · intro x hx + exact hcross ▸ And.intro (hsub e i hx.1) (hsub f j hx.2) + · rintro x rfl + exact ⟨hxi, hxj⟩ + | inr q => + obtain ⟨e, j⟩ := q + obtain ⟨i, l, hil, hint⟩ := exists_adjacent_pieces_at_internal_cut + (w e) (P e) (hw e) (hline e) (hinter e) (hvertex e) j + refine ⟨⟨e, i⟩, ⟨e, l⟩, ?_, hint⟩ + intro h + have hval := congrArg (fun q : Σ e : Fin n, Fin (k e) => q.2.val) h + exact hil (Fin.ext hval) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SubdivisionPositions.lean b/LeanPool/GraphMinor/GM12/Section4SubdivisionPositions.lean new file mode 100644 index 0000000000..b49c06b2bc --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SubdivisionPositions.lean @@ -0,0 +1,123 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SubdivisionGraph +public import LeanPool.GraphMinor.GM12.Section4CrossingPoints + +/-! +# Positions of the subdivision vertices + +In XII (4.5), page 252, keep the original vertex positions and +put each new vertex at its internal cut. The two endpoint cuts +agree with their original vertices. Internal cuts avoid original +vertices and all meetings of different original edges, so the +resulting global vertex-position map is injective. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- The position of an original or internal vertex in the source +subdivision of XII (4.5), page 252. -/ +@[expose] def subdivisionPosition {m n : ℕ} (V : Fin m → ℂ) (k : Fin n → ℕ) + (w : ∀ e, Fin (k e + 1) → ℂ) : SubdivisionVertex m n k → ℂ + | Sum.inl v => V v + | Sum.inr ⟨e, j⟩ => w e ⟨j.val + 1, by have := j.isLt; omega⟩ + +/-- The position map agrees with every cut on every original +edge, including the endpoint cuts. -/ +theorem subdivisionPosition_vertexAt {m n : ℕ} + (V : Fin m → ℂ) (κ : Fin n × Bool → Fin m) (k : Fin n → ℕ) (hk : ∀ e, 0 < k e) + (w : ∀ e, Fin (k e + 1) → ℂ) + (hw0 : ∀ e, w e 0 = V (κ (e, false))) + (hwlast : ∀ e, w e (Fin.last (k e)) = V (κ (e, true))) + (e : Fin n) (i : Fin (k e + 1)) : + subdivisionPosition V k w (subdivisionVertexAt κ k e i) = w e i := by + by_cases hi0 : i.val = 0 + · have heq : i = 0 := Fin.ext hi0 + subst i + rw [subdivisionVertexAt_zero] + exact (hw0 e).symm + by_cases hilast : i.val = k e + · have heq : i = Fin.last (k e) := Fin.ext hilast + subst i + rw [subdivisionVertexAt_last κ k e (hk e)] + exact (hwlast e).symm + · unfold subdivisionVertexAt + simp only [hi0, hilast, ↓reduceDIte, subdivisionPosition] + apply congrArg (w e) + apply Fin.ext + change i.val - 1 + 1 = i.val + omega + +/-- Avoiding old vertices and old edge meetings makes the global +subdivision positions distinct. This is the injectivity assertion +for the source subdivision in XII (4.5), page 252. -/ +theorem subdivisionPosition_injective {m n : ℕ} + (V : Fin m → ℂ) (E : Fin n → Set ℂ) (k : Fin n → ℕ) + (w : ∀ e, Fin (k e + 1) → ℂ) (hV : Function.Injective V) + (hw : ∀ e, Function.Injective (w e)) + (hmem : ∀ e i, w e i ∈ E e) + (havoid : ∀ e i, w e i ∉ E e ∩ edgeMeetingPoints V E) + (hinterior : ∀ e (j : Fin (k e - 1)), + w e ⟨j.val + 1, by have := j.isLt; omega⟩ ∉ range V) : + Function.Injective (subdivisionPosition V k w) := by + intro x y hxy + cases x with + | inl u => + cases y with + | inl v => exact congrArg Sum.inl (hV hxy) + | inr q => + obtain ⟨e, j⟩ := q + exact False.elim (hinterior e j ⟨u, hxy⟩) + | inr q => + obtain ⟨e, j⟩ := q + cases y with + | inl v => exact False.elim (hinterior e j ⟨v, hxy.symm⟩) + | inr q' => + obtain ⟨f, l⟩ := q' + by_cases hef : e = f + · subst f + have hcut := hw e hxy + have hval := congrArg Fin.val hcut + change j.val + 1 = l.val + 1 at hval + have hjl : j = l := Fin.ext (by omega) + subst l + rfl + · let r : Fin (k e + 1) := ⟨j.val + 1, by have := j.isLt; omega⟩ + let s : Fin (k f + 1) := ⟨l.val + 1, by have := l.isLt; omega⟩ + have heq : w e r = w f s := hxy + have hmeeting : w e r ∈ edgeMeetingPoints V E := + ⟨e, f, hef, ⟨hmem e r, heq ▸ hmem f s⟩, hinterior e j⟩ + exact False.elim (havoid e r ⟨hmem e r, hmeeting⟩) + +/-- No vertex of the global subdivision is an old meeting point. +The original vertices are excluded by definition, and every new +vertex is a cut chosen away from meetings in XII (4.5), page 252. -/ +theorem disjoint_subdivisionPositions_meetings {m n : ℕ} + (V : Fin m → ℂ) (E : Fin n → Set ℂ) (k : Fin n → ℕ) + (w : ∀ e, Fin (k e + 1) → ℂ) + (hmem : ∀ e i, w e i ∈ E e) + (havoid : ∀ e i, w e i ∉ E e ∩ edgeMeetingPoints V E) : + Disjoint (range (subdivisionPosition V k w)) (edgeMeetingPoints V E) := by + apply disjoint_left.mpr + rintro x ⟨v, rfl⟩ hx + cases v with + | inl z => + obtain ⟨i, j, hij, hmeet, hnot⟩ := hx + exact hnot ⟨z, rfl⟩ + | inr q => + obtain ⟨e, j⟩ := q + exact havoid e _ ⟨hmem e _, hx⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4SubdivisionStraightness.lean b/LeanPool/GraphMinor/GM12/Section4SubdivisionStraightness.lean new file mode 100644 index 0000000000..3ee6b5bcc7 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4SubdivisionStraightness.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4PieceNeighborhood +public import LeanPool.GraphMinor.GM12.Section4LocalCrossDiscs + +/-! +# Straightness of a subdivided edge near its meeting + +For XII (4.5), page 253, the original edge agrees with its +supporting line inside the open unit disc. Near a meeting, the +subdivision piece containing that meeting agrees with the old +edge. Intersect these two neighborhoods to obtain the local +straight-line model for the subdivision piece itself. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Metric + +/-- A subdivision piece is locally its chord's complete +supporting line at its unique meeting in the open unit disc. +This supplies the straightness needed to choose crossing discs +for the subdivided drawing in XII (4.5), page 253. -/ +theorem exists_open_subdivision_line_agreement {k : ℕ} + (E M : Set ℂ) (w : Fin (k + 1) → ℂ) (P : Fin k → Set ℂ) + (hline : ∀ i, IsLineWithEnds (P i) (w i.castSucc) (w i.succ)) + (hcover : (⋃ i, P i) = E) (havoid : ∀ r, w r ∉ E ∩ M) + (hinter : ∀ i j, i ≠ j → P i ∩ P j ⊆ range w) + {a b : ℂ} (ha : ‖a‖ = 1) (hb : ‖b‖ = 1) (hab : a ≠ b) + (hchord : E ∩ closedBall 0 1 = segment ℝ a b) + {i : Fin k} {x : ℂ} (hx : x ∈ P i ∩ (E ∩ M)) (hxB : x ∈ ball (0 : ℂ) 1) : + ∃ U : Set ℂ, IsOpen U ∧ x ∈ U ∧ + P i ∩ U = (line[ℝ, a, b] : Set ℂ) ∩ U := by + obtain ⟨U, hU, hxU, hmatch⟩ := exists_open_subdivision_piece_agreement E M w P + hline hcover havoid hinter hx + have hstraight := edge_inter_openBall_eq_line_inter_openBall ha hb hab hchord + refine ⟨U ∩ ball 0 1, hU.inter isOpen_ball, ⟨hxU, hxB⟩, ?_⟩ + ext z + constructor + · rintro ⟨hzP, hzU, hzB⟩ + have hzE : z ∈ E := (show z ∈ E ∩ U from hmatch.symm ▸ ⟨hzP, hzU⟩).1 + have hzL : z ∈ line[ℝ, a, b] := + (show z ∈ (line[ℝ, a, b] : Set ℂ) ∩ ball 0 1 from hstraight ▸ ⟨hzE, hzB⟩).1 + exact ⟨hzL, hzU, hzB⟩ + · rintro ⟨hzL, hzU, hzB⟩ + have hzE : z ∈ E := + (show z ∈ E ∩ ball 0 1 from hstraight.symm ▸ ⟨hzL, hzB⟩).1 + have hzP : z ∈ P i := (show z ∈ P i ∩ U from hmatch ▸ ⟨hzE, hzU⟩).1 + exact ⟨hzP, hzU, hzB⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4TargetOrientation.lean b/LeanPool/GraphMinor/GM12/Section4TargetOrientation.lean new file mode 100644 index 0000000000..e76a64d6ea --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4TargetOrientation.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Statement + +/-! +# Orienting the finite labelled target + +In XII (4.3), page 250, direct the target edges arbitrarily. +The two selected ends are assigned to the head and tail. A vertex +incident with two distinct edges then has assigned ends on two +distinct selected edges, which supplies the witnesses in the +final control argument. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- The orientation and two-edge end assignments used in XII +(4.3), pages 250--251. -/ +theorem exists_target_end_assignment + {p t : ℕ} (L : Graph (Fin p) (Fin t)) (hE : L.edgeSet = univ) + (hloopless : ∀ e v, ¬ L.IsLink e v v) + (htwo : ∀ v ∈ L.vertexSet, ∃ e f, e ≠ f ∧ L.Inc e v ∧ L.Inc f v) : + ∃ κ : Fin t × Bool → Fin p, + (∀ e u v, L.IsLink e u v → + (κ (e, true) = u ∧ κ (e, false) = v) ∨ + (κ (e, true) = v ∧ κ (e, false) = u)) ∧ + ∀ v ∈ L.vertexSet, ∃ i j, i ≠ j ∧ ∃ c d : Bool, κ (i, c) = v ∧ κ (j, d) = v := by + classical + have hex : ∀ e : Fin t, ∃ u v, L.IsLink e u v := by + intro e + apply L.exists_isLink_of_mem_edgeSet + rw [hE] + exact mem_univ e + choose head tail horient using hex + let κ : Fin t × Bool → Fin p := fun q => if q.2 then head q.1 else tail q.1 + refine ⟨κ, ?_, ?_⟩ + · intro e u v hl + have huv : u ≠ v := by + intro heq + exact hloopless e v (heq ▸ hl) + have hu := hl.inc_left.eq_or_eq_of_isLink (horient e) + have hv := hl.inc_right.eq_or_eq_of_isLink (horient e) + change (head e = u ∧ tail e = v) ∨ (head e = v ∧ tail e = u) + rcases hu with hu | hu + · rcases hv with hv | hv + · exact False.elim (huv (hu.trans hv.symm)) + · exact Or.inl ⟨hu.symm, hv.symm⟩ + · rcases hv with hv | hv + · exact Or.inr ⟨hv.symm, hu.symm⟩ + · exact False.elim (huv (hu.trans hv.symm)) + · have hslot : ∀ e v, L.Inc e v → ∃ c : Bool, κ (e, c) = v := by + intro e v hev + rcases hev.eq_or_eq_of_isLink (horient e) with hv | hv + · exact ⟨true, hv.symm⟩ + · exact ⟨false, hv.symm⟩ + intro v hv + obtain ⟨e, f, hef, he, hf⟩ := htwo v hv + obtain ⟨c, hc⟩ := hslot e v he + obtain ⟨d, hd⟩ := hslot f v hf + exact ⟨e, f, hef, c, d, hc, hd⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4TargetReplacement.lean b/LeanPool/GraphMinor/GM12/Section4TargetReplacement.lean new file mode 100644 index 0000000000..2e885d7a86 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4TargetReplacement.lean @@ -0,0 +1,62 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4SplitMinorModel +import LeanPool.GraphMinor.GM12.Section4NoIsolated +import LeanPool.GraphMinor.Minor.Basic +import LeanPool.GraphMinor.GM11.Walks + +/-! +# The target replacement in XII (4.3) + +Graph Minors XII (4.3), page 249, starts by replacing a drawable +target by a loopless graph in which every vertex is incident with +at least two edges. Starting with a drawing, add pendant edges +at isolated vertices, subdivide every edge, and add parallel +copies. The original drawing is a subgraph of the first step. +Contracting all right subdivision halves recovers that step, and +the final parallel augmentation retains the subdivision. Thus the +original graph is a minor of the loopless replacement. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A subdrawing is a subgraph, and hence isomorphic to a minor +of the ambient drawing's graph. -/ +theorem isIsoMinor_of_subdrawing + {S : Type*} [TopologicalSpace S] {Γ H : Drawing S} (h : Γ.IsSubdrawing H) : + IsIsoMinor Γ.toGraph H.toGraph := by + have hle : Γ.toGraph ≤ H.toGraph := + ⟨h.1, fun _ _ _ hl => (h.isLink_iff hl.edge_mem).mp hl⟩ + obtain ⟨K, hK, C, hC, hIso⟩ := IsIsoMinor.refl Γ.toGraph + exact ⟨K, hK.trans hle, C, hC, hIso⟩ + +/-- The loopless minimum-degree-two target replacement used at the +start of Graph Minors XII (4.3), page 249, for an actual drawing +of the target graph. -/ +theorem exists_loopless_minimum_degree_two_minor + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) : + ∃ H : Drawing S, IsIsoMinor Γ.toGraph H.toGraph ∧ + (∀ e v, ¬ H.toGraph.IsLink e v v) ∧ + ∀ v ∈ H.V, ∃ e f, e ≠ f ∧ H.toGraph.Inc e v ∧ H.toGraph.Inc f v := by + obtain ⟨Γ₀, K, H, A, B, m, x, y, hΓ₀, hd, hKH, hloop, htwo⟩ := + exists_loopless_minimum_degree_two_replacement hS Γ + have hminor : IsIsoMinor Γ₀.toGraph K.toGraph := isIsoMinor_of_isMinorModel Γ₀.toGraph K.toGraph + Γ₀.finite_V Γ₀.finite_edges K.finite_V K.finite_edges (splitBranch Γ₀ m y) A + (isMinorModel_of_splitData hd) + exact ⟨H, (isIsoMinor_of_subdrawing hΓ₀).trans + (hminor.trans (isIsoMinor_of_subdrawing hKH)), hloop, htwo⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4TerminalIndexing.lean b/LeanPool/GraphMinor/GM12/Section4TerminalIndexing.lean new file mode 100644 index 0000000000..f372f73059 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4TerminalIndexing.lean @@ -0,0 +1,56 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Data.Set.Function + +/-! +# Indexing the external path endpoints + +XII (4.4), page 251, collects both endpoints of each external path +into the prescribed set. Use an edge index and a Boolean to name +the two ends. Injectivity within each list and disjointness between +the two ranges make all these names distinct. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- The paired endpoint indexing is injective when the two endpoint +lists are injective and have disjoint ranges. -/ +theorem path_ends_injective + {ι S : Type*} (s t : ι → S) (hs : Function.Injective s) (ht : Function.Injective t) + (hdisj : Disjoint (range s) (range t)) : + Function.Injective (fun q : ι × Bool => if q.2 then s q.1 else t q.1) := by + rintro ⟨i, c⟩ ⟨j, d⟩ h + cases c <;> cases d + · exact Prod.ext (ht h) rfl + · change t i = s j at h + exact False.elim (Set.disjoint_left.mp hdisj (mem_range_self j) (h ▸ mem_range_self i)) + · change s i = t j at h + exact False.elim (Set.disjoint_left.mp hdisj (mem_range_self i) (h.symm ▸ mem_range_self j)) + · exact Prod.ext (hs h) rfl + +/-- The paired endpoint names cover precisely both endpoint lists. -/ +theorem range_path_ends {ι S : Type*} (s t : ι → S) : + range (fun q : ι × Bool => if q.2 then s q.1 else t q.1) = range s ∪ range t := by + ext x + constructor + · rintro ⟨⟨i, c⟩, rfl⟩ + cases c + · exact Or.inr (mem_range_self i) + · exact Or.inl (mem_range_self i) + · rintro (⟨i, rfl⟩ | ⟨i, rfl⟩) + · exact ⟨(i, true), rfl⟩ + · exact ⟨(i, false), rfl⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4Theorem43.lean b/LeanPool/GraphMinor/GM12/Section4Theorem43.lean new file mode 100644 index 0000000000..9d8ad3c68b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4Theorem43.lean @@ -0,0 +1,131 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM12.Induced +public import LeanPool.GraphMinor.GM12.Cited +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM12.Section4NormalizedTarget +import LeanPool.GraphMinor.GM12.Section4TargetOrientation +import LeanPool.GraphMinor.GM12.Section4TopologicalFeasibility +import LeanPool.GraphMinor.GM12.Section4FeasibleControl +import LeanPool.GraphMinor.GM12.Section3GeometricReduction +import LeanPool.GraphMinor.GM12.Section4FreeEdgeDiscs +import LeanPool.GraphMinor.GM12.Section4Monotone + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Graph Minors XII (4.3): controlling a drawable minor + +Replace the drawable target by a loopless drawable graph with two +incident edges at every vertex. Select widely separated free edges +of the host drawing and empty discs around them. The source target +drawing and the marked-disc homeomorphism prove topological +feasibility. Apply (3.2), verify control using (4.1), and pass back +to the original target by (4.2). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM14 + +universe u + +/-- A drawing gives the same incidence hypergraph through its graph representation. -/ +theorem drawing_hypergraph_eq_ofGraph + {S : Type*} [TopologicalSpace S] (Γ : Drawing S) : + Γ.toHypergraph = Hypergraph.ofGraph Γ.toGraph Γ.finite_V Γ.finite_edges := by + refine Hypergraph.ext (x := Γ.toHypergraph) + (y := Hypergraph.ofGraph Γ.toGraph Γ.finite_V Γ.finite_edges) ?_ ?_ ?_ + · rfl + · rfl + funext e v + apply propext + change (e ∈ Γ.E ∧ v ∈ Γ.V ∧ v ∈ closure e) ↔ ∃ w, Γ.toGraph.IsLink e v w + constructor + · intro h + obtain ⟨x, y, hxy⟩ := Γ.toGraph.exists_isLink_of_mem_edgeSet h.1 + have hv : v ∈ ({x, y} : Set S) := hxy.2.2.2 ▸ (show v ∈ closure e ∩ Γ.V from ⟨h.2.2, h.2.1⟩) + rcases hv with hv | hv + · subst v + exact ⟨y, hxy⟩ + · have heq := Set.mem_singleton_iff.mp hv + subst v + exact ⟨x, hxy.symm⟩ + · rintro ⟨w, he, hv, hw, hcap⟩ + exact ⟨he, hv, ((hcap.symm).subset (by simp)).1⟩ + +/-- Graph Minors XII (4.3), pages 249--251, for the drawing itself. +The threshold is enlarged by taking a maximum with the connection +threshold, also covering an edgeless target. The only statement +hypotheses are the cited VII (7.5), (5.1), and (5.5). -/ +theorem theorem_4_3_drawing + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {α β : Type*} {L : Graph α β} (D : GraphDrawing L S) : + ∃ N : ℕ, 1 ≤ N ∧ + ∀ (Γ : Drawing S) (θ : ℕ) (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ), + HasTangleMetric Γ θ T d → N ≤ θ → ControlsMinor Γ.toHypergraph θ T L := by + obtain ⟨p, t, K, DK, hKV, hKE, hminor, hloop, htwo⟩ := + exists_normalized_target_replacement hS D + obtain ⟨κ, hassign, hslots⟩ := exists_target_end_assignment K hKE hloop htwo + have hl : ∀ i, K.IsLink i (κ (i, true)) (κ (i, false)) := by + intro i + obtain ⟨v, w, h⟩ := K.exists_isLink_of_mem_edgeSet (hKE ▸ mem_univ i) + rcases hassign i v w h with ⟨hv, hw⟩ | ⟨hv, hw⟩ + · rw [hv, hw]; exact h + · rw [hv, hw]; exact h.symm + have hne : ∀ i, κ (i, true) ≠ κ (i, false) := by + intro i heq + exact hloop i (κ (i, false)) (heq ▸ hl i) + obtain ⟨k, hk, _, hcontrol⟩ := + exists_threshold_for_control_from_feasible_discs hS K κ hloop hassign hslots + let N := max k (5 + t * (k + 7)) + refine ⟨N, hk.trans (le_max_left _ _), ?_⟩ + intro Γ θ T d hm hN + have hkθ : k ≤ θ := (le_max_left _ _).trans hN + obtain ⟨f, a, b, Δ, r, hdata, hdisj, hreg, hsep⟩ := + exists_spaced_free_edge_discs hS hm hk ((le_max_right _ _).trans hN) + have hfeas := topologicallyFeasible_of_drawn_target hS K hKV hKE DK κ hl hne Δ a b + (fun i => ⟨(hdata i).2.2.1, (hdata i).2.1, (hdata i).2.2.2.2.1⟩) hdisj + have hc : ControlsMinor Γ.toHypergraph θ T K := hcontrol Γ θ T d f a b Δ r hm hkθ + (fun i => ⟨(hdata i).1, (hdata i).2.1⟩) + (fun i => ⟨(hdata i).2.2.1, (hdata i).2.2.2.2.2.1, + (hdata i).2.2.2.2.2.1.symm.trans (hdata i).2.2.2.1⟩) + hdisj hsep (fun i => ⟨(hdata i).2.2.2.2.2.2.2.1, (hdata i).2.2.2.2.2.2.2.2.2⟩) + hreg (fun i => (hdata i).2.2.2.2.2.2.1) hfeas + have heq := drawing_hypergraph_eq_ofGraph Γ + rw [heq] at hc + have hfinal := theorem_4_2_proof (G := Γ.toGraph) Γ.finite_V Γ.finite_edges + (Set.toFinite _) (Set.toFinite _) hminor hc + rwa [← heq] at hfinal + +/-- Graph Minors XII (4.3), pages 249--251. The tangle induced in +an overgraph controls every drawable target once its order exceeds +the threshold. The overgraph is written as a hypergraph with the +same vertex and edge labels as the drawing. -/ +theorem theorem_4_3_proof + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {α β : Type*} {L : Graph α β} (D : GraphDrawing L S) : + ∃ N : ℕ, 1 ≤ N ∧ + ∀ (Γ : Drawing S) (θ : ℕ) (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (G : Hypergraph S (Set S)), + HasTangleMetric Γ θ T d → N ≤ θ → Γ.toHypergraph ≤ G → + ControlsMinor G θ (inducedBySubgraph G Γ.toHypergraph θ T) L := by + obtain ⟨N, hN, hdraw⟩ := theorem_4_3_drawing hS D + refine ⟨N, hN, ?_⟩ + intro Γ θ T d G hm hθ hΓG + exact controlsMinor_inducedBySubgraph hΓG (hdraw Γ θ T d hm hθ) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4Theorem44.lean b/LeanPool/GraphMinor/GM12/Section4Theorem44.lean new file mode 100644 index 0000000000..9f0ba52216 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4Theorem44.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Cited +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM12.Section4Theorem44Large +import LeanPool.GraphMinor.GM12.Section4SmallClique +import LeanPool.GraphMinor.GM12.Section4Theorem43 +import LeanPool.GraphMinor.GM12.Section3GeometricReduction +import LeanPool.GraphMinor.GM12.Section4SpanControl +import LeanPool.GraphMinor.GM12.Section4InducedEmbedding + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Graph Minors XII (4.4): all clique sizes + +Use the path and branch construction of pages 251--252 when the +clique has at least three vertices. For the smaller cliques, the +target is drawable in the surface, so (4.3) applies as the paper +instructs. The conclusion is expressed for an embedded drawing and +an ambient tangle controlling its tangle. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph Surface Hypergraph GM14 GM15 + +universe u + +/-- XII (4.4), pages 251--252, with the embedding and tangle +relation explicit. The only statement hypotheses are the cited +VII (7.5), (5.1), and (5.5). -/ +theorem theorem_4_4_span + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (p : ℕ) : + ∃ N : ℕ, 1 ≤ N ∧ + ∀ {α β : Type*} (G : Graph α β) (θstar θ : ℕ) + (Tstar : Set (Hypergraph α β × Hypergraph α β)) + (Γ : Drawing S) (η : SpanEmbedding Γ G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (s r : Fin (p * (p - 1) / 2) → S) (P : Fin (p * (p - 1) / 2) → Graph α β) + (hCtrl : IsControllingTangle G Γ η θstar θ Tstar T), + HasTangleMetric Γ θ T d → N ≤ θ → + (∀ i, s i ∈ Γ.V ∧ r i ∈ Γ.V ∧ s i ≠ r i) → + Function.Injective s → Function.Injective r → Disjoint (range s) (range r) → + (∀ x ∈ range s ∪ range r, ∀ y ∈ range s ∪ range r, x ≠ y → N ≤ d {x} {y}) → + (∀ i, IsHPathWithEnds G η.imageGraph (P i) (η.vMap (s i)) (η.vMap (r i))) → + Pairwise (fun i j => Disjoint (P i).vertexSet (P j).vertexSet) → + ControlsMinor (Hypergraph.ofGraph G hCtrl.isTangle_star.finite_V + hCtrl.isTangle_star.finite_E) θstar Tstar (GM16.completeGraph p) := by + by_cases hp : 3 ≤ p + · exact theorem_4_4_span_large hS p hp + · obtain ⟨D⟩ := exists_graphDrawing_complete_of_le_two hS (show p ≤ 2 by omega) + obtain ⟨N, hN, hmain⟩ := theorem_4_3_drawing hS D + refine ⟨N, hN, ?_⟩ + intro α β G θstar θ Tstar Γ η T d s r P hCtrl hm hθ _ _ _ _ _ _ _ + exact controlsMinor_of_controlling_drawing_tangle η hCtrl (hmain Γ θ T d hm hθ) + +/-- Graph Minors XII (4.4), pages 251--252, for the tangle induced +from a literal drawn subgraph of the ambient graph. All vertex and +edge names are shared with the drawing, as in the paper. -/ +theorem theorem_4_4_proof + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (p : ℕ) : + ∃ N : ℕ, 1 ≤ N ∧ + ∀ (Γ : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (G : Graph S (Set S)) + (hV : G.vertexSet.Finite) (hE : G.edgeSet.Finite), + Γ.toGraph ≤ G → HasTangleMetric Γ θ T d → N ≤ θ → + ∀ (s r : Fin (p * (p - 1) / 2) → S) (P : Fin (p * (p - 1) / 2) → Graph S (Set S)), + (∀ i, s i ∈ Γ.V ∧ r i ∈ Γ.V ∧ s i ≠ r i) → + Function.Injective s → Function.Injective r → Disjoint (range s) (range r) → + (∀ x ∈ range s ∪ range r, ∀ y ∈ range s ∪ range r, x ≠ y → N ≤ d {x} {y}) → + (∀ i, IsHPathWithEnds G Γ.toGraph (P i) (s i) (r i)) → + Pairwise (fun i j => Disjoint (P i).vertexSet (P j).vertexSet) → + ControlsMinor (Hypergraph.ofGraph G hV hE) θ + (inducedBySubgraph (Hypergraph.ofGraph G hV hE) Γ.toHypergraph θ T) (GM16.completeGraph p) + := by + obtain ⟨N, hN, hmain⟩ := theorem_4_4_span hS p + refine ⟨N, hN, ?_⟩ + intro Γ θ T d G hV hE hΓG hm hθ s r P hends hs hr hsr hfar hP hPP + obtain ⟨η, hηG, hηv, _, hCtrl⟩ := exists_identity_embedding_induced_tangle Γ hV hE hΓG hm.1.2.1 + apply hmain G θ θ _ Γ η T d s r P hCtrl hm hθ hends hs hr hsr hfar + · intro i + have h := hP i + simpa only [hηv, hηG] using h + · exact hPP + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4Theorem44Large.lean b/LeanPool/GraphMinor/GM12/Section4Theorem44Large.lean new file mode 100644 index 0000000000..ddccbeccbc --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4Theorem44Large.lean @@ -0,0 +1,171 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Cited +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM12.Section4CliqueLabels +import LeanPool.GraphMinor.GM12.Section4VertexConnections +import LeanPool.GraphMinor.GM12.Section4TerminalIndexing +import LeanPool.GraphMinor.GM12.Section4SpanControl +import LeanPool.GraphMinor.GM12.Section4ExternalPathBranches +import LeanPool.GraphMinor.GM12.Section4SpanBranchBound +import LeanPool.GraphMinor.GM12.Section4Minor +import LeanPool.GraphMinor.GM12.Section2NonemptyEdges +import LeanPool.GraphMinor.Minor.Basic +import Mathlib.Data.Fintype.EquivFin + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Graph Minors XII (4.4): the branch construction + +For at least three clique vertices, carry out XII (4.4), pages +251--252. Index both ends of each external path and partition them +by the oriented clique ends. Apply (3.2), embed its connected +subdrawings into the ambient graph, and absorb each external path +except its terminal edge. The retained edges join the enlarged +branches. Each branch contains two distant prescribed vertices, +so (4.1) excludes an ambient small separation containing it. +The same argument covers three and four vertices as well as the +paper's stated reduction to at least five vertices. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph Surface Hypergraph GM10 GM14 GM15 + +universe u + +/-- XII (4.4), pages 251--252, for at least three clique vertices, +in the span formulation used by XVI. The statement hypotheses are +only the cited VII (7.5), (5.1), and (5.5). -/ +theorem theorem_4_4_span_large + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (p : ℕ) (hp : 3 ≤ p) : + ∃ N : ℕ, 1 ≤ N ∧ + ∀ {α β : Type*} (G : Graph α β) (θstar θ : ℕ) + (Tstar : Set (Hypergraph α β × Hypergraph α β)) + (Γ : Drawing S) (η : SpanEmbedding Γ G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (s r : Fin (p * (p - 1) / 2) → S) (P : Fin (p * (p - 1) / 2) → Graph α β) + (hCtrl : IsControllingTangle G Γ η θstar θ Tstar T), + HasTangleMetric Γ θ T d → N ≤ θ → + (∀ i, s i ∈ Γ.V ∧ r i ∈ Γ.V ∧ s i ≠ r i) → + Function.Injective s → Function.Injective r → Disjoint (range s) (range r) → + (∀ x ∈ range s ∪ range r, ∀ y ∈ range s ∪ range r, x ≠ y → N ≤ d {x} {y}) → + (∀ i, IsHPathWithEnds G η.imageGraph (P i) (η.vMap (s i)) (η.vMap (r i))) → + Pairwise (fun i j => Disjoint (P i).vertexSet (P j).vertexSet) → + ControlsMinor (Hypergraph.ofGraph G hCtrl.isTangle_star.finite_V + hCtrl.isTangle_star.finite_E) θstar Tstar (GM16.completeGraph p) := by + classical + let μ := p * (p - 1) / 2 + obtain ⟨K, κ, hKV, hKE, ⟨φ⟩, hloop, hassign, hslots⟩ := exists_oriented_clique_labels hp + let σ : Fin (2 * μ) ≃ Fin μ × Bool := Fintype.equivOfCardEq (by simp [Nat.mul_comm]) + obtain ⟨N, hN, hpN, hconnect⟩ := exists_threshold_for_vertex_connections hS p (2 * μ) + refine ⟨N, hN, ?_⟩ + intro α β G θstar θ Tstar Γ η T d s r P hCtrl hm hθ hends hs hr hsr hfar hP hPP + let ends : Fin μ × Bool → S := fun q => if q.2 then s q.1 else r q.1 + let z : Fin (2 * μ) → S := fun q => ends (σ q) + let owner : Fin (2 * μ) → Fin p := fun q => κ (σ q) + have hinjEnds : Function.Injective ends := path_ends_injective s r hs hr hsr + have hinjz : Function.Injective z := hinjEnds.comp σ.injective + have hEndsMem : ∀ q, ends q ∈ range s ∪ range r := by + intro ⟨i, c⟩ + cases c + · exact Or.inr (mem_range_self i) + · exact Or.inl (mem_range_self i) + have hEndsΓ : ∀ q, ends q ∈ Γ.V := by + intro ⟨i, c⟩ + cases c + · exact (hends i).2.1 + · exact (hends i).1 + have hzΓ : ∀ q, z q ∈ Γ.V := fun q => hEndsΓ (σ q) + have hfarz : ∀ i j, i ≠ j → N ≤ d {z i} {z j} := + fun i j hij => hfar (z i) (hEndsMem (σ i)) (z j) (hEndsMem (σ j)) + (fun h => hij (hinjz h)) + obtain ⟨D, hD, hDconn, hDdisj, hDclass⟩ := + hconnect Γ θ T d z owner hm hθ hzΓ hinjz hfarz + have hpoint : ∀ q, ends q ∈ (D (κ q)).V := by + intro q + have hmem : ends q ∈ edgeEndClass z owner (κ q) := + ⟨σ.symm q, by simp only [mem_ofPred_eq, owner, σ.apply_symm_apply], + by simp only [z, σ.apply_symm_apply]⟩ + exact ((hDclass (κ q)).symm.subset hmem).1 + have hDne : ∀ v, (D v).V.Nonempty := by + intro v + obtain ⟨i, j, _, c, e, hic, _⟩ := hslots v (hKV ▸ mem_univ v) + exact ⟨ends (i, c), hic ▸ hpoint (i, c)⟩ + have hTG := hCtrl.isTangle_star + obtain ⟨A, hA, hAA, hAV⟩ := exists_embedded_connecting_branches hTG.finite_V hTG.finite_E + η D hD hDne hDconn hDdisj + have hAF : ∀ v, (A v).vertexSet ⊆ η.imageGraph.vertexSet := by + intro v x hx + obtain ⟨y, hy, rfl⟩ := (hAV v).subset hx + exact η.bijOn_v.mapsTo ((hD v).1 hy) + have hsA : ∀ i, η.vMap (s i) ∈ (A (κ (i, true))).vertexSet := by + intro i + rw [hAV] + exact mem_image_of_mem η.vMap (hpoint (i, true)) + have hrA : ∀ i, η.vMap (r i) ∈ (A (κ (i, false))).vertexSet := by + intro i + rw [hAV] + exact mem_image_of_mem η.vMap (hpoint (i, false)) + obtain ⟨C, b, hC, hCC, hAC, hbinj, hjoin⟩ := exists_branches_from_external_paths + hTG.finite_V hTG.finite_E A hA hAA hAF P + (fun i => η.vMap (s i)) (fun i => η.vMap (r i)) + (fun i => κ (i, true)) (fun i => κ (i, false)) hP hPP hsA hrA + have hcontrol : ∀ A' B', (A', B') ∈ Tstar → separationOrder A' B' < p → + ∀ v : Fin p, ¬ (C v).vertexSet ⊆ A'.vertexSet := by + intro A' B' hAB horder v + obtain ⟨i, j, hij, c, e, hic, hje⟩ := hslots v (hKV ▸ mem_univ v) + have hiD : ends (i, c) ∈ (D v).V := hic ▸ hpoint (i, c) + have hjD : ends (j, e) ∈ (D v).V := hje ▸ hpoint (j, e) + have hneq : ends (i, c) ≠ ends (j, e) := + fun h => hij (congrArg Prod.fst (hinjEnds h)) + have hdist := hfar _ (hEndsMem (i, c)) _ (hEndsMem (j, e)) hneq + have htwo : 2 * p ≤ d {ends (i, c)} {ends (j, e)} := by omega + apply not_subset_small_side_of_embedded_distant_drawing hS η hm hCtrl + (by omega) (hDconn v) (hD v) hiD hjD htwo + (fun x hx => (hAC v).vertexSet_subset ((hAV v).symm.subset hx)) hAB horder + have hcK : ControlsMinor (Hypergraph.ofGraph G hTG.finite_V hTG.finite_E) θstar Tstar K := by + refine ⟨C, b, fun v _ => hC v, fun v _ w _ hvw => hCC v w hvw, ?_, ?_, + fun e _ f _ hef heq => hef (hbinj heq), ?_, ?_⟩ + · intro e u v hl huv + obtain ⟨heG, x, hx, y, hy, hxy⟩ := hjoin e + rcases hassign e u v hl with ⟨hu, hv⟩ | ⟨hv, hu⟩ + · rw [hu] at hx + rw [hv] at hy + exact ⟨heG, ⟨x, hx, hxy.inc_left⟩, y, hy, hxy.inc_right⟩ + · rw [hv] at hx + rw [hu] at hy + exact ⟨heG, ⟨y, hy, hxy.inc_right⟩, x, hx, hxy.inc_left⟩ + · intro e v hl + exact False.elim (hloop e v hl) + · rw [hKV] + have hcard : (univ : Set (Fin p)).ncard = p := by simp + rw [hcard] + exact (show p ≤ θ by omega).trans hCtrl.theta_le + · intro A' B' hAB hord v _ + rw [hKV] at hord + have hcard : (univ : Set (Fin p)).ncard = p := by simp + rw [hcard] at hord + exact hcontrol A' B' hAB hord v + have hEΓ : Γ.E.Nonempty := edges_nonempty_of_tangle_order_two hm.1.2.1 (by omega) + obtain ⟨e, _⟩ := hEΓ + let : Nonempty β := ⟨η.eMap e⟩ + exact controlsMinor_of_iso φ.symm hcK + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4Theorem45.lean b/LeanPool/GraphMinor/GM12/Section4Theorem45.lean new file mode 100644 index 0000000000..063bc2a795 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4Theorem45.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Cited +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM12.Section4Theorem45Large +import LeanPool.GraphMinor.GM12.Section3GeometricReduction +import LeanPool.GraphMinor.GM12.Section4CliqueControlMonotone +import LeanPool.GraphMinor.GM12.Section4InducedEmbedding + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Graph Minors XII (4.5): all clique sizes + +Carry out the crossing construction for a complete graph of +size at least four, then retain the desired clique branches. +This supplies the small-parameter reduction on page 252. +For a literal drawn subgraph, its identity embedding identifies +the controlling ambient tangle with the induced tangle in the +paper's conclusion. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Graph Hypergraph GM14 GM15 + +universe u + +/-- XII (4.5), pages 252--253, in the span formulation, with +region distances only bounded below by the chosen threshold. +The only statement hypotheses are VII (7.5), (5.1), and (5.5). +The source clique has size `max p 4`, instead of the paper's +reduction to at least five, before retaining the desired branches. -/ +theorem theorem_4_5_span + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (p : ℕ) : + ∃ k N : ℕ, 1 ≤ N ∧ ∀ {α β : Type*} (G : Graph α β) (θstar θ : ℕ) + (Tstar : Set (Hypergraph α β × Hypergraph α β)) (Γ : Drawing S) + (η : SpanEmbedding Γ G) (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (hCtrl : IsControllingTangle G Γ η θstar θ Tstar T), + HasTangleMetric Γ θ T d → N ≤ θ → + ∀ (r : Fin k → Set S) (P Q : Fin k → Graph α β), + Function.Injective r → (∀ i, IsEyeWithPaths G Γ η θ T (r i) (P i) (Q i)) → + (∀ i j, i ≠ j → N ≤ d (r i) (r j)) → + (∀ i j, i ≠ j → Disjoint ((P i).vertexSet ∪ (Q i).vertexSet) + ((P j).vertexSet ∪ (Q j).vertexSet)) → + ControlsMinor (Hypergraph.ofGraph G hCtrl.isTangle_star.finite_V + hCtrl.isTangle_star.finite_E) θstar Tstar (GM16.completeGraph p) := by + obtain ⟨k, N, hN, hmain⟩ := theorem_4_5_span_large hS (max p 4) (le_max_right _ _) + refine ⟨k, N, hN, ?_⟩ + intro α β G θstar θ Tstar Γ η T d hCtrl hm hθ r P Q hri heye hfar hdisj + exact controlsMinor_completeGraph_mono (le_max_left p 4) + (hmain G θstar θ Tstar Γ η T d hCtrl hm hθ r P Q hri heye hfar hdisj) + +/-- Graph Minors XII (4.5), pages 252--253, for a literal drawn +subgraph of the ambient graph and its induced tangle, as in the +paper. The eye data are the circuit, free four-vertex set, and +two external paths stated there. -/ +theorem theorem_4_5_proof + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (p : ℕ) : + ∃ k N : ℕ, 1 ≤ N ∧ ∀ (Γ : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (G : Graph S (Set S)) + (hV : G.vertexSet.Finite) (hE : G.edgeSet.Finite), + Γ.toGraph ≤ G → HasTangleMetric Γ θ T d → N ≤ θ → + ∀ (r : Fin k → Set S) (C : Fin k → Drawing S) (a b c d' : Fin k → S) + (P Q : Fin k → Graph S (Set S)), + Function.Injective r → (∀ i, r i ∈ Γ.R) → + (∀ i, (C i).IsCircuit ∧ (C i).IsSubdrawing Γ ∧ (C i).U = subBd (r i)) → + (∀ i, a i ∈ (C i).V ∧ b i ∈ (C i).V ∧ c i ∈ (C i).V ∧ d' i ∈ (C i).V) → + (∀ i, ([a i, b i, c i, d' i]).Nodup ∧ OccurInCircuitOrder (C i) (a i) (b i) (c i) (d' i)) → + (∀ i, GM10.IsFreeSet Γ.toHypergraph T θ {a i, b i, c i, d' i}) → + (∀ i, IsHPathWithEnds G Γ.toGraph (P i) (a i) (c i) ∧ + IsHPathWithEnds G Γ.toGraph (Q i) (b i) (d' i)) → + (∀ i, Disjoint (P i).vertexSet (Q i).vertexSet) → + (∀ i j, i ≠ j → N ≤ d (r i) (r j)) → + (∀ i j, i ≠ j → Disjoint ((P i).vertexSet ∪ (Q i).vertexSet) + ((P j).vertexSet ∪ (Q j).vertexSet)) → + ControlsMinor (Hypergraph.ofGraph G hV hE) θ + (inducedBySubgraph (Hypergraph.ofGraph G hV hE) Γ.toHypergraph θ T) + (GM16.completeGraph p) := by + obtain ⟨k, N, hN, hmain⟩ := theorem_4_5_span hS p + refine ⟨k, N, hN, ?_⟩ + intro Γ θ T d G hV hE hΓG hm hθ r C a b c d' P Q hri hr hC hmarks hord hfree hPQ hdisj hfar hcross + obtain ⟨η, hηG, hηv, _, hCtrl⟩ := exists_identity_embedding_induced_tangle Γ hV hE hΓG hm.1.2.1 + apply hmain G θ θ _ Γ η T d hCtrl hm hθ r P Q hri ?_ hfar hcross + intro i + refine ⟨hr i, C i, a i, b i, c i, d' i, (hC i).1, (hC i).2.1, (hC i).2.2, + (hmarks i).1, (hmarks i).2.1, (hmarks i).2.2.1, (hmarks i).2.2.2, + (hord i).1, (hord i).2, hfree i, hdisj i, ?_, ?_⟩ + · simpa only [hηv, hηG] using (hPQ i).1 + · simpa only [hηv, hηG] using (hPQ i).2 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4Theorem45Large.lean b/LeanPool/GraphMinor/GM12/Section4Theorem45Large.lean new file mode 100644 index 0000000000..f0c1ac4dd2 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4Theorem45Large.lean @@ -0,0 +1,123 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Cited +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM12.Section4EyeConnections +import LeanPool.GraphMinor.GM12.Section4EyeBranchControl +import LeanPool.GraphMinor.GM12.Section4EyePathReindex +import LeanPool.GraphMinor.GM12.Section4Monotone +import LeanPool.GraphMinor.GM12.Section2NonemptyEdges + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Graph Minors XII (4.5): the construction for large cliques + +Use the source subdivision, ordered eye discs, and endpoint +connections of page 253. Renumber the two external paths at +each eye by the source edges. The connected classes and those +paths give a controlled source minor by the two-region branch +estimate. Apply (4.2) to its complete-graph minor. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Graph Hypergraph GM14 GM15 + +universe u + +/-- XII (4.5), pages 252--253, for `p ≥ 4`, in the independent-eye +span formulation used by XV. The only statement hypotheses are +VII (7.5), (5.1), and (5.5). The paper reduces to `p ≥ 5`. +A larger threshold includes the source vertex-count bound +explicitly before applying the final separation estimate. -/ +theorem theorem_4_5_span_large + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (p : ℕ) (hp : 4 ≤ p) : + ∃ k N : ℕ, 1 ≤ N ∧ ∀ {α β : Type*} (G : Graph α β) (θstar θ : ℕ) + (Tstar : Set (Hypergraph α β × Hypergraph α β)) (Γ : Drawing S) + (η : SpanEmbedding Γ G) (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (hCtrl : IsControllingTangle G Γ η θstar θ Tstar T), + HasTangleMetric Γ θ T d → N ≤ θ → + ∀ (r : Fin k → Set S) (P Q : Fin k → Graph α β), + Function.Injective r → (∀ i, IsEyeWithPaths G Γ η θ T (r i) (P i) (Q i)) → + (∀ i j, i ≠ j → N ≤ d (r i) (r j)) → + (∀ i j, i ≠ j → Disjoint ((P i).vertexSet ∪ (Q i).vertexSet) + ((P j).vertexSet ∪ (Q j).vertexSet)) → + ControlsMinor (Hypergraph.ofGraph G hCtrl.isTangle_star.finite_V + hCtrl.isTangle_star.finite_E) θstar Tstar (GM16.completeGraph p) := by + classical + obtain ⟨W, E, L, κ, t, σ, N, hW, hE, hminor, hlink, hκne, ht, hNW, htwo, hconnect⟩ := + exists_eye_connections hS hp + let : Finite W := hW + let : Finite E := hE + let : Fintype W := Fintype.ofFinite W + let : Fintype E := Fintype.ofFinite E + refine ⟨t, N, (by omega), ?_⟩ + intro α β G θstar θ Tstar Γ η T d hCtrl hm hN r P Q hri heye hfar hdisj + have hex := fun i => (heye i).2 + choose C a b c d' hC hCG hCr ha hb hc hd hnodup horder hfree hPQ hP hQ using hex + have hr : ∀ i, r i ∈ Γ.R := fun i => (heye i).1 + obtain ⟨ends, H, hinj, hends, hinc, hH, hHc, hHH, hclass, hp0, hp1⟩ := + hconnect Γ θ T d r C a b c d' hm.1.1 hm hN hr hri hfar hC hCG hCr + (fun i => ⟨ha i, hb i, hc i, hd i⟩) horder hfree + let R₀ : Fin t × Bool → Graph α β := fun x => if x.2 then Q x.1 else P x.1 + let s : Fin t × Bool → S := fun x => if x.2 then b x.1 else a x.1 + let z : Fin t × Bool → S := fun x => if x.2 then d' x.1 else c x.1 + have hR₀ : ∀ x, IsHPathWithEnds G η.imageGraph (R₀ x) (η.vMap (s x)) (η.vMap (z x)) := by + rintro ⟨i, b'⟩ + cases b' + · exact hP i + · exact hQ i + have hR₀R₀ : Pairwise (fun x y => Disjoint (R₀ x).vertexSet (R₀ y).vertexSet) := by + rintro ⟨i, b'⟩ ⟨j, c'⟩ hneq + by_cases hij : i = j + · subst j + cases b' <;> cases c' + · exact False.elim (hneq rfl) + · exact hPQ i + · exact (hPQ i).symm + · exact False.elim (hneq rfl) + · have hi : (R₀ (i, b')).vertexSet ⊆ (P i).vertexSet ∪ (Q i).vertexSet := by + cases b' + · exact subset_union_left + · exact subset_union_right + have hj : (R₀ (j, c')).vertexSet ⊆ (P j).vertexSet ∪ (Q j).vertexSet := by + cases c' + · exact subset_union_left + · exact subset_union_right + exact (hdisj i j hij).mono hi hj + have hpairs : ∀ x, ({ends (σ x, false), ends (σ x, true)} : Set S) = {s x, z x} := by + rintro ⟨i, b'⟩ + cases b' + · exact hp0 i + · exact hp1 i + obtain ⟨R, hR, hRR⟩ := exists_external_paths_reindexed η.vMap σ ends s z R₀ hR₀ hR₀R₀ hpairs + have hEΓ : Γ.E.Nonempty := edges_nonempty_of_tangle_order_two hm.1.2.1 (by omega) + have hcardW : Fintype.card W = Nat.card W := Nat.card_eq_fintype_card.symm + have hfar' : ∀ i j, i ≠ j → 2 * Fintype.card W + 2 ≤ d (r i) (r j) := by + intro i j hij + rw [hcardW] + exact (by omega : 2 * Nat.card W + 2 ≤ N).trans (hfar i j hij) + have hθ : Fintype.card W ≤ θ := by rw [hcardW]; omega + have hcL := controlsMinor_of_eye_connections hS η hm hCtrl hEΓ L κ σ hlink hκne htwo + r hr hfar' hθ ends hends hinc H hH hHc hHH hclass R hR hRR + obtain ⟨e, _⟩ := hEΓ + let : Nonempty β := ⟨η.eMap e⟩ + exact theorem_4_2_proof hCtrl.isTangle_star.finite_V hCtrl.isTangle_star.finite_E + (Set.toFinite L.vertexSet) (Set.toFinite L.edgeSet) hminor hcL + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ThinArcDisc.lean b/LeanPool/GraphMinor/GM12/Section4ThinArcDisc.lean new file mode 100644 index 0000000000..9e03005f15 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ThinArcDisc.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscMerge +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.GM12.Section2StraightArcChart +import LeanPool.GraphMinor.GM12.Section4ThinStripDisc +import LeanPool.GraphMinor.Surface.ArcDisc +import LeanPool.GraphMinor.Surface.Wedge + +/-! +# Empty discs around normal arcs + +For the discs used in XII (4.3), page 250, straighten the arc +inside a surface chart and apply the thin-disc construction. A +closed set that meets the arc just at its ends then meets the disc +at exactly those two boundary points. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface Metric + +/-- The empty-disc construction of XII (4.3), page 250, for an +arc contained in one ball chart. -/ +theorem exists_thin_disc_of_arc_in_chart + {S : Type*} [TopologicalSpace S] [T2Space S] + (hman : ∀ x : S, IsManifoldPoint x) + {R : ℝ} {U : Set S} {h : S → ℂ} {g : ℂ → S} (c : BallChart R U h g) + {a : unitInterval → S} (ha : IsArcMap a) (haU : range a ⊆ U) + {B : Set S} (hB : IsClosed B) (hleft : a 0 ∈ B) (hright : a 1 ∈ B) + (hmeet : range a ∩ B ⊆ {a 0, a 1}) : + ∃ D : Set S, IsClosedDisc D ∧ D ∩ B = {a 0, a 1} ∧ + ({a 0, a 1} : Set S) ⊆ discBd D ∧ range a ⊆ D := by + obtain ⟨O, K, θ, hO, hKc, hKi, _, hθc, hθm, hθK⟩ := + exists_straight_arc_chart hman c ha haU + exact exists_thin_disc_of_strip_arc hO hKc hKi ha hθc hθm hθK hB hleft hright hmeet + +/-- In a closed surface, an arc with no forbidden point between +its ends has a thin disc whose only forbidden points are those ends. -/ +theorem exists_thin_disc_of_arc + {S : Type} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {a : unitInterval → S} (ha : IsArcMap a) + {B : Set S} (hB : IsClosed B) (hleft : a 0 ∈ B) (hright : a 1 ∈ B) + (hmeet : range a ∩ B ⊆ {a 0, a 1}) : + ∃ D : Set S, IsClosedDisc D ∧ D ∩ B = {a 0, a 1} ∧ + ({a 0, a 1} : Set S) ⊆ discBd D ∧ range a ⊆ D := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + obtain ⟨E, hE, haE⟩ := Surface.exists_disc_of_arc hS ha + obtain ⟨h, g, c⟩ := hE.exists_isChart + have hbc : BallChart 1 (g '' ball 0 1) h g := by + refine ⟨c.isOpen_image_ball hman, c.hc.mono ?_, c.gc.mono ball_subset_closedBall, + ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact c.gm (ball_subset_closedBall hz) + · rintro _ ⟨z, hz, rfl⟩ + rwa [c.hg (ball_subset_closedBall hz)] + · exact fun z hz => ⟨z, hz, rfl⟩ + · rintro _ ⟨z, hz, rfl⟩ + rw [c.hg (ball_subset_closedBall hz)] + · exact fun z hz => c.hg (ball_subset_closedBall hz) + have haU : range a ⊆ g '' ball 0 1 := by + rw [← c.discInt_eq] + exact haE + exact exists_thin_disc_of_arc_in_chart hman hbc ha haU hB hleft hright hmeet + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ThinPlaneDisc.lean b/LeanPool/GraphMinor/GM12/Section4ThinPlaneDisc.lean new file mode 100644 index 0000000000..e3c2a0c219 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ThinPlaneDisc.lean @@ -0,0 +1,151 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM12.Section4PinchedDisc +import LeanPool.GraphMinor.Surface.PlaneDisc +import LeanPool.GraphMinor.Surface.Wedge +import Mathlib.Topology.MetricSpace.HausdorffDistance + +/-! +# A thin disc avoiding a closed set except at its ends + +For the empty-disc construction in XII (4.3), page 250, +straighten a normal arc to a real segment. The distance from each +interior point of the segment to the forbidden closed set gives +a positive width. This width tends to zero at the ends. Shrinking +the vertical fibres of the unit disc by that width produces the +required disc within the prescribed open chart. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface Metric Complex + +/-- A real segment whose interior misses a closed set can be thickened +into a disc meeting that set only at its ends, within any open set +containing the segment. -/ +theorem exists_thin_plane_disc + {O B : Set ℂ} (hO : IsOpen O) (hB : IsClosed B) + (hsegO : Complex.ofReal '' Icc (-1 : ℝ) 1 ⊆ O) + (hBseg : B ∩ (Complex.ofReal '' Icc (-1 : ℝ) 1) ⊆ {-1, 1}) + (hleft : (-1 : ℂ) ∈ B) (hright : (1 : ℂ) ∈ B) : + ∃ D : Set ℂ, IsClosedDisc D ∧ D ⊆ O ∧ D ∩ B = {-1, 1} ∧ + ({-1, 1} : Set ℂ) ⊆ discBd D ∧ + Complex.ofReal '' Icc (-1 : ℝ) 1 ⊆ D := by + let F : Set ℂ := Oᶜ ∪ B + have hF : IsClosed F := hO.isClosed_compl.union hB + have hFne : F.Nonempty := ⟨-1, Or.inr hleft⟩ + let ε : ℝ → ℝ := fun x => min 1 (infDist (x : ℂ) F / 2) + have hεc : Continuous ε := continuous_const.min + (((continuous_infDist_pt F).comp continuous_ofReal).div_const 2) + have hεnn : ∀ x, 0 ≤ ε x := fun x => le_min (by norm_num) + (div_nonneg infDist_nonneg (by norm_num)) + have hεpos : ∀ x ∈ Ioo (-1 : ℝ) 1, 0 < ε x := by + intro x hx + have hxseg : (x : ℂ) ∈ Complex.ofReal '' Icc (-1 : ℝ) 1 := + ⟨x, ⟨hx.1.le, hx.2.le⟩, rfl⟩ + have hxF : (x : ℂ) ∉ F := by + rintro (hxO | hxB) + · exact hxO (hsegO hxseg) + · have hend := hBseg ⟨hxB, hxseg⟩ + rcases hend with h | h + · have h' := congrArg Complex.re h + simp only [ofReal_re, neg_re, one_re] at h' + linarith [hx.1] + · have h' := congrArg Complex.re (Set.mem_singleton_iff.mp h) + simp only [ofReal_re, one_re] at h' + linarith [hx.2] + have hdist : 0 < infDist (x : ℂ) F := + (infDist_pos_iff_notMem_closure hFne).mp (by rw [hF.closure_eq]; exact hxF) + exact lt_min (by norm_num) (half_pos hdist) + have hzero₀ : infDist (-1 : ℂ) F = 0 := Metric.infDist_zero_of_mem (s := F) (x := -1) + (Or.inr hleft) + have hzero₁ : infDist (1 : ℂ) F = 0 := Metric.infDist_zero_of_mem (s := F) (x := 1) + (Or.inr hright) + have hεends : ε (-1) = 0 ∧ ε 1 = 0 := by + constructor <;> simp [ε, hzero₀, hzero₁] + let f : ℂ → ℂ := fun z => (z.re : ℂ) + (ε z.re * z.im : ℝ) * I + have hfc : Continuous f := (continuous_ofReal.comp continuous_re).add + ((continuous_ofReal.comp ((hεc.comp continuous_re).mul continuous_im)).mul_const I) + have hfi := pinched_disc_injOn ε (fun x hx => (hεpos x hx).ne') + have hdisc := isClosedDisc_image_injOn isClosedDisc_closedBall.1 + (isCompact_closedBall (0 : ℂ) 1) hfc.continuousOn hfi + have hendf : f (-1) = -1 ∧ f 1 = 1 := by + constructor <;> simp [f, hεends.1, hεends.2] + have hloc : ∀ z ∈ closedBall (0 : ℂ) 1, + f z ∈ O ∧ (f z ∈ B → f z ∈ ({-1, 1} : Set ℂ)) := by + intro z hz + have hzN : ‖z‖ ≤ 1 := mem_closedBall_zero_iff.mp hz + have hre := abs_le.mp ((abs_re_le_norm z).trans hzN) + have him := (abs_im_le_norm z).trans hzN + by_cases hmid : z.re ∈ Ioo (-1 : ℝ) 1 + · have hdist : dist (f z) (z.re : ℂ) ≤ ε z.re := by + have heq : f z - (z.re : ℂ) = (ε z.re * z.im : ℝ) * I := by + dsimp only [f]; ring + rw [dist_eq_norm, heq, norm_mul, Complex.norm_I, mul_one, Complex.norm_real, + Real.norm_eq_abs, abs_mul, abs_of_nonneg (hεnn _)] + exact mul_le_of_le_one_right (hεnn _) him + have hsmall : ε z.re < infDist (z.re : ℂ) F := + (min_le_right _ _).trans_lt (half_lt_self (by + have hpos := hεpos z.re hmid + have hle : ε z.re ≤ infDist (z.re : ℂ) F / 2 := min_le_right _ _ + linarith)) + have hnot : f z ∉ F := by + intro hmem + have hle := infDist_le_dist_of_mem (x := (z.re : ℂ)) hmem + rw [dist_comm] at hle + exact (hdist.trans_lt hsmall).not_ge hle + exact ⟨not_not.mp (fun hn => hnot (Or.inl hn)), fun hb => False.elim (hnot (Or.inr hb))⟩ + · have hext : z.re = -1 ∨ z.re = 1 := by + simp only [mem_Ioo] at hmid + rcases le_or_gt z.re (-1) with h | h + · exact Or.inl (le_antisymm h hre.1) + · exact Or.inr (le_antisymm hre.2 (not_lt.mp (fun h' => hmid ⟨h, h'⟩))) + have hfend : f z ∈ ({-1, 1} : Set ℂ) := by + rcases hext with he | he + · simp [f, he, hεends.1] + · simp [f, he, hεends.2] + have hOend : ({-1, 1} : Set ℂ) ⊆ O := by + intro w hw + apply hsegO + rcases hw with rfl | hw + · exact ⟨-1, by norm_num, by simp⟩ + · have hw' := Set.mem_singleton_iff.mp hw + exact hw' ▸ ⟨1, by norm_num, by simp⟩ + exact ⟨hOend hfend, fun _ => hfend⟩ + refine ⟨f '' closedBall 0 1, hdisc.1, ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact (hloc z hz).1 + · apply Set.Subset.antisymm + · rintro w ⟨⟨z, hz, rfl⟩, hwB⟩ + exact (hloc z hz).2 hwB + · intro w hw + rcases hw with rfl | hw + · exact ⟨⟨-1, by norm_num, hendf.1⟩, hleft⟩ + · have hw' := Set.mem_singleton_iff.mp hw + subst w + exact ⟨⟨1, by norm_num, hendf.2⟩, hright⟩ + · rw [hdisc.2, isClosedDisc_closedBall.2] + intro w hw + rcases hw with rfl | hw + · exact ⟨-1, by norm_num, hendf.1⟩ + · have hw' := Set.mem_singleton_iff.mp hw + subst w + exact ⟨1, by norm_num, hendf.2⟩ + · rintro _ ⟨x, hx, rfl⟩ + refine ⟨(x : ℂ), ?_, ?_⟩ + · rw [mem_closedBall_zero_iff, Complex.norm_real, Real.norm_eq_abs] + exact abs_le.mpr hx + · simp [f] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4ThinStripDisc.lean b/LeanPool/GraphMinor/GM12/Section4ThinStripDisc.lean new file mode 100644 index 0000000000..6a335c04ea --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4ThinStripDisc.lean @@ -0,0 +1,165 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.GM12.Section4ThinPlaneDisc +import LeanPool.GraphMinor.Surface.Wedge + +/-! +# Transferring a thin disc through an arc chart + +The empty discs in XII (4.3), page 250, follow from a thin disc +around a normal arc. In a strip chart, the arc is a real interval. +Rescale that interval to `[-1, 1]` and apply the plane construction. +The chart is injective, so it carries the resulting disc and its +two boundary ends back to the surface without new intersections. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface Metric Complex + +/-- A thin disc around an arc in strip coordinates, avoiding a +closed set except at the arc's two ends. -/ +theorem exists_thin_disc_of_strip_arc + {S : Type*} [TopologicalSpace S] [T2Space S] + {O : Set ℂ} {K : ℂ → S} (hO : IsOpen O) + (hKc : ContinuousOn K O) (hKi : InjOn K O) + {a : unitInterval → S} (ha : IsArcMap a) + {θ : unitInterval → ℝ} (hθc : Continuous θ) (hθm : StrictMono θ) + (hθK : ∀ t, (θ t : ℂ) ∈ O ∧ K (θ t) = a t) + {B : Set S} (hB : IsClosed B) (hleft : a 0 ∈ B) (hright : a 1 ∈ B) + (hmeet : range a ∩ B ⊆ {a 0, a 1}) : + ∃ D : Set S, IsClosedDisc D ∧ D ∩ B = {a 0, a 1} ∧ + ({a 0, a 1} : Set S) ⊆ discBd D ∧ range a ⊆ D := by + let s : ℝ := (θ 1 - θ 0) / 2 + have hs : 0 < s := half_pos (sub_pos.mpr (hθm (show (0 : unitInterval) < 1 by norm_num))) + let A : ℂ → ℂ := fun z => (θ 0 : ℂ) + (s : ℂ) * (z + 1) + have hAc : Continuous A := by fun_prop + have hAi : Function.Injective A := by + intro z w h + have hs' : (s : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hs.ne' + exact add_right_cancel (mul_left_cancel₀ hs' (add_left_cancel h)) + have hAleft : A (-1) = (θ 0 : ℂ) := by simp [A] + have hAright : A 1 = (θ 1 : ℂ) := by + dsimp only [A, s] + push_cast + ring + have hseg : ∀ z ∈ Complex.ofReal '' Icc (-1 : ℝ) 1, + ∃ t : unitInterval, A z = (θ t : ℂ) := by + rintro _ ⟨x, hx, rfl⟩ + have hn : θ 0 + s * (x + 1) ∈ Icc (θ 0) (θ 1) := by + have hlo : 0 ≤ x + 1 := by linarith [hx.1] + have hhi : x + 1 ≤ 2 := by linarith [hx.2] + have heq : s * 2 = θ 1 - θ 0 := by dsimp only [s]; ring + constructor + · exact le_add_of_nonneg_right (mul_nonneg hs.le hlo) + · have hmul := mul_le_mul_of_nonneg_left hhi hs.le + rw [heq] at hmul + linarith + have himage := hθc.image_Icc_of_strictMono (a := 0) (b := 1) hθm + have hn' : θ 0 + s * (x + 1) ∈ θ '' Icc (0 : unitInterval) 1 := by + rw [himage] + exact hn + obtain ⟨t, _, ht⟩ := hn' + refine ⟨t, ?_⟩ + dsimp only [A] + exact_mod_cast ht.symm + let G : Set ℂ := O ∩ K ⁻¹' Bᶜ + have hG : IsOpen G := hKc.isOpen_inter_preimage hO hB.isOpen_compl + let O' : Set ℂ := A ⁻¹' O + let B' : Set ℂ := (A ⁻¹' G)ᶜ + have hO' : IsOpen O' := hO.preimage hAc + have hB' : IsClosed B' := (hG.preimage hAc).isClosed_compl + have hsegO : Complex.ofReal '' Icc (-1 : ℝ) 1 ⊆ O' := by + intro z hz + obtain ⟨t, ht⟩ := hseg z hz + change A z ∈ O + rw [ht] + exact (hθK t).1 + have hB'seg : B' ∩ (Complex.ofReal '' Icc (-1 : ℝ) 1) ⊆ {-1, 1} := by + rintro z ⟨hzB, hzseg⟩ + obtain ⟨t, ht⟩ := hseg z hzseg + have hatB : a t ∈ B := by + by_contra hn + apply hzB + exact ⟨ht ▸ (hθK t).1, by change K (A z) ∉ B; rw [ht, (hθK t).2]; exact hn⟩ + have hend := hmeet ⟨mem_range_self t, hatB⟩ + rcases hend with he | he + · have ht0 : t = 0 := ha.2 he + exact Or.inl (hAi (ht.trans (ht0 ▸ hAleft.symm))) + · have ht1 : t = 1 := ha.2 (Set.mem_singleton_iff.mp he) + exact Or.inr (Set.mem_singleton_iff.mpr (hAi (ht.trans (ht1 ▸ hAright.symm)))) + have hB'left : (-1 : ℂ) ∈ B' := by + intro h + exact h.2 (by rw [hAleft, (hθK 0).2]; exact hleft) + have hB'right : (1 : ℂ) ∈ B' := by + intro h + exact h.2 (by rw [hAright, (hθK 1).2]; exact hright) + obtain ⟨D, hD, hDO, hDB, hends, hsegD⟩ := exists_thin_plane_disc hO' hB' hsegO hB'seg hB'left + hB'right + let f : ℂ → S := fun z => K (A z) + have hfc : ContinuousOn f O' := hKc.comp hAc.continuousOn (fun _ hx => hx) + have hfi : InjOn f O' := by + intro z hz w hw he + exact hAi (hKi hz hw he) + have himage := isClosedDisc_image_injOn hD hD.isCompact (hfc.mono hDO) (hfi.mono hDO) + have hfleft : f (-1) = a 0 := by dsimp only [f]; rw [hAleft, (hθK 0).2] + have hfright : f 1 = a 1 := by dsimp only [f]; rw [hAright, (hθK 1).2] + have hmem : ∀ z ∈ D, f z ∈ B → z ∈ B' := by + intro z _ hzB hzG + exact hzG.2 hzB + refine ⟨f '' D, himage.1, ?_, ?_, ?_⟩ + · apply Set.Subset.antisymm + · rintro w ⟨⟨z, hzD, rfl⟩, hzB⟩ + have hzends : z ∈ ({-1, 1} : Set ℂ) := hDB.subset ⟨hzD, hmem z hzD hzB⟩ + rcases hzends with rfl | hzends + · exact Or.inl hfleft + · have hz1 := Set.mem_singleton_iff.mp hzends + subst z + exact Or.inr (Set.mem_singleton_iff.mpr hfright) + · intro w hw + rcases hw with rfl | hw + · exact ⟨⟨-1, discBd_subset D (hends (by simp)), hfleft⟩, hleft⟩ + · have hw1 := Set.mem_singleton_iff.mp hw + subst w + exact ⟨⟨1, discBd_subset D (hends (by simp)), hfright⟩, hright⟩ + · rw [himage.2] + intro w hw + rcases hw with rfl | hw + · exact ⟨-1, hends (by simp), hfleft⟩ + · have hw1 := Set.mem_singleton_iff.mp hw + subst w + exact ⟨1, hends (by simp), hfright⟩ + · rintro _ ⟨t, rfl⟩ + let x : ℝ := (θ t - θ 0) / s - 1 + have htlo : θ 0 ≤ θ t := hθm.monotone (unitInterval.nonneg t) + have hthi : θ t ≤ θ 1 := hθm.monotone (unitInterval.le_one t) + have hst : s * 2 = θ 1 - θ 0 := by dsimp only [s]; ring + have hx : x ∈ Icc (-1 : ℝ) 1 := by + dsimp only [x] + constructor + · have hdiv := div_nonneg (sub_nonneg.mpr htlo) hs.le + linarith + · have hdiv : (θ t - θ 0) / s ≤ 2 := (div_le_iff₀ hs).mpr (by linarith) + linarith + refine ⟨(x : ℂ), hsegD ⟨x, hx, rfl⟩, ?_⟩ + have hAx : A (x : ℂ) = (θ t : ℂ) := by + have hreal : θ 0 + s * (x + 1) = θ t := by + dsimp only [x] + field_simp + ring + dsimp only [A] + exact_mod_cast hreal + exact (congrArg K hAx).trans (hθK t).2 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4TopologicalFeasibility.lean b/LeanPool/GraphMinor/GM12/Section4TopologicalFeasibility.lean new file mode 100644 index 0000000000..ab79fc3e4f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4TopologicalFeasibility.lean @@ -0,0 +1,83 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4EndPartition +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM12.Section4DiscFamilyMatch +import LeanPool.GraphMinor.GM12.Section4FiniteSourceDiscs +import LeanPool.GraphMinor.GM12.Section4FeasibilityTransport + +/-! +# Topological feasibility for the oriented target + +This proves XII (4.3), claim (7), page 251. Replace the vertices of +the drawn target by disjoint discs and thicken the residual edges. +Match these residual edge discs, including their two ordered marks, +to the prescribed discs. The images of the vertex discs then have +exactly the required contacts with the prescribed end classes. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- XII (4.3), claim (7), page 251: the oriented target drawing +supplies the topological feasibility condition for any disjoint +prescribed edge discs with two boundary marks each. -/ +theorem topologicallyFeasible_of_drawn_target + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {p t : ℕ} (L : Graph (Fin p) (Fin t)) + (hV : L.vertexSet = univ) (hE : L.edgeSet = univ) (D : GraphDrawing L S) + (κ : Fin t × Bool → Fin p) + (hl : ∀ i, L.IsLink i (κ (i, true)) (κ (i, false))) + (hne : ∀ i, κ (i, true) ≠ κ (i, false)) + (Δ : Fin t → Set S) (a b : Fin t → S) + (hΔ : ∀ i, IsClosedDisc (Δ i) ∧ a i ≠ b i ∧ ({a i, b i} : Set S) ⊆ discBd (Δ i)) + (hdisj : ∀ i j, i ≠ j → Disjoint (Δ i) (Δ j)) : + IsTopologicallyFeasible Δ + (edgeEndClass (fun q : Fin t × Bool => if q.2 then a q.1 else b q.1) κ) := by + let σV : Fin p ≃ L.vertexSet := { + toFun := fun v => ⟨v, by rw [hV]; trivial⟩ + invFun := Subtype.val + left_inv := fun _ => rfl + right_inv := fun _ => rfl } + let σE : Fin t ≃ L.edgeSet := { + toFun := fun e => ⟨e, by rw [hE]; trivial⟩ + invFun := Subtype.val + left_inv := fun _ => rfl + right_inv := fun _ => rfl } + let ν : Fin p ≃ D.drawing.V := σV.trans D.iso.vertexEquiv + let ε : Fin t ≃ D.drawing.E := σE.trans D.iso.edgeEquiv + have hl' : ∀ i, D.drawing.toGraph.IsLink (ε i).val + (ν (κ (i, true))).val (ν (κ (i, false))).val := by + intro i + exact (D.iso.isLink_iff (σE i) (σV (κ (i, true))) (σV (κ (i, false)))).mp (hl i) + obtain ⟨Δ₀, a₀, b₀, hΔ₀, hdisj₀, hfeas₀⟩ := + exists_finite_source_disc_system hS D.drawing ν ε κ hl' hne + obtain ⟨e, he⟩ := exists_disc_family_match hS Δ₀ Δ + (fun i => (hΔ₀ i).1) (fun i => (hΔ i).1) + (fun i j hij => hdisj₀ i j hij) (fun i j hij => hdisj i j hij) + a₀ b₀ a b (fun i => (hΔ₀ i).2.2 (by simp)) (fun i => (hΔ₀ i).2.2 (by simp)) + (fun i => (hΔ₀ i).2.1) (fun i => (hΔ i).2.2 (by simp)) + (fun i => (hΔ i).2.2 (by simp)) (fun i => (hΔ i).2.1) + apply topologicallyFeasible_of_homeomorph hfeas₀ e (fun i => (he i).1) + intro v + change e '' ((fun q : Fin t × Bool => if q.2 then a₀ q.1 else b₀ q.1) '' {q | κ q = v}) = + (fun q : Fin t × Bool => if q.2 then a q.1 else b q.1) '' {q | κ q = v} + rw [image_image] + apply image_congr + rintro ⟨i, c⟩ _ + cases c + · exact (he i).2.2 + · exact (he i).2.1 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4UnitDiscContacts.lean b/LeanPool/GraphMinor/GM12/Section4UnitDiscContacts.lean new file mode 100644 index 0000000000..9ccd441869 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4UnitDiscContacts.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4ConvexBoundaryParam +import LeanPool.GraphMinor.GM19.DiscTouch + +/-! +# A unit subdisc retaining the parameters of its contacts + +For the target disc preparation of XII (4.5), page 253, take +the convex hull of the prescribed unit-circle marks and the +closed disc of radius one half. Strict convexity puts every +other point inside the unit circle. The radial boundary +parametrization fixes each prescribed mark, so their circle +parameters and cyclic order are retained. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Metric Topology + +/-- A finite nonempty set on the unit circle is exactly the +contact set of a smaller closed disc. Its boundary can be +parametrized so that each contact keeps its original circle +parameter, as needed for XII (4.5)'s target discs, page 253. -/ +theorem exists_unit_disc_contacts_with_param {N : Set ℂ} + (hN : N ⊆ sphere 0 1) (hfin : N.Finite) (hne : N.Nonempty) : + ∃ (K : Set ℂ) (p : Circle → ℂ), IsClosedDisc K ∧ K ⊆ closedBall 0 1 ∧ + K ∩ sphere 0 1 = N ∧ N ⊆ discBd K ∧ + Continuous p ∧ Function.Injective p ∧ range p = discBd K ∧ + ∀ w : Circle, (w : ℂ) ∈ N → p w = w := by + let K := convexHull ℝ (N ∪ closedBall (0 : ℂ) (1 / 2)) + have hKcompact : IsCompact K := GM19.isCompact_convexHull_union hfin hne + (isCompact_closedBall _ _) (convex_closedBall _ _) ⟨0, by simp⟩ + have hKconvex : Convex ℝ K := convex_convexHull _ _ + have hsmall : ball (0 : ℂ) (1 / 2) ⊆ K := + ball_subset_closedBall.trans (subset_union_right.trans (subset_convexHull _ _)) + have h0 : K ∈ 𝓝 (0 : ℂ) := Filter.mem_of_superset (ball_mem_nhds _ (by norm_num)) hsmall + have hKN : K ⊆ ball (0 : ℂ) 1 ∪ N := + convexHull_min (union_subset subset_union_right + (fun x hx => Or.inl (closedBall_subset_ball (by norm_num) hx))) + (GM19.convex_ball_union_of_subset_sphere hN) + have hKsub : K ⊆ closedBall (0 : ℂ) 1 := + hKN.trans (union_subset ball_subset_closedBall (hN.trans sphere_subset_closedBall)) + have hNK : N ⊆ K := fun n hn => subset_convexHull ℝ _ (Or.inl hn) + obtain ⟨hKd, p, hpcont, hpinj, hprange, hpfix⟩ := + exists_convex_boundary_param_fixing_circle hKconvex h0 hKcompact.isBounded hKcompact.isClosed + hKsub + have hcontact : K ∩ sphere (0 : ℂ) 1 = N := by + apply Subset.antisymm + · rintro z ⟨hzK, hzS⟩ + rcases hKN hzK with hzB | hzN + · have hlt := mem_ball_zero_iff.mp hzB + rw [mem_sphere_zero_iff_norm.mp hzS] at hlt + exact False.elim ((lt_irrefl (1 : ℝ)) hlt) + · exact hzN + · intro z hz + exact ⟨hNK hz, hN hz⟩ + have hNbd : N ⊆ discBd K := by + intro n hn + let w : Circle := ⟨n, hN hn⟩ + have hfix : p w = n := hpfix w (hNK hn) + exact hprange ▸ (show n ∈ range p from ⟨w, hfix⟩) + exact ⟨K, p, hKd, hKsub, hcontact, hNbd, hpcont, hpinj, hprange, + (fun w hw => hpfix w (hNK hw))⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4VertexConnections.lean b/LeanPool/GraphMinor/GM12/Section4VertexConnections.lean new file mode 100644 index 0000000000..c35d2e6b70 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4VertexConnections.lean @@ -0,0 +1,100 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4EndPartition +public import LeanPool.GraphMinor.GM12.Cited +import LeanPool.GraphMinor.GM12.Section3Theorem +import LeanPool.GraphMinor.GM12.Section3DiscRegion +import LeanPool.GraphMinor.GM12.Section4SingletonFeasibility +import LeanPool.GraphMinor.GM12.Section4SingletonDiscs +import LeanPool.GraphMinor.GM12.Section4FreeSingleton +import LeanPool.GraphMinor.GM12.Section4VertexRegionDistance +import LeanPool.GraphMinor.GM12.Section2NonemptyEdges + +import LeanPool.GraphMinor.GM07.Section7 +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Disjoint connections between distant prescribed vertices + +This is the application of (3.2) in XII (4.4), pages 251--252. +Put disjoint singleton discs at the selected vertices. Singleton +feasibility and freeness supply two hypotheses of (3.2). Passing +from vertices to their incident regions loses at most two units +of distance. The connection theorem then gives disjoint connected +subdrawings with precisely the assigned prescribed vertices. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM10 GM14 + +universe u + +/-- The connection step of XII (4.4), pages 251--252, for any +partition of finitely many distant prescribed vertices. -/ +theorem exists_threshold_for_vertex_connections + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (p t : ℕ) : + ∃ N : ℕ, 1 ≤ N ∧ 2 * p + 2 ≤ N ∧ + ∀ (Γ : Drawing S) (θ : ℕ) (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (z : Fin t → S) (κ : Fin t → Fin p), + HasTangleMetric Γ θ T d → N ≤ θ → + (∀ i, z i ∈ Γ.V) → Function.Injective z → + (∀ i j, i ≠ j → N ≤ d {z i} {z j}) → + HasConnectingSubdrawings Γ (range z) (edgeEndClass z κ) := by + obtain ⟨η, hη, hmain⟩ := theorem_3_2_proof hS t t + let N := max η (2 * p) + 2 + have hηN : η + 2 ≤ N := Nat.add_le_add_right (le_max_left _ _) 2 + have hpN : 2 * p + 2 ≤ N := Nat.add_le_add_right (le_max_right _ _) 2 + refine ⟨N, (by omega), hpN, ?_⟩ + intro Γ θ T d z κ hm hN hz hinj hfar + obtain ⟨Δ, hΔ, hdisj⟩ := exists_disjoint_single_vertex_discs hS Γ z hz hinj + have havoid : ∀ i, Γ.U ∩ Δ i = Γ.V ∩ discBd (Δ i) := + fun i => (hΔ i).2.1.trans (hΔ i).2.2.2.symm + have hZ : discBoundaryVertices Γ Δ = range z := by + ext x + simp only [discBoundaryVertices, (fun i => (hΔ i).2.2.2), mem_iUnion, mem_singleton_iff, + mem_range] + exact exists_congr (fun i => eq_comm) + have hcount : (discBoundaryVertices Γ Δ).ncard ≤ t := by + rw [hZ, Set.ncard_range_of_injective hinj] + simp + have hfeas : IsTopologicallyFeasible Δ (edgeEndClass z κ) := + topologicallyFeasible_singleton_prescriptions hS Δ (fun i => (hΔ i).1) hdisj + z (fun i => (hΔ i).2.2.1) κ + have hE : Γ.E.Nonempty := edges_nonempty_of_tangle_order_two hm.1.2.1 (by omega) + have hreg : ∀ i j, i ≠ j → ∀ ri ∈ Γ.R, (ri ∩ Δ i).Nonempty → + ∀ rj ∈ Γ.R, (rj ∩ Δ j).Nonempty → η ≤ d ri rj := by + intro i j hij ri hri hriD rj hrj hrjD + obtain ⟨r, hr, _, hDr, huniq⟩ := exists_unique_region_meeting_disc hS (hΔ i).1 (havoid i) + obtain ⟨s, hs, _, hDs, huniq'⟩ := exists_unique_region_meeting_disc hS (hΔ j).1 (havoid j) + have hzi : z i ∈ closure ri := by + rw [huniq ri hri hriD] + exact hDr (discBd_subset _ (hΔ i).2.2.1) + have hzj : z j ∈ closure rj := by + rw [huniq' rj hrj hrjD] + exact hDs (discBd_subset _ (hΔ j).2.2.1) + exact regions_distant_of_incident_vertices_distant hS hm hE (hz i) (hz j) + hri hrj hzi hzj (hηN.trans (hfar i j hij)) + have hfree : ∀ i, IsFreeSet Γ.toHypergraph T θ (Γ.V ∩ discBd (Δ i)) := by + intro i + rw [(hΔ i).2.2.2] + exact isFreeSet_singleton_of_respectful_drawing hS hm.1 (hz i) + have hconn := hmain Δ Γ θ T d p (edgeEndClass z κ) + (fun i => ⟨(hΔ i).1, havoid i⟩) hdisj hcount + ((iUnion_edgeEndClass z κ).trans hZ.symm) + (fun i j hij => disjoint_edgeEndClass z κ hinj hij) hfeas + (by omega) hm hreg hfree + rwa [hZ] at hconn + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4VertexDiscs.lean b/LeanPool/GraphMinor/GM12/Section4VertexDiscs.lean new file mode 100644 index 0000000000..c75d9a5bf5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4VertexDiscs.lean @@ -0,0 +1,81 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM11.EdgeSides +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Small disjoint discs at target vertices + +XII (4.3), claim (7), page 251, starts with small closed discs +at the vertices of a target drawing. Separate the finite vertex +set by disjoint open neighbourhoods. At each vertex also avoid +the closures of all nonincident edges. A smaller closed disc in +that neighbourhood has the required properties. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The small vertex discs used to form the residual edge arcs in +XII (4.3), claim (7), page 251. -/ +theorem exists_vertex_disc_family + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (Γ : Drawing S) : + ∃ D : Γ.V → Set S, + (∀ v, IsClosedDisc (D v) ∧ v.val ∈ interior (D v) ∧ D v ∩ Γ.V = {v.val} ∧ + ∀ e ∈ Γ.E, ¬ Γ.toGraph.Inc e v.val → Disjoint (D v) (closure e)) ∧ + (∀ v w, v ≠ w → Disjoint (D v) (D w)) := by + classical + obtain ⟨U, hU, hUdisj⟩ := Γ.finite_V.t2_separation + have hex : ∀ v : Γ.V, ∃ D : Set S, IsClosedDisc D ∧ v.val ∈ interior D ∧ D ⊆ U v.val ∧ + ∀ e ∈ Γ.E, ¬ Γ.toGraph.Inc e v.val → Disjoint D (closure e) := by + intro v + let F : Set (Set S) := {e ∈ Γ.E | ¬ Γ.toGraph.Inc e v.val} + let Z : Set S := ⋃ e ∈ F, closure e + have hF : F.Finite := Γ.finite_edges.subset (fun _ h => h.1) + have hZ : IsClosed Z := hF.isClosed_biUnion fun _ _ => isClosed_closure + have hvZ : v.val ∉ Z := by + intro hvZ + obtain ⟨e, ⟨he, hnot⟩, hve⟩ := mem_iUnion₂.mp hvZ + obtain ⟨x, y, hl⟩ := Γ.toGraph.exists_isLink_of_mem_edgeSet he + have hends : v.val ∈ ({x, y} : Set S) := hl.2.2.2 ▸ ⟨hve, v.property⟩ + rcases hends with hx | hy + · exact hnot (hx ▸ hl.inc_left) + · exact hnot ((Set.mem_singleton_iff.mp hy) ▸ hl.inc_right) + have hO : IsOpen (U v.val ∩ Zᶜ) := (hU v.val).2.inter hZ.isOpen_compl + obtain ⟨D, D', hD, hD'o, hvD', hD'D, hDO, _⟩ := + exists_closedDisc_nbhd hS hO ⟨(hU v.val).1, hvZ⟩ + refine ⟨D, hD, interior_maximal hD'D hD'o hvD', hDO.trans inter_subset_left, ?_⟩ + intro e he hnot + apply Set.disjoint_left.mpr + intro x hxD hxe + exact (hDO hxD).2 (mem_iUnion₂.mpr ⟨e, ⟨he, hnot⟩, hxe⟩) + choose D hD hvD hDU hDoff using hex + refine ⟨D, ?_, ?_⟩ + · intro v + refine ⟨hD v, hvD v, ?_, hDoff v⟩ + apply Set.Subset.antisymm + · rintro x ⟨hxD, hxV⟩ + by_contra hxv + have hvx : v.val ≠ x := Ne.symm hxv + exact Set.disjoint_left.mp (hUdisj v.property hxV hvx) (hDU v hxD) (hU x).1 + · intro x hx + have hxv := Set.mem_singleton_iff.mp hx + exact hxv ▸ ⟨interior_subset (hvD v), v.property⟩ + · intro v w hvw + have hvw' : v.val ≠ w.val := fun h => hvw (Subtype.ext h) + exact (hUdisj v.property w.property hvw').mono (hDU v) (hDU w) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4VertexRegion.lean b/LeanPool/GraphMinor/GM12/Section4VertexRegion.lean new file mode 100644 index 0000000000..f8e874fea0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4VertexRegion.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import LeanPool.GraphMinor.Surface.CrossCut +import LeanPool.GraphMinor.GM11.Theorem75 +import LeanPool.GraphMinor.GM11.Section4c +import LeanPool.GraphMinor.GM11.Section5b +import LeanPool.GraphMinor.Surface.ArcInPath + +/-! +# A short normal arc leaving a drawing vertex + +For XII (4.4), page 251, the small disc at a selected vertex starts +with an arc leaving that vertex through an incident region. Region +closures cover the surface because there are finitely many regions +and the drawing has empty interior. Restrict the region-entry path +to a short initial interval inside the assigned open neighborhood, +then remove repetitions. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 Metric + +/-- Region closures cover a drawing in a closed surface. -/ +theorem exists_region_at_point + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) (x : S) : + ∃ r ∈ Γ.R, x ∈ closure r := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hx : x ∈ closure (⋃₀ Γ.R) := by + apply _root_.mem_closure_iff.mpr + intro O hO hxO + obtain ⟨y, hyO, hyU⟩ := exists_notMem_U (Γ := Γ) hS hO ⟨x, hxO⟩ + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem hyU + exact ⟨y, hyO, r, hr, hyr⟩ + rw [(finite_R hS Γ).closure_sUnion] at hx + obtain ⟨r, hr, hxr⟩ := mem_iUnion₂.mp hx + exact ⟨r, hr, hxr⟩ + +/-- Leave a vertex along an arc that stays in an assigned open set +and meets the drawing only at that vertex. -/ +theorem exists_normal_arc_from_vertex_in_open + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (Γ : Drawing S) {v : S} (hv : v ∈ Γ.V) + {U : Set S} (hU : IsOpen U) (hvU : v ∈ U) : + ∃ a : unitInterval → S, IsArcMap a ∧ a 0 = v ∧ a 1 ∉ Γ.U ∧ + range a ⊆ U ∧ range a ∩ Γ.U = {v} := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨r, hr, hvr⟩ := exists_region_at_point hS Γ v + obtain ⟨g, hgc, hg0, hgr⟩ := exists_path_into_region hS Γ hv hr hvr + have hgU : g 0 ∈ U := hg0.symm ▸ hvU + obtain ⟨ε, hε, hεsub⟩ := Metric.mem_nhds_iff.mp + (hgc.continuousAt.preimage_mem_nhds (hU.mem_nhds hgU)) + let δ : ℝ := min (ε / 2) (1 / 2) + have hδ : 0 < δ := lt_min (half_pos hε) (by norm_num) + have hδε : δ < ε := (min_le_left _ _).trans_lt (by linarith) + have hδ1 : δ ≤ 1 := (min_le_right _ _).trans (by norm_num) + let f : unitInterval → unitInterval := fun t => + ⟨δ * t.val, mul_nonneg hδ.le t.property.1, + (mul_le_mul_of_nonneg_left t.property.2 hδ.le).trans (by simpa using hδ1)⟩ + have hfc : Continuous f := (show Continuous (fun t : unitInterval => δ * t.val) by + fun_prop).subtype_mk _ + have hf0 : f 0 = 0 := by apply Subtype.ext; change δ * 0 = 0; exact mul_zero _ + let b : unitInterval → S := fun t => g (f t) + have hbc : Continuous b := hgc.comp hfc + have hb0 : b 0 = v := by change g (f 0) = v; rw [hf0, hg0] + have hbU : ∀ t, b t ∈ U := by + intro t + apply hεsub + change dist (δ * t.val) (0 : ℝ) < ε + rw [Real.dist_eq, sub_zero, abs_of_nonneg (mul_nonneg hδ.le t.property.1)] + exact (mul_le_mul_of_nonneg_left t.property.2 hδ.le).trans_lt (by simpa using hδε) + have hbnot : ∀ t, t ≠ 0 → b t ∉ Γ.U := by + intro t ht + have htpos : 0 < t.val := lt_of_le_of_ne t.property.1 + (fun h => ht (Subtype.ext h.symm)) + exact region_subset hr (hgr (f t) (show 0 < f t from mul_pos hδ htpos)) + have hb1 : b 1 ∉ Γ.U := hbnot 1 one_ne_zero + have hneq : b 0 ≠ b 1 := fun heq => hb1 (heq ▸ (hb0.symm ▸ Γ.V_subset_U hv)) + obtain ⟨a, hac, hai, ha0, ha1, hab⟩ := exists_arc_of_path hbc hneq + refine ⟨a, ⟨hac, hai⟩, ha0.trans hb0, ?_, ?_, ?_⟩ + · rw [ha1] + exact hb1 + · rintro x hx + obtain ⟨t, rfl⟩ := hab hx + exact hbU t + · apply Set.Subset.antisymm + · rintro x ⟨hx, hxΓ⟩ + obtain ⟨t, htx⟩ := hab hx + by_cases ht : t = 0 + · exact Set.mem_singleton_iff.mpr (htx.symm.trans (ht ▸ hb0)) + · exact False.elim (hbnot t ht (htx.symm ▸ hxΓ)) + · rintro x rfl + exact ⟨⟨0, ha0.trans hb0⟩, Γ.V_subset_U hv⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4VertexRegionDistance.lean b/LeanPool/GraphMinor/GM12/Section4VertexRegionDistance.lean new file mode 100644 index 0000000000..6d4cb8cbce --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4VertexRegionDistance.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM11.CitedResults + +/-! +# Distance between regions at distant vertices + +XII (4.4), page 251, uses the threshold from (3.2) plus two. +Each selected vertex is at distance at most one from its incident +region. Two applications of the triangle inequality from XI (9.1) +therefore leave the required distance between the regions. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM14 + +/-- The two-unit distance adjustment in XII (4.4), page 251. -/ +theorem regions_distant_of_incident_vertices_distant + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric Γ θ T d) (hE : Γ.E.Nonempty) + {u v : S} (hu : u ∈ Γ.V) (hv : v ∈ Γ.V) + {r s : Set S} (hr : r ∈ Γ.R) (hs : s ∈ Γ.R) + (hur : u ∈ closure r) (hvs : v ∈ closure s) + {k : ℕ} (hfar : k + 2 ≤ d {u} {v}) : k ≤ d r s := by + have h91 := GM11.gm15_theorem_9_1 Γ θ T d hS inferInstance hm + have hsym := h91.2.2.2.1 + have htri := h91.2.2.2.2.1 + have hvr := h91.2.2.2.2.2.1 hE u hu r hr hur + have hvs' := h91.2.2.2.2.2.1 hE v hv s hs hvs + have huA : ({u} : Set S) ∈ Γ.A := Or.inl (Or.inl ⟨u, hu, rfl⟩) + have hvA : ({v} : Set S) ∈ Γ.A := Or.inl (Or.inl ⟨v, hv, rfl⟩) + have hrA : r ∈ Γ.A := Or.inr hr + have hsA : s ∈ Γ.A := Or.inr hs + have ht₁ := htri {u} huA r hrA {v} hvA + have ht₂ := htri r hrA s hsA {v} hvA + rw [hsym s hsA {v} hvA] at ht₂ + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4WalkMetric.lean b/LeanPool/GraphMinor/GM12/Section4WalkMetric.lean new file mode 100644 index 0000000000..47d2f9a339 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4WalkMetric.lean @@ -0,0 +1,172 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section1 +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Length and distance for radial walks + +In XII (4.1), page 248, the cost of a radial circuit is half its length, +which is the number of its original vertices. Bipartiteness gives this +identity. The distance bound follows by using a closed walk as a witness +in the definition of the tangle metric. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM14 Hypergraph + +universe u +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +omit [T1Space S] in +/-- Every closed walk of a pre-radial drawing `K` of `H` has even length, equal to twice the number +of visits to `V(H)`. -/ +theorem closed_walk_length_eq_two_mul {H K : Drawing S} + (hP : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) {u : S} + (W : GraphWalk K.toGraph u u) : + by classical exact W.length = 2 * (W.support.tail.countP (· ∈ H.V)) := by + classical + have hb₁ : ∀ e x y, K.toGraph.IsLink e x y → (x ∈ H.V ↔ y ∉ H.V) := + bipartite_of_preRadial hP + have hb₂ : ∀ e x y, K.toGraph.IsLink e x y → (x ∈ H.Vᶜ ↔ y ∉ H.Vᶜ) := by + intro e x y hl + simp only [mem_compl_iff, not_not] + exact ⟨fun hx => not_not.mp ((hb₁ e x y hl).not.mp hx), + fun hy hx => (hb₁ e x y hl).mp hx hy⟩ + have hle₁ := two_mul_count_le H.V hb₁ W + have hle₂ := two_mul_count_le H.Vᶜ hb₂ W + have hsum_list : ∀ l : List S, l.countP (· ∈ H.V) + l.countP (· ∈ H.Vᶜ) = l.length := by + intro l + induction l with + | nil => rfl + | cons x xs ih => + rw [List.countP_cons, List.countP_cons, List.length_cons, ← ih] + by_cases hx : x ∈ H.V <;> (simp [hx]; omega) + have hsum : W.support.tail.countP (· ∈ H.V) + W.support.tail.countP (· ∈ H.Vᶜ) = W.length := by + rw [hsum_list, List.length_tail, length_support] + rfl + omega + +omit [T1Space S] in +/-- Every circuit `D` of a pre-radial drawing `K` of `H` has length `2 * |V(D) ∩ V(H)|` and +contains a vertex of `H`. -/ +theorem circuit_length_eq_two_mul_ncard {H K D : Drawing S} + (hP : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) + (hD : D.IsCircuit) (hDs : D.IsSubdrawing K) : + D.length = 2 * (D.V ∩ H.V).ncard ∧ (D.V ∩ H.V).Nonempty := by + classical + obtain ⟨u, W_D, ⟨hnd, hed⟩, hpos, hDV, hDE⟩ := hD + obtain ⟨W, hs, he⟩ := hDs.exists_walk_up W_D + have hDlen : D.length = W.length := by + rw [Drawing.length, hDE, ← he] + have h : {e | e ∈ W.edges} = (W.edges.toFinset : Set (Set S)) := by ext; simp + rw [h, ncard_coe_finset, List.toFinset_card_of_nodup (he ▸ hed)] + rfl + have heven := closed_walk_length_eq_two_mul hP W + have htail_mem : ∀ x, x ∈ W.support.tail ↔ x ∈ D.V := by + intro x + rw [hDV, hs, mem_ofPred_eq] + cases W_D with + | nil _ => exact absurd hpos (Nat.lt_irrefl 0) + | cons _ r => + change x ∈ r.support ↔ x ∈ _ :: r.support + constructor + · exact fun hx => List.mem_cons_of_mem _ hx + · intro hx + rcases List.mem_cons.mp hx with rfl | hx + · exact r.end_mem_support + · exact hx + have hset_eq : ((W.support.tail.filter (· ∈ H.V)).toFinset : Set S) = D.V ∩ H.V := by + ext x + simp [htail_mem] + have hcard : W.support.tail.countP (· ∈ H.V) = (D.V ∩ H.V).ncard := by + rw [← hset_eq, ncard_coe_finset, + List.toFinset_card_of_nodup ((hs ▸ hnd).filter _), List.countP_eq_length_filter] + have hlen_eq : D.length = 2 * (D.V ∩ H.V).ncard := by + rw [hDlen, heven, hcard] + refine ⟨hlen_eq, ?_⟩ + have hWlen : W.length = W_D.length := by + change W.edges.length = W_D.edges.length + rw [he] + have hpos' : 0 < (D.V ∩ H.V).ncard := by omega + exact (ncard_pos (D.finite_V.subset inter_subset_left)).mp hpos' + +/-- A radial closed walk of length `2k < 2θ` containing the two corresponding +atoms witnesses distance at most `k`, as used in XII (4.1), page 248. -/ +theorem tangleMetric_le_of_walk {H K : Drawing S} {ins : Drawing S → Set S} + {θ k : ℕ} {x y x' y' : Set S} + (hx : IsCorrespondingAtom H K x x') (hy : IsCorrespondingAtom H K y y') + {u : S} (W : GraphWalk K.toGraph u u) (hW : W.length < 2 * θ) + (hlen : W.length = 2 * k) + (hxW : x' ⊆ insWalk ins K W) (hyW : y' ⊆ insWalk ins K W) : + tangleMetric H K ins θ x y ≤ k := by + classical + unfold tangleMetric + split_ifs with heq hex + · exact Nat.zero_le _ + · exact Nat.sInf_le ⟨u, W, x', y', hx, hy, hW, hlen, hxW, hyW⟩ + · exact (hex ⟨u, W, x', y', hx, hy, hW, hxW, hyW⟩).elim + +/-- The tangle metric is bounded by the order. If a short witness exists, +its even length gives a smaller bound. Otherwise the metric is the order. -/ +theorem tangleMetric_le_order {H K : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (ins : Drawing S → Set S) (θ : ℕ) (x y : Set S) : + tangleMetric H K ins θ x y ≤ θ := by + classical + by_cases heq : x = y + · simp only [tangleMetric, heq, ↓reduceIte, Nat.zero_le] + by_cases hex : ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H K x x' ∧ IsCorrespondingAtom H K y y' ∧ + W.length < 2 * θ ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W + · obtain ⟨u, W, x', y', hx, hy, hlen, hxW, hyW⟩ := hex + have heven := closed_walk_length_eq_two_mul hK.2.1 W + exact (tangleMetric_le_of_walk hx hy W hlen heven hxW hyW).trans (by omega) + · simp only [tangleMetric, heq, hex, ↓reduceIte, le_refl] + +section EdgeSeparations + +open GM10 + +variable {X : Type u} [TopologicalSpace X] + +/-- An edge of a drawing has at most two ends in its hypergraph. -/ +theorem drawing_edge_ends_ncard_le_two {H : Drawing X} {e : Set X} (he : e ∈ H.E) : + (H.toHypergraph.ends e).ncard ≤ 2 := by + obtain ⟨a, b, hl⟩ := H.toGraph.exists_isLink_of_mem_edgeSet he + have hends : H.toHypergraph.ends e ⊆ {a, b} := by + intro x hx + rw [← hl.2.2.2] + exact ⟨hx.2.2, hx.2.1⟩ + exact (ncard_le_ncard hends (toFinite _)).trans ((ncard_insert_le a {b}).trans (by simp)) + +/-- Separating one drawing edge from the rest has order at most two. -/ +theorem drawing_edge_separation_order_le_two {H : Drawing X} {e : Set X} (he : e ∈ H.E) : + separationOrder (edgeHypergraph H.toHypergraph e) (H.toHypergraph.deleteEdges {e}) ≤ 2 := by + rw [separationOrder_edgeHypergraph_deleteEdges] + exact drawing_edge_ends_ncard_le_two he + +/-- A tangle of order at least three selects the one-edge side as its small side. -/ +theorem drawing_edge_small_side_mem_of_order_three {H : Drawing X} {θ : ℕ} + {T : Set (Hypergraph X (Set X) × Hypergraph X (Set X))} + (hT : IsTangle H.toHypergraph θ T) (hθ : 2 < θ) {e : Set X} (he : e ∈ H.E) : + (edgeHypergraph H.toHypergraph e, H.toHypergraph.deleteEdges {e}) ∈ T := + (hT.axiom1 (isSeparation_edgeHypergraph_deleteEdges (G := H.toHypergraph) he) + ((drawing_edge_separation_order_le_two he).trans_lt hθ)).resolve_right + fun h => hT.axiom3 h rfl + +end EdgeSeparations + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section4WrappedChordCrossing.lean b/LeanPool/GraphMinor/GM12/Section4WrappedChordCrossing.lean new file mode 100644 index 0000000000..4b1e1e2137 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section4WrappedChordCrossing.lean @@ -0,0 +1,43 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section4ChordCrossing + +/-! +# Chord crossings across the end of a full turn + +The source drawing for XII (4.5), page 253, uses cyclic vertex +blocks. An end outside the interval of a chord can lie before its +first end or after its last end in the chosen full turn. Adding +one turn in the first case gives the usual alternating order. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface + +/-- A chord from an inside port to an outside port crosses the +chord bounding the interval. This includes a port before the start +of the chosen turn, as needed in XII (4.5), page 253. -/ +theorem chords_inter_of_inside_outside_ports {a b c d : ℝ} + (hab : a < b) (hbc : b < c) (ha : 0 ≤ a) (hc : c < 1) + (hd : d ∈ Ico 0 1) (hout : d < a ∨ c < d) : + (segment ℝ (ee a : ℂ) (ee c : ℂ) ∩ + segment ℝ (ee b : ℂ) (ee d : ℂ)).Nonempty := by + rcases hout with hda | hcd + · have h := ordered_chords_inter hab hbc + (d := d + 1) (by linarith [hd.1]) (by linarith) + rw [ee_add_one] at h + exact h + · exact ordered_chords_inter hab hbc hcd (by linarith [hd.2]) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section5Band.lean b/LeanPool/GraphMinor/GM12/Section5Band.lean new file mode 100644 index 0000000000..8e544e6819 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section5Band.lean @@ -0,0 +1,214 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutIArc +public import LeanPool.GraphMinor.Surface.ModelCriterion +import LeanPool.GraphMinor.GM11.Ties + +/-! +# Cutting a Möbius band or an annulus along a line + +We show that cutting a surface homeomorphic to `SurfaceModel 0 1 1` along a line with ends on the +boundary gives either a closed disc or two components (`exists_cut_band`). The connected case uses +the same normal form of the gluing word as `cutIArc`. A closed curve that misses the line of a cut +with the disc as result is null-homotopic (`null_of_cut`). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Function GraphMinor.Surface + +universe u + +local notation "𝕀" => unitInterval + +/-- A connected cut of the band is a closed disc. -/ +theorem exists_cut_band {S : Type u} [TopologicalSpace S] [ConnectedSpace S] {F : Set S} {s t : S} + (hS : IsSurface S) (hst : s ≠ t) (hF : F ∩ bd S = {s, t}) (hl : IsLineWithEnds F s t) + (hM : Nonempty (S ≃ₜ SurfaceModel 0 1 1)) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S), IsSurface Y + ∧ IsCutting ψ F ∧ + ∃ X X' : Set Y, X ∪ X' = ψ ⁻¹' F ∧ Disjoint X X' ∧ IsLine X ∧ IsLine X' ∧ + (Nonempty (Y ≃ₜ ClosedUnitDisc) ∨ ∃ W₁ W₂ : Set Y, X ⊆ W₁ ∧ X' ⊆ W₂ ∧ IsClopen W₁ ∧ + IsClopen W₂ ∧ W₁ ∪ W₂ = univ ∧ Disjoint W₁ W₂) := by + have hcS : CompactSpace S := hS.1 + have ht2 : T2Space S := hS.2.1 + obtain ⟨Y, tY, t2Y, ψ, hY, hψ, X, X', hP⟩ := exists_cut_arc hS hst hF hl + have hcY : CompactSpace Y := hY.1 + refine ⟨Y, tY, t2Y, ψ, hY, hψ, ?_⟩ + have hFc : IsClosed F := hl.isCompact.isClosed + have hPc := hP + obtain ⟨x0, x1, y0, y1, l1, l2, hd, hun, b1, b2, h7, h8, h9, h10⟩ := hP + have hline₁ : IsLine X := by + obtain ⟨f, -⟩ := l1 + exact ⟨f⟩ + have hline₂ : IsLine X' := by + obtain ⟨f, -⟩ := l2 + exact ⟨f⟩ + refine ⟨X, X', hun, hd, hline₁, hline₂, ?_⟩ + obtain ⟨a₀, ξ, η, L, ha0, ha1, himξ, himη, hiξ, hiη⟩ := exists_arcLift hPc hψ + have pX : IsPreconnected X := himξ ▸ isPreconnected_Icc.image _ L.cξ + have pX' : IsPreconnected X' := himη ▸ isPreconnected_Icc.image _ L.cη + have hex : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hx : ξ 0 ∈ X := himξ ▸ ⟨0, hex, rfl⟩ + have hy : η 0 ∈ X' := himη ▸ ⟨0, hex, rfl⟩ + have hsb : s ∈ bd S := (show s ∈ F ∩ bd S from hF ▸ mem_insert _ _).2 + have htb : t ∈ bd S := (show t ∈ F ∩ bd S from hF ▸ mem_insert_of_mem _ rfl).2 + obtain ⟨eM⟩ := hM + have hcrit := modelCriterion.2 + rcases cut_comps hψ hY pX pX' hun hx hy with hYc | ⟨W₁, W₂, -, -, hX₁, hX₂, hW₁, hW₂, hU, hdW, -, + -⟩ + · left + obtain ⟨a, b, c, hcpos, ⟨e⟩, hmodels⟩ := + connected_cut_arc_models hY hYc hψ hPc hFc hsb htb + rcases hmodels with he' | ⟨-, he' | ⟨hc, he' | he'⟩⟩ <;> obtain ⟨e'⟩ := he' + · have := (hcrit _ _ _ _ _ _).mp ⟨e'.symm.trans eM⟩ + omega + · have h := (hcrit _ _ _ _ _ _).mp ⟨e'.symm.trans eM⟩ + have ha : a = 0 := by omega + have hb : b = 0 := by omega + have hc : c = 1 := by omega + subst ha hb hc + obtain ⟨d⟩ := nonempty_disc_homeo + exact ⟨e.trans d⟩ + · have := (hcrit _ _ _ _ _ _).mp ⟨e'.symm.trans eM⟩ + omega + · have := (hcrit _ _ _ _ _ _).mp ⟨e'.symm.trans eM⟩ + omega + · exact .inr ⟨W₁, W₂, hX₁, hX₂, hW₁, hW₂, hU, hdW⟩ + +/-- Cutting an annulus along a line between its two cuffs gives a closed disc. -/ +theorem exists_cut_annulus {S : Type u} [TopologicalSpace S] [ConnectedSpace S] {F : Set S} {s t : + S} + (hS : IsSurface S) (hst : s ≠ t) (hF : F ∩ bd S = {s, t}) (hl : IsLineWithEnds F s t) + (hM : Nonempty (S ≃ₜ SurfaceModel 0 0 2)) + (hne : connectedComponentIn (bd S) s ≠ connectedComponentIn (bd S) t) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (ψ : Y → S), IsSurface Y ∧ IsCutting ψ F ∧ + Nonempty (Y ≃ₜ ClosedUnitDisc) := by + obtain ⟨Y, tY, ψ, hY, hψ, h1, -, -⟩ := cutIArc S F s t hS inferInstance hst hF hl + obtain ⟨-, a, b, c, ⟨e₁⟩, ⟨e₂⟩⟩ := h1 hne + obtain ⟨eM⟩ := hM + have h := modelCriterion.2 _ _ _ _ _ _ |>.mp ⟨e₁.symm.trans eM⟩ + have ha : a = 0 := by omega + have hb : b = 0 := by omega + have hc : c = 1 := by omega + subst ha hb hc + obtain ⟨d⟩ := nonempty_disc_homeo + exact ⟨Y, tY, ψ, hY, hψ, ⟨e₂.trans d⟩⟩ + +/-- A closed curve that misses the line of a cut whose result is a closed disc is null-homotopic. -/ +theorem null_of_cut {S Y : Type u} [TopologicalSpace S] [T2Space S] [TopologicalSpace Y] + [CompactSpace Y] + {ψ : Y → S} {F : Set S} (hψ : IsCutting ψ F) (e : Y ≃ₜ ClosedUnitDisc) (c : C(Circle, S)) + (hc : ∀ x, c x ∉ F) : ClosedCurveIsNullHomotopicIn univ c := by + classical + have hsurj := hψ.2.1 + have hlift : ∀ x, ∃ y, ψ y = c x := fun x => hsurj _ + choose l hl using hlift + have hunique : ∀ x y, ψ y = c x → y = l x := fun x y hy => + hψ.2.2.1 (show y ∈ ψ ⁻¹' Fᶜ by simpa [hy] using hc x) + (show l x ∈ ψ ⁻¹' Fᶜ by simpa [hl x] using hc x) (hy.trans (hl x).symm) + have hlc : Continuous l := by + rw [continuous_iff_isClosed] + intro K hK + have he : l ⁻¹' K = c ⁻¹' (ψ '' K) := by + ext x + constructor + · intro hx + exact ⟨l x, hx, hl x⟩ + · rintro ⟨y, hy, he⟩ + change l x ∈ K + rw [← hunique x y he] + exact hy + rw [he] + exact (hK.isCompact.image hψ.1).isClosed.preimage c.continuous + have hcv : Convex ℝ ClosedUnitDisc := convex_closedBall 0 1 + have h0 : (0 : EuclideanPlane) ∈ ClosedUnitDisc := by simp [ClosedUnitDisc] + let H : Circle × 𝕀 → ClosedUnitDisc := fun p => ⟨(1 - p.2.1) • (e (l p.1)).1, by + have := hcv h0 (e (l p.1)).2 p.2.2.1 (sub_nonneg.mpr p.2.2.2) (by ring) + simpa using this⟩ + have hH : Continuous H := by + refine Continuous.subtype_mk ?_ _ + have : Continuous fun p : Circle × 𝕀 => (e (l p.1)).1 := + continuous_subtype_val.comp (e.continuous.comp (hlc.comp continuous_fst)) + fun_prop + let z₀ : Y := e.symm ⟨0, h0⟩ + refine ⟨ψ z₀, mem_univ _, ⟨⟨fun p => ψ (e.symm (H p)), hψ.1.comp (e.symm.continuous.comp hH)⟩, + fun _ => mem_univ _, ?_, ?_⟩⟩ + · intro x + change ψ (e.symm (H (x, 0))) = c x + have : H (x, 0) = e (l x) := Subtype.ext (by simp [H]) + rw [this, e.symm_apply_apply, hl] + · intro x + change ψ (e.symm (H (x, 1))) = ψ z₀ + have : H (x, 1) = ⟨0, h0⟩ := Subtype.ext (by simp [H]) + rw [this] + +/-- A connected set off the cut line that holds every boundary point off the line rules out a cut +with two components. The side that the set misses would have boundary only on one lift of the line, +which is a line, but its boundary includes an `O`-arc. -/ +theorem no_split {S Y : Type u} [TopologicalSpace S] [T2Space S] [TopologicalSpace Y] [T2Space Y] + [CompactSpace Y] (hY : IsSurface Y) {ψ : Y → S} {F : Set S} (hψ : IsCutting ψ F) + (hF : IsClosed F) + {X X' : Set Y} (hu : X ∪ X' = ψ ⁻¹' F) (hl : IsLine X) (hl' : IsLine X') + {W₁ W₂ : Set Y} (hX₁ : X ⊆ W₁) (hX₂ : X' ⊆ W₂) (hW₁ : IsClopen W₁) (hW₂ : IsClopen W₂) + (hU : W₁ ∪ W₂ = univ) (hdW : Disjoint W₁ W₂) {G : Set S} (hG : IsPreconnected G) + (hGF : Disjoint G F) (hbd : bd S \ F ⊆ G) : False := by + have hcuff := cuff_statement.{u} Y hY + have hinj : ∀ {y y' : Y}, ψ y = ψ y' → ψ y ∉ F → y = y' := fun {y y'} he hn => + hψ.2.2.1 (show y ∈ ψ ⁻¹' Fᶜ from hn) (show y' ∈ ψ ⁻¹' Fᶜ from fun hm => hn (he.symm ▸ hm)) he + have key : ∀ {Z Z' W W' : Set Y}, IsLine Z' → Z' ⊆ W' → Z ⊆ W → Z ∪ Z' = ψ ⁻¹' F → IsClopen W' → + Disjoint W W' → W ∪ W' = univ → G ⊆ ψ '' W → False := by + intro Z Z' W W' hL hZ' hZ hun hcl hdj hcov hGW + obtain ⟨f⟩ := id hL + have hy₀ := (f 0).2 + have hbdZ : Z' ⊆ bd Y := fun z hz => hψ.2.2.2.2 (hun ▸ Or.inr hz) + have hC : connectedComponentIn (bd Y) (f 0).1 ∈ cuffs Y := ⟨_, hbdZ hy₀, rfl⟩ + have hsub : connectedComponentIn (bd Y) (f 0).1 ⊆ W' := + isPreconnected_connectedComponentIn.subset_isClopen hcl + ⟨_, mem_connectedComponentIn (hbdZ hy₀), hZ' hy₀⟩ + refine GM11.not_isOArc_of_subset_line hL (hcuff.2.2 _ hC) fun y hy => ?_ + by_contra hn + have hyW := hsub hy + have hyF : ψ y ∉ F := by + intro hm + have : y ∈ Z ∪ Z' := hun ▸ hm + rcases this with h | h + · exact Set.disjoint_left.mp hdj (hZ h) hyW + · exact hn h + have hb := bd_of_bd hψ hF (connectedComponentIn_subset _ _ hy) hyF + obtain ⟨y', hy', he⟩ := hGW (hbd ⟨hb, hyF⟩) + have := hinj he (he ▸ hyF) + subst this + exact Set.disjoint_left.mp hdj hy' hyW + have hclo : ∀ {W : Set Y}, IsClopen W → IsClosed (ψ '' W) := fun hW => + (hW.1.isCompact.image hψ.1).isClosed + by_cases h₁ : G ⊆ ψ '' W₁ + · exact key hl' hX₂ hX₁ hu hW₂ hdW hU h₁ + by_cases h₂ : G ⊆ ψ '' W₂ + · exact key hl hX₁ hX₂ (by rwa [Set.union_comm]) hW₁ hdW.symm (by rwa [Set.union_comm]) h₂ + obtain ⟨a, ha, ha'⟩ := not_subset.mp h₁ + obtain ⟨b, hb, hb'⟩ := not_subset.mp h₂ + have hcover : G ⊆ ψ '' W₁ ∪ ψ '' W₂ := by + intro x _ + obtain ⟨y, rfl⟩ := hψ.2.1 x + have : y ∈ W₁ ∪ W₂ := hU ▸ mem_univ y + exact this.imp (mem_image_of_mem _) (mem_image_of_mem _) + obtain ⟨z, hz, ⟨y₁, h₁', rfl⟩, ⟨y₂, h₂', he⟩⟩ := isPreconnected_closed_iff.mp hG _ _ (hclo hW₁) + (hclo hW₂) + hcover ⟨b, hb, (hcover hb).resolve_right hb'⟩ ⟨a, ha, (hcover ha).resolve_left ha'⟩ + have hn : ψ y₁ ∉ F := Set.disjoint_left.mp hGF hz + have := hinj he.symm hn + subst this + exact Set.disjoint_left.mp hdW h₁' h₂' + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section5Cap.lean b/LeanPool/GraphMinor/GM12/Section5Cap.lean new file mode 100644 index 0000000000..b015382254 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section5Cap.lean @@ -0,0 +1,303 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section5Side +import LeanPool.GraphMinor.Surface.HoleDisc +import LeanPool.GraphMinor.Surface.SurfacePull +import LeanPool.GraphMinor.Surface.AddCrosscap +import LeanPool.GraphMinor.GM11.PlaneFacts + +/-! +# From the surface to the capped surface + +Graph Minors XII, Section 5 (pages 254–255), works with a surface `Σ`, the part `Σ₁` of it, and the +surface `Σ̂₁` made by filling in discs. Here `capUp` moves a subset of `Σ` to `Σ̂₁` and `capDown` +moves +it back. We show that the closures of the filled-in discs are closed discs, and that the conditions +of (5.3) give the conditions `CapSetup` of `Section5Side.lean`. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 Hypergraph + +universe u + +variable {S T : Type u} [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] + {n : ℕ} {C : Fin n → Set S} {P₁ P₂ : Set S} {ι : P₁ → T} {D : Fin n → Set T} + +@[expose] public section + +/-- The part of `X ⊆ Σ` in `Σ₁`, moved to `Σ̂₁`. -/ +def capUp (ι : P₁ → T) (X : Set S) : Set T := ι '' ((↑) ⁻¹' X) + +end + +/-- The part of `Y ⊆ Σ̂₁` in `Σ₁`, moved back to `Σ`. -/ +@[expose] def capDown (ι : P₁ → T) (Y : Set T) : Set S := (↑) '' (ι ⁻¹' Y) + +omit [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] in +theorem mem_capUp {X : Set S} {y : T} : y ∈ capUp ι X ↔ ∃ x : P₁, x.1 ∈ X ∧ ι x = y := Iff.rfl + +omit [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] in +theorem mem_capDown {Y : Set T} {x : S} : x ∈ capDown ι Y ↔ ∃ p : P₁, ι p ∈ Y ∧ p.1 = x := Iff.rfl + +omit [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] in +theorem capUp_mono {X X' : Set S} (h : X ⊆ X') : capUp ι X ⊆ capUp ι X' := + image_mono (preimage_mono h) + +omit [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] in +theorem capDown_subset (Y : Set T) : capDown ι Y ⊆ P₁ := by + rintro _ ⟨p, -, rfl⟩ + exact p.2 + +omit [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] in +theorem capUp_subset_range (X : Set S) : capUp ι X ⊆ range ι := image_subset_range _ _ + +omit [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] in +theorem val_mem_capUp {X : Set S} {x : S} (hx₁ : x ∈ P₁) (hx : x ∈ X) : ι ⟨x, hx₁⟩ ∈ capUp ι X := + ⟨⟨x, hx₁⟩, hx, rfl⟩ + +section inj + +variable (hι : Function.Injective ι) +include hι + +omit [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] in +theorem mem_capUp_val {X : Set S} {p : P₁} : ι p ∈ capUp ι X ↔ p.1 ∈ X := by + constructor + · rintro ⟨q, hq, he⟩ + rwa [← hι he] + · exact fun h => ⟨p, h, rfl⟩ + +omit [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] in +theorem capDown_capUp {X : Set S} (hX : X ⊆ P₁) : capDown ι (capUp ι X) = X := by + ext x + constructor + · rintro ⟨p, hp, rfl⟩ + exact (mem_capUp_val hι).mp hp + · intro hx + exact ⟨⟨x, hX hx⟩, (mem_capUp_val hι).mpr hx, rfl⟩ + +omit [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] hι in +theorem capUp_capDown {Y : Set T} (hY : Y ⊆ range ι) : capUp ι (capDown ι Y) = Y := by + ext y + constructor + · rintro ⟨p, ⟨q, hq, he⟩, rfl⟩ + rw [Subtype.ext he.symm] + exact hq + · intro hy + obtain ⟨p, rfl⟩ := hY hy + exact ⟨p, ⟨p, hy, rfl⟩, rfl⟩ + +omit [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] in +theorem ncard_capUp {X : Set S} (hX : X ⊆ P₁) : (capUp ι X).ncard = X.ncard := by + have h1 : (capUp ι X).ncard = ((↑) ⁻¹' X : Set P₁).ncard := ncard_image_of_injective _ hι + have h2 : X = (↑) '' ((↑) ⁻¹' X : Set P₁) := by + rw [Subtype.image_preimage_coe] + exact (inter_eq_right.mpr hX).symm + rw [h1] + conv_rhs => rw [h2] + exact (ncard_image_of_injective _ Subtype.val_injective).symm + +end inj + +omit [T2Space T] in +theorem IsCappedSplit.isClosed₁ (h : IsCappedSplit C P₁ P₂ ι D) : IsClosed P₁ := by + have : CompactSpace P₁ := h.manifold₁.1 + exact isCompact_iff_compactSpace.mpr this |>.isClosed + +omit [T2Space T] in +theorem IsCappedSplit.isClosed₂ (h : IsCappedSplit C P₁ P₂ ι D) : IsClosed P₂ := by + have : CompactSpace P₂ := h.manifold₂.1 + exact isCompact_iff_compactSpace.mpr this |>.isClosed + +omit [T2Space S] [T2Space T] in +theorem IsCappedSplit.C_sub₁ (h : IsCappedSplit C P₁ P₂ ι D) (k : Fin n) : C k ⊆ P₁ := fun _ hx => + (h.inter.symm ▸ mem_iUnion.mpr ⟨k, hx⟩ : _ ∈ P₁ ∩ P₂).1 + +omit [T2Space S] [T2Space T] in +theorem IsCappedSplit.C_sub₂ (h : IsCappedSplit C P₁ P₂ ι D) (k : Fin n) : C k ⊆ P₂ := fun _ hx => + (h.inter.symm ▸ mem_iUnion.mpr ⟨k, hx⟩ : _ ∈ P₁ ∩ P₂).2 + +omit [T2Space S] [T2Space T] in +theorem IsCappedSplit.D_off (h : IsCappedSplit C P₁ P₂ ι D) (k : Fin n) : Disjoint (D k) (range ι) + := by + refine Set.disjoint_left.mpr fun x hx hr => ?_ + have : x ∈ (range ι)ᶜ := h.compl ▸ mem_iUnion.mpr ⟨k, hx⟩ + exact this hr + +omit [T2Space S] in +theorem IsCappedSplit.isClosed_range (h : IsCappedSplit C P₁ P₂ ι D) : IsClosed (range ι) := by + have : CompactSpace P₁ := h.manifold₁.1 + exact (isCompact_range h.isEmbedding.continuous).isClosed + +omit [T2Space S] [T2Space T] in +/-- The boundary of `D k`, as a subset of the closure. -/ +theorem closure_diff_eq (h : IsCappedSplit C P₁ P₂ ι D) (k : Fin n) : + closure (D k) \ D k = capUp ι (C k) := by + have := h.bounds k + change subBd (D k) = capUp ι (C k) at this + rw [← this, subBd] + have hop : IsClosed (univ \ D k) := by + rw [← compl_eq_univ_sdiff] + exact (h.isOpenDisc k).1.isClosed_compl + rw [hop.closure_eq] + ext x + simp [mem_sdiff, mem_inter_iff] + +omit [T2Space S] [T2Space T] in +theorem isOArc_capUp (h : IsCappedSplit C P₁ P₂ ι D) (k : Fin n) : IsOArc (capUp ι (C k)) := by + have hpre : IsOArc ((↑) ⁻¹' C k : Set P₁) := by + apply isOArc_of_image IsEmbedding.subtypeVal + rw [Subtype.image_preimage_coe, inter_eq_right.mpr (h.C_sub₁ k)] + exact h.isOArc k + exact isOArc_image h.isEmbedding hpre + +omit [T2Space S] [T2Space T] in +/-- A point of a cap boundary is a limit of points of `Σ₁` off the cap boundaries. -/ +theorem mem_closure_off (h : IsCappedSplit C P₁ P₂ ι D) (k : Fin n) {x : T} (hx : x ∈ capUp ι + (C k)) : + x ∈ closure (closure (D k))ᶜ := by + obtain ⟨c, hc, rfl⟩ := hx + have hm := mem_closure_compl_bd (h.manifold₁.2.2 c) + have hcont := h.isEmbedding.continuous + have h1 : ι c ∈ closure (ι '' (bd P₁)ᶜ) := image_closure_subset_closure_image hcont ⟨c, hm, rfl⟩ + refine closure_mono ?_ h1 + rintro _ ⟨p, hp, rfl⟩ hcl + have hr : ι p ∈ closure (D k) \ D k := + ⟨hcl, fun hD => Set.disjoint_left.mp (h.D_off k) hD ⟨p, rfl⟩⟩ + rw [closure_diff_eq h] at hr + have hpC : p.1 ∈ C k := (mem_capUp_val h.isEmbedding.injective).mp hr + have hbd : p.1 ∈ (↑) '' bd P₁ := h.bd₁ ▸ mem_iUnion.mpr ⟨k, hpC⟩ + obtain ⟨q, hq, he⟩ := hbd + rw [Subtype.ext he] at hq + exact hp hq + +variable [ConnectedSpace T] + +omit [T2Space S] [T2Space T] in +/-- The closure of a filled-in disc is a closed disc, bounded by the matching `O`-arc. -/ +theorem cap_closure (h : IsCappedSplit C P₁ P₂ ι D) (k : Fin n) : + IsClosedDisc (closure (D k)) ∧ discBd (closure (D k)) = capUp ι (C k) ∧ + discInt (closure (D k)) = D k := by + have hS := IsClosedSurface.isSurface h.surface_hat + have hb : bd T = ∅ := eq_empty_of_forall_notMem fun x hx => hx (h.surface_hat.2.2 x) + have hO : IsOArc (closure (D k) \ D k) := by + rw [closure_diff_eq h] + exact isOArc_capUp h k + obtain ⟨h1, h2⟩ := closure_disc hS (h.isOpenDisc k) (by rw [hb]; exact disjoint_bot_right) hO + (fun x hx => mem_closure_off h k (closure_diff_eq h k ▸ hx)) + refine ⟨h1, h2.trans (closure_diff_eq h k), ?_⟩ + rw [discInt, h2] + ext x + constructor + · rintro ⟨hx, hn⟩ + by_contra hD + exact hn ⟨hx, hD⟩ + · exact fun hx => ⟨subset_closure hx, fun hn => hn.2 hx⟩ + +omit [ConnectedSpace T] in +omit [T2Space T] in +/-- Moving a normal line back to `Σ`. -/ +theorem line_capDown (h : IsCappedSplit C P₁ P₂ ι D) {L : Set T} (hL : IsLine L) + (hoff : L ⊆ range ι) : IsLine (capDown ι L) := by + obtain ⟨f⟩ := hL + have hu : ∃ u v, IsLineWithEnds L u v := ⟨_, _, f, rfl, rfl⟩ + obtain ⟨u, v, hl⟩ := hu + obtain ⟨u', v', -, -, hp⟩ := hl.pull h.isEmbedding hoff + have hl' := hp.map_of_embedding (j := ((↑) : P₁ → S)) IsEmbedding.subtypeVal + obtain ⟨g, -⟩ := hl' + exact ⟨g⟩ + +omit [T2Space T] in +/-- The conditions of (5.3) give `CapSetup` for the closures of the filled-in discs. -/ +theorem capSetup {Γ : Drawing S} {Γ₁ : Drawing T} {θ : ℕ} + {𝒯 : Set (Hypergraph T (Set T) × Hypergraph T (Set T))} + (h : IsCappedSplit C P₁ P₂ ι D) (hΓ : IsCappedDrawing ι Γ Γ₁) + (hN : ∀ k, Γ.IsNormal (C k)) (hT : IsTangle Γ₁.toHypergraph θ 𝒯) + (hR : (PaintingOrDrawing.drawing Γ₁).IsRespectful θ 𝒯) + (hi : ∀ k l, k ≠ l → ∀ F : Set S, IsLine F → Γ.IsNormal F → F ⊆ P₁ → + (F ∩ C k).Nonempty → (F ∩ C l).Nonempty → θ ≤ (F ∩ Γ.V).ncard) + (hm : ∀ k, θ ≤ (Γ.V ∩ C k).ncard) + (hf : ∀ k, ∀ X ⊆ capUp ι (Γ.V ∩ C k), X.ncard ≤ θ → IsFreeSet Γ₁.toHypergraph 𝒯 θ X) : + CapSetup (fun k => closure (D k)) Γ₁ θ 𝒯 := by + have hιi := h.isEmbedding.injective + have hV : ∀ {X : Set S}, X ⊆ P₁ → capUp ι (X ∩ Γ.V) = capUp ι X ∩ Γ₁.V := by + intro X _ + rw [hΓ.2] + ext y + constructor + · rintro ⟨p, ⟨h1, h2⟩, rfl⟩ + exact ⟨⟨p, h1, rfl⟩, ⟨p, h2, rfl⟩⟩ + · rintro ⟨⟨p, h1, rfl⟩, h2⟩ + exact ⟨p, ⟨h1, (mem_capUp_val hιi).mp h2⟩, rfl⟩ + have hbdV : ∀ k, discBd (closure (D k)) ∩ Γ₁.V = capUp ι (Γ.V ∩ C k) := by + intro k + rw [(cap_closure h k).2.1, Set.inter_comm Γ.V, hV (h.C_sub₁ k)] + refine ⟨fun k => (cap_closure h k).1, ?_, ?_, hT, hR, ?_, ?_, ?_⟩ + · intro k l hkl + refine Set.disjoint_left.mpr fun x hk hl => ?_ + have hcase : ∀ m, x ∈ closure (D m) → x ∈ D m ∨ x ∈ capUp ι (C m) := fun m hm' => by + by_cases hd : x ∈ D m + · exact .inl hd + · exact .inr (closure_diff_eq h m ▸ ⟨hm', hd⟩) + rcases hcase k hk with h1 | h1 <;> rcases hcase l hl with h2 | h2 + · exact Set.disjoint_left.mp (h.disjoint_D k l hkl) h1 h2 + · exact Set.disjoint_left.mp (h.D_off k) h1 (capUp_subset_range _ h2) + · exact Set.disjoint_left.mp (h.D_off l) h2 (capUp_subset_range _ h1) + · obtain ⟨p, hp, rfl⟩ := h1 + exact Set.disjoint_left.mp (h.disjoint k l hkl) hp ((mem_capUp_val hιi).mp h2) + · intro k x ⟨hxc, hxU⟩ + have hU : x ∈ capUp ι Γ.U := by + have := hxU + rw [hΓ.1] at this + exact this + have hxd : x ∉ D k := fun hd => Set.disjoint_left.mp (h.D_off k) hd (capUp_subset_range _ hU) + have hxC : x ∈ capUp ι (C k) := closure_diff_eq h k ▸ ⟨hxc, hxd⟩ + refine ⟨(cap_closure h k).2.1 ▸ hxC, ?_⟩ + obtain ⟨p, hp, rfl⟩ := hxC + have hpU : p.1 ∈ Γ.U := (mem_capUp_val hιi).mp hU + rw [hΓ.2] + exact ⟨p, hN k ⟨hp, hpU⟩, rfl⟩ + · intro k l hkl L hL hNL hoff hk hl + have hLr : L ⊆ range ι := by + intro x hx + by_contra hn + have : x ∈ ⋃ m, D m := h.compl ▸ hn + obtain ⟨m, hm'⟩ := mem_iUnion.mp this + exact Set.disjoint_left.mp (hoff m) hx ((cap_closure h m).2.2.symm ▸ hm') + have hmeet : ∀ m, (L ∩ closure (D m)).Nonempty → (capDown ι L ∩ C m).Nonempty := by + rintro m ⟨x, hxL, hxc⟩ + have hxC : x ∈ capUp ι (C m) := closure_diff_eq h m ▸ + ⟨hxc, fun hd => Set.disjoint_left.mp (h.D_off m) hd (hLr hxL)⟩ + obtain ⟨p, hp, rfl⟩ := hxC + exact ⟨p.1, ⟨p, hxL, rfl⟩, hp⟩ + have hsubP := capDown_subset (ι := ι) L + have hN' : Γ.IsNormal (capDown ι L) := by + rintro _ ⟨⟨p, hp, rfl⟩, hpU⟩ + have : ι p ∈ L ∩ Γ₁.U := ⟨hp, by rw [hΓ.1]; exact ⟨p, hpU, rfl⟩⟩ + have hv := hNL this + rw [hΓ.2] at hv + exact (mem_capUp_val hιi).mp hv + have := hi k l hkl _ (line_capDown h hL hLr) hN' hsubP (hmeet k hk) (hmeet l hl) + have he : capUp ι (capDown ι L ∩ Γ.V) = L ∩ Γ₁.V := by + rw [hV hsubP, capUp_capDown hLr] + rw [← he, ncard_capUp hιi (inter_subset_left.trans hsubP)] + exact this + · intro k + rw [hbdV, ncard_capUp hιi (inter_subset_right.trans (h.C_sub₁ k))] + exact hm k + · intro k X hX hc + exact hf k X (hbdV k ▸ hX) hc + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section5Collar.lean b/LeanPool/GraphMinor/GM12/Section5Collar.lean new file mode 100644 index 0000000000..038b78183a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section5Collar.lean @@ -0,0 +1,260 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section5Cap +public import LeanPool.GraphMinor.GM12.Section5Curve +import LeanPool.GraphMinor.Surface.MoveCuff +import LeanPool.GraphMinor.Surface.AddCrosscap + +/-! +# A collar of the common boundary + +In the setting of Graph Minors XII, Section 5, each `O`-arc `C k` is a cuff of `Σ₁`, so it has a +collar +in `Σ₁`. We take these collars disjoint, and put them together in one map `b`, with level zero on +the +`O`-arcs and with the other levels outside `Σ₂` (`exists_outerCollar`). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric GraphMinor.Surface + +local notation "𝕀" => unitInterval + +universe u + +variable {S T : Type u} [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] + {n : ℕ} {C : Fin n → Set S} {P₁ P₂ : Set S} {ι : P₁ → T} {D : Fin n → Set T} + +omit [T2Space T] in +/-- Each `C k`, seen in `Σ₁`, is a cuff of `Σ₁`. -/ +theorem isCuff_preimage (h : IsCappedSplit C P₁ P₂ ι D) (k : Fin n) : + IsCuff (((↑) ⁻¹' C k : Set P₁)) := by + classical + have hbd : bd P₁ = (↑) ⁻¹' ⋃ i, C i := by + rw [← h.bd₁] + exact (preimage_image_eq _ Subtype.val_injective).symm + have hO : ∀ i, IsOArc ((↑) ⁻¹' C i : Set P₁) := fun i => by + apply isOArc_of_image IsEmbedding.subtypeVal + rw [Subtype.image_preimage_coe, inter_eq_right.mpr (h.C_sub₁ i)] + exact h.isOArc i + have hcl : ∀ i, IsClosed ((↑) ⁻¹' C i : Set P₁) := fun i => by + obtain ⟨f⟩ := hO i + have : CompactSpace ((↑) ⁻¹' C i : Set P₁) := f.compactSpace + exact (isCompact_iff_compactSpace.mpr this).isClosed + have hconn : ∀ i, IsPreconnected ((↑) ⁻¹' C i : Set P₁) := fun i => by + obtain ⟨f⟩ := hO i + have hr : range (fun x : Circle => (f x).1) = (↑) ⁻¹' C i := by + ext x + constructor + · rintro ⟨w, rfl⟩ + exact (f w).2 + · intro hx + refine ⟨f.symm ⟨x, hx⟩, ?_⟩ + simp + rw [← hr] + exact isPreconnected_range (continuous_subtype_val.comp f.continuous) + obtain ⟨g⟩ := hO k + let x := (g 1) + have hxk : x.1 ∈ ((↑) ⁻¹' C k : Set P₁) := x.2 + have hxbd : x.1 ∈ bd P₁ := by + rw [hbd] + exact mem_iUnion.mpr ⟨k, hxk⟩ + refine ⟨x.1, hxbd, ?_⟩ + apply Subset.antisymm + · have hsub : connectedComponentIn (bd P₁) x.1 ⊆ (↑) ⁻¹' C k ∪ (⋃ i ∈ {i | i ≠ k}, (↑) ⁻¹' C i) + := by + intro y hy + have hyb := connectedComponentIn_subset _ _ hy + rw [hbd] at hyb + obtain ⟨i, hi⟩ := mem_iUnion.mp hyb + by_cases hik : i = k + · subst hik + exact .inl hi + · exact .inr (mem_biUnion hik hi) + have hcl' : IsClosed (⋃ i ∈ {i | i ≠ k}, ((↑) ⁻¹' C i : Set P₁)) := + (Set.toFinite _).isClosed_biUnion fun i _ => hcl i + by_contra hns + obtain ⟨y, hy, hyn⟩ := not_subset.mp hns + have hy2 := (hsub hy).resolve_left hyn + obtain ⟨z, hz, hzz⟩ := (isPreconnected_closed_iff.mp isPreconnected_connectedComponentIn) _ _ + (hcl k) hcl' hsub + ⟨x.1, mem_connectedComponentIn hxbd, hxk⟩ ⟨y, hy, hy2⟩ + obtain ⟨i, hik, hi⟩ := mem_iUnion₂.mp hzz.2 + exact Set.disjoint_left.mp (h.disjoint k i (Ne.symm hik)) hzz.1 hi + · apply (hconn k).subset_connectedComponentIn hxk + rw [hbd] + exact preimage_mono (subset_iUnion C k) + +omit [T2Space T] in +/-- Disjoint open neighbourhoods of the `O`-arcs in `Σ₁`. -/ +theorem exists_disjoint_nhds (h : IsCappedSplit C P₁ P₂ ι D) : + ∃ U : Fin n → Set P₁, (∀ k, IsOpen (U k)) ∧ (∀ k, ((↑) ⁻¹' C k : Set P₁) ⊆ U k) ∧ + ∀ k l, k ≠ l → Disjoint (U k) (U l) := by + classical + have : CompactSpace P₁ := h.manifold₁.1 + have hcomp : ∀ i, IsCompact ((↑) ⁻¹' C i : Set P₁) := fun i => by + apply (isCompact_iff_compactSpace.mpr ?_ : IsCompact _) + obtain ⟨f⟩ := id (show IsOArc ((↑) ⁻¹' C i : Set P₁) from by + apply isOArc_of_image IsEmbedding.subtypeVal + rw [Subtype.image_preimage_coe, inter_eq_right.mpr (h.C_sub₁ i)] + exact h.isOArc i) + exact f.compactSpace + have hsep : ∀ k l, k ≠ l → SeparatedNhds ((↑) ⁻¹' C k : Set P₁) ((↑) ⁻¹' C l) := fun k l hkl => + SeparatedNhds.of_isCompact_isCompact (hcomp k) (hcomp l) + (Set.disjoint_left.mpr fun x hx hx' => Set.disjoint_left.mp (h.disjoint k l hkl) hx hx') + choose! u v hu hv hCu hCv hd using hsep + let V : Fin n → Fin n → Set P₁ := fun k l => if k < l then u k l else v l k + refine ⟨fun k => ⋂ l ∈ {l | l ≠ k}, V k l, ?_, ?_, ?_⟩ + · intro k + refine (Set.toFinite _).isOpen_biInter fun l hl => ?_ + simp only [V] + split_ifs with hlt + · exact hu k l (Ne.symm hl) + · exact hv l k hl + · intro k x hx + refine mem_iInter₂.mpr fun l hl => ?_ + simp only [V] + split_ifs with hlt + · exact hCu k l (Ne.symm hl) hx + · exact hCv l k hl hx + · intro k l hkl + refine Set.disjoint_left.mpr fun x hk hl => ?_ + have h1 := mem_iInter₂.mp hk l (Ne.symm hkl) + have h2 := mem_iInter₂.mp hl k hkl + simp only [V] at h1 h2 + rcases lt_or_gt_of_ne hkl with hlt | hlt + · rw [ite_eq_left hlt] at h1 + rw [ite_eq_right (not_lt.mpr hlt.le)] at h2 + exact Set.disjoint_left.mp (hd k l hkl) h1 h2 + · rw [ite_eq_right (not_lt.mpr hlt.le)] at h1 + rw [ite_eq_left hlt] at h2 + exact Set.disjoint_left.mp (hd l k hkl.symm) h2 h1 + +omit [T2Space T] in +/-- A collar of the common boundary of `Σ₁` and `Σ₂` in `Σ₁`. -/ +theorem exists_outerCollar (h : IsCappedSplit C P₁ P₂ ι D) : + ∃ b : (Fin n × Circle) × 𝕀 → S, IsOuterCollar P₂ b ∧ (∀ p, b p ∈ P₁) ∧ + (∀ k, ∀ x ∈ C k, ∃ w, b ((k, w), 0) = x) ∧ (∀ y, b (y, 0) ∈ C y.1) ∧ + ∀ ε : 𝕀, ε ≠ 0 → IsOpen (P₂ ∪ b '' {p | p.2 < ε}) := by + classical + obtain ⟨U, hUo, hCU, hUd⟩ := exists_disjoint_nhds h + have hO : ∀ i, IsOArc ((↑) ⁻¹' C i : Set P₁) := fun i => by + apply isOArc_of_image IsEmbedding.subtypeVal + rw [Subtype.image_preimage_coe, inter_eq_right.mpr (h.C_sub₁ i)] + exact h.isOArc i + have hO' : ∀ i, Nonempty (Circle ≃ₜ ((↑) ⁻¹' C i : Set P₁)) := hO + let φ : ∀ i, Circle ≃ₜ ((↑) ⁻¹' C i : Set P₁) := fun i => Classical.choice (hO' i) + have hcoll := fun k => exists_collar h.manifold₁ (isCuff_preimage h k) (φ k) (hUo k) (hCU k) + choose β hβc hβi hβU hβ0 hβo using hcoll + let b' : Fin n × (Circle × 𝕀) → S := fun q => (β q.1 q.2).1 + have hb'c : Continuous b' := by + apply continuous_prod_of_discrete_left.mpr + intro k + exact continuous_subtype_val.comp (hβc k) + let e : (Fin n × Circle) × 𝕀 ≃ₜ Fin n × (Circle × 𝕀) := Homeomorph.prodAssoc _ _ _ + let b : (Fin n × Circle) × 𝕀 → S := fun p => (β p.1.1 (p.1.2, p.2)).1 + have hbc : Continuous b := hb'c.comp e.continuous + have hbi : Function.Injective b := by + rintro ⟨⟨k, w⟩, s⟩ ⟨⟨l, w'⟩, s'⟩ he + have he' : β k (w, s) = β l (w', s') := Subtype.ext he + by_cases hkl : k = l + · subst hkl + have := hβi k he' + simp only [Prod.mk.injEq] at this + rw [this.1, this.2] + · exact (Set.disjoint_left.mp (hUd k l hkl) (hβU k ⟨_, rfl⟩) (he' ▸ hβU l ⟨_, rfl⟩)).elim + have hb0 : ∀ y, b (y, 0) ∈ C y.1 := fun y => by + change (β y.1 (y.2, 0)).1 ∈ _ + rw [hβ0] + exact (φ y.1 y.2).2 + have hsurj : ∀ k, ∀ x ∈ C k, ∃ w, b ((k, w), 0) = x := by + intro k x hx + have hxk : (⟨x, h.C_sub₁ k hx⟩ : P₁) ∈ ((↑) ⁻¹' C k : Set P₁) := hx + refine ⟨(φ k).symm ⟨_, hxk⟩, ?_⟩ + change (β k (_, 0)).1 = x + rw [hβ0] + simp + have hP₂ : ∀ p, b p ∈ P₂ → p.2 = 0 := by + rintro ⟨⟨k, w⟩, s⟩ hp + have hmem : b ((k, w), s) ∈ P₁ ∩ P₂ := ⟨(β k (w, s)).2, hp⟩ + rw [h.inter] at hmem + obtain ⟨l, hl⟩ := mem_iUnion.mp hmem + obtain ⟨w', hw'⟩ := hsurj l _ hl + have hinj := hbi hw' + exact (congrArg Prod.snd hinj).symm + have hcol : IsOuterCollar P₂ b := + ⟨hbc, hbi, fun y => h.C_sub₂ y.1 (hb0 y), fun y s hs hm => hs (hP₂ (y, s) hm)⟩ + refine ⟨b, hcol, fun p => (β p.1.1 (p.1.2, p.2)).2, hsurj, hb0, ?_⟩ + intro ε hε + have hP₁ := h.isClosed₁ + have hε0 : (0 : 𝕀) < ε := unitInterval.pos_iff_ne_zero.mpr hε + let O : Fin n → Set P₁ := fun k => β k '' {p | p.2 < ε} + have hOo : ∀ k, IsOpen (O k) := by + intro k + have hcl : IsClosed (β k '' {p | ε ≤ p.2}) := by + have hc : IsClosed {p : Circle × 𝕀 | ε ≤ p.2} := isClosed_le continuous_const continuous_snd + have : CompactSpace P₁ := h.manifold₁.1 + exact (hc.isCompact.image (hβc k)).isClosed + have he : O k = (range (β k) \ β k '' {x | x.2 = 1}) \ β k '' {p | ε ≤ p.2} := by + ext y + constructor + · rintro ⟨p, hp, rfl⟩ + refine ⟨⟨⟨p, rfl⟩, ?_⟩, ?_⟩ + · rintro ⟨q, hq, he⟩ + have := hβi k he + subst this + have h1 : q.2 = 1 := hq + have h2 : q.2 < ε := hp + rw [h1] at h2 + exact absurd h2 (not_lt.mpr unitInterval.le_one') + · rintro ⟨q, hq, he⟩ + have := hβi k he + subst this + exact absurd (show q.2 < ε from hp) (not_lt.mpr (show ε ≤ q.2 from hq)) + · rintro ⟨⟨⟨p, rfl⟩, -⟩, hn⟩ + refine ⟨p, ?_, rfl⟩ + by_contra hge + exact hn ⟨p, (not_lt.mp (show ¬ p.2 < ε from hge) : ε ≤ p.2), rfl⟩ + rw [he] + exact (hβo k).sdiff hcl + have hTc : IsClosed (⋃ k, O k)ᶜ := (isOpen_iUnion hOo).isClosed_compl + have hcl : IsClosed (((↑) : P₁ → S) '' (⋃ k, O k)ᶜ) := + hP₁.isClosedEmbedding_subtypeVal.isClosedMap _ hTc + have hcompl : (P₂ ∪ b '' {p | p.2 < ε}) = (((↑) : P₁ → S) '' (⋃ k, O k)ᶜ)ᶜ := by + ext x + constructor + · rintro hx ⟨p, hp, rfl⟩ + rcases hx with hx | ⟨⟨⟨k, w⟩, s⟩, hs, he⟩ + · have hmem : p.1 ∈ P₁ ∩ P₂ := ⟨p.2, hx⟩ + rw [h.inter] at hmem + obtain ⟨l, hl⟩ := mem_iUnion.mp hmem + obtain ⟨w, hw⟩ := hsurj l _ hl + refine hp (mem_iUnion.mpr ⟨l, (w, 0), hε0, ?_⟩) + exact Subtype.ext hw + · exact hp (mem_iUnion.mpr ⟨k, (w, s), hs, Subtype.ext he⟩) + · intro hx + by_contra hn + have hn1 : x ∉ P₂ := fun h' => hn (.inl h') + have hn2 : x ∉ b '' {p | p.2 < ε} := fun h' => hn (.inr h') + have hx₁ : x ∈ P₁ := by + have : x ∈ P₁ ∪ P₂ := h.union ▸ mem_univ x + exact this.resolve_right hn1 + refine hx ⟨⟨x, hx₁⟩, ?_, rfl⟩ + intro hO' + obtain ⟨k, ⟨w, s⟩, hs, he⟩ := mem_iUnion.mp hO' + exact hn2 ⟨((k, w), s), hs, congrArg Subtype.val he⟩ + rw [hcompl] + exact hcl.isOpen_compl + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section5Curve.lean b/LeanPool/GraphMinor/GM12/Section5Curve.lean new file mode 100644 index 0000000000..6c6f5c20a3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section5Curve.lean @@ -0,0 +1,373 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscGrow +public import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.GM07.Section11 +import Mathlib.Topology.UnitInterval + +/-! +# Moving a closed curve + +Two tools for the proof of Graph Minors XII, (5.3) (page 256). The proof replaces the pieces of a +closed curve outside `Σ₂` by pieces on the boundary of `Σ₂`. `exists_replace` makes one such +replacement, inside a closed disc. There may be infinitely many pieces, but all but finitely many +lie in a thin collar of the boundary, and `exists_push` pushes these out of the collar at one +stroke. +This file also describes the arcs of the circle between points of a closed set (`IsGap`). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric GraphMinor.Surface + +local notation "𝕀" => unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- The inverse of an injective continuous map from a compact space is continuous on the range. -/ +theorem exists_continuousOn_inv {X Y : Type*} [TopologicalSpace X] [CompactSpace X] [Nonempty X] + [TopologicalSpace Y] [T2Space Y] {a : X → Y} (hc : Continuous a) (hi : Function.Injective a) : + ∃ r : Y → X, ContinuousOn r (range a) ∧ ∀ t, r (a t) = t := by + classical + have hemb : IsEmbedding a := (hc.isClosedEmbedding hi).isEmbedding + refine ⟨Function.invFun a, ?_, Function.leftInverse_invFun hi⟩ + rw [continuousOn_iff_continuous_domRestrict] + convert (hemb.toHomeomorph).symm.continuous using 1 + funext x + obtain ⟨_, t, rfl⟩ := x + have h : hemb.toHomeomorph t = ⟨a t, t, rfl⟩ := rfl + change Function.invFun a (a t) = _ + rw [Function.leftInverse_invFun hi t, ← h, Homeomorph.symm_apply_apply] + +omit [T2Space S] in +/-- Replace a piece `c ∘ a` of a closed curve by another path `γ` with the same ends in a closed +disc +that includes the piece. The new curve is homotopic to the old one, through the disc. -/ +theorem exists_replace {c : C(Circle, S)} {a b : 𝕀 → Circle} (hab : IsTwoArcs a b) + (hu : range a ∪ range b = univ) {γ : 𝕀 → S} (hγ : Continuous γ) (h0 : γ 0 = c (a 0)) + (h1 : γ 1 = c (a 1)) {Δ : Set S} (hΔ : IsClosedDisc Δ) (hc : ∀ t, c (a t) ∈ Δ) + (hγΔ : ∀ t, γ t ∈ Δ) : + ∃ c' : C(Circle, S), (∀ x ∈ range b, c' x = c x) ∧ (∀ t, c' (a t) = γ t) ∧ + ClosedCurvesHomotopicIn (range c ∪ Δ) c c' := by + classical + obtain ⟨h, g, ch⟩ := hΔ.exists_isChart + obtain ⟨r, hr, hra⟩ := exists_continuousOn_inv hab.arc_left.1 hab.arc_left.2 + let mix : Circle × 𝕀 → ℂ := fun p => + ((1 - p.2.1 : ℝ) : ℂ) * h (c p.1) + ((p.2.1 : ℝ) : ℂ) * h (γ (r p.1)) + have hclosed_a : IsClosed (range a) := (isCompact_range hab.arc_left.1).isClosed + have hclosed_b : IsClosed (range b) := (isCompact_range hab.arc_right.1).isClosed + have hdiscA : ∀ x ∈ range a, c x ∈ Δ := by + rintro _ ⟨t, rfl⟩ + exact hc t + have hdiscγ : ∀ x ∈ range a, γ (r x) ∈ Δ := fun x _ => hγΔ _ + have hmixmem : ∀ p : Circle × 𝕀, p.1 ∈ range a → mix p ∈ closedBall (0 : ℂ) 1 := by + intro p hp + have h1' := (convex_closedBall (0 : ℂ) 1) (ch.hm (hdiscA _ hp)) (ch.hm (hdiscγ _ hp)) + (a := 1 - p.2.1) (b := p.2.1) (by linarith [p.2.2.2]) p.2.2.1 (by ring) + simpa [mix, Complex.real_smul] using h1' + have hmixc : ContinuousOn mix (range a ×ˢ univ) := by + have ch1 : ContinuousOn (fun p : Circle × 𝕀 => h (c p.1)) (range a ×ˢ univ) := + ch.hc.comp (c.continuous.comp continuous_fst).continuousOn fun p hp => hdiscA _ hp.1 + have ch2 : ContinuousOn (fun p : Circle × 𝕀 => r p.1) (range a ×ˢ univ) := + hr.comp continuous_fst.continuousOn fun p hp => hp.1 + have ch3 : ContinuousOn (fun p : Circle × 𝕀 => h (γ (r p.1))) (range a ×ˢ univ) := + ch.hc.comp (hγ.comp_continuousOn ch2) fun p hp => hdiscγ _ hp.1 + have c1 : Continuous fun p : Circle × 𝕀 => ((1 - p.2.1 : ℝ) : ℂ) := by fun_prop + have c2 : Continuous fun p : Circle × 𝕀 => ((p.2.1 : ℝ) : ℂ) := by fun_prop + exact (c1.continuousOn.mul ch1).add (c2.continuousOn.mul ch3) + let H : Circle × 𝕀 → S := fun p => if p.1 ∈ range a then g (mix p) else c p.1 + have hHa : ContinuousOn H (range a ×ˢ univ) := + (ch.gc.comp hmixc fun p hp => hmixmem p hp.1).congr fun p hp => ite_eq_left hp.1 + have hend : ∀ x ∈ range a, x ∈ range b → γ (r x) = c x := by + rintro _ ⟨s, rfl⟩ ⟨t, ht⟩ + rw [hra] + rcases hab.meet s t ht.symm with ⟨rfl, -⟩ | ⟨rfl, -⟩ + · exact h0 + · exact h1 + have hHb : ContinuousOn H (range b ×ˢ univ) := by + have : ContinuousOn (fun p : Circle × 𝕀 => c p.1) (range b ×ˢ univ) := + (c.continuous.comp continuous_fst).continuousOn + refine this.congr fun p hp => ?_ + by_cases hpa : p.1 ∈ range a + · simp only [H, ite_eq_left hpa] + have he := hend _ hpa hp.1 + simp only [mix, he] + rw [← add_mul, ← Complex.ofReal_add, sub_add_cancel, Complex.ofReal_one, one_mul, + ch.gh (hdiscA _ hpa)] + · simp only [H, ite_eq_right hpa] + have hcont : Continuous H := by + have huniv : (range a ×ˢ univ) ∪ (range b ×ˢ univ) = (univ : Set (Circle × 𝕀)) := by + rw [← union_prod, hu, univ_prod_univ] + have := hHa.union_of_isClosed hHb (hclosed_a.prod isClosed_univ) (hclosed_b.prod isClosed_univ) + rw [huniv] at this + exact continuousOn_univ.mp this + let c' : C(Circle, S) := ⟨fun x => H (x, 1), by fun_prop⟩ + have hH0 : ∀ x, H (x, 0) = c x := by + intro x + by_cases hx : x ∈ range a + · simp only [H, ite_eq_left hx, mix] + simp only [Set.Icc.coe_zero, sub_zero, Complex.ofReal_one, one_mul, Complex.ofReal_zero, + zero_mul, + add_zero] + exact ch.gh (hdiscA _ hx) + · simp only [H, ite_eq_right hx] + have hH1a : ∀ x ∈ range a, H (x, 1) = γ (r x) := by + intro x hx + simp only [H, ite_eq_left hx, mix] + simp only [Set.Icc.coe_one, sub_self, Complex.ofReal_zero, zero_mul, Complex.ofReal_one, + one_mul, + zero_add] + exact ch.gh (hdiscγ _ hx) + refine ⟨c', ?_, ?_, ⟨⟨H, hcont⟩, ?_, hH0, fun _ => rfl⟩⟩ + · intro x hx + change H (x, 1) = c x + by_cases hxa : x ∈ range a + · rw [hH1a x hxa, hend x hxa hx] + · simp only [H, ite_eq_right hxa] + · intro t + change H (a t, 1) = γ t + rw [hH1a _ ⟨t, rfl⟩, hra] + · rintro ⟨x, τ⟩ + change H (x, τ) ∈ range c ∪ Δ + by_cases hx : x ∈ range a + · simp only [H, ite_eq_left hx] + exact .inr (ch.gm (hmixmem (x, τ) hx)) + · simp only [H, ite_eq_right hx] + exact .inl ⟨x, rfl⟩ + +/-! ### A collar -/ + +/-- A map onto a collar of the boundary of `P₂` on the outside of `P₂`. -/ +structure IsOuterCollar {Y : Type*} [TopologicalSpace Y] (P₂ : Set S) (b : Y × 𝕀 → S) : Prop where + /-- The map is continuous. -/ + cont : Continuous b + /-- The map is one to one. -/ + inj : Function.Injective b + /-- Level zero lies in `P₂`. -/ + zero : ∀ y, b (y, 0) ∈ P₂ + /-- The other levels lie outside `P₂`. -/ + pos : ∀ y s, s ≠ 0 → b (y, s) ∉ P₂ + +/-- A closed curve in `P₂` together with the part of a collar below level `ε` is homotopic, in this +set, to a closed curve in `P₂`, by pushing each point of the collar down its fibre. -/ +theorem exists_push {Y : Type*} [TopologicalSpace Y] [CompactSpace Y] [Nonempty Y] {P₂ : Set S} + {b : Y × 𝕀 → S} (hb : IsOuterCollar P₂ b) (hP : IsClosed P₂) {ε : 𝕀} {c : C(Circle, S)} + (hc : ∀ x, c x ∈ P₂ ∪ b '' {p | p.2 ≤ ε}) : + ∃ c' : C(Circle, S), (∀ x, c x ∈ P₂ → c' x = c x) ∧ (∀ x p, c x = b p → c' x = b (p.1, 0)) ∧ + (∀ x, c' x ∈ P₂) ∧ ClosedCurvesHomotopicIn (P₂ ∪ b '' {p | p.2 ≤ ε}) c c' := by + classical + obtain ⟨r, hr, hrb⟩ := exists_continuousOn_inv hb.cont hb.inj + have hRange : IsClosed (range b) := (isCompact_range hb.cont).isClosed + let σ : 𝕀 → 𝕀 := unitInterval.symm + let H : Circle × 𝕀 → S := fun q => + if c q.1 ∈ range b then b ((r (c q.1)).1, (r (c q.1)).2 * σ q.2) else c q.1 + have hP2 : ∀ z ∈ P₂, ∀ τ : 𝕀, ∀ hz : z ∈ range b, b ((r z).1, (r z).2 * σ τ) = z := by + rintro _ hz τ ⟨p, rfl⟩ + rw [hrb] + have h0 : p.2 = 0 := by + by_contra hne + exact hb.pos p.1 p.2 hne hz + obtain ⟨y, s⟩ := p + simp only at h0 + subst h0 + simp + have hA : IsClosed (c ⁻¹' P₂) := hP.preimage c.continuous + have hB : IsClosed (c ⁻¹' range b) := hRange.preimage c.continuous + have h1 : ContinuousOn H ((c ⁻¹' P₂) ×ˢ univ) := by + have : ContinuousOn (fun q : Circle × 𝕀 => c q.1) ((c ⁻¹' P₂) ×ˢ univ) := + (c.continuous.comp continuous_fst).continuousOn + refine this.congr fun q hq => ?_ + by_cases hq' : c q.1 ∈ range b + · simp only [H, ite_eq_left hq'] + exact hP2 _ hq.1 _ hq' + · simp only [H, ite_eq_right hq'] + have h2 : ContinuousOn H ((c ⁻¹' range b) ×ˢ univ) := by + have hrc : ContinuousOn (fun q : Circle × 𝕀 => r (c q.1)) ((c ⁻¹' range b) ×ˢ univ) := + hr.comp (c.continuous.comp continuous_fst).continuousOn fun q hq => hq.1 + have hσ : Continuous fun q : Circle × 𝕀 => σ q.2 := unitInterval.continuous_symm.comp + continuous_snd + have hmul : ContinuousOn (fun q : Circle × 𝕀 => (r (c q.1)).2 * σ q.2) + ((c ⁻¹' range b) ×ˢ univ) := + (continuous_snd.comp_continuousOn hrc).mul hσ.continuousOn + have hall : ContinuousOn (fun q : Circle × 𝕀 => b ((r (c q.1)).1, (r (c q.1)).2 * σ q.2)) + ((c ⁻¹' range b) ×ˢ univ) := + hb.cont.comp_continuousOn ((continuous_fst.comp_continuousOn hrc).prodMk hmul) + exact hall.congr fun q hq => ite_eq_left hq.1 + have hcont : Continuous H := by + have huniv : ((c ⁻¹' P₂) ×ˢ univ) ∪ ((c ⁻¹' range b) ×ˢ univ) = (univ : Set (Circle × 𝕀)) := by + rw [← union_prod, ← preimage_union] + refine (eq_univ_of_forall fun q => ?_) + rcases hc q.1 with h | ⟨p, -, hp⟩ + · exact ⟨.inl h, mem_univ _⟩ + · exact ⟨.inr ⟨p, hp⟩, mem_univ _⟩ + have := h1.union_of_isClosed h2 (hA.prod isClosed_univ) (hB.prod isClosed_univ) + rw [huniv] at this + exact continuousOn_univ.mp this + have hb0 : ∀ x p, c x = b p → ∀ τ, H (x, τ) = b (p.1, p.2 * σ τ) := by + intro x p hxp τ + simp only [H] + rw [ite_eq_left ⟨p, hxp.symm⟩, hxp, hrb] + let c' : C(Circle, S) := ⟨fun x => H (x, 1), by fun_prop⟩ + have hσ1 : σ 1 = 0 := unitInterval.symm_one + have hσ0 : σ 0 = 1 := unitInterval.symm_zero + have hP2' : ∀ x, c x ∈ P₂ → ∀ τ, H (x, τ) = c x := by + intro x hx τ + by_cases hq : c x ∈ range b + · simp only [H, ite_eq_left hq] + exact hP2 _ hx _ hq + · simp only [H, ite_eq_right hq] + have hc' : ∀ x p, c x = b p → c' x = b (p.1, 0) := by + intro x p hxp + change H (x, 1) = _ + rw [hb0 x p hxp, hσ1, mul_zero] + refine ⟨c', fun x hx => hP2' x hx 1, hc', ?_, ⟨⟨H, hcont⟩, ?_, ?_, fun _ => rfl⟩⟩ + · intro x + rcases hc x with h | ⟨p, -, hp⟩ + · change H (x, 1) ∈ P₂ + rw [hP2' x h] + exact h + · rw [hc' x p hp.symm] + exact hb.zero _ + · rintro ⟨x, τ⟩ + change H (x, τ) ∈ _ + rcases hc x with h | ⟨p, hple, hp⟩ + · rw [hP2' x h] + exact .inl h + · rw [hb0 x p hp.symm] + refine .inr ⟨(p.1, p.2 * σ τ), ?_, rfl⟩ + exact (unitInterval.mul_le_left).trans hple + · intro x + change H (x, 0) = c x + rcases hc x with h | ⟨p, -, hp⟩ + · exact hP2' x h 0 + · rw [hb0 x p hp.symm, hσ0, mul_one] + exact hp + +/-! ### Gaps of a closed set of the circle -/ + +/-- `G` is the inside of an arc `a` of the circle with both ends in `A` and no other point in `A`; +`b` is the other arc. -/ +structure IsGap (A : Set Circle) (G : Set Circle) (a b : 𝕀 → Circle) : Prop where + /-- The two arcs. -/ + two : IsTwoArcs a b + /-- They cover the circle. -/ + cover : range a ∪ range b = univ + /-- The first end is in `A`. -/ + zero : a 0 ∈ A + /-- The last end is in `A`. -/ + one : a 1 ∈ A + /-- No other point is in `A`. -/ + off : ∀ r, r ≠ 0 → r ≠ 1 → a r ∉ A + /-- `G` is the complement of the other arc. -/ + eq : G = (range b)ᶜ + +variable {A G G' : Set Circle} {a b a' b' : 𝕀 → Circle} + +theorem IsGap.isOpen (h : IsGap A G a b) : IsOpen G := by + rw [h.eq] + exact (isCompact_range h.two.arc_right.1).isClosed.isOpen_compl + +theorem IsGap.mem_iff (h : IsGap A G a b) {r : 𝕀} : a r ∈ G ↔ r ≠ 0 ∧ r ≠ 1 := by + rw [h.eq] + constructor + · intro hn + refine ⟨?_, ?_⟩ + · rintro rfl + exact hn ⟨0, h.two.zero⟩ + · rintro rfl + exact hn ⟨1, h.two.one⟩ + · rintro ⟨h0, h1⟩ ⟨t, ht⟩ + rcases h.two.meet r t ht.symm with ⟨rfl, -⟩ | ⟨rfl, -⟩ + · exact h0 rfl + · exact h1 rfl + +theorem IsGap.subset_range (h : IsGap A G a b) : G ⊆ range a := by + intro x hx + have : x ∈ range a ∪ range b := h.cover ▸ mem_univ x + rcases this with hx' | hx' + · exact hx' + · rw [h.eq] at hx + exact absurd hx' hx + +theorem IsGap.disjoint (h : IsGap A G a b) : Disjoint G A := by + refine Set.disjoint_left.mpr fun x hx hA => ?_ + obtain ⟨r, rfl⟩ := h.subset_range hx + obtain ⟨h0, h1⟩ := h.mem_iff.mp hx + exact h.off r h0 h1 hA + +theorem IsGap.isPreconnected (h : IsGap A G a b) : IsPreconnected G := by + have he : G = a '' {r | r ≠ 0 ∧ r ≠ 1} := by + ext x + constructor + · intro hx + obtain ⟨r, rfl⟩ := h.subset_range hx + exact ⟨r, h.mem_iff.mp hx, rfl⟩ + · rintro ⟨r, hr, rfl⟩ + exact h.mem_iff.mpr hr + have hc : IsPreconnected {r : 𝕀 | r ≠ 0 ∧ r ≠ 1} := by + have : {r : 𝕀 | r ≠ 0 ∧ r ≠ 1} = Ioo 0 1 := by + ext r + exact ⟨fun hr => ⟨unitInterval.pos_iff_ne_zero.mpr hr.1, unitInterval.lt_one_iff_ne_one.mpr + hr.2⟩, + fun hr => ⟨hr.1.ne', hr.2.ne⟩⟩ + rw [this] + exact isPreconnected_Ioo + rw [he] + exact hc.image _ h.two.arc_left.1.continuousOn + +/-- Two gaps are equal or disjoint. -/ +theorem IsGap.eq_or_disjoint (hA : IsClosed A) (h : IsGap A G a b) (h' : IsGap A G' a' b') : + G = G' ∨ Disjoint G G' := by + have key : ∀ {G₁ G₂ : Set Circle} {a₁ b₁ a₂ b₂ : 𝕀 → Circle}, IsGap A G₁ a₁ b₁ → IsGap A G₂ a₂ b₂ + → + (G₁ ∩ G₂).Nonempty → G₂ ⊆ G₁ := by + intro G₁ G₂ a₁ b₁ a₂ b₂ h₁ h₂ hne + have hcl : IsClosed (range a₁ ∪ A) := (isCompact_range h₁.two.arc_left.1).isClosed.union hA + have hcov : G₂ ⊆ G₁ ∪ (range a₁ ∪ A)ᶜ := by + intro x hx + by_cases hx₁ : x ∈ G₁ + · exact .inl hx₁ + · refine .inr ?_ + rintro (⟨r, rfl⟩ | hxA) + · have hr : r = 0 ∨ r = 1 := by + by_contra hn + push Not at hn + exact hx₁ (h₁.mem_iff.mpr hn) + rcases hr with rfl | rfl + · exact Set.disjoint_left.mp h₂.disjoint hx h₁.zero + · exact Set.disjoint_left.mp h₂.disjoint hx h₁.one + · exact Set.disjoint_left.mp h₂.disjoint hx hxA + have hdis : Disjoint G₁ (range a₁ ∪ A)ᶜ := + Set.disjoint_left.mpr fun x hx hn => hn (.inl (h₁.subset_range hx)) + obtain ⟨x, hx₁, hx₂⟩ := hne + exact h₂.isPreconnected.subset_left_of_subset_union h₁.isOpen hcl.isOpen_compl hdis hcov + ⟨x, hx₂, hx₁⟩ + by_cases hne : (G ∩ G').Nonempty + · exact .inl (Subset.antisymm (key h' h (by rwa [Set.inter_comm])) (key h h' hne)) + · exact .inr (Set.disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp hne)) + +/-- Every point off a closed set with two points lies in a gap. -/ +theorem exists_gap (hA : IsClosed A) {x y z : Circle} (hx : x ∈ A) (hy : y ∈ A) (hxy : x ≠ y) + (hz : z ∉ A) : ∃ G a b, IsGap A G a b ∧ z ∈ G := by + obtain ⟨a, b, hab, hu, h0, h1, hoff, hzr⟩ := exists_circle_chord hA hz hx hy hxy + refine ⟨(range b)ᶜ, a, b, ⟨hab, hu, h0, h1, hoff, rfl⟩, ?_⟩ + rintro ⟨t, rfl⟩ + have hbA : b t ∈ range a := hzr + obtain ⟨r, hr⟩ := hbA + rcases hab.meet r t hr with ⟨-, rfl⟩ | ⟨-, rfl⟩ + · exact hz (hab.zero ▸ h0) + · exact hz (hab.one ▸ h1) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section5Final.lean b/LeanPool/GraphMinor/GM12/Section5Final.lean new file mode 100644 index 0000000000..c6787f6b90 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section5Final.lean @@ -0,0 +1,495 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section5Respect +public import LeanPool.GraphMinor.GM12.Section5Band +public import LeanPool.GraphMinor.GM15.Cited +import LeanPool.GraphMinor.GM15.Section3Disc +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.GM10.Section12 + +/-! +# Graph Minors XII, (5.1) and (5.2) + +The paper says that these follow from (5.3). Conditions (i) and (ii) of (5.3) are direct, by +[4, Theorem (12.2)] in the case of (5.1). For (iii), a curve in `Σ₂` of length `< θ` misses one of +the +`θ` disjoint paths, and cutting `Σ₂` along this path gives a closed disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {Γ : Drawing S} {P₂ : Set S} + +omit [T2Space S] in +/-- A curve of length `< θ` misses one of `θ` disjoint paths. -/ +theorem exists_missed_path {θ : ℕ} (P : Fin θ → Drawing S) + (hd : Pairwise fun i j => Disjoint (P i).U (P j).U) (hsub : ∀ i, (P i).U ⊆ Γ.U) + (c : C(Circle, S)) + (hN : Γ.IsNormal (range c)) (hc : (range c ∩ Γ.V).ncard < θ) : ∃ i, ∀ x, c x ∉ (P i).U := by + classical + by_contra hn + push Not at hn + choose z hz using hn + have hinj : Function.Injective fun i => c (z i) := by + intro i j he + by_contra hij + exact Set.disjoint_left.mp (hd hij) (hz i) (by simpa only [he] using hz j) + have hr : range (fun i => c (z i)) ⊆ range c ∩ Γ.V := by + rintro _ ⟨i, rfl⟩ + exact ⟨⟨_, rfl⟩, hN ⟨⟨_, rfl⟩, hsub i (hz i)⟩⟩ + have := ncard_le_ncard hr (Γ.finite_V.subset inter_subset_right) + rw [← image_univ, ncard_image_of_injective _ hinj, ncard_univ, Nat.card_fin] at this + omega + +/-- A closed curve in `Σ₂` that misses a line along which `Σ₂` cuts to a closed disc is +null-homotopic in `Σ₂`. -/ +theorem curve_null {F : Set P₂} (c : C(Circle, S)) (hc : ∀ x, c x ∈ P₂) (hm : ∀ x, + (⟨c x, hc x⟩ : P₂) ∉ F) + (hcut : ∃ (Y : Type u) (_ : TopologicalSpace Y) (ψ : Y → P₂), IsSurface Y ∧ IsCutting ψ F ∧ + Nonempty (Y ≃ₜ ClosedUnitDisc)) : ClosedCurveIsNullHomotopicIn P₂ c := by + obtain ⟨Y, tY, ψ, hY, hψ, ⟨e⟩⟩ := hcut + have : CompactSpace Y := hY.1 + let c' : C(Circle, P₂) := ⟨fun x => ⟨c x, hc x⟩, c.continuous.subtype_mk _⟩ + obtain ⟨z, -, H, -, h0, h1⟩ := null_of_cut hψ e c' hm + refine ⟨z.1, z.2, ⟨fun p => (H p).1, continuous_subtype_val.comp H.continuous⟩, + fun p => (H p).2, ?_, ?_⟩ + · intro x + exact congrArg Subtype.val (h0 x) + · intro x + exact congrArg Subtype.val (h1 x) + +variable {n : ℕ} {T : Type u} [TopologicalSpace T] [T2Space T] {C : Fin n → Set S} {P₁ : Set S} + {ι : P₁ → T} {D : Fin n → Set T} + +omit [T2Space S] [T2Space T] in +theorem bd_two (h : IsCappedSplit C P₁ P₂ ι D) : bd P₂ = (↑) ⁻¹' ⋃ i, C i := by + rw [← h.bd₂] + exact (preimage_image_eq _ Subtype.val_injective).symm + +omit [T2Space T] in +/-- A line in `Σ₂` with ends on the common boundary, and no other point on it, is a proper line of +`Σ₂`. -/ +theorem line_in_two (h : IsCappedSplit C P₁ P₂ ι D) {L : Set S} {s t : S} + (hl : IsLineWithEnds L s t) + (hL : L ⊆ P₂) (hmeet : L ∩ ⋃ i, C i = {s, t}) : + ∃ u v : P₂, u.1 = s ∧ v.1 = t ∧ IsLineWithEnds ((↑) ⁻¹' L : Set P₂) u v ∧ + ((↑) ⁻¹' L : Set P₂) ∩ bd P₂ = {u, v} := by + have hr : L ⊆ range ((↑) : P₂ → S) := by + rw [Subtype.range_coe] + exact hL + obtain ⟨u, v, hu, hv, hp⟩ := hl.pull IsEmbedding.subtypeVal hr + refine ⟨u, v, hu, hv, ?_, ?_⟩ + · exact hp + · rw [bd_two h] + ext x + constructor + · rintro ⟨h₁, h₂⟩ + have : x.1 ∈ L ∩ ⋃ i, C i := ⟨h₁, h₂⟩ + rw [hmeet] at this + rcases this with he | he + · exact .inl (Subtype.ext (he.trans hu.symm)) + · exact .inr (Subtype.ext (he.trans hv.symm)) + · rintro hx + have : x.1 ∈ ({s, t} : Set S) := by + rcases hx with rfl | rfl + · exact .inl hu + · exact .inr hv + rw [← hmeet] at this + exact this + +omit [T2Space S] in +/-- The points of the paths on the boundary. -/ +theorem path_meet {θ : ℕ} {P : Fin θ → Drawing S} (hd : Pairwise fun i j => Disjoint (P i).U + (P j).U) + {Y : Set S} (hN : Γ.IsNormal Y) (hsub : ∀ i, (P i).U ⊆ Γ.U) {e : Fin θ → S} (he : ∀ i, e i ∈ + (P i).U) + (hr : Γ.V ∩ Y ⊆ range e) (i : Fin θ) {x : S} (hx : x ∈ (P i).U) (hxY : x ∈ Y) : x = e i := by + have hV : x ∈ Γ.V := hN ⟨hxY, hsub i hx⟩ + obtain ⟨j, rfl⟩ := hr ⟨hV, hxY⟩ + by_cases hij : i = j + · rw [hij] + · exact (Set.disjoint_left.mp (hd hij) hx (he j)).elim + +omit [TopologicalSpace S] [T2Space S] in +/-- Every set of `θ` distinct points in a set of size `θ` is all of it. -/ +theorem range_eq_of_ncard {θ : ℕ} {e : Fin θ → S} {Y : Set S} (hY : Y.Finite) (hc : Y.ncard = θ) + (he : Function.Injective e) (hs : range e ⊆ Y) : Y ⊆ range e := by + have h1 : (range e).ncard = θ := by + rw [← image_univ, ncard_image_of_injective _ he, ncard_univ, Nat.card_fin] + exact (eq_of_subset_of_ncard_le hs (by omega) hY).symm.subset + +theorem interSet_U_two {P₂ : Set S} (hP : IsClosed P₂) {θ : ℕ} {P : Fin θ → Drawing S} + (hU : (Γ.interSet P₂).U = ⋃ i : Fin θ, (P i).U) (i : Fin θ) : (P i).U ⊆ Γ.U ∧ (P i).U ⊆ P₂ := by + have h : (P i).U ⊆ (Γ.interSet P₂).U := hU ▸ subset_iUnion (fun i => (P i).U) i + exact ⟨h.trans interSet_isSub.U_subset, h.trans (interSet_U_subset hP)⟩ + +omit [T2Space T] in +theorem comp_ne (h : IsCappedSplit C P₁ P₂ ι D) {k l : Fin n} (hkl : k ≠ l) {u v : P₂} + (hu : u.1 ∈ C k) + (hv : v.1 ∈ C l) : connectedComponentIn (bd P₂) u ≠ connectedComponentIn (bd P₂) v := by + intro he + have hb : ∀ {w : P₂} {m : Fin n}, w.1 ∈ C m → w ∈ bd P₂ := fun {w m} hw => by + rw [bd_two h] + exact mem_iUnion.mpr ⟨m, hw⟩ + have hcl : ∀ m, IsClosed ((↑) ⁻¹' C m : Set P₂) := fun m => + ((h.isOArc m).isCompact.isClosed).preimage continuous_subtype_val + have hsub : connectedComponentIn (bd P₂) u ⊆ (↑) ⁻¹' C k ∪ ⋃ m ∈ {m | m ≠ k}, (↑) ⁻¹' C m := by + intro y hy + have hyb := connectedComponentIn_subset _ _ hy + rw [bd_two h] at hyb + obtain ⟨m, hm⟩ := mem_iUnion.mp hyb + by_cases hmk : m = k + · subst hmk + exact .inl hm + · exact .inr (mem_biUnion hmk hm) + have hcl' : IsClosed (⋃ m ∈ {m | m ≠ k}, ((↑) ⁻¹' C m : Set P₂)) := + (Set.toFinite _).isClosed_biUnion fun m _ => hcl m + obtain ⟨z, -, hz, hzz⟩ := isPreconnected_closed_iff.mp isPreconnected_connectedComponentIn _ _ + (hcl k) hcl' + hsub ⟨u, mem_connectedComponentIn (hb hu), hu⟩ + ⟨v, he ▸ mem_connectedComponentIn (hb hv), mem_biUnion hkl.symm hv⟩ + obtain ⟨m, hmk, hm⟩ := mem_iUnion₂.mp hzz + exact Set.disjoint_left.mp (h.disjoint k m (Ne.symm hmk)) hz hm + +theorem free_mono {α β : Type*} {G : Hypergraph α β} {θ : ℕ} {𝒯 : Set + (Hypergraph α β × Hypergraph α β)} + (hT : IsTangle G θ 𝒯) {X Z : Set α} (hZ : IsFreeSet G 𝒯 θ Z) (hs : X ⊆ Z) : IsFreeSet G 𝒯 θ X + := by + obtain ⟨M, -, hM, -⟩ := GraphMinor.GM10.theorem_12_2_proof G hT + exact (hM X).mp (((hM Z).mpr hZ).subset hs) + +/-- **Graph Minors XII, (5.1)** (page 254). -/ +theorem theorem_5_1_proof : GM15.GM12Theorem51Statement.{u} := by + intro S _ _ T _ _ C P₁ P₂ ι D Γ Γ₁ θ 𝒯 P a b _ _ hsplit hΓ hN0 hN1 hc0 hc1 hpath hd hU hline hT + hR hf0 hf1 + obtain ⟨h, hconnT, ⟨eA⟩⟩ := hsplit + have hN : ∀ k, Γ.IsNormal (C k) := Fin.forall_fin_two.mpr ⟨hN0, hN1⟩ + have hsub := interSet_U_two h.isClosed₂ hU + have hab : ∀ i, a i ≠ b i := fun i he => + Set.disjoint_left.mp (h.disjoint 0 1 (by decide)) (hpath i).1.2 (he ▸ (hpath i).2.1.2) + have hl : ∀ i, IsLineWithEnds (P i).U (a i) (b i) := fun i => + GM14.isLine_of_isPathBetween (hpath i).2.2.1 (hab i) + have hinj : ∀ {e : Fin θ → S}, (∀ i, e i ∈ (P i).U) → Function.Injective e := by + intro e he i j hij + by_contra hn + exact Set.disjoint_left.mp (hd hn) (he i) (hij ▸ he j) + have ha : ∀ i, a i ∈ (P i).U := fun i => (hl i).left_mem + have hb : ∀ i, b i ∈ (P i).U := fun i => (hl i).right_mem + have hr0 : Γ.V ∩ C 0 ⊆ range a := range_eq_of_ncard (Γ.finite_V.subset inter_subset_left) hc0 + (hinj ha) + (by rintro _ ⟨i, rfl⟩; exact (hpath i).1) + have hr1 : Γ.V ∩ C 1 ⊆ range b := range_eq_of_ncard (Γ.finite_V.subset inter_subset_left) hc1 + (hinj hb) + (by rintro _ ⟨i, rfl⟩; exact (hpath i).2.1) + have hiii : CurvesNull Γ P₂ θ := by + intro c hcP hcN hcc + obtain ⟨i, hi⟩ := exists_missed_path P hd (fun i => (hsub i).1) c hcN hcc + have hmeet : (P i).U ∩ ⋃ k, C k = {a i, b i} := by + ext x + constructor + · rintro ⟨hx, hxC⟩ + obtain ⟨k, hk⟩ := mem_iUnion.mp hxC + obtain rfl | rfl : k = 0 ∨ k = 1 := by fin_cases k <;> simp + · exact .inl (path_meet hd (hN 0) (fun i => (hsub i).1) ha hr0 i hx hk) + · exact .inr (path_meet hd (hN 1) (fun i => (hsub i).1) hb hr1 i hx hk) + · rintro (rfl | rfl) + · exact ⟨ha i, mem_iUnion.mpr ⟨0, (hpath i).1.2⟩⟩ + · exact ⟨hb i, mem_iUnion.mpr ⟨1, (hpath i).2.1.2⟩⟩ + obtain ⟨u, v, hu, hv, hL, hB⟩ := line_in_two h (hl i) (hsub i).2 hmeet + have hne : u ≠ v := fun he => hab i (by rw [← hu, ← hv, he]) + have hM : Nonempty (P₂ ≃ₜ SurfaceModel 0 0 2) := by + obtain ⟨e₁⟩ := nonempty_cyl_homeo + exact ⟨eA.trans (GM15.closedCylinderHomeoAnnulus.symm.trans e₁.symm)⟩ + have hconnP : ConnectedSpace P₂ := by + obtain ⟨e₁⟩ := hM + have := (modelCriterion.1 0 0 2).2 + exact e₁.symm.surjective.connectedSpace e₁.symm.continuous + have hu0 : u.1 ∈ C 0 := by rw [hu]; exact (hpath i).1.2 + have hv1 : v.1 ∈ C 1 := by rw [hv]; exact (hpath i).2.1.2 + exact curve_null c hcP (fun x => hi x) + (exists_cut_annulus h.manifold₂ hne hB hL hM (comp_ne h (by decide) hu0 hv1)) + have hlineall : ∀ k l : Fin 2, k ≠ l → ∀ F : Set S, IsLine F → Γ.IsNormal F → F ⊆ P₁ → + (F ∩ C k).Nonempty → (F ∩ C l).Nonempty → θ ≤ (F ∩ Γ.V).ncard := by + intro k l hkl F h1 h2 h3 h4 h5 + obtain rfl | rfl : k = 0 ∨ k = 1 := by fin_cases k <;> simp + · obtain rfl | rfl : l = 0 ∨ l = 1 := by fin_cases l <;> simp + · exact (hkl rfl).elim + · exact hline F h1 h2 h3 h4 h5 + · obtain rfl | rfl : l = 0 ∨ l = 1 := by fin_cases l <;> simp + · exact hline F h1 h2 h3 h5 h4 + · exact (hkl rfl).elim + have : ConnectedSpace T := hconnT + exact theorem_5_3_proof h hΓ hN hT hR hlineall (Fin.forall_fin_two.mpr ⟨hc0.ge, hc1.ge⟩) + (Fin.forall_fin_two.mpr ⟨fun X hX _ => free_mono hT hf0 hX, fun X hX _ + => free_mono hT hf1 hX⟩) hiii + +omit [T2Space S] in +/-- The two open arcs of an `O`-arc between two points, read by angle. -/ +theorem two_pieces {Y : Set S} (f : Circle ≃ₜ Y) {α β : ℝ} (h1 : α < β) (h2 : β < α + 2 * Real.pi) : + let e : ℝ → S := fun r => (f (Circle.exp r)).1 + IsPreconnected (e '' Ioo α β) ∧ IsPreconnected (e '' Ioo β (α + 2 * Real.pi)) ∧ + (∀ x ∈ Y, x ≠ e α → x ≠ e β → x ∈ e '' Ioo α β ∪ e '' Ioo β (α + 2 * Real.pi)) ∧ + ∀ r, α < r → r < α + 2 * Real.pi → r ≠ β → e r ≠ e α ∧ e r ≠ e β := by + intro e + have hpi := Real.pi_pos + have hc : Continuous e := + continuous_subtype_val.comp (f.continuous.comp Circle.exp.continuous) + have hinj : ∀ {r s : ℝ}, e r = e s → ∃ m : ℤ, r = s + m * (2 * Real.pi) := fun {r s} he => + Circle.exp_eq_exp.mp (f.injective (Subtype.ext he)) + refine ⟨isPreconnected_Ioo.image _ hc.continuousOn, isPreconnected_Ioo.image _ hc.continuousOn, + ?_, ?_⟩ + · intro x hx hxα hxβ + let z := f.symm ⟨x, hx⟩ + have hrz := toIcoMod_mem_Ico (by positivity : (0 : ℝ) < 2 * Real.pi) α (Complex.arg (z : ℂ)) + set r := toIcoMod (by positivity : (0 : ℝ) < 2 * Real.pi) α (Complex.arg (z : ℂ)) with hr + have hez : e r = x := by + have hp : Circle.exp r = z := by + have hs := toIcoMod_add_toIcoDiv_zsmul (by positivity : (0 : ℝ) < 2 * Real.pi) α + (Complex.arg (z : ℂ)) + rw [← hr] at hs + have : Circle.exp (r + toIcoDiv (by positivity : (0 : ℝ) < 2 * Real.pi) α (Complex.arg + (z : ℂ)) • (2 * Real.pi)) = + Circle.exp r := by + rw [Circle.exp_eq_exp] + exact ⟨toIcoDiv (by positivity : (0 : ℝ) < 2 * Real.pi) α (Complex.arg (z : ℂ)), + by rw [zsmul_eq_mul]⟩ + rw [← this, hs, Circle.exp_arg] + change (f (Circle.exp r)).1 = x + rw [hp] + simp [z] + rw [← hez] at hxα hxβ ⊢ + have hrα : α < r := lt_of_le_of_ne hrz.1 (fun he => hxα (by rw [he])) + have hrβ : r ≠ β := fun he => hxβ (by rw [he]) + rcases lt_or_gt_of_ne hrβ with hlt | hgt + · exact .inl ⟨r, ⟨hrα, hlt⟩, rfl⟩ + · exact .inr ⟨r, ⟨hgt, hrz.2⟩, rfl⟩ + · intro r hrα hr2 hrβ + constructor + · intro he + obtain ⟨m, hm⟩ := hinj he + have h3 : (0 : ℝ) < m * (2 * Real.pi) := by linarith + have h4 : (m : ℝ) * (2 * Real.pi) < 2 * Real.pi := by linarith + have h5 : (0 : ℝ) < m := by nlinarith + have h6 : (m : ℝ) < 1 := by nlinarith + have h7 : 0 < m := by exact_mod_cast h5 + have h8 : m < 1 := by exact_mod_cast h6 + omega + · intro he + obtain ⟨m, hm⟩ := hinj he + have h3 : -(2 * Real.pi) < m * (2 * Real.pi) := by linarith + have h4 : (m : ℝ) * (2 * Real.pi) < 2 * Real.pi := by linarith + have h5 : (-1 : ℝ) < m := by nlinarith + have h6 : (m : ℝ) < 1 := by nlinarith + have h7 : -1 < m := by exact_mod_cast h5 + have h8 : m < 1 := by exact_mod_cast h6 + have h9 : m = 0 := by omega + subst h9 + apply hrβ + simpa using hm + +/-- **Graph Minors XII, (5.2)** (page 254), for `θ ≥ 2`. The statement fails for `θ = 1`, because a +path with ends on the boundary of the band need not cross it. -/ +theorem theorem_5_2_proof : GM15.GM12Theorem52Statement.{u} := by + intro S _ _ T _ _ C P₁ P₂ ι D Γ Γ₁ θ 𝒯 P a b hθ _ _ hsplit hΓ hN0 hc _ hord hrange hpath hd hU hT + hR hf + classical + obtain ⟨h, hconnT, ⟨eB⟩⟩ := hsplit + have hN : ∀ k, Γ.IsNormal (C k) := fun k => by rwa [Subsingleton.elim k 0] + have hsub := interSet_U_two h.isClosed₂ hU + obtain ⟨f, t, hmono, hlt, hv⟩ := hord + have hlen : (List.ofFn a ++ List.ofFn b).length = θ + θ := by simp + have hat : ∀ i : Fin θ, (f (Circle.exp (t i))).1 = a i := by + intro i + have := hv i.1 (by rw [hlen]; omega) + rw [this, List.getElem_append_left (by simp)] + simp + have hbt : ∀ i : Fin θ, (f (Circle.exp (t (θ + i)))).1 = b i := by + intro i + have := hv (θ + i.1) (by rw [hlen]; omega) + rw [this, List.getElem_append_right (by simp)] + simp + have hlt' : ∀ k, k < θ + θ → t k < t 0 + 2 * Real.pi := fun k hk => hlt k (by rwa [hlen]) + have hpi := Real.pi_pos + have hstep : ∀ i : Fin θ, t i < t (θ + i) ∧ t (θ + i) < t i + 2 * Real.pi := by + intro i + have h3 := hlt' (θ + i) (by have := i.2; omega) + have h4 : t 0 ≤ t i := hmono.monotone (Nat.zero_le _) + exact ⟨hmono (by have := i.2; omega), by linarith⟩ + have hne_ab : ∀ i : Fin θ, a i ≠ b i := by + intro i he + obtain ⟨h1, h2⟩ := hstep i + have h5 : (f (Circle.exp (t i))).1 = (f (Circle.exp (t (θ + i)))).1 := by rw [hat, hbt, he] + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp (f.injective (Subtype.ext h5)) + have h6 : (m : ℝ) * (2 * Real.pi) < 0 := by linarith + have h7 : -(2 * Real.pi) < (m : ℝ) * (2 * Real.pi) := by linarith + have h8 : (m : ℝ) < 0 := by nlinarith + have h9 : (-1 : ℝ) < m := by nlinarith + have h10 : m < 0 := by exact_mod_cast h8 + have h11 : -1 < m := by exact_mod_cast h9 + omega + have hl : ∀ i, IsLineWithEnds (P i).U (a i) (b i) := fun i => + GM14.isLine_of_isPathBetween (hpath i).1 (hne_ab i) + have ha : ∀ i, a i ∈ (P i).U := fun i => (hl i).left_mem + have hb : ∀ i, b i ∈ (P i).U := fun i => (hl i).right_mem + have haC : ∀ i, a i ∈ C 0 := fun i => by rw [← hat]; exact (f _).2 + have hbC : ∀ i, b i ∈ C 0 := fun i => by rw [← hbt]; exact (f _).2 + have hmeetV : ∀ i, ∀ x ∈ (P i).U, x ∈ C 0 → x = a i ∨ x = b i := by + intro i x hx hxC + have hxV : x ∈ Γ.V := hN0 ⟨hxC, (hsub i).1 hx⟩ + have hsame : ∀ j, x ∈ (P j).U → x = a j ∨ x = b j → x = a i ∨ x = b i := by + intro j hj he + by_cases hij : i = j + · rwa [hij] + · exact (Set.disjoint_left.mp (hd hij) hx hj).elim + have hmem : x ∈ range a ∪ range b := hrange ▸ ⟨hxV, hxC⟩ + rcases hmem with ⟨j, rfl⟩ | ⟨j, rfl⟩ + · exact hsame j (ha j) (.inl rfl) + · exact hsame j (hb j) (.inr rfl) + have hiii : CurvesNull Γ P₂ θ := by + intro c hcP hcN hcc + obtain ⟨i, hi⟩ := exists_missed_path P hd (fun i => (hsub i).1) c hcN hcc + have hmeet : (P i).U ∩ ⋃ k, C k = {a i, b i} := by + ext x + constructor + · rintro ⟨hx, hxC⟩ + obtain ⟨k, hk⟩ := mem_iUnion.mp hxC + rw [Subsingleton.elim k 0] at hk + exact hmeetV i x hx hk + · rintro (rfl | rfl) + · exact ⟨ha i, mem_iUnion.mpr ⟨0, haC i⟩⟩ + · exact ⟨hb i, mem_iUnion.mpr ⟨0, hbC i⟩⟩ + obtain ⟨u, v, hu, hv, hL, hB⟩ := line_in_two h (hl i) (hsub i).2 hmeet + have hne : u ≠ v := fun he => hne_ab i (by rw [← hu, ← hv, he]) + have hM : Nonempty (P₂ ≃ₜ SurfaceModel 0 1 1) := by + obtain ⟨e₁⟩ := nonempty_mob_homeo + exact ⟨eB.trans e₁.symm⟩ + have hconnP : ConnectedSpace P₂ := by + obtain ⟨e₁⟩ := hM + have := (modelCriterion.1 0 1 1).2 + exact e₁.symm.surjective.connectedSpace e₁.symm.continuous + obtain ⟨Y, tY, t2Y, ψ, hY, hψ, X, X', hun, hdX, hX, hX', hcase⟩ := exists_cut_band h.manifold₂ + hne hB hL hM + rcases hcase with hdisc | ⟨W₁, W₂, hX₁, hX₂, hW₁, hW₂, hUW, hdW⟩ + · exact curve_null c hcP (fun x => hi x) ⟨Y, tY, ψ, hY, hψ, hdisc⟩ + · exfalso + have : CompactSpace Y := hY.1 + -- A second path has its ends on the two arcs of `C` between the ends of the first. + obtain ⟨j, hji⟩ : ∃ j : Fin θ, j ≠ i := by + by_cases h0 : i.1 = 0 + · exact ⟨⟨1, by omega⟩, fun he => by rw [← he] at h0; simp at h0⟩ + · exact ⟨⟨0, by omega⟩, fun he => h0 (by rw [← he])⟩ + obtain ⟨hs1, hs2⟩ := hstep i + obtain ⟨p1, p2, hcov, hmiss⟩ := two_pieces f hs1 hs2 + set e : ℝ → S := fun r => (f (Circle.exp r)).1 with he + set A₁ := e '' Ioo (t i) (t (θ + i)) with hA₁ + set A₂ := e '' Ioo (t (θ + i)) (t i + 2 * Real.pi) with hA₂ + have hA₁C : A₁ ⊆ C 0 := by + rintro _ ⟨r, -, rfl⟩ + exact (f _).2 + have hA₂C : A₂ ⊆ C 0 := by + rintro _ ⟨r, -, rfl⟩ + exact (f _).2 + have hmeets : ((P j).U ∩ A₁).Nonempty ∧ ((P j).U ∩ A₂).Nonempty := by + have h4 : t 0 ≤ t j := hmono.monotone (Nat.zero_le _) + have h4' : t 0 ≤ t i := hmono.monotone (Nat.zero_le _) + have hj := j.2 + have hii := i.2 + have hneq : (j : ℕ) ≠ i := fun he => hji (Fin.ext he) + rcases lt_or_gt_of_ne hneq with hlt₁ | hgt₁ + · -- `j` comes first: the end `b j` is on the first arc, and `a j` one turn on is on the + -- second. + refine ⟨⟨b j, hb j, t (θ + j), ⟨hmono (by omega), hmono (by omega)⟩, hbt j⟩, + ⟨a j, ha j, t j + 2 * Real.pi, ⟨?_, ?_⟩, ?_⟩⟩ + · have := hlt' (θ + i) (by omega) + linarith + · have : t j < t i := hmono hlt₁ + linarith + · change (f (Circle.exp (t j + 2 * Real.pi))).1 = a j + rw [← hat j] + congr 2 + rw [Circle.exp_eq_exp] + exact ⟨1, by simp⟩ + · -- `i` comes first: `a j` is on the first arc, and `b j` is on the second. + refine ⟨⟨a j, ha j, t j, ⟨hmono hgt₁, hmono (by omega)⟩, hat j⟩, + ⟨b j, hb j, t (θ + j), ⟨hmono (by omega), ?_⟩, hbt j⟩⟩ + have := hlt' (θ + j) (by omega) + linarith + have hG : IsPreconnected ((P j).U ∪ A₁ ∪ A₂) := by + have hPc : IsPreconnected (P j).U := by + obtain ⟨α, hα, hr, -, -⟩ := (hl j).exists_arc + rw [← hr] + exact isPreconnected_range hα.1 + have h1 := hPc.union' hmeets.1 p1 + obtain ⟨z, hz, hz'⟩ := hmeets.2 + exact h1.union z (.inl hz) hz' p2 + have hGP : (P j).U ∪ A₁ ∪ A₂ ⊆ P₂ := by + refine union_subset (union_subset (hsub j).2 ?_) ?_ + · exact hA₁C.trans (h.C_sub₂ 0) + · exact hA₂C.trans (h.C_sub₂ 0) + have hGimg : ((↑) : P₂ → S) '' ((↑) ⁻¹' ((P j).U ∪ A₁ ∪ A₂)) = (P j).U ∪ A₁ ∪ A₂ := by + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hGP] + have hoff : ∀ r, t i < r → r < t i + 2 * Real.pi → r ≠ t (θ + i) → e r ∉ (P i).U := by + intro r h1 h2 h3 hm + obtain ⟨h5, h6⟩ := hmiss r h1 h2 h3 + rcases hmeetV i _ hm (f _).2 with he' | he' + · exact h5 (he'.trans (hat i).symm) + · exact h6 (he'.trans (hbt i).symm) + refine no_split hY hψ (((hl i).isCompact.isClosed).preimage continuous_subtype_val) hun hX + hX' hX₁ hX₂ + hW₁ hW₂ hUW hdW (G := (↑) ⁻¹' ((P j).U ∪ A₁ ∪ A₂)) + (IsEmbedding.subtypeVal.isInducing.isPreconnected_image.mp (by rw [hGimg]; exact hG)) ?_ ?_ + · refine Set.disjoint_left.mpr ?_ + rintro w ((hw | hw) | hw) hwi + · exact Set.disjoint_left.mp (hd (Ne.symm hji)) hwi hw + · obtain ⟨r, hr, hre⟩ := hw + refine hoff r hr.1 ?_ (ne_of_lt hr.2) (by rw [hre]; exact hwi) + linarith [hr.2] + · obtain ⟨r, hr, hre⟩ := hw + refine hoff r ?_ hr.2 (ne_of_gt hr.1) (by rw [hre]; exact hwi) + linarith [hr.1] + · rintro w ⟨hwb, hwF⟩ + rw [bd_two h] at hwb + obtain ⟨k, hk⟩ := mem_iUnion.mp hwb + rw [Subsingleton.elim k 0] at hk + have hw1 : w.1 ≠ e (t i) := fun hw => hwF (by + change w.1 ∈ (P i).U + rw [hw] + change (f (Circle.exp (t i))).1 ∈ (P i).U + rw [hat] + exact ha i) + have hw2 : w.1 ≠ e (t (θ + i)) := fun hw => hwF (by + change w.1 ∈ (P i).U + rw [hw] + change (f (Circle.exp (t (θ + i)))).1 ∈ (P i).U + rw [hbt] + exact hb i) + rcases hcov w.1 hk hw1 hw2 with hm | hm + · exact .inl (.inr hm) + · exact .inr hm + have : ConnectedSpace T := hconnT + refine theorem_5_3_proof h hΓ hN hT hR ?_ ?_ ?_ hiii + · intro k l hkl + exact (hkl (Subsingleton.elim k l)).elim + · intro k + rw [Subsingleton.elim k 0, hc] + omega + · intro k + rw [Subsingleton.elim k 0] + exact hf + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section5Piece.lean b/LeanPool/GraphMinor/GM12/Section5Piece.lean new file mode 100644 index 0000000000..4c72c141c7 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section5Piece.lean @@ -0,0 +1,326 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section5Collar +import LeanPool.GraphMinor.Surface.PlaneDisc +import LeanPool.GraphMinor.Surface.SurfacePull +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.PlaneFacts + +/-! +# Lines in `Σ₁` with ends on the common boundary + +We move edges and closed discs between `Σ` and the capped surface `Σ̂₁`, and read the capped form of +Graph Minors XII, (5.4) (page 255), back in `Σ₁` (`exists_piece`). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 Hypergraph + +universe u + +variable {S T : Type u} [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] + {n : ℕ} {C : Fin n → Set S} {P₁ P₂ : Set S} {ι : P₁ → T} {D : Fin n → Set T} + {Γ : Drawing S} {Γ₁ : Drawing T} + +omit [T2Space S] [T2Space T] in +theorem capUp_inter_V (hι : Function.Injective ι) (hΓ : IsCappedDrawing ι Γ Γ₁) (X : Set S) : + capUp ι (X ∩ Γ.V) = capUp ι X ∩ Γ₁.V := by + rw [hΓ.2] + ext y + constructor + · rintro ⟨p, ⟨h1, h2⟩, rfl⟩ + exact ⟨⟨p, h1, rfl⟩, ⟨p, h2, rfl⟩⟩ + · rintro ⟨⟨p, h1, rfl⟩, h2⟩ + exact ⟨p, ⟨h1, (mem_capUp_val hι).mp h2⟩, rfl⟩ + +omit [T2Space T] in +/-- An edge of `Γ` that does not meet the common boundary lies on one side. -/ +theorem edge_side (h : IsCappedSplit C P₁ P₂ ι D) (hN : ∀ k, Γ.IsNormal (C k)) {f : Set S} + (hf : f ∈ Γ.E) : (f ⊆ P₁ ∧ Disjoint f P₂) ∨ (f ⊆ P₂ ∧ Disjoint f P₁) := by + have hdis : ∀ x ∈ f, x ∈ P₁ → x ∈ P₂ → False := by + intro x hx h₁ h₂ + have hm : x ∈ P₁ ∩ P₂ := ⟨h₁, h₂⟩ + rw [h.inter] at hm + obtain ⟨k, hk⟩ := mem_iUnion.mp hm + exact (hf.2.1 hx).2 (hN k ⟨hk, (hf.2.1 hx).1⟩) + have hcov : f ⊆ P₁ ∪ P₂ := fun x _ => h.union ▸ mem_univ x + have hpre : IsPreconnected f := hf.2.2.1.isConnected.isPreconnected + obtain ⟨x, hx⟩ := hf.1 + have hsub : ∀ {A B : Set S}, IsClosed A → IsClosed B → f ⊆ A ∪ B → (∀ y ∈ f, y ∈ A → y ∈ B + → False) → + x ∈ A → f ⊆ A := by + intro A B hA hB hc hd hxA + by_contra hn + obtain ⟨y, hy, hyA⟩ := not_subset.mp hn + obtain ⟨z, hzf, hzA, hzB⟩ := isPreconnected_closed_iff.mp hpre A B hA hB hc ⟨x, hx, hxA⟩ + ⟨y, hy, (hc hy).resolve_left hyA⟩ + exact hd z hzf hzA hzB + rcases hcov hx with hx₁ | hx₂ + · have := hsub h.isClosed₁ h.isClosed₂ hcov hdis hx₁ + exact .inl ⟨this, Set.disjoint_left.mpr fun y hy hy₂ => hdis y hy (this hy) hy₂⟩ + · have := hsub h.isClosed₂ h.isClosed₁ (by rwa [Set.union_comm]) (fun y hy a b + => hdis y hy b a) hx₂ + exact .inr ⟨this, Set.disjoint_left.mpr fun y hy hy₁ => hdis y hy hy₁ (this hy)⟩ + +omit [T2Space S] in +/-- An edge in `Σ₁` moves to an edge of `Γ₁`. -/ +theorem edge_capUp (h : IsCappedSplit C P₁ P₂ ι D) (hΓ : IsCappedDrawing ι Γ Γ₁) {f : Set S} + (hf : f ∈ Γ.E) (hP : f ⊆ P₁) : capUp ι f ∈ Γ₁.E := by + have hι := h.isEmbedding + have hsubU : capUp ι f ⊆ Γ₁.U \ Γ₁.V := by + rw [hΓ.1, hΓ.2] + rintro _ ⟨p, hp, rfl⟩ + refine ⟨⟨p, (hf.2.1 hp).1, rfl⟩, ?_⟩ + rintro ⟨q, hq, he⟩ + rw [hι.injective he] at hq + exact (hf.2.1 hp).2 hq + have hpc : IsPathConnected (capUp ι f) := + (hf.2.2.1.preimage_coe hP).image hι.continuous + refine ⟨?_, hsubU, hpc, ?_⟩ + · obtain ⟨x, hx⟩ := hf.1 + exact ⟨_, val_mem_capUp (hP hx) hx⟩ + · intro E hE hEc hsub + have : Nonempty P₁ := by + obtain ⟨x, hx⟩ := hf.1 + exact ⟨⟨x, hP hx⟩⟩ + have hcP : CompactSpace P₁ := h.manifold₁.1 + obtain ⟨r, hr, hri⟩ := exists_continuousOn_inv hι.continuous hι.injective + have hEr : E ⊆ range ι := fun y hy => by + have := hE hy + rw [hΓ.1] at this + exact capUp_subset_range _ this.1 + have heq : capDown ι E = (fun y => (r y).1) '' E := by + ext x + constructor + · rintro ⟨p, hp, rfl⟩ + exact ⟨ι p, hp, by simp [hri]⟩ + · rintro ⟨y, hy, rfl⟩ + obtain ⟨p, rfl⟩ := hEr hy + exact ⟨p, hy, by simp [hri]⟩ + have hpcD : IsPathConnected (capDown ι E) := by + rw [heq] + exact hEc.image' (continuous_subtype_val.comp_continuousOn (hr.mono hEr)) + have hsubD : capDown ι E ⊆ Γ.U \ Γ.V := by + rintro _ ⟨p, hp, rfl⟩ + have hx := hE hp + rw [hΓ.1, hΓ.2] at hx + refine ⟨(mem_capUp_val hι.injective).mp hx.1, fun hV => hx.2 ⟨p, hV, rfl⟩⟩ + have hfD : f ⊆ capDown ι E := by + intro x hx + have := hsub (val_mem_capUp (hP hx) hx) + exact ⟨⟨x, hP hx⟩, this, rfl⟩ + have := hf.2.2.2 _ hsubD hpcD hfD + rw [← this, capUp_capDown hEr] + +/-- Each edge of `Γ₁` comes from an edge of `Γ` in `Σ₁`. -/ +theorem exists_edge_capUp (h : IsCappedSplit C P₁ P₂ ι D) (hΓ : IsCappedDrawing ι Γ Γ₁) + (hN : ∀ k, Γ.IsNormal (C k)) {e : Set T} (he : e ∈ Γ₁.E) : + ∃ f ∈ Γ.E, f ⊆ P₁ ∧ e = capUp ι f := by + have hι := h.isEmbedding + obtain ⟨y, hy⟩ := he.1 + have hyU := he.2.1 hy + have hy1 := hyU.1 + rw [hΓ.1] at hy1 + obtain ⟨p, hp, rfl⟩ := hy1 + have hpV : p.1 ∉ Γ.V := fun hV => hyU.2 (by rw [hΓ.2]; exact ⟨p, hV, rfl⟩) + obtain ⟨f, hf, hpf⟩ := Γ.exists_edge_of_mem hp hpV + have hP : f ⊆ P₁ := by + rcases edge_side h hN hf with ⟨h1, -⟩ | ⟨-, h2⟩ + · exact h1 + · exact (Set.disjoint_left.mp h2 hpf p.2).elim + have hup := edge_capUp h hΓ hf hP + exact ⟨f, hf, hP, Γ₁.edge_eq_of_mem he hup hy ⟨p, hpf, rfl⟩⟩ + +omit [T2Space S] in +/-- Moving a closed disc of `Σ̂₁` off the open caps back to `Σ`. -/ +theorem disc_capDown [Nonempty T] (h : IsCappedSplit C P₁ P₂ ι D) {Δ : Set T} (hΔ : IsClosedDisc Δ) + (hr : Δ ⊆ range ι) : + IsClosedDisc (capDown ι Δ) ∧ discBd (capDown ι Δ) = capDown ι (discBd Δ) := by + classical + have hι := h.isEmbedding + obtain ⟨t₀⟩ := ‹Nonempty T› + have hne : Nonempty P₁ := by + obtain ⟨x, hx⟩ := (show Δ.Nonempty from hΔ.isPathConnected.nonempty) + exact ⟨(hr hx).choose⟩ + have hcP : CompactSpace P₁ := h.manifold₁.1 + obtain ⟨r, hrc, hri⟩ := exists_continuousOn_inv hι.continuous hι.injective + let f : T → S := fun y => (r y).1 + let f' : S → T := fun x => if hx : x ∈ P₁ then ι ⟨x, hx⟩ else t₀ + have hf : ContinuousOn f Δ := continuous_subtype_val.comp_continuousOn (hrc.mono hr) + have hfi : ∀ X : Set T, X ⊆ range ι → f '' X = capDown ι X := by + intro X hX + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + obtain ⟨p, rfl⟩ := hX hy + exact ⟨p, hy, by simp [f, hri]⟩ + · rintro ⟨p, hp, rfl⟩ + exact ⟨ι p, hp, by simp [f, hri]⟩ + have hf'c : ContinuousOn f' P₁ := by + rw [continuousOn_iff_continuous_domRestrict] + have : P₁.domRestrict f' = ι := by + funext ⟨x, hx⟩ + change f' x = ι ⟨x, hx⟩ + simp [f', hx] + rw [this] + exact hι.continuous + have himg : f '' Δ ⊆ P₁ := by + rw [hfi Δ hr] + exact capDown_subset _ + have hl : LeftInvOn f' f Δ := by + intro y hy + obtain ⟨p, rfl⟩ := hr hy + simp [f, f', hri] + have := IsClosedDisc.image hΔ hf (hf'c.mono himg) hl + rw [hfi Δ hr, hfi _ ((GraphMinor.Surface.discBd_subset Δ).trans hr)] at this + exact this + +/-- The output of (5.4), read in `Σ`, for a line `L` of `Σ₁` with ends `s, t`. The line `R` is the +line `FTilde` of the paper and `Δ` is its disc. The closed disc `Δ₁` is the disc of `Σ̂₁` chosen by +the +tangle, which includes `Δ`. -/ +structure PieceData (C : Fin n → Set S) (ι : P₁ → T) (Γ : Drawing S) (Γ₁ : Drawing T) + (𝒯 : Set (Hypergraph T (Set T) × Hypergraph T (Set T))) (L : Set S) (s t : S) + (R : Set S) (Δ₁ : Set T) (Δ : Set S) : Prop where + /-- `R` is a line with ends `s, t`. -/ + line : IsLineWithEnds R s t + /-- It lies in one of the `O`-arcs. -/ + on : ∃ k, R ⊆ C k + /-- `L` and `R` meet just in their ends. -/ + meet : L ∩ R = {s, t} + /-- `R` is as short as `L`. -/ + count : (R ∩ Γ.V).ncard ≤ (L ∩ Γ.V).ncard + /-- `Δ` is a closed disc. -/ + disc : IsClosedDisc Δ + /-- It is bounded by `L ∪ R`. -/ + bd : discBd Δ = L ∪ R + /-- It includes `L`. -/ + sub_L : L ⊆ Δ + /-- It includes `R`. -/ + sub_R : R ⊆ Δ + /-- It lies in `Σ₁`. -/ + sub_P : Δ ⊆ P₁ + /-- `Δ₁` is a closed disc. -/ + disc₁ : IsClosedDisc Δ₁ + /-- It includes `Δ`. -/ + sub₁ : capUp ι Δ ⊆ Δ₁ + /-- Its frontier meets `Σ₁` just in `L`. -/ + frontier₁ : ∀ x ∈ frontier Δ₁, x ∈ range ι → x ∈ capUp ι L + /-- The tangle puts it on the small side. -/ + mem : ((PaintingOrDrawing.drawing Γ₁).inter Δ₁, (PaintingOrDrawing.drawing Γ₁).interOutside Δ₁) ∈ + 𝒯 + +variable {θ : ℕ} {𝒯 : Set (Hypergraph T (Set T) × Hypergraph T (Set T))} + +/-- **Graph Minors XII, (5.4)** (page 255), for a line `L` of `Σ₁` with ends `s, t` on the common +boundary and no other point on it. -/ +theorem exists_piece [ConnectedSpace T] (h : IsCappedSplit C P₁ P₂ ι D) + (hΓ : IsCappedDrawing ι Γ Γ₁) + (_hN : ∀ k, Γ.IsNormal (C k)) (H : CapSetup (fun k => closure (D k)) Γ₁ θ 𝒯) + {L : Set S} {s t : S} (hL : IsLineWithEnds L s t) (hst : s ≠ t) (hLN : Γ.IsNormal L) + (hsmall : (L ∩ Γ.V).ncard < θ) (hLP : L ⊆ P₁) (hs : s ∈ P₂) (ht : t ∈ P₂) + (hmeet : ∀ x ∈ L, x ∈ P₂ → x = s ∨ x = t) : + ∃ R Δ₁ Δ, PieceData C ι Γ Γ₁ 𝒯 L s t R Δ₁ Δ := by + have hι := h.isEmbedding + have hιi := hι.injective + have hrange : L ⊆ range ((↑) : P₁ → S) := by + rw [Subtype.range_coe] + exact hLP + obtain ⟨u, v, hu, hv, hLp⟩ := hL.pull IsEmbedding.subtypeVal hrange + have hLT : IsLineWithEnds (capUp ι L) (ι u) (ι v) := hLp.map_of_embedding hι + have hne : ι u ≠ ι v := fun he => hst (by rw [← hu, ← hv, hιi he]) + have hC : ∀ {x : S} {p : P₁}, p.1 = x → x ∈ P₂ → ∃ k, ι p ∈ discBd (closure (D k)) := by + intro x p hp hx + have hm : x ∈ P₁ ∩ P₂ := ⟨hp ▸ p.2, hx⟩ + rw [h.inter] at hm + obtain ⟨k, hk⟩ := mem_iUnion.mp hm + refine ⟨k, ?_⟩ + rw [(cap_closure h k).2.1] + exact ⟨p, by change p.1 ∈ C k; rw [hp]; exact hk, rfl⟩ + obtain ⟨i, hi⟩ := hC hu hs + obtain ⟨j, hj⟩ := hC hv ht + have hNT : Γ₁.IsNormal (capUp ι L) := by + rintro _ ⟨⟨p, hp, rfl⟩, hpU⟩ + rw [hΓ.1] at hpU + have hU := (mem_capUp_val hιi).mp hpU + rw [hΓ.2] + exact ⟨p, hLN ⟨hp, hU⟩, rfl⟩ + have hcount : ∀ X : Set S, X ⊆ P₁ → (capUp ι X ∩ Γ₁.V).ncard = (X ∩ Γ.V).ncard := by + intro X hX + rw [← capUp_inter_V hιi hΓ, ncard_capUp hιi (inter_subset_left.trans hX)] + have hsmallT : (capUp ι L ∩ Γ₁.V).ncard < θ := by rwa [hcount L hLP] + have hmeetT : ∀ k, capUp ι L ∩ closure (D k) ⊆ {ι u, ι v} := by + rintro k _ ⟨⟨p, hp, rfl⟩, hpc⟩ + have hdiff : ι p ∈ capUp ι (C k) := closure_diff_eq h k ▸ + ⟨hpc, fun hd => Set.disjoint_left.mp (h.D_off k) hd ⟨p, rfl⟩⟩ + have hpC : p.1 ∈ C k := (mem_capUp_val hιi).mp hdiff + rcases hmeet p.1 hp (h.C_sub₂ k hpC) with he | he + · exact .inl (by rw [Subtype.ext (he.trans hu.symm)]) + · exact .inr (by rw [Subtype.ext (he.trans hv.symm)]; rfl) + obtain ⟨R', Δ₁, Δ', hd⟩ := exists_sideData H h.surface_hat hLT hne hNT hsmallT hi hj hmeetT + obtain ⟨k, hk⟩ := hd.on_cap + rw [(cap_closure h k).2.1] at hk + have hRr : R' ⊆ range ι := hk.trans (capUp_subset_range _) + have hΔr : Δ' ⊆ range ι := by + intro x hx + by_contra hn + have : x ∈ ⋃ m, D m := h.compl ▸ hn + obtain ⟨m, hm⟩ := mem_iUnion.mp this + exact Set.disjoint_left.mp (hd.off m) hx ((cap_closure h m).2.2.symm ▸ hm) + obtain ⟨u', v', hu', hv', hRp⟩ := hd.line.pull hι hRr + have hu'' : u' = u := hιi hu' + have hv'' : v' = v := hιi hv' + subst hu'' hv'' + have hRl : IsLineWithEnds (capDown ι R') s t := by + have := hRp.map_of_embedding (j := ((↑) : P₁ → S)) IsEmbedding.subtypeVal + rwa [hu, hv] at this + have hUR : capUp ι (capDown ι R') = R' := capUp_capDown hRr + have hRP : capDown ι R' ⊆ P₁ := capDown_subset _ + obtain ⟨hΔd, hΔb⟩ := disc_capDown h hd.disc hΔr + have hbd_eq : discBd (capDown ι Δ') = L ∪ capDown ι R' := by + rw [hΔb, hd.bd, capDown, preimage_union, image_union, ← capDown, ← capDown, + capDown_capUp hιi hLP] + have hbdsub := GraphMinor.Surface.discBd_subset Δ' + rw [hd.bd] at hbdsub + refine ⟨capDown ι R', Δ₁, capDown ι Δ', ⟨hRl, ⟨k, ?_⟩, ?_, ?_, hΔd, hbd_eq, ?_, ?_, + capDown_subset _, hd.disc₁, ?_, ?_, hd.mem⟩⟩ + · rintro _ ⟨p, hp, rfl⟩ + exact (mem_capUp_val hιi).mp (hk hp) + · apply Subset.antisymm + · rintro x ⟨hxL, p, hp, rfl⟩ + have : ι p ∈ capUp ι L ∩ R' := ⟨(mem_capUp_val hιi).mpr hxL, hp⟩ + rw [hd.meet] at this + rcases this with he | he + · exact .inl (by rw [hιi he, hu]) + · exact .inr (by rw [hιi he, hv]; rfl) + · rintro x (rfl | rfl) + · exact ⟨hL.left_mem, hRl.left_mem⟩ + · exact ⟨hL.right_mem, hRl.right_mem⟩ + · rw [← hcount _ hRP, ← hcount _ hLP, hUR] + exact hd.count + · intro x hx + exact ⟨⟨x, hLP hx⟩, hbdsub (.inl ⟨⟨x, hLP hx⟩, hx, rfl⟩), rfl⟩ + · rintro _ ⟨p, hp, rfl⟩ + exact ⟨p, hbdsub (.inr hp), rfl⟩ + · rintro _ ⟨p, ⟨q, hq, he⟩, rfl⟩ + have : p = q := Subtype.ext he.symm + subst this + exact hd.sub hq + · intro x hx hr + apply hd.frontier₁ x hx + intro m hm + rw [(cap_closure h m).2.2] at hm + exact Set.disjoint_left.mp (h.D_off m) hm hr + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section5Replace.lean b/LeanPool/GraphMinor/GM12/Section5Replace.lean new file mode 100644 index 0000000000..b9f214a7fa --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section5Replace.lean @@ -0,0 +1,221 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section5Piece +import LeanPool.GraphMinor.GM07.Section11 +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Replacing finitely many pieces of an `O`-arc + +The proof of Graph Minors XII, (5.3) (page 256), replaces each piece of `F` outside `Σ₂` by the line +that (5.4) gives on the common boundary. We do this for a finite set `J` of pieces, one at a time +(`exists_curve`). Each step does not add to the number of vertices on the curve, by the bound in +(5.4). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 Hypergraph + +local notation "𝕀" => unitInterval + +universe u + +variable {S T : Type u} [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] + {n : ℕ} {C : Fin n → Set S} {P₁ P₂ : Set S} {ι : P₁ → T} + {Γ : Drawing S} {Γ₁ : Drawing T} + {𝒯 : Set (Hypergraph T (Set T) × Hypergraph T (Set T))} + +/-- The arcs of the pieces in a finite set `J` of gaps of `φ ⁻¹' P₂`, with the output of (5.4) for +each. -/ +structure Pieces (C : Fin n → Set S) (P₂ : Set S) (ι : P₁ → T) (Γ : Drawing S) (Γ₁ : Drawing T) + (𝒯 : Set (Hypergraph T (Set T) × Hypergraph T (Set T))) (φ : C(Circle, S)) (J : Finset + (Set Circle)) + (a b : Set Circle → 𝕀 → Circle) (R : Set Circle → Set S) (Δ₁ : Set Circle → Set T) + (Δ : Set Circle → Set S) : Prop where + /-- Each member of `J` is a gap. -/ + gap : ∀ G ∈ J, IsGap (φ ⁻¹' P₂) G (a G) (b G) + /-- Each gap has the data of (5.4). -/ + piece : ∀ G ∈ J, PieceData C ι Γ Γ₁ 𝒯 (φ '' range (a G)) (φ (a G 0)) (φ (a G 1)) (R G) (Δ₁ G) + (Δ G) + +variable {φ : C(Circle, S)} {J : Finset (Set Circle)} {a b : Set Circle → 𝕀 → Circle} + {R : Set Circle → Set S} {Δ₁ : Set Circle → Set T} {Δ : Set Circle → Set S} + +omit [T2Space S] in +theorem closedCurvesHomotopicIn_mono {Z Z' : Set S} {c c' : C(Circle, S)} + (h : ClosedCurvesHomotopicIn Z c c') (hZ : Z ⊆ Z') : ClosedCurvesHomotopicIn Z' c c' := by + obtain ⟨ψ, h1, h2, h3⟩ := h + exact ⟨ψ, fun p => hZ (h1 p), h2, h3⟩ + +omit [T2Space S] in +theorem closedCurvesHomotopicIn_refl {Z : Set S} {c : C(Circle, S)} (hZ : ∀ x, c x ∈ Z) : + ClosedCurvesHomotopicIn Z c c := + ⟨⟨fun p => c p.1, by fun_prop⟩, fun p => hZ p.1, fun _ => rfl, fun _ => rfl⟩ + +omit [T2Space S] in +/-- The count in one replacement. -/ +theorem count_step {X R' L c' : Set S} {Y : Set S} {s t : S} (hV : Γ.V.Finite) + (hXc : X ∩ Γ.V ⊆ Y ∩ Γ.V) (hc' : c' ∩ Γ.V ⊆ ((Y ∩ Γ.V) \ (X ∩ Γ.V)) ∪ ((R' \ {s, t}) ∩ Γ.V)) + (hL : L = X ∪ {s, t}) (hXs : Disjoint X {s, t}) (hR : ({s, t} : Set S) ⊆ R') + (hcount : (R' ∩ Γ.V).ncard ≤ (L ∩ Γ.V).ncard) : + (c' ∩ Γ.V).ncard ≤ (Y ∩ Γ.V).ncard := by + classical + have hf : ∀ Z : Set S, (Z ∩ Γ.V).Finite := fun Z => hV.subset inter_subset_right + have hE : (({s, t} : Set S) ∩ Γ.V).Finite := hf _ + have h1 : (L ∩ Γ.V).ncard = (X ∩ Γ.V).ncard + (({s, t} : Set S) ∩ Γ.V).ncard := by + rw [hL, union_inter_distrib_right] + exact ncard_union_eq (hXs.mono inter_subset_left inter_subset_left) (hf _) hE + have h2 : (R' ∩ Γ.V).ncard = ((R' \ {s, t}) ∩ Γ.V).ncard + (({s, t} : Set S) ∩ Γ.V).ncard := by + have : R' ∩ Γ.V = ((R' \ {s, t}) ∩ Γ.V) ∪ (({s, t} : Set S) ∩ Γ.V) := by + rw [← union_inter_distrib_right, sdiff_union_of_subset hR] + rw [this] + refine ncard_union_eq ?_ (hf _) hE + exact (disjoint_sdiff_left.mono inter_subset_left inter_subset_left) + have h3 : (X ∩ Γ.V).ncard + ((Y ∩ Γ.V) \ (X ∩ Γ.V)).ncard = (Y ∩ Γ.V).ncard := by + have := ncard_sdiff_add_ncard_of_subset hXc (hf Y) + omega + have h4 := ncard_le_ncard hc' (((hf Y).subset sdiff_subset).union (hf _)) + have h5 := ncard_union_le ((Y ∩ Γ.V) \ (X ∩ Γ.V)) ((R' \ {s, t}) ∩ Γ.V) + omega + +omit [T2Space T] in +omit [T2Space S] in +/-- Replace the pieces in `J`, one at a time. -/ +theorem exists_curve (hφ : Function.Injective φ) (hA : IsClosed (φ ⁻¹' P₂)) + (hC : ∀ k, C k ⊆ P₂) (hP : Pieces C P₂ ι Γ Γ₁ 𝒯 φ J a b R Δ₁ Δ) {Z : Set S} + (hφZ : ∀ x, φ x ∈ Z) (hZ : ∀ G ∈ J, Δ G ⊆ Z) : + ∃ c : C(Circle, S), (∀ x, (∀ G ∈ J, x ∉ G) → c x = φ x) ∧ + (∀ G ∈ J, ∀ x ∈ G, ∃ k, c x ∈ C k) ∧ + (range c ∩ Γ.V).ncard ≤ (range φ ∩ Γ.V).ncard ∧ ClosedCurvesHomotopicIn Z φ c := by + classical + induction J using Finset.induction_on with + | empty => exact ⟨φ, fun _ _ => rfl, by simp, le_rfl, closedCurvesHomotopicIn_refl hφZ⟩ + | insert G J' hG ih => + have hP' : Pieces C P₂ ι Γ Γ₁ 𝒯 φ J' a b R Δ₁ Δ := + ⟨fun G' hG' => hP.gap G' (Finset.mem_insert_of_mem hG'), + fun G' hG' => hP.piece G' (Finset.mem_insert_of_mem hG')⟩ + obtain ⟨c, hc1, hc2, hc3, hc4⟩ := ih hP' fun G' hG' => hZ G' (Finset.mem_insert_of_mem hG') + have hgap := hP.gap G (Finset.mem_insert_self _ _) + have hpc := hP.piece G (Finset.mem_insert_self _ _) + have hcφ : ∀ t, c (a G t) = φ (a G t) := by + intro t + apply hc1 + intro G' hG' hmem + by_cases ht : t = 0 ∨ t = 1 + · rcases ht with rfl | rfl + · exact Set.disjoint_left.mp (hP.gap G' (Finset.mem_insert_of_mem hG')).disjoint hmem + hgap.zero + · exact Set.disjoint_left.mp (hP.gap G' (Finset.mem_insert_of_mem hG')).disjoint hmem + hgap.one + · push Not at ht + have hmem' : a G t ∈ G := hgap.mem_iff.mpr ht + rcases hgap.eq_or_disjoint hA (hP.gap G' (Finset.mem_insert_of_mem hG')) with he | hd + · exact hG (he ▸ hG') + · exact Set.disjoint_left.mp hd hmem' hmem + obtain ⟨γ, hγ, hγr, hγ0, hγ1⟩ := hpc.line.exists_arc + have hrc : ∀ x, c x ∈ Z := by + obtain ⟨ψ, h1, -, h3⟩ := hc4 + exact fun x => h3 x ▸ h1 (x, 1) + obtain ⟨c', hb', ha', hh⟩ := exists_replace hgap.two hgap.cover hγ.1 + (by rw [hγ0, hcφ]) (by rw [hγ1, hcφ]) hpc.disc + (fun t => by rw [hcφ]; exact hpc.sub_L ⟨_, ⟨t, rfl⟩, rfl⟩) + (fun t => hpc.sub_R (hγr ▸ ⟨t, rfl⟩)) + have hrb : ∀ x, x ∉ G → x ∈ range (b G) := by + intro x hx + by_contra hn + exact hx (hgap.eq.symm.subset hn) + refine ⟨c', ?_, ?_, ?_, ?_⟩ + · intro x hx + have hxG : x ∉ G := hx G (Finset.mem_insert_self _ _) + rw [hb' x (hrb x hxG)] + exact hc1 x fun G' hG' => hx G' (Finset.mem_insert_of_mem hG') + · intro G' hG' x hx + rcases Finset.mem_insert.mp hG' with rfl | hG'' + · obtain ⟨t, rfl⟩ := hgap.subset_range hx + obtain ⟨k, hk⟩ := hpc.on + exact ⟨k, by rw [ha']; exact hk (hγr ▸ ⟨t, rfl⟩)⟩ + · have hxG : x ∉ G := fun hxG => by + rcases hgap.eq_or_disjoint hA (hP.gap G' hG') with he | hd + · exact hG (he ▸ hG'') + · exact Set.disjoint_left.mp hd hxG hx + rw [hb' x (hrb x hxG)] + exact hc2 G' hG'' x hx + · refine le_trans ?_ hc3 + have hL : φ '' range (a G) = (φ '' G) ∪ {φ (a G 0), φ (a G 1)} := by + ext y + constructor + · rintro ⟨_, ⟨t, rfl⟩, rfl⟩ + by_cases h0 : t = 0 + · subst h0 + exact .inr (.inl rfl) + by_cases h1 : t = 1 + · subst h1 + exact .inr (.inr rfl) + exact .inl ⟨_, hgap.mem_iff.mpr ⟨h0, h1⟩, rfl⟩ + · rintro (⟨x, hx, rfl⟩ | rfl | rfl) + · exact ⟨x, hgap.subset_range hx, rfl⟩ + · exact ⟨_, ⟨0, rfl⟩, rfl⟩ + · exact ⟨_, ⟨1, rfl⟩, rfl⟩ + have hXs : Disjoint (φ '' G) {φ (a G 0), φ (a G 1)} := by + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨x, hx, rfl⟩ (he | he) + · rw [hφ he] at hx + exact Set.disjoint_left.mp hgap.disjoint hx hgap.zero + · rw [hφ he] at hx + exact Set.disjoint_left.mp hgap.disjoint hx hgap.one + have hends : ({φ (a G 0), φ (a G 1)} : Set S) ⊆ R G := by + rintro _ (rfl | rfl) + · exact hpc.line.left_mem + · exact hpc.line.right_mem + have hoffP : ∀ y ∈ φ '' G, y ∉ P₂ := by + rintro _ ⟨x, hx, rfl⟩ hmem + exact Set.disjoint_left.mp hgap.disjoint hx hmem + refine count_step Γ.finite_V ?_ ?_ hL hXs hends hpc.count + · rintro _ ⟨⟨x, hx, rfl⟩, hV⟩ + have hxr : x ∈ range (a G) := hgap.subset_range hx + obtain ⟨t, rfl⟩ := hxr + exact ⟨⟨_, hcφ t⟩, hV⟩ + · rintro _ ⟨⟨x, rfl⟩, hV⟩ + by_cases hxG : x ∈ G + · obtain ⟨t, rfl⟩ := hgap.subset_range hxG + rw [ha'] at hV ⊢ + by_cases hend : γ t ∈ ({φ (a G 0), φ (a G 1)} : Set S) + · refine .inl ⟨⟨?_, hV⟩, fun hn => hoffP _ hn.1 ?_⟩ + · rcases hend with he | he + · exact ⟨a G 0, by rw [hcφ, he]⟩ + · exact ⟨a G 1, by rw [hcφ, he]⟩ + · rcases hend with he | he + · rw [he] + exact hgap.zero + · rw [he] + exact hgap.one + · exact .inr ⟨⟨hγr ▸ ⟨t, rfl⟩, hend⟩, hV⟩ + · rw [hb' x (hrb x hxG)] at hV ⊢ + refine .inl ⟨⟨⟨x, rfl⟩, hV⟩, fun hn => hoffP _ hn.1 ?_⟩ + by_cases hgaps : ∀ G' ∈ J', x ∉ G' + · have he := hc1 x hgaps + obtain ⟨x', hx', hxe⟩ := hn.1 + rw [he] at hxe + rw [hφ hxe] at hx' + exact absurd hx' hxG + · push Not at hgaps + obtain ⟨G', hG', hx'⟩ := hgaps + obtain ⟨k, hk⟩ := hc2 G' hG' x hx' + exact hC k hk + · apply hc4.trans (closedCurvesHomotopicIn_mono hh (union_subset ?_ ?_)) + · rintro _ ⟨x, rfl⟩ + exact hrc x + · exact hZ G (Finset.mem_insert_self _ _) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section5Respect.lean b/LeanPool/GraphMinor/GM12/Section5Respect.lean new file mode 100644 index 0000000000..761f382adc --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section5Respect.lean @@ -0,0 +1,748 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section5Tangle +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.Surface.AddCrosscap +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Graph Minors XII, (5.3) + +We prove that the tangle induced in `Γ` by a respectful tangle of `Γ₁` is respectful, under the +hypotheses of (5.3). The first case, of an `O`-arc with at most one point in `Σ₂`, is +`respect_of_inside`. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 Hypergraph + +universe u + +variable {S T : Type u} [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] + {n : ℕ} {C : Fin n → Set S} {P₁ P₂ : Set S} {ι : P₁ → T} {D : Fin n → Set T} + {Γ : Drawing S} {Γ₁ : Drawing T} {θ : ℕ} + {𝒯 : Set (Hypergraph T (Set T) × Hypergraph T (Set T))} + +theorem mem_closure_diff_iff {X : Type*} [TopologicalSpace X] {Y : Set X} (hY : IsClosed Y) + (x : X) : + x ∈ closure (univ \ Y) ↔ x ∉ Y ∨ x ∈ frontier Y := by + rw [frontier_eq_closure_inter_closure, compl_eq_univ_sdiff, hY.closure_eq] + constructor + · intro hx + by_cases hxY : x ∈ Y + · exact .inr ⟨hxY, hx⟩ + · exact .inl hxY + · rintro (hx | hx) + · exact subset_closure ⟨mem_univ x, hx⟩ + · exact hx.2 + +omit [T2Space S] [T2Space T] in +theorem isOArc_capUp_of_subset (h : IsCappedSplit C P₁ P₂ ι D) {F : Set S} (hO : IsOArc F) + (hF : F ⊆ P₁) : IsOArc (capUp ι F) := by + have hpre : IsOArc ((↑) ⁻¹' F : Set P₁) := by + apply isOArc_of_image IsEmbedding.subtypeVal + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hF] + exact hO + exact isOArc_image h.isEmbedding hpre + +omit [T2Space T] in +/-- An `O`-arc with at most one point in `Σ₂` lies in `Σ₁`, because it has no isolated point and +the complement of `Σ₁` is open. -/ +theorem subset_of_subsingleton (h : IsCappedSplit C P₁ P₂ ι D) {F : Set S} (hO : IsOArc F) + (hF : (F ∩ P₂).Subsingleton) : F ⊆ P₁ := by + obtain ⟨e⟩ := hO + intro x hx + by_contra hn + have hx₂ : x ∈ P₂ := (show x ∈ P₁ ∪ P₂ from h.union ▸ mem_univ x).resolve_left hn + let U : Set Circle := {w | (e w).1 ∉ P₁} + have hU : IsOpen U := by + have hc : Continuous fun w => (e w).1 := continuous_subtype_val.comp e.continuous + exact (h.isClosed₁.preimage hc).isOpen_compl + let w₀ := e.symm ⟨x, hx⟩ + have hw₀ : (e w₀).1 = x := by simp [w₀] + have hUs : U = {w₀} := by + apply Subset.antisymm + · intro w hw + have hw₂ : (e w).1 ∈ P₂ := + (show (e w).1 ∈ P₁ ∪ P₂ from h.union ▸ mem_univ _).resolve_left hw + have := hF ⟨(e w).2, hw₂⟩ ⟨hx, hx₂⟩ + exact e.injective (Subtype.ext (this.trans hw₀.symm)) + · rintro w rfl + change (e w₀).1 ∉ P₁ + rwa [hw₀] + have huniv : U = univ := by + apply IsClopen.eq_univ ⟨?_, hU⟩ ⟨w₀, ?_⟩ + · rw [hUs] + exact isClosed_singleton + · rw [hUs] + rfl + have hall : ∀ w : Circle, w = w₀ := fun w => by + have : w ∈ U := huniv ▸ mem_univ w + rw [hUs] at this + exact this + have hne : Circle.exp Real.pi ≠ 1 := by + intro he + have := congrArg (fun z : Circle => (z : ℂ)) he + simp only [Circle.coe_exp, Circle.coe_one] at this + rw [Complex.exp_pi_mul_I] at this + norm_num at this + exact hne ((hall _).trans (hall _).symm) + +/-- The first case of the proof of (5.3): an `O`-arc inside `Σ₁`. -/ +theorem respect_of_inside [ConnectedSpace T] (h : IsCappedSplit C P₁ P₂ ι D) + (hΓ : IsCappedDrawing ι Γ Γ₁) + (hN : ∀ k, Γ.IsNormal (C k)) (H : CapSetup (fun k => closure (D k)) Γ₁ θ 𝒯) + {F : Set S} (hO : IsOArc F) (hFN : Γ.IsNormal F) (hsmall : (F ∩ Γ.V).ncard < θ) (hFP : F ⊆ P₁) : + ∃ Δ : Set S, IsClosedDisc Δ ∧ subBd Δ = F ∧ + ((PaintingOrDrawing.drawing Γ).inter Δ, (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ + inducedAcross ι Γ Γ₁ θ 𝒯 := by + have hι := h.isEmbedding + have hιi := hι.injective + have hS := h.surface_hat + have hSS := h.surface.1 + have hcount : (capUp ι F ∩ Γ₁.V).ncard = (F ∩ Γ.V).ncard := by + rw [← capUp_inter_V hιi hΓ, ncard_capUp hιi (inter_subset_left.trans hFP)] + have hNT : Γ₁.IsNormal (capUp ι F) := by + rintro _ ⟨⟨p, hp, rfl⟩, hpU⟩ + rw [hΓ.1] at hpU + rw [hΓ.2] + exact ⟨p, hFN ⟨hp, (mem_capUp_val hιi).mp hpU⟩, rfl⟩ + obtain ⟨Δ₁, hΔ₁, hbd, hmem⟩ := H.respect.2 _ (isOArc_capUp_of_subset h hO hFP) hNT + (by change (capUp ι F ∩ Γ₁.V).ncard < θ; rwa [hcount]) + have hfr : frontier Δ₁ = capUp ι F := by rw [← subBd_eq_frontier, hbd] + have hbΔ : discBd Δ₁ = capUp ι F := by + rw [← IsClosedDisc.frontier_eq_discBd hS hΔ₁, hfr] + have hoff : ∀ k, Disjoint Δ₁ (D k) := by + intro k + have := off_cap H hS hΔ₁ hmem (by rw [hfr]; rwa [hcount]) k (by + rw [(cap_closure h k).2.2, hbΔ] + exact (h.D_off k).mono_right (capUp_subset_range _)) + rwa [(cap_closure h k).2.2] at this + have hr : Δ₁ ⊆ range ι := by + intro x hx + by_contra hn + have : x ∈ ⋃ m, D m := h.compl ▸ hn + obtain ⟨m, hm⟩ := mem_iUnion.mp this + exact Set.disjoint_left.mp (hoff m) hx hm + have : Nonempty T := ⟨(hΔ₁.isPathConnected.nonempty).some⟩ + obtain ⟨hΔd, hΔb⟩ := disc_capDown h hΔ₁ hr + have hbF : discBd (capDown ι Δ₁) = F := by + rw [hΔb, hbΔ, capDown_capUp hιi hFP] + have hsub : subBd (capDown ι Δ₁) = F := by + rw [subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hSS hΔd, hbF] + have hfrS : frontier (capDown ι Δ₁) = F := by rw [← subBd_eq_frontier, hsub] + have hcl := hΔd.isClosed + have hiff : ∀ p : P₁, ι p ∈ Δ₁ ↔ p.1 ∈ capDown ι Δ₁ := by + intro p + constructor + · intro hp + exact ⟨p, hp, rfl⟩ + · rintro ⟨q, hq, he⟩ + rwa [← Subtype.ext he] + refine ⟨capDown ι Δ₁, hΔd, hsub, mem_inducedAcross h hΓ hN hcl ?_ ?_ hiff ?_ hmem⟩ + · rw [hfrS] + exact hFN + · rw [hfrS] + exact hsmall + · intro p + rw [mem_closure_diff_iff hΔ₁.isClosed, mem_closure_diff_iff hcl, hfr, hfrS, mem_capUp_val hιi, + hiff p] + +/-- A connected set that meets a closed set and misses its frontier lies in it. -/ +theorem subset_of_frontier {X : Type*} [TopologicalSpace X] {A Y : Set X} (hA : IsPreconnected A) + (hY : IsClosed Y) (hne : (A ∩ Y).Nonempty) (hd : ∀ x ∈ A, x ∉ frontier Y) : A ⊆ Y := by + obtain ⟨x, hxA, hxY⟩ := hne + have hsub : A ⊆ interior Y ∪ Yᶜ := fun y hy => by + by_cases hyY : y ∈ Y + · refine .inl ?_ + by_contra hn + exact hd y hy ⟨subset_closure hyY, hn⟩ + · exact .inr hyY + have hxi : x ∈ interior Y := by + by_contra hn + exact hd x hxA ⟨subset_closure hxY, hn⟩ + have := hA.subset_left_of_subset_union isOpen_interior hY.isOpen_compl + (Set.disjoint_left.mpr fun _ h₁ h₂ => h₂ (interior_subset h₁)) hsub ⟨x, hxA, hxi⟩ + exact this.trans interior_subset + +local notation "𝕀" => unitInterval + +omit [T2Space S] in +theorem exists_level_near {Y : Type*} [TopologicalSpace Y] {b : Y × 𝕀 → S} (hb : Continuous b) + {F : Set S} (hF : IsClosed F) {y : Y} (hy : b (y, 0) ∉ F) : + ∃ ε : 𝕀, ε ≠ 0 ∧ ∀ s ≤ ε, b (y, s) ∉ F := by + have hopen : IsOpen {s : 𝕀 | b (y, s) ∉ F} := + (hF.preimage (hb.comp (Continuous.prodMk_right y))).isOpen_compl + have hnh : {s : 𝕀 | b (y, s) ∉ F} ∈ 𝓝 (⊥ : 𝕀) := hopen.mem_nhds hy + obtain ⟨a, ha, hsub⟩ := (nhds_bot_basis (α := 𝕀)).mem_iff.mp hnh + obtain ⟨ε, h0, hε⟩ := exists_between ha + exact ⟨ε, ne_of_gt h0, fun s hs => hsub (lt_of_le_of_lt hs hε)⟩ + +omit [T2Space S] in +/-- Near level zero, the fibres over a finite set of points off `F` miss `F`. -/ +theorem exists_level_fibre {Y : Type*} [TopologicalSpace Y] {b : Y × 𝕀 → S} (hb : Continuous b) + (hi : Function.Injective b) {F W : Set S} (hF : IsClosed F) (hW : W.Finite) + (hWF : Disjoint W F) : + ∃ ε : 𝕀, ε ≠ 0 ∧ ∀ y s, b (y, 0) ∈ W → s ≤ ε → b (y, s) ∉ F := by + induction W, hW using Set.Finite.induction_on with + | empty => exact ⟨1, one_ne_zero, fun y s hy => hy.elim⟩ + | @insert w W _ _ ih => + obtain ⟨ε, h0, hε⟩ := ih (hWF.mono_left (subset_insert _ _)) + by_cases hr : ∃ y, b (y, 0) = w + · obtain ⟨y, rfl⟩ := hr + obtain ⟨ε', h0', hε'⟩ := exists_level_near hb hF (y := y) + (Set.disjoint_left.mp hWF (mem_insert _ _)) + refine ⟨min ε ε', ?_, ?_⟩ + · rcases min_choice ε ε' with he | he <;> rw [he] <;> assumption + · intro y' s hy' hs + rcases hy' with hy' | hy' + · have : y' = y := congrArg Prod.fst (hi hy') + subst this + exact hε' s (hs.trans (min_le_right _ _)) + · exact hε y' s hy' (hs.trans (min_le_left _ _)) + · refine ⟨ε, h0, fun y s hy' hs => ?_⟩ + rcases hy' with hy' | hy' + · exact (hr ⟨y, hy'⟩).elim + · exact hε y s hy' hs + +omit [T2Space S] in +/-- Below some level, the collar misses a finite set of points off `Σ₂`. -/ +theorem exists_level_off {Y : Type*} [TopologicalSpace Y] {b : Y × 𝕀 → S} + (hb : IsOuterCollar P₂ b) {Q : Set S} + (hQ : Q.Finite) (hQP : Disjoint Q P₂) {ε₀ : 𝕀} (hε₀ : ε₀ ≠ 0) : + ∃ ε : 𝕀, ε ≠ 0 ∧ ε ≤ ε₀ ∧ ∀ q ∈ Q, q ∉ b '' {p | p.2 ≤ ε} := by + induction Q, hQ using Set.Finite.induction_on with + | empty => exact ⟨ε₀, hε₀, le_rfl, fun q hq => hq.elim⟩ + | @insert w W _ _ ih => + obtain ⟨ε, h0, hle, hε⟩ := ih (hQP.mono_left (subset_insert _ _)) + by_cases hr : w ∈ range b + · obtain ⟨⟨y, s⟩, rfl⟩ := hr + have hs : s ≠ 0 := by + rintro rfl + exact Set.disjoint_left.mp hQP (mem_insert _ _) (hb.zero y) + obtain ⟨m, hm0, hm⟩ := exists_between (unitInterval.pos_iff_ne_zero.mpr hs) + refine ⟨min ε m, ?_, (min_le_left _ _).trans hle, ?_⟩ + · rcases min_choice ε m with he | he <;> rw [he] + · exact h0 + · exact ne_of_gt hm0 + · rintro q (rfl | hq) ⟨p, hp, he⟩ + · have : p = (y, s) := hb.inj he + subst this + exact absurd (lt_of_le_of_lt ((show s ≤ min ε m from hp).trans (min_le_right _ _)) hm) + (lt_irrefl _) + · exact hε q hq ⟨p, show p.2 ≤ ε from le_trans hp (min_le_left _ _), he⟩ + · refine ⟨ε, h0, hle, ?_⟩ + rintro q (rfl | hq) + · exact fun ⟨p, _, he⟩ => hr ⟨p, he⟩ + · exact hε q hq + +@[expose] public section + +/-- Condition (iii) of (5.3), with the length of a curve read as the number of vertices on its +image. -/ +def CurvesNull (Γ : Drawing S) (P₂ : Set S) (θ : ℕ) : Prop := + ∀ c : C(Circle, S), (∀ x, c x ∈ P₂) → Γ.IsNormal (range c) → (range c ∩ Γ.V).ncard < θ → + ClosedCurveIsNullHomotopicIn P₂ c + +end + +variable {φ : C(Circle, S)} {J : Finset (Set Circle)} {a b' : Set Circle → 𝕀 → Circle} + {R : Set Circle → Set S} {Δ₁ : Set Circle → Set T} {Δg : Set Circle → Set S} + +omit [T2Space T] in +/-- The homotopy of the proof of (5.3). We replace the pieces in `J` by lines on the common +boundary, +and we push the rest of the curve across the collar. Then (iii) applies, and Graph Minors XI (7.2) +gives a disc in the subset of the null-homotopy. -/ +theorem exists_disc_of_pieces [NeZero n] (h : IsCappedSplit C P₁ P₂ ι D) (hN : ∀ k, Γ.IsNormal + (C k)) + (hφ : Function.Injective φ) (hFN : Γ.IsNormal (range φ)) (hsmall : (range φ ∩ Γ.V).ncard < θ) + (hiii : CurvesNull Γ P₂ θ) {β : (Fin n × Circle) × 𝕀 → S} (hβ : IsOuterCollar P₂ β) + (hβ0 : ∀ y, β (y, 0) ∈ C y.1) {ε : 𝕀} + (hfib : ∀ y s, β (y, 0) ∈ Γ.V → β (y, 0) ∉ range φ → s ≤ ε → β (y, s) ∉ range φ) + (hP : Pieces C P₂ ι Γ Γ₁ 𝒯 φ J a b' R Δ₁ Δg) + (hJ : ∀ x, (∀ G ∈ J, x ∉ G) → φ x ∈ P₂ ∪ β '' {p | p.2 ≤ ε}) : + ∃ Δ, Δ ⊆ P₂ ∪ β '' {p | p.2 ≤ ε} ∪ ⋃ G ∈ J, Δg G ∧ IsClosedDisc Δ ∧ discBd Δ = range φ := by + classical + have hP₂ := h.isClosed₂ + have hA : IsClosed (φ ⁻¹' P₂) := hP₂.preimage φ.continuous + set Z := P₂ ∪ β '' {p | p.2 ≤ ε} ∪ ⋃ G ∈ J, Δg G with hZdef + have hZ₁ : P₂ ∪ β '' {p | p.2 ≤ ε} ⊆ Z := subset_union_left + have hφZ : ∀ x, φ x ∈ Z := by + intro x + by_cases hx : ∀ G ∈ J, x ∉ G + · exact hZ₁ (hJ x hx) + · push Not at hx + obtain ⟨G, hG, hxG⟩ := hx + refine .inr (mem_biUnion hG ((hP.piece G hG).sub_L ?_)) + exact ⟨x, (hP.gap G hG).subset_range hxG, rfl⟩ + have hZg : ∀ G ∈ J, Δg G ⊆ Z := fun G hG => subset_biUnion_of_mem (u + := Δg) hG |>.trans subset_union_right + obtain ⟨c, hc1, hc2, hc3, hc4⟩ := exists_curve hφ hA h.C_sub₂ hP hφZ hZg + have hcN : ∀ x, c x ∈ P₂ ∪ β '' {p | p.2 ≤ ε} := by + intro x + by_cases hx : ∀ G ∈ J, x ∉ G + · rw [hc1 x hx] + exact hJ x hx + · push Not at hx + obtain ⟨G, hG, hxG⟩ := hx + obtain ⟨k, hk⟩ := hc2 G hG x hxG + exact .inl (h.C_sub₂ k hk) + obtain ⟨c', h1, h2, h3, h4⟩ := exists_push hβ hP₂ hcN + have hmemC : ∀ x, c x ∉ P₂ → (∀ G ∈ J, x ∉ G) := by + intro x hx G hG hxG + obtain ⟨k, hk⟩ := hc2 G hG x hxG + exact hx (h.C_sub₂ k hk) + have hshape : ∀ x, c' x ∈ range φ ∨ ∃ k, c' x ∈ C k := by + intro x + by_cases hx : c x ∈ P₂ + · rw [h1 x hx] + by_cases hxJ : ∀ G ∈ J, x ∉ G + · exact .inl ⟨x, (hc1 x hxJ).symm⟩ + · push Not at hxJ + obtain ⟨G, hG, hxG⟩ := hxJ + exact .inr (hc2 G hG x hxG) + · obtain ⟨p, -, he⟩ := (hcN x).resolve_left hx + rw [h2 x p he.symm] + exact .inr ⟨_, hβ0 p.1⟩ + have hnorm : Γ.IsNormal (range c') := by + rintro _ ⟨⟨x, rfl⟩, hU⟩ + rcases hshape x with hx | ⟨k, hk⟩ + · exact hFN ⟨hx, hU⟩ + · exact hN k ⟨hk, hU⟩ + have hsubV : range c' ∩ Γ.V ⊆ range c ∩ Γ.V := by + rintro _ ⟨⟨x, rfl⟩, hV⟩ + refine ⟨?_, hV⟩ + by_cases hx : c x ∈ P₂ + · exact ⟨x, (h1 x hx).symm⟩ + · obtain ⟨p, hple, he⟩ := (hcN x).resolve_left hx + have hv := h2 x p he.symm + rw [hv] at hV ⊢ + by_cases hvF : β (p.1, 0) ∈ range φ + · obtain ⟨x', hx'⟩ := hvF + have hoff : ∀ G ∈ J, x' ∉ G := by + intro G hG hxG + refine Set.disjoint_left.mp (hP.gap G hG).disjoint hxG ?_ + change φ x' ∈ P₂ + rw [hx'] + exact hβ.zero _ + exact ⟨x', by rw [hc1 x' hoff, hx']⟩ + · exfalso + apply hfib p.1 p.2 hV hvF hple + have : β (p.1, p.2) = c x := he + rw [this, hc1 x (hmemC x hx)] + exact ⟨x, rfl⟩ + have hcount : (range c' ∩ Γ.V).ncard < θ := + lt_of_le_of_lt (ncard_le_ncard hsubV (Γ.finite_V.subset inter_subset_right)) + (lt_of_le_of_lt hc3 hsmall) + obtain ⟨z, hz, hnull⟩ := hiii c' h3 hnorm hcount + have hhom : ClosedCurvesHomotopicIn Z φ (ContinuousMap.const Circle z) := + (hc4.trans (closedCurvesHomotopicIn_mono h4 hZ₁)).trans + (closedCurvesHomotopicIn_mono hnull (subset_union_left.trans hZ₁)) + have hO : IsOArc (range φ) := ⟨(φ.continuous.isClosedEmbedding hφ).isEmbedding.toHomeomorph⟩ + have hSS := h.surface.1 + have hbdS : Disjoint (range φ) (bd S) := by + refine Set.disjoint_left.mpr fun x _ hx => hx (hSS.2.2 x) + have hnO : IsNullHomotopicOArcIn Z (range φ) := by + let e : Circle ≃ₜ range φ := (φ.continuous.isClosedEmbedding hφ).isEmbedding.toHomeomorph + refine ⟨e, z, hZ₁ (.inl hz), ?_⟩ + have he : (⟨fun x => (e x).1, continuous_subtype_val.comp e.continuous⟩ : C(Circle, S)) = φ := + ContinuousMap.ext fun x => rfl + rw [he] + exact hhom + obtain ⟨Δ, hΔZ, hΔ, hb⟩ := (epstein S Z (range φ) (IsClosedSurface.isSurface hSS) h.surface.2 hO + (by rintro _ ⟨x, rfl⟩; exact hφZ x) hbdS).1 hnO + exact ⟨Δ, hΔZ, hΔ, hb⟩ + +/-- The end of the proof of (5.3). The sides from (5.4) and the vertices of `F` on the common +boundary +cover the side of `Δ`, so [5, Theorem (6.2)] shows that this side is the small one. -/ +theorem mem_of_sides (h : IsCappedSplit C P₁ P₂ ι D) (hΓ : IsCappedDrawing ι Γ Γ₁) + (hN : ∀ k, Γ.IsNormal (C k)) (hT : IsTangle Γ₁.toHypergraph θ 𝒯) {F Δ : Set S} + (hFN : Γ.IsNormal F) (hsmall : (F ∩ Γ.V).ncard < θ) (hΔ : IsClosed Δ) (hfr : frontier Δ = F) + (J : Finset (Set Circle)) (Δ₁ : Set Circle → Set T) + (hmem : ∀ G ∈ J, ((PaintingOrDrawing.drawing Γ₁).inter (Δ₁ G), + (PaintingOrDrawing.drawing Γ₁).interOutside (Δ₁ G)) ∈ 𝒯) + (hLF : ∀ G ∈ J, ∀ x ∈ frontier (Δ₁ G), x ∈ range ι → x ∈ capUp ι F) + (hcV : ∀ p : P₁, p.1 ∈ Γ.V → p.1 ∈ Δ → p.1 ∈ F ∧ p.1 ∈ P₂ ∨ ∃ G ∈ J, ι p ∈ Δ₁ G) + (hcE : ∀ e ∈ Γ₁.E, e ⊆ capUp ι Δ → ∃ G ∈ J, e ⊆ Δ₁ G) : + ((PaintingOrDrawing.drawing Γ).inter Δ, (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ + inducedAcross ι Γ Γ₁ θ 𝒯 := by + classical + have hι := h.isEmbedding + have hιi := hι.injective + have hcP : CompactSpace P₁ := h.manifold₁.1 + have hclUp : ∀ {X : Set S}, IsClosed X → IsClosed (capUp ι X) := fun hX => + ((hX.preimage continuous_subtype_val).isCompact.image hι.continuous).isClosed + set Q₁ := capUp ι Δ with hQ₁ + set Q₂ := capUp ι (closure (univ \ Δ)) with hQ₂ + have hmid : ∀ p : P₁, ι p ∈ Q₁ → ι p ∈ Q₂ → p.1 ∈ F := by + intro p h₁ h₂ + have h₁' := (mem_capUp_val hιi).mp h₁ + have h₂' := (mem_capUp_val hιi).mp h₂ + rw [← hfr, frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] + exact ⟨subset_closure h₁', h₂'⟩ + have hF2 : ∀ p : P₁, p.1 ∈ F → ι p ∈ Q₁ ∩ Q₂ := by + intro p hp + have hp' : p.1 ∈ frontier Δ := hfr ▸ hp + have hp2 := (mem_closure_diff_iff hΔ p.1).mpr (.inr hp') + exact ⟨(mem_capUp_val hιi).mpr (frontier_subset_closure hp' |> hΔ.closure_subset), + (mem_capUp_val hιi).mpr hp2⟩ + have hcov : ∀ p : P₁, ι p ∈ Q₁ ∪ Q₂ := by + intro p + by_cases hp : p.1 ∈ Δ + · exact .inl ⟨p, hp, rfl⟩ + · exact .inr ⟨p, (mem_closure_diff_iff hΔ p.1).mpr (.inl hp), rfl⟩ + have hF₁ : F ∩ Γ.V ∩ P₁ ⊆ P₁ := inter_subset_right + set Y₀ := capUp ι (F ∩ Γ.V ∩ P₁) with hY₀ + have hY₀V : Y₀ ⊆ Γ₁.V := by + rw [hΓ.2] + exact capUp_mono (inter_subset_left.trans inter_subset_right) + have hY₀c : Y₀.ncard < θ := by + rw [hY₀, ncard_capUp hιi hF₁] + exact lt_of_le_of_lt (ncard_le_ncard inter_subset_left (Γ.finite_V.subset inter_subset_right)) + hsmall + have hsub : Γ₁.V ∩ (Q₁ ∩ Q₂) ⊆ Y₀ := by + rintro y ⟨hy, ⟨p, hp, rfl⟩, h₂⟩ + rw [hΓ.2] at hy + exact ⟨p, ⟨⟨hmid p ⟨p, hp, rfl⟩ h₂, (mem_capUp_val hιi).mp hy⟩, p.2⟩, rfl⟩ + let side : Set Circle → Hypergraph T (Set T) × Hypergraph T (Set T) := fun G => + ((PaintingOrDrawing.drawing Γ₁).inter (Δ₁ G), (PaintingOrDrawing.drawing Γ₁).interOutside + (Δ₁ G)) + have hq : ((PaintingOrDrawing.drawing Γ₁).inter Q₁, (PaintingOrDrawing.drawing Γ₁).inter Q₂) ∈ 𝒯 + := by + refine mem_of_cover hT (hclUp hΔ) (hclUp isClosed_closure) ?_ ?_ ?_ ?_ + (((PaintingOrDrawing.drawing Γ₁).inter Y₀, (PaintingOrDrawing.drawing Γ₁).inter univ) :: + J.toList.map side) ?_ ?_ ?_ ?_ + · intro y hy + rw [hΓ.2] at hy + obtain ⟨p, -, rfl⟩ := hy + exact hcov p + · intro e he y hy + have hyU := (he.2.1 hy).1 + rw [hΓ.1] at hyU + obtain ⟨p, -, rfl⟩ := hyU + exact hcov p + · intro e he y hy h₁ h₂ + obtain ⟨f, hf, hfP, rfl⟩ := exists_edge_capUp h hΓ hN he + obtain ⟨p, hp, rfl⟩ := hy + have hpF := hmid p h₁ h₂ + exact (hf.2.1 hp).2 (hFN ⟨hpF, (hf.2.1 hp).1⟩) + · exact lt_of_le_of_lt (ncard_le_ncard hsub (Γ₁.finite_V.subset hY₀V)) hY₀c + · intro p hp + rcases List.mem_cons.mp hp with rfl | hp + · exact mem_vertices hT hY₀V hY₀c + · obtain ⟨G, hG, rfl⟩ := List.mem_map.mp hp + exact hmem G (Finset.mem_toList.mp hG) + · intro p hp + rcases List.mem_cons.mp hp with rfl | hp + · rintro y ⟨⟨hyV, hy⟩, -⟩ + obtain ⟨q, hq, rfl⟩ := hy + exact ⟨hyV, hF2 q hq.1.1⟩ + · obtain ⟨G, hG, rfl⟩ := List.mem_map.mp hp + intro y hy + obtain ⟨hyF, hyV⟩ := inter_outside_subset hy + have hyV' : y ∈ Γ₁.V := hyV + have hyr : y ∈ range ι := by + rw [hΓ.2] at hyV' + exact capUp_subset_range _ hyV' + obtain ⟨q, hq, rfl⟩ := hLF G (Finset.mem_toList.mp hG) y hyF hyr + exact ⟨hyV', hF2 q hq⟩ + · rintro y ⟨hyV, ⟨p, hp, rfl⟩⟩ + have hpV : p.1 ∈ Γ.V := by + rw [hΓ.2] at hyV + exact (mem_capUp_val hιi).mp hyV + rcases hcV p hpV hp with ⟨hF, -⟩ | ⟨G, hG, hpG⟩ + · exact ⟨_, List.mem_cons_self, ⟨hyV, ⟨p, ⟨⟨hF, hpV⟩, p.2⟩, rfl⟩⟩⟩ + · refine ⟨side G, List.mem_cons_of_mem _ (List.mem_map.mpr ⟨G, Finset.mem_toList.mpr hG, + rfl⟩), ?_⟩ + exact ⟨hyV, hpG⟩ + · intro e he heQ + obtain ⟨G, hG, heG⟩ := hcE e he heQ + refine ⟨side G, List.mem_cons_of_mem _ (List.mem_map.mpr ⟨G, Finset.mem_toList.mpr hG, + rfl⟩), ?_⟩ + exact ⟨he, heG⟩ + exact mem_inducedAcross h hΓ hN hΔ (by rw [hfr]; exact hFN) (by rw [hfr]; exact hsmall) + (fun p => mem_capUp_val hιi) (fun p => mem_capUp_val hιi) hq + +/-- The piece of the curve in a gap is a line of `Σ₁` to which (5.4) applies. -/ +theorem exists_piece_of_gap [ConnectedSpace T] (h : IsCappedSplit C P₁ P₂ ι D) + (hΓ : IsCappedDrawing ι Γ Γ₁) (hN : ∀ k, Γ.IsNormal (C k)) + (H : CapSetup (fun k => closure (D k)) Γ₁ θ 𝒯) (hφ : Function.Injective φ) + (hFN : Γ.IsNormal (range φ)) (hsmall : (range φ ∩ Γ.V).ncard < θ) {G : Set Circle} + {a₀ b₀ : 𝕀 → Circle} (hG : IsGap (φ ⁻¹' P₂) G a₀ b₀) : + ∃ R Δ₁ Δ, PieceData C ι Γ Γ₁ 𝒯 (φ '' range a₀) (φ (a₀ 0)) (φ (a₀ 1)) R Δ₁ Δ := by + have harc : IsArcMap (φ ∘ a₀) := + ⟨φ.continuous.comp hG.two.arc_left.1, hφ.comp hG.two.arc_left.2⟩ + have hL : IsLineWithEnds (φ '' range a₀) (φ (a₀ 0)) (φ (a₀ 1)) := by + have := harc.isLineWithEnds + rwa [range_comp] at this + have h01 : (0 : 𝕀) ≠ 1 := zero_ne_one + have hst : φ (a₀ 0) ≠ φ (a₀ 1) := fun he => h01 (hG.two.arc_left.2 (hφ he)) + have hsubF : φ '' range a₀ ⊆ range φ := image_subset_range _ _ + have hmeet : ∀ x ∈ φ '' range a₀, x ∈ P₂ → x = φ (a₀ 0) ∨ x = φ (a₀ 1) := by + rintro _ ⟨_, ⟨r, rfl⟩, rfl⟩ hr + by_cases h0 : r = 0 + · exact .inl (by rw [h0]) + by_cases h1 : r = 1 + · exact .inr (by rw [h1]) + exact (hG.off r h0 h1 hr).elim + have hLP : φ '' range a₀ ⊆ P₁ := by + refine hL.subset_closure_diff.trans (closure_minimal ?_ h.isClosed₁) + rintro x ⟨hx, hn⟩ + refine (show x ∈ P₁ ∪ P₂ from h.union ▸ mem_univ x).resolve_right fun hx₂ => hn ?_ + exact hmeet x hx hx₂ + exact exists_piece h hΓ hN H hL hst (fun x hx => hFN ⟨hsubF hx.1, hx.2⟩) + (lt_of_le_of_lt (ncard_le_ncard (inter_subset_inter_left _ hsubF) + (Γ.finite_V.subset inter_subset_right)) hsmall) hLP hG.zero hG.one hmeet + +/-- The second case of the proof of (5.3): an `O`-arc with at least two points in `Σ₂`. -/ +theorem respect_of_cross [NeZero n] [ConnectedSpace T] (h : IsCappedSplit C P₁ P₂ ι D) + (hΓ : IsCappedDrawing ι Γ Γ₁) (hN : ∀ k, Γ.IsNormal (C k)) (hT : IsTangle Γ₁.toHypergraph θ 𝒯) + (H : CapSetup (fun k => closure (D k)) Γ₁ θ 𝒯) (hiii : CurvesNull Γ P₂ θ) + (hφ : Function.Injective φ) (hFN : Γ.IsNormal (range φ)) (hsmall : (range φ ∩ Γ.V).ncard < θ) + {x₀ y₀ : Circle} (hx₀ : φ x₀ ∈ P₂) (hy₀ : φ y₀ ∈ P₂) (hxy : x₀ ≠ y₀) : + ∃ Δ : Set S, IsClosedDisc Δ ∧ subBd Δ = range φ ∧ + ((PaintingOrDrawing.drawing Γ).inter Δ, (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ + inducedAcross ι Γ Γ₁ θ 𝒯 := by + classical + have hι := h.isEmbedding + have hιi := hι.injective + have hSS := h.surface.1 + have hFc : IsClosed (range φ) := (isCompact_range φ.continuous).isClosed + obtain ⟨β, hβ, hβP, hsurj, hβ0, hopen⟩ := exists_outerCollar h + set A := φ ⁻¹' P₂ with hAdef + have hA : IsClosed A := h.isClosed₂.preimage φ.continuous + -- The fibres over the vertices off `F`. + set W₀ := (Γ.V ∩ ⋃ k, C k) \ range φ with hW₀ + have hW₀f : W₀.Finite := (Γ.finite_V.subset inter_subset_left).subset sdiff_subset + obtain ⟨ε₀, hε₀, hfib₀⟩ := exists_level_fibre hβ.cont hβ.inj hFc hW₀f disjoint_sdiff_left + have hyv : ∀ v, ∃ y, v ∈ W₀ → β (y, 0) = v := by + intro v + by_cases hv : v ∈ W₀ + · obtain ⟨k, hk⟩ := mem_iUnion.mp hv.1.2 + obtain ⟨w, hw⟩ := hsurj k v hk + exact ⟨(k, w), fun _ => hw⟩ + · exact ⟨(0, 1), fun hn => (hv hn).elim⟩ + choose yv hyv using hyv + -- A point of each edge in `Σ₁`. + have hpt : ∀ f, ∃ x, f ∈ Γ.E → x ∈ f := by + intro f + by_cases hf : f ∈ Γ.E + · obtain ⟨x, hx⟩ := hf.1 + exact ⟨x, fun _ => hx⟩ + · exact ⟨φ 1, fun hn => (hf hn).elim⟩ + choose pt hpt using hpt + set Q := ((fun v => β (yv v, ε₀)) '' W₀) ∪ (pt '' {f | f ∈ Γ.E ∧ f ⊆ P₁}) ∪ (Γ.V \ P₂) with hQ + have hfin : {f | f ∈ Γ.E ∧ f ⊆ P₁}.Finite := + Γ.toHypergraph.edgeSet_finite.subset fun _ h => h.1 + have hQf : Q.Finite := + ((hW₀f.image _).union (hfin.image _)).union (Γ.finite_V.subset sdiff_subset) + have hQP : Disjoint Q P₂ := by + refine Set.disjoint_left.mpr ?_ + rintro _ (((⟨v, -, rfl⟩ | ⟨f, ⟨hf, hfP⟩, rfl⟩)) | hx) hx₂ + · exact hβ.pos _ _ hε₀ hx₂ + · rcases edge_side h hN hf with ⟨-, hd⟩ | ⟨-, hd⟩ + · exact Set.disjoint_left.mp hd (hpt f hf) hx₂ + · exact Set.disjoint_left.mp hd (hpt f hf) (hfP (hpt f hf)) + · exact hx.2 hx₂ + obtain ⟨ε, hε, hle, hQε⟩ := exists_level_off hβ hQf hQP hε₀ + -- A compact set of points of the circle off the collar, covered by finitely many gaps. + set W := P₂ ∪ β '' {p | p.2 < ε} with hWdef + have hWo : IsOpen W := hopen ε hε + set K := (φ ⁻¹' W)ᶜ with hKdef + have hKc : IsCompact K := (hWo.preimage φ.continuous).isClosed_compl.isCompact + have hgap : ∀ z, ∃ G, z ∈ K → (∃ a b, IsGap A G a b) ∧ z ∈ G := by + intro z + by_cases hz : z ∈ K + · have hzA : z ∉ A := fun hA' => hz (.inl hA') + obtain ⟨G, a, b, hG, hzG⟩ := exists_gap hA hx₀ hy₀ hxy hzA + exact ⟨G, fun _ => ⟨⟨a, b, hG⟩, hzG⟩⟩ + · exact ⟨∅, fun hn => (hz hn).elim⟩ + choose G' hG' using hgap + obtain ⟨t, htK, hcov⟩ := hKc.elim_nhds_subcover G' fun z hz => by + obtain ⟨⟨a, b, hG⟩, hzG⟩ := hG' z hz + exact hG.isOpen.mem_nhds hzG + set J := t.image G' with hJdef + have hJg : ∀ G ∈ J, ∃ a b, IsGap A G a b := by + intro G hG + obtain ⟨z, hz, rfl⟩ := Finset.mem_image.mp hG + exact (hG' z (htK z hz)).1 + have hdata : ∀ G : Set Circle, ∃ (a b : 𝕀 → Circle) (R : Set S) (Δ₁ : Set T) (Δg : Set S), G ∈ J → + IsGap A G a b ∧ PieceData C ι Γ Γ₁ 𝒯 (φ '' range a) (φ (a 0)) (φ (a 1)) R Δ₁ Δg := by + intro G + by_cases hG : G ∈ J + · obtain ⟨a, b, hg⟩ := hJg G hG + obtain ⟨R, Δ₁, Δg, hd⟩ := exists_piece_of_gap h hΓ hN H hφ hFN hsmall hg + exact ⟨a, b, R, Δ₁, Δg, fun _ => ⟨hg, hd⟩⟩ + · exact ⟨fun _ => 1, fun _ => 1, ∅, ∅, ∅, fun hn => (hG hn).elim⟩ + choose a b R Δ₁ Δg hab using hdata + have hP : Pieces C P₂ ι Γ Γ₁ 𝒯 φ J a b R Δ₁ Δg := + ⟨fun G hG => (hab G hG).1, fun G hG => (hab G hG).2⟩ + have hJ : ∀ x, (∀ G ∈ J, x ∉ G) → φ x ∈ P₂ ∪ β '' {p | p.2 ≤ ε} := by + intro x hx + have hxK : x ∉ K := by + intro hK + obtain ⟨z, hz⟩ := mem_iUnion.mp (hcov hK) + obtain ⟨hzt, hxz⟩ := mem_iUnion.mp hz + exact hx _ (Finset.mem_image_of_mem _ hzt) hxz + have hxW : φ x ∈ W := by + by_contra hn + exact hxK hn + rcases hxW with hx' | ⟨p, hp, he⟩ + · exact .inl hx' + · exact .inr ⟨p, le_of_lt (show p.2 < ε from hp), he⟩ + have hfib : ∀ y s, β (y, 0) ∈ Γ.V → β (y, 0) ∉ range φ → s ≤ ε → β (y, s) ∉ range φ := by + intro y s hv hn hs + exact hfib₀ y s ⟨⟨hv, mem_iUnion.mpr ⟨_, hβ0 y⟩⟩, hn⟩ (hs.trans hle) + obtain ⟨Δ, hΔZ, hΔ, hb⟩ := exists_disc_of_pieces h hN hφ hFN hsmall hiii hβ hβ0 hfib hP hJ + have hfr : frontier Δ = range φ := by rw [IsClosedDisc.frontier_eq_discBd hSS hΔ, hb] + have hcl := hΔ.isClosed + refine ⟨Δ, hΔ, by rw [subBd_eq_frontier, hfr], ?_⟩ + have hoff : ∀ x ∈ Δ, x ∉ P₂ → x ∈ Q → ∃ G ∈ J, x ∈ Δg G := by + intro x hx hx₂ hxQ + rcases hΔZ hx with (hx' | hx') | hx' + · exact (hx₂ hx').elim + · exact (hQε x hxQ hx').elim + · obtain ⟨G, hG, hxG⟩ := mem_iUnion₂.mp hx' + exact ⟨G, hG, hxG⟩ + have hLF : ∀ G ∈ J, ∀ x ∈ frontier (Δ₁ G), x ∈ range ι → x ∈ capUp ι (range φ) + := fun G hG x hx hr => + capUp_mono (image_subset_range _ _) ((hab G hG).2.frontier₁ x hx hr) + have hlift : ∀ G ∈ J, ∀ A' : Set T, IsPreconnected A' → A' ⊆ range ι → + (∀ q : P₁, ι q ∈ A' → q.1 ∉ range φ) → (A' ∩ Δ₁ G).Nonempty → A' ⊆ Δ₁ G := by + intro G hG A' hc hr hmiss hne + refine subset_of_frontier hc (hab G hG).2.disc₁.isClosed hne fun y hy hf => ?_ + obtain ⟨q, hq, rfl⟩ := hLF G hG y hf (hr hy) + exact hmiss q hy hq + refine mem_of_sides h hΓ hN hT hFN hsmall hcl hfr J Δ₁ (fun G hG => (hab G hG).2.mem) hLF ?_ ?_ + · intro p hpV hpΔ + by_cases hp2 : p.1 ∈ P₂ + · by_cases hpF : p.1 ∈ range φ + · exact .inl ⟨hpF, hp2⟩ + · right + have hpm : p.1 ∈ P₁ ∩ P₂ := ⟨p.2, hp2⟩ + rw [h.inter] at hpm + have hpW : p.1 ∈ W₀ := ⟨⟨hpV, hpm⟩, hpF⟩ + have hy0 := hyv _ hpW + set y := yv p.1 with hy + have hmissF : ∀ s ≤ ε₀, β (y, s) ∉ range φ := fun s hs => + hfib₀ y s (hy0.symm ▸ hpW) hs + have hτ : Continuous fun s : 𝕀 => β (y, s) := hβ.cont.comp (Continuous.prodMk_right y) + have hA₁ : (fun s : 𝕀 => β (y, s)) '' Iic ε₀ ⊆ Δ := by + refine subset_of_frontier (isPreconnected_Iic.image _ hτ.continuousOn) hcl + ⟨p.1, ⟨0, show (⊥ : 𝕀) ≤ ε₀ from bot_le, hy0⟩, hpΔ⟩ ?_ + rintro _ ⟨s, hs, rfl⟩ + rw [hfr] + exact hmissF s hs + have hpv : β (y, ε₀) ∈ Δ := hA₁ ⟨ε₀, le_rfl, rfl⟩ + have hpv2 : β (y, ε₀) ∉ P₂ := hβ.pos _ _ hε₀ + have hpvQ : β (y, ε₀) ∈ Q := .inl (.inl ⟨p.1, hpW, rfl⟩) + obtain ⟨G, hG, hpG⟩ := hoff _ hpv hpv2 hpvQ + refine ⟨G, hG, ?_⟩ + have hτ' : Continuous fun s : 𝕀 => ι ⟨β (y, s), hβP _⟩ := + hι.continuous.comp (hτ.subtype_mk _) + refine hlift G hG ((fun s : 𝕀 => ι ⟨β (y, s), hβP _⟩) '' Iic ε₀) + (isPreconnected_Iic.image _ hτ'.continuousOn) + (by rintro _ ⟨s, -, rfl⟩; exact ⟨_, rfl⟩) ?_ ?_ + ⟨0, show (⊥ : 𝕀) ≤ ε₀ from bot_le, ?_⟩ + · rintro q ⟨s, hs, he⟩ + have : q = ⟨β (y, s), hβP _⟩ := (hιi he).symm + rw [this] + exact hmissF s hs + · exact ⟨_, ⟨ε₀, le_rfl, rfl⟩, (hab G hG).2.sub₁ ⟨⟨_, hβP _⟩, hpG, rfl⟩⟩ + · exact congrArg ι (Subtype.ext hy0) + · right + obtain ⟨G, hG, hpG⟩ := hoff p.1 hpΔ hp2 (.inr ⟨hpV, hp2⟩) + exact ⟨G, hG, (hab G hG).2.sub₁ ⟨p, hpG, rfl⟩⟩ + · intro e he heQ + obtain ⟨f, hf, hfP, rfl⟩ := exists_edge_capUp h hΓ hN he + have hfΔ : f ⊆ Δ := fun x hx => (mem_capUp_val hιi).mp (heQ (val_mem_capUp (hfP hx) hx)) + have hptf := hpt f hf + have hpt2 : pt f ∉ P₂ := by + rcases edge_side h hN hf with ⟨-, hd⟩ | ⟨-, hd⟩ + · exact Set.disjoint_left.mp hd hptf + · exact (Set.disjoint_left.mp hd hptf (hfP hptf)).elim + obtain ⟨G, hG, hpG⟩ := hoff _ (hfΔ hptf) hpt2 (.inl (.inr ⟨f, ⟨hf, hfP⟩, rfl⟩)) + refine ⟨G, hG, hlift G hG _ he.2.2.1.isConnected.isPreconnected (capUp_subset_range _) ?_ ?_⟩ + · intro q hq hqF + have hqf := (mem_capUp_val hιi).mp hq + exact (hf.2.1 hqf).2 (hFN ⟨hqF, (hf.2.1 hqf).1⟩) + · exact ⟨_, val_mem_capUp (hfP hptf) hptf, (hab G hG).2.sub₁ ⟨⟨_, hfP hptf⟩, hpG, rfl⟩⟩ + +/-- **Graph Minors XII, (5.4)** (page 255), for a `Γ`-normal line `F` in `Σ₁` with ends `s, t` on +the common boundary `⋃ k, C k` and no other point on it: there is a `Γ`-normal line `R` in +`⋃ k, C k` with the same ends as `F` and at most as many vertices of `Γ`, bounding with `F` a +closed disc `Δ ⊆ Σ₁` whose capped separation lies in `𝒯`. -/ +theorem theorem_5_4_proof [ConnectedSpace T] (h : IsCappedSplit C P₁ P₂ ι D) + (hΓ : IsCappedDrawing ι Γ Γ₁) (hN : ∀ k, Γ.IsNormal (C k)) (hT : IsTangle Γ₁.toHypergraph θ 𝒯) + (hR : (PaintingOrDrawing.drawing Γ₁).IsRespectful θ 𝒯) + (hi : ∀ k l, k ≠ l → ∀ F : Set S, IsLine F → Γ.IsNormal F → F ⊆ P₁ → + (F ∩ C k).Nonempty → (F ∩ C l).Nonempty → θ ≤ (F ∩ Γ.V).ncard) + (hm : ∀ k, θ ≤ (Γ.V ∩ C k).ncard) + (hf : ∀ k, ∀ X ⊆ capUp ι (Γ.V ∩ C k), X.ncard ≤ θ → IsFreeSet Γ₁.toHypergraph 𝒯 θ X) + {F : Set S} {s t : S} (hF : IsLineWithEnds F s t) (hst : s ≠ t) (hFN : Γ.IsNormal F) + (hsmall : (F ∩ Γ.V).ncard < θ) (hFP : F ⊆ P₁) + (hs : s ∈ ⋃ k, C k) (ht : t ∈ ⋃ k, C k) + (hmeet : ∀ x ∈ F, x ∈ ⋃ k, C k → x = s ∨ x = t) : + ∃ R : Set S, ∃ Δ : Set S, ∃ Δ₁ : Set T, + IsLineWithEnds R s t ∧ Γ.IsNormal R ∧ R ⊆ ⋃ k, C k ∧ + (R ∩ Γ.V).ncard ≤ (F ∩ Γ.V).ncard ∧ + IsClosedDisc Δ ∧ Δ ⊆ P₁ ∧ discBd Δ = F ∪ R ∧ + IsClosedDisc Δ₁ ∧ capUp ι Δ ⊆ Δ₁ ∧ + (∀ x ∈ frontier Δ₁, x ∈ range ι → x ∈ capUp ι F) ∧ + ((PaintingOrDrawing.drawing Γ₁).inter Δ₁, + (PaintingOrDrawing.drawing Γ₁).interOutside Δ₁) ∈ 𝒯 := by + have H := capSetup h hΓ hN hT hR hi hm hf + obtain ⟨R, Δ₁, Δ, hd⟩ := exists_piece h hΓ hN H hF hst hFN hsmall hFP + (h.inter ▸ hs).2 (h.inter ▸ ht).2 + (fun x hxF hxP₂ => hmeet x hxF (h.inter ▸ ⟨hFP hxF, hxP₂⟩)) + obtain ⟨k, hk⟩ := hd.on + exact ⟨R, Δ, Δ₁, hd.line, fun x hx => hN k ⟨hk hx.1, hx.2⟩, hk.trans (subset_iUnion C k), + hd.count, hd.disc, hd.sub_P, hd.bd, hd.disc₁, hd.sub₁, hd.frontier₁, hd.mem⟩ + +/-- **Graph Minors XII, (5.3)** (pages 254–255). -/ +theorem theorem_5_3_proof [NeZero n] [ConnectedSpace T] (h : IsCappedSplit C P₁ P₂ ι D) + (hΓ : IsCappedDrawing ι Γ Γ₁) (hN : ∀ k, Γ.IsNormal (C k)) (hT : IsTangle Γ₁.toHypergraph θ 𝒯) + (hR : (PaintingOrDrawing.drawing Γ₁).IsRespectful θ 𝒯) + (hi : ∀ k l, k ≠ l → ∀ F : Set S, IsLine F → Γ.IsNormal F → F ⊆ P₁ → + (F ∩ C k).Nonempty → (F ∩ C l).Nonempty → θ ≤ (F ∩ Γ.V).ncard) + (hm : ∀ k, θ ≤ (Γ.V ∩ C k).ncard) + (hf : ∀ k, ∀ X ⊆ capUp ι (Γ.V ∩ C k), X.ncard ≤ θ → IsFreeSet Γ₁.toHypergraph 𝒯 θ X) + (hiii : CurvesNull Γ P₂ θ) : + (PaintingOrDrawing.drawing Γ).IsRespectful θ (inducedAcross ι Γ Γ₁ θ 𝒯) := by + have H := capSetup h hΓ hN hT hR hi hm hf + refine ⟨h.surface.2, fun F hO hFN hsmall => ?_⟩ + by_cases hs : (F ∩ P₂).Subsingleton + · exact respect_of_inside h hΓ hN H hO hFN hsmall (subset_of_subsingleton h hO hs) + · obtain ⟨u, hu, v, hv, huv⟩ := not_subsingleton_iff.mp hs + obtain ⟨e⟩ := hO + let φ : C(Circle, S) := ⟨fun x => (e x).1, continuous_subtype_val.comp e.continuous⟩ + have hφ : Function.Injective φ := fun x y hxy => e.injective (Subtype.ext hxy) + have hr : range φ = F := by + ext x + constructor + · rintro ⟨w, rfl⟩ + exact (e w).2 + · intro hx + exact ⟨e.symm ⟨x, hx⟩, by simp [φ]⟩ + have hu' : φ (e.symm ⟨u, hu.1⟩) = u := by simp [φ] + have hv' : φ (e.symm ⟨v, hv.1⟩) = v := by simp [φ] + have := respect_of_cross h hΓ hN hT H hiii (φ := φ) hφ + (by rw [hr]; exact hFN) (by rw [hr]; exact hsmall) + (x₀ := e.symm ⟨u, hu.1⟩) (y₀ := e.symm ⟨v, hv.1⟩) (by rw [hu']; exact hu.2) + (by rw [hv']; exact hv.2) (fun he => huv (by rw [← hu', ← hv', he])) + rwa [hr] at this + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section5Side.lean b/LeanPool/GraphMinor/GM12/Section5Side.lean new file mode 100644 index 0000000000..9a39928174 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section5Side.lean @@ -0,0 +1,467 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM11.Theorem61 +import LeanPool.GraphMinor.GM14.WhitneyFaces +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.Surface.DiscUnion +import LeanPool.GraphMinor.Surface.CutLift +import LeanPool.GraphMinor.Surface.Fan + +/-! +# Lines that start and end on a filled-in disc + +We prove the heart of Graph Minors XII, (5.4) (page 255), in the capped surface `Σ̂₁`. The caps are +the closed discs `E k`, the closures of the discs `D_k` of the paper. A short normal line `L` with +ends on the caps must have both ends on the same cap, by condition (i) of (5.3). A chord `P` of this +cap closes `L` up to a short normal `O`-arc. So `P ∪ L` bounds a disc `Δ₁` chosen by the tangle. +This disc includes one half of the cap and misses the other. The part of `Δ₁` outside the cap is the +disc `Δ` of (5.4). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 Hypergraph + +universe u + +variable {T : Type u} [TopologicalSpace T] [T2Space T] + +/-- The conditions of XII (5.3), read in the capped surface. The closed discs `E k` are disjoint, +the +drawing `Γ` meets them only in vertices on their boundaries, condition (i) holds for lines off the +open discs, and condition (ii) holds. -/ +structure CapSetup {n : ℕ} (E : Fin n → Set T) (Γ : Drawing T) (θ : ℕ) + (𝒯 : Set (Hypergraph T (Set T) × Hypergraph T (Set T))) : Prop where + /-- Each cap is a closed disc. -/ + disc : ∀ k, IsClosedDisc (E k) + /-- The caps are disjoint. -/ + disj : ∀ k l, k ≠ l → Disjoint (E k) (E l) + /-- The drawing meets a cap only in vertices on its boundary. -/ + normal : ∀ k, E k ∩ Γ.U ⊆ discBd (E k) ∩ Γ.V + /-- `𝒯` is a tangle of order `θ`. -/ + tangle : IsTangle Γ.toHypergraph θ 𝒯 + /-- `𝒯` is respectful. -/ + respect : (PaintingOrDrawing.drawing Γ).IsRespectful θ 𝒯 + /-- Condition (i) of (5.3). -/ + line : ∀ k l, k ≠ l → ∀ L : Set T, IsLine L → Γ.IsNormal L → (∀ m, Disjoint L (discInt (E m))) → + (L ∩ E k).Nonempty → (L ∩ E l).Nonempty → θ ≤ (L ∩ Γ.V).ncard + /-- The first half of condition (ii) of (5.3). -/ + many : ∀ k, θ ≤ (discBd (E k) ∩ Γ.V).ncard + /-- The second half of condition (ii) of (5.3). -/ + free : ∀ k, ∀ X ⊆ discBd (E k) ∩ Γ.V, X.ncard ≤ θ → IsFreeSet Γ.toHypergraph 𝒯 θ X + +variable {n : ℕ} {E : Fin n → Set T} {Γ : Drawing T} {θ : ℕ} + {𝒯 : Set (Hypergraph T (Set T) × Hypergraph T (Set T))} + +/-- Two points of the boundary of a closed disc are joined by an arc through the interior. -/ +theorem exists_cap_chord {Δ : Set T} (hΔ : IsClosedDisc Δ) {a b : T} (ha : a ∈ discBd Δ) + (hb : b ∈ discBd Δ) (hab : a ≠ b) : + ∃ F, IsLineWithEnds F a b ∧ F ⊆ Δ ∧ F ∩ discBd Δ = {a, b} := + Surface.exists_chord hΔ ha hb hab + +omit [T2Space T] in +/-- The order of the separation of a closed disc in a closed surface is at most the number of +vertices on its boundary. -/ +theorem order_le_of_disc {Δ : Set T} : + separationOrder ((PaintingOrDrawing.drawing Γ).inter Δ) + ((PaintingOrDrawing.drawing Γ).interOutside Δ) ≤ (frontier Δ ∩ Γ.V).ncard := + ncard_le_ncard (fun _ hx => inter_outside_subset hx) (Γ.finite_V.subset inter_subset_right) + +omit [T2Space T] in +/-- A set of vertices that is free, and lies on the small side of a separation, is at most as large +as the order. -/ +theorem card_le_of_free {X Δ : Set T} (hX : IsFreeSet Γ.toHypergraph 𝒯 θ X) + (hmem : ((PaintingOrDrawing.drawing Γ).inter Δ, (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ + 𝒯) + (hXΔ : X ⊆ Δ) (hXV : X ⊆ Γ.V) : X.ncard ≤ (frontier Δ ∩ Γ.V).ncard := + (hX.2.2 hmem fun _ hx => ⟨hXV hx, hXΔ hx⟩).trans order_le_of_disc + +/-- The output of (5.4) in the capped surface. -/ +structure SideData (E : Fin n → Set T) (Γ : Drawing T) + (𝒯 : Set (Hypergraph T (Set T) × Hypergraph T (Set T))) (L : Set T) (a b : T) + (R Δ₁ Δ : Set T) : Prop where + /-- `R` is a line with the same ends as `L`. -/ + line : IsLineWithEnds R a b + /-- It lies on the boundary of one cap. -/ + on_cap : ∃ k, R ⊆ discBd (E k) + /-- `L` and `R` meet just in their ends. -/ + meet : L ∩ R = {a, b} + /-- `R` is as short as `L`. -/ + count : (R ∩ Γ.V).ncard ≤ (L ∩ Γ.V).ncard + /-- `Δ` is a closed disc. -/ + disc : IsClosedDisc Δ + /-- It is bounded by `L ∪ R`. -/ + bd : discBd Δ = L ∪ R + /-- It misses the open caps. -/ + off : ∀ k, Disjoint Δ (discInt (E k)) + /-- `Δ₁` is a closed disc. -/ + disc₁ : IsClosedDisc Δ₁ + /-- It includes `Δ`. -/ + sub : Δ ⊆ Δ₁ + /-- It includes `R`. -/ + sub_R : R ⊆ Δ₁ + /-- Off the open caps, its frontier is in `L`. -/ + frontier₁ : ∀ x ∈ frontier Δ₁, (∀ k, x ∉ discInt (E k)) → x ∈ L + /-- The tangle puts it on the small side. -/ + mem : ((PaintingOrDrawing.drawing Γ).inter Δ₁, (PaintingOrDrawing.drawing Γ).interOutside Δ₁) ∈ 𝒯 + +/-- The step of (5.4) after the side of the chord has been found: `Δ₁` includes the half `E₁` of the +cap and misses the open half `E₂`. -/ +theorem sideData_of_side (H : CapSetup E Γ θ 𝒯) (hS : IsClosedSurface T) + {L P A B E₁ E₂ Δ₁ : Set T} {a b : T} {i : Fin n} + (hL : IsLineWithEnds L a b) (hP : IsLineWithEnds P a b) (hA : IsLineWithEnds A a b) + (hAB : A ∩ B = {a, b}) (hPA : P ∩ A = {a, b}) (hPB : P ∩ B = {a, b}) + (hbdE : discBd (E i) = A ∪ B) (hPE : P ⊆ E i) + (hmeet : ∀ k, L ∩ E k ⊆ {a, b}) + (hsmall : (L ∩ Γ.V).ncard < θ) + (hE₁ : IsClosedDisc E₁) (hE₂ : IsClosedDisc E₂) (hU : E₁ ∪ E₂ = E i) + (hb₁ : discBd E₁ = A ∪ P) (hb₂ : discBd E₂ = B ∪ P) + (hΔ₁ : IsClosedDisc Δ₁) (hfr : frontier Δ₁ = P ∪ L) + (hsub : discInt E₁ ⊆ Δ₁) (hoff : Disjoint (discInt E₂) Δ₁) + (hmem : ((PaintingOrDrawing.drawing Γ).inter Δ₁, + (PaintingOrDrawing.drawing Γ).interOutside Δ₁) ∈ 𝒯) : + ∃ Δ, SideData E Γ 𝒯 L a b A Δ₁ Δ := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hbdΔ₁ : discBd Δ₁ = P ∪ L := by rw [← IsClosedDisc.frontier_eq_discBd hS hΔ₁, hfr] + have hcl : IsClosed Δ₁ := hΔ₁.isClosed + have hE₁Δ : E₁ ⊆ Δ₁ := hE₁.subset_closure_discInt.trans (closure_minimal hsub hcl) + have hab : a ∈ P ∧ b ∈ P := by + have h : ({a, b} : Set T) ⊆ P := hPA ▸ inter_subset_left + exact ⟨h (by simp), h (by simp)⟩ + have hAE₁ : A ⊆ E₁ := fun x hx => GraphMinor.Surface.discBd_subset E₁ (hb₁ ▸ .inl hx) + have hAE : A ⊆ E i := fun x hx => hU ▸ .inl (hAE₁ hx) + have hLA : L ∩ A ⊆ {a, b} := fun x hx => hmeet i ⟨hx.1, hAE hx.2⟩ + have hmeetbd : discBd E₁ ∩ discBd Δ₁ = P := by + rw [hb₁, hbdΔ₁] + ext x + constructor + · rintro ⟨hx | hx, hy | hy⟩ + · exact hy + · rcases hLA ⟨hy, hx⟩ with rfl | rfl + · exact hab.1 + · exact hab.2 + · exact hx + · exact hx + · intro hx + exact ⟨.inr hx, .inl hx⟩ + obtain ⟨hd, hdb, hdE⟩ := disc_difference E₁ Δ₁ P a b hE₁ hΔ₁ hE₁Δ hP hmeetbd + set Δ := closure (Δ₁ \ E₁) with hΔdef + have hΔΔ₁ : Δ ⊆ Δ₁ := closure_minimal sdiff_subset hcl + have hbΔ : discBd Δ = L ∪ A := by + rw [hdb, hb₁, hbdΔ₁] + ext x + constructor + · rintro ⟨(hx | hx) | hx | hx, hn⟩ + · exact .inr hx + · by_cases hend : x = a ∨ x = b + · rcases hend with rfl | rfl + · exact .inr ((hPA.symm ▸ (by simp) : x ∈ P ∩ A)).2 + · exact .inr ((hPA.symm ▸ (by simp) : x ∈ P ∩ A)).2 + · exact absurd ⟨hx, hend⟩ hn + · by_cases hend : x = a ∨ x = b + · rcases hend with rfl | rfl + · exact .inr ((hPA.symm ▸ (by simp) : x ∈ P ∩ A)).2 + · exact .inr ((hPA.symm ▸ (by simp) : x ∈ P ∩ A)).2 + · exact absurd ⟨hx, hend⟩ hn + · exact .inl hx + · rintro (hx | hx) + · refine ⟨.inr (.inr hx), fun hn => hn.2 ?_⟩ + exact hmeet i ⟨hx, hPE hn.1⟩ + · refine ⟨.inl (.inl hx), fun hn => hn.2 ?_⟩ + exact (hPA.symm ▸ (⟨hn.1, hx⟩ : x ∈ P ∩ A) : x ∈ ({a, b} : Set T)) + have hint : ∀ x ∈ discInt (E i), x ∈ discInt E₁ ∨ x ∈ discInt E₂ ∨ x ∈ P := by + intro x hx + have hxE : x ∈ E₁ ∪ E₂ := hU ▸ hx.1 + rcases hxE with hx₁ | hx₂ + · by_cases hb : x ∈ discBd E₁ + · rw [hb₁] at hb + rcases hb with hb | hb + · exact absurd (hbdE ▸ .inl hb) hx.2 + · exact .inr (.inr hb) + · exact .inl ⟨hx₁, hb⟩ + · by_cases hb : x ∈ discBd E₂ + · rw [hb₂] at hb + rcases hb with hb | hb + · exact absurd (hbdE ▸ .inr hb) hx.2 + · exact .inr (.inr hb) + · exact .inr (.inl ⟨hx₂, hb⟩) + have hBfr : ∀ x ∈ B, x ≠ a → x ≠ b → x ∉ Δ₁ := by + intro x hxB hxa hxb hxΔ + have hxE₂ : x ∈ E₂ := GraphMinor.Surface.discBd_subset E₂ (hb₂ ▸ .inl hxB) + have hxE : x ∈ E i := hU ▸ .inr hxE₂ + have hnot : x ∉ discBd Δ₁ := by + rw [hbdΔ₁] + rintro (hx | hx) + · have : x ∈ P ∩ B := ⟨hx, hxB⟩ + rw [hPB] at this + rcases this with rfl | rfl + · exact hxa rfl + · exact hxb rfl + · rcases hmeet i ⟨hx, hxE⟩ with rfl | rfl + · exact hxa rfl + · exact hxb rfl + have hopen := hΔ₁.isOpen_discInt hman + have hcl₂ := hE₂.subset_closure_discInt hxE₂ + obtain ⟨y, hy, hy₂⟩ := mem_closure_iff.mp hcl₂ _ hopen ⟨hxΔ, hnot⟩ + exact Set.disjoint_left.mp hoff hy₂ hy.1 + have hΔE₁ : Δ ∩ E₁ = A := by + rw [hdE, hb₁] + ext x + constructor + · rintro ⟨hx | hx, hn⟩ + · exact hx + · by_cases hend : x = a ∨ x = b + · rcases hend with rfl | rfl + · exact (hPA.symm ▸ (by simp) : x ∈ P ∩ A).2 + · exact (hPA.symm ▸ (by simp) : x ∈ P ∩ A).2 + · exact absurd ⟨hx, hend⟩ hn + · intro hx + refine ⟨.inl hx, fun hn => hn.2 ?_⟩ + exact (hPA.symm ▸ (⟨hn.1, hx⟩ : x ∈ P ∩ A) : x ∈ ({a, b} : Set T)) + have hPK : ∀ x ∈ P, x ∈ discBd (E i) → x = a ∨ x = b := by + intro x hx hxK + rw [hbdE] at hxK + rcases hxK with h | h + · have : x ∈ P ∩ A := ⟨hx, h⟩ + rw [hPA] at this + exact this + · have : x ∈ P ∩ B := ⟨hx, h⟩ + rw [hPB] at this + exact this + have hfrV : frontier Δ₁ ∩ Γ.V = L ∩ Γ.V := by + rw [hfr] + ext x + constructor + · rintro ⟨hx | hx, hV⟩ + · have hxK : x ∈ discBd (E i) := (H.normal i ⟨hPE hx, Γ.V_subset_U hV⟩).1 + rcases hPK x hx hxK with rfl | rfl + · exact ⟨hL.left_mem, hV⟩ + · exact ⟨hL.right_mem, hV⟩ + · exact ⟨hx, hV⟩ + · exact fun hx => ⟨.inr hx.1, hx.2⟩ + have hbound : ∀ X : Set T, X ⊆ Γ.V → X ⊆ Δ₁ → IsFreeSet Γ.toHypergraph 𝒯 θ X → + X.ncard ≤ (L ∩ Γ.V).ncard := fun X hXV hXΔ hf => by + have := card_le_of_free hf hmem hXΔ hXV + rwa [hfrV] at this + have hVfin : ∀ Y : Set T, (Y ∩ Γ.V).Finite := fun Y => Γ.finite_V.subset inter_subset_right + have hcount : (A ∩ Γ.V).ncard ≤ (L ∩ Γ.V).ncard := by + by_contra hlt + push Not at hlt + obtain ⟨X, hXA, hXc⟩ := exists_subset_card_eq (s := A ∩ Γ.V) hlt + have hXK : X ⊆ discBd (E i) ∩ Γ.V := fun x hx => ⟨hbdE ▸ .inl (hXA hx).1, (hXA hx).2⟩ + have hf := H.free i X hXK (by omega) + have := hbound X (fun x hx => (hXA hx).2) (fun x hx => hE₁Δ (hAE₁ (hXA hx).1)) hf + omega + have hother : ∀ k, k ≠ i → Disjoint Δ₁ (discInt (E k)) := by + intro k hk + have hdj : Disjoint (discInt (E k)) (discBd Δ₁) := by + rw [hbdΔ₁] + refine Set.disjoint_left.mpr fun x hx hx' => ?_ + have hxk : x ∈ E k := hx.1 + rcases hx' with h | h + · exact Set.disjoint_left.mp (H.disj i k hk.symm) (hPE h) hxk + · rcases hmeet k ⟨h, hxk⟩ with rfl | rfl + · exact Set.disjoint_left.mp (H.disj i k hk.symm) (hPE hab.1) hxk + · exact Set.disjoint_left.mp (H.disj i k hk.symm) (hPE hab.2) hxk + rcases hΔ₁.side hman (H.disc k).isPreconnected_discInt hdj with h | h + · exfalso + have hEk : E k ⊆ Δ₁ := + (H.disc k).subset_closure_discInt.trans (closure_minimal (h.trans (discInt_subset _)) hcl) + obtain ⟨X, hXK, hXc⟩ := exists_subset_card_eq (s := discBd (E k) ∩ Γ.V) (H.many k) + have hf := H.free k X hXK hXc.le + have := hbound X (fun x hx => (hXK hx).2) + (fun x hx => hEk (GraphMinor.Surface.discBd_subset _ (hXK hx).1)) hf + omega + · exact h.symm + refine ⟨Δ, ⟨hA, ⟨i, fun x hx => hbdE ▸ .inl hx⟩, ?_, hcount, hd, hbΔ, ?_, hΔ₁, hΔΔ₁, + fun x hx => hE₁Δ (hAE₁ hx), ?_, hmem⟩⟩ + · apply Subset.antisymm hLA + rintro x (rfl | rfl) + · exact ⟨hL.left_mem, hA.left_mem⟩ + · exact ⟨hL.right_mem, hA.right_mem⟩ + · intro k + by_cases hk : k = i + · subst hk + refine Set.disjoint_left.mpr fun x hxΔ hx => ?_ + rcases hint x hx with h | h | h + · have : x ∈ Δ ∩ E₁ := ⟨hxΔ, h.1⟩ + rw [hΔE₁] at this + exact hx.2 (hbdE ▸ .inl this) + · exact Set.disjoint_left.mp hoff h (hΔΔ₁ hxΔ) + · have : x ∈ Δ ∩ E₁ := ⟨hxΔ, GraphMinor.Surface.discBd_subset _ (hb₁ ▸ .inr h)⟩ + rw [hΔE₁] at this + exact hx.2 (hbdE ▸ .inl this) + · exact (hother k hk).mono_left hΔΔ₁ + · intro x hx hk + rw [hfr] at hx + rcases hx with h | h + · by_cases hKx : x ∈ discBd (E i) + · rcases hPK x h hKx with rfl | rfl + · exact hL.left_mem + · exact hL.right_mem + · exact absurd ⟨hPE h, hKx⟩ (hk i) + · exact h + +/-- **The heart of Graph Minors XII, (5.4)** (page 255), in the capped surface: a short normal line +`L` with ends on the caps and no other point on them has a partner `R` on the boundary of a cap, and +`L ∪ R` bounds a closed disc off the open caps. -/ +theorem exists_sideData (H : CapSetup E Γ θ 𝒯) (hS : IsClosedSurface T) + {L : Set T} {a b : T} {i j : Fin n} (hL : IsLineWithEnds L a b) (hab : a ≠ b) + (hN : Γ.IsNormal L) (hsmall : (L ∩ Γ.V).ncard < θ) + (ha : a ∈ discBd (E i)) (hb : b ∈ discBd (E j)) (hmeet : ∀ k, L ∩ E k ⊆ {a, b}) : + ∃ R Δ₁ Δ, SideData E Γ 𝒯 L a b R Δ₁ Δ := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hE_sub : ∀ {k x}, x ∈ discBd (E k) → x ∈ E k := fun hx => GraphMinor.Surface.discBd_subset _ + hx + -- Both ends lie on one cap, by condition (i). + have hij : i = j := by + by_contra h + have hoff : ∀ m, Disjoint L (discInt (E m)) := fun m => Set.disjoint_left.mpr fun x hx hx' => by + rcases hmeet m ⟨hx, hx'.1⟩ with rfl | rfl + · have hm : m = i := by + by_contra hne + exact Set.disjoint_left.mp (H.disj m i hne) hx'.1 (hE_sub ha) + subst hm + exact hx'.2 ha + · have hm : m = j := by + by_contra hne + exact Set.disjoint_left.mp (H.disj m j hne) hx'.1 (hE_sub hb) + subst hm + exact hx'.2 hb + have := H.line i j h L (let ⟨f, _⟩ := hL; ⟨f⟩) hN hoff ⟨a, hL.left_mem, hE_sub ha⟩ + ⟨b, hL.right_mem, hE_sub hb⟩ + omega + subst hij + have hdisc := H.disc i + obtain ⟨P, hPl, hPE, hPK⟩ := exists_cap_chord hdisc ha hb hab + obtain ⟨A, B, hA, hB, hAB, hAiB⟩ := hdisc.isOArc_discBd.lines ha hb hab + have hsubK : ∀ {Q : Set T}, Q ⊆ discBd (E i) → ({a, b} : Set T) ⊆ Q → P ∩ Q = {a, b} := by + intro Q hQ hend + apply Subset.antisymm + · exact fun x hx => hPK ▸ ⟨hx.1, hQ hx.2⟩ + · exact subset_inter (hPK ▸ inter_subset_left) hend + have hends : ∀ {Q : Set T}, IsLineWithEnds Q a b → ({a, b} : Set T) ⊆ Q := by + intro Q hQ x hx + rcases hx with rfl | rfl + · exact hQ.left_mem + · exact hQ.right_mem + have hPA := hsubK (hAB ▸ subset_union_left) (hends hA) + have hPB := hsubK (hAB ▸ subset_union_right) (hends hB) + obtain ⟨E₁, E₂, hE₁, hE₂, hU, hI, hb₁, hb₂⟩ := + GM14.Whitney.disc_split hdisc hPl hA hB hAiB hPA hPB hAB.symm hPE hab + have hPL : P ∩ L = {a, b} := by + apply Subset.antisymm + · exact fun x hx => hmeet i ⟨hx.2, hPE hx.1⟩ + · exact subset_inter (hends hPl) (hends hL) + have hO : IsOArc (P ∪ L) := oArc_of_lines hPl hL hPL + have hPint : ∀ x ∈ P, x ∈ Γ.U → x ∈ L ∧ x ∈ Γ.V := by + intro x hx hxU + have h := H.normal i ⟨hPE hx, hxU⟩ + have : x ∈ P ∩ discBd (E i) := ⟨hx, h.1⟩ + rw [hPK] at this + rcases this with rfl | rfl + · exact ⟨hL.left_mem, h.2⟩ + · exact ⟨hL.right_mem, h.2⟩ + have hNF : (PaintingOrDrawing.drawing Γ).IsNormal (P ∪ L) := by + rintro x ⟨hx | hx, hxU⟩ + · exact (hPint x hx hxU).2 + · exact hN ⟨hx, hxU⟩ + have hFV : (P ∪ L) ∩ Γ.V = L ∩ Γ.V := by + ext x + constructor + · rintro ⟨hx | hx, hV⟩ + · exact ⟨(hPint x hx (Γ.V_subset_U hV)).1, hV⟩ + · exact ⟨hx, hV⟩ + · exact fun hx => ⟨.inr hx.1, hx.2⟩ + obtain ⟨Δ₁, hΔ₁, hbd₁, hmem⟩ := H.respect.2 (P ∪ L) hO hNF (by + change ((P ∪ L) ∩ Γ.V).ncard < θ + rwa [hFV]) + have hfr : frontier Δ₁ = P ∪ L := by rw [← subBd_eq_frontier, hbd₁] + have hbdΔ₁ : discBd Δ₁ = P ∪ L := by rw [← IsClosedDisc.frontier_eq_discBd hS hΔ₁, hfr] + obtain ⟨m, hmP, hmn⟩ := GM14.Whitney.line_interior_nonempty hPl + have hmK : m ∉ discBd (E i) := fun h => hmn (hPK ▸ ⟨hmP, h⟩) + have hEP : ∀ {Q}, Q ⊆ E i → discBd Q ⊆ A ∪ B ∪ P → P ⊆ discBd Q → Disjoint (discInt Q) + (discBd Δ₁) := by + intro Q hQE _ hPQ + rw [hbdΔ₁] + refine Set.disjoint_left.mpr fun x hx hx' => ?_ + rcases hx' with h | h + · exact hx.2 (hPQ h) + · have : x ∈ ({a, b} : Set T) := hmeet i ⟨h, hQE hx.1⟩ + rcases this with rfl | rfl + · exact hx.2 (hPQ hPl.left_mem) + · exact hx.2 (hPQ hPl.right_mem) + have hsubE₁ : E₁ ⊆ E i := hU ▸ subset_union_left + have hsubE₂ : E₂ ⊆ E i := hU ▸ subset_union_right + have hb₁' : discBd E₁ ⊆ A ∪ B ∪ P := hb₁ ▸ union_subset_union_left _ subset_union_left + have hb₂' : discBd E₂ ⊆ A ∪ B ∪ P := hb₂ ▸ union_subset_union_left _ subset_union_right + have hd₁ := hEP hsubE₁ hb₁' (hb₁ ▸ subset_union_right) + have hd₂ := hEP hsubE₂ hb₂' (hb₂ ▸ subset_union_right) + -- `Δ₁` includes exactly one of the two open halves of the cap. + have hW : IsOpen (discInt (E i)) := hdisc.isOpen_discInt hman + have hmW : m ∈ discInt (E i) := ⟨hPE hmP, hmK⟩ + have hint : ∀ x ∈ discInt (E i), x ∈ discInt E₁ ∨ x ∈ discInt E₂ ∨ x ∈ P := by + intro x hx + have hxE : x ∈ E₁ ∪ E₂ := hU ▸ hx.1 + rcases hxE with hx₁ | hx₂ + · by_cases hb : x ∈ discBd E₁ + · rw [hb₁] at hb + rcases hb with hb | hb + · exact absurd (hAB ▸ .inl hb) hx.2 + · exact .inr (.inr hb) + · exact .inl ⟨hx₁, hb⟩ + · by_cases hb : x ∈ discBd E₂ + · rw [hb₂] at hb + rcases hb with hb | hb + · exact absurd (hAB ▸ .inr hb) hx.2 + · exact .inr (.inr hb) + · exact .inr (.inl ⟨hx₂, hb⟩) + have hmfr : m ∈ frontier Δ₁ := hfr ▸ .inl hmP + have hsub_of : discInt E₁ ⊆ Δ₁ → discInt E₂ ⊆ Δ₁ → False := by + intro h₁ h₂ + have hWΔ : discInt (E i) ⊆ Δ₁ := fun x hx => by + rcases hint x hx with h | h | h + · exact h₁ h + · exact h₂ h + · exact frontier_subset_closure.trans_eq hΔ₁.isClosed.closure_eq (hfr ▸ .inl h) + exact hmfr.2 (interior_maximal hWΔ hW hmW) + have hoff_of : Disjoint (discInt E₁) Δ₁ → Disjoint (discInt E₂) Δ₁ → False := by + intro h₁ h₂ + have hcl := IsClosedDisc.subset_closure_diff_frontier hS hΔ₁ + (frontier_subset_closure.trans_eq hΔ₁.isClosed.closure_eq hmfr) + obtain ⟨x, hxW, hxΔ, hxf⟩ := mem_closure_iff.mp hcl _ hW hmW + rcases hint x hxW with h | h | h + · exact Set.disjoint_left.mp h₁ h hxΔ + · exact Set.disjoint_left.mp h₂ h hxΔ + · exact hxf (hfr ▸ .inl h) + have hPA' : P ∩ A = {a, b} := hPA + rcases hΔ₁.side hman hE₁.isPreconnected_discInt hd₁ with h₁ | h₁ <;> + rcases hΔ₁.side hman hE₂.isPreconnected_discInt hd₂ with h₂ | h₂ + · exact (hsub_of (h₁.trans (discInt_subset _)) (h₂.trans (discInt_subset _))).elim + · obtain ⟨Δ, hΔ⟩ := sideData_of_side H hS hL hPl hA hAiB hPA hPB hAB.symm hPE hmeet hsmall hE₁ + hE₂ hU hb₁ hb₂ + hΔ₁ hfr (h₁.trans (discInt_subset _)) h₂ hmem + exact ⟨A, Δ₁, Δ, hΔ⟩ + · have hAiB' : B ∩ A = {a, b} := by rw [Set.inter_comm]; exact hAiB + have hU' : E₂ ∪ E₁ = E i := by + rw [Set.union_comm]; exact hU + obtain ⟨Δ, hΔ⟩ := sideData_of_side H hS hL hPl hB hAiB' hPB hPA + (hAB.symm.trans (Set.union_comm _ _)) hPE hmeet hsmall hE₂ hE₁ hU' hb₂ hb₁ hΔ₁ hfr + (h₂.trans (discInt_subset _)) h₁ hmem + exact ⟨B, Δ₁, Δ, hΔ⟩ + · exact (hoff_of h₁ h₂).elim + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section5Tangle.lean b/LeanPool/GraphMinor/GM12/Section5Tangle.lean new file mode 100644 index 0000000000..1b0d53beef --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section5Tangle.lean @@ -0,0 +1,219 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section5Replace +public import LeanPool.GraphMinor.GM11.Section6Pretangle +public import LeanPool.GraphMinor.GM11.Theorem66 +import LeanPool.GraphMinor.GM14.DiscSlope + +/-! +# The tangle step of Graph Minors XII, (5.3) + +The proof of (5.3) compares separations of `Γ` with separations of `Γ₁`. Here we show that two +closed +sets that cover `U(Γ₁)` and meet only in vertices give a separation (`isSeparation_cover`), we read +membership in the induced tangle from such a pair (`mem_inducedAcross`), and we use [5, Theorem +(6.2)] +in the form the proof wants (`mem_of_cover`). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 Hypergraph + +universe u + +variable {S T : Type u} [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [T2Space T] + {n : ℕ} {C : Fin n → Set S} {P₁ P₂ : Set S} {ι : P₁ → T} {D : Fin n → Set T} + {Γ : Drawing S} {Γ₁ : Drawing T} {θ : ℕ} + {𝒯 : Set (Hypergraph T (Set T) × Hypergraph T (Set T))} + +omit [T2Space T] in +/-- Two closed sets that cover the drawing and meet in it only in vertices give a separation. -/ +theorem isSeparation_cover {Γ : PaintingOrDrawing T} {Q₁ Q₂ : Set T} (h₁ : IsClosed Q₁) + (h₂ : IsClosed Q₂) (hV : Γ.V ⊆ Q₁ ∪ Q₂) (hE : ∀ e ∈ Γ.E, e ⊆ Q₁ ∪ Q₂) + (hn : ∀ e ∈ Γ.E, ∀ x ∈ e, x ∈ Q₁ → x ∈ Q₂ → False) : + Γ.toHypergraph.IsSeparation (Γ.inter Q₁) (Γ.inter Q₂) := by + have hedge : ∀ e ∈ Γ.E, e ⊆ Q₁ ∨ e ⊆ Q₂ := fun e he => by + by_cases he₁ : e ⊆ Q₁ + · exact .inl he₁ + · right + by_contra he₂ + obtain ⟨x, hx, hx₁⟩ := not_subset.mp he₁ + obtain ⟨y, hy, hy₂⟩ := not_subset.mp he₂ + have hx₂ := (hE e he hx).resolve_left hx₁ + have hy₁ := (hE e he hy).resolve_right hy₂ + obtain ⟨z, hz, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp (Γ.edge_props he).1 Q₁ Q₂ h₁ h₂ + (hE e he) + ⟨y, hy, hy₁⟩ ⟨x, hx, hx₂⟩ + exact hn e he z hz hz₁ hz₂ + refine ⟨inter_le h₁, inter_le h₂, ?_, ?_⟩ + · apply Hypergraph.ext + · change (Γ.V ∩ Q₁) ∪ (Γ.V ∩ Q₂) = Γ.toHypergraph.vertexSet + rw [Γ.toHypergraph_vertexSet] + ext x + constructor + · rintro (h | h) <;> exact h.1 + · intro h + exact (hV h).imp (fun h' => ⟨h, h'⟩) fun h' => ⟨h, h'⟩ + · change {e | e ∈ Γ.E ∧ e ⊆ Q₁} ∪ {e | e ∈ Γ.E ∧ e ⊆ Q₂} = Γ.toHypergraph.edgeSet + rw [Γ.toHypergraph_edgeSet] + ext e + constructor + · rintro (h | h) <;> exact h.1 + · intro h + exact (hedge e h).imp (fun h' => ⟨h, h'⟩) fun h' => ⟨h, h'⟩ + · funext e v + apply propext + change (Γ.toHypergraph.Inc e v ∧ e ⊆ Q₁ ∧ v ∈ Q₁) ∨ + (Γ.toHypergraph.Inc e v ∧ e ⊆ Q₂ ∧ v ∈ Q₂) ↔ Γ.toHypergraph.Inc e v + constructor + · rintro (h | h) <;> exact h.1 + · intro h + have hi := PaintingOrDrawing.toHypergraph_inc.mp h + rcases hedge e hi.1 with h' | h' + · exact Or.inl ⟨h, h', h₁.closure_subset_iff.mpr h' hi.2.2⟩ + · exact Or.inr ⟨h, h', h₂.closure_subset_iff.mpr h' hi.2.2⟩ + · refine eq_empty_of_forall_notMem fun e he => ?_ + obtain ⟨⟨he₁, h₁'⟩, ⟨-, h₂'⟩⟩ := he + obtain ⟨y, hy⟩ := (Γ.edge_props he₁).2.2.2 + exact hn e he₁ y hy (h₁' hy) (h₂' hy) + +/-- An edge of `Γ₁` lies in a set of `Σ̂₁` just when the edge of `Γ` it comes from lies in the +matching +set of `Σ`. -/ +theorem edge_subset_iff (h : IsCappedSplit C P₁ P₂ ι D) (hΓ : IsCappedDrawing ι Γ Γ₁) + (hN : ∀ k, Γ.IsNormal (C k)) {Q : Set T} {X : Set S} (hQ : ∀ p : P₁, ι p ∈ Q ↔ p.1 ∈ X) + {e : Set T} (he : e ∈ Γ₁.E) : e ⊆ Q ↔ ∃ f, (f ∈ Γ.E ∧ f ⊆ X) ∧ e = capUp ι f := by + constructor + · intro heQ + obtain ⟨f, hf, hP, rfl⟩ := exists_edge_capUp h hΓ hN he + refine ⟨f, ⟨hf, fun x hx => ?_⟩, rfl⟩ + exact (hQ ⟨x, hP hx⟩).mp (heQ (val_mem_capUp (hP hx) hx)) + · rintro ⟨f, ⟨-, hf⟩, rfl⟩ _ ⟨p, hp, rfl⟩ + exact (hQ p).mpr (hf hp) + +omit [T2Space S] [T2Space T] in +theorem vertex_iff (hΓ : IsCappedDrawing ι Γ Γ₁) {Q : Set T} {X : Set S} + (hQ : ∀ p : P₁, ι p ∈ Q ↔ p.1 ∈ X) : Γ₁.V ∩ Q = capUp ι (Γ.V ∩ X) := by + rw [hΓ.2] + ext y + constructor + · rintro ⟨⟨p, hp, rfl⟩, hq⟩ + exact ⟨p, ⟨hp, (hQ p).mp hq⟩, rfl⟩ + · rintro ⟨p, ⟨hp, hx⟩, rfl⟩ + exact ⟨⟨p, hp, rfl⟩, (hQ p).mpr hx⟩ + +/-- Membership in the induced tangle. -/ +theorem mem_inducedAcross (h : IsCappedSplit C P₁ P₂ ι D) (hΓ : IsCappedDrawing ι Γ Γ₁) + (hN : ∀ k, Γ.IsNormal (C k)) {Δ : Set S} (hΔ : IsClosed Δ) (hn : frontier Δ ∩ Γ.U ⊆ Γ.V) + (hord : (frontier Δ ∩ Γ.V).ncard < θ) {Q₁ Q₂ : Set T} (h₁ : ∀ p : P₁, ι p ∈ Q₁ ↔ p.1 ∈ Δ) + (h₂ : ∀ p : P₁, ι p ∈ Q₂ ↔ p.1 ∈ closure (univ \ Δ)) + (hq : ((PaintingOrDrawing.drawing Γ₁).inter Q₁, (PaintingOrDrawing.drawing Γ₁).inter Q₂) ∈ 𝒯) : + ((PaintingOrDrawing.drawing Γ).inter Δ, (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ + inducedAcross ι Γ Γ₁ θ 𝒯 := by + refine ⟨isSeparation_inter (Γ := PaintingOrDrawing.drawing Γ) hΔ hn, ?_, _, hq, ?_, ?_, ?_, ?_⟩ + · exact lt_of_le_of_lt (ncard_le_ncard (fun _ hx => inter_outside_subset hx) + (Γ.finite_V.subset inter_subset_right)) hord + · exact vertex_iff hΓ h₁ + · exact vertex_iff hΓ h₂ + · intro e he + exact (and_iff_right he).trans (edge_subset_iff h hΓ hN h₁ he) + · intro e he + exact (and_iff_right he).trans (edge_subset_iff h hΓ hN h₂ he) + +omit [T2Space T] in +/-- A separation whose small sides, taken from `𝒯`, cover one of its sides is in `𝒯`. This is the +use +of [5, Theorem (6.2)] in the proof of (5.3). -/ +theorem mem_of_cover (hT : IsTangle Γ₁.toHypergraph θ 𝒯) {Q₁ Q₂ : Set T} (h₁ : IsClosed Q₁) + (h₂ : IsClosed Q₂) (hV : Γ₁.V ⊆ Q₁ ∪ Q₂) (hE : ∀ e ∈ Γ₁.E, e ⊆ Q₁ ∪ Q₂) + (hn : ∀ e ∈ Γ₁.E, ∀ x ∈ e, x ∈ Q₁ → x ∈ Q₂ → False) + (hord : (Γ₁.V ∩ (Q₁ ∩ Q₂)).ncard < θ) + (L : List (Hypergraph T (Set T) × Hypergraph T (Set T))) (hL : ∀ p ∈ L, p ∈ 𝒯) + (hLW : ∀ p ∈ L, (p.1 ∩ p.2).vertexSet ⊆ Γ₁.V ∩ (Q₁ ∩ Q₂)) + (hcV : ∀ v ∈ Γ₁.V ∩ Q₁, ∃ p ∈ L, v ∈ p.1.vertexSet) + (hcE : ∀ e ∈ Γ₁.E, e ⊆ Q₁ → ∃ p ∈ L, e ∈ p.1.edgeSet) : + ((PaintingOrDrawing.drawing Γ₁).inter Q₁, (PaintingOrDrawing.drawing Γ₁).inter Q₂) ∈ 𝒯 := by + have hsep := isSeparation_cover (Γ := PaintingOrDrawing.drawing Γ₁) h₁ h₂ hV hE hn + have hinter : ((PaintingOrDrawing.drawing Γ₁).inter Q₂ ∩ (PaintingOrDrawing.drawing Γ₁).inter + Q₁).vertexSet = + Γ₁.V ∩ (Q₁ ∩ Q₂) := by + ext x + constructor + · rintro ⟨⟨hx, h2⟩, -, h1⟩ + exact ⟨hx, h1, h2⟩ + · rintro ⟨hx, h1, h2⟩ + exact ⟨⟨hx, h2⟩, hx, h1⟩ + have hinter' : ((PaintingOrDrawing.drawing Γ₁).inter Q₁ ∩ (PaintingOrDrawing.drawing Γ₁).inter + Q₂).vertexSet = + Γ₁.V ∩ (Q₁ ∩ Q₂) := by + ext x + constructor + · rintro ⟨⟨hx, h1⟩, -, h2⟩ + exact ⟨hx, h1, h2⟩ + · rintro ⟨hx, h1, h2⟩ + exact ⟨⟨hx, h1⟩, hx, h2⟩ + have hord' : separationOrder ((PaintingOrDrawing.drawing Γ₁).inter Q₁) + ((PaintingOrDrawing.drawing Γ₁).inter Q₂) < θ := by + unfold separationOrder + rwa [hinter'] + rcases hT.axiom1 hsep hord' with h | h + · exact h + · exfalso + exact theorem_6_2_proof (IsTangle.isPretangle hT) h L hL + (fun p hp => (hLW p hp).trans_eq hinter.symm) hcV (fun e he => hcE e he.1 he.2) + +/-- The first side `(A₀, B₀)` of the proof of (5.3): a set of few vertices. -/ +theorem mem_vertices (hT : IsTangle Γ₁.toHypergraph θ 𝒯) {Q : Set T} (hQ : Q ⊆ Γ₁.V) + (hc : Q.ncard < θ) : + ((PaintingOrDrawing.drawing Γ₁).inter Q, (PaintingOrDrawing.drawing Γ₁).inter univ) ∈ 𝒯 := by + have hfin : Q.Finite := Γ₁.finite_V.subset hQ + have hsep := isSeparation_cover (Γ := PaintingOrDrawing.drawing Γ₁) hfin.isClosed isClosed_univ + (fun _ _ => .inr trivial) (fun _ _ _ _ => .inr trivial) + (fun e he x hx hQx _ => Set.disjoint_left.mp ((PaintingOrDrawing.drawing Γ₁).edge_props he).2.1 + hx (hQ hQx)) + have hord : separationOrder ((PaintingOrDrawing.drawing Γ₁).inter Q) + ((PaintingOrDrawing.drawing Γ₁).inter univ) < θ := by + refine lt_of_le_of_lt (ncard_le_ncard ?_ hfin) hc + rintro x ⟨⟨-, hx⟩, -⟩ + exact hx + rcases hT.axiom1 hsep hord with h | h + · exact h + · exfalso + apply hT.axiom3 h + change Γ₁.V ∩ univ = Γ₁.toHypergraph.vertexSet + rw [inter_univ] + rfl + +/-- A closed disc whose boundary misses an open cap, and which is small for the tangle, misses it. +-/ +theorem off_cap {E : Fin n → Set T} (H : CapSetup E Γ₁ θ 𝒯) (hS : IsClosedSurface T) + {Δ₁ : Set T} (hΔ₁ : IsClosedDisc Δ₁) + (hmem : ((PaintingOrDrawing.drawing Γ₁).inter Δ₁, (PaintingOrDrawing.drawing Γ₁).interOutside + Δ₁) ∈ 𝒯) + (hsmall : (frontier Δ₁ ∩ Γ₁.V).ncard < θ) (k : Fin n) + (hdj : Disjoint (discInt (E k)) (discBd Δ₁)) : Disjoint Δ₁ (discInt (E k)) := by + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + rcases hΔ₁.side hman (H.disc k).isPreconnected_discInt hdj with h | h + · exfalso + have hEk : E k ⊆ Δ₁ := (H.disc k).subset_closure_discInt.trans + (closure_minimal (h.trans (discInt_subset _)) hΔ₁.isClosed) + obtain ⟨X, hXK, hXc⟩ := exists_subset_card_eq (s := discBd (E k) ∩ Γ₁.V) (H.many k) + have hf := H.free k X hXK hXc.le + have := card_le_of_free hf hmem (fun x hx => hEk (GraphMinor.Surface.discBd_subset _ + (hXK hx).1)) + (fun x hx => (hXK hx).2) + omega + · exact h.symm + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section6.lean b/LeanPool/GraphMinor/GM12/Section6.lean new file mode 100644 index 0000000000..6492ae4569 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section6.lean @@ -0,0 +1,357 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section6Chain +public import LeanPool.GraphMinor.GM12.MetricRadial +public import LeanPool.GraphMinor.GM15.Cited +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM10.Section6 + +/-! +# Graph Minors XII, Section 6: (6.1) + +We follow the proof in the paper (page 258). + +* The paper chooses a radial drawing `K` with a hub in each disc `D_m` and spokes in `D_m` to the + vertices of the paths beside it. This is `exists_special_radial`. The metric `d` is defined from + some + radial drawing, and the paper does not say why it may be computed in this `K`. We prove that it + may + (`HasTangleMetric.of_radial`). +* Claim (1) is `Setup61.ins_eq_of_disc`. +* `W` is the trace of `F`, which we write out (`exists_W`). For each path `P_i` it contains the + circuit + `Q_i` of the four spokes at the ends of `P_i`, and `ins(Q_i) ⊇ U(P_i)` by claim (1) and + `exists_Q_disc`. So `ins(W)` contains `F ∩ V(Γ)` and the edges `e_1` and `e_{θ/2}`. By claim (1) + again, `ins(W) ⊆ Δ`. +* Claim (2) is `claim_two`. +* The paper says that there is no closed walk `W*` of `K` of length `< 2θ` in `Δ` with `e_1` and + `e_{θ/2}` in `ins(W*)`. We prove this with the levels of `lev61` (`exists_low`, `exists_high`, + `two_points`). +* The end goes through [5, (8.13)] (`gm12_theorem_8_13`). +-/ + + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- An atom of `K` that corresponds to an edge of `Γ` is a region of `K` around it. -/ +theorem atom_of_edge {Γ K : Drawing S} {e x : Set S} (he : e ∈ Γ.E) + (hx : IsCorrespondingAtom Γ K e x) : e ⊆ x := by + obtain ⟨-, -, ⟨v, hv, rfl, -⟩ | ⟨-, -, h⟩ | ⟨h, -⟩⟩ := hx + · exact (edge_notMem_V he (show v ∈ ({v} : Set S) from rfl) hv).elim + · exact h + · obtain ⟨y, hy⟩ := he.1 + exact (region_subset h hy (Γ.closure_subset_U he (subset_closure hy))).elim + +private theorem hub_walk_lies_in_closed_disc + {S : Type u} + [TopologicalSpace S] + [T2Space S] + (Γ : Drawing S) + (F : Set S) + (Δ : Set S) + (k : ℕ) + (a : Fin k → S) + (b : Fin k → S) + (P : Fin k → Drawing S) + (h : Setup61 Γ F Δ k a b P) + (X : Fin k → Set S) + (Y : Fin k → Set S) + (A : Fin k → Set S) + (B : Fin k → Set S) + (E : Fin (k + 1) → Set S) + (r : Fin (k + 1) → Set S) + (hp : Pieces61 Γ F Δ a b P X Y A B E r) + (K : Drawing S) + (c : Fin (k + 1) → S) + (L : Fin (k + 1) → S → Set S) + (hcE : ∀ (m : Fin (k + 1)), c m ∈ discInt (E m)) + (hL : ∀ (m : Fin (k + 1)), ∀ x ∈ sideVerts P m, IsLineWithEnds (L m x) (c m) x ∧ L m x ⊆ E m ∧ + L m x ∩ discBd (E m) = {x} ∧ ∀ y ∈ sideVerts P m, x ≠ y → L m x ∩ L m y = {c m}) + (W : GraphWalk K.toGraph (c 0) (c 0)) + (hWE : ∀ (e : Set S), e ∈ W.edges ↔ ∃ i : Fin k, + e = L i.castSucc (a i) \ {c i.castSucc, a i} ∨ e = L i.succ (a i) \ {c i.succ, a i} ∨ + e = L i.castSucc (b i) \ {c i.castSucc, b i} ∨ e = L i.succ (b i) \ {c i.succ, b i}) + (hWS : ∀ x ∈ W.support, (∃ j, x = c j) ∨ ∃ i, x = a i ∨ x = b i) : + (walkDrawing K W).U ⊆ Δ := by + intro x hx + rcases (mem_walkDrawing_U K W).mp hx with hx | ⟨e, heW, hxe⟩ + · rcases hWS x hx with ⟨j, rfl⟩ | ⟨i, rfl | rfl⟩ + · exact hp.sub j (hcE j).1 + · exact h.U_sub i (h.line i).left_mem + · exact h.U_sub i (h.line i).right_mem + · obtain ⟨i, rfl | rfl | rfl | rfl⟩ := (hWE e).mp heW + · have hx' : a i ∈ sideVerts P i.castSucc := ⟨i, .inl rfl, h.a_V i⟩ + rw [closure_sdiff_pair (hL _ _ hx').1] at hxe + exact hp.sub _ ((hL _ _ hx').2.1 hxe) + · have hx' : a i ∈ sideVerts P i.succ := ⟨i, .inr rfl, h.a_V i⟩ + rw [closure_sdiff_pair (hL _ _ hx').1] at hxe + exact hp.sub _ ((hL _ _ hx').2.1 hxe) + · have hx' : b i ∈ sideVerts P i.castSucc := ⟨i, .inl rfl, h.b_V i⟩ + rw [closure_sdiff_pair (hL _ _ hx').1] at hxe + exact hp.sub _ ((hL _ _ hx').2.1 hxe) + · have hx' : b i ∈ sideVerts P i.succ := ⟨i, .inr rfl, h.b_V i⟩ + rw [closure_sdiff_pair (hL _ _ hx').1] at hxe + exact hp.sub _ ((hL _ _ hx').2.1 hxe) + +private theorem spoke_circuits_are_inside_hub_walk + {S : Type u} + [TopologicalSpace S] + [T2Space S] + (Γ : Drawing S) + (k : ℕ) + (a : Fin k → S) + (b : Fin k → S) + (P : Fin k → Drawing S) + (K : Drawing S) + (c : Fin (k + 1) → S) + (L : Fin (k + 1) → S → Set S) + (sp : Spokes Γ K a b P c (fun i => L i.castSucc (a i) \ {c i.castSucc, a i}) (fun i => L + i.succ (a i) \ {c i.succ, a i}) (fun i => L i.castSucc (b i) \ {c i.castSucc, b i}) fun i => + L i.succ (b i) \ {c i.succ, b i}) + (ins : Drawing S → Set S) + (Q : Fin k → Drawing S) + (hQc : ∀ (i : Fin k), (Q i).IsCircuit) + (hQV : ∀ (i : Fin k), (Q i).V = {c i.castSucc, a i, c i.succ, b i}) + (hQE : ∀ (i : Fin k), (Q i).E = + {L i.castSucc (a i) \ {c i.castSucc, a i}, L i.succ (a i) \ {c i.succ, a i}, + L i.succ (b i) \ {c i.succ, b i}, L i.castSucc (b i) \ {c i.castSucc, b i}}) + (W : GraphWalk K.toGraph (c 0) (c 0)) + (hWE : ∀ (e : Set S), e ∈ W.edges ↔ ∃ i : Fin k, + e = L i.castSucc (a i) \ {c i.castSucc, a i} ∨ e = L i.succ (a i) \ {c i.succ, a i} ∨ + e = L i.castSucc (b i) \ {c i.castSucc, b i} ∨ e = L i.succ (b i) \ {c i.succ, b i}) : + ∀ (i : Fin k), ins (Q i) ⊆ insWalk ins K W := by + intro i x hx + have hsub : (Q i).IsSubdrawing (walkDrawing K W) := by + refine ⟨?_, ?_⟩ + · rw [walkDrawing_V, hQV i] + have e₀ : _ ∈ W.edges := (hWE _).mpr ⟨i, .inl rfl⟩ + have e₁ : _ ∈ W.edges := (hWE _).mpr ⟨i, .inr (.inl rfl)⟩ + have e₂ : _ ∈ W.edges := (hWE _).mpr ⟨i, .inr (.inr (.inl rfl))⟩ + rintro x (rfl | rfl | rfl | rfl) + · exact W.left_mem_support_of_mem_edges e₀ (spoke_link (sp.mem_α₀ i) (pair_swap + (sp.cap_α₀ i))) + · exact W.left_mem_support_of_mem_edges e₀ (spoke_link (sp.mem_α₀ i) (sp.cap_α₀ i)) + · exact W.left_mem_support_of_mem_edges e₁ (spoke_link (sp.mem_α₁ i) (pair_swap + (sp.cap_α₁ i))) + · exact W.left_mem_support_of_mem_edges e₂ (spoke_link (sp.mem_β₀ i) (sp.cap_β₀ i)) + · rw [walkDrawing_E, hQE i] + rintro t (rfl | rfl | rfl | rfl) + · exact (hWE _).mpr ⟨i, .inl rfl⟩ + · exact (hWE _).mpr ⟨i, .inr (.inl rfl)⟩ + · exact (hWE _).mpr ⟨i, .inr (.inr (.inr rfl))⟩ + · exact (hWE _).mpr ⟨i, .inr (.inr (.inl rfl))⟩ + exact Or.inr (mem_iUnion₂.mpr ⟨Q i, ⟨hQc i, hsub⟩, hx⟩) + +/-- Corrected XII (6.1) (pages 257–258). The bound `d(e₁, e_{θ/2}) ≥ θ` assumes even `θ ≥ 4`. +When `θ = 2` the two edges coincide. -/ +theorem theorem_6_1_proof : GM15.GM12Theorem61Statement.{u} := by + intro S _ _ Γ F Δ k θ₁ T₁ d a b P e_path i₀ i_last hS hconn hk hθ h2c hF hN hΔ hb hnd hord hV hP + hdis + hcov he h2 hT₁ hM hfree h0 hlast + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hk0 : 0 < k := by omega + have hθ3 : 3 ≤ θ₁ := by omega + have heΓ : ∀ i, e_path i ∈ Γ.E := fun i => ((hP i).2.trans interSet_isSub).2 (he i) + have hE : Γ.E.Nonempty := ⟨_, heΓ i₀⟩ + have h : Setup61 Γ F Δ k a b P := ⟨hN, hΔ, hb, hnd, hord, hV, hP, hdis, hcov⟩ + -- the discs `D_m`, and the radial drawing `K` with hubs and spokes in them + obtain ⟨X, Y, A, B, E, r, hp, hside⟩ := h.exists_regions hS hk0 h2 + obtain ⟨K, c, L, hK, hh, hcE, hL, sp⟩ := exists_hubs_spokes h hS h2c hp hside + -- the metric may be computed in `K` + obtain ⟨ins, hd', hdist⟩ := HasTangleMetric.of_radial hS hM hK + have hT := hM.1 + have hrad : PreRad (.drawing Γ) K := ⟨hK.1, hK.2.1⟩ + have hpt : IsPretangle (PaintingOrDrawing.drawing Γ).toHypergraph θ₁ _ := + ⟨hT.2.1.one_le, hT.2.1.isSeparation, hT.2.1.order_lt, hT.2.1.axiom1, hT.2.1.axiom2⟩ + have hs : IsSlope K (2 * θ₁) ins := GM11.isSlope_of_derived hS hpt hrad.2.1 hd' + have hsize := size_free h + have hins : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing K → C.length < 2 * θ₁ → + IsClosedDisc (ins C) ∧ discBd (ins C) = C.U ∧ + ((PaintingOrDrawing.drawing Γ).inter (ins C), + (PaintingOrDrawing.drawing Γ).interOutside (ins C)) ∈ + GM12.inducedBySubgraph Γ.toHypergraph (Γ.interSet (closure (univ \ Δ))).toHypergraph θ₁ T₁ + := + fun C hC hCK hl => by + obtain ⟨h1, h2, h3⟩ := hd' C hC hCK hl + exact ⟨h1, by rw [← GM14.IsClosedDisc.subBd_eq_discBd hS h1]; exact h2, h3⟩ + -- the circuits `Q i`, and `U(P i) ⊆ ins(Q i)` + choose Q hQc hQs hQl hQV hQE using exists_Q h hh sp + have hQlen : ∀ i, (Q i).length < 2 * θ₁ := fun i => by + have := hQl i + omega + have hRQ : ∀ i, (P i).U ⊆ ins (Q i) := by + intro i + have ha₀ : a i ∈ sideVerts P i.castSucc := ⟨i, .inl rfl, h.a_V i⟩ + have hb₀ : b i ∈ sideVerts P i.castSucc := ⟨i, .inl rfl, h.b_V i⟩ + have ha₁ : a i ∈ sideVerts P i.succ := ⟨i, .inr rfl, h.a_V i⟩ + have hb₁ : b i ∈ sideVerts P i.succ := ⟨i, .inr rfl, h.b_V i⟩ + have l1 := (hL _ _ ha₀).1 + have l2 := (hL _ _ ha₁).1 + have l3 := (hL _ _ hb₀).1 + have l4 := (hL _ _ hb₁).1 + have hQU : (Q i).U = (L i.castSucc (a i) ∪ L i.castSucc (b i)) ∪ + (L i.succ (a i) ∪ L i.succ (b i)) := by + ext x + rw [(Q i).U_eq, mem_union, mem_iUnion₂, hQV i] + simp only [hQE i, mem_insert_iff, mem_singleton_iff, exists_prop, exists_eq_or_imp, + exists_eq_left, closure_sdiff_pair l1, closure_sdiff_pair l2, closure_sdiff_pair l3, + closure_sdiff_pair l4, mem_union] + constructor + · rintro ((rfl | rfl | rfl | rfl) | (h1 | h1 | h1 | h1)) + · exact .inl (.inl l1.left_mem) + · exact .inl (.inl l1.right_mem) + · exact .inr (.inl l2.left_mem) + · exact .inl (.inr l3.right_mem) + · exact .inl (.inl h1) + · exact .inr (.inl h1) + · exact .inr (.inr h1) + · exact .inl (.inr h1) + · rintro ((h1 | h1) | (h1 | h1)) + · exact .inr (.inl h1) + · exact .inr (.inr (.inr (.inr h1))) + · exact .inr (.inr (.inl h1)) + · exact .inr (.inr (.inr (.inl h1))) + obtain ⟨G, hG, hGΔ, hRG, hGb⟩ := hp.exists_Q_disc h hL i + obtain ⟨h1, h2, h3⟩ := hins (Q i) (hQc i) (hQs i) (hQlen i) + rw [h.ins_eq_of_disc hS hT.2.1 hθ3 h1 h3 hG hGΔ (by rw [h2, hGb, hQU])] + exact hRG + -- the walk `W`, and `ins(W) ⊆ Δ` + obtain ⟨W, hWl, hWE, hWS⟩ := exists_W sp (hh.c_V 0) + have hWk : W.length < 2 * θ₁ := by omega + obtain ⟨hXr, hXl⟩ := theorem_8_5_proof hS hs W hWk + have hWΔ : (walkDrawing K W).U ⊆ Δ := by + exact hub_walk_lies_in_closed_disc (S := S) Γ F Δ k a b P h X Y A B E r hp K c L hcE hL W hWE + hWS + have hXΔ : insWalk ins K W ⊆ Δ := by + rintro x (hx | hx) + · exact hWΔ hx + · obtain ⟨C, ⟨hC, hCW⟩, hxC⟩ := mem_iUnion₂.mp hx + have hCK := hCW.trans (walkDrawing_isSubdrawing K W) + obtain ⟨h1, h2, h3⟩ := hins C hC hCK (isConfined_walk W hWk C hC hCW) + exact h.sub_of_bd_sub hS hT.2.1 hθ3 h1 h3 hΔ subset_rfl (h2 ▸ hCW.U_subset.trans hWΔ) hxC + have hQW : ∀ i, ins (Q i) ⊆ insWalk ins K W := by + exact spoke_circuits_are_inside_hub_walk (S := S) Γ k a b P K c L sp ins Q hQc hQV hQE W hWE + have hFX : F ∩ Γ.V ⊆ insWalk ins K W := by + intro x hx + rw [← hV] at hx + rcases hx with ⟨i, rfl⟩ | ⟨i, rfl⟩ + · exact hQW i (hRQ i (h.line i).left_mem) + · exact hQW i (hRQ i (h.line i).right_mem) + -- claim (2) for `ins(W)` + have hclaim2 : ∀ Y : Set S, IsRestraint K ins (2 * θ₁) Y → insWalk ins K W ⊆ Y → + ¬ perimeterWalkLength K Y < perimeterWalkLength K (insWalk ins K W) := by + intro Y hY hXY hlt + exact claim_two hS hE hk hθ hT hK hd' hs hfree hsize hY (hFX.trans hXY) (by omega) + have hne : e_path i₀ ≠ e_path i_last := by + intro heq + have hii : i₀ ≠ i_last := fun hi => by + have := congrArg Fin.val hi + omega + obtain ⟨y, hy⟩ := (heΓ i₀).1 + have h1 := (P i₀).closure_subset_U (he i₀) (subset_closure hy) + have h2 := (P i_last).closure_subset_U (he i_last) (subset_closure (heq ▸ hy)) + exact hii (same_path h h1 h2) + rw [hdist _ (.inl (.inr (heΓ i₀))) _ (.inl (.inr (heΓ i_last)))] + unfold tangleMetric + rw [ite_eq_right hne] + split_ifs with hex + swap + · omega + by_contra hlt + push Not at hlt + have hne' : {m : ℕ | ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom Γ K (e_path i₀) x' ∧ IsCorrespondingAtom Γ K (e_path i_last) y' ∧ + W.length < 2 * θ₁ ∧ W.length = 2 * m ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W}.Nonempty + := by + obtain ⟨u, W'', x', y', h1, h2, h3, h4, h5⟩ := hex + exact ⟨_, u, W'', x', y', h1, h2, h3, closed_walk_length_eq_two_mul hrad.2 W'', h4, h5⟩ + obtain ⟨u, W'', x', y', hx, hy, hl, hl2, hxW, hyW⟩ := Nat.sInf_mem hne' + -- two points of the edges + obtain ⟨pa, hpa⟩ := (heΓ i₀).1 + obtain ⟨pb, hpb⟩ := (heΓ i_last).1 + have hpaR : pa ∈ (P i₀).U := (P i₀).closure_subset_U (he i₀) (subset_closure hpa) + have hpbR : pb ∈ (P i_last).U := (P i_last).closure_subset_U (he i_last) (subset_closure hpb) + have hpaX : pa ∈ insWalk ins K W := hQW i₀ (hRQ i₀ hpaR) + have hpbX : pb ∈ insWalk ins K W := hQW i_last (hRQ i_last hpbR) + have hpaU : pa ∉ K.U := Set.disjoint_left.mp (edge_disjoint hrad (heΓ i₀)) hpa + have hpbU : pb ∉ K.U := Set.disjoint_left.mp (edge_disjoint hrad (heΓ i_last)) hpb + have hoff : ({pa, pb} : Set S) ∩ K.U ⊆ K.V := by + rintro x ⟨rfl | rfl, hxU⟩ + · exact (hpaU hxU).elim + · exact (hpbU hxU).elim + obtain ⟨Y₀, hY₀X, hopt⟩ := gm12_theorem_8_13 S hS hconn K (2 * θ₁) ins hs pa pb + (insWalk ins K W) hoff hXr hpaX hpbX hclaim2 + obtain ⟨hY₀, hpaY, hpbY, hmin⟩ := hopt + -- `W*` + obtain ⟨hZr, hZl⟩ := theorem_8_5_proof hS hs W'' hl + have hle := hmin _ hZr (hxW (atom_of_edge (heΓ _) hx hpa)) (hyW (atom_of_edge (heΓ _) hy hpb)) + obtain ⟨v, Wst, -, hlen, -, -, hwd⟩ := hY₀.exists_walk hS + have hfrΔ : frontier Y₀ ⊆ Δ := (hY₀.isClosed.frontier_subset.trans hY₀X).trans hXΔ + -- a circuit of the boundary of `Y₀` around a point of `Y₀` off `K` + have hcirc : ∀ {p : S}, p ∈ Y₀ → p ∉ K.U → ∃ C : Drawing S, C.IsCircuit ∧ + C.IsSubdrawing (K.interSet (frontier Y₀)) ∧ C.length < 2 * θ₁ ∧ p ∈ ins C := by + intro p hpY hpU + have : p ∈ insOf ins (K.interSet (frontier Y₀)) := by + rw [insOf_frontier hS hs hY₀] + exact hpY + rcases this with hpU' | hpU' + · exact (hpU (interSet_isSub.U_subset hpU')).elim + · obtain ⟨C, ⟨hC, hCs⟩, hpC⟩ := mem_iUnion₂.mp hpU' + exact ⟨C, hC, hCs, hY₀.isConfined hS C hC hCs, hpC⟩ + have hsupp : ∀ {C : Drawing S}, C.IsSubdrawing (K.interSet (frontier Y₀)) → + ∀ x ∈ C.V, x ∈ Wst.support := by + intro C hCs x hx + have : x ∈ (K.interSet (frontier Y₀)).V := hCs.1 hx + rw [← hwd, walkDrawing_V] at this + exact this + have hCU : ∀ {C : Drawing S}, C.IsSubdrawing (K.interSet (frontier Y₀)) → C.U ⊆ Δ ∧ C.U ⊆ K.U := + fun hCs => ⟨(hCs.U_subset.trans (interSet_U_subset isClosed_frontier)).trans hfrΔ, + hCs.U_subset.trans interSet_isSub.U_subset⟩ + obtain ⟨C₀, hC₀, hC₀s, hC₀l, hpaC₀⟩ := hcirc hpaY hpaU + obtain ⟨C₁, hC₁, hC₁s, hC₁l, hpbC₁⟩ := hcirc hpbY hpbU + have hC₀K := hC₀s.trans interSet_isSub + have hC₁K := hC₁s.trans interSet_isSub + obtain ⟨i₀1, i₀2, i₀3⟩ := hins C₀ hC₀ hC₀K hC₀l + obtain ⟨i₁1, i₁2, i₁3⟩ := hins C₁ hC₁ hC₁K hC₁l + obtain ⟨x₀, hx₀C, hx₀⟩ := hp.exists_low h hS hK.2.1 hT.2.1 hθ3 hC₀ hC₀K (hCU hC₀s).1 i₀1 i₀2 i₀3 + h0 hpaC₀ (fun hm => hpaU ((hCU hC₀s).2 hm)) hpaR + obtain ⟨x₁, hx₁C, hx₁⟩ := hp.exists_high h hS hK.2.1 hT.2.1 hθ3 hC₁ hC₁K (hCU hC₁s).1 i₁1 i₁2 i₁3 + (by omega) hpbC₁ (fun hm => hpbU ((hCU hC₁s).2 hm)) hpbR + -- each edge of `W*` changes the level by one + have hstep : ∀ e ∈ Wst.edges, ∀ x y, closure e ∩ K.V = {x, y} → + lev61 X Y x ≤ lev61 X Y y + 1 ∧ lev61 X Y y ≤ lev61 X Y x + 1 := by + intro e he x y hxy + have heK : e ∈ (K.interSet (frontier Y₀)).E := by + rw [← hwd, walkDrawing_E] + exact he + obtain ⟨h1, h2⟩ := mem_interSet_E_iff.mp heK + have hcl : closure e ⊆ Δ := (closure_minimal h2 isClosed_frontier).trans hfrΔ + obtain ⟨v', hv', w', hw', hc'⟩ := hK.2.1.2.2.2.2.1 e h1 + have hlev := hp.lev_step h hS hK.2.1 h1 hcl hv' hw' hc' + rw [hc'] at hxy + rcases Set.pair_eq_pair_iff.mp hxy with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hlev + · exact ⟨hlev.2, hlev.1⟩ + have hlong := two_points Wst hstep (hsupp hC₀s x₀ hx₀C) (hsupp hC₁s x₁ hx₁C) + (n := 2 * k) (by rw [hx₀, hx₁]; omega) + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section6Chain.lean b/LeanPool/GraphMinor/GM12/Section6Chain.lean new file mode 100644 index 0000000000..fa30936720 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section6Chain.lean @@ -0,0 +1,274 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section6Walk +public import LeanPool.GraphMinor.GM12.Section78 +public import LeanPool.GraphMinor.GM12.Section4WalkMetric +public import LeanPool.GraphMinor.GM11.Section92 +public import LeanPool.GraphMinor.GM11.Theorem61 +public import LeanPool.GraphMinor.GM12.Section5Side + +/-! +# Graph Minors XII, Section 6: claim (2) of (6.1) + +`claim_two` is claim (2) of the paper: a restraint `Y` holding all of `F ∩ V(Γ)` has `l(Y) ≥ 2θ`. + +`two_points` says that a closed walk through two points whose levels differ by `n` has length at +least +`2n`, when each edge changes the level by at most one. It is used for the closed walk `W*` in (6.1). +-/ + + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +theorem frontier_sub_U (hS : IsClosedSurface S) {K : Drawing S} {Y : Set S} + (hc : IsClosed Y) (hn : IsGammaNice K Y) : frontier Y ⊆ K.U := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + intro x hx + by_contra hU + obtain ⟨s, hs, hxs⟩ := exists_region_of_notMem hU + have hsY := nice_region hn hs ⟨x, hxs, hc.frontier_subset hx⟩ + exact hx.2 (mem_interior.mpr ⟨s, hsY, region_isOpen hs, hxs⟩) + +open Classical in +omit [TopologicalSpace S] [T2Space S] in +theorem ncard_list_inter (l : List S) (A : Set S) : + ({x | x ∈ l} ∩ A).ncard ≤ l.countP (· ∈ A) := by + induction l with + | nil => simp + | cons y l ih => + by_cases hy : y ∈ A + · have hsub : {x | x ∈ y :: l} ∩ A ⊆ insert y ({x | x ∈ l} ∩ A) := by + rintro x ⟨hx, hxA⟩ + rcases List.mem_cons.mp hx with rfl | hx + · exact .inl rfl + · exact .inr ⟨hx, hxA⟩ + have h1 := ncard_le_ncard hsub (((List.finite_toSet l).inter_of_left A).insert y) + have h2 := ncard_insert_le y ({x | x ∈ l} ∩ A) + rw [List.countP_cons_of_pos (by simpa using hy)] + omega + · have hsub : {x | x ∈ y :: l} ∩ A ⊆ {x | x ∈ l} ∩ A := by + rintro x ⟨hx, hxA⟩ + rcases List.mem_cons.mp hx with rfl | hx + · exact (hy hxA).elim + · exact ⟨hx, hxA⟩ + have h1 := ncard_le_ncard hsub ((List.finite_toSet l).inter_of_left A) + rw [List.countP_cons_of_neg (by simpa using hy)] + omega + +omit [T2Space S] in +/-- A closed walk of `K` of length `< 4k` meets `V(Γ)` in fewer than `2k` points. -/ +theorem order_lt {Γ K : Drawing S} (hpr : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) {u : + S} + (W : GraphWalk K.toGraph u u) {k : ℕ} (_hk : 2 ≤ k) (hl : W.length < 4 * k) : + ({x | x ∈ W.support} ∩ Γ.V).ncard < 2 * k := by + classical + have h2 := closed_walk_length_eq_two_mul hpr W + cases W with + | nil hv => + have hsub : {x | x ∈ (GraphWalk.nil hv : GraphWalk K.toGraph u u).support} ∩ Γ.V ⊆ {u} := by + rintro x ⟨hx, -⟩ + simpa [GraphWalk.support] using hx + have := ncard_le_ncard hsub (finite_singleton u) + rw [ncard_singleton] at this + omega + | @cons _ y _ e hlk r => + have hsub : {x | x ∈ (GraphWalk.cons hlk r).support} ∩ Γ.V ⊆ {x | x ∈ r.support} ∩ Γ.V := by + rintro x ⟨hx, hxV⟩ + refine ⟨?_, hxV⟩ + rcases List.mem_cons.mp hx with rfl | hx + · exact r.end_mem_support + · exact hx + have h1 := ncard_le_ncard hsub ((List.finite_toSet _).inter_of_left _) + have h3 := ncard_list_inter r.support Γ.V + have h4 : (GraphWalk.cons hlk r).support.tail = r.support := rfl + rw [h4] at h2 + have h5 : r.support.countP (· ∈ Γ.V) * 2 < 4 * k := by + convert (show _ < 4 * k from hl) using 1 + rw [h2] + ring_nf + omega + +omit [T2Space S] in +/-- Walks and a level function that changes by at most one on each step. -/ +theorem level_bound {K : Drawing S} {lev : S → ℕ} {x y : S} (w : GraphWalk K.toGraph x y) + (hstep : ∀ e ∈ w.edges, ∀ p q, closure e ∩ K.V = {p, q} → lev p ≤ lev q + 1 ∧ lev q + ≤ lev p + 1) : + lev y ≤ lev x + w.length ∧ lev x ≤ lev y + w.length := by + induction w with + | nil _ => simp [GraphWalk.length, GraphWalk.edges] + | @cons a b c e hl r ih => + have h1 := hstep e List.mem_cons_self a b hl.2.2.2 + have h2 := ih fun f hf => hstep f (List.mem_cons_of_mem _ hf) + have h3 : (GraphWalk.cons hl r).length = r.length + 1 := by + simp [GraphWalk.length, GraphWalk.edges] + omega + +omit [T2Space S] in +/-- A closed walk through two points of levels differing by `n` has length at least `2n`. -/ +theorem two_points {K : Drawing S} {lev : S → ℕ} {u p q : S} (W : GraphWalk K.toGraph u u) + (hstep : ∀ e ∈ W.edges, ∀ x y, closure e ∩ K.V = {x, y} → lev x ≤ lev y + 1 ∧ lev y ≤ lev x + 1) + (hp : p ∈ W.support) (hq : q ∈ W.support) {n : ℕ} (hn : lev q = lev p + n) : + 2 * n ≤ W.length := by + obtain ⟨W₁, W₂, rfl⟩ := W.exists_append_of_mem hp + have hmem : q ∈ (W₂.append W₁).support := by + rcases (GraphWalk.mem_support_append _ _).mp hq with h | h + · exact (GraphWalk.mem_support_append _ _).mpr (.inr h) + · exact (GraphWalk.mem_support_append _ _).mpr (.inl h) + have hstep' : ∀ e ∈ (W₂.append W₁).edges, ∀ x y, closure e ∩ K.V = {x, y} → + lev x ≤ lev y + 1 ∧ lev y ≤ lev x + 1 := fun e he => hstep e (by + rw [GraphWalk.edges_append, List.mem_append] at he ⊢ + exact he.symm) + have hlen : (W₂.append W₁).length = (W₁.append W₂).length := by + rw [GraphWalk.length_append, GraphWalk.length_append, add_comm] + rw [← hlen] + obtain ⟨R₁, R₂, hR⟩ := (W₂.append W₁).exists_append_of_mem hmem + rw [hR] at hstep' ⊢ + rw [GraphWalk.edges_append] at hstep' + have h1 := level_bound R₁ fun e he => hstep' e (List.mem_append_left _ he) + have h2 := level_bound R₂ fun e he => hstep' e (List.mem_append_right _ he) + rw [GraphWalk.length_append] + omega + +variable [ConnectedSpace S] {Γ K : Drawing S} + {F Δ : Set S} {k : ℕ} {a b : Fin k → S} {P : Fin k → Drawing S} (h : Setup61 Γ F Δ k a b P) + +include h in +omit [ConnectedSpace S] in +/-- `F ∩ V(Γ₁)` has `2k` points. -/ +theorem size_free : (F ∩ (Γ.interSet (closure (univ \ Δ))).V).ncard = 2 * k := by + have hFc : F ⊆ closure (univ \ Δ) := fun x hx => by + have : x ∈ frontier Δ := by + rw [← subBd_eq_frontier, h.bd] + exact hx + rw [frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] at this + exact this.2 + have hset : F ∩ (Γ.interSet (closure (univ \ Δ))).V = range (Sum.elim a b) := by + rw [Set.Sum.elim_range, h.verts] + ext x + constructor + · rintro ⟨hx, hxV⟩ + exact ⟨hx, interSet_isSub.1 hxV⟩ + · rintro ⟨hx, hxV⟩ + exact ⟨hx, mem_interSet_V hxV (hFc hx)⟩ + have hinj : Function.Injective (Sum.elim a b) := by + rintro (i | i) (j | j) he + · exact congrArg _ (a_inj h he) + · exact (a_ne_b h _ _ he).elim + · exact (a_ne_b h _ _ he.symm).elim + · exact congrArg _ (b_inj h he) + rw [hset, ← image_univ, ncard_image_of_injective _ hinj, ncard_univ] + simp + omega + +omit [ConnectedSpace S] in +/-- A separation of `𝒯` with `F ∩ V(Γ)` on its first side has order at least `2k`. This is the use +of +freeness in the paper. -/ +theorem free_contra {θ₁ : ℕ} {T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hfree : IsFreeSet (Γ.interSet (closure (univ \ Δ))).toHypergraph T₁ θ₁ + (F ∩ (Γ.interSet (closure (univ \ Δ))).V)) + (hsize : (F ∩ (Γ.interSet (closure (univ \ Δ))).V).ncard = 2 * k) {D : Set S} + (hD : ((PaintingOrDrawing.drawing Γ).inter D, (PaintingOrDrawing.drawing Γ).interOutside D) ∈ + inducedBySubgraph Γ.toHypergraph (Γ.interSet (closure (univ \ Δ))).toHypergraph θ₁ T₁) + (hsub : F ∩ Γ.V ⊆ D) (hord : (frontier D ∩ Γ.V).ncard < 2 * k) : False := by + have hmem := hD.2.2 + have hle := hfree.2.2 hmem (fun x hx => by + have hxV : x ∈ Γ.V := interSet_isSub.1 hx.2 + exact ⟨⟨hxV, hsub ⟨hx.1, hxV⟩⟩, hx.2⟩) + have hsubset : (((PaintingOrDrawing.drawing Γ).inter D ∩ + (Γ.interSet (closure (univ \ Δ))).toHypergraph) ∩ + ((PaintingOrDrawing.drawing Γ).interOutside D ∩ + (Γ.interSet (closure (univ \ Δ))).toHypergraph)).vertexSet ⊆ frontier D ∩ Γ.V := + fun x hx => inter_outside_subset (Γ := PaintingOrDrawing.drawing Γ) ⟨hx.1.1, hx.2.1⟩ + have hle2 := ncard_le_ncard hsubset (Γ.finite_V.subset inter_subset_right) + unfold separationOrder at hle + have hle3 : (F ∩ (Γ.interSet (closure (univ \ Δ))).V).ncard ≤ (frontier D ∩ Γ.V).ncard := + hle.trans hle2 + omega + +/-- **Claim (2) of the paper.** A restraint `Y` holding `F ∩ V(Γ)` has length at least `4k`. As in +the +paper, the separation of `Y` is in the tangle by (1.1), and it has small order, against the freeness +of +`F ∩ V(Γ₁)`. -/ +theorem claim_two (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) {θ₁ : ℕ} + {T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + (hk : 2 ≤ k) (hθ : 2 * k < θ₁) + (hT : IsRespectfulDrawingTangle Γ θ₁ + (inducedBySubgraph Γ.toHypergraph (Γ.interSet (closure (univ \ Δ))).toHypergraph θ₁ T₁)) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ₁ + (inducedBySubgraph Γ.toHypergraph (Γ.interSet (closure (univ \ Δ))).toHypergraph θ₁ T₁) ins) + (hs : IsSlope K (2 * θ₁) ins) + (hfree : IsFreeSet (Γ.interSet (closure (univ \ Δ))).toHypergraph T₁ θ₁ + (F ∩ (Γ.interSet (closure (univ \ Δ))).V)) + (hsize : (F ∩ (Γ.interSet (closure (univ \ Δ))).V).ncard = 2 * k) {Y : Set S} + (hY : IsRestraint K ins (2 * θ₁) Y) (hsub : F ∩ Γ.V ⊆ Y) + (hl : perimeterWalkLength K Y < 4 * k) : False := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hrad : PreRad (.drawing Γ) K := ⟨hK.1, hK.2.1⟩ + obtain ⟨u, W', -, hlen, -, -, hwd⟩ := hY.exists_walk hS + have hYc := hY.isClosed + have hfrU := frontier_sub_U hS hYc hY.isGammaNice + have hn : frontier Y ∩ Γ.U ⊆ Γ.V := fun x hx => by + have : x ∈ Γ.U ∩ K.U := ⟨hx.2, hfrU hx.1⟩ + rw [show Γ.U ∩ K.U = Γ.V from hrad.2.1] at this + exact this + have hsep := isSeparation_inter (Γ := PaintingOrDrawing.drawing Γ) hYc hn + have hfrs : frontier Y ∩ Γ.V ⊆ {x | x ∈ W'.support} ∩ Γ.V := fun x hx => by + refine ⟨?_, hx.2⟩ + have : x ∈ (K.interSet (frontier Y)).V := mem_interSet_V (radial_V hrad hx.2) hx.1 + rw [← hwd, walkDrawing_V] at this + exact this + have hord : (frontier Y ∩ Γ.V).ncard < 2 * k := + (ncard_le_ncard hfrs ((List.finite_toSet _).inter_of_left _)).trans_lt + (order_lt hrad.2 W' hk (hlen ▸ hl)) + have hAB : ((PaintingOrDrawing.drawing Γ).inter Y ∩ (PaintingOrDrawing.drawing Γ).interOutside + Y).vertexSet + ⊆ frontier Y ∩ Γ.V := fun x hx => inter_outside_subset (Γ := PaintingOrDrawing.drawing Γ) hx + have ho : separationOrder ((PaintingOrDrawing.drawing Γ).inter Y) + ((PaintingOrDrawing.drawing Γ).interOutside Y) < θ₁ := by + have := ncard_le_ncard hAB (Γ.finite_V.subset inter_subset_right) + unfold separationOrder + omega + refine free_contra hfree hsize ((theorem_1_1_proof hS hT hE hK hd hsep ho).mpr ?_) hsub hord + rintro e ⟨heE, heY⟩ + have heΓ : e ∈ Γ.E := heE + obtain ⟨y, hy⟩ := heΓ.1 + have hdis := edge_disjoint hrad heΓ + obtain ⟨s, hs', hes⟩ := edge_region hS hrad heΓ + have hyY : y ∈ insOf ins (K.interSet (frontier Y)) := by + rw [insOf_frontier hS hs hY] + exact heY hy + rcases hyY with hyU | hyU + · exact (Set.disjoint_left.mp hdis hy (interSet_isSub.U_subset hyU)).elim + obtain ⟨C, ⟨hC, hCs⟩, hyC⟩ := mem_iUnion₂.mp hyU + have hCK := hCs.trans interSet_isSub + have hCl : C.length < 2 * θ₁ := hY.isConfined hS C hC hCs + obtain ⟨-, -, hnice⟩ := ins_slope_facts hS hs hC hCK hCl + refine ⟨C, hC, hCK, hCl, fun x hx => ?_, (hes.trans (nice_region hnice hs' ⟨y, hes hy, hyC⟩))⟩ + have hxF : x ∈ frontier Y := ((mem_interSet_V_iff isClosed_frontier).mp (hCs.1 hx.1)).2 + have hxY := hYc.frontier_subset hxF + have hxC : x ∈ closure (univ \ Y) := by + rw [frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] at hxF + exact hxF.2 + exact ⟨⟨hx.2, hxY⟩, hx.2, hxC⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section6Claims.lean b/LeanPool/GraphMinor/GM12/Section6Claims.lean new file mode 100644 index 0000000000..cae3b273da --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section6Claims.lean @@ -0,0 +1,519 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section6Special +public import LeanPool.GraphMinor.GM11.Section6 +public import LeanPool.GraphMinor.GM11.Theorem61 +public import LeanPool.GraphMinor.GM15.Section3 +public import LeanPool.GraphMinor.Surface.DiscArcs +public import LeanPool.GraphMinor.Surface.DiscUnion +import LeanPool.GraphMinor.GM10.Section6 + +/-! +# Graph Minors XII, Section 6: the claims in the proof of (6.1) + +* `ins_eq_of_disc` is claim (1) of the proof of (6.1) (page 258). Let `D ⊆ Δ` be a closed disc, and + let `I` be a closed disc with the same boundary whose separation is in the tangle. Then `I = D`. + As in + the paper, `Γ ∩ D` has no circuit, since `Γ ∩ Δ` is a union of disjoint paths + (`not_hasCircuit_inter`), and so [4, Theorem (2.10)] gives `I = D`. +* `lev61` is a level on `Δ`: a point on `P_j` has level `2j + 1`, and a point off the paths has + level + twice the number of chords before it. An edge of `K` in `Δ` changes the level by one (`lev_step`). + The paper says without proof that a closed walk `W*` of `K` in `Δ` with `e_1, e_{θ/2}` in + `ins(W*)` + has length at least `2θ`. We prove it with this level (`exists_low`, `exists_high`). +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 Hypergraph + +universe u + +/-! ### Claim (1) -/ + +/-- **A union of disjoint forests has no circuit.** Let the vertex sets of the hypergraphs `H i` be +disjoint, and let none of them have a circuit. If each edge of `G` is an edge of some `H i` with the +same +ends, then `G` has no circuit. -/ +theorem not_hasCircuit_of_parts {α β ι : Type*} {G : Hypergraph α β} (H : ι → Hypergraph α β) + (hdisj : ∀ i j, i ≠ j → Disjoint (H i).vertexSet (H j).vertexSet) + (hH : ∀ i, ¬ HasCircuit (H i)) + (hE : ∀ e ∈ G.edgeSet, ∃ i, e ∈ (H i).edgeSet ∧ G.ends e = (H i).ends e) : + ¬ HasCircuit G := by + have hidx : ∀ {i j : ι} {x : α}, x ∈ (H i).vertexSet → x ∈ (H j).vertexSet → i = j := + fun hi hj => by + by_contra hne + exact disjoint_left.mp (hdisj _ _ hne) hi hj + have hadj : ∀ {x y : α}, G.skeleton.Adj x y → + ∃ i, x ∈ (H i).vertexSet ∧ y ∈ (H i).vertexSet ∧ (H i).skeleton.Adj x y := by + rintro x y ⟨hxy, e, hx, hy⟩ + obtain ⟨i, -, hends⟩ := hE e (G.edge_mem_of_inc hx) + have hx' : x ∈ (H i).ends e := hends ▸ hx + have hy' : y ∈ (H i).ends e := hends ▸ hy + exact ⟨i, (H i).vertex_mem_of_inc hx', (H i).vertex_mem_of_inc hy', hxy, e, hx', hy'⟩ + have hwalk : ∀ {u v : α} (p : G.skeleton.Walk u v) (i : ι), u ∈ (H i).vertexSet → + ∀ e ∈ p.edges, e ∈ (H i).skeleton.edgeSet := by + intro u v p + induction p with + | nil => simp + | cons hstep q ih => + intro i hu e he + obtain ⟨j, hj, hj', hadj'⟩ := hadj hstep + have hij := hidx hu hj + subst hij + rcases List.mem_cons.mp he with rfl | he + · exact hadj' + · exact ih _ hj' e he + rintro (⟨e, he, hc⟩ | ⟨e₁, he₁, e₂, he₂, hne, hc⟩ | hcyc) + · obtain ⟨i, hei, hends⟩ := hE e he + exact hH i (.inl ⟨e, hei, hends ▸ hc⟩) + · obtain ⟨i, hi1, h1⟩ := hE e₁ he₁ + obtain ⟨j, hj2, h2⟩ := hE e₂ he₂ + obtain ⟨x, hx1, hx2⟩ : (G.ends e₁ ∩ G.ends e₂).Nonempty := + nonempty_of_ncard_ne_zero (by omega) + have hx1' : x ∈ (H i).ends e₁ := h1 ▸ hx1 + have hx2' : x ∈ (H j).ends e₂ := h2 ▸ hx2 + obtain rfl := hidx ((H i).vertex_mem_of_inc hx1') ((H j).vertex_mem_of_inc hx2') + exact hH i (.inr (.inl ⟨e₁, hi1, e₂, hj2, hne, by rwa [h1, h2] at hc⟩)) + · apply hcyc + intro u c hc + obtain ⟨i, hu, -, -⟩ := hadj (c.adj_snd hc.not_nil) + have hp := hwalk c i hu + exact hH i (.inr (.inr fun hac => hac (c.transfer _ hp) (hc.transfer hp))) + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + {Γ : Drawing S} {F Δ : Set S} {k : ℕ} {a b : Fin k → S} {P : Fin k → Drawing S} + +/-- **`Γ ∩ Δ` has no circuit.** It is the union of the disjoint paths `P i`. So for a closed set +`Z ⊆ Δ`, `Γ ∩ Z` has no circuit. -/ +theorem Setup61.not_hasCircuit_inter (h : Setup61 Γ F Δ k a b P) (hS : IsClosedSurface S) + {Z : Set S} (hZ : IsClosed Z) (hZΔ : Z ⊆ Δ) : + ¬ HasCircuit ((PaintingOrDrawing.drawing Γ).inter Z) := by + refine not_hasCircuit_of_parts (fun i => (P i).toHypergraph) + (fun i j hij => (h.disj hij).mono (P i).V_subset_U (P j).V_subset_U) + (fun i => GM15.not_hasCircuit_of_isPathBetween (h.path i).1) ?_ + rintro e ⟨heΓ, heZ⟩ + obtain ⟨y, hy⟩ := heΓ.1 + obtain ⟨-, i, hi⟩ := h.edge_mem hS heΓ ⟨y, hy, hZΔ (heZ hy)⟩ + refine ⟨i, hi, ?_⟩ + rw [← (inter_le hZ).ends_eq e ⟨heΓ, heZ⟩] + exact (GM15.toHypergraph_le_of_isSubdrawing (h.isSub i)).ends_eq e hi + +/-- **Claim (1) of (6.1).** Let `I` be a closed disc whose separation is in the tangle, and let +`D ⊆ Δ` be a closed disc with the same boundary. Then `I = D`. Otherwise `I ∪ D` is the whole +surface +(`cover_of_discBd_eq`), so the part of `Γ` outside `I` lies in `Γ ∩ D`. It has no circuit by +`not_hasCircuit_inter`, against [4, Theorem (2.10)]. -/ +theorem Setup61.ins_eq_of_disc (h : Setup61 Γ F Δ k a b P) (hS : IsClosedSurface S) + [ConnectedSpace S] {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle (PaintingOrDrawing.drawing Γ).toHypergraph θ T) (hθ : 3 ≤ θ) {I D : Set S} + (hI : IsClosedDisc I) + (hIT : ((PaintingOrDrawing.drawing Γ).inter I, (PaintingOrDrawing.drawing Γ).interOutside I) ∈ + T) + (hD : IsClosedDisc D) (hDΔ : D ⊆ Δ) (hb : discBd I = discBd D) : I = D := by + by_contra hne + have hcov := cover_of_discBd_eq hS hI hD hb hne + have hsub : closure (univ \ I) ⊆ D := by + refine closure_minimal (fun x hx => ?_) hD.isClosed + have : x ∈ I ∪ D := hcov.symm ▸ mem_univ x + exact this.resolve_left hx.2 + exact h.not_hasCircuit_inter hS isClosed_closure (hsub.trans hDΔ) (theorem_2_10_proof hT hθ hIT) + +/-- A form of claim (1): a closed disc `I` of the tangle whose boundary lies in a closed disc +`Z ⊆ Δ` lies in `Z`. -/ +theorem Setup61.sub_of_bd_sub (h : Setup61 Γ F Δ k a b P) (hS : IsClosedSurface S) + [ConnectedSpace S] {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle (PaintingOrDrawing.drawing Γ).toHypergraph θ T) (hθ : 3 ≤ θ) {I Z : Set S} + (hI : IsClosedDisc I) + (hIT : ((PaintingOrDrawing.drawing Γ).inter I, (PaintingOrDrawing.drawing Γ).interOutside I) ∈ + T) + (hZ : IsClosedDisc Z) (hZΔ : Z ⊆ Δ) (hIZ : discBd I ⊆ Z) : I ⊆ Z := by + obtain ⟨D, ⟨hDZ, hD, hDb, -⟩, -⟩ := disc_oArc Z (discBd I) hZ hIZ hI.isOArc_discBd + rw [h.ins_eq_of_disc hS hT hθ hI hIT hD (hDZ.trans hZΔ) hDb.symm] + exact hDZ + +/-! ### Levels -/ + +omit [T2Space S] in +/-- A vertex of a circuit lies on an edge of the circuit. -/ +theorem IsCircuit.exists_edge_of_mem_V {C : Drawing S} (hC : C.IsCircuit) {x : S} (hx : x ∈ C.V) : + ∃ t ∈ C.E, x ∈ closure t := by + obtain ⟨u, W, -, hlen, hV, hE⟩ := hC + have key : ∀ {u v : S} (W : GraphWalk C.toGraph u v), 0 < W.length → x ∈ W.support → + ∃ t ∈ W.edges, x ∈ closure t := by + intro u v W + induction W with + | nil _ => intro h0; simp [GraphWalk.length, GraphWalk.edges] at h0 + | @cons u' v' w' e hl rest ih => + intro _ hx + have hcap : closure e ∩ C.V = {u', v'} := hl.2.2.2 + have hu : u' ∈ closure e := (show u' ∈ closure e ∩ C.V by rw [hcap]; exact .inl rfl).1 + have hv : v' ∈ closure e := (show v' ∈ closure e ∩ C.V by rw [hcap]; exact .inr rfl).1 + rcases List.mem_cons.mp hx with rfl | hx + · exact ⟨e, List.mem_cons_self, hu⟩ + · cases rest with + | nil _ => + have : x = v' := by simpa [GraphWalk.support] using hx + exact ⟨e, List.mem_cons_self, this ▸ hv⟩ + | cons hl' r' => + obtain ⟨t, ht, hxt⟩ := ih (by simp [GraphWalk.length, GraphWalk.edges]) hx + exact ⟨t, List.mem_cons_of_mem _ ht, hxt⟩ + rw [hV] at hx + obtain ⟨t, ht, hxt⟩ := key W hlen hx + exact ⟨t, hE ▸ ht, hxt⟩ + +variable {X Y A B : Fin k → Set S} {E r : Fin (k + 1) → Set S} + +open Classical in +/-- The level of a point of `Δ`: one for each chord with the point on its second side, and one for +each chord with the point off its first side. A point of `P j` has level `2j + 1`. A point off the +paths has level twice the number of chords with the point on their second side. -/ +noncomputable def lev61 (X Y : Fin k → Set S) (y : S) : ℕ := + ∑ i, ((if y ∈ Y i then 1 else 0) + (if y ∈ X i then 0 else 1)) + +omit [T2Space S] in +theorem term_off {i : Fin k} {Xi Yi Ai Bi : Set S} + (hs : IsSide F Δ (P i).U a b i Xi Yi Ai Bi) {y : S} (hyΔ : y ∈ Δ) (hyR : y ∉ (P i).U) + [Decidable (y ∈ Xi)] [Decidable (y ∈ Yi)] : + ((if y ∈ Yi then 1 else 0) + (if y ∈ Xi then 0 else 1) : ℕ) = if y ∈ Xi then 0 else 2 := by + have h1 : y ∈ Xi ∪ Yi := hs.union ▸ hyΔ + have h2 : ¬ (y ∈ Xi ∧ y ∈ Yi) := fun h => hyR (hs.inter ▸ h) + rcases h1 with h1 | h1 <;> split_ifs <;> first | rfl | (exfalso; tauto) + +/-- **The sides of an edge of `K` in `Δ`.** Let `t` be an edge of `K` with closure in `Δ`, from a +vertex `v` of `Γ` to a vertex `w` of `K` off `Γ`. Then `w` is off `U(Γ)`, `v` lies on a path `P j`, +and +`t` lies on one side of each chord: on the second side of the chords before `P j`, and on the first +side +of the chords after it. -/ +theorem Pieces61.edge_sides (hp : Pieces61 Γ F Δ a b P X Y A B E r) (h : Setup61 Γ F Δ k a b P) + (hS : IsClosedSurface S) {K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) {t : Set S} (ht : t ∈ K.E) + (htΔ : closure t ⊆ Δ) {v w : S} (hv : v ∈ Γ.V) (hw : w ∈ K.V \ Γ.V) + (hc : closure t ∩ K.V = {v, w}) : + w ∉ Γ.U ∧ ∃ j, v ∈ (P j).U ∧ (∀ i, i < j → closure t ⊆ Y i) ∧ + (∀ i, j < i → closure t ⊆ X i) ∧ ∀ i, closure t ⊆ X i ∨ closure t ⊆ Y i := by + have hwU : w ∉ Γ.U := by + obtain ⟨r', hr', hwr⟩ := hK.2.2.2.1 w hw + exact not_mem_U_of_region hr' hwr + have htU : Disjoint t Γ.U := by + refine disjoint_left.mpr fun x hx hxU => edge_notMem_V ht hx ?_ + have : x ∈ (PaintingOrDrawing.drawing Γ).U ∩ K.U := ⟨hxU, K.closure_subset_U ht + (subset_closure hx)⟩ + rw [hK.1] at this + exact hK.2.1 this + have hvt : v ∈ closure t := (show v ∈ closure t ∩ K.V by rw [hc]; exact .inl rfl).1 + obtain ⟨j, hvj⟩ := h.U_inter hS (Γ.V_subset_U hv) (htΔ hvt) + have hside : ∀ i, closure t ⊆ X i ∨ closure t ⊆ Y i := by + intro i + have hcon : IsPreconnected t := ht.2.2.1.isConnected.isPreconnected + rcases subset_side (hp.side i).discX.isClosed (hp.side i).discY.isClosed hcon + (by rw [(hp.side i).union]; exact subset_closure.trans htΔ) + (by rw [(hp.side i).inter]; exact htU.mono_right (h.isSub i).U_subset) with h1 | h1 + · exact .inl (closure_minimal h1 (hp.side i).discX.isClosed) + · exact .inr (closure_minimal h1 (hp.side i).discY.isClosed) + have hoff : ∀ i, i ≠ j → v ∉ X i ∩ Y i := fun i hij hx => by + rw [(hp.side i).inter] at hx + exact disjoint_left.mp (h.disj hij.symm) hvj hx + refine ⟨hwU, j, hvj, fun i hij => ?_, fun i hij => ?_, hside⟩ + · refine (hside i).resolve_left fun hX => hoff i hij.ne ⟨hX hvt, ?_⟩ + exact R_after (h.chords hS) hp.side hij hvj + · refine (hside i).resolve_right fun hY => hoff i hij.ne' ⟨?_, hY hvt⟩ + exact R_before (h.chords hS) hp.side hij hvj + +/-- **An edge of `K` in `Δ` changes the level by one.** -/ +theorem Pieces61.lev_step (hp : Pieces61 Γ F Δ a b P X Y A B E r) (h : Setup61 Γ F Δ k a b P) + (hS : IsClosedSurface S) {K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) {t : Set S} (ht : t ∈ K.E) + (htΔ : closure t ⊆ Δ) {v w : S} (hv : v ∈ Γ.V) (hw : w ∈ K.V \ Γ.V) + (hc : closure t ∩ K.V = {v, w}) : + lev61 X Y v ≤ lev61 X Y w + 1 ∧ lev61 X Y w ≤ lev61 X Y v + 1 := by + classical + obtain ⟨hwU, j, hvj, -, -, hside⟩ := hp.edge_sides h hS hK ht htΔ hv hw hc + have hvt : v ∈ closure t := (show v ∈ closure t ∩ K.V by rw [hc]; exact .inl rfl).1 + have hwt : w ∈ closure t := (show w ∈ closure t ∩ K.V by rw [hc]; exact .inr rfl).1 + let f : S → Fin k → ℕ := fun y i => (if y ∈ Y i then 1 else 0) + (if y ∈ X i then 0 else 1) + have hlev : ∀ y, lev61 X Y y = f y j + ∑ i ∈ Finset.univ.erase j, f y i := fun y => + (Finset.add_sum_erase _ _ (Finset.mem_univ j)).symm + have hwR : ∀ i, w ∉ (P i).U := fun i hx => hwU ((h.isSub i).U_subset hx) + have hrest : ∑ i ∈ Finset.univ.erase j, f v i = ∑ i ∈ Finset.univ.erase j, f w i := by + refine Finset.sum_congr rfl fun i hi => ?_ + have hij : i ≠ j := Finset.ne_of_mem_erase hi + have hvR : v ∉ (P i).U := fun hx => disjoint_left.mp (h.disj hij.symm) hvj hx + simp only [f] + rw [term_off (hp.side i) (htΔ hvt) hvR, term_off (hp.side i) (htΔ hwt) (hwR i)] + rcases hside i with hX | hY + · simp [hX hvt, hX hwt] + · have h1 : v ∉ X i := fun hx => hvR ((hp.side i).inter ▸ ⟨hx, hY hvt⟩) + have h2 : w ∉ X i := fun hx => hwR i ((hp.side i).inter ▸ ⟨hx, hY hwt⟩) + simp [h1, h2] + have hfv : f v j = 1 := by + have hXY : v ∈ X j ∩ Y j := by rw [(hp.side j).inter]; exact hvj + simp [f, hXY.1, hXY.2] + have hfw : f w j = 0 ∨ f w j = 2 := by + simp only [f] + rw [term_off (hp.side j) (htΔ hwt) (hwR j)] + split_ifs <;> simp + rw [hlev v, hlev w, hrest, hfv] + omega + +omit [TopologicalSpace S] [T2Space S] in +open Classical in +theorem lev_eq_zero {y : S} (hy : ∀ i, y ∈ X i ∧ y ∉ Y i) : lev61 X Y y = 0 := by + unfold lev61 + refine Finset.sum_eq_zero fun i _ => ?_ + simp [(hy i).1, (hy i).2] + +omit [TopologicalSpace S] [T2Space S] in +open Classical in +theorem lev_eq_top {y : S} (hy : ∀ i, y ∉ X i ∧ y ∈ Y i) : lev61 X Y y = 2 * k := by + unfold lev61 + have : ∀ i : Fin k, ((if y ∈ Y i then 1 else 0) + (if y ∈ X i then 0 else 1) : ℕ) = 2 := + fun i => by simp [(hy i).1, (hy i).2] + simp only [this, Finset.sum_const, Finset.card_univ, Fintype.card_fin, smul_eq_mul] + omega + +/-- If no vertex of a circuit `C` of `K` in `Δ` has level `0`, then `U(C)` lies on the second side +of +the first chord. -/ +theorem Pieces61.U_sub_first (hp : Pieces61 Γ F Δ a b P X Y A B E r) (h : Setup61 Γ F Δ k a b P) + (hS : IsClosedSurface S) {K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) {C : Drawing S} (hC : C.IsCircuit) + (hCK : C.IsSubdrawing K) (hCΔ : C.U ⊆ Δ) {i₀ : Fin k} (hi₀ : i₀.1 = 0) + (hno : ∀ x ∈ C.V, lev61 X Y x ≠ 0) : C.U ⊆ Y i₀ := by + have hedge : ∀ t ∈ C.E, closure t ⊆ Y i₀ := by + intro t htC + have htK := hCK.2 htC + obtain ⟨v, hv, w, hw, hc⟩ := hK.2.2.2.2.1 t htK + have htΔ : closure t ⊆ Δ := (C.closure_subset_U htC).trans hCΔ + obtain ⟨hwU, j, -, hlt, hgt, hside⟩ := hp.edge_sides h hS hK htK htΔ hv hw hc + have hwt : w ∈ closure t ∩ K.V := by rw [hc]; exact .inr rfl + have hwC : w ∈ C.V := by + have : w ∈ closure t ∩ C.V := by rw [hCK.closure_inter_V htC]; exact hwt + exact this.2 + by_contra hnot + have hj : j = i₀ := by + by_contra hne + exact hnot (hlt i₀ (Fin.lt_def.mpr (by have := Fin.val_ne_of_ne hne; omega))) + subst hj + have hX : closure t ⊆ X j := (hside j).resolve_right hnot + refine hno w hwC (lev_eq_zero fun i => ?_) + have hXi : w ∈ X i := by + by_cases hij : i = j + · exact hij ▸ hX hwt.1 + · exact hgt i (Fin.lt_def.mpr (by have := Fin.val_ne_of_ne hij; omega)) hwt.1 + exact ⟨hXi, fun hYi => hwU ((h.isSub i).U_subset ((hp.side i).inter ▸ ⟨hXi, hYi⟩))⟩ + intro x hx + rw [C.U_eq] at hx + rcases hx with hx | hx + · obtain ⟨t, ht, hxt⟩ := IsCircuit.exists_edge_of_mem_V hC hx + exact hedge t ht hxt + · obtain ⟨t, ht, hxt⟩ := mem_iUnion₂.mp hx + exact hedge t ht hxt + +/-- If no vertex of a circuit `C` of `K` in `Δ` has level `2k`, then `U(C)` lies on the first side +of +the last chord. -/ +theorem Pieces61.U_sub_last (hp : Pieces61 Γ F Δ a b P X Y A B E r) (h : Setup61 Γ F Δ k a b P) + (hS : IsClosedSurface S) {K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) {C : Drawing S} (hC : C.IsCircuit) + (hCK : C.IsSubdrawing K) (hCΔ : C.U ⊆ Δ) {i₁ : Fin k} (hi₁ : i₁.1 + 1 = k) + (hno : ∀ x ∈ C.V, lev61 X Y x ≠ 2 * k) : C.U ⊆ X i₁ := by + have hedge : ∀ t ∈ C.E, closure t ⊆ X i₁ := by + intro t htC + have htK := hCK.2 htC + obtain ⟨v, hv, w, hw, hc⟩ := hK.2.2.2.2.1 t htK + have htΔ : closure t ⊆ Δ := (C.closure_subset_U htC).trans hCΔ + obtain ⟨hwU, j, -, hlt, hgt, hside⟩ := hp.edge_sides h hS hK htK htΔ hv hw hc + have hwt : w ∈ closure t ∩ K.V := by rw [hc]; exact .inr rfl + have hwC : w ∈ C.V := by + have : w ∈ closure t ∩ C.V := by rw [hCK.closure_inter_V htC]; exact hwt + exact this.2 + by_contra hnot + have hj : j = i₁ := by + by_contra hne + exact hnot (hgt i₁ (Fin.lt_def.mpr (by have := Fin.val_ne_of_ne hne; have := j.2; omega))) + subst hj + have hY : closure t ⊆ Y j := (hside j).resolve_left hnot + refine hno w hwC (lev_eq_top fun i => ?_) + have hYi : w ∈ Y i := by + by_cases hij : i = j + · exact hij ▸ hY hwt.1 + · exact hlt i (Fin.lt_def.mpr (by have := Fin.val_ne_of_ne hij; have := i.2; omega)) hwt.1 + exact ⟨fun hXi => hwU ((h.isSub i).U_subset ((hp.side i).inter ▸ ⟨hXi, hYi⟩)), hYi⟩ + intro x hx + rw [C.U_eq] at hx + rcases hx with hx | hx + · obtain ⟨t, ht, hxt⟩ := IsCircuit.exists_edge_of_mem_V hC hx + exact hedge t ht hxt + · obtain ⟨t, ht, hxt⟩ := mem_iUnion₂.mp hx + exact hedge t ht hxt + +/-- **A circuit around a point of the first path has a vertex of level `0`.** Let `C` be a circuit +of +`K` in `Δ` whose disc `I` contains a point `p` of `P_1` off `U(C)`. If no vertex of `C` had level +`0`, +then `U(C)` and so `I` would lie on the second side of the first chord (claim (1)). But `p` is in +the +closure of `D_0`, which is on the first side. -/ +theorem Pieces61.exists_low (hp : Pieces61 Γ F Δ a b P X Y A B E r) (h : Setup61 Γ F Δ k a b P) + (hS : IsClosedSurface S) [ConnectedSpace S] {K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle (PaintingOrDrawing.drawing Γ).toHypergraph θ T) (hθ : 3 ≤ θ) {C : Drawing S} + (hC : C.IsCircuit) (hCK : C.IsSubdrawing K) (hCΔ : C.U ⊆ Δ) {I : Set S} (hI : IsClosedDisc I) + (hIb : discBd I = C.U) + (hIT : ((PaintingOrDrawing.drawing Γ).inter I, (PaintingOrDrawing.drawing Γ).interOutside I) ∈ + T) + {i₀ : Fin k} (hi₀ : i₀.1 = 0) {p : S} (hpI : p ∈ I) (hpC : p ∉ C.U) (hpR : p ∈ (P i₀).U) : + ∃ x ∈ C.V, lev61 X Y x = 0 := by + by_contra hno + push Not at hno + have hU := hp.U_sub_first h hS hK hC hCK hCΔ hi₀ hno + have hIY := h.sub_of_bd_sub hS hT hθ hI hIT (hp.side i₀).discY + ((hp.side i₀).union ▸ subset_union_right) (hIb ▸ hU) + have hpint : p ∈ interior I := by + rw [interior_eq_sdiff_discBd hS hI, hIb] + exact ⟨hpI, hpC⟩ + have hpE : p ∈ closure (discInt (E i₀.castSucc)) := + (hp.disc _).subset_closure_discInt (Surface.discBd_subset _ ((hp.bd i₀).1 hpR)) + obtain ⟨z, hzY, hzD⟩ := mem_closure_iff.mp hpE _ isOpen_interior (interior_mono hIY hpint) + have hzX := hp.int_X i₀.castSucc i₀ (by simp) hzD + exact disjoint_left.mp (hp.int_P _ i₀) hzD ((hp.side i₀).inter ▸ ⟨hzX, interior_subset hzY⟩) + +/-- **A circuit around a point of the last path has a vertex of level `2k`.** This is +`exists_low` from the other end. -/ +theorem Pieces61.exists_high (hp : Pieces61 Γ F Δ a b P X Y A B E r) (h : Setup61 Γ F Δ k a b P) + (hS : IsClosedSurface S) [ConnectedSpace S] {K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle (PaintingOrDrawing.drawing Γ).toHypergraph θ T) (hθ : 3 ≤ θ) {C : Drawing S} + (hC : C.IsCircuit) (hCK : C.IsSubdrawing K) (hCΔ : C.U ⊆ Δ) {I : Set S} (hI : IsClosedDisc I) + (hIb : discBd I = C.U) + (hIT : ((PaintingOrDrawing.drawing Γ).inter I, (PaintingOrDrawing.drawing Γ).interOutside I) ∈ + T) + {i₁ : Fin k} (hi₁ : i₁.1 + 1 = k) {p : S} (hpI : p ∈ I) (hpC : p ∉ C.U) (hpR : p ∈ (P i₁).U) : + ∃ x ∈ C.V, lev61 X Y x = 2 * k := by + by_contra hno + push Not at hno + have hU := hp.U_sub_last h hS hK hC hCK hCΔ hi₁ hno + have hIX := h.sub_of_bd_sub hS hT hθ hI hIT (hp.side i₁).discX + ((hp.side i₁).union ▸ subset_union_left) (hIb ▸ hU) + have hpint : p ∈ interior I := by + rw [interior_eq_sdiff_discBd hS hI, hIb] + exact ⟨hpI, hpC⟩ + have hpE : p ∈ closure (discInt (E i₁.succ)) := + (hp.disc _).subset_closure_discInt (Surface.discBd_subset _ ((hp.bd i₁).2 hpR)) + obtain ⟨z, hzX, hzD⟩ := mem_closure_iff.mp hpE _ isOpen_interior (interior_mono hIX hpint) + have hzY := hp.int_Y i₁.succ i₁ (by simp) hzD + exact disjoint_left.mp (hp.int_P _ i₁) hzD ((hp.side i₁).inter ▸ ⟨interior_subset hzX, hzY⟩) + +/-! ### The disc of the circuit `Q_i` -/ + +theorem Setup61.a_V (h : Setup61 Γ F Δ k a b P) (i : Fin k) : a i ∈ (P i).V := by + obtain ⟨W, -, hV, -⟩ := (h.path i).1 + rw [hV] + exact W.start_mem_support + +theorem Setup61.b_V (h : Setup61 Γ F Δ k a b P) (i : Fin k) : b i ∈ (P i).V := by + obtain ⟨W, -, hV, -⟩ := (h.path i).1 + rw [hV] + exact W.end_mem_support + +/-- The lines of a star in a closed disc `D` from `c` to two points `x ≠ y` of the boundary make a +line +from `x` to `y` in `D` that meets the boundary only at `x` and `y`. With a line `R` from `x` to `y` +in +the boundary, it bounds a closed disc in `D`. -/ +theorem disc_of_star {D R Lx Ly : Set S} {c x y : S} (hD : IsClosedDisc D) + (hR : IsLineWithEnds R x y) (hRD : R ⊆ discBd D) + (hx : IsLineWithEnds Lx c x ∧ Lx ⊆ D ∧ Lx ∩ discBd D = {x}) + (hy : IsLineWithEnds Ly c y ∧ Ly ⊆ D ∧ Ly ∩ discBd D = {y}) (hxy : Lx ∩ Ly = {c}) : + ∃ G, IsClosedDisc G ∧ G ⊆ D ∧ discBd G = (Lx ∪ Ly) ∪ R ∧ (Lx ∪ Ly) ∩ R ⊆ {x, y} := by + have hJ : IsLineWithEnds (Lx ∪ Ly) x y := GM11.IsLineWithEnds.union hx.1 hy.1 hxy + have hcap : (Lx ∪ Ly) ∩ R ⊆ {x, y} := by + rintro z ⟨hz | hz, hzR⟩ + · have : z ∈ Lx ∩ discBd D := ⟨hz, hRD hzR⟩ + rw [hx.2.2] at this + exact .inl this + · have : z ∈ Ly ∩ discBd D := ⟨hz, hRD hzR⟩ + rw [hy.2.2] at this + exact .inr this + have hO : IsOArc ((Lx ∪ Ly) ∪ R) := isOArc_union hJ hR hcap + have hOD : (Lx ∪ Ly) ∪ R ⊆ D := + union_subset (union_subset hx.2.1 hy.2.1) (hRD.trans (Surface.discBd_subset _)) + obtain ⟨G, ⟨hGD, hG, hGb, -⟩, -⟩ := disc_oArc D _ hD hOD hO + exact ⟨G, hG, hGD, hGb, hcap⟩ + +/-- **The disc of `Q_i`.** The lines from the hubs `c_{i-1}` and `c_i` to the ends of `P_i` bound a +closed disc in `Δ` that includes `U(P_i)`. It is the union of the two discs that these lines cut off +from `DBar_{i-1}` and `DBar_i`, glued along `U(P_i)` (`disc_union`). -/ +theorem Pieces61.exists_Q_disc (hp : Pieces61 Γ F Δ a b P X Y A B E r) (h : Setup61 Γ F Δ k a b P) + {c : Fin (k + 1) → S} {L : Fin (k + 1) → S → Set S} + (hL : ∀ m, ∀ x ∈ sideVerts P m, IsLineWithEnds (L m x) (c m) x ∧ L m x ⊆ E m ∧ + L m x ∩ discBd (E m) = {x} ∧ ∀ y ∈ sideVerts P m, x ≠ y → L m x ∩ L m y = {c m}) + (i : Fin k) : + ∃ G, IsClosedDisc G ∧ G ⊆ Δ ∧ (P i).U ⊆ G ∧ + discBd G = (L i.castSucc (a i) ∪ L i.castSucc (b i)) ∪ (L i.succ (a i) ∪ L i.succ (b i)) := by + have ha₀ : a i ∈ sideVerts P i.castSucc := ⟨i, .inl rfl, h.a_V i⟩ + have hb₀ : b i ∈ sideVerts P i.castSucc := ⟨i, .inl rfl, h.b_V i⟩ + have ha₁ : a i ∈ sideVerts P i.succ := ⟨i, .inr rfl, h.a_V i⟩ + have hb₁ : b i ∈ sideVerts P i.succ := ⟨i, .inr rfl, h.b_V i⟩ + have hab := h.ne i + have hline := h.line i + obtain ⟨G₀, hG₀, hG₀E, hG₀b, hcap₀⟩ := disc_of_star (hp.disc i.castSucc) hline (hp.bd i).1 + ⟨(hL _ _ ha₀).1, (hL _ _ ha₀).2.1, (hL _ _ ha₀).2.2.1⟩ + ⟨(hL _ _ hb₀).1, (hL _ _ hb₀).2.1, (hL _ _ hb₀).2.2.1⟩ ((hL _ _ ha₀).2.2.2 _ hb₀ hab) + obtain ⟨G₁, hG₁, hG₁E, hG₁b, hcap₁⟩ := disc_of_star (hp.disc i.succ) hline (hp.bd i).2 + ⟨(hL _ _ ha₁).1, (hL _ _ ha₁).2.1, (hL _ _ ha₁).2.2.1⟩ + ⟨(hL _ _ hb₁).1, (hL _ _ hb₁).2.1, (hL _ _ hb₁).2.2.1⟩ ((hL _ _ ha₁).2.2.2 _ hb₁ hab) + have hR₀ : (P i).U ⊆ discBd G₀ := hG₀b ▸ subset_union_right + have hR₁ : (P i).U ⊆ discBd G₁ := hG₁b ▸ subset_union_right + have hinter : G₀ ∩ G₁ = (P i).U := by + refine subset_antisymm ?_ (subset_inter (hR₀.trans (Surface.discBd_subset _)) + (hR₁.trans (Surface.discBd_subset _))) + rintro z ⟨hz₀, hz₁⟩ + rw [← (hp.side i).inter] + exact ⟨hp.sub_X (i := i) (by simp) (hG₀E hz₀), hp.sub_Y (i := i) (by simp) (hG₁E hz₁)⟩ + obtain ⟨hG, hGb⟩ := disc_union G₀ G₁ (P i).U (a i) (b i) hG₀ hG₁ hline hinter hR₀ hR₁ + refine ⟨G₀ ∪ G₁, hG, union_subset (hG₀E.trans (hp.sub _)) (hG₁E.trans (hp.sub _)), + hR₀.trans ((Surface.discBd_subset _).trans subset_union_left), ?_⟩ + rw [hGb, hG₀b, hG₁b] + have ha : a i ∈ L i.castSucc (a i) ∪ L i.castSucc (b i) := .inl (hL _ _ ha₀).1.right_mem + have hb : b i ∈ L i.castSucc (a i) ∪ L i.castSucc (b i) := .inr (hL _ _ hb₀).1.right_mem + ext z + simp only [mem_sdiff, mem_union, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨(h1 | h1) | (h1 | h1), h2⟩ + · exact .inl h1 + · rcases not_and_or.mp h2 with h3 | h3 + · exact (h3 h1).elim + · push Not at h3 + rcases h3 with rfl | rfl + · exact .inl ha + · exact .inl hb + · exact .inr h1 + · rcases not_and_or.mp h2 with h3 | h3 + · exact (h3 h1).elim + · push Not at h3 + rcases h3 with rfl | rfl + · exact .inl ha + · exact .inl hb + · rintro (h1 | h1) + · refine ⟨.inl (.inl h1), fun ⟨hzR, hzab⟩ => hzab ?_⟩ + exact hcap₀ ⟨h1, hzR⟩ + · refine ⟨.inr (.inl h1), fun ⟨hzR, hzab⟩ => hzab ?_⟩ + exact hcap₁ ⟨h1, hzR⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section6Order.lean b/LeanPool/GraphMinor/GM12/Section6Order.lean new file mode 100644 index 0000000000..2c0ed5afe9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section6Order.lean @@ -0,0 +1,230 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.Surface.DiscGrow +public import LeanPool.GraphMinor.GM11.Forest + +/-! +# Graph Minors XII, Section 6: the two arcs at a chord + +In the setting of (6.1) the vertices of `F` are `v₁, …, v_{2k}` in order, and `P_i` joins `v_i` to +`v_{2k+1-i}`. So the ends of `P_i` cut `F` into two lines, and for `j ≠ i` both ends of `P_j` lie on +the same one of them. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface + +local notation "𝕀" => unitInterval + +variable {X : Type*} [TopologicalSpace X] [T2Space X] + +/-- Two parameters at distance less than a full turn have different images on the circle. -/ +theorem exp_inj_of_lt {x y : ℝ} (hxy : x < y) (hlt : y < x + 2 * Real.pi) : + Circle.exp x ≠ Circle.exp y := by + have hmem : x ∈ Ico x (x + 2 * Real.pi) := ⟨le_rfl, by linarith [Real.pi_pos]⟩ + exact fun h => hxy.ne + (Circle.exp_injOn_Ico (a := x) (b := x + 2 * Real.pi) (by simp) + hmem ⟨hxy.le, hlt⟩ h) + +/-- The arc of the circle from `x` to `y`, pushed into `F`, is a line, when `y - x < 2π`. -/ +theorem isLine_arc {F : Set X} (f : Circle ≃ₜ F) {x y : ℝ} (hxy : x < y) + (hlt : y ≤ x + 2 * Real.pi) (hne : (f (Circle.exp x)).1 ≠ (f (Circle.exp y)).1) : + IsLineWithEnds ((fun t => (f (Circle.exp t)).1) '' Icc x y) (f (Circle.exp x)).1 + (f (Circle.exp y)).1 := by + let g : ℝ → X := fun t => (f (Circle.exp t)).1 + have hg : Continuous g := by + have := f.continuous + fun_prop + let c : 𝕀 → ℝ := fun s => x + s.1 * (y - x) + have hc : Continuous c := by fun_prop + have hd : 0 < y - x := by linarith + have hcm : ∀ s, c s ∈ Icc x y := fun s => by + have h0 := s.2.1 + have h1 := s.2.2 + constructor + · have := mul_nonneg h0 hd.le + simp only [c] + linarith + · have := mul_le_mul_of_nonneg_right h1 hd.le + simp only [c] + linarith + have hinj : Function.Injective (g ∘ c) := by + intro s s' hss + by_contra hne' + have hval : s.1 ≠ s'.1 := fun h => hne' (Subtype.ext h) + have hfe : Circle.exp (c s) = Circle.exp (c s') := by + have : f (Circle.exp (c s)) = f (Circle.exp (c s')) := Subtype.ext hss + exact f.injective this + wlog hlts : s.1 < s'.1 generalizing s s' + · exact this hss.symm (Ne.symm hne') hval.symm hfe.symm + (lt_of_le_of_ne (not_lt.mp hlts) hval.symm) + have hcc : c s < c s' := by + simp only [c] + nlinarith + have hub : c s' < c s + 2 * Real.pi ∨ (c s = x ∧ c s' = y) := by + by_cases h0 : c s = x ∧ c s' = y + · exact .inr h0 + · left + rw [not_and_or] at h0 + have h1 := hcm s + have h2 := hcm s' + rcases h0 with h0 | h0 + · have : x < c s := lt_of_le_of_ne h1.1 (Ne.symm h0) + linarith [h2.2] + · have : c s' < y := lt_of_le_of_ne h2.2 h0 + linarith [h1.1] + rcases hub with hub | ⟨h0, h1⟩ + · exact exp_inj_of_lt hcc hub hfe + · apply hne + rw [← h0, ← h1, hfe] + have harc : IsArcMap (g ∘ c) := ⟨hg.comp hc, hinj⟩ + have hl := harc.isLineWithEnds + have hr : range (g ∘ c) = g '' Icc x y := by + ext z + constructor + · rintro ⟨s, rfl⟩ + exact ⟨c s, hcm s, rfl⟩ + · rintro ⟨w, hw, rfl⟩ + have hs : (w - x) / (y - x) ∈ unitInterval := + ⟨div_nonneg (by linarith [hw.1]) hd.le, (div_le_one hd).mpr (by linarith [hw.2])⟩ + refine ⟨⟨_, hs⟩, ?_⟩ + have : c ⟨_, hs⟩ = w := by + simp only [c] + field_simp + ring + simp only [Function.comp, this] + rw [hr] at hl + have h0 : (g ∘ c) 0 = (f (Circle.exp x)).1 := by simp [g, c] + have h1 : (g ∘ c) 1 = (f (Circle.exp y)).1 := by simp [g, c] + rwa [h0, h1] at hl + +/-- Every point of the circle has a parameter in a given window of one full turn. -/ +theorem exists_param (u : ℝ) (z : Circle) : + ∃ t ∈ Ico u (u + 2 * Real.pi), Circle.exp t = z := + GraphMinor.Surface.exists_circleExp_mem_Ico u z + +/-- Two parameters `u < v` less than a turn apart cut `F` into two lines. -/ +theorem exists_two_lines {F : Set X} (f : Circle ≃ₜ F) {u v : ℝ} (huv : u < v) + (hvu : v < u + 2 * Real.pi) : + ∃ M N : Set X, IsLineWithEnds M (f (Circle.exp u)).1 (f (Circle.exp v)).1 ∧ + IsLineWithEnds N (f (Circle.exp u)).1 (f (Circle.exp v)).1 ∧ M ∪ N = F ∧ + M ∩ N = {(f (Circle.exp u)).1, (f (Circle.exp v)).1} ∧ + (∀ w ∈ Icc u v, (f (Circle.exp w)).1 ∈ M) ∧ + (∀ w ∈ Icc v (u + 2 * Real.pi), (f (Circle.exp w)).1 ∈ N) := by + let g : ℝ → X := fun t => (f (Circle.exp t)).1 + have hne : g u ≠ g v := fun h => exp_inj_of_lt huv hvu (f.injective (Subtype.ext h)) + have hp : Circle.exp (u + 2 * Real.pi) = Circle.exp u := by simp + have hgp : g (u + 2 * Real.pi) = g u := by simp only [g, hp] + have l1 := isLine_arc f huv (by linarith) hne + have l2 := isLine_arc f hvu (by linarith [Real.pi_pos]) (by + change g v ≠ g (u + 2 * Real.pi) + rw [hgp] + exact hne.symm) + change IsLineWithEnds (g '' Icc v (u + 2 * Real.pi)) (g v) (g (u + 2 * Real.pi)) at l2 + rw [hgp] at l2 + refine ⟨g '' Icc u v, g '' Icc v (u + 2 * Real.pi), l1, GraphMinor.GM11.IsLineWithEnds.symm l2, + ?_, ?_, + fun w hw => ⟨w, hw, rfl⟩, fun w hw => ⟨w, hw, rfl⟩⟩ + · ext z + constructor + · rintro (⟨w, -, rfl⟩ | ⟨w, -, rfl⟩) <;> exact (f _).2 + · intro hz + obtain ⟨w, hw, he⟩ := exists_param u (f.symm ⟨z, hz⟩) + have hgw : g w = z := by simp [g, he] + by_cases hwv : w ≤ v + · exact .inl ⟨w, ⟨hw.1, hwv⟩, hgw⟩ + · exact .inr ⟨w, ⟨(not_le.mp hwv).le, hw.2.le⟩, hgw⟩ + · ext z + constructor + · rintro ⟨⟨w, hw, rfl⟩, ⟨w', hw', he⟩⟩ + have hee : Circle.exp w' = Circle.exp w := f.injective (Subtype.ext he) + by_cases hw1 : w = u + · exact .inl (by rw [hw1]) + by_cases hw2 : w = v + · exact .inr (by rw [hw2]; rfl) + exfalso + have h1 : u < w := lt_of_le_of_ne hw.1 (Ne.symm hw1) + have h2 : w < v := lt_of_le_of_ne hw.2 hw2 + have h3 : w < w' := by linarith [hw'.1] + have h4 : w' < w + 2 * Real.pi := by linarith [hw'.2] + exact exp_inj_of_lt h3 h4 hee.symm + · rintro (rfl | rfl) + · exact ⟨⟨u, ⟨le_rfl, huv.le⟩, rfl⟩, ⟨u + 2 * Real.pi, ⟨by linarith, le_rfl⟩, hgp⟩⟩ + · exact ⟨⟨v, ⟨huv.le, le_rfl⟩, rfl⟩, ⟨v, ⟨le_rfl, by linarith⟩, rfl⟩⟩ + +/-- The order on `F` of (6.1). The ends of `P_i` cut `F` into two lines. Both ends of each later +path lie on the first line, and both ends of each earlier path lie on the second. -/ +theorem exists_chord_arcs {F : Set X} {k : ℕ} {a b : Fin k → X} + (hord : IsListedInOrderOn F (List.ofFn a ++ (List.ofFn b).reverse)) (i : Fin k) : + ∃ M N : Set X, IsLineWithEnds M (a i) (b i) ∧ IsLineWithEnds N (a i) (b i) ∧ M ∪ N = F ∧ + M ∩ N = {a i, b i} ∧ (∀ j, i < j → a j ∈ M ∧ b j ∈ M) ∧ + (∀ j, j < i → a j ∈ N ∧ b j ∈ N) := by + obtain ⟨f, t, hmono, hlt, hl⟩ := hord + set l := List.ofFn a ++ (List.ofFn b).reverse with hldef + have hlen : l.length = 2 * k := by simp [hldef]; omega + have hA : ∀ j : Fin k, (f (Circle.exp (t j))).1 = a j := by + intro j + have hj : j.1 < l.length := by have := j.2; omega + rw [hl j.1 hj] + simp only [hldef] + rw [List.getElem_append_left (by simp)] + simp + have hB : ∀ j : Fin k, (f (Circle.exp (t (2 * k - 1 - j.1)))).1 = b j := by + intro j + have hj' := j.2 + have hj : 2 * k - 1 - j.1 < l.length := by omega + rw [hl _ hj] + simp only [hldef] + rw [List.getElem_append_right (by simp; omega)] + simp only [List.length_ofFn, List.getElem_reverse, List.getElem_ofFn] + congr 1 + apply Fin.ext + simp only + omega + have hi := i.2 + have hlast : t (2 * k - 1 - i.1) < t 0 + 2 * Real.pi := hlt _ (by omega) + have ht0 : t 0 ≤ t i.1 := hmono.monotone (Nat.zero_le _) + have huv : t i.1 < t (2 * k - 1 - i.1) := hmono (by omega) + obtain ⟨M, N, hM, hN, hu, hc, hin, hout⟩ := exists_two_lines f huv (by linarith) + rw [hA i, hB i] at hM hN hc + refine ⟨M, N, hM, hN, hu, hc, ?_, ?_⟩ + · intro j hj + have hij : i.1 < j.1 := hj + have hj' := j.2 + constructor + · rw [← hA j] + exact hin _ ⟨(hmono hij).le, (hmono (by omega)).le⟩ + · rw [← hB j] + exact hin _ ⟨(hmono (by omega)).le, (hmono (by omega)).le⟩ + · intro j hj + have hij : j.1 < i.1 := hj + have hj' := j.2 + have hper : ∀ w : ℝ, (f (Circle.exp (w + 2 * Real.pi))).1 = (f (Circle.exp w)).1 := by + intro w + simp + constructor + · rw [← hA j, ← hper] + refine hout _ ⟨?_, ?_⟩ + · have : t 0 ≤ t j.1 := hmono.monotone (Nat.zero_le _) + linarith + · have : t j.1 < t i.1 := hmono hij + linarith + · rw [← hB j] + have h2 : 2 * k - 1 - j.1 < l.length := by omega + refine hout _ ⟨(hmono (by omega)).le, ?_⟩ + have := hlt _ h2 + linarith + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section6Regions.lean b/LeanPool/GraphMinor/GM12/Section6Regions.lean new file mode 100644 index 0000000000..60339c4add --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section6Regions.lean @@ -0,0 +1,544 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section6Sides +public import LeanPool.GraphMinor.GM11.Section810 +public import LeanPool.GraphMinor.GM11.RadialAccess + +/-! +# Graph Minors XII, Section 6: the regions `r_0, …, r_k` + +"Since $\Gamma_1$ is 2-cell it follows that $r_0, r_1, \dots, r_{\theta/2}$ are all distinct." The +paper gives no more. +`no_bypass` fills this in. Suppose a path joins the two sides of a chord and misses the chord. A +part +of it runs outside `Δ` between two points of `F`, one on each of the two arcs of `F` at the chord. +Close this part up by a chord of `Δ`. This gives an `O`-arc inside one region of `Γ₁`, so it bounds +a +closed disc in this region, as the region is an open disc. The new chord cuts `Δ` in two, and each +side holds an end of the old chord. One side lies in the closed disc, and this is impossible since +the ends of the old chord are vertices of `Γ₁`. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +local notation "𝕀" => unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- Two disjoint closed sets of `[0, 1]`, one with `0` and one with `1`, have a gap between them. -/ +theorem exists_crossing {T T' : Set 𝕀} (hT : IsClosed T) (hT' : IsClosed T') (hd : Disjoint T T') + (h0 : (0 : 𝕀) ∈ T) (h1 : (1 : 𝕀) ∈ T') : + ∃ s s' : 𝕀, s < s' ∧ s ∈ T ∧ s' ∈ T' ∧ ∀ t, s < t → t < s' → t ∉ T ∧ t ∉ T' := by + have hne' : T'.Nonempty := ⟨1, h1⟩ + let s' := sInf T' + have hs' : s' ∈ T' := hT'.csInf_mem hne' (OrderBot.bddBelow _) + let A := T ∩ Iic s' + have hAc : IsClosed A := hT.inter isClosed_Iic + have hne : A.Nonempty := ⟨0, h0, show (⊥ : 𝕀) ≤ s' from bot_le⟩ + let s := sSup A + have hs : s ∈ A := hAc.csSup_mem hne (OrderTop.bddAbove _) + have hlt : s < s' := by + refine lt_of_le_of_ne hs.2 fun he => ?_ + have h2 : s ∈ T' := by + have : s = s' := he + rw [this] + exact hs' + exact Set.disjoint_left.mp hd hs.1 h2 + refine ⟨s, s', hlt, hs.1, hs', fun t h3 h4 => ⟨fun hx => ?_, fun hy => ?_⟩⟩ + · exact not_le.mpr h3 (le_csSup (OrderTop.bddAbove A) (show t ∈ A from ⟨hx, h4.le⟩)) + · exact not_le.mpr h4 (csInf_le (OrderBot.bddBelow T') hy) + +private theorem opposite_side_arc_meets_disc_only_at_ends + {S : Type u} + [TopologicalSpace S] + {Δ : Set S} + {X : Set S} + {Y : Set S} + (hu : X ∪ Y = Δ) + {p : S} + {q : S} + (c : Path p q) + (s : 𝕀) + (s' : 𝕀) + (hgap : ∀ (t : 𝕀), s < t → t < s' → t ∉ ⇑c ⁻¹' X ∧ t ∉ ⇑c ⁻¹' Y) + (hsn : ↑s < ↑s') + (u : 𝕀 → 𝕀) (huval : ∀ t : 𝕀, (u t).1 = s.1 + t.1 * (s'.1 - s.1)) + (n : S) + (m : S) + (hδ0 : c (u 0) = n) + (hδ1 : c (u 1) = m) + (e : 𝕀 → S) + (hrng : range e ⊆ range (fun t => c (u t))) : + ∀ z ∈ range e, z ∈ Δ → z = n ∨ z = m := by + intro z hz hzΔ + obtain ⟨t, rfl⟩ := hrng hz + by_cases h0 : t = 0 + · exact .inl (h0.symm ▸ hδ0) + by_cases h1 : t = 1 + · exact .inr (h1.symm ▸ hδ1) + exfalso + have ht0 : 0 < t.1 := lt_of_le_of_ne t.2.1 fun he => h0 (Subtype.ext he.symm) + have ht1 : t.1 < 1 := lt_of_le_of_ne t.2.2 fun he => h1 (Subtype.ext he) + have hd : 0 < s'.1 - s.1 := sub_pos.mpr hsn + have h3 : s < u t := by + change s.1 < (u t).1 + rw [huval] + nlinarith + have h4 : u t < s' := by + change (u t).1 < s'.1 + rw [huval] + nlinarith + obtain ⟨h5, h6⟩ := hgap _ h3 h4 + have hz : c (u t) ∈ X ∪ Y := by + rw [hu] + exact hzΔ + rcases hz with hz | hz + · exact h5 hz + · exact h6 hz + +/-- **No way around a chord.** See the module docstring. -/ +theorem no_bypass (hS : IsClosedSurface S) {Δ F X Y A B R : Set S} {a b : S} + (hΔ : IsClosedDisc Δ) (hbd : discBd Δ = F) (hX : IsClosed X) (hY : IsClosed Y) + (hu : X ∪ Y = Δ) (hi : X ∩ Y = R) (hAB : A ∪ B = F) (hABi : A ∩ B = {a, b}) + (hAc : IsClosed A) (hBc : IsClosed B) (hAX : A ⊆ X) (hBY : B ⊆ Y) {Γ₁ : Drawing S} + (hdisc : ∀ r ∈ Γ₁.R, IsOpenDisc r) + (hU : Γ₁.U ∩ Δ ⊆ F) (ha : a ∈ Γ₁.U) (hb : b ∈ Γ₁.U) {Z : Set S} (hZ : IsPathConnected Z) + (hZR : Disjoint Z R) (hZU : Disjoint Z Γ₁.U) {p q : S} (hp : p ∈ Z) (hq : q ∈ Z) (hpX : p ∈ X) + (hqY : q ∈ Y) : False := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hfr : frontier Δ = F := by rw [IsClosedDisc.frontier_eq_discBd hS hΔ, hbd] + have hXΔ : X ⊆ Δ := hu ▸ subset_union_left + have hYΔ : Y ⊆ Δ := hu ▸ subset_union_right + have hΔc : IsClosed Δ := hΔ.isClosed + have hXYZ : ∀ {x : S}, x ∈ Z → x ∈ X → x ∈ Y → False := fun hz h1 h2 => + Set.disjoint_left.mp hZR hz (hi ▸ ⟨h1, h2⟩) + have hoffU : ∀ {x : S}, x ∈ Z → x ∉ Γ₁.U := fun hz h1 => Set.disjoint_left.mp hZU hz h1 + obtain ⟨c, hc⟩ := hZ.joinedIn p hp q hq + have hcc : Continuous c := c.continuous + obtain ⟨s, s', hss, hsT, hsT', hgap⟩ := exists_crossing (hX.preimage hcc) (hY.preimage hcc) + (Set.disjoint_left.mpr fun t h1 h2 => hXYZ (hc t) h1 h2) + (by change c 0 ∈ X; rw [c.source]; exact hpX) (by change c 1 ∈ Y; rw [c.target]; exact hqY) + have hsn : s.1 < s'.1 := hss + let u : 𝕀 → 𝕀 := fun t => ⟨s.1 + t.1 * (s'.1 - s.1), by + have h1 := s.2.1 + have h2 := t.2.1 + have := mul_nonneg h2 (sub_nonneg.mpr hsn.le) + linarith, by + have h1 := t.2.2 + have h2 := s'.2.2 + have := mul_le_mul_of_nonneg_right h1 (sub_nonneg.mpr hsn.le) + linarith⟩ + have huc : Continuous u := by + refine Continuous.subtype_mk ?_ _ + fun_prop + let δ : 𝕀 → S := fun t => c (u t) + have hδ : Continuous δ := hcc.comp huc + have hu0 : u 0 = s := Subtype.ext (by simp [u]) + have hu1 : u 1 = s' := Subtype.ext (by simp [u]) + set n := c s with hn + set m := c s' with hm + have hδ0 : δ 0 = n := by simp only [δ, hu0, hn] + have hδ1 : δ 1 = m := by simp only [δ, hu1, hm] + have hnZ : n ∈ Z := hc s + have hmZ : m ∈ Z := hc s' + have hnm : n ≠ m := fun he => hXYZ hnZ hsT (he ▸ hsT') + obtain ⟨e, he, hei, he0, he1, hrng⟩ := exists_arc_of_path hδ (by rw [hδ0, hδ1]; exact hnm) + rw [hδ0] at he0 + rw [hδ1] at he1 + have harc : IsArcMap e := ⟨he, hei⟩ + have hL : IsLineWithEnds (range e) n m := he0 ▸ he1 ▸ harc.isLineWithEnds + have hLZ : range e ⊆ Z := by + rintro _ ⟨t, rfl⟩ + obtain ⟨t', ht'⟩ := hrng ⟨t, rfl⟩ + rw [← ht'] + exact hc _ + have hLΔ : ∀ z ∈ range e, z ∈ Δ → z = n ∨ z = m := by + exact opposite_side_arc_meets_disc_only_at_ends (S := S) (Δ := Δ) (X := X) (Y := Y) hu (p := + p) (q := q) c s s' hgap hsn u (fun _ => rfl) n m hδ0 hδ1 e hrng + have hLcl : closure (range e \ {n, m}) = range e := closure_sdiff_pair hL + have hcomp : range e \ {n, m} ⊆ Δᶜ := fun z hz hzΔ => by + rcases hLΔ z hz.1 hzΔ with rfl | rfl + · exact hz.2 (.inl rfl) + · exact hz.2 (.inr rfl) + have honF : ∀ {z : S}, z ∈ Δ → z ∈ range e → z ∈ F := fun hz hzL => by + rw [← hfr, frontier_eq_closure_inter_closure] + refine ⟨subset_closure hz, closure_mono hcomp (by rw [hLcl]; exact hzL)⟩ + have hnL : n ∈ range e := hL.left_mem + have hmL : m ∈ range e := hL.right_mem + have hnF : n ∈ F := honF (hXΔ hsT) hnL + have hmF : m ∈ F := honF (hYΔ hsT') hmL + have hnA : n ∈ A := by + rcases (hAB ▸ hnF : n ∈ A ∪ B) with h | h + · exact h + · exact (hXYZ hnZ hsT (hBY h)).elim + have hmB : m ∈ B := by + rcases (hAB ▸ hmF : m ∈ A ∪ B) with h | h + · exact (hXYZ hmZ (hAX h) hsT').elim + · exact h + have hnab : n ≠ a ∧ n ≠ b := ⟨fun h => hoffU hnZ (h ▸ ha), fun h => hoffU hnZ (h ▸ hb)⟩ + have hmab : m ≠ a ∧ m ≠ b := ⟨fun h => hoffU hmZ (h ▸ ha), fun h => hoffU hmZ (h ▸ hb)⟩ + obtain ⟨C₀, hC₀, hC₀Δ, hC₀F⟩ := chord_in_disc hΔ (hbd ▸ hnF) (hbd ▸ hmF) hnm + rw [hbd] at hC₀F + obtain ⟨e', harc', hr', he'0, he'1⟩ := hC₀.exists_arc + have hO : IsOArc (range e ∪ C₀) := by + rw [← hr'] + refine oArc_of_two_arcs harc harc' (by rw [he0, he'0]) (by rw [he1, he'1]) ?_ + intro t t' hee + have hz : e t ∈ Δ := hC₀Δ (hr' ▸ (hee ▸ mem_range_self t')) + rcases hLΔ _ ⟨t, rfl⟩ hz with h1 | h1 + · left + refine ⟨hei (h1.trans he0.symm), harc'.2 ?_⟩ + rw [← hee, h1, he'0] + · right + refine ⟨hei (h1.trans he1.symm), harc'.2 ?_⟩ + rw [← hee, h1, he'1] + have hC₀U : Disjoint C₀ Γ₁.U := by + refine Set.disjoint_left.mpr fun x hx hxU => ?_ + have hxF : x ∈ F := hU ⟨hxU, hC₀Δ hx⟩ + have : x ∈ ({n, m} : Set S) := hC₀F ▸ ⟨hx, hxF⟩ + rcases this with rfl | rfl + · exact hoffU hnZ hxU + · exact hoffU hmZ hxU + have hGU : Disjoint (range e ∪ C₀) Γ₁.U := + disjoint_union_left.mpr ⟨hZU.mono_left hLZ, hC₀U⟩ + have hGc : IsPreconnected (range e ∪ C₀) := + IsPreconnected.union n hnL hC₀.left_mem (line_conn hL) (line_conn hC₀) + obtain ⟨r', hr'R, hnr'⟩ := exists_region_of_notMem (hoffU hnZ) + have hsub : range e ∪ C₀ ⊆ r' := subset_region hr'R hGc hGU (Or.inl hnL) hnr' + obtain ⟨E, hEr, hE, hEb⟩ := exists_disc_in_openDisc (hdisc r' hr'R) hO hsub + have hoffE : ∀ {x : S}, x ∈ Γ₁.U → x ∉ E := fun hx hxE => region_subset hr'R (hEr hxE) hx + obtain ⟨Δ₁, Δ₂, A₁, A₂, lA₁, lA₂, hAu, -, d₁, d₂, hun, -, hb₁, hb₂⟩ := + split_disc hΔ hC₀Δ hnm hC₀ (by rw [hbd]; exact hC₀F) + have hAF : ∀ {A' : Set S}, A' ⊆ F → IsLineWithEnds A' n m → ∃ x ∈ A', x ∈ Γ₁.U := by + intro A' hA' hl + by_contra hc' + push Not at hc' + have hd : Disjoint A' (A ∩ B) := by + rw [hABi] + refine Set.disjoint_left.mpr ?_ + rintro x hx (rfl | rfl) + · exact hc' _ hx ha + · exact hc' _ hx hb + rcases subset_side hAc hBc (line_conn hl) (by rw [hAB]; exact hA') hd with h1 | h1 + · have : m ∈ A ∩ B := ⟨h1 hl.right_mem, hmB⟩ + rw [hABi] at this + rcases this with h | h + · exact hmab.1 h + · exact hmab.2 h + · have : n ∈ A ∩ B := ⟨hnA, h1 hl.left_mem⟩ + rw [hABi] at this + rcases this with h | h + · exact hnab.1 h + · exact hnab.2 h + have hA₁F : A₁ ⊆ F := by rw [← hbd, ← hAu]; exact subset_union_left + have hA₂F : A₂ ⊆ F := by rw [← hbd, ← hAu]; exact subset_union_right + obtain ⟨c₁, hc₁, hc₁U⟩ := hAF hA₁F lA₁ + obtain ⟨c₂, hc₂, hc₂U⟩ := hAF hA₂F lA₂ + obtain ⟨z, hzC, hzn⟩ := line_mid hC₀ + have hzF : z ∉ F := fun h => hzn (hC₀F ▸ ⟨hzC, h⟩) + have hzInt : z ∈ interior Δ := by + by_contra hc' + apply hzF + rw [← hfr] + exact ⟨subset_closure (hC₀Δ hzC), hc'⟩ + have hzE : z ∈ closure (discInt E) := + hE.subset_closure_discInt (GraphMinor.Surface.discBd_subset E (hEb ▸ Or.inr hzC)) + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp hzE _ isOpen_interior hzInt + have hwΔ : w ∈ Δ := interior_subset hw1 + have hwF : w ∉ F := by + rw [← hfr] + exact fun h => h.2 hw1 + have hwC : w ∉ C₀ := fun h => hw2.2 (hEb ▸ Or.inr h) + have key : ∀ {Δ' A' : Set S} {x : S}, IsClosedDisc Δ' → Δ' ⊆ Δ → discBd Δ' = A' ∪ C₀ → A' ⊆ F → + w ∈ Δ' → x ∈ A' → x ∈ Γ₁.U → False := by + intro Δ' A' x hd hsubΔ hbd' hA' hwΔ' hx hxU + have hint : w ∈ discInt Δ' := ⟨hwΔ', by + rw [hbd'] + rintro (h | h) + · exact hwF (hA' h) + · exact hwC h⟩ + have hdG : ∀ y ∈ discInt Δ', y ∉ discBd E := by + intro y hy hyG + rw [hEb] at hyG + apply hy.2 + rw [hbd'] + rcases hyG with h | h + · rcases hLΔ y h (hsubΔ hy.1) with rfl | rfl + · exact .inr hC₀.left_mem + · exact .inr hC₀.right_mem + · exact .inr h + have hdj : Disjoint (discInt E) Eᶜ := + Set.disjoint_left.mpr fun y h1 h2 => h2 h1.1 + have hcov : discInt Δ' ⊆ discInt E ∪ Eᶜ := by + intro y hy + by_cases hyE : y ∈ E + · exact .inl ⟨hyE, hdG y hy⟩ + · exact .inr hyE + rcases hd.isPreconnected_discInt.subset_or_subset (hE.isOpen_discInt hman) + hE.isClosed.isOpen_compl hdj hcov with h1 | h1 + · have h2 : Δ' ⊆ E := hd.subset_closure_discInt.trans + (closure_minimal (h1.trans sdiff_subset) hE.isClosed) + have hxΔ' : x ∈ Δ' := GraphMinor.Surface.discBd_subset _ (hbd' ▸ Or.inl hx) + exact hoffE hxU (h2 hxΔ') + · exact h1 hint hw2.1 + have hwd : w ∈ Δ₁ ∪ Δ₂ := by rw [hun]; exact hwΔ + rcases hwd with h1 | h1 + · exact key d₁ (hun ▸ subset_union_left) hb₁ hA₁F h1 hc₁ hc₁U + · exact key d₂ (hun ▸ subset_union_right) hb₂ hA₂F h1 hc₂ hc₂U + +/-- The drawing of (6.1): the facts on `Γ`, `F`, `Δ` and the paths `P_i`. -/ +structure Setup61 (Γ : Drawing S) (F Δ : Set S) (k : ℕ) (a b : Fin k → S) (P : Fin k → Drawing S) : + Prop where + /-- `F` is `Γ`-normal. -/ + normal : Γ.IsNormal F + /-- `Δ` is a closed disc. -/ + disc : IsClosedDisc Δ + /-- `Δ` is bounded by `F`. -/ + bd : subBd Δ = F + /-- The vertices on `F` are all different. -/ + nodup : (List.ofFn a ++ (List.ofFn b).reverse).Nodup + /-- They are in order on `F`. -/ + order : IsListedInOrderOn F (List.ofFn a ++ (List.ofFn b).reverse) + /-- They are all the vertices of `Γ` on `F`. -/ + verts : range a ∪ range b = F ∩ Γ.V + /-- Each `P i` is a path from `a i` to `b i` in `Γ ∩ Δ`. -/ + path : ∀ i, (P i).IsPathBetween (a i) (b i) ∧ (P i).IsSubdrawing (Γ.interSet Δ) + /-- The paths are disjoint. -/ + disj : Pairwise fun i j => Disjoint (P i).U (P j).U + /-- The paths are all of `Γ ∩ Δ`. -/ + cover : (Γ.interSet Δ).U = ⋃ i, (P i).U + +namespace Setup61 + +variable {Γ : Drawing S} {F Δ : Set S} {k : ℕ} {a b : Fin k → S} {P : Fin k → Drawing S} + +theorem ne (h : Setup61 Γ F Δ k a b P) (i : Fin k) : a i ≠ b i := by + intro he + have hd := (List.nodup_append.mp h.nodup).2.2 + exact hd (a i) (List.mem_ofFn.mpr ⟨i, rfl⟩) (b i) (List.mem_reverse.mpr (List.mem_ofFn.mpr ⟨i, + rfl⟩)) he + +theorem isSub (h : Setup61 Γ F Δ k a b P) (i : Fin k) : (P i).IsSubdrawing Γ := + (h.path i).2.trans interSet_isSub + +theorem line (h : Setup61 Γ F Δ k a b P) (i : Fin k) : IsLineWithEnds (P i).U (a i) (b i) := + GM14.isLine_of_isPathBetween (h.path i).1 (h.ne i) + +theorem U_sub (h : Setup61 Γ F Δ k a b P) (i : Fin k) : (P i).U ⊆ Δ := + (h.path i).2.U_subset.trans (interSet_U_subset h.disc.isClosed) + +theorem a_mem (h : Setup61 Γ F Δ k a b P) (i : Fin k) : a i ∈ F ∩ Γ.V := by + rw [← h.verts] + exact .inl ⟨i, rfl⟩ + +theorem b_mem (h : Setup61 Γ F Δ k a b P) (i : Fin k) : b i ∈ F ∩ Γ.V := by + rw [← h.verts] + exact .inr ⟨i, rfl⟩ + +/-- A point of `U(P i)` on `F` is an end of `P i`. -/ +theorem end_of_mem_F (h : Setup61 Γ F Δ k a b P) {i : Fin k} {x : S} (hx : x ∈ (P i).U) + (hF : x ∈ F) : x = a i ∨ x = b i := by + have hxV : x ∈ F ∩ Γ.V := ⟨hF, h.normal ⟨hF, (h.isSub i).U_subset hx⟩⟩ + rw [← h.verts] at hxV + have same : ∀ j, x ∈ (P j).U → j = i := fun j hj => by + by_contra hne + exact Set.disjoint_left.mp (h.disj hne) hj hx + rcases hxV with ⟨j, rfl⟩ | ⟨j, rfl⟩ + · rw [same j (h.line j).left_mem] + exact .inl rfl + · rw [same j (h.line j).right_mem] + exact .inr rfl + +/-- The lines `U(P i)` are chords of `Δ`. -/ +theorem chords (h : Setup61 Γ F Δ k a b P) (hS : IsClosedSurface S) : + Chords F Δ k a b fun i => (P i).U where + disc := h.disc + bd := by rw [← GraphMinor.GM14.IsClosedDisc.subBd_eq_discBd hS h.disc, h.bd] + line := h.line + sub := h.U_sub + meet i := by + refine subset_antisymm (fun x hx => h.end_of_mem_F hx.1 hx.2) ?_ + rintro _ (rfl | rfl) + · exact ⟨(h.line i).left_mem, (h.a_mem i).1⟩ + · exact ⟨(h.line i).right_mem, (h.b_mem i).1⟩ + disj _ _ hij := h.disj hij + ne := h.ne + arcs i := exists_chord_arcs h.order i + +/-- An edge of `Γ` that meets `Δ` lies in `Δ`, and is an edge of one of the paths. -/ +theorem edge_mem (h : Setup61 Γ F Δ k a b P) (hS : IsClosedSurface S) {g : Set S} (hg : g ∈ Γ.E) + (hm : (g ∩ Δ).Nonempty) : g ⊆ interior Δ ∧ ∃ i, g ∈ (P i).E := by + have hc := h.disc.isClosed + have hfr : frontier Δ = F := by + rw [IsClosedDisc.frontier_eq_discBd hS h.disc, ← GraphMinor.GM14.IsClosedDisc.subBd_eq_discBd + hS h.disc, h.bd] + have hoff : ∀ y ∈ g, y ∉ F := fun y hy hyF => + edge_notMem_V hg hy (h.normal ⟨hyF, Γ.closure_subset_U hg (subset_closure hy)⟩) + have hcov : g ⊆ interior Δ ∪ Δᶜ := by + intro y hy + by_cases hyΔ : y ∈ Δ + · refine .inl ?_ + by_contra hn + exact hoff y hy (hfr ▸ ⟨subset_closure hyΔ, hn⟩) + · exact .inr hyΔ + have hdj : Disjoint (interior Δ) Δᶜ := + Set.disjoint_left.mpr fun y h1 h2 => h2 (interior_subset h1) + have hsub : g ⊆ interior Δ := by + rcases hg.2.2.1.isConnected.isPreconnected.subset_or_subset isOpen_interior hc.isOpen_compl hdj + hcov with h1 | h1 + · exact h1 + · obtain ⟨y, hy, hyΔ⟩ := hm + exact (h1 hy hyΔ).elim + refine ⟨hsub, ?_⟩ + have hgI : g ∈ (Γ.interSet Δ).E := mem_interSet_E_iff.mpr ⟨hg, hsub.trans interior_subset⟩ + obtain ⟨x, hx⟩ := hg.1 + have hxU : x ∈ (Γ.interSet Δ).U := + (Γ.interSet Δ).closure_subset_U hgI (subset_closure hx) + rw [h.cover] at hxU + obtain ⟨i, hi⟩ := mem_iUnion.mp hxU + have hxV : x ∉ (P i).V := fun hv => edge_notMem_V hg hx ((h.isSub i).1 hv) + obtain ⟨e, he, hxe⟩ := (P i).exists_edge_of_mem hi hxV + have : g = e := Γ.edge_eq_of_mem hg ((h.isSub i).2 he) hx hxe + exact ⟨i, this ▸ he⟩ + +/-- Every point of `Γ` in `Δ` lies on a path. -/ +theorem U_inter (h : Setup61 Γ F Δ k a b P) (hS : IsClosedSurface S) {x : S} (hx : x ∈ Γ.U) + (hxΔ : x ∈ Δ) : ∃ i, x ∈ (P i).U := by + by_cases hxV : x ∈ Γ.V + · have : x ∈ (Γ.interSet Δ).U := + (Γ.interSet Δ).V_subset_U ((mem_interSet_V_iff h.disc.isClosed).mpr ⟨hxV, hxΔ⟩) + rw [h.cover] at this + exact mem_iUnion.mp this + · obtain ⟨g, hg, hxg⟩ := Γ.exists_edge_of_mem hx hxV + obtain ⟨-, i, hi⟩ := h.edge_mem hS hg ⟨x, hxg, hxΔ⟩ + exact ⟨i, (P i).closure_subset_U hi (subset_closure hxg)⟩ + +/-- An edge at an inner vertex of `P i` is an edge of `P i`. -/ +theorem edge_at_inner (h : Setup61 Γ F Δ k a b P) (hS : IsClosedSurface S) {i : Fin k} {x : S} + (hx : x ∈ (P i).U) (hxa : x ≠ a i) (hxb : x ≠ b i) {g : Set S} (hg : g ∈ Γ.E) + (hxg : x ∈ closure g) : g ∈ (P i).E := by + have hfr : frontier Δ = F := by + rw [IsClosedDisc.frontier_eq_discBd hS h.disc, ← GraphMinor.GM14.IsClosedDisc.subBd_eq_discBd + hS h.disc, h.bd] + have hxF : x ∉ F := fun hF => by + rcases h.end_of_mem_F hx hF with h1 | h1 + · exact hxa h1 + · exact hxb h1 + have hint : x ∈ interior Δ := by + by_contra hn + exact hxF (hfr ▸ ⟨subset_closure (h.U_sub i hx), hn⟩) + obtain ⟨y, hy, hyg⟩ := mem_closure_iff.mp hxg _ isOpen_interior hint + obtain ⟨-, j, hj⟩ := h.edge_mem hS hg ⟨y, hyg, interior_subset hy⟩ + have hxj : x ∈ (P j).U := (P j).closure_subset_U hj hxg + have : j = i := by + by_contra hne + exact Set.disjoint_left.mp (h.disj hne) hxj hx + exact this ▸ hj + +end Setup61 + +/-- The sides of the chords, the closed discs `DBar_m` between them, and the regions `r_m ⊇ D_m` of +(6.1). -/ +structure Pieces61 (Γ : Drawing S) (F Δ : Set S) {k : ℕ} (a b : Fin k → S) (P : Fin k → Drawing S) + (X Y A B : Fin k → Set S) (E r : Fin (k + 1) → Set S) : Prop where + side : ∀ i, IsSide F Δ (P i).U a b i (X i) (Y i) (A i) (B i) + disc : ∀ m, IsClosedDisc (E m) + sub : ∀ m, E m ⊆ Δ + bd : ∀ i, (P i).U ⊆ discBd (E i.castSucc) ∧ (P i).U ⊆ discBd (E i.succ) + int_X : ∀ m i, m.1 ≤ i.1 → discInt (E m) ⊆ X i + int_Y : ∀ m i, i.1 < m.1 → discInt (E m) ⊆ Y i + int_P : ∀ m i, Disjoint (discInt (E m)) (P i).U + reg : ∀ m, r m ∈ Γ.R + inj : Function.Injective r + int_r : ∀ m, discInt (E m) ⊆ r m + +namespace Setup61 + +variable {Γ : Drawing S} {F Δ : Set S} {k : ℕ} {a b : Fin k → S} {P : Fin k → Drawing S} + +/-- The regions of (6.1). `r m` is the region of `Γ` that includes `D_m`, with the numbering from +`0`. They are distinct since `Γ₁` is 2-cell, and each path lies between its two regions. -/ +theorem exists_regions (h : Setup61 Γ F Δ k a b P) (hS : IsClosedSurface S) + (hk : 0 < k) (h2 : (PaintingOrDrawing.drawing (Γ.interSet (closure (univ \ Δ)))).IsTwoCell) : + ∃ (X Y A B : Fin k → Set S) (E r : Fin (k + 1) → Set S), Pieces61 Γ F Δ a b P X Y A B E r ∧ + ∀ i : Fin k, (P i).U ⊆ closure (r i.castSucc) ∧ (P i).U ⊆ closure (r i.succ) := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hC := h.chords hS + have hex := fun i => hC.exists_side i + choose X Y A B hs using hex + obtain ⟨E, W, hEW, hEb, hW, hWd, hWX, hWY, hWc⟩ := exists_pieces hC hs hk + have hWU : ∀ m, Disjoint (W m) Γ.U := fun m => by + refine Set.disjoint_left.mpr fun x hx hxU => ?_ + obtain ⟨i, hi⟩ := h.U_inter hS hxU ((hW m).2.2 hx) + exact Set.disjoint_left.mp (hWd m i) hx hi + have hreg : ∀ m, ∃ r ∈ Γ.R, W m ⊆ r := fun m => by + obtain ⟨x, hx⟩ := (hW m).2.1 + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem (Set.disjoint_left.mp (hWU m) hx) + exact ⟨r, hr, subset_region hr (hW m).1 (hWU m) hx hxr⟩ + choose r hr hWr using hreg + have hsubU : (Γ.interSet (closure (univ \ Δ))).U ⊆ Γ.U := interSet_isSub.U_subset + have hfr : frontier Δ = F := by + rw [IsClosedDisc.frontier_eq_discBd hS h.disc, ← GraphMinor.GM14.IsClosedDisc.subBd_eq_discBd + hS h.disc, h.bd] + have hFcl : F ⊆ closure (univ \ Δ) := by + rw [← hfr, frontier_eq_closure_inter_closure] + intro x hx + rw [compl_eq_univ_sdiff] at hx + exact hx.2 + have hU₁ : (Γ.interSet (closure (univ \ Δ))).U ∩ Δ ⊆ F := by + rintro x ⟨hx, hxΔ⟩ + rw [← hfr, frontier_eq_closure_inter_closure] + refine ⟨subset_closure hxΔ, ?_⟩ + rw [compl_eq_univ_sdiff] + exact interSet_U_subset isClosed_closure hx + have hV₁ : ∀ {x : S}, x ∈ F ∩ Γ.V → x ∈ (Γ.interSet (closure (univ \ Δ))).U := fun hx => + (Γ.interSet _).V_subset_U ((mem_interSet_V_iff isClosed_closure).mpr ⟨hx.2, hFcl hx.1⟩) + have hinj : ∀ m m' : Fin (k + 1), m < m' → r m ≠ r m' := by + intro m m' hmm he + have hm' := m'.2 + have hmm' : m.1 < m'.1 := hmm + let i : Fin k := ⟨m.1, by omega⟩ + have hZ : IsPathConnected (r m) := isPathConnected_of_isOpen hS (region_isOpen (hr m)) + (region_isPreconnected (hr m)) (region_nonempty (hr m)) + obtain ⟨p, hp⟩ := (hW m).2.1 + obtain ⟨q, hq⟩ := (hW m').2.1 + have hd : Disjoint (r m) Γ.U := Set.disjoint_left.mpr fun x hx hxU => region_subset + (hr m) hx hxU + refine no_bypass hS h.disc hC.bd (hs i).discX.isClosed (hs i).discY.isClosed (hs i).union + (hs i).inter (hs i).arcs (hs i).arcs_inter (hs i).lineA.isCompact.isClosed + (hs i).lineB.isCompact.isClosed ?_ ?_ h2.2 hU₁ (hV₁ (h.a_mem i)) (hV₁ (h.b_mem i)) hZ + (hd.mono_right (h.isSub i).U_subset) (hd.mono_right hsubU) (hWr m hp) (he ▸ hWr m' hq) + (hWX m i le_rfl hp) (hWY m' i hmm' hq) + · exact (subset_union_left.trans (hs i).bdX.symm.subset).trans + (GraphMinor.Surface.discBd_subset _) + · exact (subset_union_left.trans (hs i).bdY.symm.subset).trans + (GraphMinor.Surface.discBd_subset _) + have hrinj : Function.Injective r := by + intro m m' he + rcases lt_trichotomy m m' with h1 | h1 | h1 + · exact (hinj m m' h1 he).elim + · exact h1 + · exact (hinj m' m h1 he.symm).elim + refine ⟨X, Y, A, B, E, r, ⟨hs, fun m => (hEW m).1, fun m => (hEW m).2.1, hEb, + fun m i hi => (hEW m).2.2 ▸ hWX m i hi, fun m i hi => (hEW m).2.2 ▸ hWY m i hi, + fun m i => (hEW m).2.2 ▸ hWd m i, hr, hrinj, fun m => (hEW m).2.2 ▸ hWr m⟩, + fun i => ⟨(hWc i).1.trans (closure_mono (hWr _)), (hWc i).2.trans (closure_mono (hWr _))⟩⟩ + +end Setup61 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section6Sides.lean b/LeanPool/GraphMinor/GM12/Section6Sides.lean new file mode 100644 index 0000000000..e90399b490 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section6Sides.lean @@ -0,0 +1,429 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section6Order +public import LeanPool.GraphMinor.GM12.Section2ArcComponents +import LeanPool.GraphMinor.GM12.Section2DiscChordSplit +public import LeanPool.GraphMinor.GM11.RadialBasics +public import LeanPool.GraphMinor.GM11.RadialChord +public import LeanPool.GraphMinor.GM14.DiscSlope +public import LeanPool.GraphMinor.Surface.ArcInPath +public import LeanPool.GraphMinor.Surface.TriPath +public import LeanPool.GraphMinor.Surface.DiscArcs +import Mathlib.Analysis.InnerProductSpace.Convex +import Mathlib.Analysis.Complex.Isometry +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.Surface.Fan + +/-! +# Graph Minors XII, Section 6: the discs `D_0, …, D_k` + +The proof of (6.1) starts: "The lines $U(P_1), \dots, U(P_{\theta/2})$ divide $\Delta - F$ into +$\theta/2 + 1$ open discs". +Each chord cuts `Δ` into two closed discs (`exists_side`), with the earlier chords on one side and +the +later chords on the other. Cutting the far side of one chord by the next chord gives the open disc +between them (`exists_pieces`). + +The paper then says that the regions `r_i ⊇ D_i` are distinct "since `Γ₁` is 2-cell". This is +`no_bypass`. A path from one side of a chord to the other that misses the chord must leave `Δ`. +Closing +it up through `Δ` gives an `O`-arc inside a region of `Γ₁`, so it bounds a closed disc in this +region. +Then one end of the chord lies in that disc, and it cannot, as it is a vertex of `Γ₁`. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 + +local notation "𝕀" => unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- Two points of the boundary of a closed disc are joined by a line through the interior. -/ +theorem chord_in_disc {Δ : Set S} (hΔ : IsClosedDisc Δ) {a b : S} (ha : a ∈ discBd Δ) + (hb : b ∈ discBd Δ) (hab : a ≠ b) : + ∃ L, IsLineWithEnds L a b ∧ L ⊆ Δ ∧ L ∩ discBd Δ = {a, b} := + Surface.exists_chord hΔ ha hb hab + +omit [T2Space S] in +/-- A preconnected set in the union of two closed sets that misses their meet lies in one of them. +-/ +theorem subset_side {X Y Z : Set S} (hX : IsClosed X) (hY : IsClosed Y) (hZ : IsPreconnected Z) + (hsub : Z ⊆ X ∪ Y) (hd : Disjoint Z (X ∩ Y)) : Z ⊆ X ∨ Z ⊆ Y := by + by_contra hc + rw [not_or, Set.not_subset, Set.not_subset] at hc + obtain ⟨⟨x, hx, hxX⟩, ⟨y, hy, hyY⟩⟩ := hc + have hxY : x ∈ Y := (hsub hx).resolve_left hxX + have hyX : y ∈ X := (hsub hy).resolve_right hyY + obtain ⟨w, hw, hw'⟩ := isPreconnected_closed_iff.mp hZ X Y hX hY hsub ⟨y, hy, hyX⟩ ⟨x, hx, hxY⟩ + exact Set.disjoint_left.mp hd hw hw' + +omit [T2Space S] in +/-- A line is connected. -/ +theorem line_conn {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : IsPreconnected L := + GraphMinor.Surface.IsLineWithEnds.isPreconnected h + +omit [T2Space S] in +/-- A line with ends `a, b` has a point other than its ends. -/ +theorem line_mid {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : (L \ {a, b}).Nonempty := + Surface.IsLineWithEnds.nonempty_sdiff h + +/-- A line through a closed disc, meeting the boundary in its two ends, cuts the disc in two. -/ +theorem split_with_arcs {D L A B : Set S} {a b : S} (hD : IsClosedDisc D) + (hL : IsLineWithEnds L a b) (hA : IsLineWithEnds A a b) (hB : IsLineWithEnds B a b) + (hAB : A ∩ B = {a, b}) (hLA : L ∩ A = {a, b}) (hLB : L ∩ B = {a, b}) + (hbd : discBd D = A ∪ B) (hLD : L ⊆ D) (hab : a ≠ b) : + ∃ E₁ E₂ : Set S, IsClosedDisc E₁ ∧ IsClosedDisc E₂ ∧ E₁ ∪ E₂ = D ∧ E₁ ∩ E₂ = L ∧ + discBd E₁ = A ∪ L ∧ discBd E₂ = B ∪ L := + GM12.disc_split_with_boundary_arcs_inter hD hL hA hB hAB hLA hLB hbd hLD hab + +/-- A line through a closed disc, meeting the boundary in its two ends, cuts the disc in two, and +the boundary into two lines. -/ +theorem split_disc {D L : Set S} {a b : S} (hD : IsClosedDisc D) (hLD : L ⊆ D) (hab : a ≠ b) + (hL : IsLineWithEnds L a b) (hc : L ∩ discBd D = {a, b}) : + ∃ E₁ E₂ A B, IsLineWithEnds A a b ∧ IsLineWithEnds B a b ∧ A ∪ B = discBd D ∧ A ∩ B = {a, b} ∧ + IsClosedDisc E₁ ∧ IsClosedDisc E₂ ∧ E₁ ∪ E₂ = D ∧ E₁ ∩ E₂ = L ∧ discBd E₁ = A ∪ L ∧ + discBd E₂ = B ∪ L := by + have hs : a ∈ discBd D := (hc ▸ (mem_insert a {b}) : a ∈ L ∩ discBd D).2 + have ht : b ∈ discBd D := (hc ▸ (Or.inr rfl : b ∈ ({a, b} : Set S)) : b ∈ L ∩ discBd D).2 + obtain ⟨x, y, hxy, hx0, hx1, hr⟩ := hD.isOArc_discBd.exists_arcs hs ht hab + have la : IsLineWithEnds (range x) a b := hx0 ▸ hx1 ▸ hxy.arc_left.isLineWithEnds + have lb : IsLineWithEnds (range y) a b := by + have := hxy.arc_right.isLineWithEnds + rwa [hxy.zero, hxy.one, hx0, hx1] at this + have hmeet : range x ∩ range y = {a, b} := by + ext z + constructor + · rintro ⟨⟨r, rfl⟩, ⟨r', e⟩⟩ + rcases hxy.meet r r' e.symm with ⟨h0, -⟩ | ⟨h1, -⟩ + · exact .inl (by rw [h0, hx0]) + · exact .inr (by rw [h1, hx1]; rfl) + · rintro (rfl | rfl) + · exact ⟨la.left_mem, lb.left_mem⟩ + · exact ⟨la.right_mem, lb.right_mem⟩ + have hcA : ∀ {G : Set S}, G ⊆ discBd D → a ∈ G → b ∈ G → L ∩ G = {a, b} := fun {G} hG ha hb => by + refine subset_antisymm (fun z hz => hc ▸ ⟨hz.1, hG hz.2⟩) ?_ + rintro _ (rfl | rfl) + · exact ⟨hL.left_mem, ha⟩ + · exact ⟨hL.right_mem, hb⟩ + obtain ⟨E₁, E₂, h1, h2, h3, h4, h5, h6⟩ := split_with_arcs hD hL la lb hmeet + (hcA (hr ▸ subset_union_left) la.left_mem la.right_mem) + (hcA (hr ▸ subset_union_right) lb.left_mem lb.right_mem) hr.symm hLD hab + exact ⟨E₁, E₂, _, _, la, lb, hr, hmeet, h1, h2, h3, h4, h5, h6⟩ + +/-- The hypotheses on the chords of `Δ` in (6.1). -/ +structure Chords (F Δ : Set S) (k : ℕ) (a b : Fin k → S) (R : Fin k → Set S) : Prop where + /-- `Δ` is a closed disc. -/ + disc : IsClosedDisc Δ + /-- `Δ` is bounded by `F`. -/ + bd : discBd Δ = F + /-- Each `R i` is a line from `a i` to `b i`. -/ + line : ∀ i, IsLineWithEnds (R i) (a i) (b i) + /-- Each `R i` lies in `Δ`. -/ + sub : ∀ i, R i ⊆ Δ + /-- Each `R i` meets `F` only in its ends. -/ + meet : ∀ i, R i ∩ F = {a i, b i} + /-- The lines are disjoint. -/ + disj : ∀ i j, i ≠ j → Disjoint (R i) (R j) + /-- The ends of `R i` differ. -/ + ne : ∀ i, a i ≠ b i + /-- The two arcs of `F` at `R i`. -/ + arcs : ∀ i, ∃ M N : Set S, IsLineWithEnds M (a i) (b i) ∧ IsLineWithEnds N (a i) (b i) ∧ + M ∪ N = F ∧ M ∩ N = {a i, b i} ∧ (∀ j, i < j → a j ∈ M ∧ b j ∈ M) ∧ + (∀ j, j < i → a j ∈ N ∧ b j ∈ N) + +/-- The two closed discs on the two sides of the chord `R i`. -/ +structure IsSide (F Δ R : Set S) {k : ℕ} (a b : Fin k → S) (i : Fin k) + (X Y A B : Set S) : Prop where + discX : IsClosedDisc X + discY : IsClosedDisc Y + union : X ∪ Y = Δ + inter : X ∩ Y = R + lineA : IsLineWithEnds A (a i) (b i) + lineB : IsLineWithEnds B (a i) (b i) + bdX : discBd X = A ∪ R + bdY : discBd Y = B ∪ R + arcs : A ∪ B = F + arcs_inter : A ∩ B = {a i, b i} + before : ∀ j, j < i → a j ∈ A ∧ b j ∈ A + after : ∀ j, i < j → a j ∈ B ∧ b j ∈ B + +variable {F Δ : Set S} {k : ℕ} {a b : Fin k → S} {R : Fin k → Set S} + +/-- Each chord cuts `Δ` into two closed discs, with the earlier chords on the first side. -/ +theorem Chords.exists_side (h : Chords F Δ k a b R) (i : Fin k) : + ∃ X Y A B, IsSide F Δ (R i) a b i X Y A B := by + obtain ⟨M, N, hM, hN, hu, hc, hb, ha⟩ := h.arcs i + have hcA : ∀ {G : Set S}, G ⊆ F → a i ∈ G → b i ∈ G → R i ∩ G = {a i, b i} := fun {G} hG h1 h2 + => by + refine subset_antisymm (fun z hz => h.meet i ▸ ⟨hz.1, hG hz.2⟩) ?_ + rintro _ (rfl | rfl) + · exact ⟨(h.line i).left_mem, h1⟩ + · exact ⟨(h.line i).right_mem, h2⟩ + obtain ⟨X, Y, hX, hY, hun, hin, hbX, hbY⟩ := split_with_arcs h.disc (h.line i) hN hM + (by rw [inter_comm]; exact hc) + (hcA (hu ▸ subset_union_right) hN.left_mem hN.right_mem) + (hcA (hu ▸ subset_union_left) hM.left_mem hM.right_mem) + (by rw [h.bd, union_comm, hu]) (h.sub i) (h.ne i) + exact ⟨X, Y, N, M, ⟨hX, hY, hun, hin, hN, hM, hbX, hbY, by rw [union_comm]; exact hu, + by rw [inter_comm]; exact hc, ha, hb⟩⟩ + +section Sides + +variable {X Y A B : Fin k → Set S} (h : Chords F Δ k a b R) + (hs : ∀ i, IsSide F Δ (R i) a b i (X i) (Y i) (A i) (B i)) + +include hs + +omit [T2Space S] in +theorem IsSide.R_sub_X (i : Fin k) : R i ⊆ X i := by + rw [← (hs i).inter] + exact inter_subset_left + +omit [T2Space S] in +theorem IsSide.R_sub_Y (i : Fin k) : R i ⊆ Y i := by + rw [← (hs i).inter] + exact inter_subset_right + +include h + +/-- An earlier chord lies on the first side of a later one. -/ +theorem R_before {i j : Fin k} (hj : j < i) : R j ⊆ X i := by + have hij : j ≠ i := hj.ne + have hd : Disjoint (R j) (X i ∩ Y i) := by + rw [(hs i).inter] + exact h.disj j i hij + rcases subset_side (hs i).discX.isClosed (hs i).discY.isClosed + (line_conn (h.line j)) (by rw [(hs i).union]; exact h.sub j) hd with h1 | h1 + · exact h1 + · have hA : a j ∈ X i := by + have : a j ∈ discBd (X i) := by + rw [(hs i).bdX] + exact .inl ((hs i).before j hj).1 + exact GraphMinor.Surface.discBd_subset _ this + exact (Set.disjoint_left.mp hd (h.line j).left_mem ⟨hA, h1 (h.line j).left_mem⟩).elim + +/-- A later chord lies on the second side of an earlier one. -/ +theorem R_after {i j : Fin k} (hj : i < j) : R j ⊆ Y i := by + have hij : j ≠ i := hj.ne' + have hd : Disjoint (R j) (X i ∩ Y i) := by + rw [(hs i).inter] + exact h.disj j i hij + rcases subset_side (hs i).discX.isClosed (hs i).discY.isClosed + (line_conn (h.line j)) (by rw [(hs i).union]; exact h.sub j) hd with h1 | h1 + · have hA : a j ∈ Y i := by + have : a j ∈ discBd (Y i) := by + rw [(hs i).bdY] + exact .inl ((hs i).after j hj).1 + exact GraphMinor.Surface.discBd_subset _ this + exact (Set.disjoint_left.mp hd (h.line j).left_mem ⟨h1 (h.line j).left_mem, hA⟩).elim + · exact h1 + +/-- The piece of `Y p` next to `R p`, cut off by the next chord `R q`. -/ +theorem mid_piece {p q : Fin k} (hpq : p < q) {E E' A₁ A₂ : Set S} (hE : IsClosedDisc E) + (hu : E ∪ E' = Y p) (hi : E ∩ E' = R q) (hbE : discBd E = A₁ ∪ R q) + (hbE' : discBd E' = A₂ ∪ R q) (hA : A₁ ∪ A₂ = discBd (Y p)) (hRp : R p ⊆ E) : + R q ⊆ closure (discInt E) ∧ Disjoint (discInt E) (R q) ∧ R p ⊆ closure (discInt E) ∧ + Disjoint (discInt E) (R p) ∧ discInt E ⊆ Y p ∧ discInt E ⊆ X q := by + have hsubE : discInt E ⊆ E := sdiff_subset + have hcl := hE.subset_closure_discInt + have hYΔ : Y p ⊆ Δ := by + rw [← (hs p).union] + exact subset_union_right + have hRq : R q ⊆ discBd E := by rw [hbE]; exact subset_union_right + have hRE : R q ⊆ E := hRq.trans (GraphMinor.Surface.discBd_subset E) + have hEY : E ⊆ Y p := by rw [← hu]; exact subset_union_left + have hd : Disjoint (discInt E) (R q) := disjoint_sdiff_left.mono_right hRq + have hdp : Disjoint (discInt E) (R p) := by + refine disjoint_sdiff_left.mono_right fun x hx => ?_ + have hxb : x ∈ discBd (Y p) := by + rw [(hs p).bdY] + exact .inr hx + rw [← hA] at hxb + rcases hxb with h1 | h2 + · rw [hbE] + exact .inl h1 + · have hxE' : x ∈ E' := GraphMinor.Surface.discBd_subset E' (by rw [hbE']; exact .inl h2) + have : x ∈ R q := hi ▸ ⟨hRp hx, hxE'⟩ + exact (Set.disjoint_left.mp (h.disj p q hpq.ne) hx this).elim + refine ⟨hRE.trans hcl, hd, hRp.trans hcl, hdp, hsubE.trans hEY, ?_⟩ + have hdq : Disjoint (discInt E) (X q ∩ Y q) := by rw [(hs q).inter]; exact hd + rcases subset_side (hs q).discX.isClosed (hs q).discY.isClosed hE.isPreconnected_discInt + (by rw [(hs q).union]; exact hsubE.trans (hEY.trans hYΔ)) hdq with h1 | h1 + · exact h1 + · exfalso + have hcY : closure (discInt E) ⊆ Y q := closure_minimal h1 (hs q).discY.isClosed + have hx := (h.line p).left_mem + have h2 : a p ∈ X q ∩ Y q := ⟨R_before h hs hpq hx, hcY (hRp.trans hcl hx)⟩ + rw [(hs q).inter] at h2 + exact Set.disjoint_left.mp (h.disj p q hpq.ne) hx h2 + +/-- The piece of `Δ` number `m`. It is `D_m` of the paper, with the numbering from `0`. -/ +theorem exists_chord_piece (m : ℕ) (hm : m ≤ k) (hk : 0 < k) : + ∃ E : Set S, IsClosedDisc E ∧ E ⊆ Δ ∧ + (∀ i : Fin k, i.1 = m → R i ⊆ discBd E ∧ discInt E ⊆ X i) ∧ + (∀ i : Fin k, i.1 + 1 = m → R i ⊆ discBd E ∧ discInt E ⊆ Y i) := by + by_cases h0 : m = 0 + · subst h0 + let i₀ : Fin k := ⟨0, hk⟩ + have hsub : discInt (X i₀) ⊆ X i₀ := sdiff_subset + have hXΔ : X i₀ ⊆ Δ := by rw [← (hs i₀).union]; exact subset_union_left + have hRb : R i₀ ⊆ discBd (X i₀) := by rw [(hs i₀).bdX]; exact subset_union_right + refine ⟨X i₀, (hs i₀).discX, hXΔ, ?_, fun i hi => by omega⟩ + intro i hi + have hii : i = i₀ := Fin.ext hi + rw [hii] + exact ⟨hRb, hsub⟩ + by_cases hk' : m = k + · subst hk' + let i₀ : Fin m := ⟨m - 1, by omega⟩ + have hsub : discInt (Y i₀) ⊆ Y i₀ := sdiff_subset + have hYΔ : Y i₀ ⊆ Δ := by rw [← (hs i₀).union]; exact subset_union_right + have hRb : R i₀ ⊆ discBd (Y i₀) := by rw [(hs i₀).bdY]; exact subset_union_right + refine ⟨Y i₀, (hs i₀).discY, hYΔ, fun i hi => by have := i.2; omega, ?_⟩ + intro i hi + have hii : i = i₀ := Fin.ext (by simp only [i₀]; omega) + rw [hii] + exact ⟨hRb, hsub⟩ + let p : Fin k := ⟨m - 1, by omega⟩ + let q : Fin k := ⟨m, by omega⟩ + have hpq : p < q := by + change m - 1 < m + omega + have hRq : R q ⊆ Y p := R_after h hs hpq + have hmeet : R q ∩ discBd (Y p) = {a q, b q} := by + rw [(hs p).bdY] + ext x + constructor + · rintro ⟨hx, h1 | h1⟩ + · have : x ∈ R q ∩ F := ⟨hx, (hs p).arcs ▸ Or.inr h1⟩ + rwa [h.meet q] at this + · exact (Set.disjoint_left.mp (h.disj q p hpq.ne') hx h1).elim + · rintro (rfl | rfl) + · exact ⟨(h.line q).left_mem, .inl ((hs p).after q hpq).1⟩ + · exact ⟨(h.line q).right_mem, .inl ((hs p).after q hpq).2⟩ + obtain ⟨E₁, E₂, A₁, A₂, -, -, hAu, -, hE₁, hE₂, hun, hin, hb₁, hb₂⟩ := + split_disc (hs p).discY hRq (h.ne q) (h.line q) hmeet + have hdp : Disjoint (R p) (E₁ ∩ E₂) := by rw [hin]; exact h.disj p q hpq.ne + have hRpY : R p ⊆ E₁ ∪ E₂ := by rw [hun]; exact IsSide.R_sub_Y hs p + have build : ∀ {E E' A₁ A₂ : Set S}, IsClosedDisc E → IsClosedDisc E' → E ∪ E' = Y p → + E ∩ E' = R q → discBd E = A₁ ∪ R q → discBd E' = A₂ ∪ R q → A₁ ∪ A₂ = discBd (Y p) → R p ⊆ E → + ∃ E : Set S, IsClosedDisc E ∧ E ⊆ Δ ∧ + (∀ i : Fin k, i.1 = m → R i ⊆ discBd E ∧ discInt E ⊆ X i) ∧ + (∀ i : Fin k, i.1 + 1 = m → R i ⊆ discBd E ∧ discInt E ⊆ Y i) := by + intro E E' A₁ A₂ hE hE' hu hi hbE hbE' hA hRp + obtain ⟨-, -, -, h4, h5, h6⟩ := mid_piece h hs hpq hE hu hi hbE hbE' hA hRp + have hYΔ : Y p ⊆ Δ := by rw [← (hs p).union]; exact subset_union_right + have hEY : E ⊆ Y p := by rw [← hu]; exact subset_union_left + refine ⟨E, hE, hEY.trans hYΔ, ?_, ?_⟩ + · intro i hi + have hii : i = q := Fin.ext hi + rw [hii] + exact ⟨by rw [hbE]; exact subset_union_right, h6⟩ + · intro i hi + have hii : i = p := Fin.ext (by simp only [p]; omega) + rw [hii] + refine ⟨fun x hx => ?_, h5⟩ + by_contra hn + exact Set.disjoint_left.mp h4 ⟨hRp hx, hn⟩ hx + rcases subset_side hE₁.isClosed hE₂.isClosed (line_conn (h.line p)) hRpY hdp with h1 | h1 + · exact build hE₁ hE₂ hun hin hb₁ hb₂ hAu h1 + · exact build hE₂ hE₁ (by rw [union_comm]; exact hun) (by rw [inter_comm]; exact hin) hb₂ hb₁ + (by rw [union_comm]; exact hAu) h1 + +/-- The pieces of `Δ`: `W m` lies before the chords from `m` on, after the chords before `m`, it +misses all chords, and the two chords next to it are in its closure. -/ +theorem exists_pieces (hk : 0 < k) : + ∃ E W : Fin (k + 1) → Set S, (∀ m, IsClosedDisc (E m) ∧ E m ⊆ Δ ∧ W m = discInt (E m)) ∧ + (∀ i : Fin k, R i ⊆ discBd (E i.castSucc) ∧ R i ⊆ discBd (E i.succ)) ∧ + (∀ m, IsPreconnected (W m) ∧ (W m).Nonempty ∧ W m ⊆ Δ) ∧ + (∀ m i, Disjoint (W m) (R i)) ∧ + (∀ m i, m.1 ≤ i.1 → W m ⊆ X i) ∧ (∀ m i, i.1 < m.1 → W m ⊆ Y i) ∧ + (∀ i : Fin k, R i ⊆ closure (W i.castSucc) ∧ R i ⊆ closure (W i.succ)) := by + have hc' := fun m : Fin (k + 1) => exists_chord_piece h hs m.1 (by have := m.2; omega) hk + choose E hE hEΔ hEX hEY using hc' + let W : Fin (k + 1) → Set S := fun m => discInt (E m) + have h1 : ∀ m, IsPreconnected (W m) := fun m => (hE m).isPreconnected_discInt + have h2 : ∀ m, (W m).Nonempty := fun m => (hE m).nonempty_discInt + have h3 : ∀ m, W m ⊆ Δ := fun m => sdiff_subset.trans (hEΔ m) + have hpiece : ∀ m (i : Fin k), R i ⊆ discBd (E m) → R i ⊆ closure (W m) ∧ Disjoint (W m) (R i) := + fun m i hR => ⟨(hR.trans (GraphMinor.Surface.discBd_subset _)).trans + (hE m).subset_closure_discInt, disjoint_sdiff_left.mono_right hR⟩ + have h4 : ∀ m (i : Fin k), i.1 = m.1 → R i ⊆ closure (W m) ∧ Disjoint (W m) (R i) ∧ W m ⊆ X i := + fun m i he => ⟨(hpiece m i (hEX m i he).1).1, (hpiece m i (hEX m i he).1).2, (hEX m i he).2⟩ + have h5 : ∀ m (i : Fin k), i.1 + 1 = m.1 → + R i ⊆ closure (W m) ∧ Disjoint (W m) (R i) ∧ W m ⊆ Y i := + fun m i he => ⟨(hpiece m i (hEY m i he).1).1, (hpiece m i (hEY m i he).1).2, (hEY m i he).2⟩ + have hle : ∀ m i, m.1 ≤ i.1 → W m ⊆ X i ∧ Disjoint (W m) (R i) := by + intro m i hmi + by_cases he : i.1 = m.1 + · exact ⟨(h4 m i he).2.2, (h4 m i he).2.1⟩ + let q : Fin k := ⟨m.1, by have := i.2; omega⟩ + have hqi : q < i := by + change m.1 < i.1 + omega + obtain ⟨h6, h7, h8⟩ := h4 m q rfl + have hd : Disjoint (W m) (R i) := by + refine Set.disjoint_left.mpr fun x hx hxi => ?_ + have : x ∈ R q := (hs q).inter ▸ ⟨h8 hx, R_after h hs hqi hxi⟩ + exact Set.disjoint_left.mp h7 hx this + refine ⟨?_, hd⟩ + have hdc : Disjoint (W m) (X i ∩ Y i) := by rw [(hs i).inter]; exact hd + rcases subset_side (hs i).discX.isClosed (hs i).discY.isClosed (h1 m) + (by rw [(hs i).union]; exact h3 m) hdc with h9 | h9 + · exact h9 + · exfalso + have hcY : closure (W m) ⊆ Y i := closure_minimal h9 (hs i).discY.isClosed + have hx := (h.line q).left_mem + have : a q ∈ X i ∩ Y i := ⟨R_before h hs hqi hx, hcY (h6 hx)⟩ + rw [(hs i).inter] at this + exact Set.disjoint_left.mp (h.disj q i hqi.ne) hx this + have hlt : ∀ m i, i.1 < m.1 → W m ⊆ Y i ∧ Disjoint (W m) (R i) := by + intro m i hmi + by_cases he : i.1 + 1 = m.1 + · exact ⟨(h5 m i he).2.2, (h5 m i he).2.1⟩ + have hm0 := m.2 + let p : Fin k := ⟨m.1 - 1, by omega⟩ + have hip : i < p := by + change i.1 < m.1 - 1 + omega + obtain ⟨h6, h7, h8⟩ := h5 m p (by simp only [p]; omega) + have hd : Disjoint (W m) (R i) := by + refine Set.disjoint_left.mpr fun x hx hxi => ?_ + have : x ∈ R p := (hs p).inter ▸ ⟨R_before h hs hip hxi, h8 hx⟩ + exact Set.disjoint_left.mp h7 hx this + refine ⟨?_, hd⟩ + have hdc : Disjoint (W m) (X i ∩ Y i) := by rw [(hs i).inter]; exact hd + rcases subset_side (hs i).discX.isClosed (hs i).discY.isClosed (h1 m) + (by rw [(hs i).union]; exact h3 m) hdc with h9 | h9 + · exfalso + have hcX : closure (W m) ⊆ X i := closure_minimal h9 (hs i).discX.isClosed + have hx := (h.line p).left_mem + have : a p ∈ X i ∩ Y i := ⟨hcX (h6 hx), R_after h hs hip hx⟩ + rw [(hs i).inter] at this + exact Set.disjoint_left.mp (h.disj p i hip.ne') hx this + · exact h9 + refine ⟨E, W, fun m => ⟨hE m, hEΔ m, rfl⟩, fun i => ⟨(hEX _ i rfl).1, (hEY _ i rfl).1⟩, + fun m => ⟨h1 m, h2 m, h3 m⟩, ?_, fun m i hi => (hle m i hi).1, fun m i hi => (hlt m i hi).1, + fun i => ⟨(h4 i.castSucc i rfl).1, (h5 i.succ i rfl).1⟩⟩ + intro m i + by_cases hi : m.1 ≤ i.1 + · exact (hle m i hi).2 + · exact (hlt m i (by omega)).2 + +end Sides + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section6Special.lean b/LeanPool/GraphMinor/GM12/Section6Special.lean new file mode 100644 index 0000000000..5455c4fb56 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section6Special.lean @@ -0,0 +1,165 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section6Regions +public import LeanPool.GraphMinor.GM12.Section3DiscStarLines +public import LeanPool.GraphMinor.GM11.RadialPrescribed + +/-! +# Graph Minors XII, Section 6: the special radial drawing of (6.1) + +The proof of (6.1) (page 258) says: "Since $\Gamma_1$ is 2-cell it follows that $r_0, r_1, \dots, +r_{\theta/2}$ are all distinct. Hence we may choose a radial drawing $K$ of $\Gamma$ such that for +$0 \le i \le \theta/2$, $D_i$ contains a vertex $v_i$ say of $K$, and $D_i$ includes edges of $K$ +from $v_i$ to every vertex of $P_i$ (if $i \ge 1$) and to every vertex of $P_{i+1}$ (if +$i < \theta/2$)." + +We do this here (`exists_special_radial`). In the closed disc `DBar_m` we draw lines from one inner +point `c m` to the vertices of the two paths on its boundary (`exists_star_lines_in_disc`). The +discs `DBar_m` overlap only on the paths (`discInt_disjoint`), so lines in different discs meet only +at +common ends. Then `exists_radial_with_spokes` gives a radial drawing with these lines as edges. The +regions `r_m` are distinct, so each has one point `c m`. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + {Γ : Drawing S} {F Δ : Set S} {k : ℕ} {a b : Fin k → S} {P : Fin k → Drawing S} + {X Y A B : Fin k → Set S} {E r : Fin (k + 1) → Set S} + +/-- The vertices on the boundary of the disc `DBar_m`: those of the paths next to it. -/ +def sideVerts (P : Fin k → Drawing S) (m : Fin (k + 1)) : Set S := + {x | ∃ i : Fin k, (i.castSucc = m ∨ i.succ = m) ∧ x ∈ (P i).V} + +/-- `DBar_m` lies on the far side of the chords before `m`, and on the near side of the others. -/ +theorem Pieces61.sub_X (hp : Pieces61 Γ F Δ a b P X Y A B E r) {m : Fin (k + 1)} {i : Fin k} + (hi : m.1 ≤ i.1) : E m ⊆ X i := + ((hp.disc m).subset_closure_discInt).trans + (closure_minimal (hp.int_X m i hi) (hp.side i).discX.isClosed) + +theorem Pieces61.sub_Y (hp : Pieces61 Γ F Δ a b P X Y A B E r) {m : Fin (k + 1)} {i : Fin k} + (hi : i.1 < m.1) : E m ⊆ Y i := + ((hp.disc m).subset_closure_discInt).trans + (closure_minimal (hp.int_Y m i hi) (hp.side i).discY.isClosed) + +/-- **Two discs `DBar_m` overlap only on the paths.** The inside of one misses the other. -/ +theorem Pieces61.discInt_disjoint (hp : Pieces61 Γ F Δ a b P X Y A B E r) {m m' : Fin (k + 1)} + (hne : m ≠ m') : Disjoint (discInt (E m)) (E m') := by + have hval : m.1 ≠ m'.1 := fun e => hne (Fin.ext e) + rcases Nat.lt_or_gt_of_ne hval with hlt | hlt + · let i : Fin k := ⟨m.1, by have := m'.2; omega⟩ + refine disjoint_left.mpr fun y hy hy' => ?_ + have h1 : y ∈ X i ∩ Y i := ⟨hp.int_X m i le_rfl hy, hp.sub_Y (i := i) hlt hy'⟩ + rw [(hp.side i).inter] at h1 + exact disjoint_left.mp (hp.int_P m i) hy h1 + · let i : Fin k := ⟨m'.1, by have := m.2; omega⟩ + refine disjoint_left.mpr fun y hy hy' => ?_ + have h1 : y ∈ X i ∩ Y i := ⟨hp.sub_X (i := i) le_rfl hy', hp.int_Y m i hlt hy⟩ + rw [(hp.side i).inter] at h1 + exact disjoint_left.mp (hp.int_P m i) hy h1 + +omit [T2Space S] in +theorem Pieces61.sideVerts_sub (hp : Pieces61 Γ F Δ a b P X Y A B E r) (m : Fin (k + 1)) : + sideVerts P m ⊆ discBd (E m) := by + rintro x ⟨i, hi, hx⟩ + have hxU := (P i).V_subset_U hx + rcases hi with rfl | rfl + · exact (hp.bd i).1 hxU + · exact (hp.bd i).2 hxU + +/-- **The special radial drawing of (6.1).** There is a radial drawing `K` of `Γ` with a vertex `c +m` +in each `D_m`, and for each vertex `x` of a path next to `D_m` an edge of `K` from `c m` to `x` +whose +closure is a line `L m x` in `DBar_m` that meets the boundary of `DBar_m` only at `x`. -/ +theorem exists_special_radial (h : Setup61 Γ F Δ k a b P) (hS : IsClosedSurface S) + (hT : (PaintingOrDrawing.drawing Γ).IsTwoCell) (hp : Pieces61 Γ F Δ a b P X Y A B E r) : + ∃ (K : Drawing S) (c : Fin (k + 1) → S) (L : Fin (k + 1) → S → Set S), + (PaintingOrDrawing.drawing Γ).IsRadialDrawing K ∧ + (∀ m, c m ∈ discInt (E m) ∧ c m ∈ K.V) ∧ + ∀ m, ∀ x ∈ sideVerts P m, IsLineWithEnds (L m x) (c m) x ∧ L m x ⊆ E m ∧ + L m x ∩ discBd (E m) = {x} ∧ (∀ y ∈ sideVerts P m, x ≠ y → L m x ∩ L m y = {c m}) ∧ + L m x \ {c m, x} ∈ K.E := by + classical + have hst := fun m => exists_star_lines_in_disc (hp.disc m) (hp.sideVerts_sub m) + choose c hc L hL hLL using hst + -- the point of each region + have : Nonempty S := ⟨c 0⟩ + let hub : Set S → S := fun s => + if hs : ∃ m, r m = s then c hs.choose else Classical.epsilon (· ∈ s) + have hub_r : ∀ m, hub (r m) = c m := by + intro m + have hs : ∃ m', r m' = r m := ⟨m, rfl⟩ + simp only [hub, dite_eq_left hs] + rw [hp.inj hs.choose_spec] + have hhub : ∀ s ∈ Γ.R, hub s ∈ s := by + intro s hs + by_cases hm : ∃ m, r m = s + · obtain ⟨m, rfl⟩ := hm + rw [hub_r] + exact hp.int_r m (hc m) + · simp only [hub, dite_eq_right hm] + exact Classical.epsilon_spec (region_nonempty hs) + have hZV : ∀ m, sideVerts P m ⊆ Γ.V := by + rintro m x ⟨i, -, hx⟩ + exact (h.isSub i).1 hx + have hfin : {p : Fin (k + 1) × S | p.2 ∈ sideVerts P p.1}.Finite := + (finite_univ.prod Γ.finite_V).subset fun p hp' => ⟨mem_univ _, hZV p.1 hp'⟩ + let s : Finset (Fin (k + 1) × S) := hfin.toFinset + have hs : ∀ p, p ∈ s ↔ p.2 ∈ sideVerts P p.1 := fun p => by simp [s] + have hLr : ∀ m, ∀ x ∈ sideVerts P m, L m x \ {x} ⊆ r m := by + intro m x hx y ⟨hyL, hyx⟩ + refine hp.int_r m ⟨(hL m x hx).2.1 hyL, fun hyb => hyx ?_⟩ + have : y ∈ L m x ∩ discBd (E m) := ⟨hyL, hyb⟩ + rwa [(hL m x hx).2.2] at this + obtain ⟨K, hK, hKV, hKE⟩ := exists_radial_with_spokes hS hT hub hhub (fun p => r p.1) + (fun p => p.2) (fun p => L p.1 p.2) s (fun p _ => hp.reg p.1) + (fun p hp' => hZV p.1 ((hs p).mp hp')) + (fun p hp' => by rw [hub_r]; exact (hL p.1 p.2 ((hs p).mp hp')).1) + (fun p hp' => hLr p.1 p.2 ((hs p).mp hp')) + (by + rintro ⟨m, x⟩ hp₁ ⟨m', x'⟩ hp₂ hne y ⟨hy, hy'⟩ + have hx := (hs _).mp hp₁ + have hx' := (hs _).mp hp₂ + simp only at hx hx' hy hy' ⊢ + rw [hub_r] + by_cases hmm : m = m' + · subst hmm + have hxx : x ≠ x' := fun e => hne (by rw [e]) + have := hLL m x hx x' hx' hxx + have hyc : y ∈ L m x ∩ L m x' := ⟨hy, hy'⟩ + rw [this] at hyc + exact Or.inl hyc + · by_cases hyx : y = x + · exact Or.inr hyx + · exfalso + have hyi : y ∈ discInt (E m) := ⟨(hL m x hx).2.1 hy, fun hyb => hyx (by + have : y ∈ L m x ∩ discBd (E m) := ⟨hy, hyb⟩ + rwa [(hL m x hx).2.2] at this)⟩ + exact disjoint_left.mp (hp.discInt_disjoint hmm) hyi ((hL m' x' hx').2.1 hy')) + (by + rintro ⟨m, x⟩ - ⟨m', x'⟩ - hρ hxx + simp only at hρ hxx + rw [hp.inj hρ, hxx]) + refine ⟨K, c, L, hK, fun m => ⟨hc m, hub_r m ▸ hKV (r m) (hp.reg m)⟩, ?_⟩ + intro m x hx + refine ⟨(hL m x hx).1, (hL m x hx).2.1, (hL m x hx).2.2, hLL m x hx, ?_⟩ + have := hKE (m, x) ((hs _).mpr hx) + simp only [hub_r] at this + exact this + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section6Walk.lean b/LeanPool/GraphMinor/GM12/Section6Walk.lean new file mode 100644 index 0000000000..9d049229b4 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section6Walk.lean @@ -0,0 +1,364 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section6Claims +public import LeanPool.GraphMinor.GM11.EvenCircuit +public import LeanPool.GraphMinor.GM11.ThreeCircuits +public import LeanPool.GraphMinor.GM11.RadialFacts +public import LeanPool.GraphMinor.GM11.RadialTwoCell +public import LeanPool.GraphMinor.GM11.RadialCorners +public import LeanPool.GraphMinor.GM11.Section5b +public import LeanPool.GraphMinor.GM14.RigidThread +public import LeanPool.GraphMinor.GM11.Section85 +public import LeanPool.GraphMinor.GM11.Rings +public import LeanPool.GraphMinor.GM11.CircuitRegions +public import LeanPool.GraphMinor.GM11.Restraints +public import LeanPool.GraphMinor.GM11.Section7 +import LeanPool.GraphMinor.GM10.Section6 + +/-! +# Graph Minors XII, Section 6: the walk `W` + +The paper takes for `W` a trace of a homeomorphism of the circle onto `F`. With the radial drawing +`K` +of `exists_special_radial`, this trace is the walk `h₀, a₁, h₁, a₂, h₂, …, a_k, h_k, b_k, h_{k-1}, +…, +b₁, h₀` through the hubs `h_m` of the discs `D_m` and the ends of the paths. We write it out +(`exists_W`). It has length `2θ = 4k`. For each path `P_i` it uses the four spokes from the ends of +`P_i` to the hubs on its two sides, and these spokes form a circuit `Q_i` (`exists_Q`). +-/ + + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- The regions `r m` of (6.1), and their hubs in `K`. -/ +structure Hubs (Γ K : Drawing S) {k : ℕ} (P : Fin k → Drawing S) (r : Fin (k + 1) → Set S) + (c : Fin (k + 1) → S) : Prop where + /-- Each `r m` is a region of `Γ`. -/ + r_mem : ∀ m, r m ∈ Γ.R + /-- The regions are distinct. -/ + r_inj : Function.Injective r + /-- Each path lies on its two regions. -/ + side : ∀ i : Fin k, (P i).U ⊆ closure (r i.castSucc) ∧ (P i).U ⊆ closure (r i.succ) + /-- The hub lies in its region. -/ + c_mem : ∀ m, c m ∈ r m + /-- The hub is a vertex of `K`. -/ + c_V : ∀ m, c m ∈ K.V + +/-- The spokes at the ends of the paths, one from each end to each of its two hubs. -/ +structure Spokes (Γ K : Drawing S) {k : ℕ} (a b : Fin k → S) (P : Fin k → Drawing S) + (c : Fin (k + 1) → S) (α₀ α₁ β₀ β₁ : Fin k → Set S) : Prop where + mem_α₀ : ∀ i, α₀ i ∈ K.E + mem_α₁ : ∀ i, α₁ i ∈ K.E + mem_β₀ : ∀ i, β₀ i ∈ K.E + mem_β₁ : ∀ i, β₁ i ∈ K.E + cap_α₀ : ∀ i, closure (α₀ i) ∩ K.V = {a i, c i.castSucc} + cap_α₁ : ∀ i, closure (α₁ i) ∩ K.V = {a i, c i.succ} + cap_β₀ : ∀ i, closure (β₀ i) ∩ K.V = {b i, c i.castSucc} + cap_β₁ : ∀ i, closure (β₁ i) ∩ K.V = {b i, c i.succ} + +variable [ConnectedSpace S] + +omit [T2Space S] [ConnectedSpace S] in +/-- Every edge of `Γ` lies in a region of a pre-radial drawing `K`. -/ +theorem edge_region (hS : IsClosedSurface S) {Γ K : Drawing S} + (hrad : PreRad (PaintingOrDrawing.drawing Γ) K) {f : Set S} (hf : f ∈ Γ.E) : + ∃ s ∈ K.R, f ⊆ s := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨y, hy⟩ := hf.1 + have hd := edge_disjoint hrad hf + obtain ⟨s, hs, hys⟩ := exists_region_of_notMem (Set.disjoint_left.mp hd hy) + exact ⟨s, hs, subset_region hs hf.2.2.1.isConnected.isPreconnected hd hy hys⟩ + +variable {Γ K : Drawing S} {F Δ : Set S} {k : ℕ} {a b : Fin k → S} {P : Fin k → Drawing S} + {r : Fin (k + 1) → Set S} {c : Fin (k + 1) → S} (h : Setup61 Γ F Δ k a b P) + (hh : Hubs Γ K P r c) + +variable {α₀ α₁ β₀ β₁ : Fin k → Set S} + +section Facts + +omit [T2Space S] [ConnectedSpace S] in +theorem hub_notMem (hh : Hubs Γ K P r c) (m : Fin (k + 1)) : c m ∉ Γ.V := + notMem_V_of_mem_region (hh.r_mem m) (hh.c_mem m) + +omit [T2Space S] [ConnectedSpace S] in +theorem hub_inj (hh : Hubs Γ K P r c) {m m' : Fin (k + 1)} (he : c m = c m') : m = m' := by + have : r m = r m' := region_eq_of_mem (hh.r_mem m) (hh.r_mem m') (hh.c_mem m) (he ▸ hh.c_mem m') + exact hh.r_inj this + +include h + +omit [ConnectedSpace S] in +theorem same_path {i j : Fin k} {x : S} (hi : x ∈ (P i).U) (hj : x ∈ (P j).U) : i = j := by + by_contra hne + exact Set.disjoint_left.mp (h.disj hne) hi hj + +omit [ConnectedSpace S] in +theorem a_inj {i j : Fin k} (he : a i = a j) : i = j := + same_path h (h.line i).left_mem (he ▸ (h.line j).left_mem) + +omit [ConnectedSpace S] in +theorem b_inj {i j : Fin k} (he : b i = b j) : i = j := + same_path h (h.line i).right_mem (he ▸ (h.line j).right_mem) + +omit [ConnectedSpace S] in +theorem a_ne_b (i j : Fin k) : a i ≠ b j := fun he => by + have hij : i = j := same_path h (h.line i).left_mem (he ▸ (h.line j).right_mem) + subst hij + exact h.ne i he + +omit [ConnectedSpace S] in +theorem a_ne_hub (hh : Hubs Γ K P r c) (i : Fin k) (m : Fin (k + 1)) : a i ≠ c m := fun he => + hub_notMem hh m (he ▸ (h.a_mem i).2) + +omit [ConnectedSpace S] in +theorem b_ne_hub (hh : Hubs Γ K P r c) (i : Fin k) (m : Fin (k + 1)) : b i ≠ c m := fun he => + hub_notMem hh m (he ▸ (h.b_mem i).2) + +end Facts + +omit [T2Space S] [ConnectedSpace S] in +theorem cap_ne {t t' : Set S} {u d u' d' : S} (hc : closure t ∩ K.V = {u, d}) + (hc' : closure t' ∩ K.V = {u', d'}) (hu : u ∈ Γ.V) (hd' : d' ∉ Γ.V) (hne : u ≠ u' ∨ d ≠ d') : + t ≠ t' := by + rintro rfl + rw [hc] at hc' + rcases Set.pair_eq_pair_iff.mp hc' with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · exact hne.elim (· h1) (· h2) + · exact hd' (h1 ▸ hu) + +omit [T2Space S] [ConnectedSpace S] in +/-- A link from a spoke. -/ +theorem spoke_link {e : Set S} {x y : S} (he : e ∈ K.E) (hc : closure e ∩ K.V = {x, y}) : + K.toGraph.IsLink e x y := by + have hx : x ∈ closure e ∩ K.V := by rw [hc]; exact .inl rfl + have hy : y ∈ closure e ∩ K.V := by rw [hc]; exact .inr rfl + exact ⟨he, hx.2, hy.2, hc⟩ + +omit [T2Space S] [ConnectedSpace S] in +omit [TopologicalSpace S] in +theorem pair_swap {x y : S} {A : Set S} (h : A = {x, y}) : A = {y, x} := h.trans (pair_comm x y) + +omit [T2Space S] [TopologicalSpace S] [ConnectedSpace S] in +theorem eq_of_pair_eq_singleton {x y z : S} (h : ({x, y} : Set S) = {z}) : x = y := by + have h1 : x ∈ ({z} : Set S) := h ▸ .inl rfl + have h2 : y ∈ ({z} : Set S) := h ▸ .inr rfl + exact h1.trans h2.symm + +omit [T2Space S] [ConnectedSpace S] in +/-- A walk up the chain of hubs, through the points `p i`. -/ +theorem exists_spine {K : Drawing S} {k : ℕ} {c : Fin (k + 1) → S} {p : Fin k → S} + {t₀ t₁ : Fin k → Set S} (h₀ : ∀ i, t₀ i ∈ K.E) (h₁ : ∀ i, t₁ i ∈ K.E) + (c₀ : ∀ i, closure (t₀ i) ∩ K.V = {p i, c i.castSucc}) + (c₁ : ∀ i, closure (t₁ i) ∩ K.V = {p i, c i.succ}) (h0V : c 0 ∈ K.V) : + ∀ (m : ℕ) (hm : m < k + 1), ∃ w : GraphWalk K.toGraph (c 0) (c ⟨m, hm⟩), w.length = 2 * m ∧ + (∀ e, e ∈ w.edges ↔ ∃ i : Fin k, i.1 < m ∧ (e = t₀ i ∨ e = t₁ i)) ∧ + (∀ x ∈ w.support, (∃ j, x = c j) ∨ ∃ i, x = p i) := by + intro m + induction m with + | zero => + intro hm + refine ⟨.nil h0V, rfl, fun e => ?_, ?_⟩ + · simp [GraphWalk.edges] + · intro x hx + exact .inl ⟨0, by simpa [GraphWalk.support] using hx⟩ + | succ m ih => + intro hm + obtain ⟨w, hl, he, hs⟩ := ih (by omega) + let i : Fin k := ⟨m, by omega⟩ + have l₀ : K.toGraph.IsLink (t₀ i) (c ⟨m, by omega⟩) (p i) := spoke_link (h₀ i) (pair_swap + (c₀ i)) + have l₁ : K.toGraph.IsLink (t₁ i) (p i) (c ⟨m + 1, hm⟩) := spoke_link (h₁ i) (c₁ i) + refine ⟨w.append (.cons l₀ (.cons l₁ (.nil l₁.2.2.1))), ?_, fun e => ?_, fun x hx => ?_⟩ + · rw [GraphWalk.length_append, hl] + simp only [GraphWalk.length, GraphWalk.edges, List.length_cons, List.length_nil] + omega + · rw [GraphWalk.edges_append, List.mem_append, he] + simp only [GraphWalk.edges, List.mem_cons, List.not_mem_nil, or_false] + constructor + · rintro (⟨j, hj, hh⟩ | hh) + · exact ⟨j, by omega, hh⟩ + · exact ⟨i, by simp [i], hh⟩ + · rintro ⟨j, hj, hh⟩ + by_cases hjm : j.1 < m + · exact .inl ⟨j, hjm, hh⟩ + · have : j = i := Fin.ext (by simp [i]; omega) + exact .inr (this ▸ hh) + · rcases (GraphWalk.mem_support_append _ _).mp hx with hx | hx + · exact hs x hx + · simp only [GraphWalk.support, List.mem_cons, List.not_mem_nil, or_false] at hx + rcases hx with rfl | rfl | rfl + · exact .inl ⟨_, rfl⟩ + · exact .inr ⟨_, rfl⟩ + · exact .inl ⟨_, rfl⟩ + +omit [T2Space S] [ConnectedSpace S] in +/-- **The walk `W`.** It goes up the hubs through the points `a i`, and back through the points +`b i`. -/ +theorem exists_W (sp : Spokes Γ K a b P c α₀ α₁ β₀ β₁) (h0V : c 0 ∈ K.V) : + ∃ W : GraphWalk K.toGraph (c 0) (c 0), W.length = 4 * k ∧ + (∀ e, e ∈ W.edges ↔ ∃ i, e = α₀ i ∨ e = α₁ i ∨ e = β₀ i ∨ e = β₁ i) ∧ + (∀ x ∈ W.support, (∃ j, x = c j) ∨ ∃ i, x = a i ∨ x = b i) := by + obtain ⟨u, hul, hue, hus⟩ := exists_spine sp.mem_α₀ sp.mem_α₁ sp.cap_α₀ sp.cap_α₁ h0V k (by omega) + obtain ⟨d, hdl, hde, hds⟩ := exists_spine sp.mem_β₀ sp.mem_β₁ sp.cap_β₀ sp.cap_β₁ h0V k (by omega) + refine ⟨u.append d.reverse, ?_, fun e => ?_, fun x hx => ?_⟩ + · rw [GraphWalk.length_append, GraphWalk.length_reverse, hul, hdl] + omega + · rw [GraphWalk.edges_append, GraphWalk.edges_reverse, List.mem_append, List.mem_reverse, hue, + hde] + constructor + · rintro (⟨i, -, h1 | h1⟩ | ⟨i, -, h1 | h1⟩) + · exact ⟨i, .inl h1⟩ + · exact ⟨i, .inr (.inl h1)⟩ + · exact ⟨i, .inr (.inr (.inl h1))⟩ + · exact ⟨i, .inr (.inr (.inr h1))⟩ + · rintro ⟨i, h1 | h1 | h1 | h1⟩ + · exact .inl ⟨i, i.2, .inl h1⟩ + · exact .inl ⟨i, i.2, .inr h1⟩ + · exact .inr ⟨i, i.2, .inl h1⟩ + · exact .inr ⟨i, i.2, .inr h1⟩ + · rcases (GraphWalk.mem_support_append _ _).mp hx with hx | hx + · rcases hus x hx with h1 | ⟨i, h1⟩ + · exact .inl h1 + · exact .inr ⟨i, .inl h1⟩ + · rw [GraphWalk.support_reverse, List.mem_reverse] at hx + rcases hds x hx with h1 | ⟨i, h1⟩ + · exact .inl h1 + · exact .inr ⟨i, .inr h1⟩ + +include h hh in +omit [ConnectedSpace S] in +/-- **The circuit `Q i`** of the four spokes at the ends of `P i`. -/ +theorem exists_Q (sp : Spokes Γ K a b P c α₀ α₁ β₀ β₁) (i : Fin k) : + ∃ Q : Drawing S, Q.IsCircuit ∧ Q.IsSubdrawing K ∧ Q.length ≤ 4 ∧ + Q.V = {c i.castSucc, a i, c i.succ, b i} ∧ Q.E = {α₀ i, α₁ i, β₁ i, β₀ i} := by + have l₀ := spoke_link (sp.mem_α₀ i) (pair_swap (sp.cap_α₀ i)) + have l₁ := spoke_link (sp.mem_α₁ i) (sp.cap_α₁ i) + have l₂ := spoke_link (sp.mem_β₁ i) (pair_swap (sp.cap_β₁ i)) + have l₃ := spoke_link (sp.mem_β₀ i) (sp.cap_β₀ i) + have hc : c i.castSucc ≠ c i.succ := fun he => + (Fin.castSucc_lt_succ (i := i)).ne (hub_inj hh he) + have hab := a_ne_b h i i + have hac := a_ne_hub h hh i + have hbc := b_ne_hub h hh i + have ha := (h.a_mem i).2 + have hb := (h.b_mem i).2 + have hn := hub_notMem hh + let W : GraphWalk K.toGraph (c i.castSucc) (c i.castSucc) := + .cons l₀ (.cons l₁ (.cons l₂ (.cons l₃ (.nil l₀.2.1)))) + have hW : W.IsSimpleClosed := by + constructor + · simp only [W, GraphWalk.support, List.tail_cons, List.nodup_cons, List.mem_cons, + List.not_mem_nil, or_false, not_or, List.nodup_nil, and_true, not_false_eq_true] + exact ⟨⟨hac _, hab, hac _⟩, ⟨(hbc i.succ).symm, hc.symm⟩, hbc _⟩ + · simp only [W, GraphWalk.edges, List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, + not_or, List.nodup_nil, and_true, not_false_eq_true] + refine ⟨⟨?_, ?_, ?_⟩, ⟨?_, ?_⟩, ?_⟩ + · exact cap_ne (sp.cap_α₀ i) (sp.cap_α₁ i) ha (hn _) (.inr hc) + · exact cap_ne (sp.cap_α₀ i) (sp.cap_β₁ i) ha (hn _) (.inl hab) + · exact cap_ne (sp.cap_α₀ i) (sp.cap_β₀ i) ha (hn _) (.inl hab) + · exact cap_ne (sp.cap_α₁ i) (sp.cap_β₁ i) ha (hn _) (.inl hab) + · exact cap_ne (sp.cap_α₁ i) (sp.cap_β₀ i) ha (hn _) (.inl hab) + · exact cap_ne (sp.cap_β₁ i) (sp.cap_β₀ i) hb (hn _) (.inr hc.symm) + have hE : (walkDrawing K W).E = {α₀ i, α₁ i, β₁ i, β₀ i} := by + rw [walkDrawing_E] + ext e + simp [W, GraphWalk.edges] + refine ⟨walkDrawing K W, isCircuit_walkDrawing K hW (by simp [W, GraphWalk.length, + GraphWalk.edges]), + walkDrawing_isSubdrawing K W, ?_, ?_, hE⟩ + · rw [Drawing.length, hE] + refine (ncard_insert_le _ _).trans ?_ + have h3 := ncard_insert_le (α₁ i) {β₁ i, β₀ i} + have h2 := ncard_insert_le (β₁ i) {β₀ i} + rw [ncard_singleton] at h2 + omega + · rw [walkDrawing_V] + ext x + simp [W, GraphWalk.support] + tauto + + +omit [ConnectedSpace S] in +/-- The ends of an edge `L \ {c, x}` of a drawing, whose closure is the line `L` from `c` to `x`. -/ +theorem cap_of_line {K : Drawing S} {L : Set S} {c x : S} (hL : IsLineWithEnds L c x) + (he : L \ {c, x} ∈ K.E) : closure (L \ {c, x}) ∩ K.V = {x, c} := by + have hcl := closure_sdiff_pair hL + have hdiff := K.closure_diff_V he + have hend : ∀ z ∈ ({c, x} : Set S), z ∈ K.V := by + intro z hz + by_contra hzV + have hzL : z ∈ closure (L \ {c, x}) := by + rw [hcl] + rcases hz with rfl | rfl + · exact hL.left_mem + · exact hL.right_mem + have : z ∈ closure (L \ {c, x}) \ K.V := ⟨hzL, hzV⟩ + rw [hdiff] at this + exact this.2 hz + ext z + constructor + · rintro ⟨hzL, hzV⟩ + by_contra hz + have hz' : z ∉ ({c, x} : Set S) := by + rintro (rfl | rfl) + · exact hz (.inr rfl) + · exact hz (.inl rfl) + rw [hcl] at hzL + exact edge_notMem_V he ⟨hzL, hz'⟩ hzV + · rintro (rfl | rfl) + · refine ⟨?_, hend _ (.inr rfl)⟩ + rw [hcl] + exact hL.right_mem + · refine ⟨?_, hend _ (.inl rfl)⟩ + rw [hcl] + exact hL.left_mem + +omit [ConnectedSpace S] in +/-- **The special radial drawing of (6.1), with its hubs and spokes.** -/ +theorem exists_hubs_spokes (h : Setup61 Γ F Δ k a b P) (hS : IsClosedSurface S) + (hT : (PaintingOrDrawing.drawing Γ).IsTwoCell) {X Y A B : Fin k → Set S} + {E : Fin (k + 1) → Set S} (hp : Pieces61 Γ F Δ a b P X Y A B E r) + (hside : ∀ i : Fin k, (P i).U ⊆ closure (r i.castSucc) ∧ (P i).U ⊆ closure (r i.succ)) : + ∃ (K : Drawing S) (c : Fin (k + 1) → S) (L : Fin (k + 1) → S → Set S), + (PaintingOrDrawing.drawing Γ).IsRadialDrawing K ∧ Hubs Γ K P r c ∧ + (∀ m, c m ∈ discInt (E m)) ∧ + (∀ m, ∀ x ∈ sideVerts P m, IsLineWithEnds (L m x) (c m) x ∧ L m x ⊆ E m ∧ + L m x ∩ discBd (E m) = {x} ∧ ∀ y ∈ sideVerts P m, x ≠ y → L m x ∩ L m y = {c m}) ∧ + Spokes Γ K a b P c (fun i => L i.castSucc (a i) \ {c i.castSucc, a i}) + (fun i => L i.succ (a i) \ {c i.succ, a i}) (fun i => L i.castSucc + (b i) \ {c i.castSucc, b i}) + (fun i => L i.succ (b i) \ {c i.succ, b i}) := by + obtain ⟨K, c, L, hK, hc, hL⟩ := exists_special_radial h hS hT hp + have ha₀ : ∀ i : Fin k, a i ∈ sideVerts P i.castSucc := fun i => ⟨i, .inl rfl, h.a_V i⟩ + have hb₀ : ∀ i : Fin k, b i ∈ sideVerts P i.castSucc := fun i => ⟨i, .inl rfl, h.b_V i⟩ + have ha₁ : ∀ i : Fin k, a i ∈ sideVerts P i.succ := fun i => ⟨i, .inr rfl, h.a_V i⟩ + have hb₁ : ∀ i : Fin k, b i ∈ sideVerts P i.succ := fun i => ⟨i, .inr rfl, h.b_V i⟩ + refine ⟨K, c, L, hK, ⟨hp.reg, hp.inj, hside, fun m => hp.int_r m (hc m).1, fun m => (hc m).2⟩, + fun m => (hc m).1, fun m x hx => ⟨(hL m x hx).1, (hL m x hx).2.1, (hL m x hx).2.2.1, + (hL m x hx).2.2.2.1⟩, ⟨fun i => (hL _ _ (ha₀ i)).2.2.2.2, fun i => (hL _ _ (ha₁ i)).2.2.2.2, + fun i => (hL _ _ (hb₀ i)).2.2.2.2, fun i => (hL _ _ (hb₁ i)).2.2.2.2, fun i => ?_, fun i + => ?_, + fun i => ?_, fun i => ?_⟩⟩ + · exact cap_of_line (hL _ _ (ha₀ i)).1 (hL _ _ (ha₀ i)).2.2.2.2 + · exact cap_of_line (hL _ _ (ha₁ i)).1 (hL _ _ (ha₁ i)).2.2.2.2 + · exact cap_of_line (hL _ _ (hb₀ i)).1 (hL _ _ (hb₀ i)).2.2.2.2 + · exact cap_of_line (hL _ _ (hb₁ i)).1 (hL _ _ (hb₁ i)).2.2.2.2 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section7.lean b/LeanPool/GraphMinor/GM12/Section7.lean new file mode 100644 index 0000000000..bd21daafcb --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section7.lean @@ -0,0 +1,314 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.TangleLemmas +public import LeanPool.GraphMinor.GM11.Section7b + +/-! +# Graph Minors XII, Section 7: deletion + +`theorem_7_1` is (7.1) of the paper: a member `(A', B')` of order `1` of a tangle `𝒯` restricts `𝒯` +to +a tangle in `B'` of the same order. The proof is the paper's. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Hypergraph GraphMinor.GM10 + +variable {α β : Type*} {G A' B' : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + +/-- The set `𝒯' = {(A ∩ B', B ∩ B') : (A, B) ∈ 𝒯}` of Graph Minors XII, (7.1) (page 259). -/ +def restrictTangle (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (B' : Hypergraph α β) : + Set (Hypergraph α β × Hypergraph α β) := + {p | ∃ A B : Hypergraph α β, (A, B) ∈ 𝒯 ∧ p = (A ∩ B', B ∩ B')} + +private theorem restricted_tangle_covers_no_triple + {α : Type*} + {β : Type*} + {G : Hypergraph α β} + {A' : Hypergraph α β} + {B' : Hypergraph α β} + {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (hT : IsTangle G θ 𝒯) + (hm : (A', B') ∈ 𝒯) + (hsep' : G.IsSeparation A' B') + (hAG : A' ≤ G) + (hBG : B' ≤ G) + (v : α) + (hv : (A' ∩ B').vertexSet = {v}) + (hvA : v ∈ A'.vertexSet) + (hvB : v ∈ B'.vertexSet) + (hvv : ∀ x ∈ A'.vertexSet, x ∈ B'.vertexSet → x = v) + (hV : A'.vertexSet ∪ B'.vertexSet = G.vertexSet) + (hE : A'.edgeSet ∪ B'.edgeSet = G.edgeSet) + (key : ∀ {A B : Hypergraph α β}, B'.IsSeparation A B → A.separationOrder B < θ → v ∈ + A.vertexSet → (A, B) ∈ restrictTangle 𝒯 B' ∨ (B, A) ∈ restrictTangle 𝒯 B') : + ∀ {A₁ B₁ A₂ B₂ A₃ B₃ : Hypergraph α β}, (A₁, B₁) ∈ 𝒯 → (A₂, B₂) ∈ 𝒯 → (A₃, B₃) ∈ 𝒯 → + B'.vertexSet ⊆ A₁.vertexSet ∪ A₂.vertexSet ∪ A₃.vertexSet → B'.edgeSet ⊆ A₁.edgeSet ∪ + A₂.edgeSet ∪ A₃.edgeSet → v ∈ A₁.vertexSet → False := by + intro A₁ B₁ A₂ B₂ A₃ B₃ h₁ h₂ h₃ hcV hcE hv₁ + have s₁ := hT.isSeparation h₁ + have s₂ := hT.isSeparation h₂ + have s₃ := hT.isSeparation h₃ + have hsep := hsep'.union_inter s₁ + have hUl : A' ∪ A₁ ≤ G := hsep.left_le + have hord : separationOrder (A' ∪ A₁) (B' ∩ B₁) < θ := by + refine lt_of_le_of_lt (ncard_le_ncard ?_ (A₁ ∩ B₁).vertexSet_finite) (hT.order_lt h₁) + rintro x ⟨h | h, h'⟩ + · have := hvv x h h'.1 + subst this + exact ⟨hv₁, h'.2⟩ + · exact ⟨h, h'.2⟩ + have hmem₁ : (A' ∪ A₁, B' ∩ B₁) ∈ 𝒯 := by + refine (hT.axiom1 hsep hord).resolve_right fun h => ?_ + refine hT.axiom2 hm h₁ h ?_ + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (union_le (union_le hAG s₁.left_le) hsep.right_le) le_rfl ?_ ?_ + · refine subset_antisymm (union_subset (union_subset hAG.vertexSet_subset + s₁.left_le.vertexSet_subset) hsep.right_le.vertexSet_subset) fun x hx => ?_ + rw [← hV] at hx + rcases hx with h' | h' + · exact Or.inl (Or.inl h') + · have : x ∈ A₁.vertexSet ∪ B₁.vertexSet := by + rw [s₁.vertexSet_union] + exact hBG.vertexSet_subset h' + rcases this with h'' | h'' + · exact Or.inl (Or.inr h'') + · exact Or.inr ⟨h', h''⟩ + · refine subset_antisymm (union_subset (union_subset hAG.edgeSet_subset + s₁.left_le.edgeSet_subset) hsep.right_le.edgeSet_subset) fun x hx => ?_ + rw [← hE] at hx + rcases hx with h' | h' + · exact Or.inl (Or.inl h') + · have : x ∈ A₁.edgeSet ∪ B₁.edgeSet := by + rw [s₁.edgeSet_union] + exact hBG.edgeSet_subset h' + rcases this with h'' | h'' + · exact Or.inl (Or.inr h'') + · exact Or.inr ⟨h', h''⟩ + refine hT.axiom2 hmem₁ h₂ h₃ ?_ + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (union_le (union_le hUl s₂.left_le) s₃.left_le) le_rfl ?_ ?_ + · refine subset_antisymm (union_subset (union_subset hUl.vertexSet_subset + s₂.left_le.vertexSet_subset) s₃.left_le.vertexSet_subset) fun x hx => ?_ + rw [← hV] at hx + rcases hx with h' | h' + · exact Or.inl (Or.inl (Or.inl h')) + · rcases hcV h' with (h'' | h'') | h'' + · exact Or.inl (Or.inl (Or.inr h'')) + · exact Or.inl (Or.inr h'') + · exact Or.inr h'' + · refine subset_antisymm (union_subset (union_subset hUl.edgeSet_subset + s₂.left_le.edgeSet_subset) s₃.left_le.edgeSet_subset) fun x hx => ?_ + rw [← hE] at hx + rcases hx with h' | h' + · exact Or.inl (Or.inl (Or.inl h')) + · rcases hcE h' with (h'' | h'') | h'' + · exact Or.inl (Or.inl (Or.inr h'')) + · exact Or.inl (Or.inr h'') + · exact Or.inr h'' + +/-- **(7.1)** of Graph Minors XII (page 267): "Let* $\mathscr{T}$ *be a tangle of order* $\theta \ge +1$ *in a graph* $G$, *and let* $(A', +B') \in \mathscr{T}$ *have order* $1$. *Let* $$\mathscr{T}' = \{(A \cap B', B \cap B') : (A, +B) \in \mathscr{T}\};$$ *then* $\mathscr{T}'$ *is a tangle in* $B'$ *of order* $\theta$." The proof +works for hypergraphs. -/ +theorem theorem_7_1_proof (hT : IsTangle G θ 𝒯) (hm : (A', B') ∈ 𝒯) (h1 : separationOrder A' B' + = 1) : + IsTangle B' θ (restrictTangle 𝒯 B') := by + have hsep' : G.IsSeparation A' B' := hT.isSeparation hm + have hAG : A' ≤ G := hsep'.left_le + have hBG : B' ≤ G := hsep'.right_le + obtain ⟨v, hv⟩ := ncard_eq_one.mp h1 + have hvA : v ∈ A'.vertexSet := by + have : v ∈ (A' ∩ B').vertexSet := by rw [hv]; rfl + exact this.1 + have hvB : v ∈ B'.vertexSet := by + have : v ∈ (A' ∩ B').vertexSet := by rw [hv]; rfl + exact this.2 + have hvv : ∀ x, x ∈ A'.vertexSet → x ∈ B'.vertexSet → x = v := fun x h₁ h₂ => by + have : x ∈ (A' ∩ B').vertexSet := ⟨h₁, h₂⟩ + rwa [hv] at this + have hee : ∀ e, e ∈ A'.edgeSet → e ∈ B'.edgeSet → False := fun e h₁ h₂ => by + have : e ∈ (A' ∩ B').edgeSet := ⟨h₁, h₂⟩ + rw [hsep'.edgeSet_inter_eq] at this + exact this + have hV : A'.vertexSet ∪ B'.vertexSet = G.vertexSet := hsep'.vertexSet_union + have hE : A'.edgeSet ∪ B'.edgeSet = G.edgeSet := hsep'.edgeSet_union + -- Members of `𝒯'` are separations of `B'` of order `< θ`. + have hmem : ∀ {A B}, (A, B) ∈ 𝒯 → B'.IsSeparation (A ∩ B') (B ∩ B') ∧ + separationOrder (A ∩ B') (B ∩ B') < θ := by + intro A B hAB + have hs := hT.isSeparation hAB + have hAl : A ∩ B' ≤ B' := inter_le_right hs.left_le hBG + have hBl : B ∩ B' ≤ B' := inter_le_right hs.right_le hBG + refine ⟨(isSeparation_iff_of_le hAl hBl).mpr ⟨?_, ?_, ?_⟩, ?_⟩ + · ext x + constructor + · rintro (h | h) <;> exact h.2 + · intro hx + have : x ∈ A.vertexSet ∪ B.vertexSet := by + rw [hs.vertexSet_union] + exact hBG.vertexSet_subset hx + rcases this with h | h + · exact Or.inl ⟨h, hx⟩ + · exact Or.inr ⟨h, hx⟩ + · ext x + constructor + · rintro (h | h) <;> exact h.2 + · intro hx + have : x ∈ A.edgeSet ∪ B.edgeSet := by + rw [hs.edgeSet_union] + exact hBG.edgeSet_subset hx + rcases this with h | h + · exact Or.inl ⟨h, hx⟩ + · exact Or.inr ⟨h, hx⟩ + · ext x + constructor + · rintro ⟨⟨h₁, -⟩, h₂, -⟩ + have : x ∈ (A ∩ B).edgeSet := ⟨h₁, h₂⟩ + rw [hs.edgeSet_inter_eq] at this + exact this + · exact fun h => h.elim + · refine lt_of_le_of_lt (ncard_le_ncard ?_ (A ∩ B).vertexSet_finite) (hT.order_lt hAB) + exact fun x hx => ⟨hx.1.1, hx.2.1⟩ + -- The first axiom, when `v` is in `A`. + have key : ∀ {A B : Hypergraph α β}, B'.IsSeparation A B → separationOrder A B < θ → + v ∈ A.vertexSet → (A, B) ∈ restrictTangle 𝒯 B' ∨ (B, A) ∈ restrictTangle 𝒯 B' := by + intro A B hs ho hvA' + have hAB' : A ≤ B' := hs.left_le + have hBB' : B ≤ B' := hs.right_le + have hUn : A ∪ A' ≤ G := union_le (hAB'.trans hBG) hAG + have hBg : B ≤ G := hBB'.trans hBG + have hsG : G.IsSeparation (A ∪ A') B := by + refine (isSeparation_iff_of_le hUn hBg).mpr ⟨?_, ?_, ?_⟩ + · rw [← hV, ← hs.vertexSet_union] + exact (union_right_comm _ _ _).trans (union_comm _ _) + · rw [← hE, ← hs.edgeSet_union] + exact (union_right_comm _ _ _).trans (union_comm _ _) + · ext e + constructor + · rintro ⟨h | h, h'⟩ + · have : e ∈ (A ∩ B).edgeSet := ⟨h, h'⟩ + rw [hs.edgeSet_inter_eq] at this + exact this + · exact (hee e h (hBB'.edgeSet_subset h')).elim + · exact fun h => h.elim + have hoG : separationOrder (A ∪ A') B < θ := by + refine lt_of_le_of_lt (ncard_le_ncard ?_ (A ∩ B).vertexSet_finite) ho + rintro x ⟨h | h, h'⟩ + · exact ⟨h, h'⟩ + · have := hvv x h (hBB'.vertexSet_subset h') + subst this + exact ⟨hvA', h'⟩ + have e₁ : (A ∪ A') ∩ B' = A := by + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq (inter_le_right hUn hBG) hAB' ?_ ?_ + · ext x + constructor + · rintro ⟨h | h, h'⟩ + · exact h + · exact hvv x h h' ▸ hvA' + · exact fun h => ⟨Or.inl h, hAB'.vertexSet_subset h⟩ + · ext e + constructor + · rintro ⟨h | h, h'⟩ + · exact h + · exact (hee e h h').elim + · exact fun h => ⟨Or.inl h, hAB'.edgeSet_subset h⟩ + have e₂ : B ∩ B' = B := by + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq (inter_le_right hBg hBG) hBB' ?_ ?_ + · exact inter_eq_left.mpr hBB'.vertexSet_subset + · exact inter_eq_left.mpr hBB'.edgeSet_subset + rcases hT.axiom1 hsG hoG with h | h + · exact Or.inl ⟨_, _, h, by rw [e₁, e₂]⟩ + · exact Or.inr ⟨_, _, h, by rw [e₁, e₂]⟩ + -- The second axiom, when `v` is in `A₁`. + have hcover : ∀ {A₁ B₁ A₂ B₂ A₃ B₃ : Hypergraph α β}, (A₁, B₁) ∈ 𝒯 → (A₂, B₂) ∈ 𝒯 → (A₃, B₃) ∈ 𝒯 → + B'.vertexSet ⊆ A₁.vertexSet ∪ A₂.vertexSet ∪ A₃.vertexSet → + B'.edgeSet ⊆ A₁.edgeSet ∪ A₂.edgeSet ∪ A₃.edgeSet → v ∈ A₁.vertexSet → False := by + exact restricted_tangle_covers_no_triple (α := α) (β := β) (G := G) (A' := A') (B' := B') (θ + := θ) (𝒯 := 𝒯) hT hm hsep' hAG hBG v hv hvA hvB hvv hV hE key + refine ⟨hT.one_le, ?_, ?_, ?_, ?_, ?_⟩ + · rintro _ _ ⟨A, B, hAB, heq⟩ + rw [Prod.mk.injEq] at heq + rw [heq.1, heq.2] + exact (hmem hAB).1 + · rintro _ _ ⟨A, B, hAB, heq⟩ + rw [Prod.mk.injEq] at heq + rw [heq.1, heq.2] + exact (hmem hAB).2 + · intro A B hs ho + have : v ∈ A.vertexSet ∪ B.vertexSet := by + rw [hs.vertexSet_union] + exact hvB + rcases this with h | h + · exact key hs ho h + · exact (key hs.symm (by rwa [separationOrder_comm]) h).symm + · rintro _ _ _ _ _ _ ⟨A₁, B₁, h₁, he₁⟩ ⟨A₂, B₂, h₂, he₂⟩ ⟨A₃, B₃, h₃, he₃⟩ hun + rw [Prod.mk.injEq] at he₁ he₂ he₃ + rw [he₁.1, he₂.1, he₃.1] at hun + have hcV : B'.vertexSet ⊆ A₁.vertexSet ∪ A₂.vertexSet ∪ A₃.vertexSet := by + intro x hx + rw [← hun] at hx + rcases hx with (h | h) | h + · exact Or.inl (Or.inl h.1) + · exact Or.inl (Or.inr h.1) + · exact Or.inr h.1 + have hcE : B'.edgeSet ⊆ A₁.edgeSet ∪ A₂.edgeSet ∪ A₃.edgeSet := by + intro x hx + rw [← hun] at hx + rcases hx with (h | h) | h + · exact Or.inl (Or.inl h.1) + · exact Or.inl (Or.inr h.1) + · exact Or.inr h.1 + rcases hcV hvB with (h | h) | h + · exact hcover h₁ h₂ h₃ hcV hcE h + · refine hcover h₂ h₁ h₃ ?_ ?_ h + · exact hcV.trans fun x hx => by + rcases hx with (h | h) | h + · exact Or.inl (Or.inr h) + · exact Or.inl (Or.inl h) + · exact Or.inr h + · exact hcE.trans fun x hx => by + rcases hx with (h | h) | h + · exact Or.inl (Or.inr h) + · exact Or.inl (Or.inl h) + · exact Or.inr h + · refine hcover h₃ h₁ h₂ ?_ ?_ h + · exact hcV.trans fun x hx => by + rcases hx with (h | h) | h + · exact Or.inl (Or.inr h) + · exact Or.inr h + · exact Or.inl (Or.inl h) + · exact hcE.trans fun x hx => by + rcases hx with (h | h) | h + · exact Or.inl (Or.inr h) + · exact Or.inr h + · exact Or.inl (Or.inl h) + · rintro _ _ ⟨A, B, hAB, heq⟩ hAeq + rw [Prod.mk.injEq] at heq + rw [heq.1] at hAeq + have hsub : B'.vertexSet ⊆ A.vertexSet := fun x hx => by + rw [← hAeq] at hx + exact hx.1 + have hs := hT.isSeparation hAB + have hord : separationOrder B A < θ := by + rw [separationOrder_comm] + exact hT.order_lt hAB + have hBA := GraphMinor.GM10.theorem_2_9_proof hT hm hs.symm hord (Or.inl hsub) + refine hT.axiom2 hAB hBA hBA ?_ + rw [GM10.union_assoc, GM10.union_self, hs.union_eq] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section710.lean b/LeanPool/GraphMinor/GM12/Section710.lean new file mode 100644 index 0000000000..886287077a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section710.lean @@ -0,0 +1,117 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section7Proved +public import LeanPool.GraphMinor.GM14.Cited + +/-! +# Graph Minors XII, (7.10): cleared respectful tangle in a 2-cell subdrawing + +This file formalizes **(7.10)** of Graph Minors XII (page 270) and the cited bridge theorem +`gm14_theorem_7_10` (`GM14.GM12Theorem710Statement`). +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Function Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- **(7.10)** of Graph Minors XII (pages 270–271): +"Let $k \ge 0$ be an integer, and let $\mathscr{T}$ be a respectful tangle of order $\ge 4k + +3$ in a 2-cell drawing $\Gamma$ in a connected surface $\Sigma$. Let its metric be $d$. Let +$c \in A(\Gamma)$, and let $\Gamma'$ be a 2-cell subdrawing of $\Gamma$ such that $d(c, e) +\le k$ for all $e \in E(\Gamma) - E(\Gamma')$, and such that if $c \in E(\Gamma) - +E(\Gamma')$ then* ... *$k \ge 2$. Then there is a respectful tangle $\mathscr{T}'$ of order +$\theta - 4k - 2$ in $\Gamma'$, with metric $d'$, such that $d'(a', b') \ge d(a, b) - 4k - +2$ for all $a, b \in A(\Gamma)$ and $a', b' \in A(\Gamma')$ with $a \subseteq a'$ and $b +\subseteq b'$. Moreover,* (i) *$\mathscr{T}'$ is unique* (ii) *$(A \cap \Gamma', B \cap +\Gamma') \in \mathscr{T}'$ for all $(A, B) \in \mathscr{T}$ of order $< \theta - 4k - 2$,* +(iii) *$d'(a', b') \le d(a, b)$ for all $a, b \in A(\Gamma)$ and $a', b' \in A(\Gamma')$ +with $a \subseteq a'$ and $b \subseteq b'$." -/ +theorem theorem_7_10_proof + (hS : IsClosedSurface S) [ConnectedSpace S] + {Γ Γ' : Drawing S} {θ k : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {c : Set S} + (hθ : 4 * k + 3 ≤ θ) + (hd : HasTangleMetric Γ θ T d) + (hc : c ∈ Γ.A) + (hSub : Γ'.IsSubdrawing Γ) + (h2cell' : (PaintingOrDrawing.drawing Γ').IsTwoCell) + (hdist : ∀ e ∈ Γ.E \ Γ'.E, d c e ≤ k) + (hck : c ∈ Γ.E \ Γ'.E → 2 ≤ k) : + ∃ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ), + IsClearedTangleAux Γ Γ' T d θ k T' d' ∧ + ∀ (T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (d₁ : Set S → Set S → ℕ), + HasTangleMetric Γ' (θ - 4 * k - 2) T₁ d₁ → + (∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → d a b - 4 * k - 2 ≤ d₁ a' b') → + T₁ = T' := by + obtain ⟨T'', d'', hd'', hd''_ge⟩ := + theorem_7_8_proof hS (by omega) hd hc hSub h2cell' hdist hck + let T' := GM10.truncation T'' (θ - 4 * k - 2) + let d' : Set S → Set S → ℕ := fun x y => min (d'' x y) (θ - 4 * k - 2) + have hd' : HasTangleMetric Γ' (θ - 4 * k - 2) T' d' := + HasTangleMetric.truncation hd'' (by omega) (by omega) + have hd_le_θ : ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, d a b ≤ θ := by + intro a ha b hb + obtain ⟨_, K, ins, hK, _, hd_eq⟩ := id hd + rw [hd_eq a ha b hb] + exact tangleMetric_le_order hK ins θ a b + have hd'_ge : ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → d a b - 4 * k - 2 ≤ d' a' b' := by + intro a ha b hb a' ha' b' hb' haa' hbb' + have h1 := hd''_ge a ha b hb a' ha' b' hb' haa' hbb' + have h2 := hd_le_θ a ha b hb + change d a b - 4 * k - 2 ≤ min (d'' a' b') (θ - 4 * k - 2) + omega + have hord_eq : θ - (4 * k + 2) = θ - 4 * k - 2 := by omega + have hd'_ord : HasTangleMetric Γ' (θ - (4 * k + 2)) T' d' := hord_eq.symm ▸ hd' + have hd'_ge_ord : ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → d a b - (4 * k + 2) ≤ d' a' b' := by + intro a ha b hb a' ha' b' hb' haa' hbb' + have hsub_eq : d a b - (4 * k + 2) = d a b - 4 * k - 2 := by omega + rw [hsub_eq] + exact hd'_ge a ha b hb a' ha' b' hb' haa' hbb' + obtain ⟨h79_sep, h79_uniq⟩ := + theorem_7_9_proof hS hd hSub h2cell' (k := 4 * k + 2) (by omega) hd'_ord hd'_ge_ord + have h77_i := + (theorem_7_7_proof hS hd hSub h2cell' (by omega) hd').1 (4 * k + 2) hd'_ge_ord + refine ⟨T', d', ⟨hd', ?_, ?_⟩, ?_⟩ + · intro A B hAB hord + exact h79_sep A B hAB (by omega) + · intro a ha b hb a' ha' b' hb' haa' hbb' + refine ⟨hd'_ge a ha b hb a' ha' b' hb' haa' hbb', ?_⟩ + have hmin_le := h77_i a ha b hb a' ha' b' hb' haa' hbb' + have hd'_le : d' a' b' ≤ θ - (4 * k + 2) := by + change min (d'' a' b') (θ - 4 * k - 2) ≤ θ - (4 * k + 2) + omega + rwa [min_eq_left hd'_le] at hmin_le + · intro T₁ d₁ hd₁ hd₁_ge + refine h79_uniq T₁ d₁ (hord_eq.symm ▸ hd₁) fun a ha b hb a' ha' b' hb' haa' hbb' => ?_ + have hsub_eq : d a b - (4 * k + 2) = d a b - 4 * k - 2 := by omega + rw [hsub_eq] + exact hd₁_ge a ha b hb a' ha' b' hb' haa' hbb' + +/-- Bridge theorem providing `GM14.GM12Theorem710Statement` from `theorem_7_10_proof`. -/ +theorem gm14_theorem_7_10 : + GM14.GM12Theorem710Statement.{u} := by + intro S _ _ hS hConn Γ Γ' θ k T d c hθ hd hc hSub h2cell' hdist hck + have : T2Space S := hS.2.1 + exact theorem_7_10_proof hS hθ hd hc hSub h2cell' hdist hck + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section711.lean b/LeanPool/GraphMinor/GM12/Section711.lean new file mode 100644 index 0000000000..dea43ee6d3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section711.lean @@ -0,0 +1,633 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section711a +public import LeanPool.GraphMinor.GM15.Cited +import LeanPool.GraphMinor.GM11.Section64b +import LeanPool.GraphMinor.GM11.FlatCover +import LeanPool.GraphMinor.GM11.OpenAround +import LeanPool.GraphMinor.GM11.GlueFaces + +/-! +# Graph Minors XII, (7.11) + +This file completes the proof of **(7.11)** of Robertson and Seymour, +*Graph Minors. XII. Distance on a surface*, J. Combin. Theory Ser. B 64 (1995), 240–272 +(pages 271–272). + +Using the restraint-union and preconnectedness results from `Section711a.lean`, we show that every +region of `Γ' = H.span ∅ {e ∈ H.E | lam < d z e}` (and thus of `deleteAtomNeighborhood H d z lam`) +is an open disc, so `Γ'` is a 2-cell drawing. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- Along any spoke `h ∈ K.E` contained in `r ∩ Z` (`r ∈ H.R`), the radial hub `w_r ∈ r ∩ K.V` +is joined in `r ∩ Z` to every point `q ∈ h`. -/ +theorem joinedIn_spoke_inter_Z (hS : IsClosedSurface S) + {H K : Drawing S} (hpre : PreRad (PaintingOrDrawing.drawing H) K) + {Z : Set S} (hZc : IsClosed Z) {r h : Set S} (hr : r ∈ H.R) (hh : h ∈ K.E) + (hhr : h ⊆ r) (hhZ : h ⊆ Z) {w_r q : S} (hw_r : w_r ∈ r) (hw_V : w_r ∈ K.V) (hq : q ∈ h) : + JoinedIn (r ∩ Z) w_r q := by + have hclZ : closure h ⊆ Z := closure_minimal hhZ hZc + obtain ⟨v, hv, r₁, hr₁, w, hw, hwV, hcap, hsub⟩ := spoke_ends hpre hS hh + obtain rfl : r₁ = r := region_eq_of_mem hr₁ hr (hsub hq) (hhr hq) + obtain rfl : w = w_r := hub_unique hpre hr₁ hw_r hw_V hw hwV + have hvw : v ≠ w := fun h => region_subset hr₁ hw_r (H.V_subset_U (h ▸ hv)) + have hline : IsLineWithEnds (closure h) v w := by + rcases K.edge_cond h hh with ⟨a, b, hab, hc', hL⟩ | ⟨a, hc', -⟩ + · rw [hcap] at hc' + rcases Set.pair_eq_pair_iff.mp hc' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hL + · exact Surface.IsLineWithEnds.symm hL + · rw [hcap] at hc' + have h₁ : v ∈ ({a} : Set S) := hc' ▸ mem_insert _ _ + have h₂ : w ∈ ({a} : Set S) := hc' ▸ mem_insert_of_mem _ rfl + exact absurd (h₁.trans h₂.symm) hvw + have hsub' : closure h \ {v} ⊆ r₁ ∩ Z := by + rintro x ⟨hx, hxv⟩ + refine ⟨?_, hclZ hx⟩ + by_cases hxV : x ∈ K.V + · have : x ∈ closure h ∩ K.V := ⟨hx, hxV⟩ + rw [hcap] at this + rcases this with h | h + · exact absurd h hxv + · exact (mem_singleton_iff.mp h) ▸ hw_r + · exact hsub ((K.closure_diff_V hh).subset ⟨hx, hxV⟩) + have hqv : q ≠ v := fun h => edge_notMem_V hh hq (h ▸ radial_V hpre hv) + exact (joinedIn_line hline (subset_closure hq) hqv).symm.mono hsub' + +/-- For every region `r ∈ H.R` with radial hub `w_r ∈ r ∩ K.V` and every `y ∈ r ∩ Z` +(where `Z` is a closed `K`-nice set), `w_r` is joined to `y` in `r ∩ Z`. -/ +theorem joinedIn_region_inter_Z (hS : IsClosedSurface S) [ConnectedSpace S] + {H K : Drawing S} (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + {Z : Set S} (hZc : IsClosed Z) (hZn : IsGammaNice K Z) + {r : Set S} (hr : r ∈ H.R) {w_r y : S} (hw_r : w_r ∈ r) (hw_V : w_r ∈ K.V) + (hy : y ∈ r ∩ Z) : + JoinedIn (r ∩ Z) w_r y := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hpre : PreRad (PaintingOrDrawing.drawing H) K := ⟨hK.1, hK.2.1⟩ + by_cases hyK : y ∈ K.U + · by_cases hyV : y ∈ K.V + · obtain rfl : y = w_r := hub_unique hpre hr hw_r hw_V hy.1 hyV + exact JoinedIn.refl hy + · obtain ⟨h, hh, hyh⟩ := K.exists_edge_of_mem hyK hyV + have hhZ : h ⊆ Z := nice_edge hZn hh ⟨y, hyh, hy.2⟩ + obtain ⟨-, -, r₁, hr₁, -, -, -, -, hsub⟩ := spoke_ends hpre hS hh + obtain rfl : r₁ = r := region_eq_of_mem hr₁ hr (hsub hyh) hy.1 + exact joinedIn_spoke_inter_Z hS hpre hZc hr₁ hh hsub hhZ hw_r hw_V hyh + · have hyRU : y ∉ (radialUnion hpre).U := by + rintro (hyH | hyK') + · exact region_subset hr hy.1 hyH + · exact hyK hyK' + obtain ⟨p, hp, hyp⟩ := exists_region_of_notMem hyRU + obtain ⟨s, hs, hys⟩ := exists_region_of_notMem hyK + have hsZ : s ⊆ Z := nice_region hZn hs ⟨y, hys, hy.2⟩ + have hps : p ⊆ s := region_sub_of_mem hpre hS hs hp (subset_closure hyp) hys + have hpZ : p ⊆ Z := hps.trans hsZ + have hcl_pZ : closure p ⊆ Z := closure_minimal hpZ hZc + have hpr : p ⊆ r := by + have hp_disj : Disjoint p H.U := + disjoint_left.mpr fun x hxp hxH => region_subset hp hxp (Or.inl hxH) + exact subset_region hr (region_isPreconnected hp) hp_disj hyp hy.1 + have hcp : w_r ∈ closure p := hub_mem_closure hpre hS hr hp hpr hw_r hw_V + obtain ⟨N, hNo, hwN, hNj⟩ := locJoin_region hS hp hcp r (region_isOpen hr) hw_r + obtain ⟨z₀, hz₀N, hz₀p⟩ := mem_closure_iff.mp hcp N hNo hwN + have hj₁ : JoinedIn (r ∩ Z) w_r z₀ := + (hNj z₀ ⟨subset_closure hz₀p, hz₀N⟩).mono fun u hu => ⟨hu.2, hcl_pZ hu.1⟩ + have hj₂ : JoinedIn (r ∩ Z) z₀ y := + ((isPathConnected_of_isOpen hS (region_isOpen hp) (region_isPreconnected hp) + ⟨z₀, hz₀p⟩).joinedIn z₀ hz₀p y hyp).mono (subset_inter hpr hpZ) + exact hj₁.trans hj₂ + +/-- Every deleted vertex `v ∈ H.V \ Γ'.V` lies in an open disc `D_v ⊆ Z`. -/ +theorem exists_openDisc_around_deleted_vertex (hS : IsClosedSurface S) [ConnectedSpace S] + {H K : Drawing S} {θ lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {ins : Drawing S → Set S} + (hResp : IsRespectfulDrawingTangle H θ T) (hE : H.E.Nonempty) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hd_eq : ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = tangleMetric H K ins θ x y) + {z z' : Set S} (hz : z ∈ H.A) (hz' : IsCorrespondingAtom H K z z') {c : S} (hc : c ∈ z') + (hlam : lam < θ) (hz_lam : z ∈ H.E → 2 ≤ lam) + {v : S} (hv : v ∈ H.V \ (H.span ∅ {f ∈ H.E | lam < d z f}).V) : + ∃ U : Set S, IsOpenDisc U ∧ v ∈ U ∧ U ⊆ restraintUnion K ins (2 * θ) c (2 * lam) := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hpre : PreRad (PaintingOrDrawing.drawing H) K := ⟨hK.1, hK.2.1⟩ + have hrf := GM11.regionFacts_of_radial hpre hS hK.2.2 hE + set Z := restraintUnion K ins (2 * θ) c (2 * lam) + set Γ' := H.span ∅ {f ∈ H.E | lam < d z f} + have hZc : IsClosed Z := isClosed_restraintUnion hS c (2 * lam) + have hZn : IsGammaNice K Z := isGammaNice_restraintUnion c (2 * lam) + -- For any `s ∈ K.R`, if `v ∈ closure s`, then `s ⊆ Z`. + have hs_sub_Z : ∀ s ∈ K.R, v ∈ closure s → s ⊆ Z := by + intro s hs hvs + obtain ⟨e, he, hes⟩ := hrf.1 s hs + have hve : v ∈ closure e := hrf.2.2 s hs e he hes v hv.1 hvs + have he_not : e ∉ Γ'.E := by + intro heΓ' + apply hv.2 + exact Or.inr (mem_iUnion₂.mpr ⟨e, by rwa [← H.span_E], hve, hv.1⟩) + have hnot_compl : ¬ (s ⊆ Zᶜ) := by + rw [← edge_mem_span_iff hS hResp hE hK hd hd_eq hz hz' hc hlam hz_lam he hs hes] + exact he_not + obtain ⟨y, hys, hyZ⟩ : (s ∩ Z).Nonempty := by + by_contra hcon + exact hnot_compl fun x hxs hxZ => hcon ⟨x, hxs, hxZ⟩ + exact nice_region hZn hs ⟨y, hys, hyZ⟩ + -- For any `h ∈ K.E`, if `v ∈ closure h`, then `h ⊆ Z`. + have hh_sub_Z : ∀ h ∈ K.E, v ∈ closure h → h ⊆ Z := by + intro h hh hvh + obtain ⟨s, hs, hhs⟩ := exists_region_incident hS hh + have hcl_hs : closure h ⊆ closure s := closure_minimal hhs isClosed_closure + exact hhs.trans (closure_minimal (hs_sub_Z s hs (hcl_hs hvh)) hZc) + -- Also `v ∈ Z`. + have hvZ : v ∈ Z := by + obtain ⟨e₀, he₀, hve₀⟩ := exists_edge_at hpre hS hE hv.1 + obtain ⟨p₀, hp₀⟩ := he₀.1 + have hUU : H.U ∩ K.U = H.V := hK.2.1.1 + have hoff : ∀ y ∈ e₀, y ∉ K.U := fun y hy hyK => by + have : y ∈ H.U ∩ K.U := ⟨(he₀.2.1 hy).1, hyK⟩ + rw [hUU] at this + exact (he₀.2.1 hy).2 this + set s₀ := connectedComponentIn (univ \ K.U) p₀ + have hs₀ : s₀ ∈ K.R := (mem_R_iff K).mpr ⟨p₀, hoff p₀ hp₀, rfl⟩ + have hes₀ : e₀ ⊆ s₀ := + he₀.2.2.1.isConnected.isPreconnected.subset_connectedComponentIn hp₀ + fun y hy => ⟨mem_univ y, hoff y hy⟩ + have hvs₀ : v ∈ closure s₀ := closure_mono hes₀ hve₀ + exact closure_minimal (hs_sub_Z s₀ hs₀ hvs₀) hZc hvs₀ + -- Define the closed set `B_v` of atoms of `K` outside `Z` or vertices `≠ v`. + let B_v : Set S := + (K.V \ {v}) ∪ (⋃ h ∈ {h ∈ K.E | ¬ (h ⊆ Z)}, closure h) ∪ + (⋃ s ∈ {s ∈ K.R | ¬ (s ⊆ Z)}, closure s) + have hBv_closed : IsClosed B_v := by + refine ((K.finite_V.subset sdiff_subset).isClosed.union ?_).union ?_ + · exact (K.finite_edges.subset (sep_subset _ _)).isClosed_biUnion fun _ _ => isClosed_closure + · exact ((finite_R hS K).subset (sep_subset _ _)).isClosed_biUnion fun _ _ => isClosed_closure + have hv_not_Bv : v ∉ B_v := by + rintro ((⟨-, hvv⟩ | h) | h) + · exact hvv rfl + · obtain ⟨h, ⟨hh, hhZ⟩, hvh⟩ := mem_iUnion₂.mp h + exact hhZ (hh_sub_Z h hh hvh) + · obtain ⟨s, ⟨hs, hsZ⟩, hvs⟩ := mem_iUnion₂.mp h + exact hsZ (hs_sub_Z s hs hvs) + have hBv_compl_sub : B_vᶜ ⊆ Z := by + intro y hy + by_cases hyK : y ∈ K.U + · by_cases hyV : y ∈ K.V + · by_cases hyv : y = v + · exact hyv ▸ hvZ + · exact False.elim (hy (Or.inl (Or.inl ⟨hyV, hyv⟩))) + · obtain ⟨h, hh, hyh⟩ := K.exists_edge_of_mem hyK hyV + by_cases hhZ : h ⊆ Z + · exact hhZ hyh + · exact False.elim (hy (Or.inl (Or.inr (mem_iUnion₂.mpr ⟨h, ⟨hh, hhZ⟩, + subset_closure hyh⟩)))) + · obtain ⟨s, hs, hys⟩ := exists_region_of_notMem hyK + by_cases hsZ : s ⊆ Z + · exact hsZ hys + · exact False.elim (hy (Or.inr (mem_iUnion₂.mpr ⟨s, ⟨hs, hsZ⟩, subset_closure hys⟩))) + obtain ⟨D, D', hD, hD', hvD', hD'D, hDB, hbdD⟩ := + exists_closedDisc_nbhd hS hBv_closed.isOpen_compl hv_not_Bv + have hInt : IsOpenDisc (discInt D) := isOpenDisc_interior hS hD + have hvInt : v ∈ discInt D := by + refine ⟨hD'D hvD', ?_⟩ + rw [← hbdD] + exact fun h => h.2 hvD' + exact ⟨discInt D, hInt, hvInt, (sdiff_subset.trans hDB).trans hBv_compl_sub⟩ + +private theorem flat_union_of_region_neighborhoods + {S : Type*} [TopologicalSpace S] {ι : Type*} (Z W : Set S) + (hZf : Flat (Subtype.val ⁻¹' Z : Set W)) + (O_S : ι → Set S) (hOS_od : ∀ i, IsOpenDisc (O_S i)) (hOS_W : ∀ i, O_S i ⊆ W) + (b_W : ι → W) (hb_mem : ∀ i, (b_W i).1 ∈ O_S i) (hb_Z : ∀ i, (b_W i).1 ∈ Z) + (hjoin_to_Z : ∀ i (y : W), y.1 ∈ O_S i → y.1 ∈ Z → + ∃ f : Cl (b_W i) y, Arw (Subtype.val ⁻¹' O_S i) f ∧ Arw (Subtype.val ⁻¹' Z) f) + (hoverlap : ∀ i j (y : W), y.1 ∈ O_S i → y.1 ∈ O_S j → i = j ∨ y.1 ∈ Z) : + Flat (⋃ i, (Subtype.val ⁻¹' O_S i : Set W)) := by + let O_W : ι → Set W := fun i => Subtype.val ⁻¹' O_S i + refine flat_iUnion_cover hZf O_W b_W ?_ hb_mem ?_ ?_ ?_ + · intro i + exact (hOS_od i).1.preimage continuous_subtype_val + · intro i + exact isPathConnected_preimage (hOS_od i).isPathConnected (hOS_W i) + · intro i + exact flat_of_simplyConnected (hOS_od i).isSimplyConnectedSet (hOS_W i) + · intro i j y hyi hyj + rcases hoverlap i j y hyi hyj with rfl | hyZ + · have hpc : IsPathConnected (O_W i) := + isPathConnected_preimage (hOS_od i).isPathConnected (hOS_W i) + have hj := hpc.joinedIn (b_W i) (hb_mem i) y hyi + refine ⟨Cl.mk hj.somePath, (Cl.mk hj.somePath).symm, + ⟨hj.somePath, hj.somePath_mem, rfl⟩, + Arw.symm ⟨hj.somePath, hj.somePath_mem, rfl⟩, ?_⟩ + rw [cl_trans_symm] + exact arw_refl (hb_Z i) + · obtain ⟨f, hfO, hfZ⟩ := hjoin_to_Z i y hyi hyZ + obtain ⟨g, hgO, hgZ⟩ := hjoin_to_Z j y hyj hyZ + exact ⟨f, g.symm, hfO, hgO.symm, hfZ.trans hgZ.symm⟩ + +private theorem removed_drawing_in_region_neighborhoods + {S : Type u} + [TopologicalSpace S] + [T2Space S] + (hS : IsClosedSurface S) + [ConnectedSpace S] + {H : Drawing S} + {θ : ℕ} + {lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hE : H.E.Nonempty) + {z : Set S} + (hz : z ∈ H.A) + (hlam : lam < θ) + (hz_lam : z ∈ H.E → 2 ≤ lam) + (hResp : IsRespectfulDrawingTangle H θ T) + (K : Drawing S) + (ins : Drawing S → Set S) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hd_eq : ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = tangleMetric H K ins θ x y) + (z' : Set S) + (hz' : IsCorrespondingAtom H K z z') + (c : S) + (hc : c ∈ z') + (hUU : H.U ∩ K.U = H.V) (discV : S → Set S) : + let Z := restraintUnion K ins (2 * θ) c (2 * lam) + let Γ' := H.span ∅ {e ∈ H.E | lam < d z e} + IsGammaNice K Z → (∀ v ∈ H.V \ Γ'.V, v ∈ discV v) → + H.U \ Γ'.U ⊆ ⋃ i : {r // r ∈ {r | r ∈ H.R ∧ (r ∩ Z).Nonempty}} ⊕ + ({s // s ∈ {s | s ∈ K.R ∧ s ⊆ Z}} ⊕ {v // v ∈ H.V \ Γ'.V}), + Sum.elim (fun r => r.1) (Sum.elim (fun s => s.1) fun v => discV v.1) i := by + intro Z Γ' hZn hdiscV_mem + rintro x ⟨hxH, hxΓ'⟩ + by_cases hxV : x ∈ H.V + · have hxS₀ : x ∈ H.V \ Γ'.V := ⟨hxV, fun hxV' => hxΓ' (Γ'.V_subset_U hxV')⟩ + exact mem_iUnion.mpr ⟨Sum.inr (Sum.inr ⟨x, hxS₀⟩), hdiscV_mem x hxS₀⟩ + · obtain ⟨e, he, hxe⟩ := H.exists_edge_of_mem hxH hxV + have he_not : e ∉ Γ'.E := fun he' => hxΓ' (Γ'.closure_subset_U he' (subset_closure hxe)) + have hoff : ∀ y ∈ e, y ∉ K.U := fun y hy hyK => by + have : y ∈ H.U ∩ K.U := ⟨(he.2.1 hy).1, hyK⟩ + rw [hUU] at this + exact (he.2.1 hy).2 this + set s_e := connectedComponentIn (univ \ K.U) x + have hs_e : s_e ∈ K.R := (mem_R_iff K).mpr ⟨x, hoff x hxe, rfl⟩ + have hes_e : e ⊆ s_e := + he.2.2.1.isConnected.isPreconnected.subset_connectedComponentIn hxe + fun y hy => ⟨mem_univ y, hoff y hy⟩ + have hnot_compl : ¬ (s_e ⊆ Zᶜ) := by + rw [← edge_mem_span_iff hS hResp hE hK hd hd_eq hz hz' hc hlam hz_lam he hs_e hes_e] + exact he_not + obtain ⟨y, hys, hyZ⟩ : (s_e ∩ Z).Nonempty := by + by_contra hcon + exact hnot_compl fun x hxs hxZ => hcon ⟨x, hxs, hxZ⟩ + have hs_e_Z : s_e ⊆ Z := nice_region hZn hs_e ⟨y, hys, hyZ⟩ + exact mem_iUnion.mpr ⟨Sum.inr (Sum.inl ⟨s_e, hs_e, hs_e_Z⟩), hes_e hxe⟩ + +private theorem bounded_region_disc_disjoint_drawing + {S : Type u} + [TopologicalSpace S] + [T2Space S] + (hS : IsClosedSurface S) + (Γ' : Drawing S) + (hΓ'U_pre : IsPreconnected Γ'.U) + (x₀ : S) + (hx₀U' : x₀ ∈ Γ'.U) + (F Δ : Set S) + (hx₀Δ : x₀ ∉ Δ) + (hΔ : IsClosedDisc Δ) + (hb : discBd Δ = F) + (hF_disj : Disjoint F Γ'.U) : + Disjoint Δ Γ'.U := by + refine disjoint_left.mpr fun x hxΔ hxU => ?_ + have hcov_U' : Γ'.U ⊆ discInt Δ ∪ Δᶜ := fun y hy => by + by_cases hyΔ : y ∈ Δ + · left + refine ⟨hyΔ, fun hybd => ?_⟩ + rw [hb] at hybd + exact disjoint_left.mp hF_disj hybd hy + · exact Or.inr hyΔ + have hInt_open : IsOpen (discInt Δ) := (isOpenDisc_interior hS hΔ).1 + have hCompl_open : IsOpen Δᶜ := hΔ.isCompact.isClosed.isOpen_compl + have hdisj_int : Disjoint (discInt Δ) Δᶜ := + disjoint_left.mpr fun y hy hyc => hyc hy.1 + have hx_int : x ∈ discInt Δ := by + refine ⟨hxΔ, fun hxbd => ?_⟩ + rw [hb] at hxbd + exact disjoint_left.mp hF_disj hxbd hxU + have hsub_int : Γ'.U ⊆ discInt Δ := + hΓ'U_pre.subset_left_of_subset_union hInt_open hCompl_open hdisj_int hcov_U' ⟨x, hxU, + hx_int⟩ + exact hx₀Δ (hsub_int hx₀U').1 + +private theorem region_not_contained_in_neighborhood_lies_outside + {S : Type u} + [TopologicalSpace S] + {H : Drawing S} + [LocallyConnectedSpace S] + (Z : Set S) + (Γ' : Drawing S) + (hU_diff_intZ : H.U \ Γ'.U ⊆ interior Z) + (q : Set S) + (hq : q ∈ (PaintingOrDrawing.drawing Γ').R) + (y₀ : S) + (hy₀q : y₀ ∈ q) + (r₀ : Set S) + (hr₀ : r₀ ∈ H.R) + (hy₀r₀ : y₀ ∈ r₀) + (hr₀Z_empty : r₀ ∩ Z = ∅) : + q ⊆ r₀ := by + by_contra hnot + obtain ⟨z₁, hz₁q, hz₁_not⟩ := not_subset.mp hnot + have hcov_q : q ⊆ r₀ ∪ (closure r₀)ᶜ := fun x hxq => by + by_cases hxr₀ : x ∈ r₀ + · exact Or.inl hxr₀ + · right + intro hxcl + have hxH : x ∈ H.U := (closure_region_subset hr₀ hxcl).resolve_left hxr₀ + have hx_int : x ∈ interior Z := hU_diff_intZ ⟨hxH, region_subset hq hxq⟩ + obtain ⟨w, hwZ, hwr₀⟩ := + mem_closure_iff.mp hxcl (interior Z) isOpen_interior hx_int + have : w ∈ r₀ ∩ Z := ⟨hwr₀, interior_subset hwZ⟩ + rw [hr₀Z_empty] at this + exact this + have hsub_r₀ := + (region_isPreconnected hq).subset_left_of_subset_union (region_isOpen hr₀) + isClosed_closure.isOpen_compl (disjoint_compl_right_iff_subset.mpr subset_closure) + hcov_q ⟨y₀, hy₀q, hy₀r₀⟩ + exact hz₁_not (hsub_r₀ hz₁q) + +/-- **(7.11)** of Graph Minors XII (page 271), for the subdrawing +`Γ' = H.span ∅ {e ∈ H.E | lam < d z e}` when `lam < θ` and `z ∈ H.E → 2 ≤ lam`. -/ +theorem theorem_7_11_span (hS : IsClosedSurface S) [ConnectedSpace S] + {H : Drawing S} {θ lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hMetric : HasTangleMetric H θ T d) (hE : H.E.Nonempty) + {z : Set S} (hz : z ∈ H.A) (hlam : lam < θ) (hz_lam : z ∈ H.E → 2 ≤ lam) : + (PaintingOrDrawing.drawing (H.span ∅ {f ∈ H.E | lam < d z f})).IsTwoCell := by + classical + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hResp, K, ins, hK, hd, hd_eq⟩ := hMetric + have hT := hResp.2.1 + have hpre : PreRad (PaintingOrDrawing.drawing H) K := ⟨hK.1, hK.2.1⟩ + have hpreT : IsPretangle H.toHypergraph θ T := + ⟨hT.one_le, hT.isSeparation, hT.order_lt, hT.axiom1, hT.axiom2⟩ + have hsl : IsSlope K (2 * θ) ins := + GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) hS hpreT hK.2.1.1 hd + obtain ⟨z', hz', -⟩ := existsUnique_correspondingAtom_t1 hK hz + obtain ⟨c, hc⟩ := atom_nonempty hz'.2.1 + set Z := restraintUnion K ins (2 * θ) c (2 * lam) + set Γ' := H.span ∅ {f ∈ H.E | lam < d z f} + have hz'Z : z' ⊆ Z := + correspondingAtom_subset_restraintUnion hS hResp hE hK hd hz' hc hlam hz_lam + have hZne : Z.Nonempty := ⟨c, hz'Z hc⟩ + have hZc : IsClosed Z := isClosed_restraintUnion hS c (2 * lam) + have hZn : IsGammaNice K Z := isGammaNice_restraintUnion c (2 * lam) + have hZs : IsSimplyConnectedSet Z := GM11.theorem_8_10_proof hS hsl hZne + obtain ⟨hZuniv, hΓ'E⟩ := + restraintUnion_ne_univ_and_span_E_nonempty hS hResp hE hK hd hd_eq hz hz' hc hlam hz_lam + have hΓ'U_pre : IsPreconnected Γ'.U := + isPreconnected_span_U hS hResp hE hK hd hd_eq hz hz' hc hlam hz_lam + have hsub : Γ'.IsSubdrawing H := H.span_isSubdrawing ∅ _ + -- Pick `e₀ ∈ Γ'.E` and `x₀ ∈ e₀`. Then `x₀ ∈ Γ'.U \ Z`. + obtain ⟨e₀, he₀⟩ := hΓ'E + have he₀H : e₀ ∈ H.E := hsub.2 he₀ + obtain ⟨x₀, hx₀⟩ := he₀.1 + have hx₀U' : x₀ ∈ Γ'.U := Γ'.closure_subset_U he₀ (subset_closure hx₀) + have hx₀U : x₀ ∈ H.U := hsub.U_subset hx₀U' + have hUU : H.U ∩ K.U = H.V := hK.2.1.1 + have hoff₀ : ∀ y ∈ e₀, y ∉ K.U := fun y hy hyK => by + have : y ∈ H.U ∩ K.U := ⟨(he₀H.2.1 hy).1, hyK⟩ + rw [hUU] at this + exact (he₀H.2.1 hy).2 this + set s₀ := connectedComponentIn (univ \ K.U) x₀ + have hs₀ : s₀ ∈ K.R := (mem_R_iff K).mpr ⟨x₀, hoff₀ x₀ hx₀, rfl⟩ + have hes₀ : e₀ ⊆ s₀ := + he₀H.2.2.1.isConnected.isPreconnected.subset_connectedComponentIn hx₀ + fun y hy => ⟨mem_univ y, hoff₀ y hy⟩ + have hs₀_compl : s₀ ⊆ Zᶜ := + (edge_mem_span_iff hS hResp hE hK hd hd_eq hz hz' hc hlam hz_lam he₀H hs₀ hes₀).mp he₀ + have hx₀_notZ : x₀ ∉ Z := hs₀_compl (hes₀ hx₀) + -- Work in the open punctured surface `W = {x₀}ᶜ`. + set W : Set S := {x₀}ᶜ + have hWo : IsOpen W := isOpen_compl_singleton + have hZW : Z ⊆ W := fun x hx hxx₀ => hx₀_notZ (mem_singleton_iff.mp hxx₀ ▸ hx) + have hZf : Flat (Subtype.val ⁻¹' Z : Set W) := flat_of_simplyConnected hZs hZW + -- Define the three families of open discs in `W`: + -- 1. `R₀ = {r ∈ H.R | (r ∩ Z).Nonempty}` + -- 2. `K₀ = {s ∈ K.R | s ⊆ Z}` + -- 3. `S₀ = H.V \ Γ'.V`, with open discs `D_v ⊆ Z` around each `v ∈ S₀`. + set R₀ : Set (Set S) := {r ∈ H.R | (r ∩ Z).Nonempty} + set K₀ : Set (Set S) := {s ∈ K.R | s ⊆ Z} + set S₀ : Set S := H.V \ Γ'.V + have hhub : ∀ r ∈ R₀, ∃ w_r, w_r ∈ r ∧ w_r ∈ K.V ∧ w_r ∈ Z := by + rintro r ⟨hr, y₀, hy₀⟩ + obtain ⟨w_r, ⟨hw_r, hw_V⟩, -⟩ := hK.2.1.2.2.1 r hr + have hj := joinedIn_region_inter_Z hS hK hZc hZn hr hw_r hw_V hy₀ + obtain ⟨γ_w, hγ_w⟩ := hj + have hw_mem : w_r ∈ r ∩ Z := by simpa using hγ_w 0 + exact ⟨w_r, hw_r, hw_V, hw_mem.2⟩ + choose! hub hub_r hub_V hub_Z using hhub + have hK₀_pt : ∀ s ∈ K₀, ∃ b_s, b_s ∈ s := fun s hs => region_nonempty hs.1 + choose! baseK hbaseK using hK₀_pt + have hS₀_disc : ∀ v ∈ S₀, ∃ U : Set S, IsOpenDisc U ∧ v ∈ U ∧ U ⊆ Z := fun v hv => + exists_openDisc_around_deleted_vertex hS hResp hE hK hd hd_eq hz hz' hc hlam hz_lam hv + choose! discV hdiscV_od hdiscV_mem hdiscV_sub using hS₀_disc + -- Index the open cover in `W`. + let ι := {r // r ∈ R₀} ⊕ ({s // s ∈ K₀} ⊕ {v // v ∈ S₀}) + let O_S : ι → Set S := + Sum.elim (fun r => r.1) (Sum.elim (fun s => s.1) (fun v => discV v.1)) + have hOS_od : ∀ i : ι, IsOpenDisc (O_S i) := by + rintro (r | (s | v)) + · exact hResp.1.2 r.1 r.2.1 + · exact radial_region_isOpenDisc hpre hS hK.2.2 s.2.1 + · exact hdiscV_od v.1 v.2 + have hOS_W : ∀ i : ι, O_S i ⊆ W := by + rintro (r | (s | v)) x hx hxx₀ + · rw [mem_singleton_iff] at hxx₀ + exact region_subset r.2.1 (hxx₀ ▸ hx) hx₀U + · exact hZW (s.2.2 hx) hxx₀ + · exact hZW (hdiscV_sub v.1 v.2 hx) hxx₀ + let b_S : ι → S := + Sum.elim (fun r => hub r.1) (Sum.elim (fun s => baseK s.1) (fun v => v.1)) + have hb_mem : ∀ i : ι, b_S i ∈ O_S i := by + rintro (r | (s | v)) + · exact hub_r r.1 r.2 + · exact hbaseK s.1 s.2 + · exact hdiscV_mem v.1 v.2 + have hb_Z : ∀ i : ι, b_S i ∈ Z := by + rintro (r | (s | v)) + · exact hub_Z r.1 r.2 + · exact s.2.2 (hbaseK s.1 s.2) + · exact hdiscV_sub v.1 v.2 (hdiscV_mem v.1 v.2) + let O_W : ι → Set W := fun i => Subtype.val ⁻¹' (O_S i) + let b_W : ι → W := fun i => ⟨b_S i, hOS_W i (hb_mem i)⟩ + -- For any `i : ι` and `y ∈ O_W i` with `y.1 ∈ Z`, there is a path in `O_W i ∩ Z_W` from `b_W i` + -- to `y`. + have hjoin_to_Z : ∀ (i : ι) (y : W), y ∈ O_W i → y.1 ∈ Z → + ∃ f : Cl (b_W i) y, Arw (O_W i) f ∧ Arw (Subtype.val ⁻¹' Z : Set W) f := by + rintro (r | (s | v)) y hy hyZ + · have hj : JoinedIn (r.1 ∩ Z) (hub r.1) y.1 := + joinedIn_region_inter_Z hS hK hZc hZn r.2.1 (hub_r r.1 r.2) (hub_V r.1 r.2) ⟨hy, hyZ⟩ + have hsub_W : r.1 ∩ Z ⊆ W := inter_subset_right.trans hZW + obtain ⟨p, hp⟩ := hj + let p_W : Path (b_W (Sum.inl r)) y := + ⟨⟨fun t => ⟨p t, hsub_W (hp t)⟩, by fun_prop⟩, Subtype.ext p.source, Subtype.ext p.target⟩ + exact ⟨Cl.mk p_W, ⟨p_W, fun t => (hp t).1, rfl⟩, ⟨p_W, fun t => (hp t).2, rfl⟩⟩ + · have hpc : IsPathConnected (O_W (Sum.inr (Sum.inl s))) := + isPathConnected_preimage (hOS_od (Sum.inr (Sum.inl s))).isPathConnected + (hOS_W (Sum.inr (Sum.inl s))) + have hj := hpc.joinedIn (b_W (Sum.inr (Sum.inl s))) (hb_mem (Sum.inr (Sum.inl s))) y hy + refine ⟨Cl.mk hj.somePath, ⟨hj.somePath, hj.somePath_mem, rfl⟩, + ⟨hj.somePath, fun t => s.2.2 (hj.somePath_mem t), rfl⟩⟩ + · have hpc : IsPathConnected (O_W (Sum.inr (Sum.inr v))) := + isPathConnected_preimage (hOS_od (Sum.inr (Sum.inr v))).isPathConnected + (hOS_W (Sum.inr (Sum.inr v))) + have hj := hpc.joinedIn (b_W (Sum.inr (Sum.inr v))) (hb_mem (Sum.inr (Sum.inr v))) y hy + refine ⟨Cl.mk hj.somePath, ⟨hj.somePath, hj.somePath_mem, rfl⟩, + ⟨hj.somePath, fun t => hdiscV_sub v.1 v.2 (hj.somePath_mem t), rfl⟩⟩ + -- Apply `flat_iUnion_cover` in `W`. + have hFlat_union : Flat (⋃ i : ι, O_W i) := by + refine flat_union_of_region_neighborhoods Z W hZf O_S hOS_od hOS_W b_W hb_mem hb_Z + hjoin_to_Z ?_ + intro i j y hyi hyj + rcases i with r | (s | v) <;> rcases j with r' | (s' | v') + all_goals first + | exact Or.inr (s.2.2 hyi) + | exact Or.inr (s'.2.2 hyj) + | exact Or.inr (hdiscV_sub v.1 v.2 hyi) + | exact Or.inr (hdiscV_sub v'.1 v'.2 hyj) + | exact Or.inl (congrArg Sum.inl (Subtype.ext (region_eq_of_mem r.2.1 r'.2.1 hyi hyj))) + -- Show that every point of `H.U \ Γ'.U` lies in `⋃ i, O_S i` (and in fact in `interior Z`). + have hU_diff_sub : H.U \ Γ'.U ⊆ ⋃ i : ι, O_S i := by + exact removed_drawing_in_region_neighborhoods hS hE hz hlam hz_lam hResp K ins hK hd hd_eq + z' hz' c hc hUU discV hZn hdiscV_mem + have hU_diff_intZ : H.U \ Γ'.U ⊆ interior Z := by + intro x hx + obtain ⟨i, hxi⟩ := mem_iUnion.mp (hU_diff_sub hx) + rcases i with r | (s | v) + · exact False.elim (region_subset r.2.1 hxi hx.1) + · exact mem_interior.mpr ⟨s.1, s.2.2, region_isOpen s.2.1, hxi⟩ + · exact mem_interior.mpr ⟨discV v.1, hdiscV_sub v.1 v.2, (hdiscV_od v.1 v.2).1, hxi⟩ + -- Now prove `IsTwoCell` for `Γ'`: `S` is connected and every region `q ∈ Γ'.R` is an open disc. + refine ⟨inferInstance, fun q hq => ?_⟩ + by_cases hq_sub : q ⊆ ⋃ i : ι, O_S i + · -- `q` lies in the flat union `⋃ i, O_S i ⊆ W`. + have hq_ne_univ : q ≠ univ := fun hun => region_subset hq (hun ▸ mem_univ x₀) hx₀U' + refine isOpenDisc_of_bound hS (region_isOpen hq) ⟨region_nonempty hq, region_isPreconnected hq⟩ + hq_ne_univ fun F hFq hF => ?_ + have hFU : F ⊆ ⋃ i : ι, O_S i := hFq.trans hq_sub + have hFW : F ⊆ W := fun x hx => by + obtain ⟨i, hxi⟩ := mem_iUnion.mp (hFU hx) + exact hOS_W i hxi + obtain ⟨ψ⟩ := id hF + let φ : C(Circle, S) := ⟨fun x => (ψ x).1, continuous_subtype_val.comp ψ.continuous⟩ + have hmem : ∀ t, φ (arcParam 1 t) ∈ W := fun t => hFW (ψ _).2 + let a : W := ⟨φ (arcParam 1 0), hmem 0⟩ + let γ_F : Path a a := + ⟨⟨fun t => ⟨φ (arcParam 1 t), hmem t⟩, by fun_prop⟩, rfl, Subtype.ext (by simp [a])⟩ + have hγ_mem : ∀ u, γ_F u ∈ ⋃ i : ι, O_W i := fun u => by + obtain ⟨i, hi⟩ := mem_iUnion.mp (hFU (ψ (arcParam 1 u)).2) + exact mem_iUnion.mpr ⟨i, hi⟩ + have hh : γ_F.Homotopic (Path.refl a) := + hFlat_union γ_F (Path.refl a) hγ_mem (fun _ => by simpa using hγ_mem 0) + have hnull : IsNullHomotopicOArcIn W F := + ⟨ψ, a.1, a.2, closedCurvesHomotopicIn_of_path 1 φ (ContinuousMap.const _ a.1) γ_F + (Path.refl a) (fun _ => rfl) (fun _ => rfl) hh⟩ + have hbd : Disjoint F (bd S) := disjoint_left.mpr fun x _ hx => hx (hS.2.2 x) + obtain ⟨Δ, hΔW, hΔ, hb⟩ := + (epstein S W F (IsClosedSurface.isSurface hS) inferInstance hF hFW hbd).1 hnull + -- `Δ` is disjoint from `Γ'.U` because `discBd Δ = F ⊆ q`, `Γ'.U` is preconnected, and `x₀ ∈ + -- Γ'.U \ Δ`. + have hF_disj : Disjoint F Γ'.U := + disjoint_left.mpr fun x hxF hxU => region_subset hq (hFq hxF) hxU + have hΔ_disj : Disjoint Δ Γ'.U := by + exact bounded_region_disc_disjoint_drawing (S := S) hS Γ' hΓ'U_pre x₀ hx₀U' F Δ + (fun h => hΔW h rfl) hΔ hb hF_disj + have hy_F : a.1 ∈ F := (ψ (arcParam 1 0)).2 + have hΔ_sub_q : Δ ⊆ q := + subset_region hq (IsClosedDisc.isSimplyConnectedSet hΔ).1.isConnected.isPreconnected + hΔ_disj (Surface.discBd_subset Δ (by rwa [hb])) (hFq hy_F) + exact ⟨Δ, hΔ_sub_q, hΔ, hb⟩ + · -- Some point `y₀ ∈ q` is not in `⋃ i, O_S i`. + obtain ⟨y₀, hy₀q, hy₀_not⟩ := not_subset.mp hq_sub + have hy₀_notH : y₀ ∉ H.U := fun hy₀H => + hy₀_not (hU_diff_sub ⟨hy₀H, region_subset hq hy₀q⟩) + obtain ⟨r₀, hr₀, hy₀r₀⟩ := exists_region_of_notMem hy₀_notH + have hr₀Z_empty : r₀ ∩ Z = ∅ := by + rw [← not_nonempty_iff_eq_empty] + intro hne + exact hy₀_not (mem_iUnion.mpr ⟨Sum.inl ⟨r₀, hr₀, hne⟩, hy₀r₀⟩) + have hr₀_sub_q : r₀ ⊆ q := by + have hr₀_disj : Disjoint r₀ Γ'.U := + disjoint_left.mpr fun x hxr₀ hxU' => region_subset hr₀ hxr₀ (hsub.U_subset hxU') + exact subset_region hq (region_isPreconnected hr₀) hr₀_disj hy₀r₀ hy₀q + -- Show `q ⊆ r₀`: if not, `q` meets `closure r₀ \ r₀ ⊆ H.U \ Γ'.U ⊆ interior Z`, so `r₀` meets + -- `Z`. + have hq_sub_r₀ : q ⊆ r₀ := by + exact region_not_contained_in_neighborhood_lies_outside (S := S) (H := H) Z Γ' + hU_diff_intZ q hq y₀ hy₀q r₀ hr₀ hy₀r₀ hr₀Z_empty + have hq_eq : q = r₀ := subset_antisymm hq_sub_r₀ hr₀_sub_q + rw [hq_eq] + exact hResp.1.2 r₀ hr₀ + +/-- **(7.11)** of Graph Minors XII (page 271): +Let `H` be a 2-cell drawing in a connected surface `S` with `E(H) ≠ ∅`, let `T` be a respectful +tangle in `H` of order `θ` with metric `d`, let `z ∈ A(H)` and let `λ ≥ 0` be an integer with +`z ∈ E(H) → 2 ≤ λ`. Let `Γ'` be the subdrawing of `H` formed by the edges `e` of `H` with +`d(z, e) > λ` and their ends. Suppose that `E(Γ') ≠ ∅`. Then `Γ'` is a 2-cell drawing in `S`. + +The paper omits `z ∈ E(H) → 2 ≤ λ`. A central edge belongs to the deleted neighborhood because +`d(z, z) = 0`. This is the deleted-edge bound in the corrected (7.8) and the printed (7.10). -/ +theorem theorem_7_11_proof (hS : IsClosedSurface S) [ConnectedSpace S] + {H : Drawing S} {θ lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hMetric : HasTangleMetric H θ T d) (hE : H.E.Nonempty) + {z : Set S} (hz : z ∈ H.A) (hz_lam : z ∈ H.E → 2 ≤ lam) + (hΓ'E : (H.span ∅ {f ∈ H.E | lam < d z f}).E.Nonempty) : + (PaintingOrDrawing.drawing (H.span ∅ {f ∈ H.E | lam < d z f})).IsTwoCell := by + obtain ⟨e₀, he₀⟩ := hΓ'E + rw [H.span_E] at he₀ + obtain ⟨⟨he₀H, hgt⟩, -⟩ := he₀ + obtain ⟨-, K, ins, hK, -, hd_eq⟩ := id hMetric + have hle_θ : d z e₀ ≤ θ := by + rw [hd_eq z hz e₀ (Or.inl (Or.inr he₀H))] + exact tangleMetric_le_order hK ins θ z e₀ + have hlam : lam < θ := lt_of_lt_of_le hgt hle_θ + exact theorem_7_11_span hS hMetric hE hz hlam hz_lam + +/-- **(7.11)** of Graph Minors XII (page 271) for `deleteAtomNeighborhood H d z lam`. -/ +theorem theorem_7_11_deleteAtomNeighborhood (hS : IsClosedSurface S) [ConnectedSpace S] + (H : Drawing S) (θ lam : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (z : Set S) + (hMetric : HasTangleMetric H θ T d) (hE : H.E.Nonempty) + (hz : z ∈ H.A) (hlam : lam < θ) (hz_lam : z ∈ H.E → 2 ≤ lam) : + (PaintingOrDrawing.drawing (deleteAtomNeighborhood H d z lam)).IsTwoCell := by + have hdel_eq : deleteAtomNeighborhood H d z lam = H.span ∅ {e ∈ H.E | lam < d z e} := by + rw [deleteAtomNeighborhood, ite_eq_right_iff.mpr fun h => False.elim (hE.ne_empty h)] + rw [hdel_eq] + exact theorem_7_11_span hS hMetric hE hz hlam hz_lam + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section711Cited.lean b/LeanPool/GraphMinor/GM12/Section711Cited.lean new file mode 100644 index 0000000000..c907f53bfe --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section711Cited.lean @@ -0,0 +1,32 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section711 + +/-! +# Graph Minors XII, (7.11), in the form that Graph Minors XV cites + +This file concludes `GM15.GM12Theorem711Statement` from `GM12.theorem_7_11_deleteAtomNeighborhood`. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +universe u + +/-- Graph Minors XII, (7.11) (page 271), as cited in (4.3) of Graph Minors XV (page 125), with the +hypothesis "if `z ∈ E(H)` then `λ ≥ 2`" that the printed statement omits. -/ +theorem gm12_theorem_7_11 : GM15.GM12Theorem711Statement.{u} := by + intro S _ _ H θ lam T d z hS hConn hMetric hE hz hlam hz_lam + have := hConn + exact theorem_7_11_deleteAtomNeighborhood hS H θ lam T d z hMetric hE hz hlam hz_lam + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section711a.lean b/LeanPool/GraphMinor/GM12/Section711a.lean new file mode 100644 index 0000000000..57e72a2741 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section711a.lean @@ -0,0 +1,497 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +import LeanPool.GraphMinor.GM12.Section1b + +public import LeanPool.GraphMinor.GM12.Section1 +public import LeanPool.GraphMinor.GM12.Section4CircuitWalk +public import LeanPool.GraphMinor.GM12.Section4WalkMetric +public import LeanPool.GraphMinor.GM11.Section85 +public import LeanPool.GraphMinor.GM11.Section810 +public import LeanPool.GraphMinor.GM11.ForestRegions +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM11.RadialFacts + +/-! +# Graph Minors XII, (7.11), Part 1: Restraint Union and Connectedness + +This file sets up the restraint union `Z = restraintUnion K ins (2 * θ) c (2 * λ)` used in the +proof of (7.11) of Graph Minors XII (pages 271–272), characterizes the edges of the +deleted-neighborhood +subdrawing in terms of radial regions outside `Z`, and proves that the deleted-neighborhood +subdrawing is non-null and has connected point set. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +theorem atom_nonempty {Γ : Drawing S} {x : Set S} (hx : x ∈ Γ.A) : x.Nonempty := by + rcases hx with (⟨v, -, rfl⟩ | hx) | hx + · exact singleton_nonempty v + · exact hx.1 + · exact region_nonempty hx + +omit [T2Space S] in +theorem existsUnique_correspondingAtom_t1 {H K : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) {x : Set S} (hx : x ∈ H.A) : + ∃! x' : Set S, IsCorrespondingAtom H K x x' := by + exact GM12.existsUnique_correspondingAtom hK hx + +omit [T2Space S] in +/-- Removing a finite set from an open connected subset of a closed surface leaves it preconnected. +-/ +theorem isPreconnected_sdiff_finite (hS : IsClosedSurface S) {O F : Set S} + (hO : IsOpen O) (hOc : IsPreconnected O) (hF : F.Finite) : IsPreconnected (O \ F) := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + induction F, hF using Set.Finite.induction_on with + | empty => + rw [sdiff_empty] + exact hOc + | @insert x F hxF hF ih => + have hG : IsOpen (O \ F) := hO.sdiff hF.isClosed + have hEq : O \ insert x F = (O \ F) \ {x} := by + ext y + simp only [mem_sdiff, mem_insert_iff, mem_singleton_iff] + tauto + rw [hEq] + by_cases hxG : x ∈ O \ F + · obtain ⟨Z, hZ, hxZ, hZG, hZc, hZcl⟩ := exists_punctured_nbhd hS hG hxG + obtain ⟨a, haZ⟩ : (Z \ {x}).Nonempty := by + by_contra hcon + rw [not_nonempty_iff_eq_empty] at hcon + rw [hcon, closure_empty] at hZcl + exact hZcl + have hcl : IsClosed ((O \ F)ᶜ ∪ {x}) := hG.isClosed_compl.union isClosed_singleton + refine isPreconnected_sdiff_of_local hG ih hcl ⟨x, hxG, rfl⟩ ⟨hZG haZ.1, haZ.2⟩ ?_ + rintro y _ ⟨t, ⟨-, ht⟩, htc⟩ + obtain rfl : t = x := ht + obtain ⟨b, hbZ, hbC⟩ := mem_closure_iff.mp htc Z hZ hxZ + have hbne : b ≠ t := (connectedComponentIn_subset _ _ hbC).2 + rw [connectedComponentIn_eq hbC] + refine hZc.subset_connectedComponentIn ⟨hbZ, hbne⟩ ?_ haZ + exact fun q hq => ⟨hZG hq.1, hq.2⟩ + · rw [sdiff_eq_left.mpr (disjoint_singleton_right.mpr hxG)] + exact ih + +omit [T2Space S] in +/-- Every edge of a drawing has at most 2 incident vertices. -/ +theorem edgeSize_drawing_le_two {H : Drawing S} {e : Set S} (he : e ∈ H.E) : + edgeSize H.toHypergraph e ≤ 2 := by + have hends : H.toHypergraph.ends e = closure e ∩ H.V := by + ext v + exact ⟨fun h => ⟨h.2.2, h.2.1⟩, fun h => ⟨he, h.2, h.1⟩⟩ + unfold edgeSize + rw [hends] + rcases H.edge_cond e he with ⟨a, b, -, hcap, -⟩ | ⟨a, hcap, -⟩ + · rw [hcap] + exact (ncard_insert_le a {b}).trans (by simp) + · rw [hcap, ncard_singleton] + omega + +/-- In the setting of (7.11), the radial atom `z'` corresponding to `z` lies in the restraint +union `restraintUnion K ins (2 * θ) c (2 * lam)` around any point `c ∈ z'`. -/ +theorem correspondingAtom_subset_restraintUnion (hS : IsClosedSurface S) [ConnectedSpace S] + {H K : Drawing S} {θ lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} + (hResp : IsRespectfulDrawingTangle H θ T) (hE : H.E.Nonempty) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + {z z' : Set S} (hz' : IsCorrespondingAtom H K z z') {c : S} (hc : c ∈ z') + (hlam : lam < θ) (hz_lam : z ∈ H.E → 2 ≤ lam) : + z' ⊆ restraintUnion K ins (2 * θ) c (2 * lam) := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hT := hResp.2.1 + have hpreT : IsPretangle H.toHypergraph θ T := + ⟨hT.one_le, hT.isSeparation, hT.order_lt, hT.axiom1, hT.axiom2⟩ + have hsl : IsSlope K (2 * θ) ins := + GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) hS hpreT hK.2.1.1 hd + rcases hz'.2.2 with ⟨v, hv, rfl, rfl⟩ | ⟨hzE, hr, hsub⟩ | ⟨hr, w, ⟨hwK, hwr⟩, rfl⟩ + · have hvc : v = c := (mem_singleton_iff.mp hc).symm + subst hvc + have hcK : v ∈ K.V := hK.2.1.2.1 hv + let W : GraphWalk K.toGraph v v := .nil hcK + have hWlen : W.length < 2 * θ := by + have := hT.one_le + change 0 < 2 * θ + omega + have h85 := GM11.theorem_8_5_proof hS hsl W hWlen + have hcW : v ∈ insWalk ins K W := + Or.inl ((walkDrawing K W).V_subset_U (by rw [walkDrawing_V]; exact W.start_mem_support)) + have hmem : insWalk ins K W ∈ + {X : Set S | IsRestraint K ins (2 * θ) X ∧ perimeterWalkLength K X ≤ 2 * lam ∧ v ∈ X} := + ⟨h85.1, h85.2.trans (Nat.zero_le _), hcW⟩ + exact singleton_subset_iff.mpr (mem_biUnion hmem hcW) + · have h2lam : 2 ≤ lam := hz_lam hzE + have h3θ : 3 ≤ θ := by omega + have hzH : z ∈ H.toHypergraph.edgeSet := hzE + have hsep := isSeparation_edgeHypergraph_deleteEdges hzH + have hsize : edgeSize H.toHypergraph z ≤ 2 := edgeSize_drawing_le_two hzE + have hord : separationOrder (edgeHypergraph H.toHypergraph z) + (H.toHypergraph.deleteEdges {z}) < θ := by + rw [separationOrder_edgeHypergraph_deleteEdges] + omega + have hmemT : (edgeHypergraph H.toHypergraph z, H.toHypergraph.deleteEdges {z}) ∈ T := + (GM10.theorem_2_7_proof hT.one_le hT.isSeparation hT.order_lt hT.axiom1 hT.axiom2).mp + hT z hzH (by omega) + have h11 := (theorem_1_1_proof hS hResp hE hK hd hsep hord).mp hmemT z + (by simp [edgeHypergraph]) + obtain ⟨C, hC, hCs, hClen, hCV, hzC⟩ := h11 + have hCeven := (circuit_length_eq_two_mul_ncard hK.2.1 hC hCs).1 + have hCV_le : (C.V ∩ H.V).ncard ≤ 2 := by + have hsubV : C.V ∩ H.V ⊆ H.toHypergraph.ends z := by + refine hCV.trans ?_ + intro x hx + exact hx.1 + have hends_fin : (H.toHypergraph.ends z).Finite := + H.toHypergraph.vertexSet_finite.subset fun x hx => H.toHypergraph.vertex_mem_of_inc hx + exact (ncard_le_ncard hsubV hends_fin).trans hsize + have hC' : C.IsCircuit := hC + obtain ⟨u₀, W₀, -, -, hV₀, -⟩ := hC' + have hu₀ : u₀ ∈ C.V := hV₀ ▸ W₀.start_mem_support + obtain ⟨W, hWC, hWlen⟩ := circuit_walk_at hC hCs hu₀ + have hWlt : W.length < 2 * θ := hWlen.trans_lt hClen + have hzW : (z ∩ insWalk ins K W).Nonempty := by + obtain ⟨p₀, hp₀⟩ := hzE.1 + refine ⟨p₀, hp₀, Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, ?_⟩, hzC hp₀⟩)⟩ + rw [hWC] + exact Drawing.IsSubdrawing.refl C + have hz'W : z' ⊆ insWalk ins K W := + (corresponding_atom_subset_iff hS hK hd hz' W hWlt).mpr hzW + have h85 := GM11.theorem_8_5_proof hS hsl W hWlt + have hper_le : perimeterWalkLength K (insWalk ins K W) ≤ 2 * lam := by + calc perimeterWalkLength K (insWalk ins K W) ≤ W.length := h85.2 + _ = C.length := hWlen + _ = 2 * (C.V ∩ H.V).ncard := hCeven + _ ≤ 2 * lam := by omega + have hmem : insWalk ins K W ∈ + {X : Set S | IsRestraint K ins (2 * θ) X ∧ perimeterWalkLength K X ≤ 2 * lam ∧ c ∈ X} := + ⟨h85.1, hper_le, hz'W hc⟩ + exact fun x hx => mem_biUnion hmem (hz'W hx) + · have hwc : w = c := (mem_singleton_iff.mp hc).symm + subst hwc + let W : GraphWalk K.toGraph w w := .nil hwK + have hWlen : W.length < 2 * θ := by + have := hT.one_le + change 0 < 2 * θ + omega + have h85 := GM11.theorem_8_5_proof hS hsl W hWlen + have hcW : w ∈ insWalk ins K W := + Or.inl ((walkDrawing K W).V_subset_U (by rw [walkDrawing_V]; exact W.start_mem_support)) + have hmem : insWalk ins K W ∈ + {X : Set S | IsRestraint K ins (2 * θ) X ∧ perimeterWalkLength K X ≤ 2 * lam ∧ w ∈ X} := + ⟨h85.1, h85.2.trans (Nat.zero_le _), hcW⟩ + exact singleton_subset_iff.mpr (mem_biUnion hmem hcW) + +/-- For an edge `e ∈ H.E` and its radial region `s ∈ K.R` (`e ⊆ s`), `e` has distance `> lam` from +`z` if and only if `s` lies in the complement of `restraintUnion K ins (2 * θ) c (2 * lam)`. -/ +theorem edge_mem_span_iff (hS : IsClosedSurface S) [ConnectedSpace S] + {H K : Drawing S} {θ lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {ins : Drawing S → Set S} + (hResp : IsRespectfulDrawingTangle H θ T) (hE : H.E.Nonempty) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hd_eq : ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = tangleMetric H K ins θ x y) + {z z' : Set S} (hz : z ∈ H.A) (hz' : IsCorrespondingAtom H K z z') {c : S} (hc : c ∈ z') + (hlam : lam < θ) (hz_lam : z ∈ H.E → 2 ≤ lam) + {e s : Set S} (he : e ∈ H.E) (hs : s ∈ K.R) (hes : e ⊆ s) : + e ∈ (H.span ∅ {f ∈ H.E | lam < d z f}).E ↔ + s ⊆ (restraintUnion K ins (2 * θ) c (2 * lam))ᶜ := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hT := hResp.2.1 + have hpreT : IsPretangle H.toHypergraph θ T := + ⟨hT.one_le, hT.isSeparation, hT.order_lt, hT.axiom1, hT.axiom2⟩ + have hsl : IsSlope K (2 * θ) ins := + GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) hS hpreT hK.2.1.1 hd + set Z := restraintUnion K ins (2 * θ) c (2 * lam) + have hZn : IsGammaNice K Z := isGammaNice_restraintUnion c (2 * lam) + have he_corr : IsCorrespondingAtom H K e s := + ⟨Or.inl (Or.inr he), Or.inr hs, Or.inr (Or.inl ⟨he, hs, hes⟩)⟩ + have hz'Z : z' ⊆ Z := + correspondingAtom_subset_restraintUnion hS hResp hE hK hd hz' hc hlam hz_lam + rw [H.span_E] + simp only [mem_inter_iff, mem_ofPred_eq, he, true_and, and_true] + constructor + · intro hgt y hys hyZ + obtain ⟨X, ⟨hXr, hXlen, hcX⟩, hyX⟩ := mem_iUnion₂.mp hyZ + obtain ⟨u, W, -, hWlen, hWlt, -, hWd⟩ := hXr.exists_walk hS + have hinsW : insWalk ins K W = X := insWalk_eq hS hsl hXr hWd + have hsX : s ⊆ insWalk ins K W := by + rw [hinsW] + exact nice_region hXr.isGammaNice hs ⟨y, hys, hyX⟩ + have hz'X : z' ⊆ insWalk ins K W := by + have hzc : (z ∩ insWalk ins K W).Nonempty := by + rw [← corresponding_atom_subset_iff hS hK hd hz' W hWlt] + rcases hz'.2.2 with ⟨v, hv, rfl, rfl⟩ | ⟨hzE, hr, hsub⟩ | ⟨hr, w, ⟨hwK, hwr⟩, rfl⟩ + · have hvc : v = c := (mem_singleton_iff.mp hc).symm + subst hvc + exact singleton_subset_iff.mpr (hinsW.symm ▸ hcX) + · exact nice_region hXr.isGammaNice hr ⟨c, hc, hcX⟩ |>.trans (by rw [hinsW]) + · have hwc : w = c := (mem_singleton_iff.mp hc).symm + subst hwc + exact singleton_subset_iff.mpr (hinsW.symm ▸ hcX) + exact (corresponding_atom_subset_iff hS hK hd hz' W hWlt).mpr hzc + obtain ⟨k, hk⟩ : ∃ k, W.length = 2 * k := ⟨_, closed_walk_length_eq_two_mul hK.2.1 W⟩ + have hd_le : tangleMetric H K ins θ z e ≤ k := + tangleMetric_le_of_walk hz' he_corr W hWlt hk hz'X hsX + have hk_le : k ≤ lam := by omega + rw [hd_eq z hz e (Or.inl (Or.inr he))] at hgt + omega + · intro hsZ + by_contra hle + push Not at hle + rw [hd_eq z hz e (Or.inl (Or.inr he))] at hle + obtain ⟨p₀, hp₀⟩ := region_nonempty hs + apply hsZ hp₀ + by_cases hze : z = e + · subst hze + have hzeq : z' = s := (existsUnique_correspondingAtom_t1 hK hz).unique hz' he_corr + exact hz'Z (hzeq.symm ▸ hp₀) + · classical + by_cases hex : ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H K z x' ∧ IsCorrespondingAtom H K e y' ∧ + W.length < 2 * θ ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W + · simp only [tangleMetric, hze, hex, ↓reduceIte] at hle + set S_k := {k : ℕ | ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H K z x' ∧ IsCorrespondingAtom H K e y' ∧ + W.length < 2 * θ ∧ W.length = 2 * k ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W} + have hle' : sInf S_k ≤ lam := hle + obtain ⟨u, W, x', y', hx', hy', hWlt, hx'W, hy'W⟩ := hex + obtain ⟨k₀, hk₀⟩ : ∃ k₀, W.length = 2 * k₀ := ⟨_, closed_walk_length_eq_two_mul hK.2.1 W⟩ + have hSk_ne : S_k.Nonempty := ⟨k₀, u, W, x', y', hx', hy', hWlt, hk₀, hx'W, hy'W⟩ + obtain ⟨u₁, W₁, x₁', y₁', hx₁', hy₁', hW₁lt, hW₁len, hx₁'W, hy₁'W⟩ := Nat.sInf_mem hSk_ne + have hx₁_eq : x₁' = z' := (existsUnique_correspondingAtom_t1 hK hz).unique hx₁' hz' + have hy₁_eq : y₁' = s := + (existsUnique_correspondingAtom_t1 hK (Or.inl (Or.inr he))).unique hy₁' he_corr + subst hx₁_eq hy₁_eq + have h85 := GM11.theorem_8_5_proof hS hsl W₁ hW₁lt + have hper : perimeterWalkLength K (insWalk ins K W₁) ≤ 2 * lam := by + calc perimeterWalkLength K (insWalk ins K W₁) ≤ W₁.length := h85.2 + _ = 2 * sInf S_k := hW₁len + _ ≤ 2 * lam := by omega + have hmem : insWalk ins K W₁ ∈ + {X : Set S | IsRestraint K ins (2 * θ) X ∧ perimeterWalkLength K X ≤ 2 * lam ∧ c ∈ X} := + ⟨h85.1, hper, hx₁'W hc⟩ + exact mem_biUnion hmem (hy₁'W hp₀) + · simp only [tangleMetric, hze, hex, ↓reduceIte] at hle + omega + +/-- In the setting of (7.11), `restraintUnion K ins (2 * θ) c (2 * lam) ≠ univ` and +`(H.span ∅ {e ∈ H.E | lam < d z e}).E` is nonempty. -/ +theorem restraintUnion_ne_univ_and_span_E_nonempty (hS : IsClosedSurface S) [ConnectedSpace S] + {H K : Drawing S} {θ lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {ins : Drawing S → Set S} + (hResp : IsRespectfulDrawingTangle H θ T) (hE : H.E.Nonempty) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hd_eq : ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = tangleMetric H K ins θ x y) + {z z' : Set S} (hz : z ∈ H.A) (hz' : IsCorrespondingAtom H K z z') {c : S} (hc : c ∈ z') + (hlam : lam < θ) (hz_lam : z ∈ H.E → 2 ≤ lam) : + restraintUnion K ins (2 * θ) c (2 * lam) ≠ univ ∧ + (H.span ∅ {f ∈ H.E | lam < d z f}).E.Nonempty := by + have : T2Space S := hS.2.1 + have hT := hResp.2.1 + have hpreT : IsPretangle H.toHypergraph θ T := + ⟨hT.one_le, hT.isSeparation, hT.order_lt, hT.axiom1, hT.axiom2⟩ + have hsl : IsSlope K (2 * θ) ins := + GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) hS hpreT hK.2.1.1 hd + have hrf := GM11.regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hE + obtain ⟨r₁, hr₁, hno₁⟩ := GM11.theorem_8_12_proof hS hsl c + obtain ⟨e₁, he₁, he₁r₁⟩ := hrf.1 r₁ hr₁ + have hr₁_compl : r₁ ⊆ (restraintUnion K ins (2 * θ) c (2 * lam))ᶜ := by + intro y hy hyZ + obtain ⟨X, ⟨hXr, -, hcX⟩, hyX⟩ := mem_iUnion₂.mp hyZ + exact hno₁ X hXr ⟨hcX, nice_region hXr.isGammaNice hr₁ ⟨y, hy, hyX⟩⟩ + obtain ⟨p₁, hp₁⟩ := region_nonempty hr₁ + refine ⟨fun hun => hr₁_compl hp₁ (hun ▸ mem_univ p₁), e₁, ?_⟩ + exact (edge_mem_span_iff hS hResp hE hK hd hd_eq hz hz' hc hlam hz_lam he₁ hr₁ he₁r₁).mpr + hr₁_compl + +/-- In the setting of (7.11), the point set of `H.span ∅ {e ∈ H.E | lam < d z e}` is +preconnected. -/ +theorem isPreconnected_span_U (hS : IsClosedSurface S) [ConnectedSpace S] + {H K : Drawing S} {θ lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {ins : Drawing S → Set S} + (hResp : IsRespectfulDrawingTangle H θ T) (hE : H.E.Nonempty) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hd_eq : ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = tangleMetric H K ins θ x y) + {z z' : Set S} (hz : z ∈ H.A) (hz' : IsCorrespondingAtom H K z z') {c : S} (hc : c ∈ z') + (hlam : lam < θ) (hz_lam : z ∈ H.E → 2 ≤ lam) : + IsPreconnected (H.span ∅ {f ∈ H.E | lam < d z f}).U := by + classical + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hT := hResp.2.1 + have hpre : PreRad (PaintingOrDrawing.drawing H) K := ⟨hK.1, hK.2.1⟩ + have hpreT : IsPretangle H.toHypergraph θ T := + ⟨hT.one_le, hT.isSeparation, hT.order_lt, hT.axiom1, hT.axiom2⟩ + have hsl : IsSlope K (2 * θ) ins := + GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) hS hpreT hK.2.1.1 hd + have hrf := GM11.regionFacts_of_radial hpre hS hK.2.2 hE + set Z := restraintUnion K ins (2 * θ) c (2 * lam) + set Γ' := H.span ∅ {f ∈ H.E | lam < d z f} + have hz'Z : z' ⊆ Z := + correspondingAtom_subset_restraintUnion hS hResp hE hK hd hz' hc hlam hz_lam + have hZne : Z.Nonempty := ⟨c, hz'Z hc⟩ + have hZc : IsClosed Z := isClosed_restraintUnion hS c (2 * lam) + have hZn : IsGammaNice K Z := isGammaNice_restraintUnion c (2 * lam) + have hZs : IsSimplyConnectedSet Z := GM11.theorem_8_10_proof hS hsl hZne + obtain ⟨hZuniv, hΓ'E⟩ := + restraintUnion_ne_univ_and_span_E_nonempty hS hResp hE hK hd hd_eq hz hz' hc hlam hz_lam + have hZcompl_conn : IsConnected Zᶜ := GM11.isConnected_compl hS hZc hZn hZs hZne hZuniv + have hW_pre : IsPreconnected (Zᶜ \ K.V) := + isPreconnected_sdiff_finite hS hZc.isOpen_compl hZcompl_conn.isPreconnected K.finite_V + -- Each point of `Γ'.U` lies in `closure e` for some `e ∈ Γ'.E`. + have hU_eq : Γ'.U = ⋃ e ∈ Γ'.E, closure e := by + apply subset_antisymm + · rintro x (hxV | hxE) + · rcases hxV with ⟨hx0, -⟩ | hxV + · exact hx0.elim + · obtain ⟨e, he, hxe, -⟩ := mem_iUnion₂.mp hxV + exact mem_iUnion₂.mpr ⟨e, by rwa [H.span_E], hxe⟩ + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hxE + exact mem_iUnion₂.mpr ⟨e, by rwa [H.span_E], hxe⟩ + · exact iUnion₂_subset fun e he => Γ'.closure_subset_U he + -- Map each `e ∈ H.E` to its radial region in `K.R`. + have hex_reg : ∀ e ∈ H.E, ∃ s ∈ K.R, e ⊆ s := fun e he => by + obtain ⟨p₀, hp₀⟩ := he.1 + have hUU : H.U ∩ K.U = H.V := hK.2.1.1 + have hoff : ∀ y ∈ e, y ∉ K.U := fun y hy hyK => by + have : y ∈ H.U ∩ K.U := ⟨(he.2.1 hy).1, hyK⟩ + rw [hUU] at this + exact (he.2.1 hy).2 this + refine ⟨connectedComponentIn (univ \ K.U) p₀, (mem_R_iff K).mpr ⟨p₀, hoff p₀ hp₀, rfl⟩, ?_⟩ + exact he.2.2.1.isConnected.isPreconnected.subset_connectedComponentIn hp₀ + fun y hy => ⟨mem_univ y, hoff y hy⟩ + choose! reg hreg_mem hreg_sub using hex_reg + have hΓ'E_sub : Γ'.E ⊆ H.E := by + rw [H.span_E] + exact inter_subset_right + intro U₁ U₂ hU₁ hU₂ hcov hne₁ hne₂ + by_contra hdisj + have hdisj' : ∀ x ∈ Γ'.U, x ∈ U₁ → x ∉ U₂ := fun x hx hx₁ hx₂ => hdisj ⟨x, hx, hx₁, hx₂⟩ + have hedge_side : ∀ e ∈ Γ'.E, closure e ⊆ U₁ ∨ closure e ⊆ U₂ := fun e he => by + have heH := hΓ'E_sub he + have hcl_pre : IsPreconnected (closure e) := heH.2.2.1.isConnected.isPreconnected.closure + have hcl_sub : closure e ⊆ Γ'.U := Γ'.closure_subset_U he + refine isPreconnected_iff_subset_of_disjoint.mp hcl_pre U₁ U₂ hU₁ hU₂ (hcl_sub.trans hcov) ?_ + rw [Set.eq_empty_iff_forall_notMem] + rintro x ⟨hx, hx₁, hx₂⟩ + exact hdisj' x (hcl_sub hx) hx₁ hx₂ + set E₁ := {e ∈ Γ'.E | closure e ⊆ U₁} + set E₂ := {e ∈ Γ'.E | closure e ⊆ U₂} + set C₁ := ⋃ e ∈ E₁, closure (reg e) + set C₂ := ⋃ e ∈ E₂, closure (reg e) + have hC₁ : IsClosed C₁ := + (Γ'.finite_edges.subset (sep_subset _ _)).isClosed_biUnion fun _ _ => isClosed_closure + have hC₂ : IsClosed C₂ := + (Γ'.finite_edges.subset (sep_subset _ _)).isClosed_biUnion fun _ _ => isClosed_closure + have hs_sub : ∀ s ∈ K.R, s ⊆ Zᶜ → s ⊆ C₁ ∪ C₂ := fun s hs hsZ => by + obtain ⟨e, he, hes⟩ := hrf.1 s hs + have heΓ' : e ∈ Γ'.E := + (edge_mem_span_iff hS hResp hE hK hd hd_eq hz hz' hc hlam hz_lam he hs hes).mpr hsZ + obtain ⟨p₀, hp₀⟩ := he.1 + have hreg_eq : reg e = s := + region_eq_of_mem (hreg_mem e he) hs (hreg_sub e he hp₀) (hes hp₀) + rw [← hreg_eq] + rcases hedge_side e heΓ' with h₁ | h₂ + · exact subset_closure.trans (subset_biUnion_of_mem (u := fun x => closure (reg x)) + (show e ∈ E₁ from ⟨heΓ', h₁⟩) |>.trans subset_union_left) + · exact subset_closure.trans (subset_biUnion_of_mem (u := fun x => closure (reg x)) + (show e ∈ E₂ from ⟨heΓ', h₂⟩) |>.trans subset_union_right) + have hZcompl_sub : Zᶜ ⊆ C₁ ∪ C₂ := by + intro y hyZ + refine (hC₁.union hC₂).closure_subset (mem_closure_iff.mpr fun O hO hyO => ?_) + obtain ⟨q, ⟨hqO, hqZ⟩, hqU⟩ := + exists_notMem_U (Γ := K) hS (hO.inter hZc.isOpen_compl) ⟨y, hyO, hyZ⟩ + obtain ⟨s, hs, hqs⟩ := exists_region_of_notMem hqU + have hsZ : s ⊆ Zᶜ := fun x hx hxZ => hqZ (nice_region hZn hs ⟨x, hx, hxZ⟩ hqs) + exact ⟨q, hqO, hs_sub s hs hsZ hqs⟩ + have hW_cov : Zᶜ \ K.V ⊆ C₁ ∪ C₂ := sdiff_subset.trans hZcompl_sub + have hW_ne₁ : ((Zᶜ \ K.V) ∩ C₁).Nonempty := by + obtain ⟨x₁, hx₁U, hx₁⟩ := hne₁ + rw [hU_eq] at hx₁U + obtain ⟨e₁, he₁, hxe₁⟩ := mem_iUnion₂.mp hx₁U + have he₁U₁ : closure e₁ ⊆ U₁ := (hedge_side e₁ he₁).resolve_right fun h₂ => + hdisj' x₁ (Γ'.closure_subset_U he₁ hxe₁) hx₁ (h₂ hxe₁) + have he₁H := hΓ'E_sub he₁ + obtain ⟨p₁, hp₁⟩ := he₁H.1 + have hp₁s : p₁ ∈ reg e₁ := hreg_sub e₁ he₁H hp₁ + have hs₁Z : reg e₁ ⊆ Zᶜ := + (edge_mem_span_iff hS hResp hE hK hd hd_eq hz hz' hc hlam hz_lam he₁H + (hreg_mem e₁ he₁H) (hreg_sub e₁ he₁H)).mp he₁ + have hp₁V : p₁ ∉ K.V := fun hV => + region_subset (hreg_mem e₁ he₁H) hp₁s (K.V_subset_U hV) + exact ⟨p₁, ⟨hs₁Z hp₁s, hp₁V⟩, + mem_biUnion (show e₁ ∈ E₁ from ⟨he₁, he₁U₁⟩) (subset_closure hp₁s)⟩ + have hW_ne₂ : ((Zᶜ \ K.V) ∩ C₂).Nonempty := by + obtain ⟨x₂, hx₂U, hx₂⟩ := hne₂ + rw [hU_eq] at hx₂U + obtain ⟨e₂, he₂, hxe₂⟩ := mem_iUnion₂.mp hx₂U + have he₂U₂ : closure e₂ ⊆ U₂ := (hedge_side e₂ he₂).resolve_left fun h₁ => + hdisj' x₂ (Γ'.closure_subset_U he₂ hxe₂) (h₁ hxe₂) hx₂ + have he₂H := hΓ'E_sub he₂ + obtain ⟨p₂, hp₂⟩ := he₂H.1 + have hp₂s : p₂ ∈ reg e₂ := hreg_sub e₂ he₂H hp₂ + have hs₂Z : reg e₂ ⊆ Zᶜ := + (edge_mem_span_iff hS hResp hE hK hd hd_eq hz hz' hc hlam hz_lam he₂H + (hreg_mem e₂ he₂H) (hreg_sub e₂ he₂H)).mp he₂ + have hp₂V : p₂ ∉ K.V := fun hV => + region_subset (hreg_mem e₂ he₂H) hp₂s (K.V_subset_U hV) + exact ⟨p₂, ⟨hs₂Z hp₂s, hp₂V⟩, + mem_biUnion (show e₂ ∈ E₂ from ⟨he₂, he₂U₂⟩) (subset_closure hp₂s)⟩ + obtain ⟨y, ⟨hyZ, hyV⟩, hyC₁, hyC₂⟩ := + isPreconnected_closed_iff.mp hW_pre C₁ C₂ hC₁ hC₂ hW_cov hW_ne₁ hW_ne₂ + obtain ⟨e₁, ⟨he₁, he₁U₁⟩, hy₁⟩ := mem_iUnion₂.mp hyC₁ + obtain ⟨e₂, ⟨he₂, he₂U₂⟩, hy₂⟩ := mem_iUnion₂.mp hyC₂ + have he₁H := hΓ'E_sub he₁ + have he₂H := hΓ'E_sub he₂ + by_cases hyU : y ∈ K.U + · obtain ⟨h, hh, hyh⟩ := K.exists_edge_of_mem hyU hyV + have hh₁ : closure h ⊆ closure (reg e₁) := + isClosed_closure.closure_subset_iff.mpr + (edge_subset_closure_of_incident hS hh (hreg_mem e₁ he₁H) ⟨y, hyh, hy₁⟩) + have hh₂ : closure h ⊆ closure (reg e₂) := + isClosed_closure.closure_subset_iff.mpr + (edge_subset_closure_of_incident hS hh (hreg_mem e₂ he₂H) ⟨y, hyh, hy₂⟩) + obtain ⟨v, hv, -, -, w, -, -, hcap, -⟩ := spoke_ends hpre hS hh + have hv_cl : v ∈ closure h := by + have : v ∈ closure h ∩ K.V := by rw [hcap]; simp + exact this.1 + have hv₁ : v ∈ closure e₁ := + hrf.2.2 (reg e₁) (hreg_mem e₁ he₁H) e₁ he₁H (hreg_sub e₁ he₁H) v hv (hh₁ hv_cl) + have hv₂ : v ∈ closure e₂ := + hrf.2.2 (reg e₂) (hreg_mem e₂ he₂H) e₂ he₂H (hreg_sub e₂ he₂H) v hv (hh₂ hv_cl) + exact hdisj' v (Γ'.closure_subset_U he₁ hv₁) (he₁U₁ hv₁) (he₂U₂ hv₂) + · obtain ⟨s, hs, hys⟩ := exists_region_of_notMem hyU + obtain ⟨q₁, hq₁s, hq₁r⟩ := mem_closure_iff.mp hy₁ s (region_isOpen hs) hys + obtain ⟨q₂, hq₂s, hq₂r⟩ := mem_closure_iff.mp hy₂ s (region_isOpen hs) hys + have hs₁ : reg e₁ = s := region_eq_of_mem (hreg_mem e₁ he₁H) hs hq₁r hq₁s + have hs₂ : reg e₂ = s := region_eq_of_mem (hreg_mem e₂ he₂H) hs hq₂r hq₂s + have he₁₂ : e₁ = e₂ := + hrf.2.1 s hs e₁ he₁H e₂ he₂H (hs₁ ▸ hreg_sub e₁ he₁H) (hs₂ ▸ hreg_sub e₂ he₂H) + obtain ⟨p₀, hp₀⟩ := he₁H.1 + exact hdisj' p₀ (Γ'.closure_subset_U he₁ (subset_closure hp₀)) + (he₁U₁ (subset_closure hp₀)) (he₂U₂ (subset_closure (he₁₂ ▸ hp₀))) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72.lean b/LeanPool/GraphMinor/GM12/Section72.lean new file mode 100644 index 0000000000..88695daafc --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72Respectful +public import LeanPool.GraphMinor.GM12.Section72LostAtoms +import LeanPool.GraphMinor.GM12.Section72RadialExists +import LeanPool.GraphMinor.GM12.Section72Slope + +/-! +# Graph Minors XII, (7.2) + +Restrict a respectful drawing tangle to the closed outside of its +selected disc bounded by a normal circle through one vertex. The +merged region is an open disc, and every lost atom is at distance at +most one from that vertex. Diversion proves respectfulness of the +restricted tangle. A radial subdrawing with the old region's hub +then gives both metric comparisons by lifting closed walks. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM14 Hypergraph + +/-- Graph Minors XII, (7.2), pages 259–260. Deleting the selected +inside of a normal circle through one vertex preserves the order of +the respectful tangle. Distances between shared atoms, and distances +from shared atoms to the enlarged region, do not decrease. -/ +theorem theorem_7_2_proof + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hθ : 2 ≤ θ) (hd : HasTangleMetric Γ θ T d) + {D F r : Set S} {v : S} (hD : IsClosedDisc D) (hbd : subBd D = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) (hFV : F ∩ Γ.V = {v}) + (hr : r ∈ Γ.R) (hFr : F \ {v} ⊆ r) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) : + (PaintingOrDrawing.drawing (Γ.interSet (closure (univ \ D)))).IsTwoCell ∧ + (∀ a ∈ Γ.A \ (Γ.interSet (closure (univ \ D))).A, d a {v} ≤ 1) ∧ + ∃ (d' : Set S → Set S → ℕ) (r' : Set S), + HasTangleMetric (Γ.interSet (closure (univ \ D))) θ + (restrictTangle T (Γ.interSet (closure (univ \ D))).toHypergraph) d' ∧ + r' ∈ (Γ.interSet (closure (univ \ D))).R ∧ r ⊆ r' ∧ + (∀ a ∈ Γ.A ∩ (Γ.interSet (closure (univ \ D))).A, + ∀ b ∈ Γ.A ∩ (Γ.interSet (closure (univ \ D))).A, d a b ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ (Γ.interSet (closure (univ \ D))).A, d a r ≤ d' a r') := by + let Γ' := Γ.interSet (closure (univ \ D)) + let Y := r ∪ (D \ {v}) + have hΓ : Γ'.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hrespect := theorem_7_2_respectful hS hθ hd hD hbd hn hFV hr hFr hm + have hY : Y ∈ Γ'.R := theorem_7_2_region hS hD hbd hn hFV hr hFr + have hvFV : v ∈ F ∩ Γ.V := hFV.symm ▸ mem_singleton v + have hF : IsOArc F := by + have hbF : discBd D = F := (IsClosedDisc.frontier_eq_discBd hS hD).symm.trans + ((subBd_eq_frontier D).symm.trans hbd) + exact hbF ▸ hD.isOArc_discBd + have hT : IsPretangle Γ.toHypergraph θ T := + ⟨hd.1.2.1.one_le, hd.1.2.1.isSeparation, hd.1.2.1.order_lt, + hd.1.2.1.axiom1, hd.1.2.1.axiom2⟩ + obtain ⟨K, ins, hK, hderived, hmetric⟩ := hd.2 + have hE : Γ.E.Nonempty := edgeSet_nonempty_of_isTangle_of_two_le hd.1.2.1 hθ + obtain ⟨K', hK', hKK, u, hur, huK'⟩ := exists_radial_subdrawing_after_disc_deletion + hS hT hθ hK hE hderived hF hvFV.1 hvFV.2 hr hFr hn hD hbd hm + have hderived' := derivedSlope_restrict_subdrawing hΓ hKK hderived + let d' := tangleMetric Γ' K' ins θ + have hmetric' : HasTangleMetric Γ' θ (restrictTangle T Γ'.toHypergraph) d' := + ⟨hrespect, K', ins, hK', hderived', fun _ _ _ _ => rfl⟩ + refine ⟨hrespect.1, ?_, d', Y, hmetric', hY, subset_union_left, ?_, ?_⟩ + · intro a ha + exact theorem_7_2_lost_atoms hS hθ hd hD hbd hn hFV hr hFr hm ha.1 ha.2 + · intro a ha b hb + rw [hmetric a ha.1 b hb.1] + exact tangleMetric_le_of_radial_subdrawing hS hΓ hKK hK hK' hderived ha.1 hb.1 + · intro a ha + rw [hmetric a ha.1 r (Or.inr hr)] + exact tangleMetric_region_le_of_radial_subdrawing hS hΓ hKK hK hK' hderived ha.1 hr hY + hur (Or.inl hur) huK' + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72BigonSides.lean b/LeanPool/GraphMinor/GM12/Section72BigonSides.lean new file mode 100644 index 0000000000..c063291f56 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72BigonSides.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72RadialHubs +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Comparing a possible empty bigon with the removed disc + +For the radial condition in XII (7.2), page 260, the boundary of a +possible new empty bigon lies in the closed outside of the removed +disc. The open interior of that disc is connected and misses the +bigon's boundary. It is therefore wholly inside the bigon or wholly +outside. In the first case the whole removed disc lies in the bigon. +If the bigon misses the boundary vertex, only the second case occurs, +and the bigon already lay in the original region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +/-- A closed disc whose boundary is outside a second disc either +contains that whole disc or misses its open interior. This is the +side comparison for the radial deletion in XII (7.2), page 260. -/ +theorem disc_subset_or_disjoint_interior_of_boundary_outside + (hS : IsClosedSurface S) {D Q : Set S} (hD : IsClosedDisc D) (hQ : IsClosedDisc Q) + (hbd : discBd Q ⊆ closure (univ \ D)) : + D ⊆ Q ∨ Disjoint (discInt D) Q := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hdis : Disjoint (discInt D) (discBd Q) := by + apply disjoint_left.mpr + intro x hxD hxQ + have hxint : x ∈ interior D := + interior_maximal (discInt_subset D) (hD.isOpen_discInt hman) hxD + have hxout := hbd hxQ + rw [← compl_eq_univ_sdiff, closure_compl] at hxout + exact hxout hxint + rcases hQ.side hman hD.isPreconnected_discInt hdis with hin | hout + · exact Or.inl (hD.subset_closure_discInt.trans + (closure_minimal (hin.trans (discInt_subset Q)) hQ.isClosed)) + · exact Or.inr hout + +/-- A possible new bigon that misses the removed boundary vertex +already lies in the old region with its own end vertex restored. +This is the unequal-vertex case of the radial condition in XII (7.2). -/ +theorem disc_subset_old_region_of_missing_boundary_vertex + (hS : IsClosedSurface S) {D Q r : Set S} {v x : S} + (hD : IsClosedDisc D) (hQ : IsClosedDisc Q) (hvD : v ∈ D) (hvQ : v ∉ Q) + (hbdQ : discBd Q ⊆ closure (univ \ D)) (hbdD : discBd D ⊆ r ∪ {v}) + (hQY : Q ⊆ (r ∪ (D \ {v})) ∪ {x}) : Q ⊆ r ∪ {x} := by + have hdis : Disjoint (discInt D) Q := by + rcases disc_subset_or_disjoint_interior_of_boundary_outside hS hD hQ hbdQ with hin | hout + · exact (hvQ (hin hvD)).elim + · exact hout + intro y hy + rcases hQY hy with (hyr | ⟨hyD, _⟩) | hyx + · exact Or.inl hyr + · have hybd : y ∈ discBd D := by + by_contra hn + exact disjoint_left.mp hdis ⟨hyD, hn⟩ hy + rcases hbdD hybd with hyr | hyv + · exact Or.inl hyr + · exact (hvQ (mem_singleton_iff.mp hyv ▸ hy)).elim + · exact Or.inr hyx + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72BoundaryCompare.lean b/LeanPool/GraphMinor/GM12/Section72BoundaryCompare.lean new file mode 100644 index 0000000000..e73f364488 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72BoundaryCompare.lean @@ -0,0 +1,149 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2InsideHomotopy +public import LeanPool.GraphMinor.GM12.Section2NormalNoncover +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM07.Section11c + +/-! +# A region deformation preserves the drawing inside the boundary + +In XII (7.2), page 260, replacing the boundary by its two-spoke circle +leaves the part of the original drawing in the selected disc unchanged. +The deformation uses only the region and its boundary vertex. Away +from that vertex it avoids every drawing point. A point outside both +selected discs supplies the second omitted point for the inside +comparison from (2.1). +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM07 + +/-- Equal intersections with the point set of a drawing give equal +intersection hypergraphs, including all incidence data. -/ +theorem inter_eq_of_drawing_inter_eq + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} {D E : Set S} + (h : Γ.U ∩ D = Γ.U ∩ E) : + (PaintingOrDrawing.drawing Γ).inter D = (PaintingOrDrawing.drawing Γ).inter E := by + have hx : ∀ x ∈ Γ.U, x ∈ D ↔ x ∈ E := by + intro x hx + exact ⟨fun hD => (h.subset ⟨hx, hD⟩).2, + fun hE => (h.superset ⟨hx, hE⟩).2⟩ + have he : ∀ e ∈ Γ.E, e ⊆ D ↔ e ⊆ E := by + intro e he + exact ⟨fun hs x hxe => (hx x (he.2.1 hxe).1).mp (hs hxe), + fun hs x hxe => (hx x (he.2.1 hxe).1).mpr (hs hxe)⟩ + apply Hypergraph.ext + · ext x + change (x ∈ Γ.V ∧ x ∈ D) ↔ x ∈ Γ.V ∧ x ∈ E + exact and_congr_right (fun hv => hx x (Γ.V_subset_U hv)) + · ext e + change (e ∈ Γ.E ∧ e ⊆ D) ↔ e ∈ Γ.E ∧ e ⊆ E + exact and_congr_right (he e) + · funext e x + apply propext + change (Γ.toHypergraph.Inc e x ∧ e ⊆ D ∧ x ∈ D) ↔ + Γ.toHypergraph.Inc e x ∧ e ⊆ E ∧ x ∈ E + apply and_congr_right + intro hi + exact and_congr (he e hi.1) (hx x (Γ.V_subset_U hi.2.1)) + +/-- Equality on drawing points and on boundary points also preserves +intersection with the closed outside. -/ +theorem drawing_inter_outside_eq_of_boundary_eq + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} {D E : Set S} + (h : Γ.U ∩ D = Γ.U ∩ E) + (hb : Γ.U ∩ frontier D = Γ.U ∩ frontier E) : + Γ.U ∩ closure (univ \ D) = Γ.U ∩ closure (univ \ E) := by + have hx : ∀ x ∈ Γ.U, x ∈ D ↔ x ∈ E := by + intro x hx + exact ⟨fun hD => (h.subset ⟨hx, hD⟩).2, + fun hE => (h.superset ⟨hx, hE⟩).2⟩ + have hbx : ∀ x ∈ Γ.U, x ∈ frontier D ↔ x ∈ frontier E := by + intro x hx + exact ⟨fun hD => (hb.subset ⟨hx, hD⟩).2, + fun hE => (hb.superset ⟨hx, hE⟩).2⟩ + have hint : ∀ x ∈ Γ.U, x ∈ interior D ↔ x ∈ interior E := by + intro x hxU + have hd := hx x hxU + have hb' := hbx x hxU + constructor + · intro hxD + have hxE := hd.mp (interior_subset hxD) + by_contra hxEi + have hfrontE : x ∈ frontier E := ⟨subset_closure hxE, hxEi⟩ + exact ((hb'.mpr hfrontE).2) hxD + · intro hxE + have hxD := hd.mpr (interior_subset hxE) + by_contra hxDi + have hfrontD : x ∈ frontier D := ⟨subset_closure hxD, hxDi⟩ + exact ((hb'.mp hfrontD).2) hxE + simp only [← compl_eq_univ_sdiff, closure_compl] + ext x + exact and_congr_right (fun hxU => not_congr (hint x hxU)) + +/-- The equality of drawing points inside two selected boundary discs +in the single-region deformation of XII (7.2), page 260. -/ +theorem drawing_inter_disc_eq_of_region_deformation + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) + {φ ψ : C(Circle, S)} (hφ : IsEmbedding φ) (hψ : IsEmbedding ψ) + {r D E : Set S} {v : S} (hr : r ∈ Γ.R) + (hvφ : v ∈ range φ) (hvψ : v ∈ range ψ) + (hD : IsClosedDisc D) (hE : IsClosedDisc E) + (hbdD : subBd D = range φ) (hbdE : subBd E = range ψ) + (hnφ : Γ.IsNormal (range φ)) (hnψ : Γ.IsNormal (range ψ)) + (hmD : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + (hmE : ((PaintingOrDrawing.drawing Γ).inter E, + (PaintingOrDrawing.drawing Γ).interOutside E) ∈ T) + (hh : ClosedCurvesHomotopicIn (r ∪ {v}) φ ψ) : + Γ.U ∩ D = Γ.U ∩ E := by + have hnDf : (PaintingOrDrawing.drawing Γ).IsNormal (frontier D) := by + rw [← subBd_eq_frontier, hbdD] + exact hnφ + have hnEf : (PaintingOrDrawing.drawing Γ).IsNormal (frontier E) := by + rw [← subBd_eq_frontier, hbdE] + exact hnψ + obtain ⟨q, hqΓ, hqD, hqE⟩ := exists_support_point_outside_two_small_sides + (Γ := .drawing Γ) hT hD.isCompact.isClosed hE.isCompact.isClosed hnDf hnEf hmD hmE + have hvD : v ∈ D := hD.isCompact.isClosed.closure_subset_iff.mpr subset_rfl + ((hbdD.symm ▸ hvφ).1) + have hvE : v ∈ E := hE.isCompact.isClosed.closure_subset_iff.mpr subset_rfl + ((hbdE.symm ▸ hvψ).1) + have hqZ : q ∉ r ∪ {v} := by + rintro (hqr | hqv) + · exact region_subset hr hqr hqΓ + · exact hqD (mem_singleton_iff.mp hqv ▸ hvD) + have hmem : ∀ x ∈ Γ.U, x ∈ D ↔ x ∈ E := by + intro x hx + by_cases hxv : x = v + · subst x + exact iff_of_true hvD hvE + · have hZpair : r ∪ {v} ⊆ ({x, q} : Set S)ᶜ := by + intro y hy hpair + rcases hpair with hyx | hyq + · subst y + rcases hy with hxr | hxv' + · exact region_subset hr hxr hx + · exact hxv hxv' + · exact hqZ (hyq ▸ hy) + exact mem_disc_iff_of_boundary_homotopy hS hφ hψ hD hE hbdD hbdE hqD hqE + (hh.mono hZpair) + ext x + exact and_congr_right (hmem x) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72ChordBigon.lean b/LeanPool/GraphMinor/GM12/Section72ChordBigon.lean new file mode 100644 index 0000000000..f5e026f4c9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72ChordBigon.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscArcs +public import LeanPool.GraphMinor.GM11.RadialChord +public import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# A chord cuts off a disc outside a nested disc + +For the equal-vertex case of the radial condition in XII (7.2), +page 260, the removed spoke is a chord of a possible new empty bigon. +Cut along that chord. The connected open interior of the removed disc +lies on one side of it. The other side is a closed disc outside that +open interior, bounded by the removed spoke and one of the two old +boundary spokes. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The chord argument for the equal-vertex case of the radial +condition in XII (7.2), page 260. One side of the chord misses the +open interior of the nested disc. -/ +theorem exists_chord_bigon_outside_nested_disc + {S : Type*} [TopologicalSpace S] [T2Space S] + {D Q F G H : Set S} {v u : S} + (hD : IsClosedDisc D) (hQ : IsClosedDisc Q) (hDQ : D ⊆ Q) + (hF : IsLineWithEnds F v u) (hG : IsLineWithEnds G v u) + (hH : IsLineWithEnds H v u) (hvu : v ≠ u) + (hFbd : F ⊆ discBd D) (hbdQ : discBd Q = G ∪ H) + (hGH : G ∩ H ⊆ {v, u}) (hFQ : F ∩ discBd Q = {v, u}) : + ∃ P : Set S, IsClosedDisc P ∧ P ⊆ Q ∧ + (discBd P = G ∪ F ∨ discBd P = H ∪ F) ∧ Disjoint (discInt D) P := by + have hFQsub : F ⊆ Q := hFbd.trans ((Surface.discBd_subset D).trans hDQ) + obtain ⟨A₁, A₂, Q₁, Q₂, _, hcomp, hQ₁, hQ₂, hUnion, hInter, hbd₁, hbd₂, _⟩ := + disc_iArc Q F v u hQ hFQsub hvu hF hFQ + have hparts : componentsIn (discBd Q \ {v, u}) = {G \ {v, u}, H \ {v, u}} := by + rw [hbdQ, union_sdiff_distrib] + apply componentsIn_union_eq_pair + (isPathConnected_sdiff_pair hG).isConnected.isPreconnected + (isPathConnected_sdiff_pair hH).isConnected.isPreconnected + (isPathConnected_sdiff_pair hG).nonempty + (isPathConnected_sdiff_pair hH).nonempty + · rw [closure_sdiff_pair hG] + exact disjoint_left.mpr fun x hxG hxH => hxH.2 (hGH ⟨hxG, hxH.1⟩) + · rw [closure_sdiff_pair hH] + exact disjoint_left.mpr fun x hxG hxH => hxG.2 (hGH ⟨hxG.1, hxH⟩) + have hends : ({v, u} : Set S) ⊆ F := fun x hx => (hFQ.superset hx).1 + have hrestore : ∀ L : Set S, (L \ {v, u}) ∪ F = L ∪ F := by + intro L + ext x + constructor + · rintro (hx | hx) + · exact Or.inl hx.1 + · exact Or.inr hx + · rintro (hx | hx) + · by_cases he : x ∈ ({v, u} : Set S) + · exact Or.inr (hends he) + · exact Or.inl ⟨hx, he⟩ + · exact Or.inr hx + have hbds : (discBd Q₁ = G ∪ F ∨ discBd Q₁ = H ∪ F) ∧ + (discBd Q₂ = G ∪ F ∨ discBd Q₂ = H ∪ F) := by + have ha₁ : A₁ ∈ componentsIn (discBd Q \ {v, u}) := hcomp.superset (Or.inl rfl) + have ha₂ : A₂ ∈ componentsIn (discBd Q \ {v, u}) := hcomp.superset (Or.inr rfl) + rw [hparts] at ha₁ ha₂ + constructor + · rcases ha₁ with h | h + · exact Or.inl (hbd₁.trans (h ▸ hrestore G)) + · exact Or.inr (hbd₁.trans (h ▸ hrestore H)) + · rcases ha₂ with h | h + · exact Or.inl (hbd₂.trans (h ▸ hrestore G)) + · exact Or.inr (hbd₂.trans (h ▸ hrestore H)) + have hsub : discInt D ⊆ Q₁ ∪ Q₂ := hUnion.symm ▸ ((discInt_subset D).trans hDQ) + have hseparate : ∀ x ∈ discInt D, x ∈ Q₁ → x ∉ Q₂ := by + intro x hxD hx₁ hx₂ + exact hxD.2 (hFbd (hInter.subset ⟨hx₁, hx₂⟩)) + rcases subset_or_subset_of_closed hD.isPreconnected_discInt hQ₁.isClosed hQ₂.isClosed + hsub hseparate with hin₁ | hin₂ + · refine ⟨Q₂, hQ₂, ?_, hbds.2, ?_⟩ + · exact fun x hx => hUnion ▸ Or.inr hx + · exact disjoint_left.mpr fun x hxD hx₂ => hseparate x hxD (hin₁ hxD) hx₂ + · refine ⟨Q₁, hQ₁, ?_, hbds.1, ?_⟩ + · exact fun x hx => hUnion ▸ Or.inl hx + · exact disjoint_left.mpr fun x hxD hx₁ => hseparate x hxD hx₁ (hin₂ hxD) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72CirclePatch.lean b/LeanPool/GraphMinor/GM12/Section72CirclePatch.lean new file mode 100644 index 0000000000..cd0d2d5217 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72CirclePatch.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72PushAway +public import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.Surface.ArcTools + +/-! +# A drawing of the two branches of a normal circle at a vertex + +In the diversion at the boundary vertex in XII (7.2), page 260, only +the two local branches of the circle matter. Choose a short line of +the circle containing it near the vertex and missing all other vertices. +Split this line at the vertex and add the two one-edge drawings. They +meet the old drawing only at that vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- The local drawing of a normal circle through a vertex, used in the +vertex case of the diversion in XII (7.2), page 260. There are just two +new edges at that vertex, and neither meets any other old vertex. -/ +theorem exists_normal_circle_patch {Γ : Drawing S} {C : Set S} {v : S} + (hC : IsOArc C) (hn : (PaintingOrDrawing.drawing Γ).IsNormal C) + (hvC : v ∈ C) (hv : v ∈ Γ.V) : + ∃ (H : Drawing S) (L₁ L₂ O : Set S) (a b : S), + IsOpen O ∧ v ∈ O ∧ C ∩ O ⊆ L₁ ∪ L₂ ∧ L₁ ∪ L₂ ⊆ C ∧ + Γ.U ∩ (L₁ ∪ L₂) ⊆ {v} ∧ + IsLineWithEnds L₁ v a ∧ IsLineWithEnds L₂ v b ∧ a ≠ v ∧ b ≠ v ∧ + L₁ ∩ L₂ = {v} ∧ H.U = Γ.U ∪ (L₁ ∪ L₂) ∧ + H.V = Γ.V ∪ {a, b} ∧ H.E = Γ.E ∪ {L₁ \ {v, a}, L₂ \ {v, b}} := by + have hVclosed : IsClosed (Γ.V \ {v}) := (Γ.finite_V.subset sdiff_subset).isClosed + obtain ⟨L, a, b, hL, hLC, hvL, hdis, hav, hbV, O, hOo, hvO, hCO⟩ := + exists_small_boundary_line hC hvC hVclosed (fun h => h.2 rfl) + have hmeet : Γ.U ∩ L ⊆ {v} := by + rintro x ⟨hxΓ, hxL⟩ + have hxV := hn ⟨hLC hxL, hxΓ⟩ + by_contra hxv + exact disjoint_left.mp hdis hxL ⟨hxV, hxv⟩ + obtain ⟨L₁, L₂, h₁, h₂, hLunion, hLcap⟩ := hL.split hvL hav.symm hbV.symm + have h₁' := Surface.IsLineWithEnds.symm h₁ + let D₁ := lineDrawing h₁' hav.symm + let D₂ := lineDrawing h₂ hbV.symm + have hmeet₁ : Γ.U ∩ D₁.U ⊆ Γ.V ∩ D₁.V := by + rintro x ⟨hxΓ, hxL⟩ + have hxv : x = v := mem_singleton_iff.mp (hmeet ⟨hxΓ, hLunion ▸ Or.inl hxL⟩) + subst x + exact ⟨hv, Or.inl rfl⟩ + let G := Γ.glue D₁ hmeet₁ + have hmeet₂ : G.U ∩ D₂.U ⊆ G.V ∩ D₂.V := by + rintro x ⟨hxG, hxL₂⟩ + have hxv : x = v := by + rcases hxG with hxΓ | hxL₁ + · exact mem_singleton_iff.mp (hmeet ⟨hxΓ, hLunion ▸ Or.inr hxL₂⟩) + · exact mem_singleton_iff.mp (hLcap ▸ ⟨hxL₁, hxL₂⟩) + subst x + exact ⟨Or.inl hv, Or.inl rfl⟩ + let H := G.glue D₂ hmeet₂ + refine ⟨H, L₁, L₂, O, a, b, hOo, hvO, ?_, ?_, ?_, h₁', h₂, hav, hbV, hLcap, ?_, ?_, ?_⟩ + · exact hLunion.symm ▸ hCO + · exact hLunion.symm ▸ hLC + · exact hLunion.symm ▸ hmeet + · change (Γ.U ∪ L₁) ∪ L₂ = Γ.U ∪ (L₁ ∪ L₂) + exact union_assoc _ _ _ + · change (Γ.V ∪ {v, a}) ∪ {v, b} = Γ.V ∪ {a, b} + ext x + by_cases hx : x ∈ Γ.V + · simp [hx] + · have hxv : x ≠ v := fun h => hx (h.symm ▸ hv) + simp [hx, hxv, or_comm] + · change (G.glue D₂ hmeet₂).E = _ + rw [Drawing.glue_E] + change (Γ.glue D₁ hmeet₁).E ∪ D₂.E = _ + rw [Drawing.glue_E, lineDrawing_E, lineDrawing_E] + ext e + simp only [mem_union, mem_insert_iff, mem_singleton_iff] + tauto + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72Circuit.lean b/LeanPool/GraphMinor/GM12/Section72Circuit.lean new file mode 100644 index 0000000000..4de0653c5b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72Circuit.lean @@ -0,0 +1,243 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72Trace +public import LeanPool.GraphMinor.GM12.Section72BoundaryCompare +import LeanPool.GraphMinor.GM11.OArcCircuit +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.Section91 + +/-! +# The radial boundary circuit for XII (7.2) + +On page 260 the boundary circle is replaced by two radial spokes. +The two-edge deformation supplies its embedded circle. Extract its +circuit from the trace drawing and compare the selected insides by +the region homotopy. Thus deleting the original selected inside +removes exactly the same original drawing points as deleting the +inside of the radial circuit. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM07 + +private theorem circuit_length_eq_two_of_le + {S : Type*} [TopologicalSpace S] + {Γ K C : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + (hC : C.IsCircuit) (hCK : C.IsSubdrawing K) (hle : C.length ≤ 2) : + C.length = 2 := by + classical + obtain ⟨u, W, ⟨_, hnd⟩, hpos, _, hCE⟩ := hC + have hl : C.length = W.length := by + rw [Drawing.length, hCE] + have he : {e | e ∈ W.edges} = (W.edges.toFinset : Set (Set S)) := by + ext x + simp + rw [he, ncard_coe_finset, List.toFinset_card_of_nodup hnd] + rfl + obtain ⟨X, _, hXE⟩ := hCK.exists_walk_up W + have hlen : X.length = W.length := congrArg List.length hXE + obtain ⟨n, hn⟩ := even_length_of_closed hK X + omega + +/-- The two edges of a radial boundary in a region with one old +vertex are parallel spokes from that vertex to the region's hub. +This spells out the edges `e, f` used in XII (7.2), page 260. -/ +theorem two_spokes_of_radial_boundary + {S : Type*} [TopologicalSpace S] + {Γ K C : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + (hCK : C.IsSubdrawing K) (hlen : C.length = 2) + {r : Set S} {v : S} (hr : r ∈ Γ.R) + (hCZ : C.U ⊆ r ∪ {v}) (hmeet : Γ.U ∩ C.U = {v}) : + ∃ (u : S) (e f : Set S), u ∈ r ∩ K.V ∧ e ≠ f ∧ C.E = {e, f} ∧ + K.toGraph.IsLink e v u ∧ K.toGraph.IsLink f v u := by + obtain ⟨u, hu, huniq⟩ := hK.2.2.1 r hr + have hend : ∀ e ∈ C.E, K.toGraph.IsLink e v u := by + intro e he + obtain ⟨z, hzΓ, w, hw, hcap⟩ := hK.2.2.2.2.1 e (hCK.2 he) + have hzcl : z ∈ closure e := by + have hz : z ∈ closure e ∩ K.V := by rw [hcap]; exact Or.inl rfl + exact hz.1 + have hwcl : w ∈ closure e := by + have hw' : w ∈ closure e ∩ K.V := by rw [hcap]; exact Or.inr rfl + exact hw'.1 + have hzv : z = v := mem_singleton_iff.mp + (hmeet.subset ⟨Γ.V_subset_U hzΓ, C.closure_subset_U he hzcl⟩) + have hwr : w ∈ r := by + rcases hCZ (C.closure_subset_U he hwcl) with hwr | hwv + · exact hwr + · exact (hw.2 (mem_singleton_iff.mp hwv ▸ hzv ▸ hzΓ)).elim + have hwu : w = u := huniq w ⟨hwr, hw.1⟩ + subst z + subst w + exact ⟨hCK.2 he, hK.2.1 hzΓ, hw.1, hcap⟩ + obtain ⟨e, f, hef, hCE⟩ := ncard_eq_two.mp hlen + exact ⟨u, e, f, hu, hef, hCE, + hend e (hCE.symm ▸ Or.inl rfl), hend f (hCE.symm ▸ Or.inr rfl)⟩ + +/-- The boundary of a two-spoke circuit has exactly its two common +ends as vertices. Its whole point set is the union of the spokes' +closures, as used in the radial deletion of XII (7.2), page 260. -/ +theorem two_spoke_circuit_point_sets + {S : Type*} [TopologicalSpace S] {K C : Drawing S} + (hC : C.IsCircuit) (hCK : C.IsSubdrawing K) + {e f : Set S} {v u : S} (hCE : C.E = {e, f}) + (he : K.toGraph.IsLink e v u) (hf : K.toGraph.IsLink f v u) : + C.V = {v, u} ∧ C.U = closure e ∪ closure f := by + have heC : e ∈ C.E := hCE.symm ▸ Or.inl rfl + have hcap : ∀ g ∈ C.E, closure g ∩ C.V = {v, u} := by + intro g hg + rw [hCK.closure_inter_V hg] + rcases hCE.subset hg with rfl | rfl + · exact he.2.2.2 + · exact hf.2.2.2 + have hCV : C.V = {v, u} := by + apply Subset.antisymm + · intro x hx + obtain ⟨W, _, hpos, _, _⟩ := exists_walk_at hC hx + cases W with + | nil hv => exact (Nat.lt_irrefl 0 hpos).elim + | @cons _ y _ g hlink rest => + have hxcl : x ∈ closure g ∩ C.V := by + rw [hlink.2.2.2] + exact Or.inl rfl + exact (hcap _ hlink.1).subset hxcl + · intro x hx + exact ((hcap e heC).superset hx).2 + refine ⟨hCV, ?_⟩ + rw [C.U_eq, hCE] + simp only [mem_insert_iff, mem_singleton_iff, iUnion_iUnion_eq_or_left, iUnion_iUnion_eq_left] + apply union_eq_right.mpr + intro x hx + exact Or.inl (((hcap e heC).superset (hCV ▸ hx)).1) + +/-- The two-spoke or backtracking alternative in XII (7.2), page 260. +In the backtracking case the selected disc lies in the region with +its boundary vertex restored. Otherwise the radial circuit inside +meets the original drawing in exactly the same points as the given +selected disc, and its boundary uses only the old region and vertex. -/ +theorem exists_radial_boundary_circuit_or_disc_subset_region + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) (hθ : 2 ≤ θ) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hE : Γ.E.Nonempty) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + {F r D : Set S} {v : S} (hF : IsOArc F) (hvF : v ∈ F) + (hv : v ∈ Γ.V) (hr : r ∈ Γ.R) (hFr : F \ {v} ⊆ r) + (hn : Γ.IsNormal F) (hD : IsClosedDisc D) (hbd : subBd D = F) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + : + D ⊆ r ∪ {v} ∨ ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing K ∧ C.length = 2 ∧ + Γ.U ∩ D = Γ.U ∩ ins C ∧ + (PaintingOrDrawing.drawing Γ).inter D = (PaintingOrDrawing.drawing Γ).inter (ins C) ∧ + (PaintingOrDrawing.drawing Γ).interOutside D = (PaintingOrDrawing.drawing Γ).interOutside + (ins C) ∧ + C.U ⊆ r ∪ {v} ∧ Γ.U ∩ C.U = {v} := by + obtain ⟨φ, ψ, W, hφ, hφF, hlen, hψU, hh, halt⟩ := + exists_two_spoke_deformation hS hK hE hF hvF hv hr hFr + rcases halt with hψ | ⟨L, hL, hψL, hLZ⟩ + · right + obtain ⟨C, hC, hCW, hCU⟩ := exists_circuit_of_oArc + (show IsOArc (range ψ) from ⟨hψ.toHomeomorph⟩) hψU.subset + have hCK := hCW.trans (walkDrawing_isSubdrawing K W) + have hCl : C.length ≤ 2 := by + have hle : C.E.ncard ≤ W.edges.length := + (ncard_le_ncard (fun e he => by + have hw := hCW.2 he + rwa [walkDrawing_E] at hw) W.edges.finite_toSet).trans (ncard_mem_list_le W.edges) + exact hle.trans (by simpa only [GraphWalk.length] using hlen.le) + obtain ⟨hE, hbdE, hmE⟩ := hd C hC hCK (by omega) + have hvψ : v ∈ range ψ := by + rw [hψU] + apply (walkDrawing K W).V_subset_U + rw [walkDrawing_V] + exact W.start_mem_support + have hψZ : range ψ ⊆ r ∪ {v} := by + obtain ⟨H, hHZ, _, hH1⟩ := hh + rintro x ⟨z, rfl⟩ + exact hH1 z ▸ hHZ (z, 1) + have hmeet : Γ.U ∩ range ψ = {v} := by + apply Subset.antisymm + · rintro x ⟨hxΓ, hxψ⟩ + rcases hψZ hxψ with hxr | hxv + · exact (region_subset hr hxr hxΓ).elim + · exact hxv + · intro x hx + have hxv := mem_singleton_iff.mp hx + subst x + exact ⟨Γ.V_subset_U hv, hvψ⟩ + have hnψ : Γ.IsNormal (range ψ) := by + rintro x ⟨hxψ, hxΓ⟩ + have hxv := mem_singleton_iff.mp (hmeet.subset ⟨hxΓ, hxψ⟩) + exact hxv ▸ hv + have heq := drawing_inter_disc_eq_of_region_deformation hS hT hφ hψ hr + (hφF.symm ▸ hvF) hvψ hD hE (hbd.trans hφF.symm) (hbdE.trans hCU) + (hφF.symm ▸ hn) hnψ hm hmE hh + have hΓF : Γ.U ∩ F = {v} := by + apply Subset.antisymm + · rintro x ⟨hxΓ, hxF⟩ + by_cases hxv : x = v + · exact hxv + · exact (region_subset hr (hFr ⟨hxF, hxv⟩) hxΓ).elim + · rintro x hx + have hxv := mem_singleton_iff.mp hx + subst x + exact ⟨Γ.V_subset_U hv, hvF⟩ + have hboundary : Γ.U ∩ frontier D = Γ.U ∩ frontier (ins C) := by + rw [← subBd_eq_frontier, hbd, hΓF, ← subBd_eq_frontier, hbdE, hCU, hmeet] + have hout := drawing_inter_outside_eq_of_boundary_eq heq hboundary + exact ⟨C, hC, hCK, circuit_length_eq_two_of_le hK.2.1 hC hCK hCl, heq, + inter_eq_of_drawing_inter_eq heq, inter_eq_of_drawing_inter_eq hout, + hCU ▸ hψZ, hCU ▸ hmeet⟩ + · left + exact selected_disc_subset_region_vertex_of_line_deformation hS hT hφ + (hφF.symm ▸ hn) hr (hφF.symm ▸ hvF) hD (hbd.trans hφF.symm) + hm hL hLZ hψL.subset hh + +/-- The radial boundary circuit in XII (7.2), page 260. Its inside +meets the original drawing in exactly the same points as the given +selected disc, and its boundary uses only the old region and vertex. -/ +theorem exists_radial_boundary_circuit + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) (hθ : 2 ≤ θ) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + {F r D : Set S} {v : S} (hF : IsOArc F) (hvF : v ∈ F) + (hv : v ∈ Γ.V) (hr : r ∈ Γ.R) (hFr : F \ {v} ⊆ r) + (hn : Γ.IsNormal F) (hD : IsClosedDisc D) (hbd : subBd D = F) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + (hED : ∃ e ∈ Γ.E, e ⊆ D) : + ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing K ∧ C.length = 2 ∧ + Γ.U ∩ D = Γ.U ∩ ins C ∧ + (PaintingOrDrawing.drawing Γ).inter D = (PaintingOrDrawing.drawing Γ).inter (ins C) ∧ + (PaintingOrDrawing.drawing Γ).interOutside D = (PaintingOrDrawing.drawing Γ).interOutside + (ins C) ∧ + C.U ⊆ r ∪ {v} ∧ Γ.U ∩ C.U = {v} := by + obtain ⟨e, he, heD⟩ := hED + rcases exists_radial_boundary_circuit_or_disc_subset_region hS hT hθ hK ⟨e, he⟩ hd + hF hvF hv hr hFr hn hD hbd hm with hDZ | hC + · obtain ⟨x, hxe⟩ := he.1 + rcases hDZ (heD hxe) with hxr | hxv + · exact (region_subset hr hxr (he.2.1 hxe).1).elim + · exact ((he.2.1 hxe).2 (mem_singleton_iff.mp hxv ▸ hv)).elim + · exact hC + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72CornerCaps.lean b/LeanPool/GraphMinor/GM12/Section72CornerCaps.lean new file mode 100644 index 0000000000..64f2cf05e9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72CornerCaps.lean @@ -0,0 +1,135 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Corners +import LeanPool.GraphMinor.GM11.RadialCap +import LeanPool.GraphMinor.Surface.ArcTools + +/-! +# Small discs in corners for the local diversion in XII (7.2) + +A corner between two half-edges has a small closed disc whose boundary +contains an initial part of each half-edge. The disc meets the drawing +only in those two initial parts. These discs allow a diversion near the +boundary vertex while keeping the outside drawing fixed. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +private theorem exists_small_parameter {f : I → S} (hf : Continuous f) + {O : Set S} (hO : IsOpen O) (h0 : f 0 ∈ O) {τ : I} (hτ : 0 < τ) : + ∃ t : I, 0 < t ∧ t < 1 ∧ t ≤ τ ∧ ∀ u, u ≤ t → f u ∈ O := by + obtain ⟨ε, hε, hb⟩ := Metric.isOpen_iff.mp (hO.preimage hf) 0 h0 + let r : ℝ := min (ε / 2) (min τ.1 (1 / 2)) + have hr : 0 < r := by + apply lt_min (by linarith) + exact lt_min hτ (by norm_num) + have hrτ : r ≤ τ.1 := (min_le_right _ _).trans (min_le_left _ _) + have hrhalf : r ≤ 1 / 2 := (min_le_right _ _).trans (min_le_right _ _) + have hrε : r ≤ ε / 2 := min_le_left _ _ + refine ⟨⟨r, hr.le, by linarith⟩, hr, by change r < 1; linarith, hrτ, ?_⟩ + intro u hu + apply hb + rw [Metric.mem_ball, Subtype.dist_eq] + simp only [Set.Icc.coe_zero, Real.dist_eq, sub_zero] + rw [abs_of_nonneg u.2.1] + have hu' : u.1 ≤ r := hu + linarith + +/-- A small cap of a corner, used for the local diversion at the vertex in +XII (7.2), page 260. Its only points on the drawing are on its two spokes. -/ +theorem exists_corner_cap (hS : IsClosedSurface S) + {H : Drawing S} {γ : Set S → I → S} (hγ : EdgePar H γ) + {v : S} {next : halfEdges H γ v → halfEdges H γ v} + {ρ P Q : halfEdges H γ v → Set S} {W : Set S} + {τ : halfEdges H γ v → I} + (hsec : IsSectors H γ v next ρ P W Q τ) (k : halfEdges H γ v) : + ∃ (t₀ t₁ : I) (D : Set S), 0 < t₀ ∧ t₀ < 1 ∧ 0 < t₁ ∧ t₁ < 1 ∧ + IsClosedDisc D ∧ D ⊆ W ∧ D ⊆ Q k ∧ + spoke γ k.1 '' Icc 0 t₀ ∪ spoke γ (next k).1 '' Icc 0 t₁ ⊆ discBd D ∧ + D ∩ H.U ⊆ spoke γ k.1 '' Icc 0 t₀ ∪ spoke γ (next k).1 '' Icc 0 t₁ := by + have hz : ∀ i : halfEdges H γ v, spoke γ i.1 0 = v := fun i => (spoke_zero γ i.1).trans i.2.2 + obtain ⟨W', hW'o, hvW', hcap⟩ := exists_cap hS (hsec.disc k) (hsec.bd k) hsec.isOpen hsec.mem + obtain ⟨t₀, ht₀, ht₀1, ht₀τ, ht₀W⟩ := exists_small_parameter (continuous_spoke hγ k.2.1) hW'o + (by rw [hz]; exact hvW') (hsec.pos k) + obtain ⟨t₁, ht₁, ht₁1, ht₁τ, ht₁W⟩ := exists_small_parameter (continuous_spoke hγ + (next k).2.1) hW'o + (by rw [hz]; exact hvW') (hsec.pos (next k)) + let A := spoke γ k.1 '' Icc 0 t₀ + let B := spoke γ (next k).1 '' Icc 0 t₁ + let a := spoke γ k.1 t₀ + let b := spoke γ (next k).1 t₁ + have hA : IsLineWithEnds A v a := by + have h := isLine_spoke_piece hγ k.2.1 ht₀ + rwa [hz] at h + have hB : IsLineWithEnds B v b := by + have h := isLine_spoke_piece hγ (next k).2.1 ht₁ + rwa [hz] at h + have hvA : v ∈ A := ⟨0, ⟨le_rfl, ht₀.le⟩, hz k⟩ + have hvB : v ∈ B := ⟨0, ⟨le_rfl, ht₁.le⟩, hz (next k)⟩ + have hAB : A ∩ B = {v} := by + refine Subset.antisymm ?_ (singleton_subset_iff.mpr ⟨hvA, hvB⟩) + rintro x ⟨⟨s, hs, rfl⟩, t, ht, hts⟩ + by_cases hs0 : s = 0 + · exact mem_singleton_iff.mpr (by rw [hs0, hz]) + · have hspos : 0 < s := unitInterval.pos_iff_ne_zero.mpr hs0 + by_cases ht0 : t = 0 + · rw [ht0, hz] at hts + exact mem_singleton_iff.mpr hts.symm + · have htpos : 0 < t := unitInterval.pos_iff_ne_zero.mpr ht0 + have hne : k.1 ≠ (next k).1 := fun he => hsec.next_ne k (Subtype.ext he.symm) + have hs1 := (spoke_eq_of_ne hγ k.2.1 (next k).2.1 hne hspos htpos hts.symm).1 + exact ((hs.2.trans_lt ht₀1).ne hs1).elim + have hline : IsLineWithEnds (A ∪ B) a b := IsLineWithEnds.union hA hB hAB + have hab : a ≠ b := by + intro he + have hmem : a ∈ A ∩ B := + ⟨⟨t₀, ⟨bot_le, le_rfl⟩, rfl⟩, t₁, ⟨bot_le, le_rfl⟩, he.symm⟩ + have hav : a = v := mem_singleton_iff.mp (hAB ▸ hmem) + have h₀ := spoke_injective hγ k.2.1 (hav.trans (hz k).symm) + exact ht₀.ne' h₀ + have hTbd : A ∪ B ⊆ discBd (Q k) := by + rintro x (⟨s, hs, rfl⟩ | ⟨s, hs, rfl⟩) + · exact hsec.left k s (hs.2.trans ht₀τ) + · exact hsec.right k s (hs.2.trans ht₁τ) + have hTW : A ∪ B ⊆ W' := by + rintro x (⟨s, hs, rfl⟩ | ⟨s, hs, rfl⟩) + · exact ht₀W s hs.2 + · exact ht₁W s hs.2 + have hva : v ≠ a := by + intro he + have h₀ := spoke_injective hγ k.2.1 (he.symm.trans (hz k).symm) + exact ht₀.ne' h₀ + have hvb : v ≠ b := by + intro he + have h₁ := spoke_injective hγ (next k).2.1 (he.symm.trans (hz (next k)).symm) + exact ht₁.ne' h₁ + obtain ⟨C, D, _, _, _, _, hD, hDW, hDQ, hDb, hDbd⟩ := + hcap a b (A ∪ B) hab hline hTbd hTW (Or.inl hvA) hva hvb + refine ⟨t₀, t₁, D, ht₀, ht₀1, ht₁, ht₁1, hD, hDW, hDQ, ?_, ?_⟩ + · rw [hDb] + exact subset_union_left + · rintro x ⟨hxD, hxH⟩ + have hxQ : x ∈ discBd (Q k) := by + by_contra hxnot + have hxP := hsec.inside k ⟨⟨hDW hxD, hDQ hxD⟩, hxnot⟩ + exact region_subset (hsec.corners.region k) (hsec.sub k hxP) hxH + exact hDbd ⟨hxD, hxQ⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72DiscGluing.lean b/LeanPool/GraphMinor/GM12/Section72DiscGluing.lean new file mode 100644 index 0000000000..19d963157d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72DiscGluing.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscUnion +public import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Gluing the removed disc to an outside bigon + +For maximality in XII (7.2), page 260, a disc between the deleted +spoke and a new spoke can be joined to the removed disc. Their +intersection is just that spoke. The joined disc is bounded by the +retained spoke and the new spoke. The side lemmas here also locate +the intersection of two discs whose open interiors are disjoint. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- If the open interior of one disc misses the other, any common +point lies on both boundaries. -/ +theorem disc_inter_subset_boundaries (hS : IsClosedSurface S) + {D Q : Set S} (hD : IsClosedDisc D) (hQ : IsClosedDisc Q) + (hdis : Disjoint (discInt D) Q) : D ∩ Q ⊆ discBd D ∩ discBd Q := by + rintro x ⟨hxD, hxQ⟩ + have hxDb : x ∈ discBd D := by + by_contra hn + exact disjoint_left.mp hdis ⟨hxD, hn⟩ hxQ + have hxQb : x ∈ discBd Q := by + by_contra hn + have hxcl : x ∈ closure (discInt D) := hD.subset_closure_discInt hxD + have hopen : IsOpen (discInt Q) := hQ.isOpen_discInt fun y => (hS.2.2 y).isManifoldPoint + obtain ⟨y, hyQ, hyD⟩ := mem_closure_iff.mp hxcl _ hopen ⟨hxQ, hn⟩ + exact disjoint_left.mp hdis hyD hyQ.1 + exact ⟨hxDb, hxQb⟩ + +/-- If a disc's open interior misses another disc's boundary, and +one of its boundary points is outside that disc, the open interior +lies wholly outside. -/ +theorem discInt_disjoint_of_boundary_point_outside (hS : IsClosedSurface S) + {D Q : Set S} (hD : IsClosedDisc D) (hQ : IsClosedDisc Q) + (hdis : Disjoint (discInt Q) (discBd D)) + {z : S} (hz : z ∈ Q) (hzD : z ∉ D) : Disjoint (discInt Q) D := by + rcases hD.side (fun y => (hS.2.2 y).isManifoldPoint) hQ.isPreconnected_discInt hdis with hin | + hout + · have hQD : Q ⊆ D := hQ.subset_closure_discInt.trans + (closure_minimal (hin.trans (discInt_subset D)) hD.isClosed) + exact (hzD (hQD hz)).elim + · exact hout + +/-- Gluing along the deleted spoke replaces it in the boundary by +the retained spoke. This is the disc union used for maximality in +XII (7.2), page 260. -/ +theorem glue_bigons_along_spoke {D Q E F L : Set S} {v u : S} + (hD : IsClosedDisc D) (hQ : IsClosedDisc Q) (hF : IsLineWithEnds F v u) + (hinter : D ∩ Q = F) (hbdD : discBd D = E ∪ F) (hbdQ : discBd Q = F ∪ L) + (hEF : E ∩ F ⊆ {v, u}) (hLF : L ∩ F ⊆ {v, u}) (hends : ({v, u} : Set S) ⊆ E) : + IsClosedDisc (D ∪ Q) ∧ discBd (D ∪ Q) = E ∪ L := by + have hFD : F ⊆ discBd D := hbdD.symm ▸ subset_union_right + have hFQ : F ⊆ discBd Q := hbdQ.symm ▸ subset_union_left + obtain ⟨hUnion, hbd⟩ := disc_union D Q F v u hD hQ hF hinter hFD hFQ + refine ⟨hUnion, hbd.trans ?_⟩ + rw [hbdD, hbdQ] + ext x + constructor + · rintro ⟨(hxE | hxF) | (hxF | hxL), hxnot⟩ + · exact Or.inl hxE + · exact Or.inl (hends (by by_contra hn; exact hxnot ⟨hxF, hn⟩)) + · exact Or.inl (hends (by by_contra hn; exact hxnot ⟨hxF, hn⟩)) + · exact Or.inr hxL + · rintro (hxE | hxL) + · exact ⟨Or.inl (Or.inl hxE), fun hx => hx.2 (hEF ⟨hxE, hx.1⟩)⟩ + · exact ⟨Or.inr (Or.inr hxL), fun hx => hx.2 (hLF ⟨hxL, hx.1⟩)⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72DiscMap.lean b/LeanPool/GraphMinor/GM12/Section72DiscMap.lean new file mode 100644 index 0000000000..a09be5bb96 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72DiscMap.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.Cap + +/-! +# Extending the boundary map used in XII (7.2) + +A continuous bijection between the boundaries of two closed discs extends +to a continuous bijection of the discs. In disc coordinates, the boundary +map is a homeomorphism of the unit circle. Schoenflies extends it to the +plane and maps the closed unit disc to itself. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric GraphMinor.Surface + +universe u v + +/-- Extend a prescribed boundary map between closed discs. This supplies the +disc replacement in the merged-region argument of XII (7.2), page 260. -/ +theorem exists_disc_boundary_extension + {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] + {D : Set X} {E : Set Y} + (hD : IsClosedDisc D) (hE : IsClosedDisc E) (f : X → Y) + (hf : ContinuousOn f (discBd D)) (hi : InjOn f (discBd D)) + (himage : f '' discBd D = discBd E) : + ∃ g : X → Y, ContinuousOn g D ∧ InjOn g D ∧ g '' D = E ∧ + EqOn g f (discBd D) := by + classical + obtain ⟨a, b, c⟩ := hD.exists_isChart + obtain ⟨a', b', c'⟩ := hE.exists_isChart + have hb : MapsTo b (sphere 0 1) (discBd D) := fun z hz => c.g_sphere ▸ mem_image_of_mem b hz + have ha' : MapsTo a' (discBd E) (sphere 0 1) := fun z hz => c'.bd ▸ mem_image_of_mem a' hz + have hfbd : MapsTo f (discBd D) (discBd E) := fun z hz => himage ▸ mem_image_of_mem f hz + let F : sphere (0 : ℂ) 1 → sphere (0 : ℂ) 1 := + fun z => ⟨a' (f (b z)), ha' (hfbd (hb z.2))⟩ + have hFc : Continuous F := by + refine Continuous.subtype_mk ?_ _ + exact (c'.hc.comp (hf.comp (c.gc.mono sphere_subset_closedBall) hb) + (fun z hz => Surface.discBd_subset E (hfbd (hb hz)))).comp_continuous + continuous_subtype_val (fun z => z.2) + have hFi : Function.Injective F := by + intro z w hzw + have h₁ : a' (f (b z)) = a' (f (b w)) := congrArg Subtype.val hzw + have h₂ : f (b z) = f (b w) := c'.gh.injOn + (Surface.discBd_subset E (hfbd (hb z.2))) + (Surface.discBd_subset E (hfbd (hb w.2))) h₁ + have h₃ : b z = b w := hi (hb z.2) (hb w.2) h₂ + exact Subtype.ext (c.hg.injOn (sphere_subset_closedBall z.2) (sphere_subset_closedBall w.2) h₃) + have hFs : Function.Surjective F := by + rintro ⟨z, hz⟩ + have hb'z : b' z ∈ discBd E := c'.g_sphere ▸ mem_image_of_mem b' hz + rw [← himage] at hb'z + obtain ⟨x, hx, hfx⟩ := hb'z + have hax : a x ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem a hx + refine ⟨⟨a x, hax⟩, Subtype.ext ?_⟩ + change a' (f (b (a x))) = z + rw [c.gh (Surface.discBd_subset D hx), hfx, c'.hg (sphere_subset_closedBall hz)] + let e : sphere (0 : ℂ) 1 ≃ₜ sphere (0 : ℂ) 1 := + hFc.homeoOfEquivCompactToT2 (f := Equiv.ofBijective F ⟨hFi, hFs⟩) + obtain ⟨p, q, m, hp⟩ := exists_bdMatch e + obtain ⟨G, hGbd, hGball⟩ := exists_plane_homeomorph oArc_sphere oArc_sphere m + rw [closedInner_sphere] at hGball + have hGmem : MapsTo G (closedBall 0 1) (closedBall 0 1) := + fun z hz => hGball ▸ mem_image_of_mem G hz + let g : X → Y := fun x => b' (G (a x)) + refine ⟨g, c'.gc.comp (G.continuous.continuousOn.comp c.hc (fun _ _ => mem_univ _)) + (fun x hx => hGmem (c.hm hx)), ?_, ?_, ?_⟩ + · intro x hx y hy hxy + have h₁ : G (a x) = G (a y) := c'.hg.injOn (hGmem (c.hm hx)) (hGmem (c.hm hy)) hxy + exact c.gh.injOn hx hy (G.injective h₁) + · change (b' ∘ G ∘ a) '' D = E + have haD : a '' D = closedBall (0 : ℂ) 1 := by + rw [← c.g_closedBall, c.h_g Subset.rfl] + rw [image_comp, image_comp, haD, hGball, c'.g_closedBall] + · intro x hx + have hax : a x ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem a hx + have hpx : p (a x) = a' (f x) := by + have h := hp ⟨a x, hax⟩ + change p (a x) = a' (f (b (a x))) at h + rwa [c.gh (Surface.discBd_subset D hx)] at h + change b' (G (a x)) = f x + rw [hGbd hax, hpx, c'.gh (Surface.discBd_subset E (hfbd hx))] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72DiscSides.lean b/LeanPool/GraphMinor/GM12/Section72DiscSides.lean new file mode 100644 index 0000000000..c54146b160 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72DiscSides.lean @@ -0,0 +1,173 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72Regions +public import LeanPool.GraphMinor.GM11.GlueDiscs +import LeanPool.GraphMinor.GM11.PerimeterExists + +/-! +# The two sides of the boundary circle inside its region + +In XII (7.2), the boundary of the removed disc lies in an open-disc +region except at one vertex. Collapse the complement of that region. +The circle is still embedded in the resulting sphere. Its two sides +are the two Jordan discs there. This identifies the part of the old +region inside the removed disc with the interior of one of those discs. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 OnePoint + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- The two open sides of a circle partitioning a sphere cannot be split +further by an open set whose frontier lies on that circle. -/ +private theorem eq_discInt_of_two_sides + {X : Type*} [TopologicalSpace X] + {B C O T : Set X} (hB : IsClosedDisc B) (hC : IsClosedDisc C) + (hbB : discBd B = O) (hbC : discBd C = O) + (hu : B ∪ C = univ) + (hTo : IsOpen T) (hclT : closure T ⊆ T ∪ O) (hdis : Disjoint T O) + (hne : T.Nonempty) (hout : ∃ z, z ∉ O ∧ z ∉ T) : + T = discInt B ∨ T = discInt C := by + have cover : ∀ {z}, z ∉ O → z ∈ discInt B ∨ z ∈ discInt C := by + intro z hz + rcases hu ▸ mem_univ z with hzB | hzC + · exact Or.inl ⟨hzB, hbB.symm ▸ hz⟩ + · exact Or.inr ⟨hzC, hbC.symm ▸ hz⟩ + have fill : ∀ {D : Set X}, IsClosedDisc D → discBd D = O → + (discInt D ∩ T).Nonempty → discInt D ⊆ T := by + intro D hD hb hmeet + refine hD.isPreconnected_discInt.subset_of_closure_inter_subset hTo hmeet ?_ + rintro z ⟨hzcl, hzD⟩ + exact (hclT hzcl).resolve_right (hb ▸ hzD.2) + have key : ∀ {D E : Set X}, IsClosedDisc D → IsClosedDisc E → + discBd D = O → discBd E = O → + (∀ {z}, z ∉ O → z ∈ discInt D ∨ z ∈ discInt E) → + (discInt D ∩ T).Nonempty → T = discInt D := by + intro D E hD hE hbD hbE hcover hmeet + have hDT := fill hD hbD hmeet + apply Subset.antisymm _ hDT + intro z hzT + rcases hcover (disjoint_left.mp hdis hzT) with hzD | hzE + · exact hzD + · have hET := fill hE hbE ⟨z, hzE, hzT⟩ + obtain ⟨p, hpO, hpT⟩ := hout + rcases hcover hpO with hpD | hpE + · exact (hpT (hDT hpD)).elim + · exact (hpT (hET hpE)).elim + obtain ⟨z, hzT⟩ := hne + rcases cover (disjoint_left.mp hdis hzT) with hzB | hzC + · exact Or.inl (key hB hC hbB hbC (fun hz => cover hz) ⟨z, hzB, hzT⟩) + · exact Or.inr (key hC hB hbC hbB (fun hz => (cover hz).symm) ⟨z, hzC, hzT⟩) + +/-- In XII (7.2), page 260, the boundary circle meets its old region in +all but the one vertex. On compactifying the region, the part inside the +removed disc is exactly one Jordan-disc interior. -/ +theorem theorem_7_2_disc_side (hS : IsClosedSurface S) + {r Δ : Set S} {v : S} (hr : IsOpenDisc r) (hΔ : IsClosedDisc Δ) + (hv : v ∈ discBd Δ) (hvr : v ∉ r) (hbr : discBd Δ \ {v} ⊆ r) : + ∃ B : Set (OnePoint r), IsClosedDisc B ∧ + discBd B = collapse r '' discBd Δ ∧ + collapse r '' (discInt Δ ∩ r) = discInt B := by + have : CompactSpace S := hS.1 + have : T2Space (OnePoint r) := by + obtain ⟨e⟩ := isSphere_onePoint hr + exact e.symm.t2Space + have hc : Continuous (collapse r) := continuous_collapse hr.1 + have hinj : InjOn (collapse r) r := by + intro x hx y hy hxy + rw [collapse_of_mem hx, collapse_of_mem hy] at hxy + exact congrArg Subtype.val (OnePoint.coe_injective hxy) + have hfinite : ∀ {x : S}, collapse r x ≠ ∞ → x ∈ r := by + intro x hx + by_contra hxr + exact hx (collapse_of_notMem hxr) + have hFb : ∀ {x}, x ∈ discBd Δ → x ∉ r → x = v := by + intro x hxb hxr + by_contra hxv + exact hxr (hbr ⟨hxb, by simpa only [mem_singleton_iff] using hxv⟩) + have hF_inj : InjOn (collapse r) (discBd Δ) := by + intro x hx y hy hxy + by_cases hxr : x ∈ r + · have hyr : y ∈ r := hfinite (by + rw [← hxy, collapse_of_mem hxr] + exact OnePoint.coe_ne_infty _) + exact hinj hxr hyr hxy + · have hyr : y ∉ r := by + intro hyr + rw [collapse_of_notMem hxr, collapse_of_mem hyr] at hxy + exact OnePoint.coe_ne_infty _ hxy.symm + exact (hFb hx hxr).trans (hFb hy hyr).symm + let O := collapse r '' discBd Δ + have hO : IsOArc O := isOArc_image hΔ.isOArc_discBd hc.continuousOn hF_inj + have hInf : (∞ : OnePoint r) ∈ O := + ⟨v, hv, collapse_of_notMem hvr⟩ + have hO_in : ∀ {x : S}, x ∈ r → collapse r x ∈ O → x ∈ discBd Δ := by + rintro x hxr ⟨y, hy, hyx⟩ + have hyr : y ∈ r := hfinite (by rw [hyx, collapse_of_mem hxr]; exact OnePoint.coe_ne_infty _) + exact hinj hyr hxr hyx ▸ hy + let T := collapse r '' (discInt Δ ∩ r) + have hTo : IsOpen T := by + have hop : IsOpen (discInt Δ ∩ r) := + (hΔ.isOpen_discInt (fun x => (hS.2.2 x).isManifoldPoint)).inter hr.1 + have heq : T = ((↑) : r → OnePoint r) '' (Subtype.val ⁻¹' (discInt Δ ∩ r)) := by + ext z + constructor + · rintro ⟨x, hx, rfl⟩ + exact ⟨⟨x, hx.2⟩, hx, (collapse_of_mem hx.2).symm⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨x.1, hx, collapse_of_mem x.2⟩ + rw [heq] + exact OnePoint.isOpenEmbedding_coe.isOpenMap _ (hop.preimage continuous_subtype_val) + have hdis : Disjoint T O := by + refine disjoint_left.mpr ?_ + rintro z ⟨x, hx, rfl⟩ hzO + exact hx.1.2 (hO_in hx.2 hzO) + have hclT : closure T ⊆ T ∪ O := by + have hcompact : IsClosed (collapse r '' Δ) := (hΔ.isCompact.image hc).isClosed + have hsub : T ⊆ collapse r '' Δ := image_mono (fun _ hx => hx.1.1) + refine (closure_minimal hsub hcompact).trans ?_ + rintro _ ⟨x, hx, rfl⟩ + by_cases hxr : x ∈ r + · by_cases hxb : x ∈ discBd Δ + · exact Or.inr ⟨x, hxb, rfl⟩ + · exact Or.inl ⟨x, ⟨⟨hx, hxb⟩, hxr⟩, rfl⟩ + · rw [collapse_of_notMem hxr] + exact Or.inr hInf + obtain ⟨w, hwb, hwv⟩ := (infinite_of_isOArc hΔ.isOArc_discBd).exists_notMem_finite + (finite_singleton v) + have hwr : w ∈ r := hbr ⟨hwb, hwv⟩ + obtain ⟨y, hyr, hyD⟩ := mem_closure_iff.mp (hΔ.subset_closure_discInt + (Surface.discBd_subset Δ hwb)) + r hr.1 hwr + have hne : T.Nonempty := ⟨collapse r y, y, ⟨hyD, hyr⟩, rfl⟩ + have hwout : w ∈ closure (univ \ Δ) := by + have hwfr : w ∈ frontier Δ := (IsClosedDisc.frontier_eq_discBd hS hΔ).symm ▸ hwb + rw [frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] at hwfr + exact hwfr.2 + obtain ⟨p, hpr, hpD⟩ := mem_closure_iff.mp hwout r hr.1 hwr + have hout : ∃ z : OnePoint r, z ∉ O ∧ z ∉ T := by + refine ⟨collapse r p, ?_, ?_⟩ + · exact fun hpO => hpD.2 (Surface.discBd_subset Δ (hO_in hpr hpO)) + · rintro ⟨x, hx, hxp⟩ + exact hpD.2 (hinj hx.2 hpr hxp ▸ hx.1.1) + obtain ⟨B, C, _, hB, hC, hbB, hbC, hu, _, _, _⟩ := + sphere_disc (OnePoint r) (isSphere_onePoint hr) O hO + rcases eq_discInt_of_two_sides hB hC hbB hbC hu hTo hclT hdis hne hout with h | h + · exact ⟨B, hB, hbB, h⟩ + · exact ⟨C, hC, hbC, h⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72Divert.lean b/LeanPool/GraphMinor/GM12/Section72Divert.lean new file mode 100644 index 0000000000..ae622507b3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72Divert.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72LocalDiversion + +/-! +# Diverting a normal circle off a disc through one vertex + +This proves the geometric diversion in XII (7.2), page 260. If the +circle misses the vertex, push it off the disc directly. Otherwise, +the local corner-cap argument first separates it from the boundary +circle near the vertex. One short boundary half-line then meets the +circle only at the vertex. A final disc push removes all other +intersections with the disc, fixing the outside drawing throughout. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- The diversion in XII (7.2), page 260. For a non-isolated boundary +vertex, a normal circle can be moved off the disc except at that vertex, +by a homeomorphism fixing the drawing pointwise. -/ +theorem theorem_7_2_divert (hS : IsClosedSurface S) + {Γ : Drawing S} {Δ C : Set S} {v : S} + (hΔ : IsClosedDisc Δ) (hvb : v ∈ discBd Δ) (hv : v ∈ Γ.V) + (hGD : Γ.U ∩ Δ ⊆ {v}) (hC : IsOArc C) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal C) + (hincident : ∃ e ∈ Γ.E, v ∈ closure e) : + ∃ h : S ≃ₜ S, (∀ x ∈ Γ.U, h x = x) ∧ (h '' C) ∩ Δ ⊆ {v} := by + have hCc : IsClosed C := by + obtain ⟨e⟩ := hC + have : CompactSpace C := e.compactSpace + exact (isCompact_iff_compactSpace.mpr this).isClosed + by_cases hvC : v ∈ C + swap + · obtain ⟨h, hfix, hdis⟩ := theorem_7_2_push_away_of_notMem hS hΔ hvb Γ.isClosed_U hGD hC hvC + exact ⟨h, hfix, fun x hx => (disjoint_left.mp hdis hx.1 hx.2).elim⟩ + have hFb : IsClosed (discBd Δ) := by + rw [← IsClosedDisc.frontier_eq_discBd hS hΔ] + exact isClosed_frontier + have hFG : discBd Δ ∩ Γ.U ⊆ {v} := + fun x hx => hGD ⟨hx.2, Surface.discBd_subset Δ hx.1⟩ + obtain ⟨h, N, hNo, hvN, hfix, hlocal⟩ := + exists_local_circle_diversion hS hC hn hv hvC hincident hFb hFG + let C' := h.symm '' C + let N' := h ⁻¹' N + have hN'o : IsOpen N' := hNo.preimage h.continuous + have hvN' : v ∈ N' := by + change h v ∈ N + rwa [hfix v (Γ.V_subset_U hv)] + have hlocal' : (discBd Δ ∩ C') ∩ N' ⊆ {v} := by + rintro x ⟨⟨hxb, hxC⟩, hxN⟩ + have hxC' : h x ∈ C := by + change x ∈ h.symm '' C at hxC + rwa [h.image_symm] at hxC + have hxv : h x = v := mem_singleton_iff.mp + (hlocal ⟨⟨mem_image_of_mem h hxb, hxC'⟩, hxN⟩) + exact mem_singleton_iff.mpr (h.injective (hxv.trans (hfix v (Γ.V_subset_U hv)).symm)) + obtain ⟨L, a, b, hL, hLb, hvL, hLN, ha, hb, _⟩ := + exists_small_boundary_line hΔ.isOArc_discBd hvb hN'o.isClosed_compl (not_not.mpr hvN') + have hLN' : L ⊆ N' := fun x hx => by + by_contra hxn + exact disjoint_left.mp hLN hx hxn + obtain ⟨A, B, hA', _, hAB, _⟩ := hL.split hvL ha.symm hb.symm + have hA : IsLineWithEnds A v a := Surface.IsLineWithEnds.symm hA' + have hAL : A ⊆ L := subset_union_left.trans hAB.subset + have hAb : A ⊆ discBd Δ := hAL.trans hLb + have hvA : v ∈ A := by obtain ⟨e, h0, _⟩ := hA; exact h0 ▸ (e 0).2 + have haA : a ∈ A := by obtain ⟨e, _, h1⟩ := hA; exact h1 ▸ (e 1).2 + have hGA : (Γ.U ∪ {a}) ∩ Δ ⊆ A := by + rintro x ⟨hxG | hxa, hxΔ⟩ + · exact (mem_singleton_iff.mp (hGD ⟨hxG, hxΔ⟩)).symm ▸ hvA + · exact (mem_singleton_iff.mp hxa).symm ▸ haA + have hC'A : C' ∩ A ⊆ {v} := by + rintro x ⟨hxC, hxA⟩ + exact hlocal' ⟨⟨hAb hxA, hxC⟩, hLN' (hAL hxA)⟩ + have hC'c : IsClosed C' := h.symm.isClosedMap _ hCc + obtain ⟨k, kfix, kpush⟩ := push_cap_fixing hS hΔ hA ha hAb + (Γ.isClosed_U.union isClosed_singleton) (Or.inl (Γ.V_subset_U hv)) + (Or.inr rfl) hGA hC'c hC'A + let f := h.symm.trans k + refine ⟨f, ?_, ?_⟩ + · intro x hx + have hh : h.symm x = x := by + rw [h.symm_apply_eq] + exact (hfix x hx).symm + change k (h.symm x) = x + rw [hh] + exact kfix x (Or.inl hx) + · rintro x ⟨⟨y, hy, hyx⟩, hxΔ⟩ + exact kpush ⟨⟨h.symm y, ⟨y, hy, rfl⟩, hyx⟩, hxΔ⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72InitialLine.lean b/LeanPool/GraphMinor/GM12/Section72InitialLine.lean new file mode 100644 index 0000000000..311e32c105 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72InitialLine.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscGrow +import Mathlib.Topology.Order.IntermediateValue + +/-! +# Initial sublines contain the line near its end + +The small corner caps in XII (7.2) contain initial sublines of the two +circle branches. Any nontrivial subline with the same end contains its +ambient line near that end. In interval coordinates this is the +intermediate value theorem, and the rest of the interval is compact. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- An initial subline contains its ambient line in a neighbourhood of the +common end, as needed for the vertex diversion in XII (7.2), page 260. -/ +theorem exists_nhds_line_subset_initial {L A : Set S} {v a b : S} + (hL : IsLineWithEnds L v a) (hA : IsLineWithEnds A v b) + (hb : b ≠ v) (hAL : A ⊆ L) : + ∃ O : Set S, IsOpen O ∧ v ∈ O ∧ L ∩ O ⊆ A := by + obtain ⟨e, he0, _⟩ := hL + obtain ⟨f, hf0, hf1⟩ := hA + let q : unitInterval → unitInterval := fun t => e.symm ⟨(f t).1, hAL (f t).2⟩ + have hqc : Continuous q := e.symm.continuous.comp + ((continuous_subtype_val.comp f.continuous).subtype_mk _) + have hq0 : q 0 = 0 := by + apply e.injective + apply Subtype.ext + change (e (e.symm ⟨(f 0).1, hAL (f 0).2⟩)).1 = (e 0).1 + rw [e.apply_symm_apply, hf0, he0] + have hqpos : 0 < q 1 := by + apply unitInterval.pos_iff_ne_zero.mpr + intro h + have heq := congrArg (fun t => (e t).1) h + change (e (e.symm ⟨(f 1).1, hAL (f 1).2⟩)).1 = (e 0).1 at heq + rw [e.apply_symm_apply, hf1, he0] at heq + exact hb heq + have hprefix : ∀ t : unitInterval, t ≤ q 1 → (e t).1 ∈ A := by + intro t ht + obtain ⟨s, _, hqs⟩ := intermediate_value_Icc (show (0 : unitInterval) ≤ 1 from bot_le) + hqc.continuousOn (show t ∈ Icc (q 0) (q 1) from ⟨hq0.symm ▸ bot_le, ht⟩) + have heq : (f s).1 = (e t).1 := by + have h := congrArg (fun t => (e t).1) hqs + change (e (e.symm ⟨(f s).1, hAL (f s).2⟩)).1 = (e t).1 at h + simpa only [e.apply_symm_apply] using h + exact heq ▸ (f s).2 + let K := (fun t : unitInterval => (e t).1) '' Icc (q 1) 1 + have hK : IsClosed K := (isCompact_Icc.image (continuous_subtype_val.comp e.continuous)).isClosed + have hvK : v ∉ K := by + rintro ⟨t, ht, htv⟩ + have ht0 : t = 0 := e.injective (Subtype.ext (htv.trans he0.symm)) + exact hqpos.not_ge (ht0 ▸ ht.1) + refine ⟨Kᶜ, hK.isOpen_compl, hvK, ?_⟩ + rintro x ⟨hxL, hxK⟩ + let t := e.symm ⟨x, hxL⟩ + have heq : (e t).1 = x := congrArg Subtype.val (e.apply_symm_apply ⟨x, hxL⟩) + have ht : t ≤ q 1 := by + by_contra hn + exact hxK ⟨t, ⟨(not_le.mp hn).le, le_top⟩, heq⟩ + exact heq ▸ hprefix t ht + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72LocalDiversion.lean b/LeanPool/GraphMinor/GM12/Section72LocalDiversion.lean new file mode 100644 index 0000000000..12a45c2e1b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72LocalDiversion.lean @@ -0,0 +1,178 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72MixedCaps +public import LeanPool.GraphMinor.GM12.Section72MixedCorners +public import LeanPool.GraphMinor.GM12.Section72InitialLine +public import LeanPool.GraphMinor.GM12.Section72PushCaps + +/-! +# The local diversion at the boundary vertex in XII (7.2) + +Add the two local circle branches to the old drawing. Each branch +has an adjacent old half-edge in the cyclic order. The two mixed +corner caps cover the branches near the vertex and meet each other +only on the old drawing. Push the boundary circle off these caps, +fixing the old drawing. This separates the two circles near the vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +private theorem restrict_sectors {H : Drawing S} {γ : Set S → I → S} {v : S} + {next : halfEdges H γ v → halfEdges H γ v} + {ρ P Q : halfEdges H γ v → Set S} {W O : Set S} + {τ : halfEdges H γ v → I} (h : IsSectors H γ v next ρ P W Q τ) + (hO : IsOpen O) (hvO : v ∈ O) : IsSectors H γ v next ρ P (W ∩ O) Q τ := by + refine { h with + isOpen := h.isOpen.inter hO + mem := ⟨h.mem, hvO⟩ + cover := fun x hx => h.cover ⟨hx.1.1, hx.2⟩ + inside := fun k x hx => h.inside k ⟨⟨hx.1.1.1, hx.1.2⟩, hx.2⟩ + off := fun k i h₁ h₂ t ht hx => h.off k i h₁ h₂ t ht hx.1 + bdU := fun k x hx => h.bdU k ⟨hx.1.1, hx.2⟩ } + +/-- The local part of the diversion in XII (7.2), page 260. At a +non-isolated vertex, a normal circle has two local branches. A +homeomorphism fixing the drawing moves another closed set meeting +the drawing only at that vertex away from these branches near the vertex. -/ +theorem exists_local_circle_diversion (hS : IsClosedSurface S) + {Γ : Drawing S} {C F : Set S} {v : S} + (hC : IsOArc C) (hn : (PaintingOrDrawing.drawing Γ).IsNormal C) + (hv : v ∈ Γ.V) (hvC : v ∈ C) + (hincident : ∃ e ∈ Γ.E, v ∈ closure e) + (hF : IsClosed F) (hFG : F ∩ Γ.U ⊆ {v}) : + ∃ (h : S ≃ₜ S) (O : Set S), IsOpen O ∧ v ∈ O ∧ + (∀ x ∈ Γ.U, h x = x) ∧ ((h '' F) ∩ C) ∩ O ⊆ {v} := by + have : Nonempty S := ⟨v⟩ + obtain ⟨H, L₀, L₁, O₀, a, b, hO₀, hvO₀, hCO₀, hLC, hmeet, hL₀, hL₁, ha, hb, hcap, hU, hV, hE⟩ := + exists_normal_circle_patch hC hn hvC hv + have hsub : Γ.IsSubdrawing H := + ⟨fun x hx => hV.symm ▸ Or.inl hx, fun e he => hE.symm ▸ Or.inl he⟩ + have hnew : ∀ e ∈ H.E, e ∉ Γ.E → e ⊆ C := by + intro e he hen + have he' : e ∈ Γ.E ∪ {L₀ \ {v, a}, L₁ \ {v, b}} := hE ▸ he + rcases he' with heΓ | he₀ | he₁ + · exact (hen heΓ).elim + · exact he₀.symm ▸ sdiff_subset.trans (subset_union_left.trans hLC) + · exact he₁.symm ▸ sdiff_subset.trans (subset_union_right.trans hLC) + obtain ⟨γ, hγ⟩ := exists_edgePar H + obtain ⟨j₀, j₁, hne, hj₀, hj₁, hn₀, hn₁, hall⟩ := + circle_patch_halfEdges hL₀ hL₁ ha hb hv hmeet hcap hV hE hγ + have : Finite (halfEdges H γ v) := (finite_halfEdges H γ v).to_subtype + have : Nontrivial (halfEdges H γ v) := ⟨⟨j₀, j₁, hne⟩⟩ + have htwo : 2 ≤ Nat.card (halfEdges H γ v) := Finite.one_lt_card_iff_nontrivial.mpr inferInstance + have hvH := hsub.1 hv + obtain ⟨next, ρ, P, W, Q, τ, hsec⟩ := exists_sectors hS H hγ hvH htwo + have hsec' := restrict_sectors hsec hO₀ hvO₀ + let old : Set (halfEdges H γ v) := {k | k.1.1 ∈ Γ.E} + have hold : old.Nonempty := by + obtain ⟨e, he, hve⟩ := hincident + obtain ⟨d, hd⟩ := exists_end_eq hγ (hsub.2 he) hvH hve + exact ⟨⟨(e, d), hsub.2 he, hd⟩, he⟩ + obtain ⟨k₀, k₁, hkk, hk₀, hk₁⟩ := exists_two_mixed_corners next hsec.corners.inj + hsec.corners.reach + hsec.next_ne hold hne hn₀ hn₁ hall + have choose_old : ∀ (j k : halfEdges H γ v), + ((k = j ∧ next k ∈ old) ∨ (k ∈ old ∧ next k = j)) → + ∃ g : halfEdges H γ v, g.1.1 ∈ Γ.E ∧ + ((g = k ∧ j = next k) ∨ (j = k ∧ g = next k)) := by + intro j k hk + rcases hk with ⟨hkj, hko⟩ | ⟨hko, hkj⟩ + · exact ⟨next k, hko, Or.inr ⟨hkj.symm, rfl⟩⟩ + · exact ⟨k, hko, Or.inl ⟨rfl, hkj.symm⟩⟩ + obtain ⟨g₀, hg₀, hc₀⟩ := choose_old j₀ k₀ hk₀ + obtain ⟨g₁, hg₁, hc₁⟩ := choose_old j₁ k₁ hk₁ + have hlocal : C ∩ (W ∩ O₀) ⊆ H.U := by + intro x hx + have hxL := hCO₀ ⟨hx.1, hx.2.2⟩ + rw [hU] + exact Or.inr hxL + obtain ⟨tG₀, tC₀, D₀, htG₀, htG₀1, htC₀, htC₀1, hD₀, hDW₀, hDQ₀, hDb₀, hDH₀, hDG₀, _⟩ := + exists_mixed_corner_cap hS hsub hn hnew hγ hv hvC hsec' hlocal k₀ g₀ j₀ hg₀ hn₀ hc₀ + obtain ⟨tG₁, tC₁, D₁, htG₁, htG₁1, htC₁, htC₁1, hD₁, hDW₁, hDQ₁, hDb₁, hDH₁, hDG₁, _⟩ := + exists_mixed_corner_cap hS hsub hn hnew hγ hv hvC hsec' hlocal k₁ g₁ j₁ hg₁ hn₁ hc₁ + have hzero : ∀ i : halfEdges H γ v, spoke γ i.1 0 = v := + fun i => (spoke_zero γ i.1).trans i.2.2 + have old_spoke : ∀ i : halfEdges H γ v, i.1.1 ∈ Γ.E → ∀ t : I, spoke γ i.1 t ∈ Γ.U := by + intro i hi t + by_cases ht : t = 0 + · rw [ht, hzero] + exact Γ.V_subset_U hv + · exact (hi.2.1 (spoke_mem_edge hγ i.2.1 (unitInterval.pos_iff_ne_zero.mpr ht))).1 + have hDD : D₀ ∩ D₁ ⊆ Γ.U := by + rintro x ⟨hx₀, hx₁⟩ + have hxH := hsec.inter k₀ k₁ hkk ⟨hDQ₀ hx₀, hDQ₁ hx₁⟩ + rcases hDH₀ ⟨hx₀, hxH⟩ with ⟨s, _, hsx⟩ | ⟨s, hs, hsx⟩ + · exact hsx ▸ old_spoke g₀ hg₀ s + · rcases hDH₁ ⟨hx₁, hxH⟩ with ⟨t, _, htx⟩ | ⟨t, ht, htx⟩ + · exact htx ▸ old_spoke g₁ hg₁ t + · by_cases hs0 : s = 0 + · exact hsx ▸ (hs0 ▸ (hzero j₀).symm ▸ Γ.V_subset_U hv) + · by_cases ht0 : t = 0 + · exact htx ▸ (ht0 ▸ (hzero j₁).symm ▸ Γ.V_subset_U hv) + · have hpairne : j₀.1 ≠ j₁.1 := fun h => hne (Subtype.ext h) + have hs1 := (spoke_eq_of_ne hγ j₀.2.1 j₁.2.1 hpairne + (unitInterval.pos_iff_ne_zero.mpr hs0) (unitInterval.pos_iff_ne_zero.mpr ht0) + (hsx.trans htx.symm)).1 + exact ((hs.2.trans_lt htC₀1).ne hs1).elim + have hline : ∀ (i : halfEdges H γ v) (t : I), 0 < t → + IsLineWithEnds (spoke γ i.1 '' Icc 0 t) v (spoke γ i.1 t) := by + intro i t ht + have h := isLine_spoke_piece hγ i.2.1 ht + rwa [hzero] at h + have hend : ∀ (i : halfEdges H γ v) (t : I), 0 < t → spoke γ i.1 t ≠ v := by + intro i t ht he + exact ht.ne' (spoke_injective hγ i.2.1 (he.trans (hzero i).symm)) + have hvL₀ : v ∈ L₀ := by obtain ⟨e, h0, _⟩ := hL₀; exact h0 ▸ (e 0).2 + have hvL₁ : v ∈ L₁ := by obtain ⟨e, h0, _⟩ := hL₁; exact h0 ▸ (e 0).2 + have hCL₀ : spoke γ j₀.1 '' Icc 0 tC₀ ⊆ L₀ := by + rintro x ⟨t, _, rfl⟩ + by_cases ht : t = 0 + · rwa [ht, hzero] + · have h := spoke_mem_edge hγ j₀.2.1 (unitInterval.pos_iff_ne_zero.mpr ht) + rw [hj₀] at h + exact h.1 + have hCL₁ : spoke γ j₁.1 '' Icc 0 tC₁ ⊆ L₁ := by + rintro x ⟨t, _, rfl⟩ + by_cases ht : t = 0 + · rwa [ht, hzero] + · have h := spoke_mem_edge hγ j₁.2.1 (unitInterval.pos_iff_ne_zero.mpr ht) + rw [hj₁] at h + exact h.1 + obtain ⟨O₁, hO₁, hvO₁, hL₀O⟩ := exists_nhds_line_subset_initial hL₀ (hline j₀ tC₀ htC₀) + (hend j₀ tC₀ htC₀) hCL₀ + obtain ⟨O₂, hO₂, hvO₂, hL₁O⟩ := exists_nhds_line_subset_initial hL₁ (hline j₁ tC₁ htC₁) + (hend j₁ tC₁ htC₁) hCL₁ + let O := (O₀ ∩ O₁) ∩ O₂ + have hcover : C ∩ O ⊆ D₀ ∪ D₁ := by + rintro x ⟨hxC, hxO⟩ + rcases hCO₀ ⟨hxC, hxO.1.1⟩ with hxL₀ | hxL₁ + · exact Or.inl (Surface.discBd_subset D₀ (hDb₀ (Or.inr (hL₀O ⟨hxL₀, hxO.1.2⟩)))) + · exact Or.inr (Surface.discBd_subset D₁ (hDb₁ (Or.inr (hL₁O ⟨hxL₁, hxO.2⟩)))) + obtain ⟨h, hfix, hdivert⟩ := push_two_caps_fixing hS hD₀ hD₁ (hline g₀ tG₀ htG₀) + (hline g₁ tG₁ htG₁) + (hend g₀ tG₀ htG₀) (hend g₁ tG₁ htG₁) + (fun x hx => hDb₀ (Or.inl hx)) (fun x hx => hDb₁ (Or.inl hx)) + Γ.isClosed_U (Γ.V_subset_U hv) + (by rintro x ⟨t, _, rfl⟩; exact old_spoke g₀ hg₀ t) + (by rintro x ⟨t, _, rfl⟩; exact old_spoke g₁ hg₁ t) + (fun x hx => hDG₀ ⟨hx.2, hx.1⟩) (fun x hx => hDG₁ ⟨hx.2, hx.1⟩) hDD hF hFG hcover + exact ⟨h, O, (hO₀.inter hO₁).inter hO₂, ⟨⟨hvO₀, hvO₁⟩, hvO₂⟩, hfix, hdivert⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72LostAtoms.lean b/LeanPool/GraphMinor/GM12/Section72LostAtoms.lean new file mode 100644 index 0000000000..5f1e748551 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72LostAtoms.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72TwoCell +public import LeanPool.GraphMinor.GM12.Section76 +import LeanPool.GraphMinor.GM12.Section79 + +/-! +# Lost atoms are at distance at most one in XII (7.2) + +Every old atom lost by the outside restriction lies in the merged +region. It meets the selected inside disc: either it is the old region, +or it lies in the punctured disc. The trace of the boundary circle +therefore bounds its distance from the one boundary vertex by one. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- The lost-atom bound in XII (7.2), pages 259–260. The selected disc and +its boundary vertex meet every lost atom, so the normal-circle bound +from (2.1) gives distance at most one. -/ +theorem theorem_7_2_lost_atoms (hS : IsClosedSurface S) [ConnectedSpace S] + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hθ : 2 ≤ θ) (hd : HasTangleMetric Γ θ T d) + {Δ F r : Set S} {v : S} (hΔ : IsClosedDisc Δ) (hbd : subBd Δ = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) + (hFV : F ∩ Γ.V = {v}) (hr : r ∈ Γ.R) (hFr : F \ {v} ⊆ r) + (hm : ((PaintingOrDrawing.drawing Γ).inter Δ, + (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T) + {a : Set S} (ha : a ∈ Γ.A) + (han : a ∉ (Γ.interSet (closure (univ \ Δ))).A) : d a {v} ≤ 1 := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let Γ' := Γ.interSet (closure (univ \ Δ)) + let Y := r ∪ (Δ \ {v}) + have hsub : Γ'.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hY : Y ∈ Γ'.R := theorem_7_2_region hS hΔ hbd hn hFV hr hFr + have hfr : frontier Δ = F := (subBd_eq_frontier Δ).symm.trans hbd + have hdb : discBd Δ = F := (IsClosedDisc.frontier_eq_discBd hS hΔ).symm.trans hfr + have hvFV : v ∈ F ∩ Γ.V := hFV.symm ▸ mem_singleton v + have hvD : v ∈ Δ := Surface.discBd_subset Δ (hdb.symm ▸ hvFV.1) + have hcover : Γ.U ⊆ Γ'.U ∪ Y := + (drawing_U_subset_outside_normal_disc_union hfr hn hvFV.1).trans + (union_subset_union subset_rfl subset_union_right) + obtain ⟨a', ha', haa'⟩ := exists_atom_superset_of_isSubdrawing hsub ha + have haY : a ⊆ Y := by + rcases atom_eq_or_eq_region_of_U_subset hsub hY hcover ha ha' haa' with + ⟨_, hmem⟩ | ⟨_, haY⟩ + · exact (han hmem.2).elim + · exact haY + have haD : (a ∩ Δ).Nonempty := by + obtain ⟨x, hxa⟩ := atom_nonempty' ha + rcases haY hxa with hxr | hxD + · have heq : a = r := atom_eq_of_inter_nonempty ha (Or.inr hr) ⟨x, hxa, hxr⟩ + obtain ⟨w, hw, hwv⟩ := (infinite_of_isOArc hΔ.isOArc_discBd).exists_notMem_finite + (finite_singleton v) + exact ⟨w, heq.symm ▸ hFr ⟨hdb ▸ hw, hwv⟩, Surface.discBd_subset Δ hw⟩ + · exact ⟨x, hxa, hxD.1⟩ + have hcard : (F ∩ Γ.V).ncard < θ := by rw [hFV, ncard_singleton]; omega + have hbound := dist_le_of_oarc_disc hS hd (hdb ▸ hΔ.isOArc_discBd) hn hcard hΔ hbd hm ha + (Or.inl (Or.inl ⟨v, hvFV.2, rfl⟩)) haD ⟨v, rfl, hvD⟩ + simpa only [hFV, ncard_singleton] using hbound + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72MaximalCriterion.lean b/LeanPool/GraphMinor/GM12/Section72MaximalCriterion.lean new file mode 100644 index 0000000000..f520a5ce13 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72MaximalCriterion.lean @@ -0,0 +1,94 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialRegions +import LeanPool.GraphMinor.GM12.Section72RadialDeletion +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# Verifying maximality by testing possible extra spokes + +For the maximality check in XII (7.2), page 260, it suffices to +compare each possible extra spoke with an existing parallel spoke. +An extension has the same vertices, since every region already has +its unique hub. Any new edge would then bound a forbidden empty +bigon with its old parallel spoke. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- An extension satisfying the radial conditions cannot add a +vertex: every old vertex and every region hub is already present. -/ +theorem preRadial_vertices_eq_of_extension {Γ K J : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + (hJ : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing J) + (hKJ : K.IsSubdrawing J) : J.V = K.V := by + apply Subset.antisymm + · intro w hw + by_cases hwΓ : w ∈ Γ.V + · exact hK.2.1 hwΓ + · obtain ⟨r, hr, hwr⟩ := hJ.2.2.2.1 w ⟨hw, hwΓ⟩ + obtain ⟨u, hu, _⟩ := hK.2.2.1 r hr + have hwu : w = u := (hJ.2.2.1 r hr).unique ⟨hwr, hw⟩ ⟨hu.1, hKJ.1 hu.2⟩ + exact hwu ▸ hu.2 + · exact hKJ.1 + +omit [T2Space S] in +/-- A pre-radial drawing is maximal if every possible extra spoke +bounds an empty disc with an old parallel spoke. This is the +criterion used to verify maximality in XII (7.2), page 260. -/ +theorem radMax_of_parallel_spokes (hS : IsClosedSurface S) + {Γ K : Drawing S} (htwo : (PaintingOrDrawing.drawing Γ).IsTwoCell) + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + (hparallel : ∀ (r : Set S), r ∈ Γ.R → ∀ u ∈ r ∩ K.V, ∀ x ∈ Γ.V, + ∀ L : Set S, IsLineWithEnds L u x → u ≠ x → L \ {u, x} ⊆ r → + Disjoint (L \ {u, x}) K.U → + ∃ e ∈ K.E, closure e ∩ K.V = {x, u} ∧ + ∃ D : Set S, IsClosedDisc D ∧ D ⊆ r ∪ {x} ∧ subBd D = closure e ∪ L) : + RadMax (.drawing Γ) K := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + intro J hJ hKJ + have hV := preRadial_vertices_eq_of_extension hK hJ hKJ + refine ⟨hV.subset, ?_⟩ + intro g hg + by_contra hgK + obtain ⟨x, hx, r, hr, u, hur, huJ, hcap, hgr⟩ := spoke_ends ⟨htwo, hJ⟩ hS hg + have huK : u ∈ K.V := hV.subset huJ + have hux : u ≠ x := fun hux => region_subset hr (hux ▸ hur) (Γ.V_subset_U hx) + have hline : IsLineWithEnds (closure g) u x := + Surface.IsLineWithEnds.symm (isLine_closure hg hux.symm hcap) + have hpuncture : closure g \ {u, x} = g := by + ext y + constructor + · rintro ⟨hyg, hyn⟩ + apply (J.closure_diff_V hg).subset + exact ⟨hyg, fun hyJ => hyn (by rw [pair_comm]; exact hcap.subset ⟨hyg, hyJ⟩)⟩ + · intro hyg + exact ⟨subset_closure hyg, fun hy => (hg.2.1 hyg).2 + ((hcap.superset (by rw [pair_comm]; exact hy)).2)⟩ + have hdis : Disjoint g K.U := by + apply disjoint_left.mpr + intro y hyg hyK + exact hgK (edge_mem_of_meets_subdrawing hKJ hg ⟨y, hyg, hyK⟩) + obtain ⟨e, he, hcape, D, hD, hDr, hbd⟩ := hparallel r hr u ⟨hur, huK⟩ x hx + (closure g) hline hux (by rw [hpuncture]; exact hgr) (by rw [hpuncture]; exact hdis) + have heg : e ≠ g := fun heg => hgK (heg ▸ he) + have hcapeJ : closure e ∩ J.V = {x, u} := (hKJ.closure_inter_V he).symm.trans hcape + exact hJ.2.2.2.2.2 e (hKJ.2 he) g hg heg x hx r hr u ⟨hur, huJ⟩ + hcapeJ hcap ⟨D, hD, hDr, hbd⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72MergedParallel.lean b/LeanPool/GraphMinor/GM12/Section72MergedParallel.lean new file mode 100644 index 0000000000..326696cca7 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72MergedParallel.lean @@ -0,0 +1,156 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72ParallelReplacement +public import LeanPool.GraphMinor.GM12.Section72RetainedBoundary +public import LeanPool.GraphMinor.GM12.Section72PushSpoke +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Every extra spoke in the merged region has a retained parallel spoke + +For maximality in XII (7.2), page 260, divert an extra spoke off the +removed disc while fixing both retained drawings. Old maximality +provides a parallel old spoke. If its old end is not the boundary +vertex, it survives. At the boundary vertex, the parallel-spoke +replacement lemma handles the deleted spoke. Pull the resulting disc +back by the diversion to compare with the original extra spoke. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The extra-spoke comparison in the merged region, completing its +part of the maximality verification in XII (7.2), page 260. -/ +theorem exists_parallel_spoke_in_merged_region + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K C : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hC : C.IsSubdrawing K) + {D r e f : Set S} {v u : S} (hD : IsClosedDisc D) (hb : frontier D = C.U) + (hCE : C.E = {e, f}) (hCV : C.V = {v, u}) (hef : e ≠ f) + (hCU : C.U = closure e ∪ closure f) (hCZ : C.U ⊆ r ∪ {v}) + (he : K.toGraph.IsLink e v u) (hf : K.toGraph.IsLink f v u) + (hmeet : Γ.U ∩ C.U = {v}) (hr : r ∈ Γ.R) (hv : v ∈ Γ.V) + (hur : u ∈ r) (huK : u ∈ K.V) + {x : S} (hx : x ∈ (Γ.interSet (closure (univ \ D))).V) + {L : Set S} (hL : IsLineWithEnds L u x) + (hLY : L \ {u, x} ⊆ r ∪ (D \ {v})) + (hLK : Disjoint (L \ {u, x}) (radialDiscDeletion K D f).U) : + ∃ g ∈ (radialDiscDeletion K D f).E, + closure g ∩ (radialDiscDeletion K D f).V = {x, u} ∧ + ∃ P : Set S, IsClosedDisc P ∧ P ⊆ (r ∪ (D \ {v})) ∪ {x} ∧ + subBd P = closure g ∪ L := by + let Γ' := Γ.interSet (closure (univ \ D)) + let K' := radialDiscDeletion K D f + let Y := r ∪ (D \ {v}) + let G := Γ'.U ∪ K'.U + have hΓ : Γ'.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hKK : K'.IsSubdrawing K := radialDiscDeletion_isSubdrawing K D f + have heC : e ∈ C.E := hCE.symm ▸ Or.inl rfl + have hfC : f ∈ C.E := hCE.symm ▸ Or.inr rfl + have heNew : e ∈ K'.E := boundary_spoke_retained hC hb heC hef + have hEline : IsLineWithEnds (closure e) v u := + isLine_closure he.1 (fun hvu => region_subset hr (hvu ▸ hur) (Γ.V_subset_U hv)) he.2.2.2 + have hbdD : discBd D = C.U := (IsClosedDisc.frontier_eq_discBd hS hD).symm.trans hb + have hEbd : closure e ⊆ discBd D := hbdD.symm ▸ C.closure_subset_U heC + have hEU : closure e ⊆ K'.U := K'.closure_subset_U heNew + have hvG : v ∈ G := Or.inr (hEU ((he.2.2.2.superset (Or.inl rfl)).1)) + have huG : u ∈ G := Or.inr (hEU ((he.2.2.2.superset (Or.inr rfl)).1)) + have hxG : x ∈ G := Or.inl (Γ'.V_subset_U hx) + have hGD : G ∩ D ⊆ closure e := by + rintro y ⟨hyΓ | hyK, hyD⟩ + · have hyv := oldDrawing_outside_inter_disc hb hmeet ⟨hyΓ, hyD⟩ + exact (he.2.2.2.superset (Or.inl (mem_singleton_iff.mp hyv))).1 + · exact (radialDiscDeletion_inter_disc hC hD hb heC hfC hef hCU hf.2.2.2 he.2.2.2).subset ⟨hyK, + hyD⟩ + have hn : (PaintingOrDrawing.drawing Γ).IsNormal C.U := by + rintro y ⟨hyC, hyΓ⟩ + exact mem_singleton_iff.mp (hmeet.subset ⟨hyΓ, hyC⟩) ▸ hv + have hFV : C.U ∩ Γ.V = {v} := by + apply Subset.antisymm + · rintro y ⟨hyC, hyΓ⟩ + exact hmeet.subset ⟨Γ.V_subset_U hyΓ, hyC⟩ + · rintro y hy + have hyv := mem_singleton_iff.mp hy + subst y + exact ⟨C.V_subset_U (hCV.symm ▸ Or.inl rfl), hv⟩ + have hY : Y ∈ Γ'.R := theorem_7_2_region hS hD ((subBd_eq_frontier D).trans hb) + hn hFV hr (fun y hy => (hCZ hy.1).resolve_right hy.2) + have hLG : L ∩ G ⊆ {x, u} := by + rintro y ⟨hyL, hyG⟩ + by_contra hyn + have hyn' : y ∉ ({u, x} : Set S) := by simpa only [pair_comm] using hyn + rcases hyG with hyΓ | hyK + · exact region_subset hY (hLY ⟨hyL, hyn'⟩) hyΓ + · exact disjoint_left.mp hLK ⟨hyL, hyn'⟩ hyK + have hLE : L ∩ closure e ⊆ {v, u} := by + rintro y ⟨hyL, hye⟩ + rcases hLG ⟨hyL, Or.inr (hEU hye)⟩ with hyx | hyu + · have hyv : y = v := hmeet.subset + ⟨hyx.symm ▸ Γ.V_subset_U (hΓ.1 hx), C.closure_subset_U heC hye⟩ + exact Or.inl hyv + · exact Or.inr hyu + obtain ⟨a, hfix, hpush, hdis⟩ := push_extra_spoke_off_disc hS hC hD hb hfC hEline hEbd + (Γ'.isClosed_U.union K'.isClosed_U) hvG huG hGD subset_union_right + hL.isCompact.isClosed hLE hLG + have hfixΓ : ∀ y ∈ Γ'.U, a y = y := fun y hy => hfix y (Or.inl hy) + have hfixK : ∀ y ∈ K'.U, a y = y := fun y hy => hfix y (Or.inr hy) + have hau : a u = u := hfix u huG + have hax : a x = x := hfix x hxG + have haY : a '' Y ⊆ Y := image_region_subset_of_fixed a hfixΓ hY (Or.inl hur) hau + have hline : IsLineWithEnds (a '' L) u x := by + simpa only [hau, hax] using lineWithEnds_image_homeomorph a hL + have hux : u ≠ x := fun hux => region_subset hr (hux ▸ hur) (Γ.V_subset_U (hΓ.1 hx)) + have hlineR : (a '' L) \ {u, x} ⊆ r := by + rintro y ⟨⟨z, hzL, hzy⟩, hyn⟩ + have hzn : z ∉ ({u, x} : Set S) := by + rintro (hzu | hzx) + · exact hyn (Or.inl (hzy.symm.trans ((congrArg a hzu).trans hau))) + · exact hyn (Or.inr (hzy.symm.trans ((congrArg a hzx).trans hax))) + have hyY := haY ⟨z, hLY ⟨hzL, hzn⟩, hzy⟩ + rcases hyY with hyr | ⟨hyD, _⟩ + · exact hyr + · have hyend := hpush ⟨⟨z, hzL, hzy⟩, hyD⟩ + have hyK : y ∈ K.U := by + rcases hyend with hyv | hyu + · exact hyv ▸ K.V_subset_U (hK.2.1.2.1 hv) + · exact hyu ▸ K.V_subset_U huK + exact (disjoint_left.mp hdis ⟨⟨z, hzL, hzy⟩, by simpa only [pair_comm] using hyn⟩ hyK).elim + have hdis' : Disjoint ((a '' L) \ {u, x}) K.U := by simpa only [pair_comm] using hdis + obtain ⟨g, hg, hcapg, Q, hQ, hQr, hQbd⟩ := parallel_of_line ⟨hK.1, hK.2.1⟩ hK.2.2 hS + hr hur huK (hΓ.1 hx) hline hux hlineR hdis' + have finish : ∀ g ∈ K'.E, closure g ∩ K.V = {x, u} → + ∀ Q : Set S, IsClosedDisc Q → Q ⊆ Y ∪ {x} → subBd Q = closure g ∪ a '' L → + ∃ g ∈ K'.E, closure g ∩ K'.V = {x, u} ∧ + ∃ P : Set S, IsClosedDisc P ∧ P ⊆ Y ∪ {x} ∧ subBd P = closure g ∪ L := by + intro g hg hcap Q hQ hQr hQbd + obtain ⟨P, hP, hPr, hPbd⟩ := pullback_spoke_disc hS a hfixΓ hfixK hY + (Or.inl hur) hau hax hg hQ hQr hQbd + exact ⟨g, hg, (hKK.closure_inter_V hg).trans hcap, P, hP, hPr, hPbd⟩ + by_cases hxv : x = v + · subst x + have hbdQ : discBd Q = closure g ∪ a '' L := + (IsClosedDisc.frontier_eq_discBd hS hQ).symm.trans ((subBd_eq_frontier Q).symm.trans hQbd) + rcases parallel_spoke_retained_or_replaced hS hK.2.1 hC hD hbdD hCE hef hCU + he hf hr hv hur huK hg hcapg (Surface.IsLineWithEnds.symm hline) hpush + (by simpa only [pair_comm] using hdis') hQ hQr hbdQ with hgNew | hreplace + · exact finish g hgNew hcapg Q hQ (hQr.trans (union_subset_union_left _ subset_union_left)) hQbd + · obtain ⟨P, hP, hPr, hPbd⟩ := hreplace + exact finish e heNew he.2.2.2 P hP hPr hPbd + · have hxD := retained_vertex_notMem_disc hb hmeet hx hxv + have hxcl : x ∈ closure g := (hcapg.superset (Or.inl rfl)).1 + have hgNew := edge_retained_of_end_outside_disc hS hC hD hb hfC hg hxcl hxD + exact finish g hgNew hcapg Q hQ (hQr.trans (union_subset_union_left _ subset_union_left)) hQbd + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72MixedCaps.lean b/LeanPool/GraphMinor/GM12/Section72MixedCaps.lean new file mode 100644 index 0000000000..74792c83cd --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72MixedCaps.lean @@ -0,0 +1,100 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72CornerCaps +public import LeanPool.GraphMinor.GM12.Section72PatchHalves + +/-! +# The two types of boundary arc in a mixed corner cap + +A mixed corner in the local patch for XII (7.2) has one half-edge of +the old drawing and one of the circle. A small cap in this corner +meets the old drawing only in its old half-edge, and the circle only +in its circle half-edge. Normality gives both assertions. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- A mixed corner cap meets the old drawing and the circle on their +respective spokes, for the diversion at the vertex in XII (7.2), page 260. -/ +theorem exists_mixed_corner_cap (hS : IsClosedSurface S) + {Γ H : Drawing S} (hsub : Γ.IsSubdrawing H) + {C : Set S} (hn : (PaintingOrDrawing.drawing Γ).IsNormal C) + (hnew : ∀ e ∈ H.E, e ∉ Γ.E → e ⊆ C) + {γ : Set S → I → S} (hγ : EdgePar H γ) + {v : S} (hv : v ∈ Γ.V) (hvC : v ∈ C) + {next : halfEdges H γ v → halfEdges H γ v} + {ρ P Q : halfEdges H γ v → Set S} {W : Set S} + {τ : halfEdges H γ v → I} (hsec : IsSectors H γ v next ρ P W Q τ) + (hlocal : C ∩ W ⊆ H.U) + (k g c : halfEdges H γ v) (hg : g.1.1 ∈ Γ.E) (hc : c.1.1 ∉ Γ.E) + (hcorner : (g = k ∧ c = next k) ∨ (c = k ∧ g = next k)) : + ∃ (tG tC : I) (D : Set S), 0 < tG ∧ tG < 1 ∧ 0 < tC ∧ tC < 1 ∧ + IsClosedDisc D ∧ D ⊆ W ∧ D ⊆ Q k ∧ + spoke γ g.1 '' Icc 0 tG ∪ spoke γ c.1 '' Icc 0 tC ⊆ discBd D ∧ + D ∩ H.U ⊆ spoke γ g.1 '' Icc 0 tG ∪ spoke γ c.1 '' Icc 0 tC ∧ + D ∩ Γ.U ⊆ spoke γ g.1 '' Icc 0 tG ∧ + D ∩ C ⊆ spoke γ c.1 '' Icc 0 tC := by + have hvg : spoke γ g.1 0 = v := (spoke_zero γ g.1).trans g.2.2 + have hvc : spoke γ c.1 0 = v := (spoke_zero γ c.1).trans c.2.2 + have hG : ∀ t : I, spoke γ g.1 t ∈ Γ.U := by + intro t + by_cases ht : t = 0 + · rw [ht, hvg] + exact Γ.V_subset_U hv + · exact (hg.2.1 (spoke_mem_edge hγ g.2.1 (unitInterval.pos_iff_ne_zero.mpr ht))).1 + have hC : ∀ t : I, spoke γ c.1 t ∈ C := by + intro t + by_cases ht : t = 0 + · rwa [ht, hvc] + · exact hnew c.1.1 c.2.1 hc (spoke_mem_edge hγ c.2.1 (unitInterval.pos_iff_ne_zero.mpr ht)) + have hGoff : ∀ t : I, spoke γ g.1 t ∈ C → spoke γ g.1 t = v := by + intro t htC + by_cases ht : t = 0 + · rwa [ht] + · have he := spoke_mem_edge hγ g.2.1 (unitInterval.pos_iff_ne_zero.mpr ht) + exact ((hg.2.1 he).2 (hn ⟨htC, hG t⟩)).elim + have hCoff : ∀ t : I, spoke γ c.1 t ∈ Γ.U → spoke γ c.1 t = v := by + intro t htΓ + by_cases ht : t = 0 + · rwa [ht] + · have he := spoke_mem_edge hγ c.2.1 (unitInterval.pos_iff_ne_zero.mpr ht) + exact ((c.2.1.2.1 he).2 (hsub.1 (hn ⟨hC t, htΓ⟩))).elim + obtain ⟨t₀, t₁, D, ht₀, ht₀1, ht₁, ht₁1, hD, hDW, hDQ, hDb, hDH⟩ := exists_corner_cap hS hγ hsec k + have hchoose : ∃ tG tC : I, 0 < tG ∧ tG < 1 ∧ 0 < tC ∧ tC < 1 ∧ + spoke γ g.1 '' Icc 0 tG ∪ spoke γ c.1 '' Icc 0 tC ⊆ discBd D ∧ + D ∩ H.U ⊆ spoke γ g.1 '' Icc 0 tG ∪ spoke γ c.1 '' Icc 0 tC := by + rcases hcorner with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨t₀, t₁, ht₀, ht₀1, ht₁, ht₁1, hDb, hDH⟩ + · exact ⟨t₁, t₀, ht₁, ht₁1, ht₀, ht₀1, by rwa [union_comm], by rwa [union_comm]⟩ + obtain ⟨tG, tC, htG, htG1, htC, htC1, hbdD, hDH'⟩ := hchoose + have hvG : v ∈ spoke γ g.1 '' Icc 0 tG := ⟨0, ⟨le_rfl, htG.le⟩, hvg⟩ + have hvC' : v ∈ spoke γ c.1 '' Icc 0 tC := ⟨0, ⟨le_rfl, htC.le⟩, hvc⟩ + refine ⟨tG, tC, D, htG, htG1, htC, htC1, hD, hDW, hDQ, hbdD, hDH', ?_, ?_⟩ + · rintro x ⟨hxD, hxΓ⟩ + rcases hDH' ⟨hxD, hsub.U_subset hxΓ⟩ with hxG | ⟨t, _, htx⟩ + · exact hxG + · have hxv : x = v := htx.symm.trans (hCoff t (htx.symm ▸ hxΓ)) + exact hxv.symm ▸ hvG + · rintro x ⟨hxD, hxC⟩ + rcases hDH' ⟨hxD, hlocal ⟨hxC, hDW hxD⟩⟩ with ⟨t, _, htx⟩ | hxC' + · have hxv : x = v := htx.symm.trans (hGoff t (htx.symm ▸ hxC)) + exact hxv.symm ▸ hvC' + · exact hxC' + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72MixedCorners.lean b/LeanPool/GraphMinor/GM12/Section72MixedCorners.lean new file mode 100644 index 0000000000..68690e674a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72MixedCorners.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Logic.Relation +public import Mathlib.SetTheory.Cardinal.NatCard +public import Mathlib.Data.Set.Basic + +/-! +# Selecting the two corners for a circle through the boundary vertex + +The local drawing in XII (7.2) has two half-edges from the circle and +at least one from the old drawing. In their cyclic order each circle +half-edge has an old half-edge on at least one side. Otherwise the two +circle half-edges would form a whole orbit, missing the old half-edges. +The two selected mixed corners are distinct. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +private theorem exists_mixed_corner_at {α : Type*} [Finite α] + (next : α → α) (hinj : Function.Injective next) + (hreach : ∀ a b, Relation.ReflTransGen (fun a b => b = next a) a b) + (hneq : ∀ a, next a ≠ a) + {old : Set α} (hold : old.Nonempty) {x y : α} + (hx : x ∉ old) (hy : y ∉ old) + (hbad : ∀ z, z ∉ old → z = x ∨ z = y) : + ∃ k, (k = x ∧ next k ∈ old) ∨ (k ∈ old ∧ next k = x) := by + by_cases hnext : next x ∈ old + · exact ⟨x, Or.inl ⟨rfl, hnext⟩⟩ + · obtain ⟨p, hpx⟩ := Finite.surjective_of_injective hinj x + by_cases hp : p ∈ old + · exact ⟨p, Or.inr ⟨hp, hpx⟩⟩ + · have hnextx : next x = y := (hbad (next x) hnext).resolve_left (hneq x) + have hpy : p = y := (hbad p hp).resolve_left (fun h => hneq x (h ▸ hpx)) + have hnexty : next y = x := hpy ▸ hpx + obtain ⟨z, hz⟩ := hold + have horbit : ∀ w, Relation.ReflTransGen (fun a b => b = next a) x w → w = x ∨ w = y := by + intro w hpath + induction hpath with + | refl => exact Or.inl rfl + | @tail a b _ hab ih => + rw [hab] + rcases ih with rfl | rfl + · exact Or.inr hnextx + · exact Or.inl hnexty + rcases horbit z (hreach x z) with rfl | rfl + · exact (hx hz).elim + · exact (hy hz).elim + +/-- The two mixed corners used for the vertex diversion in XII (7.2), +page 260. The two new half-edges in a cyclic order can each be paired +with an adjacent old half-edge, using distinct corners. -/ +theorem exists_two_mixed_corners {α : Type*} [Finite α] + (next : α → α) (hinj : Function.Injective next) + (hreach : ∀ a b, Relation.ReflTransGen (fun a b => b = next a) a b) + (hneq : ∀ a, next a ≠ a) + {old : Set α} (hold : old.Nonempty) {x y : α} (hxy : x ≠ y) + (hx : x ∉ old) (hy : y ∉ old) + (hbad : ∀ z, z ∉ old → z = x ∨ z = y) : + ∃ k l, k ≠ l ∧ + ((k = x ∧ next k ∈ old) ∨ (k ∈ old ∧ next k = x)) ∧ + ((l = y ∧ next l ∈ old) ∨ (l ∈ old ∧ next l = y)) := by + obtain ⟨k, hk⟩ := exists_mixed_corner_at next hinj hreach hneq hold hx hy hbad + obtain ⟨l, hl⟩ := exists_mixed_corner_at next hinj hreach hneq hold hy hx + (fun z hz => (hbad z hz).symm) + refine ⟨k, l, ?_, hk, hl⟩ + intro hkl + rcases hk with ⟨hkx, hkn⟩ | ⟨hko, hkn⟩ + · rcases hl with ⟨hly, _⟩ | ⟨hlo, _⟩ + · exact hxy (hkx.symm.trans (hkl.trans hly)) + · exact hx (hkx ▸ (hkl.symm ▸ hlo)) + · rcases hl with ⟨hly, _⟩ | ⟨_, hln⟩ + · exact hy (hly ▸ (hkl ▸ hko)) + · exact hxy (hkn.symm.trans ((congrArg next hkl).trans hln)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72NoBigon.lean b/LeanPool/GraphMinor/GM12/Section72NoBigon.lean new file mode 100644 index 0000000000..72be76aa66 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72NoBigon.lean @@ -0,0 +1,128 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72BigonSides +public import LeanPool.GraphMinor.GM12.Section72ChordBigon +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# No new empty bigon in the merged region + +For XII (7.2), page 260, two retained spokes cannot bound an empty +bigon in the merged region. If their old end differs from the removed +boundary vertex, the bigon misses that vertex and was already empty. +At the boundary vertex, a bigon containing the removed disc can be +cut along the deleted spoke. One side of this cut was an old empty +bigon. Both cases contradict the original radial condition. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +private theorem subset_old_region_of_disjoint_inside {D Q r : Set S} {v : S} + (hbd : discBd D ⊆ r ∪ {v}) (hQ : Q ⊆ (r ∪ (D \ {v})) ∪ {v}) + (hdis : Disjoint (discInt D) Q) : Q ⊆ r ∪ {v} := by + intro x hx + rcases hQ hx with (hxr | ⟨hxD, _⟩) | hxv + · exact Or.inl hxr + · have hxb : x ∈ discBd D := by + by_contra hnb + exact disjoint_left.mp hdis ⟨hxD, hnb⟩ hx + exact hbd hxb + · exact Or.inr hxv + +/-- Retained spokes cannot bound a new empty bigon in the merged +region of XII (7.2), page 260. Cutting along the deleted spoke handles +the case in which the bigon contains the removed disc. -/ +theorem no_empty_bigon_in_merged_region (hS : IsClosedSurface S) + {Γ K C : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + (hC : C.IsSubdrawing K) {D r f g h : Set S} {v u x : S} + (hD : IsClosedDisc D) (hb : frontier D = C.U) (hCZ : C.U ⊆ r ∪ {v}) + (hr : r ∈ Γ.R) (hv : v ∈ Γ.V) (hur : u ∈ r) (huK : u ∈ K.V) + (hfC : f ∈ C.E) (hf : K.toGraph.IsLink f v u) + (hg : g ∈ (radialDiscDeletion K D f).E) + (hh : h ∈ (radialDiscDeletion K D f).E) (hgh : g ≠ h) + (hx : x ∈ Γ.V) (hcapg : closure g ∩ K.V = {x, u}) + (hcaph : closure h ∩ K.V = {x, u}) : + ¬ ∃ Q : Set S, IsClosedDisc Q ∧ Q ⊆ (r ∪ (D \ {v})) ∪ {x} ∧ + subBd Q = closure g ∪ closure h := by + rintro ⟨Q, hQ, hQY, hQbd⟩ + have hgd := (radialDiscDeletion_E K D f).subset hg + have hhd := (radialDiscDeletion_E K D f).subset hh + have hfg : f ≠ g := Ne.symm hgd.2.2 + have hfh : f ≠ h := Ne.symm hhd.2.2 + have hbdD : discBd D = C.U := (IsClosedDisc.frontier_eq_discBd hS hD).symm.trans hb + have hbdQ : discBd Q = closure g ∪ closure h := + (IsClosedDisc.frontier_eq_discBd hS hQ).symm.trans + ((subBd_eq_frontier Q).symm.trans hQbd) + have hQout : discBd Q ⊆ closure (univ \ D) := by + rw [hbdQ] + exact union_subset (closure_minimal hgd.2.1 isClosed_closure) + (closure_minimal hhd.2.1 isClosed_closure) + have hvD : v ∈ D := by + have hvcl : v ∈ closure f := (hf.2.2.2.superset (Or.inl rfl)).1 + exact Surface.discBd_subset D (hbdD.symm ▸ C.closure_subset_U hfC hvcl) + have hbdDZ : discBd D ⊆ r ∪ {v} := hbdD ▸ hCZ + by_cases hxv : x = v + · subst x + have hvu : v ≠ u := fun heq => region_subset hr (heq ▸ hur) (Γ.V_subset_U hv) + have hlinef := isLine_closure (hC.2 hfC) hvu hf.2.2.2 + have hlineg := isLine_closure hgd.1 hvu hcapg + have hlineh := isLine_closure hhd.1 hvu hcaph + have hGF : closure g ∩ closure h ⊆ {v, u} := by + intro y hy + exact hcapg.subset ⟨hy.1, closure_inter_subset_V hgd.1 hhd.1 hgh hy⟩ + rcases disc_subset_or_disjoint_interior_of_boundary_outside hS hD hQ hQout with hDQ | hdis + · have hFbd : closure f ⊆ discBd D := hbdD.symm ▸ C.closure_subset_U hfC + have hFQ : closure f ∩ discBd Q = {v, u} := by + apply Subset.antisymm + · rintro y ⟨hyf, hyQ⟩ + rw [hbdQ] at hyQ + have hyV : y ∈ K.V := by + rcases hyQ with hyg | hyh + · exact closure_inter_subset_V (hC.2 hfC) hgd.1 hfg ⟨hyf, hyg⟩ + · exact closure_inter_subset_V (hC.2 hfC) hhd.1 hfh ⟨hyf, hyh⟩ + exact hf.2.2.2.subset ⟨hyf, hyV⟩ + · intro y hy + exact ⟨(hf.2.2.2.superset hy).1, hbdQ.symm ▸ Or.inl ((hcapg.superset hy).1)⟩ + obtain ⟨P, hP, hPQ, hPbd, hPdis⟩ := exists_chord_bigon_outside_nested_disc + hD hQ hDQ hlinef hlineg hlineh hvu hFbd hbdQ hGF hFQ + have hPZ : P ⊆ r ∪ {v} := + subset_old_region_of_disjoint_inside hbdDZ (hPQ.trans hQY) hPdis + have hPbd' : subBd P = discBd P := + (subBd_eq_frontier P).trans (IsClosedDisc.frontier_eq_discBd hS hP) + rcases hPbd with hPG | hPH + · exact hK.2.2.2.2.2 g hgd.1 f (hC.2 hfC) hgd.2.2 v hv r hr u ⟨hur, huK⟩ + hcapg hf.2.2.2 ⟨P, hP, hPZ, hPbd'.trans hPG⟩ + · exact hK.2.2.2.2.2 h hhd.1 f (hC.2 hfC) hhd.2.2 v hv r hr u ⟨hur, huK⟩ + hcaph hf.2.2.2 ⟨P, hP, hPZ, hPbd'.trans hPH⟩ + · exact hK.2.2.2.2.2 g hgd.1 h hhd.1 hgh v hv r hr u ⟨hur, huK⟩ + hcapg hcaph ⟨Q, hQ, subset_old_region_of_disjoint_inside hbdDZ hQY hdis, hQbd⟩ + · have hvY : v ∉ r ∪ (D \ {v}) := by + rintro (hvr | ⟨_, hvv⟩) + · exact region_subset hr hvr (Γ.V_subset_U hv) + · exact hvv rfl + have hvQ : v ∉ Q := by + intro hvQ + rcases hQY hvQ with hvY' | hvx + · exact hvY hvY' + · exact hxv (mem_singleton_iff.mp hvx).symm + have hQold := disc_subset_old_region_of_missing_boundary_vertex hS hD hQ hvD hvQ + hQout hbdDZ hQY + exact hK.2.2.2.2.2 g hgd.1 h hhd.1 hgh x hx r hr u ⟨hur, huK⟩ + hcapg hcaph ⟨Q, hQ, hQold, hQbd⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72OpenDisc.lean b/LeanPool/GraphMinor/GM12/Section72OpenDisc.lean new file mode 100644 index 0000000000..9aa9cc8a74 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72OpenDisc.lean @@ -0,0 +1,239 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72DiscSides +import LeanPool.GraphMinor.GM12.Section72DiscMap +import LeanPool.GraphMinor.GM11.PerimeterPull +import Mathlib.Topology.Piecewise + +/-! +# The open disc obtained by filling one side of a region + +For XII (7.2), page 260, replace the removed disc by its Jordan disc +in the compactification of the old region. The prescribed boundary +map extends across the discs. Paste it with the collapse map outside +the removed disc. This gives a homeomorphism from the merged region +to the old open disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 OnePoint + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- Filling a disc attached along all its boundary except one point to an +open disc gives an open disc. This is the open-disc assertion in XII (7.2), +page 260. The one missing boundary point stays outside the union. -/ +theorem isOpenDisc_union_disc_sdiff_point (hS : IsClosedSurface S) + {r Δ : Set S} {v : S} (hr : IsOpenDisc r) (hΔ : IsClosedDisc Δ) + (hv : v ∈ discBd Δ) (hvr : v ∉ r) (hbr : discBd Δ \ {v} ⊆ r) : + IsOpenDisc (r ∪ (Δ \ {v})) := by + classical + have : CompactSpace S := hS.1 + have : T2Space (OnePoint r) := by + obtain ⟨e⟩ := isSphere_onePoint hr + exact e.symm.t2Space + obtain ⟨B, hB, hbB, hside⟩ := theorem_7_2_disc_side hS hr hΔ hv hvr hbr + have hc : Continuous (collapse r) := continuous_collapse hr.1 + have hk : InjOn (collapse r) r := by + intro x hx y hy hxy + rw [collapse_of_mem hx, collapse_of_mem hy] at hxy + exact congrArg Subtype.val (OnePoint.coe_injective hxy) + have hfinite : ∀ {x : S}, collapse r x ≠ ∞ → x ∈ r := by + intro x hx + by_contra hxr + exact hx (collapse_of_notMem hxr) + have hboundary : ∀ {x : S}, x ∈ discBd Δ → x ∉ r → x = v := by + intro x hxb hxr + by_contra hxv + exact hxr (hbr ⟨hxb, by simpa only [mem_singleton_iff] using hxv⟩) + have hki : InjOn (collapse r) (discBd Δ) := by + intro x hx y hy hxy + by_cases hxr : x ∈ r + · have hyr := hfinite (by rw [← hxy, collapse_of_mem hxr]; exact OnePoint.coe_ne_infty _) + exact hk hxr hyr hxy + · have hyr : y ∉ r := by + intro hyr + rw [collapse_of_notMem hxr, collapse_of_mem hyr] at hxy + exact OnePoint.coe_ne_infty _ hxy.symm + exact (hboundary hx hxr).trans (hboundary hy hyr).symm + obtain ⟨g, hgc, hgi, hgB, hgbd⟩ := exists_disc_boundary_extension hΔ hB (collapse r) + hc.continuousOn hki hbB.symm + have hg_mem : MapsTo g Δ B := fun x hx => hgB ▸ mem_image_of_mem g hx + have hgv : g v = ∞ := (hgbd hv).trans (collapse_of_notMem hvr) + have hκB : ∀ {x : S}, x ∈ r → (collapse r x ∈ B ↔ x ∈ Δ) := by + intro x hxr + constructor + · intro hxB + by_cases hxb : collapse r x ∈ discBd B + · rw [hbB] at hxb + obtain ⟨y, hy, hyx⟩ := hxb + have hyr := hfinite (by rw [hyx, collapse_of_mem hxr]; exact OnePoint.coe_ne_infty _) + exact hk hyr hxr hyx ▸ Surface.discBd_subset Δ hy + · have hxint : collapse r x ∈ discInt B := ⟨hxB, hxb⟩ + rw [← hside] at hxint + obtain ⟨y, hy, hyx⟩ := hxint + exact hk hy.2 hxr hyx ▸ hy.1.1 + · intro hxD + by_cases hxb : x ∈ discBd Δ + · exact Surface.discBd_subset B (hbB ▸ mem_image_of_mem (collapse r) hxb) + · have hxint : collapse r x ∈ discInt B := hside ▸ mem_image_of_mem + (collapse r) ⟨⟨hxD, hxb⟩, hxr⟩ + exact hxint.1 + let Y := r ∪ (Δ \ {v}) + have hYeq : Y = r ∪ interior Δ := by + apply Subset.antisymm + · rintro x (hx | ⟨hxD, hxv⟩) + · exact Or.inl hx + · by_cases hxi : x ∈ interior Δ + · exact Or.inr hxi + · have hxb : x ∈ discBd Δ := (IsClosedDisc.frontier_eq_discBd hS hΔ) ▸ ⟨subset_closure hxD, + hxi⟩ + exact Or.inl (hbr ⟨hxb, hxv⟩) + · rintro x (hx | hxi) + · exact Or.inl hx + · refine Or.inr ⟨interior_subset hxi, ?_⟩ + intro hxv + have hvi : v ∈ interior Δ := mem_singleton_iff.mp hxv ▸ hxi + exact ((IsClosedDisc.frontier_eq_discBd hS hΔ).symm ▸ hv).2 hvi + have hYo : IsOpen Y := hYeq ▸ hr.1.union isOpen_interior + have hYv : ∀ {x}, x ∈ Y → x ≠ v := by + rintro x (hx | hx) rfl + · exact hvr hx + · exact hx.2 rfl + have hYout : ∀ {x}, x ∈ Y → x ∉ Δ → x ∈ r := by + rintro x (hx | hx) hxD + · exact hx + · exact (hxD hx.1).elim + let L : S → OnePoint r := Δ.piecewise g (collapse r) + have hLc : ContinuousOn L Y := by + refine ContinuousOn.piecewise ?_ ?_ (hc.continuousOn.mono inter_subset_left) + · rintro x ⟨_, hxf⟩ + exact hgbd ((IsClosedDisc.frontier_eq_discBd hS hΔ) ▸ hxf) + · exact hgc.mono (by rw [hΔ.isClosed.closure_eq]; exact inter_subset_right) + have hL_mem : ∀ {x}, x ∈ Y → (L x ∈ B ↔ x ∈ Δ) := by + intro x hx + by_cases hxD : x ∈ Δ + · simp only [L, piecewise, hxD, ↓reduceIte, iff_true] + exact hg_mem hxD + · simp only [L, piecewise, hxD, ↓reduceIte, iff_false] + exact fun h => hxD ((hκB (hYout hx hxD)).mp h) + have hLi : InjOn L Y := by + intro x hx y hy hxy + by_cases hxD : x ∈ Δ + · have hyD : y ∈ Δ := (hL_mem hy).mp (hxy ▸ (hL_mem hx).mpr hxD) + exact hgi hxD hyD (by simpa only [L, piecewise, hxD, hyD, ↓reduceIte] using hxy) + · have hyD : y ∉ Δ := fun hyD => hxD ((hL_mem hx).mp (hxy.symm ▸ (hL_mem hy).mpr hyD)) + exact hk (hYout hx hxD) (hYout hy hyD) + (by simpa only [L, piecewise, hxD, hyD, ↓reduceIte] using hxy) + let N : Set (OnePoint r) := {z | z ≠ ∞} + have hLN : MapsTo L Y N := by + intro x hx + by_cases hxD : x ∈ Δ + · change L x ≠ ∞ + rw [show L x = g x from by simp [L, hxD]] + exact fun h => hYv hx (hgi hxD (Surface.discBd_subset Δ hv) (h.trans hgv.symm)) + · rw [show L x = collapse r x from by simp [L, hxD], collapse_of_mem (hYout hx hxD)] + exact OnePoint.coe_ne_infty _ + have hLs : ∀ z ∈ N, ∃ x ∈ Y, L x = z := by + intro z hz + by_cases hzB : z ∈ B + · obtain ⟨x, hxD, hxg⟩ := hgB.symm ▸ hzB + have hxv : x ≠ v := fun h => hz (by rw [← hxg, h, hgv]) + exact ⟨x, Or.inr ⟨hxD, by simpa only [mem_singleton_iff] using hxv⟩, by simp [L, hxD, hxg]⟩ + · obtain ⟨x, rfl⟩ := OnePoint.ne_infty_iff_exists.mp hz + have hxD : x.1 ∉ Δ := fun h => hzB (by rw [← collapse_of_mem x.2]; exact (hκB x.2).mpr h) + exact ⟨x.1, Or.inl x.2, by simp [L, hxD, collapse_of_mem x.2]⟩ + let j : Δ → B := fun x => ⟨g x, hg_mem x.2⟩ + have hjc : Continuous j := hgc.domRestrict.subtype_mk _ + have hjb : Function.Bijective j := by + refine ⟨fun x y h => Subtype.ext (hgi x.2 y.2 (congrArg Subtype.val h)), ?_⟩ + rintro ⟨z, hz⟩ + obtain ⟨x, hx, rfl⟩ := hgB.symm ▸ hz + exact ⟨⟨x, hx⟩, rfl⟩ + have : CompactSpace Δ := isCompact_iff_compactSpace.mp hΔ.isCompact + let H : Δ ≃ₜ B := hjc.homeoOfEquivCompactToT2 (f := Equiv.ofBijective j hjb) + let k : OnePoint r → S := fun z => if hz : z ∈ B then (H.symm ⟨z, hz⟩).1 else v + have hkB : ContinuousOn k B := by + rw [continuousOn_iff_continuous_domRestrict] + have heq : B.domRestrict k = fun z : B => (H.symm z).1 := by + ext z + simp [k, domRestrict, z.2] + rw [heq] + exact continuous_subtype_val.comp H.symm.continuous + have hkg : ∀ x ∈ Δ, k (g x) = x := by + intro x hx + change (if hz : g x ∈ B then (H.symm ⟨g x, hz⟩).1 else v) = x + rw [dite_eq_left (hg_mem hx)] + exact congrArg Subtype.val (H.symm_apply_apply ⟨x, hx⟩) + have hunc : ∀ x ∈ r, uncollapse v (collapse r x) = x := by + intro x hx + rw [collapse_of_mem hx, uncollapse_coe] + have hkbd : EqOn k (uncollapse v) (discBd B) := by + intro z hz + rw [hbB] at hz + obtain ⟨x, hx, rfl⟩ := hz + rw [← hgbd hx, hkg x (Surface.discBd_subset Δ hx), hgbd hx] + by_cases hxr : x ∈ r + · exact (hunc x hxr).symm + · rw [collapse_of_notMem hxr] + exact hboundary hx hxr + have huc : ContinuousOn (uncollapse (A := r) v) N := by + intro z hz + obtain ⟨x, rfl⟩ := OnePoint.ne_infty_iff_exists.mp hz + exact (continuousAt_uncollapse v x).continuousWithinAt + let M := B.piecewise k (uncollapse v) + have hMc : ContinuousOn M N := by + refine ContinuousOn.piecewise ?_ ?_ (huc.mono inter_subset_left) + · intro z hz + exact hkbd ((IsClosedDisc.frontier_eq_discBd (GM11.IsSphere.isClosedSurface + (isSphere_onePoint hr)).1 hB) ▸ hz.2) + · exact hkB.mono (by rw [hB.isClosed.closure_eq]; exact inter_subset_right) + have hML : ∀ x ∈ Y, M (L x) = x := by + intro x hx + by_cases hxD : x ∈ Δ + · rw [show L x = g x from by simp [L, hxD]] + simp only [M, piecewise, hg_mem hxD, ↓reduceIte] + exact hkg x hxD + · have hxB : L x ∉ B := fun h => hxD ((hL_mem hx).mp h) + simp only [M, piecewise, hxB, ↓reduceIte] + rw [show L x = collapse r x from by simp [L, hxD]] + exact hunc x (hYout hx hxD) + let f : Y → N := fun x => ⟨L x, hLN x.2⟩ + have hfc : Continuous f := hLc.domRestrict.subtype_mk _ + have hfb : Function.Bijective f := by + refine ⟨fun x y h => Subtype.ext (hLi x.2 y.2 (congrArg Subtype.val h)), ?_⟩ + rintro ⟨z, hz⟩ + obtain ⟨x, hx, hLx⟩ := hLs z hz + exact ⟨⟨x, hx⟩, Subtype.ext hLx⟩ + let e := Equiv.ofBijective f hfb + have hInv : ∀ z : N, M z = (e.symm z).1 := by + intro z + have he : L (e.symm z).1 = z.1 := congrArg Subtype.val (e.apply_symm_apply z) + rw [← he] + exact hML _ (e.symm z).2 + let E : Y ≃ₜ N := + { toEquiv := e + continuous_toFun := hfc + continuous_invFun := (hMc.domRestrict.congr hInv).subtype_mk _ } + have hN : range ((↑) : r → OnePoint r) = N := by + ext z + exact OnePoint.ne_infty_iff_exists.symm + let R : r ≃ₜ N := OnePoint.isOpenEmbedding_coe.isEmbedding.toHomeomorph.trans + (Homeomorph.setCongr hN) + obtain ⟨φ⟩ := hr.2 + exact ⟨hYo, ⟨(φ.trans R).trans E.symm⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72OtherParallel.lean b/LeanPool/GraphMinor/GM12/Section72OtherParallel.lean new file mode 100644 index 0000000000..8a90078386 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72OtherParallel.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72RetainedBoundary +public import LeanPool.GraphMinor.GM11.RadialRegions +import LeanPool.GraphMinor.GM11.Section810 + +/-! +# Parallel spokes in unchanged regions + +For maximality in XII (7.2), page 260, an extra spoke in an unchanged +old region misses the removed disc. It also misses the old radial +drawing in its interior, since all old radial points there survive. +Old maximality supplies a parallel spoke. Its region end is outside +the removed disc, so that spoke survives as well. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- An extra spoke in an unchanged region has a retained old +parallel spoke, as required for maximality in XII (7.2), page 260. -/ +theorem exists_parallel_spoke_in_unchanged_region + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K C : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hC : C.IsSubdrawing K) + {D f s : Set S} (hD : IsClosedDisc D) (hb : frontier D = C.U) (hf : f ∈ C.E) + (hs : s ∈ Γ.R) (hsD : Disjoint s D) {w x : S} + (hw : w ∈ s ∩ (radialDiscDeletion K D f).V) + (hx : x ∈ (Γ.interSet (closure (univ \ D))).V) + {L : Set S} (hL : IsLineWithEnds L w x) (hwx : w ≠ x) + (hLs : L \ {w, x} ⊆ s) (hLK : Disjoint (L \ {w, x}) (radialDiscDeletion K D f).U) : + ∃ g ∈ (radialDiscDeletion K D f).E, + closure g ∩ (radialDiscDeletion K D f).V = {x, w} ∧ + ∃ Q : Set S, IsClosedDisc Q ∧ Q ⊆ s ∪ {x} ∧ subBd Q = closure g ∪ L := by + have hKK := radialDiscDeletion_isSubdrawing K D f + have hfD : f ⊆ D := by + intro y hy + have hybd : y ∈ frontier D := hb.symm ▸ (hf.2.1 hy).1 + exact hD.isClosed.closure_subset_iff.mpr subset_rfl hybd.1 + have hdisOld : Disjoint (L \ {w, x}) K.U := by + apply disjoint_left.mpr + intro y hyL hyK + have hyD : y ∉ D := disjoint_left.mp hsD (hLs hyL) + have hyK' : y ∈ (radialDiscDeletion K D f).U := by + rw [radialDiscDeletion_U hC hb hf] + exact ⟨⟨hyK, subset_closure ⟨mem_univ _, hyD⟩⟩, fun hyf => hyD (hfD hyf)⟩ + exact disjoint_left.mp hLK hyL hyK' + have hxΓ : x ∈ Γ.V := (mem_interSet_V_iff isClosed_closure).mp hx |>.1 + obtain ⟨g, hg, hcap, Q, hQ, hQs, hQbd⟩ := parallel_of_line ⟨hK.1, hK.2.1⟩ hK.2.2 hS + hs hw.1 (hKK.1 hw.2) hxΓ hL hwx hLs hdisOld + have hwcl : w ∈ closure g := (hcap.superset (Or.inr rfl)).1 + have hgNew := edge_retained_of_end_outside_disc hS hC hD hb hf hg hwcl + (disjoint_left.mp hsD hw.1) + exact ⟨g, hgNew, (hKK.closure_inter_V hgNew).trans hcap, Q, hQ, hQs, hQbd⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72ParallelInside.lean b/LeanPool/GraphMinor/GM12/Section72ParallelInside.lean new file mode 100644 index 0000000000..5fe7b8a78c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72ParallelInside.lean @@ -0,0 +1,86 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72PreRadial +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.GM11.RadialCorners +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# An old empty bigon cannot contain another parallel spoke + +For the maximality step in XII (7.2), page 260, a new spoke is +compared with an old parallel spoke. The disc between them lies in +an old region with one boundary vertex restored. It cannot contain +a third old parallel spoke: that spoke and the old boundary spoke +would bound a disc there, contrary to the old radial condition. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +/-- Two distinct old parallel spokes cannot both lie in a closed +disc in their old region with the boundary vertex restored. This is +used in the maximality verification of XII (7.2), page 260. -/ +theorem not_parallel_spokes_in_region_disc (hS : IsClosedSurface S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + {g h Q r : Set S} {x u : S} (hg : g ∈ K.E) (hh : h ∈ K.E) (hgh : g ≠ h) + (hx : x ∈ Γ.V) (hr : r ∈ Γ.R) (hur : u ∈ r) (huK : u ∈ K.V) + (hcapg : closure g ∩ K.V = {x, u}) (hcaph : closure h ∩ K.V = {x, u}) + (hQ : IsClosedDisc Q) (hQr : Q ⊆ r ∪ {x}) + (hgQ : closure g ⊆ Q) (hhQ : closure h ⊆ Q) : False := by + have hxu : x ≠ u := fun heq => region_subset hr (heq ▸ hur) (Γ.V_subset_U hx) + have hLg := isLine_closure hg hxu hcapg + have hLh := isLine_closure hh hxu hcaph + have hmeet : closure g ∩ closure h ⊆ {x, u} := fun z hz => + hcapg.subset ⟨hz.1, closure_inter_subset_V hg hh hgh hz⟩ + have hcircle := isOArc_union hLg hLh hmeet + obtain ⟨P, hP, _⟩ := disc_oArc Q (closure g ∪ closure h) hQ + (union_subset hgQ hhQ) hcircle + have hPbd : subBd P = closure g ∪ closure h := + (subBd_eq_frontier P).trans + ((IsClosedDisc.frontier_eq_discBd hS hP.2.1).trans hP.2.2.1) + exact hK.2.2.2.2.2 g hg h hh hgh x hx r hr u ⟨hur, huK⟩ hcapg hcaph + ⟨P, hP.2.1, hP.1.trans hQr, hPbd⟩ + +/-- Every third old parallel spoke misses a disc between an old +spoke and a new line. Otherwise connectedness puts the whole spoke +in the disc, giving the forbidden old empty bigon. -/ +theorem parallel_spoke_disjoint_region_bigon (hS : IsClosedSurface S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + {g h L Q r : Set S} {x u : S} (hg : g ∈ K.E) (hh : h ∈ K.E) (hgh : g ≠ h) + (hx : x ∈ Γ.V) (hr : r ∈ Γ.R) (hur : u ∈ r) (huK : u ∈ K.V) + (hcapg : closure g ∩ K.V = {x, u}) (hcaph : closure h ∩ K.V = {x, u}) + (hQ : IsClosedDisc Q) (hQr : Q ⊆ r ∪ {x}) (hbd : discBd Q = closure h ∪ L) + (hLK : Disjoint (L \ {x, u}) K.U) : Disjoint g Q := by + have hdis : Disjoint g (discBd Q) := by + apply disjoint_left.mpr + intro z hzg hzb + rw [hbd] at hzb + rcases hzb with hzh | hzL + · exact (hg.2.1 hzg).2 (closure_inter_subset_V hg hh hgh ⟨subset_closure hzg, hzh⟩) + · have hzn : z ∉ ({x, u} : Set S) := fun hz => + (hg.2.1 hzg).2 ((hcapg.superset hz).2) + exact disjoint_left.mp hLK ⟨hzL, hzn⟩ (hg.2.1 hzg).1 + have hman : ∀ z : S, IsManifoldPoint z := fun z => (hS.2.2 z).isManifoldPoint + rcases hQ.side hman hg.2.2.1.isConnected.isPreconnected hdis with hin | hout + · have hgQ : closure g ⊆ Q := closure_minimal (hin.trans (discInt_subset Q)) hQ.isClosed + have hhQ : closure h ⊆ Q := (hbd.symm ▸ subset_union_left).trans (Surface.discBd_subset Q) + exact (not_parallel_spokes_in_region_disc hS hK hg hh hgh hx hr hur huK + hcapg hcaph hQ hQr hgQ hhQ).elim + · exact hout + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72ParallelReplacement.lean b/LeanPool/GraphMinor/GM12/Section72ParallelReplacement.lean new file mode 100644 index 0000000000..8040fcfa61 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72ParallelReplacement.lean @@ -0,0 +1,117 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72ParallelInside +public import LeanPool.GraphMinor.GM12.Section72DiscGluing +import LeanPool.GraphMinor.GM11.Section810 + +/-! +# Replacing the deleted parallel spoke + +For maximality in XII (7.2), page 260, move a new spoke outside the +removed disc and use old maximality to find a parallel old spoke. +Every other old boundary spoke misses the disc between them. Its +open interior therefore misses the removed disc. The old parallel +spoke is retained unless it is the deleted one. In that case glue +the two discs along the deleted spoke to obtain a disc between the +new spoke and the retained boundary spoke. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The old parallel spoke is retained, or gluing along the deleted +spoke gives a new empty bigon with the retained boundary spoke. +This is the parallel-spoke comparison for XII (7.2), page 260. -/ +theorem parallel_spoke_retained_or_replaced + {S : Type*} [TopologicalSpace S] [T2Space S] (hS : IsClosedSurface S) + {Γ K C : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + (hC : C.IsSubdrawing K) {D Q r e f g L : Set S} {v u : S} + (hD : IsClosedDisc D) (hbdD : discBd D = C.U) (hCE : C.E = {e, f}) (hef : e ≠ f) + (hCU : C.U = closure e ∪ closure f) + (he : K.toGraph.IsLink e v u) (hf : K.toGraph.IsLink f v u) + (hr : r ∈ Γ.R) (hv : v ∈ Γ.V) (hur : u ∈ r) (huK : u ∈ K.V) + (hg : g ∈ K.E) (hcapg : closure g ∩ K.V = {v, u}) + (hL : IsLineWithEnds L v u) (hLD : L ∩ D ⊆ {v, u}) + (hLK : Disjoint (L \ {v, u}) K.U) + (hQ : IsClosedDisc Q) (hQr : Q ⊆ r ∪ {v}) (hbdQ : discBd Q = closure g ∪ L) : + g ∈ (radialDiscDeletion K D f).E ∨ + ∃ P : Set S, IsClosedDisc P ∧ P ⊆ (r ∪ (D \ {v})) ∪ {v} ∧ + subBd P = closure e ∪ L := by + have hopen : IsOpen (discInt Q) := hQ.isOpen_discInt fun z => (hS.2.2 z).isManifoldPoint + have hdisBoundary : ∀ k ∈ C.E, Disjoint (discInt Q) (closure k) := by + intro k hk + have hcapk : closure k ∩ K.V = {v, u} := by + rcases hCE.subset hk with rfl | rfl + · exact he.2.2.2 + · exact hf.2.2.2 + by_cases hkg : k = g + · subst k + exact disjoint_left.mpr fun z hzQ hzg => hzQ.2 (hbdQ.symm ▸ Or.inl hzg) + · have hdis := parallel_spoke_disjoint_region_bigon hS hK (hC.2 hk) hg hkg + hv hr hur huK hcapk hcapg hQ hQr hbdQ hLK + exact (hdis.mono_right (discInt_subset Q)).closure_left hopen |>.symm + have hdis : Disjoint (discInt Q) (discBd D) := by + rw [hbdD, hCU] + exact disjoint_union_right.mpr ⟨hdisBoundary e (hCE.symm ▸ Or.inl rfl), + hdisBoundary f (hCE.symm ▸ Or.inr rfl)⟩ + obtain ⟨z, hzL, hzn⟩ := (isPathConnected_sdiff_pair hL).nonempty + have hzQ : z ∈ Q := Surface.discBd_subset Q (hbdQ.symm ▸ Or.inr hzL) + have hzD : z ∉ D := fun hzD => hzn (hLD ⟨hzL, hzD⟩) + have houtside := discInt_disjoint_of_boundary_point_outside hS hD hQ hdis hzQ hzD + have hinterBd : Q ∩ D ⊆ discBd Q ∩ discBd D := disc_inter_subset_boundaries hS hQ hD houtside + have hgQ : closure g ⊆ Q := (hbdQ.symm ▸ subset_union_left).trans (Surface.discBd_subset Q) + have hgOut : g ⊆ closure (univ \ D) := by + intro y hy + by_cases hyD : y ∈ D + · have hybd := (hinterBd ⟨hgQ (subset_closure hy), hyD⟩).2 + have hyfront : y ∈ frontier D := IsClosedDisc.frontier_eq_discBd hS hD |>.symm ▸ hybd + rw [frontier_eq_closure_inter_closure] at hyfront + simpa only [compl_eq_univ_sdiff] using hyfront.2 + · exact subset_closure ⟨mem_univ _, hyD⟩ + by_cases hgf : g = f + · subst g + have hinter : D ∩ Q = closure f := by + apply Subset.antisymm + · rintro y ⟨hyD, hyQ⟩ + have hybd := (hinterBd ⟨hyQ, hyD⟩).1 + rw [hbdQ] at hybd + rcases hybd with hyf | hyL + · exact hyf + · exact (hf.2.2.2.superset (hLD ⟨hyL, hyD⟩)).1 + · intro y hyf + exact ⟨Surface.discBd_subset D (hbdD.symm ▸ hCU.symm ▸ Or.inr hyf), hgQ hyf⟩ + have hEF : closure e ∩ closure f ⊆ {v, u} := fun y hy => + he.2.2.2.subset ⟨hy.1, closure_inter_subset_V he.1 hf.1 hef hy⟩ + have hLF : L ∩ closure f ⊆ {v, u} := fun y hy => hLD ⟨hy.1, + Surface.discBd_subset D (hbdD.symm ▸ hCU.symm ▸ Or.inr hy.2)⟩ + have hends : ({v, u} : Set S) ⊆ closure e := fun y hy => (he.2.2.2.superset hy).1 + have hvu : v ≠ u := fun h => region_subset hr (h ▸ hur) (Γ.V_subset_U hv) + have hlinef := isLine_closure hf.1 hvu hf.2.2.2 + obtain ⟨hP, hPbd⟩ := glue_bigons_along_spoke hD hQ hlinef hinter + (hbdD.trans hCU) hbdQ hEF hLF hends + have hPY : D ∪ Q ⊆ (r ∪ (D \ {v})) ∪ {v} := by + rintro y (hyD | hyQ) + · by_cases hyv : y = v + · exact Or.inr hyv + · exact Or.inl (Or.inr ⟨hyD, hyv⟩) + · rcases hQr hyQ with hyr | hyv + · exact Or.inl (Or.inl hyr) + · exact Or.inr hyv + exact Or.inr ⟨D ∪ Q, hP, hPY, (subBd_eq_frontier _).trans + ((IsClosedDisc.frontier_eq_discBd hS hP).trans hPbd)⟩ + · left + rw [radialDiscDeletion_E] + exact ⟨hg, hgOut, hgf⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72PatchHalves.lean b/LeanPool/GraphMinor/GM12/Section72PatchHalves.lean new file mode 100644 index 0000000000..da4f660378 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72PatchHalves.lean @@ -0,0 +1,136 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72CirclePatch +public import LeanPool.GraphMinor.GM11.EvenCircuit + +/-! +# The two new half-edges in the local circle patch + +Each new line in the patch at the vertex in XII (7.2) gives exactly +one half-edge there. The two lines meet only at the vertex. Thus the +new half-edges are distinct, and every remaining half-edge comes from +the old drawing. This is the input for selecting the mixed corners. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +private theorem half_index_eq_of_pair {H : Drawing S} {γ : Set S → I → S} + (hγ : EdgePar H γ) {e : Set S} (he : e ∈ H.E) {v a : S} + (hp : closure e ∩ H.V = {v, a}) (ha : a ≠ v) + {b c : Bool} (hb : γ e (endOf b) = v) (hc : γ e (endOf c) = v) : b = c := by + by_contra hbc + have hboth : γ e 0 = v ∧ γ e 1 = v := by + cases b with + | false => + cases c with + | false => exact (hbc rfl).elim + | true => exact ⟨hb, hc⟩ + | true => + cases c with + | false => exact ⟨hc, hb⟩ + | true => exact (hbc rfl).elim + have hends := closure_inter_V_eq hγ he + change closure e ∩ H.V = {γ e 0, γ e 1} at hends + rw [hboth.1, hboth.2, pair_eq_singleton] at hends + have hamem : a ∈ closure e ∩ H.V := hp.symm ▸ Or.inr rfl + exact ha (by simpa only [hends, mem_singleton_iff] using hamem) + +/-- The two line edges of the local patch for XII (7.2), page 260, +give exactly the two half-edges not belonging to the old drawing. -/ +theorem circle_patch_halfEdges + {Γ H : Drawing S} {L₀ L₁ : Set S} {v a b : S} + (h₀ : IsLineWithEnds L₀ v a) (h₁ : IsLineWithEnds L₁ v b) + (ha : a ≠ v) (hb : b ≠ v) (hv : v ∈ Γ.V) + (hmeet : Γ.U ∩ (L₀ ∪ L₁) ⊆ {v}) (hcap : L₀ ∩ L₁ = {v}) + (hV : H.V = Γ.V ∪ {a, b}) + (hE : H.E = Γ.E ∪ {L₀ \ {v, a}, L₁ \ {v, b}}) + {γ : Set S → I → S} (hγ : EdgePar H γ) : + ∃ j₀ j₁ : halfEdges H γ v, j₀ ≠ j₁ ∧ + j₀.1.1 = L₀ \ {v, a} ∧ j₁.1.1 = L₁ \ {v, b} ∧ + j₀.1.1 ∉ Γ.E ∧ j₁.1.1 ∉ Γ.E ∧ + ∀ k : halfEdges H γ v, k.1.1 ∉ Γ.E → k = j₀ ∨ k = j₁ := by + have hvH : v ∈ H.V := hV.symm ▸ Or.inl hv + have hvL₀ : v ∈ L₀ := by obtain ⟨e, h0, _⟩ := h₀; exact h0 ▸ (e 0).2 + have haL : a ∈ L₀ := by obtain ⟨e, _, h1⟩ := h₀; exact h1 ▸ (e 1).2 + have hvL₁ : v ∈ L₁ := by obtain ⟨e, h0, _⟩ := h₁; exact h0 ▸ (e 0).2 + have hbL : b ∈ L₁ := by obtain ⟨e, _, h1⟩ := h₁; exact h1 ▸ (e 1).2 + have hpair₀ : closure (L₀ \ {v, a}) ∩ H.V = {v, a} := by + rw [closure_sdiff_pair h₀, hV] + ext x + constructor + · rintro ⟨hxL, hxG | hxa | hxb⟩ + · exact Or.inl (mem_singleton_iff.mp (hmeet ⟨Γ.V_subset_U hxG, Or.inl hxL⟩)) + · exact Or.inr hxa + · have hxv : x = v := mem_singleton_iff.mp (hcap ▸ ⟨hxL, hxb ▸ hbL⟩) + exact Or.inl hxv + · rintro (rfl | rfl) + · exact ⟨hvL₀, Or.inl hv⟩ + · exact ⟨haL, Or.inr (Or.inl rfl)⟩ + have hpair₁ : closure (L₁ \ {v, b}) ∩ H.V = {v, b} := by + rw [closure_sdiff_pair h₁, hV] + ext x + constructor + · rintro ⟨hxL, hxG | hxa | hxb⟩ + · exact Or.inl (mem_singleton_iff.mp (hmeet ⟨Γ.V_subset_U hxG, Or.inr hxL⟩)) + · have hxv : x = v := mem_singleton_iff.mp (hcap ▸ ⟨hxa ▸ haL, hxL⟩) + exact Or.inl hxv + · exact Or.inr hxb + · rintro (rfl | rfl) + · exact ⟨hvL₁, Or.inl hv⟩ + · exact ⟨hbL, Or.inr (Or.inr rfl)⟩ + have he₀ : L₀ \ {v, a} ∈ H.E := hE.symm ▸ Or.inr (Or.inl rfl) + have he₁ : L₁ \ {v, b} ∈ H.E := hE.symm ▸ Or.inr (Or.inr rfl) + have hn₀ : L₀ \ {v, a} ∉ Γ.E := by + intro he + obtain ⟨x, hx⟩ := he.1 + have hxv := hmeet ⟨(he.2.1 hx).1, Or.inl hx.1⟩ + exact hx.2 (Or.inl (mem_singleton_iff.mp hxv)) + have hn₁ : L₁ \ {v, b} ∉ Γ.E := by + intro he + obtain ⟨x, hx⟩ := he.1 + have hxv := hmeet ⟨(he.2.1 hx).1, Or.inr hx.1⟩ + exact hx.2 (Or.inl (mem_singleton_iff.mp hxv)) + have hne : L₀ \ {v, a} ≠ L₁ \ {v, b} := by + intro heq + obtain ⟨x, hx⟩ := he₀.1 + have hx₁ : x ∈ L₁ \ {v, b} := heq ▸ hx + have hxv : x = v := mem_singleton_iff.mp (hcap ▸ ⟨hx.1, hx₁.1⟩) + exact hx.2 (Or.inl hxv) + have hvcl₀ : v ∈ closure (L₀ \ {v, a}) := (hpair₀.symm ▸ Or.inl rfl : v ∈ closure + (L₀ \ {v, a}) ∩ H.V).1 + have hvcl₁ : v ∈ closure (L₁ \ {v, b}) := (hpair₁.symm ▸ Or.inl rfl : v ∈ closure + (L₁ \ {v, b}) ∩ H.V).1 + obtain ⟨c₀, hc₀⟩ := exists_end_eq hγ he₀ hvH hvcl₀ + obtain ⟨c₁, hc₁⟩ := exists_end_eq hγ he₁ hvH hvcl₁ + let j₀ : halfEdges H γ v := ⟨(L₀ \ {v, a}, c₀), he₀, hc₀⟩ + let j₁ : halfEdges H γ v := ⟨(L₁ \ {v, b}, c₁), he₁, hc₁⟩ + refine ⟨j₀, j₁, fun h => hne (congrArg (fun j : halfEdges H γ v => j.1.1) h), + rfl, rfl, hn₀, hn₁, ?_⟩ + intro k hkn + have hke : k.1.1 ∈ Γ.E ∪ {L₀ \ {v, a}, L₁ \ {v, b}} := hE ▸ k.2.1 + rcases hke with hko | hk₀ | hk₁ + · exact (hkn hko).elim + · refine Or.inl (Subtype.ext (Prod.ext hk₀ ?_)) + have hkbool : γ (L₀ \ {v, a}) (endOf k.1.2) = v := hk₀ ▸ k.2.2 + exact half_index_eq_of_pair hγ he₀ hpair₀ ha hkbool hc₀ + · refine Or.inr (Subtype.ext (Prod.ext hk₁ ?_)) + have hkbool : γ (L₁ \ {v, b}) (endOf k.1.2) = v := hk₁ ▸ k.2.2 + exact half_index_eq_of_pair hγ he₁ hpair₁ hb hkbool hc₁ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72PreRadial.lean b/LeanPool/GraphMinor/GM12/Section72PreRadial.lean new file mode 100644 index 0000000000..617dcabda5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72PreRadial.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72NoBigon +import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.GM11.Section810 + +/-! +# The radial conditions after deleting the interior pieces + +In XII (7.2), page 260, the closed outside of the two-spoke circuit +and the deletion of one boundary spoke satisfy the defining radial +conditions before maximality. The point-set and hub results give the +first conditions. A possible empty bigon in an unchanged region was +already empty. The new merged region is handled by cutting along the +deleted boundary spoke. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The radial deletion in XII (7.2), page 260, satisfies all radial +conditions apart from maximality. -/ +theorem radialDiscDeletion_isPreRadial + {S : Type*} [TopologicalSpace S] [T2Space S] (hS : IsClosedSurface S) + {Γ K C : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + (hC : C.IsSubdrawing K) {D r f : Set S} {v u : S} + (hD : IsClosedDisc D) (hb : frontier D = C.U) (hCV : C.V = {v, u}) + (hr : r ∈ Γ.R) (hv : v ∈ Γ.V) (hur : u ∈ r) (huK : u ∈ K.V) + (hCZ : C.U ⊆ r ∪ {v}) (hmeet : Γ.U ∩ C.U = {v}) + (hfC : f ∈ C.E) (hf : K.toGraph.IsLink f v u) : + (PaintingOrDrawing.drawing (Γ.interSet (closure (univ \ D)))).IsPreRadialDrawing + (radialDiscDeletion K D f) := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let Γ' := Γ.interSet (closure (univ \ D)) + let K' := radialDiscDeletion K D f + let Y := r ∪ (D \ {v}) + have hΓ : Γ'.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hKK : K'.IsSubdrawing K := radialDiscDeletion_isSubdrawing K D f + obtain ⟨_, _, _, _, hY, hcover⟩ := radialDiscDeletion_region_facts hS hD hb hr hv hCZ hmeet + have huNew : u ∈ K'.V := radialDiscDeletion_mem_vertexSet_of_mem_frontier + (hb.symm ▸ C.V_subset_U (hCV.symm ▸ Or.inr rfl)) huK + refine ⟨radialDiscDeletion_inter hK D f, radialDiscDeletion_vertex_subset hK D f, + radialDiscDeletion_region_hubs hS hK hC hD hb hCV hr hv hur huK hCZ hmeet, + radialDiscDeletion_vertex_region hK D f, radialDiscDeletion_edge_ends hK D f, ?_⟩ + intro g hg h hh hgh x hx s hs w hw hcapg hcaph + have hcapgK : closure g ∩ K.V = {x, w} := (hKK.closure_inter_V hg).symm.trans hcapg + have hcaphK : closure h ∩ K.V = {x, w} := (hKK.closure_inter_V hh).symm.trans hcaph + by_cases hsY : s = Y + · subst s + have hwu : w = u := + (radialDiscDeletion_merged_hub hK hC hb hCV hr hur huK).unique hw ⟨Or.inl hur, huNew⟩ + subst w + exact no_empty_bigon_in_merged_region hS hK hC hD hb hCZ hr hv hur huK hfC hf + hg hh hgh (hΓ.1 hx) hcapgK hcaphK + · have hsOld := region_mem_of_ne_merged_region hΓ hY hcover hs hsY + exact hK.2.2.2.2.2 g (hKK.2 hg) h (hKK.2 hh) hgh x (hΓ.1 hx) s hsOld + w ⟨hw.1, hKK.1 hw.2⟩ hcapgK hcaphK + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72PushAway.lean b/LeanPool/GraphMinor/GM12/Section72PushAway.lean new file mode 100644 index 0000000000..f81aa45a0e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72PushAway.lean @@ -0,0 +1,164 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72Regions +import LeanPool.GraphMinor.GM11.ArcDrawings +import LeanPool.GraphMinor.Surface.PushOff + +/-! +# Diverting a circle that misses the boundary vertex + +In the rerouting step of XII (7.2), page 260, first consider a circle +that misses the one vertex on the removed disc boundary. A short arc +of that boundary around the vertex misses the circle. Pushing across +the rest of the disc, while fixing the outside drawing and the two +ends of the short arc, moves the circle completely off the disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- A short line of a circle through a prescribed point avoids a closed set +missing that point and contains the circle near that point. -/ +theorem exists_small_boundary_line {F C : Set S} (hF : IsOArc F) + {v : S} (hv : v ∈ F) (hC : IsClosed C) (hvn : v ∉ C) : + ∃ (L : Set S) (a b : S), IsLineWithEnds L a b ∧ L ⊆ F ∧ v ∈ L ∧ + Disjoint L C ∧ a ≠ v ∧ b ≠ v ∧ + ∃ O : Set S, IsOpen O ∧ v ∈ O ∧ F ∩ O ⊆ L := by + obtain ⟨p, hp, hp0, _, hperiod, himg, hpF⟩ := exists_oArc_par hF hv + have hO : IsOpen (p ⁻¹' Cᶜ) := hC.isOpen_compl.preimage hp + have h0O : (0 : ℝ) ∈ p ⁻¹' Cᶜ := by + change p 0 ∉ C + rwa [hp0] + obtain ⟨ε, hε, hεsub⟩ := Metric.isOpen_iff.mp hO (0 : ℝ) h0O + let δ := min (ε / 2) (Real.pi / 2) + have hδ : 0 < δ := lt_min (by linarith) (by positivity) + have hδε : δ < ε := (min_le_left _ _).trans_lt (by linarith) + have hδπ : δ < Real.pi := (min_le_right _ _).trans_lt (by linarith [Real.pi_pos]) + have hi : InjOn p (Icc (-δ) δ) := by + intro s hs t ht hst + obtain ⟨m, hm⟩ := hperiod s t hst + rcases lt_trichotomy m 0 with hn | hz | hp + · have hn' : (m : ℝ) ≤ -1 := by + have hmneg : m ≤ -1 := by omega + exact_mod_cast hmneg + have hmul := mul_le_mul_of_nonneg_right hn' (show 0 ≤ 2 * Real.pi by positivity) + nlinarith [hs.1, ht.2] + · simpa only [hz, Int.cast_zero, zero_mul, add_zero] using hm + · have hp' : (1 : ℝ) ≤ m := by exact_mod_cast hp + have hmul := mul_le_mul_of_nonneg_right hp' (show 0 ≤ 2 * Real.pi by positivity) + nlinarith [hs.2, ht.1] + let L := p '' Icc (-δ) δ + have hline : IsLineWithEnds L (p (-δ)) (p δ) := isLine_of_injOn hp (by linarith) hi + have h0 : (0 : ℝ) ∈ Icc (-δ) δ := ⟨by linarith, hδ.le⟩ + refine ⟨L, p (-δ), p δ, hline, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · exact (image_subset_range p _).trans hpF + · exact ⟨0, h0, hp0⟩ + · refine disjoint_left.mpr ?_ + rintro x ⟨s, hs, rfl⟩ hsC + have hsball : s ∈ ball (0 : ℝ) ε := by + rw [mem_ball, Real.dist_eq, sub_zero, abs_lt] + constructor <;> linarith [hs.1, hs.2] + exact hεsub hsball hsC + · intro ha + have heq := hi ⟨le_rfl, by linarith⟩ h0 (ha.trans hp0.symm) + linarith + · intro hb + have heq := hi ⟨by linarith, le_rfl⟩ h0 (hb.trans hp0.symm) + linarith + · have hshift : ∀ t ∈ Ico (0 : ℝ) (2 * Real.pi), p (t - 2 * Real.pi) = p t := by + intro t ht + obtain ⟨u, hu, hups⟩ := himg.symm ▸ hpF (mem_range_self (t - 2 * Real.pi)) + obtain ⟨m, hm⟩ := hperiod u (t - 2 * Real.pi) hups + have hmlo : 1 ≤ m := by + by_contra hn + have hm0 : m ≤ 0 := by omega + have hm0' : (m : ℝ) ≤ 0 := by exact_mod_cast hm0 + have hmul := mul_nonpos_of_nonpos_of_nonneg hm0' (show 0 ≤ 2 * Real.pi by positivity) + linarith [hu.1, ht.2] + have hmhi : m ≤ 1 := by + by_contra hn + have hm2 : 2 ≤ m := by omega + have hm2' : (2 : ℝ) ≤ m := by exact_mod_cast hm2 + have hmul := mul_le_mul_of_nonneg_right hm2' (show 0 ≤ 2 * Real.pi by positivity) + nlinarith [hu.2, ht.1] + have hm1 : m = 1 := le_antisymm hmhi hmlo + have hut : u = t := by rw [hm1] at hm; norm_num at hm; linarith + exact hut ▸ hups.symm + let K := p '' Icc δ (2 * Real.pi - δ) + have hK : IsClosed K := (isCompact_Icc.image hp).isClosed + have hvK : v ∉ K := by + rintro ⟨t, ht, htv⟩ + obtain ⟨m, hm⟩ := hperiod t 0 (htv.trans hp0.symm) + by_cases hm0 : m ≤ 0 + · have hm0' : (m : ℝ) ≤ 0 := by exact_mod_cast hm0 + have hmul := mul_nonpos_of_nonpos_of_nonneg hm0' (show 0 ≤ 2 * Real.pi by positivity) + linarith [ht.1] + · have hm1 : 1 ≤ m := by omega + have hm1' : (1 : ℝ) ≤ m := by exact_mod_cast hm1 + have hmul := mul_le_mul_of_nonneg_right hm1' (show 0 ≤ 2 * Real.pi by positivity) + nlinarith [ht.2] + refine ⟨Kᶜ, hK.isOpen_compl, hvK, ?_⟩ + rintro x ⟨hxF, hxK⟩ + obtain ⟨t, ht, rfl⟩ := himg.symm ▸ hxF + by_cases htlo : t ≤ δ + · exact ⟨t, ⟨by linarith [ht.1], htlo⟩, rfl⟩ + · by_cases hthi : 2 * Real.pi - δ ≤ t + · exact ⟨t - 2 * Real.pi, ⟨by linarith, by linarith [ht.2]⟩, hshift t ht⟩ + · exact (hxK ⟨t, ⟨(not_le.mp htlo).le, (not_le.mp hthi).le⟩, rfl⟩).elim + +/-- The diversion used in XII (7.2), page 260, for a closed circle missing +the boundary vertex. The resulting homeomorphism fixes the outside drawing +pointwise and moves the circle completely off the selected disc. -/ +theorem theorem_7_2_push_away_of_notMem (hS : IsClosedSurface S) + {Δ G C : Set S} {v : S} (hΔ : IsClosedDisc Δ) (hv : v ∈ discBd Δ) + (hG : IsClosed G) (hGD : G ∩ Δ ⊆ {v}) (hC : IsOArc C) (hvn : v ∉ C) : + ∃ h : S ≃ₜ S, (∀ x ∈ G, h x = x) ∧ Disjoint (h '' C) Δ := by + have : CompactSpace S := hS.1 + have hCc : IsClosed C := by + obtain ⟨e⟩ := hC + have : CompactSpace C := e.compactSpace + exact (isCompact_iff_compactSpace.mpr this).isClosed + obtain ⟨L, a, b, hL, hLF, hvL, hLC, _, _, _⟩ := + exists_small_boundary_line hΔ.isOArc_discBd hv hCc hvn + obtain ⟨e, hea, heb⟩ := hL + have haL : a ∈ L := hea ▸ (e 0).2 + have hbL : b ∈ L := heb ▸ (e 1).2 + let Y := G ∪ {a, b} + have hYc : IsClosed Y := hG.union ((finite_singleton b).insert a).isClosed + have hYD : Y ∩ Δ ⊆ L := by + rintro x ⟨hxG | hxpair, hxD⟩ + · exact mem_singleton_iff.mp (hGD ⟨hxG, hxD⟩) ▸ hvL + · rcases mem_insert_iff.mp hxpair with rfl | hx + · exact haL + · exact mem_singleton_iff.mp hx ▸ hbL + have hCL : C ∩ L ⊆ ({a, b} : Set S) := fun _ hx => (disjoint_left.mp hLC hx.2 hx.1).elim + obtain ⟨h, hfix, hpush⟩ := push_disc (fun x => hS.2.2 x) hΔ ⟨e, hea, heb⟩ + (hLF.trans (Surface.discBd_subset Δ)) (Or.inl ⟨hLF, hYD⟩) + (hLF haL) (hLF hbL) hYc (Or.inr (mem_insert a _)) + (Or.inr (mem_insert_of_mem a rfl)) hCc hCL + refine ⟨h, fun x hx => hfix x (Or.inl hx), disjoint_left.mpr ?_⟩ + rintro x ⟨y, hy, rfl⟩ hyD + have hyab := hpush ⟨mem_image_of_mem h hy, hyD⟩ + rcases mem_insert_iff.mp hyab with hya | hyb + · have heq : h y = h a := hya.trans (hfix a (Or.inr (mem_insert a _))).symm + exact disjoint_left.mp hLC haL (h.injective heq ▸ hy) + · have heq : h y = h b := (mem_singleton_iff.mp hyb).trans + (hfix b (Or.inr (mem_insert_of_mem a rfl))).symm + exact disjoint_left.mp hLC hbL (h.injective heq ▸ hy) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72PushCaps.lean b/LeanPool/GraphMinor/GM12/Section72PushCaps.lean new file mode 100644 index 0000000000..11d210ed8e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72PushCaps.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72PushAway + +/-! +# Pushing across the two mixed corner caps + +For the vertex diversion in XII (7.2), move the boundary circle away +from each of the two local branches of the other circle. Push it off +the two mixed caps in succession, fixing the old drawing and fixing +the first cap during the second push. Inverting this homeomorphism +then moves the local branches away from the boundary circle. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- Push a closed set off a boundary cap while fixing the old drawing. +The set can meet the fixed boundary line at its first end only. -/ +theorem push_cap_fixing (hS : IsClosedSurface S) + {D A G F : Set S} {v a : S} (hD : IsClosedDisc D) + (hA : IsLineWithEnds A v a) (ha : a ≠ v) (hAb : A ⊆ discBd D) + (hG : IsClosed G) (hvG : v ∈ G) (haG : a ∈ G) (hGD : G ∩ D ⊆ A) + (hF : IsClosed F) (hFA : F ∩ A ⊆ {v}) : + ∃ h : S ≃ₜ S, (∀ x ∈ G, h x = x) ∧ (h '' F) ∩ D ⊆ {v} := by + have : CompactSpace S := hS.1 + have haA : a ∈ A := by obtain ⟨e, _, h1⟩ := hA; exact h1 ▸ (e 1).2 + have hvA : v ∈ A := by obtain ⟨e, h0, _⟩ := hA; exact h0 ▸ (e 0).2 + obtain ⟨h, hfix, hpush⟩ := push_disc (fun x => hS.2.2 x) hD hA + (hAb.trans (Surface.discBd_subset D)) (Or.inl ⟨hAb, hGD⟩) (hAb hvA) (hAb haA) + hG hvG haG hF (fun _ hx => Or.inl (mem_singleton_iff.mp (hFA hx))) + refine ⟨h, hfix, ?_⟩ + rintro x ⟨hxF, hxD⟩ + rcases mem_insert_iff.mp (hpush ⟨hxF, hxD⟩) with hxv | hxa + · exact hxv + · obtain ⟨y, hy, hyx⟩ := hxF + have hya : y = a := h.injective ((hyx.trans (mem_singleton_iff.mp hxa)).trans (hfix a haG).symm) + exact (ha (mem_singleton_iff.mp (hFA ⟨hya ▸ hy, haA⟩))).elim + +/-- Push a boundary circle off two mixed caps, keeping the first cap fixed +in the second push. This is the local diversion at the vertex in XII (7.2), +page 260. -/ +theorem push_two_caps_fixing (hS : IsClosedSurface S) + {D₀ D₁ A₀ A₁ G F C O : Set S} {v a₀ a₁ : S} + (hD₀ : IsClosedDisc D₀) (hD₁ : IsClosedDisc D₁) + (hA₀ : IsLineWithEnds A₀ v a₀) (hA₁ : IsLineWithEnds A₁ v a₁) + (ha₀ : a₀ ≠ v) (ha₁ : a₁ ≠ v) + (hAb₀ : A₀ ⊆ discBd D₀) (hAb₁ : A₁ ⊆ discBd D₁) + (hG : IsClosed G) (hvG : v ∈ G) (hA₀G : A₀ ⊆ G) (hA₁G : A₁ ⊆ G) + (hGD₀ : G ∩ D₀ ⊆ A₀) (hGD₁ : G ∩ D₁ ⊆ A₁) + (hDD : D₀ ∩ D₁ ⊆ G) (hF : IsClosed F) (hFG : F ∩ G ⊆ {v}) + (hcover : C ∩ O ⊆ D₀ ∪ D₁) : + ∃ h : S ≃ₜ S, (∀ x ∈ G, h x = x) ∧ ((h '' F) ∩ C) ∩ O ⊆ {v} := by + have ha₀G : a₀ ∈ G := by + obtain ⟨e, _, h1⟩ := hA₀ + exact hA₀G (h1 ▸ (e 1).2) + have ha₁G : a₁ ∈ G := by + obtain ⟨e, _, h1⟩ := hA₁ + exact hA₁G (h1 ▸ (e 1).2) + obtain ⟨h₀, hfix₀, hpush₀⟩ := push_cap_fixing hS hD₀ hA₀ ha₀ hAb₀ hG hvG ha₀G hGD₀ hF + (fun x hx => hFG ⟨hx.1, hA₀G hx.2⟩) + have hG' : IsClosed (G ∪ D₀) := hG.union hD₀.isClosed + have hGD' : (G ∪ D₀) ∩ D₁ ⊆ A₁ := by + rintro x ⟨hxG | hxD₀, hxD₁⟩ + · exact hGD₁ ⟨hxG, hxD₁⟩ + · exact hGD₁ ⟨hDD ⟨hxD₀, hxD₁⟩, hxD₁⟩ + have hF' : IsClosed (h₀ '' F) := h₀.isClosedMap _ hF + have hF'A₁ : (h₀ '' F) ∩ A₁ ⊆ {v} := by + rintro x ⟨⟨y, hy, hyx⟩, hxA⟩ + have hyx' : y = x := h₀.injective (hyx.trans (hfix₀ x (hA₁G hxA)).symm) + exact hFG ⟨hyx' ▸ hy, hA₁G hxA⟩ + obtain ⟨h₁, hfix₁, hpush₁⟩ := push_cap_fixing hS hD₁ hA₁ ha₁ hAb₁ hG' + (Or.inl hvG) (Or.inl ha₁G) hGD' hF' hF'A₁ + let h := h₀.trans h₁ + have hfix : ∀ x ∈ G, h x = x := by + intro x hx + change h₁ (h₀ x) = x + rw [hfix₀ x hx, hfix₁ x (Or.inl hx)] + have hpush₀' : (h '' F) ∩ D₀ ⊆ {v} := by + rintro x ⟨⟨y, hy, hyx⟩, hxD⟩ + have heq : h₀ y = x := h₁.injective (hyx.trans (hfix₁ x (Or.inr hxD)).symm) + exact hpush₀ ⟨⟨y, hy, heq⟩, hxD⟩ + have hpush₁' : (h '' F) ∩ D₁ ⊆ {v} := by + rintro x ⟨⟨y, hy, hyx⟩, hxD⟩ + exact hpush₁ ⟨⟨h₀ y, ⟨y, hy, rfl⟩, hyx⟩, hxD⟩ + refine ⟨h, hfix, ?_⟩ + rintro x ⟨⟨hxF, hxC⟩, hxO⟩ + rcases hcover ⟨hxC, hxO⟩ with hxD₀ | hxD₁ + · exact hpush₀' ⟨hxF, hxD₀⟩ + · exact hpush₁' ⟨hxF, hxD₁⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72PushSpoke.lean b/LeanPool/GraphMinor/GM12/Section72PushSpoke.lean new file mode 100644 index 0000000000..ae28d1c612 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72PushSpoke.lean @@ -0,0 +1,148 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72RadialDeletion +public import LeanPool.GraphMinor.Surface.PushOff +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.RadialChord + +/-! +# Moving a possible extra spoke off the deleted disc + +For maximality in XII (7.2), page 260, keep the reduced drawing and +its retained radial drawing fixed. Their intersection with the removed +disc lies on its retained boundary spoke. The disc-pushing theorem +moves a possible extra spoke off the disc, apart from its ends. It +then misses the whole old radial drawing in its interior. A region +with a fixed point is preserved by a homeomorphism fixing the drawing. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +/-- Push a possible extra spoke off the deleted disc while fixing the +retained drawings. Its interior then misses the old radial drawing, +as needed for maximality in XII (7.2), page 260. -/ +theorem push_extra_spoke_off_disc (hS : IsClosedSurface S) + {K C : Drawing S} (hC : C.IsSubdrawing K) {D E G L f : Set S} {v u x : S} + (hD : IsClosedDisc D) (hb : frontier D = C.U) (hfC : f ∈ C.E) + (hE : IsLineWithEnds E v u) (hEbd : E ⊆ discBd D) + (hG : IsClosed G) (hvG : v ∈ G) (huG : u ∈ G) (hGD : G ∩ D ⊆ E) + (hKG : (radialDiscDeletion K D f).U ⊆ G) + (hL : IsClosed L) (hLE : L ∩ E ⊆ {v, u}) (hLG : L ∩ G ⊆ {x, u}) : + ∃ h : S ≃ₜ S, (∀ y ∈ G, h y = y) ∧ + (h '' L) ∩ D ⊆ {v, u} ∧ Disjoint ((h '' L) \ {x, u}) K.U := by + have : CompactSpace S := hS.1 + have hvE : v ∈ E := by obtain ⟨a, h0, _⟩ := hE; exact h0 ▸ (a 0).2 + have huE : u ∈ E := by obtain ⟨a, _, h1⟩ := hE; exact h1 ▸ (a 1).2 + obtain ⟨h, hfix, hpush⟩ := Surface.push_disc (fun y => hS.2.2 y) hD hE + (hEbd.trans (Surface.discBd_subset D)) (Or.inl ⟨hEbd, hGD⟩) (hEbd hvE) (hEbd huE) + hG hvG huG hL hLE + have hdisG : Disjoint ((h '' L) \ {x, u}) G := by + apply disjoint_left.mpr + rintro y ⟨⟨z, hzL, hzy⟩, hyn⟩ hyG + have hzy' : z = y := h.injective (hzy.trans (hfix y hyG).symm) + exact hyn (hLG ⟨hzy' ▸ hzL, hyG⟩) + have hfD : f ⊆ D := by + intro y hy + have hybd : y ∈ frontier D := hb.symm ▸ (hfC.2.1 hy).1 + exact hD.isClosed.closure_subset_iff.mpr subset_rfl hybd.1 + refine ⟨h, hfix, hpush, disjoint_left.mpr ?_⟩ + intro y hyL hyK + by_cases hyD : y ∈ D + · have hyends := hpush ⟨hyL.1, hyD⟩ + have hyG : y ∈ G := by + rcases hyends with hyv | hyu + · exact mem_singleton_iff.mp hyv ▸ hvG + · exact mem_singleton_iff.mp hyu ▸ huG + exact disjoint_left.mp hdisG hyL hyG + · have hyK' : y ∈ (radialDiscDeletion K D f).U := by + rw [radialDiscDeletion_U hC hb hfC] + exact ⟨⟨hyK, subset_closure ⟨mem_univ _, hyD⟩⟩, fun hyf => hyD (hfD hyf)⟩ + exact disjoint_left.mp hdisG hyL (hKG hyK') + +omit [T2Space S] in +/-- A homeomorphism fixing a drawing maps a region with a fixed point +into itself. This keeps a diverted spoke in its original region. -/ +theorem image_region_subset_of_fixed {Γ : Drawing S} (h : S ≃ₜ S) + (hfix : ∀ y ∈ Γ.U, h y = y) {r : Set S} (hr : r ∈ Γ.R) + {u : S} (hur : u ∈ r) (hu : h u = u) : h '' r ⊆ r := by + have hconn : IsPreconnected (h '' r) := (region_isPreconnected hr).image h + h.continuous.continuousOn + have hdis : Disjoint (h '' r) Γ.U := by + apply disjoint_left.mpr + rintro y ⟨z, hzr, hzy⟩ hyΓ + have hzy' : z = y := h.injective (hzy.trans (hfix y hyΓ).symm) + exact region_subset hr (hzy' ▸ hzr) hyΓ + exact subset_region hr hconn hdis ⟨u, hur, hu⟩ hur + +/-- A homeomorphism sends a line with specified ends to the line +with the corresponding image ends. -/ +theorem lineWithEnds_image_homeomorph (h : S ≃ₜ S) {L : Set S} {u x : S} + (hL : IsLineWithEnds L u x) : IsLineWithEnds (h '' L) (h u) (h x) := by + obtain ⟨p, hp0, hp1⟩ := hL + let q : unitInterval → S := fun t => h (p t).val + have hqc : Continuous q := h.continuous.comp (continuous_subtype_val.comp p.continuous) + have hqi : Function.Injective q := h.injective.comp (Subtype.val_injective.comp p.injective) + have hrange : range q = h '' L := by + ext y + constructor + · rintro ⟨t, rfl⟩ + exact ⟨(p t).val, (p t).property, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + exact ⟨p.symm ⟨z, hz⟩, congrArg h (congrArg Subtype.val (p.apply_symm_apply ⟨z, hz⟩))⟩ + simpa only [q, hp0, hp1, hrange] using isLine_range hqc hqi + +omit [T2Space S] in +/-- Pull an empty spoke disc back after a diversion fixing the +retained drawings. Its boundary and its containing region return +to the original extra spoke. -/ +theorem pullback_spoke_disc (hS : IsClosedSurface S) + {Γ K : Drawing S} (h : S ≃ₜ S) + (hΓ : ∀ y ∈ Γ.U, h y = y) (hK : ∀ y ∈ K.U, h y = y) + {r Q L e : Set S} {u x : S} (hr : r ∈ Γ.R) (hur : u ∈ r) + (hu : h u = u) (hx : h x = x) (he : e ∈ K.E) + (hQ : IsClosedDisc Q) (hQr : Q ⊆ r ∪ {x}) (hbd : subBd Q = closure e ∪ h '' L) : + ∃ P : Set S, IsClosedDisc P ∧ P ⊆ r ∪ {x} ∧ subBd P = closure e ∪ L := by + have hΓsymm : ∀ y ∈ Γ.U, h.symm y = y := by + intro y hy + exact h.symm_apply_eq.mpr (hΓ y hy).symm + have huSymm : h.symm u = u := h.symm_apply_eq.mpr hu.symm + have hxSymm : h.symm x = x := h.symm_apply_eq.mpr hx.symm + have hrimage : h.symm '' r ⊆ r := image_region_subset_of_fixed h.symm hΓsymm hr hur huSymm + obtain ⟨hP, hPbd⟩ := hQ.image h.symm.continuous.continuousOn h.continuous.continuousOn + (fun y _ => h.apply_symm_apply y) + have heimage : h.symm '' closure e = closure e := by + ext y + constructor + · rintro ⟨z, hz, rfl⟩ + have hzfix : h.symm z = z := h.symm_apply_eq.mpr (hK z (K.closure_subset_U he hz)).symm + rw [hzfix] + exact hz + · intro hy + exact ⟨y, hy, h.symm_apply_eq.mpr (hK y (K.closure_subset_U he hy)).symm⟩ + refine ⟨h.symm '' Q, hP, ?_, ?_⟩ + · rintro y ⟨z, hz, rfl⟩ + rcases hQr hz with hzr | hzx + · exact Or.inl (hrimage ⟨z, hzr, rfl⟩) + · exact Or.inr (mem_singleton_iff.mpr + ((congrArg h.symm (mem_singleton_iff.mp hzx)).trans hxSymm)) + · rw [subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hS hP, hPbd, + ← IsClosedDisc.frontier_eq_discBd hS hQ, ← subBd_eq_frontier, hbd, + image_union, heimage, image_image] + have hinv : (fun y => h.symm (h y)) = id := funext h.symm_apply_apply + rw [hinv, image_id] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72Radial.lean b/LeanPool/GraphMinor/GM12/Section72Radial.lean new file mode 100644 index 0000000000..a502dacae2 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72Radial.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72MergedParallel +public import LeanPool.GraphMinor.GM12.Section72OtherParallel +public import LeanPool.GraphMinor.GM12.Section72MaximalCriterion +import LeanPool.GraphMinor.GM12.Section72TwoCell +import LeanPool.GraphMinor.GM11.Section810 + +/-! +# The radial drawing after the one-vertex disc deletion + +This proves the radial construction in XII (7.2), page 260. Keep the +closed outside of the two-spoke circuit and delete one boundary +spoke. The reduced drawing is two-cell, and the radial conditions +are proved in the preceding lemmas. For maximality, every possible +extra spoke has an old parallel spoke in an unchanged region, or a +retained parallel spoke obtained by diversion in the merged region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The radial construction in XII (7.2), page 260: deleting one +boundary spoke and all radial pieces strictly inside the two-spoke +circuit gives a radial drawing of the reduced drawing. -/ +theorem radialDiscDeletion_isRadial + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K C : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hC : C.IsSubdrawing K) + {D r e f : Set S} {v u : S} (hD : IsClosedDisc D) (hb : frontier D = C.U) + (hCE : C.E = {e, f}) (hCV : C.V = {v, u}) (hef : e ≠ f) + (hCU : C.U = closure e ∪ closure f) (hCZ : C.U ⊆ r ∪ {v}) + (he : K.toGraph.IsLink e v u) (hf : K.toGraph.IsLink f v u) + (hmeet : Γ.U ∩ C.U = {v}) (hr : r ∈ Γ.R) (hv : v ∈ Γ.V) + (hur : u ∈ r) (huK : u ∈ K.V) : + (PaintingOrDrawing.drawing (Γ.interSet (closure (univ \ D)))).IsRadialDrawing + (radialDiscDeletion K D f) := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let Γ' := Γ.interSet (closure (univ \ D)) + let K' := radialDiscDeletion K D f + let Y := r ∪ (D \ {v}) + have hfC : f ∈ C.E := hCE.symm ▸ Or.inr rfl + have hΓ : Γ'.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + obtain ⟨hn, hvC, hFV, hFr, hY, hcover⟩ := + radialDiscDeletion_region_facts hS hD hb hr hv hCZ hmeet + have hbd : subBd D = C.U := (subBd_eq_frontier D).trans hb + have htwo : (PaintingOrDrawing.drawing Γ').IsTwoCell := + theorem_7_2_twoCell hS hK.1 hD hbd hn hFV hr hFr + have hpre : (PaintingOrDrawing.drawing Γ').IsPreRadialDrawing K' := + radialDiscDeletion_isPreRadial hS hK.2.1 hC hD hb hCV hr hv hur huK hCZ hmeet hfC hf + have huNew : u ∈ K'.V := radialDiscDeletion_mem_vertexSet_of_mem_frontier + (hb.symm ▸ C.V_subset_U (hCV.symm ▸ Or.inr rfl)) huK + have hvNew : v ∈ Γ'.V := by + have hvf : v ∈ frontier D := hb.symm ▸ hvC + rw [frontier_eq_closure_inter_closure] at hvf + exact (mem_interSet_V_iff isClosed_closure).mpr + ⟨hv, by simpa only [compl_eq_univ_sdiff] using hvf.2⟩ + refine ⟨htwo, hpre, radMax_of_parallel_spokes hS htwo hpre ?_⟩ + intro s hs w hw x hx L hL hwx hLs hLK + by_cases hsY : s = Y + · subst s + have hwu : w = u := + (radialDiscDeletion_merged_hub hK.2.1 hC hb hCV hr hur huK).unique hw ⟨Or.inl hur, huNew⟩ + subst w + exact exists_parallel_spoke_in_merged_region hS hK hC hD hb hCE hCV hef hCU hCZ + he hf hmeet hr hv hur huK hx hL hLs hLK + · have hsOld := region_mem_of_ne_merged_region hΓ hY hcover hs hsY + have hsD : Disjoint s D := by + apply disjoint_left.mpr + intro y hys hyD + have hyv : y ≠ v := fun hyv => region_subset hs (hyv ▸ hys) (Γ'.V_subset_U hvNew) + exact hsY (region_eq_of_mem hs hY hys (Or.inr ⟨hyD, hyv⟩)) + exact exists_parallel_spoke_in_unchanged_region hS hK hC hD hb hfC hsOld hsD hw hx hL hwx hLs + hLK + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72RadialDeletion.lean b/LeanPool/GraphMinor/GM12/Section72RadialDeletion.lean new file mode 100644 index 0000000000..b61dc52c46 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72RadialDeletion.lean @@ -0,0 +1,189 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72Circuit +import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.GM12.Section1 +import LeanPool.GraphMinor.GM11.Forest +import LeanPool.GraphMinor.GM11.Section810 + +/-! +# Deleting the radial pieces inside the boundary circuit + +XII (7.2), page 260, deletes the radial vertices and edges strictly +inside the two-spoke circuit and then deletes one boundary spoke. +Restriction to the closed outside performs the first deletion. Since +the boundary is a subdrawing, it cuts no edge. The lemmas here record +the exact vertices, edges, and point set of this construction. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- An edge meeting a subdrawing belongs to that subdrawing. Its +interior point cannot be a vertex, so it belongs to an edge of each +drawing, and distinct edges have disjoint interiors. -/ +theorem edge_mem_of_meets_subdrawing {K C : Drawing S} (hC : C.IsSubdrawing K) + {e : Set S} (he : e ∈ K.E) (hm : (e ∩ C.U).Nonempty) : e ∈ C.E := by + obtain ⟨x, hxe, hxC⟩ := hm + have hxV : x ∉ C.V := fun hv => (he.2.1 hxe).2 (hC.1 hv) + obtain ⟨f, hf, hxf⟩ := C.exists_edge_of_mem hxC hxV + have hef : e = f := K.edge_eq_of_mem he (hC.2 hf) hxe hxf + exact hef.symm ▸ hf + +/-- Restriction to the closed outside of a subdrawing boundary cuts +no edge. This justifies the first deletion in XII (7.2), page 260. -/ +theorem interSet_outside_U_of_subdrawing_boundary {K C : Drawing S} + (hC : C.IsSubdrawing K) {D : Set S} (hb : frontier D = C.U) : + (K.interSet (closure (univ \ D))).U = K.U ∩ closure (univ \ D) := by + let X := closure (univ \ D) + have hfront : frontier X ⊆ frontier D := by + dsimp [X] + rw [← compl_eq_univ_sdiff, closure_compl, frontier_compl] + exact frontier_interior_subset + have hbX : frontier D ⊆ X := by + rw [frontier_eq_closure_inter_closure] + simpa only [X, compl_eq_univ_sdiff] using + (inter_subset_right : closure D ∩ closure Dᶜ ⊆ closure Dᶜ) + apply Subset.antisymm + · exact subset_inter (Drawing.span_isSubdrawing K _ _).U_subset + (interSet_U_subset isClosed_closure) + · rintro x ⟨hxK, hxX⟩ + by_cases hxV : x ∈ K.V + · exact (K.interSet X).V_subset_U (mem_interSet_V hxV hxX) + · obtain ⟨e, he, hxe⟩ := K.exists_edge_of_mem hxK hxV + have heX : e ⊆ X := by + by_cases hm : (e ∩ C.U).Nonempty + · have heC := edge_mem_of_meets_subdrawing hC he hm + exact fun y hy => hbX (hb.symm ▸ (heC.2.1 hy).1) + · have hdis : Disjoint e (frontier X) := by + apply disjoint_left.mpr + intro y hy hyf + exact hm ⟨y, hy, hb ▸ hfront hyf⟩ + exact subset_of_disjoint_frontier he.2.2.1.isConnected.isPreconnected + isClosed_closure hdis hxe hxX + exact ((mem_interSet_E_iff.mpr ⟨he, heX⟩).2.1 hxe).1 + +/-- The radial deletion in XII (7.2), page 260: retain the closed +outside of the selected disc and remove the boundary spoke `f`. -/ +def radialDiscDeletion (K : Drawing S) (D f : Set S) : Drawing S := + (K.interSet (closure (univ \ D))).deleteEdge f + +/-- Every retained radial vertex and edge is an old one. -/ +theorem radialDiscDeletion_isSubdrawing (K : Drawing S) (D f : Set S) : + (radialDiscDeletion K D f).IsSubdrawing K := + (deleteEdge_isSubdrawing _ _).trans (Drawing.span_isSubdrawing K _ _) + +/-- Exactly the vertices outside the open selected disc remain. -/ +theorem radialDiscDeletion_V (K : Drawing S) (D f : Set S) : + (radialDiscDeletion K D f).V = K.V ∩ closure (univ \ D) := by + unfold radialDiscDeletion + rw [deleteEdge_V] + ext x + exact mem_interSet_V_iff isClosed_closure + +/-- Exactly the edges in the closed outside, apart from `f`, remain. -/ +theorem radialDiscDeletion_E (K : Drawing S) (D f : Set S) : + (radialDiscDeletion K D f).E = + {e | e ∈ K.E ∧ e ⊆ closure (univ \ D) ∧ e ≠ f} := by + unfold radialDiscDeletion + rw [deleteEdge_E] + ext e + simp only [mem_sdiff, mem_singleton_iff, mem_ofPred_eq, mem_interSet_E_iff] + tauto + +/-- The point set of the deletion is the old closed outside with +only the interior of the chosen boundary spoke removed. -/ +theorem radialDiscDeletion_U {K C : Drawing S} (hC : C.IsSubdrawing K) + {D f : Set S} (hb : frontier D = C.U) (hf : f ∈ C.E) : + (radialDiscDeletion K D f).U = (K.U ∩ closure (univ \ D)) \ f := by + have hfX : f ⊆ closure (univ \ D) := by + intro x hx + have hxf : x ∈ frontier D := hb.symm ▸ (hf.2.1 hx).1 + rw [frontier_eq_closure_inter_closure] at hxf + simpa only [compl_eq_univ_sdiff] using hxf.2 + have hf' : f ∈ (K.interSet (closure (univ \ D))).E := + mem_interSet_E_iff.mpr ⟨hC.2 hf, hfX⟩ + unfold radialDiscDeletion + rw [deleteEdge_U _ hf', interSet_outside_U_of_subdrawing_boundary hC hb] + +/-- Every retained old vertex is retained by the radial deletion. -/ +theorem radialDiscDeletion_vertex_subset {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) (D f : Set S) : + (Γ.interSet (closure (univ \ D))).V ⊆ (radialDiscDeletion K D f).V := by + intro x hx + rw [radialDiscDeletion_V] + obtain ⟨hxΓ, hxD⟩ := (mem_interSet_V_iff isClosed_closure).mp hx + exact ⟨hK.2.1 hxΓ, hxD⟩ + +/-- The first radial condition survives the deletion: the two retained +drawings meet precisely at the retained old vertices. -/ +theorem radialDiscDeletion_inter {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) (D f : Set S) : + (Γ.interSet (closure (univ \ D))).U ∩ (radialDiscDeletion K D f).U = + (Γ.interSet (closure (univ \ D))).V := by + let Γ' := Γ.interSet (closure (univ \ D)) + have hΓ : Γ'.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hdel := radialDiscDeletion_isSubdrawing K D f + apply Subset.antisymm + · rintro x ⟨hxΓ, hxK⟩ + have hxV : x ∈ Γ.V := hK.1.subset ⟨hΓ.U_subset hxΓ, hdel.U_subset hxK⟩ + exact (isSubdrawing_U_inter_V hΓ).subset ⟨hxΓ, hxV⟩ + · intro x hx + exact ⟨Γ'.V_subset_U hx, + (radialDiscDeletion K D f).V_subset_U (radialDiscDeletion_vertex_subset hK D f hx)⟩ + +/-- Every retained radial vertex that is not an old vertex lies in +a region of the reduced drawing, as required in XII (7.2). -/ +theorem radialDiscDeletion_vertex_region {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) (D f : Set S) : + ∀ w ∈ (radialDiscDeletion K D f).V \ (Γ.interSet (closure (univ \ D))).V, + ∃ r ∈ (Γ.interSet (closure (univ \ D))).R, w ∈ r := by + intro w hw + have hnot : w ∉ (Γ.interSet (closure (univ \ D))).U := by + intro hwΓ + have hwV := (radialDiscDeletion_inter hK D f).subset + ⟨hwΓ, (radialDiscDeletion K D f).V_subset_U hw.1⟩ + exact hw.2 hwV + exact exists_region_of_notMem hnot + +/-- Each retained spoke still joins a retained old vertex to a +retained region vertex. Its ends are unchanged by the deletion in +XII (7.2), page 260. -/ +theorem radialDiscDeletion_edge_ends {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) (D f : Set S) : + ∀ e ∈ (radialDiscDeletion K D f).E, + ∃ v ∈ (Γ.interSet (closure (univ \ D))).V, + ∃ w ∈ (radialDiscDeletion K D f).V \ (Γ.interSet (closure (univ \ D))).V, + closure e ∩ (radialDiscDeletion K D f).V = {v, w} := by + intro e he + have hedata := (radialDiscDeletion_E K D f).subset he + obtain ⟨v, hv, w, hw, hcap⟩ := hK.2.2.2.2.1 e hedata.1 + have hcl : closure e ⊆ closure (univ \ D) := closure_minimal hedata.2.1 isClosed_closure + have hvcl : v ∈ closure e := by + have hv' : v ∈ closure e ∩ K.V := hcap.superset (Or.inl rfl) + exact hv'.1 + have hvNew : v ∈ (Γ.interSet (closure (univ \ D))).V := + (mem_interSet_V_iff isClosed_closure).mpr ⟨hv, hcl hvcl⟩ + have hcapNew : closure e ∩ (radialDiscDeletion K D f).V = {v, w} := + ((radialDiscDeletion_isSubdrawing K D f).closure_inter_V he).trans hcap + have hwNew : w ∈ (radialDiscDeletion K D f).V := + (hcapNew.superset (Or.inr rfl)).2 + have hwn : w ∉ (Γ.interSet (closure (univ \ D))).V := fun hwΓ => + hw.2 ((Drawing.span_isSubdrawing Γ _ _).1 hwΓ) + exact ⟨v, hvNew, w, ⟨hwNew, hwn⟩, hcapNew⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72RadialExists.lean b/LeanPool/GraphMinor/GM12/Section72RadialExists.lean new file mode 100644 index 0000000000..baebe16afb --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72RadialExists.lean @@ -0,0 +1,103 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72Radial +import LeanPool.GraphMinor.GM12.Section72Tangle +import LeanPool.GraphMinor.GM11.Section810 + +/-! +# A radial subdrawing for the original disc restriction + +In XII (7.2), page 260, the two-spoke trace either backtracks, in +which case no old drawing point is removed, or gives a boundary +circuit with the same old inside and outside. In the second case use +the proved radial deletion. In both cases the new radial drawing is +a subdrawing of the old one and retains the old region's hub. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +/-- Restriction to a closed set containing the whole drawing leaves +the drawing unchanged. -/ +theorem interSet_eq_self_of_U_subset {Γ : Drawing S} {X : Set S} + (hX : IsClosed X) (hΓX : Γ.U ⊆ X) : Γ.interSet X = Γ := by + apply Drawing.ext_of_V_E + · ext x + rw [mem_interSet_V_iff hX] + exact ⟨fun hx => hx.1, fun hx => ⟨hx, hΓX (Γ.V_subset_U hx)⟩⟩ + · ext e + rw [mem_interSet_E_iff] + exact ⟨fun he => he.1, fun he => ⟨he, fun x hx => hΓX (he.2.1 hx).1⟩⟩ + +/-- The radial subdrawing and retained hub used in the metric +comparisons of XII (7.2), page 260, for the original boundary disc. -/ +theorem exists_radial_subdrawing_after_disc_deletion [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) (hθ : 2 ≤ θ) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {ins : Drawing S → Set S} (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + {F r D : Set S} {v : S} (hF : IsOArc F) (hvF : v ∈ F) + (hv : v ∈ Γ.V) (hr : r ∈ Γ.R) (hFr : F \ {v} ⊆ r) + (hn : Γ.IsNormal F) (hD : IsClosedDisc D) (hbd : subBd D = F) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) : + ∃ K' : Drawing S, + (PaintingOrDrawing.drawing (Γ.interSet (closure (univ \ D)))).IsRadialDrawing K' ∧ + K'.IsSubdrawing K ∧ ∃ u ∈ r, u ∈ K'.V := by + rcases exists_radial_boundary_circuit_or_disc_subset_region hS hT hθ hK hE hd + hF hvF hv hr hFr hn hD hbd hm with hDZ | hcircle + · have hΓX : Γ.U ⊆ closure (univ \ D) := by + intro x hxΓ + by_cases hxD : x ∈ D + · rcases hDZ hxD with hxr | hxv + · exact (region_subset hr hxr hxΓ).elim + · have hxf : x ∈ frontier D := by + rw [← subBd_eq_frontier, hbd] + exact mem_singleton_iff.mp hxv ▸ hvF + rw [frontier_eq_closure_inter_closure] at hxf + simpa only [compl_eq_univ_sdiff] using hxf.2 + · exact subset_closure ⟨mem_univ _, hxD⟩ + have hΓeq := interSet_eq_self_of_U_subset isClosed_closure hΓX + obtain ⟨u, hu, _⟩ := hK.2.1.2.2.1 r hr + refine ⟨K, ?_, Drawing.IsSubdrawing.refl K, u, hu.1, hu.2⟩ + rw [hΓeq] + exact hK + · obtain ⟨C, hC, hCK, hlen, _, _, hout, hCZ, hmeet⟩ := hcircle + obtain ⟨hDC, hbdC, _⟩ := hd C hC hCK (by omega) + obtain ⟨u, e, f, hu, hef, hCE, he, hf⟩ := + two_spokes_of_radial_boundary hK.2.1 hCK hlen hr hCZ hmeet + obtain ⟨hCV, hCU⟩ := two_spoke_circuit_point_sets hC hCK hCE he hf + have hfrontC : frontier (ins C) = C.U := (subBd_eq_frontier _).symm.trans hbdC + have hΓeq : Γ.interSet (closure (univ \ D)) = Γ.interSet (closure (univ \ ins C)) := by + have hHG : (Γ.interSet (closure (univ \ D))).toHypergraph = + (Γ.interSet (closure (univ \ ins C))).toHypergraph := by + rw [interSet_toHypergraph Γ isClosed_closure, interSet_toHypergraph Γ isClosed_closure] + exact hout + exact Drawing.ext_of_V_E (congrArg Hypergraph.vertexSet hHG) (congrArg Hypergraph.edgeSet hHG) + have hRad := radialDiscDeletion_isRadial hS hK hCK hDC hfrontC hCE hCV hef hCU hCZ + he hf hmeet hr hv hu.1 hu.2 + have huNew : u ∈ (radialDiscDeletion K (ins C) f).V := by + have huf : u ∈ frontier (ins C) := hfrontC.symm ▸ C.V_subset_U (hCV.symm ▸ Or.inr rfl) + rw [frontier_eq_closure_inter_closure] at huf + rw [radialDiscDeletion_V] + exact ⟨hu.2, by simpa only [compl_eq_univ_sdiff] using huf.2⟩ + refine ⟨radialDiscDeletion K (ins C) f, ?_, radialDiscDeletion_isSubdrawing K (ins C) f, + u, hu.1, huNew⟩ + rw [hΓeq] + exact hRad + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72RadialHubs.lean b/LeanPool/GraphMinor/GM12/Section72RadialHubs.lean new file mode 100644 index 0000000000..4cf91c8f74 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72RadialHubs.lean @@ -0,0 +1,142 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72RadialDeletion +public import LeanPool.GraphMinor.GM12.Section72Regions +import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.GM12.Section76 +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.Section87 + +/-! +# Region hubs after the radial deletion in XII (7.2) + +The merged region retains the old hub on the two-spoke boundary. +Any retained radial vertex in the removed disc lies on its boundary, +whose only vertices are the old vertex and that hub. Every other +region of the reduced drawing is an old region. Its old hub remains +outside the removed disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +/-- A radial vertex on the disc frontier survives radial disc deletion. -/ +theorem radialDiscDeletion_mem_vertexSet_of_mem_frontier {K : Drawing S} {D f : Set S} {u : S} + (huD : u ∈ frontier D) (huK : u ∈ K.V) : u ∈ (radialDiscDeletion K D f).V := by + rw [frontier_eq_closure_inter_closure] at huD + rw [radialDiscDeletion_V] + exact ⟨huK, by simpa only [compl_eq_univ_sdiff] using huD.2⟩ + +/-- The merged region in XII (7.2), page 260, retains precisely the +old hub after deleting the interior radial pieces and one spoke. -/ +theorem radialDiscDeletion_merged_hub {Γ K C : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + (hC : C.IsSubdrawing K) {D r f : Set S} {v u : S} + (hb : frontier D = C.U) (hCV : C.V = {v, u}) + (hr : r ∈ Γ.R) (hur : u ∈ r) (huK : u ∈ K.V) : + ∃! w, w ∈ r ∪ (D \ {v}) ∧ w ∈ (radialDiscDeletion K D f).V := by + have huC : u ∈ C.U := C.V_subset_U (hCV.symm ▸ Or.inr rfl) + refine ⟨u, ⟨Or.inl hur, radialDiscDeletion_mem_vertexSet_of_mem_frontier + (hb.symm ▸ huC) huK⟩, ?_⟩ + rintro w ⟨hwY, hwK'⟩ + obtain ⟨hwK, hwOut⟩ := (radialDiscDeletion_V K D f).subset hwK' + rcases hwY with hwr | ⟨hwD, hwv⟩ + · exact (hK.2.2.1 r hr).unique ⟨hwr, hwK⟩ ⟨hur, huK⟩ + · have hwfront : w ∈ frontier D := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure hwD, by simpa only [compl_eq_univ_sdiff] using hwOut⟩ + have hwCV : w ∈ C.V := mem_V_of_mem_U' hC (hb ▸ hwfront) hwK + rcases hCV.subset hwCV with hwv' | hwu + · exact (hwv hwv').elim + · exact hwu + +omit [T2Space S] in +/-- If the deleted drawing points are all in one new region, every +other new region is an old region. This is the region classification +used in XII (7.2), page 260. -/ +theorem region_mem_of_ne_merged_region {Γ Γ' : Drawing S} + (hΓ : Γ'.IsSubdrawing Γ) {Y s : Set S} (hY : Y ∈ Γ'.R) + (hcover : Γ.U ⊆ Γ'.U ∪ Y) (hs : s ∈ Γ'.R) (hsY : s ≠ Y) : s ∈ Γ.R := by + have hoff : s ⊆ univ \ Γ.U := by + intro x hx + refine ⟨mem_univ _, fun hxΓ => ?_⟩ + rcases hcover hxΓ with hxΓ' | hxY + · exact region_subset hs hx hxΓ' + · exact hsY (region_eq_of_mem hs hY hx hxY) + obtain ⟨x, hx⟩ := region_nonempty hs + let R := connectedComponentIn (univ \ Γ.U) x + have hR : R ∈ Γ.R := (mem_R_iff Γ).mpr ⟨x, (hoff hx).2, rfl⟩ + have hxR : x ∈ R := mem_connectedComponentIn (hoff hx) + have hsR : s ⊆ R := (region_isPreconnected hs).subset_connectedComponentIn hx hoff + have hRs : R ⊆ s := region_subset_region_of_inter_nonempty hΓ hR hs ⟨x, hxR, hx⟩ + exact (Subset.antisymm hsR hRs).symm ▸ hR + +/-- A normal disc meeting the drawing at one boundary vertex and enclosing part of its incident +region determines the merged region and covers the removed drawing points. -/ +theorem radialDiscDeletion_region_facts (hS : IsClosedSurface S) + {Γ C : Drawing S} {D r : Set S} {v : S} + (hD : IsClosedDisc D) (hb : frontier D = C.U) (hr : r ∈ Γ.R) (hv : v ∈ Γ.V) + (hCZ : C.U ⊆ r ∪ {v}) (hmeet : Γ.U ∩ C.U = {v}) : + let Γ' := Γ.interSet (closure (univ \ D)) + let Y := r ∪ (D \ {v}) + (PaintingOrDrawing.drawing Γ).IsNormal C.U ∧ v ∈ C.U ∧ C.U ∩ Γ.V = {v} ∧ + C.U \ {v} ⊆ r ∧ Y ∈ Γ'.R ∧ Γ.U ⊆ Γ'.U ∪ Y := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hn : (PaintingOrDrawing.drawing Γ).IsNormal C.U := by + rintro x ⟨hxC, hxΓ⟩ + exact mem_singleton_iff.mp (hmeet.subset ⟨hxΓ, hxC⟩) ▸ hv + have hvC : v ∈ C.U := (hmeet.superset (mem_singleton v)).2 + have hFV : C.U ∩ Γ.V = {v} := by + refine Subset.antisymm (fun _ hx => hmeet.subset ⟨Γ.V_subset_U hx.2, hx.1⟩) ?_ + exact singleton_subset_iff.mpr ⟨hvC, hv⟩ + have hFr : C.U \ {v} ⊆ r := fun x hx => (hCZ hx.1).resolve_right hx.2 + have hbd : subBd D = C.U := (subBd_eq_frontier D).trans hb + exact ⟨hn, hvC, hFV, hFr, theorem_7_2_region hS hD hbd hn hFV hr hFr, + (drawing_U_subset_outside_normal_disc_union hb hn hvC).trans + (union_subset_union subset_rfl subset_union_right)⟩ + +/-- Every region retains exactly one hub in the radial deletion of +XII (7.2), page 260. The merged region keeps its boundary hub, and +all other regions keep their original hubs outside the removed disc. -/ +theorem radialDiscDeletion_region_hubs (hS : IsClosedSurface S) + {Γ K C : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + (hC : C.IsSubdrawing K) {D r f : Set S} {v u : S} + (hD : IsClosedDisc D) (hb : frontier D = C.U) (hCV : C.V = {v, u}) + (hr : r ∈ Γ.R) (hv : v ∈ Γ.V) (hur : u ∈ r) (huK : u ∈ K.V) + (hCZ : C.U ⊆ r ∪ {v}) (hmeet : Γ.U ∩ C.U = {v}) : + ∀ s ∈ (Γ.interSet (closure (univ \ D))).R, + ∃! w, w ∈ s ∧ w ∈ (radialDiscDeletion K D f).V := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let Γ' := Γ.interSet (closure (univ \ D)) + let Y := r ∪ (D \ {v}) + obtain ⟨_, _, _, _, hY, hcover⟩ := radialDiscDeletion_region_facts hS hD hb hr hv hCZ hmeet + intro s hs + by_cases hsY : s = Y + · subst s + exact radialDiscDeletion_merged_hub hK hC hb hCV hr hur huK + · have hsOld := region_mem_of_ne_merged_region + (Drawing.span_isSubdrawing Γ _ _) hY hcover hs hsY + obtain ⟨w, hw, huniq⟩ := hK.2.2.1 s hsOld + have hwD : w ∉ D := by + intro hwD + have hwv : w ≠ v := fun hwv => region_subset hsOld (hwv ▸ hw.1) (Γ.V_subset_U hv) + exact hsY (region_eq_of_mem hs hY hw.1 (Or.inr ⟨hwD, hwv⟩)) + have hwOut : w ∈ closure (univ \ D) := subset_closure ⟨mem_univ _, hwD⟩ + refine ⟨w, ⟨hw.1, (radialDiscDeletion_V K D f).symm ▸ ⟨hw.2, hwOut⟩⟩, ?_⟩ + rintro z ⟨hzs, hzK⟩ + exact huniq z ⟨hzs, ((radialDiscDeletion_V K D f).subset hzK).1⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72Regions.lean b/LeanPool/GraphMinor/GM12/Section72Regions.lean new file mode 100644 index 0000000000..ec40c3b956 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72Regions.lean @@ -0,0 +1,199 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72Tangle +import LeanPool.GraphMinor.GM12.Section1 +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.GM11.PaintingCells +import LeanPool.GraphMinor.GM11.Section64 + +/-! +# The merged region in Graph Minors XII, (7.2) + +The outside restriction keeps precisely the points of the original drawing +outside the disc interior. Its new region is the union of the old region +with the disc minus the one boundary vertex. The proofs use connectedness +of edges and of the punctured disc, and the boundaries of the two regions. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- The point set of a drawing restricted to a closed set with normal frontier +is its intersection with that set. In XII (7.2), the set is the outside disc. -/ +theorem interSet_U_eq_of_normal_frontier {Γ : Drawing S} {X : Set S} + (hX : IsClosed X) (hn : frontier X ∩ Γ.U ⊆ Γ.V) : + (Γ.interSet X).U = Γ.U ∩ X := by + apply Subset.antisymm + · exact subset_inter (Drawing.span_isSubdrawing Γ _ _).U_subset (interSet_U_subset hX) + · rintro x ⟨hxU, hxX⟩ + by_cases hxV : x ∈ Γ.V + · exact (Γ.interSet X).V_subset_U (mem_interSet_V hxV hxX) + · obtain ⟨e, he, hxe⟩ := Γ.exists_edge_of_mem hxU hxV + have hd : Disjoint e (frontier X) := by + refine disjoint_left.mpr fun y hy hf => ?_ + exact (he.2.1 hy).2 (hn ⟨hf, (he.2.1 hy).1⟩) + have heX : e ⊆ X := + subset_of_disjoint_frontier he.2.2.1.isConnected.isPreconnected hX hd hxe hxX + exact ((mem_interSet_E_iff.mpr ⟨he, heX⟩).2.1 hxe).1 + +/-- Restricting a drawing to the outside of a normal disc keeps its points outside the interior. -/ +theorem outside_normal_disc_drawing_U {Γ : Drawing S} {Δ F : Set S} + (hF : frontier Δ = F) (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) : + (Γ.interSet (closure (univ \ Δ))).U = Γ.U ∩ closure (univ \ Δ) := by + apply interSet_U_eq_of_normal_frontier isClosed_closure + rw [← compl_eq_univ_sdiff, closure_compl, frontier_compl] + exact fun x hx => hn ⟨hF ▸ frontier_interior_subset hx.1, hx.2⟩ + +/-- The drawing outside a normal disc meets the disc only at its sole boundary vertex. -/ +theorem outside_normal_disc_drawing_inter_subset {Γ : Drawing S} {Δ F : Set S} {v : S} + (hF : frontier Δ = F) (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) + (hv : F ∩ Γ.V = {v}) : + (Γ.interSet (closure (univ \ Δ))).U ∩ Δ ⊆ {v} := by + rw [outside_normal_disc_drawing_U hF hn] + rintro x ⟨⟨hxU, hxOut⟩, hxΔ⟩ + have hxF : x ∈ F := by + rw [← hF, frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] + exact ⟨subset_closure hxΔ, hxOut⟩ + exact hv ▸ ⟨hxF, hn ⟨hxF, hxU⟩⟩ + +/-- The outside drawing and the punctured disc cover the original drawing when the puncture +lies on the disc frontier. -/ +theorem drawing_U_subset_outside_normal_disc_union {Γ : Drawing S} {Δ F : Set S} {v : S} + (hF : frontier Δ = F) (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) + (hv : v ∈ F) : + Γ.U ⊆ (Γ.interSet (closure (univ \ Δ))).U ∪ (Δ \ {v}) := by + rw [outside_normal_disc_drawing_U hF hn, ← compl_eq_univ_sdiff, closure_compl] + intro x hx + by_cases hxi : x ∈ interior Δ + · exact Or.inr ⟨interior_subset hxi, fun hxv => + (hF.symm ▸ hv).2 (mem_singleton_iff.mp hxv ▸ hxi)⟩ + · exact Or.inl ⟨hx, hxi⟩ + +omit [T2Space S] in +private theorem frontier_region_subset_drawing [LocallyConnectedSpace S] + {Γ : Drawing S} {r : Set S} (hr : r ∈ Γ.R) : frontier r ⊆ Γ.U := by + intro x hx + by_contra hxU + have hx_compl : x ∈ univ \ Γ.U := ⟨mem_univ x, hxU⟩ + have hopen : IsOpen (connectedComponentIn (univ \ Γ.U) x) := + IsOpen.connectedComponentIn (isOpen_univ.sdiff Γ.isClosed_U) + obtain ⟨y, hy_cc, hy_r⟩ := mem_closure_iff.mp hx.1 _ hopen (mem_connectedComponentIn hx_compl) + have hr' : connectedComponentIn (univ \ Γ.U) x ∈ Γ.R := + (mem_R_iff Γ).mpr ⟨x, hxU, rfl⟩ + have heq : connectedComponentIn (univ \ Γ.U) x = r := + region_eq_of_mem hr' hr hy_cc hy_r + have hxr : x ∈ r := heq ▸ mem_connectedComponentIn hx_compl + exact hx.2 ((region_isOpen hr).interior_eq.symm ▸ hxr) + +omit [T2Space S] in +/-- A disc with one boundary point removed is preconnected. This is the +connected part of the merged-region assertion in XII (7.2), page 260. -/ +theorem disc_sdiff_boundary_point_isPreconnected {Δ : Set S} (hΔ : IsClosedDisc Δ) + {v : S} (hv : v ∈ discBd Δ) : IsPreconnected (Δ \ {v}) := by + refine hΔ.isPreconnected_discInt.subset_closure ?_ + (sdiff_subset.trans hΔ.subset_closure_discInt) + rintro x ⟨hx, hxb⟩ + exact ⟨hx, fun h => hxb (mem_singleton_iff.mp h ▸ hv)⟩ + +/-- Removing a normal disc through one vertex merges its punctured disc with +the region containing the rest of its boundary, as in XII (7.2), page 260. -/ +theorem theorem_7_2_region (hS : IsClosedSurface S) + {Γ : Drawing S} {Δ F r : Set S} {v : S} + (hΔ : IsClosedDisc Δ) (hbd : subBd Δ = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) + (hFV : F ∩ Γ.V = {v}) (hr : r ∈ Γ.R) (hFr : F \ {v} ⊆ r) : + r ∪ (Δ \ {v}) ∈ (Γ.interSet (closure (univ \ Δ))).R := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hclosed : IsClosed Δ := hΔ.isClosed + have hfr : frontier Δ = F := (subBd_eq_frontier Δ).symm.trans hbd + have hdb : discBd Δ = F := (IsClosedDisc.frontier_eq_discBd hS hΔ).symm.trans hfr + have hvFV : v ∈ F ∩ Γ.V := hFV.symm ▸ mem_singleton v + have hvb : v ∈ discBd Δ := hdb.symm ▸ hvFV.1 + have hX : closure (univ \ Δ) = (interior Δ)ᶜ := by + rw [← compl_eq_univ_sdiff, closure_compl] + have hU := outside_normal_disc_drawing_U hfr hn + let Γ' := Γ.interSet (closure (univ \ Δ)) + let Y := r ∪ (Δ \ {v}) + have hYeq : Y = r ∪ interior Δ := by + apply Subset.antisymm + · rintro x (hx | ⟨hxΔ, hxv⟩) + · exact Or.inl hx + · by_cases hxi : x ∈ interior Δ + · exact Or.inr hxi + · exact Or.inl (hFr ⟨hfr ▸ ⟨subset_closure hxΔ, hxi⟩, hxv⟩) + · rintro x (hx | hxi) + · exact Or.inl hx + · exact Or.inr ⟨interior_subset hxi, fun hxv => + (show v ∉ interior Δ from fun h => (hfr.symm ▸ hvFV.1).2 h) + (mem_singleton_iff.mp hxv ▸ hxi)⟩ + have hYo : IsOpen Y := hYeq ▸ (region_isOpen hr).union isOpen_interior + have hYoff : Y ⊆ univ \ Γ'.U := by + rintro x (hxr | ⟨hxΔ, hxv⟩) + · exact ⟨mem_univ x, fun hx => region_subset hr hxr ((Drawing.span_isSubdrawing Γ _ _).U_subset + hx)⟩ + · refine ⟨mem_univ x, fun hx => ?_⟩ + rw [hU] at hx + have hxfr : x ∈ frontier Δ := by + rw [frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] + exact ⟨subset_closure hxΔ, hx.2⟩ + have hxF : x ∈ F := hfr ▸ hxfr + exact hxv (hFV ▸ ⟨hxF, hn ⟨hxF, hx.1⟩⟩) + obtain ⟨w, hwF, hwv⟩ := (infinite_of_isOArc hΔ.isOArc_discBd).exists_notMem_finite + (finite_singleton v) + have hwr : w ∈ r := hFr ⟨hdb ▸ hwF, hwv⟩ + have hwD : w ∈ Δ \ {v} := ⟨Surface.discBd_subset Δ hwF, hwv⟩ + have hYconn : IsPreconnected Y := + (region_isPreconnected hr).union w hwr hwD (disc_sdiff_boundary_point_isPreconnected hΔ hvb) + have hYfr : frontier Y ⊆ Γ'.U := by + intro x hx + have hxnot : x ∉ Y := fun hy => hx.2 (hYo.interior_eq.symm ▸ hy) + have hxnotr : x ∉ r := fun h => hxnot (Or.inl h) + have hxnoti : x ∉ interior Δ := fun h => hxnot (hYeq.symm ▸ Or.inr h) + have hxold : x ∈ Γ.U := by + rw [hYeq] at hx + rcases frontier_union_subset r (interior Δ) hx with ⟨hxr, _⟩ | ⟨_, hxi⟩ + · exact frontier_region_subset_drawing hr hxr + · have hxF : x ∈ F := hfr ▸ frontier_interior_subset hxi + by_cases hxv : x ∈ ({v} : Set S) + · exact Γ.V_subset_U (mem_singleton_iff.mp hxv ▸ hvFV.2) + · exact (hxnotr (hFr ⟨hxF, hxv⟩)).elim + change x ∈ (Γ.interSet (closure (univ \ Δ))).U + rw [hU, hX] + exact ⟨hxold, hxnoti⟩ + have hwY : w ∈ Y := Or.inl hwr + let C := connectedComponentIn (univ \ Γ'.U) w + have hYC : Y ⊆ C := hYconn.subset_connectedComponentIn hwY hYoff + have hCY : C ⊆ Y := by + have hcover : C ⊆ Y ∪ (closure Y)ᶜ := by + intro x hxC + by_cases hxcl : x ∈ closure Y + · refine Or.inl ?_ + by_contra hxY + have hxfr : x ∈ frontier Y := ⟨hxcl, fun h => hxY (interior_subset h)⟩ + exact (connectedComponentIn_subset (univ \ Γ'.U) w hxC).2 (hYfr hxfr) + · exact Or.inr hxcl + exact isPreconnected_connectedComponentIn.subset_left_of_subset_union hYo + isClosed_closure.isOpen_compl + (disjoint_left.mpr fun x hx hxcl => hxcl (subset_closure hx)) hcover + ⟨w, mem_connectedComponentIn (hYoff hwY), hwY⟩ + have hCreg : C ∈ Γ'.R := (mem_R_iff Γ').mpr ⟨w, (hYoff hwY).2, rfl⟩ + change Y ∈ Γ'.R + rw [← Subset.antisymm hCY hYC] + exact hCreg + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72RespectAway.lean b/LeanPool/GraphMinor/GM12/Section72RespectAway.lean new file mode 100644 index 0000000000..26d014ace9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72RespectAway.lean @@ -0,0 +1,172 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72PushAway +public import LeanPool.GraphMinor.GM12.Section77 + +/-! +# Respectfulness for circles missing the vertex in XII (7.2) + +Divert a circle off the removed disc by a homeomorphism fixing the +outside drawing. The diverted circle is normal for the old drawing +and meets exactly the same vertices. Respectfulness gives its inside +disc. Pull that disc back. Since the outside drawing is fixed, its +separation is unchanged and belongs to the restricted tangle. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- Pulling a set back by a homeomorphism fixing the drawing preserves its intersection hypergraph. +-/ +theorem inter_preimage_of_fixed {Γ : Drawing S} (h : S ≃ₜ S) + (hfix : ∀ x ∈ Γ.U, h x = x) (E : Set S) : + (PaintingOrDrawing.drawing Γ).inter (h ⁻¹' E) = (PaintingOrDrawing.drawing Γ).inter E := by + have hV : ∀ x ∈ Γ.V, h x = x := fun x hx => hfix x (Γ.V_subset_U hx) + have hE : ∀ e ∈ Γ.E, ∀ x ∈ e, h x = x := fun e he x hx => hfix x (he.2.1 hx).1 + have heq : ∀ e ∈ Γ.E, e ⊆ h ⁻¹' E ↔ e ⊆ E := by + intro e he + constructor + · intro hs x hx + have hh := hs hx + change h x ∈ E at hh + rwa [hE e he x hx] at hh + · intro hs x hx + change h x ∈ E + rw [hE e he x hx] + exact hs hx + apply Hypergraph.ext + · ext x + change (x ∈ Γ.V ∧ h x ∈ E) ↔ x ∈ Γ.V ∧ x ∈ E + exact ⟨fun hx => ⟨hx.1, hV x hx.1 ▸ hx.2⟩, + fun hx => ⟨hx.1, (hV x hx.1).symm ▸ hx.2⟩⟩ + · ext e + change (e ∈ Γ.E ∧ e ⊆ h ⁻¹' E) ↔ e ∈ Γ.E ∧ e ⊆ E + exact ⟨fun hx => ⟨hx.1, (heq e hx.1).mp hx.2⟩, + fun hx => ⟨hx.1, (heq e hx.1).mpr hx.2⟩⟩ + · funext e x + apply propext + change (Γ.toHypergraph.Inc e x ∧ e ⊆ h ⁻¹' E ∧ h x ∈ E) ↔ + Γ.toHypergraph.Inc e x ∧ e ⊆ E ∧ x ∈ E + constructor + · rintro ⟨hi, he, hx⟩ + exact ⟨hi, (heq e hi.1).mp he, hV x hi.2.1 ▸ hx⟩ + · rintro ⟨hi, he, hx⟩ + exact ⟨hi, (heq e hi.1).mpr he, (hV x hi.2.1).symm ▸ hx⟩ + +omit [T2Space S] in +/-- Pulling a set back by a homeomorphism fixing the drawing preserves its outside intersection. -/ +theorem interOutside_preimage_of_fixed {Γ : Drawing S} (h : S ≃ₜ S) + (hfix : ∀ x ∈ Γ.U, h x = x) (E : Set S) : + (PaintingOrDrawing.drawing Γ).interOutside (h ⁻¹' E) = + (PaintingOrDrawing.drawing Γ).interOutside E := by + have heq : univ \ (h ⁻¹' E) = h ⁻¹' (univ \ E) := by ext x; simp + unfold PaintingOrDrawing.interOutside + rw [heq, ← h.preimage_closure, inter_preimage_of_fixed h hfix] + +omit [T2Space S] in +/-- Pull a selected disc back along a diversion that fixes the smaller drawing and sends every +point of the circle in the old drawing into the smaller drawing. -/ +theorem respectful_disc_of_diversion (hS : IsClosedSurface S) + {Γ Γ' : Drawing S} (hsub : Γ'.IsSubdrawing Γ) {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + {C : Set S} (hC : IsOArc C) + (hCn : (PaintingOrDrawing.drawing Γ').IsNormal C) (hcard : (C ∩ Γ'.V).ncard < θ) + (h : S ≃ₜ S) (hfix : ∀ x ∈ Γ'.U, h x = x) + (holdU : ∀ {x}, x ∈ h '' C → x ∈ Γ.U → x ∈ Γ'.U) : + ∃ E : Set S, IsClosedDisc E ∧ subBd E = C ∧ + ((PaintingOrDrawing.drawing Γ').inter E, (PaintingOrDrawing.drawing Γ').interOutside E) ∈ + restrictTangle T Γ'.toHypergraph := by + have hCnormal : (PaintingOrDrawing.drawing Γ).IsNormal (h '' C) := by + rintro x ⟨hxC, hxU⟩ + have hxU' := holdU hxC hxU + obtain ⟨y, hy, hyx⟩ := hxC + have hyx' : y = x := h.injective (hyx.trans (hfix x hxU').symm) + exact hsub.1 (hCn ⟨hyx' ▸ hy, hxU'⟩) + have hverts : (h '' C) ∩ Γ.V = C ∩ Γ'.V := by + ext x + constructor + · rintro ⟨hxC, hxV⟩ + have hxU' := holdU hxC (Γ.V_subset_U hxV) + obtain ⟨y, hy, hyx⟩ := hxC + have hyx' : y = x := h.injective (hyx.trans (hfix x hxU').symm) + exact ⟨hyx' ▸ hy, hCn ⟨hyx' ▸ hy, hxU'⟩⟩ + · rintro ⟨hxC, hxV⟩ + exact ⟨⟨x, hxC, hfix x (Γ'.V_subset_U hxV)⟩, hsub.1 hxV⟩ + have hCO : IsOArc (h '' C) := + hC.image h.continuous.continuousOn h.symm.continuous.continuousOn (fun x _ + => h.symm_apply_apply x) + obtain ⟨D, hD, hDb, hm⟩ := hrespect.2 (h '' C) hCO hCnormal (hverts.symm ▸ hcard) + have hm' : ((PaintingOrDrawing.drawing Γ').inter D, + (PaintingOrDrawing.drawing Γ').interOutside D) ∈ restrictTangle T Γ'.toHypergraph := by + have hmem : (((PaintingOrDrawing.drawing Γ).inter D) ∩ Γ'.toHypergraph, + ((PaintingOrDrawing.drawing Γ).interOutside D) ∩ Γ'.toHypergraph) ∈ + restrictTangle T Γ'.toHypergraph := ⟨_, _, hm, rfl⟩ + rwa [drawing_inter_inter_subdrawing hsub, drawing_interOutside_inter_subdrawing hsub] at hmem + obtain ⟨hE, hbE⟩ := hD.image h.symm.continuous.continuousOn h.continuous.continuousOn + (fun x _ => h.apply_symm_apply x) + have hpre : h.symm '' D = h ⁻¹' D := by + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + simpa only [mem_preimage, h.apply_symm_apply] using hy + · intro hx + exact ⟨h x, hx, h.symm_apply_apply x⟩ + have hb : subBd (h ⁻¹' D) = C := by + rw [← hpre, subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hS hE, hbE, + ← IsClosedDisc.frontier_eq_discBd hS hD, ← subBd_eq_frontier, hDb] + rw [image_image] + have heq : (fun x => h.symm (h x)) = id := funext h.symm_apply_apply + rw [heq, image_id] + refine ⟨h ⁻¹' D, hpre ▸ hE, hb, ?_⟩ + rw [inter_preimage_of_fixed h hfix, interOutside_preimage_of_fixed h hfix] + exact hm' + +/-- The respectfulness assertion in the diversion step of XII (7.2), page +260, for a normal circle that does not pass through the boundary vertex. -/ +theorem theorem_7_2_respectful_of_notMem (hS : IsClosedSurface S) + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + {Δ F C : Set S} {v : S} (hΔ : IsClosedDisc Δ) (hbd : subBd Δ = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) (hFV : F ∩ Γ.V = {v}) + (hC : IsOArc C) + (hCn : (PaintingOrDrawing.drawing (Γ.interSet (closure (univ \ Δ)))).IsNormal C) + (hcard : (C ∩ (Γ.interSet (closure (univ \ Δ))).V).ncard < θ) + (hvn : v ∉ C) : + ∃ E : Set S, IsClosedDisc E ∧ subBd E = C ∧ + ((PaintingOrDrawing.drawing (Γ.interSet (closure (univ \ Δ)))).inter E, + (PaintingOrDrawing.drawing (Γ.interSet (closure (univ \ Δ)))).interOutside E) ∈ + restrictTangle T (Γ.interSet (closure (univ \ Δ))).toHypergraph := by + let Γ' := Γ.interSet (closure (univ \ Δ)) + have hsub : Γ'.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hfr : frontier Δ = F := (subBd_eq_frontier Δ).symm.trans hbd + have hdb : discBd Δ = F := (IsClosedDisc.frontier_eq_discBd hS hΔ).symm.trans hfr + have hvFV : v ∈ F ∩ Γ.V := hFV.symm ▸ mem_singleton v + have hvb : v ∈ discBd Δ := hdb.symm ▸ hvFV.1 + have hUeq := outside_normal_disc_drawing_U hfr hn + have hGD : Γ'.U ∩ Δ ⊆ {v} := outside_normal_disc_drawing_inter_subset hfr hn hFV + obtain ⟨h, hfix, hpush⟩ := theorem_7_2_push_away_of_notMem hS hΔ hvb Γ'.isClosed_U hGD hC hvn + have holdU : ∀ {x}, x ∈ h '' C → x ∈ Γ.U → x ∈ Γ'.U := by + intro x hxC hxU + have hxD : x ∉ Δ := disjoint_left.mp hpush hxC + exact hUeq.symm ▸ ⟨hxU, subset_closure ⟨mem_univ x, hxD⟩⟩ + exact respectful_disc_of_diversion hS hsub hrespect hC hCn hcard h hfix holdU + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72Respectful.lean b/LeanPool/GraphMinor/GM12/Section72Respectful.lean new file mode 100644 index 0000000000..4f29ce311c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72Respectful.lean @@ -0,0 +1,116 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72RespectAway +public import LeanPool.GraphMinor.GM12.Section72TwoCell +import LeanPool.GraphMinor.GM12.Section72Divert +import LeanPool.GraphMinor.GM12.Section79 +import LeanPool.GraphMinor.GM11.RadialFacts +import LeanPool.GraphMinor.GM11.RadialExists + +/-! +# Respectfulness of the restricted tangle in XII (7.2) + +Divert every normal circle off the selected disc except at its boundary +vertex, fixing the outside drawing. The diverted circle has precisely +the same vertices and is normal in the original drawing. Pull the +selected inside disc back along the diversion. This follows the +respectfulness paragraph of XII (7.2), page 260, including the case +of a circle through the boundary vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- The selected-disc assertion after the diversion in XII (7.2), page 260. +The boundary vertex is not isolated in the outside drawing. -/ +theorem theorem_7_2_respectful_of_incident (hS : IsClosedSurface S) + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + {Δ F C : Set S} {v : S} (hΔ : IsClosedDisc Δ) (hbd : subBd Δ = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) (hFV : F ∩ Γ.V = {v}) + (hC : IsOArc C) + (hCn : (PaintingOrDrawing.drawing (Γ.interSet (closure (univ \ Δ)))).IsNormal C) + (hcard : (C ∩ (Γ.interSet (closure (univ \ Δ))).V).ncard < θ) + (hincident : ∃ e ∈ (Γ.interSet (closure (univ \ Δ))).E, v ∈ closure e) : + ∃ E : Set S, IsClosedDisc E ∧ subBd E = C ∧ + ((PaintingOrDrawing.drawing (Γ.interSet (closure (univ \ Δ)))).inter E, + (PaintingOrDrawing.drawing (Γ.interSet (closure (univ \ Δ)))).interOutside E) ∈ + restrictTangle T (Γ.interSet (closure (univ \ Δ))).toHypergraph := by + let Γ' := Γ.interSet (closure (univ \ Δ)) + have hsub : Γ'.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hfr : frontier Δ = F := (subBd_eq_frontier Δ).symm.trans hbd + have hdb : discBd Δ = F := (IsClosedDisc.frontier_eq_discBd hS hΔ).symm.trans hfr + have hvFV : v ∈ F ∩ Γ.V := hFV.symm ▸ mem_singleton v + have hvb : v ∈ discBd Δ := hdb.symm ▸ hvFV.1 + have hUeq := outside_normal_disc_drawing_U hfr hn + have hGD : Γ'.U ∩ Δ ⊆ {v} := outside_normal_disc_drawing_inter_subset hfr hn hFV + have hvnew : v ∈ Γ'.V := (mem_interSet_V_iff isClosed_closure).mpr + ⟨hvFV.2, by + have hvfr : v ∈ frontier Δ := hfr.symm ▸ hvFV.1 + rw [frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] at hvfr + exact hvfr.2⟩ + obtain ⟨h, hfix, hpush⟩ := theorem_7_2_divert hS hΔ hvb hvnew hGD hC hCn hincident + have holdU : ∀ {x}, x ∈ h '' C → x ∈ Γ.U → x ∈ Γ'.U := by + intro x hxC hxU + by_cases hxD : x ∈ Δ + · have hxv : x = v := mem_singleton_iff.mp (hpush ⟨hxC, hxD⟩) + exact hxv.symm ▸ Γ'.V_subset_U hvnew + · exact hUeq.symm ▸ ⟨hxU, subset_closure ⟨mem_univ x, hxD⟩⟩ + exact respectful_disc_of_diversion hS hsub hrespect hC hCn hcard h hfix holdU + + +/-- The respectful-tangle assertion of XII (7.2), pages 259–260. The +outside drawing is two-cell. Its tangle is the order-one restriction, +and every normal circle has the selected disc supplied by diversion. -/ +theorem theorem_7_2_respectful (hS : IsClosedSurface S) [ConnectedSpace S] + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hθ : 2 ≤ θ) (hd : HasTangleMetric Γ θ T d) + {Δ F r : Set S} {v : S} (hΔ : IsClosedDisc Δ) (hbd : subBd Δ = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) (hFV : F ∩ Γ.V = {v}) + (hr : r ∈ Γ.R) (hFr : F \ {v} ⊆ r) + (hm : ((PaintingOrDrawing.drawing Γ).inter Δ, + (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T) : + IsRespectfulDrawingTangle (Γ.interSet (closure (univ \ Δ))) θ + (restrictTangle T (Γ.interSet (closure (univ \ Δ))).toHypergraph) := by + let Γ' := Γ.interSet (closure (univ \ Δ)) + have ht : IsTangle Γ'.toHypergraph θ (restrictTangle T Γ'.toHypergraph) := by + change IsTangle (Γ.interSet (closure (univ \ Δ))).toHypergraph θ + (restrictTangle T (Γ.interSet (closure (univ \ Δ))).toHypergraph) + rw [interSet_toHypergraph Γ isClosed_closure] + exact theorem_7_1_proof hd.1.2.1 hm (separationOrder_inter_eq_one hΔ.isClosed hbd hFV) + have htwo := theorem_7_2_twoCell hS hd.1.1 hΔ hbd hn hFV hr hFr + have hE : Γ'.E.Nonempty := edgeSet_nonempty_of_isTangle_of_two_le ht hθ + obtain ⟨K, hK⟩ := GM11.exists_radialDrawing hS htwo + have hrf := GM11.regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hE + have hvOld : v ∈ Γ.V := (hFV.symm ▸ mem_singleton v : v ∈ F ∩ Γ.V).2 + have hvNew : v ∈ Γ'.V := by + apply (mem_interSet_V_iff isClosed_closure).mpr + refine ⟨hvOld, ?_⟩ + have hvfr : v ∈ frontier Δ := by + rw [← subBd_eq_frontier, hbd] + exact (hFV.symm ▸ mem_singleton v : v ∈ F ∩ Γ.V).1 + rw [frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] at hvfr + exact hvfr.2 + have hincident := GM11.exists_edge_of_regionFacts hS hrf hvNew + refine ⟨htwo, ht, inferInstance, ?_⟩ + intro C hC hCn hcard + exact theorem_7_2_respectful_of_incident hS hd.1.2.2 hΔ hbd hn hFV hC hCn hcard hincident + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72RetainedBoundary.lean b/LeanPool/GraphMinor/GM12/Section72RetainedBoundary.lean new file mode 100644 index 0000000000..8d32c73bf1 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72RetainedBoundary.lean @@ -0,0 +1,122 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72RadialDeletion +import LeanPool.GraphMinor.GM11.RadialCorners +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# The fixed boundary of the radial deletion + +For the maximality argument in XII (7.2), page 260, the reduced old +drawing meets the removed disc only at the boundary vertex. The +retained radial drawing meets it in the retained boundary spoke. +These facts let the disc-pushing map fix both retained drawings. +An old radial edge with an end outside the disc also survives. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +/-- A boundary spoke different from the deleted spoke survives. -/ +theorem boundary_spoke_retained {K C : Drawing S} (hC : C.IsSubdrawing K) + {D e f : Set S} (hb : frontier D = C.U) (he : e ∈ C.E) (hef : e ≠ f) : + e ∈ (radialDiscDeletion K D f).E := by + rw [radialDiscDeletion_E] + refine ⟨hC.2 he, ?_, hef⟩ + intro y hy + have hybd : y ∈ frontier D := hb.symm ▸ (he.2.1 hy).1 + rw [frontier_eq_closure_inter_closure] at hybd + simpa only [compl_eq_univ_sdiff] using hybd.2 + +/-- Inside the removed disc, the retained radial drawing is exactly +the closure of the retained boundary spoke. -/ +theorem radialDiscDeletion_inter_disc {K C : Drawing S} (hC : C.IsSubdrawing K) + {D e f : Set S} {v u : S} (hD : IsClosedDisc D) (hb : frontier D = C.U) + (he : e ∈ C.E) (hf : f ∈ C.E) (hef : e ≠ f) + (hCU : C.U = closure e ∪ closure f) + (hcapf : closure f ∩ K.V = {v, u}) (hcape : closure e ∩ K.V = {v, u}) : + (radialDiscDeletion K D f).U ∩ D = closure e := by + have heNew := boundary_spoke_retained hC hb he hef + apply Subset.antisymm + · rintro y ⟨hyK, hyD⟩ + obtain ⟨⟨_, hyOut⟩, hynf⟩ := (radialDiscDeletion_U hC hb hf).subset hyK + have hybd : y ∈ frontier D := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure hyD, by simpa only [compl_eq_univ_sdiff] using hyOut⟩ + rcases hCU.subset (hb ▸ hybd) with hye | hyf + · exact hye + · have hyV : y ∈ K.V := by + by_contra hnV + exact hynf ((K.closure_diff_V (hC.2 hf)).subset ⟨hyf, hnV⟩) + exact (hcape.superset (hcapf.subset ⟨hyf, hyV⟩)).1 + · intro y hye + refine ⟨(radialDiscDeletion K D f).closure_subset_U heNew hye, ?_⟩ + have hybd : y ∈ frontier D := hb.symm ▸ C.closure_subset_U he hye + exact hD.isClosed.closure_subset_iff.mpr subset_rfl hybd.1 + +/-- The retained old drawing meets the removed disc only at its one +old boundary vertex. -/ +theorem oldDrawing_outside_inter_disc {Γ C : Drawing S} {D : Set S} {v : S} + (hb : frontier D = C.U) (hmeet : Γ.U ∩ C.U = {v}) : + (Γ.interSet (closure (univ \ D))).U ∩ D ⊆ {v} := by + rintro y ⟨hyΓ, hyD⟩ + have hyOut := interSet_U_subset isClosed_closure hyΓ + have hybd : y ∈ frontier D := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure hyD, by simpa only [compl_eq_univ_sdiff] using hyOut⟩ + exact hmeet.subset ⟨(Drawing.span_isSubdrawing Γ _ _).U_subset hyΓ, hb ▸ hybd⟩ + +/-- A retained old vertex other than the boundary vertex is outside +the whole removed disc. -/ +theorem retained_vertex_notMem_disc {Γ C : Drawing S} {D : Set S} {v x : S} + (hb : frontier D = C.U) (hmeet : Γ.U ∩ C.U = {v}) + (hx : x ∈ (Γ.interSet (closure (univ \ D))).V) (hxv : x ≠ v) : x ∉ D := by + intro hxD + exact hxv (oldDrawing_outside_inter_disc hb hmeet + ⟨(Γ.interSet (closure (univ \ D))).V_subset_U hx, hxD⟩) + +/-- An old edge with an end outside the disc is retained by the +radial deletion. The boundary is a subdrawing, so it cannot cut that +edge into an inside part and an outside part. -/ +theorem edge_retained_of_end_outside_disc (hS : IsClosedSurface S) + {K C : Drawing S} (hC : C.IsSubdrawing K) {D f g : Set S} + (hD : IsClosedDisc D) (hb : frontier D = C.U) (hf : f ∈ C.E) + (hg : g ∈ K.E) {x : S} (hx : x ∈ closure g) (hxD : x ∉ D) : + g ∈ (radialDiscDeletion K D f).E := by + have hCD : C.U ⊆ D := by + intro y hy + have hybd : y ∈ frontier D := hb.symm ▸ hy + exact hD.isClosed.closure_subset_iff.mpr subset_rfl hybd.1 + have hdis : Disjoint g (discBd D) := by + apply disjoint_left.mpr + intro y hyg hybd + have hyC : y ∈ C.U := hb ▸ (IsClosedDisc.frontier_eq_discBd hS hD).symm ▸ hybd + have hgC := edge_mem_of_meets_subdrawing hC hg ⟨y, hyg, hyC⟩ + exact hxD (hCD (C.closure_subset_U hgC hx)) + have hout : Disjoint g D := by + rcases hD.side (fun y => (hS.2.2 y).isManifoldPoint) hg.2.2.1.isConnected.isPreconnected hdis + with hin | hout + · exact (hxD ((closure_minimal (hin.trans (discInt_subset D)) hD.isClosed) hx)).elim + · exact hout + have hgf : g ≠ f := by + intro hgf + obtain ⟨y, hyg⟩ := hg.1 + exact disjoint_left.mp hout hyg (hCD ((hgf.symm ▸ hf).2.1 hyg).1) + rw [radialDiscDeletion_E] + exact ⟨hg, fun y hy => subset_closure ⟨mem_univ _, disjoint_left.mp hout hy⟩, hgf⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72Slope.lean b/LeanPool/GraphMinor/GM12/Section72Slope.lean new file mode 100644 index 0000000000..7874013d60 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72Slope.lean @@ -0,0 +1,150 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section77 +public import LeanPool.GraphMinor.GM12.Section7 +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.Section91 +import LeanPool.GraphMinor.GM12.Section4WalkMetric + +/-! +# Restricting the radial inside function in XII (7.2) + +On page 260 a radial drawing of the reduced drawing is chosen as a +subdrawing of the original radial drawing. Every one of its short +circuits is therefore an old circuit. Intersect the separation of its +selected disc with the reduced drawing. This proves that the old +inside function is a derived inside function for the restricted +tangle. Lifting a walk through the subdrawing does not change either +its drawing or its inside. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM14 + +/-- The old inside function remains derived for the restricted tangle +on a radial subdrawing, as used in XII (7.2), page 260. -/ +theorem derivedSlope_restrict_subdrawing + {S : Type*} [TopologicalSpace S] {Γ Γ' K K' : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} + (hΓ : Γ'.IsSubdrawing Γ) (hK : K'.IsSubdrawing K) + (hd : IsDerivedSlope (.drawing Γ) K θ T ins) : + IsDerivedSlope (.drawing Γ') K' θ (restrictTangle T Γ'.toHypergraph) ins := by + intro C hC hCK' hlen + obtain ⟨hD, hbd, hm⟩ := hd C hC (hCK'.trans hK) hlen + refine ⟨hD, hbd, ?_⟩ + have hm' : (((PaintingOrDrawing.drawing Γ).inter (ins C)) ∩ Γ'.toHypergraph, + ((PaintingOrDrawing.drawing Γ).interOutside (ins C)) ∩ Γ'.toHypergraph) ∈ + restrictTangle T Γ'.toHypergraph := ⟨_, _, hm, rfl⟩ + rwa [drawing_inter_inter_subdrawing hΓ, drawing_interOutside_inter_subdrawing hΓ] at hm' + +/-- Lifting a closed walk through a subdrawing preserves its point +set, its length, and its inside. This is the walk comparison in +XII (7.2), page 260. -/ +theorem exists_lifted_walk_same_inside + {S : Type*} [TopologicalSpace S] [T1Space S] {K K' : Drawing S} + (hK : K'.IsSubdrawing K) (ins : Drawing S → Set S) {v : S} + (W : GraphWalk K'.toGraph v v) : + ∃ X : GraphWalk K.toGraph v v, X.length = W.length ∧ + walkDrawing K X = walkDrawing K' W ∧ insWalk ins K X = insWalk ins K' W := by + obtain ⟨X, hV, hE⟩ := hK.exists_walk_up W + have hdraw : walkDrawing K X = walkDrawing K' W := by + apply Drawing.ext_of_V_E + · rw [walkDrawing_V, walkDrawing_V, hV] + · rw [walkDrawing_E, walkDrawing_E, hE] + exact ⟨X, congrArg List.length hE, hdraw, congrArg (insOf ins) hdraw⟩ + +/-- Passing to a radial subdrawing cannot decrease distance between +atoms shared by the old and reduced drawings. This proves the walk +comparison used for XII (7.2)(i), page 260. -/ +theorem tangleMetric_le_of_radial_subdrawing + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ Γ' K K' : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} + (hΓ : Γ'.IsSubdrawing Γ) (hKK : K'.IsSubdrawing K) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hK' : (PaintingOrDrawing.drawing Γ').IsRadialDrawing K') + (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + {a b : Set S} (ha : a ∈ Γ.A) (hb : b ∈ Γ.A) : + tangleMetric Γ K ins θ a b ≤ tangleMetric Γ' K' ins θ a b := by + classical + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + by_cases hab : a = b + · subst b + simp only [tangleMetric, ↓reduceIte, le_refl] + rcases GM11.tangleMetric_cases hK'.2.1 hab with hfull | ⟨_, hw⟩ + · rw [hfull] + exact tangleMetric_le_order hK ins θ a b + · obtain ⟨v, W, a', b', hca', hcb', hshort, hlen, haW, hbW⟩ := hw + have hd' := derivedSlope_restrict_subdrawing hΓ hKK hd + have hameet := (corresponding_atom_subset_iff hS hK' hd' hca' W hshort).mp haW + have hbmeet := (corresponding_atom_subset_iff hS hK' hd' hcb' W hshort).mp hbW + obtain ⟨X, hXlen, _, hinside⟩ := exists_lifted_walk_same_inside hKK ins W + have hXshort : X.length < 2 * θ := hXlen ▸ hshort + obtain ⟨a₀, hca, _⟩ := existsUnique_correspondingAtom' hK ha + obtain ⟨b₀, hcb, _⟩ := existsUnique_correspondingAtom' hK hb + have haX : a₀ ⊆ insWalk ins K X := + (corresponding_atom_subset_iff hS hK hd hca X hXshort).mpr (hinside.symm ▸ hameet) + have hbX : b₀ ⊆ insWalk ins K X := + (corresponding_atom_subset_iff hS hK hd hcb X hXshort).mpr (hinside.symm ▸ hbmeet) + exact tangleMetric_le_of_walk hca hcb X hXshort (hXlen.trans hlen) haX hbX + +/-- If the old region and the merged region retain the same radial +hub, their distances from an old atom satisfy the comparison in +XII (7.2)(ii), page 260. -/ +theorem tangleMetric_region_le_of_radial_subdrawing + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ Γ' K K' : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} + (hΓ : Γ'.IsSubdrawing Γ) (hKK : K'.IsSubdrawing K) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hK' : (PaintingOrDrawing.drawing Γ').IsRadialDrawing K') + (hd : IsDerivedSlope (.drawing Γ) K θ T ins) + {a r r' : Set S} (ha : a ∈ Γ.A) (hr : r ∈ Γ.R) (hr' : r' ∈ Γ'.R) + {u : S} (hur : u ∈ r) (hur' : u ∈ r') (huK' : u ∈ K'.V) : + tangleMetric Γ K ins θ a r ≤ tangleMetric Γ' K' ins θ a r' := by + classical + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + by_cases har' : a = r' + · have har : a = r := atom_eq_of_inter_nonempty ha (Or.inr hr) + ⟨u, har'.symm ▸ hur', hur⟩ + rw [har] + simp only [tangleMetric, ↓reduceIte, Nat.zero_le] + rcases GM11.tangleMetric_cases hK'.2.1 har' with hfull | ⟨_, hw⟩ + · rw [hfull] + exact tangleMetric_le_order hK ins θ a r + · obtain ⟨v, W, a', b', hca', hcb', hshort, hlen, haW, hbW⟩ := hw + have hd' := derivedSlope_restrict_subdrawing hΓ hKK hd + have hcr' : IsCorrespondingAtom Γ' K' r' {u} := + ⟨Or.inr hr', Or.inl (Or.inl ⟨u, huK', rfl⟩), + Or.inr (Or.inr ⟨hr', u, ⟨huK', hur'⟩, rfl⟩)⟩ + have hrameet := (corresponding_atom_subset_iff hS hK' hd' hcb' W hshort).mp hbW + have huW : u ∈ insWalk ins K' W := + ((corresponding_atom_subset_iff hS hK' hd' hcr' W hshort).mpr hrameet) rfl + have hameet := (corresponding_atom_subset_iff hS hK' hd' hca' W hshort).mp haW + obtain ⟨X, hXlen, _, hinside⟩ := exists_lifted_walk_same_inside hKK ins W + have hXshort : X.length < 2 * θ := hXlen ▸ hshort + obtain ⟨a₀, hca, _⟩ := existsUnique_correspondingAtom' hK ha + have hcr : IsCorrespondingAtom Γ K r {u} := + ⟨Or.inr hr, Or.inl (Or.inl ⟨u, hKK.1 huK', rfl⟩), + Or.inr (Or.inr ⟨hr, u, ⟨hKK.1 huK', hur⟩, rfl⟩)⟩ + have haX : a₀ ⊆ insWalk ins K X := + (corresponding_atom_subset_iff hS hK hd hca X hXshort).mpr (hinside.symm ▸ hameet) + have huX : ({u} : Set S) ⊆ insWalk ins K X := + singleton_subset_iff.mpr (hinside.symm ▸ huW) + exact tangleMetric_le_of_walk hca hcr X hXshort (hXlen.trans hlen) haX huX + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72Tangle.lean b/LeanPool/GraphMinor/GM12/Section72Tangle.lean new file mode 100644 index 0000000000..ad52344146 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72Tangle.lean @@ -0,0 +1,105 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section7 +public import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.Theorem61 + +/-! +# Restricting the tangle in Graph Minors XII, (7.2) + +A normal circle through one vertex bounds a disc chosen by respectfulness. +The disc separation has order one, so XII, (7.1) restricts the tangle to the +outside drawing without lowering its order. This proves the tangle assertion +in the first part of the proof of (7.2), pages 259–260. It does not prove +that the new drawing is two-cell, or that the new tangle is respectful. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- On a closed set, the hypergraph of the restricted drawing agrees with the +intersection hypergraph used for respectful tangles in XII, (7.2), page 260. -/ +theorem interSet_toHypergraph (Γ : Drawing S) {X : Set S} (hX : IsClosed X) : + (Γ.interSet X).toHypergraph = (PaintingOrDrawing.drawing Γ).inter X := by + apply Hypergraph.ext + · ext v + exact mem_interSet_V_iff hX + · ext e + exact mem_interSet_E_iff + · funext e v + apply propext + constructor + · rintro ⟨he, hv, hc⟩ + obtain ⟨heΓ, heX⟩ := mem_interSet_E_iff.mp he + obtain ⟨hvΓ, hvX⟩ := (mem_interSet_V_iff hX).mp hv + exact ⟨⟨heΓ, hvΓ, hc⟩, heX, hvX⟩ + · rintro ⟨⟨he, hv, hc⟩, heX, hvX⟩ + exact ⟨mem_interSet_E_iff.mpr ⟨he, heX⟩, + (mem_interSet_V_iff hX).mpr ⟨hv, hvX⟩, hc⟩ + +omit [T2Space S] in +/-- In the proof of XII, (7.2), the separation across the chosen disc has +order one because its common vertices are precisely the vertices on the circle. -/ +theorem separationOrder_inter_eq_one {Γ : Drawing S} {Δ F : Set S} {v : S} + (hΔ : IsClosed Δ) (hbd : subBd Δ = F) (hFV : F ∩ Γ.V = {v}) : + separationOrder ((PaintingOrDrawing.drawing Γ).inter Δ) + ((PaintingOrDrawing.drawing Γ).interOutside Δ) = 1 := by + have hfr : frontier Δ = F := (subBd_eq_frontier Δ).symm.trans hbd + have hvertices : + (((PaintingOrDrawing.drawing Γ).inter Δ) ∩ + ((PaintingOrDrawing.drawing Γ).interOutside Δ)).vertexSet = F ∩ Γ.V := by + ext x + constructor + · intro hx + have h := inter_outside_subset hx + exact ⟨hfr ▸ h.1, h.2⟩ + · rintro ⟨hxF, hxV⟩ + have hxfr : x ∈ frontier Δ := hfr.symm ▸ hxF + have hxΔ : x ∈ Δ := hΔ.closure_eq ▸ hxfr.1 + have hxout : x ∈ closure (univ \ Δ) := by + rw [← compl_eq_univ_sdiff, closure_compl] + exact hxfr.2 + exact ⟨⟨hxV, hxΔ⟩, hxV, hxout⟩ + unfold separationOrder + rw [hvertices, hFV, ncard_singleton] + +/-- The tangle restriction in XII, (7.2), pages 259–260, obtained from (7.1). +Respectfulness supplies the disc and membership of its separation. The single +boundary vertex gives order one, with no extra separation hypothesis. -/ +theorem theorem_7_2_tangle {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsTangle Γ.toHypergraph θ T) + (hrespect : (PaintingOrDrawing.drawing Γ).IsRespectful θ T) + {F : Set S} {v : S} (hF : IsOArc F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) + (hFV : F ∩ Γ.V = {v}) : + ∃ Δ : Set S, IsClosedDisc Δ ∧ subBd Δ = F ∧ + ((PaintingOrDrawing.drawing Γ).inter Δ, + (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T ∧ + IsTangle (Γ.interSet (closure (univ \ Δ))).toHypergraph θ + (restrictTangle T (Γ.interSet (closure (univ \ Δ))).toHypergraph) := by + have hcard : (F ∩ Γ.V).ncard < θ := by rw [hFV, ncard_singleton]; omega + obtain ⟨Δ, hΔ, hbd, hm⟩ := hrespect.2 F hF hn hcard + have hclosed : IsClosed Δ := (IsClosedDisc.isCompact hΔ).isClosed + have ho := separationOrder_inter_eq_one hclosed hbd hFV + have ht := theorem_7_1_proof hT hm ho + refine ⟨Δ, hΔ, hbd, hm, ?_⟩ + rw [interSet_toHypergraph Γ isClosed_closure] + exact ht + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72Trace.lean b/LeanPool/GraphMinor/GM12/Section72Trace.lean new file mode 100644 index 0000000000..b15a63bd38 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72Trace.lean @@ -0,0 +1,157 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2PartitionDeformation +public import LeanPool.GraphMinor.GM12.Section2CyclicEmbedding +public import LeanPool.GraphMinor.GM12.Section2BacktrackInside +import LeanPool.GraphMinor.GM12.Section2CurveCounts +import LeanPool.GraphMinor.GM12.Section2CirclePeriod +import LeanPool.GraphMinor.GM12.Section2PeriodicHits + +/-! +# The two-spoke trace of a circle meeting one vertex + +In XII (7.2), page 260, the boundary circle visits just one region, +starting and ending at the same vertex. Apply the region deformation +from (2.1) to this single visit. Its two-edge trace is either an +embedded circle or a backtracking line. The homotopy stays in the +region together with the boundary vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM07 + +/-- The single region visit in XII (7.2), page 260, gives a two-edge +radial trace, with its simplicity or backtracking alternative. -/ +theorem exists_two_spoke_deformation + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {F r : Set S} {v : S} (hF : IsOArc F) (hvF : v ∈ F) + (hv : v ∈ Γ.V) (hr : r ∈ Γ.R) (hFr : F \ {v} ⊆ r) : + ∃ φ ψ : C(Circle, S), ∃ W : GraphWalk K.toGraph v v, + IsEmbedding φ ∧ range φ = F ∧ W.length = 2 ∧ + range ψ = (walkDrawing K W).U ∧ + ClosedCurvesHomotopicIn (r ∪ {v}) φ ψ ∧ + (IsEmbedding ψ ∨ ∃ L, IsLine L ∧ range ψ = L ∧ L ⊆ r ∪ {v}) := by + obtain ⟨H⟩ := hF + let φ : C(Circle, S) := ⟨fun z => (H z).val, + continuous_subtype_val.comp H.continuous⟩ + have hφ : IsEmbedding φ := IsEmbedding.subtypeVal.comp H.isEmbedding + have hφF : range φ = F := by + ext x + constructor + · rintro ⟨z, rfl⟩ + exact (H z).property + · intro hx + exact ⟨H.symm ⟨x, hx⟩, congrArg Subtype.val (H.apply_symm_apply ⟨x, hx⟩)⟩ + obtain ⟨z, hz⟩ := hφF.symm ▸ hvF + obtain ⟨a, _, ha⟩ := (circle_parameter_bijOn 0).surjOn (mem_univ z) + have hav : periodicCurve φ a = v := by + change φ (Circle.exp (2 * Real.pi * a)) = v + exact (congrArg φ ha).trans hz + have hφZ : range φ ⊆ r ∪ {v} := by + intro x hx + by_cases hxv : x = v + · exact Or.inr hxv + · exact Or.inl (hFr ⟨hφF ▸ hx, hxv⟩) + let t : Fin 2 → ℝ := fun i => a + i.val + have ht : StrictMono t := by + intro i j hij + change a + (i.val : ℝ) < a + (j.val : ℝ) + exact add_lt_add_right (Nat.cast_lt.mpr hij) a + have hperiod : t (Fin.last 1) = t 0 + 1 := by simp [t] + have htΓ : ∀ i, periodicCurve φ (t i) ∈ Γ.V := by + intro i + fin_cases i + · simpa [t, hav] using hv + · simpa [t, periodicCurve_periodic φ a, hav] using hv + have hvisit : ∀ (i : Fin 1) s, s ∈ Ioo (t i.castSucc) (t i.succ) → + periodicCurve φ s ∈ r := by + intro i s hs + have hi : i = 0 := Subsingleton.elim _ _ + subst i + have hs' : s ∈ Ioo a (a + 1) := by simpa [t] using hs + apply hFr + refine ⟨hφF ▸ mem_range_self _ , ?_⟩ + intro hsv + have heq : Circle.exp (2 * Real.pi * s) = Circle.exp (2 * Real.pi * a) := + hφ.injective (hsv.trans hav.symm) + have hsa := circle_parameter_injOn a ⟨hs'.1.le, hs'.2⟩ + ⟨le_rfl, lt_add_one a⟩ heq + exact (ne_of_gt hs'.1) hsa + have ht0 : periodicCurve φ (t 0) = v := by simpa [t] using hav + have hex := exists_partition_trace_deformation hS hK hE hφZ (by decide : 0 < 1) + t ht hperiod htΓ (fun _ => r) (fun _ => hr) (fun _ => subset_union_left) hvisit + rw [ht0] at hex + obtain ⟨δ, hmatch, W, _, hlen, hψU, hh, _, _, _, halt⟩ := hex + refine ⟨φ, concatLoop (by decide : 0 < 1) δ hmatch, W, + hφ, hφF, by simpa using hlen, hψU, hh, ?_⟩ + rcases halt 0 with hinj | ⟨_, L, hL, hδL, hLZ⟩ + · left + apply ((concatLoop (by decide : 0 < 1) δ hmatch).continuous.isClosedEmbedding _).isEmbedding + apply concatLoop_injective_of_halfopen_pieces + intro i j s u hs hu heq + have hij : i = j := Subsingleton.elim _ _ + have hi : i = 0 := Subsingleton.elim _ _ + subst j + subst i + exact ⟨rfl, hinj ⟨unitInterval.nonneg _, hs⟩ ⟨unitInterval.nonneg _, hu⟩ heq⟩ + · right + refine ⟨L, hL, ?_, ?_⟩ + · rw [range_concatLoop] + have heq : (⋃ i, range (δ i)) = range (δ 0) := by + ext x + simp only [mem_iUnion] + constructor + · rintro ⟨i, hi⟩ + exact (Subsingleton.elim i (0 : Fin 1)) ▸ hi + · intro hx + exact ⟨0, hx⟩ + exact heq.trans hδL + · simpa [t, hav] using hLZ + +/-- If the selected disc contains an edge, the two-spoke deformation +in XII (7.2), page 260, cannot backtrack. A backtrack would put the +whole disc in the region with just its boundary vertex restored. -/ +theorem exists_embedded_two_spoke_deformation + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {F r D : Set S} {v : S} (hF : IsOArc F) (hvF : v ∈ F) + (hv : v ∈ Γ.V) (hr : r ∈ Γ.R) (hFr : F \ {v} ⊆ r) + (hn : Γ.IsNormal F) (hD : IsClosedDisc D) (hbd : subBd D = F) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + (hED : ∃ e ∈ Γ.E, e ⊆ D) : + ∃ φ ψ : C(Circle, S), ∃ W : GraphWalk K.toGraph v v, + IsEmbedding φ ∧ range φ = F ∧ W.length = 2 ∧ + range ψ = (walkDrawing K W).U ∧ + ClosedCurvesHomotopicIn (r ∪ {v}) φ ψ ∧ IsEmbedding ψ := by + obtain ⟨e, he, heD⟩ := hED + obtain ⟨φ, ψ, W, hφ, hφF, hlen, hψU, hh, halt⟩ := + exists_two_spoke_deformation hS hK ⟨e, he⟩ hF hvF hv hr hFr + refine ⟨φ, ψ, W, hφ, hφF, hlen, hψU, hh, ?_⟩ + rcases halt with hψ | ⟨L, hL, hψL, hLZ⟩ + · exact hψ + · have hDZ := selected_disc_subset_region_vertex_of_line_deformation hS hT hφ + (hφF.symm ▸ hn) hr (hφF.symm ▸ hvF) hD (hbd.trans hφF.symm) + hm hL hLZ hψL.subset hh + obtain ⟨x, hx⟩ := he.1 + rcases hDZ (heD hx) with hxr | hxv + · exact (region_subset hr hxr (he.2.1 hx).1).elim + · exact ((he.2.1 hx).2 (mem_singleton_iff.mp hxv ▸ hv)).elim + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section72TwoCell.lean b/LeanPool/GraphMinor/GM12/Section72TwoCell.lean new file mode 100644 index 0000000000..3399d52afa --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section72TwoCell.lean @@ -0,0 +1,81 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72OpenDisc + +/-! +# Two-cellness after the disc restriction in XII (7.2) + +The merged region is an open disc. Every other new region is an old +region: outside the merged region the two drawings have the same point +set. Thus the outside restriction is two-cell, as in the first paragraph +of the proof of XII (7.2), page 260. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- The two-cell assertion of XII (7.2), pages 259–260. The old region +containing the punctured boundary is enlarged to an open disc. All other +regions of the restricted drawing are unchanged old regions. -/ +theorem theorem_7_2_twoCell (hS : IsClosedSurface S) + {Γ : Drawing S} (htwo : (PaintingOrDrawing.drawing Γ).IsTwoCell) + {Δ F r : Set S} {v : S} + (hΔ : IsClosedDisc Δ) (hbd : subBd Δ = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) + (hFV : F ∩ Γ.V = {v}) (hr : r ∈ Γ.R) (hFr : F \ {v} ⊆ r) : + (PaintingOrDrawing.drawing (Γ.interSet (closure (univ \ Δ)))).IsTwoCell := by + have : ConnectedSpace S := htwo.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let Γ' := Γ.interSet (closure (univ \ Δ)) + let Y := r ∪ (Δ \ {v}) + have hY := theorem_7_2_region hS hΔ hbd hn hFV hr hFr + have hfr : frontier Δ = F := (subBd_eq_frontier Δ).symm.trans hbd + have hdb : discBd Δ = F := (IsClosedDisc.frontier_eq_discBd hS hΔ).symm.trans hfr + have hvFV : v ∈ F ∩ Γ.V := hFV.symm ▸ mem_singleton v + have hYo : IsOpenDisc Y := isOpenDisc_union_disc_sdiff_point hS (htwo.2 r hr) hΔ + (hdb.symm ▸ hvFV.1) (fun hvr => region_subset hr hvr (Γ.V_subset_U hvFV.2)) + (by rw [hdb]; exact hFr) + have hcover : Γ.U ⊆ Γ'.U ∪ Y := + (drawing_U_subset_outside_normal_disc_union hfr hn hvFV.1).trans + (union_subset_union subset_rfl subset_union_right) + refine ⟨inferInstance, fun s hs => ?_⟩ + by_cases hsY : s = Y + · exact hsY.symm ▸ hYo + · have hoff : s ⊆ univ \ Γ.U := by + intro x hx + refine ⟨mem_univ x, fun hxU => ?_⟩ + rcases hcover hxU with hxU' | hxY + · exact region_subset hs hx hxU' + · exact hsY (region_eq_of_mem hs hY hx hxY) + obtain ⟨x, hx⟩ := region_nonempty hs + let C := connectedComponentIn (univ \ Γ.U) x + have hC : C ∈ Γ.R := (mem_R_iff Γ).mpr ⟨x, (hoff hx).2, rfl⟩ + have hsC : s ⊆ C := (region_isPreconnected hs).subset_connectedComponentIn hx hoff + have hxnew : x ∈ univ \ Γ'.U := ⟨mem_univ x, region_subset hs hx⟩ + have hCCnew : connectedComponentIn (univ \ Γ'.U) x ∈ Γ'.R := + (mem_R_iff Γ').mpr ⟨x, hxnew.2, rfl⟩ + have hnewEq : connectedComponentIn (univ \ Γ'.U) x = s := + region_eq_of_mem hCCnew hs (mem_connectedComponentIn hxnew) hx + have hCs : C ⊆ s := by + rw [← hnewEq] + exact connectedComponentIn_mono x (fun y hy => + ⟨mem_univ y, fun hyU' => hy.2 ((Drawing.span_isSubdrawing Γ _ _).U_subset hyU')⟩) + have heq : s = C := Subset.antisymm hsC hCs + exact heq.symm ▸ htwo.2 C hC + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73.lean b/LeanPool/GraphMinor/GM12/Section73.lean new file mode 100644 index 0000000000..312649f134 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73.lean @@ -0,0 +1,115 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM12.Section76 +import LeanPool.GraphMinor.GM12.Section73MetricComparison +import LeanPool.GraphMinor.GM12.Section73VertexReduction +import LeanPool.GraphMinor.GM12.Section73NoParallel +import LeanPool.GraphMinor.GM12.Section73OrderOne +import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.GM07.Section3 + +/-! +# Graph Minors XII, (7.3) + +Deleting a vertex while preserving a two-cell drawing loses at +most two in shared-atom distances, and at most one in distance +to the deleted vertex's region. We follow the radial contraction +and lifted-walk proof on pages 261--262, using the visit bounds +from the proved construction of XI (9.2). First remove selected +one-vertex discs containing edges. This finite reduction corrects +the paper's parallel-spoke assertion and preserves all needed +old lower bounds. The reduced radial construction then proves +both inequalities. Original order two uses the order-one case. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 GM14 Hypergraph + +/-- Graph Minors XII, (7.3), pages 261--262. A two-cell vertex +deletion has a respectful tangle of order one less, with shared +atom distances decreasing by at most two and distance to the +merged region decreasing by at most one. The finite selected-disc +reduction corrects the paper's assertion that the old +radial drawing has no parallel spokes at the vertex, which fails +when there is a contractible loop at the vertex. See the correction +to the proof of (7.3) in `corrections/GM12.md`. -/ +theorem theorem_7_3_proof + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hθ : 2 ≤ θ) (hd : HasTangleMetric Γ θ T d) + {v : S} (hv : v ∈ Γ.V) + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) : + ∃ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r : Set S), + HasTangleMetric (deleteVertices Γ {v}) (θ - 1) T' d' ∧ + r ∈ (deleteVertices Γ {v}).R ∧ v ∈ r ∧ + (∀ a ∈ Γ.A ∩ (deleteVertices Γ {v}).A, + ∀ b ∈ Γ.A ∩ (deleteVertices Γ {v}).A, d a b - 2 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ (deleteVertices Γ {v}).A, d a {v} - 1 ≤ d' a r) := by + by_cases hθtwo : θ = 2 + · subst θ + obtain ⟨d', r, hm, hr, hvr, hi, hii⟩ := theorem_7_3_order_two hS hd hv htwo + exact ⟨_, d', r, hm, hr, hvr, hi, hii⟩ + have hθthree : 3 ≤ θ := by omega + obtain ⟨Γ₀, T₀, d₀, hΓ₀, hv₀, hdelete, hd₀, hcomp₀, hno⟩ := + exists_vertex_reduction hS hθ hd hv htwo + have htwo₀ : (PaintingOrDrawing.drawing (deleteVertices Γ₀ {v})).IsTwoCell := + hdelete.symm ▸ htwo + obtain ⟨K, ins, hK, hins, heq⟩ := hd₀.2 + have hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g := by + intro e he g hg u hel hgl + by_contra heg + have huK : u ∈ K.V := hel.2.2.1 + have hun : u ∉ Γ₀.V := (bipartite_of_preRadial hK.2.1 e v u hel).mp hv₀ + obtain ⟨r, hr, hur⟩ := hK.2.1.2.2.2.1 u ⟨huK, hun⟩ + exact no_parallel_spokes_of_no_selected_edge_inside hS hθ hd₀.1 hK.2.1 hv₀ htwo₀ hno + he hg heg hr hur huK hel.2.2.2 hgl.2.2.2 + have hE : Γ₀.E.Nonempty := edgeSet_nonempty_of_isTangle_of_two_le hd₀.1.2.1 hθ + have ht' := theorem_7_3_tangle hθ hd₀.1.2.1 hv₀ + have hE' : (deleteVertices Γ₀ {v}).E.Nonempty := + edgeSet_nonempty_of_isTangle_of_two_le ht' (by omega) + have hvnot : v ∉ (deleteVertices Γ₀ {v}).U := by + intro hvU + have hvV := (isSubdrawing_U_inter_V (deleteVertices_isSubdrawing Γ₀ {v})).subset ⟨hvU, hv₀⟩ + exact ((deleteVertices_V Γ₀ {v}).subset hvV).2 rfl + obtain ⟨r, hr, hvr⟩ := exists_region_of_notMem hvnot + obtain ⟨d', hm, hi, hii⟩ := exists_metric_with_vertex_deletion_bounds_of_unique_spokes + hS hθ hd₀.1 hins hK hE hv₀ htwo₀ hE' hunique hr hvr + have hshared : ∀ a ∈ Γ.A ∩ (deleteVertices Γ {v}).A, + a ∈ Γ₀.A ∩ (deleteVertices Γ₀ {v}).A := by + intro a ha + have ha' : a ∈ (deleteVertices Γ₀ {v}).A := hdelete.symm ▸ ha.2 + exact ⟨shared_atom_mem_intermediate hΓ₀ (deleteVertices_isSubdrawing Γ₀ {v}) ha.1 ha', ha'⟩ + refine ⟨_, d', r, hdelete ▸ hm, hdelete ▸ hr, hvr, ?_, ?_⟩ + · intro a ha b hb + have ha₀ := hshared a ha + have hb₀ := hshared b hb + have hold := hcomp₀ a ⟨ha.1, ha₀.1⟩ b ⟨hb.1, hb₀.1⟩ + have hnew := hi a ha₀ b hb₀ + rw [← heq a ha₀.1 b hb₀.1] at hnew + omega + · intro a ha + have ha₀ := hshared a ha + have hvA : ({v} : Set S) ∈ Γ.A ∩ Γ₀.A := + ⟨Or.inl (Or.inl ⟨v, hv, rfl⟩), Or.inl (Or.inl ⟨v, hv₀, rfl⟩)⟩ + have hold := hcomp₀ a ⟨ha.1, ha₀.1⟩ {v} hvA + have hnew := hii a ha₀ + rw [← heq a ha₀.1 {v} hvA.2] at hnew + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73ArcCollapse.lean b/LeanPool/GraphMinor/GM12/Section73ArcCollapse.lean new file mode 100644 index 0000000000..7eb24f8ae5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73ArcCollapse.lean @@ -0,0 +1,143 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73ThinStripCollapse +import LeanPool.GraphMinor.GM12.Section4StripRectangle +import LeanPool.GraphMinor.Surface.Classification +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.Surface.Wedge + +/-! +# Contracting a drawn arc while fixing a disjoint closed set + +For the radial-edge contractions in XII (7.3), page 261, straighten +the arc in a surface strip. Take a thin rectangle avoiding the closed +set to be fixed and contract its axis interval. The resulting map is +continuous and onto, and identifies precisely the arc. Conjugating +through a surface model makes the construction work in every universe. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface Metric + +private theorem exists_arc_collapse_type + {S : Type} [TopologicalSpace S] [T2Space S] (hS : IsClosedSurface S) + {a : unitInterval → S} (ha : IsArcMap a) + {F : Set S} (hF : IsClosed F) (havoid : Disjoint (range a) F) : + ∃ f : C(S, S), Function.Surjective f ∧ (∀ x ∈ F, f x = x) ∧ + (∀ x ∈ range a, f x = a 0) ∧ + (∀ x y, f x = f y ↔ x = y ∨ (x ∈ range a ∧ y ∈ range a)) := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + obtain ⟨E, hE, haE⟩ := Surface.exists_disc_of_arc hS ha + obtain ⟨h, g, c⟩ := hE.exists_isChart + have hbc : BallChart 1 (g '' ball 0 1) h g := by + refine ⟨c.isOpen_image_ball hman, c.hc.mono ?_, c.gc.mono ball_subset_closedBall, + ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact c.gm (ball_subset_closedBall hz) + · rintro _ ⟨z, hz, rfl⟩ + rwa [c.hg (ball_subset_closedBall hz)] + · exact fun z hz => ⟨z, hz, rfl⟩ + · rintro _ ⟨z, hz, rfl⟩ + rw [c.hg (ball_subset_closedBall hz)] + · exact fun z hz => c.hg (ball_subset_closedBall hz) + have haU : range a ⊆ g '' ball 0 1 := by rw [← c.discInt_eq]; exact haE + obtain ⟨O, K, θ, hK, hθc, hθm, hθK⟩ := Surface.exists_stripChart hman hbc ha haU + let G := O ∩ K ⁻¹' Fᶜ + have hG : IsOpen G := hK.hc.isOpen_inter_preimage hK.isOpen hF.isOpen_compl + have hθ01 : θ 0 < θ 1 := hθm (by norm_num : (0 : unitInterval) < 1) + have hseg : Complex.ofReal '' Icc (θ 0) (θ 1) ⊆ G := by + rintro z ⟨t, ht, rfl⟩ + have himage := hθc.image_Icc_of_strictMono (a := 0) (b := 1) hθm + obtain ⟨s, _, hs⟩ := (himage.symm ▸ ht : t ∈ θ '' Icc 0 1) + subst t + refine ⟨(hθK s).1, ?_⟩ + change K (θ s) ∉ F + rw [(hθK s).2] + exact disjoint_left.mp havoid (mem_range_self s) + obtain ⟨δ, hδ, hrect⟩ := exists_strip_rectangle hG hθ01.le hseg + obtain ⟨f, hfs, hfix, hconst, _, hfibre⟩ := exists_thin_strip_interval_collapse hK hθ01 hδ + (fun z hz => (hrect hz).1) + have haxis : K '' (Complex.ofReal '' Icc (θ 0) (θ 1)) = range a := by + ext x + constructor + · rintro ⟨z, ⟨t, ht, rfl⟩, rfl⟩ + have himage := hθc.image_Icc_of_strictMono (a := 0) (b := 1) hθm + obtain ⟨s, _, hs⟩ := (himage.symm ▸ ht : t ∈ θ '' Icc 0 1) + exact ⟨s, (hθK s).2.symm.trans (congrArg K (congrArg Complex.ofReal hs))⟩ + · rintro ⟨t, rfl⟩ + exact ⟨(θ t : ℂ), ⟨θ t, ⟨hθm.monotone (unitInterval.nonneg _), + hθm.monotone (unitInterval.le_one _)⟩, rfl⟩, (hθK t).2⟩ + refine ⟨f, hfs, ?_, ?_, ?_⟩ + · intro x hx + apply hfix + rintro ⟨z, hz, rfl⟩ + exact (hrect hz).2 hx + · intro x hx + have h := hconst x (haxis.symm ▸ hx) + exact h.trans (hθK 0).2 + · simpa only [haxis] using hfibre + +/-- Contract an arc to its first endpoint by a continuous surjection, +fixing any closed set disjoint from it and identifying no other +points. This realizes the edge contractions in XII (7.3), page 261. -/ +theorem exists_arc_collapse + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {a : unitInterval → S} (ha : IsArcMap a) + {F : Set S} (hF : IsClosed F) (havoid : Disjoint (range a) F) : + ∃ f : C(S, S), Function.Surjective f ∧ (∀ x ∈ F, f x = x) ∧ + (∀ x ∈ range a, f x = a 0) ∧ + (∀ x y, f x = f y ↔ x = y ∨ (x ∈ range a ∧ y ∈ range a)) := by + let : CompactSpace S := hS.1 + have hSurface : IsSurface S := ⟨hS.1, hS.2.1, fun x => (hS.2.2 x).isManifoldPoint⟩ + obtain ⟨n, m, c, ⟨e⟩⟩ := classification S hSurface inferInstance + let : T2Space (SurfaceModel n m c) := e.t2Space + have hM : IsClosedSurface (SurfaceModel n m c) := by + refine ⟨e.compactSpace, e.t2Space, ?_⟩ + intro x + have hx := (isInteriorPoint_homeomorph_iff e (e.symm x)).mpr (hS.2.2 (e.symm x)) + simpa only [e.apply_symm_apply] using hx + let a' : unitInterval → SurfaceModel n m c := fun t => e (a t) + let F' : Set (SurfaceModel n m c) := e.symm ⁻¹' F + have ha' : IsArcMap a' := ⟨e.continuous.comp ha.1, e.injective.comp ha.2⟩ + have hF' : IsClosed F' := hF.preimage e.symm.continuous + have havoid' : Disjoint (range a') F' := by + apply disjoint_left.mpr + rintro z ⟨t, rfl⟩ hz + have hzF : a t ∈ F := by simpa only [F', a', mem_preimage, e.symm_apply_apply] using hz + exact disjoint_left.mp havoid (mem_range_self t) hzF + obtain ⟨f, hfs, hfix, hconst, hfibre⟩ := exists_arc_collapse_type hM ha' hF' havoid' + let g : C(S, S) := ⟨fun x => e.symm (f (e x)), + e.symm.continuous.comp (f.continuous.comp e.continuous)⟩ + have hrange : ∀ x : S, e x ∈ range a' ↔ x ∈ range a := by + intro x + constructor + · rintro ⟨t, ht⟩ + exact ⟨t, e.injective ht⟩ + · rintro ⟨t, rfl⟩ + exact ⟨t, rfl⟩ + refine ⟨g, e.symm.surjective.comp (hfs.comp e.surjective), ?_, ?_, ?_⟩ + · intro x hx + change e.symm (f (e x)) = x + rw [hfix (e x) (by simpa only [F', mem_preimage, e.symm_apply_apply] using hx), + e.symm_apply_apply] + · intro x hx + change e.symm (f (e x)) = a 0 + rw [hconst (e x) ((hrange x).mpr hx)] + exact e.symm_apply_apply _ + · intro x y + change e.symm (f (e x)) = e.symm (f (e y)) ↔ _ + rw [e.symm.injective.eq_iff, hfibre] + simp only [e.injective.eq_iff, hrange] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73ArcCollapseCircle.lean b/LeanPool/GraphMinor/GM12/Section73ArcCollapseCircle.lean new file mode 100644 index 0000000000..e9971189c0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73ArcCollapseCircle.lean @@ -0,0 +1,112 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73TwoArcLoop +import LeanPool.GraphMinor.GM12.Section73WalkPaths + +/-! +# Removing the constant arc from the collapsed circle + +For XII (7.3), Claim (1), page 262, parameterize the old circle +by its two complementary arcs. The collapse makes the first arc +constant. The image of the other arc is a loop injective apart +from its ends, so it parameterizes the new circle. The constant +first half of the collapsed loop can be removed by the usual +path homotopy, inside the image of the remaining arc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Collapsing one arc of a two-arc circle leaves, up to homotopy, +the embedded circle parameterized by the complementary arc. This +compares the circuit parameters in XII (7.3), Claim (1), page 262. -/ +theorem exists_circle_parameters_after_arc_collapse + {S : Type*} [TopologicalSpace S] [T2Space S] {p q : S} {Z : Set S} + (α : Path p q) (β : Path q p) (hα : Function.Injective α) (hβ : Function.Injective β) + (hcap : range α ∩ range β ⊆ {p, q}) (f : C(S, S)) + (hconstant : ∀ t, f (α t) = f p) + (hinj : InjOn (fun t => f (β t)) (Ico (0 : unitInterval) 1)) + (hZ : ∀ t, f (β t) ∈ Z) : + ∃ φ ψ : C(Circle, S), IsEmbedding φ ∧ IsEmbedding ψ ∧ + range φ = range α ∪ range β ∧ range ψ = f '' range β ∧ + ClosedCurvesHomotopicIn Z (f.comp φ) ψ := by + have h01 : (α.trans β).toContinuousMap 0 = (α.trans β).toContinuousMap 1 := + (α.trans β).source.trans (α.trans β).target.symm + obtain ⟨φ, hφ, hφrange, hφpar⟩ := exists_embedded_circle_of_loop + (α.trans β).toContinuousMap h01 (two_arc_loop_injOn α β hα hβ hcap) + have hfpq : f p = f q := by + have hh := hconstant 1 + rw [α.target] at hh + exact hh.symm + let γ : Path (f p) (f p) := (β.map f.continuous).cast hfpq rfl + have hγ01 : γ.toContinuousMap 0 = γ.toContinuousMap 1 := γ.source.trans γ.target.symm + obtain ⟨ψ, hψ, hψrange, hψpar⟩ := exists_embedded_circle_of_loop γ.toContinuousMap hγ01 hinj + have hpZ : f p ∈ Z := by simpa only [β.target] using hZ 1 + let a : Z := ⟨f p, hpZ⟩ + let γZ : Path a a := { + toFun := fun t => ⟨γ t, hZ t⟩ + continuous_toFun := by fun_prop + source' := Subtype.ext γ.source + target' := Subtype.ext γ.target } + have hh : ClosedCurvesHomotopicIn Z (f.comp φ) ψ := by + apply closedCurvesHomotopicIn_of_path 1 (f.comp φ) ψ ((Path.refl a).trans γZ) γZ + · intro t + rw [ContinuousMap.comp_apply, hφpar] + change (((Path.refl a).trans γZ) t).val = f ((α.trans β) t) + rw [Path.trans_apply, Path.trans_apply] + split_ifs with ht + · exact (hconstant _).symm + · rfl + · intro t + rw [hψpar] + rfl + · exact Path.Homotopic.refl_trans γZ + refine ⟨φ, ψ, hφ, hψ, ?_, ?_, hh⟩ + · exact hφrange.trans (Path.trans_range α β) + · rw [hψrange] + change range (fun t => f (β t)) = f '' range β + exact range_comp f β + +/-- Exact collapse fibres make the complementary arc's image +injective on the half-open interval. Thus the parameter comparison +for XII (7.3), Claim (1), follows from the arc and fibre data, +without assuming injectivity of the collapsed parameterization. -/ +theorem exists_circle_parameters_of_collapse_fibres + {S : Type*} [TopologicalSpace S] [T2Space S] {p q : S} {A Z : Set S} + (α : Path p q) (β : Path q p) (hα : Function.Injective α) (hβ : Function.Injective β) + (hcap : range α ∩ range β ⊆ {p, q}) (hαA : range α ⊆ A) + (hβA : range β ∩ A ⊆ {p, q}) (f : C(S, S)) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ (x ∈ A ∧ y ∈ A)) + (hZ : f '' range β ⊆ Z) : + ∃ φ ψ : C(Circle, S), IsEmbedding φ ∧ IsEmbedding ψ ∧ + range φ = range α ∪ range β ∧ range ψ = f '' range β ∧ + ClosedCurvesHomotopicIn Z (f.comp φ) ψ := by + have hpA : p ∈ A := α.source ▸ hαA (mem_range_self 0) + have hconstant : ∀ t, f (α t) = f p := fun t => (hfibre _ _).mpr + (Or.inr ⟨hαA (mem_range_self t), hpA⟩) + have hends : ∀ t ∈ Ico (0 : unitInterval) 1, β t ∈ A → t = 0 := by + intro t ht htA + rcases hβA ⟨mem_range_self t, htA⟩ with htp | htq + · have htone : t = 1 := hβ (htp.trans β.target.symm) + exact (ht.2.ne htone).elim + · exact hβ (htq.trans β.source.symm) + have hinj : InjOn (fun t => f (β t)) (Ico (0 : unitInterval) 1) := by + intro s hs t ht hst + rcases (hfibre _ _).mp hst with heq | hA + · exact hβ heq + · exact (hends s hs hA.1).trans (hends t ht hA.2).symm + exact exists_circle_parameters_after_arc_collapse α β hα hβ hcap f hconstant hinj + (fun t => hZ ⟨β t, mem_range_self t, rfl⟩) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73BigonChord.lean b/LeanPool/GraphMinor/GM12/Section73BigonChord.lean new file mode 100644 index 0000000000..3bddf2cb8f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73BigonChord.lean @@ -0,0 +1,112 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscArcs +public import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# Cutting a radial bigon along a third spoke + +For the finite cleanup in XII (7.3), page 261, choose a disc between +two parallel spokes containing as few spokes as possible. If there +is a third spoke in the disc, it is a proper chord. Cutting along it +gives a smaller bigon that omits one original boundary edge. This +file proves that strict decrease from the disc cross-cut theorem. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A third parallel spoke in a bigon cuts off a bigon omitting an +old boundary edge. This is the strict-decrease step in the finite +cleanup of XII (7.3), page 261. -/ +theorem exists_bigon_from_third_spoke + {S : Type*} [TopologicalSpace S] [T2Space S] {H : Drawing S} + {g h k Q : Set S} {v u : S} (hg : g ∈ H.E) (hh : h ∈ H.E) (hk : k ∈ H.E) + (hgh : g ≠ h) (hkg : k ≠ g) (hkh : k ≠ h) (hvu : v ≠ u) + (hcg : closure g ∩ H.V = {v, u}) (hch : closure h ∩ H.V = {v, u}) + (hck : closure k ∩ H.V = {v, u}) + (hQ : IsClosedDisc Q) (hbd : discBd Q = closure g ∪ closure h) + (hkQ : closure k ⊆ Q) : + ∃ P : Set S, IsClosedDisc P ∧ P ⊆ Q ∧ + (discBd P = closure g ∪ closure k ∨ discBd P = closure h ∪ closure k) ∧ + (¬ g ⊆ P ∨ ¬ h ⊆ P) := by + have hLg := isLine_closure hg hvu hcg + have hLh := isLine_closure hh hvu hch + have hLk := isLine_closure hk hvu hck + have hmeet : closure g ∩ closure h ⊆ {v, u} := fun x hx => + hcg.subset ⟨hx.1, closure_inter_subset_V hg hh hgh hx⟩ + have hkbd : closure k ∩ discBd Q = {v, u} := by + apply Subset.antisymm + · rintro x ⟨hxk, hxQ⟩ + rw [hbd] at hxQ + rcases hxQ with hxg | hxh + · exact hck.subset ⟨hxk, closure_inter_subset_V hk hg hkg ⟨hxk, hxg⟩⟩ + · exact hck.subset ⟨hxk, closure_inter_subset_V hk hh hkh ⟨hxk, hxh⟩⟩ + · intro x hx + exact ⟨(hck.superset hx).1, hbd ▸ Or.inl (hcg.superset hx).1⟩ + obtain ⟨A₁, A₂, P₁, P₂, _, hcomp, hP₁, hP₂, hUnion, hInter, hbd₁, hbd₂, _⟩ := + disc_iArc Q (closure k) v u hQ hkQ hvu hLk hkbd + have hparts : componentsIn (discBd Q \ {v, u}) = + {closure g \ {v, u}, closure h \ {v, u}} := by + rw [hbd, union_sdiff_distrib] + apply componentsIn_union_eq_pair + (isPathConnected_sdiff_pair hLg).isConnected.isPreconnected + (isPathConnected_sdiff_pair hLh).isConnected.isPreconnected + (isPathConnected_sdiff_pair hLg).nonempty + (isPathConnected_sdiff_pair hLh).nonempty + · rw [closure_sdiff_pair hLg] + exact disjoint_left.mpr fun x hxg hxh => hxh.2 (hmeet ⟨hxg, hxh.1⟩) + · rw [closure_sdiff_pair hLh] + exact disjoint_left.mpr fun x hxg hxh => hxg.2 (hmeet ⟨hxg.1, hxh⟩) + have hends : ({v, u} : Set S) ⊆ closure k := fun x hx => (hck.superset hx).1 + have hrestore : ∀ L : Set S, (L \ {v, u}) ∪ closure k = L ∪ closure k := by + intro L + ext x + constructor + · rintro (hx | hx) + · exact Or.inl hx.1 + · exact Or.inr hx + · rintro (hx | hx) + · by_cases hxend : x ∈ ({v, u} : Set S) + · exact Or.inr (hends hxend) + · exact Or.inl ⟨hx, hxend⟩ + · exact Or.inr hx + have hA₁ : A₁ = closure g \ {v, u} ∨ A₁ = closure h \ {v, u} := by + have hmem := hcomp.superset (Or.inl rfl) + rw [hparts] at hmem + exact hmem + have hA₂ : A₂ = closure g \ {v, u} ∨ A₂ = closure h \ {v, u} := by + have hmem := hcomp.superset (Or.inr rfl) + rw [hparts] at hmem + exact hmem + refine ⟨P₁, hP₁, (fun x hx => hUnion ▸ Or.inl hx), ?_, ?_⟩ + · rcases hA₁ with hA₁ | hA₁ + · exact Or.inl (hbd₁.trans (hA₁ ▸ hrestore (closure g))) + · exact Or.inr (hbd₁.trans (hA₁ ▸ hrestore (closure h))) + · have hmiss : ∀ a ∈ H.E, a ≠ k → A₂ = closure a \ {v, u} → ¬ a ⊆ P₁ := by + intro a ha hak hAa haP₁ + obtain ⟨x, hxa⟩ := ha.1 + have hxV : x ∉ H.V := (ha.2.1 hxa).2 + have hxend : x ∉ ({v, u} : Set S) := fun hx => hxV (hck.superset hx).2 + have hxA₂ : x ∈ A₂ := hAa.symm ▸ ⟨subset_closure hxa, hxend⟩ + have hxP₂ : x ∈ P₂ := Surface.discBd_subset P₂ (hbd₂ ▸ Or.inl hxA₂) + have hxk : x ∈ closure k := hInter.subset ⟨haP₁ hxa, hxP₂⟩ + exact hxV (closure_inter_subset_V ha hk hak ⟨subset_closure hxa, hxk⟩) + rcases hA₂ with hA₂ | hA₂ + · exact Or.inl (hmiss g hg hkg.symm hA₂) + · exact Or.inr (hmiss h hh hkh.symm hA₂) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CellularContraction.lean b/LeanPool/GraphMinor/GM12/Section73CellularContraction.lean new file mode 100644 index 0000000000..7868af157a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CellularContraction.lean @@ -0,0 +1,158 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73CollapseComplement +public import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.RadialTwoCell + +/-! +# Two-cell drawings under a contraction + +In XII (7.3), page 261, contracting the radial star preserves the +regions of the radial drawing. A homeomorphism of complements takes +connected components to connected components. Thus every new region +is homeomorphic to an old region, and remains an open disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A homeomorphism between drawing complements pairs each region +of the second drawing with a homeomorphic region of the first. +This transfers the radial regions in XII (7.3), page 261. -/ +theorem exists_region_homeomorph_of_complement + {S : Type*} [TopologicalSpace S] {K H : Drawing S} + (e : ↥(K.Uᶜ) ≃ₜ ↥(H.Uᶜ)) {q : Set S} (hq : q ∈ H.R) : + ∃ r, ∃ hr : r ∈ K.R, ∃ h : r ≃ₜ q, + ∀ x : r, (h x).val = (e ⟨x.val, region_subset hr x.property⟩).val := by + obtain ⟨y, hyq⟩ := region_nonempty hq + let g : q → S := fun z => (e.symm ⟨z.val, region_subset hq z.property⟩).val + have hgc : Continuous g := continuous_subtype_val.comp (e.symm.continuous.comp + (continuous_subtype_val.subtype_mk fun z => region_subset hq z.property)) + let : PreconnectedSpace q := isPreconnected_iff_preconnectedSpace.mp (region_isPreconnected hq) + have hgnot : ∀ z : q, g z ∉ K.U := fun z => (e.symm ⟨z.val, region_subset hq z.property⟩).property + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem (hgnot ⟨y, hyq⟩) + have hgr : range g ⊆ r := subset_region hr (isPreconnected_range hgc) + (disjoint_left.mpr fun _ ⟨z, hzx⟩ hx => hgnot z (hzx ▸ hx)) + (mem_range_self ⟨y, hyq⟩) hxr + let p : r → S := fun z => (e ⟨z.val, region_subset hr z.property⟩).val + have hpc : Continuous p := continuous_subtype_val.comp (e.continuous.comp + (continuous_subtype_val.subtype_mk fun z => region_subset hr z.property)) + let : PreconnectedSpace r := isPreconnected_iff_preconnectedSpace.mp (region_isPreconnected hr) + have hpnot : ∀ z : r, p z ∉ H.U := fun z => (e ⟨z.val, region_subset hr z.property⟩).property + have hpx : p ⟨g ⟨y, hyq⟩, hxr⟩ = y := congrArg Subtype.val (e.apply_symm_apply ⟨y, region_subset + hq hyq⟩) + have hpq : range p ⊆ q := subset_region hq (isPreconnected_range hpc) + (disjoint_left.mpr fun _ ⟨z, hzx⟩ hx => hpnot z (hzx ▸ hx)) + ⟨⟨g ⟨y, hyq⟩, hxr⟩, hpx⟩ hyq + refine ⟨r, hr, { + toFun := fun z => ⟨p z, hpq (mem_range_self z)⟩ + invFun := fun z => ⟨g z, hgr (mem_range_self z)⟩ + left_inv := ?_ + right_inv := ?_ + continuous_toFun := hpc.subtype_mk _ + continuous_invFun := hgc.subtype_mk _ }, ?_⟩ + · intro z + apply Subtype.ext + change (e.symm (e ⟨z.val, region_subset hr z.property⟩)).val = z.val + exact congrArg (fun x : ↥(K.Uᶜ) => x.val) (e.symm_apply_apply ⟨z.val, + region_subset hr z.property⟩) + · intro z + apply Subtype.ext + change (e (e.symm ⟨z.val, region_subset hq z.property⟩)).val = z.val + exact congrArg (fun x : ↥(H.Uᶜ) => x.val) (e.apply_symm_apply ⟨z.val, + region_subset hq z.property⟩) + · intro z + rfl + +/-- A homeomorphism of drawing complements preserves the two-cell +property. This supplies the region-topology step in the contraction +of XII (7.3), page 261. -/ +theorem isTwoCell_of_complement_homeomorph + {S : Type*} [TopologicalSpace S] [LocallyConnectedSpace S] + {K H : Drawing S} (hK : (PaintingOrDrawing.drawing K).IsTwoCell) + (e : ↥(K.Uᶜ) ≃ₜ ↥(H.Uᶜ)) : (PaintingOrDrawing.drawing H).IsTwoCell := by + refine ⟨hK.1, ?_⟩ + intro q hq + obtain ⟨r, hr, erq, _⟩ := exists_region_homeomorph_of_complement e hq + obtain ⟨er⟩ := (hK.2 r hr).2 + exact ⟨region_isOpen hq, ⟨er.trans erq⟩⟩ + +/-- A surjective collapse inside a two-cell drawing preserves its +two-cell property. This is the contraction step of XII (7.3), +page 261, before the empty-disc cleanup. -/ +theorem isTwoCell_image_of_collapse + {S : Type*} [TopologicalSpace S] [T2Space S] [CompactSpace S] + [LocallyConnectedSpace S] {K H : Drawing S} + (hK : (PaintingOrDrawing.drawing K).IsTwoCell) + {A : Set S} (hAK : A ⊆ K.U) (f : C(S, S)) (hsurj : Function.Surjective f) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ (x ∈ A ∧ y ∈ A)) + (hHU : H.U = f '' K.U) : (PaintingOrDrawing.drawing H).IsTwoCell := by + obtain ⟨e, _⟩ := exists_homeomorph_collapse_complement hAK f hsurj hfibre + exact isTwoCell_of_complement_homeomorph hK + (e.trans (Homeomorph.setCongr (congrArg compl hHU.symm))) + +/-- The radial-star image drawing is two-cell before parallel +spokes bounding empty discs are deleted. This is the topological +contraction used in XII (7.3), page 261. -/ +theorem radial_star_image_isTwoCell + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K H : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {v : S} (hv : v ∈ Γ.V) (f : C(S, S)) (hsurj : Function.Surjective f) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + (hHU : H.U = f '' K.U) : (PaintingOrDrawing.drawing H).IsTwoCell := by + let : CompactSpace S := hS.1 + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hAK : {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e ⊆ K.U := by + intro x hx + rcases hx with rfl | hx + · exact K.V_subset_U (hK.2.1.2.1 hv) + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact K.closure_subset_U he.1 hxe + exact isTwoCell_image_of_collapse + (radial_isTwoCell_of_drawing hS hK) hAK f hsurj hfibre hHU + +/-- Every region of a collapsed drawing is exactly the image of an +old region, with the collapse restricting to a homeomorphism there. +This locates the faces used in the empty-disc cleanup of XII (7.3), +page 261. -/ +theorem exists_region_image_of_collapse + {S : Type*} [TopologicalSpace S] [T2Space S] [CompactSpace S] + {K H : Drawing S} {A : Set S} (hAK : A ⊆ K.U) + (f : C(S, S)) (hsurj : Function.Surjective f) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ (x ∈ A ∧ y ∈ A)) + (hHU : H.U = f '' K.U) {q : Set S} (hq : q ∈ H.R) : + ∃ r ∈ K.R, q = f '' r ∧ Nonempty (r ≃ₜ q) := by + obtain ⟨e, he⟩ := exists_homeomorph_collapse_complement hAK f hsurj hfibre + let e' : ↥(K.Uᶜ) ≃ₜ ↥(H.Uᶜ) := + e.trans (Homeomorph.setCongr (congrArg compl hHU.symm)) + have he' : ∀ x : ↥(K.Uᶜ), (e' x).val = f x := he + obtain ⟨r, hr, h, hh⟩ := exists_region_homeomorph_of_complement e' hq + have hmap : ∀ x : r, (h x).val = f x := fun x => + (hh x).trans (he' ⟨x.val, region_subset hr x.property⟩) + refine ⟨r, hr, ?_, ⟨h⟩⟩ + apply Eq.symm + apply Subset.antisymm + · rintro y ⟨x, hxr, rfl⟩ + rw [← hmap ⟨x, hxr⟩] + exact (h ⟨x, hxr⟩).property + · intro y hyq + let x : r := h.symm ⟨y, hyq⟩ + exact ⟨x.val, x.property, + (hmap x).symm.trans (congrArg Subtype.val (h.apply_symm_apply ⟨y, hyq⟩))⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CircleArcFibres.lean b/LeanPool/GraphMinor/GM12/Section73CircleArcFibres.lean new file mode 100644 index 0000000000..9b530e4deb --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CircleArcFibres.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73ArcCollapseCircle +public import LeanPool.GraphMinor.GM12.Section73CircleComplement +import LeanPool.GraphMinor.GM11.Forest +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Circle parameters when the collapsed fibre is an arc + +For XII (7.3), Claim (1), page 262, the old circuit meets the +collapsed star in one arc. Split its circle into that arc and +the complementary arc. The exact fibre condition makes the image +of the complementary arc injective except at its ends. Its image +is the whole new circle, since the collapsed arc contributes only +the common endpoint. Removing the constant arc gives the required +homotopy of parameterized curves. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- If a collapse meets an old circle in an arc, its image circle +has an embedded parameterization homotopic to the collapsed old +parameterization. This is the arc-fibre case used for the selected +disc comparison in XII (7.3), Claim (1), page 262. -/ +theorem exists_circle_parameters_of_arc_fibre + {S : Type*} [TopologicalSpace S] [T2Space S] + {F A Z : Set S} {p q : S} (hF : IsOArc F) + (hL : IsLineWithEnds (F ∩ A) p q) (f : C(S, S)) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ (x ∈ A ∧ y ∈ A)) + (hZ : f '' F ⊆ Z) : + ∃ φ ψ : C(Circle, S), IsEmbedding φ ∧ IsEmbedding ψ ∧ + range φ = F ∧ range ψ = f '' F ∧ + ClosedCurvesHomotopicIn Z (f.comp φ) ψ := by + obtain ⟨B, hB, hFB, hcap⟩ := exists_complementary_line_in_circle hF hL inter_subset_left + obtain ⟨a, ha, hArange, ha₀, ha₁⟩ := hL.exists_arc + obtain ⟨b, hb, hBrange, hb₀, hb₁⟩ := (GM11.IsLineWithEnds.symm hB).exists_arc + let α : Path p q := ⟨⟨a, ha.1⟩, ha₀, ha₁⟩ + let β : Path q p := ⟨⟨b, hb.1⟩, hb₀, hb₁⟩ + have hαrange : range α = F ∩ A := hArange + have hβrange : range β = B := hBrange + have hαA : range α ⊆ A := hαrange ▸ inter_subset_right + have hβA : range β ∩ A ⊆ {p, q} := by + rw [hβrange] + rintro x ⟨hxB, hxA⟩ + have hxF : x ∈ F := hFB ▸ Or.inr hxB + exact hcap.subset ⟨⟨hxF, hxA⟩, hxB⟩ + have hαβ : range α ∩ range β ⊆ {p, q} := by rw [hαrange, hβrange, hcap] + obtain ⟨φ, ψ, hφ, hψ, hφrange, hψrange, hh⟩ := + exists_circle_parameters_of_collapse_fibres α β ha.2 hb.2 hαβ hαA hβA f hfibre + ((image_mono (show range β ⊆ F by rw [hβrange]; exact fun x hx => hFB ▸ Or.inr hx)).trans hZ) + have hpA : p ∈ A := hL.left_mem.2 + have hsmall : f '' (F ∩ A) ⊆ f '' B := by + rintro x ⟨y, hy, rfl⟩ + have hfp : f y = f p := (hfibre _ _).mpr (Or.inr ⟨hy.2, hpA⟩) + exact ⟨p, hB.left_mem, hfp.symm⟩ + have hBimage : f '' B = f '' F := by + rw [← hFB, image_union, union_eq_right.mpr hsmall] + refine ⟨φ, ψ, hφ, hψ, ?_, ?_, hh⟩ + · rw [hφrange, hαrange, hβrange, hFB] + · rw [hψrange, hβrange, hBimage] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CircleComplement.lean b/LeanPool/GraphMinor/GM12/Section73CircleComplement.lean new file mode 100644 index 0000000000..465fc7619e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CircleComplement.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.CutLift +import LeanPool.GraphMinor.Surface.EdgeLoop +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# The complementary arc of a line in a circle + +For XII (7.3), Claim (1), page 262, remove the arc of the old +circuit that is collapsed into the new hub. Its complement closes +to the other arc of that circle. Split the circle at the two +ends. The interior of the given line is connected, so it lies +in one of the two resulting arcs. A connected subset of a line +containing both ends is the whole line. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- A line contained in a circle has a complementary line with +the same ends. This splits the old circuit at its collapsed arc +in XII (7.3), Claim (1), page 262. -/ +theorem exists_complementary_line_in_circle + {S : Type*} [TopologicalSpace S] [T2Space S] + {F L : Set S} {p q : S} (hF : IsOArc F) (hL : IsLineWithEnds L p q) + (hLF : L ⊆ F) : + ∃ B : Set S, IsLineWithEnds B p q ∧ L ∪ B = F ∧ L ∩ B = {p, q} := by + obtain ⟨a, ha, hrange, h₀, h₁⟩ := hL.exists_arc + have hpq : p ≠ q := by + intro hpq + have heq := ha.2 (h₀.trans (hpq.trans h₁.symm)) + exact (zero_ne_one : (0 : unitInterval) ≠ 1) heq + obtain ⟨A, B, hA, hB, hAB, hcap⟩ := hF.lines (hLF hL.left_mem) (hLF hL.right_mem) hpq + have hpre : IsPreconnected (L \ {p, q}) := GM11.IsLineWithEnds.isPreconnected_sdiff_pair hL + have hcover : L \ {p, q} ⊆ A ∪ B := fun x hx => hAB.symm ▸ hLF hx.1 + have hside : L \ {p, q} ⊆ A ∨ L \ {p, q} ⊆ B := by + by_cases hmeet : ((L \ {p, q}) ∩ A).Nonempty + · left + intro x hx + by_contra hxn + have hxB := (hcover hx).resolve_left hxn + obtain ⟨z, hzL, hzA, hzB⟩ := isPreconnected_closed_iff.mp hpre A B + hA.isCompact.isClosed hB.isCompact.isClosed hcover hmeet ⟨x, hx, hxB⟩ + exact hzL.2 (hcap.subset ⟨hzA, hzB⟩) + · right + intro x hx + exact (hcover hx).resolve_left (fun hxA => hmeet ⟨x, hx, hxA⟩) + have hpreL : IsPreconnected L := hrange ▸ isPreconnected_range ha.1 + have extend : ∀ (C : Set S), p ∈ C → q ∈ C → L \ {p, q} ⊆ C → L ⊆ C := by + intro C hpC hqC hsub x hx + by_cases hxpq : x ∈ ({p, q} : Set S) + · rcases hxpq with rfl | rfl + · exact hpC + · exact hqC + · exact hsub ⟨hx, hxpq⟩ + rcases hside with hLA | hLB + · have hLA' := extend A hA.left_mem hA.right_mem hLA + have hEq := hA.eq_of_subset hpreL hLA' hL.left_mem hL.right_mem + exact ⟨B, hB, hEq.symm ▸ hAB, hEq.symm ▸ hcap⟩ + · have hLB' := extend B hB.left_mem hB.right_mem hLB + have hEq := hB.eq_of_subset hpreL hLB' hL.left_mem hL.right_mem + exact ⟨A, hA, hEq.symm ▸ (union_comm A B ▸ hAB), + hEq.symm ▸ (inter_comm A B ▸ hcap)⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CircleFibreParameters.lean b/LeanPool/GraphMinor/GM12/Section73CircleFibreParameters.lean new file mode 100644 index 0000000000..d44d9a8d3f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CircleFibreParameters.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73CircleArcFibres +import Mathlib.Topology.Separation.Hausdorff + +/-! +# Circle parameters for the two kinds of circuit fibre + +In XII (7.3), Claim (1), page 262, the old circuit meets the +collapsed star in either one point or one arc. In the point case +the collapse remains injective on the circle. The arc case uses +the complementary-arc parameterization and the homotopy removing +the constant arc. Both give embedded old and new parameters and +a homotopy from the collapsed old parameter to the new one. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Choose embedded boundary parameters before and after a +collapse whose intersection with the old circle is a point or +an arc. This treats both circuit alternatives in XII (7.3), +Claim (1), page 262. -/ +theorem exists_circle_parameters_of_fibre_shape + {S : Type*} [TopologicalSpace S] [T2Space S] + {F A Z : Set S} (hF : IsOArc F) + (hshape : (F ∩ A).Subsingleton ∨ ∃ p q, IsLineWithEnds (F ∩ A) p q) + (f : C(S, S)) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ (x ∈ A ∧ y ∈ A)) + (hZ : f '' F ⊆ Z) : + ∃ φ ψ : C(Circle, S), IsEmbedding φ ∧ IsEmbedding ψ ∧ + range φ = F ∧ range ψ = f '' F ∧ + ClosedCurvesHomotopicIn Z (f.comp φ) ψ := by + rcases hshape with hsingle | ⟨p, q, hline⟩ + · obtain ⟨e⟩ := hF + let φ : C(Circle, S) := ⟨fun z => (e z).val, continuous_subtype_val.comp e.continuous⟩ + have hφ : IsEmbedding φ := IsEmbedding.subtypeVal.comp e.isEmbedding + have hrange : range φ = F := by + ext x + constructor + · rintro ⟨z, rfl⟩ + exact (e z).property + · intro hx + exact ⟨e.symm ⟨x, hx⟩, congrArg Subtype.val (e.apply_symm_apply _)⟩ + let ψ : C(Circle, S) := f.comp φ + have hinj : Function.Injective ψ := by + intro z w heq + rcases (hfibre (φ z) (φ w)).mp heq with heq | hA + · exact hφ.injective heq + · exact hφ.injective (hsingle ⟨(e z).property, hA.1⟩ ⟨(e w).property, hA.2⟩) + have hψrange : range ψ = f '' F := by + change range (f ∘ φ) = _ + rw [range_comp, hrange] + refine ⟨φ, ψ, hφ, (ψ.continuous.isClosedEmbedding hinj).isEmbedding, hrange, hψrange, ?_⟩ + let H : C(Circle × unitInterval, S) := ⟨fun w => ψ w.1, by fun_prop⟩ + exact ⟨H, fun w => hZ (hψrange ▸ mem_range_self w.1), fun _ => rfl, fun _ => rfl⟩ + · exact exists_circle_parameters_of_arc_fibre hF hline f hfibre hZ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CircuitJoin.lean b/LeanPool/GraphMinor/GM12/Section73CircuitJoin.lean new file mode 100644 index 0000000000..9bdb66cf1e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CircuitJoin.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73CircuitVisitCount +public import LeanPool.GraphMinor.GM12.Section73DiscAttachment +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.Ties + +/-! +# Joining the boundary walks of disc pieces + +The two-disc tie in XII (7.3), page 262, is enclosed by joining +the two circuit walks at their common vertex. Each circuit walk +visits a vertex at most once, so their concatenation visits it at +most twice. Their edges are disjoint, since the circuits meet in +only one point. Their total length is therefore bounded by the +length of any walk containing both circuits. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The circuit visit bound with a prescribed starting vertex. -/ +theorem exists_circuit_walk_at_with_visit_bound + {S : Type*} [TopologicalSpace S] [T1Space S] {K C : Drawing S} {p : S} + (hC : C.IsCircuit) (hCK : C.IsSubdrawing K) (hpC : p ∈ C.V) : + ∃ W : GraphWalk K.toGraph p p, walkDrawing K W = C ∧ + W.length = C.length ∧ ∀ v, walkVertexCount v W ≤ 1 := by + obtain ⟨P, hP, _, hV, hE⟩ := exists_walk_at hC hpC + obtain ⟨W, hWS, hWE⟩ := hCK.exists_walk_up P + have hW : W.IsSimpleClosed := by + change W.support.tail.Nodup ∧ W.edges.Nodup + rw [hWS, hWE] + exact hP + have hdraw : walkDrawing K W = C := by + apply Drawing.ext_of_V_E + · rw [walkDrawing_V, hWS, hV] + · rw [walkDrawing_E, hWE, hE] + have hlen : W.length = C.length := by + change W.edges.length = C.E.ncard + rw [hWE, hE] + have hset : {e | e ∈ P.edges} = (P.edges.toFinset : Set (Set S)) := by ext e; simp + rw [hset, ncard_coe_finset, List.toFinset_card_of_nodup hP.2] + exact ⟨W, hdraw, hlen, walkVertexCount_le_one_of_isSimpleClosed hW⟩ + +/-- Subdrawings meeting in at most one point have disjoint edge +sets. A common edge would put its interior point in the vertex set. -/ +theorem disjoint_edges_of_subsingleton_inter + {S : Type*} [TopologicalSpace S] [T2Space S] {K C D : Drawing S} + (hCK : C.IsSubdrawing K) (hDK : D.IsSubdrawing K) + (hCD : (C.U ∩ D.U).Subsingleton) : Disjoint C.E D.E := by + apply disjoint_left.mpr + intro e heC heD + obtain ⟨p, hpe⟩ := heC.1 + have hpC : p ∈ C.U := (heC.2.1 hpe).1 + have hpD : p ∈ D.U := (heD.2.1 hpe).1 + have hpV := mem_vertices_of_subdrawing_inter_singleton hCK hDK hpC hpD + (fun x hx => hCD hx ⟨hpC, hpD⟩) + exact ((hCK.2 heC).2.1 hpe).2 hpV + +/-- The lengths of two edge-disjoint circuits contained in a walk +sum to at most the length of the walk. -/ +theorem circuit_lengths_add_le_walk_length + {S : Type*} [TopologicalSpace S] [T1Space S] {K C D : Drawing S} + {u : S} (W : GraphWalk K.toGraph u u) + (hCW : C.IsSubdrawing (walkDrawing K W)) + (hDW : D.IsSubdrawing (walkDrawing K W)) (hE : Disjoint C.E D.E) : + C.length + D.length ≤ W.length := by + change C.E.ncard + D.E.ncard ≤ W.edges.length + rw [← ncard_union_eq hE C.finite_edges D.finite_edges] + apply (ncard_le_ncard (fun e he => ?_) W.edges.finite_toSet).trans (ncard_mem_list_le W.edges) + rcases he with he | he + · have hh := hCW.2 he + rwa [walkDrawing_E] at hh + · have hh := hDW.2 he + rwa [walkDrawing_E] at hh + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CircuitLift.lean b/LeanPool/GraphMinor/GM12/Section73CircuitLift.lean new file mode 100644 index 0000000000..4b41947542 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CircuitLift.lean @@ -0,0 +1,315 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73WalkLiftEdges +public import LeanPool.GraphMinor.GM12.Section73SplicedCircuit +import LeanPool.GraphMinor.GM12.Section73CircuitPath +import LeanPool.GraphMinor.GM12.Section73UnchangedCircuit +import LeanPool.GraphMinor.GM12.Section73DrawingImages +import LeanPool.GraphMinor.GM12.Section73RadialSpliceFibre +import LeanPool.GraphMinor.GM11.CircuitRegions +import LeanPool.GraphMinor.GM11.RadialBasics + +/-! +# The old circuit inside the constructed lifted walk + +For XII (7.3), Claim (1), page 262, remove the two new spokes +at the merged hub from the circuit. Lift the remaining path +unchanged and recover the two old region hubs. The replacement +edges recorded by the lifted walk contain the required two- or +four-edge splice. This constructs the old circuit inside that +walk, with the paper's length and deleted-vertex alternatives. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +open Classical in +private theorem spliced_lift_edges_map_into_circuit + {S : Type*} + [TopologicalSpace S] + [T2Space S] + {K : Drawing S} + {v : S} + (f : C(S, S)) + {C : Drawing S} + (x : S) + (y : S) + (e : Set S) + (e' : Set S) + (Q : GraphWalk K.toGraph x y) + (g : Set S) + (p : S) + (hfg : ⇑f '' g = e) + (g' : Set S) + (q : S) + (hfg' : ⇑f '' g' = e') + (k : Set S) + (hk : k ∈ K.E) + (hkl : K.toGraph.IsLink k v p) + (k' : Set S) + (hk' : k' ∈ K.E) + (hkl' : K.toGraph.IsLink k' v q) + (D : Drawing S) + (hDE : D.E = if p = q then insert g (insert g' {e | e ∈ Q.edges}) else insert k (insert g + (insert g' (insert k' {e | e ∈ Q.edges})))) + (heC : e ∈ C.E) + (heC' : e' ∈ C.E) + (hQimg : ⇑f '' (walkDrawing K Q).U ⊆ C.U) + (hStarImg : ∀ s ∈ K.E, v ∈ closure s → ⇑f '' s ⊆ C.U) : + ∀ s ∈ D.E, ⇑f '' s ⊆ C.U := by + intro s hs + have hsCases : s = k ∨ s = g ∨ s = g' ∨ s = k' ∨ s ∈ Q.edges := by + rw [hDE] at hs + by_cases hpq : p = q + · rw [ite_eq_left hpq] at hs + rcases hs with rfl | rfl | hs + · exact Or.inr (Or.inl rfl) + · exact Or.inr (Or.inr (Or.inl rfl)) + · exact Or.inr (Or.inr (Or.inr (Or.inr hs))) + · rw [ite_eq_right hpq] at hs + exact hs + rcases hsCases with hsEq | hsEq | hsEq | hsEq | hs + · subst s + exact hStarImg k hk (hkl.2.2.2.superset (Or.inl rfl)).1 + · subst s + rw [hfg]; exact fun z hz => (heC.2.1 hz).1 + · subst s + rw [hfg']; exact fun z hz => (heC'.2.1 hz).1 + · subst s + exact hStarImg k' hk' (hkl'.2.2.2.superset (Or.inl rfl)).1 + · apply (image_mono (show s ⊆ (walkDrawing K Q).U from ?_)).trans hQimg + have hsQ : s ∈ (walkDrawing K Q).E := by rw [walkDrawing_E]; exact hs + exact fun z hz => (hsQ.2.1 hz).1 + +/-- Construct the old circuit in the hub case of XII (7.3), +Claim (1), page 262, inside the actual lifted walk. Its length +is the new circuit's length plus twice `ε`, with `ε` at most +one; when `ε = 1`, the old circuit contains the deleted vertex. -/ +theorem exists_circuit_in_lifted_walk_through_hub + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K J : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + (f : C(S, S)) (hfix : ∀ x ∉ r', f x = x) + (hcollapse : ∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + (hJV : J.V = f '' K.V) + (hJE : J.E ⊆ (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g}) + (hJpre : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsPreRadialDrawing J) + (hJtwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) + {a : S} (W : GraphWalk J.toGraph a a) (W' : GraphWalk K.toGraph a a) + (hpoints : (walkDrawing K W').U \ r' = (walkDrawing J W).U \ r') + (hedges : ∀ e ∈ W.edges, ∀ g ∈ spokeReplacementEdges K J v f e, g ∈ W'.edges) + {C : Drawing S} (hC : C.IsCircuit) (hCW : C.IsSubdrawing (walkDrawing J W)) + (hvC : v ∈ C.V) : + ∃ (D : Drawing S) (ε : ℕ), D.IsCircuit ∧ D.IsSubdrawing (walkDrawing K W') ∧ + ε ≤ 1 ∧ D.length = C.length + 2 * ε ∧ (ε = 1 → v ∈ D.V) ∧ + f '' D.U = C.U ∧ + ((D.U ∩ ({v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)).Subsingleton ∨ + ∃ p q, IsLineWithEnds + (D.U ∩ ({v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) p q) := by + classical + let : CompactSpace S := hS.1 + have hCJ : C.IsSubdrawing J := hCW.trans (walkDrawing_isSubdrawing J W) + have hV : J.V ⊆ K.V := by + intro x hx + rw [hJV, image_radial_vertices_eq hS hK hE hv hr' hvr' hfix hcollapse] at hx + rcases hx with hx | hxv + · exact hx.1 + · exact hxv ▸ hK.2.1.2.1 hv + have hvJ : v ∈ J.V := hCJ.1 hvC + have hretain : ∀ e x y, J.toGraph.IsLink e x y → x ≠ v → y ≠ v → e ∈ K.E := by + intro e x y hel + obtain ⟨_, _, _, _, hret⟩ := exists_edge_walk_lift hS hK hE hv hr' hvr' + f hfix hcollapse hfibre hJV hJE hel + exact hret + have hloop : ∀ e x y, J.toGraph.IsLink e x y → x ≠ y := by + intro e x y hel hxy + subst y + have hb := bipartite_of_preRadial hJpre e x x hel + by_cases hx : x ∈ (deleteVertices Γ {v}).V + · exact (hb.mp hx) hx + · exact hx (hb.mpr hx) + obtain ⟨x, y, e, e', hel, hel', P, hP, hvP, hee, _, _, hCV, hCE, hClen⟩ := + exists_circuit_path_in_drawing hC hCJ hloop hvC + obtain ⟨Q, hQS, hQE, hQout⟩ := exists_unchanged_path_lift hS ⟨hJtwo, hJpre⟩ + hr' hvr' hvJ hV hretain P hvP + have hQsimple : Q.IsSimple := by change Q.support.Nodup; rw [hQS]; exact hP + have hQlen : Q.length = P.length := congrArg List.length hQE + obtain ⟨g, p, hg, hvg, hfg, hpr, hpK, hpn, _, hgl⟩ := + exists_old_spoke_at_contracted_vertex hS hK hv hr' f hfix hfibre hJV hJE hel + obtain ⟨g', q, hg', hvg', hfg', hqr, hqK, hqn, _, hgl'⟩ := + exists_old_spoke_at_contracted_vertex hS hK hv hr' f hfix hfibre hJV hJE hel'.symm + obtain ⟨k, hk, hkl⟩ := exists_spoke_to_hub_in_deleted_region hS hK hE hv hr' hvr' hpK hpn hpr + obtain ⟨k', hk', hkl'⟩ := exists_spoke_to_hub_in_deleted_region hS hK hE hv hr' hvr' hqK hqn hqr + have hpQ : p ∉ Q.support := fun hpQ => hQout p hpQ hpr + have hqQ : q ∉ Q.support := fun hqQ => hQout q hqQ hqr + have hvQ : v ∉ Q.support := fun hvQ => hQout v hvQ hvr' + have hpv : p ≠ v := fun hpv => hpn (hpv ▸ hv) + have hqv : q ≠ v := fun hqv => hqn (hqv ▸ hv) + have hgg : g ≠ g' := by + intro hgg + exact hee (hfg.symm.trans ((congrArg (image f) hgg).trans hfg')) + have heW : e ∈ W.edges := by + have heC : e ∈ C.E := by rw [hCE]; exact Or.inl rfl + have heD := hCW.2 heC + rw [walkDrawing_E] at heD + exact heD + have heW' : e' ∈ W.edges := by + have heC : e' ∈ C.E := by rw [hCE]; exact Or.inr (Or.inl rfl) + have heD := hCW.2 heC + rw [walkDrawing_E] at heD + exact heD + have hgN : g ∈ (walkDrawing K W').E := by + rw [walkDrawing_E] + exact hedges e heW g ⟨x, g, p, hel, hvg, hfg, hgl, Or.inl rfl⟩ + have hkN : k ∈ (walkDrawing K W').E := by + rw [walkDrawing_E] + exact hedges e heW k ⟨x, g, p, hel, hvg, hfg, hgl, Or.inr hkl⟩ + have hgN' : g' ∈ (walkDrawing K W').E := by + rw [walkDrawing_E] + exact hedges e' heW' g' ⟨y, g', q, hel'.symm, hvg', hfg', hgl', Or.inl rfl⟩ + have hkN' : k' ∈ (walkDrawing K W').E := by + rw [walkDrawing_E] + exact hedges e' heW' k' ⟨y, g', q, hel'.symm, hvg', hfg', hgl', Or.inr hkl'⟩ + have hPD : (walkDrawing J P).IsSubdrawing C := by + constructor + · rw [walkDrawing_V, hCV] + exact fun z hz => Or.inr hz + · rw [walkDrawing_E, hCE] + exact fun d hd => Or.inr (Or.inr hd) + have hQP : walkDrawing K Q = walkDrawing J P := by + apply Drawing.ext_of_V_E + · rw [walkDrawing_V, walkDrawing_V, hQS] + · rw [walkDrawing_E, walkDrawing_E, hQE] + have hdis := subdrawing_disjoint_region_of_notMem_hub hS ⟨hJtwo, hJpre⟩ hr' hvr' hvJ + (walkDrawing_isSubdrawing J P) (by rw [walkDrawing_V]; exact hvP) + have hQU : (walkDrawing K Q).U ⊆ (walkDrawing K W').U := by + rw [hQP] + intro z hz + have hzn : z ∉ r' := fun hzr => disjoint_left.mp hdis hz hzr + have hzW : z ∈ (walkDrawing J W).U \ r' := ⟨hCW.U_subset (hPD.U_subset hz), hzn⟩ + rw [← hpoints] at hzW + exact hzW.1 + have hQN := isSubdrawing_of_U_subset_common (walkDrawing_isSubdrawing K Q) + (walkDrawing_isSubdrawing K W') hQU + have hQedges : ∀ d ∈ Q.edges, d ∈ (walkDrawing K W').E := by + intro d hd + apply hQN.2 + rw [walkDrawing_E] + exact hd + obtain ⟨D, hD, hDN, hDlen, hDV, hDE⟩ := exists_spliced_circuit_in_subdrawing + (walkDrawing_isSubdrawing K W') hkl hgl hgl'.symm hkl'.symm Q hQsimple + hpQ hqQ hvQ hpv hqv hgg hkN hgN hgN' hkN' hQedges + have hQfix : ∀ z ∈ (walkDrawing K Q).U, f z = z := by + rw [hQP] + exact fun z hz => hfix z (fun hzr => disjoint_left.mp hdis hz hzr) + have hfp : f p = v := hcollapse p (Or.inr (mem_iUnion₂.mpr + ⟨k, ⟨hk, (hkl.2.2.2.superset (Or.inl rfl)).1⟩, + (hkl.2.2.2.superset (Or.inr rfl)).1⟩)) + have hfq : f q = v := hcollapse q (Or.inr (mem_iUnion₂.mpr + ⟨k', ⟨hk', (hkl'.2.2.2.superset (Or.inl rfl)).1⟩, + (hkl'.2.2.2.superset (Or.inr rfl)).1⟩)) + have hfv : f v = v := hcollapse v (Or.inl rfl) + have hQV : ∀ z ∈ Q.support, z ∈ D.V := by + intro z hz + rw [hDV] + exact Or.inl (Or.inl hz) + have hQE_D : ∀ d ∈ Q.edges, d ∈ D.E := by + intro d hd + rw [hDE] + split_ifs <;> simp only [mem_insert_iff, mem_ofPred_eq] <;> tauto + have hgD : g ∈ D.E := by + rw [hDE] + split_ifs <;> simp only [mem_insert_iff, mem_ofPred_eq] <;> tauto + have hgD' : g' ∈ D.E := by + rw [hDE] + split_ifs <;> simp only [mem_insert_iff, mem_ofPred_eq] <;> tauto + have heC : e ∈ C.E := by rw [hCE]; exact Or.inl rfl + have heC' : e' ∈ C.E := by rw [hCE]; exact Or.inr (Or.inl rfl) + have hQV_C : ∀ z ∈ Q.support, z ∈ C.V := by + intro z hz + rw [hCV] + exact Or.inr (hQS ▸ hz) + have hQimg : f '' (walkDrawing K Q).U ⊆ C.U := by + rintro z ⟨w, hw, rfl⟩ + rw [hQfix w hw] + rw [hQP] at hw + exact hPD.U_subset hw + have hStarImg : ∀ s ∈ K.E, v ∈ closure s → f '' s ⊆ C.U := by + intro s hs hvs z hz + obtain ⟨w, hws, rfl⟩ := hz + rw [hcollapse w (Or.inr (mem_iUnion₂.mpr ⟨s, ⟨hs, hvs⟩, subset_closure hws⟩))] + exact C.V_subset_U hvC + have hVimage : f '' D.V ⊆ C.U := by + rintro z ⟨w, hw, rfl⟩ + have hwCases : w ∈ Q.support ∨ w = p ∨ w = q ∨ w = v := by + rw [hDV] at hw + by_cases hpq : p = q + · rw [ite_eq_left hpq] at hw + simp only [mem_union, mem_ofPred_eq, mem_insert_iff, mem_singleton_iff, + mem_empty_iff_false, or_false] at hw + tauto + · rw [ite_eq_right hpq] at hw + simp only [mem_union, mem_ofPred_eq, mem_insert_iff, mem_singleton_iff] at hw + tauto + rcases hwCases with hw | rfl | rfl | rfl + · have hwDraw : w ∈ (walkDrawing K Q).V := by rw [walkDrawing_V]; exact hw + rw [hQfix w ((walkDrawing K Q).V_subset_U hwDraw)] + exact C.V_subset_U (hQV_C w hw) + · rw [hfp]; exact C.V_subset_U hvC + · rw [hfq]; exact C.V_subset_U hvC + · rw [hfv]; exact C.V_subset_U hvC + have hEimage : ∀ s ∈ D.E, f '' s ⊆ C.U := by + exact spliced_lift_edges_map_into_circuit (S := S) (K := K) (v := v) f (C := C) x y e e' Q g p + hfg g' q hfg' k hk hkl k' hk' hkl' D hDE heC heC' hQimg hStarImg + have hVback : C.V ⊆ f '' D.U := by + intro z hz + rw [hCV] at hz + rcases hz with rfl | hz + · have hpD : p ∈ D.V := by rw [hDV]; exact Or.inl (Or.inr (Or.inl rfl)) + exact ⟨p, D.V_subset_U hpD, hfp⟩ + · have hzQ : z ∈ Q.support := hQS.symm ▸ hz + have hzDraw : z ∈ (walkDrawing K Q).V := by rw [walkDrawing_V]; exact hzQ + exact ⟨z, D.V_subset_U (hQV z hzQ), + hQfix z ((walkDrawing K Q).V_subset_U hzDraw)⟩ + have hEback : ∀ s ∈ C.E, s ⊆ f '' D.U := by + intro s hs z hz + rw [hCE] at hs + rcases hs with rfl | rfl | hs + · obtain ⟨w, hw, hfw⟩ := (hfg.symm ▸ hz : z ∈ f '' g) + exact ⟨w, (hgD.2.1 hw).1, hfw⟩ + · obtain ⟨w, hw, hfw⟩ := (hfg'.symm ▸ hz : z ∈ f '' g') + exact ⟨w, (hgD'.2.1 hw).1, hfw⟩ + · have hsQ : s ∈ Q.edges := hQE.symm ▸ hs + have hsD := hQE_D s hsQ + have hsDraw : s ∈ (walkDrawing K Q).E := by rw [walkDrawing_E]; exact hsQ + exact ⟨z, (hsD.2.1 hz).1, hQfix z ((hsDraw.2.1 hz).1)⟩ + have himage := drawing_image_eq_of_vertex_edge_images f hVimage hEimage hVback hEback + have hDisQ : Disjoint (walkDrawing K Q).U r' := hQP.symm ▸ hdis + have hshape := radial_spliced_circuit_fibre_shape hS ⟨hK.1, hK.2.1⟩ hv hr' hvr' + hkl hgl hgl' hkl' hvg hvg' Q hDisQ hDV hDE + refine ⟨D, if p = q then 0 else 1, hD, hDN, ?_, ?_, ?_, himage, hshape⟩ + · split_ifs <;> omega + · rw [hDlen, hQlen, hClen] + split_ifs <;> omega + · intro hε + have hpq : p ≠ q := by intro heq; simp only [heq, ite_true] at hε; omega + rw [hDV, ite_eq_right hpq] + exact Or.inr rfl + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CircuitPath.lean b/LeanPool/GraphMinor/GM12/Section73CircuitPath.lean new file mode 100644 index 0000000000..370cbb9fe6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CircuitPath.lean @@ -0,0 +1,129 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73CircuitWalks + +/-! +# Removing one vertex from a circuit + +For XII (7.3), Claim (1), page 262, separate the two edges at +the merged hub from the remaining path of the circuit. Rotate a +simple closed walk to that hub and remove its first and last +edges. The remaining path is simple and omits the hub. A circuit +with two parallel edges leaves a path of length zero. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A loopless circuit at a chosen vertex consists of two distinct +edges at that vertex and a simple path avoiding it. This gives +the path denoted by `C'` with its hub removed in XII (7.3), +Claim (1), page 262, including the parallel-edge case. -/ +theorem exists_circuit_path_at_vertex + {S : Type*} [TopologicalSpace S] {C : Drawing S} + (hC : C.IsCircuit) + (hloop : ∀ e x y, C.toGraph.IsLink e x y → x ≠ y) + {v : S} (hv : v ∈ C.V) : + ∃ (x y : S) (e f : Set S) (_he : C.toGraph.IsLink e v x) + (_hf : C.toGraph.IsLink f y v) (P : GraphWalk C.toGraph x y), + P.IsSimple ∧ v ∉ P.support ∧ e ≠ f ∧ e ∉ P.edges ∧ f ∉ P.edges ∧ + C.V = insert v {z | z ∈ P.support} ∧ + C.E = insert e (insert f {g | g ∈ P.edges}) ∧ C.length = P.length + 2 := by + obtain ⟨u, W, hW, hpos, hV, hE⟩ := hC + have hvW : v ∈ W.support := by simpa only [hV, mem_ofPred_eq] using hv + obtain ⟨R, hR, hlen, hmemV, hmemE⟩ := exists_simpleClosed_walk_at_vertex W hW hvW + have hClen : C.length = W.length := by + change C.E.ncard = W.edges.length + rw [hE] + have hset : {g | g ∈ W.edges} = (W.edges.toFinset : Set (Set S)) := by ext g; simp + rw [hset, ncard_coe_finset, List.toFinset_card_of_nodup hW.2] + have hRpos : 0 < R.length := hlen.symm ▸ hpos + cases hcase : R with + | nil h => rw [hcase] at hRpos; exact (Nat.lt_irrefl 0 hRpos).elim + | @cons _ x _ e he rest => + have hrestpos : 0 < rest.length := by + by_contra hnot + have hz : rest.length = 0 := Nat.eq_zero_of_not_pos hnot + have hxv := GraphWalk.eq_of_length_eq_zero hz + exact hloop e v x he hxv.symm + obtain ⟨y, f, hf, P, hlast⟩ := exists_walk_last_edge rest hrestpos + have hnd : (P.support ++ [v]).Nodup := by + have hh := hR.1 + rw [hcase, GraphWalk.support_cons, List.tail_cons, hlast, GraphWalk.support_append] at hh + exact hh + have hP : P.IsSimple := (List.nodup_append.mp hnd).1 + have hvP : v ∉ P.support := by + intro hvm + exact (List.nodup_append.mp hnd).2.2 v hvm v (by simp) rfl + have hEd : (e :: (P.edges ++ [f])).Nodup := by + have hh := hR.2 + rw [hcase, GraphWalk.edges_cons, hlast, GraphWalk.edges_append] at hh + exact hh + have heP : e ∉ P.edges := fun hem => (List.nodup_cons.mp hEd).1 (List.mem_append_left _ hem) + have hef : e ≠ f := by + intro hef + exact (List.nodup_cons.mp hEd).1 (List.mem_append_right _ (by simp [hef])) + have hfP : f ∉ P.edges := by + intro hfm + exact (List.nodup_append.mp (List.nodup_cons.mp hEd).2).2.2 f hfm f (by simp) rfl + refine ⟨x, y, e, f, he, hf, P, hP, hvP, hef, heP, hfP, ?_, ?_, ?_⟩ + · ext z + rw [hV] + change z ∈ W.support ↔ _ + rw [← hmemV z, hcase, GraphWalk.support_cons, hlast, GraphWalk.support_append] + simp only [GraphWalk.support_cons, GraphWalk.support_nil, List.tail_cons, List.mem_cons, + List.mem_append, mem_insert_iff, mem_ofPred_eq] + tauto + · ext g + rw [hE] + change g ∈ W.edges ↔ _ + rw [← hmemE g, hcase, GraphWalk.edges_cons, hlast, GraphWalk.edges_append] + simp only [GraphWalk.edges_cons, GraphWalk.edges_nil, List.mem_cons, List.mem_append, + mem_insert_iff, mem_ofPred_eq] + tauto + · rw [hClen, ← hlen, hcase, GraphWalk.length_cons, hlast, GraphWalk.length_append] + simp only [GraphWalk.length_cons, GraphWalk.length_nil] + +/-- Read the circuit path in its ambient drawing rather than in +the circuit's own graph. This is the form used for the two new +spokes and the retained path in XII (7.3), Claim (1), page 262. -/ +theorem exists_circuit_path_in_drawing + {S : Type*} [TopologicalSpace S] {J C : Drawing S} + (hC : C.IsCircuit) (hCJ : C.IsSubdrawing J) + (hloop : ∀ e x y, J.toGraph.IsLink e x y → x ≠ y) + {v : S} (hv : v ∈ C.V) : + ∃ (x y : S) (e f : Set S) (_he : J.toGraph.IsLink e v x) + (_hf : J.toGraph.IsLink f y v) (P : GraphWalk J.toGraph x y), + P.IsSimple ∧ v ∉ P.support ∧ e ≠ f ∧ e ∉ P.edges ∧ f ∉ P.edges ∧ + C.V = insert v {z | z ∈ P.support} ∧ + C.E = insert e (insert f {g | g ∈ P.edges}) ∧ C.length = P.length + 2 := by + have hloopC : ∀ e x y, C.toGraph.IsLink e x y → x ≠ y := + fun e x y h => hloop e x y ((hCJ.isLink_iff h.1).mp h) + obtain ⟨x, y, e, f, he, hf, P₀, hP₀, hvP₀, hef, heP₀, hfP₀, hV, hE, hlen⟩ := + exists_circuit_path_at_vertex hC hloopC hv + obtain ⟨P, hPS, hPE⟩ := hCJ.exists_walk_up P₀ + have hPlen : P.length = P₀.length := congrArg List.length hPE + refine ⟨x, y, e, f, (hCJ.isLink_iff he.1).mp he, (hCJ.isLink_iff hf.1).mp hf, + P, ?_, ?_, hef, ?_, ?_, ?_, ?_, ?_⟩ + · change P.support.Nodup + rw [hPS] + exact hP₀ + · rwa [hPS] + · rwa [hPE] + · rwa [hPE] + · rwa [hPS] + · rwa [hPE] + · rwa [hPlen] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CircuitSplice.lean b/LeanPool/GraphMinor/GM12/Section73CircuitSplice.lean new file mode 100644 index 0000000000..a018e0b293 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CircuitSplice.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73CircuitWalks + +/-! +# Joining the old circuit through the radial star + +In XII (7.3), Claim (1), page 262, the two replaced spokes have +either the same old middle vertex or different old middle vertices. +In the first case two edges close the retained path. In the second +case four edges close it through the deleted vertex. The middle +vertices and the deleted vertex lie outside the retained path, so +both constructions give simple closed walks. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Graph + +/-- The four-edge splice in XII (7.3), Claim (1), page 262, +closes the retained path into a simple closed walk. All its edges +belong to the path or the four specified spokes. -/ +theorem exists_simpleClosed_four_edge_splice + {α β : Type*} {G : Graph α β} {x y v p q : α} {a b c d : β} + (ha : G.IsLink a v p) (hb : G.IsLink b p x) + (hc : G.IsLink c y q) (hd : G.IsLink d q v) + (P : GraphWalk G x y) (hP : P.IsSimple) + (hp : p ∉ P.support) (hq : q ∉ P.support) (hv : v ∉ P.support) + (hpq : p ≠ q) (hpv : p ≠ v) (hqv : q ≠ v) : + ∃ W : GraphWalk G v v, W.IsSimpleClosed ∧ W.length = P.length + 4 ∧ + W.edges = a :: b :: (P.edges ++ [c, d]) ∧ + W.support = v :: p :: (P.support ++ [q, v]) := by + let Q : GraphWalk G p q := .cons hb (P.append (.cons hc (.nil hc.right_mem))) + have hQsupport : Q.support = p :: (P.support ++ [q]) := by + dsimp only [Q] + rw [GraphWalk.support_cons, GraphWalk.support_append] + rfl + have hQsimple : Q.IsSimple := by + change Q.support.Nodup + rw [hQsupport] + apply List.nodup_cons.mpr + refine ⟨?_, List.nodup_append.mpr ⟨hP, by simp, ?_⟩⟩ + · intro hpm + rcases List.mem_append.mp hpm with hpm | hpm + · exact hp hpm + · exact hpq (List.mem_singleton.mp hpm) + · intro z hz w hw hzw + have hwq : w = q := List.mem_singleton.mp hw + exact hq (hzw.trans hwq ▸ hz) + have hvQ : v ∉ Q.support := by + rw [hQsupport] + intro hvm + rcases List.mem_cons.mp hvm with hvp | hvm + · exact hpv hvp.symm + · rcases List.mem_append.mp hvm with hvm | hvm + · exact hv hvm + · exact hqv (List.mem_singleton.mp hvm).symm + have had : a ≠ d := by + intro had + have ha' : G.IsLink d v p := had ▸ ha + exact hpq (ha'.right_unique hd.symm) + let W : GraphWalk G v v := .cons ha (Q.append (.cons hd (.nil hd.right_mem))) + refine ⟨W, isSimpleClosed_close_path ha hd Q hQsimple hvQ had, ?_, ?_, ?_⟩ + · dsimp only [W, Q] + rw [GraphWalk.length_cons, GraphWalk.length_append, GraphWalk.length_cons, + GraphWalk.length_append] + simp only [GraphWalk.length_cons, GraphWalk.length_nil] + · dsimp only [W, Q] + rw [GraphWalk.edges_cons, GraphWalk.edges_append, GraphWalk.edges_cons, + GraphWalk.edges_append] + simp only [GraphWalk.edges_cons, GraphWalk.edges_nil, List.append_assoc, List.cons_append] + rfl + · dsimp only [W] + rw [GraphWalk.support_cons, GraphWalk.support_append, hQsupport] + simp only [GraphWalk.support_cons, GraphWalk.support_nil, List.tail_cons, + List.cons_append, List.append_assoc] + rfl + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CircuitVisitCount.lean b/LeanPool/GraphMinor/GM12/Section73CircuitVisitCount.lean new file mode 100644 index 0000000000..5290b3a003 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CircuitVisitCount.lean @@ -0,0 +1,120 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73WalkSubstitution +import Mathlib.Data.List.Nodup + +/-! +# Visit counts for circuit walks + +The walk selection in XII (7.3), page 262, uses XI (9.2) and +the six shapes of a tie. A disc boundary contributes a circuit +walk, which visits each vertex at most once. For a closed walk, +counting departures is the same as counting its support with the +first vertex removed. A simple closed walk has this latter list +without repetitions. This proves the needed circuit visit bound. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +open Classical in +/-- The departure count, plus the final position, is the count in +the full support list. -/ +theorem walkVertexCount_add_end_eq_count_support + {α β : Type*} {G : Graph α β} (v : α) {a b : α} (W : GraphWalk G a b) : + walkVertexCount v W + (if b = v then 1 else 0) = W.support.count v := by + induction W with + | @nil z h => by_cases hzv : z = v <;> simp [walkVertexCount, GraphWalk.support, hzv] + | @cons x y z e h P ih => + rw [walkVertexCount, GraphWalk.support_cons, List.count_cons] + by_cases hxv : x = v <;> simp [hxv] at * <;> omega + +open Classical in +/-- On a closed walk, departure counts equal the counts in the +support list with its first position removed. -/ +theorem walkVertexCount_eq_count_support_tail + {α β : Type*} {G : Graph α β} (v : α) {a : α} (W : GraphWalk G a a) : + walkVertexCount v W = W.support.tail.count v := by + have hh := walkVertexCount_add_end_eq_count_support v W + rw [W.support_eq_cons, List.count_cons] at hh + by_cases hav : a = v <;> simp [hav] at hh <;> omega + +/-- A simple closed walk visits any vertex at most once, with +visits counted before the repeated final position. This is the +disc-boundary case of the visit bounds used in XII (7.3). -/ +theorem walkVertexCount_le_one_of_isSimpleClosed + {α β : Type*} {G : Graph α β} {a : α} {W : GraphWalk G a a} + (hW : W.IsSimpleClosed) (v : α) : walkVertexCount v W ≤ 1 := by + classical + rw [walkVertexCount_eq_count_support_tail] + exact List.nodup_iff_count_le_one.mp hW.1 v + +/-- Departure counts add when walks are concatenated. -/ +theorem walkVertexCount_append + {α β : Type*} {G : Graph α β} (v : α) {a b c : α} + (P : GraphWalk G a b) (Q : GraphWalk G b c) : + walkVertexCount v (P.append Q) = walkVertexCount v P + walkVertexCount v Q := by + classical + induction P with + | nil h => simp only [GraphWalk.append, walkVertexCount, Nat.zero_add] + | cons h R ih => + change (if _ = v then 1 else 0) + walkVertexCount v (R.append Q) = _ + rw [ih, walkVertexCount] + exact (Nat.add_assoc _ _ _).symm + +/-- Traversing a simple path and returning along it visits every +vertex at most twice, and an endpoint at most once. These are the +line contributions to the tie bounds used in XII (7.3), page 262. -/ +theorem walkVertexCount_backtrack_bounds + {α β : Type*} {G : Graph α β} {a b : α} (P : GraphWalk G a b) (hP : P.IsSimple) + (v : α) : walkVertexCount v (P.append P.reverse) ≤ 2 ∧ + (v = a ∨ v = b → walkVertexCount v (P.append P.reverse) ≤ 1) := by + classical + have hcount : P.support.count v ≤ 1 := List.nodup_iff_count_le_one.mp hP v + have h₁ := walkVertexCount_add_end_eq_count_support v P + have h₂ := walkVertexCount_add_end_eq_count_support v P.reverse + rw [GraphWalk.support_reverse, List.count_reverse] at h₂ + rw [walkVertexCount_append] + constructor + · omega + · rintro (rfl | rfl) <;> simp only [ite_true] at h₁ h₂ <;> omega + +/-- A circuit has a closed walk in its ambient drawing of exactly +its length, with the same underlying drawing and at most one +visit to every vertex. This supplies the circuit walks in the +tie argument used by XII (7.3), page 262. -/ +theorem exists_circuit_walk_with_visit_bound + {S : Type*} [TopologicalSpace S] [T1Space S] {K C : Drawing S} + (hC : C.IsCircuit) (hCK : C.IsSubdrawing K) : + ∃ (a : S) (W : GraphWalk K.toGraph a a), walkDrawing K W = C ∧ + W.length = C.length ∧ ∀ v, walkVertexCount v W ≤ 1 := by + classical + obtain ⟨a, P, hP, _, hV, hE⟩ := hC + obtain ⟨W, hWS, hWE⟩ := hCK.exists_walk_up P + have hW : W.IsSimpleClosed := by + change W.support.tail.Nodup ∧ W.edges.Nodup + rw [hWS, hWE] + exact hP + have hdraw : walkDrawing K W = C := by + apply Drawing.ext_of_V_E + · rw [walkDrawing_V, hWS, hV] + · rw [walkDrawing_E, hWE, hE] + have hlen : W.length = C.length := by + change W.edges.length = C.E.ncard + rw [hWE, hE] + have hset : {e | e ∈ P.edges} = (P.edges.toFinset : Set (Set S)) := by ext e; simp + rw [hset, ncard_coe_finset, List.toFinset_card_of_nodup hP.2] + exact ⟨a, W, hdraw, hlen, walkVertexCount_le_one_of_isSimpleClosed hW⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CircuitWalks.lean b/LeanPool/GraphMinor/GM12/Section73CircuitWalks.lean new file mode 100644 index 0000000000..4db3884dec --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CircuitWalks.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Walks + +/-! +# Reading a circuit at a chosen vertex + +For XII (7.3), Claim (1), page 262, read the new circuit from the +merged hub. Removing its first and last edge leaves a simple path. +The elementary walk lemmas here rotate a simple closed walk, +separate its final edge, and close a simple path through a new +vertex. They also cover a path with no edges, which occurs for a +two-edge circuit with parallel edges. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface Graph + +/-- Rotate a simple closed walk to any vertex of its support, +preserving its simplicity, length, and the sets of vertices and +edges. This reads the circuit at the hub in XII (7.3), Claim (1). -/ +theorem exists_simpleClosed_walk_at_vertex + {α β : Type*} {G : Graph α β} {a v : α} (W : GraphWalk G a a) + (hW : W.IsSimpleClosed) (hv : v ∈ W.support) : + ∃ V : GraphWalk G v v, V.IsSimpleClosed ∧ V.length = W.length ∧ + (∀ x, x ∈ V.support ↔ x ∈ W.support) ∧ + (∀ e, e ∈ V.edges ↔ e ∈ W.edges) := by + obtain ⟨P, Q, rfl⟩ := W.exists_append_of_mem hv + refine ⟨Q.append P, ⟨?_, ?_⟩, ?_, ?_, ?_⟩ + · have h₁ : (P.append Q).support.tail = P.support.tail ++ Q.support.tail := by + rw [GraphWalk.support_append, P.support_eq_cons] + simp + have h₂ : (Q.append P).support.tail = Q.support.tail ++ P.support.tail := by + rw [GraphWalk.support_append, Q.support_eq_cons] + simp + rw [h₂] + have hnd := hW.1 + rw [h₁] at hnd + exact List.perm_append_comm.nodup_iff.mp hnd + · rw [GraphWalk.edges_append] + have hnd := hW.2 + rw [GraphWalk.edges_append] at hnd + exact List.perm_append_comm.nodup_iff.mp hnd + · rw [GraphWalk.length_append, GraphWalk.length_append] + exact Nat.add_comm _ _ + · intro x + rw [GraphWalk.mem_support_append, GraphWalk.mem_support_append, or_comm] + · intro e + rw [GraphWalk.edges_append, GraphWalk.edges_append, List.mem_append, List.mem_append, or_comm] + +/-- Separate the final edge of a positive-length walk. This +exposes the two spokes at the hub in XII (7.3), Claim (1). -/ +theorem exists_walk_last_edge + {α β : Type*} {G : Graph α β} {a b : α} (W : GraphWalk G a b) (hpos : 0 < W.length) : + ∃ (y : α) (e : β) (h : G.IsLink e y b) (P : GraphWalk G a y), + W = P.append (.cons h (.nil h.right_mem)) := by + induction W with + | nil h => exact (Nat.lt_irrefl 0 hpos).elim + | @cons x y z e h R ih => + cases hcase : R with + | nil hz => exact ⟨x, e, h, .nil h.left_mem, rfl⟩ + | cons h' R' => + have hR : 0 < R.length := by rw [hcase, GraphWalk.length_cons]; exact Nat.zero_lt_succ _ + obtain ⟨w, f, hf, P, hP⟩ := ih hR + exact ⟨w, f, hf, .cons h P, congrArg (GraphWalk.cons h) (hcase.symm.trans hP)⟩ + +/-- Closing a simple path through a vertex outside its support +gives a simple closed walk, provided its two new edges differ. +The zero-edge path case gives a two-edge circuit. This constructs +the old circuit in XII (7.3), Claim (1), page 262. -/ +theorem isSimpleClosed_close_path + {α β : Type*} {G : Graph α β} {a b v : α} {e f : β} + (he : G.IsLink e v a) (hf : G.IsLink f b v) (P : GraphWalk G a b) + (hP : P.IsSimple) (hv : v ∉ P.support) (hef : e ≠ f) : + (GraphWalk.cons he (P.append (.cons hf (.nil hf.right_mem)))).IsSimpleClosed := by + have heP : e ∉ P.edges := fun h => hv (P.left_mem_support_of_mem_edges h he) + have hfP : f ∉ P.edges := fun h => hv (P.left_mem_support_of_mem_edges h hf.symm) + constructor + · change (P.append (.cons hf (.nil hf.right_mem))).support.Nodup + rw [GraphWalk.support_append] + change (P.support ++ [v]).Nodup + exact List.nodup_append.mpr ⟨hP, by simp, fun x hx y hy hxy => by + have hyv : y = v := List.mem_singleton.mp hy + exact hv (hxy.trans hyv ▸ hx)⟩ + · rw [GraphWalk.edges_cons, GraphWalk.edges_append] + change (e :: (P.edges ++ [f])).Nodup + apply List.nodup_cons.mpr + refine ⟨?_, List.nodup_append.mpr ⟨hP.edges_nodup, by simp, ?_⟩⟩ + · intro hem + rcases List.mem_append.mp hem with hem | hem + · exact heP hem + · exact hef (List.mem_singleton.mp hem) + · intro x hx y hy hxy + have hyf : y = f := List.mem_singleton.mp hy + exact hfP (hxy.trans hyf ▸ hx) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CollapseComplement.lean b/LeanPool/GraphMinor/GM12/Section73CollapseComplement.lean new file mode 100644 index 0000000000..c86d255c08 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CollapseComplement.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Topology.ContinuousMap.Basic +public import Mathlib.Topology.Homeomorph.Defs +import Mathlib.Topology.LocalAtTarget +import Mathlib.Topology.Compactness.Compact + +/-! +# The complement of a contracted drawing + +For the radial-star contraction in XII (7.3), page 261, the collapsed +set lies inside the drawing. The collapse therefore identifies no +points of its complement. Since a continuous map from a compact +space to a Hausdorff space is closed, the induced bijection of +complements is a homeomorphism. This lets regions pass through the +contraction without changing their topology. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology + +/-- A continuous surjective collapse supported inside a set gives +a homeomorphism of its complement to the complement of its image. +This transfers radial regions through the contraction in XII (7.3). -/ +theorem exists_homeomorph_collapse_complement + {S : Type*} [TopologicalSpace S] [CompactSpace S] [T2Space S] + {A B : Set S} (hAB : A ⊆ B) (f : C(S, S)) (hsurj : Function.Surjective f) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ (x ∈ A ∧ y ∈ A)) : + ∃ e : ↥(Bᶜ) ≃ₜ ↥((f '' B)ᶜ), ∀ x : ↥(Bᶜ), (e x).val = f x := by + have hpre : f ⁻¹' (f '' B)ᶜ = Bᶜ := by + ext x + constructor + · intro hx hxB + exact hx (mem_image_of_mem f hxB) + · rintro hx ⟨y, hyB, hyx⟩ + rcases (hfibre x y).mp hyx.symm with hxy | hAxy + · exact hx (hxy ▸ hyB) + · exact hx (hAB hAxy.1) + let p := ((f '' B)ᶜ).restrictPreimage f + have hinj : Function.Injective p := by + intro x y hxy + apply Subtype.ext + have hxy' : f x = f y := congrArg Subtype.val hxy + rcases (hfibre x y).mp hxy' with hxy' | hAxy + · exact hxy' + · exact False.elim (x.property (mem_image_of_mem f (hAB hAxy.1))) + let e := (Equiv.ofBijective p ⟨hinj, hsurj.restrictPreimage _⟩).toHomeomorphOfContinuousClosed + f.continuous.restrictPreimage (f.continuous.isClosedMap.restrictPreimage _) + refine ⟨(Homeomorph.setCongr hpre).symm.trans e, ?_⟩ + intro x + rfl + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CollapseComposition.lean b/LeanPool/GraphMinor/GM12/Section73CollapseComposition.lean new file mode 100644 index 0000000000..dcbe638a17 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CollapseComposition.lean @@ -0,0 +1,127 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Data.Set.Function + +/-! +# Composing consecutive interval contractions + +To contract an arc in XII (7.3), page 261, cover its strip axis by +short intervals and collapse them from the last to the first. If a +map collapses `A` to a point of `B` and fixes `B`, a subsequent +collapse of `B` contracts exactly `A ∪ B`. This file proves that +fibre calculation without topological assumptions. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set + +/-- Successive collapses identify exactly the union of their +collapsed sets when the first map fixes the second set. This is the +composition rule for the arc contractions in XII (7.3). -/ +theorem collapse_composition_fibres {X : Type*} {f g : X → X} {A B : Set X} {a : X} + (hf : ∀ x y, f x = f y ↔ x = y ∨ (x ∈ A ∧ y ∈ A)) + (hg : ∀ x y, g x = g y ↔ x = y ∨ (x ∈ B ∧ y ∈ B)) + (hA : ∀ x ∈ A, f x = a) (hB : ∀ x ∈ B, f x = x) (haB : a ∈ B) : + (∀ x ∈ A ∪ B, g (f x) = g a) ∧ + (∀ x y, g (f x) = g (f y) ↔ x = y ∨ (x ∈ A ∪ B ∧ y ∈ A ∪ B)) := by + have hconstant : ∀ x ∈ A ∪ B, g (f x) = g a := by + intro x hx + rcases hx with hxA | hxB + · rw [hA x hxA] + · rw [hB x hxB] + exact (hg x a).mpr (Or.inr ⟨hxB, haB⟩) + have hpre : ∀ x, f x ∈ B → x ∈ A ∪ B := by + intro x hx + have heq : f x = f (f x) := (hB (f x) hx).symm + rcases (hf x (f x)).mp heq with hxx | hAx + · exact Or.inr (hxx ▸ hx) + · exact Or.inl hAx.1 + refine ⟨hconstant, ?_⟩ + intro x y + constructor + · intro heq + rcases (hg (f x) (f y)).mp heq with hxy | hBxy + · rcases (hf x y).mp hxy with hxy | hAxy + · exact Or.inl hxy + · exact Or.inr ⟨Or.inl hAxy.1, Or.inl hAxy.2⟩ + · exact Or.inr ⟨hpre x hBxy.1, hpre y hBxy.2⟩ + · rintro (rfl | ⟨hx, hy⟩) + · rfl + · exact (hconstant x hx).trans (hconstant y hy).symm + +/-- Collapsing the image of a second set composes with an earlier +collapse to identify exactly their union, provided the earlier +collapsed value belongs to that image. This handles radial-star +contractions in XII (7.3) when the second arc has moved. -/ +theorem collapse_image_composition_fibres + {X : Type*} {f g : X → X} {A B : Set X} {a : X} + (hf : ∀ x y, f x = f y ↔ x = y ∨ (x ∈ A ∧ y ∈ A)) + (hg : ∀ x y, g x = g y ↔ x = y ∨ (x ∈ f '' B ∧ y ∈ f '' B)) + (hA : ∀ x ∈ A, f x = a) (haB : a ∈ f '' B) : + (∀ x ∈ A ∪ B, g (f x) = g a) ∧ + (∀ x y, g (f x) = g (f y) ↔ x = y ∨ (x ∈ A ∪ B ∧ y ∈ A ∪ B)) := by + have hconstant : ∀ x ∈ A ∪ B, g (f x) = g a := by + intro x hx + rcases hx with hxA | hxB + · rw [hA x hxA] + · exact (hg (f x) a).mpr (Or.inr ⟨mem_image_of_mem f hxB, haB⟩) + have hpre : ∀ x, f x ∈ f '' B → x ∈ A ∪ B := by + rintro x ⟨z, hz, hzx⟩ + rcases (hf x z).mp hzx.symm with hxz | hxA + · exact Or.inr (hxz ▸ hz) + · exact Or.inl hxA.1 + refine ⟨hconstant, ?_⟩ + intro x y + constructor + · intro heq + rcases (hg (f x) (f y)).mp heq with hxy | hBxy + · rcases (hf x y).mp hxy with hxy | hAxy + · exact Or.inl hxy + · exact Or.inr ⟨Or.inl hAxy.1, Or.inl hAxy.2⟩ + · exact Or.inr ⟨hpre x hBxy.1, hpre y hBxy.2⟩ + · rintro (rfl | ⟨hx, hy⟩) + · rfl + · exact (hconstant x hx).trans (hconstant y hy).symm + +/-- A collapse supported in a region preserves that region and +leaves every image point outside it unchanged. This records the +unchanged part of the radial drawing in XII (7.3), page 261. -/ +theorem collapse_image_diff_eq + {X : Type*} {f : X → X} {A R : Set X} + (hf : ∀ x y, f x = f y ↔ x = y ∨ (x ∈ A ∧ y ∈ A)) + (hfix : ∀ x ∉ R, f x = x) (hAR : A ⊆ R) : + (∀ x, f x ∈ R ↔ x ∈ R) ∧ (∀ B : Set X, (f '' B) \ R = B \ R) := by + have hmem : ∀ x, f x ∈ R ↔ x ∈ R := by + intro x + constructor + · intro hfx + by_contra hxn + exact hxn (hfix x hxn ▸ hfx) + · intro hx + by_contra hfxn + have heq : f x = f (f x) := (hfix (f x) hfxn).symm + rcases (hf x (f x)).mp heq with hxx | hxA + · exact hfxn (hxx ▸ hx) + · exact hfxn (hAR hxA.2) + refine ⟨hmem, ?_⟩ + intro B + apply Subset.antisymm + · rintro y ⟨⟨x, hxB, hxy⟩, hyn⟩ + have hxn : x ∉ R := fun hx => hyn (hxy ▸ (hmem x).mpr hx) + have hxy' : x = y := (hfix x hxn).symm.trans hxy + exact ⟨hxy' ▸ hxB, hyn⟩ + · rintro x ⟨hxB, hxn⟩ + exact ⟨⟨x, hxB, hfix x hxn⟩, hxn⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CollapseHomotopy.lean b/LeanPool/GraphMinor/GM12/Section73CollapseHomotopy.lean new file mode 100644 index 0000000000..9087d06d0d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CollapseHomotopy.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73DiscSupportedHomotopy +import LeanPool.GraphMinor.GM12.Section73CollapseComposition +import LeanPool.GraphMinor.GM11.Section6 +public import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# A disc-supported collapse preserves the homotopy class of a curve + +For the selected-inside comparison in XII (7.3), Claim (1), +page 262, the star lies in the interior of its supporting disc. +The exact fibre condition and the fixed outside imply that the +collapse preserves this interior. Interpolate in the supporting +disc and extend by the identity. Any curve and its collapsed +image are then homotopic while avoiding all points outside the +curve and the supporting disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A collapse whose fibres lie in a supporting disc preserves +the homotopy class of a closed curve, with the homotopy contained +in the curve together with that disc. This is the controlled +deformation used for XII (7.3), Claim (1), page 262. -/ +theorem closedCurve_homotopic_under_disc_collapse + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {D A Z : Set S} (hD : IsClosedDisc D) + (hAD : A ⊆ discInt D) (f : C(S, S)) + (hfix : ∀ x ∉ discInt D, f x = x) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ (x ∈ A ∧ y ∈ A)) + (φ : C(Circle, S)) (hφZ : range φ ⊆ Z) (hDZ : D ⊆ Z) : + ClosedCurvesHomotopicIn Z φ (f.comp φ) := by + have hint : discInt D = interior D := by + rw [discInt, ← IsClosedDisc.frontier_eq_discBd hS hD, frontier, hD.isClosed.closure_eq] + ext x + constructor + · rintro ⟨hxD, hx⟩ + by_contra hxI + exact hx ⟨hxD, hxI⟩ + · intro hxI + exact ⟨interior_subset hxI, fun hx => hx.2 hxI⟩ + have hpres := (collapse_image_diff_eq hfibre hfix hAD).1 + have hmap : ∀ x ∈ D, f x ∈ D := by + intro x hxD + by_cases hxI : x ∈ discInt D + · exact Surface.discInt_subset D ((hpres x).mpr hxI) + · exact (hfix x hxI).symm ▸ hxD + have hfix' : ∀ x ∉ interior D, f x = x := by + rw [← hint] + exact hfix + exact closedCurve_homotopic_of_disc_supported_map hD f hmap hfix' φ hφZ hDZ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CollapseInterval.lean b/LeanPool/GraphMinor/GM12/Section73CollapseInterval.lean new file mode 100644 index 0000000000..5b8cdb389a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CollapseInterval.lean @@ -0,0 +1,133 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Topology.Instances.Real.Lemmas +import Mathlib.Tactic.Linarith + +/-! +# Collapsing a real interval in strip coordinates + +For the radial-edge contractions in XII (7.3), page 261, flatten the +axis interval of a strip to its left endpoint. The map is increasing +on either side, and its only repeated values come from the flattened +interval. Interpolation with the identity is strictly increasing until +the final collapse. These facts supply the local coordinate map for +contracting a drawn edge. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set + +/-- The axis map flattening `[l,r]` to `l`, used for the local edge +contraction in XII (7.3). Outside the interval it has positive slope. -/ +def collapseInterval (l r x : ℝ) : ℝ := min x l + max (2 * (x - r)) 0 + +/-- The axis map is continuous. -/ +theorem continuous_collapseInterval (l r : ℝ) : Continuous (collapseInterval l r) := by + unfold collapseInterval + fun_prop + +/-- The axis map is monotone. -/ +theorem monotone_collapseInterval (l r : ℝ) : Monotone (collapseInterval l r) := by + intro x y hxy + apply add_le_add (min_le_min_right l hxy) + apply max_le_max _ le_rfl + exact mul_le_mul_of_nonneg_left (sub_le_sub_right hxy r) (by norm_num) + +/-- To the left of the interval, the map is the identity. -/ +theorem collapseInterval_of_le {l r x : ℝ} (hlr : l ≤ r) (hx : x ≤ l) : + collapseInterval l r x = x := by + unfold collapseInterval + rw [min_eq_left hx, max_eq_right (by linarith : 2 * (x - r) ≤ 0), add_zero] + +/-- Every point of the interval maps to its left end. -/ +theorem collapseInterval_of_mem {l r x : ℝ} (hx : x ∈ Icc l r) : + collapseInterval l r x = l := by + unfold collapseInterval + rw [min_eq_right hx.1, max_eq_right (by linarith [hx.2] : 2 * (x - r) ≤ 0), add_zero] + +/-- To the right, the map has slope two. -/ +theorem collapseInterval_of_ge {l r x : ℝ} (hlr : l ≤ r) (hx : r ≤ x) : + collapseInterval l r x = l + 2 * (x - r) := by + unfold collapseInterval + rw [min_eq_right (hlr.trans hx), max_eq_left (by linarith : 0 ≤ 2 * (x - r))] + +private theorem collapseInterval_strict {l r x y : ℝ} (hlr : l ≤ r) (hxy : x < y) + (hout : x < l ∨ r < y) : collapseInterval l r x < collapseInterval l r y := by + rcases hout with hxl | hry + · rw [collapseInterval_of_le hlr hxl.le] + by_cases hyl : y ≤ l + · rw [collapseInterval_of_le hlr hyl] + exact hxy + · have hle := monotone_collapseInterval l r (le_of_not_ge hyl) + rw [collapseInterval_of_mem ⟨le_rfl, hlr⟩] at hle + exact hxl.trans_le hle + · rw [collapseInterval_of_ge hlr hry.le] + by_cases hrx : r ≤ x + · rw [collapseInterval_of_ge hlr hrx] + linarith + · have hle := monotone_collapseInterval l r (le_of_not_ge hrx) + rw [collapseInterval_of_mem ⟨hlr, le_rfl⟩] at hle + linarith + +/-- The flattened interval is the only non-singleton fibre. -/ +theorem collapseInterval_eq_iff {l r x y : ℝ} (hlr : l ≤ r) : + collapseInterval l r x = collapseInterval l r y ↔ + x = y ∨ (x ∈ Icc l r ∧ y ∈ Icc l r) := by + constructor + · intro heq + rcases lt_trichotomy x y with hxy | hxy | hyx + · right + have hlx : l ≤ x := by + by_contra hn + exact (ne_of_lt (collapseInterval_strict hlr hxy (Or.inl (lt_of_not_ge hn)))) heq + have hyr : y ≤ r := by + by_contra hn + exact (ne_of_lt (collapseInterval_strict hlr hxy (Or.inr (lt_of_not_ge hn)))) heq + exact ⟨⟨hlx, hxy.le.trans hyr⟩, ⟨hlx.trans hxy.le, hyr⟩⟩ + · exact Or.inl hxy + · right + have hly : l ≤ y := by + by_contra hn + exact (ne_of_lt (collapseInterval_strict hlr hyx (Or.inl (lt_of_not_ge hn)))) heq.symm + have hxr : x ≤ r := by + by_contra hn + exact (ne_of_lt (collapseInterval_strict hlr hyx (Or.inr (lt_of_not_ge hn)))) heq.symm + exact ⟨⟨hly.trans hyx.le, hxr⟩, ⟨hly, hyx.le.trans hxr⟩⟩ + · rintro (rfl | ⟨hx, hy⟩) + · rfl + · rw [collapseInterval_of_mem hx, collapseInterval_of_mem hy] + +/-- Interpolation remains monotone at the final collapse. -/ +theorem collapseInterval_interpolation_monotone {l r t : ℝ} (ht : 0 ≤ t) (ht1 : t ≤ 1) : + Monotone (fun x => (1 - t) * x + t * collapseInterval l r x) := by + intro x y hxy + exact add_le_add (mul_le_mul_of_nonneg_left hxy (sub_nonneg.mpr ht1)) + (mul_le_mul_of_nonneg_left (monotone_collapseInterval l r hxy) ht) + +/-- Interpolation with the identity is strictly increasing before +the final collapse. -/ +theorem collapseInterval_interpolation_strictMono {l r t : ℝ} (ht : 0 ≤ t) (ht1 : t < 1) : + StrictMono (fun x => (1 - t) * x + t * collapseInterval l r x) := by + intro x y hxy + exact add_lt_add_of_lt_of_le (mul_lt_mul_of_pos_left hxy (sub_pos.mpr ht1)) + (mul_le_mul_of_nonneg_left (monotone_collapseInterval l r hxy.le) ht) + +/-- The strip endpoints stay fixed during interpolation. -/ +theorem collapseInterval_interpolation_endpoints {l r t : ℝ} (hlr : l ≤ r) : + ((1 - t) * (2 * l - r) + t * collapseInterval l r (2 * l - r) = 2 * l - r) ∧ + ((1 - t) * (2 * r - l) + t * collapseInterval l r (2 * r - l) = 2 * r - l) := by + rw [collapseInterval_of_le hlr (by linarith), collapseInterval_of_ge hlr (by linarith)] + constructor <;> ring + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CollapseRectangle.lean b/LeanPool/GraphMinor/GM12/Section73CollapseRectangle.lean new file mode 100644 index 0000000000..a1b879bdae --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CollapseRectangle.lean @@ -0,0 +1,155 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73CollapseInterval +public import LeanPool.GraphMinor.Surface.ArcDisc +import Mathlib.Analysis.Complex.ReImTopology + +/-! +# A rectangle map collapsing its central axis interval + +For the radial contractions in XII (7.3), page 261, interpolate the +interval collapse with the identity on each horizontal line of a +rectangle. The interpolation reaches the collapse only on its axis. +The boundary stays fixed, and every horizontal interval maps onto +itself. This permits the map to be pasted into a surface strip. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology Complex + +/-- The rectangle supporting a collapse of the axis interval `[l,r]`. -/ +def collapseRectangle (l r ε : ℝ) : Set ℂ := + Icc (2 * l - r) (2 * r - l) ×ℂ Icc (-ε) ε + +/-- The collapse weight is one on the axis and zero on the horizontal +boundary of the rectangle. -/ +noncomputable def collapseWeight (ε : ℝ) (z : ℂ) : ℝ := 1 - |z.im| / ε + +/-- The rectangle coordinate map used to contract a drawn edge. -/ +noncomputable def collapseStrip (l r ε : ℝ) (z : ℂ) : ℂ := + (((1 - collapseWeight ε z) * z.re + collapseWeight ε z * collapseInterval l r z.re : ℝ) : ℂ) + + z.im * I + +/-- The rectangle map is continuous. -/ +theorem continuous_collapseStrip (l r ε : ℝ) : Continuous (collapseStrip l r ε) := by + have hψ := continuous_collapseInterval l r + unfold collapseStrip collapseWeight + fun_prop + +/-- The map keeps the vertical coordinate. -/ +theorem collapseStrip_im (l r ε : ℝ) (z : ℂ) : (collapseStrip l r ε z).im = z.im := by + simp [collapseStrip] + +/-- Its horizontal coordinate is the interpolated interval collapse. -/ +theorem collapseStrip_re (l r ε : ℝ) (z : ℂ) : + (collapseStrip l r ε z).re = + (1 - collapseWeight ε z) * z.re + collapseWeight ε z * collapseInterval l r z.re := by + simp [collapseStrip] + +/-- The weight lies between zero and one throughout the rectangle. -/ +theorem collapseWeight_mem {l r ε : ℝ} (hε : 0 < ε) {z : ℂ} + (hz : z ∈ collapseRectangle l r ε) : collapseWeight ε z ∈ Icc (0 : ℝ) 1 := by + have him : |z.im| ≤ ε := abs_le.mpr hz.2 + constructor + · exact sub_nonneg.mpr ((div_le_one hε).mpr him) + · exact sub_le_self _ (div_nonneg (abs_nonneg _) hε.le) + +/-- The rectangle maps into itself. -/ +theorem collapseStrip_mapsTo {l r ε : ℝ} (hlr : l ≤ r) (hε : 0 < ε) : + MapsTo (collapseStrip l r ε) (collapseRectangle l r ε) (collapseRectangle l r ε) := by + intro z hz + have hs := collapseWeight_mem hε hz + have hmono := collapseInterval_interpolation_monotone (l := l) (r := r) hs.1 hs.2 + obtain ⟨hleft, hright⟩ := collapseInterval_interpolation_endpoints (t := collapseWeight ε z) hlr + refine ⟨?_, ?_⟩ + · change (collapseStrip l r ε z).re ∈ Icc _ _ + rw [collapseStrip_re] + exact ⟨hleft ▸ hmono hz.1.1, hright ▸ hmono hz.1.2⟩ + · change (collapseStrip l r ε z).im ∈ Icc _ _ + rw [collapseStrip_im] + exact hz.2 + +/-- On the axis, the rectangle map is the interval collapse. -/ +theorem collapseStrip_ofReal (l r ε x : ℝ) : + collapseStrip l r ε (x : ℂ) = (collapseInterval l r x : ℂ) := by + simp [collapseStrip, collapseWeight] + +/-- The rectangle boundary stays fixed. -/ +theorem collapseStrip_frontier {l r ε : ℝ} (hlr : l ≤ r) (hε : 0 < ε) + {z : ℂ} (hz : z ∈ frontier (collapseRectangle l r ε)) : collapseStrip l r ε z = z := by + have hRc : IsCompact (collapseRectangle l r ε) := isCompact_Icc.reProdIm isCompact_Icc + rw [hRc.isClosed.frontier_eq, collapseRectangle, interior_reProdIm, interior_Icc, + interior_Icc] at hz + obtain ⟨hzR, hznot⟩ := hz + apply Complex.ext + · rw [collapseStrip_re] + obtain ⟨hleft, hright⟩ := collapseInterval_interpolation_endpoints (t := collapseWeight ε z) hlr + by_cases hzl : z.re = 2 * l - r + · simpa only [hzl] using hleft + by_cases hzr : z.re = 2 * r - l + · simpa only [hzr] using hright + have himnot : z.im ∉ Ioo (-ε) ε := fun him => hznot + ⟨⟨lt_of_le_of_ne hzR.1.1 (Ne.symm hzl), lt_of_le_of_ne hzR.1.2 hzr⟩, him⟩ + have him : |z.im| = ε := by + apply le_antisymm (abs_le.mpr hzR.2) + by_contra hn + exact himnot (abs_lt.mp (lt_of_not_ge hn)) + have hs : collapseWeight ε z = 0 := by + unfold collapseWeight + rw [him, div_self hε.ne'] + exact sub_self _ + rw [hs] + ring + · exact collapseStrip_im l r ε z + +/-- Only the axis attains full collapse weight. -/ +theorem collapseWeight_lt_one {ε : ℝ} (hε : 0 < ε) {z : ℂ} (hz : z.im ≠ 0) : + collapseWeight ε z < 1 := by + have hpos : 0 < |z.im| / ε := div_pos (abs_pos.mpr hz) hε + unfold collapseWeight + linarith + +/-- The central axis interval is the only non-singleton fibre of +the rectangle map. Away from the axis, the interpolation is strictly +increasing on its horizontal line. -/ +theorem collapseStrip_eq_iff {l r ε : ℝ} (hlr : l ≤ r) (hε : 0 < ε) {z w : ℂ} + (hz : z ∈ collapseRectangle l r ε) : + collapseStrip l r ε z = collapseStrip l r ε w ↔ + z = w ∨ (z ∈ Complex.ofReal '' Icc l r ∧ w ∈ Complex.ofReal '' Icc l r) := by + constructor + · intro heq + have him : z.im = w.im := by + have him := congrArg Complex.im heq + simpa only [collapseStrip_im] using him + have hs : collapseWeight ε z = collapseWeight ε w := by simp only [collapseWeight, him] + have hre := congrArg Complex.re heq + rw [collapseStrip_re, collapseStrip_re, ← hs] at hre + by_cases hz0 : z.im = 0 + · have hw0 : w.im = 0 := him.symm.trans hz0 + have hs1 : collapseWeight ε z = 1 := by simp [collapseWeight, hz0] + rw [hs1] at hre + simp only [sub_self, zero_mul, one_mul, zero_add] at hre + rcases (collapseInterval_eq_iff hlr).mp hre with hre | ⟨hzr, hwr⟩ + · exact Or.inl (Complex.ext hre him) + · exact Or.inr ⟨⟨z.re, hzr, Complex.ext rfl (by simp [hz0])⟩, + ⟨w.re, hwr, Complex.ext rfl (by simp [hw0])⟩⟩ + · have hstrict := collapseInterval_interpolation_strictMono + (l := l) (r := r) (collapseWeight_mem hε hz).1 (collapseWeight_lt_one hε hz0) + exact Or.inl (Complex.ext (hstrict.injective hre) him) + · rintro (rfl | ⟨⟨x, hx, rfl⟩, ⟨y, hy, rfl⟩⟩) + · rfl + · rw [collapseStrip_ofReal, collapseStrip_ofReal, collapseInterval_of_mem hx, + collapseInterval_of_mem hy] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73CommonCircuitInside.lean b/LeanPool/GraphMinor/GM12/Section73CommonCircuitInside.lean new file mode 100644 index 0000000000..d8c4f937fe --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73CommonCircuitInside.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73SelectedDiscDeletion +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.Section7 +import LeanPool.GraphMinor.GM11.Section64 +import LeanPool.GraphMinor.GM11.Theorem61 + +/-! +# The inside of a circuit shared by the two radial drawings + +For XII (7.3), Claim (1), page 262, a circuit retained in both +radial drawings has the same selected inside. Its old separation +has order at most half the circuit length. Adding the deleted +vertex to both sides keeps the order small, so the same disc is +selected in the deleted tangle. Two selected discs with the same +boundary agree, since otherwise they cover the surface. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 Hypergraph + +/-- Two discs with the same radial boundary and selected by the +same pretangle agree. This is the disc-uniqueness argument used +in the inside comparison of XII (7.3), Claim (1), page 262. -/ +theorem selected_radial_discs_eq + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : PaintingOrDrawing S} {K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle Γ.toHypergraph θ T) (hrad : Γ.U ∩ K.U = Γ.V) + {D₁ D₂ F : Set S} (hD₁ : IsClosedDisc D₁) (hD₂ : IsClosedDisc D₂) + (hb₁ : subBd D₁ = F) (hb₂ : subBd D₂ = F) (hFK : F ⊆ K.U) + (hm₁ : (Γ.inter D₁, Γ.interOutside D₁) ∈ T) + (hm₂ : (Γ.inter D₂, Γ.interOutside D₂) ∈ T) : D₁ = D₂ := by + by_contra hne + have hf₁ : frontier D₁ = F := (subBd_eq_frontier D₁).symm.trans hb₁ + have hf₂ : frontier D₂ = F := (subBd_eq_frontier D₂).symm.trans hb₂ + have hbd : discBd D₁ = discBd D₂ := by + rw [← IsClosedDisc.frontier_eq_discBd hS hD₁, + ← IsClosedDisc.frontier_eq_discBd hS hD₂, hf₁, hf₂] + have hcov := cover_of_discBd_eq hS hD₁ hD₂ hbd hne + exact not_cover hT hrad hD₁.isClosed hD₂.isClosed hD₁.isClosed + (hf₁.symm ▸ hFK) (hf₂.symm ▸ hFK) (hf₁.symm ▸ hFK) hm₁ hm₂ hm₁ + (by rw [hcov, univ_union]) + +/-- The separation at a radial circuit has order at most half its +length. This supplies the order bound in XII (7.3), Claim (1). -/ +theorem two_mul_disc_separationOrder_le_circuit_length + {S : Type*} [TopologicalSpace S] + {Γ : PaintingOrDrawing S} {K C : Drawing S} + (hK : Γ.IsPreRadialDrawing K) (hC : C.IsCircuit) (hCs : C.IsSubdrawing K) + {D : Set S} (hbd : subBd D = C.U) : + 2 * separationOrder (Γ.inter D) (Γ.interOutside D) ≤ C.length := by + have hf : frontier D = C.U := (subBd_eq_frontier D).symm.trans hbd + have h₁ := two_mul_ncard_le_length Γ.V (bipartite_of_preRadial hK) hC hCs + have h₂ : (Γ.V ∩ C.V).Finite := C.finite_V.subset inter_subset_right + have h₃ := ncard_le_ncard (s := (Γ.inter D ∩ Γ.interOutside D).vertexSet) + (fun x hx => by + have hm := inter_outside_vertex hK.2.1 hCs hf hx + exact ⟨hm.2, hm.1⟩) h₂ + change 2 * (Γ.inter D ∩ Γ.interOutside D).vertexSet.ncard ≤ C.length + omega + +/-- A short circuit shared by the old and new radial drawings has +the same derived inside. This proves the unchanged-circuit case of +XII (7.3), Claim (1), page 262. -/ +theorem common_circuit_inside_eq_after_vertex_deletion + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K J C : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsTangle Γ.toHypergraph θ T) + {v : S} (hv : v ∈ Γ.V) + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + (hJ : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsPreRadialDrawing J) + {ins ins' : Drawing S → Set S} + (hins : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + (hins' : IsDerivedSlope (PaintingOrDrawing.drawing (deleteVertices Γ {v})) J (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) ins') + (hC : C.IsCircuit) (hCK : C.IsSubdrawing K) (hCJ : C.IsSubdrawing J) + (hshort : C.length + 2 < 2 * θ) : ins C = ins' C := by + obtain ⟨hD, hbd, hm⟩ := hins C hC hCK (by omega) + have hsepBound := two_mul_disc_separationOrder_le_circuit_length hK hC hCK hbd + have haugBound := separationOrder_adjoin_vertex_le + ((PaintingOrDrawing.drawing Γ).inter (ins C)) + ((PaintingOrDrawing.drawing Γ).interOutside (ins C)) v + have haug : separationOrder + ((PaintingOrDrawing.drawing Γ).inter (ins C) ∪ vertexHypergraph v) + ((PaintingOrDrawing.drawing Γ).interOutside (ins C) ∪ vertexHypergraph v) < θ := by omega + have hmNew := selected_disc_mem_deleted_tangle hT hv hD.isClosed hm haug + obtain ⟨hD', hbd', hm'⟩ := hins' C hC hCJ (by omega) + have ht := theorem_7_3_tangle hθ hT hv + have hpret : IsPretangle (PaintingOrDrawing.drawing (deleteVertices Γ {v})).toHypergraph + (θ - 1) (deleteVerticesTangle Γ.toHypergraph {v} T θ) := + ⟨ht.one_le, ht.isSeparation, ht.order_lt, ht.axiom1, ht.axiom2⟩ + exact selected_radial_discs_eq hS hpret hJ.1 hD hD' hbd hbd' hCJ.U_subset hmNew hm' + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73ComparisonConstruction.lean b/LeanPool/GraphMinor/GM12/Section73ComparisonConstruction.lean new file mode 100644 index 0000000000..c06d0b571f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73ComparisonConstruction.lean @@ -0,0 +1,137 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73DerivedContraction +public import LeanPool.GraphMinor.GM12.Section73WalkSubstitution +public import LeanPool.GraphMinor.GM12.SurfaceDualContractDefs +import LeanPool.GraphMinor.GM12.Section73SupportedRadialContraction +import LeanPool.GraphMinor.GM12.Section73WalkLiftEdges +import LeanPool.GraphMinor.GM12.Section73WalkInside +import LeanPool.GraphMinor.GM12.Section73HubInside +import LeanPool.GraphMinor.GM12.Section73Representativity +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.GM11.Theorem61 + +/-! +# Constructing the new metric with the walk inside comparisons + +For XII (7.3), pages 261--262, choose the supported radial star +collapse and clean its image. Prove representativity of the new +drawing and respectfulness of the deleted tangle, then derive +its inside function and metric. Each short new walk now has an +actual old lift with the stated length, inside containment, and +preservation of the enclosed merged hub. No walk-comparison step +is assumed in this construction. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 GM14 Hypergraph + +/-- Construct the supported radial star contraction, the new radial +metric, and the lifted-walk inside comparisons used for both bounds +of XII (7.3), pages 261--262, exposing `(D, f, H, J)` as an +`IsStarContraction`. -/ +theorem exists_starContraction_with_vertex_deletion_walk_comparison + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsRespectfulDrawingTangle Γ θ T) + {ins : Drawing S → Set S} + (hins : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) + (hE' : (deleteVertices Γ {v}).E.Nonempty) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) + {r' : Set S} (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') : + ∃ (D : Set S) (f : C(S, S)) (H J : Drawing S) (ins' : Drawing S → Set S), + IsStarContraction K v r' D f H J ∧ + (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsRadialDrawing J ∧ + IsDerivedSlope (PaintingOrDrawing.drawing (deleteVertices Γ {v})) J (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) ins' ∧ + HasTangleMetric (deleteVertices Γ {v}) (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) + (tangleMetric (deleteVertices Γ {v}) J ins' (θ - 1)) ∧ v ∈ J.V ∧ + ∀ (a : S) (W : GraphWalk J.toGraph a a), W.length < 2 * (θ - 1) → + ∃ W' : GraphWalk K.toGraph a a, + W'.length = W.length + 2 * walkVertexCount v W ∧ + insWalk ins' J W ⊆ insWalk ins K W' ∪ r' ∧ + (v ∈ insWalk ins' J W → v ∈ insWalk ins K W') := by + obtain ⟨B, f, H, J, hB, hBr, hAB, hsurj, hfixB, hfix, hcollapse, hfibre, + hHU, hHV, hHE, hJH, hJV, hJ⟩ := + exists_supported_radial_star_contraction hS hK hE hv htwo hE' hunique hr' hvr' + have hc : IsStarContraction K v r' B f H J := + ⟨hB, hBr, hfixB, hcollapse, hfibre, hHU, hHV, hJH, hJV⟩ + have hpret : IsPretangle Γ.toHypergraph θ T := + ⟨hT.2.1.one_le, hT.2.1.isSeparation, hT.2.1.order_lt, hT.2.1.axiom1, hT.2.1.axiom2⟩ + have hs := GM14.isSlope_of_derived (Γ := PaintingOrDrawing.drawing Γ) (Γ' + := K) hS hpret hK.2.1.1 hins + have hJV' : J.V = f '' K.V := hJV.trans hHV + have hJE : J.E ⊆ (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g} := fun _ he => + hHE ▸ hJH.2 he + have hrep := isRepresentative_of_radial_star_contraction hS hK hE hv hr' hvr' + f hfix hcollapse hfibre hJV' hJE hJ.2.1 hs hJ hE' + have hresp := isRespectful_after_vertex_deletion_of_representative hS hθ hT hv htwo hrep + obtain ⟨ins', hins'⟩ := exists_derivedSlope hS hresp.2.2 hJ.2.1 + have hm : HasTangleMetric (deleteVertices Γ {v}) (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) + (tangleMetric (deleteVertices Γ {v}) J ins' (θ - 1)) := + ⟨hresp, J, ins', hJ, hins', fun _ _ _ _ => rfl⟩ + have hvJ : v ∈ J.V := hJV'.symm ▸ ⟨v, hK.2.1.2.1 hv, hcollapse v (Or.inl rfl)⟩ + refine ⟨B, f, H, J, ins', hc, hJ, hins', hm, hvJ, ?_⟩ + intro a W hshort + obtain ⟨W', hlen, _, hpoints, hedges⟩ := exists_closed_walk_lift_with_edges hS hK hE hv hr' hvr' + f hfix hcollapse hfibre hJV' hJE hJ.2.1 hunique W + refine ⟨W', hlen, ?_, ?_⟩ + · exact theorem_7_3_claim_1_short_walk hS hθ hT.2.1 hins hins' hK hE hv hr' hvr' + f hfix hcollapse hfibre hJV' hJE hJ hB hBr hAB hfixB W W' hshort hpoints hedges + · exact hub_mem_inside_lifted_walk hS hθ hT.2.1 hins hins' hK hE hv hr' hvr' + f hfix hcollapse hfibre hJV' hJE hJ W W' hshort hpoints hedges + +/-- Construct the new radial metric and the lifted-walk inside +comparisons used for both bounds of XII (7.3), pages 261--262. +The only local reduction condition is uniqueness of the old star +spokes, which is supplied by the selected-disc reduction. -/ +theorem exists_metric_with_vertex_deletion_walk_comparison + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsRespectfulDrawingTangle Γ θ T) + {ins : Drawing S → Set S} + (hins : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) + (hE' : (deleteVertices Γ {v}).E.Nonempty) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) + {r' : Set S} (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') : + ∃ (J : Drawing S) (ins' : Drawing S → Set S), + (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsRadialDrawing J ∧ + IsDerivedSlope (PaintingOrDrawing.drawing (deleteVertices Γ {v})) J (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) ins' ∧ + HasTangleMetric (deleteVertices Γ {v}) (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) + (tangleMetric (deleteVertices Γ {v}) J ins' (θ - 1)) ∧ v ∈ J.V ∧ + ∀ (a : S) (W : GraphWalk J.toGraph a a), W.length < 2 * (θ - 1) → + ∃ W' : GraphWalk K.toGraph a a, + W'.length = W.length + 2 * walkVertexCount v W ∧ + insWalk ins' J W ⊆ insWalk ins K W' ∪ r' ∧ + (v ∈ insWalk ins' J W → v ∈ insWalk ins K W') := by + obtain ⟨_, _, _, J, ins', _, hJ, hins', hm, hvJ, hcomp⟩ := + exists_starContraction_with_vertex_deletion_walk_comparison + hS hθ hT hins hK hE hv htwo hE' hunique hr' hvr' + exact ⟨J, ins', hJ, hins', hm, hvJ, hcomp⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73ConnectorVisits.lean b/LeanPool/GraphMinor/GM12/Section73ConnectorVisits.lean new file mode 100644 index 0000000000..5ee1b2c002 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73ConnectorVisits.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73CircuitVisitCount +import LeanPool.GraphMinor.GM11.Ties +import LeanPool.GraphMinor.GM11.Section88 + +/-! +# Visit counts after joining two pieces + +In XII (7.3), page 262, XI (9.2) supplies walks around two +pieces and a connector. Replace the connector by a shortest path +between their vertex sets. It meets either piece only at the +corresponding end. Interior vertices of the connector contribute +at most two visits and none from the pieces. At an end there is +at most one visit from the connector and one from its piece. +If the path has zero length, the two piece walks alone contribute +at most two visits. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +/-- A closed walk never departs from a vertex outside its support. -/ +theorem walkVertexCount_eq_zero_of_notMem_support + {α β : Type*} {G : Graph α β} {a v : α} (W : GraphWalk G a a) + (hv : v ∉ W.support) : walkVertexCount v W = 0 := by + classical + rw [walkVertexCount_eq_count_support_tail] + exact List.count_eq_zero.mpr (fun h => hv (List.mem_of_mem_tail h)) + +/-- The forward and reverse path have the same vertex set as +the path itself. In particular their count is zero off the path. -/ +theorem walkVertexCount_backtrack_eq_zero_of_notMem_support + {α β : Type*} {G : Graph α β} {a b v : α} (Q : GraphWalk G a b) + (hv : v ∉ Q.support) : walkVertexCount v (Q.append Q.reverse) = 0 := by + apply walkVertexCount_eq_zero_of_notMem_support + intro h + rcases (GraphWalk.mem_support_append _ _).mp h with h | h + · exact hv h + · rw [GraphWalk.support_reverse, List.mem_reverse] at h + exact hv h + +/-- Joining two closed walks that each visit every vertex at +most once by a simple path meeting their supports only at its +ends gives at most two visits to every vertex. -/ +theorem walkVertexCount_join_le_two + {α β : Type*} {G : Graph α β} {a b : α} + (P : GraphWalk G a a) (R : GraphWalk G b b) (Q : GraphWalk G a b) + (hP : ∀ v, walkVertexCount v P ≤ 1) (hR : ∀ v, walkVertexCount v R ≤ 1) + (hQ : Q.IsSimple) + (hQP : ∀ v ∈ Q.support, v ∈ P.support → v = a) + (hQR : ∀ v ∈ Q.support, v ∈ R.support → v = b) (v : α) : + walkVertexCount v (P.append (Q.append (R.append Q.reverse))) ≤ 2 := by + have hadd : walkVertexCount v (P.append (Q.append (R.append Q.reverse))) = + walkVertexCount v P + walkVertexCount v R + walkVertexCount v (Q.append Q.reverse) := by + simp only [walkVertexCount_append] + omega + rw [hadd] + have hp := hP v + have hr := hR v + have hback := walkVertexCount_backtrack_bounds Q hQ v + by_cases hvQ : v ∈ Q.support + · by_cases hvP : v ∈ P.support + · by_cases hvR : v ∈ R.support + · have hva := hQP v hvQ hvP + have hvb := hQR v hvQ hvR + have hab : a = b := hva.symm.trans hvb + cases hab + cases Q with + | nil _ => simp only [GraphWalk.append, GraphWalk.reverse, walkVertexCount]; omega + | cons _ T => exact ((List.nodup_cons.mp hQ).1 T.end_mem_support).elim + · have hz := walkVertexCount_eq_zero_of_notMem_support R hvR + have hba := hback.2 (Or.inl (hQP v hvQ hvP)) + omega + · have hzP := walkVertexCount_eq_zero_of_notMem_support P hvP + by_cases hvR : v ∈ R.support + · have hba := hback.2 (Or.inr (hQR v hvQ hvR)) + omega + · have hzR := walkVertexCount_eq_zero_of_notMem_support R hvR + omega + · have hz := walkVertexCount_backtrack_eq_zero_of_notMem_support Q hvQ + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73ContractDrawing.lean b/LeanPool/GraphMinor/GM12/Section73ContractDrawing.lean new file mode 100644 index 0000000000..82631286c7 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73ContractDrawing.lean @@ -0,0 +1,57 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +import LeanPool.GraphMinor.GM12.Section73StarDrawing + +public import LeanPool.GraphMinor.GM12.Section73ImageArc +public import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM12.Section4FiniteLineDrawing +import LeanPool.GraphMinor.GM11.RadialCorners +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# The drawing obtained by contracting one edge + +For the radial contractions in XII (7.3), page 261, a contraction +map identifies just one edge closure. Every other edge closure meets +that closure in at most one point, so its image remains a line. +Assemble these image lines into a drawing. Its vertices are precisely +the images of the old vertices, and its edges are precisely the +images of the old edges other than the contracted edge. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A continuous arc contraction gives a drawing with exactly the +expected vertices, edges, and point set when every other edge meets +the contracted arc in at most one point. This constructs the drawings +used in the radial-star contraction of XII (7.3), page 261. -/ +theorem exists_drawing_of_edge_collapse + {S : Type*} [TopologicalSpace S] [T2Space S] {K : Drawing S} {e : Set S} + (he : e ∈ K.E) {v : S} (hv : v ∈ K.V) (hve : v ∈ closure e) + (hlines : ∀ g ∈ K.E, ∃ u w : S, IsLineWithEnds (closure g) u w ∧ + closure g ∩ K.V = {u, w}) + (hmeet : ∀ g ∈ K.E, g ≠ e → (closure g ∩ closure e).Subsingleton) + (f : C(S, S)) (hcollapse : ∀ x ∈ closure e, f x = v) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ (x ∈ closure e ∧ y ∈ closure e)) : + ∃ H : Drawing S, H.U = f '' K.U ∧ H.V = f '' K.V ∧ + H.E = (fun g => f '' g) '' (K.E \ {e}) := by + refine exists_drawing_of_star_collapse (C := {e}) hv hve ?_ ?_ ?_ ?_ f hcollapse hfibre + · intro g hg + rw [mem_singleton_iff.mp hg] + · exact fun g hg => hlines g hg.1 + · exact fun g hg => hmeet g hg.1 hg.2 + · exact fun g hg => closure_inter_subset_V hg.1 he hg.2 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73ContractedFaces.lean b/LeanPool/GraphMinor/GM12/Section73ContractedFaces.lean new file mode 100644 index 0000000000..73511ba0a5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73ContractedFaces.lean @@ -0,0 +1,83 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73CellularContraction +public import LeanPool.GraphMinor.GM12.Section73RadialStar +import LeanPool.GraphMinor.GM11.RadialFacts +import LeanPool.GraphMinor.GM12.Section73ImageIncidence + +/-! +# Edges inside the contracted radial regions + +For the cleanup in XII (7.3), page 261, each contracted radial +region comes from one old radial region and contains the image of +its old drawing edge. It contains at most one edge of the drawing +after vertex deletion. Indeed, those edges stay fixed, so any two +would already lie in the same old radial region, contradicting the +unique-edge property of a radial drawing. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A contracted radial region contains an old edge image and at +most one surviving drawing edge. These are the faces to be cleaned +up in XII (7.3), page 261. -/ +theorem contracted_radial_region_edges + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K H : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + (f : C(S, S)) (hsurj : Function.Surjective f) (hfix : ∀ x ∉ r', f x = x) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + (hHU : H.U = f '' K.U) {q : Set S} (hq : q ∈ H.R) : + ∃ r ∈ K.R, q = f '' r ∧ + (∃ e ∈ Γ.E, f '' e ⊆ q) ∧ + (∀ e ∈ (deleteVertices Γ {v}).E, ∀ g ∈ (deleteVertices Γ {v}).E, + e ⊆ q → g ⊆ q → e = g) := by + let : CompactSpace S := hS.1 + have hAK : {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e ⊆ K.U := by + intro x hx + rcases hx with rfl | hx + · exact K.V_subset_U (hK.2.1.2.1 hv) + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact K.closure_subset_U he.1 hxe + obtain ⟨r, hr, hqr, _⟩ := exists_region_image_of_collapse hAK f hsurj hfibre hHU hq + have hfacts := regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hE + obtain ⟨e, he, her⟩ := hfacts.1 r hr + refine ⟨r, hr, hqr, ⟨e, he, ?_⟩, ?_⟩ + · rw [hqr] + exact image_mono her + · have hpre : ∀ x, f x ∈ q → x ∈ r := by + intro x hfx + rw [hqr] at hfx + obtain ⟨y, hyr, hyx⟩ := hfx + rcases (hfibre x y).mp hyx.symm with hxy | hAxy + · exact hxy ▸ hyr + · exact False.elim (region_subset hr hyr (hAK hAxy.2)) + have hsub : ∀ g ∈ (deleteVertices Γ {v}).E, g ⊆ q → g ⊆ r := by + intro g hg hgq x hxg + have hxU : x ∈ (deleteVertices Γ {v}).U := + (deleteVertices Γ {v}).closure_subset_U hg (subset_closure hxg) + have hxn : x ∉ r' := fun hxr' => region_subset hr' hxr' hxU + apply hpre x + rw [hfix x hxn] + exact hgq hxg + intro a ha b hb haq hbq + have hdelete := deleteVertices_isSubdrawing Γ {v} + exact hfacts.2.1 r hr a (hdelete.2 ha) b (hdelete.2 hb) (hsub a ha haq) (hsub b hb hbq) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73DeleteRadialEdge.lean b/LeanPool/GraphMinor/GM12/Section73DeleteRadialEdge.lean new file mode 100644 index 0000000000..81c34c4e0a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73DeleteRadialEdge.lean @@ -0,0 +1,178 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.Section4c +import LeanPool.GraphMinor.GM11.GlueFaces +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Deleting an edge between distinct radial regions + +The cleanup in XII (7.3), page 261, removes one boundary edge of an +empty parallel-edge region. Deleting an edge between two distinct +regions merges just those regions. Their union with the edge is an +open disc, so the drawing remains two-cell. Other regions stay +unchanged because an edge is incident with at most two regions. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Edge deletion retains every vertex, including isolated ones. +This keeps the radial hubs fixed during the cleanup in XII (7.3). -/ +theorem deleteEdge_vertices_eq + {S : Type*} [TopologicalSpace S] [T2Space S] (H : Drawing S) (e : Set S) : + (H.deleteEdge e).V = H.V := by + apply Subset.antisymm (deleteEdge_isSubdrawing H e).1 + intro x hx + exact Or.inl ⟨hx, hx⟩ + +/-- Deleting a radial edge preserves the intersection with the +original drawing because all its vertices are retained. This is +condition (i) during the cleanup of XII (7.3), page 261. -/ +theorem drawing_inter_deleteEdge_eq + {S : Type*} [TopologicalSpace S] [T2Space S] {Γ H : Drawing S} + (hcap : Γ.U ∩ H.U = Γ.V) (hV : Γ.V ⊆ H.V) (e : Set S) : + Γ.U ∩ (H.deleteEdge e).U = Γ.V := by + apply Subset.antisymm + · rintro x ⟨hxΓ, hxH⟩ + exact hcap.subset ⟨hxΓ, (deleteEdge_isSubdrawing H e).U_subset hxH⟩ + · intro x hxΓ + refine ⟨Γ.V_subset_U hxΓ, (H.deleteEdge e).V_subset_U ?_⟩ + rw [deleteEdge_vertices_eq] + exact hV hxΓ + +/-- Deleting an edge between two distinct disc regions changes +only those two regions, replacing them by their union with the edge. +This is the region calculation for the cleanup in XII (7.3), page 261. -/ +theorem region_deleteEdge_cases + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {H : Drawing S} {e p q : Set S} + (he : e ∈ H.E) (hp : p ∈ H.R) (hq : q ∈ H.R) (hpq : p ≠ q) + (hdp : IsOpenDisc p) (hdq : IsOpenDisc q) + (hep : e ⊆ closure p) (heq : e ⊆ closure q) + {r : Set S} (hr : r ∈ (H.deleteEdge e).R) : + r = p ∪ q ∪ e ∨ (r ∈ H.R ∧ r ≠ p ∧ r ≠ q) := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let A : Set S := p ∪ q ∪ e + let B : Set S := ⋃ t ∈ {t ∈ H.R | t ≠ p ∧ t ≠ q}, t + have hA : IsOpenDisc A := theorem_glue_regions hS he hp hq hpq hdp hdq hep heq + have hB : IsOpen B := isOpen_biUnion fun t ht => region_isOpen ht.1 + have hother : ∀ t ∈ H.R, t ≠ p → t ≠ q → t ∈ (H.deleteEdge e).R := by + intro t ht htp htq + apply region_deleteEdge_of_not_incident he ht + apply disjoint_left.mpr + intro x hxe hxcl + have het := edge_subset_closure_of_incident hS he ht ⟨x, hxe, hxcl⟩ + rcases region_incident_two hS he hp hq ht hep heq het with h | h | h + · exact hpq h + · exact htp h.symm + · exact htq h.symm + have hdisAB : Disjoint A B := by + apply disjoint_left.mpr + intro x hxA hxB + obtain ⟨t, ht, hxt⟩ := mem_iUnion₂.mp hxB + rcases hxA with (hxp | hxq) | hxe + · exact ht.2.1 (region_eq_of_mem ht.1 hp hxt hxp) + · exact ht.2.2 (region_eq_of_mem ht.1 hq hxt hxq) + · exact region_subset ht.1 hxt (H.closure_subset_U he (subset_closure hxe)) + have hcov : (H.deleteEdge e).Uᶜ ⊆ A ∪ B := by + intro x hx + by_cases hxH : x ∈ H.U + · have hxe : x ∈ e := by + by_contra hxn + apply hx + rw [deleteEdge_U H he] + exact ⟨hxH, hxn⟩ + exact Or.inl (Or.inr hxe) + · obtain ⟨t, ht, hxt⟩ := exists_region_of_notMem hxH + by_cases htp : t = p + · exact Or.inl (Or.inl (Or.inl (htp ▸ hxt))) + · by_cases htq : t = q + · exact Or.inl (Or.inl (Or.inr (htq ▸ hxt))) + · exact Or.inr (mem_iUnion₂.mpr ⟨t, ⟨ht, htp, htq⟩, hxt⟩) + have hrcov : r ⊆ A ∪ B := fun _ hx => hcov (region_subset hr hx) + by_cases hmeet : (r ∩ A).Nonempty + · left + obtain ⟨x, hxr, hxA⟩ := hmeet + have hrA : r ⊆ A := (region_isPreconnected hr).subset_left_of_subset_union + hA.1 hB hdisAB hrcov ⟨x, hxr, hxA⟩ + have hAdis : Disjoint A (H.deleteEdge e).U := by + apply disjoint_left.mpr + intro y hyA hyH + rw [deleteEdge_U H he] at hyH + rcases hyA with (hyp | hyq) | hye + · exact region_subset hp hyp hyH.1 + · exact region_subset hq hyq hyH.1 + · exact hyH.2 hye + exact Subset.antisymm hrA + (subset_region hr (isPreconnected_of_isOpenDisc hA) hAdis hxA hxr) + · right + obtain ⟨x, hxr⟩ := region_nonempty hr + have hxB : x ∈ B := (hrcov hxr).resolve_left fun hxA => hmeet ⟨x, hxr, hxA⟩ + obtain ⟨t, ht, hxt⟩ := mem_iUnion₂.mp hxB + have htnew := hother t ht.1 ht.2.1 ht.2.2 + have hrt : r = t := region_eq_of_mem hr htnew hxr hxt + exact hrt.symm ▸ ht + +/-- Removing an edge between distinct regions preserves the +two-cell property. This supplies the deletion step in the empty-disc +cleanup of XII (7.3), page 261. -/ +theorem isTwoCell_deleteEdge_of_distinct_regions + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {H : Drawing S} + (hH : (PaintingOrDrawing.drawing H).IsTwoCell) {e p q : Set S} + (he : e ∈ H.E) (hp : p ∈ H.R) (hq : q ∈ H.R) (hpq : p ≠ q) + (hep : e ⊆ closure p) (heq : e ⊆ closure q) : + (PaintingOrDrawing.drawing (H.deleteEdge e)).IsTwoCell := by + refine ⟨hH.1, ?_⟩ + intro r hr + rcases region_deleteEdge_cases hS he hp hq hpq (hH.2 p hp) (hH.2 q hq) hep heq hr with h | h + · rw [h] + exact theorem_glue_regions hS he hp hq hpq (hH.2 p hp) (hH.2 q hq) hep heq + · exact hH.2 r h.1 + +/-- If one merged region contains no edge of the other drawing, +the deletion preserves the condition that every region contains at +most one such edge. This is the edge invariant in the cleanup of +XII (7.3), page 261. -/ +theorem region_edge_unique_deleteEdge + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ H : Drawing S} + (hH : (PaintingOrDrawing.drawing H).IsTwoCell) {e p q : Set S} + (he : e ∈ H.E) (hp : p ∈ H.R) (hq : q ∈ H.R) (hpq : p ≠ q) + (hep : e ⊆ closure p) (heq : e ⊆ closure q) + (hdis : ∀ g ∈ Γ.E, Disjoint g H.U) + (hempty : ∀ g ∈ Γ.E, ¬ g ⊆ p) + (hunique : ∀ r ∈ H.R, ∀ a ∈ Γ.E, ∀ b ∈ Γ.E, a ⊆ r → b ⊆ r → a = b) : + ∀ r ∈ (H.deleteEdge e).R, ∀ a ∈ Γ.E, ∀ b ∈ Γ.E, a ⊆ r → b ⊆ r → a = b := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + intro r hr a ha b hb har hbr + rcases region_deleteEdge_cases hS he hp hq hpq (hH.2 p hp) (hH.2 q hq) hep heq hr with hrA | hrOld + · have hsubq : ∀ g ∈ Γ.E, g ⊆ p ∪ q ∪ e → g ⊆ q := by + intro g hg hgA + have hsubpq : g ⊆ p ∪ q := by + intro x hxg + rcases hgA hxg with hxpq | hxe + · exact hxpq + · exact False.elim (disjoint_left.mp (hdis g hg) hxg + (H.closure_subset_U he (subset_closure hxe))) + have hpqd : Disjoint p q := disjoint_left.mpr fun x hxp hxq => + hpq (region_eq_of_mem hp hq hxp hxq) + exact ((hg.2.2.1.isConnected.isPreconnected).subset_or_subset + (region_isOpen hp) (region_isOpen hq) hpqd hsubpq).resolve_left (hempty g hg) + exact hunique q hq a ha b hb (hsubq a ha (hrA ▸ har)) (hsubq b hb (hrA ▸ hbr)) + · exact hunique r hrOld.1 a ha b hb har hbr + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73DeletedRegions.lean b/LeanPool/GraphMinor/GM12/Section73DeletedRegions.lean new file mode 100644 index 0000000000..5b0e25158a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73DeletedRegions.lean @@ -0,0 +1,154 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73Tangle +public import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.Section4c +import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.Surface.PlaneSeparation + +/-! +# Regions meeting a deleted vertex + +In XII (7.3), page 261, the radial hubs that merge into the new +region are the hubs of old regions incident with the deleted vertex. +If an old region meets the new region containing the vertex, a +connected set crosses its frontier. A frontier point missing from +the deleted drawing is either the deleted vertex or belongs to a +deleted incident edge. In both cases the vertex lies in the closure +of the old region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A point of the original drawing omitted by vertex deletion is +the deleted vertex or belongs to an edge incident with it. This is +used to locate the merged regions in XII (7.3), page 261. -/ +theorem mem_deleted_vertex_or_incident_edge + {S : Type*} [TopologicalSpace S] [T2Space S] {Γ : Drawing S} {v x : S} + (hx : x ∈ Γ.U) (hxnot : x ∉ (deleteVertices Γ {v}).U) : + x = v ∨ ∃ e ∈ Γ.E, x ∈ e ∧ v ∈ closure e := by + by_cases hxV : x ∈ Γ.V + · left + by_contra hxv + apply hxnot + apply (deleteVertices Γ {v}).V_subset_U + rw [deleteVertices_V] + exact ⟨hxV, hxv⟩ + · right + rw [Γ.U_eq] at hx + rcases hx with hxV' | hx + · exact False.elim (hxV hxV') + obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + have hxe' : x ∈ e := (Γ.closure_diff_V he).subset ⟨hxe, hxV⟩ + refine ⟨e, he, hxe', ?_⟩ + by_contra hve + have he' : e ∈ (deleteVertices Γ {v}).E := by + rw [deleteVertices_E] + exact ⟨he, disjoint_left.mpr fun y hy hyv => hve (hyv ▸ hy.1)⟩ + exact hxnot ((deleteVertices Γ {v}).closure_subset_U he' hxe) + +/-- Every old region that meets the new region of the deleted +vertex is incident with that vertex. This identifies the hubs merged +by the radial-star contraction in XII (7.3), page 261. -/ +theorem deleted_vertex_mem_closure_of_region_meeting + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ : Drawing S} {v : S} (hv : v ∈ Γ.V) + {r r' : Set S} (hr : r ∈ Γ.R) (hr' : r' ∈ (deleteVertices Γ {v}).R) + (hvr' : v ∈ r') (hmeet : (r ∩ r').Nonempty) : v ∈ closure r := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨x, hxr, hxr'⟩ := hmeet + have hvr : v ∉ r := fun h => region_subset hr h (Γ.V_subset_U hv) + obtain ⟨y, hyr', hyfr⟩ := inter_frontier_nonempty_of_isPreconnected + (region_isPreconnected hr') ⟨x, hxr', hxr⟩ ⟨v, hvr', hvr⟩ + have hycl : y ∈ closure r := hyfr.1 + have hyU : y ∈ Γ.U := by + rcases closure_region_subset hr hycl with hyr | hyU + · exact False.elim (hyfr.2 ((region_isOpen hr).interior_eq.symm ▸ hyr)) + · exact hyU + rcases mem_deleted_vertex_or_incident_edge hyU (region_subset hr' hyr') with rfl | ⟨e, he, hye, + hve⟩ + · exact hycl + · have hesub : e ⊆ closure r := edge_subset_closure_of_incident hS he hr ⟨y, hye, hycl⟩ + exact closure_minimal hesub isClosed_closure hve + +/-- An old region not incident with the deleted vertex remains a +region. This is the unchanged-region part of XII (7.3), page 261. -/ +theorem region_deleteVertices_of_not_incident + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ : Drawing S} {v : S} + {r : Set S} (hr : r ∈ Γ.R) (hvnot : v ∉ closure r) : + r ∈ (deleteVertices Γ {v}).R := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hclosure : closure r ⊆ r ∪ (deleteVertices Γ {v}).U := by + intro y hycl + rcases closure_region_subset hr hycl with hyr | hyU + · exact Or.inl hyr + · by_cases hynew : y ∈ (deleteVertices Γ {v}).U + · exact Or.inr hynew + · exfalso + rcases mem_deleted_vertex_or_incident_edge hyU hynew with rfl | ⟨e, he, hye, hve⟩ + · exact hvnot hycl + · exact hvnot (closure_minimal + (edge_subset_closure_of_incident hS he hr ⟨y, hye, hycl⟩) isClosed_closure hve) + obtain ⟨r', hr', hsub⟩ := exists_region_superset (deleteVertices_isSubdrawing Γ {v}) hr + have hcov : r' ⊆ r ∪ (closure r)ᶜ := by + intro y hyr' + by_cases hycl : y ∈ closure r + · rcases hclosure hycl with hyr | hyU + · exact Or.inl hyr + · exact False.elim (region_subset hr' hyr' hyU) + · exact Or.inr hycl + obtain ⟨x, hxr⟩ := region_nonempty hr + have hback : r' ⊆ r := (region_isPreconnected hr').subset_left_of_subset_union + (region_isOpen hr) isClosed_closure.isOpen_compl + (disjoint_left.mpr fun _ hy hyn => hyn (subset_closure hy)) hcov ⟨x, hsub hxr, hxr⟩ + exact (subset_antisymm hsub hback) ▸ hr' + +/-- A region after deletion that does not contain the deleted +vertex was already a region before deletion. This gives the other +region hubs in XII (7.3), page 261. -/ +theorem deleted_region_of_not_mem_vertex + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ : Drawing S} {v : S} (hv : v ∈ Γ.V) + {s : Set S} (hs : s ∈ (deleteVertices Γ {v}).R) (hvs : v ∉ s) : s ∈ Γ.R := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨x, hxs, hxΓ⟩ := exists_notMem_U (Γ := Γ) hS (region_isOpen hs) (region_nonempty hs) + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem hxΓ + have hvnot : v ∉ closure r := by + intro hvcl + have hpre : IsPreconnected (insert v r) := (region_isPreconnected hr).subset_closure + (subset_insert v r) (by + intro y hy + rcases hy with rfl | hyr + · exact hvcl + · exact subset_closure hyr) + have hdelete := deleteVertices_isSubdrawing Γ {v} + have hvnotU : v ∉ (deleteVertices Γ {v}).U := by + intro hvU + have hvV := (isSubdrawing_U_inter_V hdelete).subset ⟨hvU, hv⟩ + exact ((deleteVertices_V Γ {v}).subset hvV).2 rfl + have hdis : Disjoint (insert v r) (deleteVertices Γ {v}).U := by + apply disjoint_left.mpr + rintro y (rfl | hyr) hyU + · exact hvnotU hyU + · exact region_subset hr hyr (hdelete.U_subset hyU) + have hsub := subset_region hs hpre hdis (Or.inr hxr) hxs + exact hvs (hsub (Or.inl rfl)) + have hrnew := region_deleteVertices_of_not_incident hS hr hvnot + have heq : r = s := region_eq_of_mem hrnew hs hxr hxs + exact heq ▸ hr + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73DerivedContraction.lean b/LeanPool/GraphMinor/GM12/Section73DerivedContraction.lean new file mode 100644 index 0000000000..8a7f1b2e65 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73DerivedContraction.lean @@ -0,0 +1,85 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73RadialContraction +public import LeanPool.GraphMinor.GM12.Section73Respectfulness +import LeanPool.GraphMinor.GM12.Section73Representativity +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.GM11.Theorem61 + +/-! +# The derived inside function after radial star contraction + +For XII (7.3), page 261, construct the radial drawing after +vertex deletion, prove representativity with the lifted short +walks, and select the discs of the deleted tangle. Its derived +inside function then exists for this same radial drawing. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 GM14 Hypergraph + +/-- The radial construction in XII (7.3), page 261, together with +respectfulness and the new derived inside function. The geometric +contraction and the old inside function supply all the hypotheses +of the representativity proof. -/ +theorem exists_derivedSlope_after_radial_star_contraction + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsRespectfulDrawingTangle Γ θ T) + {ins : Drawing S → Set S} + (hins : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) + (hE' : (deleteVertices Γ {v}).E.Nonempty) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) + {r' : Set S} (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') : + ∃ (f : C(S, S)) (H J : Drawing S) (ins' : Drawing S → Set S), Function.Surjective f ∧ + (∀ x ∉ r', f x = x) ∧ + (∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) ∧ + (∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) ∧ + H.U = f '' K.U ∧ H.V = f '' K.V ∧ + H.E = (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g} ∧ + J.IsSubdrawing H ∧ J.V = H.V ∧ + (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsRadialDrawing J ∧ + IsRespectfulDrawingTangle (deleteVertices Γ {v}) (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) ∧ + IsDerivedSlope (PaintingOrDrawing.drawing (deleteVertices Γ {v})) J (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) ins' ∧ + (∀ (a : S) (W : GraphWalk J.toGraph a a), + ∃ W' : GraphWalk K.toGraph a a, + W'.length = W.length + 2 * walkVertexCount v W ∧ + f '' (walkDrawing K W').U = (walkDrawing J W).U ∧ + (walkDrawing K W').U \ r' = (walkDrawing J W).U \ r') := by + obtain ⟨f, H, J, hsurj, hfix, hcollapse, hfibre, hHU, hHV, hHE, hJH, hJV, hJrad, hlift⟩ := + exists_radial_star_contraction hS hK hE hv htwo hE' hunique hr' hvr' + have hpret : IsPretangle Γ.toHypergraph θ T := + ⟨hT.2.1.one_le, hT.2.1.isSeparation, hT.2.1.order_lt, hT.2.1.axiom1, hT.2.1.axiom2⟩ + have hs := GM14.isSlope_of_derived (Γ := PaintingOrDrawing.drawing Γ) (Γ' + := K) hS hpret hK.2.1.1 hins + have hJV' : J.V = f '' K.V := hJV.trans hHV + have hJE : J.E ⊆ (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g} := fun _ he => + hHE ▸ hJH.2 he + have hrep := isRepresentative_of_radial_star_contraction hS hK hE hv hr' hvr' + f hfix hcollapse hfibre hJV' hJE hJrad.2.1 hs hJrad hE' + have hresp := isRespectful_after_vertex_deletion_of_representative hS hθ hT hv htwo hrep + obtain ⟨ins', hins'⟩ := exists_derivedSlope hS hresp.2.2 hJrad.2.1 + exact ⟨f, H, J, ins', hsurj, hfix, hcollapse, hfibre, hHU, hHV, hHE, hJH, hJV, + hJrad, hresp, hins', hlift⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73DiscAttachment.lean b/LeanPool/GraphMinor/GM12/Section73DiscAttachment.lean new file mode 100644 index 0000000000..0fe22f8041 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73DiscAttachment.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM12.Section73TieBoundary +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.OArcCircuit +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.Disc + +/-! +# Attachment points of disc pieces + +Two disc pieces of a tie meet, if at all, in a single point. +That point belongs to the boundary of both discs. A connected +set with more than one point has no isolated point, so neither +disc can meet the interior of the other at their sole common +point. Once their boundary circuits lie in a drawing, their +common point must be a vertex: an interior point of a common +edge would force more than that point into their intersection. +These facts let the tie walk in XII (7.3), page 262, concatenate +the two boundary walks at their attachment. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +private theorem preconnected_subset_closure_punctured + {S : Type*} [TopologicalSpace S] [T1Space S] {A : Set S} {p : S} + (hA : IsPreconnected A) (hne : ¬ A ⊆ {p}) : A ⊆ closure (A \ {p}) := by + by_cases hp : p ∈ closure (A \ {p}) + · intro x hx + by_cases hxp : x = p + · exact hxp.symm ▸ hp + · exact subset_closure ⟨hx, hxp⟩ + · have hcov : A ⊆ closure (A \ {p}) ∪ {p} := by + intro x hx + by_cases hxp : x = p + · exact Or.inr hxp + · exact Or.inl (subset_closure ⟨hx, hxp⟩) + have hdis : closure (A \ {p}) ∩ ({p} : Set S) = ∅ := by + apply eq_empty_iff_forall_notMem.mpr + rintro x ⟨hx, rfl⟩ + exact hp hx + exact (isPreconnected_iff_subset_of_disjoint_closed.mp hA _ _ isClosed_closure + isClosed_singleton hcov (by rw [hdis, inter_empty])).resolve_right hne + +/-- A disc has no isolated point, including at its boundary. -/ +theorem disc_subset_closure_punctured + {S : Type*} [TopologicalSpace S] [T2Space S] {D : Set S} + (hD : IsClosedDisc D) (p : S) : D ⊆ closure (D \ {p}) := by + apply preconnected_subset_closure_punctured hD.isPathConnected.isConnected.isPreconnected + intro hsub + exact ((infinite_of_isOArc hD.isOArc_discBd).mono ((Surface.discBd_subset D).trans hsub) + (finite_singleton p)).elim + +/-- The sole common point of two closed discs is on both boundaries. -/ +theorem disc_attachment_mem_boundaries + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {D E : Set S} {p : S} + (hD : IsClosedDisc D) (hE : IsClosedDisc E) (hDE : D ∩ E = {p}) : + p ∈ discBd D ∧ p ∈ discBd E := by + have hfirst : ∀ {A B : Set S}, IsClosedDisc A → IsClosedDisc B → + A ∩ B = {p} → p ∈ discBd A := by + intro A B hA hB hAB + have hpAB : p ∈ A ∩ B := hAB.symm ▸ mem_singleton p + rw [← IsClosedDisc.frontier_eq_discBd hS hA] + refine ⟨subset_closure hpAB.1, ?_⟩ + intro hpint + have hpcl := disc_subset_closure_punctured hB p hpAB.2 + obtain ⟨x, hxint, hxB⟩ := mem_closure_iff.mp hpcl _ isOpen_interior hpint + exact hxB.2 (hAB ▸ (⟨interior_subset hxint, hxB.1⟩ : x ∈ A ∩ B)) + exact ⟨hfirst hD hE hDE, hfirst hE hD (inter_comm D E ▸ hDE)⟩ + +/-- A point at which two subdrawings meet alone is an ambient +vertex. Otherwise its ambient edge lies in both subdrawings. -/ +theorem mem_vertices_of_subdrawing_inter_singleton + {S : Type*} [TopologicalSpace S] [T2Space S] + {K C D : Drawing S} {p : S} + (hCK : C.IsSubdrawing K) (hDK : D.IsSubdrawing K) + (hpC : p ∈ C.U) (hpD : p ∈ D.U) (hCD : C.U ∩ D.U ⊆ {p}) : p ∈ K.V := by + by_contra hpV + obtain ⟨e, heC, hpe⟩ := C.exists_edge_of_mem hpC (fun h => hpV (hCK.1 h)) + obtain ⟨f, hfD, hpf⟩ := D.exists_edge_of_mem hpD (fun h => hpV (hDK.1 h)) + have hef : e = f := K.edge_eq_of_mem (hCK.2 heC) (hDK.2 hfD) hpe hpf + have hesub : e ⊆ {p} := by + intro x hx + apply hCD + exact ⟨(heC.2.1 hx).1, (hfD.2.1 (hef ▸ hx)).1⟩ + have hcl : closure e ⊆ {p} := closure_minimal hesub isClosed_singleton + rcases K.edge_cond e (hCK.2 heC) with ⟨a, b, _, hcap, _⟩ | ⟨a, hcap, _⟩ + · have ha : a ∈ closure e ∩ K.V := hcap.symm ▸ (Or.inl rfl : a ∈ ({a, b} : Set S)) + exact hpV ((hcl ha.1) ▸ ha.2) + · have ha : a ∈ closure e ∩ K.V := hcap.symm ▸ mem_singleton a + exact hpV ((hcl ha.1) ▸ ha.2) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73DiscComparison.lean b/LeanPool/GraphMinor/GM12/Section73DiscComparison.lean new file mode 100644 index 0000000000..7f1308c447 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73DiscComparison.lean @@ -0,0 +1,116 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73CircleFibreParameters +public import LeanPool.GraphMinor.GM12.Section73CollapseHomotopy +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM12.Section2InsideHomotopy +import LeanPool.GraphMinor.GM12.Section2NormalNoncover +import LeanPool.GraphMinor.GM11.Section7 +import LeanPool.GraphMinor.GM11.Regions + +/-! +# Comparing selected discs outside the merged region + +For XII (7.3), Claim (1), page 262, the old circuit collapses +onto the new one. Its intersection with the star is one point +or one arc. Parameterize both circles and use the disc-supported +homotopy to compare them away from the merged region. The tangle +supplies a drawing point outside both selected discs. For any +other point outside the region, homotopy in the surface punctured +at these two points determines which side of each circle it lies +on. The selected discs therefore agree outside the region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 Hypergraph + +/-- Selected discs bounded by a circle and its star-collapse +image agree outside the merged region. This is the topological +inside comparison in XII (7.3), Claim (1), page 262. The fibre +shape describes the two old circuit alternatives. -/ +theorem selected_discs_agree_outside_collapsed_region + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsPretangle (PaintingOrDrawing.drawing Γ).toHypergraph θ T) + {r : Set S} (hr : r ∈ Γ.R) + {D E B F G A : Set S} (hD : IsClosedDisc D) (hE : IsClosedDisc E) + (hB : IsClosedDisc B) (hBr : B ⊆ r) (hAB : A ⊆ discInt B) + (hbdD : subBd D = F) (hbdE : subBd E = G) + (hnF : Γ.IsNormal F) (hnG : Γ.IsNormal G) + (hmD : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + (hmE : ((PaintingOrDrawing.drawing Γ).inter E, + (PaintingOrDrawing.drawing Γ).interOutside E) ∈ T) + (hF : IsOArc F) + (hshape : (F ∩ A).Subsingleton ∨ ∃ p q, IsLineWithEnds (F ∩ A) p q) + (f : C(S, S)) (hfixB : ∀ x ∉ discInt B, f x = x) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ (x ∈ A ∧ y ∈ A)) + (himage : f '' F = G) : D \ r = E \ r := by + have hFD : F ⊆ D := by + rw [← hbdD, subBd_eq_frontier] + exact hD.isClosed.frontier_subset + have hGE : G ⊆ E := by + rw [← hbdE, subBd_eq_frontier] + exact hE.isClosed.frontier_subset + have hnD : (PaintingOrDrawing.drawing Γ).IsNormal (frontier D) := by + rw [← subBd_eq_frontier, hbdD] + exact hnF + have hnE : (PaintingOrDrawing.drawing Γ).IsNormal (frontier E) := by + rw [← subBd_eq_frontier, hbdE] + exact hnG + obtain ⟨q, hqΓ, hqD, hqE⟩ := exists_support_point_outside_two_small_sides hT + hD.isClosed hE.isClosed hnD hnE hmD hmE + have hqr : q ∉ r := fun hqr => region_subset hr hqr hqΓ + have hAr : A ⊆ r := hAB.trans ((Surface.discInt_subset B).trans hBr) + have hfix : ∀ x ∉ r, f x = x := fun x hxr => hfixB x + (fun hxB => hxr (hBr (Surface.discInt_subset B hxB))) + have hmem : ∀ x ∉ r, x ∈ D ↔ x ∈ E := by + intro x hxr + by_cases hxF : x ∈ F + · have hxG : x ∈ G := himage ▸ ⟨x, hxF, hfix x hxr⟩ + exact iff_of_true (hFD hxF) (hGE hxG) + have hxG : x ∉ G := by + intro hxG + obtain ⟨y, hyF, hfy⟩ := himage.symm ▸ hxG + rcases (hfibre y x).mp (hfy.trans (hfix x hxr).symm) with hyx | hA + · exact hxF (hyx ▸ hyF) + · exact hxr (hAr hA.2) + let Z : Set S := ({x, q} : Set S)ᶜ + have hFZ : F ⊆ Z := by + intro y hy hpair + rcases hpair with hyx | hyq + · exact hxF (hyx ▸ hy) + · exact hqD (hFD (hyq ▸ hy)) + have hGZ : G ⊆ Z := by + intro y hy hpair + rcases hpair with hyx | hyq + · exact hxG (hyx ▸ hy) + · exact hqE (hGE (hyq ▸ hy)) + have hBZ : B ⊆ Z := by + intro y hy hpair + rcases hpair with hyx | hyq + · exact hxr (hBr (hyx ▸ hy)) + · exact hqr (hBr (hyq ▸ hy)) + obtain ⟨φ, ψ, hφ, hψ, hφrange, hψrange, hcollapse⟩ := + exists_circle_parameters_of_fibre_shape hF hshape f hfibre (himage.symm ▸ hGZ) + have hψrange' : range ψ = G := hψrange.trans himage + have hφZ : range φ ⊆ Z := hφrange.symm ▸ hFZ + have hdeform := closedCurve_homotopic_under_disc_collapse hS hB hAB f hfixB hfibre φ hφZ hBZ + exact mem_disc_iff_of_boundary_homotopy hS hφ hψ hD hE + (hbdD.trans hφrange.symm) (hbdE.trans hψrange'.symm) hqD hqE (hdeform.trans hcollapse) + ext x + exact and_congr_left (fun hx => hmem x hx) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73DiscInterpolation.lean b/LeanPool/GraphMinor/GM12/Section73DiscInterpolation.lean new file mode 100644 index 0000000000..cf49b72ec5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73DiscInterpolation.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.Disc + +/-! +# Interpolating maps with values in a closed disc + +For the inside comparison in XII (7.3), Claim (1), page 262, +interpolate the supported collapse with the identity inside its +supporting disc. A disc coordinate identifies the disc with a +convex set. Straight-line interpolation in this coordinate stays +in the disc and fixes any point where the two maps agree. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Two maps into a closed disc interpolate inside that disc, +fixing points where they agree. This gives the local homotopy +for the supported radial collapse in XII (7.3), Claim (1). -/ +theorem exists_disc_interpolation + {X S : Type*} [TopologicalSpace X] [TopologicalSpace S] + {D : Set S} (hD : IsClosedDisc D) (f g : C(X, S)) + (hf : range f ⊆ D) (hg : range g ⊆ D) : + ∃ H : C(unitInterval × X, S), (∀ w, H w ∈ D) ∧ + (∀ x, H (0, x) = f x) ∧ (∀ x, H (1, x) = g x) ∧ + ∀ x, f x = g x → ∀ t, H (t, x) = f x := by + obtain ⟨e⟩ := hD + let f₀ : C(X, ClosedUnitDisc) := + ⟨fun x => e.symm ⟨f x, hf (mem_range_self x)⟩, by fun_prop⟩ + let f₁ : C(X, ClosedUnitDisc) := + ⟨fun x => e.symm ⟨g x, hg (mem_range_self x)⟩, by fun_prop⟩ + let F : C(unitInterval × X, EuclideanPlane) := + ⟨fun w => (1 - w.1.val) • (f₀ w.2).val + w.1.val • (f₁ w.2).val, by fun_prop⟩ + have hFD : ∀ w, F w ∈ ClosedUnitDisc := by + intro w + exact convex_closedUnitDisc (f₀ w.2).property (f₁ w.2).property + (sub_nonneg.mpr w.1.property.2) w.1.property.1 (sub_add_cancel 1 w.1.val) + let H : C(unitInterval × X, S) := + ⟨fun w => (e ⟨F w, hFD w⟩).val, by fun_prop⟩ + refine ⟨H, fun w => (e ⟨F w, hFD w⟩).property, ?_, ?_, ?_⟩ + · intro x + have heq : (⟨F (0, x), hFD (0, x)⟩ : ClosedUnitDisc) = f₀ x := by + apply Subtype.ext + simp only [F, ContinuousMap.coe_mk, Icc.coe_zero, sub_zero, one_smul, + zero_smul, add_zero] + change (e ⟨F (0, x), hFD (0, x)⟩).val = f x + rw [heq] + exact congrArg Subtype.val (e.apply_symm_apply _) + · intro x + have heq : (⟨F (1, x), hFD (1, x)⟩ : ClosedUnitDisc) = f₁ x := by + apply Subtype.ext + simp only [F, ContinuousMap.coe_mk, Icc.coe_one, sub_self, zero_smul, + one_smul, zero_add] + change (e ⟨F (1, x), hFD (1, x)⟩).val = g x + rw [heq] + exact congrArg Subtype.val (e.apply_symm_apply _) + · intro x hfg t + have heq : f₀ x = f₁ x := congrArg e.symm (Subtype.ext hfg) + have hFt : (⟨F (t, x), hFD (t, x)⟩ : ClosedUnitDisc) = f₀ x := by + apply Subtype.ext + change (1 - t.val) • (f₀ x).val + t.val • (f₁ x).val = (f₀ x).val + rw [← heq, ← add_smul, sub_add_cancel, one_smul] + change (e ⟨F (t, x), hFD (t, x)⟩).val = f x + rw [hFt] + exact congrArg Subtype.val (e.apply_symm_apply _) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73DiscOrientation.lean b/LeanPool/GraphMinor/GM12/Section73DiscOrientation.lean new file mode 100644 index 0000000000..38880b0eba --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73DiscOrientation.lean @@ -0,0 +1,103 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73Tangle +import LeanPool.GraphMinor.GM11.OArcCircuit +import LeanPool.GraphMinor.GM11.Theorem64 +import LeanPool.GraphMinor.GM11.Theorem61 +import LeanPool.GraphMinor.Surface.DiscsInSurface + +/-! +# Orienting a disc separation after vertex deletion + +In XII (7.3), page 261, a disc bounded by a short normal circle in +the deleted drawing must have its inside on the small side. Otherwise +an old tangle member lifts the reverse orientation. XI (6.4) gives a +non-null circle in its large side avoiding the separator. This circle +avoids the deleted vertex and every edge incident with it, so it lies +in the new inside disc, a contradiction. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 GM14 Hypergraph + +/-- A circle in a drawing that avoids a vertex survives deletion of +that vertex, including all its edge points. This is the survival step +in the respectful-tangle argument of XII (7.3), page 261. -/ +theorem oArc_subset_underlying_delete_vertex + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + {Γ : Drawing S} {A : Hypergraph S (Set S)} (hA : A ≤ Γ.toHypergraph) + {F : Set S} {v : S} (hF : IsOArc F) (hFA : F ⊆ PaintingOrDrawing.underlying A) + (hvF : v ∉ F) : F ⊆ PaintingOrDrawing.underlying (A.deleteVertices {v}) := by + have hFΓ : F ⊆ Γ.U := by + intro x hx + rcases hFA hx with hxA | ⟨e, he, hxe⟩ + · exact Γ.V_subset_U (hA.vertexSet_subset hxA) + · exact ((hA.edgeSet_subset he).2.1 hxe).1 + intro x hxF + rcases hFA hxF with hxA | ⟨e, he, hxe⟩ + · exact Or.inl ⟨hxA, fun hxv => hvF (mem_singleton_iff.mp hxv ▸ hxF)⟩ + · have heΓ : e ∈ Γ.E := hA.edgeSet_subset he + have heF : e ⊆ F := edge_subset_of_oArc hF hFΓ heΓ ⟨x, hxe, hxF⟩ + have hno : ∀ w ∈ ({v} : Set S), ¬ A.Inc e w := by + intro w hw hi + have hwcl : w ∈ closure e := (inc_of_le hA hi).2.2 + have hwF : w ∈ F := closure_minimal heF (isCompact_of_isOArc hF).isClosed hwcl + exact hvF (mem_singleton_iff.mp hw ▸ hwF) + exact Or.inr ⟨e, ⟨he, hno⟩, hxe⟩ + +/-- The disc orientation in XII (7.3), page 261, on a surface other +than the sphere. Every short normal circle that bounds a disc has +that disc selected by the deleted-vertex tangle. -/ +theorem disc_orientation_after_vertex_deletion + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsRespectfulDrawingTangle Γ θ T) {v : S} (hv : v ∈ Γ.V) + {D : Set S} (hD : IsClosedDisc D) + (hn : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsNormal (frontier D)) + (hcard : (frontier D ∩ (deleteVertices Γ {v}).V).ncard < θ - 1) : + ((PaintingOrDrawing.drawing (deleteVertices Γ {v})).inter D, + (PaintingOrDrawing.drawing (deleteVertices Γ {v})).interOutside D) ∈ + deleteVerticesTangle Γ.toHypergraph {v} T θ := by + let Γ' := deleteVertices Γ {v} + let A' := (PaintingOrDrawing.drawing Γ').inter D + let B' := (PaintingOrDrawing.drawing Γ').interOutside D + have hnew := theorem_7_3_tangle hθ hT.2.1 hv + have hsep : Γ'.toHypergraph.IsSeparation A' B' := isSeparation_inter hD.isClosed hn + have hord : separationOrder A' B' < θ - 1 := by + apply lt_of_le_of_lt _ hcard + exact ncard_le_ncard (fun x hx => inter_outside_subset hx) + (Γ'.finite_V.subset inter_subset_right) + apply (hnew.axiom1 hsep hord).resolve_right + intro hrev + obtain ⟨⟨A, B⟩, hm, hvAB, hAdel, hBdel⟩ := hrev.2.2 + have hpret : IsPretangle Γ.toHypergraph θ T := + ⟨hT.2.1.one_le, hT.2.1.isSeparation, hT.2.1.order_lt, hT.2.1.axiom1, hT.2.1.axiom2⟩ + have hsepOld := hT.2.1.isSeparation hm + have hordOld := hT.2.1.order_lt hm + obtain ⟨F, hF, hFB, hnon⟩ := + ((GM11.theorem_6_4_proof hS hns hT.1 hpret hT.2.2).1 A B hsepOld hordOld).2.mp hm + have hvA : v ∈ A.vertexSet := (hvAB (mem_singleton v)).1 + have hvF : v ∉ F := fun hvF => (hFB hvF).2 (Or.inl hvA) + have hsurvive := oArc_subset_underlying_delete_vertex hsepOld.right_le hF + (hFB.trans sdiff_subset) hvF + rw [hBdel] at hsurvive + have hFD : F ⊆ D := by + intro x hx + rcases hsurvive hx with hxA | ⟨e, he, hxe⟩ + · exact hxA.2 + · exact he.2 hxe + exact hnon (isNullHomotopicOArcIn_of_subset_disc hF (subset_univ D) hD hFD) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73DiscPreprocess.lean b/LeanPool/GraphMinor/GM12/Section73DiscPreprocess.lean new file mode 100644 index 0000000000..066409ceaf --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73DiscPreprocess.lean @@ -0,0 +1,164 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73Tangle +import LeanPool.GraphMinor.GM12.Section78 +import LeanPool.GraphMinor.GM12.Section72RadialExists +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Removing a selected one-vertex disc before vertex contraction + +The parallel-edge claim in the proof of XII (7.3), page 261, fails +when a loop is attached at the deleted vertex: the outer loop face +has two corners there even though deleting the vertex leaves a two-cell drawing. +The smallest correction first applies (7.2) to such selected insides. +Here we prove that this does not change the drawing after vertex +deletion. Its connected point set misses the one-vertex boundary. +The third tangle axiom provides a surviving vertex outside the disc, +so the whole deleted drawing lies outside it. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 GM14 Hypergraph + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +/-- If vertex deletion leaves a two-cell drawing, that drawing misses +every selected disc whose normal boundary meets just the deleted +vertex. This justifies the preprocessing needed in XII (7.3). -/ +theorem deleted_drawing_disjoint_selected_vertex_disc [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph θ T) {v : S} + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) + {D F : Set S} (hD : IsClosedDisc D) (hbd : subBd D = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) (hFV : F ∩ Γ.V = {v}) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) : + Disjoint (deleteVertices Γ {v}).U D := by + let Γ' := deleteVertices Γ {v} + have hΓ : Γ'.IsSubdrawing Γ := deleteVertices_isSubdrawing Γ {v} + have hvFV : v ∈ F ∩ Γ.V := hFV.symm ▸ mem_singleton v + have hfront : frontier D = F := (subBd_eq_frontier D).symm.trans hbd + have hvD : v ∈ D := hD.isClosed.closure_subset_iff.mpr subset_rfl + ((hfront.symm ▸ hvFV.1).1) + have hvnot : v ∉ Γ'.U := by + intro hvU + have hvV := (isSubdrawing_U_inter_V hΓ).subset ⟨hvU, hvFV.2⟩ + exact ((deleteVertices_V Γ {v}).subset hvV).2 rfl + have hnotall : ¬ Γ.V ⊆ D := by + intro hsub + apply hT.axiom3 hm + exact inter_eq_left.mpr hsub + obtain ⟨w, hwΓ, hwD⟩ := not_subset.mp hnotall + have hwNew : w ∈ Γ'.V := by + rw [deleteVertices_V] + exact ⟨hwΓ, fun hwv => hwD (mem_singleton_iff.mp hwv ▸ hvD)⟩ + have hdis : Disjoint Γ'.U (discBd D) := by + apply disjoint_left.mpr + intro x hxNew hxBd + have hxF : x ∈ F := hfront ▸ (IsClosedDisc.frontier_eq_discBd hS hD).symm ▸ hxBd + have hxV : x ∈ Γ.V := hn ⟨hxF, hΓ.U_subset hxNew⟩ + have hxv : x = v := hFV.subset ⟨hxF, hxV⟩ + exact hvnot (hxv ▸ hxNew) + rcases hD.side (fun x => (hS.2.2 x).isManifoldPoint) + (isPreconnected_U_of_isTwoCell hS htwo) hdis with hin | hout + · exact (hwD ((discInt_subset D) (hin (Γ'.V_subset_U hwNew)))).elim + · exact hout + +/-- Closed-set restriction commutes with vertex deletion, including +all ends of the surviving edges. -/ +theorem deleteVertices_interSet {Γ : Drawing S} {X Z : Set S} (hX : IsClosed X) : + deleteVertices (Γ.interSet X) Z = (deleteVertices Γ Z).interSet X := by + have hsub : (Γ.interSet X).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + apply Drawing.ext_of_V_E + · ext x + simp only [deleteVertices_V, mem_interSet_V_iff hX, mem_sdiff] + tauto + · ext e + rw [deleteVertices_E, mem_interSet_E_iff, deleteVertices_E] + simp only [mem_ofPred_eq, mem_interSet_E_iff] + constructor + · rintro ⟨⟨he, heX⟩, hd⟩ + have he' := mem_interSet_E_iff.mpr ⟨he, heX⟩ + rw [hsub.closure_inter_V he'] at hd + exact ⟨⟨he, hd⟩, heX⟩ + · rintro ⟨⟨he, hd⟩, heX⟩ + have he' := mem_interSet_E_iff.mpr ⟨he, heX⟩ + rw [← hsub.closure_inter_V he'] at hd + exact ⟨⟨he, heX⟩, hd⟩ + +/-- Removing the selected disc before deleting its boundary vertex +does not change the resulting two-cell drawing. This corrects the +loop issue in the radial contraction used in XII (7.3), page 261. -/ +theorem selected_disc_restriction_delete_vertex_eq [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph θ T) {v : S} + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) + {D F : Set S} (hD : IsClosedDisc D) (hbd : subBd D = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) (hFV : F ∩ Γ.V = {v}) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) : + deleteVertices (Γ.interSet (closure (univ \ D))) {v} = deleteVertices Γ {v} := by + rw [deleteVertices_interSet isClosed_closure] + apply interSet_eq_self_of_U_subset isClosed_closure + intro x hx + exact subset_closure ⟨mem_univ _, disjoint_left.mp + (deleted_drawing_disjoint_selected_vertex_disc hS hT htwo hD hbd hn hFV hm) hx⟩ + +/-- The only old vertex in a selected one-vertex disc is its boundary +vertex when deleting that vertex leaves a two-cell drawing. -/ +theorem vertices_in_selected_vertex_disc [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph θ T) {v : S} + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) + {D F : Set S} (hD : IsClosedDisc D) (hbd : subBd D = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) (hFV : F ∩ Γ.V = {v}) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) : Γ.V ∩ D = {v} := by + have hdis := deleted_drawing_disjoint_selected_vertex_disc hS hT htwo hD hbd hn hFV hm + have hvFV : v ∈ F ∩ Γ.V := hFV.symm ▸ mem_singleton v + have hvD : v ∈ D := hD.isClosed.closure_subset_iff.mpr subset_rfl + (((subBd_eq_frontier D).symm.trans hbd).symm ▸ hvFV.1).1 + apply Subset.antisymm + · rintro x ⟨hxΓ, hxD⟩ + by_contra hxv + have hxNew : x ∈ (deleteVertices Γ {v}).V := (deleteVertices_V Γ {v}).symm ▸ ⟨hxΓ, hxv⟩ + exact disjoint_left.mp hdis ((deleteVertices Γ {v}).V_subset_U hxNew) hxD + · rintro x hx + have hxv := mem_singleton_iff.mp hx + subst x + exact ⟨hvFV.2, hvD⟩ + +/-- Removing a selected inside containing an old edge strictly +reduces the number of edges. This supplies the finite induction +measure for preprocessing in XII (7.3). -/ +theorem ncard_edges_outside_lt_of_edge_inside {Γ : Drawing S} {D : Set S} + (hn : frontier D ∩ Γ.U ⊆ Γ.V) {e : Set S} (he : e ∈ Γ.E) (heD : e ⊆ D) : + (Γ.interSet (closure (univ \ D))).E.ncard < Γ.E.ncard := by + have hsub : (Γ.interSet (closure (univ \ D))).E ⊆ Γ.E := (Drawing.span_isSubdrawing Γ _ _).2 + have hen : e ∉ (Γ.interSet (closure (univ \ D))).E := by + intro heNew + have heOut := (mem_interSet_E_iff.mp heNew).2 + obtain ⟨x, hxe⟩ := he.1 + have hxFront : x ∈ frontier D := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure (heD hxe), by simpa only [compl_eq_univ_sdiff] using heOut hxe⟩ + exact (he.2.1 hxe).2 (hn ⟨hxFront, (he.2.1 hxe).1⟩) + exact ncard_lt_ncard ⟨hsub, fun hback => hen (hback he)⟩ Γ.finite_edges + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73DiscSupportedHomotopy.lean b/LeanPool/GraphMinor/GM12/Section73DiscSupportedHomotopy.lean new file mode 100644 index 0000000000..ccbd2373b8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73DiscSupportedHomotopy.lean @@ -0,0 +1,131 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73DiscInterpolation +import Mathlib.Topology.ContinuousOn +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Extending the disc interpolation by the identity + +For XII (7.3), Claim (1), page 262, a collapse supported in a +closed disc deforms to the identity without moving any point +outside the disc's interior. Interpolate in disc coordinates, +then paste with the identity on the closed complement of the +interior. The two formulas agree on the boundary. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- A map supported inside a closed disc and preserving that disc +is homotopic to the identity, fixing its boundary and outside. +This controls the boundary deformation for the selected-inside +comparison in XII (7.3), Claim (1), page 262. -/ +theorem exists_disc_supported_homotopy + {S : Type*} [TopologicalSpace S] [T2Space S] + {D : Set S} (hD : IsClosedDisc D) (f : C(S, S)) + (hmap : ∀ x ∈ D, f x ∈ D) (hfix : ∀ x ∉ interior D, f x = x) : + ∃ H : C(unitInterval × S, S), (∀ x, H (0, x) = x) ∧ + (∀ x, H (1, x) = f x) ∧ + (∀ t x, x ∉ interior D → H (t, x) = x) ∧ + ∀ t x, x ∈ D → H (t, x) ∈ D := by + classical + let ι : C(D, S) := ⟨Subtype.val, continuous_subtype_val⟩ + let fd : C(D, S) := f.comp ι + obtain ⟨F, hFD, hF₀, hF₁, hFfix⟩ := exists_disc_interpolation hD ι fd + (by rintro _ ⟨x, rfl⟩; exact x.property) + (by rintro _ ⟨x, rfl⟩; exact hmap x.val x.property) + let H : unitInterval × S → S := fun w => + if hx : w.2 ∈ D then F (w.1, ⟨w.2, hx⟩) else w.2 + have hHfix : ∀ t x, x ∉ interior D → H (t, x) = x := by + intro t x hx + dsimp only [H] + by_cases hxD : x ∈ D + · rw [dite_eq_left hxD] + exact hFfix ⟨x, hxD⟩ (hfix x hx).symm t + · rw [dite_eq_right hxD] + have hOn : ContinuousOn H (Prod.snd ⁻¹' D) := by + apply continuousOn_iff_continuous_domRestrict.mpr + have hc : Continuous (fun w : (Prod.snd ⁻¹' D : Set (unitInterval × S)) => + F (w.val.1, ⟨w.val.2, w.property⟩)) := by fun_prop + apply hc.congr + intro w + change F (w.val.1, ⟨w.val.2, w.property⟩) = + if hx : w.val.2 ∈ D then F (w.val.1, ⟨w.val.2, hx⟩) else w.val.2 + have hwD : w.val.2 ∈ D := w.property + rw [dite_eq_left hwD] + have hOff : ContinuousOn H (Prod.snd ⁻¹' (interior D)ᶜ) := by + apply continuous_snd.continuousOn.congr + intro w hw + exact hHfix w.1 w.2 hw + have hcover : (Prod.snd ⁻¹' D : Set (unitInterval × S)) ∪ + (Prod.snd ⁻¹' (interior D)ᶜ) = univ := by + apply eq_univ_of_forall + intro w + by_cases hw : w.2 ∈ interior D + · exact Or.inl (show w.2 ∈ D from interior_subset hw) + · exact Or.inr hw + have hcont : Continuous H := by + have hc := hOn.union_of_isClosed hOff + (hD.isCompact.isClosed.preimage continuous_snd) + (isOpen_interior.isClosed_compl.preimage continuous_snd) + rw [hcover] at hc + exact continuousOn_univ.mp hc + refine ⟨⟨H, hcont⟩, ?_, ?_, hHfix, ?_⟩ + · intro x + change H (0, x) = x + dsimp only [H] + by_cases hx : x ∈ D + · rw [dite_eq_left hx] + exact hF₀ ⟨x, hx⟩ + · rw [dite_eq_right hx] + · intro x + change H (1, x) = f x + dsimp only [H] + by_cases hx : x ∈ D + · rw [dite_eq_left hx] + exact hF₁ ⟨x, hx⟩ + · rw [dite_eq_right hx] + exact (hfix x (fun hi => hx (interior_subset hi))).symm + · intro t x hx + change H (t, x) ∈ D + dsimp only [H] + rw [dite_eq_left hx] + exact hFD _ + +/-- A supported disc deformation gives a homotopy of any closed +curve to its image. The homotopy stays in any set containing the +curve and the supporting disc. This permits the punctured-surface +comparison of selected insides in XII (7.3), Claim (1). -/ +theorem closedCurve_homotopic_of_disc_supported_map + {S : Type*} [TopologicalSpace S] [T2Space S] + {D Z : Set S} (hD : IsClosedDisc D) (f : C(S, S)) + (hmap : ∀ x ∈ D, f x ∈ D) (hfix : ∀ x ∉ interior D, f x = x) + (φ : C(Circle, S)) (hφZ : range φ ⊆ Z) (hDZ : D ⊆ Z) : + ClosedCurvesHomotopicIn Z φ (f.comp φ) := by + obtain ⟨H, hH₀, hH₁, hHfix, hHD⟩ := exists_disc_supported_homotopy hD f hmap hfix + let Ψ : C(Circle × unitInterval, S) := ⟨fun w => H (w.2, φ w.1), by fun_prop⟩ + refine ⟨Ψ, ?_, ?_, ?_⟩ + · intro w + change H (w.2, φ w.1) ∈ Z + by_cases hx : φ w.1 ∈ D + · exact hDZ (hHD w.2 _ hx) + · rw [hHfix w.2 _ (fun hi => hx (interior_subset hi))] + exact hφZ (mem_range_self _) + · intro z + exact hH₀ (φ z) + · intro z + exact hH₁ (φ z) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73DrawingImages.lean b/LeanPool/GraphMinor/GM12/Section73DrawingImages.lean new file mode 100644 index 0000000000..5cab255c90 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73DrawingImages.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Walks + +/-! +# Determining the image of a circuit from its vertices and edges + +For XII (7.3), Claim (1), page 262, identify the collapsed old +circuit with the new circuit. It suffices to check vertices and +open edges. Continuity handles the old edge closures, and the +compactness of the old drawing makes its image closed, so the +new edge closures are included as well. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- To map one drawing's point set into another, it suffices to +map its vertices and open edges there. This checks the forward +inclusion for the collapsed circuit in XII (7.3), Claim (1). -/ +theorem drawing_image_subset_of_vertex_edge_images + {S : Type*} [TopologicalSpace S] {D C : Drawing S} (f : C(S, S)) + (hV : f '' D.V ⊆ C.U) (hE : ∀ e ∈ D.E, f '' e ⊆ C.U) : + f '' D.U ⊆ C.U := by + rintro z ⟨x, hx, rfl⟩ + rw [D.U_eq] at hx + rcases hx with hxV | hxE + · exact hV ⟨x, hxV, rfl⟩ + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hxE + have hximg : f x ∈ closure (f '' e) := image_closure_subset_closure_image f.continuous + ⟨x, hxe, rfl⟩ + exact closure_minimal (hE e he) C.isClosed_U hximg + +/-- On a compact Hausdorff surface the collapsed drawing equals +the new drawing once the forward vertex and edge images and the +reverse vertex and edge containments are known. This identifies +the circuit image in XII (7.3), Claim (1), page 262. -/ +theorem drawing_image_eq_of_vertex_edge_images + {S : Type*} [TopologicalSpace S] [T2Space S] [CompactSpace S] + {D C : Drawing S} (f : C(S, S)) + (hV : f '' D.V ⊆ C.U) (hE : ∀ e ∈ D.E, f '' e ⊆ C.U) + (hV' : C.V ⊆ f '' D.U) (hE' : ∀ e ∈ C.E, e ⊆ f '' D.U) : + f '' D.U = C.U := by + apply Subset.antisymm (drawing_image_subset_of_vertex_edge_images f hV hE) + have hclosed : IsClosed (f '' D.U) := (D.isClosed_U.isCompact.image f.continuous).isClosed + intro x hx + rw [C.U_eq] at hx + rcases hx with hxV | hxE + · exact hV' hxV + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hxE + exact closure_minimal (hE' e he) hclosed hxe + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73EdgeContraction.lean b/LeanPool/GraphMinor/GM12/Section73EdgeContraction.lean new file mode 100644 index 0000000000..665963ee6a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73EdgeContraction.lean @@ -0,0 +1,103 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73ContractDrawing +public import LeanPool.GraphMinor.GM12.Section73ArcCollapse +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# Contracting an edge with no parallel mate + +In XII (7.3), page 261, each edge of the radial star has distinct +ends and no parallel mate. These conditions imply that every other +edge meets its closure in at most one point. Contract its interval +parameterization, then assemble the image edges into a drawing. +A prescribed closed set disjoint from the edge closure stays fixed. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Distinct edges meet a nonparallel edge in at most one point. +This supplies the intersection condition for the radial contractions +in XII (7.3), page 261. -/ +theorem closure_inter_subsingleton_of_unique_link + {S : Type*} [TopologicalSpace S] {K : Drawing S} {e : Set S} {v u : S} + (hel : K.toGraph.IsLink e v u) (hvu : v ≠ u) + (hlines : ∀ g ∈ K.E, ∃ a b : S, IsLineWithEnds (closure g) a b ∧ + closure g ∩ K.V = {a, b}) + (hunique : ∀ g ∈ K.E, K.toGraph.IsLink g v u → g = e) : + ∀ g ∈ K.E, g ≠ e → (closure g ∩ closure e).Subsingleton := by + intro g hg hge + have hnotboth : ¬ (v ∈ closure g ∧ u ∈ closure g) := by + rintro ⟨hvg, hug⟩ + obtain ⟨a, b, _, hcap⟩ := hlines g hg + have hva : v = a ∨ v = b := hcap.subset ⟨hvg, hel.2.1⟩ + have hua : u = a ∨ u = b := hcap.subset ⟨hug, hel.2.2.1⟩ + have hcap' : closure g ∩ K.V = {v, u} := by + rcases hva with rfl | rfl <;> rcases hua with h | h + · exact False.elim (hvu h.symm) + · simpa only [h] using hcap + · simpa only [h, pair_comm] using hcap + · exact False.elim (hvu h.symm) + exact hge (hunique g hg ⟨hg, hel.2.1, hel.2.2.1, hcap'⟩) + intro x hx y hy + have hxV := closure_inter_subset_V hg hel.1 hge hx + have hyV := closure_inter_subset_V hg hel.1 hge hy + rcases hel.2.2.2.subset ⟨hx.2, hxV⟩ with rfl | rfl <;> + rcases hel.2.2.2.subset ⟨hy.2, hyV⟩ with rfl | rfl + · rfl + · exact False.elim (hnotboth ⟨hx.1, hy.1⟩) + · exact False.elim (hnotboth ⟨hy.1, hx.1⟩) + · rfl + +/-- Realize one radial-star contraction by a continuous surjection +and an image drawing. Only the chosen edge closure is identified. +This is one edge of the contraction in XII (7.3), page 261. -/ +theorem exists_edge_contraction + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {K : Drawing S} {e : Set S} {v u : S} + (hel : K.toGraph.IsLink e v u) (hvu : v ≠ u) + (hlines : ∀ g ∈ K.E, ∃ a b : S, IsLineWithEnds (closure g) a b ∧ + closure g ∩ K.V = {a, b}) + (hunique : ∀ g ∈ K.E, K.toGraph.IsLink g v u → g = e) + {F : Set S} (hF : IsClosed F) (havoid : Disjoint (closure e) F) : + ∃ (f : C(S, S)) (H : Drawing S), + Function.Surjective f ∧ (∀ x ∈ F, f x = x) ∧ + (∀ x ∈ closure e, f x = v) ∧ + (∀ x y, f x = f y ↔ x = y ∨ (x ∈ closure e ∧ y ∈ closure e)) ∧ + H.U = f '' K.U ∧ H.V = f '' K.V ∧ + H.E = (fun g => f '' g) '' (K.E \ {e}) := by + obtain ⟨p, hp0, hp1⟩ := isLine_closure hel.1 hvu hel.2.2.2 + let a : unitInterval → S := fun t => (p t).val + have ha : IsArcMap a := ⟨continuous_subtype_val.comp p.continuous, + fun _ _ h => p.injective (Subtype.ext h)⟩ + have hrange : range a = closure e := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (p t).property + · intro hx + exact ⟨p.symm ⟨x, hx⟩, congrArg Subtype.val (p.apply_symm_apply ⟨x, hx⟩)⟩ + obtain ⟨f, hsurj, hfix, hconst, hfibre⟩ := exists_arc_collapse hS ha hF (hrange ▸ havoid) + have hcollapse : ∀ x ∈ closure e, f x = v := by + intro x hx + exact (hconst x (hrange.symm ▸ hx)).trans hp0 + have hfibre' : ∀ x y, f x = f y ↔ x = y ∨ (x ∈ closure e ∧ y ∈ closure e) := by + simpa only [hrange] using hfibre + obtain ⟨H, hHU, hHV, hHE⟩ := exists_drawing_of_edge_collapse hel.1 hel.2.1 + (hel.2.2.2.superset (Or.inl rfl)).1 hlines + (closure_inter_subsingleton_of_unique_link hel hvu hlines hunique) f hcollapse hfibre' + exact ⟨f, H, hsurj, hfix, hcollapse, hfibre', hHU, hHV, hHE⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73EdgeWalkLift.lean b/LeanPool/GraphMinor/GM12/Section73EdgeWalkLift.lean new file mode 100644 index 0000000000..e39a3264d8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73EdgeWalkLift.lean @@ -0,0 +1,157 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73SpokeImages +import LeanPool.GraphMinor.GM12.Section73WalkPointSets +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.GM11.RadialRegions +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# Replacing a contracted radial edge by an old path + +In XII (7.3), page 261, a new spoke at the merged hub corresponds +to a two-edge path through an old hub. Every other new spoke is an +unchanged old spoke. The old radial vertices outside the merged +region stay fixed, and every old hub inside it has a spoke to the +deleted vertex. This file constructs the replacement paths in both +orientations and proves their lengths. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +open Classical in +/-- Each edge of the cleaned contraction lifts to one old edge, +or to two old edges when incident with the merged hub. This is the +edge replacement defining the lifted walk in XII (7.3), page 261. -/ +theorem exists_edge_walk_lift + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K J : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + (f : C(S, S)) (hfix : ∀ x ∉ r', f x = x) + (hcollapse : ∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + (hJV : J.V = f '' K.V) + (hJE : J.E ⊆ (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g}) + {e : Set S} {x y : S} (hel : J.toGraph.IsLink e x y) : + ∃ W : GraphWalk K.toGraph x y, + W.length = (if x = v ∨ y = v then 2 else 1) ∧ + f '' (walkDrawing K W).U = closure e ∧ + (walkDrawing K W).U \ r' = closure e \ r' ∧ + (x ≠ v → y ≠ v → e ∈ K.E) := by + classical + obtain ⟨g, hg, rfl⟩ := hJE hel.1 + obtain ⟨w, hw, r, hr, u, hur, huK, hcap, _⟩ := spoke_ends ⟨hK.1, hK.2.1⟩ hS hg.1 + have hwv : w ≠ v := fun h => hg.2 (h ▸ (hcap.superset (Or.inl rfl)).1) + have huv : u ≠ v := fun h => region_subset hr (h ▸ hur) (Γ.V_subset_U hv) + have hun : u ∉ Γ.V := fun hu => region_subset hr hur (Γ.V_subset_U hu) + have hwnew : w ∈ (deleteVertices Γ {v}).V := by + rw [deleteVertices_V] + exact ⟨hw, hwv⟩ + have hwnr : w ∉ r' := fun hwr => region_subset hr' hwr ((deleteVertices Γ {v}).V_subset_U hwnew) + have hfw : f w = w := hfix w hwnr + have hwu : w ≠ u := fun h => region_subset hr (h ▸ hur) (Γ.V_subset_U hw) + have hcapimage : closure (f '' g) ∩ J.V = {w, f u} := by + rw [hJV, closure_image_inter_vertices (isLine_closure hg.1 hwu hcap) + (radial_edge_inter_star hS ⟨hK.1, hK.2.1⟩ hv hg.1 hg.2).2 f hfibre, + hcap, image_pair, hfw] + have hpair : ({x, y} : Set S) = {w, f u} := hel.2.2.2.symm.trans hcapimage + have hgl : K.toGraph.IsLink g w u := ⟨hg.1, hK.2.1.2.1 hw, huK, hcap⟩ + have hclimage : closure (f '' g) = f '' closure g := + closure_image_eq_of_compact_closure f.continuous (isLine_closure hg.1 hwu hcap).isCompact + have houtside : closure (f '' g) \ r' = closure g \ r' := by + rw [hclimage] + exact (collapse_image_diff_eq hfibre hfix + (radial_star_subset_deleted_region hS ⟨hK.1, hK.2.1⟩ hv hr' hvr')).2 (closure g) + by_cases hur' : u ∈ r' + · have hfu : f u = v := hcollapse u + (radial_vertices_in_deleted_region hS hK hE hv hr' hvr' ⟨huK, hur'⟩) + obtain ⟨k, hk, hkl⟩ := exists_spoke_to_hub_in_deleted_region hS hK hE hv hr' hvr' huK hun hur' + let P : GraphWalk K.toGraph v w := .cons hkl (.cons hgl.symm (.nil (hK.2.1.2.1 hw))) + have hPlen : P.length = 2 := by rfl + have hkR : closure k ⊆ r' := by + intro z hz + apply radial_star_subset_deleted_region hS ⟨hK.1, hK.2.1⟩ hv hr' hvr' + exact Or.inr (mem_iUnion₂.mpr ⟨k, ⟨hk, (hkl.2.2.2.superset (Or.inl rfl)).1⟩, hz⟩) + have himagek : f '' closure k = {v} := by + apply Subset.antisymm + · rintro z ⟨a, hak, haz⟩ + exact haz.symm.trans (hcollapse a (Or.inr (mem_iUnion₂.mpr + ⟨k, ⟨hk, (hkl.2.2.2.superset (Or.inl rfl)).1⟩, hak⟩))) + · intro z hz + have hzv : z = v := hz + rw [hzv] + exact ⟨v, (hkl.2.2.2.superset (Or.inl rfl)).1, hcollapse v (Or.inl rfl)⟩ + have hvimg : v ∈ closure (f '' g) := by + have hvimg' := (hcapimage.superset (Or.inr rfl)).1 + rwa [hfu] at hvimg' + have hPimage : f '' (walkDrawing K P).U = closure (f '' g) := by + change f '' (walkDrawing K (.cons hkl (.cons hgl.symm (.nil (hK.2.1.2.1 hw))))).U = _ + rw [walkDrawing_two_edges_points, image_union, himagek, ← hclimage] + exact union_eq_right.mpr (singleton_subset_iff.mpr hvimg) + have hPpoints : (walkDrawing K P).U \ r' = closure (f '' g) \ r' := by + change (walkDrawing K (.cons hkl (.cons hgl.symm (.nil (hK.2.1.2.1 hw))))).U \ r' = _ + rw [walkDrawing_two_edges_points, union_sdiff_distrib, sdiff_eq_empty.mpr hkR, empty_union, + houtside] + rw [hfu] at hpair + rcases pair_eq_pair_iff.mp hpair with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · refine ⟨P.reverse, by simpa only [GraphWalk.length_reverse, or_true, ite_true] using hPlen, + ?_, ?_, fun _ hyn => False.elim (hyn rfl)⟩ + · rw [walkDrawing_reverse_points] + exact hPimage + · rw [walkDrawing_reverse_points] + exact hPpoints + · exact ⟨P, by simpa only [true_or, ite_true] using hPlen, hPimage, hPpoints, + fun hxn _ => False.elim (hxn rfl)⟩ + · have hfu : f u = u := hfix u hur' + have hdis := spoke_closure_disjoint_deleted_region hS ⟨hK.1, hK.2.1⟩ hr' + hg.1 hg.2 hw hr hur hcap hur' + have himage : f '' g = g := by + apply Subset.antisymm + · rintro z ⟨a, hag, haz⟩ + have haf : f a = a := hfix a (fun har' => disjoint_left.mp hdis (subset_closure hag) har') + exact (haf.symm.trans haz) ▸ hag + · intro z hzg + exact ⟨z, hzg, hfix z (fun hzr' => disjoint_left.mp hdis (subset_closure hzg) hzr')⟩ + let P : GraphWalk K.toGraph w u := .cons hgl (.nil huK) + have hPlen : P.length = 1 := by rfl + have hPimage : f '' (walkDrawing K P).U = closure (f '' g) := by + rw [walkDrawing_one_edge_points] + exact hclimage.symm + have hPpoints : (walkDrawing K P).U \ r' = closure (f '' g) \ r' := by + rw [walkDrawing_one_edge_points, houtside] + rw [hfu] at hpair + rcases pair_eq_pair_iff.mp hpair with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · refine ⟨P, by simpa only [hwv, huv, false_or, ite_false] using hPlen, hPimage, hPpoints, ?_⟩ + intro _ _ + change f '' g ∈ K.E + rw [himage] + exact hg.1 + · refine ⟨P.reverse, by simpa only [GraphWalk.length_reverse, huv, hwv, false_or, + ite_false] using hPlen, + ?_, ?_, ?_⟩ + · rw [walkDrawing_reverse_points] + exact hPimage + · rw [walkDrawing_reverse_points] + exact hPpoints + · intro _ _ + change f '' g ∈ K.E + rw [himage] + exact hg.1 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73EmptyBigon.lean b/LeanPool/GraphMinor/GM12/Section73EmptyBigon.lean new file mode 100644 index 0000000000..0e6f22715d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73EmptyBigon.lean @@ -0,0 +1,156 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73InnermostBigon +public import LeanPool.GraphMinor.GM11.Regions +public import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.GM11.RadialCorners +import LeanPool.GraphMinor.GM12.Section73ImageArc +import LeanPool.GraphMinor.GM11.Section4c +import LeanPool.GraphMinor.GM14.DiscSlope + +/-! +# An innermost bigon is an empty region + +In the radial cleanup of XII (7.3), page 261, a bigon in a region +has no radial vertices except its two ends. Choose an innermost +parallel-spoke bigon. Any other edge meeting its interior must lie +inside it, have the same two ends, and contradict minimality. The +interior therefore misses the drawing. Its boundary lies in the +drawing, so the interior is one whole region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A loopless edge whose closure lies in a disc containing only +two drawing vertices has exactly those two ends. This identifies +possible interior spokes in the cleanup of XII (7.3), page 261. -/ +theorem edge_ends_of_two_vertices_in_disc + {S : Type*} [TopologicalSpace S] {H : Drawing S} {k Q : Set S} {v u : S} + (hline : ∃ a b, IsLineWithEnds (closure k) a b ∧ closure k ∩ H.V = {a, b}) + (hVQ : H.V ∩ Q ⊆ {v, u}) (hkQ : closure k ⊆ Q) : + closure k ∩ H.V = {v, u} := by + obtain ⟨a, b, hL, hcap⟩ := hline + have ha := hcap.superset (Or.inl rfl) + have hb := hcap.superset (Or.inr rfl) + have haends := hVQ ⟨ha.2, hkQ ha.1⟩ + have hbends := hVQ ⟨hb.2, hkQ hb.1⟩ + have hab := lineWithEnds_ends_ne hL + rcases haends with hav | hau <;> rcases hbends with hbv | hbu + · exact False.elim (hab (hav.trans hbv.symm)) + · rw [hcap, hav, hbu] + · rw [hcap, hau, hbv, pair_comm] + · exact False.elim (hab (hau.trans hbu.symm)) + +/-- A parallel-spoke bigon containing only its two end vertices +contains an empty bigon that is a region of the drawing. This gives +a region on which to perform the cleanup in XII (7.3), page 261. -/ +theorem exists_empty_parallel_bigon_region + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H : Drawing S} + (hlines : ∀ k ∈ H.E, ∃ a b, IsLineWithEnds (closure k) a b ∧ + closure k ∩ H.V = {a, b}) + {g h Q : Set S} {v u : S} (hg : g ∈ H.E) (hh : h ∈ H.E) + (hgh : g ≠ h) (hvu : v ≠ u) + (hcg : closure g ∩ H.V = {v, u}) (hch : closure h ∩ H.V = {v, u}) + (hQ : IsClosedDisc Q) (hbd : discBd Q = closure g ∪ closure h) + (hVQ : H.V ∩ Q ⊆ {v, u}) : + ∃ (P a b : Set S), IsClosedDisc P ∧ P ⊆ Q ∧ a ∈ H.E ∧ b ∈ H.E ∧ + a ≠ b ∧ closure a ∩ H.V = {v, u} ∧ closure b ∩ H.V = {v, u} ∧ + discBd P = closure a ∪ closure b ∧ + Disjoint (discInt P) H.U ∧ discInt P ∈ H.R := by + obtain ⟨P, a, b, hP, hPQ, ha, hb, hab, hca, hcb, hbdP, hmin⟩ := + exists_innermost_parallel_bigon hg hh hgh hvu hcg hch hQ hbd + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hother : ∀ k ∈ H.E, k ≠ a → k ≠ b → Disjoint k P := by + intro k hk hka hkb + have hdisbd : Disjoint k (discBd P) := by + apply disjoint_left.mpr + intro x hxk hxbd + rw [hbdP] at hxbd + have hxV : x ∈ H.V := by + rcases hxbd with hxa | hxb + · exact closure_inter_subset_V hk ha hka ⟨subset_closure hxk, hxa⟩ + · exact closure_inter_subset_V hk hb hkb ⟨subset_closure hxk, hxb⟩ + exact (hk.2.1 hxk).2 hxV + rcases hP.side hman hk.2.2.1.isConnected.isPreconnected hdisbd with hin | hout + · have hkP : k ⊆ P := hin.trans (discInt_subset P) + have hck : closure k ∩ H.V = {v, u} := edge_ends_of_two_vertices_in_disc + (hlines k hk) hVQ ((closure_minimal hkP hP.isClosed).trans hPQ) + exact False.elim ((hmin k hk hck hkP).elim hka hkb) + · exact hout + have hendsbd : ({v, u} : Set S) ⊆ discBd P := fun x hx => + hbdP ▸ Or.inl (hca.superset hx).1 + have hdis : Disjoint (discInt P) H.U := by + apply disjoint_left.mpr + intro x hxP hxH + have hxV : x ∉ H.V := by + intro hxV + exact hxP.2 (hendsbd (hVQ ⟨hxV, hPQ hxP.1⟩)) + rw [H.U_eq] at hxH + rcases hxH with hxV' | hxH + · exact hxV hxV' + obtain ⟨k, hk, hxk⟩ := mem_iUnion₂.mp hxH + by_cases hka : k = a + · exact hxP.2 (hbdP ▸ Or.inl (hka ▸ hxk)) + · by_cases hkb : k = b + · exact hxP.2 (hbdP ▸ Or.inr (hkb ▸ hxk)) + · exact disjoint_left.mp (hother k hk hka hkb) + ((H.closure_diff_V hk).subset ⟨hxk, hxV⟩) hxP.1 + obtain ⟨x, hxP⟩ := hP.nonempty_discInt + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem (disjoint_left.mp hdis hxP) + have hPr : discInt P ⊆ r := subset_region hr hP.isPreconnected_discInt hdis hxP hxr + have hrbd : Disjoint r (discBd P) := by + apply disjoint_left.mpr + intro y hyr hybd + rw [hbdP] at hybd + rcases hybd with hya | hyb + · exact region_subset hr hyr (H.closure_subset_U ha hya) + · exact region_subset hr hyr (H.closure_subset_U hb hyb) + have hrP : r ⊆ discInt P := by + rcases hP.side hman (region_isPreconnected hr) hrbd with hin | hout + · exact hin + · exact False.elim (disjoint_left.mp hout hxr hxP.1) + have hregion : discInt P ∈ H.R := (Subset.antisymm hPr hrP) ▸ hr + exact ⟨P, a, b, hP, hPQ, ha, hb, hab, hca, hcb, hbdP, hdis, hregion⟩ + +/-- A boundary edge of a disc region has a second incident region +outside that disc. This makes the empty-bigon deletion in XII (7.3), +page 261, a deletion between distinct regions. -/ +theorem exists_region_outside_disc_at_edge + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H : Drawing S} {e P : Set S} + (he : e ∈ H.E) (hP : IsClosedDisc P) (hebd : e ⊆ discBd P) : + ∃ q ∈ H.R, q ≠ discInt P ∧ e ⊆ closure q := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨x, hxe⟩ := he.1 + obtain ⟨W, A₁, A₂, hW, hxW, _, hcover, hc₁, hc₂, hd₁, hd₂, hcl₁, hcl₂⟩ := + exists_edge_sides hS H he hxe + have hxfr : x ∈ frontier P := (IsClosedDisc.frontier_eq_discBd hS hP).symm ▸ hebd hxe + have hxcl : x ∈ closure (Pᶜ) := by + rw [frontier_eq_closure_inter_closure] at hxfr + exact hxfr.2 + obtain ⟨z, hzW, hzP⟩ := mem_closure_iff.mp hxcl W hW hxW + obtain ⟨y, hyO, hyH⟩ := exists_notMem_U (Γ := H) hS (hW.inter hP.isClosed.isOpen_compl) + ⟨z, hzW, hzP⟩ + obtain ⟨q, hq, hyq⟩ := exists_region_of_notMem hyH + have hxq : x ∈ closure q := by + rcases hcover ⟨hyO.1, hyH⟩ with hy₁ | hy₂ + · exact closure_mono (subset_region hq hc₁ hd₁ hy₁ hyq) (hcl₁ ⟨hxe, hxW⟩) + · exact closure_mono (subset_region hq hc₂ hd₂ hy₂ hyq) (hcl₂ ⟨hxe, hxW⟩) + refine ⟨q, hq, ?_, edge_subset_closure_of_incident hS he hq ⟨x, hxe, hxq⟩⟩ + intro hqP + exact hyO.2 ((hqP ▸ hyq : y ∈ discInt P).1) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73FaceRefinement.lean b/LeanPool/GraphMinor/GM12/Section73FaceRefinement.lean new file mode 100644 index 0000000000..70a3c7804e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73FaceRefinement.lean @@ -0,0 +1,139 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73ProperArcCircle +public import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.ArcDrawings +import LeanPool.GraphMinor.Surface.Jordan +import LeanPool.GraphMinor.GM11.PerimeterPull +import LeanPool.GraphMinor.GM11.Section4c +import LeanPool.GraphMinor.GM12.Section72RadialDeletion + +/-! +# An added spoke splits an old disc face + +For maximality in XII (7.3), page 261, compare the cleaned drawing +with a radial extension having the same vertices. Any added edge +lies in one old disc face and has its ends on the old drawing. +Compactify that face. The added edge becomes a circle in a sphere, +whose two Jordan sides give distinct regions of the extension inside +the old face. This will contradict uniqueness of surviving drawing +edges in each old face. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 OnePoint + +/-- An added edge with distinct ends splits a face of a two-cell +spanning subdrawing into at least two regions. This is the face +refinement used for maximality in XII (7.3), page 261. -/ +theorem exists_two_regions_in_old_face + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H K : Drawing S} (hHK : H.IsSubdrawing K) + (hV : H.V = K.V) (hH : (PaintingOrDrawing.drawing H).IsTwoCell) + {g : Set S} (hg : g ∈ K.E) (hgn : g ∉ H.E) + {a b : S} (hline : IsLineWithEnds (closure g) a b) + (hcap : closure g ∩ K.V = {a, b}) : + ∃ A ∈ H.R, ∃ p ∈ K.R, ∃ q ∈ K.R, p ≠ q ∧ p ⊆ A ∧ q ⊆ A := by + let : CompactSpace S := hS.1 + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hgdis : Disjoint g H.U := disjoint_left.mpr fun x hxg hxH => + hgn (edge_mem_of_meets_subdrawing hHK hg ⟨x, hxg, hxH⟩) + obtain ⟨x, hxg⟩ := hg.1 + obtain ⟨A, hA, hxA⟩ := exists_region_of_notMem (disjoint_left.mp hgdis hxg) + have hgA : g ⊆ A := subset_region hA hg.2.2.1.isConnected.isPreconnected hgdis hxg hxA + have haV : a ∈ H.V := hV.symm ▸ (hcap.superset (Or.inl rfl)).2 + have hbV : b ∈ H.V := hV.symm ▸ (hcap.superset (Or.inr rfl)).2 + have han : a ∉ A := fun haA => region_subset hA haA (H.V_subset_U haV) + have hbn : b ∉ A := fun hbA => region_subset hA hbA (H.V_subset_U hbV) + have hinside : closure g \ {a, b} ⊆ A := by + rintro y ⟨hyg, hyn⟩ + apply hgA + exact (K.closure_diff_V hg).subset ⟨hyg, fun hyV => hyn (hcap.subset ⟨hyg, hyV⟩)⟩ + let F : Set (OnePoint A) := collapse A '' closure g + have hF : IsOArc F := isOArc_collapse_proper_line (hH.2 A hA) hline han hbn hinside + have hinfF : (∞ : OnePoint A) ∈ F := ⟨a, (hcap.superset (Or.inl rfl)).1, collapse_of_notMem han⟩ + have hsphere := isSphere_onePoint (hH.2 A hA) + obtain ⟨hSA, hconnA⟩ := IsSphere.isClosedSurface hsphere + let : T2Space (OnePoint A) := hSA.2.1 + let : ConnectedSpace (OnePoint A) := hconnA + let : LocallyConnectedSpace (OnePoint A) := IsClosedSurface.locallyConnectedSpace hSA + obtain ⟨C, hCU, _⟩ := exists_loop_drawing hF hinfF + obtain ⟨B₁, B₂, hsplit⟩ := jordan_sphere hsphere hF + have hB₁ : B₁ ∈ C.R := by + change B₁ ∈ componentsIn (univ \ C.U) + rw [hCU, hsplit.2.1] + exact Or.inl rfl + have hB₂ : B₂ ∈ C.R := by + change B₂ ∈ componentsIn (univ \ C.U) + rw [hCU, hsplit.2.1] + exact Or.inr rfl + have hc : Continuous (collapse A) := continuous_collapse (hH.2 A hA).1 + have hpreinside : ∀ B ∈ C.R, collapse A ⁻¹' B ⊆ A := by + intro B hB y hyB + by_contra hyn + have hyinf : collapse A y = ∞ := collapse_of_notMem hyn + exact region_subset hB hyB (hyinf.symm ▸ (hCU.symm ▸ hinfF)) + have hprene : ∀ B ∈ C.R, (collapse A ⁻¹' B).Nonempty := by + intro B hB + obtain ⟨z, hzB⟩ := region_nonempty hB + induction z using OnePoint.rec with + | infty => exact False.elim (region_subset hB hzB (hCU.symm ▸ hinfF)) + | coe z => + refine ⟨z.val, ?_⟩ + change collapse A z.val ∈ B + rw [collapse_of_mem z.property] + exact hzB + obtain ⟨y₁, hy₁, hy₁K⟩ := exists_notMem_U (Γ := K) hS + ((region_isOpen hB₁).preimage hc) (hprene B₁ hB₁) + obtain ⟨y₂, hy₂, hy₂K⟩ := exists_notMem_U (Γ := K) hS + ((region_isOpen hB₂).preimage hc) (hprene B₂ hB₂) + obtain ⟨p, hp, hy₁p⟩ := exists_region_of_notMem hy₁K + obtain ⟨q, hq, hy₂q⟩ := exists_region_of_notMem hy₂K + have hpA : p ⊆ A := subset_region hA (region_isPreconnected hp) + (disjoint_left.mpr fun z hzp hzH => region_subset hp hzp (hHK.U_subset hzH)) + hy₁p (hpreinside B₁ hB₁ hy₁) + have hqA : q ⊆ A := subset_region hA (region_isPreconnected hq) + (disjoint_left.mpr fun z hzq hzH => region_subset hq hzq (hHK.U_subset hzH)) + hy₂q (hpreinside B₂ hB₂ hy₂) + refine ⟨A, hA, p, hp, q, hq, ?_, hpA, hqA⟩ + intro hpq + have hy₂p : y₂ ∈ p := hpq.symm ▸ hy₂q + have hpavoid : ∀ z ∈ p, collapse A z ∉ C.U := by + intro z hzp hzC + have hzA := hpA hzp + have hzfinite : collapse A z ≠ ∞ := collapse_ne_infty_iff.mpr hzA + rw [hCU] at hzC + obtain ⟨w, hwg, hwz⟩ := hzC + have hwA : w ∈ A := collapse_ne_infty_iff.mp (fun hwinf => hzfinite (hwz.symm.trans hwinf)) + have hwz' : w = z := collapse_injOn A hwA hzA hwz + exact region_subset hp hzp (K.closure_subset_U hg (hwz' ▸ hwg)) + have hpcover : p ⊆ (collapse A ⁻¹' B₁) ∪ (collapse A ⁻¹' B₂) := by + intro z hzp + obtain ⟨B, hB, hzB⟩ := exists_region_of_notMem (hpavoid z hzp) + have hBB : B = B₁ ∨ B = B₂ := by + change B ∈ componentsIn (univ \ C.U) at hB + rw [hCU, hsplit.2.1] at hB + exact hB + rcases hBB with rfl | rfl + · exact Or.inl hzB + · exact Or.inr hzB + have hBdis : Disjoint B₁ B₂ := disjoint_left.mpr fun z hz₁ hz₂ => + hsplit.1 (region_eq_of_mem hB₁ hB₂ hz₁ hz₂) + rcases (region_isPreconnected hp).subset_or_subset + ((region_isOpen hB₁).preimage hc) ((region_isOpen hB₂).preimage hc) + (hBdis.preimage (collapse A)) hpcover with hin₁ | hin₂ + · exact disjoint_left.mp hBdis (hin₁ hy₂p) hy₂ + · exact disjoint_left.mp hBdis hy₁ (hin₂ hy₁p) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73HubCircuitInside.lean b/LeanPool/GraphMinor/GM12/Section73HubCircuitInside.lean new file mode 100644 index 0000000000..bcd5841680 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73HubCircuitInside.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73DiscComparison +public import LeanPool.GraphMinor.GM12.Section73CircuitLift +public import LeanPool.GraphMinor.GM12.Section73SplicedSeparation +import LeanPool.GraphMinor.GM11.Separate + +/-! +# The inside comparison for a circuit through the merged hub + +For XII (7.3), Claim (1), page 262, construct the old circuit +inside the lifted walk. Its length and deleted-vertex alternative +keep the enlarged separation below the old tangle order. Thus +its selected disc is also selected in the new tangle. The circuit +image and its point-or-arc fibre give equality of the selected +discs outside the merged region. This puts the new circuit's +inside in the lifted walk's inside together with that region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 Hypergraph + +/-- The circuit-through-the-hub case of XII (7.3), Claim (1), +page 262, with the old circuit, separation transfer, and selected +disc comparison all proved from the constructed collapse. -/ +theorem circuit_inside_subset_lifted_walk_through_hub + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K J : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsTangle Γ.toHypergraph θ T) + {v : S} {ins ins' : Drawing S → Set S} + (hins : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + (hins' : IsDerivedSlope (PaintingOrDrawing.drawing (deleteVertices Γ {v})) J (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) ins') + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + (f : C(S, S)) (hfix : ∀ x ∉ r', f x = x) + (hcollapse : ∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + (hJV : J.V = f '' K.V) + (hJE : J.E ⊆ (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g}) + (hJpre : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsPreRadialDrawing J) + (hJtwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) + {B : Set S} (hB : IsClosedDisc B) (hBr : B ⊆ r') + (hAB : ({v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ⊆ discInt B) + (hfixB : ∀ x ∉ discInt B, f x = x) + {a : S} (W : GraphWalk J.toGraph a a) (W' : GraphWalk K.toGraph a a) + (hpoints : (walkDrawing K W').U \ r' = (walkDrawing J W).U \ r') + (hedges : ∀ e ∈ W.edges, ∀ g ∈ spokeReplacementEdges K J v f e, g ∈ W'.edges) + {C : Drawing S} (hC : C.IsCircuit) (hCW : C.IsSubdrawing (walkDrawing J W)) + (hvC : v ∈ C.V) (hshort : C.length + 2 < 2 * θ) : + ins' C ⊆ insWalk ins K W' ∪ r' := by + obtain ⟨D, ε, hD, hDW, hε, hDlen, hvD, himage, hshape⟩ := + exists_circuit_in_lifted_walk_through_hub hS hK hE hv hr' hvr' f hfix hcollapse hfibre + hJV hJE hJpre hJtwo W W' hpoints hedges hC hCW hvC + have hDK : D.IsSubdrawing K := hDW.trans (walkDrawing_isSubdrawing K W') + have hCJ : C.IsSubdrawing J := hCW.trans (walkDrawing_isSubdrawing J W) + obtain ⟨hOld, hOldbd, _⟩ := hins D hD hDK (by omega) + obtain ⟨hNew, hNewbd, hmNew⟩ := hins' C hC hCJ (by omega) + have hmOld := spliced_circuit_disc_mem_deleted_tangle hT hv hK.2.1 hins hD hDK + hε hDlen.le hvD hshort + have hdelete := deleteVertices_isSubdrawing Γ {v} + have hnOld : (deleteVertices Γ {v}).IsNormal D.U := by + rintro z ⟨hzD, hzΓ'⟩ + have hzΓ : z ∈ Γ.V := hK.2.1.1.subset ⟨hdelete.U_subset hzΓ', hDK.U_subset hzD⟩ + exact (isSubdrawing_U_inter_V hdelete).subset ⟨hzΓ', hzΓ⟩ + have hnNew : (deleteVertices Γ {v}).IsNormal C.U := by + rintro z ⟨hzC, hzΓ'⟩ + exact hJpre.1.subset ⟨hzΓ', hCJ.U_subset hzC⟩ + have ht := theorem_7_3_tangle hθ hT hv + have hpret : IsPretangle (PaintingOrDrawing.drawing (deleteVertices Γ {v})).toHypergraph + (θ - 1) (deleteVerticesTangle Γ.toHypergraph {v} T θ) := + ⟨ht.one_le, ht.isSeparation, ht.order_lt, ht.axiom1, ht.axiom2⟩ + have heq := selected_discs_agree_outside_collapsed_region hS hpret hr' + hOld hNew hB hBr hAB hOldbd hNewbd hnOld hnNew hmOld hmNew + (IsCircuit.isOArc_U hD) hshape f hfixB hfibre himage + intro z hz + by_cases hzr : z ∈ r' + · exact Or.inr hzr + · have hzOld : z ∈ ins D := (heq.superset ⟨hz, hzr⟩).1 + exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨D, ⟨hD, hDW⟩, hzOld⟩)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73HubInside.lean b/LeanPool/GraphMinor/GM12/Section73HubInside.lean new file mode 100644 index 0000000000..1fc41eafe9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73HubInside.lean @@ -0,0 +1,91 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73WalkInside +import LeanPool.GraphMinor.GM12.Section73HubWalkImage +import LeanPool.GraphMinor.GM12.Section73UnchangedCircuit + +/-! +# The merged hub stays inside the lifted walk + +For XII (7.3)(ii), page 262, the new walk encloses the merged +hub. If the walk visits it, a replacement star spoke puts the +deleted vertex in the old walk. Otherwise a circuit whose inside +contains the hub omits the hub itself. That circuit is unchanged +and has the same old inside. Thus the deleted vertex lies in +the inside of the lifted walk in either case. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 Hypergraph + +/-- A new walk enclosing the merged hub lifts to a walk enclosing +the deleted vertex. This proves the point-inside assertion at the +end of XII (7.3)(ii), page 262. -/ +theorem hub_mem_inside_lifted_walk + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K J : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsTangle Γ.toHypergraph θ T) + {v : S} {ins ins' : Drawing S → Set S} + (hins : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + (hins' : IsDerivedSlope (PaintingOrDrawing.drawing (deleteVertices Γ {v})) J (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) ins') + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + (f : C(S, S)) (hfix : ∀ x ∉ r', f x = x) + (hcollapse : ∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + (hJV : J.V = f '' K.V) + (hJE : J.E ⊆ (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g}) + (hJ : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsRadialDrawing J) + {a : S} (W : GraphWalk J.toGraph a a) (W' : GraphWalk K.toGraph a a) + (hWshort : W.length < 2 * (θ - 1)) + (hpoints : (walkDrawing K W').U \ r' = (walkDrawing J W).U \ r') + (hedges : ∀ e ∈ W.edges, ∀ g ∈ spokeReplacementEdges K J v f e, g ∈ W'.edges) + (hvInside : v ∈ insWalk ins' J W) : v ∈ insWalk ins K W' := by + have hV : J.V ⊆ K.V := by + intro x hx + rw [hJV, image_radial_vertices_eq hS hK hE hv hr' hvr' hfix hcollapse] at hx + rcases hx with hx | hxv + · exact hx.1 + · exact hxv ▸ hK.2.1.2.1 hv + have hvJ : v ∈ J.V := hJV.symm ▸ ⟨v, hK.2.1.2.1 hv, hcollapse v (Or.inl rfl)⟩ + have hretain : ∀ e x y, J.toGraph.IsLink e x y → x ≠ v → y ≠ v → e ∈ K.E := by + intro e x y hel + obtain ⟨_, _, _, _, hret⟩ := exists_edge_walk_lift hS hK hE hv hr' hvr' + f hfix hcollapse hfibre hJV hJE hel + exact hret + have hwalk : v ∈ (walkDrawing J W).U → v ∈ insWalk ins K W' := by + intro hvWU + exact Or.inl (hub_mem_lifted_walk_of_mem_walk hS hK hE hv hr' hvr' f hfix hfibre + hJV hJE hvJ W W' hedges hvWU) + change v ∈ insOf ins' (walkDrawing J W) at hvInside + rcases hvInside with hvWU | hvC + · exact hwalk hvWU + · obtain ⟨C, ⟨hC, hCW⟩, hvC⟩ := mem_iUnion₂.mp hvC + by_cases hvCV : v ∈ C.V + · exact hwalk (hCW.U_subset (C.V_subset_U hvCV)) + · have hClen : C.length ≤ W.length := by + apply (ncard_le_ncard (fun e he => ?_) W.edges.finite_toSet).trans + (ncard_mem_list_le W.edges) + have hem := hCW.2 he + rwa [walkDrawing_E] at hem + have hshort : C.length + 2 < 2 * θ := by omega + exact circuit_inside_subset_lifted_walk_of_notMem_hub hS hθ hT hv hK.2.1 hJ hr' hvr' + hvJ hV hretain hins hins' W W' hpoints hC hCW hvCV hshort hvC + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73HubWalkImage.lean b/LeanPool/GraphMinor/GM12/Section73HubWalkImage.lean new file mode 100644 index 0000000000..50a82000b1 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73HubWalkImage.lean @@ -0,0 +1,72 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73WalkLiftEdges +import LeanPool.GraphMinor.GM11.RadialBasics + +/-! +# A visited merged hub remains in the lifted walk + +At the end of XII (7.3), page 262, a new walk used for distance +to the merged region must retain the deleted vertex after lifting. +If the hub is its initial vertex this holds directly. Otherwise +split the walk at a hub visit. Its next edge has a two-edge +replacement using a star spoke, whose old endpoint is the deleted +vertex. The recorded replacement edges put that spoke in the lift. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- If the merged hub belongs to the point set of the new walk, +it belongs to the point set of its constructed lift. This is the +walk-point assertion used in XII (7.3)(ii), page 262. -/ +theorem hub_mem_lifted_walk_of_mem_walk + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K J : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + (f : C(S, S)) (hfix : ∀ x ∉ r', f x = x) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + (hJV : J.V = f '' K.V) + (hJE : J.E ⊆ (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g}) + (hvJ : v ∈ J.V) + {a : S} (W : GraphWalk J.toGraph a a) (W' : GraphWalk K.toGraph a a) + (hedges : ∀ e ∈ W.edges, ∀ g ∈ spokeReplacementEdges K J v f e, g ∈ W'.edges) + (hvW : v ∈ (walkDrawing J W).U) : v ∈ (walkDrawing K W').U := by + have hvSupport : v ∈ W.support := by + have hvV := (isSubdrawing_U_inter_V (walkDrawing_isSubdrawing J W)).subset ⟨hvW, hvJ⟩ + rw [walkDrawing_V] at hvV + exact hvV + by_cases hva : v = a + · have haV : a ∈ (walkDrawing K W').V := by rw [walkDrawing_V]; exact W'.start_mem_support + exact hva.symm ▸ (walkDrawing K W').V_subset_U haV + obtain ⟨P, Q, hsplit⟩ := W.exists_append_of_mem hvSupport + cases hQ : Q with + | nil h => exact (hva rfl).elim + | @cons _ z _ e hel R => + have heW : e ∈ W.edges := by + rw [hsplit, GraphWalk.edges_append, hQ, GraphWalk.edges_cons] + exact List.mem_append_right _ List.mem_cons_self + obtain ⟨g, p, _, hvg, hfg, hpr, hpK, hpn, _, hgl⟩ := + exists_old_spoke_at_contracted_vertex hS hK hv hr' f hfix hfibre hJV hJE hel + obtain ⟨k, _, hkl⟩ := exists_spoke_to_hub_in_deleted_region hS hK hE hv hr' hvr' hpK hpn hpr + have hkW : k ∈ (walkDrawing K W').E := by + rw [walkDrawing_E] + exact hedges e heW k ⟨z, g, p, hel, hvg, hfg, hgl, Or.inr hkl⟩ + exact (walkDrawing K W').closure_subset_U hkW (hkl.2.2.2.superset (Or.inl rfl)).1 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73ImageArc.lean b/LeanPool/GraphMinor/GM12/Section73ImageArc.lean new file mode 100644 index 0000000000..5bda97b0b6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73ImageArc.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import Mathlib.Topology.ContinuousMap.Basic +import LeanPool.GraphMinor.GM11.RadialChord + +/-! +# Edge lines under a contraction map + +In XII (7.3), page 261, contracting one radial edge preserves the +other edge lines when the contraction is injective on each of their +closures. Parameterize a line, compose with the map, and use the +resulting embedded interval. Compactness also lets the image commute +with taking an edge closure. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A continuous map injective on a line preserves that line and its +specified ends, as needed for the edge contractions in XII (7.3). -/ +theorem lineWithEnds_image_of_injOn + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] [T2Space T] + {L : Set S} {u v : S} (hL : IsLineWithEnds L u v) {f : S → T} + (hf : ContinuousOn f L) (hinj : InjOn f L) : + IsLineWithEnds (f '' L) (f u) (f v) := + hL.image_under_injOn hf hinj + +/-- The two specified ends of a line are distinct. -/ +theorem lineWithEnds_ends_ne {S : Type*} [TopologicalSpace S] + {L : Set S} {u v : S} (hL : IsLineWithEnds L u v) : u ≠ v := by + obtain ⟨p, hp0, hp1⟩ := hL + intro huv + exact (zero_ne_one : (0 : unitInterval) ≠ 1) + (p.injective (Subtype.ext (hp0.trans (huv.trans hp1.symm)))) + +/-- A continuous map commutes with closure on a set with compact +closure. This identifies the closures of the surviving edge images. -/ +theorem closure_image_eq_of_compact_closure + {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] [T2Space T] + {f : S → T} (hf : Continuous f) {A : Set S} (hA : IsCompact (closure A)) : + closure (f '' A) = f '' closure A := by + exact Subset.antisymm + (closure_minimal (image_mono subset_closure) (hA.image hf).isClosed) + (image_closure_subset_closure_image hf) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73ImageIncidence.lean b/LeanPool/GraphMinor/GM12/Section73ImageIncidence.lean new file mode 100644 index 0000000000..014231a0f7 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73ImageIncidence.lean @@ -0,0 +1,178 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73RadialStarDrawing +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.GM11.RadialRegions +import LeanPool.GraphMinor.GM11.RadialCorners +import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.GM12.Section73MergedHub +import LeanPool.GraphMinor.GM12.Section73CellularContraction + +/-! +# Incidence in the contracted radial drawing + +In XII (7.3), page 261, the star collapse fixes the drawing after +vertex deletion. Its exact fibres then imply that the image radial +drawing meets that drawing precisely in its vertices. A surviving +edge closure has exactly the images of its old ends as ends, because +its intersection with the collapsed star contains only vertices. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The ends of a surviving edge under an exact collapse are the +images of its old ends when its closure meets the collapsed set only +in vertices. This is used for XII (7.3), page 261. -/ +theorem closure_image_inter_vertices + {S : Type*} [TopologicalSpace S] [T2Space S] {K : Drawing S} + {A g : Set S} {u w : S} (hline : IsLineWithEnds (closure g) u w) + (hvertex : closure g ∩ A ⊆ K.V) (f : C(S, S)) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ (x ∈ A ∧ y ∈ A)) : + closure (f '' g) ∩ (f '' K.V) = f '' (closure g ∩ K.V) := by + rw [closure_image_eq_of_compact_closure f.continuous hline.isCompact] + apply Subset.antisymm + · rintro y ⟨⟨z, hzg, hzy⟩, ⟨a, haV, hay⟩⟩ + have hzV : z ∈ K.V := by + rcases (hfibre z a).mp (hzy.trans hay.symm) with hza | hzA + · exact hza ▸ haV + · exact hvertex ⟨hzg, hzA.1⟩ + exact ⟨z, ⟨hzg, hzV⟩, hzy⟩ + · rintro y ⟨z, ⟨hzg, hzV⟩, rfl⟩ + exact ⟨⟨z, hzg, rfl⟩, ⟨z, hzV, rfl⟩⟩ + +/-- The image radial drawing meets the deleted drawing exactly in +its vertices, all of which remain radial vertices. This proves +condition (i) in the construction of XII (7.3), page 261. -/ +theorem image_radial_inter_deleted_drawing + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : PreRad (PaintingOrDrawing.drawing Γ) K) {v : S} (hv : v ∈ Γ.V) + {r' : Set S} (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + {f : S → S} (hfix : ∀ x ∉ r', f x = x) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) : + (deleteVertices Γ {v}).U ∩ (f '' K.U) = (deleteVertices Γ {v}).V ∧ + (deleteVertices Γ {v}).V ⊆ f '' K.V := by + have hdelete := deleteVertices_isSubdrawing Γ {v} + have hAR := radial_star_subset_deleted_region hS hK hv hr' hvr' + have hout : ∀ x ∈ (deleteVertices Γ {v}).U, x ∉ r' := + fun x hx hxr => region_subset hr' hxr hx + have hVsub : (deleteVertices Γ {v}).V ⊆ f '' K.V := by + intro x hx + exact ⟨x, hK.2.2.1 (hdelete.1 hx), hfix x (hout x ((deleteVertices Γ {v}).V_subset_U hx))⟩ + refine ⟨Subset.antisymm ?_ ?_, hVsub⟩ + · rintro x ⟨hxD, ⟨y, hyK, hyx⟩⟩ + have hyx' : y = x := by + have heq : f y = f x := hyx.trans (hfix x (hout x hxD)).symm + rcases (hfibre y x).mp heq with hyx' | hAx + · exact hyx' + · exact False.elim (hout x hxD (hAR hAx.2)) + have hxK : x ∈ K.U := hyx' ▸ hyK + have hxΓV : x ∈ Γ.V := hK.2.1.subset ⟨hdelete.U_subset hxD, hxK⟩ + exact (isSubdrawing_U_inter_V hdelete).subset ⟨hxD, hxΓV⟩ + · intro x hxV + obtain ⟨y, hyKV, hyx⟩ := hVsub hxV + exact ⟨(deleteVertices Γ {v}).V_subset_U hxV, y, K.V_subset_U hyKV, hyx⟩ + +/-- Each surviving spoke image joins a vertex of the deleted +drawing to an image hub. This proves condition (iii) of the radial +construction in XII (7.3), page 261. -/ +theorem image_radial_edge_ends + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : PreRad (PaintingOrDrawing.drawing Γ) K) {v : S} (hv : v ∈ Γ.V) + {r' : Set S} (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + (f : C(S, S)) (hfix : ∀ x ∉ r', f x = x) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + {g : Set S} (hg : g ∈ K.E) (hvg : v ∉ closure g) : + ∃ a ∈ (deleteVertices Γ {v}).V, ∃ b ∈ (f '' K.V) \ (deleteVertices Γ {v}).V, + closure (f '' g) ∩ (f '' K.V) = {a, b} := by + have hdelete := deleteVertices_isSubdrawing Γ {v} + have hout : ∀ x ∈ (deleteVertices Γ {v}).U, x ∉ r' := + fun x hx hxr => region_subset hr' hxr hx + obtain ⟨a, ha, r, hr, b, hb, hbK, hcap, _⟩ := spoke_ends hK hS hg + have hab : a ≠ b := fun h => region_subset hr (h ▸ hb) (Γ.V_subset_U ha) + have haV : a ∈ (deleteVertices Γ {v}).V := by + rw [deleteVertices_V] + refine ⟨ha, ?_⟩ + intro hav + exact hvg (hav ▸ (hcap.superset (Or.inl rfl)).1) + have hfa : f a = a := hfix a (hout a ((deleteVertices Γ {v}).V_subset_U haV)) + have hfbnot : f b ∉ (deleteVertices Γ {v}).V := by + intro hfbV + have hfbU := (deleteVertices Γ {v}).V_subset_U hfbV + have hfixfb : f (f b) = f b := hfix (f b) (hout (f b) hfbU) + rcases (hfibre b (f b)).mp hfixfb.symm with hbfb | hAb + · have hbV : b ∈ Γ.V := hbfb ▸ hdelete.1 hfbV + exact region_subset hr hb (Γ.V_subset_U hbV) + · exact hout (f b) hfbU (radial_star_subset_deleted_region hS hK hv hr' hvr' hAb.2) + refine ⟨a, haV, f b, ⟨mem_image_of_mem f hbK, hfbnot⟩, ?_⟩ + rw [closure_image_inter_vertices (isLine_closure hg hab hcap) + (radial_edge_inter_star hS hK hv hg hvg).2 f hfibre, hcap, image_pair, hfa] + +/-- The drawing obtained by contracting the reduced radial star is +two-cell and satisfies the intersection, region-hub, and bipartition +conditions for a radial drawing of the deleted drawing. This is the +construction in XII (7.3), page 261, before the empty-disc cleanup. -/ +theorem exists_contracted_radial_incidence + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) + {r' : Set S} (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') : + ∃ (f : C(S, S)) (H : Drawing S), Function.Surjective f ∧ + (∀ x ∉ r', f x = x) ∧ + (∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) ∧ + (∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) ∧ + H.U = f '' K.U ∧ H.V = f '' K.V ∧ + H.E = (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g} ∧ + (PaintingOrDrawing.drawing H).IsTwoCell ∧ + (deleteVertices Γ {v}).U ∩ H.U = (deleteVertices Γ {v}).V ∧ + (deleteVertices Γ {v}).V ⊆ H.V ∧ + (∀ s ∈ (deleteVertices Γ {v}).R, ∃! w, w ∈ s ∧ w ∈ H.V) ∧ + (∀ w ∈ H.V \ (deleteVertices Γ {v}).V, ∃ s ∈ (deleteVertices Γ {v}).R, w ∈ s) ∧ + (∀ e ∈ H.E, ∃ a ∈ (deleteVertices Γ {v}).V, + ∃ b ∈ H.V \ (deleteVertices Γ {v}).V, closure e ∩ H.V = {a, b}) := by + obtain ⟨f, H, hsurj, hfix, hcollapse, hfibre, hHU, hHV, hHE, _, _, _⟩ := + exists_contracted_radial_star_drawing_in_region hS ⟨hK.1, hK.2.1⟩ hv hunique hr' hvr' + have hinter := image_radial_inter_deleted_drawing hS ⟨hK.1, hK.2.1⟩ hv hr' hvr' hfix hfibre + have hcap : (deleteVertices Γ {v}).U ∩ H.U = (deleteVertices Γ {v}).V := by + rw [hHU] + exact hinter.1 + refine ⟨f, H, hsurj, hfix, hcollapse, hfibre, hHU, hHV, hHE, + radial_star_image_isTwoCell hS hK hv f hsurj hfibre hHU, hcap, ?_, ?_, ?_, ?_⟩ + · rw [hHV] + exact hinter.2 + · rw [hHV] + exact image_radial_region_hub_unique hS hK hE hv hr' hvr' hfix hcollapse hfibre + · intro w hw + apply exists_region_of_notMem + intro hwU + exact hw.2 (hcap.subset ⟨hwU, H.V_subset_U hw.1⟩) + · intro e he + obtain ⟨g, hg, rfl⟩ := hHE.subset he + obtain ⟨a, ha, b, hb, hends⟩ := image_radial_edge_ends hS ⟨hK.1, hK.2.1⟩ hv hr' hvr' + f hfix hfibre hg.1 hg.2 + rw [hHV] + exact ⟨a, ha, b, hb, hends⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73InnermostBigon.lean b/LeanPool/GraphMinor/GM12/Section73InnermostBigon.lean new file mode 100644 index 0000000000..3c04d492f7 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73InnermostBigon.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73BigonChord +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Choosing an innermost radial bigon + +For XII (7.3), page 261, choose a bigon inside a given parallel-spoke +disc with the fewest contained edges. A third parallel spoke cuts off +a new bigon with strictly fewer edges, which contradicts minimality. +Thus the chosen disc contains no other parallel spoke. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Inside any parallel-spoke bigon there is a bigon containing no +third parallel spoke. This is the finite minimality step in the +cleanup of XII (7.3), page 261. -/ +theorem exists_innermost_parallel_bigon + {S : Type*} [TopologicalSpace S] [T2Space S] {H : Drawing S} + {g h Q : Set S} {v u : S} (hg : g ∈ H.E) (hh : h ∈ H.E) + (hgh : g ≠ h) (hvu : v ≠ u) + (hcg : closure g ∩ H.V = {v, u}) (hch : closure h ∩ H.V = {v, u}) + (hQ : IsClosedDisc Q) (hbd : discBd Q = closure g ∪ closure h) : + ∃ (P a b : Set S), IsClosedDisc P ∧ P ⊆ Q ∧ a ∈ H.E ∧ b ∈ H.E ∧ + a ≠ b ∧ closure a ∩ H.V = {v, u} ∧ closure b ∩ H.V = {v, u} ∧ + discBd P = closure a ∪ closure b ∧ + (∀ k ∈ H.E, closure k ∩ H.V = {v, u} → k ⊆ P → k = a ∨ k = b) := by + classical + let count : Set S → ℕ := fun P => {e ∈ H.E | e ⊆ P}.ncard + let good : ℕ → Prop := fun n => ∃ (P a b : Set S), IsClosedDisc P ∧ P ⊆ Q ∧ + a ∈ H.E ∧ b ∈ H.E ∧ a ≠ b ∧ closure a ∩ H.V = {v, u} ∧ + closure b ∩ H.V = {v, u} ∧ discBd P = closure a ∪ closure b ∧ count P = n + have hex : ∃ n, good n := + ⟨count Q, Q, g, h, hQ, Subset.rfl, hg, hh, hgh, hcg, hch, hbd, rfl⟩ + obtain ⟨P, a, b, hP, hPQ, ha, hb, hab, hca, hcb, hbdP, hcount⟩ := Nat.find_spec hex + refine ⟨P, a, b, hP, hPQ, ha, hb, hab, hca, hcb, hbdP, ?_⟩ + intro k hk hck hkP + by_contra hnot + have hka : k ≠ a := fun h => hnot (Or.inl h) + have hkb : k ≠ b := fun h => hnot (Or.inr h) + have hkcl : closure k ⊆ P := closure_minimal hkP hP.isClosed + obtain ⟨P', hP', hP'P, hbdP', hmiss⟩ := exists_bigon_from_third_spoke + ha hb hk hab hka hkb hvu hca hcb hck hP hbdP hkcl + have hgood : good (count P') := by + rcases hbdP' with hbdP' | hbdP' + · exact ⟨P', a, k, hP', hP'P.trans hPQ, ha, hk, hka.symm, hca, hck, hbdP', rfl⟩ + · exact ⟨P', b, k, hP', hP'P.trans hPQ, hb, hk, hkb.symm, hcb, hck, hbdP', rfl⟩ + have hmin : count P ≤ count P' := by + rw [hcount] + exact Nat.find_min' hex hgood + have hsub : {e ∈ H.E | e ⊆ P'} ⊆ {e ∈ H.E | e ⊆ P} := + fun _ he => ⟨he.1, he.2.trans hP'P⟩ + have habP : a ⊆ P ∧ b ⊆ P := by + constructor + · intro x hx + exact Surface.discBd_subset P (hbdP ▸ Or.inl (subset_closure hx)) + · intro x hx + exact Surface.discBd_subset P (hbdP ▸ Or.inr (subset_closure hx)) + have hnotback : ¬ {e ∈ H.E | e ⊆ P} ⊆ {e ∈ H.E | e ⊆ P'} := by + intro hback + rcases hmiss with han | hbn + · exact han (hback ⟨ha, habP.1⟩).2 + · exact hbn (hback ⟨hb, habP.2⟩).2 + have hlt : count P' < count P := ncard_lt_ncard ⟨hsub, hnotback⟩ + (H.finite_edges.subset fun _ he => he.1) + exact (Nat.not_le_of_gt hlt) hmin + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73LiftedSpokeEdges.lean b/LeanPool/GraphMinor/GM12/Section73LiftedSpokeEdges.lean new file mode 100644 index 0000000000..edc5bab03b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73LiftedSpokeEdges.lean @@ -0,0 +1,93 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73OldSpoke +import LeanPool.GraphMinor.GM11.CircuitRegions +import LeanPool.GraphMinor.GM12.Section73RadialStarDrawing + +/-! +# Edges forced into a two-edge spoke lift + +For XII (7.3), Claim (1), page 262, a surviving old spoke must +occur in any walk whose collapsed image contains its new edge. +Its interior misses the collapsed star, so each interior point +has a unique preimage. A two-edge lift from the deleted vertex +then also uses the unique star spoke to the old region hub. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A surviving old edge occurs in a lifted walk if its image is +contained in the walk's image. Its interior has singleton fibres +under the star collapse. This supplies the surviving spoke in +XII (7.3), Claim (1), page 262. -/ +theorem old_edge_mem_lift_of_image + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : PreRad (PaintingOrDrawing.drawing Γ) K) {v : S} (hv : v ∈ Γ.V) + {g : Set S} (hg : g ∈ K.E) (hvg : v ∉ closure g) + (f : S → S) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + {a b : S} (W : GraphWalk K.toGraph a b) + (himage : f '' g ⊆ f '' (walkDrawing K W).U) : g ∈ W.edges := by + obtain ⟨x, hxg⟩ := hg.1 + have hxnot : x ∉ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e := by + intro hxA + exact (hg.2.1 hxg).2 + ((radial_edge_inter_star hS hK hv hg hvg).2 ⟨subset_closure hxg, hxA⟩) + obtain ⟨y, hy, hfy⟩ := himage ⟨x, hxg, rfl⟩ + have hxy : x = y := ((hfibre x y).mp hfy.symm).resolve_right (fun h => hxnot h.1) + have hxW : x ∈ (walkDrawing K W).U := hxy.symm ▸ hy + have hgW : g ∈ (walkDrawing K W).E := by + by_contra hgnot + exact disjoint_left.mp (edge_disjoint_U (walkDrawing_isSubdrawing K W) hg hgnot) hxg hxW + rw [walkDrawing_E] at hgW + exact hgW + +/-- A two-edge lift from the deleted vertex uses the unique star +edge to the middle vertex of its surviving spoke. This records +the other edge of each replacement path in XII (7.3), Claim (1). -/ +theorem star_edge_mem_two_edge_lift + {S : Type*} [TopologicalSpace S] {K : Drawing S} {v x u : S} {g k : Set S} + (hkg : K.toGraph.IsLink g u x) (hvg : v ∉ closure g) + (hunique : ∀ e ∈ K.E, K.toGraph.IsLink e v u → e = k) + (W : GraphWalk K.toGraph v x) (hlen : W.length = 2) (hgW : g ∈ W.edges) : + k ∈ W.edges := by + cases hcase : W with + | nil h => rw [hcase, GraphWalk.length_nil] at hlen; omega + | @cons _ y _ e he R => + cases hR : R with + | nil h => rw [hcase, hR, GraphWalk.length_cons, GraphWalk.length_nil] at hlen; omega + | @cons _ z _ f hf Q => + cases hQ : Q with + | nil h => + rw [hcase, hR, hQ] at hgW + have hgcases : g = e ∨ g = f := by + simpa only [GraphWalk.edges_cons, GraphWalk.edges_nil, List.mem_cons, + List.not_mem_nil, or_false] using hgW + rcases hgcases with hge | hgf + · have he' : K.toGraph.IsLink g v y := hge.symm ▸ he + exact (hvg (he'.2.2.2.superset (Or.inl rfl)).1).elim + · have hf' : K.toGraph.IsLink g y x := hgf.symm ▸ hf + have hyu : y = u := hf'.left_unique hkg + have hek : e = k := hunique e he.1 (hyu ▸ he) + exact List.mem_cons.mpr (Or.inl hek.symm) + | cons h R' => + rw [hcase, hR, hQ, GraphWalk.length_cons, GraphWalk.length_cons, + GraphWalk.length_cons] at hlen + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73LoopParameter.lean b/LeanPool/GraphMinor/GM12/Section73LoopParameter.lean new file mode 100644 index 0000000000..72e1800889 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73LoopParameter.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section3 +import Mathlib.Topology.Separation.Hausdorff + +/-! +# Parameterizing the circle after collapsing an arc + +For XII (7.3), Claim (1), page 262, the part of the old circuit +outside the collapsed arc becomes a loop whose only repeated +point is its pair of ends. Factoring through the usual interval +parameter of the circle gives an embedded circle. Reading the +loop on a half-open interval proves injectivity directly. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A loop injective on its half-open parameter interval induces +an embedded parameterization of its image circle. This is the +parameterization used after the arc collapse in XII (7.3), +Claim (1), page 262. -/ +theorem exists_embedded_circle_of_loop + {S : Type*} [TopologicalSpace S] [T2Space S] + (m : C(unitInterval, S)) (h01 : m 0 = m 1) + (hinj : InjOn m (Ico (0 : unitInterval) 1)) : + ∃ φ : C(Circle, S), IsEmbedding φ ∧ range φ = range m ∧ + ∀ t, φ (arcParam 1 t) = m t := by + let φ := loopLift 1 m h01 + have hpar : ∀ z : Circle, ∃ t ∈ Ico (0 : unitInterval) 1, arcParam 1 t = z := by + intro z + obtain ⟨t, rfl⟩ := arcParam_surjective 1 z + by_cases ht : t = 1 + · subst t + exact ⟨0, ⟨le_rfl, by norm_num⟩, by rw [arcParam_zero, arcParam_one]⟩ + · exact ⟨t, ⟨unitInterval.nonneg t, unitInterval.lt_one_iff_ne_one.mpr ht⟩, rfl⟩ + have hφinj : Function.Injective φ := by + intro z w hzw + obtain ⟨s, hs, rfl⟩ := hpar z + obtain ⟨t, ht, rfl⟩ := hpar w + have hst : m s = m t := by + change loopLift 1 m h01 (arcParam 1 s) = loopLift 1 m h01 (arcParam 1 t) at hzw + simpa only [loopLift_apply] using hzw + exact congrArg (arcParam 1) (hinj hs ht hst) + refine ⟨φ, (φ.continuous.isClosedEmbedding hφinj).isEmbedding, ?_, ?_⟩ + · ext x + constructor + · rintro ⟨z, rfl⟩ + obtain ⟨t, rfl⟩ := arcParam_surjective 1 z + exact ⟨t, (loopLift_apply 1 m h01 t).symm⟩ + · rintro ⟨t, rfl⟩ + exact ⟨arcParam 1 t, loopLift_apply 1 m h01 t⟩ + · exact loopLift_apply 1 m h01 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73MergedHub.lean b/LeanPool/GraphMinor/GM12/Section73MergedHub.lean new file mode 100644 index 0000000000..70f258e2c2 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73MergedHub.lean @@ -0,0 +1,118 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73DeletedRegions +public import LeanPool.GraphMinor.GM12.Section73RadialStar +import LeanPool.GraphMinor.GM11.RadialRegions +import LeanPool.GraphMinor.GM12.Section73ImageArc + +/-! +# The hub of the merged region + +In XII (7.3), page 261, the radial-star contraction makes the deleted +vertex the hub of its new region. Every old radial vertex in that +region belongs to the star: an old drawing vertex there must be the +deleted vertex, and every old region hub there has a spoke to it by +radial maximality. Hence the image drawing has exactly one vertex +in the merged region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- All old radial vertices in the merged region belong to the +contracted star. This identifies the new hub in XII (7.3), page 261. -/ +theorem radial_vertices_in_deleted_region + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') : + K.V ∩ r' ⊆ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e := by + rintro w ⟨hwK, hwr'⟩ + by_cases hwΓ : w ∈ Γ.V + · by_cases hwv : w = v + · exact Or.inl hwv + · have hwV : w ∈ (deleteVertices Γ {v}).V := by + rw [deleteVertices_V] + exact ⟨hwΓ, hwv⟩ + exact False.elim (region_subset hr' hwr' ((deleteVertices Γ {v}).V_subset_U hwV)) + · obtain ⟨r, hr, hwr⟩ := hK.2.1.2.2.2.1 w ⟨hwK, hwΓ⟩ + have hvcl : v ∈ closure r := deleted_vertex_mem_closure_of_region_meeting hS hv hr hr' hvr' + ⟨w, hwr, hwr'⟩ + obtain ⟨e, he, hcap⟩ := exists_spoke_at ⟨hK.1, hK.2.1⟩ hK.2.2 hS hE hr hwr hwK hv hvcl + have hve : v ∈ closure e := (hcap.superset (Or.inl rfl)).1 + have hwe : w ∈ closure e := (hcap.superset (Or.inr rfl)).1 + exact Or.inr (mem_iUnion₂.mpr ⟨e, ⟨he, hve⟩, hwe⟩) + +/-- An exact radial-star collapse fixing the outside of the merged +region puts precisely the new hub at the deleted vertex. This is +condition (ii) there for the construction in XII (7.3), page 261. -/ +theorem image_radial_vertices_inter_deleted_region + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + {f : S → S} (hfix : ∀ x ∉ r', f x = x) + (hcollapse : ∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) : + (f '' K.V) ∩ r' = {v} := by + apply Subset.antisymm + · rintro y ⟨⟨x, hxK, hxy⟩, hyr'⟩ + have hxr' : x ∈ r' := by + by_contra hxn + exact hxn ((hfix x hxn).symm.trans hxy ▸ hyr') + have hxA := radial_vertices_in_deleted_region hS hK hE hv hr' hvr' ⟨hxK, hxr'⟩ + exact hxy.symm.trans (hcollapse x hxA) + · intro y hy + have hyv : y = v := hy + rw [hyv] + exact ⟨⟨v, hK.2.1.2.1 hv, hcollapse v (Or.inl rfl)⟩, hvr'⟩ + +/-- The image drawing has one hub in every region after vertex +deletion. The merged region has hub `v`; every other region keeps +its old hub. This proves condition (ii) of the radial construction +in XII (7.3), page 261, before removing empty parallel discs. -/ +theorem image_radial_region_hub_unique + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + {f : S → S} (hfix : ∀ x ∉ r', f x = x) + (hcollapse : ∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) : + ∀ s ∈ (deleteVertices Γ {v}).R, ∃! w, w ∈ s ∧ w ∈ f '' K.V := by + intro s hs + by_cases hsr : s = r' + · subst s + have hcap := image_radial_vertices_inter_deleted_region hS hK hE hv hr' hvr' hfix hcollapse + refine ⟨v, ⟨hvr', ?_⟩, ?_⟩ + · exact (hcap.superset rfl).1 + · intro w hw + exact hcap.subset ⟨hw.2, hw.1⟩ + · have hvs : v ∉ s := fun h => hsr (region_eq_of_mem hs hr' h hvr') + have hsΓ : s ∈ Γ.R := deleted_region_of_not_mem_vertex hS hv hs hvs + have hsout : ∀ x ∈ s, x ∉ r' := fun x hx hxr => hsr (region_eq_of_mem hs hr' hx hxr) + have hsub := radial_star_subset_deleted_region hS ⟨hK.1, hK.2.1⟩ hv hr' hvr' + have himage := (collapse_image_diff_eq hfibre hfix hsub).2 K.V + obtain ⟨w, hw, huniq⟩ := hK.2.1.2.2.1 s hsΓ + refine ⟨w, ⟨hw.1, ?_⟩, ?_⟩ + · exact ⟨w, hw.2, hfix w (hsout w hw.1)⟩ + · intro z hz + have hzK : z ∈ K.V := (himage.subset ⟨hz.2, hsout z hz.1⟩).1 + exact huniq z ⟨hz.1, hzK⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73MetricComparison.lean b/LeanPool/GraphMinor/GM12/Section73MetricComparison.lean new file mode 100644 index 0000000000..f120e32aec --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73MetricComparison.lean @@ -0,0 +1,167 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73MetricVisits +public import LeanPool.GraphMinor.GM12.Section73ComparisonConstruction +import LeanPool.GraphMinor.GM12.Section73SharedAtoms +import LeanPool.GraphMinor.GM12.Section1 +import LeanPool.GraphMinor.GM12.Section4WalkMetric +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM11.Theorem66 + +/-! +# The metric bounds after radial contraction + +For XII (7.3), page 262, apply the bounded-visit witnesses to the +new radial metric. The actual walk comparison from the star +contraction transfers the two atoms outside the merged region +to the old inside. Two hub visits add at most four to the walk +length, and one adds at most two. Dividing the old metric walk +bound by two gives the losses two and one. Distances near the +new order are handled by the old metric's order bound. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM14 GM10 Hypergraph + +/-- The reduced radial construction gives the star contraction `(D, f, H, J)`, +the derived slope `ins'`, and both metric bounds of XII (7.3), pages 261--262. -/ +theorem exists_starContraction_with_vertex_deletion_bounds_of_unique_spokes + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsRespectfulDrawingTangle Γ θ T) + {ins : Drawing S → Set S} + (hins : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) + (hE' : (deleteVertices Γ {v}).E.Nonempty) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) + {r : Set S} (hr : r ∈ (deleteVertices Γ {v}).R) (hvr : v ∈ r) : + ∃ (D : Set S) (f : C(S, S)) (H J : Drawing S) (ins' : Drawing S → Set S), + IsStarContraction K v r D f H J ∧ + (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsRadialDrawing J ∧ + IsDerivedSlope (PaintingOrDrawing.drawing (deleteVertices Γ {v})) J (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) ins' ∧ + HasTangleMetric (deleteVertices Γ {v}) (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) + (tangleMetric (deleteVertices Γ {v}) J ins' (θ - 1)) ∧ v ∈ J.V ∧ + (∀ a ∈ Γ.A ∩ (deleteVertices Γ {v}).A, + ∀ b ∈ Γ.A ∩ (deleteVertices Γ {v}).A, + tangleMetric Γ K ins θ a b ≤ + tangleMetric (deleteVertices Γ {v}) J ins' (θ - 1) a b + 2) ∧ + (∀ a ∈ Γ.A ∩ (deleteVertices Γ {v}).A, + tangleMetric Γ K ins θ a {v} ≤ + tangleMetric (deleteVertices Γ {v}) J ins' (θ - 1) a r + 1) := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨D, f, H, J, ins', hc, hJ, hins', hm, hvJ, hcomp⟩ := + exists_starContraction_with_vertex_deletion_walk_comparison + hS hθ hT hins hK hE hv htwo hE' hunique hr hvr + let d' := tangleMetric (deleteVertices Γ {v}) J ins' (θ - 1) + have hpret' := GM11.IsTangle.isPretangle hm.1.2.1 + have hs' := GM14.isSlope_of_derived (Γ := PaintingOrDrawing.drawing (deleteVertices Γ {v})) + (Γ' := J) hS hpret' hJ.2.1.1 hins' + have htransfer : ∀ (a : Set S), a ∈ Γ.A ∩ (deleteVertices Γ {v}).A → + ∀ (p : S) (W : GraphWalk J.toGraph p p) (W' : GraphWalk K.toGraph p p), + W.length < 2 * (θ - 1) → insWalk ins' J W ⊆ insWalk ins K W' ∪ r → + W'.length < 2 * θ → ∀ a', IsCorrespondingAtom (deleteVertices Γ {v}) J a a' → + a' ⊆ insWalk ins' J W → ∀ a₀, IsCorrespondingAtom Γ K a a₀ → + a₀ ⊆ insWalk ins K W' := by + intro a ha p W W' hW hinc hW' a' hca' haW a₀ hca + have hmeet := (corresponding_atom_subset_iff hS hJ hins' hca' W hW).mp haW + have hdis := shared_atom_disjoint_deleted_region hv htwo hr hvr ha + apply (corresponding_atom_subset_iff hS hK hins hca W' hW').mpr + obtain ⟨x, hxa, hxW⟩ := hmeet + exact ⟨x, hxa, (hinc hxW).resolve_right (fun hxr => disjoint_left.mp hdis hxa hxr)⟩ + refine ⟨D, f, H, J, ins', hc, hJ, hins', hm, hvJ, ?_, ?_⟩ + · intro a ha b hb + change _ ≤ d' a b + 2 + by_cases hab : a = b + · subst b + simp only [tangleMetric, ite_true, Nat.zero_le] + have hold := tangleMetric_le_order hK ins θ a b + by_cases hnear : θ ≤ d' a b + 2 + · exact hold.trans hnear + have hlt : d' a b < θ - 1 := by omega + obtain ⟨p, W, a', b', hca', hcb', hlen, hshort, haW, hbW, hcount⟩ := + exists_tangleMetric_walk_with_two_visit_bound hS hJ hs' hab hlt + obtain ⟨W', hWlen, hinc, _⟩ := hcomp p W hshort + have hc := hcount v + have hWshort : W'.length < 2 * θ := by change W.length ≤ 2 * d' a b at hlen; omega + obtain ⟨a₀, hca, _⟩ := existsUnique_correspondingAtom' hK ha.1 + obtain ⟨b₀, hcb, _⟩ := existsUnique_correspondingAtom' hK hb.1 + have haW' := htransfer a ha p W W' hshort hinc hWshort a' hca' haW a₀ hca + have hbW' := htransfer b hb p W W' hshort hinc hWshort b' hcb' hbW b₀ hcb + have hbound := two_mul_tangleMetric_le_walk_length hK hca hcb W' hWshort haW' hbW' + change W.length ≤ 2 * d' a b at hlen + omega + · intro a ha + change _ ≤ d' a r + 1 + have hold := tangleMetric_le_order hK ins θ a {v} + by_cases hnear : θ ≤ d' a r + 1 + · exact hold.trans hnear + have hlt : d' a r < θ - 1 := by omega + have hdis := shared_atom_disjoint_deleted_region hv htwo hr hvr ha + have har : a ≠ r := by + intro heq + exact disjoint_left.mp hdis (heq.symm ▸ hvr) hvr + have hcor : IsCorrespondingAtom (deleteVertices Γ {v}) J r {v} := + ⟨Or.inr hr, Or.inl (Or.inl ⟨v, hvJ, rfl⟩), + Or.inr (Or.inr ⟨hr, v, ⟨hvJ, hvr⟩, rfl⟩)⟩ + obtain ⟨p, W, a', hca', hlen, hshort, haW, hvW, hcount⟩ := + exists_tangleMetric_walk_with_one_point_visit_bound hS hJ hs' hcor har hlt + obtain ⟨W', hWlen, hinc, hhub⟩ := hcomp p W hshort + have hWshort : W'.length < 2 * θ := by change W.length ≤ 2 * d' a r at hlen; omega + obtain ⟨a₀, hca, _⟩ := existsUnique_correspondingAtom' hK ha.1 + have haW' := htransfer a ha p W W' hshort hinc hWshort a' hca' haW a₀ hca + have hcv : IsCorrespondingAtom Γ K {v} {v} := + ⟨Or.inl (Or.inl ⟨v, hv, rfl⟩), + Or.inl (Or.inl ⟨v, hK.2.1.2.1 hv, rfl⟩), Or.inl ⟨v, hv, rfl, rfl⟩⟩ + have hbound := two_mul_tangleMetric_le_walk_length hK hca hcv W' hWshort haW' + (singleton_subset_iff.mpr (hhub hvW)) + change W.length ≤ 2 * d' a r at hlen + omega + +/-- The reduced radial construction gives both metric bounds of +XII (7.3), pages 261--262. The old spoke uniqueness condition is +supplied by the selected-disc reduction before this construction. -/ +theorem exists_metric_with_vertex_deletion_bounds_of_unique_spokes + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsRespectfulDrawingTangle Γ θ T) + {ins : Drawing S → Set S} + (hins : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) + (hE' : (deleteVertices Γ {v}).E.Nonempty) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) + {r : Set S} (hr : r ∈ (deleteVertices Γ {v}).R) (hvr : v ∈ r) : + ∃ d' : Set S → Set S → ℕ, + HasTangleMetric (deleteVertices Γ {v}) (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) d' ∧ + (∀ a ∈ Γ.A ∩ (deleteVertices Γ {v}).A, + ∀ b ∈ Γ.A ∩ (deleteVertices Γ {v}).A, + tangleMetric Γ K ins θ a b ≤ d' a b + 2) ∧ + (∀ a ∈ Γ.A ∩ (deleteVertices Γ {v}).A, + tangleMetric Γ K ins θ a {v} ≤ d' a r + 1) := by + obtain ⟨_, _, _, J, ins', _, _, _, hm, _, hi, hii⟩ := + exists_starContraction_with_vertex_deletion_bounds_of_unique_spokes + hS hθ hT hins hK hE hv htwo hE' hunique hr hvr + exact ⟨tangleMetric (deleteVertices Γ {v}) J ins' (θ - 1), hm, hi, hii⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73MetricVisits.lean b/LeanPool/GraphMinor/GM12/Section73MetricVisits.lean new file mode 100644 index 0000000000..c3d4d67749 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73MetricVisits.lean @@ -0,0 +1,83 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73PointRestraintVisits +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.GM11.Section91 +import LeanPool.GraphMinor.GM11.Section85 + +/-! +# Metric witnesses with bounded visits + +XII (7.3), page 262, applies XI (9.2) to a shortest metric walk. +Its inside is a restraint by XI (8.5), whose perimeter is at most +the walk length. The two-visit selection therefore preserves the +metric budget. When the second corresponding atom is the hub +singleton, the distinguished-point selection gives one hub visit. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM14 + +/-- A metric below the order, between distinct atoms, has a +witness no longer than twice the metric and visiting every vertex +at most twice, as required in XII (7.3)(i), page 262. -/ +theorem exists_tangleMetric_walk_with_two_visit_bound + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} {ins : Drawing S → Set S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hs : IsSlope K (2 * θ) ins) {a b : Set S} (hab : a ≠ b) + (hlt : tangleMetric Γ K ins θ a b < θ) : + ∃ (p : S) (W : GraphWalk K.toGraph p p) (a' b' : Set S), + IsCorrespondingAtom Γ K a a' ∧ IsCorrespondingAtom Γ K b b' ∧ + W.length ≤ 2 * tangleMetric Γ K ins θ a b ∧ W.length < 2 * θ ∧ + a' ⊆ insWalk ins K W ∧ b' ⊆ insWalk ins K W ∧ + ∀ v, walkVertexCount v W ≤ 2 := by + rcases tangleMetric_cases (ins := ins) (θ := θ) hK.2.1 hab with heq | ⟨_, hwit⟩ + · rw [heq] at hlt + exact (Nat.lt_irrefl θ hlt).elim + obtain ⟨u, Z, a', b', ha', hb', hZshort, hZlen, haZ, hbZ⟩ := hwit + obtain ⟨hY, hperim⟩ := theorem_8_5_proof hS hs Z hZshort + obtain ⟨p, W, hlen, hshort, haW, hbW, hcount⟩ := + exists_restraint_walk_with_two_visit_bound hS hs ha'.2.1 hb'.2.1 hY haZ hbZ + exact ⟨p, W, a', b', ha', hb', (hlen.trans hperim).trans_eq hZlen, + hshort, haW, hbW, hcount⟩ + +/-- If the atom corresponding to the second metric argument is +`{v}`, its metric witness can be chosen with at most one visit to +`v`. This is the witness refinement in XII (7.3)(ii), page 262. -/ +theorem exists_tangleMetric_walk_with_one_point_visit_bound + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} {ins : Drawing S → Set S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hs : IsSlope K (2 * θ) ins) {a b : Set S} {v : S} + (hcor : IsCorrespondingAtom Γ K b {v}) (hab : a ≠ b) + (hlt : tangleMetric Γ K ins θ a b < θ) : + ∃ (p : S) (W : GraphWalk K.toGraph p p) (a' : Set S), + IsCorrespondingAtom Γ K a a' ∧ + W.length ≤ 2 * tangleMetric Γ K ins θ a b ∧ W.length < 2 * θ ∧ + a' ⊆ insWalk ins K W ∧ v ∈ insWalk ins K W ∧ walkVertexCount v W ≤ 1 := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + rcases tangleMetric_cases (ins := ins) (θ := θ) hK.2.1 hab with heq | ⟨_, hwit⟩ + · rw [heq] at hlt + exact (Nat.lt_irrefl θ hlt).elim + obtain ⟨u, Z, a', b', ha', hb', hZshort, hZlen, haZ, hbZ⟩ := hwit + have hb'eq : b' = {v} := (existsUnique_correspondingAtom' hK hcor.1).unique hb' hcor + have hvZ : v ∈ insWalk ins K Z := (hb'eq ▸ hbZ) (mem_singleton v) + obtain ⟨hY, hperim⟩ := theorem_8_5_proof hS hs Z hZshort + obtain ⟨p, W, hlen, hshort, haW, hvW, hcount⟩ := + exists_restraint_walk_with_one_point_visit_bound hS hs ha'.2.1 hcor.2.1 hY haZ hvZ + exact ⟨p, W, a', ha', (hlen.trans hperim).trans_eq hZlen, hshort, haW, hvW, hcount⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73MinimalCircle.lean b/LeanPool/GraphMinor/GM12/Section73MinimalCircle.lean new file mode 100644 index 0000000000..6492dd4fea --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73MinimalCircle.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73ThetaNull +public import LeanPool.GraphMinor.GM12.Section2ThetaConstruction +import LeanPool.GraphMinor.GM12.Section2CurveCounts + +/-! +# A shortest non-null normal circle visits each region once + +To justify the representativity step in XII (7.3), page 261, choose +a non-null normal circle meeting as few drawing vertices as possible. +If its intersection with a region is disconnected, a chord produces +two normal circles with fewer vertices, as in XII (2.1). Minimality +makes both new circles null-homotopic. The theta-circle lemma then +makes the original circle null-homotopic, a contradiction. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A non-null normal circle can be chosen with no more vertices +and with connected intersection with every region. This is the +minimal-circle reduction in the representativity step of XII (7.3). -/ +theorem exists_minimal_nonNull_normal_circle + {S : Type*} [TopologicalSpace S] [T2Space S] (hS : IsClosedSurface S) + {Γ : Drawing S} {F : Set S} (hF : IsOArc F) (hn : Γ.IsNormal F) + (hnon : ¬ IsNullHomotopicOArc F) : + ∃ G : Set S, IsOArc G ∧ Γ.IsNormal G ∧ ¬ IsNullHomotopicOArc G ∧ + (G ∩ Γ.V).ncard ≤ (F ∩ Γ.V).ncard ∧ + ∀ r ∈ Γ.R, IsPreconnected (G ∩ r) := by + classical + have hex : ∃ n : ℕ, ∃ G : Set S, IsOArc G ∧ Γ.IsNormal G ∧ + ¬ IsNullHomotopicOArc G ∧ (G ∩ Γ.V).ncard = n := + ⟨(F ∩ Γ.V).ncard, F, hF, hn, hnon, rfl⟩ + obtain ⟨G, hG, hGn, hGnon, hcount⟩ := Nat.find_spec hex + have hmin : ∀ H : Set S, IsOArc H → Γ.IsNormal H → ¬ IsNullHomotopicOArc H → + (G ∩ Γ.V).ncard ≤ (H ∩ Γ.V).ncard := by + intro H hH hHn hHnon + rw [hcount] + exact Nat.find_min' hex ⟨H, hH, hHn, hHnon, rfl⟩ + refine ⟨G, hG, hGn, hGnon, hmin F hF hn hnon, ?_⟩ + intro r hr + by_contra hdisconn + obtain ⟨L, A, B, a, b, hL, hA, hB, hABG, hLA, hLB, hAB, hLr, + hLAo, hLBo, hLAn, hLBn, hAV, hBV⟩ := + exists_theta_of_disconnected_region_intersection hS hr hG hGn hdisconn + have hLV : Disjoint L Γ.V := disjoint_left.mpr fun x hxL hxV => + region_subset hr (hLr hxL) (Γ.V_subset_U hxV) + have hABV : Disjoint (A ∩ B) Γ.V := hLV.mono_left fun x hx => + (hLA.superset (hAB.subset hx)).1 + obtain ⟨hsmallA, hsmallB⟩ := chord_circle_vertex_counts_lt Γ.finite_V hLV hABV hAV hBV + have hcountA : ((L ∪ A) ∩ Γ.V).ncard < (G ∩ Γ.V).ncard := by + simpa only [union_comm L A, hABG] using hsmallA + have hcountB : ((L ∪ B) ∩ Γ.V).ncard < (G ∩ Γ.V).ncard := by + simpa only [union_comm L B, hABG] using hsmallB + have hnullA : IsNullHomotopicOArc (L ∪ A) := by + by_contra hnonnull + exact (Nat.not_le_of_lt hcountA) (hmin (L ∪ A) hLAo hLAn hnonnull) + have hnullB : IsNullHomotopicOArc (L ∪ B) := by + by_contra hnonnull + exact (Nat.not_le_of_lt hcountB) (hmin (L ∪ B) hLBo hLBn hnonnull) + have hSurface : IsSurface S := ⟨hS.1, hS.2.1, fun x => (hS.2.2 x).isManifoldPoint⟩ + have hnull := nullHomotopic_third_theta_circle hSurface hA hB hL hAB hLAo hLBo hnullA hnullB + exact hGnon (hABG ▸ hnull) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73NoParallel.lean b/LeanPool/GraphMinor/GM12/Section73NoParallel.lean new file mode 100644 index 0000000000..47066c86ad --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73NoParallel.lean @@ -0,0 +1,160 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73DiscPreprocess +import LeanPool.GraphMinor.GM12.Section72Regions +import LeanPool.GraphMinor.GM11.RadialRegions +import LeanPool.GraphMinor.GM11.RadialCorners +import LeanPool.GraphMinor.GM11.RadialBasics + +/-! +# Parallel radial spokes after the selected-disc reduction + +The claim in XII (7.3), page 261, that vertex deletion being two-cell +rules out parallel radial spokes needs the selected-disc reduction: +a loop at the deleted vertex is a counterexample without it. Once +no selected one-vertex disc contains an old edge, two parallel spokes +would bound a selected disc containing only their old region and +boundary vertex. This contradicts the radial condition. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 GM14 Hypergraph + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +/-- A normal closed disc containing no old edge and only its boundary +vertex from the old vertex set lies in the boundary region with that +vertex restored. -/ +theorem disc_subset_region_vertex_of_no_edges (hS : IsClosedSurface S) + {Γ : Drawing S} {D F r : Set S} {v : S} + (hD : IsClosedDisc D) (hbd : discBd D = F) (hvF : v ∈ F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) (hVD : Γ.V ∩ D = {v}) + (hr : r ∈ Γ.R) (hFr : F \ {v} ⊆ r) + (hno : ∀ e ∈ Γ.E, ¬ e ⊆ D) : D ⊆ r ∪ {v} := by + have hfront : frontier D = F := (IsClosedDisc.frontier_eq_discBd hS hD).trans hbd + have hΓD : Γ.U ∩ D ⊆ {v} := by + rintro x ⟨hxΓ, hxD⟩ + by_cases hxV : x ∈ Γ.V + · exact hVD.subset ⟨hxV, hxD⟩ + · obtain ⟨e, he, hxe⟩ := Γ.exists_edge_of_mem hxΓ hxV + have hdis : Disjoint e (frontier D) := by + apply disjoint_left.mpr + intro y hye hyF + exact (he.2.1 hye).2 (hn ⟨hfront ▸ hyF, (he.2.1 hye).1⟩) + exact (hno e he (subset_of_disjoint_frontier he.2.2.1.isConnected.isPreconnected + hD.isClosed hdis hxe hxD)).elim + have hdis : Disjoint (D \ {v}) Γ.U := disjoint_left.mpr fun x hxD hxΓ => + hxD.2 (hΓD ⟨hxΓ, hxD.1⟩) + have hF : IsOArc F := hbd ▸ hD.isOArc_discBd + obtain ⟨u, hu⟩ := ((infinite_of_isOArc hF).sdiff (finite_singleton v)).nonempty + have huD : u ∈ D \ {v} := ⟨Surface.discBd_subset D (hbd.symm ▸ hu.1), hu.2⟩ + have hsubset : D \ {v} ⊆ r := subset_region hr + (disc_sdiff_boundary_point_isPreconnected hD (hbd.symm ▸ hvF)) hdis huD (hFr hu) + intro x hxD + by_cases hxv : x = v + · exact Or.inr hxv + · exact Or.inl (hsubset ⟨hxD, hxv⟩) + +omit [T2Space S] in +/-- The closure of a radial spoke lies in its region with its old +end restored. -/ +theorem closure_spoke_subset_region_vertex (hS : IsClosedSurface S) + {Γ K : Drawing S} (htwo : (PaintingOrDrawing.drawing Γ).IsTwoCell) + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + {g r : Set S} {v u : S} (hg : g ∈ K.E) (hr : r ∈ Γ.R) (hur : u ∈ r) + (hcap : closure g ∩ K.V = {v, u}) : closure g ⊆ r ∪ {v} := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hucl : u ∈ closure g := (hcap.superset (Or.inr rfl)).1 + obtain ⟨y, hyr, hyg⟩ := mem_closure_iff.mp hucl r (region_isOpen hr) hur + have hgr : g ⊆ r := subset_region hr hg.2.2.1.isConnected.isPreconnected + (spoke_disjoint ⟨htwo, hK⟩ hg) hyg hyr + intro x hx + by_cases hxV : x ∈ K.V + · rcases hcap.subset ⟨hx, hxV⟩ with hxv | hxu + · exact Or.inr hxv + · exact Or.inl (hxu ▸ hur) + · exact Or.inl (hgr ((K.closure_diff_V hg).subset ⟨hx, hxV⟩)) + +/-- Two radial spokes with the same ends would bound a normal disc. If the disc selected by the +respectful tangle has only the specified old vertex and no old edge, pre-radiality gives a +contradiction. -/ +theorem parallel_spokes_contradiction + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsRespectfulDrawingTangle Γ θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) {v : S} (hv : v ∈ Γ.V) + {g h r : Set S} {u : S} (hg : g ∈ K.E) (hh : h ∈ K.E) (hgh : g ≠ h) + (hr : r ∈ Γ.R) (hur : u ∈ r) (huK : u ∈ K.V) + (hcapg : closure g ∩ K.V = {v, u}) (hcaph : closure h ∩ K.V = {v, u}) + (hinside : ∀ D F : Set S, IsClosedDisc D → IsOArc F → subBd D = F → + (PaintingOrDrawing.drawing Γ).IsNormal F → F ∩ Γ.V = {v} → F \ {v} ⊆ r → + ((PaintingOrDrawing.drawing Γ).inter D, (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T → + Γ.V ∩ D = {v} ∧ ∀ e ∈ Γ.E, ¬ e ⊆ D) : False := by + let F := closure g ∪ closure h + have hvu : v ≠ u := fun h => region_subset hr (h ▸ hur) (Γ.V_subset_U hv) + have hLg := isLine_closure hg hvu hcapg + have hLh := isLine_closure hh hvu hcaph + have hF : IsOArc F := isOArc_union hLg hLh fun x hx => + hcapg.subset ⟨hx.1, closure_inter_subset_V hg hh hgh hx⟩ + have hFZ : F ⊆ r ∪ {v} := union_subset + (closure_spoke_subset_region_vertex hS hT.1 hK hg hr hur hcapg) + (closure_spoke_subset_region_vertex hS hT.1 hK hh hr hur hcaph) + have hvF : v ∈ F := Or.inl (hcapg.superset (Or.inl rfl)).1 + have hn : (PaintingOrDrawing.drawing Γ).IsNormal F := by + rintro x ⟨hxF, hxΓ⟩ + rcases hFZ hxF with hxr | hxv + · exact (region_subset hr hxr hxΓ).elim + · exact hxv ▸ hv + have hFV : F ∩ Γ.V = {v} := by + apply Subset.antisymm + · rintro x ⟨hxF, hxV⟩ + exact (hFZ hxF).resolve_left (fun hxr => region_subset hr hxr (Γ.V_subset_U hxV)) + · rintro x hx + have hxv := mem_singleton_iff.mp hx + subst x + exact ⟨hvF, hv⟩ + have hFsmall : (F ∩ Γ.V).ncard < θ := by + rw [hFV, ncard_singleton] + omega + obtain ⟨D, hD, hbd, hm⟩ := hT.2.2.2 F hF hn hFsmall + have hFr : F \ {v} ⊆ r := fun x hx => (hFZ hx.1).resolve_right hx.2 + obtain ⟨hVD, hno⟩ := hinside D F hD hF hbd hn hFV hFr hm + have hDb : discBd D = F := (IsClosedDisc.frontier_eq_discBd hS hD).symm.trans + ((subBd_eq_frontier D).symm.trans hbd) + have hDr : D ⊆ r ∪ {v} := + disc_subset_region_vertex_of_no_edges hS hD hDb hvF hn hVD hr hFr hno + exact hK.2.2.2.2.2 g hg h hh hgh v hv r hr u ⟨hur, huK⟩ hcapg hcaph ⟨D, hD, hDr, hbd⟩ + +/-- Corrected parallel-spoke claim for XII (7.3), page 261: after +selected one-vertex insides containing old edges have been removed, +no two radial spokes at the vertex have the same other end. -/ +theorem no_parallel_spokes_of_no_selected_edge_inside [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsRespectfulDrawingTangle Γ θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) {v : S} (hv : v ∈ Γ.V) + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) + (hno : ∀ D F : Set S, IsClosedDisc D → IsOArc F → subBd D = F → + (PaintingOrDrawing.drawing Γ).IsNormal F → F ∩ Γ.V = {v} → + ((PaintingOrDrawing.drawing Γ).inter D, (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T → + ∀ e ∈ Γ.E, ¬ e ⊆ D) + {g h r : Set S} {u : S} (hg : g ∈ K.E) (hh : h ∈ K.E) (hgh : g ≠ h) + (hr : r ∈ Γ.R) (hur : u ∈ r) (huK : u ∈ K.V) + (hcapg : closure g ∩ K.V = {v, u}) (hcaph : closure h ∩ K.V = {v, u}) : False := by + apply parallel_spokes_contradiction hS hθ hT hK hv hg hh hgh hr hur huK hcapg hcaph + intro D F hD hF hbd hn hFV _ hm + exact ⟨vertices_in_selected_vertex_disc hS hT.2.1 htwo hD hbd hn hFV hm, + hno D F hD hF hbd hn hFV hm⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73OldSpoke.lean b/LeanPool/GraphMinor/GM12/Section73OldSpoke.lean new file mode 100644 index 0000000000..f9b8f8a76a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73OldSpoke.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73EdgeWalkLift +import LeanPool.GraphMinor.GM12.Section73MergedHub +import LeanPool.GraphMinor.GM12.Section73StarDrawing +import LeanPool.GraphMinor.GM11.RadialRegions +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# The old spoke behind an edge at the merged hub + +In XII (7.3), Claim (1), page 262, each new spoke at the hub +comes from an old spoke joining the same drawing vertex to an old +region hub. That old hub lies in the merged region. The surviving +old spoke avoids the deleted vertex. These data identify the two +or four edges used to close the lifted circuit. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Recover the surviving old spoke and its old region hub from +an edge at the contracted vertex. This gives the middle vertices +of the two replacement paths in XII (7.3), Claim (1), page 262. -/ +theorem exists_old_spoke_at_contracted_vertex + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K J : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {v : S} (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) + (f : C(S, S)) (hfix : ∀ x ∉ r', f x = x) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + (hJV : J.V = f '' K.V) + (hJE : J.E ⊆ (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g}) + {e : Set S} {x : S} (hel : J.toGraph.IsLink e v x) : + ∃ (g : Set S) (u : S), g ∈ K.E ∧ v ∉ closure g ∧ f '' g = e ∧ + u ∈ r' ∧ u ∈ K.V ∧ u ∉ Γ.V ∧ + x ∈ (deleteVertices Γ {v}).V ∧ K.toGraph.IsLink g u x := by + obtain ⟨g, hg, rfl⟩ := hJE hel.1 + obtain ⟨w, hw, r, hr, u, hur, huK, hcap, _⟩ := spoke_ends ⟨hK.1, hK.2.1⟩ hS hg.1 + have hwv : w ≠ v := fun h => hg.2 (h ▸ (hcap.superset (Or.inl rfl)).1) + have hwnew : w ∈ (deleteVertices Γ {v}).V := by + rw [deleteVertices_V] + exact ⟨hw, fun h => hwv h⟩ + have hwnr : w ∉ r' := fun hwr => region_subset hr' hwr + ((deleteVertices Γ {v}).V_subset_U hwnew) + have hfw : f w = w := hfix w hwnr + have hwu : w ≠ u := fun h => region_subset hr (h ▸ hur) (Γ.V_subset_U hw) + have hcapimage : closure (f '' g) ∩ J.V = {w, f u} := by + rw [hJV, closure_image_inter_vertices (isLine_closure hg.1 hwu hcap) + (radial_edge_inter_star hS ⟨hK.1, hK.2.1⟩ hv hg.1 hg.2).2 f hfibre, + hcap, image_insert_eq, image_singleton, hfw] + have hpair : ({w, f u} : Set S) = {v, x} := hcapimage.symm.trans hel.2.2.2 + have hwx : w = x := (hpair.subset (Or.inl rfl)).resolve_left hwv + have hfv : f u = v := by + have hvpair : v ∈ ({w, f u} : Set S) := hpair.superset (Or.inl rfl) + exact ((hvpair.resolve_left hwv.symm)).symm + have huv : u ≠ v := fun h => region_subset hr (h ▸ hur) (Γ.V_subset_U hv) + have hur' : u ∈ r' := by + by_contra hunr + exact huv ((hfix u hunr).symm.trans hfv) + refine ⟨g, u, hg.1, hg.2, rfl, hur', huK, + (fun hu => region_subset hr hur (Γ.V_subset_U hu)), hwx ▸ hwnew, hg.1, huK, ?_, ?_⟩ + · exact hwx ▸ hK.2.1.2.1 hw + · rw [← hwx, hcap, pair_comm] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73OrderOne.lean b/LeanPool/GraphMinor/GM12/Section73OrderOne.lean new file mode 100644 index 0000000000..4bcc828550 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73OrderOne.lean @@ -0,0 +1,147 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73Tangle +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.GM14.Section7a +import LeanPool.GraphMinor.GM12.Section72Tangle +import LeanPool.GraphMinor.GM11.Section64 +import LeanPool.GraphMinor.GM11.RadialExists +import LeanPool.GraphMinor.GM11.Theorem61 +import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.GM11.Section91 + +/-! +# The order-one case after vertex deletion + +For the endpoint case of XII (7.3), page 261, the deleted tangle has +order one. A normal circle with fewer than one vertex lies in one +region of the two-cell drawing and bounds a disc there. The disc +misses the whole drawing, so the tangle selects it: the reverse +orientation would put every vertex on the small side. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM10 GM11 GM14 Hypergraph + +/-- Every order-one tangle in a two-cell drawing is respectful. +This proves the endpoint respectfulness case used in XII (7.3), +page 261. -/ +theorem isRespectful_order_one + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} + (htwo : (PaintingOrDrawing.drawing Γ).IsTwoCell) + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph 1 T) : IsRespectfulDrawingTangle Γ 1 T := by + refine ⟨htwo, hT, inferInstance, ?_⟩ + intro F hF hn hcard + have hFV : F ∩ Γ.V = ∅ := by + apply (ncard_eq_zero (Γ.finite_V.subset inter_subset_right)).mp + exact Nat.eq_zero_of_le_zero (Nat.le_of_lt_succ hcard) + have hdis : Disjoint F Γ.U := by + apply disjoint_left.mpr + intro x hxF hxU + have hxV := hn ⟨hxF, hxU⟩ + exact (hFV.subset ⟨hxF, hxV⟩).elim + obtain ⟨x, hxF⟩ := GM14.IsOArc.nonempty hF + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem (disjoint_left.mp hdis hxF) + have hFr : F ⊆ r := subset_region hr (GM14.IsOArc.isPreconnected hF) hdis hxF hxr + obtain ⟨D, hDr, hD, hbd⟩ := exists_disc_in_openDisc (htwo.2 r hr) hF hFr + have hbd' : subBd D = F := (IsClosedDisc.subBd_eq_discBd hS hD).trans hbd + have hnD : (PaintingOrDrawing.drawing Γ).IsNormal (frontier D) := by + rw [← subBd_eq_frontier, hbd'] + exact hn + have hsep := isSeparation_inter hD.isClosed hnD + have hord : separationOrder ((PaintingOrDrawing.drawing Γ).inter D) + ((PaintingOrDrawing.drawing Γ).interOutside D) < 1 := by + apply lt_of_le_of_lt _ hcard + rw [← hbd', subBd_eq_frontier] + exact ncard_le_ncard (fun x hx => inter_outside_subset hx) + (Γ.finite_V.subset inter_subset_right) + refine ⟨D, hD, hbd', (hT.axiom1 hsep hord).resolve_right ?_⟩ + intro hrev + apply hT.axiom3 hrev + apply Subset.antisymm + · exact inter_subset_left + · intro x hxV + refine ⟨hxV, subset_closure ⟨mem_univ _, ?_⟩⟩ + intro hxD + exact region_subset hr (hDr hxD) (Γ.V_subset_U hxV) + +/-- An order-one respectful tangle has a metric. This supplies the +metric needed in the endpoint case of XII (7.3), page 261. -/ +theorem exists_metric_order_one + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} + (htwo : (PaintingOrDrawing.drawing Γ).IsTwoCell) + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph 1 T) : + ∃ d : Set S → Set S → ℕ, HasTangleMetric Γ 1 T d := by + have hresp := isRespectful_order_one hS htwo hT + obtain ⟨K, hK⟩ := exists_radialDrawing hS htwo + obtain ⟨ins, hins⟩ := exists_derivedSlope hS hresp.2.2 hK.2.1 + exact ⟨tangleMetric Γ K ins 1, hresp, K, ins, hK, hins, fun _ _ _ _ => rfl⟩ + +/-- The order-two endpoint of Graph Minors XII, (7.3), pages +261–262. The deleted tangle has order one. The first bound follows +from the old metric's order bound. For the second, distinct atoms +have positive new distance; if the atoms agree, the old distance to +the deleted vertex is zero. These are precisely the endpoint cases +excluded by the strict-distance assumptions in the paper's proof. -/ +theorem theorem_7_3_order_two + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hd : HasTangleMetric Γ 2 T d) + {v : S} (hv : v ∈ Γ.V) + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) : + ∃ (d' : Set S → Set S → ℕ) (r' : Set S), + HasTangleMetric (deleteVertices Γ {v}) 1 + (GM10.deleteVerticesTangle Γ.toHypergraph {v} T 2) d' ∧ + r' ∈ (deleteVertices Γ {v}).R ∧ v ∈ r' ∧ + (∀ a ∈ Γ.A ∩ (deleteVertices Γ {v}).A, + ∀ b ∈ Γ.A ∩ (deleteVertices Γ {v}).A, d a b - 2 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ (deleteVertices Γ {v}).A, d a {v} - 1 ≤ d' a r') := by + have hT' : IsTangle (deleteVertices Γ {v}).toHypergraph 1 + (GM10.deleteVerticesTangle Γ.toHypergraph {v} T 2) := by + simpa using theorem_7_3_tangle (by decide : 2 ≤ 2) hd.1.2.1 hv + obtain ⟨d', hd'⟩ := exists_metric_order_one hS htwo hT' + have hdelete := deleteVertices_isSubdrawing Γ {v} + have hvnot : v ∉ (deleteVertices Γ {v}).U := by + intro hvU + have hvV := (isSubdrawing_U_inter_V hdelete).subset ⟨hvU, hv⟩ + exact ((deleteVertices_V Γ {v}).subset hvV).2 rfl + obtain ⟨r', hr', hvr'⟩ := exists_region_of_notMem hvnot + have hbound : ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, d a b ≤ 2 := by + obtain ⟨_, K, ins, hK, _, heq⟩ := hd + intro a ha b hb + rw [heq a ha b hb] + exact tangleMetric_le_order hK.2.1 a b + have hvA : ({v} : Set S) ∈ Γ.A := Or.inl (Or.inl ⟨v, hv, rfl⟩) + refine ⟨d', r', hd', hr', hvr', ?_, ?_⟩ + · intro a ha b hb + exact (Nat.sub_eq_zero_of_le (hbound a ha.1 b hb.1)) ▸ Nat.zero_le (d' a b) + · intro a ha + by_cases har : a = r' + · have hva : v ∈ a := har.symm ▸ hvr' + have hav : a = {v} := atom_eq_of_inter_nonempty ha.1 hvA ⟨v, hva, rfl⟩ + have hd0 : d a {v} = 0 := by rw [hav]; exact metric_self hd hvA + rw [hd0, Nat.zero_sub] + exact Nat.zero_le _ + · have hpositive : 1 ≤ d' a r' := Nat.one_le_iff_ne_zero.mpr + (fun h0 => har ((tangleMetric_eq_zero_iff hS hd' ha.2 (Or.inr hr')).mp h0)) + have hle : d a {v} ≤ 2 := hbound a ha.1 {v} hvA + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73PeriodNull.lean b/LeanPool/GraphMinor/GM12/Section73PeriodNull.lean new file mode 100644 index 0000000000..324f1f60bc --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73PeriodNull.lean @@ -0,0 +1,55 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73RealPath +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM12.Section2PeriodicHits +import LeanPool.GraphMinor.GM11.FlatCover + +/-! +# Null-homotopy of a closed curve from one real period + +In the representativity step of XII (7.3), page 261, a trace +deforms one real period of the normal circle to a null-homotopic +walk. Reading this path homotopy on the cylinder gives a homotopy +of the original closed curve to a constant curve. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A null-homotopy fixing the endpoints of one period makes the +original closed curve null-homotopic. This closes the trace-path +comparison used for representativity in XII (7.3), page 261. -/ +theorem closedCurve_null_of_period_path + {S : Type*} [TopologicalSpace S] (φ : C(Circle, S)) (a : ℝ) + {x : S} (ha : periodicCurve φ a = x) (hb : periodicCurve φ (a + 1) = x) + (hnull : ((realIntervalPath (periodicCurve φ) (periodicCurve_continuous φ) a (a + 1)).cast + ha.symm hb.symm).Homotopic (Path.refl x)) : + ClosedCurveIsNullHomotopicIn univ φ := by + let p := (realIntervalPath (periodicCurve φ) (periodicCurve_continuous φ) a (a + 1)).cast + ha.symm hb.symm + let x' : (univ : Set S) := ⟨x, mem_univ x⟩ + let p' : Path x' x' := p.map toUniv.continuous + have hp : ∀ t, (p' t).1 = φ (arcParam (Circle.exp (2 * Real.pi * a)) t) := by + intro t + change φ (Circle.exp (2 * Real.pi * (a + t.val * (a + 1 - a)))) = _ + rw [arcParam_apply, ← Circle.exp_add] + congr 2 + ring + have hh : p'.Homotopic (Path.refl x') := hnull.map toUniv + exact ⟨x, mem_univ x, closedCurvesHomotopicIn_of_path + (Circle.exp (2 * Real.pi * a)) φ (ContinuousMap.const Circle x) + p' (Path.refl x') hp (fun _ => rfl) hh⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73PieceWalk.lean b/LeanPool/GraphMinor/GM12/Section73PieceWalk.lean new file mode 100644 index 0000000000..e44c9bf469 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73PieceWalk.lean @@ -0,0 +1,125 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73CircuitJoin +public import LeanPool.GraphMinor.GM11.Section92 + +/-! +# Normalizing the walks of XI (9.2) + +The proof of XI (9.2), used in XII (7.3), page 262, constructs +pieces bounded by a circuit, by one edge traversed twice, or by +one vertex. Normalize their walks accordingly. Each normalized +walk visits every ambient vertex at most once, and its length +is no greater than any closed walk with the same drawing. This +keeps the perimeter budget supplied by XI (9.2) when a different +attachment vertex is chosen. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +private theorem two_le_closed_walk_length_of_vertices + {α β : Type*} {G : Graph α β} {a b c : α} (W : GraphWalk G c c) + (ha : a ∈ W.support) (hb : b ∈ W.support) (hab : a ≠ b) : 2 ≤ W.length := by + cases W with + | nil _ => + have ha' : a = c := List.mem_singleton.mp ha + have hb' : b = c := List.mem_singleton.mp hb + exact (hab (ha'.trans hb'.symm)).elim + | cons _ R => + cases R with + | nil _ => + have ha' : a = c := by simpa [GraphWalk.support] using ha + have hb' : b = c := by simpa [GraphWalk.support] using hb + exact (hab (ha'.trans hb'.symm)).elim + | cons _ R => simp only [GraphWalk.length_cons]; omega + +/-- Normalize the boundary walk of a piece constructed in the +proof of XI (9.2), at any vertex of the piece. The three defining +shapes give a circuit walk, a two-edge return walk, or a nil walk. -/ +theorem exists_piece_walk_with_visit_bound + {S : Type*} [TopologicalSpace S] [T2Space S] + {K G : Drawing S} {ins : Drawing S → Set S} {k : ℕ} {Y A : Set S} + (hP : IsPiece K ins k Y A G) {p z : S} (hp : p ∈ G.V) + (Z : GraphWalk K.toGraph z z) (hZ : walkDrawing K Z = G) : + ∃ W : GraphWalk K.toGraph p p, walkDrawing K W = G ∧ + W.length ≤ Z.length ∧ ∀ v, walkVertexCount v W ≤ 1 := by + have hGK : G.IsSubdrawing K := hP.sub.trans interSet_isSub + rcases hP.kind with ⟨hC, _⟩ | ⟨e, u, v, huv, he, hcap, hGV, hGE, _, _⟩ | + ⟨v, hGV, hGE, _, _⟩ + · obtain ⟨W, hW, hlen, hcount⟩ := exists_circuit_walk_at_with_visit_bound hC hGK hp + refine ⟨W, hW, ?_, hcount⟩ + rw [hlen] + change G.E.ncard ≤ Z.edges.length + rw [← hZ, walkDrawing_E] + exact ncard_mem_list_le Z.edges + · have huCap : u ∈ closure e ∩ K.V := hcap.symm ▸ (Or.inl rfl : u ∈ ({u, v} : Set S)) + have hvCap : v ∈ closure e ∩ K.V := hcap.symm ▸ (Or.inr rfl : v ∈ ({u, v} : Set S)) + have hu : u ∈ K.V := huCap.2 + have hv : v ∈ K.V := hvCap.2 + have hl : K.toGraph.IsLink e u v := ⟨he, hu, hv, hcap⟩ + have hZlen : 2 ≤ Z.length := by + have huZ : u ∈ Z.support := by + have hh : u ∈ (walkDrawing K Z).V := hZ.symm ▸ (hGV.symm ▸ (Or.inl rfl : u ∈ + ({u, v} : Set S))) + rwa [walkDrawing_V] at hh + have hvZ : v ∈ Z.support := by + have hh : v ∈ (walkDrawing K Z).V := hZ.symm ▸ (hGV.symm ▸ (Or.inr rfl : v ∈ + ({u, v} : Set S))) + rwa [walkDrawing_V] at hh + exact two_le_closed_walk_length_of_vertices Z huZ hvZ huv + have hmake : ∀ {a b : S}, a ≠ b → K.toGraph.IsLink e a b → G.V = {a, b} → + ∃ W : GraphWalk K.toGraph a a, walkDrawing K W = G ∧ + W.length ≤ Z.length ∧ ∀ w, walkVertexCount w W ≤ 1 := by + intro a b hab hl hV + let W : GraphWalk K.toGraph a a := .cons hl (.cons hl.symm (.nil hl.2.1)) + refine ⟨W, ?_, hZlen, ?_⟩ + · apply Drawing.ext_of_V_E + · rw [walkDrawing_V, hV] + ext w + simp only [W, GraphWalk.support, List.mem_cons, List.not_mem_nil, or_false, mem_ofPred_eq, + mem_insert_iff, mem_singleton_iff] + tauto + · rw [walkDrawing_E, hGE] + ext f + simp [W, GraphWalk.edges] + · intro w + classical + change (if a = w then 1 else 0) + ((if b = w then 1 else 0) + 0) ≤ 1 + by_cases ha : a = w + · have hb : b ≠ w := fun hb => hab (ha.trans hb.symm) + simp [ha, hb] + · by_cases hb : b = w <;> simp [ha, hb] + rw [hGV] at hp + rcases hp with hp | hp + · subst p + exact hmake huv hl hGV + · have hpv : p = v := hp + subst p + exact hmake huv.symm hl.symm (hGV.trans (pair_comm u v)) + · have hpv : p = v := by rw [hGV] at hp; exact hp + subst p + let W : GraphWalk K.toGraph v v := .nil (hGK.1 hp) + refine ⟨W, ?_, Nat.zero_le _, ?_⟩ + · apply Drawing.ext_of_V_E + · rw [walkDrawing_V, hGV] + ext x + simp [W, GraphWalk.support] + · rw [walkDrawing_E, hGE] + ext e + simp [W, GraphWalk.edges] + · intro w + exact Nat.zero_le 1 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73PointRestraintVisits.lean b/LeanPool/GraphMinor/GM12/Section73PointRestraintVisits.lean new file mode 100644 index 0000000000..fa07c1880f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73PointRestraintVisits.lean @@ -0,0 +1,128 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73RestraintVisits +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.Section88 +import LeanPool.GraphMinor.GM11.Ties + +/-! +# A one-visit witness for a distinguished vertex + +For XII (7.3)(ii), page 262, one of the two atoms corresponds +to the merged hub vertex. Use the pieces in the proof of XI +(9.2), as in the two-visit construction. If the first piece +already encloses the hub, its own boundary walk suffices. If the +connector reaches the hub, stop it at the hub and return, omitting +the second piece. Otherwise only the second piece can visit the +hub. These choices give at most one hub visit within the same +perimeter budget. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The distinguished-vertex refinement of the XI (9.2) witness +selection used in XII (7.3)(ii), page 262. -/ +theorem exists_restraint_walk_with_one_point_visit_bound + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {K : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + (hs : IsSlope K k ins) {a Y : Set S} {v : S} (ha : a ∈ K.A) + (hv : ({v} : Set S) ∈ K.A) (hY : IsRestraint K ins k Y) + (haY : a ⊆ Y) (hvY : v ∈ Y) : + ∃ (p : S) (W : GraphWalk K.toGraph p p), W.length ≤ perimeterWalkLength K Y ∧ + W.length < k ∧ a ⊆ insWalk ins K W ∧ v ∈ insWalk ins K W ∧ + walkVertexCount v W ≤ 1 := by + rcases exists_pieces hS hs ha hv hY haY (singleton_subset_iff.mpr hvY) with + ⟨A, G, hP, haA, hvA⟩ | ⟨A, G, B, H, hP, hR, haA, hvB, _, hlink⟩ + · obtain ⟨p, hp⟩ := hP.Vne + obtain ⟨Z, hZ, hcnt⟩ := hP.walk p hp + have hZlen : Z.length ≤ perimeterWalkLength K Y := + length_le_of_count hS hY (fun e he => mem_E_of_mem_edges Z he) hcnt + obtain ⟨W, hW, hlen, hcount⟩ := exists_piece_walk_with_visit_bound hP hp Z hZ + have hinside : A ⊆ insWalk ins K W := by simpa only [insWalk, hW] using hP.sub_ins + exact ⟨p, W, hlen.trans hZlen, (hlen.trans hZlen).trans_lt hY.length_lt, + haA.trans hinside, hinside (hvA (mem_singleton v)), hcount v⟩ + · obtain ⟨a₀, b₀, Q₀, Z₀, R₀, ha₀, hb₀, hZ₀, hR₀, hbudget⟩ := hlink + obtain ⟨p, hp, q, hq, Q, hQ, hmin, _, _⟩ := + exists_shortest (A := G.V) (B := H.V) ⟨a₀, ha₀, b₀, hb₀, ⟨Q₀⟩⟩ + have hQlen := hmin a₀ ha₀ b₀ hb₀ Q₀ + obtain ⟨P, hPG, hPlen, hPcount⟩ := exists_piece_walk_with_visit_bound hP hp Z₀ hZ₀ + obtain ⟨R, hRH, hRlen, hRcount⟩ := exists_piece_walk_with_visit_bound hR hq R₀ hR₀ + have hAin : A ⊆ insWalk ins K P := by simpa only [insWalk, hPG] using hP.sub_ins + have hBin : B ⊆ insWalk ins K R := by simpa only [insWalk, hRH] using hR.sub_ins + by_cases hvP : v ∈ insWalk ins K P + · have hlen : P.length ≤ perimeterWalkLength K Y := by omega + exact ⟨p, P, hlen, hlen.trans_lt hY.length_lt, haA.trans hAin, hvP, hPcount v⟩ + have hvPs : v ∉ P.support := by + intro h + exact hvP (Or.inl ((mem_walkDrawing_U K P).mpr (Or.inl h))) + have hPzero := walkVertexCount_eq_zero_of_notMem_support P hvPs + by_cases hvQ : v ∈ Q.support + · obtain ⟨L, M, hQLM⟩ := Q.exists_append_of_mem hvQ + have hLsimple : L.IsSimple := by + have hn : Q.support.Nodup := hQ + rw [hQLM, GraphWalk.support_append] at hn + exact hn.of_append_left + have hLlen : L.length ≤ Q.length := by + rw [hQLM, GraphWalk.length_append] + exact Nat.le_add_right _ _ + let W := P.append (L.append L.reverse) + have hlen : W.length ≤ perimeterWalkLength K Y := by + have hWlen : W.length = P.length + 2 * L.length := by + simp only [W, GraphWalk.length_append, GraphWalk.length_reverse] + omega + omega + have hPW : (walkDrawing K P).IsSubdrawing (walkDrawing K W) := by + apply walkDrawing_mono + · intro x hx; exact (GraphWalk.mem_support_append _ _).mpr (Or.inl hx) + · intro e he; simp only [W, GraphWalk.edges_append, List.mem_append]; exact Or.inl he + have hvW : v ∈ W.support := (GraphWalk.mem_support_append _ _).mpr (Or.inr + ((GraphWalk.mem_support_append _ _).mpr (Or.inl L.end_mem_support))) + refine ⟨p, W, hlen, hlen.trans_lt hY.length_lt, + (haA.trans hAin).trans (insOf_mono hPW), + Or.inl ((mem_walkDrawing_U K W).mpr (Or.inl hvW)), ?_⟩ + have hback := (walkVertexCount_backtrack_bounds L hLsimple v).2 (Or.inr rfl) + change walkVertexCount v (P.append (L.append L.reverse)) ≤ 1 + rw [walkVertexCount_append, hPzero, Nat.zero_add] + exact hback + · let W := P.append (Q.append (R.append Q.reverse)) + have hlen : W.length ≤ perimeterWalkLength K Y := by + have hWlen : W.length = P.length + Q.length + R.length + Q.length := by + simp only [W, GraphWalk.length_append, GraphWalk.length_reverse] + omega + omega + have hPW : (walkDrawing K P).IsSubdrawing (walkDrawing K W) := by + apply walkDrawing_mono + · intro x hx; exact (GraphWalk.mem_support_append _ _).mpr (Or.inl hx) + · intro e he; simp only [W, GraphWalk.edges_append, List.mem_append]; exact Or.inl he + have hRW : (walkDrawing K R).IsSubdrawing (walkDrawing K W) := by + apply walkDrawing_mono + · intro x hx + exact (GraphWalk.mem_support_append _ _).mpr (Or.inr + ((GraphWalk.mem_support_append _ _).mpr (Or.inr + ((GraphWalk.mem_support_append _ _).mpr (Or.inl hx))))) + · intro e he + simp only [W, GraphWalk.edges_append, List.mem_append] + exact Or.inr (Or.inr (Or.inl he)) + refine ⟨p, W, hlen, hlen.trans_lt hY.length_lt, + (haA.trans hAin).trans (insOf_mono hPW), + insOf_mono hRW (hBin (hvB (mem_singleton v))), ?_⟩ + have hback := walkVertexCount_backtrack_eq_zero_of_notMem_support Q hvQ + have hr := hRcount v + simp only [walkVertexCount_append] at hback ⊢ + change walkVertexCount v (P.append (Q.append (R.append Q.reverse))) ≤ 1 + simp only [walkVertexCount_append] + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73PreRadialContraction.lean b/LeanPool/GraphMinor/GM12/Section73PreRadialContraction.lean new file mode 100644 index 0000000000..92275dc687 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73PreRadialContraction.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73ImageIncidence +public import LeanPool.GraphMinor.GM12.Section73RadialCleanup +import LeanPool.GraphMinor.GM12.Section73ContractedFaces + +/-! +# The cleaned contraction of the radial star + +For XII (7.3), page 261, contract the reduced radial star and remove +parallel spokes bounding empty discs. The construction gives a +two-cell pre-radial drawing of the drawing after vertex deletion. +It retains the image vertices and uses only surviving old spoke +images as edges. Every region contains at most one surviving edge +of the original drawing. Maximality is a separate verification. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Contracting the reduced radial star and cleaning up empty +bigons gives a two-cell pre-radial drawing after vertex deletion. +This is the contraction and deletion construction of XII (7.3), +page 261, with the global maximality check left separate. -/ +theorem exists_cleaned_radial_star_contraction + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) + {r' : Set S} (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') : + ∃ (f : C(S, S)) (H J : Drawing S), Function.Surjective f ∧ + (∀ x ∉ r', f x = x) ∧ + (∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) ∧ + (∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) ∧ + H.U = f '' K.U ∧ H.V = f '' K.V ∧ + H.E = (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g} ∧ + J.IsSubdrawing H ∧ J.V = H.V ∧ + (PaintingOrDrawing.drawing J).IsTwoCell ∧ + (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsPreRadialDrawing J ∧ + (∀ r ∈ J.R, ∀ a ∈ (deleteVertices Γ {v}).E, ∀ b ∈ (deleteVertices Γ {v}).E, + a ⊆ r → b ⊆ r → a = b) := by + obtain ⟨f, H, hsurj, hfix, hcollapse, hfibre, hHU, hHV, hHE, + hHtwo, hcap, hV, hhub, hregion, hlink⟩ := + exists_contracted_radial_incidence hS hK hE hv hunique hr' hvr' + have hface : ∀ r ∈ H.R, ∀ a ∈ (deleteVertices Γ {v}).E, + ∀ b ∈ (deleteVertices Γ {v}).E, a ⊆ r → b ⊆ r → a = b := by + intro r hr + obtain ⟨_, _, _, _, huniq⟩ := contracted_radial_region_edges hS hK hE hv hr' hvr' + f hsurj hfix hfibre hHU hr + exact huniq + obtain ⟨J, hJH, hJV, hJtwo, hJpre, hJface⟩ := + exists_preRadial_subdrawing_by_cleanup hS hHtwo hcap hV hhub hregion hlink hface + exact ⟨f, H, J, hsurj, hfix, hcollapse, hfibre, hHU, hHV, hHE, + hJH, hJV, hJtwo, hJpre, hJface⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73ProperArcCircle.lean b/LeanPool/GraphMinor/GM12/Section73ProperArcCircle.lean new file mode 100644 index 0000000000..c9f48b5f48 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73ProperArcCircle.lean @@ -0,0 +1,94 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.GlueDiscs +import LeanPool.GraphMinor.GM11.PerimeterPull + +/-! +# Compactifying a proper arc in a disc face + +For the maximality verification in XII (7.3), page 261, an added +spoke lies in an old disc face except at its ends. Collapse the +complement of that face to infinity. The spoke becomes a circle in +the one-point compactification, which is a sphere. The Jordan curve +theorem can then separate the two sides of the added spoke. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 OnePoint + +/-- The compactification collapse is injective on the open set it +retains. This is used for proper spokes in XII (7.3), page 261. -/ +theorem collapse_injOn {S : Type*} (A : Set S) : + InjOn (collapse A) A := by + intro x hx y hy hxy + rw [collapse_of_mem hx, collapse_of_mem hy] at hxy + exact congrArg Subtype.val (OnePoint.coe_injective hxy) + +/-- The finite points under compactification are exactly the points +of the retained set. -/ +theorem collapse_ne_infty_iff {S : Type*} {A : Set S} {x : S} : + collapse A x ≠ ∞ ↔ x ∈ A := by + by_cases hx : x ∈ A + · rw [collapse_of_mem hx] + exact ⟨fun _ => hx, fun _ => OnePoint.coe_ne_infty _⟩ + · rw [collapse_of_notMem hx] + exact ⟨fun h => False.elim (h rfl), fun h => False.elim (hx h)⟩ + +/-- A proper arc across an open disc becomes a circle when its +outside is collapsed to infinity. This is the separation step for +an added radial spoke in XII (7.3), page 261. -/ +theorem isOArc_collapse_proper_line + {S : Type*} [TopologicalSpace S] [T2Space S] + {A L : Set S} {a b : S} (hA : IsOpenDisc A) (hL : IsLineWithEnds L a b) + (ha : a ∉ A) (hb : b ∉ A) (hinside : L \ {a, b} ⊆ A) : + IsOArc (collapse A '' L) := by + obtain ⟨hSphere, _⟩ := IsSphere.isClosedSurface (isSphere_onePoint hA) + let : T2Space (OnePoint A) := hSphere.2.1 + obtain ⟨p, hp0, hp1⟩ := hL + let m : unitInterval → OnePoint A := fun t => collapse A (p t).val + have hmc : Continuous m := (continuous_collapse hA.1).comp + (continuous_subtype_val.comp p.continuous) + have hm0 : m 0 = ∞ := by + change collapse A (p 0).val = ∞ + rw [hp0, collapse_of_notMem ha] + have hm1 : m 1 = ∞ := by + change collapse A (p 1).val = ∞ + rw [hp1, collapse_of_notMem hb] + have hinterior : ∀ t ∈ Ioo (0 : unitInterval) 1, (p t).val ∈ A := by + intro t ht + apply hinside + refine ⟨(p t).property, ?_⟩ + rintro (hpa | hpb) + · have ht0 : t = 0 := p.injective (Subtype.ext (hpa.trans hp0.symm)) + exact ht.1.ne' ht0 + · have ht1 : t = 1 := p.injective (Subtype.ext (hpb.trans hp1.symm)) + exact ht.2.ne ht1 + have hmi : InjOn m (Ioo (0 : unitInterval) 1) := by + intro s hs t ht hst + exact p.injective (Subtype.ext (collapse_injOn A (hinterior s hs) (hinterior t ht) hst)) + have hmne : ∀ t ∈ Ioo (0 : unitInterval) 1, m t ≠ m 0 := by + intro t ht + rw [hm0] + exact collapse_ne_infty_iff.mpr (hinterior t ht) + have hrange : range m = collapse A '' L := by + ext y + constructor + · rintro ⟨t, rfl⟩ + exact ⟨(p t).val, (p t).property, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨p.symm ⟨x, hx⟩, congrArg (collapse A) (congrArg Subtype.val (p.apply_symm_apply ⟨x, + hx⟩))⟩ + exact hrange ▸ isOArc_of_loop hmc (hm0.trans hm1.symm) hmi hmne + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73RadialCleanup.lean b/LeanPool/GraphMinor/GM12/Section73RadialCleanup.lean new file mode 100644 index 0000000000..b9769f2945 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73RadialCleanup.lean @@ -0,0 +1,128 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73EmptyBigon +public import LeanPool.GraphMinor.GM12.Section73DeleteRadialEdge +public import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# Removing empty parallel-spoke discs + +For XII (7.3), page 261, minimize the edge count among subdrawings +that retain every vertex, remain two-cell, and have at most one +original drawing edge in each region. If parallel spokes bound a +disc in their original region, an innermost bigon is an empty region. +Delete one boundary edge and merge this empty region with its outside +neighbour. All the conditions persist and the edge count decreases. +Thus the minimum satisfies the no-empty-disc radial condition. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The finite empty-disc cleanup in Graph Minors XII, (7.3), +page 261. Starting with the radial incidence and hub conditions, +remove spokes until the no-empty-disc condition also holds. Keep +all vertices, the two-cell property, and uniqueness of original +drawing edges within regions. -/ +theorem exists_preRadial_subdrawing_by_cleanup + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ H : Drawing S} + (hH : (PaintingOrDrawing.drawing H).IsTwoCell) + (hcap : Γ.U ∩ H.U = Γ.V) (hV : Γ.V ⊆ H.V) + (hhub : ∀ r ∈ Γ.R, ∃! w, w ∈ r ∧ w ∈ H.V) + (hregion : ∀ w ∈ H.V \ Γ.V, ∃ r ∈ Γ.R, w ∈ r) + (hlink : ∀ e ∈ H.E, ∃ a ∈ Γ.V, ∃ b ∈ H.V \ Γ.V, + closure e ∩ H.V = {a, b}) + (hunique : ∀ r ∈ H.R, ∀ a ∈ Γ.E, ∀ b ∈ Γ.E, a ⊆ r → b ⊆ r → a = b) : + ∃ J : Drawing S, J.IsSubdrawing H ∧ J.V = H.V ∧ + (PaintingOrDrawing.drawing J).IsTwoCell ∧ + (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing J ∧ + (∀ r ∈ J.R, ∀ a ∈ Γ.E, ∀ b ∈ Γ.E, a ⊆ r → b ⊆ r → a = b) := by + classical + let good : ℕ → Prop := fun n => ∃ J : Drawing S, J.IsSubdrawing H ∧ J.V = H.V ∧ + (PaintingOrDrawing.drawing J).IsTwoCell ∧ + (∀ r ∈ J.R, ∀ a ∈ Γ.E, ∀ b ∈ Γ.E, a ⊆ r → b ⊆ r → a = b) ∧ J.E.ncard = n + have hex : ∃ n, good n := + ⟨H.E.ncard, H, ⟨Subset.rfl, Subset.rfl⟩, rfl, hH, hunique, rfl⟩ + obtain ⟨J, hJH, hJV, hJtwo, hJun, hcount⟩ := Nat.find_spec hex + have hVJ : Γ.V ⊆ J.V := hJV.symm ▸ hV + have hcapJ : Γ.U ∩ J.U = Γ.V := by + apply Subset.antisymm + · rintro x ⟨hxΓ, hxJ⟩ + exact hcap.subset ⟨hxΓ, hJH.U_subset hxJ⟩ + · intro x hx + exact ⟨Γ.V_subset_U hx, J.V_subset_U (hVJ hx)⟩ + have hhubJ : ∀ r ∈ Γ.R, ∃! w, w ∈ r ∧ w ∈ J.V := hJV.symm ▸ hhub + have hregionJ : ∀ w ∈ J.V \ Γ.V, ∃ r ∈ Γ.R, w ∈ r := hJV.symm ▸ hregion + have hlinkJ : ∀ e ∈ J.E, ∃ a ∈ Γ.V, ∃ b ∈ J.V \ Γ.V, + closure e ∩ J.V = {a, b} := by + intro e he + rw [hJV] + exact hlink e (hJH.2 he) + refine ⟨J, hJH, hJV, hJtwo, ⟨hcapJ, hVJ, hhubJ, hregionJ, hlinkJ, ?_⟩, hJun⟩ + intro g hg h hh hgh w hw r hr u hu hcg hch + rintro ⟨D, hD, hDr, hbdD⟩ + have hwu : w ≠ u := fun h => region_subset hr (h ▸ hu.1) (Γ.V_subset_U hw) + have hbd : discBd D = closure g ∪ closure h := + (GM14.IsClosedDisc.subBd_eq_discBd hS hD).symm.trans hbdD + have hVD : J.V ∩ D ⊆ {w, u} := by + rintro x ⟨hxV, hxD⟩ + rcases hDr hxD with hxr | hxw + · exact Or.inr ((hhubJ r hr).unique ⟨hxr, hxV⟩ ⟨hu.1, hu.2⟩) + · exact Or.inl hxw + have hlines : ∀ k ∈ J.E, ∃ a b, IsLineWithEnds (closure k) a b ∧ + closure k ∩ J.V = {a, b} := by + intro k hk + obtain ⟨a, ha, b, hb, hck⟩ := hlinkJ k hk + have hab : a ≠ b := fun h => hb.2 (h ▸ ha) + exact ⟨a, b, isLine_closure hk hab hck, hck⟩ + obtain ⟨P, a, b, hP, hPD, ha, hb, hab, hca, hcb, hbdP, hPdis, hpreg⟩ := + exists_empty_parallel_bigon_region hS hlines hg hh hgh hwu hcg hch hD hbd hVD + have habd : a ⊆ discBd P := fun x hx => hbdP ▸ Or.inl (subset_closure hx) + obtain ⟨q, hq, hqp, haq⟩ := exists_region_outside_disc_at_edge hS ha hP habd + have hap : a ⊆ closure (discInt P) := fun x hx => + hP.subset_closure_discInt (Surface.discBd_subset P (habd hx)) + have hnewtwo := isTwoCell_deleteEdge_of_distinct_regions hS hJtwo ha hpreg hq hqp.symm hap haq + have hdisΓ : ∀ k ∈ Γ.E, Disjoint k J.U := by + intro k hk + apply disjoint_left.mpr + intro x hxk hxJ + exact (hk.2.1 hxk).2 (hcapJ.subset ⟨(hk.2.1 hxk).1, hxJ⟩) + have hPr : discInt P ⊆ r := by + intro x hxP + rcases hDr (hPD hxP.1) with hxr | hxw + · exact hxr + · have hwbd : w ∈ discBd P := hbdP ▸ Or.inl (hca.superset (Or.inl rfl)).1 + exact False.elim (hxP.2 (hxw ▸ hwbd)) + have hempty : ∀ k ∈ Γ.E, ¬ k ⊆ discInt P := by + intro k hk hkP + obtain ⟨x, hxk⟩ := hk.1 + exact region_subset hr (hPr (hkP hxk)) (hk.2.1 hxk).1 + have hnewun := region_edge_unique_deleteEdge hS hJtwo ha hpreg hq hqp.symm hap haq hdisΓ hempty + hJun + have hnewV : (J.deleteEdge a).V = H.V := (deleteEdge_vertices_eq J a).trans hJV + have hnewH : (J.deleteEdge a).IsSubdrawing H := (deleteEdge_isSubdrawing J a).trans hJH + have hgood : good (J.deleteEdge a).E.ncard := + ⟨J.deleteEdge a, hnewH, hnewV, hnewtwo, hnewun, rfl⟩ + have hmin : J.E.ncard ≤ (J.deleteEdge a).E.ncard := by + rw [hcount] + exact Nat.find_min' hex hgood + have hlt : (J.deleteEdge a).E.ncard < J.E.ncard := by + rw [deleteEdge_E] + exact ncard_lt_ncard ⟨sdiff_subset, fun hback => (hback ha).2 rfl⟩ J.finite_edges + exact (Nat.not_le_of_gt hlt) hmin + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73RadialContraction.lean b/LeanPool/GraphMinor/GM12/Section73RadialContraction.lean new file mode 100644 index 0000000000..f2b2cc5bf0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73RadialContraction.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73PreRadialContraction +public import LeanPool.GraphMinor.GM12.Section73WalkLift +import LeanPool.GraphMinor.GM12.Section73RadialMaximal + +/-! +# The radial drawing and lifted walks after deletion + +This assembles the radial-star construction of XII (7.3), page 261. +Contract the spokes at the deleted vertex, remove empty parallel +bigons, and verify global maximality. Each closed walk in the new +radial drawing lifts to the old one with the stated length increase +and with the same point set outside the merged region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The radial-star construction and lifted walks in XII (7.3), +page 261, when the deleted drawing has an edge. The endpoint case +of order two is handled by `theorem_7_3_order_two`. -/ +theorem exists_radial_star_contraction + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) + (hE' : (deleteVertices Γ {v}).E.Nonempty) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) + {r' : Set S} (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') : + ∃ (f : C(S, S)) (H J : Drawing S), Function.Surjective f ∧ + (∀ x ∉ r', f x = x) ∧ + (∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) ∧ + (∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) ∧ + H.U = f '' K.U ∧ H.V = f '' K.V ∧ + H.E = (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g} ∧ + J.IsSubdrawing H ∧ J.V = H.V ∧ + (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsRadialDrawing J ∧ + (∀ (a : S) (W : GraphWalk J.toGraph a a), + ∃ W' : GraphWalk K.toGraph a a, + W'.length = W.length + 2 * walkVertexCount v W ∧ + f '' (walkDrawing K W').U = (walkDrawing J W).U ∧ + (walkDrawing K W').U \ r' = (walkDrawing J W).U \ r') := by + obtain ⟨f, H, J, hsurj, hfix, hcollapse, hfibre, hHU, hHV, hHE, + hJH, hJV, hJtwo, hJpre, hJface⟩ := + exists_cleaned_radial_star_contraction hS hK hE hv hunique hr' hvr' + have hJrad := isRadial_of_twoCell_unique_edges hS htwo hE' hJpre hJtwo hJface + refine ⟨f, H, J, hsurj, hfix, hcollapse, hfibre, hHU, hHV, hHE, hJH, hJV, hJrad, ?_⟩ + intro a W + have hJV' : J.V = f '' K.V := hJV.trans hHV + have hJE : J.E ⊆ (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g} := fun _ he => + hHE ▸ hJH.2 he + exact exists_closed_walk_lift hS hK hE hv hr' hvr' f hfix hcollapse hfibre hJV' hJE hJpre W + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73RadialMaximal.lean b/LeanPool/GraphMinor/GM12/Section73RadialMaximal.lean new file mode 100644 index 0000000000..0ba294363d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73RadialMaximal.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73FaceRefinement +public import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM11.RadialExists +import LeanPool.GraphMinor.GM11.RadialFacts +import LeanPool.GraphMinor.GM12.Section72MaximalCriterion +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# Maximality of the cleaned radial contraction + +For XII (7.3), page 261, extend the cleaned pre-radial drawing to a +radial drawing using the finite spoke bound. If an edge was added, +it splits one old disc face into two regions of the extension. Each +new radial region contains an original drawing edge. Those edges +would lie in the same old face, contradicting the edge-uniqueness +condition retained during cleanup. Hence no edge was added. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A pre-radial drawing extends to a radial drawing. The finite +spoke bound gives a maximum edge count among its pre-radial +extensions. This is used for maximality in XII (7.3), page 261. -/ +theorem exists_radial_extension + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ J : Drawing S} + (htwo : (PaintingOrDrawing.drawing Γ).IsTwoCell) + (hJ : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing J) : + ∃ K : Drawing S, (PaintingOrDrawing.drawing Γ).IsRadialDrawing K ∧ J.IsSubdrawing K := by + classical + obtain ⟨N, hN⟩ := exists_spoke_bound_drawing htwo hS + let A : Set ℕ := {n | ∃ K : Drawing S, + (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K ∧ J.IsSubdrawing K ∧ K.E.ncard = n} + have hAne : A.Nonempty := ⟨J.E.ncard, J, hJ, ⟨Subset.rfl, Subset.rfl⟩, rfl⟩ + have hAbdd : BddAbove A := ⟨N, by rintro _ ⟨K, hK, _, rfl⟩; exact hN K hK⟩ + obtain ⟨K, hK, hJK, hcount⟩ := Nat.sSup_mem hAne hAbdd + refine ⟨K, ⟨htwo, hK, ?_⟩, hJK⟩ + intro L hL hKL + have hVL := preRadial_vertices_eq_of_extension hK hL hKL + refine ⟨hVL.subset, ?_⟩ + have hle : L.E.ncard ≤ K.E.ncard := by + rw [hcount] + exact le_csSup hAbdd ⟨L, hL, hJK.trans hKL, rfl⟩ + exact (eq_of_subset_of_ncard_le hKL.2 hle L.finite_edges).superset + +/-- A two-cell pre-radial drawing is radial if each of its regions +contains at most one original drawing edge and that original drawing +has an edge. This closes the global maximality verification for the +cleanup in XII (7.3), page 261. -/ +theorem isRadial_of_twoCell_unique_edges + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ J : Drawing S} + (htwo : (PaintingOrDrawing.drawing Γ).IsTwoCell) (hE : Γ.E.Nonempty) + (hJ : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing J) + (hJtwo : (PaintingOrDrawing.drawing J).IsTwoCell) + (hunique : ∀ r ∈ J.R, ∀ a ∈ Γ.E, ∀ b ∈ Γ.E, a ⊆ r → b ⊆ r → a = b) : + (PaintingOrDrawing.drawing Γ).IsRadialDrawing J := by + obtain ⟨K, hK, hJK⟩ := exists_radial_extension hS htwo hJ + have hV : K.V = J.V := preRadial_vertices_eq_of_extension hJ hK.2.1 hJK + have hfacts := regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hE + have hback : K.E ⊆ J.E := by + intro g hg + by_contra hgn + obtain ⟨a, ha, b, hb, hcap⟩ := hK.2.1.2.2.2.2.1 g hg + have hab : a ≠ b := fun h => hb.2 (h ▸ ha) + obtain ⟨A, hA, p, hp, q, hq, hpq, hpA, hqA⟩ := exists_two_regions_in_old_face + hS hJK hV.symm hJtwo hg hgn (isLine_closure hg hab hcap) hcap + obtain ⟨e, he, hep⟩ := hfacts.1 p hp + obtain ⟨f, hf, hfq⟩ := hfacts.1 q hq + have hef : e = f := hunique A hA e he f hf (hep.trans hpA) (hfq.trans hqA) + obtain ⟨x, hxe⟩ := he.1 + exact hpq (region_eq_of_mem hp hq (hep hxe) (hfq (hef ▸ hxe))) + have heq : J = K := Drawing.ext_of_V_E hV.symm (Subset.antisymm hJK.2 hback) + exact heq.symm ▸ hK + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73RadialSpliceFibre.lean b/LeanPool/GraphMinor/GM12/Section73RadialSpliceFibre.lean new file mode 100644 index 0000000000..af41119311 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73RadialSpliceFibre.lean @@ -0,0 +1,111 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73SpliceFibre +public import LeanPool.GraphMinor.GM12.Section73RadialStarDrawing +import LeanPool.GraphMinor.GM11.RadialCorners +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.GM11.Fan + +/-! +# The radial splice meets the star in a point or an arc + +For XII (7.3), Claim (1), page 262, the retained path misses +the merged region and hence the star. Each surviving spoke can +meet the star only in an old radial vertex, which must be its +region hub. The intersection calculation for the splice now +gives a singleton or the two star spokes. If the hubs differ, +those two spokes meet only at the deleted vertex and form a line. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +open Classical in +/-- The actual radial splice has the fibre shape required for +the selected-disc comparison in XII (7.3), Claim (1), page 262. +The point case has a common old hub; the arc case has two hubs. -/ +theorem radial_spliced_circuit_fibre_shape + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K D : Drawing S} + (hK : PreRad (PaintingOrDrawing.drawing Γ) K) {v : S} (hv : v ∈ Γ.V) + {r : Set S} (hr : r ∈ (deleteVertices Γ {v}).R) (hvr : v ∈ r) + {p q x y : S} {k g g' k' : Set S} + (hkl : K.toGraph.IsLink k v p) (hgl : K.toGraph.IsLink g p x) + (hgl' : K.toGraph.IsLink g' q y) (hkl' : K.toGraph.IsLink k' v q) + (hvg : v ∉ closure g) (hvg' : v ∉ closure g') + (Q : GraphWalk K.toGraph x y) (hDis : Disjoint (walkDrawing K Q).U r) + (hDV : D.V = ({z | z ∈ Q.support} ∪ {p, q}) ∪ (if p = q then ∅ else {v})) + (hDE : D.E = if p = q then insert g (insert g' {e | e ∈ Q.edges}) + else insert k (insert g (insert g' (insert k' {e | e ∈ Q.edges})))) : + (D.U ∩ ({v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)).Subsingleton ∨ + ∃ a b, IsLineWithEnds + (D.U ∩ ({v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) a b := by + classical + let A : Set S := {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e + have hAr : A ⊆ r := radial_star_subset_deleted_region hS hK hv hr hvr + have hkA : closure k ⊆ A := fun z hz => Or.inr (mem_iUnion₂.mpr + ⟨k, ⟨hkl.1, (hkl.2.2.2.superset (Or.inl rfl)).1⟩, hz⟩) + have hkA' : closure k' ⊆ A := fun z hz => Or.inr (mem_iUnion₂.mpr + ⟨k', ⟨hkl'.1, (hkl'.2.2.2.superset (Or.inl rfl)).1⟩, hz⟩) + have hQout : ∀ z ∈ Q.support, z ∉ r := by + intro z hz + have hzV : z ∈ (walkDrawing K Q).V := by rw [walkDrawing_V]; exact hz + exact disjoint_left.mp hDis ((walkDrawing K Q).V_subset_U hzV) + have hgA : closure g ∩ A ⊆ {p} := by + rintro z ⟨hzg, hzA⟩ + have hzK := (radial_edge_inter_star hS hK hv hgl.1 hvg).2 ⟨hzg, hzA⟩ + rcases hgl.2.2.2.subset ⟨hzg, hzK⟩ with hzp | hzx + · exact hzp + · exact (hQout x Q.start_mem_support (hzx ▸ hAr hzA)).elim + have hgA' : closure g' ∩ A ⊆ {q} := by + rintro z ⟨hzg, hzA⟩ + have hzK := (radial_edge_inter_star hS hK hv hgl'.1 hvg').2 ⟨hzg, hzA⟩ + rcases hgl'.2.2.2.subset ⟨hzg, hzK⟩ with hzq | hzy + · exact hzq + · exact (hQout y Q.end_mem_support (hzy ▸ hAr hzA)).elim + have heq : D.U ∩ A = if p = q then {p} else closure k ∪ closure k' := + spliced_circuit_inter_collapse_set hkl hkl'.symm Q hDV hDE + (hDis.mono_right hAr) hkA hkA' hgA hgA' + by_cases hpq : p = q + · left + change (D.U ∩ A).Subsingleton + rw [heq, ite_eq_left hpq] + exact subsingleton_singleton + · right + have hkk : k ≠ k' := by + intro hkk + have hkl₀ : K.toGraph.IsLink k' v p := hkk ▸ hkl + exact hpq (hkl₀.right_unique hkl') + have hmeet : closure k ∩ closure k' = {v} := by + apply Subset.antisymm + · rintro z ⟨hzk, hzk'⟩ + have hzK := closure_inter_subset_V hkl.1 hkl'.1 hkk ⟨hzk, hzk'⟩ + rcases hkl.2.2.2.subset ⟨hzk, hzK⟩ with hzv | hzp + · exact hzv + · rcases hkl'.2.2.2.subset ⟨hzk', hzK⟩ with hzv | hzq + · exact hzv + · exact (hpq (hzp.symm.trans hzq)).elim + · rintro z rfl + exact ⟨(hkl.2.2.2.superset (Or.inl rfl)).1, (hkl'.2.2.2.superset (Or.inl rfl)).1⟩ + have hvp : v ≠ p := fun heq => + ((bipartite_of_preRadial hK.2 k v p hkl).mp hv) (heq ▸ hv) + have hvq : v ≠ q := fun heq => + ((bipartite_of_preRadial hK.2 k' v q hkl').mp hv) (heq ▸ hv) + refine ⟨p, q, ?_⟩ + change IsLineWithEnds (D.U ∩ A) p q + rw [heq, ite_eq_right hpq] + exact GM11.IsLineWithEnds.union (isLine_closure hkl.1 hvp hkl.2.2.2) + (isLine_closure hkl'.1 hvq hkl'.2.2.2) hmeet + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73RadialStar.lean b/LeanPool/GraphMinor/GM12/Section73RadialStar.lean new file mode 100644 index 0000000000..715f3f2b54 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73RadialStar.lean @@ -0,0 +1,178 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73StarCollapse +public import LeanPool.GraphMinor.GM12.Section73NoParallel +public import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM12.Section73EdgeContraction +import LeanPool.GraphMinor.GM11.RadialRegions +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# The radial star at a deleted vertex + +For XII (7.3), page 261, the spokes at the deleted vertex form a +finite star after the selected-disc reduction. Distinct spokes meet +only at their old end. Their closures miss the drawing after vertex +deletion. The finite-star collapse therefore fixes that drawing +pointwise and identifies exactly the star to its centre. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Orient a radial spoke incident with an old vertex toward its +region hub. This records its line and region for XII (7.3). -/ +theorem radial_spoke_ends_at_vertex + {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} (hK : PreRad (PaintingOrDrawing.drawing Γ) K) + {v : S} (hv : v ∈ Γ.V) {e : Set S} (he : e ∈ K.E) (hve : v ∈ closure e) : + ∃ r ∈ Γ.R, ∃ u, u ∈ r ∧ K.toGraph.IsLink e v u ∧ + IsLineWithEnds (closure e) v u ∧ closure e ⊆ r ∪ {v} := by + obtain ⟨w, hw, r, hr, u, hur, huK, hcap, _⟩ := spoke_ends hK hS he + have hvK : v ∈ K.V := hK.2.2.1 hv + have hvw : v = w := by + rcases hcap.subset ⟨hve, hvK⟩ with h | h + · exact h + · exact False.elim (region_subset hr (h ▸ hur) (Γ.V_subset_U hv)) + subst w + have hvu : v ≠ u := fun h => region_subset hr (h ▸ hur) (Γ.V_subset_U hv) + exact ⟨r, hr, u, hur, ⟨he, hvK, huK, hcap⟩, + isLine_closure he hvu hcap, + closure_spoke_subset_region_vertex hS hK.1 hK.2 he hr hur hcap⟩ + +/-- Distinct spokes of the reduced radial star are lines meeting +only at the centre, as used in XII (7.3), page 261. -/ +theorem radial_star_lines_and_intersections + {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} (hK : PreRad (PaintingOrDrawing.drawing Γ) K) + {v : S} (hv : v ∈ Γ.V) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) : + (∀ e ∈ {e ∈ K.E | v ∈ closure e}, ∃ u, IsLineWithEnds (closure e) v u) ∧ + (∀ e ∈ {e ∈ K.E | v ∈ closure e}, ∀ g ∈ {e ∈ K.E | v ∈ closure e}, + e ≠ g → closure e ∩ closure g ⊆ {v}) := by + let E : Set (Set S) := {e ∈ K.E | v ∈ closure e} + have hlines : ∀ e ∈ E, ∃ u, IsLineWithEnds (closure e) v u := by + intro e he + obtain ⟨r, hr, u, hu, hel, hline, _⟩ := radial_spoke_ends_at_vertex hS hK hv he.1 he.2 + exact ⟨u, hline⟩ + have halllines : ∀ g ∈ K.E, ∃ a b, IsLineWithEnds (closure g) a b ∧ + closure g ∩ K.V = {a, b} := by + intro g hg + obtain ⟨a, ha, r, hr, b, hb, hbK, hcap, _⟩ := spoke_ends hK hS hg + have hab : a ≠ b := fun h => region_subset hr (h ▸ hb) (Γ.V_subset_U ha) + exact ⟨a, b, isLine_closure hg hab hcap, hcap⟩ + have hmeet : ∀ e ∈ E, ∀ g ∈ E, e ≠ g → closure e ∩ closure g ⊆ {v} := by + intro e he g hg heg x hx + obtain ⟨r, hr, u, hu, hel, hline, _⟩ := radial_spoke_ends_at_vertex hS hK hv he.1 he.2 + have hvu : v ≠ u := lineWithEnds_ends_ne hline + have hsub := closure_inter_subsingleton_of_unique_link hel hvu halllines + (fun g hg hgl => (hunique e he.1 g hg u hel hgl).symm) g hg.1 heg.symm + exact hsub ⟨hg.2, he.2⟩ ⟨hx.2, hx.1⟩ |>.symm + exact ⟨hlines, hmeet⟩ + +/-- The reduced radial star contracts to the deleted vertex while +fixing the remaining drawing. This is the simultaneous topological +contraction used in XII (7.3), page 261. -/ +theorem exists_radial_star_collapse + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} (hK : PreRad (PaintingOrDrawing.drawing Γ) K) + {v : S} (hv : v ∈ Γ.V) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) : + ∃ f : C(S, S), Function.Surjective f ∧ + (∀ x ∈ (deleteVertices Γ {v}).U, f x = x) ∧ + (∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) ∧ + (∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) := by + let E : Set (Set S) := {e ∈ K.E | v ∈ closure e} + obtain ⟨hlines, hmeet⟩ := radial_star_lines_and_intersections hS hK hv hunique + have hdelete := deleteVertices_isSubdrawing Γ {v} + have hvnot : v ∉ (deleteVertices Γ {v}).U := by + intro hvU + have hvV := (isSubdrawing_U_inter_V hdelete).subset ⟨hvU, hv⟩ + exact ((deleteVertices_V Γ {v}).subset hvV).2 rfl + have havoid : Disjoint ({v} ∪ ⋃ e ∈ E, closure e) (deleteVertices Γ {v}).U := by + apply disjoint_left.mpr + intro x hx hxU + rcases hx with rfl | hx + · exact hvnot hxU + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + obtain ⟨r, hr, u, hu, hel, hline, hsub⟩ := radial_spoke_ends_at_vertex hS hK hv he.1 he.2 + rcases hsub hxe with hxr | rfl + · exact region_subset hr hxr (hdelete.U_subset hxU) + · exact hvnot hxU + have hfinite : {e ∈ K.E | v ∈ closure e}.Finite := K.finite_edges.subset fun _ he => he.1 + exact exists_star_collapse hS hfinite closure v hlines hmeet (deleteVertices Γ {v}).isClosed_U + havoid + +/-- The radial star lies in the region containing the deleted +vertex, as required for the contraction in XII (7.3), page 261. -/ +theorem radial_star_subset_deleted_region + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : PreRad (PaintingOrDrawing.drawing Γ) K) {v : S} (hv : v ∈ Γ.V) + {r' : Set S} (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') : + {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e ⊆ r' := by + have hdelete := deleteVertices_isSubdrawing Γ {v} + intro x hx + rcases hx with rfl | hx + · exact hvr' + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + obtain ⟨r, hr, u, hu, hel, hline, hsub⟩ := radial_spoke_ends_at_vertex hS hK hv he.1 he.2 + have hdis : Disjoint (closure e) (deleteVertices Γ {v}).U := by + apply disjoint_left.mpr + intro y hy hyU + rcases hsub hy with hyr | rfl + · exact region_subset hr hyr (hdelete.U_subset hyU) + · exact region_subset hr' hvr' hyU + have hc : IsPreconnected (closure e) := by + obtain ⟨p, _, _⟩ := hline + have hrange : range (fun t : unitInterval => (p t).val) = closure e := by + ext y + constructor + · rintro ⟨t, rfl⟩ + exact (p t).property + · intro hy + exact ⟨p.symm ⟨y, hy⟩, congrArg Subtype.val (p.apply_symm_apply ⟨y, hy⟩)⟩ + rw [← hrange] + exact isPreconnected_range (continuous_subtype_val.comp p.continuous) + exact subset_region hr' hc hdis he.2 hvr' hxe + +/-- The radial-star contraction may fix every point outside the +region of the deleted vertex. This gives the unchanged part of the +radial drawing in XII (7.3), page 261. -/ +theorem exists_radial_star_collapse_in_region + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : PreRad (PaintingOrDrawing.drawing Γ) K) {v : S} (hv : v ∈ Γ.V) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) + {r' : Set S} (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') : + ∃ f : C(S, S), Function.Surjective f ∧ (∀ x ∉ r', f x = x) ∧ + (∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) ∧ + (∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hlines, hmeet⟩ := radial_star_lines_and_intersections hS hK hv hunique + have hsub := radial_star_subset_deleted_region hS hK hv hr' hvr' + have havoid : Disjoint ({v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) r'ᶜ := + disjoint_left.mpr fun _ hx hxn => hxn (hsub hx) + have hfinite : {e ∈ K.E | v ∈ closure e}.Finite := K.finite_edges.subset fun _ he => he.1 + exact exists_star_collapse hS hfinite closure v hlines hmeet (region_isOpen hr').isClosed_compl + havoid + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73RadialStarDrawing.lean b/LeanPool/GraphMinor/GM12/Section73RadialStarDrawing.lean new file mode 100644 index 0000000000..17eff2f2d9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73RadialStarDrawing.lean @@ -0,0 +1,153 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73RadialStar +public import LeanPool.GraphMinor.GM12.Section73StarDrawing +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# The drawing after contraction of the radial star + +In XII (7.3), page 261, collapse all radial spokes at the deleted +vertex. A surviving spoke has one old end different from that +vertex. It can meet the collapsed star only at its other end, so +its image remains a line. The image drawing has exactly the images +of the surviving edges and fixes the drawing after vertex deletion. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A surviving radial edge meets the collapsed star in at most one +vertex. This is the geometric condition needed for the image drawing +in XII (7.3), page 261. -/ +theorem radial_edge_inter_star + {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : PreRad (PaintingOrDrawing.drawing Γ) K) {v : S} (hv : v ∈ Γ.V) + {g : Set S} (hg : g ∈ K.E) (hvg : v ∉ closure g) : + (closure g ∩ ({v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)).Subsingleton ∧ + closure g ∩ ({v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ⊆ K.V := by + let A : Set S := {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e + have hvertex : closure g ∩ A ⊆ K.V := by + rintro x ⟨hxg, hxA⟩ + rcases hxA with rfl | hxA + · exact False.elim (hvg hxg) + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hxA + exact closure_inter_subset_V hg he.1 (fun h => hvg (h.symm ▸ he.2)) ⟨hxg, hxe⟩ + have hOld : A ∩ Γ.U ⊆ {v} := by + rintro x ⟨hxA, hxΓ⟩ + rcases hxA with hxv | hxA + · exact hxv + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hxA + obtain ⟨r, hr, u, hu, hel, hline, hsub⟩ := radial_spoke_ends_at_vertex hS hK hv he.1 he.2 + rcases hsub hxe with hxr | hxv + · exact False.elim (region_subset hr hxr hxΓ) + · exact hxv + obtain ⟨a, ha, r, hr, b, hb, hbK, hcap, _⟩ := spoke_ends hK hS hg + have hsubset : closure g ∩ A ⊆ {b} := by + rintro x ⟨hxg, hxA⟩ + rcases hcap.subset ⟨hxg, hvertex ⟨hxg, hxA⟩⟩ with hxa | hxb + · have hxΓ : x ∈ Γ.U := by rw [hxa]; exact Γ.V_subset_U ha + have hxv : x = v := hOld ⟨hxA, hxΓ⟩ + exact False.elim (hvg (hxv ▸ hxg)) + · exact hxb + exact ⟨fun _ hx _ hy => (hsubset hx).trans (hsubset hy).symm, hvertex⟩ + +/-- The image of the radial drawing under an exact star collapse +is a drawing with precisely the surviving edge images. This is the +drawing construction in XII (7.3), page 261. -/ +theorem exists_radial_star_image_drawing + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : PreRad (PaintingOrDrawing.drawing Γ) K) {v : S} (hv : v ∈ Γ.V) + (f : C(S, S)) + (hcollapse : ∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) : + ∃ H : Drawing S, H.U = f '' K.U ∧ H.V = f '' K.V ∧ + H.E = (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g} := by + let C : Set (Set S) := {e ∈ K.E | v ∈ closure e} + have hnot : ∀ g ∈ K.E \ C, v ∉ closure g := by + intro g hg hvg + exact hg.2 ⟨hg.1, hvg⟩ + have hlines : ∀ g ∈ K.E \ C, ∃ a b, IsLineWithEnds (closure g) a b ∧ + closure g ∩ K.V = {a, b} := by + intro g hg + obtain ⟨a, ha, r, hr, b, hb, hbK, hcap, _⟩ := spoke_ends hK hS hg.1 + have hab : a ≠ b := fun h => region_subset hr (h ▸ hb) (Γ.V_subset_U ha) + exact ⟨a, b, isLine_closure hg.1 hab hcap, hcap⟩ + obtain ⟨H, hHU, hHV, hHE⟩ := exists_drawing_of_star_collapse (hK.2.2.1 hv) (Or.inl rfl) + (fun e he x hx => Or.inr (mem_iUnion₂.mpr ⟨e, he, hx⟩)) hlines + (fun g hg => (radial_edge_inter_star hS hK hv hg.1 (hnot g hg)).1) + (fun g hg => (radial_edge_inter_star hS hK hv hg.1 (hnot g hg)).2) f hcollapse hfibre + have hCE : K.E \ C = {g ∈ K.E | v ∉ closure g} := by + ext g + exact ⟨fun hg => ⟨hg.1, hnot g hg⟩, fun hg => ⟨hg.1, fun h => hg.2 h.2⟩⟩ + exact ⟨H, hHU, hHV, hCE ▸ hHE⟩ + +/-- Construct the drawing after the radial-star contraction in XII +(7.3), page 261. Its vertices and surviving edges are exactly the +images of the old ones, and the deleted drawing is fixed pointwise. -/ +theorem exists_contracted_radial_star_drawing + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : PreRad (PaintingOrDrawing.drawing Γ) K) {v : S} (hv : v ∈ Γ.V) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) : + ∃ (f : C(S, S)) (H : Drawing S), Function.Surjective f ∧ + (∀ x ∈ (deleteVertices Γ {v}).U, f x = x) ∧ + (∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) ∧ + (∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) ∧ + H.U = f '' K.U ∧ H.V = f '' K.V ∧ + H.E = (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g} := by + obtain ⟨f, hsurj, hfix, hcollapse, hfibre⟩ := exists_radial_star_collapse hS hK hv hunique + obtain ⟨H, hHU, hHV, hHE⟩ := exists_radial_star_image_drawing hS hK hv f hcollapse hfibre + exact ⟨f, H, hsurj, hfix, hcollapse, hfibre, hHU, hHV, hHE⟩ + +/-- The contracted radial-star drawing agrees with the original +outside the region of the deleted vertex. This establishes the +unchanged part of the drawing in XII (7.3), page 261, before deleting +parallel spokes that bound empty discs. -/ +theorem exists_contracted_radial_star_drawing_in_region + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : PreRad (PaintingOrDrawing.drawing Γ) K) {v : S} (hv : v ∈ Γ.V) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) + {r' : Set S} (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') : + ∃ (f : C(S, S)) (H : Drawing S), Function.Surjective f ∧ + (∀ x ∉ r', f x = x) ∧ + (∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) ∧ + (∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) ∧ + H.U = f '' K.U ∧ H.V = f '' K.V ∧ + H.E = (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g} ∧ + H.U \ r' = K.U \ r' ∧ H.V \ r' = K.V \ r' ∧ + (∀ B : Set S, (f '' B) \ r' = B \ r') := by + obtain ⟨f, hsurj, hfix, hcollapse, hfibre⟩ := + exists_radial_star_collapse_in_region hS hK hv hunique hr' hvr' + obtain ⟨H, hHU, hHV, hHE⟩ := exists_radial_star_image_drawing hS hK hv f hcollapse hfibre + have hsub := radial_star_subset_deleted_region hS hK hv hr' hvr' + have himage := (collapse_image_diff_eq hfibre hfix hsub).2 + refine ⟨f, H, hsurj, hfix, hcollapse, hfibre, hHU, hHV, hHE, ?_, ?_, himage⟩ + · rw [hHU] + exact himage K.U + · rw [hHV] + exact himage K.V + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73RealPath.lean b/LeanPool/GraphMinor/GM12/Section73RealPath.lean new file mode 100644 index 0000000000..1b524d8c9b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73RealPath.lean @@ -0,0 +1,85 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Topology.Homotopy.Path +import LeanPool.GraphMinor.GM12.Section2PathHomotopy + +/-! +# Paths on real parameter intervals + +For the trace comparison in the representativity step of XII (7.3), +page 261, turn a real-parameter curve segment into a path on the unit +interval. Splitting its real interval gives the same path up to a +homotopy fixing the ends. This allows the homotopies for successive +region visits to be concatenated. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology + +/-- Restrict a continuous real-parameter curve to an interval and +rescale it to a path. -/ +@[expose] noncomputable def realIntervalPath + {S : Type*} [TopologicalSpace S] (f : ℝ → S) (hf : Continuous f) (a b : ℝ) : + Path (f a) (f b) where + toFun := fun t => f (a + t.val * (b - a)) + continuous_toFun := hf.comp (by fun_prop) + source' := by change f (a + (0 : ℝ) * (b - a)) = f a; simp + target' := by + change f (a + (1 : ℝ) * (b - a)) = f b + congr 1 + ring + +/-- A real interval of length zero gives the constant path. -/ +theorem realIntervalPath_self + {S : Type*} [TopologicalSpace S] (f : ℝ → S) (hf : Continuous f) (a : ℝ) : + realIntervalPath f hf a a = Path.refl (f a) := by + ext t + change f (a + t.val * (a - a)) = f a + simp + +/-- The paths on two successive real intervals concatenate to the +path on their union up to homotopy with fixed ends. This is the +partition step for traces in XII (7.3), page 261. -/ +theorem realIntervalPath_split + {S : Type*} [TopologicalSpace S] (f : ℝ → S) (hf : Continuous f) + {a b c : ℝ} (hab : a < b) (hac : a ≤ c) (hcb : c ≤ b) : + ((realIntervalPath f hf a c).trans (realIntervalPath f hf c b)).Homotopic + (realIntervalPath f hf a b) := by + let s : unitInterval := ⟨(c - a) / (b - a), + div_nonneg (sub_nonneg.mpr hac) (sub_nonneg.mpr hab.le), + (div_le_one (sub_pos.mpr hab)).mpr (sub_le_sub_right hcb a)⟩ + have hs : a + s.val * (b - a) = c := by + change a + ((c - a) / (b - a)) * (b - a) = c + rw [div_mul_cancel₀ _ (sub_ne_zero.mpr hab.ne')] + ring + let P := realIntervalPath f hf a b + have hmid : P s = f c := congrArg f hs + let α : Path (f a) (P s) := (realIntervalPath f hf a c).cast rfl hmid + let β : Path (P s) (f b) := (realIntervalPath f hf c b).cast hmid rfl + have hα : ∀ t, α t = (P.subpath 0 s) t := by + intro t + change f (a + t.val * (c - a)) = f (a + ((1 - t.val) * 0 + t.val * s.val) * (b - a)) + apply congrArg f + rw [← hs] + ring + have hβ : ∀ t, β t = (P.subpath s 1) t := by + intro t + change f (c + t.val * (b - c)) = f (a + ((1 - t.val) * s.val + t.val * 1) * (b - a)) + apply congrArg f + rw [← hs] + ring + have hsplit := split_path_homotopic P s α β hα hβ + exact hsplit + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73ReplacementEdges.lean b/LeanPool/GraphMinor/GM12/Section73ReplacementEdges.lean new file mode 100644 index 0000000000..772bfbee9e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73ReplacementEdges.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73LiftedSpokeEdges +import LeanPool.GraphMinor.GM11.RadialRegions + +/-! +# The edges of the replacement paths + +In XII (7.3), page 261, a new spoke at the merged hub is replaced +by the old surviving spoke and the star spoke to its old region +hub. Record these old edges from their incidence and image data. +When the star spokes are unique, every two-edge lift with the +required image contains these edges. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The old edges of the two-edge paths replacing a spoke in +XII (7.3), page 261. The surviving spoke maps to the new edge, +and the other spoke joins its old hub to the deleted vertex. -/ +@[expose] def spokeReplacementEdges + {S : Type*} [TopologicalSpace S] (K J : Drawing S) (v : S) (f : S → S) + (e : Set S) : Set (Set S) := + {d | ∃ (z : S) (g : Set S) (u : S), J.toGraph.IsLink e v z ∧ + v ∉ closure g ∧ f '' g = e ∧ K.toGraph.IsLink g u z ∧ + (d = g ∨ K.toGraph.IsLink d v u)} + +open Classical in +/-- Every old replacement edge occurs in a one- or two-edge lift +of the new edge with the specified image. The uniqueness of star +spokes identifies the first edge of the two-edge lift. This is +the edge containment needed for XII (7.3), Claim (1), page 262. -/ +theorem spokeReplacementEdges_subset_edge_lift + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K J : Drawing S} + (hK : PreRad (PaintingOrDrawing.drawing Γ) K) {v : S} (hv : v ∈ Γ.V) + (f : S → S) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) + {e : Set S} {x y : S} (hel : J.toGraph.IsLink e x y) + (W : GraphWalk K.toGraph x y) + (hlen : W.length = if x = v ∨ y = v then 2 else 1) + (himage : f '' (walkDrawing K W).U = closure e) : + ∀ d ∈ spokeReplacementEdges K J v f e, d ∈ W.edges := by + rintro d ⟨z, g, u, hnew, hvg, hfg, hgu, hd⟩ + have hgW : g ∈ W.edges := old_edge_mem_lift_of_image hS hK hv hgu.1 hvg f hfibre W (by + rw [himage, hfg] + exact subset_closure) + rcases hd with rfl | hd + · exact hgW + · have hstar : ∀ a ∈ K.E, K.toGraph.IsLink a v u → a = d := + fun a ha hal => hunique a ha d hd.1 u hal hd + rcases hel.eq_and_eq_or_eq_and_eq hnew with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · have htwo : W.length = 2 := by simpa only [true_or, ite_true] using hlen + exact star_edge_mem_two_edge_lift hgu hvg hstar W htwo hgW + · have htwo : W.reverse.length = 2 := by + rw [GraphWalk.length_reverse] + simpa only [or_true, ite_true] using hlen + have hgRev : g ∈ W.reverse.edges := by + rwa [GraphWalk.edges_reverse, List.mem_reverse] + have hdRev := star_edge_mem_two_edge_lift hgu hvg hstar W.reverse htwo hgRev + rwa [GraphWalk.edges_reverse, List.mem_reverse] at hdRev + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73Representativity.lean b/LeanPool/GraphMinor/GM12/Section73Representativity.lean new file mode 100644 index 0000000000..abb9d303aa --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73Representativity.lean @@ -0,0 +1,93 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73ShortWalkNull +import LeanPool.GraphMinor.GM12.Section73TracePath +import LeanPool.GraphMinor.GM12.Section73TraceHubCount +import LeanPool.GraphMinor.GM12.Section73PeriodNull +import LeanPool.GraphMinor.GM12.Section73MinimalCircle +import LeanPool.GraphMinor.GM12.Section2TraceExistence +import LeanPool.GraphMinor.GM12.Section2CurveCounts +import LeanPool.GraphMinor.GM11.FlatCover +import LeanPool.GraphMinor.GM11.Section64 + +/-! +# Representativity after contracting a radial star + +For XII (7.3), page 261, a short non-null normal circle can be +chosen to meet every region in a connected set. Its radial trace +visits the merged hub at most once. Lifting it therefore adds at +most two edges. The old slope contracts this short lifted walk, +and composing with the collapse contracts the original circle. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The constructed radial star contraction preserves representativity +with order decreased by one, as used in XII (7.3), page 261. -/ +theorem isRepresentative_of_radial_star_contraction + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K J : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + (f : C(S, S)) (hfix : ∀ x ∉ r', f x = x) + (hcollapse : ∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + (hJV : J.V = f '' K.V) + (hJE : J.E ⊆ (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g}) + (hJpre : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsPreRadialDrawing J) + {θ : ℕ} {ins : Drawing S → Set S} (hs : IsSlope K (2 * θ) ins) + (hJ : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsRadialDrawing J) + (hE' : (deleteVertices Γ {v}).E.Nonempty) + : (deleteVertices Γ {v}).IsRepresentative (θ - 1) := by + refine ⟨inferInstance, ?_⟩ + intro F hF hn hcard + by_contra hnon + obtain ⟨G, hG, hGn, hGnon, hcount, hconn⟩ := + exists_minimal_nonNull_normal_circle hS hF hn hnon + obtain ⟨φ, hφ, hrange, hφn, hlen⟩ := exists_normal_curve_of_oArc hG hGn + obtain ⟨u, W, hW⟩ := exists_trace hS hJ hE' hφn + rcases hW.2 with ⟨_, _, _, r, hr, hφr, _⟩ | ⟨_, hWlen, a, hsteps⟩ + · have hGr : G ⊆ r := hrange ▸ hφr + obtain ⟨D, _, hD, hbd⟩ := exists_disc_in_openDisc (hJ.1.2 r hr) hG hGr + exact hGnon (isNullHomotopicOArcIn_of_subset_disc hG (subset_univ _) hD + (hbd ▸ Surface.discBd_subset D)) + · have hvcount : walkVertexCount v W ≤ 1 := + traceSteps_hub_count_le_one hφ hr' (hrange.symm ▸ hconn r' hr') hvr' + (l := a) le_rfl le_rfl W hsteps + have hlength : W.length + 2 * walkVertexCount v W < 2 * θ := by + rw [hWlen, hlen, inter_comm] + omega + have hloop : ∀ e x y, J.toGraph.IsLink e x y → x ≠ y := by + intro e x y hel heq + subst y + have hb := bipartite_of_preRadial hJpre e x x hel + by_cases hx : x ∈ (deleteVertices Γ {v}).V + · exact (hb.mp hx) hx + · exact hx (hb.mpr hx) + obtain ⟨q, hq⟩ := exists_edge_paths hloop + have hq' : ∀ e x y (h : J.toGraph.IsLink e x y), range (q e x y h) ⊆ closure e := + fun e x y h => (hq e x y h).subset + have hwNull := walkPath_null_of_vertex_deletion_lift hS hK hE hv hr' hvr' + f hfix hcollapse hfibre hJV hJE hJpre hs q hq' W hlength + obtain ⟨ha, hb, hpath⟩ := traceSteps_path_homotopic ⟨hJ.1, hJpre⟩ + (periodicCurve_continuous φ) q hq' W hsteps + have hnull := closedCurve_null_of_period_path φ a ha hb (hpath.trans hwNull) + have hnullRange : IsNullHomotopicOArc (range φ) := ⟨hφ.toHomeomorph, hnull⟩ + exact hGnon (hrange ▸ hnullRange) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73Respectfulness.lean b/LeanPool/GraphMinor/GM12/Section73Respectfulness.lean new file mode 100644 index 0000000000..b772108ae6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73Respectfulness.lean @@ -0,0 +1,62 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73DiscOrientation +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.Epstein +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.Section7 +import LeanPool.GraphMinor.GM16.SphereRespectful + +/-! +# Respectfulness of the deleted tangle + +For XII (7.3), page 261, representativity supplies a disc bounded +by every short normal circle. On a nonspherical surface the +orientation argument selects this disc in the deleted tangle. +On the sphere the tangle axiom selects one of the two discs. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 GM14 Hypergraph + +/-- Complete the disc-selection argument of XII (7.3), page 261, +once representativity of the deleted drawing has been proved. -/ +theorem isRespectful_after_vertex_deletion_of_representative + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsRespectfulDrawingTangle Γ θ T) {v : S} (hv : v ∈ Γ.V) + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) + (hrep : (deleteVertices Γ {v}).IsRepresentative (θ - 1)) : + IsRespectfulDrawingTangle (deleteVertices Γ {v}) (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) := by + have hnew := theorem_7_3_tangle hθ hT.2.1 hv + refine ⟨htwo, hnew, ?_⟩ + by_cases hsphere : IsSphere S + · exact GM16.drawing_tangle_isRespectful_of_isSphere hS hsphere _ hnew + · refine ⟨inferInstance, ?_⟩ + intro F hF hn hcard + have hnull := hrep.2 F hF hn hcard + have hSurface : IsSurface S := ⟨hS.1, hS.2.1, fun x => (hS.2.2 x).isManifoldPoint⟩ + have hbd : Disjoint F (bd S) := disjoint_left.mpr fun x _ hx => hx (hS.2.2 x) + obtain ⟨D, _, hD, hDF⟩ := epstein_first hSurface hF (subset_univ F) hbd hnull + have hfront : frontier D = F := (IsClosedDisc.frontier_eq_discBd hS hD).trans hDF + have hnormal : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsNormal + (frontier D) := hfront.symm ▸ hn + have hcount : (frontier D ∩ (deleteVertices Γ {v}).V).ncard < θ - 1 := + hfront.symm ▸ hcard + exact ⟨D, hD, (subBd_eq_frontier D).trans hfront, + disc_orientation_after_vertex_deletion hS hsphere hθ hT hv hD hnormal hcount⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73RestraintVisits.lean b/LeanPool/GraphMinor/GM12/Section73RestraintVisits.lean new file mode 100644 index 0000000000..3a80151c01 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73RestraintVisits.lean @@ -0,0 +1,105 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73PieceWalk +public import LeanPool.GraphMinor.GM12.Section73ConnectorVisits +import LeanPool.GraphMinor.GM11.Section88 +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.Ties + +/-! +# Two-visit witnesses from XI (9.2) + +XII (7.3), page 262, selects its metric witness by XI (9.2). +We use the proved piece construction in that argument. With one +piece, normalize its boundary walk. With two pieces, normalize +both boundary walks and replace their connector by a shortest +path between their vertex sets. These replacements preserve the +perimeter budget and the containment of the two atoms in the +inside. The connector visit lemma then gives at most two visits +to each vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The two-visit consequence of the proof of XI (9.2) used by +XII (7.3), page 262: two atoms in a restraint are enclosed by a +walk within its perimeter budget, visiting each vertex at most +twice. All pieces and their connecting path are constructed by +the proved lemmas of XI (9.2). -/ +theorem exists_restraint_walk_with_two_visit_bound + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {K : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + (hs : IsSlope K k ins) {a b Y : Set S} (ha : a ∈ K.A) (hb : b ∈ K.A) + (hY : IsRestraint K ins k Y) (haY : a ⊆ Y) (hbY : b ⊆ Y) : + ∃ (p : S) (W : GraphWalk K.toGraph p p), W.length ≤ perimeterWalkLength K Y ∧ + W.length < k ∧ a ⊆ insWalk ins K W ∧ b ⊆ insWalk ins K W ∧ + ∀ v, walkVertexCount v W ≤ 2 := by + rcases exists_pieces hS hs ha hb hY haY hbY with + ⟨A, G, hP, haA, hbA⟩ | ⟨A, G, B, H, hP, hR, haA, hbB, _, hlink⟩ + · obtain ⟨p, hp⟩ := hP.Vne + obtain ⟨Z, hZ, hcnt⟩ := hP.walk p hp + have hZlen : Z.length ≤ perimeterWalkLength K Y := + length_le_of_count hS hY (fun e he => mem_E_of_mem_edges Z he) hcnt + obtain ⟨W, hW, hlen, hcount⟩ := exists_piece_walk_with_visit_bound hP hp Z hZ + have hinside : A ⊆ insWalk ins K W := by + simpa only [insWalk, hW] using hP.sub_ins + exact ⟨p, W, hlen.trans hZlen, (hlen.trans hZlen).trans_lt hY.length_lt, + haA.trans hinside, hbA.trans hinside, fun v => (hcount v).trans (by decide)⟩ + · obtain ⟨a₀, b₀, Q₀, Z₀, R₀, ha₀, hb₀, hZ₀, hR₀, hbudget⟩ := hlink + obtain ⟨p, hp, q, hq, Q, hQ, hmin, hQG, hQH⟩ := + exists_shortest (A := G.V) (B := H.V) ⟨a₀, ha₀, b₀, hb₀, ⟨Q₀⟩⟩ + have hQlen := hmin a₀ ha₀ b₀ hb₀ Q₀ + obtain ⟨P, hPG, hPlen, hPcount⟩ := exists_piece_walk_with_visit_bound hP hp Z₀ hZ₀ + obtain ⟨R, hRH, hRlen, hRcount⟩ := exists_piece_walk_with_visit_bound hR hq R₀ hR₀ + let W := P.append (Q.append (R.append Q.reverse)) + have hlen : W.length ≤ perimeterWalkLength K Y := by + have hWlen : W.length = P.length + Q.length + R.length + Q.length := by + simp only [W, GraphWalk.length_append, GraphWalk.length_reverse] + omega + omega + have hGW : G.IsSubdrawing (walkDrawing K W) := by + rw [← hPG] + apply walkDrawing_mono + · intro x hx + exact (GraphWalk.mem_support_append _ _).mpr (Or.inl hx) + · intro e he + change e ∈ (P.append (Q.append (R.append Q.reverse))).edges + rw [GraphWalk.edges_append] + exact List.mem_append_left _ he + have hHW : H.IsSubdrawing (walkDrawing K W) := by + rw [← hRH] + apply walkDrawing_mono + · intro x hx + exact (GraphWalk.mem_support_append _ _).mpr (Or.inr + ((GraphWalk.mem_support_append _ _).mpr (Or.inr + ((GraphWalk.mem_support_append _ _).mpr (Or.inl hx))))) + · intro e he + simp only [W, GraphWalk.edges_append, List.mem_append] + exact Or.inr (Or.inr (Or.inl he)) + have hAin : A ⊆ insWalk ins K W := hP.sub_ins.trans (insOf_mono hGW) + have hBin : B ⊆ insWalk ins K W := hR.sub_ins.trans (insOf_mono hHW) + refine ⟨p, W, hlen, hlen.trans_lt hY.length_lt, haA.trans hAin, hbB.trans hBin, ?_⟩ + intro v + apply walkVertexCount_join_le_two P R Q hPcount hRcount hQ + · intro x hxQ hxP + apply hQG x hxQ + rw [← hPG, walkDrawing_V] + exact hxP + · intro x hxQ hxR + apply hQH x hxQ + rw [← hRH, walkDrawing_V] + exact hxR + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73SelectedDiscDeletion.lean b/LeanPool/GraphMinor/GM12/Section73SelectedDiscDeletion.lean new file mode 100644 index 0000000000..cc524226a5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73SelectedDiscDeletion.lean @@ -0,0 +1,68 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73Separator +public import LeanPool.GraphMinor.GM12.Section73Tangle +import LeanPool.GraphMinor.GM12.Section73DiscPreprocess +import LeanPool.GraphMinor.GM12.Section72Tangle + +/-! +# Selected disc separations survive vertex deletion + +In XII (7.3), Claim (1), page 262, an old selected disc gives +a selected separation in the deleted tangle. First add the deleted +vertex to both sides and apply X (2.9). Deleting the vertex then +recovers exactly the intersections of the new drawing with the +same disc and its closed outside. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 GM10 Hypergraph + +/-- Closed-set intersection commutes with vertex deletion at the +level of the separation hypergraphs. This identifies the two sides +in XII (7.3), Claim (1), page 262. -/ +theorem drawing_inter_deleteVertices + {S : Type*} [TopologicalSpace S] [T2Space S] + (Γ : Drawing S) (Z : Set S) {X : Set S} (hX : IsClosed X) : + (PaintingOrDrawing.drawing (deleteVertices Γ Z)).inter X = + ((PaintingOrDrawing.drawing Γ).inter X).deleteVertices Z := by + rw [← interSet_toHypergraph _ hX, ← deleteVertices_interSet hX, + deleteVertices_toHypergraph, interSet_toHypergraph Γ hX] + +/-- A selected old disc still selects its inside after deletion, +provided putting the deleted vertex on both sides keeps the order +below the old tangle order. This is the separation-transfer step +of XII (7.3), Claim (1), page 262. -/ +theorem selected_disc_mem_deleted_tangle + {S : Type*} [TopologicalSpace S] [T2Space S] + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph θ T) {v : S} (hv : v ∈ Γ.V) + {D : Set S} (hD : IsClosed D) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + (hord : separationOrder + ((PaintingOrDrawing.drawing Γ).inter D ∪ vertexHypergraph v) + ((PaintingOrDrawing.drawing Γ).interOutside D ∪ vertexHypergraph v) < θ) : + ((PaintingOrDrawing.drawing (deleteVertices Γ {v})).inter D, + (PaintingOrDrawing.drawing (deleteVertices Γ {v})).interOutside D) ∈ + deleteVerticesTangle Γ.toHypergraph {v} T θ := by + have hm' := delete_pair_mem_tangle_of_adjoin_order hT hm hv hord + change (((PaintingOrDrawing.drawing Γ).inter D).deleteVertices {v}, + ((PaintingOrDrawing.drawing Γ).inter (closure (univ \ D))).deleteVertices {v}) ∈ _ at hm' + rw [← drawing_inter_deleteVertices Γ {v} hD, + ← drawing_inter_deleteVertices Γ {v} isClosed_closure] at hm' + exact hm' + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73Separator.lean b/LeanPool/GraphMinor/GM12/Section73Separator.lean new file mode 100644 index 0000000000..eeb1846bd6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73Separator.lean @@ -0,0 +1,187 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Defs2 +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Putting the deleted vertex on both sides of a separation + +In XII (7.3), Claim (1), page 262, enlarge both sides of an old +separation by the single vertex being deleted, adding no edges. +The result is still a separation. Its order increases by at most +one and stays fixed if the vertex was already on both sides. +When the new order is below the tangle order, X (2.9) preserves +the selected orientation. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Hypergraph GM10 + +/-- Adding the same vertex to both sides, without edges, preserves +the separation, as in XII (7.3), Claim (1), page 262. -/ +theorem isSeparation_adjoin_vertex + {α β : Type*} {G A B : Hypergraph α β} (hsep : G.IsSeparation A B) + {v : α} (hv : v ∈ G.vertexSet) : + G.IsSeparation (A ∪ vertexHypergraph v) (B ∪ vertexHypergraph v) := by + rw [isSeparation_iff_of_le + (union_le hsep.left_le (vertexHypergraph_le hv)) + (union_le hsep.right_le (vertexHypergraph_le hv))] + refine ⟨?_, ?_, ?_⟩ + · change (A.vertexSet ∪ {v}) ∪ (B.vertexSet ∪ {v}) = G.vertexSet + calc + _ = (A.vertexSet ∪ B.vertexSet) ∪ {v} := by + ext x; simp only [mem_union, mem_singleton_iff]; tauto + _ = G.vertexSet := by rw [hsep.vertexSet_union, union_singleton, insert_eq_of_mem hv] + · simpa only [union_edgeSet, vertexHypergraph, union_empty] using hsep.edgeSet_union + · simpa only [union_edgeSet, vertexHypergraph, union_empty, inter_edgeSet] using + hsep.edgeSet_inter_eq + +/-- The enlarged separator is the old separator with the one vertex +inserted. This is the order calculation in XII (7.3), Claim (1). -/ +theorem separationOrder_adjoin_vertex + {α β : Type*} (A B : Hypergraph α β) (v : α) : + separationOrder (A ∪ vertexHypergraph v) (B ∪ vertexHypergraph v) = + (insert v (A.vertexSet ∩ B.vertexSet)).ncard := by + unfold separationOrder + congr 1 + ext x + change (x ∈ A.vertexSet ∨ x = v) ∧ (x ∈ B.vertexSet ∨ x = v) ↔ _ + simp only [mem_insert_iff, mem_inter_iff] + tauto + +/-- Adjoining the vertex increases the separation order by at most +one, the first order bound in XII (7.3), Claim (1), page 262. -/ +theorem separationOrder_adjoin_vertex_le + {α β : Type*} (A B : Hypergraph α β) (v : α) : + separationOrder (A ∪ vertexHypergraph v) (B ∪ vertexHypergraph v) ≤ + separationOrder A B + 1 := by + rw [separationOrder_adjoin_vertex] + exact ncard_insert_le _ _ + +/-- A vertex already in the separator adds nothing to its order. +This is the saving of one in XII (7.3), Claim (1), page 262. -/ +theorem separationOrder_adjoin_vertex_of_mem + {α β : Type*} {A B : Hypergraph α β} {v : α} + (hv : v ∈ A.vertexSet ∩ B.vertexSet) : + separationOrder (A ∪ vertexHypergraph v) (B ∪ vertexHypergraph v) = + separationOrder A B := by + rw [separationOrder_adjoin_vertex, insert_eq_of_mem hv] + rfl + +/-- X (2.9) selects the enlarged separation when its order is still +small. This is the orientation step of XII (7.3), Claim (1), page 262. -/ +theorem adjoin_vertex_mem_tangle + {α β : Type*} {G A B : Hypergraph α β} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} (hT : IsTangle G θ T) + (hm : (A, B) ∈ T) {v : α} (hv : v ∈ G.vertexSet) + (hord : separationOrder (A ∪ vertexHypergraph v) (B ∪ vertexHypergraph v) < θ) : + (A ∪ vertexHypergraph v, B ∪ vertexHypergraph v) ∈ T := by + exact GraphMinor.GM10.theorem_2_9_proof hT hm (isSeparation_adjoin_vertex + (hT.isSeparation hm) hv) hord + (Or.inl subset_union_left) + +/-- Deleting the adjoined vertex gives the same graph as deleting +it before adjoining. This identifies the sides in XII (7.3), +Claim (1), after passing to the deleted tangle. -/ +theorem deleteVertices_adjoin_vertex + {α β : Type*} (A : Hypergraph α β) (v : α) : + (A ∪ vertexHypergraph v).deleteVertices {v} = A.deleteVertices {v} := by + apply Hypergraph.ext + · ext x + change (x ∈ A.vertexSet ∪ {v} ∧ x ∉ ({v} : Set α)) ↔ + (x ∈ A.vertexSet ∧ x ∉ ({v} : Set α)) + simp only [mem_union, mem_singleton_iff] + tauto + · ext e + simp only [deleteVertices, union_edgeSet, vertexHypergraph, union_empty, mem_ofPred_eq, + union_inc, or_false] + · funext e x + simp only [deleteVertices, union_inc, vertexHypergraph, or_false] + +private theorem delete_mono + {α β : Type*} {G A : Hypergraph α β} (hA : A ≤ G) (Z : Set α) : + A.deleteVertices Z ≤ G.deleteVertices Z where + vertexSet_subset := sdiff_subset_sdiff hA.vertexSet_subset subset_rfl + edgeSet_subset e he := + ⟨hA.edgeSet_subset he.1, fun v hv hi => he.2 v hv ((inc_iff_of_le hA he.1).2 hi)⟩ + ends_eq e he := by + ext v + simp only [Hypergraph.ends, mem_ofPred_eq, deleteVertices] + simp_rw [inc_iff_of_le hA he.1] + +/-- Vertex deletion preserves a separation. This identifies the +separation used when passing from the enlarged sides to the new +tangle in XII (7.3), Claim (1). -/ +theorem isSeparation_deleteVertices + {α β : Type*} {G A B : Hypergraph α β} (hsep : G.IsSeparation A B) (Z : Set α) : + (G.deleteVertices Z).IsSeparation (A.deleteVertices Z) (B.deleteVertices Z) := by + rw [isSeparation_iff_of_le (delete_mono hsep.left_le Z) (delete_mono hsep.right_le Z)] + refine ⟨?_, ?_, ?_⟩ + · change (A.vertexSet \ Z) ∪ (B.vertexSet \ Z) = G.vertexSet \ Z + rw [← union_sdiff_distrib, hsep.vertexSet_union] + · ext e + constructor + · rintro (he | he) + · exact (delete_mono hsep.left_le Z).edgeSet_subset he + · exact (delete_mono hsep.right_le Z).edgeSet_subset he + · rintro ⟨he, hno⟩ + rcases hsep.edgeSet_union.symm ▸ he with heA | heB + · exact Or.inl ⟨heA, fun v hv hi => hno v hv ((inc_iff_of_le hsep.left_le heA).1 hi)⟩ + · exact Or.inr ⟨heB, fun v hv hi => hno v hv ((inc_iff_of_le hsep.right_le heB).1 hi)⟩ + · apply eq_empty_iff_forall_notMem.mpr + rintro e ⟨heA, heB⟩ + exact hsep.disjoint_edgeSet.le_bot ⟨heA.1, heB.1⟩ + +/-- Deleting the vertex decreases the enlarged separation order by +exactly one, since it occurs on both enlarged sides. -/ +theorem separationOrder_adjoin_vertex_eq_delete_add_one + {α β : Type*} (A B : Hypergraph α β) (v : α) : + separationOrder (A ∪ vertexHypergraph v) (B ∪ vertexHypergraph v) = + separationOrder (A.deleteVertices {v}) (B.deleteVertices {v}) + 1 := by + rw [separationOrder_adjoin_vertex] + have heq : insert v (A.vertexSet ∩ B.vertexSet) = + insert v ((A.vertexSet \ {v}) ∩ (B.vertexSet \ {v})) := by + ext x + simp only [mem_insert_iff, mem_inter_iff, mem_sdiff, mem_singleton_iff] + tauto + have hfin : ((A.vertexSet \ {v}) ∩ (B.vertexSet \ {v})).Finite := + A.vertexSet_finite.subset (fun _ hx => hx.1.1) + have hvnot : v ∉ (A.vertexSet \ {v}) ∩ (B.vertexSet \ {v}) := + fun hx => hx.1.2 rfl + rw [heq, ncard_insert_of_notMem hvnot hfin] + rfl + +/-- After adjoining the vertex on both sides, X (2.9) and deletion +give the selected pair in the new tangle. This proves the tangle +membership step of XII (7.3), Claim (1), page 262. -/ +theorem delete_pair_mem_tangle_of_adjoin_order + {α β : Type*} {G A B : Hypergraph α β} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} (hT : IsTangle G θ T) + (hm : (A, B) ∈ T) {v : α} (hv : v ∈ G.vertexSet) + (hord : separationOrder (A ∪ vertexHypergraph v) (B ∪ vertexHypergraph v) < θ) : + (A.deleteVertices {v}, B.deleteVertices {v}) ∈ deleteVerticesTangle G {v} T θ := by + have hm' := adjoin_vertex_mem_tangle hT hm hv hord + refine ⟨isSeparation_deleteVertices (hT.isSeparation hm) {v}, ?_, + (A ∪ vertexHypergraph v, B ∪ vertexHypergraph v), hm', ?_, + deleteVertices_adjoin_vertex A v, deleteVertices_adjoin_vertex B v⟩ + · change separationOrder (A.deleteVertices {v}) (B.deleteVertices {v}) < θ - ({v} : Set α).ncard + rw [ncard_singleton] + rw [separationOrder_adjoin_vertex_eq_delete_add_one] at hord + omega + · intro x hx + have hxv : x = v := hx + subst x + exact ⟨Or.inr rfl, Or.inr rfl⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73SharedAtoms.lean b/LeanPool/GraphMinor/GM12/Section73SharedAtoms.lean new file mode 100644 index 0000000000..88314f987b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73SharedAtoms.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section77 +public import LeanPool.GraphMinor.GM12.Section73Tangle +import LeanPool.GraphMinor.GM11.Theorem75 +import LeanPool.GraphMinor.GM11.PaintingFacts +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Shared atoms miss the merged region + +For XII (7.3)(i), page 262, an atom shared by the old and +deleted drawings misses the merged region. Otherwise it would +equal that region as a new atom. Since it contains the deleted +vertex, its old atom would then be just that vertex. An open +disc cannot be a singleton: it contains a closed disc with an +infinite boundary circle. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Atoms shared by the two drawings miss the merged region, +as used in XII (7.3)(i), page 262. Two-cellness rules out the +only possible exception, a region consisting of the deleted vertex. -/ +theorem shared_atom_disjoint_deleted_region + {S : Type*} [TopologicalSpace S] [T2Space S] {Γ : Drawing S} + {v : S} (hv : v ∈ Γ.V) + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) + {r : Set S} (hr : r ∈ (deleteVertices Γ {v}).R) (hvr : v ∈ r) + {a : Set S} (ha : a ∈ Γ.A ∩ (deleteVertices Γ {v}).A) : Disjoint a r := by + apply disjoint_left.mpr + intro x hxa hxr + have har : a = r := atom_eq_of_inter_nonempty ha.2 (Or.inr hr) ⟨x, hxa, hxr⟩ + have hva : v ∈ a := har.symm ▸ hvr + have hav : a = {v} := atom_eq_of_inter_nonempty ha.1 (Or.inl (Or.inl ⟨v, hv, rfl⟩)) + ⟨v, hva, rfl⟩ + have hrSingle : r = {v} := har.symm.trans hav + obtain ⟨D, hD, hDr, _⟩ := exists_closedDisc_of_isCompact (htwo.2 r hr) isCompact_singleton + (singleton_subset_iff.mpr hvr) + have hInfinite := infinite_of_isOArc hD.isOArc_discBd + apply hInfinite + apply (finite_singleton v).subset + exact (Surface.discBd_subset D).trans (hDr.trans hrSingle.subset) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73ShortWalkNull.lean b/LeanPool/GraphMinor/GM12/Section73ShortWalkNull.lean new file mode 100644 index 0000000000..8684991f45 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73ShortWalkNull.lean @@ -0,0 +1,117 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73WalkPathLift +public import LeanPool.GraphMinor.GM12.Section73EdgeWalkLift +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# Null-homotopy of short walks after vertex deletion + +For the representativity step of XII (7.3), page 261, lift a closed +walk of the new radial drawing to the old one. If its increased +length is below the old slope bound, the realized old path is +null-homotopic. Composing its contraction with the star-collapse map +and comparing edge paths gives a null-homotopy of the realized new +walk. The comparison uses the constructed replacement paths. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +open Classical in +/-- A new radial walk whose lifted length is below the old slope +bound is null-homotopic. This proves the old-to-new short-walk step +in the representativity argument of XII (7.3), page 261. -/ +theorem walkPath_null_of_vertex_deletion_lift + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K J : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + (f : C(S, S)) (hfix : ∀ x ∉ r', f x = x) + (hcollapse : ∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + (hJV : J.V = f '' K.V) + (hJE : J.E ⊆ (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g}) + (hJpre : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsPreRadialDrawing J) + {k : ℕ} {ins : Drawing S → Set S} (hs : IsSlope K k ins) + (q : ∀ e x y, J.toGraph.IsLink e x y → Path x y) + (hq : ∀ e x y (h : J.toGraph.IsLink e x y), range (q e x y h) ⊆ closure e) + {a : S} (W : GraphWalk J.toGraph a a) + (hshort : W.length + 2 * walkVertexCount v W < k) : + (walkPath q W).Homotopic (Path.refl a) := by + have hloopK : ∀ e x y, K.toGraph.IsLink e x y → x ≠ y := by + intro e x y hel hxy + subst y + have hb := bipartite_of_preRadial hK.2.1 e x x hel + by_cases hx : x ∈ Γ.V + · exact (hb.mp hx) hx + · exact hx (hb.mpr hx) + have hloopJ : ∀ e x y, J.toGraph.IsLink e x y → x ≠ y := by + intro e x y hel hxy + subst y + have hb := bipartite_of_preRadial hJpre e x x hel + by_cases hx : x ∈ (deleteVertices Γ {v}).V + · exact (hb.mp hx) hx + · exact hx (hb.mpr hx) + obtain ⟨p, hp⟩ := exists_edge_paths hloopK + have hp' : ∀ e x y (h : K.toGraph.IsLink e x y), range (p e x y h) ⊆ closure e := + fun e x y h => (hp e x y h).subset + have hV : J.V ⊆ K.V := by + intro x hx + rw [hJV, image_radial_vertices_eq hS hK hE hv hr' hvr' hfix hcollapse] at hx + rcases hx with hx | hxv + · exact hx.1 + · exact hxv ▸ hK.2.1.2.1 hv + have hfixV : ∀ x ∈ J.V, f x = x := by + intro x hx + rw [hJV, image_radial_vertices_eq hS hK hE hv hr' hvr' hfix hcollapse] at hx + rcases hx with hx | hxv + · exact hfix x hx.2 + · have hxv' : x = v := hxv + rw [hxv'] + exact hcollapse v (Or.inl rfl) + have hlines : ∀ e ∈ J.E, IsLine (closure e) := by + intro e he + obtain ⟨x, hx, y, hy, hcap⟩ := hJpre.2.2.2.2.1 e he + have hxy : x ≠ y := fun h => hy.2 (h ▸ hx) + obtain ⟨p, _, _⟩ := isLine_closure he hxy hcap + exact ⟨p⟩ + have hpaths : ∀ e x y, J.toGraph.IsLink e x y → + ∃ P : GraphWalk K.toGraph x y, + P.length = (if x = v ∨ y = v then 2 else 1) ∧ + f '' (walkDrawing K P).U = closure e := by + intro e x y hel + obtain ⟨P, hP, hPimage, _⟩ := exists_edge_walk_lift hS hK hE hv hr' hvr' + f hfix hcollapse hfibre hJV hJE hel + exact ⟨P, hP, hPimage⟩ + obtain ⟨W', hWlen, hWhom⟩ := exists_closed_walk_path_lift f hfixV hV hloopJ hlines + p hp' q hq hpaths W + have hshort' : W'.length < k := hWlen ▸ hshort + have hnull := walkPath_homotopic_refl_of_short_slope hS hs p hp' W' hshort' + have hfa : f a = a := hfixV a (W.mem_vertexSet_of_mem_support W.start_mem_support) + have hmapnull : (mapPathFixed f hfa hfa (walkPath p W')).Homotopic (Path.refl a) := by + have hm := (hnull.map f).pathCast hfa.symm hfa.symm + change (mapPathFixed f hfa hfa (walkPath p W')).Homotopic + (mapPathFixed f hfa hfa (Path.refl a)) at hm + have heq : mapPathFixed f hfa hfa (Path.refl a) = Path.refl a := by + ext t + exact hfa + rw [heq] at hm + exact hm + exact hWhom.symm.trans hmapnull + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73SpliceFibre.lean b/LeanPool/GraphMinor/GM12/Section73SpliceFibre.lean new file mode 100644 index 0000000000..04e62a218d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73SpliceFibre.lean @@ -0,0 +1,115 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73SplicedCircuit + +/-! +# The part of the spliced circuit in the collapsed star + +For XII (7.3), Claim (1), page 262, the retained path misses +the star. Each surviving spoke meets it only at its old hub. +When the hubs agree, the old circuit therefore meets the star +only at that hub. When they differ, its intersection is exactly +the union of the two star spokes used by the splice. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +open Classical in +/-- Compute the collapsed part of a spliced circuit from its +vertex and edge sets. This gives the two fibre alternatives in +XII (7.3), Claim (1), page 262. -/ +theorem spliced_circuit_inter_collapse_set + {S : Type*} [TopologicalSpace S] [T2Space S] {K C : Drawing S} + {x y v p q : S} {a b c d : Set S} {A : Set S} + (ha : K.toGraph.IsLink a v p) (hd : K.toGraph.IsLink d q v) + (P : GraphWalk K.toGraph x y) + (hCV : C.V = ({z | z ∈ P.support} ∪ {p, q}) ∪ (if p = q then ∅ else {v})) + (hCE : C.E = if p = q then insert b (insert c {e | e ∈ P.edges}) + else insert a (insert b (insert c (insert d {e | e ∈ P.edges})))) + (hPA : Disjoint (walkDrawing K P).U A) + (haA : closure a ⊆ A) (hdA : closure d ⊆ A) + (hbA : closure b ∩ A ⊆ {p}) (hcA : closure c ∩ A ⊆ {q}) : + C.U ∩ A = if p = q then {p} else closure a ∪ closure d := by + classical + have hpcl : p ∈ closure a := (ha.2.2.2.superset (Or.inr rfl)).1 + have hqcl : q ∈ closure d := (hd.2.2.2.superset (Or.inl rfl)).1 + have hvcl : v ∈ closure a := (ha.2.2.2.superset (Or.inl rfl)).1 + have hPV : ∀ z ∈ P.support, z ∉ A := by + intro z hz + have hzV : z ∈ (walkDrawing K P).V := by rw [walkDrawing_V]; exact hz + exact disjoint_left.mp hPA ((walkDrawing K P).V_subset_U hzV) + have hPE : ∀ e ∈ P.edges, Disjoint (closure e) A := by + intro e he + have heP : e ∈ (walkDrawing K P).E := by rw [walkDrawing_E]; exact he + exact hPA.mono_left ((walkDrawing K P).closure_subset_U heP) + by_cases hpq : p = q + · subst q + rw [ite_eq_left rfl] + have hCV' : C.V = {z | z ∈ P.support} ∪ {p} := by rw [hCV]; simp + have hCE' : C.E = insert b (insert c {e | e ∈ P.edges}) := by + rw [hCE, ite_eq_left rfl] + apply Subset.antisymm + · rintro z ⟨hzC, hzA⟩ + rw [C.U_eq] at hzC + rcases hzC with hzV | hzE + · rw [hCV'] at hzV + exact hzV.resolve_left (fun hzP => hPV z hzP hzA) + · obtain ⟨e, he, hze⟩ := mem_iUnion₂.mp hzE + rw [hCE'] at he + rcases he with heq | heq | he + · subst e + exact hbA ⟨hze, hzA⟩ + · subst e + exact hcA ⟨hze, hzA⟩ + · exact (disjoint_left.mp (hPE e he) hze hzA).elim + · rintro z rfl + exact ⟨C.V_subset_U (hCV'.symm ▸ Or.inr rfl), haA hpcl⟩ + · rw [ite_eq_right hpq] + have hCV' : C.V = ({z | z ∈ P.support} ∪ {p, q}) ∪ {v} := by + rw [hCV, ite_eq_right hpq] + have hCE' : C.E = insert a (insert b (insert c (insert d {e | e ∈ P.edges}))) := by + rw [hCE, ite_eq_right hpq] + apply Subset.antisymm + · rintro z ⟨hzC, hzA⟩ + rw [C.U_eq] at hzC + rcases hzC with hzV | hzE + · rw [hCV'] at hzV + rcases hzV with (hzP | hzp | hzq) | hzv + · exact (hPV z hzP hzA).elim + · exact Or.inl (hzp.symm ▸ hpcl) + · exact Or.inr (hzq.symm ▸ hqcl) + · exact Or.inl (hzv.symm ▸ hvcl) + · obtain ⟨e, he, hze⟩ := mem_iUnion₂.mp hzE + rw [hCE'] at he + rcases he with heq | heq | heq | heq | he + · subst e + exact Or.inl hze + · subst e + have hzp : z = p := hbA ⟨hze, hzA⟩ + exact Or.inl (hzp.symm ▸ hpcl) + · subst e + have hzq : z = q := hcA ⟨hze, hzA⟩ + exact Or.inr (hzq.symm ▸ hqcl) + · subst e + exact Or.inr hze + · exact (disjoint_left.mp (hPE e he) hze hzA).elim + · intro z hz + rcases hz with hz | hz + · have haC : a ∈ C.E := hCE'.symm ▸ Or.inl rfl + exact ⟨C.closure_subset_U haC hz, haA hz⟩ + · have hdC : d ∈ C.E := hCE'.symm ▸ Or.inr (Or.inr (Or.inr (Or.inl rfl))) + exact ⟨C.closure_subset_U hdC hz, hdA hz⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73SplicedCircuit.lean b/LeanPool/GraphMinor/GM12/Section73SplicedCircuit.lean new file mode 100644 index 0000000000..33ee933bfd --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73SplicedCircuit.lean @@ -0,0 +1,141 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73CircuitSplice +import LeanPool.GraphMinor.GM11.EvenCircuit +import LeanPool.GraphMinor.GM11.CircuitRegions + +/-! +# The circuit obtained by splicing the retained path + +For XII (7.3), Claim (1), page 262, close the retained simple +path through the old region hubs. If the hubs agree, two old +spokes suffice. Otherwise four old spokes close it through the +deleted vertex. Record the exact vertices, edges, and length of +the resulting old circuit. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 + +private theorem walkDrawing_length_of_nodup + {S : Type*} [TopologicalSpace S] [T1Space S] (K : Drawing S) + {x y : S} (W : GraphWalk K.toGraph x y) (hW : W.edges.Nodup) : + (walkDrawing K W).length = W.length := by + classical + rw [Drawing.length, walkDrawing_E] + have hset : {e | e ∈ W.edges} = (W.edges.toFinset : Set (Set S)) := by ext e; simp + rw [hset, ncard_coe_finset, List.toFinset_card_of_nodup hW] + rfl + +/-- The old circuit in XII (7.3), Claim (1), page 262, formed +from a retained path and two or four spokes. Its length increases +by two precisely when the old middle vertices differ. -/ +theorem exists_spliced_circuit + {S : Type*} [TopologicalSpace S] [T1Space S] {K : Drawing S} + {x y v p q : S} {a b c d : Set S} + (ha : K.toGraph.IsLink a v p) (hb : K.toGraph.IsLink b p x) + (hc : K.toGraph.IsLink c y q) (hd : K.toGraph.IsLink d q v) + (P : GraphWalk K.toGraph x y) (hP : P.IsSimple) + (hp : p ∉ P.support) (hq : q ∉ P.support) (hv : v ∉ P.support) + (hpv : p ≠ v) (hqv : q ≠ v) (hbc : b ≠ c) : + open scoped Classical in + ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing K ∧ + C.length = P.length + (if p = q then 2 else 4) ∧ + C.V = ({z | z ∈ P.support} ∪ {p, q}) ∪ (if p = q then ∅ else {v}) ∧ + C.E = if p = q then insert b (insert c {e | e ∈ P.edges}) + else insert a (insert b (insert c (insert d {e | e ∈ P.edges}))) := by + classical + by_cases hpq : p = q + · subst q + let W : GraphWalk K.toGraph p p := .cons hb (P.append (.cons hc (.nil hc.right_mem))) + have hsc := isSimpleClosed_close_path hb hc P hP hp hbc + have hlen : W.length = P.length + 2 := by + dsimp only [W] + rw [GraphWalk.length_cons, GraphWalk.length_append] + simp only [GraphWalk.length_cons, GraphWalk.length_nil] + refine ⟨walkDrawing K W, isCircuit_walkDrawing K hsc (by rw [hlen]; omega), + walkDrawing_isSubdrawing K W, ?_, ?_, ?_⟩ + · rw [walkDrawing_length_of_nodup K W hsc.2, hlen, ite_eq_left (rfl : p = p)] + · rw [walkDrawing_V] + dsimp only [W] + rw [GraphWalk.support_cons, GraphWalk.support_append] + ext z + simp only [GraphWalk.support_cons, GraphWalk.support_nil, List.tail_cons, + List.mem_cons, List.mem_append, mem_ofPred_eq, mem_union, mem_insert_iff, + mem_singleton_iff] + tauto + · rw [walkDrawing_E, ite_eq_left rfl] + dsimp only [W] + rw [GraphWalk.edges_cons, GraphWalk.edges_append] + ext e + simp only [GraphWalk.edges_cons, GraphWalk.edges_nil, List.mem_cons, List.mem_append, + mem_ofPred_eq, mem_insert_iff, List.not_mem_nil, or_false] + tauto + · obtain ⟨W, hsc, hlen, hE, hV⟩ := exists_simpleClosed_four_edge_splice ha hb hc hd P hP + hp hq hv hpq hpv hqv + refine ⟨walkDrawing K W, isCircuit_walkDrawing K hsc (by rw [hlen]; omega), + walkDrawing_isSubdrawing K W, ?_, ?_, ?_⟩ + · rw [walkDrawing_length_of_nodup K W hsc.2, hlen, ite_eq_right hpq] + · rw [walkDrawing_V, hV] + ext z + simp only [List.mem_cons, List.mem_append, List.not_mem_nil, or_false, + mem_ofPred_eq, mem_union, mem_insert_iff, mem_singleton_iff, ite_eq_right hpq] + tauto + · rw [walkDrawing_E, hE, ite_eq_right hpq] + ext e + simp only [List.mem_cons, List.mem_append, List.not_mem_nil, or_false, + mem_ofPred_eq, mem_insert_iff] + tauto + +/-- The spliced circuit lies in any old subdrawing containing the +retained path and its replacement spokes. This is the containment +in the lifted walk used in XII (7.3), Claim (1), page 262. -/ +theorem exists_spliced_circuit_in_subdrawing + {S : Type*} [TopologicalSpace S] [T2Space S] {K N : Drawing S} + (hNK : N.IsSubdrawing K) + {x y v p q : S} {a b c d : Set S} + (ha : K.toGraph.IsLink a v p) (hb : K.toGraph.IsLink b p x) + (hc : K.toGraph.IsLink c y q) (hd : K.toGraph.IsLink d q v) + (P : GraphWalk K.toGraph x y) (hP : P.IsSimple) + (hp : p ∉ P.support) (hq : q ∉ P.support) (hv : v ∉ P.support) + (hpv : p ≠ v) (hqv : q ≠ v) (hbc : b ≠ c) + (haN : a ∈ N.E) (hbN : b ∈ N.E) (hcN : c ∈ N.E) (hdN : d ∈ N.E) + (hPN : ∀ e ∈ P.edges, e ∈ N.E) : + open scoped Classical in + ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing N ∧ + C.length = P.length + (if p = q then 2 else 4) ∧ + C.V = ({z | z ∈ P.support} ∪ {p, q}) ∪ (if p = q then ∅ else {v}) ∧ + C.E = if p = q then insert b (insert c {e | e ∈ P.edges}) + else insert a (insert b (insert c (insert d {e | e ∈ P.edges}))) := by + classical + obtain ⟨C, hC, hCK, hlen, hV, hE⟩ := exists_spliced_circuit ha hb hc hd P hP + hp hq hv hpv hqv hbc + refine ⟨C, hC, circuit_isSubdrawing_of_E hC hCK hNK ?_, hlen, hV, hE⟩ + intro e he + rw [hE] at he + by_cases hpq : p = q + · rw [ite_eq_left hpq] at he + rcases he with rfl | rfl | he + · exact hbN + · exact hcN + · exact hPN e he + · rw [ite_eq_right hpq] at he + rcases he with rfl | rfl | rfl | rfl | he + · exact haN + · exact hbN + · exact hcN + · exact hdN + · exact hPN e he + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73SplicedSeparation.lean b/LeanPool/GraphMinor/GM12/Section73SplicedSeparation.lean new file mode 100644 index 0000000000..d18b14e74a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73SplicedSeparation.lean @@ -0,0 +1,73 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73CommonCircuitInside +import LeanPool.GraphMinor.GM11.Section7 +import LeanPool.GraphMinor.GM11.Theorem61 + +/-! +# The order bound for the spliced circuit separation + +In XII (7.3), Claim (1), page 262, the old circuit has either +the new circuit's length or two more edges. In the latter case +the deleted vertex lies on the old circuit. It is already in +both sides of the old disc separation, so adjoining it does not +raise the order. In both cases X (2.9) therefore selects the +disc separation in the deleted tangle. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 Hypergraph + +/-- The selected inside of the spliced old circuit gives a selected +disc separation in the deleted tangle. This proves the order and +orientation calculation for the hub case of XII (7.3), Claim (1), +page 262. The parameter `n` is the new circuit's length. -/ +theorem spliced_circuit_disc_mem_deleted_tangle + {S : Type*} [TopologicalSpace S] [T2Space S] + {Γ K C : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph θ T) {v : S} (hv : v ∈ Γ.V) + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + {ins : Drawing S → Set S} + (hins : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + (hC : C.IsCircuit) (hCK : C.IsSubdrawing K) + {n ε : ℕ} (hε : ε ≤ 1) (hlen : C.length ≤ n + 2 * ε) + (hvC : ε = 1 → v ∈ C.V) (hshort : n + 2 < 2 * θ) : + ((PaintingOrDrawing.drawing (deleteVertices Γ {v})).inter (ins C), + (PaintingOrDrawing.drawing (deleteVertices Γ {v})).interOutside (ins C)) ∈ + deleteVerticesTangle Γ.toHypergraph {v} T θ := by + have hClen : C.length < 2 * θ := by omega + obtain ⟨hD, hbd, hm⟩ := hins C hC hCK hClen + have hsepBound := two_mul_disc_separationOrder_le_circuit_length hK hC hCK hbd + apply selected_disc_mem_deleted_tangle hT hv hD.isClosed hm + by_cases hεzero : ε = 0 + · have haugBound := separationOrder_adjoin_vertex_le + ((PaintingOrDrawing.drawing Γ).inter (ins C)) + ((PaintingOrDrawing.drawing Γ).interOutside (ins C)) v + omega + · have hεone : ε = 1 := by omega + have hvfr : v ∈ frontier (ins C) := by + rw [← subBd_eq_frontier, hbd] + exact C.V_subset_U (hvC hεone) + have hvD : v ∈ ins C := hD.isClosed.frontier_subset hvfr + have hvout : v ∈ closure (univ \ ins C) := by + rw [frontier_eq_closure_inter_closure] at hvfr + simpa only [compl_eq_univ_sdiff] using hvfr.2 + have hvSep : v ∈ ((PaintingOrDrawing.drawing Γ).inter (ins C)).vertexSet ∩ + ((PaintingOrDrawing.drawing Γ).interOutside (ins C)).vertexSet := + ⟨⟨hv, hvD⟩, hv, hvout⟩ + rw [separationOrder_adjoin_vertex_of_mem hvSep] + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73SpokeImages.lean b/LeanPool/GraphMinor/GM12/Section73SpokeImages.lean new file mode 100644 index 0000000000..bd203c990e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73SpokeImages.lean @@ -0,0 +1,101 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73MergedHub +public import LeanPool.GraphMinor.GM12.Section73ImageIncidence +import LeanPool.GraphMinor.GM11.Section4c +import LeanPool.GraphMinor.GM11.RadialRegions + +/-! +# Vertices and spokes under the radial-star collapse + +For the lifted walks in XII (7.3), page 261, the new radial vertices +are the old vertices outside the merged region together with its new +hub at the deleted vertex. Every old hub inside the merged region +has a spoke to that vertex. Spokes whose hubs lie outside it stay +pointwise fixed. These facts identify the old paths corresponding +to the new spokes. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The new radial vertices are precisely the retained old vertices +and the new hub at the deleted vertex. This identifies the walk +vertices in XII (7.3), page 261. -/ +theorem image_radial_vertices_eq + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + {f : S → S} (hfix : ∀ x ∉ r', f x = x) + (hcollapse : ∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) : + f '' K.V = (K.V \ r') ∪ {v} := by + apply Subset.antisymm + · rintro y ⟨x, hxK, hxy⟩ + by_cases hxr : x ∈ r' + · exact Or.inr (hxy.symm.trans (hcollapse x + (radial_vertices_in_deleted_region hS hK hE hv hr' hvr' ⟨hxK, hxr⟩))) + · have hxy' : x = y := (hfix x hxr).symm.trans hxy + exact Or.inl (hxy' ▸ ⟨hxK, hxr⟩) + · rintro y (hy | hyv) + · exact ⟨y, hy.1, hfix y hy.2⟩ + · have hyv' : y = v := hyv + rw [hyv'] + exact ⟨v, hK.2.1.2.1 hv, hcollapse v (Or.inl rfl)⟩ + +/-- Every old hub in the merged region has a spoke to the deleted +vertex. This supplies the first edge of the two-edge paths in XII +(7.3), page 261. -/ +theorem exists_spoke_to_hub_in_deleted_region + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + {u : S} (huK : u ∈ K.V) (hun : u ∉ Γ.V) (hur' : u ∈ r') : + ∃ e ∈ K.E, K.toGraph.IsLink e v u := by + obtain ⟨r, hr, hur⟩ := hK.2.1.2.2.2.1 u ⟨huK, hun⟩ + have hvcl := deleted_vertex_mem_closure_of_region_meeting hS hv hr hr' hvr' ⟨u, hur, hur'⟩ + obtain ⟨e, he, hcap⟩ := exists_spoke_at ⟨hK.1, hK.2.1⟩ hK.2.2 hS hE hr hur huK hv hvcl + exact ⟨e, he, he, hK.2.1.2.1 hv, huK, hcap⟩ + +/-- A spoke whose old hub is outside the merged region stays +outside that region. This is the unchanged-edge case of the walk +replacement in XII (7.3), page 261. -/ +theorem spoke_closure_disjoint_deleted_region + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : PreRad (PaintingOrDrawing.drawing Γ) K) + {v : S} {r' : Set S} (hr' : r' ∈ (deleteVertices Γ {v}).R) + {g r : Set S} {w u : S} (hg : g ∈ K.E) (hvg : v ∉ closure g) + (hw : w ∈ Γ.V) (hr : r ∈ Γ.R) (hur : u ∈ r) + (hcap : closure g ∩ K.V = {w, u}) (hun : u ∉ r') : + Disjoint (closure g) r' := by + have hdelete := deleteVertices_isSubdrawing Γ {v} + obtain ⟨t, ht, hrt⟩ := exists_region_superset hdelete hr + have htr : t ≠ r' := fun h => hun (h ▸ hrt hur) + have hrdis : Disjoint r r' := disjoint_left.mpr fun x hxr hxr' => + htr (region_eq_of_mem ht hr' (hrt hxr) hxr') + have hwV : w ∈ (deleteVertices Γ {v}).V := by + rw [deleteVertices_V] + exact ⟨hw, fun hwv => hvg (hwv ▸ (hcap.superset (Or.inl rfl)).1)⟩ + have hwn : w ∉ r' := fun hwr' => region_subset hr' hwr' ((deleteVertices Γ {v}).V_subset_U hwV) + apply disjoint_left.mpr + intro x hxg hxr' + rcases closure_spoke_subset_region_vertex hS hK.1 hK.2 hg hr hur hcap hxg with hxr | hxw + · exact disjoint_left.mp hrdis hxr hxr' + · exact hwn (hxw ▸ hxr') + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73StarCollapse.lean b/LeanPool/GraphMinor/GM12/Section73StarCollapse.lean new file mode 100644 index 0000000000..36c9b535aa --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73StarCollapse.lean @@ -0,0 +1,134 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73ArcCollapse +public import LeanPool.GraphMinor.GM12.Section73CollapseComposition +public import LeanPool.GraphMinor.Surface.Defs + +/-! +# Collapsing a finite star of arcs + +The radial-star contraction in XII (7.3), page 261, collapses finitely +many lines whose only common point is the centre. Collapse the lines +one at a time. Earlier collapses remain injective on the next line, +so its image is still an arc. The exact fibre calculation shows that +the composite identifies precisely the whole star. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Contract a finite star of lines to its centre while fixing a +closed set disjoint from the star. This supplies the topological +contraction used in XII (7.3), page 261. -/ +theorem exists_star_collapse + {S ι : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {E : Set ι} (hE : E.Finite) + (L : ι → Set S) (v : S) + (hlines : ∀ i ∈ E, ∃ u, IsLineWithEnds (L i) v u) + (hmeet : ∀ i ∈ E, ∀ j ∈ E, i ≠ j → L i ∩ L j ⊆ {v}) + {F : Set S} (hF : IsClosed F) + (havoid : Disjoint ({v} ∪ ⋃ i ∈ E, L i) F) : + ∃ f : C(S, S), Function.Surjective f ∧ (∀ x ∈ F, f x = x) ∧ + (∀ x ∈ {v} ∪ ⋃ i ∈ E, L i, f x = v) ∧ + (∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ i ∈ E, L i) ∧ (y ∈ {v} ∪ ⋃ i ∈ E, L i)) := by + classical + revert hlines hmeet havoid + induction E, hE using Set.Finite.induction_on with + | empty => + intro _ _ _ + refine ⟨ContinuousMap.id S, Function.surjective_id, fun _ _ => rfl, ?_, ?_⟩ + · simp + · intro x y + simp only [ContinuousMap.id_apply, iUnion_false, mem_empty_iff_false, + iUnion_empty, union_empty, mem_singleton_iff] + exact ⟨Or.inl, fun h => h.elim id (fun h => h.1.trans h.2.symm)⟩ + | @insert i E hi hE ih => + intro hlines hmeet havoid + let A : Set S := {v} ∪ ⋃ j ∈ E, L j + have hA_sub : A ⊆ {v} ∪ ⋃ j ∈ insert i E, L j := by + intro x hx + rcases hx with hx | hx + · exact Or.inl hx + · obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.mp hx + exact Or.inr (mem_iUnion₂.mpr ⟨j, Or.inr hj, hxj⟩) + have hLi_sub : L i ⊆ {v} ∪ ⋃ j ∈ insert i E, L j := fun _ hx => + Or.inr (mem_iUnion₂.mpr ⟨i, Or.inl rfl, hx⟩) + obtain ⟨f, hfs, hfix, hconst, hfibre⟩ := ih + (fun j hj => hlines j (Or.inr hj)) + (fun j hj k hk hjk => hmeet j (Or.inr hj) k (Or.inr hk) hjk) + (havoid.mono_left hA_sub) + have hvA : v ∈ A := Or.inl rfl + have hfv : f v = v := hconst v hvA + have hcap : A ∩ L i ⊆ {v} := by + rintro x ⟨hx, hxi⟩ + rcases hx with hx | hx + · exact hx + · obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.mp hx + exact hmeet j (Or.inr hj) i (Or.inl rfl) (fun h => hi (h ▸ hj)) ⟨hxj, hxi⟩ + have hinj : InjOn f (L i) := by + intro x hx y hy heq + rcases (hfibre x y).mp heq with hxy | hAxy + · exact hxy + · exact (hcap ⟨hAxy.1, hx⟩).trans (hcap ⟨hAxy.2, hy⟩).symm + obtain ⟨u, p, hp0, hp1⟩ := hlines i (Or.inl rfl) + let a : unitInterval → S := fun t => f (p t).val + have ha : IsArcMap a := ⟨f.continuous.comp (continuous_subtype_val.comp p.continuous), + fun _ _ h => p.injective (Subtype.ext (hinj (p _).property (p _).property h))⟩ + have hrange : range a = f '' L i := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact ⟨(p t).val, (p t).property, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + exact ⟨p.symm ⟨z, hz⟩, congrArg f (congrArg Subtype.val (p.apply_symm_apply ⟨z, hz⟩))⟩ + have himageavoid : Disjoint (range a) F := by + rw [hrange] + apply disjoint_left.mpr + rintro y ⟨x, hx, hxy⟩ hyF + have heq : f x = f y := hxy.trans (hfix y hyF).symm + rcases (hfibre x y).mp heq with hxy' | hAxy + · exact disjoint_left.mp havoid (hLi_sub (hxy' ▸ hx)) hyF + · exact disjoint_left.mp havoid (hA_sub hAxy.2) hyF + obtain ⟨g, hgs, hgfix, hgconst, hgfibre⟩ := exists_arc_collapse hS ha hF himageavoid + have ha0 : a 0 = v := (congrArg f hp0).trans hfv + have hvLi : v ∈ L i := hp0 ▸ (p 0).property + have hvimage : v ∈ f '' L i := ⟨v, hvLi, hfv⟩ + have hgfibre' : ∀ x y, g x = g y ↔ x = y ∨ (x ∈ f '' L i ∧ y ∈ f '' L i) := by + simpa only [hrange] using hgfibre + obtain ⟨hcompconst, hcompfibre⟩ := collapse_image_composition_fibres hfibre hgfibre' hconst + hvimage + have hgv : g v = v := (hgconst v (hrange.symm ▸ hvimage)).trans ha0 + have hUnion : ({v} ∪ ⋃ j ∈ insert i E, L j) = A ∪ L i := by + ext x + simp only [A, mem_union, mem_singleton_iff, mem_iUnion, mem_insert_iff] + constructor + · rintro (hx | ⟨j, hj, hxj⟩) + · exact Or.inl (Or.inl hx) + · rcases hj with rfl | hj + · exact Or.inr hxj + · exact Or.inl (Or.inr ⟨j, hj, hxj⟩) + · rintro ((hx | ⟨j, hj, hxj⟩) | hx) + · exact Or.inl hx + · exact Or.inr ⟨j, Or.inr hj, hxj⟩ + · exact Or.inr ⟨i, Or.inl rfl, hx⟩ + refine ⟨g.comp f, hgs.comp hfs, ?_, ?_, ?_⟩ + · intro x hx + change g (f x) = x + rw [hfix x hx, hgfix x hx] + · intro x hx + exact (hcompconst x (hUnion ▸ hx)).trans hgv + · simpa only [hUnion, ContinuousMap.comp_apply] using hcompfibre + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73StarDrawing.lean b/LeanPool/GraphMinor/GM12/Section73StarDrawing.lean new file mode 100644 index 0000000000..3ddf06d165 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73StarDrawing.lean @@ -0,0 +1,136 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73ImageArc +public import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM12.Section4FiniteLineDrawing +import LeanPool.GraphMinor.GM11.RadialCorners +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# The drawing obtained by contracting a star + +For the radial-star contraction in XII (7.3), page 261, every +surviving edge closure meets the collapsed star in at most one +vertex. Its image is therefore still a line. Assemble these lines +into the image drawing and identify its point, vertex, and edge sets. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Construct the image drawing of a collapsed set when surviving +edge closures meet that set in at most one vertex. This realizes the +radial-star contraction in XII (7.3), page 261. -/ +theorem exists_drawing_of_star_collapse + {S : Type*} [TopologicalSpace S] [T2Space S] {K : Drawing S} + {A : Set S} {C : Set (Set S)} {v : S} (hv : v ∈ K.V) (hvA : v ∈ A) + (hremove : ∀ e ∈ C, closure e ⊆ A) + (hlines : ∀ g ∈ K.E \ C, ∃ u w : S, IsLineWithEnds (closure g) u w ∧ + closure g ∩ K.V = {u, w}) + (hmeet : ∀ g ∈ K.E \ C, (closure g ∩ A).Subsingleton) + (hvertex : ∀ g ∈ K.E \ C, closure g ∩ A ⊆ K.V) + (f : C(S, S)) (hcollapse : ∀ x ∈ A, f x = v) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ (x ∈ A ∧ y ∈ A)) : + ∃ H : Drawing S, H.U = f '' K.U ∧ H.V = f '' K.V ∧ + H.E = (fun g => f '' g) '' (K.E \ C) := by + classical + let ι := {g : K.E // g.val ∉ C} + let : Finite K.E := K.finite_edges.to_subtype + have hdata : ∀ i : ι, ∃ u w : S, IsLineWithEnds (closure i.1.1) u w ∧ + closure i.1.1 ∩ K.V = {u, w} := fun i => hlines i.1.1 ⟨i.1.2, i.2⟩ + choose u w hline hcap using hdata + let L : ι → Set S := fun i => f '' closure i.1.1 + have hinj : ∀ i : ι, InjOn f (closure i.1.1) := by + intro i x hx y hy heq + rcases (hfibre x y).mp heq with hxy | hLxy + · exact hxy + · exact hmeet i.1.1 ⟨i.1.2, i.2⟩ ⟨hx, hLxy.1⟩ ⟨hy, hLxy.2⟩ + have hnewline : ∀ i : ι, IsLineWithEnds (L i) (f (u i)) (f (w i)) := fun i => + lineWithEnds_image_of_injOn (hline i) f.continuous.continuousOn (hinj i) + have hends : ∀ i : ι, L i ∩ (f '' K.V) = {f (u i), f (w i)} := by + intro i + apply Subset.antisymm + · rintro y ⟨⟨z, hzg, hzy⟩, ⟨a, haV, hay⟩⟩ + have hzV : z ∈ K.V := by + rcases (hfibre z a).mp (hzy.trans hay.symm) with hza | hzL + · exact hza ▸ haV + · exact hvertex i.1.1 ⟨i.1.2, i.2⟩ ⟨hzg, hzL.1⟩ + rcases (hcap i).subset ⟨hzg, hzV⟩ with hzu | hzw + · exact Or.inl (hzy.symm.trans (congrArg f hzu)) + · exact Or.inr (hzy.symm.trans (congrArg f hzw)) + · rintro y (rfl | rfl) + · have hu := (hcap i).superset (Or.inl rfl) + exact ⟨⟨u i, hu.1, rfl⟩, ⟨u i, hu.2, rfl⟩⟩ + · have hw := (hcap i).superset (Or.inr rfl) + exact ⟨⟨w i, hw.1, rfl⟩, ⟨w i, hw.2, rfl⟩⟩ + have hnewmeet : ∀ i j : ι, i ≠ j → L i ∩ L j ⊆ f '' K.V := by + intro i j hij y hy + obtain ⟨z, hzi, hzy⟩ := hy.1 + obtain ⟨a, haj, hay⟩ := hy.2 + have hgedge : i.1.1 ≠ j.1.1 := fun h => hij (Subtype.ext (Subtype.ext h)) + rcases (hfibre z a).mp (hzy.trans hay.symm) with hza | hzL + · exact ⟨z, closure_inter_subset_V i.1.2 j.1.2 hgedge ⟨hzi, hza ▸ haj⟩, hzy⟩ + · have hyv : y = v := hzy.symm.trans (hcollapse z hzL.1) + exact ⟨v, hv, (hcollapse v hvA).trans hyv.symm⟩ + obtain ⟨H, hHU, hHV, hHE⟩ := exists_drawing_of_finite_lines + (K.finite_V.image f) (Set.finite_univ : (univ : Set ι).Finite) + L (fun i => f (u i)) (fun i => f (w i)) + (fun i _ => hnewline i) (fun i _ => lineWithEnds_ends_ne (hnewline i)) + (fun i _ => hends i) (fun i _ j _ hij => hnewmeet i j hij) + have hinterior : ∀ i : ι, L i \ {f (u i), f (w i)} = f '' i.1.1 := by + intro i + apply Subset.antisymm + · rintro y ⟨⟨z, hz, hzy⟩, hyn⟩ + have hzV : z ∉ K.V := by + intro hzV + rcases (hcap i).subset ⟨hz, hzV⟩ with hzu | hzw + · exact hyn (Or.inl (hzy.symm.trans (congrArg f hzu))) + · exact hyn (Or.inr (hzy.symm.trans (congrArg f hzw))) + exact ⟨z, (K.closure_diff_V i.1.2).subset ⟨hz, hzV⟩, hzy⟩ + · rintro y ⟨z, hz, rfl⟩ + refine ⟨⟨z, subset_closure hz, rfl⟩, ?_⟩ + rintro (hequ | heqw) + · have hzu : z = u i := hinj i (subset_closure hz) + ((hcap i).superset (Or.inl rfl)).1 hequ + exact (i.1.2.2.1 hz).2 (hzu ▸ ((hcap i).superset (Or.inl rfl)).2) + · have hzw : z = w i := hinj i (subset_closure hz) + ((hcap i).superset (Or.inr rfl)).1 heqw + exact (i.1.2.2.1 hz).2 (hzw ▸ ((hcap i).superset (Or.inr rfl)).2) + refine ⟨H, ?_, hHV, ?_⟩ + · rw [hHU] + apply Subset.antisymm + · rintro y (hyV | hyL) + · obtain ⟨z, hz, rfl⟩ := hyV + exact ⟨z, K.V_subset_U hz, rfl⟩ + · obtain ⟨i, _, z, hz, rfl⟩ := mem_iUnion₂.mp hyL + exact ⟨z, K.closure_subset_U i.1.2 hz, rfl⟩ + · rintro y ⟨z, hzK, rfl⟩ + rw [K.U_eq] at hzK + rcases hzK with hzV | hzE + · exact Or.inl ⟨z, hzV, rfl⟩ + · obtain ⟨g, hg, hzg⟩ := mem_iUnion₂.mp hzE + by_cases hge : g ∈ C + · have hzf : f z = v := hcollapse z (hremove g hge hzg) + exact Or.inl ⟨v, hv, (hcollapse v hvA).trans hzf.symm⟩ + · let i : ι := ⟨⟨g, hg⟩, hge⟩ + exact Or.inr (mem_iUnion₂.mpr ⟨i, mem_univ _, z, hzg, rfl⟩) + · rw [hHE] + apply Subset.antisymm + · rintro g ⟨i, _, rfl⟩ + exact ⟨i.1.1, ⟨i.1.2, i.2⟩, (hinterior i).symm⟩ + · rintro g ⟨a, ha, rfl⟩ + let i : ι := ⟨⟨a, ha.1⟩, ha.2⟩ + exact ⟨i, mem_univ _, hinterior i⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73StripCollapse.lean b/LeanPool/GraphMinor/GM12/Section73StripCollapse.lean new file mode 100644 index 0000000000..f893253a4d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73StripCollapse.lean @@ -0,0 +1,140 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73CollapseRectangle +import Mathlib.Analysis.Complex.ReImTopology + +/-! +# Collapsing an axis interval in a surface strip + +Paste the rectangle collapse into a strip chart and leave all other +points fixed. The map is continuous and onto. Its only non-singleton +fibre is the drawn axis interval, which maps to its first endpoint. +This is the local topological contraction used for radial edges in +XII (7.3), page 261. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface Complex + +/-- A strip chart supports a continuous surjection contracting one +axis interval to its first endpoint and identifying no other points. +This is the local edge contraction for XII (7.3), page 261. -/ +theorem exists_strip_interval_collapse + {T : Type} [TopologicalSpace T] [T2Space T] {O : Set ℂ} {K : ℂ → T} + (hK : StripChart O K) {l r ε : ℝ} (hlr : l < r) (hε : 0 < ε) + (hRO : collapseRectangle l r ε ⊆ O) : + ∃ f : C(T, T), Function.Surjective f ∧ + (∀ x ∉ K '' collapseRectangle l r ε, f x = x) ∧ + (∀ x ∈ K '' (Complex.ofReal '' Icc l r), f x = K (l : ℂ)) ∧ + (∀ t : ℝ, (t : ℂ) ∈ O → t ≤ l → f (K (t : ℂ)) = K (t : ℂ)) ∧ + (∀ x y, f x = f y ↔ x = y ∨ + (x ∈ K '' (Complex.ofReal '' Icc l r) ∧ y ∈ K '' (Complex.ofReal '' Icc l r))) := by + let R := collapseRectangle l r ε + let A := Complex.ofReal '' Icc l r + have hRc : IsCompact R := isCompact_Icc.reProdIm isCompact_Icc + have hΦR : MapsTo (collapseStrip l r ε) R R := collapseStrip_mapsTo hlr.le hε + let Φ : Unit × ℂ → ℂ := fun p => collapseStrip l r ε p.2 + have hΦc : Continuous Φ := (continuous_collapseStrip l r ε).comp continuous_snd + obtain ⟨c, hcc, hc1, hc2⟩ := exists_glue hK hRc hRO Φ hΦc.continuousOn + (fun _ z hz => hΦR hz) (fun _ z hz => collapseStrip_frontier hlr.le hε hz) + let f : C(T, T) := ⟨fun x => c ((), x), hcc.comp (by fun_prop)⟩ + have hAR : A ⊆ R := by + rintro z ⟨t, ht, rfl⟩ + refine ⟨?_, ?_⟩ + · change 2 * l - r ≤ t ∧ t ≤ 2 * r - l + constructor <;> linarith [ht.1, ht.2] + · change -ε ≤ (t : ℂ).im ∧ (t : ℂ).im ≤ ε + simp only [ofReal_im] + exact ⟨neg_nonpos.mpr hε.le, hε.le⟩ + have hconst : ∀ x ∈ K '' A, f x = K (l : ℂ) := by + rintro x ⟨z, ⟨t, ht, rfl⟩, rfl⟩ + change c ((), K (t : ℂ)) = _ + rw [hc1 () _ (hAR ⟨t, ht, rfl⟩)] + change K (collapseStrip l r ε (t : ℂ)) = _ + rw [collapseStrip_ofReal, collapseInterval_of_mem ht] + have hsurjR : ∀ w ∈ R, ∃ z ∈ R, collapseStrip l r ε z = w := by + intro w hw + let t := collapseWeight ε w + let F : ℝ → ℝ := fun x => (1 - t) * x + t * collapseInterval l r x + have hFc : Continuous F := by + have hψ := continuous_collapseInterval l r + fun_prop + obtain ⟨hleft, hright⟩ := collapseInterval_interpolation_endpoints (t := t) hlr.le + have ha : 2 * l - r ≤ 2 * r - l := by linarith + obtain ⟨x, hx, hxe⟩ : w.re ∈ F '' Icc (2 * l - r) (2 * r - l) := by + apply intermediate_value_Icc ha hFc.continuousOn + change w.re ∈ Icc (F (2 * l - r)) (F (2 * r - l)) + dsimp only [F] + rw [hleft, hright] + exact hw.1 + let z : ℂ := (x : ℂ) + w.im * I + have hzre : z.re = x := by simp [z] + have hzim : z.im = w.im := by simp [z] + have hzR : z ∈ R := ⟨by simpa only [mem_preimage, hzre] using hx, + by simpa only [mem_preimage, hzim] using hw.2⟩ + refine ⟨z, hzR, Complex.ext ?_ ?_⟩ + · rw [collapseStrip_re, hzre] + have hweight : collapseWeight ε z = t := by simp only [collapseWeight, hzim, t] + rw [hweight] + exact hxe + · rw [collapseStrip_im, hzim] + have hsurj : Function.Surjective f := by + intro y + by_cases hy : y ∈ K '' R + · obtain ⟨w, hw, rfl⟩ := hy + obtain ⟨z, hz, hzw⟩ := hsurjR w hw + refine ⟨K z, ?_⟩ + change c ((), K z) = K w + rw [hc1 () z hz] + exact congrArg K hzw + · exact ⟨y, hc2 () y hy⟩ + have hleftAxis : ∀ t : ℝ, (t : ℂ) ∈ O → t ≤ l → f (K (t : ℂ)) = K (t : ℂ) := by + intro t ht htl + by_cases hKt : K (t : ℂ) ∈ K '' R + · obtain ⟨w, hw, heq⟩ := hKt + have hwt : w = (t : ℂ) := hK.hi (hRO hw) ht heq + subst w + change c ((), K (t : ℂ)) = _ + rw [hc1 () _ hw] + change K (collapseStrip l r ε (t : ℂ)) = _ + rw [collapseStrip_ofReal, collapseInterval_of_le hlr.le htl] + · exact hc2 () _ hKt + refine ⟨f, hsurj, fun x hx => hc2 () x hx, hconst, hleftAxis, ?_⟩ + intro x y + constructor + · intro heq + by_cases hx : x ∈ K '' R <;> by_cases hy : y ∈ K '' R + · obtain ⟨z, hz, rfl⟩ := hx + obtain ⟨w, hw, rfl⟩ := hy + change c ((), K z) = c ((), K w) at heq + rw [hc1 () z hz, hc1 () w hw] at heq + have hΦ : collapseStrip l r ε z = collapseStrip l r ε w := + hK.hi (hRO (hΦR hz)) (hRO (hΦR hw)) heq + rcases (collapseStrip_eq_iff hlr.le hε hz).mp hΦ with hzw | ⟨hzA, hwA⟩ + · exact Or.inl (congrArg K hzw) + · exact Or.inr ⟨⟨z, hzA, rfl⟩, ⟨w, hwA, rfl⟩⟩ + · obtain ⟨z, hz, rfl⟩ := hx + change c ((), K z) = c ((), y) at heq + rw [hc1 () z hz, hc2 () y hy] at heq + exact (hy ⟨collapseStrip l r ε z, hΦR hz, heq⟩).elim + · obtain ⟨w, hw, rfl⟩ := hy + change c ((), x) = c ((), K w) at heq + rw [hc2 () x hx, hc1 () w hw] at heq + exact (hx ⟨collapseStrip l r ε w, hΦR hw, heq.symm⟩).elim + · exact Or.inl (by change c ((), x) = c ((), y) at heq; rwa [hc2 () x hx, hc2 () y hy] at heq) + · rintro (rfl | ⟨hx, hy⟩) + · rfl + · rw [hconst x hx, hconst y hy] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73SupportedCollapse.lean b/LeanPool/GraphMinor/GM12/Section73SupportedCollapse.lean new file mode 100644 index 0000000000..6d878f1756 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73SupportedCollapse.lean @@ -0,0 +1,72 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73RadialStar +import LeanPool.GraphMinor.GM11.Theorem75 +import LeanPool.GraphMinor.Surface.Collar +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Keeping the star collapse inside a smaller closed disc + +The radial-star contraction in XII (7.3), page 261, can be +performed inside a closed disc contained in the merged region. +The finite star is compact. Enclose it in a disc in that region, +then enlarge the disc slightly so the star lies in its interior. +Apply the star collapse fixing the complement of this interior. +This gives the fixed boundary needed to compare selected insides. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Choose the radial-star contraction with support in a closed +disc lying in the merged region. The star lies in the interior +of this disc and the contraction fixes its boundary and outside. +This refines the topological construction of XII (7.3), page 261. -/ +theorem exists_radial_star_collapse_supported_in_disc + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : PreRad (PaintingOrDrawing.drawing Γ) K) {v : S} (hv : v ∈ Γ.V) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) + {r : Set S} (hr : r ∈ (deleteVertices Γ {v}).R) (hvr : v ∈ r) + (hropen : IsOpenDisc r) : + ∃ (D : Set S) (f : C(S, S)), IsClosedDisc D ∧ D ⊆ r ∧ + ({v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ⊆ discInt D ∧ + Function.Surjective f ∧ (∀ x ∉ discInt D, f x = x) ∧ + (∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) ∧ + (∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) := by + let : CompactSpace S := hS.1 + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let E : Set (Set S) := {e ∈ K.E | v ∈ closure e} + let A : Set S := {v} ∪ ⋃ e ∈ E, closure e + have hE : E.Finite := K.finite_edges.subset fun _ he => he.1 + have hAc : IsCompact A := isCompact_singleton.union + (hE.isCompact_biUnion fun _ _ => isClosed_closure.isCompact) + have hAr : A ⊆ r := radial_star_subset_deleted_region hS hK hv hr hvr + obtain ⟨D₀, hD₀, hD₀r, hAD₀⟩ := exists_closedDisc_of_isCompact hropen hAc hAr + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + obtain ⟨D, hD, hD₀D, hDsub⟩ := exists_disc_around hman hD₀ + (fun x _ => hS.2.2 x) hropen.1 ((Surface.discBd_subset D₀).trans hD₀r) + have hDr : D ⊆ r := hDsub.trans (union_subset hD₀r subset_rfl) + have hAD : A ⊆ discInt D := hAD₀.trans hD₀D + obtain ⟨hlines, hmeet⟩ := radial_star_lines_and_intersections hS hK hv hunique + have havoid : Disjoint A (discInt D)ᶜ := disjoint_left.mpr fun x hx hxn => hxn (hAD hx) + obtain ⟨f, hsurj, hfix, hcollapse, hfibre⟩ := exists_star_collapse hS hE closure v + hlines hmeet (hD.isOpen_discInt hman).isClosed_compl havoid + exact ⟨D, f, hD, hDr, hAD, hsurj, hfix, hcollapse, hfibre⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73SupportedRadialContraction.lean b/LeanPool/GraphMinor/GM12/Section73SupportedRadialContraction.lean new file mode 100644 index 0000000000..286481406f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73SupportedRadialContraction.lean @@ -0,0 +1,100 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73SupportedCollapse +public import LeanPool.GraphMinor.GM12.Section73RadialContraction +import LeanPool.GraphMinor.GM12.Section73CellularContraction +import LeanPool.GraphMinor.GM12.Section73ContractedFaces +import LeanPool.GraphMinor.GM12.Section73RadialMaximal + +/-! +# The radial contraction with a supporting disc + +For the disc comparison in XII (7.3), Claim (1), page 262, +choose the star collapse supported in a closed disc inside the +merged region. Assemble its image drawing and clean up the empty +parallel bigons as before. The resulting radial drawing retains +this same collapse map and its fixed boundary and outside. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The radial-star construction with its supporting disc, for +the controlled boundary homotopy in XII (7.3), Claim (1), page 262. +The image and the cleaned radial drawing use the same map. -/ +theorem exists_supported_radial_star_contraction + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) + (hE' : (deleteVertices Γ {v}).E.Nonempty) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) + {r : Set S} (hr : r ∈ (deleteVertices Γ {v}).R) (hvr : v ∈ r) : + ∃ (D : Set S) (f : C(S, S)) (H J : Drawing S), IsClosedDisc D ∧ D ⊆ r ∧ + ({v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ⊆ discInt D ∧ + Function.Surjective f ∧ (∀ x ∉ discInt D, f x = x) ∧ + (∀ x ∉ r, f x = x) ∧ + (∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) ∧ + (∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) ∧ + H.U = f '' K.U ∧ H.V = f '' K.V ∧ + H.E = (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g} ∧ + J.IsSubdrawing H ∧ J.V = H.V ∧ + (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsRadialDrawing J := by + obtain ⟨D, f, hD, hDr, hAD, hsurj, hfixD, hcollapse, hfibre⟩ := + exists_radial_star_collapse_supported_in_disc hS ⟨hK.1, hK.2.1⟩ hv hunique hr hvr + (htwo.2 r hr) + have hfix : ∀ x ∉ r, f x = x := fun x hxr => hfixD x + (fun hxD => hxr (hDr (Surface.discInt_subset D hxD))) + obtain ⟨H, hHU, hHV, hHE⟩ := exists_radial_star_image_drawing hS ⟨hK.1, hK.2.1⟩ hv + f hcollapse hfibre + have hinter := image_radial_inter_deleted_drawing hS ⟨hK.1, hK.2.1⟩ hv hr hvr hfix hfibre + have hcap : (deleteVertices Γ {v}).U ∩ H.U = (deleteVertices Γ {v}).V := by + rw [hHU] + exact hinter.1 + have hV : (deleteVertices Γ {v}).V ⊆ H.V := by rw [hHV]; exact hinter.2 + have hhub : ∀ s ∈ (deleteVertices Γ {v}).R, ∃! w, w ∈ s ∧ w ∈ H.V := by + rw [hHV] + exact image_radial_region_hub_unique hS hK hE hv hr hvr hfix hcollapse hfibre + have hregion : ∀ w ∈ H.V \ (deleteVertices Γ {v}).V, + ∃ s ∈ (deleteVertices Γ {v}).R, w ∈ s := by + intro w hw + apply exists_region_of_notMem + intro hwU + exact hw.2 (hcap.subset ⟨hwU, H.V_subset_U hw.1⟩) + have hlink : ∀ e ∈ H.E, ∃ a ∈ (deleteVertices Γ {v}).V, + ∃ b ∈ H.V \ (deleteVertices Γ {v}).V, closure e ∩ H.V = {a, b} := by + intro e he + obtain ⟨g, hg, rfl⟩ := hHE.subset he + obtain ⟨a, ha, b, hb, hends⟩ := image_radial_edge_ends hS ⟨hK.1, hK.2.1⟩ hv hr hvr + f hfix hfibre hg.1 hg.2 + rw [hHV] + exact ⟨a, ha, b, hb, hends⟩ + have hHtwo := radial_star_image_isTwoCell hS hK hv f hsurj hfibre hHU + have hface : ∀ s ∈ H.R, ∀ a ∈ (deleteVertices Γ {v}).E, + ∀ b ∈ (deleteVertices Γ {v}).E, a ⊆ s → b ⊆ s → a = b := by + intro s hs + obtain ⟨_, _, _, _, huniq⟩ := contracted_radial_region_edges hS hK hE hv hr hvr + f hsurj hfix hfibre hHU hs + exact huniq + obtain ⟨J, hJH, hJV, hJtwo, hJpre, hJface⟩ := + exists_preRadial_subdrawing_by_cleanup hS hHtwo hcap hV hhub hregion hlink hface + have hJ := isRadial_of_twoCell_unique_edges hS htwo hE' hJpre hJtwo hJface + exact ⟨D, f, H, J, hD, hDr, hAD, hsurj, hfixD, hfix, hcollapse, hfibre, hHU, + hHV, hHE, hJH, hJV, hJ⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73Tangle.lean b/LeanPool/GraphMinor/GM12/Section73Tangle.lean new file mode 100644 index 0000000000..bf96637aae --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73Tangle.lean @@ -0,0 +1,103 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section76 +public import LeanPool.GraphMinor.GM10.Defs2 +import LeanPool.GraphMinor.GM10.Section8 + +/-! +# The tangle after vertex deletion in Graph Minors XII, (7.3) + +Deleting vertices from a drawing agrees with deleting them from its hypergraph. +Thus Graph Minors X, (8.5) supplies the tangle used at the start of the proof of +XII, (7.3), page 261. This file proves that part of the construction. Respectfulness +and the two metric bounds are separate questions. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Hypergraph GraphMinor.Surface GraphMinor.GM10 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- Vertex deletion in a drawing and in its hypergraph have the same vertices, +edges, and incidence relation. This identifies the two deletions used at the +start of Graph Minors XII, (7.3), page 261. -/ +theorem deleteVertices_toHypergraph (Γ : Drawing S) (Z : Set S) : + (deleteVertices Γ Z).toHypergraph = Γ.toHypergraph.deleteVertices Z := by + have hsub := deleteVertices_isSubdrawing Γ Z + have heq : (deleteVertices Γ Z).E = + {e ∈ Γ.E | ∀ v ∈ Z, ¬ Γ.toHypergraph.Inc e v} := by + rw [deleteVertices_E] + ext e + constructor + · rintro ⟨he, hd⟩ + exact ⟨he, fun v hv hi => disjoint_left.mp hd ⟨hi.2.2, hi.2.1⟩ hv⟩ + · rintro ⟨he, hn⟩ + exact ⟨he, disjoint_left.mpr fun v hv hz => hn v hz ⟨he, hv.2, hv.1⟩⟩ + apply Hypergraph.ext + · exact deleteVertices_V Γ Z + · exact heq + · funext e v + apply propext + constructor + · rintro ⟨he, hv, hc⟩ + refine ⟨⟨hsub.2 he, hsub.1 hv, hc⟩, ?_⟩ + exact (heq ▸ he).2 + · rintro ⟨hi, hn⟩ + refine ⟨heq.symm ▸ ⟨hi.1, hn⟩, ?_, hi.2.2⟩ + rw [deleteVertices_V] + exact ⟨hi.2.1, fun hv => hn v hv hi⟩ + +omit [T2Space S] in +/-- Every edge of the hypergraph of a drawing has one or two ends, as required +when applying Graph Minors X, (8.5) in XII, (7.3). -/ +theorem drawing_toHypergraph_isGraph (Γ : Drawing S) : Γ.toHypergraph.IsGraph := by + intro e he + have hends : Γ.toHypergraph.ends e = closure e ∩ Γ.V := by + ext v + exact ⟨fun h => ⟨h.2.2, h.2.1⟩, fun h => ⟨he, h.2, h.1⟩⟩ + rw [hends] + rcases Γ.edge_cond e he with ⟨x, y, _, hxy, _⟩ | ⟨x, hx, _⟩ + · rw [hxy] + refine ⟨⟨x, mem_insert x _⟩, ?_⟩ + simpa only [ncard_singleton] using ncard_insert_le x ({y} : Set S) + · rw [hx, ncard_singleton] + exact ⟨singleton_nonempty x, by omega⟩ + +/-- The tangle part of the construction in Graph Minors XII, (7.3), page 261. +For a set of fewer than `θ` vertices, this is exactly X, (8.5), after identifying +the hypergraph of the deleted drawing. -/ +theorem deleteVertices_isTangle {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph θ T) {Z : Set S} + (hZ : Z ⊆ Γ.V) (hcard : Z.ncard < θ) : + IsTangle (deleteVertices Γ Z).toHypergraph (θ - Z.ncard) + (deleteVerticesTangle Γ.toHypergraph Z T θ) := by + rw [deleteVertices_toHypergraph] + exact GM10.theorem_8_5_proof (drawing_toHypergraph_isGraph Γ) hT hZ hcard + +/-- At a single vertex, the tangle constructed at the start of XII, (7.3) +has order `θ - 1`. No assumption about two-cellness is needed for this part. -/ +theorem theorem_7_3_tangle {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsTangle Γ.toHypergraph θ T) + {v : S} (hv : v ∈ Γ.V) : + IsTangle (deleteVertices Γ {v}).toHypergraph (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) := by + have hcard : ({v} : Set S).ncard < θ := by rw [ncard_singleton]; omega + simpa only [ncard_singleton] using + deleteVertices_isTangle hT (singleton_subset_iff.mpr hv) hcard + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73ThetaNull.lean b/LeanPool/GraphMinor/GM12/Section73ThetaNull.lean new file mode 100644 index 0000000000..0768d6dea9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73ThetaNull.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2ArcHomotopy +public import LeanPool.GraphMinor.GM12.Section2PathHomotopy +import LeanPool.GraphMinor.GM07.Section11a +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Null-homotopy of the third circle of a theta graph + +The representativity argument in XII (7.3), page 261, can simplify +a non-null normal circle by a chord in a region. If both new circles +were null-homotopic, each would bound a disc. In those discs the two +old arcs are each homotopic to the chord. They are therefore homotopic +to each other, which makes the old circle null-homotopic as well. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM07 + +/-- In a theta graph, null-homotopy of both circles using the chord +implies null-homotopy of the remaining circle. This supplies the +circle simplification used for representativity in XII (7.3). -/ +theorem nullHomotopic_third_theta_circle + {S : Type*} [TopologicalSpace S] [T2Space S] (hS : IsSurface S) + {A B L : Set S} {a b : S} + (hA : IsLineWithEnds A a b) (hB : IsLineWithEnds B a b) (hL : IsLineWithEnds L a b) + (hAB : A ∩ B = {a, b}) (hLA : IsOArc (L ∪ A)) (hLB : IsOArc (L ∪ B)) + (hnullA : IsNullHomotopicOArc (L ∪ A)) (hnullB : IsNullHomotopicOArc (L ∪ B)) : + IsNullHomotopicOArc (A ∪ B) := by + obtain ⟨D₁, hD₁, hbd₁⟩ := nullHomotopicOArc_bounds_disc hS hLA hnullA + obtain ⟨D₂, hD₂, hbd₂⟩ := nullHomotopicOArc_bounds_disc hS hLB hnullB + obtain ⟨f, hf, hfA, hf0, hf1⟩ := hA.exists_arc + obtain ⟨g, hg, hgB, hg0, hg1⟩ := hB.exists_arc + obtain ⟨ℓ, hℓ, hℓL, hℓ0, hℓ1⟩ := hL.exists_arc + let p : Path a b := ⟨⟨f, hf.1⟩, hf0, hf1⟩ + let q : Path a b := ⟨⟨g, hg.1⟩, hg0, hg1⟩ + let k : Path a b := ⟨⟨ℓ, hℓ.1⟩, hℓ0, hℓ1⟩ + have hpD : ∀ t, p t ∈ D₁ := fun t => Surface.discBd_subset D₁ + (hbd₁.symm ▸ Or.inr (hfA ▸ mem_range_self t)) + have hkD : ∀ t, k t ∈ D₁ := fun t => Surface.discBd_subset D₁ + (hbd₁.symm ▸ Or.inl (hℓL ▸ mem_range_self t)) + have hqD : ∀ t, q t ∈ D₂ := fun t => Surface.discBd_subset D₂ + (hbd₂.symm ▸ Or.inr (hgB ▸ mem_range_self t)) + have hkD' : ∀ t, k t ∈ D₂ := fun t => Surface.discBd_subset D₂ + (hbd₂.symm ▸ Or.inl (hℓL ▸ mem_range_self t)) + have hpk := paths_homotopic_of_range_in_simplyConnected hD₁.isSimplyConnectedSet p k hpD hkD + have hqk := paths_homotopic_of_range_in_simplyConnected hD₂.isSimplyConnectedSet q k hqD hkD' + have hcross : ∀ s t, p s = q t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + intro s t heq + have hends : p s ∈ ({a, b} : Set S) := hAB.subset + ⟨hfA ▸ mem_range_self s, heq ▸ (hgB ▸ mem_range_self t)⟩ + rcases hends with ha | hb + · exact Or.inl ⟨hf.2 (ha.trans hf0.symm), hg.2 (heq.symm.trans (ha.trans hg0.symm))⟩ + · exact Or.inr ⟨hf.2 (hb.trans hf1.symm), hg.2 (heq.symm.trans (hb.trans hg1.symm))⟩ + have hnull := nullHomotopic_union_of_homotopic_arcs p q hf.2 hg.2 hcross (hpk.trans hqk.symm) + change IsNullHomotopicOArcIn univ (range f ∪ range g) at hnull + rwa [hfA, hgB] at hnull + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73ThinStripCollapse.lean b/LeanPool/GraphMinor/GM12/Section73ThinStripCollapse.lean new file mode 100644 index 0000000000..1b81b925d3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73ThinStripCollapse.lean @@ -0,0 +1,150 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73StripCollapse +public import LeanPool.GraphMinor.GM12.Section73CollapseComposition +import Mathlib.Algebra.Order.Archimedean.Basic + +/-! +# Contracting a long interval inside a thin strip + +For the radial-edge contractions in XII (7.3), page 261, the strip +may extend only a short way beyond the arc ends. Divide its axis +interval into short pieces and collapse them from right to left. +Each piece has support in the prescribed strip. The composition +collapses exactly the whole interval and fixes the outside. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface Complex + +/-- An arbitrarily thin rectangular strip suffices to contract its +axis interval, identifying no other points. This removes the support +restriction from the local contractions used in XII (7.3). -/ +theorem exists_thin_strip_interval_collapse + {T : Type} [TopologicalSpace T] [T2Space T] {O : Set ℂ} {K : ℂ → T} + (hK : StripChart O K) {l r δ : ℝ} (hlr : l < r) (hδ : 0 < δ) + (hRO : Icc (l - δ) (r + δ) ×ℂ Icc (-δ) δ ⊆ O) : + ∃ f : C(T, T), Function.Surjective f ∧ + (∀ x ∉ K '' (Icc (l - δ) (r + δ) ×ℂ Icc (-δ) δ), f x = x) ∧ + (∀ x ∈ K '' (Complex.ofReal '' Icc l r), f x = K (l : ℂ)) ∧ + (∀ t : ℝ, (t : ℂ) ∈ O → t ≤ l → f (K (t : ℂ)) = K (t : ℂ)) ∧ + (∀ x y, f x = f y ↔ x = y ∨ + (x ∈ K '' (Complex.ofReal '' Icc l r) ∧ y ∈ K '' (Complex.ofReal '' Icc l r))) := by + classical + obtain ⟨N, hN⟩ := exists_nat_gt ((r - l) / δ) + have hNpos : (0 : ℝ) < N := (div_pos (sub_pos.mpr hlr) hδ).trans hN + let h : ℝ := (r - l) / N + have hh : 0 < h := div_pos (sub_pos.mpr hlr) hNpos + have hhδ : h < δ := by + apply (div_lt_iff₀ hNpos).mpr + have hmul := (div_lt_iff₀ hδ).mp hN + simpa only [mul_comm] using hmul + have hNh : h * (N : ℝ) = r - l := div_mul_cancel₀ _ hNpos.ne' + let c : ℕ → ℝ := fun k => r - k * h + let R : Set ℂ := Icc (l - δ) (r + δ) ×ℂ Icc (-δ) δ + let A : ℕ → Set T := fun k => K '' (Complex.ofReal '' Icc (c k) r) + have hcN : c N = l := by dsimp only [c]; rw [mul_comm _ h, hNh]; ring + have hcbounds : ∀ k ≤ N, l ≤ c k ∧ c k ≤ r := by + intro k hk + have hkn : (k : ℝ) ≤ N := by exact_mod_cast hk + have hk0 : (0 : ℝ) ≤ k := Nat.cast_nonneg k + have hle := mul_le_mul_of_nonneg_right hkn hh.le + have hnon := mul_nonneg hk0 hh.le + dsimp only [c] + constructor <;> nlinarith [hNh] + have hcstep : ∀ k, c (k + 1) = c k - h := by + intro k + dsimp only [c] + rw [Nat.cast_add, Nat.cast_one] + ring + have haxis : ∀ k ≤ N, ∀ t ∈ Icc (c k) r, (t : ℂ) ∈ O := by + intro k hk t ht + apply hRO + refine ⟨?_, ?_⟩ + · change l - δ ≤ t ∧ t ≤ r + δ + constructor <;> linarith [(hcbounds k hk).1, ht.1, ht.2] + · change -δ ≤ (t : ℂ).im ∧ (t : ℂ).im ≤ δ + simp only [ofReal_im] + exact ⟨neg_nonpos.mpr hδ.le, hδ.le⟩ + have build : ∀ k ≤ N, ∃ f : C(T, T), Function.Surjective f ∧ + (∀ x ∉ K '' R, f x = x) ∧ (∀ x ∈ A k, f x = K (c k : ℂ)) ∧ + (∀ t : ℝ, (t : ℂ) ∈ O → t ≤ c k → f (K (t : ℂ)) = K (t : ℂ)) ∧ + (∀ x y, f x = f y ↔ x = y ∨ (x ∈ A k ∧ y ∈ A k)) := by + intro k + induction k with + | zero => + intro hk + have hA0 : A 0 = {K (r : ℂ)} := by simp [A, c] + refine ⟨⟨id, continuous_id⟩, Function.surjective_id, fun _ _ => rfl, ?_, + fun _ _ _ => rfl, ?_⟩ + · intro x hx + change x = K (c 0 : ℂ) + simpa only [c, Nat.cast_zero, zero_mul, sub_zero] using mem_singleton_iff.mp (hA0.subset hx) + · intro x y + change x = y ↔ x = y ∨ (x ∈ A 0 ∧ y ∈ A 0) + constructor + · exact Or.inl + · rintro (hxy | ⟨hx, hy⟩) + · exact hxy + · exact (hA0.subset hx).trans (hA0.subset hy).symm + | succ k ih => + intro hk + have hkN : k ≤ N := (Nat.le_succ k).trans hk + obtain ⟨f, hfs, hfix, hconst, hleft, hfibre⟩ := ih hkN + have hstep : c (k + 1) < c k := by rw [hcstep]; exact sub_lt_self _ hh + have hpiece : collapseRectangle (c (k + 1)) (c k) δ ⊆ R := by + intro z hz + refine ⟨?_, hz.2⟩ + change l - δ ≤ z.re ∧ z.re ≤ r + δ + have hlow := (hcbounds (k + 1) hk).1 + have hupp := (hcbounds k hkN).2 + have hstep' := hcstep k + constructor <;> linarith [hz.1.1, hz.1.2] + obtain ⟨g, hgs, hgfix, hgconst, hgleft, hgfibre⟩ := + exists_strip_interval_collapse hK hstep hδ (hpiece.trans hRO) + let B : Set T := K '' (Complex.ofReal '' Icc (c (k + 1)) (c k)) + have hBfix : ∀ x ∈ B, f x = x := by + rintro x ⟨z, ⟨t, ht, rfl⟩, rfl⟩ + exact hleft t (haxis (k + 1) hk t ⟨ht.1, ht.2.trans (hcbounds k hkN).2⟩) ht.2 + have haB : K (c k : ℂ) ∈ B := ⟨(c k : ℂ), ⟨c k, ⟨hstep.le, le_rfl⟩, rfl⟩, rfl⟩ + obtain ⟨hcomconst, hcomfib⟩ := collapse_composition_fibres hfibre hgfibre hconst hBfix haB + have hUnion : A k ∪ B = A (k + 1) := by + change (K '' (Complex.ofReal '' Icc (c k) r)) ∪ + (K '' (Complex.ofReal '' Icc (c (k + 1)) (c k))) = _ + rw [← image_union, ← image_union, union_comm, + Icc_union_Icc_eq_Icc hstep.le (hcbounds k hkN).2] + have hpoint : g (K (c k : ℂ)) = K (c (k + 1) : ℂ) := hgconst _ haB + refine ⟨g.comp f, hgs.comp hfs, ?_, ?_, ?_, ?_⟩ + · intro x hx + change g (f x) = x + rw [hfix x hx] + exact hgfix x (fun hp => hx (image_mono hpiece hp)) + · intro x hx + change g (f x) = _ + rw [← hUnion] at hx + exact (hcomconst x hx).trans hpoint + · intro t ht htc + change g (f (K (t : ℂ))) = _ + rw [hleft t ht (htc.trans hstep.le), hgleft t ht htc] + · intro x y + change g (f x) = g (f y) ↔ _ + have hfibxy : g (f x) = g (f y) ↔ x = y ∨ (x ∈ A k ∪ B ∧ y ∈ A k ∪ B) := hcomfib x y + rwa [hUnion] at hfibxy + obtain ⟨f, hfs, hfix, hconst, hleft, hfibre⟩ := build N le_rfl + refine ⟨f, hfs, hfix, ?_, ?_, ?_⟩ + · simpa only [A, hcN] using hconst + · simpa only [hcN] using hleft + · simpa only [A, hcN] using hfibre + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73TieBoundary.lean b/LeanPool/GraphMinor/GM12/Section73TieBoundary.lean new file mode 100644 index 0000000000..0654fb1971 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73TieBoundary.lean @@ -0,0 +1,120 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.CutLift +import Mathlib.Topology.Separation.Basic + +/-! +# Boundaries of the pieces of a tie + +The walk selection in XII (7.3), page 262, uses the ties of XI +(9.2). Their disc and line pieces meet only at finitely many +attachment points. Away from these points, a boundary of a piece +is on the boundary of the union. A line or circle is the closure +of itself with finitely many points removed. Thus a closed set +containing the boundary of the union contains these boundaries +at the attachment points too. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- Removing finitely many points from a line leaves a dense +subset of that line, including at its ends. -/ +theorem line_subset_closure_sdiff_finite + {S : Type*} [TopologicalSpace S] {L T : Set S} {p q : S} + (hL : IsLineWithEnds L p q) (hT : T.Finite) : L ⊆ closure (L \ T) := by + obtain ⟨a, ha, hr, _, _⟩ := hL.exists_arc + have hpre : (a ⁻¹' T).Finite := hT.preimage ha.2.injOn + have hd : Dense ((univ : Set unitInterval) \ a ⁻¹' T) := dense_univ.sdiff_finite hpre + rintro x hx + obtain ⟨t, rfl⟩ := hr.symm ▸ hx + have ht : t ∈ closure ((univ : Set unitInterval) \ a ⁻¹' T) := by + rw [hd.closure_eq] + exact mem_univ t + apply closure_mono (s := a '' ((univ : Set unitInterval) \ a ⁻¹' T)) + (fun z hz => ?_) (image_closure_subset_closure_image ha.1 ⟨t, ht, rfl⟩) + obtain ⟨s, hs, rfl⟩ := hz + exact ⟨hr ▸ mem_range_self s, hs.2⟩ + +/-- Removing finitely many points from a circle leaves a dense +subset of the circle. Split it into two lines and apply the +line result to each. -/ +theorem oArc_subset_closure_sdiff_finite + {S : Type*} [TopologicalSpace S] [T2Space S] {F T : Set S} + (hF : IsOArc F) (hT : T.Finite) : F ⊆ closure (F \ T) := by + obtain ⟨e⟩ := hF + let p : S := (e 1).1 + have hp : p ∈ F := (e 1).2 + have hF : IsOArc F := ⟨e⟩ + obtain ⟨q, hq, hpq⟩ := hF.exists_ne p + obtain ⟨A, B, hA, hB, hAB, _⟩ := hF.lines hp hq hpq.symm + have hAF : A ⊆ F := hAB ▸ subset_union_left + have hBF : B ⊆ F := hAB ▸ subset_union_right + intro x hx + rcases (hAB.symm ▸ hx) with hx | hx + · exact closure_mono (sdiff_subset_sdiff_left hAF) + (line_subset_closure_sdiff_finite hA hT hx) + · exact closure_mono (sdiff_subset_sdiff_left hBF) + (line_subset_closure_sdiff_finite hB hT hx) + +/-- Outside a closed second piece, boundary points of a first +piece remain boundary points of their union. -/ +theorem frontier_sdiff_subset_frontier_union + {S : Type*} [TopologicalSpace S] {A B : Set S} (hB : IsClosed B) : + frontier A \ B ⊆ frontier (A ∪ B) := by + intro x hx + refine ⟨closure_mono subset_union_left hx.1.1, ?_⟩ + intro hi + have hopen : IsOpen (interior (A ∪ B) ∩ Bᶜ) := isOpen_interior.inter hB.isOpen_compl + have hsub : interior (A ∪ B) ∩ Bᶜ ⊆ A := by + intro y hy + exact (interior_subset hy.1).resolve_right hy.2 + exact hx.1.2 (interior_maximal hsub hopen ⟨hi, hx.2⟩) + +/-- A boundary contained in a closed set on a dense subset is +contained in it everywhere. -/ +theorem subset_of_frontier_union_of_dense_complement + {S : Type*} [TopologicalSpace S] {A B F U : Set S} + (hB : IsClosed B) (hU : IsClosed U) (hFA : F ⊆ frontier A) + (hdense : F ⊆ closure (F \ (F ∩ B))) + (hfront : frontier (A ∪ B) ⊆ U) : F ⊆ U := by + apply hdense.trans + apply closure_minimal _ hU + intro x hx + exact hfront (frontier_sdiff_subset_frontier_union hB + ⟨hFA hx.1, fun hxB => hx.2 ⟨hx.1, hxB⟩⟩) + +/-- A circle on the boundary of one piece is in every closed set +containing the boundary of the union, when the second piece meets +it only finitely often. -/ +theorem oArc_subset_of_frontier_union_of_finite_attachment + {S : Type*} [TopologicalSpace S] [T2Space S] {A B F U : Set S} + (hB : IsClosed B) (hU : IsClosed U) (hFA : F ⊆ frontier A) + (hF : IsOArc F) (hfinite : (F ∩ B).Finite) + (hfront : frontier (A ∪ B) ⊆ U) : F ⊆ U := + subset_of_frontier_union_of_dense_complement hB hU hFA + (oArc_subset_closure_sdiff_finite hF hfinite) hfront + +/-- The corresponding boundary extension for a line. The finite +attachment points are recovered by continuity along the line. -/ +theorem line_subset_of_frontier_union_of_finite_attachment + {S : Type*} [TopologicalSpace S] {A B F U : Set S} {p q : S} + (hB : IsClosed B) (hU : IsClosed U) (hFA : F ⊆ frontier A) + (hF : IsLineWithEnds F p q) (hfinite : (F ∩ B).Finite) + (hfront : frontier (A ∪ B) ⊆ U) : F ⊆ U := + subset_of_frontier_union_of_dense_complement hB hU hFA + (line_subset_closure_sdiff_finite hF hfinite) hfront + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73TraceHubCount.lean b/LeanPool/GraphMinor/GM12/Section73TraceHubCount.lean new file mode 100644 index 0000000000..f5e762b811 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73TraceHubCount.lean @@ -0,0 +1,111 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73WalkSubstitution +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM12.Section2ConnectedRegionArc +import LeanPool.GraphMinor.GM12.Section2CirclePeriod +import LeanPool.GraphMinor.GM12.Section2TraceParameters +import LeanPool.GraphMinor.GM11.Regions + +/-!+# Counting visits to a region hub + +The representativity step of XII (7.3), page 261, uses a normal +circle whose intersection with each region is connected. Such a +circle visits the hub of any fixed region at most once in its +radial trace. A second visit would give a second parameter interval +for that region, contradicting connectedness of the intersection. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +private theorem traceSteps_count_zero + {S : Type*} [TopologicalSpace S] {Γ K : Drawing S} + {f : ℝ → S} {r : Set S} (hr : r ∈ Γ.R) {v : S} (hv : v ∈ r) + {a b : ℝ} {x y : S} (W : GraphWalk K.toGraph x y) + (hW : TraceSteps Γ K f a b W) + (havoid : ∀ s ∈ Ioo a b, f s ∉ r) : walkVertexCount v W = 0 := by + classical + cases hcase : W with + | nil h => rfl + | @cons _ w _ e h₁ rest => + rw [hcase] at hW + cases hrest : rest with + | nil h => rw [hrest] at hW; exact hW.elim + | @cons _ z _ e' h₂ tail => + rw [hrest] at hW + obtain ⟨c, hac, _, hx, _, _, q, hq, hwq, hfr, _, _, ht⟩ := hW + have hcb := (traceSteps_parameters tail ht).1 + have hxv : x ≠ v := fun heq => region_subset hr (heq ▸ hv) (Γ.V_subset_U hx) + have hwv : w ≠ v := by + intro heq + have hqr := region_eq_of_mem hq hr hwq (heq ▸ hv) + have hm : (a + c) / 2 ∈ Ioo a c := ⟨by linarith, by linarith⟩ + exact havoid _ ⟨hm.1, hm.2.trans_le hcb⟩ (hqr ▸ hfr _ hm) + have htzero := traceSteps_count_zero hr hv tail ht + (fun s hs => havoid s ⟨hac.trans hs.1, hs.2⟩) + simp only [walkVertexCount, ite_eq_right hxv, ite_eq_right hwv, htzero, Nat.zero_add] +termination_by W.length +decreasing_by + rw [hcase, hrest] + simp only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +/-- An embedded circle with connected intersection with a region +visits its hub at most once in a one-period radial trace. This +bounds the extra two edges in the representativity step of XII +(7.3), page 261. -/ +theorem traceSteps_hub_count_le_one + {S : Type*} [TopologicalSpace S] [T2Space S] {Γ K : Drawing S} + {φ : C(Circle, S)} (hφ : IsEmbedding φ) + {r : Set S} (hr : r ∈ Γ.R) (hconn : IsPreconnected (range φ ∩ r)) + {v : S} (hv : v ∈ r) {l a b : ℝ} (hla : l ≤ a) (hbl : b ≤ l + 1) + {x y : S} (W : GraphWalk K.toGraph x y) + (hW : TraceSteps Γ K (periodicCurve φ) a b W) : + walkVertexCount v W ≤ 1 := by + classical + cases hcase : W with + | nil h => exact Nat.zero_le _ + | @cons _ w _ e h₁ rest => + rw [hcase] at hW + cases hrest : rest with + | nil h => rw [hrest] at hW; exact hW.elim + | @cons _ z _ e' h₂ tail => + rw [hrest] at hW + obtain ⟨c, hac, hfa, hx, hfc, _, q, hq, hwq, hfr, _, _, ht⟩ := hW + have hp := traceSteps_parameters tail ht + have hxv : x ≠ v := fun heq => region_subset hr (heq ▸ hv) (Γ.V_subset_U hx) + by_cases hwv : w = v + · have hqr := region_eq_of_mem hq hr hwq (hwv ▸ hv) + have hfr' : ∀ s ∈ Ioo a c, periodicCurve φ s ∈ r := fun s hs => hqr ▸ hfr s hs + have havoid : ∀ s ∈ Ioo c b, periodicCurve φ s ∉ r := by + intro s hs hsr + obtain ⟨t, ht, hts⟩ := preimage_region_subset_parameter_arc hφ hr hconn hac + (hfa.symm ▸ hx) (hfc.symm ▸ hp.2.2.1) hfr' hsr + have hts' := circle_parameter_injOn l + (show t ∈ Ico l (l + 1) from ⟨hla.trans ht.1.le, ht.2.trans_le (hp.1.trans hbl)⟩) + (show s ∈ Ico l (l + 1) from ⟨hla.trans (hac.trans hs.1).le, hs.2.trans_le hbl⟩) hts + exact (not_lt_of_ge hs.1.le) (hts' ▸ ht.2) + have htzero := traceSteps_count_zero hr hv tail ht havoid + simp only [walkVertexCount, ite_eq_right hxv, ite_eq_left hwv, htzero, Nat.zero_add, + Nat.add_zero, le_refl] + · have htail := traceSteps_hub_count_le_one hφ hr hconn hv (hla.trans hac.le) hbl tail ht + simpa only [walkVertexCount, ite_eq_right hxv, ite_eq_right hwv, Nat.zero_add] using htail +termination_by W.length +decreasing_by + rw [hcase, hrest] + simp only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73TracePath.lean b/LeanPool/GraphMinor/GM12/Section73TracePath.lean new file mode 100644 index 0000000000..229e71c3dd --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73TracePath.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73TraceVisitPath +public import LeanPool.GraphMinor.GM12.Section73WalkPaths +import LeanPool.GraphMinor.GM12.Section2TraceParameters + +/-! +# A traced curve segment deforms to its walk path + +For the representativity step of XII (7.3), page 261, split a trace +at each successive vertex hit. A region interval deforms to its two +prescribed spoke paths. The remaining trace deforms by induction. +The real-interval split and path associativity then give a homotopy +for the whole segment, with its endpoints fixed. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A real curve segment carrying trace steps is homotopic to a +path realizing that trace. This compares the normal curve with the +radial walk in the representativity proof of XII (7.3), page 261. -/ +theorem traceSteps_path_homotopic + {S : Type*} [TopologicalSpace S] [T2Space S] + {Γ K : Drawing S} (hK : PreRad (PaintingOrDrawing.drawing Γ) K) + {f : ℝ → S} (hf : Continuous f) + (q : ∀ e x y, K.toGraph.IsLink e x y → Path x y) + (hq : ∀ e x y (h : K.toGraph.IsLink e x y), range (q e x y h) ⊆ closure e) + {a b : ℝ} {u v : S} (W : GraphWalk K.toGraph u v) + (hW : TraceSteps Γ K f a b W) : + ∃ (hfa : f a = u) (hfb : f b = v), + ((realIntervalPath f hf a b).cast hfa.symm hfb.symm).Homotopic (walkPath q W) := by + cases hWcase : W with + | nil hv => + rw [hWcase] at hW + obtain ⟨hab, hfa, _⟩ := hW + subst b + refine ⟨hfa, hfa, ?_⟩ + rw [realIntervalPath_self] + have heq : (Path.refl (f a)).cast hfa.symm hfa.symm = Path.refl u := by + ext t + exact hfa + rw [heq] + exact Path.Homotopic.refl _ + | @cons _ w _ e h₁ rest => + rw [hWcase] at hW + cases hrestcase : rest with + | nil hv => rw [hrestcase] at hW; exact hW.elim + | @cons _ x _ e' h₂ tail => + rw [hrestcase] at hW + obtain ⟨c, hac, hfa, hu, hfc, hwK, r, hr, hwr, hfr, hleave, henter, ht⟩ := hW + have hparams := traceSteps_parameters tail ht + obtain ⟨hfc', hfb, htail⟩ := traceSteps_path_homotopic hK hf q hq tail ht + have hab : a < b := hac.trans_le hparams.1 + have hsplit := (realIntervalPath_split f hf hab hac.le hparams.1).symm.pathCast + hfa.symm hfb.symm + rw [Path.cast_trans _ _ hfa.symm hfc.symm hfb.symm] at hsplit + have hvisit := region_visit_homotopic_to_edge_paths hK hf hac hfa hfc hu + hparams.2.2.1 hr hwr h₁ h₂ hfr hleave henter q hq + refine ⟨hfa, hfb, ?_⟩ + exact hsplit.trans ((hvisit.hcomp htail).trans + (Path.Homotopic.trans_assoc (q e u w h₁) (q e' w x h₂) (walkPath q tail))) +termination_by W.length +decreasing_by + rw [hWcase, hrestcase] + simp only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73TraceVisitPath.lean b/LeanPool/GraphMinor/GM12/Section73TraceVisitPath.lean new file mode 100644 index 0000000000..1f8b9d3953 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73TraceVisitPath.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73RealPath +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM11.Walks +public import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM12.Section2RegionPathDeformation +import LeanPool.GraphMinor.GM11.LocalCone +import LeanPool.GraphMinor.GM11.PathClasses +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# A region visit deforms to prescribed spoke paths + +For the representativity step of XII (7.3), page 261, use the trace +of a normal curve in the new radial drawing. On each region visit, +the entry comparison deforms the original segment to its two +spokes. A line is simply connected, so those spoke paths can be +replaced by any prescribed parametrizations with the same ends. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 unitInterval + +/-- One region interval of a trace is homotopic to its two +prescribed edge paths. This is the local trace-to-path comparison +used for representativity in XII (7.3), page 261. -/ +theorem region_visit_homotopic_to_edge_paths + {S : Type*} [TopologicalSpace S] [T2Space S] + {Γ K : Drawing S} (hK : PreRad (PaintingOrDrawing.drawing Γ) K) + {f : ℝ → S} (hf : Continuous f) {a c : ℝ} (hac : a < c) + {u v w : S} (hfa : f a = u) (hfc : f c = v) + (hu : u ∈ Γ.V) (hv : v ∈ Γ.V) + {r e e' : Set S} (hr : r ∈ Γ.R) (hw : w ∈ r) + (h₁ : K.toGraph.IsLink e u w) (h₂ : K.toGraph.IsLink e' w v) + (hfr : ∀ t ∈ Ioo a c, f t ∈ r) + (hleave : LeavesLike f a c e r u w) (henter : EntersLike f a c e' r v w) + (q : ∀ g x y, K.toGraph.IsLink g x y → Path x y) + (hq : ∀ g x y (h : K.toGraph.IsLink g x y), range (q g x y h) ⊆ closure g) : + ((realIntervalPath f hf a c).cast hfa.symm hfc.symm).Homotopic + ((q e u w h₁).trans (q e' w v h₂)) := by + let γ := (realIntervalPath f hf a c).cast hfa.symm hfc.symm + let P : Path (⟨u, mem_univ u⟩ : (univ : Set S)) ⟨v, mem_univ v⟩ := { + toFun := fun t => ⟨γ t, mem_univ _⟩ + continuous_toFun := γ.continuous.subtype_mk _ + source' := Subtype.ext γ.source + target' := Subtype.ext γ.target } + have huE : u ∉ e := fun hx => (h₁.1.2.1 hx).2 h₁.2.1 + have hwE : w ∉ e := fun hx => (h₁.1.2.1 hx).2 h₁.2.2.1 + have hvE' : v ∉ e' := fun hx => (h₂.1.2.1 hx).2 h₂.2.2.1 + have hwE' : w ∉ e' := fun hx => (h₂.1.2.1 hx).2 h₂.2.1 + have huw : u ≠ w := fun h => region_subset hr (h ▸ hw) (Γ.V_subset_U hu) + have hvw : v ≠ w := fun h => region_subset hr (h ▸ hw) (Γ.V_subset_U hv) + obtain ⟨α, β, _, _, hαrange, hβrange, _, _, hhom⟩ := + region_path_homotopic_to_spokes (hK.1.2 r hr) (subset_univ _) (mem_univ u) (mem_univ v) + hw huE hwE huw hvE' hwE' hvw hf hac hfa hfc hfr hleave henter P (fun _ => rfl) + have hhomS := hhom.map (⟨Subtype.val, continuous_subtype_val⟩ : C((univ : Set S), S)) + change γ.Homotopic ((α.trans β.symm).map continuous_subtype_val) at hhomS + rw [Path.map_trans, ← Path.map_symm] at hhomS + have hα : (α.map continuous_subtype_val).Homotopic (q e u w h₁) := by + obtain ⟨p, _, _⟩ := isLine_closure h₁.1 huw h₁.2.2.2 + apply GM11.IsSimplyConnectedSet.flat (GM11.IsLine.isSimplyConnected (L := closure e) ⟨p⟩) + · intro t + exact hαrange.subset (mem_range_self t) + · intro t + exact hq e u w h₁ (mem_range_self t) + have hβ : (β.map continuous_subtype_val).symm.Homotopic (q e' w v h₂) := by + obtain ⟨p, _, _⟩ := isLine_closure h₂.1 hvw.symm h₂.2.2.2 + apply GM11.IsSimplyConnectedSet.flat (GM11.IsLine.isSimplyConnected (L := closure e') ⟨p⟩) + · intro t + change (β (σ t)).val ∈ closure e' + exact hβrange.subset (mem_range_self (σ t)) + · intro t + exact hq e' w v h₂ (mem_range_self t) + exact hhomS.trans (hα.hcomp hβ) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73TwoArcLoop.lean b/LeanPool/GraphMinor/GM12/Section73TwoArcLoop.lean new file mode 100644 index 0000000000..d8c5928426 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73TwoArcLoop.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73LoopParameter + +/-! +# The circle parameter from two arcs + +For XII (7.3), Claim (1), page 262, split the old circuit into +the arc collapsed to the hub and its complementary arc. Traverse +the first arc and then the second. Each is injective and their +only common points are their ends, so this loop is injective on +the half-open unit interval and parameterizes the old circle. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +private theorem crossing_parameters + {S : Type*} [TopologicalSpace S] {p q : S} + (α : Path p q) (β : Path q p) (hα : Function.Injective α) (hβ : Function.Injective β) + (hcap : range α ∩ range β ⊆ {p, q}) {s t : unitInterval} (heq : α s = β t) : + (s = 0 ∧ t = 1) ∨ (s = 1 ∧ t = 0) := by + rcases hcap ⟨mem_range_self s, t, heq.symm⟩ with hp | hq + · exact Or.inl ⟨hα (hp.trans α.source.symm), hβ ((heq.symm.trans hp).trans β.target.symm)⟩ + · exact Or.inr ⟨hα (hq.trans α.target.symm), hβ ((heq.symm.trans hq).trans β.source.symm)⟩ + +/-- The loop obtained by traversing two arcs with only their ends +in common is injective on its half-open parameter interval. This +provides the old embedded circle in XII (7.3), Claim (1). -/ +theorem two_arc_loop_injOn + {S : Type*} [TopologicalSpace S] {p q : S} + (α : Path p q) (β : Path q p) (hα : Function.Injective α) (hβ : Function.Injective β) + (hcap : range α ∩ range β ⊆ {p, q}) : + InjOn (α.trans β) (Ico (0 : unitInterval) 1) := by + intro s hs t ht heq + have hs1 : s.val < 1 := hs.2 + have ht1 : t.val < 1 := ht.2 + by_cases hsHalf : s.val ≤ 1 / 2 + · by_cases htHalf : t.val ≤ 1 / 2 + · rw [Path.trans_apply, Path.trans_apply, dite_eq_left hsHalf, dite_eq_left htHalf] at heq + have hh := congrArg Subtype.val (hα heq) + apply Subtype.ext + change 2 * s.val = 2 * t.val at hh + linarith + · rw [Path.trans_apply, Path.trans_apply, dite_eq_left hsHalf, dite_eq_right htHalf] at heq + rcases crossing_parameters α β hα hβ hcap heq with ⟨h₀, h₁⟩ | ⟨h₁, h₀⟩ + · have hh := congrArg Subtype.val h₁ + change 2 * t.val - 1 = 1 at hh + linarith + · have hh := congrArg Subtype.val h₀ + change 2 * t.val - 1 = 0 at hh + linarith + · by_cases htHalf : t.val ≤ 1 / 2 + · rw [Path.trans_apply, Path.trans_apply, dite_eq_right hsHalf, dite_eq_left htHalf] at heq + rcases crossing_parameters α β hα hβ hcap heq.symm with ⟨h₀, h₁⟩ | ⟨h₁, h₀⟩ + · have hh := congrArg Subtype.val h₁ + change 2 * s.val - 1 = 1 at hh + linarith + · have hh := congrArg Subtype.val h₀ + change 2 * s.val - 1 = 0 at hh + linarith + · rw [Path.trans_apply, Path.trans_apply, dite_eq_right hsHalf, dite_eq_right htHalf] at heq + have hh := congrArg Subtype.val (hβ heq) + apply Subtype.ext + change 2 * s.val - 1 = 2 * t.val - 1 at hh + linarith + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73UnchangedCircuit.lean b/LeanPool/GraphMinor/GM12/Section73UnchangedCircuit.lean new file mode 100644 index 0000000000..f9b3e187a9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73UnchangedCircuit.lean @@ -0,0 +1,159 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73CommonCircuitInside +public import LeanPool.GraphMinor.GM12.Section73EdgeWalkLift +import LeanPool.GraphMinor.GM11.CircuitRegions +import LeanPool.GraphMinor.GM11.RadialRegions + +/-! +# Circuits that avoid the merged hub + +For the first case of XII (7.3), Claim (1), page 262, a circuit +avoiding the merged hub misses the merged region altogether. +Its edges are unchanged old edges. Equality of the two walk point +sets outside that region then places the circuit in the lifted +walk. Its selected inside is unchanged, as proved by the disc +separation argument. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 Hypergraph + +/-- A radial subdrawing omitting a region's hub misses that whole +region. This is the geometric reason that the unchanged-circuit +case of XII (7.3), Claim (1), lies outside the merged region. -/ +theorem subdrawing_disjoint_region_of_notMem_hub + {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {Γ J C : Drawing S} + (hJ : PreRad (PaintingOrDrawing.drawing Γ) J) + {r : Set S} (hr : r ∈ Γ.R) {v : S} (hvr : v ∈ r) (hvJ : v ∈ J.V) + (hCJ : C.IsSubdrawing J) (hvC : v ∉ C.V) : Disjoint C.U r := by + apply disjoint_left.mpr + intro x hxC hxr + by_cases hxV : x ∈ C.V + · have hxv := hub_unique hJ hr hvr hvJ hxr (hCJ.1 hxV) + exact hvC (hxv ▸ hxV) + · obtain ⟨e, he, hxe⟩ := C.exists_edge_of_mem hxC hxV + obtain ⟨u, _, q, hq, w, hwq, hwJ, hcap, heq⟩ := spoke_ends hJ hS (hCJ.2 he) + have hqr : q = r := region_eq_of_mem hq hr (heq hxe) hxr + have hwv := hub_unique hJ hr hvr hvJ (hqr ▸ hwq) hwJ + have hwC : w ∈ C.V := by + have hw : w ∈ closure e ∩ J.V := hcap.superset (Or.inr rfl) + rw [← hCJ.closure_inter_V he] at hw + exact hw.2 + exact hvC (hwv ▸ hwC) + +/-- Inside one drawing, inclusion of underlying point sets implies +inclusion of subdrawings. Vertices are recovered by intersecting +with the ambient vertices; an absent edge misses the smaller +underlying point set. -/ +theorem isSubdrawing_of_U_subset_common + {S : Type*} [TopologicalSpace S] {K C N : Drawing S} + (hCK : C.IsSubdrawing K) (hNK : N.IsSubdrawing K) (hU : C.U ⊆ N.U) : + C.IsSubdrawing N := by + refine ⟨?_, ?_⟩ + · intro x hx + exact (isSubdrawing_U_inter_V hNK).subset ⟨hU (C.V_subset_U hx), hCK.1 hx⟩ + · intro e he + by_contra hen + obtain ⟨x, hxe⟩ := he.1 + exact disjoint_left.mp (edge_disjoint_U hNK (hCK.2 he) hen) hxe + (hU ((he.2.1 hxe).1)) + +/-- A subdrawing omitting the contracted vertex is an old +subdrawing whenever all its incident edge replacements have length +one. This identifies the unchanged circuits in XII (7.3). -/ +theorem isSubdrawing_of_retained_edges + {S : Type*} [TopologicalSpace S] {K J C : Drawing S} {v : S} + (hV : J.V ⊆ K.V) + (hretain : ∀ e x y, J.toGraph.IsLink e x y → x ≠ v → y ≠ v → e ∈ K.E) + (hCJ : C.IsSubdrawing J) (hvC : v ∉ C.V) : C.IsSubdrawing K := by + refine ⟨hCJ.1.trans hV, ?_⟩ + intro e he + obtain ⟨x, y, hxy⟩ := (C.toGraph.edge_mem_iff_exists_isLink e).mp he + exact hretain e x y ((hCJ.isLink_iff he).mp hxy) + (fun hxv => hvC (hxv ▸ hxy.2.1)) (fun hyv => hvC (hyv ▸ hxy.2.2.1)) + +/-- A path avoiding the merged hub lifts with the same vertex and +edge lists, and all its vertices lie outside the merged region. +This lifts the retained part of the circuit in XII (7.3), +Claim (1), page 262. -/ +theorem exists_unchanged_path_lift + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ J K : Drawing S} + (hJ : PreRad (PaintingOrDrawing.drawing Γ) J) + {r : Set S} (hr : r ∈ Γ.R) {v : S} (hvr : v ∈ r) (hvJ : v ∈ J.V) + (hV : J.V ⊆ K.V) + (hretain : ∀ e x y, J.toGraph.IsLink e x y → x ≠ v → y ≠ v → e ∈ K.E) + {x y : S} (P : GraphWalk J.toGraph x y) (hvP : v ∉ P.support) : + ∃ Q : GraphWalk K.toGraph x y, Q.support = P.support ∧ Q.edges = P.edges ∧ + ∀ z ∈ Q.support, z ∉ r := by + have hPJ := walkDrawing_isSubdrawing J P + have hvDraw : v ∉ (walkDrawing J P).V := by + rw [walkDrawing_V] + exact hvP + have hPK := isSubdrawing_of_retained_edges hV hretain hPJ hvDraw + obtain ⟨P₀, hS₀, hE₀⟩ := hPJ.exists_walk_down P + (by rw [walkDrawing_V]; exact fun _ hz => hz) + (by rw [walkDrawing_E]; exact fun _ he => he) + obtain ⟨Q, hSQ, hEQ⟩ := hPK.exists_walk_up P₀ + have hdis := subdrawing_disjoint_region_of_notMem_hub hS hJ hr hvr hvJ hPJ hvDraw + refine ⟨Q, hSQ.trans hS₀, hEQ.trans hE₀, ?_⟩ + intro z hz hzr + have hzP : z ∈ P.support := hS₀ ▸ hSQ ▸ hz + have hzV : z ∈ (walkDrawing J P).V := by rw [walkDrawing_V]; exact hzP + exact disjoint_left.mp hdis ((walkDrawing J P).V_subset_U hzV) hzr + +/-- The inside of a short circuit avoiding the merged hub lies +in the inside of the lifted walk. This proves the first circuit +case of XII (7.3), Claim (1), page 262. The retained-edge and +outside-point-set assumptions are the geometric properties of +the constructed spoke replacements. -/ +theorem circuit_inside_subset_lifted_walk_of_notMem_hub + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K J C : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsTangle Γ.toHypergraph θ T) + {v : S} (hv : v ∈ Γ.V) + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + (hJ : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsRadialDrawing J) + {r : Set S} (hr : r ∈ (deleteVertices Γ {v}).R) (hvr : v ∈ r) (hvJ : v ∈ J.V) + (hV : J.V ⊆ K.V) + (hretain : ∀ e x y, J.toGraph.IsLink e x y → x ≠ v → y ≠ v → e ∈ K.E) + {ins ins' : Drawing S → Set S} + (hins : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + (hins' : IsDerivedSlope (PaintingOrDrawing.drawing (deleteVertices Γ {v})) J (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) ins') + {a b : S} (W : GraphWalk J.toGraph a a) (W' : GraphWalk K.toGraph b b) + (hpoints : (walkDrawing K W').U \ r = (walkDrawing J W).U \ r) + (hC : C.IsCircuit) (hCW : C.IsSubdrawing (walkDrawing J W)) + (hvC : v ∉ C.V) (hshort : C.length + 2 < 2 * θ) : + ins' C ⊆ insWalk ins K W' := by + have hCJ : C.IsSubdrawing J := hCW.trans (walkDrawing_isSubdrawing J W) + have hCK := isSubdrawing_of_retained_edges hV hretain hCJ hvC + have hdis := subdrawing_disjoint_region_of_notMem_hub hS ⟨hJ.1, hJ.2.1⟩ hr hvr hvJ hCJ hvC + have hU : C.U ⊆ (walkDrawing K W').U := by + intro x hx + have hxout : x ∉ r := fun hxr => disjoint_left.mp hdis hx hxr + have hmem : x ∈ (walkDrawing J W).U \ r := ⟨hCW.U_subset hx, hxout⟩ + rw [← hpoints] at hmem + exact hmem.1 + have hCW' := isSubdrawing_of_U_subset_common hCK (walkDrawing_isSubdrawing K W') hU + have heq := common_circuit_inside_eq_after_vertex_deletion hS hθ hT hv hK hJ.2.1 + hins hins' hC hCK hCJ hshort + intro x hx + change x ∈ insOf ins (walkDrawing K W') + exact Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, hCW'⟩, heq.symm ▸ hx⟩) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73VertexReduction.lean b/LeanPool/GraphMinor/GM12/Section73VertexReduction.lean new file mode 100644 index 0000000000..c0eb34151d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73VertexReduction.lean @@ -0,0 +1,124 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72 +public import LeanPool.GraphMinor.GM12.Section73DiscPreprocess +import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM07.Section3 + +/-! +# Finite selected-disc reduction before vertex contraction + +To correct the parallel-spoke claim in XII (7.3), page 261, repeatedly +apply (7.2) while a selected one-vertex inside contains an old edge. +The deleted drawing does not change and the number of edges drops. +Choose a drawing with the fewest edges among these reductions. +Both metric comparisons are retained by transitivity. This supplies +the reduced case with no extra assumption in the original problem. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 GM14 Hypergraph + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- An atom shared by the first and last drawings in a chain of +subdrawings is an atom of the intermediate drawing as well. -/ +theorem shared_atom_mem_intermediate {Γ K H : Drawing S} + (hK : K.IsSubdrawing Γ) (hH : H.IsSubdrawing K) {a : Set S} + (haΓ : a ∈ Γ.A) (haH : a ∈ H.A) : a ∈ K.A := by + obtain ⟨b, hb, hab⟩ := exists_atom_superset_of_isSubdrawing hK haΓ + obtain ⟨c, hc, hbc⟩ := exists_atom_superset_of_isSubdrawing hH hb + obtain ⟨x, hxa⟩ := atom_nonempty' haH + have hac : a = c := atom_eq_of_inter_nonempty haH hc ⟨x, hxa, hbc (hab hxa)⟩ + have habEq : a = b := Subset.antisymm hab (hbc.trans hac.symm.subset) + exact habEq.symm ▸ hb + +omit [T2Space S] in +/-- The punctured normal circle through one old vertex lies in a +single region, the region used when applying XII (7.2). -/ +theorem exists_region_of_normal_circle_single_vertex {Γ : Drawing S} {F : Set S} {v : S} + (hF : IsOArc F) (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) + (hFV : F ∩ Γ.V = {v}) : ∃ r ∈ Γ.R, F \ {v} ⊆ r := by + have hvF : v ∈ F := (hFV.symm ▸ mem_singleton v).1 + have hpath := isPathConnected_oArc_diff hF hvF + have hdis : Disjoint (F \ {v}) Γ.U := by + apply disjoint_left.mpr + rintro x ⟨hxF, hxv⟩ hxΓ + exact hxv (hFV.subset ⟨hxF, hn ⟨hxF, hxΓ⟩⟩) + obtain ⟨x, hx⟩ := hpath.nonempty + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem (disjoint_left.mp hdis hx) + exact ⟨r, hr, subset_region hr hpath.isConnected.isPreconnected hdis hx hxr⟩ + +/-- Remove selected one-vertex insides until none contains an edge. +The deleted drawing stays fixed, and distances between shared atoms +do not decrease. This is the preprocessing correction for XII (7.3). -/ +theorem exists_vertex_reduction [ConnectedSpace S] (hS : IsClosedSurface S) + {Γ : Drawing S} {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hθ : 2 ≤ θ) (hd : HasTangleMetric Γ θ T d) + {v : S} (hv : v ∈ Γ.V) + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) : + ∃ (Γ₀ : Drawing S) (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ), + Γ₀.IsSubdrawing Γ ∧ v ∈ Γ₀.V ∧ deleteVertices Γ₀ {v} = deleteVertices Γ {v} ∧ + HasTangleMetric Γ₀ θ T₀ d₀ ∧ + (∀ a ∈ Γ.A ∩ Γ₀.A, ∀ b ∈ Γ.A ∩ Γ₀.A, d a b ≤ d₀ a b) ∧ + (∀ D F : Set S, IsClosedDisc D → IsOArc F → subBd D = F → + (PaintingOrDrawing.drawing Γ₀).IsNormal F → F ∩ Γ₀.V = {v} → + ((PaintingOrDrawing.drawing Γ₀).inter D, (PaintingOrDrawing.drawing Γ₀).interOutside D) ∈ + T₀ → + ∀ e ∈ Γ₀.E, ¬ e ⊆ D) := by + classical + have hex : ∃ n : ℕ, ∃ (K : Drawing S) + (U : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (δ : Set S → Set S → ℕ), + K.IsSubdrawing Γ ∧ v ∈ K.V ∧ deleteVertices K {v} = deleteVertices Γ {v} ∧ + HasTangleMetric K θ U δ ∧ + (∀ a ∈ Γ.A ∩ K.A, ∀ b ∈ Γ.A ∩ K.A, d a b ≤ δ a b) ∧ K.E.ncard = n := + ⟨Γ.E.ncard, Γ, T, d, Drawing.IsSubdrawing.refl Γ, hv, rfl, hd, + fun _ _ _ _ => le_rfl, rfl⟩ + obtain ⟨Γ₀, T₀, d₀, hΓ₀, hv₀, hdelete₀, hd₀, hcomp₀, hcount⟩ := Nat.find_spec hex + refine ⟨Γ₀, T₀, d₀, hΓ₀, hv₀, hdelete₀, hd₀, hcomp₀, ?_⟩ + intro D F hD hF hbd hn hFV hm e he heD + obtain ⟨r, hr, hFr⟩ := exists_region_of_normal_circle_single_vertex hF hn hFV + obtain ⟨_, _, d₁, r₁, hd₁, _, _, hcomp₁, _⟩ := + theorem_7_2_proof hS hθ hd₀ hD hbd hn hFV hr hFr hm + let Γ₁ := Γ₀.interSet (closure (univ \ D)) + let T₁ := restrictTangle T₀ Γ₁.toHypergraph + have hΓ₁ : Γ₁.IsSubdrawing Γ₀ := Drawing.span_isSubdrawing Γ₀ _ _ + have hfront : frontier D = F := (subBd_eq_frontier D).symm.trans hbd + have hvF : v ∈ F := (hFV.symm ▸ mem_singleton v).1 + have hv₁ : v ∈ Γ₁.V := by + have hvFront : v ∈ frontier D := hfront.symm ▸ hvF + rw [frontier_eq_closure_inter_closure] at hvFront + exact (mem_interSet_V_iff isClosed_closure).mpr + ⟨hv₀, by simpa only [compl_eq_univ_sdiff] using hvFront.2⟩ + have htwo₀ : (PaintingOrDrawing.drawing (deleteVertices Γ₀ {v})).IsTwoCell := by + rw [hdelete₀] + exact htwo + have hdelete₁ : deleteVertices Γ₁ {v} = deleteVertices Γ {v} := + (selected_disc_restriction_delete_vertex_eq hS hd₀.1.2.1 htwo₀ hD hbd hn hFV hm).trans hdelete₀ + have hcomp : ∀ a ∈ Γ.A ∩ Γ₁.A, ∀ b ∈ Γ.A ∩ Γ₁.A, d a b ≤ d₁ a b := by + intro a ha b hb + have ha₀ := shared_atom_mem_intermediate hΓ₀ hΓ₁ ha.1 ha.2 + have hb₀ := shared_atom_mem_intermediate hΓ₀ hΓ₁ hb.1 hb.2 + exact (hcomp₀ a ⟨ha.1, ha₀⟩ b ⟨hb.1, hb₀⟩).trans (hcomp₁ a ⟨ha₀, ha.2⟩ b ⟨hb₀, hb.2⟩) + have hless : Γ₁.E.ncard < Γ₀.E.ncard := ncard_edges_outside_lt_of_edge_inside + (fun x hx => hn ⟨hfront ▸ hx.1, hx.2⟩) he heD + have hminimal : Nat.find hex ≤ Γ₁.E.ncard := Nat.find_min' hex + ⟨Γ₁, T₁, d₁, hΓ₁.trans hΓ₀, hv₁, hdelete₁, hd₁, hcomp, rfl⟩ + rw [← hcount] at hminimal + exact (Nat.not_le_of_lt hless) hminimal + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73WalkInside.lean b/LeanPool/GraphMinor/GM12/Section73WalkInside.lean new file mode 100644 index 0000000000..0db0d38e72 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73WalkInside.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73HubCircuitInside +import LeanPool.GraphMinor.GM12.Section73UnchangedCircuit + +/-! +# The lifted-walk inside containment + +This proves the inside comparison of XII (7.3), Claim (1), +page 262, for the short new walks used by its metric argument. +Outside the merged region the walk point sets agree. Each circuit +of the new walk either avoids the hub and is unchanged, or passes +through the hub and has the proved old splice. Both circuit +comparisons place its inside in the old walk's inside together +with the merged region. Taking their union proves the claim. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 Hypergraph + +/-- Graph Minors XII, (7.3), Claim (1), page 262, for new walks +of length less than twice the new tangle order. These are the +walks used in both distance comparisons. The old and new +circuit cases and their selected-disc comparisons are discharged. -/ +theorem theorem_7_3_claim_1_short_walk + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K J : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsTangle Γ.toHypergraph θ T) + {v : S} {ins ins' : Drawing S → Set S} + (hins : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + (hins' : IsDerivedSlope (PaintingOrDrawing.drawing (deleteVertices Γ {v})) J (θ - 1) + (deleteVerticesTangle Γ.toHypergraph {v} T θ) ins') + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + (f : C(S, S)) (hfix : ∀ x ∉ r', f x = x) + (hcollapse : ∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + (hJV : J.V = f '' K.V) + (hJE : J.E ⊆ (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g}) + (hJ : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsRadialDrawing J) + {B : Set S} (hB : IsClosedDisc B) (hBr : B ⊆ r') + (hAB : ({v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ⊆ discInt B) + (hfixB : ∀ x ∉ discInt B, f x = x) + {a : S} (W : GraphWalk J.toGraph a a) (W' : GraphWalk K.toGraph a a) + (hWshort : W.length < 2 * (θ - 1)) + (hpoints : (walkDrawing K W').U \ r' = (walkDrawing J W).U \ r') + (hedges : ∀ e ∈ W.edges, ∀ g ∈ spokeReplacementEdges K J v f e, g ∈ W'.edges) : + insWalk ins' J W ⊆ insWalk ins K W' ∪ r' := by + have hV : J.V ⊆ K.V := by + intro x hx + rw [hJV, image_radial_vertices_eq hS hK hE hv hr' hvr' hfix hcollapse] at hx + rcases hx with hx | hxv + · exact hx.1 + · exact hxv ▸ hK.2.1.2.1 hv + have hvJ : v ∈ J.V := hJV.symm ▸ ⟨v, hK.2.1.2.1 hv, hcollapse v (Or.inl rfl)⟩ + have hretain : ∀ e x y, J.toGraph.IsLink e x y → x ≠ v → y ≠ v → e ∈ K.E := by + intro e x y hel + obtain ⟨_, _, _, _, hret⟩ := exists_edge_walk_lift hS hK hE hv hr' hvr' + f hfix hcollapse hfibre hJV hJE hel + exact hret + intro z hz + change z ∈ insOf ins' (walkDrawing J W) at hz + rcases hz with hz | hz + · by_cases hzr : z ∈ r' + · exact Or.inr hzr + · have hzOld : z ∈ (walkDrawing K W').U := (hpoints.superset ⟨hz, hzr⟩).1 + exact Or.inl (Or.inl hzOld) + · obtain ⟨C, ⟨hC, hCW⟩, hzC⟩ := mem_iUnion₂.mp hz + have hClen : C.length ≤ W.length := by + apply (ncard_le_ncard (fun e he => ?_) W.edges.finite_toSet).trans (ncard_mem_list_le W.edges) + have hem := hCW.2 he + rwa [walkDrawing_E] at hem + have hCshort : C.length + 2 < 2 * θ := by omega + by_cases hvC : v ∈ C.V + · exact circuit_inside_subset_lifted_walk_through_hub hS hθ hT hins hins' + hK hE hv hr' hvr' f hfix hcollapse hfibre hJV hJE hJ.2.1 hJ.1 + hB hBr hAB hfixB W W' hpoints hedges hC hCW hvC hCshort hzC + · exact Or.inl (circuit_inside_subset_lifted_walk_of_notMem_hub hS hθ hT hv + hK.2.1 hJ hr' hvr' hvJ hV hretain hins hins' W W' hpoints hC hCW hvC hCshort hzC) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73WalkLift.lean b/LeanPool/GraphMinor/GM12/Section73WalkLift.lean new file mode 100644 index 0000000000..3534927d8e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73WalkLift.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73EdgeWalkLift +public import LeanPool.GraphMinor.GM12.Section73WalkSubstitution + +/-! +# Lifting walks of the cleaned contraction + +In XII (7.3), page 261, replace every spoke at the merged hub by its +two-edge old path, and use one old edge for every other spoke. All +new radial vertices are old vertices. The resulting closed walk has +length larger by twice the number of visits to the merged hub. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The cleaned radial vertices are fixed old vertices, and its links have distinct ends. -/ +theorem walk_lift_vertex_properties + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K J : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + (f : C(S, S)) (hfix : ∀ x ∉ r', f x = x) + (hcollapse : ∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) + (hJV : J.V = f '' K.V) + (hJpre : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsPreRadialDrawing J) : + J.V ⊆ K.V ∧ (∀ x ∈ J.V, f x = x) ∧ + (∀ e x y, J.toGraph.IsLink e x y → x ≠ y) := by + have hvertices : ∀ x ∈ J.V, x ∈ K.V ∧ f x = x := by + intro x hx + rw [hJV, image_radial_vertices_eq hS hK hE hv hr' hvr' hfix hcollapse] at hx + rcases hx with hx | hxv + · exact ⟨hx.1, hfix x hx.2⟩ + · have heq : x = v := hxv + subst x + exact ⟨hK.2.1.2.1 hv, hcollapse v (Or.inl rfl)⟩ + refine ⟨fun x hx => (hvertices x hx).1, fun x hx => (hvertices x hx).2, ?_⟩ + intro e x y hel hxy + subst y + have hb := bipartite_of_preRadial hJpre e x x hel + by_cases hx : x ∈ (deleteVertices Γ {v}).V + · exact (hb.mp hx) hx + · exact hx (hb.mpr hx) + +open Classical in +/-- The lifted closed walk in Graph Minors XII, (7.3), page 261, +exists and has length exactly twice the number of hub occurrences +more than the new walk. The replacement paths are constructed from +the old radial drawing, with no assumed walk-lifting step. -/ +theorem exists_closed_walk_lift + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K J : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + (f : C(S, S)) (hfix : ∀ x ∉ r', f x = x) + (hcollapse : ∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + (hJV : J.V = f '' K.V) + (hJE : J.E ⊆ (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g}) + (hJpre : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsPreRadialDrawing J) + {a : S} (W : GraphWalk J.toGraph a a) : + ∃ W' : GraphWalk K.toGraph a a, + W'.length = W.length + 2 * walkVertexCount v W ∧ + f '' (walkDrawing K W').U = (walkDrawing J W).U ∧ + (walkDrawing K W').U \ r' = (walkDrawing J W).U \ r' := by + obtain ⟨hV, hfixV, hloopless⟩ := + walk_lift_vertex_properties hS hK hE hv hr' hvr' f hfix hcollapse hJV hJpre + have hpaths : ∀ e x y, J.toGraph.IsLink e x y → + ∃ P : GraphWalk K.toGraph x y, + P.length = (if x = v ∨ y = v then 2 else 1) ∧ + f '' (walkDrawing K P).U = closure e ∧ + (walkDrawing K P).U \ r' = closure e \ r' := by + intro e x y hel + obtain ⟨P, hP, hPimage, hPpts, _⟩ := exists_edge_walk_lift hS hK hE hv hr' hvr' f hfix + hcollapse hfibre hJV hJE hel + exact ⟨P, hP, hPimage, hPpts⟩ + exact exists_closed_walk_substitution_with_points f hfixV hV hloopless hpaths W + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73WalkLiftEdges.lean b/LeanPool/GraphMinor/GM12/Section73WalkLiftEdges.lean new file mode 100644 index 0000000000..f9424cb012 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73WalkLiftEdges.lean @@ -0,0 +1,73 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73WalkLift +public import LeanPool.GraphMinor.GM12.Section73ReplacementEdges +import LeanPool.GraphMinor.GM12.Section73WalkSubstitutionEdges +import LeanPool.GraphMinor.GM11.RadialBasics + +/-! +# The lifted walk contains all its replacement edges + +For XII (7.3), Claim (1), page 262, retain the edge containment +from each spoke replacement when assembling the lifted walk. +This supplements its length, image, and outside point-set identities +with the old edges needed to build the lifted circuit. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +open Classical in +/-- The constructed closed lift contains every old edge of the +replacement paths for the new spokes it uses. This is the +circuit-containment step of XII (7.3), Claim (1), page 262. -/ +theorem exists_closed_walk_lift_with_edges + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K J : Drawing S} + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) {r' : Set S} + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') + (f : C(S, S)) (hfix : ∀ x ∉ r', f x = x) + (hcollapse : ∀ x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e, f x = v) + (hfibre : ∀ x y, f x = f y ↔ x = y ∨ + (x ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e) ∧ + (y ∈ {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e)) + (hJV : J.V = f '' K.V) + (hJE : J.E ⊆ (fun g => f '' g) '' {g ∈ K.E | v ∉ closure g}) + (hJpre : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsPreRadialDrawing J) + (hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g) + {a : S} (W : GraphWalk J.toGraph a a) : + ∃ W' : GraphWalk K.toGraph a a, + W'.length = W.length + 2 * walkVertexCount v W ∧ + f '' (walkDrawing K W').U = (walkDrawing J W).U ∧ + (walkDrawing K W').U \ r' = (walkDrawing J W).U \ r' ∧ + ∀ e ∈ W.edges, ∀ g ∈ spokeReplacementEdges K J v f e, g ∈ W'.edges := by + obtain ⟨hV, hfixV, hloopless⟩ := + walk_lift_vertex_properties hS hK hE hv hr' hvr' f hfix hcollapse hJV hJpre + have hpaths : ∀ e x y, J.toGraph.IsLink e x y → + ∃ P : GraphWalk K.toGraph x y, + P.length = (if x = v ∨ y = v then 2 else 1) ∧ + f '' (walkDrawing K P).U = closure e ∧ + (walkDrawing K P).U \ r' = closure e \ r' ∧ + ∀ g ∈ spokeReplacementEdges K J v f e, g ∈ P.edges := by + intro e x y hel + obtain ⟨P, hP, hPimage, hPpts, _⟩ := exists_edge_walk_lift hS hK hE hv hr' hvr' f hfix + hcollapse hfibre hJV hJE hel + exact ⟨P, hP, hPimage, hPpts, + spokeReplacementEdges_subset_edge_lift hS ⟨hK.1, hK.2.1⟩ hv f hfibre hunique hel P hP hPimage⟩ + exact exists_closed_walk_substitution_with_edge_sets (spokeReplacementEdges K J v f) + f hfixV hV hloopless hpaths W + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73WalkPathLift.lean b/LeanPool/GraphMinor/GM12/Section73WalkPathLift.lean new file mode 100644 index 0000000000..e1eb99d54d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73WalkPathLift.lean @@ -0,0 +1,118 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73WalkPaths +public import LeanPool.GraphMinor.GM12.Section73WalkSubstitution +import LeanPool.GraphMinor.GM11.LocalCone +import LeanPool.GraphMinor.GM11.PathClasses + +/-! +# Homotopy of realized lifted walks + +For the representativity step of XII (7.3), page 261, realize a new +walk by paths in its edge closures. Realize each old replacement +path as well. After the collapse, its range lies in the new edge +closure, a line. The two paths are therefore homotopic with fixed +ends. Concatenating these homotopies compares the whole walks. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Apply a continuous map to a path when its two ends are fixed. +This retains the original endpoint types in the homotopy comparison +for XII (7.3). -/ +@[expose] def mapPathFixed + {S : Type*} [TopologicalSpace S] (f : C(S, S)) {a b : S} + (ha : f a = a) (hb : f b = b) (p : Path a b) : Path a b := + (p.map f.continuous).cast ha.symm hb.symm + +private theorem mapPathFixed_refl + {S : Type*} [TopologicalSpace S] (f : C(S, S)) {a : S} (ha : f a = a) : + mapPathFixed f ha ha (Path.refl a) = Path.refl a := by + ext t + exact ha + +private theorem mapPathFixed_trans + {S : Type*} [TopologicalSpace S] (f : C(S, S)) {a b c : S} + (ha : f a = a) (hb : f b = b) (hc : f c = c) (p : Path a b) (q : Path b c) : + mapPathFixed f ha hc (p.trans q) = + (mapPathFixed f ha hb p).trans (mapPathFixed f hb hc q) := by + unfold mapPathFixed + rw [Path.map_trans, Path.cast_trans _ _ ha.symm hb.symm hc.symm] + +private theorem mapPathFixed_homotopic + {S : Type*} [TopologicalSpace S] (f : C(S, S)) {a b : S} + (ha : f a = a) (hb : f b = b) {p q : Path a b} (hpq : p.Homotopic q) : + (mapPathFixed f ha hb p).Homotopic (mapPathFixed f ha hb q) := + (hpq.map f).pathCast ha.symm hb.symm + +open Classical in +/-- The realized lifted walk maps to a path homotopic to the +realized new walk, with the exact length increase in XII (7.3), +page 261. Edge images lie in lines, so their endpoint-preserving +homotopies concatenate. -/ +theorem exists_closed_walk_path_lift + {S : Type*} [TopologicalSpace S] [T2Space S] {J K : Drawing S} {v : S} + (f : C(S, S)) (hfix : ∀ x ∈ J.V, f x = x) (hV : J.V ⊆ K.V) + (hloopless : ∀ e x y, J.toGraph.IsLink e x y → x ≠ y) + (hline : ∀ e ∈ J.E, IsLine (closure e)) + (p : ∀ e x y, K.toGraph.IsLink e x y → Path x y) + (hp : ∀ e x y (h : K.toGraph.IsLink e x y), range (p e x y h) ⊆ closure e) + (q : ∀ e x y, J.toGraph.IsLink e x y → Path x y) + (hq : ∀ e x y (h : J.toGraph.IsLink e x y), range (q e x y h) ⊆ closure e) + (hpaths : ∀ e x y, J.toGraph.IsLink e x y → + ∃ P : GraphWalk K.toGraph x y, + P.length = (if x = v ∨ y = v then 2 else 1) ∧ + f '' (walkDrawing K P).U = closure e) + {a : S} (W : GraphWalk J.toGraph a a) : + let hfa : f a = a := hfix a (W.mem_vertexSet_of_mem_support W.start_mem_support) + ∃ W' : GraphWalk K.toGraph a a, + W'.length = W.length + 2 * walkVertexCount v W ∧ + (mapPathFixed f hfa hfa (walkPath p W')).Homotopic (walkPath q W) := by + let I : S → ℕ := fun x => if x = v then 1 else 0 + have hlift : ∀ {x y : S} (Q : GraphWalk J.toGraph x y) (hx : x ∈ J.V) (hy : y ∈ J.V), + ∃ Q' : GraphWalk K.toGraph x y, + (Q'.length + I x = Q.length + 2 * walkVertexCount v Q + I y) ∧ + (mapPathFixed f (hfix x hx) (hfix y hy) (walkPath p Q')).Homotopic (walkPath q Q) := by + intro x y Q + induction Q with + | nil h => + intro hx hy + refine ⟨.nil (hV h), by rfl, ?_⟩ + change (mapPathFixed f (hfix _ hx) (hfix _ hx) (Path.refl _)).Homotopic (Path.refl _) + rw [mapPathFixed_refl] + | @cons x y z e h Q ih => + intro hx hz + have hy : y ∈ J.V := h.2.2.1 + obtain ⟨P, hP, hPimage⟩ := hpaths e x y h + obtain ⟨Q', hQlen, hQhom⟩ := ih hy hz + have hedge : (mapPathFixed f (hfix x hx) (hfix y hy) (walkPath p P)).Homotopic (q e x y h) + := by + apply GM11.IsSimplyConnectedSet.flat (GM11.IsLine.isSimplyConnected (hline e h.1)) + · intro t + apply hPimage.subset + exact ⟨walkPath p P t, range_walkPath_subset p hp P (mem_range_self t), rfl⟩ + · intro t + exact hq e x y h (mem_range_self t) + refine ⟨P.append Q', ?_, ?_⟩ + · exact replacement_append_length (h := h) (hloopless e x y h) hP hQlen + · have happend := mapPathFixed_homotopic f (hfix x hx) (hfix z hz) + (walkPath_append_homotopic p P Q') + rw [mapPathFixed_trans f (hfix x hx) (hfix y hy) (hfix z hz)] at happend + exact happend.trans (hedge.hcomp hQhom) + have ha : a ∈ J.V := W.mem_vertexSet_of_mem_support W.start_mem_support + obtain ⟨W', hWlen, hWhom⟩ := hlift W ha ha + exact ⟨W', Nat.add_right_cancel hWlen, hWhom⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73WalkPaths.lean b/LeanPool/GraphMinor/GM12/Section73WalkPaths.lean new file mode 100644 index 0000000000..7d4cd5605c --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73WalkPaths.lean @@ -0,0 +1,119 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Walks +public import Mathlib.Topology.Homotopy.Path +import LeanPool.GraphMinor.GM12.Section73WalkPointSets +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.PathClasses +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# Paths realizing radial walks + +For the representativity step of XII (7.3), page 261, realize each +edge of a radial walk by a path in its closure and concatenate these +paths. The resulting path stays in the walk drawing. A short closed +walk lies in its simply connected inside, by XI (8.5), so the path +is null-homotopic. This will pass through the star-collapse map. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Graph Surface GM11 + +/-- A loopless drawing admits paths parametrizing every oriented +edge closure. These realize the radial edges in XII (7.3). -/ +theorem exists_edge_paths + {S : Type*} [TopologicalSpace S] {K : Drawing S} + (hloopless : ∀ e x y, K.toGraph.IsLink e x y → x ≠ y) : + ∃ p : ∀ e x y, K.toGraph.IsLink e x y → Path x y, + ∀ e x y (h : K.toGraph.IsLink e x y), range (p e x y h) = closure e := by + classical + have hex : ∀ e x y (h : K.toGraph.IsLink e x y), + ∃ p : Path x y, range p = closure e := by + intro e x y h + obtain ⟨p, hp0, hp1⟩ := isLine_closure h.1 (hloopless e x y h) h.2.2.2 + let q : Path x y := { + toFun := fun t => (p t).val + continuous_toFun := continuous_subtype_val.comp p.continuous + source' := hp0 + target' := hp1 } + refine ⟨q, ?_⟩ + ext z + constructor + · rintro ⟨t, rfl⟩ + exact (p t).property + · intro hz + exact ⟨p.symm ⟨z, hz⟩, congrArg Subtype.val (p.apply_symm_apply ⟨z, hz⟩)⟩ + choose p hp using hex + exact ⟨p, hp⟩ + +/-- Realize a graph walk using prescribed paths for its oriented +edges. This is a parametrization of the walks in XII (7.3), page 261. -/ +@[expose] noncomputable def walkPath + {S E : Type*} [TopologicalSpace S] {G : Graph S E} + (p : ∀ e x y, G.IsLink e x y → Path x y) {a b : S} : GraphWalk G a b → Path a b + | .nil _ => Path.refl _ + | .cons (u := x) (v := y) (e := e) h W => (p e x y h).trans (walkPath p W) + +/-- Realizing a concatenated walk agrees up to homotopy with +concatenating its realized paths. -/ +theorem walkPath_append_homotopic + {S E : Type*} [TopologicalSpace S] {G : Graph S E} + (p : ∀ e x y, G.IsLink e x y → Path x y) + {a b c : S} (W : GraphWalk G a b) (W' : GraphWalk G b c) : + (walkPath p (W.append W')).Homotopic ((walkPath p W).trans (walkPath p W')) := by + induction W with + | nil h => exact (Path.Homotopic.refl_trans (walkPath p W')).symm + | @cons x y z e h W ih => + exact ((Path.Homotopic.refl (p e x y h)).hcomp (ih W')).trans + (Path.Homotopic.trans_assoc (p e x y h) (walkPath p W) (walkPath p W')).symm + +/-- Edge paths in their closures realize the walk within its point +set. This controls the paths used in XII (7.3), page 261. -/ +theorem range_walkPath_subset + {S : Type*} [TopologicalSpace S] [T2Space S] {K : Drawing S} + (p : ∀ e x y, K.toGraph.IsLink e x y → Path x y) + (hp : ∀ e x y (h : K.toGraph.IsLink e x y), range (p e x y h) ⊆ closure e) + {a b : S} (W : GraphWalk K.toGraph a b) : + range (walkPath p W) ⊆ (walkDrawing K W).U := by + induction W with + | nil h => + change range (Path.refl _) ⊆ _ + rw [Path.refl_range] + exact (walkDrawing_nil_points h).symm.subset + | @cons x y z e h W ih => + change range ((p e x y h).trans (walkPath p W)) ⊆ _ + rw [Path.trans_range, walkDrawing_cons_points] + exact union_subset_union (hp e x y h) ih + +/-- A path realizing a short closed walk of a slope is +null-homotopic. Its range lies in `ins(W)`, which is simply connected +by XI (8.5). This supplies the old-walk step for the representativity +argument in XII (7.3), page 261. -/ +theorem walkPath_homotopic_refl_of_short_slope + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {K : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + (hs : IsSlope K k ins) + (p : ∀ e x y, K.toGraph.IsLink e x y → Path x y) + (hp : ∀ e x y (h : K.toGraph.IsLink e x y), range (p e x y h) ⊆ closure e) + {a : S} (W : GraphWalk K.toGraph a a) (hshort : W.length < k) : + (walkPath p W).Homotopic (Path.refl a) := by + have hrest := (GM11.theorem_8_5_proof hS hs W hshort).1 + have hpoints : ∀ t, walkPath p W t ∈ insWalk ins K W := fun t => + Or.inl (range_walkPath_subset p hp W (mem_range_self t)) + have ha : a ∈ insWalk ins K W := by simpa using hpoints 0 + exact GM11.IsSimplyConnectedSet.flat hrest.isSimplyConnected + (walkPath p W) (Path.refl a) hpoints (fun _ => ha) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73WalkPointSets.lean b/LeanPool/GraphMinor/GM12/Section73WalkPointSets.lean new file mode 100644 index 0000000000..1a9c2a569b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73WalkPointSets.lean @@ -0,0 +1,73 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.Ties + +/-! +# Point sets of the replacement paths + +For XII (7.3), page 261, the point set of a replacement path is the +union of its old edge closures. Concatenation takes unions and +reversal preserves the point set. These formulas let the lifted walk +be compared with the new walk outside the merged region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The point set of an empty walk is its single vertex. -/ +theorem walkDrawing_nil_points + {S : Type*} [TopologicalSpace S] [T2Space S] {K : Drawing S} {x : S} (hx : x ∈ K.V) : + (walkDrawing K (.nil hx)).U = {x} := + GraphWalk.drawing_U_nil K hx + +/-- Prepending an edge adds its closure to the walk's point set. -/ +theorem walkDrawing_cons_points + {S : Type*} [TopologicalSpace S] [T2Space S] {K : Drawing S} {e : Set S} {x y z : S} + (he : K.toGraph.IsLink e x y) (W : GraphWalk K.toGraph y z) : + (walkDrawing K (.cons he W)).U = closure e ∪ (walkDrawing K W).U := + GraphWalk.drawing_U_cons K he W + +/-- A one-edge walk has the closure of that edge as point set. -/ +theorem walkDrawing_one_edge_points + {S : Type*} [TopologicalSpace S] [T2Space S] {K : Drawing S} {e : Set S} {x y : S} + (he : K.toGraph.IsLink e x y) : + (walkDrawing K (.cons he (.nil he.2.2.1))).U = closure e := by + rw [walkDrawing_cons_points, walkDrawing_nil_points] + exact union_eq_left.mpr (singleton_subset_iff.mpr (he.2.2.2.superset (Or.inr rfl)).1) + +/-- A two-edge path has the union of the two edge closures as its +point set, as used in XII (7.3), page 261. -/ +theorem walkDrawing_two_edges_points + {S : Type*} [TopologicalSpace S] [T2Space S] {K : Drawing S} {e g : Set S} {x y z : S} + (he : K.toGraph.IsLink e x y) (hg : K.toGraph.IsLink g y z) : + (walkDrawing K (.cons he (.cons hg (.nil hg.2.2.1)))).U = closure e ∪ closure g := + GraphWalk.drawing_U_two_edges K he hg + +/-- Reversal leaves a walk's point set unchanged. -/ +theorem walkDrawing_reverse_points + {S : Type*} [TopologicalSpace S] [T2Space S] {K : Drawing S} {x y : S} + (W : GraphWalk K.toGraph x y) : + (walkDrawing K W.reverse).U = (walkDrawing K W).U := by + ext z + exact GM11.mem_U_reverse + +/-- Concatenation unions the point sets of its two walks. -/ +theorem walkDrawing_append_points + {S : Type*} [TopologicalSpace S] [T2Space S] {K : Drawing S} {x y z : S} + (W : GraphWalk K.toGraph x y) (W' : GraphWalk K.toGraph y z) : + (walkDrawing K (W.append W')).U = (walkDrawing K W).U ∪ (walkDrawing K W').U := + GraphWalk.drawing_U_append K W W' + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73WalkSubstitution.lean b/LeanPool/GraphMinor/GM12/Section73WalkSubstitution.lean new file mode 100644 index 0000000000..87a137025a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73WalkSubstitution.lean @@ -0,0 +1,198 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Walks +import Mathlib.Data.List.Count +import LeanPool.GraphMinor.GM12.Section73WalkPointSets + +/-! +# The length of a walk after replacing spokes + +In XII (7.3), page 261, replace each spoke at the merged hub by a +two-edge path and every other edge by one edge. Each occurrence of +the hub in a closed walk has one arriving and one departing edge. +The replacement therefore adds twice the number of occurrences. +Count occurrences by departure positions, excluding the repeated +last vertex of a closed walk. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Graph Surface GM11 + +open Classical in +/-- Count the occurrences of a vertex before the final position of +a walk. On closed walks this is the occurrence count used in XII +(7.3), page 261. -/ +@[expose] noncomputable def walkVertexCount + {α β : Type*} {G : Graph α β} (v : α) {a b : α} : GraphWalk G a b → ℕ + | .nil _ => 0 + | .cons (u := x) _ W => (if x = v then 1 else 0) + walkVertexCount v W + +open Classical in +/-- The departure count is the count in the support list with its +last position removed. -/ +theorem walkVertexCount_eq_count_dropLast + {α β : Type*} {G : Graph α β} (v : α) {a b : α} (W : GraphWalk G a b) : + walkVertexCount v W = (W.support.dropLast).count v := by + induction W with + | nil h => rfl + | @cons x y z e h W ih => + rw [walkVertexCount, GraphWalk.support_cons, List.dropLast_cons_of_ne_nil W.support_ne_nil, + List.count_cons, ← ih] + by_cases hx : x = v + · simp [hx, Nat.add_comm] + · simp [hx] + +open Classical in +private theorem replacement_edge_length {α : Type*} {x y v : α} (hxy : x ≠ y) : + (if x = v ∨ y = v then 2 else 1) = + 1 + (if x = v then 1 else 0) + (if y = v then 1 else 0) := by + by_cases hx : x = v <;> by_cases hy : y = v + · exact False.elim (hxy (hx.trans hy.symm)) + · simp only [hx, hy, true_or, ite_true, ite_false] + · simp only [hx, hy, or_true, ite_true, ite_false] + · simp only [hx, hy, false_or, ite_false] + +open Classical in +/-- The length identity for extending an already substituted walk by its first edge. -/ +theorem replacement_append_length {α β γ : Type*} + {G : Graph α β} {G' : Graph α γ} {v x y z : α} {e : β} + {h : G.IsLink e x y} {Q : GraphWalk G y z} + {P : GraphWalk G' x y} {Q' : GraphWalk G' y z} (hxy : x ≠ y) + (hP : P.length = if x = v ∨ y = v then 2 else 1) + (hQ : Q'.length + (if y = v then 1 else 0) = + Q.length + 2 * walkVertexCount v Q + (if z = v then 1 else 0)) : + (P.append Q').length + (if x = v then 1 else 0) = + (GraphWalk.cons h Q).length + 2 * walkVertexCount v (GraphWalk.cons h Q) + + (if z = v then 1 else 0) := by + have hlength := hP.trans (replacement_edge_length hxy) + rw [GraphWalk.length_append, GraphWalk.length_cons, walkVertexCount] + omega + +open Classical in +/-- Replacing each edge at a vertex by two edges adds twice the +number of vertex occurrences to a closed walk's length. This is the +length identity for the lifted walk in XII (7.3), page 261. -/ +theorem exists_closed_walk_substitution + {α β γ : Type*} {G : Graph α β} {G' : Graph α γ} {v : α} + (hV : ∀ x ∈ V(G), x ∈ V(G')) + (hloopless : ∀ e x y, G.IsLink e x y → x ≠ y) + (hpaths : ∀ e x y, G.IsLink e x y → + ∃ P : GraphWalk G' x y, P.length = if x = v ∨ y = v then 2 else 1) + {a : α} (W : GraphWalk G a a) : + ∃ W' : GraphWalk G' a a, W'.length = W.length + 2 * walkVertexCount v W := by + let I : α → ℕ := fun x => if x = v then 1 else 0 + have hlift : ∀ {x y : α} (R : GraphWalk G x y), ∃ R' : GraphWalk G' x y, + R'.length + I x = R.length + 2 * walkVertexCount v R + I y := by + intro x y R + induction R with + | nil h => exact ⟨.nil (hV _ h), by rfl⟩ + | @cons x y z e h R ih => + obtain ⟨P, hP⟩ := hpaths e x y h + obtain ⟨R', hR'⟩ := ih + refine ⟨P.append R', ?_⟩ + exact replacement_append_length (h := h) (hloopless e x y h) hP hR' + obtain ⟨W', hW'⟩ := hlift W + exact ⟨W', Nat.add_right_cancel hW'⟩ + +open Classical in +/-- The lifted walk contains the specified old edges of every +new edge that it replaces. This records the edge containment +needed for the old circuit in XII (7.3), Claim (1), page 262. -/ +theorem exists_closed_walk_substitution_with_edge_sets + {S : Type*} [TopologicalSpace S] [T2Space S] {J K : Drawing S} {v : S} {R : Set S} + (B : Set S → Set (Set S)) + (f : S → S) (hfixV : ∀ x ∈ J.V, f x = x) + (hV : J.V ⊆ K.V) + (hloopless : ∀ e x y, J.toGraph.IsLink e x y → x ≠ y) + (hpaths : ∀ e x y, J.toGraph.IsLink e x y → + ∃ P : GraphWalk K.toGraph x y, + P.length = (if x = v ∨ y = v then 2 else 1) ∧ + f '' (walkDrawing K P).U = closure e ∧ + (walkDrawing K P).U \ R = closure e \ R ∧ + ∀ g ∈ B e, g ∈ P.edges) + {a : S} (W : GraphWalk J.toGraph a a) : + ∃ W' : GraphWalk K.toGraph a a, + W'.length = W.length + 2 * walkVertexCount v W ∧ + f '' (walkDrawing K W').U = (walkDrawing J W).U ∧ + (walkDrawing K W').U \ R = (walkDrawing J W).U \ R ∧ + ∀ e ∈ W.edges, ∀ g ∈ B e, g ∈ W'.edges := by + let I : S → ℕ := fun x => if x = v then 1 else 0 + have hlift : ∀ {x y : S} (Q : GraphWalk J.toGraph x y), ∃ Q' : GraphWalk K.toGraph x y, + (Q'.length + I x = Q.length + 2 * walkVertexCount v Q + I y) ∧ + f '' (walkDrawing K Q').U = (walkDrawing J Q).U ∧ + (walkDrawing K Q').U \ R = (walkDrawing J Q).U \ R ∧ + ∀ e ∈ Q.edges, ∀ g ∈ B e, g ∈ Q'.edges := by + intro x y Q + induction Q with + | nil h => + refine ⟨.nil (hV h), by rfl, ?_, ?_, ?_⟩ + · calc + f '' (walkDrawing K (.nil (hV h))).U = f '' {_} := + congrArg (image f) (walkDrawing_nil_points (K := K) (hV h)) + _ = {_} := by rw [image_singleton, hfixV _ h] + _ = (walkDrawing J (.nil h)).U := (walkDrawing_nil_points (K := J) h).symm + · exact congrArg (fun A : Set S => A \ R) + ((walkDrawing_nil_points (K := K) (hV h)).trans (walkDrawing_nil_points (K := J) h).symm) + · intro e he + exact (List.not_mem_nil he).elim + | @cons x y z e h Q ih => + obtain ⟨P, hP, hPimage, hPpts, hPB⟩ := hpaths e x y h + obtain ⟨Q', hQ', hQimage, hQpts, hQB⟩ := ih + refine ⟨P.append Q', ?_, ?_, ?_, ?_⟩ + · exact replacement_append_length (h := h) (hloopless e x y h) hP hQ' + · rw [walkDrawing_append_points, image_union, hPimage, hQimage, walkDrawing_cons_points] + · rw [walkDrawing_append_points, union_sdiff_distrib, hPpts, hQpts, + ← union_sdiff_distrib, walkDrawing_cons_points] + · intro d hd g hg + rw [GraphWalk.edges_append] + rcases List.mem_cons.mp hd with rfl | hd + · exact List.mem_append_left _ (hPB g hg) + · exact List.mem_append_right _ (hQB d hd g hg) + obtain ⟨W', hWlen, hWimage, hWpts, hWB⟩ := hlift W + exact ⟨W', Nat.add_right_cancel hWlen, hWimage, hWpts, hWB⟩ + +open Classical in +/-- The walk substitution also preserves the point set outside a +specified region when every edge replacement does so. This is the +point-set part of the lifted walk in XII (7.3), page 261. -/ +theorem exists_closed_walk_substitution_with_points + {S : Type*} [TopologicalSpace S] [T2Space S] {J K : Drawing S} {v : S} {R : Set S} + (f : S → S) (hfixV : ∀ x ∈ J.V, f x = x) + (hV : J.V ⊆ K.V) + (hloopless : ∀ e x y, J.toGraph.IsLink e x y → x ≠ y) + (hpaths : ∀ e x y, J.toGraph.IsLink e x y → + ∃ P : GraphWalk K.toGraph x y, + P.length = (if x = v ∨ y = v then 2 else 1) ∧ + f '' (walkDrawing K P).U = closure e ∧ + (walkDrawing K P).U \ R = closure e \ R) + {a : S} (W : GraphWalk J.toGraph a a) : + ∃ W' : GraphWalk K.toGraph a a, + W'.length = W.length + 2 * walkVertexCount v W ∧ + f '' (walkDrawing K W').U = (walkDrawing J W).U ∧ + (walkDrawing K W').U \ R = (walkDrawing J W).U \ R := by + have hpaths' : ∀ e x y, J.toGraph.IsLink e x y → + ∃ P : GraphWalk K.toGraph x y, + P.length = (if x = v ∨ y = v then 2 else 1) ∧ + f '' (walkDrawing K P).U = closure e ∧ + (walkDrawing K P).U \ R = closure e \ R ∧ + ∀ g ∈ (∅ : Set (Set S)), g ∈ P.edges := by + intro e x y h + obtain ⟨P, hlen, himage, hpoints⟩ := hpaths e x y h + exact ⟨P, hlen, himage, hpoints, fun _ hg => hg.elim⟩ + obtain ⟨W', hlen, himage, hpoints, -⟩ := + exists_closed_walk_substitution_with_edge_sets (fun _ => ∅) + f hfixV hV hloopless hpaths' W + exact ⟨W', hlen, himage, hpoints⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section73WalkSubstitutionEdges.lean b/LeanPool/GraphMinor/GM12/Section73WalkSubstitutionEdges.lean new file mode 100644 index 0000000000..92f8aa3a30 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section73WalkSubstitutionEdges.lean @@ -0,0 +1,20 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73WalkSubstitution + +/-! +# Edge containment in a substituted walk + +The circuit comparison in XII (7.3), Claim (1), page 262, +uses the old edges of each replaced spoke inside the lifted walk. +`exists_closed_walk_substitution_with_edge_sets` records these edges +alongside the length and point-set identities. +-/ diff --git a/LeanPool/GraphMinor/GM12/Section74.lean b/LeanPool/GraphMinor/GM12/Section74.lean new file mode 100644 index 0000000000..80010e56f0 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section76 +import LeanPool.GraphMinor.GM12.Section74Base +import LeanPool.GraphMinor.GM12.Section74BaseCellularity +import LeanPool.GraphMinor.GM12.Section74Induction + +/-! +# Graph Minors XII, (7.4) + +A respectful tangle survives deletion of a vertex in a two-cell +component, with the four distance and point-set bounds on pages +262--263. We follow the paper's induction on the number of edges. +If a selected normal one-vertex disc contains an edge, apply +(7.2), use the induction hypothesis outside the disc, and transfer +all four conclusions back. Otherwise distinct corner regions, +finite edge gluing, and final leaf deletion show that deleting +the vertex is two-cell. Apply (7.3), with the local bounds for +the removed atoms, in that base case. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 GM14 + +/-- Graph Minors XII, (7.4), pages 262--263. Vertex deletion has +a two-cell component with a respectful tangle of order one less, +shared-atom distances decreasing by at most two, and distance +to its region of the deleted vertex decreasing by at most one. +All original atoms contained in that region have old distance +at most two from the deleted vertex. The component condition +uses the connected components of the drawing's point set. -/ +theorem theorem_7_4_proof + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hθ : 2 ≤ θ) (hd : HasTangleMetric Γ θ T d) + {v : S} (hv : v ∈ Γ.V) : + ∃ (Γ' : Drawing S) (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r : Set S), + Γ'.IsSubdrawing (deleteVertices Γ {v}) ∧ + Γ'.U ∈ componentsIn (deleteVertices Γ {v}).U ∧ + HasTangleMetric Γ' (θ - 1) T' d' ∧ r ∈ Γ'.R ∧ v ∈ r ∧ + Γ.U ⊆ Γ'.U ∪ r ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 2 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a {v} - 1 ≤ d' a r) ∧ + (∀ a ∈ Γ.A, a ⊆ r → d a {v} ≤ 2) := by + induction hn : Γ.E.ncard using Nat.strong_induction_on generalizing Γ T d with + | ind n ih => + by_cases hex : ∃ (D F : Set S), IsClosedDisc D ∧ IsOArc F ∧ subBd D = F ∧ + (PaintingOrDrawing.drawing Γ).IsNormal F ∧ F ∩ Γ.V = {v} ∧ + ((PaintingOrDrawing.drawing Γ).inter D, (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T ∧ + ∃ e ∈ Γ.E, e ⊆ D + · obtain ⟨D, F, hD, hF, hbd, hnF, hFV, hm, e, he, heD⟩ := hex + apply theorem_7_4_disc_induction hS hθ hd hv ?_ hD hF hbd hnF hFV hm he heD + intro Λ U δ hsmall hmetric hvΛ + exact ih _ (by omega) hmetric hvΛ rfl + · have hno : ∀ D F : Set S, IsClosedDisc D → IsOArc F → subBd D = F → + (PaintingOrDrawing.drawing Γ).IsNormal F → F ∩ Γ.V = {v} → + ((PaintingOrDrawing.drawing Γ).inter D, (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T + → + ∀ e ∈ Γ.E, ¬ e ⊆ D := by + intro D F hD hF hbd hnF hFV hm e he heD + exact hex ⟨D, F, hD, hF, hbd, hnF, hFV, hm, e, he, heD⟩ + exact theorem_7_4_of_twoCell_delete hS hθ hd hv + (isTwoCell_delete_vertex_of_no_selected_edge hS hθ hd hv hno) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74Base.lean b/LeanPool/GraphMinor/GM12/Section74Base.lean new file mode 100644 index 0000000000..b85f09e667 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74Base.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73 +public import LeanPool.GraphMinor.GM12.Section74DeletedRegion +import LeanPool.GraphMinor.GM12.Section78 +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# The two-cell-deletion case of XII (7.4) + +In the base case of the induction on edges in XII (7.4), pages +262--263, vertex deletion is two-cell. Apply (7.3) for the tangle +and the two lower bounds. The deleted-region lemmas supply the +point-set containment and upper bound two. The whole deleted +drawing is its own component because a two-cell drawing in a +connected closed surface is connected. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 GM14 + +/-- The base case of XII (7.4), pages 262--263, after establishing +that deletion of the vertex is two-cell. A component is expressed +by its point set being a connected component of the deleted +point set, together with the subdrawing relation. -/ +theorem theorem_7_4_of_twoCell_delete + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hθ : 2 ≤ θ) (hd : HasTangleMetric Γ θ T d) + {v : S} (hv : v ∈ Γ.V) + (htwo : (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell) : + ∃ (Γ' : Drawing S) (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r : Set S), + Γ'.IsSubdrawing (deleteVertices Γ {v}) ∧ + Γ'.U ∈ componentsIn (deleteVertices Γ {v}).U ∧ + HasTangleMetric Γ' (θ - 1) T' d' ∧ r ∈ Γ'.R ∧ v ∈ r ∧ + Γ.U ⊆ Γ'.U ∪ r ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 2 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a {v} - 1 ≤ d' a r) ∧ + (∀ a ∈ Γ.A, a ⊆ r → d a {v} ≤ 2) := by + obtain ⟨T', d', r, hm, hr, hvr, hi, hii⟩ := theorem_7_3_proof hS hθ hd hv htwo + let N := deleteVertices Γ {v} + have hNpos : 0 < N.V.ncard := by + have hle := hm.1.2.1.order_le_ncard_vertexSet + change θ - 1 ≤ N.V.ncard at hle + omega + obtain ⟨p, hp⟩ := (ncard_pos N.finite_V).mp hNpos + have hpU : p ∈ N.U := N.V_subset_U hp + have hpre : IsPreconnected N.U := isPreconnected_U_of_isTwoCell hS htwo + have hcomponent : N.U ∈ componentsIn N.U := by + refine ⟨p, hpU, Subset.antisymm (connectedComponentIn_subset _ _) ?_⟩ + exact hpre.subset_connectedComponentIn hpU Subset.rfl + exact ⟨N, T', d', r, Drawing.IsSubdrawing.refl N, hcomponent, hm, hr, hvr, + drawing_subset_delete_union_vertex_region hv hr hvr, hi, hii, + fun a ha har => atom_in_deleted_vertex_region_distance_le_two hS hθ hd hv hr hvr ha har⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74BaseCellularity.lean b/LeanPool/GraphMinor/GM12/Section74BaseCellularity.lean new file mode 100644 index 0000000000..36cd58d523 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74BaseCellularity.lean @@ -0,0 +1,112 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section76 +import LeanPool.GraphMinor.GM12.Section74CornerRegions +import LeanPool.GraphMinor.GM12.Section74CornerEdges +import LeanPool.GraphMinor.GM12.Section74FiniteGluing +import LeanPool.GraphMinor.GM12.Section74LeafTwoCell +import LeanPool.GraphMinor.GM12.Section74VertexWalk +import LeanPool.GraphMinor.GM12.Section78 +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM11.Section4b +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# Cellularity in the base case of XII (7.4) + +The first paragraph of the proof on pages 262--263 excludes a +selected normal one-vertex disc containing an edge. The sector +argument then makes the corner regions distinct. The tangle has +at least two vertices, so connectedness supplies a non-loop edge +at the deleted vertex. This edge has one half-edge there. The +cyclic order and distinct corner regions force all other edges +to have one half-edge as well. The finite gluing leaves the +chosen edge as a leaf; deleting that leaf preserves two-cellularity. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 GM14 + +private theorem exists_nonloop_edge_at_vertex + {S : Type*} [TopologicalSpace S] [T2Space S] {Γ : Drawing S} + (hpre : IsPreconnected Γ.U) {v w : S} (hv : v ∈ Γ.V) (hw : w ∈ Γ.V) (hwv : w ≠ v) : + ∃ (e : Set S) (u : S), e ∈ Γ.E ∧ u ∈ Γ.V ∧ u ≠ v ∧ + closure e ∩ Γ.V = {u, v} ∧ IsLineWithEnds (closure e) u v := by + obtain ⟨W⟩ := exists_walk_of_isPreconnected_U hpre hv hw + obtain ⟨P, hP, _, _⟩ := GraphWalk.exists_isSimple W + cases P with + | nil _ => exact (hwv rfl).elim + | @cons _ u _ e hl R => + have hvu : v ≠ u := by + intro heq + exact (List.nodup_cons.mp hP).1 + ((congrArg (fun x => x ∈ R.support) heq.symm).mp R.start_mem_support) + refine ⟨e, u, hl.1, hl.2.2.1, hvu.symm, ?_, ?_⟩ + · exact hl.2.2.2.trans (pair_comm v u) + · exact Surface.IsLineWithEnds.symm (isLine_closure hl.1 hvu hl.2.2.2) + +/-- The cellularity assertion in the first paragraph of the +proof of XII (7.4), pages 262--263. It is proved by the actual +sector argument, finite edge gluing, and final leaf deletion. -/ +theorem isTwoCell_delete_vertex_of_no_selected_edge + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hθ : 2 ≤ θ) (hd : HasTangleMetric Γ θ T d) + {v : S} (hv : v ∈ Γ.V) + (hno : ∀ D F : Set S, IsClosedDisc D → IsOArc F → subBd D = F → + (PaintingOrDrawing.drawing Γ).IsNormal F → F ∩ Γ.V = {v} → + ((PaintingOrDrawing.drawing Γ).inter D, (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T → + ∀ e ∈ Γ.E, ¬ e ⊆ D) : + (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell := by + have hcard := hd.1.2.1.order_le_ncard_vertexSet + change θ ≤ Γ.V.ncard at hcard + have hother : ∃ w ∈ Γ.V, w ≠ v := by + by_contra h + push Not at h + have hsub : Γ.V ⊆ {v} := fun w hw => h w hw + have hle := ncard_le_ncard hsub (finite_singleton v) + rw [ncard_singleton] at hle + omega + obtain ⟨w, hw, hwv⟩ := hother + obtain ⟨e, u, he, _, huv, hcap, hLine⟩ := exists_nonloop_edge_at_vertex + (isPreconnected_U_of_isTwoCell hS hd.1.1) hv hw hwv + let : Nonempty S := ⟨v⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + have hvCap : v ∈ closure e ∩ Γ.V := hcap.symm ▸ (Or.inr rfl : v ∈ ({u, v} : Set S)) + obtain ⟨b, hb⟩ := exists_end_eq hγ he hv hvCap.1 + let keep : halfEdges Γ γ v := ⟨(e, b), he, hb⟩ + have hkeep : ∀ k : halfEdges Γ γ v, k.1.1 = keep.1.1 → k = keep := + fun k hk => halfedge_eq_of_same_nonloop_edge hγ keep k huv hcap hk + by_cases h2 : 2 ≤ Nat.card (halfEdges Γ γ v) + · obtain ⟨next, ρ, P, W, Q, τ, hsec⟩ := exists_sectors hS Γ hγ hv h2 + have hρ := corner_regions_injective_in_theorem_7_4_base hS hθ hd.1 hv hno hsec + have hEdges := corner_edges_injective_of_single_fibre hsec.corners hρ keep hkeep + exact isTwoCell_delete_vertex_of_corner_data hS hd.1.1 hγ hv hsec.corners hρ hEdges keep huv + hcap hLine + · let α := halfEdges Γ γ v + let : Finite α := (finite_halfEdges Γ γ v).to_subtype + let : Nonempty α := ⟨keep⟩ + have hpos : 0 < Nat.card α := Nat.card_pos + have hOne : Nat.card α = 1 := by change ¬ 2 ≤ Nat.card α at h2; omega + let : Subsingleton α := (Nat.card_eq_one_iff_unique.mp hOne).1 + have hleaf : ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f := by + intro f hf hfe hvf + obtain ⟨c, hc⟩ := exists_end_eq hγ hf hv hvf + let k : α := ⟨(f, c), hf, hc⟩ + have hk : k = keep := Subsingleton.elim _ _ + exact hfe (congrArg (fun j : α => j.1.1) hk) + exact isTwoCell_delete_leaf hS hd.1.1 he huv hcap hLine hleaf + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74BoundaryParam.lean b/LeanPool/GraphMinor/GM12/Section74BoundaryParam.lean new file mode 100644 index 0000000000..20a90839fe --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74BoundaryParam.lean @@ -0,0 +1,55 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.ArcDrawings +import LeanPool.GraphMinor.GM11.EdgeSides +import LeanPool.GraphMinor.GM11.PaintingFacts +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# Parameterizing a disc boundary punctured at one point + +The leaf gluing in XII (7.4), pages 262--263, uses a disc whose +boundary misses the old region at just one point. Regard its +boundary circle as a loop drawing with that point as its sole +vertex. The edge parameter then runs through every other boundary +point injectively in the open parameter interval, and starts and +ends at the missing point. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 unitInterval + +/-- A circle punctured at a marked point has a loop parameter +that is injective on the open interval and takes both ends to +the marked point. -/ +theorem exists_punctured_oArc_parameter + {S : Type*} [TopologicalSpace S] [T2Space S] {F : Set S} {w : S} + (hF : IsOArc F) (hw : w ∈ F) : + ∃ ℓ : I → S, Continuous ℓ ∧ ℓ 0 = w ∧ ℓ 1 = w ∧ + InjOn ℓ (Ioo 0 1) ∧ ℓ '' Ioo 0 1 = F \ {w} := by + obtain ⟨K, hKU, hKV⟩ := exists_loop_drawing hF hw + have hne : (F \ {w}).Nonempty := ((infinite_of_isOArc hF).sdiff (finite_singleton w)).nonempty + have hpath : IsPathConnected (F \ {w}) := isPathConnected_oArc_diff hF hw + have he : F \ {w} ∈ K.E := by + change F \ {w} ∈ arcComponentsIn (K.U \ K.V) + rw [hKU, hKV] + refine ⟨hne, Subset.rfl, hpath, ?_⟩ + intro A hA _ hsub + exact Subset.antisymm hA hsub + obtain ⟨ℓ, hℓ, h0, h1, hi, hrange⟩ := exists_edge_param K he + rw [hKV] at h0 h1 + exact ⟨ℓ, hℓ, h0, h1, hi, hrange⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74Bridge.lean b/LeanPool/GraphMinor/GM12/Section74Bridge.lean new file mode 100644 index 0000000000..01605fcb92 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74Bridge.lean @@ -0,0 +1,33 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section74 +public import LeanPool.GraphMinor.GM12.Section75Defs + +/-! +# XII (7.4) in the form used by (7.5) + +`theorem_7_4` gives more than `Theorem74Statement` asks for, namely that the point set of `Γ'` is a +component of the point set of `Γ \ v`. This file drops that part. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +universe u + +/-- Graph Minors XII, (7.4), pages 262--263, in the form of `Theorem74Statement`. -/ +theorem gm12_theorem_7_4 : Theorem74Statement.{u} := by + intro S _ _ _ hS Γ θ T d v hθ hd hv + obtain ⟨Γ', T', d', r, hsub, -, hd', hr, hvr, hU, hi, hii, hiii⟩ := theorem_7_4_proof hS hθ hd hv + exact ⟨Γ', T', d', r, hsub, hd'.1.1, hd', hr, hvr, hU, hi, hii, hiii⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74Components.lean b/LeanPool/GraphMinor/GM12/Section74Components.lean new file mode 100644 index 0000000000..16062711e9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74Components.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section76 +import LeanPool.GraphMinor.GM12.Section73DiscPreprocess +import LeanPool.GraphMinor.GM12.Section72Regions +import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.Surface.PlaneSeparation + +/-! +# Components preserved by the disc reduction in XII (7.4) + +The induction step on page 263 removes the inside of a normal +disc through the deleted vertex. After deleting that vertex, the +disc boundary misses the drawing. A connected component cannot +cross that boundary. Hence any component of the drawing outside +the disc was already a component before the disc reduction. +This proves the component assertion in the induction step. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Restriction across a boundary missing the whole set removes +components without splitting the components that remain. -/ +theorem component_of_restriction_of_disjoint_frontier + {S : Type*} [TopologicalSpace S] {U X C : Set S} + (hX : IsClosed X) (hdis : Disjoint U (frontier X)) + (hC : C ∈ componentsIn (U ∩ X)) : C ∈ componentsIn U := by + obtain ⟨x, hx, rfl⟩ := hC + have hxC : x ∈ connectedComponentIn U x := mem_connectedComponentIn hx.1 + have hCX : connectedComponentIn U x ⊆ X := by + apply subset_of_disjoint_frontier isPreconnected_connectedComponentIn hX + (hdis.mono_left (connectedComponentIn_subset U x)) hxC hx.2 + have heq : connectedComponentIn (U ∩ X) x = connectedComponentIn U x := by + apply Subset.antisymm + · exact isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn hx) ((connectedComponentIn_subset _ _).trans inter_subset_left) + · exact isPreconnected_connectedComponentIn.subset_connectedComponentIn hxC + (subset_inter (connectedComponentIn_subset U x) hCX) + exact ⟨x, hx.1, heq.symm⟩ + +/-- Every component left after the one-vertex disc reduction and +vertex deletion is a component of the original vertex deletion, +as claimed in XII (7.4), page 263. -/ +theorem component_after_normal_disc_reduction + {S : Type*} [TopologicalSpace S] [T2Space S] + {Γ : Drawing S} {D F C : Set S} {v : S} + (hbd : subBd D = F) (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) + (hFV : F ∩ Γ.V = {v}) + (hC : C ∈ componentsIn (deleteVertices (Γ.interSet (closure (univ \ D))) {v}).U) : + C ∈ componentsIn (deleteVertices Γ {v}).U := by + let N := deleteVertices Γ {v} + let X := closure (univ \ D) + have hfrD : frontier D = F := (subBd_eq_frontier D).symm.trans hbd + have hfrX : frontier X ⊆ F := by + change frontier (closure (univ \ D)) ⊆ F + rw [← compl_eq_univ_sdiff, closure_compl, frontier_compl] + exact frontier_interior_subset.trans hfrD.subset + have hvnot : v ∉ N.U := by + intro hvU + have hvΓ : v ∈ Γ.V := (hFV.symm ▸ mem_singleton v).2 + have hvN := (isSubdrawing_U_inter_V (deleteVertices_isSubdrawing Γ {v})).subset ⟨hvU, hvΓ⟩ + exact ((deleteVertices_V Γ {v}).subset hvN).2 rfl + have hdis : Disjoint N.U (frontier X) := by + apply disjoint_left.mpr + intro x hxN hxF + have hxΓ : x ∈ Γ.U := (deleteVertices_isSubdrawing Γ {v}).U_subset hxN + have hxv : x = v := by + have hh : x ∈ F ∩ Γ.V := ⟨hfrX hxF, hn ⟨hfrX hxF, hxΓ⟩⟩ + rw [hFV] at hh + exact hh + exact hvnot (hxv ▸ hxN) + have hNU : (N.interSet X).U = N.U ∩ X := + interSet_U_eq_of_normal_frontier isClosed_closure + (fun x hx => False.elim (disjoint_left.mp hdis hx.2 hx.1)) + have hdelete := deleteVertices_interSet (Γ := Γ) (Z := ({v} : Set S)) + (X := closure (univ \ D)) isClosed_closure + rw [hdelete, hNU] at hC + exact component_of_restriction_of_disjoint_frontier isClosed_closure hdis hC + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74CornerEdges.lean b/LeanPool/GraphMinor/GM12/Section74CornerEdges.lean new file mode 100644 index 0000000000..20de1597f9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74CornerEdges.lean @@ -0,0 +1,113 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Corners +import LeanPool.GraphMinor.GM11.EvenCircuit +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# Distinct incident edges from distinct corner regions + +In the base case of XII (7.4), pages 262--263, a non-loop +incident edge has just one half-edge at the vertex. If some +other edge had two half-edges there, distinct corner regions +force those half-edges to be each other's successors. The cyclic +order would then consist only of those two half-edges, contrary +to the non-loop edge. Thus every incident edge occurs once in +the corner order, as required by the finite gluing. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- The two endpoint parameters of a non-loop edge are distinct. -/ +theorem endpoint_parameter_injective_of_distinct_ends + {S : Type*} [TopologicalSpace S] [T2Space S] {Γ : Drawing S} + {γ : Set S → unitInterval → S} (hγ : EdgePar Γ γ) {e : Set S} (he : e ∈ Γ.E) + {u v : S} (huv : u ≠ v) (hcap : closure e ∩ Γ.V = {u, v}) : + Function.Injective (fun b => γ e (endOf b)) := by + have huCap : u ∈ closure e ∩ Γ.V := hcap.symm ▸ (Or.inl rfl : u ∈ ({u, v} : Set S)) + have hvCap : v ∈ closure e ∩ Γ.V := hcap.symm ▸ (Or.inr rfl : v ∈ ({u, v} : Set S)) + rw [closure_inter_V_eq hγ he] at huCap hvCap + have hne : γ e (endOf false) ≠ γ e (endOf true) := by + intro heq + rw [heq] at huCap hvCap + have hu' : u = γ e (endOf true) := by + simpa only [pair_eq_singleton, mem_singleton_iff] using huCap + have hv' : v = γ e (endOf true) := by + simpa only [pair_eq_singleton, mem_singleton_iff] using hvCap + exact huv (hu'.trans hv'.symm) + intro b c hbc + cases b <;> cases c + · rfl + · exact (hne hbc).elim + · exact (hne hbc.symm).elim + · rfl + +/-- A non-loop edge has just one half-edge at a specified end. -/ +theorem halfedge_eq_of_same_nonloop_edge + {S : Type*} [TopologicalSpace S] [T2Space S] {Γ : Drawing S} + {γ : Set S → unitInterval → S} (hγ : EdgePar Γ γ) {v : S} + (keep k : halfEdges Γ γ v) {u : S} (huv : u ≠ v) + (hcap : closure keep.1.1 ∩ Γ.V = {u, v}) (hEdge : k.1.1 = keep.1.1) : k = keep := by + have hk : γ keep.1.1 (endOf k.1.2) = v := by rw [← hEdge]; exact k.2.2 + have hb : k.1.2 = keep.1.2 := + endpoint_parameter_injective_of_distinct_ends hγ keep.2.1 huv hcap (hk.trans keep.2.2.symm) + exact Subtype.ext (Prod.ext hEdge hb) + +/-- If corner regions are distinct and one edge has a singleton +half-edge fibre, every edge does. A doubled edge would force a +cyclic order consisting of its two half-edges alone. -/ +theorem corner_edges_injective_of_single_fibre + {S : Type*} [TopologicalSpace S] {Γ : Drawing S} + {γ : Set S → unitInterval → S} {v : S} + {next : halfEdges Γ γ v → halfEdges Γ γ v} + {ρ : halfEdges Γ γ v → Set S} (hcor : IsCorners Γ γ v next ρ) + (hρ : Function.Injective ρ) (keep : halfEdges Γ γ v) + (hkeep : ∀ k : halfEdges Γ γ v, k.1.1 = keep.1.1 → k = keep) : + Function.Injective (fun k : halfEdges Γ γ v => k.1.1) := by + intro a b hab + by_contra hne + have hsurj := next_surjective hcor + have hcl : ∀ k : halfEdges Γ γ v, k.1.1 ⊆ closure (ρ k) := by + intro k + obtain ⟨p, hp⟩ := hsurj k + exact hp ▸ hcor.right p + have hnext : ∀ i j : halfEdges Γ γ v, i ≠ j → i.1.1 = j.1.1 → next j = i := by + intro i j hij hEdge + obtain ⟨p, hp⟩ := hsurj i + have hecl : (next p).1.1 ⊆ closure (ρ j) := by rw [hp, hEdge]; exact hcl j + rcases hcor.sides p (ρ j) (hcor.region j) hecl with h | h + · have hjp : j = p := hρ h + exact hjp.symm ▸ hp + · have hji : j = i := hρ (h.trans (congrArg ρ hp)) + exact (hij hji.symm).elim + have hba : next b = a := hnext a b hne hab + have hab' : next a = b := hnext b a (Ne.symm hne) hab.symm + have hall : ∀ k : halfEdges Γ γ v, k = a ∨ k = b := by + intro k + have hr := hcor.reach a k + induction hr with + | refl => exact Or.inl rfl + | tail hr hs ih => + rcases ih with h | h + · exact Or.inr (hs.trans ((congrArg next h).trans hab')) + · exact Or.inl (hs.trans ((congrArg next h).trans hba)) + have haKeep : a.1.1 = keep.1.1 := by + rcases hall keep with hk | hk + · exact congrArg (fun j : halfEdges Γ γ v => j.1.1) hk.symm + · exact hab.trans (congrArg (fun j : halfEdges Γ γ v => j.1.1) hk.symm) + have hbKeep : b.1.1 = keep.1.1 := hab.symm.trans haKeep + exact hne ((hkeep a haKeep).trans (hkeep b hbKeep).symm) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74CornerRegions.lean b/LeanPool/GraphMinor/GM12/Section74CornerRegions.lean new file mode 100644 index 0000000000..815cbaefc6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74CornerRegions.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Corners +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM12.Section74NoParallel +import LeanPool.GraphMinor.GM11.RadialFaces +import LeanPool.GraphMinor.GM11.RadialExists +import LeanPool.GraphMinor.GM07.Section3 + +/-! +# Distinct corner regions in the base case of XII (7.4) + +The no-selected-disc case on pages 262--263 implies that the +corner regions at the vertex are distinct. Otherwise two paths +in different sectors join inside the same region and make a +normal circle through the vertex. Respectfulness selects its +disc. With no edge inside, the disc lies in the old region with +the vertex restored. A small connected set on its interior side +would then lie in both sectors, contrary to their intersection +being in the drawing. This is the sector argument used for XI's +radial corner lemma, now with the selected disc at the old vertex. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 GM14 unitInterval + +/-- In the no-selected-edge case of XII (7.4), distinct sectors +at the vertex belong to distinct regions of the drawing. -/ +theorem corner_regions_injective_in_theorem_7_4_base + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsRespectfulDrawingTangle Γ θ T) + {c : S} (hv : c ∈ Γ.V) + (hno : ∀ D F : Set S, IsClosedDisc D → IsOArc F → subBd D = F → + (PaintingOrDrawing.drawing Γ).IsNormal F → F ∩ Γ.V = {c} → + ((PaintingOrDrawing.drawing Γ).inter D, (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T → + ∀ e ∈ Γ.E, ¬ e ⊆ D) + {γ : Set S → I → S} + {next : halfEdges Γ γ c → halfEdges Γ γ c} + {ρ P Q : halfEdges Γ γ c → Set S} {W : Set S} {τ : halfEdges Γ γ c → I} + (hsec : IsSectors Γ γ c next ρ P W Q τ) : Function.Injective ρ := by + intro k k' hρ + by_contra hkk + refine corner_regions_ne_of_free_disc hS (Γ.V_subset_U hv) hsec hkk ?_ hρ + intro J hJ hvJ hJp + have hpR : ρ k ∈ Γ.R := IsCorners.region (IsSectors.corners hsec) k + have hn : (PaintingOrDrawing.drawing Γ).IsNormal J := by + intro x hx + rcases hJp x hx.1 with hxc | hxr + · exact hxc ▸ hv + · exact (region_subset hpR hxr hx.2).elim + have hJV : J ∩ Γ.V = {c} := by + apply Subset.antisymm + · intro x hx + exact (hJp x hx.1).resolve_right (fun hxr => region_subset hpR hxr (Γ.V_subset_U hx.2)) + · exact singleton_subset_iff.mpr ⟨hvJ, hv⟩ + obtain ⟨Δ, hΔ, hbd, hm⟩ := hT.2.2.2 J hJ hn + (by change (J ∩ Γ.V).ncard < θ; rw [hJV, ncard_singleton]; omega) + have hNo := hno Δ J hΔ hJ hbd hn hJV hm + obtain ⟨K, hK⟩ := exists_radialDrawing hS hT.1 + have hE : Γ.E.Nonempty := edgeSet_nonempty_of_isTangle_of_two_le hT.2.1 hθ + have hVD := vertices_in_normal_vertex_disc_of_no_edges hS ⟨hT.1, hK.2.1⟩ hE hΔ hbd hn hJV hNo + have hb : discBd Δ = J := (IsClosedDisc.frontier_eq_discBd hS hΔ).symm.trans + ((subBd_eq_frontier Δ).symm.trans hbd) + have hcb : c ∈ discBd Δ := hb.symm ▸ hvJ + have hΔr : Δ ⊆ ρ k ∪ {c} := disc_subset_region_vertex_of_no_edges hS hΔ hb hvJ hn hVD hpR + (fun x hx => (hJp x hx.1).resolve_left hx.2) hNo + have hfree : Disjoint (Δ \ discBd Δ) Γ.U := by + apply disjoint_left.mpr + intro x hx hxG + rcases hΔr hx.1 with hxr | hxc + · exact region_subset hpR hxr hxG + · exact hx.2 (hxc.symm ▸ hcb) + exact ⟨Δ, hΔ, hb, hfree⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74DeletedRegion.lean b/LeanPool/GraphMinor/GM12/Section74DeletedRegion.lean new file mode 100644 index 0000000000..9d595df9b3 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74DeletedRegion.lean @@ -0,0 +1,113 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73DeletedRegions +import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.GM11.Section91 +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM07.Section3 + +/-! +# The region of a deleted vertex in XII (7.4) + +In the base case of XII (7.4), pages 262--263, the drawing after +vertex deletion is two-cell. All removed edges belong to the +region containing that vertex: each edge together with the +vertex is connected and misses the remaining drawing. Every old +atom contained in this region is the deleted vertex, an incident +edge, or an incident region. The metric's incidence bounds put their +old distance to the deleted vertex at most two. This proves assertions (i) and +(iv) in this base case. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM14 GM10 + +/-- An incident edge, with the deleted vertex restored, lies in +the region containing that vertex after deletion. -/ +theorem incident_edge_subset_deleted_vertex_region + {S : Type*} [TopologicalSpace S] [T2Space S] + {Γ : Drawing S} {v : S} (hv : v ∈ Γ.V) + {r : Set S} (hr : r ∈ (deleteVertices Γ {v}).R) (hvr : v ∈ r) + {e : Set S} (he : e ∈ Γ.E) (hve : v ∈ closure e) : e ⊆ r := by + have hpre : IsPreconnected (insert v e) := + he.2.2.1.isConnected.isPreconnected.subset_closure (subset_insert v e) + (insert_subset hve subset_closure) + have hdis : Disjoint (insert v e) (deleteVertices Γ {v}).U := by + apply disjoint_left.mpr + intro x hx hxU + rcases hx with rfl | hxe + · exact region_subset hr hvr hxU + · have heNew : e ∉ (deleteVertices Γ {v}).E := by + intro h + have hdis := (deleteVertices_E Γ {v}).subset h + exact disjoint_left.mp hdis.2 ⟨hve, hv⟩ rfl + have hxV : x ∉ Γ.V := (he.2.1 hxe).2 + have hxV' : x ∉ (deleteVertices Γ {v}).V := + fun h => hxV ((deleteVertices_isSubdrawing Γ {v}).1 h) + obtain ⟨f, hf, hxf⟩ := (deleteVertices Γ {v}).exists_edge_of_mem hxU hxV' + have hef : e = f := Γ.edge_eq_of_mem he ((deleteVertices_isSubdrawing Γ {v}).2 hf) hxe hxf + exact heNew (hef.symm ▸ hf) + exact (subset_insert v e).trans (subset_region hr hpre hdis (mem_insert v e) hvr) + +/-- Assertion (i) of XII (7.4) in its two-cell-deletion base case. +The containment itself needs no two-cell hypothesis. -/ +theorem drawing_subset_delete_union_vertex_region + {S : Type*} [TopologicalSpace S] [T2Space S] + {Γ : Drawing S} {v : S} (hv : v ∈ Γ.V) + {r : Set S} (hr : r ∈ (deleteVertices Γ {v}).R) (hvr : v ∈ r) : + Γ.U ⊆ (deleteVertices Γ {v}).U ∪ r := by + intro x hx + by_cases hxNew : x ∈ (deleteVertices Γ {v}).U + · exact Or.inl hxNew + · right + rcases mem_deleted_vertex_or_incident_edge hx hxNew with rfl | ⟨e, he, hxe, hve⟩ + · exact hvr + · exact incident_edge_subset_deleted_vertex_region hv hr hvr he hve hxe + +/-- Assertion (iv) of XII (7.4), pages 262--263, when the deleted +drawing is two-cell. Old atoms within its merged region have +old distance at most two from the deleted vertex. -/ +theorem atom_in_deleted_vertex_region_distance_le_two + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hθ : 2 ≤ θ) (hd : HasTangleMetric Γ θ T d) + {v : S} (hv : v ∈ Γ.V) {r : Set S} + (hr : r ∈ (deleteVertices Γ {v}).R) (hvr : v ∈ r) + {a : Set S} (ha : a ∈ Γ.A) (har : a ⊆ r) : d a {v} ≤ 2 := by + have h91 := gm15_theorem_9_1 Γ θ T d hS inferInstance hd + have hvA : ({v} : Set S) ∈ Γ.A := Or.inl (Or.inl ⟨v, hv, rfl⟩) + rcases ha with (⟨u, hu, rfl⟩ | he) | hs + · have huv : u = v := by + by_contra hne + have huNew : u ∈ (deleteVertices Γ {v}).V := (deleteVertices_V Γ {v}).symm ▸ ⟨hu, hne⟩ + exact region_subset hr (har (mem_singleton u)) ((deleteVertices Γ {v}).V_subset_U huNew) + subst u + rw [h91.2.1 {v} hvA] + exact Nat.zero_le _ + · obtain ⟨x, hxe⟩ := he.1 + have hxnot : x ∉ (deleteVertices Γ {v}).U := region_subset hr (har hxe) + rcases mem_deleted_vertex_or_incident_edge (he.2.1 hxe).1 hxnot with hxv | ⟨f, hf, hxf, hvf⟩ + · exact ((he.2.1 hxe).2 (hxv.symm ▸ hv)).elim + · have hef : a = f := Γ.edge_eq_of_mem he hf hxe hxf + have hve : v ∈ closure a := hef.symm ▸ hvf + rw [h91.2.2.2.1 a (Or.inl (Or.inr he)) {v} hvA] + exact h91.2.2.2.2.2.2 v hv a he hve + · have hE : Γ.E.Nonempty := edgeSet_nonempty_of_isTangle_of_two_le hd.1.2.1 hθ + obtain ⟨x, hxa⟩ := region_nonempty hs + have hnear := deleted_vertex_mem_closure_of_region_meeting hS hv hs hr hvr ⟨x, hxa, har hxa⟩ + rw [h91.2.2.2.1 a (Or.inr hs) {v} hvA] + exact (h91.2.2.2.2.2.1 hE v hv a hs hnear).trans (by decide) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74DiscRegion.lean b/LeanPool/GraphMinor/GM12/Section74DiscRegion.lean new file mode 100644 index 0000000000..9bba4a8146 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74DiscRegion.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section72 +import LeanPool.GraphMinor.GM12.Section73DiscAttachment +import LeanPool.GraphMinor.GM12.Section73VertexReduction +import LeanPool.GraphMinor.GM11.Section810 + +/-! +# The merged region in the induction of XII (7.4) + +The disc reduction in XII (7.4), page 263, creates the region +`r ∪ (D \ {v})`. Its closure contains `v`. Any later subdrawing +whose region contains `v` therefore absorbs this whole region: +an open neighbourhood of `v` meets it, and connectedness keeps +it within one region. The old point set is contained in the +restricted point set together with the removed disc. Thus the +point-set containment from the smaller drawing passes back to +the original drawing. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- An old region whose closure contains a point of a new region +is wholly contained in that new region of a subdrawing. -/ +theorem region_subset_of_closure_mem_subdrawing_region + {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {Γ Γ' : Drawing S} (hsub : Γ'.IsSubdrawing Γ) + {r r' : Set S} (hr : r ∈ Γ.R) (hr' : r' ∈ Γ'.R) + {v : S} (hvr : v ∈ closure r) (hvr' : v ∈ r') : r ⊆ r' := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨x, hxr', hxr⟩ := mem_closure_iff.mp hvr r' (region_isOpen hr') hvr' + exact subset_region hr' (region_isPreconnected hr) + (disjoint_left.mpr fun y hyr hyU => region_subset hr hyr (hsub.U_subset hyU)) hxr hxr' + +/-- The removed normal disc lies in the final region containing +its boundary vertex, once the reduced drawing satisfies (7.4)(i). +This is the region containment used in the induction on page 263. -/ +theorem normal_disc_subset_final_vertex_region + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ Γ' : Drawing S} {D F r r' : Set S} {v : S} + (hD : IsClosedDisc D) (hbd : subBd D = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) (hFV : F ∩ Γ.V = {v}) + (hr : r ∈ Γ.R) (hFr : F \ {v} ⊆ r) + (hsub : Γ'.IsSubdrawing (Γ.interSet (closure (univ \ D)))) + (hr' : r' ∈ Γ'.R) (hvr' : v ∈ r') : + r ∪ D ⊆ r' := by + have hY := theorem_7_2_region hS hD hbd hn hFV hr hFr + have hvD : v ∈ D := by + have hvF : v ∈ F := (hFV.symm ▸ mem_singleton v).1 + have hvfr : v ∈ frontier D := ((subBd_eq_frontier D).symm.trans hbd).symm ▸ hvF + exact hD.isClosed.closure_subset_iff.mpr subset_rfl hvfr.1 + have hvY : v ∈ closure (r ∪ (D \ {v})) := + closure_mono subset_union_right (disc_subset_closure_punctured hD v hvD) + have hYr' := region_subset_of_closure_mem_subdrawing_region hS hsub hY hr' hvY hvr' + intro x hx + rcases hx with hx | hx + · exact hYr' (Or.inl hx) + · by_cases hxv : x = v + · exact hxv.symm ▸ hvr' + · exact hYr' (Or.inr ⟨hx, hxv⟩) + +/-- The point set removed by restricting outside a normal disc +is contained in that disc. -/ +theorem drawing_subset_outside_disc_union_disc + {S : Type*} [TopologicalSpace S] [T2Space S] + {Γ : Drawing S} {D F : Set S} (hbd : subBd D = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) : + Γ.U ⊆ (Γ.interSet (closure (univ \ D))).U ∪ D := by + have hfrD : frontier D = F := (subBd_eq_frontier D).symm.trans hbd + have hnorm : frontier (closure (univ \ D)) ∩ Γ.U ⊆ Γ.V := by + rw [← compl_eq_univ_sdiff, closure_compl, frontier_compl] + intro x hx + exact hn ⟨hfrD ▸ frontier_interior_subset hx.1, hx.2⟩ + rw [interSet_U_eq_of_normal_frontier isClosed_closure hnorm] + intro x hx + by_cases hxD : x ∈ D + · exact Or.inr hxD + · exact Or.inl ⟨hx, subset_closure ⟨mem_univ x, hxD⟩⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74EdgeDeletion.lean b/LeanPool/GraphMinor/GM12/Section74EdgeDeletion.lean new file mode 100644 index 0000000000..4ea0a192a8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74EdgeDeletion.lean @@ -0,0 +1,125 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section76 +import LeanPool.GraphMinor.GM11.GlueFaces +import LeanPool.GraphMinor.GM11.Section4c +import LeanPool.GraphMinor.GM11.Section7 + +/-! +# Gluing disc regions while deleting an edge + +The cellularity assertion in the base case of XII (7.4), pages +262--263, requires gluing the old disc regions around the vertex. +Here an edge between two distinct disc regions is removed. Their +union with the open edge is a disc by the proved gluing theorem. +Its boundary remains in the drawing after edge deletion, so this +union is precisely the new region. Every other new region misses +the removed edge and was already an old region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A nonempty open connected set missing a drawing and with +its remaining closure in the drawing is a whole region. -/ +theorem mem_regions_of_open_connected_closure_subset + {S : Type*} [TopologicalSpace S] {K : Drawing S} {A : Set S} + (hA : IsOpen A) (hc : IsConnected A) (hdis : Disjoint A K.U) + (hcl : closure A ⊆ A ∪ K.U) : A ∈ K.R := by + obtain ⟨x, hx⟩ := hc.1 + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem (disjoint_left.mp hdis hx) + have hAr : A ⊆ r := subset_region hr hc.2 hdis hx hxr + have hcov : r ⊆ A ∪ (closure A)ᶜ := by + intro y hyr + by_cases hycl : y ∈ closure A + · exact Or.inl ((hcl hycl).resolve_right (region_subset hr hyr)) + · exact Or.inr hycl + have hrA : r ⊆ A := (region_isPreconnected hr).subset_left_of_subset_union hA + isClosed_closure.isOpen_compl + (disjoint_left.mpr fun y hya hyc => hyc (subset_closure hya)) hcov ⟨x, hxr, hx⟩ + exact (Subset.antisymm hrA hAr) ▸ hr + +/-- Removing an edge between two distinct open-disc regions +merges them into exactly their union with that edge. -/ +theorem merged_region_deleteEdge + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {K : Drawing S} {e p q : Set S} + (he : e ∈ K.E) (hp : p ∈ K.R) (hq : q ∈ K.R) (hpq : p ≠ q) + (hdp : IsOpenDisc p) (hdq : IsOpenDisc q) + (hep : e ⊆ closure p) (heq : e ⊆ closure q) : + p ∪ q ∪ e ∈ (K.deleteEdge e).R ∧ IsOpenDisc (p ∪ q ∪ e) := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hdisc := theorem_glue_regions hS he hp hq hpq hdp hdq hep heq + refine ⟨mem_regions_of_open_connected_closure_subset hdisc.1 + hdisc.isPathConnected.isConnected ?_ ?_, hdisc⟩ + · apply disjoint_left.mpr + intro x hx hxU + rw [deleteEdge_U K he] at hxU + rcases hx with (hxp | hxq) | hxe + · exact region_subset hp hxp hxU.1 + · exact region_subset hq hxq hxU.1 + · exact hxU.2 hxe + · intro x hx + rw [closure_union, closure_union] at hx + have hxOld : x ∈ (p ∪ q ∪ e) ∪ K.U := by + rcases hx with (hxp | hxq) | hxe + · rcases closure_region_subset hp hxp with h | h + · exact Or.inl (Or.inl (Or.inl h)) + · exact Or.inr h + · rcases closure_region_subset hq hxq with h | h + · exact Or.inl (Or.inl (Or.inr h)) + · exact Or.inr h + · exact Or.inr (K.closure_subset_U he hxe) + rcases hxOld with hxA | hxK + · exact Or.inl hxA + · by_cases hxe : x ∈ e + · exact Or.inl (Or.inr hxe) + · exact Or.inr ((deleteEdge_U K he).symm ▸ ⟨hxK, hxe⟩) + +/-- Deleting an edge between two distinct regions preserves a + two-cell drawing. The merged region is a disc by gluing, and + every other region was already an old disc region. -/ +theorem isTwoCell_deleteEdge_of_distinct_regions + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {K : Drawing S} + (hK : (PaintingOrDrawing.drawing K).IsTwoCell) {e p q : Set S} + (he : e ∈ K.E) (hp : p ∈ K.R) (hq : q ∈ K.R) (hpq : p ≠ q) + (hep : e ⊆ closure p) (heq : e ⊆ closure q) : + (PaintingOrDrawing.drawing (K.deleteEdge e)).IsTwoCell := by + obtain ⟨hmerge, hdmerge⟩ := merged_region_deleteEdge hS he hp hq hpq (hK.2 p hp) + (hK.2 q hq) hep heq + refine ⟨inferInstance, ?_⟩ + intro r hr + by_cases hmeet : (r ∩ e).Nonempty + · obtain ⟨x, hxr, hxe⟩ := hmeet + have hreq : r = p ∪ q ∪ e := region_eq_of_mem hr hmerge hxr (Or.inr hxe) + exact hreq.symm ▸ hdmerge + · obtain ⟨x, hxr⟩ := region_nonempty hr + have hxK : x ∉ K.U := by + intro hx + have hxn := region_subset hr hxr + rw [deleteEdge_U K he] at hxn + exact hxn ⟨hx, fun hxe => hmeet ⟨x, hxr, hxe⟩⟩ + obtain ⟨s, hs, hxs⟩ := exists_region_of_notMem hxK + have hrs : r ⊆ s := subset_region hs (region_isPreconnected hr) + (disjoint_left.mpr fun y hyr hyK => by + have hyN := region_subset hr hyr + rw [deleteEdge_U K he] at hyN + exact hyN ⟨hyK, fun hye => hmeet ⟨y, hyr, hye⟩⟩) hxr hxs + have hsr : s ⊆ r := subset_region hr (region_isPreconnected hs) + (disjoint_left.mpr fun y hys hyN => region_subset hs hys + ((deleteEdge_isSubdrawing K e).U_subset hyN)) hxs hxr + exact (Subset.antisymm hrs hsr).symm ▸ hK.2 s hs + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74FiniteGluing.lean b/LeanPool/GraphMinor/GM12/Section74FiniteGluing.lean new file mode 100644 index 0000000000..0c8fa69729 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74FiniteGluing.lean @@ -0,0 +1,218 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Corners +public import LeanPool.GraphMinor.GM12.Section76 +import LeanPool.GraphMinor.GM12.Section74RegionMerge +import LeanPool.GraphMinor.GM12.Section74LeafTwoCell +import LeanPool.GraphMinor.GM12.Section77 +import Mathlib.Data.Finset.Card + +/-! +# Finite gluing of the corner regions at a vertex + +In the base case of XII (7.4), pages 262--263, the corner regions +at the vertex are distinct. Keep one incident edge. Starting in +one corner, glue successive corner regions across all the other +incident edges. At each step the fresh corner region is distinct +from the merged region, so deleting their common edge preserves +two-cellularity. A finite cyclic order has an exit from every +proper nonempty subset. Thus the process reaches every corner. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +private def removedCornerEdges {α β : Type*} (f : α → β) (keep : α) (A : Finset α) : Set β := + {e | ∃ k ∈ A, k ≠ keep ∧ f k = e} + +private theorem removedCornerEdges_insert {α β : Type*} [DecidableEq α] (f : α → β) (keep b : α) + (A : Finset α) (hb : b ≠ keep) : + removedCornerEdges f keep (insert b A) = insert (f b) (removedCornerEdges f keep A) := by + ext e + simp only [removedCornerEdges, mem_ofPred_eq, Finset.mem_insert, mem_insert_iff] + constructor + · rintro ⟨k, hk | hk, hkeep, he⟩ + · exact Or.inl (he.symm.trans (congrArg f hk)) + · exact Or.inr ⟨k, hk, hkeep, he⟩ + · rintro (he | ⟨k, hk, hkeep, hke⟩) + · exact ⟨b, Or.inl rfl, hb, he.symm⟩ + · exact ⟨k, Or.inr hk, hkeep, hke⟩ + +private theorem exists_exit_of_reach {α : Type*} (next : α → α) + (hreach : ∀ a b, Relation.ReflTransGen (fun x y => y = next x) a b) + (A : Finset α) {keep : α} (hkeep : keep ∈ A) (hne : ∃ b, b ∉ A) : + ∃ a ∈ A, next a ∉ A := by + by_contra h + push Not at h + obtain ⟨b, hb⟩ := hne + have hall : ∀ c, c ∈ A := by + intro c + have hr := hreach keep c + induction hr with + | refl => exact hkeep + | tail hr hs ih => exact hs ▸ h _ ih + exact hb (hall b) + +/-- Finite gluing around a vertex with distinct corner regions +and with each incident edge represented once. All incident edges +except the chosen one can be deleted while keeping two-cellularity. -/ +theorem exists_twoCell_after_gluing_corners + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} + (hΓ : (PaintingOrDrawing.drawing Γ).IsTwoCell) + {γ : Set S → unitInterval → S} {v : S} + {next : halfEdges Γ γ v → halfEdges Γ γ v} + {ρ : halfEdges Γ γ v → Set S} (hcor : IsCorners Γ γ v next ρ) + (hρ : Function.Injective ρ) + (hEdges : Function.Injective (fun k : halfEdges Γ γ v => k.1.1)) + (keep : halfEdges Γ γ v) : + ∃ D : Drawing S, D.IsSubdrawing Γ ∧ D.V = Γ.V ∧ + D.E = Γ.E \ {e | ∃ k : halfEdges Γ γ v, k ≠ keep ∧ k.1.1 = e} ∧ + (PaintingOrDrawing.drawing D).IsTwoCell := by + let α := halfEdges Γ γ v + let : Fintype α := (finite_halfEdges Γ γ v).fintype + let f : α → Set S := fun k => k.1.1 + let R := removedCornerEdges f keep + let good : ℕ → Prop := fun n => ∃ (A : Finset α) (D : Drawing S) (T : Set S), + keep ∈ A ∧ (Finset.univ \ A).card = n ∧ D.IsSubdrawing Γ ∧ D.V = Γ.V ∧ + D.E = Γ.E \ R A ∧ (PaintingOrDrawing.drawing D).IsTwoCell ∧ T ∈ D.R ∧ + (∀ k ∈ A, ρ k ⊆ T) ∧ (∀ k ∉ A, ρ k ∈ D.R) + have hRone : R {keep} = ∅ := by + ext e + simp [R, removedCornerEdges] + have hex : ∃ n, good n := by + refine ⟨_, {keep}, Γ, ρ keep, by simp, rfl, Drawing.IsSubdrawing.refl Γ, rfl, ?_, hΓ, + hcor.region keep, ?_, ?_⟩ + · rw [hRone, sdiff_empty] + · intro k hk + have hkEq : k = keep := Finset.mem_singleton.mp hk + exact hkEq ▸ Subset.rfl + · intro k _ + exact hcor.region k + classical + obtain ⟨A, D, T, hkeep, hcard, hDΓ, hDV, hDE, hD, hTR, hcontain, houtside⟩ := Nat.find_spec hex + by_cases hAll : A = Finset.univ + · refine ⟨D, hDΓ, hDV, ?_, hD⟩ + rw [hDE, hAll] + congr 1 + ext e + simp only [R, removedCornerEdges, mem_ofPred_eq, Finset.mem_univ, true_and] + rfl + have hne : ∃ b : α, b ∉ A := by + by_contra h + push Not at h + exact hAll (Finset.eq_univ_of_forall h) + obtain ⟨a, ha, hb⟩ := exists_exit_of_reach next hcor.reach A hkeep hne + let b := next a + have hbA : b ∉ A := hb + have hbkeep : b ≠ keep := fun h => hbA ((congrArg (fun x => x ∈ A) h.symm).mp hkeep) + have hbD : f b ∈ D.E := by + rw [hDE] + refine ⟨b.2.1, ?_⟩ + rintro ⟨k, hk, _, hke⟩ + exact hbA ((congrArg (fun x => x ∈ A) (hEdges hke)).mp hk) + have hneT : ∀ k ∉ A, ρ k ≠ T := by + intro k hk hEq + obtain ⟨x, hx⟩ := region_nonempty (hcor.region keep) + have hxT := hcontain keep hkeep hx + have heq : ρ keep = ρ k := region_eq_of_mem (hcor.region keep) (hcor.region k) hx + (hEq.symm ▸ hxT) + exact hk ((hρ heq) ▸ hkeep) + have hbR : ρ b ∈ D.R := houtside b hb + have hTb : T ≠ ρ b := (hneT b hb).symm + have heT : f b ⊆ closure T := (hcor.left a).trans (closure_mono (hcontain a ha)) + have heb : f b ⊆ closure (ρ b) := hcor.right a + have hDnew := isTwoCell_deleteEdge_of_distinct_regions hS hD hbD hTR hbR hTb heT heb + obtain ⟨hTnew, _⟩ := merged_region_deleteEdge hS hbD hTR hbR hTb (hD.2 T hTR) (hD.2 + (ρ b) hbR) heT heb + have hRinsert : R (insert b A) = insert (f b) (R A) := by + simpa only [R] using removedCornerEdges_insert f keep b A hbkeep + have hDEnew : (D.deleteEdge (f b)).E = Γ.E \ R (insert b A) := by + rw [deleteEdge_E, hDE, hRinsert] + ext e + simp only [mem_sdiff, mem_singleton_iff, mem_insert_iff] + tauto + have hnew : good (Finset.univ \ insert b A).card := by + refine ⟨insert b A, D.deleteEdge (f b), T ∪ ρ b ∪ f b, Finset.mem_insert_of_mem hkeep, rfl, + (deleteEdge_isSubdrawing D (f b)).trans hDΓ, (deleteEdge_V D (f b)).trans hDV, + hDEnew, hDnew, hTnew, ?_, ?_⟩ + · intro k hk + rcases Finset.mem_insert.mp hk with hk | hk + · exact hk ▸ (subset_union_right.trans subset_union_left) + · exact (hcontain k hk).trans (subset_union_left.trans subset_union_left) + · intro k hk + have hkA : k ∉ A := fun h => hk (Finset.mem_insert_of_mem h) + have hkb : k ≠ b := fun h => hk (Finset.mem_insert.mpr (Or.inl h)) + exact region_deleteEdge_of_ne_merged_pair hS hbD hTR hbR hTb + (hD.2 T hTR) (hD.2 (ρ b) hbR) heT heb (houtside k hkA) (hneT k hkA) + (fun h => hkb (hρ h)) + have hle := Nat.find_min' hex hnew + have hbDiff : b ∈ Finset.univ \ A := Finset.mem_sdiff.mpr ⟨Finset.mem_univ b, hb⟩ + have hpos : 0 < (Finset.univ \ A).card := Finset.card_pos.mpr ⟨b, hbDiff⟩ + rw [Finset.sdiff_insert, Finset.card_erase_of_mem hbDiff] at hle + omega + +/-- Distinct corner regions give cellularity after vertex deletion +when each incident edge has one half-edge there and the retained +edge is a line. The finite gluing leaves precisely this leaf edge. -/ +theorem isTwoCell_delete_vertex_of_corner_data + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} + (hΓ : (PaintingOrDrawing.drawing Γ).IsTwoCell) + {γ : Set S → unitInterval → S} (hγ : EdgePar Γ γ) {v : S} (hv : v ∈ Γ.V) + {next : halfEdges Γ γ v → halfEdges Γ γ v} + {ρ : halfEdges Γ γ v → Set S} (hcor : IsCorners Γ γ v next ρ) + (hρ : Function.Injective ρ) + (hEdges : Function.Injective (fun k : halfEdges Γ γ v => k.1.1)) + (keep : halfEdges Γ γ v) {u : S} (huv : u ≠ v) + (hcap : closure keep.1.1 ∩ Γ.V = {u, v}) + (hLine : IsLineWithEnds (closure keep.1.1) u v) : + (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell := by + obtain ⟨D, hDΓ, hDV, hDE, hD⟩ := exists_twoCell_after_gluing_corners hS hΓ hcor hρ hEdges keep + have hhalf : ∀ k : halfEdges Γ γ v, v ∈ closure k.1.1 := by + intro k + exact (congrArg (fun x => x ∈ closure k.1.1) k.2.2).mp + (end_mem_closure hγ k.2.1 k.1.2) + have hkept : keep.1.1 ∈ D.E := by + rw [hDE] + refine ⟨keep.2.1, ?_⟩ + rintro ⟨k, hk, hke⟩ + exact hk (hEdges hke) + have hleaf : ∀ f ∈ D.E, f ≠ keep.1.1 → v ∉ closure f := by + intro f hf hne hvf + have hfΓ : f ∈ Γ.E := hDΓ.2 hf + obtain ⟨b, hb⟩ := exists_end_eq hγ hfΓ hv hvf + let k : halfEdges Γ γ v := ⟨(f, b), hfΓ, hb⟩ + have hk : k ≠ keep := fun hk => hne (congrArg (fun j : halfEdges Γ γ v => j.1.1) hk) + exact (hDE.subset hf).2 ⟨k, hk, rfl⟩ + have hcapD : closure keep.1.1 ∩ D.V = {u, v} := hDV.symm ▸ hcap + have hcell := isTwoCell_delete_leaf hS hD hkept huv hcapD hLine hleaf + have heq : deleteVertices D {v} = deleteVertices Γ {v} := by + apply Drawing.ext_of_V_E + · rw [deleteVertices_V, deleteVertices_V, hDV] + · rw [deleteVertices_E, deleteVertices_E] + ext f + constructor + · intro hf + exact ⟨hDΓ.2 hf.1, hDV ▸ hf.2⟩ + · intro hf + refine ⟨?_, hDV.symm ▸ hf.2⟩ + rw [hDE] + refine ⟨hf.1, ?_⟩ + rintro ⟨k, _, hkf⟩ + have hvf : v ∈ closure f := hkf ▸ hhalf k + exact disjoint_left.mp hf.2 ⟨hvf, hv⟩ rfl + exact heq ▸ hcell + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74Induction.lean b/LeanPool/GraphMinor/GM12/Section74Induction.lean new file mode 100644 index 0000000000..4074c4e538 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74Induction.lean @@ -0,0 +1,119 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section74Base +import LeanPool.GraphMinor.GM12.Section74Components +import LeanPool.GraphMinor.GM12.Section74DiscRegion +import LeanPool.GraphMinor.GM12.Section73VertexReduction +import LeanPool.GraphMinor.GM12.Section73DiscPreprocess +import LeanPool.GraphMinor.GM11.Section810 + +/-! +# The disc-removal induction step of XII (7.4) + +On page 263, remove a selected normal disc through the vertex +that contains an old edge. Its outside restriction has fewer +edges. Apply (7.2), then the induction hypothesis to this smaller +drawing. Components are preserved across the normal boundary. +The final region absorbs the removed disc. The shared-atom +lower bounds compose, and the lost-atom bound from (7.2) proves +the remaining upper bound for old atoms in the final region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 GM14 + +/-- The disc-removal case of the edge induction proving XII +(7.4), page 263. The induction hypothesis is quantified over +all drawings with strictly fewer edges and the same order. -/ +theorem theorem_7_4_disc_induction + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hθ : 2 ≤ θ) (hd : HasTangleMetric Γ θ T d) + {v : S} (hv : v ∈ Γ.V) + (hInd : ∀ (Λ : Drawing S) + (U : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (δ : Set S → Set S → ℕ), + Λ.E.ncard < Γ.E.ncard → HasTangleMetric Λ θ U δ → v ∈ Λ.V → + ∃ (H : Drawing S) (U' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (δ' : Set S → Set S → ℕ) (s : Set S), + H.IsSubdrawing (deleteVertices Λ {v}) ∧ H.U ∈ componentsIn (deleteVertices Λ {v}).U ∧ + HasTangleMetric H (θ - 1) U' δ' ∧ s ∈ H.R ∧ v ∈ s ∧ Λ.U ⊆ H.U ∪ s ∧ + (∀ a ∈ Λ.A ∩ H.A, ∀ b ∈ Λ.A ∩ H.A, δ a b - 2 ≤ δ' a b) ∧ + (∀ a ∈ Λ.A ∩ H.A, δ a {v} - 1 ≤ δ' a s) ∧ + (∀ a ∈ Λ.A, a ⊆ s → δ a {v} ≤ 2)) + {D F : Set S} (hD : IsClosedDisc D) (hF : IsOArc F) (hbd : subBd D = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) (hFV : F ∩ Γ.V = {v}) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) + {e : Set S} (he : e ∈ Γ.E) (heD : e ⊆ D) : + ∃ (Γ' : Drawing S) (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r : Set S), + Γ'.IsSubdrawing (deleteVertices Γ {v}) ∧ Γ'.U ∈ componentsIn (deleteVertices Γ {v}).U ∧ + HasTangleMetric Γ' (θ - 1) T' d' ∧ r ∈ Γ'.R ∧ v ∈ r ∧ Γ.U ⊆ Γ'.U ∪ r ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 2 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a {v} - 1 ≤ d' a r) ∧ + (∀ a ∈ Γ.A, a ⊆ r → d a {v} ≤ 2) := by + obtain ⟨r₀, hr₀, hFr⟩ := exists_region_of_normal_circle_single_vertex hF hn hFV + obtain ⟨_, hlost, d₀, _, hd₀, _, _, hcomp, _⟩ := + theorem_7_2_proof hS hθ hd hD hbd hn hFV hr₀ hFr hm + let Λ := Γ.interSet (closure (univ \ D)) + have hΛΓ : Λ.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hvΛ : v ∈ Λ.V := by + apply (mem_interSet_V_iff isClosed_closure).mpr + have hvF : v ∈ F := (hFV.symm ▸ mem_singleton v).1 + have hvfr : v ∈ frontier D := ((subBd_eq_frontier D).symm.trans hbd).symm ▸ hvF + rw [frontier_eq_closure_inter_closure] at hvfr + exact ⟨hv, by simpa only [compl_eq_univ_sdiff] using hvfr.2⟩ + have hsmall : Λ.E.ncard < Γ.E.ncard := ncard_edges_outside_lt_of_edge_inside + (fun x hx => hn ⟨((subBd_eq_frontier D).symm.trans hbd) ▸ hx.1, hx.2⟩) he heD + obtain ⟨Γ', T', d', r, hΓ'Λ, hcomponent, hd', hr, hvr, hcover, hi, hii, hiii⟩ := + hInd Λ _ d₀ hsmall hd₀ hvΛ + have hΓ' : Γ'.IsSubdrawing Λ := hΓ'Λ.trans (deleteVertices_isSubdrawing Λ {v}) + have hΓ'Γ : Γ'.IsSubdrawing Γ := hΓ'.trans hΛΓ + have hdelete : Γ'.IsSubdrawing (deleteVertices Γ {v}) := by + apply isSubdrawing_deleteVertices_iff.mpr + exact ⟨hΓ'Γ, (isSubdrawing_deleteVertices_iff.mp hΓ'Λ).2⟩ + have hshared : ∀ a ∈ Γ.A ∩ Γ'.A, a ∈ Λ.A ∩ Γ'.A := by + intro a ha + exact ⟨shared_atom_mem_intermediate hΛΓ hΓ' ha.1 ha.2, ha.2⟩ + have hDr := normal_disc_subset_final_vertex_region hS hD hbd hn hFV hr₀ hFr hΓ' hr hvr + have hcoverΓ : Γ.U ⊆ Γ'.U ∪ r := by + intro x hx + rcases drawing_subset_outside_disc_union_disc hbd hn hx with hxΛ | hxD + · exact hcover hxΛ + · exact Or.inr (hDr (Or.inr hxD)) + have hvA : ({v} : Set S) ∈ Γ.A ∩ Λ.A := + ⟨Or.inl (Or.inl ⟨v, hv, rfl⟩), Or.inl (Or.inl ⟨v, hvΛ, rfl⟩)⟩ + refine ⟨Γ', T', d', r, hdelete, + component_after_normal_disc_reduction hbd hn hFV hcomponent, + hd', hr, hvr, hcoverΓ, ?_, ?_, ?_⟩ + · intro a ha b hb + have haΛ := hshared a ha + have hbΛ := hshared b hb + have hle := hcomp a ⟨ha.1, haΛ.1⟩ b ⟨hb.1, hbΛ.1⟩ + have hbound := hi a haΛ b hbΛ + omega + · intro a ha + have haΛ := hshared a ha + have hle := hcomp a ⟨ha.1, haΛ.1⟩ {v} hvA + have hbound := hii a haΛ + omega + · intro a ha har + by_cases haΛ : a ∈ Λ.A + · have hle := hcomp a ⟨ha, haΛ⟩ {v} hvA + have hbound := hiii a haΛ har + omega + · exact (hlost a ⟨ha, haΛ⟩).trans (by decide) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74LeafAccess.lean b/LeanPool/GraphMinor/GM12/Section74LeafAccess.lean new file mode 100644 index 0000000000..0f97432b40 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74LeafAccess.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscGrow +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM11.RadialAccess +import LeanPool.GraphMinor.Surface.ArcInPath + +/-! +# Extending the leaf edge into its old region + +The slit-disc construction for XII (7.4), pages 262--263, +continues the leaf edge by an arc into the incident region. +XI's leaf-access lemma supplies a path from the leaf whose +positive times stay in that region. Erasing repetitions gives +a line with the same ends. It meets the old drawing only at +the leaf, so it can be joined to a final segment of the edge +before constructing the lens. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 unitInterval + +/-- An access line from a leaf into a region touching it, +meeting the old drawing in exactly the leaf endpoint. -/ +theorem exists_access_line_from_leaf + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ : Drawing S} {e : Set S} (he : e ∈ Γ.E) + {u v : S} (huv : u ≠ v) (hcap : closure e ∩ Γ.V = {u, v}) + (hL : IsLineWithEnds (closure e) u v) + (hleaf : ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f) + {r : Set S} (hr : r ∈ Γ.R) (hvr : v ∈ closure r) : + ∃ (B : Set S) (z : S), IsLineWithEnds B v z ∧ z ∈ r ∧ + B \ {v} ⊆ r ∧ B ∩ Γ.U = {v} := by + have hvCap : v ∈ closure e ∩ Γ.V := hcap.symm ▸ (Or.inr rfl : v ∈ ({u, v} : Set S)) + have hvG : v ∈ Γ.U := Γ.V_subset_U hvCap.2 + obtain ⟨g, hg, hg0, hgpos⟩ := exists_path_of_leaf hS Γ he huv hcap hL hleaf hr hvr + have hg1 : g 1 ∈ r := hgpos 1 zero_lt_one + have hends : g 0 ≠ g 1 := by + intro h + exact region_subset hr hg1 (h ▸ hg0.symm ▸ hvG) + obtain ⟨a, ha, hai, ha0, ha1, har⟩ := exists_arc_of_path hg hends + have hline : IsLineWithEnds (range a) v (g 1) := by + have hh := (show IsArcMap a from ⟨ha, hai⟩).isLineWithEnds + rwa [ha0, hg0, ha1] at hh + have hAr : range a \ {v} ⊆ r := by + rintro x ⟨⟨s, rfl⟩, hne⟩ + obtain ⟨t, ht⟩ := har (mem_range_self s) + have ht0 : t ≠ 0 := by + intro heq + exact hne (ht.symm.trans (heq ▸ hg0)) + exact ht ▸ hgpos t (lt_of_le_of_ne (unitInterval.nonneg t) (Ne.symm ht0)) + refine ⟨range a, g 1, hline, hg1, hAr, ?_⟩ + apply Subset.antisymm + · intro x hx + by_contra hne + exact region_subset hr (hAr ⟨hx.1, hne⟩) hx.2 + · refine singleton_subset_iff.mpr ⟨?_, hvG⟩ + exact ⟨0, ha0.trans hg0⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74LeafDiscGlue.lean b/LeanPool/GraphMinor/GM12/Section74LeafDiscGlue.lean new file mode 100644 index 0000000000..0cabada248 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74LeafDiscGlue.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.GM11.GlueDiscs +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.DiscUnion +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Enclosing a circle across a leaf neighbourhood + +For the final gluing at the leaf in XII (7.4), pages 262--263, +let `A` be the old open-disc region and `N` a closed disc around +the removed end of the edge. The part of a circle outside the +interior of `N` is compact in `A`. XI's disc gluing lemma puts +that compact set in a closed disc of `A` meeting `N` in one +boundary line. Their union is a closed disc. The circle bounds +a smaller disc within this union. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 unitInterval + +/-- A circle whose part outside a suitable leaf disc lies in an +old disc region bounds a disc in the union of those two sets. +The geometric boundary and connectivity conditions describe the +local disc at the leaf, before applying the gluing construction. -/ +theorem exists_disc_bounding_circle_by_leaf_gluing + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {A N F : Set S} + (hA : IsOpenDisc A) (hN : IsClosedDisc N) (hF : IsOArc F) + {ℓ : I → S} (hℓ : Continuous ℓ) (h0 : ℓ 0 ∉ A) (h1 : ℓ 1 ∉ A) + (hinj : InjOn ℓ (Ioo 0 1)) (hbd : discBd N ∩ A = ℓ '' Ioo 0 1) + (hT : IsPreconnected (discInt N ∩ A)) (hTne : (discInt N ∩ A).Nonempty) + (hFA : F \ discInt N ⊆ A) : + ∃ D : Set S, D ⊆ A ∪ N ∧ IsClosedDisc D ∧ discBd D = F := by + have hbound : ∀ (E : Set S), IsClosedDisc E → E ⊆ A ∪ N → F ⊆ E → + ∃ D : Set S, D ⊆ A ∪ N ∧ IsClosedDisc D ∧ discBd D = F := by + intro E hE hEsub hFE + obtain ⟨D, hD, _⟩ := disc_oArc E F hE hFE hF + exact ⟨D, hD.1.trans hEsub, hD.2.1, hD.2.2.1⟩ + by_cases hFN : F ⊆ N + · exact hbound N hN subset_union_right hFN + let C := F \ discInt N + have hCc : IsCompact C := (isCompact_of_isOArc hF).inter_right + (hN.isOpen_discInt (fun x => (hS.2.2 x).isManifoldPoint)).isClosed_compl + have hCne : C.Nonempty := by + obtain ⟨x, hxF, hxN⟩ := not_subset.mp hFN + exact ⟨x, hxF, fun hx => hxN (discInt_subset N hx)⟩ + have hCdis : Disjoint C (discInt N) := disjoint_sdiff_left + obtain ⟨ρ, L, s, t, hρ, hρA, hCρ, hmeet, hL, hLρ, hLN⟩ := + exists_disc_off hS hA hN hℓ h0 h1 hinj hbd hT hTne hCc hFA hCdis hCne + have hUnion : IsClosedDisc (ρ ∪ N) := (disc_union ρ N L s t hρ hN hL hmeet hLρ hLN).1 + apply hbound (ρ ∪ N) hUnion (union_subset_union_left N hρA) + intro x hxF + by_cases hxN : x ∈ discInt N + · exact Or.inr (discInt_subset N hxN) + · exact Or.inl (hCρ ⟨hxF, hxN⟩) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74LeafLens.lean b/LeanPool/GraphMinor/GM12/Section74LeafLens.lean new file mode 100644 index 0000000000..3356ed8a7f --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74LeafLens.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM12.Section73ImageArc +import LeanPool.GraphMinor.GM12.Section74LensUniverses +import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.Surface.Disc +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.GM11.Regions + +/-! +# A slit disc around the end of a leaf edge + +The leaf step in XII (7.4), pages 262--263, extends the last +part of the leaf edge by an access arc into its incident region. +A lens around the combined line puts the leaf endpoint inside +and the other end on its boundary. The closed set `Z` consists +of the drawing that remains and the earlier part of the leaf +edge. The lens misses `Z` except at its boundary end. Hence it +lies in the new region and meets the old drawing in exactly the +last part of the leaf edge, a slit with only one boundary point. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A lens around a leaf segment continued by an access arc is +a closed slit disc in the new region. The sets `L`, `B`, and `Z` +are the leaf segment, its access continuation, and the closed +remainder of the old drawing. -/ +theorem exists_leaf_slit_lens + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {K : Drawing S} {G L B Z r : Set S} {w v z : S} + (hL : IsLineWithEnds L w v) (hB : IsLineWithEnds B v z) + (hLB : L ∩ B = {v}) (hZ : IsClosed Z) (hLZ : L ∩ Z = {w}) + (hBZ : Disjoint B Z) (hG : G ⊆ Z ∪ L) (hLG : L ⊆ G) + (hKZ : K.U ⊆ Z) (hwK : w ∉ K.U) (hr : r ∈ K.R) (hvr : v ∈ r) : + ∃ N : Set S, IsClosedDisc N ∧ N ⊆ r ∧ L ⊆ N ∧ + N ∩ G = L ∧ discBd N ∩ L = {w} := by + have hExt : IsLineWithEnds (L ∪ B) w z := Surface.IsLineWithEnds.union hL hB hLB + have hwz : w ≠ z := lineWithEnds_ends_ne hExt + have hExtZ : (L ∪ B) ∩ Z ⊆ {w, z} := by + intro x hx + rcases hx.1 with hxL | hxB + · exact Or.inl (by have hh : x ∈ L ∩ Z := ⟨hxL, hx.2⟩; rwa [hLZ] at hh) + · exact (disjoint_left.mp hBZ hxB hx.2).elim + obtain ⟨N, hN, hExtN, hNZ, hwbd, _, hbdExt⟩ := + exists_edge_lens_disc_universes hS hExt hwz hZ hExtZ + have hzZ : z ∉ Z := disjoint_left.mp hBZ hB.right_mem + have hNZw : N ∩ Z ⊆ {w} := by + intro x hx + exact (hNZ hx).resolve_right (fun hxz => hzZ (hxz ▸ hx.2)) + have hLN : L ⊆ N := subset_union_left.trans hExtN + have hNdis : Disjoint N K.U := by + apply disjoint_left.mpr + intro x hxN hxK + have hxw : x = w := hNZw ⟨hxN, hKZ hxK⟩ + exact hwK (hxw ▸ hxK) + have hNr : N ⊆ r := subset_region hr hN.isPathConnected.isConnected.isPreconnected + hNdis (hLN hL.right_mem) hvr + have hNG : N ∩ G = L := by + apply Subset.antisymm + · intro x hx + rcases hG hx.2 with hxZ | hxL + · have hxw : x = w := hNZw ⟨hx.1, hxZ⟩ + exact hxw.symm ▸ hL.left_mem + · exact hxL + · intro x hx + exact ⟨hLN hx, hLG hx⟩ + have hzL : z ∉ L := by + intro hz + have hzv : z = v := by + have hh : z ∈ L ∩ B := ⟨hz, hB.right_mem⟩ + rw [hLB] at hh + exact hh + exact lineWithEnds_ends_ne hB hzv.symm + have hbdL : discBd N ∩ L = {w} := by + apply Subset.antisymm + · intro x hx + exact (hbdExt ⟨hx.1, Or.inl hx.2⟩).resolve_right (fun hxz => hzL (hxz ▸ hx.2)) + · exact singleton_subset_iff.mpr ⟨hwbd, hL.left_mem⟩ + exact ⟨N, hN, hNr, hLN, hNG, hbdL⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74LeafRegion.lean b/LeanPool/GraphMinor/GM12/Section74LeafRegion.lean new file mode 100644 index 0000000000..c1e1f03d4d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74LeafRegion.lean @@ -0,0 +1,85 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section74DeletedRegion +import LeanPool.GraphMinor.GM12.Section74DiscRegion +import LeanPool.GraphMinor.GM11.LeafNbhd +import LeanPool.GraphMinor.GM11.Regions + +/-! +# The merged region at a leaf + +In the last gluing step for the base case of XII (7.4), pages +262--263, the vertex has one incident edge. The leaf-neighbourhood +lemma shows that just one old region reaches the vertex. Deleting +the leaf therefore enlarges exactly that region by the open edge +and the leaf endpoint. This identifies the set for the final +open-disc assertion. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Only one region of a drawing can reach a leaf vertex. -/ +theorem regions_eq_of_leaf_vertex + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ : Drawing S} {e : Set S} (he : e ∈ Γ.E) + {u v : S} (huv : u ≠ v) (hcap : closure e ∩ Γ.V = {u, v}) + (hL : IsLineWithEnds (closure e) u v) + (hleaf : ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f) + {r s : Set S} (hr : r ∈ Γ.R) (hs : s ∈ Γ.R) + (hvr : v ∈ closure r) (hvs : v ∈ closure s) : r = s := by + obtain ⟨Z, hZ, hvZ, hjoin⟩ := exists_leaf_nbhd hS Γ he huv hcap hL hleaf isOpen_univ (mem_univ v) + obtain ⟨a, haZ, har⟩ := mem_closure_iff.mp hvr Z hZ hvZ + obtain ⟨b, hbZ, hbs⟩ := mem_closure_iff.mp hvs Z hZ hvZ + obtain ⟨A, hA, hdis, haA, hbA, _⟩ := hjoin a haZ (region_subset hr har) b hbZ + (region_subset hs hbs) + have hbR : b ∈ r := subset_region hr hA hdis haA har hbA + exact region_eq_of_mem hr hs hbR hbs + +/-- Deleting a leaf enlarges its incident region by precisely +the open edge and the leaf endpoint. -/ +theorem deleted_leaf_region_eq + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ : Drawing S} {e : Set S} (he : e ∈ Γ.E) + {u v : S} (huv : u ≠ v) (hcap : closure e ∩ Γ.V = {u, v}) + (hL : IsLineWithEnds (closure e) u v) + (hleaf : ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f) + {r r' : Set S} (hr : r ∈ Γ.R) (hvr : v ∈ closure r) + (hr' : r' ∈ (deleteVertices Γ {v}).R) (hvr' : v ∈ r') : + r' = r ∪ e ∪ {v} := by + have hvCap : v ∈ closure e ∩ Γ.V := hcap.symm ▸ (Or.inr rfl : v ∈ ({u, v} : Set S)) + have hv : v ∈ Γ.V := hvCap.2 + have hrr' := region_subset_of_closure_mem_subdrawing_region hS + (deleteVertices_isSubdrawing Γ {v}) hr hr' hvr hvr' + apply Subset.antisymm + · intro x hxr' + by_cases hxU : x ∈ Γ.U + · rcases mem_deleted_vertex_or_incident_edge hxU (region_subset hr' hxr') with rfl | ⟨f, hf, + hxf, hvf⟩ + · exact Or.inr rfl + · have hfe : f = e := by + by_contra hne + exact hleaf f hf hne hvf + exact Or.inl (Or.inr (hfe ▸ hxf)) + · obtain ⟨s, hs, hxs⟩ := exists_region_of_notMem hxU + have hvs := deleted_vertex_mem_closure_of_region_meeting hS hv hs hr' hvr' ⟨x, hxs, hxr'⟩ + have hsr : s = r := regions_eq_of_leaf_vertex hS he huv hcap hL hleaf hs hr hvs hvr + exact Or.inl (Or.inl (hsr ▸ hxs)) + · intro x hx + rcases hx with (hxr | hxe) | rfl + · exact hrr' hxr + · exact incident_edge_subset_deleted_vertex_region hv hr' hvr' he hvCap.1 hxe + · exact hvr' + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74LeafSegment.lean b/LeanPool/GraphMinor/GM12/Section74LeafSegment.lean new file mode 100644 index 0000000000..f8ff64df73 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74LeafSegment.lean @@ -0,0 +1,99 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.ArcErase +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Cutting the leaf edge before a compact circle + +In the leaf gluing needed by XII (7.4), pages 262--263, the +circle to be enclosed misses the retained end of the edge. +A short initial segment misses the circle as well, by continuity. +Cut the edge there. Its last segment contains every intersection +with the circle, and the initial and last segments meet only in +the cut point. This gives the closed remainder used in the lens +construction. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface Metric unitInterval + +private theorem exists_initial_interval_avoiding_closed + {S : Type*} [TopologicalSpace S] {a : I → S} (ha : Continuous a) + {F : Set S} (hF : IsClosed F) (h0 : a 0 ∉ F) : + ∃ t : I, 0 < t ∧ t < 1 ∧ ∀ s ≤ t, a s ∉ F := by + have hO : IsOpen (a ⁻¹' Fᶜ) := hF.isOpen_compl.preimage ha + obtain ⟨ε, hε, hsub⟩ := Metric.isOpen_iff.mp hO 0 h0 + let t : I := ⟨min (ε / 2) (1 / 2), le_min (by positivity) (by norm_num), + (min_le_right _ _).trans (by norm_num)⟩ + have htpos : 0 < t := show (0 : ℝ) < min (ε / 2) (1 / 2) from + lt_min (by positivity) (by norm_num) + have htone : t < 1 := show min (ε / 2) (1 / 2) < (1 : ℝ) from + (min_le_right _ _).trans_lt (by norm_num) + refine ⟨t, htpos, htone, ?_⟩ + intro s hst + apply hsub + change dist s (0 : I) < ε + change |(s : ℝ) - 0| < ε + rw [sub_zero, abs_of_nonneg s.2.1] + have hst' : (s : ℝ) ≤ min (ε / 2) (1 / 2) := hst + have hsε : (s : ℝ) ≤ ε / 2 := hst'.trans (min_le_left _ _) + linarith + +/-- Split a line into an initial segment missing a closed set +and a last segment, at a point different from either end. -/ +theorem exists_line_split_with_prefix_avoiding_closed + {S : Type*} [TopologicalSpace S] [T2Space S] {E F : Set S} {u v : S} + (hE : IsLineWithEnds E u v) (hF : IsClosed F) (huF : u ∉ F) : + ∃ (P L : Set S) (w : S), IsLineWithEnds P u w ∧ IsLineWithEnds L w v ∧ + P ∪ L = E ∧ P ∩ L = {w} ∧ Disjoint P F ∧ w ≠ u ∧ w ≠ v := by + obtain ⟨a, ha, har, ha0, ha1⟩ := hE.exists_arc + obtain ⟨t, ht0, ht1, havoid⟩ := exists_initial_interval_avoiding_closed ha.1 hF (ha0.symm ▸ huF) + let P := a '' Icc 0 t + let L := a '' Icc t 1 + have hP : IsLineWithEnds P u (a t) := by + have hh := (ha.sub (s := 0) (t := t) ht0.ne).isLineWithEnds + rwa [range_subArc _ ht0.le, subArc_zero, subArc_one, ha0] at hh + have hL : IsLineWithEnds L (a t) v := by + have hh := (ha.sub (s := t) (t := 1) ht1.ne).isLineWithEnds + rwa [range_subArc _ ht1.le, subArc_zero, subArc_one, ha1] at hh + have hUnion : P ∪ L = E := by + change a '' Icc 0 t ∪ a '' Icc t 1 = E + rw [← image_union, Icc_union_Icc_eq_Icc ht0.le ht1.le, ← har] + ext x + simp only [mem_image, mem_Icc, mem_range] + constructor + · rintro ⟨s, _, hs⟩; exact ⟨s, hs⟩ + · rintro ⟨s, hs⟩; exact ⟨s, ⟨unitInterval.nonneg s, unitInterval.le_one s⟩, hs⟩ + have hInter : P ∩ L = {a t} := by + apply Subset.antisymm + · rintro x ⟨⟨s, hs, hsx⟩, r, hr, hrx⟩ + have hsr : s = r := ha.2 (hsx.trans hrx.symm) + have hst : s = t := le_antisymm hs.2 (hsr.symm ▸ hr.1) + exact hsx.symm.trans (congrArg a hst) + · exact singleton_subset_iff.mpr + ⟨⟨t, ⟨unitInterval.nonneg t, le_rfl⟩, rfl⟩, + ⟨t, ⟨le_rfl, unitInterval.le_one t⟩, rfl⟩⟩ + have hdis : Disjoint P F := by + apply disjoint_left.mpr + rintro x ⟨s, hs, rfl⟩ hxF + exact havoid s hs.2 hxF + refine ⟨P, L, a t, hP, hL, hUnion, hInter, hdis, ?_, ?_⟩ + · intro h + exact ht0.ne' (ha.2 (h.trans ha0.symm)) + · intro h + exact ht1.ne (ha.2 (h.trans ha1.symm)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74LeafTwoCell.lean b/LeanPool/GraphMinor/GM12/Section74LeafTwoCell.lean new file mode 100644 index 0000000000..10a40d5cea --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74LeafTwoCell.lean @@ -0,0 +1,205 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section74LeafRegion +import LeanPool.GraphMinor.GM12.Section74LeafAccess +import LeanPool.GraphMinor.GM12.Section74LeafSegment +import LeanPool.GraphMinor.GM12.Section74LeafLens +import LeanPool.GraphMinor.GM12.Section74SlitEnclosure +import LeanPool.GraphMinor.GM11.GlueFaces +import LeanPool.GraphMinor.GM11.PaintingFacts +import LeanPool.GraphMinor.GM11.Section4c +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Deleting a leaf preserves disc regions + +For the last gluing step needed in XII (7.4), pages 262--263, +consider a circle in the region enlarged by deleting a leaf. +Cut the leaf edge before the circle, continue its last segment +by an access line into the old region, and construct a slit lens. +The enclosure lemma bounds the circle in the enlarged region. +The open-disc criterion then proves that the region is a disc. +All other regions are old regions. The lens is transported from a small +copy, so the construction works in any surface universe. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +private theorem enclose_circle_in_deleted_leaf_region + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ : Drawing S} {e : Set S} (he : e ∈ Γ.E) + {u v : S} (huv : u ≠ v) (hcap : closure e ∩ Γ.V = {u, v}) + (hEdge : IsLineWithEnds (closure e) u v) + (hleaf : ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f) + {r Y : Set S} (hr : r ∈ Γ.R) (hdr : IsOpenDisc r) (hvr : v ∈ closure r) + (hY : Y ∈ (deleteVertices Γ {v}).R) (hvY : v ∈ Y) + {F : Set S} (hF : IsOArc F) (hFY : F ⊆ Y) : + ∃ D : Set S, D ⊆ Y ∧ IsClosedDisc D ∧ discBd D = F := by + let K := deleteVertices Γ {v} + have huCap : u ∈ closure e ∩ Γ.V := hcap.symm ▸ (Or.inl rfl : u ∈ ({u, v} : Set S)) + have hvCap : v ∈ closure e ∩ Γ.V := hcap.symm ▸ (Or.inr rfl : v ∈ ({u, v} : Set S)) + have huK : u ∈ K.U := K.V_subset_U ((deleteVertices_V Γ {v}).symm ▸ ⟨huCap.2, huv⟩) + have huF : u ∉ F := fun h => region_subset hY (hFY h) huK + obtain ⟨P, L, w, hP, hL, hPL, hcapPL, hPF, hwu, hwv⟩ := + exists_line_split_with_prefix_avoiding_closed hEdge (isCompact_of_isOArc hF).isClosed huF + have hPE : P ⊆ closure e := hPL ▸ subset_union_left + have hLE : L ⊆ closure e := hPL ▸ subset_union_right + have hLG : L ⊆ Γ.U := hLE.trans (Γ.closure_subset_U he) + have hPG : P ⊆ Γ.U := hPE.trans (Γ.closure_subset_U he) + have huL : u ∉ L := by + intro huL + have huw : u = w := by + have hh : u ∈ P ∩ L := ⟨hP.left_mem, huL⟩ + rw [hcapPL] at hh + exact hh + exact hwu huw.symm + have hvP : v ∉ P := by + intro hvP + have hvw : v = w := by + have hh : v ∈ P ∩ L := ⟨hvP, hL.right_mem⟩ + rw [hcapPL] at hh + exact hh + exact hwv hvw.symm + have hLY : L ⊆ Y := by + intro x hxL + by_cases hxV : x ∈ Γ.V + · rcases hcap.subset ⟨hLE hxL, hxV⟩ with hxu | hxv + · exact (huL (hxu ▸ hxL)).elim + · exact hxv.symm ▸ hvY + · have hxe : x ∈ e := (Γ.closure_diff_V he).subset ⟨hLE hxL, hxV⟩ + exact incident_edge_subset_deleted_vertex_region hvCap.2 hY hvY he hvCap.1 hxe + obtain ⟨B, z, hB, hzr, hBr, hBG⟩ := exists_access_line_from_leaf hS he huv hcap hEdge hleaf hr hvr + have hLB : L ∩ B = {v} := by + apply Subset.antisymm + · intro x hx + have hxG : x ∈ B ∩ Γ.U := ⟨hx.2, hLG hx.1⟩ + rwa [hBG] at hxG + · exact singleton_subset_iff.mpr ⟨hL.right_mem, hB.left_mem⟩ + let Z := K.U ∪ P + have hZ : IsClosed Z := K.isClosed_U.union hP.isCompact.isClosed + have hLZ : L ∩ Z = {w} := by + apply Subset.antisymm + · intro x hx + rcases hx.2 with hxK | hxP + · exact (region_subset hY (hLY hx.1) hxK).elim + · have hh : x ∈ P ∩ L := ⟨hxP, hx.1⟩ + rwa [hcapPL] at hh + · exact singleton_subset_iff.mpr ⟨hL.left_mem, Or.inr hP.right_mem⟩ + have hBZ : Disjoint B Z := by + apply disjoint_left.mpr + intro x hxB hxZ + have hxG : x ∈ Γ.U := by + rcases hxZ with hxK | hxP + · exact (deleteVertices_isSubdrawing Γ {v}).U_subset hxK + · exact hPG hxP + have hxv : x = v := by + have hh : x ∈ B ∩ Γ.U := ⟨hxB, hxG⟩ + rw [hBG] at hh + exact hh + rcases hxZ with hxK | hxP + · exact region_subset hY hvY ((congrArg (fun y => y ∈ K.U) hxv).mp hxK) + · exact hvP (hxv ▸ hxP) + have hG : Γ.U ⊆ Z ∪ L := by + intro x hxG + by_cases hxK : x ∈ K.U + · exact Or.inl (Or.inl hxK) + · rcases mem_deleted_vertex_or_incident_edge hxG hxK with rfl | ⟨f, hf, hxf, hvf⟩ + · exact Or.inr hL.right_mem + · have hfe : f = e := by + by_contra hne + exact hleaf f hf hne hvf + have hxE : x ∈ closure e := subset_closure (hfe ▸ hxf) + rw [← hPL] at hxE + rcases hxE with hxP | hxL + · exact Or.inl (Or.inr hxP) + · exact Or.inr hxL + have hwK : w ∉ K.U := region_subset hY (hLY hL.left_mem) + obtain ⟨N, hN, hNY, hLN, hNG, hbdL⟩ := exists_leaf_slit_lens hS hL hB hLB hZ hLZ hBZ hG hLG + subset_union_left hwK hY hvY + have hYeq := deleted_leaf_region_eq hS he huv hcap hEdge hleaf hr hvr hY hvY + have hShape : Y ⊆ r ∪ Γ.U := by + intro x hx + rw [hYeq] at hx + rcases hx with (hxr | hxe) | rfl + · exact Or.inl hxr + · exact Or.inr (he.2.1 hxe).1 + · exact Or.inr (Γ.V_subset_U hvCap.2) + have hrY : r ⊆ Y := by rw [hYeq]; exact subset_union_left.trans subset_union_left + have hFZ : Disjoint F Z := by + apply disjoint_left.mpr + intro x hxF hxZ + rcases hxZ with hxK | hxP + · exact region_subset hY (hFY hxF) hxK + · exact disjoint_left.mp hPF hxP hxF + have hFA : F \ discInt N ⊆ r := by + intro x hx + apply (hShape (hFY hx.1)).resolve_right + intro hxG + have hxL : x ∈ L := (hG hxG).resolve_left (fun hxZ => disjoint_left.mp hFZ hx.1 hxZ) + have hxN : x ∈ N := hLN hxL + have hxBd : x ∉ discBd N := by + intro hxBd + have hxw : x = w := by + have hh : x ∈ discBd N ∩ L := ⟨hxBd, hxL⟩ + rw [hbdL] at hh + exact hh + exact disjoint_left.mp hFZ hx.1 (Or.inr (hxw.symm ▸ hP.right_mem)) + exact hx.2 ⟨hxN, hxBd⟩ + exact exists_disc_bounding_circle_in_leaf_region_of_slit_disc hS hr hdr hrY hShape hN hNY + hL hLN hNG hbdL hF hFA + +/-- On a closed surface, the merged region formed by +deleting a leaf from a two-cell drawing is an open disc. -/ +theorem isOpenDisc_deleted_leaf_region + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} + (hΓ : (PaintingOrDrawing.drawing Γ).IsTwoCell) + {e : Set S} (he : e ∈ Γ.E) {u v : S} (huv : u ≠ v) + (hcap : closure e ∩ Γ.V = {u, v}) (hEdge : IsLineWithEnds (closure e) u v) + (hleaf : ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f) + {Y : Set S} (hY : Y ∈ (deleteVertices Γ {v}).R) (hvY : v ∈ Y) : IsOpenDisc Y := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hvCap : v ∈ closure e ∩ Γ.V := hcap.symm ▸ (Or.inr rfl : v ∈ ({u, v} : Set S)) + obtain ⟨x, hxY, hxG⟩ := exists_notMem_U (Γ := Γ) hS (region_isOpen hY) (region_nonempty hY) + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem hxG + have hvr := deleted_vertex_mem_closure_of_region_meeting hS hvCap.2 hr hY hvY ⟨x, hxr, hxY⟩ + have huCap : u ∈ closure e ∩ Γ.V := hcap.symm ▸ (Or.inl rfl : u ∈ ({u, v} : Set S)) + have huK : u ∈ (deleteVertices Γ {v}).U := (deleteVertices Γ {v}).V_subset_U + ((deleteVertices_V Γ {v}).symm ▸ ⟨huCap.2, huv⟩) + apply isOpenDisc_of_bound hS (region_isOpen hY) ⟨region_nonempty hY, region_isPreconnected hY⟩ + (fun h => region_subset hY (h.symm ▸ mem_univ u) huK) + intro F hFY hF + exact enclose_circle_in_deleted_leaf_region hS he huv hcap hEdge hleaf hr + (hΓ.2 r hr) hvr hY hvY hF hFY + +/-- Deleting a leaf from a two-cell drawing on a connected +closed surface preserves two-cellularity. The only enlarged +region is handled by the preceding slit-disc construction. -/ +theorem isTwoCell_delete_leaf + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} + (hΓ : (PaintingOrDrawing.drawing Γ).IsTwoCell) + {e : Set S} (he : e ∈ Γ.E) {u v : S} (huv : u ≠ v) + (hcap : closure e ∩ Γ.V = {u, v}) (hEdge : IsLineWithEnds (closure e) u v) + (hleaf : ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f) : + (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell := by + have hvCap : v ∈ closure e ∩ Γ.V := hcap.symm ▸ (Or.inr rfl : v ∈ ({u, v} : Set S)) + refine ⟨inferInstance, ?_⟩ + intro Y hY + by_cases hvY : v ∈ Y + · exact isOpenDisc_deleted_leaf_region hS hΓ he huv hcap hEdge hleaf hY hvY + · exact hΓ.2 Y (deleted_region_of_not_mem_vertex hS hvCap.2 hY hvY) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74LensUniverses.lean b/LeanPool/GraphMinor/GM12/Section74LensUniverses.lean new file mode 100644 index 0000000000..83d57cae3e --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74LensUniverses.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM12.Section4SmallSurfaceCopy +import LeanPool.GraphMinor.Surface.EdgeLens +import LeanPool.GraphMinor.Surface.PlaneDisc +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Slit lenses in arbitrary surface universes + +The lens used in the leaf gluing for XII (7.4), pages 262--263, +is first constructed on a small copy of the closed surface. +A homeomorphism carries the line and the closed set to that +copy, and carries the resulting closed disc back. It preserves +the intersection and boundary conditions needed by the proof. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface + +/-- The disc and boundary parts of the edge-lens construction, +transported from a small copy to any closed surface. -/ +theorem exists_edge_lens_disc_universes + {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {L Z : Set S} {u v : S} + (hL : IsLineWithEnds L u v) (huv : u ≠ v) (hZ : IsClosed Z) + (hLZ : L ∩ Z ⊆ {u, v}) : + ∃ D : Set S, IsClosedDisc D ∧ L ⊆ D ∧ D ∩ Z ⊆ {u, v} ∧ + u ∈ discBd D ∧ v ∈ discBd D ∧ discBd D ∩ L ⊆ {u, v} := by + obtain ⟨T, t, ⟨e⟩, hT⟩ := exists_small_closed_surface_copy hS + let : TopologicalSpace T := t + let : T2Space T := hT.2.1 + have hLine : IsLineWithEnds (e '' L) (e u) (e v) := by + obtain ⟨a, ha, har, ha0, ha1⟩ := hL.exists_arc + have hArc : IsArcMap (e ∘ a) := ⟨e.continuous.comp ha.1, e.injective.comp ha.2⟩ + have hh := hArc.isLineWithEnds + rwa [range_comp, har, Function.comp_apply, Function.comp_apply, ha0, ha1] at hh + have hClosed : IsClosed (e '' Z) := e.isClosedMap Z hZ + have hInter : (e '' L) ∩ (e '' Z) ⊆ {e u, e v} := by + rw [← Set.image_inter e.injective] + rintro y ⟨x, hx, rfl⟩ + rcases hLZ hx with h | h + · exact Or.inl (congrArg e h) + · exact Or.inr (congrArg e h) + obtain ⟨D, _, _, hD, hLD, hDZ, huBd, hvBd, hBdL, _⟩ := + exists_edge_lens hT hLine (e.injective.ne huv) hClosed hInter + have hDisc := hD.image e.symm.continuous.continuousOn e.continuous.continuousOn + (fun x _ => e.apply_symm_apply x) + have hmem : ∀ x : S, x ∈ e.symm '' D ↔ e x ∈ D := by + intro x + constructor + · rintro ⟨y, hy, hxy⟩ + have hh : y = e x := by simpa only [e.apply_symm_apply] using congrArg e hxy + exact hh ▸ hy + · intro hx + exact ⟨e x, hx, e.symm_apply_apply x⟩ + have hbdmem : ∀ x : S, x ∈ discBd (e.symm '' D) ↔ e x ∈ discBd D := by + intro x + rw [hDisc.2] + constructor + · rintro ⟨y, hy, hxy⟩ + have hh : y = e x := by simpa only [e.apply_symm_apply] using congrArg e hxy + exact hh ▸ hy + · intro hx + exact ⟨e x, hx, e.symm_apply_apply x⟩ + refine ⟨e.symm '' D, hDisc.1, ?_, ?_, hbdmem u |>.mpr huBd, hbdmem v |>.mpr hvBd, ?_⟩ + · intro x hx + exact (hmem x).mpr (hLD ⟨x, hx, rfl⟩) + · intro x hx + rcases hDZ ⟨(hmem x).mp hx.1, ⟨x, hx.2, rfl⟩⟩ with h | h + · exact Or.inl (e.injective h) + · exact Or.inr (e.injective h) + · intro x hx + rcases hBdL ⟨(hbdmem x).mp hx.1, ⟨x, hx.2, rfl⟩⟩ with h | h + · exact Or.inl (e.injective h) + · exact Or.inr (e.injective h) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74NoParallel.lean b/LeanPool/GraphMinor/GM12/Section74NoParallel.lean new file mode 100644 index 0000000000..09c203e8c9 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74NoParallel.lean @@ -0,0 +1,86 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section73NoParallel +public import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM11.RadialRegions +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM07.Section3 + +/-! +# The radial star in the base case of XII (7.4) + +The induction base on pages 262--263 excludes selected normal +one-vertex discs containing an edge. Such a disc contains no +other old vertex either: an edge at that vertex would meet the +disc interior and could not cross the normal boundary. Thus a +pair of parallel spokes at the deleted vertex would bound a +disc contained in one old region with the vertex restored, +contrary to the pre-radial condition. This argument does not +presuppose that vertex deletion is two-cell. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 GM14 + +/-- A normal one-vertex disc containing no old edge contains no +other old vertex, when the drawing has an edge. -/ +theorem vertices_in_normal_vertex_disc_of_no_edges + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} + (hK : PreRad (PaintingOrDrawing.drawing Γ) K) (hE : Γ.E.Nonempty) + {D F : Set S} {v : S} (hD : IsClosedDisc D) (hbd : subBd D = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) (hFV : F ∩ Γ.V = {v}) + (hno : ∀ e ∈ Γ.E, ¬ e ⊆ D) : Γ.V ∩ D = {v} := by + have hfront : frontier D = F := (subBd_eq_frontier D).symm.trans hbd + have hvFV : v ∈ F ∩ Γ.V := hFV.symm ▸ mem_singleton v + refine Subset.antisymm ?_ (singleton_subset_iff.mpr ⟨hvFV.2, + hD.isClosed.closure_subset_iff.mpr subset_rfl (hfront.symm ▸ hvFV.1).1⟩) + intro w hw + by_contra hwv + have hwint : w ∈ interior D := by + by_contra h + exact hwv (hFV ▸ (⟨hfront ▸ (⟨subset_closure hw.2, h⟩ : w ∈ frontier D), hw.1⟩ : w ∈ F ∩ Γ.V)) + obtain ⟨e, he, hwe⟩ := exists_edge_at hK hS hE hw.1 + obtain ⟨x, hxint, hxe⟩ := mem_closure_iff.mp hwe _ isOpen_interior hwint + have hdis : Disjoint e (frontier D) := by + apply disjoint_left.mpr + intro y hye hyF + exact (he.2.1 hye).2 (hn ⟨hfront ▸ hyF, (he.2.1 hye).1⟩) + exact hno e he (subset_of_disjoint_frontier he.2.2.1.isConnected.isPreconnected + hD.isClosed hdis hxe (interior_subset hxint)) + +/-- In the no-selected-edge base case of XII (7.4), a radial +star at the deleted vertex has no parallel spokes. Unlike the +corresponding preprocessing lemma for (7.3), this does not assume +that the deletion is two-cell. -/ +theorem no_parallel_spokes_in_theorem_7_4_base + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsRespectfulDrawingTangle Γ θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) {v : S} (hv : v ∈ Γ.V) + (hno : ∀ D F : Set S, IsClosedDisc D → IsOArc F → subBd D = F → + (PaintingOrDrawing.drawing Γ).IsNormal F → F ∩ Γ.V = {v} → + ((PaintingOrDrawing.drawing Γ).inter D, (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T → + ∀ e ∈ Γ.E, ¬ e ⊆ D) + {g h r : Set S} {u : S} (hg : g ∈ K.E) (hh : h ∈ K.E) (hgh : g ≠ h) + (hr : r ∈ Γ.R) (hur : u ∈ r) (huK : u ∈ K.V) + (hcapg : closure g ∩ K.V = {v, u}) (hcaph : closure h ∩ K.V = {v, u}) : False := by + apply parallel_spokes_contradiction hS hθ hT hK hv hg hh hgh hr hur huK hcapg hcaph + intro D F hD hF hbd hn hFV _ hm + have hE : Γ.E.Nonempty := edgeSet_nonempty_of_isTangle_of_two_le hT.2.1 hθ + have hnone := hno D F hD hF hbd hn hFV hm + exact ⟨vertices_in_normal_vertex_disc_of_no_edges hS ⟨hT.1, hK⟩ hE hD hbd hn hFV hnone, hnone⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74RegionMerge.lean b/LeanPool/GraphMinor/GM12/Section74RegionMerge.lean new file mode 100644 index 0000000000..0df64dc6ef --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74RegionMerge.lean @@ -0,0 +1,81 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section74EdgeDeletion +import LeanPool.GraphMinor.GM11.Section4c + +/-! +# The other regions in an edge gluing + +The finite gluing in XII (7.4), pages 262--263, removes edges +between distinct corner regions. The merged region was identified +in `Section74EdgeDeletion`. Every new region other than this +one is an old region, and each old region other than the two +merged regions survives. These facts allow the gluing to continue +through the cyclic list of corners. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A region after edge deletion either meets the edge, or is +an old region of the drawing. -/ +theorem region_deleteEdge_old_of_disjoint + {S : Type*} [TopologicalSpace S] [T2Space S] {K : Drawing S} {e r : Set S} + (he : e ∈ K.E) (hr : r ∈ (K.deleteEdge e).R) (hdis : Disjoint r e) : r ∈ K.R := by + obtain ⟨x, hxr⟩ := region_nonempty hr + have hxK : x ∉ K.U := by + intro hx + have hxn := region_subset hr hxr + rw [deleteEdge_U K he] at hxn + exact hxn ⟨hx, disjoint_left.mp hdis hxr⟩ + obtain ⟨s, hs, hxs⟩ := exists_region_of_notMem hxK + have hrs : r ⊆ s := subset_region hs (region_isPreconnected hr) + (disjoint_left.mpr fun y hyr hyK => by + have hyN := region_subset hr hyr + rw [deleteEdge_U K he] at hyN + exact hyN ⟨hyK, disjoint_left.mp hdis hyr⟩) hxr hxs + have hsr : s ⊆ r := subset_region hr (region_isPreconnected hs) + (disjoint_left.mpr fun y hys hyN => region_subset hs hys + ((deleteEdge_isSubdrawing K e).U_subset hyN)) hxs hxr + exact (Subset.antisymm hrs hsr).symm ▸ hs + +/-- Every old region other than the two being glued survives +the edge deletion. -/ +theorem region_deleteEdge_of_ne_merged_pair + {S : Type*} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {K : Drawing S} {e p q r : Set S} + (he : e ∈ K.E) (hp : p ∈ K.R) (hq : q ∈ K.R) (hpq : p ≠ q) + (hdp : IsOpenDisc p) (hdq : IsOpenDisc q) + (hep : e ⊆ closure p) (heq : e ⊆ closure q) + (hr : r ∈ K.R) (hrp : r ≠ p) (hrq : r ≠ q) : r ∈ (K.deleteEdge e).R := by + obtain ⟨hmerge, _⟩ := merged_region_deleteEdge hS he hp hq hpq hdp hdq hep heq + obtain ⟨x, hxr⟩ := region_nonempty hr + have hxK : x ∉ K.U := region_subset hr hxr + obtain ⟨s, hs, hxs⟩ := exists_region_of_notMem + (fun h => hxK ((deleteEdge_isSubdrawing K e).U_subset h)) + have hxNotMerge : x ∉ p ∪ q ∪ e := by + rintro ((hxp | hxq) | hxe) + · exact hrp (region_eq_of_mem hr hp hxr hxp) + · exact hrq (region_eq_of_mem hr hq hxr hxq) + · exact hxK (he.2.1 hxe).1 + have hsDis : Disjoint s e := by + apply disjoint_left.mpr + intro y hys hye + have hsEq : s = p ∪ q ∪ e := region_eq_of_mem hs hmerge hys (Or.inr hye) + exact hxNotMerge (hsEq ▸ hxs) + have hsOld := region_deleteEdge_old_of_disjoint he hs hsDis + have hsr : s = r := region_eq_of_mem hsOld hr hxs hxr + exact hsr ▸ hs + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74SlitDisc.lean b/LeanPool/GraphMinor/GM12/Section74SlitDisc.lean new file mode 100644 index 0000000000..5e9d492eae --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74SlitDisc.lean @@ -0,0 +1,129 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import Mathlib.Topology.MetricSpace.ProperSpace.Real +import LeanPool.GraphMinor.Surface.Crossing +import LeanPool.GraphMinor.Surface.PlaneSeparation +public import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# A disc interior with a slit ending inside it + +The final leaf-edge gluing in XII (7.4), pages 262--263, uses a +disc meeting the old drawing in a slit with one end on its +boundary and one end inside. The slit does not disconnect the +disc interior. In plane coordinates this follows from +Janiszewski: the boundary circle and the slit meet in one point; +neither separates two points of the disc interior off the slit. +Their common complementary component stays inside the disc. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface Metric + +/-- A line meeting the boundary circle in one point does not +disconnect the open ball after it is removed. This is the plane +slit-disc fact used for leaf deletion in XII (7.4). -/ +theorem isPreconnected_ball_sdiff_line_of_singleton_boundary + {c : ℂ} {ρ : ℝ} {L : Set ℂ} {w : ℂ} + (hL : IsLine L) (hinter : sphere c ρ ∩ L = {w}) : + IsPreconnected (ball c ρ \ L) := by + apply isPreconnected_of_forall_pair + intro x hx y hy + have hxout : x ∉ sphere c ρ ∪ L := by + rintro (h | h) + · exact (ne_of_lt (mem_ball.mp hx.1)) h + · exact hx.2 h + have hyout : y ∉ sphere c ρ ∪ L := by + rintro (h | h) + · exact (ne_of_lt (mem_ball.mp hy.1)) h + · exact hy.2 h + have hsameCircle : y ∈ connectedComponentIn (sphere c ρ)ᶜ x := + (convex_ball c ρ).isPreconnected.subset_connectedComponentIn hx.1 + (fun z hz => (ne_of_lt (mem_ball.mp hz))) hy.1 + have hsameLine : y ∈ connectedComponentIn Lᶜ x := by + obtain ⟨φ⟩ := hL + rw [component_eq_of_arc φ hx.2 hy.2] + exact mem_connectedComponentIn hy.2 + have hLc : IsCompact L := by + obtain ⟨e⟩ := hL + exact (show IsLineWithEnds L (e 0).1 (e 1).1 from ⟨e, rfl, rfl⟩).isCompact + have hsame := janiszewski (isCompact_sphere c ρ) hLc + (hinter.symm ▸ isConnected_singleton.isPreconnected) hxout hyout hsameCircle hsameLine + let C := connectedComponentIn (sphere c ρ ∪ L)ᶜ x + have hCsub : C ⊆ (sphere c ρ ∪ L)ᶜ := connectedComponentIn_subset _ _ + have hxC : x ∈ C := mem_connectedComponentIn hxout + have hCball : C ⊆ ball c ρ := by + apply isPreconnected_connectedComponentIn.subset_left_of_subset_union + isOpen_ball isClosed_closedBall.isOpen_compl + (disjoint_left.mpr fun z hz hzc => hzc (ball_subset_closedBall hz)) + (fun z hz => ?_) ⟨x, hxC, hx.1⟩ + by_cases hzball : z ∈ ball c ρ + · exact Or.inl hzball + · refine Or.inr fun hzclosed => ?_ + have hzSphere : z ∈ sphere c ρ := le_antisymm hzclosed (not_lt.mp hzball) + exact hCsub hz (Or.inl hzSphere) + exact ⟨C, fun z hz => ⟨hCball hz, fun hzL => hCsub hz (Or.inr hzL)⟩, + hxC, hsame, isPreconnected_connectedComponentIn⟩ + +/-- A line contained in a closed disc and meeting its boundary +in just one point does not disconnect the disc interior. This +transfers the plane slit argument through a disc chart. -/ +theorem isPreconnected_discInt_sdiff_line_of_singleton_boundary + {S : Type*} [TopologicalSpace S] {D L : Set S} {u v w : S} + (hD : IsClosedDisc D) (hL : IsLineWithEnds L u v) (hLD : L ⊆ D) + (hinter : discBd D ∩ L = {w}) : IsPreconnected (discInt D \ L) := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hi : InjOn h D := c.gh.injOn + have hLine : IsLine (h '' L) := by + obtain ⟨a, ha, har, _, _⟩ := hL.exists_arc + have haD : ∀ t, a t ∈ D := fun t => hLD (har ▸ mem_range_self t) + have hc : Continuous (h ∘ a) := c.hc.comp_continuous ha.1 haD + have hinj : Function.Injective (h ∘ a) := fun s t hst => ha.2 (hi (haD s) (haD t) hst) + have hr : range (h ∘ a) = h '' L := by rw [range_comp, har] + obtain ⟨e, _, _⟩ := (show IsArcMap (h ∘ a) from ⟨hc, hinj⟩).isLineWithEnds + exact hr ▸ ⟨e⟩ + have hw : w ∈ discBd D ∩ L := hinter.symm ▸ mem_singleton w + have hInter : sphere (0 : ℂ) 1 ∩ h '' L = {h w} := by + apply Subset.antisymm + · rintro z ⟨hzsphere, x, hxL, hxz⟩ + obtain ⟨y, hybd, hyz⟩ := c.bd.symm ▸ hzsphere + have hyx : y = x := hi (Surface.discBd_subset D hybd) (hLD hxL) (hyz.trans hxz.symm) + have hxw : x = w := by + have hh : x ∈ discBd D ∩ L := ⟨hyx ▸ hybd, hxL⟩ + rw [hinter] at hh + exact hh + exact hxz.symm.trans (congrArg h hxw) + · refine singleton_subset_iff.mpr ⟨?_, ⟨w, hw.2, rfl⟩⟩ + rw [← c.bd] + exact ⟨w, hw.1, rfl⟩ + have hpre := isPreconnected_ball_sdiff_line_of_singleton_boundary hLine hInter + have heq : g '' (ball (0 : ℂ) 1 \ h '' L) = discInt D \ L := by + apply Subset.antisymm + · rintro x ⟨z, hz, rfl⟩ + refine ⟨c.discInt_eq.symm ▸ ⟨z, hz.1, rfl⟩, ?_⟩ + intro hxL + exact hz.2 ⟨g z, hxL, c.hg (ball_subset_closedBall hz.1)⟩ + · rintro x ⟨hxD, hxL⟩ + obtain ⟨z, hz, hzx⟩ := c.discInt_eq ▸ hxD + refine ⟨z, ⟨hz, ?_⟩, hzx⟩ + rintro ⟨y, hyL, hyz⟩ + have hyx : y = x := (c.gh (hLD hyL)).symm.trans + ((congrArg g hyz).trans hzx) + exact hxL (hyx ▸ hyL) + rw [← heq] + exact hpre.image g (c.gc.mono (sdiff_subset.trans ball_subset_closedBall)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74SlitEnclosure.lean b/LeanPool/GraphMinor/GM12/Section74SlitEnclosure.lean new file mode 100644 index 0000000000..1d1a0d081b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74SlitEnclosure.lean @@ -0,0 +1,83 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section74LeafDiscGlue +import LeanPool.GraphMinor.GM12.Section74SlitDisc +import LeanPool.GraphMinor.GM12.Section74BoundaryParam +import LeanPool.GraphMinor.GM11.Section4c + +/-! +# Bounding a circle through the slit disc at a leaf + +In the leaf case needed for XII (7.4), pages 262--263, a slit +disc `N` meets the old drawing in one line `L`, and that line +meets its boundary at one point. Every other point of `N` is in +the old open-disc region. Its boundary is therefore a circle +punctured at that point, and its interior off the drawing is +preconnected by the slit lemma. The disc-gluing construction +then bounds any circle whose part outside `N` is in the old +region, with the bounding disc wholly in the enlarged region. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- A slit disc gives the circle-enclosure required for the +open-disc criterion at a deleted leaf. All local disc conditions +come from the geometric lens construction. -/ +theorem exists_disc_bounding_circle_in_leaf_region_of_slit_disc + {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Γ : Drawing S} {r Y N L F : Set S} {w a b : S} + (hr : r ∈ Γ.R) (hdr : IsOpenDisc r) (hrY : r ⊆ Y) + (hShape : Y ⊆ r ∪ Γ.U) (hN : IsClosedDisc N) (hNY : N ⊆ Y) + (hLine : IsLineWithEnds L a b) (hLN : L ⊆ N) + (hNG : N ∩ Γ.U = L) (hbdL : discBd N ∩ L = {w}) + (hF : IsOArc F) (hFA : F \ discInt N ⊆ r) : + ∃ D : Set S, D ⊆ Y ∧ IsClosedDisc D ∧ discBd D = F := by + have hLG : L ⊆ Γ.U := by intro x hx; exact (hNG.symm ▸ hx).2 + have hw : w ∈ discBd N ∩ L := hbdL.symm ▸ mem_singleton w + have hbd : discBd N ∩ r = discBd N \ {w} := by + apply Subset.antisymm + · intro x hx + refine ⟨hx.1, ?_⟩ + intro hxw + exact region_subset hr hx.2 (hxw.symm ▸ hLG hw.2) + · intro x hx + have hxN : x ∈ N := Surface.discBd_subset N hx.1 + refine ⟨hx.1, ?_⟩ + apply (hShape (hNY hxN)).resolve_right + intro hxG + have hxL : x ∈ L := hNG ▸ (⟨hxN, hxG⟩ : x ∈ N ∩ Γ.U) + exact hx.2 (hbdL ▸ (⟨hx.1, hxL⟩ : x ∈ discBd N ∩ L)) + have hint : discInt N ∩ r = discInt N \ L := by + apply Subset.antisymm + · intro x hx + exact ⟨hx.1, fun hxL => region_subset hr hx.2 (hLG hxL)⟩ + · intro x hx + have hxN := discInt_subset N hx.1 + exact ⟨hx.1, (hShape (hNY hxN)).resolve_right (fun hxG => hx.2 (hNG ▸ ⟨hxN, hxG⟩))⟩ + have hT : IsPreconnected (discInt N ∩ r) := by + rw [hint] + exact isPreconnected_discInt_sdiff_line_of_singleton_boundary hN hLine hLN hbdL + have hTne : (discInt N ∩ r).Nonempty := by + obtain ⟨x, hxN, hxG⟩ := exists_notMem_U (Γ := Γ) hS + (hN.isOpen_discInt (fun x => (hS.2.2 x).isManifoldPoint)) hN.nonempty_discInt + exact ⟨x, hxN, (hShape (hNY (discInt_subset N hxN))).resolve_right hxG⟩ + obtain ⟨ℓ, hℓ, h0, h1, hinj, hrange⟩ := exists_punctured_oArc_parameter hN.isOArc_discBd hw.1 + have hwG : w ∈ Γ.U := hLG hw.2 + have hwr : w ∉ r := fun h => region_subset hr h hwG + obtain ⟨D, hDsub, hD, hDb⟩ := exists_disc_bounding_circle_by_leaf_gluing hS hdr hN hF hℓ + (h0 ▸ hwr) (h1 ▸ hwr) hinj (hbd.trans hrange.symm) hT hTne hFA + exact ⟨D, hDsub.trans (union_subset hrY hNY), hD, hDb⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section74VertexWalk.lean b/LeanPool/GraphMinor/GM12/Section74VertexWalk.lean new file mode 100644 index 0000000000..428f689e68 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section74VertexWalk.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM11.EvenCircuit +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# A walk in a connected drawing + +For the base case of XII (7.4), pages 262--263, the old two-cell +drawing has a connected point set. Any two of its vertices are +therefore joined by a graph walk. Otherwise the reachable vertices +and their edge closures, and the remaining vertices and their edge +closures, form two disjoint closed pieces of the point set. This +supplies a non-loop edge at the vertex when another vertex exists. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 + +/-- Topological connectedness of a finite drawing gives graph +walks between its vertices. -/ +theorem exists_walk_of_isPreconnected_U + {S : Type*} [TopologicalSpace S] [T2Space S] {Γ : Drawing S} + (hconn : IsPreconnected Γ.U) {a b : S} (ha : a ∈ Γ.V) (hb : b ∈ Γ.V) : + Nonempty (GraphWalk Γ.toGraph a b) := by + classical + let : Nonempty S := ⟨a⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + by_contra hno + let A : Set S := {x | Nonempty (GraphWalk Γ.toGraph a x)} + have haA : a ∈ A := ⟨.nil ha⟩ + have hbA : b ∉ A := hno + have hAV : A ⊆ Γ.V := by + rintro x ⟨W⟩ + exact mem_V_of_mem_support W W.end_mem_support + have hstep : ∀ f ∈ Γ.E, ∀ c, γ f (endOf c) ∈ A → γ f (endOf (!c)) ∈ A := by + rintro f hf c ⟨W⟩ + have hl := isLink_ends hγ (Drawing.IsSubdrawing.refl Γ) hf c + exact ⟨W.append (.cons hl (.nil hl.2.2.1))⟩ + let side : Set S → Prop := fun f => γ f (endOf false) ∈ A + have hside : ∀ f ∈ Γ.E, ∀ x ∈ closure f, x ∈ Γ.V → (side f ↔ x ∈ A) := by + intro f hf x hxf hxV + obtain ⟨c, rfl⟩ := exists_end_eq hγ hf hxV hxf + cases c with + | false => exact Iff.rfl + | true => exact ⟨hstep f hf false, hstep f hf true⟩ + let X := A ∪ ⋃ f ∈ {f | f ∈ Γ.E ∧ side f}, closure f + let Y := (Γ.V \ A) ∪ ⋃ f ∈ {f | f ∈ Γ.E ∧ ¬ side f}, closure f + have hfin : ∀ P : Set S → Prop, {f | f ∈ Γ.E ∧ P f}.Finite := + fun P => Γ.finite_edges.subset fun _ h => h.1 + have hXc : IsClosed X := (Γ.finite_V.subset hAV).isClosed.union + ((hfin _).isClosed_biUnion fun _ _ => isClosed_closure) + have hYc : IsClosed Y := (Γ.finite_V.subset sdiff_subset).isClosed.union + ((hfin _).isClosed_biUnion fun _ _ => isClosed_closure) + have hdis : Disjoint X Y := by + apply disjoint_left.mpr + rintro x (hx₁ | hx₁) (hx₂ | hx₂) + · exact hx₂.2 hx₁ + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx₂ + exact hf.2 ((hside f hf.1 x hxf (hAV hx₁)).mpr hx₁) + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx₁ + exact hx₂.2 ((hside f hf.1 x hxf hx₂.1).mp hf.2) + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx₁ + obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp hx₂ + have hfg : f ≠ g := fun h => hg.2 (h ▸ hf.2) + have hxV : x ∈ Γ.V := closure_inter_subset_V hf.1 hg.1 hfg ⟨hxf, hxg⟩ + exact hg.2 ((hside g hg.1 x hxg hxV).mpr ((hside f hf.1 x hxf hxV).mp hf.2)) + have hcover : Γ.U ⊆ X ∪ Y := by + intro x hx + rw [Γ.U_eq] at hx + rcases hx with hxV | hxE + · by_cases hxA : x ∈ A + · exact Or.inl (Or.inl hxA) + · exact Or.inr (Or.inl ⟨hxV, hxA⟩) + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hxE + by_cases hfside : side f + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfside⟩, hxf⟩)) + · exact Or.inr (Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfside⟩, hxf⟩)) + obtain ⟨x, _, hxX, hxY⟩ := isPreconnected_closed_iff.mp hconn X Y hXc hYc hcover + ⟨a, Γ.V_subset_U ha, Or.inl haA⟩ ⟨b, Γ.V_subset_U hb, Or.inl ⟨hb, hbA⟩⟩ + exact disjoint_left.mp hdis hxX hxY + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section75.lean b/LeanPool/GraphMinor/GM12/Section75.lean new file mode 100644 index 0000000000..8d00c31683 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section75.lean @@ -0,0 +1,894 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section75Defs +public import LeanPool.GraphMinor.GM12.Section72 +public import LeanPool.GraphMinor.GM12.Section73VertexReduction +public import LeanPool.GraphMinor.GM12.Section73NoParallel +import LeanPool.GraphMinor.GM12.Section74Bridge +import LeanPool.GraphMinor.GM12.Section78 +import LeanPool.GraphMinor.GM12.Section79 +import LeanPool.GraphMinor.GM11.RadialRegions +import LeanPool.GraphMinor.GM11.Section91 +import LeanPool.GraphMinor.GM11.Theorem66 + +/-! +# Graph Minors XII, (7.5) and Case 1 of (7.4) + +This file formalizes the proved components of **(7.4)** (pages 262–263) and **(7.5)** +(pages 263–266) of Graph Minors XII: +1. **Case 1 of (7.4) (`theorem_7_4_case_1_step`, `exists_theorem_7_4_disc_reduction`, + pages 262–263):** The inductive step on `|E(Γ)|` using **(7.2)** (`theorem_7_2`) when there is a + `Γ`-normal `O`-arc `F` with `F ∩ V(Γ) = {v}` whose selected disc `Δ = ins(F)` contains an edge of + `Γ`, together with the finite reduction to a subdrawing `Γ₀` with no such `O`-arc `F`. +2. **Case 1 of (7.5) (`theorem_7_5_lost_atoms_region`, `theorem_7_5_case_1_step`, + `exists_theorem_7_5_disc_reduction`, page 264):** The inductive step on `|E(Γ)|` using **(7.2)** + (`theorem_7_2`) when there is a `Γ`-normal `O`-arc `F ⊆ r ∪ {v}` with `F ∩ V(Γ) = {v}` whose + selected disc `Δ = ins(F)` contains an edge of `Γ`, together with the finite reduction to a + subdrawing `Γ₀` with no such `O`-arc `F`. +3. **Transition to Case 2 of (7.5) (`vertices_in_selected_region_disc_of_no_edges`, + `no_parallel_spokes_at_region_hub`, page 265):** Once no `Γ₀`-normal `O`-arc `F ⊆ r₀ ∪ {v}` with + `F ∩ V(Γ₀) = {v}` has an edge of `Γ₀` in its selected disc, the hub of `r₀` in any radial + drawing `K` of `Γ₀` has no two parallel radial edges to the same vertex `v ∈ V(Γ₀)`. +4. **Case 2 deduction from (7.4) (`closure_region_subset_of_region_subset`, + `incident_edge_subset_region_of_vertex_mem`, `U_subset_of_deleteVertices_U_subset`, + `theorem_7_5_case_2_from_7_4`, pages 265–266):** Deduction of `(i)`–`(iv)` of **(7.5)** from + `Theorem74Statement` applied to `(Γ₃, T₃, d₃, r₂*)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Function Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-! ## 1. Subdrawing and vertex-deletion helpers for (7.4) and (7.5) -/ + +/-- If `Γ₁` is a subdrawing of `Γ₂` and `Z₂ ∩ Γ₁.V ⊆ Z₁`, then `deleteVertices Γ₁ Z₁` is a +subdrawing of `deleteVertices Γ₂ Z₂`. -/ +theorem deleteVertices_mono_subdrawing {Γ₁ Γ₂ : Drawing S} {Z₁ Z₂ : Set S} + (hSub : Γ₁.IsSubdrawing Γ₂) (hZ : Z₂ ∩ Γ₁.V ⊆ Z₁) : + (deleteVertices Γ₁ Z₁).IsSubdrawing (deleteVertices Γ₂ Z₂) := by + rw [isSubdrawing_deleteVertices_iff] + refine ⟨(deleteVertices_isSubdrawing Γ₁ Z₁).trans hSub, ?_⟩ + rw [deleteVertices_V, disjoint_iff_inter_eq_empty] + ext x + simp only [mem_inter_iff, mem_sdiff, mem_empty_iff_false, iff_false, not_and] + intro ⟨hxV₁, hxZ₁⟩ hxZ₂ + exact hxZ₁ (hZ ⟨hxZ₂, hxV₁⟩) + +omit [T2Space S] in +/-- In Case 1 of **(7.5)** (page 264), if `Γ''` is a subdrawing of `Γ` and `r ⊆ r''`, then the +vertices of `Γ''` incident with `r` in `Γ` are also incident with `r''` in `Γ''`: +`Z ∩ V(Γ'') ⊆ Z''`. -/ +theorem incident_vertices_inter_subset {Γ Γ'' : Drawing S} {r r'' : Set S} + (hr : r ⊆ r'') : + {v ∈ Γ.V | v ∈ closure r} ∩ Γ''.V ⊆ {v ∈ Γ''.V | v ∈ closure r''} := by + rintro v ⟨⟨_, hvr⟩, hv''⟩ + exact ⟨hv'', closure_mono hr hvr⟩ + +/-- In Case 1 of **(7.5)** (page 264), "Certainly $\Gamma'$ is a subdrawing of $\Gamma \setminus Z$, +since $Z \cap V(\Gamma'') +\subseteq Z''$": if `Γ''` is a subdrawing of `Γ`, `r ⊆ r''`, and `Γ'` is a subdrawing of +`Γ'' \ Z''`, then `Γ'` is a subdrawing of `Γ \ Z`. -/ +theorem isSubdrawing_deleteVertices_of_region_subset {Γ Γ'' Γ' : Drawing S} {r r'' : Set S} + (hSub'' : Γ''.IsSubdrawing Γ) (hr : r ⊆ r'') + (hSub' : Γ'.IsSubdrawing (deleteVertices Γ'' {v ∈ Γ''.V | v ∈ closure r''})) : + Γ'.IsSubdrawing (deleteVertices Γ {v ∈ Γ.V | v ∈ closure r}) := + hSub'.trans (deleteVertices_mono_subdrawing hSub'' (incident_vertices_inter_subset hr)) + +/-- Under the hypotheses of **(7.2)** (pages 259–260), the point set of `Γ` is contained in the +point set of `Γ'' = Γ.interSet (closure (univ \ Δ))` together with the merged region +`Y = r ∪ (Δ \ {v})`: `U(Γ) ⊆ U(Γ'') ∪ r''`. -/ +theorem interSet_compl_disc_U_subset + {Γ : Drawing S} {Δ F r : Set S} {v : S} + (hbd : subBd Δ = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) (hFV : F ∩ Γ.V = {v}) : + Γ.U ⊆ (Γ.interSet (closure (univ \ Δ))).U ∪ (r ∪ (Δ \ {v})) := by + have hfr : frontier Δ = F := (subBd_eq_frontier Δ).symm.trans hbd + have hvFV : v ∈ F ∩ Γ.V := hFV.symm ▸ mem_singleton v + have hnorm : frontier (closure (univ \ Δ)) ∩ Γ.U ⊆ Γ.V := by + rw [← compl_eq_univ_sdiff, closure_compl, frontier_compl] + exact fun x hx => hn ⟨hfr ▸ frontier_interior_subset hx.1, hx.2⟩ + have hUeq := interSet_U_eq_of_normal_frontier isClosed_closure hnorm + intro x hx + by_cases hxout : x ∈ closure (univ \ Δ) + · exact Or.inl (hUeq.symm ▸ ⟨hx, hxout⟩) + · have hxi : x ∈ interior Δ := by + by_contra h + exact hxout (by rw [← compl_eq_univ_sdiff, closure_compl]; exact h) + exact Or.inr (Or.inr ⟨interior_subset hxi, fun hxv => + (hfr.symm ▸ hvFV.1).2 (mem_singleton_iff.mp hxv ▸ hxi)⟩) + +/-! ## 2. Case 1 of (7.4) (pages 262–263) -/ + +/-- The inductive step (Case 1) in the proof of **(7.4)** (Graph Minors XII, pages 262–263): +given a closed disc `D` bounded by a `Γ`-normal `O`-arc `F` with `F ∩ V(Γ) = {v}` and +`(Γ ∩ D, Γ ∩ closure (Σ \ D)) ∈ T`, let `Γ'' = Γ.interSet (closure (univ \ D))` and +`T'' = restrictTangle T Γ''.toHypergraph`. Then **(7.2)** provides a metric `d''` for `T''` in +`Γ''`, and any `(Γ', T', d', r')` satisfying the conclusion of **(7.4)** for `(Γ'', θ, T'', d'', v)` +also satisfies the conclusion of **(7.4)** for `(Γ, θ, T, d, v)`. -/ +theorem theorem_7_4_case_1_step [ConnectedSpace S] (hS : IsClosedSurface S) + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {v : S} + (hθ : 2 ≤ θ) (hd : HasTangleMetric Γ θ T d) (hv : v ∈ Γ.V) + {D F : Set S} (hD : IsClosedDisc D) (hF : IsOArc F) (hbd : subBd D = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) (hFV : F ∩ Γ.V = {v}) + (hm : ((PaintingOrDrawing.drawing Γ).inter D, + (PaintingOrDrawing.drawing Γ).interOutside D) ∈ T) : + let Γ'' := Γ.interSet (closure (univ \ D)) + let T'' := restrictTangle T Γ''.toHypergraph + v ∈ Γ''.V ∧ + ∃ (d'' : Set S → Set S → ℕ), + HasTangleMetric Γ'' θ T'' d'' ∧ + (∀ (Γ' : Drawing S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r' : Set S), + Γ'.IsSubdrawing (deleteVertices Γ'' {v}) → + (PaintingOrDrawing.drawing Γ').IsTwoCell → + HasTangleMetric Γ' (θ - 1) T' d' → + r' ∈ Γ'.R → v ∈ r' → + Γ''.U ⊆ Γ'.U ∪ r' → + (∀ a ∈ Γ''.A ∩ Γ'.A, ∀ b ∈ Γ''.A ∩ Γ'.A, d'' a b - 2 ≤ d' a b) → + (∀ a ∈ Γ''.A ∩ Γ'.A, d'' a {v} - 1 ≤ d' a r') → + (∀ a ∈ Γ''.A, a ⊆ r' → d'' a {v} ≤ 2) → + Γ'.IsSubdrawing (deleteVertices Γ {v}) ∧ + (PaintingOrDrawing.drawing Γ').IsTwoCell ∧ + HasTangleMetric Γ' (θ - 1) T' d' ∧ + r' ∈ Γ'.R ∧ v ∈ r' ∧ + Γ.U ⊆ Γ'.U ∪ r' ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 2 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a {v} - 1 ≤ d' a r') ∧ + (∀ a ∈ Γ.A, a ⊆ r' → d a {v} ≤ 2)) := by + intro Γ'' T'' + have hSub'' : Γ''.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hfront : frontier D = F := (subBd_eq_frontier D).symm.trans hbd + have hvF : v ∈ F := (hFV.symm ▸ mem_singleton v).1 + have hv'' : v ∈ Γ''.V := by + have hvFront : v ∈ frontier D := hfront.symm ▸ hvF + rw [frontier_eq_closure_inter_closure] at hvFront + exact (mem_interSet_V_iff isClosed_closure).mpr + ⟨hv, by simpa only [compl_eq_univ_sdiff] using hvFront.2⟩ + obtain ⟨r, hr, hFr⟩ := exists_region_of_normal_circle_single_vertex hF hn hFV + obtain ⟨_, hlost, d'', r'', hd'', hr'', hrr'', hcomp_ab, _⟩ := + theorem_7_2_proof hS hθ hd hD hbd hn hFV hr hFr hm + have hY : r ∪ (D \ {v}) ∈ Γ''.R := theorem_7_2_region hS hD hbd hn hFV hr hFr + obtain ⟨x₀, hx₀r⟩ := region_nonempty hr + have hr''_eq : r'' = r ∪ (D \ {v}) := + atom_eq_of_inter_nonempty (Or.inr hr'') (Or.inr hY) ⟨x₀, hrr'' hx₀r, Or.inl hx₀r⟩ + have hU_Γ'' : Γ.U ⊆ Γ''.U ∪ r'' := + hr''_eq.symm ▸ interSet_compl_disc_U_subset hbd hn hFV + refine ⟨hv'', d'', hd'', ?_⟩ + intro Γ' T' d' r' hSub' htwo' hd' hr' hvr' hU' hii' hiii' hiv' + have hSub_Γ'Γ'' : Γ'.IsSubdrawing Γ'' := + hSub'.trans (deleteVertices_isSubdrawing Γ'' {v}) + have hSub_del : Γ'.IsSubdrawing (deleteVertices Γ {v}) := + hSub'.trans (deleteVertices_mono_subdrawing hSub'' inter_subset_left) + have hv_bd : v ∈ discBd D := + ((IsClosedDisc.frontier_eq_discBd hS hD).symm.trans hfront) ▸ hvF + have hInt_sub : discInt D ⊆ r'' := fun x hx => + hr''_eq ▸ Or.inr ⟨hx.1, fun hxv => hx.2 (mem_singleton_iff.mp hxv ▸ hv_bd)⟩ + have hvr''_cl : v ∈ closure r'' := + closure_mono hInt_sub (hD.subset_closure_discInt (Surface.discBd_subset D hv_bd)) + have hr''_sub_r' : r'' ⊆ r' := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨w, hwr', hwr''⟩ := mem_closure_iff.mp hvr''_cl r' (region_isOpen hr') hvr' + exact region_subset_region_of_inter_nonempty hSub_Γ'Γ'' hr'' hr' ⟨w, hwr'', hwr'⟩ + have hU_Γ : Γ.U ⊆ Γ'.U ∪ r' := + hU_Γ''.trans (union_subset hU' (hr''_sub_r'.trans subset_union_right)) + have hvA_Γ : ({v} : Set S) ∈ Γ.A := Or.inl (Or.inl ⟨v, hv, rfl⟩) + have hvA_Γ'' : ({v} : Set S) ∈ Γ''.A := Or.inl (Or.inl ⟨v, hv'', rfl⟩) + refine ⟨hSub_del, htwo', hd', hr', hvr', hU_Γ, ?_, ?_, ?_⟩ + · intro a ha b hb + have ha'' : a ∈ Γ''.A := shared_atom_mem_intermediate hSub'' hSub_Γ'Γ'' ha.1 ha.2 + have hb'' : b ∈ Γ''.A := shared_atom_mem_intermediate hSub'' hSub_Γ'Γ'' hb.1 hb.2 + have h1 := hcomp_ab a ⟨ha.1, ha''⟩ b ⟨hb.1, hb''⟩ + have h2 := hii' a ⟨ha'', ha.2⟩ b ⟨hb'', hb.2⟩ + omega + · intro a ha + have ha'' : a ∈ Γ''.A := shared_atom_mem_intermediate hSub'' hSub_Γ'Γ'' ha.1 ha.2 + have h1 := hcomp_ab a ⟨ha.1, ha''⟩ {v} ⟨hvA_Γ, hvA_Γ''⟩ + have h2 := hiii' a ⟨ha'', ha.2⟩ + omega + · intro a ha har' + by_cases ha'' : a ∈ Γ''.A + · have h1 := hcomp_ab a ⟨ha, ha''⟩ {v} ⟨hvA_Γ, hvA_Γ''⟩ + have h2 := hiv' a ha'' har' + omega + · have h1 := hlost a ⟨ha, ha''⟩ + omega + +/-- The finite selected-disc reduction for **(7.4)** (Graph Minors XII, pages 262–263): +by induction on `|E(Γ)|` using `theorem_7_4_case_1_step`, there is a 2-cell subdrawing `Γ₀` of `Γ` +with `v ∈ V(Γ₀)` and a respectful tangle `T₀` of order `θ` in `Γ₀` with metric `d₀` such that: +1. no `Γ₀`-normal `O`-arc `F` with `F ∩ V(Γ₀) = {v}` has an edge of `Γ₀` in its selected disc, and +2. any `(Γ', T', d', r')` satisfying the conclusion of **(7.4)** for `(Γ₀, θ, T₀, d₀, v)` also + satisfies the conclusion of **(7.4)** for `(Γ, θ, T, d, v)`. -/ +theorem exists_theorem_7_4_disc_reduction [ConnectedSpace S] (hS : IsClosedSurface S) + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {v : S} + (hθ : 2 ≤ θ) (hd : HasTangleMetric Γ θ T d) (hv : v ∈ Γ.V) : + ∃ (Γ₀ : Drawing S) + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ), + Γ₀.IsSubdrawing Γ ∧ v ∈ Γ₀.V ∧ + HasTangleMetric Γ₀ θ T₀ d₀ ∧ + (∀ D F : Set S, IsClosedDisc D → IsOArc F → subBd D = F → + (PaintingOrDrawing.drawing Γ₀).IsNormal F → F ∩ Γ₀.V = {v} → + ((PaintingOrDrawing.drawing Γ₀).inter D, + (PaintingOrDrawing.drawing Γ₀).interOutside D) ∈ T₀ → + ∀ e ∈ Γ₀.E, ¬ e ⊆ D) ∧ + (∀ (Γ' : Drawing S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r' : Set S), + Γ'.IsSubdrawing (deleteVertices Γ₀ {v}) → + (PaintingOrDrawing.drawing Γ').IsTwoCell → + HasTangleMetric Γ' (θ - 1) T' d' → + r' ∈ Γ'.R → v ∈ r' → + Γ₀.U ⊆ Γ'.U ∪ r' → + (∀ a ∈ Γ₀.A ∩ Γ'.A, ∀ b ∈ Γ₀.A ∩ Γ'.A, d₀ a b - 2 ≤ d' a b) → + (∀ a ∈ Γ₀.A ∩ Γ'.A, d₀ a {v} - 1 ≤ d' a r') → + (∀ a ∈ Γ₀.A, a ⊆ r' → d₀ a {v} ≤ 2) → + Γ'.IsSubdrawing (deleteVertices Γ {v}) ∧ + (PaintingOrDrawing.drawing Γ').IsTwoCell ∧ + HasTangleMetric Γ' (θ - 1) T' d' ∧ + r' ∈ Γ'.R ∧ v ∈ r' ∧ + Γ.U ⊆ Γ'.U ∪ r' ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 2 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a {v} - 1 ≤ d' a r') ∧ + (∀ a ∈ Γ.A, a ⊆ r' → d a {v} ≤ 2)) := by + classical + have hex : ∃ n : ℕ, ∃ (Γ₀ : Drawing S) + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ), + Γ₀.IsSubdrawing Γ ∧ v ∈ Γ₀.V ∧ + HasTangleMetric Γ₀ θ T₀ d₀ ∧ + (∀ (Γ' : Drawing S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r' : Set S), + Γ'.IsSubdrawing (deleteVertices Γ₀ {v}) → + (PaintingOrDrawing.drawing Γ').IsTwoCell → + HasTangleMetric Γ' (θ - 1) T' d' → + r' ∈ Γ'.R → v ∈ r' → + Γ₀.U ⊆ Γ'.U ∪ r' → + (∀ a ∈ Γ₀.A ∩ Γ'.A, ∀ b ∈ Γ₀.A ∩ Γ'.A, d₀ a b - 2 ≤ d' a b) → + (∀ a ∈ Γ₀.A ∩ Γ'.A, d₀ a {v} - 1 ≤ d' a r') → + (∀ a ∈ Γ₀.A, a ⊆ r' → d₀ a {v} ≤ 2) → + Γ'.IsSubdrawing (deleteVertices Γ {v}) ∧ + (PaintingOrDrawing.drawing Γ').IsTwoCell ∧ + HasTangleMetric Γ' (θ - 1) T' d' ∧ + r' ∈ Γ'.R ∧ v ∈ r' ∧ + Γ.U ⊆ Γ'.U ∪ r' ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 2 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a {v} - 1 ≤ d' a r') ∧ + (∀ a ∈ Γ.A, a ⊆ r' → d a {v} ≤ 2)) ∧ + Γ₀.E.ncard = n := + ⟨Γ.E.ncard, Γ, T, d, Drawing.IsSubdrawing.refl Γ, hv, hd, + fun _ _ _ _ h1 h2 h3 h4 h5 h6 h7 h8 h9 => ⟨h1, h2, h3, h4, h5, h6, h7, h8, h9⟩, rfl⟩ + obtain ⟨Γ₀, T₀, d₀, hΓ₀, hv₀, hd₀, hlift₀, hcount⟩ := Nat.find_spec hex + refine ⟨Γ₀, T₀, d₀, hΓ₀, hv₀, hd₀, ?_, hlift₀⟩ + intro D F hD hF hbd hn hFV hm e he heD + obtain ⟨hv₁, d₁, hd₁, hstep₁⟩ := + theorem_7_4_case_1_step hS hθ hd₀ hv₀ hD hF hbd hn hFV hm + let Γ₁ := Γ₀.interSet (closure (univ \ D)) + let T₁ := restrictTangle T₀ Γ₁.toHypergraph + have hΓ₁ : Γ₁.IsSubdrawing Γ₀ := Drawing.span_isSubdrawing Γ₀ _ _ + have hfront : frontier D = F := (subBd_eq_frontier D).symm.trans hbd + have hless : Γ₁.E.ncard < Γ₀.E.ncard := ncard_edges_outside_lt_of_edge_inside + (fun x hx => hn ⟨hfront ▸ hx.1, hx.2⟩) he heD + have hlift₁ : ∀ (Γ' : Drawing S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r' : Set S), + Γ'.IsSubdrawing (deleteVertices Γ₁ {v}) → + (PaintingOrDrawing.drawing Γ').IsTwoCell → + HasTangleMetric Γ' (θ - 1) T' d' → + r' ∈ Γ'.R → v ∈ r' → + Γ₁.U ⊆ Γ'.U ∪ r' → + (∀ a ∈ Γ₁.A ∩ Γ'.A, ∀ b ∈ Γ₁.A ∩ Γ'.A, d₁ a b - 2 ≤ d' a b) → + (∀ a ∈ Γ₁.A ∩ Γ'.A, d₁ a {v} - 1 ≤ d' a r') → + (∀ a ∈ Γ₁.A, a ⊆ r' → d₁ a {v} ≤ 2) → + Γ'.IsSubdrawing (deleteVertices Γ {v}) ∧ + (PaintingOrDrawing.drawing Γ').IsTwoCell ∧ + HasTangleMetric Γ' (θ - 1) T' d' ∧ + r' ∈ Γ'.R ∧ v ∈ r' ∧ + Γ.U ⊆ Γ'.U ∪ r' ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 2 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a {v} - 1 ≤ d' a r') ∧ + (∀ a ∈ Γ.A, a ⊆ r' → d a {v} ≤ 2) := by + intro Γ' T' d' r' h1 h2 h3 h4 h5 h6 h7 h8 h9 + obtain ⟨s1, s2, s3, s4, s5, s6, s7, s8, s9⟩ := + hstep₁ Γ' T' d' r' h1 h2 h3 h4 h5 h6 h7 h8 h9 + exact hlift₀ Γ' T' d' r' s1 s2 s3 s4 s5 s6 s7 s8 s9 + have hminimal : Nat.find hex ≤ Γ₁.E.ncard := Nat.find_min' hex + ⟨Γ₁, T₁, d₁, hΓ₁.trans hΓ₀, hv₁, hd₁, hlift₁, rfl⟩ + rw [← hcount] at hminimal + exact (Nat.not_le_of_lt hless) hminimal + +/-! ## 3. Case 1 of (7.5) (page 264) -/ + +/-- In Case 1 of **(7.5)** (Graph Minors XII, page 264, line 639): +"If $a \notin A(\Gamma'')$, then $a \cap ins(F) \ne \emptyset$, and so $d(a, r) \le 1 \le 3$." -/ +theorem theorem_7_5_lost_atoms_region (hS : IsClosedSurface S) [ConnectedSpace S] + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hθ : 2 ≤ θ) (hd : HasTangleMetric Γ θ T d) + {Δ F r : Set S} {v : S} (hΔ : IsClosedDisc Δ) (hbd : subBd Δ = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) + (hFV : F ∩ Γ.V = {v}) (hr : r ∈ Γ.R) (hFr : F \ {v} ⊆ r) + (hm : ((PaintingOrDrawing.drawing Γ).inter Δ, + (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T) + {a : Set S} (ha : a ∈ Γ.A) + (han : a ∉ (Γ.interSet (closure (univ \ Δ))).A) : d a r ≤ 1 := by + let Γ'' := Γ.interSet (closure (univ \ Δ)) + let Y := r ∪ (Δ \ {v}) + have hsub : Γ''.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + have hY : Y ∈ Γ''.R := theorem_7_2_region hS hΔ hbd hn hFV hr hFr + have hfr : frontier Δ = F := (subBd_eq_frontier Δ).symm.trans hbd + have hdb : discBd Δ = F := (IsClosedDisc.frontier_eq_discBd hS hΔ).symm.trans hfr + have hcover : Γ.U ⊆ Γ''.U ∪ Y := interSet_compl_disc_U_subset hbd hn hFV + obtain ⟨a', ha', haa'⟩ := exists_atom_superset_of_isSubdrawing hsub ha + have haY : a ⊆ Y := by + rcases atom_eq_or_eq_region_of_U_subset hsub hY hcover ha ha' haa' with + ⟨_, hmem⟩ | ⟨_, haY⟩ + · exact (han hmem.2).elim + · exact haY + have hrΔ : (r ∩ Δ).Nonempty := by + obtain ⟨w, hw, hwv⟩ := + (infinite_of_isOArc hΔ.isOArc_discBd).exists_notMem_finite (finite_singleton v) + exact ⟨w, hFr ⟨hdb ▸ hw, hwv⟩, Surface.discBd_subset Δ hw⟩ + have haΔ : (a ∩ Δ).Nonempty := by + obtain ⟨x, hxa⟩ := atom_nonempty' ha + rcases haY hxa with hxr | hxΔ + · have heq : a = r := atom_eq_of_inter_nonempty ha (Or.inr hr) ⟨x, hxa, hxr⟩ + exact heq.symm ▸ hrΔ + · exact ⟨x, hxa, hxΔ.1⟩ + have hcard : (F ∩ Γ.V).ncard < θ := by rw [hFV, ncard_singleton]; omega + have hbound := dist_le_of_oarc_disc hS hd (hdb ▸ hΔ.isOArc_discBd) hn hcard hΔ hbd hm ha + (Or.inr hr) haΔ hrΔ + simpa only [hFV, ncard_singleton] using hbound + +/-- The inductive step (Case 1) in the proof of **(7.5)** (Graph Minors XII, page 264, +lines 601–640): +Suppose there is a `Γ`-normal `O`-arc `F ⊆ r ∪ {v}` with `F ∩ V(Γ) = {v}` and selected closed +disc `Δ = ins(F)`. Let `Γ'' = Γ.interSet (closure (univ \ Δ))` and +`T'' = restrictTangle T Γ''.toHypergraph`. Then **(7.2)** provides a metric `d''` for `T''` in +`Γ''` and a region `r'' ∈ R(Γ'')` with `r ⊆ r''` satisfying `(v)` and `(vi)` of page 264, and any +`(Γ', T', d', r')` satisfying the conclusion `(i')`–`(iv')` of **(7.5)** for `(Γ'', θ, T'', d'', +r'')` +also satisfies `(i)`–`(iv)` of **(7.5)** for `(Γ, θ, T, d, r)`. -/ +theorem theorem_7_5_case_1_step [ConnectedSpace S] (hS : IsClosedSurface S) + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {r : Set S} + (hθ : 3 ≤ θ) (hd : HasTangleMetric Γ θ T d) (hr : r ∈ Γ.R) + {Δ F : Set S} {v : S} (hΔ : IsClosedDisc Δ) (hbd : subBd Δ = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) (hFV : F ∩ Γ.V = {v}) + (hFr : F \ {v} ⊆ r) + (hm : ((PaintingOrDrawing.drawing Γ).inter Δ, + (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T) : + let Γ'' := Γ.interSet (closure (univ \ Δ)) + let T'' := restrictTangle T Γ''.toHypergraph + ∃ (d'' : Set S → Set S → ℕ) (r'' : Set S), + HasTangleMetric Γ'' θ T'' d'' ∧ + r'' ∈ Γ''.R ∧ r ⊆ r'' ∧ + (∀ a ∈ Γ.A ∩ Γ''.A, ∀ b ∈ Γ.A ∩ Γ''.A, d a b ≤ d'' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ''.A, d a r ≤ d'' a r'') ∧ + (∀ (Γ' : Drawing S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r' : Set S), + Γ'.IsSubdrawing (deleteVertices Γ'' {w ∈ Γ''.V | w ∈ closure r''}) → + (PaintingOrDrawing.drawing Γ').IsTwoCell → + HasTangleMetric Γ' (θ - 2) T' d' → + r' ∈ Γ'.R → r'' ⊆ r' → + Γ''.U ⊆ Γ'.U ∪ r' → + (∀ a ∈ Γ''.A ∩ Γ'.A, ∀ b ∈ Γ''.A ∩ Γ'.A, d'' a b - 4 ≤ d' a b) → + (∀ a ∈ Γ''.A ∩ Γ'.A, d'' a r'' - 2 ≤ d' a r') → + (∀ a ∈ Γ''.A, a ⊆ r' → d'' a r'' ≤ 3) → + Γ'.IsSubdrawing (deleteVertices Γ {w ∈ Γ.V | w ∈ closure r}) ∧ + (PaintingOrDrawing.drawing Γ').IsTwoCell ∧ + HasTangleMetric Γ' (θ - 2) T' d' ∧ + r' ∈ Γ'.R ∧ r ⊆ r' ∧ + Γ.U ⊆ Γ'.U ∪ r' ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 4 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a r - 2 ≤ d' a r') ∧ + (∀ a ∈ Γ.A, a ⊆ r' → d a r ≤ 3)) := by + intro Γ'' T'' + have hθ2 : 2 ≤ θ := by omega + have hSub'' : Γ''.IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + obtain ⟨_, _, d'', r'', hd'', hr'', hrr'', hv_ab, hvi_ar⟩ := + theorem_7_2_proof hS hθ2 hd hΔ hbd hn hFV hr hFr hm + have hY : r ∪ (Δ \ {v}) ∈ Γ''.R := theorem_7_2_region hS hΔ hbd hn hFV hr hFr + obtain ⟨x₀, hx₀r⟩ := region_nonempty hr + have hr''_eq : r'' = r ∪ (Δ \ {v}) := + atom_eq_of_inter_nonempty (Or.inr hr'') (Or.inr hY) ⟨x₀, hrr'' hx₀r, Or.inl hx₀r⟩ + have hU_Γ'' : Γ.U ⊆ Γ''.U ∪ r'' := + hr''_eq.symm ▸ interSet_compl_disc_U_subset hbd hn hFV + refine ⟨d'', r'', hd'', hr'', hrr'', hv_ab, hvi_ar, ?_⟩ + intro Γ' T' d' r' hSub' htwo' hd' hr' hr''r' hU' hii' hiii' hiv' + have hSub_Γ'Γ'' : Γ'.IsSubdrawing Γ'' := + hSub'.trans (deleteVertices_isSubdrawing Γ'' _) + have hSub_del : Γ'.IsSubdrawing (deleteVertices Γ {w ∈ Γ.V | w ∈ closure r}) := + isSubdrawing_deleteVertices_of_region_subset hSub'' hrr'' hSub' + have hrr' : r ⊆ r' := hrr''.trans hr''r' + have hU_Γ : Γ.U ⊆ Γ'.U ∪ r' := + hU_Γ''.trans (union_subset hU' (hr''r'.trans subset_union_right)) + refine ⟨hSub_del, htwo', hd', hr', hrr', hU_Γ, ?_, ?_, ?_⟩ + · intro a ha b hb + have ha'' : a ∈ Γ''.A := shared_atom_mem_intermediate hSub'' hSub_Γ'Γ'' ha.1 ha.2 + have hb'' : b ∈ Γ''.A := shared_atom_mem_intermediate hSub'' hSub_Γ'Γ'' hb.1 hb.2 + have h1 := hv_ab a ⟨ha.1, ha''⟩ b ⟨hb.1, hb''⟩ + have h2 := hii' a ⟨ha'', ha.2⟩ b ⟨hb'', hb.2⟩ + omega + · intro a ha + have ha'' : a ∈ Γ''.A := shared_atom_mem_intermediate hSub'' hSub_Γ'Γ'' ha.1 ha.2 + have h1 := hvi_ar a ⟨ha.1, ha''⟩ + have h2 := hiii' a ⟨ha'', ha.2⟩ + omega + · intro a ha har' + by_cases ha'' : a ∈ Γ''.A + · have h1 := hvi_ar a ⟨ha, ha''⟩ + have h2 := hiv' a ha'' har' + omega + · have h1 := theorem_7_5_lost_atoms_region hS hθ2 hd hΔ hbd hn hFV hr hFr hm ha ha'' + omega + +/-- The finite selected-disc reduction for **(7.5)** (Graph Minors XII, page 264): +by induction on `|E(Γ)|` using `theorem_7_5_case_1_step`, there is a 2-cell subdrawing `Γ₀` of `Γ`, +a respectful tangle `T₀` of order `θ` in `Γ₀` with metric `d₀`, and a region `r₀ ∈ R(Γ₀)` with +`r ⊆ r₀` such that: +1. no `Γ₀`-normal `O`-arc `F ⊆ r₀ ∪ {v}` with `F ∩ V(Γ₀) = {v}` has an edge of `Γ₀` in its + selected disc `Δ = ins(F)`, and +2. any `(Γ', T', d', r')` satisfying the conclusion of **(7.5)** for `(Γ₀, θ, T₀, d₀, r₀)` also + satisfies the conclusion of **(7.5)** for `(Γ, θ, T, d, r)`. -/ +theorem exists_theorem_7_5_disc_reduction [ConnectedSpace S] (hS : IsClosedSurface S) + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {r : Set S} + (hθ : 3 ≤ θ) (hd : HasTangleMetric Γ θ T d) (hr : r ∈ Γ.R) : + ∃ (Γ₀ : Drawing S) + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ) (r₀ : Set S), + Γ₀.IsSubdrawing Γ ∧ + HasTangleMetric Γ₀ θ T₀ d₀ ∧ + r₀ ∈ Γ₀.R ∧ r ⊆ r₀ ∧ + (∀ Δ F : Set S, ∀ v : S, IsClosedDisc Δ → subBd Δ = F → + (PaintingOrDrawing.drawing Γ₀).IsNormal F → F ∩ Γ₀.V = {v} → + F \ {v} ⊆ r₀ → + ((PaintingOrDrawing.drawing Γ₀).inter Δ, + (PaintingOrDrawing.drawing Γ₀).interOutside Δ) ∈ T₀ → + ∀ e ∈ Γ₀.E, ¬ e ⊆ Δ) ∧ + (∀ (Γ' : Drawing S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r' : Set S), + Γ'.IsSubdrawing (deleteVertices Γ₀ {w ∈ Γ₀.V | w ∈ closure r₀}) → + (PaintingOrDrawing.drawing Γ').IsTwoCell → + HasTangleMetric Γ' (θ - 2) T' d' → + r' ∈ Γ'.R → r₀ ⊆ r' → + Γ₀.U ⊆ Γ'.U ∪ r' → + (∀ a ∈ Γ₀.A ∩ Γ'.A, ∀ b ∈ Γ₀.A ∩ Γ'.A, d₀ a b - 4 ≤ d' a b) → + (∀ a ∈ Γ₀.A ∩ Γ'.A, d₀ a r₀ - 2 ≤ d' a r') → + (∀ a ∈ Γ₀.A, a ⊆ r' → d₀ a r₀ ≤ 3) → + Γ'.IsSubdrawing (deleteVertices Γ {w ∈ Γ.V | w ∈ closure r}) ∧ + (PaintingOrDrawing.drawing Γ').IsTwoCell ∧ + HasTangleMetric Γ' (θ - 2) T' d' ∧ + r' ∈ Γ'.R ∧ r ⊆ r' ∧ + Γ.U ⊆ Γ'.U ∪ r' ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 4 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a r - 2 ≤ d' a r') ∧ + (∀ a ∈ Γ.A, a ⊆ r' → d a r ≤ 3)) := by + classical + have hex : ∃ n : ℕ, ∃ (Γ₀ : Drawing S) + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ) (r₀ : Set S), + Γ₀.IsSubdrawing Γ ∧ + HasTangleMetric Γ₀ θ T₀ d₀ ∧ + r₀ ∈ Γ₀.R ∧ r ⊆ r₀ ∧ + (∀ (Γ' : Drawing S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r' : Set S), + Γ'.IsSubdrawing (deleteVertices Γ₀ {w ∈ Γ₀.V | w ∈ closure r₀}) → + (PaintingOrDrawing.drawing Γ').IsTwoCell → + HasTangleMetric Γ' (θ - 2) T' d' → + r' ∈ Γ'.R → r₀ ⊆ r' → + Γ₀.U ⊆ Γ'.U ∪ r' → + (∀ a ∈ Γ₀.A ∩ Γ'.A, ∀ b ∈ Γ₀.A ∩ Γ'.A, d₀ a b - 4 ≤ d' a b) → + (∀ a ∈ Γ₀.A ∩ Γ'.A, d₀ a r₀ - 2 ≤ d' a r') → + (∀ a ∈ Γ₀.A, a ⊆ r' → d₀ a r₀ ≤ 3) → + Γ'.IsSubdrawing (deleteVertices Γ {w ∈ Γ.V | w ∈ closure r}) ∧ + (PaintingOrDrawing.drawing Γ').IsTwoCell ∧ + HasTangleMetric Γ' (θ - 2) T' d' ∧ + r' ∈ Γ'.R ∧ r ⊆ r' ∧ + Γ.U ⊆ Γ'.U ∪ r' ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 4 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a r - 2 ≤ d' a r') ∧ + (∀ a ∈ Γ.A, a ⊆ r' → d a r ≤ 3)) ∧ + Γ₀.E.ncard = n := + ⟨Γ.E.ncard, Γ, T, d, r, Drawing.IsSubdrawing.refl Γ, hd, hr, Subset.rfl, + fun _ _ _ _ h1 h2 h3 h4 h5 h6 h7 h8 h9 => ⟨h1, h2, h3, h4, h5, h6, h7, h8, h9⟩, rfl⟩ + obtain ⟨Γ₀, T₀, d₀, r₀, hΓ₀, hd₀, hr₀, hrr₀, hlift₀, hcount⟩ := Nat.find_spec hex + refine ⟨Γ₀, T₀, d₀, r₀, hΓ₀, hd₀, hr₀, hrr₀, ?_, hlift₀⟩ + intro Δ F v hΔ hbd hn hFV hFr₀ hm e he heΔ + obtain ⟨d₁, r₁, hd₁, hr₁, hr₀r₁, _, _, hstep₁⟩ := + theorem_7_5_case_1_step hS hθ hd₀ hr₀ hΔ hbd hn hFV hFr₀ hm + let Γ₁ := Γ₀.interSet (closure (univ \ Δ)) + let T₁ := restrictTangle T₀ Γ₁.toHypergraph + have hΓ₁ : Γ₁.IsSubdrawing Γ₀ := Drawing.span_isSubdrawing Γ₀ _ _ + have hfront : frontier Δ = F := (subBd_eq_frontier Δ).symm.trans hbd + have hless : Γ₁.E.ncard < Γ₀.E.ncard := ncard_edges_outside_lt_of_edge_inside + (fun x hx => hn ⟨hfront ▸ hx.1, hx.2⟩) he heΔ + have hlift₁ : ∀ (Γ' : Drawing S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r' : Set S), + Γ'.IsSubdrawing (deleteVertices Γ₁ {w ∈ Γ₁.V | w ∈ closure r₁}) → + (PaintingOrDrawing.drawing Γ').IsTwoCell → + HasTangleMetric Γ' (θ - 2) T' d' → + r' ∈ Γ'.R → r₁ ⊆ r' → + Γ₁.U ⊆ Γ'.U ∪ r' → + (∀ a ∈ Γ₁.A ∩ Γ'.A, ∀ b ∈ Γ₁.A ∩ Γ'.A, d₁ a b - 4 ≤ d' a b) → + (∀ a ∈ Γ₁.A ∩ Γ'.A, d₁ a r₁ - 2 ≤ d' a r') → + (∀ a ∈ Γ₁.A, a ⊆ r' → d₁ a r₁ ≤ 3) → + Γ'.IsSubdrawing (deleteVertices Γ {w ∈ Γ.V | w ∈ closure r}) ∧ + (PaintingOrDrawing.drawing Γ').IsTwoCell ∧ + HasTangleMetric Γ' (θ - 2) T' d' ∧ + r' ∈ Γ'.R ∧ r ⊆ r' ∧ + Γ.U ⊆ Γ'.U ∪ r' ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 4 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a r - 2 ≤ d' a r') ∧ + (∀ a ∈ Γ.A, a ⊆ r' → d a r ≤ 3) := by + intro Γ' T' d' r' h1 h2 h3 h4 h5 h6 h7 h8 h9 + obtain ⟨s1, s2, s3, s4, s5, s6, s7, s8, s9⟩ := + hstep₁ Γ' T' d' r' h1 h2 h3 h4 h5 h6 h7 h8 h9 + exact hlift₀ Γ' T' d' r' s1 s2 s3 s4 s5 s6 s7 s8 s9 + have hminimal : Nat.find hex ≤ Γ₁.E.ncard := Nat.find_min' hex + ⟨Γ₁, T₁, d₁, r₁, hΓ₁.trans hΓ₀, hd₁, hr₁, hrr₀.trans hr₀r₁, hlift₁, rfl⟩ + rw [← hcount] at hminimal + exact (Nat.not_le_of_lt hless) hminimal + +/-! ## 4. Transition to Case 2 of (7.5): no parallel radial spokes at the region hub (page 265) -/ + +/-- In a 2-cell drawing `Γ` on a closed surface `S`, if `D` is a closed disc whose `Γ`-normal +boundary `F = subBd D` meets `Γ.V` only at `{v}`, and `D` contains no edge of `Γ`, then +`Γ.V ∩ D = {v}` (without requiring `(deleteVertices Γ {v}).IsTwoCell`). -/ +theorem vertices_in_selected_region_disc_of_no_edges [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} + (htwo : (PaintingOrDrawing.drawing Γ).IsTwoCell) + {D F : Set S} {v : S} + (hD : IsClosedDisc D) (hbd : subBd D = F) + (hn : (PaintingOrDrawing.drawing Γ).IsNormal F) (hFV : F ∩ Γ.V = {v}) + (hno : ∀ e ∈ Γ.E, ¬ e ⊆ D) : Γ.V ∩ D = {v} := by + have hfront : frontier D = F := (subBd_eq_frontier D).symm.trans hbd + have hvFV : v ∈ F ∩ Γ.V := hFV.symm ▸ mem_singleton v + have hvD : v ∈ D := hD.isClosed.closure_subset_iff.mpr subset_rfl ((hfront.symm ▸ hvFV.1).1) + apply Subset.antisymm + · rintro w ⟨hwV, hwD⟩ + by_contra hwv + have hw_not_F : w ∉ F := fun hwF => hwv (mem_singleton_iff.mp (hFV.subset ⟨hwF, hwV⟩)) + have hw_int : w ∈ interior D := by + by_contra hw_nint + exact hw_not_F (hfront ▸ ⟨subset_closure hwD, hw_nint⟩) + have hUD_sub_V : Γ.U ∩ D ⊆ Γ.V := by + rintro x ⟨hxU, hxD⟩ + by_cases hxV : x ∈ Γ.V + · exact hxV + · obtain ⟨e, he, hxe⟩ := Γ.exists_edge_of_mem hxU hxV + have hdis : Disjoint e (frontier D) := by + apply disjoint_left.mpr + intro y hye hyF + exact (he.2.1 hye).2 (hn ⟨hfront ▸ hyF, (he.2.1 hye).1⟩) + exact (hno e he (subset_of_disjoint_frontier he.2.2.1.isConnected.isPreconnected + hD.isClosed hdis hxe hxD)).elim + have hUint_eq : Γ.U ∩ interior D = (Γ.V ∩ D) \ {v} := by + ext x + simp only [mem_inter_iff, mem_sdiff, mem_singleton_iff] + constructor + · rintro ⟨hxU, hxInt⟩ + have hxD : x ∈ D := interior_subset hxInt + have hxV : x ∈ Γ.V := hUD_sub_V ⟨hxU, hxD⟩ + refine ⟨⟨hxV, hxD⟩, ?_⟩ + rintro rfl + exact (hfront.symm ▸ hvFV.1).2 hxInt + · rintro ⟨⟨hxV, hxD⟩, hxv⟩ + refine ⟨Γ.V_subset_U hxV, ?_⟩ + by_contra hx_nint + have hxF : x ∈ F := hfront ▸ ⟨subset_closure hxD, hx_nint⟩ + exact hxv (mem_singleton_iff.mp (hFV.subset ⟨hxF, hxV⟩)) + have hVfin : Γ.V.Finite := Γ.toHypergraph.vertexSet_finite + have hfin : ((Γ.V ∩ D) \ {v}).Finite := + (hVfin.subset inter_subset_left).subset sdiff_subset + have hclosed : IsClosed ((Γ.V ∩ D) \ {v}) := hfin.isClosed + have hU_conn : IsPreconnected Γ.U := isPreconnected_U_of_isTwoCell hS htwo + have hsub_union : Γ.U ⊆ interior D ∪ ((Γ.V ∩ D) \ {v})ᶜ := by + intro x hxU + by_cases hxInt : x ∈ interior D + · exact Or.inl hxInt + · refine Or.inr (fun hx_mem => hxInt ?_) + have : x ∈ Γ.U ∩ interior D := hUint_eq.symm ▸ hx_mem + exact this.2 + have hne_left : (Γ.U ∩ interior D).Nonempty := ⟨w, Γ.V_subset_U hwV, hw_int⟩ + have hne_right : (Γ.U ∩ ((Γ.V ∩ D) \ {v})ᶜ).Nonempty := + ⟨v, Γ.V_subset_U hvFV.2, fun hv_mem => hv_mem.2 rfl⟩ + obtain ⟨z, hzU, hzInt, hzn⟩ := + hU_conn (interior D) (((Γ.V ∩ D) \ {v})ᶜ) isOpen_interior hclosed.isOpen_compl + hsub_union hne_left hne_right + exact hzn (hUint_eq ▸ ⟨hzU, hzInt⟩) + · rintro x hx + rcases mem_singleton_iff.mp hx with rfl + exact ⟨hvFV.2, hvD⟩ + +/-- In Case 2 of **(7.5)** (Graph Minors XII, page 265, line 643), once there is no `Γ`-normal +`O`-arc `F ⊆ r ∪ {v}` with `F ∩ V(Γ) = {v}` whose selected disc `Δ = ins(F)` contains an edge of +`Γ`, in any radial drawing `K` of `Γ`, the hub `u ∈ r ∩ K.V` has no two parallel radial edges +`g ≠ h` to the same vertex `v ∈ V(Γ)`. -/ +theorem no_parallel_spokes_at_region_hub [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsRespectfulDrawingTangle Γ θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + {r : Set S} (hr : r ∈ Γ.R) + (hno : ∀ Δ F : Set S, ∀ v : S, IsClosedDisc Δ → subBd Δ = F → + (PaintingOrDrawing.drawing Γ).IsNormal F → F ∩ Γ.V = {v} → + F \ {v} ⊆ r → + ((PaintingOrDrawing.drawing Γ).inter Δ, + (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T → + ∀ e ∈ Γ.E, ¬ e ⊆ Δ) + {g h : Set S} {v u : S} (hv : v ∈ Γ.V) (hg : g ∈ K.E) (hh : h ∈ K.E) (hgh : g ≠ h) + (hur : u ∈ r) (huK : u ∈ K.V) + (hcapg : closure g ∩ K.V = {v, u}) (hcaph : closure h ∩ K.V = {v, u}) : False := by + apply parallel_spokes_contradiction hS hθ hT hK hv hg hh hgh hr hur huK hcapg hcaph + intro D F hD _ hbd hn hFV hFr hm + have hnone := hno D F v hD hbd hn hFV hFr hm + exact ⟨vertices_in_selected_region_disc_of_no_edges hS hT.1 hD hbd hn hFV hnone, hnone⟩ + +/-! ## 5. Case 2 of (7.5): deduction of (i)–(iv) from (7.4) (pages 265–266) -/ + +/-- If two drawings `H` and `H₁` share a radial drawing `K` and derived slope `ins`, and `a` and +`a_star` (respectively `b` and `b_star`) have the same corresponding atoms in `A(K)` (with +`a = b ↔ a_star = b_star`), then `tangleMetric H₁ K ins θ a_star b_star = tangleMetric H K ins θ a +b` +(Graph Minors XII, Section 7, page 265, line 643). -/ +theorem tangleMetric_eq_of_correspondingAtom_iff {H H₁ K : Drawing S} + {ins : Drawing S → Set S} {θ : ℕ} {a b a_star b_star : Set S} + (heq : a = b ↔ a_star = b_star) + (ha : ∀ x' : Set S, IsCorrespondingAtom H K a x' ↔ IsCorrespondingAtom H₁ K a_star x') + (hb : ∀ y' : Set S, IsCorrespondingAtom H K b y' ↔ IsCorrespondingAtom H₁ K b_star y') : + tangleMetric H₁ K ins θ a_star b_star = tangleMetric H K ins θ a b := by + classical + unfold tangleMetric + by_cases hab : a = b + · have hab_star : a_star = b_star := heq.mp hab + simp [hab, hab_star] + · have hab_star : a_star ≠ b_star := fun h => hab (heq.mpr h) + simp only [hab, hab_star, ↓reduceIte, ← ha, ← hb] + +/-- In Case 2 of **(7.5)** (Graph Minors XII, page 265): +"By [5, Theorem (6.6)], there is a respectful tangle $\mathscr{T}_1$ of order $\theta$ in +$\Gamma_1$, +with metric $d_1$, such that $d_1(a^*, b^*) = d(a, b)$ for all $a, b \in A(\Gamma)$." +Here `Γ` and `Γ₁` share the radial drawing `K` witnessing `HasTangleMetric Γ θ T d`. -/ +theorem exists_dual_tangleMetric_of_common_radial [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ Γ₁ K : Drawing S} {ins : Drawing S → Set S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 3 ≤ θ) (hT : IsRespectfulDrawingTangle Γ θ T) + (hE₁ : Γ₁.E.Nonempty) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hK₁ : (PaintingOrDrawing.drawing Γ₁).IsRadialDrawing K) + (hins : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) : + ∃ (T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (d₁ : Set S → Set S → ℕ), + HasTangleMetric Γ₁ θ T₁ d₁ ∧ + IsDerivedSlope (PaintingOrDrawing.drawing Γ₁) K θ T₁ ins ∧ + (∀ x ∈ Γ₁.A, ∀ y ∈ Γ₁.A, d₁ x y = tangleMetric Γ₁ K ins θ x y) ∧ + (∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a_star ∈ Γ₁.A, ∀ b_star ∈ Γ₁.A, + (a = b ↔ a_star = b_star) → + (∀ x' : Set S, IsCorrespondingAtom Γ K a x' ↔ IsCorrespondingAtom Γ₁ K a_star x') → + (∀ y' : Set S, IsCorrespondingAtom Γ K b y' ↔ IsCorrespondingAtom Γ₁ K b_star y') → + d₁ a_star b_star = tangleMetric Γ K ins θ a b) := by + have hθ_2 : 2 ≤ θ := by omega + have hE : Γ.E.Nonempty := edgeSet_nonempty_of_isTangle_of_two_le hT.2.1 hθ_2 + have hloop : θ ≠ 2 ∨ (∀ e ∈ Γ.E, ∃ x y, x ≠ y ∧ closure e ∩ Γ.V = {x, y}) ∧ + ∀ e ∈ Γ₁.E, ∃ x y, x ≠ y ∧ closure e ∩ Γ₁.V = {x, y} := Or.inl (by omega) + obtain ⟨φ, hφ⟩ := GM11.theorem_6_6_proof hS hE hE₁ hK hK₁ hloop + let T_sub : GM11.RespectfulTangle Γ θ := ⟨T, hT.2.1, hT.2.2⟩ + let T₁ := (φ T_sub).1 + have hT₁_tangle : GM10.IsTangle Γ₁.toHypergraph θ T₁ := (φ T_sub).2.1 + have hT₁_resp : (PaintingOrDrawing.drawing Γ₁).IsRespectful θ T₁ := (φ T_sub).2.2 + have hins₁ : IsDerivedSlope (PaintingOrDrawing.drawing Γ₁) K θ T₁ ins := + (hφ T_sub ins).mp hins + let d₁ : Set S → Set S → ℕ := tangleMetric Γ₁ K ins θ + have hd₁ : HasTangleMetric Γ₁ θ T₁ d₁ := + ⟨⟨hK₁.1, hT₁_tangle, hT₁_resp⟩, K, ins, hK₁, hins₁, fun _ _ _ _ => rfl⟩ + refine ⟨T₁, d₁, hd₁, hins₁, fun _ _ _ _ => rfl, ?_⟩ + intro a _ b _ a_star _ b_star _ heq ha hb + exact tangleMetric_eq_of_correspondingAtom_iff heq ha hb + +/-- In Case 2 of **(7.5)** (Graph Minors XII, page 265, line 663): +if `Γ'` is a subdrawing of `Γ \ Z`, `r ∈ R(Γ)`, `r' ∈ R(Γ')`, and `r ⊆ r'`, then +`Z = {v ∈ V(Γ) | v ∈ closure r} ⊆ r'`. -/ +theorem incident_vertices_subset_region_of_region_subset {Γ Γ' : Drawing S} {r r' : Set S} + (hr : r ∈ Γ.R) (hr' : r' ∈ Γ'.R) + (hSub' : Γ'.IsSubdrawing (deleteVertices Γ {v ∈ Γ.V | v ∈ closure r})) + (hrr' : r ⊆ r') : + {v ∈ Γ.V | v ∈ closure r} ⊆ r' := by + have ⟨hSubΓ, hDisjZ⟩ := isSubdrawing_deleteVertices_iff.mp hSub' + rintro v ⟨hvV, hvr⟩ + have hv_not_U' : v ∉ Γ'.U := by + intro hvU' + have hvV' : v ∈ Γ'.V := (isSubdrawing_U_inter_V hSubΓ).subset ⟨hvU', hvV⟩ + exact disjoint_left.mp hDisjZ hvV' ⟨hvV, hvr⟩ + have hr_conn : IsPreconnected r := region_isPreconnected hr + have hrv_conn : IsPreconnected (r ∪ {v}) := + hr_conn.subset_closure subset_union_left + (union_subset subset_closure (singleton_subset_iff.mpr hvr)) + obtain ⟨x₀, hx₀r⟩ := region_nonempty hr + have hrv_off : r ∪ {v} ⊆ univ \ Γ'.U := by + rintro y (hyr | hyv) + · exact ⟨mem_univ y, region_subset hr' (hrr' hyr)⟩ + · rcases mem_singleton_iff.mp hyv with rfl + exact ⟨mem_univ y, hv_not_U'⟩ + have hsub_comp := hrv_conn.subset_connectedComponentIn (Or.inl hx₀r) hrv_off + have hcomp_R : connectedComponentIn (univ \ Γ'.U) x₀ ∈ Γ'.R := + (mem_R_iff Γ').mpr ⟨x₀, (hrv_off (Or.inl hx₀r)).2, rfl⟩ + have hcomp_eq : connectedComponentIn (univ \ Γ'.U) x₀ = r' := + atom_eq_of_inter_nonempty (Or.inr hcomp_R) (Or.inr hr') + ⟨x₀, mem_connectedComponentIn (hrv_off (Or.inl hx₀r)), hrr' hx₀r⟩ + exact hcomp_eq ▸ hsub_comp (Or.inr rfl) + +/-- In Case 2 of **(7.5)** (Graph Minors XII, page 265, lines 663–664): +since `Z ⊆ r'`, every edge of `Γ` incident with a member of `Z` is included in `r'`. -/ +theorem incident_edge_subset_region_of_vertex_mem {Γ Γ' : Drawing S} {Z r' e : Set S} {z : S} + (hr' : r' ∈ Γ'.R) (hSub' : Γ'.IsSubdrawing (deleteVertices Γ Z)) + (he : e ∈ Γ.E) (hzV : z ∈ Γ.V) (hzZ : z ∈ Z) (hze : z ∈ closure e) (hZr' : Z ⊆ r') : + e ⊆ r' := by + have ⟨hSubΓ, _⟩ := isSubdrawing_deleteVertices_iff.mp hSub' + have he_not_del : e ∉ (deleteVertices Γ Z).E := by + rw [deleteVertices_E] + intro ⟨_, hdisj⟩ + exact disjoint_left.mp hdisj ⟨hze, hzV⟩ hzZ + have he_not_E' : e ∉ Γ'.E := fun he' => he_not_del (hSub'.2 he') + have he_disj_U' : Disjoint e Γ'.U := by + rw [disjoint_iff_inter_eq_empty] + ext x + simp only [mem_inter_iff, mem_empty_iff_false, iff_false, not_and] + intro hxe hxU' + by_cases hxV' : x ∈ Γ'.V + · exact (he.2.1 hxe).2 (hSubΓ.1 hxV') + · obtain ⟨e', he', hxe'⟩ := Γ'.exists_edge_of_mem hxU' hxV' + have heq : e = e' := atom_eq_of_inter_nonempty (Or.inl (Or.inr he)) + (Or.inl (Or.inr (hSubΓ.2 he'))) ⟨x, hxe, hxe'⟩ + exact he_not_E' (heq ▸ he') + have he_conn : IsPreconnected e := he.2.2.1.isConnected.isPreconnected + have hez_conn : IsPreconnected (e ∪ {z}) := + he_conn.subset_closure subset_union_left + (union_subset subset_closure (singleton_subset_iff.mpr hze)) + have hzr' : z ∈ r' := hZr' hzZ + have hez_off : e ∪ {z} ⊆ univ \ Γ'.U := by + rintro y (hye | hyz) + · exact ⟨mem_univ y, disjoint_left.mp he_disj_U' hye⟩ + · rcases mem_singleton_iff.mp hyz with rfl + exact ⟨mem_univ y, region_subset hr' hzr'⟩ + have hsub_comp := hez_conn.subset_connectedComponentIn (Or.inr rfl) hez_off + have hcomp_R : connectedComponentIn (univ \ Γ'.U) z ∈ Γ'.R := + (mem_R_iff Γ').mpr ⟨z, (hez_off (Or.inr rfl)).2, rfl⟩ + have hcomp_eq : connectedComponentIn (univ \ Γ'.U) z = r' := + atom_eq_of_inter_nonempty (Or.inr hcomp_R) (Or.inr hr') + ⟨z, mem_connectedComponentIn (hez_off (Or.inr rfl)), hzr'⟩ + exact subset_union_left.trans (hcomp_eq ▸ hsub_comp) + +/-- In Case 2 of **(7.5)** (Graph Minors XII, page 265, lines 663–669): +since `Z ⊆ r'`, every edge of `Γ` incident with a member of `Z` is included in `r'`, and by (vii) +`U(Γ \ Z) ⊆ U(Γ₃) ⊆ U(Γ') ∪ r'`; consequently `U(Γ) ⊆ U(Γ') ∪ r'`, proving `(i)`. -/ +theorem U_subset_of_deleteVertices_U_subset {Γ Γ' : Drawing S} {r r' : Set S} + (hr : r ∈ Γ.R) (hr' : r' ∈ Γ'.R) + (hSub' : Γ'.IsSubdrawing (deleteVertices Γ {v ∈ Γ.V | v ∈ closure r})) + (hrr' : r ⊆ r') + (hU_del : (deleteVertices Γ {v ∈ Γ.V | v ∈ closure r}).U ⊆ Γ'.U ∪ r') : + Γ.U ⊆ Γ'.U ∪ r' := by + let Z := {v ∈ Γ.V | v ∈ closure r} + have hZr' : Z ⊆ r' := incident_vertices_subset_region_of_region_subset hr hr' hSub' hrr' + intro x hxU + by_cases hxV : x ∈ Γ.V + · by_cases hxZ : x ∈ Z + · exact Or.inr (hZr' hxZ) + · have hx_del : x ∈ (deleteVertices Γ Z).V := by + rw [deleteVertices_V] + exact ⟨hxV, hxZ⟩ + exact hU_del ((deleteVertices Γ Z).V_subset_U hx_del) + · obtain ⟨e, he, hxe⟩ := Γ.exists_edge_of_mem hxU hxV + by_cases hdisj : Disjoint (closure e ∩ Γ.V) Z + · have he_del : e ∈ (deleteVertices Γ Z).E := by + rw [deleteVertices_E] + exact ⟨he, hdisj⟩ + exact hU_del ((he_del.2.1 hxe).1) + · rw [not_disjoint_iff] at hdisj + obtain ⟨z, ⟨hze, hzV⟩, hzZ⟩ := hdisj + exact Or.inr (incident_edge_subset_region_of_vertex_mem hr' hSub' he hzV hzZ hze hZr' hxe) + +/-- In Case 2 of **(7.5)** (Graph Minors XII, page 265, line 669): +for any shared atom `a ∈ A(Γ) ∩ A(Γ')`, we have `a ∩ r' = ∅` (and hence `a ∩ r = ∅`). -/ +theorem theorem_7_5_disjoint_region_of_shared_atom [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ Γ' : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {r r' : Set S} (hθ : 2 ≤ θ) (hT : IsRespectfulDrawingTangle Γ θ T) + (hr : r ∈ Γ.R) (hr' : r' ∈ Γ'.R) + (hSub' : Γ'.IsSubdrawing (deleteVertices Γ {v ∈ Γ.V | v ∈ closure r})) + (hrr' : r ⊆ r') {a : Set S} (ha : a ∈ Γ.A ∩ Γ'.A) : + Disjoint a r' ∧ Disjoint a r := by + have hE : Γ.E.Nonempty := edgeSet_nonempty_of_isTangle_of_two_le hT.2.1 hθ + obtain ⟨z, hzV, hzr⟩ := exists_vertex_at_region hS hE hr + have hz_r' : z ∈ r' := + incident_vertices_subset_region_of_region_subset hr hr' hSub' hrr' ⟨hzV, hzr⟩ + obtain ⟨x₀, hx₀r⟩ := region_nonempty hr + have hx₀r' : x₀ ∈ r' := hrr' hx₀r + have har' : Disjoint a r' := by + rw [disjoint_iff_inter_eq_empty] + by_contra hne + obtain ⟨x, hxa, hxr'⟩ := nonempty_iff_ne_empty.mpr hne + have har'_eq : a = r' := atom_eq_of_inter_nonempty ha.2 (Or.inr hr') ⟨x, hxa, hxr'⟩ + have hza : z ∈ a := har'_eq.symm ▸ hz_r' + have haz_eq : a = {z} := atom_eq_of_inter_nonempty ha.1 (Or.inl (Or.inl ⟨z, hzV, rfl⟩)) + ⟨z, hza, rfl⟩ + have hx₀_a : x₀ ∈ a := har'_eq.symm ▸ hx₀r' + have har_eq : a = r := atom_eq_of_inter_nonempty ha.1 (Or.inr hr) ⟨x₀, hx₀_a, hx₀r⟩ + have hzr_mem : z ∈ r := har_eq ▸ haz_eq ▸ mem_singleton z + exact region_subset hr hzr_mem (Γ.V_subset_U hzV) + exact ⟨har', Disjoint.mono_right hrr' har'⟩ + +/-- In Case 2 of **(7.5)** (Graph Minors XII, page 265, lines 652–669): +applying **(7.4)** (`Theorem74Statement`) to `(Γ₃, θ - 1, T₃, d₃, r₂_star)` where +`r₂_star ∈ V(Γ₃) ∩ r` and `Γ₃ \ {r₂_star} = Γ \ Z` yields a 2-cell subdrawing `Γ'` of `Γ \ Z`, +a respectful tangle `T'` of order `θ - 2` in `Γ'` with metric `d'`, and the region `r' ∈ R(Γ')` +including `r` such that `(i)` `U(Γ) ⊆ U(Γ') ∪ r'` and the bounds `(viii)`, `(ix)`, `(x)` of line +654 hold. -/ +theorem theorem_7_5_apply_7_4 [ConnectedSpace S] + (hS : IsClosedSurface S) + {Γ Γ₃ : Drawing S} {θ : ℕ} + {T₃ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d₃ : Set S → Set S → ℕ} {r : Set S} {r₂_star : S} + (hθ : 3 ≤ θ) (hr : r ∈ Γ.R) + (hd₃ : HasTangleMetric Γ₃ (θ - 1) T₃ d₃) + (hr₂_V : r₂_star ∈ Γ₃.V) (hr₂_r : r₂_star ∈ r) + (hdel_eq : deleteVertices Γ₃ {r₂_star} = deleteVertices Γ {v ∈ Γ.V | v ∈ closure r}) : + ∃ (Γ' : Drawing S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r' : Set S), + Γ'.IsSubdrawing (deleteVertices Γ {v ∈ Γ.V | v ∈ closure r}) ∧ + (PaintingOrDrawing.drawing Γ').IsTwoCell ∧ + HasTangleMetric Γ' (θ - 2) T' d' ∧ + r' ∈ Γ'.R ∧ r ⊆ r' ∧ + Γ.U ⊆ Γ'.U ∪ r' ∧ + (∀ a ∈ Γ₃.A ∩ Γ'.A, ∀ b ∈ Γ₃.A ∩ Γ'.A, d₃ a b - 2 ≤ d' a b) ∧ + (∀ a ∈ Γ₃.A ∩ Γ'.A, d₃ a {r₂_star} - 1 ≤ d' a r') ∧ + (∀ a ∈ Γ₃.A, a ⊆ r' → d₃ a {r₂_star} ≤ 2) := by + have hθ_3 : 2 ≤ θ - 1 := by omega + obtain ⟨Γ', T', d', r', hSub'₃, htwo', hd', hr', hr₂_r', hU₃, hii₃, hiii₃, hiv₃⟩ := + gm12_theorem_7_4 S hS Γ₃ (θ - 1) T₃ d₃ r₂_star hθ_3 hd₃ hr₂_V + have hSub' : Γ'.IsSubdrawing (deleteVertices Γ {v ∈ Γ.V | v ∈ closure r}) := + hdel_eq ▸ hSub'₃ + have hSub_Γ'Γ : Γ'.IsSubdrawing Γ := + hSub'.trans (deleteVertices_isSubdrawing Γ _) + have hrr' : r ⊆ r' := + region_subset_region_of_inter_nonempty hSub_Γ'Γ hr hr' ⟨r₂_star, hr₂_r, hr₂_r'⟩ + have hU_del : (deleteVertices Γ {v ∈ Γ.V | v ∈ closure r}).U ⊆ Γ'.U ∪ r' := by + rw [← hdel_eq] + exact (deleteVertices_isSubdrawing Γ₃ {r₂_star}).U_subset.trans hU₃ + have hU_Γ : Γ.U ⊆ Γ'.U ∪ r' := + U_subset_of_deleteVertices_U_subset hr hr' hSub' hrr' hU_del + have hθ_eq : θ - 1 - 1 = θ - 2 := by omega + have hd'_θ : HasTangleMetric Γ' (θ - 2) T' d' := hθ_eq ▸ hd' + exact ⟨Γ', T', d', r', hSub', htwo', hd'_θ, hr', hrr', hU_Γ, hii₃, hiii₃, hiv₃⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section75Case2.lean b/LeanPool/GraphMinor/GM12/Section75Case2.lean new file mode 100644 index 0000000000..4fe5ab177a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section75Case2.lean @@ -0,0 +1,291 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section75Case2Atoms +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM12.Section74Bridge + +/-! +# The end of Case 2 of XII (7.5) + +The paragraph of pages 265 and 266 that claims that `Γ'`, `𝒯'`, `r'` satisfy the theorem. The +theorem takes what +the chain of Case 2 gives, and proves (ii), (iii) and (iv) of (7.5). Condition (i) is in the +conclusion +of `theorem_7_5_apply_7_4`, by `U_subset_of_deleteVertices_U_subset`. +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- In Case 2 of **(7.5)** (Graph Minors XII, pages 265 and 266): `Γ'`, `𝒯'`, `r'` satisfy the +theorem. Write `Γ₂ = Γ₁ \ v`, where `v = r*` and `r₂` is the region of `Γ₂` containing `v`. From +the duals `Γ₁` and `Γ₃`, the equations `d₁(a*, b*) = d(a, b)` and `d₃(a*, b*) = d₂(a, b)` in the +form of +`exists_dual_tangleMetric_of_common_radial`, the bounds (v), (vi) of (7.3) and the conclusion of +`theorem_7_5_apply_7_4`, this proves (ii), (iii), (iv) of (7.5). -/ +theorem theorem_7_5_case_2_end (hS : IsClosedSurface S) + {Γ Γ₁ K J Γ₃ Γ' : Drawing S} {f : C(S, S)} {θ : ℕ} + {T T₁ T₂ T₃ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d₁ d₂ d₃ d' : Set S → Set S → ℕ} {ins ins₂ : Drawing S → Set S} + {r r₂ r' : Set S} {v : S} (hθ : 3 ≤ θ) + (hT : IsRespectfulDrawingTangle Γ θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hd : ∀ x ∈ Γ.A, ∀ y ∈ Γ.A, d x y = tangleMetric Γ K ins θ x y) + (hr : r ∈ Γ.R) (hvr : v ∈ r) (hvK : v ∈ K.V) + (hK₁ : (PaintingOrDrawing.drawing Γ₁).IsRadialDrawing K) (hdual : IsLineDual Γ K Γ₁) + (hM₁ : HasTangleMetric Γ₁ θ T₁ d₁) + (hd₁ : ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a_star ∈ Γ₁.A, ∀ b_star ∈ Γ₁.A, + (a = b ↔ a_star = b_star) → + (∀ x' : Set S, IsCorrespondingAtom Γ K a x' ↔ IsCorrespondingAtom Γ₁ K a_star x') → + (∀ y' : Set S, IsCorrespondingAtom Γ K b y' ↔ IsCorrespondingAtom Γ₁ K b_star y') → + d₁ a_star b_star = tangleMetric Γ K ins θ a b) + (hM₂ : HasTangleMetric (deleteVertices Γ₁ {v}) (θ - 1) T₂ d₂) + (hr₂ : r₂ ∈ (deleteVertices Γ₁ {v}).R) (hvr₂ : v ∈ r₂) + (h_v : ∀ a ∈ Γ₁.A ∩ (deleteVertices Γ₁ {v}).A, + ∀ b ∈ Γ₁.A ∩ (deleteVertices Γ₁ {v}).A, d₁ a b - 2 ≤ d₂ a b) + (h_vi : ∀ a ∈ Γ₁.A ∩ (deleteVertices Γ₁ {v}).A, d₁ a {v} - 1 ≤ d₂ a r₂) + (hJ : (PaintingOrDrawing.drawing (deleteVertices Γ₁ {v})).IsRadialDrawing J) + (hd₂ : ∀ x ∈ (deleteVertices Γ₁ {v}).A, ∀ y ∈ (deleteVertices Γ₁ {v}).A, + d₂ x y = tangleMetric (deleteVertices Γ₁ {v}) J ins₂ (θ - 1) x y) + (hc : IsContractedDual Γ Γ₁ K J f r v Γ₃) + (hM₃ : HasTangleMetric Γ₃ (θ - 1) T₃ d₃) + (hd₃ : ∀ a ∈ (deleteVertices Γ₁ {v}).A, ∀ b ∈ (deleteVertices Γ₁ {v}).A, + ∀ a_star ∈ Γ₃.A, ∀ b_star ∈ Γ₃.A, + (a = b ↔ a_star = b_star) → + (∀ x' : Set S, IsCorrespondingAtom (deleteVertices Γ₁ {v}) J a x' ↔ + IsCorrespondingAtom Γ₃ J a_star x') → + (∀ y' : Set S, IsCorrespondingAtom (deleteVertices Γ₁ {v}) J b y' ↔ + IsCorrespondingAtom Γ₃ J b_star y') → + d₃ a_star b_star = tangleMetric (deleteVertices Γ₁ {v}) J ins₂ (θ - 1) a b) + (hSub' : Γ'.IsSubdrawing (deleteVertices Γ {u ∈ Γ.V | u ∈ closure r})) + (hr' : r' ∈ Γ'.R) (hrr' : r ⊆ r') (hU : Γ.U ⊆ Γ'.U ∪ r') + (h_viii : ∀ a ∈ Γ₃.A ∩ Γ'.A, ∀ b ∈ Γ₃.A ∩ Γ'.A, d₃ a b - 2 ≤ d' a b) + (h_ix : ∀ a ∈ Γ₃.A ∩ Γ'.A, d₃ a {v} - 1 ≤ d' a r') + (h_x : ∀ a ∈ Γ₃.A, a ⊆ r' → d₃ a {v} ≤ 2) : + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 4 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a r - 2 ≤ d' a r') ∧ + (∀ a ∈ Γ.A, a ⊆ r' → d a r ≤ 3) := by + obtain ⟨_, _, _, _, _, _, _, _, _, _, _, _, hV₁, _⟩ := hdual + obtain ⟨-, h₀, -, hsym₁, -, hreg₁, hedge₁⟩ := GM11.gm15_theorem_9_1 Γ₁ θ T₁ d₁ hS inferInstance + hM₁ + have hE : Γ.E.Nonempty := edgeSet_nonempty_of_isTangle_of_two_le hT.2.1 (by omega) + have hE₂ : (deleteVertices Γ₁ {v}).E.Nonempty := + edgeSet_nonempty_of_isTangle_of_two_le hM₂.1.2.1 (by omega) + have hE₁ : Γ₁.E.Nonempty := hE₂.mono (deleteVertices_isSubdrawing Γ₁ {v}).2 + have hE₃ : Γ₃.E.Nonempty := edgeSet_nonempty_of_isTangle_of_two_le hM₃.1.2.1 (by omega) + have hvV₃ : v ∈ Γ₃.V := by + rw [hc.V_eq] + exact Or.inr rfl + have hv₁ : v ∈ Γ₁.V := by + rw [hV₁] + exact ⟨hvK, fun h' => region_subset hr hvr (Γ.V_subset_U h')⟩ + have hvJ : v ∈ J.V := hc.radial.2.1.2.1 hvV₃ + have hvr' : v ∈ r' := hrr' hvr + have hZ : {u ∈ Γ.V | u ∈ closure r} = Γ.V ∩ (closure r \ r) := by + ext u + exact ⟨fun h' => ⟨h'.1, h'.2, fun h'' => region_subset hr h'' (Γ.V_subset_U h'.1)⟩, + fun h' => ⟨h'.1, h'.2.1⟩⟩ + have hSub₃ : Γ'.IsSubdrawing (deleteVertices Γ₃ {v}) := by + rw [hc.delete_eq, ← hZ] + exact hSub' + have hSub₃' : Γ'.IsSubdrawing Γ₃ := hSub₃.trans (deleteVertices_isSubdrawing Γ₃ {v}) + have hU₃ : Γ₃.U ⊆ Γ'.U ∪ r' := by + refine U_subset_of_delete_U_subset hr' hSub₃ hvV₃ hvr' (Subset.trans ?_ hU) + rw [hc.delete_eq] + exact (deleteVertices_isSubdrawing Γ _).U_subset + have hrs : SameAtom Γ Γ₁ K r {v} := sameAtom_region hK hK₁ hv₁ hr hvK hvr + have hrs₂ : SameAtom (deleteVertices Γ₁ {v}) Γ₃ J r₂ {v} := + ⟨{v}, corr_region hr₂ hvJ hvr₂, corr_vertex hc.radial hvV₃⟩ + have hd_eq : ∀ {a b a₁ b₁ : Set S}, a ∈ Γ.A → b ∈ Γ.A → SameAtom Γ Γ₁ K a a₁ → + SameAtom Γ Γ₁ K b b₁ → d a b = d₁ a₁ b₁ := fun {a b _ _} ha hb h₁ h₂ => by + rw [hd a ha b hb] + exact (dual_metric_eq hS hK hK₁ hE hE₁ hd₁ h₁ h₂).symm + have hd₃_eq : ∀ {a b a₃ b₃ : Set S}, a ∈ (deleteVertices Γ₁ {v}).A → + b ∈ (deleteVertices Γ₁ {v}).A → SameAtom (deleteVertices Γ₁ {v}) Γ₃ J a a₃ → + SameAtom (deleteVertices Γ₁ {v}) Γ₃ J b b₃ → d₂ a b = d₃ a₃ b₃ := fun {a b _ _} ha hb h₁ h₂ + => by + rw [hd₂ a ha b hb] + exact (dual_metric_eq hS hJ hc.radial hE₂ hE₃ hd₃ h₁ h₂).symm + have hdis : ∀ a ∈ Γ.A ∩ Γ'.A, Disjoint a r' := fun a ha => + (theorem_7_5_disjoint_region_of_shared_atom hS (by omega) hT hr hr' hSub' hrr' ha).1 + have hSubΓ : Γ'.IsSubdrawing Γ := (isSubdrawing_deleteVertices_iff.mp hSub').1 + have hshared : ∀ a ∈ Γ.A ∩ Γ'.A, ∃ a₁, a₁ ∈ Γ₁.A ∧ a₁ ∈ (deleteVertices Γ₁ {v}).A ∧ + SameAtom Γ Γ₁ K a a₁ ∧ a ∈ Γ₃.A ∧ SameAtom (deleteVertices Γ₁ {v}) Γ₃ J a₁ a := by + rintro a ⟨ha, ha'⟩ + have har' := hdis a ⟨ha, ha'⟩ + rcases ha' with (⟨u, hu', rfl⟩ | he') | hR' + · have hu : u ∈ Γ.V := hSubΓ.1 hu' + have hur : u ∉ closure r := fun h' => + disjoint_left.mp (isSubdrawing_deleteVertices_iff.mp hSub').2 hu' ⟨hu, h'⟩ + obtain ⟨t, ht, ht₂, hs, hu₃, hs₂⟩ := thread_vertex hc hK hK₁ hV₁ hu hur + exact ⟨t, Or.inr ht, Or.inr ht₂, hs, Or.inl (Or.inl ⟨u, hu₃, rfl⟩), hs₂⟩ + · have he : a ∈ Γ.E := hSubΓ.2 he' + have hd' := hSub'.2 he' + rw [deleteVertices_E] at hd' + have hdj : Disjoint (closure a ∩ Γ.V) (closure r \ r) := + disjoint_left.mpr fun u h₁ h₂ => disjoint_left.mp hd'.2 h₁ ⟨h₁.2, h₂.1⟩ + obtain ⟨g, hg, hg₂, hs, hfe, hs₂⟩ := thread_edge hc he (hc.not_sub a he hdj) + rw [hc.fixed a he hdj] at hfe hs₂ + exact ⟨g, Or.inl (Or.inr hg), Or.inl (Or.inr hg₂), hs, Or.inl (Or.inr hfe), hs₂⟩ + · have hoffU : ∀ x ∈ a, x ∉ Γ.U := fun x hxa hxU => by + rcases hU hxU with h | h + · exact region_subset hR' hxa h + · exact disjoint_left.mp har' hxa h + obtain ⟨x₀, hx₀⟩ := region_nonempty hR' + rcases ha with (⟨u, hu, rfl⟩ | he) | hR + · exact absurd (Γ.V_subset_U (mem_singleton_iff.mp hx₀ ▸ hu)) (hoffU x₀ hx₀) + · exact absurd (he.2.1 hx₀).1 (hoffU x₀ hx₀) + · have har : a ≠ r := by + rintro rfl + exact disjoint_left.mp har' hvr hvr' + obtain ⟨w, hwa, hw₁, hw₂, hs, t, ht, hwt, hs₂⟩ := + thread_region hc hJ hK hK₁ hV₁ hr hvr hR har + have ha₃ : a ∈ Γ₃.R := region_of_disjoint hSub₃' hU₃ hR' har' + obtain rfl : t = a := region_eq_of_mem ht ha₃ hwt hwa + exact ⟨{w}, hw₁, hw₂, hs, Or.inr ha₃, hs₂⟩ + have hbound : ∀ {a a₁ a₃ : Set S}, a ∈ Γ.A → a₁ ∈ Γ₁.A → a₁ ∈ (deleteVertices Γ₁ {v}).A → + SameAtom Γ Γ₁ K a a₁ → a₃ ∈ Γ₃.A → SameAtom (deleteVertices Γ₁ {v}) Γ₃ J a₁ a₃ → a₃ ⊆ r' → + d a r ≤ 3 := fun {a a₁ a₃} ha ha₁ ha₂ hs ha₃ hs₂ hsub => by + have h₁ := hd_eq ha (Or.inr hr) hs hrs + have h₂ := hd₃_eq ha₂ (Or.inr hr₂) hs₂ hrs₂ + have h₃ := h_vi a₁ ⟨ha₁, ha₂⟩ + have h₄ := h_x a₃ ha₃ hsub + omega + refine ⟨?_, ?_, ?_⟩ + · intro a ha b hb + by_cases hab : a = b + · obtain ⟨a₁, ha₁, -, hs, -, -⟩ := hshared a ha + subst hab + rw [hd_eq ha.1 ha.1 hs hs, h₀ a₁ ha₁] + exact Nat.zero_le _ + obtain ⟨a₁, ha₁, ha₂, hs, ha₃, hs₂⟩ := hshared a ha + obtain ⟨b₁, hb₁, hb₂, ht, hb₃, ht₂⟩ := hshared b hb + have h₁ := hd_eq ha.1 hb.1 hs ht + have h₂ := hd₃_eq ha₂ hb₂ hs₂ ht₂ + have h₃ := h_v a₁ ⟨ha₁, ha₂⟩ b₁ ⟨hb₁, hb₂⟩ + have h₄ := h_viii a ⟨ha₃, ha.2⟩ b ⟨hb₃, hb.2⟩ + omega + · intro a ha + obtain ⟨a₁, ha₁, ha₂, hs, ha₃, hs₂⟩ := hshared a ha + have h₁ := hd_eq ha.1 (Or.inr hr) hs hrs + have h₂ := hd₃_eq ha₂ (Or.inr hr₂) hs₂ hrs₂ + have h₃ := h_vi a₁ ⟨ha₁, ha₂⟩ + have h₄ := h_ix a ⟨ha₃, ha.2⟩ + omega + · intro a ha har' + have hrA : r ∈ Γ.A := Or.inr hr + have hvA : ({v} : Set S) ∈ Γ₁.A := Or.inl (Or.inl ⟨v, hv₁, rfl⟩) + rcases id ha with (⟨u, hu, rfl⟩ | he) | hR + · by_cases hur : u ∈ closure r + · obtain ⟨t, ht, hut, hs⟩ := sameAtom_vertex hK hK₁ hV₁ hu + have h₁ := hreg₁ hE₁ v hv₁ t ht (hc.vertex_bd u hu hur t ht hut) + rw [hd_eq ha hrA hs hrs, hsym₁ t (Or.inr ht) {v} hvA] + omega + · obtain ⟨t, ht, ht₂, hs, hu₃, hs₂⟩ := thread_vertex hc hK hK₁ hV₁ hu hur + exact hbound ha (Or.inr ht) (Or.inr ht₂) hs (Or.inl (Or.inl ⟨u, hu₃, rfl⟩)) hs₂ har' + · by_cases hn : a ⊆ closure r \ r + · obtain ⟨g, hg, hvg, s, hs, hes, hgs⟩ := hc.edge_bd a he hn + have hsa : SameAtom Γ Γ₁ K a g := ⟨s, corr_edge he hs hes, corr_edge hg hs hgs⟩ + have h₁ := hedge₁ v hv₁ g hg hvg + rw [hd_eq ha hrA hsa hrs, hsym₁ g (Or.inl (Or.inr hg)) {v} hvA] + omega + · obtain ⟨g, hg, hg₂, hs, hfe, hs₂⟩ := thread_edge hc he hn + have hsub : f '' a ⊆ r' := by + by_cases hdj : Disjoint (closure a ∩ Γ.V) (closure r \ r) + · rw [hc.fixed a he hdj] + exact har' + · rw [not_disjoint_iff] at hdj + obtain ⟨u, ⟨hua, huV⟩, hur⟩ := hdj + have hfu := hc.collapse u huV hur.1 + have hvc : v ∈ closure (f '' a) := + hfu ▸ image_closure_subset_closure_image f.continuous ⟨u, hua, rfl⟩ + exact incident_edge_subset_region_of_vertex_mem hr' hSub₃ hfe hvV₃ rfl hvc + (singleton_subset_iff.mpr hvr') + exact hbound ha (Or.inl (Or.inr hg)) (Or.inl (Or.inr hg₂)) hs (Or.inl (Or.inr hfe)) hs₂ hsub + · by_cases har : a = r + · subst har + rw [hd_eq ha ha hrs hrs, h₀ {v} hvA] + omega + · obtain ⟨w, hwa, hw₁, hw₂, hs, t, ht, hwt, hs₂⟩ := + thread_region hc hJ hK hK₁ hV₁ hr hvr hR har + have hsub : t ⊆ r' := + region_subset_region_of_inter_nonempty hSub₃' ht hr' ⟨w, hwt, har' hwa⟩ + exact hbound ha hw₁ hw₂ hs (Or.inr ht) hs₂ hsub + +/-- All of (i) to (iv) of **(7.5)** in Case 2, with `Γ'`, `T'`, `d'`, `r'` from +`theorem_7_5_apply_7_4`. The conclusion is that of `Theorem75Statement`. -/ +theorem theorem_7_5_case_2 (hS : IsClosedSurface S) + {Γ Γ₁ K J Γ₃ : Drawing S} {f : C(S, S)} {θ : ℕ} + {T T₁ T₂ T₃ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d₁ d₂ d₃ : Set S → Set S → ℕ} {ins ins₂ : Drawing S → Set S} + {r r₂ : Set S} {v : S} (hθ : 3 ≤ θ) + (hT : IsRespectfulDrawingTangle Γ θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hd : ∀ x ∈ Γ.A, ∀ y ∈ Γ.A, d x y = tangleMetric Γ K ins θ x y) + (hr : r ∈ Γ.R) (hvr : v ∈ r) (hvK : v ∈ K.V) + (hK₁ : (PaintingOrDrawing.drawing Γ₁).IsRadialDrawing K) (hdual : IsLineDual Γ K Γ₁) + (hM₁ : HasTangleMetric Γ₁ θ T₁ d₁) + (hd₁ : ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a_star ∈ Γ₁.A, ∀ b_star ∈ Γ₁.A, + (a = b ↔ a_star = b_star) → + (∀ x' : Set S, IsCorrespondingAtom Γ K a x' ↔ IsCorrespondingAtom Γ₁ K a_star x') → + (∀ y' : Set S, IsCorrespondingAtom Γ K b y' ↔ IsCorrespondingAtom Γ₁ K b_star y') → + d₁ a_star b_star = tangleMetric Γ K ins θ a b) + (hM₂ : HasTangleMetric (deleteVertices Γ₁ {v}) (θ - 1) T₂ d₂) + (hr₂ : r₂ ∈ (deleteVertices Γ₁ {v}).R) (hvr₂ : v ∈ r₂) + (h_v : ∀ a ∈ Γ₁.A ∩ (deleteVertices Γ₁ {v}).A, + ∀ b ∈ Γ₁.A ∩ (deleteVertices Γ₁ {v}).A, d₁ a b - 2 ≤ d₂ a b) + (h_vi : ∀ a ∈ Γ₁.A ∩ (deleteVertices Γ₁ {v}).A, d₁ a {v} - 1 ≤ d₂ a r₂) + (hJ : (PaintingOrDrawing.drawing (deleteVertices Γ₁ {v})).IsRadialDrawing J) + (hd₂ : ∀ x ∈ (deleteVertices Γ₁ {v}).A, ∀ y ∈ (deleteVertices Γ₁ {v}).A, + d₂ x y = tangleMetric (deleteVertices Γ₁ {v}) J ins₂ (θ - 1) x y) + (hc : IsContractedDual Γ Γ₁ K J f r v Γ₃) + (hM₃ : HasTangleMetric Γ₃ (θ - 1) T₃ d₃) + (hd₃ : ∀ a ∈ (deleteVertices Γ₁ {v}).A, ∀ b ∈ (deleteVertices Γ₁ {v}).A, + ∀ a_star ∈ Γ₃.A, ∀ b_star ∈ Γ₃.A, + (a = b ↔ a_star = b_star) → + (∀ x' : Set S, IsCorrespondingAtom (deleteVertices Γ₁ {v}) J a x' ↔ + IsCorrespondingAtom Γ₃ J a_star x') → + (∀ y' : Set S, IsCorrespondingAtom (deleteVertices Γ₁ {v}) J b y' ↔ + IsCorrespondingAtom Γ₃ J b_star y') → + d₃ a_star b_star = tangleMetric (deleteVertices Γ₁ {v}) J ins₂ (θ - 1) a b) : + ∃ (Γ' : Drawing S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r' : Set S), + Γ'.IsSubdrawing (deleteVertices Γ {u ∈ Γ.V | u ∈ closure r}) ∧ + (PaintingOrDrawing.drawing Γ').IsTwoCell ∧ + HasTangleMetric Γ' (θ - 2) T' d' ∧ + r' ∈ Γ'.R ∧ r ⊆ r' ∧ + Γ.U ⊆ Γ'.U ∪ r' ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 4 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a r - 2 ≤ d' a r') ∧ + (∀ a ∈ Γ.A, a ⊆ r' → d a r ≤ 3) := by + have hvV₃ : v ∈ Γ₃.V := by + rw [hc.V_eq] + exact Or.inr rfl + have hZ : {u ∈ Γ.V | u ∈ closure r} = Γ.V ∩ (closure r \ r) := by + ext u + exact ⟨fun h' => ⟨h'.1, h'.2, fun h'' => region_subset hr h'' (Γ.V_subset_U h'.1)⟩, + fun h' => ⟨h'.1, h'.2.1⟩⟩ + obtain ⟨Γ', T', d', r', hSub', htwo, hM', hr', hrr', hU, h_viii, h_ix, h_x⟩ := + theorem_7_5_apply_7_4 hS hθ hr hM₃ hvV₃ hvr (by rw [hc.delete_eq, hZ]) + exact ⟨Γ', T', d', r', hSub', htwo, hM', hr', hrr', hU, theorem_7_5_case_2_end hS hθ hT hK hd hr + hvr + hvK hK₁ hdual hM₁ hd₁ hM₂ hr₂ hvr₂ h_v h_vi hJ hd₂ hc hM₃ hd₃ hSub' hr' hrr' hU h_viii h_ix h_x⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section75Case2Atoms.lean b/LeanPool/GraphMinor/GM12/Section75Case2Atoms.lean new file mode 100644 index 0000000000..e807343262 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section75Case2Atoms.lean @@ -0,0 +1,281 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section75 +public import LeanPool.GraphMinor.GM12.SurfaceDualContractDefs + +/-! +# Atoms in the end of Case 2 of XII (7.5) + +Let `Γ₁` be dual to `Γ`, let `Γ₂ = Γ₁ \ r*`, and let `Γ₃` be dual to `Γ₂`. An atom of `Γ` is tied to +an +atom of `Γ₁`, and an atom of `Γ₂` to an atom of `Γ₃`, when they have the same corresponding atom in +the +common radial drawing (`SameAtom`). The metrics agree across such pairs (`dual_metric_eq`). + +The rest of the file finds the atoms `a*` and `a**` for the atoms `a` of `Γ` that +`theorem_7_5_case_2_end` +uses, in `Section75Case2.lean`. +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The atoms `x` of `H` and `y` of `H'` have the same corresponding atom in the drawing `K`, which +is +radial for both. This is the paper's `y = x*`, for `H'` dual to `H`. -/ +def SameAtom (H H' K : Drawing S) (x y : Set S) : Prop := + ∃ z, IsCorrespondingAtom H K x z ∧ IsCorrespondingAtom H' K y z + +/-- Two atoms with the same corresponding atom are equal. -/ +theorem correspondingAtom_inj (hS : IsClosedSurface S) {H K : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) (hE : H.E.Nonempty) {x y z : Set S} + (hx : IsCorrespondingAtom H K x z) (hy : IsCorrespondingAtom H K y z) : x = y := by + have hrad : PreRad (PaintingOrDrawing.drawing H) K := ⟨hK.1, hK.2.1⟩ + have hnoV : ∀ {w : S}, w ∈ K.V → ({w} : Set S) ∉ K.R := fun hw hR => + region_subset hR (mem_singleton _) (K.V_subset_U hw) + rcases hx with ⟨-, -, ⟨u, hu, rfl, rfl⟩ | ⟨hxE, hzR, hxz⟩ | ⟨hxR, w, ⟨hwK, hwx⟩, rfl⟩⟩ <;> + rcases hy with ⟨-, -, ⟨u', hu', rfl, hz⟩ | ⟨hyE, hzR', hyz⟩ | ⟨hyR, w', ⟨hwK', hwy⟩, hz⟩⟩ + · exact hz + · exact absurd hzR' (hnoV (radial_V hrad hu)) + · obtain rfl : u = w' := by simpa using hz + exact absurd (H.V_subset_U hu) (region_subset hyR hwy) + · exact absurd hzR (hz ▸ hnoV (radial_V hrad hu')) + · exact (regionFacts_of_radial hrad hS hK.2.2 hE).2.1 z hzR x hxE y hyE hxz hyz + · exact absurd hzR (hz ▸ hnoV hwK') + · obtain rfl : w = u' := by simpa using hz + exact absurd (H.V_subset_U hu') (region_subset hxR hwx) + · exact absurd hzR' (hnoV hwK) + · obtain rfl : w = w' := by simpa using hz + exact region_eq_of_mem hxR hyR hwx hwy + +namespace SameAtom + +variable {H H' K : Drawing S} {a a' b b' : Set S} + +omit [ConnectedSpace S] in +omit [T2Space S] in +/-- The form in which `exists_dual_tangleMetric_of_common_radial` asks for a dual pair. -/ +theorem forall_iff (hS : IsClosedSurface S) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hK' : (PaintingOrDrawing.drawing H').IsRadialDrawing K) (h : SameAtom H H' K a a') + (z : Set S) : + IsCorrespondingAtom H K a z ↔ IsCorrespondingAtom H' K a' z := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨w, hw, hw'⟩ := h + constructor + · intro hz + rwa [(existsUnique_correspondingAtom hK hw.1).unique hz hw] + · intro hz + rwa [(existsUnique_correspondingAtom hK' hw'.1).unique hz hw'] + +/-- Duals of equal atoms are equal, and conversely. -/ +theorem eq_iff (hS : IsClosedSurface S) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hK' : (PaintingOrDrawing.drawing H').IsRadialDrawing K) + (hE : H.E.Nonempty) (hE' : H'.E.Nonempty) + (ha : SameAtom H H' K a a') (hb : SameAtom H H' K b b') : a = b ↔ a' = b' := by + obtain ⟨z, hz, hz'⟩ := id ha + obtain ⟨w, hw, hw'⟩ := id hb + constructor + · rintro rfl + exact correspondingAtom_inj hS hK' hE' hz' ((hb.forall_iff hS hK hK' z).mp hz) + · rintro rfl + exact correspondingAtom_inj hS hK hE hz ((hb.forall_iff hS hK hK' z).mpr hz') + +end SameAtom + +/-- `d₁(a*, b*) = d(a, b)`, for the form of the equation that +`exists_dual_tangleMetric_of_common_radial` gives. -/ +theorem dual_metric_eq (hS : IsClosedSurface S) {H H' K : Drawing S} {δ δ' : Set S → Set S → ℕ} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hK' : (PaintingOrDrawing.drawing H').IsRadialDrawing K) + (hE : H.E.Nonempty) (hE' : H'.E.Nonempty) + (hδ : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ a_star ∈ H'.A, ∀ b_star ∈ H'.A, + (a = b ↔ a_star = b_star) → + (∀ x' : Set S, IsCorrespondingAtom H K a x' ↔ IsCorrespondingAtom H' K a_star x') → + (∀ y' : Set S, IsCorrespondingAtom H K b y' ↔ IsCorrespondingAtom H' K b_star y') → + δ' a_star b_star = δ a b) + {a a' b b' : Set S} (ha : SameAtom H H' K a a') (hb : SameAtom H H' K b b') : + δ' a' b' = δ a b := by + obtain ⟨_, hz, hz'⟩ := id ha + obtain ⟨_, hw, hw'⟩ := id hb + exact hδ a hz.1 b hw.1 a' hz'.1 b' hw'.1 (ha.eq_iff hS hK hK' hE hE' hb) + (ha.forall_iff hS hK hK') (hb.forall_iff hS hK hK') + +section Corr + +variable {H K : Drawing S} + +omit [T2Space S] [ConnectedSpace S] in +theorem corr_vertex (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) {u : S} (hu : u ∈ H.V) : + IsCorrespondingAtom H K {u} {u} := + ⟨Or.inl (Or.inl ⟨u, hu, rfl⟩), Or.inl (Or.inl ⟨u, hK.2.1.2.1 hu, rfl⟩), Or.inl ⟨u, hu, rfl, rfl⟩⟩ + +omit [T2Space S] [ConnectedSpace S] in +theorem corr_region {t : Set S} (ht : t ∈ H.R) {u : S} (huK : u ∈ K.V) (hut : u ∈ t) : + IsCorrespondingAtom H K t {u} := + ⟨Or.inr ht, Or.inl (Or.inl ⟨u, huK, rfl⟩), Or.inr (Or.inr ⟨ht, u, ⟨huK, hut⟩, rfl⟩)⟩ + +omit [T2Space S] [ConnectedSpace S] in +theorem corr_edge {e s : Set S} (he : e ∈ H.E) (hs : s ∈ K.R) (hes : e ⊆ s) : + IsCorrespondingAtom H K e s := + ⟨Or.inl (Or.inr he), Or.inr hs, Or.inr (Or.inl ⟨he, hs, hes⟩)⟩ + +end Corr + +section Vii + +variable {Γ₃ Γ' : Drawing S} {v : S} {r' : Set S} + +omit [ConnectedSpace S] in +/-- (vii) of Case 2 of (7.5): `U(Γ₃) ⊆ U(Γ') ∪ r'`. Since `theorem_7_5_apply_7_4` keeps only (i), we +get (vii) from `U(Γ₃ \ r₂*) ⊆ U(Γ') ∪ r'`. An edge of `Γ₃` at `r₂*` lies in `r'`, since `r₂* ∈ r'` +and +`Γ'` is a subdrawing of `Γ₃ \ r₂*`. -/ +theorem U_subset_of_delete_U_subset (hr' : r' ∈ Γ'.R) (hSub : Γ'.IsSubdrawing + (deleteVertices Γ₃ {v})) + (hvV : v ∈ Γ₃.V) (hvr' : v ∈ r') (hU : (deleteVertices Γ₃ {v}).U ⊆ Γ'.U ∪ r') : + Γ₃.U ⊆ Γ'.U ∪ r' := by + intro x hx + by_cases hxV : x ∈ Γ₃.V + · by_cases hxv : x = v + · exact Or.inr (hxv ▸ hvr') + · exact hU ((deleteVertices Γ₃ {v}).V_subset_U (by rw [deleteVertices_V]; exact ⟨hxV, hxv⟩)) + · obtain ⟨e, he, hxe⟩ := Γ₃.exists_edge_of_mem hx hxV + by_cases hd : Disjoint (closure e ∩ Γ₃.V) {v} + · have he' : e ∈ (deleteVertices Γ₃ {v}).E := by rw [deleteVertices_E]; exact ⟨he, hd⟩ + exact hU (he'.2.1 hxe).1 + · rw [not_disjoint_iff] at hd + obtain ⟨z, ⟨hze, -⟩, hz⟩ := hd + obtain rfl : z = v := hz + exact Or.inr (incident_edge_subset_region_of_vertex_mem hr' hSub he hvV rfl hze + (singleton_subset_iff.mpr hvr') hxe) + +omit [ConnectedSpace S] in +omit [T2Space S] in +/-- A region of `Γ'` other than `r'`, off `r'`, is a region of `Γ₃`, by (vii). -/ +theorem region_of_disjoint (hSub : Γ'.IsSubdrawing Γ₃) (hU : Γ₃.U ⊆ Γ'.U ∪ r') {a : Set S} + (ha : a ∈ Γ'.R) (har' : Disjoint a r') : a ∈ Γ₃.R := by + have hoff : Disjoint a Γ₃.U := disjoint_left.mpr fun x hxa hxU => by + rcases hU hxU with h | h + · exact region_subset ha hxa h + · exact disjoint_left.mp har' hxa h + obtain ⟨x, hx⟩ := region_nonempty ha + obtain ⟨t, ht, hxt⟩ := exists_region_of_notMem (disjoint_left.mp hoff hx) + have hat : a ⊆ t := subset_region ht (region_isPreconnected ha) hoff hx hxt + have hta : t ⊆ a := region_subset_region_of_inter_nonempty hSub ht ha ⟨x, hxt, hx⟩ + exact (Subset.antisymm hat hta) ▸ ht + +end Vii + +section Threads + +variable {Γ Γ₁ K J Γ₃ : Drawing S} {f : C(S, S)} {r : Set S} {v : S} + +omit [T2Space S] [ConnectedSpace S] in +/-- A region `t` of `Γ₁` around a vertex `u` of `Γ` is `{u}*`. -/ +theorem sameAtom_vertex (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hK₁ : (PaintingOrDrawing.drawing Γ₁).IsRadialDrawing K) (hV₁ : Γ₁.V = K.V \ Γ.V) {u : S} + (hu : u ∈ Γ.V) : ∃ t ∈ Γ₁.R, u ∈ t ∧ SameAtom Γ Γ₁ K {u} t := by + have huK : u ∈ K.V := hK.2.1.2.1 hu + have hoff : u ∉ Γ₁.U := fun h' => by + have : u ∈ Γ₁.V := hK₁.2.1.1.subset ⟨h', K.V_subset_U huK⟩ + rw [hV₁] at this + exact this.2 hu + obtain ⟨t, ht, hut⟩ := exists_region_of_notMem hoff + exact ⟨t, ht, hut, {u}, corr_vertex hK hu, corr_region ht huK hut⟩ + +omit [T2Space S] [ConnectedSpace S] in +/-- `{w}` is `c*`, for a region `c` of `Γ` and the vertex `w` of `K` in it. -/ +theorem sameAtom_region (_hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hK₁ : (PaintingOrDrawing.drawing Γ₁).IsRadialDrawing K) {w : S} (hw : w ∈ Γ₁.V) {c : Set S} + (hc : c ∈ Γ.R) (hwK : w ∈ K.V) (hwc : w ∈ c) : SameAtom Γ Γ₁ K c {w} := + ⟨{w}, corr_region hc hwK hwc, corr_vertex hK₁ hw⟩ + +variable (hc : IsContractedDual Γ Γ₁ K J f r v Γ₃) + (hK₂ : (PaintingOrDrawing.drawing (deleteVertices Γ₁ {v})).IsRadialDrawing J) + +include hc hK₂ + +omit hK₂ in +omit [ConnectedSpace S] in +/-- For a vertex `u` of `Γ` off `rBar`, the atoms `{u}*` and `{u}**`: the second is `{u}` again. -/ +theorem thread_vertex (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hK₁ : (PaintingOrDrawing.drawing Γ₁).IsRadialDrawing K) (hV₁ : Γ₁.V = K.V \ Γ.V) {u : S} + (hu : u ∈ Γ.V) (hur : u ∉ closure r) : + ∃ t ∈ Γ₁.R, t ∈ (deleteVertices Γ₁ {v}).R ∧ SameAtom Γ Γ₁ K {u} t ∧ + u ∈ Γ₃.V ∧ SameAtom (deleteVertices Γ₁ {v}) Γ₃ J t {u} := by + obtain ⟨t, ht, hut, hs⟩ := sameAtom_vertex hK hK₁ hV₁ hu + have ht₂ := hc.vertex_corr u ⟨hu, fun h' => hur h'.1⟩ t ht hut + have hu₃ : u ∈ Γ₃.V := by + rw [hc.V_eq] + exact Or.inl ⟨hu, fun h' => hur h'.1⟩ + exact ⟨t, ht, ht₂, hs, hu₃, {u}, corr_region ht₂ (hc.radial.2.1.2.1 hu₃) hut, + corr_vertex hc.radial hu₃⟩ + +omit hK₂ in +omit [ConnectedSpace S] in +/-- For an edge `e` of `Γ` not in `rBar - r`, the atoms `e*` and `e** = f '' e`. -/ +theorem thread_edge {e : Set S} (he : e ∈ Γ.E) (hn : ¬ e ⊆ closure r \ r) : + ∃ g ∈ Γ₁.E, g ∈ (deleteVertices Γ₁ {v}).E ∧ SameAtom Γ Γ₁ K e g ∧ + f '' e ∈ Γ₃.E ∧ SameAtom (deleteVertices Γ₁ {v}) Γ₃ J g (f '' e) := by + obtain ⟨g, hg, ⟨s, hs, hes, hgs⟩, s', hs', hfe, hgs'⟩ := hc.edge_corr e he hn + have hg₁ : g ∈ Γ₁.E := (deleteVertices_isSubdrawing Γ₁ {v}).2 hg + have hfeE : f '' e ∈ Γ₃.E := by + rw [hc.E_eq] + exact ⟨e, ⟨he, hn⟩, rfl⟩ + exact ⟨g, hg₁, hg, ⟨s, corr_edge he hs hes, corr_edge hg₁ hs hgs⟩, hfeE, + ⟨s', corr_edge hg hs' hgs', corr_edge hfeE hs' hfe⟩⟩ + +omit [ConnectedSpace S] in +/-- For a region `c ≠ r` of `Γ`, the atoms `c*` and `c**`: the first is the vertex `w` of `K` in +`c`, +and the second is the region of `Γ₃` around `w`. -/ +theorem thread_region (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hK₁' : (PaintingOrDrawing.drawing Γ₁).IsRadialDrawing K) (hV₁ : Γ₁.V = K.V \ Γ.V) + (hr : r ∈ Γ.R) (hvr : v ∈ r) {c : Set S} (hc' : c ∈ Γ.R) + (hcr : c ≠ r) : + ∃ w ∈ c, ({w} : Set S) ∈ Γ₁.A ∧ ({w} : Set S) ∈ (deleteVertices Γ₁ {v}).A ∧ + SameAtom Γ Γ₁ K c {w} ∧ ∃ t ∈ Γ₃.R, w ∈ t ∧ SameAtom (deleteVertices Γ₁ {v}) Γ₃ J {w} t := by + obtain ⟨w, ⟨hwc, hwK⟩, -⟩ := hK.2.1.2.2.1 c hc' + have hwΓ : w ∉ Γ.V := fun h' => region_subset hc' hwc (Γ.V_subset_U h') + have hwv : w ≠ v := by + rintro rfl + exact hcr (region_eq_of_mem hc' hr hwc hvr) + have hw₁ : w ∈ Γ₁.V := by + rw [hV₁] + exact ⟨hwK, hwΓ⟩ + have hw₂ : w ∈ (deleteVertices Γ₁ {v}).V := by + rw [deleteVertices_V] + exact ⟨hw₁, hwv⟩ + have hwJ : w ∈ J.V := hK₂.2.1.2.1 hw₂ + have hoff : w ∉ Γ₃.U := fun h' => by + have : w ∈ Γ₃.V := hc.radial.2.1.1.subset ⟨h', J.V_subset_U hwJ⟩ + rw [hc.V_eq] at this + rcases this with h | h + · exact hwΓ h.1 + · exact hwv h + obtain ⟨t, ht, hwt⟩ := exists_region_of_notMem hoff + exact ⟨w, hwc, Or.inl (Or.inl ⟨w, hw₁, rfl⟩), Or.inl (Or.inl ⟨w, hw₂, rfl⟩), ⟨{w}, + corr_region hc' hwK hwc, corr_vertex hK₁' hw₁⟩, t, ht, hwt, ⟨{w}, corr_vertex hK₂ hw₂, + corr_region ht hwJ hwt⟩⟩ + +end Threads + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section75Case2Lift.lean b/LeanPool/GraphMinor/GM12/Section75Case2Lift.lean new file mode 100644 index 0000000000..0f2f141173 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section75Case2Lift.lean @@ -0,0 +1,538 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Section8 +public import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Two small sides and an edge cover a graph + +A hypergraph fact for the order 2 step of Case 2 of XII (7.5). Let `T` be a tangle of order 3 in a +graph +`G`, and let `T'` be the tangle of order 2 in `G \ v` that it gives. Suppose `(A₁, B₁)` and `(A₂, +B₂)` are +in `T'`, and that `A₁`, `A₂` and one edge `g` of `G \ v` make up `G \ v`. Then `A₁`, `A₂`, each with +the +edges at `v` that go to it, and `g` are three small sides that cover `G`. This cannot happen +(`false_of_cover_of_edge`). +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Hypergraph GraphMinor.GM10 + +variable {α β : Type*} + +/-- `A` with `v` and with the edges at `v` all of whose other ends lie in `A`. -/ +def starLeft (G A : Hypergraph α β) (v : α) (hA : A ≤ G.deleteVertices {v}) (hv : v ∈ G.vertexSet) : + Hypergraph α β where + vertexSet := A.vertexSet ∪ {v} + edgeSet := A.edgeSet ∪ {f ∈ G.edgeSet | G.Inc f v ∧ ∀ w, G.Inc f w → w = v ∨ w ∈ A.vertexSet} + Inc f w := G.Inc f w ∧ + (f ∈ A.edgeSet ∨ f ∈ G.edgeSet ∧ G.Inc f v ∧ ∀ w, G.Inc f w → w = v ∨ w ∈ A.vertexSet) + vertex_mem_of_inc f w h := by + obtain ⟨h₁, hf | hf⟩ := h + · have hd : w ∈ (G.deleteVertices {v}).ends f := by + have hf' := hA.edgeSet_subset hf + exact ⟨h₁, fun u hu => hu ▸ hf'.2 v rfl⟩ + rw [hA.ends_eq f hf] at hd + exact Or.inl (A.vertex_mem_of_inc hd) + · rcases hf.2.2 w h₁ with rfl | h' + · exact Or.inr rfl + · exact Or.inl h' + edge_mem_of_inc f w h := by + obtain ⟨_, hf | hf⟩ := h + · exact Or.inl hf + · exact Or.inr hf + vertexSet_finite := A.vertexSet_finite.union (finite_singleton v) + edgeSet_finite := A.edgeSet_finite.union (G.edgeSet_finite.subset fun _ h => h.1) + +/-- The other side of `starLeft`. -/ +def starRight (G A B : Hypergraph α β) (v : α) (hG : G.IsGraph) + (hAB : (G.deleteVertices {v}).IsSeparation A B) (hv : v ∈ G.vertexSet) : + Hypergraph α β where + vertexSet := B.vertexSet ∪ {v} + edgeSet := G.edgeSet \ (starLeft G A v hAB.left_le hv).edgeSet + Inc f w := G.Inc f w ∧ f ∉ (starLeft G A v hAB.left_le hv).edgeSet + vertex_mem_of_inc f w h := by + obtain ⟨h₁, hf⟩ := h + have hfG := G.edge_mem_of_inc h₁ + have hwG := G.vertex_mem_of_inc h₁ + by_cases hw : w = v + · exact Or.inr hw + by_cases hfv : G.Inc f v + · have : ∃ y, G.Inc f y ∧ y ≠ v ∧ y ∉ A.vertexSet := by + by_contra hn + push Not at hn + exact hf (Or.inr ⟨hfG, hfv, fun y hy => by + by_cases hyv : y = v + · exact Or.inl hyv + · exact Or.inr (hn y hy hyv)⟩) + obtain ⟨y, hy, hyv, hyA⟩ := this + have hwy : w = y := by + by_contra hne + have hsub : ({v, w, y} : Set α) ⊆ G.ends f := by + rintro z (rfl | rfl | rfl) + · exact hfv + · exact h₁ + · exact hy + have hcard : ({v, w, y} : Set α).ncard = 3 := by + rw [ncard_insert_of_notMem (by simp [Ne.symm hw, Ne.symm hyv]) (by simp), + ncard_pair hne] + have := ncard_le_ncard hsub (G.vertexSet_finite.subset fun _ h => G.vertex_mem_of_inc h) + have := (hG f hfG).2 + omega + have hmem : y ∈ A.vertexSet ∪ B.vertexSet := by + have h' : (A ∪ B).vertexSet = _ := congrArg vertexSet hAB.union_eq + change _ = G.vertexSet \ {v} at h' + change y ∈ (A ∪ B).vertexSet + rw [h'] + exact ⟨G.vertex_mem_of_inc hy, hyv⟩ + exact Or.inl (hwy ▸ hmem.resolve_left hyA) + · have hfd : f ∈ (G.deleteVertices {v}).edgeSet := ⟨hfG, fun u hu => hu ▸ hfv⟩ + have hfB : f ∈ B.edgeSet := by + have h' : (A ∪ B).edgeSet = _ := congrArg edgeSet hAB.union_eq + have : f ∈ (A ∪ B).edgeSet := h' ▸ hfd + exact this.resolve_left fun h'' => hf (Or.inl h'') + have hd : w ∈ (G.deleteVertices {v}).ends f := ⟨h₁, fun u hu => hu ▸ hfv⟩ + rw [hAB.right_le.ends_eq f hfB] at hd + exact Or.inl (B.vertex_mem_of_inc hd) + edge_mem_of_inc f w h := ⟨G.edge_mem_of_inc h.1, h.2⟩ + vertexSet_finite := B.vertexSet_finite.union (finite_singleton v) + edgeSet_finite := G.edgeSet_finite.subset sdiff_subset + +variable {G A B : Hypergraph α β} {v : α} + +theorem notMem_of_le_delete (hA : A ≤ G.deleteVertices {v}) : v ∉ A.vertexSet := fun h => + (hA.vertexSet_subset h).2 rfl + +theorem star_isSeparation (hG : G.IsGraph) (hAB : (G.deleteVertices {v}).IsSeparation A B) + (hv : v ∈ G.vertexSet) : + G.IsSeparation (starLeft G A v hAB.left_le hv) (starRight G A B v hG hAB hv) := by + have hUV : ∀ w, w ∈ G.vertexSet → w = v ∨ w ∈ A.vertexSet ∨ w ∈ B.vertexSet := by + intro w hw + by_cases hwv : w = v + · exact Or.inl hwv + · right + have h' : (A ∪ B).vertexSet = _ := congrArg vertexSet hAB.union_eq + change w ∈ (A ∪ B).vertexSet + rw [h'] + exact ⟨hw, hwv⟩ + have hAE : A.edgeSet ⊆ G.edgeSet := fun f hf => (hAB.left_le.edgeSet_subset hf).1 + refine ⟨⟨?_, ?_, ?_⟩, ⟨?_, ?_, ?_⟩, ?_, ?_⟩ + · rintro w (h | h) + · exact (hAB.left_le.vertexSet_subset h).1 + · exact (mem_singleton_iff.mp h) ▸ hv + · rintro f (h | h) + · exact hAE h + · exact h.1 + · intro f hf + ext w + exact ⟨fun h => ⟨h, hf.imp id id⟩, fun h => h.1⟩ + · rintro w (h | h) + · exact (hAB.right_le.vertexSet_subset h).1 + · exact (mem_singleton_iff.mp h) ▸ hv + · exact fun f h => h.1 + · intro f hf + ext w + exact ⟨fun h => ⟨h, hf.2⟩, fun h => h.1⟩ + · refine Hypergraph.ext ?_ ?_ ?_ + · ext w + constructor + · rintro ((h | h) | (h | h)) + · exact (hAB.left_le.vertexSet_subset h).1 + · exact (mem_singleton_iff.mp h) ▸ hv + · exact (hAB.right_le.vertexSet_subset h).1 + · exact (mem_singleton_iff.mp h) ▸ hv + · intro hw + rcases hUV w hw with h | h | h + · exact Or.inl (Or.inr h) + · exact Or.inl (Or.inl h) + · exact Or.inr (Or.inl h) + · ext f + constructor + · rintro (h | h) + · rcases h with h | h + · exact hAE h + · exact h.1 + · exact h.1 + · intro hf + by_cases h : f ∈ (starLeft G A v hAB.left_le hv).edgeSet + · exact Or.inl h + · exact Or.inr ⟨hf, h⟩ + · funext f w + apply propext + constructor + · rintro (h | h) + · exact h.1 + · exact h.1 + · intro h + by_cases hf : f ∈ (starLeft G A v hAB.left_le hv).edgeSet + · exact Or.inl ⟨h, hf.imp id id⟩ + · exact Or.inr ⟨h, hf⟩ + · ext f + simp only [mem_empty_iff_false, iff_false] + exact fun h => h.2.2 h.1 + +theorem star_order_le (hG : G.IsGraph) (hAB : (G.deleteVertices {v}).IsSeparation A B) + (hv : v ∈ G.vertexSet) : + separationOrder (starLeft G A v hAB.left_le hv) (starRight G A B v hG hAB hv) ≤ + separationOrder A B + 1 := by + have hsub : (starLeft G A v hAB.left_le hv ∩ starRight G A B v hG hAB hv).vertexSet ⊆ + insert v (A ∩ B).vertexSet := by + rintro w ⟨h₁ | h₁, h₂ | h₂⟩ + · exact Or.inr ⟨h₁, h₂⟩ + · exact Or.inl h₂ + · exact Or.inl h₁ + · exact Or.inl h₁ + have hfin : (insert v (A ∩ B).vertexSet).Finite := (A ∩ B).vertexSet_finite.insert v + exact (ncard_le_ncard hsub hfin).trans (ncard_insert_le _ _) + +theorem starLeft_delete (hAB : (G.deleteVertices {v}).IsSeparation A B) (hv : v ∈ G.vertexSet) : + (starLeft G A v hAB.left_le hv).deleteVertices {v} = A := by + have hvA := notMem_of_le_delete hAB.left_le + have hno : ∀ f ∈ A.edgeSet, ¬ G.Inc f v := fun f hf => + (hAB.left_le.edgeSet_subset hf).2 v rfl + have hmem : ∀ f, (starLeft G A v hAB.left_le hv).Inc f v → f ∉ A.edgeSet := fun f h hf => + hno f hf h.1 + refine Hypergraph.ext ?_ ?_ ?_ + · ext w + constructor + · rintro ⟨h | h, h'⟩ + · exact h + · exact absurd h h' + · exact fun h => ⟨Or.inl h, fun h' => hvA (mem_singleton_iff.mp h' ▸ h)⟩ + · ext f + constructor + · rintro ⟨h | h, h'⟩ + · exact h + · exact absurd ⟨h.2.1, Or.inr h⟩ (h' v rfl) + · exact fun h => ⟨Or.inl h, fun u hu h' => hno f h (mem_singleton_iff.mp hu ▸ h'.1)⟩ + · funext f w + apply propext + constructor + · rintro ⟨⟨h₁, h | h⟩, h₂⟩ + · have hd : w ∈ (G.deleteVertices {v}).ends f := + ⟨h₁, fun u hu => (mem_singleton_iff.mp hu) ▸ hno f h⟩ + rw [hAB.left_le.ends_eq f h] at hd + exact hd + · exact absurd ⟨h.2.1, Or.inr h⟩ (h₂ v rfl) + · intro h + have hf := A.edge_mem_of_inc h + have hd : w ∈ (G.deleteVertices {v}).ends f := by + rw [hAB.left_le.ends_eq f hf] + exact h + exact ⟨⟨hd.1, Or.inl hf⟩, fun u hu h' => hno f hf (mem_singleton_iff.mp hu ▸ h'.1)⟩ + +theorem starRight_delete (hG : G.IsGraph) (hAB : (G.deleteVertices {v}).IsSeparation A B) + (hv : v ∈ G.vertexSet) : + (starRight G A B v hG hAB hv).deleteVertices {v} = B := by + have hvB := notMem_of_le_delete hAB.right_le + have hno : ∀ f ∈ B.edgeSet, ¬ G.Inc f v := fun f hf => + (hAB.right_le.edgeSet_subset hf).2 v rfl + have hBout : ∀ f ∈ B.edgeSet, f ∉ (starLeft G A v hAB.left_le hv).edgeSet := by + rintro f hf (h | h) + · have : f ∈ (A ∩ B).edgeSet := ⟨h, hf⟩ + rw [hAB.edgeSet_inter_eq] at this + exact this + · exact hno f hf h.2.1 + have hBE : ∀ f, f ∈ G.edgeSet → f ∉ (starLeft G A v hAB.left_le hv).edgeSet → ¬ G.Inc f v → + f ∈ B.edgeSet := by + intro f hf hn hfv + have hfd : f ∈ (G.deleteVertices {v}).edgeSet := ⟨hf, fun u hu => hu ▸ hfv⟩ + have h' : (A ∪ B).edgeSet = _ := congrArg edgeSet hAB.union_eq + have : f ∈ (A ∪ B).edgeSet := h' ▸ hfd + exact this.resolve_left fun h'' => hn (Or.inl h'') + refine Hypergraph.ext ?_ ?_ ?_ + · ext w + constructor + · rintro ⟨h | h, h'⟩ + · exact h + · exact absurd h h' + · exact fun h => ⟨Or.inl h, fun h' => hvB (mem_singleton_iff.mp h' ▸ h)⟩ + · ext f + constructor + · rintro ⟨h, h'⟩ + exact hBE f h.1 h.2 fun hi => h' v rfl ⟨hi, h.2⟩ + · intro h + exact ⟨⟨(hAB.right_le.edgeSet_subset h).1, hBout f h⟩, + fun u hu h' => hno f h (mem_singleton_iff.mp hu ▸ h'.1)⟩ + · funext f w + apply propext + constructor + · rintro ⟨⟨h₁, h⟩, h₂⟩ + have hfB := hBE f (G.edge_mem_of_inc h₁) h fun hi => h₂ v rfl ⟨hi, h⟩ + have hd : w ∈ (G.deleteVertices {v}).ends f := + ⟨h₁, fun u hu => (mem_singleton_iff.mp hu) ▸ hno f hfB⟩ + rw [hAB.right_le.ends_eq f hfB] at hd + exact hd + · intro h + have hf := B.edge_mem_of_inc h + have hd : w ∈ (G.deleteVertices {v}).ends f := by + rw [hAB.right_le.ends_eq f hf] + exact h + exact ⟨⟨hd.1, hBout f hf⟩, fun u hu h' => hno f hf (mem_singleton_iff.mp hu ▸ h'.1)⟩ + +/-- A separation in `T'` lifts to `T` with the edges at `v` placed as in `starLeft`. -/ +theorem star_mem {T : Set (Hypergraph α β × Hypergraph α β)} (hG : G.IsGraph) + (hT : IsTangle G 3 T) (hv : v ∈ G.vertexSet) + (hT' : IsTangle (G.deleteVertices {v}) 2 (deleteVerticesTangle G {v} T 3)) + (hAB : (A, B) ∈ deleteVerticesTangle G {v} T 3) : + ∃ (hs : (G.deleteVertices {v}).IsSeparation A B) , + (starLeft G A v hs.left_le hv, starRight G A B v hG hs hv) ∈ T := by + have hs : (G.deleteVertices {v}).IsSeparation A B := hAB.1 + refine ⟨hs, ?_⟩ + have hsep := star_isSeparation hG hs hv + have hord : separationOrder (starLeft G A v hs.left_le hv) (starRight G A B v hG hs hv) < 3 := by + have h₁ := star_order_le hG hs hv + have h₂ : separationOrder A B < 2 := hT'.order_lt hAB + omega + refine (hT.axiom1 hsep hord).resolve_right fun hn => ?_ + have hsymm : (G.deleteVertices {v}).IsSeparation B A := by + refine ⟨hs.right_le, hs.left_le, ?_, ?_⟩ + · rw [← hs.union_eq] + exact Hypergraph.ext (union_comm _ _) (union_comm _ _) (by + funext f w; exact propext or_comm) + · have : (B ∩ A).edgeSet = (A ∩ B).edgeSet := inter_comm _ _ + rw [this] + exact hs.edgeSet_inter_eq + have hordBA : separationOrder B A < 2 := by + have h₂ : separationOrder A B < 2 := hT'.order_lt hAB + have : separationOrder B A = separationOrder A B := by + unfold separationOrder + exact congrArg ncard (inter_comm _ _) + omega + have hBA : (B, A) ∈ deleteVerticesTangle G {v} T 3 := by + refine ⟨hsymm, by simpa using hordBA, _, hn, ?_, starRight_delete hG hs hv, + starLeft_delete hs hv⟩ + rintro w hw + obtain rfl : w = v := hw + exact ⟨Or.inr rfl, Or.inr rfl⟩ + refine hT'.axiom2 hAB hBA hBA ?_ + rw [← hs.union_eq] + refine Hypergraph.ext (by ext w; exact or_iff_left_of_imp fun h => Or.inr h) (by + ext w; exact or_iff_left_of_imp fun h => Or.inr h) ?_ + funext f w + exact propext (or_iff_left_of_imp fun h => Or.inr h) + +/-- The union of the left sides of some separations of `G` that all meet at most in `h`, as a +separation of `G` that meets in `h`. -/ +def joinLeft (G : Hypergraph α β) (P : Set (Hypergraph α β × Hypergraph α β)) (h : α) + (hP : ∀ p ∈ P, G.IsSeparation p.1 p.2) (_hh : h ∈ G.vertexSet) : Hypergraph α β where + vertexSet := insert h (⋃ p ∈ P, p.1.vertexSet) + edgeSet := ⋃ p ∈ P, p.1.edgeSet + Inc f w := G.Inc f w ∧ f ∈ ⋃ p ∈ P, p.1.edgeSet + vertex_mem_of_inc f w hi := by + obtain ⟨p, hp, hf⟩ := mem_iUnion₂.mp hi.2 + have hw : w ∈ p.1.ends f := by + rw [← (hP p hp).left_le.ends_eq f hf] + exact hi.1 + exact Or.inr (mem_biUnion hp (p.1.vertex_mem_of_inc hw)) + edge_mem_of_inc _ _ hi := hi.2 + vertexSet_finite := (G.vertexSet_finite.subset fun w hw => by + obtain ⟨p, hp, hw⟩ := mem_iUnion₂.mp hw + exact (hP p hp).left_le.vertexSet_subset hw).insert h + edgeSet_finite := G.edgeSet_finite.subset fun f hf => by + obtain ⟨p, hp, hf⟩ := mem_iUnion₂.mp hf + exact (hP p hp).left_le.edgeSet_subset hf + +/-- The other side of `joinLeft`. -/ +def joinRight (G : Hypergraph α β) (P : Set (Hypergraph α β × Hypergraph α β)) (h : α) + (hP : ∀ p ∈ P, G.IsSeparation p.1 p.2) (_hh : h ∈ G.vertexSet) + (hm : ∀ p ∈ P, (p.1 ∩ p.2).vertexSet ⊆ {h}) : Hypergraph α β where + vertexSet := insert h (G.vertexSet \ ⋃ p ∈ P, p.1.vertexSet) + edgeSet := G.edgeSet \ ⋃ p ∈ P, p.1.edgeSet + Inc f w := G.Inc f w ∧ f ∉ ⋃ p ∈ P, p.1.edgeSet + vertex_mem_of_inc f w hi := by + by_cases hw : w = h + · exact Or.inl hw + refine Or.inr ⟨G.vertex_mem_of_inc hi.1, fun hc => ?_⟩ + obtain ⟨p, hp, hwp⟩ := mem_iUnion₂.mp hc + have hs := hP p hp + have hfG := G.edge_mem_of_inc hi.1 + have hfQ : f ∈ p.2.edgeSet := by + have hu : (p.1 ∪ p.2).edgeSet = G.edgeSet := congrArg edgeSet hs.union_eq + have : f ∈ (p.1 ∪ p.2).edgeSet := hu ▸ hfG + exact this.resolve_left fun h' => hi.2 (mem_biUnion hp h') + have hwQ : w ∈ p.2.ends f := by + rw [← hs.right_le.ends_eq f hfQ] + exact hi.1 + exact hw (hm p hp ⟨hwp, p.2.vertex_mem_of_inc hwQ⟩) + edge_mem_of_inc f _ hi := ⟨G.edge_mem_of_inc hi.1, hi.2⟩ + vertexSet_finite := (G.vertexSet_finite.subset sdiff_subset).insert h + edgeSet_finite := G.edgeSet_finite.subset sdiff_subset + +theorem join_isSeparation {P : Set (Hypergraph α β × Hypergraph α β)} {h : α} + (hP : ∀ p ∈ P, G.IsSeparation p.1 p.2) (hh : h ∈ G.vertexSet) + (hm : ∀ p ∈ P, (p.1 ∩ p.2).vertexSet ⊆ {h}) : + G.IsSeparation (joinLeft G P h hP hh) (joinRight G P h hP hh hm) := by + have hVL : ∀ w ∈ ⋃ p ∈ P, p.1.vertexSet, w ∈ G.vertexSet := fun w hw => by + obtain ⟨p, hp, hw⟩ := mem_iUnion₂.mp hw + exact (hP p hp).left_le.vertexSet_subset hw + have hEL : ∀ f ∈ ⋃ p ∈ P, p.1.edgeSet, f ∈ G.edgeSet := fun f hf => by + obtain ⟨p, hp, hf⟩ := mem_iUnion₂.mp hf + exact (hP p hp).left_le.edgeSet_subset hf + refine ⟨⟨?_, hEL, ?_⟩, ⟨?_, sdiff_subset, ?_⟩, ?_, ?_⟩ + · rintro w (rfl | hw) + · exact hh + · exact hVL w hw + · intro f hf + ext w + exact ⟨fun hi => ⟨hi, hf⟩, fun hi => hi.1⟩ + · rintro w (rfl | hw) + · exact hh + · exact hw.1 + · intro f hf + ext w + exact ⟨fun hi => ⟨hi, hf.2⟩, fun hi => hi.1⟩ + · refine Hypergraph.ext ?_ ?_ ?_ + · ext w + constructor + · rintro ((rfl | hw) | (rfl | hw)) + · exact hh + · exact hVL w hw + · exact hh + · exact hw.1 + · intro hw + by_cases hc : w ∈ ⋃ p ∈ P, p.1.vertexSet + · exact Or.inl (Or.inr hc) + · exact Or.inr (Or.inr ⟨hw, hc⟩) + · ext f + constructor + · rintro (hf | hf) + · exact hEL f hf + · exact hf.1 + · intro hf + by_cases hc : f ∈ ⋃ p ∈ P, p.1.edgeSet + · exact Or.inl hc + · exact Or.inr ⟨hf, hc⟩ + · funext f w + apply propext + constructor + · rintro (hi | hi) + · exact hi.1 + · exact hi.1 + · intro hi + by_cases hc : f ∈ ⋃ p ∈ P, p.1.edgeSet + · exact Or.inl ⟨hi, hc⟩ + · exact Or.inr ⟨hi, hc⟩ + · ext f + simp only [mem_empty_iff_false, iff_false] + exact fun hf => hf.2.2 hf.1 + +theorem join_inter_subset {P : Set (Hypergraph α β × Hypergraph α β)} {h : α} + (hP : ∀ p ∈ P, G.IsSeparation p.1 p.2) (hh : h ∈ G.vertexSet) + (hm : ∀ p ∈ P, (p.1 ∩ p.2).vertexSet ⊆ {h}) : + (joinLeft G P h hP hh ∩ joinRight G P h hP hh hm).vertexSet = {h} := by + ext w + constructor + · rintro ⟨h₁ | h₁, h₂ | h₂⟩ + · exact h₁ + · exact h₁ + · exact h₂ + · exact absurd h₁ h₂.2 + · intro hw + exact ⟨Or.inl hw, Or.inl hw⟩ + +/-- See the module docstring. The hypotheses `hV` and `hE` say that `A₁`, `A₂` and `g` make up `G \ +v`. -/ +theorem false_of_cover_of_edge {A₁ B₁ A₂ B₂ : Hypergraph α β} + {T : Set (Hypergraph α β × Hypergraph α β)} (hG : G.IsGraph) + (hT : IsTangle G 3 T) (hv : v ∈ G.vertexSet) + (hT' : IsTangle (G.deleteVertices {v}) 2 (deleteVerticesTangle G {v} T 3)) + (h₁ : (A₁, B₁) ∈ deleteVerticesTangle G {v} T 3) + (h₂ : (A₂, B₂) ∈ deleteVerticesTangle G {v} T 3) + {g : β} (hg : g ∈ G.edgeSet) + (hV : ∀ w ∈ G.vertexSet, w ≠ v → w ∈ A₁.vertexSet ∨ w ∈ A₂.vertexSet) + (hE : ∀ f ∈ G.edgeSet, ¬ G.Inc f v → f ≠ g → f ∈ A₁.edgeSet ∨ f ∈ A₂.edgeSet) : False := by + obtain ⟨hs₁, hm₁⟩ := star_mem hG hT hv hT' h₁ + obtain ⟨hs₂, hm₂⟩ := star_mem hG hT hv hT' h₂ + have hsize : edgeSize G g < 3 := by + have := (hG g hg).2 + unfold edgeSize + omega + have hm₃ := (GraphMinor.GM10.theorem_2_7_proof hT.one_le hT.isSeparation hT.order_lt hT.axiom1 + hT.axiom2).mp hT g hg hsize + have hle₁ := (star_isSeparation hG hs₁ hv).left_le + have hle₂ := (star_isSeparation hG hs₂ hv).left_le + have hedge : ∀ f ∈ G.edgeSet, f ∈ (starLeft G A₁ v hs₁.left_le hv).edgeSet ∨ + f ∈ (starLeft G A₂ v hs₂.left_le hv).edgeSet ∨ f = g := by + intro f hf + by_cases hfv : G.Inc f v + · by_cases hc : ∃ y, G.Inc f y ∧ y ≠ v + · obtain ⟨y, hy, hyv⟩ := hc + have honly : ∀ w, G.Inc f w → w = v ∨ w = y := by + intro w hw + by_contra hn + push Not at hn + have hsub : ({v, w, y} : Set α) ⊆ G.ends f := by + rintro z (rfl | rfl | rfl) + · exact hfv + · exact hw + · exact hy + have hcard : ({v, w, y} : Set α).ncard = 3 := by + rw [ncard_insert_of_notMem (by simp [Ne.symm hn.1, Ne.symm hyv]) (by simp), + ncard_pair hn.2] + have := ncard_le_ncard hsub (G.vertexSet_finite.subset fun _ h => G.vertex_mem_of_inc h) + have := (hG f hf).2 + omega + rcases hV y (G.vertex_mem_of_inc hy) hyv with h | h + · exact Or.inl (Or.inr ⟨hf, hfv, fun w hw => (honly w hw).imp id (fun (e : w = y) + => e ▸ h)⟩) + · exact Or.inr (Or.inl (Or.inr ⟨hf, hfv, fun w hw => (honly w hw).imp id (fun (e : w = y) + => e ▸ h)⟩)) + · push Not at hc + exact Or.inl (Or.inr ⟨hf, hfv, fun w hw => Or.inl (hc w hw)⟩) + · by_cases hfg : f = g + · exact Or.inr (Or.inr hfg) + · rcases hE f hf hfv hfg with h | h + · exact Or.inl (Or.inl h) + · exact Or.inr (Or.inl (Or.inl h)) + refine hT.axiom2 hm₁ hm₂ hm₃ ?_ + refine Hypergraph.ext ?_ ?_ ?_ + · ext w + constructor + · rintro ((h | h) | h) + · exact hle₁.vertexSet_subset h + · exact hle₂.vertexSet_subset h + · exact G.vertex_mem_of_inc h + · intro hw + by_cases hwv : w = v + · exact Or.inl (Or.inl (Or.inr hwv)) + · rcases hV w hw hwv with h | h + · exact Or.inl (Or.inl (Or.inl h)) + · exact Or.inl (Or.inr (Or.inl h)) + · ext f + constructor + · rintro ((h | h) | h) + · exact hle₁.edgeSet_subset h + · exact hle₂.edgeSet_subset h + · exact (mem_singleton_iff.mp h) ▸ hg + · intro hf + rcases hedge f hf with h | h | h + · exact Or.inl (Or.inl h) + · exact Or.inl (Or.inr h) + · exact Or.inr h + · funext f w + apply propext + constructor + · rintro ((h | h) | h) + · exact h.1 + · exact h.1 + · exact h.1 ▸ h.2 + · intro h + rcases hedge f (G.edge_mem_of_inc h) with hf | hf | hf + · exact Or.inl (Or.inl ⟨h, hf.imp id id⟩) + · exact Or.inl (Or.inr ⟨h, hf.imp id id⟩) + · exact Or.inr ⟨hf, hf ▸ h⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section75Defs.lean b/LeanPool/GraphMinor/GM12/Section75Defs.lean new file mode 100644 index 0000000000..a851b10bf8 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section75Defs.lean @@ -0,0 +1,60 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section76 + +/-! +# Graph Minors XII, (7.4): statement definition for Section 7.5 + +This file defines `GM12.Theorem74Statement`, formalizing **(7.4)** of Graph Minors XII +(pages 262–263), using the same definitions (`HasTangleMetric`, `deleteVertices`, `IsTwoCell`) +as `GM12.Theorem75Statement` in `GraphMinor/GM12/Section76.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Function Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 Hypergraph + +universe u + +/-- **(7.4)** of Graph Minors XII (pages 262–263): +"Let $\mathscr{T}$ be a respectful tangle of order $\theta \ge 2$ in a 2-cell drawing +$\Gamma$ in a connected surface $\Sigma$, and let its metric be $d$. Let $v \in V(\Gamma)$. +Then there is a 2-cell component $\Gamma'$ of $\Gamma \setminus v$ and a respectful tangle +$\mathscr{T}'$ of order $\theta - 1$ in $\Gamma'$, with metric $d'$, such that if $r'$ is +the region of $\Gamma'$ containing $v$, then* (i) *$U(\Gamma) \subseteq U(\Gamma') \cup r'$* +(ii) *$d'(a, b) \ge d(a, b) - 2$ for all $a, b \in A(\Gamma) \cap A(\Gamma')$* (iii) *$d'(a, +r') \ge d(a, \{v\}) - 1$ for all $a \in A(\Gamma) \cap A(\Gamma')$, and* (iv) *$d(a, \{v\}) +\le 2$ for all $a \in A(\Gamma)$ with $a \subseteq r'$." -/ +def Theorem74Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T2Space S] [ConnectedSpace S], + IsClosedSurface S → + ∀ (Γ : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (v : S), + 2 ≤ θ → + HasTangleMetric Γ θ T d → + v ∈ Γ.V → + ∃ (Γ' : Drawing S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r' : Set S), + Γ'.IsSubdrawing (deleteVertices Γ {v}) ∧ + (PaintingOrDrawing.drawing Γ').IsTwoCell ∧ + HasTangleMetric Γ' (θ - 1) T' d' ∧ + r' ∈ Γ'.R ∧ v ∈ r' ∧ + Γ.U ⊆ Γ'.U ∪ r' ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 2 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a {v} - 1 ≤ d' a r') ∧ + (∀ a ∈ Γ.A, a ⊆ r' → d a {v} ≤ 2) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section75OrderTwo.lean b/LeanPool/GraphMinor/GM12/Section75OrderTwo.lean new file mode 100644 index 0000000000..9c82e24e3b --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section75OrderTwo.lean @@ -0,0 +1,338 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section75Case2Lift +public import LeanPool.GraphMinor.GM12.Section73Tangle +public import LeanPool.GraphMinor.GM11.Theorem65 +public import LeanPool.GraphMinor.GM11.Theorem66 + +/-! +# The step of (6.6) at order 2 in Case 2 of XII (7.5) + +At `θ = 3`, Case 2 of (7.5) passes from the tangle `T₂` of order 2 in `Γ₂ = Γ₁ \ v` to a tangle of +order 2 +in `Γ₃`, by (6.6). But (6.6) fails at order 2 for a drawing with loops, and `Γ₃` may have loops. We +use +that `T₂` comes from a tangle `T₁` of order 3 in `Γ₁`. + +Let `T₃` be the pretangle in `Γ₃` induced by the slope of `T₂`. By X (2.7) we need that a loop `e` +of `Γ₃` +has a small side. Suppose not. Then `Γ₃ \ e` is small. Let `s` be the region of `J` containing `e`, +and +`g` the edge of `Γ₂` in `s`. Every other region of `J` lies in the disc of a short circuit in +`N(Z)`, and +`N(Z)` lies in `sBar`, so the vertex of `Γ₂` on that circuit is an end of `g`. By (6.3) these discs +give +two members of `T₂`, one for each end of `g`, whose left sides and `g` make up `Γ₂`. This +contradicts +`false_of_cover_of_edge`. +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +private theorem vertex_side_join_contains_selected_insides + {S : Type u} + [TopologicalSpace S] + [T2Space S] + [ConnectedSpace S] + (hS : IsClosedSurface S) + {J : Drawing S} + {ins : Drawing S → Set S} + (H : Drawing S) + (hJ₂ : (PaintingOrDrawing.drawing H).IsRadialDrawing J) + (hE₂ : H.E.Nonempty) + (T₂ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (hresp : (PaintingOrDrawing.drawing H).IsRespectful 2 T₂) + (hins : IsDerivedSlope (PaintingOrDrawing.drawing H) J 2 T₂ ins) + (hp₂ : IsPretangle (PaintingOrDrawing.drawing H).toHypergraph 2 T₂) + (Cs : Set (Drawing S)) + (hCJ : ∀ C ∈ Cs, C.IsCircuit ∧ C.IsSubdrawing J ∧ C.length < 2 * 2) + (pair : Drawing S → Hypergraph S (Set S) × Hypergraph S (Set S)) + (hPairEdges : ∀ C, (pair C).1.edgeSet ⊆ {f | f ⊆ ins C}) + (P : S → Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (hP : ∀ h, P h = pair '' {C ∈ Cs | C.V ∩ H.V ⊆ {h}}) + (hPs : ∀ (h : S), ∀ p ∈ P h, H.toHypergraph.IsSeparation p.1 p.2) + (hPm : ∀ (h : S), ∀ p ∈ P h, (p.1 ∩ p.2).vertexSet ⊆ {h}) +: + ∀ (h : S) (hh : h ∈ H.toHypergraph.vertexSet), (joinLeft H.toHypergraph (P h) h (hPs h) hh, + joinRight H.toHypergraph (P h) h (hPs h) hh (hPm h)) ∈ T₂ := by + intro h hh + have ht := theorem_6_3_proof S hS inferInstance (PaintingOrDrawing.drawing H) J 2 T₂ ins hJ₂.1 + hE₂ hp₂ + hresp hJ₂ hins + have hsepj := join_isSeparation (hPs h) hh (hPm h) + have hmj := join_inter_subset (hPs h) hh (hPm h) + have hordj : separationOrder (joinLeft H.toHypergraph (P h) h (hPs h) hh) + (joinRight H.toHypergraph (P h) h (hPs h) hh (hPm h)) < 2 := by + unfold separationOrder + rw [hmj, ncard_singleton] + omega + refine (ht.1 _ _ hsepj hordj).mpr ?_ + set A := joinLeft H.toHypergraph (P h) h (hPs h) hh with hA + have hex : ∀ f : A.edgeSet, ∃ C, (C ∈ Cs ∧ C.V ∩ H.V ⊆ {h}) ∧ f.1 ⊆ ins C := by + rintro ⟨f, hf⟩ + obtain ⟨p, hp, hf'⟩ := mem_iUnion₂.mp hf + rw [hP] at hp + obtain ⟨C, hC, rfl⟩ := hp + exact ⟨C, hC, hPairEdges C hf'⟩ + choose C' hC' using hex + have : Fintype A.edgeSet := A.edgeSet_finite.fintype + refine ⟨Fintype.card A.edgeSet, fun i => C' ((Fintype.equivFin _).symm i), fun i => ?_, ?_⟩ + · obtain ⟨hc, hs'⟩ := (hC' ((Fintype.equivFin _).symm i)).1 + refine ⟨(hCJ _ hc).1, (hCJ _ hc).2.1, (hCJ _ hc).2.2, fun w hw => ?_⟩ + have hw' := hs' hw + rw [hmj] + exact hw' + · intro f hf + refine ⟨Fintype.equivFin _ ⟨f, hf⟩, ?_⟩ + simpa using (hC' ⟨f, hf⟩).2 + +private theorem edge_covered_by_selected_circuit + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {Γ₃ : Drawing S} + {J : Drawing S} + {ins : Drawing S → Set S} + (H : Drawing S) + (hrad₂ : PreRad (PaintingOrDrawing.drawing H) J) + (F₂ : RegionFacts (PaintingOrDrawing.drawing H) J) + (e : Set S) + (x : S) + (s : Set S) + (hs : s ∈ J.R) + (hxs : x ∈ s) + (hes : e ⊆ s) + (g : Set S) + (hg : g ∈ (PaintingOrDrawing.drawing H).E) + (hgs : g ⊆ s) + (Z : Set (Set S)) + (hsmall : IsSmall J ins (2 * 2) (PaintingOrDrawing.drawing Γ₃).V 2 Z) + (hsZ : ∀ r ∈ J.R, r ≠ s → r ∈ Z) + : + ∀ f ∈ H.E, f ≠ g → ∃ C : Drawing S, + (C.IsCircuit ∧ C.IsSubdrawing (boundaryDrawing J Z) ∧ C.length < 2 * 2) ∧ f ⊆ ins C := by + intro f hf hfg + obtain ⟨y, hy⟩ := hf.1 + have hfdis : Disjoint f J.U := edge_disjoint hrad₂ hf + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem (disjoint_left.mp hfdis hy) + have hfr' : f ⊆ r := subset_region hr hf.2.2.1.isConnected.isPreconnected hfdis hy hyr + have hrs : r ≠ s := by + rintro rfl + exact hfg (F₂.2.1 r hr f hf g hg hfr' hgs) + obtain ⟨C, hC, hCsub, hl, hin⟩ := hsmall.2 r (hsZ r hr hrs) + exact ⟨C, ⟨hC, hCsub, hl⟩, hfr'.trans hin⟩ + +/-- See the module docstring. -/ +theorem isTangle_induced_of_order_three (hS : IsClosedSurface S) {Γ₁ Γ₃ J : Drawing S} {v : S} + {T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + (hT₁ : IsTangle Γ₁.toHypergraph 3 T₁) (hv : v ∈ Γ₁.V) + (hresp : (PaintingOrDrawing.drawing (deleteVertices Γ₁ {v})).IsRespectful 2 + (deleteVerticesTangle Γ₁.toHypergraph {v} T₁ 3)) + (hJ₂ : (PaintingOrDrawing.drawing (deleteVertices Γ₁ {v})).IsRadialDrawing J) + (hJ₃ : (PaintingOrDrawing.drawing Γ₃).IsRadialDrawing J) + (hins : IsDerivedSlope (PaintingOrDrawing.drawing (deleteVertices Γ₁ {v})) J 2 + (deleteVerticesTangle Γ₁.toHypergraph {v} T₁ 3) ins) + (hE₂ : (deleteVertices Γ₁ {v}).E.Nonempty) (hE₃ : Γ₃.E.Nonempty) : + IsTangle Γ₃.toHypergraph 2 (inducedPretangle (PaintingOrDrawing.drawing Γ₃) J 2 ins) := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + set H := deleteVertices Γ₁ {v} with hH + set T₂ := deleteVerticesTangle Γ₁.toHypergraph {v} T₁ 3 with hT₂def + have hT₂ : IsTangle H.toHypergraph 2 T₂ := theorem_7_3_tangle (by decide) hT₁ hv + have hT₂' : IsTangle (Γ₁.toHypergraph.deleteVertices {v}) 2 T₂ := by + rw [← deleteVertices_toHypergraph] + exact hT₂ + have hp₂ : IsPretangle (PaintingOrDrawing.drawing H).toHypergraph 2 T₂ := + IsTangle.isPretangle hT₂ + have hsl := isSlope_of_derived hS hp₂ hJ₂.2.1.1 hins + obtain ⟨hp₃, -, -⟩ := theorem_6_1_proof (Γ := PaintingOrDrawing.drawing Γ₃) hS hE₃ hJ₃ + (by norm_num) hsl + have hrad₂ : PreRad (PaintingOrDrawing.drawing H) J := ⟨hJ₂.1, hJ₂.2.1⟩ + have hrad₃ : PreRad (PaintingOrDrawing.drawing Γ₃) J := ⟨hJ₃.1, hJ₃.2.1⟩ + have F₂ := regionFacts_of_radial hrad₂ hS hJ₂.2.2 hE₂ + have F₃ := regionFacts_of_radial hrad₃ hS hJ₃.2.2 hE₃ + refine (GraphMinor.GM10.theorem_2_7_proof hp₃.one_le hp₃.isSeparation hp₃.order_lt hp₃.axiom1 + hp₃.axiom2).mpr ?_ + intro e he hsize + have heE : e ∈ Γ₃.E := he + have hsep := isSeparation_edgeHypergraph_deleteEdges (G := Γ₃.toHypergraph) he + have hord : separationOrder (edgeHypergraph Γ₃.toHypergraph e) + (Γ₃.toHypergraph.deleteEdges {e}) < 2 := by + rwa [separationOrder_edgeHypergraph_deleteEdges] + refine (hp₃.axiom1 hsep hord).resolve_right fun hbad => ?_ + obtain ⟨-, -, hsmall⟩ := hbad + -- The region `s` of `J` containing `e`, and the edge `g` of `Γ₂` in it. + obtain ⟨x, hx⟩ := heE.1 + have hedis : Disjoint e J.U := edge_disjoint hrad₃ heE + obtain ⟨s, hs, hxs⟩ := exists_region_of_notMem (disjoint_left.mp hedis hx) + have hes : e ⊆ s := subset_region hs heE.2.2.1.isConnected.isPreconnected hedis hx hxs + obtain ⟨g, hg, hgs⟩ := F₂.1 s hs + set Z := PaintingOrDrawing.regionsIncludingEdge J (Γ₃.toHypergraph.deleteEdges {e}) with hZ + have hsZ : ∀ r ∈ J.R, r ≠ s → r ∈ Z := by + intro r hr hrs + obtain ⟨e', he', he'r⟩ := F₃.1 r hr + refine ⟨hr, e', ⟨he', fun h' => hrs ?_⟩, he'r⟩ + obtain rfl : e' = e := h' + exact region_eq_of_mem hr hs (he'r hx) hxs + set N := boundaryDrawing J Z with hN + have hNsub : N.IsSubdrawing J := Drawing.span_isSubdrawing J _ _ + -- A vertex of `Γ₂` on `N(Z)` is an end of `g`. + have hNV : ∀ w ∈ N.V, w ∈ H.V → w ∈ closure g := by + intro w hw hwH + have hcl : w ∈ closure s := by + rcases hw with ⟨⟨-, r, ⟨hrR, hrZ⟩, -, -, hwr⟩, -⟩ | hw + · by_cases hrs : r = s + · exact hrs ▸ hwr + · exact absurd (hsZ r hrR hrs) hrZ + · obtain ⟨e', ⟨⟨-, r, ⟨hrR, hrZ⟩, -, -, hne⟩, he'J⟩, hwe'⟩ := mem_iUnion₂.mp hw + have hrs : r = s := by + by_contra hrs + exact hrZ (hsZ r hrR hrs) + subst hrs + exact closure_minimal (edge_subset_closure_of_incident hS he'J hrR hne) isClosed_closure + hwe'.1 + exact F₂.2.2 s hs g hg hgs w hwH hcl + set Cs : Set (Drawing S) := {C | C.IsCircuit ∧ C.IsSubdrawing N ∧ C.length < 2 * 2} with hCs + have hCJ : ∀ C ∈ Cs, C.IsCircuit ∧ C.IsSubdrawing J ∧ C.length < 2 * 2 := + fun C hC => ⟨hC.1, hC.2.1.trans hNsub, hC.2.2⟩ + let pair : Drawing S → Hypergraph S (Set S) × Hypergraph S (Set S) := fun C => + ((PaintingOrDrawing.drawing H).inter (ins C), (PaintingOrDrawing.drawing H).interOutside + (ins C)) + have hpair : ∀ C ∈ Cs, pair C ∈ T₂ := fun C hC => + (hins C (hCJ C hC).1 (hCJ C hC).2.1 (hCJ C hC).2.2).2.2 + have hfr : ∀ C ∈ Cs, frontier (ins C) = C.U := fun C hC => by + rw [← subBd_eq_frontier] + exact (hins C (hCJ C hC).1 (hCJ C hC).2.1 (hCJ C hC).2.2).2.1 + have hcl : ∀ C ∈ Cs, IsClosed (ins C) := fun C hC => + (IsClosedDisc.isCompact (hins C (hCJ C hC).1 (hCJ C hC).2.1 (hCJ C hC).2.2).1).isClosed + -- The two sides of `pair C` meet in the vertices of `Γ₂` on `C`. + have hmeet : ∀ C ∈ Cs, ((pair C).1 ∩ (pair C).2).vertexSet = C.V ∩ H.V := by + intro C hC + ext w + constructor + · rintro ⟨⟨hwH, hwi⟩, -, hwo⟩ + have hwf : w ∈ frontier (ins C) := by + rw [frontier_eq_closure_inter_closure] + refine ⟨subset_closure hwi, ?_⟩ + rwa [compl_eq_univ_sdiff] + rw [hfr C hC] at hwf + refine ⟨?_, hwH⟩ + by_contra hwV + obtain ⟨f, hf, hwfe⟩ := C.exists_edge_of_mem hwf hwV + exact ((hCJ C hC).2.1.2 hf).2.1 hwfe |>.2 (hJ₂.2.1.2.1 hwH) + · rintro ⟨hwC, hwH⟩ + have hwf : w ∈ frontier (ins C) := by + rw [hfr C hC] + exact C.V_subset_U hwC + have hwf' := hwf + rw [frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] at hwf' + have hwi : w ∈ ins C := (hcl C hC).closure_eq ▸ hwf'.1 + exact ⟨⟨hwH, hwi⟩, hwH, hwf'.2⟩ + have hlt : ∀ C ∈ Cs, (C.V ∩ H.V).ncard < 2 := by + intro C hC + rw [← hmeet C hC] + exact hT₂.order_lt (hpair C hC) + obtain ⟨h₁, h₂, hh₁, hh₂, hgends⟩ : ∃ h₁ h₂, h₁ ∈ H.V ∧ h₂ ∈ H.V ∧ + closure g ∩ H.V = {h₁, h₂} := by + rcases H.edge_cond g hg with ⟨a, b, -, hc, -⟩ | ⟨a, hc, -⟩ + · have ha : a ∈ closure g ∩ H.V := by rw [hc]; simp + have hb : b ∈ closure g ∩ H.V := by rw [hc]; simp + exact ⟨a, b, ha.2, hb.2, hc⟩ + · have ha : a ∈ closure g ∩ H.V := by rw [hc]; simp + exact ⟨a, a, ha.2, ha.2, by rw [hc]; simp⟩ + -- Each short circuit in `N(Z)` meets `Γ₂` in at most one of the ends of `g`. + have hend : ∀ C ∈ Cs, C.V ∩ H.V ⊆ {h₁} ∨ C.V ∩ H.V ⊆ {h₂} := by + intro C hC + have hfin : (C.V ∩ H.V).Finite := C.finite_V.subset inter_subset_left + have hone : ∀ a ∈ C.V ∩ H.V, ∀ b ∈ C.V ∩ H.V, a = b := fun a ha b hb => by + by_contra hab + have h2 := ncard_le_ncard (show ({a, b} : Set S) ⊆ C.V ∩ H.V by + rintro z (rfl | rfl) + · exact ha + · exact hb) hfin + rw [ncard_pair hab] at h2 + have := hlt C hC + omega + rcases (C.V ∩ H.V).eq_empty_or_nonempty with he | ⟨a, ha⟩ + · exact Or.inl (he ▸ empty_subset _) + have hag : a ∈ closure g ∩ H.V := ⟨hNV a (hC.2.1.1 ha.1) ha.2, ha.2⟩ + rw [hgends] at hag + rcases hag with rfl | rfl + · exact Or.inl fun b hb => hone b hb _ ha + · exact Or.inr fun b hb => hone b hb _ ha + let P : S → Set (Hypergraph S (Set S) × Hypergraph S (Set S)) := fun h => + pair '' {C | C ∈ Cs ∧ C.V ∩ H.V ⊆ {h}} + have hPs : ∀ h, ∀ p ∈ P h, H.toHypergraph.IsSeparation p.1 p.2 := by + rintro h _ ⟨C, hC, rfl⟩ + exact hT₂.isSeparation (hpair C hC.1) + have hPm : ∀ h, ∀ p ∈ P h, (p.1 ∩ p.2).vertexSet ⊆ {h} := by + rintro h _ ⟨C, hC, rfl⟩ + rw [hmeet C hC.1] + exact hC.2 + have hthe := fun (h : S) (hh : h ∈ H.toHypergraph.vertexSet) => + join_isSeparation (hPs h) hh (hPm h) + -- The join for an end of `g` is in `T₂`, by (6.3). + have hjoin : ∀ h (hh : h ∈ H.toHypergraph.vertexSet), + (joinLeft H.toHypergraph (P h) h (hPs h) hh, + joinRight H.toHypergraph (P h) h (hPs h) hh (hPm h)) ∈ T₂ := by + exact vertex_side_join_contains_selected_insides (S := S) hS (J := J) (ins := ins) + H hJ₂ hE₂ T₂ hresp hins hp₂ Cs hCJ pair (fun _ _ hf => hf.2) P (fun _ => rfl) hPs hPm + -- Every edge of `Γ₂` other than `g` lies in the disc of a short circuit in `N(Z)`. + have hcover : ∀ f ∈ H.E, f ≠ g → ∃ C ∈ Cs, f ⊆ ins C := by + exact edge_covered_by_selected_circuit (S := S) (Γ₃ := Γ₃) (J := J) (ins := ins) H hrad₂ F₂ e + x s hs hxs hes g hg hgs Z hsmall hsZ + have hmemP : ∀ C ∈ Cs, pair C ∈ P h₁ ∨ pair C ∈ P h₂ := fun C hC => + (hend C hC).imp (fun h' => ⟨C, ⟨hC, h'⟩, rfl⟩) (fun h' => ⟨C, ⟨hC, h'⟩, rfl⟩) + have hedge : ∀ {f}, f ∈ H.E → ∀ C ∈ Cs, f ⊆ ins C → f ∈ (pair C).1.edgeSet := + fun hf C _ hsub => ⟨hf, hsub⟩ + rw [← deleteVertices_toHypergraph] at hT₂' + refine false_of_cover_of_edge (A₁ := joinLeft H.toHypergraph (P h₁) h₁ (hPs h₁) hh₁) + (A₂ := joinLeft H.toHypergraph (P h₂) h₂ (hPs h₂) hh₂) + (drawing_toHypergraph_isGraph Γ₁) hT₁ hv ?_ (hjoin h₁ hh₁) (hjoin h₂ hh₂) + (g := g) ((deleteVertices_isSubdrawing Γ₁ {v}).2 hg) ?_ ?_ + · rw [← deleteVertices_toHypergraph] + exact hT₂ + · intro w hw hwv + have hwH : w ∈ H.V := by + rw [hH, deleteVertices_V] + exact ⟨hw, hwv⟩ + obtain ⟨f, hf, hwf⟩ := exists_edge_of_regionFacts hS F₂ hwH + by_cases hfg : f = g + · have : w ∈ closure g ∩ H.V := ⟨hfg ▸ hwf, hwH⟩ + rw [hgends] at this + rcases this with rfl | rfl + · exact Or.inl (Or.inl rfl) + · exact Or.inr (Or.inl rfl) + · obtain ⟨C, hC, hin⟩ := hcover f hf hfg + have hwi : w ∈ ins C := (hcl C hC).closure_eq ▸ closure_mono hin hwf + rcases hmemP C hC with h' | h' + · exact Or.inl (Or.inr (mem_biUnion h' ⟨hwH, hwi⟩)) + · exact Or.inr (Or.inr (mem_biUnion h' ⟨hwH, hwi⟩)) + · intro f hf hfv hfg + have hfH : f ∈ H.E := by + have h' : f ∈ (Γ₁.toHypergraph.deleteVertices {v}).edgeSet := ⟨hf, fun u hu => hu ▸ hfv⟩ + rw [← deleteVertices_toHypergraph] at h' + exact h' + obtain ⟨C, hC, hin⟩ := hcover f hfH hfg + rcases hmemP C hC with h' | h' + · exact Or.inl (mem_biUnion h' (hedge hfH C hC hin)) + · exact Or.inr (mem_biUnion h' (hedge hfH C hC hin)) + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section75Proof.lean b/LeanPool/GraphMinor/GM12/Section75Proof.lean new file mode 100644 index 0000000000..86ea6531b5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section75Proof.lean @@ -0,0 +1,221 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section75Case2 +public import LeanPool.GraphMinor.GM12.Section75OrderTwo +public import LeanPool.GraphMinor.GM12.Section75TwoCell +public import LeanPool.GraphMinor.GM12.Section73MetricComparison +public import LeanPool.GraphMinor.GM12.SurfaceDualContract +import LeanPool.GraphMinor.GM11.Theorem63 + +/-! +# Graph Minors XII, (7.5) + +Case 1 of (7.5) is `exists_theorem_7_5_disc_reduction`. It leaves a drawing in which no `O`-arc +through +one vertex has an edge in its selected disc. `theorem_7_5_case_2_chain` runs the chain of Case 2 on +such a +drawing, `Γ` to the dual `Γ₁` to `Γ₂ = Γ₁ \ r*` to the dual `Γ₃` of `Γ₂`, and ends with +`theorem_7_5_case_2`. +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The form of `exists_dual_tangleMetric_of_common_radial` at order 2, for the tangle of `Γ₂` that +comes +from a tangle of order 3 in `Γ₁`. The tangle in `Γ₃` is `isTangle_induced_of_order_three`. -/ +theorem exists_dual_tangleMetric_order_two (hS : IsClosedSurface S) {Γ₁ Γ₃ J : Drawing S} {v : S} + {T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + (hT₁ : IsTangle Γ₁.toHypergraph 3 T₁) (hv : v ∈ Γ₁.V) + (hresp : (PaintingOrDrawing.drawing (deleteVertices Γ₁ {v})).IsRespectful 2 + (deleteVerticesTangle Γ₁.toHypergraph {v} T₁ 3)) + (hJ₂ : (PaintingOrDrawing.drawing (deleteVertices Γ₁ {v})).IsRadialDrawing J) + (hJ₃ : (PaintingOrDrawing.drawing Γ₃).IsRadialDrawing J) + (hins : IsDerivedSlope (PaintingOrDrawing.drawing (deleteVertices Γ₁ {v})) J 2 + (deleteVerticesTangle Γ₁.toHypergraph {v} T₁ 3) ins) + (hE₂ : (deleteVertices Γ₁ {v}).E.Nonempty) (hE₃ : Γ₃.E.Nonempty) : + ∃ (T₃ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (d₃ : Set S → Set S → ℕ), + HasTangleMetric Γ₃ 2 T₃ d₃ ∧ + (∀ a ∈ (deleteVertices Γ₁ {v}).A, ∀ b ∈ (deleteVertices Γ₁ {v}).A, + ∀ a_star ∈ Γ₃.A, ∀ b_star ∈ Γ₃.A, + (a = b ↔ a_star = b_star) → + (∀ x' : Set S, IsCorrespondingAtom (deleteVertices Γ₁ {v}) J a x' ↔ + IsCorrespondingAtom Γ₃ J a_star x') → + (∀ y' : Set S, IsCorrespondingAtom (deleteVertices Γ₁ {v}) J b y' ↔ + IsCorrespondingAtom Γ₃ J b_star y') → + d₃ a_star b_star = tangleMetric (deleteVertices Γ₁ {v}) J ins 2 a b) := by + have hT₃ := isTangle_induced_of_order_three hS hT₁ hv hresp hJ₂ hJ₃ hins hE₂ hE₃ + have hp₂ : IsPretangle (PaintingOrDrawing.drawing (deleteVertices Γ₁ {v})).toHypergraph 2 + (deleteVerticesTangle Γ₁.toHypergraph {v} T₁ 3) := + IsTangle.isPretangle (theorem_7_3_tangle (by decide) hT₁ hv) + have hsl := isSlope_of_derived hS hp₂ hJ₂.2.1.1 hins + obtain ⟨-, hr₃, hd₃⟩ := theorem_6_1_proof (Γ := PaintingOrDrawing.drawing Γ₃) hS hE₃ hJ₃ + (by norm_num) hsl + refine ⟨_, tangleMetric Γ₃ J ins 2, ⟨⟨hJ₃.1, hT₃, hr₃⟩, J, ins, hJ₃, hd₃, fun _ _ _ _ => rfl⟩, ?_⟩ + intro a _ b _ a_star _ b_star _ heq ha hb + exact tangleMetric_eq_of_correspondingAtom_iff heq ha hb + +/-- The vertex `v` of `K` in `r` has at most one spoke to each vertex of `Γ`, once no `O`-arc +through +one vertex in `r ∪ {v}` has an edge in its selected disc. This is where the paper's "`rBar - r` is +an +`O`-arc" is used. -/ +theorem unique_spokes_of_no_disc (hS : IsClosedSurface S) {Γ K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 2 ≤ θ) (hT : IsRespectfulDrawingTangle Γ θ T) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {r : Set S} (hr : r ∈ Γ.R) + (hno : ∀ Δ F : Set S, ∀ v : S, IsClosedDisc Δ → subBd Δ = F → + (PaintingOrDrawing.drawing Γ).IsNormal F → F ∩ Γ.V = {v} → + F \ {v} ⊆ r → + ((PaintingOrDrawing.drawing Γ).inter Δ, + (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T → + ∀ e ∈ Γ.E, ¬ e ⊆ Δ) + {v : S} (hvr : v ∈ r) (hvK : v ∈ K.V) : + ∀ g ∈ K.E, ∀ h ∈ K.E, ∀ c : S, c ∈ K.V → + closure g ∩ K.V = {v, c} → closure h ∩ K.V = {v, c} → g = h := by + intro g hg h hh c hc hcapg hcaph + by_contra hgh + obtain ⟨x, hx, y, hy, hxy⟩ := hK.2.1.2.2.2.2.1 g hg + have hvΓ : v ∉ Γ.V := fun h' => region_subset hr hvr (Γ.V_subset_U h') + have hxm : x ∈ closure g ∩ K.V := by rw [hxy]; simp + rw [hcapg] at hxm + have hxc : x = c := hxm.resolve_left fun h' => hvΓ (h' ▸ hx) + subst hxc + refine no_parallel_spokes_at_region_hub hS hθ hT hK.2.1 hr hno hx hg hh hgh hvr hvK ?_ ?_ + · rw [hcapg, pair_comm] + · rw [hcaph, pair_comm] + +/-- The chain of Case 2 of **(7.5)** (Graph Minors XII, page 265), for a drawing `Γ` in which no +`O`-arc through one vertex in `r ∪ {v}` has an edge in its selected disc. -/ +theorem theorem_7_5_case_2_chain (hS : IsClosedSurface S) {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {r : Set S} + (hθ : 3 ≤ θ) (hM : HasTangleMetric Γ θ T d) (hr : r ∈ Γ.R) + (hno : ∀ Δ F : Set S, ∀ v : S, IsClosedDisc Δ → subBd Δ = F → + (PaintingOrDrawing.drawing Γ).IsNormal F → F ∩ Γ.V = {v} → + F \ {v} ⊆ r → + ((PaintingOrDrawing.drawing Γ).inter Δ, + (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T → + ∀ e ∈ Γ.E, ¬ e ⊆ Δ) : + ∃ (Γ' : Drawing S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r' : Set S), + Γ'.IsSubdrawing (deleteVertices Γ {u ∈ Γ.V | u ∈ closure r}) ∧ + (PaintingOrDrawing.drawing Γ').IsTwoCell ∧ + HasTangleMetric Γ' (θ - 2) T' d' ∧ + r' ∈ Γ'.R ∧ r ⊆ r' ∧ + Γ.U ⊆ Γ'.U ∪ r' ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 4 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a r - 2 ≤ d' a r') ∧ + (∀ a ∈ Γ.A, a ⊆ r' → d a r ≤ 3) := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hT, K, ins, hK, hins, heq⟩ := id hM + have hE : Γ.E.Nonempty := edgeSet_nonempty_of_isTangle_of_two_le hT.2.1 (by omega) + -- The dual `Γ₁`, with `T₁`, `d₁` by (6.6). + obtain ⟨Γ₁, hK₁, hdual⟩ := exists_lineDual_of_radial hS hE hK + obtain ⟨_, _, _, _, _, _, _, _, _, _, _, _, hV₁, hE₁eq⟩ := id hdual + have hE₁ : Γ₁.E.Nonempty := by + rw [hE₁eq] + exact hE.image _ + obtain ⟨T₁, d₁, hM₁, hins₁, heq₁, hd₁⟩ := + exists_dual_tangleMetric_of_common_radial hS hθ hT hE₁ hK hK₁ hins + have hT₁ := hM₁.1 + -- The vertex `v = r*`, and `Γ₂ = Γ₁ \ v`, which is 2-cell. + obtain ⟨v, ⟨hvr, hvK⟩, -⟩ := hK.2.1.2.2.1 r hr + have hv₁ : v ∈ Γ₁.V := by + rw [hV₁] + exact ⟨hvK, fun h' => region_subset hr hvr (Γ.V_subset_U h')⟩ + have hspoke := unique_spokes_of_no_disc hS (by omega) hT hK hr hno hvr hvK + have hother : ∃ w ∈ Γ₁.V, w ≠ v := by + by_contra hn + push Not at hn + obtain ⟨e, he⟩ := hE₁ + have hheV : Γ₁.toHypergraph.ends e = Γ₁.toHypergraph.vertexSet := by + apply Subset.antisymm fun _ h => Γ₁.toHypergraph.vertex_mem_of_inc h + obtain ⟨y, hy⟩ := (drawing_toHypergraph_isGraph Γ₁ e he).1 + have hyv : y = v := hn y (Γ₁.toHypergraph.vertex_mem_of_inc hy) + intro w hw + have hwv : w = v := hn w hw + rw [hwv, ← hyv] + exact hy + have hsize : edgeSize Γ₁.toHypergraph e < θ := by + have := (drawing_toHypergraph_isGraph Γ₁ e he).2 + unfold edgeSize + omega + have hm := (GraphMinor.GM10.theorem_2_7_proof hT₁.2.1.one_le hT₁.2.1.isSeparation + hT₁.2.1.order_lt hT₁.2.1.axiom1 + hT₁.2.1.axiom2).mp hT₁.2.1 e he hsize + exact hT₁.2.1.axiom3 hm hheV + have htwo := isTwoCell_delete_vertex_of_unique_spokes hS hK₁ hv₁ hother hspoke + have hE₂ : (deleteVertices Γ₁ {v}).E.Nonempty := + edgeSet_nonempty_of_isTangle_of_two_le (theorem_7_3_tangle (by omega) hT₁.2.1 hv₁) (by omega) + have hvnot : v ∉ (deleteVertices Γ₁ {v}).U := by + intro hvU + have hvV := (isSubdrawing_U_inter_V (deleteVertices_isSubdrawing Γ₁ {v})).subset ⟨hvU, hv₁⟩ + exact ((deleteVertices_V Γ₁ {v}).subset hvV).2 rfl + obtain ⟨r₂, hr₂, hvr₂⟩ := exists_region_of_notMem hvnot + -- (7.3) on `Γ₁`. + have hunique : ∀ e ∈ K.E, ∀ g ∈ K.E, ∀ u : S, + K.toGraph.IsLink e v u → K.toGraph.IsLink g v u → e = g := fun e he g hg u h₁ h₂ => + hspoke e he g hg u h₁.2.2.1 h₁.2.2.2 h₂.2.2.2 + obtain ⟨D, f, H, J, ins₂, hc, hJ, hins₂, hm, -, hi, hii⟩ := + exists_starContraction_with_vertex_deletion_bounds_of_unique_spokes hS (by omega) hT₁ hins₁ hK₁ + hE₁ hv₁ htwo hE₂ hunique hr₂ hvr₂ + -- The dual `Γ₃` of `Γ₂`, with `T₃`, `d₃` by (6.6). + obtain ⟨Γ₃, hcd⟩ := exists_contracted_dual hS hE hK hK₁ hdual hr hvr hvK hr₂ hvr₂ hc hJ hE₂ + obtain ⟨T₃, d₃, hM₃, hd₃⟩ : ∃ (T₃ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₃ : Set S → Set S → ℕ), HasTangleMetric Γ₃ (θ - 1) T₃ d₃ ∧ + (∀ a ∈ (deleteVertices Γ₁ {v}).A, ∀ b ∈ (deleteVertices Γ₁ {v}).A, + ∀ a_star ∈ Γ₃.A, ∀ b_star ∈ Γ₃.A, + (a = b ↔ a_star = b_star) → + (∀ x' : Set S, IsCorrespondingAtom (deleteVertices Γ₁ {v}) J a x' ↔ + IsCorrespondingAtom Γ₃ J a_star x') → + (∀ y' : Set S, IsCorrespondingAtom (deleteVertices Γ₁ {v}) J b y' ↔ + IsCorrespondingAtom Γ₃ J b_star y') → + d₃ a_star b_star = tangleMetric (deleteVertices Γ₁ {v}) J ins₂ (θ - 1) a b) := by + by_cases h3 : θ = 3 + · subst h3 + exact exists_dual_tangleMetric_order_two hS hT₁.2.1 hv₁ hm.1.2.2 hJ hcd.radial hins₂ hE₂ + hcd.nonempty_E + · obtain ⟨T₃, d₃, h, -, -, hh⟩ := exists_dual_tangleMetric_of_common_radial hS (by omega) hm.1 + hcd.nonempty_E hJ hcd.radial hins₂ + exact ⟨T₃, d₃, h, hh⟩ + have hvA : ({v} : Set S) ∈ Γ₁.A := Or.inl (Or.inl ⟨v, hv₁, rfl⟩) + refine theorem_7_5_case_2 hS hθ hT hK heq hr hvr hvK hK₁ hdual hM₁ hd₁ hm hr₂ hvr₂ ?_ ?_ hJ + (fun _ _ _ _ => rfl) hcd hM₃ hd₃ + · intro a ha b hb + have := hi a ha b hb + rw [heq₁ a ha.1 b hb.1] + omega + · intro a ha + have := hii a ha + rw [heq₁ a ha.1 {v} hvA] + omega + +/-- **(7.5)** of Graph Minors XII (page 263). -/ +theorem theorem_7_5_proof : Theorem75Statement.{u} := by + intro S _ _ _ hS Γ θ T d r hθ hd hr + obtain ⟨Γ₀, T₀, d₀, r₀, -, hd₀, hr₀, hrr₀, hno, hlift⟩ := + exists_theorem_7_5_disc_reduction hS hθ hd hr + obtain ⟨Γ', T', d', r', h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈, h₉⟩ := + theorem_7_5_case_2_chain hS hθ hd₀ hr₀ hno + exact ⟨Γ', T', d', r', hlift Γ' T' d' r' h₁ h₂ h₃ h₄ h₅ h₆ h₇ h₈ h₉⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section75TwoCell.lean b/LeanPool/GraphMinor/GM12/Section75TwoCell.lean new file mode 100644 index 0000000000..be67fd9c8d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section75TwoCell.lean @@ -0,0 +1,227 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section2FreeSectorChord +public import LeanPool.GraphMinor.GM12.Section2SectorSpoke +public import LeanPool.GraphMinor.GM12.Section2SpokePaths +public import LeanPool.GraphMinor.GM12.Section74BaseCellularity +import LeanPool.GraphMinor.GM12.Section74CornerEdges +import LeanPool.GraphMinor.GM12.Section74FiniteGluing +import LeanPool.GraphMinor.GM12.Section74LeafTwoCell +import LeanPool.GraphMinor.GM12.Section74VertexWalk +import LeanPool.GraphMinor.GM12.Section78 +import LeanPool.GraphMinor.GM11.Section4b +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# Two-cellularity of `Γ₁ \ r*` in Case 2 of XII (7.5) + +In Case 2 of Graph Minors XII (7.5) (page 265), after the selected-disc reduction of Case 1, +`no_parallel_spokes_at_region_hub` ensures that the hub `v = r* ∈ V(Γ₁)` of `r ∈ R(Γ)` in the common +radial drawing `K` of `Γ` and its dual `Γ₁` has at most one spoke in `K` to each vertex `c ∈ V(Γ)` +(the hub in `K` of a region of `Γ₁`). + +By radial maximality of `K` as a radial drawing of `Γ₁`, each sector `Q k` of `Γ₁` at `v` is entered +by a spoke of `K` at `v` whose other end is the hub `c ∈ ρ k ∩ V(K)`. Uniqueness of spokes at `v` +therefore implies that `ρ` is injective at `v`, and the sector-gluing argument of +`Section74BaseCellularity.lean` yields that `Γ₂ = deleteVertices Γ₁ {v}` is a 2-cell drawing. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology Surface GM11 GM10 GM14 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- Every sector `Q k` at a vertex `v ∈ V(Γ)` of a 2-cell drawing `Γ` with radial drawing `K` is +entered by a spoke of `K` at `v` whose other end is the hub `c ∈ ρ k ∩ V(K)`. -/ +theorem exists_sector_spoke_of_radial (hS : IsClosedSurface S) + {Γ K : Drawing S} (hrad : PreRad (.drawing Γ) K) + (hmax : RadMax (.drawing Γ) K) (hE : Γ.E.Nonempty) + {γ η : Set S → I → S} (hη : EdgePar K η) {v : S} (hv : v ∈ Γ.V) + {next : halfEdges Γ γ v → halfEdges Γ γ v} + {ρ P Q : halfEdges Γ γ v → Set S} {W : Set S} + {τ : halfEdges Γ γ v → I} + (hsec : IsSectors Γ γ v next ρ P W Q τ) (k : halfEdges Γ γ v) + {c : S} (hc : c ∈ ρ k) (hcV : c ∈ K.V) : + ∃ (i : halfEdges K η v) (ε : I), 0 < ε ∧ + closure i.val.1 ∩ K.V = {v, c} ∧ + ∀ t, 0 < t → t ≤ ε → spoke η i.val t ∈ Q k \ discBd (Q k) := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hr : ρ k ∈ Γ.R := hsec.corners.region k + have hcover : W \ Γ.U ⊆ ⋃ j, Q j := fun x hx => by + obtain ⟨j, hj⟩ := mem_iUnion.mp (hsec.cover hx) + exact mem_iUnion.mpr ⟨j, hsec.subQ j hj⟩ + have hoff : ∀ i : halfEdges K η v, ∀ t : I, 0 < t → spoke η i.val t ∉ Γ.U := by + intro i t ht hΓ + have he : spoke η i.val t ∈ i.val.1 := spoke_mem_edge hη i.property.1 ht + have hKV : spoke η i.val t ∈ K.V := radial_V hrad + (radial_inter hrad ▸ ⟨hΓ, K.closure_subset_U i.property.1 (subset_closure he)⟩) + exact edge_notMem_V i.property.1 he hKV + have hregion : (Q k \ discBd (Q k)) ∩ W ⊆ ρ k := by + rintro z ⟨⟨hzQ, hzbd⟩, hzW⟩ + exact hsec.sub k (hsec.inside k ⟨⟨hzW, hzQ⟩, hzbd⟩) + rcases sector_spoke_or_free_neighbourhood hη hv (radial_V hrad hv) hsec hcover hoff k with + ⟨i, ε, hε, hεQ⟩ | ⟨O, hO, hvO, hfree⟩ + · have hgi : Continuous (spoke η i.val) := + (hη.cont i.val.1 i.property.1).comp (continuous_halfPar i.val.2) + have hgi0 : spoke η i.val 0 = v := by rw [spoke_zero]; exact i.property.2 + obtain ⟨δ, hδ, hδε, hδW⟩ := exists_pos_le hgi hsec.isOpen (hgi0.symm ▸ hsec.mem) hε + have hδr : spoke η i.val δ ∈ ρ k := hregion ⟨hεQ δ hδ hδε, hδW δ le_rfl⟩ + have hcap := spoke_ends_of_halfEdge_point hS hrad hη hv i hr hc hcV hδ hδr + exact ⟨i, δ, hδ, hcap, fun t ht htδ => hεQ t ht (htδ.trans hδε)⟩ + · exfalso + obtain ⟨e, he, hcap, u, hu, hui, hu0, _, _, ⟨N, hN, hvN, hNgerm⟩, Δ, hΔ, hΔr, hbd⟩ := + exists_parallel_spoke_at_free_sector hS hrad hmax hE hv hsec k hc hcV hO hvO hfree + have hb : discBd Δ = closure e ∪ range u := + (IsClosedDisc.frontier_eq_discBd hS hΔ).symm.trans ((subBd_eq_frontier Δ).symm.trans hbd) + have hve : v ∈ closure e := (hcap.superset (Or.inl rfl)).1 + have hvb : v ∈ discBd Δ := hb ▸ Or.inl hve + have hΔfree : Disjoint (Δ \ discBd Δ) Γ.U := by + refine disjoint_left.mpr fun y hy hyU => ?_ + rcases hΔr hy.1 with hyr | hyv + · exact region_subset hr hyr hyU + · exact hy.2 (hyv.symm ▸ hvb) + have hWN : IsOpen (W ∩ N) := hsec.isOpen.inter hN + obtain ⟨A, W₀, hW₀, hvW₀, hAc, hAΔ, hAb, hAX, -, hclA⟩ := + exists_half_nbhd hΔ hWN.isClosed_compl hvb (fun h' => h' ⟨hsec.mem, hvN⟩) + have hAW : ∀ y ∈ A, y ∈ W ∩ N := fun y hy => by + by_contra hn + exact disjoint_left.mp hAX hy hn + have hAU : ∀ y ∈ A, y ∉ Γ.U := fun y hy hyU => + disjoint_left.mp hΔfree ⟨hAΔ hy, disjoint_left.mp hAb hy⟩ hyU + have hQd := hsec.disc k + have hAfr : Disjoint A (frontier (Q k)) := by + rw [IsClosedDisc.frontier_eq_discBd hS hQd] + exact disjoint_left.mpr fun y hy hyb => hAU y hy (hsec.bdU k ⟨(hAW y hy).1, hyb⟩) + obtain ⟨t, ht, hutW⟩ := exists_pos_mem hu (hW₀.inter hN) (by rw [hu0]; exact ⟨hvW₀, hvN⟩) + have hzcl : u t ∈ closure A := hclA ⟨hutW.1, hb ▸ Or.inr ⟨t, rfl⟩⟩ + obtain ⟨hzQ, hzb⟩ := hNgerm t ht hutW.2 + have hzint : u t ∈ interior (Q k) := by + have hnf : u t ∉ frontier (Q k) := by + rwa [IsClosedDisc.frontier_eq_discBd hS hQd] + by_contra hni + exact hnf ⟨subset_closure hzQ, hni⟩ + have hAQ : A ⊆ Q k := by + rcases subset_or_disjoint_of_frontier hQd.isClosed hAc hAfr with h' | h' + · exact h' + · obtain ⟨y, hyI, hyA⟩ := mem_closure_iff.mp hzcl _ isOpen_interior hzint + exact (disjoint_left.mp h' hyA (interior_subset hyI)).elim + have hclQ : closure A ⊆ Q k := closure_minimal hAQ hQd.isClosed + obtain ⟨b, hbv⟩ := exists_end_eq hη he (radial_V hrad hv) hve + let i : halfEdges K η v := ⟨(e, b), he, hbv⟩ + have hgi : Continuous (spoke η i.val) := + (hη.cont i.val.1 i.property.1).comp (continuous_halfPar i.val.2) + have hgi0 : spoke η i.val 0 = v := by rw [spoke_zero]; exact hbv + obtain ⟨s', hs', hsW⟩ := exists_pos_mem hgi (hW₀.inter hO) (by rw [hgi0]; exact ⟨hvW₀, hvO⟩) + have hmem : spoke η i.val s' ∈ closure e := subset_closure (spoke_mem_edge hη i.property.1 hs') + have hsQ : spoke η i.val s' ∈ Q k := hclQ (hclA ⟨hsW.1, hb ▸ Or.inl hmem⟩) + have hsK : spoke η i.val s' ∈ K.U := K.closure_subset_U he hmem + exact disjoint_left.mp hfree ⟨⟨hsW.2, hsQ⟩, hoff i s' hs'⟩ hsK + +/-- If `K` is a radial drawing of `Γ` and has at most one spoke between `v ∈ V(Γ)` and any hub +`c ∈ V(K)`, then the corner-region map `ρ` of any sector system of `Γ` at `v` is injective. -/ +theorem corner_regions_injective_of_unique_spokes (hS : IsClosedSurface S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hE : Γ.E.Nonempty) {v : S} (hv : v ∈ Γ.V) + (hunique : ∀ g ∈ K.E, ∀ h ∈ K.E, ∀ c : S, c ∈ K.V → + closure g ∩ K.V = {v, c} → closure h ∩ K.V = {v, c} → g = h) + {γ : Set S → I → S} + {next : halfEdges Γ γ v → halfEdges Γ γ v} + {ρ P Q : halfEdges Γ γ v → Set S} {W : Set S} {τ : halfEdges Γ γ v → I} + (hsec : IsSectors Γ γ v next ρ P W Q τ) : Function.Injective ρ := by + intro k k' hρ + by_contra hkk + have : Nonempty S := ⟨v⟩ + obtain ⟨η, hη⟩ := exists_edgePar K + have hrad : PreRad (.drawing Γ) K := ⟨hK.1, hK.2.1⟩ + have hmax : RadMax (.drawing Γ) K := hK.2.2 + have hr : ρ k ∈ Γ.R := hsec.corners.region k + obtain ⟨c, ⟨hc, hcV⟩, -⟩ := hrad.2.2.2.1 (ρ k) hr + obtain ⟨i, ε, hε, hcap, hεQ⟩ := + exists_sector_spoke_of_radial hS hrad hmax hE hη hv hsec k hc hcV + obtain ⟨i', ε', hε', hcap', hε'Q⟩ := + exists_sector_spoke_of_radial hS hrad hmax hE hη hv hsec k' (hρ ▸ hc) hcV + have heq_edge : i.val.1 = i'.val.1 := + hunique i.val.1 i.property.1 i'.val.1 i'.property.1 c hcV hcap hcap' + have hvc : c ≠ v := fun h => region_subset hr (h ▸ hc) (Γ.V_subset_U hv) + have hcap_cv : closure i.val.1 ∩ K.V = {c, v} := hcap.trans (pair_comm v c) + have hii' : i = i' := + (halfedge_eq_of_same_nonloop_edge hη i i' hvc hcap_cv heq_edge.symm).symm + subst hii' + let t : I := min ε ε' + have ht : 0 < t := lt_min hε hε' + have htQ : spoke η i.val t ∈ Q k := (hεQ t ht (min_le_left _ _)).1 + have htQ' : spoke η i.val t ∈ Q k' := (hε'Q t ht (min_le_right _ _)).1 + have htΓ : spoke η i.val t ∈ Γ.U := hsec.inter k k' hkk ⟨htQ, htQ'⟩ + have he : spoke η i.val t ∈ i.val.1 := spoke_mem_edge hη i.property.1 ht + have hKV : spoke η i.val t ∈ K.V := radial_V hrad + (radial_inter hrad ▸ ⟨htΓ, K.closure_subset_U i.property.1 (subset_closure he)⟩) + exact edge_notMem_V i.property.1 he hKV + +/-- If `Γ` is a 2-cell drawing with radial drawing `K`, `v ∈ V(Γ)` is not the only vertex of `Γ`, +and `K` has at most one spoke from `v` to each hub `c ∈ V(K)`, then `deleteVertices Γ {v}` is a +2-cell drawing. -/ +theorem isTwoCell_delete_vertex_of_unique_spokes (hS : IsClosedSurface S) + {Γ K : Drawing S} (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + {v : S} (hv : v ∈ Γ.V) (hother : ∃ w ∈ Γ.V, w ≠ v) + (hunique : ∀ g ∈ K.E, ∀ h ∈ K.E, ∀ c : S, c ∈ K.V → + closure g ∩ K.V = {v, c} → closure h ∩ K.V = {v, c} → g = h) : + (PaintingOrDrawing.drawing (deleteVertices Γ {v})).IsTwoCell := by + obtain ⟨w, hw, hwv⟩ := hother + classical + have hpre : IsPreconnected Γ.U := isPreconnected_U_of_isTwoCell hS hK.1 + obtain ⟨W⟩ := exists_walk_of_isPreconnected_U hpre hv hw + obtain ⟨P, hP, _, _⟩ := GraphWalk.exists_isSimple W + have hex : ∃ (e : Set S) (u : S), e ∈ Γ.E ∧ u ∈ Γ.V ∧ u ≠ v ∧ + closure e ∩ Γ.V = {u, v} ∧ IsLineWithEnds (closure e) u v := by + cases P with + | nil _ => exact (hwv rfl).elim + | @cons _ u _ e hl R => + have hvu : v ≠ u := by + intro heq + exact (List.nodup_cons.mp hP).1 + ((congrArg (fun x => x ∈ R.support) heq.symm).mp R.start_mem_support) + exact ⟨e, u, hl.1, hl.2.2.1, hvu.symm, hl.2.2.2.trans (pair_comm v u), + Surface.IsLineWithEnds.symm (isLine_closure hl.1 hvu hl.2.2.2)⟩ + obtain ⟨e, u, he, _, huv, hcap, hLine⟩ := hex + have hE : Γ.E.Nonempty := ⟨e, he⟩ + let : Nonempty S := ⟨v⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar Γ + have hvCap : v ∈ closure e ∩ Γ.V := hcap.symm ▸ (Or.inr rfl : v ∈ ({u, v} : Set S)) + obtain ⟨b, hb⟩ := exists_end_eq hγ he hv hvCap.1 + let keep : halfEdges Γ γ v := ⟨(e, b), he, hb⟩ + have hkeep : ∀ k : halfEdges Γ γ v, k.1.1 = keep.1.1 → k = keep := + fun k hk => halfedge_eq_of_same_nonloop_edge hγ keep k huv hcap hk + by_cases h2 : 2 ≤ Nat.card (halfEdges Γ γ v) + · obtain ⟨next, ρ, P, W, Q, τ, hsec⟩ := exists_sectors hS Γ hγ hv h2 + have hρ := corner_regions_injective_of_unique_spokes hS hK hE hv hunique hsec + have hEdges := corner_edges_injective_of_single_fibre hsec.corners hρ keep hkeep + exact isTwoCell_delete_vertex_of_corner_data hS hK.1 hγ hv hsec.corners hρ hEdges keep huv hcap + hLine + · let α := halfEdges Γ γ v + let : Finite α := (finite_halfEdges Γ γ v).to_subtype + let : Nonempty α := ⟨keep⟩ + have hpos : 0 < Nat.card α := Nat.card_pos + have hOne : Nat.card α = 1 := by change ¬ 2 ≤ Nat.card α at h2; omega + let : Subsingleton α := (Nat.card_eq_one_iff_unique.mp hOne).1 + have hleaf : ∀ f ∈ Γ.E, f ≠ e → v ∉ closure f := by + intro f hf hfe hvf + obtain ⟨c, hc⟩ := exists_end_eq hγ hf hv hvf + let k : α := ⟨(f, c), hf, hc⟩ + have hk : k = keep := Subsingleton.elim _ _ + exact hfe (congrArg (fun j : α => j.1.1) hk) + exact isTwoCell_delete_leaf hS hK.1 he huv hcap hLine hleaf + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section76.lean b/LeanPool/GraphMinor/GM12/Section76.lean new file mode 100644 index 0000000000..a1df40aaaa --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section76.lean @@ -0,0 +1,267 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.GM11.Section64 +import LeanPool.GraphMinor.GM11.Section91 +import LeanPool.GraphMinor.GM11.CitedResults + +/-! +# Graph Minors XII, (7.6): deleting vertices near a region + +This file defines vertex deletion and proves the metric comparison used in **(7.6)** of +Graph Minors XII (page 266). The main induction is in `Section7Proved.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Function Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-! ## 1. Vertex deletion in a drawing -/ + +omit [T2Space S] in +/-- `Γ \ Z`, the subdrawing of `Γ` obtained by deleting a set `Z` of vertices and all edges incident +with `Z` (Graph Minors XII, Section 7, pages 261–268). -/ +def deleteVertices (Γ : Drawing S) (Z : Set S) : Drawing S := + Γ.span (Γ.V \ Z) {e ∈ Γ.E | Disjoint (closure e ∩ Γ.V) Z} + +theorem deleteVertices_isSubdrawing (Γ : Drawing S) (Z : Set S) : + (deleteVertices Γ Z).IsSubdrawing Γ := + Γ.span_isSubdrawing _ _ + +theorem deleteVertices_E (Γ : Drawing S) (Z : Set S) : + (deleteVertices Γ Z).E = {e ∈ Γ.E | Disjoint (closure e ∩ Γ.V) Z} := by + rw [deleteVertices, Drawing.span_E] + ext e + simp only [mem_inter_iff, mem_ofPred_eq, and_iff_left_iff_imp] + exact fun h => h.1 + +theorem deleteVertices_V (Γ : Drawing S) (Z : Set S) : + (deleteVertices Γ Z).V = Γ.V \ Z := by + rw [deleteVertices, Drawing.span_V, Drawing.spanV] + ext x + simp only [mem_inter_iff, mem_union, mem_sdiff, mem_iUnion, exists_prop] + constructor + · rintro (⟨⟨hxV, hxZ⟩, _⟩ | ⟨e, ⟨⟨_, hdisj⟩, _⟩, hxe, hxV⟩) + · exact ⟨hxV, hxZ⟩ + · exact ⟨hxV, disjoint_left.mp hdisj ⟨hxe, hxV⟩⟩ + · rintro ⟨hxV, hxZ⟩ + exact Or.inl ⟨⟨hxV, hxZ⟩, hxV⟩ + +theorem isSubdrawing_deleteVertices_iff {Γ Γ' : Drawing S} {Z : Set S} : + Γ'.IsSubdrawing (deleteVertices Γ Z) ↔ Γ'.IsSubdrawing Γ ∧ Disjoint Γ'.V Z := by + constructor + · intro h + refine ⟨h.trans (deleteVertices_isSubdrawing Γ Z), ?_⟩ + rw [disjoint_iff_inter_eq_empty] + ext x + simp only [mem_inter_iff, mem_empty_iff_false, iff_false, not_and] + intro hxV' hxZ + have hx : x ∈ Γ.V \ Z := deleteVertices_V Γ Z ▸ h.1 hxV' + exact hx.2 hxZ + · rintro ⟨hSub, hDisj⟩ + refine ⟨?_, ?_⟩ + · intro x hx + rw [deleteVertices_V] + exact ⟨hSub.1 hx, disjoint_left.mp hDisj hx⟩ + · rw [deleteVertices_E] + intro e he + refine ⟨hSub.2 he, ?_⟩ + rw [← hSub.closure_inter_V he] + exact Disjoint.mono_left inter_subset_right hDisj + +/-! ## 2. Atom dichotomy when `Γ.U ⊆ Γ'.U ∪ r'` -/ + +omit [T2Space S] in +/-- If `r` is a region of `Γ` and `r'` is a region of a subdrawing `Γ'` of `Γ` with `r ∩ r'` +nonempty, then `r ⊆ r'`. -/ +theorem region_subset_region_of_inter_nonempty {Γ Γ' : Drawing S} + (hSub : Γ'.IsSubdrawing Γ) {r r' : Set S} (hr : r ∈ Γ.R) (hr' : r' ∈ Γ'.R) + (hne : (r ∩ r').Nonempty) : r ⊆ r' := by + obtain ⟨x, hxr, hxr'⟩ := hne + obtain ⟨a', ha', hra'⟩ := exists_atom_superset_of_isSubdrawing hSub (Or.inr hr) + have heq : a' = r' := atom_eq_of_inter_nonempty ha' (Or.inr hr') ⟨x, hra' hxr, hxr'⟩ + exact heq ▸ hra' + +omit [T2Space S] in +/-- If `Γ'` is a subdrawing of `Γ`, `r' ∈ Γ'.R`, and `Γ.U ⊆ Γ'.U ∪ r'`, then for any atom `a ∈ Γ.A` +and `a' ∈ Γ'.A` with `a ⊆ a'`, either `a = a'` (and `a ∈ Γ.A ∩ Γ'.A`) or `a' = r'` (and `a ⊆ r'`). +-/ +theorem atom_eq_or_eq_region_of_U_subset {Γ Γ' : Drawing S} + (hSub : Γ'.IsSubdrawing Γ) {r' : Set S} (hr' : r' ∈ Γ'.R) + (hU : Γ.U ⊆ Γ'.U ∪ r') {a a' : Set S} (ha : a ∈ Γ.A) (ha' : a' ∈ Γ'.A) + (haa' : a ⊆ a') : + (a = a' ∧ a ∈ Γ.A ∩ Γ'.A) ∨ (a' = r' ∧ a ⊆ r') := by + obtain ⟨x, hxa⟩ := atom_nonempty' ha + rcases ha with (⟨v, hv, rfl⟩ | haE) | haR + · rcases hU (Γ.V_subset_U hv) with hvU' | hvr' + · have hvV' : v ∈ Γ'.V := (isSubdrawing_U_inter_V hSub).subset ⟨hvU', hv⟩ + have hvA' : ({v} : Set S) ∈ Γ'.A := Or.inl (Or.inl ⟨v, hvV', rfl⟩) + have heq : {v} = a' := atom_eq_of_inter_nonempty hvA' ha' ⟨v, rfl, haa' rfl⟩ + exact Or.inl ⟨heq, Or.inl (Or.inl ⟨v, hv, rfl⟩), hvA'⟩ + · have heq : a' = r' := atom_eq_of_inter_nonempty ha' (Or.inr hr') ⟨v, haa' rfl, hvr'⟩ + exact Or.inr ⟨heq, heq ▸ haa'⟩ + · by_cases haE' : a ∈ Γ'.E + · have heq : a = a' := + atom_eq_of_inter_nonempty (Or.inl (Or.inr haE')) ha' ⟨x, hxa, haa' hxa⟩ + exact Or.inl ⟨heq, Or.inl (Or.inr haE), Or.inl (Or.inr haE')⟩ + · have hxr' : x ∈ r' := by + rcases hU (haE.2.1 hxa).1 with hxU' | hxr' + · by_cases hxV' : x ∈ Γ'.V + · exact ((haE.2.1 hxa).2 (hSub.1 hxV')).elim + · obtain ⟨e', he', hxe'⟩ := Γ'.exists_edge_of_mem hxU' hxV' + have heq : a = e' := atom_eq_of_inter_nonempty (Or.inl (Or.inr haE)) + (Or.inl (Or.inr (hSub.2 he'))) ⟨x, hxa, hxe'⟩ + exact (haE' (heq ▸ he')).elim + · exact hxr' + have heq : a' = r' := atom_eq_of_inter_nonempty ha' (Or.inr hr') ⟨x, haa' hxa, hxr'⟩ + exact Or.inr ⟨heq, heq ▸ haa'⟩ + · have ha'R : a' ∈ Γ'.R := by + rcases ha' with (⟨v, hv', rfl⟩ | ha'E) | ha'R + · exact (region_subset haR hxa (Γ.V_subset_U (hSub.1 (mem_singleton_iff.mp + (haa' hxa) ▸ hv')))).elim + · exact (region_subset haR hxa ((hSub.2 ha'E).2.1 (haa' hxa)).1).elim + · exact ha'R + by_cases heq_r' : a' = r' + · exact Or.inr ⟨heq_r', heq_r' ▸ haa'⟩ + · have hdisj_r' : Disjoint a' r' := by + rw [disjoint_iff_inter_eq_empty] + by_contra hne + exact heq_r' (atom_eq_of_inter_nonempty (Or.inr ha'R) (Or.inr hr') + (nonempty_iff_ne_empty.mpr hne)) + have ha'_off : a' ⊆ univ \ Γ.U := by + intro y hya' + refine ⟨mem_univ y, fun hyU => ?_⟩ + rcases hU hyU with hyU' | hyr' + · exact region_subset ha'R hya' hyU' + · exact disjoint_left.mp hdisj_r' hya' hyr' + have ha'_sub_a : a' ⊆ a := by + have hconn : IsPreconnected a' := region_isPreconnected ha'R + have hsub := hconn.subset_connectedComponentIn (haa' hxa) ha'_off + have hx_eq : connectedComponentIn (univ \ Γ.U) x ∈ Γ.R := + (mem_R_iff Γ).mpr ⟨x, (ha'_off (haa' hxa)).2, rfl⟩ + have heq_a : a = connectedComponentIn (univ \ Γ.U) x := + atom_eq_of_inter_nonempty (Or.inr haR) (Or.inr hx_eq) + ⟨x, hxa, mem_connectedComponentIn (ha'_off (haa' hxa))⟩ + exact heq_a.symm ▸ hsub + have heq : a = a' := Subset.antisymm haa' ha'_sub_a + exact Or.inl ⟨heq, Or.inr haR, Or.inr (heq.symm ▸ ha'R)⟩ + +/-! ## 3. Statement of (7.5) and Proof of (7.6) -/ + +/-- **(7.5)** of Graph Minors XII (pages 263–264): +"(7.5) *Let $\mathscr{T}$ be a respectful tangle of order $\theta \ge 3$ in a 2-cell drawing +$\Gamma$ in a connected surface $\Sigma$, and let its metric be $d$. Let $r$ be a region of +$\Gamma$, and let $Z$ be the set of vertices of $\Gamma$ incident with $r$. Then there is a 2-cell* +... +subdrawing $\Gamma'$ of $\Gamma \setminus Z$, and a respectful tangle $\mathscr{T}'$ of order +$\theta - 2$ in $\Gamma'$, with metric $d'$, such that if $r'$ is the region of $\Gamma'$ with +$r \subseteq r'$, then +$$ +\begin{aligned} +\text{(i)} \quad & U(\Gamma) \subseteq U(\Gamma') \cup r' \\ +\text{(ii)} \quad & d'(a, b) \ge d(a, b) - 4 \text{ for all } a, b \in A(\Gamma) \cap A(\Gamma') \\ +\text{(iii)} \quad & d'(a, r') \ge d(a, r) - 2 \text{ for all } a \in A(\Gamma) \cap A(\Gamma'), +\text{ and} \\ +\text{(iv)} \quad & d(a, r) \le 3 \text{ for all } a \in A(\Gamma) \text{ with } a \subseteq r'. +\end{aligned} +$$" -/ +def Theorem75Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T2Space S] [ConnectedSpace S], + IsClosedSurface S → + ∀ (Γ : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Set S), + 3 ≤ θ → + HasTangleMetric Γ θ T d → + r ∈ Γ.R → + ∃ (Γ' : Drawing S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r' : Set S), + Γ'.IsSubdrawing (deleteVertices Γ {v ∈ Γ.V | v ∈ closure r}) ∧ + (PaintingOrDrawing.drawing Γ').IsTwoCell ∧ + HasTangleMetric Γ' (θ - 2) T' d' ∧ + r' ∈ Γ'.R ∧ r ⊆ r' ∧ + Γ.U ⊆ Γ'.U ∪ r' ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 4 ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a r - 2 ≤ d' a r') ∧ + (∀ a ∈ Γ.A, a ⊆ r' → d a r ≤ 3) + +/-- The set `Z` of vertices of `Γ` within normal-line distance `k` of a region `r` +(Graph Minors XII, (7.6), page 266): the vertices `v` of `Γ` such that there is a `Γ`-normal line +`F` with `v ∈ F`, `F ∩ r ≠ ∅`, and `|F ∩ V(Γ)| ≤ k`. -/ +def regionLineVertices (Γ : Drawing S) (r : Set S) (k : ℕ) : Set S := + {v ∈ Γ.V | ∃ F : Set S, IsLine F ∧ (PaintingOrDrawing.drawing Γ).IsNormal F ∧ + v ∈ F ∧ (F ∩ r).Nonempty ∧ (F ∩ Γ.V).ncard ≤ k} + +/-- The "In particular" deduction of **(7.6)** (page 266): conditions `(i)`–`(iv)` imply +`d'(a', b') ≥ d(a, b) - 4k - 2` for all `a, b ∈ A(Γ)` and `a', b' ∈ A(Γ')` with `a ⊆ a'` and +`b ⊆ b'`. -/ +theorem theorem_7_6_in_particular + (hS : IsClosedSurface S) [ConnectedSpace S] + {Γ Γ' : Drawing S} {θ θ' k : ℕ} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {r r' : Set S} + (hd : HasTangleMetric Γ θ T d) + (hd' : HasTangleMetric Γ' θ' T' d') + (hSub : Γ'.IsSubdrawing Γ) + (hr : r ∈ Γ.R) (hr' : r' ∈ Γ'.R) + (h_i : Γ.U ⊆ Γ'.U ∪ r') + (h_ii : ∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 4 * k ≤ d' a b) + (h_iii : ∀ a ∈ Γ.A ∩ Γ'.A, d a r - 2 * k ≤ d' a r') + (h_iv : ∀ a ∈ Γ.A, a ⊆ r' → d a r ≤ 2 * k + 1) + {a b a' b' : Set S} (ha : a ∈ Γ.A) (hb : b ∈ Γ.A) + (ha' : a' ∈ Γ'.A) (hb' : b' ∈ Γ'.A) + (haa' : a ⊆ a') (hbb' : b ⊆ b') : + d a b - 4 * k - 2 ≤ d' a' b' := by + obtain ⟨_, _, _, hsym, htri, _, _⟩ := GM11.gm15_theorem_9_1 Γ θ T d hS inferInstance hd + obtain ⟨_, _, _, hsym', _, _, _⟩ := GM11.gm15_theorem_9_1 Γ' θ' T' d' hS inferInstance hd' + have hrA : r ∈ Γ.A := Or.inr hr + have hr'A : r' ∈ Γ'.A := Or.inr hr' + rcases atom_eq_or_eq_region_of_U_subset hSub hr' h_i ha ha' haa' with + ⟨ha_eq, ha_mem⟩ | ⟨ha'_eq, har'⟩ + · rw [← ha_eq] + rcases atom_eq_or_eq_region_of_U_subset hSub hr' h_i hb hb' hbb' with + ⟨hb_eq, hb_mem⟩ | ⟨hb'_eq, hbr'⟩ + · rw [← hb_eq] + have h := h_ii a ha_mem b hb_mem + omega + · rw [hb'_eq] + have h1 := h_iii a ha_mem + have h2 := h_iv b hb hbr' + have h3 := htri a ha r hrA b hb + have h4 := hsym b hb r hrA + omega + · rw [ha'_eq] + rcases atom_eq_or_eq_region_of_U_subset hSub hr' h_i hb hb' hbb' with + ⟨hb_eq, hb_mem⟩ | ⟨hb'_eq, hbr'⟩ + · rw [← hb_eq] + have h1 := h_iii b hb_mem + have h2 := h_iv a ha har' + have h3 := htri a ha r hrA b hb + have h4 := hsym' b hb_mem.2 r' hr'A + have h5 := hsym b hb r hrA + omega + · rw [hb'_eq] + have h1 := h_iv a ha har' + have h2 := h_iv b hb hbr' + have h3 := htri a ha r hrA b hb + have h4 := hsym b hb r hrA + omega + + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section77.lean b/LeanPool/GraphMinor/GM12/Section77.lean new file mode 100644 index 0000000000..85ad9aed5a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section77.lean @@ -0,0 +1,1014 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section1b +public import LeanPool.GraphMinor.GM12.Induced +public import LeanPool.GraphMinor.GM12.Section2CirclePeriod +public import LeanPool.GraphMinor.GM15.Cited +import LeanPool.GraphMinor.GM12.Section2Theorem +import LeanPool.GraphMinor.GM12.Section2TangleTraceExistence +import LeanPool.GraphMinor.GM12.Section2 +import LeanPool.GraphMinor.GM11.Section64 +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.Section91 +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.Surface.ArcTools +import Mathlib.Topology.Instances.AddCircle.Defs + +/-! +# Graph Minors XII, (7.7): comparing tangle metrics in a subdrawing + +This file formalizes **(7.7)** of Graph Minors XII (page 268) and its cited form +`GM15.GM12Theorem77Statement` using the proved `(2.1)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Function Topology unitInterval GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 Hypergraph + +universe u + +/-- **(2.1)** of Graph Minors XII (page 243), together with the existence of a trace of a normal +closed curve of finite length defined immediately before (2.1) on page 243: +"Let $\Gamma$ be a 2-cell drawing in a connected surface $\Sigma$, with a radial drawing $K$. +Let $\mathscr{T}$ be a respectful tangle in $\Gamma$ of order $\theta \ge 1$, let $\phi +\colon S^1 \to \Sigma$ be continuous, of length $<\theta$, such that $|\phi|$ is +$\Gamma$-normal, and let $W$ be a trace of $\phi$. Then $ins(W)$ is defined. Moreover, for +any atom $c$ of $\Gamma$, if there is an $O$-arc $F \subseteq |\phi|$ with $c \cap ins(F) +\ne \emptyset$, then $c \cap ins(W) \ne \emptyset$." -/ +def Theorem21Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T2Space S] [ConnectedSpace S], + IsClosedSurface S → + ∀ (Γ K : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (ins : Drawing S → Set S), + (PaintingOrDrawing.drawing Γ).IsRadialDrawing K → + 1 ≤ θ → + IsTangle Γ.toHypergraph θ T → + (PaintingOrDrawing.drawing Γ).IsRespectful θ T → + IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins → + ∀ φ : C(Circle, S), + IsNormalCurve Γ φ → + curveLength Γ φ < θ → + (∃ (u : S) (W : GraphWalk K.toGraph u u), IsTrace Γ K φ W) ∧ + ∀ (u : S) (W : GraphWalk K.toGraph u u), + IsTrace Γ K φ W → + W.length < 2 * θ ∧ + ∀ c ∈ Γ.A, ∀ F Δ : Set S, + IsOArc F → F ⊆ range φ → + IsClosedDisc Δ → subBd Δ = F → + ((PaintingOrDrawing.drawing Γ).inter Δ, + (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T → + (c ∩ Δ).Nonempty → + (c ∩ insWalk ins K W).Nonempty + +/-- XII (2.1), page 243, in the combined form used in Section 7. +The trace exists even at length zero. The atom assertion is the proved +trace theorem, applied to the disc selected by the tangle. -/ +theorem theorem_2_1_statement : Theorem21Statement.{u} := by + intro S _ _ _ hS Γ K θ T ins hK _ hT hrespect hd φ hn hlen + refine ⟨exists_trace_of_curveLength_lt_tangle_order hS hT hK hn hlen, ?_⟩ + intro v W hW + refine ⟨theorem_2_1_length hW hlen, ?_⟩ + intro c hc F Δ hF hFφ hΔ hbd hm hcΔ + exact (theorem_2_1_proof hS hT hrespect hK hd W hW hlen hF hFφ hΔ hbd hm hc hcΔ).2 + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-! ## 1. Helper lemmas on atoms, subdrawings, tangles, and metrics -/ + +omit [T2Space S] in +/-- Every atom of `Γ` is non-empty. -/ +theorem atom_nonempty' {Γ : Drawing S} {x : Set S} (hx : x ∈ Γ.A) : x.Nonempty := by + rcases hx with (⟨v, -, rfl⟩ | hx) | hx + · exact singleton_nonempty v + · exact hx.1 + · exact region_nonempty hx + +omit [T2Space S] in +/-- Distinct atoms of `Γ` are disjoint. -/ +theorem atom_eq_of_inter_nonempty {Γ : Drawing S} {a b : Set S} + (ha : a ∈ Γ.A) (hb : b ∈ Γ.A) (hne : (a ∩ b).Nonempty) : a = b := by + have hatom : ∀ c ∈ Γ.A, IsGammaNice Γ c := fun c hc => ⟨{c}, by simpa using hc, by simp⟩ + exact Subset.antisymm (nice_atom (hatom b hb) ha hne) + (nice_atom (hatom a ha) hb (inter_comm a b ▸ hne)) + +omit [T2Space S] in +/-- In a radial drawing `K` of `H`, every atom of `H` has a unique corresponding atom in `K`. -/ +theorem existsUnique_correspondingAtom' {H K : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) {x : Set S} (hx : x ∈ H.A) : + ∃! x' : Set S, IsCorrespondingAtom H K x x' := by + exact GM12.existsUnique_correspondingAtom hK hx + +/-- Any hypergraph admitting a tangle of order `θ ≥ 2` has at least one edge. -/ +theorem edgeSet_nonempty_of_isTangle_of_two_le {α β : Type*} {G : Hypergraph α β} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} (hT : IsTangle G θ T) (hθ : 2 ≤ θ) : + G.edgeSet.Nonempty := + GM10.IsTangle.edgeSet_nonempty_of_two_le hT hθ + +/-- Unconditional version of `exists_edge_dist_eq_theta`, using the proved theorems +`GM11.gm14_theorem_8_12` and `GM11.gm12_theorem_8_5`. -/ +theorem exists_edge_dist_eq_theta_uncond (hS : IsClosedSurface S) [ConnectedSpace S] + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hMetric : HasTangleMetric H θ T d) (hE : H.E.Nonempty) + {z : Set S} (hz : z ∈ H.A) (hzE : 2 ≤ H.E.ncard ∨ z ∉ H.E) : + ∃ e ∈ H.E, d z e = θ := by + exact exists_edge_dist_eq_theta_of_metric hS inferInstance hMetric hE hz hzE + +/-- A walk of length `0` has `insWalk ins K W = {u}`. -/ +theorem insWalk_eq_singleton_of_length_zero {K : Drawing S} + {ins : Drawing S → Set S} {u : S} (W : GraphWalk K.toGraph u u) (hW0 : W.length = 0) : + insWalk ins K W = {u} := by + have hEdges : W.edges = [] := List.length_eq_zero_iff.mp hW0 + have hSupp : W.support = [u] := by + cases W with + | nil _ => rfl + | cons _ _ => simp [GraphWalk.length, GraphWalk.edges] at hW0 + have hV : (walkDrawing K W).V = {u} := by + rw [walkDrawing_V, hSupp] + ext x + simp + have hE : (walkDrawing K W).E = ∅ := by + rw [walkDrawing_E, hEdges] + ext e + simp + have hU : (walkDrawing K W).U = {u} := by + rw [Drawing.U_eq, hV, hE] + simp + unfold insWalk insOf + rw [hU] + refine Subset.antisymm ?_ subset_union_left + rintro x (hx | hx) + · exact hx + · obtain ⟨C, ⟨hC, hCs⟩, -⟩ := mem_iUnion₂.mp hx + exfalso + have hCU : C.U ⊆ {u} := hU ▸ hCs.U_subset + exact (infinite_of_isOArc (IsCircuit.isOArc_U hC)) ((finite_singleton u).subset hCU) + +/-- For a respectful tangle metric `d` of order `θ`, `d a b = 0` if and only if `a = b`. -/ +theorem tangleMetric_eq_zero_iff (hS : IsClosedSurface S) + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hd : HasTangleMetric Γ θ T d) + {a b : Set S} (ha : a ∈ Γ.A) (hb : b ∈ Γ.A) : + d a b = 0 ↔ a = b := by + refine ⟨fun h0 => ?_, fun h => h ▸ metric_self hd ha⟩ + by_contra hab + obtain ⟨hResp, K, ins, hK, hSlope, hd_eq⟩ := hd + have hθ1 : 1 ≤ θ := hResp.2.1.one_le + rw [hd_eq a ha b hb] at h0 + rcases GM11.tangleMetric_cases (ins := ins) (θ := θ) hK.2.1 hab with hθ | ⟨-, hwit⟩ + · omega + · rw [h0] at hwit + obtain ⟨u, W, x', y', hx', hy', hW, hW0, hxW, hyW⟩ := hwit + have haW : (a ∩ insWalk ins K W).Nonempty := + (corresponding_atom_subset_iff hS hK hSlope hx' W hW).mp hxW + have hbW : (b ∩ insWalk ins K W).Nonempty := + (corresponding_atom_subset_iff hS hK hSlope hy' W hW).mp hyW + rw [insWalk_eq_singleton_of_length_zero W (by omega)] at haW hbW + obtain ⟨y₁, hxa, hy₁⟩ := haW + obtain ⟨y₂, hxb, hy₂⟩ := hbW + rw [mem_singleton_iff.mp hy₁] at hxa + rw [mem_singleton_iff.mp hy₂] at hxb + exact hab (atom_eq_of_inter_nonempty ha hb ⟨u, hxa, hxb⟩) + +omit [T2Space S] in +/-- Every atom of a drawing `Γ` is contained in some atom of any subdrawing `Γ'`. -/ +theorem exists_atom_superset_of_isSubdrawing {Γ Γ' : Drawing S} + (hsub : Γ'.IsSubdrawing Γ) {a : Set S} (ha : a ∈ Γ.A) : + ∃ a' ∈ Γ'.A, a ⊆ a' := by + obtain ⟨x, hxa⟩ := atom_nonempty' ha + obtain ⟨a', ha', hxa'⟩ := GM11.exists_atom Γ' x + refine ⟨a', ha', ?_⟩ + rcases ha with (⟨v, hv, rfl⟩ | haE) | haR + · rw [mem_singleton_iff.mp hxa] at hxa' + exact singleton_subset_iff.mpr hxa' + · by_cases haE' : a ∈ Γ'.E + · have heq := atom_eq_of_inter_nonempty (Or.inl (Or.inr haE')) ha' ⟨x, hxa, hxa'⟩ + exact heq ▸ Subset.rfl + · have hoff : a ⊆ univ \ Γ'.U := by + intro y hya + refine ⟨mem_univ y, fun hyU' => ?_⟩ + by_cases hyV' : y ∈ Γ'.V + · exact (haE.2.1 hya).2 (hsub.1 hyV') + · obtain ⟨e', he', hye'⟩ := Γ'.exists_edge_of_mem hyU' hyV' + have he'Γ : e' ∈ Γ.E := hsub.2 he' + have heq := atom_eq_of_inter_nonempty (Or.inl (Or.inr haE)) + (Or.inl (Or.inr he'Γ)) ⟨y, hya, hye'⟩ + exact haE' (heq ▸ he') + have hr' : connectedComponentIn (univ \ Γ'.U) x ∈ Γ'.R := + (mem_R_iff Γ').mpr ⟨x, (hoff hxa).2, rfl⟩ + have heq := atom_eq_of_inter_nonempty (Or.inr hr') ha' + ⟨x, mem_connectedComponentIn (hoff hxa), hxa'⟩ + rw [← heq] + exact haE.2.2.1.isConnected.isPreconnected.subset_connectedComponentIn hxa hoff + · have hoff : a ⊆ univ \ Γ'.U := + fun y hya => ⟨mem_univ y, fun hyU' => region_subset haR hya (hsub.U_subset hyU')⟩ + have hr' : connectedComponentIn (univ \ Γ'.U) x ∈ Γ'.R := + (mem_R_iff Γ').mpr ⟨x, (hoff hxa).2, rfl⟩ + have heq := atom_eq_of_inter_nonempty (Or.inr hr') ha' + ⟨x, mem_connectedComponentIn (hoff hxa), hxa'⟩ + rw [← heq] + exact (region_isPreconnected haR).subset_connectedComponentIn hxa hoff + +omit [T2Space S] in +/-- If `Γ'` is a subdrawing of `Γ`, then `Γ'.U ∩ Γ.V = Γ'.V`. -/ +theorem isSubdrawing_U_inter_V {Γ Γ' : Drawing S} (hsub : Γ'.IsSubdrawing Γ) : + Γ'.U ∩ Γ.V = Γ'.V := by + refine Subset.antisymm ?_ (fun x hx => ⟨Γ'.V_subset_U hx, hsub.1 hx⟩) + rintro x ⟨hxU', hxV⟩ + by_cases hxV' : x ∈ Γ'.V + · exact hxV' + · obtain ⟨e', he', hxe'⟩ := Γ'.exists_edge_of_mem hxU' hxV' + exact absurd hxV ((hsub.2 he').2.1 hxe').2 + +omit [T2Space S] in +/-- A `Γ`-normal set `Z` is also `Γ'`-normal for any subdrawing `Γ'` of `Γ`. -/ +theorem isNormal_of_isSubdrawing {Γ Γ' : Drawing S} (hsub : Γ'.IsSubdrawing Γ) + {Z : Set S} (hZ : Γ.IsNormal Z) : Γ'.IsNormal Z := by + intro x ⟨hxZ, hxU'⟩ + have hxV : x ∈ Γ.V := hZ ⟨hxZ, hsub.U_subset hxU'⟩ + exact (isSubdrawing_U_inter_V hsub).subset ⟨hxU', hxV⟩ + +omit [T2Space S] in +/-- A `Γ`-normal curve of finite length is also a `Γ'`-normal curve of finite length for any +subdrawing `Γ'` of `Γ`, with `curveLength Γ' φ ≤ curveLength Γ φ`. -/ +theorem isNormalCurve_of_isSubdrawing {Γ Γ' : Drawing S} (hsub : Γ'.IsSubdrawing Γ) + {φ : C(Circle, S)} (hφ : IsNormalCurve Γ φ) : + IsNormalCurve Γ' φ ∧ curveLength Γ' φ ≤ curveLength Γ φ := by + have hsub_hits : {x : Circle | φ x ∈ Γ'.U} ⊆ {x : Circle | φ x ∈ Γ.U} := + fun x hx => hsub.U_subset hx + exact ⟨⟨hφ.1.subset hsub_hits, isNormal_of_isSubdrawing hsub hφ.2⟩, + ncard_le_ncard hsub_hits hφ.1⟩ + +omit [T2Space S] in +/-- If `Γ'` is a subdrawing of `Γ`, then `Γ'.toHypergraph ≤ Γ.toHypergraph`. -/ +theorem toHypergraph_le_of_isSubdrawing {Γ Γ' : Drawing S} (hsub : Γ'.IsSubdrawing Γ) : + Γ'.toHypergraph ≤ Γ.toHypergraph where + vertexSet_subset := hsub.1 + edgeSet_subset := hsub.2 + ends_eq e he := by + ext v + simp only [Hypergraph.ends, Drawing.toHypergraph, mem_ofPred_eq] + have hcl : closure e ∩ Γ'.V = closure e ∩ Γ.V := hsub.closure_inter_V he + constructor + · rintro ⟨-, hv, hve⟩ + have hv' : v ∈ Γ'.V := by + have : v ∈ closure e ∩ Γ.V := ⟨hve, hv⟩ + rw [← hcl] at this + exact this.2 + exact ⟨he, hv', hve⟩ + · rintro ⟨-, hv', hve⟩ + exact ⟨hsub.2 he, hsub.1 hv', hve⟩ + +omit [T2Space S] in +/-- Intersecting `(PaintingOrDrawing.drawing Γ).inter Δ` with `Γ'.toHypergraph` yields +`(PaintingOrDrawing.drawing Γ').inter Δ`. -/ +theorem drawing_inter_inter_subdrawing {Γ Γ' : Drawing S} (hsub : Γ'.IsSubdrawing Γ) + (Δ : Set S) : + ((PaintingOrDrawing.drawing Γ).inter Δ) ∩ Γ'.toHypergraph = + (PaintingOrDrawing.drawing Γ').inter Δ := by + have hle := toHypergraph_le_of_isSubdrawing hsub + ext x + · simp only [inter_vertexSet, PaintingOrDrawing.inter, PaintingOrDrawing.V, + Drawing.toHypergraph] + exact ⟨fun ⟨⟨_, hxΔ⟩, hxV'⟩ => ⟨hxV', hxΔ⟩, fun ⟨hxV', hxΔ⟩ => ⟨⟨hsub.1 hxV', hxΔ⟩, hxV'⟩⟩ + · simp only [inter_edgeSet, PaintingOrDrawing.inter, PaintingOrDrawing.E, + Drawing.toHypergraph, mem_inter_iff, mem_ofPred_eq] + exact ⟨fun ⟨⟨_, hxΔ⟩, hxE'⟩ => ⟨hxE', hxΔ⟩, fun ⟨hxE', hxΔ⟩ => ⟨⟨hsub.2 hxE', hxΔ⟩, hxE'⟩⟩ + · rename_i v + simp only [inter_inc, PaintingOrDrawing.inter, PaintingOrDrawing.toHypergraph, + Drawing.toHypergraph] + exact ⟨fun ⟨⟨_, hxΔ, hvΔ⟩, hinc'⟩ => ⟨hinc', hxΔ, hvΔ⟩, + fun ⟨hinc', hxΔ, hvΔ⟩ => ⟨⟨inc_of_le hle hinc', hxΔ, hvΔ⟩, hinc'⟩⟩ + +omit [T2Space S] in +/-- Intersecting `(PaintingOrDrawing.drawing Γ).interOutside Δ` with `Γ'.toHypergraph` yields +`(PaintingOrDrawing.drawing Γ').interOutside Δ`. -/ +theorem drawing_interOutside_inter_subdrawing {Γ Γ' : Drawing S} (hsub : Γ'.IsSubdrawing Γ) + (Δ : Set S) : + ((PaintingOrDrawing.drawing Γ).interOutside Δ) ∩ Γ'.toHypergraph = + (PaintingOrDrawing.drawing Γ').interOutside Δ := + drawing_inter_inter_subdrawing hsub (closure (univ \ Δ)) + +/-! ## 2. Atoms meeting the range of a curve meet the underlying set of its trace -/ + +/-- Along `TraceSteps Γ K f a b W`, `a ≤ b` and any atom `c ∈ Γ.A` meeting `f '' Icc a b` meets +`(walkDrawing K W).V`. -/ +theorem traceSteps_le_and_meets_walkDrawing_V {Γ K : Drawing S} {f : ℝ → S} + {a b : ℝ} {u v : S} (W : GraphWalk K.toGraph u v) (hW : TraceSteps Γ K f a b W) : + a ≤ b ∧ ∀ s ∈ Icc a b, ∀ c ∈ Γ.A, f s ∈ c → (c ∩ (walkDrawing K W).V).Nonempty := by + cases hWcase : W with + | nil hv => + rw [hWcase] at hW + obtain ⟨rfl, hfa, huΓ⟩ := hW + refine ⟨le_rfl, fun s hs c hc hfs => ?_⟩ + have hs_eq : s = a := le_antisymm hs.2 hs.1 + rw [hs_eq, hfa] at hfs + have hc_eq : c = {u} := + atom_eq_of_inter_nonempty hc (Or.inl (Or.inl ⟨u, huΓ, rfl⟩)) ⟨u, hfs, rfl⟩ + refine ⟨u, hc_eq ▸ mem_singleton u, ?_⟩ + rw [walkDrawing_V] + simp [GraphWalk.support] + | cons hl rest => + rw [hWcase] at hW + cases hrestcase : rest with + | nil hv => + rw [hrestcase] at hW + exact hW.elim + | cons hl₂ rest₂ => + rw [hrestcase] at hW + obtain ⟨d, had, hfa, huΓ, hfd, hwK, r, hr, hwr, hfr, _, _, ht⟩ := hW + obtain ⟨hdb, hmeet₂⟩ := traceSteps_le_and_meets_walkDrawing_V rest₂ ht + refine ⟨had.le.trans hdb, fun s hs c hc hfs => ?_⟩ + rcases lt_trichotomy s d with hsd | heq | hds + · rcases eq_or_lt_of_le hs.1 with rfl | has + · rw [hfa] at hfs + have hc_eq : c = {u} := + atom_eq_of_inter_nonempty hc (Or.inl (Or.inl ⟨u, huΓ, rfl⟩)) ⟨u, hfs, rfl⟩ + refine ⟨u, hc_eq ▸ mem_singleton u, ?_⟩ + rw [walkDrawing_V] + simp [GraphWalk.support] + · have hsr : f s ∈ r := hfr s ⟨has, hsd⟩ + have hc_eq : c = r := atom_eq_of_inter_nonempty hc (Or.inr hr) ⟨f s, hfs, hsr⟩ + refine ⟨_, hc_eq ▸ hwr, ?_⟩ + rw [walkDrawing_V] + simp [GraphWalk.support] + · subst heq + obtain ⟨z, hzc, hzV⟩ := hmeet₂ s ⟨le_rfl, hdb⟩ c hc hfs + refine ⟨z, hzc, ?_⟩ + rw [walkDrawing_V] at hzV ⊢ + exact List.mem_cons_of_mem _ (List.mem_cons_of_mem _ hzV) + · obtain ⟨z, hzc, hzV⟩ := hmeet₂ s ⟨hds.le, hs.2⟩ c hc hfs + refine ⟨z, hzc, ?_⟩ + rw [walkDrawing_V] at hzV ⊢ + exact List.mem_cons_of_mem _ (List.mem_cons_of_mem _ hzV) +termination_by W.length +decreasing_by + rw [hWcase, hrestcase] + simp only [GraphWalk.length, GraphWalk.edges, List.length_cons] + omega + +/-- If `W` is a trace of `φ` in `K` and `c ∈ Γ.A` meets `range φ`, then `c` meets +`(walkDrawing K W).U` (and hence `insWalk ins K W`). -/ +theorem meets_walkDrawing_of_isTrace {Γ K : Drawing S} {φ : C(Circle, S)} + {u : S} {W : GraphWalk K.toGraph u u} (hW : IsTrace Γ K φ W) + {c : Set S} (hc : c ∈ Γ.A) (hmeet : (c ∩ range φ).Nonempty) : + (c ∩ (walkDrawing K W).U).Nonempty := by + obtain ⟨z, hzc, x, rfl⟩ := hmeet + rcases hW.2 with ⟨-, -, huK, r, hr, hφr, hur⟩ | ⟨-, -, a, ht⟩ + · have hxr : φ x ∈ r := hφr (mem_range_self x) + have hc_eq : c = r := atom_eq_of_inter_nonempty hc (Or.inr hr) ⟨φ x, hzc, hxr⟩ + refine ⟨u, hc_eq ▸ hur, (walkDrawing K W).V_subset_U ?_⟩ + rw [walkDrawing_V] + exact W.start_mem_support + · obtain ⟨s, hs, hsx⟩ := (circle_parameter_bijOn a).surjOn (mem_univ x) + have hps : periodicCurve φ s = φ x := congrArg φ hsx + rw [← hps] at hzc + obtain ⟨_, hstep⟩ := traceSteps_le_and_meets_walkDrawing_V W ht + obtain ⟨w, hwc, hwV⟩ := hstep s (Ico_subset_Icc_self hs) c hc hzc + exact ⟨w, hwc, (walkDrawing K W).V_subset_U hwV⟩ + +/-! ## 3. Constructing normal closed curves from radial walks and from `O`-arcs -/ + +omit [T2Space S] in +/-- Any `Γ`-normal `O`-arc `F` admits a continuous parametrization `φ : C(Circle, S)` with +`range φ = F`, `IsNormalCurve Γ φ`, and `curveLength Γ φ = (F ∩ Γ.V).ncard`. -/ +theorem exists_closedCurve_of_isOArc {Γ : Drawing S} {F : Set S} + (hF : IsOArc F) (hnorm : Γ.IsNormal F) : + ∃ φ : C(Circle, S), + range φ = F ∧ IsNormalCurve Γ φ ∧ curveLength Γ φ = (F ∩ Γ.V).ncard := by + obtain ⟨e⟩ := hF + let φ : C(Circle, S) := ⟨fun z => (e z).1, continuous_subtype_val.comp e.continuous⟩ + have hrange : range φ = F := by + ext x + constructor + · rintro ⟨z, rfl⟩ + exact (e z).2 + · intro hx + exact ⟨e.symm ⟨x, hx⟩, by simp [φ]⟩ + have hinj : Function.Injective φ := fun x y hxy => e.injective (Subtype.ext hxy) + have hhit_eq : φ '' {z : Circle | φ z ∈ Γ.U} = F ∩ Γ.V := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + have hxF : φ z ∈ F := (e z).2 + exact ⟨hxF, hnorm ⟨hxF, hz⟩⟩ + · rintro ⟨hxF, hxV⟩ + refine ⟨e.symm ⟨x, hxF⟩, ?_, by simp [φ]⟩ + change φ (e.symm ⟨x, hxF⟩) ∈ Γ.U + have : φ (e.symm ⟨x, hxF⟩) = x := by simp [φ] + rw [this] + exact Γ.V_subset_U hxV + have hfin_FV : (F ∩ Γ.V).Finite := Γ.finite_V.subset inter_subset_right + have hfin_hits : {z : Circle | φ z ∈ Γ.U}.Finite := by + refine Finite.of_finite_image ?_ hinj.injOn + rw [hhit_eq] + exact hfin_FV + have hlen : curveLength Γ φ = (F ∩ Γ.V).ncard := by + unfold curveLength + rw [← hhit_eq, ncard_image_of_injective _ hinj] + exact ⟨φ, hrange, ⟨hfin_hits, hrange.symm ▸ hnorm⟩, hlen⟩ + +omit [T2Space S] in +/-- Given a single radial link `K.toGraph.IsLink e u w`, there is a path `p : Path u w` with +`range p = closure e` whose hits with `Γ.V` in `[0, 1)` have cardinality at most `1` if `u ∈ Γ.V` +and `0` if `u ∉ Γ.V`. -/ +private theorem exists_path_of_radial_link {Γ K : Drawing S} + (hrad : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + {e : Set S} {u w : S} (hlink : K.toGraph.IsLink e u w) : + (u ∈ Γ.V ↔ w ∉ Γ.V) ∧ + ∃ p : Path u w, + range p = closure e ∧ + {t : unitInterval | t.1 < 1 ∧ p t ∈ Γ.V}.Finite ∧ + {t : unitInterval | t.1 < 1 ∧ p t ∈ Γ.V}.ncard ≤ (open Classical in if u ∈ Γ.V then 1 else + 0) := by + classical + have heK : e ∈ K.E := hlink.1 + have hcap : closure e ∩ K.V = {u, w} := hlink.2.2.2 + obtain ⟨v₀, hv₀, w₀, hw₀, hcap₀⟩ := hrad.2.2.2.2.1 e heK + have hpair : ({u, w} : Set S) = {v₀, w₀} := hcap.symm.trans hcap₀ + have hvw_ne : v₀ ≠ w₀ := fun h => hw₀.2 (h ▸ hv₀) + have hu_or : u = v₀ ∧ w = w₀ ∨ u = w₀ ∧ w = v₀ := by + have hu_mem : u ∈ ({v₀, w₀} : Set S) := hpair ▸ mem_insert u {w} + have hw_mem : w ∈ ({v₀, w₀} : Set S) := hpair ▸ mem_insert_of_mem u (mem_singleton w) + rcases hu_mem with hu_eq | hu_eq <;> rcases hw_mem with hw_eq | hw_eq + · exfalso + have hsing : ({v₀, w₀} : Set S) = {v₀} := by + rw [← hpair, hu_eq, hw_eq, pair_eq_singleton] + have hw₀_mem : w₀ ∈ ({v₀} : Set S) := hsing ▸ mem_insert_of_mem v₀ (mem_singleton w₀) + exact hvw_ne (mem_singleton_iff.mp hw₀_mem).symm + · exact Or.inl ⟨hu_eq, hw_eq⟩ + · exact Or.inr ⟨hu_eq, hw_eq⟩ + · exfalso + have hsing : ({v₀, w₀} : Set S) = {w₀} := by + rw [← hpair, hu_eq, hw_eq, pair_eq_singleton] + have hv₀_mem : v₀ ∈ ({w₀} : Set S) := hsing ▸ mem_insert v₀ {w₀} + exact hvw_ne (mem_singleton_iff.mp hv₀_mem) + have huw_ne : u ≠ w := by + rcases hu_or with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hvw_ne + · exact hvw_ne.symm + have hbipart : u ∈ Γ.V ↔ w ∉ Γ.V := by + rcases hu_or with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨fun _ => hw₀.2, fun _ => hv₀⟩ + · exact ⟨fun h => absurd h hw₀.2, fun h => (h hv₀).elim⟩ + have hline : IsLineWithEnds (closure e) u w := by + rcases K.edge_cond e heK with ⟨u₁, w₁, _, hcap₁, hl₁⟩ | ⟨u₁, hcap₁, _⟩ + · have hp₁ : ({u, w} : Set S) = {u₁, w₁} := hcap.symm.trans hcap₁ + have hu₁ : u ∈ ({u₁, w₁} : Set S) := hp₁ ▸ mem_insert u {w} + have hw₁ : w ∈ ({u₁, w₁} : Set S) := hp₁ ▸ mem_insert_of_mem u (mem_singleton w) + rcases hu₁ with rfl | rfl <;> rcases hw₁ with rfl | rfl + · exact (huw_ne rfl).elim + · exact hl₁ + · exact hl₁.symm + · exact (huw_ne rfl).elim + · exfalso + have hp₁ : ({u, w} : Set S) = {u₁} := hcap.symm.trans hcap₁ + have hu₁ : u = u₁ := mem_singleton_iff.mp (hp₁ ▸ mem_insert u {w}) + have hw₁ : w = u₁ := mem_singleton_iff.mp (hp₁ ▸ mem_insert_of_mem u (mem_singleton w)) + exact huw_ne (hu₁.trans hw₁.symm) + obtain ⟨a, ha, hran, ha0, ha1⟩ := hline.exists_arc + let p : Path u w := ⟨⟨a, ha.1⟩, ha0, ha1⟩ + have hsub : {t : unitInterval | t.1 < 1 ∧ p t ∈ Γ.V} ⊆ if u ∈ Γ.V then {0} else ∅ := by + intro t ⟨ht1, htV⟩ + have htKV : a t ∈ closure e ∩ K.V := ⟨hran ▸ mem_range_self t, hrad.2.1 htV⟩ + rw [hcap] at htKV + rcases htKV with htu | htw + · have ht0 : t = 0 := ha.2 (htu.trans ha0.symm) + subst ht0 + change a 0 ∈ Γ.V at htV + rw [ha0] at htV + simp [htV] + · have ht_one : t = 1 := ha.2 (htw.trans ha1.symm) + subst ht_one + exact (lt_irrefl (1 : ℝ) ht1).elim + have hfin : (if u ∈ Γ.V then ({0} : Set unitInterval) else ∅).Finite := by + split_ifs + · exact finite_singleton 0 + · exact finite_empty + refine ⟨hbipart, p, hran, hfin.subset hsub, (ncard_le_ncard hsub hfin).trans ?_⟩ + split_ifs <;> simp + +/-- Every walk `W` of positive length in a radial drawing `K` is traced by a continuous path +`p : Path u v` with `range p = (walkDrawing K W).U` whose hits with `Γ.V` in `[0, 1)` have +cardinality at most `(W.length + 1) / 2` if `u ∈ Γ.V` and `W.length / 2` if `u ∉ Γ.V`. -/ +theorem exists_path_of_radial_walk {Γ K : Drawing S} + (hrad : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + {u v : S} (W : GraphWalk K.toGraph u v) (hpos : 0 < W.length) : + ∃ p : Path u v, + range p = (walkDrawing K W).U ∧ + {t : unitInterval | t.1 < 1 ∧ p t ∈ Γ.V}.Finite ∧ + {t : unitInterval | t.1 < 1 ∧ p t ∈ Γ.V}.ncard ≤ + (open Classical in if u ∈ Γ.V then (W.length + 1) / 2 else W.length / 2) := by + classical + induction W with + | nil _ => simp [GraphWalk.length, GraphWalk.edges] at hpos + | @cons u w v e hlink rest ih => + obtain ⟨hbip, p₁, hran₁, hfin₁, hcard₁⟩ := exists_path_of_radial_link hrad hlink + cases hrest : rest with + | nil hw => + subst hrest + have hU : (walkDrawing K (.cons hlink (.nil hw))).U = closure e := by + have hV : (walkDrawing K (.cons hlink (.nil hw))).V = {u, w} := by + rw [walkDrawing_V] + ext x + simp [GraphWalk.support] + have hE : (walkDrawing K (.cons hlink (.nil hw))).E = {e} := by + rw [walkDrawing_E] + ext f + simp [GraphWalk.edges] + rw [Drawing.U_eq, hV, hE, biUnion_singleton] + refine Subset.antisymm (union_subset ?_ subset_rfl) subset_union_right + rw [← hlink.2.2.2] + exact inter_subset_left + refine ⟨p₁, hran₁.trans hU.symm, hfin₁, hcard₁.trans ?_⟩ + simp [GraphWalk.length, GraphWalk.edges] + | cons hl₂ rest₂ => + subst hrest + have hpos₂ : 0 < (GraphWalk.cons hl₂ rest₂).length := by + simp [GraphWalk.length, GraphWalk.edges] + obtain ⟨p₂, hran₂, hfin₂, hcard₂⟩ := ih hpos₂ + let p := p₁.trans p₂ + have hran : range p = (walkDrawing K (.cons hlink (.cons hl₂ rest₂))).U := by + rw [Path.trans_range, hran₁, hran₂] + have hV : (walkDrawing K (.cons hlink (.cons hl₂ rest₂))).V = + insert u (walkDrawing K (.cons hl₂ rest₂)).V := by + rw [walkDrawing_V, walkDrawing_V] + ext x + simp [GraphWalk.support] + have hE : (walkDrawing K (.cons hlink (.cons hl₂ rest₂))).E = + insert e (walkDrawing K (.cons hl₂ rest₂)).E := by + rw [walkDrawing_E, walkDrawing_E] + ext f + simp [GraphWalk.edges] + have hu_cl : u ∈ closure e := by + have : u ∈ closure e ∩ K.V := hlink.2.2.2 ▸ mem_insert u {w} + exact this.1 + rw [Drawing.U_eq, Drawing.U_eq, hV, hE] + ext x + simp only [mem_union, mem_insert_iff, mem_iUnion, exists_prop] + constructor + · rintro (hx | hx | ⟨f, hf, hxf⟩) + · exact Or.inr ⟨e, Or.inl rfl, hx⟩ + · exact Or.inl (Or.inr hx) + · exact Or.inr ⟨f, Or.inr hf, hxf⟩ + · rintro ((rfl | hx) | ⟨f, rfl | hf, hxf⟩) + · exact Or.inl hu_cl + · exact Or.inr (Or.inl hx) + · exact Or.inl hxf + · exact Or.inr (Or.inr ⟨f, hf, hxf⟩) + let halfLeft : unitInterval → unitInterval := + fun s => ⟨s.1 / 2, by have := s.2.1; linarith, by have := s.2.2; linarith⟩ + let halfRight : unitInterval → unitInterval := + fun s => ⟨(s.1 + 1) / 2, by have := s.2.1; linarith, by have := s.2.2; linarith⟩ + let S₁ : Set unitInterval := {t : unitInterval | t.1 < 1 ∧ p₁ t ∈ Γ.V} + let S₂ : Set unitInterval := {t : unitInterval | t.1 < 1 ∧ p₂ t ∈ Γ.V} + have hhit_sub : {t : unitInterval | t.1 < 1 ∧ p t ∈ Γ.V} ⊆ + halfLeft '' S₁ ∪ halfRight '' S₂ := by + intro t ⟨ht1, hpt⟩ + rcases le_or_gt t.1 (1 / 2 : ℝ) with hle | hgt + · rcases eq_or_lt_of_le hle with heq | hlt + · have ht_half : t = ⟨1 / 2, by norm_num, by norm_num⟩ := Subtype.ext heq + rw [ht_half] at hpt ⊢ + have hp_half : p ⟨1 / 2, by norm_num, by norm_num⟩ = p₂ 0 := by + change Path.trans p₁ p₂ ⟨1 / 2, by norm_num, by norm_num⟩ = p₂ 0 + rw [Path.trans_apply] + split_ifs + · simp [p₁.target, p₂.source] + · exfalso; norm_num at * + rw [hp_half] at hpt + refine Or.inr ⟨0, ⟨by norm_num, hpt⟩, ?_⟩ + ext + simp [halfRight] + · let s : unitInterval := ⟨2 * t.1, by have := t.2.1; linarith, by linarith⟩ + have hpt_eq : p t = p₁ s := by + change Path.trans p₁ p₂ t = p₁ s + rw [Path.trans_apply] + split_ifs with h + · rfl + · exact (h hle).elim + rw [hpt_eq] at hpt + refine Or.inl ⟨s, ⟨by change 2 * t.1 < 1; linarith, hpt⟩, ?_⟩ + ext + simp [halfLeft, s] + · let s : unitInterval := ⟨2 * t.1 - 1, by linarith, by linarith [t.2.2]⟩ + have hpt_eq : p t = p₂ s := by + change Path.trans p₁ p₂ t = p₂ s + rw [Path.trans_apply] + split_ifs with h + · exact (not_le_of_gt hgt h).elim + · rfl + rw [hpt_eq] at hpt + refine Or.inr ⟨s, ⟨by change 2 * t.1 - 1 < 1; linarith, hpt⟩, ?_⟩ + ext + simp [halfRight, s] + have hfin_union : (halfLeft '' S₁ ∪ halfRight '' S₂).Finite := + (hfin₁.image halfLeft).union (hfin₂.image halfRight) + have hfin : {t : unitInterval | t.1 < 1 ∧ p t ∈ Γ.V}.Finite := + hfin_union.subset hhit_sub + have hcard : {t : unitInterval | t.1 < 1 ∧ p t ∈ Γ.V}.ncard ≤ S₁.ncard + S₂.ncard := by + calc {t : unitInterval | t.1 < 1 ∧ p t ∈ Γ.V}.ncard + _ ≤ (halfLeft '' S₁ ∪ halfRight '' S₂).ncard := ncard_le_ncard hhit_sub hfin_union + _ ≤ (halfLeft '' S₁).ncard + (halfRight '' S₂).ncard := + ncard_union_le (halfLeft '' S₁) (halfRight '' S₂) + _ ≤ S₁.ncard + S₂.ncard := + add_le_add (ncard_image_le hfin₁) (ncard_image_le hfin₂) + refine ⟨p, hran, hfin, hcard.trans ?_⟩ + have hlen : (GraphWalk.cons hlink (.cons hl₂ rest₂)).length = + (GraphWalk.cons hl₂ rest₂).length + 1 := by + simp [GraphWalk.length, GraphWalk.edges] + rw [hlen] + refine (add_le_add hcard₁ hcard₂).trans ?_ + by_cases hu : u ∈ Γ.V + · have hw : w ∉ Γ.V := hbip.mp hu + simp only [hu, hw, ↓reduceIte] + omega + · have hw : w ∈ Γ.V := hbip.not_left.mp hu + simp only [hu, hw, ↓reduceIte] + omega + +omit [T2Space S] in +/-- A closed path descends to a continuous curve on the circle. The half-open parameter +interval gives the original path values, and both maps have the same range. -/ +theorem exists_closedCurve_of_loop_with_parameter {u : S} (p : Path u u) : + ∃ φ : C(Circle, S), range φ = range p ∧ + ∀ t : unitInterval, t.1 < 1 → φ (Circle.exp (2 * Real.pi * t.1)) = p t := by + have : Fact ((0 : ℝ) < 1) := ⟨zero_lt_one⟩ + let f : ℝ → S := extI p + have hf_per : f 0 = f 1 := by + change extI p (0 : unitInterval).1 = extI p (1 : unitInterval).1 + rw [extI_coe, extI_coe, p.source, p.target] + have hf_cont : Continuous f := continuous_extI p.continuous + let g : AddCircle (1 : ℝ) → S := AddCircle.liftIco (1 : ℝ) 0 f + have hg_cont : Continuous g := + AddCircle.liftIco_zero_continuous hf_per hf_cont.continuousOn + let e : Circle ≃ₜ AddCircle (1 : ℝ) := (AddCircle.homeomorphCircle one_ne_zero).symm + let φ : C(Circle, S) := ⟨g ∘ e, hg_cont.comp e.continuous⟩ + let q : unitInterval → Circle := fun t => Circle.exp (2 * Real.pi * t.1) + have hφ_q : ∀ t : unitInterval, t.1 < 1 → φ (q t) = p t := by + intro t ht1 + have ht_Ico : t.1 ∈ Ico (0 : ℝ) 1 := ⟨t.2.1, ht1⟩ + have he_qt : e (q t) = (t.1 : AddCircle (1 : ℝ)) := by + refine (Homeomorph.symm_apply_eq (AddCircle.homeomorphCircle one_ne_zero)).mpr ?_ + symm + rw [AddCircle.homeomorphCircle_apply, AddCircle.toCircle_apply_mk] + change Circle.exp (2 * Real.pi / 1 * t.1) = Circle.exp (2 * Real.pi * t.1) + congr 1 + ring + change g (e (q t)) = p t + rw [he_qt] + change AddCircle.liftIco (1 : ℝ) 0 f (t.1 : AddCircle (1 : ℝ)) = p t + rw [AddCircle.liftIco_zero_coe_apply ht_Ico] + exact extI_coe p t + have hrange : range φ = range p := by + ext x + constructor + · rintro ⟨z, rfl⟩ + obtain ⟨s, hs, hsz⟩ := (circle_parameter_bijOn 0).surjOn (mem_univ z) + rw [zero_add] at hs + let t : unitInterval := ⟨s, hs.1, hs.2.le⟩ + have hqt : q t = z := hsz + rw [← hqt, hφ_q t hs.2] + exact mem_range_self t + · rintro ⟨t, rfl⟩ + rcases eq_or_lt_of_le t.2.2 with ht1 | ht1 + · have ht_eq : t = 1 := Subtype.ext ht1 + rw [ht_eq, p.target, ← p.source, ← hφ_q 0 zero_lt_one] + exact mem_range_self (q 0) + · rw [← hφ_q t ht1] + exact mem_range_self (q t) + exact ⟨φ, hrange, hφ_q⟩ + +/-- Every closed walk `W` of positive length `2 * m` in a radial drawing `K` is traced by a +`Γ`-normal closed curve `φ : C(Circle, S)` with `range φ = (walkDrawing K W).U` and +`curveLength Γ φ ≤ m`. -/ +private theorem exists_closedCurve_of_radial_walk {Γ K : Drawing S} + (hrad : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + {u : S} (W : GraphWalk K.toGraph u u) (hpos : 0 < W.length) + {m : ℕ} (hlen : W.length ≤ 2 * m) : + ∃ φ : C(Circle, S), + range φ = (walkDrawing K W).U ∧ + IsNormalCurve Γ φ ∧ + curveLength Γ φ ≤ m := by + classical + obtain ⟨p, hran, hfin_p, hcard_p⟩ := exists_path_of_radial_walk hrad W hpos + obtain ⟨φ, hrange, hφ_q⟩ := exists_closedCurve_of_loop_with_parameter p + let q : unitInterval → Circle := fun t => Circle.exp (2 * Real.pi * t.1) + have hrange_W : range φ = (walkDrawing K W).U := hrange.trans hran + have hnorm_W : Γ.IsNormal (range φ) := by + unfold Drawing.IsNormal + rw [hrange_W, Set.inter_comm] + exact subset_trans (inter_subset_inter_right _ (walkDrawing_isSubdrawing K W).U_subset) + (subset_of_eq hrad.1) + let Sp : Set unitInterval := {t : unitInterval | t.1 < 1 ∧ p t ∈ Γ.V} + have hhit_sub : {z : Circle | φ z ∈ Γ.U} ⊆ q '' Sp := by + intro z hz + obtain ⟨s, hs, hsz⟩ := (circle_parameter_bijOn 0).surjOn (mem_univ z) + rw [zero_add] at hs + let t : unitInterval := ⟨s, hs.1, hs.2.le⟩ + have hqt : q t = z := hsz + have hq : φ (q t) = p t := hφ_q t hs.2 + have hpt_U : p t ∈ Γ.U := by + rw [← hq, hqt] + exact hz + have hpt_V : p t ∈ Γ.V := hnorm_W ⟨hrange ▸ mem_range_self t, hpt_U⟩ + exact ⟨t, ⟨hs.2, hpt_V⟩, hqt⟩ + have hfin_hits : {z : Circle | φ z ∈ Γ.U}.Finite := (hfin_p.image q).subset hhit_sub + have hlen_φ : curveLength Γ φ ≤ m := by + unfold curveLength + calc {z : Circle | φ z ∈ Γ.U}.ncard + _ ≤ (q '' Sp).ncard := ncard_le_ncard hhit_sub (hfin_p.image q) + _ ≤ Sp.ncard := ncard_image_le hfin_p + _ ≤ if u ∈ Γ.V then (W.length + 1) / 2 else W.length / 2 := hcard_p + _ ≤ m := by split_ifs <;> omega + exact ⟨φ, hrange_W, ⟨hfin_hits, hnorm_W⟩, hlen_φ⟩ + +/-! ## 4. Proof of (7.7) -/ + +/-- Core lemma for **(7.7)**: if `d a b < d' a' b'` for `a, b ∈ Γ.A` and `a', b' ∈ Γ'.A` with +`a ⊆ a'`, `b ⊆ b'`, and `d a b < θ`, then there is an `O`-arc `F` in `S` and a closed disc `Δ` +bounded by `F` such that: +- `((PaintingOrDrawing.drawing Γ).inter Δ, (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T`, +- `((PaintingOrDrawing.drawing Γ').inter Δ, (PaintingOrDrawing.drawing Γ').interOutside Δ) ∉ T'`, +- and there exist `c ∈ Γ.A`, `f ∈ Γ.E`, and `c', f' ∈ Γ'.A` with `c ⊆ c'`, `f ⊆ f'`, + `d c f = θ`, and `d' c' f' ≤ d a b`. -/ +private theorem exists_disc_and_atoms_of_lt + (hS : IsClosedSurface S) [ConnectedSpace S] + {Γ Γ' : Drawing S} {θ θ' : ℕ} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} + (hd : HasTangleMetric Γ θ T d) + (hsub : Γ'.IsSubdrawing Γ) + (hθ : θ' ≤ θ) (hd' : HasTangleMetric Γ' θ' T' d') + {a b : Set S} (ha : a ∈ Γ.A) (hb : b ∈ Γ.A) + {a' b' : Set S} (ha' : a' ∈ Γ'.A) (hb' : b' ∈ Γ'.A) + (haa' : a ⊆ a') (hbb' : b ⊆ b') + (hd_lt_d' : d a b < d' a' b') : + ∃ Δ : Set S, + ((PaintingOrDrawing.drawing Γ).inter Δ, + (PaintingOrDrawing.drawing Γ).interOutside Δ) ∈ T ∧ + ((PaintingOrDrawing.drawing Γ').inter Δ, + (PaintingOrDrawing.drawing Γ').interOutside Δ) ∉ T' ∧ + ∃ c ∈ Γ.A, ∃ f ∈ Γ.E, ∃ c' ∈ Γ'.A, ∃ f' ∈ Γ'.A, + c ⊆ c' ∧ f ⊆ f' ∧ d c f = θ ∧ d' c' f' ≤ d a b := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hResp, K, ins, hrad, hslope, hd_eq⟩ := id hd + obtain ⟨hResp', K', ins', hrad', hslope', hd'_eq⟩ := id hd' + have hd'_le_θ' : d' a' b' ≤ θ' := by + rw [hd'_eq a' ha' b' hb'] + exact GM11.tangleMetric_le_order hrad'.2.1 a' b' + have hd_lt_θ' : d a b < θ' := lt_of_lt_of_le hd_lt_d' hd'_le_θ' + have hd_lt_θ : d a b < θ := lt_of_lt_of_le hd_lt_θ' hθ + have hab_ne : a ≠ b := by + rintro rfl + obtain ⟨x, hxa⟩ := atom_nonempty' ha + have ha'b' : a' = b' := atom_eq_of_inter_nonempty ha' hb' ⟨x, haa' hxa, hbb' hxa⟩ + subst ha'b' + have hd'0 : d' a' a' = 0 := metric_self hd' ha' + omega + have hd_pos : 0 < d a b := + Nat.pos_of_ne_zero fun h0 => hab_ne ((tangleMetric_eq_zero_iff hS hd ha hb).mp h0) + have hθ2 : 2 ≤ θ := by omega + have hEΓ : Γ.E.Nonempty := edgeSet_nonempty_of_isTangle_of_two_le hResp.2.1 hθ2 + have hd_ab : d a b = tangleMetric Γ K ins θ a b := hd_eq a ha b hb + rcases GM11.tangleMetric_cases (ins := ins) (θ := θ) hrad.2.1 hab_ne with h_eq_θ | ⟨_, hwit⟩ + · omega + rw [← hd_ab] at hwit + obtain ⟨u, W, a_K, b_K, ha_K, hb_K, hW_lt, hW_len, ha_sub_W, hb_sub_W⟩ := hwit + have hposW : 0 < W.length := by omega + have haW : (a ∩ insWalk ins K W).Nonempty := + (corresponding_atom_subset_iff hS hrad hslope ha_K W hW_lt).mp ha_sub_W + have hbW : (b ∩ insWalk ins K W).Nonempty := + (corresponding_atom_subset_iff hS hrad hslope hb_K W hW_lt).mp hb_sub_W + obtain ⟨φ, hranφ, hnormφ, hlenφ⟩ := + exists_closedCurve_of_radial_walk hrad.2.1 W hposW hW_len.le + obtain ⟨hnormφ', hlenφ'_le⟩ := isNormalCurve_of_isSubdrawing hsub hnormφ + have hlenφ' : curveLength Γ' φ ≤ d a b := hlenφ'_le.trans hlenφ + have hlenφ'_lt : curveLength Γ' φ < θ' := lt_of_le_of_lt hlenφ' hd_lt_θ' + have h21_app := theorem_2_1_statement S hS Γ' K' θ' T' ins' hrad' hResp'.2.1.one_le hResp'.2.1 + hResp'.2.2 + hslope' φ hnormφ' hlenφ'_lt + obtain ⟨⟨v, W', htr'⟩, h21_prop⟩ := h21_app + obtain ⟨hW'_lt, h21_disc⟩ := h21_prop v W' htr' + have hW'_len : W'.length = 2 * curveLength Γ' φ := by + rcases htr'.2 with ⟨h0, hW0, -⟩ | ⟨-, hW2, -⟩ + · rw [h0, hW0] + · exact hW2 + -- Any two atoms of `Γ'` meeting `insWalk ins' K' W'` have `d'`-distance at most `d a b`. + have hd'_le_of_meet : ∀ x' ∈ Γ'.A, ∀ y' ∈ Γ'.A, + (x' ∩ insWalk ins' K' W').Nonempty → (y' ∩ insWalk ins' K' W').Nonempty → + d' x' y' ≤ d a b := by + intro x' hx' y' hy' hx'W hy'W + by_cases hxy' : x' = y' + · subst hxy' + rw [metric_self hd' hx'] + exact Nat.zero_le _ + · obtain ⟨x'_K, hx'_K, -⟩ := existsUnique_correspondingAtom' hrad' hx' + obtain ⟨y'_K, hy'_K, -⟩ := existsUnique_correspondingAtom' hrad' hy' + have hx'_sub : x'_K ⊆ insWalk ins' K' W' := + (corresponding_atom_subset_iff hS hrad' hslope' hx'_K W' hW'_lt).mpr hx'W + have hy'_sub : y'_K ⊆ insWalk ins' K' W' := + (corresponding_atom_subset_iff hS hrad' hslope' hy'_K W' hW'_lt).mpr hy'W + have hwit' : GM11.MetricWitness Γ' K' ins' θ' x' y' (curveLength Γ' φ) := + ⟨v, W', x'_K, y'_K, hx'_K, hy'_K, hW'_lt, hW'_len, hx'_sub, hy'_sub⟩ + rw [hd'_eq x' hx' y' hy'] + exact (GM11.tangleMetric_le hwit').trans hlenφ' + -- Hence `a'` and `b'` cannot both meet `insWalk ins' K' W'`. + have hnot_both : ¬ ((a' ∩ insWalk ins' K' W').Nonempty ∧ (b' ∩ insWalk ins' K' W').Nonempty) := + fun ⟨ha'W, hb'W⟩ => not_le_of_gt hd_lt_d' (hd'_le_of_meet a' ha' b' hb' ha'W hb'W) + have hex_z₀ : ∃ z₀ ∈ Γ.A, ∃ z₀' ∈ Γ'.A, z₀ ⊆ z₀' ∧ + (z₀ ∩ insWalk ins K W).Nonempty ∧ ¬ (z₀' ∩ insWalk ins' K' W').Nonempty := by + by_cases ha'W : (a' ∩ insWalk ins' K' W').Nonempty + · have hb'W : ¬ (b' ∩ insWalk ins' K' W').Nonempty := fun h => hnot_both ⟨ha'W, h⟩ + exact ⟨b, hb, b', hb', hbb', hbW, hb'W⟩ + · exact ⟨a, ha, a', ha', haa', haW, ha'W⟩ + obtain ⟨z₀, hz₀, z₀', hz₀', hzz', hz₀W, hz₀'W⟩ := hex_z₀ + -- `z₀` cannot meet `(walkDrawing K W).U = range φ`, else `z₀'` meets `insWalk ins' K' W'`. + have hz₀_not_U : ¬ (z₀ ∩ (walkDrawing K W).U).Nonempty := by + intro hmeet + rw [← hranφ] at hmeet + have hmeet' : (z₀' ∩ range φ).Nonempty := hmeet.mono (inter_subset_inter_left _ hzz') + have hmeet_W' := meets_walkDrawing_of_isTrace htr' hz₀' hmeet' + exact hz₀'W (hmeet_W'.mono (inter_subset_inter_right _ subset_union_left)) + -- Therefore `z₀` meets `ins C` for some circuit `C` of `walkDrawing K W`. + obtain ⟨p₀, hp₀z, hp₀W⟩ := hz₀W + rcases hp₀W with hp₀U | hp₀C + · exact (hz₀_not_U ⟨p₀, hp₀z, hp₀U⟩).elim + obtain ⟨C, ⟨hC, hCs⟩, hp₀C⟩ := mem_iUnion₂.mp hp₀C + let F : Set S := C.U + let Δ : Set S := ins C + have hFO : IsOArc F := IsCircuit.isOArc_U hC + have hF_sub_φ : F ⊆ range φ := by + rw [hranφ] + exact hCs.U_subset + have hCK : C.IsSubdrawing K := hCs.trans (walkDrawing_isSubdrawing K W) + have hC_len_le : C.length ≤ W.length := by + have hsubE : C.E ⊆ {e | e ∈ W.edges} := by + have := hCs.2 + rwa [walkDrawing_E] at this + calc C.E.ncard ≤ ({e | e ∈ W.edges} : Set (Set S)).ncard := + Set.ncard_le_ncard hsubE (List.finite_toSet _) + _ ≤ W.edges.length := by + rw [show ({e | e ∈ W.edges} : Set (Set S)) = ↑W.edges.toFinset by ext; simp, + Set.ncard_coe_finset] + exact List.toFinset_card_le _ + _ = W.length := rfl + have hC_len_lt : C.length < 2 * θ := lt_of_le_of_lt hC_len_le hW_lt + obtain ⟨hΔ_disc, hΔ_bd, hΔ_memT⟩ := hslope C hC hCK hC_len_lt + have hΔ_notMemT' : + ((PaintingOrDrawing.drawing Γ').inter Δ, + (PaintingOrDrawing.drawing Γ').interOutside Δ) ∉ T' := by + intro hmemT' + have hz₀'_Δ : (z₀' ∩ Δ).Nonempty := ⟨p₀, hzz' hp₀z, hp₀C⟩ + exact hz₀'W (h21_disc z₀' hz₀' F Δ hFO hF_sub_φ hΔ_disc hΔ_bd hmemT' hz₀'_Δ) + -- Now find `Δ'` from `IsRespectful` of `T'` in `Γ'`. + have hnormF' : (PaintingOrDrawing.drawing Γ').IsNormal F := + fun x ⟨hxF, hxU'⟩ => hnormφ'.2 ⟨hF_sub_φ hxF, hxU'⟩ + have hF_sub_img : F ∩ Γ'.V ⊆ φ '' {x : Circle | φ x ∈ Γ'.U} := by + rintro y ⟨hyF, hyV'⟩ + obtain ⟨z, rfl⟩ := hF_sub_φ hyF + exact ⟨z, Γ'.V_subset_U hyV', rfl⟩ + have hcardF' : (F ∩ (PaintingOrDrawing.drawing Γ').V).ncard < θ' := by + change (F ∩ Γ'.V).ncard < θ' + calc (F ∩ Γ'.V).ncard + _ ≤ (φ '' {x : Circle | φ x ∈ Γ'.U}).ncard := + ncard_le_ncard hF_sub_img (hnormφ'.1.image φ) + _ ≤ {x : Circle | φ x ∈ Γ'.U}.ncard := ncard_image_le hnormφ'.1 + _ = curveLength Γ' φ := rfl + _ < θ' := hlenφ'_lt + obtain ⟨Δ', hΔ'_disc, hΔ'_bd, hΔ'_memT'⟩ := hResp'.2.2.2 F hFO hnormF' hcardF' + have hΔ_ne_Δ' : Δ ≠ Δ' := fun h => hΔ_notMemT' (h ▸ hΔ'_memT') + have hdiscBd_eq : discBd Δ = discBd Δ' := by + rw [← GM11.IsClosedDisc.frontier_eq_discBd hS hΔ_disc, + ← GM11.IsClosedDisc.frontier_eq_discBd hS hΔ'_disc, + ← subBd_eq_frontier, ← subBd_eq_frontier, hΔ_bd, hΔ'_bd] + have hcov : Δ ∪ Δ' = univ := GM11.cover_of_discBd_eq hS hΔ_disc hΔ'_disc hdiscBd_eq hΔ_ne_Δ' + -- Choose `x₀ ∈ F` and let `c ∈ Γ.A` be the atom containing `x₀`. + obtain ⟨x₀, hx₀F⟩ := (infinite_of_isOArc hFO).nonempty + obtain ⟨c, hc, hx₀c⟩ := GM11.exists_atom Γ x₀ + have hc_not_E : c ∉ Γ.E := by + intro hcE + have hx₀K : x₀ ∈ K.U := hCK.U_subset hx₀F + have hx₀Γ : x₀ ∈ Γ.U := (hcE.2.1 hx₀c).1 + have hx₀V : x₀ ∈ Γ.V := by + have h1 : x₀ ∈ (PaintingOrDrawing.drawing Γ).U ∩ K.U := ⟨hx₀Γ, hx₀K⟩ + rwa [hrad.2.1.1] at h1 + exact (hcE.2.1 hx₀c).2 hx₀V + obtain ⟨f, hfE, hd_cf⟩ := + exists_edge_dist_eq_theta_uncond hS hd hEΓ hc (Or.inr hc_not_E) + have hfA : f ∈ Γ.A := Or.inl (Or.inr hfE) + obtain ⟨c', hc', hcc'⟩ := exists_atom_superset_of_isSubdrawing hsub hc + obtain ⟨f', hf', hff'⟩ := exists_atom_superset_of_isSubdrawing hsub hfA + have hF_sub_Δ : F ⊆ Δ := by + change C.U ⊆ ins C + rw [← hΔ_bd, subBd_eq_frontier] + exact (IsClosedDisc.isCompact hΔ_disc).isClosed.frontier_subset + have hF_sub_Δ' : F ⊆ Δ' := by + rw [← hΔ'_bd, subBd_eq_frontier] + exact (IsClosedDisc.isCompact hΔ'_disc).isClosed.frontier_subset + have hΔ_sub_W : Δ ⊆ insWalk ins K W := + fun x hx => Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, hCs⟩, hx⟩) + -- `f` cannot meet `Δ`, otherwise `W` witnesses `d c f ≤ d a b < θ`. + have hf_not_Δ : ¬ (f ∩ Δ).Nonempty := by + intro hfΔ + have hcW : (c ∩ insWalk ins K W).Nonempty := ⟨x₀, hx₀c, hΔ_sub_W (hF_sub_Δ hx₀F)⟩ + have hfW : (f ∩ insWalk ins K W).Nonempty := hfΔ.mono (inter_subset_inter_right _ hΔ_sub_W) + by_cases hcf : c = f + · subst hcf + exact hc_not_E hfE + · obtain ⟨c_K, hc_K, -⟩ := existsUnique_correspondingAtom' hrad hc + obtain ⟨f_K, hf_K, -⟩ := existsUnique_correspondingAtom' hrad hfA + have hc_sub : c_K ⊆ insWalk ins K W := + (corresponding_atom_subset_iff hS hrad hslope hc_K W hW_lt).mpr hcW + have hf_sub : f_K ⊆ insWalk ins K W := + (corresponding_atom_subset_iff hS hrad hslope hf_K W hW_lt).mpr hfW + have hwit_cf : GM11.MetricWitness Γ K ins θ c f (d a b) := + ⟨u, W, c_K, f_K, hc_K, hf_K, hW_lt, hW_len, hc_sub, hf_sub⟩ + have hd_le : d c f ≤ d a b := by + rw [hd_eq c hc f hfA] + exact GM11.tangleMetric_le hwit_cf + omega + -- Since `f.Nonempty` and `Δ ∪ Δ' = univ`, `f` meets `Δ'`. + obtain ⟨y₀, hy₀f⟩ := hfE.1 + have hy₀Δ' : y₀ ∈ Δ' := by + have hy₀_univ : y₀ ∈ Δ ∪ Δ' := hcov.symm ▸ mem_univ y₀ + exact hy₀_univ.resolve_left fun hy₀Δ => hf_not_Δ ⟨y₀, hy₀f, hy₀Δ⟩ + have hc'Δ' : (c' ∩ Δ').Nonempty := ⟨x₀, hcc' hx₀c, hF_sub_Δ' hx₀F⟩ + have hf'Δ' : (f' ∩ Δ').Nonempty := ⟨y₀, hff' hy₀f, hy₀Δ'⟩ + have hc'W' : (c' ∩ insWalk ins' K' W').Nonempty := + h21_disc c' hc' F Δ' hFO hF_sub_φ hΔ'_disc hΔ'_bd hΔ'_memT' hc'Δ' + have hf'W' : (f' ∩ insWalk ins' K' W').Nonempty := + h21_disc f' hf' F Δ' hFO hF_sub_φ hΔ'_disc hΔ'_bd hΔ'_memT' hf'Δ' + refine ⟨Δ, hΔ_memT, hΔ_notMemT', c, hc, f, hfE, c', hc', f', hf', + hcc', hff', hd_cf, hd'_le_of_meet c' hc' f' hf' hc'W' hf'W'⟩ + +/-- **(7.7)** of Graph Minors XII (page 268): +"(7.7) *Let $\mathscr{T}$ be a respectful tangle of order $\theta$ in a 2-cell drawing $\Gamma$ in a +connected surface $\Sigma$; let its metric be $d$. Let $\Gamma'$ be a 2-cell subdrawing of $\Gamma$, +and let $\mathscr{T}'$ be a respectful tangle of order $\theta' \le \theta$ in $\Gamma'$, with +metric $d'$. Then* +(i) *for $k \ge 0$, if $d'(a', b') \ge d(a, b) - k$ for all $a, b \in A(\Gamma)$ and +$a', b' \in A(\Gamma')$ with $a \subseteq a'$ and $b \subseteq b'$, then +$d(a, b) \ge \min(d'(a', b'), \theta - k)$ for all such $a, b, a', b'$* +(ii) *if $\theta = \theta'$ and $\mathscr{T}$ is the tangle in $\Gamma$ induced by $\mathscr{T}'$, +then $d(a, b) \ge d'(a', b')$ for all $a, b \in A(\Gamma)$ and $a', b' \in A(\Gamma')$ with +$a \subseteq a'$ and $b \subseteq b'$.*" -/ +theorem theorem_7_7_proof + (hS : IsClosedSurface S) [ConnectedSpace S] + {Γ Γ' : Drawing S} {θ θ' : ℕ} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} + (hd : HasTangleMetric Γ θ T d) + (hsub : Γ'.IsSubdrawing Γ) (htc' : (PaintingOrDrawing.drawing Γ').IsTwoCell) + (hθ : θ' ≤ θ) (hd' : HasTangleMetric Γ' θ' T' d') : + (∀ k : ℕ, + (∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → d a b - k ≤ d' a' b') → + ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → min (d' a' b') (θ - k) ≤ d a b) ∧ + (θ = θ' → T = inducedBySubgraph Γ.toHypergraph Γ'.toHypergraph θ' T' → + ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → d' a' b' ≤ d a b) := by + let _ := htc' + refine ⟨fun k hhyp a ha b hb a' ha' b' hb' haa' hbb' => ?_, + fun hθ_eq hT_ind a ha b hb a' ha' b' hb' haa' hbb' => ?_⟩ + · by_contra hlt + push Not at hlt + have hd_lt_d' : d a b < d' a' b' := lt_of_lt_of_le hlt (min_le_left _ _) + have hd_lt_θk : d a b < θ - k := lt_of_lt_of_le hlt (min_le_right _ _) + obtain ⟨_, _, _, c, hc, f, hfE, c', hc', f', hf', hcc', hff', hd_cf, hd'_cf⟩ := + exists_disc_and_atoms_of_lt hS hd hsub hθ hd' ha hb ha' hb' haa' hbb' hd_lt_d' + have hge := hhyp c hc f (Or.inl (Or.inr hfE)) c' hc' f' hf' hcc' hff' + omega + · by_contra hlt + push Not at hlt + obtain ⟨Δ, hΔ_memT, hΔ_notMemT', -⟩ := + exists_disc_and_atoms_of_lt hS hd hsub hθ hd' ha hb ha' hb' haa' hbb' hlt + rw [hT_ind] at hΔ_memT + have hmem : (((PaintingOrDrawing.drawing Γ).inter Δ) ∩ Γ'.toHypergraph, + ((PaintingOrDrawing.drawing Γ).interOutside Δ) ∩ Γ'.toHypergraph) ∈ T' := hΔ_memT.2.2 + rw [drawing_inter_inter_subdrawing hsub Δ, + drawing_interOutside_inter_subdrawing hsub Δ] at hmem + exact hΔ_notMemT' hmem + +/-- Bridge theorem proving `GM15.GM12Theorem77Statement` using the proved `(2.1)`. -/ +theorem gm15_theorem_7_7 : + GM15.GM12Theorem77Statement.{u} := by + intro S _ _ Γ Γ' θ θ' T T' d d' hS hconn hd hsub htc' hθ hd' + exact theorem_7_7_proof hS hd hsub htc' hθ hd' + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section78.lean b/LeanPool/GraphMinor/GM12/Section78.lean new file mode 100644 index 0000000000..c5a107d902 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section78.lean @@ -0,0 +1,314 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section76 +public import LeanPool.GraphMinor.GM12.Section79 +public import LeanPool.GraphMinor.GM12.Section711a +public import LeanPool.GraphMinor.GM12.Section4CircuitMeet +import LeanPool.GraphMinor.GM11.Section91 +import LeanPool.GraphMinor.GM11.CitedResults + +/-! +# Graph Minors XII, (7.8): respectful tangle in a 2-cell subdrawing deleting a ball of edges + +This file proves the walk and metric lemmas for **(7.8)** of Graph Minors XII (page 268). +The main proof is in `Section7Proved.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Function Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-! ## 1. Helper lemmas on walks in a radial drawing -/ + +omit [T2Space S] in +/-- Every walk `W` between `a` and `b` contains a simple walk `W'` between `a` and `b` of length at +most `W.length` whose vertices are a subset of `W.support`. -/ +theorem exists_simple_subwalk {Γ : Drawing S} {a b : S} (W : GraphWalk Γ.toGraph a b) : + ∃ W' : GraphWalk Γ.toGraph a b, W'.IsSimple ∧ W'.length ≤ W.length ∧ + ∀ x ∈ W'.support, x ∈ W.support := by + induction W with + | nil h => exact ⟨.nil h, by simp [GraphWalk.IsSimple], le_rfl, fun _ hx => hx⟩ + | @cons u v w e h r ih => + obtain ⟨r', hr', hlen, hsub⟩ := ih + by_cases hu : u ∈ r'.support + · obtain ⟨R₁, R₂, rfl⟩ := r'.exists_append_of_mem hu + refine ⟨R₂, (isSimple_of_append hr').2, ?_, fun x hx => List.mem_cons_of_mem u (hsub x ?_)⟩ + · rw [GraphWalk.length_append] at hlen + simp only [GraphWalk.length_cons] + omega + · exact (GraphWalk.mem_support_append _ _).mpr (Or.inr hx) + · refine ⟨.cons h r', List.nodup_cons.mpr ⟨hu, hr'⟩, ?_, ?_⟩ + · simp only [GraphWalk.length_cons] + omega + · intro x hx + rcases List.mem_cons.mp hx with rfl | hx + · exact List.mem_cons_self + · exact List.mem_cons_of_mem u (hsub x hx) + +omit [T2Space S] in +/-- In a pre-radial drawing `K` of `Γ`, the parity of a walk's length determines whether its +endpoints lie on the same side of the bipartition `(Γ.V, K.V \ Γ.V)`, and the number of visits to +`Γ.V` along `W.support` is bounded by `W.length / 2 + 1` (if `a ∈ Γ.V`) or `(W.length + 1) / 2` +(if `a ∉ Γ.V`). -/ +theorem walk_bipartite_parity_and_count {Γ K : Drawing S} + (hP : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + {a b : S} (W : GraphWalk K.toGraph a b) : + (Even W.length ↔ (a ∈ Γ.V ↔ b ∈ Γ.V)) ∧ + by classical exact W.support.countP (· ∈ Γ.V) ≤ + if a ∈ Γ.V then W.length / 2 + 1 else (W.length + 1) / 2 := by + classical + have hbip := bipartite_of_preRadial hP + induction W with + | nil h => + refine ⟨by simp, ?_⟩ + split_ifs with ha <;> simp [ha] + | @cons u v w e hl r ih => + have huv : u ∈ Γ.V ↔ v ∉ Γ.V := hbip e u v hl + obtain ⟨ih_even, ih_count⟩ := ih + constructor + · rw [GraphWalk.length_cons, Nat.even_add_one, ih_even] + tauto + · rw [GraphWalk.support_cons, List.countP_cons, GraphWalk.length_cons] + by_cases hu : u ∈ Γ.V + · have hv : v ∉ Γ.V := huv.mp hu + simp only [hu, hv, decide_true, ↓reduceIte] at ih_count ⊢ + omega + · have hv : v ∈ Γ.V := not_not.mp (huv.not.mp hu) + simp only [hu, hv, decide_false, Bool.false_eq_true, ↓reduceIte] at ih_count ⊢ + omega + +/-- If there is a walk in a radial drawing `K` of `Γ` from `v₀ ∈ r` (`r ∈ Γ.R`, `v₀ ∈ K.V \ Γ.V`) +to `v ∈ Γ.V` of length at most `2 * k`, then `v ∈ regionLineVertices Γ r k`. -/ +theorem mem_regionLineVertices_of_radial_walk {Γ K : Drawing S} + (hP : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + {r : Set S} {v₀ v : S} {k : ℕ} + (hv₀_r : v₀ ∈ r) (hv₀_not : v₀ ∉ Γ.V) (hv : v ∈ Γ.V) + (W : GraphWalk K.toGraph v₀ v) (hWlen : W.length ≤ 2 * k) : + v ∈ regionLineVertices Γ r k := by + classical + obtain ⟨W', hW'_sim, hW'_len, _⟩ := exists_simple_subwalk W + have hv₀_ne_v : v₀ ≠ v := fun h => hv₀_not (h ▸ hv) + have hP_path : (walkDrawing K W').IsPathBetween v₀ v := walkDrawing_isPathBetween K hW'_sim + have hline_ends : IsLineWithEnds (walkDrawing K W').U v₀ v := + GM11.isLine_of_isPathBetween hP_path hv₀_ne_v + obtain ⟨f_line, -⟩ := hline_ends + have hline : IsLine (walkDrawing K W').U := ⟨f_line⟩ + have hSubK : (walkDrawing K W').IsSubdrawing K := walkDrawing_isSubdrawing K W' + have hnorm : (PaintingOrDrawing.drawing Γ).IsNormal (walkDrawing K W').U := by + intro x ⟨hxP, hxΓ⟩ + have hx : x ∈ Γ.U ∩ K.U := ⟨hxΓ, hSubK.U_subset hxP⟩ + have hUU : Γ.U ∩ K.U = Γ.V := hP.1 + rwa [hUU] at hx + have hv₀_U : v₀ ∈ (walkDrawing K W').U := + (walkDrawing K W').V_subset_U (by rw [walkDrawing_V]; exact W'.start_mem_support) + have hv_U : v ∈ (walkDrawing K W').U := + (walkDrawing K W').V_subset_U (by rw [walkDrawing_V]; exact W'.end_mem_support) + have hU_inter_V : (walkDrawing K W').U ∩ Γ.V ⊆ + ((W'.support.filter (· ∈ Γ.V)).toFinset : Set S) := by + intro x ⟨hxU, hxV⟩ + have hxPV : x ∈ (walkDrawing K W').V := + subdrawing_vertex_of_mem_U hSubK hxU (hP.2.1 hxV) + rw [walkDrawing_V] at hxPV + simp only [Finset.mem_coe, List.mem_toFinset, List.mem_filter, decide_eq_true_eq] + exact ⟨hxPV, hxV⟩ + have hcard_le : ((walkDrawing K W').U ∩ Γ.V).ncard ≤ W'.support.countP (· ∈ Γ.V) := by + calc ((walkDrawing K W').U ∩ Γ.V).ncard + _ ≤ ((W'.support.filter (· ∈ Γ.V)).toFinset : Set S).ncard := + ncard_le_ncard hU_inter_V (Finset.finite_toSet _) + _ = (W'.support.filter (· ∈ Γ.V)).length := by + rw [ncard_coe_finset, List.toFinset_card_of_nodup (hW'_sim.filter _)] + _ = W'.support.countP (· ∈ Γ.V) := List.countP_eq_length_filter.symm + obtain ⟨hpar, hcnt⟩ := walk_bipartite_parity_and_count hP W' + simp only [hv₀_not, ↓reduceIte] at hcnt + have hnot_even : ¬ Even W'.length := by + rw [hpar] + intro hiff + exact hv₀_not (hiff.mpr hv) + rw [Nat.not_even_iff_odd] at hnot_even + obtain ⟨m, hm⟩ := hnot_even + have hlen_le : W'.length ≤ 2 * k := hW'_len.trans hWlen + have hdiv_le : (W'.length + 1) / 2 ≤ k := by omega + refine ⟨hv, (walkDrawing K W').U, hline, hnorm, hv_U, ⟨v₀, hv₀_U, hv₀_r⟩, + hcard_le.trans (hcnt.trans hdiv_le)⟩ + +/-- If `W` is a closed walk of `K` of length at most `4 * k` containing `v₀ ∈ r` (`v₀ ∉ Γ.V`) and +`v ∈ Γ.V`, then `v ∈ regionLineVertices Γ r k`. -/ +theorem mem_regionLineVertices_of_closed_walk {Γ K : Drawing S} + (hP : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + {r : Set S} {u v₀ v : S} {k : ℕ} + (hv₀_r : v₀ ∈ r) (hv₀_not : v₀ ∉ Γ.V) + (W : GraphWalk K.toGraph u u) (hWlen : W.length ≤ 4 * k) + (hv₀_W : v₀ ∈ (walkDrawing K W).V) + (hv_W : v ∈ (walkDrawing K W).V) (hv_Γ : v ∈ Γ.V) : + v ∈ regionLineVertices Γ r k := by + rw [walkDrawing_V, mem_ofPred_eq] at hv₀_W hv_W + obtain ⟨W₁, W₂, rfl⟩ := W.exists_append_of_mem hv₀_W + set Rot := W₂.append W₁ + have hRot_len : Rot.length ≤ 4 * k := by + rw [GraphWalk.length_append] at hWlen ⊢ + omega + have hv_Rot : v ∈ Rot.support := by + rw [GraphWalk.mem_support_append] at hv_W ⊢ + exact hv_W.symm + obtain ⟨P₁, P₂, hRot_eq⟩ := Rot.exists_append_of_mem hv_Rot + have hsum : P₁.length + P₂.reverse.length ≤ 4 * k := by + rw [GraphWalk.length_reverse, ← GraphWalk.length_append, ← hRot_eq] + exact hRot_len + rcases le_or_gt P₁.length (2 * k) with hle₁ | hgt₁ + · exact mem_regionLineVertices_of_radial_walk hP hv₀_r hv₀_not hv_Γ P₁ hle₁ + · have hle₂ : P₂.reverse.length ≤ 2 * k := by omega + exact mem_regionLineVertices_of_radial_walk hP hv₀_r hv₀_not hv_Γ P₂.reverse hle₂ + +omit [T2Space S] in +/-- Rotating a closed walk `W` at a vertex `v ∈ W.support` produces a closed walk at `v` with the +same length and the same walk drawing. -/ +theorem rotate_closed_walk [T1Space S] {K : Drawing S} {u v : S} + (W : GraphWalk K.toGraph u u) (hv : v ∈ W.support) : + ∃ V : GraphWalk K.toGraph v v, + V.length = W.length ∧ walkDrawing K V = walkDrawing K W := by + obtain ⟨W₁, W₂, rfl⟩ := W.exists_append_of_mem hv + refine ⟨W₂.append W₁, ?_, Drawing.ext_of_V_E ?_ ?_⟩ + · simp only [GraphWalk.length_append] + omega + · rw [walkDrawing_V, walkDrawing_V] + ext x + simp only [mem_ofPred_eq, GraphWalk.mem_support_append, or_comm] + · rw [walkDrawing_E, walkDrawing_E] + ext e + simp only [mem_ofPred_eq, GraphWalk.edges_append, List.mem_append, or_comm] + +/-- For a restraint `X`, its boundary `subBd X` is preconnected. -/ +theorem isPreconnected_subBd_of_isRestraint (hS : IsClosedSurface S) [ConnectedSpace S] + {K : Drawing S} {ins : Drawing S → Set S} {two_theta : ℕ} {X : Set S} + (hr : IsRestraint K ins two_theta X) : IsPreconnected (subBd X) := by + obtain ⟨_, _, ⟨h, -, -, hrng, -, -⟩, -⟩ := + exists_perimeterWalk hS hr.isClosed hr.isGammaNice hr.isSimplyConnected hr.nonempty hr.ne_univ + rw [← hrng] + exact isPreconnected_range (h.continuous.comp (continuous_id.prodMk continuous_const)) + +/-- The underlying point set `D.U` of a 2-cell drawing `D` in a connected closed surface is +preconnected. -/ +theorem isPreconnected_U_of_isTwoCell (hS : IsClosedSurface S) [ConnectedSpace S] + {D : Drawing S} (h2cell : (PaintingOrDrawing.drawing D).IsTwoCell) : + IsPreconnected D.U := by + rw [isPreconnected_iff_subset_of_fully_disjoint_closed D.isClosed_U] + intro U V hU hV hUV hdisj + let U' := D.U ∩ U + let V' := D.U ∩ V + have hU' : IsClosed U' := D.isClosed_U.inter hU + have hV' : IsClosed V' := D.isClosed_U.inter hV + have hdisj' : Disjoint U' V' := hdisj.mono inter_subset_right inter_subset_right + have hUV' : U' ∪ V' = D.U := by + rw [← inter_union_distrib_left] + exact inter_eq_left.mpr hUV + by_cases hU'ne : U'.Nonempty + · have hV'0 : V' = ∅ := eq_empty_of_split hS h2cell.2 hU' hV' hdisj' hUV' hU'ne + refine Or.inl fun x hx => ?_ + have hx' : x ∈ U' ∪ V' := hUV'.symm ▸ hx + rw [hV'0, union_empty] at hx' + exact hx'.2 + · rw [not_nonempty_iff_eq_empty] at hU'ne + refine Or.inr fun x hx => ?_ + have hx' : x ∈ U' ∪ V' := hUV'.symm ▸ hx + rw [hU'ne, empty_union] at hx' + exact hx'.2 + +/-- In the setting of (7.8), for any edge `e ∈ Γ.E` with `d c e ≤ k < θ` and `(c = e → 2 ≤ k)`, +there is a closed walk `W` of `K` of length at most `2 * k` such that `h ⊆ insWalk ins K W` and +`e ⊆ insWalk ins K W`. -/ +theorem exists_walk_of_edge_dist_le (hS : IsClosedSurface S) [ConnectedSpace S] + {Γ K : Drawing S} {θ k : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {ins : Drawing S → Set S} + (hResp : IsRespectfulDrawingTangle Γ θ T) (hE : Γ.E.Nonempty) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + (hd_eq : ∀ x ∈ Γ.A, ∀ y ∈ Γ.A, d x y = tangleMetric Γ K ins θ x y) + {c h e : Set S} (hc : c ∈ Γ.A) (hh : IsCorrespondingAtom Γ K c h) + (he : e ∈ Γ.E) (hkθ : k < θ) (hd_ce : d c e ≤ k) (hce_k : c = e → 2 ≤ k) : + ∃ (u : S) (W : GraphWalk K.toGraph u u), + W.length ≤ 2 * k ∧ h ⊆ insWalk ins K W ∧ e ⊆ insWalk ins K W := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have heA : e ∈ Γ.A := Or.inl (Or.inr he) + obtain ⟨r_e, hr_e, -⟩ := existsUnique_correspondingAtom hK heA + have her_e : e ⊆ r_e := by + rcases hr_e.2.2 with ⟨v, hv, rfl, -⟩ | ⟨_, _, hsub⟩ | ⟨hr, -⟩ + · exact absurd hv (he.2.1 (mem_singleton v)).2 + · exact hsub + · obtain ⟨p₀, hp₀⟩ := he.1 + exact absurd (he.2.1 hp₀).1 (region_subset hr hp₀) + by_cases hce : c = e + · subst hce + have hk2 : 2 ≤ k := hce_k rfl + have hT := hResp.2.1 + have hcH : c ∈ Γ.toHypergraph.edgeSet := he + have hsep := isSeparation_edgeHypergraph_deleteEdges hcH + have hsize : edgeSize Γ.toHypergraph c ≤ 2 := edgeSize_drawing_le_two he + have hord : separationOrder (edgeHypergraph Γ.toHypergraph c) + (Γ.toHypergraph.deleteEdges {c}) < θ := by + rw [separationOrder_edgeHypergraph_deleteEdges] + omega + have hmemT : (edgeHypergraph Γ.toHypergraph c, Γ.toHypergraph.deleteEdges {c}) ∈ T := + (GM10.theorem_2_7_proof hT.one_le hT.isSeparation hT.order_lt hT.axiom1 hT.axiom2).mp + hT c hcH (by omega) + obtain ⟨C, hC, hCs, hClen, hCV, hcC⟩ := + (theorem_1_1_proof hS hResp hE hK hd hsep hord).mp hmemT c (by simp [edgeHypergraph]) + have hCeven := (circuit_length_eq_two_mul_ncard hK.2.1 hC hCs).1 + have hCV_le : (C.V ∩ Γ.V).ncard ≤ 2 := by + have hsubV : C.V ∩ Γ.V ⊆ Γ.toHypergraph.ends c := + hCV.trans fun x hx => hx.1 + have hends_fin : (Γ.toHypergraph.ends c).Finite := + Γ.toHypergraph.vertexSet_finite.subset fun x hx => Γ.toHypergraph.vertex_mem_of_inc hx + exact (ncard_le_ncard hsubV hends_fin).trans hsize + have hC' : C.IsCircuit := hC + obtain ⟨u₀, W₀, -, -, hV₀, -⟩ := hC' + have hu₀ : u₀ ∈ C.V := hV₀ ▸ W₀.start_mem_support + obtain ⟨W, hWC, hWlen⟩ := circuit_walk_at hC hCs hu₀ + have hWlt : W.length < 2 * θ := hWlen.trans_lt hClen + have hcW : (c ∩ insWalk ins K W).Nonempty := by + obtain ⟨p₀, hp₀⟩ := he.1 + refine ⟨p₀, hp₀, Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, ?_⟩, hcC hp₀⟩)⟩ + rw [hWC] + exact Drawing.IsSubdrawing.refl C + have hhW : h ⊆ insWalk ins K W := + (corresponding_atom_subset_iff hS hK hd hh W hWlt).mpr hcW + have hhr_e : h = r_e := (existsUnique_correspondingAtom hK hc).unique hh hr_e + refine ⟨u₀, W, ?_, hhW, her_e.trans (hhr_e ▸ hhW)⟩ + omega + · classical + rw [hd_eq c hc e heA] at hd_ce + by_cases hex : ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom Γ K c x' ∧ IsCorrespondingAtom Γ K e y' ∧ + W.length < 2 * θ ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W + · simp only [tangleMetric, hce, hex, ↓reduceIte] at hd_ce + set S_k := {m : ℕ | ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom Γ K c x' ∧ IsCorrespondingAtom Γ K e y' ∧ + W.length < 2 * θ ∧ W.length = 2 * m ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W} + have hle' : sInf S_k ≤ k := hd_ce + obtain ⟨u, W, x', y', hx', hy', hWlt, hx'W, hy'W⟩ := hex + obtain ⟨m₀, hm₀⟩ : ∃ m₀, W.length = 2 * m₀ := ⟨_, closed_walk_length_eq_two_mul hK.2.1 W⟩ + have hSk_ne : S_k.Nonempty := ⟨m₀, u, W, x', y', hx', hy', hWlt, hm₀, hx'W, hy'W⟩ + obtain ⟨u₁, W₁, x₁', y₁', hx₁', hy₁', _, hW₁len, hx₁'W, hy₁'W⟩ := Nat.sInf_mem hSk_ne + have hx₁_eq : x₁' = h := (existsUnique_correspondingAtom hK hc).unique hx₁' hh + have hy₁_eq : y₁' = r_e := (existsUnique_correspondingAtom hK heA).unique hy₁' hr_e + refine ⟨u₁, W₁, by omega, hx₁_eq ▸ hx₁'W, her_e.trans (hy₁_eq ▸ hy₁'W)⟩ + · simp only [tangleMetric, hce, hex, ↓reduceIte] at hd_ce + omega + + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section79.lean b/LeanPool/GraphMinor/GM12/Section79.lean new file mode 100644 index 0000000000..a6afb7cf20 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section79.lean @@ -0,0 +1,616 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.GM12.Section4WalkMetric +import LeanPool.GraphMinor.GM11.Section64 +import LeanPool.GraphMinor.GM11.Section7b +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM12.Section4MetricExistence + +/-! +# Graph Minors XII, (7.9): uniqueness and restriction of subdrawing tangles + +This file formalizes **(7.9)** of Graph Minors XII (page 270) using the proved `(2.1)` +via `(7.7)`, `(1.1)` (`GM11.theorem_6_3_of_regionFacts`), and `(1.2)` +(`exists_atom_dist_eq_theta`). +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Function Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-! ## 1. Truncation and subgraph-induction of respectful tangles -/ + +omit [T2Space S] in +/-- If `H` is a 2-cell drawing and `T` is a respectful tangle of order `θ` in `H`, then for any +`1 ≤ θ' ≤ θ`, the truncation `GM10.truncation T θ'` is a respectful tangle of order `θ'` in `H`. -/ +theorem IsRespectfulDrawingTangle.truncation {H : Drawing S} {θ θ' : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (h : IsRespectfulDrawingTangle H θ T) (hpos : 1 ≤ θ') (hle : θ' ≤ θ) : + IsRespectfulDrawingTangle H θ' (GM10.truncation T θ') := by + rcases h with ⟨h2cell, hT, hConn, hResp⟩ + refine ⟨h2cell, hT.truncation hpos hle, hConn, fun F hF hNorm hcard => ?_⟩ + obtain ⟨Δ, hΔ, hbd, hmem⟩ := hResp F hF hNorm (lt_of_lt_of_le hcard hle) + refine ⟨Δ, hΔ, hbd, hmem, ?_⟩ + have hsub : (((PaintingOrDrawing.drawing H).inter Δ) ∩ + ((PaintingOrDrawing.drawing H).interOutside Δ)).vertexSet ⊆ F ∩ H.V := by + rintro x ⟨⟨hxV, hxΔ⟩, ⟨_, hxOut⟩⟩ + refine ⟨?_, hxV⟩ + rw [← hbd, GM11.subBd_eq_frontier, frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] + exact ⟨subset_closure hxΔ, hxOut⟩ + exact lt_of_le_of_lt (ncard_le_ncard hsub (H.finite_V.subset inter_subset_right)) hcard + +private theorem metric_walk_of_lt {H K : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (ins : Drawing S → Set S) {θ : ℕ} {x y : Set S} (hne : x ≠ y) + (hlt : tangleMetric H K ins θ x y < θ) : + ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H K x x' ∧ IsCorrespondingAtom H K y y' ∧ + W.length < 2 * θ ∧ W.length = 2 * tangleMetric H K ins θ x y ∧ + x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W := by + classical + unfold tangleMetric at hlt ⊢ + simp only [hne, ↓reduceIte] at hlt ⊢ + split_ifs at hlt ⊢ with hex + · have hnonempty : {k : ℕ | ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H K x x' ∧ IsCorrespondingAtom H K y y' ∧ + W.length < 2 * θ ∧ W.length = 2 * k ∧ + x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W}.Nonempty := by + obtain ⟨u, W, x', y', hx, hy, hlen, hxW, hyW⟩ := hex + refine ⟨W.support.tail.countP (· ∈ H.V), u, W, x', y', hx, hy, hlen, ?_, hxW, hyW⟩ + exact closed_walk_length_eq_two_mul hK.2.1 W + exact Nat.sInf_mem hnonempty + · exact (Nat.lt_irrefl _ hlt).elim + +/-- Changing the order from `θ` to `θ' ≤ θ` truncates the radial metric at `θ'`. -/ +theorem tangleMetric_truncation {H K : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (ins : Drawing S → Set S) {θ θ' : ℕ} (hle : θ' ≤ θ) (x y : Set S) : + tangleMetric H K ins θ' x y = min (tangleMetric H K ins θ x y) θ' := by + classical + by_cases heq : x = y + · subst y + simp only [tangleMetric, ↓reduceIte, Nat.zero_min] + have hsmall := tangleMetric_le_order hK ins θ' x y + apply le_antisymm + · apply le_min _ hsmall + by_cases hlt : tangleMetric H K ins θ x y < θ' + · obtain ⟨u, W, x', y', hx, hy, _, hlen, hxW, hyW⟩ := + metric_walk_of_lt hK ins heq (hlt.trans_le hle) + exact tangleMetric_le_of_walk hx hy W (by omega) hlen hxW hyW + · exact hsmall.trans (Nat.le_of_not_gt hlt) + · by_cases hlt : tangleMetric H K ins θ' x y < θ' + · obtain ⟨u, W, x', y', hx, hy, hshort, hlen, hxW, hyW⟩ := + metric_walk_of_lt hK ins heq hlt + have hw : W.length < 2 * θ := lt_of_lt_of_le hshort (Nat.mul_le_mul_left 2 hle) + exact (min_le_left _ _).trans (tangleMetric_le_of_walk hx hy W hw hlen hxW hyW) + · exact (min_le_right _ _).trans (Nat.le_of_not_gt hlt) + +/-- Truncation of a respectful drawing tangle cuts off its metric at the new order. -/ +theorem HasTangleMetric.truncation {H : Drawing S} {θ θ' : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (h : HasTangleMetric H θ T d) + (hpos : 1 ≤ θ') (hle : θ' ≤ θ) : + HasTangleMetric H θ' (GM10.truncation T θ') (fun a b => min (d a b) θ') := by + classical + obtain ⟨hresp, K, ins, hK, hins, hd⟩ := h + refine ⟨IsRespectfulDrawingTangle.truncation hresp hpos hle, K, ins, hK, ?_, ?_⟩ + · intro C hC hCK hlen + obtain ⟨hD, hbd, hmem⟩ := hins C hC hCK (lt_of_lt_of_le hlen (Nat.mul_le_mul_left 2 hle)) + refine ⟨hD, hbd, hmem, ?_⟩ + have hsub : (((PaintingOrDrawing.drawing H).inter (ins C)) ∩ + ((PaintingOrDrawing.drawing H).interOutside (ins C))).vertexSet ⊆ C.V ∩ H.V := by + rintro x ⟨⟨hxH, hxD⟩, ⟨_, hxout⟩⟩ + have hxC : x ∈ C.U := hbd ▸ (show x ∈ subBd (ins C) from ⟨subset_closure hxD, hxout⟩) + rw [C.U_eq] at hxC + rcases hxC with hxCV | hxE + · exact ⟨hxCV, hxH⟩ + · obtain ⟨e, heC, hxe⟩ := mem_iUnion₂.mp hxE + have hxK := hK.2.1.2.1 hxH + have hxCV : x ∈ closure e ∩ C.V := by + rw [hCK.closure_inter_V heC] + exact ⟨hxe, hxK⟩ + exact ⟨hxCV.2, hxH⟩ + have hc := (circuit_length_eq_two_mul_ncard hK.2.1 hC hCK).1 + have hcount := ncard_le_ncard hsub (C.finite_V.subset inter_subset_left) + change (((PaintingOrDrawing.drawing H).inter (ins C)) ∩ + ((PaintingOrDrawing.drawing H).interOutside (ins C))).vertexSet.ncard < θ' + omega + · intro a ha b hb + change min (d a b) θ' = _ + rw [hd a ha b hb, tangleMetric_truncation hK ins hle] + +omit [T2Space S] in +private theorem drawing_inter_le (H' : Drawing S) {D : Set S} (hD : IsClosed D) : + (PaintingOrDrawing.drawing H').inter D ≤ H'.toHypergraph := by + refine ⟨inter_subset_left, fun _ h => h.1, fun e he => ?_⟩ + ext v + change (e ∈ H'.E ∧ v ∈ H'.V ∧ v ∈ closure e) ↔ + (e ∈ H'.E ∧ v ∈ H'.V ∧ v ∈ closure e) ∧ e ⊆ D ∧ v ∈ D + exact ⟨fun h => ⟨h, he.2, hD.closure_subset_iff.mpr he.2 h.2.2⟩, fun h => h.1⟩ + +/-- If `H₀` is a subdrawing of `H'` and `T₀` is a respectful tangle of order `θ'` in `H₀`, then +`inducedBySubgraph H'.toHypergraph H₀.toHypergraph θ' T₀` is respectful in `H'`. -/ +theorem isRespectful_inducedBySubgraph {H₀ H' : Drawing S} {θ' : ℕ} + {T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hSub : H₀.IsSubdrawing H') + (hResp₀ : (PaintingOrDrawing.drawing H₀).IsRespectful θ' T₀) : + (PaintingOrDrawing.drawing H').IsRespectful θ' + (inducedBySubgraph H'.toHypergraph H₀.toHypergraph θ' T₀) := by + refine ⟨hResp₀.1, fun F hF hNorm' hcard' => ?_⟩ + have hNorm₀ : (PaintingOrDrawing.drawing H₀).IsNormal F := + isNormal_of_isSubdrawing hSub hNorm' + have hcard₀ : (F ∩ H₀.V).ncard < θ' := + lt_of_le_of_lt + (ncard_le_ncard (inter_subset_inter_right F hSub.1) (H'.finite_V.subset inter_subset_right)) + hcard' + obtain ⟨Δ, hΔ, hbd, hmem₀⟩ := hResp₀.2 F hF hNorm₀ hcard₀ + refine ⟨Δ, hΔ, hbd, ?_, ?_, ?_⟩ + · have hAl : (PaintingOrDrawing.drawing H').inter Δ ≤ H'.toHypergraph := + drawing_inter_le H' hΔ.isClosed + have hBl : (PaintingOrDrawing.drawing H').interOutside Δ ≤ H'.toHypergraph := + drawing_inter_le H' isClosed_closure + refine (isSeparation_iff_of_le hAl hBl).mpr ⟨?_, ?_, ?_⟩ + · ext x + change (x ∈ H'.V ∩ Δ ∨ x ∈ H'.V ∩ closure (univ \ Δ)) ↔ x ∈ H'.V + constructor + · rintro (⟨hx, _⟩ | ⟨hx, _⟩) <;> exact hx + · intro hx + by_cases hxΔ : x ∈ Δ + · exact Or.inl ⟨hx, hxΔ⟩ + · exact Or.inr ⟨hx, subset_closure ⟨mem_univ x, hxΔ⟩⟩ + · ext e + change (e ∈ {e ∈ H'.E | e ⊆ Δ} ∨ e ∈ {e ∈ H'.E | e ⊆ closure (univ \ Δ)}) ↔ e ∈ H'.E + constructor + · rintro (⟨he, _⟩ | ⟨he, _⟩) <;> exact he + · intro he + obtain ⟨x, hxe⟩ := he.1 + have he_pre : IsPreconnected e := + (GM11.PaintingOrDrawing.edge_props (Γ := PaintingOrDrawing.drawing H') he).1 + have hdisF : Disjoint e (frontier Δ) := by + rw [GM11.subBd_eq_frontier' Δ, hbd] + exact disjoint_left.mpr fun y hye hyF => + (he.2.1 hye).2 (hNorm' ⟨hyF, (he.2.1 hye).1⟩) + by_cases hxΔ : x ∈ Δ + · exact Or.inl ⟨he, subset_of_disjoint_frontier + he_pre hΔ.isClosed hdisF hxe hxΔ⟩ + · have hdisF' : Disjoint e (frontier (closure (univ \ Δ))) := by + refine Disjoint.mono_right ?_ hdisF + intro y hy + have hy1 : y ∈ frontier (univ \ Δ) := frontier_closure_subset hy + rwa [← compl_eq_univ_sdiff, frontier_compl] at hy1 + exact Or.inr ⟨he, subset_of_disjoint_frontier + he_pre isClosed_closure hdisF' hxe (subset_closure ⟨mem_univ x, hxΔ⟩)⟩ + · ext e + change (e ∈ {e ∈ H'.E | e ⊆ Δ} ∧ e ∈ {e ∈ H'.E | e ⊆ closure (univ \ Δ)}) ↔ + e ∈ (∅ : Set (Set S)) + simp only [mem_ofPred_eq, mem_empty_iff_false, iff_false] + rintro ⟨⟨he, heΔ⟩, ⟨_, heOut⟩⟩ + obtain ⟨x, hxe⟩ := he.1 + have hxF : x ∈ F := by + rw [← hbd, GM11.subBd_eq_frontier, frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] + exact ⟨subset_closure (heΔ hxe), heOut hxe⟩ + exact (he.2.1 hxe).2 (hNorm' ⟨hxF, (he.2.1 hxe).1⟩) + · have hsub : (((PaintingOrDrawing.drawing H').inter Δ) ∩ + ((PaintingOrDrawing.drawing H').interOutside Δ)).vertexSet ⊆ F ∩ H'.V := by + rintro x ⟨⟨hxV, hxΔ⟩, ⟨_, hxOut⟩⟩ + refine ⟨?_, hxV⟩ + rw [← hbd, GM11.subBd_eq_frontier, frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] + exact ⟨subset_closure hxΔ, hxOut⟩ + exact lt_of_le_of_lt (ncard_le_ncard hsub (H'.finite_V.subset inter_subset_right)) hcard' + · rwa [drawing_inter_inter_subdrawing hSub Δ, drawing_interOutside_inter_subdrawing hSub Δ] + +/-- Every circuit `C` of a pre-radial drawing `K` of `H` has `C.U` an `O`-arc, +`C.length = 2 * (C.U ∩ H.V).ncard`, and `2 ≤ C.length`. -/ +theorem circuit_props_of_preRadial {H K C : Drawing S} + (hP : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) + (hC : C.IsCircuit) (hCs : C.IsSubdrawing K) : + IsOArc C.U ∧ C.length = 2 * (C.U ∩ H.V).ncard ∧ 2 ≤ C.length := by + have hoarc : IsOArc C.U := IsCircuit.isOArc_U hC + obtain ⟨hlen, hne⟩ := circuit_length_eq_two_mul_ncard hP hC hCs + have hUV : C.U ∩ H.V = C.V ∩ H.V := by + refine Subset.antisymm ?_ (inter_subset_inter_left H.V C.V_subset_U) + rintro x ⟨hxCU, hxHV⟩ + exact ⟨(isSubdrawing_U_inter_V hCs).subset ⟨hxCU, hP.2.1 hxHV⟩, hxHV⟩ + rw [hUV] + obtain ⟨x, hxCV, hxHV⟩ := hne + have h1 : 1 ≤ (C.V ∩ H.V).ncard := + (ncard_pos (C.finite_V.subset inter_subset_left)).mpr ⟨x, hxCV, hxHV⟩ + exact ⟨hoarc, hlen, by omega⟩ + +/-- Every respectful tangle `T` of order `θ` in a 2-cell drawing `H` has a derived slope `ins` in +any radial drawing `K` of `H`. -/ +theorem exists_derivedSlope_of_respectful {H K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hResp : IsRespectfulDrawingTangle H θ T) + (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) : + ∃ ins : Drawing S → Set S, IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins := + GM11.exists_derivedSlope_of_preRadial hResp.2.2 hrad + +/-- Every respectful tangle `T` of order `θ` in a 2-cell drawing `H` in a closed surface `S` has a +tangle metric `d` (`HasTangleMetric H θ T d`). -/ +theorem exists_hasTangleMetric (hS : IsClosedSurface S) {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hResp : IsRespectfulDrawingTangle H θ T) : + ∃ d : Set S → Set S → ℕ, HasTangleMetric H θ T d := + exists_metric_of_respectful_drawing_tangle hS hResp + +/-! ## 2. Helper lemmas for (7.9) -/ + +/-- For any 2-cell drawing `H` in a closed surface `S` with a respectful tangle `T` of order `θ ≥ 2` +with metric `d`, and any atom `z ∈ H.A`, there exists an atom `b ∈ H.A` with `d z b = θ` +(Graph Minors XII, (1.2), page 242). -/ +theorem exists_atom_dist_eq_theta (hS : IsClosedSurface S) [ConnectedSpace S] + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hMetric : HasTangleMetric H θ T d) (hθ : 2 ≤ θ) + {z : Set S} (hz : z ∈ H.A) : + ∃ b ∈ H.A, d z b = θ := by + have hE : H.E.Nonempty := edgeSet_nonempty_of_isTangle_of_two_le hMetric.1.2.1 hθ + obtain ⟨e, he, hDist⟩ := exists_edge_for_metric_eq_order hS inferInstance hMetric hE hz + by_cases hze : z = e + · have hEnds : (closure e ∩ H.V).Nonempty := by + rcases H.edge_cond e he with ⟨u, v, _, hcl, _⟩ | ⟨u, hcl, _⟩ + · exact ⟨u, by rw [hcl]; simp⟩ + · exact ⟨u, by rw [hcl]; simp⟩ + obtain ⟨u, hu⟩ := hEnds + have huA : ({u} : Set S) ∈ H.A := Or.inl (Or.inl ⟨u, hu.2, rfl⟩) + have hne : z ≠ {u} := fun h => + (he.2.1 ((hze.symm.trans h).symm ▸ mem_singleton u)).2 hu.2 + exact ⟨{u}, huA, hDist _ huA hne (Or.inr hze)⟩ + · have heA : e ∈ H.A := Or.inl (Or.inr he) + exact ⟨e, heA, hDist _ heA hze (Or.inl rfl)⟩ + +/-- By `(2.1)`, if `F` is a `Γ'`-normal `O`-arc with `(F ∩ Γ'.V).ncard < θ'` and `Δ` is its inside +disc with respect to `(T', d')`, then any two atoms `a', b' ∈ Γ'.A` meeting `Δ` have +`d' a' b' ≤ (F ∩ Γ'.V).ncard`. -/ +theorem dist_le_of_oarc_disc + (hS : IsClosedSurface S) [ConnectedSpace S] + {Γ' : Drawing S} {θ' : ℕ} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d' : Set S → Set S → ℕ} + (hd' : HasTangleMetric Γ' θ' T' d') + {F Δ : Set S} (hF : IsOArc F) + (hF_norm : (PaintingOrDrawing.drawing Γ').IsNormal F) + (hcard : (F ∩ Γ'.V).ncard < θ') + (hΔ : IsClosedDisc Δ) (hbd : subBd Δ = F) + (hmem : ((PaintingOrDrawing.drawing Γ').inter Δ, + (PaintingOrDrawing.drawing Γ').interOutside Δ) ∈ T') + {a' b' : Set S} (ha' : a' ∈ Γ'.A) (hb' : b' ∈ Γ'.A) + (ha'Δ : (a' ∩ Δ).Nonempty) (hb'Δ : (b' ∩ Δ).Nonempty) : + d' a' b' ≤ (F ∩ Γ'.V).ncard := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + by_cases hab' : a' = b' + · subst hab' + rw [metric_self hd' ha'] + exact Nat.zero_le _ + obtain ⟨hResp', K', ins', hrad', hslope', hd'_eq⟩ := id hd' + obtain ⟨e⟩ := id hF + let φ : C(Circle, S) := ⟨fun z => (e z).1, continuous_subtype_val.comp e.continuous⟩ + have hφ_inj : Function.Injective φ := Subtype.val_injective.comp e.injective + have hran : range φ = F := by + ext x + constructor + · rintro ⟨z, rfl⟩ + exact (e z).2 + · intro hx + exact ⟨e.symm ⟨x, hx⟩, by simp [φ]⟩ + have hhit_eq : φ '' {z : Circle | φ z ∈ Γ'.U} = F ∩ Γ'.U := by + ext x + simp only [mem_image, mem_ofPred_eq, mem_inter_iff] + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨(e z).2, hz⟩ + · rintro ⟨hxF, hxU⟩ + exact ⟨e.symm ⟨x, hxF⟩, by simpa [φ] using hxU, by simp [φ]⟩ + have hFU_eq : F ∩ Γ'.U = F ∩ Γ'.V := by + refine Subset.antisymm (fun x hx => ⟨hx.1, hF_norm hx⟩) + (inter_subset_inter_right F Γ'.V_subset_U) + have hhit_fin : {z : Circle | φ z ∈ Γ'.U}.Finite := by + refine Finite.of_finite_image ?_ hφ_inj.injOn + rw [hhit_eq, hFU_eq] + exact Γ'.finite_V.subset inter_subset_right + have hnormφ : IsNormalCurve Γ' φ := ⟨hhit_fin, by rwa [hran]⟩ + have hclen : curveLength Γ' φ = (F ∩ Γ'.V).ncard := by + unfold curveLength + rw [← ncard_image_of_injective _ hφ_inj, hhit_eq, hFU_eq] + have hclen_lt : curveLength Γ' φ < θ' := hclen.symm ▸ hcard + have h21_app := theorem_2_1_statement S hS Γ' K' θ' T' ins' hrad' hResp'.2.1.one_le hResp'.2.1 + hResp'.2.2 + hslope' φ hnormφ hclen_lt + obtain ⟨⟨v, W', htr'⟩, h21_prop⟩ := h21_app + obtain ⟨hW'_lt, h21_disc⟩ := h21_prop v W' htr' + have hW'_len : W'.length = 2 * curveLength Γ' φ := by + rcases htr'.2 with ⟨h0, hW0, -⟩ | ⟨-, hW2, -⟩ + · rw [h0, hW0] + · exact hW2 + have ha'W : (a' ∩ insWalk ins' K' W').Nonempty := + h21_disc a' ha' F Δ hF (by rw [hran]) hΔ hbd hmem ha'Δ + have hb'W : (b' ∩ insWalk ins' K' W').Nonempty := + h21_disc b' hb' F Δ hF (by rw [hran]) hΔ hbd hmem hb'Δ + obtain ⟨a'_K, ha'_K, -⟩ := existsUnique_correspondingAtom' hrad' ha' + obtain ⟨b'_K, hb'_K, -⟩ := existsUnique_correspondingAtom' hrad' hb' + have ha'_sub : a'_K ⊆ insWalk ins' K' W' := + (corresponding_atom_subset_iff hS hrad' hslope' ha'_K W' hW'_lt).mpr ha'W + have hb'_sub : b'_K ⊆ insWalk ins' K' W' := + (corresponding_atom_subset_iff hS hrad' hslope' hb'_K W' hW'_lt).mpr hb'W + rw [hd'_eq a' ha' b' hb', ← hclen] + exact tangleMetric_le_of_walk ha'_K hb'_K W' hW'_lt hW'_len ha'_sub hb'_sub + +/-- If `H₁` is a 2-cell drawing in a closed surface `S` with `H₁.E = ∅`, then `H₁.V.ncard ≤ 1`. -/ +theorem ncard_V_le_one_of_E_empty [ConnectedSpace S] + (hS : IsClosedSurface S) {H₁ : Drawing S} (h2cell : (PaintingOrDrawing.drawing H₁).IsTwoCell) + (hE : H₁.E = ∅) : H₁.V.ncard ≤ 1 := by + classical + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + by_contra hgt + have h1lt : 1 < H₁.V.ncard := Nat.lt_of_not_le hgt + obtain ⟨x, z, hx, hz, hxz⟩ := (Set.one_lt_ncard_iff H₁.finite_V).mp h1lt + let Bad : Set S := H₁.V \ {x} + have hBad : IsClosed Bad := (H₁.finite_V.subset sdiff_subset).isClosed + have hxBad : x ∉ Bad := fun h => h.2 rfl + obtain ⟨D, D', hD, hD', hxD', hD'D, hDO, hbdD⟩ := + exists_closedDisc_nbhd hS hBad.isOpen_compl hxBad + have hU_eq : H₁.U = H₁.V := by rw [H₁.U_eq, hE]; simp + have hbdU : Disjoint (discBd D) H₁.U := by + refine disjoint_left.mpr fun y hy hyU => ?_ + have hyD : y ∈ D := GM11.discBd_subset D hy + have hyx : y ≠ x := fun h => (hbdD ▸ hy).2 (h ▸ hxD') + exact hDO hyD ⟨hU_eq ▸ hyU, hyx⟩ + have hF := hD.isOArc_discBd + have hbdne : (discBd D).Nonempty := by obtain ⟨φ⟩ := hF; exact ⟨_, (φ 1).2⟩ + have hbdconn : IsPreconnected (discBd D) := by + obtain ⟨φ⟩ := hF + have : discBd D = range fun w => (φ w).1 := by + ext y + exact ⟨fun hy => ⟨φ.symm ⟨y, hy⟩, by simp⟩, by rintro ⟨w, rfl⟩; exact (φ w).2⟩ + rw [this] + exact isPreconnected_range (by fun_prop) + obtain ⟨y, hy⟩ := hbdne + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem (disjoint_left.mp hbdU hy) + have hsub : discBd D ⊆ r := subset_region hr hbdconn hbdU hy hyr + obtain ⟨Δ, hΔr, hΔ, hb⟩ := GM11.exists_disc_in_openDisc (h2cell.2 r hr) hF hsub + have hxΔ : x ∉ Δ := fun h => region_subset hr (hΔr h) (H₁.V_subset_U hx) + have hcov := GM11.cover_of_discBd_eq hS hD hΔ hb.symm fun h => hxΔ (h ▸ hD'D hxD') + have hzU : z ∈ H₁.U := H₁.V_subset_U hz + rcases (hcov ▸ mem_univ z : z ∈ D ∪ Δ) with h | h + · exact hDO h ⟨hz, hxz.symm⟩ + · exact region_subset hr (hΔr h) hzU + +/-! ## 3. Proof of (7.9) -/ + +/-- Second claim of **(7.9)**: uniqueness of the respectful tangle `T'` of order `θ - k` in `Γ'` +whose metric `d'` satisfies `d'(a', b') ≥ d(a, b) - k`. -/ +theorem theorem_7_9_unique + (hS : IsClosedSurface S) [ConnectedSpace S] + {Γ Γ' : Drawing S} {θ k : ℕ} + {T T' T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' d'' : Set S → Set S → ℕ} + (hd : HasTangleMetric Γ θ T d) + (hSub : Γ'.IsSubdrawing Γ) + (hk : k < θ) + (hd' : HasTangleMetric Γ' (θ - k) T' d') + (hge' : ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → d a b - k ≤ d' a' b') + (hd'' : HasTangleMetric Γ' (θ - k) T'' d'') + (hge'' : ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → d a b - k ≤ d'' a' b') : + T'' = T' := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hResp', K', ins', hK', hins', _⟩ := id hd' + obtain ⟨ins'', hins''⟩ := exists_derivedSlope_of_respectful hd''.1 hK'.2.1 + have hCircEq : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing K' → + C.length < 2 * (θ - k) → ins' C = ins'' C := by + intro C hC hCs hlen + obtain ⟨hoarc, hlen_eq, h2le⟩ := circuit_props_of_preRadial hK'.2.1 hC hCs + have hcard_lt : (C.U ∩ Γ'.V).ncard < θ - k := by omega + have hθ2 : 2 ≤ θ := by omega + have hnorm' : (PaintingOrDrawing.drawing Γ').IsNormal C.U := by + rintro x ⟨hxC, hxH⟩ + have : x ∈ (PaintingOrDrawing.drawing Γ').U ∩ K'.U := ⟨hxH, hCs.U_subset hxC⟩ + rwa [hK'.2.1.1] at this + obtain ⟨v, W_C, _, _, hCV, _⟩ := id hC + have hvU : v ∈ C.U := C.V_subset_U (hCV ▸ W_C.start_mem_support) + obtain ⟨a, ha, hva⟩ := GM11.exists_atom Γ v + obtain ⟨b, hb, hd_ab⟩ := exists_atom_dist_eq_theta hS hd hθ2 ha + obtain ⟨σ, hσb⟩ := atom_nonempty' hb + obtain ⟨a', ha', haa'⟩ := exists_atom_superset_of_isSubdrawing hSub ha + obtain ⟨b', hb', hbb'⟩ := exists_atom_superset_of_isSubdrawing hSub hb + have hd'_ge : θ - k ≤ d' a' b' := by + have := hge' a ha b hb a' ha' b' hb' haa' hbb' + omega + have hd''_ge : θ - k ≤ d'' a' b' := by + have := hge'' a ha b hb a' ha' b' hb' haa' hbb' + omega + obtain ⟨hD₁, hbd₁, hmem₁⟩ := hins' C hC hCs hlen + obtain ⟨hD₂, hbd₂, hmem₂⟩ := hins'' C hC hCs hlen + have hv_D₁ : v ∈ ins' C := by + have : v ∈ subBd (ins' C) := hbd₁ ▸ hvU + exact hD₁.isClosed.closure_eq ▸ this.1 + have hv_D₂ : v ∈ ins'' C := by + have : v ∈ subBd (ins'' C) := hbd₂ ▸ hvU + exact hD₂.isClosed.closure_eq ▸ this.1 + have ha'_D₁ : (a' ∩ ins' C).Nonempty := ⟨v, haa' hva, hv_D₁⟩ + have ha'_D₂ : (a' ∩ ins'' C).Nonempty := ⟨v, haa' hva, hv_D₂⟩ + have hσ_not_D₁ : σ ∉ ins' C := fun hσ₁ => by + have hb'_D₁ : (b' ∩ ins' C).Nonempty := ⟨σ, hbb' hσb, hσ₁⟩ + have hle := dist_le_of_oarc_disc hS hd' hoarc hnorm' hcard_lt hD₁ hbd₁ hmem₁ + ha' hb' ha'_D₁ hb'_D₁ + omega + have hσ_not_D₂ : σ ∉ ins'' C := fun hσ₂ => by + have hb'_D₂ : (b' ∩ ins'' C).Nonempty := ⟨σ, hbb' hσb, hσ₂⟩ + have hle := dist_le_of_oarc_disc hS hd'' hoarc hnorm' hcard_lt hD₂ hbd₂ hmem₂ + ha' hb' ha'_D₂ hb'_D₂ + omega + by_contra hne + have hdb : discBd (ins' C) = discBd (ins'' C) := by + rw [← GM11.IsClosedDisc.frontier_eq_discBd hS hD₁, + ← GM11.IsClosedDisc.frontier_eq_discBd hS hD₂, + GM11.subBd_eq_frontier', GM11.subBd_eq_frontier', hbd₁, hbd₂] + have hcov := GM11.cover_of_discBd_eq hS hD₁ hD₂ hdb hne + rcases (hcov ▸ mem_univ σ : σ ∈ ins' C ∪ ins'' C) with h | h + · exact hσ_not_D₁ h + · exact hσ_not_D₂ h + have hT' : IsTangle Γ'.toHypergraph (θ - k) T' := hResp'.2.1 + have hT'' : IsTangle Γ'.toHypergraph (θ - k) T'' := hd''.1.2.1 + have hPre' : IsPretangle (PaintingOrDrawing.drawing Γ').toHypergraph (θ - k) T' := + ⟨hT'.one_le, hT'.isSeparation, hT'.order_lt, hT'.axiom1, hT'.axiom2⟩ + have hPre'' : IsPretangle (PaintingOrDrawing.drawing Γ').toHypergraph (θ - k) T'' := + ⟨hT''.one_le, hT''.isSeparation, hT''.order_lt, hT''.axiom1, hT''.axiom2⟩ + have hsub_tangle : ∀ {U₁ U₂ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins₁ ins₂ : Drawing S → Set S}, + IsTangle Γ'.toHypergraph (θ - k) U₁ → + IsTangle Γ'.toHypergraph (θ - k) U₂ → + IsPretangle (PaintingOrDrawing.drawing Γ').toHypergraph (θ - k) U₁ → + IsPretangle (PaintingOrDrawing.drawing Γ').toHypergraph (θ - k) U₂ → + IsDerivedSlope (PaintingOrDrawing.drawing Γ') K' (θ - k) U₁ ins₁ → + IsDerivedSlope (PaintingOrDrawing.drawing Γ') K' (θ - k) U₂ ins₂ → + (∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing K' → + C.length < 2 * (θ - k) → ins₁ C = ins₂ C) → + U₁ ⊆ U₂ := by + intro U₁ U₂ ins₁ ins₂ hU₁ hU₂ hPU₁ hPU₂ hins₁ hins₂ hCEq + by_cases hE : Γ'.E.Nonempty + · have hf : GM11.RegionFacts (PaintingOrDrawing.drawing Γ') K' := + GM11.regionFacts_of_radial ⟨hK'.1, hK'.2.1⟩ hS hK'.2.2 hE + have h63_1 := (GM11.theorem_6_3_of_regionFacts hS hPU₁ hK'.2.1 hins₁ hf).1 + have h63_2 := (GM11.theorem_6_3_of_regionFacts hS hPU₂ hK'.2.1 hins₂ hf).1 + rintro ⟨A, B⟩ hAB + have hsep := hU₁.isSeparation hAB + have hord := hU₁.order_lt hAB + obtain ⟨m, C, hC, hin⟩ := (h63_1 A B hsep hord).mp hAB + refine (h63_2 A B hsep hord).mpr ⟨m, C, hC, fun e he => ?_⟩ + obtain ⟨i, hi⟩ := hin e he + obtain ⟨hc, hs, hl, _⟩ := hC i + rw [hCEq (C i) hc hs hl] at hi + exact ⟨i, hi⟩ + · have hE_empty : Γ'.E = ∅ := Set.not_nonempty_iff_eq_empty.mp hE + have hV_le : Γ'.V.ncard ≤ 1 := ncard_V_le_one_of_E_empty hS hK'.1 hE_empty + have hord_le : θ - k ≤ 1 := hU₁.order_le_ncard_vertexSet.trans hV_le + rintro ⟨A, B⟩ hAB + have hsep := hU₁.isSeparation hAB + have hVA_empty : A.vertexSet = ∅ := by + by_contra hne + obtain ⟨x, hxA⟩ := Set.nonempty_iff_ne_empty.mpr hne + have hxV : x ∈ Γ'.V := hsep.left_le.vertexSet_subset hxA + have hV_eq : Γ'.V = {x} := by + apply Set.Subset.antisymm _ (Set.singleton_subset_iff.mpr hxV) + intro y hy + by_contra hyx + have hxy_ne : x ≠ y := fun h => hyx (h.symm ▸ Set.mem_singleton x) + have h2 : ({x, y} : Set S).ncard = 2 := Set.ncard_pair hxy_ne + have hsub : ({x, y} : Set S) ⊆ Γ'.V := by + rintro w (rfl | rfl) + · exact hxV + · exact hy + have := Set.ncard_le_ncard hsub Γ'.finite_V + omega + have hVA : A.vertexSet = Γ'.V := + Set.Subset.antisymm hsep.left_le.vertexSet_subset (hV_eq ▸ Set.singleton_subset_iff.mpr + hxA) + exact hU₁.axiom3 hAB hVA + have hVB_eq : B.vertexSet = Γ'.V := by + have := hsep.vertexSet_union + rwa [hVA_empty, Set.empty_union] at this + have hord₂ : separationOrder A B < θ - k := hU₁.order_lt hAB + exact (hU₂.axiom1 hsep hord₂).resolve_right fun hBA => hU₂.axiom3 hBA hVB_eq + exact Subset.antisymm + (hsub_tangle hT'' hT' hPre'' hPre' hins'' hins' fun C hC hCs hlen => + (hCircEq C hC hCs hlen).symm) + (hsub_tangle hT' hT'' hPre' hPre'' hins' hins'' hCircEq) + +/-- **(7.9)** of Graph Minors XII (page 270): +"Let $k \ge 0$ be an integer. Let $\mathscr{T}$ be a respectful tangle of order $\theta > k$ +in a 2-cell drawing $\Gamma$ in a connected surface $\Sigma$; let its metric be $d$. Let +$\Gamma'$ be a 2-cell subdrawing of $\Gamma$, and let $\mathscr{T}'$ be a respectful tangle +of order $\theta - k$ in $\Gamma'$, with metric $d'$, such that $d'(a', b') \ge d(a, b) - k$ +for all $a, b \in A(\Gamma)$ and $a', b' \in A(\Gamma')$ with $a \subseteq a'$ and $b +\subseteq b'$. Then $(A \cap \Gamma', B \cap \Gamma') \in \mathscr{T}'$ for all $(A, B) \in +\mathscr{T}$ of order $< \theta - k$. Moreover, if $\mathscr{T}''$ is another respectful +tangle of order $\theta - k$ in $\Gamma'$, with metric $d''$, and again $d''(a', b') \ge +d(a, b) - k$ for all $a, b \in A(\Gamma)$ and $a', b' \in A(\Gamma')$ with $a \subseteq a'$ +and $b \subseteq b'$, then $\mathscr{T}'' = \mathscr{T}'$." -/ +theorem theorem_7_9_proof + (hS : IsClosedSurface S) [ConnectedSpace S] + {Γ Γ' : Drawing S} {θ k : ℕ} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} + (hd : HasTangleMetric Γ θ T d) + (hSub : Γ'.IsSubdrawing Γ) + (h2cell' : (PaintingOrDrawing.drawing Γ').IsTwoCell) + (hk : k < θ) + (hd' : HasTangleMetric Γ' (θ - k) T' d') + (hge' : ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → d a b - k ≤ d' a' b') : + (∀ A B : Hypergraph S (Set S), + (A, B) ∈ T → separationOrder A B < θ - k → + (A ∩ Γ'.toHypergraph, B ∩ Γ'.toHypergraph) ∈ T') ∧ + (∀ (T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (d'' : Set S → Set S → ℕ), + HasTangleMetric Γ' (θ - k) T'' d'' → + (∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → d a b - k ≤ d'' a' b') → + T'' = T') := by + refine ⟨?_, fun T'' d'' hd'' hge'' => + theorem_7_9_unique hS hd hSub hk hd' hge' hd'' hge''⟩ + let T₁ := inducedBySubgraph Γ.toHypergraph Γ'.toHypergraph (θ - k) T' + let T₂ := GM10.truncation T (θ - k) + have hSubHyp : Γ'.toHypergraph ≤ Γ.toHypergraph := toHypergraph_le_of_isSubdrawing hSub + have hT₁ : IsTangle Γ.toHypergraph (θ - k) T₁ := + inducedBySubgraph_isTangle hSubHyp hd'.1.2.1 + have hResp₁ : (PaintingOrDrawing.drawing Γ).IsRespectful (θ - k) T₁ := + isRespectful_inducedBySubgraph hSub hd'.1.2.2 + have hRDT₁ : IsRespectfulDrawingTangle Γ (θ - k) T₁ := + ⟨hd.1.1, hT₁, hResp₁⟩ + obtain ⟨d₁, hd₁⟩ := exists_hasTangleMetric hS hRDT₁ + have h77_ii := (theorem_7_7_proof hS hd₁ hSub h2cell' le_rfl hd').2 rfl rfl + have hge₁ : ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ.A, ∀ b' ∈ Γ.A, + a ⊆ a' → b ⊆ b' → d a b - k ≤ d₁ a' b' := by + intro a ha b hb a' ha' b' hb' haa' hbb' + obtain ⟨x, hxa⟩ := atom_nonempty' ha + obtain ⟨y, hyb⟩ := atom_nonempty' hb + have ha_eq : a' = a := atom_eq_of_inter_nonempty ha' ha ⟨x, haa' hxa, hxa⟩ + have hb_eq : b' = b := atom_eq_of_inter_nonempty hb' hb ⟨y, hbb' hyb, hyb⟩ + rw [ha_eq, hb_eq] + obtain ⟨a₁, ha₁, haa₁⟩ := exists_atom_superset_of_isSubdrawing hSub ha + obtain ⟨b₁, hb₁, hbb₁⟩ := exists_atom_superset_of_isSubdrawing hSub hb + exact (hge' a ha b hb a₁ ha₁ b₁ hb₁ haa₁ hbb₁).trans + (h77_ii a ha b hb a₁ ha₁ b₁ hb₁ haa₁ hbb₁) + have hd₂ : HasTangleMetric Γ (θ - k) T₂ (fun a b => min (d a b) (θ - k)) := + HasTangleMetric.truncation hd (by omega) (Nat.sub_le θ k) + have hge₂ : ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ.A, ∀ b' ∈ Γ.A, + a ⊆ a' → b ⊆ b' → d a b - k ≤ min (d a' b') (θ - k) := by + intro a ha b hb a' ha' b' hb' haa' hbb' + obtain ⟨x, hxa⟩ := atom_nonempty' ha + obtain ⟨y, hyb⟩ := atom_nonempty' hb + have ha_eq : a' = a := atom_eq_of_inter_nonempty ha' ha ⟨x, haa' hxa, hxa⟩ + have hb_eq : b' = b := atom_eq_of_inter_nonempty hb' hb ⟨y, hbb' hyb, hyb⟩ + rw [ha_eq, hb_eq] + obtain ⟨_, K, ins, hK, _, hd_eq⟩ := id hd + have hle_θ : d a b ≤ θ := by + rw [hd_eq a ha b hb] + exact tangleMetric_le_order hK ins θ a b + exact le_min (Nat.sub_le _ _) (by omega) + have hT₁_eq_T₂ : T₂ = T₁ := + theorem_7_9_unique hS hd (Drawing.IsSubdrawing.refl Γ) hk hd₁ hge₁ hd₂ hge₂ + intro A B hAB hord + have hmem₂ : (A, B) ∈ T₂ := ⟨hAB, hord⟩ + rw [hT₁_eq_T₂] at hmem₂ + exact hmem₂.2.2 + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/Section7Proved.lean b/LeanPool/GraphMinor/GM12/Section7Proved.lean new file mode 100644 index 0000000000..37db5f13e6 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/Section7Proved.lean @@ -0,0 +1,608 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Section78 +import LeanPool.GraphMinor.GM12.Section75Proof +import LeanPool.GraphMinor.GM11.Section64 +import LeanPool.GraphMinor.GM11.Section91 +import LeanPool.GraphMinor.GM11.CitedResults + +/-! +# Graph Minors XII, (7.6) and (7.8) + +Use the proved (7.5) in the induction deleting vertices near a region, then apply +that induction to the edge deletion in (7.8). The preliminary metric lemmas remain +in Sections 76 and 78, since the proof of (7.5) uses them too. +-/ + +public section + +namespace GraphMinor.GM12 + +open Set Function Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +private theorem isPreconnected_of_isLine {F : Set S} (hF : IsLine F) : IsPreconnected F := by + obtain ⟨e⟩ := hF + have heq : F = range fun t : unitInterval => (e t).1 := by + ext x + exact ⟨fun hx => ⟨e.symm ⟨x, hx⟩, by simp⟩, by rintro ⟨t, rfl⟩; exact (e t).2⟩ + rw [heq] + exact isPreconnected_range (continuous_subtype_val.comp e.continuous) + +omit [T2Space S] in +private theorem frontier_region_subset_U [LocallyConnectedSpace S] + {Γ : Drawing S} {r : Set S} (hr : r ∈ Γ.R) : frontier r ⊆ Γ.U := by + intro x hx + by_contra hxU + have hx_compl : x ∈ univ \ Γ.U := ⟨mem_univ x, hxU⟩ + have hopen : IsOpen (connectedComponentIn (univ \ Γ.U) x) := + IsOpen.connectedComponentIn (isOpen_univ.sdiff Γ.isClosed_U) + obtain ⟨y, hy_cc, hy_r⟩ := + mem_closure_iff.mp hx.1 (connectedComponentIn (univ \ Γ.U) x) hopen + (mem_connectedComponentIn hx_compl) + have hcc_R : connectedComponentIn (univ \ Γ.U) x ∈ Γ.R := + (mem_R_iff Γ).mpr ⟨x, hxU, rfl⟩ + have heq : connectedComponentIn (univ \ Γ.U) x = r := + atom_eq_of_inter_nonempty (Or.inr hcc_R) (Or.inr hr) ⟨y, hy_cc, hy_r⟩ + have hxr : x ∈ r := heq ▸ mem_connectedComponentIn hx_compl + exact hx.2 ((region_isOpen hr).interior_eq.symm ▸ hxr) + +/-- **(7.6)** of Graph Minors XII (page 266): +"(7.6) *Let $k \ge 0$ be an integer, and let $\mathscr{T}$ be a respectful tangle of order +$\theta \ge 2k + 1$ in a 2-cell drawing $\Gamma$ in a connected surface $\Sigma$. Let its metric be +$d$. Let $r$ be a region of $\Gamma$, and let $Z$ be the set of all vertices $v$ of $\Gamma$ such +that there is a $\Gamma$-normal line $F$ with $v \in F$, $F \cap r \ne \emptyset$ and +$|F \cap V(\Gamma)| \le k$. Then there is a 2-cell subdrawing $\Gamma'$ of $\Gamma \setminus Z$, and +a respectful tangle $\mathscr{T}'$ of order $\theta - 2k$ in $\Gamma'$, with metric $d'$, such that +if $r'$ is the region of $\Gamma'$ with $r \subseteq r'$, then* +$$ +\begin{aligned} +\text{(i)} \quad & U(\Gamma) \subseteq U(\Gamma') \cup r' \\ +\text{(ii)} \quad & d'(a, b) \ge d(a, b) - 4k \text{ for all } a, b \in A(\Gamma) \cap A(\Gamma') \\ +\text{(iii)} \quad & d'(a, r') \ge d(a, r) - 2k \text{ for all } a \in A(\Gamma) \cap A(\Gamma'), +\text{ and} \\ +\text{(iv)} \quad & d(a, r) \le 2k + 1 \text{ for all } a \in A(\Gamma) \text{ with } a \subseteq +r'. +\end{aligned} +$$ +*In particular, if $a, b \in A(\Gamma)$ and $a', b' \in A(\Gamma')$ with $a \subseteq a'$ and +$b \subseteq b'$, then $d'(a', b') \ge d(a, b) - 4k - 2$.*" -/ +theorem theorem_7_6_proof + (hS : IsClosedSurface S) [ConnectedSpace S] + {Γ : Drawing S} {θ : ℕ} (k : ℕ) + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {r : Set S} + (hθ : 2 * k + 1 ≤ θ) + (hd : HasTangleMetric Γ θ T d) + (hr : r ∈ Γ.R) : + ∃ (Γ' : Drawing S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r' : Set S), + Γ'.IsSubdrawing (deleteVertices Γ (regionLineVertices Γ r k)) ∧ + (PaintingOrDrawing.drawing Γ').IsTwoCell ∧ + HasTangleMetric Γ' (θ - 2 * k) T' d' ∧ + r' ∈ Γ'.R ∧ r ⊆ r' ∧ + Γ.U ⊆ Γ'.U ∪ r' ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 4 * k ≤ d' a b) ∧ + (∀ a ∈ Γ.A ∩ Γ'.A, d a r - 2 * k ≤ d' a r') ∧ + (∀ a ∈ Γ.A, a ⊆ r' → d a r ≤ 2 * k + 1) ∧ + (∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → d a b - 4 * k - 2 ≤ d' a' b') := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + induction k generalizing Γ θ T d r with + | zero => + have hZ_empty : regionLineVertices Γ r 0 = ∅ := by + ext v + simp only [regionLineVertices, mem_ofPred_eq, mem_empty_iff_false, iff_false, not_and, + not_exists] + intro hv F _ _ hvF _ hcard0 + have hpos : 0 < (F ∩ Γ.V).ncard := + (ncard_pos (Γ.finite_V.subset inter_subset_right)).mpr ⟨v, hvF, hv⟩ + omega + have hSub0 : Γ.IsSubdrawing (deleteVertices Γ (regionLineVertices Γ r 0)) := by + rw [hZ_empty, isSubdrawing_deleteVertices_iff] + exact ⟨Drawing.IsSubdrawing.refl Γ, disjoint_empty _⟩ + have h_i : Γ.U ⊆ Γ.U ∪ r := subset_union_left + have h_ii : ∀ a ∈ Γ.A ∩ Γ.A, ∀ b ∈ Γ.A ∩ Γ.A, d a b - 4 * 0 ≤ d a b := + fun _ _ _ _ => Nat.sub_le _ _ + have h_iii : ∀ a ∈ Γ.A ∩ Γ.A, d a r - 2 * 0 ≤ d a r := + fun _ _ => Nat.sub_le _ _ + have h_iv : ∀ a ∈ Γ.A, a ⊆ r → d a r ≤ 2 * 0 + 1 := by + intro a ha har + obtain ⟨x, hxa⟩ := atom_nonempty' ha + have heq : a = r := atom_eq_of_inter_nonempty ha (Or.inr hr) ⟨x, hxa, har hxa⟩ + subst heq + rw [metric_self hd (Or.inr hr)] + omega + refine ⟨Γ, T, d, r, hSub0, hd.1.1, by simpa using hd, hr, Subset.rfl, h_i, h_ii, h_iii, h_iv, + fun a ha b hb a' ha' b' hb' haa' hbb' => + theorem_7_6_in_particular hS hd (by simpa using hd) (Drawing.IsSubdrawing.refl Γ) hr hr + h_i h_ii h_iii h_iv ha hb ha' hb' haa' hbb'⟩ + | succ k ih => + have hθ3 : 3 ≤ θ := by omega + obtain ⟨Γ'', T'', d'', r'', hSub'', h2cell'', hd'', hr'', hr_sub'', + hU'', hd''_ab, hd''_ar, hd_le3⟩ := theorem_7_5_proof S hS Γ θ T d r hθ3 hd hr + obtain ⟨hSubΓ'', hDisjY⟩ := isSubdrawing_deleteVertices_iff.mp hSub'' + have hθ'' : 2 * k + 1 ≤ θ - 2 := by omega + obtain ⟨Γ', T', d', r', hSub', h2cell', hd', hr', hr''_sub', + hU', hd'_ab, hd'_ar'', hd''_le, _⟩ := ih hθ'' hd'' hr'' + obtain ⟨hSubΓ'Γ'', hDisjZ''⟩ := isSubdrawing_deleteVertices_iff.mp hSub' + have hSubΓ'Γ : Γ'.IsSubdrawing Γ := hSubΓ'Γ''.trans hSubΓ'' + -- Any vertex in `regionLineVertices Γ r (k + 1) ∩ Γ''.V` belongs to `regionLineVertices Γ'' r'' + -- k`. + have hZ_sub_Z'' : regionLineVertices Γ r (k + 1) ∩ Γ''.V ⊆ regionLineVertices Γ'' r'' k := by + intro v hv + rcases hv with ⟨⟨hvΓ, F, hF_line, hF_norm, hvF, ⟨p, hpF, hpr⟩, hF_card⟩, hvΓ''⟩ + have hv_not_cl : v ∉ closure r := fun hv_cl => + disjoint_left.mp hDisjY hvΓ'' ⟨hvΓ, hv_cl⟩ + have hF_pre : IsPreconnected F := isPreconnected_of_isLine hF_line + have hF_fr : (F ∩ frontier r).Nonempty := by + by_contra h_emp + have hdis : Disjoint F (frontier (closure r)) := by + refine Disjoint.mono_right frontier_closure_subset ?_ + exact disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp h_emp) + exact hv_not_cl + (subset_of_disjoint_frontier hF_pre isClosed_closure hdis hpF (subset_closure hpr) hvF) + obtain ⟨w, hwF, hw_fr⟩ := hF_fr + have hwU : w ∈ Γ.U := frontier_region_subset_U hr hw_fr + have hwV : w ∈ Γ.V := hF_norm ⟨hwF, hwU⟩ + have hw_cl : w ∈ closure r := hw_fr.1 + have hw_not_Γ'' : w ∉ Γ''.V := fun hw'' => + disjoint_left.mp hDisjY hw'' ⟨hwV, hw_cl⟩ + have hw_not_inter : w ∉ F ∩ Γ''.V := fun h => hw_not_Γ'' h.2 + have hins_sub : insert w (F ∩ Γ''.V) ⊆ F ∩ Γ.V := by + rintro x (rfl | ⟨hxF, hxV''⟩) + · exact ⟨hwF, hwV⟩ + · exact ⟨hxF, hSubΓ''.1 hxV''⟩ + have hcard_ins : (insert w (F ∩ Γ''.V)).ncard ≤ k + 1 := + (ncard_le_ncard hins_sub (Γ.finite_V.subset inter_subset_right)).trans hF_card + rw [ncard_insert_of_notMem hw_not_inter (Γ''.finite_V.subset inter_subset_right)] at hcard_ins + refine ⟨hvΓ'', F, hF_line, isNormal_of_isSubdrawing hSubΓ'' hF_norm, hvF, + ⟨p, hpF, hr_sub'' hpr⟩, by omega⟩ + have hSub_del : Γ'.IsSubdrawing (deleteVertices Γ (regionLineVertices Γ r (k + 1))) := by + rw [isSubdrawing_deleteVertices_iff] + refine ⟨hSubΓ'Γ, disjoint_left.mpr fun v hvΓ' hvZ => ?_⟩ + exact disjoint_left.mp hDisjZ'' hvΓ' (hZ_sub_Z'' ⟨hvZ, hSubΓ'Γ''.1 hvΓ'⟩) + have hr_sub' : r ⊆ r' := hr_sub''.trans hr''_sub' + have h_i : Γ.U ⊆ Γ'.U ∪ r' := by + intro x hx + rcases hU'' hx with hxU'' | hxr'' + · exact hU' hxU'' + · exact Or.inr (hr''_sub' hxr'') + have hA_sub'' : Γ.A ∩ Γ'.A ⊆ Γ''.A := by + rintro a ⟨haΓ, haΓ'⟩ + obtain ⟨x, hxa⟩ := atom_nonempty' haΓ + obtain ⟨a'', ha'', haa''⟩ := exists_atom_superset_of_isSubdrawing hSubΓ'' haΓ + obtain ⟨a₁', ha₁', ha''a₁'⟩ := exists_atom_superset_of_isSubdrawing hSubΓ'Γ'' ha'' + have heq : a₁' = a := + atom_eq_of_inter_nonempty ha₁' haΓ' ⟨x, ha''a₁' (haa'' hxa), hxa⟩ + have ha_eq : a = a'' := Subset.antisymm haa'' (heq ▸ ha''a₁') + exact ha_eq ▸ ha'' + have h_ii : ∀ a ∈ Γ.A ∩ Γ'.A, ∀ b ∈ Γ.A ∩ Γ'.A, d a b - 4 * (k + 1) ≤ d' a b := by + intro a ha b hb + have ha'' : a ∈ Γ''.A := hA_sub'' ha + have hb'' : b ∈ Γ''.A := hA_sub'' hb + have h1 := hd''_ab a ⟨ha.1, ha''⟩ b ⟨hb.1, hb''⟩ + have h2 := hd'_ab a ⟨ha'', ha.2⟩ b ⟨hb'', hb.2⟩ + omega + have h_iii : ∀ a ∈ Γ.A ∩ Γ'.A, d a r - 2 * (k + 1) ≤ d' a r' := by + intro a ha + have ha'' : a ∈ Γ''.A := hA_sub'' ha + have h1 := hd''_ar a ⟨ha.1, ha''⟩ + have h2 := hd'_ar'' a ⟨ha'', ha.2⟩ + omega + have h_iv : ∀ a ∈ Γ.A, a ⊆ r' → d a r ≤ 2 * (k + 1) + 1 := by + intro a ha har' + obtain ⟨a'', ha'', haa''⟩ := exists_atom_superset_of_isSubdrawing hSubΓ'' ha + rcases atom_eq_or_eq_region_of_U_subset hSubΓ'' hr'' hU'' ha ha'' haa'' with + ⟨rfl, ha_mem''⟩ | ⟨rfl, har''⟩ + · have h1 := hd''_ar a ha_mem'' + have h2 := hd''_le a ha_mem''.2 har' + omega + · have h1 := hd_le3 a ha har'' + omega + have hd'_eq : HasTangleMetric Γ' (θ - 2 * (k + 1)) T' d' := by + have h_ord_eq : θ - 2 - 2 * k = θ - 2 * (k + 1) := by omega + rwa [h_ord_eq] at hd' + refine ⟨Γ', T', d', r', hSub_del, h2cell', hd'_eq, hr', hr_sub', h_i, h_ii, h_iii, h_iv, + fun a ha b hb a' ha' b' hb' haa' hbb' => + theorem_7_6_in_particular hS hd hd'_eq hSubΓ'Γ hr hr' + h_i h_ii h_iii h_iv ha hb ha' hb' haa' hbb'⟩ + + +/-! ## 2. Proof of (7.8) -/ + +private theorem deleted_encircling_region_le_target_drawing + {S : Type u} + [TopologicalSpace S] + [T2Space S] + (hS : IsClosedSurface S) + [ConnectedSpace S] + {Γ : Drawing S} + {Γ' : Drawing S} + {θ : ℕ} + {k : ℕ} + (hθ : 2 * k + 2 ≤ θ) + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {c : Set S} + (hc : c ∈ Γ.A) + (hSub : Γ'.IsSubdrawing Γ) + (hdist : ∀ e ∈ Γ.E \ Γ'.E, d c e ≤ k) + (hck : c ∈ Γ.E \ Γ'.E → 2 ≤ k) + (hResp : IsRespectfulDrawingTangle Γ θ T) + (K : Drawing S) + (ins : Drawing S → Set S) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hds : IsDerivedSlope (PaintingOrDrawing.drawing Γ) K θ T ins) + (hd_eq : ∀ x ∈ Γ.A, ∀ y ∈ Γ.A, d x y = tangleMetric Γ K ins θ x y) + (hUU : Γ.U ∩ K.U = Γ.V) + (hsl : IsSlope K (2 * θ) ins) + (hE_ne : Γ.E.Nonempty) + (h : Set S) + (hh : IsCorrespondingAtom Γ K c h) + (u_init : S) + (W_init : GraphWalk K.toGraph u_init u_init) + (u₀ : S) + (W₀ : GraphWalk K.toGraph u₀ u₀) + (hW₀_len : W₀.length ≤ 2 * k) + (hh_W₀ : h ⊆ insWalk ins K W₀) + (hW₀_max : ∀ ⦃y : Set S⦄, + (∃ (u : S) (W : GraphWalk K.toGraph u u), W.length ≤ 2 * k ∧ h ⊆ insWalk ins K W ∧ + insWalk ins K W_init ⊆ y ∧ y = insWalk ins K W) → + insWalk ins K W₀ ⊆ y → y ⊆ insWalk ins K W₀) + (hinit_W₀ : insWalk ins K W_init ⊆ insWalk ins K W₀) + (v₀ : S) + (hv₀_W₀ : v₀ ∈ (walkDrawing K W₀).V) + (hv₀_not_Γ : v₀ ∉ Γ.V) + (r : Set S) + (hr : r ∈ Γ.R) + (hv₀_r : v₀ ∈ r) + (hr_corr : IsCorrespondingAtom Γ K r {v₀}) + (Γ'' : Drawing S) + (T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d'' : Set S → Set S → ℕ) + (r'' : Set S) + (h2cell'' : (PaintingOrDrawing.drawing Γ'').IsTwoCell) + (hd'' : HasTangleMetric Γ'' (θ - 2 * k) T'' d'') + (hU'' : Γ.U ⊆ Γ''.U ∪ r'') + (h_iv'' : ∀ a ∈ Γ.A, a ⊆ r'' → d a r ≤ 2 * k + 1) + (hSubΓ'' : Γ''.IsSubdrawing Γ) + (hDisjZ : Disjoint Γ''.V (regionLineVertices Γ r k)) : + Γ''.IsSubdrawing Γ' := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let 𝒜 : Set (Set S) := {X | ∃ (u : S) (W : GraphWalk K.toGraph u u), + W.length ≤ 2 * k ∧ h ⊆ insWalk ins K W ∧ insWalk ins K W_init ⊆ X ∧ X = insWalk ins K W} + have hE_sub : Γ''.E ⊆ Γ'.E := by + intro e he'' + by_contra he_not_Γ' + have he_Γ : e ∈ Γ.E := hSubΓ''.2 he'' + obtain ⟨u₁, W₁, hW₁_len, hh_W₁, he_W₁⟩ := + exists_walk_of_edge_dist_le hS hResp hE_ne hK hds hd_eq hc hh he_Γ (by omega) + (hdist e ⟨he_Γ, he_not_Γ'⟩) (fun hce => hck (hce ▸ ⟨he_Γ, he_not_Γ'⟩)) + -- Combine `W₀` and `W₁` into a single closed walk `W` of length `≤ 4 * k` with `v₀ ∈ V(W)` + -- and `e ⊆ insWalk ins K W`. + have hex_W : ∃ (u : S) (W : GraphWalk K.toGraph u u), + W.length ≤ 4 * k ∧ v₀ ∈ (walkDrawing K W).V ∧ e ⊆ insWalk ins K W := by + by_cases hsub₁₀ : insWalk ins K W₁ ⊆ insWalk ins K W₀ + · exact ⟨u₀, W₀, by omega, hv₀_W₀, he_W₁.trans hsub₁₀⟩ + · have hW₀_lt : W₀.length < 2 * θ := by omega + have hW₁_lt : W₁.length < 2 * θ := by omega + have hr₀ : IsRestraint K ins (2 * θ) (insWalk ins K W₀) := + (GM11.theorem_8_5_proof hS hsl W₀ hW₀_lt).1 + have hr₁ : IsRestraint K ins (2 * θ) (insWalk ins K W₁) := + (GM11.theorem_8_5_proof hS hsl W₁ hW₁_lt).1 + have hpre₀ : IsPreconnected (subBd (insWalk ins K W₀)) := + isPreconnected_subBd_of_isRestraint hS hr₀ + have hpre₁ : IsPreconnected (subBd (insWalk ins K W₁)) := + isPreconnected_subBd_of_isRestraint hS hr₁ + obtain ⟨xh, hxh⟩ := atom_nonempty hh.2.1 + have hmeet : (insWalk ins K W₀ ∩ insWalk ins K W₁).Nonempty := + ⟨xh, hh_W₀ hxh, hh_W₁ hxh⟩ + have hneq : insWalk ins K W₀ ∪ insWalk ins K W₁ ≠ univ := by + have h84 := GM11.theorem_8_4_proof hS hsl hr₀ hr₁ hr₁ + rwa [Set.union_assoc, Set.union_self] at h84 + have hnot_sub₀₁ : ¬ insWalk ins K W₀ ⊆ insWalk ins K W₁ := by + intro hsub₀₁ + have hmem₁ : insWalk ins K W₁ ∈ 𝒜 := + ⟨u₁, W₁, hW₁_len, hh_W₁, hinit_W₀.trans hsub₀₁, rfl⟩ + exact hsub₁₀ (hW₀_max hmem₁ hsub₀₁) + have hbd_meet : ¬ Disjoint (subBd (insWalk ins K W₀)) (subBd (insWalk ins K W₁)) := by + intro hdisj + rcases GM11.theorem_7_7_proof hpre₀ hpre₁ hmeet hneq hdisj with h₀₁ | h₁₀ + · exact hnot_sub₀₁ h₀₁ + · exact hsub₁₀ h₁₀ + rw [not_disjoint_iff_nonempty_inter] at hbd_meet + have hfr₀ : subBd (insWalk ins K W₀) ⊆ (walkDrawing K W₀).U := by + rw [subBd_eq_frontier] + exact (frontier_insOf_subset hsl (walkDrawing_isSubdrawing K W₀) + (isConfined_walk W₀ hW₀_lt)).2 + have hfr₁ : subBd (insWalk ins K W₁) ⊆ (walkDrawing K W₁).U := by + rw [subBd_eq_frontier] + exact (frontier_insOf_subset hsl (walkDrawing_isSubdrawing K W₁) + (isConfined_walk W₁ hW₁_lt)).2 + have hU_meet : ((walkDrawing K W₀).U ∩ (walkDrawing K W₁).U).Nonempty := + hbd_meet.mono (inter_subset_inter hfr₀ hfr₁) + obtain ⟨w, hw₀, hw₁⟩ := + subdrawings_common_vertex (walkDrawing_isSubdrawing K W₀) + (walkDrawing_isSubdrawing K W₁) hU_meet + rw [walkDrawing_V] at hw₀ hw₁ + obtain ⟨V₁, hV₁_len, hV₁_draw⟩ := rotate_closed_walk W₁ hw₁ + obtain ⟨W, hW_len, hW₀_sub, hV₁_sub⟩ := splice_closed_walks W₀ V₁ hw₀ + have hW₁_sub : (walkDrawing K W₁).IsSubdrawing (walkDrawing K W) := + hV₁_draw ▸ hV₁_sub + refine ⟨u₀, W, by omega, hW₀_sub.1 hv₀_W₀, he_W₁.trans (insOf_mono hW₁_sub)⟩ + obtain ⟨u, W, hW_len, hv₀_W, he_W⟩ := hex_W + have hW_lt : W.length < 2 * θ := by omega + obtain ⟨hclW, hfrW⟩ := + frontier_insOf_subset hsl (walkDrawing_isSubdrawing K W) (isConfined_walk W hW_lt) + change IsClosed (insWalk ins K W) at hclW + change frontier (insWalk ins K W) ⊆ (walkDrawing K W).U at hfrW + -- Every vertex in `(walkDrawing K W).V ∩ Γ.V` belongs to `regionLineVertices Γ r k`, + -- so `Γ''.U` is disjoint from `frontier (insWalk ins K W)`. + have hdisj_fr : Disjoint Γ''.U (frontier (insWalk ins K W)) := by + refine disjoint_left.mpr fun x hxU'' hxfr => ?_ + have hxW_U : x ∈ (walkDrawing K W).U := hfrW hxfr + have hx_ΓV : x ∈ Γ.V := hUU ▸ + ⟨hSubΓ''.U_subset hxU'', (walkDrawing_isSubdrawing K W).U_subset hxW_U⟩ + have hx_V'' : x ∈ Γ''.V := subdrawing_vertex_of_mem_U hSubΓ'' hxU'' hx_ΓV + have hx_WV : x ∈ (walkDrawing K W).V := + subdrawing_vertex_of_mem_U (walkDrawing_isSubdrawing K W) hxW_U (hK.2.1.2.1 hx_ΓV) + have hx_Z : x ∈ regionLineVertices Γ r k := + mem_regionLineVertices_of_closed_walk hK.2.1 hv₀_r hv₀_not_Γ W hW_len hv₀_W hx_WV hx_ΓV + exact disjoint_left.mp hDisjZ hx_V'' hx_Z + obtain ⟨p_e, hp_e⟩ := he''.1 + have hU''_sub : Γ''.U ⊆ insWalk ins K W := + subset_of_disjoint_frontier (isPreconnected_U_of_isTwoCell hS h2cell'') hclW hdisj_fr + ((he''.2.1 hp_e).1) (he_W hp_e) + -- By (1.2), there is an edge `f ∈ Γ.E` with `d r f = θ`. + have hr_not_E : r ∉ Γ.E := fun hrE => by + obtain ⟨x, hxr⟩ := region_nonempty hr + exact region_subset hr hxr ((hrE.2.1 hxr).1) + obtain ⟨f, hf_Γ, hd_rf⟩ := + exists_edge_dist_eq_theta_uncond hS ⟨hResp, K, ins, hK, hds, hd_eq⟩ + (by omega) (Or.inr hr) (Or.inr hr_not_E) + -- Show `f ∈ Γ''.E` using (iv) of (7.6). + have hf_Γ'' : f ∈ Γ''.E := by + by_contra hf_not_Γ'' + have hf_sub_r'' : f ⊆ r'' := by + intro x hxf + rcases hU'' ((hf_Γ.2.1 hxf).1) with hxU'' | hxr'' + · exfalso + have hx_not_V'' : x ∉ Γ''.V := fun hxV'' => (hf_Γ.2.1 hxf).2 (hSubΓ''.1 hxV'') + obtain ⟨g, hg'', hxg⟩ := Γ''.exists_edge_of_mem hxU'' hx_not_V'' + have hfg : f = g := Γ.edge_eq_of_mem hf_Γ (hSubΓ''.2 hg'') hxf hxg + exact hf_not_Γ'' (hfg ▸ hg'') + · exact hxr'' + have hd_fr_le : d f r ≤ 2 * k + 1 := h_iv'' f (Or.inl (Or.inr hf_Γ)) hf_sub_r'' + obtain ⟨_, _, _, hsym, _, _, _⟩ := + GM11.gm15_theorem_9_1 Γ θ T d hS inferInstance ⟨hResp, K, ins, hK, hds, hd_eq⟩ + have hd_rf_le : d r f ≤ 2 * k + 1 := + (hsym r (Or.inr hr) f (Or.inl (Or.inr hf_Γ))).trans_le hd_fr_le + omega + have hf_sub_W : f ⊆ insWalk ins K W := + fun x hx => hU''_sub (hf_Γ''.2.1 hx).1 + obtain ⟨r_f, hr_f, -⟩ := existsUnique_correspondingAtom hK (Or.inl (Or.inr hf_Γ)) + have hr_f_R : r_f ∈ K.R := by + rcases hr_f.2.2 with ⟨v, hv, rfl, -⟩ | ⟨_, hr_f_R, _⟩ | ⟨hr_f_Γ, -⟩ + · exact absurd hv (hf_Γ.2.1 (mem_singleton v)).2 + · exact hr_f_R + · obtain ⟨x, hxf⟩ := hf_Γ.1 + exact absurd (hf_Γ.2.1 hxf).1 (region_subset hr_f_Γ hxf) + have hf_sub_rf : f ⊆ r_f := by + rcases hr_f.2.2 with ⟨v, hv, rfl, -⟩ | ⟨_, _, hsub⟩ | ⟨hr_f_Γ, -⟩ + · exact absurd hv (hf_Γ.2.1 (mem_singleton v)).2 + · exact hsub + · obtain ⟨x, hxf⟩ := hf_Γ.1 + exact absurd (hf_Γ.2.1 hxf).1 (region_subset hr_f_Γ hxf) + obtain ⟨pf, hpf⟩ := hf_Γ.1 + have hrf_W : r_f ⊆ insWalk ins K W := + nice_region (GM11.theorem_8_5_proof hS hsl W hW_lt).1.isGammaNice hr_f_R + ⟨pf, hf_sub_rf hpf, hf_sub_W hpf⟩ + have hv₀_in_W : ({v₀} : Set S) ⊆ insWalk ins K W := + singleton_subset_iff.mpr (Or.inl ((walkDrawing K W).V_subset_U hv₀_W)) + obtain ⟨m, hm⟩ : ∃ m, W.length = 2 * m := ⟨_, closed_walk_length_eq_two_mul hK.2.1 W⟩ + have hd_rf_le : d r f ≤ m := by + rw [hd_eq r (Or.inr hr) f (Or.inl (Or.inr hf_Γ))] + exact tangleMetric_le_of_walk hr_corr hr_f W hW_lt hm hv₀_in_W hrf_W + omega + -- Deduce `Γ''.V ⊆ Γ'.V` since `Γ''` has no isolated vertices. + refine ⟨fun v hv'' => ?_, hE_sub⟩ + have hE''_ne : Γ''.E.Nonempty := + edgeSet_nonempty_of_isTangle_of_two_le hd''.1.2.1 (by omega) + obtain ⟨K'', hK''⟩ := GM11.exists_radialDrawing hS h2cell'' + have hrf'' := GM11.regionFacts_of_radial ⟨hK''.1, hK''.2.1⟩ hS hK''.2.2 hE''_ne + obtain ⟨e, he'', hve⟩ := exists_edge_of_regionFacts hS hrf'' hv'' + have he' : e ∈ Γ'.E := hE_sub he'' + have hv_in : v ∈ closure e ∩ Γ'.V := by + rw [hSub.closure_inter_V he', ← hSubΓ''.closure_inter_V he''] + exact ⟨hve, hv''⟩ + exact hv_in.2 + +/-- **(7.8)** of Graph Minors XII (page 268): +"Let $k \ge 0$ be an integer, and let $\mathscr{T}$ be a respectful tangle of order $\theta +\ge 2k + 2$ in a 2-cell drawing $\Gamma$ in a connected surface $\Sigma$. Let its metric be +$d$. Let $c \in A(\Gamma)$, and let $\Gamma'$ be a 2-cell subdrawing of $\Gamma$ such that +$d(c, e) \le k$ for all $e \in E(\Gamma) - E(\Gamma')$, and such that if $c \in E(\Gamma')$ +then $k \ge 2$. Then there is a respectful tangle $\mathscr{T}'$ of order $\theta - 2k$ in +$\Gamma'$, with metric $d'$, such that $d'(a', b') \ge d(a, b) - 4k - 2$ for all $a, b \in +A(\Gamma)$ and $a', b' \in A(\Gamma')$ with $a \subseteq a'$ and $b \subseteq b'$." + +The printed statement of (7.8) requires `k ≥ 2` if `c ∈ Γ'.E`. The corrected hypothesis is +`c ∈ Γ.E \ Γ'.E → 2 ≤ k`, as in (7.10) on page 270. On page 269 the printed proof uses the +bound when the radial atom of the center is a region, and again for a deleted edge `e = c`. +The Lean proof starts with a deleted edge within distance `k` of the center. Its initial-walk +construction requires `2 ≤ k` when that edge equals `c`. -/ +theorem theorem_7_8_proof + (hS : IsClosedSurface S) [ConnectedSpace S] + {Γ Γ' : Drawing S} {θ k : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {c : Set S} + (hθ : 2 * k + 2 ≤ θ) + (hd : HasTangleMetric Γ θ T d) + (hc : c ∈ Γ.A) + (hSub : Γ'.IsSubdrawing Γ) + (h2cell' : (PaintingOrDrawing.drawing Γ').IsTwoCell) + (hdist : ∀ e ∈ Γ.E \ Γ'.E, d c e ≤ k) + (hck : c ∈ Γ.E \ Γ'.E → 2 ≤ k) : + ∃ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ), + HasTangleMetric Γ' (θ - 2 * k) T' d' ∧ + ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → d a b - 4 * k - 2 ≤ d' a' b' := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + -- First handle the case `Γ.E \ Γ'.E = ∅`, where `Γ' = Γ`. + by_cases hE_diff : (Γ.E \ Γ'.E).Nonempty + swap + · rw [not_nonempty_iff_eq_empty, sdiff_eq_empty] at hE_diff + have hE_eq : Γ'.E = Γ.E := Subset.antisymm hSub.2 hE_diff + have hE_ne : Γ.E.Nonempty := + edgeSet_nonempty_of_isTangle_of_two_le hd.1.2.1 (by omega) + obtain ⟨K₀, hK₀⟩ := GM11.exists_radialDrawing hS hd.1.1 + have hrf := GM11.regionFacts_of_radial ⟨hK₀.1, hK₀.2.1⟩ hS hK₀.2.2 hE_ne + have hV_eq : Γ'.V = Γ.V := by + refine Subset.antisymm hSub.1 fun v hv => ?_ + obtain ⟨e, he, hve⟩ := exists_edge_of_regionFacts hS hrf hv + have he' : e ∈ Γ'.E := hE_eq.symm ▸ he + have hv_in : v ∈ closure e ∩ Γ'.V := by + rw [hSub.closure_inter_V he'] + exact ⟨hve, hv⟩ + exact hv_in.2 + have hΓ_eq : Γ' = Γ := Drawing.ext_of_V_E hV_eq hE_eq + subst hΓ_eq + have htrunc : HasTangleMetric Γ' (θ - 2 * k) (GM10.truncation T (θ - 2 * k)) + (fun x y => min (d x y) (θ - 2 * k)) := + HasTangleMetric.truncation hd (by omega) (Nat.sub_le θ (2 * k)) + refine ⟨GM10.truncation T (θ - 2 * k), fun x y => min (d x y) (θ - 2 * k), htrunc, ?_⟩ + intro a ha b hb a' ha' b' hb' haa' hbb' + obtain ⟨xa, hxa⟩ := atom_nonempty' ha + obtain ⟨xb, hxb⟩ := atom_nonempty' hb + have ha_eq : a' = a := atom_eq_of_inter_nonempty ha' ha ⟨xa, haa' hxa, hxa⟩ + have hb_eq : b' = b := atom_eq_of_inter_nonempty hb' hb ⟨xb, hbb' hxb, hxb⟩ + rw [ha_eq, hb_eq] + have hd_le : d a b ≤ θ := by + obtain ⟨_, K, ins, hK, _, hd_eq⟩ := id hd + rw [hd_eq a ha b hb] + exact tangleMetric_le_order hK ins θ a b + change d a b - 4 * k - 2 ≤ min (d a b) (θ - 2 * k) + omega + -- Now `Γ.E \ Γ'.E` is nonempty; choose `e₀ ∈ Γ.E \ Γ'.E`. + obtain ⟨e₀, he₀_Γ, he₀_not_Γ'⟩ := hE_diff + obtain ⟨hResp, K, ins, hK, hds, hd_eq⟩ := hd + have h2cell := hResp.1 + have hT := hResp.2.1 + have hUU : Γ.U ∩ K.U = Γ.V := hK.2.1.1 + have hpreT : IsPretangle Γ.toHypergraph θ T := + ⟨hT.one_le, hT.isSeparation, hT.order_lt, hT.axiom1, hT.axiom2⟩ + have hsl : IsSlope K (2 * θ) ins := + GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing Γ) hS hpreT hK.2.1.1 hds + have hE_ne : Γ.E.Nonempty := ⟨e₀, he₀_Γ⟩ + obtain ⟨h, hh, -⟩ := existsUnique_correspondingAtom hK hc + -- Initial closed walk `W_init` of length `≤ 2 * k` containing `h` and `e₀`. + obtain ⟨u_init, W_init, hW_init_len, hh_init, he₀_init⟩ := + exists_walk_of_edge_dist_le hS hResp hE_ne hK hds hd_eq hc hh he₀_Γ (by omega) + (hdist e₀ ⟨he₀_Γ, he₀_not_Γ'⟩) (fun hce => hck (hce ▸ ⟨he₀_Γ, he₀_not_Γ'⟩)) + -- Choose `W₀` of length `≤ 2 * k` with `insWalk ins K W_init ⊆ insWalk ins K W₀` and + -- `insWalk ins K W₀` maximal among closed walks of length `≤ 2 * k` containing `h`. + let 𝒜 : Set (Set S) := + {X : Set S | ∃ (u : S) (W : GraphWalk K.toGraph u u), + W.length ≤ 2 * k ∧ h ⊆ insWalk ins K W ∧ insWalk ins K W_init ⊆ X ∧ X = insWalk ins K W} + have h𝒜_fin : 𝒜.Finite := by + have hSub_fin : {D : Drawing S | D.IsSubdrawing K}.Finite := by + refine Set.Finite.of_finite_image (f := fun D : Drawing S => (D.V, D.E)) ?_ ?_ + · refine (K.finite_V.finite_subsets.prod K.finite_edges.finite_subsets).subset ?_ + rintro _ ⟨D, hD, rfl⟩ + exact ⟨hD.1, hD.2⟩ + · intro D₁ _ D₂ _ hpair + exact Drawing.ext_of_V_E (congrArg Prod.fst hpair) (congrArg Prod.snd hpair) + refine (hSub_fin.image (insOf ins)).subset ?_ + rintro X ⟨u, W, -, -, -, rfl⟩ + exact ⟨walkDrawing K W, walkDrawing_isSubdrawing K W, rfl⟩ + have h𝒜_ne : 𝒜.Nonempty := + ⟨insWalk ins K W_init, u_init, W_init, hW_init_len, hh_init, Subset.rfl, rfl⟩ + obtain ⟨X₀, ⟨u₀, W₀, hW₀_len, hh_W₀, hinit_W₀, rfl⟩, hW₀_max⟩ := + h𝒜_fin.exists_maximal h𝒜_ne + have he₀_W₀ : e₀ ⊆ insWalk ins K W₀ := he₀_init.trans hinit_W₀ + -- Show that `(walkDrawing K W₀).V \ Γ.V` is nonempty. + have hv₀_exists : ∃ v₀ ∈ (walkDrawing K W₀).V, v₀ ∉ Γ.V := by + cases hW₀_case : W₀ with + | nil hu₀ => + exfalso + obtain ⟨p₀, hp₀⟩ := he₀_Γ.1 + have hp₀_not_K : p₀ ∉ K.U := fun hpK => by + have hp_in : p₀ ∈ Γ.U ∩ K.U := ⟨(he₀_Γ.2.1 hp₀).1, hpK⟩ + rw [hUU] at hp_in + exact (he₀_Γ.2.1 hp₀).2 hp_in + have hp₀_in : p₀ ∈ insWalk ins K (GraphWalk.nil hu₀) := hW₀_case ▸ he₀_W₀ hp₀ + rcases hp₀_in with hpU | hpC + · exact hp₀_not_K ((walkDrawing_isSubdrawing K _).U_subset hpU) + · obtain ⟨C, ⟨hC, hCs⟩, _⟩ := mem_iUnion₂.mp hpC + obtain ⟨_, W_C, _, hpos, _, hCE⟩ := hC + cases W_C with + | nil _ => exact (lt_irrefl 0 hpos).elim + | @cons _ _ _ f hl _ => + have hfC : f ∈ C.E := by rw [hCE]; exact List.mem_cons_self + have hfW : f ∈ (walkDrawing K (GraphWalk.nil hu₀)).E := hCs.2 hfC + rw [walkDrawing_E] at hfW + exact List.not_mem_nil hfW + | @cons _ w₀ _ f hl rest => + have hbip := bipartite_of_preRadial hK.2.1 f u₀ w₀ hl + by_cases hu₀ : u₀ ∈ Γ.V + · refine ⟨w₀, ?_, hbip.mp hu₀⟩ + rw [walkDrawing_V] + exact List.mem_cons_of_mem _ rest.start_mem_support + · refine ⟨u₀, ?_, hu₀⟩ + rw [walkDrawing_V] + exact List.mem_cons_self + obtain ⟨v₀, hv₀_W₀, hv₀_not_Γ⟩ := hv₀_exists + have hv₀_K : v₀ ∈ K.V := (walkDrawing_isSubdrawing K W₀).1 hv₀_W₀ + have hv₀_not_ΓU : v₀ ∉ Γ.U := fun hvU => hv₀_not_Γ (hUU ▸ ⟨hvU, K.V_subset_U hv₀_K⟩) + obtain ⟨r, hr, hv₀_r⟩ := exists_region_of_notMem hv₀_not_ΓU + have hr_corr : IsCorrespondingAtom Γ K r {v₀} := + ⟨Or.inr hr, Or.inl (Or.inl ⟨v₀, hv₀_K, rfl⟩), Or.inr (Or.inr ⟨hr, v₀, ⟨hv₀_K, hv₀_r⟩, rfl⟩)⟩ + -- Apply (7.6) to `(Γ, θ, k, T, d, r)`. + obtain ⟨Γ'', T'', d'', r'', hSub''_del, h2cell'', hd'', hr'', hr_sub'', + hU'', _, _, h_iv'', h_part''⟩ := + theorem_7_6_proof hS k (by omega) ⟨hResp, K, ins, hK, hds, hd_eq⟩ hr + obtain ⟨hSubΓ'', hDisjZ⟩ := isSubdrawing_deleteVertices_iff.mp hSub''_del + -- Prove `Γ''.IsSubdrawing Γ'`. + have hSubΓ''Γ' : Γ''.IsSubdrawing Γ' := by + exact deleted_encircling_region_le_target_drawing hS hθ (T := T) (d := d) (c := c) + hc hSub hdist hck hResp K ins hK hds hd_eq hUU hsl hE_ne h hh u_init W_init u₀ W₀ hW₀_len + hh_W₀ hW₀_max hinit_W₀ v₀ hv₀_W₀ hv₀_not_Γ r hr hv₀_r hr_corr Γ'' T'' d'' r'' h2cell'' hd'' + hU'' h_iv'' hSubΓ'' hDisjZ + -- Induce `T''` in `Γ'` and apply (7.7)(ii). + let T' := inducedBySubgraph Γ'.toHypergraph Γ''.toHypergraph (θ - 2 * k) T'' + have hSubHyp : Γ''.toHypergraph ≤ Γ'.toHypergraph := toHypergraph_le_of_isSubdrawing hSubΓ''Γ' + have hT' : IsTangle Γ'.toHypergraph (θ - 2 * k) T' := + inducedBySubgraph_isTangle hSubHyp hd''.1.2.1 + have hResp' : (PaintingOrDrawing.drawing Γ').IsRespectful (θ - 2 * k) T' := + isRespectful_inducedBySubgraph hSubΓ''Γ' hd''.1.2.2 + have hRDT' : IsRespectfulDrawingTangle Γ' (θ - 2 * k) T' := + ⟨h2cell', hT', hResp'⟩ + obtain ⟨d', hd'⟩ := exists_hasTangleMetric hS hRDT' + refine ⟨T', d', hd', fun a ha b hb a' ha' b' hb' haa' hbb' => ?_⟩ + obtain ⟨a'', ha'', ha'a''⟩ := exists_atom_superset_of_isSubdrawing hSubΓ''Γ' ha' + obtain ⟨b'', hb'', hb'b''⟩ := exists_atom_superset_of_isSubdrawing hSubΓ''Γ' hb' + have h1 : d a b - 4 * k - 2 ≤ d'' a'' b'' := + h_part'' a ha b hb a'' ha'' b'' hb'' (haa'.trans ha'a'') (hbb'.trans hb'b'') + have h2 : d'' a'' b'' ≤ d' a' b' := + (theorem_7_7_proof hS hd' hSubΓ''Γ' h2cell'' le_rfl hd'').2 rfl rfl + a' ha' b' hb' a'' ha'' b'' hb'' ha'a'' hb'b'' + exact h1.trans h2 + + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/SurfaceDual.lean b/LeanPool/GraphMinor/GM12/SurfaceDual.lean new file mode 100644 index 0000000000..2c476f1feb --- /dev/null +++ b/LeanPool/GraphMinor/GM12/SurfaceDual.lean @@ -0,0 +1,253 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.SurfaceDualFan + +/-! +# A surface dual from a radial drawing + +Graph Minors XII, (7.5), uses this step: "Let $\Gamma_1$ be a drawing in $\Sigma$ dual to $\Gamma$, +in the usual sense +of surface duals". The text gives no proof that the dual has a common radial drawing with `Γ`. This +file gives one (`exists_surfaceDual_of_radial`). + +Each edge `e` of `Γ` has two regions of `Γ ∪ K` beside it. Choose a point `m e` of `e`. In each of +the +two regions, take a line from `m e` to the vertex of `K` on that region's frontier that is not in +`Γ`. +The two lines form the dual edge, which is a loop if they end at the same vertex. + +The drawing `K ∪ N`, where `N` is made of the lines, is a radial drawing of `Γ` with the points `m +e` as +new vertices (`SurfaceDualSplit.lean`). So the regions of the dual are the stars of +`SurfaceDualStar.lean`, and each has one vertex of `Γ`. Then `K` satisfies conditions (i)-(iv) for +the +dual, with the roles of the two kinds of vertices swapped. Maximality is by count. +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +variable [T2Space S] [ConnectedSpace S] + +/-- See the module docstring. The drawing `Γ₁` here is any drawing made from the lines of `hL`. -/ +theorem IsDualLines.isRadial_dual {Γ K D : Drawing S} {hrad : PreRad (PaintingOrDrawing.drawing Γ) + K} + {A B : Set S → Set S} {m x y : Set S → S} {f : Set S × Bool → Set S} {h : Set S × Bool → S} + {ℓ : Set S × Bool → I → S} (hL : IsDualLines hrad D A B m x y f h ℓ) (hS : IsClosedSurface S) + (hmax : RadMax (PaintingOrDrawing.drawing Γ) K) (hE : Γ.E.Nonempty) {Γ₁ : Drawing S} + (h₁U : Γ₁.U = (K.V \ Γ.V) ∪ ⋃ e ∈ Γ.E, (range (ℓ (e, true)) ∪ range (ℓ (e, false)))) + (h₁V : Γ₁.V = K.V \ Γ.V) + (h₁E : Γ₁.E = (fun e => (range (ℓ (e, true)) ∪ range (ℓ (e, false))) \ + {h (e, true), h (e, false)}) '' Γ.E) : + (PaintingOrDrawing.drawing Γ₁).IsRadialDrawing K := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hfin : (K.V \ Γ.V).Finite := K.finite_V.subset sdiff_subset + obtain ⟨N, hNU, hNV, hNE⟩ := hL.exists_lineDrawing (hfin.union (Γ.finite_edges.image _)) + have hKN := hL.glue_compat hNU hNV + have hrad₁ := hL.preRad_glue hNU hNV hNE hKN hS hmax hE + have hmax₁ := hL.radMax_glue hNU hNV hNE hKN hS hmax hE + have hDE : D.E.Nonempty := by + obtain ⟨e, he⟩ := hE + exact ⟨_, (hL.split e he).1⟩ + have hsub : Γ.V ⊆ D.V := fun z hz => hL.V_eq ▸ Or.inl hz + have hmΓ : ∀ {e}, e ∈ Γ.E → m e ∉ Γ.V := fun he => edge_notMem_V he (hL.m_mem he) + have hX : IsSideSplit D (K.glue N hKN) N Γ.V := by + refine ⟨hsub, ?_, ?_, ?_, ?_, ?_⟩ + · apply subset_antisymm + · intro z hz + have hz' := hz + rw [hNV] at hz' + rcases hz' with hz' | ⟨e, he, rfl⟩ + · exact ⟨Or.inl hz'.1, hz'.2⟩ + · exact ⟨Or.inr hz, hmΓ he⟩ + · rintro z ⟨hz | hz, hzΓ⟩ + · exact hNV ▸ Or.inl ⟨hz, hzΓ⟩ + · exact hz + · intro g hg + rw [Drawing.glue_E] + exact Or.inr hg + · intro g hg + obtain ⟨e, he, rfl | rfl⟩ := hL.all g hg + · obtain ⟨-, -, -, -, -, -, -, hx, -, -, hcA, -⟩ := hL.split e he + exact ⟨x e, hx, m e, ⟨hL.m_mem_D he, hmΓ he⟩, hcA⟩ + · obtain ⟨-, -, -, -, -, -, -, -, hy, -, -, hcB⟩ := hL.split e he + exact ⟨y e, hy, m e, ⟨hL.m_mem_D he, hmΓ he⟩, by rw [hcB, pair_comm]⟩ + · intro g hg hgN + rw [Drawing.glue_E] at hg + have hgK : g ∈ K.E := hg.resolve_right hgN + obtain ⟨v, hv, w, -, hcap⟩ := hrad.2.2.2.2.2.1 g hgK + have : v ∈ closure g ∩ K.V := by rw [hcap]; simp + exact ⟨v, hv, this.1⟩ + · intro g hg + obtain ⟨e, he, b, -, hcl⟩ := hL.N_edge hNE hg + rw [hcl] + refine disjoint_left.mpr fun z hz hzV => ?_ + rcases hL.mem_line he b hz with h₁ | h₁ | h₁ + · exact (hL.face_off he b h₁).1 (Γ.V_subset_U hzV) + · exact hmΓ he (h₁ ▸ hzV) + · exact hL.hub_off he b (h₁ ▸ Γ.V_subset_U hzV) + have hU : Γ₁.U = N.U := by + rw [h₁U, hNU] + apply subset_antisymm + · rintro z (hz | hz) + · exact Or.inl (Or.inl hz) + · obtain ⟨e, he, hz | hz⟩ := mem_iUnion₂.mp hz + · exact Or.inr (mem_biUnion (show (e, true) ∈ Γ.E ×ˢ (univ : Set Bool) from ⟨he, + mem_univ _⟩) hz) + · exact Or.inr (mem_biUnion (show (e, false) ∈ Γ.E ×ˢ (univ : Set Bool) from ⟨he, + mem_univ _⟩) hz) + · rintro z ((hz | ⟨e, he, rfl⟩) | hz) + · exact Or.inl hz + · exact Or.inr (mem_biUnion he (Or.inl (line_left_mem (hL.isLine he true) |> + (hL.zero e he true ▸ ·)))) + · obtain ⟨⟨e, b⟩, ⟨he, -⟩, hz⟩ := mem_iUnion₂.mp hz + refine Or.inr (mem_biUnion he ?_) + cases b + · exact Or.inr hz + · exact Or.inl hz + have hR : Γ₁.R = N.R := by + simp only [Drawing.R, hU] + let H := radialUnion hrad₁ + have hsplit₁ : ∀ {v}, v ∈ Γ.V → star H v ∈ N.R := fun hv => hX.star_mem_R hrad₁ hS hmax₁ hDE hv + have hsplit₂ : ∀ {r}, r ∈ N.R → ∃ v ∈ Γ.V, r = star H v := fun hr => + hX.exists_star_eq hrad₁ hS hmax₁ hDE hr + have htwo : (PaintingOrDrawing.drawing Γ₁).IsTwoCell := by + refine ⟨inferInstance, fun r hr => ?_⟩ + have hr' : r ∈ N.R := hR ▸ hr + obtain ⟨v, hv, rfl⟩ := hsplit₂ hr' + exact hX.star_isOpenDisc hrad₁ hS hmax₁ hDE hv + have hhubK : ∀ {z}, z ∈ K.V → z ∉ Γ.V → z ∈ N.V := fun h₁ h₂ => hNV ▸ Or.inl ⟨h₁, h₂⟩ + have huniq : ∀ {v w}, v ∈ Γ.V → w ∈ star H v → w ∈ K.V → w = v := by + intro v w hv hw hwK + by_cases hwΓ : w ∈ Γ.V + · exact hX.star_eq hrad₁ hS hmax₁ hDE hwΓ hv (mem_star_self _ _) hw + · exact absurd (N.V_subset_U (hhubK hwK hwΓ)) (disjoint_left.mp (hX.star_off hrad₁ hv) hw) + have hpre : (PaintingOrDrawing.drawing Γ₁).IsPreRadialDrawing K := by + refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ + · change Γ₁.U ∩ K.U = Γ₁.V + rw [hU, h₁V] + apply subset_antisymm + · rintro z ⟨hz, hz'⟩ + have hzV := (hKN ⟨hz', hz⟩).2 + rw [hNV] at hzV + rcases hzV with hzV | ⟨e, he, rfl⟩ + · exact hzV + · exact absurd hz' (hL.m_K he) + · intro z hz + exact ⟨N.V_subset_U (hNV ▸ Or.inl hz), K.V_subset_U hz.1⟩ + · change Γ₁.V ⊆ K.V + rw [h₁V] + exact sdiff_subset + · intro r hr + have hr' : r ∈ N.R := hR ▸ (show r ∈ Γ₁.R from hr) + obtain ⟨v, hv, rfl⟩ := hsplit₂ hr' + exact ⟨v, ⟨mem_star_self _ _, radial_V hrad hv⟩, fun w hw => huniq hv hw.1 hw.2⟩ + · rintro w ⟨hw, hwn⟩ + have hwΓ : w ∈ Γ.V := by + by_contra hn + exact hwn (show w ∈ Γ₁.V from h₁V ▸ ⟨hw, hn⟩) + exact ⟨star H w, (show star H w ∈ Γ₁.R from hR.symm ▸ hsplit₁ hwΓ), mem_star_self _ _⟩ + · intro g hg + obtain ⟨v, hv, w, hw, hcap⟩ := hrad.2.2.2.2.2.1 g hg + refine ⟨w, (show w ∈ Γ₁.V from h₁V ▸ hw), v, ⟨radial_V hrad hv, ?_⟩, by rw [hcap, pair_comm]⟩ + intro hv' + have : v ∈ K.V \ Γ.V := h₁V ▸ hv' + exact this.2 hv + · intro g hg g' hg' _ u hu r hr w hw hc hc' ⟨Δ, hΔ, hsubΔ, hb⟩ + have hr' : r ∈ N.R := hR ▸ (show r ∈ Γ₁.R from hr) + obtain ⟨v, hv, rfl⟩ := hsplit₂ hr' + have huK : u ∈ K.V \ Γ.V := h₁V ▸ (show u ∈ Γ₁.V from hu) + have hdb : discBd Δ = closure g ∪ closure g' := by + rw [← hb, subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hS hΔ] + have hgH : ∀ {g}, g ∈ K.E → closure g ⊆ H.U := fun hg z hz => + Or.inr (Or.inl (K.closure_subset_U hg hz)) + refine hX.no_disc_in_star hrad₁ hS hmax₁ hDE hv hΔ hsubΔ (fun h' => ?_) + (Or.inr (Or.inl (K.V_subset_U huK.1))) ?_ + · rw [hL.V_eq] at h' + rcases h' with h' | ⟨e, he, rfl⟩ + · exact huK.2 h' + · exact hL.m_K he (K.V_subset_U huK.1) + · rw [hdb] + exact union_subset (hgH hg) (hgH hg') + have hallΓ₁ : ∀ z ∈ Γ₁.V, ∃ g ∈ Γ₁.E, z ∈ closure g := by + intro z hz + rw [h₁V] at hz + obtain ⟨e, he, b, rfl⟩ := hL.exists_hub hz.1 hz.2 hmax hS hE + refine ⟨_, h₁E ▸ mem_image_of_mem _ he, ?_⟩ + have hsubL : range (ℓ (e, b)) \ {m e, h (e, b)} ⊆ + (range (ℓ (e, true)) ∪ range (ℓ (e, false))) \ {h (e, true), h (e, false)} := by + rintro w ⟨hw, hwn⟩ + have hwf : w ∈ f (e, b) := by + rcases hL.mem_line he b hw with h₁ | h₁ | h₁ + · exact h₁ + · exact absurd (Or.inl h₁) hwn + · exact absurd (Or.inr h₁) hwn + refine ⟨?_, ?_⟩ + · cases b + · exact Or.inr hw + · exact Or.inl hw + · rintro (h₁ | h₁) + · exact (hL.face_off he b hwf).2 (h₁ ▸ hL.hub_K he true) + · exact (hL.face_off he b hwf).2 (h₁ ▸ hL.hub_K he false) + have hcl := closure_sdiff_pair (hL.isLine he b) + refine closure_mono hsubL ?_ + rw [hcl] + exact line_right_mem (hL.isLine he b) + have hcard : 2 * Γ₁.E.ncard ≤ K.E.ncard := by + have h₁ := two_mul_le_ncard_spokes hrad hS hmax hE + have h₂ : Γ₁.E.ncard ≤ Γ.E.ncard := by + rw [h₁E] + exact ncard_image_le Γ.finite_edges + omega + exact ⟨htwo, hpre, radMax_of_card hS htwo hpre hallΓ₁ hcard⟩ + +/-- `Γ₁` is a dual of `Γ` made from lines through the faces of `Γ ∪ K`, as in `IsDualLines`. So each +edge of `Γ` meets `Γ₁` in one point, where it crosses its dual edge. -/ +def IsLineDual (Γ K Γ₁ : Drawing S) : Prop := + ∃ (hrad : PreRad (PaintingOrDrawing.drawing Γ) K) (D : Drawing S) (A B : Set S → Set S) + (m x y : Set S → S) (f : Set S × Bool → Set S) (h : Set S × Bool → S) + (ℓ : Set S × Bool → I → S), IsDualLines hrad D A B m x y f h ℓ ∧ + Γ₁.U = (K.V \ Γ.V) ∪ ⋃ e ∈ Γ.E, (range (ℓ (e, true)) ∪ range (ℓ (e, false))) ∧ + Γ₁.V = K.V \ Γ.V ∧ + Γ₁.E = (fun e => (range (ℓ (e, true)) ∪ range (ℓ (e, false))) \ + {h (e, true), h (e, false)}) '' Γ.E + +/-- `exists_surfaceDual_of_radial`, with the dual made from lines. -/ +theorem exists_lineDual_of_radial (hS : IsClosedSurface S) {Γ K : Drawing S} (hE : Γ.E.Nonempty) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) : + ∃ Γ₁ : Drawing S, (PaintingOrDrawing.drawing Γ₁).IsRadialDrawing K ∧ IsLineDual Γ K Γ₁ := by + have hrad : PreRad (PaintingOrDrawing.drawing Γ) K := ⟨hK.1, hK.2.1⟩ + have hmax : RadMax (PaintingOrDrawing.drawing Γ) K := hK.2.2 + obtain ⟨D, A, B, m, x, y, f, h, ℓ, hL⟩ := exists_dualLines hrad hS hmax hE + obtain ⟨Γ₁, h₁U, h₁V, h₁E⟩ := hL.exists_dual (K.finite_V.subset sdiff_subset) + exact ⟨Γ₁, hL.isRadial_dual hS hmax hE h₁U h₁V h₁E, + hrad, D, A, B, m, x, y, f, h, ℓ, hL, h₁U, h₁V, h₁E⟩ + +omit [T2Space S] [ConnectedSpace S] in +/-- See the module docstring. -/ +theorem exists_surfaceDual_of_radial (hS : IsClosedSurface S) {Γ K : Drawing S} (hE : Γ.E.Nonempty) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) : + ∃ Γ₁ : Drawing S, (PaintingOrDrawing.drawing Γ₁).IsRadialDrawing K ∧ Γ₁.V = K.V \ Γ.V := by + have : T2Space S := hS.2.1 + have : ConnectedSpace S := hK.1.1 + obtain ⟨Γ₁, h₁, -, -, -, -, -, -, -, -, -, -, -, -, h₁V, -⟩ := exists_lineDual_of_radial hS hE hK + exact ⟨Γ₁, h₁, h₁V⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/SurfaceDualContract.lean b/LeanPool/GraphMinor/GM12/SurfaceDualContract.lean new file mode 100644 index 0000000000..bc29989b6a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/SurfaceDualContract.lean @@ -0,0 +1,246 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.SurfaceDualContractLines + +/-! +# The contracted dual in Case 2 of XII (7.5) + +Let `Γ₁` be a line dual of `Γ` that shares the radial drawing `K`, and let `r*` be the vertex of `K` +in +the region `r` of `Γ`. Let `f` collapse the star of `r*` in `K`, as in +`exists_supported_radial_star_contraction`, and let `J` be the resulting radial drawing of `Γ₁ \ +r*`. +The theorem `exists_contracted_dual` gives a drawing `Γ₃` for which `J` is also radial, with edges +the +images under `f` of the edges of `Γ` that are not in `rBar - r`. This fills in the sentence of the +text that +puts the vertex of `Γ₃` formed by contracting these edges at a point of `r`, with `Γ₃` less that +vertex +equal to `Γ \ Z`. That vertex is `r*`. + +The lines of `exists_lines` give `Γ₃` by `IsDualLines.exists_dual`, and `J` is radial for it by +`IsDualLines.isRadial_dual`. The rest of the file works out the vertices and edges of `Γ₃`. +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +namespace IsContractSetting + +variable {Γ K D₀ Γ₁ H J : Drawing S} {hrad : PreRad (PaintingOrDrawing.drawing Γ) K} + {A B : Set S → Set S} {m x y : Set S → S} {φ : Set S × Bool → Set S} {h : Set S × Bool → S} + {ℓ : Set S × Bool → I → S} {hL : IsDualLines hrad D₀ A B m x y φ h ℓ} {r r₂ D : Set S} {v : S} + {f : C(S, S)} (C : IsContractSetting hL Γ₁ r v r₂ D f H J) + +include C + +omit [ConnectedSpace S] in +/-- The image of `e` is the image of its closure, less the images of its ends. -/ +theorem image_dual {e : Set S} (he : e ∈ Γ.E) : + (f '' closure (hal A B e true) ∪ f '' closure (hal A B e false)) \ + {f (halEnd x y e true), f (halEnd x y e false)} = f '' e := by + have hfwd : ∀ b, ∀ w ∈ closure (hal A B e b), f w ≠ f (halEnd x y e b) → f w ∈ f '' e := by + intro b w hw hne + rcases hL.mem_closure_hal he hw with h₁ | h₁ | h₁ + · exact ⟨w, hL.hal_subset he b h₁, rfl⟩ + · exact ⟨w, h₁ ▸ hL.m_mem he, rfl⟩ + · exact absurd (congrArg f h₁) hne + apply subset_antisymm + · rintro z ⟨⟨w, hw, rfl⟩ | ⟨w, hw, rfl⟩, hn⟩ + · exact hfwd true w hw fun h' => hn (Or.inl h') + · exact hfwd false w hw fun h' => hn (Or.inr h') + · rintro _ ⟨w, hw, rfl⟩ + have hwK : w ∉ K.U := disjoint_left.mp (edge_disjoint hrad he) hw + have hne : ∀ b, f w ≠ f (halEnd x y e b) := by + intro b h' + rcases C.fibre h' with h₁ | h₁ + · exact edge_notMem_V he hw (h₁ ▸ hL.hal_end he b) + · exact hwK (radialStar_subset C.hvK h₁.1) + refine ⟨?_, ?_⟩ + · by_cases hwm : w = m e + · exact Or.inl (mem_image_of_mem _ (hwm ▸ hL.m_mem_closure_hal he true)) + · obtain ⟨b, hb⟩ := hL.hal_cover he hw hwm + cases b + · exact Or.inr (mem_image_of_mem _ (subset_closure hb)) + · exact Or.inl (mem_image_of_mem _ (subset_closure hb)) + · rintro (h' | h') + · exact hne true h' + · exact hne false h' + +theorem image_fixed {e : Set S} (he : e ∈ Γ.E) (hd : Disjoint (closure e ∩ Γ.V) (closure r \ r)) : + f '' e = e := by + ext z + constructor + · rintro ⟨w, hw, rfl⟩ + rwa [C.fix_edge he hd hw] + · exact fun hz => ⟨z, hz, C.fix_edge he hd hz⟩ + +/-- The vertices of the contracted dual. -/ +theorem vertices_eq : J.V \ (deleteVertices Γ₁ {v}).V = (Γ.V \ (closure r \ r)) ∪ {v} := by + have hJV : J.V = f '' K.V := C.hc.J_V.trans C.hc.H_V + have hvstar : v ∈ radialStar K v := Or.inl rfl + ext z + constructor + · rintro ⟨hzJ, hzG⟩ + rw [hJV] at hzJ + obtain ⟨k, hk, rfl⟩ := hzJ + by_cases hstar : k ∈ radialStar K v + · exact Or.inr (C.hc.collapse k hstar) + by_cases hkΓ : k ∈ Γ.V + · have hkr : k ∉ closure r := fun h' => + hstar (IsDualLines.mem_star_of_closure (hrad := hrad) C.hS C.hmax C.hE C.hr C.hvr C.hvK hkΓ + h') + rw [C.fix_vertex hkΓ hkr] + exact Or.inl ⟨hkΓ, fun h' => hkr h'.1⟩ + · have hkG : k ∈ (deleteVertices Γ₁ {v}).V := by + rw [deleteVertices_V, C.V₁] + exact ⟨⟨hk, hkΓ⟩, fun h' => hstar ((mem_singleton_iff.mp h') ▸ hvstar)⟩ + exact absurd ((C.fix_U ((deleteVertices Γ₁ {v}).V_subset_U hkG)).symm ▸ hkG) hzG + · rintro (⟨hz, hz'⟩ | hz) + · refine ⟨?_, fun h' => C.vertex_off hz (U₂_sub ((deleteVertices Γ₁ {v}).V_subset_U h'))⟩ + rw [hJV] + exact ⟨z, radial_V hrad hz, C.fix_vertex hz (C.notMem_closure hz hz')⟩ + · obtain rfl : z = v := hz + refine ⟨?_, fun h' => ?_⟩ + · rw [hJV] + exact ⟨z, C.hvK, C.hc.collapse z hvstar⟩ + · rw [deleteVertices_V] at h' + exact h'.2 rfl + +/-- See the module docstring. -/ +theorem exists_contracted : ∃ Γ₃ : Drawing S, IsContractedDual Γ Γ₁ K J f r v Γ₃ := by + obtain ⟨D₂, A₂, B₂, m₂, x₂, y₂, φ₂, h₂, ℓ₂, hL₂, hspec⟩ := C.exists_lines + obtain ⟨Γ₃, h₃U, h₃V, h₃E⟩ := hL₂.exists_dual (J.finite_V.subset sdiff_subset) + have hrad₃ := hL₂.isRadial_dual C.hS C.hJ.2.2 C.hE₂ h₃U h₃V h₃E + have hV₃ : Γ₃.V = (Γ.V \ (closure r \ r)) ∪ {v} := h₃V.trans C.vertices_eq + have key : ∀ e ∈ Γ.E, ¬ e ⊆ closure r \ r → + (range (ℓ₂ (dualEdge h ℓ e, true)) ∪ range (ℓ₂ (dualEdge h ℓ e, false))) \ + {h₂ (dualEdge h ℓ e, true), h₂ (dualEdge h ℓ e, false)} = f '' e := by + intro e he hn + obtain ⟨-, hT, hhT⟩ := hspec e he hn true + obtain ⟨-, hF, hhF⟩ := hspec e he hn false + rw [hT, hF, hhT, hhF] + exact C.image_dual he + have hE₃ : Γ₃.E = (fun e => f '' e) '' {e ∈ Γ.E | ¬ e ⊆ closure r \ r} := by + rw [h₃E] + ext e' + constructor + · rintro ⟨g, hg, rfl⟩ + obtain ⟨e, he, hn, rfl⟩ := C.exists_of_mem hg + exact ⟨e, ⟨he, hn⟩, (key e he hn).symm⟩ + · rintro ⟨e, ⟨he, hn⟩, rfl⟩ + exact ⟨_, C.dual_mem he hn, key e he hn⟩ + have hfix : ∀ e ∈ Γ.E, Disjoint (closure e ∩ Γ.V) (closure r \ r) → f '' e = e := + fun e he hd => C.image_fixed he hd + have hvV₃ : v ∈ Γ₃.V := by + rw [hV₃] + exact Or.inr rfl + have hdualK : ∀ e ∈ Γ.E, ∃ s ∈ K.R, e ⊆ s ∧ dualEdge h ℓ e ⊆ s := by + intro e he + obtain ⟨s, hs, hes, hs'⟩ := hL.exists_region C.hS C.hmax C.hE he + refine ⟨s, hs, hes, fun z hz => ?_⟩ + rcases hL.mem_dualEdge he hz with ⟨b, hb⟩ | h₁ + · rw [hs'] + cases b + · exact Or.inl (Or.inr hb) + · exact Or.inl (Or.inl hb) + · exact h₁ ▸ hes (hL.m_mem he) + have hne₃ : Γ₃.E.Nonempty := by + obtain ⟨g, hg⟩ := C.hE₂ + obtain ⟨e, he, hn, -⟩ := C.exists_of_mem hg + rw [hE₃] + exact ⟨_, e, ⟨he, hn⟩, rfl⟩ + refine ⟨Γ₃, hrad₃, hne₃, hV₃, ?_, hE₃, hfix, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · refine Drawing.ext_of_V_E ?_ ?_ + · rw [deleteVertices_V, deleteVertices_V, hV₃] + ext z + constructor + · rintro ⟨hz | hz, hzv⟩ + · exact ⟨hz.1, fun h' => hz.2 h'.2⟩ + · exact absurd hz hzv + · rintro ⟨hz, hz'⟩ + exact ⟨Or.inl ⟨hz, fun h' => hz' ⟨hz, h'⟩⟩, fun h' => C.v_notMem (h' ▸ hz)⟩ + · rw [deleteVertices_E, deleteVertices_E] + ext e' + constructor + · rintro ⟨he', hd⟩ + rw [hE₃] at he' + obtain ⟨e, ⟨he, hn⟩, rfl⟩ := he' + have hde : Disjoint (closure e ∩ Γ.V) (closure r \ r) := by + refine disjoint_left.mpr ?_ + rintro u ⟨hu, huV⟩ huZ + have hfu := C.collapse_vertex huV huZ.1 + have hvc : v ∈ closure (f '' e) := + hfu ▸ image_closure_subset_closure_image f.continuous ⟨u, hu, rfl⟩ + exact disjoint_left.mp hd ⟨hvc, hvV₃⟩ rfl + change f '' e ∈ _ + rw [hfix e he hde] + exact ⟨he, disjoint_left.mpr fun u h₁ h₂ => disjoint_left.mp hde h₁ h₂.2⟩ + · rintro ⟨he, hd⟩ + have hde : Disjoint (closure e' ∩ Γ.V) (closure r \ r) := + disjoint_left.mpr fun u h₁ h₂ => disjoint_left.mp hd h₁ ⟨h₁.2, h₂⟩ + refine ⟨?_, disjoint_left.mpr ?_⟩ + · rw [hE₃] + exact ⟨e', ⟨he, C.not_sub_of_ends he hde⟩, hfix e' he hde⟩ + · rintro u ⟨hu, -⟩ huv + obtain rfl : u = v := huv + exact region_subset C.hr C.hvr (Γ.closure_subset_U he hu) + · intro e he hn + refine ⟨_, C.dual_mem he hn, hdualK e he, ?_⟩ + · obtain ⟨s, hs, hgs, hs'⟩ := hL₂.exists_region C.hS C.hJ.2.2 C.hE₂ (C.dual_mem he hn) + refine ⟨s, hs, ?_, hgs⟩ + rintro _ ⟨z, hz, rfl⟩ + by_cases hzm : z = m e + · rw [hzm, C.m_fix he hn] + exact hgs (hL.m_mem_dualEdge he) + · obtain ⟨b, hb⟩ := hL.hal_cover he hz hzm + have hmem := (hspec e he hn b).1 ⟨z, hb, rfl⟩ + rw [hs'] + cases b + · exact Or.inl (Or.inr hmem) + · exact Or.inl (Or.inl hmem) + · intro w hw t ht hwt + exact C.region_mem hw.1 (C.notMem_closure hw.1 hw.2) ht hwt + · exact fun e he hd => C.not_sub_of_ends he hd + · exact fun u hu hur => C.collapse_vertex hu hur + · intro e he hsub + refine ⟨_, C.E₁ ▸ mem_image_of_mem _ he, C.mem_closure_dual he hsub, ?_⟩ + exact hdualK e he + · exact fun u hu hur t ht hut => C.mem_closure_region hu hur ht hut + +end IsContractSetting + +/-- See the module docstring. The vertex `v` is `r*`, and `r₂` is the region of `Γ₁ \ v` around `v`. +The dual `Γ₁` must be a line dual, as `exists_lineDual_of_radial` gives: a dual that crosses an edge +of +`Γ` more than once could enter `r₂` through an edge that `f` must then move. -/ +theorem exists_contracted_dual (hS : IsClosedSurface S) {Γ Γ₁ K : Drawing S} (hE : Γ.E.Nonempty) + (hK : (PaintingOrDrawing.drawing Γ).IsRadialDrawing K) + (hK₁ : (PaintingOrDrawing.drawing Γ₁).IsRadialDrawing K) (hdual : IsLineDual Γ K Γ₁) + {r : Set S} (hr : r ∈ Γ.R) {v : S} (hvr : v ∈ r) (hvK : v ∈ K.V) + {r₂ : Set S} (hr₂ : r₂ ∈ (deleteVertices Γ₁ {v}).R) (hvr₂ : v ∈ r₂) + {D : Set S} {f : C(S, S)} {H J : Drawing S} (hc : IsStarContraction K v r₂ D f H J) + (hJ : (PaintingOrDrawing.drawing (deleteVertices Γ₁ {v})).IsRadialDrawing J) + (hE₂ : (deleteVertices Γ₁ {v}).E.Nonempty) : + ∃ Γ₃ : Drawing S, IsContractedDual Γ Γ₁ K J f r v Γ₃ := by + obtain ⟨hrad, D₀, A, B, m, x, y, φ, h, ℓ, hL, h₁U, h₁V, h₁E⟩ := hdual + exact IsContractSetting.exists_contracted (hL := hL) (Γ₁ := Γ₁) + ⟨hS, hK.2.2, hE, hK₁, h₁U, h₁V, h₁E, hr, hvr, hvK, hr₂, hvr₂, hc, hJ, hE₂⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/SurfaceDualContractBase.lean b/LeanPool/GraphMinor/GM12/SurfaceDualContractBase.lean new file mode 100644 index 0000000000..76c6a11c40 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/SurfaceDualContractBase.lean @@ -0,0 +1,183 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.SurfaceDualContractDefs + +/-! +# A line dual, and the collapse of a star + +Facts for `exists_contracted_dual`. Let `Γ₁` be made from the lines of `IsDualLines`. Each edge `e` +of +`Γ` meets `Γ₁` only at `m e` (`inter_dual`), where it meets its dual edge `dualEdge`. + +A region of `Γ₁` with `v` off its closure is a region of `Γ₁ \ v` (`region_mem_delete`). +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The union of two lines of `IsDualLines`, less the hubs. -/ +def dualEdge (h : Set S × Bool → S) (ℓ : Set S × Bool → I → S) (e : Set S) : Set S := + (range (ℓ (e, true)) ∪ range (ℓ (e, false))) \ {h (e, true), h (e, false)} + +omit [ConnectedSpace S] in +/-- See the module docstring. -/ +theorem region_mem_delete (hS : IsClosedSurface S) {G : Drawing S} {v : S} {t : Set S} + (ht : t ∈ G.R) + (hv : v ∉ closure t) : t ∈ (deleteVertices G {v}).R := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + set G' := deleteVertices G {v} with hG' + have hsub : G'.U ⊆ G.U := (deleteVertices_isSubdrawing G {v}).U_subset + have hcl : closure t ⊆ t ∪ G'.U := by + intro y hy + rcases closure_region_subset ht hy with h' | h' + · exact Or.inl h' + by_cases hyV : y ∈ G.V + · have hyv : y ≠ v := fun h'' => hv (h'' ▸ hy) + have : y ∈ G'.V := by + rw [hG', deleteVertices_V] + exact ⟨hyV, hyv⟩ + exact Or.inr (G'.V_subset_U this) + · obtain ⟨g, hg, hyg⟩ := G.exists_edge_of_mem h' hyV + have hgt : g ⊆ closure t := edge_subset_closure_of_incident hS hg ht ⟨y, hyg, hy⟩ + have hgG' : g ∈ G'.E := by + rw [hG', deleteVertices_E] + refine ⟨hg, disjoint_left.mpr fun z hz hzv => hv ?_⟩ + have hzv' : z = v := hzv + exact hzv' ▸ closure_minimal hgt isClosed_closure hz.1 + exact Or.inr (G'.closure_subset_U hgG' (subset_closure hyg)) + have hclosed : IsClosed (t ∪ G'.U) := by + refine isClosed_of_closure_subset ?_ + rw [closure_union, G'.isClosed_U.closure_eq] + exact union_subset (hcl.trans Subset.rfl) subset_union_right + have hdis : Disjoint t G'.U := disjoint_left.mpr fun z hz hz' => region_subset ht hz (hsub hz') + refine mem_R_of_split (C' := (t ∪ G'.U)ᶜ) (region_isOpen ht) hclosed.isOpen_compl + (region_nonempty ht) (region_isPreconnected ht) (disjoint_left.mpr fun z hz h' => h' + (Or.inl hz)) ?_ + ext z + constructor + · rintro (hz | hz) hzU + · exact disjoint_left.mp hdis hz hzU + · exact hz (Or.inr hzU) + · intro hz + by_cases hzt : z ∈ t + · exact Or.inl hzt + · refine Or.inr ?_ + rintro (h' | h') + · exact hzt h' + · exact hz h' + +namespace IsDualLines + +variable {Γ K D₀ Γ₁ : Drawing S} {hrad : PreRad (PaintingOrDrawing.drawing Γ) K} + {A B : Set S → Set S} {m x y : Set S → S} {φ : Set S × Bool → Set S} {h : Set S × Bool → S} + {ℓ : Set S × Bool → I → S} (hL : IsDualLines hrad D₀ A B m x y φ h ℓ) + (h₁U : Γ₁.U = (K.V \ Γ.V) ∪ ⋃ e ∈ Γ.E, (range (ℓ (e, true)) ∪ range (ℓ (e, false)))) + +include hL + +omit [ConnectedSpace S] in +theorem hub_mem_line {e : Set S} (he : e ∈ Γ.E) (b : Bool) : h (e, b) ∈ range (ℓ (e, b)) := + line_right_mem (hL.isLine he b) + +omit [ConnectedSpace S] in +theorem m_mem_line {e : Set S} (he : e ∈ Γ.E) (b : Bool) : m e ∈ range (ℓ (e, b)) := + line_left_mem (hL.isLine he b) + +omit [ConnectedSpace S] in +theorem m_mem_dualEdge {e : Set S} (he : e ∈ Γ.E) : m e ∈ dualEdge h ℓ e := by + refine ⟨Or.inl (hL.m_mem_line he true), ?_⟩ + rintro (h' | h') + · exact hL.hub_ne_m he he true h'.symm + · exact hL.hub_ne_m he he false h'.symm + +omit [T2Space S] [ConnectedSpace S] in +/-- A point of the dual edge is on a face beside `e` or is `m e`. -/ +theorem mem_dualEdge {e : Set S} (he : e ∈ Γ.E) {z : S} (hz : z ∈ dualEdge h ℓ e) : + (∃ b, z ∈ φ (e, b)) ∨ z = m e := by + obtain ⟨hz | hz, hn⟩ := hz + · rcases hL.mem_line he true hz with h₁ | h₁ | h₁ + · exact Or.inl ⟨true, h₁⟩ + · exact Or.inr h₁ + · exact absurd (Or.inl h₁) hn + · rcases hL.mem_line he false hz with h₁ | h₁ | h₁ + · exact Or.inl ⟨false, h₁⟩ + · exact Or.inr h₁ + · exact absurd (Or.inr h₁) hn + +omit [ConnectedSpace S] in +/-- The closure of the dual edge is the union of the two lines. -/ +theorem closure_dualEdge {e : Set S} (he : e ∈ Γ.E) : + closure (dualEdge h ℓ e) = range (ℓ (e, true)) ∪ range (ℓ (e, false)) := by + have hsub : ∀ b, range (ℓ (e, b)) \ {m e, h (e, b)} ⊆ dualEdge h ℓ e := by + rintro b z ⟨hz, hn⟩ + have hzf : z ∈ φ (e, b) := by + rcases hL.mem_line he b hz with h₁ | h₁ | h₁ + · exact h₁ + · exact absurd (Or.inl h₁) hn + · exact absurd (Or.inr h₁) hn + refine ⟨?_, ?_⟩ + · cases b + · exact Or.inr hz + · exact Or.inl hz + · rintro (h₁ | h₁) + · exact (hL.face_off he b hzf).2 (h₁ ▸ hL.hub_K he true) + · exact (hL.face_off he b hzf).2 (h₁ ▸ hL.hub_K he false) + apply subset_antisymm + · refine closure_minimal sdiff_subset ?_ + exact (isCompact_range (hL.cont e he true)).isClosed.union + (isCompact_range (hL.cont e he false)).isClosed + · refine union_subset ?_ ?_ + · have := closure_mono (hsub true) + rwa [closure_sdiff_pair (hL.isLine he true)] at this + · have := closure_mono (hsub false) + rwa [closure_sdiff_pair (hL.isLine he false)] at this + +omit [ConnectedSpace S] in +theorem dualEdge_inj {e e' : Set S} (he : e ∈ Γ.E) (he' : e' ∈ Γ.E) + (heq : dualEdge h ℓ e = dualEdge h ℓ e') : e = e' := by + have hm := hL.m_mem_dualEdge he + rw [heq] at hm + rcases hL.mem_dualEdge he' hm with ⟨b, hb⟩ | h₁ + · exact absurd (hL.m_U he) (hL.face_off he' b hb).1 + · exact hL.m_inj he he' h₁ + +include h₁U in +omit [T2Space S] [ConnectedSpace S] in +/-- An edge of `Γ` meets the dual only at `m e`. -/ +theorem inter_dual {e : Set S} (he : e ∈ Γ.E) {z : S} (hz : z ∈ e) (hz' : z ∈ Γ₁.U) : z = m e := by + have hzK : z ∉ K.U := disjoint_left.mp (edge_disjoint hrad he) hz + have hzU : z ∈ Γ.U := Γ.closure_subset_U he (subset_closure hz) + rw [h₁U] at hz' + rcases hz' with hz' | hz' + · exact absurd (K.V_subset_U hz'.1) hzK + · obtain ⟨e', he', hz'⟩ := mem_iUnion₂.mp hz' + have key : ∀ b, z ∈ range (ℓ (e', b)) → z = m e := by + intro b hzb + rcases hL.mem_line he' b hzb with h₁ | h₁ | h₁ + · exact absurd hzU (hL.face_off he' b h₁).1 + · obtain rfl := hL.m_inj he he' (Γ.edge_eq_of_mem he he' hz (h₁ ▸ hL.m_mem he') ▸ rfl) + exact h₁ + · exact absurd (h₁ ▸ hzK) (fun h' => h' (hL.hub_K he' b)) + rcases hz' with hz' | hz' + · exact key true hz' + · exact key false hz' + +end IsDualLines + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/SurfaceDualContractDefs.lean b/LeanPool/GraphMinor/GM12/SurfaceDualContractDefs.lean new file mode 100644 index 0000000000..47e7b451b5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/SurfaceDualContractDefs.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.SurfaceDual +public import LeanPool.GraphMinor.GM12.Section76 + +/-! +# The setting of the contracted dual in Case 2 of XII (7.5) + +The structures for `exists_contracted_dual`, in `SurfaceDualContract.lean`. +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The vertex `v` with the closures of the edges of `K` at `v`. -/ +def radialStar (K : Drawing S) (v : S) : Set S := + {v} ∪ ⋃ e ∈ {e ∈ K.E | v ∈ closure e}, closure e + +/-- The part of the conclusion of `exists_supported_radial_star_contraction` that we use. The map +`f` +collapses the star of `v` in `K` to `v`, and it fixes all points off the interior of a closed disc +`D` +in the region `r`. The drawing `H` is the image of `K`, and `J` is a subdrawing of `H` on the same +vertices. -/ +structure IsStarContraction (K : Drawing S) (v : S) (r D : Set S) (f : C(S, S)) (H J : Drawing S) : + Prop where + disc : IsClosedDisc D + sub : D ⊆ r + fix : ∀ x ∉ discInt D, f x = x + collapse : ∀ x ∈ radialStar K v, f x = v + fibre : ∀ x y, f x = f y ↔ x = y ∨ x ∈ radialStar K v ∧ y ∈ radialStar K v + H_U : H.U = f '' K.U + H_V : H.V = f '' K.V + J_sub : J.IsSubdrawing H + J_V : J.V = H.V + +/-- The conclusion of `exists_contracted_dual`, for `Z = V(Γ) ∩ (rBar - r)` and `Γ₂ = Γ₁ \ r*`. The +first +four fields say what `Γ₃` is. The others give the correspondence between atoms that the end of Case +2 +uses: an edge `e` of `Γ` off `Z` is fixed by `f`, an edge `e` not in `rBar - r` lies with some edge +of +`Γ₂` in one region of `K`, and its image lies with that edge in one region of `J`, a region of `Γ₁` +around a vertex off `Z` is a region of `Γ₂`, an edge off `Z` is not in `rBar - r`, a vertex in `Z` +is sent +to `v`, and the duals of the atoms +of `rBar - r` are incident with `v`. -/ +structure IsContractedDual (Γ Γ₁ K J : Drawing S) (f : C(S, S)) (r : Set S) (v : S) + (Γ₃ : Drawing S) : + Prop where + radial : (PaintingOrDrawing.drawing Γ₃).IsRadialDrawing J + nonempty_E : Γ₃.E.Nonempty + V_eq : Γ₃.V = (Γ.V \ (closure r \ r)) ∪ {v} + delete_eq : deleteVertices Γ₃ {v} = deleteVertices Γ (Γ.V ∩ (closure r \ r)) + E_eq : Γ₃.E = (fun e => f '' e) '' {e ∈ Γ.E | ¬ e ⊆ closure r \ r} + fixed : ∀ e ∈ Γ.E, Disjoint (closure e ∩ Γ.V) (closure r \ r) → f '' e = e + edge_corr : ∀ e ∈ Γ.E, ¬ e ⊆ closure r \ r → ∃ g ∈ (deleteVertices Γ₁ {v}).E, + (∃ s ∈ K.R, e ⊆ s ∧ g ⊆ s) ∧ ∃ s ∈ J.R, f '' e ⊆ s ∧ g ⊆ s + vertex_corr : ∀ w ∈ Γ.V \ (closure r \ r), ∀ t ∈ Γ₁.R, w ∈ t → t ∈ (deleteVertices Γ₁ {v}).R + not_sub : ∀ e ∈ Γ.E, Disjoint (closure e ∩ Γ.V) (closure r \ r) → ¬ e ⊆ closure r \ r + collapse : ∀ u ∈ Γ.V, u ∈ closure r → f u = v + edge_bd : ∀ e ∈ Γ.E, e ⊆ closure r \ r → + ∃ g ∈ Γ₁.E, v ∈ closure g ∧ ∃ s ∈ K.R, e ⊆ s ∧ g ⊆ s + vertex_bd : ∀ u ∈ Γ.V, u ∈ closure r → ∀ t ∈ Γ₁.R, u ∈ t → v ∈ closure t + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/SurfaceDualContractFix.lean b/LeanPool/GraphMinor/GM12/SurfaceDualContractFix.lean new file mode 100644 index 0000000000..77c40f3ddf --- /dev/null +++ b/LeanPool/GraphMinor/GM12/SurfaceDualContractFix.lean @@ -0,0 +1,293 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.SurfaceDualContractStar + +/-! +# What the collapse moves + +The setting of `exists_contracted_dual` is `IsContractSetting`. Write `G` for `Γ₁ \ v`. Points of +`G` are +fixed by `f` (`fix_U`), since `D` lies in a region of `G`. A vertex of `Γ` off `rBar` lies in a +region of +`Γ₁` with `v` off its closure (`vertex_region`), since otherwise `K` would have an edge from the +vertex +to `v`. That region is a region of `G` other than `r₂`. So an edge of `Γ` with no end in `rBar - r` +is fixed +pointwise (`fix_edge`). + +An edge `e` of `Γ` is in `rBar - r` exactly when its dual is not in `G`, by `dual_mem` and +`exists_of_mem`. +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The hypotheses of `exists_contracted_dual`, with the lines of the dual written out. -/ +structure IsContractSetting {Γ K D₀ : Drawing S} {hrad : PreRad (PaintingOrDrawing.drawing Γ) K} + {A B : Set S → Set S} {m x y : Set S → S} {φ : Set S × Bool → Set S} {h : Set S × Bool → S} + {ℓ : Set S × Bool → I → S} (hL : IsDualLines hrad D₀ A B m x y φ h ℓ) (Γ₁ : Drawing S) + (r : Set S) (v : S) (r₂ D : Set S) (f : C(S, S)) (H J : Drawing S) : Prop where + hS : IsClosedSurface S + hmax : RadMax (PaintingOrDrawing.drawing Γ) K + hE : Γ.E.Nonempty + hK₁ : (PaintingOrDrawing.drawing Γ₁).IsRadialDrawing K + U₁ : Γ₁.U = (K.V \ Γ.V) ∪ ⋃ e ∈ Γ.E, (range (ℓ (e, true)) ∪ range (ℓ (e, false))) + V₁ : Γ₁.V = K.V \ Γ.V + E₁ : Γ₁.E = dualEdge h ℓ '' Γ.E + hr : r ∈ Γ.R + hvr : v ∈ r + hvK : v ∈ K.V + hr₂ : r₂ ∈ (deleteVertices Γ₁ {v}).R + hvr₂ : v ∈ r₂ + hc : IsStarContraction K v r₂ D f H J + hJ : (PaintingOrDrawing.drawing (deleteVertices Γ₁ {v})).IsRadialDrawing J + hE₂ : (deleteVertices Γ₁ {v}).E.Nonempty + +namespace IsContractSetting + +variable {Γ K D₀ Γ₁ H J : Drawing S} {hrad : PreRad (PaintingOrDrawing.drawing Γ) K} + {A B : Set S → Set S} {m x y : Set S → S} {φ : Set S × Bool → Set S} {h : Set S × Bool → S} + {ℓ : Set S × Bool → I → S} {hL : IsDualLines hrad D₀ A B m x y φ h ℓ} {r r₂ D : Set S} {v : S} + {f : C(S, S)} (C : IsContractSetting hL Γ₁ r v r₂ D f H J) + +include C + +omit [ConnectedSpace S] in +theorem hrad₂ : PreRad (PaintingOrDrawing.drawing (deleteVertices Γ₁ {v})) J := ⟨C.hJ.1, C.hJ.2.1⟩ + +omit [ConnectedSpace S] in +theorem hrad₁ : PreRad (PaintingOrDrawing.drawing Γ₁) K := ⟨C.hK₁.1, C.hK₁.2.1⟩ + +omit [ConnectedSpace S] in +theorem v_notMem : v ∉ Γ.V := fun h' => region_subset C.hr C.hvr (Γ.V_subset_U h') + +omit [ConnectedSpace S] in +theorem v_mem₁ : v ∈ Γ₁.V := by + rw [C.V₁] + exact ⟨C.hvK, C.v_notMem⟩ + +omit [ConnectedSpace S] in +theorem fix_off {z : S} (hz : z ∉ D) : f z = z := C.hc.fix z fun h' => hz (discInt_subset D h') + +omit [ConnectedSpace S] in +theorem fix_off_r₂ {z : S} (hz : z ∉ r₂) : f z = z := C.fix_off fun h' => hz (C.hc.sub h') + +omit [ConnectedSpace S] in +theorem fix_U {z : S} (hz : z ∈ (deleteVertices Γ₁ {v}).U) : f z = z := + C.fix_off_r₂ fun h' => region_subset C.hr₂ h' hz + +omit [ConnectedSpace S] in +theorem fibre {a b : S} (hab : f a = f b) : a = b ∨ a ∈ radialStar K v ∧ b ∈ radialStar K v := + (C.hc.fibre a b).1 hab + +omit [ConnectedSpace S] C in +theorem U₂_sub : (deleteVertices Γ₁ {v}).U ⊆ Γ₁.U := (deleteVertices_isSubdrawing Γ₁ {v}).U_subset + +omit [ConnectedSpace S] in +/-- A point off `Γ₁` and off `K` has its image off `G ∪ J`. -/ +theorem image_off {z : S} (h₁ : z ∉ Γ₁.U) (hK : z ∉ K.U) : f z ∉ (radialUnion C.hrad₂).U := by + have hstar : z ∉ radialStar K v := fun h' => hK (radialStar_subset C.hvK h') + rw [radialUnion_U] + rintro (h' | h') + · rcases C.fibre (C.fix_U h') with h'' | h'' + · exact h₁ (U₂_sub (h'' ▸ h')) + · exact hstar h''.2 + · have hH : f z ∈ H.U := C.hc.J_sub.U_subset h' + rw [C.hc.H_U] at hH + obtain ⟨k, hk, hkz⟩ := hH + rcases C.fibre hkz with h'' | h'' + · exact hK (h'' ▸ hk) + · exact hstar h''.2 + +omit [ConnectedSpace S] in +/-- A vertex of `K` on the star is `v` or a vertex of `Γ`. -/ +theorem star_inter_V {z : S} (hz : z ∈ radialStar K v) (hzK : z ∈ K.V) : z = v ∨ z ∈ Γ.V := by + rcases hz with hz | hz + · exact Or.inl hz + obtain ⟨g, ⟨hg, hvg⟩, hzg⟩ := mem_iUnion₂.mp hz + obtain ⟨u, hu, -, -, w, -, -, hcap, -⟩ := spoke_ends hrad C.hS hg + have hv' : v ∈ closure g ∩ K.V := ⟨hvg, C.hvK⟩ + have hz' : z ∈ closure g ∩ K.V := ⟨hzg, hzK⟩ + rw [hcap] at hv' hz' + rcases hz' with h' | h' + · exact Or.inr (h' ▸ hu) + · rcases hv' with h'' | h'' + · exact absurd (h'' ▸ hu) C.v_notMem + · exact Or.inl (h'.trans h''.symm) + +omit [ConnectedSpace S] in +theorem vertex_off {w : S} (hw : w ∈ Γ.V) : w ∉ Γ₁.U := by + intro h' + have hwK : w ∈ K.V := radial_V hrad hw + have : w ∈ Γ₁.V := by + rw [← radial_inter C.hrad₁] + exact ⟨h', K.V_subset_U hwK⟩ + rw [C.V₁] at this + exact this.2 hw + +omit [ConnectedSpace S] in +/-- Images of vertices of `Γ` are off `G`. -/ +theorem end_off {u : S} (hu : u ∈ Γ.V) : f u ∉ (deleteVertices Γ₁ {v}).U := by + intro h' + rcases C.fibre (C.fix_U h') with h'' | ⟨h₁, -⟩ + · exact C.vertex_off hu (U₂_sub (h'' ▸ h')) + · have hK : f u ∈ Γ₁.V := by + rw [← radial_inter C.hrad₁] + exact ⟨U₂_sub h', radialStar_subset C.hvK h₁⟩ + rw [C.V₁] at hK + rcases C.star_inter_V h₁ hK.1 with h₃ | h₃ + · exact region_subset C.hr₂ C.hvr₂ (h₃ ▸ h') + · exact hK.2 h₃ + +/-- See the module docstring. -/ +theorem vertex_region {w : S} (hw : w ∈ Γ.V) (hwr : w ∉ closure r) {t : Set S} (ht : t ∈ Γ₁.R) + (hwt : w ∈ t) : v ∉ closure t := by + intro hv + have hE₁ : Γ₁.E.Nonempty := C.hE₂.mono (deleteVertices_isSubdrawing Γ₁ {v}).2 + obtain ⟨g, hg, hcap⟩ := exists_spoke_at C.hrad₁ C.hK₁.2.2 C.hS hE₁ ht hwt (radial_V hrad hw) + C.v_mem₁ hv + have hv' : v ∈ closure g ∩ K.V := by rw [hcap]; simp + have hw' : w ∈ closure g ∩ K.V := by rw [hcap]; simp + have hstar : w ∈ radialStar K v := + Or.inr (mem_biUnion (show g ∈ {e ∈ K.E | v ∈ closure e} from ⟨hg, hv'.1⟩) hw'.1) + exact hwr (IsDualLines.star_vertex (hrad := hrad) C.hS C.hr C.hvr C.hvK hstar hw) + +/-- A region of `Γ₁` around a vertex of `Γ` off `rBar` is a region of `G`. -/ +theorem region_mem {w : S} (hw : w ∈ Γ.V) (hwr : w ∉ closure r) {t : Set S} (ht : t ∈ Γ₁.R) + (hwt : w ∈ t) : t ∈ (deleteVertices Γ₁ {v}).R := + region_mem_delete C.hS ht (C.vertex_region hw hwr ht hwt) + +/-- A region of `Γ₁` around a vertex of `Γ` off `rBar` misses `r₂`. -/ +theorem region_off {w : S} (hw : w ∈ Γ.V) (hwr : w ∉ closure r) {t : Set S} (ht : t ∈ Γ₁.R) + (hwt : w ∈ t) {z : S} (hz : z ∈ t) : z ∉ r₂ := by + intro h' + obtain rfl := region_eq_of_mem (C.region_mem hw hwr ht hwt) C.hr₂ hz h' + exact region_subset ht C.hvr₂ (Γ₁.V_subset_U C.v_mem₁) + +theorem fix_vertex {w : S} (hw : w ∈ Γ.V) (hwr : w ∉ closure r) : f w = w := by + obtain ⟨t, ht, hwt⟩ := exists_region_of_notMem (C.vertex_off hw) + exact C.fix_off_r₂ (C.region_off hw hwr ht hwt hwt) + +theorem fix_hal {e : Set S} (he : e ∈ Γ.E) {b : Bool} (hu : halEnd x y e b ∉ closure r) {z : S} + (hz : z ∈ hal A B e b) : f z = z := by + obtain ⟨t, ht, hwt⟩ := exists_region_of_notMem (C.vertex_off (hL.hal_end he b)) + exact C.fix_off_r₂ (C.region_off (hL.hal_end he b) hu ht hwt (hL.hal_in_region C.U₁ he b ht hwt + hz)) + +omit [ConnectedSpace S] in +theorem dual_mem {e : Set S} (he : e ∈ Γ.E) (hn : ¬ e ⊆ closure r \ r) : + dualEdge h ℓ e ∈ (deleteVertices Γ₁ {v}).E := by + rw [deleteVertices_E] + refine ⟨C.E₁ ▸ mem_image_of_mem _ he, disjoint_left.mpr ?_⟩ + rintro z ⟨hz, -⟩ hzv + obtain rfl : z = v := hzv + rw [hL.closure_dualEdge he] at hz + have key : ∀ b, z ∈ range (ℓ (e, b)) → False := by + intro b hb + rcases hL.mem_line he b hb with h₁ | h₁ | h₁ + · exact (hL.face_off he b h₁).2 (K.V_subset_U C.hvK) + · exact hL.m_K he (h₁ ▸ K.V_subset_U C.hvK) + · exact hn (hL.hub_eq_subset C.hr C.hvr he h₁.symm) + rcases hz with hz | hz + · exact key true hz + · exact key false hz + +omit [ConnectedSpace S] in +theorem exists_of_mem {g : Set S} (hg : g ∈ (deleteVertices Γ₁ {v}).E) : + ∃ e, e ∈ Γ.E ∧ ¬ e ⊆ closure r \ r ∧ g = dualEdge h ℓ e := by + rw [deleteVertices_E] at hg + obtain ⟨hg₁, hd⟩ := hg + rw [C.E₁] at hg₁ + obtain ⟨e, he, rfl⟩ := hg₁ + refine ⟨e, he, fun hsub => ?_, rfl⟩ + obtain ⟨b, hb⟩ := hL.exists_hub_eq C.hS C.hr C.hvr C.hvK he hsub + have hv : v ∈ closure (dualEdge h ℓ e) := by + rw [hL.closure_dualEdge he, ← hb] + cases b + · exact Or.inr (hL.hub_mem_line he false) + · exact Or.inl (hL.hub_mem_line he true) + exact disjoint_left.mp hd ⟨hv, C.v_mem₁⟩ rfl + +omit [ConnectedSpace S] in +/-- The dual of an edge in `rBar - r` is incident with `v`. -/ +theorem mem_closure_dual {e : Set S} (he : e ∈ Γ.E) (hsub : e ⊆ closure r \ r) : + v ∈ closure (dualEdge h ℓ e) := by + obtain ⟨b, hb⟩ := hL.exists_hub_eq C.hS C.hr C.hvr C.hvK he hsub + rw [hL.closure_dualEdge he, ← hb] + cases b + · exact Or.inr (hL.hub_mem_line he false) + · exact Or.inl (hL.hub_mem_line he true) + +/-- A region of `Γ₁` around a vertex of `Γ` on `rBar` has `v` in its closure, by the spoke of `K` +between +them. -/ +theorem mem_closure_region {u : S} (hu : u ∈ Γ.V) (hur : u ∈ closure r) {t : Set S} + (ht : t ∈ Γ₁.R) (hut : u ∈ t) : v ∈ closure t := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace C.hS + obtain ⟨g, hg, hcap⟩ := exists_spoke_at hrad C.hmax C.hS C.hE C.hr C.hvr C.hvK hu hur + have hu' : u ∈ closure g ∩ K.V := by rw [hcap]; simp + have hv' : v ∈ closure g ∩ K.V := by rw [hcap]; simp + obtain ⟨x, hxt, hxg⟩ := mem_closure_iff.mp hu'.1 t (region_isOpen ht) hut + have hgt : g ⊆ t := subset_region ht hg.2.2.1.isConnected.isPreconnected + (spoke_disjoint C.hrad₁ hg) hxg hxt + exact closure_mono hgt hv'.1 + +omit [ConnectedSpace S] in +theorem dual_U {e : Set S} (he : e ∈ Γ.E) (hn : ¬ e ⊆ closure r \ r) : + dualEdge h ℓ e ⊆ (deleteVertices Γ₁ {v}).U := + subset_closure.trans ((deleteVertices Γ₁ {v}).closure_subset_U (C.dual_mem he hn)) + +omit [ConnectedSpace S] in +theorem m_fix {e : Set S} (he : e ∈ Γ.E) (hn : ¬ e ⊆ closure r \ r) : f (m e) = m e := + C.fix_U (C.dual_U he hn (hL.m_mem_dualEdge he)) + +/-- A vertex of `Γ` on `rBar` is sent to `v`. -/ +theorem collapse_vertex {u : S} (hu : u ∈ Γ.V) (hur : u ∈ closure r) : f u = v := + C.hc.collapse u (IsDualLines.mem_star_of_closure (hrad := hrad) C.hS C.hmax C.hE C.hr C.hvr C.hvK + hu hur) + +omit [ConnectedSpace S] in +/-- An end of an edge not in `rBar - r` lies off `rBar` when it is not in `rBar - r`. -/ +theorem notMem_closure {u : S} (hu : u ∈ Γ.V) (hu' : u ∉ closure r \ r) : u ∉ closure r := + fun h' => hu' ⟨h', fun h'' => region_subset C.hr h'' (Γ.V_subset_U hu)⟩ + +omit [ConnectedSpace S] in +theorem not_sub_of_ends {e : Set S} (he : e ∈ Γ.E) + (hd : Disjoint (closure e ∩ Γ.V) (closure r \ r)) : ¬ e ⊆ closure r \ r := by + intro hsub + have hmem := hL.end_mem_closure_hal he true + have hu : halEnd x y e true ∈ closure e := closure_mono (hL.hal_subset he true) hmem + have hV := hL.hal_end he true + exact C.notMem_closure hV (disjoint_left.mp hd ⟨hu, hV⟩) + (closure_minimal (hsub.trans sdiff_subset) isClosed_closure hu) + +/-- See the module docstring. -/ +theorem fix_edge {e : Set S} (he : e ∈ Γ.E) (hd : Disjoint (closure e ∩ Γ.V) (closure r \ r)) + {z : S} (hz : z ∈ e) : f z = z := by + by_cases hzm : z = m e + · exact hzm ▸ C.m_fix he (C.not_sub_of_ends he hd) + obtain ⟨b, hb⟩ := hL.hal_cover he hz hzm + have hV := hL.hal_end he b + have hu : halEnd x y e b ∈ closure e := closure_mono (hL.hal_subset he b) + (hL.end_mem_closure_hal he b) + exact C.fix_hal he (C.notMem_closure hV (disjoint_left.mp hd ⟨hu, hV⟩)) hb + +end IsContractSetting + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/SurfaceDualContractLines.lean b/LeanPool/GraphMinor/GM12/SurfaceDualContractLines.lean new file mode 100644 index 0000000000..e9b907e703 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/SurfaceDualContractLines.lean @@ -0,0 +1,313 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.SurfaceDualContractFix + +/-! +# Lines for the contracted dual + +We give `IsDualLines` data for `G = Γ₁ \ v` and `J` (`exists_lines`). The point on the edge `e*` of +`G` is +`m e`, and the two lines are the images under `f` of the two halves of `e`, with their ends. Each +image +misses `G ∪ J`, so it lies in one face of `G ∪ J`. The main step is `face_ne`, that the two faces +differ. +Near `m e` the map `f` is the identity. The dual edge cuts the region `s` of `K` around `e` into two +parts, and the image of each part stays in one face and meets a half of `e`. Near `m e` these two +parts +fill a neighbourhood of `m e`, so they meet both faces beside `e*`. +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +namespace IsContractSetting + +variable {Γ K D₀ Γ₁ H J : Drawing S} {hrad : PreRad (PaintingOrDrawing.drawing Γ) K} + {A B : Set S → Set S} {m x y : Set S → S} {φ : Set S × Bool → Set S} {h : Set S × Bool → S} + {ℓ : Set S × Bool → I → S} {hL : IsDualLines hrad D₀ A B m x y φ h ℓ} {r r₂ D : Set S} {v : S} + {f : C(S, S)} (C : IsContractSetting hL Γ₁ r v r₂ D f H J) + +include C + +omit [ConnectedSpace S] in +/-- In the region of `K` around `e`, the only points of `Γ₁` are those on the two lines of `e`. -/ +theorem cut_off_dual {e s : Set S} (he : e ∈ Γ.E) (hs : s ∈ K.R) + (hs' : s = φ (e, true) ∪ φ (e, false) ∪ e) {z : S} (hz : z ∈ s) + (hzC : z ∉ range (ℓ (e, true)) ∪ range (ℓ (e, false))) : z ∉ Γ₁.U := by + have hzK : z ∉ K.U := region_subset hs hz + have hzC' : ∀ b, z ∉ range (ℓ (e, b)) := by + intro b hb + cases b + · exact hzC (Or.inr hb) + · exact hzC (Or.inl hb) + have hzcases : (∃ b, z ∈ φ (e, b)) ∨ z ∈ e := by + have hz₂ := hz + rw [hs'] at hz₂ + rcases hz₂ with (h₁ | h₁) | h₁ + · exact Or.inl ⟨true, h₁⟩ + · exact Or.inl ⟨false, h₁⟩ + · exact Or.inr h₁ + rw [C.U₁] + rintro (h' | h') + · exact hzK (K.V_subset_U h'.1) + obtain ⟨e', he', hz'⟩ := mem_iUnion₂.mp h' + have key : ∀ b, z ∉ range (ℓ (e', b)) := by + intro b hb + rcases hL.mem_line he' b hb with h₁ | h₁ | h₁ + · rcases hzcases with ⟨b', hb'⟩ | h₂ + · obtain rfl := hL.face_unique e' he' e he b b' + (region_eq_of_mem (hL.face e' he' b).1 (hL.face e he b').1 h₁ hb') + exact hzC' b hb + · exact (hL.face_off he' b h₁).1 (Γ.closure_subset_U he (subset_closure h₂)) + · rcases hzcases with ⟨b', hb'⟩ | h₂ + · exact (hL.face_off he b' hb').1 (h₁ ▸ hL.m_U he') + · obtain rfl := Γ.edge_eq_of_mem he he' h₂ (h₁ ▸ hL.m_mem he') + exact hzC' b hb + · exact hzK (h₁ ▸ hL.hub_K he' b) + rcases hz' with hz' | hz' + · exact key true hz' + · exact key false hz' + +omit [ConnectedSpace S] in +/-- A part `T` of `s` that meets `e` has its image in the face of the image of a half of `e`. -/ +theorem side {e s T P : Set S} (he : e ∈ Γ.E) (hs : s ∈ K.R) + (hs' : s = φ (e, true) ∪ φ (e, false) ∪ e) (hTc : IsPreconnected T) + (hTs : T ⊆ s \ (range (ℓ (e, true)) ∪ range (ℓ (e, false)))) (hTe : (T ∩ e).Nonempty) + (hP : P ∈ (radialUnion C.hrad₂).R) (hhal : ∀ b, f '' hal A B e b ⊆ P) {y : S} (hy : y ∈ T) + (hyD : y ∉ D) : y ∈ P := by + obtain ⟨z, hzT, hze⟩ := hTe + have hzm : z ≠ m e := fun h' => (hTs hzT).2 (Or.inl (h' ▸ hL.m_mem_line he true)) + obtain ⟨b, hb⟩ := hL.hal_cover he hze hzm + have hoff : Disjoint (f '' T) (radialUnion C.hrad₂).U := by + refine disjoint_left.mpr ?_ + rintro _ ⟨w, hw, rfl⟩ + exact C.image_off (C.cut_off_dual he hs hs' (hTs hw).1 (hTs hw).2) + (region_subset hs (hTs hw).1) + have hsub : f '' T ⊆ P := subset_region hP (hTc.image f f.continuous.continuousOn) hoff + (mem_image_of_mem _ hzT) (hhal b ⟨z, hb, rfl⟩) + have := hsub ⟨y, hy, rfl⟩ + rwa [C.fix_off hyD] at this + +omit [T2Space S] [ConnectedSpace S] C in +/-- The image of the closure of a half lies in the closure of a face that holds the image of the +half. -/ +theorem image_closure_hal {e P : Set S} {b : Bool} (hhal : f '' hal A B e b ⊆ P) {z : S} + (hz : z ∈ closure (hal A B e b)) : f z ∈ closure P := + closure_mono hhal (image_closure_subset_closure_image f.continuous ⟨z, hz, rfl⟩) + +omit [ConnectedSpace S] in +theorem dual_mem_W {e : Set S} (he : e ∈ Γ.E) (hn : ¬ e ⊆ closure r \ r) : + dualEdge h ℓ e ∈ (radialUnion C.hrad₂).E := by + rw [radialUnion_E] + exact Or.inl (C.dual_mem he hn) + +omit [ConnectedSpace S] in +theorem dual_sub_closure {e P : Set S} (he : e ∈ Γ.E) (hn : ¬ e ⊆ closure r \ r) + (hP : P ∈ (radialUnion C.hrad₂).R) {b : Bool} (hhal : f '' hal A B e b ⊆ P) : + dualEdge h ℓ e ⊆ closure P := by + have hm : m e ∈ closure P := by + have := image_closure_hal hhal (hL.m_mem_closure_hal he b) + rwa [C.m_fix he hn] at this + exact edge_subset_closure_of_incident C.hS (C.dual_mem_W he hn) hP + ⟨m e, hL.m_mem_dualEdge he, hm⟩ + +/-- The images of the two halves of `e` are not in one face. See the module docstring. -/ +theorem face_ne {e P : Set S} (he : e ∈ Γ.E) (hn : ¬ e ⊆ closure r \ r) + (hP : P ∈ (radialUnion C.hrad₂).R) (hhal : ∀ b, f '' hal A B e b ⊆ P) : False := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace C.hS + have hgP := C.dual_sub_closure he hn hP (hhal true) + obtain ⟨p, hp, q, hq, hpq, hep, heq, hall⟩ := + exists_two_faces C.hrad₂ C.hS C.hJ.2.2 C.hE₂ (C.dual_mem he hn) + obtain ⟨Q, hQ, hQne, hgQ⟩ : ∃ Q ∈ (radialUnion C.hrad₂).R, Q ≠ P ∧ dualEdge h ℓ e ⊆ closure Q + := by + rcases hall P hP hgP with rfl | rfl + · exact ⟨q, hq, hpq.symm, heq⟩ + · exact ⟨p, hp, hpq, hep⟩ + obtain ⟨s, hs, T₁, T₂, hes, hs', hT₁, hT₂, -, hcov, hm₁, hm₂⟩ := + hL.exists_cut_region C.hS C.hmax C.hE he + have hopen : IsOpen (s ∩ Dᶜ) := (region_isOpen hs).inter C.hc.disc.isClosed.isOpen_compl + have hmem : m e ∈ s ∩ Dᶜ := ⟨hes (hL.m_mem he), fun h' => + region_subset C.hr₂ (C.hc.sub h') (C.dual_U he hn (hL.m_mem_dualEdge he))⟩ + obtain ⟨z, hzW, hzQ⟩ := mem_closure_iff.mp (hgQ (hL.m_mem_dualEdge he)) _ hopen hmem + have hzC : z ∉ range (ℓ (e, true)) ∪ range (ℓ (e, false)) := by + intro h' + have hzg : z ∈ dualEdge h ℓ e := by + refine ⟨h', ?_⟩ + rintro (h₁ | h₁) + · exact region_subset hs hzW.1 (h₁ ▸ hL.hub_K he true) + · exact region_subset hs hzW.1 (h₁ ▸ hL.hub_K he false) + exact region_subset hQ hzQ (Or.inl (C.dual_U he hn hzg)) + have hzT : z ∈ s \ (range (ℓ (e, true)) ∪ range (ℓ (e, false))) := ⟨hzW.1, hzC⟩ + have hzP : z ∈ P := by + rw [hcov] at hzT + rcases hzT with h₁ | h₁ + · exact C.side he hs hs' (isPreconnected_of_isOpenDisc hT₁) (hcov ▸ subset_union_left) hm₁ hP + hhal h₁ hzW.2 + · exact C.side he hs hs' (isPreconnected_of_isOpenDisc hT₂) (hcov ▸ subset_union_right) hm₂ hP + hhal h₁ hzW.2 + exact hQne (region_eq_of_mem hQ hP hzQ hzP) + +omit [ConnectedSpace S] in +/-- The image of a half lies in a face of `G ∪ J`. -/ +theorem exists_face {e : Set S} (he : e ∈ Γ.E) (b : Bool) : + ∃ p ∈ (radialUnion C.hrad₂).R, f '' hal A B e b ⊆ p := by + obtain ⟨z, hz⟩ := hL.hal_nonempty he b + have hoff : ∀ w ∈ hal A B e b, f w ∉ (radialUnion C.hrad₂).U := fun w hw => + C.image_off (hL.hal_off_dual C.U₁ he b hw) (hL.hal_off_K he b hw) + obtain ⟨p, hp, hzp⟩ := exists_region_of_notMem (hoff z hz) + refine ⟨p, hp, subset_region hp ((hL.hal_conn he b).image f f.continuous.continuousOn) ?_ + (mem_image_of_mem _ hz) hzp⟩ + refine disjoint_left.mpr ?_ + rintro _ ⟨w, hw, rfl⟩ + exact hoff w hw + +/-- See the module docstring. -/ +theorem exists_lines : ∃ (D₂ : Drawing S) (A₂ B₂ : Set S → Set S) (m₂ x₂ y₂ : Set S → S) + (φ₂ : Set S × Bool → Set S) (h₂ : Set S × Bool → S) (ℓ₂ : Set S × Bool → I → S), + IsDualLines C.hrad₂ D₂ A₂ B₂ m₂ x₂ y₂ φ₂ h₂ ℓ₂ ∧ + ∀ e ∈ Γ.E, ¬ e ⊆ closure r \ r → ∀ b, f '' hal A B e b ⊆ φ₂ (dualEdge h ℓ e, b) ∧ + range (ℓ₂ (dualEdge h ℓ e, b)) = f '' closure (hal A B e b) ∧ + h₂ (dualEdge h ℓ e, b) = f (halEnd x y e b) := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace C.hS + have hne : Nonempty S := ⟨v⟩ + have hback := fun g (hg : g ∈ (deleteVertices Γ₁ {v}).E) => C.exists_of_mem hg + choose! back hbE hbn hbg using hback + have hbd : ∀ e ∈ Γ.E, ¬ e ⊆ closure r \ r → back (dualEdge h ℓ e) = e := fun e he hn => + hL.dualEdge_inj (hbE _ (C.dual_mem he hn)) he (hbg _ (C.dual_mem he hn)).symm + have hm₂ : ∀ g ∈ (deleteVertices Γ₁ {v}).E, m (back g) ∈ g := by + intro g hg + have := hL.m_mem_dualEdge (hbE g hg) + rwa [← hbg g hg] at this + obtain ⟨D₂, A₂, B₂, x₂, y₂, hU, hV, hsplit, hall⟩ := + exists_split_at (deleteVertices Γ₁ {v}) (fun g => m (back g)) hm₂ + have hparam : ∀ i : Set S × Bool, i.1 ∈ Γ.E → ∃ p : I → S, Continuous p ∧ Function.Injective p ∧ + p 0 = m i.1 ∧ p 1 = halEnd x y i.1 i.2 ∧ range p = closure (hal A B i.1 i.2) := + fun i hi => exists_inj_param (hL.hal_line hi i.2) + choose! par hpc hpi hp0 hp1 hpr using hparam + have hface : ∀ i : Set S × Bool, i.1 ∈ Γ.E → ∃ p ∈ (radialUnion C.hrad₂).R, + f '' hal A B i.1 i.2 ⊆ p := fun i hi => C.exists_face hi i.2 + choose! face hfR hfs using hface + have hg₀ : ∀ {g}, g ∈ (deleteVertices Γ₁ {v}).E → ∀ b, + g ⊆ closure (face (back g, b)) := by + intro g hg b + have := C.dual_sub_closure (hbE g hg) (hbn g hg) (hfR (back g, b) (hbE g hg)) + (hfs (back g, b) (hbE g hg)) + rwa [← hbg g hg] at this + refine ⟨D₂, A₂, B₂, fun g => m (back g), x₂, y₂, fun i => face (back i.1, i.2), + fun i => f (halEnd x y (back i.1) i.2), fun i => f ∘ par (back i.1, i.2), ?_, ?_⟩ + · refine ⟨hU, hV, hsplit, hall, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · exact fun g hg b => ⟨hfR (back g, b) (hbE g hg), hg₀ hg b⟩ + · intro g hg heq + refine C.face_ne (hbE g hg) (hbn g hg) (hfR (back g, true) (hbE g hg)) fun b => ?_ + cases b + · have := hfs (back g, false) (hbE g hg) + exact fun z hz => (show face (back g, true) = face (back g, false) from heq).symm ▸ this hz + · exact hfs (back g, true) (hbE g hg) + · intro g hg p hp hgp + obtain ⟨p₀, -, q₀, -, -, -, -, hall₀⟩ := + exists_two_faces C.hrad₂ C.hS C.hJ.2.2 C.hE₂ hg + have hT := hall₀ _ (hfR (back g, true) (hbE g hg)) (hg₀ hg true) + have hF := hall₀ _ (hfR (back g, false) (hbE g hg)) (hg₀ hg false) + have hP := hall₀ p hp hgp + have hdis : face (back g, true) ≠ face (back g, false) := by + intro heq + refine C.face_ne (hbE g hg) (hbn g hg) (hfR (back g, true) (hbE g hg)) fun b => ?_ + cases b + · exact fun z hz => heq.symm ▸ hfs (back g, false) (hbE g hg) hz + · exact hfs (back g, true) (hbE g hg) + have key : p = face (back g, true) ∨ p = face (back g, false) := by + rcases hP with h₁ | h₁ <;> rcases hT with h₂ | h₂ <;> rcases hF with h₃ | h₃ + all_goals first + | exact Or.inl (h₁.trans h₂.symm) + | exact Or.inr (h₁.trans h₃.symm) + | exact absurd (h₂.trans h₃.symm) hdis + rcases key with h₁ | h₁ + · exact ⟨true, h₁⟩ + · exact ⟨false, h₁⟩ + · intro g hg g' hg' b b' heq + obtain ⟨e₀, -, -, hu, -⟩ := + face_edge C.hrad₂ C.hS C.hJ.2.2 C.hE₂ (hfR (back g, b) (hbE g hg)) + have h₁ := hu g hg (hg₀ hg b) + have heq' : face (back g, b) = face (back g', b') := heq + have h₂ := hu g' hg' (heq' ▸ hg₀ hg' b') + exact h₁.trans h₂.symm + · intro g hg b + obtain ⟨s, hs, hsub⟩ := exists_region_of_sub C.hrad₂ (hfR (back g, b) (hbE g hg)) + have he := hbE g hg + have hmem : f (halEnd x y (back g) b) ∈ closure s := + closure_mono hsub (image_closure_hal (hfs (back g, b) he) (hL.end_mem_closure_hal he b)) + refine ⟨s, hs, hsub, ?_, ?_⟩ + · rcases closure_region_subset hs hmem with h₁ | h₁ + · exact h₁ + · exact absurd h₁ (C.end_off (hL.hal_end he b)) + · have : f (halEnd x y (back g) b) ∈ H.V := by + rw [C.hc.H_V] + exact ⟨_, radial_V hrad (hL.hal_end he b), rfl⟩ + rw [← C.hc.J_V] at this + exact this + · intro g hg b + exact f.continuous.comp (hpc (back g, b) (hbE g hg)) + · intro g hg b t t' htt + have he := hbE g hg + have hmem : ∀ t, par (back g, b) t ∈ closure (hal A B (back g) b) := fun t => by + have := hpr (back g, b) he + rw [show closure (hal A B (back g) b) = range (par (back g, b)) from this.symm] + exact ⟨t, rfl⟩ + refine hpi (back g, b) he ?_ + rcases C.fibre htt with h₁ | ⟨h₁, h₂⟩ + · exact h₁ + · exact (hL.closure_hal_K he (hmem t) (radialStar_subset C.hvK h₁)).trans + (hL.closure_hal_K he (hmem t') (radialStar_subset C.hvK h₂)).symm + · intro g hg b + have h₀ : par (back g, b) 0 = m (back g) := hp0 (back g, b) (hbE g hg) + change f (par (back g, b) 0) = m (back g) + rw [h₀] + exact C.m_fix (hbE g hg) (hbn g hg) + · intro g hg b + have h₀ : par (back g, b) 1 = halEnd x y (back g) b := hp1 (back g, b) (hbE g hg) + change f (par (back g, b) 1) = _ + rw [h₀] + · intro g hg b t ht₀ ht₁ + have he := hbE g hg + have hinj := hpi (back g, b) he + have h₀ : par (back g, b) 0 = m (back g) := hp0 (back g, b) he + have h₁ : par (back g, b) 1 = halEnd x y (back g) b := hp1 (back g, b) he + have hmem : par (back g, b) t ∈ closure (hal A B (back g) b) := by + have := hpr (back g, b) he + rw [show closure (hal A B (back g) b) = range (par (back g, b)) from this.symm] + exact ⟨t, rfl⟩ + rcases hL.mem_closure_hal he hmem with h₂ | h₂ | h₂ + · exact hfs (back g, b) he ⟨_, h₂, rfl⟩ + · exact absurd (hinj (h₂.trans h₀.symm)) ht₀ + · exact absurd (hinj (h₂.trans h₁.symm)) ht₁ + · intro e he hn b + have hb₀ := hbd e he hn + refine ⟨?_, ?_, ?_⟩ + · have := hfs (e, b) he + simpa only [hb₀] using this + · have : range (f ∘ par (back (dualEdge h ℓ e), b)) = + f '' closure (hal A B e b) := by + rw [hb₀, range_comp, show range (par (e, b)) = _ from hpr (e, b) he] + exact this + · simp only [hb₀] + +end IsContractSetting + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/SurfaceDualContractStar.lean b/LeanPool/GraphMinor/GM12/SurfaceDualContractStar.lean new file mode 100644 index 0000000000..5a6f2561f2 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/SurfaceDualContractStar.lean @@ -0,0 +1,271 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.SurfaceDualContractBase + +/-! +# The star of `v` and the edges of `Γ` + +Facts for `exists_contracted_dual`, in the notation of `IsDualLines`, with `v` the vertex of `K` in +the +region `r` of `Γ`, and `f` a collapse of the star of `v` in `K`. The star meets `V(Γ)` in the +vertices +of `Γ` on `rBar` (`star_vertex`, `mem_star_of_closure`). An edge of `Γ` is in `rBar - r` exactly +when one of +its two hubs is `v` (`hub_eq_subset`, `exists_hub_eq`). A half `hal e b` of an edge with its end off +`rBar` misses the region `r₂` of `Γ₁ \ v` that holds `v` (`hal_off`). +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +omit [T2Space S] [ConnectedSpace S] in +/-- A line is the range of an injective map from the unit interval. -/ +theorem exists_inj_param {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) : + ∃ p : I → S, Continuous p ∧ Function.Injective p ∧ p 0 = a ∧ p 1 = b ∧ range p = L := by + obtain ⟨φ, h₀, h₁⟩ := hL + have hinj : Function.Injective fun t : I => (φ t).1 := + fun t t' h' => φ.injective (Subtype.ext h') + refine ⟨fun t => (φ t).1, by fun_prop, hinj, h₀, h₁, ?_⟩ + ext z + constructor + · rintro ⟨t, rfl⟩ + exact (φ t).2 + · intro hz + obtain ⟨t, ht⟩ := φ.surjective ⟨z, hz⟩ + exact ⟨t, congrArg Subtype.val ht⟩ + +omit [T2Space S] [ConnectedSpace S] in +theorem radialStar_subset {K : Drawing S} {v : S} (hv : v ∈ K.V) : radialStar K v ⊆ K.U := by + rintro z (hz | hz) + · exact (mem_singleton_iff.mp hz) ▸ K.V_subset_U hv + · obtain ⟨g, hg, hzg⟩ := mem_iUnion₂.mp hz + exact K.closure_subset_U hg.1 hzg + +namespace IsDualLines + +variable {Γ K D₀ Γ₁ : Drawing S} {hrad : PreRad (PaintingOrDrawing.drawing Γ) K} + {A B : Set S → Set S} {m x y : Set S → S} {φ : Set S × Bool → Set S} {h : Set S × Bool → S} + {ℓ : Set S × Bool → I → S} (hL : IsDualLines hrad D₀ A B m x y φ h ℓ) + (hS : IsClosedSurface S) (hmax : RadMax (PaintingOrDrawing.drawing Γ) K) (hE : Γ.E.Nonempty) + {r : Set S} (hr : r ∈ Γ.R) {v : S} (hvr : v ∈ r) (hvK : v ∈ K.V) + +include hL hr hvr hvK + +omit [T2Space S] [ConnectedSpace S] hvK in +theorem hub_eq_subset {e : Set S} (he : e ∈ Γ.E) {b : Bool} (hb : h (e, b) = v) : + e ⊆ closure r \ r := by + obtain ⟨r', hr', hfr, hhr, -⟩ := hL.hub e he b + obtain rfl : r' = r := region_eq_of_mem hr' hr hhr (hb ▸ hvr) + exact fun z hz => ⟨closure_mono hfr ((hL.face e he b).2 hz), + fun h' => region_subset hr' h' (Γ.closure_subset_U he (subset_closure hz))⟩ + +include hS hmax hE + +omit [ConnectedSpace S] hmax hE in +theorem exists_hub_eq {e : Set S} (he : e ∈ Γ.E) (hsub : e ⊆ closure r \ r) : ∃ b, h (e, b) = v + := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨z, hz⟩ := he.1 + have heH : e ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inl he + obtain ⟨W, A₁, A₂, hW, hzW, -, hcov, hc₁, hc₂, hd₁, hd₂, hcl₁, hcl₂⟩ := + exists_edge_sides hS (radialUnion hrad) heH hz + obtain ⟨w, hwW, hwr⟩ := mem_closure_iff.mp (hsub hz).1 W hW hzW + obtain ⟨y', ⟨hyW, hyr⟩, hyU⟩ := exists_notMem_U (Γ := radialUnion hrad) hS + (hW.inter (region_isOpen hr)) ⟨w, hwW, hwr⟩ + have key : ∀ {A' : Set S}, IsPreconnected A' → Disjoint A' (radialUnion hrad).U → + e ∩ W ⊆ closure A' → y' ∈ A' → ∃ b, h (e, b) = v := by + intro A' hA hd hcl hy + obtain ⟨p, hp, hyp⟩ := exists_region_of_notMem hyU + have hAp : A' ⊆ p := subset_region hp hA hd hy hyp + have hzp : z ∈ closure p := closure_mono hAp (hcl ⟨hz, hzW⟩) + have hep : e ⊆ closure p := edge_subset_closure_of_incident hS heH hp ⟨z, hz, hzp⟩ + obtain ⟨b, rfl⟩ := hL.face_all e he p hp hep + obtain ⟨r', hr', hfr, hhr, hhV⟩ := hL.hub e he b + obtain rfl : r' = r := region_eq_of_mem hr' hr (hfr hyp) hyr + exact ⟨b, hub_unique hrad hr' hvr hvK hhr hhV⟩ + rcases hcov ⟨hyW, hyU⟩ with h₁ | h₁ + · exact key hc₁ hd₁ hcl₁ h₁ + · exact key hc₂ hd₂ hcl₂ h₁ + +include hrad in +omit [T2Space S] [ConnectedSpace S] hL hmax hE in +theorem star_vertex {z : S} (hz : z ∈ radialStar K v) (hzΓ : z ∈ Γ.V) : z ∈ closure r := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + rcases hz with hz | hz + · exact absurd (Γ.V_subset_U ((mem_singleton_iff.mp hz) ▸ hzΓ)) (region_subset hr hvr) + obtain ⟨g, ⟨hg, hvg⟩, hzg⟩ := mem_iUnion₂.mp hz + obtain ⟨u, hu, r', hr', w, hw, hwV, hcap, hgr⟩ := spoke_ends hrad hS hg + have hv' : v ∈ closure g ∩ K.V := ⟨hvg, hvK⟩ + rw [hcap] at hv' + have hvw : v = w := by + rcases hv' with h' | h' + · exact absurd (Γ.V_subset_U (h' ▸ hu)) (region_subset hr hvr) + · exact h' + obtain rfl : r' = r := region_eq_of_mem hr' hr hw (hvw ▸ hvr) + exact closure_mono hgr hzg + +include hrad in +omit hL in +theorem mem_star_of_closure {z : S} (hzΓ : z ∈ Γ.V) (hzr : z ∈ closure r) : z ∈ radialStar K v := by + obtain ⟨g, hg, hcap⟩ := exists_spoke_at hrad hmax hS hE hr hvr hvK hzΓ hzr + have hz' : z ∈ closure g ∩ K.V := by rw [hcap]; simp + have hv' : v ∈ closure g ∩ K.V := by rw [hcap]; simp + exact Or.inr (mem_biUnion (show g ∈ {e ∈ K.E | v ∈ closure e} from ⟨hg, hv'.1⟩) hz'.1) + +end IsDualLines + +/-- The half of `e` for `b`, and its end in `V(Γ)`. -/ +def hal (A B : Set S → Set S) (e : Set S) (b : Bool) : Set S := cond b (A e) (B e) + +/-- See `hal`. -/ +def halEnd (x y : Set S → S) (e : Set S) (b : Bool) : S := cond b (x e) (y e) + +namespace IsDualLines + +variable {Γ K D₀ Γ₁ : Drawing S} {hrad : PreRad (PaintingOrDrawing.drawing Γ) K} + {A B : Set S → Set S} {m x y : Set S → S} {φ : Set S × Bool → Set S} {h : Set S × Bool → S} + {ℓ : Set S × Bool → I → S} (hL : IsDualLines hrad D₀ A B m x y φ h ℓ) + (h₁U : Γ₁.U = (K.V \ Γ.V) ∪ ⋃ e ∈ Γ.E, (range (ℓ (e, true)) ∪ range (ℓ (e, false)))) + +include hL + +omit [T2Space S] [ConnectedSpace S] in +theorem hal_mem {e : Set S} (he : e ∈ Γ.E) (b : Bool) : hal A B e b ∈ D₀.E := by + obtain ⟨hA, hB, -⟩ := hL.split e he + cases b + · exact hB + · exact hA + +omit [T2Space S] [ConnectedSpace S] in +theorem hal_end {e : Set S} (he : e ∈ Γ.E) (b : Bool) : halEnd x y e b ∈ Γ.V := by + obtain ⟨-, -, -, -, -, -, -, hx, hy, -⟩ := hL.split e he + cases b + · exact hy + · exact hx + +omit [T2Space S] [ConnectedSpace S] in +theorem hal_subset {e : Set S} (he : e ∈ Γ.E) (b : Bool) : hal A B e b ⊆ e := by + obtain ⟨-, -, -, -, -, -, hs, -⟩ := hL.split e he + intro z hz + rw [hs] + cases b + · exact Or.inr hz + · exact Or.inl (Or.inl hz) + +omit [T2Space S] [ConnectedSpace S] in +theorem m_notMem_hal {e : Set S} (he : e ∈ Γ.E) (b : Bool) : m e ∉ hal A B e b := by + obtain ⟨-, -, -, hA, hB, -⟩ := hL.split e he + cases b + · exact hB + · exact hA + +omit [T2Space S] [ConnectedSpace S] in +theorem hal_cap {e : Set S} (he : e ∈ Γ.E) (b : Bool) : + closure (hal A B e b) ∩ D₀.V = {m e, halEnd x y e b} := by + obtain ⟨-, -, -, -, -, -, -, -, -, -, hcA, hcB⟩ := hL.split e he + cases b + · exact hcB + · rw [pair_comm] + exact hcA + +omit [T2Space S] [ConnectedSpace S] in +theorem hal_cover {e : Set S} (he : e ∈ Γ.E) {z : S} (hz : z ∈ e) (hzm : z ≠ m e) : + ∃ b, z ∈ hal A B e b := by + obtain ⟨-, -, -, -, -, -, hs, -⟩ := hL.split e he + rw [hs] at hz + rcases hz with (hz | hz) | hz + · exact ⟨true, hz⟩ + · exact absurd hz hzm + · exact ⟨false, hz⟩ + +omit [T2Space S] [ConnectedSpace S] in +theorem m_ne_end {e : Set S} (he : e ∈ Γ.E) (b : Bool) : m e ≠ halEnd x y e b := fun h' => + edge_notMem_V he (hL.m_mem he) (h' ▸ hL.hal_end he b) + +omit [T2Space S] [ConnectedSpace S] in +theorem hal_line {e : Set S} (he : e ∈ Γ.E) (b : Bool) : + IsLineWithEnds (closure (hal A B e b)) (m e) (halEnd x y e b) := + isLine_closure (hL.hal_mem he b) (hL.m_ne_end he b) (hL.hal_cap he b) + +omit [T2Space S] [ConnectedSpace S] in +theorem m_mem_closure_hal {e : Set S} (he : e ∈ Γ.E) (b : Bool) : m e ∈ closure (hal A B e b) := + line_left_mem (hL.hal_line he b) + +omit [T2Space S] [ConnectedSpace S] in +theorem end_mem_closure_hal {e : Set S} (he : e ∈ Γ.E) (b : Bool) : + halEnd x y e b ∈ closure (hal A B e b) := + line_right_mem (hL.hal_line he b) + +omit [T2Space S] [ConnectedSpace S] in +/-- A point of the closure of a half is in the half or is one of its two ends. -/ +theorem mem_closure_hal {e : Set S} (he : e ∈ Γ.E) {b : Bool} {z : S} + (hz : z ∈ closure (hal A B e b)) : z ∈ hal A B e b ∨ z = m e ∨ z = halEnd x y e b := by + by_cases hzV : z ∈ D₀.V + · have : z ∈ closure (hal A B e b) ∩ D₀.V := ⟨hz, hzV⟩ + rw [hL.hal_cap he b] at this + exact Or.inr this + · exact Or.inl (D₀.closure_diff_V (hL.hal_mem he b) ▸ ⟨hz, hzV⟩) + +omit [T2Space S] [ConnectedSpace S] in +theorem hal_nonempty {e : Set S} (he : e ∈ Γ.E) (b : Bool) : (hal A B e b).Nonempty := + (hL.hal_mem he b).1 + +omit [T2Space S] [ConnectedSpace S] in +theorem hal_conn {e : Set S} (he : e ∈ Γ.E) (b : Bool) : IsPreconnected (hal A B e b) := + (hL.hal_mem he b).2.2.1.isConnected.isPreconnected + +omit [T2Space S] [ConnectedSpace S] in +theorem hal_off_K {e : Set S} (he : e ∈ Γ.E) (b : Bool) {z : S} (hz : z ∈ hal A B e b) : z ∉ K.U := + disjoint_left.mp (edge_disjoint hrad he) (hL.hal_subset he b hz) + +omit [T2Space S] [ConnectedSpace S] in +/-- A point of the closure of a half on `K` is its end in `V(Γ)`. -/ +theorem closure_hal_K {e : Set S} (he : e ∈ Γ.E) {b : Bool} {z : S} + (hz : z ∈ closure (hal A B e b)) (hzK : z ∈ K.U) : z = halEnd x y e b := by + rcases hL.mem_closure_hal he hz with h' | h' | h' + · exact absurd hzK (hL.hal_off_K he b h') + · exact absurd (h' ▸ hzK) (hL.m_K he) + · exact h' + +include h₁U in +omit [T2Space S] [ConnectedSpace S] in +theorem hal_off_dual {e : Set S} (he : e ∈ Γ.E) (b : Bool) {z : S} (hz : z ∈ hal A B e b) : + z ∉ Γ₁.U := fun h' => + hL.m_notMem_hal he b (hL.inter_dual h₁U he (hL.hal_subset he b hz) h' ▸ hz) + +include h₁U in +omit [T2Space S] [ConnectedSpace S] in +/-- A half with its end lies in a region of `Γ₁`. -/ +theorem hal_in_region {e : Set S} (he : e ∈ Γ.E) (b : Bool) {t : Set S} (ht : t ∈ Γ₁.R) + (hend : halEnd x y e b ∈ t) : hal A B e b ⊆ t := by + have hc : IsPreconnected (hal A B e b ∪ {halEnd x y e b}) := + (hL.hal_conn he b).subset_closure subset_union_left + (union_subset subset_closure (singleton_subset_iff.mpr (hL.end_mem_closure_hal he b))) + have hd : Disjoint (hal A B e b ∪ {halEnd x y e b}) Γ₁.U := by + refine disjoint_left.mpr ?_ + rintro z (hz | hz) hzU + · exact hL.hal_off_dual h₁U he b hz hzU + · exact region_subset ht ((mem_singleton_iff.mp hz) ▸ hend) hzU + exact subset_union_left.trans (subset_region ht hc hd (Or.inr rfl) hend) + +end IsDualLines + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/SurfaceDualCount.lean b/LeanPool/GraphMinor/GM12/SurfaceDualCount.lean new file mode 100644 index 0000000000..2b8fb4ece5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/SurfaceDualCount.lean @@ -0,0 +1,192 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialExists +public import LeanPool.GraphMinor.GM11.RadialFacts +public import LeanPool.GraphMinor.GM12.Section72MaximalCriterion + +/-! +# Counting the edges of a radial drawing + +If `Γ'` satisfies (i)-(iv) for `Γ`, and each vertex of `Γ` has an edge, then `Γ'` has at most +`2 |E(Γ)|` edges (`ncard_spokes_le_two_mul`). If `Γ'` is radial and `Γ` has an edge, then it has at +least this many (`two_mul_le_ncard_spokes`). In both cases we step from one half-edge to the next +around a vertex, as in `ncard_spokes_le`. + +We use this to prove the maximality clause of a radial drawing: a drawing with `2 |E(Γ)|` edges that +satisfies (i)-(iv) has no proper extension (`radMax_of_card`). +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {Γ Γ' : Drawing S} + +/-- See the module docstring. An edge `s` of `Γ'` has just one half-edge at a vertex of `Γ`, and +that +vertex also has an edge of `Γ`. So the rotation there exists, and the half-edge after `s` is a +half-edge of `Γ` by `corner_has_edge`. This map is injective, since `s` determines its half-edge and +the rotation is injective. -/ +theorem ncard_spokes_le_two_mul (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') + (hS : IsClosedSurface S) (hall : ∀ x ∈ Γ.V, ∃ e ∈ Γ.E, x ∈ closure e) : + Γ'.E.ncard ≤ 2 * Γ.E.ncard := by + classical + by_cases hemp : Γ'.E = ∅ + · simp [hemp] + obtain ⟨s₀, hs₀⟩ := nonempty_iff_ne_empty.mpr hemp + obtain ⟨y₀, -⟩ := hs₀.1 + have hne : Nonempty S := ⟨y₀⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar (radialUnion hrad) + let H := radialUnion hrad + have hHV : ∀ y : Γ.V, y.1 ∈ H.V := fun y => by + rw [show H.V = Γ'.V from radialUnion_V hrad] + exact radial_V hrad y.2 + have hspoke : ∀ s : Γ'.E, ∃ (y : Γ.V) (a : halfEdges H γ y.1), a.1.1 = s.1 := fun s => by + obtain ⟨x, φ, h, -⟩ := spoke_half_unique hrad hS s.2 hγ + exact ⟨x, φ, h⟩ + choose y a ha using hspoke + have htwo : ∀ s : Γ'.E, 2 ≤ Nat.card (halfEdges H γ (y s).1) := fun s => by + obtain ⟨e, he, hxe⟩ := hall _ (y s).2 + have heH : e ∈ H.E := by + rw [show H.E = Γ.E ∪ Γ'.E from radialUnion_E hrad] + exact Or.inl he + obtain ⟨b, hb⟩ := exists_end_eq hγ heH (hHV _) hxe + refine (one_lt_ncard (finite_halfEdges H γ _)).mpr ⟨(e, b), ⟨heH, hb⟩, a s, (a s).2, + fun h => ?_⟩ + have h' : e = s.1 := (congrArg Prod.fst h).trans (ha s) + exact edge_not_both hrad he (h' ▸ s.2) + have hsec : ∀ y : Γ.V, ∃ next : halfEdges H γ y.1 → halfEdges H γ y.1, + 2 ≤ Nat.card (halfEdges H γ y.1) → ∃ ρ P W Q τ, IsSectors H γ y.1 next ρ P W Q τ := fun y + => by + by_cases h : 2 ≤ Nat.card (halfEdges H γ y.1) + · obtain ⟨next, h'⟩ := exists_sectors hS _ hγ (hHV y) h + exact ⟨next, fun _ => h'⟩ + · exact ⟨id, fun h' => absurd h' h⟩ + choose next hnext using hsec + let Φ : Γ'.E → Set S × Bool := fun s => (next (y s) (a s)).1 + have hmaps : ∀ s, Φ s ∈ Γ.E ×ˢ (univ : Set Bool) := by + intro s + obtain ⟨ρ, P, W, Q, τ, hc⟩ := hnext _ (htwo s) + refine ⟨(edge_cases hrad (next (y s) (a s))).resolve_right fun h' => ?_, mem_univ _⟩ + exact corner_has_edge hrad hS hγ (y s).2 hc (a s) (by rw [ha]; exact s.2) h' + have hinj : Function.Injective Φ := by + intro s t hst + have hvx : y s = y t := by + have h₁ := (next (y s) (a s)).2.2 + have h₂ := (next (y t) (a t)).2.2 + have hst' : (next (y s) (a s)).1 = (next (y t) (a t)).1 := hst + rw [hst'] at h₁ + exact Subtype.ext (h₁.symm.trans h₂) + obtain ⟨ρ, P, W, Q, τ, hc⟩ := hnext _ (htwo s) + have hat : (a s).1 = (a t).1 := by + have hst' : (next (y s) (a s)).1 = (next (y t) (a t)).1 := hst + generalize a t = b at hst' + generalize a s = a' at hst' hc + generalize y t = z at hvx b hst' + subst hvx + exact congrArg Subtype.val (hc.corners.inj (Subtype.ext hst')) + exact Subtype.ext (by rw [← ha s, ← ha t, hat]) + have hEf : (Γ.E ×ˢ (univ : Set Bool)).Finite := Γ.finite_edges.prod finite_univ + have hle : Γ'.E.ncard ≤ (Γ.E ×ˢ (univ : Set Bool)).ncard := by + rw [← Nat.card_coe_set_eq, ← Nat.card_coe_set_eq] + have := hEf.to_subtype + exact Nat.card_le_card_of_injective (fun s => (⟨Φ s, hmaps s⟩ : (Γ.E ×ˢ + (univ : Set Bool) : Set _))) + fun s t h => hinj (congrArg Subtype.val h) + have h₃ : (Γ.E ×ˢ (univ : Set Bool)).ncard = Γ.E.ncard * 2 := by + rw [ncard_prod] + simp + omega + +variable [ConnectedSpace S] + +/-- See the module docstring. Send a half-edge of `Γ` to the half-edge after it, which belongs to an +edge of `Γ'` by `corner_alternates`. This map is injective on half-edges. -/ +theorem two_mul_le_ncard_spokes (hrad : PreRad (PaintingOrDrawing.drawing Γ) Γ') + (hS : IsClosedSurface S) (hmax : RadMax (PaintingOrDrawing.drawing Γ) Γ') (hE : Γ.E.Nonempty) : + 2 * Γ.E.ncard ≤ Γ'.E.ncard := by + classical + obtain ⟨γ, hγ⟩ := exists_edgePar (radialUnion hrad) + let H := radialUnion hrad + have hHV : ∀ {y : S}, y ∈ Γ.V → y ∈ H.V := fun h => by + rw [show H.V = Γ'.V from radialUnion_V hrad] + exact radial_V hrad h + have hsec : ∀ y : Γ.V, ∃ next : halfEdges H γ y.1 → halfEdges H γ y.1, + ∃ ρ P W Q τ, IsSectors H γ y.1 next ρ P W Q τ := fun y => + exists_sectors hS _ hγ (hHV y.2) (two_half_edges hrad hS hmax hE hγ y.2) + choose next hnext using hsec + let Half := Γ.E ×ˢ (univ : Set Bool) + have hend : ∀ q : Half, ∃ y : Γ.V, ∃ k : halfEdges H γ y.1, k.1 = q.1 := by + rintro ⟨⟨e, b⟩, he, -⟩ + have heH : e ∈ H.E := by + rw [show H.E = Γ.E ∪ Γ'.E from radialUnion_E hrad] + exact Or.inl he + have hmem : γ e (endOf b) ∈ Γ.V := by + have h₁ := end_mem_closure hγ heH b + have h₂ : γ e (endOf b) ∈ Γ'.V := by + have : γ e (endOf b) ∈ H.V := by + cases b + · exact hγ.zero e heH + · exact hγ.one e heH + rwa [show H.V = Γ'.V from radialUnion_V hrad] at this + exact radial_inter hrad ▸ ⟨Γ.closure_subset_U he h₁, Γ'.V_subset_U h₂⟩ + exact ⟨⟨_, hmem⟩, ⟨(e, b), heH, rfl⟩, rfl⟩ + choose y k hk using hend + have hmaps : ∀ q : Half, (next (y q) (k q)).1.1 ∈ Γ'.E := by + intro q + obtain ⟨ρ, P, W, Q, τ, hc⟩ := hnext (y q) + rcases corner_alternates hrad hS hmax hE hγ (y q).2 hc (k q) with h | h + · exact absurd (hk q ▸ h.1) (fun h' => edge_not_both hrad q.2.1 h') + · exact h.2 + have hinj : Function.Injective fun q : Half => (next (y q) (k q)).1.1 := by + intro q q' hqq + obtain ⟨x, φ, -, huniq⟩ := spoke_half_unique hrad hS (hmaps q) hγ + obtain ⟨hy, hφ⟩ := huniq (y q) _ rfl + obtain ⟨hy', hφ'⟩ := huniq (y q') _ (Eq.symm hqq) + have hyy : y q = y q' := hy.trans hy'.symm + have hval : (next (y q) (k q)).1 = (next (y q') (k q')).1 := hφ.trans hφ'.symm + obtain ⟨ρ, P, W, Q, τ, hc⟩ := hnext (y q) + have hkk : (k q).1 = (k q').1 := by + generalize k q' = b at hval + generalize k q = a at hval hc + generalize y q' = z at hyy b hval + subst hyy + exact congrArg Subtype.val (hc.corners.inj (Subtype.ext hval)) + exact Subtype.ext (by rw [← hk q, ← hk q', hkk]) + have hEf : (Γ.E ×ˢ (univ : Set Bool)).Finite := Γ.finite_edges.prod finite_univ + have hle : (Γ.E ×ˢ (univ : Set Bool)).ncard ≤ Γ'.E.ncard := by + rw [← Nat.card_coe_set_eq, ← Nat.card_coe_set_eq] + have : Finite Γ'.E := Γ'.finite_edges.to_subtype + exact Nat.card_le_card_of_injective (fun q : Half => (⟨_, hmaps q⟩ : Γ'.E)) + fun s t h => hinj (congrArg Subtype.val h) + have h₃ : (Γ.E ×ˢ (univ : Set Bool)).ncard = Γ.E.ncard * 2 := by + rw [ncard_prod] + simp + omega + +omit [ConnectedSpace S] in +/-- See the module docstring. An extension of `Γ'` has the same vertices. Its edges include those of +`Γ'`, and it has no more of them, so the edges are the same. -/ +theorem radMax_of_card (hS : IsClosedSurface S) (hT : (PaintingOrDrawing.drawing Γ).IsTwoCell) + (hpre : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing Γ') + (hall : ∀ x ∈ Γ.V, ∃ e ∈ Γ.E, x ∈ closure e) (hcard : 2 * Γ.E.ncard ≤ Γ'.E.ncard) : + RadMax (PaintingOrDrawing.drawing Γ) Γ' := by + intro J hJ hsub + have hle := ncard_spokes_le_two_mul (⟨hT, hJ⟩ : PreRad (PaintingOrDrawing.drawing Γ) J) hS hall + have hE : J.E = Γ'.E := (Set.eq_of_subset_of_ncard_le hsub.2 (by omega) J.finite_edges).symm + exact ⟨(preRadial_vertices_eq_of_extension hpre hJ hsub).subset, hE.subset⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/SurfaceDualCurves.lean b/LeanPool/GraphMinor/GM12/SurfaceDualCurves.lean new file mode 100644 index 0000000000..b44547f253 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/SurfaceDualCurves.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.ArcDrawings +public import LeanPool.GraphMinor.GM11.RadialExists +public import LeanPool.GraphMinor.GM12.Section4FiniteLineDrawing +import LeanPool.GraphMinor.Surface.Circle + +/-! +# A drawing from finitely many lines and `O`-arcs + +`exists_drawing_of_curves` is `exists_drawing_of_finite_lines` with loops allowed. The dual of a +drawing may have a loop, so we need this form. +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Surface GM11 unitInterval + +/-- An `O`-arc less one of its points is path connected. -/ +theorem isPathConnected_oArc_sdiff {S : Type*} [TopologicalSpace S] {F : Set S} + (hF : IsOArc F) {a : S} (ha : a ∈ F) : IsPathConnected (F \ {a}) := + hF.isPathConnected_sdiff_singleton ha + +/-- The drawing on a single `O`-arc, with one vertex. -/ +theorem exists_loop_drawing_E {S : Type*} [TopologicalSpace S] [T2Space S] {F : Set S} + (hF : IsOArc F) {a : S} (ha : a ∈ F) : + ∃ D : Drawing S, D.U = F ∧ D.V = {a} ∧ D.E = {F \ {a}} := by + obtain ⟨D, hU, hV⟩ := exists_loop_drawing hF ha + refine ⟨D, hU, hV, ?_⟩ + have hc := isPathConnected_oArc_sdiff hF ha + change arcComponentsIn (D.U \ D.V) = _ + rw [hU, hV] + apply subset_antisymm + · rintro C ⟨-, hs, -, hmax⟩ + exact (hmax _ Subset.rfl hc hs).symm + · rintro _ rfl + exact ⟨hc.nonempty, Subset.rfl, hc, fun E hE _ hsub => subset_antisymm hE hsub⟩ + +/-- See the module docstring. Each curve is a line with two ends or an `O`-arc with one vertex, +which +`hone` says in a uniform way. -/ +theorem exists_drawing_of_curves {S ι : Type*} [TopologicalSpace S] [T2Space S] {V : Set S} + (hV : V.Finite) {E : Set ι} (hE : E.Finite) (L : ι → Set S) (u v : ι → S) + (hone : ∀ i ∈ E, ∃ D : Drawing S, D.U = L i ∧ D.V = {u i, v i} ∧ D.E = {L i \ {u i, v i}}) + (hends : ∀ i ∈ E, L i ∩ V = {u i, v i}) + (hmeet : ∀ i ∈ E, ∀ j ∈ E, i ≠ j → L i ∩ L j ⊆ V) : + ∃ H : Drawing S, H.U = V ∪ ⋃ i ∈ E, L i ∧ H.V = V ∧ + H.E = (fun i => L i \ {u i, v i}) '' E := by + revert hone hends hmeet + induction E, hE using Set.Finite.induction_on with + | empty => + intro _ _ _ + refine ⟨pointsDrawing hV, ?_, rfl, ?_⟩ + · change V = V ∪ ⋃ i ∈ (∅ : Set ι), L i + simp + · rw [pointsDrawing_E, image_empty] + | @insert i E hi hE ih => + intro hone hends hmeet + obtain ⟨H, hHU, hHV, hHE⟩ := ih (fun j hj => hone j (Or.inr hj)) + (fun j hj => hends j (Or.inr hj)) + (fun j hj k hk hjk => hmeet j (Or.inr hj) k (Or.inr hk) hjk) + obtain ⟨K, hKU, hKV, hKE⟩ := hone i (Or.inl rfl) + have hKiV : K.V ⊆ V := by + rw [hKV, ← hends i (Or.inl rfl)] + exact inter_subset_right + have hglue : H.U ∩ K.U ⊆ H.V ∩ K.V := by + rintro x ⟨hxH, hxK⟩ + have hxL : x ∈ L i := hKU ▸ hxK + have hxV : x ∈ V := by + rw [hHU] at hxH + rcases hxH with hxV | hxH + · exact hxV + · obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.mp hxH + exact hmeet j (Or.inr hj) i (Or.inl rfl) + (fun heq => hi (heq ▸ hj)) ⟨hxj, hxL⟩ + refine ⟨hHV.symm ▸ hxV, ?_⟩ + rw [hKV, ← hends i (Or.inl rfl)] + exact ⟨hxL, hxV⟩ + refine ⟨H.glue K hglue, ?_, ?_, ?_⟩ + · change H.U ∪ K.U = _ + rw [hHU, hKU, biUnion_insert] + ac_rfl + · change H.V ∪ K.V = V + rw [hHV] + exact union_eq_left.mpr hKiV + · rw [Drawing.glue_E, hHE, hKE, image_insert_eq, union_singleton] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/SurfaceDualCut.lean b/LeanPool/GraphMinor/GM12/SurfaceDualCut.lean new file mode 100644 index 0000000000..f1f830dd9d --- /dev/null +++ b/LeanPool/GraphMinor/GM12/SurfaceDualCut.lean @@ -0,0 +1,223 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.RadialTwoCell +public import LeanPool.GraphMinor.GM11.GlueDiscs + +/-! +# A cross-cut of an open disc + +Let `p` be an open disc in a closed surface, and let `a` be a line or an `O`-arc with its ends off +`p` +and all of its other points in `p`. Collapse the complement of `p` to a point. This gives a sphere, +and `a` +becomes an `O`-arc. So the Jordan curve theorem cuts `p` along `a` into exactly two parts, and the +whole line is on the frontier of each. Each part is an open disc, by `isOpenDisc_of_bound` +(`exists_crosscut_sides`). +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval OnePoint + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- Two components of a set are equal or disjoint. -/ +theorem disjoint_of_components {X : Type*} [TopologicalSpace X] {T A B : Set X} + (hA : A ∈ componentsIn T) (hB : B ∈ componentsIn T) (hne : A ≠ B) : Disjoint A B := by + obtain ⟨a, -, rfl⟩ := hA + obtain ⟨b, -, rfl⟩ := hB + refine disjoint_left.mpr fun x h₁ h₂ => hne ?_ + rw [connectedComponentIn_eq h₁, connectedComponentIn_eq h₂] + +/-- A subset of `X` with frontier `F` that misses `F` is open. -/ +theorem isOpen_of_frontier {X : Type*} [TopologicalSpace X] {A F : Set X} (h : frontier A = F) + (hd : Disjoint A F) : IsOpen A := by + rw [← interior_eq_iff_isOpen] + refine interior_subset.antisymm fun x hx => ?_ + by_contra hn + exact disjoint_left.mp hd hx (h ▸ ⟨subset_closure hx, hn⟩) + +variable [ConnectedSpace S] + +/-- See the module docstring. -/ +theorem exists_crosscut_sides (hS : IsClosedSurface S) {p : Set S} (hp : IsOpenDisc p) {a : I → S} + (ha : Continuous a) (hi : InjOn a (Ioo 0 1)) (h0 : a 0 ∉ p) (h1 : a 1 ∉ p) + (hin : ∀ t, t ≠ 0 → t ≠ 1 → a t ∈ p) : + ∃ s₁ s₂ : Set S, IsOpenDisc s₁ ∧ IsOpenDisc s₂ ∧ Disjoint s₁ s₂ ∧ p \ range a = s₁ ∪ s₂ ∧ + range a ⊆ closure s₁ ∧ range a ⊆ closure s₂ := by + classical + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hsph : IsSphere (OnePoint p) := isSphere_onePoint hp + have hT : T2Space (OnePoint p) := by + obtain ⟨e⟩ := id hsph + exact e.symm.t2Space + have hpo : IsOpen p := hp.1 + have hmc : Continuous (collapse p ∘ a) := (continuous_collapse hpo).comp ha + have hm0 : (collapse p ∘ a) 0 = ∞ := collapse_of_notMem h0 + have hm1 : (collapse p ∘ a) 1 = ∞ := collapse_of_notMem h1 + have hmin : ∀ t ∈ Ioo (0 : I) 1, a t ∈ p := fun t ht => hin t ht.1.ne' ht.2.ne + have hF : IsOArc (range (collapse p ∘ a)) := by + refine isOArc_of_loop hmc (hm0.trans hm1.symm) ?_ ?_ + · intro s hs t ht h + simp only [Function.comp, collapse_of_mem (hmin s hs), collapse_of_mem (hmin t ht)] at h + exact hi hs ht (congrArg Subtype.val (OnePoint.coe_injective h)) + · intro t ht + rw [hm0] + simp only [Function.comp, collapse_of_mem (hmin t ht)] + exact OnePoint.coe_ne_infty _ + obtain ⟨A, B, hne, hcomp, hfA, hfB⟩ := jordan_sphere hsph hF + set F := range (collapse p ∘ a) with hFdef + have hinfF : (∞ : OnePoint p) ∈ F := ⟨0, hm0⟩ + have hmemA : A ∈ componentsIn (univ \ F) := hcomp ▸ Or.inl rfl + have hmemB : B ∈ componentsIn (univ \ F) := hcomp ▸ Or.inr rfl + have hsub : ∀ {C : Set (OnePoint p)}, C ∈ componentsIn (univ \ F) → Disjoint C F := by + rintro _ ⟨x, hx, rfl⟩ + exact disjoint_left.mpr fun y hy hyF => (connectedComponentIn_subset _ _ hy).2 hyF + have hpre : ∀ {C : Set (OnePoint p)}, C ∈ componentsIn (univ \ F) → IsPreconnected C := by + rintro _ ⟨x, -, rfl⟩ + exact isPreconnected_connectedComponentIn + have hnon : ∀ {C : Set (OnePoint p)}, C ∈ componentsIn (univ \ F) → C.Nonempty := by + rintro _ ⟨x, hx, rfl⟩ + exact ⟨x, mem_connectedComponentIn hx⟩ + have hoA : IsOpen A := isOpen_of_frontier hfA (hsub hmemA) + have hoB : IsOpen B := isOpen_of_frontier hfB (hsub hmemB) + have hdAB : Disjoint A B := disjoint_of_components hmemA hmemB hne + -- The part of `p` for a side of the curve. + let side : Set (OnePoint p) → Set S := fun C => collapse p ⁻¹' C + obtain ⟨z⟩ : Nonempty S := inferInstance + have hsub_p : ∀ {C : Set (OnePoint p)}, C ∈ componentsIn (univ \ F) → side C ⊆ p := by + intro C hC x hx + by_contra hn + have : (∞ : OnePoint p) ∈ C := by + have h : collapse p x ∈ C := hx + rwa [collapse_of_notMem hn] at h + exact disjoint_left.mp (hsub hC) this hinfF + have hunc : ∀ {C : Set (OnePoint p)}, C ∈ componentsIn (univ \ F) → + ContinuousOn (uncollapse z) C := by + intro C hC y hy + induction y using OnePoint.rec with + | infty => exact absurd hinfF (disjoint_left.mp (hsub hC) hy) + | coe y => exact (continuousAt_uncollapse z y).continuousWithinAt + have himg : ∀ {C : Set (OnePoint p)}, C ∈ componentsIn (univ \ F) → + side C = uncollapse z '' C := by + intro C hC + ext x + constructor + · intro hx + have hxp := hsub_p hC hx + refine ⟨collapse p x, hx, ?_⟩ + rw [collapse_of_mem hxp] + rfl + · rintro ⟨y, hy, rfl⟩ + induction y using OnePoint.rec with + | infty => exact absurd hinfF (disjoint_left.mp (hsub hC) hy) + | coe y => + change collapse p y.1 ∈ C + rw [collapse_of_mem y.2] + exact hy + have hsconn : ∀ {C : Set (OnePoint p)}, C ∈ componentsIn (univ \ F) → IsPreconnected (side C) + := by + intro C hC + rw [himg hC] + exact (hpre hC).image _ (hunc hC) + have hrange_off : ∀ {C : Set (OnePoint p)}, C ∈ componentsIn (univ \ F) → + Disjoint (side C) (range a) := by + intro C hC + refine disjoint_left.mpr ?_ + rintro _ hx ⟨t, rfl⟩ + exact disjoint_left.mp (hsub hC) hx ⟨t, rfl⟩ + have hopen : ∀ {C : Set (OnePoint p)}, IsOpen C → IsOpen (side C) := fun h => + h.preimage (continuous_collapse hpo) + have hnonempty : ∀ {C : Set (OnePoint p)}, C ∈ componentsIn (univ \ F) → (side C).Nonempty := by + intro C hC + rw [himg hC] + exact (hnon hC).image _ + have hcover : p \ range a ⊆ side A ∪ side B := by + rintro x ⟨hxp, hxa⟩ + have hxF : collapse p x ∉ F := by + rintro ⟨t, ht⟩ + by_cases ht0 : t = 0 + · rw [ht0, hm0, collapse_of_mem hxp] at ht + exact OnePoint.coe_ne_infty _ ht.symm + by_cases ht1 : t = 1 + · rw [ht1, hm1, collapse_of_mem hxp] at ht + exact OnePoint.coe_ne_infty _ ht.symm + have hat := hin t ht0 ht1 + simp only [Function.comp, collapse_of_mem hat, collapse_of_mem hxp] at ht + exact hxa ⟨t, congrArg Subtype.val (OnePoint.coe_injective ht)⟩ + have h : connectedComponentIn (univ \ F) (collapse p x) ∈ componentsIn (univ \ F) := + mem_image_of_mem _ ⟨mem_univ _, hxF⟩ + rw [hcomp] at h + have hm := mem_connectedComponentIn (F := univ \ F) ⟨mem_univ _, hxF⟩ + rcases h with h | h + · exact Or.inl (h ▸ hm) + · exact Or.inr (h ▸ hm) + have hdisc : ∀ {C D : Set (OnePoint p)}, C ∈ componentsIn (univ \ F) → + D ∈ componentsIn (univ \ F) → Disjoint C D → IsOpen C → IsOpen D → + p \ range a ⊆ side C ∪ side D → IsOpenDisc (side C) := by + intro C D hC hD hCD hoC hoD hcov + refine isOpenDisc_of_bound hS (hopen hoC) ⟨hnonempty hC, hsconn hC⟩ + (fun h => hsub_p hC (h.symm ▸ mem_univ (a 0)) |> h0) ?_ + intro G hGC hG + have hGp := hGC.trans (hsub_p hC) + obtain ⟨Δ, hΔp, hΔ, hb⟩ := exists_disc_in_openDisc hp hG hGp + have hconn : IsPreconnected (range a) := isPreconnected_range ha + have hdb : Disjoint (range a) (discBd Δ) := by + rw [hb] + exact ((hrange_off hC).mono_left hGC).symm + have hΔa : Disjoint (range a) Δ := + disjoint_disc_of_outside hman hΔ hconn hdb ⟨0, rfl⟩ fun h => h0 (hΔp h) + refine ⟨Δ, ?_, hΔ, hb⟩ + obtain ⟨y, hy⟩ : G.Nonempty := by + obtain ⟨φ⟩ := hG + exact ⟨_, (φ 1).2⟩ + have hyΔ : y ∈ Δ := GraphMinor.Surface.discBd_subset Δ (hb.symm.subset hy) + have hΔc : IsPreconnected Δ := by + obtain ⟨h, g, c'⟩ := hΔ.exists_isChart + rw [← c'.g_closedBall] + exact (convex_closedBall _ _).isPreconnected.image _ c'.gc + have hdis : Disjoint (side C) (side D) := + disjoint_left.mpr fun x h₁ h₂ => disjoint_left.mp hCD h₁ h₂ + exact hΔc.subset_left_of_subset_union (hopen hoC) (hopen hoD) hdis + (fun x hx => hcov ⟨hΔp hx, fun h => disjoint_left.mp hΔa h hx⟩) ⟨y, hyΔ, hGC hy⟩ + have hclosure : ∀ {C : Set (OnePoint p)}, C ∈ componentsIn (univ \ F) → frontier C = F → + range a ⊆ closure (side C) := by + intro C hC hf + have hIoo : a '' Ioo 0 1 ⊆ closure (side C) := by + rintro _ ⟨t, ht, rfl⟩ + have hmem : (collapse p ∘ a) t ∈ closure C := by + have : (collapse p ∘ a) t ∈ frontier C := hf ▸ ⟨t, rfl⟩ + exact frontier_subset_closure this + have hat := hmin t ht + simp only [Function.comp, collapse_of_mem hat] at hmem + rw [himg hC] + exact mem_closure_image (continuousAt_uncollapse z ⟨a t, hat⟩) hmem + have hdense : (univ : Set I) ⊆ closure (Ioo (0 : I) 1) := by + rw [closure_Ioo (by norm_num : (0 : I) ≠ 1)] + exact fun t _ => ⟨t.2.1, t.2.2⟩ + rintro _ ⟨t, rfl⟩ + exact closure_minimal hIoo isClosed_closure (image_closure_subset_closure_image ha + (mem_image_of_mem a (hdense (mem_univ t)))) + refine ⟨side A, side B, hdisc hmemA hmemB hdAB hoA hoB hcover, + hdisc hmemB hmemA hdAB.symm hoB hoA ((union_comm _ _).subset.trans' hcover) , + disjoint_left.mpr fun x h₁ h₂ => disjoint_left.mp hdAB h₁ h₂, ?_, hclosure hmemA hfA, + hclosure hmemB hfB⟩ + refine Subset.antisymm hcover (union_subset ?_ ?_) + · exact fun x hx => ⟨hsub_p hmemA hx, disjoint_left.mp (hrange_off hmemA) hx⟩ + · exact fun x hx => ⟨hsub_p hmemB hx, disjoint_left.mp (hrange_off hmemB) hx⟩ + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/SurfaceDualDraw.lean b/LeanPool/GraphMinor/GM12/SurfaceDualDraw.lean new file mode 100644 index 0000000000..adba8ef5a5 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/SurfaceDualDraw.lean @@ -0,0 +1,271 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.SurfaceDualFace + +/-! +# The two drawings on the lines through the faces + +From the lines of `IsDualLines` we build two drawings on the same set. +`IsDualLines.exists_lineDrawing` +has one edge for each line, and its vertices are the hubs and the points `m e`. +`IsDualLines.exists_dual` +has one edge for each edge `e` of `Γ`, made of the two lines at `m e`, and its vertices are the +hubs. This +edge is a loop when the two lines end at the same hub. +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] {Γ K D : Drawing S} + {hrad : PreRad (PaintingOrDrawing.drawing Γ) K} {A B : Set S → Set S} {m x y : Set S → S} + {f : Set S × Bool → Set S} {h : Set S × Bool → S} {ℓ : Set S × Bool → I → S} + +omit [ConnectedSpace S] in +omit [T2Space S] in +theorem line_left_mem {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : a ∈ L := by + obtain ⟨f, h₀, -⟩ := h + exact h₀ ▸ (f 0).2 + +omit [ConnectedSpace S] in +omit [T2Space S] in +theorem line_right_mem {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : b ∈ L := by + obtain ⟨f, -, h₁⟩ := h + exact h₁ ▸ (f 1).2 + +namespace IsDualLines + +variable (hL : IsDualLines hrad D A B m x y f h ℓ) + +include hL + +omit [T2Space S] [ConnectedSpace S] in +theorem mem_line {e : Set S} (he : e ∈ Γ.E) (b : Bool) {z : S} (hz : z ∈ range (ℓ (e, b))) : + z ∈ f (e, b) ∨ z = m e ∨ z = h (e, b) := by + obtain ⟨t, rfl⟩ := hz + by_cases h0 : t = 0 + · exact Or.inr (Or.inl (h0 ▸ hL.zero e he b)) + by_cases h1 : t = 1 + · exact Or.inr (Or.inr (h1 ▸ hL.one e he b)) + exact Or.inl (hL.inside e he b t h0 h1) + +omit [ConnectedSpace S] in +theorem isLine {e : Set S} (he : e ∈ Γ.E) (b : Bool) : + IsLineWithEnds (range (ℓ (e, b))) (m e) (h (e, b)) := by + have := isLine_range (hL.cont e he b) (hL.inj e he b) + rwa [hL.zero e he b, hL.one e he b] at this + +omit [T2Space S] [ConnectedSpace S] in +theorem m_mem {e : Set S} (he : e ∈ Γ.E) : m e ∈ e := (hL.split e he).2.2.1 + +omit [T2Space S] [ConnectedSpace S] in +theorem m_U {e : Set S} (he : e ∈ Γ.E) : m e ∈ Γ.U := + Γ.closure_subset_U he (subset_closure (hL.m_mem he)) + +omit [T2Space S] [ConnectedSpace S] in +theorem m_K {e : Set S} (he : e ∈ Γ.E) : m e ∉ K.U := + disjoint_left.mp (edge_disjoint hrad he) (hL.m_mem he) + +omit [T2Space S] [ConnectedSpace S] in +theorem face_off {e : Set S} (he : e ∈ Γ.E) (b : Bool) {z : S} (hz : z ∈ f (e, b)) : + z ∉ Γ.U ∧ z ∉ K.U := by + have := region_subset (hL.face e he b).1 hz + exact ⟨fun h' => this (Or.inl h'), fun h' => this (Or.inr h')⟩ + +omit [T2Space S] [ConnectedSpace S] in +theorem m_inj {e e' : Set S} (he : e ∈ Γ.E) (he' : e' ∈ Γ.E) (hm : m e = m e') : e = e' := + Γ.edge_eq_of_mem he he' (hL.m_mem he) (hm ▸ hL.m_mem he') + +omit [T2Space S] [ConnectedSpace S] in +theorem hub_off {e : Set S} (he : e ∈ Γ.E) (b : Bool) : h (e, b) ∉ Γ.U := by + obtain ⟨r, hr, -, hc, -⟩ := hL.hub e he b + exact region_subset hr hc + +omit [T2Space S] [ConnectedSpace S] in +theorem hub_V {e : Set S} (he : e ∈ Γ.E) (b : Bool) : h (e, b) ∈ K.V := by + obtain ⟨r, hr, -, -, hc⟩ := hL.hub e he b + exact hc + +omit [T2Space S] [ConnectedSpace S] in +theorem hub_K {e : Set S} (he : e ∈ Γ.E) (b : Bool) : h (e, b) ∈ K.U := + K.V_subset_U (hL.hub_V he b) + +omit [T2Space S] [ConnectedSpace S] in +theorem hub_ne_m {e e' : Set S} (he : e ∈ Γ.E) (he' : e' ∈ Γ.E) (b : Bool) : h (e, b) ≠ m e' := + fun h' => hL.hub_off he b (h' ▸ hL.m_U he') + +omit [T2Space S] [ConnectedSpace S] in +/-- Two different lines meet only at their ends. -/ +theorem line_meet {e e' : Set S} (he : e ∈ Γ.E) (he' : e' ∈ Γ.E) {b b' : Bool} + (hne : (e, b) ≠ (e', b')) {z : S} (hz : z ∈ range (ℓ (e, b))) (hz' : z ∈ range (ℓ (e', b'))) : + z = m e ∨ z = h (e, b) := by + rcases hL.mem_line he b hz with h₁ | h₁ | h₁ + · exfalso + rcases hL.mem_line he' b' hz' with h₂ | h₂ | h₂ + · have hff : f (e, b) = f (e', b') := + region_eq_of_mem (hL.face e he b).1 (hL.face e' he' b').1 h₁ h₂ + obtain rfl := hL.face_unique e he e' he' b b' hff + have hbb : b ≠ b' := fun h' => hne (h' ▸ rfl) + refine hL.face_ne e he ?_ + cases b <;> cases b' + · exact (hbb rfl).elim + · exact hff.symm + · exact hff + · exact (hbb rfl).elim + · exact (hL.face_off he b h₁).1 (h₂ ▸ hL.m_U he') + · exact (hL.face_off he b h₁).2 (h₂ ▸ hL.hub_K he' b') + · exact Or.inl h₁ + · exact Or.inr h₁ + +/-- The vertices of the dual. -/ +theorem exists_hub {c : S} (hc : c ∈ K.V) (hc' : c ∉ Γ.V) (hmax : RadMax + (PaintingOrDrawing.drawing Γ) K) + (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) : ∃ e ∈ Γ.E, ∃ b, h (e, b) = c := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨r, hr, hcr⟩ := hrad.2.2.2.2.1 c ⟨hc, hc'⟩ + obtain ⟨s, hs, hcs⟩ := hub_has_spoke hrad hS hmax hr hcr hc + have hsH : s ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inr hs + obtain ⟨p, hp, hsp⟩ := exists_region_incident hS hsH + obtain ⟨e, he, hep, -, -⟩ := face_edge hrad hS hmax hE hp + obtain ⟨b, rfl⟩ := hL.face_all e he p hp hep + obtain ⟨r', hr', hfr', hhr', hhV⟩ := hL.hub e he b + obtain ⟨v, hv, r₀, hr₀, w, hw, hwV, hcap, hsr₀⟩ := spoke_ends hrad hS hs + obtain ⟨q, hq⟩ := hs.1 + obtain ⟨z, hz₁, hz₂⟩ := mem_closure_iff.mp (hsp hq) r₀ (region_isOpen hr₀) (hsr₀ hq) + obtain rfl : r₀ = r' := region_eq_of_mem hr₀ hr' hz₁ (hfr' hz₂) + have hcw : c = w := by + have : c ∈ closure s ∩ K.V := ⟨hcs, hc⟩ + rw [hcap] at this + rcases this with h' | h' + · exact absurd (h' ▸ hv) hc' + · exact h' + exact ⟨e, he, b, (hub_unique hrad hr₀ hw hwV hhr' hhV).trans hcw.symm⟩ + +omit [ConnectedSpace S] in +/-- The drawing with one edge for each line. -/ +theorem exists_lineDrawing (hfin : ((K.V \ Γ.V) ∪ m '' Γ.E).Finite) : + ∃ N : Drawing S, N.U = ((K.V \ Γ.V) ∪ m '' Γ.E) ∪ ⋃ i ∈ Γ.E ×ˢ (univ : Set Bool), range (ℓ i) ∧ + N.V = (K.V \ Γ.V) ∪ m '' Γ.E ∧ + N.E = (fun i => range (ℓ i) \ {m i.1, h i}) '' (Γ.E ×ˢ (univ : Set Bool)) := by + have hm : ∀ {e}, e ∈ Γ.E → m e ∈ (K.V \ Γ.V) ∪ m '' Γ.E := fun he => Or.inr ⟨_, he, rfl⟩ + have hh : ∀ {e}, e ∈ Γ.E → ∀ b, h (e, b) ∈ (K.V \ Γ.V) ∪ m '' Γ.E := fun he b => + Or.inl ⟨hL.hub_V he b, fun h' => hL.hub_off he b (Γ.V_subset_U h')⟩ + refine exists_drawing_of_finite_lines hfin (Γ.finite_edges.prod finite_univ) (fun i => range + (ℓ i)) + (fun i => m i.1) h ?_ ?_ ?_ ?_ + · rintro ⟨e, b⟩ ⟨he, -⟩ + exact hL.isLine he b + · rintro ⟨e, b⟩ ⟨he, -⟩ h' + exact hL.hub_ne_m he he b h'.symm + · rintro ⟨e, b⟩ ⟨he, -⟩ + apply subset_antisymm + · rintro z ⟨hz, hzV⟩ + rcases hL.mem_line he b hz with h₁ | h₁ | h₁ + · exfalso + rcases hzV with hzV | ⟨e', he', rfl⟩ + · exact (hL.face_off he b h₁).2 (K.V_subset_U hzV.1) + · exact (hL.face_off he b h₁).1 (hL.m_U he') + · exact Or.inl h₁ + · exact Or.inr h₁ + · rintro z (rfl | rfl) + · exact ⟨(line_left_mem (hL.isLine he b)), hm he⟩ + · exact ⟨(line_right_mem (hL.isLine he b)), hh he b⟩ + · rintro ⟨e, b⟩ ⟨he, -⟩ ⟨e', b'⟩ ⟨he', -⟩ hne z ⟨hz, hz'⟩ + rcases hL.line_meet he he' hne hz hz' with rfl | rfl + · exact hm he + · exact hh he b + +omit [ConnectedSpace S] in +/-- The dual. -/ +theorem exists_dual (hfin : (K.V \ Γ.V).Finite) : + ∃ Γ₁ : Drawing S, Γ₁.U = (K.V \ Γ.V) ∪ ⋃ e ∈ Γ.E, (range (ℓ (e, true)) ∪ range (ℓ (e, false))) ∧ + Γ₁.V = K.V \ Γ.V ∧ + Γ₁.E = (fun e => (range (ℓ (e, true)) ∪ range (ℓ (e, false))) \ + {h (e, true), h (e, false)}) '' Γ.E := by + have hh : ∀ {e}, e ∈ Γ.E → ∀ b, h (e, b) ∈ K.V \ Γ.V := fun he b => + ⟨hL.hub_V he b, fun h' => hL.hub_off he b (Γ.V_subset_U h')⟩ + have hmn : ∀ {e}, e ∈ Γ.E → m e ∉ K.V \ Γ.V := fun he h' => hL.m_K he (K.V_subset_U h'.1) + refine exists_drawing_of_curves hfin Γ.finite_edges + (fun e => range (ℓ (e, true)) ∪ range (ℓ (e, false))) (fun e => h (e, true)) + (fun e => h (e, false)) ?_ ?_ ?_ + · intro e he + have hT := hL.isLine he true + have hF := hL.isLine he false + have hne : ((e, true) : Set S × Bool) ≠ (e, false) := by simp + by_cases heq : h (e, true) = h (e, false) + · rw [heq] at hT ⊢ + have hF' := hF + have hO : IsOArc (range (ℓ (e, true)) ∪ range (ℓ (e, false))) := by + refine isOArc_union hT hF fun z hz => ?_ + rcases hL.line_meet he he hne hz.1 hz.2 with h₁ | h₁ + · exact Or.inl h₁ + · exact Or.inr (heq ▸ h₁) + obtain ⟨D', h₁, h₂, h₃⟩ := exists_loop_drawing_E hO (a := h (e, false)) (Or.inr + (line_right_mem hF)) + refine ⟨D', h₁, ?_, ?_⟩ + · rw [h₂, pair_eq_singleton] + · rw [h₃, pair_eq_singleton] + · have hcap : range (ℓ (e, true)) ∩ range (ℓ (e, false)) = {m e} := by + apply subset_antisymm + · rintro z ⟨h₁, h₂⟩ + rcases hL.line_meet he he hne h₁ h₂ with h₃ | h₃ + · exact h₃ + · exfalso + rcases hL.mem_line he false h₂ with h₄ | h₄ | h₄ + · exact absurd (hL.hub_K he true) (h₃ ▸ (hL.face_off he false h₄).2) + · exact hL.hub_ne_m he he true (h₃.symm.trans h₄) + · exact heq (h₃.symm.trans h₄) + · rintro z rfl + exact ⟨(line_left_mem hT), (line_left_mem hF)⟩ + have hline := IsLineWithEnds.union hT hF hcap + exact ⟨lineDrawing hline heq, rfl, rfl, lineDrawing_E hline heq⟩ + · intro e he + apply subset_antisymm + · rintro z ⟨hz | hz, hzV⟩ + · rcases hL.mem_line he true hz with h₁ | h₁ | h₁ + · exact absurd (K.V_subset_U hzV.1) (hL.face_off he true h₁).2 + · exact absurd (h₁ ▸ hzV) (hmn he) + · exact Or.inl h₁ + · rcases hL.mem_line he false hz with h₁ | h₁ | h₁ + · exact absurd (K.V_subset_U hzV.1) (hL.face_off he false h₁).2 + · exact absurd (h₁ ▸ hzV) (hmn he) + · exact Or.inr h₁ + · rintro z (rfl | rfl) + · exact ⟨Or.inl (line_right_mem (hL.isLine he true)), hh he true⟩ + · exact ⟨Or.inr (line_right_mem (hL.isLine he false)), hh he false⟩ + · intro e he e' he' hne z ⟨hz, hz'⟩ + have key : ∀ {b b'}, z ∈ range (ℓ (e, b)) → z ∈ range (ℓ (e', b')) → z ∈ K.V \ Γ.V := by + intro b b' h₁ h₂ + have hne' : ((e, b) : Set S × Bool) ≠ (e', b') := fun h' => hne (congrArg Prod.fst h') + rcases hL.line_meet he he' hne' h₁ h₂ with rfl | rfl + · exfalso + rcases hL.mem_line he' b' h₂ with h₃ | h₃ | h₃ + · exact (hL.face_off he' b' h₃).1 (hL.m_U he) + · exact hne (hL.m_inj he he' h₃) + · exact hL.hub_ne_m he' he b' h₃.symm + · exact hh he b + rcases hz with hz | hz <;> rcases hz' with hz' | hz' + · exact key hz hz' + · exact key hz hz' + · exact key hz hz' + · exact key hz hz' + +end IsDualLines + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/SurfaceDualFace.lean b/LeanPool/GraphMinor/GM12/SurfaceDualFace.lean new file mode 100644 index 0000000000..1e142e17fe --- /dev/null +++ b/LeanPool/GraphMinor/GM12/SurfaceDualFace.lean @@ -0,0 +1,198 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Disc +public import LeanPool.GraphMinor.GM11.SplitEdge +public import LeanPool.GraphMinor.GM11.RadialAccess +public import LeanPool.GraphMinor.GM12.SurfaceDualCut +public import LeanPool.GraphMinor.GM12.SurfaceDualCurves + +/-! +# The faces of a drawing and its radial drawing + +Let `H = Γ ∪ K`, for a radial drawing `K` of `Γ`. Each region `p` of `H` has a vertex of `K` from +the +region of `Γ` around `p` on its frontier (`exists_face_hub`), and an edge `e` of `Γ` on its +frontier. +We fix a point `m` of `e` and take a line from `m` to the hub, inside `p` (`exists_face_line`). +-/ + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] {Γ K : Drawing S} + +omit [T2Space S] [ConnectedSpace S] in +/-- A region of `H` lies in a region `r` of `Γ`, and the vertex of `K` in `r` is on its frontier. +The +region is not all of `r`, so its frontier meets `r`. A point of the frontier in `r` is the hub or +lies +on an edge of `K`. The whole edge is then on the frontier, and so is its end at the hub. -/ +theorem exists_face_hub (hrad : PreRad (PaintingOrDrawing.drawing Γ) K) (hS : IsClosedSurface S) + {p : Set S} (hp : p ∈ (radialUnion hrad).R) : + ∃ r ∈ Γ.R, p ⊆ r ∧ ∃ c ∈ r, c ∈ K.V ∧ c ∈ closure p := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨r, hr, hpr⟩ := exists_region_of_sub hrad hp + obtain ⟨c, ⟨hc, hcV⟩, -⟩ := hrad.2.2.2.1 r hr + have hc' : c ∈ r := hc + have hcV' : c ∈ K.V := hcV + refine ⟨r, hr, hpr, c, hc', hcV', ?_⟩ + have hopen : IsOpen p := region_isOpen hp + have hcU : c ∈ (radialUnion hrad).U := Or.inr (K.V_subset_U hcV') + have hrc : IsPreconnected r := region_isPreconnected hr + -- The frontier of `p` meets `r`. + obtain ⟨y, hyr, hyp⟩ : ∃ y ∈ r, y ∈ closure p \ p := by + by_contra hno + push Not at hno + have hclopen : r ⊆ p ∪ (closure p)ᶜ := fun y hy => by + by_cases h : y ∈ closure p + · exact Or.inl (by + by_contra hn + exact hno y hy ⟨h, hn⟩ |>.elim) + · exact Or.inr h + obtain ⟨z, hz⟩ := region_nonempty hp + have := hrc.subset_left_of_subset_union hopen isClosed_closure.isOpen_compl + (disjoint_left.mpr fun x h₁ h₂ => h₂ (subset_closure h₁)) hclopen ⟨z, hpr hz, hz⟩ hc' + exact region_subset hp this hcU + by_cases hyc : y = c + · exact hyc ▸ hyp.1 + have hyU : y ∈ (radialUnion hrad).U := by + rcases closure_region_subset hp hyp.1 with h | h + · exact absurd h hyp.2 + · exact h + have hyK : y ∈ K.U := by + rcases hyU with h | h + · exact absurd h (region_subset hr hyr) + · exact h + have hyV : y ∉ K.V := fun h => hyc (hub_unique hrad hr hc' hcV' hyr h) + obtain ⟨g, hg, hyg⟩ := K.exists_edge_of_mem hyK hyV + have hgH : g ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inr hg + have hgp : g ⊆ closure p := + edge_subset_closure_of_incident hS hgH hp ⟨y, hyg, hyp.1⟩ + exact closure_minimal hgp isClosed_closure (spoke_in_region hrad hS hr hc' hcV' hg hyg hyr).1 + +/-- The objects from which we build the dual. `D` is `Γ` with one new vertex `m e` on each edge `e`, +which cuts `e` into `A e` and `B e`, with ends `x e, m e` and `m e, y e`. Each edge `e` has two +faces +`f (e, b)` beside it, one for each `b`. Each face has a hub `h (e, b)`, and `ℓ (e, b)` is a line +from +`m e` to the hub through the face. -/ +structure IsDualLines (hrad : PreRad (PaintingOrDrawing.drawing Γ) K) (D : Drawing S) + (A B : Set S → Set S) (m x y : Set S → S) (f : Set S × Bool → Set S) (h : Set S × Bool → S) + (ℓ : Set S × Bool → I → S) : Prop where + U_eq : D.U = Γ.U + V_eq : D.V = Γ.V ∪ m '' Γ.E + split : ∀ e ∈ Γ.E, A e ∈ D.E ∧ B e ∈ D.E ∧ m e ∈ e ∧ m e ∉ A e ∧ m e ∉ B e ∧ Disjoint (A e) (B e) + ∧ + e = A e ∪ {m e} ∪ B e ∧ x e ∈ Γ.V ∧ y e ∈ Γ.V ∧ closure e ∩ Γ.V = {x e, y e} ∧ + closure (A e) ∩ D.V = {x e, m e} ∧ closure (B e) ∩ D.V = {m e, y e} + all : ∀ g ∈ D.E, ∃ e ∈ Γ.E, g = A e ∨ g = B e + face : ∀ e ∈ Γ.E, ∀ b, f (e, b) ∈ (radialUnion hrad).R ∧ e ⊆ closure (f (e, b)) + face_ne : ∀ e ∈ Γ.E, f (e, true) ≠ f (e, false) + face_all : ∀ e ∈ Γ.E, ∀ p ∈ (radialUnion hrad).R, e ⊆ closure p → ∃ b, p = f (e, b) + face_unique : ∀ e ∈ Γ.E, ∀ e' ∈ Γ.E, ∀ b b', f (e, b) = f (e', b') → e = e' + hub : ∀ e ∈ Γ.E, ∀ b, ∃ r ∈ Γ.R, f (e, b) ⊆ r ∧ h (e, b) ∈ r ∧ h (e, b) ∈ K.V + cont : ∀ e ∈ Γ.E, ∀ b, Continuous (ℓ (e, b)) + inj : ∀ e ∈ Γ.E, ∀ b, Function.Injective (ℓ (e, b)) + zero : ∀ e ∈ Γ.E, ∀ b, ℓ (e, b) 0 = m e + one : ∀ e ∈ Γ.E, ∀ b, ℓ (e, b) 1 = h (e, b) + inside : ∀ e ∈ Γ.E, ∀ b, ∀ t, t ≠ 0 → t ≠ 1 → ℓ (e, b) t ∈ f (e, b) + +/-- The objects of `IsDualLines` exist. Each face has an edge of `Γ` on its frontier, and a hub by +`exists_face_hub`. The point `m e` and the hub are vertices of `D ∪ K` that have a half-edge, so +`exists_access` gives a path from each of them into the face, and `exists_chord` joins these. -/ +theorem exists_dualLines (hrad : PreRad (PaintingOrDrawing.drawing Γ) K) (hS : IsClosedSurface S) + (hmax : RadMax (PaintingOrDrawing.drawing Γ) K) (hE : Γ.E.Nonempty) : + ∃ D A B m x y f h ℓ, IsDualLines hrad D A B m x y f h ℓ := by + classical + obtain ⟨e₀, he₀⟩ := hE + obtain ⟨y₀, -⟩ := he₀.1 + have hne : Nonempty S := ⟨y₀⟩ + have hE : Γ.E.Nonempty := ⟨e₀, he₀⟩ + obtain ⟨D, A, B, m, x, y, hU, hV, hsplit, hall⟩ := exists_split Γ + have hDK : D.U ∩ K.U ⊆ D.V ∩ K.V := by + rintro z ⟨h₁, h₂⟩ + have hz : z ∈ Γ.V := by + rw [← radial_inter hrad] + exact ⟨hU ▸ h₁, h₂⟩ + exact ⟨hV ▸ Or.inl hz, radial_V hrad hz⟩ + let Hs := D.glue K hDK + have hHsU : Hs.U = (radialUnion hrad).U := by + change D.U ∪ K.U = Γ.U ∪ K.U + rw [hU] + have hHsR : Hs.R = (radialUnion hrad).R := by + simp only [Drawing.R, hHsU] + have hHsE : Hs.E = D.E ∪ K.E := Drawing.glue_E _ + obtain ⟨γ, hγ⟩ := exists_edgePar Hs + have hface : ∀ e ∈ Γ.E, ∃ p q : Set S, p ∈ (radialUnion hrad).R ∧ q ∈ (radialUnion hrad).R + ∧ p ≠ q ∧ + e ⊆ closure p ∧ e ⊆ closure q ∧ + ∀ p' ∈ (radialUnion hrad).R, e ⊆ closure p' → p' = p ∨ p' = q := fun e he => by + obtain ⟨p, hp, q, hq, h₁, h₂, h₃, h₄⟩ := exists_two_faces hrad hS hmax hE he + exact ⟨p, q, hp, hq, h₁, h₂, h₃, h₄⟩ + choose! p q hp hq hpq hep heq hsides using hface + let f : Set S × Bool → Set S := fun i => if i.2 then p i.1 else q i.1 + have hf : ∀ e ∈ Γ.E, ∀ b, f (e, b) ∈ (radialUnion hrad).R ∧ e ⊆ closure (f (e, b)) := by + intro e he b + cases b + · exact ⟨hq e he, heq e he⟩ + · exact ⟨hp e he, hep e he⟩ + have hline : ∀ i : Set S × Bool, i.1 ∈ Γ.E → ∃ (c : S) (g : I → S), (∃ r ∈ Γ.R, f i ⊆ r ∧ c ∈ r + ∧ c ∈ K.V) ∧ + Continuous g ∧ Function.Injective g ∧ g 0 = m i.1 ∧ g 1 = c ∧ + ∀ t, t ≠ 0 → t ≠ 1 → g t ∈ f i := by + rintro ⟨e, b⟩ he + obtain ⟨hfR, hef⟩ := hf e he b + obtain ⟨r, hr, hfr, c, hc, hcV, hcl⟩ := exists_face_hub hrad hS hfR + have hfR' : f (e, b) ∈ Hs.R := hHsR ▸ hfR + have hfd : IsOpenDisc (f (e, b)) := face_isOpenDisc hrad hS hmax hfR + obtain ⟨hA, -, hme, -, -, -, -, -, -, -, hcapA, -⟩ := hsplit e he + have hmcl : m e ∈ closure (A e) ∩ D.V := by rw [hcapA]; simp + have hAH : A e ∈ Hs.E := hHsE ▸ Or.inl hA + have hmH : m e ∈ Hs.V := Or.inl hmcl.2 + have hcH : c ∈ Hs.V := Or.inr hcV + obtain ⟨g₁, hg₁, h₁0, h₁⟩ := exists_access hS Hs hγ hmH + (by + obtain ⟨b', hb'⟩ := exists_end_eq hγ hAH hmH hmcl.1 + exact ⟨(A e, b'), hAH, hb'⟩) hfR' (hef hme) + obtain ⟨s, hs, hcs⟩ := hub_has_spoke hrad hS hmax hr hc hcV + have hsH : s ∈ Hs.E := hHsE ▸ Or.inr hs + obtain ⟨g₂, hg₂, h₂0, h₂⟩ := exists_access hS Hs hγ hcH + (by + obtain ⟨b', hb'⟩ := exists_end_eq hγ hsH hcH hcs + exact ⟨(s, b'), hsH, hb'⟩) hfR' hcl + have hmU : m e ∈ Γ.U := Γ.closure_subset_U he (subset_closure hme) + have hmc : m e ≠ c := fun h' => region_subset hr hc (h' ▸ hmU) + have hmf : m e ∉ f (e, b) := fun h' => region_subset hr (hfr h') hmU + obtain ⟨g, hg, hi, h0, h1, hin, -⟩ := exists_chord (IsOpenDisc.isPathConnected hfd) hmc hmf hg₁ + hg₂ h₁0 h₂0 h₁ h₂ + exact ⟨c, g, ⟨r, hr, hfr, hc, hcV⟩, hg, hi, h0, h1, hin⟩ + choose! h ℓ hhub hcont hinj h0 h1 hin using hline + refine ⟨D, A, B, m, x, y, f, h, ℓ, ⟨hU, hV, hsplit, hall, hf, fun e he => hpq e he, ?_, ?_, + fun e he b => hhub (e, b) he, fun e he b => hcont (e, b) he, fun e he b => hinj (e, b) he, + fun e he b => h0 (e, b) he, fun e he b => h1 (e, b) he, fun e he b => hin (e, b) he⟩⟩ + · intro e he p' hp' hcl + rcases hsides e he p' hp' hcl with h' | h' + · exact ⟨true, h'⟩ + · exact ⟨false, h'⟩ + · intro e he e' he' b b' heq' + obtain ⟨hfR, hef⟩ := hf e he b + obtain ⟨hfR', hef'⟩ := hf e' he' b' + obtain ⟨g, -, -, hg, -⟩ := face_edge hrad hS hmax hE hfR + rw [hg e he hef, hg e' he' (heq' ▸ hef')] + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/SurfaceDualFan.lean b/LeanPool/GraphMinor/GM12/SurfaceDualFan.lean new file mode 100644 index 0000000000..303025567a --- /dev/null +++ b/LeanPool/GraphMinor/GM12/SurfaceDualFan.lean @@ -0,0 +1,625 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section4c +public import LeanPool.GraphMinor.GM12.SurfaceDualStar + +/-! +# A star is an open disc + +Go around `v ∈ V₀`, with the half-edges `o 0, o 1, ...` at `v` in rotation order. The regions in the +corners are all different (`IsSideSplit.corner_inj`). Start with the region in the first corner and +glue on the regions in the next corners one at a time, across the edge between them, by +`glue_open_discs`. This gives a fan, which is an open disc (`fan`). + +The last step is different, since the last region touches the fan along the two edges `o 0` and the +last +half-edge, which meet at `v`. These two edges have different other ends, by `corner_alternates`. So +their union is a line through `v`, which we add to `N` as one edge, and we use `glue_open_discs` for +that +drawing. The fan and the last region are regions of this drawing since the stars are open and +disjoint. +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] {D K N : Drawing S} + {V₀ : Set S} + +/-- See the module docstring. -/ +def fan {ι : Type*} (ρ a : ι → Set S) (o : ℕ → ι) : ℕ → Set S + | 0 => ρ (o 0) + | n + 1 => fan ρ a o n ∪ ρ (o (n + 1)) ∪ a (o (n + 1)) + +section Fan + +omit [T2Space S] [ConnectedSpace S] + +variable {ι : Type*} {ρ a : ι → Set S} {o : ℕ → ι} + +omit [TopologicalSpace S] in +theorem face_subset_fan {i n : ℕ} (hi : i ≤ n) : ρ (o i) ⊆ fan ρ a o n := by + induction n with + | zero => + obtain rfl : i = 0 := by omega + exact Subset.rfl + | succ n ih => + by_cases h : i = n + 1 + · subst h + exact fun x hx => Or.inl (Or.inr hx) + · exact (ih (by omega)).trans fun x hx => Or.inl (Or.inl hx) + +omit [TopologicalSpace S] in +theorem arm_subset_fan {i n : ℕ} (h₀ : 1 ≤ i) (hi : i ≤ n) : a (o i) ⊆ fan ρ a o n := by + induction n with + | zero => omega + | succ n ih => + by_cases h : i = n + 1 + · subst h + exact fun x hx => Or.inr hx + · exact (ih (by omega)).trans fun x hx => Or.inl (Or.inl hx) + +omit [TopologicalSpace S] in +theorem mem_fan {n : ℕ} {x : S} (hx : x ∈ fan ρ a o n) : + (∃ i ≤ n, x ∈ ρ (o i)) ∨ ∃ i, 1 ≤ i ∧ i ≤ n ∧ x ∈ a (o i) := by + induction n with + | zero => exact Or.inl ⟨0, le_rfl, hx⟩ + | succ n ih => + rcases hx with (hx | hx) | hx + · rcases ih hx with ⟨i, hi, h⟩ | ⟨i, h₁, hi, h⟩ + · exact Or.inl ⟨i, by omega, h⟩ + · exact Or.inr ⟨i, h₁, by omega, h⟩ + · exact Or.inl ⟨n + 1, le_rfl, hx⟩ + · exact Or.inr ⟨n + 1, by omega, le_rfl, hx⟩ + +end Fan + +omit [T2Space S] [ConnectedSpace S] in +/-- A connected open set that, with a disjoint open set, fills the complement of `U(H)` is a region. +-/ +theorem mem_R_of_split {H : Drawing S} {C C' : Set S} (hC : IsOpen C) (hC' : IsOpen C') + (hne : C.Nonempty) (hcon : IsPreconnected C) (hd : Disjoint C C') (hu : C ∪ C' + = H.Uᶜ) : C ∈ H.R := by + obtain ⟨x, hx⟩ := hne + have hxU : x ∉ H.U := by + have : x ∈ H.Uᶜ := hu ▸ Or.inl hx + exact this + rw [mem_R_iff] + refine ⟨x, hxU, subset_antisymm ?_ ?_⟩ + · refine hcon.subset_connectedComponentIn hx fun y hy => ⟨mem_univ _, ?_⟩ + have : y ∈ H.Uᶜ := hu ▸ Or.inl hy + exact this + · have hc : IsPreconnected (connectedComponentIn (univ \ H.U) x) := + isPreconnected_connectedComponentIn + refine hc.subset_left_of_subset_union hC hC' hd (fun y hy => ?_) ⟨x, + mem_connectedComponentIn ⟨mem_univ _, hxU⟩, hx⟩ + rw [hu] + exact (connectedComponentIn_subset _ _ hy).2 + +namespace IsSideSplit + +variable (hX : IsSideSplit D K N V₀) (hrad : PreRad (PaintingOrDrawing.drawing D) K) + (hS : IsClosedSurface S) (hmax : RadMax (PaintingOrDrawing.drawing D) K) (hE : D.E.Nonempty) + +private theorem initial_fan_is_open_disc + {S : Type u} + [TopologicalSpace S] + [ConnectedSpace S] + (hS : IsClosedSurface S) + {v : S} + (H : Drawing S) + (γ : Set S → ↑I → S) + (next : ↑(halfEdges H γ v) → ↑(halfEdges H γ v)) + (ρ : ↑(halfEdges H γ v) → Set S) + (d : ℕ) + (o : ℕ → ↑(halfEdges H γ v)) + (hosucc : ∀ (i : ℕ), o (i + 1) = next (o i)) + (hoinj : ∀ {i j : ℕ}, i < d → j < d → o i = o j → i = j) + (a : ↑(halfEdges H γ v) → Set S) + (hEk : ∀ (k : ↑(halfEdges H γ v)), a k ∈ H.E) + (hRk : ∀ (k : ↑(halfEdges H γ v)), ρ k ∈ H.R) + (hOpen : ∀ k, IsOpenDisc (ρ k)) + (hleft : ∀ (k : ↑(halfEdges H γ v)), a (next k) ⊆ closure (ρ k)) + (hright : ∀ (k : ↑(halfEdges H γ v)), a (next k) ⊆ closure (ρ (next k))) + (hρinj : ∀ {k k' : ↑(halfEdges H γ v)}, ρ k = ρ k' → k = k') + (hd_arm : ∀ {n j : ℕ}, j < d → n < d → j = 0 ∨ n < j → Disjoint (fan ρ a o n) (closure (a (o + j)))) + (hd_face : ∀ {n j : ℕ}, n < j → j < d → Disjoint (fan ρ a o n) (ρ (o j))) + (hd_rc : ∀ (k k' : ↑(halfEdges H γ v)), Disjoint (ρ k) (closure (a k'))) : + ∀ (n : ℕ), n + 2 ≤ d → IsOpenDisc (fan ρ a o n) := by + intro n + induction n with + | zero => + intro _ + exact hOpen _ + | succ n ih => + intro hn + have hn1 : n + 1 < d := by omega + have hne : ρ (o n) ≠ ρ (o (n + 1)) := fun h' => by + have := hoinj (by omega) hn1 (hρinj h') + omega + refine glue_open_discs hS (hEk (o (n + 1))) (hRk (o n)) (hRk (o (n + 1))) hne ?_ ?_ + (face_subset_fan le_rfl) Subset.rfl (ih (by omega)) (hOpen _) + (hd_face (by omega) hn1) (hd_arm hn1 (by omega) (Or.inr (by omega))) (hd_rc _ _) + · rw [hosucc] + exact hleft _ + · rw [hosucc] + exact hright _ + +private theorem star_eq_completed_fan + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {v : S} + (H : Drawing S) + (γ : Set S → ↑I → S) + (hγ : EdgePar H γ) + (hvH : v ∈ H.V) + (next : ↑(halfEdges H γ v) → ↑(halfEdges H γ v)) + (ρ : ↑(halfEdges H γ v) → Set S) + (hcor : IsCorners H γ v next ρ) + (d : ℕ) + (o : ℕ → ↑(halfEdges H γ v)) + (hreach : ∀ (k : ↑(halfEdges H γ v)), ∃ i < d, o i = k) + (a : ↑(halfEdges H γ v) → Set S) + (ha : ∀ k, a k = k.1.1) + (hEk : ∀ (k : ↑(halfEdges H γ v)), a k ∈ H.E) + (hvk : ∀ (k : ↑(halfEdges H γ v)), v ∈ closure (a k)) + (e : ℕ) (hed : d = e + 2) + (w₀ : S) + (hw₀v : w₀ ≠ v) + (w₁ : S) + (hw₁v : w₁ ≠ v) + (c : Set S) (hc : c = closure (a (o 0)) ∪ closure (a (o (e + 1)))) + (hmemc : ∀ {z : S}, z ∈ c → z = v ∨ z = w₀ ∨ z = w₁ ∨ z ∈ a (o 0) ∨ z ∈ a (o (e + 1))) + (hw₀H : w₀ ∈ H.V) + (hw₁H : w₁ ∈ H.V) + (hstar : ∀ {z : S}, z ∈ fan ρ a o e → z ∈ star H v) + (hstarF : ρ (o (e + 1)) ⊆ star H v) : + star H v = fan ρ a o e ∪ ρ (o (e + 1)) ∪ c \ {w₀, w₁} := by + apply subset_antisymm + · intro x hx + have hedge : ∀ {g}, x ∈ g → g = a (o 0) ∨ g = a (o (e + 1)) → x ∈ c \ {w₀, w₁} := by + rintro g hxg (rfl | rfl) + · refine ⟨hc ▸ Or.inl (subset_closure hxg), ?_⟩ + rintro (h' | h') + · exact edge_notMem_V (hEk _) hxg (h' ▸ hw₀H) + · exact edge_notMem_V (hEk _) hxg (h' ▸ hw₁H) + · refine ⟨hc ▸ Or.inr (subset_closure hxg), ?_⟩ + rintro (h' | h') + · exact edge_notMem_V (hEk _) hxg (h' ▸ hw₀H) + · exact edge_notMem_V (hEk _) hxg (h' ▸ hw₁H) + rcases mem_star hx with rfl | ⟨g, hg, hvg, hxg⟩ | ⟨p, hp, hvp, hxp⟩ + · refine Or.inr ⟨hc ▸ Or.inl (hvk (o 0)), ?_⟩ + rintro (h' | h') + · exact hw₀v h'.symm + · exact hw₁v h'.symm + · obtain ⟨b, hb⟩ := exists_end_eq hγ hg hvH hvg + obtain ⟨i, hi, hik⟩ := hreach ⟨(g, b), hg, hb⟩ + have hgi : a (o i) = g := by rw [hik, ha] + by_cases h₀ : i = 0 + · subst h₀ + exact Or.inr (hedge hxg (Or.inl hgi.symm)) + by_cases h₁ : i = e + 1 + · subst h₁ + exact Or.inr (hedge hxg (Or.inr hgi.symm)) + · exact Or.inl (Or.inl (arm_subset_fan (by omega) (by omega) (hgi ▸ hxg))) + · obtain ⟨k, rfl⟩ := IsCorners.all hcor p hp hvp + obtain ⟨i, hi, rfl⟩ := hreach k + by_cases h₁ : i = e + 1 + · subst h₁ + exact Or.inl (Or.inr hxp) + · exact Or.inl (Or.inl (face_subset_fan (by omega) hxp)) + · rintro x ((hx | hx) | ⟨hx, hxw⟩) + · exact hstar hx + · exact hstarF hx + · rcases hmemc hx with rfl | rfl | rfl | h' | h' + · exact mem_star_self _ _ + · exact absurd (Or.inl rfl) hxw + · exact absurd (Or.inr rfl) hxw + · exact edge_subset_star (hEk _) (hvk _) h' + · exact edge_subset_star (hEk _) (hvk _) h' + +private theorem completed_fan_complements_augmented_drawing + {S : Type u} + [TopologicalSpace S] + [T2Space S] + [ConnectedSpace S] + {D : Drawing S} + {K : Drawing S} + {N : Drawing S} + {V₀ : Set S} + (hX : IsSideSplit D K N V₀) + (hrad : PreRad (PaintingOrDrawing.drawing D) K) + (hS : IsClosedSurface S) + (hmax : RadMax (PaintingOrDrawing.drawing D) K) + (hE : D.E.Nonempty) + {v : S} + (hv : v ∈ V₀) + (H : Drawing S) (hH : H = radialUnion hrad) + (γ : Set S → ↑I → S) + (ρ : ↑(halfEdges H γ v) → Set S) + (o : ℕ → ↑(halfEdges H γ v)) + (a : ↑(halfEdges H γ v) → Set S) + (e : ℕ) + (w₀ : S) + (w₁ : S) + (c : Set S) + (H' : Drawing S) + (hH'U : H'.U = N.U ∪ c) + (hstar : ∀ {z : S}, z ∈ fan ρ a o e → z ∈ star H v) + (hstarF : ρ (o (e + 1)) ⊆ star H v) + (hdc : Disjoint (fan ρ a o e) c) + (hdcF : Disjoint (ρ (o (e + 1))) c) + (hstar_eq : star H v = fan ρ a o e ∪ ρ (o (e + 1)) ∪ c \ {w₀, w₁}) + (Rest : Set S) (hRest_eq : Rest = ⋃ w ∈ V₀ \ {v}, star H w) + (hRestc : Disjoint Rest c) : + fan ρ a o e ∪ ρ (o (e + 1)) ∪ Rest = H'.Uᶜ := by + subst H + rw [hH'U, hRest_eq] + apply subset_antisymm + · rintro x ((hx | hx) | hx) (hxU | hxU) + · exact disjoint_left.mp (hX.star_off hrad hv) (hstar hx) hxU + · exact disjoint_left.mp hdc hx hxU + · exact disjoint_left.mp (hX.star_off hrad hv) (hstarF hx) hxU + · exact disjoint_left.mp hdcF hx hxU + · obtain ⟨u, hu, hxu⟩ := mem_iUnion₂.mp hx + exact disjoint_left.mp (hX.star_off hrad hu.1) hxu hxU + · exact disjoint_left.mp hRestc (hRest_eq.symm ▸ hx) hxU + · intro x hx + have hxN : x ∉ N.U := fun h' => hx (Or.inl h') + have hxc : x ∉ c := fun h' => hx (Or.inr h') + obtain ⟨u, hu, hxu⟩ := hX.exists_star hrad hS hmax hE hxN + by_cases huv : u = v + · subst huv + rw [hstar_eq] at hxu + rcases hxu with (h' | h') | h' + · exact Or.inl (Or.inl h') + · exact Or.inl (Or.inr h') + · exact absurd h'.1 hxc + · exact Or.inr (mem_biUnion (show u ∈ V₀ \ {v} from ⟨hu, huv⟩) hxu) + +private theorem fan_end_arms_have_single_intersection {S : Type u} [TopologicalSpace S] + {H : Drawing S} {e₀ e₁ : Set S} {v w₀ w₁ : S} (he₀ : e₀ ∈ H.E) (he₁ : e₁ ∈ H.E) + (hne : e₀ ≠ e₁) (hw₀₁ : w₀ ≠ w₁) (hv₀ : v ∈ closure e₀) (hv₁ : v ∈ closure e₁) + (hcap₀ : closure e₀ ∩ H.V = {v, w₀}) (hcap₁ : closure e₁ ∩ H.V = {v, w₁}) : + closure e₀ ∩ closure e₁ = {v} := by + apply subset_antisymm + · rintro z ⟨h₁, h₂⟩ + have hzV := closure_inter_subset_V he₀ he₁ hne ⟨h₁, h₂⟩ + have h₃ : z ∈ ({v, w₀} : Set S) := hcap₀ ▸ ⟨h₁, hzV⟩ + have h₄ : z ∈ ({v, w₁} : Set S) := hcap₁ ▸ ⟨h₂, hzV⟩ + rcases h₃ with h₃ | h₃ + · exact h₃ + · rcases h₄ with h₄ | h₄ + · exact h₄ + · exact absurd (h₃.symm.trans h₄) hw₀₁ + · rintro z rfl + exact ⟨hv₀, hv₁⟩ + +private theorem joining_line_membership {S : Type u} [TopologicalSpace S] + {H : Drawing S} {e₀ e₁ : Set S} {v w₀ w₁ : S} (he₀ : e₀ ∈ H.E) (he₁ : e₁ ∈ H.E) + (hcap₀ : closure e₀ ∩ H.V = {v, w₀}) (hcap₁ : closure e₁ ∩ H.V = {v, w₁}) : + ∀ {z : S}, z ∈ closure e₀ ∪ closure e₁ → + z = v ∨ z = w₀ ∨ z = w₁ ∨ z ∈ e₀ ∨ z ∈ e₁ := by + rintro z (hz | hz) + · by_cases hzV : z ∈ H.V + · have : z ∈ ({v, w₀} : Set S) := hcap₀ ▸ ⟨hz, hzV⟩ + rcases this with h' | h' + · exact Or.inl h' + · exact Or.inr (Or.inl h') + · exact Or.inr (Or.inr (Or.inr (Or.inl (H.closure_diff_V he₀ ▸ ⟨hz, hzV⟩)))) + · by_cases hzV : z ∈ H.V + · have : z ∈ ({v, w₁} : Set S) := hcap₁ ▸ ⟨hz, hzV⟩ + rcases this with h' | h' + · exact Or.inl h' + · exact Or.inr (Or.inr (Or.inl h')) + · exact Or.inr (Or.inr (Or.inr (Or.inr (H.closure_diff_V he₁ ▸ ⟨hz, hzV⟩)))) + +private theorem joining_line_meets_split_only_at_endpoints {S : Type u} [TopologicalSpace S] + [T2Space S] {N : Drawing S} {c e₀ e₁ : Set S} {v w₀ w₁ : S} + (hv : v ∉ N.U) (hw₀ : w₀ ∈ N.V) (hw₁ : w₁ ∈ N.V) + (he₀ : Disjoint e₀ N.U) (he₁ : Disjoint e₁ N.U) (hne : w₀ ≠ w₁) + (hline : IsLineWithEnds c w₀ w₁) + (hmemc : ∀ {z}, z ∈ c → z = v ∨ z = w₀ ∨ z = w₁ ∨ z ∈ e₀ ∨ z ∈ e₁) : + N.U ∩ (lineDrawing hline hne).U ⊆ N.V ∩ (lineDrawing hline hne).V := by + rintro z ⟨hzN, hzc⟩ + rcases hmemc hzc with rfl | rfl | rfl | h' | h' + · exact absurd hzN hv + · exact ⟨hw₀, Or.inl rfl⟩ + · exact ⟨hw₁, Or.inr rfl⟩ + · exact absurd hzN (disjoint_left.mp he₀ h') + · exact absurd hzN (disjoint_left.mp he₁ h') + +include hX hS hmax hE + +/-- See the module docstring. -/ +theorem star_isOpenDisc {v : S} (hv : v ∈ V₀) : IsOpenDisc (star (radialUnion hrad) v) := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨y₀⟩ : Nonempty S := inferInstance + have hne' : Nonempty S := ⟨y₀⟩ + set H := radialUnion hrad with hH + obtain ⟨γ, hγ⟩ := exists_edgePar H + have hvH : v ∈ H.V := hX.V_sub hrad hv + have hvD := hX.sub_V hv + have htwo : 2 ≤ Nat.card (halfEdges H γ v) := two_half_edges hrad hS hmax hE hγ hvD + obtain ⟨next, ρ, P, W, Q, τ, hsec⟩ := exists_sectors hS H hγ hvH htwo + have hcor := IsSectors.corners hsec + have : Finite (halfEdges H γ v) := (finite_halfEdges H γ v).to_subtype + obtain ⟨k₀⟩ : Nonempty (halfEdges H γ v) := by + by_contra hn + rw [not_nonempty_iff] at hn + have h0 : Nat.card (halfEdges H γ v) = 0 := Nat.card_of_isEmpty + omega + have hinjn : Function.Injective next := IsCorners.inj hcor + have hper := hinjn.mem_periodicPts k₀ + set d := Function.minimalPeriod next k₀ with hd + have hdpos : 0 < d := Function.minimalPeriod_pos_of_mem_periodicPts hper + let o : ℕ → halfEdges H γ v := fun i => next^[i] k₀ + have hosucc : ∀ i, o (i + 1) = next (o i) := fun i => Function.iterate_succ_apply' _ _ _ + have ho0 : o 0 = k₀ := rfl + have hod : o d = k₀ := Function.iterate_minimalPeriod + have hoinj : ∀ {i j}, i < d → j < d → o i = o j → i = j := fun hi hj h' => + Function.iterate_injOn_Iio_minimalPeriod hi hj h' + have hreach : ∀ k, ∃ i < d, o i = k := by + intro k + have h₁ : ∃ n, next^[n] k₀ = k := by + induction IsCorners.reach hcor k₀ k with + | refl => exact ⟨0, rfl⟩ + | tail _ h' ih => + obtain ⟨n, hn⟩ := ih + refine ⟨n + 1, ?_⟩ + rw [Function.iterate_succ_apply', hn] + exact h'.symm + obtain ⟨n, hn⟩ := h₁ + exact ⟨n % d, Nat.mod_lt _ hdpos, Function.iterate_mod_minimalPeriod_eq.trans hn⟩ + have hd2 : 2 ≤ d := by + by_contra hn + have h1 : d = 1 := by omega + have : o 1 = k₀ := h1 ▸ hod + exact IsSectors.next_ne hsec k₀ ((hosucc 0).symm.trans this) + let a : halfEdges H γ v → Set S := fun k => k.1.1 + have hEk : ∀ k, a k ∈ H.E := fun k => k.2.1 + have hvk : ∀ k, v ∈ closure (a k) := fun k => by + have := end_mem_closure hγ k.2.1 k.1.2 + rwa [k.2.2] at this + have hRk : ∀ k, ρ k ∈ H.R := IsCorners.region hcor + have hleft : ∀ k, a (next k) ⊆ closure (ρ k) := IsCorners.left hcor + have hright : ∀ k, a (next k) ⊆ closure (ρ (next k)) := IsCorners.right hcor + have hρinj : ∀ {k k'}, ρ k = ρ k' → k = k' := fun h' => + hX.corner_inj hrad hS hmax hE hγ hv hsec h' + -- Faces and fans are disjoint from later faces and from the closures of the other arms. + have hd_arm : ∀ {n j}, j < d → n < d → (j = 0 ∨ n < j) → Disjoint (fan ρ a o n) (closure (a + (o j))) := by + intro n j hj hn hc + refine disjoint_left.mpr fun x hx hxc => ?_ + rcases mem_fan hx with ⟨i, -, hi⟩ | ⟨i, h₁, hi, hxi⟩ + · exact region_subset (hRk _) hi (H.closure_subset_U (hEk _) hxc) + · have hxV : x ∉ H.V := edge_notMem_V (hEk _) hxi + have hxj : x ∈ a (o j) := H.closure_diff_V (hEk _) ▸ ⟨hxc, hxV⟩ + have heq : a (o i) = a (o j) := H.edge_eq_of_mem (hEk _) (hEk _) hxi hxj + have := hoinj (by omega) hj (hX.half_inj hrad hγ hv heq) + omega + have hd_face : ∀ {n j}, n < j → j < d → Disjoint (fan ρ a o n) (ρ (o j)) := by + intro n j hnj hj + refine disjoint_left.mpr fun x hx hxρ => ?_ + rcases mem_fan hx with ⟨i, hi, hxi⟩ | ⟨i, -, -, hxi⟩ + · have := hoinj (by omega) hj (hρinj (region_eq_of_mem (hRk _) (hRk _) hxi hxρ)) + omega + · exact region_subset (hRk _) hxρ (H.closure_subset_U (hEk _) (subset_closure hxi)) + have hd_rc : ∀ k k', Disjoint (ρ k) (closure (a k')) := fun k k' => + disjoint_left.mpr fun x hx hxc => region_subset (hRk _) hx (H.closure_subset_U (hEk _) hxc) + -- The fans are open discs. + have hfan : ∀ n, n + 2 ≤ d → IsOpenDisc (fan ρ a o n) := by + exact initial_fan_is_open_disc hS (v := v) H γ next ρ d o hosucc hoinj a hEk hRk + (fun k => face_isOpenDisc hrad hS hmax (hRk k)) hleft hright hρinj hd_arm hd_face hd_rc + -- The last step. + obtain ⟨e, hed⟩ : ∃ e, d = e + 2 := ⟨d - 2, by omega⟩ + have hlast : next (o (e + 1)) = o 0 := by + rw [← hosucc, ho0, ← hod, hed] + have hfanE : IsOpenDisc (fan ρ a o e) := hfan e (by omega) + have hF₁ : IsOpenDisc (ρ (o (e + 1))) := face_isOpenDisc hrad hS hmax (hRk _) + obtain ⟨w₀, hw₀v, hw₀V₀, hw₀N, hcap₀, hN₀, hD₀, hK₀⟩ := hX.arm hrad (hEk (o 0)) hv (hvk _) + obtain ⟨w₁, hw₁v, hw₁V₀, hw₁N, hcap₁, hN₁, hD₁, hK₁⟩ := hX.arm hrad (hEk (o (e + 1))) hv (hvk _) + have hw₀₁ : w₀ ≠ w₁ := by + have halt := corner_alternates hrad hS hmax hE hγ hvD hsec (o (e + 1)) + rw [hlast] at halt + rcases halt with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact fun h' => hK₁ h₁ (h' ▸ hD₀ h₂) + · exact fun h' => hK₀ h₂ (h'.symm ▸ hD₁ h₁) + have hne0 : a (o 0) ≠ a (o (e + 1)) := fun h' => by + have := hoinj (by omega) (by omega) (hX.half_inj hrad hγ hv h') + omega + have hl₀ : IsLineWithEnds (closure (a (o 0))) v w₀ := isLine_closure (hEk _) hw₀v.symm hcap₀ + have hl₁ : IsLineWithEnds (closure (a (o (e + 1)))) v w₁ := isLine_closure (hEk _) hw₁v.symm hcap₁ + have hcap : closure (a (o 0)) ∩ closure (a (o (e + 1))) = {v} := by + exact fan_end_arms_have_single_intersection (hEk _) (hEk _) hne0 hw₀₁ (hvk _) (hvk _) + hcap₀ hcap₁ + have hline := IsLineWithEnds.union hl₀ hl₁ hcap + set c := closure (a (o 0)) ∪ closure (a (o (e + 1))) with hc + -- A point of the line is `v`, one of the two other ends, or on one of the two arms. + have hmemc : ∀ {z}, z ∈ c → z = v ∨ z = w₀ ∨ z = w₁ ∨ z ∈ a (o 0) ∨ z ∈ a (o (e + 1)) := by + exact joining_line_membership (hEk _) (hEk _) hcap₀ hcap₁ + have hw₀H : w₀ ∈ H.V := hX.N_V_sub hrad hw₀N + have hw₁H : w₁ ∈ H.V := hX.N_V_sub hrad hw₁N + have hglue : N.U ∩ (lineDrawing hline hw₀₁).U ⊆ N.V ∩ (lineDrawing hline hw₀₁).V := by + exact joining_line_meets_split_only_at_endpoints (hX.V₀_off hv) hw₀N hw₁N + (hX.edge_off hrad (hEk _) hN₀) (hX.edge_off hrad (hEk _) hN₁) hw₀₁ hline hmemc + let H' := N.glue (lineDrawing hline hw₀₁) hglue + have hH'U : H'.U = N.U ∪ c := rfl + have heH' : c \ {w₀, w₁} ∈ H'.E := by + rw [Drawing.glue_E, lineDrawing_E] + exact Or.inr rfl + have hstar : ∀ {z}, z ∈ fan ρ a o e → z ∈ star H v := by + intro z hz + rcases mem_fan hz with ⟨i, -, h'⟩ | ⟨i, -, -, h'⟩ + · exact face_subset_star (hRk _) (IsCorners.closure_v hcor _) h' + · exact edge_subset_star (hEk _) (hvk _) h' + have hstarF : ρ (o (e + 1)) ⊆ star H v := + face_subset_star (hRk _) (IsCorners.closure_v hcor _) + have hdc : Disjoint (fan ρ a o e) c := by + rw [hc, disjoint_union_right] + exact ⟨hd_arm (by omega) (by omega) (Or.inl rfl), hd_arm (by omega) (by omega) (Or.inr + (by omega))⟩ + have hdcF : Disjoint (ρ (o (e + 1))) c := by + rw [hc, disjoint_union_right] + exact ⟨hd_rc _ _, hd_rc _ _⟩ + have hstar_eq : star H v = fan ρ a o e ∪ ρ (o (e + 1)) ∪ (c \ {w₀, w₁}) := by + exact star_eq_completed_fan (S := S) (v := v) H γ hγ hvH next ρ hcor d o hreach a + (fun _ => rfl) hEk hvk e hed w₀ hw₀v w₁ hw₁v c hc hmemc hw₀H hw₁H hstar hstarF + let Rest : Set S := ⋃ u ∈ V₀ \ {v}, star H u + have hRest : IsOpen Rest := + isOpen_biUnion fun u hu => hX.star_isOpen hrad hS hmax hE hu.1 + have hRestv : Disjoint Rest (star H v) := by + refine disjoint_left.mpr fun x hx hx' => ?_ + obtain ⟨u, hu, hxu⟩ := mem_iUnion₂.mp hx + exact hu.2 (hX.star_eq hrad hS hmax hE hu.1 hv hxu hx') + have hRestc : Disjoint Rest c := by + refine disjoint_left.mpr fun x hx hxc => ?_ + obtain ⟨u, hu, hxu⟩ := mem_iUnion₂.mp hx + have hnN : x ∉ N.U := disjoint_left.mp (hX.star_off hrad hu.1) hxu + rcases hmemc hxc with rfl | rfl | rfl | h' | h' + · exact disjoint_left.mp hRestv hx (mem_star_self _ _) + · exact hnN (N.V_subset_U hw₀N) + · exact hnN (N.V_subset_U hw₁N) + · exact disjoint_left.mp hRestv hx (edge_subset_star (hEk _) (hvk _) h') + · exact disjoint_left.mp hRestv hx (edge_subset_star (hEk _) (hvk _) h') + -- The complement of the new drawing. + have hcompl : fan ρ a o e ∪ ρ (o (e + 1)) ∪ Rest = H'.Uᶜ := by + exact completed_fan_complements_augmented_drawing (S := S) (D := D) (K := K) (N := N) (V₀ := + V₀) hX hrad hS hmax hE (v := v) hv H hH γ ρ o a e w₀ w₁ c H' hH'U hstar hstarF hdc hdcF + hstar_eq Rest rfl hRestc + have hdFF : Disjoint (fan ρ a o e) (ρ (o (e + 1))) := hd_face (by omega) (by omega) + have hdR₁ : Disjoint (fan ρ a o e) Rest := by + refine disjoint_left.mpr fun x hx hx' => disjoint_left.mp hRestv hx' (hstar hx) + have hdR₂ : Disjoint (ρ (o (e + 1))) Rest := by + refine disjoint_left.mpr fun x hx hx' => disjoint_left.mp hRestv hx' (hstarF hx) + have hneF : (fan ρ a o e).Nonempty := by + obtain ⟨x, hx⟩ := region_nonempty (hRk (o 0)) + exact ⟨x, face_subset_fan (Nat.zero_le _) hx⟩ + have hR₁ : fan ρ a o e ∈ H'.R := by + refine mem_R_of_split (C' := ρ (o (e + 1)) ∪ Rest) hfanE.1 (hF₁.1.union hRest) hneF + (isPreconnected_of_isOpenDisc hfanE) (disjoint_union_right.mpr ⟨hdFF, hdR₁⟩) ?_ + rw [← hcompl, union_assoc] + have hR₂ : ρ (o (e + 1)) ∈ H'.R := by + refine mem_R_of_split (C' := fan ρ a o e ∪ Rest) hF₁.1 (hfanE.1.union hRest) + (region_nonempty (hRk _)) (isPreconnected_of_isOpenDisc hF₁) + (disjoint_union_right.mpr ⟨hdFF.symm, hdR₂⟩) ?_ + rw [← hcompl, union_right_comm, union_comm (ρ _)] + have hclc : closure (c \ {w₀, w₁}) = c := closure_sdiff_pair hline + have hsub_c : ∀ {T : Set S}, IsClosed T → a (o 0) ⊆ T → a (o (e + 1)) ⊆ T → v ∈ T → + c \ {w₀, w₁} ⊆ T := by + intro T hT h₁ h₂ hvT z hz + rcases hmemc hz.1 with rfl | rfl | rfl | h' | h' + · exact hvT + · exact absurd (Or.inl rfl) hz.2 + · exact absurd (Or.inr rfl) hz.2 + · exact h₁ h' + · exact h₂ h' + have hh₁ : c \ {w₀, w₁} ⊆ closure (fan ρ a o e) := by + refine hsub_c isClosed_closure ?_ ?_ ?_ + · have := hright (o (e + 1)) + rw [hlast] at this + exact this.trans (closure_mono (face_subset_fan (Nat.zero_le _))) + · have := hleft (o e) + rw [← hosucc] at this + exact this.trans (closure_mono (face_subset_fan le_rfl)) + · exact closure_mono (face_subset_fan (Nat.zero_le _)) (IsCorners.closure_v hcor _) + have hh₂ : c \ {w₀, w₁} ⊆ closure (ρ (o (e + 1))) := by + refine hsub_c isClosed_closure ?_ ?_ (IsCorners.closure_v hcor _) + · have := hleft (o (e + 1)) + rwa [hlast] at this + · have := hright (o e) + rwa [← hosucc] at this + rw [hstar_eq] + refine glue_open_discs hS heH' hR₁ hR₂ (fun h' => ?_) hh₁ hh₂ Subset.rfl Subset.rfl hfanE hF₁ hdFF + (by rw [hclc]; exact hdc) (by rw [hclc]; exact hdcF) + obtain ⟨x, hx⟩ := hneF + exact disjoint_left.mp hdFF hx (h' ▸ hx) + +/-- The stars are the regions of `N`: they are open, connected and disjoint, and they fill the +complement of `U(N)`. -/ +theorem star_mem_R {v : S} (hv : v ∈ V₀) : star (radialUnion hrad) v ∈ N.R := by + set H := radialUnion hrad with hH + have hd := hX.star_isOpenDisc hrad hS hmax hE hv + refine mem_R_of_split (C' := ⋃ u ∈ V₀ \ {v}, star H u) hd.1 + (isOpen_biUnion fun u hu => hX.star_isOpen hrad hS hmax hE hu.1) ⟨v, mem_star_self _ _⟩ + (isPreconnected_of_isOpenDisc hd) ?_ ?_ + · refine disjoint_left.mpr fun x hx hx' => ?_ + obtain ⟨u, hu, hxu⟩ := mem_iUnion₂.mp hx' + exact hu.2 (hX.star_eq hrad hS hmax hE hu.1 hv hxu hx) + · apply subset_antisymm + · rintro x (hx | hx) hxU + · exact disjoint_left.mp (hX.star_off hrad hv) hx hxU + · obtain ⟨u, hu, hxu⟩ := mem_iUnion₂.mp hx + exact disjoint_left.mp (hX.star_off hrad hu.1) hxu hxU + · intro x hx + obtain ⟨u, hu, hxu⟩ := hX.exists_star hrad hS hmax hE hx + by_cases huv : u = v + · exact Or.inl (huv ▸ hxu) + · exact Or.inr (mem_biUnion (show u ∈ V₀ \ {v} from ⟨hu, huv⟩) hxu) + +theorem exists_star_eq {r : Set S} (hr : r ∈ N.R) : ∃ v ∈ V₀, r = star (radialUnion hrad) v := by + obtain ⟨x, hx⟩ := region_nonempty hr + obtain ⟨v, hv, hxv⟩ := hX.exists_star hrad hS hmax hE (region_subset hr hx) + exact ⟨v, hv, region_eq_of_mem hr (hX.star_mem_R hrad hS hmax hE hv) hx hxv⟩ + +/-- A closed disc in a star and one more point `u` off `D`, with its boundary on `H`, does not +exist. +Its interior has a point off `H`, in a region of `H` at `v`. This region lies in the disc, since it +misses the boundary. So the disc holds the end off `V₀` of the edge of `D` beside this region. But +this +end is not in the star, since it is on `N`, and it is not `u`. -/ +theorem no_disc_in_star {v u : S} (hv : v ∈ V₀) {Δ : Set S} (hΔ : IsClosedDisc Δ) + (hsub : Δ ⊆ star (radialUnion hrad) v ∪ {u}) (hu : u ∉ D.V) (huU : u ∈ (radialUnion hrad).U) + (hb : discBd Δ ⊆ (radialUnion hrad).U) : False := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hne : (discInt Δ).Nonempty := by + obtain ⟨h, g, c'⟩ := hΔ.exists_isChart + rw [c'.discInt_eq] + exact ⟨g 0, mem_image_of_mem _ (Metric.mem_ball_self one_pos)⟩ + obtain ⟨y, hyO, hyU⟩ := exists_notMem_U (Γ := radialUnion hrad) hS (hΔ.isOpen_discInt hman) hne + have hyΔ : y ∈ Δ := hyO.1 + have hys : y ∈ star (radialUnion hrad) v := by + rcases hsub hyΔ with h' | h' + · exact h' + · exact absurd (h' ▸ huU) hyU + obtain ⟨p, hp, hvp, hyp⟩ : ∃ p ∈ (radialUnion hrad).R, v ∈ closure p ∧ y ∈ p := by + rcases mem_star hys with rfl | ⟨g, hg, -, hyg⟩ | h' + · exact absurd ((radialUnion hrad).V_subset_U (hX.V_sub hrad hv)) hyU + · exact absurd ((radialUnion hrad).closure_subset_U hg (subset_closure hyg)) hyU + · exact h' + have hpΔ : p ⊆ Δ := by + intro z hz + by_contra hzΔ + have hdis := disjoint_disc_of_outside hman hΔ (region_isPreconnected hp) + (disjoint_left.mpr fun w hw hw' => region_subset hp hw (hb hw')) hz hzΔ + exact disjoint_left.mp hdis hyp hyΔ + obtain ⟨j, hj, hjp, -, -⟩ := face_edge hrad hS hmax hE hp + obtain ⟨u', -, w, hw, hcap⟩ := hX.D_ends j hj + have hwj : w ∈ closure j ∩ D.V := by rw [hcap]; simp + have hwΔ : w ∈ Δ := closure_minimal (hjp.trans (closure_minimal hpΔ hΔ.isClosed)) hΔ.isClosed + hwj.1 + rcases hsub hwΔ with h' | h' + · exact disjoint_left.mp (hX.star_off hrad hv) h' + (N.V_subset_U (hX.V_eq ▸ ⟨radial_V hrad hw.1, hw.2⟩)) + · exact hu (h' ▸ hw.1) + +end IsSideSplit + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/SurfaceDualSplit.lean b/LeanPool/GraphMinor/GM12/SurfaceDualSplit.lean new file mode 100644 index 0000000000..1095bcefb7 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/SurfaceDualSplit.lean @@ -0,0 +1,592 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.SurfaceDualDraw +public import LeanPool.GraphMinor.GM12.SurfaceDualCount + +/-! +# The dual lines extend a radial drawing + +Let `D` be `Γ` with a new vertex on each edge, as in `IsDualLines`, and let `N` be the drawing of +the +lines through the faces. Then `K ∪ N` is a radial drawing of `D` (`preRad_glue`, `radMax_glue`). +This +is the main step. It means that everything GM11 proves about a drawing and a radial drawing of it +applies +to `D` and `K ∪ N`. Conditions (i)-(iii) are direct. Condition (iv) needs an argument only for the +two +lines at `m e` when they end at the same hub (`no_bigon_lines`). Maximality is by count. +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] {Γ K D : Drawing S} + {hrad : PreRad (PaintingOrDrawing.drawing Γ) K} {A B : Set S → Set S} {m x y : Set S → S} + {f : Set S × Bool → Set S} {h : Set S × Bool → S} {ℓ : Set S × Bool → I → S} + +omit [TopologicalSpace S] [T2Space S] [ConnectedSpace S] in +theorem exists_mid : ∃ t : I, t ≠ 0 ∧ t ≠ 1 := by + refine ⟨⟨1 / 2, by norm_num, by norm_num⟩, fun h' => ?_, fun h' => ?_⟩ + · have := congrArg Subtype.val h' + norm_num at this + · have := congrArg Subtype.val h' + norm_num at this + +omit [T2Space S] [ConnectedSpace S] in +/-- An `O`-arc through `a` is the range of a loop at `a` that is injective off its ends. -/ +theorem exists_oArc_loop {F : Set S} (hF : IsOArc F) {a₀ : S} (ha : a₀ ∈ F) : + ∃ a : I → S, Continuous a ∧ InjOn a (Ioo 0 1) ∧ a 0 = a₀ ∧ a 1 = a₀ ∧ range a = F ∧ + ∀ t, t ≠ 0 → t ≠ 1 → a t ≠ a₀ := by + obtain ⟨p, hp, h0, h2, hper, himg, hr⟩ := exists_oArc_par hF ha + have hpos : (0 : ℝ) < 2 * Real.pi := Real.two_pi_pos + have hint : ∀ n : ℤ, (-1 : ℝ) < n → (n : ℝ) < 1 → n = 0 := by + intro n h₁ h₂ + have h₃ : -1 < n := by exact_mod_cast h₁ + have h₄ : n < 1 := by exact_mod_cast h₂ + omega + have hIoo : ∀ {t : I}, t ≠ 0 → t ≠ 1 → (0 : ℝ) < t ∧ (t : ℝ) < 1 := by + intro t h₁ h₂ + refine ⟨lt_of_le_of_ne t.2.1 fun h' => h₁ (Subtype.ext h'.symm), lt_of_le_of_ne t.2.2 fun h' => + h₂ (Subtype.ext h')⟩ + refine ⟨fun t => p (2 * Real.pi * t), by fun_prop, ?_, by simpa using h0, by simpa using h2, + ?_, ?_⟩ + · intro s hs t ht hst + obtain ⟨n, hn⟩ := hper _ _ hst + have hs' := hIoo hs.1.ne' hs.2.ne + have ht' := hIoo ht.1.ne' ht.2.ne + have hsub : (s : ℝ) - t = n := by + have : 2 * Real.pi * ((s : ℝ) - t - n) = 0 := by linarith + have := (mul_eq_zero.mp this).resolve_left hpos.ne' + linarith + have : n = 0 := hint n (by linarith) (by linarith) + subst this + refine Subtype.ext ?_ + simpa [sub_eq_zero] using hsub + · apply subset_antisymm + · rintro _ ⟨t, rfl⟩ + exact hr ⟨_, rfl⟩ + · rw [← himg] + rintro _ ⟨u, hu, rfl⟩ + have h₁ : 0 ≤ u / (2 * Real.pi) := div_nonneg hu.1 hpos.le + have h₂ : u / (2 * Real.pi) ≤ 1 := (div_le_one hpos).mpr hu.2.le + refine ⟨⟨_, h₁, h₂⟩, ?_⟩ + change p (2 * Real.pi * (u / (2 * Real.pi))) = p u + rw [mul_div_cancel₀ _ hpos.ne'] + · intro t h₁ h₂ h' + have h'' : p (2 * Real.pi * t) = p 0 := by + rw [h0] + exact h' + obtain ⟨n, hn⟩ := hper _ _ h'' + have ht' := hIoo h₁ h₂ + have hsub : (t : ℝ) = n := by + have : 2 * Real.pi * ((t : ℝ) - n) = 0 := by linarith + have := (mul_eq_zero.mp this).resolve_left hpos.ne' + linarith + have : n = 0 := hint n (by linarith) (by linarith) + subst this + exact h₁ (Subtype.ext (by simpa using hsub)) + +namespace IsDualLines + +variable (hL : IsDualLines hrad D A B m x y f h ℓ) + +include hL + +/-- The region of `K` around `e` is made of the two faces at `e` and `e` itself. -/ +theorem exists_region (hS : IsClosedSurface S) (hmax : RadMax (PaintingOrDrawing.drawing Γ) K) + (hE : Γ.E.Nonempty) {e : Set S} (he : e ∈ Γ.E) : + ∃ s ∈ K.R, e ⊆ s ∧ s = f (e, true) ∪ f (e, false) ∪ e := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨z, hz⟩ := he.1 + have hdis : Disjoint e K.U := edge_disjoint hrad he + obtain ⟨s, hs, hzs⟩ := exists_region_of_notMem (disjoint_left.mp hdis hz) + have hes : e ⊆ s := + subset_region hs he.2.2.1.isConnected.isPreconnected hdis hz hzs + obtain ⟨p, hp, q, hq, hpq, hep, heq, hs'⟩ := region_eq_two_faces hrad hS hmax hE hs he hes + refine ⟨s, hs, hes, ?_⟩ + obtain ⟨b, rfl⟩ := hL.face_all e he p hp hep + obtain ⟨b', rfl⟩ := hL.face_all e he q hq heq + have hbb : b ≠ b' := fun h' => hpq (h' ▸ rfl) + rw [hs'] + cases b <;> cases b' + · exact absurd rfl hbb + · rw [union_comm (f (e, false)) (f (e, true))] + · rfl + · exact absurd rfl hbb + +/-- The two lines at `m e` cut the region `s` of `K` around `e` into two open discs, by +`exists_crosscut_sides`. Each part meets `e`: a part that misses `e` lies in one of the two faces at +`e`, but the lines are in its closure, and they enter the other face. -/ +theorem exists_cut_region (hS : IsClosedSurface S) (hmax : RadMax (PaintingOrDrawing.drawing Γ) K) + (hE : Γ.E.Nonempty) {e : Set S} (he : e ∈ Γ.E) : + ∃ s ∈ K.R, ∃ T₁ T₂ : Set S, e ⊆ s ∧ s = f (e, true) ∪ f (e, false) ∪ e ∧ IsOpenDisc T₁ ∧ + IsOpenDisc T₂ ∧ Disjoint T₁ T₂ ∧ + s \ (range (ℓ (e, true)) ∪ range (ℓ (e, false))) = T₁ ∪ T₂ ∧ (T₁ ∩ e).Nonempty ∧ + (T₂ ∩ e).Nonempty := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨s, hs, hes, hs'⟩ := hL.exists_region hS hmax hE he + have hsd : IsOpenDisc s := radial_region_isOpenDisc hrad hS hmax hs + have hT := hL.isLine he true + have hF := hL.isLine he false + have hne : ((e, true) : Set S × Bool) ≠ (e, false) := by simp + set C := range (ℓ (e, true)) ∪ range (ℓ (e, false)) with hC + have hhs : ∀ b, h (e, b) ∉ s := fun b h' => region_subset hs h' (hL.hub_K he b) + have hCs : ∀ z ∈ C, z ≠ h (e, true) → z ≠ h (e, false) → z ∈ s := by + intro z hz hz₁ hz₂ + rw [hs'] + rcases hz with hz | hz + · rcases hL.mem_line he true hz with h₁ | h₁ | h₁ + · exact Or.inl (Or.inl h₁) + · exact Or.inr (h₁ ▸ hL.m_mem he) + · exact absurd h₁ hz₁ + · rcases hL.mem_line he false hz with h₁ | h₁ | h₁ + · exact Or.inl (Or.inr h₁) + · exact Or.inr (h₁ ▸ hL.m_mem he) + · exact absurd h₁ hz₂ + -- A parametrization of the two lines, with its ends off `s`. + obtain ⟨a, hac, hai, ha0, ha1, har, hin⟩ : ∃ a : I → S, Continuous a ∧ InjOn a (Ioo 0 1) + ∧ a 0 ∉ s ∧ + a 1 ∉ s ∧ range a = C ∧ ∀ t, t ≠ 0 → t ≠ 1 → a t ∈ s := by + by_cases hh : h (e, true) = h (e, false) + · have hO : IsOArc C := by + rw [hh] at hT + refine isOArc_union hT hF fun z hz => ?_ + rcases hL.line_meet he he hne hz.1 hz.2 with h₁ | h₁ + · exact Or.inl h₁ + · exact Or.inr (hh ▸ h₁) + obtain ⟨a, hac, hai, ha0, ha1, har, hane⟩ := exists_oArc_loop hO (a₀ := h (e, false)) + (Or.inr (line_right_mem hF)) + refine ⟨a, hac, hai, ha0 ▸ hhs false, ha1 ▸ hhs false, har, fun t h₁ h₂ => ?_⟩ + exact hCs _ (har ▸ ⟨t, rfl⟩) (hh ▸ hane t h₁ h₂) (hane t h₁ h₂) + · have hcap : range (ℓ (e, true)) ∩ range (ℓ (e, false)) = {m e} := by + apply subset_antisymm + · rintro z ⟨h₁, h₂⟩ + rcases hL.line_meet he he hne h₁ h₂ with h₃ | h₃ + · exact h₃ + · exfalso + rcases hL.mem_line he false h₂ with h₄ | h₄ | h₄ + · exact (hL.face_off he false h₄).2 (h₃ ▸ hL.hub_K he true) + · exact hL.hub_ne_m he he true (h₃.symm.trans h₄) + · exact hh (h₃.symm.trans h₄) + · rintro z rfl + exact ⟨line_left_mem hT, line_left_mem hF⟩ + obtain ⟨φ, h₀, h₁⟩ := IsLineWithEnds.union hT hF hcap + have hinj : Function.Injective fun t : I => (φ t).1 := + fun t t' h' => φ.injective (Subtype.ext h') + refine ⟨fun t => (φ t).1, by fun_prop, hinj.injOn, by + change (φ 0).1 ∉ s + rw [h₀] + exact hhs true, by + change (φ 1).1 ∉ s + rw [h₁] + exact hhs false, ?_, fun t h₂ h₃ => ?_⟩ + · ext z + constructor + · rintro ⟨t, rfl⟩ + exact (φ t).2 + · intro hz + obtain ⟨t, ht⟩ := φ.surjective ⟨z, hz⟩ + exact ⟨t, congrArg Subtype.val ht⟩ + · refine hCs _ (φ t).2 ?_ ?_ + · exact fun h' => h₂ (hinj (h'.trans h₀.symm)) + · exact fun h' => h₃ (hinj (h'.trans h₁.symm)) + obtain ⟨T₁, T₂, hT₁, hT₂, hT₁₂, hcov, hcl₁, hcl₂⟩ := exists_crosscut_sides hS hsd hac hai ha0 ha1 + hin + rw [har] at hcov hcl₁ hcl₂ + have hfaces : ∀ b, IsOpen (f (e, b)) := fun b => region_isOpen (hL.face e he b).1 + have hfdis : Disjoint (f (e, true)) (f (e, false)) := disjoint_left.mpr fun z h₁ h₂ => + hL.face_ne e he (region_eq_of_mem (hL.face e he true).1 (hL.face e he false).1 h₁ h₂) + obtain ⟨t₀, ht₀, ht₁⟩ := exists_mid + have hmeet : ∀ T : Set S, IsOpenDisc T → T ⊆ s \ C → C ⊆ closure T → (T ∩ e).Nonempty := by + intro T hT' hTs hCT + by_contra hno + have hTf : T ⊆ f (e, true) ∪ f (e, false) := by + intro z hz + have hzs := (hTs hz).1 + rw [hs'] at hzs + rcases hzs with h₁ | h₁ + · exact h₁ + · exact absurd ⟨z, hz, h₁⟩ hno + have hTc : IsPreconnected T := isPreconnected_of_isOpenDisc hT' + have hTne : T.Nonempty := by + by_contra hn + have hn' : T = ∅ := not_nonempty_iff_eq_empty.mp hn + have := hCT (Or.inl (line_right_mem hT)) + rw [hn'] at this + simp at this + obtain ⟨z, hz⟩ := hTne + rcases hTf hz with h₁ | h₁ + · have hsubT : T ⊆ f (e, true) := hTc.subset_left_of_subset_union (hfaces true) (hfaces false) + hfdis hTf ⟨z, hz, h₁⟩ + have hp := hL.inside e he false t₀ ht₀ ht₁ + obtain ⟨w, hw₁, hw₂⟩ := mem_closure_iff.mp (hCT (Or.inr ⟨t₀, rfl⟩)) _ (hfaces false) hp + exact disjoint_left.mp hfdis (hsubT hw₂) hw₁ + · have hsubT : T ⊆ f (e, false) := hTc.subset_right_of_subset_union (hfaces true) (hfaces false) + hfdis hTf ⟨z, hz, h₁⟩ + have hp := hL.inside e he true t₀ ht₀ ht₁ + obtain ⟨w, hw₁, hw₂⟩ := mem_closure_iff.mp (hCT (Or.inl ⟨t₀, rfl⟩)) _ (hfaces true) hp + exact disjoint_left.mp hfdis hw₁ (hsubT hw₂) + exact ⟨s, hs, T₁, T₂, hes, hs', hT₁, hT₂, hT₁₂, hcov, hmeet T₁ hT₁ (hcov ▸ subset_union_left) + hcl₁, + hmeet T₂ hT₂ (hcov ▸ subset_union_right) hcl₂⟩ + +/-- **The two lines at `m e` do not bound a disc that misses the rest of `e`.** Let `C` be the union +of +the two lines, when they end at the same hub. Each part of `exists_cut_region` has a point of `e` +outside `Δ`, and it misses `C`, so it misses `Δ`. Then all of `s \ C` misses `Δ`. But a point of `C` +in +the open set `s` is in the closure of the interior of `Δ`, which misses `C`. -/ +theorem no_bigon_lines (hS : IsClosedSurface S) (hmax : RadMax (PaintingOrDrawing.drawing Γ) K) + (hE : Γ.E.Nonempty) {e : Set S} (he : e ∈ Γ.E) {Δ r : Set S} + (hr : r ∈ Γ.R) (hΔ : IsClosedDisc Δ) (hsub : Δ ⊆ r ∪ {m e}) + (hb : discBd Δ = range (ℓ (e, true)) ∪ range (ℓ (e, false))) : False := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + obtain ⟨s, hs, T₁, T₂, -, hs', hT₁, hT₂, -, hcov, hm₁, hm₂⟩ := hL.exists_cut_region hS hmax hE he + have hsd : IsOpenDisc s := radial_region_isOpenDisc hrad hS hmax hs + have hmC : m e ∈ range (ℓ (e, true)) ∪ range (ℓ (e, false)) := + Or.inl (line_left_mem (hL.isLine he true)) + obtain ⟨t₀, ht₀, ht₁⟩ := exists_mid + have hmiss : ∀ T : Set S, IsOpenDisc T → T ⊆ s \ (range (ℓ (e, true)) ∪ range (ℓ (e, false))) → + (T ∩ e).Nonempty → Disjoint T Δ := by + rintro T hT' hTs ⟨u, huT, hue⟩ + refine disjoint_disc_of_outside hman hΔ (isPreconnected_of_isOpenDisc hT') ?_ huT fun hu => ?_ + · rw [hb] + exact disjoint_left.mpr fun z hz h' => (hTs hz).2 h' + · rcases hsub hu with h₁ | h₁ + · exact region_subset hr h₁ (Γ.closure_subset_U he (subset_closure hue)) + · exact (hTs huT).2 (h₁ ▸ hmC) + have hd₁ := hmiss T₁ hT₁ (hcov ▸ subset_union_left) hm₁ + have hd₂ := hmiss T₂ hT₂ (hcov ▸ subset_union_right) hm₂ + have hpt : ℓ (e, true) t₀ ∈ s := by + rw [hs'] + exact Or.inl (Or.inl (hL.inside e he true t₀ ht₀ ht₁)) + have hpΔ : ℓ (e, true) t₀ ∈ Δ := by + refine GraphMinor.Surface.discBd_subset Δ ?_ + rw [hb] + exact Or.inl ⟨t₀, rfl⟩ + obtain ⟨w, hw₁, hw₂⟩ := mem_closure_iff.mp (hΔ.subset_closure_discInt hpΔ) s hsd.1 hpt + have hw : w ∈ s \ (range (ℓ (e, true)) ∪ range (ℓ (e, false))) := ⟨hw₁, fun h' => hw₂.2 (hb ▸ h')⟩ + rw [hcov] at hw + rcases hw with h₁ | h₁ + · exact disjoint_left.mp hd₁ h₁ hw₂.1 + · exact disjoint_left.mp hd₂ h₁ hw₂.1 + +variable {N : Drawing S} + (hNU : N.U = ((K.V \ Γ.V) ∪ m '' Γ.E) ∪ ⋃ i ∈ Γ.E ×ˢ (univ : Set Bool), range (ℓ i)) + (hNV : N.V = (K.V \ Γ.V) ∪ m '' Γ.E) + (hNE : N.E = (fun i => range (ℓ i) \ {m i.1, h i}) '' (Γ.E ×ˢ (univ : Set Bool))) + +include hNU in +omit [T2Space S] [ConnectedSpace S] in +/-- A point of `N` is a hub, a point `m e`, or a point of a face. -/ +theorem mem_N {z : S} (hz : z ∈ N.U) : + (z ∈ K.V ∧ z ∉ Γ.V) ∨ (∃ e ∈ Γ.E, z = m e) ∨ ∃ e ∈ Γ.E, ∃ b, z ∈ f (e, b) := by + rw [hNU] at hz + rcases hz with (hz | ⟨e, he, rfl⟩) | hz + · exact Or.inl hz + · exact Or.inr (Or.inl ⟨e, he, rfl⟩) + · obtain ⟨⟨e, b⟩, ⟨he, -⟩, hzl⟩ := mem_iUnion₂.mp hz + rcases hL.mem_line he b hzl with h₁ | h₁ | h₁ + · exact Or.inr (Or.inr ⟨e, he, b, h₁⟩) + · exact Or.inr (Or.inl ⟨e, he, h₁⟩) + · exact Or.inl ⟨h₁ ▸ hL.hub_V he b, fun h' => hL.hub_off he b (h₁ ▸ Γ.V_subset_U h')⟩ + +include hNU hNV in +omit [T2Space S] [ConnectedSpace S] in +theorem glue_compat : K.U ∩ N.U ⊆ K.V ∩ N.V := by + rintro z ⟨h₁, h₂⟩ + rcases hL.mem_N hNU h₂ with hz | ⟨e, he, rfl⟩ | ⟨e, he, b, hz⟩ + · exact ⟨hz.1, hNV ▸ Or.inl hz⟩ + · exact absurd h₁ (hL.m_K he) + · exact absurd h₁ (hL.face_off he b hz).2 + +omit [T2Space S] [ConnectedSpace S] in +theorem R_eq : D.R = Γ.R := by + simp only [Drawing.R, hL.U_eq] + +include hNE in +omit [ConnectedSpace S] in +/-- The closure of an edge of `N` is a line. -/ +theorem N_edge {g : Set S} (hg : g ∈ N.E) : + ∃ e ∈ Γ.E, ∃ b, g = range (ℓ (e, b)) \ {m e, h (e, b)} ∧ closure g = range (ℓ (e, b)) := by + rw [hNE] at hg + obtain ⟨⟨e, b⟩, ⟨he, -⟩, rfl⟩ := hg + exact ⟨e, he, b, rfl, closure_sdiff_pair (hL.isLine he b)⟩ + +variable (hKN : K.U ∩ N.U ⊆ K.V ∩ N.V) + +include hNU hNV in +omit [T2Space S] [ConnectedSpace S] hL hNU hNV in +theorem cap_spoke {g : Set S} (hg : g ∈ K.E) : + closure g ∩ (K.glue N hKN).V = closure g ∩ K.V := by + ext z + refine ⟨fun hz => ⟨hz.1, ?_⟩, fun hz => ⟨hz.1, Or.inl hz.2⟩⟩ + rcases hz.2 with h₁ | h₁ + · exact h₁ + · exact (hKN ⟨K.closure_subset_U hg hz.1, N.V_subset_U h₁⟩).1 + +include hNU hNV in +omit hNU in +omit [ConnectedSpace S] in +theorem cap_line {e : Set S} (he : e ∈ Γ.E) (b : Bool) : + range (ℓ (e, b)) ∩ (K.glue N hKN).V = {m e, h (e, b)} := by + apply subset_antisymm + · rintro z ⟨hz, hzV⟩ + rcases hL.mem_line he b hz with h₁ | h₁ | h₁ + · exfalso + rcases hzV with hzV | hzV + · exact (hL.face_off he b h₁).2 (K.V_subset_U hzV) + · rw [hNV] at hzV + rcases hzV with hzV | ⟨e', he', rfl⟩ + · exact (hL.face_off he b h₁).2 (K.V_subset_U hzV.1) + · exact (hL.face_off he b h₁).1 (hL.m_U he') + · exact Or.inl h₁ + · exact Or.inr h₁ + · rintro z (rfl | rfl) + · exact ⟨line_left_mem (hL.isLine he b), Or.inr (hNV ▸ Or.inr ⟨e, he, rfl⟩)⟩ + · exact ⟨line_right_mem (hL.isLine he b), Or.inl (hL.hub_V he b)⟩ + +omit [T2Space S] [ConnectedSpace S] in +theorem hub_notMem_D {e : Set S} (he : e ∈ Γ.E) (b : Bool) : h (e, b) ∉ D.V := by + intro h' + rw [hL.V_eq] at h' + rcases h' with h' | ⟨e', he', h'⟩ + · exact hL.hub_off he b (Γ.V_subset_U h') + · exact hL.hub_ne_m he he' b h'.symm + +omit [T2Space S] [ConnectedSpace S] in +theorem m_mem_D {e : Set S} (he : e ∈ Γ.E) : m e ∈ D.V := hL.V_eq ▸ Or.inr ⟨e, he, rfl⟩ + +include hNU hNV hNE in +/-- Conditions (i)-(iv) for `D` and `K ∪ N`. -/ +theorem preRad_glue (hS : IsClosedSurface S) (hmax : RadMax (PaintingOrDrawing.drawing Γ) K) + (hE : Γ.E.Nonempty) : PreRad (PaintingOrDrawing.drawing D) (K.glue N hKN) := by + have hR := hL.R_eq + have hRm : ∀ {r}, r ∈ D.R → r ∈ Γ.R := fun h' => hR ▸ h' + have hRm' : ∀ {r}, r ∈ Γ.R → r ∈ D.R := fun h' => hR.symm ▸ h' + have hVm : ∀ {z}, z ∈ Γ.V → z ∈ D.V := fun h' => hL.V_eq.symm ▸ Or.inl h' + refine ⟨⟨inferInstance, fun r hr => hrad.1.2 r (hRm hr)⟩, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · change D.U ∩ (K.U ∪ N.U) = D.V + rw [hL.U_eq, hL.V_eq] + apply subset_antisymm + · rintro z ⟨hz, hz' | hz'⟩ + · exact Or.inl (radial_inter hrad ▸ ⟨hz, hz'⟩) + · rcases hL.mem_N hNU hz' with h₁ | ⟨e, he, rfl⟩ | ⟨e, he, b, h₁⟩ + · exact Or.inl (radial_inter hrad ▸ ⟨hz, K.V_subset_U h₁.1⟩) + · exact Or.inr ⟨e, he, rfl⟩ + · exact absurd hz (hL.face_off he b h₁).1 + · rintro z (hz | ⟨e, he, rfl⟩) + · exact ⟨Γ.V_subset_U hz, Or.inl (K.V_subset_U (radial_V hrad hz))⟩ + · exact ⟨hL.m_U he, Or.inr (N.V_subset_U (hNV ▸ Or.inr ⟨e, he, rfl⟩))⟩ + · change D.V ⊆ K.V ∪ N.V + rw [hL.V_eq] + rintro z (hz | ⟨e, he, rfl⟩) + · exact Or.inl (radial_V hrad hz) + · exact Or.inr (hNV ▸ Or.inr ⟨e, he, rfl⟩) + · intro r hr + have hr' : r ∈ Γ.R := hRm hr + obtain ⟨w, ⟨hw, hwV⟩, huniq⟩ := hrad.2.2.2.1 r hr' + refine ⟨w, ⟨hw, Or.inl hwV⟩, ?_⟩ + rintro z ⟨hz, hz' | hz'⟩ + · exact huniq z ⟨hz, hz'⟩ + · rw [hNV] at hz' + rcases hz' with hz' | ⟨e, he, rfl⟩ + · exact huniq z ⟨hz, hz'.1⟩ + · exact absurd (hL.m_U he) (region_subset hr' hz) + · rintro w ⟨hw, hwD⟩ + have hwΓ : w ∉ Γ.V := fun h' => hwD (hVm h') + have hwK : w ∈ K.V := by + rcases hw with hw | hw + · exact hw + · rw [hNV] at hw + rcases hw with hw | ⟨e, he, rfl⟩ + · exact hw.1 + · exact absurd (hL.m_mem_D he) hwD + obtain ⟨r, hr, hwr⟩ := hrad.2.2.2.2.1 w ⟨hwK, hwΓ⟩ + exact ⟨r, hRm' hr, hwr⟩ + · intro g hg + rw [Drawing.glue_E] at hg + rcases hg with hg | hg + · obtain ⟨v, hv, w, hw, hcap⟩ := hrad.2.2.2.2.2.1 g hg + have hw' : w ∉ D.V := fun h' => by + rw [hL.V_eq] at h' + rcases h' with h' | ⟨e, he, rfl⟩ + · exact hw.2 h' + · exact hL.m_K he (K.V_subset_U hw.1) + exact ⟨v, hVm hv, w, ⟨Or.inl hw.1, hw'⟩, + (cap_spoke hKN hg).trans hcap⟩ + · obtain ⟨e, he, b, -, hcl⟩ := hL.N_edge hNE hg + refine ⟨m e, hL.m_mem_D he, h (e, b), ⟨Or.inl (hL.hub_V he b), hL.hub_notMem_D he b⟩, ?_⟩ + rw [hcl] + exact hL.cap_line hNV hKN he b + · intro g hg g' hg' hne v hv r hr w ⟨hwr, hwV⟩ hc hc' ⟨Δ, hΔ, hsub, hb⟩ + have hr' : r ∈ Γ.R := hRm hr + have hwK : w ∈ K.V := by + rcases hwV with h₁ | h₁ + · exact h₁ + · rw [hNV] at h₁ + rcases h₁ with h₁ | ⟨e, he, rfl⟩ + · exact h₁.1 + · exact absurd (hL.m_U he) (region_subset hr' hwr) + have hwU : w ∉ Γ.U := fun h' => region_subset hr' hwr h' + -- An edge of `K ∪ N` with ends `v, w` that is a spoke has `v` in `K`. + have hsp : ∀ {g}, g ∈ K.E → closure g ∩ (K.glue N hKN).V = {v, w} → + closure g ∩ K.V = {v, w} ∧ v ∈ K.U := by + intro g hg hc + have h₁ := (cap_spoke hKN hg).symm.trans hc + have h₂ : v ∈ closure g ∩ K.V := by rw [h₁]; simp + exact ⟨h₁, K.closure_subset_U hg h₂.1⟩ + -- An edge of `N` with ends `v, w` is a line at `v`. + have hln : ∀ {g}, g ∈ N.E → closure g ∩ (K.glue N hKN).V = {v, w} → + ∃ e ∈ Γ.E, ∃ b, g = range (ℓ (e, b)) \ {m e, h (e, b)} ∧ closure g = range (ℓ (e, b)) ∧ + v = m e ∧ w = h (e, b) := by + intro g hg hc + obtain ⟨e, he, b, hge, hcl⟩ := hL.N_edge hNE hg + have hcap := hL.cap_line hNV hKN he b + rw [← hcl, hc] at hcap + have h₁ : m e ∈ ({v, w} : Set S) := hcap ▸ Or.inl rfl + have h₂ : h (e, b) ∈ ({v, w} : Set S) := hcap ▸ Or.inr rfl + have hmw : m e = v := by + rcases h₁ with h₁ | h₁ + · exact h₁ + · exact absurd (h₁ ▸ hL.m_U he) hwU + have hhw : h (e, b) = w := by + rcases h₂ with h₂ | h₂ + · exact absurd (h₂ ▸ hv) (hL.hub_notMem_D he b) + · exact h₂ + exact ⟨e, he, b, hge, hcl, hmw.symm, hhw.symm⟩ + rw [Drawing.glue_E] at hg hg' + have hdB : discBd Δ = closure g ∪ closure g' := by + rw [← hb, subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hS hΔ] + rcases hg with hg | hg <;> rcases hg' with hg' | hg' + · obtain ⟨hc₁, hvK⟩ := hsp hg hc + obtain ⟨hc₂, -⟩ := hsp hg' hc' + have hvΓ : v ∈ Γ.V := by + have hv' : v ∈ D.V := hv + rw [hL.V_eq] at hv' + rcases hv' with hv' | ⟨e, he, rfl⟩ + · exact hv' + · exact absurd hvK (hL.m_K he) + exact hrad.2.2.2.2.2.2 g hg g' hg' hne v hvΓ r hr' w ⟨hwr, hwK⟩ hc₁ hc₂ ⟨Δ, hΔ, hsub, hb⟩ + · obtain ⟨-, hvK⟩ := hsp hg hc + obtain ⟨e, he, b, -, -, rfl, -⟩ := hln hg' hc' + exact hL.m_K he hvK + · obtain ⟨-, hvK⟩ := hsp hg' hc' + obtain ⟨e, he, b, -, -, rfl, -⟩ := hln hg hc + exact hL.m_K he hvK + · obtain ⟨e, he, b, hge, hcl, hve, hwe⟩ := hln hg hc + obtain ⟨e', he', b', hge', hcl', hve', hwe'⟩ := hln hg' hc' + obtain rfl : e = e' := hL.m_inj he he' (hve.symm.trans hve') + have hbb : b ≠ b' := fun h' => hne (by rw [hge, hge', h']) + rw [hcl, hcl'] at hdB + rw [hve] at hsub + cases b <;> cases b' + · exact hbb rfl + · exact hL.no_bigon_lines hS hmax hE he hr' hΔ hsub (hdB.trans (union_comm _ _)) + · exact hL.no_bigon_lines hS hmax hE he hr' hΔ hsub hdB + · exact hbb rfl + +include hNE in +omit [T2Space S] [ConnectedSpace S] in +/-- `N` has at least two edges for each edge of `Γ`. -/ +theorem two_mul_le_ncard_N : 2 * Γ.E.ncard ≤ N.E.ncard := by + have hinj : InjOn (fun i : Set S × Bool => range (ℓ i) \ {m i.1, h i}) (Γ.E ×ˢ (univ : Set Bool)) + := by + rintro ⟨e, b⟩ ⟨he, -⟩ ⟨e', b'⟩ ⟨he', -⟩ heq + by_contra hne + obtain ⟨t₀, h₀, h₁⟩ := exists_mid + have hmem : ℓ (e, b) t₀ ∈ range (ℓ (e, b)) \ {m e, h (e, b)} := by + refine ⟨⟨t₀, rfl⟩, ?_⟩ + have hin := hL.face_off he b (hL.inside e he b t₀ h₀ h₁) + rintro (h₂ | h₂) + · exact hin.1 (h₂ ▸ hL.m_U he) + · exact hin.2 (h₂ ▸ hL.hub_K he b) + have hmem' : ℓ (e, b) t₀ ∈ range (ℓ (e', b')) \ {m e', h (e', b')} := by + have heq' : range (ℓ (e, b)) \ {m e, h (e, b)} = range (ℓ (e', b')) \ {m e', h (e', b')} + := heq + exact heq' ▸ hmem + rcases hL.line_meet he he' hne hmem.1 hmem'.1 with h₂ | h₂ + · exact hmem.2 (Or.inl h₂) + · exact hmem.2 (Or.inr h₂) + rw [hNE, hinj.ncard_image, ncard_prod] + simp [mul_comm] + +include hNE in +omit [ConnectedSpace S] in +/-- An edge of `K` and an edge of `N` are different. -/ +theorem disjoint_edges : Disjoint K.E N.E := by + refine disjoint_left.mpr fun g hg hg' => ?_ + obtain ⟨e, he, b, rfl, -⟩ := hL.N_edge hNE hg' + obtain ⟨t₀, h₀, h₁⟩ := exists_mid + have hin := hL.face_off he b (hL.inside e he b t₀ h₀ h₁) + refine hin.2 (K.closure_subset_U hg (subset_closure ⟨⟨t₀, rfl⟩, ?_⟩)) + rintro (h₂ | h₂) + · exact hin.1 (h₂ ▸ hL.m_U he) + · exact hin.2 (h₂ ▸ hL.hub_K he b) + +omit [T2Space S] [ConnectedSpace S] in +/-- `D` has at most two edges for each edge of `Γ`. -/ +theorem ncard_D_le : D.E.ncard ≤ 2 * Γ.E.ncard := by + have hsub : D.E ⊆ (fun i : Set S × Bool => if i.2 then A i.1 else B i.1) '' (Γ.E ×ˢ + (univ : Set Bool)) := by + intro g hg + obtain ⟨e, he, h' | h'⟩ := hL.all g hg + · exact ⟨(e, true), ⟨he, mem_univ _⟩, by simp [h']⟩ + · exact ⟨(e, false), ⟨he, mem_univ _⟩, by simp [h']⟩ + have hfin := Γ.finite_edges.prod (finite_univ (α := Bool)) + have h₃ : (Γ.E ×ˢ (univ : Set Bool)).ncard = Γ.E.ncard * 2 := by + rw [ncard_prod] + simp + exact (ncard_le_ncard hsub (hfin.image _)).trans ((ncard_image_le hfin).trans (h₃.le.trans + (by omega))) + +/-- Each vertex of `D` has an edge of `D`. -/ +theorem D_all (hS : IsClosedSurface S) (hE : Γ.E.Nonempty) : + ∀ v ∈ D.V, ∃ g ∈ D.E, v ∈ closure g := by + intro v hv + rw [hL.V_eq] at hv + rcases hv with hv | ⟨e, he, rfl⟩ + · obtain ⟨e, he, hve⟩ := exists_edge_at hrad hS hE hv + obtain ⟨hA, hB, -, -, -, -, -, -, -, hcap, hcA, hcB⟩ := hL.split e he + have hv' : v ∈ closure e ∩ Γ.V := ⟨hve, hv⟩ + rw [hcap] at hv' + rcases hv' with rfl | rfl + · have : x e ∈ closure (A e) ∩ D.V := by rw [hcA]; simp + exact ⟨_, hA, this.1⟩ + · have : y e ∈ closure (B e) ∩ D.V := by rw [hcB]; simp + exact ⟨_, hB, this.1⟩ + · obtain ⟨hA, -, -, -, -, -, -, -, -, -, hcA, -⟩ := hL.split e he + have : m e ∈ closure (A e) ∩ D.V := by rw [hcA]; simp + exact ⟨_, hA, this.1⟩ + +include hNU hNV hNE in +/-- Maximality for `D` and `K ∪ N`, by count. The edges of `K` number at least `2 |E(Γ)|`, and so do +the +edges of `N`. So `K ∪ N` has at least `4 |E(Γ)|`, which is at least `2 |E(D)|`. -/ +theorem radMax_glue (hS : IsClosedSurface S) (hmax : RadMax (PaintingOrDrawing.drawing Γ) K) + (hE : Γ.E.Nonempty) : RadMax (PaintingOrDrawing.drawing D) (K.glue N hKN) := by + have hpre := hL.preRad_glue hNU hNV hNE hKN hS hmax hE + refine radMax_of_card hS hpre.1 hpre.2 (hL.D_all hS hE) ?_ + rw [Drawing.glue_E, ncard_union_eq (hL.disjoint_edges hNE) K.finite_edges N.finite_edges] + have h₁ := two_mul_le_ncard_spokes hrad hS hmax hE + have h₂ := hL.two_mul_le_ncard_N hNE + have h₃ := hL.ncard_D_le + omega + +end IsDualLines + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM12/SurfaceDualStar.lean b/LeanPool/GraphMinor/GM12/SurfaceDualStar.lean new file mode 100644 index 0000000000..f17fc49201 --- /dev/null +++ b/LeanPool/GraphMinor/GM12/SurfaceDualStar.lean @@ -0,0 +1,392 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.SurfaceDualSplit + +/-! +# Stars around vertices + +Let `K` be a radial drawing of `D`, and let `H = D ∪ K`. Suppose that the vertices of `D` split into +a +set `V₀` and the rest, so that each edge of `D` has one end in each part. Let `N` be the part of `K` +that +misses `V₀`, on the vertices `V(K) \ V₀` (`IsSideSplit`). + +The *star* of `v ∈ V₀` is `v` with the edges and the regions of `H` at `v`. Here we prove that the +stars +are open and disjoint, and that they cover the complement of `U(N)`. The file `SurfaceDualFan.lean` +proves that each star is an open disc. So the stars are the regions of `N`. +-/ + + +@[expose] public section + +namespace GraphMinor.GM12 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] {D K N : Drawing S} + {V₀ : Set S} + +/-- See the module docstring. -/ +def star (H : Drawing S) (v : S) : Set S := + {v} ∪ (⋃ g ∈ {g ∈ H.E | v ∈ closure g}, g) ∪ ⋃ p ∈ {p ∈ H.R | v ∈ closure p}, p + +omit [T2Space S] [ConnectedSpace S] in +theorem mem_star_self (H : Drawing S) (v : S) : v ∈ star H v := Or.inl (Or.inl rfl) + +omit [T2Space S] [ConnectedSpace S] in +theorem edge_subset_star {H : Drawing S} {v : S} {g : Set S} (hg : g ∈ H.E) (hv : v ∈ closure g) : + g ⊆ star H v := + fun _ hx => Or.inl (Or.inr (mem_biUnion (show g ∈ {g ∈ H.E | v ∈ closure g} from ⟨hg, hv⟩) hx)) + +omit [T2Space S] [ConnectedSpace S] in +theorem face_subset_star {H : Drawing S} {v : S} {p : Set S} (hp : p ∈ H.R) (hv : v ∈ closure p) : + p ⊆ star H v := + fun _ hx => Or.inr (mem_biUnion (show p ∈ {p ∈ H.R | v ∈ closure p} from ⟨hp, hv⟩) hx) + +omit [T2Space S] [ConnectedSpace S] in +theorem mem_star {H : Drawing S} {v x : S} (hx : x ∈ star H v) : + x = v ∨ (∃ g ∈ H.E, v ∈ closure g ∧ x ∈ g) ∨ ∃ p ∈ H.R, v ∈ closure p ∧ x ∈ p := by + rcases hx with (hx | hx) | hx + · exact Or.inl hx + · obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp hx + exact Or.inr (Or.inl ⟨g, hg.1, hg.2, hxg⟩) + · obtain ⟨p, hp, hxp⟩ := mem_iUnion₂.mp hx + exact Or.inr (Or.inr ⟨p, hp.1, hp.2, hxp⟩) + +/-- See the module docstring. -/ +structure IsSideSplit (D K N : Drawing S) (V₀ : Set S) : Prop where + sub_V : V₀ ⊆ D.V + V_eq : N.V = K.V \ V₀ + E_sub : N.E ⊆ K.E + D_ends : ∀ g ∈ D.E, ∃ u ∈ V₀, ∃ w ∈ D.V \ V₀, closure g ∩ D.V = {u, w} + K_ends : ∀ g ∈ K.E, g ∉ N.E → ∃ u ∈ V₀, u ∈ closure g + N_ends : ∀ g ∈ N.E, Disjoint (closure g) V₀ + +namespace IsSideSplit + +variable (hX : IsSideSplit D K N V₀) (hrad : PreRad (PaintingOrDrawing.drawing D) K) + +include hX + +omit [T2Space S] [ConnectedSpace S] in +theorem V_sub {v : S} (hv : v ∈ V₀) : v ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact radial_V hrad (hX.sub_V hv) + +omit [T2Space S] [ConnectedSpace S] in +/-- An edge of `H` at `v ∈ V₀` has its other end off `V₀`, in `N`. -/ +theorem arm {g : Set S} (hg : g ∈ (radialUnion hrad).E) {v : S} (hv : v ∈ V₀) + (hvg : v ∈ closure g) : + ∃ w, w ≠ v ∧ w ∉ V₀ ∧ w ∈ N.V ∧ closure g ∩ (radialUnion hrad).V = {v, w} ∧ g ∉ N.E ∧ + (g ∈ D.E → w ∈ D.V) ∧ (g ∈ K.E → w ∉ D.V) := by + have hvD := hX.sub_V hv + rw [radialUnion_E] at hg + rw [radialUnion_V] + have hnotN : g ∉ N.E := fun h' => disjoint_left.mp (hX.N_ends g h') hvg hv + rcases hg with hg | hg + · obtain ⟨u, hu, w, hw, hcap⟩ := hX.D_ends g hg + have hcap' : closure g ∩ K.V = {u, w} := by + rw [← hcap] + ext z + constructor + · rintro ⟨h₁, h₂⟩ + exact ⟨h₁, radial_inter hrad ▸ ⟨D.closure_subset_U hg h₁, K.V_subset_U h₂⟩⟩ + · rintro ⟨h₁, h₂⟩ + exact ⟨h₁, radial_V hrad h₂⟩ + have hvm : v ∈ closure g ∩ D.V := ⟨hvg, hvD⟩ + rw [hcap] at hvm + rcases hvm with rfl | hvm + · have hwV : w ∈ closure g ∩ D.V := by rw [hcap]; simp + refine ⟨w, fun h' => hw.2 (h' ▸ hu), hw.2, hX.V_eq ▸ ⟨radial_V hrad hw.1, hw.2⟩, hcap', hnotN, + fun _ => hw.1, fun hgK => ?_⟩ + exact absurd hg fun h' => edge_not_both hrad h' hgK + · exact absurd (hvm ▸ hv) hw.2 + · obtain ⟨u, hu, w, hw, hcap⟩ := hrad.2.2.2.2.2.1 g hg + have hvm : v ∈ closure g ∩ K.V := ⟨hvg, radial_V hrad hvD⟩ + rw [hcap] at hvm + rcases hvm with rfl | hvm + · exact ⟨w, fun h' => hw.2 (h' ▸ hvD), fun h' => hw.2 (hX.sub_V h'), + hX.V_eq ▸ ⟨hw.1, fun h' => hw.2 (hX.sub_V h')⟩, hcap, hnotN, + fun hgD => absurd hg fun h' => edge_not_both hrad hgD h', fun _ => hw.2⟩ + · exact absurd (hvm ▸ hvD) hw.2 + +omit [T2Space S] [ConnectedSpace S] in +/-- An edge of `H` has at most one end in `V₀`. -/ +theorem arm_unique {g : Set S} (hg : g ∈ (radialUnion hrad).E) {v v' : S} (hv : v ∈ V₀) + (hv' : v' ∈ V₀) + (hvg : v ∈ closure g) (hvg' : v' ∈ closure g) : v = v' := by + obtain ⟨w, -, hw, -, hcap, -⟩ := hX.arm hrad hg hv hvg + have : v' ∈ closure g ∩ (radialUnion hrad).V := ⟨hvg', hX.V_sub hrad hv'⟩ + rw [hcap] at this + rcases this with h' | h' + · exact h'.symm + · exact absurd (h' ▸ hv') hw + +omit [T2Space S] [ConnectedSpace S] in +theorem N_E_sub {g : Set S} (hg : g ∈ N.E) : g ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inr (hX.E_sub hg) + +omit [T2Space S] [ConnectedSpace S] in +theorem N_V_sub {z : S} (hz : z ∈ N.V) : z ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + rw [hX.V_eq] at hz + exact hz.1 + +omit [T2Space S] [ConnectedSpace S] in +theorem N_U_sub {z : S} (hz : z ∈ N.U) : z ∈ (radialUnion hrad).U := by + by_cases hzV : z ∈ N.V + · exact (radialUnion hrad).V_subset_U (hX.N_V_sub hrad hzV) + · obtain ⟨g, hg, hzg⟩ := N.exists_edge_of_mem hz hzV + exact (radialUnion hrad).closure_subset_U (hX.N_E_sub hrad hg) (subset_closure hzg) + +omit [T2Space S] [ConnectedSpace S] in +/-- A point of `V₀` is off `N`. -/ +theorem V₀_off {v : S} (hv : v ∈ V₀) : v ∉ N.U := by + intro hz + by_cases hzV : v ∈ N.V + · rw [hX.V_eq] at hzV + exact hzV.2 hv + · obtain ⟨g, hg, hzg⟩ := N.exists_edge_of_mem hz hzV + exact disjoint_left.mp (hX.N_ends g hg) (subset_closure hzg) hv + +omit [T2Space S] [ConnectedSpace S] in +/-- An edge of `H` that is not in `N` is off `N`. -/ +theorem edge_off {g : Set S} (hg : g ∈ (radialUnion hrad).E) (hgN : g ∉ N.E) : Disjoint g N.U := by + refine disjoint_left.mpr fun z hzg hz => ?_ + by_cases hzV : z ∈ N.V + · exact edge_notMem_V hg hzg (hX.N_V_sub hrad hzV) + · obtain ⟨g', hg', hzg'⟩ := N.exists_edge_of_mem hz hzV + exact hgN ((radialUnion hrad).edge_eq_of_mem hg (hX.N_E_sub hrad hg') hzg hzg' ▸ hg') + +omit [T2Space S] [ConnectedSpace S] in +/-- A star is off `N`. -/ +theorem star_off {v : S} (hv : v ∈ V₀) : Disjoint (star (radialUnion hrad) v) N.U := by + refine disjoint_left.mpr fun z hz hzN => ?_ + rcases mem_star hz with rfl | ⟨g, hg, hvg, hzg⟩ | ⟨p, hp, -, hzp⟩ + · exact hX.V₀_off hv hzN + · obtain ⟨w, -, -, -, -, hgN, -⟩ := hX.arm hrad hg hv hvg + exact disjoint_left.mp (hX.edge_off hrad hg hgN) hzg hzN + · exact region_subset hp hzp (hX.N_U_sub hrad hzN) + +variable (hS : IsClosedSurface S) (hmax : RadMax (PaintingOrDrawing.drawing D) K) + (hE : D.E.Nonempty) + +include hS hmax hE + +/-- Each region of `H` has a point of `V₀` on its frontier: an end of its edge of `D`. -/ +theorem exists_face_vertex {p : Set S} (hp : p ∈ (radialUnion hrad).R) : + ∃ v ∈ V₀, v ∈ closure p := by + obtain ⟨e, he, hep, -, -⟩ := face_edge hrad hS hmax hE hp + obtain ⟨u, hu, w, -, hcap⟩ := hX.D_ends e he + have : u ∈ closure e ∩ D.V := by rw [hcap]; simp + exact ⟨u, hu, closure_minimal hep isClosed_closure this.1⟩ + +/-- Each region of `H` has just one point of `V₀` on its frontier. -/ +theorem face_vertex_unique {p : Set S} (hp : p ∈ (radialUnion hrad).R) {v v' : S} (hv : v ∈ V₀) + (hv' : v' ∈ V₀) (hvp : v ∈ closure p) (hvp' : v' ∈ closure p) : v = v' := by + obtain ⟨e, he, -, -, hall⟩ := face_edge hrad hS hmax hE hp + have heH : e ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inl he + exact hX.arm_unique hrad heH hv hv' (hall v (hX.sub_V hv) hvp) (hall v' (hX.sub_V hv') hvp') + +/-- Stars at different points of `V₀` are disjoint. -/ +theorem star_eq {v v' x : S} (hv : v ∈ V₀) (hv' : v' ∈ V₀) (hx : x ∈ star (radialUnion hrad) v) + (hx' : x ∈ star (radialUnion hrad) v') : v = v' := by + have hVU : ∀ {z}, z ∈ V₀ → z ∈ (radialUnion hrad).U := fun hz => + (radialUnion hrad).V_subset_U (hX.V_sub hrad hz) + rcases mem_star hx with rfl | ⟨g, hg, hvg, hxg⟩ | ⟨p, hp, hvp, hxp⟩ <;> + rcases mem_star hx' with h₁ | ⟨g', hg', hvg', hxg'⟩ | ⟨p', hp', hvp', hxp'⟩ + · exact h₁ + · exact absurd (hX.V_sub hrad hv) (edge_notMem_V hg' hxg') + · exact absurd (hVU hv) (region_subset hp' hxp') + · exact absurd (hX.V_sub hrad hv') (edge_notMem_V hg (h₁ ▸ hxg)) + · obtain rfl := (radialUnion hrad).edge_eq_of_mem hg hg' hxg hxg' + exact hX.arm_unique hrad hg hv hv' hvg hvg' + · exact absurd ((radialUnion hrad).closure_subset_U hg (subset_closure hxg)) + (region_subset hp' hxp') + · exact absurd (hVU hv') (region_subset hp (h₁ ▸ hxp)) + · exact absurd ((radialUnion hrad).closure_subset_U hg' (subset_closure hxg')) + (region_subset hp hxp) + · obtain rfl := region_eq_of_mem hp hp' hxp hxp' + exact hX.face_vertex_unique hrad hS hmax hE hp hv hv' hvp hvp' + +/-- The stars cover the complement of `N`. -/ +theorem exists_star {x : S} (hx : x ∉ N.U) : ∃ v ∈ V₀, x ∈ star (radialUnion hrad) v := by + by_cases hxU : x ∈ (radialUnion hrad).U + · by_cases hxV : x ∈ (radialUnion hrad).V + · rw [radialUnion_V] at hxV + have hxV₀ : x ∈ V₀ := by + by_contra hn + exact hx (N.V_subset_U (hX.V_eq ▸ ⟨hxV, hn⟩)) + exact ⟨x, hxV₀, mem_star_self _ _⟩ + · obtain ⟨g, hg, hxg⟩ := (radialUnion hrad).exists_edge_of_mem hxU hxV + have hu : ∃ u ∈ V₀, u ∈ closure g := by + have hg' := hg + rw [radialUnion_E] at hg' + rcases hg' with hg' | hg' + · obtain ⟨u, hu, w, -, hcap⟩ := hX.D_ends g hg' + have : u ∈ closure g ∩ D.V := by rw [hcap]; simp + exact ⟨u, hu, this.1⟩ + · refine hX.K_ends g hg' fun h' => hx ?_ + exact N.closure_subset_U h' (subset_closure hxg) + obtain ⟨u, hu, hug⟩ := hu + exact ⟨u, hu, edge_subset_star hg hug hxg⟩ + · obtain ⟨p, hp, hxp⟩ := exists_region_of_notMem hxU + obtain ⟨v, hv, hvp⟩ := hX.exists_face_vertex hrad hS hmax hE hp + exact ⟨v, hv, face_subset_star hp hvp hxp⟩ + +/-- A star is open. Near `v` this follows from the sectors at `v`, once we remove the closed set +made of +the edges away from `v` and the other vertices. Near a point of an edge, it follows from the two +sides of the edge. -/ +theorem star_isOpen {v : S} (hv : v ∈ V₀) : IsOpen (star (radialUnion hrad) v) := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let H := radialUnion hrad + refine isOpen_iff_forall_mem_open.mpr fun x hx => ?_ + rcases mem_star hx with rfl | ⟨g, hg, hvg, hxg⟩ | ⟨p, hp, hvp, hxp⟩ + · obtain ⟨y₀⟩ : Nonempty S := inferInstance + obtain ⟨γ, hγ⟩ := exists_edgePar H + obtain ⟨next, ρ, P, W, Q, τ, hsec⟩ := exists_sectors hS H hγ (hX.V_sub hrad hv) + (two_half_edges hrad hS hmax hE hγ (hX.sub_V hv)) + let Z : Set S := (⋃ g ∈ {g ∈ H.E | x ∉ closure g}, closure g) ∪ (H.V \ {x}) + have hZ : IsClosed Z := by + refine IsClosed.union ?_ ?_ + · exact (H.finite_edges.subset (sep_subset _ _)).isClosed_biUnion fun _ _ => isClosed_closure + · exact (H.finite_V.subset sdiff_subset).isClosed + have hxZ : x ∉ Z := by + rintro (h' | h') + · obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h' + exact hg.2 hxg + · exact h'.2 rfl + refine ⟨W \ Z, ?_, (IsSectors.isOpen hsec).sdiff hZ, IsSectors.mem hsec, hxZ⟩ + rintro y ⟨hyW, hyZ⟩ + by_cases hyU : y ∈ H.U + · by_cases hyV : y ∈ H.V + · have : y = x := by + by_contra hn + exact hyZ (Or.inr ⟨hyV, hn⟩) + exact this ▸ mem_star_self _ _ + · obtain ⟨g, hg, hyg⟩ := H.exists_edge_of_mem hyU hyV + have hxg : x ∈ closure g := by + by_contra hn + exact hyZ (Or.inl (mem_biUnion (show g ∈ {g ∈ H.E | x ∉ closure g} from ⟨hg, hn⟩) + (subset_closure hyg))) + exact edge_subset_star hg hxg hyg + · obtain ⟨k, hk⟩ := mem_iUnion.mp (IsSectors.cover hsec ⟨hyW, hyU⟩) + have hcor := IsSectors.corners hsec + exact face_subset_star (IsCorners.region hcor k) (IsCorners.closure_v hcor k) + (IsSectors.sub hsec k hk) + · obtain ⟨W, A₁, A₂, hW, hxW, hWU, hcov, hc₁, hc₂, hd₁, hd₂, hcl₁, hcl₂⟩ := + exists_edge_sides hS H hg hxg + refine ⟨W, ?_, hW, hxW⟩ + have hside : ∀ {A : Set S}, IsPreconnected A → Disjoint A H.U → g ∩ W ⊆ closure A → + ∀ y ∈ A, y ∈ star H v := by + intro A hA hd hcl y hy + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem (disjoint_left.mp hd hy) + have hAr : A ⊆ r := subset_region hr hA hd hy hyr + have hxr : x ∈ closure r := closure_mono hAr (hcl ⟨hxg, hxW⟩) + have hgr : g ⊆ closure r := edge_subset_closure_of_incident hS hg hr ⟨x, hxg, hxr⟩ + exact face_subset_star hr (closure_minimal hgr isClosed_closure hvg) hyr + intro y hy + by_cases hyU : y ∈ H.U + · exact edge_subset_star hg hvg (hWU ⟨hy, hyU⟩) + · rcases hcov ⟨hy, hyU⟩ with h₁ | h₁ + · exact hside hc₁ hd₁ hcl₁ y h₁ + · exact hside hc₂ hd₂ hcl₂ y h₁ + · exact ⟨p, face_subset_star hp hvp, region_isOpen hp, hxp⟩ + +variable {γ : Set S → I → S} {v : S} + {next : halfEdges (radialUnion hrad) γ v → halfEdges (radialUnion hrad) γ v} + {ρ P Q : halfEdges (radialUnion hrad) γ v → Set S} {W : Set S} + {τ : halfEdges (radialUnion hrad) γ v → I} + +omit hS hmax hE in +omit [ConnectedSpace S] in +/-- An edge at `v` has just one half-edge at `v`, since it is not a loop. -/ +theorem half_inj (hγ : EdgePar (radialUnion hrad) γ) (hv : v ∈ V₀) + {k k' : halfEdges (radialUnion hrad) γ v} (h' : k.1.1 = k'.1.1) : k = k' := by + have hg := k.2.1 + have hvg : v ∈ closure k.1.1 := by + have := end_mem_closure hγ k.2.1 k.1.2 + rwa [k.2.2] at this + obtain ⟨w, hwv, -, -, hcap, -⟩ := hX.arm hrad hg hv hvg + have hw : w ∈ closure k.1.1 ∩ (radialUnion hrad).V := by rw [hcap]; simp + obtain ⟨b, hb⟩ := exists_end_eq hγ hg hw.2 hw.1 + refine Subtype.ext (Prod.ext h' ?_) + by_contra hne + have h₁ := k.2.2 + have h₂ := k'.2.2 + rw [← h'] at h₂ + have hbc : b = k.1.2 ∨ b = k'.1.2 := by + revert hne + cases b <;> cases k.1.2 <;> cases k'.1.2 <;> simp + rcases hbc with hb' | hb' + · rw [hb'] at hb + exact hwv (hb.symm.trans h₁) + · rw [hb'] at hb + exact hwv (hb.symm.trans h₂) + +/-- The corners at `v` lie in different regions of `H`. Each corner has a half-edge of `D` beside +it, by +`corner_alternates`. Two corners in one region have the same one, since a region has one edge of +`D`. +So they are the two corners beside this half-edge. But an edge of `D` has two different regions +beside +it, by `exists_two_faces`. -/ +theorem corner_inj (hγ : EdgePar (radialUnion hrad) γ) (hv : v ∈ V₀) + (hsec : IsSectors (radialUnion hrad) γ v next ρ P W Q τ) + {k k' : halfEdges (radialUnion hrad) γ v} (h' : ρ k = ρ k') : k = k' := by + have hcor := IsSectors.corners hsec + have hvD := hX.sub_V hv + have hbes : ∀ c : halfEdges (radialUnion hrad) γ v, + ∃ j, (j = c ∨ j = next c) ∧ j.1.1 ∈ D.E ∧ j.1.1 ⊆ closure (ρ c) := by + intro c + obtain ⟨c', hc'⟩ := next_surjective hcor c + have hl : c.1.1 ⊆ closure (ρ c) := by + have := IsCorners.right hcor c' + rwa [hc'] at this + rcases corner_alternates hrad hS hmax hE hγ hvD hsec c with h₁ | h₁ + · exact ⟨next c, Or.inr rfl, h₁.2, IsCorners.left hcor c⟩ + · exact ⟨c, Or.inl rfl, h₁.1, hl⟩ + obtain ⟨j, hj, hjD, hjc⟩ := hbes k + obtain ⟨j', hj', hjD', hjc'⟩ := hbes k' + have hjj : j = j' := by + obtain ⟨e, he, -, heu, -⟩ := face_edge hrad hS hmax hE (IsCorners.region hcor k) + exact hX.half_inj hrad hγ hv + ((heu _ hjD hjc).trans (heu _ hjD' (h'.symm ▸ hjc')).symm) + subst hjj + have hne : ∀ c : halfEdges (radialUnion hrad) γ v, (next c).1.1 ∈ D.E → ρ c ≠ ρ (next c) := by + intro c hc heq + obtain ⟨p, hp, q, hq, hpq, hep, heq', -⟩ := exists_two_faces hrad hS hmax hE hc + have h₁ := IsCorners.sides hcor c p hp hep + have h₂ := IsCorners.sides hcor c q hq heq' + refine hpq ?_ + rcases h₁ with h₁ | h₁ <;> rcases h₂ with h₂ | h₂ + · exact h₁.trans h₂.symm + · exact h₁.trans (heq.trans h₂.symm) + · exact h₁.trans (heq.symm.trans h₂.symm) + · exact h₁.trans h₂.symm + rcases hj with hj | hj <;> rcases hj' with hj' | hj' + · exact hj.symm.trans hj' + · have hρ : ρ (next k') = ρ k := congrArg ρ (hj'.symm.trans hj) + exact absurd (h'.symm.trans hρ.symm) (hne k' (hj' ▸ hjD)) + · have hρ : ρ (next k) = ρ k' := congrArg ρ (hj.symm.trans hj') + exact absurd (h'.trans hρ.symm) (hne k (hj ▸ hjD)) + · exact IsCorners.inj hcor (hj.symm.trans hj') + +end IsSideSplit + +end GraphMinor.GM12 diff --git a/LeanPool/GraphMinor/GM14/Adapted.lean b/LeanPool/GraphMinor/GM14/Adapted.lean new file mode 100644 index 0000000000..a48ad01b31 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Adapted.lean @@ -0,0 +1,111 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.GM14.Cited +public import LeanPool.GraphMinor.GM14.Section6a +public import LeanPool.GraphMinor.GM14.Section7a +public import LeanPool.GraphMinor.GM16.Battlefields + +/-! +# Graph Minors XIV: Adapted and Open Local Steps + +This file states as closed `Prop`s: +1. Result `(8.1)` (`Theorem81Statement`, page 40) of N. Robertson and P. D. Seymour, + *Graph Minors. XIV. Extending an embedding*, J. Combin. Theory Ser. B **65** (1995) 23–50, which + the paper introduces with: + "The proof of [3, theorem (11.11)] may easily be adapted to yield the following." +2. The remaining local topological/drawing gluing step in Section 10, kept as an explicit + closed `...Statement : Prop` definition outside `Cited.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 + GraphMinor.GM10 GraphMinor.GM11 Hypergraph + +universe u v w + +/-! ## Result (8.1) (adapted from Graph Minors IX, (11.11)) -/ + +/-- Statement of Graph Minors XIV, (8.1) (page 40), whose proof adapts the proof of Graph Minors IX, +(11.11): +"A society $(G, \Omega)$ has no cross if and only if there is a 3-segregation $\mathscr{S}$ +of $G$ with $\bar{\Omega} \subseteq V(\mathscr{S})$ and an arrangement $\alpha$ of +$\mathscr{S}$ in a closed disc $\Delta$ with $\Omega = \alpha^{-1}(bd(\Delta))$." -/ +def Theorem81Statement : Prop := + ∀ {D : Type w} [TopologicalSpace D] [T2Space D] {α : Type u} {β : Type v} + (S : Society α β), + IsSurface D → Nonempty (D ≃ₜ ClosedUnitDisc) → + ((∀ P_set : Set (Graph α β), S.IsCrookedTransaction P_set → P_set.ncard ≠ 2) ↔ + ∃ (S_seg : Set (Society α β)) (α_disc : Society α β → Set D) (α_pt : α → D), + IsThreeSegregation S.G S_seg ∧ + S.Ω.bar ⊆ segregationVertices S_seg ∧ + IsSurfaceArrangement S_seg α_disc α_pt ∧ + IsPullbackPerm S_seg α_pt (bd D) S.Ω) + +/-! ## Section 10 Local Translation Step -/ + +/-- Local translation between representativity `≥ 209` on a non-spherical closed surface `S` for a +subdivision `H` of a simple 3-connected graph inside a 4-connected graph `G` and the tangle-metric / +zone / 3-segregation conditions of `(4.1)` in the proof of Graph Minors XIV, (1.1) +(pages 24–25, 30–31). -/ +def Theorem11TranslationStatement : Prop := + ∀ {S : Type u} [TopologicalSpace S] [T2Space S] {α : Type v} {β : Type w} + (_hS : IsClosedSurface S) (_hConn : ConnectedSpace S) (_hnot_sphere : ¬ IsSphere S) + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G), + V(G).Finite → E(G).Finite → + (5 ≤ V(G).ncard ∧ + ∀ G₁ G₂ : Graph α β, IsGraphSeparation G G₁ G₂ → + (V(G₁) ∩ V(G₂)).ncard < 4 → V(G₁) = V(G) ∨ V(G₂) = V(G)) → + IsSubdivisionOfSimpleThreeConnected η.imageGraph → + H.IsRepresentative 209 → + ∃ (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ), + H.IsTwoCell ∧ IsRigid H ∧ + IsRespectfulDrawingTangle H 209 T ∧ HasTangleMetric H 209 T d ∧ + (∀ (P : Graph α β) (u v : S), + u ∈ H.V → v ∈ H.V → + IsHPathWithEnds G η.imageGraph P (η.vMap u) (η.vMap v) → + ¬ (d {u} {v} < 12) → + ∃ (P_G : Graph α β) (u_H v_H : S), + u_H ∈ H.V ∧ v_H ∈ H.V ∧ + IsHPathWithEnds G η.imageGraph P_G (η.vMap u_H) (η.vMap v_H) ∧ + ¬ ∃ φ : C(Circle, S), + (range φ ∩ H.U).encard ≤ 3 ∧ u_H ∈ curveIns φ ∧ v_H ∈ curveIns φ) ∧ + (∀ (Λ : Set S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) + (η_cl : SpanEmbedding (clearedSubdrawing H Λ) G), + IsLambdaZone H d 39 Λ → + IsRigid (clearedSubdrawing H Λ) → + IsClearedTangle H T d 209 39 Λ T' d' → + (∀ v ∈ (clearedSubdrawing H Λ).V, η_cl.vMap v = η.vMap v) → + IsDrawingEye G (clearedSubdrawing H Λ) η_cl (209 - 158) T' Λ → + ∃ (C : Drawing S) (Λ₀ : Set S) (x : S) (a b c d_v : S) (P₁ P₂ : Graph α β), + C.IsCircuit ∧ C.IsSubdrawing H ∧ IsOpenDisc Λ₀ ∧ subBd Λ₀ = C.U ∧ x ∈ Λ₀ ∧ + a ∈ C.V ∧ b ∈ C.V ∧ c ∈ C.V ∧ d_v ∈ C.V ∧ + OccurInCircuitOrder C a b c d_v ∧ + IsSubdivisionOfSimpleThreeConnected (clearedSubdrawing H Λ₀).toGraph ∧ + (∀ y ∈ Λ₀, ∃ φ : C(Circle, S), + (range φ ∩ H.U).encard ≤ 39 ∧ x ∈ curveIns φ ∧ y ∈ curveIns φ) ∧ + (∀ Δ : Set S, IsClosedDisc Δ → ({a, b, c, d_v} : Set S) ⊆ Δ → + 4 ≤ ((subBd Δ \ Λ₀) ∩ H.U).encard) ∧ + Disjoint V(P₁) V(P₂) ∧ + IsGraphPathWithEnds G P₁ (η.vMap a) (η.vMap c) ∧ + IsGraphPathWithEnds G P₂ (η.vMap b) (η.vMap d_v)) ∧ + ((∃ (S_seg : Set (Society α β)) (α_disc : Society α β → Set S) (α_pt : α → S), + IsThreeSegregation G S_seg ∧ IsTangleLocal G H η T S_seg ∧ + IsSurfaceArrangement S_seg α_disc α_pt ∧ IsCompatibleWith G H η S_seg α_disc α_pt) → + ∃ (Γ_G : GraphDrawing G S), H.IsSubdrawing Γ_G.drawing) + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/AnnulusRural.lean b/LeanPool/GraphMinor/GM14/AnnulusRural.lean new file mode 100644 index 0000000000..63e15ebe07 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/AnnulusRural.lean @@ -0,0 +1,420 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Section3a +public import LeanPool.GraphMinor.GM14.SegregationDrawing +public import LeanPool.GraphMinor.GM16.AnnulusPresentation +public import LeanPool.GraphMinor.GM16.DiscPlaneCoordinates + +/-! +# A drawing between two discs is a rural neighbourhood + +Let `Y` be a drawing of `G` between two closed discs `D₀ ⊆ D`, and let `Ω`, `Ω₀` be natural orders +of the vertices on `bd(D)` and on `bd(D₀)`. Then `(G, Ω, Ω₀)` is rural, and nested circuits around +`D₀` give a nest. In (8.4) the graph is not a drawing with vertices in `S`, and the orders are +given. +So we state this for an abstract graph, and keep the given orders. +-/ + + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor GraphMinor.GM09 GraphMinor.Surface GraphMinor.GM11 + GraphMinor.GM16 + +universe u v w + +variable {α : Type u} {β : Type v} {S : Type w} [TopologicalSpace S] [T2Space S] [CompactSpace S] + [Nonempty S] + +omit [T2Space S] [CompactSpace S] [Nonempty S] in +/-- A natural order depends only on the points of its vertices. -/ +theorem IsNaturalOrderFrom.congr {ν ν' : α → S} {Ω : CyclicPerm α} {F : Set S} + (h : IsNaturalOrderFrom ν Ω F) (he : ∀ v ∈ Ω.bar, ν' v = ν v) : + IsNaturalOrderFrom ν' Ω F := by + obtain ⟨hF, φ, hm, hc⟩ := h + refine ⟨hF, φ, fun v hv => he v hv ▸ hm v hv, fun v₁ v₂ v₃ h₃ => ?_⟩ + obtain ⟨t₁, t₂, t₃, h₁₂, h₂₃, h₃₁, e₁, e₂, e₃⟩ := hc v₁ v₂ v₃ h₃ + have hm₃ := (Ω.isClockwise3_iff.mp h₃).2.2.2 + exact ⟨t₁, t₂, t₃, h₁₂, h₂₃, h₃₁, e₁.trans (he v₁ hm₃.1).symm, e₂.trans (he v₂ hm₃.2.1).symm, + e₃.trans (he v₃ hm₃.2.2.1).symm⟩ + +/-! ### Reversing a cyclic permutation (`Ω⁻¹`) and invariance of crooked transactions -/ + +@[simp] +theorem reverse_bar (Ω : CyclicPerm α) : Ω⁻¹.bar = Ω.bar := rfl + +theorem iterate_invFunBar_toFun (Ω : CyclicPerm α) (n : ℕ) {z : α} (hz : z ∈ Ω.bar) : + (Ω.invFunBar^[n]) ((Ω.toFun^[n]) z) = z := by + induction n with + | zero => rfl + | succ n ih => + rw [Function.iterate_succ_apply, Function.iterate_succ_apply', + Ω.invFunBar_toFun (Ω.iterate_mem n hz)] + exact ih + +theorem iterate_toFun_invFunBar (Ω : CyclicPerm α) (n : ℕ) {z : α} (hz : z ∈ Ω.bar) : + (Ω.toFun^[n]) ((Ω.invFunBar^[n]) z) = z := by + induction n with + | zero => rfl + | succ n ih => + have hmem : (Ω.invFunBar^[n]) z ∈ Ω.bar := Ω⁻¹.iterate_mem n hz + rw [Function.iterate_succ_apply, Function.iterate_succ_apply', Ω.toFun_invFunBar hmem] + exact ih + +theorem iterate_invFunBar_sub (Ω : CyclicPerm α) {k j : ℕ} (hj : j ≤ k) {x : α} + (hx : x ∈ Ω.bar) : + (Ω.invFunBar^[j]) ((Ω.toFun^[k]) x) = (Ω.toFun^[k - j]) x := by + have hk : k = j + (k - j) := (Nat.add_sub_of_le hj).symm + conv_lhs => rw [hk, Function.iterate_add_apply] + exact iterate_invFunBar_toFun Ω j (Ω.iterate_mem (k - j) hx) + +theorem firstHitIn_reverse_of_firstHitIn {Ω : CyclicPerm α} {X : Set α} {x y : α} + (hx : x ∈ Ω.bar) (hxX : x ∈ X) (h : Ω.FirstHitIn X x y) : + Ω⁻¹.FirstHitIn X y x := by + rcases h with ⟨k, hk1, rfl, hyX, hmin⟩ + refine ⟨k, hk1, iterate_invFunBar_toFun Ω k hx, hxX, fun j hj1 hjlt => ?_⟩ + change (Ω.invFunBar^[j]) ((Ω.toFun^[k]) x) ∉ X + rw [iterate_invFunBar_sub Ω (le_of_lt hjlt) hx] + exact hmin (k - j) (Nat.le_sub_of_add_le (by omega)) (Nat.sub_lt (by omega) (by omega)) + +theorem firstHitIn_of_firstHitIn_reverse {Ω : CyclicPerm α} {X : Set α} {x y : α} + (hy : y ∈ Ω.bar) (hyX : y ∈ X) (h : Ω⁻¹.FirstHitIn X y x) : + Ω.FirstHitIn X x y := by + rcases h with ⟨k, hk1, hky, hxX, hmin⟩ + change (Ω.invFunBar^[k]) y = x at hky + subst hky + have hsub : ∀ {j : ℕ}, j ≤ k → (Ω.toFun^[j]) ((Ω.invFunBar^[k]) y) = (Ω.invFunBar^[k - j]) y := by + intro j hj + have hk : k = j + (k - j) := (Nat.add_sub_of_le hj).symm + have hmem : (Ω.invFunBar^[k - j]) y ∈ Ω.bar := Ω⁻¹.iterate_mem (k - j) hy + conv_lhs => rw [hk, Function.iterate_add_apply] + exact iterate_toFun_invFunBar Ω j hmem + refine ⟨k, hk1, ?_, hyX, fun j hj1 hjlt => ?_⟩ + · rw [hsub (le_refl k), Nat.sub_self, Function.iterate_zero_apply] + · rw [hsub (le_of_lt hjlt)] + exact hmin (k - j) (Nat.le_sub_of_add_le (by omega)) (Nat.sub_lt (by omega) (by omega)) + +theorem isClockwise3_reverse_iff {Ω : CyclicPerm α} {v₁ v₂ v₃ : α} : + Ω⁻¹.IsClockwise3 v₁ v₂ v₃ ↔ Ω.IsClockwise3 v₁ v₃ v₂ := by + rw [CyclicPerm.isClockwise3_iff, CyclicPerm.isClockwise3_iff] + have hset : ({v₁, v₃, v₂} : Set α) = {v₁, v₂, v₃} := by ext x; simp [or_comm] + rw [hset] + simp only [reverse_bar] + refine ⟨fun ⟨h12, h13, h23, hv1, hv2, hv3, hhit12, hhit23, hhit31⟩ => + ⟨h13, h12, h23.symm, hv1, hv3, hv2, + firstHitIn_of_firstHitIn_reverse hv3 (by simp) hhit31, + firstHitIn_of_firstHitIn_reverse hv2 (by simp) hhit23, + firstHitIn_of_firstHitIn_reverse hv1 (by simp) hhit12⟩, + fun ⟨h13, h12, h32, hv1, hv3, hv2, hhit13, hhit32, hhit21⟩ => + ⟨h12, h13, h32.symm, hv1, hv2, hv3, + firstHitIn_reverse_of_firstHitIn hv2 (by simp) hhit21, + firstHitIn_reverse_of_firstHitIn hv3 (by simp) hhit32, + firstHitIn_reverse_of_firstHitIn hv1 (by simp) hhit13⟩⟩ + +theorem interval_reverse (Ω : CyclicPerm α) (a b : α) : + Ω⁻¹.interval a b = Ω.interval b a := by + ext v + simp only [CyclicPerm.interval, reverse_bar, mem_ofPred_eq, mem_sdiff, mem_insert_iff, + mem_singleton_iff, isClockwise3_reverse_iff] + refine ⟨fun ⟨⟨hv, hne⟩, hcw⟩ => ⟨⟨hv, by tauto⟩, Ω.isClockwise3_rotate hcw⟩, + fun ⟨⟨hv, hne⟩, hcw⟩ => ⟨⟨hv, by tauto⟩, Ω.isClockwise3_rotate (Ω.isClockwise3_rotate hcw)⟩⟩ + +theorem crosses_reverse_iff (Ω : CyclicPerm α) {a₁ b₁ a₂ b₂ : α} : + Ω⁻¹.Crosses a₁ b₁ a₂ b₂ ↔ Ω.Crosses a₁ b₁ a₂ b₂ := by + rw [Ω⁻¹.crosses_iff_interval, Ω.crosses_iff_interval, interval_reverse, interval_reverse] + tauto + +theorem isFence_reverse_iff (Ω : CyclicPerm α) {A B : Set α} : + Ω⁻¹.IsFence A B ↔ Ω.IsFence A B := by + simp only [CyclicPerm.IsFence, reverse_bar, crosses_reverse_iff] + +theorem isOmegaPathWithEnds_of_eq_or_reverse {S₁ S₂ : Society α β} (hG : S₁.G = S₂.G) + (hΩ : S₁.Ω = S₂.Ω ∨ S₁.Ω = S₂.Ω⁻¹) {P : Graph α β} {a b : α} : + S₁.IsOmegaPathWithEnds P a b ↔ S₂.IsOmegaPathWithEnds P a b := by + have hbar : S₁.Ω.bar = S₂.Ω.bar := by rcases hΩ with h | h <;> simp [h] + simp only [Society.IsOmegaPathWithEnds, hG, hbar] + +theorem transactionEnds_of_eq_or_reverse {S₁ S₂ : Society α β} (hG : S₁.G = S₂.G) + (hΩ : S₁.Ω = S₂.Ω ∨ S₁.Ω = S₂.Ω⁻¹) (P_set : Set (Graph α β)) : + S₁.transactionEnds P_set = S₂.transactionEnds P_set := by + ext v + simp only [Society.transactionEnds, mem_ofPred_eq, isOmegaPathWithEnds_of_eq_or_reverse hG hΩ] + +theorem isCrookedTransaction_of_eq_or_reverse {S₁ S₂ : Society α β} (hG : S₁.G = S₂.G) + (hΩ : S₁.Ω = S₂.Ω ∨ S₁.Ω = S₂.Ω⁻¹) {P_set : Set (Graph α β)} : + S₁.IsCrookedTransaction P_set ↔ S₂.IsCrookedTransaction P_set := by + have hpath : ∀ {P a b}, S₁.IsOmegaPathWithEnds P a b ↔ S₂.IsOmegaPathWithEnds P a b := + isOmegaPathWithEnds_of_eq_or_reverse hG hΩ + have hop : ∀ {P}, S₁.IsOmegaPath P ↔ S₂.IsOmegaPath P := by + intro P; simp only [Society.IsOmegaPath, hpath] + have hdisj : S₁.IsDisjointOmegaPathSet P_set ↔ S₂.IsDisjointOmegaPathSet P_set := by + simp only [Society.IsDisjointOmegaPathSet, hop] + have hfe : ∀ {A B}, S₁.Ω.IsFence A B ↔ S₂.Ω.IsFence A B := by + intro A B + rcases hΩ with h | h + · rw [h] + · rw [h, isFence_reverse_iff] + have hff : ∀ {A B}, S₁.IsFenceFor P_set A B ↔ S₂.IsFenceFor P_set A B := by + intro A B; simp only [Society.IsFenceFor, hdisj, hfe, hpath] + have htr : S₁.IsTransaction P_set ↔ S₂.IsTransaction P_set := by + simp only [Society.IsTransaction, hff] + have hends : S₁.transactionEnds P_set = S₂.transactionEnds P_set := + transactionEnds_of_eq_or_reverse hG hΩ P_set + have hper : ∀ {P}, S₁.IsPeripheralIn P_set P ↔ S₂.IsPeripheralIn P_set P := by + intro P + rcases hΩ with h | h + · simp only [Society.IsPeripheralIn, hpath, hends, h] + · simp only [Society.IsPeripheralIn, hpath, hends, h, interval_reverse, or_comm] + simp only [Society.IsCrookedTransaction, htr, hper] + +omit [T2Space S] [CompactSpace S] [Nonempty S] in +/-- Reversing a cyclic permutation preserves `IsNaturalOrderFrom` (by reversing the circle). -/ +theorem IsNaturalOrderFrom.reverse {ν : α → S} {Ω : CyclicPerm α} {F : Set S} + (h : IsNaturalOrderFrom ν Ω F) : + IsNaturalOrderFrom ν Ω⁻¹ F := by + obtain ⟨hF, φ, hm, hc⟩ := h + let φ' : Circle ≃ₜ F := (Homeomorph.inv Circle).trans φ + have hφ' : ∀ w : Circle, (φ' w).1 = (φ w⁻¹).1 := fun _ => rfl + refine ⟨hF, φ', fun v hv => hm v hv, fun v₁ v₂ v₃ hcw => ?_⟩ + rw [isClockwise3_reverse_iff] at hcw + obtain ⟨t₁, t₃, t₂, ht13, ht32, ht21, e₁, e₃, e₂⟩ := hc v₁ v₃ v₂ hcw + refine ⟨-t₁, -t₂ + 2 * Real.pi, -t₃ + 2 * Real.pi, + by linarith, by linarith, by linarith, ?_, ?_, ?_⟩ + · rw [hφ', ← Circle.exp_neg, neg_neg, e₁] + · have hexp : (Circle.exp (-t₂ + 2 * Real.pi))⁻¹ = Circle.exp t₂ := by + rw [← Circle.exp_neg, show -(-t₂ + 2 * Real.pi) = t₂ - 2 * Real.pi by ring, + ← Surface.exp_add_two_pi' (t₂ - 2 * Real.pi), sub_add_cancel] + rw [hφ', hexp, e₂] + · have hexp : (Circle.exp (-t₃ + 2 * Real.pi))⁻¹ = Circle.exp t₃ := by + rw [← Circle.exp_neg, show -(-t₃ + 2 * Real.pi) = t₃ - 2 * Real.pi by ring, + ← Surface.exp_add_two_pi' (t₃ - 2 * Real.pi), sub_add_cancel] + rw [hφ', hexp, e₃] + +theorem drawingAgreesWithOArcHomeo_inv {G : Graph α β} {Γ : GraphDrawing G EuclideanPlane} + {Ω : CyclicPerm α} {C : Set EuclideanPlane} {φ : Circle ≃ₜ C} + (h : DrawingAgreesWithOArcHomeo Γ Ω C φ) : + DrawingAgreesWithOArcHomeo Γ Ω⁻¹ C ((Homeomorph.inv Circle).trans φ) := by + let φ' : Circle ≃ₜ C := (Homeomorph.inv Circle).trans φ + have hφ' : ∀ w : Circle, (φ' w).1 = (φ w⁻¹).1 := fun _ => rfl + refine ⟨fun v hv => h.1 v hv, fun v₁ v₂ v₃ hcw => ?_⟩ + rw [isClockwise3_reverse_iff] at hcw + obtain ⟨t₁, t₃, t₂, ht13, ht32, ht21, e₁, e₃, e₂⟩ := h.2 v₁ v₃ v₂ hcw + refine ⟨-t₁, -t₂ + 2 * Real.pi, -t₃ + 2 * Real.pi, + by linarith, by linarith, by linarith, ?_, ?_, ?_⟩ + · rw [hφ', ← Circle.exp_neg, neg_neg] + exact e₁ + · have hexp : (Circle.exp (-t₂ + 2 * Real.pi))⁻¹ = Circle.exp t₂ := by + rw [← Circle.exp_neg, show -(-t₂ + 2 * Real.pi) = t₂ - 2 * Real.pi by ring, + ← Surface.exp_add_two_pi' (t₂ - 2 * Real.pi), sub_add_cancel] + rw [hφ', hexp] + exact e₂ + · have hexp : (Circle.exp (-t₃ + 2 * Real.pi))⁻¹ = Circle.exp t₃ := by + rw [← Circle.exp_neg, show -(-t₃ + 2 * Real.pi) = t₃ - 2 * Real.pi by ring, + ← Surface.exp_add_two_pi' (t₃ - 2 * Real.pi), sub_add_cancel] + rw [hφ', hexp] + exact e₃ + +omit [Nonempty S] in +/-- Plane disc coordinates for `D` chosen (reflecting by `conjPlane` if necessary) so that a given +boundary parametrization `φ : Circle ≃ₜ discBd D` transports to a clockwise boundary homeomorphism +on `subBd (f '' D)`. -/ +theorem exists_clockwise_plane_disc_coordinates {D : Set S} (hD : IsClosedDisc D) + (φ : Circle ≃ₜ discBd D) : + ∃ (f : S → EuclideanPlane) (g : EuclideanPlane → S) (φ' : Circle ≃ₜ subBd (f '' D)), + Continuous f ∧ InjOn f D ∧ ContinuousOn g (f '' D) ∧ LeftInvOn g f D ∧ + (∀ E ⊆ D, IsClosedDisc E → IsClosedDisc (f '' E) ∧ subBd (f '' E) = f '' discBd E) ∧ + IsClockwiseDiscHomeo (f '' D) φ' ∧ ∀ t : Circle, (φ' t).1 = f (φ t).1 := by + classical + obtain ⟨f₀, g₀, hf₀, hi₀, hg₀, hgf₀, hdisc₀⟩ := exists_plane_disc_coordinates hD + obtain ⟨hΔ₀_disc, hbd₀⟩ := hdisc₀ D Subset.rfl hD + obtain ⟨φ'₀, hφ'₀⟩ := transport_circle_parametrization hf₀.continuousOn hg₀ hgf₀ + (GraphMinor.GM11.discBd_subset D) hbd₀ φ + by_cases hcw : IsClockwiseDiscHomeo (f₀ '' D) φ'₀ + · exact ⟨f₀, g₀, φ'₀, hf₀, hi₀, hg₀, hgf₀, hdisc₀, hcw, hφ'₀⟩ + · let f : S → EuclideanPlane := conjPlane ∘ f₀ + let g : EuclideanPlane → S := g₀ ∘ conjPlane.symm + have hf : Continuous f := conjPlane.continuous.comp hf₀ + have hi : InjOn f D := conjPlane.injective.comp_injOn hi₀ + have hg : ContinuousOn g (f '' D) := by + refine hg₀.comp conjPlane.symm.continuous.continuousOn ?_ + rintro _ ⟨x, hx, rfl⟩ + exact ⟨x, hx, by simp [f]⟩ + have hgf : LeftInvOn g f D := fun x hx => by simp [f, g, hgf₀ hx] + have hdisc : ∀ E ⊆ D, IsClosedDisc E → + IsClosedDisc (f '' E) ∧ subBd (f '' E) = f '' discBd E := by + intro E hED hE + obtain ⟨hEd, hEb⟩ := hdisc₀ E hED hE + have himg : f '' E = conjPlane '' (f₀ '' E) := Set.image_comp conjPlane f₀ E + refine ⟨himg ▸ isClosedDisc_image_conjPlane hEd, ?_⟩ + rw [himg, subBd_image_conjPlane, hEb, ← Set.image_comp] + obtain ⟨φ', hφ'⟩ := transport_circle_parametrization hf.continuousOn hg hgf + (GraphMinor.GM11.discBd_subset D) (hdisc D Subset.rfl hD).2 φ + have hcw' : IsClockwiseDiscHomeo (f '' D) φ' := by + have hcw_conj := isClockwiseDiscHomeo_conjPlane_of_not hΔ₀_disc rfl hcw + have himg : f '' D = conjPlane '' (f₀ '' D) := Set.image_comp conjPlane f₀ D + intro x hx + rw [himg] at hx + have h1 := hcw_conj x hx + have hfun : (fun w : Circle => complexPlane.symm (φ' w).1) = + (fun w : Circle => complexPlane.symm + ((φ'₀.trans (conjPlane.toHomeomorph.image (subBd (f₀ '' D)))) w).1) := by + ext w + exact congrArg complexPlane.symm ((hφ' w).trans (congrArg conjPlane (hφ'₀ w).symm)) + rwa [hfun] + exact ⟨f, g, φ', hf, hi, hg, hgf, hdisc, hcw', hφ'⟩ + +/-- Given two nested closed discs `D₀ ⊆ D` on a surface `S` with natural orders `Ω` on `discBd D` +and `Ω₀` on `discBd D₀`, there is a choice of `Ω₀' ∈ {Ω₀, Ω₀⁻¹}` whose orientation is compatible +with `Ω`, so that any drawing between `D` and `D₀` with boundary orders `Ω` and `Ω₀'` has a +presentation. -/ +theorem exists_presentation_of_drawing {D D₀ : Set S} (hD : IsClosedDisc D) (hD₀ : IsClosedDisc D₀) + (hD₀D : D₀ ⊆ D) {ν : α → S} {Ω Ω₀ : CyclicPerm α} + (hnat : IsNaturalOrderFrom ν Ω (discBd D)) (hnat₀ : IsNaturalOrderFrom ν Ω₀ (discBd D₀)) : + ∃ Ω₀' : CyclicPerm α, (Ω₀' = Ω₀ ∨ Ω₀' = Ω₀⁻¹) ∧ Ω₀'.bar = Ω₀.bar ∧ + IsNaturalOrderFrom ν Ω₀' (discBd D₀) ∧ + ∀ (N : Neighborhood α β) (Y : GraphDrawing N.G S), + N.Ω = Ω → N.Ω₀ = Ω₀' → + Y.drawing.U ⊆ D \ discInt D₀ → + (∀ v : V(N.G), (Y.iso.vertexEquiv v).1 = ν v.1) → + (∀ v ∈ V(N.G), ν v ∈ discBd D ↔ v ∈ N.Ω.bar) → + (∀ v ∈ V(N.G), ν v ∈ discBd D₀ ↔ v ∈ N.Ω₀.bar) → + ∃ (P : Presentation N) (f : S → EuclideanPlane), Continuous f ∧ InjOn f D ∧ + P.Δ = f '' D ∧ P.Δ₀ = f '' D₀ ∧ + (∀ E ⊆ D, IsClosedDisc E → IsClosedDisc (f '' E) ∧ subBd (f '' E) = f '' discBd E) ∧ + ∀ J, graphDrawingSubgraphU P.Γ J = f '' graphDrawingSubgraphU Y J := by + classical + obtain ⟨-, φ, hm, hc⟩ := hnat + obtain ⟨-, φ₀, hm₀, hc₀⟩ := id hnat₀ + obtain ⟨f, g, φ', hf, hi, hg, hgf, hdisc, hcw_D, hφ'⟩ := + exists_clockwise_plane_disc_coordinates hD φ + obtain ⟨hΔ, hbd⟩ := hdisc D Subset.rfl hD + obtain ⟨hΔ₀, hbd₀⟩ := hdisc D₀ hD₀D hD₀ + obtain ⟨φ₀', hφ₀'⟩ := transport_circle_parametrization hf.continuousOn hg hgf + ((GraphMinor.GM11.discBd_subset D₀).trans hD₀D) hbd₀ φ₀ + let Ω₀' : CyclicPerm α := if IsClockwiseDiscHomeo (f '' D₀) φ₀' then Ω₀ else Ω₀⁻¹ + have hΩ₀'_or : Ω₀' = Ω₀ ∨ Ω₀' = Ω₀⁻¹ := by + by_cases h : IsClockwiseDiscHomeo (f '' D₀) φ₀' <;> simp [Ω₀', h] + have hΩ₀'_bar : Ω₀'.bar = Ω₀.bar := by + rcases hΩ₀'_or with h | h <;> simp [h] + have hnat₀' : IsNaturalOrderFrom ν Ω₀' (discBd D₀) := by + rcases hΩ₀'_or with h | h + · rw [h]; exact hnat₀ + · rw [h]; exact hnat₀.reverse + refine ⟨Ω₀', hΩ₀'_or, hΩ₀'_bar, hnat₀', ?_⟩ + intro N Y hNΩ hNΩ₀ hY hν hbar hbar₀ + have hUD : Y.drawing.U ⊆ D := fun x hx => (hY hx).1 + have hUc : IsCompact Y.drawing.U := hD.isCompact.of_isClosed_subset Y.drawing.isClosed_U hUD + obtain ⟨Γ, hU, hV, hv, hvs, -, hsub⟩ := GM09.GraphDrawing.transportOn Y hUc hf.continuousOn + (hi.mono hUD) + have hvss : ∀ v (hv' : v ∈ V(N.G)), graphDrawingVertexSet Γ v = {f (ν v)} := fun v hv' => by + rw [graphDrawingVertexSet_eq_singleton Γ hv', hv ⟨v, hv'⟩, hν ⟨v, hv'⟩] + have hνD : ∀ v ∈ V(N.G), ν v ∈ D := fun v hv' => by + have := Y.drawing.V_subset_U (Y.iso.vertexEquiv ⟨v, hv'⟩).2 + rw [hν ⟨v, hv'⟩] at this + exact hUD this + have hagree_of : ∀ {E : Set S} {Ω_E : CyclicPerm α} {φ_E : Circle ≃ₜ discBd E} + {φ'_E : Circle ≃ₜ subBd (f '' E)}, + E ⊆ D → subBd (f '' E) = f '' discBd E → Ω_E.bar ⊆ V(N.G) → + (∀ v ∈ Ω_E.bar, ν v ∈ discBd E) → + (∀ v₁ v₂ v₃ : α, Ω_E.IsClockwise3 v₁ v₂ v₃ → + ∃ t₁ t₂ t₃ : ℝ, t₁ < t₂ ∧ t₂ < t₃ ∧ t₃ < t₁ + 2 * Real.pi ∧ + (φ_E (Circle.exp t₁)).1 = ν v₁ ∧ + (φ_E (Circle.exp t₂)).1 = ν v₂ ∧ + (φ_E (Circle.exp t₃)).1 = ν v₃) → + (∀ t : Circle, (φ'_E t).1 = f (φ_E t).1) → + DrawingAgreesWithOArcHomeo Γ Ω_E (subBd (f '' E)) φ'_E := by + intro E Ω_E φ_E φ'_E _ hb hΩ_sub hm_E hc_E hφ'_E + refine ⟨fun v hv' => ?_, fun v₁ v₂ v₃ h₃ => ?_⟩ + · rw [hvss v (hΩ_sub hv'), singleton_subset_iff, hb] + exact mem_image_of_mem f (hm_E v hv') + · obtain ⟨t₁, t₂, t₃, h₁₂, h₂₃, h₃₁, e₁, e₂, e₃⟩ := hc_E v₁ v₂ v₃ h₃ + have hm₃ := (Ω_E.isClockwise3_iff.mp h₃).2.2.2 + refine ⟨t₁, t₂, t₃, h₁₂, h₂₃, h₃₁, ?_, ?_, ?_⟩ + · rw [hvss v₁ (hΩ_sub hm₃.1), hφ'_E, e₁]; rfl + · rw [hvss v₂ (hΩ_sub hm₃.2.1), hφ'_E, e₂]; rfl + · rw [hvss v₃ (hΩ_sub hm₃.2.2.1), hφ'_E, e₃]; rfl + have hbetween : Γ.drawing.U ⊆ f '' D \ interior (f '' D₀) := by + rw [hU] + rintro _ ⟨x, hxQ, rfl⟩ + have hxD := (hY hxQ).1 + refine ⟨mem_image_of_mem f hxD, fun hxint => ?_⟩ + obtain ⟨y, hy, hyx⟩ := interior_subset hxint + have hyx' : y = x := hi (hD₀D hy) hxD hyx + have hxD₀ : x ∈ D₀ := hyx' ▸ hy + have hxnotbd : x ∉ discBd D₀ := by + intro hxb + have hfb : f x ∈ subBd (f '' D₀) := hbd₀.symm ▸ mem_image_of_mem f hxb + rw [subBd_eq_frontier] at hfb + exact hfb.2 hxint + exact (hY hxQ).2 ⟨hxD₀, hxnotbd⟩ + have hiff : ∀ (E : Set S), E ⊆ D → subBd (f '' E) = f '' discBd E → ∀ v ∈ V(N.G), + graphDrawingVertexSet Γ v ⊆ subBd (f '' E) ↔ ν v ∈ discBd E := by + intro E hED hbdE v hv' + rw [hvss v hv', singleton_subset_iff, hbdE] + constructor + · rintro ⟨y, hy, heq⟩ + exact hi (hED (GraphMinor.GM11.discBd_subset E hy)) (hνD v hv') heq ▸ hy + · exact mem_image_of_mem f + have hφ_agree : DrawingAgreesWithOArcHomeo Γ N.Ω (subBd (f '' D)) φ' := by + rw [hNΩ] + exact hagree_of Subset.rfl hbd (hNΩ ▸ N.bar_subset) hm hc hφ' + have hΩ₀_sub : Ω₀.bar ⊆ V(N.G) := by + rw [← hΩ₀'_bar, ← hNΩ₀] + exact N.bar₀_subset + have hφ₀_agree_base : DrawingAgreesWithOArcHomeo Γ Ω₀ (subBd (f '' D₀)) φ₀' := + hagree_of hD₀D hbd₀ hΩ₀_sub hm₀ hc₀ hφ₀' + have hinner : ∃ φ₀'' : Circle ≃ₜ subBd (f '' D₀), + IsClockwiseDiscHomeo (f '' D₀) φ₀'' ∧ + DrawingAgreesWithOArcHomeo Γ N.Ω₀ (subBd (f '' D₀)) φ₀'' := by + rw [hNΩ₀] + by_cases hcw₀ : IsClockwiseDiscHomeo (f '' D₀) φ₀' + · have hΩ₀'_eq : Ω₀' = Ω₀ := ite_eq_left hcw₀ + rw [hΩ₀'_eq] + exact ⟨φ₀', hcw₀, hφ₀_agree_base⟩ + · have hΩ₀'_eq : Ω₀' = Ω₀⁻¹ := ite_eq_right hcw₀ + rw [hΩ₀'_eq] + exact ⟨(Homeomorph.inv Circle).trans φ₀', + (isClockwiseDiscHomeo_or_inv hΔ₀ rfl φ₀').resolve_left hcw₀, + drawingAgreesWithOArcHomeo_inv hφ₀_agree_base⟩ + obtain ⟨φ₀'', hcw₀'', hφ₀''_agree⟩ := hinner + refine ⟨⟨Γ, f '' D, f '' D₀, hΔ, image_mono hD₀D, hbetween, + fun v hv' => (hiff D Subset.rfl hbd v hv').trans (hbar v hv'), + fun v hv' => (hiff D₀ hD₀D hbd₀ v hv').trans (hbar₀ v hv'), + ⟨φ', hcw_D, hφ_agree⟩, Or.inr ⟨hΔ₀, φ₀'', hcw₀'', hφ₀''_agree⟩⟩, f, hf, hi, rfl, rfl, hdisc, + hsub⟩ + +omit [T2Space S] [CompactSpace S] [Nonempty S] in +/-- Nested circuits around the inner disc give a nest. -/ +theorem hasBreadthGe_of_presentation {N : Neighborhood α β} (P : Presentation N) + (Y : GraphDrawing N.G S) {D D₀ : Set S} {f : S → EuclideanPlane} + (hΔ : P.Δ = f '' D) (hΔ₀ : P.Δ₀ = f '' D₀) + (hdisc : ∀ E ⊆ D, IsClosedDisc E → IsClosedDisc (f '' E) ∧ subBd (f '' E) = f '' discBd E) + (hpoints : ∀ J, graphDrawingSubgraphU P.Γ J = f '' graphDrawingSubgraphU Y J) + {s : ℕ} (K : Fin s → Graph α β) (E : Fin s → Set S) + (hK : ∀ i, IsGraphCircuit N.G (K i)) + (hDis : Pairwise (fun i j => Disjoint V(K i) V(K j))) + (hE : ∀ i, IsClosedDisc (E i) ∧ discBd (E i) = graphDrawingSubgraphU Y (K i) ∧ + D₀ ⊆ E i ∧ E i ⊆ D) + (hNest : ∀ i j, i ≤ j → E i ⊆ E j) : N.HasBreadthGe s := by + refine ⟨P, K, hK, hDis, fun i => f '' E i, ?_, ?_, ?_⟩ + · intro i + obtain ⟨hEi, hBd, _, hED⟩ := hE i + obtain ⟨hFi, hFb⟩ := hdisc (E i) hED hEi + exact ⟨hFi, by rw [hFb, hBd, hpoints]⟩ + · intro i + rw [hΔ₀, hΔ] + exact ⟨image_mono (hE i).2.2.1, image_mono (hE i).2.2.2⟩ + · intro i j hij + exact image_mono (hNest i j hij) + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Bridge.lean b/LeanPool/GraphMinor/GM14/Bridge.lean new file mode 100644 index 0000000000..252fff9145 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Bridge.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section9 +public import LeanPool.GraphMinor.GM14.Section10 +public import LeanPool.GraphMinor.GM15.Cited + +import LeanPool.GraphMinor.GM09.Bridge + +import LeanPool.GraphMinor.GM12.Section710 + +import LeanPool.GraphMinor.GM14.Section8 + +/-! +# Graph Minors XIV: Bridges to Graph Minors XV Cited Statements + +This file concludes the cited statements `GM15.GM14Theorem96Statement` and +`GM15.GM14Theorem101Statement` from `theorem_9_6` and `theorem_10_1`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +universe u v w + +/-- Bridge theorem concluding `GM15.GM14Theorem96Statement` from `theorem_9_6_proof`. -/ +theorem gm14_theorem_9_6 : + GM15.GM14Theorem96Statement.{u, v, w} := + theorem_9_6_proof + +/-- Bridge theorem concluding `GM15.GM14Theorem101Statement` from `theorem_10_1_proof`. -/ +theorem gm14_theorem_10_1 : + GM15.GM14Theorem101Statement.{u, v, w} := by + intro S _ _ α β G₀ H η θ μ T d hS hConn hV_fin hE_fin hRig hMetric h12 hEven hθ hnot_step hii + have h2cell : H.IsTwoCell := hMetric.1.1 + have hT : IsRespectfulDrawingTangle H θ T := hMetric.1 + have hi_path : ∀ (P : Graph α β) (u v : S), + u ∈ H.V → v ∈ H.V → + IsHPathWithEnds G₀ η.imageGraph P (η.vMap u) (η.vMap v) → + d {u} {v} < μ := by + intro P u v hu hv hP + exact not_le.mp fun hge => hnot_step ⟨P, u, v, hu, hv, hP, hge⟩ + have hii_no_eye : ∀ (Λ : Set S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) + (η_cl : SpanEmbedding (clearedSubdrawing H Λ) G₀), + IsLambdaZone H d (3 * μ + 3) Λ → + IsRigid (clearedSubdrawing H Λ) → + IsClearedTangle H T d θ (3 * μ + 3) Λ T' d' → + (∀ v ∈ (clearedSubdrawing H Λ).V, η_cl.vMap v = η.vMap v) → + (∀ e ∈ (clearedSubdrawing H Λ).E, η_cl.eMap e = η.eMap e) → + ¬ IsDrawingEye G₀ (clearedSubdrawing H Λ) η_cl (θ - 4 * (3 * μ + 3) - 2) T' Λ := by + rintro Λ T' d' η_cl ⟨z, _, hzone⟩ hRig_cl hT' hv he + exact hii z Λ T' d' η_cl hzone hT' hRig_cl hv he + exact theorem_10_1_proof + hS hConn G₀ H η T d θ μ hV_fin hE_fin h2cell hRig hT hMetric ⟨h12, hEven⟩ hθ hi_path hii_no_eye + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/BridgeFacts.lean b/LeanPool/GraphMinor/GM14/BridgeFacts.lean new file mode 100644 index 0000000000..456c89a98a --- /dev/null +++ b/LeanPool/GraphMinor/GM14/BridgeFacts.lean @@ -0,0 +1,315 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs + +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Bridges of a subgraph + +A component of the complement of a subgraph gives a bridge. These lemmas show that bridges cover +the vertices and edges of the ambient graph outside the subgraph and give their intersection +properties. +-/ + +public section + +namespace GraphMinor.GM14 + +open Set Graph GM06 GM09 Surface + +universe u v + +/-- For any component `C` of `deleteVertices G V(H_sub)`, the subgraph `B` formed by `C` and its +attachment edges to `V(H_sub)` is a bridge (`IsBridge G H_sub B`). -/ +theorem isBridge_of_component {α : Type u} {β : Type v} + {G H_sub C : Graph α β} (hH : H_sub ≤ G) + (hC : C ∈ graphComponents (deleteVertices G V(H_sub))) : + let V_B := V(C) ∪ {v ∈ V(H_sub) | ∃ e ∈ E(G), ∃ u ∈ V(C), G.IsLink e u v} + let E_B := E(C) ∪ {e ∈ E(G) | ∃ u ∈ V(C), ∃ v ∈ V(H_sub), G.IsLink e u v} + let B := (G.induce V_B).restrict E_B + IsBridge G H_sub B ∧ V(B) = V_B ∧ E(B) = E_B := by + intro V_B E_B B + have hC_del : C ≤ deleteVertices G V(H_sub) := hC.1 + have hdel_G : deleteVertices G V(H_sub) ≤ G := deleteVertices_le G V(H_sub) + have hC_G : C ≤ G := hC_del.trans hdel_G + have hVB_sub : V_B ⊆ V(G) := by + rintro v (hvC | ⟨hvH, _⟩) + · exact hC_G.vertexSet_mono hvC + · exact hH.vertexSet_mono hvH + have hB_le : B ≤ G := restrict_le.trans (G.induce_le hVB_sub) + have hVB_eq : V(B) = V_B := by + simp [B] + have hEB_eq : E(B) = E_B := by + ext e + simp only [B, edgeSet_restrict, mem_inter_iff, edgeSet_induce] + refine ⟨fun h => h.2, fun he => ⟨?_, he⟩⟩ + rcases he with heC | ⟨heG, u, huC, v, hvH, hlink⟩ + · obtain ⟨x, y, hxy⟩ := C.exists_isLink_of_mem_edgeSet heC + exact ⟨x, y, hxy.mono hC_G, Or.inl hxy.left_mem, Or.inl hxy.right_mem⟩ + · exact ⟨u, v, hlink, Or.inl huC, Or.inr ⟨hvH, e, heG, u, huC, hlink⟩⟩ + refine ⟨⟨hH, hB_le, Or.inr ⟨C, hC, hVB_eq, hEB_eq⟩⟩, hVB_eq, hEB_eq⟩ + +/-- Every vertex of `G` outside `V(H_sub)` belongs to a bridge of `H_sub` in `G`. -/ +theorem exists_bridge_of_mem_vertexSet {α : Type u} {β : Type v} + {G H_sub : Graph α β} (hH : H_sub ≤ G) {v : α} (hvG : v ∈ V(G)) (hvH : v ∉ V(H_sub)) : + ∃ B : Graph α β, IsBridge G H_sub B ∧ v ∈ V(B) := by + have hv_del : v ∈ V(deleteVertices G V(H_sub)) := ⟨hvG, hvH⟩ + obtain ⟨C, hC, hvC⟩ := exists_graphComponent_of_mem hv_del + obtain ⟨hB, hVB, _⟩ := isBridge_of_component hH hC + exact ⟨_, hB, hVB ▸ Or.inl hvC⟩ + +/-- Every edge of `G` outside `E(H_sub)` belongs to a bridge of `H_sub` in `G`. -/ +theorem exists_bridge_of_mem_edgeSet {α : Type u} {β : Type v} + {G H_sub : Graph α β} (hH : H_sub ≤ G) {e : β} (heG : e ∈ E(G)) (heH : e ∉ E(H_sub)) : + ∃ B : Graph α β, IsBridge G H_sub B ∧ e ∈ E(B) := by + obtain ⟨u, v, hlink⟩ := G.exists_isLink_of_mem_edgeSet heG + by_cases huH : u ∈ V(H_sub) + · by_cases hvH : v ∈ V(H_sub) + · let B := (G.induce {u, v}).restrict {e} + have hsub : ({u, v} : Set α) ⊆ V(G) := by + rintro x (rfl | rfl) + · exact hlink.left_mem + · exact hlink.right_mem + have hB_le : B ≤ G := restrict_le.trans (G.induce_le hsub) + have hVB : V(B) = {u, v} := by simp [B] + have hEB : E(B) = {e} := by + ext e' + simp only [B, edgeSet_restrict, mem_inter_iff, edgeSet_induce, mem_singleton_iff] + refine ⟨fun h => h.2, ?_⟩ + rintro rfl + exact ⟨⟨u, v, hlink, Or.inl rfl, Or.inr rfl⟩, rfl⟩ + exact ⟨B, ⟨hH, hB_le, Or.inl ⟨e, ⟨heG, heH⟩, u, huH, v, hvH, hlink, hVB, hEB⟩⟩, + hEB ▸ mem_singleton e⟩ + · have hv_del : v ∈ V(deleteVertices G V(H_sub)) := ⟨hlink.right_mem, hvH⟩ + obtain ⟨C, hC, hvC⟩ := exists_graphComponent_of_mem hv_del + obtain ⟨hB, _, hEB⟩ := isBridge_of_component hH hC + refine ⟨_, hB, hEB.symm ▸ Or.inr ⟨heG, v, hvC, u, huH, hlink.symm⟩⟩ + · have hu_del : u ∈ V(deleteVertices G V(H_sub)) := ⟨hlink.left_mem, huH⟩ + obtain ⟨C, hC, huC⟩ := exists_graphComponent_of_mem hu_del + obtain ⟨hB, _, hEB⟩ := isBridge_of_component hH hC + by_cases hvH : v ∈ V(H_sub) + · exact ⟨_, hB, hEB.symm ▸ Or.inr ⟨heG, u, huC, v, hvH, hlink⟩⟩ + · have hlink_del : (deleteVertices G V(H_sub)).IsLink e u v := + (deleteVertices_isLink G V(H_sub)).mpr ⟨hlink, huH, hvH⟩ + have hvC : v ∈ V(C) := (mem_graphComponent_iff_of_isLink hC hlink_del).mp huC + have heC : e ∈ E(C) := + (isClosedSubgraph_of_isGraphComponent hC).closed ⟨v, hlink_del⟩ huC + exact ⟨_, hB, hEB.symm ▸ Or.inl heC⟩ + +private theorem bridge_edge_with_ends_in_subgraph {α : Type u} {β : Type v} + {G H_sub B : Graph α β} (hB : IsBridge G H_sub B) {e : β} {x y : α} + (hxy : G.IsLink e x y) (hx : x ∈ V(H_sub)) (hy : y ∈ V(H_sub)) (heB : e ∈ E(B)) : + e ∉ E(H_sub) ∧ V(B) = {x, y} ∧ E(B) = {e} := by + rcases hB.2.2 with ⟨e₀, he₀, u, _, v, _, huv, hVB, hEB⟩ | ⟨C, hC, _, hEB⟩ + · rw [hEB, mem_singleton_iff] at heB + subst heB + refine ⟨he₀.2, ?_, hEB⟩ + rw [hVB] + rcases huv.eq_and_eq_or_eq_and_eq hxy with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · exact Set.pair_comm u v + · have hC_del : C ≤ deleteVertices G V(H_sub) := hC.1 + rw [hEB] at heB + rcases heB with heC | ⟨_, u, huC, v, _, huv⟩ + · obtain ⟨u, v, huv_C⟩ := C.exists_isLink_of_mem_edgeSet heC + have huv_G : G.IsLink e u v := huv_C.mono (hC_del.trans (deleteVertices_le G V(H_sub))) + have hu_not_H : u ∉ V(H_sub) := (hC_del.vertexSet_mono huv_C.left_mem).2 + rcases huv_G.eq_and_eq_or_eq_and_eq hxy with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact (hu_not_H hx).elim + · exact (hu_not_H hy).elim + · have hu_not_H : u ∉ V(H_sub) := (hC_del.vertexSet_mono huC).2 + rcases huv.eq_and_eq_or_eq_and_eq hxy with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact (hu_not_H hx).elim + · exact (hu_not_H hy).elim + +/-- Every bridge `B` of `H_sub` in `G` is edge-disjoint from `H_sub`. -/ +theorem isBridge_disjoint_edgeSet {α : Type u} {β : Type v} + {G H_sub B : Graph α β} (hB : IsBridge G H_sub B) : + Disjoint E(B) E(H_sub) := by + refine Set.disjoint_left.mpr fun e heB heH => ?_ + obtain ⟨x, y, hxy⟩ := H_sub.exists_isLink_of_mem_edgeSet heH + exact (bridge_edge_with_ends_in_subgraph hB (hxy.mono hB.1) hxy.left_mem hxy.right_mem heB).1 heH + +/-- Two bridges `B₁, B₂` of `H_sub` in `G` that share a vertex outside `V(H_sub)` or share an edge +are equal (`B₁ = B₂`). -/ +theorem isBridge_eq_of_inter {α : Type u} {β : Type v} + {G H_sub B₁ B₂ : Graph α β} (hB₁ : IsBridge G H_sub B₁) (hB₂ : IsBridge G H_sub B₂) : + (∀ v ∈ V(B₁) ∩ V(B₂), v ∉ V(H_sub) → B₁ = B₂) ∧ + (∀ e ∈ E(B₁) ∩ E(B₂), B₁ = B₂) := by + have hcomp_of_vertex : ∀ {B : Graph α β} {v : α}, + IsBridge G H_sub B → v ∈ V(B) → v ∉ V(H_sub) → + ∃ C ∈ graphComponents (deleteVertices G V(H_sub)), + v ∈ V(C) ∧ + V(B) = V(C) ∪ {w ∈ V(H_sub) | ∃ e ∈ E(G), ∃ x ∈ V(C), G.IsLink e x w} ∧ + E(B) = E(C) ∪ {e ∈ E(G) | ∃ x ∈ V(C), ∃ w ∈ V(H_sub), G.IsLink e x w} := by + intro B v hB hvB hv_not_H + rcases hB.2.2 with ⟨e, _, w₁, hw₁, w₂, hw₂, _, hVB, _⟩ | ⟨C, hC, hVB, hEB⟩ + · rw [hVB] at hvB + rcases hvB with rfl | rfl + · exact (hv_not_H hw₁).elim + · exact (hv_not_H hw₂).elim + · rw [hVB] at hvB + rcases hvB with hvC | ⟨hvH, _⟩ + · exact ⟨C, hC, hvC, hVB, hEB⟩ + · exact (hv_not_H hvH).elim + have h_eq_of_vertex : ∀ v ∈ V(B₁) ∩ V(B₂), v ∉ V(H_sub) → B₁ = B₂ := by + rintro v ⟨hv₁, hv₂⟩ hv_not_H + obtain ⟨C₁, hC₁, hvC₁, hVB₁, hEB₁⟩ := hcomp_of_vertex hB₁ hv₁ hv_not_H + obtain ⟨C₂, hC₂, hvC₂, hVB₂, hEB₂⟩ := hcomp_of_vertex hB₂ hv₂ hv_not_H + have hC_eq : C₁ = C₂ := isGraphComponent_eq_of_mem_inter hC₁ hC₂ ⟨v, hvC₁, hvC₂⟩ + refine (Compatible.of_le_le hB₁.2.1 hB₂.2.1).ext ?_ ?_ + · rw [hVB₁, hVB₂, hC_eq] + · rw [hEB₁, hEB₂, hC_eq] + refine ⟨h_eq_of_vertex, ?_⟩ + rintro e ⟨he₁, he₂⟩ + obtain ⟨x, y, hxy₁⟩ := B₁.exists_isLink_of_mem_edgeSet he₁ + have hxy_G : G.IsLink e x y := hxy₁.mono hB₁.2.1 + have hxy₂ : B₂.IsLink e x y := (hB₂.2.1.isLink_iff he₂).mpr hxy_G + by_cases hxH : x ∈ V(H_sub) + · by_cases hyH : y ∈ V(H_sub) + · obtain ⟨_, hVB₁, hEB₁⟩ := + bridge_edge_with_ends_in_subgraph hB₁ hxy_G hxH hyH he₁ + obtain ⟨_, hVB₂, hEB₂⟩ := bridge_edge_with_ends_in_subgraph hB₂ hxy_G hxH hyH he₂ + exact (Compatible.of_le_le hB₁.2.1 hB₂.2.1).ext + (hVB₁.trans hVB₂.symm) (hEB₁.trans hEB₂.symm) + · exact h_eq_of_vertex y ⟨hxy₁.right_mem, hxy₂.right_mem⟩ hyH + · exact h_eq_of_vertex x ⟨hxy₁.left_mem, hxy₂.left_mem⟩ hxH + +/-- Two bridges that share a vertex outside the subgraph or share an edge have equal vertex sets. -/ +theorem isBridge_vertexSet_eq_of_inter {α : Type u} {β : Type v} + {G H_sub B₁ B₂ : Graph α β} (hB₁ : IsBridge G H_sub B₁) (hB₂ : IsBridge G H_sub B₂) : + (∀ v ∈ V(B₁) ∩ V(B₂), v ∉ V(H_sub) → V(B₁) = V(B₂)) ∧ + (∀ e ∈ E(B₁) ∩ E(B₂), V(B₁) = V(B₂)) := by + obtain ⟨hvertex, hedge⟩ := isBridge_eq_of_inter hB₁ hB₂ + exact ⟨fun v hv hvH => congrArg Graph.vertexSet (hvertex v hv hvH), + fun e he => congrArg Graph.vertexSet (hedge e he)⟩ + +/-- If `C` is a connected component of `deleteVertices G V(H_sub)` and `u', v' ∈ V(H_sub)` are +distinct vertices linked in `G` by edges `e₁, e₂` to vertices `x₁, x₂ ∈ V(C)`, then there is an +`H_sub`-path `P` in `G` with ends `u'` and `v'`. -/ +theorem exists_isHPathWithEnds_of_component_attachments {α : Type u} {β : Type v} + {G H_sub C : Graph α β} + (hH : H_sub ≤ G) (hC : C ∈ graphComponents (deleteVertices G V(H_sub))) + {u' v' x₁ x₂ : α} {e₁ e₂ : β} + (hu' : u' ∈ V(H_sub)) (hv' : v' ∈ V(H_sub)) (huv' : u' ≠ v') + (hx₁ : x₁ ∈ V(C)) (hx₂ : x₂ ∈ V(C)) + (he₁ : G.IsLink e₁ u' x₁) (he₂ : G.IsLink e₂ x₂ v') : + ∃ P : Graph α β, IsHPathWithEnds G H_sub P u' v' := by + have hC_del : C ≤ deleteVertices G V(H_sub) := hC.1 + have hdel_G : deleteVertices G V(H_sub) ≤ G := deleteVertices_le G V(H_sub) + have hC_G : C ≤ G := hC_del.trans hdel_G + have hVC_disj : ∀ w ∈ V(C), w ∉ V(H_sub) := fun w hw => + (hC_del.vertexSet_mono hw).2 + obtain ⟨W₀⟩ := hC.2.1.2 x₁ hx₁ x₂ hx₂ + obtain ⟨W, hW_sim, _, _⟩ := exists_isSimple_subwalk W₀ + obtain ⟨W_G, hWG_sup, hWG_ed⟩ := exists_walk_up_of_le hC_G W + let W_full : GraphWalk G u' v' := + GraphWalk.cons he₁ (W_G.append (GraphWalk.cons he₂ (GraphWalk.nil he₂.right_mem))) + have hWf_sup : W_full.support = u' :: (W.support ++ [v']) := by + simp [W_full, GraphWalk.support_append, hWG_sup] + have hWf_ed : W_full.edges = e₁ :: (W.edges ++ [e₂]) := by + simp [W_full, GraphWalk.edges_append, hWG_ed] + have hu'_not_W : u' ∉ W.support := fun h => + hVC_disj u' (W.mem_vertexSet_of_mem_support h) hu' + have hv'_not_W : v' ∉ W.support := fun h => + hVC_disj v' (W.mem_vertexSet_of_mem_support h) hv' + have hWf_sim : W_full.IsSimple := by + unfold GraphWalk.IsSimple + rw [hWf_sup, List.nodup_cons] + refine ⟨?_, ?_⟩ + · simp only [List.mem_append, List.mem_singleton, not_or] + exact ⟨hu'_not_W, huv'⟩ + · rw [List.nodup_append] + refine ⟨hW_sim, List.nodup_singleton v', fun z hz w hw hzw => ?_⟩ + simp only [List.mem_singleton] at hw + subst hw hzw + exact hv'_not_W hz + let P := walkSubgraph W_full + refine ⟨P, hH, isGraphPathWithEnds_walkSubgraph hWf_sim, huv', hu', hv', ?_, ?_⟩ + · rw [vertexSet_walkSubgraph] + ext z + simp only [mem_inter_iff, mem_ofPred_eq, hWf_sup, List.mem_cons, List.mem_append, + List.not_mem_nil, or_false, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨rfl | hzW | rfl, hzH⟩ + · exact Or.inl rfl + · exact False.elim (hVC_disj z (W.mem_vertexSet_of_mem_support hzW) hzH) + · exact Or.inr rfl + · rintro (rfl | rfl) + · exact ⟨Or.inl rfl, hu'⟩ + · exact ⟨Or.inr (Or.inr rfl), hv'⟩ + · rw [edgeSet_walkSubgraph] + refine Set.disjoint_left.mpr fun e heP heH => ?_ + simp only [mem_ofPred_eq, hWf_ed, List.mem_cons, List.mem_append, + List.not_mem_nil, or_false] at heP + rcases heP with rfl | heW | rfl + · have hlinkH : H_sub.IsLink e u' x₁ := (hH.isLink_iff heH).mpr he₁ + exact hVC_disj x₁ hx₁ hlinkH.right_mem + · have heC : e ∈ E(C) := walk_edges_subset_edgeSet W e heW + have he_del : e ∈ E(deleteVertices G V(H_sub)) := hC_del.edgeSet_mono heC + obtain ⟨w₁, w₂, hlink_del⟩ := exists_isLink_of_mem_edgeSet he_del + have hlink_G : G.IsLink e w₁ w₂ := hlink_del.mono hdel_G + have hlink_H : H_sub.IsLink e w₁ w₂ := (hH.isLink_iff heH).mpr hlink_G + exact hlink_del.left_mem.2 hlink_H.left_mem + · have hlinkH : H_sub.IsLink e x₂ v' := (hH.isLink_iff heH).mpr he₂ + exact hVC_disj x₂ hx₂ hlinkH.left_mem + +/-- If `B` is a bridge of `H_sub` in `G` and `u', v' ∈ V(B) ∩ V(H_sub)` are distinct, then there is +an `H_sub`-path `P` in `G` with ends `u'` and `v'`. -/ +theorem exists_isHPathWithEnds_of_isBridge {α : Type u} {β : Type v} + {G H_sub B : Graph α β} + (hB : IsBridge G H_sub B) {u' v' : α} + (hu'B : u' ∈ V(B)) (hv'B : v' ∈ V(B)) + (hu'H : u' ∈ V(H_sub)) (hv'H : v' ∈ V(H_sub)) (huv' : u' ≠ v') : + ∃ P : Graph α β, IsHPathWithEnds G H_sub P u' v' := by + rcases hB.2.2 with ⟨e, he, w₁, _, w₂, _, hlink_w, hVB, _⟩ | ⟨C, hC, hVB, _⟩ + · rw [hVB] at hu'B hv'B + have hlink : G.IsLink e u' v' := by + rcases hu'B with rfl | rfl <;> rcases hv'B with rfl | rfl + · exact False.elim (huv' rfl) + · exact hlink_w + · exact hlink_w.symm + · exact False.elim (huv' rfl) + let W : GraphWalk G u' v' := GraphWalk.cons hlink (GraphWalk.nil hlink.right_mem) + have hW_sup : W.support = [u', v'] := rfl + have hW_ed : W.edges = [e] := rfl + have hW_sim : W.IsSimple := by + unfold GraphWalk.IsSimple + rw [hW_sup] + simp [huv'] + refine ⟨walkSubgraph W, hB.1, isGraphPathWithEnds_walkSubgraph hW_sim, huv', hu'H, hv'H, ?_, ?_⟩ + · rw [vertexSet_walkSubgraph, hW_sup] + ext z + simp only [mem_inter_iff, mem_ofPred_eq, List.mem_cons, List.not_mem_nil, or_false, + mem_insert_iff, mem_singleton_iff] + exact ⟨fun h => h.1, fun h => ⟨h, h.elim (fun h₁ => h₁ ▸ hu'H) (fun h₂ => h₂ ▸ hv'H)⟩⟩ + · rw [edgeSet_walkSubgraph, hW_ed] + refine Set.disjoint_left.mpr fun f hfP hfH => ?_ + simp only [mem_ofPred_eq, List.mem_cons, List.not_mem_nil, or_false] at hfP + subst hfP + exact he.2 hfH + · rw [hVB] at hu'B hv'B + have hVC_disj : ∀ w ∈ V(C), w ∉ V(H_sub) := fun w hw => (hC.1.vertexSet_mono hw).2 + have hu'E : ∃ e₁ ∈ E(G), ∃ x₁ ∈ V(C), G.IsLink e₁ x₁ u' := by + rcases hu'B with hu'C | ⟨_, h⟩ + · exact False.elim (hVC_disj u' hu'C hu'H) + · exact h + have hv'E : ∃ e₂ ∈ E(G), ∃ x₂ ∈ V(C), G.IsLink e₂ x₂ v' := by + rcases hv'B with hv'C | ⟨_, h⟩ + · exact False.elim (hVC_disj v' hv'C hv'H) + · exact h + obtain ⟨e₁, _, x₁, hx₁, hlink₁⟩ := hu'E + obtain ⟨e₂, _, x₂, hx₂, hlink₂⟩ := hv'E + exact exists_isHPathWithEnds_of_component_attachments hB.1 hC hu'H hv'H huv' hx₁ hx₂ + hlink₁.symm hlink₂ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Cited.lean b/LeanPool/GraphMinor/GM14/Cited.lean new file mode 100644 index 0000000000..8f2bc08b1a --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Cited.lean @@ -0,0 +1,215 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.Surface.TopologyStatements + +/-! +# Results cited in Graph Minors XIV + +This file states as `Prop`s the results from other papers of the series and external theorems that +are cited in *Graph Minors. XIV. Extending an embedding* (JCTB 65 (1995) 23–50) and are proved in +parallel tracks: + +* `GM07Theorem42Statement`: Graph Minors VII, (4.2) (page 222), used in Section 9 (page 43). +* `GM07Theorem119Statement`: Graph Minors VII, (11.9) (page 253), used in Section 9 (page 43). +* `GM09Theorem91Statement`: Graph Minors IX, (9.1) (page 62), used in Section 8 (page 42). +* `GM09Theorem104Statement`: Graph Minors IX, (10.4) (page 65), used in Section 8 (page 40). +* `GM11Theorem63Statement`: Graph Minors XI, (6.3) (page 89), used in Section 7 (page 36). +* `GM11Theorem810Statement`: Graph Minors XI, (8.10) (page 100), used in Section 9 (pages 43–44). +* `GM11Theorem812Statement`: Graph Minors XI, (8.12) (page 102), used in Section 7 (page 35). +* `GM12Theorem710Statement`: Graph Minors XII, (7.10) (page 270), which gives (3.2) of XIV + (page 28). +* `WhitneyPlanarUniquenessStatement`: Whitney's theorem on uniqueness of embeddings of subdivisions + of simple 3-connected graphs in the 2-sphere, used in the proof of (6.4) (page 34). +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 + Hypergraph + +universe u v + +/-- Statement of Graph Minors VII, (4.2) (page 222): +"Let $\Sigma$ be a connected surface with $bd(\Sigma) = \emptyset$, and let $Y \subseteq +\Sigma$ be connected and open. Suppose that every $O$-arc included in $Y$ bounds a disc +included in $Y$. Then either $\Sigma$ is a sphere and $Y = \Sigma$, or $Y$ is an open disc." -/ +def GM07Theorem42Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsSurface S → ConnectedSpace S → bd S = ∅ → + ∀ Y : Set S, IsConnected Y → IsOpen Y → + (∀ F : Set S, IsOArc F → F ⊆ Y → ∃ Δ : Set S, IsClosedDisc Δ ∧ subBd Δ = F ∧ Δ ⊆ Y) → + (IsSphere S ∧ Y = univ) ∨ IsOpenDisc Y + +/-- Closed-surface form of Graph Minors VII, (11.9) (page 253): +"If $\Sigma$ is connected and $Z \subseteq \Sigma$ is flat and l.a.c., and either $Z$ is +closed or $Z$ is arc-connected, then there is an open simply connected subset $Y \subseteq +\Sigma$ with $Z \subseteq Y$." + +For surfaces with boundary, `GM07.gm07_theorem_11_9_subset` uses `IsSimplyConnectedSubset`. -/ +def GM07Theorem119Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsSurface S → ConnectedSpace S → bd S = ∅ → + ∀ Z : Set S, IsFlat Z → IsLocallyArcConnected Z → + (IsClosed Z ∨ IsArcConnected Z) → + ∃ Y : Set S, IsOpen Y ∧ IsArcSimplyConnected Y ∧ Z ⊆ Y + +/-- Statement of Graph Minors IX, (9.1) (page 62): +"If the composition of a society $(G, \Omega)$ with some rural neighborhood has a crooked +transaction of cardinality $\ge p$, then so does $(G, \Omega)$." -/ +def GM09Theorem91Statement : Prop := + ∀ {α : Type u} {β : Type v} (S_comp S : Society α β) (N : Neighborhood α β) + (p : ℕ) (P_set : Set (Graph α β)), + N.IsRural → S_comp.IsComposition S N → + S_comp.IsCrookedTransaction P_set → p ≤ P_set.ncard → + ∃ P_set' : Set (Graph α β), S.IsCrookedTransaction P_set' ∧ p ≤ P_set'.ncard + +/-- Statement of Graph Minors IX, (10.4) (page 65): +"Let $p \ge 2$ with $p \ne 3$. Let $(G, \Omega, \Omega_0)$ be a rural neighborhood of breadth +$\ge p + 5$, and let $X \subseteq \bar{\Omega}$ be linked with $|X| \ge 2p + 8$. Let $(G +\cup G_0, \Omega)$ be the composition of some society $(G_0, \Omega_0)$ with $(G, \Omega, +\Omega_0)$, and suppose that there is a crooked transaction $\mathscr{P}$ in $(G \cup G_0, +\Omega)$ with $|\mathscr{P}| \ge p$. Then $\mathscr{P}$ may be chosen with $V(\mathscr{P}) +\subseteq X$ and such that no member of $\mathscr{P}$ has any internal vertex in +$\bar{\Omega}$." -/ +def GM09Theorem104Statement : Prop := + ∀ {α : Type u} {β : Type v} (S_comp S₀ : Society α β) (N : Neighborhood α β) + (p : ℕ) (X : Set α) (P_set : Set (Graph α β)), + 2 ≤ p → p ≠ 3 → + N.IsRural → N.HasBreadthGe (p + 5) → + N.IsLinked X → 2 * p + 8 ≤ X.ncard → + S_comp.IsComposition S₀ N → + S_comp.IsCrookedTransaction P_set → p ≤ P_set.ncard → + ∃ P_set' : Set (Graph α β), + S_comp.IsCrookedTransaction P_set' ∧ p ≤ P_set'.ncard ∧ + S_comp.transactionEnds P_set' ⊆ X ∧ + ∀ P ∈ P_set', Disjoint (pathInternalVerts S_comp.G P) S_comp.Ω.bar + +/-- Statement of Graph Minors XI, (6.3) (page 89): +"Let $\Gamma$ be a 2-cell painting or drawing in a connected surface $\Sigma$ with $E(\Gamma) +\ne \emptyset$, and let $\mathscr{T}$ be a respectful pretangle in $\Gamma$ of order $\theta +\ge 1$. Let $\Gamma'$ be a radial drawing of $\Gamma$, and let $ins$ be the derived slope. +Then for every separation $(A, B)$ of $\Gamma$ of order $< \theta$, the following are +equivalent:* (i) $(A, B) \in \mathscr{T}$ (ii) *there are circuits $C_1, \dots, C_k$ of +$\Gamma'$ with $V(C_i) \cap V(\Gamma) \subseteq V(A \cap B)$ ($1 \le i \le k$), such that +every edge of $A$ is a subset of one of $ins(C_1), \dots, ins(C_k)$.* *In particular, +$\mathscr{T}$ is the pretangle induced from $ins$." -/ +def GM11Theorem63Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ (Γ : PaintingOrDrawing S) (Γ' : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (ins : Drawing S → Set S), + Γ.IsTwoCell → Γ.E.Nonempty → IsPretangle Γ.toHypergraph θ T → Γ.IsRespectful θ T → + Γ.IsRadialDrawing Γ' → IsDerivedSlope Γ Γ' θ T ins → + (∀ A B : Hypergraph S (Set S), Γ.toHypergraph.IsSeparation A B → separationOrder A B < θ → + ((A, B) ∈ T ↔ + ∃ (k : ℕ) (C : Fin k → Drawing S), + (∀ i : Fin k, (C i).IsCircuit ∧ (C i).IsSubdrawing Γ' ∧ (C i).length < 2 * θ ∧ + (C i).V ∩ Γ.V ⊆ (A ∩ B).vertexSet) ∧ + ∀ e ∈ A.edgeSet, ∃ i : Fin k, e ⊆ ins (C i))) ∧ + T = inducedPretangle Γ Γ' θ ins + +/-- Statement of Graph Minors XI, (8.10) (page 100): +"Let $c \in \Sigma$, let $0 \le k < 2\theta$, and let $Z$ be the union of all restraints $X$ +with $l(X) \le k$ and $c \in X$. Then $Z$ is simply-connected." +The paper allows `Z = ∅` (see the proof of (8.12)), but `IsSimplyConnectedSet` needs a point, so `Z` +is +assumed non-empty here. For `Z = ∅` the `Prop` would be false: take one vertex in the sphere, no +edges, +`k = 0`, and `c` not that vertex. -/ +def GM11Theorem810Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ (Γ : Drawing S) (two_theta : ℕ) (ins : Drawing S → Set S), + IsSlope Γ two_theta ins → + ∀ (c : S) (k : ℕ), k < two_theta → + (⋃ X ∈ {X : Set S | IsRestraint Γ ins two_theta X ∧ + perimeterWalkLength Γ X ≤ k ∧ c ∈ X}, X).Nonempty → + IsSimplyConnectedSet + (⋃ X ∈ {X : Set S | IsRestraint Γ ins two_theta X ∧ + perimeterWalkLength Γ X ≤ k ∧ c ∈ X}, X) + +/-- Statement of Graph Minors XI, (8.12) (page 102): +"If $c \in \Sigma$, there is a region $r$ of $\Gamma$ such that there is no restraint $X$ +with $c \in X$ and $r \subseteq X$." -/ +def GM11Theorem812Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ (Γ : Drawing S) (two_theta : ℕ) (ins : Drawing S → Set S), + IsSlope Γ two_theta ins → + ∀ c : S, ∃ r ∈ Γ.R, ∀ X : Set S, IsRestraint Γ ins two_theta X → ¬ (c ∈ X ∧ r ⊆ X) + +/-- The conclusion of Graph Minors XII, (7.10) for `(T', d')` in `Γ'`. -/ +def IsClearedTangleAux {S : Type u} [TopologicalSpace S] [T1Space S] + (Γ Γ' : Drawing S) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (θ k : ℕ) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) : Prop := + HasTangleMetric Γ' (θ - 4 * k - 2) T' d' ∧ + (∀ A B : Hypergraph S (Set S), + (A, B) ∈ T → separationOrder A B < θ - 4 * k - 2 → + (A ∩ Γ'.toHypergraph, B ∩ Γ'.toHypergraph) ∈ T') ∧ + (∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → d a b - 4 * k - 2 ≤ d' a' b' ∧ d' a' b' ≤ d a b) + +/-- Statement of Graph Minors XII, (7.10) (pages 270–271): +"Let $k \ge 0$ be an integer, and let $\mathscr{T}$ be a respectful tangle of order $\ge 4k + 3$ in +a 2-cell drawing $\Gamma$ in a connected surface $\Sigma$. Let its metric be $d$. Let $c \in +A(\Gamma)$, and let $\Gamma'$ be a 2-cell subdrawing of $\Gamma$ such that $d(c, e) \le k$ for all +$e \in E(\Gamma) - E(\Gamma')$, and such that if $c \in E(\Gamma) - E(\Gamma')$ then ... $k \ge 2$. +Then there is a respectful tangle $\mathscr{T}'$ of order $\theta - 4k - 2$ in $\Gamma'$, with +metric $d'$, such that $d'(a', b') \ge d(a, b) - 4k - 2$ for all $a, b \in A(\Gamma)$ and $a', b' +\in A(\Gamma')$ with $a \subseteq a'$ and $b \subseteq b'$. Moreover, +(i) $\mathscr{T}'$ is unique +(ii) $(A \cap \Gamma', B \cap \Gamma') \in \mathscr{T}'$ for all $(A, B) \in \mathscr{T}$ of order +$< \theta - 4k - 2$, +(iii) $d'(a', b') \le d(a, b)$ for all $a, b \in A(\Gamma)$ and $a', b' \in A(\Gamma')$ with $a +\subseteq a'$ and $b \subseteq b'$." -/ +def GM12Theorem710Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ (Γ Γ' : Drawing S) (θ k : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (c : Set S), + 4 * k + 3 ≤ θ → + HasTangleMetric Γ θ T d → + c ∈ Γ.A → + Γ'.IsSubdrawing Γ → + (PaintingOrDrawing.drawing Γ').IsTwoCell → + (∀ e ∈ Γ.E \ Γ'.E, d c e ≤ k) → + (c ∈ Γ.E \ Γ'.E → 2 ≤ k) → + (∃ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (d' : Set S → Set S → ℕ), + IsClearedTangleAux Γ Γ' T d θ k T' d' ∧ + ∀ (T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (d'' : Set S → Set S → ℕ), + HasTangleMetric Γ' (θ - 4 * k - 2) T'' d'' → + (∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → d a b - 4 * k - 2 ≤ d'' a' b') → + T'' = T') + +/-- Whitney's theorem on uniqueness of planar embeddings of subdivisions of simple 3-connected +graphs, as used in the proof of Graph Minors XIV, (6.4) (page 34): any two drawings in a sphere of a +graph `J` which is a subdivision of a simple 3-connected graph are related by a homeomorphism of the +sphere extending the graph isomorphism on vertices and edges. -/ +def WhitneyPlanarUniquenessStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsSurface S → IsSphere S → + ∀ (J₁ J₂ : Drawing S), + IsSubdivisionOfSimpleThreeConnected J₁.toGraph → + ∀ φ_iso : Iso J₁.toGraph J₂.toGraph, + ∃ h : S ≃ₜ S, + (∀ v : V(J₁.toGraph), h v.1 = (φ_iso.vertexEquiv v).1) ∧ + (∀ e : E(J₁.toGraph), h '' e.1 = (φ_iso.edgeEquiv e).1) + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/ClaimOneReduction.lean b/LeanPool/GraphMinor/GM14/ClaimOneReduction.lean new file mode 100644 index 0000000000..081be88202 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/ClaimOneReduction.lean @@ -0,0 +1,265 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.SegregationReplace +public import LeanPool.GraphMinor.GM14.ForestClaim + +/-! +# Claim (1) of (8.4) + +"We proceed by induction on $|V(G_1)| + |E(G_1)|$. We claim that we may assume that (1) ..." (page +41). +`exists_reduced` is this induction. A member of the segregation with a smaller `A'` is replaced +(`exists_replacement`), and a crooked transaction survives by `claim_1_of_8_4`. At the end Claim (1) +holds, and the final graph is a subgraph of the first one, so a transaction in it is one in the +first. +-/ + + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor GraphMinor.GM09 GraphMinor.Surface GraphMinor.GM11 + GraphMinor.GM06 + +universe u v w + +variable {α : Type u} {β : Type v} {S : Type w} [TopologicalSpace S] + +/-- Claim (1) of (8.4), for one member `S₀` of the segregation, with `H ∩ A` given by `η`. -/ +def ClaimOne {G₁ : Graph α β} {H : Drawing S} (η : SpanEmbedding H G₁) (S₀ : Society α β) : Prop := + ∀ A' : Graph α β, A' ≤ S₀.G → S₀.Ω.bar ⊆ V(A') → pieceGraph η S₀.G ≤ A' → E(A').Nonempty → + PreservesBarPaths S₀ A' → A' = S₀.G + +/-- One step: a smaller segregation with the same arrangement. -/ +theorem exists_reduction_step {H : Drawing S} {α_pt : α → S} {S₂ S_G : Society α β} + {N : Neighborhood α β} {η : SpanEmbedding H N.G} {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} {pi : ℕ} + (hseg : IsThreeSegregation N.G S_seg) (harr : IsSurfaceArrangement S_seg α_disc α_pt) + (hcompat : IsCompatibleWith N.G H η S_seg α_disc α_pt) + (hΩ : N.Ω.bar ⊆ segregationVertices S_seg) (hΩ₀ : N.Ω₀.bar ⊆ segregationVertices S_seg) + (hcomp : S_G.IsComposition S₂ N) + (hcr : ∃ P_set, S_G.IsCrookedTransaction P_set ∧ pi ≤ P_set.ncard) + {S₀ : Society α β} (hS₀ : S₀ ∈ S_seg) {A' : Graph α β} (hA' : A' ≤ S₀.G) + (hbar : S₀.Ω.bar ⊆ V(A')) (hH : pieceGraph η S₀.G ≤ A') (hE : E(A').Nonempty) + (hpres : PreservesBarPaths S₀ A') (hne : A' ≠ S₀.G) : + ∃ (N' : Neighborhood α β) (S_G' : Society α β) (η' : SpanEmbedding H N'.G) + (S_seg' : Set (Society α β)) (α_disc' : Society α β → Set S), + N'.G ≤ N.G ∧ N'.Ω = N.Ω ∧ N'.Ω₀ = N.Ω₀ ∧ S_G'.Ω = S_G.Ω ∧ S_G'.G ≤ S_G.G ∧ + IsThreeSegregation N'.G S_seg' ∧ IsSurfaceArrangement S_seg' α_disc' α_pt ∧ + IsCompatibleWith N'.G H η' S_seg' α_disc' α_pt ∧ + segregationVertices S_seg' = segregationVertices S_seg ∧ + η'.imageGraph = η.imageGraph ∧ η'.vMap = η.vMap ∧ η'.eMap = η.eMap ∧ + (∀ S' ∈ S_seg', ∃ S₁ ∈ S_seg, α_disc' S' = α_disc S₁) ∧ + V(N'.G).ncard + E(N'.G).ncard < V(N.G).ncard + E(N.G).ncard ∧ + S_G'.IsComposition S₂ N' ∧ ∃ P_set, S_G'.IsCrookedTransaction P_set ∧ pi ≤ P_set.ncard := by + classical + obtain ⟨⟨⟨hS₂G, hNG, hVun, hEun, hEdis⟩, hbarN⟩, hΩeq, hΩ₀eq, hS₂bar⟩ := hcomp + obtain ⟨S_seg', α_disc', G₁', η', hG₁', hseg', harr', hcompat', hsegV, him, hvm, hem, hdisc, + hdrop, hV', hE'⟩ := exists_replacement N.finite_V N.finite_E hseg harr hcompat hS₀ hA' hbar hH + hE hne + have hS₀N := hseg.1.le S₀ hS₀ + have hS₀G : S₀.G ≤ S_G.G := hS₀N.trans hNG + have hrest : ∀ S₁ ∈ S_seg, S₁.G ≤ S_G.G := fun S₁ h => (hseg.1.le S₁ h).trans hNG + -- A vertex of `V(S_seg)` is in `V(A)` only if it is in `ΩBar`. + have hbar₀ : ∀ x ∈ segregationVertices S_seg, x ∈ V(S₀.G) → + x ∈ S₀.Ω.bar ∨ ∃ S₁ ∈ S_seg, S₁ ≠ S₀ ∧ x ∈ V(S₁.G) := by + intro x hx _ + obtain ⟨S₁, h₁, hx₁⟩ := mem_iUnion₂.mp hx + by_cases h : S₁ = S₀ + · exact Or.inl (h ▸ hx₁) + · exact Or.inr ⟨S₁, h₁, h, S₁.bar_subset hx₁⟩ + -- The rest of the graph. + let barG : Graph α β := (S_G.G.induce S₀.Ω.bar).restrict ∅ + have hbarG : barG ≤ S_G.G := + restrict_le.trans (induce_le (S₀.bar_subset.trans hS₀G.vertexSet_mono)) + have hbarE : E(barG) = ∅ := by + simp [barG] + let T : Set (Graph α β) := insert barG (insert S₂.G ((fun S₁ : Society α β => S₁.G) '' + (S_seg \ {S₀}))) + have hT : ∀ P ∈ T, P ≤ S_G.G := by + rintro P (rfl | rfl | ⟨S₁, ⟨h₁, -⟩, rfl⟩) + · exact hbarG + · exact hS₂G + · exact hrest S₁ h₁ + let B : Graph α β := subgraphSUnion S_G.G T + have hB : B ≤ S_G.G := subgraphSUnion_le hT + have hBV : V(B) = S₀.Ω.bar ∪ (V(S₂.G) ∪ ⋃ S₁ ∈ S_seg \ {S₀}, V(S₁.G)) := by + simp only [B, T, vertexSet_subgraphSUnion, biUnion_insert, biUnion_image] + rfl + have hBE : E(B) = E(S₂.G) ∪ ⋃ S₁ ∈ S_seg \ {S₀}, E(S₁.G) := by + simp only [B] + rw [edgeSet_subgraphSUnion hT] + simp only [T, biUnion_insert, biUnion_image, hbarE, empty_union] + have hVS : V(S_G.G) = V(S₂.G) ∪ (V(S₀.G) ∪ ⋃ S₁ ∈ S_seg \ {S₀}, V(S₁.G)) := by + rw [← hVun] + congr 1 + conv_lhs => rw [← hseg.1.union_eq] + simp only [vertexSet_subgraphSUnion, biUnion_image] + rw [← biUnion_insert (t := fun S₁ : Society α β => V(S₁.G)) S₀, insert_sdiff_singleton, + insert_eq_of_mem hS₀] + have hES : E(S_G.G) = E(S₂.G) ∪ (E(S₀.G) ∪ ⋃ S₁ ∈ S_seg \ {S₀}, E(S₁.G)) := by + rw [← hEun] + congr 1 + conv_lhs => rw [← hseg.1.union_eq] + rw [edgeSet_subgraphSUnion (by rintro _ ⟨S₁, hS₁, rfl⟩; exact hseg.1.le S₁ hS₁)] + simp only [biUnion_image] + rw [← biUnion_insert (t := fun S₁ : Society α β => E(S₁.G)) S₀, insert_sdiff_singleton, + insert_eq_of_mem hS₀] + have hSep : IsGraphSeparation S_G.G S₀.G B := by + refine ⟨hS₀G, hB, ?_, ?_, ?_⟩ + · rw [hBV, hVS] + ext x + simp only [mem_union] + have : x ∈ S₀.Ω.bar → x ∈ V(S₀.G) := fun h => S₀.bar_subset h + tauto + · rw [hBE, hES] + ext x + simp only [mem_union] + tauto + · rw [hBE] + refine disjoint_union_right.mpr ⟨?_, disjoint_iUnion₂_right.mpr ?_⟩ + · exact (hEdis.mono_right hS₀N.edgeSet_mono).symm + · rintro S₁ ⟨h₁, hn₁⟩ + exact hseg.1.edge_disjoint S₀ hS₀ S₁ h₁ (Ne.symm hn₁) + have hInter : V(S₀.G) ∩ V(B) = S₀.Ω.bar := by + refine Subset.antisymm ?_ fun x hx => ⟨S₀.bar_subset hx, hBV ▸ Or.inl hx⟩ + rintro x ⟨hx₀, hxB⟩ + rw [hBV] at hxB + have hoth : ∀ S₁ ∈ S_seg, S₁ ≠ S₀ → x ∈ V(S₁.G) → x ∈ S₀.Ω.bar := fun S₁ h₁ hn hx₁ => + (hseg.1.vertex_inter_subset S₀ hS₀ S₁ h₁ (Ne.symm hn) ⟨hx₀, hx₁⟩).1 + rcases hxB with h | h | h + · exact h + · have hxb : x ∈ N.Ω₀.bar := by + rw [hΩ₀eq, hS₂bar] + exact ⟨h, hS₀N.vertexSet_mono hx₀⟩ + rcases hbar₀ x (hΩ₀ hxb) hx₀ with h' | ⟨S₁, h₁, hn, hx₁⟩ + · exact h' + · exact hoth S₁ h₁ hn hx₁ + · obtain ⟨S₁, ⟨h₁, hn⟩, hx₁⟩ := mem_iUnion₂.mp h + exact hoth S₁ h₁ hn hx₁ + have hΩ₁B : S_G.Ω.bar ⊆ V(B) := by + intro x hx + rw [hBV] + obtain ⟨S₁, h₁, hx₁⟩ := mem_iUnion₂.mp (hΩ (hΩeq ▸ hx)) + by_cases h : S₁ = S₀ + · exact Or.inl (h ▸ hx₁) + · exact Or.inr (Or.inr (mem_iUnion₂.mpr ⟨S₁, ⟨h₁, h⟩, S₁.bar_subset hx₁⟩)) + have hA'G : A' ≤ S_G.G := hA'.trans hS₀G + let U : Graph α β := subgraphUnion S_G.G A' B + have hUle : U ≤ S_G.G := subgraphUnion_le hA'G hB + have hUV : V(U) = V(A') ∪ (V(S₂.G) ∪ ⋃ S₁ ∈ S_seg \ {S₀}, V(S₁.G)) := by + simp only [U, vertexSet_subgraphUnion] + rw [hBV] + ext x + simp only [mem_union] + have : x ∈ S₀.Ω.bar → x ∈ V(A') := fun h => hbar h + tauto + have hUE : E(U) = E(A') ∪ (E(S₂.G) ∪ ⋃ S₁ ∈ S_seg \ {S₀}, E(S₁.G)) := by + simp only [U] + rw [edgeSet_subgraphUnion hA'G hB, hBE] + have hG₁'le : G₁' ≤ U := by + refine le_of_subset_of_subset (hG₁'.trans hNG) hUle ?_ ?_ + · rw [hV', hUV] + exact union_subset_union_right _ subset_union_right + · rw [hE', hUE] + exact union_subset_union_right _ subset_union_right + have hS₂U : S₂.G ≤ U := by + refine le_of_subset_of_subset hS₂G hUle ?_ ?_ + · rw [hUV] + exact subset_union_left.trans subset_union_right + · rw [hUE] + exact subset_union_left.trans subset_union_right + -- A vertex of `V(S_seg)` stays in the new graph. + have hsegG' : segregationVertices S_seg ⊆ V(G₁') := by + intro x hx + rw [← hsegV] at hx + obtain ⟨S₁, h₁, hx₁⟩ := mem_iUnion₂.mp hx + exact (hseg'.1.le S₁ h₁).vertexSet_mono (S₁.bar_subset hx₁) + let N' : Neighborhood α β := ⟨G₁', N.Ω, N.Ω₀, N.finite_V.subset hG₁'.vertexSet_mono, + N.finite_E.subset hG₁'.edgeSet_mono, hΩ.trans hsegG', hΩ₀.trans hsegG'⟩ + let S_G' : Society α β := ⟨U, S_G.Ω, S_G.finite_V.subset hUle.vertexSet_mono, + S_G.finite_E.subset hUle.edgeSet_mono, hΩ₁B.trans subset_union_right⟩ + have hcomp' : S_G'.IsComposition S₂ N' := by + refine ⟨⟨⟨hS₂U, hG₁'le, ?_, ?_, ?_⟩, ?_⟩, hΩeq, hΩ₀eq, ?_⟩ + · change V(S₂.G) ∪ V(G₁') = V(U) + rw [hV', hUV] + ext x + simp only [mem_union] + tauto + · change E(S₂.G) ∪ E(G₁') = E(U) + rw [hE', hUE] + ext x + simp only [mem_union] + tauto + · exact hEdis.mono_right hG₁'.edgeSet_mono + · change S_G.Ω.bar ⊆ V(G₁') + exact fun x hx => hsegG' (hΩ (hΩeq ▸ hx)) + · change S₂.Ω.bar = V(S₂.G) ∩ V(G₁') + refine Subset.antisymm (fun x hx => ⟨?_, ?_⟩) ?_ + · rw [hS₂bar] at hx + exact hx.1 + · exact hsegG' (hΩ₀ (hΩ₀eq ▸ hx)) + · rintro x ⟨h₁, h₂⟩ + rw [hS₂bar] + exact ⟨h₁, hG₁'.vertexSet_mono h₂⟩ + obtain ⟨P_set, hP, hc⟩ := hcr + obtain ⟨P', hP', hc'⟩ := claim_1_of_8_4 (S₁' := S_G') hSep hInter + (S₀.finite_V.subset S₀.bar_subset) (hseg.2 S₀ hS₀) hA' hpres hΩ₁B rfl rfl hP hc + exact ⟨N', S_G', η', S_seg', α_disc', hG₁', rfl, rfl, rfl, hUle, hseg', harr', hcompat', hsegV, + him, hvm, hem, hdisc, hdrop, hcomp', P', hP', hc'⟩ + +/-- **Claim (1) of (8.4).** See the module docstring. -/ +theorem exists_reduced {H : Drawing S} {α_pt : α → S} {S₂ : Society α β} {pi : ℕ} : + ∀ (n : ℕ) (S_G : Society α β) (N : Neighborhood α β) (η : SpanEmbedding H N.G) + (S_seg : Set (Society α β)) (α_disc : Society α β → Set S), + V(N.G).ncard + E(N.G).ncard = n → + IsThreeSegregation N.G S_seg → IsSurfaceArrangement S_seg α_disc α_pt → + IsCompatibleWith N.G H η S_seg α_disc α_pt → + N.Ω.bar ⊆ segregationVertices S_seg → N.Ω₀.bar ⊆ segregationVertices S_seg → + S_G.IsComposition S₂ N → + (∃ P_set, S_G.IsCrookedTransaction P_set ∧ pi ≤ P_set.ncard) → + ∃ (N' : Neighborhood α β) (S_G' : Society α β) (η' : SpanEmbedding H N'.G) + (S_seg' : Set (Society α β)) (α_disc' : Society α β → Set S), + N'.G ≤ N.G ∧ N'.Ω = N.Ω ∧ N'.Ω₀ = N.Ω₀ ∧ S_G'.Ω = S_G.Ω ∧ S_G'.G ≤ S_G.G ∧ + IsThreeSegregation N'.G S_seg' ∧ IsSurfaceArrangement S_seg' α_disc' α_pt ∧ + IsCompatibleWith N'.G H η' S_seg' α_disc' α_pt ∧ + segregationVertices S_seg' = segregationVertices S_seg ∧ + η'.imageGraph = η.imageGraph ∧ η'.vMap = η.vMap ∧ η'.eMap = η.eMap ∧ + (∀ S' ∈ S_seg', ∃ S₁ ∈ S_seg, α_disc' S' = α_disc S₁) ∧ + S_G'.IsComposition S₂ N' ∧ + (∃ P_set, S_G'.IsCrookedTransaction P_set ∧ pi ≤ P_set.ncard) ∧ + ∀ S₀ ∈ S_seg', ClaimOne η' S₀ := by + intro n + induction n using Nat.strong_induction_on with + | _ n ih => + intro S_G N η S_seg α_disc hn hseg harr hcompat hΩ hΩ₀ hcomp hcr + by_cases hall : ∀ S₀ ∈ S_seg, ClaimOne η S₀ + · exact ⟨N, S_G, η, S_seg, α_disc, le_rfl, rfl, rfl, rfl, le_rfl, hseg, harr, hcompat, rfl, + rfl, rfl, rfl, fun S' h => ⟨S', h, rfl⟩, hcomp, hcr, hall⟩ + · unfold ClaimOne at hall + push Not at hall + obtain ⟨S₀, hS₀, A', hA', hbar, hH, hE, hpres, hne⟩ := hall + obtain ⟨N₁, S₁, η₁, seg₁, d₁, h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈, h₉, h₁₀, h₁₁, h₁₂, h₁₃, h₁₄, + h₁₅, h₁₆⟩ := exists_reduction_step hseg harr hcompat hΩ hΩ₀ hcomp hcr hS₀ hA' hbar hH hE + hpres hne + obtain ⟨N₂, S₂', η₂, seg₂, d₂, k₁, k₂, k₃, k₄, k₅, k₆, k₇, k₈, k₉, k₁₀, k₁₁, k₁₂, k₁₃, k₁₄, + k₁₅, k₁₆⟩ := ih _ (hn ▸ h₁₄) S₁ N₁ η₁ seg₁ d₁ rfl h₆ h₇ h₈ + (h₂.symm ▸ h₉.symm ▸ hΩ) (h₃.symm ▸ h₉.symm ▸ hΩ₀) h₁₅ h₁₆ + refine ⟨N₂, S₂', η₂, seg₂, d₂, k₁.trans h₁, k₂.trans h₂, k₃.trans h₃, k₄.trans h₄, + k₅.trans h₅, k₆, k₇, k₈, k₉.trans h₉, k₁₀.trans h₁₀, k₁₁.trans h₁₁, k₁₂.trans h₁₂, ?_, k₁₄, + k₁₅, k₁₆⟩ + intro S' hS' + obtain ⟨S₃, hS₃, e₁⟩ := k₁₃ S' hS' + obtain ⟨S₄, hS₄, e₂⟩ := h₁₃ S₃ hS₃ + exact ⟨S₄, hS₄, e₁.trans e₂⟩ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/CylinderCut.lean b/LeanPool/GraphMinor/GM14/CylinderCut.lean new file mode 100644 index 0000000000..8ec8957ece --- /dev/null +++ b/LeanPool/GraphMinor/GM14/CylinderCut.lean @@ -0,0 +1,364 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.AnnulusRural +public import LeanPool.GraphMinor.GM14.DiscSlope + +/-! +# Cutting a drawing along a circuit + +Let `Y` be a drawing of a graph `A`, and let `C` be a circuit of `A` that is the boundary of a +closed +disc `E`. Each edge off `C` is inside `E` or outside `E`. This gives a separation of `A` with common +vertices `V(C)` (`exists_cut`). The edges of `C` go inside, except for a set `T` of them that we are +free to choose. This is the separation `(A, B)` of the proof of (8.4), page 42. + +`exists_cut_society` then writes a society as the two compositions that the paper uses. +-/ + + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor GraphMinor.GM09 GraphMinor.Surface GraphMinor.GM11 + GraphMinor.GM06 + +universe u v w + +variable {α : Type u} {β : Type v} {S : Type w} [TopologicalSpace S] [T2Space S] +variable {A C : Graph α β} {Y : GraphDrawing A S} {ν : α → S} + +omit [T2Space S] in +theorem inj_of_drawing (hν : ∀ v : V(A), (Y.iso.vertexEquiv v).1 = ν v.1) : InjOn ν V(A) := by + intro a ha b hb hab + have h : (Y.iso.vertexEquiv ⟨a, ha⟩).1 = (Y.iso.vertexEquiv ⟨b, hb⟩).1 := + (hν ⟨a, ha⟩).trans (hab.trans (hν ⟨b, hb⟩).symm) + exact congrArg Subtype.val (Y.iso.vertexEquiv.injective (Subtype.ext h)) + +omit [T2Space S] in +theorem mem_V_of_drawing (hν : ∀ v : V(A), (Y.iso.vertexEquiv v).1 = ν v.1) {v : α} + (hv : v ∈ V(A)) : ν v ∈ Y.drawing.V := by + rw [← hν ⟨v, hv⟩] + exact (Y.iso.vertexEquiv ⟨v, hv⟩).2 + +omit [T2Space S] in +theorem edge_mem_of_drawing {e : β} (he : e ∈ E(A)) : graphDrawingEdgeSet Y e ∈ Y.drawing.E := by + rw [graphDrawingEdgeSet_eq Y he] + exact (Y.iso.edgeEquiv ⟨e, he⟩).2 + +omit [T2Space S] in +theorem ends_of_drawing (hν : ∀ v : V(A), (Y.iso.vertexEquiv v).1 = ν v.1) {e : β} {a b : α} + (hl : A.IsLink e a b) : closure (graphDrawingEdgeSet Y e) ∩ Y.drawing.V = {ν a, ν b} := by + have h := (Y.iso.isLink_iff ⟨e, hl.edge_mem⟩ ⟨a, hl.left_mem⟩ ⟨b, hl.right_mem⟩).mp hl + rw [graphDrawingEdgeSet_eq Y hl.edge_mem, ← hν ⟨a, hl.left_mem⟩, ← hν ⟨b, hl.right_mem⟩] + exact h.2.2.2 + +omit [T2Space S] in +theorem mem_subgraphU_iff (hν : ∀ v : V(A), (Y.iso.vertexEquiv v).1 = ν v.1) (hC : C ≤ A) {v : α} + (hv : v ∈ V(A)) : ν v ∈ graphDrawingSubgraphU Y C ↔ v ∈ V(C) := by + have hinj := inj_of_drawing hν + constructor + · rintro (h | h) + · obtain ⟨w, hw, hx⟩ := mem_iUnion₂.mp h + have hwA := hC.vertexSet_mono hw + rw [graphDrawingVertexSet_eq_singleton Y hwA, hν ⟨w, hwA⟩] at hx + exact hinj hv hwA hx ▸ hw + · obtain ⟨e, he, hx⟩ := mem_iUnion₂.mp h + obtain ⟨a, b, hl⟩ := C.exists_isLink_of_mem_edgeSet he + have hm : ν v ∈ closure (graphDrawingEdgeSet Y e) ∩ Y.drawing.V := + ⟨hx, mem_V_of_drawing hν hv⟩ + rw [ends_of_drawing hν (hl.mono hC)] at hm + rcases hm with h | h + · exact hinj hv (hC.vertexSet_mono hl.left_mem) h ▸ hl.left_mem + · exact hinj hv (hC.vertexSet_mono hl.right_mem) h ▸ hl.right_mem + · intro h + refine Or.inl (mem_iUnion₂.mpr ⟨v, h, ?_⟩) + rw [graphDrawingVertexSet_eq_singleton Y hv, hν ⟨v, hv⟩] + rfl + +/-- An edge off the circuit is inside the disc or outside it. -/ +theorem edge_sides (hS : IsClosedSurface S) + {E' : Set S} (hE : IsClosedDisc E') (hC : C ≤ A) (hbd : discBd E' = graphDrawingSubgraphU Y C) + {e : β} (he : e ∈ E(A)) (heC : e ∉ E(C)) : + graphDrawingEdgeSet Y e ⊆ discInt E' ∨ Disjoint (graphDrawingEdgeSet Y e) E' := by + have hmem := edge_mem_of_drawing (Y := Y) he + have hpre : IsPreconnected (graphDrawingEdgeSet Y e) := hmem.2.2.1.isConnected.isPreconnected + have hman : ∀ x : S, IsManifoldPoint x := (IsClosedSurface.isSurface hS).2.2 + have hoff : ∀ x ∈ graphDrawingEdgeSet Y e, x ∉ discBd E' := by + intro x hx hxb + have hxV : x ∉ Y.drawing.V := (hmem.2.1 hx).2 + rw [hbd] at hxb + rcases hxb with h | h + · obtain ⟨w, hw, hxw⟩ := mem_iUnion₂.mp h + have hwA := hC.vertexSet_mono hw + rw [graphDrawingVertexSet_eq_singleton Y hwA] at hxw + exact hxV (hxw ▸ (Y.iso.vertexEquiv ⟨w, hwA⟩).2) + · obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h + have hgA := hC.edgeSet_mono hg + have hgm := edge_mem_of_drawing (Y := Y) hgA + have hx' : x ∈ graphDrawingEdgeSet Y g := by + rw [← Y.drawing.closure_diff_V hgm] + exact ⟨hxg, hxV⟩ + have heq := Y.drawing.edge_eq_of_mem hmem hgm hx hx' + rw [graphDrawingEdgeSet_eq Y he, graphDrawingEdgeSet_eq Y hgA] at heq + have hne : e = g := congrArg Subtype.val (Y.iso.edgeEquiv.injective (Subtype.ext heq)) + exact heC (hne ▸ hg) + have hsub : graphDrawingEdgeSet Y e ⊆ discInt E' ∪ E'ᶜ := by + intro x hx + by_cases h : x ∈ E' + · exact Or.inl ⟨h, hoff x hx⟩ + · exact Or.inr h + rcases hpre.subset_or_subset (hE.isOpen_discInt hman) hE.isClosed.isOpen_compl + (disjoint_left.mpr fun x h₁ h₂ => h₂ h₁.1) hsub with h | h + · exact Or.inl h + · exact Or.inr (disjoint_left.mpr fun x h₁ h₂ => h h₁ h₂) + +/-- See the module docstring. -/ +theorem exists_cut (hν : ∀ v : V(A), (Y.iso.vertexEquiv v).1 = ν v.1) (hS : IsClosedSurface S) + {E' : Set S} (hE : IsClosedDisc E') (hC : C ≤ A) (hbd : discBd E' = graphDrawingSubgraphU Y C) + {T : Set β} (hT : T ⊆ E(C)) : + ∃ I O : Graph α β, I ≤ A ∧ O ≤ A ∧ V(I) = {v ∈ V(A) | ν v ∈ E'} ∧ + V(O) = {v ∈ V(A) | ν v ∉ discInt E'} ∧ E(I) ∪ E(O) = E(A) ∧ Disjoint E(I) E(O) ∧ + (∀ e ∈ E(I), closure (graphDrawingEdgeSet Y e) ⊆ E') ∧ + (∀ e ∈ E(O), closure (graphDrawingEdgeSet Y e) ⊆ (discInt E')ᶜ) ∧ + E(C) \ T ⊆ E(I) ∧ T ⊆ E(O) ∧ + (∀ e ∈ E(O), e ∈ T ∨ ¬ graphDrawingEdgeSet Y e ⊆ E') := by + classical + have hman : ∀ x : S, IsManifoldPoint x := (IsClosedSurface.isSurface hS).2.2 + have hopen : IsOpen (discInt E') := hE.isOpen_discInt hman + have hclE : IsClosed E' := hE.isClosed + have hCbd : ∀ e ∈ E(C), closure (graphDrawingEdgeSet Y e) ⊆ discBd E' := fun e he => by + rw [hbd] + exact subset_union_right.trans' (subset_biUnion_of_mem + (u := fun e => closure (graphDrawingEdgeSet Y e)) he) + have hdisc : ∀ {P : Set S}, P ⊆ discBd E' → P ⊆ (discInt E')ᶜ := fun h x hx hxi => hxi.2 (h hx) + have hbE : discBd E' ⊆ E' := GraphMinor.Surface.discBd_subset E' + -- The two kinds of edge. + let inE : Set β := {e | graphDrawingEdgeSet Y e ⊆ E' ∧ e ∉ T} + let outE : Set β := {e | ¬ graphDrawingEdgeSet Y e ⊆ E' ∨ e ∈ T} + have hin : ∀ e ∈ E(A), graphDrawingEdgeSet Y e ⊆ E' → closure (graphDrawingEdgeSet Y e) ⊆ E' := + fun e _ h => closure_minimal h hclE + have hout : ∀ e ∈ E(A), e ∈ outE → closure (graphDrawingEdgeSet Y e) ⊆ (discInt E')ᶜ := by + rintro e he (h | h) + · by_cases heC : e ∈ E(C) + · exact absurd (subset_closure.trans ((hCbd e heC).trans hbE)) h + · rcases edge_sides hS hE hC hbd he heC with h' | h' + · exact absurd (h'.trans sdiff_subset) h + · refine closure_minimal ?_ hopen.isClosed_compl + exact fun x hx hxi => disjoint_left.mp h' hx hxi.1 + · exact hdisc (hCbd e (hT h)) + let I : Graph α β := (A.induce {v ∈ V(A) | ν v ∈ E'}).restrict inE + let O : Graph α β := (A.induce {v ∈ V(A) | ν v ∉ discInt E'}).restrict outE + have hI : I ≤ A := restrict_le.trans (induce_le fun _ h => h.1) + have hO : O ≤ A := restrict_le.trans (induce_le fun _ h => h.1) + have hends : ∀ {e a b}, A.IsLink e a b → ν a ∈ closure (graphDrawingEdgeSet Y e) ∧ + ν b ∈ closure (graphDrawingEdgeSet Y e) := by + intro e a b hl + have h := ends_of_drawing hν hl + have h₁ : ν a ∈ closure (graphDrawingEdgeSet Y e) ∩ Y.drawing.V := h.superset (mem_insert _ _) + have h₂ : ν b ∈ closure (graphDrawingEdgeSet Y e) ∩ Y.drawing.V := + h.superset (mem_insert_of_mem _ rfl) + exact ⟨h₁.1, h₂.1⟩ + have hIE : E(I) = E(A) ∩ inE := by + ext e + constructor + · intro h + exact ⟨hI.edgeSet_mono h, ((edgeSet_restrict _ _).subset h).2⟩ + · rintro ⟨he, hin'⟩ + obtain ⟨a, b, hl⟩ := A.exists_isLink_of_mem_edgeSet he + have hc := hin e he hin'.1 + obtain ⟨h₁, h₂⟩ := hends hl + have : I.IsLink e a b := ⟨hin', hl, ⟨hl.left_mem, hc h₁⟩, ⟨hl.right_mem, hc h₂⟩⟩ + exact this.edge_mem + have hOE : E(O) = E(A) ∩ outE := by + ext e + constructor + · intro h + exact ⟨hO.edgeSet_mono h, ((edgeSet_restrict _ _).subset h).2⟩ + · rintro ⟨he, hout'⟩ + obtain ⟨a, b, hl⟩ := A.exists_isLink_of_mem_edgeSet he + have hc := hout e he hout' + obtain ⟨h₁, h₂⟩ := hends hl + have : O.IsLink e a b := ⟨hout', hl, ⟨hl.left_mem, hc h₁⟩, ⟨hl.right_mem, hc h₂⟩⟩ + exact this.edge_mem + refine ⟨I, O, hI, hO, rfl, rfl, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [hIE, hOE] + ext e + simp only [mem_union, mem_inter_iff, inE, outE, mem_ofPred_eq] + tauto + · rw [hIE, hOE] + refine disjoint_left.mpr ?_ + rintro e ⟨-, h₁, h₂⟩ ⟨-, h₃ | h₃⟩ + · exact h₃ h₁ + · exact h₂ h₃ + · intro e he + rw [hIE] at he + exact hin e he.1 he.2.1 + · intro e he + rw [hOE] at he + exact hout e he.1 he.2 + · rintro e ⟨he, heT⟩ + rw [hIE] + exact ⟨hC.edgeSet_mono he, subset_closure.trans ((hCbd e he).trans hbE), heT⟩ + · intro e he + rw [hOE] + exact ⟨hC.edgeSet_mono (hT he), Or.inr he⟩ + · intro e he + rw [hOE] at he + exact he.2.symm + +/-- See the module docstring. The society `(A ∪ G₂, Ω_E)` of the paper is `Sm`, the neighbourhood +outside `E'` is `Nout`, and the one inside is `Nin`. -/ +theorem exists_cut_society (hS : IsClosedSurface S) {S_top S₂ : Society α β} + {N : Neighborhood α β} (hcomp : S_top.IsComposition S₂ N) (Y : GraphDrawing N.G S) {ν : α → S} + (hν : ∀ v : V(N.G), (Y.iso.vertexEquiv v).1 = ν v.1) {D D₂ E' : Set S} (_hD : IsClosedDisc D) + (hE : IsClosedDisc E') (hD₂E : D₂ ⊆ E') (hED : E' ⊆ D) + (hbarD : ∀ v ∈ N.Ω.bar, ν v ∈ discBd D) (hbarD₂ : ∀ v ∈ N.Ω₀.bar, ν v ∈ D₂) + {C : Graph α β} (hC : C ≤ N.G) (hbd : discBd E' = graphDrawingSubgraphU Y C) {T : Set β} + (hT : T ⊆ E(C)) (Ω_E : CyclicPerm α) (hΩE : Ω_E.bar = V(C)) : + ∃ (Sm : Society α β) (Nout Nin : Neighborhood α β) (Yin : GraphDrawing Nin.G S) + (Yout : GraphDrawing Nout.G S), + Sm.Ω = Ω_E ∧ Nout.Ω = N.Ω ∧ Nout.Ω₀ = Ω_E ∧ Nin.Ω = Ω_E ∧ Nin.Ω₀ = N.Ω₀ ∧ + Nin.G ≤ N.G ∧ Nout.G ≤ N.G ∧ Sm.G ≤ S_top.G ∧ + V(Nin.G) = {v ∈ V(N.G) | ν v ∈ E'} ∧ V(Nout.G) = {v ∈ V(N.G) | ν v ∉ discInt E'} ∧ + E(C) \ T ⊆ E(Nin.G) ∧ T ⊆ E(Nout.G) ∧ E(Nin.G) ∪ E(Nout.G) = E(N.G) ∧ + (∀ e ∈ E(Nin.G), closure (graphDrawingEdgeSet Y e) ⊆ E') ∧ + (∀ e ∈ E(Nout.G), e ∈ T ∨ ¬ graphDrawingEdgeSet Y e ⊆ E') ∧ + V(Sm.G) = V(S₂.G) ∪ V(Nin.G) ∧ E(Sm.G) = E(S₂.G) ∪ E(Nin.G) ∧ + S_top.IsComposition Sm Nout ∧ Sm.IsComposition S₂ Nin ∧ + (∀ v : V(Nin.G), (Yin.iso.vertexEquiv v).1 = ν v.1) ∧ + (∀ v : V(Nout.G), (Yout.iso.vertexEquiv v).1 = ν v.1) ∧ + Yin.drawing.U ⊆ Y.drawing.U ∩ E' ∧ Yout.drawing.U ⊆ Y.drawing.U ∩ (discInt E')ᶜ ∧ + (∀ e ∈ E(Nin.G), graphDrawingEdgeSet Yin e = graphDrawingEdgeSet Y e) ∧ + (∀ e ∈ E(Nout.G), graphDrawingEdgeSet Yout e = graphDrawingEdgeSet Y e) ∧ + (∀ P ≤ Nin.G, graphDrawingSubgraphU Yin P = graphDrawingSubgraphU Y P) ∧ + (∀ P ≤ Nout.G, graphDrawingSubgraphU Yout P = graphDrawingSubgraphU Y P) := by + classical + obtain ⟨⟨⟨hS₂G, hNG, hVun, hEun, hEdis⟩, hbarN⟩, hΩeq, hΩ₀eq, hS₂bar⟩ := hcomp + obtain ⟨I, O, hI, hO, hIV, hOV, hun, hdis, hIc, hOc, hCI, hTO, hOT⟩ + := exists_cut hν hS hE hC hbd hT + have hman : ∀ x : S, IsManifoldPoint x := (IsClosedSurface.isSurface hS).2.2 + have hC₁ : ∀ {v}, v ∈ V(N.G) → (ν v ∈ discBd E' ↔ v ∈ V(C)) := fun hv => by + rw [hbd] + exact mem_subgraphU_iff hν hC hv + have hCV : ∀ {v}, v ∈ V(C) → ν v ∈ discBd E' := fun hv => + (hC₁ (hC.vertexSet_mono hv)).mpr hv + have hbE : discBd E' ⊆ E' := GraphMinor.Surface.discBd_subset E' + have hCI' : V(C) ⊆ V(I) := fun v hv => by + rw [hIV] + exact ⟨hC.vertexSet_mono hv, hbE (hCV hv)⟩ + have hCO' : V(C) ⊆ V(O) := fun v hv => by + rw [hOV] + exact ⟨hC.vertexSet_mono hv, fun h => h.2 (hCV hv)⟩ + have hunV : V(I) ∪ V(O) = V(N.G) := by + rw [hIV, hOV] + ext v + constructor + · rintro (h | h) + · exact h.1 + · exact h.1 + · intro hv + by_cases h : ν v ∈ E' + · exact Or.inl ⟨hv, h⟩ + · exact Or.inr ⟨hv, fun h' => h h'.1⟩ + have hbarO : N.Ω.bar ⊆ V(O) := by + intro v hv + rw [hOV] + refine ⟨N.bar_subset hv, fun hi => ?_⟩ + exact (GraphMinor.Surface.discInt_mono hman hE hED hi).2 (hbarD v hv) + have hbarI : N.Ω₀.bar ⊆ V(I) := by + intro v hv + rw [hIV] + exact ⟨N.bar₀_subset hv, hD₂E (hbarD₂ v hv)⟩ + have hIG : I ≤ S_top.G := hI.trans hNG + have hOG : O ≤ S_top.G := hO.trans hNG + let U : Graph α β := subgraphUnion S_top.G S₂.G I + have hU : U ≤ S_top.G := subgraphUnion_le hS₂G hIG + have hUV : V(U) = V(S₂.G) ∪ V(I) := rfl + have hUE : E(U) = E(S₂.G) ∪ E(I) := edgeSet_subgraphUnion hS₂G hIG + let Sm : Society α β := ⟨U, Ω_E, S_top.finite_V.subset hU.vertexSet_mono, + S_top.finite_E.subset hU.edgeSet_mono, by + rw [hΩE] + exact hCI'.trans subset_union_right⟩ + let Nout : Neighborhood α β := ⟨O, N.Ω, Ω_E, N.finite_V.subset hO.vertexSet_mono, + N.finite_E.subset hO.edgeSet_mono, hbarO, by + rw [hΩE] + exact hCO'⟩ + let Nin : Neighborhood α β := ⟨I, Ω_E, N.Ω₀, N.finite_V.subset hI.vertexSet_mono, + N.finite_E.subset hI.edgeSet_mono, by + rw [hΩE] + exact hCI', hbarI⟩ + have hcomp₁ : S_top.IsComposition Sm Nout := by + refine ⟨⟨⟨hU, hOG, ?_, ?_, ?_⟩, hΩeq ▸ hbarO⟩, hΩeq, rfl, ?_⟩ + · change V(U) ∪ V(O) = V(S_top.G) + rw [hUV, union_assoc, hunV, hVun] + · change E(U) ∪ E(O) = E(S_top.G) + rw [hUE, union_assoc, hun, hEun] + · change Disjoint E(U) E(O) + rw [hUE] + exact disjoint_union_left.mpr ⟨hEdis.mono_right hO.edgeSet_mono, hdis⟩ + · change Ω_E.bar = V(U) ∩ V(O) + rw [hΩE, hUV] + refine Subset.antisymm (fun v hv => ⟨Or.inr (hCI' hv), hCO' hv⟩) ?_ + rintro v ⟨h | h, h'⟩ + · have hvN := hO.vertexSet_mono h' + have hvb : v ∈ N.Ω₀.bar := by + rw [hΩ₀eq, hS₂bar] + exact ⟨h, hvN⟩ + rw [hOV] at h' + refine (hC₁ hvN).mp ?_ + by_contra hn + exact h'.2 ⟨hD₂E (hbarD₂ v hvb), hn⟩ + · rw [hIV] at h + rw [hOV] at h' + refine (hC₁ h.1).mp ?_ + by_contra hn + exact h'.2 ⟨h.2, hn⟩ + have hcomp₂ : Sm.IsComposition S₂ Nin := by + refine ⟨⟨⟨le_of_subset_of_subset hS₂G hU subset_union_left (by + rw [hUE] + exact subset_union_left), le_of_subset_of_subset hIG hU subset_union_right (by + rw [hUE] + exact subset_union_right), rfl, hUE.symm, ?_⟩, ?_⟩, rfl, hΩ₀eq, ?_⟩ + · exact hEdis.mono_right hI.edgeSet_mono + · change Ω_E.bar ⊆ V(I) + rw [hΩE] + exact hCI' + · change S₂.Ω.bar = V(S₂.G) ∩ V(I) + refine Subset.antisymm (fun v hv => ⟨S₂.bar_subset hv, hbarI (hΩ₀eq ▸ hv)⟩) ?_ + rintro v ⟨h₁, h₂⟩ + rw [hS₂bar] + exact ⟨h₁, hI.vertexSet_mono h₂⟩ + obtain ⟨Yin, hUi, hUs, -, hiv, -, hie, hip⟩ := GM09.GraphDrawing.ofSubgraph Y hI + obtain ⟨Yout, hUo, hUs', -, hov, -, hoe, hop⟩ := GM09.GraphDrawing.ofSubgraph Y hO + refine ⟨Sm, Nout, Nin, Yin, Yout, rfl, rfl, rfl, rfl, rfl, hI, hO, hU, hIV, hOV, hCI, hTO, hun, + hIc, + hOT, hUV, hUE, hcomp₁, hcomp₂, ?_, ?_, ?_, ?_, hie, hoe, hip, hop⟩ + · intro v + rw [hiv v] + exact hν ⟨v.1, hI.vertexSet_mono v.2⟩ + · intro v + rw [hov v] + exact hν ⟨v.1, hO.vertexSet_mono v.2⟩ + · refine subset_inter hUs ?_ + rw [hUi] + refine union_subset (iUnion₂_subset fun v hv => ?_) (iUnion₂_subset fun e he => hIc e he) + rw [graphDrawingVertexSet_eq_singleton Y (hI.vertexSet_mono hv), hν ⟨v, hI.vertexSet_mono hv⟩, + singleton_subset_iff] + exact (hIV.subset hv).2 + · refine subset_inter hUs' ?_ + rw [hUo] + refine union_subset (iUnion₂_subset fun v hv => ?_) (iUnion₂_subset fun e he => hOc e he) + rw [graphDrawingVertexSet_eq_singleton Y (hO.vertexSet_mono hv), hν ⟨v, hO.vertexSet_mono hv⟩, + singleton_subset_iff] + exact (hOV.subset hv).2 + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/CylinderParts.lean b/LeanPool/GraphMinor/GM14/CylinderParts.lean new file mode 100644 index 0000000000..12f32a2e91 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/CylinderParts.lean @@ -0,0 +1,282 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.CylinderCut +public import LeanPool.GraphMinor.GM14.NaturalOrderArc +public import LeanPool.GraphMinor.GM14.PieceFacts +public import LeanPool.GraphMinor.GM14.Section5 + +/-! +# Small steps of the proof of (8.4) + +The main results: `path_in_side` says that a path that starts on one side of a separation and meets +the common vertices only at its end stays on that side. `exists_nest_between` gives the `π + 5` +nested circuits of (8.4), which come from the regional distance by (5.5). +-/ + + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor GraphMinor.GM09 GraphMinor.Surface GraphMinor.GM11 + +universe u v w + +variable {α : Type u} {β : Type v} + +theorem start_mem_support {P : Graph α β} {a b : α} (W : GraphWalk P a b) : a ∈ W.support := by + cases W <;> simp [GraphWalk.support] + +theorem last_mem_support {P : Graph α β} {a b : α} (W : GraphWalk P a b) : b ∈ W.support := by + induction W with + | nil hv => simp [GraphWalk.support] + | cons hlink rest ih => simp [GraphWalk.support, ih] + +theorem walk_in_side {G P I O : Graph α β} (hP : P ≤ G) (hO : O ≤ G) (hI : I ≤ G) + (hE : E(G) ⊆ E(I) ∪ E(O)) {Z : Set α} (hZ : V(I) ∩ V(O) ⊆ Z) {a b : α} (W : GraphWalk P a b) + (ha : a ∈ V(I)) (hs : W.support.Nodup) (hoff : ∀ v ∈ W.support, v ∈ Z → v = b) : + (∀ v ∈ W.support, v ∈ V(I)) ∧ ∀ e ∈ W.edges, e ∈ E(I) := by + induction W with + | nil hv => + refine ⟨?_, by simp [GraphWalk.edges]⟩ + intro v hv' + simp only [GraphWalk.support, List.mem_singleton] at hv' + exact hv' ▸ ha + | @cons u x w e hlink rest ih => + simp only [GraphWalk.support, List.nodup_cons] at hs + have hne : u ≠ w := fun h => hs.1 (h ▸ last_mem_support rest) + have huZ : u ∉ Z := fun h => hne (hoff u (by simp [GraphWalk.support]) h) + have hlG : G.IsLink e u x := hlink.mono hP + have heI : e ∈ E(I) := by + rcases hE hlG.edge_mem with h | h + · exact h + · exact absurd (hZ ⟨ha, (hlG.of_compatible (Compatible.of_le_le le_rfl hO) h).left_mem⟩) huZ + have hxI : x ∈ V(I) := (hlG.of_compatible (Compatible.of_le_le le_rfl hI) heI).right_mem + obtain ⟨h₁, h₂⟩ := ih hxI hs.2 fun v hv hvZ => + hoff v (by simp [GraphWalk.support, hv]) hvZ + constructor + · intro v hv + simp only [GraphWalk.support, List.mem_cons] at hv + rcases hv with rfl | hv + · exact ha + · exact h₁ v hv + · intro f hf + simp only [GraphWalk.edges, List.mem_cons] at hf + rcases hf with rfl | hf + · exact heI + · exact h₂ f hf + +/-- See the module docstring. -/ +theorem path_in_side {G P I O : Graph α β} (hO : O ≤ G) (hI : I ≤ G) (hE : E(G) ⊆ E(I) ∪ E(O)) + {Z : Set α} (hZ : V(I) ∩ V(O) ⊆ Z) {a b : α} (hP : IsGraphPathWithEnds G P a b) + (ha : a ∈ V(I)) (hoff : V(P) ∩ Z ⊆ {b}) : P ≤ I := by + obtain ⟨hle, W, hs, hV, hEP⟩ := hP + obtain ⟨h₁, h₂⟩ := walk_in_side hle hO hI hE hZ W ha hs fun v hv hvZ => + hoff ⟨hV.superset hv, hvZ⟩ + exact le_of_subset_of_subset hle hI (fun v hv => h₁ v (hV.subset hv)) + fun e he => h₂ e (hEP.subset he) + +theorem walk_no_loop {P : Graph α β} {a b : α} (W : GraphWalk P a b) (hs : W.support.Nodup) {e : β} + (he : e ∈ W.edges) {z : α} (hz : P.IsLink e z z) : False := by + induction W with + | nil hv => simp [GraphWalk.edges] at he + | @cons u x w f hlink rest ih => + simp only [GraphWalk.support, List.nodup_cons] at hs + simp only [GraphWalk.edges, List.mem_cons] at he + rcases he with rfl | he + · rcases hlink.eq_and_eq_or_eq_and_eq hz with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hs.1 (start_mem_support rest) + · exact hs.1 (start_mem_support rest) + · exact ih hs.2 he + +/-- A path has no loop. -/ +theorem IsGraphPathWithEnds.no_loop {G P : Graph α β} {a b : α} (hP : IsGraphPathWithEnds G P a b) + {e : β} {z : α} (hz : P.IsLink e z z) : False := by + obtain ⟨-, W, hs, -, hEP⟩ := hP + exact walk_no_loop W hs (hEP.subset hz.edge_mem) hz + +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +theorem edge_subset_U {R : Drawing S} {e : Set S} (he : e ∈ R.E) : e ⊆ R.U := by + rw [R.U_eq] + exact subset_closure.trans (subset_union_right.trans' (subset_biUnion_of_mem + (u := fun e => closure e) he)) + +omit [T2Space S] in +/-- The image of a subdrawing `R` under `η` has the same set of points as `R`. -/ +theorem subgraphU_image {H R : Drawing S} (hR : R.IsSubdrawing H) {G A : Graph α β} + (η : SpanEmbedding H G) (Y : GraphDrawing A S) {ν : α → S} + (hν : ∀ v : V(A), (Y.iso.vertexEquiv v).1 = ν v.1) (hle : η.imageGraph ≤ A) + (hη : ∀ v ∈ H.V, ν (η.vMap v) = v) + (hηe : ∀ e ∈ H.E, graphDrawingEdgeSet Y (η.eMap e) = e) (hRG : R.toGraph ≤ H.toGraph) : + graphDrawingSubgraphU Y (η.gmap.sub R.toGraph) = R.U := by + have hV : ∀ v ∈ R.V, η.vMap v ∈ V(A) := fun v hv => + hle.vertexSet_mono (η.gmap.bijV.mapsTo (hR.1 hv)) + rw [R.U_eq] + refine Subset.antisymm (union_subset (iUnion₂_subset ?_) (iUnion₂_subset ?_)) + (union_subset ?_ (iUnion₂_subset ?_)) + · rintro _ ⟨v, hv, rfl⟩ + rw [graphDrawingVertexSet_eq_singleton Y (hV v hv), hν ⟨_, hV v hv⟩, hη v (hR.1 hv)] + exact singleton_subset_iff.mpr (Or.inl hv) + · intro a ha + rw [η.gmap.edgeSet_sub hRG] at ha + obtain ⟨e, he, rfl⟩ := ha + rw [hηe e (hR.2 he)] + exact subset_biUnion_of_mem (u := fun e => closure e) he |>.trans subset_union_right + · intro v hv + refine Or.inl (mem_iUnion₂.mpr ⟨η.vMap v, mem_image_of_mem _ hv, ?_⟩) + rw [graphDrawingVertexSet_eq_singleton Y (hV v hv), hν ⟨_, hV v hv⟩, hη v (hR.1 hv)] + rfl + · intro e he + have h : η.eMap e ∈ E(η.gmap.sub R.toGraph) := by + rw [η.gmap.edgeSet_sub hRG] + exact mem_image_of_mem _ he + refine Subset.trans ?_ (subset_union_right (s := _)) + refine subset_biUnion_of_mem (u := fun e => closure (graphDrawingEdgeSet Y e)) h |>.trans' ?_ + rw [show graphDrawingEdgeSet Y (η.eMap e) = e from hηe e (hR.2 he)] + +omit [T2Space S] in +theorem mem_discBd_of_subset (hman : ∀ x : S, IsManifoldPoint x) {A D : Set S} (hA : IsClosedDisc A) + (hAD : A ⊆ D) {x : S} (hx : x ∈ A) (hb : x ∈ discBd D) : x ∈ discBd A := by + by_contra hn + exact (discInt_mono hman hA hAD ⟨hx, hn⟩).2 hb + +omit [T2Space S] in +/-- A disc whose boundary misses the boundary of a larger disc misses it altogether. -/ +theorem subset_sdiff_discBd (hman : ∀ x : S, IsManifoldPoint x) {A Q : Set S} + (hA : IsClosedDisc A) (hAQ : A ⊆ Q) (hb : discBd A ⊆ Q \ discBd Q) : + A ⊆ Q \ discBd Q := by + intro x hx + by_cases h : x ∈ discBd A + · exact hb h + · exact discInt_mono hman hA hAQ ⟨hx, h⟩ + +variable [ConnectedSpace S] + +omit [T2Space S] in +/-- See the module docstring. -/ +theorem exists_nest_between (hS : IsClosedSurface S) (H : Drawing S) {C₁ C₂ : Drawing S} + {E₁ E₂ : Set S} (hE₁ : IsClosedDisc E₁) (hE₂ : IsClosedDisc E₂) + (hC₁ : C₁.IsCircuit ∧ C₁.IsSubdrawing H) (hC₂ : C₂.IsCircuit ∧ C₂.IsSubdrawing H) + (hbd₁ : discBd E₁ = C₁.U) (hbd₂ : discBd E₂ = C₂.U) (hE₂E₁ : E₂ ⊆ E₁ \ C₁.U) {m : ℕ} + (hd : m + 1 ≤ regionalDistance H C₂.U C₁.U) : + ∃ (R : Fin (m + 2) → Drawing S) (A : Fin (m + 2) → Set S), + (∀ i, (R i).IsCircuit ∧ (R i).IsSubdrawing H ∧ IsClosedDisc (A i) ∧ discBd (A i) = (R i).U ∧ + E₂ ⊆ A i ∧ A i ⊆ E₁) ∧ + (R 0 = C₂ ∧ A 0 = E₂) ∧ ∀ i j, i < j → A i ⊆ A j \ (R j).U := by + classical + have hman : ∀ x : S, IsManifoldPoint x := (IsClosedSurface.isSurface hS).2.2 + have hsb₁ : subBd E₁ = C₁.U := by + rw [← hbd₁] + exact IsClosedDisc.subBd_eq_discBd hS hE₁ + have hZ : C₂.U ⊆ E₁ \ subBd E₁ := by + rw [hsb₁, ← hbd₂] + exact (GraphMinor.Surface.discBd_subset E₂).trans hE₂E₁ + obtain ⟨φ⟩ := hE₂.isOArc_discBd + have hconn : IsPreconnected C₂.U := by + rw [← hbd₂] + have := (isPreconnected_range (f := fun z : Circle => (φ z).1) + (continuous_subtype_val.comp φ.continuous)) + rwa [show range (fun z : Circle => (φ z).1) = discBd E₂ by + ext x + constructor + · rintro ⟨z, rfl⟩ + exact (φ z).2 + · intro hx + exact ⟨φ.symm ⟨x, hx⟩, by simp⟩] at this + have hne : C₂.U.Nonempty := by + rw [← hbd₂] + exact ⟨_, (φ 1).2⟩ + obtain ⟨CC, Λ, hprops, hnest⟩ := theorem_5_5_aux hS H hE₁ m hZ hne hconn (hsb₁ ▸ hd) + let seq : ℕ → Drawing S × Set S := fun k => + if k = 0 then (C₂, E₂) else + if h : k - 1 < m then (CC ⟨k - 1, h⟩, closure (Λ ⟨k - 1, h⟩)) else (C₁, E₁) + have h0 : seq 0 = (C₂, E₂) := rfl + have hmid : ∀ i : Fin m, seq (i.1 + 1) = (CC i, closure (Λ i)) := by + intro i + simp only [seq, Nat.add_eq_zero_iff, one_ne_zero, and_false, ↓reduceIte, Nat.add_sub_cancel, + i.2, ↓reduceDIte] + have hlast : seq (m + 1) = (C₁, E₁) := by + simp [seq] + have hE₂sub : E₂ ⊆ E₁ := hE₂E₁.trans sdiff_subset + -- The facts on one circuit of the middle. + have hmidfacts : ∀ i : Fin m, E₂ ⊆ closure (Λ i) ∧ closure (Λ i) ⊆ E₁ \ C₁.U := by + intro i + obtain ⟨-, -, -, -, hcl, hdisc, -, -, -, hZΛ⟩ := hprops i + have hcl' : closure (Λ i) ⊆ E₁ \ C₁.U := hsb₁ ▸ hcl + refine ⟨?_, hcl'⟩ + refine GraphMinor.GM16.closedDisc_subset_of_boundary_subset hE₁ hdisc hE₂ + (hcl'.trans sdiff_subset) hE₂sub ?_ + rw [hbd₂] + exact hZΛ.trans subset_closure + have hgood : ∀ k, k ≤ m + 1 → (seq k).1.IsCircuit ∧ (seq k).1.IsSubdrawing H ∧ + IsClosedDisc (seq k).2 ∧ discBd (seq k).2 = (seq k).1.U ∧ E₂ ⊆ (seq k).2 ∧ (seq k).2 ⊆ E₁ + := by + intro k hk + rcases Nat.eq_zero_or_pos k with rfl | hk0 + · rw [h0] + exact ⟨hC₂.1, hC₂.2, hE₂, hbd₂, Subset.rfl, hE₂sub⟩ + · obtain ⟨j, rfl⟩ : ∃ j, k = j + 1 := ⟨k - 1, by omega⟩ + by_cases hj : j < m + · rw [hmid ⟨j, hj⟩] + obtain ⟨h₁, h₂, -, -, -, hdisc, -, hb, -, -⟩ := hprops ⟨j, hj⟩ + obtain ⟨h₃, h₄⟩ := hmidfacts ⟨j, hj⟩ + exact ⟨h₂, h₁, hdisc, (IsClosedDisc.subBd_eq_discBd hS hdisc).symm.trans hb, h₃, + h₄.trans sdiff_subset⟩ + · have : j = m := by omega + subst this + rw [hlast] + exact ⟨hC₁.1, hC₁.2, hE₁, hbd₁, hE₂sub, Subset.rfl⟩ + have hstep : ∀ k, k ≤ m → (seq k).2 ⊆ (seq (k + 1)).2 \ (seq (k + 1)).1.U := by + intro k hk + have hcase0 : ∀ i : Fin m, E₂ ⊆ closure (Λ i) \ (CC i).U := by + intro i + obtain ⟨-, -, -, -, -, hdisc, -, hb, hdiff, hZΛ⟩ := hprops i + have hbq : discBd (closure (Λ i)) = (CC i).U := (IsClosedDisc.subBd_eq_discBd hS + hdisc).symm.trans hb + rw [← hbq] + refine subset_sdiff_discBd hman hE₂ (hmidfacts i).1 ?_ + rw [hbq, hdiff, hbd₂] + exact hZΛ + rcases Nat.eq_zero_or_pos k with rfl | hk0 + · by_cases hm : 0 < m + · rw [h0, hmid ⟨0, hm⟩] + exact hcase0 ⟨0, hm⟩ + · have : m = 0 := by omega + subst this + rw [h0, hlast] + exact hE₂E₁ + · obtain ⟨j, rfl⟩ : ∃ j, k = j + 1 := ⟨k - 1, by omega⟩ + have hj : j < m := by omega + rw [hmid ⟨j, hj⟩] + by_cases hj' : j + 1 < m + · rw [hmid ⟨j + 1, hj'⟩] + obtain ⟨-, -, -, -, -, -, -, -, hdiff, -⟩ := hprops ⟨j + 1, hj'⟩ + change closure (Λ ⟨j, hj⟩) ⊆ closure (Λ ⟨j + 1, hj'⟩) \ (CC ⟨j + 1, hj'⟩).U + rw [hdiff] + exact hnest ⟨j, hj⟩ ⟨j + 1, hj'⟩ (Nat.lt_succ_self j) + · have : j + 1 = m := by omega + subst this + rw [hlast] + exact (hmidfacts ⟨j, hj⟩).2 + have hchain : ∀ i j, i < j → j ≤ m + 1 → (seq i).2 ⊆ (seq j).2 \ (seq j).1.U := by + intro i j hij + induction j, hij using Nat.le_induction with + | base => exact fun h => hstep i (by omega) + | succ j hj ih => + intro h + exact (ih (by omega)).trans (sdiff_subset.trans (hstep j (by omega))) + refine ⟨fun i => (seq i.1).1, fun i => (seq i.1).2, fun i => hgood i.1 (by omega), ?_, + fun i j hij => hchain i.1 j.1 hij (by omega)⟩ + exact ⟨congrArg Prod.fst h0, congrArg Prod.snd h0⟩ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Defs.lean b/LeanPool/GraphMinor/GM14/Defs.lean new file mode 100644 index 0000000000..c7426621d9 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Defs.lean @@ -0,0 +1,543 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM10.Defs2 +public import LeanPool.GraphMinor.GM11.Defs + +/-! +# Definitions of Graph Minors XIV + +This file formalizes the definitions of N. Robertson and P. D. Seymour, +*Graph Minors. XIV. Extending an embedding*, J. Combin. Theory Ser. B **65** (1995) 23–50. + +## Contents + +- **Section 1 (pages 24–25):** Subdivisions of simple 3-connected graphs + (`IsSubdivisionOfSimpleThreeConnected`) and `ins(φ)` for `H`-normal closed curves (`curveIns`). +- **Section 2 (pages 25–26):** Radial drawings `K` of `H` (`GM11.PaintingOrDrawing.IsRadialDrawing`) + and the atom `x'` of `K` corresponding to an atom `x` of `H` (`IsCorrespondingAtom`). +- **Section 3 (pages 27–29):** Respectful tangles in drawings (`IsRespectfulDrawingTangle`), + the inside function `ins` and metric `d(x, y)` of a respectful tangle (`tangleMetric`), + `λ`-zones around an atom `z` (`IsLambdaZoneAround`, `IsLambdaZone`), the subdrawing + `H ∩ (Σ - Λ)` (`clearedSubdrawing`), tangles obtained by clearing `Λ` (`IsClearedTangle`), + free sets (`GM10.IsFreeSet`), `H`-paths (`IsHPath`), embeddings of a drawing `H` as a subgraph of + `G` (`SpanEmbedding`, `DrawingSubgraph`), and eyes of `H` in `G` with respect to `T` + (`IsDrawingEye`). +- **Section 4 (pages 29–31):** Dials for `F, H` (`IsDial`), rigid drawings (`IsRigid`), natural + orders of `X ⊆ F` from an `O`-arc `F` (`IsNaturalOrderFrom`), segregations and 3-segregations of a + graph `G` (`IsGraphSegregation`, `IsThreeSegregation`), arrangements of a segregation in a surface + `Σ` (`IsSurfaceArrangement`), arrangements compatible with `H` (`IsCompatibleWith`), `T`-local + segregations (`IsTangleLocal`), and bridges of `H` in `G` (`IsBridge`). +- **Section 5 (pages 31–32):** Connected sets of regions (`IsConnectedRegionSet`), chains of + points and regions (`IsRegionChain`), and regional distance (`regionalDistance`). +- **Section 6 (pages 33–35):** Simply-connected subsets `X ⊆ Σ` in the sense of Section 6 + (`IsArcSimplyConnected`) and isomorphic drawings (`AreIsomorphicDrawings`). +- **Section 7 (pages 37–39):** `α`-normal subsets `X ⊆ Σ` (`IsArrangementNormal`). +- **Section 8 (pages 39–45):** Pullback cyclic permutation `α⁻¹(F)` (`IsPullbackPerm`) and + cylinder breadth `≥ q` (`HasCylinderBreadthGe`). +- **Section 9 (pages 45–47):** Battlefields `(Λ, C, X)` of size `β` around `z` (`IsBattlefield`) and + pullback subgraphs `α⁻¹(Σ')` (`arrangementPullbackGraph`). +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 + GraphMinor.GM11 Hypergraph + +universe u v w + +/-! ## Section 1: Introduction (pages 24–25) -/ + +/-- A graph `G₀` is simple and 3-connected if it is simple, has at least 4 vertices, and has no +separation `(G₁, G₂)` of order `< 3` with `V(G₁) ≠ V(G₀)` and `V(G₂) ≠ V(G₀)` +(Graph Minors XIV, Section 1, page 24). -/ +def IsSimpleThreeConnectedGraph {α : Type u} {β : Type v} (G₀ : Graph α β) : Prop := + IsSimpleGraph G₀ ∧ 4 ≤ V(G₀).ncard ∧ + ∀ G₁ G₂ : Graph α β, IsGraphSeparation G₀ G₁ G₂ → + (V(G₁) ∩ V(G₂)).ncard < 3 → V(G₁) = V(G₀) ∨ V(G₂) = V(G₀) + +/-- `G` is a subdivision of `G₀` if `G` is obtained from `G₀` by replacing each edge `e ∈ E(G₀)` +with a path `P_e` of `G` between the ends of `e`, of length `≥ 1`, such that the paths `P_e` are +mutually internally vertex-disjoint and meet `V(G₀)` only at their ends +(Graph Minors XIV, Section 1, page 24). -/ +def IsSubdivisionOf {α : Type u} {β : Type v} (G G₀ : Graph α β) : Prop := + V(G₀) ⊆ V(G) ∧ + ∃ P : β → Graph α β, + (∀ e ∈ E(G₀), ∃ u v : α, G₀.IsLink e u v ∧ IsGraphPathWithEnds G (P e) u v ∧ + E(P e).Nonempty ∧ V(P e) ∩ V(G₀) = {u, v}) ∧ + (∀ e₁ ∈ E(G₀), ∀ e₂ ∈ E(G₀), e₁ ≠ e₂ → + Disjoint E(P e₁) E(P e₂) ∧ V(P e₁) ∩ V(P e₂) ⊆ V(G₀)) ∧ + V(G) = V(G₀) ∪ (⋃ e ∈ E(G₀), V(P e)) ∧ + E(G) = ⋃ e ∈ E(G₀), E(P e) + +/-- `G` is a subdivision of a simple 3-connected graph (Graph Minors XIV, Section 1, page 24). -/ +def IsSubdivisionOfSimpleThreeConnected {α : Type u} {β : Type v} (G : Graph α β) : Prop := + ∃ G₀ : Graph α β, IsSimpleThreeConnectedGraph G₀ ∧ IsSubdivisionOf G G₀ + +section SurfaceDefs + +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +/-- For an `H`-normal closed curve `φ : S¹ → Σ` in a surface `Σ` that is not a sphere, `ins(φ)` is +the union of `|φ|` and all closed discs in `Σ` with boundary included in `|φ|` +(Graph Minors XIV, Section 1, (1.1), page 24). -/ +def curveIns (φ : C(Circle, S)) : Set S := + range φ ∪ ⋃ Δ ∈ {Δ : Set S | IsClosedDisc Δ ∧ subBd Δ ⊆ range φ}, Δ + +/-! ## Section 2: Radial Drawings (pages 25–26) -/ + +/-- "If $K$ is a radial drawing of $H$, then to every atom $x$ of $H$ there naturally corresponds +an atom $x'$ of $K$; namely, if $x = \{v\}$ for some $v \in V(H)$ then $x' = x$, if $x \in E(H)$, +then $x' \in R(K)$ includes $e$; and if $x \in R(H)$, then $x' = \{v\}$ for the unique $v \in V(K)$ +with $v \in x$. We call $x'$ the *atom of $K$ corresponding to $x$*" +(Graph Minors XIV, Section 2, page 26; the paper writes $e$ for $x$). -/ +def IsCorrespondingAtom (H K : Drawing S) (x x' : Set S) : Prop := + x ∈ H.A ∧ x' ∈ K.A ∧ + ((∃ v ∈ H.V, x = {v} ∧ x' = {v}) ∨ + (x ∈ H.E ∧ x' ∈ K.R ∧ x ⊆ x') ∨ + (x ∈ H.R ∧ ∃ v ∈ K.V ∩ x, x' = {v})) + +/-! ## Section 3: Tangles (pages 27–29) -/ + +/-- `T` is a respectful tangle of order `θ` in a 2-cell drawing `H` in `Σ` +(Graph Minors XIV, Section 3, page 27). -/ +def IsRespectfulDrawingTangle (H : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) : Prop := + (PaintingOrDrawing.drawing H).IsTwoCell ∧ + IsTangle H.toHypergraph θ T ∧ + (PaintingOrDrawing.drawing H).IsRespectful θ T + +/-- The metric `d(x, y)` of a respectful tangle `T` of order `θ` in `H` (with radial drawing `K` +and derived inside function `ins`), for `x, y ∈ A(H)` with corresponding atoms `x', y'` of `K`: +- `0` if `x = y`, +- `k` if `x ≠ y` and there is a closed walk `W` of `K` with length `< 2θ` with `x', y' ⊆ ins(W)`, + and the shortest such walk has length `2k`, +- `θ` otherwise +(Graph Minors XIV, Section 3, page 27; Graph Minors XII, Section 1, page 242). -/ +noncomputable def tangleMetric (H K : Drawing S) (ins : Drawing S → Set S) (θ : ℕ) + (x y : Set S) : ℕ := + open Classical in + if x = y then 0 + else if ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H K x x' ∧ IsCorrespondingAtom H K y y' ∧ + W.length < 2 * θ ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W then + sInf {k : ℕ | ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H K x x' ∧ IsCorrespondingAtom H K y y' ∧ + W.length < 2 * θ ∧ W.length = 2 * k ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W} + else θ + +/-- `d` is the metric of the respectful tangle `T` of order `θ` in `H` +(Graph Minors XIV, Section 3, page 27). -/ +def HasTangleMetric (H : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) : Prop := + IsRespectfulDrawingTangle H θ T ∧ + ∃ (K : Drawing S) (ins : Drawing S → Set S), + (PaintingOrDrawing.drawing H).IsRadialDrawing K ∧ + IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins ∧ + ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = tangleMetric H K ins θ x y + +/-- The corrected definition of a zone in Graph Minors XIV, §3. The printed text reads: +"Let $H$ be a 2-cell drawing in $\Sigma$, and let $\mathscr{T}$ be a respectful tangle in $H$ +of order $\theta$, with metric $d$. Let $z \in A(H)$ and let $\lambda \ge 0$ be an integer. +A *$\lambda$-zone around $z$* is an open disc $\Lambda \subseteq \Sigma$ with $z \subseteq +\Lambda$, such that $bd(\Lambda)$ is an $O$-arc and hence $\overline{\Lambda}$ is a closed +disc, $bd(\Lambda) \subseteq U(H)$, $d(z, x) \le \lambda$ for all $x \in A(H)$ with $x +\subseteq \overline{\Lambda}$, and if $z \in E(H)$ then $\lambda \ge 2$" (Graph Minors XIV, Section +3, page 28). The formal definition requires the closure to be a closed disc as a separate +condition. The printed implication from an $O$-arc boundary fails on the projective plane. -/ +structure IsLambdaZoneAround (H : Drawing S) (d : Set S → Set S → ℕ) (lam : ℕ) + (z Λ : Set S) : Prop where + /-- `z ∈ A(H)`. -/ + z_mem : z ∈ H.A + /-- `Λ` is an open disc in `Σ`. -/ + isOpenDisc : IsOpenDisc Λ + /-- `z ⊆ Λ`. -/ + z_subset : z ⊆ Λ + /-- `bd(Λ)` is an `O`-arc. -/ + isOArc_bd : IsOArc (subBd Λ) + /-- `closure Λ` is a closed disc. -/ + isClosedDisc_closure : IsClosedDisc (closure Λ) + /-- `bd(Λ) ⊆ U(H)`. -/ + bd_subset_U : subBd Λ ⊆ H.U + /-- `d(z, x) ≤ λ` for all `x ∈ A(H)` with `x ⊆ closure Λ`. -/ + dist_le : ∀ x ∈ H.A, x ⊆ closure Λ → d z x ≤ lam + /-- If `z ∈ E(H)` then `λ ≥ 2`. -/ + two_le_of_edge : z ∈ H.E → 2 ≤ lam + +/-- "A *$\lambda$-zone (for $H$)* is a subset of $\Sigma$ which is a $\lambda$-zone around $z$ +for some $z \in A(H)$" +(Graph Minors XIV, Section 3, page 28). -/ +def IsLambdaZone (H : Drawing S) (d : Set S → Set S → ℕ) (lam : ℕ) (Λ : Set S) : Prop := + ∃ z ∈ H.A, IsLambdaZoneAround H d lam z Λ + +/-- `H' = H ∩ (Σ - Λ)`, the subdrawing of `H` outside `Λ` +(Graph Minors XIV, Section 3, page 28). -/ +def clearedSubdrawing (H : Drawing S) (Λ : Set S) : Drawing S := + H.interSet (univ \ Λ) + +/-- "We say that $\mathscr{T}'$ is a *tangle of order $\theta - 4\lambda - 2$ obtained by clearing +$\Lambda$* if $\mathscr{T}'$ is a tangle in $H'$ of order $\theta - 4\lambda - 2$, and +(i) $\mathscr{T}'$ is respectful, and has metric $d'$ say +(ii) $(A \cap H', B \cap H') \in \mathscr{T}'$ for all $(A, B) \in \mathscr{T}$ of order $<\theta - +4\lambda - 2$, and +(iii) if $x, y \in A(H)$ and $x', y' \in A(H')$ with $x \subseteq x'$ and $y \subseteq y'$, then +$d(x, y) \ge d'(x', y') \ge d(x, y) - 4\lambda - 2$." +(Graph Minors XIV, Section 3, page 28, where $H' = H \cap (\Sigma - \Lambda)$). -/ +structure IsClearedTangle (H : Drawing S) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (θ lam : ℕ) (Λ : Set S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) : Prop where + /-- `(i)` `T'` is a respectful tangle of order `θ - 4λ - 2` in `H' = H ∩ (Σ - Λ)` with metric + `d'`. -/ + hasMetric : HasTangleMetric (clearedSubdrawing H Λ) (θ - 4 * lam - 2) T' d' + /-- `(ii)` `(A ∩ H', B ∩ H') ∈ T'` for all `(A, B) ∈ T` of order `< θ - 4λ - 2`. -/ + mem_of_order_lt : ∀ A B : Hypergraph S (Set S), + (A, B) ∈ T → separationOrder A B < θ - 4 * lam - 2 → + (A ∩ (clearedSubdrawing H Λ).toHypergraph, + B ∩ (clearedSubdrawing H Λ).toHypergraph) ∈ T' + /-- `(iii)` Distance comparison for `x, y ∈ A(H)` and `x', y' ∈ A(H')` with `x ⊆ x'`, `y ⊆ y'`. -/ + dist_bounds : ∀ x ∈ H.A, ∀ y ∈ H.A, + ∀ x' ∈ (clearedSubdrawing H Λ).A, ∀ y' ∈ (clearedSubdrawing H Λ).A, + x ⊆ x' → y ⊆ y' → d x y - 4 * lam - 2 ≤ d' x' y' ∧ d' x' y' ≤ d x y + +/-- "If $H$ is a subgraph of $G$, an *$H$-path* is a path of $G$ with distinct ends both in +$V(H)$ and with no other vertex or edge in $H$" (Graph Minors XIV, Section 3, page 28). -/ +def IsHPathWithEnds {α : Type v} {β : Type w} (G H P : Graph α β) (a b : α) : Prop := + H ≤ G ∧ IsGraphPathWithEnds G P a b ∧ a ≠ b ∧ a ∈ V(H) ∧ b ∈ V(H) ∧ + V(P) ∩ V(H) = {a, b} ∧ Disjoint E(P) E(H) + +/-- `P` is an `H`-path in `G` (Graph Minors XIV, Section 3, page 28). -/ +def IsHPath {α : Type v} {β : Type w} (G H P : Graph α β) : Prop := + ∃ a b : α, IsHPathWithEnds G H P a b + +/-- Four distinct vertices `a, b, c, d` occur in `V(C)` in that cyclic order along the circuit `C` +(Graph Minors XIV, Section 3, page 28). -/ +def OccurInCircuitOrder (C : Drawing S) (a b c d : S) : Prop := + ∃ φ : Circle ≃ₜ C.U, + ∃ (t₁ t₂ t₃ t₄ : ℝ), 0 ≤ t₁ ∧ t₁ < t₂ ∧ t₂ < t₃ ∧ t₃ < t₄ ∧ t₄ < 2 * Real.pi ∧ + (φ (Circle.exp t₁)).1 = a ∧ (φ (Circle.exp t₂)).1 = b ∧ + (φ (Circle.exp t₃)).1 = c ∧ (φ (Circle.exp t₄)).1 = d + +/-- An embedding `η` of a drawing `H` in `Σ` as a subgraph `imageGraph ≤ G` of an abstract graph +`G : Graph α β` (Graph Minors XIV, Section 3, page 28; Graph Minors XV, Section 1, page 114). -/ +structure SpanEmbedding {α : Type v} {β : Type w} (H : Drawing S) (G : Graph α β) where + /-- The image subgraph `η(H) ≤ G`. -/ + imageGraph : Graph α β + /-- The vertex bijection `η_V : S → α` on `V(H)`. -/ + vMap : S → α + /-- The edge bijection `η_E : Set S → β` on `E(H)`. -/ + eMap : Set S → β + /-- `imageGraph ≤ G`. -/ + imageGraph_le : imageGraph ≤ G + /-- `vMap` maps `V(H)` bijectively onto `V(imageGraph)`. -/ + bijOn_v : BijOn vMap H.V V(imageGraph) + /-- `eMap` maps `E(H)` bijectively onto `E(imageGraph)`. -/ + bijOn_e : BijOn eMap H.E E(imageGraph) + /-- `η` preserves the incidence relation between vertices and edges. -/ + inc_iff : ∀ e ∈ H.E, ∀ v ∈ H.V, imageGraph.Inc (eMap e) (vMap v) ↔ v ∈ closure e + +/-- Alias for `SpanEmbedding`. -/ +abbrev DrawingSubgraph {α : Type v} {β : Type w} (H : Drawing S) (G : Graph α β) := + SpanEmbedding H G + +/-- "Let $H$ be a subgraph of $G$, and let $H$ be a 2-cell drawing in $\Sigma$. Let $\mathscr{T}$ +be a respectful tangle in $H$. A region $r$ of $H$ is an *eye of $H$(in $G$) with respect to +$\mathscr{T}$* if (i) there is a circuit $C$ of $H$ with $U(C) = bd(r)$ (ii) there are +distinct vertices $a, b, c, d$ occurring in $V(C)$ in that order, and $\{a, b, c, d\}$ is +free with respect to $\mathscr{T}$, and ... (iii) there are two disjoint $H$-paths in $G$ with +ends $a, c$ and $b, d$ respectively." +(Graph Minors XIV, Section 3, pages 28–29). -/ +def IsDrawingEye {α : Type v} {β : Type w} (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ : ℕ) (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (r : Set S) : Prop := + r ∈ H.R ∧ + ∃ (C : Drawing S) (a b c d : S) (P₁ P₂ : Graph α β), + C.IsCircuit ∧ C.IsSubdrawing H ∧ C.U = subBd r ∧ + a ∈ C.V ∧ b ∈ C.V ∧ c ∈ C.V ∧ d ∈ C.V ∧ + ([a, b, c, d]).Nodup ∧ OccurInCircuitOrder C a b c d ∧ + IsFreeSet H.toHypergraph T θ {a, b, c, d} ∧ + Disjoint V(P₁) V(P₂) ∧ + IsHPathWithEnds G η.imageGraph P₁ (η.vMap a) (η.vMap c) ∧ + IsHPathWithEnds G η.imageGraph P₂ (η.vMap b) (η.vMap d) + +/-! ## Section 4: Statement of the Theorem (pages 29–31) -/ + +/-- "Let $H$ be a drawing in a surface $\Sigma$. If $F \subseteq \Sigma$ is an $O$-arc with $F +\cap U(H) \subseteq V(H)$ and $|F \cap V(H)| \le 2$, a *dial for $F$ (or for $F, H$ in case +of ambiguity)* is a closed disc $\Delta \subseteq \Sigma$ with $bd(\Delta) = F$, such that +either (i) $\Delta \cap U(H) \subseteq F$, or (ii) $|F \cap V(H)| = 2$ and $H \cap \Delta$ +is a path joining the two vertices in $F \cap V(H)$." +(Graph Minors XIV, Section 4, page 29). -/ +def IsDial (H : Drawing S) (F Δ : Set S) : Prop := + IsClosedDisc Δ ∧ subBd Δ = F ∧ + (Δ ∩ H.U ⊆ F ∨ + ∃ u v : S, u ≠ v ∧ F ∩ H.V = {u, v} ∧ (H.interSet Δ).IsPathBetween u v) + +/-- "We say that $H$ is *rigid (in $\Sigma$)* if $\Sigma$ includes a dial for every $O$-arc $F +\subseteq \Sigma$ with $F \cap U(H) \subseteq V(H)$ and $|F \cap V(H)| \le 2$" (Graph Minors XIV, +Section 4, page 29). -/ +def IsRigid (H : Drawing S) : Prop := + ∀ F : Set S, IsOArc F → F ∩ H.U ⊆ H.V → (F ∩ H.V).ncard ≤ 2 → + ∃ Δ : Set S, IsDial H F Δ + +/-- "If $F$ is an $O$-arc, and $X \subseteq F$ is finite, then both orientations of $F$ induce +cyclic permutations of $X$, and we call these the *natural orders of $X$ from $F$" +(Graph Minors XIV, Section 4, page 29). -/ +def IsNaturalOrderFrom {α : Type v} (α_pt : α → S) (Ω : CyclicPerm α) (F : Set S) : Prop := + IsOArc F ∧ ∃ φ : Circle ≃ₜ F, AgreesWithOArcHomeo α_pt Ω F φ + +/-- "A *segregation* of a graph $G$ is a set $\mathscr{S}$ of societies such that (i) $A +\subseteq G$ for every $(A, \Omega) \in \mathscr{S}$, and $\bigcup (A \colon (A, \Omega) \in +\mathscr{S}) = G$, and (ii) $V(A \cap A') \subseteq \overline{\Omega} \cap +\overline{\Omega}'$ and $E(A \cap A') = \emptyset$ for all distinct $(A, \Omega), (A', +\Omega') \in \mathscr{S}$." +(Graph Minors XIV, Section 4, page 29). -/ +structure IsGraphSegregation {α : Type v} {β : Type w} (G : Graph α β) + (S_seg : Set (Society α β)) : Prop where + /-- `S_seg` is finite. -/ + finite : S_seg.Finite + /-- `(i)` `A ≤ G` for every `(A, Ω) ∈ S_seg`. -/ + le : ∀ S₀ ∈ S_seg, S₀.G ≤ G + /-- `(i)` `⋃_{(A, Ω) ∈ S_seg} A = G`. -/ + union_eq : subgraphSUnion G ((fun S₀ : Society α β => S₀.G) '' S_seg) = G + /-- `(ii)` `V(A ∩ A') ⊆ ΩBar ∩ ΩBar'` for distinct `(A, Ω), (A', Ω') ∈ S_seg`. -/ + vertex_inter_subset : ∀ S₁ ∈ S_seg, ∀ S₂ ∈ S_seg, S₁ ≠ S₂ → + V(S₁.G) ∩ V(S₂.G) ⊆ S₁.Ω.bar ∩ S₂.Ω.bar + /-- `(ii)` `E(A ∩ A') = ∅` for distinct `(A, Ω), (A', Ω') ∈ S_seg`. -/ + edge_disjoint : ∀ S₁ ∈ S_seg, ∀ S₂ ∈ S_seg, S₁ ≠ S₂ → Disjoint E(S₁.G) E(S₂.G) + +/-- `V(S_seg) = ⋃ (ΩBar : (A, Ω) ∈ S_seg)` (Graph Minors XIV, Section 4, page 29). -/ +def segregationVertices {α : Type v} {β : Type w} (S_seg : Set (Society α β)) : Set α := + ⋃ S₀ ∈ S_seg, S₀.Ω.bar + +/-- "A segregation $\mathscr{S}$ is a *3-segregation* if $|\overline{\Omega}| \le 3$ for all $(A, +\Omega) \in \mathscr{S}$" +(Graph Minors XIV, Section 4, page 29). -/ +def IsThreeSegregation {α : Type v} {β : Type w} (G : Graph α β) + (S_seg : Set (Society α β)) : Prop := + IsGraphSegregation G S_seg ∧ ∀ S₀ ∈ S_seg, S₀.Ω.bar.ncard ≤ 3 + +/-- "Let $\mathscr{S} = \{(A_1, \Omega_1), \dots, (A_k, \Omega_k)\}$ be a segregation of $G$, and +let $\Sigma$ be a surface. An *arrangement of $\mathscr{S}$ in $\Sigma$* is a function $\alpha$ +with domain $\mathscr{S} \cup V(\mathscr{S})$, such that (writing $\alpha(A, \Omega)$ for +$\alpha((A, \Omega))$): +(i) $1 \le i \le k$, $\alpha(A_i, \Omega_i)$ is a closed disc $\Delta_i \subseteq \Sigma$, and +$\alpha(x) \in bd(\Delta_i)$ for each $x \in \overline{\Omega}_i$ +(ii) for $1 \le i < j \le k$, if $x \in \Delta_i \cap \Delta_j$ then $x = \alpha(v)$ for some $v +\in \overline{\Omega}_i \cap \overline{\Omega}_j$; and for $1 \le i \le k$, if $x \in \Delta_i +\cap bd(\Sigma)$ then $x = \alpha(v)$ for some $v \in \overline{\Omega}_i$, +(iii) for distinct $x, y \in V(\mathscr{S})$, $\alpha(x) \ne \alpha(y)$, and +(iv) for $1 \le i \le k$, $\Omega_i$ is mapped by $\alpha$ to a natural order of +$\alpha(\Omega_i)$ from $bd(\Delta_i)$." +(Graph Minors XIV, Section 4, page 29). -/ +structure IsSurfaceArrangement {α : Type v} {β : Type w} + (S_seg : Set (Society α β)) (α_disc : Society α β → Set S) (α_pt : α → S) : Prop where + /-- `(i)` `α(A, Ω)` is a closed disc in `Σ` and `α(x) ∈ bd(α(A, Ω))` for `x ∈ ΩBar`. -/ + isClosedDisc : ∀ S₀ ∈ S_seg, IsClosedDisc (α_disc S₀) ∧ + ∀ x ∈ S₀.Ω.bar, α_pt x ∈ subBd (α_disc S₀) + /-- `(ii)` Intersection of two discs `α(S₁) ∩ α(S₂)` for `S₁ ≠ S₂`. -/ + inter_discs : ∀ S₁ ∈ S_seg, ∀ S₂ ∈ S_seg, S₁ ≠ S₂ → + α_disc S₁ ∩ α_disc S₂ ⊆ α_pt '' (S₁.Ω.bar ∩ S₂.Ω.bar) + /-- `(ii)` Intersection with the surface boundary `bd(Σ)`. -/ + inter_bd : ∀ S₀ ∈ S_seg, α_disc S₀ ∩ bd S ⊆ α_pt '' S₀.Ω.bar + /-- `(iii)` `α` is injective on `V(S_seg)`. -/ + injOn_pts : InjOn α_pt (segregationVertices S_seg) + /-- `(iv)` `Ω` is mapped by `α` to a natural order of `α(ΩBar)` from `bd(α(A, Ω))`. -/ + natural_order : ∀ S₀ ∈ S_seg, IsNaturalOrderFrom α_pt S₀.Ω (subBd (α_disc S₀)) + +/-- "Now let $H$ be a subgraph of $G$, and let $H$ be a 2-cell drawing in $\Sigma$. Let $\alpha$ +be an arrangement in $\Sigma$ of a segregation $\mathscr{S}$ of $G$. We say that $\alpha$ is +*compatible with $H$* if (i) $\alpha(v) = v$ for all $v \in V(H) \cap V(\mathscr{S})$, and +(ii) for each $(A, \Omega) \in \mathscr{S}$, $U(H) \cap bd(\alpha(A, \Omega)) = V(H) \cap +\overline{\Omega}$, and $H \cap \alpha(A, \Omega) = H \cap A$." +(Graph Minors XIV, Section 4, page 30). -/ +structure IsCompatibleWith {α : Type v} {β : Type w} (G : Graph α β) (H : Drawing S) + (η : SpanEmbedding H G) (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) (α_pt : α → S) : Prop where + /-- `(i)` `α(η(v)) = v` for all `v ∈ V(H)` with `η(v) ∈ V(S_seg)`. -/ + pt_eq : ∀ v ∈ H.V, η.vMap v ∈ segregationVertices S_seg → α_pt (η.vMap v) = v + /-- `(ii)` `U(H) ∩ bd(α(A, Ω)) = {v ∈ V(H) : η(v) ∈ ΩBar}`. -/ + bd_inter_eq : ∀ S₀ ∈ S_seg, H.U ∩ subBd (α_disc S₀) = {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar} + /-- `(ii)` `V(H ∩ α(A, Ω))` corresponds under `η` to `V(η(H) ∩ A)`. -/ + inter_V_iff : ∀ S₀ ∈ S_seg, ∀ v ∈ H.V, v ∈ α_disc S₀ ↔ η.vMap v ∈ V(S₀.G) + /-- `(ii)` An edge of `H` is included in `α(A, Ω)` if and only if its image under `η` belongs to + `E(A)`. -/ + inter_E_iff : ∀ S₀ ∈ S_seg, ∀ e ∈ H.E, e ⊆ α_disc S₀ ↔ η.eMap e ∈ E(S₀.G) + +/-- "If $H$ is a subgraph of $G$ and $\mathscr{S}$ is a segregation of $G$, and $\mathscr{T}$ is +a tangle in $H$, we say that $\mathscr{S}$ is *$\mathscr{T}$-local* if $(A \cap H, B \cap H) +\in \mathscr{T}$ for all $(A, \Omega) \in \mathscr{S}$, where $B$ is the unique subgraph of +$G$ such that $(A, B)$ is a separation of $G$ and $V(A \cap B) = \overline{\Omega}$" +(Graph Minors XIV, Section 4, page 30). -/ +def IsTangleLocal {α : Type v} {β : Type w} (G : Graph α β) (H : Drawing S) + (η : SpanEmbedding H G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (S_seg : Set (Society α β)) : Prop := + ∀ S₀ ∈ S_seg, ∀ B : Graph α β, + IsGraphSeparation G S₀.G B → V(S₀.G) ∩ V(B) = S₀.Ω.bar → + ∃ A_H B_H : Hypergraph S (Set S), + H.toHypergraph.IsSeparation A_H B_H ∧ + A_H.vertexSet = {v ∈ H.V | η.vMap v ∈ V(S₀.G)} ∧ + B_H.vertexSet = {v ∈ H.V | η.vMap v ∈ V(B)} ∧ + A_H.edgeSet = {e ∈ H.E | η.eMap e ∈ E(S₀.G)} ∧ + B_H.edgeSet = {e ∈ H.E | η.eMap e ∈ E(B)} ∧ + (A_H, B_H) ∈ T + +/-- "A bridge of $H$ in $G$ is a subgraph of $G$, consisting of either an edge of $G$ not in +$E(H)$ but with both ends in $V(H)$, or a component of $G \setminus V(H)$ and all edges +between it and $V(H)$ (and their ends)" (Graph Minors XIV, Section 4, page 30). -/ +def IsBridge {α : Type v} {β : Type w} (G H J : Graph α β) : Prop := + H ≤ G ∧ J ≤ G ∧ + ((∃ e ∈ E(G) \ E(H), ∃ u ∈ V(H), ∃ v ∈ V(H), + G.IsLink e u v ∧ V(J) = {u, v} ∧ E(J) = {e}) ∨ + (∃ C ∈ graphComponents (deleteVertices G V(H)), + V(J) = V(C) ∪ {v ∈ V(H) | ∃ e ∈ E(G), ∃ u ∈ V(C), G.IsLink e u v} ∧ + E(J) = E(C) ∪ {e ∈ E(G) | ∃ u ∈ V(C), ∃ v ∈ V(H), G.IsLink e u v})) + +/-! ## Section 5: Distance in a Drawing (pages 31–32) -/ + +/-- "A set $\mathscr{R}$ of regions of a drawing $H$ is *connected* if for all $r, r' \in +\mathscr{R}$ there is a sequence $r = r_1, r_2, \dots, r_k = r'$ of members of $\mathscr{R}$ such +that for $1 \le i < k$, there is an edge of $H$ incident with $r_i$ and with $r_{i+1}$." +(Graph Minors XIV, Section 5, page 31). -/ +def IsConnectedRegionSet (H : Drawing S) (R_set : Set (Set S)) : Prop := + R_set ⊆ H.R ∧ + ∀ r ∈ R_set, ∀ r' ∈ R_set, + Relation.ReflTransGen + (fun r₁ r₂ => r₁ ∈ R_set ∧ r₂ ∈ R_set ∧ + ∃ e ∈ H.E, H.EdgeRegionIncident e r₁ ∧ H.EdgeRegionIncident e r₂) r r' + +/-- "If $H$ is a drawing in $\Sigma$, a *chain* is a sequence $v_0, r_1, \dots, r_k, v_k$ such +that $r_1, \dots, r_k$ are regions of $H$ and for $1 \le i \le k$, $\{v_{i-1}, v_i\} +\subseteq \bar{r}_i$. (We do not insist that $v_0, \dots, v_k$ are vertices.) The chain has +*length* $k$, and $v_0, v_k$ are its *ends" +(Graph Minors XIV, Section 5, page 32). -/ +def IsRegionChain (H : Drawing S) (X Y : Set S) {k : ℕ} (v_seq : Fin (k + 1) → S) + (r_seq : Fin k → Set S) : Prop := + v_seq 0 ∈ X ∧ v_seq (Fin.last k) ∈ Y ∧ + ∀ i : Fin k, r_seq i ∈ H.R ∧ + v_seq i.castSucc ∈ closure (r_seq i) ∧ + v_seq i.succ ∈ closure (r_seq i) + +/-- "If $X, Y \subseteq \Sigma$ are non-empty, we define the *regional distance* between $X$ and +$Y$ to be the minimum length of a chain with one end in $X$ and the other in $Y$" +(Graph Minors XIV, Section 5, page 32). -/ +noncomputable def regionalDistance (H : Drawing S) (X Y : Set S) : ℕ := + sInf {k : ℕ | ∃ (v_seq : Fin (k + 1) → S) (r_seq : Fin k → Set S), + IsRegionChain H X Y v_seq r_seq} + +/-! ## Section 6: Simply-Connected Subsets (pages 33–35) -/ + +/-- "A subset $X \subseteq \Sigma$ is *simply-connected* if $X$ is arc-wise connected and every +O-arc $F \subseteq X$ bounds a closed disc $\Delta \subseteq X$." +(Graph Minors XIV, Section 6, page 33). -/ +def IsArcSimplyConnected (X : Set S) : Prop := + IsArcConnected X ∧ ∀ F : Set S, IsOArc F → F ⊆ X → ∃ Δ : Set S, IsClosedDisc Δ ∧ subBd Δ = F + ∧ Δ ⊆ X + +/-- "Two drawings are *isomorphic* if they are isomorphic as graphs" +(Graph Minors XIV, Section 6, page 34). -/ +def AreIsomorphicDrawings (H₁ H₂ : Drawing S) : Prop := + Nonempty (Iso H₁.toGraph H₂.toGraph) + +/-! ## Section 7: Modifying an Arrangement (pages 37–39) -/ + +/-- "If $\alpha$ is an arrangement in a surface $\Sigma$ of a segregation $\mathscr{S}$ of $G$, a +subset $X \subseteq \Sigma$ is said to be $\alpha$-normal if +$$X \cap \alpha(A, \Omega) \subseteq \{\alpha(v) : v \in \bar{\Omega}\}$$ +for all $(A, \Omega) \in \mathscr{S}$." +(Graph Minors XIV, Section 7, page 37). -/ +def IsArrangementNormal {α : Type v} {β : Type w} (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) (α_pt : α → S) (X : Set S) : Prop := + ∀ S₀ ∈ S_seg, X ∩ α_disc S₀ ⊆ α_pt '' S₀.Ω.bar + +/-! ## Section 8: Segregation in a Cylinder (pages 39–45) -/ + +/-- Given an arrangement `α` of `S_seg` in `Σ` and an `α`-normal `O`-arc `F ⊆ Σ` with a cyclic order +on `F`, `Ω` is the pullback cyclic permutation `α⁻¹(F)` on `{v ∈ V(S_seg) : α(v) ∈ F}` +(Graph Minors XIV, Section 8, page 39). -/ +def IsPullbackPerm {α : Type v} {β : Type w} (S_seg : Set (Society α β)) + (α_pt : α → S) (F : Set S) (Ω : CyclicPerm α) : Prop := + Ω.bar = {v ∈ segregationVertices S_seg | α_pt v ∈ F} ∧ IsNaturalOrderFrom α_pt Ω F + +/-- "Let $(H, \Omega_1, \Omega_2)$ be a rural neighbourhood, in a closed cylinder $\Sigma$ with +ends $F_1, F_2$. It has *breadth* $\ge q$ if there are $q$ circuits of $H$, mutually +disjoint, and each winding around $\Sigma$, in the natural sense" (Graph Minors XIV, Section 8, page +40). -/ +def HasCylinderBreadthGe {α : Type v} {β : Type w} + (N : Neighborhood α β) (q : ℕ) : Prop := + N.HasBreadthGe q + +/-! ## Section 9: Battlefields (pages 45–47) -/ + +/-- The normalized battlefield of size `β` used in XVI (8.1) has `|X| = β`. The original +definition in XIV allows a larger free set. See `GM16.IsBattlefieldData.normalize` for the +reduction to the normalized form. The printed definition reads: +"Let $H$ be a 2-cell drawing in $\Sigma$, let $z \in A(H)$, and let $\mathscr{T}$ be a +respectful tangle in $H$ of order $\theta$, with metric $d$. Let $\beta \ge 4$ be an even integer. +A triple $(\Lambda, C, X)$ is a *battlefield of size $\beta$ around $z$* if +(i) $\Lambda$ is a $(3\beta + 3)$-zone around $z$, and $H \cap (\Sigma - \Lambda)$ is a rigid +drawing in $\Sigma$ +(ii) $X \subseteq V(H) \cap bd(\Lambda)$, and $\theta \ge 12\beta + 15$, and $X$ is free with +respect to the tangle of order $\theta - 4(3\beta + 3) - 2$ obtained by clearing $\Lambda$, +(iii) $C$ is a circuit of $H$ with $U(C) \subseteq \Lambda$, and there are $\beta$ disjoint paths +of $H$ from $U(C)$ to $X$, each with no vertex in $H \cap bd(\Lambda)$ except its last, +(iv) the regional distance between $U(C)$ and $bd(\Lambda)$ is at least $1 + \frac{1}{2}\beta$, +(v) the open disc in $\Lambda$ bounded by $U(C)$ includes every $x \in A(K)$ with $d(z, x) < +\beta$." +(Graph Minors XIV, Section 9, page 45; in `(v)` the paper writes `A(K)` for `A(H)`). -/ +structure IsBattlefield (H : Drawing S) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (θ beta : ℕ) (z : Set S) + (Λ : Set S) (C : Drawing S) (X : Set S) : Prop where + /-- `β ≥ 4` is even, `θ ≥ 12β + 15`, and `z ∈ A(H)`. -/ + params_valid : 4 ≤ beta ∧ Even beta ∧ 12 * beta + 15 ≤ θ ∧ z ∈ H.A + /-- `(i)` `Λ` is a `(3β + 3)`-zone around `z`. -/ + isZone : IsLambdaZoneAround H d (3 * beta + 3) z Λ + /-- `(i)` `H ∩ (Σ - Λ)` is rigid. -/ + isRigid_cleared : IsRigid (clearedSubdrawing H Λ) + /-- `(ii)` `X ⊆ V(H) ∩ bd(Λ)` with `|X| = β`, and `X` is free with respect to the tangle of order + `θ - 4(3β + 3) - 2` obtained by clearing `Λ`. -/ + isFree_X : X ⊆ H.V ∩ subBd Λ ∧ X.ncard = beta ∧ + ∃ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (d' : Set S → Set S → ℕ), + IsClearedTangle H T d θ (3 * beta + 3) Λ T' d' ∧ + IsFreeSet (clearedSubdrawing H Λ).toHypergraph T' (θ - 4 * (3 * beta + 3) - 2) X + /-- `(iii)` `C` is a circuit of `H` with `U(C) ⊆ Λ`, and there are `β` mutually disjoint paths of + `H` from `V(C)` to `X`, each intersecting `H ∩ bd(Λ)` only in its last vertex. -/ + circuit_and_paths : + C.IsCircuit ∧ C.IsSubdrawing H ∧ C.U ⊆ Λ ∧ + ∃ P : Fin beta → Drawing S, + (∀ k : Fin beta, ∃ u ∈ C.V, ∃ v ∈ X, + (P k).IsPathBetween u v ∧ (P k).IsSubdrawing H ∧ + (P k).U ∩ (H.U ∩ subBd Λ) = {v}) ∧ + Pairwise (fun k₁ k₂ : Fin beta => Disjoint (P k₁).V (P k₂).V) + /-- `(iv)` The regional distance between `U(C)` and `bd(Λ)` is at least `1 + β / 2`. -/ + regionalDistance_ge : 1 + beta / 2 ≤ regionalDistance H C.U (subBd Λ) + /-- `(v)` The open disc in `Λ` bounded by `U(C)` includes every `x ∈ A(H)` with `d(z, x) < β`. -/ + openDisc_includes : ∃ Δ₀ : Set S, + IsOpenDisc Δ₀ ∧ Δ₀ ⊆ Λ ∧ subBd Δ₀ = C.U ∧ + ∀ x ∈ H.A, d z x < beta → x ⊆ Δ₀ + +/-- "We define $\alpha^{-1}(\Sigma')$ to be the subgraph of $G$ formed by $$ \bigcup (A : (A, +\Omega) \in \mathscr{S} \text{ and } \alpha(A, \Omega) \subseteq \Sigma') $$ together with +all $v \in V(\mathscr{S})$ such that $\alpha(v) \in \Sigma'$" +(Graph Minors XIV, Section 9, page 47). -/ +def arrangementPullbackGraph {α : Type v} {β : Type w} (G : Graph α β) (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) (α_pt : α → S) (S' : Set S) : Graph α β := + (G.induce (((⋃ S₀ ∈ {S₀ ∈ S_seg | α_disc S₀ ⊆ S'}, V(S₀.G)) ∪ + {v ∈ segregationVertices S_seg | α_pt v ∈ S'}) ∩ V(G))).restrict + (⋃ S₀ ∈ {S₀ ∈ S_seg | α_disc S₀ ⊆ S'}, E(S₀.G)) + +end SurfaceDefs + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/DiscArrangement.lean b/LeanPool/GraphMinor/GM14/DiscArrangement.lean new file mode 100644 index 0000000000..acdee31edd --- /dev/null +++ b/LeanPool/GraphMinor/GM14/DiscArrangement.lean @@ -0,0 +1,264 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.GM14.DiscBoundaryHomeomorphism +import LeanPool.GraphMinor.GM14.DiscSlope + +/-! +# Disc transport and intersection in surface arrangements + +A disc arrangement in the plane can be transported to a disc in a closed surface with a prescribed +order of boundary marks. A cell of a surface arrangement that meets a normal disc without lying +inside it can meet the disc only at its boundary marks. +-/ + +public section + +namespace GraphMinor.GM14 + +open Set Function Topology Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 + +universe u v w + +/-- Transport a planar disc arrangement to a surface disc with prescribed boundary marks. -/ +theorem exists_surface_disc_arrangement_of_isDiscArrangement + {S : Type w} [TopologicalSpace S] (hS : IsClosedSurface S) {α : Type u} {β : Type v} + (S_soc : Society α β) {m : ℕ} (A₀ : Society α β) (A : Fin m → Society α β) + (Δ_E α₀_E : Set EuclideanPlane) (α_disc_E : Fin m → Set EuclideanPlane) + (α_pt_E : α → EuclideanPlane) + (hBar : S_soc.Ω.bar ⊆ segregationVertices (insert A₀ (range A))) + (hArr : IsDiscArrangement S_soc A₀ A Δ_E α₀_E α_disc_E α_pt_E) + (Δ_S : Set S) (hΔ_S : IsClosedDisc Δ_S) + (α₀_pt : α → S) (hinj_S : InjOn α₀_pt S_soc.Ω.bar) + (hNat_S : IsNaturalOrderFrom α₀_pt S_soc.Ω (subBd Δ_S)) : + let S_seg := insert A₀ (range A) + ∃ (α_disc_S : Society α β → Set S) (α_pt_S : α → S), + (∀ v ∈ S_soc.Ω.bar, α_pt_S v = α₀_pt v) ∧ + (∀ v ∈ segregationVertices S_seg, α_pt_S v ∈ Δ_S) ∧ + (∀ v ∈ segregationVertices S_seg, v ∉ S_soc.Ω.bar → α_pt_S v ∈ Δ_S \ subBd Δ_S) ∧ + InjOn α_pt_S (segregationVertices S_seg) ∧ + (∀ B ∈ S_seg, IsClosedDisc (α_disc_S B) ∧ α_disc_S B ⊆ Δ_S ∧ + ∀ x ∈ B.Ω.bar, α_pt_S x ∈ subBd (α_disc_S B)) ∧ + (∀ B ∈ S_seg, IsNaturalOrderFrom α_pt_S B.Ω (subBd (α_disc_S B))) ∧ + (∀ B ∈ S_seg, α_disc_S B ∩ subBd Δ_S ⊆ α_pt_S '' (B.Ω.bar ∩ S_soc.Ω.bar)) ∧ + (∀ B₁ ∈ S_seg, ∀ B₂ ∈ S_seg, B₁ ≠ B₂ → + α_disc_S B₁ ∩ α_disc_S B₂ ⊆ α_pt_S '' (B₁.Ω.bar ∩ B₂.Ω.bar)) := by + classical + intro S_seg + have hseg_eq : segregationVertices S_seg = A₀.Ω.bar ∪ ⋃ j : Fin m, (A j).Ω.bar := by + ext v + simp only [segregationVertices, S_seg, mem_iUnion, mem_insert_iff, mem_range, mem_union] + constructor + · rintro ⟨B, rfl | ⟨j, rfl⟩, hv⟩ + · exact Or.inl hv + · exact Or.inr ⟨j, hv⟩ + · rintro (hv | ⟨j, hv⟩) + · exact ⟨A₀, Or.inl rfl, hv⟩ + · exact ⟨A j, Or.inr ⟨j, rfl⟩, hv⟩ + have hinj_E_seg : InjOn α_pt_E (segregationVertices S_seg) := hseg_eq ▸ hArr.injOn_pts + obtain ⟨φ_E, _, hA_E⟩ := hArr.bd_outer + obtain ⟨_, φ_S, hA_S⟩ := hNat_S + obtain ⟨e_subBd, he_subBd⟩ := + exists_bd_homeo_of_agreesWithOArcHomeo hA_E hA_S (hinj_E_seg.mono hBar) hinj_S + have hbd_E : subBd Δ_E = discBd Δ_E := + isClosedDisc_subBd_eq_discBd_euclideanPlane hArr.isClosedDisc_Δ + have hbd_S : subBd Δ_S = discBd Δ_S := IsClosedDisc.subBd_eq_discBd hS hΔ_S + let e_bd : discBd Δ_E ≃ₜ discBd Δ_S := + (Homeomorph.setCongr hbd_E.symm).trans (e_subBd.trans (Homeomorph.setCongr hbd_S)) + obtain ⟨f, f', hf_maps, hf'_maps, hf_cont, hf'_cont, hf_left, hf_right, hf_bd⟩ := + exists_disc_extension_of_bd_homeo hArr.isClosedDisc_Δ hΔ_S e_bd + have hf_subBd : ∀ x (hx : x ∈ subBd Δ_E), f x = (e_subBd ⟨x, hx⟩).1 := by + intro x hx + have hx' : x ∈ discBd Δ_E := hbd_E ▸ hx + have h := hf_bd ⟨x, hx'⟩ + exact h + have hf_mem_subBd_iff : ∀ x ∈ Δ_E, f x ∈ subBd Δ_S ↔ x ∈ subBd Δ_E := by + intro x hx + constructor + · intro hfx + have hfx' : f x ∈ discBd Δ_S := hbd_S ▸ hfx + let x₀ : discBd Δ_E := e_bd.symm ⟨f x, hfx'⟩ + have hx₀_eq : f x₀.1 = f x := by + rw [hf_bd x₀, e_bd.apply_symm_apply] + have hx_eq : x₀.1 = x := hf_left.injOn (Surface.discBd_subset Δ_E x₀.2) hx hx₀_eq + rw [← hx_eq, hbd_E] + exact x₀.2 + · intro hx_bd + rw [hf_subBd x hx_bd] + exact (e_subBd ⟨x, hx_bd⟩).2 + let disc_E : Society α β → Set EuclideanPlane := fun B => + if B = A₀ then α₀_E + else if h : ∃ j : Fin m, A j = B then α_disc_E (Classical.choose h) + else ∅ + have hdisc_E_zero : disc_E A₀ = α₀_E := by simp [disc_E] + have hdisc_E_ne : ∀ {B : Society α β}, B ∈ S_seg → B ≠ A₀ → + ∃ j : Fin m, A j = B ∧ disc_E B = α_disc_E j := by + intro B hB hne + have hex : ∃ j : Fin m, A j = B := by + rcases hB with rfl | ⟨j, rfl⟩ + · exact (hne rfl).elim + · exact ⟨j, rfl⟩ + refine ⟨Classical.choose hex, Classical.choose_spec hex, ?_⟩ + simp [disc_E, hne, hex] + have hdisc_E_closed : ∀ B ∈ S_seg, IsClosedDisc (disc_E B) ∧ disc_E B ⊆ Δ_E := by + intro B hB + by_cases h0 : B = A₀ + · subst h0; rw [hdisc_E_zero]; exact hArr.isClosedDisc_zero + · obtain ⟨j, _, hj_disc⟩ := hdisc_E_ne hB h0 + rw [hj_disc]; exact hArr.isClosedDisc_succ j + have hdisc_E_bd : ∀ B ∈ S_seg, ∃ φ : Circle ≃ₜ subBd (disc_E B), + AgreesWithOArcHomeo α_pt_E B.Ω (subBd (disc_E B)) φ := by + intro B hB + by_cases h0 : B = A₀ + · subst h0; rw [hdisc_E_zero]; obtain ⟨φ, _, h⟩ := hArr.bd_zero; exact ⟨φ, h⟩ + · obtain ⟨j, rfl, hj_disc⟩ := hdisc_E_ne hB h0 + rw [hj_disc]; obtain ⟨φ, _, h⟩ := hArr.bd_succ j; exact ⟨φ, h⟩ + have hdisc_E_inter_bd : ∀ B ∈ S_seg, + disc_E B ∩ subBd Δ_E ⊆ α_pt_E '' (B.Ω.bar ∩ S_soc.Ω.bar) := by + intro B hB + by_cases h0 : B = A₀ + · subst h0; rw [hdisc_E_zero]; exact hArr.inter_bd_zero + · obtain ⟨j, rfl, hj_disc⟩ := hdisc_E_ne hB h0 + rw [hj_disc]; exact hArr.inter_bd_succ j + have hdisc_E_inter : ∀ B₁ ∈ S_seg, ∀ B₂ ∈ S_seg, B₁ ≠ B₂ → + disc_E B₁ ∩ disc_E B₂ ⊆ α_pt_E '' (B₁.Ω.bar ∩ B₂.Ω.bar) := by + intro B₁ hB₁ B₂ hB₂ hne + by_cases h10 : B₁ = A₀ + · subst h10 + obtain ⟨j, rfl, hj_disc⟩ := hdisc_E_ne hB₂ hne.symm + rw [hdisc_E_zero, hj_disc] + exact hArr.inter_zero j + · obtain ⟨i, hAi, hi_disc⟩ := hdisc_E_ne hB₁ h10 + by_cases h20 : B₂ = A₀ + · subst h20 + rw [hi_disc, hdisc_E_zero, ← hAi, Set.inter_comm, Set.inter_comm (A i).Ω.bar] + exact hArr.inter_zero i + · obtain ⟨j, hAj, hj_disc⟩ := hdisc_E_ne hB₂ h20 + have hij : i ≠ j := fun heq => hne (hAi.symm.trans (congrArg A heq |>.trans hAj)) + rw [hi_disc, hj_disc, ← hAi, ← hAj] + exact hArr.inter_succ i j hij + have hpt_E_mem : ∀ v ∈ segregationVertices S_seg, α_pt_E v ∈ Δ_E := by + intro v hv + rcases mem_iUnion₂.mp hv with ⟨B, hB, hvB⟩ + obtain ⟨φ_B, hA_B⟩ := hdisc_E_bd B hB + have hsub : subBd (disc_E B) ⊆ disc_E B := by + rw [isClosedDisc_subBd_eq_discBd_euclideanPlane (hdisc_E_closed B hB).1] + exact Surface.discBd_subset (disc_E B) + exact (hdisc_E_closed B hB).2 (hsub (hA_B.1 v hvB)) + let α_disc_S : Society α β → Set S := fun B => f '' disc_E B + let α_pt_S : α → S := fun v => f (α_pt_E v) + have hB_img : ∀ B ∈ S_seg, + IsClosedDisc (α_disc_S B) ∧ subBd (α_disc_S B) = f '' subBd (disc_E B) := by + intro B hB + obtain ⟨hB_disc, hB_sub⟩ := hdisc_E_closed B hB + have hf'_B : ContinuousOn f' (f '' disc_E B) := + hf'_cont.mono (image_subset_iff.mpr fun x hx => hf_maps (hB_sub hx)) + obtain ⟨himg_disc, himg_bd⟩ := + hB_disc.image (hf_cont.mono hB_sub) hf'_B (hf_left.mono hB_sub) + refine ⟨himg_disc, ?_⟩ + rw [IsClosedDisc.subBd_eq_discBd hS himg_disc, himg_bd, + isClosedDisc_subBd_eq_discBd_euclideanPlane hB_disc] + refine ⟨α_disc_S, α_pt_S, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro v hv + dsimp only [α_pt_S] + rw [hf_subBd (α_pt_E v) (hA_E.1 v hv), he_subBd v hv] + · intro v hv + exact hf_maps (hpt_E_mem v hv) + · intro v hv hv_not + refine ⟨hf_maps (hpt_E_mem v hv), fun hbd => ?_⟩ + have hx_bd : α_pt_E v ∈ subBd Δ_E := (hf_mem_subBd_iff (α_pt_E v) (hpt_E_mem v hv)).mp hbd + rcases mem_iUnion₂.mp hv with ⟨B, hB, hvB⟩ + obtain ⟨φ_B, hA_B⟩ := hdisc_E_bd B hB + have hsub : subBd (disc_E B) ⊆ disc_E B := by + rw [isClosedDisc_subBd_eq_discBd_euclideanPlane (hdisc_E_closed B hB).1] + exact Surface.discBd_subset (disc_E B) + have hmem_inter : α_pt_E v ∈ disc_E B ∩ subBd Δ_E := ⟨hsub (hA_B.1 v hvB), hx_bd⟩ + obtain ⟨w, ⟨hwB, hwS⟩, hw_eq⟩ := hdisc_E_inter_bd B hB hmem_inter + have hw_seg : w ∈ segregationVertices S_seg := mem_biUnion hB hwB + have hvw : w = v := hinj_E_seg hw_seg hv hw_eq + exact hv_not (hvw ▸ hwS) + · intro u hu v hv huv + exact hinj_E_seg hu hv (hf_left.injOn (hpt_E_mem u hu) (hpt_E_mem v hv) huv) + · intro B hB + obtain ⟨hdisc_B, hbd_B⟩ := hB_img B hB + refine ⟨hdisc_B, image_subset_iff.mpr fun x hx => hf_maps ((hdisc_E_closed B hB).2 hx), ?_⟩ + intro x hx + obtain ⟨φ_B, hA_B⟩ := hdisc_E_bd B hB + rw [hbd_B] + exact mem_image_of_mem f (hA_B.1 x hx) + · intro B hB + obtain ⟨hdisc_B, hbd_B⟩ := hB_img B hB + obtain ⟨φ_B, hA_B⟩ := hdisc_E_bd B hB + have hsub_B : subBd (disc_E B) ⊆ Δ_E := by + rw [isClosedDisc_subBd_eq_discBd_euclideanPlane (hdisc_E_closed B hB).1] + exact (Surface.discBd_subset (disc_E B)).trans (hdisc_E_closed B hB).2 + have hf'_bdB : ContinuousOn f' (f '' subBd (disc_E B)) := + hf'_cont.mono (image_subset_iff.mpr fun x hx => hf_maps (hsub_B hx)) + obtain ⟨e_B, he_B⟩ := exists_homeomorph_image (hf_cont.mono hsub_B) hf'_bdB + (hf_left.mono hsub_B) + let φ_B_S : Circle ≃ₜ subBd (α_disc_S B) := + φ_B.trans (e_B.trans (Homeomorph.setCongr hbd_B.symm)) + refine ⟨⟨φ_B_S⟩, φ_B_S, ?_, ?_⟩ + · intro v hv + rw [hbd_B] + exact mem_image_of_mem f (hA_B.1 v hv) + · intro v₁ v₂ v₃ hcw3 + obtain ⟨t₁, t₂, t₃, ht12, ht23, ht31, h1, h2, h3⟩ := hA_B.2 v₁ v₂ v₃ hcw3 + refine ⟨t₁, t₂, t₃, ht12, ht23, ht31, ?_, ?_, ?_⟩ + · exact (he_B (φ_B (Circle.exp t₁))).trans (congrArg f h1) + · exact (he_B (φ_B (Circle.exp t₂))).trans (congrArg f h2) + · exact (he_B (φ_B (Circle.exp t₃))).trans (congrArg f h3) + · rintro B hB _ ⟨⟨x, hxB, rfl⟩, hy_bd⟩ + have hx_Δ : x ∈ Δ_E := (hdisc_E_closed B hB).2 hxB + have hx_bd : x ∈ subBd Δ_E := (hf_mem_subBd_iff x hx_Δ).mp hy_bd + obtain ⟨v, hv, hxv⟩ := hdisc_E_inter_bd B hB ⟨hxB, hx_bd⟩ + exact ⟨v, hv, congrArg f hxv⟩ + · rintro B₁ hB₁ B₂ hB₂ hne _ ⟨⟨x₁, hx₁, rfl⟩, ⟨x₂, hx₂, hx_eq⟩⟩ + have hx12 : x₁ = x₂ := + hf_left.injOn ((hdisc_E_closed B₁ hB₁).2 hx₁) ((hdisc_E_closed B₂ hB₂).2 hx₂) hx_eq.symm + subst hx12 + obtain ⟨v, hv, hxv⟩ := hdisc_E_inter B₁ hB₁ B₂ hB₂ hne ⟨hx₁, hx₂⟩ + exact ⟨v, hv, congrArg f hxv⟩ + +/-- A cell not contained in a normal disc meets it only at its boundary marks. -/ +theorem inter_disc_subset_subBd_of_not_subset + {S : Type w} [TopologicalSpace S] [T2Space S] (hS : IsClosedSurface S) {α : Type u} {β : Type v} + {S₀ : Set (Society α β)} {α₀_disc : Society α β → Set S} {α₀_pt : α → S} + (hArr : IsSurfaceArrangement S₀ α₀_disc α₀_pt) + {Δ : Set S} (hΔ : IsClosedDisc Δ) + (hNorm : IsArrangementNormal S₀ α₀_disc α₀_pt (subBd Δ)) + {A : Society α β} (hA : A ∈ S₀) (hnot_sub : ¬ α₀_disc A ⊆ Δ) : + α₀_disc A ∩ Δ ⊆ subBd Δ ∧ α₀_disc A ∩ Δ ⊆ α₀_pt '' A.Ω.bar := by + let D := α₀_disc A + obtain ⟨hD, hD_bd⟩ := hArr.isClosedDisc A hA + have hfr_D : frontier D = subBd D := (GM11.subBd_eq_frontier D).symm + have hfr_Δ : frontier Δ = subBd Δ := (GM11.subBd_eq_frontier Δ).symm + have hdis_fr : Disjoint (D \ frontier D) (frontier Δ) := by + rw [hfr_D, hfr_Δ, Set.disjoint_left] + rintro x ⟨hxD, hx_not_bd⟩ hx_bdΔ + obtain ⟨v, hv, rfl⟩ := hNorm A hA ⟨hx_bdΔ, hxD⟩ + exact hx_not_bd (hD_bd v hv) + have hdis_Δ : Disjoint (D \ frontier D) Δ := by + refine (GM14.subset_or_disjoint_of_frontier hΔ.isClosed + (GM14.IsClosedDisc.isPreconnected_diff_frontier hS hD) hdis_fr).resolve_left ?_ + intro hsub + exact hnot_sub ((GM14.IsClosedDisc.subset_closure_diff_frontier hS hD).trans + (hΔ.isClosed.closure_subset_iff.mpr hsub)) + have hD_compl : D ⊆ closure Δᶜ := + (GM14.IsClosedDisc.subset_closure_diff_frontier hS hD).trans + (closure_mono (Set.disjoint_left.mp hdis_Δ)) + have hsub_bd : D ∩ Δ ⊆ subBd Δ := by + rintro x ⟨hxD, hxΔ⟩ + rw [← hfr_Δ, frontier_eq_closure_inter_closure] + exact ⟨subset_closure hxΔ, hD_compl hxD⟩ + refine ⟨hsub_bd, fun x hx => hNorm A hA ⟨hsub_bd hx, hx.1⟩⟩ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/DiscBoundaryHomeomorphism.lean b/LeanPool/GraphMinor/GM14/DiscBoundaryHomeomorphism.lean new file mode 100644 index 0000000000..b24d7114e3 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/DiscBoundaryHomeomorphism.lean @@ -0,0 +1,489 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM11.Section7 +public import LeanPool.GraphMinor.Surface.DiscsInSurface +import LeanPool.GraphMinor.Surface.CircleMove +import LeanPool.GraphMinor.GM09.Section4b +import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! +# Homeomorphisms matching marked disc boundaries + +Increasing real interpolation matches two cyclically ordered lists on a circle. A boundary +homeomorphism then extends over the entire disc. The planar frontier criteria identify the +boundary of the disc in Euclidean coordinates. +-/ + +public section + +namespace GraphMinor.GM14 + +open Set Topology Surface GM09 + +/-- Every point of the Euclidean plane is a surface interior point. -/ +theorem isInteriorPoint_euclideanPlane (x : EuclideanPlane) : IsInteriorPoint x := + Surface.isInteriorPoint_euclideanPlane x + +/-- The frontier of a closed disc in the plane is its disc boundary. -/ +theorem isClosedDisc_frontier_eq_discBd_euclideanPlane {D : Set EuclideanPlane} + (hD : IsClosedDisc D) : frontier D = discBd D := + Surface.plane_disc_frontier hD + +/-- The surface and disc boundaries agree for a closed disc in the plane. -/ +theorem isClosedDisc_subBd_eq_discBd_euclideanPlane {D : Set EuclideanPlane} + (hD : IsClosedDisc D) : subBd D = discBd D := + Surface.subBd_eq_discBd_euclideanPlane hD + +/-- Two strictly ordered finite lists of real points admit strictly monotone interpolation. -/ +theorem exists_strictMonoOn_interp (n : ℕ) (a b : ℕ → ℝ) + (ha : StrictMono a) (hb : StrictMono b) : + ∃ τ : ℝ → ℝ, + ContinuousOn τ (Icc (a 0) (a (n + 1))) ∧ + StrictMonoOn τ (Icc (a 0) (a (n + 1))) ∧ + ∀ i ≤ n + 1, τ (a i) = b i := by + induction n with + | zero => + have ha01 : a 0 < a 1 := ha Nat.zero_lt_one + have hb01 : b 0 < b 1 := hb Nat.zero_lt_one + have hslope : 0 < (b 1 - b 0) / (a 1 - a 0) := div_pos (by linarith) (by linarith) + let τ : ℝ → ℝ := fun x => b 0 + (b 1 - b 0) / (a 1 - a 0) * (x - a 0) + refine ⟨τ, by fun_prop, ?_, ?_⟩ + · intro x _ y _ hxy + dsimp only [τ] + nlinarith + · intro i hi + rcases Nat.le_one_iff_eq_zero_or_eq_one.mp hi with rfl | rfl + · simp [τ] + · dsimp only [τ] + have hne : a 1 - a 0 ≠ 0 := by linarith + rw [div_mul_cancel₀ _ hne] + ring + | succ n ih => + obtain ⟨τ₀, hcont₀, hmono₀, hval₀⟩ := ih + have ha_step : a (n + 1) < a (n + 2) := ha (Nat.lt_succ_self (n + 1)) + have hb_step : b (n + 1) < b (n + 2) := hb (Nat.lt_succ_self (n + 1)) + have ha0_le : a 0 ≤ a (n + 1) := ha.monotone (Nat.zero_le (n + 1)) + have hslope : 0 < (b (n + 2) - b (n + 1)) / (a (n + 2) - a (n + 1)) := + div_pos (by linarith) (by linarith) + let τ₁ : ℝ → ℝ := fun x => + b (n + 1) + (b (n + 2) - b (n + 1)) / (a (n + 2) - a (n + 1)) * (x - a (n + 1)) + let τ : ℝ → ℝ := fun x => if x ≤ a (n + 1) then τ₀ x else τ₁ x + have hτ_left : ∀ x ≤ a (n + 1), τ x = τ₀ x := fun x hx => by simp [τ, hx] + have hτ_right : ∀ x, a (n + 1) ≤ x → τ x = τ₁ x := by + intro x hx + rcases eq_or_lt_of_le hx with rfl | hlt + · simp [τ, τ₁, hval₀ (n + 1) le_rfl] + · have hnot : ¬ x ≤ a (n + 1) := not_le.mpr hlt + simp [τ, hnot] + have hcont₁ : ContinuousOn τ (Icc (a (n + 1)) (a (n + 2))) := by + refine (by fun_prop : ContinuousOn τ₁ (Icc (a (n + 1)) (a (n + 2)))).congr ?_ + intro x hx + exact hτ_right x hx.1 + have hcont₀' : ContinuousOn τ (Icc (a 0) (a (n + 1))) := by + refine hcont₀.congr ?_ + intro x hx + exact hτ_left x hx.2 + have hIcc_union : Icc (a 0) (a (n + 1)) ∪ Icc (a (n + 1)) (a (n + 2)) = Icc (a 0) (a (n + 2)) := + Icc_union_Icc_eq_Icc ha0_le ha_step.le + refine ⟨τ, ?_, ?_, ?_⟩ + · rw [← hIcc_union] + exact hcont₀'.union_of_isClosed hcont₁ isClosed_Icc isClosed_Icc + · intro x hx y hy hxy + by_cases hy_le : y ≤ a (n + 1) + · have hx_le : x ≤ a (n + 1) := hxy.le.trans hy_le + rw [hτ_left x hx_le, hτ_left y hy_le] + exact hmono₀ ⟨hx.1, hx_le⟩ ⟨hy.1, hy_le⟩ hxy + · have hy_gt : a (n + 1) < y := not_le.mp hy_le + by_cases hx_le : x ≤ a (n + 1) + · have h1 : τ x ≤ b (n + 1) := by + rw [hτ_left x hx_le, ← hval₀ (n + 1) le_rfl] + exact hmono₀.monotoneOn ⟨hx.1, hx_le⟩ ⟨ha0_le, le_rfl⟩ hx_le + have h2 : b (n + 1) < τ y := by + rw [hτ_right y hy_gt.le] + dsimp only [τ₁] + nlinarith + exact h1.trans_lt h2 + · have hx_gt : a (n + 1) < x := not_le.mp hx_le + rw [hτ_right x hx_gt.le, hτ_right y hy_gt.le] + dsimp only [τ₁] + nlinarith + · intro i hi + rcases Nat.of_le_succ hi with hi_le | rfl + · rw [hτ_left (a i) (ha.monotone hi_le)] + exact hval₀ i hi_le + · rw [hτ_right (a (n + 2)) ha_step.le] + dsimp only [τ₁] + have hne : a (n + 2) - a (n + 1) ≠ 0 := by linarith + rw [div_mul_cancel₀ _ hne] + ring + +/-- Match two cyclically ordered lists on the unit circle by a homeomorphism. -/ +theorem exists_circle_homeo_matching_angles (m : ℕ) (hm : 1 ≤ m) + (t₁ t₂ : ℕ → ℝ) (ht₁ : StrictMono t₁) (ht₂ : StrictMono t₂) + (hbd₁ : ∀ i < m, t₁ i < t₁ 0 + 2 * Real.pi) + (hbd₂ : ∀ i < m, t₂ i < t₂ 0 + 2 * Real.pi) : + ∃ h_circ : Circle ≃ₜ Circle, + ∀ i < m, h_circ (Circle.exp (t₁ i)) = Circle.exp (t₂ i) := by + have hpi : 0 < 2 * Real.pi := by positivity + let a : ℕ → ℝ := fun i => + if i < m then (t₁ i - t₁ 0) / (2 * Real.pi) else 1 + (i - m : ℕ) + let b : ℕ → ℝ := fun i => + if i < m then (t₂ i - t₂ 0) / (2 * Real.pi) else 1 + (i - m : ℕ) + have ha_mono : StrictMono a := by + intro i j hij + dsimp only [a] + by_cases hj : j < m + · have hi : i < m := hij.trans hj + simp only [hi, hj, ↓reduceIte] + exact div_lt_div_of_pos_right (by linarith [ht₁ hij]) hpi + · by_cases hi : i < m + · simp only [hi, hj, ↓reduceIte] + have hlt : (t₁ i - t₁ 0) / (2 * Real.pi) < 1 := by + rw [div_lt_one hpi] + linarith [hbd₁ i hi] + have hge : (0 : ℝ) ≤ (j - m : ℕ) := Nat.cast_nonneg _ + linarith + · simp only [hi, hj, ↓reduceIte] + have hsub : i - m < j - m := by omega + have hcast : ((i - m : ℕ) : ℝ) < ((j - m : ℕ) : ℝ) := Nat.cast_lt.mpr hsub + linarith + have hb_mono : StrictMono b := by + intro i j hij + dsimp only [b] + by_cases hj : j < m + · have hi : i < m := hij.trans hj + simp only [hi, hj, ↓reduceIte] + exact div_lt_div_of_pos_right (by linarith [ht₂ hij]) hpi + · by_cases hi : i < m + · simp only [hi, hj, ↓reduceIte] + have hlt : (t₂ i - t₂ 0) / (2 * Real.pi) < 1 := by + rw [div_lt_one hpi] + linarith [hbd₂ i hi] + have hge : (0 : ℝ) ≤ (j - m : ℕ) := Nat.cast_nonneg _ + linarith + · simp only [hi, hj, ↓reduceIte] + have hsub : i - m < j - m := by omega + have hcast : ((i - m : ℕ) : ℝ) < ((j - m : ℕ) : ℝ) := Nat.cast_lt.mpr hsub + linarith + have hm0 : 0 < m := hm + have ha0 : a 0 = 0 := by simp [a, hm0] + have hb0 : b 0 = 0 := by simp [b, hm0] + have ham : a m = 1 := by simp [a] + have hbm : b m = 1 := by simp [b] + have hm_eq : m = (m - 1) + 1 := (Nat.sub_add_cancel hm).symm + obtain ⟨τ, hcont, hmono, hval⟩ := exists_strictMonoOn_interp (m - 1) a b ha_mono hb_mono + rw [← hm_eq, ha0, ham] at hcont hmono + rw [← hm_eq] at hval + have hτ0 : τ 0 = 0 := by + have h := hval 0 (Nat.zero_le m) + rwa [ha0, hb0] at h + have hτ1 : τ 1 = τ 0 + 1 := by + have h := hval m le_rfl + rw [ham, hbm] at h + rw [hτ0, zero_add, h] + obtain ⟨h₀, _, hh₀⟩ := exists_circle_homeo hcont hmono hτ1 + let rot₁ : Circle ≃ₜ Circle := Homeomorph.mulRight (Circle.exp (-t₁ 0)) + let rot₂ : Circle ≃ₜ Circle := Homeomorph.mulRight (Circle.exp (t₂ 0)) + refine ⟨(rot₁.trans h₀).trans rot₂, fun i hi => ?_⟩ + have hai_mem : a i ∈ Icc (0 : ℝ) 1 := by + rw [← ha0, ← ham] + exact ⟨ha_mono.monotone (Nat.zero_le i), ha_mono.monotone (le_of_lt hi)⟩ + have hai_ee : ee (a i) = rot₁ (Circle.exp (t₁ i)) := by + change Circle.exp (2 * Real.pi * a i) = Circle.exp (t₁ i) * Circle.exp (-t₁ 0) + dsimp only [a] + simp only [hi, ↓reduceIte] + rw [mul_div_cancel₀ _ (ne_of_gt hpi), ← Circle.exp_add, sub_eq_add_neg] + have hbi_ee : ee (b i) = Circle.exp (t₂ i - t₂ 0) := by + dsimp only [ee, b] + simp only [hi, ↓reduceIte] + rw [mul_div_cancel₀ _ (ne_of_gt hpi)] + simp only [Homeomorph.trans_apply] + rw [← hai_ee, hh₀ (a i) hai_mem, hval i (le_of_lt hi), hbi_ee] + change Circle.exp (t₂ i - t₂ 0) * Circle.exp (t₂ 0) = Circle.exp (t₂ i) + rw [← Circle.exp_add, sub_add_cancel] + +/-- A homeomorphism between disc boundaries extends over both discs. -/ +theorem exists_disc_extension_of_bd_homeo + {S₁ : Type*} {S₂ : Type*} [TopologicalSpace S₁] [TopologicalSpace S₂] + {D₁ : Set S₁} {D₂ : Set S₂} (hD₁ : IsClosedDisc D₁) (hD₂ : IsClosedDisc D₂) + (e_bd : discBd D₁ ≃ₜ discBd D₂) : + ∃ (f : S₁ → S₂) (f' : S₂ → S₁), + MapsTo f D₁ D₂ ∧ MapsTo f' D₂ D₁ ∧ + ContinuousOn f D₁ ∧ ContinuousOn f' D₂ ∧ + LeftInvOn f' f D₁ ∧ LeftInvOn f f' D₂ ∧ + ∀ x : discBd D₁, f x.1 = (e_bd x).1 := by + obtain ⟨h₁, g₁, c₁⟩ := hD₁.exists_isChart + obtain ⟨h₂, g₂, c₂⟩ := hD₂.exists_isChart + have hsub₁ := Surface.discBd_subset D₁ + have hsub₂ := Surface.discBd_subset D₂ + have hs_sub : Metric.sphere (0 : ℂ) 1 ⊆ Metric.closedBall (0 : ℂ) 1 + := Metric.sphere_subset_closedBall + obtain ⟨e₁', he₁'⟩ := exists_homeomorph_image (c₁.hc.mono hsub₁) + (by rw [c₁.bd]; exact c₁.gc.mono hs_sub) (c₁.gh.mono hsub₁) + let e₁ : discBd D₁ ≃ₜ Metric.sphere (0 : ℂ) 1 := e₁'.trans (Homeomorph.setCongr c₁.bd) + have he₁ : ∀ x : discBd D₁, (e₁ x).1 = h₁ x.1 := fun x => he₁' x + obtain ⟨e₂', he₂'⟩ := exists_homeomorph_image (c₂.hc.mono hsub₂) + (by rw [c₂.bd]; exact c₂.gc.mono hs_sub) (c₂.gh.mono hsub₂) + let e₂ : discBd D₂ ≃ₜ Metric.sphere (0 : ℂ) 1 := e₂'.trans (Homeomorph.setCongr c₂.bd) + have he₂ : ∀ x : discBd D₂, (e₂ x).1 = h₂ x.1 := fun x => he₂' x + let e_sph : Metric.sphere (0 : ℂ) 1 ≃ₜ Metric.sphere (0 : ℂ) 1 := (e₁.symm.trans e_bd).trans e₂ + obtain ⟨h₀, k₀, m, hh₀⟩ := exists_bdMatch e_sph + obtain ⟨ψ, χ, m', hψ⟩ := exists_bdMatch_closedInner oArc_sphere oArc_sphere m + rw [closedInner_sphere] at m' + obtain ⟨m_maps₁, m_maps₂, m_left, m_right, m_cont₁, m_cont₂⟩ := m' + let f : S₁ → S₂ := g₂ ∘ ψ ∘ h₁ + let f' : S₂ → S₁ := g₁ ∘ χ ∘ h₂ + refine ⟨f, f', ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro x hx + exact c₂.gm (m_maps₁ (c₁.hm hx)) + · intro y hy + exact c₁.gm (m_maps₂ (c₂.hm hy)) + · exact c₂.gc.comp (m_cont₁.comp c₁.hc c₁.hm) (m_maps₁.comp c₁.hm) + · exact c₁.gc.comp (m_cont₂.comp c₂.hc c₂.hm) (m_maps₂.comp c₂.hm) + · intro x hx + dsimp only [f, f', Function.comp_apply] + rw [c₂.hg (m_maps₁ (c₁.hm hx)), m_left (c₁.hm hx), c₁.gh hx] + · intro y hy + dsimp only [f, f', Function.comp_apply] + rw [c₁.hg (m_maps₂ (c₂.hm hy)), m_right (c₂.hm hy), c₂.gh hy] + · intro x + dsimp only [f, Function.comp_apply] + have hx_sph : h₁ x.1 ∈ Metric.sphere (0 : ℂ) 1 := c₁.bd ▸ mem_image_of_mem h₁ x.2 + have he₁_x : (⟨h₁ x.1, hx_sph⟩ : Metric.sphere (0 : ℂ) 1) = e₁ x := Subtype.ext (he₁ x).symm + rw [hψ hx_sph, hh₀ ⟨h₁ x.1, hx_sph⟩, he₁_x] + simp only [e_sph, Homeomorph.trans_apply, Homeomorph.symm_apply_apply] + rw [he₂ (e_bd x), c₂.gh (hsub₂ (e_bd x).2)] + +/-- The order on clockwise triples determines increasing angles for any list of length at least +three. -/ +theorem exists_angles_of_clockwise_triples + {S : Type*} [TopologicalSpace S] {α : Type*} + {ν : α → S} {Ω : CyclicPerm α} {C : Set S} {φ : Circle ≃ₜ C} {L : List α} + (hAgree : ∀ v₁ v₂ v₃ : α, Ω.IsClockwise3 v₁ v₂ v₃ → + ∃ (t₁ t₂ t₃ : ℝ), t₁ < t₂ ∧ t₂ < t₃ ∧ t₃ < t₁ + 2 * Real.pi ∧ + (φ (Circle.exp t₁)).1 = ν v₁ ∧ (φ (Circle.exp t₂)).1 = ν v₂ ∧ + (φ (Circle.exp t₃)).1 = ν v₃) + (hcw : Ω.IsClockwiseSeq L) (hlen3 : 3 ≤ L.length) : + ∃ t : ℕ → ℝ, + StrictMono t ∧ + (∀ i < L.length, t i < t 0 + 2 * Real.pi) ∧ + ∀ (i : ℕ) (hi : i < L.length), (φ (Circle.exp (t i))).1 = ν (L[i]'hi) := by + classical + have hpi : 0 < 2 * Real.pi := Real.two_pi_pos + let pt : ℝ → S := fun t => (φ (Circle.exp t)).1 + have hpt_eq_iff : ∀ t₁ t₂ : ℝ, pt t₁ = pt t₂ ↔ ∃ m : ℤ, t₁ = t₂ + m * (2 * Real.pi) := by + intro t₁ t₂ + constructor + · intro h + have h1 : φ (Circle.exp t₁) = φ (Circle.exp t₂) := Subtype.ext h + exact Circle.exp_eq_exp.mp (φ.injective h1) + · rintro ⟨m, rfl⟩ + have h2 : Circle.exp (t₂ + m * (2 * Real.pi)) = Circle.exp t₂ := + Circle.exp_eq_exp.mpr ⟨m, rfl⟩ + simp [pt, h2] + have hpt_inj : ∀ t₀ : ℝ, InjOn pt (Ico t₀ (t₀ + 2 * Real.pi)) := by + intro t₀ t₁ ht₁ t₂ ht₂ h + obtain ⟨m, rfl⟩ := (hpt_eq_iff t₁ t₂).mp h + have hm0 : m = 0 := by + by_contra hm + rcases lt_or_gt_of_ne hm with hlt | hgt + · have hm_le : (m : ℝ) ≤ -1 := by exact_mod_cast Int.le_sub_one_of_lt hlt + have : (m : ℝ) * (2 * Real.pi) ≤ -1 * (2 * Real.pi) := + mul_le_mul_of_nonneg_right hm_le hpi.le + linarith [ht₁.1, ht₂.2] + · have hm_ge : (1 : ℝ) ≤ m := by exact_mod_cast hgt + have : 1 * (2 * Real.pi) ≤ (m : ℝ) * (2 * Real.pi) := + mul_le_mul_of_nonneg_right hm_ge hpi.le + linarith [ht₁.2, ht₂.1] + simp [hm0] + have h012 : Ω.IsClockwise3 (L[0]'(by omega)) (L[1]'(by omega)) (L[2]'(by omega)) := + (Ω.mem_interval_of_lt hcw (by omega) (by omega) hlen3).2 + obtain ⟨t₀, t₁, t₂, ht01, ht12, ht20, hpt0, hpt1, hpt2⟩ := + hAgree (L[0]'(by omega)) (L[1]'(by omega)) (L[2]'(by omega)) h012 + have hshift3 : ∀ v₁ v₂ : α, Ω.IsClockwise3 (L[0]'(by omega)) v₁ v₂ → + ∃ u₁ u₂ : ℝ, t₀ < u₁ ∧ u₁ < u₂ ∧ u₂ < t₀ + 2 * Real.pi ∧ + pt u₁ = ν v₁ ∧ pt u₂ = ν v₂ := by + intro v₁ v₂ hcw3 + obtain ⟨s₀, s₁, s₂, hs01, hs12, hs20, hs₀, hs₁, hs₂⟩ := hAgree (L[0]'(by omega)) v₁ v₂ hcw3 + obtain ⟨m, hm⟩ := (hpt_eq_iff t₀ s₀).mp (hpt0.trans hs₀.symm) + refine ⟨s₁ + m * (2 * Real.pi), s₂ + m * (2 * Real.pi), by linarith, by linarith, by linarith, + ?_, ?_⟩ + · exact ((hpt_eq_iff _ s₁).mpr ⟨m, rfl⟩).trans hs₁ + · exact ((hpt_eq_iff _ s₂).mpr ⟨m, rfl⟩).trans hs₂ + have hex : ∀ (i : ℕ) (hi : i < L.length), + ∃ u ∈ Ico t₀ (t₀ + 2 * Real.pi), pt u = ν (L[i]'hi) ∧ (0 < i → t₀ < u) := by + intro i hi + rcases Nat.eq_zero_or_pos i with rfl | hi_pos + · exact ⟨t₀, ⟨le_rfl, by linarith⟩, hpt0, fun h => (Nat.lt_irrefl 0 h).elim⟩ + · by_cases hi1 : i = 1 + · subst hi1 + exact ⟨t₁, ⟨le_of_lt ht01, by linarith⟩, hpt1, fun _ => ht01⟩ + · have hcw_i : Ω.IsClockwise3 (L[0]'(by omega)) (L[1]'(by omega)) (L[i]'hi) := + (Ω.mem_interval_of_lt hcw (by omega) (by omega) hi).2 + obtain ⟨u₁, u₂, hu01, hu12, hu20, _, hu₂⟩ := hshift3 (L[1]'(by omega)) (L[i]'hi) hcw_i + exact ⟨u₂, ⟨le_of_lt (hu01.trans hu12), hu20⟩, hu₂, fun _ => hu01.trans hu12⟩ + let t : ℕ → ℝ := fun i => + if hi : i < L.length then Classical.choose (hex i hi) else t₀ + 2 * Real.pi + i + have ht_spec : ∀ (i : ℕ) (hi : i < L.length), + t i ∈ Ico t₀ (t₀ + 2 * Real.pi) ∧ pt (t i) = ν (L[i]'hi) ∧ (0 < i → t₀ < t i) := by + intro i hi + have h_eq : t i = Classical.choose (hex i hi) := by + dsimp only [t]; split_ifs; rfl + rw [h_eq] + exact Classical.choose_spec (hex i hi) + have ht0_eq : t 0 = t₀ := by + obtain ⟨ht0_mem, ht0_pt, _⟩ := ht_spec 0 (by omega) + exact hpt_inj t₀ ht0_mem ⟨le_rfl, by linarith⟩ (ht0_pt.trans hpt0.symm) + refine ⟨t, ?_, ?_, ?_⟩ + · intro i j hij + by_cases hj : j < L.length + · have hi : i < L.length := hij.trans hj + rcases Nat.eq_zero_or_pos i with rfl | hi_pos + · rw [ht0_eq] + exact (ht_spec j hj).2.2 hij + · have hcw_ij : Ω.IsClockwise3 (L[0]'(by omega)) (L[i]'hi) (L[j]'hj) := + (Ω.mem_interval_of_lt hcw hi_pos hij hj).2 + obtain ⟨u₁, u₂, hu01, hu12, hu20, hu₁, hu₂⟩ := hshift3 (L[i]'hi) (L[j]'hj) hcw_ij + have hti : t i = u₁ := + hpt_inj t₀ (ht_spec i hi).1 ⟨le_of_lt hu01, hu12.trans hu20⟩ + ((ht_spec i hi).2.1.trans hu₁.symm) + have htj : t j = u₂ := + hpt_inj t₀ (ht_spec j hj).1 ⟨le_of_lt (hu01.trans hu12), hu20⟩ + ((ht_spec j hj).2.1.trans hu₂.symm) + linarith + · by_cases hi : i < L.length + · have hti := (ht_spec i hi).1.2 + have htj : t j = t₀ + 2 * Real.pi + j := by dsimp only [t]; split_ifs; rfl + have hj_nonneg : (0 : ℝ) ≤ j := Nat.cast_nonneg j + linarith + · have hti : t i = t₀ + 2 * Real.pi + i := by dsimp only [t]; split_ifs; rfl + have htj : t j = t₀ + 2 * Real.pi + j := by dsimp only [t]; split_ifs; rfl + have hij_cast : (i : ℝ) < (j : ℝ) := Nat.cast_lt.mpr hij + linarith + · intro i hi + rw [ht0_eq] + exact (ht_spec i hi).1.2 + · intro i hi + simpa [pt] using (ht_spec i hi).2.1 + +/-- Represent a nonempty clockwise sequence by increasing angles over one turn. -/ +theorem exists_angles_of_isClockwiseSeq + {S : Type*} [TopologicalSpace S] {α : Type*} + {ν : α → S} {Ω : CyclicPerm α} {C : Set S} {φ : Circle ≃ₜ C} {L : List α} + (hA : AgreesWithOArcHomeo ν Ω C φ) (hinj : InjOn ν Ω.bar) + (hcw : Ω.IsClockwiseSeq L) (hlen : 1 ≤ L.length) : + ∃ t : ℕ → ℝ, + StrictMono t ∧ + (∀ i < L.length, t i < t 0 + 2 * Real.pi) ∧ + ∀ (i : ℕ) (hi : i < L.length), (φ (Circle.exp (t i))).1 = ν (L[i]'hi) := by + classical + have hpi : 0 < 2 * Real.pi := Real.two_pi_pos + by_cases hlen3 : 3 ≤ L.length + · exact exists_angles_of_clockwise_triples hA.2 hcw hlen3 + · have hmem0 : L[0]'hlen ∈ Ω.bar := hcw.2.1 _ (List.getElem_mem hlen) + obtain ⟨θ₀, hθ₀⟩ := Circle.exp_surjective (φ.symm ⟨ν (L[0]'hlen), hA.1 _ hmem0⟩) + have hpt0 : (φ (Circle.exp θ₀)).1 = ν (L[0]'hlen) := by + rw [hθ₀, φ.apply_symm_apply] + rcases ( by omega : L.length = 1 ∨ L.length = 2 ) with hlen1 | hlen2 + · refine ⟨fun i => θ₀ + i, ?_, ?_, ?_⟩ + · intro i j hij + have hij_cast : (i : ℝ) < (j : ℝ) := Nat.cast_lt.mpr hij + linarith + · intro i hi + have hi0 : i = 0 := by omega + subst hi0 + simp [hpi] + · intro i hi + have hi0 : i = 0 := by omega + subst hi0 + simpa using hpt0 + · have h1_lt : 1 < L.length := by omega + have hmem1 : L[1]'h1_lt ∈ Ω.bar := hcw.2.1 _ (List.getElem_mem h1_lt) + obtain ⟨θ₁', hθ₁'⟩ := Circle.exp_surjective (φ.symm ⟨ν (L[1]'h1_lt), hA.1 _ hmem1⟩) + obtain ⟨θ₁, hθ₁_mem, hθ₁_exp⟩ := Circle.periodic_exp.exists_mem_Ico hpi θ₁' θ₀ + have hpt1 : (φ (Circle.exp θ₁)).1 = ν (L[1]'h1_lt) := by + rw [← hθ₁_exp, hθ₁', φ.apply_symm_apply] + have hne01 : L[0]'hlen ≠ L[1]'h1_lt := by + intro heq + have := (List.Nodup.getElem_inj_iff hcw.1).mp heq + omega + have hθ0_lt_θ1 : θ₀ < θ₁ := by + rcases eq_or_lt_of_le hθ₁_mem.1 with rfl | hlt + · exfalso + exact hne01 (hinj hmem0 hmem1 (hpt0.symm.trans hpt1)) + · exact hlt + let t : ℕ → ℝ := fun i => + if i = 0 then θ₀ else if i = 1 then θ₁ else θ₀ + 2 * Real.pi + i + refine ⟨t, ?_, ?_, ?_⟩ + · intro i j hij + dsimp only [t] + by_cases hj : j < 2 + · have hi0 : i = 0 := by omega + have hj1 : j = 1 := by omega + subst hi0; subst hj1 + simpa using hθ0_lt_θ1 + · by_cases hi : i < 2 + · have hj_nonneg : (0 : ℝ) ≤ j := Nat.cast_nonneg j + rcases (by omega : i = 0 ∨ i = 1) with rfl | rfl + · simp only [↓reduceIte, show j ≠ 0 by omega, show j ≠ 1 by omega] + linarith + · simp only [show (1 : ℕ) ≠ 0 by omega, ↓reduceIte, show j ≠ 0 by omega, + show j ≠ 1 by omega] + linarith [hθ₁_mem.2] + · simp only [show i ≠ 0 by omega, show i ≠ 1 by omega, show j ≠ 0 by omega, + show j ≠ 1 by omega, ↓reduceIte] + have hij_cast : (i : ℝ) < (j : ℝ) := Nat.cast_lt.mpr hij + linarith + · intro i hi + dsimp only [t] + rcases (by omega : i = 0 ∨ i = 1) with rfl | rfl + · simp [hpi] + · simpa using hθ₁_mem.2 + · intro i hi + dsimp only [t] + rcases (by omega : i = 0 ∨ i = 1) with rfl | rfl + · simpa using hpt0 + · simpa using hpt1 + +/-- Match the marked points of two circle parametrizations with the same cyclic order. -/ +theorem exists_bd_homeo_of_agreesWithOArcHomeo + {S₁ : Type*} {S₂ : Type*} [TopologicalSpace S₁] [TopologicalSpace S₂] {α : Type*} + {ν₁ : α → S₁} {ν₂ : α → S₂} {Ω : CyclicPerm α} {C₁ : Set S₁} {C₂ : Set S₂} + {φ₁ : Circle ≃ₜ C₁} {φ₂ : Circle ≃ₜ C₂} + (hA₁ : AgreesWithOArcHomeo ν₁ Ω C₁ φ₁) (hA₂ : AgreesWithOArcHomeo ν₂ Ω C₂ φ₂) + (hinj₁ : InjOn ν₁ Ω.bar) (hinj₂ : InjOn ν₂ Ω.bar) : + ∃ e_bd : C₁ ≃ₜ C₂, ∀ v (hv : v ∈ Ω.bar), (e_bd ⟨ν₁ v, hA₁.1 v hv⟩).1 = ν₂ v := by + rcases Ω.bar.eq_empty_or_nonempty with hemp | ⟨w₀, hw₀⟩ + · refine ⟨φ₁.symm.trans φ₂, fun v hv => ?_⟩ + rw [hemp] at hv + exact hv.elim + · obtain ⟨L, hL_len, hL_set, _, hcw⟩ := Ω.exists_isClockwiseSeq_of_subset_bar Subset.rfl hw₀ + have hlen_pos : 1 ≤ L.length := by + have hw₀L : w₀ ∈ L := by + have : w₀ ∈ {v | v ∈ L} := hL_set.symm ▸ hw₀ + exact this + exact List.length_pos_of_mem hw₀L + obtain ⟨t₁, ht₁_mono, ht₁_bd, ht₁_pt⟩ := exists_angles_of_isClockwiseSeq hA₁ hinj₁ hcw hlen_pos + obtain ⟨t₂, ht₂_mono, ht₂_bd, ht₂_pt⟩ := exists_angles_of_isClockwiseSeq hA₂ hinj₂ hcw hlen_pos + obtain ⟨h_circ, hh_circ⟩ := + exists_circle_homeo_matching_angles L.length hlen_pos t₁ t₂ ht₁_mono ht₂_mono ht₁_bd ht₂_bd + refine ⟨φ₁.symm.trans (h_circ.trans φ₂), fun v hv => ?_⟩ + have hvL : v ∈ L := by + have : v ∈ {x | x ∈ L} := hL_set.symm ▸ hv + exact this + obtain ⟨i, hi, rfl⟩ := List.getElem_of_mem hvL + have hφ₁_eq : (⟨ν₁ (L[i]'hi), hA₁.1 _ hv⟩ : C₁) = φ₁ (Circle.exp (t₁ i)) := + Subtype.ext (ht₁_pt i hi).symm + simp only [Homeomorph.trans_apply] + rw [hφ₁_eq, φ₁.symm_apply_apply, hh_circ i hi, ht₂_pt i hi] + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/DiscSlope.lean b/LeanPool/GraphMinor/GM14/DiscSlope.lean new file mode 100644 index 0000000000..49a17a09c3 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/DiscSlope.lean @@ -0,0 +1,391 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Section6Pretangle +public import LeanPool.GraphMinor.GM11.Section7 +public import LeanPool.GraphMinor.GM11.Section3 +public import LeanPool.GraphMinor.GM11.Section4c +public import LeanPool.GraphMinor.GM11.Forest +public import LeanPool.GraphMinor.GM11.Fan +public import LeanPool.GraphMinor.GM11.PlaneFacts +public import LeanPool.GraphMinor.Surface.DiscsInSurface +public import LeanPool.GraphMinor.Surface.DiscUnion +public import LeanPool.GraphMinor.Surface.SphereDisc +public import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.GM11.DrawingTopology +import LeanPool.GraphMinor.GM11.NormalNoncover +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# Slopes from Pretangles and Closed Discs + +This file provides two slope constructions used across Graph Minors XIV: + +1. `isSlope_of_derived`: the inside function derived from a respectful pretangle of order `θ` + gives a slope of order `θ` in the radial drawing, as described before (6.1) in Graph Minors XI, + page 87. Lean uses the circuit-length cutoff `2 * θ`. Graph Minors XIV uses this construction + in Sections 7 and 9. +2. `isSlope_discIns`: for any drawing `Γ'` with `U(Γ') ⊆ Δ` inside a closed disc `Δ` in a connected + closed surface `S`, the function `discIns Δ` mapping each circuit `C` of `Γ'` to the unique + closed disc in `Δ` bounded by `U(C)` is a slope of any order `k ≥ 2` on `Γ'` (used in Section 5 + of Graph Minors XIV). +3. `IsClosedDisc.isOpenDisc_diff_subBd`: for any closed disc `D` in a closed surface `S`, + `D \ subBd D` is an open disc with closure `D` and boundary `subBd D`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 Metric Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Boundary and Interior of Closed Discs in a Closed Surface -/ + +/-- The manifold boundary of a closed disc in a closed surface is its frontier. This is invariance +of domain, in a chart of the surface. -/ +theorem IsClosedDisc.frontier_eq_discBd (hS : IsClosedSurface S) {D : Set S} (hD : IsClosedDisc D) : + frontier D = discBd D := + GM11.IsClosedDisc.frontier_eq_discBd hS hD + +theorem IsClosedDisc.subBd_eq_discBd (hS : IsClosedSurface S) {D : Set S} (hD : IsClosedDisc D) : + subBd D = discBd D := by + rw [subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hS hD] + +/-- A closed disc in a closed surface is the closure of its interior. -/ +theorem IsClosedDisc.subset_closure_diff_frontier (hS : IsClosedSurface S) {D : Set S} + (hD : IsClosedDisc D) : D ⊆ closure (D \ frontier D) := + GM11.IsClosedDisc.subset_closure_diff_frontier hS hD + +/-- For a closed disc `D` in a closed surface `S`, `D \ subBd D` is an open disc with closure `D` +and boundary `subBd D`. -/ +theorem IsClosedDisc.isOpenDisc_diff_subBd (hS : IsClosedSurface S) {D : Set S} + (hD : IsClosedDisc D) : + IsOpenDisc (D \ subBd D) ∧ closure (D \ subBd D) = D ∧ subBd (D \ subBd D) = subBd D := by + have : T2Space S := hS.2.1 + have hman : ∀ x : S, IsManifoldPoint x := (IsClosedSurface.isSurface hS).2.2 + have hcl : IsClosed D := hD.isCompact.isClosed + have hbd : subBd D = discBd D := IsClosedDisc.subBd_eq_discBd hS hD + have hfr : frontier D = subBd D := (subBd_eq_frontier D).symm + obtain ⟨h, g, c⟩ := hD.exists_isChart + obtain ⟨u1, d1⟩ := c.union_ball + have hEq : D \ subBd D = g '' ball 0 1 := by + rw [hbd] + ext x + constructor + · rintro ⟨hxD, hxn⟩ + rw [← u1] at hxD + rcases hxD with hx | hx + · exact hx + · exact absurd hx hxn + · intro hx + exact ⟨u1 ▸ Or.inl hx, disjoint_left.mp d1 hx⟩ + have hOpen : IsOpen (D \ subBd D) := by + rw [hEq] + exact c.isOpen_image_ball hman + have hHomeo : Nonempty (OpenUnitDisc ≃ₜ (D \ subBd D : Set S)) := by + -- `g ∘ complexPlane.symm` maps `OpenUnitDisc` onto `g '' ball 0 1 = D \ subBd D` with inverse + -- `complexPlane ∘ h`. + have hball : ∀ x : OpenUnitDisc, complexPlane.symm x.1 ∈ ball (0 : ℂ) 1 := by + intro x + have hx : ‖x.1‖ < 1 := by simpa [OpenUnitDisc] using x.2 + simpa [mem_ball_zero_iff] using hx + have hmemD : ∀ x : OpenUnitDisc, g (complexPlane.symm x.1) ∈ D \ subBd D := by + intro x + rw [hEq] + exact mem_image_of_mem g (hball x) + have hinvM : ∀ y : (D \ subBd D : Set S), complexPlane (h y.1) ∈ OpenUnitDisc := by + intro y + have hy : y.1 ∈ g '' ball 0 1 := hEq ▸ y.2 + obtain ⟨z, hz, hzy⟩ := hy + rw [← hzy, c.hg (ball_subset_closedBall hz)] + have hzn : ‖complexPlane z‖ < 1 := by + rw [LinearIsometryEquiv.norm_map] + simpa [mem_ball_zero_iff] using hz + simpa [OpenUnitDisc] using hzn + refine ⟨{ + toFun := fun x => ⟨g (complexPlane.symm x.1), hmemD x⟩ + invFun := fun y => ⟨complexPlane (h y.1), hinvM y⟩ + left_inv := fun x => by + apply Subtype.ext + change complexPlane (h (g (complexPlane.symm x.1))) = x.1 + rw [c.hg (ball_subset_closedBall (hball x)), LinearIsometryEquiv.apply_symm_apply] + right_inv := fun y => by + apply Subtype.ext + change g (complexPlane.symm (complexPlane (h y.1))) = y.1 + rw [LinearIsometryEquiv.symm_apply_apply, c.gh y.2.1] + continuous_toFun := by + refine Continuous.subtype_mk ?_ _ + have hc : ContinuousOn g (ball 0 1) := c.gc.mono ball_subset_closedBall + exact hc.comp_continuous (complexPlane.symm.continuous.comp continuous_subtype_val) hball + continuous_invFun := by + refine Continuous.subtype_mk ?_ _ + refine complexPlane.continuous.comp ?_ + exact c.hc.comp_continuous continuous_subtype_val fun y => y.2.1 + }⟩ + have hclEq : closure (D \ subBd D) = D := by + apply subset_antisymm (hcl.closure_subset_iff.mpr sdiff_subset) + rw [← hfr] + exact IsClosedDisc.subset_closure_diff_frontier hS hD + have hsubBdEq : subBd (D \ subBd D) = subBd D := by + have hsubD : subBd D ⊆ D := by + rw [← hfr] + exact hcl.frontier_subset + rw [subBd_eq_frontier, frontier_eq_closure_inter_closure, hclEq, + hOpen.isClosed_compl.closure_eq] + ext x + constructor + · rintro ⟨hxD, hxnot⟩ + by_contra hnbd + exact hxnot ⟨hxD, hnbd⟩ + · intro hxbd + exact ⟨hsubD hxbd, fun h => h.2 hxbd⟩ + exact ⟨⟨hOpen, hHomeo⟩, hclEq, hsubBdEq⟩ + +/-- The interior of a closed disc in a closed surface is preconnected. -/ +theorem IsClosedDisc.isPreconnected_diff_frontier (hS : IsClosedSurface S) {D : Set S} + (hD : IsClosedDisc D) : IsPreconnected (D \ frontier D) := + GM11.IsClosedDisc.isPreconnected_diff_frontier hS hD + +/-- A preconnected set disjoint from the frontier of a closed set `X` is either contained in `X` +or disjoint from `X`. -/ +theorem subset_or_disjoint_of_frontier {X F : Set S} (hX : IsClosed X) (hF : IsPreconnected F) + (hd : Disjoint F (frontier X)) : F ⊆ X ∨ Disjoint F X := + GM11.subset_or_disjoint_of_frontier hX hF hd + +/-! ## 2. Two Lines with Common Ends and Circuits as `O`-Arcs -/ + +/-- Two different closed discs of a connected closed surface with the same boundary cover the +surface. -/ +theorem cover_of_discBd_eq [ConnectedSpace S] (hS : IsClosedSurface S) {Δ₁ Δ₂ : Set S} + (h₁ : IsClosedDisc Δ₁) (h₂ : IsClosedDisc Δ₂) (hb : discBd Δ₁ = discBd Δ₂) (hne : Δ₁ ≠ Δ₂) : + Δ₁ ∪ Δ₂ = univ := + GM11.cover_of_discBd_eq hS h₁ h₂ hb hne + +/-- The part of a line between its ends is connected. -/ +theorem IsLineWithEnds.isPreconnected_sdiff_pair {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : + IsPreconnected (L \ {a, b}) := + GM11.IsLineWithEnds.isPreconnected_sdiff_pair h + +/-- Let `A₀, A₁, A₂` be lines with common ends and otherwise disjoint, and let `Δ_i` be a closed +disc +with boundary the union of the other two lines. If `A_i ⊄ Δ_i` for each `i`, then `Δ₀ ∪ Δ₁` is a +closed disc distinct from `Δ₂` with the same boundary as `Δ₂`. -/ +theorem theta_disc_union (hS : IsClosedSurface S) {A₀ A₁ A₂ Δ₀ Δ₁ Δ₂ : Set S} {a b : S} + (l₀ : IsLineWithEnds A₀ a b) (l₁ : IsLineWithEnds A₁ a b) (l₂ : IsLineWithEnds A₂ a b) + (i₀₁ : A₀ ∩ A₁ = {a, b}) (i₁₂ : A₁ ∩ A₂ = {a, b}) (i₂₀ : A₂ ∩ A₀ = {a, b}) + (d₀ : IsClosedDisc Δ₀) (d₁ : IsClosedDisc Δ₁) (d₂ : IsClosedDisc Δ₂) + (f₀ : frontier Δ₀ = A₁ ∪ A₂) (f₁ : frontier Δ₁ = A₂ ∪ A₀) (f₂ : frontier Δ₂ = A₀ ∪ A₁) + (h₀ : ¬ A₀ ⊆ Δ₀) (h₁ : ¬ A₁ ⊆ Δ₁) (h₂ : ¬ A₂ ⊆ Δ₂) : + IsClosedDisc (Δ₀ ∪ Δ₁) ∧ discBd (Δ₀ ∪ Δ₁) = discBd Δ₂ ∧ Δ₀ ∪ Δ₁ ≠ Δ₂ := + GM11.theta_union hS l₀ l₁ l₂ i₀₁ i₁₂ i₂₀ d₀ d₁ d₂ f₀ f₁ f₂ h₀ h₁ h₂ + +theorem theta_cover [ConnectedSpace S] (hS : IsClosedSurface S) {A₀ A₁ A₂ Δ₀ Δ₁ Δ₂ : Set S} {a b : + S} + (l₀ : IsLineWithEnds A₀ a b) (l₁ : IsLineWithEnds A₁ a b) (l₂ : IsLineWithEnds A₂ a b) + (i₀₁ : A₀ ∩ A₁ = {a, b}) (i₁₂ : A₁ ∩ A₂ = {a, b}) (i₂₀ : A₂ ∩ A₀ = {a, b}) + (d₀ : IsClosedDisc Δ₀) (d₁ : IsClosedDisc Δ₁) (d₂ : IsClosedDisc Δ₂) + (f₀ : frontier Δ₀ = A₁ ∪ A₂) (f₁ : frontier Δ₁ = A₂ ∪ A₀) (f₂ : frontier Δ₂ = A₀ ∪ A₁) + (h₀ : ¬ A₀ ⊆ Δ₀) (h₁ : ¬ A₁ ⊆ Δ₁) (h₂ : ¬ A₂ ⊆ Δ₂) : Δ₀ ∪ Δ₁ ∪ Δ₂ = univ := + GM11.theta_cover hS l₀ l₁ l₂ i₀₁ i₁₂ i₂₀ d₀ d₁ d₂ f₀ f₁ f₂ h₀ h₁ h₂ + +section Paths + +variable [T2Space S] + +omit [T2Space S] in +theorem mem_V_of_mem_support {Γ : Drawing S} {a b : S} (W : GraphWalk Γ.toGraph a b) {x : S} + (hx : x ∈ W.support) : x ∈ Γ.V := + GM11.mem_V_of_mem_support W hx + +omit [T2Space S] in +theorem mem_E_of_mem_edges {Γ : Drawing S} {a b : S} (W : GraphWalk Γ.toGraph a b) {f : Set S} + (hf : f ∈ W.edges) : f ∈ Γ.E := + GM11.mem_E_of_mem_edges W hf + +omit [T2Space S] in +/-- A vertex in the closure of an edge of a walk is on the walk. -/ +theorem mem_support_of_mem_edges {Γ : Drawing S} {a b : S} (W : GraphWalk Γ.toGraph a b) {f : Set S} + (hf : f ∈ W.edges) {x : S} (hxf : x ∈ closure f) (hxV : x ∈ Γ.V) : x ∈ W.support := + GM11.mem_support_of_mem_edges W hf hxf hxV + +/-- The union of the vertices and edges of a path with distinct ends is a line between them. -/ +theorem walk_isLine (Γ : Drawing S) {a b : S} (W : GraphWalk Γ.toGraph a b) (hW : W.IsSimple) + (hab : a ≠ b) : IsLineWithEnds ({x | x ∈ W.support} ∪ ⋃ e ∈ {e | e ∈ W.edges}, closure e) a b := + GM11.walk_isLine Γ W hW hab + +omit [T2Space S] in +/-- A path of positive length has distinct ends. -/ +theorem ne_of_isPathBetween {P : Drawing S} {a b : S} (hP : P.IsPathBetween a b) + (hl : 0 < P.length) : a ≠ b := + GM11.ne_of_isPathBetween hP hl + +/-- A path of positive length is a line between its ends. -/ +theorem isLine_of_isPathBetween {P : Drawing S} {a b : S} (hP : P.IsPathBetween a b) + (hab : a ≠ b) : IsLineWithEnds P.U a b := + GM11.isLine_of_isPathBetween hP hab + +omit [T2Space S] in +/-- Two subdrawings of a drawing without common edges meet only in common vertices. -/ +theorem U_inter_of_disjoint {Γ C D : Drawing S} (hC : C.IsSubdrawing Γ) (hD : D.IsSubdrawing Γ) + (hE : Disjoint C.E D.E) : C.U ∩ D.U = C.V ∩ D.V := + GM11.U_inter_of_disjoint hC hD hE + +/-- Two lines with the same two ends and nothing else in common form an `O`-arc. -/ +theorem isOArc_union {L₁ L₂ : Set S} {a b : S} (h₁ : IsLineWithEnds L₁ a b) + (h₂ : IsLineWithEnds L₂ a b) (hcap : L₁ ∩ L₂ ⊆ {a, b}) : IsOArc (L₁ ∪ L₂) := + GM11.isOArc_union h₁ h₂ hcap + +/-- The point set `U(C)` of any circuit `C` in a Hausdorff space is an `O`-arc. -/ +theorem isOArc_of_isCircuit {C : Drawing S} (hC : C.IsCircuit) : IsOArc C.U := + GM11.IsCircuit.isOArc_U hC + +end Paths + +/-! ## 3. Derived Slope of a Pretangle -/ + +section Tangle + +variable [T1Space S] {Γ : PaintingOrDrawing S} {Γ' : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + +omit [T1Space S] in +theorem PaintingOrDrawing.toHypergraph_inc {Γ : PaintingOrDrawing S} {e : Set S} {v : S} : + Γ.toHypergraph.Inc e v ↔ e ∈ Γ.E ∧ v ∈ Γ.V ∧ v ∈ closure e := + GM11.PaintingOrDrawing.toHypergraph_inc + +omit [T1Space S] in +theorem PaintingOrDrawing.edge_props {Γ : PaintingOrDrawing S} {e : Set S} (he : e ∈ Γ.E) : + IsPreconnected e ∧ Disjoint e Γ.V ∧ e ⊆ Γ.U ∧ e.Nonempty := + GM11.PaintingOrDrawing.edge_props he + +omit [T1Space S] in +theorem edge_subset_or_disjoint_of_radial (hrad : Γ.U ∩ Γ'.U = Γ.V) {Δ : Set S} (hΔ : IsClosed Δ) + (hb : frontier Δ ⊆ Γ'.U) {e : Set S} (he : e ∈ Γ.E) : e ⊆ Δ ∨ Disjoint e Δ := + GM11.edge_subset_or_disjoint_of_radial hrad hΔ hb he + +omit [T1Space S] in +theorem not_cover (hT : IsPretangle Γ.toHypergraph θ T) (hrad : Γ.U ∩ Γ'.U = Γ.V) + {Δ₁ Δ₂ Δ₃ : Set S} (c₁ : IsClosed Δ₁) (c₂ : IsClosed Δ₂) (c₃ : IsClosed Δ₃) + (b₁ : frontier Δ₁ ⊆ Γ'.U) (b₂ : frontier Δ₂ ⊆ Γ'.U) (b₃ : frontier Δ₃ ⊆ Γ'.U) + (m₁ : (Γ.inter Δ₁, Γ.interOutside Δ₁) ∈ T) (m₂ : (Γ.inter Δ₂, Γ.interOutside Δ₂) ∈ T) + (m₃ : (Γ.inter Δ₃, Γ.interOutside Δ₃) ∈ T) (hcov : Δ₁ ∪ Δ₂ ∪ Δ₃ = univ) : False := + GM11.not_cover_of_radial_frontiers hT hrad c₁ c₂ c₃ b₁ b₂ b₃ m₁ m₂ m₃ hcov + +/-- A derived inside function is a slope with circuit-length cutoff `2 * θ`. +This is the cutoff for a slope of order `θ` in Graph Minors XI, page 87, before (6.1). -/ +theorem isSlope_of_derived [ConnectedSpace S] (hS : IsClosedSurface S) + (hT : IsPretangle Γ.toHypergraph θ T) (hrad : Γ.U ∩ Γ'.U = Γ.V) + (hd : IsDerivedSlope Γ Γ' θ T ins) : IsSlope Γ' (2 * θ) ins := + GM11.isSlope_of_derived hS hT hrad hd + +end Tangle + +/-! ## 4. Slope of a Drawing in a Closed Disc -/ + +/-- For a closed disc `Δ` and a drawing `C`, `discIns Δ C` is the unique closed disc in `Δ` bounded +by `U(C)` when `Δ` is a closed disc and `U(C) ⊆ Δ` is an `O`-arc, and `∅` otherwise. -/ +noncomputable def discIns (Δ : Set S) (C : Drawing S) : Set S := + open Classical in + if h : IsClosedDisc Δ ∧ C.U ⊆ Δ ∧ IsOArc C.U then + (disc_oArc Δ C.U h.1 h.2.1 h.2.2).choose + else ∅ + +theorem discIns_spec [T2Space S] {Δ : Set S} (hΔ : IsClosedDisc Δ) {C : Drawing S} + (hC : C.IsCircuit) (hCU : C.U ⊆ Δ) : + (discIns Δ C ⊆ Δ ∧ IsClosedDisc (discIns Δ C) ∧ discBd (discIns Δ C) = C.U) ∧ + ∀ Δ' : Set S, Δ' ⊆ Δ → IsClosedDisc Δ' → discBd Δ' = C.U → Δ' = discIns Δ C := by + have hO : IsOArc C.U := isOArc_of_isCircuit hC + have hdisc : discIns Δ C = (disc_oArc Δ C.U hΔ hCU hO).choose := by + simp only [discIns, hΔ, hCU, hO, and_self, dite_true] + rw [hdisc] + obtain ⟨⟨h1, h2, h3, -⟩, huniq⟩ := (disc_oArc Δ C.U hΔ hCU hO).choose_spec + exact ⟨⟨h1, h2, h3⟩, huniq⟩ + +/-- Any drawing `Γ'` with `U(Γ') ⊆ Δ` inside a closed disc `Δ` in a closed surface `S` has +`discIns Δ` as a slope of any order `k ≥ 2`. -/ +theorem isSlope_discIns [T2Space S] (hS : IsClosedSurface S) {Δ : Set S} (hΔ : IsClosedDisc Δ) + {Γ' : Drawing S} (hU : Γ'.U ⊆ Δ) {k : ℕ} (hk : 2 ≤ k) : + IsSlope Γ' k (discIns Δ) := by + have hspec : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing Γ' → + discIns Δ C ⊆ Δ ∧ IsClosedDisc (discIns Δ C) ∧ discBd (discIns Δ C) = C.U ∧ + frontier (discIns Δ C) = C.U ∧ subBd (discIns Δ C) = C.U ∧ + (∀ Δ' : Set S, Δ' ⊆ Δ → IsClosedDisc Δ' → discBd Δ' = C.U → Δ' = discIns Δ C) := by + intro C hC hCs + obtain ⟨⟨h1, h2, h3⟩, huniq⟩ := discIns_spec hΔ hC (hCs.U_subset.trans hU) + have hfr : frontier (discIns Δ C) = C.U := by + rw [IsClosedDisc.frontier_eq_discBd hS h2, h3] + exact ⟨h1, h2, h3, hfr, by rw [subBd_eq_frontier, hfr], huniq⟩ + have hmono : ∀ C₁ C₂ : Drawing S, C₁.IsCircuit → C₁.IsSubdrawing Γ' → C₁.length < k → + C₂.IsCircuit → C₂.IsSubdrawing Γ' → C₂.length < k → C₁.U ⊆ discIns Δ C₂ → + discIns Δ C₁ ⊆ discIns Δ C₂ := by + intro C₁ C₂ h₁ s₁ _ h₂ s₂ _ hsub + obtain ⟨sub₁, d₁, b₁, -, -, uniq₁⟩ := hspec C₁ h₁ s₁ + obtain ⟨sub₂, d₂, b₂, -, -, -⟩ := hspec C₂ h₂ s₂ + obtain ⟨D, ⟨hD₂, dD, bD, -⟩, -⟩ := disc_oArc (discIns Δ C₂) C₁.U d₂ hsub + (isOArc_of_isCircuit h₁) + have huniq : D = discIns Δ C₁ := uniq₁ D (hD₂.trans sub₂) dD bD + exact huniq ▸ hD₂ + refine ⟨hk, fun C hC hCs _ => (hspec C hC hCs).2.1, + fun C hC hCs _ => (hspec C hC hCs).2.2.2.2.1, hmono, ?_⟩ + intro P₀ P₁ P₂ a b hP₀ hP₁ hP₂ s₀ s₁ s₂ p₀ p₁ p₂ v₀₁ v₁₂ v₂₀ e₀₁ e₁₂ e₂₀ l₀ l₁ l₂ + have hab := ne_of_isPathBetween hP₀ p₀ + have supU : ∀ {P Q : Drawing S}, P.IsSubdrawing Γ' → Q.IsSubdrawing Γ' → + (Γ'.sup P Q).U = P.U ∪ Q.U := by + intro P Q hP hQ + rw [Drawing.U_eq, Drawing.sup_V hP hQ, Drawing.sup_E hP hQ, P.U_eq, Q.U_eq, biUnion_union] + ext x + simp only [mem_union] + tauto + have circ : ∀ {P Q : Drawing S}, P.IsPathBetween a b → Q.IsPathBetween a b → + P.IsSubdrawing Γ' → Q.IsSubdrawing Γ' → P.V ∩ Q.V = {a, b} → Disjoint P.E Q.E → + (Γ'.sup P Q).IsCircuit ∧ (Γ'.sup P Q).IsSubdrawing Γ' := fun hP hQ sP sQ v e => + ⟨Drawing.isCircuit_sup hP hQ sP sQ hab v e, Drawing.sup_isSubdrawing Γ' _ _⟩ + obtain ⟨c₀, ss₀⟩ := circ hP₁ hP₂ s₁ s₂ v₁₂ e₁₂ + obtain ⟨c₁, ss₁⟩ := circ hP₂ hP₀ s₂ s₀ v₂₀ e₂₀ + obtain ⟨c₂, ss₂⟩ := circ hP₀ hP₁ s₀ s₁ v₀₁ e₀₁ + obtain ⟨sub₀, d₀, b₀, f₀, -, -⟩ := hspec _ c₀ ss₀ + obtain ⟨sub₁, d₁, b₁, f₁, -, -⟩ := hspec _ c₁ ss₁ + obtain ⟨sub₂, d₂, b₂, f₂, -, uniq₂⟩ := hspec _ c₂ ss₂ + rw [supU s₁ s₂] at f₀ + rw [supU s₂ s₀] at f₁ + rw [supU s₀ s₁] at f₂ + have sb₀ : P₁.U ∪ P₂.U ⊆ discIns Δ (Γ'.sup P₁ P₂) := f₀ ▸ d₀.isCompact.isClosed.frontier_subset + have sb₁ : P₂.U ∪ P₀.U ⊆ discIns Δ (Γ'.sup P₂ P₀) := f₁ ▸ d₁.isCompact.isClosed.frontier_subset + have sb₂ : P₀.U ∪ P₁.U ⊆ discIns Δ (Γ'.sup P₀ P₁) := f₂ ▸ d₂.isCompact.isClosed.frontier_subset + by_cases h₀ : P₀.U ⊆ discIns Δ (Γ'.sup P₁ P₂) + · refine Or.inl ⟨hmono _ _ c₁ ss₁ l₁ c₀ ss₀ l₀ ?_, hmono _ _ c₂ ss₂ l₂ c₀ ss₀ l₀ ?_⟩ + · rw [supU s₂ s₀]; exact union_subset (subset_union_right.trans sb₀) h₀ + · rw [supU s₀ s₁]; exact union_subset h₀ (subset_union_left.trans sb₀) + by_cases h₁ : P₁.U ⊆ discIns Δ (Γ'.sup P₂ P₀) + · refine Or.inr (Or.inl ⟨hmono _ _ c₀ ss₀ l₀ c₁ ss₁ l₁ ?_, hmono _ _ c₂ ss₂ l₂ c₁ ss₁ l₁ ?_⟩) + · rw [supU s₁ s₂]; exact union_subset h₁ (subset_union_left.trans sb₁) + · rw [supU s₀ s₁]; exact union_subset (subset_union_right.trans sb₁) h₁ + by_cases h₂ : P₂.U ⊆ discIns Δ (Γ'.sup P₀ P₁) + · refine Or.inr (Or.inr ⟨hmono _ _ c₀ ss₀ l₀ c₂ ss₂ l₂ ?_, hmono _ _ c₁ ss₁ l₁ c₂ ss₂ l₂ ?_⟩) + · rw [supU s₁ s₂]; exact union_subset (subset_union_right.trans sb₂) h₂ + · rw [supU s₂ s₀]; exact union_subset h₂ (subset_union_left.trans sb₂) + exfalso + obtain ⟨dU, hbd, hne⟩ := + theta_disc_union hS (isLine_of_isPathBetween hP₀ hab) (isLine_of_isPathBetween hP₁ hab) + (isLine_of_isPathBetween hP₂ hab) (by rw [U_inter_of_disjoint s₀ s₁ e₀₁, v₀₁]) + (by rw [U_inter_of_disjoint s₁ s₂ e₁₂, v₁₂]) (by rw [U_inter_of_disjoint s₂ s₀ e₂₀, v₂₀]) + d₀ d₁ d₂ f₀ f₁ f₂ h₀ h₁ h₂ + have hUsub : discIns Δ (Γ'.sup P₁ P₂) ∪ discIns Δ (Γ'.sup P₂ P₀) ⊆ Δ := + union_subset sub₀ sub₁ + have hbd₂ : discBd (discIns Δ (Γ'.sup P₁ P₂) ∪ discIns Δ (Γ'.sup P₂ P₀)) = + (Γ'.sup P₀ P₁).U := hbd.trans b₂ + have heq := uniq₂ _ hUsub dU hbd₂ + exact hne heq + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/DiscTangleSep.lean b/LeanPool/GraphMinor/GM14/DiscTangleSep.lean new file mode 100644 index 0000000000..f569664606 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/DiscTangleSep.lean @@ -0,0 +1,819 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.GM14.Section10Translation1 +import LeanPool.GraphMinor.GM14.Section7a +import LeanPool.GraphMinor.GM11.Section64b +import LeanPool.GraphMinor.GM11.Section91 +import LeanPool.GraphMinor.GM11.CitedResults + +/-! +# Tangle Separations and Distance Bounds for Non-Normal Discs and Closed Curves + +This file proves two general lemmas connecting intersections with `U(H)` (without any +`H`-normality or `O`-arc restriction) to respectful tangles and their metrics on a connected +closed non-spherical surface `S`: + +- `disc_sep_mem_tangle`: for a 2-cell drawing `Γ` with `Γ.E.Nonempty` and a respectful tangle `T` + of order `θ > 15`, any closed disc `Δ ⊆ S` with `(subBd Δ ∩ Γ.U).Finite` and + `(subBd Δ ∩ Γ.U).ncard ≤ 3` induces a separation `(A, B) ∈ T` of `Γ.toHypergraph` with + `A.vertexSet = Γ.V ∩ Δ` and `separationOrder A B ≤ (subBd Δ ∩ Γ.U).ncard`. +- `not_exists_curve_of_dist_ge_twelve`: if `H` has tangle metric `d` of order `θ > 15` with + `H.E.Nonempty` and `u, v ∈ H.V` satisfy `¬ d {u} {v} < 12`, then there is no continuous closed + curve `φ : C(Circle, S)` with `(range φ ∩ H.U).encard ≤ 3`, `u ∈ curveIns φ`, and + `v ∈ curveIns φ`. + +These supply the boundary-intersection and curve-enclosure steps for Graph Minors XIV, +`(1.1)(iii)(iii)` and `(1.1)(ii)` (pages 24–25). +-/ + +namespace GraphMinor.GM14 + +open Set Function Topology Graph Hypergraph +open GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM10 +open GraphMinor.GM11 GraphMinor.GM14.Whitney + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-! ## 1. Edge Ends, Boundary Counts, and Small Edge-Set Separations -/ + +omit [T2Space S] in +private theorem closure_inter_V_nonempty_and_ncard_le_two {Γ : Drawing S} {e : Set S} + (he : e ∈ Γ.E) : + (closure e ∩ Γ.V).Nonempty ∧ (closure e ∩ Γ.V).ncard ≤ 2 := by + rcases Γ.edge_cond e he with ⟨u, v, huv, hcap, -⟩ | ⟨u, hcap, -⟩ + · rw [hcap] + exact ⟨⟨u, Or.inl rfl⟩, by rw [ncard_pair huv]⟩ + · rw [hcap] + exact ⟨⟨u, rfl⟩, by rw [ncard_singleton]; omega⟩ + +omit [T2Space S] in +private theorem closure_inter_V_inter_ncard_le_one {Γ : Drawing S} {e Δ : Set S} + (he : e ∈ Γ.E) (hnot : ¬ (closure e ∩ Γ.V ⊆ Δ)) : + ((closure e ∩ Γ.V) ∩ Δ).ncard ≤ 1 := by + rcases Γ.edge_cond e he with ⟨u, v, _, hcap, -⟩ | ⟨u, hcap, -⟩ + · rw [hcap] at hnot ⊢ + by_cases hu : u ∈ Δ + · have hv : v ∉ Δ := fun hv => hnot (by rintro z (rfl | rfl) <;> assumption) + have hsub : ({u, v} : Set S) ∩ Δ ⊆ {u} := by + rintro z ⟨rfl | rfl, hzΔ⟩ + · rfl + · exact absurd hzΔ hv + exact (ncard_le_ncard hsub (finite_singleton u)).trans (by rw [ncard_singleton]) + · have hsub : ({u, v} : Set S) ∩ Δ ⊆ {v} := by + rintro z ⟨rfl | rfl, hzΔ⟩ + · exact absurd hzΔ hu + · rfl + exact (ncard_le_ncard hsub (finite_singleton v)).trans (by rw [ncard_singleton]) + · rw [hcap] at hnot ⊢ + have hu : u ∉ Δ := fun hu => hnot (singleton_subset_iff.mpr hu) + have hemp : ({u} : Set S) ∩ Δ = ∅ := by + ext z + simp only [mem_inter_iff, mem_singleton_iff, mem_empty_iff_false, iff_false, not_and] + rintro rfl + exact hu + rw [hemp, ncard_empty] + omega + +omit [T2Space S] in +private theorem ends_subset_closure_inter_V {Γ : Drawing S} {e : Set S} : + Γ.toHypergraph.ends e ⊆ closure e ∩ Γ.V := by + intro v hv + have h := (PaintingOrDrawing.toHypergraph_inc (Γ := PaintingOrDrawing.drawing Γ)).mp hv + exact ⟨h.2.2, h.2.1⟩ + +omit [T2Space S] in +private theorem ends_ncard_le_two {Γ : Drawing S} {e : Set S} (he : e ∈ Γ.E) : + (Γ.toHypergraph.ends e).ncard ≤ 2 := + (ncard_le_ncard ends_subset_closure_inter_V (Γ.finite_V.subset inter_subset_right)).trans + (closure_inter_V_nonempty_and_ncard_le_two he).2 + +omit [T2Space S] in +/-- For a subset `X ⊆ S` such that `(X ∩ Γ.U).Finite`, the number of vertices of `Γ` in `X` plus +the number of edges of `Γ` meeting `X` is at most `(X ∩ Γ.U).ncard`. -/ +private theorem bd_verts_add_edges_ncard_le {Γ : Drawing S} {X : Set S} + (hfin : (X ∩ Γ.U).Finite) : + (X ∩ Γ.V).ncard + {e ∈ Γ.E | (e ∩ X).Nonempty}.ncard ≤ (X ∩ Γ.U).ncard := by + classical + set V_bd := X ∩ Γ.V + set E_bd := {e ∈ Γ.E | (e ∩ X).Nonempty} + have hE_fin : E_bd.Finite := Γ.finite_edges.subset fun _ h => h.1 + by_cases hE_ne : E_bd.Nonempty + · obtain ⟨e₀, he₀⟩ := hE_ne + obtain ⟨p₀, hp₀e, _⟩ := he₀.2 + let f : Set S → S := fun e => if h : (e ∩ X).Nonempty then h.choose else p₀ + have hf_spec : ∀ {e}, e ∈ E_bd → f e ∈ e ∧ f e ∈ X := by + intro e he + simp only [f, he.2, dite_true] + exact he.2.choose_spec + have hinj : InjOn f E_bd := by + intro e₁ he₁ e₂ he₂ heq + exact Γ.edge_eq_of_mem he₁.1 he₂.1 (hf_spec he₁).1 (heq ▸ (hf_spec he₂).1) + have himg_sub : f '' E_bd ⊆ (X ∩ Γ.U) \ V_bd := by + rintro z ⟨e, he, rfl⟩ + obtain ⟨hfe, hfX⟩ := hf_spec he + exact ⟨⟨hfX, (he.1.2.1 hfe).1⟩, fun hzV => (he.1.2.1 hfe).2 hzV.2⟩ + have hV_sub : V_bd ⊆ X ∩ Γ.U := inter_subset_inter_right X Γ.V_subset_U + have hdisj : Disjoint V_bd (f '' E_bd) := + disjoint_left.mpr fun z hzV hzI => (himg_sub hzI).2 hzV + have hunion_sub : V_bd ∪ f '' E_bd ⊆ X ∩ Γ.U := union_subset hV_sub + (himg_sub.trans sdiff_subset) + have hV_fin : V_bd.Finite := hfin.subset hV_sub + have hI_fin : (f '' E_bd).Finite := hE_fin.image f + have hle := ncard_le_ncard hunion_sub hfin + rw [ncard_union_eq hdisj hV_fin hI_fin, hinj.ncard_image] at hle + exact hle + · rw [not_nonempty_iff_eq_empty.mp hE_ne, ncard_empty, add_zero] + exact ncard_le_ncard (inter_subset_inter_right X Γ.V_subset_U) hfin + +omit [T2Space S] in +/-- In a tangle `T` of `Γ.toHypergraph` where every vertex of `Γ` is incident with an edge of `Γ`, +no separation `(L, M) ∈ T` can satisfy `separationOrder L M + 2 * M.edgeSet.ncard < θ`. -/ +private theorem not_mem_tangle_of_edgeSet_ncard_small {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph θ T) + (hno_iso : ∀ v ∈ Γ.V, ∃ e ∈ Γ.E, v ∈ closure e) : + ∀ (n : ℕ) {L M : Hypergraph S (Set S)}, + M.edgeSet.ncard = n → (L, M) ∈ T → + separationOrder L M + 2 * n < θ → False := by + intro n + induction n with + | zero => + intro L M hMn hLM _ + have hsep := hT.isSeparation hLM + have hME : M.edgeSet = ∅ := (ncard_eq_zero M.edgeSet_finite).mp hMn + have hLE : L.edgeSet = Γ.E := by + have hU := hsep.edgeSet_union + rw [hME, union_empty] at hU + exact hU + have hLV : L.vertexSet = Γ.V := by + apply subset_antisymm hsep.left_le.vertexSet_subset + intro v hv + obtain ⟨e, he, hve⟩ := hno_iso v hv + have heL : e ∈ L.edgeSet := hLE.symm ▸ he + have hincG : Γ.toHypergraph.Inc e v := + (PaintingOrDrawing.toHypergraph_inc (Γ := PaintingOrDrawing.drawing Γ)).mpr ⟨he, hv, hve⟩ + exact L.vertex_mem_of_inc ((inc_iff_of_le hsep.left_le heL).mpr hincG) + exact hT.axiom3 hLM hLV + | succ n ih => + intro L M hMn hLM hbound + have hsep := hT.isSeparation hLM + have hM_ne : M.edgeSet.Nonempty := (ncard_pos M.edgeSet_finite).mp (by omega) + obtain ⟨e, heM⟩ := hM_ne + have heE : e ∈ Γ.E := hsep.right_le.edgeSet_subset heM + have hends_le : (Γ.toHypergraph.ends e).ncard ≤ 2 := ends_ncard_le_two heE + have he_size : edgeSize Γ.toHypergraph e < θ := by + unfold edgeSize + omega + have hKe : (edgeHypergraph Γ.toHypergraph e, Γ.toHypergraph.deleteEdges {e}) ∈ T := + (GM10.theorem_2_7_proof (by omega) hT.isSeparation hT.order_lt hT.axiom1 hT.axiom2).mp + hT e heE he_size + let Ke := edgeHypergraph Γ.toHypergraph e + let De := Γ.toHypergraph.deleteEdges {e} + have hinter_sub : ((L ∪ Ke) ∩ (M ∩ De)).vertexSet ⊆ + (L ∩ M).vertexSet ∪ Γ.toHypergraph.ends e := by + intro z ⟨hzLK, hzM, _⟩ + rcases hzLK with hzL | hzKe + · exact Or.inl ⟨hzL, hzM⟩ + · exact Or.inr hzKe + have hfin_u : ((L ∩ M).vertexSet ∪ Γ.toHypergraph.ends e).Finite := + (L ∩ M).vertexSet_finite.union (Γ.finite_V.subset fun _ h => ends_subset_closure_inter_V h + |>.2) + have hord_le : separationOrder (L ∪ Ke) (M ∩ De) ≤ separationOrder L M + 2 := by + calc ((L ∪ Ke) ∩ (M ∩ De)).vertexSet.ncard + _ ≤ ((L ∩ M).vertexSet ∪ Γ.toHypergraph.ends e).ncard := + ncard_le_ncard hinter_sub hfin_u + _ ≤ (L ∩ M).vertexSet.ncard + (Γ.toHypergraph.ends e).ncard := ncard_union_le _ _ + _ ≤ separationOrder L M + 2 := Nat.add_le_add_left hends_le _ + have hord_lt : separationOrder (L ∪ Ke) (M ∩ De) < θ := by omega + have hunion : (L ∪ Ke, M ∩ De) ∈ T := GM10.theorem_2_2_proof hT hLM hKe hord_lt + have hMDe_eq : (M ∩ De).edgeSet = M.edgeSet \ {e} := by + change M.edgeSet ∩ (Γ.E \ {e}) = M.edgeSet \ {e} + ext g + simp only [mem_inter_iff, mem_sdiff, mem_singleton_iff] + exact ⟨fun ⟨hgM, _, hne⟩ => ⟨hgM, hne⟩, + fun ⟨hgM, hne⟩ => ⟨hgM, hsep.right_le.edgeSet_subset hgM, hne⟩⟩ + have hMDe_card : (M ∩ De).edgeSet.ncard = n := by + rw [hMDe_eq, ncard_sdiff_singleton_of_mem heM, hMn] + rfl + exact ih hMDe_card hunion (by omega) + +omit [TopologicalSpace S] [T2Space S] in +private theorem ncard_biUnion_finset_le {ι : Type*} (F : Finset ι) + (s : ι → Set S) : + (⋃ i ∈ F, s i).ncard ≤ ∑ i ∈ F, (s i).ncard := by + classical + induction F using Finset.induction_on with + | empty => simp + | @insert a F ha ih => + simp only [Finset.mem_insert, iUnion_iUnion_eq_or_left, Finset.sum_insert ha] + exact (ncard_union_le (s a) (⋃ i ∈ F, s i)).trans (Nat.add_le_add_left ih _) + +/-! ## 2. Disc Separation Construction and Membership in `T` -/ + +private def discSepA (Γ : Drawing S) (Δ : Set S) (E₁ : Set (Set S)) + (hE₁ : E₁ ⊆ Γ.E) (hends : ∀ e ∈ E₁, closure e ∩ Γ.V ⊆ Δ) : Hypergraph S (Set S) where + vertexSet := Γ.V ∩ Δ + edgeSet := E₁ + Inc e v := Γ.toHypergraph.Inc e v ∧ e ∈ E₁ + vertex_mem_of_inc e v h := by + have hi := (PaintingOrDrawing.toHypergraph_inc (Γ := PaintingOrDrawing.drawing Γ)).mp h.1 + exact ⟨hi.2.1, hends e h.2 ⟨hi.2.2, hi.2.1⟩⟩ + edge_mem_of_inc _ _ h := h.2 + vertexSet_finite := Γ.finite_V.subset inter_subset_left + edgeSet_finite := Γ.finite_edges.subset hE₁ + +private def discSepB (Γ : Drawing S) (Δ : Set S) (E₁ : Set (Set S)) : Hypergraph S (Set S) where + vertexSet := (Γ.V \ Δ) ∪ (subBd Δ ∩ Γ.V) ∪ Whitney.verts Γ.toGraph (Γ.E \ E₁) + edgeSet := Γ.E \ E₁ + Inc e v := Γ.toHypergraph.Inc e v ∧ e ∈ Γ.E \ E₁ + vertex_mem_of_inc e v h := by + have hi := (PaintingOrDrawing.toHypergraph_inc (Γ := PaintingOrDrawing.drawing Γ)).mp h.1 + exact Or.inr ⟨e, h.2, inc_of_mem_closure hi.1 hi.2.2 hi.2.1⟩ + edge_mem_of_inc _ _ h := h.2 + vertexSet_finite := by + refine ((Γ.finite_V.subset sdiff_subset).union (Γ.finite_V.subset inter_subset_right)).union ?_ + exact Γ.finite_V.subset fun _ ⟨_, _, _, hl⟩ => hl.left_mem + edgeSet_finite := Γ.finite_edges.subset sdiff_subset + +omit [T2Space S] in +private theorem isSeparation_discSep {Γ : Drawing S} {Δ : Set S} {E₁ : Set (Set S)} + (hE₁ : E₁ ⊆ Γ.E) (hends : ∀ e ∈ E₁, closure e ∩ Γ.V ⊆ Δ) : + Γ.toHypergraph.IsSeparation (discSepA Γ Δ E₁ hE₁ hends) (discSepB Γ Δ E₁) := by + have hleA : discSepA Γ Δ E₁ hE₁ hends ≤ Γ.toHypergraph := by + refine ⟨inter_subset_left, hE₁, fun e he => ?_⟩ + ext v + exact ⟨fun h => ⟨h, he⟩, fun h => h.1⟩ + have hleB : discSepB Γ Δ E₁ ≤ Γ.toHypergraph := by + refine ⟨?_, sdiff_subset, fun e he => ?_⟩ + · refine union_subset (union_subset sdiff_subset inter_subset_right) ?_ + exact fun _ ⟨_, _, _, hl⟩ => hl.left_mem + · ext v + exact ⟨fun h => ⟨h, he⟩, fun h => h.1⟩ + rw [isSeparation_iff_of_le hleA hleB] + refine ⟨?_, ?_, ?_⟩ + · ext v + constructor + · intro hv + rcases hv with hvA | hvB + · exact hleA.vertexSet_subset hvA + · exact hleB.vertexSet_subset hvB + · intro hv + by_cases hvΔ : v ∈ Δ + · exact Or.inl ⟨hv, hvΔ⟩ + · exact Or.inr (Or.inl (Or.inl ⟨hv, hvΔ⟩)) + · change E₁ ∪ (Γ.E \ E₁) = Γ.E + ext e + exact ⟨fun h => h.elim (fun h1 => hE₁ h1) And.left, + fun h => (Classical.em (e ∈ E₁)).imp_right fun hn => ⟨h, hn⟩⟩ + · exact Disjoint.inter_eq disjoint_sdiff_self_right + +omit [T2Space S] in +private theorem inter_vertexSet_discSep_subset {Γ : Drawing S} {Δ : Set S} + (hΔ_cl : IsClosed Δ) {E₁ : Set (Set S)} + (hE₁ : E₁ ⊆ Γ.E) (hends : ∀ e ∈ E₁, closure e ∩ Γ.V ⊆ Δ) + (hin_sub : {e ∈ Γ.E | e ⊆ Δ} ⊆ E₁) : + (discSepA Γ Δ E₁ hE₁ hends ∩ discSepB Γ Δ E₁).vertexSet ⊆ + (subBd Δ ∩ Γ.V) ∪ ⋃ e ∈ {e ∈ Γ.E | (e ∩ subBd Δ).Nonempty} \ E₁, ((closure e ∩ Γ.V) ∩ Δ) := by + rintro v ⟨⟨hvV, hvΔ⟩, hvB⟩ + rcases hvB with (⟨_, hvnΔ⟩ | hv_bd) | ⟨e, ⟨heE, he_not⟩, hinc⟩ + · exact absurd hvΔ hvnΔ + · exact Or.inl hv_bd + · have hve : v ∈ closure e := mem_closure_of_inc hinc + by_cases he_bd : (e ∩ subBd Δ).Nonempty + · exact Or.inr (mem_iUnion₂.mpr ⟨e, ⟨⟨heE, he_bd⟩, he_not⟩, ⟨hve, hvV⟩, hvΔ⟩) + · have hdis_bd : Disjoint e (frontier Δ) := by + rw [← subBd_eq_frontier] + exact not_nonempty_iff_eq_empty.mp he_bd |> disjoint_iff_inter_eq_empty.mpr + have hdis_Δ : Disjoint e Δ := by + refine disjoint_left.mpr fun x hxe hxΔ => he_not (hin_sub ⟨heE, ?_⟩) + exact subset_of_disjoint_frontier heE.2.2.1.isConnected.isPreconnected + hΔ_cl hdis_bd hxe hxΔ + have hv_not_int : v ∉ interior Δ := by + intro hv_int + obtain ⟨y, hy_int, hye⟩ := mem_closure_iff.mp hve (interior Δ) isOpen_interior hv_int + exact disjoint_left.mp hdis_Δ hye (interior_subset hy_int) + have hv_fr : v ∈ subBd Δ := by + rw [subBd_eq_frontier, frontier, hΔ_cl.closure_eq] + exact ⟨hvΔ, hv_not_int⟩ + exact Or.inl ⟨hv_fr, hvV⟩ + +public section + +/-- For any 2-cell drawing `Γ` with `Γ.E.Nonempty` on a connected closed non-spherical surface `S`, +respectful tangle `T` of order `θ > 15`, and closed disc `Δ ⊆ S` with `(subBd Δ ∩ Γ.U).Finite` and +`(subBd Δ ∩ Γ.U).ncard ≤ 3`, there is a separation `(A, B) ∈ T` of `Γ.toHypergraph` with +`A.vertexSet = Γ.V ∩ Δ`, `separationOrder A B ≤ (subBd Δ ∩ Γ.U).ncard`, and every separator vertex +either in `subBd Δ ∩ Γ.V` or an end of an edge of `Γ` meeting `subBd Δ`. -/ +theorem disc_sep_mem_tangle [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + {Γ : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hθ : 15 < θ) (hE : Γ.E.Nonempty) (hResp : IsRespectfulDrawingTangle Γ θ T) + {Δ : Set S} (hΔ : IsClosedDisc Δ) + (hfin : (subBd Δ ∩ Γ.U).Finite) (hcard : (subBd Δ ∩ Γ.U).ncard ≤ 3) : + ∃ A B : Hypergraph S (Set S), + (A, B) ∈ T ∧ + A.vertexSet = Γ.V ∩ Δ ∧ + separationOrder A B ≤ (subBd Δ ∩ Γ.U).ncard ∧ + (∀ w ∈ (A ∩ B).vertexSet, + w ∈ subBd Δ ∩ Γ.V ∨ ∃ e ∈ Γ.E, (e ∩ subBd Δ).Nonempty ∧ w ∈ closure e ∩ Γ.V) := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have h2cell : (PaintingOrDrawing.drawing Γ).IsTwoCell := hResp.1 + have hT : IsTangle Γ.toHypergraph θ T := hResp.2.1 + have hresp : (PaintingOrDrawing.drawing Γ).IsRespectful θ T := hResp.2.2 + obtain ⟨K, hK⟩ := GM11.exists_radialDrawing (Γ := PaintingOrDrawing.drawing Γ) hS h2cell + obtain ⟨ins, hd⟩ := GM11.exists_derivedSlope hS hresp hK.2.1 + have hrf : RegionFacts (PaintingOrDrawing.drawing Γ) K := + GM11.regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hE + have hno_iso : ∀ v ∈ Γ.V, ∃ e ∈ Γ.E, v ∈ closure e := fun v hv => by + obtain ⟨e, he, hve⟩ := GM11.exists_edge_of_regionFacts hS hrf hv + exact ⟨e, he, hve⟩ + set V_bd := subBd Δ ∩ Γ.V + set E_bd := {e ∈ Γ.E | (e ∩ subBd Δ).Nonempty} + have hE_bd_fin : E_bd.Finite := Γ.finite_edges.subset fun _ h => h.1 + have hV_bd_fin : V_bd.Finite := Γ.finite_V.subset inter_subset_right + have hsum_le : V_bd.ncard + E_bd.ncard ≤ (subBd Δ ∩ Γ.U).ncard := + bd_verts_add_edges_ncard_le hfin + -- Step 1: Purely interior edge set `E₀ = {e ∈ Γ.E | e ⊆ Δ}` gives `(A₀, B₀) ∈ T` of order `≤ 6`. + let E₀ : Set (Set S) := {e ∈ Γ.E | e ⊆ Δ} + have hE₀_sub : E₀ ⊆ Γ.E := fun _ h => h.1 + have hE₀_ends : ∀ e ∈ E₀, closure e ∩ Γ.V ⊆ Δ := fun e he x hx => + hΔ.isClosed.closure_subset_iff.mpr he.2 hx.1 + let A₀ := discSepA Γ Δ E₀ hE₀_sub hE₀_ends + let B₀ := discSepB Γ Δ E₀ + have hsep₀ : Γ.toHypergraph.IsSeparation A₀ B₀ := isSeparation_discSep hE₀_sub hE₀_ends + have hord₀_le : separationOrder A₀ B₀ ≤ 6 := by + have hsub₀ := inter_vertexSet_discSep_subset hΔ.isClosed hE₀_sub hE₀_ends Subset.rfl + have hfin_bi : (⋃ e ∈ E_bd \ E₀, ((closure e ∩ Γ.V) ∩ Δ)).Finite := + (hE_bd_fin.subset sdiff_subset).biUnion fun _ _ => + Γ.finite_V.subset (inter_subset_right.trans' inter_subset_left) + have hbi_le : (⋃ e ∈ E_bd \ E₀, ((closure e ∩ Γ.V) ∩ Δ)).ncard ≤ 2 * (E_bd \ E₀).ncard := by + classical + obtain ⟨F, hF⟩ := (hE_bd_fin.subset sdiff_subset).exists_finset_coe + rw [← hF] + have hbi_eq : (⋃ e ∈ (F : Set (Set S)), ((closure e ∩ Γ.V) ∩ Δ)) = + ⋃ e ∈ F, ((closure e ∩ Γ.V) ∩ Δ) := by simp + rw [hbi_eq, ncard_coe_finset] + refine (ncard_biUnion_finset_le F fun e => (closure e ∩ Γ.V) ∩ Δ).trans ?_ + calc ∑ e ∈ F, ((closure e ∩ Γ.V) ∩ Δ).ncard + _ ≤ ∑ _e ∈ F, 2 := Finset.sum_le_sum fun e heF => by + have heE : e ∈ Γ.E := ((hF ▸ heF : e ∈ E_bd \ E₀)).1.1 + exact (ncard_le_ncard inter_subset_left + (Γ.finite_V.subset inter_subset_right)).trans + (closure_inter_V_nonempty_and_ncard_le_two heE).2 + _ = 2 * F.card := by rw [Finset.sum_const, smul_eq_mul, mul_comm] + have hle_ediff : (E_bd \ E₀).ncard ≤ E_bd.ncard := ncard_le_ncard sdiff_subset hE_bd_fin + calc (A₀ ∩ B₀).vertexSet.ncard + _ ≤ (V_bd ∪ ⋃ e ∈ E_bd \ E₀, ((closure e ∩ Γ.V) ∩ Δ)).ncard := + ncard_le_ncard hsub₀ (hV_bd_fin.union hfin_bi) + _ ≤ V_bd.ncard + (⋃ e ∈ E_bd \ E₀, ((closure e ∩ Γ.V) ∩ Δ)).ncard := ncard_union_le _ _ + _ ≤ V_bd.ncard + 2 * (E_bd \ E₀).ncard := Nat.add_le_add_left hbi_le _ + _ ≤ V_bd.ncard + 2 * E_bd.ncard := Nat.add_le_add_left (Nat.mul_le_mul_left 2 hle_ediff) _ + _ ≤ 6 := by omega + have hA₀_null : ∀ F : Set S, F ⊆ PaintingOrDrawing.underlying A₀ → IsOArc F → + IsNullHomotopicOArc F := by + intro F hFA hF + have hsub : ∀ e ∈ A₀.edgeSet, e ⊆ Δ := fun _ he => he.2 + have hFΔ : F ⊆ Δ := + GM11.oArc_subset_of_edges hF hΔ.isClosed A₀.vertexSet_finite hsub hFA + exact isNullHomotopicOArcIn_of_subset_disc hF (subset_univ _) hΔ hFΔ + obtain ⟨F₀, hF₀, hF₀_sub, hF₀_not_null⟩ := + GM11.exists_oArc_of_null hS hns hE hK (by omega) hd hsep₀ (by omega) hA₀_null + have hnot_B₀ : (B₀, A₀) ∉ T := by + intro hB₀A₀ + exact hF₀_not_null (GM11.no_oArc_of_mem (Γ := PaintingOrDrawing.drawing Γ) hS hns hE h2cell + hT.isPretangle hresp hK hd hsep₀.symm (by rw [separationOrder_comm]; omega) hB₀A₀ hF₀ + (hF₀_sub.trans sdiff_subset)) + have hA₀B₀ : (A₀, B₀) ∈ T := (hT.axiom1 hsep₀ (by omega)).resolve_right hnot_B₀ + -- Step 2: Refined edge set `E₁` adds boundary edges whose ends both lie in `Δ`, giving order `≤ + -- 3`. + let E₁ : Set (Set S) := {e ∈ Γ.E | e ⊆ Δ ∨ (e ∈ E_bd ∧ closure e ∩ Γ.V ⊆ Δ)} + have hE₁_sub : E₁ ⊆ Γ.E := fun _ h => h.1 + have hE₁_ends : ∀ e ∈ E₁, closure e ∩ Γ.V ⊆ Δ := by + rintro e ⟨_, heΔ | ⟨_, hends⟩⟩ + · exact fun x hx => hΔ.isClosed.closure_subset_iff.mpr heΔ hx.1 + · exact hends + have hE₀_E₁ : E₀ ⊆ E₁ := fun _ ⟨he, heΔ⟩ => ⟨he, Or.inl heΔ⟩ + let A₁ := discSepA Γ Δ E₁ hE₁_sub hE₁_ends + let B₁ := discSepB Γ Δ E₁ + have hsep₁ : Γ.toHypergraph.IsSeparation A₁ B₁ := isSeparation_discSep hE₁_sub hE₁_ends + have hsub₁ := inter_vertexSet_discSep_subset hΔ.isClosed hE₁_sub hE₁_ends hE₀_E₁ + have hord₁_le : separationOrder A₁ B₁ ≤ (subBd Δ ∩ Γ.U).ncard := by + have hfin_bi : (⋃ e ∈ E_bd \ E₁, ((closure e ∩ Γ.V) ∩ Δ)).Finite := + (hE_bd_fin.subset sdiff_subset).biUnion fun _ _ => + Γ.finite_V.subset (inter_subset_right.trans' inter_subset_left) + have hbi_le : (⋃ e ∈ E_bd \ E₁, ((closure e ∩ Γ.V) ∩ Δ)).ncard ≤ (E_bd \ E₁).ncard := by + classical + obtain ⟨F, hF⟩ := (hE_bd_fin.subset sdiff_subset).exists_finset_coe + rw [← hF] + have hbi_eq : (⋃ e ∈ (F : Set (Set S)), ((closure e ∩ Γ.V) ∩ Δ)) = + ⋃ e ∈ F, ((closure e ∩ Γ.V) ∩ Δ) := by simp + rw [hbi_eq, ncard_coe_finset] + refine (ncard_biUnion_finset_le F fun e => (closure e ∩ Γ.V) ∩ Δ).trans ?_ + calc ∑ e ∈ F, ((closure e ∩ Γ.V) ∩ Δ).ncard + _ ≤ ∑ _e ∈ F, 1 := Finset.sum_le_sum fun e heF => by + obtain ⟨he_bd, he_not⟩ := (hF ▸ heF : e ∈ E_bd \ E₁) + exact closure_inter_V_inter_ncard_le_one he_bd.1 + fun hends => he_not ⟨he_bd.1, Or.inr ⟨he_bd, hends⟩⟩ + _ = F.card := by rw [Finset.sum_const, smul_eq_mul, mul_one] + have hle_ediff : (E_bd \ E₁).ncard ≤ E_bd.ncard := ncard_le_ncard sdiff_subset hE_bd_fin + calc (A₁ ∩ B₁).vertexSet.ncard + _ ≤ (V_bd ∪ ⋃ e ∈ E_bd \ E₁, ((closure e ∩ Γ.V) ∩ Δ)).ncard := + ncard_le_ncard hsub₁ (hV_bd_fin.union hfin_bi) + _ ≤ V_bd.ncard + (⋃ e ∈ E_bd \ E₁, ((closure e ∩ Γ.V) ∩ Δ)).ncard := ncard_union_le _ _ + _ ≤ V_bd.ncard + (E_bd \ E₁).ncard := Nat.add_le_add_left hbi_le _ + _ ≤ V_bd.ncard + E_bd.ncard := Nat.add_le_add_left hle_ediff _ + _ ≤ (subBd Δ ∩ Γ.U).ncard := hsum_le + -- Step 3: Show `(B₁, A₁) ∉ T`, hence `(A₁, B₁) ∈ T`. + have hnot_B₁ : (B₁, A₁) ∉ T := by + intro hB₁A₁ + have hinter_u : ((A₀ ∪ B₁) ∩ (B₀ ∩ A₁)).vertexSet ⊆ + (A₀ ∩ B₀).vertexSet ∪ (B₁ ∩ A₁).vertexSet := by + intro z ⟨hz_l, hzB₀, hzA₁⟩ + rcases hz_l with hzA₀ | hzB₁ + · exact Or.inl ⟨hzA₀, hzB₀⟩ + · exact Or.inr ⟨hzB₁, hzA₁⟩ + have hord_u_le : separationOrder (A₀ ∪ B₁) (B₀ ∩ A₁) ≤ 9 := by + have hfin_u := (A₀ ∩ B₀).vertexSet_finite.union (B₁ ∩ A₁).vertexSet_finite + have hord_B₁A₁ : (B₁ ∩ A₁).vertexSet.ncard ≤ 3 := by + have : separationOrder B₁ A₁ ≤ 3 := by + rw [separationOrder_comm] + exact hord₁_le.trans hcard + exact this + calc ((A₀ ∪ B₁) ∩ (B₀ ∩ A₁)).vertexSet.ncard + _ ≤ ((A₀ ∩ B₀).vertexSet ∪ (B₁ ∩ A₁).vertexSet).ncard := ncard_le_ncard hinter_u hfin_u + _ ≤ (A₀ ∩ B₀).vertexSet.ncard + (B₁ ∩ A₁).vertexSet.ncard := ncard_union_le _ _ + _ ≤ 6 + 3 := Nat.add_le_add hord₀_le hord_B₁A₁ + _ = 9 := rfl + have hunion : (A₀ ∪ B₁, B₀ ∩ A₁) ∈ T := + GM10.theorem_2_2_proof hT hA₀B₀ hB₁A₁ (by omega) + have hR_sub : (B₀ ∩ A₁).edgeSet ⊆ E_bd := by + rintro e ⟨⟨_, he_not₀⟩, ⟨heE, he₁⟩⟩ + rcases he₁ with heΔ | ⟨he_bd, _⟩ + · exact absurd ⟨heE, heΔ⟩ he_not₀ + · exact he_bd + have hR_card : (B₀ ∩ A₁).edgeSet.ncard ≤ 3 := + (ncard_le_ncard hR_sub hE_bd_fin).trans (by omega) + exact not_mem_tangle_of_edgeSet_ncard_small hT hno_iso (B₀ ∩ A₁).edgeSet.ncard rfl hunion + (by omega) + have hA₁B₁ : (A₁, B₁) ∈ T := (hT.axiom1 hsep₁ (by omega)).resolve_right hnot_B₁ + refine ⟨A₁, B₁, hA₁B₁, rfl, hord₁_le, fun w hw => ?_⟩ + rcases hsub₁ hw with hw_bd | hw_bi + · exact Or.inl hw_bd + · obtain ⟨e, ⟨⟨heE, he_bd⟩, _⟩, hwe, _⟩ := mem_iUnion₂.mp hw_bi + exact Or.inr ⟨e, heE, he_bd, hwe⟩ + +/-! ## 3. Curve Hit-Count vs. Tangle Metric Bound (`d {u} {v} < 12`) -/ + +/-- `AssocVertex H p w` relates a point `p ∈ H.U` to an associated vertex `w ∈ H.V`: either +`p = w ∈ H.V`, or `p` lies in an edge `e ∈ H.E` and `w` is an end of `e`. -/ +private def AssocVertex (H : Drawing S) (p w : S) : Prop := + (p ∈ H.V ∧ w = p) ∨ ∃ e ∈ H.E, p ∈ e ∧ w ∈ closure e ∩ H.V + +omit [T2Space S] in +private theorem AssocVertex.mem_V {H : Drawing S} {p w : S} (h : AssocVertex H p w) : + w ∈ H.V := by + rcases h with ⟨hp, rfl⟩ | ⟨_, _, _, hw⟩ + · exact hp + · exact hw.2 + +omit [T2Space S] in +private theorem exists_assocVertex {H : Drawing S} {p : S} (hp : p ∈ H.U) : + ∃ w ∈ H.V, AssocVertex H p w := by + by_cases hpV : p ∈ H.V + · exact ⟨p, hpV, Or.inl ⟨hpV, rfl⟩⟩ + · obtain ⟨e, he, hpe⟩ := H.exists_edge_of_mem hp hpV + obtain ⟨⟨w, hw⟩, -⟩ := closure_inter_V_nonempty_and_ncard_le_two he + exact ⟨w, hw.2, Or.inr ⟨e, he, hpe, hw⟩⟩ + +omit [T2Space S] in +private theorem mem_closure_region_of_assocVertex (hS : IsClosedSurface S) + {H : Drawing S} {p w : S} {r : Set S} + (ha : AssocVertex H p w) (hr : r ∈ H.R) (hpr : p ∈ closure r) : + w ∈ closure r := by + rcases ha with ⟨_, rfl⟩ | ⟨e, he, hpe, hwe, _⟩ + · exact hpr + · have her : e ⊆ closure r := GM11.edge_subset_closure_of_incident hS he hr ⟨p, hpe, hpr⟩ + exact isClosed_closure.closure_subset_iff.mpr her hwe + +omit [T2Space S] in +private theorem finite_R_of_radial {H K : Drawing S} (hE : H.E.Nonempty) + (hrad : (PaintingOrDrawing.drawing H).IsRadialDrawing K) : + H.R.Finite := by + classical + obtain ⟨e₀, he₀⟩ := hE + obtain ⟨v₀, _⟩ := he₀.1 + let hub : Set S → S := fun r => + if hr : r ∈ H.R then (hrad.2.1.2.2.1 r hr).exists.choose else v₀ + have hhub_spec : ∀ {r}, r ∈ H.R → hub r ∈ r ∧ hub r ∈ K.V := by + intro r hr + simp only [hub, hr, dite_true] + exact (hrad.2.1.2.2.1 r hr).exists.choose_spec + refine Finite.of_finite_image (f := hub) (K.finite_V.subset ?_) ?_ + · rintro _ ⟨r, hr, rfl⟩ + exact (hhub_spec hr).2 + · intro r₁ hr₁ r₂ hr₂ heq + exact region_eq_of_mem hr₁ hr₂ (hhub_spec hr₁).1 (heq ▸ (hhub_spec hr₂).1) + +/-- For any nonempty proper subset `X₁` of `X = range φ ∩ H.U`, some region `r ∈ H.R` meets both +`X₁` and `X \ X₁` in its closure. -/ +private theorem exists_shared_region_of_partition (hS : IsClosedSurface S) {H K : Drawing S} + (hE : H.E.Nonempty) (hrad : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + {φ : C(Circle, S)} (hfin : (range φ ∩ H.U).Finite) + {X₁ : Set S} (hX₁_sub : X₁ ⊆ range φ ∩ H.U) + (hX₁_ne : X₁.Nonempty) (hX₂_ne : ((range φ ∩ H.U) \ X₁).Nonempty) : + ∃ q₁ ∈ X₁, ∃ q₂ ∈ (range φ ∩ H.U) \ X₁, ∃ r ∈ H.R, + q₁ ∈ closure r ∧ q₂ ∈ closure r := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + set X := range φ ∩ H.U + set X₂ := X \ X₁ + have hR_fin : H.R.Finite := finite_R_of_radial hE hrad + by_contra hno + push Not at hno + let R₁ := {r ∈ H.R | Disjoint (closure r) X₂} + let R₂ := {r ∈ H.R | ¬ Disjoint (closure r) X₂} + have hR₂_disj : ∀ r ∈ R₂, Disjoint (closure r) X₁ := by + intro r ⟨hr, hnot₂⟩ + rw [Set.not_disjoint_iff] at hnot₂ + obtain ⟨q₂, hq₂_cl, hq₂_X₂⟩ := hnot₂ + exact disjoint_left.mpr fun q₁ hq₁_cl hq₁_X₁ => + hno q₁ hq₁_X₁ q₂ hq₂_X₂ r hr hq₁_cl hq₂_cl + let K₁ : Set S := X₁ ∪ ⋃ r ∈ R₁, closure r + let K₂ : Set S := X₂ ∪ ⋃ r ∈ R₂, closure r + have hRf₁ : R₁.Finite := hR_fin.subset fun _ h => h.1 + have hRf₂ : R₂.Finite := hR_fin.subset fun _ h => h.1 + have hK₁_cl : IsClosed K₁ := + (hfin.subset hX₁_sub).isClosed.union (hRf₁.isClosed_biUnion fun _ _ => isClosed_closure) + have hK₂_cl : IsClosed K₂ := + (hfin.subset sdiff_subset).isClosed.union (hRf₂.isClosed_biUnion fun _ _ => isClosed_closure) + have hcov : range φ ⊆ K₁ ∪ K₂ := by + intro z hz + by_cases hzU : z ∈ H.U + · by_cases hz₁ : z ∈ X₁ + · exact Or.inl (Or.inl hz₁) + · exact Or.inr (Or.inl ⟨⟨hz, hzU⟩, hz₁⟩) + · obtain ⟨r, hr, hzr⟩ := exists_region_of_notMem hzU + by_cases hd₂ : Disjoint (closure r) X₂ + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨r, ⟨hr, hd₂⟩, subset_closure hzr⟩)) + · exact Or.inr (Or.inr (mem_iUnion₂.mpr ⟨r, ⟨hr, hd₂⟩, subset_closure hzr⟩)) + obtain ⟨q₁, hq₁⟩ := hX₁_ne + obtain ⟨q₂, hq₂⟩ := hX₂_ne + have hconn := (isConnected_range φ.continuous).isPreconnected + obtain ⟨z, hz_ran, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp hconn K₁ K₂ hK₁_cl hK₂_cl hcov + ⟨q₁, (hX₁_sub hq₁).1, Or.inl hq₁⟩ ⟨q₂, hq₂.1.1, Or.inl hq₂⟩ + by_cases hzU : z ∈ H.U + · by_cases hzX₁ : z ∈ X₁ + · rcases hz₂ with hzX₂ | hzr₂ + · exact hzX₂.2 hzX₁ + · obtain ⟨r₂, hr₂, hzr₂⟩ := mem_iUnion₂.mp hzr₂ + exact disjoint_left.mp (hR₂_disj r₂ hr₂) hzr₂ hzX₁ + · have hzX₂ : z ∈ X₂ := ⟨⟨hz_ran, hzU⟩, hzX₁⟩ + rcases hz₁ with hzX₁' | hzr₁ + · exact hzX₁ hzX₁' + · obtain ⟨r₁, ⟨_, hd₁⟩, hzr₁⟩ := mem_iUnion₂.mp hzr₁ + exact disjoint_left.mp hd₁ hzr₁ hzX₂ + · obtain ⟨r₀, hr₀, hzr₀⟩ := exists_region_of_notMem hzU + have hzr₁ : z ∈ ⋃ r ∈ R₁, closure r := + hz₁.resolve_left fun h => hzU (hX₁_sub h).2 + have hzr₂ : z ∈ ⋃ r ∈ R₂, closure r := + hz₂.resolve_left fun h => hzU h.1.2 + obtain ⟨r₁, hr₁, hcl₁⟩ := mem_iUnion₂.mp hzr₁ + obtain ⟨r₂, hr₂, hcl₂⟩ := mem_iUnion₂.mp hzr₂ + obtain ⟨y₁, hy₁₀, hy₁₁⟩ := mem_closure_iff.mp hcl₁ r₀ (region_isOpen hr₀) hzr₀ + obtain ⟨y₂, hy₂₀, hy₂₂⟩ := mem_closure_iff.mp hcl₂ r₀ (region_isOpen hr₀) hzr₀ + have heq₁ : r₀ = r₁ := region_eq_of_mem hr₀ hr₁.1 hy₁₀ hy₁₁ + have heq₂ : r₀ = r₂ := region_eq_of_mem hr₀ hr₂.1 hy₂₀ hy₂₂ + exact hr₂.2 (heq₂ ▸ heq₁ ▸ hr₁.2) + +private theorem dist_le_two_of_same_or_shared_region [ConnectedSpace S] + (hS : IsClosedSurface S) {H K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + {d : Set S → Set S → ℕ} + (hE : H.E.Nonempty) (hResp : IsRespectfulDrawingTangle H θ T) + (hrad : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hslope : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hd_eq : ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = tangleMetric H K ins θ x y) + {p₁ p₂ w₁ w₂ : S} (ha₁ : AssocVertex H p₁ w₁) (ha₂ : AssocVertex H p₂ w₂) + (hrel : p₁ = p₂ ∨ ∃ r ∈ H.R, p₁ ∈ closure r ∧ p₂ ∈ closure r) : + d {w₁} {w₂} ≤ 2 := by + have hsl : IsSlope K (2 * θ) ins := + GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) hS hResp.2.1.isPretangle hrad.2.1.1 + hslope + have hw₁V := ha₁.mem_V + have hw₂V := ha₂.mem_V + have hw₁A : ({w₁} : Set S) ∈ H.A := Or.inl (Or.inl ⟨w₁, hw₁V, rfl⟩) + have hw₂A : ({w₂} : Set S) ∈ H.A := Or.inl (Or.inl ⟨w₂, hw₂V, rfl⟩) + have h_via_region : ∀ {r : Set S}, r ∈ H.R → w₁ ∈ closure r → w₂ ∈ closure r → + d {w₁} {w₂} ≤ 2 := by + intro r hr hwr₁ hwr₂ + rw [hd_eq {w₁} hw₁A {w₂} hw₂A] + have h1 := GM11.tangleMetric_le_one (ins := ins) (θ := θ) hS hrad hE hw₁V hr hwr₁ + have h2 : tangleMetric H K ins θ r {w₂} ≤ 1 := by + rw [GM11.tangleMetric_comm] + exact GM11.tangleMetric_le_one (ins := ins) (θ := θ) hS hrad hE hw₂V hr hwr₂ + exact (GM11.tangleMetric_triangle hS hrad.2.1 hsl {w₁} r {w₂}).trans (Nat.add_le_add h1 h2) + rcases hrel with rfl | ⟨r, hr, hp₁r, hp₂r⟩ + · rcases ha₁ with ⟨hp₁V, hw₁_eq⟩ | ⟨e₁, he₁, hp₁e₁, hw₁e₁, _⟩ + · rcases ha₂ with ⟨_, hw₂_eq⟩ | ⟨e₂, he₂, hp₁e₂, _, _⟩ + · have hw_eq : w₂ = w₁ := hw₂_eq.trans hw₁_eq.symm + rw [hd_eq {w₁} hw₁A {w₂} hw₂A, hw_eq] + simp [tangleMetric] + · exact absurd hp₁V (he₂.2.1 hp₁e₂).2 + · rcases ha₂ with ⟨hp₁V, _⟩ | ⟨e₂, he₂, hp₁e₂, hw₂e₂, _⟩ + · exact absurd hp₁V (he₁.2.1 hp₁e₁).2 + · have heq : e₁ = e₂ := H.edge_eq_of_mem he₁ he₂ hp₁e₁ hp₁e₂ + subst heq + obtain ⟨r, hr, her⟩ := GM11.exists_region_incident hS he₁ + have hcl : closure e₁ ⊆ closure r := isClosed_closure.closure_subset_iff.mpr her + exact h_via_region hr (hcl hw₁e₁) (hcl hw₂e₂) + · exact h_via_region hr + (mem_closure_region_of_assocVertex hS ha₁ hr hp₁r) + (mem_closure_region_of_assocVertex hS ha₂ hr hp₂r) + +private theorem dist_le_four_of_assocVertex_on_curve [ConnectedSpace S] + (hS : IsClosedSurface S) {H K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + {d : Set S → Set S → ℕ} + (hE : H.E.Nonempty) (hResp : IsRespectfulDrawingTangle H θ T) + (hrad : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hslope : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hd_eq : ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = tangleMetric H K ins θ x y) + {φ : C(Circle, S)} (hfin : (range φ ∩ H.U).Finite) (hcard : (range φ ∩ H.U).ncard ≤ 3) + {p₁ p₂ w₁ w₂ : S} (hp₁ : p₁ ∈ range φ ∩ H.U) (hp₂ : p₂ ∈ range φ ∩ H.U) + (ha₁ : AssocVertex H p₁ w₁) (ha₂ : AssocVertex H p₂ w₂) : + d {w₁} {w₂} ≤ 4 := by + have hsl : IsSlope K (2 * θ) ins := + GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) hS hResp.2.1.isPretangle hrad.2.1.1 + hslope + set X := range φ ∩ H.U + let X₁ : Set S := {q ∈ X | q = p₁ ∨ ∃ r ∈ H.R, p₁ ∈ closure r ∧ q ∈ closure r} + by_cases hp₂_X₁ : p₂ ∈ X₁ + · exact (dist_le_two_of_same_or_shared_region hS hE hResp hrad hslope hd_eq ha₁ ha₂ + (hp₂_X₁.2.imp Eq.symm id)).trans (by omega) + · have hX₁_sub : X₁ ⊆ X := fun _ h => h.1 + have hp₁_X₁ : p₁ ∈ X₁ := ⟨hp₁, Or.inl rfl⟩ + obtain ⟨q₁, hq₁, q₂, hq₂, r₂, hr₂, hq₁r₂, hq₂r₂⟩ := + exists_shared_region_of_partition hS hE hrad hfin hX₁_sub ⟨p₁, hp₁_X₁⟩ ⟨p₂, hp₂, hp₂_X₁⟩ + have hq₁_ne : q₁ ≠ p₁ := by + rintro rfl + exact hq₂.2 ⟨hq₂.1, Or.inr ⟨r₂, hr₂, hq₁r₂, hq₂r₂⟩⟩ + have hq₂_eq : q₂ = p₂ := by + by_contra hne₂ + have hp₁_ne_p₂ : p₁ ≠ p₂ := fun h => hp₂_X₁ (h ▸ hp₁_X₁) + have hp₁_ne_q₂ : p₁ ≠ q₂ := fun h => hq₂.2 (h ▸ hp₁_X₁) + have hq₁_ne_q₂ : q₁ ≠ q₂ := fun h => hq₂.2 (h ▸ hq₁) + have hq₁_ne_p₂ : q₁ ≠ p₂ := fun h => hp₂_X₁ (h ▸ hq₁) + have hsub4 : ({p₁, q₁, q₂, p₂} : Set S) ⊆ X := by + rintro z (rfl | rfl | rfl | rfl) + · exact hp₁ + · exact hq₁.1 + · exact hq₂.1 + · exact hp₂ + have h4 : ({p₁, q₁, q₂, p₂} : Set S).ncard = 4 := by + rw [ncard_insert_of_notMem (by simp [hq₁_ne.symm, hp₁_ne_q₂, hp₁_ne_p₂]), + ncard_insert_of_notMem (by simp [hq₁_ne_q₂, hq₁_ne_p₂]), + ncard_pair hne₂] + have hle := ncard_le_ncard hsub4 hfin + omega + subst hq₂_eq + obtain ⟨w_q, hw_qV, ha_q⟩ := exists_assocVertex hq₁.1.2 + have hd₁ : d {w₁} {w_q} ≤ 2 := + dist_le_two_of_same_or_shared_region hS hE hResp hrad hslope hd_eq ha₁ ha_q + (hq₁.2.imp Eq.symm id) + have hd₂ : d {w_q} {w₂} ≤ 2 := + dist_le_two_of_same_or_shared_region hS hE hResp hrad hslope hd_eq ha_q ha₂ + (Or.inr ⟨r₂, hr₂, hq₁r₂, hq₂r₂⟩) + have hw₁A : ({w₁} : Set S) ∈ H.A := Or.inl (Or.inl ⟨w₁, ha₁.mem_V, rfl⟩) + have hwqA : ({w_q} : Set S) ∈ H.A := Or.inl (Or.inl ⟨w_q, hw_qV, rfl⟩) + have hw₂A : ({w₂} : Set S) ∈ H.A := Or.inl (Or.inl ⟨w₂, ha₂.mem_V, rfl⟩) + have htri : d {w₁} {w₂} ≤ d {w₁} {w_q} + d {w_q} {w₂} := by + rw [hd_eq {w₁} hw₁A {w₂} hw₂A, hd_eq {w₁} hw₁A {w_q} hwqA, hd_eq {w_q} hwqA {w₂} hw₂A] + exact GM11.tangleMetric_triangle hS hrad.2.1 hsl {w₁} {w_q} {w₂} + omega + +private theorem exists_assocVertex_dist_le_three_of_mem_curveIns [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + {H K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + {d : Set S → Set S → ℕ} + (hθ : 15 < θ) (hE : H.E.Nonempty) (hResp : IsRespectfulDrawingTangle H θ T) + (hrad : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hslope : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hd_eq : ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = tangleMetric H K ins θ x y) + {φ : C(Circle, S)} (hfin : (range φ ∩ H.U).Finite) (hcard : (range φ ∩ H.U).ncard ≤ 3) + {u : S} (hu : u ∈ H.V) (hu_ins : u ∈ curveIns φ) : + ∃ p ∈ range φ ∩ H.U, ∃ w ∈ H.V, AssocVertex H p w ∧ d {u} {w} ≤ 3 := by + have huA : ({u} : Set S) ∈ H.A := Or.inl (Or.inl ⟨u, hu, rfl⟩) + rcases hu_ins with hu_ran | hu_disc + · refine ⟨u, ⟨hu_ran, H.V_subset_U hu⟩, u, hu, Or.inl ⟨hu, rfl⟩, ?_⟩ + rw [hd_eq {u} huA {u} huA] + simp [tangleMetric] + · obtain ⟨Δ, ⟨hΔ, hbd_sub⟩, huΔ⟩ := mem_iUnion₂.mp hu_disc + have hbd_U_sub : subBd Δ ∩ H.U ⊆ range φ ∩ H.U := inter_subset_inter_left H.U hbd_sub + have hfin_Δ : (subBd Δ ∩ H.U).Finite := hfin.subset hbd_U_sub + have hcard_Δ : (subBd Δ ∩ H.U).ncard ≤ 3 := (ncard_le_ncard hbd_U_sub hfin).trans hcard + obtain ⟨A₁, B₁, hA₁B₁, hAV, hord_le, hsep_verts⟩ := + disc_sep_mem_tangle hS hns hθ hE hResp hΔ hfin_Δ hcard_Δ + have hassoc_sep : ∀ w ∈ (A₁ ∩ B₁).vertexSet, + ∃ p ∈ range φ ∩ H.U, AssocVertex H p w := by + intro w hw + rcases hsep_verts w hw with ⟨hw_bd, hwV⟩ | ⟨e, heE, ⟨p, hpe, hp_bd⟩, hw_cl⟩ + · exact ⟨w, ⟨hbd_sub hw_bd, H.V_subset_U hwV⟩, Or.inl ⟨hwV, rfl⟩⟩ + · exact ⟨p, ⟨hbd_sub hp_bd, (heE.2.1 hpe).1⟩, Or.inr ⟨e, heE, hpe, hw_cl⟩⟩ + by_cases hu_sep : u ∈ (A₁ ∩ B₁).vertexSet + · obtain ⟨p, hp, ha⟩ := hassoc_sep u hu_sep + refine ⟨p, hp, u, hu, ha, ?_⟩ + rw [hd_eq {u} huA {u} huA] + simp [tangleMetric] + · have hsep₁ := hResp.2.1.isSeparation hA₁B₁ + have huA₁ : u ∈ A₁.vertexSet := hAV.symm ▸ ⟨hu, huΔ⟩ + have hu_not_B₁ : u ∉ B₁.vertexSet := fun huB₁ => hu_sep ⟨huA₁, huB₁⟩ + have hrf : RegionFacts (PaintingOrDrawing.drawing H) K := + GM11.regionFacts_of_radial ⟨hrad.1, hrad.2.1⟩ hS hrad.2.2 hE + obtain ⟨f, hfE, huf⟩ := GM11.exists_edge_of_regionFacts hS hrf hu + have hincH : H.toHypergraph.Inc f u := + (PaintingOrDrawing.toHypergraph_inc (Γ := PaintingOrDrawing.drawing H)).mpr ⟨hfE, hu, huf⟩ + have hfA₁ : f ∈ A₁.edgeSet := by + rcases (hsep₁.edgeSet_union.symm ▸ hfE : f ∈ A₁.edgeSet ∪ B₁.edgeSet) with hfA | hfB + · exact hfA + · exact absurd (B₁.vertex_mem_of_inc ((inc_iff_of_le hsep₁.right_le hfB).mpr hincH)) + hu_not_B₁ + obtain ⟨D, hD, hDs, hDlen, hDV, hfD⟩ := + theorem_7_2_proof hS ‹ConnectedSpace S› hE hResp hrad hslope hA₁B₁ hfA₁ + obtain ⟨w, hwD⟩ := (circuit_length_eq_two_mul_ncard hrad.2.1 hD hDs).2 + have hw_sep : w ∈ (A₁ ∩ B₁).vertexSet := hDV hwD + obtain ⟨p, hp, ha⟩ := hassoc_sep w hw_sep + have hu_insD : u ∈ ins D := + (hslope D hD hDs hDlen).1.isClosed.closure_subset_iff.mpr hfD huf + have hwA : ({w} : Set S) ∈ H.A := Or.inl (Or.inl ⟨w, hwD.2, rfl⟩) + have hduw : d {u} {w} ≤ 3 := by + rw [hd_eq {u} huA {w} hwA, GM11.tangleMetric_comm] + calc tangleMetric H K ins θ {w} {u} + _ ≤ (D.V ∩ H.V).ncard := + (tangleMetric_vertex_le_of_circuit hS hrad hslope hD hDs hDlen hwD huA + ⟨u, rfl, hu_insD⟩).2 + _ ≤ (A₁ ∩ B₁).vertexSet.ncard := ncard_le_ncard hDV (A₁ ∩ B₁).vertexSet_finite + _ ≤ (subBd Δ ∩ H.U).ncard := hord_le + _ ≤ 3 := hcard_Δ + exact ⟨p, hp, w, hwD.2, ha, hduw⟩ + +/-- If `H` is a drawing in a connected closed non-spherical surface `S` with `H.E.Nonempty` and a +respectful tangle `T` of order `θ > 15` with metric `d`, and `u, v ∈ H.V` satisfy `¬ d {u} {v} < +12`, +then there is no continuous closed curve `φ : C(Circle, S)` with `(range φ ∩ H.U).encard ≤ 3`, +`u ∈ curveIns φ`, and `v ∈ curveIns φ`. -/ +theorem not_exists_curve_of_dist_ge_twelve [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hθ : 15 < θ) (hE : H.E.Nonempty) (hd : HasTangleMetric H θ T d) + {u v : S} (hu : u ∈ H.V) (hv : v ∈ H.V) (hdist : ¬ d {u} {v} < 12) : + ¬ ∃ φ : C(Circle, S), + (range φ ∩ H.U).encard ≤ 3 ∧ u ∈ curveIns φ ∧ v ∈ curveIns φ := by + rintro ⟨φ, hencard, hu_ins, hv_ins⟩ + have hfin : (range φ ∩ H.U).Finite := + Set.finite_of_encard_le_coe (k := 3) hencard + have hcard : (range φ ∩ H.U).ncard ≤ 3 := + Nat.cast_le (α := ℕ∞).mp (by rw [hfin.cast_ncard_eq]; exact hencard) + obtain ⟨hResp, K, ins, hrad, hslope, hd_eq⟩ := id hd + have hsl : IsSlope K (2 * θ) ins := + GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) hS hResp.2.1.isPretangle hrad.2.1.1 + hslope + obtain ⟨p_u, hp_u, w_u, hw_u, ha_u, hdu⟩ := + exists_assocVertex_dist_le_three_of_mem_curveIns hS hns hθ hE hResp hrad hslope hd_eq + hfin hcard hu hu_ins + obtain ⟨p_v, hp_v, w_v, hw_v, ha_v, hdv⟩ := + exists_assocVertex_dist_le_three_of_mem_curveIns hS hns hθ hE hResp hrad hslope hd_eq + hfin hcard hv hv_ins + have hdw : d {w_u} {w_v} ≤ 4 := + dist_le_four_of_assocVertex_on_curve hS hE hResp hrad hslope hd_eq + hfin hcard hp_u hp_v ha_u ha_v + have huA : ({u} : Set S) ∈ H.A := Or.inl (Or.inl ⟨u, hu, rfl⟩) + have hvA : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hv, rfl⟩) + have hwuA : ({w_u} : Set S) ∈ H.A := Or.inl (Or.inl ⟨w_u, hw_u, rfl⟩) + have hwvA : ({w_v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨w_v, hw_v, rfl⟩) + have hdv_symm : d {w_v} {v} = d {v} {w_v} := by + rw [hd_eq {w_v} hwvA {v} hvA, hd_eq {v} hvA {w_v} hwvA, GM11.tangleMetric_comm] + have htri₁ : d {u} {v} ≤ d {u} {w_u} + d {w_u} {v} := by + rw [hd_eq {u} huA {v} hvA, hd_eq {u} huA {w_u} hwuA, hd_eq {w_u} hwuA {v} hvA] + exact GM11.tangleMetric_triangle hS hrad.2.1 hsl {u} {w_u} {v} + have htri₂ : d {w_u} {v} ≤ d {w_u} {w_v} + d {w_v} {v} := by + rw [hd_eq {w_u} hwuA {v} hvA, hd_eq {w_u} hwuA {w_v} hwvA, hd_eq {w_v} hwvA {v} hvA] + exact GM11.tangleMetric_triangle hS hrad.2.1 hsl {w_u} {w_v} {v} + exact hdist (by omega) + +end + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/FewCircuits.lean b/LeanPool/GraphMinor/GM14/FewCircuits.lean new file mode 100644 index 0000000000..b468fe9ce5 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/FewCircuits.lean @@ -0,0 +1,286 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section8a +public import LeanPool.GraphMinor.GM09.Basic +public import LeanPool.GraphMinor.GM09.Section2c +public import LeanPool.GraphMinor.GM09.Section3a +public import LeanPool.GraphMinor.GM09.Section9 + +/-! +# Graphs with at most one circuit + +In the proof of Graph Minors XIV, (8.4) (page 42), the paper uses the fact that "every graph with +at most one circuit can be drawn in the plane with all its vertices incident with the infinite +region". We build this drawing one vertex at a time. This file finds the vertex to add last: a +finite graph with at most one circuit is either that circuit, or it has a vertex with at most one +edge at it. +-/ + + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Graph GraphMinor GraphMinor.GM09 GraphMinor.Surface + +universe u v + +variable {α : Type u} {β : Type v} + +/-- A finite graph has finitely many subgraphs. -/ +theorem finite_subgraphs {G : Graph α β} (hV : V(G).Finite) (hE : E(G).Finite) : + {C : Graph α β | C ≤ G}.Finite := by + have hfin := Set.Finite.prod hV.finite_subsets hE.finite_subsets + refine Set.Finite.of_finite_image (f := fun C : Graph α β => (V(C), E(C))) + (hfin.subset ?_) ?_ + · rintro _ ⟨C, hC, rfl⟩ + have hC' : C ≤ G := hC + exact ⟨hC'.vertexSet_mono, hC'.edgeSet_mono⟩ + · intro C hC D hD h + have h' : V(C) = V(D) ∧ E(C) = E(D) := by simpa using h + exact (Compatible.of_le_le hC hD).ext h'.1 h'.2 + +/-- Two circuits of a finite graph with at most one circuit are equal. -/ +theorem eq_of_isGraphCircuit {G C D : Graph α β} (hV : V(G).Finite) (hE : E(G).Finite) + (hc : {C | IsGraphCircuit G C}.ncard ≤ 1) (hC : IsGraphCircuit G C) + (hD : IsGraphCircuit G D) : C = D := by + have hfin : {C | IsGraphCircuit G C}.Finite := + (finite_subgraphs hV hE).subset fun _ h => h.1 + by_contra hne + have h2 : 2 ≤ {C | IsGraphCircuit G C}.ncard := by + rw [← ncard_pair hne] + refine ncard_le_ncard ?_ hfin + rintro x (rfl | rfl) + · exact hC + · exact hD + omega + +/-- A loop is a circuit. -/ +theorem isGraphCircuit_of_isLoop {G : Graph α β} {e : β} {a : α} (hl : G.IsLink e a a) : + IsGraphCircuit G (walkSubgraph (GraphWalk.cons hl (GraphWalk.nil hl.left_mem))) := by + refine ⟨walkSubgraph_le _, ?_⟩ + have hl' : (walkSubgraph (GraphWalk.cons hl (GraphWalk.nil hl.left_mem))).IsLink e a a := by + exact (walkSubgraph_isLink _).mpr ⟨by simp [GraphWalk.edges], hl⟩ + refine ⟨a, GraphWalk.cons hl' (GraphWalk.nil hl'.left_mem), ?_, ?_, ?_, ?_⟩ + · simp [GraphWalk.IsSimpleClosed, GraphWalk.support, GraphWalk.edges] + · simp [GraphWalk.length, GraphWalk.edges] + · rw [vertexSet_walkSubgraph] + simp [GraphWalk.support] + · rw [edgeSet_walkSubgraph] + simp [GraphWalk.edges] + +/-- An edge between two distinct vertices is a path. -/ +theorem isGraphPathWithEnds_edge {G : Graph α β} {e : β} {a b : α} (hl : G.IsLink e a b) + (hab : a ≠ b) : + IsGraphPathWithEnds G (walkSubgraph (GraphWalk.cons hl (GraphWalk.nil hl.right_mem))) a b := + isGraphPathWithEnds_walkSubgraph (by simpa [GraphWalk.IsSimple, GraphWalk.support] using hab) + +/-- At an end of a longest path of a graph with no circuit, every edge lies on the path. -/ +theorem mem_edgeSet_of_longest {F Q : Graph α β} {a b : α} + (hno : ¬ ∃ C : Graph α β, IsGraphCircuit F C) (hVF : V(F).Finite) + (hQ : IsGraphPathWithEnds F Q a b) + (hmax : ∀ (Q' : Graph α β) (a' b' : α), IsGraphPathWithEnds F Q' a' b' → + V(Q').ncard ≤ V(Q).ncard) + {f : β} {y : α} (hl : F.IsLink f a y) : f ∈ E(Q) := by + by_contra hf + by_cases hy : y ∈ V(Q) + · by_cases hay : a = y + · subst hay + exact hno ⟨_, isGraphCircuit_of_isLoop hl⟩ + · obtain ⟨R, hRQ, -, hR⟩ := hQ.exists_subpath hQ.left_mem hy + refine hno ⟨_, isGraphCircuit_subgraphUnion hR (isGraphPathWithEnds_edge hl hay) hay ?_ ?_⟩ + · refine subset_antisymm ?_ ?_ + · rintro x ⟨-, hx⟩ + rw [vertexSet_walkSubgraph] at hx + simpa [GraphWalk.support] using hx + · rintro x (rfl | rfl) + · exact ⟨hR.left_mem, by simp [vertexSet_walkSubgraph, GraphWalk.support]⟩ + · exact ⟨hR.right_mem, by simp [vertexSet_walkSubgraph, GraphWalk.support]⟩ + · rw [edgeSet_walkSubgraph] + refine disjoint_left.mpr fun e he h => ?_ + have : e = f := by simpa [GraphWalk.edges] using h + exact hf (this ▸ hRQ.edgeSet_mono he) + · obtain ⟨hQF, W, hW, hVQ, -⟩ := hQ + obtain ⟨W', hs, -⟩ := exists_walk_up_of_le hQF W + have hs' : (GraphWalk.cons hl.symm W').IsSimple := by + unfold GraphWalk.IsSimple + rw [GraphWalk.support_cons, hs] + refine List.nodup_cons.mpr ⟨fun h => hy ?_, hW⟩ + rw [hVQ] + exact h + have hle := hmax _ _ _ (isGraphPathWithEnds_walkSubgraph hs') + have hV' : V(walkSubgraph (GraphWalk.cons hl.symm W')) = insert y V(Q) := by + rw [vertexSet_walkSubgraph, GraphWalk.support_cons, hs, hVQ] + ext x + simp + rw [hV', ncard_insert_of_notMem hy (hVF.subset hQF.vertexSet_mono)] at hle + omega + +/-- A graph with an edge and no circuit has a path with two distinct ends that is as long as +possible. -/ +theorem exists_longest_path {F : Graph α β} (hVF : V(F).Finite) (hno : ¬ ∃ C, IsGraphCircuit F C) + (hE : E(F).Nonempty) : + ∃ (Q : Graph α β) (a b : α), IsGraphPathWithEnds F Q a b ∧ a ≠ b ∧ + ∀ (Q' : Graph α β) (a' b' : α), IsGraphPathWithEnds F Q' a' b' → + V(Q').ncard ≤ V(Q).ncard := by + classical + obtain ⟨e, he⟩ := hE + obtain ⟨p, q, hl⟩ := F.exists_isLink_of_mem_edgeSet he + have hpq : p ≠ q := by + rintro rfl + exact hno ⟨_, isGraphCircuit_of_isLoop hl⟩ + have hbd : ∀ (Q' : Graph α β) (a' b' : α), IsGraphPathWithEnds F Q' a' b' → + V(Q').ncard ≤ V(F).ncard := fun Q' _ _ h => ncard_le_ncard h.le.vertexSet_mono hVF + let s : Set ℕ := {n | ∃ (Q : Graph α β) (a b : α), IsGraphPathWithEnds F Q a b ∧ a ≠ b ∧ + V(Q).ncard = n} + have hs : s.Finite := (Set.finite_Iic V(F).ncard).subset fun n ⟨Q, a, b, h, _, hn⟩ => + hn ▸ hbd Q a b h + have hne : s.Nonempty := ⟨_, _, p, q, isGraphPathWithEnds_edge hl hpq, hpq, rfl⟩ + obtain ⟨n, hn, hmax⟩ := hs.exists_maximal hne + obtain ⟨Q, a, b, hQ, hab, rfl⟩ := hn + refine ⟨Q, a, b, hQ, hab, fun Q' a' b' h => ?_⟩ + by_cases heq : a' = b' + · subst heq + have h1 : V(Q') = {a'} := by + obtain ⟨-, W, hW, hV, -⟩ := h + cases W with + | nil hv => rw [hV]; ext x; simp [GraphWalk.support] + | cons hlink W' => + have := List.nodup_cons.mp (show (_ :: W'.support).Nodup from hW) + exact (this.1 W'.end_mem_support).elim + rw [h1, ncard_singleton] + exact Nat.succ_le_of_lt ((ncard_pos (hVF.subset hQ.le.vertexSet_mono)).mpr ⟨a, hQ.left_mem⟩) + · by_contra hlt + exact absurd (hmax ⟨Q', a', b', h, heq, rfl⟩ (not_le.mp hlt).le) (by omega) + +/-- **A vertex to add last.** A finite graph with a vertex and at most one circuit is either a +circuit, or it has a vertex with no edge at it, or a vertex with just one edge at it, not a loop. -/ +theorem isGraphCircuit_self_or_exists_leaf {K : Graph α β} (hV : V(K).Finite) (hE : E(K).Finite) + (hc : {C | IsGraphCircuit K C}.ncard ≤ 1) (hne : V(K).Nonempty) : + IsGraphCircuit K K ∨ ∃ r ∈ V(K), (∀ e x, ¬ K.IsLink e r x) ∨ + ∃ e u, u ≠ r ∧ K.IsLink e r u ∧ ∀ e' x, K.IsLink e' r x → e' = e := by + classical + -- `Z` is the edge set of the circuit of `K`, if it has one. + obtain ⟨Z, Y, hZK, hZ⟩ : ∃ (Z : Set β) (Y : Set α), Z ⊆ E(K) ∧ + ((Z = ∅ ∧ Y = ∅ ∧ ¬ ∃ C, IsGraphCircuit K C) ∨ + ∃ C, IsGraphCircuit K C ∧ Z = E(C) ∧ Y = V(C)) := by + by_cases h : ∃ C, IsGraphCircuit K C + · obtain ⟨C, hC⟩ := h + exact ⟨E(C), V(C), hC.1.edgeSet_mono, Or.inr ⟨C, hC, rfl, rfl⟩⟩ + · exact ⟨∅, ∅, empty_subset _, Or.inl ⟨rfl, rfl, h⟩⟩ + let F : Graph α β := K.restrict (E(K) \ Z) + have hFK : F ≤ K := restrict_le + have hVF : V(F) = V(K) := rfl + have hEF : E(F) = E(K) \ Z := by + change E(K) ∩ (E(K) \ Z) = _ + exact inter_eq_right.mpr sdiff_subset + -- A circuit of `F` would be a second circuit of `K`. + have hno : ¬ ∃ C, IsGraphCircuit F C := by + rintro ⟨C, hC⟩ + have hC' : IsGraphCircuit K C := ⟨hC.1.trans hFK, hC.2⟩ + rcases hZ with ⟨-, -, h⟩ | ⟨C₀, hC₀, rfl, -⟩ + · exact h ⟨C, hC'⟩ + · have heq := eq_of_isGraphCircuit hV hE hc hC' hC₀ + subst heq + have hCF := hC.1 + obtain ⟨-, u, W, -, hpos, -, hEC⟩ := hC + cases W with + | nil _ => simp [GraphWalk.length, GraphWalk.edges] at hpos + | @cons x y z e hl W' => + have heC : e ∈ E(C) := by rw [hEC]; simp [GraphWalk.edges] + have : e ∈ E(F) := hCF.edgeSet_mono heC + rw [hEF] at this + exact this.2 heC + have hYedge : ∀ {e x y}, K.IsLink e x y → x ∉ Y → e ∉ Z := by + intro e x y hl hx heZ + rcases hZ with ⟨rfl, -, -⟩ | ⟨C, hC, rfl, rfl⟩ + · exact heZ + · exact hx (hC.1.vertexSet_mono |> fun _ => ((hC.1.isLink_iff heZ).mpr hl).left_mem) + by_cases hEF' : E(F).Nonempty + · obtain ⟨Q, a, b, hQ, hab, hmax⟩ := exists_longest_path (hVF ▸ hV) hno hEF' + -- An end of `Q` off the circuit has only one edge at it. + have hleaf : ∀ {a b : α}, IsGraphPathWithEnds F Q a b → a ≠ b → a ∉ Y → + ∃ r ∈ V(K), (∀ e x, ¬ K.IsLink e r x) ∨ + ∃ e u, u ≠ r ∧ K.IsLink e r u ∧ ∀ e' x, K.IsLink e' r x → e' = e := by + intro a b hQ hab ha + obtain ⟨e, heQ, hinc⟩ := hQ.exists_inc_left_of_ne hab + obtain ⟨u, hu⟩ := hinc + refine ⟨a, hVF ▸ hQ.le.vertexSet_mono hQ.left_mem, Or.inr ⟨e, u, ?_, + (hu.mono (hQ.le.trans hFK)), ?_⟩⟩ + · rintro rfl + exact hno ⟨_, isGraphCircuit_of_isLoop (hu.mono hQ.le)⟩ + · intro e' x hl + have hlF : F.IsLink e' a x := by + refine (hFK.isLink_iff ?_).mpr hl + rw [hEF] + exact ⟨hl.edge_mem, hYedge hl ha⟩ + have he' := mem_edgeSet_of_longest hno (hVF ▸ hV) hQ hmax hlF + have hinc' : Q.Inc e' a := ⟨x, (hQ.le.isLink_iff he').mpr hlF⟩ + exact hQ.inc_left_unique he' heQ hinc' ⟨u, hu⟩ + by_cases ha : a ∈ Y + · by_cases hb : b ∈ Y + · -- Both ends on the circuit: the path gives a second circuit. + exfalso + rcases hZ with ⟨-, rfl, -⟩ | ⟨C, hC, rfl, rfl⟩ + · exact ha + · have hne' : (V(Q) ∩ (V(C) \ {a})).Nonempty := + ⟨b, hQ.right_mem, hb, fun h => hab h.symm⟩ + obtain ⟨u, ⟨-, huC, hua⟩, P₁, P₂, hP₁Q, -, hP₁, -, -, -, -, hdis⟩ := + hQ.exists_first_split_at_mem hne' + have hau : a ≠ u := fun h => hua h.symm + obtain ⟨R, -, hRC, -, hR, -, -, -, -, -, -⟩ := + IsGraphCircuit.exists_two_paths hC ha huC hau + have hP₁K : IsGraphPathWithEnds K P₁ a u := + hP₁.mono (hQ.le.trans hFK) + have hEP₁ : Disjoint E(P₁) E(C) := by + refine disjoint_left.mpr fun e he heC => ?_ + have : e ∈ E(F) := (hP₁Q.trans hQ.le).edgeSet_mono he + rw [hEF] at this + exact this.2 heC + have hVP₁ : V(P₁) ∩ V(R) = {a, u} := by + refine subset_antisymm ?_ ?_ + · rintro x ⟨hx₁, hxR⟩ + by_cases hxa : x = a + · exact Or.inl hxa + by_cases hxu : x = u + · exact Or.inr hxu + exact (disjoint_left.mp hdis ⟨hx₁, hxu⟩ ⟨hRC.vertexSet_mono hxR, hxa⟩).elim + · rintro x (rfl | rfl) + · exact ⟨hP₁.left_mem, hR.left_mem⟩ + · exact ⟨hP₁.right_mem, hR.right_mem⟩ + have hC₂ := isGraphCircuit_subgraphUnion hP₁K hR hau hVP₁ + (hEP₁.mono_right hRC.edgeSet_mono) + have heq := eq_of_isGraphCircuit hV hE hc hC₂ hC + obtain ⟨e, he, -⟩ := hP₁.exists_inc_left_of_ne hau + have heC : e ∈ E(C) := by + rw [← heq, edgeSet_subgraphUnion hP₁K.le hR.le] + exact Or.inl he + exact disjoint_left.mp hEP₁ he heC + · exact Or.inr (hleaf hQ.symm hab.symm hb) + · exact Or.inr (hleaf hQ hab ha) + · -- All edges of `K` lie on the circuit. + have hEK : E(K) ⊆ Z := by + intro e he + by_contra heZ + exact hEF' ⟨e, hEF ▸ ⟨he, heZ⟩⟩ + by_cases hall : V(K) ⊆ Y + · rcases hZ with ⟨-, rfl, -⟩ | ⟨C, hC, rfl, rfl⟩ + · obtain ⟨x, hx⟩ := hne + exact (hall hx).elim + · left + have heq : C = K := + (Compatible.of_le_le hC.1 le_rfl).ext (subset_antisymm hC.1.vertexSet_mono hall) + (subset_antisymm hC.1.edgeSet_mono hEK) + exact heq ▸ hC + · obtain ⟨r, hr, hrY⟩ := not_subset.mp hall + exact Or.inr ⟨r, hr, Or.inl fun e x hl => hYedge hl hrY (hEK hl.edge_mem)⟩ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/FewCircuitsDrawing.lean b/LeanPool/GraphMinor/GM14/FewCircuitsDrawing.lean new file mode 100644 index 0000000000..c41c45dc88 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/FewCircuitsDrawing.lean @@ -0,0 +1,541 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.FewCircuits +public import LeanPool.GraphMinor.GM09.RuralExtend +public import LeanPool.GraphMinor.GM09.Section2e +public import LeanPool.GraphMinor.GM09.DiscDrawing +public import LeanPool.GraphMinor.GM09.Section6b + +/-! +# Drawing a graph with at most one circuit + +"every graph with at most one circuit can be drawn in the plane with all its vertices incident with +the infinite region" (Graph Minors XIV, proof of (8.4), page 42). We put all the vertices on the +boundary of a disc, and add them in the order given by `isGraphCircuit_self_or_exists_leaf`. A +new vertex goes next to the end of its edge, so the edge fits along the boundary. +-/ + + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Graph GraphMinor GraphMinor.GM09 GraphMinor.Surface + +universe u v + +variable {α : Type u} {β : Type v} + +/-- The order of a list, read by positions. -/ +theorem isClockwise3_ofNodupList_iff (L : List α) (hnd : L.Nodup) (hne : L ≠ []) + {i j k : ℕ} (hi : i < L.length) (hj : j < L.length) (hk : k < L.length) + (hij : i ≠ j) (hik : i ≠ k) (hjk : j ≠ k) : + (CyclicPerm.ofNodupList L hnd hne).IsClockwise3 L[i] L[j] L[k] ↔ + (i < k ∧ i < j ∧ j < k) ∨ (k < i ∧ (j < k ∨ i < j)) := by + have hmem : L[j] ∈ (CyclicPerm.ofNodupList L hnd hne).interval L[i] L[k] ↔ + (CyclicPerm.ofNodupList L hnd hne).IsClockwise3 L[i] L[j] L[k] := by + refine ⟨fun h => h.2, fun h => ⟨⟨List.getElem_mem hj, ?_⟩, h⟩⟩ + rintro (h' | h') + · exact hij (nodup_getElem_inj hnd hj hi h').symm + · exact hjk (nodup_getElem_inj hnd hj hk h') + rw [← hmem] + rcases lt_or_gt_of_ne hik with h | h + · rw [CyclicPerm.ofNodupList_mem_interval_iff L hnd hne h hk hj] + omega + · rw [CyclicPerm.ofNodupList_mem_interval_swap_iff L hnd hne h hi hj] + omega + +/-- Inserting a new element in a list keeps the order of the other elements. -/ +theorem isClockwise3_of_insert (L₁ L₂ : List α) (r : α) (hnd : (L₁ ++ r :: L₂).Nodup) + (hne : L₁ ++ r :: L₂ ≠ []) (hnd' : (L₁ ++ L₂).Nodup) (hne' : L₁ ++ L₂ ≠ []) : + ∀ v₁ v₂ v₃ : α, (CyclicPerm.ofNodupList _ hnd hne).IsClockwise3 v₁ v₂ v₃ → v₁ ≠ r → v₂ ≠ r → + v₃ ≠ r → (CyclicPerm.ofNodupList _ hnd' hne').IsClockwise3 v₁ v₂ v₃ := by + intro v₁ v₂ v₃ h h₁ h₂ h₃ + set A := L₁ ++ L₂ with hA + set B := L₁ ++ r :: L₂ with hB + let f : ℕ → ℕ := fun j => if j < L₁.length then j else j + 1 + have hlen : B.length = A.length + 1 := by simp [hA, hB]; omega + have hf : ∀ j (hj : j < A.length), ∃ h' : f j < B.length, B[f j] = A[j] := by + intro j hj + have hlt : f j < B.length := by + simp only [f] + split_ifs <;> omega + refine ⟨hlt, ?_⟩ + by_cases hjL : j < L₁.length + · simp only [f, hjL, ite_true, hA, hB] + rw [List.getElem_append_left hjL, List.getElem_append_left hjL] + · have hfj : f j = j + 1 := by simp [f, hjL] + simp only [hfj, hA, hB] + rw [List.getElem_append_right (by omega), List.getElem_append_right (by omega)] + have : j + 1 - L₁.length = (j - L₁.length) + 1 := by omega + simp only [this, List.getElem_cons_succ] + have hm := (CyclicPerm.ofNodupList _ hnd hne).isClockwise3_iff.mp h + have hidx : ∀ v, v ∈ B → v ≠ r → ∃ (j : ℕ) (hj : j < A.length), A[j] = v := by + intro v hv hvr + have hvA : v ∈ A := by + simp only [hB, List.mem_append, List.mem_cons] at hv + simp only [hA, List.mem_append] + tauto + obtain ⟨j, hj, rfl⟩ := List.mem_iff_getElem.mp hvA + exact ⟨j, hj, rfl⟩ + obtain ⟨i, hi, rfl⟩ := hidx v₁ hm.2.2.2.1 h₁ + obtain ⟨j, hj, rfl⟩ := hidx v₂ hm.2.2.2.2.1 h₂ + obtain ⟨k, hk, rfl⟩ := hidx v₃ hm.2.2.2.2.2.1 h₃ + have hij : i ≠ j := fun h' => hm.1 (by subst h'; rfl) + have hik : i ≠ k := fun h' => hm.2.1 (by subst h'; rfl) + have hjk : j ≠ k := fun h' => hm.2.2.1 (by subst h'; rfl) + obtain ⟨hi', hfi⟩ := hf i hi + obtain ⟨hj', hfj⟩ := hf j hj + obtain ⟨hk', hfk⟩ := hf k hk + have hmono : ∀ {a b : ℕ}, a < b → f a < f b := by + intro a b hab + simp only [f] + split_ifs <;> omega + have hinj : ∀ {a b : ℕ}, a ≠ b → f a ≠ f b := by + intro a b hab + rcases lt_or_gt_of_ne hab with h' | h' + · exact (hmono h').ne + · exact (hmono h').ne' + rw [← hfi, ← hfj, ← hfk, isClockwise3_ofNodupList_iff B hnd hne hi' hj' hk' (hinj hij) (hinj hik) + (hinj hjk)] at h + rw [isClockwise3_ofNodupList_iff A hnd' hne' hi hj hk hij hik hjk] + have hmono' : ∀ {a b : ℕ}, f a < f b → a < b := by + intro a b hab + by_contra hn + rcases eq_or_lt_of_le (not_lt.mp hn) with h' | h' + · subst h' + exact lt_irrefl _ hab + · exact lt_asymm hab (hmono h') + rcases h with ⟨a, b, c⟩ | ⟨a, b | b⟩ + · exact Or.inl ⟨hmono' a, hmono' b, hmono' c⟩ + · exact Or.inr ⟨hmono' a, Or.inl (hmono' b)⟩ + · exact Or.inr ⟨hmono' a, Or.inr (hmono' b)⟩ + +/-- Consecutive elements of a list have nothing between them. -/ +theorem interval_succ_eq_empty (L : List α) (hnd : L.Nodup) (hne : L ≠ []) {i : ℕ} + (hi : i + 1 < L.length) : + (CyclicPerm.ofNodupList L hnd hne).interval L[i] L[i + 1] = ∅ := by + refine eq_empty_of_forall_notMem fun x hx => ?_ + have hxL : x ∈ L := hx.1.1 + obtain ⟨j, hj, rfl⟩ := List.mem_iff_getElem.mp hxL + have := (CyclicPerm.ofNodupList_mem_interval_iff L hnd hne (Nat.lt_succ_self i) hi hj).mp hx + omega + +/-- The last and first elements of a list have nothing between them. -/ +theorem interval_last_eq_empty (L : List α) (hnd : L.Nodup) (hne : L ≠ []) (h1 : 0 < L.length) + (h2 : 1 < L.length) : + (CyclicPerm.ofNodupList L hnd hne).interval (L[L.length - 1]'(by omega)) L[0] = ∅ := by + refine eq_empty_of_forall_notMem fun x hx => ?_ + have hxL : x ∈ L := hx.1.1 + obtain ⟨j, hj, rfl⟩ := List.mem_iff_getElem.mp hxL + have := (CyclicPerm.ofNodupList_mem_interval_swap_iff L hnd hne (i := 0) (k := L.length - 1) + (by omega) (by omega) hj).mp hx + omega + +/-- `K` has a rural drawing with all its vertices on the boundary of the disc, in the order of the +list `L`. -/ +def BoundaryRural (K : Graph α β) (L : List α) : Prop := + {x | x ∈ L} = V(K) ∧ ∃ (hnd : L.Nodup) (hne : L ≠ []) (N : Neighborhood α β), + N.G = K ∧ N.Ω = CyclicPerm.ofNodupList L hnd hne ∧ N.Ω₀.bar = ∅ ∧ N.IsRural + +/-- A single vertex. -/ +theorem boundaryRural_singleton {K : Graph α β} {v : α} (hV : V(K) = {v}) (hE : E(K) = ∅) : + BoundaryRural K [v] := by + have hnd : [v].Nodup := List.nodup_singleton v + have hne : [v] ≠ [] := by simp + have hbar : {x | x ∈ [v]} = V(K) := by rw [hV]; ext x; simp + let S : Society α β := + { G := K + Ω := CyclicPerm.ofNodupList [v] hnd hne + finite_V := hV ▸ finite_singleton v + finite_E := hE ▸ finite_empty + bar_subset := by rw [CyclicPerm.ofNodupList_bar, hbar] } + have hVS : V(S.G) = {v} := hV + let ν : α → ℂ := fun _ => 1 + have hinj : InjOn ν V(S.G) := by + rw [hVS] + exact injOn_singleton _ _ + obtain ⟨Γ, hU, hν⟩ := GraphDrawing.of_edgeless S.finite_V hE hinj + have hθ : IsValidAngle [v] (fun _ => (0 : ℝ)) := by + refine ⟨fun i j hi hj hij => ?_, fun i hi => ?_⟩ + · simp only [List.length_singleton] at hi hj + omega + · have := Real.pi_pos + linarith + have hbarS : S.Ω.bar = {v} := by + change {x | x ∈ [v]} = {v} + ext x + simp + have hL : S.Ω.IsOrbitList [v] := CyclicPerm.isOrbitList_ofNodupList _ hnd hne + have hball : Γ.drawing.U ⊆ Metric.closedBall (0 : ℂ) 1 := by + rw [hU] + rintro _ ⟨x, -, rfl⟩ + simp [ν] + have hsph : Γ.drawing.U ∩ Metric.sphere (0 : ℂ) 1 = ν '' S.Ω.bar := by + rw [hU, hbarS, hVS] + ext x + simp [ν] + have hr := isRuralSociety_of_complex_disc_drawing S hL hθ hinj + (fun w _ => by simp [ν]) hball hsph hν + obtain ⟨Ω₀, h₀, hΩ₀, hr⟩ := hr + exact ⟨hbar, hnd, hne, _, rfl, rfl, hΩ₀, hr⟩ + +/-- Adding a vertex with no edges. -/ +theorem BoundaryRural.add_vertex {K K' : Graph α β} {L₁ L₂ : List α} {r : α} + (h : BoundaryRural K' (L₁ ++ L₂)) (hVf : V(K).Finite) (hEf : E(K).Finite) (hle : K' ≤ K) + (hr : r ∉ V(K')) (hV : V(K) = insert r V(K')) (hE : E(K) = E(K')) : + BoundaryRural K (L₁ ++ r :: L₂) := by + obtain ⟨hL, hnd, hne, N, hG, hΩ, hΩ₀, hrural⟩ := h + subst hG + have hrL : r ∉ L₁ ++ L₂ := fun h' => hr (hL ▸ h') + have hnd' : (L₁ ++ r :: L₂).Nodup := by + have hp : (L₁ ++ r :: L₂).Perm (r :: (L₁ ++ L₂)) := List.perm_middle + exact hp.nodup_iff.mpr (List.nodup_cons.mpr ⟨hrL, hnd⟩) + have hne' : L₁ ++ r :: L₂ ≠ [] := by simp + have hL' : {x | x ∈ L₁ ++ r :: L₂} = V(K) := by + rw [hV, ← hL] + ext x + simp only [mem_ofPred_eq, List.mem_append, List.mem_cons, mem_insert_iff] + tauto + let N' : Neighborhood α β := + { G := K + Ω := CyclicPerm.ofNodupList _ hnd' hne' + Ω₀ := N.Ω₀ + finite_V := hVf + finite_E := hEf + bar_subset := by rw [CyclicPerm.ofNodupList_bar, hL'] + bar₀_subset := hle.vertexSet_mono.trans' N.bar₀_subset |> fun h => h } + refine ⟨hL', hnd', hne', N', rfl, rfl, hΩ₀, ?_⟩ + refine hrural.add_boundary_vertex rfl hle hr hV hE ?_ ?_ ?_ + · change r ∈ {x | x ∈ L₁ ++ r :: L₂} + simp + · rw [hΩ] + change {x | x ∈ L₁ ++ L₂} = {x | x ∈ L₁ ++ r :: L₂} \ {r} + ext x + simp only [mem_ofPred_eq, List.mem_append, List.mem_cons, mem_sdiff, mem_singleton_iff] + constructor + · intro hx + refine ⟨by tauto, ?_⟩ + rintro rfl + exact hrL (by simpa using hx) + · tauto + · rw [hΩ] + exact isClockwise3_of_insert L₁ L₂ r hnd' hne' hnd hne + +/-- Adding an edge along the boundary. -/ +theorem BoundaryRural.add_edge {K K' : Graph α β} {L : List α} {e : β} {u w : α} + (h : BoundaryRural K' L) (hVf : V(K).Finite) (hEf : E(K).Finite) (hle : K' ≤ K) + (hV : V(K) = V(K')) (hE : E(K) = insert e E(K')) (he : e ∉ E(K')) + (hl : K.IsLink e u w) (huw : u ≠ w) + (hgap : ∀ (hnd : L.Nodup) (hne : L ≠ []), + (CyclicPerm.ofNodupList L hnd hne).interval u w = ∅) : + BoundaryRural K L := by + obtain ⟨hL, hnd, hne, N, hG, hΩ, hΩ₀, hrural⟩ := h + subst hG + have hL' : {x | x ∈ L} = V(K) := hV ▸ hL + let N' : Neighborhood α β := + { G := K + Ω := N.Ω + Ω₀ := N.Ω₀ + finite_V := hVf + finite_E := hEf + bar_subset := hle.vertexSet_mono.trans' N.bar_subset |> fun h => h + bar₀_subset := hle.vertexSet_mono.trans' N.bar₀_subset |> fun h => h } + have hbar : N.Ω.bar = V(N.G) := by rw [hΩ, ← hL]; rfl + refine ⟨hL', hnd, hne, N', rfl, hΩ, hΩ₀, ?_⟩ + refine hrural.add_boundary_edge rfl rfl hle hV hE he hl ?_ ?_ huw ?_ + · rw [hbar, ← hV] + exact hl.left_mem + · rw [hbar, ← hV] + exact hl.right_mem + · rw [hΩ] + exact hgap hnd hne + +/-- Adding a loop. -/ +theorem BoundaryRural.add_loop {K K' : Graph α β} {L : List α} {e : β} {u : α} + (h : BoundaryRural K' L) (hVf : V(K).Finite) (hEf : E(K).Finite) (hle : K' ≤ K) + (hV : V(K) = V(K')) (hE : E(K) = insert e E(K')) (he : e ∉ E(K')) + (hl : K.IsLink e u u) : BoundaryRural K L := by + obtain ⟨hL, hnd, hne, N, hG, hΩ, hΩ₀, hrural⟩ := h + subst hG + have hL' : {x | x ∈ L} = V(K) := hV ▸ hL + let N' : Neighborhood α β := + { G := K + Ω := N.Ω + Ω₀ := N.Ω₀ + finite_V := hVf + finite_E := hEf + bar_subset := hle.vertexSet_mono.trans' N.bar_subset |> fun h => h + bar₀_subset := hle.vertexSet_mono.trans' N.bar₀_subset |> fun h => h } + refine ⟨hL', hnd, hne, N', rfl, hΩ, hΩ₀, ?_⟩ + refine hrural.add_loop rfl rfl hle hV hE he hl (hV ▸ hl.left_mem) ?_ + rw [hΩ₀] + exact fun h => h + +/-- Two subgraphs of `G`, compared by their vertices and edges. -/ +theorem le_of_subset_of_subset {G A B : Graph α β} (hA : A ≤ G) (hB : B ≤ G) + (hV : V(A) ⊆ V(B)) (hE : E(A) ⊆ E(B)) : A ≤ B := by + rw [(Compatible.of_le_le hA hB).le_iff] + exact ⟨hV, hE⟩ + +/-- A path, in its own order. -/ +theorem boundaryRural_path {K : Graph α β} {x y : α} (W : GraphWalk K x y) (hW : W.IsSimple) : + BoundaryRural (walkSubgraph W) W.support := by + induction W with + | nil hv => + refine boundaryRural_singleton ?_ ?_ + · rw [vertexSet_walkSubgraph] + ext a + simp [GraphWalk.support] + · rw [edgeSet_walkSubgraph] + ext a + simp [GraphWalk.edges] + | @cons x z y f hl rest ih => + have hs : (x :: rest.support).Nodup := hW + obtain ⟨hx, hrest⟩ := List.nodup_cons.mp hs + have hih := ih hrest + have hle₀ := walkSubgraph_le rest + let W₂ : GraphWalk K x y := GraphWalk.cons hl rest + have hV₂ : V(walkSubgraph W₂) = insert x V(walkSubgraph rest) := by + rw [vertexSet_walkSubgraph, vertexSet_walkSubgraph] + ext a + simp [W₂, GraphWalk.support] + have hE₂ : E(walkSubgraph W₂) = insert f E(walkSubgraph rest) := by + rw [edgeSet_walkSubgraph, edgeSet_walkSubgraph] + ext a + simp [W₂, GraphWalk.edges] + have hxV : x ∉ V(walkSubgraph rest) := by + rw [vertexSet_walkSubgraph] + exact hx + have hxK : x ∈ V(K) := hl.left_mem + let K₁ := addVertexTo K (walkSubgraph rest) x + have hK₁K : K₁ ≤ K := addVertexTo_le hle₀ hxK + have hK₁₂ : K₁ ≤ walkSubgraph W₂ := by + refine le_of_subset_of_subset hK₁K (walkSubgraph_le W₂) ?_ ?_ + · rw [vertexSet_addVertexTo, hV₂] + · rw [edgeSet_addVertexTo hle₀, hE₂] + exact subset_insert _ _ + have hfin : V(walkSubgraph W₂).Finite := by + rw [vertexSet_walkSubgraph] + exact List.finite_toSet _ + have hfinE : E(walkSubgraph W₂).Finite := by + rw [edgeSet_walkSubgraph] + exact List.finite_toSet _ + have h₁ : BoundaryRural K₁ ([] ++ x :: rest.support) := by + refine BoundaryRural.add_vertex (L₁ := []) (L₂ := rest.support) hih + (hfin.subset hK₁₂.vertexSet_mono) (hfinE.subset hK₁₂.edgeSet_mono) + (le_addVertexTo hle₀) hxV vertexSet_addVertexTo (edgeSet_addVertexTo hle₀) + have hxz : x ≠ z := fun h => hx (h ▸ rest.start_mem_support) + have hfE : f ∉ E(K₁) := by + rw [edgeSet_addVertexTo hle₀, edgeSet_walkSubgraph] + intro hf + have hf' : f ∈ E(walkSubgraph rest) := by rw [edgeSet_walkSubgraph]; exact hf + obtain ⟨p, q, hpq⟩ := (walkSubgraph rest).exists_isLink_of_mem_edgeSet hf' + have hpq' := hpq.mono hle₀ + rcases hpq'.eq_and_eq_or_eq_and_eq hl with ⟨rfl, -⟩ | ⟨-, rfl⟩ + · exact hxV hpq.left_mem + · exact hxV hpq.right_mem + have hlink : (walkSubgraph W₂).IsLink f x z := + (walkSubgraph_isLink W₂).mpr ⟨by simp [W₂, GraphWalk.edges], hl⟩ + refine BoundaryRural.add_edge h₁ hfin hfinE hK₁₂ ?_ ?_ hfE hlink hxz ?_ + · rw [vertexSet_addVertexTo, hV₂] + · rw [edgeSet_addVertexTo hle₀, hE₂] + · intro hnd hne + have hlen : 1 < ([] ++ x :: rest.support).length := by + have : 0 < rest.support.length := List.length_pos_of_mem rest.start_mem_support + simp only [List.nil_append, List.length_cons] + omega + have := interval_succ_eq_empty _ hnd hne (i := 0) hlen + simpa [support_getElem_zero] using this + +/-- A circuit, in its own order. -/ +theorem exists_boundaryRural_of_isCircuit {K : Graph α β} (hC : IsGraphCircuit K K) : + ∃ L, BoundaryRural K L := by + obtain ⟨-, u, W, ⟨hnd, hed⟩, hpos, hVK, hEK⟩ := hC + cases W with + | nil _ => simp [GraphWalk.length, GraphWalk.edges] at hpos + | @cons u x _ f hl W' => + have hs : W'.support.Nodup := by simpa [GraphWalk.support] using hnd + have hf : f ∉ W'.edges := (List.nodup_cons.mp (by simpa [GraphWalk.edges] using hed)).1 + refine ⟨W'.support, ?_⟩ + have hP := boundaryRural_path W' hs + have hle := walkSubgraph_le W' + have huW : u ∈ W'.support := W'.end_mem_support + have hV' : V(K) = V(walkSubgraph W') := by + rw [vertexSet_walkSubgraph, hVK] + ext a + simp only [mem_ofPred_eq, GraphWalk.support_cons, List.mem_cons] + constructor + · rintro (rfl | h) + · exact huW + · exact h + · exact Or.inr + have hE' : E(K) = insert f E(walkSubgraph W') := by + rw [edgeSet_walkSubgraph, hEK] + ext a + simp [GraphWalk.edges] + have hf' : f ∉ E(walkSubgraph W') := by + rw [edgeSet_walkSubgraph] + exact hf + have hVf : V(K).Finite := by rw [hVK]; exact List.finite_toSet _ + have hEf : E(K).Finite := by rw [hEK]; exact List.finite_toSet _ + by_cases hxu : x = u + · subst hxu + exact hP.add_loop hVf hEf hle hV' hE' hf' hl + · refine hP.add_edge hVf hEf hle hV' hE' hf' hl (Ne.symm hxu) ?_ + intro hnd' hne' + have hlen : 1 < W'.support.length := by + by_contra hn + have h1 : W'.support.length = 1 := by + have : 0 < W'.support.length := List.length_pos_of_mem huW + omega + obtain ⟨a, ha⟩ := List.length_eq_one_iff.mp h1 + have hx' : x ∈ W'.support := W'.start_mem_support + rw [ha] at hx' huW + simp only [List.mem_singleton] at hx' huW + exact hxu (hx'.trans huW.symm) + have := interval_last_eq_empty _ hnd' hne' (by omega) hlen + simpa [support_getElem_zero, support_getElem_last] using this + +/-- The circuits of a subgraph are circuits of the graph. -/ +theorem ncard_circuits_le_of_le {K K' : Graph α β} (hV : V(K).Finite) (hE : E(K).Finite) + (hle : K' ≤ K) (hc : {C | IsGraphCircuit K C}.ncard ≤ 1) : + {C | IsGraphCircuit K' C}.ncard ≤ 1 := by + have hfin : {C | IsGraphCircuit K C}.Finite := + (finite_subgraphs hV hE).subset fun _ h => h.1 + have hsub : {C | IsGraphCircuit K' C} ⊆ {C | IsGraphCircuit K C} := fun C hC => + (⟨hC.1.trans hle, hC.2⟩ : IsGraphCircuit K C) + exact (ncard_le_ncard hsub hfin).trans hc + +/-- A finite graph with a vertex and at most one circuit has a rural drawing with all its vertices +on the boundary. -/ +theorem exists_boundaryRural {K : Graph α β} (hV : V(K).Finite) (hE : E(K).Finite) + (hc : {C | IsGraphCircuit K C}.ncard ≤ 1) (hne : V(K).Nonempty) : + ∃ L, BoundaryRural K L := by + classical + induction hn : V(K).ncard using Nat.strong_induction_on generalizing K with + | _ n ih => + have hdel : ∀ r ∈ V(K), V(deleteVertices K {r}).Nonempty → + ∃ L, BoundaryRural (deleteVertices K {r}) L := by + intro r hr hne' + have hle := deleteVertices_le K {r} + refine ih _ ?_ (hV.subset hle.vertexSet_mono) (hE.subset hle.edgeSet_mono) + (ncard_circuits_le_of_le hV hE hle hc) hne' rfl + rw [← hn, vertexSet_deleteVertices] + exact ncard_sdiff_singleton_lt_of_mem hr hV + rcases isGraphCircuit_self_or_exists_leaf hV hE hc hne with hC | ⟨r, hr, hiso | ⟨e, u, hur, hl, + huniq⟩⟩ + · exact exists_boundaryRural_of_isCircuit hC + · have hle := deleteVertices_le K {r} + have hEe : E(K) = E(deleteVertices K {r}) := by + refine subset_antisymm (fun f hf => ?_) hle.edgeSet_mono + obtain ⟨x, y, hxy⟩ := K.exists_isLink_of_mem_edgeSet hf + have hx : x ≠ r := by rintro rfl; exact hiso f y hxy + have hy : y ≠ r := by rintro rfl; exact hiso f x hxy.symm + exact ((deleteVertices_isLink K {r}).mpr ⟨hxy, hx, hy⟩).edge_mem + by_cases hne' : V(deleteVertices K {r}).Nonempty + · obtain ⟨L, hL⟩ := hdel r hr hne' + refine ⟨r :: L, ?_⟩ + refine BoundaryRural.add_vertex (L₁ := []) (L₂ := L) hL hV hE hle (fun h => h.2 rfl) ?_ hEe + rw [vertexSet_deleteVertices, insert_sdiff_singleton, insert_eq_of_mem hr] + · have hVr : V(K) = {r} := by + refine subset_antisymm (fun x hx => ?_) (singleton_subset_iff.mpr hr) + by_contra hxr + exact hne' ⟨x, hx, hxr⟩ + have hE0 : E(K) = ∅ := by + refine eq_empty_of_forall_notMem fun f hf => ?_ + obtain ⟨x, y, hxy⟩ := K.exists_isLink_of_mem_edgeSet hf + have hx : x = r := by + have := hxy.left_mem + rwa [hVr] at this + exact hiso f y (hx ▸ hxy) + exact ⟨[r], boundaryRural_singleton hVr hE0⟩ + · have hle := deleteVertices_le K {r} + have huV : u ∈ V(deleteVertices K {r}) := ⟨hl.right_mem, hur⟩ + obtain ⟨L, hL⟩ := hdel r hr ⟨u, huV⟩ + have huL : u ∈ L := by + have : u ∈ {x | x ∈ L} := hL.1 ▸ huV + exact this + obtain ⟨L₁, L₂, rfl⟩ := List.append_of_mem huL + let K₀ := addVertexTo K (deleteVertices K {r}) r + have hK₀ : K₀ ≤ K := addVertexTo_le hle hr + have hEdel : E(K₀) = E(deleteVertices K {r}) := edgeSet_addVertexTo hle + have h₀ : BoundaryRural K₀ (L₁ ++ u :: r :: L₂) := by + have := BoundaryRural.add_vertex (K := K₀) (L₁ := L₁ ++ [u]) (L₂ := L₂) (r := r) + (by simpa using hL) (hV.subset hK₀.vertexSet_mono) (hE.subset hK₀.edgeSet_mono) + (le_addVertexTo hle) (fun h => h.2 rfl) vertexSet_addVertexTo hEdel + simpa using this + have hVeq : V(K) = V(K₀) := by + rw [vertexSet_addVertexTo, vertexSet_deleteVertices, insert_sdiff_singleton, + insert_eq_of_mem hr] + have heK₀ : e ∉ E(K₀) := by + rw [hEdel] + intro he + obtain ⟨x, y, hxy⟩ := (deleteVertices K {r}).exists_isLink_of_mem_edgeSet he + obtain ⟨-, hx, hy⟩ := (deleteVertices_isLink K {r}).mp hxy + rcases hxy.mono hle |>.eq_and_eq_or_eq_and_eq hl with ⟨rfl, -⟩ | ⟨-, rfl⟩ + · exact hx rfl + · exact hy rfl + have hEins : E(K) = insert e E(K₀) := by + rw [hEdel] + refine subset_antisymm (fun f hf => ?_) (insert_subset hl.edge_mem hle.edgeSet_mono) + obtain ⟨x, y, hxy⟩ := K.exists_isLink_of_mem_edgeSet hf + by_cases hx : x = r + · subst hx + exact Or.inl (huniq f y hxy) + by_cases hy : y = r + · subst hy + exact Or.inl (huniq f x hxy.symm) + exact Or.inr ((deleteVertices_isLink K {r}).mpr ⟨hxy, hx, hy⟩).edge_mem + refine ⟨_, h₀.add_edge hV hE hK₀ hVeq hEins heK₀ hl.symm hur ?_⟩ + intro hnd hne₀ + have hlen : L₁.length + 1 < (L₁ ++ u :: r :: L₂).length := by simp + have := interval_succ_eq_empty _ hnd hne₀ hlen + simpa using this + +/-- **Graph Minors XIV, proof of (8.4), page 42.** "every graph with at most one circuit can be +drawn in the plane with all its vertices +incident with the infinite region" Here the vertices lie +on the boundary of a closed disc that contains the drawing. -/ +theorem exists_boundary_drawing {K : Graph α β} (hV : V(K).Finite) (hE : E(K).Finite) + (hc : {C | IsGraphCircuit K C}.ncard ≤ 1) : + ∃ (Γ : GraphDrawing K EuclideanPlane) (Δ : Set EuclideanPlane), IsClosedDisc Δ ∧ + Γ.drawing.U ⊆ Δ ∧ Γ.drawing.V ⊆ subBd Δ := by + by_cases hne : V(K).Nonempty + · obtain ⟨L, hL, hnd, hne', N, rfl, hΩ, -, Γ, Δ, Δ₀, hΔ, -, hU, hbd, -⟩ := + exists_boundaryRural hV hE hc hne + refine ⟨Γ, Δ, hΔ, fun x hx => (hU hx).1, ?_⟩ + intro x hx + let v := Γ.iso.vertexEquiv.symm ⟨x, hx⟩ + have hv : v.1 ∈ N.Ω.bar := by + rw [hΩ] + change v.1 ∈ {x | x ∈ L} + rw [hL] + exact v.2 + have hsub := (hbd v.1 v.2).mpr hv + apply hsub + refine ⟨v.2, ?_⟩ + simp [v] + · have hVe : V(K) = ∅ := not_nonempty_iff_eq_empty.mp hne + have hEe : E(K) = ∅ := by + refine eq_empty_of_forall_notMem fun f hf => ?_ + obtain ⟨x, y, hxy⟩ := K.exists_isLink_of_mem_edgeSet hf + exact hne ⟨x, hxy.left_mem⟩ + obtain ⟨Γ, hU, hν⟩ := GraphDrawing.of_edgeless (S := EuclideanPlane) hV hEe + (ν := fun _ => 0) (by rw [hVe]; exact injOn_empty _) + refine ⟨Γ, ClosedUnitDisc, ⟨Homeomorph.refl ClosedUnitDisc⟩, ?_, ?_⟩ + · rw [hU, hVe] + simp + · have : Γ.drawing.V ⊆ Γ.drawing.U := Γ.drawing.V_subset_U + rw [hU, hVe, image_empty] at this + exact this.trans (empty_subset _) + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/ForestClaim.lean b/LeanPool/GraphMinor/GM14/ForestClaim.lean new file mode 100644 index 0000000000..527e125334 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/ForestClaim.lean @@ -0,0 +1,742 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.FewCircuits +public import LeanPool.GraphMinor.GM14.RigidGood +public import LeanPool.GraphMinor.GM14.Section8a + +/-! +# Claim (2) of (8.4), the case of a forest + +Let `(A, Ω)` be a member of the segregation. Suppose that `H ∩ A` is a forest. The paper takes a +maximal +forest `B` of `A` with `H ∩ A ⊆ B`, and adds one edge `e` to `B`. The paper's `e` joins the two +sides of +`B` at the vertex `w`, but `B \ w` may have a third side, and then `B + e` need not join `u` and +`v`. + +So we choose `B` with care. Among the good forests, we take one where the side of `u` is as large as +possible (`exists_forest_step` is the exchange that makes this side larger). This needs the fact +that +each leaf of `H ∩ A` is in `ΩBar`, which holds since `H` is rigid. Without it the step fails. For +example, let `ΩBar = {u, v, w}`, let `A` have edges `wu, wv, wt, ut, tv` with `t ∉ ΩBar`, and let +`H ∩ A` be the star `wu, wv, wt`. Then `B` is the star, and `B + e` has no `u`–`v` path off `w` +for either choice of `e`. See the correction to the proof of (8.4) in `corrections/GM14.md`. +-/ + + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Graph GraphMinor GraphMinor.GM09 GraphMinor.Surface GraphMinor.GM11 + +universe u v + +variable {α : Type u} {β : Type v} + +section Walks + +variable {G : Graph α β} + +/-- `x` and `y` are joined by a walk that misses `w`. -/ +def Off (G : Graph α β) (w x y : α) : Prop := ∃ W : GraphWalk G x y, w ∉ W.support + +theorem Off.ne_left {w x y : α} (h : Off G w x y) : x ≠ w := by + obtain ⟨W, hW⟩ := h + rintro rfl + cases W <;> simp [GraphWalk.support] at hW + +theorem Off.symm {w x y : α} (h : Off G w x y) : Off G w y x := by + obtain ⟨W, hW⟩ := h + exact ⟨W.reverse, by rwa [GraphWalk.support_reverse, List.mem_reverse]⟩ + +theorem Off.ne_right {w x y : α} (h : Off G w x y) : y ≠ w := h.symm.ne_left + +theorem Off.trans {w x y z : α} (h : Off G w x y) (h' : Off G w y z) : Off G w x z := by + obtain ⟨W, hW⟩ := h + obtain ⟨W', hW'⟩ := h' + refine ⟨W.append W', fun hm => ?_⟩ + rcases (GraphWalk.mem_support_append W W').mp hm with h₁ | h₁ + · exact hW h₁ + · exact hW' h₁ + +theorem walk_end_mem {x y : α} (W : GraphWalk G x y) : y ∈ V(G) := by + induction W with + | nil h => exact h + | cons _ _ ih => exact ih + +theorem Off.of_link {w x y : α} {e : β} (hl : G.IsLink e x y) (hx : x ≠ w) (hy : y ≠ w) : + Off G w x y := + ⟨.cons hl (.nil hl.right_mem), by + simp only [GraphWalk.support, List.mem_cons, List.not_mem_nil, or_false, not_or] + exact ⟨fun h => hx h.symm, fun h => hy h.symm⟩⟩ + +theorem Off.refl {w x : α} (hx : x ∈ V(G)) (hxw : x ≠ w) : Off G w x x := + ⟨.nil hx, by + simp only [GraphWalk.support, List.mem_singleton] + exact fun h => hxw h.symm⟩ + +/-- A walk off `w` from inside a set to outside has an edge that leaves the set. -/ +theorem exists_exit {K : Set α} {x y : α} (W : GraphWalk G x y) (hx : x ∈ K) (hy : y ∉ K) : + ∃ a b e, G.IsLink e a b ∧ e ∈ W.edges ∧ a ∈ W.support ∧ b ∈ W.support ∧ a ∈ K ∧ b ∉ K := by + induction W with + | nil _ => exact absurd hx hy + | @cons u t b e hl rest ih => + by_cases ht : t ∈ K + · obtain ⟨a', b', e', h₁, h₂, h₃, h₄, h₅, h₆⟩ := ih ht hy + exact ⟨a', b', e', h₁, List.mem_cons_of_mem _ h₂, List.mem_cons_of_mem _ h₃, + List.mem_cons_of_mem _ h₄, h₅, h₆⟩ + · refine ⟨u, t, e, hl, List.mem_cons_self, List.mem_cons_self, List.mem_cons_of_mem _ ?_, hx, + ht⟩ + cases rest <;> simp [GraphWalk.support] + +/-- The last step of a walk to `w`. -/ +theorem exists_last_step {x w : α} (W : GraphWalk G x w) (hx : x ≠ w) : + ∃ z f, G.IsLink f z w ∧ Off G w x z := by + classical + induction W with + | nil _ => exact absurd rfl hx + | @cons u t b e hl rest ih => + by_cases ht : t = b + · subst ht + exact ⟨u, e, hl, Off.refl hl.left_mem hx⟩ + · obtain ⟨z, f, h₁, h₂⟩ := ih ht + exact ⟨z, f, h₁, (Off.of_link hl hx ht).trans h₂⟩ + +/-- An edge of a walk has its ends on the walk. -/ +theorem ends_mem_support {x y : α} (W : GraphWalk G x y) {e : β} (he : e ∈ W.edges) {a b : α} + (hl : G.IsLink e a b) : a ∈ W.support ∧ b ∈ W.support := by + induction W with + | nil _ => simp [GraphWalk.edges] at he + | @cons u t c e' hl' rest ih => + rcases List.mem_cons.mp he with rfl | he' + · have hs : t ∈ rest.support := by cases rest <;> simp [GraphWalk.support] + rcases hl.eq_and_eq_or_eq_and_eq hl' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨List.mem_cons_self, List.mem_cons_of_mem _ hs⟩ + · exact ⟨List.mem_cons_of_mem _ hs, List.mem_cons_self⟩ + · obtain ⟨h₁, h₂⟩ := ih he' + exact ⟨List.mem_cons_of_mem _ h₁, List.mem_cons_of_mem _ h₂⟩ + +/-- A walk whose steps are joined in `G'` gives a walk of `G'`. -/ +theorem walk_lift {G' : Graph α β} (h : ∀ e a b, G.IsLink e a b → Nonempty (GraphWalk G' a b)) + (hV : V(G) ⊆ V(G')) {x y : α} (W : GraphWalk G x y) : Nonempty (GraphWalk G' x y) := by + induction W with + | nil hv => exact ⟨.nil (hV hv)⟩ + | cons hl _ ih => + obtain ⟨W₁⟩ := h _ _ _ hl + obtain ⟨W₂⟩ := ih + exact ⟨W₁.append W₂⟩ + +theorem no_circuit_mono {G₁ G₂ : Graph α β} (hle : G₁ ≤ G₂) (hno : ¬ ∃ C, IsGraphCircuit G₂ C) : + ¬ ∃ C, IsGraphCircuit G₁ C := by + rintro ⟨C, hC, hrest⟩ + exact hno ⟨C, hC.trans hle, hrest⟩ + +/-- A closed walk through `g` gives a walk between the ends of `g`. -/ +theorem exists_split_edge {C : Graph α β} {a b : α} (W : GraphWalk C a b) {g : β} + (hg : g ∈ W.edges) : ∃ p q, C.IsLink g p q ∧ ∃ (W₁ : GraphWalk C a p) (W₂ : GraphWalk C q b), + W.edges = W₁.edges ++ g :: W₂.edges := by + obtain ⟨p, q, h, W₁, W₂, heq⟩ := W.split_at_edge hg + exact ⟨p, q, h, W₁, W₂, by rw [heq, GraphWalk.edges_append, GraphWalk.edges_cons]⟩ + +/-- Adding an edge between two parts of a forest gives a forest. -/ +theorem no_circuit_insert {A : Graph α β} {Z : Set β} {g : β} {x y : α} + (hno : ¬ ∃ C, IsGraphCircuit (A.restrict Z) C) (hl : A.IsLink g x y) + (hnc : IsEmpty (GraphWalk (A.restrict Z) x y)) : + ¬ ∃ C, IsGraphCircuit (A.restrict (insert g Z)) C := by + rintro ⟨C, hle, u, W, ⟨hs, hd⟩, hlen, hV, hE⟩ + have htrans : ∀ {a b : α} (W' : GraphWalk C a b), g ∉ W'.edges → + Nonempty (GraphWalk (A.restrict Z) a b) := by + intro a b W' hg + obtain ⟨W'', -, -⟩ := W'.exists_transfer (G' := A.restrict Z) + (fun e p q he hlk => by + have hl' := hlk.mono hle + refine ⟨(hl'.1.resolve_left ?_), hl'.2⟩ + rintro rfl + exact hg he) + (fun z hz => hle.vertexSet_mono (W'.mem_vertexSet_of_mem_support hz)) + exact ⟨W''⟩ + by_cases hg : g ∈ W.edges + · obtain ⟨p, q, h₁, W₁, W₂, h₂⟩ := exists_split_edge W hg + rw [h₂] at hd + have hd' := (List.nodup_cons.mp (List.nodup_middle.mp hd)).1 + have hg₁ : g ∉ W₁.edges := fun h => hd' (List.mem_append_left _ h) + have hg₂ : g ∉ W₂.edges := fun h => hd' (List.mem_append_right _ h) + obtain ⟨Y⟩ := htrans (W₂.append W₁) (by + rw [GraphWalk.edges_append] + simp [hg₁, hg₂]) + have h₃ := h₁.mono hle + rcases hl.eq_and_eq_or_eq_and_eq h₃.2 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hnc.false Y.reverse + · exact hnc.false Y + · refine hno ⟨C, ?_, u, W, ⟨hs, hd⟩, hlen, hV, hE⟩ + refine ⟨hle.vertexSet_mono, fun e p q hlk => ?_⟩ + have he : e ∈ W.edges := by + have : e ∈ E(C) := hlk.edge_mem + rwa [hE] at this + have hl' := hlk.mono hle + refine ⟨hl'.1.resolve_left ?_, hl'.2⟩ + rintro rfl + exact hg he + +/-- An edge of a forest is a bridge. -/ +theorem not_joined_of_forest {G : Graph α β} {e : β} {x y : α} + (hno : ¬ ∃ C, IsGraphCircuit G C) (hl : G.IsLink e x y) (hxy : x ≠ y) : + IsEmpty (GraphWalk (G.restrict {e}ᶜ) x y) := by + refine ⟨fun W => ?_⟩ + obtain ⟨P, hP, -, hE⟩ := exists_isGraphPathWithEnds_of_walk W + have hP' := hP.mono (restrict_le (G := G)) + have hR := isGraphPathWithEnds_edge hl hxy + refine hno ⟨_, isGraphCircuit_subgraphUnion hP' hR hxy ?_ ?_⟩ + · have hVR : V(walkSubgraph (GraphWalk.cons hl (GraphWalk.nil hl.right_mem))) = {x, y} := by + ext z + simp [vertexSet_walkSubgraph, GraphWalk.support] + rw [hVR] + ext z + constructor + · exact fun h => h.2 + · rintro (rfl | rfl) + · exact ⟨hP.left_mem, Or.inl rfl⟩ + · exact ⟨hP.right_mem, Or.inr rfl⟩ + · refine disjoint_left.mpr fun f hf hf' => ?_ + have hfe : f = e := by + have : f ∈ E(walkSubgraph (GraphWalk.cons hl (GraphWalk.nil hl.right_mem))) := hf' + rw [edgeSet_walkSubgraph] at this + simpa [GraphWalk.edges] using this + have h₁ : f ∈ E(G.restrict {e}ᶜ) := hP.1.edgeSet_mono hf + exact ((edgeSet_restrict _ _).subset h₁).2 hfe + +end Walks + +section Forest + +variable {A F P : Graph α β} + +/-- `Z` is the edge set of a spanning forest of `A` that includes `F`. -/ +structure GoodForest (A F : Graph α β) (Z : Set β) : Prop where + hF : E(F) ⊆ Z + hZ : Z ⊆ E(A) + forest : ¬ ∃ C, IsGraphCircuit (A.restrict Z) C + conn : ∀ e a b, A.IsLink e a b → Nonempty (GraphWalk (A.restrict Z) a b) + +theorem GoodForest.vertexSet {Z : Set β} : V(A.restrict Z) = V(A) := rfl + +theorem GoodForest.walk {Z : Set β} (h : GoodForest A F Z) {a b : α} (W : GraphWalk A a b) : + Nonempty (GraphWalk (A.restrict Z) a b) := + walk_lift h.conn Subset.rfl W + +theorem le_restrict {Z : Set β} (hF : F ≤ A) (hZ : E(F) ⊆ Z) : F ≤ A.restrict Z := + ⟨hF.vertexSet_mono, fun _ _ _ hl => ⟨hZ hl.edge_mem, hl.mono hF⟩⟩ + +/-- A circuit whose edges are in a subgraph is a circuit of the subgraph. -/ +theorem no_circuit_restrict (hF : F ≤ A) (hno : ¬ ∃ C, IsGraphCircuit F C) : + ¬ ∃ C, IsGraphCircuit (A.restrict E(F)) C := by + rintro ⟨C, hle, u, W, hs, hlen, hV, hE⟩ + have hlink : ∀ {e x y}, C.IsLink e x y → F.IsLink e x y := by + intro e x y hl + have hl' := hl.mono hle + exact (hF.isLink_iff hl'.1).mpr hl'.2 + have hmem : ∀ {a b : α} (W' : GraphWalk C a b), 0 < W'.length → ∀ x ∈ W'.support, x ∈ V(F) := by + intro a b W' hl + induction W' with + | nil _ => simp [GraphWalk.length, GraphWalk.edges] at hl + | @cons p t c e hlk rest ih => + intro x hx + rcases List.mem_cons.mp hx with rfl | hx + · exact (hlink hlk).left_mem + · cases rest with + | nil _ => + simp only [GraphWalk.support, List.mem_singleton] at hx + subst hx + exact (hlink hlk).right_mem + | cons h' r' => + exact ih (by simp [GraphWalk.length, GraphWalk.edges]) x hx + refine hno ⟨C, ⟨?_, fun e x y hl => hlink hl⟩, u, W, hs, hlen, hV, hE⟩ + intro x hx + exact hmem W hlen x (hV.subset hx) + +/-- There is a good forest. -/ +theorem exists_goodForest (hF : F ≤ A) (hE : E(A).Finite) (hno : ¬ ∃ C, IsGraphCircuit F C) : + ∃ Z, GoodForest A F Z := by + classical + let 𝓕 : Set (Set β) := {Z | E(F) ⊆ Z ∧ Z ⊆ E(A) ∧ ¬ ∃ C, IsGraphCircuit (A.restrict Z) C} + have hfin : 𝓕.Finite := hE.finite_subsets.subset fun Z h => h.2.1 + have hne : 𝓕.Nonempty := ⟨E(F), Subset.rfl, hF.edgeSet_mono, no_circuit_restrict hF hno⟩ + obtain ⟨Z, ⟨h₁, h₂, h₃⟩, hmax⟩ := Set.exists_max_image 𝓕 ncard hfin hne + refine ⟨Z, h₁, h₂, h₃, fun e a b hl => ?_⟩ + by_contra hnc + have hnc' : IsEmpty (GraphWalk (A.restrict Z) a b) := not_nonempty_iff.mp hnc + have heZ : e ∉ Z := fun heZ => hnc ⟨.cons ⟨heZ, hl⟩ (.nil hl.right_mem)⟩ + have hin : insert e Z ∈ 𝓕 := ⟨h₁.trans (subset_insert _ _), insert_subset hl.edge_mem h₂, + no_circuit_insert h₃ hl hnc'⟩ + have := hmax _ hin + rw [ncard_insert_of_notMem heZ (hE.subset h₂)] at this + omega + +/-- The exchange step. Take a good forest `B` with a path `P` that goes from `u` through `w` to `v`. +Let `g` be an edge from the side `K` of `u` in `B - w` to a side that has neither `u` nor `v`. +Remove the +edge from that side to `w`, and add `g`. The result is good, it holds `P`, and the side of `u` is +larger. -/ +theorem exists_forest_step {S₀ : Set α} {Z : Set β} (hF : F ≤ A) (hgf : GoodForest A F Z) + (hno : ¬ ∃ C, IsGraphCircuit F C) (hVf : V(A).Finite) + (hleaf : ∀ t ∈ V(F), t ∉ S₀ → ∀ e, F.Inc e t → ∃ e', e' ≠ e ∧ F.Inc e' t) + (hPA : P ≤ A) (hPZ : E(P) ⊆ Z) {u v w x y : α} {g : β} (W₁ : GraphWalk P u w) + (hside : ∀ p ∈ V(P), p ≠ w → Off (A.restrict Z) w u p ∨ Off (A.restrict Z) w v p) + (hxu : Off (A.restrict Z) w u x) (hl : A.IsLink g x y) (hyw : y ≠ w) + (hyu : ¬ Off (A.restrict Z) w u y) (hyv : ¬ Off (A.restrict Z) w y v) + (hKbar : ∀ t, Off (A.restrict Z) w y t → t ∉ S₀) : + ∃ Z', GoodForest A F Z' ∧ E(P) ⊆ Z' ∧ + {t | Off (A.restrict Z) w u t} ⊂ {t | Off (A.restrict Z') w u t} := by + classical + set B := A.restrict Z with hB + have hPB : P ≤ B := le_restrict hPA hPZ + have hxw : x ≠ w := hxu.ne_right + -- The side of `y`. + obtain ⟨W₀⟩ : Nonempty (GraphWalk B y w) := by + obtain ⟨W₁'⟩ := hgf.conn g y x hl.symm + obtain ⟨W₂', -⟩ := hxu.symm + obtain ⟨W₃', -, -⟩ := exists_walk_up_of_le hPB W₁ + exact ⟨(W₁'.append W₂').append W₃'⟩ + obtain ⟨z, f, hfz, hyz⟩ := exists_last_step W₀ hyw + have hzw : z ≠ w := hyz.ne_right + have hfZ : f ∈ Z := hfz.1 + -- Each edge of `B` that leaves the side of `y` goes to `w`. + have hstay : ∀ e p q, B.IsLink e p q → Off B w y p → q ≠ w → Off B w y q := fun e p q h hp hq => + hp.trans (Off.of_link h hp.ne_right hq) + -- The side of `y` holds a leaf of `F` if `f` is an edge of `F`. + have hfF : f ∉ E(F) := by + intro hfF + let K₁ : Set α := {t | Off B w y t} ∪ {w} + let F₁ : Graph α β := F.induce (V(F) ∩ K₁) + have hF₁F : F₁ ≤ F := induce_le inter_subset_left + have hfl : F.IsLink f z w := (hF.isLink_iff hfF).mpr hfz.2 + have hfl₁ : F₁.IsLink f z w := ⟨hfl, ⟨hfl.left_mem, Or.inl hyz⟩, ⟨hfl.right_mem, Or.inr rfl⟩⟩ + have hno₁ := no_circuit_mono hF₁F hno + have hVF₁ : V(F₁).Finite := (hVf.subset hF.vertexSet_mono).subset inter_subset_left + obtain ⟨Q, a, b, hQ, hab, hmax⟩ := exists_longest_path hVF₁ hno₁ ⟨f, hfl₁.edge_mem⟩ + -- One end of `Q` is off `w`. + have key : ∀ {Q : Graph α β} {a b : α}, IsGraphPathWithEnds F₁ Q a b → a ≠ b → a ≠ w → + (∀ (Q' : Graph α β) (a' b' : α), IsGraphPathWithEnds F₁ Q' a' b' → + V(Q').ncard ≤ V(Q).ncard) → False := by + intro Q a b hQ hab haw hmax + have haK : a ∈ V(F) ∩ K₁ := hQ.left_mem |> hQ.1.vertexSet_mono + have haS : Off B w y a := haK.2.resolve_right haw + obtain ⟨hQle, W, hs, hV, hE⟩ := id hQ + -- The first edge of `Q`. + obtain ⟨e₁, a₁, hl₁, he₁⟩ : ∃ e₁ a₁, Q.IsLink e₁ a a₁ ∧ e₁ ∈ W.edges := by + cases W with + | nil _ => exact absurd rfl hab + | cons h r => exact ⟨_, _, h, List.mem_cons_self⟩ + have hl₁F : F.IsLink e₁ a a₁ := (hl₁.mono hQle).mono hF₁F + obtain ⟨e', hne, a', hl'⟩ := hleaf a haK.1 (hKbar a haS) e₁ ⟨a₁, hl₁F⟩ + have hle' : F₁.IsLink e' a a' := by + refine ⟨hl', haK, hl'.right_mem, ?_⟩ + by_cases ha' : a' = w + · exact Or.inr ha' + · refine Or.inl (hstay e' a a' ?_ haS ha') + exact ⟨hgf.hF hl'.edge_mem, hl'.mono hF⟩ + have he' : e' ∈ E(Q) := mem_edgeSet_of_longest hno₁ hVF₁ hQ hmax hle' + have hQe' : Q.IsLink e' a a' := (hQle.isLink_iff he').mpr hle' + exact hne (Whitney.edge_at_start W hs (hE.subset he') he₁ ⟨_, hQe'⟩ ⟨_, hl₁⟩) + by_cases haw : a = w + · have hbw : b ≠ w := fun h => hab (haw.trans h.symm) + refine key hQ.symm hab.symm hbw fun Q' a' b' h => ?_ + exact hmax Q' a' b' h + · exact key hQ hab haw hmax + -- Edges of `B` other than `f` stay in the side of `y`. + have hbridge : ∀ e p q, B.IsLink e p q → Off B w y p → ¬ Off B w y q → e = f := by + intro e p q hlk hp hq + by_contra hef + have hqw : q = w := by + by_contra hqw + exact hq (hstay e p q hlk hp hqw) + subst hqw + have hpz : Off B q p z := hp.symm.trans hyz + obtain ⟨Wp, hWp⟩ := hpz + have hbr := not_joined_of_forest hgf.forest hlk hp.ne_right + have hW' : ∀ e' ∈ Wp.edges, e' ≠ e := by + rintro e' he' rfl + exact hWp (ends_mem_support Wp he' hlk).2 + obtain ⟨Y, -, -⟩ := Wp.exists_transfer (G' := B.restrict {e}ᶜ) + (fun e' a b he' h => ⟨hW' e' he', h⟩) (fun t ht => Wp.mem_vertexSet_of_mem_support ht) + exact hbr.false (Y.append (.cons ⟨hef ∘ Eq.symm, hfz⟩ (.nil hfz.right_mem))) + -- The new forest. + have hxsplit : ¬ Off B w y x := fun h => hyu (hxu.trans h.symm) + have hgZ : IsEmpty (GraphWalk (A.restrict (Z \ {f})) x y) := by + refine ⟨fun Y => ?_⟩ + obtain ⟨a, b, e, h₁, -, -, -, h₅, h₆⟩ := exists_exit Y.reverse + (show y ∈ {t | Off B w y t} from Off.refl hl.right_mem hyw) hxsplit + have h₂ : (A.restrict (Z \ {f})).IsLink e a b := h₁ + have heZ : e ∈ Z := h₂.1.1 + exact h₂.1.2 (hbridge e a b ⟨heZ, h₂.2⟩ h₅ h₆) + have hforest₀ : ¬ ∃ C, IsGraphCircuit (A.restrict (Z \ {f})) C := + no_circuit_mono (G₂ := B) ⟨le_rfl, fun e a b (h : e ∈ Z \ {f} ∧ A.IsLink e a b) => + (⟨h.1.1, h.2⟩ : e ∈ Z ∧ A.IsLink e a b)⟩ hgf.forest + have hforest := no_circuit_insert hforest₀ hl hgZ + set Z' := insert g (Z \ {f}) with hZ' + set B' := A.restrict Z' with hB' + have hsubZ : ∀ e ∈ Z, e ≠ f → e ∈ Z' := fun e he hef => Or.inr ⟨he, hef⟩ + have hfP : f ∉ E(P) := by + intro hfP + have hlP : P.IsLink f z w := (hPB.isLink_iff hfP).mpr hfz + rcases hside z hlP.left_mem hzw with h | h + · exact hyu (h.trans hyz.symm) + · exact hyv (hyz.trans h.symm) + -- Walks off `w` of `B` are walks of `B'`. + have hoff : ∀ {p q}, Off B w p q → Off B' w p q := by + rintro p q ⟨Wp, hWp⟩ + have hW' : ∀ e' ∈ Wp.edges, e' ≠ f := by + rintro e' he' rfl + exact hWp (ends_mem_support Wp he' hfz).2 + obtain ⟨Y, hs, -⟩ := Wp.exists_transfer (G' := B') + (fun e' a b he' h => ⟨hsubZ e' h.1 (hW' e' he'), h.2⟩) + (fun t ht => Wp.mem_vertexSet_of_mem_support ht) + exact ⟨Y, hs ▸ hWp⟩ + have hPB' : P ≤ B' := le_restrict hPA fun e he => hsubZ e (hPZ he) (fun h => hfP (h ▸ he)) + have hconn : ∀ e a b, A.IsLink e a b → Nonempty (GraphWalk B' a b) := by + have hB'step : ∀ e a b, B.IsLink e a b → Nonempty (GraphWalk B' a b) := by + intro e a b hlk + by_cases hef : e = f + · subst hef + rcases hlk.eq_and_eq_or_eq_and_eq hfz with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · obtain ⟨Y₁, -⟩ := hoff hyz + obtain ⟨Y₂, -⟩ := hoff hxu + obtain ⟨Y₃, -, -⟩ := exists_walk_up_of_le hPB' W₁ + have hg' : B'.IsLink g y x := ⟨mem_insert _ _, hl.symm⟩ + exact ⟨Y₁.reverse.append ((GraphWalk.cons hg' Y₂.reverse).append Y₃)⟩ + · obtain ⟨Y₁, -⟩ := hoff hyz + obtain ⟨Y₂, -⟩ := hoff hxu + obtain ⟨Y₃, -, -⟩ := exists_walk_up_of_le hPB' W₁ + have hg' : B'.IsLink g y x := ⟨mem_insert _ _, hl.symm⟩ + exact ⟨(Y₁.reverse.append ((GraphWalk.cons hg' Y₂.reverse).append Y₃)).reverse⟩ + · exact ⟨.cons ⟨hsubZ e hlk.1 hef, hlk.2⟩ (.nil hlk.2.right_mem)⟩ + intro e a b hlk + obtain ⟨Y⟩ := hgf.conn e a b hlk + exact walk_lift hB'step Subset.rfl Y + refine ⟨Z', ⟨fun e he => hsubZ e (hgf.hF he) (fun h => hfF (h ▸ he)), + insert_subset hl.edge_mem (sdiff_subset.trans hgf.hZ), hforest, hconn⟩, + fun e he => hsubZ e (hPZ he) (fun h => hfP (h ▸ he)), fun t ht => hoff ht, fun hsub => hyu ?_⟩ + have hy' : Off B' w u y := (hoff hxu).trans (Off.of_link ⟨mem_insert _ _, hl⟩ hxw hyw) + exact hsub hy' + +/-- A vertex of a path, off the far end, is joined to the near end by a walk off the far end. -/ +theorem off_of_path {G B R : Graph α β} {a b p : α} (hR : IsGraphPathWithEnds G R a b) + (hle : R ≤ B) (hp : p ∈ V(R)) (hpb : p ≠ b) : Off B b a p := by + obtain ⟨R₁, R₂, hR₁R, -, hR₁, hR₂, -, hcap, -⟩ := hR.exists_split_at hp + obtain ⟨-, W, -, hV, -⟩ := hR₁ + obtain ⟨Y, hs, -⟩ := exists_walk_up_of_le (hR₁R.trans hle) W + refine ⟨Y, fun hb => ?_⟩ + rw [hs] at hb + have h₁ : b ∈ V(R₁) := hV ▸ hb + have h₂ : b ∈ V(R₁) ∩ V(R₂) := ⟨h₁, hR₂.right_mem⟩ + rw [hcap] at h₂ + exact hpb h₂.symm + +private theorem first_subpath_has_two_boundary_vertices + {S₀ : Society α β} {P P₁ P₂ : Graph α β} {u v w : α} + (hu : u ∈ S₀.Ω.bar) (hwbar : w ∈ S₀.Ω.bar) (hwv : w ≠ v) + (hbar : ∀ t ∈ S₀.Ω.bar, t = u ∨ t = v ∨ t = w) + (hP₁ : IsGraphPathWithEnds P P₁ u w) (hP₂ : IsGraphPathWithEnds P P₂ w v) + (hcap : V(P₁) ∩ V(P₂) = {w}) : + V(P₁) ∩ S₀.Ω.bar = {u, w} := by + ext t + constructor + · rintro ⟨h₁, h₂⟩ + rcases hbar t h₂ with rfl | rfl | rfl + · exact Or.inl rfl + · have : t ∈ V(P₁) ∩ V(P₂) := ⟨h₁, hP₂.right_mem⟩ + rw [hcap] at this + exact absurd this.symm hwv + · exact Or.inr rfl + · rintro (rfl | rfl) + · exact ⟨hP₁.left_mem, hu⟩ + · exact ⟨hP₁.right_mem, hwbar⟩ + +private theorem last_subpath_has_two_boundary_vertices + {S₀ : Society α β} {P P₁ P₂ : Graph α β} {u v w : α} + (hv : v ∈ S₀.Ω.bar) (hwbar : w ∈ S₀.Ω.bar) (hwu : w ≠ u) + (hbar : ∀ t ∈ S₀.Ω.bar, t = u ∨ t = v ∨ t = w) + (hP₁ : IsGraphPathWithEnds P P₁ u w) (hP₂ : IsGraphPathWithEnds P P₂ w v) + (hcap : V(P₁) ∩ V(P₂) = {w}) : + V(P₂) ∩ S₀.Ω.bar = {w, v} := by + ext t + constructor + · rintro ⟨h₁, h₂⟩ + rcases hbar t h₂ with rfl | rfl | rfl + · have : t ∈ V(P₁) ∩ V(P₂) := ⟨hP₁.left_mem, h₁⟩ + rw [hcap] at this + exact absurd this.symm hwu + · exact Or.inr rfl + · exact Or.inl rfl + · rintro (rfl | rfl) + · exact ⟨hP₂.left_mem, hwbar⟩ + · exact ⟨hP₂.right_mem, hv⟩ + +private theorem retained_paths_preserve_boundary_pairs + {S₀ : Society α β} {P P₁ P₂ : Graph α β} {u v w : α} + (hbar : ∀ t ∈ S₀.Ω.bar, t = u ∨ t = v ∨ t = w) + (hP₁ : IsGraphPathWithEnds P P₁ u w) (hP₂ : IsGraphPathWithEnds P P₂ w v) + (hbarP₁ : V(P₁) ∩ S₀.Ω.bar = {u, w}) + (hbarP₂ : V(P₂) ∩ S₀.Ω.bar = {w, v}) : + ∀ {G' : Graph α β}, P ≤ G' → (∃ R, IsGraphPathWithEnds G' R u v ∧ V(R) ∩ S₀.Ω.bar = {u, v}) → + (∃ R, IsGraphPathWithEnds G' R v u ∧ V(R) ∩ S₀.Ω.bar = {v, u}) → PreservesBarPaths S₀ G' := by + intro G' hG' h₁ h₂ a ha b hb hab _ + have h₃ : IsGraphPathWithEnds G' P₁ u w := hP₁.mono hG' + have h₄ : IsGraphPathWithEnds G' P₂ w v := hP₂.mono hG' + rcases hbar a ha with rfl | rfl | rfl <;> rcases hbar b hb with rfl | rfl | rfl + · exact absurd rfl hab + · exact h₁ + · exact ⟨P₁, h₃, hbarP₁⟩ + · exact h₂ + · exact absurd rfl hab + · exact ⟨P₂, h₄.symm, by rw [hbarP₂, pair_comm]⟩ + · exact ⟨P₁, h₃.symm, by rw [hbarP₁, pair_comm]⟩ + · exact ⟨P₂, h₄, hbarP₂⟩ + · exact absurd rfl hab + +/-- **Claim (2) of (8.4), when `H ∩ A` is a forest.** -/ +theorem few_circuits_of_forest {S₀ : Society α β} (hF : F ≤ S₀.G) (hBar3 : S₀.Ω.bar.ncard ≤ 3) + (hClaim1 : ∀ A' : Graph α β, A' ≤ S₀.G → S₀.Ω.bar ⊆ V(A') → + F ≤ A' → E(A').Nonempty → PreservesBarPaths S₀ A' → A' = S₀.G) + (hno : ¬ ∃ C, IsGraphCircuit F C) + (hleaf : ∀ t ∈ V(F), t ∉ S₀.Ω.bar → ∀ e, F.Inc e t → ∃ e', e' ≠ e ∧ F.Inc e' t) : + {C : Graph α β | IsGraphCircuit S₀.G C}.ncard ≤ 1 := by + classical + set A := S₀.G with hA + have hbarV : S₀.Ω.bar ⊆ V(A) := S₀.bar_subset + have hVf : V(A).Finite := S₀.finite_V + have hEf : E(A).Finite := S₀.finite_E + obtain ⟨Z₀, hZ₀⟩ := exists_goodForest hF hEf hno + by_cases hZne : Z₀.Nonempty + swap + · -- The case `E(B) = ∅`: every edge of `A` is a loop, and by (1), `|E(A)| ≤ 1`. + have hZe : Z₀ = ∅ := not_nonempty_iff_eq_empty.mp hZne + refine ncard_circuits_le_one_of_ncard_edges_le_one fun g hg g' hg' => ?_ + have hA' : A.restrict {g} = A := by + refine hClaim1 _ restrict_le hbarV (le_restrict hF ?_) ⟨g, ?_⟩ ?_ + · have := hZ₀.hF + rw [hZe] at this + exact this.trans (empty_subset _) + · exact (edgeSet_restrict _ _).superset ⟨hg, rfl⟩ + · rintro u - v - huv ⟨Q, hQ, -⟩ + exfalso + obtain ⟨hle, W, -⟩ := hQ + obtain ⟨Y, -, -⟩ := exists_walk_up_of_le hle W + obtain ⟨Y'⟩ := hZ₀.walk Y + cases Y' with + | nil _ => exact huv rfl + | cons h _ => + have := h.1 + rw [hZe] at this + exact this + have h' : g' ∈ E(A.restrict {g}) := hA'.symm ▸ hg' + exact ((edgeSet_restrict _ _).subset h').2.symm + by_cases hpres : PreservesBarPaths S₀ (A.restrict Z₀) + · have hEne : E(A.restrict Z₀).Nonempty := by + obtain ⟨g, hg⟩ := hZne + exact ⟨g, (edgeSet_restrict _ _).superset ⟨hZ₀.hZ hg, hg⟩⟩ + have hAB := hClaim1 _ restrict_le hbarV (le_restrict hF hZ₀.hF) hEne hpres + refine ncard_circuits_le_one_of_no_circuits ?_ + have := hZ₀.forest + rwa [hAB] at this + -- There are `u, v` joined in `A` but not in `B`. + unfold PreservesBarPaths at hpres + push Not at hpres + obtain ⟨u, hu, v, hv, huv, ⟨Q, hQ, hQbar⟩, hnotB⟩ := hpres + obtain ⟨hQle, WQ, -, hVQ, -⟩ := id hQ + obtain ⟨WQ', hWQs, -⟩ := exists_walk_up_of_le hQle WQ + obtain ⟨Y⟩ := hZ₀.walk WQ' + obtain ⟨P, hP, -, -⟩ := exists_isGraphPathWithEnds_of_walk Y + obtain ⟨w, hwP, hwbar, hwu, hwv⟩ : ∃ w ∈ V(P), w ∈ S₀.Ω.bar ∧ w ≠ u ∧ w ≠ v := by + by_contra hcon + push Not at hcon + refine hnotB P hP ?_ + ext t + constructor + · rintro ⟨h₁, h₂⟩ + by_cases htu : t = u + · exact Or.inl htu + · exact Or.inr (hcon t h₁ h₂ htu) + · rintro (rfl | rfl) + · exact ⟨hP.left_mem, hu⟩ + · exact ⟨hP.right_mem, hv⟩ + have hbar : ∀ t ∈ S₀.Ω.bar, t = u ∨ t = v ∨ t = w := by + have hfinbar : S₀.Ω.bar.Finite := hVf.subset hbarV + have hsub : ({u, v, w} : Set α) ⊆ S₀.Ω.bar := by + rintro t (rfl | rfl | rfl) + · exact hu + · exact hv + · exact hwbar + have hc : ({u, v, w} : Set α).ncard = 3 := by + rw [ncard_insert_of_notMem (by simp [huv, hwu.symm]) (by simp), ncard_pair hwv.symm] + have heq := eq_of_subset_of_ncard_le hsub (by omega) hfinbar + intro t ht + rw [← heq] at ht + exact ht + -- The good forests that hold `P`. + have hPZ₀ : E(P) ⊆ Z₀ := fun e he => ((edgeSet_restrict _ _).subset (hP.1.edgeSet_mono he)).2 + have hPA : IsGraphPathWithEnds A P u v := hP.mono restrict_le + obtain ⟨P₁, P₂, hP₁P, hP₂P, hP₁, hP₂, hun, hcap, -⟩ := hPA.exists_split_at hwP + let 𝓒 : Set (Set β) := {Z | GoodForest A F Z ∧ E(P) ⊆ Z} + have hfin : 𝓒.Finite := hEf.finite_subsets.subset fun Z h => h.1.hZ + obtain ⟨Z, ⟨hgf, hPZ⟩, hmax⟩ := Set.exists_max_image 𝓒 + (fun Z => {t | Off (A.restrict Z) w u t}.ncard) hfin ⟨Z₀, hZ₀, hPZ₀⟩ + set B := A.restrict Z with hB + have hPB : P ≤ B := le_restrict hPA.1 hPZ + have hbarP₁ : V(P₁) ∩ S₀.Ω.bar = {u, w} := by + exact first_subpath_has_two_boundary_vertices (S₀ := S₀) hu hwbar hwv hbar hP₁ hP₂ hcap + have hbarP₂ : V(P₂) ∩ S₀.Ω.bar = {w, v} := by + exact last_subpath_has_two_boundary_vertices (S₀ := S₀) hv hwbar hwu hbar hP₁ hP₂ hcap + have hVPun : V(P) = V(P₁) ∪ V(P₂) := by + rw [← vertexSet_subgraphUnion P P₁ P₂, hun] + have hside : ∀ p ∈ V(P), p ≠ w → Off B w u p ∨ Off B w v p := by + intro p hp hpw + rcases hVPun.subset hp with h | h + · exact Or.inl (off_of_path hP₁ (hP₁P.trans hPB) h hpw) + · exact Or.inr (off_of_path hP₂.symm (hP₂P.trans hPB) h hpw) + -- The cases of a pair of vertices of `ΩBar`. + have hpairs : ∀ {G' : Graph α β}, P ≤ G' → + (∃ R, IsGraphPathWithEnds G' R u v ∧ V(R) ∩ S₀.Ω.bar = {u, v}) → + (∃ R, IsGraphPathWithEnds G' R v u ∧ V(R) ∩ S₀.Ω.bar = {v, u}) → + PreservesBarPaths S₀ G' := by + exact retained_paths_preserve_boundary_pairs (S₀ := S₀) hbar hP₁ hP₂ hbarP₁ hbarP₂ + have hEB : E(B).Nonempty := by + have huE : E(P).Nonempty := by + obtain ⟨-, W, -, -, hE⟩ := hP + cases W with + | nil _ => exact absurd rfl huv + | cons h _ => exact ⟨_, hE.superset (List.mem_cons_self)⟩ + obtain ⟨e, he⟩ := huE + exact ⟨e, hPB.edgeSet_mono he⟩ + by_cases hoff : Off B w u v + · -- The forest `B` keeps all the pairs, so `A = B`. + obtain ⟨X, hX⟩ := hoff + obtain ⟨R, hR, hRV, -⟩ := exists_isGraphPathWithEnds_of_walk X + have hRbar : V(R) ∩ S₀.Ω.bar = {u, v} := by + ext t + constructor + · rintro ⟨h₁, h₂⟩ + rcases hbar t h₂ with rfl | rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + · exact absurd (hRV h₁) hX + · rintro (rfl | rfl) + · exact ⟨hR.left_mem, hu⟩ + · exact ⟨hR.right_mem, hv⟩ + have hp := hpairs hPB ⟨R, hR, hRbar⟩ ⟨R, hR.symm, by rw [hRbar, pair_comm]⟩ + have hAB := hClaim1 _ restrict_le hbarV (le_restrict hF hgf.hF) hEB hp + refine ncard_circuits_le_one_of_no_circuits ?_ + have := hgf.forest + rwa [hAB] at this + -- Take the first edge of the path of `A` that leaves the side of `u`. + have hwQ : w ∉ WQ'.support := by + intro h + have h₁ : w ∈ V(Q) := by + rw [hVQ] + exact (hWQs ▸ h : w ∈ WQ.support) + have h₂ : w ∈ V(Q) ∩ S₀.Ω.bar := ⟨h₁, hwbar⟩ + rw [hQbar] at h₂ + rcases h₂ with h₃ | h₃ + · exact hwu h₃ + · exact hwv h₃ + obtain ⟨a, b, e, hl, -, ha, hb, haK, hbK⟩ := exists_exit WQ' (K := {t | Off B w u t}) + (Off.refl (hbarV hu) hwu.symm) hoff + have hbw : b ≠ w := fun h => hwQ (h ▸ hb) + have haw : a ≠ w := fun h => hwQ (h ▸ ha) + by_cases hbv : Off B w b v + · -- The paper's edge: `B + e` keeps all the pairs, so `A = B + e`. + have hle : B ≤ A.restrict (insert e Z) := + ⟨le_rfl, fun e' p q (h : e' ∈ Z ∧ A.IsLink e' p q) => + (⟨Or.inr h.1, h.2⟩ : e' ∈ insert e Z ∧ A.IsLink e' p q)⟩ + obtain ⟨X₁, hX₁⟩ := id haK + obtain ⟨X₂, hX₂⟩ := hbv + obtain ⟨R₁, hR₁, hR₁V, -⟩ := exists_isGraphPathWithEnds_of_walk X₁ + obtain ⟨R₂, hR₂, hR₂V, -⟩ := exists_isGraphPathWithEnds_of_walk X₂ + have hsub : ∀ {R : Graph α β}, (∀ t ∈ V(R), t ≠ w) → V(R) ∩ S₀.Ω.bar ⊆ {u, v} := by + rintro R hR t ⟨h₁, h₂⟩ + rcases hbar t h₂ with h | h | h + · exact Or.inl h + · exact Or.inr h + · exact absurd h (hR t h₁) + have h₁ : ∀ t ∈ V(R₁), t ≠ w := fun t ht h => hX₁ (h ▸ hR₁V ht) + have h₂ : ∀ t ∈ V(R₂), t ≠ w := fun t ht h => hX₂ (h ▸ hR₂V ht) + have hl' : (A.restrict (insert e Z)).IsLink e a b := ⟨mem_insert _ _, hl⟩ + have hp := hpairs (hPB.trans hle) + (exists_bar_chord_of_link_between_branches hu hv (hR₁.mono hle) (hsub h₁) hl' + (hR₂.mono hle) (hsub h₂)) + (exists_bar_chord_of_link_between_branches hv hu (hR₂.mono hle).symm + (by rw [pair_comm]; exact hsub h₂) hl'.symm (hR₁.mono hle).symm + (by rw [pair_comm]; exact hsub h₁)) + have hEA' : E(A.restrict (insert e Z)).Nonempty := hEB.mono hle.edgeSet_mono + have hAe := hClaim1 _ restrict_le hbarV ((le_restrict hF hgf.hF).trans hle) hEA' hp + have hab : a ≠ b := fun h => hbK (h ▸ haK) + refine ncard_circuits_le_one_of_insert_edge (B := B) (e := e) restrict_le hgf.forest hl hab rfl + ?_ + intro t ht + have ht' : t ∈ E(A.restrict (insert e Z)) := hAe.symm ▸ ht + rcases ((edgeSet_restrict _ _).subset ht').2 with rfl | h + · exact mem_insert _ _ + · exact Or.inr ((edgeSet_restrict _ _).superset ⟨ht, h⟩) + · -- A third side: exchange, and the side of `u` grows. + exfalso + obtain ⟨W₁, -, -, -⟩ : ∃ W₁ : GraphWalk P u w, True ∧ True ∧ True := by + obtain ⟨-, W₁, -⟩ := hP₁ + obtain ⟨Y₁, -, -⟩ := exists_walk_up_of_le hP₁P W₁ + exact ⟨Y₁, trivial, trivial, trivial⟩ + have hKbar : ∀ t, Off B w b t → t ∉ S₀.Ω.bar := by + intro t ht ht' + rcases hbar t ht' with rfl | rfl | rfl + · exact hbK ht.symm + · exact hbv ht + · exact ht.ne_right rfl + obtain ⟨Z', hZ', hPZ', hss⟩ := exists_forest_step (S₀ := S₀.Ω.bar) hF hgf hno hVf hleaf hPA.1 + hPZ + W₁ hside haK hl hbw hbK hbv hKbar + have hfinS : {t | Off (A.restrict Z') w u t}.Finite := hVf.subset fun t ht => by + obtain ⟨X, -⟩ := ht + exact (show t ∈ V(A.restrict Z') from walk_end_mem X) + have hlt := ncard_lt_ncard hss hfinS + exact absurd (hmax Z' ⟨hZ', hPZ'⟩) (not_le.mpr hlt) + +end Forest + +/-- Graph Minors XIV, (8.4), Claim (2) (page 42): +"For each $(A, \Omega) \in \mathscr{S}$ either $A \subseteq H$ or $A$ has at most one circuit." +Proved from Claim (1). If `H ∩ A` has a circuit `C`, three disjoint paths from `V(C)` to `ΩBar` +imply +that `A' = H ∩ A` satisfies the conditions of Claim (1), so `A = H ∩ A`. Otherwise `H ∩ A` is a +forest, +and this is `few_circuits_of_forest`. The hypothesis `hleaf` says that each leaf of `H ∩ A` is in +`ΩBar`; +it follows from the rigidity of `H`, and the claim fails without it. -/ +theorem claim_2_of_8_4 {α : Type u} {β : Type v} + {S₀ : Society α β} {H_inter_A : Graph α β} + (hHA : H_inter_A ≤ S₀.G) + (hBar3 : S₀.Ω.bar.ncard ≤ 3) + (hClaim1 : ∀ A' : Graph α β, A' ≤ S₀.G → S₀.Ω.bar ⊆ V(A') → + H_inter_A ≤ A' → E(A').Nonempty → PreservesBarPaths S₀ A' → A' = S₀.G) + (hCircuit : ∀ C : Graph α β, IsGraphCircuit H_inter_A C → + ∃ (P : Fin 3 → Graph α β) (x y : Fin 3 → α), + (∀ i, IsFromToPathWithEnds H_inter_A (P i) V(C) S₀.Ω.bar (x i) (y i)) ∧ + Pairwise (fun i j => Disjoint V(P i) V(P j))) + (hleaf : ∀ t ∈ V(H_inter_A), t ∉ S₀.Ω.bar → ∀ e, H_inter_A.Inc e t → + ∃ e', e' ≠ e ∧ H_inter_A.Inc e' t) : + S₀.G = H_inter_A ∨ {C : Graph α β | IsGraphCircuit S₀.G C}.ncard ≤ 1 := by + by_cases hcirc : ∃ C : Graph α β, IsGraphCircuit H_inter_A C + · obtain ⟨C, hC⟩ := hcirc + obtain ⟨P, x, y, hP, hDisj⟩ := hCircuit C hC + obtain ⟨hbar, hE, hpres⟩ := + preservesBarPaths_of_three_disjoint_paths_from_circuit hBar3 hC hP hDisj + exact Or.inl (hClaim1 H_inter_A hHA hbar le_rfl hE hpres).symm + · exact Or.inr (few_circuits_of_forest hHA hBar3 hClaim1 hcirc hleaf) + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Form84.lean b/LeanPool/GraphMinor/GM14/Form84.lean new file mode 100644 index 0000000000..c3ea3555e0 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Form84.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.GM14.Section6a +public import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# The form of (8.4) + +`Theorem84DiscStatement` is the statement of XIV (8.4), with the cylinder given as a difference of +discs. `theorem_8_4` in `Section8.lean` proves it. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 + +universe u v w + +/-- Graph Minors XIV, (8.4) (pages 41–42), with the cylinder as a difference of discs. + +The cylinder `Σ` is `D \ discInt D₂`, for closed discs `D₂ ⊆ D` of a connected closed surface `S`, +with `F₁ = discBd D` and `F₂ = discBd D₂`. The circuits `C₁, C₂` bound closed discs `E₁, E₂`, with +`D₂ ⊆ E₂`, `E₂ ⊆ E₁ \ C₁.U` and `E₁ ⊆ D`. So the component of `Σ - U(C₁)` that includes `U(C₂)` is +the part of `E₁ \ C₁.U` in `Σ`. That `H` is a rigid drawing in `Σ` is `IsRigidIn H Σ`, and every +disc +of the arrangement lies in `Σ`. The paths are paths of the graph `H.toGraph`. + +`H` is a subgraph of `N.G` by `η`, and `(N.G, N.Ω, N.Ω₀)` is the neighbourhood `(G_1, Ω_1, Ω_2)`. +The +society `S_G` is `(G, Ω_1)` and `S_G0` is `(G, Ω_0)`. The map `μ` reads a vertex of `V(C₁)` in `N.G` +as a point. The last two lines of the conclusion say that `U(P ∩ H) - {u, v}` is in that component, +for vertices and for edges. `∃ a b` names the ends of `p`. -/ +def Theorem84DiscStatement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] {α : Type u} {β : Type v} + {H C₁ C₂ : Drawing S} {D D₂ E₁ E₂ X : Set S} {pi : ℕ} {N : Neighborhood α β} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + {S_G S₂ S_G0 : Society α β} {μ : α → S} + (P : Fin (2 * pi + 8) → Graph S (Set S)) (η : SpanEmbedding H N.G), + IsClosedSurface S → + IsClosedDisc D → IsClosedDisc D₂ → IsClosedDisc E₁ → IsClosedDisc E₂ → + D₂ ⊆ E₂ → E₂ ⊆ E₁ \ C₁.U → E₁ ⊆ D → + IsRigidIn H (D \ discInt D₂) → + C₁.IsCircuit ∧ C₁.IsSubdrawing H → C₂.IsCircuit ∧ C₂.IsSubdrawing H → + discBd E₁ = C₁.U → discBd E₂ = C₂.U → + pi ≠ 1 → pi ≠ 3 → pi + 4 ≤ regionalDistance H C₂.U C₁.U → + X ⊆ C₁.V → + (∀ i, ∃ x ∈ X, ∃ y ∈ C₂.V, IsGraphPathWithEnds H.toGraph (P i) x y ∧ V(P i) ∩ C₁.V = {x}) → + (Pairwise fun i j => Disjoint V(P i) V(P j)) → + IsThreeSegregation N.G S_seg → + IsSurfaceArrangement S_seg α_disc α_pt → + IsCompatibleWith N.G H η S_seg α_disc α_pt → + (∀ S₀ ∈ S_seg, α_disc S₀ ⊆ D \ discInt D₂) → + IsPullbackPerm S_seg α_pt (discBd D) N.Ω → + IsPullbackPerm S_seg α_pt (discBd D₂) N.Ω₀ → + S_G.IsComposition S₂ N → + S_G0.G = S_G.G → + S_G0.Ω.bar = η.vMap '' C₁.V → + (∀ v ∈ C₁.V, μ (η.vMap v) = v) → + IsNaturalOrderFrom μ S_G0.Ω (discBd E₁) → + (∃ P_set : Set (Graph α β), S_G.IsCrookedTransaction P_set ∧ pi ≤ P_set.ncard) → + ∃ P_set : Set (Graph α β), S_G0.IsCrookedTransaction P_set ∧ pi ≤ P_set.ncard ∧ + S_G0.transactionEnds P_set ⊆ η.vMap '' X ∧ + ∀ p ∈ P_set, ∃ a b : α, S_G0.IsOmegaPathWithEnds p a b ∧ + (∀ v ∈ H.V, η.vMap v ∈ V(p) → η.vMap v = a ∨ η.vMap v = b ∨ v ∈ E₁ \ C₁.U) ∧ + (∀ e ∈ H.E, η.eMap e ∈ E(p) → e ⊆ E₁ \ C₁.U) + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/GraphTransport.lean b/LeanPool/GraphMinor/GM14/GraphTransport.lean new file mode 100644 index 0000000000..e6a6c1205b --- /dev/null +++ b/LeanPool/GraphMinor/GM14/GraphTransport.lean @@ -0,0 +1,170 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Basic +public import LeanPool.GraphMinor.GM11.Defs + +/-! +# Moving paths and circuits along a graph isomorphism + +`GMap G G' f g` says that the maps `f` on vertices and `g` on edges are an isomorphism from `G` to +`G'`. We use total maps, since the maps in hand (`η.vMap` and the maps of a homeomorphism) are +total. +A subgraph `Q` of `G` goes to `GMap.sub`, and paths and circuits go to paths and circuits. +-/ + + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Graph GraphMinor GraphMinor.GM09 GraphMinor.Surface + +universe u v u' v' + +variable {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + +/-- `f` and `g` are an isomorphism from `G` to `G'`. -/ +structure GMap (G : Graph α β) (G' : Graph α' β') (f : α → α') (g : β → β') : Prop where + bijV : BijOn f V(G) V(G') + bijE : BijOn g E(G) E(G') + link : ∀ {e x y}, e ∈ E(G) → x ∈ V(G) → y ∈ V(G) → + (G.IsLink e x y ↔ G'.IsLink (g e) (f x) (f y)) + +variable {G : Graph α β} {G' : Graph α' β'} {f : α → α'} {g : β → β'} + +/-- The inverse of an isomorphism. -/ +theorem GMap.symm [Nonempty α] [Nonempty β] (m : GMap G G' f g) : + GMap G' G (Function.invFunOn f V(G)) (Function.invFunOn g E(G)) := by + have hV := m.bijV.invOn_invFunOn + have hE := m.bijE.invOn_invFunOn + refine ⟨(bijOn_comm hV).mpr m.bijV, (bijOn_comm hE).mpr m.bijE, ?_⟩ + intro e x y he hx hy + have he' := ((bijOn_comm hE).mpr m.bijE).mapsTo he + have hx' := ((bijOn_comm hV).mpr m.bijV).mapsTo hx + have hy' := ((bijOn_comm hV).mpr m.bijV).mapsTo hy + rw [m.link he' hx' hy', hE.2 he, hV.2 hx, hV.2 hy] + +/-- A walk goes to a walk. -/ +theorem exists_walk_image (hl : ∀ {e x y}, G.IsLink e x y → G'.IsLink (g e) (f x) (f y)) + (hv : ∀ x ∈ V(G), f x ∈ V(G')) {a b : α} (W : GraphWalk G a b) : + ∃ W' : GraphWalk G' (f a) (f b), W'.support = W.support.map f ∧ W'.edges = W.edges.map g := by + induction W with + | nil h => exact ⟨.nil (hv _ h), rfl, rfl⟩ + | cons hlink _ ih => + obtain ⟨W', h₁, h₂⟩ := ih + exact ⟨.cons (hl hlink) W', by simp [GraphWalk.support, h₁], by simp [GraphWalk.edges, h₂]⟩ + +/-- The image of a subgraph. -/ +def GMap.sub (_ : GMap G G' f g) (Q : Graph α β) : Graph α' β' := + (G'.induce (f '' V(Q))).restrict (g '' E(Q)) + +theorem mem_of_mem_walk {Q : Graph α β} {a b : α} (W : GraphWalk Q a b) {x : α} + (hx : x ∈ W.support) : x ∈ V(Q) := by + induction W with + | nil h => + simp only [GraphWalk.support, List.mem_singleton] at hx + exact hx ▸ h + | cons hlink _ ih => + simp only [GraphWalk.support, List.mem_cons] at hx + rcases hx with rfl | hx + · exact hlink.left_mem + · exact ih hx + +variable (m : GMap G G' f g) {Q : Graph α β} + +include m in +theorem GMap.image_V_subset (hQ : Q ≤ G) : f '' V(Q) ⊆ V(G') := + (image_mono hQ.vertexSet_mono).trans m.bijV.mapsTo.image_subset + +theorem GMap.sub_le (hQ : Q ≤ G) : m.sub Q ≤ G' := + restrict_le.trans (induce_le (m.image_V_subset hQ)) + +theorem GMap.vertexSet_sub : V(m.sub Q) = f '' V(Q) := rfl + +theorem GMap.sub_isLink (hQ : Q ≤ G) {e x y} (h : Q.IsLink e x y) : + (m.sub Q).IsLink (g e) (f x) (f y) := by + have hG := h.mono hQ + have hl := (m.link hG.edge_mem hG.left_mem hG.right_mem).mp hG + exact ⟨mem_image_of_mem g h.edge_mem, + ⟨hl, mem_image_of_mem f h.left_mem, mem_image_of_mem f h.right_mem⟩⟩ + +theorem GMap.edgeSet_sub (hQ : Q ≤ G) : E(m.sub Q) = g '' E(Q) := by + ext a + constructor + · intro h + exact ((edgeSet_restrict _ _).subset h).2 + · rintro ⟨e, he, rfl⟩ + obtain ⟨x, y, hl⟩ := Q.exists_isLink_of_mem_edgeSet he + exact (m.sub_isLink hQ hl).edge_mem + +/-- The walk of the image of `Q`. -/ +theorem GMap.exists_walk_sub (hQ : Q ≤ G) {a b : α} (W : GraphWalk Q a b) : + ∃ W' : GraphWalk (m.sub Q) (f a) (f b), W'.support = W.support.map f ∧ + W'.edges = W.edges.map g := + exists_walk_image (m.sub_isLink hQ) (fun _ h => mem_image_of_mem f h) W + +/-- A path goes to a path. -/ +theorem GMap.path {a b : α} (hP : IsGraphPathWithEnds G Q a b) : + IsGraphPathWithEnds G' (m.sub Q) (f a) (f b) := by + obtain ⟨hle, W, hs, hV, hE⟩ := hP + obtain ⟨W', h₁, h₂⟩ := m.exists_walk_sub hle W + refine ⟨m.sub_le hle, W', ?_, ?_, ?_⟩ + · change W'.support.Nodup + rw [h₁] + refine hs.map_on fun x hx y hy hxy => ?_ + exact m.bijV.injOn (hle.vertexSet_mono (mem_of_mem_walk W hx)) + (hle.vertexSet_mono (mem_of_mem_walk W hy)) hxy + · rw [m.vertexSet_sub, hV, h₁] + ext x + simp + · rw [m.edgeSet_sub hle, hE, h₂] + ext x + simp + +/-- A circuit goes to a circuit. -/ +theorem GMap.circuit (hC : IsGraphCircuit G Q) : IsGraphCircuit G' (m.sub Q) := by + obtain ⟨hle, u, W, ⟨hs, hd⟩, hlen, hV, hE⟩ := hC + obtain ⟨W', h₁, h₂⟩ := m.exists_walk_sub hle W + have hinjV : ∀ l : List α, (∀ x ∈ l, x ∈ V(Q)) → l.Nodup → (l.map f).Nodup := by + intro l hl hn + refine hn.map_on fun x hx y hy hxy => ?_ + exact m.bijV.injOn (hle.vertexSet_mono (hl x hx)) (hle.vertexSet_mono (hl y hy)) hxy + refine ⟨m.sub_le hle, f u, W', ⟨?_, ?_⟩, ?_, ?_, ?_⟩ + · rw [h₁, ← List.map_tail] + exact hinjV _ (fun x hx => mem_of_mem_walk W (List.mem_of_mem_tail hx)) hs + · rw [h₂] + refine hd.map_on fun x hx y hy hxy => ?_ + have hxE : x ∈ E(Q) := hE ▸ hx + have hyE : y ∈ E(Q) := hE ▸ hy + exact m.bijE.injOn (hle.edgeSet_mono hxE) (hle.edgeSet_mono hyE) hxy + · change 0 < W'.edges.length + rw [h₂, List.length_map] + exact hlen + · rw [m.vertexSet_sub, hV, h₁] + ext x + simp + · rw [m.edgeSet_sub hle, hE, h₂] + ext x + simp + +/-- A path from `X` to `Y` goes to a path from `f(X)` to `f(Y)`. -/ +theorem GMap.fromTo {X Y : Set α} (hX : X ⊆ V(G)) (hY : Y ⊆ V(G)) {a b : α} + (hP : IsFromToPathWithEnds G Q X Y a b) : + IsFromToPathWithEnds G' (m.sub Q) (f '' X) (f '' Y) (f a) (f b) := by + obtain ⟨hp, h₁, h₂⟩ := hP + have hcap : ∀ Z : Set α, Z ⊆ V(G) → f '' V(Q) ∩ f '' Z = f '' (V(Q) ∩ Z) := fun Z hZ => + ((m.bijV.injOn.mono (union_subset hp.1.vertexSet_mono hZ)).image_inter subset_union_left + subset_union_right).symm + refine ⟨m.path hp, ?_, ?_⟩ + · rw [m.vertexSet_sub, hcap X hX, h₁, image_singleton] + · rw [m.vertexSet_sub, hcap Y hY, h₂, image_singleton] + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/NaturalOrderArc.lean b/LeanPool/GraphMinor/GM14/NaturalOrderArc.lean new file mode 100644 index 0000000000..eaf3a6ece5 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/NaturalOrderArc.lean @@ -0,0 +1,162 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# Two consecutive vertices of a natural order + +Let `Ω` be a natural order from an `O`-arc `F`, and let `L ⊆ F` be connected, with `a, b` as its +only +vertices of `ΩBar`. Then `a` and `b` are consecutive: one of the two intervals of `Ω` between them +is +empty (`interval_empty_of_arc`). We use this for an edge of the circuit `C₁` in (8.4). If a path of +a +crooked transaction were such an edge, it would be peripheral. +-/ + + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology GraphMinor GraphMinor.GM09 GraphMinor.Surface Real + +universe u w + +/-- Two points cut the circle into two open arcs. -/ +theorem circle_separates {L : Set Circle} (hL : IsPreconnected L) {p q x y : ℝ} (h₁ : p < x) + (h₂ : x < q) (h₃ : q < y) (h₄ : y < p + 2 * π) (hx : Circle.exp x ∈ L) (hy : Circle.exp y ∈ L) + (hp : Circle.exp p ∉ L) (hq : Circle.exp q ∉ L) : False := by + have hopen := isLocalHomeomorph_circleExp.isOpenMap + have hP : IsOpen (Circle.exp '' Ioo p q) := hopen _ isOpen_Ioo + have hQ : IsOpen (Circle.exp '' Ioo q (p + 2 * π)) := hopen _ isOpen_Ioo + have hpi : 0 < 2 * π := by positivity + have hdis : Disjoint (Circle.exp '' Ioo p q) (Circle.exp '' Ioo q (p + 2 * π)) := by + refine disjoint_left.mpr ?_ + rintro _ ⟨r, ⟨hr₁, hr₂⟩, rfl⟩ ⟨s, ⟨hs₁, hs₂⟩, hs⟩ + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp hs + have hgt : (0 : ℝ) < (m : ℝ) * (2 * π) := by linarith + have hlt : (m : ℝ) * (2 * π) < 1 * (2 * π) := by linarith + have h₅ : (0 : ℝ) < m := (mul_pos_iff_of_pos_right hpi).mp hgt + have h₆ : (m : ℝ) < 1 := lt_of_mul_lt_mul_right hlt hpi.le + have h₇ : 0 < m := by exact_mod_cast h₅ + have h₈ : m < 1 := by exact_mod_cast h₆ + omega + have hcover : L ⊆ Circle.exp '' Ioo p q ∪ Circle.exp '' Ioo q (p + 2 * π) := by + intro z hz + obtain ⟨θ, rfl⟩ : ∃ θ : ℝ, Circle.exp θ = z := ⟨Complex.arg z, Circle.exp_arg z⟩ + let t : ℝ := toIcoMod Real.two_pi_pos p θ + have ht : Circle.exp t = Circle.exp θ := by + refine Circle.exp_eq_exp.mpr ⟨-toIcoDiv Real.two_pi_pos p θ, ?_⟩ + have := self_sub_toIcoDiv_zsmul Real.two_pi_pos p θ + simp only [zsmul_eq_mul] at this + simp only [t, Int.cast_neg, neg_mul, ← this] + ring + obtain ⟨ht₁, ht₂⟩ : t ∈ Ico p (p + 2 * π) := toIcoMod_mem_Ico Real.two_pi_pos p θ + rw [← ht] at hz ⊢ + have hne₁ : t ≠ p := fun h => hp (h ▸ hz) + have hne₂ : t ≠ q := fun h => hq (h ▸ hz) + rcases lt_or_gt_of_ne hne₂ with h | h + · exact Or.inl ⟨t, ⟨lt_of_le_of_ne ht₁ hne₁.symm, h⟩, rfl⟩ + · exact Or.inr ⟨t, ⟨h, ht₂⟩, rfl⟩ + rcases hL.subset_or_subset hP hQ hdis hcover with h | h + · obtain ⟨s, ⟨hs₁, hs₂⟩, hs⟩ := h hy + exact disjoint_left.mp hdis ⟨s, ⟨hs₁, hs₂⟩, hs⟩ ⟨y, ⟨h₃, h₄⟩, rfl⟩ + · obtain ⟨s, ⟨hs₁, hs₂⟩, hs⟩ := h hx + exact disjoint_left.mp hdis ⟨x, ⟨h₁, h₂⟩, rfl⟩ ⟨s, ⟨hs₁, hs₂⟩, hs⟩ + +variable {α : Type u} {S : Type w} [TopologicalSpace S] + +/-- See the module docstring. -/ +theorem interval_empty_of_arc {ν : α → S} {Ω : CyclicPerm α} {F L : Set S} + (hnat : IsNaturalOrderFrom ν Ω F) (hLF : L ⊆ F) (hL : IsPreconnected L) {a b : α} + (ha : ν a ∈ L) (hb : ν b ∈ L) (hoff : ∀ v ∈ Ω.bar, ν v ∈ L → v = a ∨ v = b) : + Ω.interval a b = ∅ ∨ Ω.interval b a = ∅ := by + by_contra hcon + push Not at hcon + obtain ⟨⟨c, hcb, hc⟩, ⟨d, hdb, hd⟩⟩ := hcon + obtain ⟨-, φ, hm, hord⟩ := hnat + obtain ⟨t₁, t₂, t₃, h₁₂, h₂₃, h₃₁, e₁, e₂, e₃⟩ := hord a c b hc + obtain ⟨s₁, s₂, s₃, k₁₂, k₂₃, k₃₁, f₁, f₂, f₃⟩ := hord b d a hd + -- The set `L`, on the circle. + let K : Set F := Subtype.val ⁻¹' L + have hK : IsPreconnected K := by + rw [← IsInducing.subtypeVal.isPreconnected_image] + rwa [Subtype.image_preimage_coe, inter_eq_right.mpr hLF] + let T : Set Circle := φ.symm '' K + have hT : IsPreconnected T := hK.image _ φ.symm.continuous.continuousOn + have hmem : ∀ r : ℝ, Circle.exp r ∈ T ↔ (φ (Circle.exp r)).1 ∈ L := by + intro r + constructor + · rintro ⟨y, hy, hyr⟩ + rw [← hyr, φ.apply_symm_apply] + exact hy + · intro h + exact ⟨φ (Circle.exp r), h, φ.symm_apply_apply _⟩ + have hinj : ∀ {x y : ℝ}, (φ (Circle.exp x)).1 = (φ (Circle.exp y)).1 → + ∃ m : ℤ, x = y + m * (2 * π) := fun h => + Circle.exp_eq_exp.mp (φ.injective (Subtype.ext h)) + obtain ⟨m, hm₁⟩ := hinj (f₁.trans e₃.symm) + obtain ⟨n, hn₁⟩ := hinj (f₃.trans e₁.symm) + have hpi : 0 < 2 * π := by positivity + -- The point of `d`, in the same period as the rest. + set u : ℝ := s₂ - m * (2 * π) with hu + have hexp : Circle.exp u = Circle.exp s₂ := Circle.exp_eq_exp.mpr ⟨-m, by + rw [hu] + push_cast + ring⟩ + have hk : ((n - m : ℤ) : ℝ) = 1 := by + push_cast + have h₅ : (t₃ : ℝ) < t₁ + (n - m) * (2 * π) := by nlinarith + have h₆ : t₁ + ((n : ℝ) - m) * (2 * π) < t₃ + 2 * π := by nlinarith + have h₇ : (0 : ℝ) < ((n : ℝ) - m) * (2 * π) := by nlinarith + have h₈ : ((n : ℝ) - m) * (2 * π) < 2 * (2 * π) := by nlinarith + have h₉ : (0 : ℝ) < (n : ℝ) - m := (mul_pos_iff_of_pos_right hpi).mp h₇ + have h₁₀ : (n : ℝ) - m < 2 := lt_of_mul_lt_mul_right h₈ hpi.le + have i₁ : (0 : ℤ) < n - m := by exact_mod_cast h₉ + have i₂ : n - m < (2 : ℤ) := by exact_mod_cast h₁₀ + have i₃ : n - m = (1 : ℤ) := by omega + exact_mod_cast i₃ + have hk' : (n : ℝ) - m = 1 := by + push_cast at hk + exact hk + have hu₁ : t₃ < u := by + rw [hu] + nlinarith + have hu₂ : u < t₁ + 2 * π := by + rw [hu] + have : s₃ - m * (2 * π) = t₁ + ((n : ℝ) - m) * (2 * π) := by + rw [hn₁] + ring + rw [hk'] at this + linarith + have hcL : Circle.exp t₂ ∉ T := by + rw [hmem, e₂] + intro h + rcases hoff c hcb.1 h with rfl | rfl + · exact hcb.2 (Or.inl rfl) + · exact hcb.2 (Or.inr rfl) + have hdL : Circle.exp u ∉ T := by + rw [hexp, hmem, f₂] + intro h + rcases hoff d hdb.1 h with rfl | rfl + · exact hdb.2 (Or.inr rfl) + · exact hdb.2 (Or.inl rfl) + have hbL : Circle.exp t₃ ∈ T := by + rw [hmem, e₃] + exact hb + have haL : Circle.exp (t₁ + 2 * π) ∈ T := by + rw [Circle.exp_add_two_pi, hmem, e₁] + exact ha + exact circle_separates hT h₂₃ hu₁ hu₂ (by linarith) hbL haL hcL hdL + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/PieceDrawing.lean b/LeanPool/GraphMinor/GM14/PieceDrawing.lean new file mode 100644 index 0000000000..c54f5d56de --- /dev/null +++ b/LeanPool/GraphMinor/GM14/PieceDrawing.lean @@ -0,0 +1,386 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.FewCircuitsDrawing +public import LeanPool.GraphMinor.GM14.RigidPoints +public import LeanPool.GraphMinor.GM14.Section6 +public import LeanPool.GraphMinor.Minor.Basic + +/-! +# Extending a drawing inside one disc of an arrangement + +"Since every graph with at most one circuit can be drawn in the plane with all its vertices incident +with the infinite region, we deduce from (2) and the rigidity of $H$ that for each $(A, \Omega) \in +\mathscr{S}$, the +drawing $H \cap A$ in the disc $\alpha(A, \Omega)$ can be extended to an embedding of $A$ in this +disc, in such a +way that each $v \in \bar{\Omega}$ is represented by the point $\alpha(v)$" (Graph Minors XIV, proof +of (8.4), page +42). We draw `A` in the disc from scratch, and then use (6.4) to move the drawing of `H ∩ A` that we +get onto the given one. +-/ + + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor GraphMinor.GM09 GraphMinor.Surface GraphMinor.GM11 +open GraphMinor.GM14.Whitney + +universe u v w + +variable {α : Type u} {β : Type v} {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- Place a boundary drawing in another disc and prescribe up to three boundary vertices. -/ +theorem place_boundary_drawing {K : Graph α β} (hV : V(K).Finite) + (Y : GraphDrawing K EuclideanPlane) {Δ : Set EuclideanPlane} + (hΔ : IsClosedDisc Δ) (hYU : Y.drawing.U ⊆ Δ) (hYV : Y.drawing.V ⊆ subBd Δ) + {D : Set S} (hD : IsClosedDisc D) {X : Set α} + (hXK : X ⊆ V(K)) (hX : X.ncard ≤ 3) {g : α → S} (hg : InjOn g X) + (hgD : MapsTo g X (discBd D)) : + ∃ Γ : GraphDrawing K S, Γ.drawing.U ⊆ D ∧ Γ.drawing.U ∩ discBd D = g '' X ∧ + ∀ v : V(K), v.1 ∈ X → (Γ.iso.vertexEquiv v).1 = g v.1 := by + classical + have hpt : ∀ v (hv : v ∈ V(K)), vertexPt Y v = (Y.iso.vertexEquiv ⟨v, hv⟩).1 := fun v hv => by + simp [vertexPt, hv] + have hptV : ∀ v ∈ V(K), vertexPt Y v ∈ Y.drawing.V := fun v hv => by + rw [hpt v hv] + exact (Y.iso.vertexEquiv ⟨v, hv⟩).2 + have hptinj : InjOn (vertexPt Y) V(K) := vertexPt_injOn Y + let F : Set EuclideanPlane := vertexPt Y '' X + have hXf : X.Finite := hV.subset hXK + have hFf : F.Finite := hXf.image _ + have hFbd : F ⊆ discBd Δ := by + rintro _ ⟨v, hv, rfl⟩ + rw [← subBd_eq_discBd_plane hΔ] + exact hYV (hptV v (hXK hv)) + have hFc : F.ncard ≤ 3 := (ncard_image_le hXf).trans hX + obtain ⟨Ψ, Ψ', hΨc, -, _, hΨi, hΨD, hΨF, hΨin⟩ := + exists_disc_shrink_map hΔ hFf.isClosed hFbd + obtain ⟨x₀, -⟩ := hD.nonempty_discInt + let g' : EuclideanPlane → S := fun y => + if h : ∃ v ∈ X, vertexPt Y v = y then g h.choose else x₀ + have hg'e : ∀ v ∈ X, g' (vertexPt Y v) = g v := by + intro v hv + have h : ∃ w ∈ X, vertexPt Y w = vertexPt Y v := ⟨v, hv, rfl⟩ + have hs := h.choose_spec + change (if h : ∃ w ∈ X, vertexPt Y w = vertexPt Y v then g h.choose else x₀) = g v + rw [dite_eq_left_of_eq_true (eq_true h), hptinj (hXK hs.1) (hXK hv) hs.2] + have hg'i : InjOn g' F := by + rintro _ ⟨v, hv, rfl⟩ _ ⟨w, hw, rfl⟩ h + rw [hg'e v hv, hg'e w hw] at h + rw [hg hv hw h] + have hg'm : MapsTo g' F (discBd D) := by + rintro _ ⟨v, hv, rfl⟩ + rw [hg'e v hv] + exact hgD hv + obtain ⟨φ, φ', hφ, hφg, -, hφb'⟩ := exists_disc_points hΔ hD hFf hFbd hFc hg'i hg'm + let f : EuclideanPlane → S := fun x => φ (Ψ x) + have hΨm : MapsTo Ψ Δ Δ := fun x hx => hΨD (mem_image_of_mem Ψ hx) + have hfc : ContinuousOn f Δ := hφ.2.2.2.2.1.comp hΨc hΨm + have hfi : InjOn f Δ := fun x hx y hy h => + hΨi hx hy (hφ.injOn (hΨm hx) (hΨm hy) h) + have hUc : IsCompact Y.drawing.U := hΔ.isCompact.of_isClosed_subset Y.drawing.isClosed_U hYU + obtain ⟨Γ, hU, -, hv, -, -, -⟩ := + GM09.GraphDrawing.transportOn Y hUc (hfc.mono hYU) (hfi.mono hYU) + have hfF : ∀ v ∈ X, f (vertexPt Y v) = g v := fun v hv => by + have hm : vertexPt Y v ∈ F := mem_image_of_mem _ hv + change φ (Ψ _) = g v + rw [hΨF _ hm, hφg _ hm] + exact hg'e v hv + refine ⟨Γ, ?_, ?_, fun v hvX => ?_⟩ + · rw [hU] + rintro _ ⟨x, hx, rfl⟩ + exact hφ.1 (hΨm (hYU hx)) + · rw [hU] + refine subset_antisymm ?_ ?_ + · rintro _ ⟨⟨x, hx, rfl⟩, hb⟩ + by_cases hxF : x ∈ F + · obtain ⟨v, hv', rfl⟩ := hxF + exact ⟨v, hv', (hfF v hv').symm⟩ + · have hin := hΨin x ⟨hYU hx, hxF⟩ + have hb' := hφb' hb + rw [show φ' (f x) = Ψ x from hφ.2.2.1 hin.1] at hb' + exact (hin.2 hb').elim + · rintro _ ⟨v, hv', rfl⟩ + refine ⟨⟨vertexPt Y v, ?_, hfF v hv'⟩, hgD hv'⟩ + exact Y.drawing.V_subset_U (hptV v (hXK hv')) + · rw [hv v, ← hpt v.1 v.2] + exact hfF v.1 hvX + +/-- A graph with at most one circuit can be drawn in a closed disc, with at most three chosen +vertices at given points of the boundary, and with nothing else on the boundary. -/ +theorem exists_disc_drawing {K : Graph α β} (hV : V(K).Finite) (hE : E(K).Finite) + (hc : {C | IsGraphCircuit K C}.ncard ≤ 1) {D : Set S} (hD : IsClosedDisc D) {X : Set α} + (hXK : X ⊆ V(K)) (hX : X.ncard ≤ 3) {g : α → S} (hg : InjOn g X) + (hgD : MapsTo g X (discBd D)) : + ∃ Γ : GraphDrawing K S, Γ.drawing.U ⊆ D ∧ Γ.drawing.U ∩ discBd D = g '' X ∧ + ∀ v : V(K), v.1 ∈ X → (Γ.iso.vertexEquiv v).1 = g v.1 := by + classical + obtain ⟨Y, Δ, hΔ, hYU, hYV⟩ := exists_boundary_drawing hV hE hc + exact place_boundary_drawing hV Y hΔ hYU hYV hD hXK hX hg hgD + +/-- The inverse of an isomorphism. -/ +def isoSymm {α' β' α'' β'' : Type*} {G : Graph α' β'} {G' : Graph α'' β''} (ι : Iso G G') : + Iso G' G := + ι.symm + +/-- The composition of two isomorphisms. -/ +def isoTrans {α₁ β₁ α₂ β₂ α₃ β₃ : Type*} {G₁ : Graph α₁ β₁} {G₂ : Graph α₂ β₂} {G₃ : Graph α₃ β₃} + (ι : Iso G₁ G₂) (κ : Iso G₂ G₃) : Iso G₁ G₃ := + ι.trans κ + +omit [T2Space S] in +/-- A `SpanEmbedding` is an isomorphism onto its image. -/ +theorem SpanEmbedding.exists_iso {H : Drawing S} {G : Graph α β} (η : SpanEmbedding H G) : + ∃ ι : Iso H.toGraph η.imageGraph, (∀ v, (ι.vertexEquiv v).1 = η.vMap v.1) ∧ + ∀ e, (ι.edgeEquiv e).1 = η.eMap e.1 := by + classical + let vE : V(H.toGraph) ≃ V(η.imageGraph) := η.bijOn_v.equiv η.vMap + let eE : E(H.toGraph) ≃ E(η.imageGraph) := η.bijOn_e.equiv η.eMap + have hlink : ∀ (e : Set S) (he : e ∈ H.E) (x y : S) (hx : x ∈ H.V) (hy : y ∈ H.V), + H.toGraph.IsLink e x y ↔ η.imageGraph.IsLink (η.eMap e) (η.vMap x) (η.vMap y) := by + intro e he x y hx hy + have hends : ∀ {a b : α} {w : S}, η.imageGraph.IsLink (η.eMap e) a b → w ∈ H.V → + w ∈ closure e → η.vMap w = a ∨ η.vMap w = b := by + intro a b w hab hw hwe + obtain ⟨c, hc⟩ := (η.inc_iff e he w hw).mpr hwe + exact η.imageGraph.eq_or_eq_of_isLink_of_isLink hc hab + constructor + · rintro ⟨-, -, -, hcl⟩ + have hxe : x ∈ closure e := (show x ∈ ({x, y} : Set S) from Or.inl rfl) |> fun h => + (hcl ▸ h : x ∈ closure e ∩ H.V).1 + have hye : y ∈ closure e := (show y ∈ ({x, y} : Set S) from Or.inr rfl) |> fun h => + (hcl ▸ h : y ∈ closure e ∩ H.V).1 + obtain ⟨z, hz⟩ := (η.inc_iff e he x hx).mpr hxe + obtain ⟨w, hw, rfl⟩ := η.bijOn_v.surjOn hz.right_mem + have hwe : w ∈ closure e := (η.inc_iff e he w hw).mp ⟨_, hz.symm⟩ + have hw' : w ∈ ({x, y} : Set S) := hcl ▸ ⟨hwe, hw⟩ + rcases hw' with rfl | rfl + · have hy' := hends hz hy hye + have hyx : y = w := by + rcases hy' with h | h <;> exact η.bijOn_v.injOn hy hx h + rwa [hyx] + · exact hz + · intro h + refine ⟨he, hx, hy, subset_antisymm ?_ ?_⟩ + · rintro w ⟨hwe, hw⟩ + rcases hends h hw hwe with h' | h' + · exact Or.inl (η.bijOn_v.injOn hw hx h') + · exact Or.inr (η.bijOn_v.injOn hw hy h') + · rintro w (rfl | rfl) + · exact ⟨(η.inc_iff e he w hx).mp h.inc_left, hx⟩ + · exact ⟨(η.inc_iff e he w hy).mp h.inc_right, hy⟩ + exact ⟨⟨vE, eE, fun e x y => hlink e.1 e.2 x.1 y.1 x.2 y.2⟩, fun _ => rfl, fun _ => rfl⟩ + +/-- Align a disc drawing of `K` with the prescribed drawing of its subgraph. -/ +theorem extend_piece_drawing {H₁ : Drawing S} {K : Graph α β} (η : SpanEmbedding H₁ K) + {D : Set S} (hD : IsClosedDisc D) (hbdD : subBd D = discBd D) + (hH₁D : H₁.U ⊆ D) (hH₁bd : H₁.U ∩ subBd D ⊆ H₁.V) + {X : Set α} (hXK : X ⊆ V(K)) {g : α → S} (hgD : MapsTo g X (subBd D)) + (hXH : ∀ v ∈ H₁.V, v ∈ subBd D ↔ η.vMap v ∈ X) + (hgH : ∀ v ∈ H₁.V, η.vMap v ∈ X → g (η.vMap v) = v) + (hrigid : ∀ F : Set S, F ⊆ D → IsOArc F → F ∩ H₁.U ⊆ H₁.V → + (F ∩ H₁.V).ncard ≤ 2 → ∃ Δ' : Set S, Δ' ⊆ D ∧ IsDial H₁ F Δ') + (Y : GraphDrawing K S) (hYU : Y.drawing.U ⊆ D) (hYbd : Y.drawing.U ∩ subBd D = g '' X) + (hYg : ∀ v : V(K), v.1 ∈ X → (Y.iso.vertexEquiv v).1 = g v.1) : + ∃ Γ : GraphDrawing K S, Γ.drawing.U ⊆ D ∧ Γ.drawing.U ∩ subBd D = g '' X ∧ + (∀ v : V(K), v.1 ∈ X → (Γ.iso.vertexEquiv v).1 = g v.1) ∧ + (∀ v ∈ H₁.V, graphDrawingVertexSet Γ (η.vMap v) = {v}) ∧ + ∀ e ∈ H₁.E, graphDrawingEdgeSet Γ (η.eMap e) = e := by + classical + obtain ⟨ι, hιv, hιe⟩ := η.exists_iso + obtain ⟨Y₀, -, hY₀U, hY₀s, hY₀v, -, hY₀e, -⟩ := GM09.GraphDrawing.ofSubgraph Y η.imageGraph_le + let φ : Iso H₁.toGraph Y₀.drawing.toGraph := isoTrans ι Y₀.iso + have hle := η.imageGraph_le + have hmem : ∀ v ∈ H₁.V, η.vMap v ∈ V(K) := fun v hv => + hle.vertexSet_mono (η.bijOn_v.mapsTo hv) + have hφv : ∀ v : V(H₁.toGraph), (φ.vertexEquiv v).1 = + (Y.iso.vertexEquiv ⟨η.vMap v.1, hmem v.1 v.2⟩).1 := by + intro v + have h1 : (φ.vertexEquiv v).1 = (Y₀.iso.vertexEquiv (ι.vertexEquiv v)).1 := rfl + rw [h1, hY₀v] + congr 3 + exact hιv v + have hφe : ∀ e : E(H₁.toGraph), (φ.edgeEquiv e).1 = graphDrawingEdgeSet Y (η.eMap e.1) := by + intro e + have h1 : (φ.edgeEquiv e).1 = (Y₀.iso.edgeEquiv (ι.edgeEquiv e)).1 := rfl + have hm : η.eMap e.1 ∈ E(η.imageGraph) := η.bijOn_e.mapsTo e.2 + rw [← hY₀e _ hm, graphDrawingEdgeSet_eq Y₀ hm, h1] + congr 3 + exact Subtype.ext (hιe e) + have hbar : ∀ v (hv : v ∈ H₁.V), v ∈ subBd D → + (Y.iso.vertexEquiv ⟨η.vMap v, hmem v hv⟩).1 = v := by + intro v hv hb + have hX' := (hXH v hv).mp hb + rw [hYg ⟨_, hmem v hv⟩ hX'] + exact hgH v hv hX' + have hY₀V : ∀ x ∈ Y₀.drawing.V, ∃ (v : S) (hv : v ∈ H₁.V), + x = (Y.iso.vertexEquiv ⟨η.vMap v, hmem v hv⟩).1 := by + intro x hx + obtain ⟨v, hv, hw⟩ := η.bijOn_v.surjOn (Y₀.iso.vertexEquiv.symm ⟨x, hx⟩).2 + refine ⟨v, hv, ?_⟩ + have h := hY₀v (Y₀.iso.vertexEquiv.symm ⟨x, hx⟩) + rw [Equiv.apply_symm_apply] at h + refine h.trans ?_ + congr 3 + exact hw.symm + have hYpt : ∀ a (ha : a ∈ X), (Y.iso.vertexEquiv ⟨a, hXK ha⟩).1 = g a := fun a ha => hYg _ ha + have hH₂bd : Y₀.drawing.U ∩ subBd D ⊆ Y₀.drawing.V := by + rintro x ⟨hxU, hxb⟩ + by_contra hxV + obtain ⟨e, he, hxe⟩ := Y₀.drawing.exists_edge_of_mem hxU hxV + have heY : e ∈ Y.drawing.E := hY₀s.2 he + have hx' : x ∈ Y.drawing.U ∩ subBd D := ⟨hY₀U hxU, hxb⟩ + rw [hYbd] at hx' + obtain ⟨a, ha, rfl⟩ := hx' + have hgaV : g a ∈ Y.drawing.V := hYpt a ha ▸ (Y.iso.vertexEquiv ⟨a, hXK ha⟩).2 + exact (heY.2.1 hxe).2 hgaV + have hbdV : H₁.V ∩ subBd D = Y₀.drawing.V ∩ subBd D := by + ext x + constructor + · rintro ⟨hxV, hxb⟩ + have h1 := hφv ⟨x, hxV⟩ + rw [hbar x hxV hxb] at h1 + exact ⟨h1 ▸ (φ.vertexEquiv ⟨x, hxV⟩).2, hxb⟩ + · rintro ⟨hxV, hxb⟩ + obtain ⟨v, hv, rfl⟩ := hY₀V x hxV + have hx' : (Y.iso.vertexEquiv ⟨η.vMap v, hmem v hv⟩).1 ∈ Y.drawing.U ∩ subBd D := + ⟨Y.drawing.V_subset_U (Y.iso.vertexEquiv _).2, hxb⟩ + rw [hYbd] at hx' + obtain ⟨a, ha, hax⟩ := hx' + have hinj : (⟨a, hXK ha⟩ : V(K)) = ⟨η.vMap v, hmem v hv⟩ := by + apply Y.iso.vertexEquiv.injective + apply Subtype.ext + rw [hYpt a ha, hax] + have hav : a = η.vMap v := congrArg Subtype.val hinj + have hvb : v ∈ subBd D := (hXH v hv).mpr (hav ▸ ha) + rw [hbar v hv hvb] + exact ⟨hv, hvb⟩ + have hφbd : ∀ v : V(H₁.toGraph), v.1 ∈ subBd D → (φ.vertexEquiv v).1 = v.1 := fun v hb => by + rw [hφv v] + exact hbar v.1 v.2 hb + obtain ⟨ψ, hψD, hψv, hψe, -, -, -, hψbd⟩ := theorem_6_4_proof hD hbdD hH₁D + (hY₀U.trans hYU) hH₁bd + hH₂bd hbdV φ hφbd hrigid + obtain ⟨x₀, -⟩ := hD.nonempty_discInt + have hSne : Nonempty S := ⟨x₀⟩ + have hUc : IsCompact Y.drawing.U := hD.isCompact.of_isClosed_subset Y.drawing.isClosed_U hYU + obtain ⟨Γ, hU, -, hv, hvs, hes, -⟩ := GM09.GraphDrawing.transportOn Y hUc + ψ.symm.continuous.continuousOn ψ.symm.injective.injOn + have hsymm : ∀ x ∈ subBd D, ψ.symm x = x := fun x hx => by + rw [Homeomorph.symm_apply_eq] + exact (hψbd x hx).symm + refine ⟨Γ, ?_, ?_, ?_, ?_, ?_⟩ + · rw [hU] + rintro _ ⟨y, hy, rfl⟩ + have : y ∈ ψ '' D := by rw [hψD]; exact hYU hy + obtain ⟨z, hz, rfl⟩ := this + simpa using hz + · rw [hU, ← hYbd] + refine subset_antisymm ?_ ?_ + · rintro _ ⟨⟨y, hy, rfl⟩, hb⟩ + have h1 := hψbd _ hb + rw [Homeomorph.apply_symm_apply] at h1 + rw [← h1] + exact ⟨hy, h1 ▸ hb⟩ + · rintro y ⟨hy, hb⟩ + exact ⟨⟨y, hy, hsymm y hb⟩, hb⟩ + · intro v hvX + rw [hv v, hYg v hvX] + exact hsymm _ (hgD hvX) + · intro v hvH + have hk := hmem v hvH + rw [hvs, graphDrawingVertexSet_eq_singleton Y hk, image_singleton, ← hφv ⟨v, hvH⟩, + ← hψv ⟨v, hvH⟩] + simp + · intro e he + rw [hes, ← hφe ⟨e, he⟩, ← hψe ⟨e, he⟩] + simp [image_image] + +/-- **The drawing of one member of the segregation.** Suppose that `H₁` is drawn in the closed disc +`D`, and that it is a subgraph `η(H₁)` of `K`. Suppose that `K = η(H₁)`, or that `K` has at most +one circuit. Then `K` has a drawing in `D` which extends the drawing `H₁`, with the vertices of `X` +at given points of the boundary, and with nothing else on the boundary. -/ +theorem exists_piece_drawing {H₁ : Drawing S} {K : Graph α β} (η : SpanEmbedding H₁ K) + (hV : V(K).Finite) (hE : E(K).Finite) {D : Set S} (hD : IsClosedDisc D) + (hbdD : subBd D = discBd D) (hH₁D : H₁.U ⊆ D) (hH₁bd : H₁.U ∩ subBd D ⊆ H₁.V) + {X : Set α} (hXK : X ⊆ V(K)) (hX : X.ncard ≤ 3) {g : α → S} (hg : InjOn g X) + (hgD : MapsTo g X (subBd D)) (hXH : ∀ v ∈ H₁.V, v ∈ subBd D ↔ η.vMap v ∈ X) + (hgH : ∀ v ∈ H₁.V, η.vMap v ∈ X → g (η.vMap v) = v) + (hrigid : ∀ F : Set S, F ⊆ D → IsOArc F → F ∩ H₁.U ⊆ H₁.V → + (F ∩ H₁.V).ncard ≤ 2 → ∃ Δ' : Set S, Δ' ⊆ D ∧ IsDial H₁ F Δ') + (hc : η.imageGraph = K ∨ {C | IsGraphCircuit K C}.ncard ≤ 1) : + ∃ Γ : GraphDrawing K S, Γ.drawing.U ⊆ D ∧ Γ.drawing.U ∩ subBd D = g '' X ∧ + (∀ v : V(K), v.1 ∈ X → (Γ.iso.vertexEquiv v).1 = g v.1) ∧ + (∀ v ∈ H₁.V, graphDrawingVertexSet Γ (η.vMap v) = {v}) ∧ + ∀ e ∈ H₁.E, graphDrawingEdgeSet Γ (η.eMap e) = e := by + classical + by_cases hK : η.imageGraph = K + · -- Here `K` is `η(H₁)`, so the drawing `H₁` itself is the answer. + have key : ∀ K' : Graph α β, η.imageGraph = K' → ∃ ι : Iso H₁.toGraph K', + (∀ v, (ι.vertexEquiv v).1 = η.vMap v.1) ∧ ∀ e, (ι.edgeEquiv e).1 = η.eMap e.1 := by + rintro _ rfl + exact η.exists_iso + obtain ⟨ι, hιv, hιe⟩ := key K hK + let Γ : GraphDrawing K S := ⟨H₁, isoSymm ι⟩ + have hsv : ∀ (v : α) (hv : v ∈ V(K)), η.vMap (Γ.iso.vertexEquiv ⟨v, hv⟩).1 = v := by + intro v hv + have := hιv (ι.vertexEquiv.symm ⟨v, hv⟩) + rw [Equiv.apply_symm_apply] at this + exact this.symm + have hVeq : V(η.imageGraph) = V(K) := congrArg _ hK + have hEeq : E(η.imageGraph) = E(K) := congrArg _ hK + have hmem : ∀ v ∈ H₁.V, η.vMap v ∈ V(K) := fun v hv => + hVeq.subset (η.bijOn_v.mapsTo hv) + have hsv' : ∀ v (hv : v ∈ H₁.V) (hk : η.vMap v ∈ V(K)), + (Γ.iso.vertexEquiv ⟨η.vMap v, hk⟩).1 = v := by + intro v hv hk + exact η.bijOn_v.injOn (Γ.iso.vertexEquiv ⟨η.vMap v, hk⟩).2 hv (hsv _ hk) + refine ⟨Γ, hH₁D, ?_, ?_, ?_, ?_⟩ + · refine subset_antisymm ?_ ?_ + · rintro x ⟨hxU, hxb⟩ + have hxV := hH₁bd ⟨hxU, hxb⟩ + have hxX := (hXH x hxV).mp hxb + exact ⟨_, hxX, hgH x hxV hxX⟩ + · rintro _ ⟨a, ha, rfl⟩ + have haV : a ∈ V(η.imageGraph) := hVeq.superset (hXK ha) + obtain ⟨v, hv, rfl⟩ := η.bijOn_v.surjOn haV + rw [hgH v hv ha] + exact ⟨H₁.V_subset_U hv, (hXH v hv).mpr ha⟩ + · intro v hvX + have h := hsv v.1 v.2 + have hx : (Γ.iso.vertexEquiv v).1 ∈ H₁.V := (Γ.iso.vertexEquiv v).2 + have h' := hgH _ hx (by rw [h]; exact hvX) + rw [h] at h' + exact h'.symm + · intro v hv + ext x + simp only [graphDrawingVertexSet, mem_ofPred_eq, mem_singleton_iff] + constructor + · rintro ⟨hk, rfl⟩ + exact hsv' v hv hk + · rintro rfl + exact ⟨hmem x hv, hsv' x hv _⟩ + · intro e he + have hk : η.eMap e ∈ E(K) := hEeq.subset (η.bijOn_e.mapsTo he) + rw [graphDrawingEdgeSet_eq Γ hk] + have h1 := hιe (ι.edgeEquiv.symm ⟨η.eMap e, hk⟩) + rw [Equiv.apply_symm_apply] at h1 + exact η.bijOn_e.injOn (ι.edgeEquiv.symm ⟨η.eMap e, hk⟩).2 he h1.symm + · -- Otherwise we draw `K` from scratch and move the drawing of `η(H₁)` onto `H₁` by (6.4). + have hc' := hc.resolve_left hK + obtain ⟨Y, hYU, hYbd, hYg⟩ := exists_disc_drawing hV hE hc' hD hXK hX hg + (by rw [← hbdD]; exact hgD) + rw [← hbdD] at hYbd + exact extend_piece_drawing η hD hbdD hH₁D hH₁bd hXK hgD hXH hgH hrigid Y hYU hYbd hYg + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/PieceFacts.lean b/LeanPool/GraphMinor/GM14/PieceFacts.lean new file mode 100644 index 0000000000..57697b8897 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/PieceFacts.lean @@ -0,0 +1,279 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.ClaimOneReduction +public import LeanPool.GraphMinor.GM14.RigidDisc +public import LeanPool.GraphMinor.GM16.NestedDiscContainment +public import LeanPool.GraphMinor.GM11.Section810 + +/-! +# The members of the segregation in (8.4) + +"Since every graph with at most one circuit can be drawn in the plane with all its vertices incident +with the infinite region, we deduce from (2) and the rigidity of $H$ that for each $(A, \Omega) \in +\mathscr{S}$, +the drawing $H \cap A$ in the disc $\alpha(A, \Omega)$ can be extended to an embedding of $A$ in +this disc" +(page 42). Here `pieceDrawing` is this sentence, after Claim (2), which is `piece_claim_2`. +-/ + + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor GraphMinor.GM09 GraphMinor.Surface GraphMinor.GM11 + GraphMinor.GM06 GraphMinor.GM16 GraphMinor.GM14.Whitney + +universe u v w + +variable {α : Type u} {β : Type v} {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- A circuit of a drawing, as a graph, is a subdrawing. -/ +theorem exists_circuit_drawing {H : Drawing S} {C : Graph S (Set S)} + (hC : IsGraphCircuit H.toGraph C) : + ∃ R : Drawing S, R.IsCircuit ∧ R.IsSubdrawing H ∧ R.V = V(C) ∧ R.E = E(C) := by + obtain ⟨hle, u, W, hs, hlen, hV, hE⟩ := hC + have hVC : V(C) ⊆ H.V := hle.vertexSet_mono + have hEC : E(C) ⊆ H.E := hle.edgeSet_mono + have hRE : (H.span V(C) E(C)).E = E(C) := by + rw [H.span_E] + exact inter_eq_left.mpr hEC + have hRV : (H.span V(C) E(C)).V = V(C) := by + rw [H.span_V] + refine Subset.antisymm (union_subset inter_subset_left (iUnion₂_subset fun e he => ?_)) + fun x hx => Or.inl ⟨hx, hVC hx⟩ + rintro x ⟨hxe, hxV⟩ + obtain ⟨a, b, hl⟩ := C.exists_isLink_of_mem_edgeSet he.1 + have hl' := hl.mono hle + have hc : closure e ∩ H.V = {a, b} := hl'.2.2.2 + have : x ∈ ({a, b} : Set S) := hc ▸ ⟨hxe, hxV⟩ + rcases this with rfl | rfl + · exact hl.left_mem + · exact hl.right_mem + obtain ⟨W', hs', he'⟩ := W.exists_transfer (G' := (H.span V(C) E(C)).toGraph) + (fun e a b _ hl => by + have hl' := hl.mono hle + refine ⟨hRE.superset hl.edge_mem, hRV.superset hl.left_mem, hRV.superset hl.right_mem, ?_⟩ + have hc : closure e ∩ H.V = {a, b} := hl'.2.2.2 + rw [hRV, ← hc] + ext z + constructor + · exact fun h => ⟨h.1, hVC h.2⟩ + · rintro ⟨h₁, h₂⟩ + have : z ∈ ({a, b} : Set S) := hc ▸ ⟨h₁, h₂⟩ + rcases this with rfl | rfl + · exact ⟨h₁, hl.left_mem⟩ + · exact ⟨h₁, hl.right_mem⟩) + (fun x hx => hRV.superset (W.mem_vertexSet_of_mem_support hx)) + refine ⟨H.span V(C) E(C), ⟨u, W', ?_, ?_, ?_, ?_⟩, ?_, hRV, hRE⟩ + · change W'.support.tail.Nodup ∧ W'.edges.Nodup + rw [hs', he'] + exact hs + · change 0 < W'.edges.length + rw [he'] + exact hlen + · exact hRV.trans (hV.trans (by rw [hs'])) + · exact hRE.trans (hE.trans (by rw [he'])) + · exact ⟨hRV.subset.trans hVC, hRE.subset.trans hEC⟩ + +omit [T2Space S] in +/-- A circuit of a drawing is a circuit of its graph. -/ +theorem isGraphCircuit_of_isCircuit {H R : Drawing S} (hR : R.IsCircuit) (hRH : R.IsSubdrawing H) : + IsGraphCircuit H.toGraph R.toGraph := by + obtain ⟨u, W, hs, hlen, hV, hE⟩ := hR + refine ⟨?_, u, W, hs, hlen, hV, hE⟩ + refine ⟨hRH.1, fun e x y hl => ?_⟩ + refine ⟨hRH.2 hl.edge_mem, hRH.1 hl.left_mem, hRH.1 hl.right_mem, ?_⟩ + rw [← hRH.closure_inter_V hl.edge_mem] + exact hl.2.2.2 + +/-- A drawing that is rigid in `Cyl` is rigid in a closed disc in `Cyl`. -/ +theorem isRigidIn_interSet (hS : IsClosedSurface S) {H : Drawing S} {B Cyl d : Set S} + (hB : IsClosedDisc B) (hCyl : Cyl ⊆ B) (hrig : IsRigidIn H Cyl) (hd : IsClosedDisc d) + (hdCyl : d ⊆ Cyl) (hbd : subBd d ∩ H.U ⊆ H.V) : IsRigidIn (H.interSet d) d := by + have hcl : IsClosed d := hd.isClosed + obtain ⟨hV, hU⟩ := interSet_V_and_U hcl hbd + intro F hFd hF hFn hFc + have hFV : F ∩ (H.interSet d).V = F ∩ H.V := by + rw [hV] + ext x + exact ⟨fun h => ⟨h.1, h.2.1⟩, fun h => ⟨h.1, h.2, hFd h.1⟩⟩ + have hFn' : F ∩ H.U ⊆ H.V := by + rintro x ⟨hx, hxU⟩ + have : x ∈ F ∩ (H.interSet d).U := ⟨hx, hU.superset ⟨hxU, hFd hx⟩⟩ + have := hFn this + rw [hV] at this + exact this.1 + obtain ⟨Δ, hΔCyl, hΔd, hΔb, hor⟩ := hrig F (hFd.trans hdCyl) hF hFn' (hFV ▸ hFc) + have hbdΔ : discBd Δ = F := (IsClosedDisc.subBd_eq_discBd hS hΔd).symm.trans hΔb + have hsub : Δ ⊆ d := closedDisc_subset_of_boundary_subset hB hd hΔd (hdCyl.trans hCyl) + (hΔCyl.trans hCyl) (hbdΔ ▸ hFd) + refine ⟨Δ, hsub, hΔd, hΔb, ?_⟩ + rcases hor with h | ⟨u, v, huv, hcap, hp⟩ + · left + rw [hU] + exact fun x hx => h ⟨hx.1, hx.2.1⟩ + · right + refine ⟨u, v, huv, hFV.trans hcap, ?_⟩ + have heq : (H.interSet d).interSet Δ = H.interSet Δ := by + have hE₁ : ((H.interSet d).interSet Δ).E = (H.interSet Δ).E := by + rw [interSet_E, interSet_E, interSet_E] + ext e + exact ⟨fun h => ⟨h.1.1, h.2⟩, fun h => ⟨⟨h.1, h.2.trans hsub⟩, h.2⟩⟩ + refine Drawing.ext_of_V_E ?_ hE₁ + ext x + rw [GM11.mem_interSet_V_iff hΔd.isClosed, GM11.mem_interSet_V_iff hΔd.isClosed, hV] + exact ⟨fun h => ⟨h.1.1, h.2⟩, fun h => ⟨⟨h.1, hsub h.2⟩, h.2⟩⟩ + rwa [heq] + +omit [T2Space S] in +/-- A span embedding is an isomorphism onto its image. -/ +theorem SpanEmbedding.gmap {H : Drawing S} {G : Graph α β} (η : SpanEmbedding H G) : + GMap H.toGraph η.imageGraph η.vMap η.eMap := by + obtain ⟨ι, hv, he⟩ := η.exists_iso + refine ⟨η.bijOn_v, η.bijOn_e, fun {e x y} hee hx hy => ?_⟩ + have := ι.isLink_iff ⟨e, hee⟩ ⟨x, hx⟩ ⟨y, hy⟩ + rwa [he, hv, hv] at this + +/-- **Claim (2) of (8.4)** for one member of the segregation. -/ +theorem piece_claim_2 {H : Drawing S} {G₁ : Graph α β} {η : SpanEmbedding H G₁} {S₀ : Society α β} + (hone : ClaimOne η S₀) (hS₀G : S₀.G ≤ G₁) {d : Set S} (hd : IsClosedDisc d) + (hbdd : subBd d = discBd d) (η₁ : SpanEmbedding (H.interSet d) S₀.G) + (him : η₁.imageGraph = pieceGraph η S₀.G) (hrig : IsRigidIn (H.interSet d) d) + (h3 : S₀.Ω.bar.ncard ≤ 3) + (hXH : ∀ v ∈ (H.interSet d).V, v ∈ subBd d ↔ η₁.vMap v ∈ S₀.Ω.bar) + (hU : (H.interSet d).U ⊆ d) (hn : (H.interSet d).U ∩ subBd d ⊆ (H.interSet d).V) : + S₀.G = pieceGraph η S₀.G ∨ {C : Graph α β | IsGraphCircuit S₀.G C}.ncard ≤ 1 := by + classical + have : Nonempty S := by + obtain ⟨x, hx⟩ := hd.nonempty_discInt + exact ⟨x⟩ + have m := η₁.gmap + rw [him] at m + have hvm : ∀ v ∈ (H.interSet d).V, η₁.vMap v ∈ V(pieceGraph η S₀.G) := fun v hv + => m.bijV.mapsTo hv + refine claim_2_of_8_4 (pieceGraph_le η hS₀G) h3 hone ?_ ?_ + · intro C hC + have : Nonempty α := by + obtain ⟨-, u, -⟩ := hC + exact ⟨u⟩ + have ms := m.symm + obtain ⟨R, hR, hRH, hRV, -⟩ := exists_circuit_drawing (ms.circuit hC) + obtain ⟨Q, hdis, hQ⟩ := three_paths_of_rigid hd hbdd hU hn hrig hR hRH + have hRV' : η₁.vMap '' R.V = V(C) := by + rw [hRV] + change η₁.vMap '' (Function.invFunOn η₁.vMap (H.interSet d).V '' V(C)) = V(C) + rw [image_image] + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + have h₁ : η₁.vMap (Function.invFunOn η₁.vMap (H.interSet d).V y) = y := + m.bijV.invOn_invFunOn.2 (hC.1.vertexSet_mono hy) + change η₁.vMap (Function.invFunOn η₁.vMap (H.interSet d).V y) ∈ V(C) + rw [h₁] + exact hy + · intro hx + exact ⟨x, hx, m.bijV.invOn_invFunOn.2 (hC.1.vertexSet_mono hx)⟩ + have hend : ∀ i, ∃ x y, IsFromToPathWithEnds (pieceGraph η S₀.G) (m.sub (Q i)) V(C) S₀.Ω.bar + x y := by + intro i + obtain ⟨a, b, hP⟩ := hQ i + have h := m.fromTo hRH.1 inter_subset_left hP + rw [hRV'] at h + refine ⟨_, _, h.1, h.2.1, ?_⟩ + rw [← h.2.2] + ext z + constructor + · rintro ⟨hz, hzb⟩ + obtain ⟨v, hv, rfl⟩ := hz + have hvH : v ∈ (H.interSet d).V := hP.1.1.vertexSet_mono hv + exact ⟨mem_image_of_mem _ hv, v, ⟨hvH, (hXH v hvH).mpr hzb⟩, rfl⟩ + · rintro ⟨hz, v, ⟨hvH, hvb⟩, rfl⟩ + exact ⟨hz, (hXH v hvH).mp hvb⟩ + choose x y hP using hend + refine ⟨fun i => m.sub (Q i), x, y, hP, fun i j hij => ?_⟩ + change Disjoint (η₁.vMap '' V(Q i)) (η₁.vMap '' V(Q j)) + obtain ⟨_, _, hPi⟩ := hQ i + obtain ⟨_, _, hPj⟩ := hQ j + refine disjoint_left.mpr ?_ + rintro _ ⟨a, ha, rfl⟩ ⟨b, hb, hab⟩ + have hab' := m.bijV.injOn (hPj.1.1.vertexSet_mono hb) (hPi.1.1.vertexSet_mono ha) hab + exact disjoint_left.mp (hdis hij) ha (hab' ▸ hb) + · rintro t ht htb e ⟨z, hl⟩ + obtain ⟨v, hv, rfl⟩ := m.bijV.surjOn ht + obtain ⟨g, hg, rfl⟩ := m.bijE.surjOn hl.edge_mem + obtain ⟨y, hy, rfl⟩ := m.bijV.surjOn hl.right_mem + have hl' := (m.link hg hv hy).mpr hl + have hvb : v ∉ subBd d := fun h => htb ((hXH v hv).mp h) + obtain ⟨g', hg', y', hl''⟩ := two_edges_of_rigid hd hbdd hU hn hrig hv hvb ⟨y, hl'⟩ + refine ⟨η₁.eMap g', fun h => hg' (m.bijE.injOn hl''.edge_mem hg h), _, + (m.link hl''.edge_mem hv hl''.right_mem).mp hl''⟩ + +/-- **The sentence on page 42.** Each member of the segregation has a drawing in its disc that +extends +`H ∩ A`. -/ +theorem exists_member_drawing (hS : IsClosedSurface S) {H : Drawing S} {B Cyl : Set S} + (hB : IsClosedDisc B) (hCyl : Cyl ⊆ B) (hrig : IsRigidIn H Cyl) {G₁ : Graph α β} + {η : SpanEmbedding H G₁} {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} + {α_pt : α → S} (hseg : IsThreeSegregation G₁ S_seg) + (harr : IsSurfaceArrangement S_seg α_disc α_pt) + (hcompat : IsCompatibleWith G₁ H η S_seg α_disc α_pt) + (hdiscs : ∀ S₀ ∈ S_seg, α_disc S₀ ⊆ Cyl) {S₀ : Society α β} (hS₀ : S₀ ∈ S_seg) + (hone : ClaimOne η S₀) : + ∃ Γ : GraphDrawing S₀.G S, Γ.drawing.U ⊆ α_disc S₀ ∧ + Γ.drawing.U ∩ subBd (α_disc S₀) = α_pt '' S₀.Ω.bar ∧ + (∀ v : V(S₀.G), v.1 ∈ S₀.Ω.bar → (Γ.iso.vertexEquiv v).1 = α_pt v.1) ∧ + (∀ v ∈ H.V, v ∈ α_disc S₀ → graphDrawingVertexSet Γ (η.vMap v) = {v}) ∧ + ∀ e ∈ H.E, e ⊆ α_disc S₀ → graphDrawingEdgeSet Γ (η.eMap e) = e := by + obtain ⟨hd, hbarpt⟩ := harr.isClosedDisc S₀ hS₀ + have hbdd : subBd (α_disc S₀) = discBd (α_disc S₀) := IsClosedDisc.subBd_eq_discBd hS hd + obtain ⟨η₁, him, hv, he, hbd, hIV, hU, hn, hXH⟩ := + exists_compatible_pieceEmbedding hS₀ (hseg.1.le S₀ hS₀) hd.isClosed hcompat + have hrig₁ := isRigidIn_interSet hS hB hCyl hrig hd (hdiscs S₀ hS₀) hbd + have hc := piece_claim_2 hone (hseg.1.le S₀ hS₀) hd hbdd η₁ him hrig₁ (hseg.2 S₀ hS₀) hXH hU hn + have hc' : η₁.imageGraph = S₀.G ∨ {C : Graph α β | IsGraphCircuit S₀.G C}.ncard ≤ 1 := by + rw [him] + exact hc.imp Eq.symm id + obtain ⟨Γ, h₁, h₂, h₃, h₄, h₅⟩ := exists_piece_drawing η₁ S₀.finite_V S₀.finite_E hd hbdd hU hn + S₀.bar_subset (hseg.2 S₀ hS₀) + (harr.injOn_pts.mono fun x hx => mem_iUnion₂.mpr ⟨S₀, hS₀, hx⟩) hbarpt hXH + (fun v hv' h => by + rw [hIV] at hv' + rw [hv] at h ⊢ + exact hcompat.pt_eq v hv'.1 (mem_iUnion₂.mpr ⟨S₀, hS₀, h⟩)) + hrig₁ hc' + refine ⟨Γ, h₁, h₂, h₃, fun v hv' hvd => ?_, fun e he' hed => ?_⟩ + · have := h₄ v (by rw [hIV]; exact ⟨hv', hvd⟩) + rwa [hv] at this + · have := h₅ e (by rw [interSet_E]; exact ⟨he', hed⟩) + rwa [he] at this + +/-- "It follows that we may assume, to simplify notation, that $G_1$ is a drawing in $\Sigma$" (page +42). -/ +theorem exists_reduced_drawing (hS : IsClosedSurface S) {H : Drawing S} {B Cyl : Set S} + (hB : IsClosedDisc B) (hCyl : Cyl ⊆ B) (hrig : IsRigidIn H Cyl) {G₁ : Graph α β} + {η : SpanEmbedding H G₁} {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} + {α_pt : α → S} (hseg : IsThreeSegregation G₁ S_seg) + (harr : IsSurfaceArrangement S_seg α_disc α_pt) + (hcompat : IsCompatibleWith G₁ H η S_seg α_disc α_pt) + (hdiscs : ∀ S₀ ∈ S_seg, α_disc S₀ ⊆ Cyl) (hone : ∀ S₀ ∈ S_seg, ClaimOne η S₀) : + ∃ (Γ : GraphDrawing G₁ S) (ν : α → S), Γ.drawing.U ⊆ ⋃ S₀ ∈ S_seg, α_disc S₀ ∧ + (∀ v : V(G₁), (Γ.iso.vertexEquiv v).1 = ν v.1) ∧ + (∀ v ∈ segregationVertices S_seg, ν v = α_pt v) ∧ + (∀ v ∈ H.V, ν (η.vMap v) = v) ∧ + (∀ e ∈ H.E, graphDrawingEdgeSet Γ (η.eMap e) = e) ∧ + ∀ v ∈ V(G₁), ∃ S₀ ∈ S_seg, ν v ∈ α_disc S₀ ∧ (ν v ∈ subBd (α_disc S₀) → v ∈ S₀.Ω.bar) := by + classical + choose Γs h₁ h₂ h₃ h₄ h₅ using fun S₀ (h : S₀ ∈ S_seg) => + exists_member_drawing hS hB hCyl hrig hseg harr hcompat hdiscs h (hone S₀ h) + exact exists_drawing_of_compatible_members hseg.1 harr hcompat Γs h₁ h₂ h₃ h₄ h₅ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/RadialAtoms.lean b/LeanPool/GraphMinor/GM14/RadialAtoms.lean new file mode 100644 index 0000000000..1b9467c161 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/RadialAtoms.lean @@ -0,0 +1,68 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM11.Regions + +/-! +# Corresponding atoms in radial drawings + +A radial drawing has one corresponding atom for each atom of the original drawing. +-/ + +public section + +namespace GraphMinor.GM14 + +open Set Surface GM11 + +variable {S : Type*} [TopologicalSpace S] + +/-- Every atom of the original drawing has a unique corresponding +atom in its radial drawing. -/ +theorem existsUnique_correspondingAtom {H K : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) {x : Set S} (hx : x ∈ H.A) : + ∃! x' : Set S, IsCorrespondingAtom H K x x' := by + have hP := hK.2.1 + have hUU : H.U ∩ K.U = H.V := hP.1 + have hVV : H.V ⊆ K.V := hP.2.1 + have huniqR : ∀ r ∈ H.R, ∃! w, w ∈ r ∧ w ∈ K.V := hP.2.2.1 + have hxA := hx + rcases hx with (⟨v, hv, rfl⟩ | hxE) | hxR + · refine ⟨{v}, ⟨hxA, Or.inl (Or.inl ⟨v, hVV hv, rfl⟩), Or.inl ⟨v, hv, rfl, rfl⟩⟩, ?_⟩ + rintro x' ⟨-, -, ⟨u, -, hu, rfl⟩ | ⟨he, -, -⟩ | ⟨hr, -⟩⟩ + · exact hu.symm + · exact absurd hv (he.2.1 (mem_singleton v)).2 + · exact absurd (H.V_subset_U hv) (region_subset hr (mem_singleton v)) + · obtain ⟨p₀, hp₀⟩ := hxE.1 + have hoff : ∀ y ∈ x, y ∉ K.U := fun y hy hyK => by + have : y ∈ H.U ∩ K.U := ⟨(hxE.2.1 hy).1, hyK⟩ + rw [hUU] at this + exact (hxE.2.1 hy).2 this + set r₀ := connectedComponentIn (univ \ K.U) p₀ + have hr₀ : r₀ ∈ K.R := (mem_R_iff K).mpr ⟨p₀, hoff p₀ hp₀, rfl⟩ + have hsub : x ⊆ r₀ := + hxE.2.2.1.isConnected.isPreconnected.subset_connectedComponentIn hp₀ + fun y hy => ⟨mem_univ y, hoff y hy⟩ + refine ⟨r₀, ⟨hxA, Or.inr hr₀, Or.inr (Or.inl ⟨hxE, hr₀, hsub⟩)⟩, ?_⟩ + rintro x' ⟨-, -, ⟨u, hu, hxu, -⟩ | ⟨-, hr', hsub'⟩ | ⟨hr, -⟩⟩ + · exact absurd hu (hxE.2.1 (hxu ▸ mem_singleton u)).2 + · exact region_eq_of_mem hr' hr₀ (hsub' hp₀) (hsub hp₀) + · exact absurd (hxE.2.1 hp₀).1 (region_subset hr hp₀) + · obtain ⟨w, ⟨hwx, hwK⟩, hw_uniq⟩ := huniqR x hxR + refine ⟨{w}, ⟨hxA, Or.inl (Or.inl ⟨w, hwK, rfl⟩), + Or.inr (Or.inr ⟨hxR, w, ⟨hwK, hwx⟩, rfl⟩)⟩, ?_⟩ + rintro x' ⟨-, -, ⟨u, hu, hxu, -⟩ | ⟨he, -, -⟩ | ⟨-, u, ⟨huK, hux⟩, rfl⟩⟩ + · exact absurd (H.V_subset_U hu) (region_subset hxR (hxu ▸ mem_singleton u)) + · obtain ⟨p₀, hp₀⟩ := he.1 + exact absurd (he.2.1 hp₀).1 (region_subset hxR hp₀) + · rw [hw_uniq u ⟨hux, huK⟩] + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/RigidAccess.lean b/LeanPool/GraphMinor/GM14/RigidAccess.lean new file mode 100644 index 0000000000..d187cfc9c6 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/RigidAccess.lean @@ -0,0 +1,414 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.RigidClaims +public import LeanPool.GraphMinor.GM14.RigidFinger +public import LeanPool.GraphMinor.GM14.RigidSphere +import LeanPool.GraphMinor.GM11.ForestRegions +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM12.Section4ParallelLine +import LeanPool.GraphMinor.GM14.WhitneyFaces +import LeanPool.GraphMinor.GM14.RigidThread +import LeanPool.GraphMinor.Surface.ArcInPath +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# A disc around a part of a rigid drawing + +Let `H` be a rigid drawing in a closed disc `D₁` of a sphere, and let `Γ` be a subdrawing of `H`. +Let `X` be a +set of at most three vertices of `Γ`, such that all the other vertices of `Γ` are off `bd(D₁)` and +have all +their edges in `Γ`. We find a closed disc that holds `Γ`, with `X` as the points of `Γ` on its +boundary +(`exists_disc_of_part`). This is how we use Claim (2) of Graph Minors XIV, (6.5), that `Γ` with a +new vertex +joined to `X` is planar. + +By `exists_disc_around`, we need a line from a fixed point `a` to each `x ∈ X`, meeting `U(Γ)` only +in `x`. +Take `a` to be the hub of a wheel outside `D₁`. The wheel with `H` has the graph of the paper's +proof of +Claim (2), `H` with a new vertex joined to `V(H) ∩ bd(D₁)`, up to the rim. + +If `Γ` has a circuit, then Claim (1) gives three disjoint paths to `bd(D₁)`. By `tail_off`, each `x` +starts a +path off `Γ`, and this path with a spoke of the wheel is the line. If `Γ` has no circuit, then the +paper says +that the planarity is clear, and here is the reason. The complement of `U(Γ)` is connected, and each +`x` +is an end of a line whose other points are off `U(Γ)`: an edge of `H` or of the wheel at `x` off +`Γ`, or a +parallel copy of an edge of `Γ` at `x`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Topology Graph GraphMinor.GM09 GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {T : Type u} [TopologicalSpace T] + +/-- A closed surface is locally path connected. -/ +theorem locPath (hS : IsClosedSurface T) : LocallyPathConnectedSpace T := by + rw [locallyPathConnectedSpace_iff_pathComponentIn_mem_nhds] + intro x u hu hx + obtain ⟨V, hV, hxV, ⟨h⟩⟩ := hS.2.2 x + have hball : IsOpen (OpenUnitDisc : Set EuclideanPlane) := Metric.isOpen_ball + have : LocallyPathConnectedSpace OpenUnitDisc := hball.locallyPathConnectedSpace + have : LocallyPathConnectedSpace V := h.isOpenEmbedding.locallyPathConnectedSpace + let x' : V := ⟨x, hxV⟩ + have hu' : IsOpen (Subtype.val ⁻¹' u : Set V) := hu.preimage continuous_subtype_val + have hm := (locallyPathConnectedSpace_iff_pathComponentIn_mem_nhds.mp ‹_›) x' _ hu' hx + have hm₂ : Subtype.val '' pathComponentIn (Subtype.val ⁻¹' u : Set V) x' ∈ 𝓝 x := by + have := hV.isOpenEmbedding_subtypeVal.map_nhds_eq x' + rw [← this] + exact Filter.image_mem_map hm + refine Filter.mem_of_superset hm₂ ?_ + rintro _ ⟨y, hy, rfl⟩ + have hj : JoinedIn (Subtype.val ⁻¹' u : Set V) x' y := hy + have h₂ := hj.map continuous_subtype_val.continuousOn + exact h₂.mono (image_preimage_subset _ _) + +/-- A line to `x` from a point of a path connected set `C` that holds the rest of a line at `x`. -/ +theorem exists_line_to [T2Space T] {C L : Set T} {a x y : T} (hC : IsPathConnected C) (ha : a ∈ C) + (hL : IsLineWithEnds L x y) (hsub : L \ {x, y} ⊆ C) (hax : a ≠ x) : + ∃ ℓ, IsLineWithEnds ℓ a x ∧ ℓ ⊆ insert x C := by + obtain ⟨f, h0, h1⟩ := id hL + let m : unitInterval → unitInterval := fun t => ⟨(1 - t.1) / 2, by + have := t.2.1 + have := t.2.2 + constructor <;> linarith⟩ + have hm : Continuous m := by + refine Continuous.subtype_mk ?_ _ + fun_prop + let q : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have hq : m 0 = q := Subtype.ext (by simp [m, q]) + have h₀ : m 1 = 0 := Subtype.ext (by simp [m]) + have hinn : ∀ t : unitInterval, t ≠ 1 → ((f (m t)).1 : T) ∈ L \ {x, y} := by + intro t ht + refine ⟨(f (m t)).2, ?_⟩ + have hne0 : m t ≠ 0 := fun h => ht (by + have h₁ : (1 - t.1) / 2 = 0 := congrArg Subtype.val h + exact Subtype.ext (by simp only [Set.Icc.coe_one]; linarith)) + have hne1 : m t ≠ 1 := fun h => by + have h₁ : (1 - t.1) / 2 = 1 := congrArg Subtype.val h + have := t.2.1 + linarith + rintro (h | h) + · exact hne0 (f.injective (Subtype.ext (h.trans h0.symm))) + · exact hne1 (f.injective (Subtype.ext (h.trans h1.symm))) + let γ : Path ((f q).1 : T) x := + { toFun := fun t => (f (m t)).1 + continuous_toFun := continuous_subtype_val.comp (f.continuous.comp hm) + source' := by simp [hq] + target' := by simp only [h₀]; exact h0 } + have hqC : ((f q).1 : T) ∈ C := by + have := hinn 0 zero_ne_one + rw [hq] at this + exact hsub this + obtain ⟨p, hp⟩ := hC.joinedIn a ha _ hqC + let P := p.trans γ + obtain ⟨e, he, hi, he0, he1, her⟩ := exists_arc_of_path (γ := P) P.continuous + (by simpa [P] using hax) + have hline : IsLineWithEnds (range e) (e 0) (e 1) := IsArcMap.isLineWithEnds ⟨he, hi⟩ + rw [he0, he1] at hline + refine ⟨range e, by simpa [P] using hline, her.trans ?_⟩ + rw [show range ⇑P = range ⇑p ∪ range ⇑γ from Path.trans_range p γ] + refine union_subset (range_subset_iff.mpr fun t => Or.inr (hp t)) ?_ + rintro _ ⟨t, rfl⟩ + by_cases ht : t = 1 + · subst ht + exact Or.inl γ.target + · exact Or.inr (hsub (hinn t ht)) + +/-- Each vertex of a subdivision of a 3-connected graph has an edge. -/ +theorem SubData.exists_edge {α β : Type*} {G G₀ : Graph α β} {P : β → Graph α β} + (h : SubData G G₀ P) + {v : α} (hv : v ∈ V(G)) : ∃ g ∈ E(G), G.Inc g v := by + have hE : ∀ {e g}, e ∈ E(G₀) → g ∈ E(P e) → g ∈ E(G) := fun {e g} he hg => by + rw [h.eunion] + exact mem_iUnion₂.mpr ⟨e, he, hg⟩ + rw [h.vunion] at hv + rcases hv with hv | hv + · obtain ⟨e, -, -, ⟨w, hw⟩, -⟩ := IsSimpleThreeConnected.exists_two_edges h.simple hv + obtain ⟨g, hg, hi⟩ := (h.exists_edge_at_ends hw).1 + exact ⟨g, hE hw.edge_mem hg, hi⟩ + · obtain ⟨e, he, hv⟩ := mem_iUnion₂.mp hv + obtain ⟨u, w, hl, ⟨hle, W, hs, hVe, hEe⟩, -, -⟩ := h.path e he + by_cases hvu : v = u + · obtain ⟨g, hg, hi⟩ := (h.exists_edge_at_ends hl).1 + exact ⟨g, hE he hg, hvu ▸ hi⟩ + by_cases hvw : v = w + · obtain ⟨g, hg, hi⟩ := (h.exists_edge_at_ends hl).2 + exact ⟨g, hE he hg, hvw ▸ hi⟩ + rw [hVe] at hv + obtain ⟨g, hg, -, -, -, ⟨y, hy⟩, -⟩ := exists_two_edges_at_inner W hs hv hvu hvw + have hgE : g ∈ E(P e) := by rw [hEe]; exact hg + exact ⟨g, hE he hgE, y, hy.mono hle⟩ + +private theorem exists_access_line_to_vertex_of_forest + {T : Type u} + [TopologicalSpace T] + [T2Space T] + [ConnectedSpace T] + (hS : IsClosedSurface T) + {Γ : Drawing T} + {X : Set T} + (a : T) + (G₀ : Graph T (Set T)) + (Q₀ : Set T → Graph T (Set T)) + (J : Drawing T) + (hgood : Good J.toGraph) + (hsd : SubData J.toGraph G₀ Q₀) + (hΓJ : Γ.IsSubdrawing J) + (haK : a ∉ Γ.U) + (hoff : ∀ g ∈ J.E, g ∉ Γ.E → ∀ z ∈ g, z ∉ Γ.U) + (hclo : ∀ {g : Set T} {v : T}, J.toGraph.Inc g v → v ∈ closure g) + (hXJ : ∀ {x : T}, x ∈ X → x ∈ J.V) + (hax : ∀ {x : T}, x ∈ X → a ≠ x) : + (¬∃ R : Drawing T, R.IsCircuit ∧ R.IsSubdrawing Γ) → + ∀ x ∈ X, ∃ ℓ, IsLineWithEnds ℓ a x ∧ ℓ ∩ Γ.U ⊆ {x} := by + intro hno x₀ hx₀ + have hpre : IsPreconnected Γ.Uᶜ := + isPreconnected_compl_of_noCircuit hS Γ fun R h₁ h₂ => hno ⟨R, h₁, h₂⟩ + have hO : IsOpen Γ.Uᶜ := Γ.isClosed_U.isOpen_compl + have := locPath hS + have hCp : IsPathConnected Γ.Uᶜ := by + refine hO.isConnected_iff_isPathConnected.mp ⟨⟨a, haK⟩, hpre⟩ + have hfin : ∀ L y, IsLineWithEnds L x₀ y → L \ {x₀, y} ⊆ Γ.Uᶜ → + ∃ ℓ, IsLineWithEnds ℓ a x₀ ∧ ℓ ∩ Γ.U ⊆ {x₀} := by + intro L y hL hsub + obtain ⟨ℓ, hℓ, hsubℓ⟩ := exists_line_to hCp haK hL hsub (hax hx₀) + refine ⟨ℓ, hℓ, ?_⟩ + rintro z ⟨hz, hzU⟩ + exact (hsubℓ hz).resolve_right fun h => h hzU + obtain ⟨g₀, hg₀, hi₀⟩ := hsd.exists_edge (v := x₀) (hXJ hx₀) + have hg₀' : g₀ ∈ J.E := hg₀ + obtain ⟨w, hxw, hc, hL⟩ : ∃ w, x₀ ≠ w ∧ closure g₀ ∩ J.V = {x₀, w} ∧ + IsLineWithEnds (closure g₀) x₀ w := by + rcases J.edge_cond g₀ hg₀' with ⟨u, v, huv, hc, hL⟩ | ⟨u, hc, -⟩ + · have h₁ : x₀ ∈ ({u, v} : Set T) := hc ▸ ⟨hclo hi₀, hXJ hx₀⟩ + rcases h₁ with rfl | h₁ + · exact ⟨v, huv, hc, hL⟩ + · have h₂ : x₀ = v := h₁ + subst h₂ + exact ⟨u, huv.symm, hc.trans (pair_comm _ _), IsLineWithEnds.symm hL⟩ + · have huV : u ∈ J.V := by + have h₁ : u ∈ closure g₀ ∩ J.V := hc ▸ rfl + exact h₁.2 + exact absurd ⟨hg₀', huV, huV, hc.trans (pair_eq_singleton u).symm⟩ (hgood.no_loop g₀ u) + by_cases hg₀Γ : g₀ ∈ Γ.E + · let Z : Set T := (Γ.span Γ.V (Γ.E \ {g₀})).U + have hZc : IsClosed Z := (Γ.span Γ.V (Γ.E \ {g₀})).isClosed_U + have hKZ : Γ.U ⊆ Z ∪ closure g₀ := by + intro z hz + rw [Γ.U_eq] at hz + rcases hz with hz | hz + · exact Or.inl (Or.inl (Or.inl ⟨hz, hz⟩)) + · obtain ⟨e, he, hze⟩ := mem_iUnion₂.mp hz + by_cases heg : e = g₀ + · exact Or.inr (heg ▸ hze) + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨e, ⟨⟨he, heg⟩, he⟩, hze⟩)) + have hLZ : closure g₀ ∩ Z ⊆ {x₀, w} := by + rintro z ⟨hz, hzZ⟩ + by_contra hzn + have hzV : z ∉ J.V := fun h => hzn (hc ▸ ⟨hz, h⟩) + have hzg : z ∈ g₀ := by + rw [← J.closure_diff_V hg₀'] + exact ⟨hz, hzV⟩ + rcases hzZ with hzs | hzc + · exact hzV (hΓJ.1 (Γ.spanV_subset _ _ hzs)) + · obtain ⟨e, ⟨⟨he, hne⟩, -⟩, hze⟩ := mem_iUnion₂.mp hzc + have hzeJ : z ∈ e := by + rw [← J.closure_diff_V (hΓJ.2 he)] + exact ⟨hze, hzV⟩ + exact hne (J.edge_eq_of_mem (hΓJ.2 he) hg₀' hzeJ hzg) + obtain ⟨P', hP', hP'Z, hP'L⟩ := GM12.exists_parallel_line hS hL hxw hZc hLZ + refine hfin P' w hP' ?_ + rintro z ⟨hz, hzn⟩ hzU + rcases hKZ hzU with h₁ | h₁ + · exact hzn (hP'Z ⟨hz, h₁⟩) + · exact hzn (hP'L ▸ ⟨hz, h₁⟩) + · refine hfin _ w hL ?_ + rintro z ⟨hz, hzn⟩ + refine hoff g₀ hg₀' hg₀Γ z ?_ + rw [← J.closure_diff_V hg₀'] + exact ⟨hz, fun hzV => hzn (hc ▸ ⟨hz, hzV⟩)⟩ + +/-- **A disc around a part.** See the module docstring. -/ +theorem exists_disc_of_part [T2Space T] [ConnectedSpace T] (hS : IsClosedSurface T) + (hsph : IsSphere T) + {D₁ D₂ B : Set T} (hd₁ : IsClosedDisc D₁) (hd₂ : IsClosedDisc D₂) (hb₁ : discBd D₁ = B) + (hb₂ : discBd D₂ = B) (hcov : D₁ ∪ D₂ = univ) (hcap : D₁ ∩ D₂ = B) {H Γ : Drawing T} + (hU : H.U ⊆ D₁) (hn : H.U ∩ B ⊆ H.V) (hr : IsRigidIn H D₁) (hΓ : Γ.IsSubdrawing H) {X : Set T} + (hXV : X ⊆ Γ.V) (hX : X.ncard ≤ 3) + (hout : ∀ v ∈ Γ.V, v ∉ X → v ∉ B ∧ ∀ e ∈ H.E, v ∈ closure e → e ∈ Γ.E) : + ∃ E : Set T, IsClosedDisc E ∧ Γ.U ⊆ E ∧ discBd E ∩ Γ.U = X := by + classical + have hcomp : CompactSpace T := hS.1 + obtain ⟨W, a, Γ', hm, hw, hf, hrr, -, -, haD₁, -, hhub⟩ := + exists_frame hS hsph hd₁ hd₂ hb₁ hb₂ hcov hcap hU hn hr + have hu : IsUnion H W (H.glue W hm) := isUnion_glue hm + have hsb : subBd D₁ = B := (IsClosedDisc.subBd_eq_discBd hS hd₁).trans hb₁ + have hgood := good_of_wheel hf hrr hw hu + (fun v hv hvW => ⟨hv, by + have : v ∈ D₁ ∩ D₂ := ⟨hU (H.V_subset_U hv), hw.Usub (W.V_subset_U hvW)⟩ + rwa [hcap] at this⟩) hm hS hsph + obtain ⟨G₀, Q₀, hsd⟩ := exists_subData (good_sub hgood) + generalize hJ : H.glue W hm = J at hu hf hrr hgood hsd + have hHJ : H.IsSubdrawing J := ⟨hf.Vsub, hf.Esub⟩ + have hWJ : W.IsSubdrawing J := ⟨hu.hV ▸ subset_union_right, hu.hE ▸ subset_union_right⟩ + have hΓJ : Γ.IsSubdrawing J := hΓ.trans hHJ + have hKH : Γ.U ⊆ H.U := hΓ.U_subset + have haK : a ∉ Γ.U := fun h => haD₁ (hU (hKH h)) + -- Edges of `J` off `Γ` miss `U(Γ)`. + have hoff : ∀ g ∈ J.E, g ∉ Γ.E → ∀ z ∈ g, z ∉ Γ.U := by + intro g hg hgΓ z hz hzU + by_cases hzV : z ∈ Γ.V + · exact edge_notMem_V hg hz (hΓJ.1 hzV) + · obtain ⟨e, he, hze⟩ := Γ.exists_edge_of_mem hzU hzV + exact hgΓ (J.edge_eq_of_mem hg (hΓJ.2 he) hz hze ▸ he) + have hclo : ∀ {g v}, J.toGraph.Inc g v → v ∈ closure g := by + rintro g v ⟨y, hl⟩ + have h₁ : v ∈ closure g ∩ J.V := hl.2.2.2 ▸ mem_insert _ _ + exact h₁.1 + have hXJ : ∀ {x}, x ∈ X → x ∈ J.V := fun hx => hΓJ.1 (hXV hx) + have hXf : X.Finite := Γ.finite_V.subset hXV + have hax : ∀ {x}, x ∈ X → a ≠ x := fun hx h => haK (h ▸ Γ.V_subset_U (hXV hx)) + have hUV : ∀ {z}, z ∈ Γ.U → z ∈ J.V → z ∈ Γ.V := fun {z} hz hzJ => by + by_contra hn + obtain ⟨e, he, hze⟩ := Γ.exists_edge_of_mem hz hn + exact edge_notMem_V (hΓJ.2 he) hze hzJ + -- The case of a circuit: Claims (1) and (2). + have hcirc : (∃ R : Drawing T, R.IsCircuit ∧ R.IsSubdrawing Γ) → + ∀ x ∈ X, ∃ ℓ, IsLineWithEnds ℓ a x ∧ ℓ ∩ Γ.U ⊆ {x} := by + rintro ⟨R, hR, hRs⟩ x₀ hx₀ + have hB' : ∀ v ∈ H.V, ∀ g ∈ J.E, g ∉ H.E → v ∈ closure g → v ∈ subBd D₁ := by + intro v hv g hg hgH hvg + have hgW : g ∈ W.E := (show g ∈ H.E ∪ W.E from hu.hE ▸ hg).resolve_left hgH + have h₂ : v ∈ closure g ∩ J.V := ⟨hvg, hf.Vsub hv⟩ + rw [← hWJ.closure_inter_V hgW] at h₂ + rw [hsb] + exact hcap ▸ ⟨hU (H.V_subset_U hv), hw.Usub (W.V_subset_U h₂.2)⟩ + obtain ⟨Q, hdis, hQ⟩ := claim_1_three_paths hf hrr hS hsph hsd hB' hR (hRs.trans hΓ) + have hyB : ∀ {y}, y ∈ H.V ∩ subBd D₁ → y ∈ B := fun hy => hsb ▸ hy.2 + have hhit : ∀ i, ∃ x ∈ V(Q i), x ∈ X := by + intro i + obtain ⟨u, y, ⟨hle, W', -, hV, -⟩, hu', hy⟩ := hQ i + have huR : u ∈ V(Q i) ∩ R.V := hu' ▸ rfl + have hyB' : y ∈ V(Q i) ∩ (H.V ∩ subBd D₁) := hy ▸ rfl + obtain ⟨x, hx, hxX⟩ := walk_hits hΓ hout hle W' (hRs.1 huR.2) (hyB hyB'.2) + exact ⟨x, hV ▸ hx, hxX⟩ + choose c hc hcX using hhit + have hinj : Function.Injective c := by + intro i j hij + by_contra hne + exact disjoint_left.mp (hdis hne) (hc i) (hij ▸ hc j) + have hrange : range c = X := by + refine eq_of_subset_of_ncard_le (range_subset_iff.mpr hcX) ?_ hXf + rw [← image_univ, ncard_image_of_injective _ hinj, ncard_univ] + simpa using hX + obtain ⟨i, rfl⟩ : x₀ ∈ range c := hrange ▸ hx₀ + have huniq : ∀ z ∈ V(Q i), z ∈ X → z = c i := by + intro z hz hzX + rw [← hrange] at hzX + obtain ⟨j, rfl⟩ := hzX + by_cases hij : i = j + · rw [hij] + · exact absurd (hc j) (disjoint_left.mp (hdis hij) hz) + obtain ⟨u, y, ⟨hle, W', hs, hV, -⟩, -, hy⟩ := hQ i + have hyH : y ∈ H.V ∩ subBd D₁ := (show y ∈ V(Q i) ∩ (H.V ∩ subBd D₁) from hy ▸ rfl).2 + have hci : c i ∈ W'.support := by + have := hc i + rw [hV] at this + exact this + obtain ⟨T, hTs, hT₁, -⟩ := walk_tail W' hci hs + have hmem : ∀ {z}, z ∈ T.support → z ∈ V(Q i) := fun {z} hz => by + rw [hV] + exact hT₁ z hz + have hTH : ∀ {z}, z ∈ T.support → z ∈ H.V := fun hz => hle.vertexSet_mono (hmem hz) + have htail := fun {z} (hz : z ∈ T.support) (hne : z ≠ c i) => + tail_off hΓ hout hle T hTs (hyB hyH) (fun w hw hwX => huniq w (hmem hw) hwX) hz hne + have hay : y ≠ a := fun h => haD₁ (h ▸ hU (H.V_subset_U hyH.1)) + obtain ⟨g, hg⟩ := hhub y (hw.BV ⟨hyH.1, hyB hyH⟩) hay + have hgJ : J.toGraph.IsLink g a y := (hWJ.isLink_iff hg.1).mp hg + obtain ⟨T', hs', he'⟩ := T.exists_transfer (G' := J.toGraph) + (fun e p q _ hl => (hHJ.isLink_iff (hl.mono hle).1).mp (hl.mono hle)) + (fun z hz => hf.Vsub (hTH hz)) + have hT's : T'.IsSimple := by + unfold GraphWalk.IsSimple + rw [hs'] + exact hTs + have hsupp : ∀ {z}, z ∈ (GraphWalk.cons hgJ T'.reverse).support → z = a ∨ z ∈ T.support := by + intro z hz + simp only [GraphWalk.support, List.mem_cons, GraphWalk.support_reverse, + List.mem_reverse] at hz + rcases hz with hz | hz + · exact Or.inl hz + · exact Or.inr (hs' ▸ hz) + have hAs : (GraphWalk.cons hgJ T'.reverse).IsSimple := by + refine List.nodup_cons.mpr ⟨fun h => ?_, hT's.reverse⟩ + rw [GraphWalk.support_reverse, List.mem_reverse, hs'] at h + exact haD₁ (hU (H.V_subset_U (hTH h))) + have hVoff : ∀ z ∈ (GraphWalk.cons hgJ T'.reverse).support, z ≠ c i → z ∉ Γ.U := by + intro z hz hne hzU + rcases hsupp hz with rfl | hz' + · exact haK hzU + · exact htail hz' hne (hUV hzU (hf.Vsub (hTH hz'))) + have hEoff : ∀ e ∈ (GraphWalk.cons hgJ T'.reverse).edges, e ∉ Γ.E := by + intro e he heΓ + obtain ⟨p, q, hl, hp, hq⟩ := walk_edge_ends _ he + have hend : ∀ {w}, w ∈ closure e ∩ J.V → w ∈ (GraphWalk.cons hgJ T'.reverse).support → w + = c i := by + intro w hw hws + by_contra hne + rw [← hΓJ.closure_inter_V heΓ] at hw + exact hVoff w hws hne (Γ.V_subset_U hw.2) + have hpc : p ∈ closure e ∩ J.V := hl.2.2.2 ▸ mem_insert _ _ + have hqc : q ∈ closure e ∩ J.V := hl.2.2.2 ▸ mem_insert_of_mem _ rfl + have hpq : p = q := (hend hpc hp).trans (hend hqc hq).symm + subst hpq + exact hgood.no_loop e p hl + refine ⟨_, walk_isLine J _ hAs (hax (hcX i)), ?_⟩ + rintro z ⟨hz | hz, hzU⟩ + · by_contra hne + exact hVoff z hz hne hzU + · obtain ⟨e, he, hze⟩ := mem_iUnion₂.mp hz + obtain ⟨p, q, hl, hp, hq⟩ := walk_edge_ends _ he + by_cases hzV : z ∈ J.V + · by_contra hne + have h₁ : z ∈ closure e ∩ J.V := ⟨hze, hzV⟩ + rw [hl.2.2.2] at h₁ + rcases h₁ with rfl | h₁ + · exact hVoff z hp hne hzU + · have h₂ : z = q := h₁ + exact hVoff z (h₂ ▸ hq) hne hzU + · have hze' : z ∈ e := by + rw [← J.closure_diff_V hl.1] + exact ⟨hze, hzV⟩ + exact absurd hzU (hoff e hl.1 (hEoff e he) z hze') + -- The case of no circuit. + have hforest : (¬ ∃ R : Drawing T, R.IsCircuit ∧ R.IsSubdrawing Γ) → + ∀ x ∈ X, ∃ ℓ, IsLineWithEnds ℓ a x ∧ ℓ ∩ Γ.U ⊆ {x} := by + exact exists_access_line_to_vertex_of_forest (T := T) hS (Γ := Γ) (X := X) a G₀ Q₀ J hgood hsd + hΓJ haK hoff hclo hXJ hax + have hlines : ∀ x ∈ X, ∃ ℓ, IsLineWithEnds ℓ a x ∧ ℓ ∩ Γ.U ⊆ {x} := by + by_cases hc : ∃ R : Drawing T, R.IsCircuit ∧ R.IsSubdrawing Γ + · exact hcirc hc + · exact hforest hc + obtain ⟨E, hE, hKE, -, hb⟩ := exists_disc_around hS hsph Γ.isClosed_U.isCompact haK hXf + (hXV.trans Γ.V_subset_U) hlines + exact ⟨E, hE, hKE, hb⟩ + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM14/RigidClaims.lean b/LeanPool/GraphMinor/GM14/RigidClaims.lean new file mode 100644 index 0000000000..1ce00b5430 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/RigidClaims.lean @@ -0,0 +1,230 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.RigidThread +import LeanPool.GraphMinor.GM09.Section2d +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM14.WhitneyFaces +import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# Claims (1) and (2) of Graph Minors XIV, (6.5) + +Claim (1) (`claim_1_three_paths`): for a circuit `C` of a drawing `H` that is rigid in `Δ`, there +are three +disjoint paths of `H` from `V(C)` to `V(H) ∩ bd(Δ)`. If not, Menger's theorem gives a separation of +order +at most two. The form of Menger's theorem for planar graphs that the paper cites is +`exists_thread_disc`: it +turns the separation into an `O`-arc that bounds a closed disc in `Δ`. This disc holds `U(C)`, which +contradicts rigidity by `claim_1_dial_contradiction_6_5`. + +For Claim (2), let `Γ` be the part of `H` in a society, and let `X` be `V(H) ∩ ΩBar`. Each of the +three paths of +Claim (1) from a circuit of `Γ` must pass through `X`, since a vertex of `Γ` off `X` has all its +edges +in `Γ` and is off `bd(Δ)` (`walk_hits`). As `|X| ≤ 3`, each path holds exactly one vertex of `X`, +and +what follows that vertex on the path is off `Γ` (`tail_off`). +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 + +universe u v + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- **Graph Minors XIV, (6.5), Claim (1), dial contradiction step** (pages 34–35): +In a drawing `H` that is rigid in a closed disc `Δ`, no `O`-arc `F ⊆ Δ` with `F ∩ U(H) ⊆ V(H)` and +`|F ∩ V(H)| ≤ 2` can bound a closed disc `Δ₀ ⊆ Δ` with `U(C) ⊆ Δ₀` for a circuit `C` of `H` ("But +$H$ is rigid, and $F$ only bounds one closed disc in $\Delta$, a contradiction"). -/ +theorem claim_1_dial_contradiction_6_5 + {H C : Drawing S} {Δ F Δ₀ : Set S} (hΔ : IsClosedDisc Δ) + (hrigid : ∀ F' : Set S, F' ⊆ Δ → IsOArc F' → F' ∩ H.U ⊆ H.V → + (F' ∩ H.V).ncard ≤ 2 → + ∃ Δ' : Set S, Δ' ⊆ Δ ∧ IsDial H F' Δ' ∧ discBd Δ' = F') + (hC : C.IsCircuit) (hCH : C.IsSubdrawing H) + (hFΔ : F ⊆ Δ) (hFo : IsOArc F) (hFnorm : F ∩ H.U ⊆ H.V) (hFcard : (F ∩ H.V).ncard ≤ 2) + (hΔ₀ : IsClosedDisc Δ₀) (hΔ₀Δ : Δ₀ ⊆ Δ) (hΔ₀discBd : discBd Δ₀ = F) (hCU₀ : C.U ⊆ Δ₀) : + False := by + obtain ⟨Δ₁, hΔ₁Δ, hdial₁, hΔ₁discBd⟩ := hrigid F hFΔ hFo hFnorm hFcard + obtain ⟨Δ_uniq, -, h_uniq⟩ := disc_oArc Δ F hΔ hFΔ hFo + have hΔ₀_eq : Δ₀ = Δ_uniq := h_uniq Δ₀ hΔ₀Δ hΔ₀ hΔ₀discBd + have hΔ₁_eq : Δ₁ = Δ_uniq := h_uniq Δ₁ hΔ₁Δ hdial₁.1 hΔ₁discBd + have hCU₁ : C.U ⊆ Δ₁ := (hΔ₀_eq.trans hΔ₁_eq.symm) ▸ hCU₀ + exact no_circuit_in_dial hdial₁ hFnorm hC hCH hCU₁ + +namespace Whitney + +variable {H J Γ Γ' : Drawing S} {Δ B X : Set S} {a : S} + +/-- **Graph Minors XIV, (6.5), Claim (1)** (pages 34 and 35). Vertices of `H` on an edge of `J` off +`H` lie on +`bd(Δ)`. -/ +theorem claim_1_three_paths [ConnectedSpace S] (f : Frame H J Δ a) (r : Rad J Γ') + (hS : IsClosedSurface S) (hsph : IsSphere S) {G₀ : Graph S (Set S)} {Q₀ : Set S → Graph S + (Set S)} + (hsd : SubData J.toGraph G₀ Q₀) + (hB : ∀ v ∈ H.V, ∀ g ∈ J.E, g ∉ H.E → v ∈ closure g → v ∈ subBd Δ) {R : Drawing S} + (hR : R.IsCircuit) (hRH : R.IsSubdrawing H) : + ∃ Q : Fin 3 → Graph S (Set S), Pairwise (fun i j => Disjoint V(Q i) V(Q j)) ∧ + ∀ i, IsFromToPath H.toGraph (Q i) R.V (H.V ∩ subBd Δ) := by + classical + have : Finite V(H.toGraph) := H.finite_V.to_subtype + rcases exists_fromToPaths_or_graphSeparation (G := H.toGraph) (X := R.V) (Y + := H.V ∩ subBd Δ) hRH.1 + inter_subset_left 3 with ⟨Q, h₁, h₂⟩ | ⟨G₁, G₂, hsep, -, hX, hY, hc⟩ + · exact ⟨Q, h₁, h₂⟩ + exfalso + obtain ⟨hle₁, hle₂, hV, hE, -⟩ := hsep + have hHJ : H.IsSubdrawing J := ⟨f.Vsub, f.Esub⟩ + have hRJ : R.IsSubdrawing J := hRH.trans hHJ + let A : Set (Set S) := E(G₁) ∪ R.E + have hA : A ⊆ H.E := union_subset hle₁.edgeSet_mono hRH.2 + have hbd : Whitney.bdry J.toGraph A ⊆ V(G₁) ∩ V(G₂) := by + rintro v ⟨⟨e, he, ⟨y, hl⟩⟩, ⟨e', he', hie'⟩⟩ + have hl' := (hHJ.isLink_iff (hA he)).mpr hl + have hvH : v ∈ H.V := hl'.2.1 + have hv₁ : v ∈ V(G₁) := by + rcases he with h | h + · exact ((hle₁.isLink_iff h).mpr hl').left_mem + · exact hX ((hRH.isLink_iff h).mpr hl').2.1 + refine ⟨hv₁, ?_⟩ + by_contra hv₂ + have hvb : v ∉ subBd Δ := fun h => hv₂ (hY ⟨hvH, h⟩) + obtain ⟨y', hl₂⟩ := hie' + have hclo : v ∈ closure e' := by + have h₁ : v ∈ closure e' ∩ J.V := hl₂.2.2.2 ▸ mem_insert _ _ + exact h₁.1 + have heH : e' ∈ H.E := by + by_contra hn + exact hvb (hB v hvH e' he'.1 hn hclo) + have heG : e' ∈ E(G₂) := by + have h₁ : e' ∈ E(G₁) ∪ E(G₂) := hE ▸ heH + exact h₁.resolve_left fun h => he'.2 (Or.inl h) + exact hv₂ ((hle₂.isLink_iff heG).mpr ((hHJ.isLink_iff heH).mpr hl₂)).left_mem + have hfinS : (V(G₁) ∩ V(G₂)).Finite := H.finite_V.subset (inter_subset_left.trans + hle₁.vertexSet_mono) + have hRE : R.E.Nonempty := by + obtain ⟨u, W₂, -, hpos, -, hE₂⟩ := id hR + cases W₂ with + | nil _ => simp [GraphWalk.length] at hpos + | @cons _ m _ g hl rest => exact ⟨g, by rw [hE₂]; simp [GraphWalk.edges]⟩ + obtain ⟨g, hg⟩ := hRE + obtain ⟨x, y, P, D, -, -, -, -, hPE, -, hh, rfl⟩ := exists_thread_disc f r hS hsph hA + (by have := ncard_le_ncard hbd hfinS; omega) (hfinS.subset hbd) ⟨g, Or.inr hg⟩ + have hEsub : ∀ e ∈ R.E, closure e ⊆ D := fun e he => by + have h₁ : e ∈ (H.interSet D).E := hPE ▸ Or.inr he + exact closure_minimal (mem_interSet_E.mp h₁).2 hh.disc.isClosed + refine claim_1_dial_contradiction_6_5 (F := discBd D) f.disc (fun F' h₁ h₂ h₃ h₄ => ?_) hR hRH + ((Surface.discBd_subset D).trans hh.sub) hh.disc.isOArc_discBd hh.norm + (by rw [hh.cap, ncard_pair hh.ne]) hh.disc hh.sub rfl ?_ + · obtain ⟨Δ', h₅, h₆⟩ := f.rigid F' h₁ h₂ h₃ h₄ + exact ⟨Δ', h₅, h₆, (IsClosedDisc.subBd_eq_discBd hS h₆.1).symm.trans h₆.2.1⟩ + · intro z hz + rw [R.U_eq] at hz + rcases hz with hz | hz + · obtain ⟨e, he, -, -, -, ⟨y', hl⟩, -⟩ := circuit_two_edges hsd hR hRJ hz + have h₁ : z ∈ closure e ∩ J.V := hl.2.2.2 ▸ mem_insert _ _ + exact hEsub e he h₁.1 + · obtain ⟨e, he, hze⟩ := mem_iUnion₂.mp hz + exact hEsub e he hze + +omit [T2Space S] in +/-- A walk from `Γ` to `B` meets `X`, if each vertex of `Γ` off `X` is off `B` and has all its edges +in `Γ`. -/ +theorem walk_hits (hΓ : Γ.IsSubdrawing H) + (hout : ∀ v ∈ Γ.V, v ∉ X → v ∉ B ∧ ∀ e ∈ H.E, v ∈ closure e → e ∈ Γ.E) {P : Graph S (Set S)} + (hP : P ≤ H.toGraph) {u b : S} (W : GraphWalk P u b) (hu : u ∈ Γ.V) (hb : b ∈ B) : + ∃ x ∈ W.support, x ∈ X := by + induction W with + | nil _ => + by_contra hn + refine (hout _ hu fun h => hn ⟨_, ?_, h⟩).1 hb + simp [GraphWalk.support] + | @cons u t b g hl rest ih => + by_cases huX : u ∈ X + · exact ⟨u, by simp [GraphWalk.support], huX⟩ + obtain ⟨-, hall⟩ := hout u hu huX + have hl' := hl.mono hP + have hcap : closure g ∩ H.V = {u, t} := hl'.2.2.2 + have hu₁ : u ∈ closure g ∩ H.V := hcap ▸ mem_insert _ _ + have ht₁ : t ∈ closure g ∩ H.V := hcap ▸ mem_insert_of_mem _ rfl + have hgΓ := hall g hl'.1 hu₁.1 + rw [← hΓ.closure_inter_V hgΓ] at ht₁ + obtain ⟨x, hx, hxX⟩ := ih ht₁.2 hb + exact ⟨x, by simp [GraphWalk.support, hx], hxX⟩ + +omit [TopologicalSpace S] [T2Space S] in +/-- The part of a walk after one of its vertices. -/ +theorem walk_tail {α β : Type*} {P : Graph α β} {u b : α} (W : GraphWalk P u b) {x : α} + (hx : x ∈ W.support) + (hs : W.IsSimple) : + ∃ T : GraphWalk P x b, T.IsSimple ∧ (∀ z ∈ T.support, z ∈ W.support) + ∧ ∀ e ∈ T.edges, e ∈ W.edges := by + induction W with + | @nil v hv => + have h₁ : x = v := by simpa [GraphWalk.support] using hx + subst h₁ + exact ⟨.nil hv, hs, fun z hz => hz, fun e he => he⟩ + | @cons u t b g hl rest ih => + by_cases hxu : x = u + · subst hxu + exact ⟨.cons hl rest, hs, fun z hz => hz, fun e he => he⟩ + · have hx' : x ∈ rest.support := by + simp only [GraphWalk.support, List.mem_cons] at hx + exact hx.resolve_left hxu + obtain ⟨T, h₁, h₂, h₃⟩ := ih hx' (List.nodup_cons.mp hs).2 + refine ⟨T, h₁, fun z hz => ?_, fun e he => ?_⟩ + · simp [GraphWalk.support, h₂ z hz] + · simp [GraphWalk.edges, h₃ e he] + +omit [T2Space S] in +/-- **What follows the only vertex of `X` on a simple walk to `B` is off `Γ`.** -/ +theorem tail_off (hΓ : Γ.IsSubdrawing H) + (hout : ∀ v ∈ Γ.V, v ∉ X → v ∉ B ∧ ∀ e ∈ H.E, v ∈ closure e → e ∈ Γ.E) {P : Graph S (Set S)} + (hP : P ≤ H.toGraph) {x b : S} (T : GraphWalk P x b) (hs : T.IsSimple) (hb : b ∈ B) + (huniq : ∀ z ∈ T.support, z ∈ X → z = x) {z : S} (hz : z ∈ T.support) (hzx : z ≠ x) : z ∉ Γ.V + := by + intro hzΓ + cases T with + | nil _ => exact hzx (by simpa [GraphWalk.support] using hz) + | @cons _ t _ g hl rest => + have hnd := List.nodup_cons.mp hs + have hz' : z ∈ rest.support := by + simp only [GraphWalk.support, List.mem_cons] at hz + exact hz.resolve_left hzx + obtain ⟨T₂, -, h₂, -⟩ := walk_tail rest hz' hnd.2 + obtain ⟨w, hw, hwX⟩ := walk_hits hΓ hout hP T₂ hzΓ hb + have hw' := h₂ w hw + have hwx : w = x := huniq w (by simp [GraphWalk.support, hw']) hwX + exact hnd.1 (hwx ▸ hw') + +omit [T2Space S] in +/-- The ends of an edge of a walk lie on the walk. -/ +theorem walk_edge_ends {u b : S} (W : GraphWalk J.toGraph u b) {g : Set S} (hg : g ∈ W.edges) : + ∃ p q, J.toGraph.IsLink g p q ∧ p ∈ W.support ∧ q ∈ W.support := by + induction W with + | nil _ => simp [GraphWalk.edges] at hg + | @cons u t b c hl rest ih => + simp only [GraphWalk.edges, List.mem_cons] at hg + rcases hg with rfl | hg + · refine ⟨u, t, hl, by simp [GraphWalk.support], ?_⟩ + cases rest <;> simp [GraphWalk.support] + · obtain ⟨p, q, h₁, h₂, h₃⟩ := ih hg + exact ⟨p, q, h₁, by simp [GraphWalk.support, h₂], by simp [GraphWalk.support, h₃]⟩ + +end Whitney + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/RigidDisc.lean b/LeanPool/GraphMinor/GM14/RigidDisc.lean new file mode 100644 index 0000000000..b45ce8de82 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/RigidDisc.lean @@ -0,0 +1,348 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.RigidClaims +public import LeanPool.GraphMinor.GM14.RigidAccess +public import LeanPool.GraphMinor.GM14.RigidSegregation +public import LeanPool.GraphMinor.GM14.GraphTransport +import LeanPool.GraphMinor.GM11.PerimeterPull +import LeanPool.GraphMinor.Surface.SphereDisc +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.Schoenflies +import LeanPool.GraphMinor.Surface.AddCrosscap + +/-! +# Two facts about a drawing that is rigid in a closed disc + +Let `H` be a drawing that is rigid in a closed disc `Δ`. A circuit of `H` has three disjoint paths +to +`V(H) ∩ bd(Δ)` (`three_paths_of_rigid`). This is Claim (1) of (6.5), page 34, for a disc in any +surface. A vertex of `H` off `bd(Δ)` does not lie on just one edge (`two_edges_of_rigid`). Claim (2) +of (8.4) needs this second fact. + +Both facts are first proved in a sphere, with the wheel of `exists_frame` on the other side of +`bd(Δ)`. Then we move `H` to a disc in the sphere by `mapD`. +-/ + + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor GraphMinor.GM09 GraphMinor.Surface GraphMinor.GM11 +open GraphMinor.GM14.Whitney + +universe u + +section Sphere + +variable {T : Type u} [TopologicalSpace T] [T2Space T] [ConnectedSpace T] + +/-- A vertex off the boundary circle lies on at least two edges. -/ +theorem two_edges_sphere (hS : IsClosedSurface T) (hsph : IsSphere T) + {D₁ D₂ C : Set T} (hd₁ : IsClosedDisc D₁) (hd₂ : IsClosedDisc D₂) (hb₁ : discBd D₁ = C) + (hb₂ : discBd D₂ = C) (hcov : D₁ ∪ D₂ = univ) (hcap : D₁ ∩ D₂ = C) {H : Drawing T} + (hU : H.U ⊆ D₁) (hn : H.U ∩ C ⊆ H.V) (hr : IsRigidIn H D₁) {v : T} (hv : v ∈ H.V) + (hvC : v ∉ C) {e : Set T} (he : H.toGraph.Inc e v) : + ∃ e', e' ≠ e ∧ H.toGraph.Inc e' v := by + classical + obtain ⟨W, a, Γ', hm, hw, hf, hrr, -, -, haD₁, -, hhub⟩ := + exists_frame hS hsph hd₁ hd₂ hb₁ hb₂ hcov hcap hU hn hr + have hu : IsUnion H W (H.glue W hm) := isUnion_glue hm + have hsb : subBd D₁ = C := (IsClosedDisc.subBd_eq_discBd hS hd₁).trans hb₁ + generalize hJ : H.glue W hm = J at hu hf hrr + have hHJ : H.IsSubdrawing J := ⟨hf.Vsub, hf.Esub⟩ + have hWJ : W.IsSubdrawing J := ⟨hu.hV ▸ subset_union_right, hu.hE ▸ subset_union_right⟩ + have heE : e ∈ H.E := he.edge_mem + by_contra hno + push Not at hno + -- All edges of `J` at `v` are edges of `H`, as `v` is off the circle. + have hJH : ∀ g, J.toGraph.Inc g v → g = e := by + rintro g ⟨y, hl⟩ + have hgJ : g ∈ J.E := hl.edge_mem + have hgH : g ∈ H.E := by + by_contra hgH + have hgW : g ∈ W.E := (show g ∈ H.E ∪ W.E from hu.hE ▸ hgJ).resolve_left hgH + have h₁ : v ∈ closure g ∩ J.V := hl.2.2.2 ▸ mem_insert _ _ + rw [← hWJ.closure_inter_V hgW] at h₁ + exact hvC (hcap ▸ ⟨hU (H.V_subset_U hv), hw.Usub (W.V_subset_U h₁.2)⟩) + by_contra hge + have hc : closure g ∩ J.V = {v, y} := hl.2.2.2 + rw [← hHJ.closure_inter_V hgH] at hc + have hy : y ∈ H.V := (show y ∈ closure g ∩ H.V from hc ▸ mem_insert_of_mem _ rfl).2 + exact hno g hge ⟨y, hgH, hv, hy, hc⟩ + obtain ⟨y, hl⟩ := he + have hlJ : J.toGraph.IsLink e v y := by + refine ⟨hHJ.2 heE, hHJ.1 hv, hHJ.1 hl.2.2.1, ?_⟩ + rw [← hHJ.closure_inter_V heE] + exact hl.2.2.2 + have hb : Whitney.bdry J.toGraph {e} ⊆ {y} \ {v} := by + rintro z ⟨⟨_, (rfl : _ = e), hz⟩, ⟨g, ⟨hgE, hge⟩, hzg⟩⟩ + have hzv : z ≠ v := by + rintro rfl + exact hge (hJH g hzg) + obtain ⟨w, hw'⟩ := hz + rcases J.toGraph.eq_or_eq_of_isLink_of_isLink hw' hlJ with h | h + · exact absurd h hzv + · exact ⟨h, hzv⟩ + have hsub : Whitney.bdry J.toGraph {e} ⊆ {y} := hb.trans sdiff_subset + have hfin : (Whitney.bdry J.toGraph {e}).Finite := (finite_singleton y).subset hsub + have hcard : (Whitney.bdry J.toGraph {e}).ncard ≤ 2 := by + have := ncard_le_ncard hsub (finite_singleton y) + rw [ncard_singleton] at this + omega + obtain ⟨x, y', -, hxy, hbd, -⟩ := exists_thread hf hrr hS hsph (singleton_subset_iff.mpr heE) + hcard hfin (singleton_nonempty e) + have h₁ : x ∈ ({y} : Set T) := hsub (hbd ▸ mem_insert _ _) + have h₂ : y' ∈ ({y} : Set T) := hsub (hbd ▸ mem_insert_of_mem _ rfl) + exact hxy (h₁.trans h₂.symm) + +/-- Claim (1) of (6.5), with the wheel built in. -/ +theorem three_paths_sphere (hS : IsClosedSurface T) (hsph : IsSphere T) + {D₁ D₂ C : Set T} (hd₁ : IsClosedDisc D₁) (hd₂ : IsClosedDisc D₂) (hb₁ : discBd D₁ = C) + (hb₂ : discBd D₂ = C) (hcov : D₁ ∪ D₂ = univ) (hcap : D₁ ∩ D₂ = C) {H : Drawing T} + (hU : H.U ⊆ D₁) (hn : H.U ∩ C ⊆ H.V) (hr : IsRigidIn H D₁) {R : Drawing T} + (hR : R.IsCircuit) (hRH : R.IsSubdrawing H) : + ∃ Q : Fin 3 → Graph T (Set T), Pairwise (fun i j => Disjoint V(Q i) V(Q j)) ∧ + ∀ i, IsFromToPath H.toGraph (Q i) R.V (H.V ∩ C) := by + classical + obtain ⟨W, a, Γ', hm, hw, hf, hrr, -, -, haD₁, -, hhub⟩ := + exists_frame hS hsph hd₁ hd₂ hb₁ hb₂ hcov hcap hU hn hr + have hu : IsUnion H W (H.glue W hm) := isUnion_glue hm + have hsb : subBd D₁ = C := (IsClosedDisc.subBd_eq_discBd hS hd₁).trans hb₁ + have hgood := good_of_wheel hf hrr hw hu + (fun v hv hvW => ⟨hv, by + have : v ∈ D₁ ∩ D₂ := ⟨hU (H.V_subset_U hv), hw.Usub (W.V_subset_U hvW)⟩ + rwa [hcap] at this⟩) hm hS hsph + obtain ⟨G₀, Q₀, hsd⟩ := exists_subData (good_sub hgood) + generalize hJ : H.glue W hm = J at hu hf hrr hgood hsd + have hWJ : W.IsSubdrawing J := ⟨hu.hV ▸ subset_union_right, hu.hE ▸ subset_union_right⟩ + have hB' : ∀ v ∈ H.V, ∀ g ∈ J.E, g ∉ H.E → v ∈ closure g → v ∈ subBd D₁ := by + intro v hv g hg hgH hvg + have hgW : g ∈ W.E := (show g ∈ H.E ∪ W.E from hu.hE ▸ hg).resolve_left hgH + have h₂ : v ∈ closure g ∩ J.V := ⟨hvg, hf.Vsub hv⟩ + rw [← hWJ.closure_inter_V hgW] at h₂ + rw [hsb] + exact hcap ▸ ⟨hU (H.V_subset_U hv), hw.Usub (W.V_subset_U h₂.2)⟩ + have := claim_1_three_paths hf hrr hS hsph hsd hB' hR hRH + rwa [hsb] at this + +end Sphere + +section Move + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- The image of a drawing has the same graph. -/ +theorem gmap_mapD {T : Type*} [TopologicalSpace T] [T2Space T] {A : Set S} {B : Set T} {f : S → T} + {f' : T → S} (hP : PH A B f f') (hA : IsCompact A) (H : Drawing S) (hU : H.U ⊆ A) : + GMap H.toGraph (mapD hP hA H hU).toGraph f (image f) := by + have hVA : H.V ⊆ A := H.V_subset_U.trans hU + have heA : ∀ {e}, e ∈ H.E → e ⊆ A := fun he => subset_closure.trans + ((H.closure_subset_U he).trans hU) + refine ⟨⟨fun x hx => mem_image_of_mem f hx, hP.injOn.mono hVA, fun y hy => hy⟩, + ⟨fun e he => ?_, ?_, ?_⟩, ?_⟩ + · change image f e ∈ (mapD hP hA H hU).E + rw [mapD_E] + exact mem_image_of_mem _ he + · intro e he e' he' h + have h₁ := hP.back (heA he) + have h₂ := hP.back (heA he') + change f '' e = f '' e' at h + rw [← h₁, ← h₂, h] + · intro e' he' + change e' ∈ (mapD hP hA H hU).E at he' + rw [mapD_E] at he' + exact he' + · intro e x y he hx hy + have hcap : closure (f '' e) ∩ f '' H.V = f '' (closure e ∩ H.V) := cap_image_eq hP hA + (heA he) hVA + have hcl : closure e ⊆ A := closure_minimal (heA he) hA.isClosed + change (e ∈ H.E ∧ x ∈ H.V ∧ y ∈ H.V ∧ closure e ∩ H.V = {x, y}) ↔ + (image f e ∈ (mapD hP hA H hU).E ∧ f x ∈ f '' H.V ∧ f y ∈ f '' H.V ∧ + closure (f '' e) ∩ f '' H.V = {f x, f y}) + rw [hcap, ← image_pair] + constructor + · rintro ⟨-, -, -, h⟩ + refine ⟨?_, mem_image_of_mem f hx, mem_image_of_mem f hy, by rw [h]⟩ + rw [mapD_E] + exact mem_image_of_mem _ he + · rintro ⟨-, -, -, h⟩ + refine ⟨he, hx, hy, ?_⟩ + have hi : InjOn f A := hP.injOn + refine (hi.image_eq_image_iff ?_ ?_).mp h + · exact inter_subset_left.trans hcl + · rintro z (rfl | rfl) + · exact hVA hx + · exact hVA hy + +variable {α : Type*} {β : Type*} {α' : Type*} {β' : Type*} + +theorem GMap.symm_image {G : Graph α β} {G' : Graph α' β'} {f : α → α'} {g : β → β'} + [Nonempty α] (m : GMap G G' f g) {Z : Set α} (hZ : Z ⊆ V(G)) : + Function.invFunOn f V(G) '' (f '' Z) = Z := by + rw [image_image] + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + change Function.invFunOn f V(G) (f z) ∈ Z + rw [m.bijV.invOn_invFunOn.1 (hZ hz)] + exact hz + · intro hx + exact ⟨x, hx, m.bijV.invOn_invFunOn.1 (hZ hx)⟩ + +omit [T2Space S] in +/-- A closed disc of `S`, as a closed disc of a sphere. -/ +theorem exists_sphere_model {Δ : Set S} (hΔ : IsClosedDisc Δ) (hbdΔ : subBd Δ = discBd Δ) : + ∃ (D₁ D₂ C : Set (OnePoint EuclideanPlane)) (f : S → OnePoint EuclideanPlane) + (f' : OnePoint EuclideanPlane → S), IsClosedDisc D₁ ∧ IsClosedDisc D₂ ∧ discBd D₁ = C ∧ + discBd D₂ = C ∧ D₁ ∪ D₂ = univ ∧ D₁ ∩ D₂ = C ∧ PH Δ D₁ f f' ∧ subBd D₁ = C ∧ + (∀ x ∈ Δ, f x ∈ C ↔ x ∈ subBd Δ) ∧ f '' subBd Δ ⊆ subBd D₁ ∧ f' '' subBd D₁ ⊆ subBd Δ := by + have hsph : IsSphere (OnePoint EuclideanPlane) := ⟨Homeomorph.refl _⟩ + obtain ⟨hS, hconn⟩ := GraphMinor.GM11.IsSphere.isClosedSurface hsph + have hO : IsOArc (sph '' Metric.sphere (0 : ℂ) 1) := + isOArc_image isOpenEmbedding_sph.isEmbedding oArc_sphere + obtain ⟨D₁, D₂, -, hd₁, hd₂, hb₁, hb₂, hcov, hcap, -, -⟩ := sphere_disc _ hsph _ hO + generalize sph '' Metric.sphere (0 : ℂ) 1 = C at hO hb₁ hb₂ hcap + obtain ⟨f, f', hP, hf₁, hf₂⟩ := exists_disc_map hΔ hd₁ + have hsbD : subBd D₁ = C := (IsClosedDisc.subBd_eq_discBd hS hd₁).trans hb₁ + have hbd : f '' subBd Δ ⊆ subBd D₁ := by + rw [hbdΔ, IsClosedDisc.subBd_eq_discBd hS hd₁] + exact hf₁ + have hbd' : f' '' subBd D₁ ⊆ subBd Δ := by + rw [hbdΔ, IsClosedDisc.subBd_eq_discBd hS hd₁] + exact hf₂ + refine ⟨D₁, D₂, C, f, f', hd₁, hd₂, hb₁, hb₂, hcov, hcap, hP, hsbD, fun x hx => ⟨fun h => ?_, + fun h => hsbD ▸ hbd (mem_image_of_mem f h)⟩, hbd, hbd'⟩ + have h₁ := hbd' (mem_image_of_mem f' (hsbD.symm ▸ h)) + rwa [hP.left hx] at h₁ + +variable {Δ : Set S} {H : Drawing S} + +/-- **Claim (1) of (6.5).** A circuit of a drawing that is rigid in a closed disc has three disjoint +paths to the boundary. -/ +theorem three_paths_of_rigid (hΔ : IsClosedDisc Δ) (hbdΔ : subBd Δ = discBd Δ) (hHΔ : H.U ⊆ Δ) + (hHbd : H.U ∩ subBd Δ ⊆ H.V) (hrigid : IsRigidIn H Δ) {R : Drawing S} (hR : R.IsCircuit) + (hRH : R.IsSubdrawing H) : + ∃ Q : Fin 3 → Graph S (Set S), Pairwise (fun i j => Disjoint V(Q i) V(Q j)) ∧ + ∀ i, IsFromToPath H.toGraph (Q i) R.V (H.V ∩ subBd Δ) := by + classical + have hsph : IsSphere (OnePoint EuclideanPlane) := ⟨Homeomorph.refl _⟩ + obtain ⟨hS, hconn⟩ := GraphMinor.GM11.IsSphere.isClosedSurface hsph + obtain ⟨D₁, D₂, C, f, f', hd₁, hd₂, hb₁, hb₂, hcov, hcap, hP, hsbD, hiff, hbd, hbd'⟩ := + exists_sphere_model hΔ hbdΔ + have hAc : IsCompact Δ := hΔ.isCompact + have hBc : IsCompact D₁ := hd₁.isCompact + have hRU : R.U ⊆ Δ := hRH.U_subset.trans hHΔ + let M := mapD hP hAc H hHΔ + let R' := mapD hP hAc R hRU + have hVΔ : H.V ⊆ Δ := H.V_subset_U.trans hHΔ + have hMn : M.U ∩ C ⊆ M.V := by + rintro _ ⟨⟨x, hx, rfl⟩, hxC⟩ + exact mem_image_of_mem f (hHbd ⟨hx, (hiff x (hHΔ hx)).mp hxC⟩) + have hMr : IsRigidIn M D₁ := isRigidIn_mapD hP hAc hbd hbd' H hHΔ hrigid + have hR'M : R'.IsSubdrawing M := by + refine ⟨image_mono hRH.1, ?_⟩ + change (mapD hP hAc R hRU).E ⊆ (mapD hP hAc H hHΔ).E + rw [mapD_E, mapD_E] + exact image_mono hRH.2 + have hR' : R'.IsCircuit := by + obtain ⟨u, W, ⟨hs, hd⟩, hlen, hV, hE⟩ := hR + have mR := gmap_mapD hP hAc R hRU + obtain ⟨W', h₁, h₂⟩ := exists_walk_image + (fun {e x y} h => (mR.link h.edge_mem h.left_mem h.right_mem).mp h) + (fun x hx => mR.bijV.mapsTo hx) W + refine ⟨f u, W', ⟨?_, ?_⟩, ?_, ?_, ?_⟩ + · rw [h₁, ← List.map_tail] + refine hs.map_on fun x hx y hy hxy => ?_ + exact mR.bijV.injOn (mem_of_mem_walk W (List.mem_of_mem_tail hx)) + (mem_of_mem_walk W (List.mem_of_mem_tail hy)) hxy + · rw [h₂] + refine hd.map_on fun x hx y hy hxy => ?_ + exact mR.bijE.injOn (hE ▸ hx : x ∈ R.E) (hE ▸ hy : y ∈ R.E) hxy + · change 0 < W'.edges.length + rw [h₂, List.length_map] + exact hlen + · change f '' R.V = _ + rw [hV, h₁] + ext z + simp + · change (mapD hP hAc R hRU).E = _ + rw [mapD_E, hE, h₂] + ext z + simp + obtain ⟨Q', hdis, hQ'⟩ := three_paths_sphere hS hsph hd₁ hd₂ hb₁ hb₂ hcov hcap + (hP.image_sub hHΔ) hMn hMr hR' hR'M + obtain ⟨u, -, -, -, -, -⟩ := id hR + have : Nonempty S := ⟨u⟩ + have m := gmap_mapD hP hAc H hHΔ + have ms := m.symm + have hRV : R.V ⊆ H.V := hRH.1 + have hcapV : M.V ∩ C = f '' (H.V ∩ subBd Δ) := by + ext y + constructor + · rintro ⟨⟨x, hx, rfl⟩, hxC⟩ + exact ⟨x, ⟨hx, (hiff x (hVΔ hx)).mp hxC⟩, rfl⟩ + · rintro ⟨x, ⟨hx, hxb⟩, rfl⟩ + exact ⟨mem_image_of_mem f hx, (hiff x (hVΔ hx)).mpr hxb⟩ + refine ⟨fun i => ms.sub (Q' i), ?_, fun i => ?_⟩ + · intro i j hij + obtain ⟨_, _, hPi⟩ := hQ' i + obtain ⟨_, _, hPj⟩ := hQ' j + change Disjoint (Function.invFunOn f H.V '' V(Q' i)) (Function.invFunOn f H.V '' V(Q' j)) + refine disjoint_left.mpr ?_ + rintro _ ⟨a, ha, rfl⟩ ⟨b, hb, hab⟩ + have hab' := ms.bijV.injOn (hPj.1.1.vertexSet_mono hb) (hPi.1.1.vertexSet_mono ha) hab + exact disjoint_left.mp (hdis hij) ha (hab' ▸ hb) + · obtain ⟨a, b, hPi⟩ := hQ' i + have h := ms.fromTo (image_mono hRH.1) (inter_subset_left.trans (Subset.rfl)) hPi + have e₁ : Function.invFunOn f H.V '' (f '' R.V) = R.V := m.symm_image hRV + have e₂ : Function.invFunOn f H.V '' (M.V ∩ C) = H.V ∩ subBd Δ := by + rw [hcapV] + exact m.symm_image inter_subset_left + change IsFromToPathWithEnds H.toGraph _ (Function.invFunOn f H.V '' (f '' R.V)) + (Function.invFunOn f H.V '' (M.V ∩ C)) _ _ at h + rw [e₁, e₂] at h + exact ⟨_, _, h⟩ + +/-- A vertex off the boundary of a closed disc does not lie on just one edge, if the drawing is +rigid +in the disc. -/ +theorem two_edges_of_rigid (hΔ : IsClosedDisc Δ) (hbdΔ : subBd Δ = discBd Δ) (hHΔ : H.U ⊆ Δ) + (hHbd : H.U ∩ subBd Δ ⊆ H.V) (hrigid : IsRigidIn H Δ) {v : S} (hv : v ∈ H.V) + (hvb : v ∉ subBd Δ) {e : Set S} (he : H.toGraph.Inc e v) : + ∃ e', e' ≠ e ∧ H.toGraph.Inc e' v := by + classical + have hsph : IsSphere (OnePoint EuclideanPlane) := ⟨Homeomorph.refl _⟩ + obtain ⟨hS, hconn⟩ := GraphMinor.GM11.IsSphere.isClosedSurface hsph + obtain ⟨D₁, D₂, C, f, f', hd₁, hd₂, hb₁, hb₂, hcov, hcap, hP, hsbD, hiff, hbd, hbd'⟩ := + exists_sphere_model hΔ hbdΔ + have hAc : IsCompact Δ := hΔ.isCompact + have hBc : IsCompact D₁ := hd₁.isCompact + let M := mapD hP hAc H hHΔ + have hVΔ : H.V ⊆ Δ := H.V_subset_U.trans hHΔ + have hMn : M.U ∩ C ⊆ M.V := by + rintro _ ⟨⟨x, hx, rfl⟩, hxC⟩ + exact mem_image_of_mem f (hHbd ⟨hx, (hiff x (hHΔ hx)).mp hxC⟩) + have hMr : IsRigidIn M D₁ := isRigidIn_mapD hP hAc hbd hbd' H hHΔ hrigid + have m := gmap_mapD hP hAc H hHΔ + obtain ⟨y, hl⟩ := he + have hl' := (m.link hl.edge_mem hl.left_mem hl.right_mem).mp hl + obtain ⟨g, hge, z, hg⟩ := two_edges_sphere hS hsph hd₁ hd₂ hb₁ hb₂ hcov hcap + (hP.image_sub hHΔ) hMn hMr (mem_image_of_mem f hv) + (fun h => hvb ((hiff v (hVΔ hv)).mp h)) ⟨_, hl'⟩ + obtain ⟨e', he', rfl⟩ := m.bijE.surjOn hg.edge_mem + obtain ⟨z', hz', rfl⟩ := m.bijV.surjOn hg.right_mem + refine ⟨e', fun h => hge (h ▸ rfl), z', ?_⟩ + exact (m.link he' hv hz').mpr hg + +end Move + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/RigidExtension.lean b/LeanPool/GraphMinor/GM14/RigidExtension.lean new file mode 100644 index 0000000000..24445988a9 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/RigidExtension.lean @@ -0,0 +1,222 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.RigidSphere +public import LeanPool.GraphMinor.GM14.RigidMap +import LeanPool.GraphMinor.GM11.PerimeterPull +import LeanPool.GraphMinor.Surface.Schoenflies +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.Surface.SphereDisc +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.AddCrosscap + +/-! +# (6.4) + +We move the drawings in `Δ` to one of the two closed discs of the unit circle in the sphere, apply +`sphere_core` there, and move the homeomorphism back. It is the identity off `Δ` (`exists_extend`). +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Topology Graph Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +/-- A homeomorphism of a closed set that fixes its frontier extends by the identity. -/ +theorem exists_extend {X : Type u} [TopologicalSpace X] {Δ : Set X} (hc : IsClosed Δ) {k k' : X → X} + (hP : PH Δ Δ k k') (hfix : ∀ x ∈ frontier Δ, k x = x) (hfix' : ∀ x ∈ frontier Δ, k' x = x) : + ∃ ψ : X ≃ₜ X, EqOn ψ k Δ ∧ ψ '' Δ = Δ := by + classical + have hcont : ∀ {j : X → X}, ContinuousOn j Δ → (∀ x ∈ frontier Δ, j x = x) → + Continuous fun x => if x ∈ Δ then j x else x := by + intro j hj hf + refine continuous_if (fun a ha => hf a ha) ?_ continuous_id.continuousOn + have : closure {x | x ∈ Δ} = Δ := hc.closure_eq + rw [this] + exact hj + have hi : ∀ {j j' : X → X}, PH Δ Δ j j' → ∀ x, (if (if x ∈ Δ then j x else x) ∈ Δ then + j' (if x ∈ Δ then j x else x) else (if x ∈ Δ then j x else x)) = x := by + intro j j' hj x + by_cases hx : x ∈ Δ + · simp only [hx, ite_true, hj.1 hx] + exact hj.2.2.1 hx + · simp [hx] + let ψ : X ≃ₜ X := + { toFun := fun x => if x ∈ Δ then k x else x + invFun := fun x => if x ∈ Δ then k' x else x + left_inv := hi hP + right_inv := hi hP.symm + continuous_toFun := hcont hP.2.2.2.2.1 hfix + continuous_invFun := hcont hP.2.2.2.2.2 hfix' } + have hEq : EqOn ψ k Δ := fun x hx => ite_eq_left hx + refine ⟨ψ, hEq, ?_⟩ + rw [hEq.image_eq] + exact hP.image_eq + +theorem chart_bd {W : Type*} [TopologicalSpace W] {E : Set W} {p : W → ℂ} {q : ℂ → W} + (ch : IsChart E p q) : q '' sphere 0 1 ⊆ discBd E := by + rintro _ ⟨z, hz, rfl⟩ + rw [← ch.bd] at hz + obtain ⟨w, hw, rfl⟩ := hz + rwa [ch.gh (Surface.discBd_subset E hw)] + +/-- Inverse homeomorphisms from any closed disc to a closed disc in another space, boundary to +boundary. -/ +theorem exists_disc_map {X : Type u} {Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] {D : Set + X} + {D' : Set Y} (hD : IsClosedDisc D) (hD' : IsClosedDisc D') : + ∃ f f', PH D D' f f' ∧ f '' discBd D ⊆ discBd D' ∧ f' '' discBd D' ⊆ discBd D := by + obtain ⟨a, b, c⟩ := hD.exists_isChart + obtain ⟨a', b', c'⟩ := hD'.exists_isChart + have h₁ : PH D (closedBall 0 1) a b := ⟨c.hm, c.gm, c.gh, c.hg, c.hc, c.gc⟩ + have h₂ : PH D' (closedBall 0 1) a' b' := ⟨c'.hm, c'.gm, c'.gh, c'.hg, c'.hc, c'.gc⟩ + refine ⟨b' ∘ a, b ∘ a', h₁.comp h₂.symm, ?_, ?_⟩ + · rw [image_comp] + refine Subset.trans (image_mono ?_) (chart_bd c') + rw [c.bd] + · rw [image_comp] + refine Subset.trans (image_mono ?_) (chart_bd c) + rw [c'.bd] + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- **Graph Minors XIV, (6.4)** (page 34), in the form that its use in (6.5) needs. -/ +theorem extension_64 {Δ : Set S} (hΔ : IsClosedDisc Δ) (hbdΔ : subBd Δ + = discBd Δ) {H₁ H₂ : Drawing S} + (hU₁ : H₁.U ⊆ Δ) (hU₂ : H₂.U ⊆ Δ) (hn₁ : H₁.U ∩ subBd Δ ⊆ H₁.V) (hn₂ : H₂.U ∩ subBd Δ ⊆ H₂.V) + (hV : H₁.V ∩ subBd Δ = H₂.V ∩ subBd Δ) (φ : Iso H₁.toGraph H₂.toGraph) + (hφ : ∀ v : V(H₁.toGraph), v.1 ∈ subBd Δ → (φ.vertexEquiv v).1 = v.1) + (hr : ∀ F : Set S, F ⊆ Δ → IsOArc F → F ∩ H₁.U ⊆ H₁.V → (F ∩ H₁.V).ncard ≤ 2 → + ∃ Δ' : Set S, Δ' ⊆ Δ ∧ IsDial H₁ F Δ') : + ∃ ψ : S ≃ₜ S, ψ '' Δ = Δ ∧ (∀ x ∈ subBd Δ, ψ x = x) ∧ + (∀ v : V(H₁.toGraph), ψ v.1 = (φ.vertexEquiv v).1) ∧ + ∀ e : E(H₁.toGraph), ψ '' e.1 = (φ.edgeEquiv e).1 := by + classical + let T := OnePoint EuclideanPlane + have hsph : IsSphere T := ⟨Homeomorph.refl _⟩ + obtain ⟨hS, hconn⟩ := IsSphere.isClosedSurface hsph + have hSurf : IsSurface T := hS.isSurface + have hO : IsOArc (sph '' sphere (0 : ℂ) 1) := + isOArc_image isOpenEmbedding_sph.isEmbedding oArc_sphere + obtain ⟨D₁, D₂, -, hd₁, hd₂, hb₁, hb₂, hcov, hcap, -, -⟩ := sphere_disc T hsph _ hO + set C : Set T := sph '' sphere (0 : ℂ) 1 with hC + obtain ⟨f, f', hP, hf₁, hf₂⟩ := exists_disc_map hΔ hd₁ + have hAc : IsCompact Δ := hΔ.isCompact + have hBc : IsCompact D₁ := hd₁.isCompact + have hsbD : subBd D₁ = C := (IsClosedDisc.subBd_eq_discBd hS hd₁).trans hb₁ + have hfC : ∀ {x}, x ∈ subBd Δ → f x ∈ C := fun {x} hx => by + have h₁ : x ∈ discBd Δ := hbdΔ ▸ hx + rw [← hb₁] + exact hf₁ (mem_image_of_mem f h₁) + have hfC' : ∀ {y}, y ∈ C → f' y ∈ subBd Δ := fun {y} hy => by + rw [← hb₁] at hy + rw [hbdΔ] + exact hf₂ (mem_image_of_mem f' hy) + have hsubΔ : subBd Δ ⊆ Δ := by + rw [hbdΔ] + exact Surface.discBd_subset Δ + have hCD : C ⊆ D₁ := by + rw [← hb₁] + exact Surface.discBd_subset D₁ + have hcapi : ∀ {H : Drawing S}, H.U ⊆ Δ → H.U ∩ subBd Δ ⊆ H.V → f '' H.U ∩ C ⊆ f '' H.V := by + rintro H hH hn _ ⟨⟨x, hx, rfl⟩, hxC⟩ + have h₁ := hfC' hxC + rw [hP.left (hH hx)] at h₁ + exact mem_image_of_mem f (hn ⟨hx, h₁⟩) + have hVi : ∀ {H H' : Drawing S}, H.U ⊆ Δ → H.V ∩ subBd Δ = H'.V ∩ subBd Δ → + f '' H.V ∩ C ⊆ f '' H'.V ∩ C := by + rintro H H' hH hv _ ⟨⟨x, hx, rfl⟩, hxC⟩ + have h₁ := hfC' hxC + rw [hP.left (hH (H.V_subset_U hx))] at h₁ + have h₂ : x ∈ H'.V ∩ subBd Δ := hv ▸ ⟨hx, h₁⟩ + exact ⟨mem_image_of_mem f h₂.1, hxC⟩ + let M₁ := mapD hP hAc H₁ hU₁ + let M₂ := mapD hP hAc H₂ hU₂ + let ι₁ := mapIso hP hAc H₁ hU₁ + let ι₂ := mapIso hP hAc H₂ hU₂ + let φ' : Iso M₁.toGraph M₂.toGraph := + { vertexEquiv := ι₁.vertexEquiv.symm.trans (φ.vertexEquiv.trans ι₂.vertexEquiv) + edgeEquiv := ι₁.edgeEquiv.symm.trans (φ.edgeEquiv.trans ι₂.edgeEquiv) + isLink_iff := by + intro e x y + obtain ⟨e₀, rfl⟩ := ι₁.edgeEquiv.surjective e + obtain ⟨x₀, rfl⟩ := ι₁.vertexEquiv.surjective x + obtain ⟨y₀, rfl⟩ := ι₁.vertexEquiv.surjective y + simp only [Equiv.trans_apply, Equiv.symm_apply_apply] + rw [← ι₁.isLink_iff, ← ι₂.isLink_iff, ← φ.isLink_iff] } + have hφ'v : ∀ v : V(H₁.toGraph), (φ'.vertexEquiv (ι₁.vertexEquiv v)).1 = f (φ.vertexEquiv v).1 + := by + intro v + change (ι₂.vertexEquiv (φ.vertexEquiv (ι₁.vertexEquiv.symm (ι₁.vertexEquiv v)))).1 = _ + rw [Equiv.symm_apply_apply] + exact mapIso_vertex hP hAc H₂ hU₂ _ + have hφ'e : ∀ e : E(H₁.toGraph), (φ'.edgeEquiv (ι₁.edgeEquiv e)).1 = f '' (φ.edgeEquiv e).1 := by + intro e + change (ι₂.edgeEquiv (φ.edgeEquiv (ι₁.edgeEquiv.symm (ι₁.edgeEquiv e)))).1 = _ + rw [Equiv.symm_apply_apply] + exact mapIso_edge hP hAc H₂ hU₂ _ + obtain ⟨h, hhD, hhC, hhV, hhE⟩ := sphere_core hSurf hS hsph hd₁ hd₂ hb₁ hb₂ hcov hcap + (H₁ := M₁) (H₂ := M₂) (hP.image_sub hU₁) (hP.image_sub hU₂) (hcapi hU₁ hn₁) (hcapi hU₂ hn₂) + (subset_antisymm (hVi hU₁ hV) (hVi hU₂ hV.symm)) φ' + (by + intro w hw + have hv : ι₁.vertexEquiv (ι₁.vertexEquiv.symm w) = w := Equiv.apply_symm_apply _ _ + obtain ⟨v, rfl⟩ : ∃ v, w = ι₁.vertexEquiv v := ⟨_, hv.symm⟩ + have hvb : v.1 ∈ subBd Δ := by + have h₁ : f v.1 ∈ C := hw + have h₂ := hfC' h₁ + rwa [hP.left (hU₁ (H₁.V_subset_U v.2))] at h₂ + rw [hφ'v, hφ v hvb] + rfl) + (isRigidIn_mapD hP hAc (by rw [hsbD]; exact image_subset_iff.mpr fun _ hx => hfC hx) + (by rw [hsbD]; exact image_subset_iff.mpr fun _ hx => hfC' hx) H₁ hU₁ hr) + have hH : PH D₁ D₁ h h.symm := by + refine ⟨?_, ?_, fun x _ => h.symm_apply_apply x, fun x _ => h.apply_symm_apply x, + h.continuous.continuousOn, h.symm.continuous.continuousOn⟩ + · exact fun x hx => hhD ▸ mem_image_of_mem h hx + · intro y hy + rw [← hhD] at hy + obtain ⟨x, hx, rfl⟩ := hy + simpa using hx + have hk := (hP.comp hH).comp hP.symm + have hfix : ∀ x ∈ subBd Δ, f' (h (f x)) = x := fun x hx => by + rw [hhC _ (hfC hx)] + exact hP.left (hsubΔ hx) + have hfix' : ∀ x ∈ subBd Δ, f' (h.symm (f x)) = x := fun x hx => by + have : h.symm (f x) = f x := by + rw [Homeomorph.symm_apply_eq] + exact (hhC _ (hfC hx)).symm + rw [this] + exact hP.left (hsubΔ hx) + obtain ⟨ψ, hψ, hψD⟩ := exists_extend hΔ.isClosed hk + (fun x hx => hfix x (subBd_eq_frontier Δ ▸ hx)) + (fun x hx => hfix' x (subBd_eq_frontier Δ ▸ hx)) + refine ⟨ψ, hψD, fun x hx => ?_, fun v => ?_, fun e => ?_⟩ + · rw [hψ (hsubΔ hx)] + exact hfix x hx + · have hvΔ := hU₁ (H₁.V_subset_U v.2) + rw [hψ hvΔ] + change f' (h (f v.1)) = _ + have h₁ := hhV (ι₁.vertexEquiv v) + change h (f v.1) = _ at h₁ + rw [h₁, hφ'v, hP.left (hU₂ (H₂.V_subset_U (φ.vertexEquiv v).2))] + · have heΔ : e.1 ⊆ Δ := cap_image H₁ hU₁ e.2 + have he₂ : (φ.edgeEquiv e).1 ⊆ Δ := cap_image H₂ hU₂ (φ.edgeEquiv e).2 + rw [hψ.mono heΔ |>.image_eq] + change (f' ∘ (h ∘ f)) '' e.1 = _ + rw [image_comp, image_comp] + have h₁ := hhE (ι₁.edgeEquiv e) + change h '' (f '' e.1) = _ at h₁ + rw [h₁, hφ'e, hP.back he₂] + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM14/RigidFinger.lean b/LeanPool/GraphMinor/GM14/RigidFinger.lean new file mode 100644 index 0000000000..4f64efb203 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/RigidFinger.lean @@ -0,0 +1,883 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.RigidMap +import LeanPool.GraphMinor.GM11.ArcDrawings +import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.GM11.PerimeterPull +import LeanPool.GraphMinor.GM11.EdgeSides +import LeanPool.GraphMinor.Surface.SphereDisc +import LeanPool.GraphMinor.GM12.Section4ParallelLine +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.Surface.Cap +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.DiscUnion +import LeanPool.GraphMinor.Surface.Lunes +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.Surface.PushOff + +/-! +# A finger of a closed disc + +Let `E` be a closed disc in a closed surface, let `K ⊆ E` be compact, and let `x ∈ K` be off +`bd(E)`. Let a +line run from a point outside `E` to `x`, and meet `K` only in `x`. We remove from `E` a thin finger +along the +line, up to `x`. Then `E` stays a closed disc that holds `K`, and `x` joins the points of `K` on the +boundary +(`exists_finger`). We repeat this in `exists_disc_around`, to bring a finite set of points of `K` to +the +boundary. + +To make the finger, take a parallel copy of the line, by `exists_parallel_line`. The last parts of +the two +lines, from where they enter `E`, form a chord through `x`. In one half of `E` we use coordinates in +which +the chord is straight. In those coordinates the finger is the region under a graph, of height at +most half +the distance to `K`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {T : Type u} [TopologicalSpace T] + +/-- The last part of a line that ends inside a closed disc and starts outside it. -/ +theorem exists_last_part (hS : IsClosedSurface T) {E ℓ : Set T} {p x : T} (hE : IsClosedDisc E) + (hℓ : IsLineWithEnds ℓ p x) (hp : p ∉ E) (hx : x ∈ E) (hxb : x ∉ discBd E) : + ∃ (z : T) (ℓ' : Set T), z ∈ discBd E ∧ IsLineWithEnds ℓ' z x ∧ ℓ' ⊆ ℓ ∧ ℓ' ⊆ E ∧ + ℓ' ∩ discBd E = {z} := by + have ht2 : T2Space T := hS.2.1 + have hfr : frontier E = discBd E := IsClosedDisc.frontier_eq_discBd hS hE + have hin : ∀ {y}, y ∈ E → y ∉ discBd E → y ∈ interior E := fun {y} hy hyb => by + by_contra hn + apply hyb + rw [← hfr, frontier, hE.isClosed.closure_eq] + exact ⟨hy, hn⟩ + obtain ⟨f, h0, h1⟩ := hℓ + let γ : ℝ → T := fun t => (f (projIcc 0 1 zero_le_one t)).1 + have hγc : Continuous γ := + continuous_subtype_val.comp (f.continuous.comp continuous_projIcc) + have hγi : InjOn γ (Icc 0 1) := fun s hs t ht h => by + have := f.injective (Subtype.ext h) + have h₃ := congrArg Subtype.val this + simpa [projIcc_of_mem zero_le_one hs, projIcc_of_mem zero_le_one ht] using h₃ + have hγ0 : γ 0 = p := by simpa [γ] using h0 + have hγ1 : γ 1 = x := by simpa [γ] using h1 + let C : Set ℝ := Icc 0 1 ∩ γ ⁻¹' (interior E)ᶜ + have hCc : IsCompact C := + isCompact_Icc.inter_right (isOpen_interior.isClosed_compl.preimage hγc) + have hCne : C.Nonempty := ⟨0, ⟨by simp, by + rw [mem_preimage, hγ0] + exact fun h => hp (interior_subset h)⟩⟩ + obtain ⟨t₀, ht₀, hmax⟩ := hCc.exists_isGreatest hCne |>.imp fun _ h => h + have ht₁ : t₀ < 1 := by + refine lt_of_le_of_ne ht₀.1.2 fun h => ?_ + have := ht₀.2 + rw [mem_preimage, h, hγ1] at this + exact this (hin hx hxb) + have hafter : ∀ t, t₀ < t → t ≤ 1 → γ t ∈ interior E := fun t h₁ h₂ => by + by_contra hn + exact absurd (hmax ⟨⟨ht₀.1.1.trans h₁.le, h₂⟩, hn⟩) (not_le.mpr h₁) + have hin_E : ∀ t ∈ Icc t₀ 1, γ t ∈ E := by + intro t ht + have hsub : Ioc t₀ 1 ⊆ γ ⁻¹' E := fun s hs => by + have h₁ : γ s ∈ E := interior_subset (hafter s hs.1 hs.2) + exact h₁ + have hcl : Icc t₀ 1 ⊆ closure (Ioc t₀ 1) := by + rw [closure_Ioc ht₁.ne] + exact closure_minimal hsub (hE.isClosed.preimage hγc) (hcl ht) + have hz : γ t₀ ∈ discBd E := by + rw [← hfr, frontier, hE.isClosed.closure_eq] + exact ⟨hin_E t₀ ⟨le_rfl, ht₁.le⟩, ht₀.2⟩ + have hsubI : Icc t₀ 1 ⊆ Icc 0 1 := Icc_subset_Icc_left ht₀.1.1 + refine ⟨γ t₀, γ '' Icc t₀ 1, hz, ?_, ?_, ?_, ?_⟩ + · have := isLine_of_injOn hγc ht₁ (hγi.mono hsubI) + rwa [hγ1] at this + · rintro _ ⟨t, -, rfl⟩ + exact (f _).2 + · exact image_subset_iff.mpr hin_E + · apply subset_antisymm + · rintro _ ⟨⟨t, ht, rfl⟩, htb⟩ + rcases ht.1.lt_or_eq with h | h + · have := hafter t h ht.2 + rw [← hfr] at htb + exact absurd this (disjoint_left.mp disjoint_interior_frontier · htb) + · rw [h] + rfl + · rintro _ rfl + exact ⟨⟨t₀, ⟨le_rfl, ht₁.le⟩, rfl⟩, hz⟩ + +theorem hl_start {L : Set T} {u v : T} (h : IsLineWithEnds L u v) : u ∈ L := by + obtain ⟨f, h0, -⟩ := h + exact h0 ▸ (f 0).2 + +theorem hl_end {L : Set T} {u v : T} (h : IsLineWithEnds L u v) : v ∈ L := by + obtain ⟨f, -, h1⟩ := h + exact h1 ▸ (f 1).2 + +/-- The upper rectangle. -/ +def Rect : Set ℂ := Icc (-1 : ℝ) 1 ×ℂ Icc (0 : ℝ) 1 + +/-- Its base. -/ +noncomputable def Base : Set ℂ := segment ℝ (-1 : ℂ) 1 + +theorem mem_Rect {z : ℂ} : z ∈ Rect ↔ z.re ∈ Icc (-1 : ℝ) 1 ∧ z.im ∈ Icc (0 : ℝ) 1 := Iff.rfl + +theorem mem_Base {z : ℂ} : z ∈ Base ↔ z.re ∈ Icc (-1 : ℝ) 1 ∧ z.im = 0 := by + constructor + · rintro ⟨a, b, ha, hb, hab, rfl⟩ + have h₁ : (a • (-1 : ℂ) + b • (1 : ℂ)).re = b - a := by simp; ring + rw [h₁] + refine ⟨⟨by linarith, by linarith⟩, by simp⟩ + · rintro ⟨⟨h₁, h₂⟩, h₃⟩ + refine ⟨(1 - z.re) / 2, (1 + z.re) / 2, by linarith, by linarith, by ring, ?_⟩ + apply Complex.ext + · simp + ring + · simp [h₃] + +theorem base_sub_frontier : Base ⊆ discBd Rect := by + have hb := (isClosedDisc_rect (a := -1) (b := 1) (c := 0) (d := 1) (by norm_num) (by norm_num)).2 + change Base ⊆ discBd (Icc (-1 : ℝ) 1 ×ℂ Icc (0 : ℝ) 1) + rw [hb, Complex.frontier_reProdIm] + rintro z hz + obtain ⟨h₁, h₂⟩ := mem_Base.mp hz + refine Or.inl ⟨?_, ?_⟩ + · change z.re ∈ closure _ + rw [closure_Icc] + exact h₁ + · change z.im ∈ frontier _ + rw [frontier_Icc (by norm_num : (0 : ℝ) ≤ 1)] + exact Or.inl h₂ + +/-- Coordinates on a closed disc in which a line of its boundary is the base of the rectangle. -/ +theorem exists_rect_chart [T2Space T] {Δ c : Set T} {a b : T} (hΔ : IsClosedDisc Δ) + (hc : IsLineWithEnds c a b) (hcb : c ⊆ discBd Δ) : + ∃ (f : T → ℂ) (f' : ℂ → T), PH Δ Rect f f' ∧ f '' c = Base ∧ f a = -1 ∧ f b = 1 := by + have hRd : IsClosedDisc Rect := + (isClosedDisc_rect (a := -1) (b := 1) (c := 0) (d := 1) (by norm_num) (by norm_num)).1 + have hB : IsLineWithEnds Base (-1) 1 := isLineWithEnds_segment (by norm_num) + obtain ⟨u, v, huv, hru, hu0, hu1, hun⟩ := exists_arcs_of_line hΔ.isOArc_discBd hc hcb + obtain ⟨u', v', huv', hru', hu0', hu1', hun'⟩ := + exists_arcs_of_line hRd.isOArc_discBd hB base_sub_frontier + have hl₁ : IsLineWithEnds (range v) a b := by + have := huv.arc_right.isLineWithEnds + rwa [huv.zero, huv.one, hu0, hu1] at this + have hl₂ : IsLineWithEnds (range v') (-1) 1 := by + have := huv'.arc_right.isLineWithEnds + rwa [huv'.zero, huv'.one, hu0', hu1'] at this + have hne : Nonempty T := ⟨a⟩ + obtain ⟨g₁, g₁', hP₁, ha₁, hb₁⟩ := exists_line_PH hc hB + obtain ⟨g₂, g₂', hP₂, ha₂, hb₂⟩ := exists_line_PH hl₁ hl₂ + have hmeet : ∀ {s t}, u s = v t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := fun {s t} h + => huv.meet s t h + have hmeet' : ∀ {s t}, u' s = v' t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := + fun {s t} h => huv'.meet s t h + have hend : ∀ {x}, x ∈ c → x ∈ range v → x = a ∨ x = b := by + rintro x hx ⟨t, rfl⟩ + rw [← hru] at hx + obtain ⟨s, hs⟩ := hx + rcases hmeet hs with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl (by rw [← hs, hu0]) + · exact Or.inr (by rw [← hs, hu1]) + have hend' : ∀ {x}, x ∈ Base → x ∈ range v' → x = -1 ∨ x = 1 := by + rintro x hx ⟨t, rfl⟩ + rw [← hru'] at hx + obtain ⟨s, hs⟩ := hx + rcases hmeet' hs with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl (by rw [← hs, hu0']) + · exact Or.inr (by rw [← hs, hu1']) + have hg₁' : g₁' (-1) = a := by + have := hP₁.2.2.1 (hl_start hc) + rwa [ha₁] at this + have hg₁'' : g₁' 1 = b := by + have := hP₁.2.2.1 (hl_end hc) + rwa [hb₁] at this + have hg₂' : g₂' (-1) = a := by + have := hP₂.2.2.1 (hl_start hl₁) + rwa [ha₂] at this + have hg₂'' : g₂' 1 = b := by + have := hP₂.2.2.1 (hl_end hl₁) + rwa [hb₂] at this + let A : Bool → Set T := fun i => if i then c else range v + let B' : Bool → Set ℂ := fun i => if i then Base else range v' + let k : Bool → T → ℂ := fun i => if i then g₁ else g₂ + let k' : Bool → ℂ → T := fun i => if i then g₁' else g₂' + obtain ⟨F, F', hF, hFe, hFe'⟩ := exists_glue (A := A) (B := B') (f := k) (f' := k') + (by + rintro (_ | _) + · exact (isCompact_range huv.arc_right.1).isClosed + · exact (hru ▸ isCompact_range huv.arc_left.1).isClosed) + (by + rintro (_ | _) + · exact (isCompact_range huv'.arc_right.1).isClosed + · exact (hru' ▸ isCompact_range huv'.arc_left.1).isClosed) + (by + rintro (_ | _) + · exact hP₂ + · exact hP₁) + (by + rintro (_ | _) (_ | _) x hx hx' + · rfl + · rcases hend hx' hx with rfl | rfl + · exact ha₂.trans ha₁.symm + · exact hb₂.trans hb₁.symm + · rcases hend hx hx' with rfl | rfl + · exact ha₁.trans ha₂.symm + · exact hb₁.trans hb₂.symm + · rfl) + (by + rintro (_ | _) (_ | _) x hx hx' + · rfl + · rcases hend' hx' hx with rfl | rfl + · exact hg₂'.trans hg₁'.symm + · exact hg₂''.trans hg₁''.symm + · rcases hend' hx hx' with rfl | rfl + · exact hg₁'.trans hg₂'.symm + · exact hg₁''.trans hg₂''.symm + · rfl) + have hUA : (⋃ i, A i) = discBd Δ := by + rw [← hun, hru] + ext z + simp only [mem_iUnion, Bool.exists_bool, A, mem_union] + simp [or_comm] + have hUB : (⋃ i, B' i) = discBd Rect := by + rw [← hun', hru'] + ext z + simp only [mem_iUnion, Bool.exists_bool, B', mem_union] + simp [or_comm] + rw [hUA, hUB] at hF + obtain ⟨f, f', hf, he, he'⟩ := exists_disc_PH hΔ hRd hF + have hcb' : ∀ {x}, x ∈ c → f x = g₁ x := fun {x} hx => by + rw [he (hcb hx)] + exact hFe true hx + refine ⟨f, f', hf, ?_, ?_, ?_⟩ + · rw [image_congr fun x hx => hcb' hx] + exact hP₁.image_eq + · rw [hcb' (hl_start hc), ha₁] + · rw [hcb' (hl_end hc), hb₁] + +section Graph + +variable {w : ℝ → ℝ} + +/-- The part of the rectangle over a graph. -/ +def Over (w : ℝ → ℝ) : Set ℂ := {z | z.re ∈ Icc (-1 : ℝ) 1 ∧ w z.re ≤ z.im ∧ z.im ≤ 1} + +/-- Pushing the rectangle up to the part over a graph. -/ +noncomputable def raise (w : ℝ → ℝ) (z : ℂ) : ℂ := ⟨z.re, w z.re + z.im * (1 - w z.re)⟩ + +/-- The inverse of `raise`. -/ +noncomputable def lower (w : ℝ → ℝ) (z : ℂ) : ℂ := ⟨z.re, (z.im - w z.re) / (1 - w z.re)⟩ + +theorem raise_PH (hw : Continuous w) (h1 : ∀ s, w s ≤ 1 / 2) : + PH Rect (Over w) (raise w) (lower w) := by + have hpos : ∀ s, 0 < 1 - w s := fun s => by linarith [h1 s] + have hmk : ∀ {a b : ℂ → ℝ}, Continuous a → Continuous b → + Continuous fun z : ℂ => (⟨a z, b z⟩ : ℂ) := fun ha hb => + Complex.equivRealProdCLM.symm.continuous.comp (ha.prodMk hb) + have hwc : Continuous fun z : ℂ => w z.re := hw.comp Complex.continuous_re + refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ + · rintro z ⟨h₁, h₂⟩ + refine ⟨h₁, ?_, ?_⟩ + · have := mul_nonneg h₂.1 (hpos z.re).le + change w z.re ≤ w z.re + z.im * (1 - w z.re) + linarith + · have := mul_nonneg (sub_nonneg.mpr h₂.2) (hpos z.re).le + change w z.re + z.im * (1 - w z.re) ≤ 1 + nlinarith + · rintro z ⟨h₁, h₂, h₃⟩ + refine ⟨h₁, ?_, ?_⟩ + · exact div_nonneg (sub_nonneg.mpr h₂) (hpos z.re).le + · exact (div_le_one (hpos z.re)).mpr (by linarith) + · intro z _ + apply Complex.ext + · rfl + · change (w z.re + z.im * (1 - w z.re) - w z.re) / (1 - w z.re) = z.im + field_simp [(hpos z.re).ne'] + ring + · intro z _ + apply Complex.ext + · rfl + · change w z.re + (z.im - w z.re) / (1 - w z.re) * (1 - w z.re) = z.im + field_simp [(hpos z.re).ne'] + ring + · exact (hmk Complex.continuous_re + (hwc.add (Complex.continuous_im.mul (continuous_const.sub hwc)))).continuousOn + · exact (hmk Complex.continuous_re + ((Complex.continuous_im.sub hwc).div (continuous_const.sub hwc) + fun z => (hpos z.re).ne')).continuousOn + +end Graph + +private theorem base_left_of_tip_avoids_obstacle + {T : Type u} + [TopologicalSpace T] + {K : Set T} + {ℓ : Set T} + {x : T} + (hℓK : ℓ ∩ K ⊆ {x}) + (z₁ : T) + (ℓ₁ : Set T) + (hl₁ : IsLineWithEnds ℓ₁ z₁ x) + (hsub₁ : ℓ₁ ⊆ ℓ) + (ℓ₂ : Set T) + (hxℓ₁ : x ∈ ℓ₁) + (Δ₁ : Set T) + (f : T → ℂ) + (f' : ℂ → T) + (hf : PH Δ₁ Rect f f') + (hfc : f '' (ℓ₁ ∪ ℓ₂) = Base) + (hf₁ : f z₁ = -1) + (hc_sub : ℓ₁ ∪ ℓ₂ ⊆ Δ₁) + (s₀ : ℝ) + (hfxe : f x = ↑s₀) : + ∀ s ∈ Ico (-1) s₀, ↑s ∉ (f '' (K ∩ Δ₁)) := by + let K' := f '' (K ∩ Δ₁) + rintro s ⟨h₁, h₂⟩ ⟨y, ⟨hyK, hyΔ⟩, hy⟩ + have hsub : Icc (-1 : ℝ) s₀ ⊆ Complex.re '' (f '' ℓ₁) := by + have hpre : IsPreconnected (Complex.re '' (f '' ℓ₁)) := by + have hlc : IsPreconnected ℓ₁ := by + obtain ⟨q, -, -⟩ := id hl₁ + have hr : range (fun c : unitInterval => (q c).1) = ℓ₁ := by + ext z + constructor + · rintro ⟨c, rfl⟩ + exact (q c).2 + · intro hz + exact ⟨q.symm ⟨z, hz⟩, by simp⟩ + rw [← hr] + exact isPreconnected_range (continuous_subtype_val.comp q.continuous) + have h₃ := hlc.image f (hf.2.2.2.2.1.mono (subset_union_left.trans hc_sub)) + exact h₃.image _ Complex.continuous_re.continuousOn + have ho := hpre.ordConnected + exact ho.out ⟨f z₁, mem_image_of_mem f (hl_start hl₁), by rw [hf₁]; simp⟩ + ⟨f x, mem_image_of_mem f hxℓ₁, by rw [hfxe]; simp⟩ + obtain ⟨_, ⟨q, hq, rfl⟩, hqe⟩ := hsub ⟨h₁, h₂.le⟩ + have hqb : f q ∈ Base := hfc ▸ mem_image_of_mem f (Or.inl hq) + have hqs : f q = (s : ℂ) := Complex.ext (by simpa using hqe) (by simpa using + (mem_Base.mp hqb).2) + have hqy : q = y := hf.injOn (hc_sub (Or.inl hq)) hyΔ (hqs.trans hy.symm) + subst hqy + have hqx : q = x := by + have := hℓK ⟨hsub₁ hq, hyK⟩ + exact this + rw [hqx, hfxe] at hqs + have : s₀ = s := by exact_mod_cast hqs + exact h₂.ne this.symm + +private theorem mem_right_base_segment + (s₀ : ℝ) + (hs₁ : s₀ < 1) : + ∀ {z : ℂ}, z ∈ segment ℝ (↑s₀) 1 ↔ z.re ∈ Icc s₀ 1 ∧ z.im = 0 := by + intro z + constructor + · rintro ⟨a, b, ha, hb, hab, rfl⟩ + have h₁ : (a • (s₀ : ℂ) + b • (1 : ℂ)).re = a * s₀ + b := by simp + rw [h₁] + refine ⟨⟨by nlinarith, by nlinarith⟩, by simp⟩ + · rintro ⟨⟨h₁, h₂⟩, h₃⟩ + have hd : 0 < 1 - s₀ := by linarith + have key : (1 - z.re) / (1 - s₀) * s₀ + (z.re - s₀) / (1 - s₀) = z.re := by + field_simp + ring + refine ⟨(1 - z.re) / (1 - s₀), (z.re - s₀) / (1 - s₀), div_nonneg (by linarith) hd.le, + div_nonneg (by linarith) hd.le, by field_simp; ring, ?_⟩ + apply Complex.ext + · rw [Complex.add_re, Complex.smul_re, Complex.smul_re] + simp only [Complex.ofReal_re, Complex.one_re, smul_eq_mul, mul_one] + exact key + · rw [Complex.add_im, Complex.smul_im, Complex.smul_im] + simp [h₃] + +private theorem raised_disc_meets_other_half_along_right_base + {T : Type u} + [TopologicalSpace T] + (ℓ₁ : Set T) + (ℓ₂ : Set T) + (Δ₁ : Set T) + (Δ₂ : Set T) + (hmeet : Δ₁ ∩ Δ₂ = ℓ₁ ∪ ℓ₂) + (hcbd₂ : ℓ₁ ∪ ℓ₂ ⊆ discBd Δ₂) + (f : T → ℂ) + (f' : ℂ → T) + (hf : PH Δ₁ Rect f f') + (hfc : f '' (ℓ₁ ∪ ℓ₂) = Base) + (s₀ : ℝ) (hs₀ : s₀ ∈ Icc (-1) 1) + (w : ℝ → ℝ) + (hwright : ∀ (s : ℝ), s₀ ≤ s → w s = 0) + (hwleft : ∀ s ∈ Ico (-1) s₀, 0 < w s) + (hUpR : Over w ⊆ Rect) + (hΔ'sub : f' '' Over w ⊆ Δ₁) + (hmem₀ : ∀ {z : ℂ}, z ∈ segment ℝ (↑s₀) 1 ↔ z.re ∈ Icc s₀ 1 ∧ z.im = 0) + (hLc : f' '' segment ℝ (↑s₀) 1 ⊆ ℓ₁ ∪ ℓ₂) : + f' '' Over w ∩ Δ₂ = f' '' segment ℝ (↑s₀) 1 := by + apply subset_antisymm + · rintro _ ⟨⟨u, hu, rfl⟩, hu₂⟩ + have hin : f' u ∈ ℓ₁ ∪ ℓ₂ := hmeet ▸ ⟨hΔ'sub (mem_image_of_mem f' hu), hu₂⟩ + have hub : f (f' u) ∈ Base := hfc ▸ mem_image_of_mem f hin + rw [hf.right (hUpR hu)] at hub + obtain ⟨h₁, h₂⟩ := mem_Base.mp hub + refine mem_image_of_mem f' (hmem₀.mpr ⟨⟨?_, h₁.2⟩, h₂⟩) + by_contra hn + have := hwleft u.re ⟨h₁.1, not_le.mp hn⟩ + have h₃ := hu.2.1 + rw [h₂] at h₃ + linarith + · rintro _ ⟨u, hu, rfl⟩ + refine ⟨mem_image_of_mem f' ?_, ?_⟩ + · obtain ⟨⟨h₁, h₂⟩, h₃⟩ := hmem₀.mp hu + refine ⟨⟨by linarith [hs₀.1], h₂⟩, ?_, by rw [h₃]; norm_num⟩ + rw [hwright _ h₁, h₃] + · exact Surface.discBd_subset _ (hcbd₂ (hLc (mem_image_of_mem f' hu))) + +private theorem raised_disc_union_contains_obstacle + {T : Type u} + [TopologicalSpace T] + {E : Set T} + {K : Set T} + (hKE : K ⊆ E) + (Δ₁ : Set T) + (Δ₂ : Set T) + (f : T → ℂ) + (f' : ℂ → T) + (hf : PH Δ₁ Rect f f') + (s₀ : ℝ) + (w : ℝ → ℝ) + (hwright : ∀ (s : ℝ), s₀ ≤ s → w s = 0) + (hwle : ∀ z ∈ (f '' (K ∩ Δ₁)), 0 ≤ z.im → z.re < s₀ → w z.re ≤ z.im / 2) + (hmemE : ∀ {z : T}, z ∈ E → z ∈ Δ₁ ∨ z ∈ Δ₂) : + K ⊆ f' '' Over w ∪ Δ₂ := by + let K' := f '' (K ∩ Δ₁) + intro z hz + rcases hmemE (hKE hz) with h₁ | h₁ + · refine Or.inl ⟨f z, ?_, hf.left h₁⟩ + obtain ⟨h₃, h₄⟩ := hf.1 h₁ + refine ⟨h₃, ?_, h₄.2⟩ + by_cases hlt : (f z).re < s₀ + · have := hwle (f z) ⟨z, ⟨hz, h₁⟩, rfl⟩ h₄.1 hlt + linarith [h₄.1] + · rw [hwright _ (not_lt.mp hlt)] + exact h₄.1 + · exact Or.inr h₁ + +private theorem removed_points_below_raising_graph + {T : Type u} + [TopologicalSpace T] + {E : Set T} + (Δ₁ : Set T) + (Δ₂ : Set T) + (f : T → ℂ) + (f' : ℂ → T) + (hf : PH Δ₁ Rect f f') + (s₀ : ℝ) + (w : ℝ → ℝ) + (hwright : ∀ (s : ℝ), s₀ ≤ s → w s = 0) + (hmemE : ∀ {z : T}, z ∈ E → z ∈ Δ₁ ∨ z ∈ Δ₂) : + E \ (f' '' Over w ∪ Δ₂) ⊆ f' '' ({z | z.re ∈ Icc (-1) s₀ ∧ 0 ≤ z.im ∧ z.im ≤ w z.re}) := by + let FgC : Set ℂ := {z | z.re ∈ Icc (-1) s₀ ∧ 0 ≤ z.im ∧ z.im ≤ w z.re} + rintro y ⟨hyE, hyn⟩ + have hyΔ : y ∈ Δ₁ := (hmemE hyE).resolve_right fun h => hyn (Or.inr h) + obtain ⟨h₃, h₄⟩ := hf.1 hyΔ + refine ⟨f y, ?_, hf.left hyΔ⟩ + have hlt : (f y).im < w (f y).re := by + by_contra hn + exact hyn (Or.inl ⟨f y, ⟨h₃, not_lt.mp hn, h₄.2⟩, hf.left hyΔ⟩) + refine ⟨⟨h₃.1, ?_⟩, h₄.1, hlt.le⟩ + by_contra hn + rw [hwright _ (not_le.mp hn).le] at hlt + linarith [h₄.1] + +private theorem raising_graph_meets_obstacle_at_tip + {T : Type u} + [TopologicalSpace T] + {K : Set T} + {x : T} + (Δ₁ : Set T) + (f : T → ℂ) + (f' : ℂ → T) + (hf : PH Δ₁ Rect f f') + (s₀ : ℝ) + (hoff : ∀ s ∈ Ico (-1) s₀, ↑s ∉ (f '' (K ∩ Δ₁))) + (w : ℝ → ℝ) + (hwright : ∀ (s : ℝ), s₀ ≤ s → w s = 0) + (hwle : ∀ z ∈ (f '' (K ∩ Δ₁)), 0 ≤ z.im → z.re < s₀ → w z.re ≤ z.im / 2) + (hf'x : f' ↑s₀ = x) + (hFgR : ({z | z.re ∈ Icc (-1) s₀ ∧ 0 ≤ z.im ∧ z.im ≤ w z.re}) ⊆ Rect) : + ∀ {z : T}, z ∈ K → z ∈ f' '' ({z | z.re ∈ Icc (-1) s₀ ∧ 0 ≤ z.im ∧ z.im ≤ w z.re}) → z = x := by + let K' := f '' (K ∩ Δ₁) + let FgC : Set ℂ := {z | z.re ∈ Icc (-1) s₀ ∧ 0 ≤ z.im ∧ z.im ≤ w z.re} + rintro z hz ⟨u, hu, rfl⟩ + have huR := hFgR hu + have hzΔ : f' u ∈ Δ₁ := hf.2.1 huR + have hfu : u ∈ K' := ⟨f' u, ⟨hz, hzΔ⟩, hf.right huR⟩ + rcases hu.1.2.lt_or_eq with hlt | heq + · have h₁ := hwle u hfu hu.2.1 hlt + have h₂ : u.im = 0 := by linarith [hu.2.1, hu.2.2] + have h₃ : u = (u.re : ℂ) := Complex.ext (by simp) (by simp [h₂]) + exact absurd (h₃ ▸ hfu) (hoff u.re ⟨hu.1.1, hlt⟩) + · have h₁ : u.im = 0 := by + have := hu.2.2 + rw [hwright _ heq.ge] at this + linarith [hu.2.1] + have h₃ : u = (s₀ : ℂ) := Complex.ext (by simp [heq]) (by simp [h₁]) + rw [h₃, hf'x] + +private theorem raised_disc_boundary_meets_obstacle_at_tip + {T : Type u} + [TopologicalSpace T] + [T2Space T] + (hS : IsClosedSurface T) + {E : Set T} + {K : Set T} + {x : T} + (hE : IsClosedDisc E) + (hKE : K ⊆ E) + (hx : x ∈ K) + (hfrE : frontier E = discBd E) + (ℓ₁ : Set T) + (ℓ₂ : Set T) + (Δ₁ : Set T) + (Δ₂ : Set T) + (hmeet : Δ₁ ∩ Δ₂ = ℓ₁ ∪ ℓ₂) + (f : T → ℂ) + (f' : ℂ → T) + (hf : PH Δ₁ Rect f f') + (hfc : f '' (ℓ₁ ∪ ℓ₂) = Base) + (s₀ : ℝ) + (hs₀ : s₀ ∈ Icc (-1) 1) + (w : ℝ → ℝ) + (hwc : Continuous w) + (hw0 : ∀ (s : ℝ), 0 ≤ w s) + (hw1 : ∀ (s : ℝ), w s ≤ 1 / 2) + (hwright : ∀ (s : ℝ), s₀ ≤ s → w s = 0) + (hwleft : ∀ s ∈ Ico (-1) s₀, 0 < w s) + (hUpR : Over w ⊆ Rect) + (hsm : -1 < s₀) + (hf'x : f' ↑s₀ = x) + (hE'd : IsClosedDisc (f' '' Over w ∪ Δ₂)) + (hE'E : f' '' Over w ∪ Δ₂ ⊆ E) + (hKE' : K ⊆ f' '' Over w ∪ Δ₂) + (hFg : IsClosed (f' '' ({z | z.re ∈ Icc (-1) s₀ ∧ 0 ≤ z.im ∧ z.im ≤ w z.re}))) + (hdiff : E \ (f' '' Over w ∪ Δ₂) ⊆ f' '' ({z | z.re ∈ Icc (-1) s₀ ∧ 0 ≤ z.im ∧ z.im ≤ w + z.re})) + (hKFg : ∀ {z : T}, z ∈ K → z ∈ f' '' ({z | z.re ∈ Icc (-1) s₀ ∧ 0 ≤ z.im ∧ z.im ≤ w z.re}) → z + = x) : + discBd (f' '' Over w ∪ Δ₂) ∩ K = discBd E ∩ K ∪ {x} := by + let K' := f '' (K ∩ Δ₁) + let FgC : Set ℂ := {z | z.re ∈ Icc (-1) s₀ ∧ 0 ≤ z.im ∧ z.im ≤ w z.re} + have hfrE' := IsClosedDisc.frontier_eq_discBd hS hE'd + ext z + constructor + · rintro ⟨hzb, hzK⟩ + by_cases hb : z ∈ discBd E + · exact Or.inl ⟨hb, hzK⟩ + · refine Or.inr ?_ + by_contra hzx + have hzin : z ∈ interior E := by + by_contra hn + apply hb + rw [← hfrE, frontier, hE.isClosed.closure_eq] + exact ⟨hKE hzK, hn⟩ + have hzFg : z ∉ f' '' FgC := fun h => hzx (hKFg hzK h) + have hopen : IsOpen (interior E ∩ (f' '' FgC)ᶜ) := isOpen_interior.inter hFg.isOpen_compl + have hsub : interior E ∩ (f' '' FgC)ᶜ ⊆ f' '' Over w ∪ Δ₂ := by + rintro y ⟨h₁, h₂⟩ + by_contra hn + exact h₂ (hdiff ⟨interior_subset h₁, hn⟩) + have hint : z ∈ interior (f' '' Over w ∪ Δ₂) := + interior_maximal hsub hopen ⟨hzin, hzFg⟩ + rw [← hfrE'] at hzb + exact disjoint_left.mp disjoint_interior_frontier hint hzb + · rintro (⟨hzb, hzK⟩ | hzx) + · refine ⟨?_, hzK⟩ + rw [← hfrE', frontier_eq_closure_inter_closure] + rw [← hfrE, frontier_eq_closure_inter_closure] at hzb + exact ⟨subset_closure (hKE' hzK), closure_mono (compl_subset_compl.mpr hE'E) hzb.2⟩ + · have hzx' : z = x := hzx + subst hzx' + refine ⟨?_, hx⟩ + rw [← hfrE', frontier_eq_closure_inter_closure] + refine ⟨subset_closure (hKE' hx), ?_⟩ + let m : ℝ → ℂ := fun s => ⟨s, w s / 2⟩ + have hmc : Continuous m := + Complex.equivRealProdCLM.symm.continuous.comp (continuous_id.prodMk (hwc.div_const 2)) + have hmR : ∀ s ∈ Icc (-1 : ℝ) s₀, m s ∈ Rect := fun s hs => + ⟨⟨hs.1, hs.2.trans hs₀.2⟩, by + have h₁ := hw0 s + have h₂ := hw1 s + constructor + · change 0 ≤ w s / 2 + linarith + · change w s / 2 ≤ 1 + linarith⟩ + have hg : ContinuousOn (f' ∘ m) (Icc (-1 : ℝ) s₀) := + hf.2.2.2.2.2.comp hmc.continuousOn hmR + have hcls : s₀ ∈ closure (Ico (-1 : ℝ) s₀) := by + rw [closure_Ico hsm.ne] + exact ⟨hsm.le, le_rfl⟩ + have hcw : ContinuousWithinAt (f' ∘ m) (Ico (-1 : ℝ) s₀) s₀ := + (hg s₀ ⟨hsm.le, le_rfl⟩).mono Ico_subset_Icc_self + have hend : (f' ∘ m) s₀ = z := by + have : m s₀ = (s₀ : ℂ) := by + apply Complex.ext + · rfl + · change w s₀ / 2 = _ + rw [hwright _ le_rfl] + simp + simp only [Function.comp, this, hf'x] + rw [← hend] + refine closure_mono ?_ (hcw.mem_closure_image hcls) + rintro _ ⟨s, hs, rfl⟩ + have hsI : s ∈ Icc (-1 : ℝ) s₀ := ⟨hs.1, hs.2.le⟩ + have hp₀ := hwleft s hs + rintro (⟨u, hu, hue⟩ | h₁) + · have h₃ := hf.symm.injOn (hUpR hu) (hmR s hsI) hue + have h₄ := hu.2.1 + rw [h₃] at h₄ + change w s ≤ w s / 2 at h₄ + linarith + · have hin : (f' ∘ m) s ∈ ℓ₁ ∪ ℓ₂ := hmeet ▸ ⟨hf.2.1 (hmR s hsI), h₁⟩ + have hub : f ((f' ∘ m) s) ∈ Base := hfc ▸ mem_image_of_mem f hin + simp only [Function.comp] at hub + rw [hf.right (hmR s hsI)] at hub + have h₃ : w s / 2 = 0 := (mem_Base.mp hub).2 + linarith + +/-- **A finger.** See the module docstring. -/ +theorem exists_finger [T2Space T] [ConnectedSpace T] (hS : IsClosedSurface T) {E K ℓ : Set T} {p x + : T} + (hE : IsClosedDisc E) (hKc : IsCompact K) (hKE : K ⊆ E) (hx : x ∈ K) (hxb : x ∉ discBd E) + (hp : p ∉ E) (hℓ : IsLineWithEnds ℓ p x) (hℓK : ℓ ∩ K ⊆ {x}) : + ∃ E' : Set T, IsClosedDisc E' ∧ E' ⊆ E ∧ K ⊆ E' ∧ discBd E' ∩ K = (discBd E ∩ K) ∪ {x} := by + classical + have hpx : p ≠ x := fun h => hp (h ▸ hKE hx) + have hfrE : frontier E = discBd E := IsClosedDisc.frontier_eq_discBd hS hE + -- Two lines, and their last parts. + obtain ⟨P, hP, hPK, hPℓ⟩ := GM12.exists_parallel_line hS hℓ hpx hKc.isClosed + (fun z hz => Or.inr (hℓK hz)) + obtain ⟨z₁, ℓ₁, hz₁, hl₁, hsub₁, hE₁, hb₁⟩ := exists_last_part hS hE hℓ hp (hKE hx) hxb + obtain ⟨z₂, ℓ₂, hz₂, hl₂, hsub₂, hE₂, hb₂⟩ := exists_last_part hS hE hP hp (hKE hx) hxb + have hxℓ₁ : x ∈ ℓ₁ := hl_end hl₁ + have hxℓ₂ : x ∈ ℓ₂ := hl_end hl₂ + have hcap : ℓ₁ ∩ ℓ₂ = {x} := by + apply subset_antisymm + · rintro z ⟨h₁, h₂⟩ + have : z ∈ P ∩ ℓ := ⟨hsub₂ h₂, hsub₁ h₁⟩ + rw [hPℓ] at this + rcases this with h₃ | h₃ + · exact absurd (h₃ ▸ hE₁ h₁) hp + · exact h₃ + · rintro z rfl + exact ⟨hxℓ₁, hxℓ₂⟩ + have hz₁₂ : z₁ ≠ z₂ := fun h => by + have : z₁ ∈ ℓ₁ ∩ ℓ₂ := ⟨hl_start hl₁, h ▸ hl_start hl₂⟩ + rw [hcap] at this + exact hxb (this ▸ hz₁) + have hc : IsLineWithEnds (ℓ₁ ∪ ℓ₂) z₁ z₂ := GraphMinor.Surface.IsLineWithEnds.union hl₁ + (GraphMinor.Surface.IsLineWithEnds.symm hl₂) hcap + have hcE : ℓ₁ ∪ ℓ₂ ⊆ E := union_subset hE₁ hE₂ + have hcb : (ℓ₁ ∪ ℓ₂) ∩ discBd E = {z₁, z₂} := by + rw [union_inter_distrib_right, hb₁, hb₂] + rfl + obtain ⟨A₁, A₂, Δ₁, Δ₂, -, -, hΔ₁, hΔ₂, hcov, hmeet, hbd₁, hbd₂, -⟩ := + disc_iArc E (ℓ₁ ∪ ℓ₂) z₁ z₂ hE hcE hz₁₂ hc hcb + have hcbd : ℓ₁ ∪ ℓ₂ ⊆ discBd Δ₁ := hbd₁ ▸ subset_union_right + have hcbd₂ : ℓ₁ ∪ ℓ₂ ⊆ discBd Δ₂ := hbd₂ ▸ subset_union_right + have hfr₁ : frontier Δ₁ = discBd Δ₁ := IsClosedDisc.frontier_eq_discBd hS hΔ₁ + obtain ⟨f, f', hf, hfc, hf₁, hf₂⟩ := exists_rect_chart hΔ₁ hc hcbd + have hΔ₁E : Δ₁ ⊆ E := hcov ▸ subset_union_left + have hΔ₂E : Δ₂ ⊆ E := hcov ▸ subset_union_right + have hRc : IsCompact Rect := isCompact_Icc.reProdIm isCompact_Icc + have hc_sub : ℓ₁ ∪ ℓ₂ ⊆ Δ₁ := fun z hz => Surface.discBd_subset _ (hcbd hz) + -- The point `x` in the chart. + have hfx : f x ∈ Base := hfc ▸ mem_image_of_mem f (Or.inl hxℓ₁) + obtain ⟨hs₀, hfxi⟩ := mem_Base.mp hfx + set s₀ := (f x).re with hs₀def + have hfxe : f x = (s₀ : ℂ) := Complex.ext (by simp [s₀]) (by simp [hfxi]) + -- The part of `K` in the chart. + let K' : Set ℂ := f '' (K ∩ Δ₁) + have hK'c : IsCompact K' := + hf.image_isCompact inter_subset_right (hKc.inter_right hΔ₁.isClosed) + have hsK' : (s₀ : ℂ) ∈ K' := ⟨x, ⟨hx, hc_sub (Or.inl hxℓ₁)⟩, hfxe⟩ + -- Real points before `s₀` are off `K'`. + have hoff : ∀ s : ℝ, s ∈ Ico (-1 : ℝ) s₀ → (s : ℂ) ∉ K' := by + exact base_left_of_tip_avoids_obstacle (T := T) (K := K) (ℓ := ℓ) (x := x) hℓK z₁ ℓ₁ hl₁ hsub₁ + ℓ₂ hxℓ₁ Δ₁ f f' hf hfc hf₁ hc_sub s₀ hfxe + -- The height. + have hKne : K'.Nonempty := ⟨_, hsK'⟩ + let d : ℝ → ℝ := fun s => infDist (s : ℂ) K' + have hdc : Continuous d := (continuous_infDist_pt K').comp Complex.continuous_ofReal + let w : ℝ → ℝ := fun s => min (d (min s s₀) / 2) (1 / 2) + have hwc : Continuous w := + ((hdc.comp (continuous_id.min continuous_const)).div_const 2).min continuous_const + have hw0 : ∀ s, 0 ≤ w s := fun s => + le_min (div_nonneg infDist_nonneg (by norm_num)) (by norm_num) + have hw1 : ∀ s, w s ≤ 1 / 2 := fun s => min_le_right _ _ + have hwright : ∀ s, s₀ ≤ s → w s = 0 := fun s hs => by + have h₁ : d (min s s₀) = 0 := by + rw [min_eq_right hs] + exact infDist_zero_of_mem hsK' + simp [w, h₁] + have hwleft : ∀ s, s ∈ Ico (-1 : ℝ) s₀ → 0 < w s := fun s hs => by + have h₁ : 0 < d s := by + refine (hK'c.isClosed.notMem_iff_infDist_pos hKne).mp (hoff s hs) + have h₂ : min s s₀ = s := min_eq_left hs.2.le + simp only [w, h₂] + exact lt_min (by linarith) (by norm_num) + have hwle : ∀ z : ℂ, z ∈ K' → 0 ≤ z.im → z.re < s₀ → w z.re ≤ z.im / 2 := by + intro z hz hi hlt + have h₂ : min z.re s₀ = z.re := min_eq_left hlt.le + have h₃ : d z.re ≤ dist (z.re : ℂ) z := infDist_le_dist_of_mem hz + have h₄ : dist (z.re : ℂ) z = z.im := by + rw [dist_comm, Complex.dist_eq] + have : z - (z.re : ℂ) = (z.im : ℂ) * Complex.I := by + apply Complex.ext <;> simp + rw [this] + simp [abs_of_nonneg hi] + calc w z.re ≤ d z.re / 2 := by + simp only [w, h₂] + exact min_le_left _ _ + _ ≤ z.im / 2 := by linarith + -- The new disc. + have hRd : IsClosedDisc Rect := + (isClosedDisc_rect (a := -1) (b := 1) (c := 0) (d := 1) (by norm_num) (by norm_num)).1 + have hUpR : Over w ⊆ Rect := fun z hz => ⟨hz.1, (hw0 _).trans hz.2.1, hz.2.2⟩ + have hL := raise_PH hwc hw1 + have hchain := hL.comp (hf.symm.restrict' hUpR) + have hΔ'd : IsClosedDisc (f' '' Over w) := by + have := hchain.disc_image Subset.rfl hRd + rwa [hchain.image_eq] at this + have hΔ'sub : f' '' Over w ⊆ Δ₁ := hf.symm.image_sub hUpR + have hfr' : frontier (f' '' Over w) = discBd (f' '' Over w) := + IsClosedDisc.frontier_eq_discBd hS hΔ'd + have hs₁ : s₀ < 1 := by + refine lt_of_le_of_ne hs₀.2 fun h => ?_ + have h₁ : f x = 1 := by rw [hfxe, h]; simp + have h₂ := hf.injOn (hc_sub (Or.inl hxℓ₁)) (hc_sub (Or.inr (hl_start hl₂))) (h₁.trans hf₂.symm) + exact hxb (h₂ ▸ hz₂) + have hsm : -1 < s₀ := by + refine lt_of_le_of_ne hs₀.1 fun h => ?_ + have h₁ : f x = -1 := by rw [hfxe, ← h]; simp + have h₂ := hf.injOn (hc_sub (Or.inl hxℓ₁)) (hc_sub (Or.inl (hl_start hl₁))) (h₁.trans hf₁.symm) + exact hxb (h₂ ▸ hz₁) + have hL₀ : IsLineWithEnds (segment ℝ (s₀ : ℂ) 1) (s₀ : ℂ) 1 := + isLineWithEnds_segment (by exact_mod_cast hs₁.ne) + have hmem₀ : ∀ {z : ℂ}, z ∈ segment ℝ (s₀ : ℂ) 1 ↔ z.re ∈ Icc s₀ 1 ∧ z.im = 0 := by + exact mem_right_base_segment s₀ hs₁ + have hL₀R : segment ℝ (s₀ : ℂ) 1 ⊆ Rect := fun z hz => by + obtain ⟨⟨h₁, h₂⟩, h₃⟩ := hmem₀.mp hz + exact ⟨⟨by linarith [hs₀.1], h₂⟩, by change z.im ∈ Icc (0 : ℝ) 1; rw [h₃]; norm_num⟩ + have hL₀B : segment ℝ (s₀ : ℂ) 1 ⊆ Base := fun z hz => by + obtain ⟨⟨h₁, h₂⟩, h₃⟩ := hmem₀.mp hz + exact mem_Base.mpr ⟨⟨by linarith [hs₀.1], h₂⟩, h₃⟩ + have hline := hf.symm.line_image hL₀R hL₀ + have hf'x : f' (s₀ : ℂ) = x := by + rw [← hfxe] + exact hf.left (hc_sub (Or.inl hxℓ₁)) + have hf'z : f' 1 = z₂ := by + rw [← hf₂] + exact hf.left (hc_sub (Or.inr (hl_start hl₂))) + rw [hf'x, hf'z] at hline + have hBc : ∀ {u}, u ∈ Base → f' u ∈ ℓ₁ ∪ ℓ₂ := fun {u} hu => by + rw [← hfc] at hu + obtain ⟨q, hq, rfl⟩ := hu + rwa [hf.left (hc_sub hq)] + have hLc : f' '' segment ℝ (s₀ : ℂ) 1 ⊆ ℓ₁ ∪ ℓ₂ := by + rintro _ ⟨u, hu, rfl⟩ + exact hBc (hL₀B hu) + have hmeetRaised : f' '' Over w ∩ Δ₂ = f' '' segment ℝ (s₀ : ℂ) 1 := by + exact raised_disc_meets_other_half_along_right_base (T := T) ℓ₁ ℓ₂ Δ₁ Δ₂ hmeet hcbd₂ f f' hf + hfc s₀ hs₀ w hwright hwleft hUpR hΔ'sub hmem₀ hLc + have hLb₁ : f' '' segment ℝ (s₀ : ℂ) 1 ⊆ discBd (f' '' Over w) := by + intro y hy + rw [← hfr', frontier_eq_closure_inter_closure] + have hyΔ : y ∈ f' '' Over w := (hmeetRaised.symm.subset hy).1 + refine ⟨subset_closure hyΔ, ?_⟩ + have h₁ : y ∈ frontier Δ₁ := hfr₁ ▸ hcbd (hLc hy) + rw [frontier_eq_closure_inter_closure] at h₁ + exact closure_mono (compl_subset_compl.mpr hΔ'sub) h₁.2 + obtain ⟨hE'd, -⟩ := disc_union _ _ _ _ _ hΔ'd hΔ₂ hline hmeetRaised hLb₁ (hLc.trans hcbd₂) + have hE'E : f' '' Over w ∪ Δ₂ ⊆ E := union_subset (hΔ'sub.trans hΔ₁E) hΔ₂E + have hmemE : ∀ {z}, z ∈ E → z ∈ Δ₁ ∨ z ∈ Δ₂ := fun {z} hz => by + rw [← hcov] at hz + exact hz + have hKE' : K ⊆ f' '' Over w ∪ Δ₂ := by + exact raised_disc_union_contains_obstacle (T := T) (E := E) (K := K) hKE Δ₁ Δ₂ f f' hf s₀ w + hwright hwle hmemE + -- The finger. + let FgC : Set ℂ := {z | z.re ∈ Icc (-1 : ℝ) s₀ ∧ 0 ≤ z.im ∧ z.im ≤ w z.re} + have hFgR : FgC ⊆ Rect := fun z hz => + ⟨⟨hz.1.1, hz.1.2.trans hs₀.2⟩, hz.2.1, hz.2.2.trans ((hw1 _).trans (by norm_num))⟩ + have hFgcl : IsClosed FgC := + (isClosed_Icc.preimage Complex.continuous_re).inter + ((isClosed_le continuous_const Complex.continuous_im).inter + (isClosed_le Complex.continuous_im (hwc.comp Complex.continuous_re))) + have hFg : IsClosed (f' '' FgC) := + hf.symm.image_isClosed hRc hFgR hFgcl + have hdiff : E \ (f' '' Over w ∪ Δ₂) ⊆ f' '' FgC := by + exact removed_points_below_raising_graph (T := T) (E := E) Δ₁ Δ₂ f f' hf s₀ w hwright hmemE + have hKFg : ∀ {z}, z ∈ K → z ∈ f' '' FgC → z = x := by + exact raising_graph_meets_obstacle_at_tip (T := T) (K := K) (x := x) Δ₁ f f' hf s₀ hoff w + hwright hwle hf'x hFgR + have hRaisedBoundary : discBd (f' '' Over w ∪ Δ₂) ∩ K = (discBd E ∩ K) ∪ {x} := by + exact raised_disc_boundary_meets_obstacle_at_tip (T := T) hS (E := E) (K := K) (x := x) + hE hKE hx hfrE ℓ₁ ℓ₂ Δ₁ Δ₂ hmeet f f' hf hfc s₀ hs₀ w hwc hw0 hw1 hwright hwleft hUpR hsm + hf'x hE'd hE'E hKE' hFg hdiff hKFg + exact ⟨_, hE'd, hE'E, hKE', hRaisedBoundary⟩ + +/-- **A closed disc around `K` with a finite set `X` of points on its boundary.** Each point of `X` +is the +end of a line from a fixed point `p` off `K`, which meets `K` only in that end. -/ +theorem exists_disc_around [T2Space T] [ConnectedSpace T] (hS : IsClosedSurface T) + (hsph : IsSphere T) + {K X : Set T} {p : T} (hKc : IsCompact K) (hp : p ∉ K) (hX : X.Finite) (hXK : X ⊆ K) + (hl : ∀ x ∈ X, ∃ ℓ, IsLineWithEnds ℓ p x ∧ ℓ ∩ K ⊆ {x}) : + ∃ E : Set T, IsClosedDisc E ∧ K ⊆ E ∧ p ∉ E ∧ discBd E ∩ K = X := by + classical + induction X, hX using Set.Finite.induction_on with + | empty => + obtain ⟨D, D', hD, hD'o, hpD', hD'D, hDO, hb⟩ := + exists_closedDisc_nbhd hS hKc.isClosed.isOpen_compl hp + obtain ⟨Δ₁, Δ₂, -, hd₁, hd₂, hb₁, hb₂, hcov, hcap, -, huniq⟩ := + sphere_disc T hsph (discBd D) hD.isOArc_discBd + have hpb : p ∉ discBd D := fun h => (hb ▸ h).2 hpD' + rcases huniq D hD rfl with rfl | rfl + · refine ⟨Δ₂, hd₂, fun z hz => ?_, fun hz => hpb (hcap ▸ ⟨hD'D hpD', hz⟩), ?_⟩ + · have : z ∈ D ∪ Δ₂ := hcov ▸ mem_univ z + exact this.resolve_left fun h => hDO h hz + · refine eq_empty_of_forall_notMem fun z hz => ?_ + rw [hb₂] at hz + exact hDO (Surface.discBd_subset _ hz.1) hz.2 + · refine ⟨Δ₁, hd₁, fun z hz => ?_, fun hz => hpb (hcap ▸ ⟨hz, hD'D hpD'⟩), ?_⟩ + · have : z ∈ Δ₁ ∪ D := hcov ▸ mem_univ z + exact this.resolve_right fun h => hDO h hz + · refine eq_empty_of_forall_notMem fun z hz => ?_ + rw [hb₁] at hz + exact hDO (Surface.discBd_subset _ hz.1) hz.2 + | @insert x X hxX hfin ih => + obtain ⟨E, hE, hKE, hpE, hbE⟩ := ih (fun z hz => hXK (mem_insert_of_mem _ hz)) + fun z hz => hl z (mem_insert_of_mem _ hz) + have hxK : x ∈ K := hXK (mem_insert _ _) + obtain ⟨ℓ, hℓ, hℓK⟩ := hl x (mem_insert _ _) + obtain ⟨E', hE', hE'E, hKE', hb⟩ := + exists_finger hS hE hKc hKE hxK (fun h => hxX (hbE ▸ ⟨h, hxK⟩)) hpE hℓ hℓK + refine ⟨E', hE', hKE', fun h => hpE (hE'E h), ?_⟩ + rw [hb, hbE, union_comm] + rfl + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM14/RigidGood.lean b/LeanPool/GraphMinor/GM14/RigidGood.lean new file mode 100644 index 0000000000..1151a00a31 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/RigidGood.lean @@ -0,0 +1,533 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.RigidThread +public import LeanPool.GraphMinor.GM14.Suppress +import LeanPool.GraphMinor.GM11.RadialExists + +/-! +# A rigid drawing with a wheel around it is good + +Let `H` be rigid in a closed disc `Δ` in a sphere, and draw a wheel `W` in the closed disc on the +other +side of `bd(Δ)`, with its rim on `bd(Δ)`, with `V(H) ∩ bd(Δ)` among its rim vertices, and with no +edge of +`W` between two vertices of `H`. In the paper's proof of (6.4) the union is `J₁`, except that we +keep +the rim edges apart from `H` by new vertices on the rim. + +`good_of_wheel` shows that the union `J` is `Good`, so that it is a subdivision of a simple +3-connected +graph (`good_sub`). Take a separation of order at most 2. The wheel stays on one side, apart from +the +common vertices. The edges of `H` on the other side then form a set with at most two boundary +vertices, and `exists_thread` says that this set is a path. +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +universe u v + +section WalkFacts + +variable {α : Type u} {β : Type v} {P : Graph α β} + +theorem length_support {a b : α} (W : GraphWalk P a b) : W.support.length = W.edges.length + 1 := by + induction W with + | nil _ => simp [GraphWalk.support, GraphWalk.edges] + | cons _ _ ih => simp [GraphWalk.support, GraphWalk.edges, ih] + +/-- In a simple walk, only one edge meets the start. -/ +theorem edge_at_start {a b : α} (W : GraphWalk P a b) (hs : W.IsSimple) {g g' : β} + (hg : g ∈ W.edges) (hg' : g' ∈ W.edges) (hi : P.Inc g a) (hi' : P.Inc g' a) : g = g' := by + cases W with + | nil _ => simp [GraphWalk.edges] at hg + | @cons u t b c hl rest => + have hun : a ∉ rest.support := (List.nodup_cons.mp hs).1 + have key : ∀ {x}, x ∈ (GraphWalk.cons hl rest).edges → P.Inc x a → x = c := by + intro x hx hix + simp only [GraphWalk.edges, List.mem_cons] at hx + rcases hx with hx | hx + · exact hx + · exact absurd (inc_mem_support rest hx hix) hun + rw [key hg hi, key hg' hi'] + +/-- In a simple walk, at most two edges meet an inner vertex. -/ +theorem edge_at_inner {a b : α} (W : GraphWalk P a b) (hs : W.IsSimple) {v : α} + (hva : v ≠ a) (hvb : v ≠ b) {e f g : β} (he : e ∈ W.edges) (hf : f ∈ W.edges) (hg : g ∈ W.edges) + (hie : P.Inc e v) (hif : P.Inc f v) (hig : P.Inc g v) (hne : e ≠ f) : g = e ∨ g = f := by + induction W with + | nil _ => simp [GraphWalk.edges] at he + | @cons u t b c hl rest ih => + have hrs : rest.IsSimple := (List.nodup_cons.mp hs).2 + simp only [GraphWalk.edges, List.mem_cons] at he hf hg + by_cases hvt : v = t + · subst hvt + rcases he with he | he <;> rcases hf with hf | hf + · exact absurd (he.trans hf.symm) hne + · rcases hg with hg | hg + · exact Or.inl (hg.trans he.symm) + · exact Or.inr (edge_at_start rest hrs hg hf hig hif) + · rcases hg with hg | hg + · exact Or.inr (hg.trans hf.symm) + · exact Or.inl (edge_at_start rest hrs hg he hig hie) + · exact absurd (edge_at_start rest hrs he hf hie hif) hne + · have hnot : ∀ {x}, x = c ∨ x ∈ rest.edges → P.Inc x v → x ∈ rest.edges := by + rintro x (rfl | hx) hi + · exfalso + obtain ⟨z, hz⟩ := hi + rcases P.eq_or_eq_of_isLink_of_isLink hz hl with h₁ | h₁ + · exact hva h₁ + · exact hvt h₁ + · exact hx + exact ih hrs hvt hvb (hnot he hie) (hnot hf hif) (hnot hg hig) + +end WalkFacts + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- Counts for a path drawing. -/ +theorem path_count {P : Drawing S} {x y : S} (h : P.IsPathBetween x y) (hxy : x ≠ y) (hx : x ∈ P.V) + (hy : y ∈ P.V) : P.E.ncard ≤ (P.V \ {x, y}).ncard + 1 := by + classical + obtain ⟨W, hs, hV, hE⟩ := h + have h₁ : P.V = ↑W.support.toFinset := by + rw [hV] + ext z + simp + have h₂ : P.E = ↑W.edges.toFinset := by + rw [hE] + ext z + simp + have hc₁ : P.V.ncard = W.support.length := by + rw [h₁, ncard_coe_finset, List.toFinset_card_of_nodup hs] + have hc₂ : P.E.ncard ≤ W.edges.length := by + rw [h₂, ncard_coe_finset] + exact List.toFinset_card_le _ + have hsub : ({x, y} : Set S) ⊆ P.V := by + rintro z (rfl | rfl) + · exact hx + · exact hy + have hc₃ : (P.V \ {x, y}).ncard = P.V.ncard - 2 := by + rw [ncard_sdiff hsub (toFinite _), ncard_pair hxy] + have := length_support W + have hge : 2 ≤ P.V.ncard := by + rw [← ncard_pair hxy] + exact ncard_le_ncard hsub P.finite_V + omega + +omit [T2Space S] in +/-- An inner vertex of a path meets exactly two of its edges. -/ +theorem path_two {P : Drawing S} {x y : S} (h : P.IsPathBetween x y) {v : S} (hv : v ∈ P.V) + (hx : v ≠ x) (hy : v ≠ y) : {g | P.toGraph.Inc g v}.ncard = 2 := by + obtain ⟨W, hs, hV, hE⟩ := h + have hvs : v ∈ W.support := by + rw [hV] at hv + exact hv + obtain ⟨e, he, f, hf, hne, hie, hif⟩ := exists_two_edges_at_inner W hs hvs hx hy + have heq : {g | P.toGraph.Inc g v} = {e, f} := by + ext g + constructor + · intro hig + have hgE : g ∈ W.edges := by + have : g ∈ P.E := hig.edge_mem + rw [hE] at this + exact this + exact edge_at_inner W hs hx hy he hf hgE hie hif hig hne + · rintro (rfl | rfl) + · exact hie + · exact hif + rw [heq, ncard_pair hne] + +/-- What we use about the wheel `W`. -/ +structure Wheel (W : Drawing S) (B D₁ D₂ : Set S) : Prop where + Usub : W.U ⊆ D₂ + bdU : discBd D₂ ⊆ W.U + hconn : IsPreconnected (D₁ ∪ W.U) + BV : B ⊆ W.V + nl : ∀ e u, ¬ W.toGraph.IsLink e u u + simple : ∀ e e' u v, W.toGraph.IsLink e u v → W.toGraph.IsLink e' u v → e = e' + nob : ∀ e u v, W.toGraph.IsLink e u v → u ∈ B → v ∉ B + four : ∃ T : Set S, T ⊆ W.V ∧ 4 ≤ T.ncard ∧ ∀ v ∈ T, 3 ≤ {e | W.toGraph.Inc e v}.ncard + side : ∀ U₁ U₂ X : Set S, IsClosed U₁ → IsClosed U₂ → W.U ⊆ U₁ ∪ U₂ → W.U ∩ U₁ ∩ U₂ ⊆ X → + X ⊆ W.V → X.ncard ≤ 2 → W.V \ X ⊆ U₁ ∨ W.V \ X ⊆ U₂ + +/-- `J` is the union of `H` and `W`, as graphs. -/ +structure IsUnion (H W J : Drawing S) : Prop where + hV : J.V = H.V ∪ W.V + hE : J.E = H.E ∪ W.E + linkH : ∀ e ∈ H.E, ∀ u v, J.toGraph.IsLink e u v ↔ H.toGraph.IsLink e u v + linkW : ∀ e ∈ W.E, ∀ u v, J.toGraph.IsLink e u v ↔ W.toGraph.IsLink e u v + +/-- The point set of a graph with edges in `J`. -/ +def pts (G : Graph S (Set S)) : Set S := V(G) ∪ ⋃ e ∈ E(G), closure e + +variable {H W J Γ' : Drawing S} {B Δ D₂ : Set S} {a : S} + +section Sep + +variable {G₁ G₂ : Graph S (Set S)} + +omit [T2Space S] in +/-- A vertex of `J` in the closure of an edge of a subgraph is a vertex of the subgraph. -/ +theorem mem_V_of_closure (hs : G₁ ≤ J.toGraph) {e : Set S} (he : e ∈ E(G₁)) {z : S} + (hz : z ∈ closure e) (hzV : z ∈ J.V) : z ∈ V(G₁) := by + obtain ⟨c, d, hl⟩ := (G₁.edge_mem_iff_exists_isLink e).mp he + have hl' : J.toGraph.IsLink e c d := hs.isLink_mono hl + have : z ∈ closure e ∩ J.V := ⟨hz, hzV⟩ + rw [hl'.2.2.2] at this + rcases this with rfl | rfl + · exact hl.left_mem + · exact hl.right_mem + +theorem isClosed_pts (hs : G₁ ≤ J.toGraph) : IsClosed (pts G₁) := by + refine IsClosed.union ((J.finite_V.subset hs.vertexSet_mono).isClosed) ?_ + exact (J.finite_edges.subset hs.edgeSet_mono).isClosed_biUnion fun _ _ => isClosed_closure + +omit [T2Space S] in +theorem mem_V_of_pts (hs : G₁ ≤ J.toGraph) {z : S} (hz : z ∈ pts G₁) (hzV : z ∈ J.V) : z ∈ V(G₁) + := by + rcases hz with hz | hz + · exact hz + · obtain ⟨e, he, hze⟩ := mem_iUnion₂.mp hz + exact mem_V_of_closure hs he hze hzV + +omit [T2Space S] in +theorem pts_cover (hs : IsGraphSeparation J.toGraph G₁ G₂) : J.U ⊆ pts G₁ ∪ pts G₂ := by + obtain ⟨-, -, hV, hE, -⟩ := hs + intro z hz + rw [Drawing.U_eq] at hz + rcases hz with hz | hz + · have : z ∈ V(G₁) ∪ V(G₂) := hV ▸ hz + rcases this with h₁ | h₁ + · exact Or.inl (Or.inl h₁) + · exact Or.inr (Or.inl h₁) + · obtain ⟨e, he, hze⟩ := mem_iUnion₂.mp hz + have : e ∈ E(G₁) ∪ E(G₂) := hE ▸ he + rcases this with h₁ | h₁ + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨e, h₁, hze⟩)) + · exact Or.inr (Or.inr (mem_iUnion₂.mpr ⟨e, h₁, hze⟩)) + +omit [T2Space S] in +theorem pts_cap (hs : IsGraphSeparation J.toGraph G₁ G₂) : pts G₁ ∩ pts G₂ ⊆ V(G₁) ∩ V(G₂) := by + obtain ⟨hl₁, hl₂, hV, hE, hdis⟩ := id hs + have hsubV₁ : V(G₁) ⊆ J.V := hl₁.vertexSet_mono + have hsubV₂ : V(G₂) ⊆ J.V := hl₂.vertexSet_mono + rintro z ⟨hz₁, hz₂⟩ + have hzV : z ∈ J.V := by + rcases hz₁ with h₁ | h₁ + · exact hsubV₁ h₁ + · rcases hz₂ with h₂ | h₂ + · exact hsubV₂ h₂ + · obtain ⟨e, he, hze⟩ := mem_iUnion₂.mp h₁ + obtain ⟨e', he', hze'⟩ := mem_iUnion₂.mp h₂ + by_contra hn + have heJ : e ∈ J.E := hl₁.edgeSet_mono he + have heJ' : e' ∈ J.E := hl₂.edgeSet_mono he' + have h₃ : z ∈ e := by + rw [← J.closure_diff_V heJ] + exact ⟨hze, hn⟩ + have h₄ : z ∈ e' := by + rw [← J.closure_diff_V heJ'] + exact ⟨hze', hn⟩ + have := J.edge_eq_of_mem heJ heJ' h₃ h₄ + exact disjoint_left.mp hdis he (this ▸ he') + exact ⟨mem_V_of_pts hl₁ hz₁ hzV, mem_V_of_pts hl₂ hz₂ hzV⟩ + +omit [T2Space S] in +/-- A vertex at an edge of a subdrawing is a vertex of that subdrawing. -/ +theorem mem_V_of_inc_sub {P : Drawing S} (hs : P.IsSubdrawing J) {g : Set S} (hg : g ∈ P.E) {v : S} + (hi : J.toGraph.Inc g v) : v ∈ P.V := by + by_contra hn + have hvg : v ∈ g := by + rw [← P.closure_diff_V hg] + exact ⟨mem_closure_of_inc hi, hn⟩ + exact edge_notMem_V (hs.2 hg) hvg hi.vertex_mem + +/-- If the wheel, apart from the common vertices, is on the side of `G₁`, then `G₂` is thin. -/ +theorem thin_of_side [ConnectedSpace S] (f : Frame H J Δ a) (r : Rad J Γ') (hw : Wheel W B Δ D₂) + (hu : IsUnion H W J) (hB : ∀ v ∈ H.V, v ∈ W.V → v ∈ B) (hS : IsClosedSurface S) + (hsph : IsSphere S) (hs : IsGraphSeparation J.toGraph G₁ G₂) + (hord : (V(G₁) ∩ V(G₂)).ncard ≤ 2) (hP : W.V \ (V(G₁) ∩ V(G₂)) ⊆ V(G₁)) + (hJl : ∀ e v, ¬ J.toGraph.IsLink e v v) : + Thin J.toGraph G₂ G₁ := by + classical + obtain ⟨hl₁, hl₂, hV, hE, hdis⟩ := id hs + set X := V(G₁) ∩ V(G₂) with hX + have hXfin : X.Finite := J.finite_V.subset fun z hz => hl₁.vertexSet_mono hz.1 + have hEfin₂ : E(G₂).Finite := J.finite_edges.subset hl₂.edgeSet_mono + -- Vertices on the side of `G₂` that are not common are not in the wheel, and all their edges are + -- on that side. + have hnoW : ∀ {v}, v ∈ V(G₂) → v ∉ X → v ∉ W.V := fun {v} h₁ h₂ h₃ => + h₂ ⟨hP ⟨h₃, h₂⟩, h₁⟩ + have hside : ∀ {v g}, v ∈ V(G₂) → v ∉ X → g ∈ J.E → J.toGraph.Inc g v → g ∈ E(G₂) := by + intro v g h₁ h₂ hg hi + have : g ∈ E(G₁) ∪ E(G₂) := hE ▸ hg + rcases this with h₃ | h₃ + · exact absurd ⟨mem_V_of_closure hl₁ h₃ (mem_closure_of_inc hi) hi.vertex_mem, h₁⟩ h₂ + · exact h₃ + have hendsW : ∀ {g v}, g ∈ W.E → J.toGraph.Inc g v → v ∈ W.V := by + rintro g v hg ⟨t, ht⟩ + exact ((hu.linkW g hg v t).mp ht).left_mem + let A : Set (Set S) := E(G₂) ∩ H.E + have hAH : A ⊆ H.E := inter_subset_right + have hE₂split : ∀ {g}, g ∈ E(G₂) → g ∉ A → g ∈ W.E := by + intro g hg hn + have : g ∈ J.E := hl₂.edgeSet_mono hg + rw [hu.hE] at this + rcases this with h₃ | h₃ + · exact absurd ⟨hg, h₃⟩ hn + · exact h₃ + have hbX : Whitney.bdry J.toGraph A ⊆ X := by + rintro v ⟨⟨g, hg, hi⟩, ⟨g', ⟨hg', hgA⟩, hi'⟩⟩ + by_contra hn + have hv₂ : v ∈ V(G₂) := mem_V_of_closure hl₂ hg.1 (mem_closure_of_inc hi) hi.vertex_mem + have hg'₂ := hside hv₂ hn hg' hi' + exact hnoW hv₂ hn (hendsW (hE₂split hg'₂ hgA) hi') + have hbfin : (Whitney.bdry J.toGraph A).Finite := hXfin.subset hbX + have hbc : (Whitney.bdry J.toGraph A).ncard ≤ 2 := (ncard_le_ncard hbX hXfin).trans hord + -- A vertex of `G₂` that is not common has an edge. + have hedge : ∀ {v}, v ∈ J.V → ∃ g ∈ J.E, J.toGraph.Inc g v := by + intro v hv + obtain ⟨g, hg, hc⟩ := exists_edge_of_regionFacts hS r.facts hv + exact ⟨g, hg, inc_of_mem_closure hg hc hv⟩ + by_cases hA : A = ∅ + · -- Only edges of the wheel are on the side of `G₂`. + have hV₂ : V(G₂) ⊆ V(G₁) := by + intro v hv + by_contra hn + have hnX : v ∉ X := fun h₃ => hn h₃.1 + obtain ⟨g, hg, hi⟩ := hedge (hl₂.vertexSet_mono hv) + have hg₂ := hside hv hnX hg hi + exact hnoW hv hnX (hendsW (hE₂split hg₂ (by rw [hA]; exact notMem_empty _)) hi) + by_cases hemp : E(G₂) = ∅ + · exact Or.inl ⟨hV₂, hemp⟩ + obtain ⟨g, hg⟩ := nonempty_iff_ne_empty.mpr hemp + obtain ⟨u, v, huv⟩ := (G₂.edge_mem_iff_exists_isLink g).mp hg + have huv' : J.toGraph.IsLink g u v := hl₂.isLink_mono huv + have hne : u ≠ v := fun h₃ => hJl g v (h₃ ▸ huv') + have huX : u ∈ X := ⟨hV₂ huv.left_mem, huv.left_mem⟩ + have hvX : v ∈ X := ⟨hV₂ huv.right_mem, huv.right_mem⟩ + have hXeq : X = {u, v} := by + have hsub : ({u, v} : Set S) ⊆ X := by + rintro z (rfl | rfl) + · exact huX + · exact hvX + exact (eq_of_subset_of_ncard_le hsub (by rw [ncard_pair hne]; exact hord) hXfin).symm + have hgW := hE₂split hg (by rw [hA]; exact notMem_empty _) + have hX₂ : (V(G₂) ∩ V(G₁)).encard = 2 := by + rw [inter_comm, ← hX, hXeq, encard_pair hne] + refine Or.inr ⟨hX₂, fun z hz => absurd (hV₂ hz.1) hz.2, ?_⟩ + have hsing : E(G₂) ⊆ {g} := by + intro g' hg' + have hg'W := hE₂split hg' (by rw [hA]; exact notMem_empty _) + obtain ⟨c, d, hcd⟩ := (G₂.edge_mem_iff_exists_isLink g').mp hg' + have hcd' : J.toGraph.IsLink g' c d := hl₂.isLink_mono hcd + have hc : c ∈ X := ⟨hV₂ hcd.left_mem, hcd.left_mem⟩ + have hd : d ∈ X := ⟨hV₂ hcd.right_mem, hcd.right_mem⟩ + have hcdne : c ≠ d := fun h₃ => hJl g' d (h₃ ▸ hcd') + have hlk₁ := (hu.linkW g hgW u v).mp huv' + have hlk₂ := (hu.linkW g' hg'W c d).mp hcd' + rw [hXeq] at hc hd + rcases hc with rfl | rfl <;> rcases hd with rfl | rfl + · exact absurd rfl hcdne + · exact hw.simple _ _ _ _ hlk₂ hlk₁ + · exact hw.simple _ _ _ _ hlk₂.symm hlk₁ + · exact absurd rfl hcdne + simpa using (encard_mono hsing).trans (by simp : ({g} : Set (Set S)).encard ≤ _) + -- Some edges of `H` are on the side of `G₂`, and they form a path. + obtain ⟨x, y, P, hxy, hbd, hPs, hpath, hPE, hin⟩ := + exists_thread f r hS hsph hAH hbc hbfin (nonempty_iff_ne_empty.mpr hA) + have hxX : x ∈ X := hbX (hbd ▸ Or.inl rfl) + have hyX : y ∈ X := hbX (hbd ▸ Or.inr rfl) + have hXeq : X = {x, y} := by + have hsub : ({x, y} : Set S) ⊆ X := by + rintro z (rfl | rfl) + · exact hxX + · exact hyX + exact (eq_of_subset_of_ncard_le hsub (by rw [ncard_pair hxy]; exact hord) hXfin).symm + have hPJ : P.IsSubdrawing J := ⟨hPs.1.trans f.Vsub, hPs.2.trans f.Esub⟩ + -- The ends are vertices of `H`. + have hbdH : ∀ {z}, z ∈ Whitney.bdry J.toGraph A → z ∈ H.V := by + rintro z ⟨⟨g, hg, hi⟩, -⟩ + obtain ⟨t, ht⟩ := hi + exact ((hu.linkH g hg.2 z t).mp ht).left_mem + have hxH : x ∈ H.V := hbdH (hbd ▸ Or.inl rfl) + have hyH : y ∈ H.V := hbdH (hbd ▸ Or.inr rfl) + have hE₂ : E(G₂) = P.E := by + rw [hPE] + refine subset_antisymm (fun g hg => ?_) inter_subset_left + by_contra hn + have hgW := hE₂split hg hn + obtain ⟨c, d, hcd⟩ := (G₂.edge_mem_iff_exists_isLink g).mp hg + have hcd' : J.toGraph.IsLink g c d := hl₂.isLink_mono hcd + have hlk := (hu.linkW g hgW c d).mp hcd' + have hcX : c ∈ X := by + by_contra hn' + exact hnoW hcd.left_mem hn' hlk.left_mem + have hdX : d ∈ X := by + by_contra hn' + exact hnoW hcd.right_mem hn' hlk.right_mem + have hcB : c ∈ B := hB c (by + rw [hXeq] at hcX + rcases hcX with rfl | rfl + · exact hxH + · exact hyH) hlk.left_mem + have hdB : d ∈ B := hB d (by + rw [hXeq] at hdX + rcases hdX with rfl | rfl + · exact hxH + · exact hyH) hlk.right_mem + exact hw.nob g c d hlk hcB hdB + have hxP : x ∈ P.V := by + obtain ⟨W₀, -, hV₀, -⟩ := id hpath + rw [hV₀] + exact start_mem_support W₀ + have hyP : y ∈ P.V := by + obtain ⟨W₀, -, hV₀, -⟩ := id hpath + rw [hV₀] + exact end_mem_support W₀ + have hX₂ : (V(G₂) ∩ V(G₁)).encard = 2 := by + rw [inter_comm, ← hX, hXeq, encard_pair hxy] + -- A vertex on the path is on the side of `G₂`. + have hPinV : ∀ {v}, v ∈ P.V → v ≠ x → v ≠ y → v ∈ V(G₂) \ V(G₁) := by + intro v hv h₁ h₂ + have hedgeP : ∃ g ∈ P.E, P.toGraph.Inc g v := by + obtain ⟨W₀, hs₀, hV₀, hE₀⟩ := id hpath + have hvs : v ∈ W₀.support := by + rw [hV₀] at hv + exact hv + obtain ⟨e, he, -, -, -, hie, -⟩ := exists_two_edges_at_inner W₀ hs₀ hvs h₁ h₂ + exact ⟨e, hE₀ ▸ he, hie⟩ + obtain ⟨g, hg, hi⟩ := hedgeP + have hv₂ : v ∈ V(G₂) := mem_V_of_closure hl₂ (hE₂ ▸ hg) (mem_closure_of_inc hi) (hPJ.1 hv) + refine ⟨hv₂, fun hv₁ => ?_⟩ + have : v ∈ X := ⟨hv₁, hv₂⟩ + rw [hXeq] at this + rcases this with h₃ | h₃ + · exact h₁ h₃ + · exact h₂ h₃ + have hV₂P : ∀ {v}, v ∈ V(G₂) \ V(G₁) → v ∈ P.V ∧ v ≠ x ∧ v ≠ y := by + rintro v ⟨hv, hn⟩ + have hnX : v ∉ X := fun h₃ => hn h₃.1 + have hvx : v ≠ x := fun h₃ => hnX (h₃ ▸ hxX) + have hvy : v ≠ y := fun h₃ => hnX (h₃ ▸ hyX) + obtain ⟨g, hg, hi⟩ := hedge (hl₂.vertexSet_mono hv) + have hg₂ := hside hv hnX hg hi + have hgP : g ∈ P.E := hE₂ ▸ hg₂ + exact ⟨mem_V_of_inc_sub hPJ hgP hi, hvx, hvy⟩ + refine Or.inr ⟨hX₂, fun v hv => ?_, ?_⟩ + · obtain ⟨hvP, h₁, h₂⟩ := hV₂P hv + obtain ⟨-, hall⟩ := hin v hvP h₁ h₂ + have hset : {g | J.toGraph.Inc g v} = {g | P.toGraph.Inc g v} := by + ext g + constructor + · intro hi + have hgP := hall g hi.edge_mem hi + exact inc_of_mem_closure hgP (mem_closure_of_inc hi) hvP + · intro hi + exact inc_of_mem_closure (hPJ.2 hi.edge_mem) (mem_closure_of_inc hi) (hPJ.1 hvP) + change {g | J.toGraph.Inc g v}.encard = 2 + have hfin : {g | P.toGraph.Inc g v}.Finite := + P.finite_edges.subset fun _ hg => hg.edge_mem + rw [hset, ← hfin.cast_ncard_eq] + exact_mod_cast path_two hpath hvP h₁ h₂ + · rw [hE₂] + have hsub : P.V \ {x, y} ⊆ V(G₂) \ V(G₁) := fun v hv => + hPinV hv.1 (fun h₃ => hv.2 (Or.inl h₃)) (fun h₃ => hv.2 (Or.inr h₃)) + have hfinV : (V(G₂) \ V(G₁)).Finite := + J.finite_V.subset fun z hz => hl₂.vertexSet_mono hz.1 + have hfinE : P.E.Finite := P.finite_edges + rw [← hfinE.cast_ncard_eq, ← hfinV.cast_ncard_eq] + exact_mod_cast (path_count hpath hxy hxP hyP).trans (by + have := ncard_le_ncard hsub hfinV + omega) + +end Sep + +/-- **The union of a rigid drawing and a wheel is good.** -/ +theorem good_of_wheel [ConnectedSpace S] (f : Frame H J Δ a) (r : Rad J Γ') (hw : Wheel W B Δ D₂) + (hu : IsUnion H W J) (hB : ∀ v ∈ H.V, v ∈ W.V → v ∈ B) (hc : H.U ∩ W.U ⊆ H.V ∩ W.V) + (hS : IsClosedSurface S) (hsph : IsSphere S) : Good J.toGraph := by + classical + have hJl : ∀ e v, ¬ J.toGraph.IsLink e v v := by + intro e v hl + have he : e ∈ H.E ∪ W.E := hu.hE ▸ hl.edge_mem + rcases he with he | he + · have hsub : Whitney.bdry J.toGraph {e} ⊆ {v} := by + rintro z ⟨⟨g, rfl, t, ht⟩, -⟩ + rcases J.toGraph.eq_or_eq_of_isLink_of_isLink ht hl with h₁ | h₁ <;> exact h₁ + have hc : (Whitney.bdry J.toGraph {e}).ncard ≤ 2 := + (ncard_le_ncard hsub (toFinite _)).trans (by simp) + obtain ⟨F, D, x, y, -, -, -, -, -, -, hxy, hcap, -, -, hF⟩ := + exists_dial_of_edge f r hS hsph (singleton_subset_iff.mpr he) hc + ((toFinite ({v} : Set S)).subset hsub) rfl + have hx : x ∈ F ∩ H.V := hcap ▸ Or.inl rfl + have hy : y ∈ F ∩ H.V := hcap ▸ Or.inr rfl + exact hxy ((hsub (hF hx)).trans (hsub (hF hy)).symm) + · exact hw.nl e v ((hu.linkW e he v v).mp hl) + refine ⟨J.finite_V, J.finite_edges, hJl, ?_, ?_⟩ + · obtain ⟨T, hTV, hT4, hT3⟩ := hw.four + have hsub : T ⊆ {v | v ∈ V(J.toGraph) ∧ deg J.toGraph v ≠ 2} := by + intro v hv + have hvJ : v ∈ J.V := hu.hV ▸ Or.inr (hTV hv) + refine ⟨hvJ, fun hd => ?_⟩ + have hmono : {e | W.toGraph.Inc e v} ⊆ {e | J.toGraph.Inc e v} := by + rintro e ⟨t, ht⟩ + exact ⟨t, (hu.linkW e ht.edge_mem v t).mpr ht⟩ + have hfin : {e | J.toGraph.Inc e v}.Finite := J.finite_edges.subset fun e he => he.edge_mem + have h₁ := ncard_le_ncard hmono hfin + have h₂ := hT3 v hv + change {e | J.toGraph.Inc e v}.encard = 2 at hd + rw [← hfin.cast_ncard_eq] at hd + have hcard : {e | J.toGraph.Inc e v}.ncard = 2 := by exact_mod_cast hd + omega + exact hT4.trans (ncard_le_ncard hsub (J.finite_V.subset fun _ hz => hz.1)) + · intro G₁ G₂ hs hord + obtain ⟨hl₁, hl₂, hV, hE, hdis⟩ := id hs + set X := V(G₁) ∩ V(G₂) with hX + let Y := X ∩ W.V + have hYfin : Y.Finite := W.finite_V.subset inter_subset_right + have hXfin : X.Finite := J.finite_V.subset fun z hz => hl₁.vertexSet_mono hz.1 + have hYc : Y.ncard ≤ 2 := (ncard_le_ncard inter_subset_left hXfin).trans hord + have hWJ : W.U ⊆ J.U := by + rw [W.U_eq, J.U_eq] + refine union_subset_union (hu.hV ▸ subset_union_right) ?_ + rw [hu.hE] + exact biUnion_subset_biUnion_left subset_union_right + have hside := hw.side (pts G₁) (pts G₂) Y (isClosed_pts hl₁) (isClosed_pts hl₂) + (hWJ.trans (pts_cover hs)) (by + rintro z ⟨⟨hzW, h₁⟩, h₂⟩ + have hzX := pts_cap hs ⟨h₁, h₂⟩ + refine ⟨hzX, ?_⟩ + have hzJ : z ∈ J.V := hl₁.vertexSet_mono hzX.1 + rw [hu.hV] at hzJ + rcases hzJ with hzH | hzW' + · exact (hc ⟨H.V_subset_U hzH, hzW⟩).2 + · exact hzW') inter_subset_right hYc + have hvert : ∀ {K : Graph S (Set S)}, K ≤ J.toGraph → W.V \ Y ⊆ pts K → + W.V \ X ⊆ V(K) := by + intro K hK hsub v hv + have hvJ : v ∈ J.V := hu.hV ▸ Or.inr hv.1 + exact mem_V_of_pts hK (hsub ⟨hv.1, fun h₁ => hv.2 h₁.1⟩) hvJ + rcases hside with h₁ | h₁ + · exact Or.inr (thin_of_side f r hw hu hB hS hsph hs hord (hvert hl₁ h₁) hJl) + · have hs' : IsGraphSeparation J.toGraph G₂ G₁ := + ⟨hl₂, hl₁, by rw [union_comm]; exact hV, by rw [union_comm]; exact hE, hdis.symm⟩ + refine Or.inl (thin_of_side f r hw hu hB hS hsph hs' (by rw [inter_comm]; exact hord) ?_ hJl) + rw [inter_comm] + exact hvert hl₂ h₁ + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM14/RigidMap.lean b/LeanPool/GraphMinor/GM14/RigidMap.lean new file mode 100644 index 0000000000..59fa576988 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/RigidMap.lean @@ -0,0 +1,521 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Whitney +public import LeanPool.GraphMinor.GM14.Section6a +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Moving a drawing to another surface + +Let `f` and `f'` be inverse homeomorphisms between a compact set `A` and a set `B` in another space. +A +drawing in `A` then has an image in `B`: `mapD`. The image has the same graph (`mapIso`), and paths +go +to paths. If `A` and `B` are closed discs whose boundaries correspond, then frontiers of closed +subsets +correspond too (`subBd_image`), and rigidity carries over (`isRigidIn_mapD`). +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM11 + +universe u v + +variable {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] [T2Space X] [T2Space Y] +variable {A : Set X} {B : Set Y} {f : X → Y} {f' : Y → X} + +omit [T2Space X] [T2Space Y] in +theorem PH.injOn (h : PH A B f f') : InjOn f A := h.2.2.1.injOn + +omit [T2Space X] [T2Space Y] in +theorem PH.left (h : PH A B f f') {x : X} (hx : x ∈ A) : f' (f x) = x := h.2.2.1 hx + +omit [T2Space X] [T2Space Y] in +theorem PH.right (h : PH A B f f') {y : Y} (hy : y ∈ B) : f (f' y) = y := h.2.2.2.1 hy + +omit [T2Space X] [T2Space Y] in +theorem PH.back (h : PH A B f f') {Z : Set X} (hZ : Z ⊆ A) : f' '' (f '' Z) = Z := by + ext x + constructor + · rintro ⟨_, ⟨z, hz, rfl⟩, rfl⟩ + rwa [h.left (hZ hz)] + · intro hx + exact ⟨f x, mem_image_of_mem f hx, h.left (hZ hx)⟩ + +omit [T2Space X] [T2Space Y] in +theorem PH.mem_image_iff (h : PH A B f f') {Z : Set X} (hZ : Z ⊆ A) {x : X} (hx : x ∈ A) : + f x ∈ f '' Z ↔ x ∈ Z := by + constructor + · rintro ⟨z, hz, he⟩ + rwa [← h.injOn (hZ hz) hx he] + · exact fun hz => mem_image_of_mem f hz + +omit [T2Space X] [T2Space Y] in +theorem PH.image_sub (h : PH A B f f') {Z : Set X} (hZ : Z ⊆ A) : f '' Z ⊆ B := + fun _ ⟨_, hz, he⟩ => he ▸ h.1 (hZ hz) + +omit [T2Space X] in +omit [T2Space Y] in +theorem PH.image_isCompact (h : PH A B f f') {Z : Set X} (hZ : Z ⊆ A) (hc : IsCompact Z) : + IsCompact (f '' Z) := hc.image_of_continuousOn (h.2.2.2.2.1.mono hZ) + +omit [T2Space X] in +theorem PH.image_isClosed (h : PH A B f f') (hA : IsCompact A) {Z : Set X} (hZ : Z ⊆ A) + (hc : IsClosed Z) : IsClosed (f '' Z) := + (h.image_isCompact hZ (hA.of_isClosed_subset hc hZ)).isClosed + +/-- Inverse homeomorphisms carry closures to closures. -/ +theorem PH.image_closure (h : PH A B f f') (hA : IsCompact A) {Z : Set X} (hZ : Z ⊆ A) : + f '' closure Z = closure (f '' Z) := by + have hcl : closure Z ⊆ A := closure_minimal hZ hA.isClosed + refine subset_antisymm ((h.2.2.2.2.1.mono hcl).image_closure) ?_ + exact closure_minimal (image_mono subset_closure) (h.image_isClosed hA hcl isClosed_closure) + +omit [T2Space X] [T2Space Y] in +theorem PH.restrict' (h : PH A B f f') {Z : Set X} (hZ : Z ⊆ A) : PH Z (f '' Z) f f' := + PH.restrict h hZ (h.image_sub hZ) (fun _ hz => mem_image_of_mem f hz) (fun _ hy => by + obtain ⟨z, hz, rfl⟩ := hy + rwa [h.left (hZ hz)]) + +omit [T2Space X] [T2Space Y] in +/-- Inverse homeomorphisms carry arc components to arc components. -/ +theorem arcComponentsIn_PH (h : PH A B f f') {F : Set X} (hF : F ⊆ A) : + arcComponentsIn (f '' F) = image f '' arcComponentsIn F := by + have hpath : ∀ {Z : Set X}, Z ⊆ A → IsPathConnected Z → IsPathConnected (f '' Z) := + fun hZ hp => hp.image' (h.2.2.2.2.1.mono hZ) + have hpath' : ∀ {Z : Set Y}, Z ⊆ B → IsPathConnected Z → IsPathConnected (f' '' Z) := + fun hZ hp => hp.image' (h.2.2.2.2.2.mono hZ) + ext C' + constructor + · rintro ⟨hne', hsub', hpc', hmax'⟩ + have hC'B : C' ⊆ B := hsub'.trans (h.image_sub hF) + have hback : f '' (f' '' C') = C' := h.symm.back hC'B + have hsub : f' '' C' ⊆ F := by + rintro _ ⟨y, hy, rfl⟩ + obtain ⟨z, hz, rfl⟩ := hsub' hy + rwa [h.left (hF hz)] + refine ⟨f' '' C', ⟨hne'.image f', hsub, hpath' hC'B hpc', ?_⟩, hback⟩ + intro D hDF hDpc hsubD + have hD' : f '' D = C' := by + refine hmax' (f '' D) (image_mono hDF) (hpath (hDF.trans hF) hDpc) ?_ + rw [← hback] + exact image_mono hsubD + rw [← hD', h.back (hDF.trans hF)] + · rintro ⟨C, ⟨hne, hsub, hpc, hmax⟩, rfl⟩ + refine ⟨hne.image f, image_mono hsub, hpath (hsub.trans hF) hpc, ?_⟩ + intro D' hD'F hD'pc hsubD' + have hD'B : D' ⊆ B := hD'F.trans (h.image_sub hF) + have hD : f' '' D' = C := by + refine hmax (f' '' D') ?_ (hpath' hD'B hD'pc) ?_ + · rintro _ ⟨y, hy, rfl⟩ + obtain ⟨z, hz, rfl⟩ := hD'F hy + rwa [h.left (hF hz)] + · have := image_mono (f := f') hsubD' + rwa [h.back (hsub.trans hF)] at this + rw [← hD, h.symm.back hD'B] + +omit [T2Space X] in +/-- The image of a line is a line. -/ +theorem PH.line_image (h : PH A B f f') {L : Set X} {u v : X} (hL : L ⊆ A) + (hl : IsLineWithEnds L u v) : IsLineWithEnds (f '' L) (f u) (f v) := + hl.image_under_injOn (h.2.2.2.2.1.mono hL) (h.injOn.mono hL) + +omit [T2Space X] in +/-- The image of an `O`-arc is an `O`-arc. -/ +theorem PH.oArc_image (h : PH A B f f') {L : Set X} (hL : L ⊆ A) (hl : IsOArc L) : + IsOArc (f '' L) := by + obtain ⟨g⟩ := hl + let e : Circle → Y := fun t => f (g t).1 + have hec : Continuous e := + (h.2.2.2.2.1.mono hL).comp_continuous (continuous_subtype_val.comp g.continuous) fun t => + (g t).2 + have hei : Function.Injective e := fun x y he => + g.injective (Subtype.ext (h.injOn (hL (g x).2) (hL (g y).2) he)) + have hr : range e = f '' L := by + ext y + constructor + · rintro ⟨t, rfl⟩ + exact ⟨_, (g t).2, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + exact ⟨g.symm ⟨z, hz⟩, by simp [e]⟩ + have hem := hec.isClosedEmbedding hei + exact ⟨hem.isEmbedding.toHomeomorph.trans (Homeomorph.setCongr hr)⟩ + +omit [T2Space X] [T2Space Y] in +/-- The image of a closed disc is a closed disc. -/ +theorem PH.disc_image (h : PH A B f f') {D : Set X} (hD : D ⊆ A) (hd : IsClosedDisc D) : + IsClosedDisc (f '' D) := by + obtain ⟨g⟩ := hd + have hr := h.restrict' hD + let e : D ≃ₜ (f '' D) := + { toFun := fun z => ⟨f z.1, mem_image_of_mem f z.2⟩ + invFun := fun y => ⟨f' y.1, by + obtain ⟨_, ⟨z, hz, rfl⟩⟩ := y + simpa [h.left (hD hz)] using hz⟩ + left_inv := fun z => Subtype.ext (h.left (hD z.2)) + right_inv := fun y => Subtype.ext (h.right (h.image_sub hD y.2)) + continuous_toFun := by + refine Continuous.subtype_mk ?_ _ + exact (h.2.2.2.2.1.mono hD).comp_continuous continuous_subtype_val fun z => z.2 + continuous_invFun := by + refine Continuous.subtype_mk ?_ _ + exact (h.2.2.2.2.2.mono (h.image_sub hD)).comp_continuous continuous_subtype_val + fun z => z.2 } + exact ⟨g.trans e⟩ + +section Map + +variable (hP : PH A B f f') (hA : IsCompact A) (H : Drawing X) (hU : H.U ⊆ A) + +include hP hU in +omit [TopologicalSpace Y] [T2Space X] [T2Space Y] hP in +theorem cap_image {e : Set X} (he : e ∈ H.E) : e ⊆ A := + ((subset_closure.trans (H.closure_subset_U he)).trans hU) + +/-- The image of a drawing. -/ +noncomputable def mapD : Drawing Y where + U := f '' H.U + V := f '' H.V + V_subset_U := image_mono H.V_subset_U + isClosed_U := hP.image_isClosed hA hU H.isClosed_U + finite_V := H.finite_V.image f + finite_edges := by + have hdiff : f '' H.U \ f '' H.V = f '' (H.U \ H.V) := + (hP.injOn.mono hU).image_sdiff_subset H.V_subset_U |>.symm + rw [hdiff, arcComponentsIn_PH hP (sdiff_subset.trans hU)] + exact H.finite_edges.image (image f) + edge_cond := by + have hdiff : f '' H.U \ f '' H.V = f '' (H.U \ H.V) := + (hP.injOn.mono hU).image_sdiff_subset H.V_subset_U |>.symm + intro e' he' + rw [hdiff, arcComponentsIn_PH hP (sdiff_subset.trans hU)] at he' + obtain ⟨e, he, rfl⟩ := he' + have heA : e ⊆ A := cap_image H hU he + have hclA : closure e ⊆ A := closure_minimal heA hA.isClosed + have hcap : closure (f '' e) ∩ f '' H.V = f '' (closure e ∩ H.V) := by + rw [← hP.image_closure hA heA] + exact ((hP.injOn.mono (union_subset hclA (H.V_subset_U.trans hU))).image_inter + subset_union_left subset_union_right).symm + rcases H.edge_cond e he with ⟨u, v, huv, hcap_e, hL⟩ | ⟨u, hcap_e, hO⟩ + · left + have hu : u ∈ closure e ∩ H.V := hcap_e ▸ Or.inl rfl + have hv : v ∈ closure e ∩ H.V := hcap_e ▸ Or.inr rfl + refine ⟨f u, f v, fun h => huv (hP.injOn (hclA hu.1) (hclA hv.1) h), ?_, ?_⟩ + · rw [hcap, hcap_e, image_pair] + · rw [← hP.image_closure hA heA] + exact hP.line_image hclA hL + · right + refine ⟨f u, ?_, ?_⟩ + · rw [hcap, hcap_e, image_singleton] + · rw [← hP.image_closure hA heA] + exact hP.oArc_image hclA hO + +theorem mapD_U : (mapD hP hA H hU).U = f '' H.U := rfl + +theorem mapD_V : (mapD hP hA H hU).V = f '' H.V := rfl + +theorem mapD_E : (mapD hP hA H hU).E = image f '' H.E := by + have hdiff : f '' H.U \ f '' H.V = f '' (H.U \ H.V) := + (hP.injOn.mono hU).image_sdiff_subset H.V_subset_U |>.symm + change arcComponentsIn (f '' H.U \ f '' H.V) = _ + rw [hdiff, arcComponentsIn_PH hP (sdiff_subset.trans hU)] + rfl + +include hP hA in +theorem cap_image_eq {e Z : Set X} (he : e ⊆ A) (hZ : Z ⊆ A) : + closure (f '' e) ∩ f '' Z = f '' (closure e ∩ Z) := by + have hclA : closure e ⊆ A := closure_minimal he hA.isClosed + rw [← hP.image_closure hA he] + exact ((hP.injOn.mono (union_subset hclA hZ)).image_inter + subset_union_left subset_union_right).symm + +include hP in +omit [T2Space X] [T2Space Y] in +theorem image_injOn_E {E : Set (Set X)} (hE : ∀ e ∈ E, e ⊆ A) : InjOn (image f) E := by + intro e he e' he' h + have : image f e = image f e' := h + rw [← hP.back (hE e he), ← hP.back (hE e' he')] + exact congrArg _ this + +/-- The drawing and its image are isomorphic. -/ +noncomputable def mapIso : Iso H.toGraph (mapD hP hA H hU).toGraph where + vertexEquiv := + { toFun := fun v => ⟨f v.1, mem_image_of_mem f v.2⟩ + invFun := fun w => ⟨f' w.1, by + obtain ⟨_, ⟨z, hz, rfl⟩⟩ := w + have hzH : z ∈ H.V := hz + change f' (f z) ∈ H.V + rwa [hP.left (hU (H.V_subset_U hzH))]⟩ + left_inv := fun v => Subtype.ext (hP.left (hU (H.V_subset_U v.2))) + right_inv := fun w => Subtype.ext (by + obtain ⟨_, ⟨z, hz, rfl⟩⟩ := w + have hzH : z ∈ H.V := hz + change f (f' (f z)) = f z + rw [hP.left (hU (H.V_subset_U hzH))]) } + edgeEquiv := + have hm : ∀ {e}, e ∈ H.E → f '' e ∈ (mapD hP hA H hU).E := fun he => by + rw [mapD_E] + exact mem_image_of_mem _ he + have hm' : ∀ {e'}, e' ∈ (mapD hP hA H hU).E → ∃ e ∈ H.E, f '' e = e' := fun he' => by + rw [mapD_E] at he' + exact he' + { toFun := fun e => ⟨f '' e.1, hm e.2⟩ + invFun := fun w => ⟨f' '' w.1, by + obtain ⟨e, he, heq⟩ := hm' w.2 + rw [← heq, hP.back (cap_image H hU he)] + exact he⟩ + left_inv := fun e => Subtype.ext (hP.back (cap_image H hU e.2)) + right_inv := fun w => Subtype.ext (by + obtain ⟨e, he, heq⟩ := hm' w.2 + change f '' (f' '' w.1) = w.1 + rw [← heq, hP.back (cap_image H hU he)]) } + isLink_iff := by + rintro ⟨e, he⟩ ⟨x, hx⟩ ⟨y, hy⟩ + have heA : e ⊆ A := cap_image H hU he + have hVA : H.V ⊆ A := H.V_subset_U.trans hU + have hclA : closure e ⊆ A := closure_minimal heA hA.isClosed + have hcap := cap_image_eq hP hA heA hVA + have hE' : f '' e ∈ (mapD hP hA H hU).E := by + rw [mapD_E] + exact mem_image_of_mem _ he + constructor + · rintro ⟨-, -, -, hc⟩ + refine ⟨hE', mem_image_of_mem f hx, mem_image_of_mem f hy, ?_⟩ + change closure (f '' e) ∩ f '' H.V = {f x, f y} + rw [hcap, hc, image_pair] + · rintro ⟨-, -, -, hc⟩ + refine ⟨he, hx, hy, ?_⟩ + have hc' : closure (f '' e) ∩ f '' H.V = {f x, f y} := hc + rw [hcap, ← image_pair] at hc' + refine (hP.injOn.image_eq_image_iff (inter_subset_left.trans hclA) ?_).mp hc' + rintro z (rfl | rfl) + · exact hVA hx + · exact hVA hy + +theorem mapIso_vertex (v : V(H.toGraph)) : + ((mapIso hP hA H hU).vertexEquiv v).1 = f v.1 := rfl + +theorem mapIso_edge (e : E(H.toGraph)) : + ((mapIso hP hA H hU).edgeEquiv e).1 = f '' e.1 := rfl + +end Map + +omit [T2Space X] [T2Space Y] in +/-- Maps that keep links, and are injective on vertices, carry paths to paths. -/ +theorem isPathBetween_map {P : Drawing X} {Q : Drawing Y} (g : X → Y) (ge : Set X → Set Y) + (hl : ∀ e u v, P.toGraph.IsLink e u v → Q.toGraph.IsLink (ge e) (g u) (g v)) + (hV : Q.V = g '' P.V) (hE : Q.E = ge '' P.E) (hi : InjOn g P.V) {a b : X} + (h : P.IsPathBetween a b) : Q.IsPathBetween (g a) (g b) := by + obtain ⟨W, hs, hPV, hPE⟩ := h + have key : ∀ {c d : X} (W : GraphWalk P.toGraph c d), ∃ W' : GraphWalk Q.toGraph (g c) (g d), + W'.support = W.support.map g ∧ W'.edges = W.edges.map ge := by + intro c d W + induction W with + | nil hv => + have hv' : g _ ∈ Q.V := hV ▸ mem_image_of_mem g hv + exact ⟨GraphWalk.nil hv', rfl, rfl⟩ + | cons hlink rest ih => + obtain ⟨W', h₁, h₂⟩ := ih + refine ⟨GraphWalk.cons (hl _ _ _ hlink) W', ?_, ?_⟩ + · simp [GraphWalk.support, h₁] + · simp [GraphWalk.edges, h₂] + obtain ⟨W', h₁, h₂⟩ := key W + refine ⟨W', ?_, ?_, ?_⟩ + · change W'.support.Nodup + rw [h₁] + refine List.Nodup.map_on (fun x hx y hy he => hi ?_ ?_ he) hs + · rw [hPV] + exact hx + · rw [hPV] + exact hy + · rw [hV, hPV] + ext y + simp [h₁] + · rw [hE, hPE] + ext y + simp [h₂] + +section Rigid + +variable (hP : PH A B f f') (hA : IsCompact A) (H : Drawing X) (hU : H.U ⊆ A) + +theorem interSet_E {T : Set X} : (H.interSet T).E = {e | e ∈ H.E ∧ e ⊆ T} := by + change (H.span _ _).E = _ + rw [Drawing.span_E] + ext e + exact ⟨fun h => h.1, fun h => ⟨h, h.1⟩⟩ + +theorem mapD_interSet_E {T : Set X} (hT : T ⊆ A) : + ((mapD hP hA H hU).interSet (f '' T)).E = image f '' (H.interSet T).E := by + rw [interSet_E, interSet_E, mapD_E] + ext e' + constructor + · rintro ⟨⟨e, he, rfl⟩, hsub⟩ + refine ⟨e, ⟨he, ?_⟩, rfl⟩ + have := image_mono (f := f') hsub + rwa [hP.back hT, hP.back (cap_image H hU he)] at this + · rintro ⟨e, ⟨he, hsub⟩, rfl⟩ + exact ⟨mem_image_of_mem _ he, image_mono hsub⟩ + +theorem mapD_interSet_V {T : Set X} (hT : T ⊆ A) : + ((mapD hP hA H hU).interSet (f '' T)).V = f '' (H.interSet T).V := by + have hVA : H.V ⊆ A := H.V_subset_U.trans hU + have hset : ∀ {e : Set X}, e ∈ H.E → closure (f '' e) ∩ f '' H.V = f '' (closure e ∩ H.V) := + fun he => cap_image_eq hP hA (cap_image H hU he) hVA + ext y + constructor + · rintro (⟨hy, -⟩ | hy) + · obtain ⟨⟨x, hx, rfl⟩, hxT⟩ := hy + exact ⟨x, Or.inl ⟨⟨hx, (hP.mem_image_iff hT (hVA hx)).mp hxT⟩, hx⟩, rfl⟩ + · obtain ⟨e', he', hy'⟩ := mem_iUnion₂.mp hy + have he₁ : e' ∈ ((mapD hP hA H hU).interSet (f '' T)).E := by + rw [interSet_E] + exact he'.1 + rw [mapD_interSet_E hP hA H hU hT] at he₁ + obtain ⟨e, he, rfl⟩ := he₁ + rw [interSet_E] at he + have hy'' : y ∈ closure (f '' e) ∩ f '' H.V := hy' + rw [hset he.1] at hy'' + obtain ⟨x, hx, rfl⟩ := hy'' + exact ⟨x, Or.inr (mem_iUnion₂.mpr ⟨e, ⟨he, he.1⟩, hx⟩), rfl⟩ + · rintro ⟨x, (⟨⟨hx, hxT⟩, -⟩ | hx), rfl⟩ + · exact Or.inl ⟨⟨mem_image_of_mem f hx, mem_image_of_mem f hxT⟩, mem_image_of_mem f hx⟩ + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + refine Or.inr (mem_iUnion₂.mpr ⟨f '' e, ?_, ?_⟩) + · have heE : e ∈ H.E := he.1.1 + refine ⟨⟨?_, image_mono he.1.2⟩, ?_⟩ + · rw [mapD_E] + exact mem_image_of_mem _ heE + · rw [mapD_E] + exact mem_image_of_mem _ heE + · change f x ∈ closure (f '' e) ∩ f '' H.V + rw [hset he.2] + exact mem_image_of_mem f hxe + +/-- Paths in `H ∩ T` go to paths in the image of `H` in `f(T)`. -/ +theorem path_image {T : Set X} (hT : T ⊆ A) {a b : X} (h : (H.interSet T).IsPathBetween a b) : + ((mapD hP hA H hU).interSet (f '' T)).IsPathBetween (f a) (f b) := by + have hVA : (H.interSet T).V ⊆ A := by + refine Subset.trans ?_ (H.V_subset_U.trans hU) + exact (Drawing.span_isSubdrawing _ _ _).1 + refine isPathBetween_map f (image f) ?_ (mapD_interSet_V hP hA H hU hT) + (mapD_interSet_E hP hA H hU hT) (hP.injOn.mono hVA) h + rintro e u v ⟨he, hu, hv, hc⟩ + refine ⟨?_, ?_, ?_, ?_⟩ + · have := mem_image_of_mem (image f) he + rw [← mapD_interSet_E hP hA H hU hT] at this + exact this + · have := mem_image_of_mem f hu + rw [← mapD_interSet_V hP hA H hU hT] at this + exact this + · have := mem_image_of_mem f hv + rw [← mapD_interSet_V hP hA H hU hT] at this + exact this + · have heE : e ∈ H.E := by + have := he + rw [interSet_E] at this + exact this.1 + change closure (f '' e) ∩ ((mapD hP hA H hU).interSet (f '' T)).V = _ + rw [mapD_interSet_V hP hA H hU hT, cap_image_eq hP hA (cap_image H hU heE) hVA, hc, + image_pair] + +end Rigid + +omit [T2Space X] [T2Space Y] in +theorem subBd_subset_of {Z : Set Y} (hZ : Z ⊆ B) (hc : IsClosed Z) : subBd Z ⊆ B := by + rintro p ⟨hp, -⟩ + exact hZ (hc.closure_eq ▸ hp) + +omit [T2Space X] [T2Space Y] in +/-- A point of a closed `Z` in `A` that is a limit of points off `Z` stays one under `f`, if the +frontier of `A` goes into the frontier of `B`. -/ +theorem subBd_image (hP : PH A B f f') + (hbd : f '' subBd A ⊆ subBd B) {Z : Set X} (hZ : Z ⊆ A) (hc : IsClosed Z) : + f '' subBd Z ⊆ subBd (f '' Z) := by + rintro _ ⟨p, ⟨hp, hp'⟩, rfl⟩ + have hpZ : p ∈ Z := hc.closure_eq ▸ hp + refine ⟨subset_closure (mem_image_of_mem f hpZ), ?_⟩ + by_cases hpA : p ∈ closure (univ \ A) + · have hq : f p ∈ subBd B := hbd ⟨p, ⟨subset_closure (hZ hpZ), hpA⟩, rfl⟩ + exact closure_mono (sdiff_subset_sdiff_right (hP.image_sub hZ)) hq.2 + · have hO : IsOpen (closure (univ \ A))ᶜ := isClosed_closure.isOpen_compl + have hsub : (closure (univ \ A))ᶜ ⊆ A := by + intro z hz + by_contra hn + exact hz (subset_closure ⟨mem_univ z, hn⟩) + let W := (closure (univ \ A))ᶜ ∩ (univ \ Z) + have hW : p ∈ closure W := by + have := hO.inter_closure (t := univ \ Z) + exact closure_mono (Subset.refl _) (this ⟨hpA, hp'⟩) + have hWA : W ⊆ A := inter_subset_left.trans hsub + have hcont : ContinuousWithinAt f W p := + (hP.2.2.2.2.1 p (hZ hpZ)).mono hWA + refine closure_mono ?_ (hcont.mem_closure_image hW) + rintro _ ⟨z, hz, rfl⟩ + refine ⟨mem_univ _, fun hzi => hz.2.2 ?_⟩ + exact (hP.mem_image_iff hZ (hWA hz)).mp hzi + +/-- **Rigidity carries over.** -/ +theorem isRigidIn_mapD (hP : PH A B f f') (hA : IsCompact A) + (hbd : f '' subBd A ⊆ subBd B) (hbd' : f' '' subBd B ⊆ subBd A) (H : Drawing X) (hU : H.U ⊆ A) + (hr : IsRigidIn H A) : IsRigidIn (mapD hP hA H hU) B := by + intro F' hF'B hO hcap hc + have hVA : H.V ⊆ A := H.V_subset_U.trans hU + have hFA : f' '' F' ⊆ A := hP.symm.image_sub hF'B + have hFF : f '' (f' '' F') = F' := hP.symm.back hF'B + have hcapV : f '' (f' '' F' ∩ H.V) = F' ∩ f '' H.V := by + conv_rhs => rw [← hFF] + exact (hP.injOn.mono (union_subset hFA hVA)).image_inter subset_union_left subset_union_right + obtain ⟨Δ, hΔA, hd, hbdΔ, hcase⟩ := hr (f' '' F') hFA (hP.symm.oArc_image hF'B hO) + (by + rintro z ⟨hz, hzU⟩ + have h₁ : f z ∈ F' := by + rw [← hFF] + exact mem_image_of_mem f hz + have h₂ := hcap ⟨h₁, mem_image_of_mem f hzU⟩ + exact (hP.mem_image_iff hVA (hU hzU)).mp h₂) + (by + have hcfin : (F' ∩ f '' H.V).Finite := (H.finite_V.image f).subset inter_subset_right + have hi : InjOn f (f' '' F' ∩ H.V) := hP.injOn.mono (inter_subset_left.trans hFA) + rw [← hi.ncard_image, hcapV] + exact hc) + have hΔc : IsClosed Δ := hd.isClosed + have hΔ' : f '' Δ ⊆ B := hP.image_sub hΔA + have hsub₁ := subBd_image hP hbd hΔA hΔc + have hsub₂ := subBd_image hP.symm hbd' hΔ' (hP.image_isClosed hA hΔA hΔc) + rw [hP.back hΔA] at hsub₂ + have hbdeq : subBd (f '' Δ) = F' := by + refine subset_antisymm ?_ ?_ + · have : f '' (f' '' subBd (f '' Δ)) ⊆ f '' (subBd Δ) := image_mono hsub₂ + rw [hP.symm.back (subBd_subset_of hΔ' (hP.image_isClosed hA hΔA hΔc)), hbdΔ, hFF] at this + exact this + · have := hsub₁ + rwa [hbdΔ, hFF] at this + refine ⟨f '' Δ, hΔ', hP.disc_image hΔA hd, hbdeq, ?_⟩ + rcases hcase with hcase | ⟨u, v, huv, hcap₂, hpath⟩ + · refine Or.inl ?_ + rintro _ ⟨⟨x, hx, rfl⟩, ⟨y, hy, he⟩⟩ + have hxy : y = x := hP.injOn (hU hy) (hΔA hx) he + subst hxy + rw [← hFF] + exact mem_image_of_mem f (hcase ⟨hx, hy⟩) + · refine Or.inr ⟨f u, f v, ?_, ?_, path_image hP hA H hU hΔA hpath⟩ + · have hu : u ∈ f' '' F' ∩ H.V := hcap₂ ▸ Or.inl rfl + have hv : v ∈ f' '' F' ∩ H.V := hcap₂ ▸ Or.inr rfl + exact fun h => huv (hP.injOn (hVA hu.2) (hVA hv.2) h) + · change F' ∩ f '' H.V = _ + rw [← hcapV, hcap₂, image_pair] + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM14/RigidNoose.lean b/LeanPool/GraphMinor/GM14/RigidNoose.lean new file mode 100644 index 0000000000..83ddd2bb4d --- /dev/null +++ b/LeanPool/GraphMinor/GM14/RigidNoose.lean @@ -0,0 +1,375 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.WhitneyPeripheral +public import LeanPool.GraphMinor.GM14.Section6a +import LeanPool.GraphMinor.GM11.SphereRegion +import LeanPool.GraphMinor.GM11.GlueFaces +import LeanPool.GraphMinor.GM11.RadialExists +import LeanPool.GraphMinor.GM11.Theorem61 +import LeanPool.GraphMinor.GM11.OArcCircuit + +/-! +# Curves that a rigid drawing forces around a separation + +Let `H` be a drawing that is rigid in a closed disc `Δ` in a sphere, and let `J` be a drawing with +`H` +inside `Δ` and with extra pieces outside. We show two things. + +First, `J` is 2-cell (`Frame.twoCell`), since rigidity gives a disc inside any region. So `J` has a +radial drawing, whose circuits meet `J` only in vertices. + +Second, this is the place where Graph Minors XIV uses "a form of Menger's theorem for planar +graphs". Let +`E` be a set of edges of `H`, and take the regions of the radial drawing that contain an edge of +`E`. +The boundary of their union meets `J` only in vertices that meet both `E` and another edge. If at +most +two vertices do so, then rigidity gives a dial for each `O`-arc in that boundary. A region outside +all +the dials cannot be both inside and outside the union, so each edge of `E` lies in a dial. As the +arc +meets an edge inside the disc, the disc must hold a path of `H`. This is `exists_dial_of_edge`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- If `Z` is a set of regions of `Γ'`, then a region of `N(Z)` does not hold both a point of a +member +of `Z` and a point outside the closures of the members of `Z`. -/ +theorem not_same_side [ConnectedSpace S] (hS : IsClosedSurface S) {Γ' : Drawing S} {Z : Set (Set S)} + (hZ : Z ⊆ Γ'.R) {s : Set S} (hs : s ∈ Z) {p a : S} (hp : p ∈ s) + (ha : a ∉ ⋃ t ∈ Z, closure t) : + ¬ ∃ r ∈ (boundaryDrawing Γ' Z).R, a ∈ r ∧ p ∈ r := by + classical + rintro ⟨r, hr, har, hpr⟩ + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hfin : Γ'.R.Finite := finite_R hS Γ' + set N := boundaryDrawing Γ' Z with hN + let Y := ⋃ t ∈ Z, closure t + let Y' := ⋃ t ∈ Γ'.R \ Z, closure t + have hYc : IsClosed Y := (hfin.subset hZ).isClosed_biUnion fun _ _ => isClosed_closure + have hYc' : IsClosed Y' := (hfin.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure + have hcov : (univ : Set S) ⊆ Y ∪ Y' := by + intro x _ + have hdense : x ∈ closure (⋃₀ Γ'.R) := by + refine mem_closure_iff.mpr fun O hO hxO => ?_ + obtain ⟨y, hyO, hyU⟩ := exists_notMem_U (Γ := Γ') hS hO ⟨x, hxO⟩ + obtain ⟨t, ht, hyt⟩ := exists_region_of_notMem hyU + exact ⟨y, hyO, t, ht, hyt⟩ + rw [hfin.closure_sUnion] at hdense + obtain ⟨t, ht, hxt⟩ := mem_iUnion₂.mp hdense + by_cases htZ : t ∈ Z + · exact Or.inl (mem_iUnion₂.mpr ⟨t, htZ, hxt⟩) + · exact Or.inr (mem_iUnion₂.mpr ⟨t, ⟨ht, htZ⟩, hxt⟩) + have hcap : Y ∩ Y' ⊆ N.U := by + rintro x ⟨hx, hx'⟩ + obtain ⟨t, ht, hxt⟩ := mem_iUnion₂.mp hx + obtain ⟨t', ht', hxt'⟩ := mem_iUnion₂.mp hx' + have htR := hZ ht + have hne : t ≠ t' := fun h' => ht'.2 (h' ▸ ht) + have hxU : x ∈ Γ'.U := by + rcases closure_region_subset htR hxt with h₁ | h₁ + · exfalso + obtain ⟨y, hy, hyt'⟩ := mem_closure_iff.mp hxt' t (region_isOpen htR) h₁ + exact hne (region_eq_of_mem htR ht'.1 hy hyt') + · exact h₁ + by_cases hxV : x ∈ Γ'.V + · exact N.V_subset_U ((mem_boundaryDrawing_V hS).mpr + ⟨⟨t, ht, hxV, Or.inr htR, hxt⟩, t', ht', hxV, Or.inr ht'.1, hxt'⟩) + · obtain ⟨e, he, hxe⟩ := Γ'.exists_edge_of_mem hxU hxV + have hN' : e ∈ N.E := mem_boundaryDrawing_E.mpr + ⟨⟨t, ht, he, htR, x, hxe, hxt⟩, t', ht', he, ht'.1, x, hxe, hxt'⟩ + exact N.closure_subset_U hN' (subset_closure hxe) + have hpY : p ∈ Y := mem_iUnion₂.mpr ⟨s, hs, subset_closure hp⟩ + have haY' : a ∈ Y' := (hcov (mem_univ a)).resolve_left ha + obtain ⟨z, hzr, hz, hz'⟩ := isPreconnected_closed_iff.mp (region_isPreconnected hr) Y Y' hYc hYc' + (fun x _ => hcov (mem_univ x)) ⟨p, hpr, hpY⟩ ⟨a, har, haY'⟩ + exact region_subset hr hzr (hcap ⟨hz, hz'⟩) + +/-- What we use about a drawing `H` in a closed disc `Δ` and a drawing `J` that extends it. -/ +structure Frame (H J : Drawing S) (Δ : Set S) (a : S) : Prop where + disc : IsClosedDisc Δ + bd : subBd Δ ⊆ J.U + Usub : H.U ⊆ Δ + normal : H.U ∩ subBd Δ ⊆ H.V + Vsub : H.V ⊆ J.V + Esub : H.E ⊆ J.E + rest : J.U ∩ (Δ \ subBd Δ) ⊆ H.U + conn : IsPreconnected (Δ ∪ J.U) + outside : a ∉ Δ + outer : IsPreconnected Δᶜ + rigid : IsRigidIn H Δ + +variable {H J Γ' : Drawing S} {Δ : Set S} {a : S} + +theorem Frame.U_subset (f : Frame H J Δ a) : H.U ⊆ J.U := by + intro x hx + rw [Drawing.U_eq] at hx ⊢ + rcases hx with hx | hx + · exact Or.inl (f.Vsub hx) + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact Or.inr (mem_iUnion₂.mpr ⟨e, f.Esub he, hxe⟩) + +omit [T2Space S] in +/-- A point of an edge of `J` is not a vertex of `J`. -/ +theorem edge_notMem_V {e : Set S} (he : e ∈ J.E) {x : S} (hx : x ∈ e) : x ∉ J.V := he.2.1 hx |>.2 + +theorem Frame.U_inter_V (f : Frame H J Δ a) {x : S} (hx : x ∈ H.U) (hxV : x ∈ J.V) : x ∈ H.V := by + by_contra hn + obtain ⟨e, he, hxe⟩ := H.exists_edge_of_mem hx hn + exact edge_notMem_V (f.Esub he) hxe hxV + +omit [T2Space S] in +/-- A closed disc with boundary in the interior of `Δ`, and inside `Δ`, misses the boundary of `Δ`. +-/ +theorem disc_misses_bd {D : Set S} (hD : subBd D ⊆ Δ \ subBd Δ) + (hDΔ : D ⊆ Δ) : Disjoint D (subBd Δ) := by + refine disjoint_left.mpr fun x hxD hxb => ?_ + have hxfr : x ∉ frontier D := by + rw [← subBd_eq_frontier] + exact fun h' => (hD h').2 hxb + have hxi : x ∈ interior D := by + by_contra hn + exact hxfr ⟨subset_closure hxD, hn⟩ + have : x ∈ interior Δ := interior_mono hDΔ hxi + rw [subBd_eq_frontier] at hxb + exact hxb.2 this + +/-- **`J` is 2-cell.** -/ +theorem Frame.twoCell [ConnectedSpace S] (f : Frame H J Δ a) (hS : IsClosedSurface S) + (hsph : IsSphere S) : + (PaintingOrDrawing.drawing J).IsTwoCell := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + refine ⟨inferInstance, fun r hr => ?_⟩ + have hr' : r ∈ J.R := hr + have hpre := region_isPreconnected hr' + have hne : r.Nonempty := region_nonempty hr' + have hfr : Disjoint r (subBd Δ) := + disjoint_left.mpr fun x hx hxb => region_subset hr' hx (f.bd hxb) + have hbdne : (subBd Δ).Nonempty := by + rw [subBd_eq_frontier] + exact nonempty_frontier_iff.mpr ⟨f.disc.isPathConnected.nonempty, + fun h' => f.outside (h' ▸ mem_univ a)⟩ + refine isOpenDisc_of_bound hS (region_isOpen hr') ⟨hne, hpre⟩ ?_ fun F hFr hF => ?_ + · obtain ⟨x, hx⟩ := hbdne + exact fun h' => region_subset hr' (h' ▸ mem_univ x) (f.bd hx) + have hFU : Disjoint F J.U := disjoint_left.mpr fun x hx hxU => region_subset hr' (hFr hx) hxU + have hdisc := subset_or_disjoint_of_frontier f.disc.isClosed hpre + (by rwa [← subBd_eq_frontier]) + rcases hdisc with hrΔ | hrΔ + · have hFH : F ∩ H.U = ∅ := by + refine eq_empty_of_forall_notMem fun x hx => ?_ + exact disjoint_left.mp hFU hx.1 (f.U_subset hx.2) + have hFV : F ∩ H.V = ∅ := eq_empty_of_subset (inter_subset_inter_right F H.V_subset_U) hFH + obtain ⟨D, hDΔ, hd, hbd, hcases⟩ := + f.rigid F (hFr.trans hrΔ) hF (by rw [hFH]; exact empty_subset _) + (by rw [hFV, ncard_empty]; omega) + have hDH : D ∩ H.U ⊆ F := by + rcases hcases with h₁ | ⟨u, v, huv, hc, -⟩ + · exact h₁ + · have h₁ : (F ∩ H.V).ncard = 2 := by rw [hc, ncard_pair huv] + rw [hFV, ncard_empty] at h₁ + omega + have hbdin : subBd D ⊆ Δ \ subBd Δ := fun x hx => by + have hxF : x ∈ F := hbd ▸ hx + exact ⟨hrΔ (hFr hxF), disjoint_left.mp hfr (hFr hxF)⟩ + have hDb := disc_misses_bd hbdin hDΔ + have hDJ : Disjoint D J.U := by + refine disjoint_left.mpr fun x hxD hxU => ?_ + have hxH : x ∈ H.U := f.rest ⟨hxU, hDΔ hxD, disjoint_left.mp hDb hxD⟩ + exact disjoint_left.mp hFU (hDH ⟨hxD, hxH⟩) hxU + have hbdF : discBd D = F := (IsClosedDisc.subBd_eq_discBd hS hd).symm.trans hbd + obtain ⟨x, hx⟩ := id hF |> fun ⟨φ⟩ => (⟨(φ 1).1, (φ 1).2⟩ : ∃ x, x ∈ F) + have hxD : x ∈ D := Surface.discBd_subset D (hbdF.symm ▸ hx) + exact ⟨D, subset_region hr' hd.isPathConnected.isConnected.isPreconnected hDJ hxD (hFr hx), hd, + hbdF⟩ + · have hT : Disjoint (Δ ∪ J.U) F := by + refine disjoint_left.mpr ?_ + rintro x (hx | hx) hxF + · exact disjoint_left.mp hrΔ (hFr hxF) hx + · exact disjoint_left.mp hFU hxF hx + obtain ⟨D, hd, hbdF, hdis⟩ := exists_disc_missing hS hsph hF f.conn hT + have hDJ : Disjoint D J.U := hdis.mono_right subset_union_right + obtain ⟨x, hx⟩ := id hF |> fun ⟨φ⟩ => (⟨(φ 1).1, (φ 1).2⟩ : ∃ x, x ∈ F) + have hxD : x ∈ D := Surface.discBd_subset D (hbdF.symm ▸ hx) + exact ⟨D, subset_region hr' hd.isPathConnected.isConnected.isPreconnected hDJ hxD (hFr hx), hd, + hbdF⟩ + +/-- The facts on a radial drawing `Γ'` of `J` that we use. -/ +structure Rad (J Γ' : Drawing S) : Prop where + cap : J.U ∩ Γ'.U = J.V + vsub : J.V ⊆ Γ'.V + facts : RegionFacts (PaintingOrDrawing.drawing J) Γ' + +/-- The regions of `Γ'` that hold an edge of `A`. -/ +def tiles (Γ' : Drawing S) (A : Set (Set S)) : Set (Set S) := {s | s ∈ Γ'.R ∧ ∃ e ∈ A, e ⊆ s} + +omit [T2Space S] in +theorem tiles_subset (A : Set (Set S)) : tiles Γ' A ⊆ Γ'.R := fun _ h => h.1 + +omit [T2Space S] in +theorem Rad.edge_off (r : Rad J Γ') {e : Set S} (he : e ∈ J.E) : Disjoint e Γ'.U := by + refine disjoint_left.mpr fun x hx hxU => ?_ + have : x ∈ J.U ∩ Γ'.U := ⟨J.closure_subset_U he (subset_closure hx), hxU⟩ + rw [r.cap] at this + exact edge_notMem_V he hx this + +omit [T2Space S] in +/-- A point of `J` in a region of `Γ'` lies on the edge of that region. -/ +theorem Rad.mem_edge (r : Rad J Γ') {e s : Set S} (he : e ∈ J.E) (hs : s ∈ Γ'.R) (hes : e ⊆ s) + {x : S} (hx : x ∈ s) (hxU : x ∈ J.U) : x ∈ e := by + have hxV : x ∉ J.V := fun h' => region_subset hs hx (Γ'.V_subset_U (r.vsub h')) + obtain ⟨g, hg, hxg⟩ := J.exists_edge_of_mem hxU hxV + have hgs : g ⊆ s := subset_region hs hg.2.2.1.isConnected.isPreconnected (r.edge_off hg) hxg hx + have := r.facts.2.1 s hs g hg e he hgs hes + exact this ▸ hxg + +omit [T2Space S] in +/-- Each edge of `J` lies in a region of `Γ'`. -/ +theorem Rad.exists_tile (r : Rad J Γ') {e : Set S} (he : e ∈ J.E) : ∃ s ∈ Γ'.R, e ⊆ s := by + obtain ⟨p, hp⟩ := he.1 + have hpU : p ∉ Γ'.U := disjoint_left.mp (r.edge_off he) hp + obtain ⟨s, hs, hps⟩ := exists_region_of_notMem hpU + exact ⟨s, hs, subset_region hs he.2.2.1.isConnected.isPreconnected (r.edge_off he) hp hps⟩ + +/-- An edge of `J` with a point in the interior of `Δ` is an edge of `H`. -/ +theorem Frame.mem_E (f : Frame H J Δ a) {g : Set S} (hg : g ∈ J.E) {q : S} (hq : q ∈ g) + (hqΔ : q ∈ Δ) (hqb : q ∉ subBd Δ) : g ∈ H.E := by + have hqU : q ∈ J.U := J.closure_subset_U hg (subset_closure hq) + have hqH : q ∈ H.U := f.rest ⟨hqU, hqΔ, hqb⟩ + have hqV : q ∉ H.V := fun h' => edge_notMem_V hg hq (f.Vsub h') + obtain ⟨g', hg', hqg'⟩ := H.exists_edge_of_mem hqH hqV + rw [J.edge_eq_of_mem hg (f.Esub hg') hq hqg'] + exact hg' + +/-- The closure of a region of `Γ'` that holds an edge of `H` lies in `Δ`. -/ +theorem Frame.tile_sub (f : Frame H J Δ a) (r : Rad J Γ') {e s : Set S} (he : e ∈ H.E) + (hs : s ∈ Γ'.R) (hes : e ⊆ s) : closure s ⊆ Δ := by + have hd : Disjoint s (frontier Δ) := by + rw [← subBd_eq_frontier] + refine disjoint_left.mpr fun x hx hxb => ?_ + have hxe := r.mem_edge (f.Esub he) hs hes hx (f.bd hxb) + have hxH : x ∈ H.U := H.closure_subset_U he (subset_closure hxe) + exact edge_notMem_V he hxe (f.normal ⟨hxH, hxb⟩) + have hsp : IsPreconnected s := region_isPreconnected hs + rcases subset_or_disjoint_of_frontier f.disc.isClosed hsp hd with h₁ | h₁ + · exact closure_minimal h₁ f.disc.isClosed + · obtain ⟨p, hp⟩ := he.1 + exact absurd (f.Usub (H.closure_subset_U he (subset_closure hp))) (disjoint_left.mp h₁ (hes hp)) + +/-- A vertex of `J` on `N(Z)` meets an edge of `A` and an edge outside `A`. -/ +theorem Rad.mem_bdry (r : Rad J Γ') (hS : IsClosedSurface S) {A : Set (Set S)} {v : S} + (hvJ : v ∈ J.V) (hv : v ∈ (boundaryDrawing Γ' (tiles Γ' A)).V) (hA : A ⊆ J.E) : + v ∈ Whitney.bdry J.toGraph A := by + obtain ⟨⟨t, ht, -, -, hvt⟩, t', ht', -, -, hvt'⟩ := (mem_boundaryDrawing_V hS).mp hv + obtain ⟨htR, e, heA, het⟩ := ht + obtain ⟨g, hg, hgt⟩ := r.facts.1 t' ht'.1 + have hgA : g ∉ A := fun h' => ht'.2 ⟨ht'.1, g, h', hgt⟩ + exact ⟨⟨e, heA, inc_of_mem_closure (hA heA) + (r.facts.2.2 t htR e (hA heA) het v hvJ hvt) hvJ⟩, + ⟨g, ⟨hg, hgA⟩, inc_of_mem_closure hg (r.facts.2.2 t' ht'.1 g hg hgt v hvJ hvt') hvJ⟩⟩ + +/-- An `O`-arc in `N(Z)`, for `Z` the regions of a set of edges, is normal for `H`, and its vertices +are in the boundary of the set. -/ +theorem Frame.normal_arc (f : Frame H J Δ a) (r : Rad J Γ') (hS : IsClosedSurface S) + {A : Set (Set S)} (hA : A ⊆ H.E) {F : Set S} + (hFN : F ⊆ (boundaryDrawing Γ' (tiles Γ' A)).U) : + F ∩ H.U ⊆ H.V ∧ F ∩ H.V ⊆ Whitney.bdry J.toGraph A := by + have hNs : (boundaryDrawing Γ' (tiles Γ' A)).IsSubdrawing Γ' := Drawing.span_isSubdrawing Γ' _ _ + have hJV : ∀ x ∈ F, x ∈ H.U → x ∈ J.V := fun x hx hxU => by + have : x ∈ J.U ∩ Γ'.U := ⟨f.U_subset hxU, hNs.U_subset (hFN hx)⟩ + rwa [r.cap] at this + refine ⟨fun x hx => f.U_inter_V hx.2 (hJV x hx.1 hx.2), fun x hx => ?_⟩ + have hxJ := f.Vsub hx.2 + have hxN : x ∈ (boundaryDrawing Γ' (tiles Γ' A)).V := by + rcases hFN hx.1 with h₁ | h₁ + · exact h₁ + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp h₁ + exact Or.inr (mem_iUnion₂.mpr ⟨e, he, hxe, r.vsub hxJ⟩) + exact r.mem_bdry hS hxJ hxN (hA.trans f.Esub) + +/-- The boundary of the regions of edges of `H` lies in `Δ`. -/ +theorem Frame.N_sub (f : Frame H J Δ a) (r : Rad J Γ') (hS : IsClosedSurface S) + {A : Set (Set S)} (hA : A ⊆ H.E) : (boundaryDrawing Γ' (tiles Γ' A)).U ⊆ Δ := by + intro x hx + rw [Drawing.U_eq] at hx + rcases hx with hx | hx + · obtain ⟨⟨t, ⟨htR, e, he, het⟩, -, -, hxt⟩, -⟩ := (mem_boundaryDrawing_V hS).mp hx + exact f.tile_sub r (hA he) htR het hxt + · obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp hx + obtain ⟨⟨t, ⟨htR, e, he, het⟩, hinc⟩, -⟩ := mem_boundaryDrawing_E.mp hg + have hgc := edge_subset_closure_of_incident hS hinc.1 hinc.2.1 hinc.2.2 + exact f.tile_sub r (hA he) htR het (closure_minimal hgc isClosed_closure hxg) + +/-- **Each edge of a small set lies in a dial that holds a path.** Here the set `A` of edges of `H` +has +at most two vertices that meet both `A` and another edge of `J`. -/ +theorem exists_dial_of_edge [ConnectedSpace S] (f : Frame H J Δ a) (r : Rad J Γ') + (hS : IsClosedSurface S) (hsph : IsSphere S) {A : Set (Set S)} (hA : A ⊆ H.E) + (hb : (Whitney.bdry J.toGraph A).ncard ≤ 2) (hfin : (Whitney.bdry J.toGraph A).Finite) + {e : Set S} (he : e ∈ A) : + ∃ F D x y, IsOArc F ∧ F ⊆ (boundaryDrawing Γ' (tiles Γ' A)).U ∧ D ⊆ Δ ∧ IsClosedDisc D ∧ + discBd D = F ∧ e ⊆ D ∧ x ≠ y ∧ F ∩ H.V = {x, y} ∧ (H.interSet D).IsPathBetween x y ∧ + F ∩ H.U ⊆ H.V ∧ F ∩ H.V ⊆ Whitney.bdry J.toGraph A := by + classical + set N := boundaryDrawing Γ' (tiles Γ' A) with hN + have hNΔ : N.U ⊆ Δ := f.N_sub r hS hA + have hdial : ∀ F, IsOArc F → F ⊆ N.U → ∃ D, D ⊆ Δ ∧ IsDial H F D := by + intro F hF hFN + obtain ⟨h₁, h₂⟩ := f.normal_arc r hS hA hFN + exact f.rigid F (hFN.trans hNΔ) hF h₁ ((ncard_le_ncard h₂ hfin).trans hb) + let Q : Set S := N.U ∪ ⋃₀ {D | D ⊆ Δ ∧ ∃ F, IsOArc F ∧ F ⊆ N.U ∧ IsDial H F D} + have hQΔ : Q ⊆ Δ := union_subset hNΔ (sUnion_subset fun _ h => h.1) + obtain ⟨p, hp⟩ := (hA he).1 + have heJ := f.Esub (hA he) + have hpΓ : p ∉ Γ'.U := disjoint_left.mp (r.edge_off heJ) hp + obtain ⟨s, hs, hes⟩ := r.exists_tile heJ + have hsZ : s ∈ tiles Γ' A := ⟨hs, e, he, hes⟩ + have hNs : N.IsSubdrawing Γ' := Drawing.span_isSubdrawing Γ' _ _ + have hpN : p ∉ N.U := fun h' => hpΓ (hNs.U_subset h') + have hpQ : p ∈ Q := by + by_contra hpQ + have hreg := same_region_of_discs hS hsph (fun h' => f.outside (hQΔ h')) hpQ _ N rfl + subset_union_left (fun F hF hFN => by + obtain ⟨D, hDΔ, hd⟩ := hdial F hF hFN + exact ⟨D, hd.1, fun y hy => Or.inr ⟨D, ⟨hDΔ, F, hF, hFN, hd⟩, hy⟩, + (IsClosedDisc.subBd_eq_discBd hS hd.1).symm.trans hd.2.1⟩) + obtain ⟨t, ht, hat, hpt⟩ := hreg + refine not_same_side hS (tiles_subset A) hsZ (hes hp) (fun hh => ?_) ⟨t, ht, hat, hpt⟩ + obtain ⟨t', ⟨htR, e', he', het⟩, hat'⟩ := mem_iUnion₂.mp hh + exact f.outside (f.tile_sub r (hA he') htR het hat') + rcases hpQ with hpQ | ⟨D, ⟨hDΔ, F, hF, hFN, hd⟩, hpD⟩ + · exact absurd hpQ hpN + obtain ⟨hdisc, hbd, hcases⟩ := hd + obtain ⟨h₁, h₂⟩ := f.normal_arc r hS hA hFN + have heF : Disjoint e F := disjoint_left.mpr fun x hx hxF => + edge_notMem_V (hA he) hx (h₁ ⟨hxF, H.closure_subset_U (hA he) (subset_closure hx)⟩) + have hfr : frontier D = F := by rw [← subBd_eq_frontier, hbd] + have heD : e ⊆ D := by + rcases subset_or_disjoint_of_frontier hdisc.isClosed (hA he).2.2.1.isConnected.isPreconnected + (by rwa [hfr]) with h₃ | h₃ + · exact h₃ + · exact absurd hpD (disjoint_left.mp h₃ hp) + rcases hcases with h₃ | ⟨x, y, hxy, hc, hpath⟩ + · exact absurd (h₃ ⟨hpD, H.closure_subset_U (hA he) (subset_closure hp)⟩) + (disjoint_left.mp heF hp) + · exact ⟨F, D, x, y, hF, hFN, hDΔ, hdisc, (IsClosedDisc.subBd_eq_discBd hS hdisc).symm.trans hbd, + heD, hxy, hc, hpath, h₁, h₂⟩ + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM14/RigidPoints.lean b/LeanPool/GraphMinor/GM14/RigidPoints.lean new file mode 100644 index 0000000000..8a47583fbb --- /dev/null +++ b/LeanPool/GraphMinor/GM14/RigidPoints.lean @@ -0,0 +1,278 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Whitney +import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.Surface.CutLift +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.GM11.PaintingFacts + +/-! +# Moving three points of a circle + +Any injective map from at most three points of an `O`-arc to another `O`-arc extends to a +homeomorphism between +the `O`-arcs (`exists_oArc_map`), since three points cut an `O`-arc into three lines and all orders +of +three points on a circle are the same up to reflection. It then extends to a homeomorphism between +closed +discs with these `O`-arcs as boundaries (`exists_disc_points`). +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u v + +variable {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] [T2Space X] [T2Space Y] + +omit [T2Space Y] in +/-- Three points cut an `O`-arc into three lines. -/ +theorem exists_three_lines {F : Set X} (hF : IsOArc F) {x y z : X} (hx : x ∈ F) (hy : y ∈ F) + (hz : z ∈ F) + (hxy : x ≠ y) (hxz : x ≠ z) (hyz : y ≠ z) : + ∃ L₁ L₂ L₃ : Set X, IsLineWithEnds L₁ x y ∧ IsLineWithEnds L₂ y z ∧ IsLineWithEnds L₃ z x ∧ + L₁ ∪ L₂ ∪ L₃ = F ∧ L₁ ∩ L₂ = {y} ∧ L₂ ∩ L₃ = {z} ∧ L₃ ∩ L₁ = {x} := by + obtain ⟨A₀, B₀, hA₀, hB₀, hun₀, hcap₀⟩ := IsOArc.lines hF hx hy hxy + obtain ⟨A, B, hA, hB, hun, hcap, hzB⟩ : ∃ A B : Set X, IsLineWithEnds A x y + ∧ IsLineWithEnds B x y ∧ + A ∪ B = F ∧ A ∩ B = {x, y} ∧ z ∈ B := by + have : z ∈ A₀ ∪ B₀ := hun₀ ▸ hz + rcases this with h | h + · exact ⟨B₀, A₀, hB₀, hA₀, (union_comm _ _).trans hun₀, (inter_comm _ _).trans hcap₀, h⟩ + · exact ⟨A₀, B₀, hA₀, hB₀, hun₀, hcap₀, h⟩ + obtain ⟨M₁, M₂, hM₁, hM₂, hMu, hMc⟩ := IsLineWithEnds.split hB hzB hxz.symm hyz.symm + have hxM₁ : x ∈ M₁ := by + obtain ⟨f, h0, -⟩ := hM₁ + exact h0 ▸ (f 0).2 + have hzM₁ : z ∈ M₁ := by + obtain ⟨f, -, h1⟩ := hM₁ + exact h1 ▸ (f 1).2 + have hzM₂ : z ∈ M₂ := by + obtain ⟨f, h0, -⟩ := hM₂ + exact h0 ▸ (f 0).2 + have hyM₂ : y ∈ M₂ := by + obtain ⟨f, -, h1⟩ := hM₂ + exact h1 ▸ (f 1).2 + have hxA : x ∈ A := by + have : x ∈ A ∩ B := hcap ▸ mem_insert _ _ + exact this.1 + have hyA : y ∈ A := by + have : y ∈ A ∩ B := hcap ▸ mem_insert_of_mem _ rfl + exact this.1 + have hxn : x ∉ M₂ := fun h => hxz (by simpa [hMc] using (show x ∈ M₁ ∩ M₂ from ⟨hxM₁, h⟩)) + have hyn : y ∉ M₁ := fun h => hyz (by simpa [hMc] using (show y ∈ M₁ ∩ M₂ from ⟨h, hyM₂⟩)) + have hAM : ∀ {w}, w ∈ A → w ∈ B → w = x ∨ w = y := fun {w} h₁ h₂ => by + have : w ∈ A ∩ B := ⟨h₁, h₂⟩ + rw [hcap] at this + exact this + refine ⟨A, M₂, M₁, hA, GraphMinor.Surface.IsLineWithEnds.symm hM₂, + GraphMinor.Surface.IsLineWithEnds.symm hM₁, ?_, ?_, ?_, ?_⟩ + · rw [← hun, ← hMu] + ext w + simp only [mem_union] + tauto + · apply subset_antisymm + · rintro w ⟨h₁, h₂⟩ + have h₃ : w ∈ B := hMu ▸ Or.inr h₂ + rcases hAM h₁ h₃ with rfl | h₄ + · exact absurd h₂ hxn + · exact h₄ + · rintro w rfl + exact ⟨hyA, hyM₂⟩ + · rw [inter_comm, hMc] + · apply subset_antisymm + · rintro w ⟨h₁, h₂⟩ + have h₃ : w ∈ B := hMu ▸ Or.inl h₁ + rcases hAM h₂ h₃ with h₄ | rfl + · exact h₄ + · exact absurd h₁ hyn + · rintro w rfl + exact ⟨hxM₁, hxA⟩ + +omit [T2Space X] [T2Space Y] in +omit [TopologicalSpace X] [TopologicalSpace Y] in +/-- A map on at most three points of an infinite set into an infinite set extends to three points. +-/ +theorem exists_three_pts {F : Set X} {F' : Set Y} (hF : F.Infinite) (hF' : F'.Infinite) {P : Set X} + (hPf : P.Finite) (hPF : P ⊆ F) (hc : P.ncard ≤ 3) {g : X → Y} (hg : InjOn g P) + (hgF : MapsTo g P F') : + ∃ (x y z : X) (g' : X → Y), x ∈ F ∧ y ∈ F ∧ z ∈ F ∧ x ≠ y ∧ x ≠ z ∧ y ≠ z ∧ g' x ∈ F' + ∧ g' y ∈ F' ∧ + g' z ∈ F' ∧ g' x ≠ g' y ∧ g' x ≠ g' z ∧ g' y ≠ g' z ∧ + ∀ p ∈ P, (p = x ∨ p = y ∨ p = z) ∧ g' p = g p := by + classical + induction hn : 3 - P.ncard generalizing P g with + | zero => + have h3 : P.ncard = 3 := by omega + obtain ⟨x, y, z, hxy, hxz, hyz, rfl⟩ := ncard_eq_three.mp h3 + have hm₁ : x ∈ ({x, y, z} : Set X) := by simp + have hm₂ : y ∈ ({x, y, z} : Set X) := by simp + have hm₃ : z ∈ ({x, y, z} : Set X) := by simp + refine ⟨x, y, z, g, hPF hm₁, hPF hm₂, hPF hm₃, hxy, hxz, hyz, hgF hm₁, hgF hm₂, hgF hm₃, + fun h => hxy (hg hm₁ hm₂ h), fun h => hxz (hg hm₁ hm₃ h), fun h => hyz (hg hm₂ hm₃ h), ?_⟩ + rintro p hp + exact ⟨hp, rfl⟩ + | succ n ih => + obtain ⟨x, hxF, hxP⟩ := (hF.sdiff hPf).nonempty + obtain ⟨y, hyF, hyP⟩ := (hF'.sdiff (hPf.image g)).nonempty + have hcard : (insert x P).ncard = P.ncard + 1 := ncard_insert_of_notMem hxP hPf + have hupd : ∀ p ∈ P, Function.update g x y p = g p := fun p hp => + Function.update_of_ne (fun h : p = x => hxP (by rw [← h]; exact hp)) _ _ + obtain ⟨a, b, c, g', h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈, h₉, h₁₀, h₁₁, h₁₂, hall⟩ := + ih (P := insert x P) (g := Function.update g x y) (hPf.insert x) (insert_subset hxF hPF) + (by omega) (by + intro p hp q hq he + rcases hp with rfl | hp <;> rcases hq with rfl | hq + · rfl + · rw [Function.update_self, hupd q hq] at he + exact absurd (he ▸ mem_image_of_mem g hq) hyP + · rw [Function.update_self, hupd p hp] at he + exact absurd (he.symm ▸ mem_image_of_mem g hp) hyP + · rw [hupd p hp, hupd q hq] at he + exact hg hp hq he) (by + intro p hp + rcases hp with rfl | hp + · rw [Function.update_self] + exact hyF + · rw [hupd p hp] + exact hgF hp) (by omega) + refine ⟨a, b, c, g', h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈, h₉, h₁₀, h₁₁, h₁₂, fun p hp => ?_⟩ + obtain ⟨h₁₃, h₁₄⟩ := hall p (mem_insert_of_mem _ hp) + exact ⟨h₁₃, h₁₄.trans (hupd p hp)⟩ + +/-- An injective map from at most three points of an `O`-arc into an `O`-arc extends to a +homeomorphism. -/ +theorem exists_oArc_map {F : Set X} {F' : Set Y} (hF : IsOArc F) (hF' : IsOArc F') {P : Set X} + (hPf : P.Finite) (hPF : P ⊆ F) (hc : P.ncard ≤ 3) {g : X → Y} (hg : InjOn g P) + (hgF : MapsTo g P F') : ∃ f f', PH F F' f f' ∧ ∀ p ∈ P, f p = g p := by + obtain ⟨x, y, z, g', h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈, h₉, h₁₀, h₁₁, h₁₂, hall⟩ := + exists_three_pts (infinite_of_isOArc hF) (infinite_of_isOArc hF') hPf hPF hc hg hgF + obtain ⟨L₁, L₂, L₃, hL₁, hL₂, hL₃, hu, c₁₂, c₂₃, c₃₁⟩ := exists_three_lines hF h₁ h₂ h₃ h₄ h₅ h₆ + obtain ⟨M₁, M₂, M₃, hM₁, hM₂, hM₃, hu', d₁₂, d₂₃, d₃₁⟩ := exists_three_lines hF' h₇ h₈ h₉ h₁₀ h₁₁ + h₁₂ + have : Nonempty X := ⟨x⟩ + have : Nonempty Y := ⟨g' x⟩ + obtain ⟨a₁, a₁', p₁, e₁, e₁'⟩ := exists_line_PH hL₁ hM₁ + obtain ⟨a₂, a₂', p₂, e₂, e₂'⟩ := exists_line_PH hL₂ hM₂ + obtain ⟨a₃, a₃', p₃, e₃, e₃'⟩ := exists_line_PH hL₃ hM₃ + have st : ∀ {L : Set X} {u v : X}, IsLineWithEnds L u v → u ∈ L ∧ v ∈ L := fun {L u v} h => by + obtain ⟨f, h0, h1⟩ := h + exact ⟨h0 ▸ (f 0).2, h1 ▸ (f 1).2⟩ + have b₁ : a₁' (g' x) = x := by rw [← e₁]; exact p₁.2.2.1 (st hL₁).1 + have b₂ : a₁' (g' y) = y := by rw [← e₁']; exact p₁.2.2.1 (st hL₁).2 + have b₃ : a₂' (g' y) = y := by rw [← e₂]; exact p₂.2.2.1 (st hL₂).1 + have b₄ : a₂' (g' z) = z := by rw [← e₂']; exact p₂.2.2.1 (st hL₂).2 + have b₅ : a₃' (g' z) = z := by rw [← e₃]; exact p₃.2.2.1 (st hL₃).1 + have b₆ : a₃' (g' x) = x := by rw [← e₃']; exact p₃.2.2.1 (st hL₃).2 + have e₁₂ : ∀ u, u ∈ L₁ → u ∈ L₂ → a₁ u = a₂ u := fun u h h' => by + have : u ∈ L₁ ∩ L₂ := ⟨h, h'⟩ + rw [c₁₂] at this + rw [show u = y from this, e₁', e₂] + have e₂₃ : ∀ u, u ∈ L₂ → u ∈ L₃ → a₂ u = a₃ u := fun u h h' => by + have : u ∈ L₂ ∩ L₃ := ⟨h, h'⟩ + rw [c₂₃] at this + rw [show u = z from this, e₂', e₃] + have e₃₁ : ∀ u, u ∈ L₃ → u ∈ L₁ → a₃ u = a₁ u := fun u h h' => by + have : u ∈ L₃ ∩ L₁ := ⟨h, h'⟩ + rw [c₃₁] at this + rw [show u = x from this, e₃', e₁] + have f₁₂ : ∀ u, u ∈ M₁ → u ∈ M₂ → a₁' u = a₂' u := fun u h h' => by + have : u ∈ M₁ ∩ M₂ := ⟨h, h'⟩ + rw [d₁₂] at this + rw [show u = g' y from this, b₂, b₃] + have f₂₃ : ∀ u, u ∈ M₂ → u ∈ M₃ → a₂' u = a₃' u := fun u h h' => by + have : u ∈ M₂ ∩ M₃ := ⟨h, h'⟩ + rw [d₂₃] at this + rw [show u = g' z from this, b₄, b₅] + have f₃₁ : ∀ u, u ∈ M₃ → u ∈ M₁ → a₃' u = a₁' u := fun u h h' => by + have : u ∈ M₃ ∩ M₁ := ⟨h, h'⟩ + rw [d₃₁] at this + rw [show u = g' x from this, b₆, b₁] + obtain ⟨f, f', hf, hef, -⟩ := exists_glue (ι := Fin 3) (A := ![L₁, L₂, L₃]) (B := ![M₁, M₂, M₃]) + (f := ![a₁, a₂, a₃]) (f' := ![a₁', a₂', a₃']) + (by + intro i + fin_cases i + · exact hL₁.isCompact.isClosed + · exact hL₂.isCompact.isClosed + · exact hL₃.isCompact.isClosed) + (by + intro i + fin_cases i + · exact hM₁.isCompact.isClosed + · exact hM₂.isCompact.isClosed + · exact hM₃.isCompact.isClosed) + (by + intro i + fin_cases i + · exact p₁ + · exact p₂ + · exact p₃) + (by + intro i j u hi hj + fin_cases i <;> fin_cases j + · rfl + · exact e₁₂ u hi hj + · exact (e₃₁ u hj hi).symm + · exact (e₁₂ u hj hi).symm + · rfl + · exact e₂₃ u hi hj + · exact e₃₁ u hi hj + · exact (e₂₃ u hj hi).symm + · rfl) + (by + intro i j u hi hj + fin_cases i <;> fin_cases j + · rfl + · exact f₁₂ u hi hj + · exact (f₃₁ u hj hi).symm + · exact (f₁₂ u hj hi).symm + · rfl + · exact f₂₃ u hi hj + · exact f₃₁ u hi hj + · exact (f₂₃ u hj hi).symm + · rfl) + have hUA : (⋃ i, (![L₁, L₂, L₃] : Fin 3 → Set X) i) = F := by + rw [← hu] + ext w + simp [Fin.exists_fin_succ, or_assoc] + have hUB : (⋃ i, (![M₁, M₂, M₃] : Fin 3 → Set Y) i) = F' := by + rw [← hu'] + ext w + simp [Fin.exists_fin_succ, or_assoc] + rw [hUA, hUB] at hf + refine ⟨f, f', hf, fun p hp => ?_⟩ + obtain ⟨h₁₃, h₁₄⟩ := hall p hp + rw [← h₁₄] + rcases h₁₃ with rfl | rfl | rfl + · exact (hef 0 (st hL₁).1).trans e₁ + · exact (hef 1 (st hL₂).1).trans e₂ + · exact (hef 2 (st hL₃).1).trans e₃ + +/-- A homeomorphism between closed discs with a given effect on at most three boundary points. -/ +theorem exists_disc_points {E : Set X} {E' : Set Y} (hE : IsClosedDisc E) + (hE' : IsClosedDisc E') {P : Set X} + (hPf : P.Finite) (hPF : P ⊆ discBd E) (hc : P.ncard ≤ 3) {g : X → Y} (hg : InjOn g P) + (hgF : MapsTo g P (discBd E')) : + ∃ f f', PH E E' f f' ∧ (∀ p ∈ P, f p = g p) ∧ MapsTo f (discBd E) (discBd E') ∧ + MapsTo f' (discBd E') (discBd E) := by + obtain ⟨k, k', hk, hkg⟩ := exists_oArc_map hE.isOArc_discBd hE'.isOArc_discBd hPf hPF hc hg hgF + obtain ⟨f, f', hf, he, he'⟩ := exists_disc_PH hE hE' hk + refine ⟨f, f', hf, fun p hp => (he (hPF hp)).trans (hkg p hp), fun x hx => ?_, fun y hy => ?_⟩ + · rw [he hx] + exact hk.1 hx + · rw [he' hy] + exact hk.2.1 hy + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM14/RigidSegregation.lean b/LeanPool/GraphMinor/GM14/RigidSegregation.lean new file mode 100644 index 0000000000..6b4c88d04f --- /dev/null +++ b/LeanPool/GraphMinor/GM14/RigidSegregation.lean @@ -0,0 +1,510 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.RigidAccess +public import LeanPool.GraphMinor.GM14.RigidExtension +public import LeanPool.GraphMinor.GM14.RigidPoints +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.PerimeterPull +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.Surface.Schoenflies +import LeanPool.GraphMinor.Surface.SphereDisc +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.AddCrosscap + +/-! +# Redrawing a rigid drawing along a 3-segregation + +This file proves the first step of the proof of Graph Minors XIV, (6.5). Let `H` be a rigid drawing +in a closed +disc `Δ`, and let `α` be an arrangement in `Δ` of a 3-segregation. We redraw `H` so that the part of +`H` in +each society lies in the disc of this society, with the vertices in `ΩBar` at their places +(`union_drawing_65`). + +We work one society at a time. In a sphere, the part of `H` in a society lies in a closed disc with +the vertices +in `ΩBar` on its boundary (`exists_disc_of_part`). We map this disc onto the disc of the society, +with +these vertices going to their places (`exists_part_map`). These maps agree on common points, since +the +societies share only vertices in `ΩBar`. Gluing them gives a map on all of `U(H)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Topology Metric Graph GraphMinor.GM09 GraphMinor.Surface GraphMinor.GM11 + +universe u v w + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- **One part of `H`.** Let `P₀` be a subdrawing of a rigid drawing `H` in `Δ`, and let `X₀` be at +most three +vertices of `P₀`. Suppose that all other vertices of `P₀` are off `bd(Δ)` and have all their edges +in `P₀`. +Then `P₀` can be mapped into any closed disc `A ⊆ Δ`, with `X₀` going to given points of `bd(A)`, +and with +only `X₀` going to `bd(A)`. -/ +theorem exists_part_map {H P₀ : Drawing S} {Δ A : Set S} (hΔ : IsClosedDisc Δ) (hbdΔ : subBd Δ + = discBd Δ) + (hHΔ : H.U ⊆ Δ) (hHbd : H.U ∩ subBd Δ ⊆ H.V) (hrigid : IsRigidIn H Δ) (hP₀ : P₀.IsSubdrawing H) + {X₀ : Set S} (hXV : X₀ ⊆ P₀.V) (hc : X₀.ncard ≤ 3) + (hout : ∀ v ∈ P₀.V, v ∉ X₀ → v ∉ subBd Δ ∧ ∀ e ∈ H.E, v ∈ closure e → e ∈ P₀.E) + (hA : IsClosedDisc A) (hAΔ : A ⊆ Δ) {g : S → S} (hg : InjOn g X₀) (hgA : MapsTo g X₀ + (subBd A)) : + ∃ ψ ψ', PH P₀.U (ψ '' P₀.U) ψ ψ' ∧ MapsTo ψ P₀.U A ∧ (∀ z ∈ P₀.U, ψ z ∈ subBd A → z ∈ X₀) ∧ + ∀ x ∈ X₀, ψ x = g x := by + classical + let T := OnePoint EuclideanPlane + have hsph : IsSphere T := ⟨Homeomorph.refl _⟩ + obtain ⟨hS, hconn⟩ := IsSphere.isClosedSurface hsph + have hO : IsOArc (sph '' sphere (0 : ℂ) 1) := + isOArc_image isOpenEmbedding_sph.isEmbedding oArc_sphere + obtain ⟨D₁, D₂, -, hd₁, hd₂, hb₁, hb₂, hcov, hcap, -, -⟩ := sphere_disc T hsph _ hO + generalize sph '' sphere (0 : ℂ) 1 = C at hO hb₁ hb₂ hcap + obtain ⟨f, f', hP, hf₁, hf₂⟩ := exists_disc_map hΔ hd₁ + have hAc : IsCompact Δ := hΔ.isCompact + have hBc : IsCompact D₁ := hd₁.isCompact + have hsbD : subBd D₁ = C := (IsClosedDisc.subBd_eq_discBd hS hd₁).trans hb₁ + have hbd : f '' subBd Δ ⊆ subBd D₁ := by + rw [hbdΔ, IsClosedDisc.subBd_eq_discBd hS hd₁] + exact hf₁ + have hbd' : f' '' subBd D₁ ⊆ subBd Δ := by + rw [hbdΔ, IsClosedDisc.subBd_eq_discBd hS hd₁] + exact hf₂ + have hU₀ : P₀.U ⊆ Δ := hP₀.U_subset.trans hHΔ + have hVΔ : H.V ⊆ Δ := H.V_subset_U.trans hHΔ + let M := mapD hP hAc H hHΔ + let Γ := mapD hP hAc P₀ hU₀ + have hMU : M.U ⊆ D₁ := hP.image_sub hHΔ + have hMn : M.U ∩ C ⊆ M.V := by + rintro _ ⟨⟨x, hx, rfl⟩, hxC⟩ + have h₁ : f' (f x) ∈ subBd Δ := hbd' (mem_image_of_mem f' (hsbD.symm ▸ hxC)) + rw [hP.left (hHΔ hx)] at h₁ + exact mem_image_of_mem f (hHbd ⟨hx, h₁⟩) + have hMr : IsRigidIn M D₁ := isRigidIn_mapD hP hAc hbd hbd' H hHΔ hrigid + have hΓ : Γ.IsSubdrawing M := by + refine ⟨image_mono hP₀.1, ?_⟩ + change (mapD hP hAc P₀ hU₀).E ⊆ (mapD hP hAc H hHΔ).E + rw [mapD_E, mapD_E] + exact image_mono hP₀.2 + have hX'f : (f '' X₀).Finite := (P₀.finite_V.subset hXV).image f + have hX'c : (f '' X₀).ncard ≤ 3 := (ncard_image_le (P₀.finite_V.subset hXV)).trans hc + have hout' : ∀ v ∈ Γ.V, v ∉ f '' X₀ → v ∉ C ∧ ∀ e ∈ M.E, v ∈ closure e → e ∈ Γ.E := by + rintro _ ⟨v, hv, rfl⟩ hvn + obtain ⟨h₁, h₂⟩ := hout v hv fun h => hvn (mem_image_of_mem f h) + have hvH : v ∈ H.V := hP₀.1 hv + refine ⟨fun hC => h₁ ?_, fun e' he' hin => ?_⟩ + · have h₃ := hbd' (mem_image_of_mem f' (hsbD.symm ▸ hC)) + rwa [hP.left (hVΔ hvH)] at h₃ + · change e' ∈ (mapD hP hAc H hHΔ).E at he' + rw [mapD_E] at he' + obtain ⟨e, he, rfl⟩ := he' + have heΔ : e ⊆ Δ := subset_closure.trans ((H.closure_subset_U he).trans hHΔ) + have hm : f v ∈ closure (f '' e) ∩ f '' H.V := ⟨hin, mem_image_of_mem f hvH⟩ + rw [cap_image_eq hP hAc heΔ hVΔ] at hm + obtain ⟨w, ⟨hw, hwV⟩, hfw⟩ := hm + have hwv : w = v := hP.injOn (hVΔ hwV) (hVΔ hvH) hfw + change f '' e ∈ (mapD hP hAc P₀ hU₀).E + rw [mapD_E] + exact ⟨e, h₂ e he (hwv ▸ hw), rfl⟩ + obtain ⟨E, hE, hKE, hbE⟩ := exists_disc_of_part hS hsph hd₁ hd₂ hb₁ hb₂ hcov hcap hMU hMn hMr hΓ + (image_mono hXV) hX'c hout' + have hAd : IsClosedDisc (f '' A) := hP.disc_image hAΔ hA + have hAsb : subBd (f '' A) = discBd (f '' A) := IsClosedDisc.subBd_eq_discBd hS hAd + have hsub_img : f '' subBd A ⊆ subBd (f '' A) := subBd_image hP hbd hAΔ hA.isClosed + have hgΔ : ∀ {x : S}, x ∈ X₀ → g x ∈ Δ := fun hx => hAΔ (subBd_subset_of subset_rfl hA.isClosed + (hgA hx)) + have hX₀Δ : X₀ ⊆ Δ := hXV.trans (P₀.V_subset_U.trans hU₀) + let g' : T → T := fun y => f (g (f' y)) + have hg'e : ∀ {x : S}, x ∈ X₀ → g' (f x) = f (g x) := fun {x} hx => by + change f (g (f' (f x))) = _ + rw [hP.left (hX₀Δ hx)] + have hg'i : InjOn g' (f '' X₀) := by + rintro _ ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩ h + rw [hg'e hx, hg'e hy] at h + rw [hg (hx) hy (hP.injOn (hgΔ hx) (hgΔ hy) h)] + have hg'm : MapsTo g' (f '' X₀) (discBd (f '' A)) := by + rintro _ ⟨x, hx, rfl⟩ + rw [hg'e hx, ← hAsb] + exact hsub_img (mem_image_of_mem f (hgA hx)) + obtain ⟨p, p', hp, hpg, -, hpb'⟩ := exists_disc_points hE hAd hX'f + (fun y hy => (hbE.symm ▸ hy : y ∈ discBd E ∩ Γ.U).1) hX'c hg'i hg'm + have hsub₃ : p '' (f '' P₀.U) ⊆ D₁ := by + rintro _ ⟨y, hy, rfl⟩ + exact hP.image_sub hAΔ (hp.1 (hKE hy)) + have hch := ((hP.restrict' hU₀).comp (hp.restrict' hKE)).comp (hP.symm.restrict' hsub₃) + have hch' := hch + rw [← hch.image_eq] at hch' + refine ⟨_, _, hch', ?_, ?_, ?_⟩ + · intro z hz + obtain ⟨a, ha, h₁⟩ := hp.1 (hKE (mem_image_of_mem f hz)) + change f' (p (f z)) ∈ A + rw [← h₁, hP.left (hAΔ ha)] + exact ha + · intro z hz hzb + change f' (p (f z)) ∈ subBd A at hzb + have hin : p (f z) ∈ D₁ := hsub₃ (mem_image_of_mem p (mem_image_of_mem f hz)) + have h₁ := hsub_img (mem_image_of_mem f hzb) + rw [hP.right hin, hAsb] at h₁ + have h₂ := hpb' h₁ + rw [hp.left (hKE (mem_image_of_mem f hz))] at h₂ + have h₃ : f z ∈ discBd E ∩ Γ.U := ⟨h₂, mem_image_of_mem f hz⟩ + rw [hbE] at h₃ + obtain ⟨x, hx, hxz⟩ := h₃ + exact hP.injOn (hX₀Δ hx) (hU₀ hz) hxz ▸ hx + · intro x hx + change f' (p (f x)) = g x + rw [hpg _ (mem_image_of_mem f hx), hg'e hx, hP.left (hgΔ hx)] + +/-- The vertices of `H` that go into `ΩBar` of a society. -/ +abbrev barPart {α : Type v} {β : Type w} {G : Graph α β} {H : Drawing S} (η : SpanEmbedding H G) + (S₀ : Society α β) : Set S := {v | v ∈ H.V ∧ η.vMap v ∈ S₀.Ω.bar} + +omit [T2Space S] in +theorem seg_edge {α : Type v} {β : Type w} {G : Graph α β} {H : Drawing S} (η : SpanEmbedding H G) + {S_seg : Set (Society α β)} (hseg : IsThreeSegregation G S_seg) {e : Set S} (he : e ∈ H.E) : + ∃ S₀ ∈ S_seg, η.eMap e ∈ E(S₀.G) := by + have hPle : ∀ P ∈ (fun S₀ : Society α β => S₀.G) '' S_seg, P ≤ G := by + rintro _ ⟨S₀, hS₀, rfl⟩ + exact hseg.1.le S₀ hS₀ + have h₁ : η.eMap e ∈ E(G) := η.imageGraph_le.edgeSet_mono (η.bijOn_e.mapsTo he) + have hEu := congrArg Graph.edgeSet hseg.1.union_eq + rw [edgeSet_subgraphSUnion hPle] at hEu + rw [← hEu] at h₁ + obtain ⟨_, ⟨S₀, hS₀, rfl⟩, h₂⟩ := mem_iUnion₂.mp h₁ + exact ⟨S₀, hS₀, h₂⟩ + +omit [T2Space S] in +theorem seg_vertex {α : Type v} {β : Type w} {G : Graph α β} {H : Drawing S} (η : SpanEmbedding H G) + {S_seg : Set (Society α β)} (hseg : IsThreeSegregation G S_seg) {v : S} (hv : v ∈ H.V) : + ∃ S₀ ∈ S_seg, η.vMap v ∈ V(S₀.G) := by + have h₁ : η.vMap v ∈ V(G) := η.imageGraph_le.vertexSet_mono (η.bijOn_v.mapsTo hv) + have hVu : (⋃ P ∈ (fun S₀ : Society α β => S₀.G) '' S_seg, V(P)) = V(G) := + congrArg Graph.vertexSet hseg.1.union_eq + rw [← hVu] at h₁ + obtain ⟨_, ⟨S₀, hS₀, rfl⟩, h₂⟩ := mem_iUnion₂.mp h₁ + exact ⟨S₀, hS₀, h₂⟩ + +/-- For each society, the part of `H` in it, with a map into the disc of the society. -/ +theorem exists_society_maps {α : Type v} {β : Type w} {G : Graph α β} {H : Drawing S} {Δ : Set S} + (hΔ : IsClosedDisc Δ) (hbdΔ : subBd Δ = discBd Δ) (hHΔ : H.U ⊆ Δ) (hHbd : H.U ∩ subBd Δ ⊆ H.V) + (hrigid : IsRigidIn H Δ) (η : SpanEmbedding H G) {S_seg : Set (Society α β)} + (hseg : IsThreeSegregation G S_seg) + (hbd_in_seg : ∀ v ∈ H.V ∩ subBd Δ, η.vMap v ∈ segregationVertices S_seg) + {α_disc : Society α β → Set S} {α_pt : α → S} (harr : IsSurfaceArrangement S_seg α_disc α_pt) + (harr_Δ : ∀ S₀ ∈ S_seg, α_disc S₀ ⊆ Δ) : + ∃ (Pd : Society α β → Drawing S) (ψ ψ' : S_seg → S → S), + (∀ S₀, (Pd S₀).IsSubdrawing H) ∧ + (∀ S₀, (Pd S₀).E = {e | e ∈ H.E ∧ η.eMap e ∈ E(S₀.G)}) ∧ + (∀ S₀ ∈ S_seg, (Pd S₀).V = {v | v ∈ H.V ∧ η.vMap v ∈ V(S₀.G)}) ∧ + ∀ i : S_seg, PH (Pd i.1).U (ψ i '' (Pd i.1).U) (ψ i) (ψ' i) ∧ + MapsTo (ψ i) (Pd i.1).U (α_disc i.1) ∧ + (∀ z ∈ (Pd i.1).U, ψ i z ∈ subBd (α_disc i.1) → z ∈ barPart η i.1) ∧ + ∀ x ∈ barPart η i.1, ψ i x = α_pt (η.vMap x) := by + classical + have hηv : InjOn η.vMap H.V := η.bijOn_v.injOn + have hle : ∀ S₀ ∈ S_seg, S₀.G ≤ G := hseg.1.le + have hIncG : ∀ e ∈ H.E, ∀ v ∈ H.V, v ∈ closure e → G.Inc (η.eMap e) (η.vMap v) := by + intro e he v hv hve + obtain ⟨y, hy⟩ := (η.inc_iff e he v hv).mpr hve + exact ⟨y, hy.mono η.imageGraph_le⟩ + have hsoc_v : ∀ S₀ ∈ S_seg, ∀ e ∈ H.E, η.eMap e ∈ E(S₀.G) → ∀ v ∈ H.V, v ∈ closure e → + η.vMap v ∈ V(S₀.G) := by + intro S₀ hS₀ e he hη v hv hve + obtain ⟨y, hy⟩ := hIncG e he v hv hve + exact (((hle S₀ hS₀).isLink_iff hη).mpr hy).left_mem + have hsegv : ∀ {S₀ x}, S₀ ∈ S_seg → x ∈ S₀.Ω.bar → x ∈ segregationVertices S_seg := + fun hS₀ hx => mem_iUnion₂.mpr ⟨_, hS₀, hx⟩ + have hbar : ∀ S₀ : Society α β, S₀.Ω.bar.Finite := fun S₀ => S₀.finite_V.subset S₀.bar_subset + let Vs : Society α β → Set S := fun S₀ => {v | v ∈ H.V ∧ η.vMap v ∈ V(S₀.G)} + let Es : Society α β → Set (Set S) := fun S₀ => {e | e ∈ H.E ∧ η.eMap e ∈ E(S₀.G)} + let Pd : Society α β → Drawing S := fun S₀ => H.span (Vs S₀) (Es S₀) + have hPs : ∀ S₀, (Pd S₀).IsSubdrawing H := fun S₀ => H.span_isSubdrawing _ _ + have hPE : ∀ S₀, (Pd S₀).E = Es S₀ := fun S₀ => by + change (H.span (Vs S₀) (Es S₀)).E = _ + rw [H.span_E] + exact inter_eq_left.mpr fun e he => he.1 + have hPV : ∀ S₀ ∈ S_seg, (Pd S₀).V = Vs S₀ := by + intro S₀ hS₀ + apply subset_antisymm + · rintro v (⟨hv, -⟩ | hv) + · exact hv + · obtain ⟨e, ⟨he, -⟩, hve, hvV⟩ := mem_iUnion₂.mp hv + exact ⟨hvV, hsoc_v S₀ hS₀ e he.1 he.2 v hvV hve⟩ + · intro v hv + exact Or.inl ⟨hv, hv.1⟩ + have hPXs : ∀ S₀ ∈ S_seg, barPart η S₀ ⊆ (Pd S₀).V := fun S₀ hS₀ => by + rw [hPV S₀ hS₀] + exact fun v hv => ⟨hv.1, S₀.bar_subset hv.2⟩ + have hXc : ∀ S₀ ∈ S_seg, (barPart η S₀).ncard ≤ 3 := by + intro S₀ hS₀ + have hinj : InjOn η.vMap (barPart η S₀) := hηv.mono fun v hv => hv.1 + rw [← hinj.ncard_image] + refine (ncard_le_ncard ?_ (hbar S₀)).trans (hseg.2 S₀ hS₀) + rintro _ ⟨v, hv, rfl⟩ + exact hv.2 + have hout : ∀ S₀ ∈ S_seg, ∀ v ∈ (Pd S₀).V, v ∉ barPart η S₀ → + v ∉ subBd Δ ∧ ∀ e ∈ H.E, v ∈ closure e → e ∈ (Pd S₀).E := by + intro S₀ hS₀ v hv hvX + rw [hPV S₀ hS₀] at hv + have hoth : ∀ S₁ ∈ S_seg, η.vMap v ∈ V(S₁.G) → S₁ = S₀ := by + intro S₁ hS₁ h₁ + by_contra hne + exact hvX ⟨hv.1, (hseg.1.vertex_inter_subset S₀ hS₀ S₁ hS₁ (Ne.symm hne) ⟨hv.2, h₁⟩).1⟩ + refine ⟨fun hb => ?_, fun e he hve => ?_⟩ + · obtain ⟨S₁, hS₁, h₁⟩ := mem_iUnion₂.mp (hbd_in_seg v ⟨hv.1, hb⟩) + have h₂ := hoth S₁ hS₁ (S₁.bar_subset h₁) + subst h₂ + exact hvX ⟨hv.1, h₁⟩ + · obtain ⟨S₁, hS₁, h₁⟩ := seg_edge η hseg he + have h₂ := hoth S₁ hS₁ (hsoc_v S₁ hS₁ e he h₁ v hv.1 hve) + subst h₂ + rw [hPE] + exact ⟨he, h₁⟩ + have hdisc : ∀ S₀ ∈ S_seg, IsClosedDisc (α_disc S₀) := fun S₀ hS₀ => (harr.isClosedDisc S₀ hS₀).1 + have hparts : ∀ i : S_seg, ∃ ψ ψ', PH (Pd i.1).U (ψ '' (Pd i.1).U) ψ ψ' ∧ + MapsTo ψ (Pd i.1).U (α_disc i.1) ∧ (∀ z ∈ (Pd i.1).U, ψ z ∈ subBd (α_disc i.1) + → z ∈ barPart η i.1) ∧ + ∀ x ∈ barPart η i.1, ψ x = α_pt (η.vMap x) := by + rintro ⟨S₀, hS₀⟩ + refine exists_part_map (g := fun x => α_pt (η.vMap x)) hΔ hbdΔ hHΔ hHbd hrigid (hPs S₀) + (hPXs S₀ hS₀) (hXc S₀ hS₀) (hout S₀ hS₀) (hdisc S₀ hS₀) (harr_Δ S₀ hS₀) ?_ ?_ + · intro x hx y hy h + exact hηv hx.1 hy.1 (harr.injOn_pts (hsegv hS₀ hx.2) (hsegv hS₀ hy.2) h) + · intro x hx + exact (harr.isClosedDisc S₀ hS₀).2 _ hx.2 + choose ψ ψ' h using hparts + exact ⟨Pd, ψ, ψ', hPs, hPE, hPV, h⟩ + +/-- **The first step of the proof of (6.5).** See the module docstring. -/ +theorem union_drawing_65 {α : Type v} {β : Type w} {G : Graph α β} {H : Drawing S} {Δ : Set S} + (hΔ : IsClosedDisc Δ) (hbdΔ : subBd Δ = discBd Δ) (hHΔ : H.U ⊆ Δ) (hHbd : H.U ∩ subBd Δ ⊆ H.V) + (hrigid : ∀ F, F ⊆ Δ → IsOArc F → F ∩ H.U ⊆ H.V → (F ∩ H.V).ncard ≤ 2 → + ∃ Δ', Δ' ⊆ Δ ∧ IsDial H F Δ') + (η : SpanEmbedding H G) {S_seg : Set (Society α β)} (hseg : IsThreeSegregation G S_seg) + (hbd_in_seg : ∀ v ∈ H.V ∩ subBd Δ, η.vMap v ∈ segregationVertices S_seg) + {α_disc : Society α β → Set S} {α_pt : α → S} (harr : IsSurfaceArrangement S_seg α_disc α_pt) + (harr_Δ : ∀ S₀ ∈ S_seg, α_disc S₀ ⊆ Δ) (hα_id : ∀ v ∈ H.V ∩ subBd Δ, α_pt (η.vMap v) = v) + (hα_bd : ∀ v ∈ H.V, η.vMap v ∈ segregationVertices S_seg → α_pt (η.vMap v) ∈ subBd Δ + → v ∈ subBd Δ) : + ∃ (H' : Drawing S) (φ : Iso H.toGraph H'.toGraph), + H'.U ⊆ Δ ∧ H'.U ∩ subBd Δ ⊆ H'.V ∧ H.V ∩ subBd Δ = H'.V ∩ subBd Δ ∧ + (∀ v : V(H.toGraph), η.vMap v.1 ∈ segregationVertices S_seg → + α_pt (η.vMap v.1) = (φ.vertexEquiv v).1) ∧ + (∀ S₀ ∈ S_seg, + H'.U ∩ subBd (α_disc S₀) = {w | ∃ v : V(H.toGraph), (φ.vertexEquiv v).1 = w + ∧ η.vMap v.1 ∈ S₀.Ω.bar} ∧ + (∀ v, (φ.vertexEquiv v).1 ∈ α_disc S₀ ↔ η.vMap v.1 ∈ V(S₀.G)) ∧ + (∀ e, (φ.edgeEquiv e).1 ⊆ α_disc S₀ ↔ η.eMap e.1 ∈ E(S₀.G))) := by + classical + obtain ⟨Pd, ψ, ψ', hPs, hPE, hPV, hparts⟩ := exists_society_maps hΔ hbdΔ hHΔ hHbd hrigid η hseg + hbd_in_seg harr harr_Δ + have h₁ := fun i => (hparts i).1 + have h₂ := fun i => (hparts i).2.1 + have h₃ := fun i => (hparts i).2.2.1 + have h₄ := fun i => (hparts i).2.2.2 + clear hparts + have hηv : InjOn η.vMap H.V := η.bijOn_v.injOn + have hsegv : ∀ {S₀ x}, S₀ ∈ S_seg → x ∈ S₀.Ω.bar → x ∈ segregationVertices S_seg := + fun hS₀ hx => mem_iUnion₂.mpr ⟨_, hS₀, hx⟩ + have hdisc : ∀ S₀ ∈ S_seg, IsClosedDisc (α_disc S₀) := fun S₀ hS₀ => (harr.isClosedDisc S₀ hS₀).1 + have hPXs : ∀ S₀ ∈ S_seg, barPart η S₀ ⊆ (Pd S₀).V := fun S₀ hS₀ => by + rw [hPV S₀ hS₀] + exact fun v hv => ⟨hv.1, S₀.bar_subset hv.2⟩ + have hPU_V : ∀ S₀ ∈ S_seg, ∀ z ∈ (Pd S₀).U, z ∈ H.V → z ∈ {v | v ∈ H.V ∧ η.vMap v ∈ V(S₀.G)} := by + intro S₀ hS₀ z hz hzV + rw [← hPV S₀ hS₀] + by_contra hn + obtain ⟨e, he, hze⟩ := (Pd S₀).exists_edge_of_mem hz hn + exact edge_notMem_V ((hPs S₀).2 he) hze hzV + -- A point of one part that goes into the disc of another society is a shared vertex. + have hcross : ∀ i j : S_seg, i ≠ j → ∀ z ∈ (Pd i.1).U, ψ i z ∈ α_disc j.1 → + z ∈ barPart η i.1 ∧ η.vMap z ∈ j.1.Ω.bar := by + intro i j hij z hz hzj + have hne : i.1 ≠ j.1 := fun h => hij (Subtype.ext h) + obtain ⟨q, ⟨hqi, hqj⟩, hq⟩ := harr.inter_discs i.1 i.2 j.1 j.2 hne ⟨h₂ i hz, hzj⟩ + have hb : ψ i z ∈ subBd (α_disc i.1) := by + rw [← hq] + exact (harr.isClosedDisc i.1 i.2).2 q hqi + have hzX := h₃ i z hz hb + refine ⟨hzX, ?_⟩ + have he : α_pt (η.vMap z) = α_pt q := by rw [← h₄ i z hzX, hq] + rw [harr.injOn_pts (hsegv i.2 hzX.2) (hsegv i.2 hqi) he] + exact hqj + have hclosedB : ∀ i : S_seg, IsClosed (ψ i '' (Pd i.1).U) := by + intro i + have hc : IsCompact (Pd i.1).U := + hΔ.isCompact.of_isClosed_subset (Pd i.1).isClosed_U ((hPs i.1).U_subset.trans hHΔ) + exact (h₁ i).image_isClosed hc subset_rfl (Pd i.1).isClosed_U + have hfin : Finite S_seg := hseg.1.1.to_subtype + have hnS : Nonempty S := hΔ.isPathConnected.nonempty.to_type + obtain ⟨Φ, Φ', hΦ, hEq, -⟩ := exists_glue (A := fun i : S_seg => (Pd i.1).U) + (B := fun i : S_seg => ψ i '' (Pd i.1).U) (f := ψ) (f' := ψ') (fun i => (Pd i.1).isClosed_U) + hclosedB h₁ + (by + intro i j x hxi hxj + by_cases hij : i = j + · rw [hij] + have hne : i.1 ≠ j.1 := fun h => hij (Subtype.ext h) + have hxV : x ∈ H.V := by + by_contra hn + obtain ⟨e, he, hxe⟩ := (Pd i.1).exists_edge_of_mem hxi fun h => hn ((hPs i.1).1 h) + obtain ⟨f, hf, hxf⟩ := (Pd j.1).exists_edge_of_mem hxj fun h => hn ((hPs j.1).1 h) + have heq := H.edge_eq_of_mem ((hPs i.1).2 he) ((hPs j.1).2 hf) hxe hxf + rw [hPE] at he hf + subst heq + exact disjoint_left.mp (hseg.1.edge_disjoint i.1 i.2 j.1 j.2 hne) he.2 hf.2 + have hi := hPU_V i.1 i.2 x hxi hxV + have hj := hPU_V j.1 j.2 x hxj hxV + obtain ⟨h₅, h₆⟩ := hseg.1.vertex_inter_subset i.1 i.2 j.1 j.2 hne ⟨hi.2, hj.2⟩ + rw [h₄ i x ⟨hxV, h₅⟩, h₄ j x ⟨hxV, h₆⟩]) + (by + rintro i j y ⟨z, hz, rfl⟩ ⟨z', hz', hzz⟩ + by_cases hij : i = j + · subst hij + rfl + have hiz : ψ i z ∈ α_disc j.1 := hzz ▸ h₂ j hz' + have hjz : ψ j z' ∈ α_disc i.1 := hzz.symm ▸ h₂ i hz + obtain ⟨hX, hb⟩ := hcross i j hij z hz hiz + obtain ⟨hX', hb'⟩ := hcross j i (Ne.symm hij) z' hz' hjz + have h₅ : α_pt (η.vMap z) = α_pt (η.vMap z') := by + rw [← h₄ i z hX, ← h₄ j z' hX', hzz] + have h₆ := harr.injOn_pts (hsegv i.2 hX.2) (hsegv j.2 hX'.2) h₅ + have h₇ := hηv hX.1 hX'.1 h₆ + rw [(h₁ i).left hz, ← hzz, (h₁ j).left hz'] + exact h₇) + have hcover : (⋃ i : S_seg, (Pd i.1).U) = H.U := by + apply subset_antisymm (iUnion_subset fun i : S_seg => (hPs i.1).U_subset) + intro z hz + by_cases hzV : z ∈ H.V + · obtain ⟨S₀, hS₀, h⟩ := seg_vertex η hseg hzV + refine mem_iUnion.mpr ⟨⟨S₀, hS₀⟩, (Pd S₀).V_subset_U ?_⟩ + rw [hPV S₀ hS₀] + exact ⟨hzV, h⟩ + · obtain ⟨e, he, hze⟩ := H.exists_edge_of_mem hz hzV + obtain ⟨S₀, hS₀, h⟩ := seg_edge η hseg he + have heP : e ∈ (Pd S₀).E := by + rw [hPE] + exact ⟨he, h⟩ + exact mem_iUnion.mpr ⟨⟨S₀, hS₀⟩, (Pd S₀).closure_subset_U heP (subset_closure hze)⟩ + rw [hcover] at hΦ + have hHc : IsCompact H.U := hΔ.isCompact.of_isClosed_subset H.isClosed_U hHΔ + let H' := mapD hΦ hHc H subset_rfl + let φ := mapIso hΦ hHc H subset_rfl + have hφv : ∀ v : V(H.toGraph), (φ.vertexEquiv v).1 = Φ v.1 := fun v => mapIso_vertex hΦ hHc H _ v + have hφe : ∀ e : E(H.toGraph), (φ.edgeEquiv e).1 = Φ '' e.1 := fun e => mapIso_edge hΦ hHc H _ e + have hΦi : ∀ (i : S_seg) {z}, z ∈ (Pd i.1).U → Φ z = ψ i z := fun i {z} hz => hEq i hz + have hsome : ∀ z ∈ H.U, ∃ i : S_seg, z ∈ (Pd i.1).U := fun z hz => + mem_iUnion.mp (hcover.symm ▸ hz) + have hΦX : ∀ S₀ ∈ S_seg, ∀ v ∈ barPart η S₀, Φ v = α_pt (η.vMap v) := by + intro S₀ hS₀ v hv + have h₅ : v ∈ (Pd S₀).U := (Pd S₀).V_subset_U (hPXs S₀ hS₀ hv) + rw [hΦi ⟨S₀, hS₀⟩ h₅] + exact h₄ ⟨S₀, hS₀⟩ v hv + have hbdα : ∀ {i : S_seg} {w}, w ∈ α_disc i.1 → w ∈ subBd Δ → w ∈ subBd (α_disc i.1) := + fun {i w} h₅ h₆ => ⟨subset_closure h₅, closure_mono (show univ \ Δ ⊆ univ \ α_disc i.1 from + fun y hy => ⟨hy.1, fun h => hy.2 (harr_Δ i.1 i.2 h)⟩) h₆.2⟩ + have hbdV : ∀ z ∈ H.U, Φ z ∈ subBd Δ → ∃ S₀ ∈ S_seg, z ∈ barPart η S₀ := by + intro z hz hb + obtain ⟨i, hi⟩ := hsome z hz + have h₅ : ψ i z ∈ α_disc i.1 := h₂ i hi + rw [hΦi i hi] at hb + exact ⟨i.1, i.2, h₃ i z hi (hbdα h₅ hb)⟩ + refine ⟨H', φ, ?_, ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + obtain ⟨i, hi⟩ := hsome z hz + rw [hΦi i hi] + exact harr_Δ i.1 i.2 (h₂ i hi) + · rintro _ ⟨⟨z, hz, rfl⟩, hb⟩ + obtain ⟨S₀, -, hzX⟩ := hbdV z hz hb + exact mem_image_of_mem Φ hzX.1 + · apply subset_antisymm + · rintro v ⟨hv, hb⟩ + obtain ⟨S₁, hS₁, h₅⟩ := mem_iUnion₂.mp (hbd_in_seg v ⟨hv, hb⟩) + have h₆ := hΦX S₁ hS₁ v ⟨hv, h₅⟩ + rw [hα_id v ⟨hv, hb⟩] at h₆ + exact ⟨⟨v, hv, h₆⟩, hb⟩ + · rintro _ ⟨⟨v, hv, rfl⟩, hb⟩ + have hvU : v ∈ H.U := H.V_subset_U hv + obtain ⟨S₀, hS₀, hvX⟩ := hbdV v hvU hb + have h₅ := hΦX S₀ hS₀ v hvX + have hseg₀ := hsegv hS₀ hvX.2 + have hvb := hα_bd v hv hseg₀ (h₅ ▸ hb) + rw [h₅, hα_id v ⟨hv, hvb⟩] + exact ⟨hv, hvb⟩ + · intro v hv + obtain ⟨S₁, hS₁, h₅⟩ := mem_iUnion₂.mp hv + rw [hφv, hΦX S₁ hS₁ v.1 ⟨v.2, h₅⟩] + · intro S₀ hS₀ + let i₀ : S_seg := ⟨S₀, hS₀⟩ + have hdiskSub : subBd (α_disc S₀) ⊆ α_disc S₀ := subBd_subset_of subset_rfl + (hdisc S₀ hS₀).isClosed + refine ⟨?_, fun v => ?_, fun e => ?_⟩ + · apply subset_antisymm + · rintro _ ⟨⟨z, hz, rfl⟩, hb⟩ + obtain ⟨i, hi⟩ := hsome z hz + have hzb : ψ i z ∈ subBd (α_disc S₀) := hΦi i hi ▸ hb + have hzX : z ∈ H.V ∧ η.vMap z ∈ S₀.Ω.bar := by + by_cases hii : i = i₀ + · have hs : i.1 = S₀ := congrArg Subtype.val hii + exact hs ▸ h₃ i z hi (hs.symm ▸ hzb) + · obtain ⟨h₅, h₆⟩ := hcross i i₀ hii z hi (hdiskSub hzb) + exact ⟨h₅.1, h₆⟩ + exact ⟨⟨z, hzX.1⟩, hφv _, hzX.2⟩ + · rintro _ ⟨v, rfl, hv⟩ + rw [hφv, hΦX S₀ hS₀ v.1 ⟨v.2, hv⟩] + refine ⟨?_, (harr.isClosedDisc S₀ hS₀).2 _ hv⟩ + rw [← hΦX S₀ hS₀ v.1 ⟨v.2, hv⟩] + exact mem_image_of_mem Φ (H.V_subset_U v.2) + · rw [hφv] + have hvU : v.1 ∈ H.U := H.V_subset_U v.2 + constructor + · intro h₅ + obtain ⟨i, hi⟩ := hsome v.1 hvU + by_cases hii : i = i₀ + · have hs : i.1 = S₀ := congrArg Subtype.val hii + have hi' : v.1 ∈ (Pd S₀).U := hs ▸ hi + exact (hPU_V S₀ hS₀ v.1 hi' v.2).2 + · have h₆ : ψ i v.1 ∈ α_disc i₀.1 := hΦi i hi ▸ h₅ + exact S₀.bar_subset (hcross i i₀ hii v.1 hi h₆).2 + · intro h₅ + have h₆ : v.1 ∈ (Pd S₀).U := (Pd S₀).V_subset_U (by + rw [hPV S₀ hS₀] + exact ⟨v.2, h₅⟩) + rw [hΦi i₀ h₆] + exact h₂ i₀ h₆ + · rw [hφe] + have heH : e.1 ∈ H.E := e.2 + obtain ⟨z, hz⟩ := heH.1 + constructor + · intro h₅ + obtain ⟨S₁, hS₁, h₆⟩ := seg_edge η hseg heH + by_cases hii : S₁ = S₀ + · exact hii ▸ h₆ + · have heP : e.1 ∈ (Pd S₁).E := by + rw [hPE] + exact ⟨heH, h₆⟩ + have hzU : z ∈ (Pd S₁).U := (Pd S₁).closure_subset_U heP (subset_closure hz) + have h₇ : ψ ⟨S₁, hS₁⟩ z ∈ α_disc S₀ := hΦi ⟨S₁, hS₁⟩ hzU ▸ h₅ (mem_image_of_mem Φ hz) + have h₈ := hcross ⟨S₁, hS₁⟩ i₀ (fun h => hii (congrArg Subtype.val h)) z hzU h₇ + exact absurd h₈.1.1 (edge_notMem_V heH hz) + · rintro h₅ _ ⟨y, hy, rfl⟩ + have heP : e.1 ∈ (Pd S₀).E := by + rw [hPE] + exact ⟨heH, h₅⟩ + have hyU : y ∈ (Pd S₀).U := (Pd S₀).closure_subset_U heP (subset_closure hy) + rw [hΦi i₀ hyU] + exact h₂ i₀ hyU + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM14/RigidSphere.lean b/LeanPool/GraphMinor/GM14/RigidSphere.lean new file mode 100644 index 0000000000..64f20818b9 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/RigidSphere.lean @@ -0,0 +1,373 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.RigidWheel +public import LeanPool.GraphMinor.GM14.Whitney +import LeanPool.GraphMinor.GM11.RadialExists +import LeanPool.GraphMinor.GM11.Theorem61 +import LeanPool.GraphMinor.GM11.PerimeterPull +import LeanPool.GraphMinor.GM14.DiscSlope + +/-! +# (6.4) on a sphere + +Here is the core of the paper's proof of (6.4) (page 34). Let `D₁` and `D₂` be the two closed discs +of a +sphere with common boundary `C`. Let `H₁` and `H₂` be drawings in `D₁` with the same vertices on +`C`, and +let `φ` be an isomorphism between them that fixes those vertices. If `H₁` is rigid in `D₁`, then `φ` +comes +from a homeomorphism of the sphere that keeps `D₁` and fixes `C`. + +Add one wheel `W` in `D₂` to both drawings. By `good_of_wheel` and `good_sub`, the first union is a +subdivision of a simple 3-connected graph. Whitney's theorem (`whitney_fixing`) then gives a +homeomorphism +that fixes `W` pointwise. It keeps the sides of `C`, as it fixes `C` and the hub of the wheel. +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- Two unions with a wheel are isomorphic if the parts are, and the isomorphism fixes the wheel. -/ +theorem exists_glueIso {H₁ H₂ W J₁ J₂ : Drawing S} (hu₁ : IsUnion H₁ W J₁) (hu₂ : IsUnion H₂ W J₂) + (φ : Iso H₁.toGraph H₂.toGraph) + (hfix : ∀ v : V(H₁.toGraph), v.1 ∈ W.V → (φ.vertexEquiv v).1 = v.1) + (hfix' : ∀ v : V(H₂.toGraph), v.1 ∈ W.V → (φ.vertexEquiv.symm v).1 = v.1) + (hd₁ : Disjoint H₁.E W.E) (hd₂ : Disjoint H₂.E W.E) : + ∃ φ' : Iso J₁.toGraph J₂.toGraph, + (∀ (v : V(J₁.toGraph)) (h : v.1 ∈ H₁.V), (φ'.vertexEquiv v).1 = (φ.vertexEquiv ⟨v.1, h⟩).1) ∧ + (∀ v : V(J₁.toGraph), v.1 ∈ W.V → (φ'.vertexEquiv v).1 = v.1) ∧ + (∀ (e : E(J₁.toGraph)) (h : e.1 ∈ H₁.E), (φ'.edgeEquiv e).1 = (φ.edgeEquiv ⟨e.1, h⟩).1) ∧ + (∀ e : E(J₁.toGraph), e.1 ∈ W.E → (φ'.edgeEquiv e).1 = e.1) := by + classical + let fv : S → S := fun v => if h : v ∈ H₁.V then (φ.vertexEquiv ⟨v, h⟩).1 else v + let gv : S → S := fun v => if h : v ∈ H₂.V then (φ.vertexEquiv.symm ⟨v, h⟩).1 else v + let fe : Set S → Set S := fun e => if h : e ∈ H₁.E then (φ.edgeEquiv ⟨e, h⟩).1 else e + let ge : Set S → Set S := fun e => if h : e ∈ H₂.E then (φ.edgeEquiv.symm ⟨e, h⟩).1 else e + have fv₁ : ∀ {v} (h : v ∈ H₁.V), fv v = (φ.vertexEquiv ⟨v, h⟩).1 := fun h => dite_eq_left h + have fv₂ : ∀ {v}, v ∉ H₁.V → fv v = v := fun h => dite_eq_right h + have gv₁ : ∀ {v} (h : v ∈ H₂.V), gv v = (φ.vertexEquiv.symm ⟨v, h⟩).1 := fun h => dite_eq_left h + have gv₂ : ∀ {v}, v ∉ H₂.V → gv v = v := fun h => dite_eq_right h + have fe₁ : ∀ {e} (h : e ∈ H₁.E), fe e = (φ.edgeEquiv ⟨e, h⟩).1 := fun h => dite_eq_left h + have fe₂ : ∀ {e}, e ∉ H₁.E → fe e = e := fun h => dite_eq_right h + have ge₁ : ∀ {e} (h : e ∈ H₂.E), ge e = (φ.edgeEquiv.symm ⟨e, h⟩).1 := fun h => dite_eq_left h + have ge₂ : ∀ {e}, e ∉ H₂.E → ge e = e := fun h => dite_eq_right h + have hfH : ∀ {v}, v ∈ H₁.V → fv v ∈ H₂.V := fun h => by + rw [fv₁ h] + exact (φ.vertexEquiv ⟨_, h⟩).2 + have hgH : ∀ {v}, v ∈ H₂.V → gv v ∈ H₁.V := fun h => by + rw [gv₁ h] + exact (φ.vertexEquiv.symm ⟨_, h⟩).2 + have hfW : ∀ {v}, v ∈ W.V → fv v = v := fun {v} h => by + by_cases h₁ : v ∈ H₁.V + · rw [fv₁ h₁] + exact hfix ⟨v, h₁⟩ h + · exact fv₂ h₁ + have hgW : ∀ {v}, v ∈ W.V → gv v = v := fun {v} h => by + by_cases h₁ : v ∈ H₂.V + · rw [gv₁ h₁] + exact hfix' ⟨v, h₁⟩ h + · exact gv₂ h₁ + have hgf : ∀ {v}, v ∈ J₁.V → gv (fv v) = v := fun {v} hv => by + by_cases h₁ : v ∈ H₁.V + · rw [gv₁ (hfH h₁)] + simp [fv₁ h₁] + · have hW : v ∈ W.V := by + rw [hu₁.hV] at hv + exact hv.resolve_left h₁ + rw [hfW hW, hgW hW] + have hfg : ∀ {v}, v ∈ J₂.V → fv (gv v) = v := fun {v} hv => by + by_cases h₁ : v ∈ H₂.V + · rw [fv₁ (hgH h₁)] + simp [gv₁ h₁] + · have hW : v ∈ W.V := by + rw [hu₂.hV] at hv + exact hv.resolve_left h₁ + rw [hgW hW, hfW hW] + have hfJ : ∀ {v}, v ∈ J₁.V → fv v ∈ J₂.V := fun {v} hv => by + rw [hu₁.hV] at hv + rw [hu₂.hV] + rcases hv with h₁ | h₁ + · exact Or.inl (hfH h₁) + · exact Or.inr (by rw [hfW h₁]; exact h₁) + have hgJ : ∀ {v}, v ∈ J₂.V → gv v ∈ J₁.V := fun {v} hv => by + rw [hu₂.hV] at hv + rw [hu₁.hV] + rcases hv with h₁ | h₁ + · exact Or.inl (hgH h₁) + · exact Or.inr (by rw [hgW h₁]; exact h₁) + have hfeH : ∀ {e}, e ∈ H₁.E → fe e ∈ H₂.E := fun h => by + rw [fe₁ h] + exact (φ.edgeEquiv ⟨_, h⟩).2 + have hgeH : ∀ {e}, e ∈ H₂.E → ge e ∈ H₁.E := fun h => by + rw [ge₁ h] + exact (φ.edgeEquiv.symm ⟨_, h⟩).2 + have hfeW : ∀ {e}, e ∈ W.E → fe e = e := fun h => fe₂ fun h₁ => disjoint_left.mp hd₁ h₁ h + have hgeW : ∀ {e}, e ∈ W.E → ge e = e := fun h => ge₂ fun h₁ => disjoint_left.mp hd₂ h₁ h + have hgfe : ∀ {e}, e ∈ J₁.E → ge (fe e) = e := fun {e} he => by + have he' : e ∈ H₁.E ∪ W.E := hu₁.hE ▸ he + rcases he' with h₁ | h₁ + · rw [ge₁ (hfeH h₁)] + simp [fe₁ h₁] + · rw [hfeW h₁, hgeW h₁] + have hfge : ∀ {e}, e ∈ J₂.E → fe (ge e) = e := fun {e} he => by + have he' : e ∈ H₂.E ∪ W.E := hu₂.hE ▸ he + rcases he' with h₁ | h₁ + · rw [fe₁ (hgeH h₁)] + simp [ge₁ h₁] + · rw [hgeW h₁, hfeW h₁] + have hfeJ : ∀ {e}, e ∈ J₁.E → fe e ∈ J₂.E := fun {e} he => by + have he' : e ∈ H₁.E ∪ W.E := hu₁.hE ▸ he + rw [hu₂.hE] + rcases he' with h₁ | h₁ + · exact Or.inl (hfeH h₁) + · exact Or.inr (by rw [hfeW h₁]; exact h₁) + have hgeJ : ∀ {e}, e ∈ J₂.E → ge e ∈ J₁.E := fun {e} he => by + have he' : e ∈ H₂.E ∪ W.E := hu₂.hE ▸ he + rw [hu₁.hE] + rcases he' with h₁ | h₁ + · exact Or.inl (hgeH h₁) + · exact Or.inr (by rw [hgeW h₁]; exact h₁) + -- If `f(x)` lies in the wheel, then `f(x) = x`. + have hback : ∀ {x}, x ∈ J₁.V → fv x ∈ W.V → fv x = x := fun {x} hx hW => by + have := hgf hx + rw [hgW hW] at this + exact this + -- If `f(x)` lies in `H₂`, then `x` lies in `H₁`. + have hbackH : ∀ {x}, x ∈ J₁.V → fv x ∈ H₂.V → x ∈ H₁.V := fun {x} hx hH => by + have := hgH hH + rwa [hgf hx] at this + refine ⟨⟨⟨fun v => ⟨fv v.1, hfJ v.2⟩, fun v => ⟨gv v.1, hgJ v.2⟩, + fun v => Subtype.ext (hgf v.2), fun v => Subtype.ext (hfg v.2)⟩, + ⟨fun e => ⟨fe e.1, hfeJ e.2⟩, fun e => ⟨ge e.1, hgeJ e.2⟩, + fun e => Subtype.ext (hgfe e.2), fun e => Subtype.ext (hfge e.2)⟩, ?_⟩, + fun v h => fv₁ h, fun v h => hfW h, fun e h => fe₁ h, fun e h => hfeW h⟩ + rintro ⟨e, he⟩ ⟨x, hx⟩ ⟨y, hy⟩ + change J₁.toGraph.IsLink e x y ↔ J₂.toGraph.IsLink (fe e) (fv x) (fv y) + have he' : e ∈ H₁.E ∪ W.E := hu₁.hE ▸ he + rcases he' with h₁ | h₁ + · rw [hu₁.linkH e h₁ x y, hu₂.linkH _ (hfeH h₁)] + constructor + · intro hl + have hxH : x ∈ H₁.V := hl.left_mem + have hyH : y ∈ H₁.V := hl.right_mem + rw [fe₁ h₁, fv₁ hxH, fv₁ hyH] + exact (φ.isLink_iff ⟨e, h₁⟩ ⟨x, hxH⟩ ⟨y, hyH⟩).mp hl + · intro hl + have hxH : x ∈ H₁.V := hbackH hx hl.left_mem + have hyH : y ∈ H₁.V := hbackH hy hl.right_mem + rw [fe₁ h₁, fv₁ hxH, fv₁ hyH] at hl + exact (φ.isLink_iff ⟨e, h₁⟩ ⟨x, hxH⟩ ⟨y, hyH⟩).mpr hl + · rw [hfeW h₁, hu₁.linkW e h₁ x y, hu₂.linkW e h₁] + constructor + · intro hl + rw [hfW hl.left_mem, hfW hl.right_mem] + exact hl + · intro hl + have h₃ := hback hx hl.left_mem + have h₄ := hback hy hl.right_mem + rwa [h₃, h₄] at hl + +omit [T2Space S] in +/-- A homeomorphism of the sphere that fixes the common boundary and a point off `D₁` keeps the +complement of `D₁`. -/ +theorem image_compl_sub {D₁ D₂ C : Set S} (hc₁ : IsClosed D₁) (hc₂ : IsClosed D₂) (hcov : D₁ ∪ D₂ + = univ) + (hC : D₁ ∩ D₂ = C) (hconn : IsPreconnected D₁ᶜ) {a : S} (ha : a ∉ D₁) (h : S ≃ₜ S) + (hfix : ∀ x ∈ C, h x = x) (hfa : h a = a) : h '' D₁ᶜ ⊆ D₁ᶜ := by + have hpre : IsPreconnected (h '' D₁ᶜ) := hconn.image h h.continuous.continuousOn + refine hpre.subset_left_of_subset_union hc₁.isOpen_compl hc₂.isOpen_compl ?_ ?_ ?_ + · refine disjoint_left.mpr fun x h₁ h₂ => ?_ + have : x ∈ D₁ ∪ D₂ := hcov ▸ mem_univ x + rcases this with h₃ | h₃ + · exact h₁ h₃ + · exact h₂ h₃ + · rintro _ ⟨x, hx, rfl⟩ + by_contra hn + simp only [mem_union, mem_compl_iff, not_or, not_not] at hn + have hC' : h x ∈ C := hC ▸ hn + have : h (h x) = h x := hfix _ hC' + have hxx : h x = x := h.injective this + exact hx (hxx ▸ hn.1) + · exact ⟨a, ⟨a, ha, hfa⟩, ha⟩ + +/-- A rigid drawing in `D₁`, with a wheel in `D₂`, gives a frame and a radial drawing. -/ +theorem exists_frame [ConnectedSpace S] (hS : IsClosedSurface S) (hsph : IsSphere S) + {D₁ D₂ C : Set S} (hd₁ : IsClosedDisc D₁) (hd₂ : IsClosedDisc D₂) (hb₁ : discBd D₁ = C) + (hb₂ : discBd D₂ = C) (hcov : D₁ ∪ D₂ = univ) (hcap : D₁ ∩ D₂ = C) {H : Drawing S} + (hU : H.U ⊆ D₁) (hn : H.U ∩ C ⊆ H.V) (hr : IsRigidIn H D₁) : + ∃ (W : Drawing S) (a : S) (Γ' : Drawing S) (hm : H.U ∩ W.U ⊆ H.V ∩ W.V), + Wheel W (H.V ∩ C) D₁ D₂ ∧ Frame H (H.glue W hm) D₁ a ∧ Rad (H.glue W hm) Γ' ∧ a ∈ W.V ∧ + a ∈ D₂ ∧ a ∉ D₁ ∧ IsPreconnected D₁ᶜ ∧ (∀ z ∈ W.V, z ≠ a → ∃ g, W.toGraph.IsLink g a z) := by + classical + have hsb : subBd D₁ = C := (IsClosedDisc.subBd_eq_discBd hS hd₁).trans hb₁ + have hB : (H.V ∩ C).Finite := H.finite_V.subset inter_subset_left + have hpd₁ : IsPreconnected D₁ := hd₁.isPathConnected.isConnected.isPreconnected + have hCD₁ : discBd D₂ ⊆ D₁ := hb₂ ▸ hb₁ ▸ Surface.discBd_subset D₁ + obtain ⟨W, a, hw, haV, haD, hab, hVsub, hhub⟩ := exists_wheel hd₂ hB + (inter_subset_right.trans hb₂.symm.subset) hpd₁ hCD₁ + have hm : H.U ∩ W.U ⊆ H.V ∩ W.V := by + rintro z ⟨hz, hz'⟩ + have hzC : z ∈ C := hcap ▸ ⟨hU hz, hw.Usub hz'⟩ + have hzV : z ∈ H.V := hn ⟨hz, hzC⟩ + exact ⟨hzV, hw.BV ⟨hzV, hzC⟩⟩ + have hu : IsUnion H W (H.glue W hm) := isUnion_glue hm + have hcompl : D₁ᶜ = D₂ \ frontier D₂ := by + rw [IsClosedDisc.frontier_eq_discBd hS hd₂, hb₂] + ext x + constructor + · intro hx + have : x ∈ D₁ ∪ D₂ := hcov ▸ mem_univ x + refine ⟨this.resolve_left hx, fun h₁ => hx ?_⟩ + rw [← hb₁] at h₁ + exact Surface.discBd_subset D₁ h₁ + · rintro ⟨h₁, h₂⟩ h₃ + exact h₂ (hcap ▸ ⟨h₃, h₁⟩) + have hpre : IsPreconnected D₁ᶜ := hcompl ▸ IsClosedDisc.isPreconnected_diff_frontier hS hd₂ + have haD₁ : a ∉ D₁ := fun h₁ => hab (hb₂.symm ▸ hcap ▸ ⟨h₁, haD⟩) + have hWsub : W.U ⊆ (H.glue W hm).U := subset_union_right + have hCW : C ⊆ W.U := hb₂ ▸ hw.bdU + have hf : Frame H (H.glue W hm) D₁ a := by + refine ⟨hd₁, ?_, hU, ?_, subset_union_left, ?_, ?_, ?_, haD₁, hpre, hr⟩ + · rw [hsb] + exact hCW.trans hWsub + · rw [hsb] + exact hn + · exact fun e he => hu.hE ▸ Or.inl he + · rintro z ⟨hz | hz, hzD, hzb⟩ + · exact hz + · exact absurd (hsb ▸ hcap ▸ ⟨hzD, hw.Usub hz⟩) hzb + · change IsPreconnected (D₁ ∪ (H.U ∪ W.U)) + rw [← union_assoc, union_eq_left.mpr hU] + exact hw.hconn + have hJE : (PaintingOrDrawing.drawing (H.glue W hm)).E.Nonempty := by + obtain ⟨T, -, hT4, hT3⟩ := hw.four + obtain ⟨t, ht⟩ : T.Nonempty := by + refine nonempty_iff_ne_empty.mpr fun h₁ => ?_ + rw [h₁, ncard_empty] at hT4 + omega + have h₃ := hT3 t ht + obtain ⟨g, hg⟩ : {e | W.toGraph.Inc e t}.Nonempty := by + refine nonempty_iff_ne_empty.mpr fun h₁ => ?_ + rw [h₁, ncard_empty] at h₃ + omega + refine ⟨g, ?_⟩ + change g ∈ (H.glue W hm).E + rw [hu.hE] + exact Or.inr hg.edge_mem + obtain ⟨Γ', hrad⟩ := exists_radialDrawing hS (hf.twoCell hS hsph) + exact ⟨W, a, Γ', hm, hw, hf, ⟨hrad.2.1.1, hrad.2.1.2.1, regionFacts_any hS hJE hrad⟩, haV, haD, + haD₁, + hpre, hhub⟩ + +/-- **(6.4) on a sphere.** -/ +theorem sphere_core [ConnectedSpace S] (hSurf : IsSurface S) (hS : IsClosedSurface S) + (hsph : IsSphere S) + {D₁ D₂ C : Set S} (hd₁ : IsClosedDisc D₁) (hd₂ : IsClosedDisc D₂) (hb₁ : discBd D₁ = C) + (hb₂ : discBd D₂ = C) (hcov : D₁ ∪ D₂ = univ) (hcap : D₁ ∩ D₂ = C) {H₁ H₂ : Drawing S} + (hU₁ : H₁.U ⊆ D₁) (hU₂ : H₂.U ⊆ D₁) (hn₁ : H₁.U ∩ C ⊆ H₁.V) (hn₂ : H₂.U ∩ C ⊆ H₂.V) + (hV : H₁.V ∩ C = H₂.V ∩ C) (φ : Iso H₁.toGraph H₂.toGraph) + (hφ : ∀ v : V(H₁.toGraph), v.1 ∈ C → (φ.vertexEquiv v).1 = v.1) (hr : IsRigidIn H₁ D₁) : + ∃ h : S ≃ₜ S, h '' D₁ = D₁ ∧ (∀ x ∈ C, h x = x) ∧ (∀ v : V(H₁.toGraph), h v.1 = + (φ.vertexEquiv v).1) ∧ + ∀ e : E(H₁.toGraph), h '' e.1 = (φ.edgeEquiv e).1 := by + classical + obtain ⟨W, a, Γ', hm₁, hw, hf, hrr, haV, haD, haD₁, hpre, -⟩ := + exists_frame hS hsph hd₁ hd₂ hb₁ hb₂ hcov hcap hU₁ hn₁ hr + have hm₂ : H₂.U ∩ W.U ⊆ H₂.V ∩ W.V := by + rintro z ⟨hz, hz'⟩ + have hzC : z ∈ C := hcap ▸ ⟨hU₂ hz, hw.Usub hz'⟩ + have hzV : z ∈ H₂.V := hn₂ ⟨hz, hzC⟩ + exact ⟨hzV, hw.BV (hV.symm.subset ⟨hzV, hzC⟩)⟩ + have hu₁ : IsUnion H₁ W (H₁.glue W hm₁) := isUnion_glue hm₁ + have hu₂ : IsUnion H₂ W (H₂.glue W hm₂) := isUnion_glue hm₂ + have hCW : C ⊆ W.U := hb₂ ▸ hw.bdU + have hgood := good_of_wheel hf hrr hw hu₁ + (fun v hv hvW => ⟨hv, by + have : v ∈ D₁ ∩ D₂ := ⟨hU₁ (H₁.V_subset_U hv), hw.Usub (W.V_subset_U hvW)⟩ + rwa [hcap] at this⟩) hm₁ hS hsph + have hsub := good_sub hgood + -- A wheel vertex in `H₁` or `H₂` lies on `C`. + have hVC₁ : ∀ {v}, v ∈ H₁.V → v ∈ W.V → v ∈ C := fun hv hvW => by + have : _ ∈ D₁ ∩ D₂ := ⟨hU₁ (H₁.V_subset_U hv), hw.Usub (W.V_subset_U hvW)⟩ + rwa [hcap] at this + have hVC₂ : ∀ {v}, v ∈ H₂.V → v ∈ W.V → v ∈ C := fun hv hvW => by + have : _ ∈ D₁ ∩ D₂ := ⟨hU₂ (H₂.V_subset_U hv), hw.Usub (W.V_subset_U hvW)⟩ + rwa [hcap] at this + have hdE : ∀ {H : Drawing S}, H.U ∩ W.U ⊆ H.V ∩ W.V → Disjoint H.E W.E := by + intro H hH + refine disjoint_left.mpr fun e he he' => ?_ + obtain ⟨z, hz⟩ := he.1 + have hzU : z ∈ H.U := H.closure_subset_U he (subset_closure hz) + have hzW : z ∈ W.U := W.closure_subset_U he' (subset_closure hz) + exact edge_notMem_V he hz (hH ⟨hzU, hzW⟩).1 + obtain ⟨φ', hφ₁, hφ₂, hφ₃, hφ₄⟩ := exists_glueIso hu₁ hu₂ φ + (fun v hv => hφ v (hVC₁ v.2 hv)) + (fun v hv => by + have hvC := hVC₂ v.2 hv + have hv₁ : v.1 ∈ H₁.V := (hV.symm.subset ⟨v.2, hvC⟩).1 + have h₁ := hφ ⟨v.1, hv₁⟩ hvC + have h₂ : φ.vertexEquiv ⟨v.1, hv₁⟩ = v := Subtype.ext h₁ + have h₃ := congrArg Subtype.val (φ.vertexEquiv.symm_apply_apply ⟨v.1, hv₁⟩) + rw [h₂] at h₃ + exact h₃) + (hdE hm₁) (hdE hm₂) + obtain ⟨h, hhV, hhE, hhW⟩ := whitney_fixing hSurf hsph _ _ hsub φ' W.E (by + intro e he + refine ⟨hφ₄ e he, fun v hv => hφ₂ v ?_⟩ + have hvW : v.1 ∈ W.U := W.closure_subset_U he hv + have hvV : v.1 ∈ H₁.V ∪ W.V := hu₁.hV ▸ v.2 + rcases hvV with h₁ | h₁ + · exact (hm₁ ⟨H₁.V_subset_U h₁, hvW⟩).2 + · exact h₁) + have hWfix : ∀ x ∈ W.U, h x = x := by + intro x hx + by_cases hxV : x ∈ W.V + · have hxJ : x ∈ V((H₁.glue W hm₁).toGraph) := Or.inr hxV + rw [hhV ⟨x, hxJ⟩] + exact hφ₂ ⟨x, hxJ⟩ hxV + · obtain ⟨e, he, hxe⟩ := W.exists_edge_of_mem hx hxV + exact hhW e he (hu₁.hE ▸ Or.inr he) x (subset_closure hxe) + have hfixC : ∀ x ∈ C, h x = x := fun x hx => hWfix x (hCW hx) + have hfa : h a = a := hWfix a (W.V_subset_U haV) + have hsym₁ : ∀ x ∈ C, h.symm x = x := fun x hx => by + rw [Homeomorph.symm_apply_eq] + exact (hfixC x hx).symm + have hsyma : h.symm a = a := by + rw [Homeomorph.symm_apply_eq] + exact hfa.symm + have hi₁ := image_compl_sub hd₁.isClosed hd₂.isClosed hcov hcap hpre haD₁ h hfixC hfa + have hi₂ := image_compl_sub hd₁.isClosed hd₂.isClosed hcov hcap hpre haD₁ h.symm hsym₁ hsyma + refine ⟨h, ?_, hfixC, ?_, ?_⟩ + · have hc : h '' D₁ᶜ = D₁ᶜ := by + refine subset_antisymm hi₁ fun x hx => ⟨h.symm x, hi₂ (mem_image_of_mem _ hx), by simp⟩ + have := congrArg compl hc + rwa [compl_compl, ← image_compl_eq h.bijective, compl_compl] at this + · intro v + have hvJ : v.1 ∈ V((H₁.glue W hm₁).toGraph) := Or.inl v.2 + rw [hhV ⟨v.1, hvJ⟩] + exact hφ₁ ⟨v.1, hvJ⟩ v.2 + · intro e + have heJ : e.1 ∈ E((H₁.glue W hm₁).toGraph) := by + change e.1 ∈ (H₁.glue W hm₁).E + rw [hu₁.hE] + exact Or.inl e.2 + rw [hhE ⟨e.1, heJ⟩] + exact hφ₃ ⟨e.1, heJ⟩ e.2 + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM14/RigidThread.lean b/LeanPool/GraphMinor/GM14/RigidThread.lean new file mode 100644 index 0000000000..42ef4a033c --- /dev/null +++ b/LeanPool/GraphMinor/GM14/RigidThread.lean @@ -0,0 +1,515 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.RigidNoose +public import LeanPool.GraphMinor.GM14.Section6b +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.SphereRegion +import LeanPool.GraphMinor.GM11.OArcCircuit + +/-! +# A small side of a rigid drawing is a path + +We keep the setting of `RigidNoose`. Let `A` be a nonempty set of edges of `H` with at most two +vertices that meet both `A` and another edge of `J`. Then `A` is the edge set of a path `P` of `H` +between these two vertices, and the inner vertices of `P` have no other edges and do not lie on the +boundary of `Δ`. This is `exists_thread`. + +By `exists_dial_of_edge`, each edge of `A` is on a path in a dial. If two such paths differ then +they +are disjoint inside and form a circuit `K`. We apply `exists_dial_of_edge` again, to all the edges +in +the disc that `K` bounds in `Δ`. The new `O`-arc misses the inside of that disc, since all the +regions +there are in the set. So the new dial includes the disc, and it holds the circuit `K`. But it holds +only a path, and a line includes no `O`-arc. +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- A line includes no `O`-arc. -/ +theorem not_oArc_subset_line {F L : Set S} {a b : S} (hF : IsOArc F) (hL : IsLineWithEnds L a b) + (hFL : F ⊆ L) : False := by + obtain ⟨φ⟩ := hF + obtain ⟨ψ, -, -⟩ := hL + let g : Circle → ℝ := fun x => (ψ.symm ⟨(φ x).1, hFL (φ x).2⟩ : unitInterval) + have hg : Continuous g := by fun_prop + refine GM11.not_injective_circle_real hg fun x y hxy => ?_ + have h₁ : ψ.symm ⟨(φ x).1, hFL (φ x).2⟩ = ψ.symm ⟨(φ y).1, hFL (φ y).2⟩ := Subtype.ext hxy + have h₂ := ψ.symm.injective h₁ + exact φ.injective (Subtype.ext (congrArg (fun z : L => z.1) h₂)) + +omit [T2Space S] in +theorem isPathBetween_symm {P : Drawing S} {a b : S} (h : P.IsPathBetween a b) : + P.IsPathBetween b a := by + obtain ⟨W, hs, hV, hE⟩ := h + refine ⟨W.reverse, hs.reverse, ?_, ?_⟩ + · rw [hV] + ext x + simp [GraphWalk.support_reverse] + · rw [hE] + ext x + simp [GraphWalk.edges_reverse] + +theorem start_mem_support {α β : Type*} {G : Graph α β} {a b : α} (W : GraphWalk G a b) : + a ∈ W.support := by + cases W <;> simp [GraphWalk.support] + +theorem end_mem_support {α β : Type*} {G : Graph α β} {a b : α} (W : GraphWalk G a b) : + b ∈ W.support := by + induction W with + | nil _ => simp [GraphWalk.support] + | cons _ _ ih => exact List.mem_cons_of_mem _ ih + +omit [T2Space S] in +/-- All the edges of a simple walk are on the same side of `A` if no inner vertex meets both sides. +-/ +theorem walk_same_side {J P : Drawing S} (hV : P.V ⊆ J.V) (hE : P.E ⊆ J.E) {A : Set (Set S)} : + ∀ {a b : S} (W : GraphWalk P.toGraph a b), W.IsSimple → + (∀ v ∈ W.support, v ≠ a → v ≠ b → v ∉ Whitney.bdry J.toGraph A) → + ∀ g ∈ W.edges, ∀ g' ∈ W.edges, g ∈ A → g' ∈ A := by + intro a b W + induction W with + | nil _ => simp [GraphWalk.edges] + | @cons u v t e hl rest ih => + intro hs hb g hg g' hg' hgA + have hrs : rest.IsSimple := (List.nodup_cons.mp hs).2 + have hun : u ∉ rest.support := (List.nodup_cons.mp hs).1 + have hrb : ∀ w ∈ rest.support, w ≠ v → w ≠ t → w ∉ Whitney.bdry J.toGraph A := fun w hw h₁ h₂ => + hb w (List.mem_cons_of_mem _ hw) (fun h' => hun (h' ▸ hw)) h₂ + have hIH := ih hrs hrb + -- `e` and the edges of `rest` are on the same side. + have hstep : ∀ c ∈ rest.edges, (e ∈ A ↔ c ∈ A) := by + intro c hc + have hfirst : ∃ c₀ ∈ rest.edges, P.toGraph.Inc c₀ v := by + cases rest with + | nil _ => simp [GraphWalk.edges] at hc + | @cons _ v' _ c₀ hl' _ => exact ⟨c₀, by simp [GraphWalk.edges], v', hl'⟩ + obtain ⟨c₀, hc₀, hic⟩ := hfirst + have hvt : v ≠ t := by + rintro rfl + cases rest with + | nil _ => simp [GraphWalk.edges] at hc + | @cons _ v' _ c₀ hl' r' => + exact (List.nodup_cons.mp hrs).1 (end_mem_support r') + have hvb := hb v (List.mem_cons_of_mem _ (start_mem_support rest)) + (fun h' => hun (h' ▸ start_mem_support rest)) hvt + have hincJ : ∀ {f : Set S}, P.toGraph.Inc f v → f ∈ P.E → J.toGraph.Inc f v := fun hi hf => + inc_of_mem_closure (hE hf) (mem_closure_of_inc hi) (hV hl.right_mem) + have heE : e ∈ P.E := hl.edge_mem + have hc₀E : c₀ ∈ P.E := hic.edge_mem + have h₀ : e ∈ A ↔ c₀ ∈ A := by + constructor + · intro he + by_contra hn + exact hvb ⟨⟨e, he, hincJ ⟨u, hl.symm⟩ heE⟩, ⟨c₀, ⟨hE hc₀E, hn⟩, hincJ hic hc₀E⟩⟩ + · intro he + by_contra hn + exact hvb ⟨⟨c₀, he, hincJ hic hc₀E⟩, ⟨e, ⟨hE heE, hn⟩, hincJ ⟨u, hl.symm⟩ heE⟩⟩ + exact h₀.trans ⟨fun h' => hIH c₀ hc₀ c hc h', fun h' => hIH c hc c₀ hc₀ h'⟩ + simp only [GraphWalk.edges, List.mem_cons] at hg hg' + rcases hg with rfl | hg <;> rcases hg' with rfl | hg' + · exact hgA + · exact (hstep g' hg').mp hgA + · exact (hstep g hg).mpr hgA + · exact hIH g hg g' hg' hgA + +variable {H J Γ' : Drawing S} {Δ : Set S} {a : S} + +/-- What a dial gives. -/ +structure Holder (H : Drawing S) (Δ F D : Set S) (x y : S) : Prop where + disc : IsClosedDisc D + sub : D ⊆ Δ + bd : discBd D = F + ne : x ≠ y + cap : F ∩ H.V = {x, y} + path : (H.interSet D).IsPathBetween x y + norm : F ∩ H.U ⊆ H.V + +variable {F D : Set S} {x y : S} + +theorem Holder.fr (h : Holder H Δ F D x y) (hS : IsClosedSurface S) : frontier D = F := + (IsClosedDisc.frontier_eq_discBd hS h.disc).trans h.bd + +theorem Holder.edge_F (h : Holder H Δ F D x y) {g : Set S} (hg : g ∈ H.E) : Disjoint g F := + disjoint_left.mpr fun _z hz hzF => + edge_notMem_V hg hz (h.norm ⟨hzF, H.closure_subset_U hg (subset_closure hz)⟩) + +theorem Holder.meets (h : Holder H Δ F D x y) (hS : IsClosedSurface S) {g : Set S} (hg : g ∈ H.E) + (hm : (g ∩ D).Nonempty) : g ⊆ D := by + rcases subset_or_disjoint_of_frontier h.disc.isClosed hg.2.2.1.isConnected.isPreconnected + (by rw [h.fr hS]; exact h.edge_F hg) with h₁ | h₁ + · exact h₁ + · obtain ⟨z, hz, hz'⟩ := hm + exact absurd hz' (disjoint_left.mp h₁ hz) + +theorem Holder.VU (h : Holder H Δ F D x y) (hS : IsClosedSurface S) : + (H.interSet D).V = H.V ∩ D ∧ (H.interSet D).U = H.U ∩ D := + interSet_V_and_U_of_edges h.disc.isClosed fun _ hg hm => h.meets hS hg hm + +theorem mem_interSet_E {g : Set S} : g ∈ (H.interSet D).E ↔ g ∈ H.E ∧ g ⊆ D := by + change g ∈ (H.span _ _).E ↔ _ + rw [H.span_E] + constructor + · rintro ⟨h₁, -⟩ + exact h₁ + · exact fun h₁ => ⟨h₁, h₁.1⟩ + +/-- A vertex of the path other than its ends is inside the disc. -/ +theorem Holder.inner (h : Holder H Δ F D x y) (hS : IsClosedSurface S) {v : S} + (hv : v ∈ (H.interSet D).V) (hx : v ≠ x) (hy : v ≠ y) : v ∈ interior D := by + rw [(h.VU hS).1] at hv + have hnF : v ∉ F := fun h' => by + have : v ∈ F ∩ H.V := ⟨h', hv.1⟩ + rw [h.cap] at this + rcases this with h₁ | h₁ + · exact hx h₁ + · exact hy h₁ + by_contra hn + exact hnF (h.fr hS ▸ ⟨subset_closure hv.2, hn⟩) + +/-- An edge of `J` that meets the interior of a disc in `Δ` is an edge of `H`. -/ +theorem Frame.mem_E_of_interior (f : Frame H J Δ a) {D' : Set S} (hD' : D' ⊆ Δ) {g : Set S} + (hg : g ∈ J.E) {q : S} (hq : q ∈ g) (hqD : q ∈ interior D') : g ∈ H.E := by + have hqi : q ∈ interior Δ := interior_mono hD' hqD + refine f.mem_E hg hq (interior_subset hqi) fun hb => ?_ + rw [subBd_eq_frontier] at hb + exact hb.2 hqi + +/-- Each edge of `J` at an inner vertex of the path is on the path, and the vertex is not on the +boundary of `Δ`. -/ +theorem Holder.inner_edges (h : Holder H Δ F D x y) (f : Frame H J Δ a) (hS : IsClosedSurface S) + {v : S} (hv : v ∈ (H.interSet D).V) (hx : v ≠ x) (hy : v ≠ y) : + v ∉ subBd Δ ∧ ∀ g ∈ J.E, J.toGraph.Inc g v → g ∈ (H.interSet D).E := by + have hi := h.inner hS hv hx hy + refine ⟨fun hb => ?_, fun g hg hinc => ?_⟩ + · rw [subBd_eq_frontier] at hb + exact hb.2 (interior_mono h.sub hi) + · have hc := mem_closure_of_inc hinc + obtain ⟨q, hqi, hqg⟩ := mem_closure_iff.mp hc _ isOpen_interior hi + have hgH := f.mem_E_of_interior h.sub hg hqg hqi + exact mem_interSet_E.mpr ⟨hgH, h.meets hS hgH ⟨q, hqg, interior_subset hqi⟩⟩ + +/-- Two holder paths with an edge belonging only to the second meet exactly at their ends +and form a circuit. -/ +theorem Holder.paths_form_circuit (hS : IsClosedSurface S) {F' D' : Set S} + (h₁ : Holder H Δ F D x y) (h₂ : Holder H Δ F' D' x y) + {e' : Set S} (he' : e' ∈ (H.interSet D').E) (hne : e' ∉ (H.interSet D).E) : + let P := H.interSet D + let P' := H.interSet D' + P.V ∩ P'.V = {x, y} ∧ Disjoint P.E P'.E ∧ (H.sup P P').IsCircuit := by + classical + set P := H.interSet D + set P' := H.interSet D' + have hPs : P.IsSubdrawing H := Drawing.span_isSubdrawing H _ _ + have hPs' : P'.IsSubdrawing H := Drawing.span_isSubdrawing H _ _ + have hxy := h₁.ne + have hline' : IsLineWithEnds P'.U x y := isLine_of_isPathBetween h₂.path hxy + have hxF : x ∈ F ∩ H.V := h₁.cap ▸ Or.inl rfl + have hyF : y ∈ F ∩ H.V := h₁.cap ▸ Or.inr rfl + have hxF' : x ∈ F' ∩ H.V := h₂.cap ▸ Or.inl rfl + have hyF' : y ∈ F' ∩ H.V := h₂.cap ▸ Or.inr rfl + have hFD : F ⊆ D := h₁.bd ▸ Surface.discBd_subset D + have hFD' : F' ⊆ D' := h₂.bd ▸ Surface.discBd_subset D' + have hxP : x ∈ P.V := (h₁.VU hS).1 ▸ ⟨hxF.2, hFD hxF.1⟩ + have hyP : y ∈ P.V := (h₁.VU hS).1 ▸ ⟨hyF.2, hFD hyF.1⟩ + have hxP' : x ∈ P'.V := (h₂.VU hS).1 ▸ ⟨hxF'.2, hFD' hxF'.1⟩ + have hyP' : y ∈ P'.V := (h₂.VU hS).1 ▸ ⟨hyF'.2, hFD' hyF'.1⟩ + -- The inside of the second path misses the first disc. + have hoff : P'.U \ {x, y} ⊆ H.U \ F := fun z hz => by + have hzU : z ∈ H.U := hPs'.U_subset hz.1 + refine ⟨hzU, fun hzF => hz.2 ?_⟩ + rw [← h₁.cap] + exact ⟨hzF, h₁.norm ⟨hzF, hzU⟩⟩ + have hedge : ∀ {g}, g ∈ P'.E → g ⊆ P'.U \ {x, y} := fun {g} hg z hz => by + refine ⟨P'.closure_subset_U hg (subset_closure hz), ?_⟩ + rintro (rfl | rfl) + · exact edge_notMem_V hg hz hxP' + · exact edge_notMem_V hg hz hyP' + have hdis : Disjoint (P'.U \ {x, y}) D := by + rcases subset_or_disjoint_of_frontier h₁.disc.isClosed + (IsLineWithEnds.isPreconnected_sdiff_pair hline') + (by + rw [h₁.fr hS] + exact disjoint_left.mpr fun z hz hzF => (hoff hz).2 hzF) with h₃ | h₃ + · exfalso + exact hne (mem_interSet_E.mpr ⟨hPs'.2 he', (hedge he').trans h₃⟩) + · exact h₃ + have hV : P.V ∩ P'.V = {x, y} := by + ext z + constructor + · rintro ⟨hz, hz'⟩ + by_contra hn + have hzD : z ∈ D := by + rw [(h₁.VU hS).1] at hz + exact hz.2 + exact disjoint_left.mp hdis ⟨P'.V_subset_U hz', hn⟩ hzD + · rintro (rfl | rfl) + · exact ⟨hxP, hxP'⟩ + · exact ⟨hyP, hyP'⟩ + have hE : Disjoint P.E P'.E := by + refine disjoint_left.mpr fun g hg hg' => ?_ + obtain ⟨z, hz⟩ := hg.1 + exact disjoint_left.mp hdis (hedge hg' hz) ((mem_interSet_E.mp hg).2 hz) + exact ⟨hV, hE, Drawing.isCircuit_sup h₁.path h₂.path hPs hPs' hxy hV hE⟩ + +omit [T2Space S] in +/-- The enclosed edges have boundary in the two distinguished vertices, and their tiles cover +the radial regions meeting the disc interior. -/ +theorem enclosed_edges_boundary_and_tiles {J Γ' K : Drawing S} (r : Rad J Γ') + {E₀ : Set S} {A' : Set (Set S)} {x y : S} + (hClosed : IsClosed E₀) (hfrE : frontier E₀ = K.U) (hKJ : K.IsSubdrawing J) + (hAdisc : ∀ g ∈ A', g ⊆ E₀) (hKA' : K.E ⊆ A') + (hinA : ∀ {g q}, g ∈ J.E → q ∈ g → q ∈ interior E₀ → g ∈ A') + (hBoundaryEdges : ∀ {v g}, v ∈ J.V → v ∈ K.U → v ≠ x → v ≠ y → + g ∈ J.E → J.toGraph.Inc g v → g ∈ K.E) : + Whitney.bdry J.toGraph A' ⊆ {x, y} ∧ + ∀ t ∈ Γ'.R, (t ∩ interior E₀).Nonempty → t ∈ tiles Γ' A' := by + have hbdry : Whitney.bdry J.toGraph A' ⊆ {x, y} := by + rintro v ⟨⟨g, hgA, hgi⟩, ⟨g', ⟨hg'J, hg'A⟩, hg'i⟩⟩ + by_contra hvn + have hvx : v ≠ x := fun h' => hvn (Or.inl h') + have hvy : v ≠ y := fun h' => hvn (Or.inr h') + have hvJ : v ∈ J.V := hgi.vertex_mem + have hvE : v ∈ E₀ := closure_minimal (hAdisc g hgA) hClosed (mem_closure_of_inc hgi) + by_cases hvK : v ∈ K.U + · exact hg'A (hKA' (hBoundaryEdges hvJ hvK hvx hvy hg'J hg'i)) + · have hvi : v ∈ interior E₀ := by + by_contra hn + exact hvK (hfrE ▸ ⟨subset_closure hvE, hn⟩) + obtain ⟨q, hqi, hqg⟩ := mem_closure_iff.mp (mem_closure_of_inc hg'i) _ isOpen_interior hvi + exact hg'A (hinA hg'J hqg hqi) + have htile : ∀ t ∈ Γ'.R, (t ∩ interior E₀).Nonempty → t ∈ tiles Γ' A' := by + intro t ht hm + obtain ⟨g, hg, hgt⟩ := r.facts.1 t ht + have hgJ : g ∈ J.E := hg + refine ⟨ht, g, ?_, hgt⟩ + by_contra hgA + have hgK : g ∉ K.E := fun h' => hgA (hKA' h') + have hdisj : Disjoint g K.U := edge_disjoint_U hKJ hgJ hgK + have htK : Disjoint t (frontier E₀) := by + rw [hfrE] + refine disjoint_left.mpr fun z hz hzK => ?_ + have hzU : z ∈ J.U := hKJ.U_subset hzK + exact disjoint_left.mp hdisj (r.mem_edge hgJ ht hgt hz hzU) hzK + rcases subset_or_disjoint_of_frontier hClosed (region_isPreconnected ht) htK with h₃ | h₃ + · obtain ⟨q, hq⟩ := hg.1 + have hqi : q ∈ interior E₀ := by + by_contra hn + exact disjoint_left.mp hdisj hq (hfrE ▸ ⟨subset_closure (h₃ (hgt hq)), hn⟩) + exact hgA (hinA hgJ hq hqi) + · obtain ⟨z, hz, hz'⟩ := hm + exact absurd (interior_subset hz') (disjoint_left.mp h₃ hz) + exact ⟨hbdry, htile⟩ + +/-- A radial boundary arc avoids the interior of a disc covered by the selected tiles. -/ +theorem radial_boundary_disjoint_interior (hS : IsClosedSurface S) {Γ' : Drawing S} + {E₀ F : Set S} {A' : Set (Set S)} (hFN : F ⊆ (boundaryDrawing Γ' (tiles Γ' A')).U) + (htile : ∀ t ∈ Γ'.R, (t ∩ interior E₀).Nonempty → t ∈ tiles Γ' A') : + Disjoint F (interior E₀) := by + refine disjoint_left.mpr fun z hz hzi => ?_ + have hzN := hFN hz + obtain ⟨t, ht, hzt⟩ : ∃ t ∈ Γ'.R \ tiles Γ' A', z ∈ closure t := by + rw [Drawing.U_eq] at hzN + rcases hzN with h₃ | h₃ + · obtain ⟨-, t, ht, -, -, hzt⟩ := (mem_boundaryDrawing_V hS).mp h₃ + exact ⟨t, ht, hzt⟩ + · obtain ⟨g, hg, hzg⟩ := mem_iUnion₂.mp h₃ + obtain ⟨-, t, ht, hinc⟩ := mem_boundaryDrawing_E.mp hg + exact ⟨t, ht, closure_minimal (edge_subset_closure_of_incident hS hinc.1 hinc.2.1 hinc.2.2) + isClosed_closure hzg⟩ + obtain ⟨q, hqi, hqt⟩ := mem_closure_iff.mp hzt _ isOpen_interior hzi + exact ht.2 (htile t ht.1 ⟨q, hqt, hqi⟩) + +/-- Two paths of dials with an edge in only one of them cannot both exist. -/ +theorem no_two_paths [ConnectedSpace S] (f : Frame H J Δ a) (r : Rad J Γ') (hS : IsClosedSurface S) + (hsph : IsSphere S) {F' D' : Set S} (h₁ : Holder H Δ F D x y) (h₂ : Holder H Δ F' D' x y) + {e e' : Set S} (he : e ∈ (H.interSet D).E) (he' : e' ∈ (H.interSet D').E) + (hne : e' ∉ (H.interSet D).E) : False := by + classical + set P := H.interSet D + set P' := H.interSet D' + have hPs : P.IsSubdrawing H := Drawing.span_isSubdrawing H _ _ + have hPs' : P'.IsSubdrawing H := Drawing.span_isSubdrawing H _ _ + have hxy := h₁.ne + obtain ⟨-, -, hK⟩ := h₁.paths_form_circuit hS h₂ he' hne + let K := H.sup P P' + have hKU : K.U = P.U ∪ P'.U := sup_U hPs hPs' + have hKE : K.E = P.E ∪ P'.E := Drawing.sup_E hPs hPs' + have hKs : K.IsSubdrawing H := Drawing.sup_isSubdrawing _ _ _ + have hPΔ : P.U ⊆ Δ := hPs.U_subset.trans f.Usub + have hPΔ' : P'.U ⊆ Δ := hPs'.U_subset.trans f.Usub + have hKΔ : K.U ⊆ Δ := hKU ▸ union_subset hPΔ hPΔ' + have hKarc : IsOArc K.U := IsCircuit.isOArc_U hK + obtain ⟨E₀, hE₀, hbE, hdE⟩ := exists_disc_missing hS hsph hKarc f.outer + (disjoint_left.mpr fun z hz hzK => hz (hKΔ hzK)) + have hE₀Δ : E₀ ⊆ Δ := fun z hz => by + by_contra hn + exact disjoint_left.mp hdE hz hn + have hfrE : frontier E₀ = K.U := (IsClosedDisc.frontier_eq_discBd hS hE₀).trans hbE + have hKE₀ : K.U ⊆ E₀ := hbE ▸ Surface.discBd_subset E₀ + have hKJ : K.IsSubdrawing J := ⟨hKs.1.trans f.Vsub, hKs.2.trans f.Esub⟩ + let A' : Set (Set S) := {g | g ∈ H.E ∧ g ⊆ E₀} + have hKA' : K.E ⊆ A' := fun g hg => ⟨hKs.2 hg, (K.closure_subset_U hg).trans hKE₀ |>.trans' + subset_closure⟩ + -- An edge of `J` with a point inside `E₀` is in `A'`. + have hinA : ∀ {g q}, g ∈ J.E → q ∈ g → q ∈ interior E₀ → g ∈ A' := by + intro g q hg hq hqi + by_cases hgK : g ∈ K.E + · exact hKA' hgK + · have hgH := f.mem_E_of_interior hE₀Δ hg hq hqi + refine ⟨hgH, ?_⟩ + have hdisj : Disjoint g K.U := edge_disjoint_U hKJ hg hgK + rcases subset_or_disjoint_of_frontier hE₀.isClosed hg.2.2.1.isConnected.isPreconnected + (by rwa [hfrE]) with h₃ | h₃ + · exact h₃ + · exact absurd (interior_subset hqi) (disjoint_left.mp h₃ hq) + have hBoundaryEdges : ∀ {v g}, v ∈ J.V → v ∈ K.U → v ≠ x → v ≠ y → + g ∈ J.E → J.toGraph.Inc g v → g ∈ K.E := by + intro v g' hvJ hvK hvx hvy hg'J hg'i + rw [hKU] at hvK + rcases hvK with hv | hv + · have hvP : v ∈ P.V := by + rw [(h₁.VU hS).1] + rw [(h₁.VU hS).2] at hv + exact ⟨f.U_inter_V hv.1 hvJ, hv.2⟩ + exact hKE ▸ Or.inl ((h₁.inner_edges f hS hvP hvx hvy).2 g' hg'J hg'i) + · have hvP : v ∈ P'.V := by + rw [(h₂.VU hS).1] + rw [(h₂.VU hS).2] at hv + exact ⟨f.U_inter_V hv.1 hvJ, hv.2⟩ + exact hKE ▸ Or.inr ((h₂.inner_edges f hS hvP hvx hvy).2 g' hg'J hg'i) + obtain ⟨hbdry, htile⟩ := enclosed_edges_boundary_and_tiles (A' := A') r hE₀.isClosed hfrE hKJ + (fun _ h => h.2) hKA' hinA hBoundaryEdges + have hbfin : (Whitney.bdry J.toGraph A').Finite := (toFinite ({x, y} : Set S)).subset hbdry + have hbc : (Whitney.bdry J.toGraph A').ncard ≤ 2 := + (ncard_le_ncard hbdry (toFinite _)).trans (ncard_pair hxy).le + have hA'H : A' ⊆ H.E := fun _ hg => hg.1 + have heA' : e ∈ A' := hKA' (hKE ▸ Or.inl he) + obtain ⟨F₁, D₁, x₁, y₁, hF₁, hF₁N, hD₁Δ, hD₁, hbD₁, heD₁, hxy₁, hcap₁, hpath₁, hn₁, -⟩ := + exists_dial_of_edge f r hS hsph hA'H hbc hbfin heA' + have hF₁int := radial_boundary_disjoint_interior hS hF₁N htile + have hfrD₁ : frontier D₁ = F₁ := (IsClosedDisc.frontier_eq_discBd hS hD₁).trans hbD₁ + have hInt : E₀ \ frontier E₀ ⊆ interior E₀ := fun z hz => by + by_contra hn + exact hz.2 ⟨subset_closure hz.1, hn⟩ + obtain ⟨p, hp⟩ := (hPs.2 he).1 + have hpF₁ : p ∉ F₁ := fun h' => by + have hh : p ∈ H.U := H.closure_subset_U (hPs.2 he) (subset_closure hp) + exact edge_notMem_V (hPs.2 he) hp (hn₁ ⟨h', hh⟩) + have hpi : p ∈ interior D₁ := by + by_contra hn + exact hpF₁ (hfrD₁ ▸ ⟨subset_closure (heD₁ hp), hn⟩) + have hpE₀ : p ∈ E₀ := hKE₀ (hKU ▸ Or.inl (P.closure_subset_U he (subset_closure hp))) + have hsubInt : E₀ \ frontier E₀ ⊆ D₁ := by + rcases subset_or_disjoint_of_frontier hD₁.isClosed + (IsClosedDisc.isPreconnected_diff_frontier hS hE₀) + (by + rw [hfrD₁] + exact disjoint_left.mpr fun z hz hzF => disjoint_left.mp hF₁int hzF (hInt hz)) with h₃ | h₃ + · exact h₃ + · exfalso + obtain ⟨q, hqi, hqm⟩ := mem_closure_iff.mp + (IsClosedDisc.subset_closure_diff_frontier hS hE₀ hpE₀) _ isOpen_interior hpi + exact disjoint_left.mp h₃ hqm (interior_subset hqi) + have hE₀D₁ : E₀ ⊆ D₁ := (IsClosedDisc.subset_closure_diff_frontier hS hE₀).trans + (closure_minimal hsubInt hD₁.isClosed) + have hh₁ : Holder H Δ F₁ D₁ x₁ y₁ := ⟨hD₁, hD₁Δ, hbD₁, hxy₁, hcap₁, hpath₁, hn₁⟩ + have hline₁ := isLine_of_isPathBetween hpath₁ hxy₁ + refine not_oArc_subset_line hKarc hline₁ fun z hz => ?_ + rw [(hh₁.VU hS).2] + exact ⟨hKs.U_subset hz, hE₀D₁ (hKE₀ hz)⟩ + +/-- **A small set of edges of `H` is a path, in a disc in `Δ`.** -/ +theorem exists_thread_disc [ConnectedSpace S] (f : Frame H J Δ a) (r : Rad J Γ') + (hS : IsClosedSurface S) + (hsph : IsSphere S) {A : Set (Set S)} (hA : A ⊆ H.E) (hb : (Whitney.bdry J.toGraph A).ncard ≤ 2) + (hfin : (Whitney.bdry J.toGraph A).Finite) (hne : A.Nonempty) : + ∃ (x y : S) (P : Drawing S) (D : Set S), x ≠ y ∧ Whitney.bdry J.toGraph A = {x, y} + ∧ P.IsSubdrawing H ∧ + P.IsPathBetween x y ∧ P.E = A ∧ + (∀ v ∈ P.V, v ≠ x → v ≠ y → v ∉ subBd Δ ∧ ∀ g ∈ J.E, J.toGraph.Inc g v → g ∈ P.E) ∧ + Holder H Δ (discBd D) D x y ∧ P = H.interSet D := by + classical + obtain ⟨e₀, he₀⟩ := hne + have key : ∀ e ∈ A, ∃ F D x y, Holder H Δ F D x y ∧ e ∈ (H.interSet D).E ∧ + Whitney.bdry J.toGraph A = {x, y} := by + intro e he + obtain ⟨F, D, x, y, hF, -, hDΔ, hD, hbd, heD, hxy, hcap, hpath, hn, hsub⟩ := + exists_dial_of_edge f r hS hsph hA hb hfin he + refine ⟨F, D, x, y, ⟨hD, hDΔ, hbd, hxy, hcap, hpath, hn⟩, mem_interSet_E.mpr ⟨hA he, heD⟩, ?_⟩ + have h₁ : ({x, y} : Set S) ⊆ Whitney.bdry J.toGraph A := hcap ▸ hsub + exact (eq_of_subset_of_ncard_le h₁ (by rw [ncard_pair hxy]; exact hb) hfin).symm + obtain ⟨F, D, x, y, h₁, he₀P, hbd⟩ := key e₀ he₀ + have h₀ : Holder H Δ (discBd D) D x y := + ⟨h₁.disc, h₁.sub, rfl, h₁.ne, by rw [h₁.bd]; exact h₁.cap, h₁.path, by rw [h₁.bd]; exact + h₁.norm⟩ + refine ⟨x, y, H.interSet D, D, h₁.ne, hbd, Drawing.span_isSubdrawing H _ _, h₁.path, + subset_antisymm ?_ ?_, fun v hv h₃ h₄ => h₁.inner_edges f hS hv h₃ h₄, h₀, rfl⟩ + · obtain ⟨W, hs, hV, hE⟩ := h₁.path + intro g hg + have hPs : (H.interSet D).IsSubdrawing H := Drawing.span_isSubdrawing H _ _ + have hg' : g ∈ W.edges := by + rw [hE] at hg + exact hg + have he₀' : e₀ ∈ W.edges := by + rw [hE] at he₀P + exact he₀P + refine walk_same_side (J := J) (hPs.1.trans f.Vsub) (hPs.2.trans f.Esub) W hs + (fun v _ h₃ h₄ hvb => ?_) e₀ he₀' g hg' he₀ + rw [hbd] at hvb + rcases hvb with h₅ | h₅ + · exact h₃ h₅ + · exact h₄ h₅ + · intro e he + by_contra hn + obtain ⟨F', D', x', y', h₂, heP, hbd'⟩ := key e he + have hset : ({x, y} : Set S) = {x', y'} := hbd.symm.trans hbd' + have hx' : x ∈ ({x', y'} : Set S) := hset ▸ Or.inl rfl + rcases hx' with rfl | hx' + · have hy' : y' = y := by + have : y' ∈ ({x, y} : Set S) := hset ▸ Or.inr rfl + rcases this with h₃ | h₃ + · exact absurd h₃.symm h₂.ne + · exact h₃ + subst hy' + exact no_two_paths f r hS hsph h₁ h₂ he₀P heP hn + · obtain rfl : x = y' := hx' + have hy' : x' = y := by + have : x' ∈ ({x, y} : Set S) := hset ▸ Or.inl rfl + rcases this with h₃ | h₃ + · exact absurd h₃ h₂.ne + · exact h₃ + subst hy' + have h₂' : Holder H Δ F' D' x x' := ⟨h₂.disc, h₂.sub, h₂.bd, h₁.ne, by + rw [pair_comm]; exact h₂.cap, isPathBetween_symm h₂.path, h₂.norm⟩ + exact no_two_paths f r hS hsph h₁ h₂' he₀P heP hn + +/-- **A small set of edges of `H` is a path.** -/ +theorem exists_thread [ConnectedSpace S] (f : Frame H J Δ a) (r : Rad J Γ') (hS : IsClosedSurface S) + (hsph : IsSphere S) {A : Set (Set S)} (hA : A ⊆ H.E) (hb : (Whitney.bdry J.toGraph A).ncard ≤ 2) + (hfin : (Whitney.bdry J.toGraph A).Finite) (hne : A.Nonempty) : + ∃ (x y : S) (P : Drawing S), x ≠ y ∧ Whitney.bdry J.toGraph A = {x, y} ∧ P.IsSubdrawing H + ∧ P.IsPathBetween x y ∧ + P.E = A ∧ ∀ v ∈ P.V, v ≠ x → v ≠ y → + v ∉ subBd Δ ∧ ∀ g ∈ J.E, J.toGraph.Inc g v → g ∈ P.E := by + obtain ⟨x, y, P, -, h₁, h₂, h₃, h₄, h₅, h₆, -⟩ := exists_thread_disc f r hS hsph hA hb hfin hne + exact ⟨x, y, P, h₁, h₂, h₃, h₄, h₅, h₆⟩ + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM14/RigidWheel.lean b/LeanPool/GraphMinor/GM14/RigidWheel.lean new file mode 100644 index 0000000000..089d1471d6 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/RigidWheel.lean @@ -0,0 +1,717 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.RigidGood +import LeanPool.GraphMinor.GM11.ArcDrawings +import LeanPool.GraphMinor.GM11.SplitEdge +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.GM11.RadialExists +import LeanPool.GraphMinor.GM11.OArcCircuit +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.Surface.Lunes +import LeanPool.GraphMinor.Surface.InvarianceOfDomain + +/-! +# The wheel around a closed disc + +`exists_wheel` builds the wheel of `RigidGood` in a closed disc `D₂`. Its rim is the boundary of +`D₂`, +with the given finite set `B` among its vertices. We put a new vertex in each edge of the rim, so no +rim edge joins two vertices of `B`. The hub is the centre of `D₂`, and a spoke goes to each rim +vertex. +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Topology Graph Metric GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- A line in `ℂ` has a line as its image under a map that is continuous and injective on it. -/ +theorem line_image {Z : Set ℂ} {a b : ℂ} (hl : IsLineWithEnds Z a b) {g : ℂ → S} + (hc : ContinuousOn g Z) (hi : InjOn g Z) : IsLineWithEnds (g '' Z) (g a) (g b) := + hl.image_under_injOn hc hi + +omit [T2Space S] in +theorem line_start {L : Set S} {u v : S} (h : IsLineWithEnds L u v) : u ∈ L := by + obtain ⟨f, h0, -⟩ := h + exact h0 ▸ (f 0).2 + +omit [T2Space S] in +theorem line_end {L : Set S} {u v : S} (h : IsLineWithEnds L u v) : v ∈ L := by + obtain ⟨f, -, h1⟩ := h + exact h1 ▸ (f 1).2 + +omit [T2Space S] in +theorem line_preconn {L : Set S} {u v : S} (h : IsLineWithEnds L u v) : IsPreconnected L := + GraphMinor.Surface.IsLineWithEnds.isPreconnected h + +omit [T2Space S] in +/-- An O-arc is preconnected. -/ +theorem isPreconnected_of_oArc {F : Set S} (hF : IsOArc F) : IsPreconnected F := + GraphMinor.Surface.IsOArc.isPreconnected hF + +/-- Lines from `a` that meet only in `a` form a drawing. -/ +theorem exists_star {a : S} {L : S → Set S} {R : Set S} (hR : R.Finite) : + (∀ z ∈ R, z ≠ a ∧ IsLineWithEnds (L z) a z) → (∀ z ∈ R, ∀ z' ∈ R, z ≠ z' → L z ∩ L z' ⊆ {a}) → + ∃ St : Drawing S, St.U = insert a (⋃ z ∈ R, L z) ∧ St.V = insert a R ∧ + St.E = (fun z => L z \ {a, z}) '' R := by + induction R, hR using Set.Finite.induction_on with + | empty => + intro _ _ + refine ⟨pointsDrawing (finite_singleton a), by simp [pointsDrawing], by simp [pointsDrawing], + ?_⟩ + rw [pointsDrawing_E] + simp + | @insert z R hz hfin ih => + intro h₁ h₂ + obtain ⟨St, hU, hV, hE⟩ := ih (fun w hw => h₁ w (mem_insert_of_mem _ hw)) + (fun w hw w' hw' hne => h₂ w (mem_insert_of_mem _ hw) w' (mem_insert_of_mem _ hw') hne) + obtain ⟨hne, hl⟩ := h₁ z (mem_insert _ _) + have hc : St.U ∩ (lineDrawing hl hne.symm).U ⊆ St.V ∩ (lineDrawing hl hne.symm).V := by + rintro p ⟨hp, hpL⟩ + have hpL' : p ∈ L z := hpL + have hpa : p = a := by + rw [hU] at hp + rcases hp with hp | hp + · exact hp + · obtain ⟨w, hw, hpw⟩ := mem_iUnion₂.mp hp + have hne' : w ≠ z := fun h' => hz (h' ▸ hw) + exact h₂ w (mem_insert_of_mem _ hw) z (mem_insert _ _) hne' ⟨hpw, hpL'⟩ + subst hpa + exact ⟨hV ▸ mem_insert _ _, Or.inl rfl⟩ + refine ⟨St.glue (lineDrawing hl hne.symm) hc, ?_, ?_, ?_⟩ + · change St.U ∪ L z = _ + rw [hU] + ext p + simp only [mem_union, mem_insert_iff, mem_iUnion, exists_prop] + constructor + · rintro ((h' | ⟨w, hw, hp⟩) | h') + · exact Or.inl h' + · exact Or.inr ⟨w, Or.inr hw, hp⟩ + · exact Or.inr ⟨z, Or.inl rfl, h'⟩ + · rintro (h' | ⟨w, rfl | hw, hp⟩) + · exact Or.inl (Or.inl h') + · exact Or.inr hp + · exact Or.inl (Or.inr ⟨w, hw, hp⟩) + · change St.V ∪ {a, z} = _ + rw [hV] + ext p + simp only [mem_union, mem_insert_iff, mem_singleton_iff] + tauto + · rw [Drawing.glue_E, hE, lineDrawing_E, image_insert_eq, union_comm, singleton_union] + +/-- Spokes in a closed disc. -/ +theorem exists_spokes {D : Set S} (hD : IsClosedDisc D) {R : Set S} (hR : R ⊆ discBd D) : + ∃ (a : S) (L : S → Set S), a ∈ D ∧ a ∉ discBd D ∧ + (∀ z ∈ R, z ≠ a ∧ IsLineWithEnds (L z) a z ∧ L z ⊆ D ∧ L z ∩ discBd D = {z}) ∧ + ∀ z ∈ R, ∀ z' ∈ R, z ≠ z' → L z ∩ L z' ⊆ {a} := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hsph : ∀ {z}, z ∈ discBd D → h z ∈ sphere (0 : ℂ) 1 := fun hz => c.bd ▸ mem_image_of_mem h hz + have hzD : ∀ {z}, z ∈ discBd D → z ∈ D := fun hz => Surface.discBd_subset D hz + have hgh : ∀ {z}, z ∈ discBd D → g (h z) = z := fun hz => c.gh (hzD hz) + have h0 : (0 : ℂ) ∈ closedBall (0 : ℂ) 1 := by simp + have hseg : ∀ {w : ℂ}, w ∈ sphere (0 : ℂ) 1 → segment ℝ 0 w ⊆ closedBall (0 : ℂ) 1 := fun hw => + (convex_closedBall _ _).segment_subset h0 (sphere_subset_closedBall hw) + have hne0 : ∀ {w : ℂ}, w ∈ sphere (0 : ℂ) 1 → (0 : ℂ) ≠ w := fun hw h' => by + rw [← h'] at hw + simp at hw + have hnorm : ∀ {w p : ℂ}, w ∈ sphere (0 : ℂ) 1 → p ∈ segment ℝ 0 w → + ∃ t : ℝ, 0 ≤ t ∧ p = (t : ℂ) * w ∧ ‖p‖ = t := by + rintro w p hw ⟨c₁, t, -, ht, -, rfl⟩ + have hw1 : ‖w‖ = 1 := by simpa using hw + refine ⟨t, ht, by simp, ?_⟩ + simp [hw1, abs_of_nonneg ht] + refine ⟨g 0, fun z => g '' segment ℝ 0 (h z), c.gm h0, ?_, ?_, ?_⟩ + · intro h' + have h₁ := hsph h' + rw [c.hg h0] at h₁ + simp at h₁ + · intro z hz + have hzb := hR hz + have hw := hsph hzb + refine ⟨?_, ?_, ?_, ?_⟩ + · intro h' + have h₁ := hsph hzb + rw [h', c.hg h0] at h₁ + simp at h₁ + · have := line_image (isLineWithEnds_segment (hne0 hw)) (c.gc.mono (hseg hw)) + (c.hg.injOn.mono (hseg hw)) + rwa [hgh hzb] at this + · exact image_subset_iff.mpr fun p hp => c.gm (hseg hw hp) + · ext x + constructor + · rintro ⟨⟨p, hp, rfl⟩, hxb⟩ + have h₁ := hsph hxb + rw [c.hg (hseg hw hp)] at h₁ + obtain ⟨t, -, hpt, hn⟩ := hnorm hw hp + have ht : t = 1 := by + rw [← hn] + simpa using h₁ + rw [hpt, ht] + simp [hgh hzb] + · rintro rfl + refine ⟨⟨h x, right_mem_segment ℝ _ _, hgh hzb⟩, hzb⟩ + · rintro z hz z' hz' hne x ⟨⟨p, hp, rfl⟩, ⟨p', hp', heq⟩⟩ + have hw := hsph (hR hz) + have hw' := hsph (hR hz') + have hpp : p' = p := by + have := congrArg h heq + rwa [c.hg (hseg hw' hp'), c.hg (hseg hw hp)] at this + subst hpp + obtain ⟨t, -, hpt, hn⟩ := hnorm hw hp + obtain ⟨t', -, hpt', hn'⟩ := hnorm hw' hp' + have htt : t = t' := hn.symm.trans hn' + subst htt + by_cases h0t : t = 0 + · rw [hpt, h0t] + simp + · exfalso + have heqw : h z = h z' := by + have h₁ : (t : ℂ) ≠ 0 := by exact_mod_cast h0t + exact mul_left_cancel₀ h₁ (hpt.symm.trans hpt') + apply hne + rw [← hgh (hR hz), ← hgh (hR hz'), heqw] + +/-- One round of splitting edges. -/ +theorem exists_split_step [Nonempty S] (D : Drawing S) : + ∃ (D' : Drawing S) (T : Set S), D'.U = D.U ∧ D.V ⊆ D'.V ∧ + (∀ g u, ¬ D'.toGraph.IsLink g u u) ∧ + (∀ g u v, D'.toGraph.IsLink g u v → u ∈ D.V → v ∉ D.V) ∧ + ((∀ g u, ¬ D.toGraph.IsLink g u u) → + ∀ g g' u v, D'.toGraph.IsLink g u v → D'.toGraph.IsLink g' u v → g = g') ∧ + 2 * D.E.ncard ≤ D'.E.ncard ∧ T.ncard = D.E.ncard ∧ T ⊆ D'.V ∧ + ∀ t ∈ T, ∃ g g', g ≠ g' ∧ D'.toGraph.Inc g t ∧ D'.toGraph.Inc g' t := by + classical + obtain ⟨D', A, B, m, x, y, hU, hV, hf, hall⟩ := exists_split D + have hmV : ∀ e ∈ D.E, m e ∉ D.V := fun e he => edge_notMem_V he (hf e he).2.2.1 + have hsubV : D.V ⊆ D'.V := hV ▸ subset_union_left + have hmV' : ∀ e ∈ D.E, m e ∈ D'.V := fun e he => hV ▸ Or.inr (mem_image_of_mem m he) + have hAe : ∀ e ∈ D.E, A e ⊆ e := fun e he z hz => by + rw [(hf e he).2.2.2.2.2.2.1] + exact Or.inl (Or.inl hz) + have hBe : ∀ e ∈ D.E, B e ⊆ e := fun e he z hz => by + rw [(hf e he).2.2.2.2.2.2.1] + exact Or.inr hz + have hshape : ∀ g ∈ D'.E, ∃ e ∈ D.E, ∃ p ∈ D.V, closure g ∩ D'.V = {p, m e} ∧ + ((g = A e ∧ p = x e) ∨ (g = B e ∧ p = y e)) := by + intro g hg + obtain ⟨e, he, rfl | rfl⟩ := hall g hg + · have := hf e he + exact ⟨e, he, x e, this.2.2.2.2.2.2.2.1, this.2.2.2.2.2.2.2.2.2.2.1, Or.inl ⟨rfl, rfl⟩⟩ + · have := hf e he + refine ⟨e, he, y e, this.2.2.2.2.2.2.2.2.1, ?_, Or.inr ⟨rfl, rfl⟩⟩ + rw [this.2.2.2.2.2.2.2.2.2.2.2, pair_comm] + have hminj : ∀ e ∈ D.E, ∀ e' ∈ D.E, m e = m e' → e = e' := fun e he e' he' h => + D.edge_eq_of_mem he he' (hf e he).2.2.1 (h ▸ (hf e' he').2.2.1) + have hAinj : InjOn A D.E := fun e he e' he' h => by + obtain ⟨z, hz⟩ := (hf e he).1.1 + exact D.edge_eq_of_mem he he' (hAe e he hz) (hAe e' he' (h ▸ hz)) + have hBinj : InjOn B D.E := fun e he e' he' h => by + obtain ⟨z, hz⟩ := (hf e he).2.1.1 + exact D.edge_eq_of_mem he he' (hBe e he hz) (hBe e' he' (h ▸ hz)) + have hABne : ∀ e ∈ D.E, A e ≠ B e := fun e he h => by + obtain ⟨z, hz⟩ := (hf e he).1.1 + exact disjoint_left.mp (hf e he).2.2.2.2.2.1 hz (h ▸ hz) + have hAB : Disjoint (A '' D.E) (B '' D.E) := by + refine disjoint_left.mpr ?_ + rintro _ ⟨e, he, rfl⟩ ⟨e', he', h⟩ + obtain ⟨z, hz⟩ := (hf e he).1.1 + have heq : e = e' := D.edge_eq_of_mem he he' (hAe e he hz) (hBe e' he' (h ▸ hz)) + subst heq + exact hABne e he h.symm + refine ⟨D', m '' D.E, hU, hsubV, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro g u hl + obtain ⟨e, he, p, hp, heq, -⟩ := hshape g hl.1 + have hc := hl.2.2.2 + rw [heq] at hc + have h₁ : p ∈ ({u, u} : Set S) := hc ▸ Or.inl rfl + have h₂ : m e ∈ ({u, u} : Set S) := hc ▸ Or.inr rfl + simp only [pair_eq_singleton, mem_singleton_iff] at h₁ h₂ + exact hmV e he (h₂.trans h₁.symm ▸ hp) + · intro g u v hl hu + obtain ⟨e, he, p, hp, heq, -⟩ := hshape g hl.1 + have hc := hl.2.2.2 + rw [heq] at hc + have h₂ : m e ∈ ({u, v} : Set S) := hc ▸ Or.inr rfl + rcases h₂ with h₂ | h₂ + · exact absurd (h₂ ▸ hu) (hmV e he) + · exact h₂ ▸ hmV e he + · intro hnl g g' u v hl hl' + obtain ⟨e, he, p, hp, heq, hc₁⟩ := hshape g hl.1 + obtain ⟨e', he', p', hp', heq', hc₂⟩ := hshape g' hl'.1 + have hc : ({p, m e} : Set S) = {p', m e'} := by + rw [← heq, ← heq', hl.2.2.2, hl'.2.2.2] + have hme : m e = m e' := by + have : m e ∈ ({p', m e'} : Set S) := hc ▸ Or.inr rfl + rcases this with h₁ | h₁ + · exact absurd (h₁ ▸ hp') (hmV e he) + · exact h₁ + have hee : e = e' := hminj e he e' he' hme + subst hee + have hpp : p = p' := by + have : p ∈ ({p', m e} : Set S) := hc ▸ Or.inl rfl + rcases this with h₁ | h₁ + · exact h₁ + · exact absurd (h₁ ▸ hp) (hmV e he) + have hno : x e ≠ y e := by + intro hxy + have h₁ := hf e he + refine hnl e (x e) ⟨he, h₁.2.2.2.2.2.2.2.1, h₁.2.2.2.2.2.2.2.1, ?_⟩ + rw [h₁.2.2.2.2.2.2.2.2.2.1, ← hxy] + rcases hc₁ with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> rcases hc₂ with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · exact absurd hpp hno + · exact absurd hpp.symm hno + · rfl + · have h₁ : (A '' D.E ∪ B '' D.E).ncard = D.E.ncard + D.E.ncard := by + rw [ncard_union_eq hAB (D.finite_edges.image _) (D.finite_edges.image _), + hAinj.ncard_image, hBinj.ncard_image] + have h₂ : A '' D.E ∪ B '' D.E ⊆ D'.E := by + rintro _ (⟨e, he, rfl⟩ | ⟨e, he, rfl⟩) + · exact (hf e he).1 + · exact (hf e he).2.1 + have := ncard_le_ncard h₂ D'.finite_edges + omega + · exact InjOn.ncard_image fun e he e' he' h => hminj e he e' he' h + · exact hV ▸ subset_union_right + · rintro _ ⟨e, he, rfl⟩ + have h₁ := hf e he + refine ⟨A e, B e, hABne e he, ⟨x e, h₁.1, hmV' e he, hsubV h₁.2.2.2.2.2.2.2.1, ?_⟩, + ⟨y e, h₁.2.1, hmV' e he, hsubV h₁.2.2.2.2.2.2.2.2.1, h₁.2.2.2.2.2.2.2.2.2.2.2⟩⟩ + rw [h₁.2.2.2.2.2.2.2.2.2.2.1, pair_comm] + +/-- Three rounds of splitting. The rim has no loops and no parallel edges, no edge joins two old +vertices, and at least four vertices meet two edges. -/ +theorem exists_rim (D : Drawing S) (hne : D.E.Nonempty) : + ∃ (Rim : Drawing S) (T : Set S), Rim.U = D.U ∧ D.V ⊆ Rim.V ∧ + (∀ g u, ¬ Rim.toGraph.IsLink g u u) ∧ + (∀ g u v, Rim.toGraph.IsLink g u v → u ∈ D.V → v ∉ D.V) ∧ + (∀ g g' u v, Rim.toGraph.IsLink g u v → Rim.toGraph.IsLink g' u v → g = g') ∧ + 4 ≤ T.ncard ∧ T ⊆ Rim.V ∧ + ∀ t ∈ T, ∃ g g', g ≠ g' ∧ Rim.toGraph.Inc g t ∧ Rim.toGraph.Inc g' t := by + obtain ⟨e, he⟩ := hne + obtain ⟨z, -⟩ := he.1 + have : Nonempty S := ⟨z⟩ + obtain ⟨D₁, -, hU₁, hV₁, -, -, -, hc₁, -⟩ := exists_split_step D + obtain ⟨D₂, -, hU₂, hV₂, hl₂, -, -, hc₂, -⟩ := exists_split_step D₁ + obtain ⟨D₃, T, hU₃, hV₃, hl₃, hn₃, hs₃, -, hT, hTV, hT2⟩ := exists_split_step D₂ + have hc₀ : 1 ≤ D.E.ncard := Nat.one_le_iff_ne_zero.mpr + ((ncard_ne_zero_of_mem he D.finite_edges)) + refine ⟨D₃, T, by rw [hU₃, hU₂, hU₁], hV₁.trans (hV₂.trans hV₃), hl₃, ?_, hs₃ hl₂, by omega, + hTV, hT2⟩ + exact fun g u v hl hu hv => hn₃ g u v hl (hV₂ (hV₁ hu)) (hV₂ (hV₁ hv)) + +section Glue + +variable {Γ₁ Γ₂ : Drawing S} + +omit [T2Space S] in +theorem cap_glue_left (h : Γ₁.U ∩ Γ₂.U ⊆ Γ₁.V ∩ Γ₂.V) {e : Set S} (he : e ∈ Γ₁.E) : + closure e ∩ (Γ₁.V ∪ Γ₂.V) = closure e ∩ Γ₁.V := by + refine subset_antisymm ?_ fun z hz => ⟨hz.1, Or.inl hz.2⟩ + rintro z ⟨hz, h₁ | h₁⟩ + · exact ⟨hz, h₁⟩ + · exact ⟨hz, (h ⟨Γ₁.closure_subset_U he hz, Γ₂.V_subset_U h₁⟩).1⟩ + +omit [T2Space S] in +theorem cap_glue_right (h : Γ₁.U ∩ Γ₂.U ⊆ Γ₁.V ∩ Γ₂.V) {e : Set S} (he : e ∈ Γ₂.E) : + closure e ∩ (Γ₁.V ∪ Γ₂.V) = closure e ∩ Γ₂.V := by + refine subset_antisymm ?_ fun z hz => ⟨hz.1, Or.inr hz.2⟩ + rintro z ⟨hz, h₁ | h₁⟩ + · exact ⟨hz, (h ⟨Γ₁.V_subset_U h₁, Γ₂.closure_subset_U he hz⟩).2⟩ + · exact ⟨hz, h₁⟩ + +omit [T2Space S] in +/-- The links of a union of two drawings are those of the parts. -/ +theorem isUnion_glue (h : Γ₁.U ∩ Γ₂.U ⊆ Γ₁.V ∩ Γ₂.V) : IsUnion Γ₁ Γ₂ (Γ₁.glue Γ₂ h) := by + refine ⟨rfl, Drawing.glue_E h, fun e he u v => ?_, fun e he u v => ?_⟩ + · constructor + · rintro ⟨-, -, -, hc⟩ + have hc' : closure e ∩ Γ₁.V = {u, v} := (cap_glue_left h he).symm.trans hc + have hu : u ∈ closure e ∩ Γ₁.V := hc' ▸ Or.inl rfl + have hv : v ∈ closure e ∩ Γ₁.V := hc' ▸ Or.inr rfl + exact ⟨he, hu.2, hv.2, hc'⟩ + · rintro ⟨-, hu, hv, hc⟩ + exact ⟨(Drawing.glue_E h).symm ▸ Or.inl he, Or.inl hu, Or.inl hv, + (cap_glue_left h he).trans hc⟩ + · constructor + · rintro ⟨-, -, -, hc⟩ + have hc' : closure e ∩ Γ₂.V = {u, v} := (cap_glue_right h he).symm.trans hc + have hu : u ∈ closure e ∩ Γ₂.V := hc' ▸ Or.inl rfl + have hv : v ∈ closure e ∩ Γ₂.V := hc' ▸ Or.inr rfl + exact ⟨he, hu.2, hv.2, hc'⟩ + · rintro ⟨-, hu, hv, hc⟩ + exact ⟨(Drawing.glue_E h).symm ▸ Or.inr he, Or.inr hu, Or.inr hv, + (cap_glue_right h he).trans hc⟩ + +end Glue + +omit [T2Space S] in +/-- A preconnected set covered by two closed sets that it does not meet together lies in one. -/ +theorem preconn_side {P U₁ U₂ : Set S} (hP : IsPreconnected P) (h₁ : IsClosed U₁) (h₂ : IsClosed U₂) + (hc : P ⊆ U₁ ∪ U₂) (hd : ∀ z ∈ P, z ∈ U₁ → z ∈ U₂ → False) : P ⊆ U₁ ∨ P ⊆ U₂ := by + by_contra hn + push Not at hn + obtain ⟨hn₁, hn₂⟩ := hn + obtain ⟨x, hx, hx₁⟩ := not_subset.mp hn₁ + obtain ⟨y, hy, hy₂⟩ := not_subset.mp hn₂ + have hx₂ : x ∈ U₂ := (hc hx).resolve_left hx₁ + have hy₁ : y ∈ U₁ := (hc hy).resolve_right hy₂ + obtain ⟨z, hz, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp hP U₁ U₂ h₁ h₂ hc ⟨y, hy, hy₁⟩ ⟨x, hx, + hx₂⟩ + exact hd z hz hz₁ hz₂ + +private theorem spokes_meet_wheel_vertices_at_ends + {S : Type u} + [TopologicalSpace S] + {D₂ : Set S} + (Rim : Drawing S) + (hVC : Rim.V ⊆ discBd D₂) + (a : S) + (L : S → Set S) + (haD : a ∈ D₂) + (hab : a ∉ discBd D₂) + (hL : ∀ z ∈ Rim.V, z ≠ a ∧ IsLineWithEnds (L z) a z ∧ L z ⊆ D₂ ∧ L z ∩ discBd D₂ = {z}) + (hdis : ∀ z ∈ Rim.V, ∀ z' ∈ Rim.V, z ≠ z' → L z ∩ L z' ⊆ {a}) + (St : Drawing S) + (hSU : St.U = insert a (⋃ z ∈ Rim.V, L z)) + (hSV : St.V = insert a Rim.V) + (hSE : St.E = (fun z => L z \ {a, z}) '' Rim.V) + (W : Drawing S) + (hWU : W.U = discBd D₂ ∪ insert a (⋃ z ∈ Rim.V, L z)) + (hWV : W.V = insert a Rim.V) + (haW : a ∈ W.V) : + ∀ z ∈ Rim.V, L z ∩ W.V = {a, z} := by + intro z hz + obtain ⟨hne, hl, -, hm⟩ := hL z hz + apply subset_antisymm + · rintro p ⟨hp, hpV⟩ + rw [hWV] at hpV + rcases hpV with h₁ | h₁ + · exact Or.inl h₁ + · have h₂ : p ∈ L z ∩ discBd D₂ := ⟨hp, hVC h₁⟩ + rw [hm] at h₂ + exact Or.inr h₂ + · rintro p (rfl | rfl) + · exact ⟨line_start hl, haW⟩ + · exact ⟨line_end hl, hWV ▸ Or.inr hz⟩ + +private theorem star_edges_link_spoke_endpoints + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {D₂ : Set S} + (Rim : Drawing S) + (a : S) + (L : S → Set S) + (hL : ∀ z ∈ Rim.V, z ≠ a ∧ IsLineWithEnds (L z) a z ∧ L z ⊆ D₂ ∧ L z ∩ discBd D₂ = {z}) + (St : Drawing S) + (hSE : St.E = (fun z => L z \ {a, z}) '' Rim.V) + (W : Drawing S) + (hcap : ∀ z ∈ Rim.V, L z ∩ W.V = {a, z}) : + ∀ {g : Set S} {u v : S}, g ∈ St.E → W.toGraph.IsLink g u v → + ∃ z ∈ Rim.V, z ≠ a ∧ ({u, v} : Set S) = {a, z} := by + intro g u v hg hl + rw [hSE] at hg + obtain ⟨z, hz, rfl⟩ := hg + obtain ⟨hne, hl', -, -⟩ := hL z hz + refine ⟨z, hz, hne, ?_⟩ + have := hl.2.2.2 + rw [closure_sdiff_pair hl'] at this + rw [← this] + exact hcap z hz + +private theorem wheel_has_no_small_separation + {S : Type u} + [TopologicalSpace S] + {B : Set S} + {D₂ : Set S} + (hO : IsOArc (discBd D₂)) + (Rim : Drawing S) + (hVC : Rim.V ⊆ discBd D₂) + (a : S) + (L : S → Set S) + (haD : a ∈ D₂) + (hab : a ∉ discBd D₂) + (hL : ∀ z ∈ Rim.V, z ≠ a ∧ IsLineWithEnds (L z) a z ∧ L z ⊆ D₂ ∧ L z ∩ discBd D₂ = {z}) + (hdis : ∀ z ∈ Rim.V, ∀ z' ∈ Rim.V, z ≠ z' → L z ∩ L z' ⊆ {a}) + (St : Drawing S) + (hSU : St.U = insert a (⋃ z ∈ Rim.V, L z)) + (hSV : St.V = insert a Rim.V) + (hSE : St.E = (fun z => L z \ {a, z}) '' Rim.V) + (W : Drawing S) + (hWU : W.U = discBd D₂ ∪ insert a (⋃ z ∈ Rim.V, L z)) + (hWV : W.V = insert a Rim.V) + (haW : a ∈ W.V) + (hcap : ∀ z ∈ Rim.V, L z ∩ W.V = {a, z}) + (hspoke : ∀ {g : Set S} {u v : S}, g ∈ St.E → W.toGraph.IsLink g u v → ∃ z ∈ Rim.V, z ≠ a ∧ + ({u, v} : Set S) = {a, z}) + (hrimV : ∀ {g : Set S} {u v : S}, g ∈ Rim.E → W.toGraph.IsLink g u v → u ≠ a) + (hanB : a ∉ B) + (hpairs : ∀ {u v z : S}, ({u, v} : Set S) = {a, z} → u = a ∧ v = z ∨ u = z ∧ v = a) : + ∀ (U₁ U₂ X : Set S), IsClosed U₁ → IsClosed U₂ → W.U ⊆ U₁ ∪ U₂ → W.U ∩ U₁ ∩ U₂ ⊆ X → X ⊆ W.V → + X.ncard ≤ 2 → W.V \ X ⊆ U₁ ∨ W.V \ X ⊆ U₂ := by + intro U₁ U₂ X h₁ h₂ hcov hcap₂ hXV hXc + by_cases haX : a ∈ X + · let P := discBd D₂ \ (X \ {a}) + have hX' : (X \ {a}).ncard ≤ 1 := by + rw [ncard_sdiff_singleton_of_mem haX] + omega + have hP : IsPreconnected P := by + rcases eq_empty_or_nonempty (X \ {a}) with h₀ | ⟨q, hq⟩ + · change IsPreconnected (discBd D₂ \ (X \ {a})) + rw [h₀, sdiff_empty] + exact isPreconnected_of_oArc hO + · have hXf : (X \ {a}).Finite := W.finite_V.subset fun z hz => hXV hz.1 + have hs : X \ {a} = {q} := subset_antisymm + (fun z hz => (ncard_le_one hXf).mp hX' z hz q hq) (singleton_subset_iff.mpr hq) + change IsPreconnected (discBd D₂ \ (X \ {a})) + rw [hs] + by_cases hqO : q ∈ discBd D₂ + · exact (isPathConnected_oArc_diff hO hqO).isConnected.isPreconnected + · rw [sdiff_singleton_eq_self hqO] + exact isPreconnected_of_oArc hO + have hPU : P ⊆ W.U := fun z hz => hWU ▸ Or.inl hz.1 + have hside := preconn_side hP h₁ h₂ (hPU.trans hcov) (fun z hz hz₁ hz₂ => hz.2 + ⟨hcap₂ ⟨⟨hPU hz, hz₁⟩, hz₂⟩, fun h₃ => hab (h₃ ▸ hz.1)⟩) + have hVP : W.V \ X ⊆ P := by + rintro z ⟨hz, hzX⟩ + rw [hWV] at hz + rcases hz with hz | hz + · exact absurd (hz ▸ haX) hzX + · exact ⟨hVC hz, fun h₃ => hzX h₃.1⟩ + rcases hside with hs | hs + · exact Or.inl (hVP.trans hs) + · exact Or.inr (hVP.trans hs) + · have haU : a ∈ W.U := W.V_subset_U haW + have key : ∀ {K K' : Set S}, IsClosed K → IsClosed K' → W.U ⊆ K ∪ K' → + W.U ∩ K ∩ K' ⊆ X → a ∈ K → W.V \ X ⊆ K := by + intro K K' hK hK' hc' hd ha z hz + obtain ⟨hzV, hzX⟩ := hz + rw [hWV] at hzV + rcases hzV with rfl | hzV + · exact ha + · have hlU : L z ⊆ W.U := fun p hp => + hWU ▸ Or.inr (Or.inr (mem_iUnion₂.mpr ⟨z, hzV, hp⟩)) + have hdis₂ : ∀ p ∈ L z, p ∈ K → p ∈ K' → False := by + intro p hp hp₁ hp₂ + have hpX := hd ⟨⟨hlU hp, hp₁⟩, hp₂⟩ + have : p ∈ L z ∩ W.V := ⟨hp, hXV hpX⟩ + rw [hcap z hzV] at this + rcases this with h₃ | h₃ + · exact haX (h₃ ▸ hpX) + · exact hzX (h₃ ▸ hpX) + rcases preconn_side (line_preconn (hL z hzV).2.1) hK hK' (hlU.trans hc') hdis₂ + with h₃ | h₃ + · exact h₃ (line_end (hL z hzV).2.1) + · exact (hdis₂ a (line_start (hL z hzV).2.1) ha (h₃ (line_start (hL z hzV).2.1))).elim + rcases hcov haU with ha | ha + · exact Or.inl (key h₁ h₂ hcov hcap₂ ha) + · refine Or.inr (key h₂ h₁ (by rwa [union_comm]) ?_ ha) + rintro z ⟨⟨h₃, h₄⟩, h₅⟩ + exact hcap₂ ⟨⟨h₃, h₅⟩, h₄⟩ + +/-- **The wheel.** `D₁` is any preconnected set that holds the rim. -/ +theorem exists_wheel {B D₁ D₂ : Set S} (hD₂ : IsClosedDisc D₂) (hB : B.Finite) (hBb : B ⊆ discBd D₂) + (hD₁ : IsPreconnected D₁) (hsub : discBd D₂ ⊆ D₁) : + ∃ (W : Drawing S) (a : S), Wheel W B D₁ D₂ ∧ a ∈ W.V ∧ a ∈ D₂ ∧ a ∉ discBd D₂ ∧ + W.V ⊆ insert a (discBd D₂) ∧ ∀ z ∈ W.V, z ≠ a → ∃ g, W.toGraph.IsLink g a z := by + classical + have hO : IsOArc (discBd D₂) := hD₂.isOArc_discBd + obtain ⟨c, hc⟩ : (discBd D₂).Nonempty := (infinite_of_isOArc hO).nonempty + obtain ⟨D₀, hU₀, hV₀⟩ := exists_drawing_on_oArc hO (hB.insert c) (insert_nonempty _ _) + (insert_subset hc hBb) + have hE₀ : D₀.E.Nonempty := by + by_contra hn + have hemp : D₀.E = ∅ := not_nonempty_iff_eq_empty.mp hn + have hU := D₀.U_eq + rw [hemp] at hU + have : D₀.U = D₀.V := by simpa using hU + exact infinite_of_isOArc hO ((hU₀.symm.trans this) ▸ D₀.finite_V) + obtain ⟨Rim, T, hRU, hRV, hnl, hnob, hsimple, hT4, hTV, hT2⟩ := exists_rim D₀ hE₀ + have hBV : B ⊆ D₀.V := by + rw [hV₀] + exact subset_insert _ _ + have hVC : Rim.V ⊆ discBd D₂ := fun z hz => by + have := Rim.V_subset_U hz + rwa [hRU, hU₀] at this + obtain ⟨a, L, haD, hab, hL, hdis⟩ := exists_spokes hD₂ hVC + obtain ⟨St, hSU, hSV, hSE⟩ := exists_star (a := a) (L := L) Rim.finite_V + (fun z hz => ⟨(hL z hz).1, (hL z hz).2.1⟩) hdis + have hmeet : Rim.U ∩ St.U ⊆ Rim.V ∩ St.V := by + rintro z ⟨hz, hz'⟩ + have hzb : z ∈ discBd D₂ := by rwa [hRU, hU₀] at hz + rw [hSU] at hz' + rcases hz' with hz' | hz' + · exact absurd (hz' ▸ hzb) hab + · obtain ⟨w, hw, hzw⟩ := mem_iUnion₂.mp hz' + have h₁ : z ∈ L w ∩ discBd D₂ := ⟨hzw, hzb⟩ + rw [(hL w hw).2.2.2] at h₁ + have h₂ : z = w := h₁ + subst h₂ + exact ⟨hw, hSV ▸ Or.inr hw⟩ + let W := Rim.glue St hmeet + have hu : IsUnion Rim St W := isUnion_glue hmeet + have hWU : W.U = discBd D₂ ∪ insert a (⋃ z ∈ Rim.V, L z) := by + change Rim.U ∪ St.U = _ + rw [hRU, hU₀, hSU] + have hWV : W.V = insert a Rim.V := by + change Rim.V ∪ St.V = _ + rw [hSV, union_eq_right.mpr (subset_insert _ _)] + have haW : a ∈ W.V := hWV ▸ mem_insert _ _ + -- The links of a spoke. + have hcap : ∀ z ∈ Rim.V, L z ∩ W.V = {a, z} := by + exact spokes_meet_wheel_vertices_at_ends (S := S) (D₂ := D₂) Rim hVC a L haD hab hL hdis St + hSU hSV hSE W hWU hWV haW + have hspoke : ∀ {g u v}, g ∈ St.E → W.toGraph.IsLink g u v → ∃ z ∈ Rim.V, z ≠ a ∧ + ({u, v} : Set S) = {a, z} := by + exact star_edges_link_spoke_endpoints (S := S) (D₂ := D₂) Rim a L hL St hSE W hcap + have hrimC : ∀ {g u v}, g ∈ Rim.E → W.toGraph.IsLink g u v → Rim.toGraph.IsLink g u v := + fun {g u v} hg hl => (hu.linkH g hg u v).mp hl + have hEsplit : ∀ {g}, g ∈ W.E → g ∈ Rim.E ∨ g ∈ St.E := fun {g} hg => by + have h₁ : g ∈ W.E := hg + rw [hu.hE] at h₁ + exact h₁ + have hrimV : ∀ {g u v}, g ∈ Rim.E → W.toGraph.IsLink g u v → u ≠ a := by + intro g u v hg hl h + exact hab (h ▸ hVC (hrimC hg hl).left_mem) + have hanB : a ∉ B := fun h => hab (hBb h) + have hpairs : ∀ {u v z : S}, ({u, v} : Set S) = {a, z} → (u = a ∧ v = z) ∨ (u = z ∧ v = a) := by + intro u v z h + exact Set.pair_eq_pair_iff.mp h + refine ⟨W, a, ?_, haW, haD, hab, ?_, ?_⟩ + · refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [hWU] + refine union_subset (Surface.discBd_subset D₂) (insert_subset haD ?_) + exact iUnion₂_subset fun z hz => (hL z hz).2.2.1 + · rw [hWU] + exact subset_union_left + · have hstar : IsPreconnected (⋃ z ∈ Rim.V, L z) := by + have := isPreconnected_sUnion a (L '' Rim.V) + (by rintro _ ⟨z, hz, rfl⟩; exact line_start (hL z hz).2.1) + (by rintro _ ⟨z, hz, rfl⟩; exact line_preconn (hL z hz).2.1) + rwa [sUnion_image] at this + obtain ⟨z, hz⟩ : Rim.V.Nonempty := ⟨c, hRV (hV₀ ▸ mem_insert _ _)⟩ + have hzs : z ∈ ⋃ z ∈ Rim.V, L z := mem_iUnion₂.mpr ⟨z, hz, line_end (hL z hz).2.1⟩ + have hun := hD₁.union z (hsub (hVC hz)) hzs hstar + convert hun using 1 + rw [hWU] + have has : a ∈ ⋃ z ∈ Rim.V, L z := mem_iUnion₂.mpr ⟨z, hz, line_start (hL z hz).2.1⟩ + rw [insert_eq_of_mem has, ← union_assoc, union_eq_left.mpr hsub] + · exact (hBV.trans hRV).trans fun z hz => hWV ▸ Or.inr hz + · intro e u hl + rcases hEsplit hl.1 with he | he + · exact hnl e u (hrimC he hl) + · obtain ⟨z, hz, hne, hp⟩ := hspoke he hl + rcases hpairs hp with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact hne (h₂.symm.trans h₁) + · exact hne (h₁.symm.trans h₂) + · intro e e' u v hl hl' + rcases hEsplit hl.1 with he | he <;> rcases hEsplit hl'.1 with he' | he' + · exact hsimple e e' u v (hrimC he hl) (hrimC he' hl') + · exfalso + obtain ⟨z, -, -, hp⟩ := hspoke he' hl' + have ha := hpairs hp + have hu₁ := hrimV he hl + have hv₁ := hrimV he hl.symm + rcases ha with ⟨h₁, -⟩ | ⟨-, h₁⟩ + · exact hu₁ h₁ + · exact hv₁ h₁ + · exfalso + obtain ⟨z, -, -, hp⟩ := hspoke he hl + have hu₁ := hrimV he' hl' + have hv₁ := hrimV he' hl'.symm + rcases hpairs hp with ⟨h₁, -⟩ | ⟨-, h₁⟩ + · exact hu₁ h₁ + · exact hv₁ h₁ + · have hSE' := hSE + obtain ⟨z, hz, hne, hp⟩ := hspoke he hl + obtain ⟨z', hz', hne', hp'⟩ := hspoke he' hl' + have hzz : z = z' := by + have h₁ : ({a, z} : Set S) = {a, z'} := hp.symm.trans hp' + have h₂ : z ∈ ({a, z'} : Set S) := h₁ ▸ Or.inr rfl + rcases h₂ with h₂ | h₂ + · exact absurd h₂ hne + · exact h₂ + subst hzz + rw [hSE] at he he' + obtain ⟨w, hw, rfl⟩ := he + obtain ⟨w', hw', rfl⟩ := he' + have hc₁ := hl.2.2.2 + have hc₂ := hl'.2.2.2 + rw [closure_sdiff_pair (hL w hw).2.1, hcap w hw] at hc₁ + rw [closure_sdiff_pair (hL w' hw').2.1, hcap w' hw'] at hc₂ + have h₃ : ({a, w} : Set S) = {a, w'} := hc₁.trans hc₂.symm + have h₄ : w ∈ ({a, w'} : Set S) := h₃ ▸ Or.inr rfl + have hww : w = w' := by + rcases h₄ with h₄ | h₄ + · exact absurd h₄ (hL w hw).1 + · exact h₄ + rw [hww] + · intro e u v hl huB + rcases hEsplit hl.1 with he | he + · exact fun hvB => hnob e u v (hrimC he hl) (hBV huB) (hBV hvB) + · obtain ⟨z, -, -, hp⟩ := hspoke he hl + rcases hpairs hp with ⟨h₁, -⟩ | ⟨-, h₁⟩ + · exact absurd (h₁ ▸ huB) hanB + · exact h₁ ▸ hanB + · refine ⟨T, hTV.trans fun z hz => hWV ▸ Or.inr hz, hT4, ?_⟩ + intro v hv + obtain ⟨g, g', hne, hi, hi'⟩ := hT2 v hv + have hvV := hTV hv + obtain ⟨hne', hl', -, -⟩ := hL v hvV + let sp := L v \ {a, v} + have hsp : sp ∈ St.E := hSE ▸ mem_image_of_mem _ hvV + have hspW : sp ∈ W.E := hu.hE ▸ Or.inr hsp + have hspl : W.toGraph.IsLink sp v a := by + refine ⟨hspW, hWV ▸ Or.inr hvV, haW, ?_⟩ + rw [closure_sdiff_pair hl', hcap v hvV, pair_comm] + have hconv : ∀ {g}, Rim.toGraph.Inc g v → W.toGraph.Inc g v := by + rintro g ⟨t, ht⟩ + exact ⟨t, (hu.linkH g ht.1 v t).mpr ht⟩ + have hspne : ∀ {g}, Rim.toGraph.Inc g v → sp ≠ g := by + rintro g ⟨t, ht⟩ h + have h₁ : a ∈ closure sp ∩ W.V := by + rw [hspl.2.2.2] + exact Or.inr rfl + have h₂ : a ∈ closure g := h ▸ h₁.1 + have h₃ := Rim.closure_subset_U ht.1 h₂ + rw [hRU, hU₀] at h₃ + exact hab h₃ + have hsub₃ : ({sp, g, g'} : Set (Set S)) ⊆ {e | W.toGraph.Inc e v} := by + rintro e (rfl | rfl | rfl) + · exact ⟨a, hspl⟩ + · exact hconv hi + · exact hconv hi' + have hfin : {e | W.toGraph.Inc e v}.Finite := W.finite_edges.subset fun e he => he.edge_mem + have hc₃ : ({sp, g, g'} : Set (Set S)).ncard = 3 := by + rw [ncard_eq_three] + exact ⟨sp, g, g', hspne hi, hspne hi', hne, rfl⟩ + rw [← hc₃] + exact ncard_le_ncard hsub₃ hfin + · exact wheel_has_no_small_separation (S := S) (B := B) (D₂ := D₂) hO Rim hVC a L haD hab hL + hdis St hSU hSV hSE W hWU hWV haW hcap hspoke hrimV hanB hpairs + · rw [hWV] + exact insert_subset_insert hVC + · intro z hz hza + rw [hWV] at hz + have hzR : z ∈ Rim.V := hz.resolve_left hza + obtain ⟨-, hl', -, -⟩ := hL z hzR + have hsp : L z \ {a, z} ∈ St.E := hSE ▸ mem_image_of_mem _ hzR + refine ⟨L z \ {a, z}, hu.hE ▸ Or.inr hsp, haW, hWV ▸ Or.inr hzR, ?_⟩ + rw [closure_sdiff_pair hl', hcap z hzR] + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM14/Section10.lean b/LeanPool/GraphMinor/GM14/Section10.lean new file mode 100644 index 0000000000..3e767d5126 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section10.lean @@ -0,0 +1,3514 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section9 +public import LeanPool.GraphMinor.GM14.Section6 +public import LeanPool.GraphMinor.GM14.Section10Translation4 +import LeanPool.GraphMinor.GM14.DiscBoundaryHomeomorphism +public import LeanPool.GraphMinor.GM14.BridgeFacts +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section4b +import LeanPool.GraphMinor.GM11.OArcCircuit +import LeanPool.GraphMinor.GM11.Section81 +import LeanPool.GraphMinor.GM14.Section7b +import LeanPool.GraphMinor.GM14.Section8Core +import LeanPool.GraphMinor.Surface.CircleMove +import LeanPool.GraphMinor.Surface.EdgeLens + +import LeanPool.GraphMinor.GM09.Bridge + +import LeanPool.GraphMinor.GM12.Section710 +import LeanPool.GraphMinor.GM14.DiscArrangement + + +/-! +# Graph Minors XIV – Section 10: The Main Proof ((10.1), (4.1), and (1.1)) + +This file formalizes Section 10 ("The Main Proof", pages 49–50), Section 4 ((4.1), page 30), and +Section 1 ((1.1), pages 24–25) of N. Robertson and P. D. Seymour, +*Graph Minors. XIV. Extending an embedding*, J. Combin. Theory Ser. B **65** (1995) 23–50: + +- `isHPathWithEnds_mono`, `spanEmbeddingMono`, `isDrawingEye_mono`: monotonicity of `H`-paths, + span embeddings, and eyes under subgraph inclusion `G₀ ≤ G`. +- `bridge_step_10_1` and `theorem_10_1` ((10.1), pages 49–50): proved by induction on + `|V(G)| + |E(G)|` using bridges of `H` in `G`, `(9.6)` (`theorem_9_6` with `π = 2`), `(8.1)` + (`Theorem81Statement`), `(6.1)` (`theorem_6_1`), `(6.5)` (`theorem_6_5`), and `(7.3)` + (`theorem_7_3`) to glue the modified arrangement `α*` inside `Δ` with `α` outside `Δ`. +- `theorem_4_1` ((4.1), page 30): the main theorem of Graph Minors XIV, proved by setting `β = 12` + in `theorem_10_1`. +- `theorem_1_1` ((1.1), pages 24–25): the simplified special case for 4-connected graphs and + subdivisions of simple 3-connected graphs in non-spherical surfaces without boundary of + representativity `≥ 209`, deduced from `theorem_4_1`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 + GraphMinor.GM11 Hypergraph + +universe u v w + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-! ## Monotonicity of `H`-Paths, Span Embeddings, and Eyes -/ + +omit [T2Space S] in +/-- Monotonicity of `IsHPathWithEnds` with respect to ambient graph inclusion `G₀ ≤ G`. -/ +theorem isHPathWithEnds_mono {α : Type v} {β : Type w} + {G₀ G H₀ P : Graph α β} {a b : α} (hG₀ : G₀ ≤ G) + (hP : IsHPathWithEnds G₀ H₀ P a b) : + IsHPathWithEnds G H₀ P a b := + ⟨hP.1.trans hG₀, ⟨hP.2.1.1.trans hG₀, hP.2.1.2⟩, hP.2.2⟩ + +/-- Extending a `SpanEmbedding H' G₀` along `G₀ ≤ G` to a `SpanEmbedding H' G`. -/ +def spanEmbeddingMono {α : Type v} {β : Type w} {H' : Drawing S} {G₀ G : Graph α β} + (hG₀ : G₀ ≤ G) (η₀ : SpanEmbedding H' G₀) : SpanEmbedding H' G where + imageGraph := η₀.imageGraph + vMap := η₀.vMap + eMap := η₀.eMap + imageGraph_le := η₀.imageGraph_le.trans hG₀ + bijOn_v := η₀.bijOn_v + bijOn_e := η₀.bijOn_e + inc_iff := η₀.inc_iff + +omit [T2Space S] in +/-- If `r` is an eye of `H'` in `G₀ ≤ G` with respect to `T'`, then `r` is also an eye of `H'` in +`G` with respect to `T'`. -/ +theorem isDrawingEye_mono {α : Type v} {β : Type w} + {G₀ G : Graph α β} (hG₀ : G₀ ≤ G) {H' : Drawing S} (η₀ : SpanEmbedding H' G₀) + {θ' : ℕ} {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {r : Set S} + (heye : IsDrawingEye G₀ H' η₀ θ' T' r) : + IsDrawingEye G H' (spanEmbeddingMono hG₀ η₀) θ' T' r := by + obtain ⟨hr, C, a, b, c, d, P₁, P₂, hC, hCs, hCU, ha, hb, hc, hd, hnodup, hord, hfree, + hdisj, hP₁, hP₂⟩ := heye + exact ⟨hr, C, a, b, c, d, P₁, P₂, hC, hCs, hCU, ha, hb, hc, hd, hnodup, hord, hfree, + hdisj, isHPathWithEnds_mono hG₀ hP₁, isHPathWithEnds_mono hG₀ hP₂⟩ + +/-! ## Bridge Decomposition Lemmas -/ + +omit [T2Space S] in +/-- If `G₀ ≠ η₀.imageGraph`, there is a bridge `J` of `η₀.imageGraph` in `G₀` and a remaining +union `G' = subgraphSUnion G₀ {η₀.imageGraph, subgraphSUnion G₀ B_rem}` with strictly smaller +`|V(G')| + |E(G')| < |V(G₀)| + |E(G₀)|`. -/ +private theorem exists_bridge_decomposition_of_ne {α : Type v} {β : Type w} + {G₀ : Graph α β} {H : Drawing S} (η₀ : SpanEmbedding H G₀) + (hV_fin : V(G₀).Finite) (hE_fin : E(G₀).Finite) + (hne : G₀ ≠ η₀.imageGraph) : + ∃ (J G' : Graph α β) (B_rem : Set (Graph α β)) (η' : SpanEmbedding H G'), + IsBridge G₀ η₀.imageGraph J ∧ + (∀ B ∈ B_rem, IsBridge G₀ η₀.imageGraph B) ∧ + J ∉ B_rem ∧ + J = subgraphSUnion G₀ {J} ∧ + G' = subgraphSUnion G₀ {η₀.imageGraph, subgraphSUnion G₀ B_rem} ∧ + G' ≤ G₀ ∧ + G₀ = subgraphUnion G₀ G' J ∧ + Disjoint E(G') E(J) ∧ + V(G') ∩ V(J) ⊆ V(η₀.imageGraph) ∧ + η'.imageGraph = η₀.imageGraph ∧ + (∀ v ∈ H.V, η'.vMap v = η₀.vMap v) ∧ + (∀ e ∈ H.E, η'.eMap e = η₀.eMap e) ∧ + V(G').ncard + E(G').ncard < V(G₀).ncard + E(G₀).ncard := by + have hex_J : ∃ J : Graph α β, IsBridge G₀ η₀.imageGraph J := by + by_cases hV_eq : V(G₀) = V(η₀.imageGraph) + · have hE_ne : E(G₀) ≠ E(η₀.imageGraph) := fun hE_eq => + hne ((Compatible.of_le_le le_rfl η₀.imageGraph_le).ext hV_eq hE_eq) + have hE_notsub : ¬ E(G₀) ⊆ E(η₀.imageGraph) := fun hsub => + hE_ne (subset_antisymm hsub η₀.imageGraph_le.edgeSet_mono) + obtain ⟨e, heG, heH⟩ := Set.not_subset.mp hE_notsub + obtain ⟨J, hJ, _⟩ := exists_bridge_of_mem_edgeSet η₀.imageGraph_le heG heH + exact ⟨J, hJ⟩ + · have hV_notsub : ¬ V(G₀) ⊆ V(η₀.imageGraph) := fun hsub => + hV_eq (subset_antisymm hsub η₀.imageGraph_le.vertexSet_mono) + obtain ⟨v, hvG, hvH⟩ := Set.not_subset.mp hV_notsub + obtain ⟨J, hJ, _⟩ := exists_bridge_of_mem_vertexSet η₀.imageGraph_le hvG hvH + exact ⟨J, hJ⟩ + obtain ⟨J, hJ⟩ := hex_J + let B_rem : Set (Graph α β) := {B : Graph α β | IsBridge G₀ η₀.imageGraph B ∧ B ≠ J} + have hB_rem : ∀ B ∈ B_rem, IsBridge G₀ η₀.imageGraph B := fun _ hB => hB.1 + have hJ_not_rem : J ∉ B_rem := fun h => h.2 rfl + let U_rem := subgraphSUnion G₀ B_rem + have hU_rem_le : U_rem ≤ G₀ := subgraphSUnion_le fun _ hB => hB.1.2.1 + have hPair_le : ∀ Q ∈ ({η₀.imageGraph, U_rem} : Set (Graph α β)), Q ≤ G₀ := by + rintro Q (rfl | rfl) + · exact η₀.imageGraph_le + · exact hU_rem_le + let G' := subgraphSUnion G₀ {η₀.imageGraph, U_rem} + have hG'_le : G' ≤ G₀ := subgraphSUnion_le hPair_le + have hH_le_G' : η₀.imageGraph ≤ G' := le_subgraphSUnion hPair_le (Or.inl rfl) + let η' : SpanEmbedding H G' := { + imageGraph := η₀.imageGraph + vMap := η₀.vMap + eMap := η₀.eMap + imageGraph_le := hH_le_G' + bijOn_v := η₀.bijOn_v + bijOn_e := η₀.bijOn_e + inc_iff := η₀.inc_iff + } + have hJ_sUnion : J = subgraphSUnion G₀ {J} := by + have h1 : ∀ Q ∈ ({J} : Set (Graph α β)), Q ≤ G₀ := by rintro Q rfl; exact hJ.2.1 + refine (Compatible.of_le_le hJ.2.1 (subgraphSUnion_le h1)).ext ?_ ?_ + · rw [vertexSet_subgraphSUnion]; simp + · rw [edgeSet_subgraphSUnion h1]; simp + have hVG' : V(G') = V(η₀.imageGraph) ∪ ⋃ B ∈ B_rem, V(B) := by + change V(subgraphSUnion G₀ {η₀.imageGraph, U_rem}) = _ + rw [vertexSet_subgraphSUnion] + ext v + constructor + · intro hv + obtain ⟨Q, rfl | rfl, hvQ⟩ := mem_iUnion₂.mp hv + · exact Or.inl hvQ + · rw [vertexSet_subgraphSUnion] at hvQ + exact Or.inr hvQ + · rintro (hvH | hvU) + · exact mem_iUnion₂.mpr ⟨η₀.imageGraph, Or.inl rfl, hvH⟩ + · refine mem_iUnion₂.mpr ⟨U_rem, Or.inr rfl, ?_⟩ + rw [vertexSet_subgraphSUnion] + exact hvU + have hle_from_bridge : ∀ B ∈ B_rem, B ≤ G₀ := fun _ hB => hB.1.2.1 + have hEG' : E(G') = E(η₀.imageGraph) ∪ ⋃ B ∈ B_rem, E(B) := by + change E(subgraphSUnion G₀ {η₀.imageGraph, U_rem}) = _ + rw [edgeSet_subgraphSUnion hPair_le] + ext e + constructor + · intro he + obtain ⟨Q, rfl | rfl, heQ⟩ := mem_iUnion₂.mp he + · exact Or.inl heQ + · rw [edgeSet_subgraphSUnion hle_from_bridge] at heQ + exact Or.inr heQ + · rintro (heH | heU) + · exact mem_iUnion₂.mpr ⟨η₀.imageGraph, Or.inl rfl, heH⟩ + · refine mem_iUnion₂.mpr ⟨U_rem, Or.inr rfl, ?_⟩ + rw [edgeSet_subgraphSUnion hle_from_bridge] + exact heU + have hG₀_union : G₀ = subgraphUnion G₀ G' J := by + refine (Compatible.of_le_le le_rfl (subgraphUnion_le hG'_le hJ.2.1)).ext ?_ ?_ + · ext v + rw [vertexSet_subgraphUnion, hVG'] + refine ⟨fun hvG => ?_, fun h => ?_⟩ + · by_cases hvH : v ∈ V(η₀.imageGraph) + · exact Or.inl (Or.inl hvH) + · obtain ⟨B, hB, hvB⟩ := exists_bridge_of_mem_vertexSet η₀.imageGraph_le hvG hvH + by_cases hBJ : B = J + · exact Or.inr (hBJ ▸ hvB) + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨B, ⟨hB, hBJ⟩, hvB⟩)) + · rcases h with hG' | hJ_v + · exact hG'_le.vertexSet_mono (hVG' ▸ hG') + · exact hJ.2.1.vertexSet_mono hJ_v + · ext e + rw [edgeSet_subgraphUnion hG'_le hJ.2.1, hEG'] + refine ⟨fun heG => ?_, fun h => ?_⟩ + · by_cases heH : e ∈ E(η₀.imageGraph) + · exact Or.inl (Or.inl heH) + · obtain ⟨B, hB, heB⟩ := exists_bridge_of_mem_edgeSet η₀.imageGraph_le heG heH + by_cases hBJ : B = J + · exact Or.inr (hBJ ▸ heB) + · exact Or.inl (Or.inr (mem_iUnion₂.mpr ⟨B, ⟨hB, hBJ⟩, heB⟩)) + · rcases h with hG' | hJ_e + · exact hG'_le.edgeSet_mono (hEG' ▸ hG') + · exact hJ.2.1.edgeSet_mono hJ_e + have hDisj_E : Disjoint E(G') E(J) := by + rw [hEG'] + refine Set.disjoint_left.mpr fun e heG' heJ => ?_ + rcases heG' with heH | heRem + · exact Set.disjoint_left.mp (isBridge_disjoint_edgeSet hJ) heJ heH + · obtain ⟨B, hB, heB⟩ := mem_iUnion₂.mp heRem + exact hB.2 ((isBridge_eq_of_inter hB.1 hJ).2 e ⟨heB, heJ⟩) + have hInter_V : V(G') ∩ V(J) ⊆ V(η₀.imageGraph) := by + rintro v ⟨hvG', hvJ⟩ + by_contra hv_not_H + rw [hVG'] at hvG' + rcases hvG' with hvH | hvRem + · exact hv_not_H hvH + · obtain ⟨B, hB, hvB⟩ := mem_iUnion₂.mp hvRem + exact hB.2 ((isBridge_eq_of_inter hB.1 hJ).1 v ⟨hvB, hvJ⟩ hv_not_H) + have hcard_lt : V(G').ncard + E(G').ncard < V(G₀).ncard + E(G₀).ncard := by + have hV_le : V(G').ncard ≤ V(G₀).ncard := ncard_le_ncard hG'_le.vertexSet_mono hV_fin + have hE_le : E(G').ncard ≤ E(G₀).ncard := ncard_le_ncard hG'_le.edgeSet_mono hE_fin + rcases hJ.2.2 with ⟨e₀, he₀, _, _, _, _, _, _, hEJ⟩ | ⟨C, hC, hVJ, _⟩ + · have he₀_J : e₀ ∈ E(J) := hEJ ▸ mem_singleton e₀ + have he₀_not_G' : e₀ ∉ E(G') := Set.disjoint_right.mp hDisj_E he₀_J + have hE_ssub : E(G') ⊂ E(G₀) := ⟨hG'_le.edgeSet_mono, fun hsub => he₀_not_G' (hsub he₀.1)⟩ + have hE_lt : E(G').ncard < E(G₀).ncard := ncard_lt_ncard hE_ssub hE_fin + omega + · obtain ⟨v₀, hv₀C⟩ := hC.2.1.1 + have hv₀J : v₀ ∈ V(J) := hVJ ▸ Or.inl hv₀C + have hv₀_not_H : v₀ ∉ V(η₀.imageGraph) := (hC.1.vertexSet_mono hv₀C).2 + have hv₀_not_G' : v₀ ∉ V(G') := fun hv₀G' => hv₀_not_H (hInter_V ⟨hv₀G', hv₀J⟩) + have hv₀G₀ : v₀ ∈ V(G₀) := hJ.2.1.vertexSet_mono hv₀J + have hV_ssub : V(G') ⊂ V(G₀) := ⟨hG'_le.vertexSet_mono, fun hsub => hv₀_not_G' (hsub hv₀G₀)⟩ + have hV_lt : V(G').ncard < V(G₀).ncard := ncard_lt_ncard hV_ssub hV_fin + omega + exact ⟨J, G', B_rem, η', hJ, hB_rem, hJ_not_rem, hJ_sUnion, rfl, hG'_le, hG₀_union, + hDisj_E, hInter_V, rfl, fun _ _ => rfl, fun _ _ => rfl, hcard_lt⟩ + +/-! ## Converting a Crooked Transaction in `clearedSociety` to an Eye and Rigidity in `Δ` -/ + +omit [T2Space S] in +/-- If `Ω` is a natural order from `C.U` via `ν : α → S` and `[v₁, v₂, v₃, v₄]` is `Ω`-clockwise, +then `ν v₁, ν v₂, ν v₃, ν v₄` occur in circuit order on `C`. -/ +private theorem occurInCircuitOrder_of_isClockwiseSeq {α : Type v} + {C : Drawing S} {ν : α → S} {Ω : CyclicPerm α} {F : Set S} + {v₁ v₂ v₃ v₄ : α} + (hCU : C.U = F) + (hNat : IsNaturalOrderFrom ν Ω F) + (hcw : Ω.IsClockwiseSeq [v₁, v₂, v₃, v₄]) : + OccurInCircuitOrder C (ν v₁) (ν v₂) (ν v₃) (ν v₄) := by + obtain ⟨_, φ, _, hAgree3⟩ := hNat + obtain ⟨t, hmono, hturn, hpoint⟩ := + exists_angles_of_clockwise_triples hAgree3 hcw (by simp) + have h01 : t 0 < t 1 := hmono (by decide) + have h12 : t 1 < t 2 := hmono (by decide) + have h23 : t 2 < t 3 := hmono (by decide) + have h30 : t 3 < t 0 + 2 * Real.pi := hturn 3 (by simp) + let φ_C : Circle ≃ₜ C.U := + (Homeomorph.mulLeft (Circle.exp (t 0))).trans (φ.trans (Homeomorph.setCongr hCU.symm)) + refine ⟨φ_C, 0, t 1 - t 0, t 2 - t 0, t 3 - t 0, le_rfl, by linarith, by linarith, by linarith, + by linarith, ?_, ?_, ?_, ?_⟩ + · change (φ (Circle.exp (t 0) * Circle.exp 0)).1 = ν v₁ + rw [← Circle.exp_add, add_zero] + exact hpoint 0 (by simp) + · change (φ (Circle.exp (t 0) * Circle.exp (t 1 - t 0))).1 = ν v₂ + rw [← Circle.exp_add, add_sub_cancel] + exact hpoint 1 (by simp) + · change (φ (Circle.exp (t 0) * Circle.exp (t 2 - t 0))).1 = ν v₃ + rw [← Circle.exp_add, add_sub_cancel] + exact hpoint 2 (by simp) + · change (φ (Circle.exp (t 0) * Circle.exp (t 3 - t 0))).1 = ν v₄ + rw [← Circle.exp_add, add_sub_cancel] + exact hpoint 3 (by simp) + +/-- Outcome `(iv)(a)` of `(9.6)` with `π = 2` produces an eye `IsDrawingEye` of `clearedSubdrawing H +Λ` +in `G₀` with respect to `T₁`. -/ +private theorem isDrawingEye_of_crookedTransaction [ConnectedSpace S] {α : Type v} {β : Type w} + {G₀ : Graph α β} {H : Drawing S} {d : Set S → Set S → ℕ} {θ beta : ℕ} + {T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {z Λ : Set S} {clearedEmbedding : SpanEmbedding (clearedSubdrawing H Λ) G₀} + {clearedSociety : Society α β} {P_set : Set (Graph α β)} {X : Set S} + (hZone : IsLambdaZoneAround H d (3 * beta + 3) z Λ) + (hNat : ∃ inv_v : α → S, + (∀ x ∈ clearedSociety.Ω.bar, + inv_v x ∈ (clearedSubdrawing H Λ).V ∩ subBd Λ ∧ clearedEmbedding.vMap (inv_v x) = x) ∧ + IsNaturalOrderFrom inv_v clearedSociety.Ω (subBd Λ)) + (hCrooked : clearedSociety.IsCrookedTransaction P_set) + (hCard : 2 ≤ P_set.ncard) + (hPaths : ∀ P ∈ P_set, ∀ a b : α, + clearedSociety.IsOmegaPathWithEnds P a b → + IsHPathWithEnds G₀ clearedEmbedding.imageGraph P a b) + (hX_sub : X ⊆ (clearedSubdrawing H Λ).V ∩ subBd Λ) + (hEnds : clearedSociety.transactionEnds P_set = clearedEmbedding.vMap '' X) + (hFreeX : IsFreeSet (clearedSubdrawing H Λ).toHypergraph T₁ (θ - 4 * (3 * beta + 3) - 2) X) + (hT₁ : IsTangle (clearedSubdrawing H Λ).toHypergraph (θ - 4 * (3 * beta + 3) - 2) T₁) : + IsDrawingEye G₀ (clearedSubdrawing H Λ) clearedEmbedding (θ - 4 * (3 * beta + 3) - 2) T₁ Λ := by + let H' := clearedSubdrawing H Λ + obtain ⟨hΛR, _⟩ := clearedSubdrawing_mem_R_and_atom hZone + have hcl_bd : IsClosed (subBd Λ) := isClosed_closure.inter isClosed_closure + let C_bd := H'.interSet (subBd Λ) + obtain ⟨_, hCirc_bd, hC_U⟩ := clearedSubdrawing_boundary hZone + have hC_sub : C_bd.IsSubdrawing H' := H'.span_isSubdrawing _ _ + -- Extract a crossing pair `P₁, P₂ ∈ P_set` from `hCrooked` and `2 ≤ P_set.ncard` + have hne_P : P_set.Nonempty := Set.nonempty_of_ncard_ne_zero (by omega) + obtain ⟨P₁, hP₁_in, P₂, hP₂_in, hP12, hCrooked12⟩ := + clearedSociety.exists_crooked_pair_of_nonempty hCrooked hne_P + obtain ⟨A, B, hfence12⟩ := hCrooked12.1 + obtain ⟨a₁, ha₁A, c₁, hc₁B, hP₁_ends⟩ := hfence12.2.2 P₁ (Or.inl rfl) + obtain ⟨b₁, hb₁A, d₁, hd₁B, hP₂_ends⟩ := hfence12.2.2 P₂ (Or.inr rfl) + have hdisj_12 : Disjoint V(P₁) V(P₂) := hfence12.1.2 (Or.inl rfl) (Or.inr rfl) hP12 + -- Show `clearedSociety.Ω.Crosses a₁ c₁ b₁ d₁` since `P₁` is not peripheral in `{P₁, P₂}` + have hcross : clearedSociety.Ω.Crosses a₁ c₁ b₁ d₁ := by + by_contra hnot_cr + have hper₁ : clearedSociety.IsPeripheralIn {P₁, P₂} P₁ := by + by_contra hnot_per + have hcross_path : clearedSociety.OmegaPathsCross P₁ P₂ := by + have hEnds12_sub : clearedSociety.transactionEnds {P₁, P₂} ⊆ {a₁, c₁, b₁, d₁} := by + rintro x ⟨Q, hQ, y, hQ_ends⟩ + rcases hQ with rfl | rfl + · rcases hP₁_ends.ends_eq clearedSociety hQ_ends with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl rfl + · exact Or.inr (Or.inl rfl) + · rcases hP₂_ends.ends_eq clearedSociety hQ_ends with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inr (Or.inr (Or.inl rfl)) + · exact Or.inr (Or.inr (Or.inr rfl)) + have hnot_disj1 : ¬ Disjoint (clearedSociety.Ω.interval a₁ c₁) + (clearedSociety.transactionEnds {P₁, P₂}) := + fun hd => hnot_per ⟨Or.inl rfl, a₁, c₁, hP₁_ends, Or.inl hd⟩ + have hnot_disj2 : ¬ Disjoint (clearedSociety.Ω.interval c₁ a₁) + (clearedSociety.transactionEnds {P₁, P₂}) := + fun hd => hnot_per ⟨Or.inl rfl, a₁, c₁, hP₁_ends, Or.inr hd⟩ + obtain ⟨u, hu_int, hu_ends⟩ := Set.not_disjoint_iff.mp hnot_disj1 + obtain ⟨v, hv_int, hv_ends⟩ := Set.not_disjoint_iff.mp hnot_disj2 + have hu_bd : u = b₁ ∨ u = d₁ := by + rcases hEnds12_sub hu_ends with rfl | rfl | rfl | rfl + · exact (hu_int.1.2 (Or.inl rfl)).elim + · exact (hu_int.1.2 (Or.inr rfl)).elim + · exact Or.inl rfl + · exact Or.inr rfl + have hv_bd : v = b₁ ∨ v = d₁ := by + rcases hEnds12_sub hv_ends with rfl | rfl | rfl | rfl + · exact (hv_int.1.2 (Or.inr rfl)).elim + · exact (hv_int.1.2 (Or.inl rfl)).elim + · exact Or.inl rfl + · exact Or.inr rfl + have hdisj_int : Disjoint (clearedSociety.Ω.interval a₁ c₁) (clearedSociety.Ω.interval c₁ + a₁) := + clearedSociety.Ω.disjoint_interval_swap a₁ c₁ + have huv_ne : u ≠ v := fun h => Set.disjoint_left.mp hdisj_int hu_int (h ▸ hv_int) + have hcr' : clearedSociety.Ω.Crosses a₁ c₁ b₁ d₁ := by + rw [clearedSociety.Ω.crosses_iff_interval] + rcases hu_bd with rfl | rfl <;> rcases hv_bd with rfl | rfl + · exact (huv_ne rfl).elim + · exact Or.inl ⟨hu_int, hv_int⟩ + · exact Or.inr ⟨hu_int, hv_int⟩ + · exact (huv_ne rfl).elim + exact ⟨hdisj_12, a₁, c₁, b₁, d₁, hP₁_ends, hP₂_ends, hcr'⟩ + rcases hcross_path with ⟨_, x₁, y₁, x₂, y₂, hx₁y₁, hx₂y₂, hcr_xy⟩ + rcases hP₁_ends.ends_eq clearedSociety hx₁y₁ with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> + rcases hP₂_ends.ends_eq clearedSociety hx₂y₂ with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hnot_cr hcr_xy + · exact hnot_cr hcr_xy.swap_right + · exact hnot_cr hcr_xy.swap_left + · exact hnot_cr hcr_xy.swap_left.swap_right + exact hCrooked12.2 P₁ (Or.inl rfl) hper₁ + -- Map `a₁, b₁, c₁, d₁` via `inv_v` + obtain ⟨inv_v, hinv_v, hNat_Ω⟩ := hNat + have hinv_mem_X : ∀ x ∈ clearedSociety.transactionEnds P_set, + inv_v x ∈ X ∧ clearedEmbedding.vMap (inv_v x) = x ∧ inv_v x ∈ C_bd.V := by + intro x hx + have hx_img : x ∈ clearedEmbedding.vMap '' X := hEnds ▸ hx + obtain ⟨y, hyX, hyx⟩ := hx_img + rcases hx with ⟨Q, hQ, z, hPath⟩ + obtain ⟨hinv_mem, hinv_eq⟩ := hinv_v x hPath.2.2.1 + have hy_eq : inv_v x = y := + clearedEmbedding.bijOn_v.injOn hinv_mem.1 (hX_sub hyX).1 (hinv_eq.trans hyx.symm) + have hCV : inv_v x ∈ C_bd.V := by + change inv_v x ∈ (H'.interSet (subBd Λ)).V + rw [H'.interSet_V_of_isClosed hcl_bd] + exact hinv_mem + exact ⟨hy_eq ▸ hyX, hinv_eq, hCV⟩ + have ha₁_ends : a₁ ∈ clearedSociety.transactionEnds P_set := + hP₁_ends.mem_transactionEnds_left clearedSociety hP₁_in + have hc₁_ends : c₁ ∈ clearedSociety.transactionEnds P_set := + hP₁_ends.mem_transactionEnds_right clearedSociety hP₁_in + have hb₁_ends : b₁ ∈ clearedSociety.transactionEnds P_set := + hP₂_ends.mem_transactionEnds_left clearedSociety hP₂_in + have hd₁_ends : d₁ ∈ clearedSociety.transactionEnds P_set := + hP₂_ends.mem_transactionEnds_right clearedSociety hP₂_in + have hP₁_H : IsHPathWithEnds G₀ clearedEmbedding.imageGraph P₁ a₁ c₁ + := hPaths P₁ hP₁_in a₁ c₁ hP₁_ends + have hP₂_H : IsHPathWithEnds G₀ clearedEmbedding.imageGraph P₂ b₁ d₁ + := hPaths P₂ hP₂_in b₁ d₁ hP₂_ends + have hinv_inj : ∀ x ∈ clearedSociety.Ω.bar, ∀ y ∈ clearedSociety.Ω.bar, inv_v x = inv_v y → x = y + := by + intro x hx y hy hxy + rw [← (hinv_v x hx).2, ← (hinv_v y hy).2, hxy] + rcases hcross with hcw1 | hcw2 + · let a := inv_v a₁ + let b := inv_v b₁ + let c := inv_v c₁ + let d_v := inv_v d₁ + have hnodup : ([a, b, c, d_v]).Nodup := by + change ([a₁, b₁, c₁, d₁].map inv_v).Nodup + refine hcw1.1.map_on ?_ + intro x hx y hy hxy + exact hinv_inj x (hcw1.2.1 x hx) y (hcw1.2.1 y hy) hxy + have hord : OccurInCircuitOrder C_bd a b c d_v := + occurInCircuitOrder_of_isClockwiseSeq hC_U hNat_Ω hcw1 + have hfree : IsFreeSet H'.toHypergraph T₁ (θ - 4 * (3 * beta + 3) - 2) {a, b, c, d_v} := by + refine freeSet_subset hT₁ hFreeX ?_ + rintro x (rfl | rfl | rfl | rfl) + · exact (hinv_mem_X a₁ ha₁_ends).1 + · exact (hinv_mem_X b₁ hb₁_ends).1 + · exact (hinv_mem_X c₁ hc₁_ends).1 + · exact (hinv_mem_X d₁ hd₁_ends).1 + refine ⟨hΛR, C_bd, a, b, c, d_v, P₁, P₂, hCirc_bd, hC_sub, hC_U, + (hinv_mem_X a₁ ha₁_ends).2.2, (hinv_mem_X b₁ hb₁_ends).2.2, + (hinv_mem_X c₁ hc₁_ends).2.2, (hinv_mem_X d₁ hd₁_ends).2.2, + hnodup, hord, hfree, hdisj_12, ?_, ?_⟩ + · rwa [(hinv_mem_X a₁ ha₁_ends).2.1, (hinv_mem_X c₁ hc₁_ends).2.1] + · rwa [(hinv_mem_X b₁ hb₁_ends).2.1, (hinv_mem_X d₁ hd₁_ends).2.1] + · let a := inv_v d₁ + let b := inv_v c₁ + let c := inv_v b₁ + let d_v := inv_v a₁ + have hnodup : ([a, b, c, d_v]).Nodup := by + change ([d₁, c₁, b₁, a₁].map inv_v).Nodup + refine hcw2.1.map_on ?_ + intro x hx y hy hxy + exact hinv_inj x (hcw2.2.1 x hx) y (hcw2.2.1 y hy) hxy + have hord : OccurInCircuitOrder C_bd a b c d_v := + occurInCircuitOrder_of_isClockwiseSeq hC_U hNat_Ω hcw2 + have hfree : IsFreeSet H'.toHypergraph T₁ (θ - 4 * (3 * beta + 3) - 2) {a, b, c, d_v} := by + refine freeSet_subset hT₁ hFreeX ?_ + rintro x (rfl | rfl | rfl | rfl) + · exact (hinv_mem_X d₁ hd₁_ends).1 + · exact (hinv_mem_X c₁ hc₁_ends).1 + · exact (hinv_mem_X b₁ hb₁_ends).1 + · exact (hinv_mem_X a₁ ha₁_ends).1 + have hP₂_symm : IsHPathWithEnds G₀ clearedEmbedding.imageGraph P₂ d₁ b₁ := + ⟨hP₂_H.1, hP₂_H.2.1.symm, hP₂_H.2.2.1.symm, hP₂_H.2.2.2.2.1, hP₂_H.2.2.2.1, + Set.pair_comm b₁ d₁ ▸ hP₂_H.2.2.2.2.2.1, hP₂_H.2.2.2.2.2.2⟩ + have hP₁_symm : IsHPathWithEnds G₀ clearedEmbedding.imageGraph P₁ c₁ a₁ := + ⟨hP₁_H.1, hP₁_H.2.1.symm, hP₁_H.2.2.1.symm, hP₁_H.2.2.2.2.1, hP₁_H.2.2.2.1, + Set.pair_comm a₁ c₁ ▸ hP₁_H.2.2.2.2.2.1, hP₁_H.2.2.2.2.2.2⟩ + refine ⟨hΛR, C_bd, a, b, c, d_v, P₂, P₁, hCirc_bd, hC_sub, hC_U, + (hinv_mem_X d₁ hd₁_ends).2.2, (hinv_mem_X c₁ hc₁_ends).2.2, + (hinv_mem_X b₁ hb₁_ends).2.2, (hinv_mem_X a₁ ha₁_ends).2.2, + hnodup, hord, hfree, hdisj_12.symm, ?_, ?_⟩ + · rwa [(hinv_mem_X d₁ hd₁_ends).2.1, (hinv_mem_X b₁ hb₁_ends).2.1] + · rwa [(hinv_mem_X c₁ hc₁_ends).2.1, (hinv_mem_X a₁ ha₁_ends).2.1] + +/-- By `(6.1)` (`theorem_6_1_proof`), when `Δ` is an `α`-normal closed disc and `H ∩ closure (Σ \ +Δ)` +contains a circuit `C_out`, `H ∩ Δ` is rigid in `Δ` (`IsRigidIn (H.interSet Δ) Δ`). -/ +private theorem isRigidIn_of_normal_closedDisc {α : Type v} {β : Type w} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {G' : Graph α β} {H : Drawing S} {η' : SpanEmbedding H G'} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + {Δ : Set S} + (hRig : IsRigid H) + (hSeg : IsThreeSegregation G' S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hΔ_disc : IsClosedDisc Δ) + (hNorm : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) + (hCout : ∃ C_out : Drawing S, + C_out.IsCircuit ∧ C_out.IsSubdrawing (H.interSet (closure (univ \ Δ)))) : + IsRigidIn (H.interSet Δ) Δ := by + have : ConnectedSpace S := hConn + have hbd_HV : subBd Δ ∩ H.U ⊆ H.V := by + rintro x ⟨hxbd, hxU⟩ + by_contra hxnotV + obtain ⟨e, he, hxe⟩ := H.exists_edge_of_mem hxU hxnotV + have he_G' : η'.eMap e ∈ E(G') := η'.imageGraph_le.edgeSet_mono (η'.bijOn_e.mapsTo he) + have he_union : η'.eMap e ∈ E(subgraphSUnion G' ((fun S₁ : Society α β => S₁.G) '' S_seg)) := + hSeg.1.union_eq.symm ▸ he_G' + simp only [subgraphSUnion, edgeSet_restrict, mem_inter_iff, mem_iUnion, mem_image, + exists_prop] at he_union + obtain ⟨_, ⟨S₀, hS₀, rfl⟩, he_S₀⟩ := he_union.2 + have he_disc : e ⊆ α_disc S₀ := (hComp.inter_E_iff S₀ hS₀ e he).mpr he_S₀ + have hx_bar : x ∈ α_pt '' S₀.Ω.bar := hNorm S₀ hS₀ ⟨hxbd, he_disc hxe⟩ + obtain ⟨y, hy_bar, rfl⟩ := hx_bar + have hx_bd_S₀ : α_pt y ∈ H.U ∩ subBd (α_disc S₀) := + ⟨hxU, (hArr.isClosedDisc S₀ hS₀).2 y hy_bar⟩ + rw [hComp.bd_inter_eq S₀ hS₀] at hx_bd_S₀ + exact hxnotV hx_bd_S₀.1 + refine theorem_6_1_proof hRig hΔ_disc.isClosed hbd_HV + (fun D hD hD_bd hD_not => subsurf_closedDisc hS hΔ_disc hD hD_bd hD_not) ?_ + intro Δ' hΔ' hΔ'_inter hΔ'_bd + have hbd_eq : subBd Δ' = subBd Δ := + eq_of_oArc_subset (IsClosedDisc.subBd_eq_discBd hS hΔ' ▸ hΔ'.isOArc_discBd) + (IsClosedDisc.subBd_eq_discBd hS hΔ_disc ▸ hΔ_disc.isOArc_discBd) hΔ'_bd + have hdiscBd_eq : discBd Δ' = discBd Δ := by + rw [← IsClosedDisc.subBd_eq_discBd hS hΔ', ← IsClosedDisc.subBd_eq_discBd hS hΔ_disc, hbd_eq] + have hne_Δ' : Δ' ≠ Δ := by + intro hEq + subst hEq + rw [Set.inter_self] at hΔ'_inter + obtain ⟨hOD, _, _⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hΔ_disc + obtain ⟨φ⟩ := hOD.2 + have h0 : (0 : EuclideanPlane) ∈ OpenUnitDisc := by simp [OpenUnitDisc] + let p₀ : S := (φ ⟨0, h0⟩).1 + have hp_in : p₀ ∈ Δ' := (φ ⟨0, h0⟩).2.1 + have hp_not : p₀ ∉ subBd Δ' := (φ ⟨0, h0⟩).2.2 + rw [hΔ'_inter] at hp_in + exact hp_not hp_in + have hcov : Δ' ∪ Δ = univ := cover_of_discBd_eq hS hΔ' hΔ_disc hdiscBd_eq hne_Δ' + have hcompl_sub : univ \ Δ ⊆ Δ' := fun x ⟨hxU, hxnot⟩ => (hcov.symm ▸ hxU).resolve_right hxnot + have hcl_sub : closure (univ \ Δ) ⊆ Δ' := hΔ'.isClosed.closure_subset_iff.mpr hcompl_sub + obtain ⟨C_out, hCout_cir, hCout_sub⟩ := hCout + refine ⟨C_out, hCout_cir, hCout_sub.trans (H.span_isSubdrawing _ _), hCout_sub.U_subset.trans ?_⟩ + rw [(H.interSet (closure (univ \ Δ))).U_eq, + H.interSet_V_of_isClosed isClosed_closure, Drawing.interSet_E] + exact (union_subset inter_subset_right + (iUnion₂_subset fun e he => isClosed_closure.closure_subset_iff.mpr he.2)).trans hcl_sub + +/-! ## Base Case and Vertex-Disjoint Bridge Case for (10.1) (pages 49–50) -/ + +private theorem disjoint_bridge_piece_preserves_three_segregation + {S : Type u} + [TopologicalSpace S] + {α : Type v} + {β : Type w} + {G₀ : Graph α β} + {G' : Graph α β} + {J : Graph α β} + {H : Drawing S} + {η₀ : SpanEmbedding H G₀} + {S_seg : Set (Society α β)} + (hJ : IsBridge G₀ η₀.imageGraph J) + (hG'_le : G' ≤ G₀) + (hG₀_eq : G₀ = subgraphUnion G₀ G' J) + (hSeg : IsThreeSegregation G' S_seg) + (A₀ : Society α β) + (G_A : Graph α β) + (hV_GA : V(G_A) = V(A₀.G) ∪ V(J)) + (hE_GA : E(G_A) = E(A₀.G) ∪ E(J)) + (A₀' : Society α β) + (hA₀G : A₀'.G = G_A) + (f : Society α β → Society α β) + (hf_mem : ∀ S₀ ∈ (insert A₀' (S_seg \ {A₀})), f S₀ ∈ S_seg) + (hf_inj : InjOn f (insert A₀' (S_seg \ {A₀}))) + (hf_surj : SurjOn f (insert A₀' (S_seg \ {A₀})) S_seg) + (hf_Ω : ∀ S₀ ∈ (insert A₀' (S_seg \ {A₀})), (f S₀).Ω = S₀.Ω) + (hf_V : ∀ S₀ ∈ (insert A₀' (S_seg \ {A₀})), V(S₀.G) ∩ V(G') = V((f S₀).G)) + (hf_E : ∀ S₀ ∈ (insert A₀' (S_seg \ {A₀})), E(S₀.G) ∩ E(G') = E((f S₀).G)) + (hS_seg_G_le : ∀ S₀ ∈ (insert A₀' (S_seg \ {A₀})), S₀.G ≤ G₀) + (hS_seg_G_le_img : ∀ Q ∈ (fun S₀ => S₀.G) '' (insert A₀' (S_seg \ {A₀})), Q ≤ G₀) + (hS_seg_le_img : ∀ Q ∈ (fun S₀ => S₀.G) '' S_seg, Q ≤ G') : + IsThreeSegregation G₀ (insert A₀' (S_seg \ {A₀})) := by + let S_seg_G := insert A₀' (S_seg \ {A₀}) + refine ⟨⟨(hSeg.1.finite.subset sdiff_subset).insert A₀', hS_seg_G_le, ?_, ?_, ?_⟩, + fun S₀ hS₀ => hf_Ω S₀ hS₀ ▸ hSeg.2 (f S₀) (hf_mem S₀ hS₀)⟩ + · have hV_G₀ : V(G₀) = V(G') ∪ V(J) := + (congrArg Graph.vertexSet hG₀_eq).trans (vertexSet_subgraphUnion G₀ G' J) + have hE_G₀ : E(G₀) = E(G') ∪ E(J) := + (congrArg Graph.edgeSet hG₀_eq).trans (edgeSet_subgraphUnion hG'_le hJ.2.1) + refine (Compatible.of_le_le (subgraphSUnion_le hS_seg_G_le_img) le_rfl).ext ?_ ?_ + · rw [vertexSet_subgraphSUnion] + ext x + simp only [mem_iUnion, mem_image, exists_prop] + refine ⟨fun ⟨_, ⟨S₀, hS₀, rfl⟩, hx⟩ => (hS_seg_G_le S₀ hS₀).vertexSet_mono hx, + fun hxG₀ => ?_⟩ + rcases hV_G₀ ▸ hxG₀ with hxG' | hxJ + · have hx_u : x ∈ V(subgraphSUnion G' ((fun S₀ : Society α β => S₀.G) '' S_seg)) := + hSeg.1.union_eq.symm ▸ hxG' + rw [vertexSet_subgraphSUnion] at hx_u + simp only [mem_iUnion, mem_image, exists_prop] at hx_u + obtain ⟨_, ⟨S₀, hS₀, rfl⟩, hxS₀⟩ := hx_u + obtain ⟨S₁, hS₁, hEq⟩ := hf_surj hS₀ + exact ⟨S₁.G, ⟨S₁, hS₁, rfl⟩, ((hf_V S₁ hS₁).symm ▸ hEq ▸ hxS₀).1⟩ + · exact ⟨A₀'.G, ⟨A₀', Or.inl rfl, rfl⟩, hA₀G.symm ▸ hV_GA ▸ Or.inr hxJ⟩ + · rw [edgeSet_subgraphSUnion hS_seg_G_le_img] + ext e + simp only [mem_iUnion, mem_image, exists_prop] + refine ⟨fun ⟨_, ⟨S₀, hS₀, rfl⟩, he⟩ => (hS_seg_G_le S₀ hS₀).edgeSet_mono he, + fun heG₀ => ?_⟩ + rcases hE_G₀ ▸ heG₀ with heG' | heJ + · have he_u : e ∈ E(subgraphSUnion G' ((fun S₀ : Society α β => S₀.G) '' S_seg)) := + hSeg.1.union_eq.symm ▸ heG' + rw [edgeSet_subgraphSUnion hS_seg_le_img] at he_u + simp only [mem_iUnion, mem_image, exists_prop] at he_u + obtain ⟨_, ⟨S₀, hS₀, rfl⟩, heS₀⟩ := he_u + obtain ⟨S₁, hS₁, hEq⟩ := hf_surj hS₀ + exact ⟨S₁.G, ⟨S₁, hS₁, rfl⟩, ((hf_E S₁ hS₁).symm ▸ hEq ▸ heS₀).1⟩ + · exact ⟨A₀'.G, ⟨A₀', Or.inl rfl, rfl⟩, hA₀G.symm ▸ hE_GA ▸ Or.inr heJ⟩ + · intro S₁ hS₁ S₂ hS₂ hne + have hf_ne : f S₁ ≠ f S₂ := fun h => hne (hf_inj hS₁ hS₂ h) + have hsub : V(S₁.G) ∩ V(S₂.G) ⊆ V((f S₁).G) ∩ V((f S₂).G) := by + rw [← hf_V S₁ hS₁, ← hf_V S₂ hS₂] + rcases hS₁ with rfl | ⟨hS₁_in, _⟩ <;> rcases hS₂ with rfl | ⟨hS₂_in, _⟩ + · exact (hne rfl).elim + · intro x ⟨hx₁, hx₂⟩ + have hxG' : x ∈ V(G') := (hSeg.1.le S₂ hS₂_in).vertexSet_mono hx₂ + exact ⟨⟨hx₁, hxG'⟩, ⟨hx₂, hxG'⟩⟩ + · intro x ⟨hx₁, hx₂⟩ + have hxG' : x ∈ V(G') := (hSeg.1.le S₁ hS₁_in).vertexSet_mono hx₁ + exact ⟨⟨hx₁, hxG'⟩, ⟨hx₂, hxG'⟩⟩ + · intro x ⟨hx₁, hx₂⟩ + exact ⟨⟨hx₁, (hSeg.1.le S₁ hS₁_in).vertexSet_mono hx₁⟩, + ⟨hx₂, (hSeg.1.le S₂ hS₂_in).vertexSet_mono hx₂⟩⟩ + rw [← hf_Ω S₁ hS₁, ← hf_Ω S₂ hS₂] + exact hsub.trans (hSeg.1.vertex_inter_subset (f S₁) (hf_mem S₁ hS₁) (f S₂) + (hf_mem S₂ hS₂) hf_ne) + · intro S₁ hS₁ S₂ hS₂ hne + have hf_ne : f S₁ ≠ f S₂ := fun h => hne (hf_inj hS₁ hS₂ h) + have hdisj := hSeg.1.edge_disjoint (f S₁) (hf_mem S₁ hS₁) (f S₂) (hf_mem S₂ hS₂) hf_ne + rw [← hf_E S₁ hS₁, ← hf_E S₂ hS₂] at hdisj + refine Set.disjoint_left.mpr fun e he₁ he₂ => ?_ + rcases hS₁ with rfl | ⟨hS₁_in, _⟩ <;> rcases hS₂ with rfl | ⟨hS₂_in, _⟩ + · exact hne rfl + · have heG' : e ∈ E(G') := (hSeg.1.le S₂ hS₂_in).edgeSet_mono he₂ + exact Set.disjoint_left.mp hdisj ⟨he₁, heG'⟩ ⟨he₂, heG'⟩ + · have heG' : e ∈ E(G') := (hSeg.1.le S₁ hS₁_in).edgeSet_mono he₁ + exact Set.disjoint_left.mp hdisj ⟨he₁, heG'⟩ ⟨he₂, heG'⟩ + · exact Set.disjoint_left.mp hdisj + ⟨he₁, (hSeg.1.le S₁ hS₁_in).edgeSet_mono he₁⟩ + ⟨he₂, (hSeg.1.le S₂ hS₂_in).edgeSet_mono he₂⟩ + +private theorem disjoint_bridge_piece_preserves_tangle_locality + {S : Type u} + [TopologicalSpace S] + {α : Type v} + {β : Type w} + {G₀ : Graph α β} + {G' : Graph α β} + {H : Drawing S} + {η₀ : SpanEmbedding H G₀} + {η' : SpanEmbedding H G'} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {S_seg : Set (Society α β)} + (hG'_le : G' ≤ G₀) + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η₀.vMap v) + (hη'_e : ∀ e ∈ H.E, η'.eMap e = η₀.eMap e) + (hSeg : IsThreeSegregation G' S_seg) + (hLoc : IsTangleLocal G' H η' T S_seg) + (S_seg_G : Set (Society α β)) + (f : Society α β → Society α β) + (hf_mem : ∀ S₀ ∈ S_seg_G, f S₀ ∈ S_seg) + (hf_Ω : ∀ S₀ ∈ S_seg_G, (f S₀).Ω = S₀.Ω) + (hf_V : ∀ S₀ ∈ S_seg_G, V(S₀.G) ∩ V(G') = V((f S₀).G)) + (hf_E : ∀ S₀ ∈ S_seg_G, E(S₀.G) ∩ E(G') = E((f S₀).G)) : + IsTangleLocal G₀ H η₀ T S_seg_G := by + intro S₀ hS₀ B hsepB hVB_eq + let B' : Graph α β := (G'.induce (V(B) ∩ V(G'))).restrict E(B) + have hV_B' : V(B') = V(B) ∩ V(G') := by simp [B'] + have hE_B' : E(B') = E(B) ∩ E(G') := by + ext e + simp only [B', edgeSet_restrict, edgeSet_induce, mem_inter_iff] + refine ⟨fun ⟨⟨u_e, v_e, hlink, _, _⟩, heB⟩ => ⟨heB, hlink.edge_mem⟩, fun ⟨heB, heG'⟩ => ?_⟩ + obtain ⟨u_e, v_e, hlink⟩ := G'.exists_isLink_of_mem_edgeSet heG' + have hlink_B : B.IsLink e u_e v_e := + (hsepB.2.1.isLink_iff heB).mpr (hlink.mono hG'_le) + exact ⟨⟨u_e, v_e, hlink, ⟨hlink_B.left_mem, hlink.left_mem⟩, + ⟨hlink_B.right_mem, hlink.right_mem⟩⟩, heB⟩ + have hB'_le : B' ≤ G' := restrict_le.trans (G'.induce_le inter_subset_right) + have hfS₀_le : (f S₀).G ≤ G' := hSeg.1.le (f S₀) (hf_mem S₀ hS₀) + have hsepB' : IsGraphSeparation G' (f S₀).G B' := by + refine ⟨hfS₀_le, hB'_le, ?_, ?_, ?_⟩ + · rw [← hf_V S₀ hS₀, hV_B', ← union_inter_distrib_right, hsepB.2.2.1] + exact inter_eq_right.mpr hG'_le.vertexSet_mono + · rw [← hf_E S₀ hS₀, hE_B', ← union_inter_distrib_right, hsepB.2.2.2.1] + exact inter_eq_right.mpr hG'_le.edgeSet_mono + · rw [← hf_E S₀ hS₀, hE_B'] + exact hsepB.2.2.2.2.mono inter_subset_left inter_subset_left + have hVB'_eq : V((f S₀).G) ∩ V(B') = (f S₀).Ω.bar := by + rw [← hf_V S₀ hS₀, hV_B', hf_Ω S₀ hS₀] + ext x + simp only [mem_inter_iff] + refine ⟨fun ⟨⟨hxS, _⟩, ⟨hxB, _⟩⟩ => hVB_eq ▸ ⟨hxS, hxB⟩, fun hxbar => ?_⟩ + have hxG' : x ∈ V(G') := + hfS₀_le.vertexSet_mono ((f S₀).bar_subset (hf_Ω S₀ hS₀ ▸ hxbar)) + have hx_inter : x ∈ V(S₀.G) ∩ V(B) := hVB_eq.symm ▸ hxbar + exact ⟨⟨hx_inter.1, hxG'⟩, ⟨hx_inter.2, hxG'⟩⟩ + obtain ⟨A_H, B_H, hsep_H, hAH_V, hBH_V, hAH_E, hBH_E, hT_mem⟩ := + hLoc (f S₀) (hf_mem S₀ hS₀) B' hsepB' hVB'_eq + refine ⟨A_H, B_H, hsep_H, ?_, ?_, ?_, ?_, hT_mem⟩ + · rw [hAH_V, ← hf_V S₀ hS₀] + ext v + simp only [mem_sep_iff, mem_inter_iff] + exact ⟨fun ⟨hv, hvS, _⟩ => ⟨hv, hη'_v v hv ▸ hvS⟩, + fun ⟨hv, hvS⟩ => ⟨hv, (hη'_v v hv).symm ▸ hvS, + η'.imageGraph_le.vertexSet_mono (η'.bijOn_v.mapsTo hv)⟩⟩ + · rw [hBH_V, hV_B'] + ext v + simp only [mem_sep_iff, mem_inter_iff] + exact ⟨fun ⟨hv, hvB, _⟩ => ⟨hv, hη'_v v hv ▸ hvB⟩, + fun ⟨hv, hvB⟩ => ⟨hv, (hη'_v v hv).symm ▸ hvB, + η'.imageGraph_le.vertexSet_mono (η'.bijOn_v.mapsTo hv)⟩⟩ + · rw [hAH_E, ← hf_E S₀ hS₀] + ext e + simp only [mem_sep_iff, mem_inter_iff] + exact ⟨fun ⟨he, heS, _⟩ => ⟨he, hη'_e e he ▸ heS⟩, + fun ⟨he, heS⟩ => ⟨he, (hη'_e e he).symm ▸ heS, + η'.imageGraph_le.edgeSet_mono (η'.bijOn_e.mapsTo he)⟩⟩ + · rw [hBH_E, hE_B'] + ext e + simp only [mem_sep_iff, mem_inter_iff] + exact ⟨fun ⟨he, heB, _⟩ => ⟨he, hη'_e e he ▸ heB⟩, + fun ⟨he, heB⟩ => ⟨he, (hη'_e e he).symm ▸ heB, + η'.imageGraph_le.edgeSet_mono (η'.bijOn_e.mapsTo he)⟩⟩ + +/-- Vertex-disjoint bridge case in the proof of (10.1) (page 49): when `J` is a bridge of `η₀(H)` in +`G₀` with `V(H ∩ J) = ∅`, replacing some `(A₀, Ω₀) ∈ S_seg` by `(A₀ ∪ J, Ω₀)` extends a `T`-local +3-segregation of `G'` and compatible arrangement to `G₀`. -/ +private theorem disjoint_bridge_step_10_1 {α : Type v} {β : Type w} + {G₀ G' J : Graph α β} {H : Drawing S} {η₀ : SpanEmbedding H G₀} {η' : SpanEmbedding H G'} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {θ : ℕ} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + (hV_fin : V(G₀).Finite) (hE_fin : E(G₀).Finite) + (hMetric : HasTangleMetric H θ T d) (hθ : 17 ≤ θ) + (hJ : IsBridge G₀ η₀.imageGraph J) + (hG'_le : G' ≤ G₀) + (hG₀_eq : G₀ = subgraphUnion G₀ G' J) + (hDisj_E : Disjoint E(G') E(J)) + (hInter_V : V(G') ∩ V(J) ⊆ V(η₀.imageGraph)) + (hVJ_empty : ∀ v ∈ H.V, η₀.vMap v ∉ V(J)) + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η₀.vMap v) + (hη'_e : ∀ e ∈ H.E, η'.eMap e = η₀.eMap e) + (hSeg : IsThreeSegregation G' S_seg) + (hLoc : IsTangleLocal G' H η' T S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) : + ∃ (S_seg_G : Set (Society α β)) (α_disc_G : Society α β → Set S) (α_pt_G : α → S), + IsThreeSegregation G₀ S_seg_G ∧ IsTangleLocal G₀ H η₀ T S_seg_G ∧ + IsSurfaceArrangement S_seg_G α_disc_G α_pt_G ∧ + IsCompatibleWith G₀ H η₀ S_seg_G α_disc_G α_pt_G := by + classical + have hDisj_V : Disjoint V(G') V(J) := by + refine Set.disjoint_left.mpr fun x hxG' hxJ => ?_ + obtain ⟨v, hvH, rfl⟩ := η₀.bijOn_v.surjOn (hInter_V ⟨hxG', hxJ⟩) + exact hVJ_empty v hvH hxJ + have hVJ_ne : V(J).Nonempty := by + rcases hJ.2.2 with ⟨e, _, u, huH, v, _, _, hVJ, _⟩ | ⟨C, hC_comp, hVJ, _⟩ + · obtain ⟨w, hwH, rfl⟩ := η₀.bijOn_v.surjOn huH + exact (hVJ_empty w hwH (hVJ ▸ Or.inl rfl)).elim + · obtain ⟨x, hxC⟩ := hC_comp.2.1.1 + exact ⟨x, hVJ ▸ Or.inl hxC⟩ + have hHE_ne : H.E.Nonempty := edgeSet_nonempty_of_isTangle hMetric.1.2.1 (by omega) + obtain ⟨e₀, he₀H⟩ := hHE_ne + have he₀_G' : η'.eMap e₀ ∈ E(G') := η'.imageGraph_le.edgeSet_mono (η'.bijOn_e.mapsTo he₀H) + have he₀_union : η'.eMap e₀ ∈ E(subgraphSUnion G' ((fun S₀ : Society α β => S₀.G) '' S_seg)) := + hSeg.1.union_eq.symm ▸ he₀_G' + simp only [subgraphSUnion, edgeSet_restrict, mem_inter_iff, mem_iUnion, mem_image, + exists_prop] at he₀_union + obtain ⟨_, ⟨A₀, hA₀_in, rfl⟩, _⟩ := he₀_union.2 + have hA₀_le_G₀ : A₀.G ≤ G₀ := (hSeg.1.le A₀ hA₀_in).trans hG'_le + let G_A : Graph α β := subgraphUnion G₀ A₀.G J + have hG_A_le : G_A ≤ G₀ := subgraphUnion_le hA₀_le_G₀ hJ.2.1 + have hV_GA : V(G_A) = V(A₀.G) ∪ V(J) := vertexSet_subgraphUnion G₀ A₀.G J + have hE_GA : E(G_A) = E(A₀.G) ∪ E(J) := edgeSet_subgraphUnion hA₀_le_G₀ hJ.2.1 + have hbar_GA : A₀.Ω.bar ⊆ V(G_A) := + A₀.bar_subset.trans (hV_GA ▸ subset_union_left) + let A₀' : Society α β := + ⟨G_A, A₀.Ω, hV_fin.subset hG_A_le.vertexSet_mono, hE_fin.subset hG_A_le.edgeSet_mono, hbar_GA⟩ + have hA₀'_not_in : A₀' ∉ S_seg := by + intro h_in + obtain ⟨x, hxJ⟩ := hVJ_ne + have hxG' : x ∈ V(G') := + (hSeg.1.le A₀' h_in).vertexSet_mono (hV_GA ▸ Or.inr hxJ) + exact Set.disjoint_left.mp hDisj_V hxG' hxJ + let S_seg_G : Set (Society α β) := insert A₀' (S_seg \ {A₀}) + let f : Society α β → Society α β := fun S₀ => if S₀ = A₀' then A₀ else S₀ + let α_disc_G : Society α β → Set S := fun S₀ => α_disc (f S₀) + have hf_mem : ∀ S₀ ∈ S_seg_G, f S₀ ∈ S_seg := by + rintro S₀ (rfl | ⟨hS₀_in, _⟩) + · simp [f, hA₀_in] + · have hne : S₀ ≠ A₀' := fun h => hA₀'_not_in (h ▸ hS₀_in) + simp [f, hne, hS₀_in] + have hf_inj : InjOn f S_seg_G := by + rintro S₁ (rfl | ⟨hS₁, hne₁⟩) S₂ (rfl | ⟨hS₂, hne₂⟩) hEq + · rfl + · have hne₂' : S₂ ≠ A₀' := fun h => hA₀'_not_in (h ▸ hS₂) + simp only [f, ↓reduceIte, hne₂'] at hEq + exact (hne₂ hEq.symm).elim + · have hne₁' : S₁ ≠ A₀' := fun h => hA₀'_not_in (h ▸ hS₁) + simp only [f, hne₁', ↓reduceIte] at hEq + exact (hne₁ hEq).elim + · have hne₁' : S₁ ≠ A₀' := fun h => hA₀'_not_in (h ▸ hS₁) + have hne₂' : S₂ ≠ A₀' := fun h => hA₀'_not_in (h ▸ hS₂) + simpa [f, hne₁', hne₂'] using hEq + have hf_surj : SurjOn f S_seg_G S_seg := by + intro S₀ hS₀ + by_cases h : S₀ = A₀ + · subst h + exact ⟨A₀', Or.inl rfl, by simp [f]⟩ + · have hne : S₀ ≠ A₀' := fun h' => hA₀'_not_in (h' ▸ hS₀) + exact ⟨S₀, Or.inr ⟨hS₀, h⟩, by simp [f, hne]⟩ + have hf_Ω : ∀ S₀ ∈ S_seg_G, (f S₀).Ω = S₀.Ω := by + rintro S₀ (rfl | ⟨hS₀_in, _⟩) + · simp [f, A₀'] + · have hne : S₀ ≠ A₀' := fun h => hA₀'_not_in (h ▸ hS₀_in) + simp [f, hne] + have hf_V : ∀ S₀ ∈ S_seg_G, V(S₀.G) ∩ V(G') = V((f S₀).G) := by + rintro S₀ (rfl | ⟨hS₀_in, _⟩) + · simp only [f, ↓reduceIte, A₀', hV_GA, union_inter_distrib_right, + hDisj_V.symm.inter_eq, union_empty] + exact inter_eq_left.mpr (hSeg.1.le A₀ hA₀_in).vertexSet_mono + · have hne : S₀ ≠ A₀' := fun h => hA₀'_not_in (h ▸ hS₀_in) + simp only [f, hne, ↓reduceIte] + exact inter_eq_left.mpr (hSeg.1.le S₀ hS₀_in).vertexSet_mono + have hf_E : ∀ S₀ ∈ S_seg_G, E(S₀.G) ∩ E(G') = E((f S₀).G) := by + rintro S₀ (rfl | ⟨hS₀_in, _⟩) + · simp only [f, ↓reduceIte, A₀', hE_GA, union_inter_distrib_right, + hDisj_E.symm.inter_eq, union_empty] + exact inter_eq_left.mpr (hSeg.1.le A₀ hA₀_in).edgeSet_mono + · have hne : S₀ ≠ A₀' := fun h => hA₀'_not_in (h ▸ hS₀_in) + simp only [f, hne, ↓reduceIte] + exact inter_eq_left.mpr (hSeg.1.le S₀ hS₀_in).edgeSet_mono + have hsegV_eq : segregationVertices S_seg_G = segregationVertices S_seg := by + ext x + simp only [segregationVertices, mem_iUnion, exists_prop] + refine ⟨fun ⟨S₀, hS₀, hx⟩ => ⟨f S₀, hf_mem S₀ hS₀, (hf_Ω S₀ hS₀).symm ▸ hx⟩, + fun ⟨S₀, hS₀, hx⟩ => ?_⟩ + obtain ⟨S₁, hS₁, rfl⟩ := hf_surj hS₀ + exact ⟨S₁, hS₁, (hf_Ω S₁ hS₁) ▸ hx⟩ + have hS_seg_G_le : ∀ S₀ ∈ S_seg_G, S₀.G ≤ G₀ := by + rintro S₀ (rfl | ⟨hS₀_in, _⟩) + · exact hG_A_le + · exact (hSeg.1.le S₀ hS₀_in).trans hG'_le + have hS_seg_G_le_img : ∀ Q ∈ (fun S₀ : Society α β => S₀.G) '' S_seg_G, Q ≤ G₀ := by + rintro _ ⟨S₀, hS₀, rfl⟩ + exact hS_seg_G_le S₀ hS₀ + have hS_seg_le_img : ∀ Q ∈ (fun S₀ : Society α β => S₀.G) '' S_seg, Q ≤ G' := by + rintro _ ⟨S₀, hS₀, rfl⟩ + exact hSeg.1.le S₀ hS₀ + have h3seg_G : IsThreeSegregation G₀ S_seg_G := by + exact disjoint_bridge_piece_preserves_three_segregation (S := S) (α := α) (β := β) (G₀ := G₀) + (G' := G') (J := J) (H := H) (η₀ := η₀) (S_seg := S_seg) hJ hG'_le hG₀_eq hSeg A₀ G_A hV_GA + hE_GA A₀' rfl f hf_mem hf_inj hf_surj hf_Ω hf_V hf_E hS_seg_G_le hS_seg_G_le_img hS_seg_le_img + have hArr_G : IsSurfaceArrangement S_seg_G α_disc_G α_pt := by + refine ⟨fun S₀ hS₀ => hf_Ω S₀ hS₀ ▸ hArr.isClosedDisc (f S₀) (hf_mem S₀ hS₀), + fun S₁ hS₁ S₂ hS₂ hne => ?_, + fun S₀ hS₀ => hf_Ω S₀ hS₀ ▸ hArr.inter_bd (f S₀) (hf_mem S₀ hS₀), + hsegV_eq ▸ hArr.injOn_pts, + fun S₀ hS₀ => hf_Ω S₀ hS₀ ▸ hArr.natural_order (f S₀) (hf_mem S₀ hS₀)⟩ + rw [← hf_Ω S₁ hS₁, ← hf_Ω S₂ hS₂] + exact hArr.inter_discs (f S₁) (hf_mem S₁ hS₁) (f S₂) (hf_mem S₂ hS₂) + (fun h => hne (hf_inj hS₁ hS₂ h)) + have hComp_G : IsCompatibleWith G₀ H η₀ S_seg_G α_disc_G α_pt := by + refine ⟨?_, ?_, ?_, ?_⟩ + · intro v hvH hv_seg + rw [← hη'_v v hvH] + exact hComp.pt_eq v hvH (hsegV_eq ▸ hη'_v v hvH ▸ hv_seg) + · intro S₀ hS₀ + rw [show α_disc_G S₀ = α_disc (f S₀) from rfl, hComp.bd_inter_eq (f S₀) (hf_mem S₀ hS₀), + hf_Ω S₀ hS₀] + ext v + simp only [mem_sep_iff] + exact ⟨fun ⟨hv, h⟩ => ⟨hv, hη'_v v hv ▸ h⟩, fun ⟨hv, h⟩ => ⟨hv, (hη'_v v hv).symm ▸ h⟩⟩ + · intro S₀ hS₀ v hvH + rw [show α_disc_G S₀ = α_disc (f S₀) from rfl, hComp.inter_V_iff (f S₀) (hf_mem S₀ hS₀) v hvH, + hη'_v v hvH, ← hf_V S₀ hS₀, mem_inter_iff] + have hvG' : η₀.vMap v ∈ V(G') := + hη'_v v hvH ▸ η'.imageGraph_le.vertexSet_mono (η'.bijOn_v.mapsTo hvH) + exact ⟨fun h => h.1, fun h => ⟨h, hvG'⟩⟩ + · intro S₀ hS₀ e heH + rw [show α_disc_G S₀ = α_disc (f S₀) from rfl, hComp.inter_E_iff (f S₀) (hf_mem S₀ hS₀) e heH, + hη'_e e heH, ← hf_E S₀ hS₀, mem_inter_iff] + have heG' : η₀.eMap e ∈ E(G') := + hη'_e e heH ▸ η'.imageGraph_le.edgeSet_mono (η'.bijOn_e.mapsTo heH) + exact ⟨fun h => h.1, fun h => ⟨h, heG'⟩⟩ + have hLoc_G : IsTangleLocal G₀ H η₀ T S_seg_G := by + exact disjoint_bridge_piece_preserves_tangle_locality (S := S) (α := α) (β := β) (G₀ := G₀) + (G' := G') (H := H) (η₀ := η₀) (η' := η') (T := T) (S_seg := S_seg) hG'_le hη'_v hη'_e hSeg + hLoc S_seg_G f hf_mem hf_Ω hf_V hf_E + exact ⟨S_seg_G, α_disc_G, α_pt, h3seg_G, hLoc_G, hArr_G, hComp_G⟩ + +omit [T2Space S] in +private theorem ends_toHypergraph_eq {H : Drawing S} {e : Set S} (he : e ∈ H.E) : + H.toHypergraph.ends e = closure e ∩ H.V := by + ext v + simp only [Hypergraph.ends, mem_ofPred_eq, mem_inter_iff] + exact ⟨fun ⟨_, hv, hcl⟩ => ⟨hcl, hv⟩, fun ⟨hcl, hv⟩ => ⟨he, hv, hcl⟩⟩ + +omit [T2Space S] in +/-- Every closed surface `S : Type u` is homeomorphic to a topological space `T : Type 0`. -/ +private theorem exists_homeomorph_type_zero (hS : IsClosedSurface S) : + ∃ (T : Type) (_ : TopologicalSpace T), Nonempty (S ≃ₜ T) := by + classical + have : CompactSpace S := hS.1 + have hchart : ∀ x : S, IsInteriorPoint x := hS.2.2 + choose U hU_open hxU hφ using hchart + obtain ⟨F, hF_cov⟩ := + isCompact_univ.elim_finite_subcover U hU_open (fun x _ => mem_iUnion.mpr ⟨x, hxU x⟩) + let eF : F ≃ Fin F.card := F.equivFin + have hex : ∀ s : S, ∃ x : F, s ∈ U x.1 := by + intro s + obtain ⟨x, hx⟩ := mem_iUnion.mp (hF_cov (mem_univ s)) + obtain ⟨hxF, hsU⟩ := mem_iUnion.mp hx + exact ⟨⟨x, hxF⟩, hsU⟩ + let φ : ∀ x : S, U x ≃ₜ OpenUnitDisc := fun x => Classical.choice (hφ x) + let toZero : S → Fin F.card × OpenUnitDisc := fun s => + (eF (Classical.choose (hex s)), + φ (Classical.choose (hex s)).1 ⟨s, Classical.choose_spec (hex s)⟩) + have haux : ∀ {s₁ s₂ : S} (x₁ x₂ : F) (hs₁ : s₁ ∈ U x₁.1) (hs₂ : s₂ ∈ U x₂.1), + x₁ = x₂ → + φ x₁.1 ⟨s₁, hs₁⟩ = φ x₂.1 ⟨s₂, hs₂⟩ → + s₁ = s₂ := by + rintro s₁ s₂ x₁ _ hs₁ hs₂ rfl hφ_eq + exact congrArg Subtype.val ((φ x₁.1).injective hφ_eq) + have htoZero_inj : Function.Injective toZero := by + intro s₁ s₂ hEq + exact haux (Classical.choose (hex s₁)) (Classical.choose (hex s₂)) + (Classical.choose_spec (hex s₁)) (Classical.choose_spec (hex s₂)) + (eF.injective (congrArg Prod.fst hEq)) (congrArg Prod.snd hEq) + let T : Type := range toZero + let e : S ≃ T := Equiv.ofInjective toZero htoZero_inj + let topT : TopologicalSpace T := TopologicalSpace.induced e.symm inferInstance + have hind : @Topology.IsInducing T S topT _ e.symm := ⟨rfl⟩ + exact ⟨T, topT, ⟨(@Equiv.toHomeomorphOfIsInducing T S topT _ e.symm hind).symm⟩⟩ + +omit [T2Space S] in +/-- Universe-polymorphic wrapper around `exists_edge_lens` for `S : Type u`. -/ +private theorem exists_edge_lens_univ (hS : IsClosedSurface S) + {L : Set S} {u v : S} (hL : IsLineWithEnds L u v) (huv : u ≠ v) + {Z : Set S} (hZ : IsClosed Z) (hLZ : L ∩ Z ⊆ {u, v}) : + ∃ D : Set S, + IsClosedDisc D ∧ L ⊆ D ∧ D ∩ Z ⊆ {u, v} ∧ + u ∈ discBd D ∧ v ∈ discBd D ∧ discBd D ∩ L ⊆ {u, v} := by + obtain ⟨T, _, ⟨ψ⟩⟩ := exists_homeomorph_type_zero hS + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hT : IsClosedSurface T := + ⟨ψ.compactSpace, ψ.t2Space, fun y => by + simpa using (isInteriorPoint_homeomorph_iff ψ (ψ.symm y)).mpr (hS.2.2 (ψ.symm y))⟩ + have hL' : IsLineWithEnds (ψ '' L) (ψ u) (ψ v) := by + obtain ⟨f, hf0, hf1⟩ := hL + exact ⟨f.trans (ψ.image L), congrArg ψ hf0, congrArg ψ hf1⟩ + have huv' : ψ u ≠ ψ v := fun h => huv (ψ.injective h) + have hZ' : IsClosed (ψ '' Z) := ψ.isClosedMap Z hZ + have hLZ' : (ψ '' L) ∩ (ψ '' Z) ⊆ {ψ u, ψ v} := by + rintro _ ⟨⟨x, hxL, rfl⟩, ⟨y, hyZ, hxy⟩⟩ + have hxy' : y = x := ψ.injective hxy + subst hxy' + rcases hLZ ⟨hxL, hyZ⟩ with rfl | rfl <;> simp + obtain ⟨D', _, _, hD'_disc, hL'_sub, hD'Z', hu'_bd, hv'_bd, hbd'_L', _⟩ := + exists_edge_lens hT hL' huv' hZ' hLZ' + let D : Set S := ψ.symm '' D' + have hD_disc : IsClosedDisc D := by + obtain ⟨φ⟩ := hD'_disc + exact ⟨φ.trans (ψ.symm.image D')⟩ + have hbd_eq : discBd D = ψ.symm '' discBd D' := by + rw [← IsClosedDisc.subBd_eq_discBd hS hD_disc, ← IsClosedDisc.subBd_eq_discBd hT hD'_disc, + ← subBd_eq_frontier' D, ← subBd_eq_frontier' D'] + exact (ψ.symm.image_frontier D').symm + refine ⟨D, hD_disc, ?_, ?_, ?_, ?_, ?_⟩ + · intro x hxL + exact ⟨ψ x, hL'_sub ⟨x, hxL, rfl⟩, ψ.symm_apply_apply x⟩ + · rintro x ⟨⟨y, hyD', rfl⟩, hxZ⟩ + have hy_in : y ∈ D' ∩ ψ '' Z := ⟨hyD', ψ.symm y, hxZ, ψ.apply_symm_apply y⟩ + rcases hD'Z' hy_in with rfl | rfl <;> simp + · rw [hbd_eq] + exact ⟨ψ u, hu'_bd, ψ.symm_apply_apply u⟩ + · rw [hbd_eq] + exact ⟨ψ v, hv'_bd, ψ.symm_apply_apply v⟩ + · rw [hbd_eq] + rintro x ⟨⟨y, hybd', rfl⟩, hxL⟩ + have hy_in : y ∈ discBd D' ∩ ψ '' L := ⟨hybd', ψ.symm y, hxL, ψ.apply_symm_apply y⟩ + rcases hbd'_L' hy_in with rfl | rfl <;> simp + +/-- Every edge of a rigid drawing `H` with a respectful tangle of order `θ ≥ 2` has two distinct +endpoints in `H.V` (`closure e` is a line with ends `u, v`). -/ +private theorem no_loop_of_rigid_tangle + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hRig : IsRigid H) (hMetric : HasTangleMetric H θ T d) (hθ : 2 ≤ θ) + {e : Set S} (he : e ∈ H.E) : + ∃ u v : S, u ≠ v ∧ closure e ∩ H.V = {u, v} ∧ IsLineWithEnds (closure e) u v := by + have : ConnectedSpace S := hConn + rcases H.edge_cond e he with hline | ⟨u, hcap, _⟩ + · exact hline + · exfalso + have hu_in : u ∈ closure e ∩ H.V := hcap ▸ mem_singleton u + have huV : u ∈ H.V := hu_in.2 + have he_hyp : e ∈ H.toHypergraph.edgeSet := + (PaintingOrDrawing.toHypergraph_edgeSet (Γ := PaintingOrDrawing.drawing H)).symm ▸ he + let A : Hypergraph S (Set S) := GM10.edgeHypergraph H.toHypergraph e + let B : Hypergraph S (Set S) := H.toHypergraph.deleteEdges {e} + have hVA : A.vertexSet = {u} := by + change H.toHypergraph.ends e = {u} + rw [ends_toHypergraph_eq he, hcap] + have hsep : H.toHypergraph.IsSeparation A B := + GM10.isSeparation_edgeHypergraph_deleteEdges he_hyp + have hord : separationOrder A B < θ := by + have hV_inter : (A ∩ B).vertexSet = {u} := by + change A.vertexSet ∩ H.V = {u} + rw [hVA] + exact inter_eq_left.mpr (singleton_subset_iff.mpr huV) + rw [separationOrder, hV_inter, ncard_singleton] + omega + have hAB : (A, B) ∈ T := + (hMetric.1.2.1.axiom1 hsep hord).resolve_right (fun hBA => hMetric.1.2.1.axiom3 hBA rfl) + obtain ⟨K, ins, hK, hd, _⟩ := hMetric.2 + obtain ⟨D, hD, hDs, hDlen, hDV, heD⟩ := + theorem_7_2_proof hS hConn ⟨e, he⟩ hMetric.1 hK hd hAB (mem_singleton e) + have hDV_sub : D.V ∩ H.V ⊆ {u} := + hDV.trans (hVA ▸ inter_subset_left) + have hUU : H.U ∩ K.U = H.V := hK.2.1.1 + have hDU_HU : D.U ∩ H.U ⊆ H.V := by + rintro x ⟨hxD, hxH⟩ + have : x ∈ H.U ∩ K.U := ⟨hxH, hDs.U_subset hxD⟩ + rwa [hUU] at this + have hDU_HV : D.U ∩ H.V ⊆ {u} := by + rintro x ⟨hxD, hxV⟩ + have hxDV : x ∈ D.V := by + by_contra hxnot + obtain ⟨g, hgD, hxg⟩ := D.exists_edge_of_mem hxD hxnot + exact ((hDs.2 hgD).2.1 hxg).2 (hK.2.1.2.1 hxV) + exact hDV_sub ⟨hxDV, hxV⟩ + have hcard_le1 : (D.U ∩ H.V).ncard ≤ 1 := + (ncard_le_ncard hDU_HV (finite_singleton u)).trans (by simp) + obtain ⟨Δ, hΔ_disc, hΔ_bd, hΔ_cases⟩ := + hRig D.U (isOArc_of_isCircuit hD) hDU_HU (by omega) + have hΔ_HU : Δ ∩ H.U ⊆ D.U := by + rcases hΔ_cases with hsub | ⟨u₁, v₁, huv_ne, hpair, _⟩ + · exact hsub + · exfalso + have hu₁ : u₁ = u := hDU_HV (hpair ▸ Or.inl rfl) + have hv₁ : v₁ = u := hDU_HV (hpair ▸ Or.inr rfl) + exact huv_ne (hu₁.trans hv₁.symm) + obtain ⟨hDdisc, hDbd, hDT⟩ := hd D hD hDs hDlen + by_cases h_eq : ins D = Δ + · obtain ⟨p, hp⟩ := he.1 + have hp_Δ : p ∈ Δ ∩ H.U := ⟨h_eq ▸ heD hp, (he.2.1 hp).1⟩ + exact (he.2.1 hp).2 (hDU_HU ⟨hΔ_HU hp_Δ, hp_Δ.2⟩) + · have hdiscBd_eq : discBd (ins D) = discBd Δ := by + rw [← IsClosedDisc.subBd_eq_discBd hS hDdisc, hDbd, + ← IsClosedDisc.subBd_eq_discBd hS hΔ_disc, hΔ_bd] + have hcov : ins D ∪ Δ = univ := cover_of_discBd_eq hS hDdisc hΔ_disc hdiscBd_eq h_eq + have hDU_ins : D.U ⊆ ins D := by + have hfr : frontier (ins D) = D.U := by rw [subBd_eq_frontier', hDbd] + exact hfr ▸ hDdisc.isClosed.frontier_subset + have hHV_ins : H.V ⊆ ins D := by + intro v hvV + have hvU : v ∈ H.U := H.V_subset_U hvV + rcases (hcov.symm ▸ mem_univ v : v ∈ ins D ∪ Δ) with hvin | hvΔ + · exact hvin + · exact hDU_ins (hΔ_HU ⟨hvΔ, hvU⟩) + have hV_eq : ((PaintingOrDrawing.drawing H).inter (ins D)).vertexSet = + H.toHypergraph.vertexSet := + inter_eq_left.mpr hHV_ins + exact hMetric.1.2.1.axiom3 hDT hV_eq + +private theorem exists_disjoint_edge_lenses + {S : Type u} + [TopologicalSpace S] + [T2Space S] + (hS : IsClosedSurface S) + {H : Drawing S} + (hends : ∀ e ∈ H.E, ∃ u v, u ≠ v ∧ closure e ∩ H.V = {u, v} ∧ IsLineWithEnds (closure e) u v) + (hcl_inter : ∀ e ∈ H.E, ∀ f ∈ H.E, e ≠ f → closure e ∩ closure f ⊆ H.V) : + ∀ (E_sub : Finset (Set S)), ↑E_sub ⊆ H.E → ∃ (D : Set S → Set S), + ∀ e ∈ E_sub, IsClosedDisc (D e) ∧ closure e ⊆ + D e ∧ D e ∩ H.V = closure e ∩ H.V ∧ H.U ∩ subBd (D e) = closure e ∩ H.V ∧ (∀ g ∈ H.E, g ≠ e + → D e ∩ closure g ⊆ closure e ∩ H.V ∩ (closure g ∩ H.V)) ∧ ∀ f ∈ E_sub, f ≠ e → D e ∩ D f ⊆ + closure e ∩ H.V ∩ (closure f ∩ H.V) := by + intro E_sub + induction E_sub using Finset.induction_on with + | empty => + intro _ + exact ⟨fun _ => ∅, fun _ h => (Finset.notMem_empty _ h).elim⟩ + | @insert e₀ E_sub he₀_not ih => + intro hsub + have he₀H : e₀ ∈ H.E := hsub (Finset.mem_insert_self e₀ E_sub) + have hsub' : (E_sub : Set (Set S)) ⊆ H.E := + (Finset.coe_subset.mpr (Finset.subset_insert e₀ E_sub)).trans hsub + obtain ⟨D₀, hD₀⟩ := ih hsub' + obtain ⟨u, v, huv, hcap, hL⟩ := hends e₀ he₀H + let Z : Set S := H.V ∪ (⋃ g ∈ H.E \ {e₀}, closure g) ∪ (⋃ f ∈ E_sub, D₀ f) + have hZ : IsClosed Z := + (H.finite_V.isClosed.union + ((H.finite_edges.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure)).union + (E_sub.finite_toSet.isClosed_biUnion fun f hf => (hD₀ f hf).1.isClosed) + have hLZ : closure e₀ ∩ Z ⊆ {u, v} := by + rw [← hcap] + rintro x ⟨hxe₀, (hxV | hxg) | hxf⟩ + · exact ⟨hxe₀, hxV⟩ + · simp only [mem_iUnion, exists_prop] at hxg + obtain ⟨g, ⟨hgH, hge₀⟩, hxg⟩ := hxg + exact ⟨hxe₀, hcl_inter e₀ he₀H g hgH (Ne.symm hge₀) ⟨hxe₀, hxg⟩⟩ + · simp only [mem_iUnion] at hxf + obtain ⟨f, hf_in, hxf⟩ := hxf + have hfe₀ : f ≠ e₀ := fun h => he₀_not (h ▸ hf_in) + exact ((hD₀ f hf_in).2.2.2.2.1 e₀ he₀H hfe₀.symm ⟨hxf, hxe₀⟩).2 + obtain ⟨D_new, hD_disc, hL_sub, hDZ, hu_bd, hv_bd, hbd_L⟩ := + exists_edge_lens_univ hS hL huv hZ hLZ + have hsubBd_eq : subBd D_new = discBd D_new := IsClosedDisc.subBd_eq_discBd hS hD_disc + have hD_HV : D_new ∩ H.V = closure e₀ ∩ H.V := by + apply subset_antisymm + · rw [hcap] + exact (inter_subset_inter_right D_new + (subset_union_left.trans subset_union_left)).trans hDZ + · exact inter_subset_inter_left H.V hL_sub + have hD_clg : ∀ g ∈ H.E, g ≠ e₀ → + D_new ∩ closure g ⊆ (closure e₀ ∩ H.V) ∩ (closure g ∩ H.V) := by + intro g hg hge₀ x ⟨hxD, hxg⟩ + have hxZ : x ∈ Z := Or.inl (Or.inr (mem_biUnion ⟨hg, hge₀⟩ hxg)) + have hx_uv : x ∈ closure e₀ ∩ H.V := hcap ▸ hDZ ⟨hxD, hxZ⟩ + exact ⟨hx_uv, hxg, hx_uv.2⟩ + have hD_Df : ∀ f ∈ E_sub, f ≠ e₀ → + D_new ∩ D₀ f ⊆ (closure e₀ ∩ H.V) ∩ (closure f ∩ H.V) := by + intro f hf _ x ⟨hxD, hxDf⟩ + have hxZ : x ∈ Z := Or.inr (mem_biUnion hf hxDf) + have hx_uv : x ∈ closure e₀ ∩ H.V := hcap ▸ hDZ ⟨hxD, hxZ⟩ + have hx_f : x ∈ closure f ∩ H.V := (hD₀ f hf).2.2.1 ▸ ⟨hxDf, hx_uv.2⟩ + exact ⟨hx_uv, hx_f⟩ + have hHU_bd : H.U ∩ subBd D_new = closure e₀ ∩ H.V := by + apply subset_antisymm + · rintro x ⟨hxU, hxbd⟩ + have hxD : x ∈ D_new := hD_disc.isClosed.closure_eq ▸ hxbd.1 + rw [H.U_eq] at hxU + rcases hxU with hxV | hxe + · exact hD_HV ▸ ⟨hxD, hxV⟩ + · simp only [mem_iUnion, exists_prop] at hxe + obtain ⟨g, hgH, hxg⟩ := hxe + by_cases hge₀ : g = e₀ + · subst hge₀ + rw [hsubBd_eq] at hxbd + exact hcap ▸ hbd_L ⟨hxbd, hxg⟩ + · exact (hD_clg g hgH hge₀ ⟨hxD, hxg⟩).1 + · rw [hcap, hsubBd_eq] + rintro x (rfl | rfl) + · exact ⟨H.V_subset_U (hcap ▸ Or.inl rfl : x ∈ closure e₀ ∩ H.V).2, hu_bd⟩ + · exact ⟨H.V_subset_U (hcap ▸ Or.inr rfl : x ∈ closure e₀ ∩ H.V).2, hv_bd⟩ + let D : Set S → Set S := fun e => if e = e₀ then D_new else D₀ e + refine ⟨D, fun e he => ?_⟩ + rcases Finset.mem_insert.mp he with rfl | he_in + · simp only [D, ↓reduceIte] + refine ⟨hD_disc, hL_sub, hD_HV, hHU_bd, hD_clg, fun f hf hfe => ?_⟩ + rcases Finset.mem_insert.mp hf with rfl | hf_in + · exact (hfe rfl).elim + · simp only [hfe, ↓reduceIte] + exact hD_Df f hf_in hfe + · have hee₀ : e ≠ e₀ := fun h => he₀_not (h ▸ he_in) + simp only [D, hee₀, ↓reduceIte] + obtain ⟨h1, h2, h3, h4, h5, h6⟩ := hD₀ e he_in + refine ⟨h1, h2, h3, h4, h5, fun f hf hfe => ?_⟩ + rcases Finset.mem_insert.mp hf with rfl | hf_in + · simp only [↓reduceIte] + rw [Set.inter_comm (D₀ e) D_new, Set.inter_comm (closure e ∩ H.V)] + exact hD_Df e he_in hee₀ + · have hfe₀ : f ≠ e₀ := fun h => he₀_not (h ▸ hf_in) + simp only [hfe₀, ↓reduceIte] + exact h6 f hf_in hfe + +private theorem edge_societies_form_three_segregation + {S : Type u} + [TopologicalSpace S] + {α : Type v} + {β : Type w} + (hS : IsClosedSurface S) + {G₀ : Graph α β} + {H : Drawing S} + {η₀ : SpanEmbedding H G₀} + (hbase : G₀ = η₀.imageGraph) + [ConnectedSpace S] + (K : Drawing S) + (hrf : RegionFacts (PaintingOrDrawing.drawing H) K) + (hends : ∀ e ∈ H.E, ∃ u v, u ≠ v ∧ closure e ∩ H.V = {u, v} ∧ IsLineWithEnds (closure e) u v) + (D_map : Set S → Set S) + (α_pt : α → S) + (G_e : Set S → Graph α β) + (hV_Ge : ∀ (e : Set S), V(G_e e) = (fun e => η₀.vMap '' (closure e ∩ H.V)) e) + (hE_Ge : ∀ e ∈ H.E, E(G_e e) = {η₀.eMap e}) + (Ω_map : Set S → CyclicPerm α) + (hΩ_map : ∀ e ∈ H.E, (Ω_map e).bar = (fun e => η₀.vMap '' (closure e ∩ H.V)) e ∧ + IsNaturalOrderFrom α_pt (Ω_map e) (subBd (D_map e))) + (S_map : Set S → Society α β) + (hS_map_G : ∀ e ∈ H.E, (S_map e).G = G_e e) + (hS_map_Ω : ∀ e ∈ H.E, (S_map e).Ω = Ω_map e) + (hS_seg_le : ∀ S₀ ∈ (S_map '' H.E), S₀.G ≤ G₀) + (hS_seg_le_img : ∀ Q ∈ (fun S₀ => S₀.G) '' (S_map '' H.E), Q ≤ G₀) : + IsThreeSegregation G₀ (S_map '' H.E) := by + let V_e := fun e => η₀.vMap '' (closure e ∩ H.V) + let S_seg := S_map '' H.E + refine ⟨⟨H.finite_edges.image S_map, hS_seg_le, ?_, ?_, ?_⟩, ?_⟩ + · refine (Compatible.of_le_le (subgraphSUnion_le hS_seg_le_img) le_rfl).ext ?_ ?_ + · rw [vertexSet_subgraphSUnion] + ext x + simp only [mem_iUnion, mem_image, exists_prop] + refine ⟨fun ⟨_, ⟨S₀, hS₀, rfl⟩, hx⟩ => (hS_seg_le S₀ hS₀).vertexSet_mono hx, + fun hxG₀ => ?_⟩ + obtain ⟨v, hvH, rfl⟩ := η₀.bijOn_v.surjOn (hbase ▸ hxG₀) + obtain ⟨e, heH, hve⟩ := GM11.exists_edge_of_regionFacts hS hrf hvH + refine ⟨G_e e, ⟨S_map e, ⟨e, heH, rfl⟩, hS_map_G e heH⟩, ?_⟩ + rw [hV_Ge e] + exact ⟨v, ⟨hve, hvH⟩, rfl⟩ + · rw [edgeSet_subgraphSUnion hS_seg_le_img] + ext e_G + simp only [mem_iUnion, mem_image, exists_prop] + refine ⟨fun ⟨_, ⟨S₀, hS₀, rfl⟩, he⟩ => (hS_seg_le S₀ hS₀).edgeSet_mono he, + fun heG₀ => ?_⟩ + obtain ⟨e, heH, rfl⟩ := η₀.bijOn_e.surjOn (hbase ▸ heG₀) + refine ⟨G_e e, ⟨S_map e, ⟨e, heH, rfl⟩, hS_map_G e heH⟩, ?_⟩ + rw [hE_Ge e heH] + exact mem_singleton _ + · rintro _ ⟨e₁, he₁, rfl⟩ _ ⟨e₂, he₂, rfl⟩ _ + rw [hS_map_G e₁ he₁, hS_map_G e₂ he₂, hV_Ge e₁, hV_Ge e₂, + hS_map_Ω e₁ he₁, hS_map_Ω e₂ he₂, (hΩ_map e₁ he₁).1, (hΩ_map e₂ he₂).1] + · rintro _ ⟨e₁, he₁, rfl⟩ _ ⟨e₂, he₂, rfl⟩ hne + have he_ne : e₁ ≠ e₂ := fun h => hne (h ▸ rfl) + rw [hS_map_G e₁ he₁, hS_map_G e₂ he₂, hE_Ge e₁ he₁, hE_Ge e₂ he₂, + disjoint_singleton] + exact fun h => he_ne (η₀.bijOn_e.injOn he₁ he₂ h) + · rintro _ ⟨e, he, rfl⟩ + rw [hS_map_Ω e he, (hΩ_map e he).1] + obtain ⟨u, v, _, hcap, _⟩ := hends e he + have hcard : (V_e e).ncard ≤ 2 := by + change (η₀.vMap '' (closure e ∩ H.V)).ncard ≤ 2 + rw [hcap] + exact (ncard_image_le ((finite_singleton v).insert u)).trans + ((ncard_insert_le u {v}).trans (by simp)) + exact hcard.trans (by decide) + +private theorem edge_lenses_form_surface_arrangement + {S : Type u} + [TopologicalSpace S] + {α : Type v} + {β : Type w} + (hS : IsClosedSurface S) + {G₀ : Graph α β} + {H : Drawing S} + {η₀ : SpanEmbedding H G₀} + (D_map : Set S → Set S) + (hD : ∀ e ∈ H.E, IsClosedDisc (D_map e) ∧ closure e ⊆ D_map e ∧ D_map e ∩ H.V = closure e ∩ + H.V ∧ H.U ∩ subBd (D_map e) = closure e ∩ H.V ∧ (∀ g ∈ H.E, g ≠ e → D_map e ∩ closure g ⊆ + closure e ∩ H.V ∩ (closure g ∩ H.V)) ∧ ∀ f ∈ H.E, f ≠ e → D_map e ∩ D_map f ⊆ closure e ∩ + H.V ∩ (closure f ∩ H.V)) + (α_pt : α → S) + (hα_pt_vMap : ∀ v ∈ H.V, α_pt (η₀.vMap v) = v) + (hα_pt_inj : InjOn α_pt V(G₀)) + (Ω_map : Set S → CyclicPerm α) + (hΩ_map : ∀ e ∈ H.E, (Ω_map e).bar = (fun e => η₀.vMap '' (closure e ∩ H.V)) e ∧ + IsNaturalOrderFrom α_pt (Ω_map e) (subBd (D_map e))) + (S_map : Set S → Society α β) + (hS_map_Ω : ∀ e ∈ H.E, (S_map e).Ω = Ω_map e) + (α_disc : Society α β → Set S) + (hα_disc_eq : ∀ e ∈ H.E, α_disc (S_map e) = D_map e) + (hsegV_sub : segregationVertices (S_map '' H.E) ⊆ V(G₀)) : + IsSurfaceArrangement (S_map '' H.E) α_disc α_pt := by + let V_e := fun e => η₀.vMap '' (closure e ∩ H.V) + let S_seg := S_map '' H.E + refine ⟨?_, ?_, ?_, hα_pt_inj.mono hsegV_sub, ?_⟩ + · rintro _ ⟨e, he, rfl⟩ + rw [hα_disc_eq e he, hS_map_Ω e he, (hΩ_map e he).1] + refine ⟨(hD e he).1, ?_⟩ + rintro _ ⟨v, hv_cl, rfl⟩ + rw [hα_pt_vMap v hv_cl.2] + exact ((hD e he).2.2.2.1 ▸ hv_cl).2 + · rintro _ ⟨e₁, he₁, rfl⟩ _ ⟨e₂, he₂, rfl⟩ hne + have he_ne : e₁ ≠ e₂ := fun h => hne (h ▸ rfl) + rw [hα_disc_eq e₁ he₁, hα_disc_eq e₂ he₂, + hS_map_Ω e₁ he₁, hS_map_Ω e₂ he₂, (hΩ_map e₁ he₁).1, (hΩ_map e₂ he₂).1] + intro x hx + obtain ⟨hx₁, hx₂⟩ := (hD e₁ he₁).2.2.2.2.2 e₂ he₂ he_ne.symm hx + exact ⟨η₀.vMap x, ⟨⟨x, hx₁, rfl⟩, ⟨x, hx₂, rfl⟩⟩, hα_pt_vMap x hx₁.2⟩ + · rintro _ ⟨e, he, rfl⟩ x ⟨_, hxbd⟩ + exact (hxbd (hS.2.2 x)).elim + · rintro _ ⟨e, he, rfl⟩ + rw [hα_disc_eq e he, hS_map_Ω e he] + exact (hΩ_map e he).2 + +private theorem edge_lens_arrangement_is_compatible + {S : Type u} + [TopologicalSpace S] + {α : Type v} + {β : Type w} + {G₀ : Graph α β} + {H : Drawing S} + {η₀ : SpanEmbedding H G₀} + (D_map : Set S → Set S) + (hD : ∀ e ∈ H.E, IsClosedDisc (D_map e) ∧ closure e ⊆ D_map e ∧ D_map e ∩ H.V = closure e ∩ + H.V ∧ H.U ∩ subBd (D_map e) = closure e ∩ H.V ∧ (∀ g ∈ H.E, g ≠ e → D_map e ∩ closure g ⊆ + closure e ∩ H.V ∩ (closure g ∩ H.V)) ∧ ∀ f ∈ H.E, f ≠ e → D_map e ∩ D_map f ⊆ closure e ∩ + H.V ∩ (closure f ∩ H.V)) + (α_pt : α → S) + (hα_pt_vMap : ∀ v ∈ H.V, α_pt (η₀.vMap v) = v) + (G_e : Set S → Graph α β) + (hV_Ge : ∀ (e : Set S), V(G_e e) = (fun e => η₀.vMap '' (closure e ∩ H.V)) e) + (hE_Ge : ∀ e ∈ H.E, E(G_e e) = {η₀.eMap e}) + (Ω_map : Set S → CyclicPerm α) + (hΩ_map : ∀ e ∈ H.E, (Ω_map e).bar = (fun e => η₀.vMap '' (closure e ∩ H.V)) e ∧ + IsNaturalOrderFrom α_pt (Ω_map e) (subBd (D_map e))) + (S_map : Set S → Society α β) + (hS_map_G : ∀ e ∈ H.E, (S_map e).G = G_e e) + (hS_map_Ω : ∀ e ∈ H.E, (S_map e).Ω = Ω_map e) + (α_disc : Society α β → Set S) + (hα_disc_eq : ∀ e ∈ H.E, α_disc (S_map e) = D_map e) : + IsCompatibleWith G₀ H η₀ (S_map '' H.E) α_disc α_pt := by + let V_e := fun e => η₀.vMap '' (closure e ∩ H.V) + let S_seg := S_map '' H.E + refine ⟨fun v hv _ => hα_pt_vMap v hv, ?_, ?_, ?_⟩ + · rintro _ ⟨e, he, rfl⟩ + rw [hα_disc_eq e he, (hD e he).2.2.2.1, hS_map_Ω e he, (hΩ_map e he).1] + ext v + simp only [mem_inter_iff, mem_sep_iff, mem_image] + refine ⟨fun ⟨hv_cl, hvH⟩ => ⟨hvH, v, ⟨hv_cl, hvH⟩, rfl⟩, + fun ⟨hvH, w, ⟨hw_cl, hwH⟩, hEq⟩ => ?_⟩ + have hwv : w = v := η₀.bijOn_v.injOn hwH hvH hEq + exact ⟨hwv ▸ hw_cl, hvH⟩ + · rintro _ ⟨e, he, rfl⟩ v hvH + rw [hα_disc_eq e he, hS_map_G e he, hV_Ge e] + simp only [mem_image] + refine ⟨fun hvD => ⟨v, (hD e he).2.2.1 ▸ ⟨hvD, hvH⟩, rfl⟩, + fun ⟨w, ⟨hw_cl, hwH⟩, hEq⟩ => ?_⟩ + have hwv : w = v := η₀.bijOn_v.injOn hwH hvH hEq + exact (hD e he).2.1 (hwv ▸ hw_cl) + · rintro _ ⟨e, he, rfl⟩ f hfH + rw [hα_disc_eq e he, hS_map_G e he, hE_Ge e he, mem_singleton_iff] + refine ⟨fun hfD => ?_, fun hEq => ?_⟩ + · by_contra hne + have hf_ne_e : f ≠ e := fun h => hne (h ▸ rfl) + obtain ⟨p, hp⟩ := hfH.1 + have hp_in : p ∈ D_map e ∩ closure f := ⟨hfD hp, subset_closure hp⟩ + have hp_V : p ∈ H.V := ((hD e he).2.2.2.2.1 f hfH hf_ne_e hp_in).1.2 + exact (hfH.2.1 hp).2 hp_V + · have hfe : f = e := η₀.bijOn_e.injOn hfH he hEq + subst hfe + exact subset_closure.trans (hD f hfH).2.1 + +private theorem edge_society_segregation_is_tangle_local + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {α : Type v} + {β : Type w} + {G₀ : Graph α β} + {H : Drawing S} + {η₀ : SpanEmbedding H G₀} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {θ : ℕ} + (hMetric : HasTangleMetric H θ T d) + (hθ : 17 ≤ θ) + (hends : ∀ e ∈ H.E, ∃ u v, u ≠ v ∧ closure e ∩ H.V = {u, v} ∧ IsLineWithEnds (closure e) u v) + (D_map : Set S → Set S) + (α_pt : α → S) + (hVG₀ : V(G₀) = V(η₀.imageGraph)) + (hEG₀ : E(G₀) = E(η₀.imageGraph)) + (G_e : Set S → Graph α β) + (hV_Ge : ∀ (e : Set S), V(G_e e) = (fun e => η₀.vMap '' (closure e ∩ H.V)) e) + (hE_Ge : ∀ e ∈ H.E, E(G_e e) = {η₀.eMap e}) + (Ω_map : Set S → CyclicPerm α) + (hΩ_map : ∀ e ∈ H.E, (Ω_map e).bar = (fun e => η₀.vMap '' (closure e ∩ H.V)) e ∧ + IsNaturalOrderFrom α_pt (Ω_map e) (subBd (D_map e))) + (S_map : Set S → Society α β) + (hS_map_G : ∀ e ∈ H.E, (S_map e).G = G_e e) + (hS_map_Ω : ∀ e ∈ H.E, (S_map e).Ω = Ω_map e) : + IsTangleLocal G₀ H η₀ T (S_map '' H.E) := by + let V_e := fun e => η₀.vMap '' (closure e ∩ H.V) + let S_seg := S_map '' H.E + rintro _ ⟨e, he, rfl⟩ B hsepB hVB_eq + rw [hS_map_G e he] at hsepB hVB_eq + rw [hS_map_Ω e he, (hΩ_map e he).1] at hVB_eq + have hV_B_eq : V(B) = V(G₀) := by + have hsub : V_e e ⊆ V(B) := hVB_eq.ge.trans inter_subset_right + have hu : V(G_e e) ∪ V(B) = V(G₀) := hsepB.2.2.1 + rw [hV_Ge e] at hu + exact (union_eq_right.mpr hsub).symm.trans hu + have hE_B_eq : E(B) = E(G₀) \ {η₀.eMap e} := by + have hu : E(G_e e) ∪ E(B) = E(G₀) := hsepB.2.2.2.1 + have hd : Disjoint E(G_e e) E(B) := hsepB.2.2.2.2 + rw [hE_Ge e he] at hu hd + ext f_G + simp only [mem_sdiff, mem_singleton_iff] + refine ⟨fun hfB => ⟨hsepB.2.1.edgeSet_mono hfB, + fun hEq => Set.disjoint_left.mp hd (hEq ▸ mem_singleton _) hfB⟩, + fun ⟨hfG₀, hne⟩ => (hu.symm ▸ hfG₀).resolve_left hne⟩ + have he_hyp : e ∈ H.toHypergraph.edgeSet := + (PaintingOrDrawing.toHypergraph_edgeSet (Γ := PaintingOrDrawing.drawing H)).symm ▸ he + let A_H : Hypergraph S (Set S) := GM10.edgeHypergraph H.toHypergraph e + let B_H : Hypergraph S (Set S) := H.toHypergraph.deleteEdges {e} + have hVA_H : A_H.vertexSet = closure e ∩ H.V := ends_toHypergraph_eq he + have hEA_H : A_H.edgeSet = {e} := rfl + have hsep_H : H.toHypergraph.IsSeparation A_H B_H := + GM10.isSeparation_edgeHypergraph_deleteEdges he_hyp + have hord_H : separationOrder A_H B_H < θ := by + obtain ⟨u, v, _, hcap, _⟩ := hends e he + have hV_inter : (A_H ∩ B_H).vertexSet = {u, v} := by + change A_H.vertexSet ∩ H.V = {u, v} + rw [hVA_H, Set.inter_assoc, Set.inter_self, hcap] + rw [separationOrder, hV_inter] + have hle2 : ({u, v} : Set S).ncard ≤ 2 := (ncard_insert_le u {v}).trans (by simp) + omega + have hAB_T : (A_H, B_H) ∈ T := + (hMetric.1.2.1.axiom1 hsep_H hord_H).resolve_right + (fun hBA => hMetric.1.2.1.axiom3 hBA rfl) + refine ⟨A_H, B_H, hsep_H, ?_, ?_, ?_, ?_, hAB_T⟩ + · rw [hS_map_G e he, hV_Ge e, hVA_H] + ext v + simp only [mem_inter_iff, mem_sep_iff] + refine ⟨fun ⟨hve, hvH⟩ => ⟨hvH, v, ⟨hve, hvH⟩, rfl⟩, + fun ⟨hvH, w, ⟨hwe, hwH⟩, hEq⟩ => ?_⟩ + have hwv : w = v := η₀.bijOn_v.injOn hwH hvH hEq + exact ⟨hwv ▸ hwe, hvH⟩ + · rw [hV_B_eq] + ext v + change v ∈ H.V ↔ v ∈ H.V ∧ η₀.vMap v ∈ V(G₀) + refine ⟨fun hvH => ⟨hvH, ?_⟩, fun h => h.1⟩ + rw [hVG₀] + exact η₀.bijOn_v.mapsTo hvH + · rw [hS_map_G e he, hE_Ge e he, hEA_H] + ext f + simp only [mem_singleton_iff, mem_sep_iff] + exact ⟨fun hfe => ⟨hfe ▸ he, hfe ▸ rfl⟩, fun ⟨hfH, hEq⟩ => η₀.bijOn_e.injOn hfH he hEq⟩ + · rw [hE_B_eq] + ext f + change f ∈ H.E \ {e} ↔ f ∈ H.E ∧ η₀.eMap f ∈ E(G₀) \ {η₀.eMap e} + simp only [mem_sdiff, mem_singleton_iff] + refine ⟨fun ⟨hfH, hne⟩ => ⟨hfH, ⟨by rw [hEG₀]; exact η₀.bijOn_e.mapsTo hfH, + fun hEq => hne (η₀.bijOn_e.injOn hfH he hEq)⟩⟩, + fun ⟨hfH, _, hne⟩ => ⟨hfH, fun hfe => hne (hfe ▸ rfl)⟩⟩ + +/-- Base case `G₀ = η₀.imageGraph` in the proof of (10.1) (page 49): placing a thin closed disc +around each edge of `H` via `exists_edge_lens` yields a `T`-local 3-segregation of `G₀` and an +arrangement in `S` compatible with `H`. -/ +private theorem base_case_10_1 {α : Type v} {β : Type w} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {G₀ : Graph α β} {H : Drawing S} {η₀ : SpanEmbedding H G₀} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {θ : ℕ} + (hV_fin : V(G₀).Finite) (hE_fin : E(G₀).Finite) + (hRig : IsRigid H) (hMetric : HasTangleMetric H θ T d) (hθ : 17 ≤ θ) + (hbase : G₀ = η₀.imageGraph) : + ∃ (S_seg : Set (Society α β)) (α_disc : Society α β → Set S) (α_pt : α → S), + IsThreeSegregation G₀ S_seg ∧ IsTangleLocal G₀ H η₀ T S_seg ∧ + IsSurfaceArrangement S_seg α_disc α_pt ∧ IsCompatibleWith G₀ H η₀ S_seg α_disc α_pt := by + classical + have : ConnectedSpace S := hConn + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hHE_ne : H.E.Nonempty := edgeSet_nonempty_of_isTangle hMetric.1.2.1 (by omega) + obtain ⟨K, ins, hK, _, _⟩ := hMetric.2 + have hrf := GM11.regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hHE_ne + have hends : ∀ e ∈ H.E, ∃ u v : S, u ≠ v ∧ closure e ∩ H.V = {u, v} ∧ + IsLineWithEnds (closure e) u v := + fun e he => no_loop_of_rigid_tangle hS hConn hRig hMetric (by omega) he + have hcl_inter : ∀ e ∈ H.E, ∀ f ∈ H.E, e ≠ f → closure e ∩ closure f ⊆ H.V := by + rintro e he f hf hef y ⟨h₁, h₂⟩ + by_contra hy + exact hef (H.edge_eq_of_mem he hf ((H.closure_diff_V he).subset ⟨h₁, hy⟩) + ((H.closure_diff_V hf).subset ⟨h₂, hy⟩)) + -- Construct thin closed discs `D e` around each `e ∈ H.E` inductively over `Finset (Set S)` + have hex_lenses : ∀ (E_sub : Finset (Set S)), (E_sub : Set (Set S)) ⊆ H.E → + ∃ D : Set S → Set S, + ∀ e ∈ E_sub, + IsClosedDisc (D e) ∧ + closure e ⊆ D e ∧ + D e ∩ H.V = closure e ∩ H.V ∧ + H.U ∩ subBd (D e) = closure e ∩ H.V ∧ + (∀ g ∈ H.E, g ≠ e → D e ∩ closure g ⊆ (closure e ∩ H.V) ∩ (closure g ∩ H.V)) ∧ + (∀ f ∈ E_sub, f ≠ e → D e ∩ D f ⊆ (closure e ∩ H.V) ∩ (closure f ∩ H.V)) := by + exact exists_disjoint_edge_lenses (S := S) hS (H := H) hends hcl_inter + obtain ⟨D_map, hD_map⟩ := + hex_lenses H.finite_edges.toFinset (fun e he => H.finite_edges.mem_toFinset.mp he) + have hD : ∀ e ∈ H.E, + IsClosedDisc (D_map e) ∧ + closure e ⊆ D_map e ∧ + D_map e ∩ H.V = closure e ∩ H.V ∧ + H.U ∩ subBd (D_map e) = closure e ∩ H.V ∧ + (∀ g ∈ H.E, g ≠ e → D_map e ∩ closure g ⊆ (closure e ∩ H.V) ∩ (closure g ∩ H.V)) ∧ + (∀ f ∈ H.E, f ≠ e → D_map e ∩ D_map f ⊆ (closure e ∩ H.V) ∩ (closure f ∩ H.V)) := by + intro e he + obtain ⟨h1, h2, h3, h4, h5, h6⟩ := hD_map e (H.finite_edges.mem_toFinset.mpr he) + exact ⟨h1, h2, h3, h4, h5, fun f hf hfe => h6 f (H.finite_edges.mem_toFinset.mpr hf) hfe⟩ + -- Define `α_pt : α → S` as the inverse of `η₀.vMap` on `V(G₀)` + obtain ⟨e_some, he_some⟩ := hHE_ne + obtain ⟨p_some, _⟩ := he_some.1 + let α_pt : α → S := fun x => + if hx : ∃ v ∈ H.V, η₀.vMap v = x then Classical.choose hx else p_some + have hα_pt_vMap : ∀ v ∈ H.V, α_pt (η₀.vMap v) = v := by + intro v hv + have hex : ∃ w ∈ H.V, η₀.vMap w = η₀.vMap v := ⟨v, hv, rfl⟩ + have hch := Classical.choose_spec hex + simp only [α_pt, hex, ↓reduceDIte] + exact η₀.bijOn_v.injOn hch.1 hv hch.2 + have hα_pt_inj : InjOn α_pt V(G₀) := by + intro x hx y hy hxy + obtain ⟨u, huV, rfl⟩ := η₀.bijOn_v.surjOn (hbase ▸ hx) + obtain ⟨v, hvV, rfl⟩ := η₀.bijOn_v.surjOn (hbase ▸ hy) + rw [hα_pt_vMap u huV, hα_pt_vMap v hvV] at hxy + rw [hxy] + -- For each `e ∈ H.E`, define the single-edge subgraph `G_e` and natural order `Ω_e` + have hVG₀ : V(G₀) = V(η₀.imageGraph) := congrArg (fun K => V(K)) hbase + have hEG₀ : E(G₀) = E(η₀.imageGraph) := congrArg (fun K => E(K)) hbase + let V_e : Set S → Set α := fun e => η₀.vMap '' (closure e ∩ H.V) + have hVe_sub : ∀ e : Set S, V_e e ⊆ V(G₀) := by + rintro e _ ⟨v, ⟨_, hvV⟩, rfl⟩ + rw [hVG₀] + exact η₀.bijOn_v.mapsTo hvV + let G_e : Set S → Graph α β := fun e => (G₀.induce (V_e e)).restrict {η₀.eMap e} + have hGe_le : ∀ e : Set S, G_e e ≤ G₀ := fun e => restrict_le.trans (G₀.induce_le (hVe_sub e)) + have hV_Ge : ∀ e : Set S, V(G_e e) = V_e e := fun e => by simp [G_e] + have hE_Ge : ∀ e ∈ H.E, E(G_e e) = {η₀.eMap e} := by + intro e he + ext f_G + simp only [G_e, edgeSet_restrict, edgeSet_induce, mem_inter_iff, mem_singleton_iff] + refine ⟨fun h => h.2, ?_⟩ + rintro rfl + have he_G₀ : η₀.eMap e ∈ E(G₀) := by + rw [hEG₀] + exact η₀.bijOn_e.mapsTo he + obtain ⟨x, y, hlink⟩ := G₀.exists_isLink_of_mem_edgeSet he_G₀ + obtain ⟨u, huV, rfl⟩ := η₀.bijOn_v.surjOn (hbase ▸ hlink.left_mem) + obtain ⟨v, hvV, rfl⟩ := η₀.bijOn_v.surjOn (hbase ▸ hlink.right_mem) + have hlink_H : η₀.imageGraph.IsLink (η₀.eMap e) (η₀.vMap u) (η₀.vMap v) := hbase ▸ hlink + have hu_cl : u ∈ closure e := (η₀.inc_iff e he u huV).mp hlink_H.inc_left + have hv_cl : v ∈ closure e := (η₀.inc_iff e he v hvV).mp hlink_H.inc_right + exact ⟨⟨η₀.vMap u, η₀.vMap v, hlink, ⟨u, ⟨hu_cl, huV⟩, rfl⟩, ⟨v, ⟨hv_cl, hvV⟩, rfl⟩⟩, rfl⟩ + let Ω_triv : CyclicPerm α := + { bar := ∅ + finite_bar := finite_empty + toFun := id + bijOn := bijOn_id ∅ + single_orbit := fun _ h => h.elim } + have hΩ_ex : ∀ e : Set S, + ∃ Ω : CyclicPerm α, + e ∈ H.E → Ω.bar = V_e e ∧ IsNaturalOrderFrom α_pt Ω (subBd (D_map e)) := by + intro e + by_cases he : e ∈ H.E + · have hF : IsOArc (subBd (D_map e)) := + IsClosedDisc.subBd_eq_discBd hS (hD e he).1 ▸ (hD e he).1.isOArc_discBd + have hY_fin : (V_e e).Finite := (H.finite_V.subset inter_subset_right).image η₀.vMap + have hinj : InjOn α_pt (V_e e) := hα_pt_inj.mono (hVe_sub e) + have hYF : MapsTo α_pt (V_e e) (subBd (D_map e)) := by + rintro _ ⟨v, hv_cl, rfl⟩ + rw [hα_pt_vMap v hv_cl.2] + exact ((hD e he).2.2.2.1 ▸ hv_cl).2 + obtain ⟨Ω, hbar, hNat⟩ := exists_natural_order_injOn hF hY_fin hinj hYF + exact ⟨Ω, fun _ => ⟨hbar, hNat⟩⟩ + · exact ⟨Ω_triv, fun h => (he h).elim⟩ + choose Ω_map hΩ_map using hΩ_ex + let S_map : Set S → Society α β := fun e => + if he : e ∈ H.E then + ⟨G_e e, Ω_map e, hV_fin.subset (hGe_le e).vertexSet_mono, + hE_fin.subset (hGe_le e).edgeSet_mono, (hΩ_map e he).1 ▸ (hV_Ge e).symm.subset⟩ + else + ⟨⊥, Ω_triv, finite_empty, finite_empty, empty_subset _⟩ + have hS_map_G : ∀ e ∈ H.E, (S_map e).G = G_e e := by + intro e he + simp [S_map, he] + have hS_map_Ω : ∀ e ∈ H.E, (S_map e).Ω = Ω_map e := by + intro e he + simp [S_map, he] + have hS_map_inj : InjOn S_map H.E := by + intro e₁ he₁ e₂ he₂ hEq + have hE_eq : E((S_map e₁).G) = E((S_map e₂).G) := by rw [hEq] + rw [hS_map_G e₁ he₁, hS_map_G e₂ he₂, hE_Ge e₁ he₁, hE_Ge e₂ he₂, + singleton_eq_singleton_iff] at hE_eq + exact η₀.bijOn_e.injOn he₁ he₂ hE_eq + let S_seg : Set (Society α β) := S_map '' H.E + let α_disc : Society α β → Set S := fun S₀ => + if h : ∃ e ∈ H.E, S_map e = S₀ then D_map (Classical.choose h) else ∅ + have hα_disc_eq : ∀ e ∈ H.E, α_disc (S_map e) = D_map e := by + intro e he + have hex : ∃ f ∈ H.E, S_map f = S_map e := ⟨e, he, rfl⟩ + have hch := Classical.choose_spec hex + simp only [α_disc, hex, ↓reduceDIte] + rw [hS_map_inj hch.1 he hch.2] + have hsegV_sub : segregationVertices S_seg ⊆ V(G₀) := by + rintro x hx + simp only [segregationVertices, mem_iUnion, exists_prop] at hx + obtain ⟨_, ⟨e, he, rfl⟩, hx_bar⟩ := hx + exact (hGe_le e).vertexSet_mono (hS_map_G e he ▸ (S_map e).bar_subset hx_bar) + have hS_seg_le : ∀ S₀ ∈ S_seg, S₀.G ≤ G₀ := by + rintro _ ⟨e, he, rfl⟩ + rw [hS_map_G e he] + exact hGe_le e + have hS_seg_le_img : ∀ Q ∈ (fun S₀ : Society α β => S₀.G) '' S_seg, Q ≤ G₀ := by + rintro _ ⟨S₀, hS₀, rfl⟩ + exact hS_seg_le S₀ hS₀ + have h3seg : IsThreeSegregation G₀ S_seg := by + exact edge_societies_form_three_segregation (S := S) (α := α) (β := β) hS (G₀ := G₀) (H := H) + (η₀ := η₀) hbase K hrf hends D_map α_pt G_e hV_Ge hE_Ge Ω_map hΩ_map S_map hS_map_G + hS_map_Ω hS_seg_le hS_seg_le_img + have hArr : IsSurfaceArrangement S_seg α_disc α_pt := by + exact edge_lenses_form_surface_arrangement (S := S) (α := α) (β := β) hS (G₀ := G₀) (H := H) + (η₀ := η₀) D_map hD α_pt hα_pt_vMap hα_pt_inj Ω_map hΩ_map S_map hS_map_Ω α_disc hα_disc_eq + hsegV_sub + have hComp : IsCompatibleWith G₀ H η₀ S_seg α_disc α_pt := by + exact edge_lens_arrangement_is_compatible (S := S) (α := α) (β := β) (G₀ := G₀) (H := H) (η₀ + := η₀) D_map hD α_pt hα_pt_vMap G_e hV_Ge hE_Ge Ω_map hΩ_map S_map hS_map_G hS_map_Ω α_disc + hα_disc_eq + have hLoc : IsTangleLocal G₀ H η₀ T S_seg := by + exact edge_society_segregation_is_tangle_local (S := S) (α := α) (β := β) (G₀ := G₀) (H := H) + (η₀ := η₀) (T := T) (d := d) (θ := θ) hMetric hθ hends D_map α_pt hVG₀ hEG₀ G_e hV_Ge hE_Ge + Ω_map hΩ_map S_map hS_map_G hS_map_Ω + exact ⟨S_seg, α_disc, α_pt, h3seg, hLoc, hArr, hComp⟩ + +/-! ## Disc Replacement and Arrangement Gluing for (10.1) (pages 49–50) -/ + +private theorem embedded_cell_boundary_is_image + {S : Type u} + [TopologicalSpace S] + {α : Type v} + {β : Type w} + (hS : IsClosedSurface S) + {Δ : Set S} + [T2Space S] + (S_seg_0 : Set (Society α β)) + (α_disc_D : Society α β → Set ↑Δ) + (α_pt_D : α → ↑Δ) + (harr_D : IsSurfaceArrangement S_seg_0 α_disc_D α_pt_D) + (hdisc₁_closed : ∀ B ∈ S_seg_0, IsClosedDisc ((fun B => Subtype.val '' α_disc_D B) B) ∧ (fun B + => Subtype.val '' α_disc_D B) B ⊆ Δ) : + ∀ B ∈ S_seg_0, subBd ((fun B => Subtype.val '' α_disc_D B) B) = Subtype.val '' subBd (α_disc_D + B) := by + let disc₁ := fun B => Subtype.val '' α_disc_D B + intro B hB + obtain ⟨⟨φ_bdB⟩, _⟩ := harr_D.natural_order B hB + let F_B : Set S := Subtype.val '' subBd (α_disc_D B) + let g_F : Circle → F_B := fun z => + ⟨(φ_bdB z).1.1, mem_image_of_mem Subtype.val (φ_bdB z).2⟩ + have hg_F_cont : Continuous g_F := by fun_prop + have hg_F_bij : Function.Bijective g_F := by + refine ⟨fun z₁ z₂ h => ?_, fun y => ?_⟩ + · have h0 : (g_F z₁).1 = (g_F z₂).1 := congrArg Subtype.val h + exact φ_bdB.injective (Subtype.ext (Subtype.ext h0)) + · obtain ⟨x, hx, hxy⟩ := y.2 + refine ⟨φ_bdB.symm ⟨x, hx⟩, Subtype.ext ?_⟩ + change ((φ_bdB (φ_bdB.symm ⟨x, hx⟩)).1).1 = y.1 + rw [φ_bdB.apply_symm_apply] + exact hxy + have hF_OArc : IsOArc F_B := + ⟨hg_F_cont.homeoOfEquivCompactToT2 (f := Equiv.ofBijective g_F hg_F_bij)⟩ + have hF_sub : F_B ⊆ subBd (disc₁ B) := by + rintro _ ⟨x, hx_bd, rfl⟩ + rw [← subBd_eq_frontier'] at hx_bd + rw [← subBd_eq_frontier'] + have hx_disc : x ∈ α_disc_D B := + (harr_D.isClosedDisc B hB).1.isCompact.isClosed.closure_eq ▸ hx_bd.1 + refine ⟨subset_closure (mem_image_of_mem Subtype.val hx_disc), fun hx_int => ?_⟩ + have hU_open : IsOpen ((Subtype.val : ↥Δ → S) ⁻¹' interior (disc₁ B)) := + isOpen_interior.preimage continuous_subtype_val + have hU_sub : (Subtype.val : ↥Δ → S) ⁻¹' interior (disc₁ B) ⊆ α_disc_D B := by + intro y hy + obtain ⟨z, hz, hzy⟩ := interior_subset hy + exact Subtype.val_injective hzy ▸ hz + exact hx_bd.2 (interior_maximal hU_sub hU_open hx_int) + exact (eq_subBd_of_isOArc_subset hS (hdisc₁_closed B hB).1 hF_OArc hF_sub).symm + +private theorem embedded_cell_boundary_retains_cyclic_order + {S : Type u} + [TopologicalSpace S] + {α : Type v} + {β : Type w} + {Δ : Set S} + [T2Space S] + (S_seg_0 : Set (Society α β)) + (α_disc_D : Society α β → Set ↑Δ) + (α_pt_D : α → ↑Δ) + (harr_D : IsSurfaceArrangement S_seg_0 α_disc_D α_pt_D) + (hdisc₁_subBd_eq : ∀ B ∈ S_seg_0, subBd ((fun B => Subtype.val '' α_disc_D B) B) = Subtype.val + '' subBd (α_disc_D B)) : + ∀ B ∈ S_seg_0, ∃ φ, AgreesWithOArcHomeo (fun v => ↑(α_pt_D v)) B.Ω (subBd ((fun B => + Subtype.val '' α_disc_D B) B)) φ := by + let disc₁ := fun B => Subtype.val '' α_disc_D B + let pt₁ := fun v => ↑(α_pt_D v) + intro B hB + obtain ⟨_, φ_bdB, hA_bdB⟩ := harr_D.natural_order B hB + have hbd_eq := hdisc₁_subBd_eq B hB + let g_F : Circle → subBd (disc₁ B) := fun z => + ⟨(φ_bdB z).1.1, hbd_eq.symm ▸ mem_image_of_mem Subtype.val (φ_bdB z).2⟩ + have hg_F_cont : Continuous g_F := by fun_prop + have hg_F_bij : Function.Bijective g_F := by + refine ⟨fun z₁ z₂ h => ?_, fun y => ?_⟩ + · have h0 : (g_F z₁).1 = (g_F z₂).1 := congrArg Subtype.val h + exact φ_bdB.injective (Subtype.ext (Subtype.ext h0)) + · have hy2 : y.1 ∈ Subtype.val '' subBd (α_disc_D B) := hbd_eq ▸ y.2 + obtain ⟨x, hx, hxy⟩ := hy2 + refine ⟨φ_bdB.symm ⟨x, hx⟩, Subtype.ext ?_⟩ + change ((φ_bdB (φ_bdB.symm ⟨x, hx⟩)).1).1 = y.1 + rw [φ_bdB.apply_symm_apply] + exact hxy + let φ_B_1 : Circle ≃ₜ subBd (disc₁ B) := + hg_F_cont.homeoOfEquivCompactToT2 (f := Equiv.ofBijective g_F hg_F_bij) + refine ⟨φ_B_1, fun v hv => hbd_eq.symm ▸ mem_image_of_mem Subtype.val (hA_bdB.1 v hv), + fun v₁ v₂ v₃ hcw3 => ?_⟩ + obtain ⟨t₁, t₂, t₃, ht12, ht23, ht31, h1, h2, h3⟩ := hA_bdB.2 v₁ v₂ v₃ hcw3 + exact ⟨t₁, t₂, t₃, ht12, ht23, ht31, + congrArg Subtype.val h1, congrArg Subtype.val h2, congrArg Subtype.val h3⟩ + +private theorem extended_cell_homeomorphism_preserves_boundary + {S : Type u} + [TopologicalSpace S] + {α : Type v} + {β : Type w} + (hS : IsClosedSurface S) + {Δ : Set S} + (S_seg_0 : Set (Society α β)) + (f : S → S) + (f' : S → S) + (hf_maps : MapsTo f Δ Δ) + (hf_cont : ContinuousOn f Δ) + (hf'_cont : ContinuousOn f' Δ) + (hf_left : LeftInvOn f' f Δ) + (disc₁ : Society α β → Set S) + (hdisc₁_closed : ∀ B ∈ S_seg_0, IsClosedDisc (disc₁ B) ∧ disc₁ B ⊆ Δ) : + ∀ B ∈ S_seg_0, IsClosedDisc (f '' disc₁ B) ∧ subBd (f '' disc₁ B) = f '' subBd (disc₁ B) := by + intro B hB + obtain ⟨hB_disc, hB_sub⟩ := hdisc₁_closed B hB + have hf'_B : ContinuousOn f' (f '' disc₁ B) := + hf'_cont.mono (image_subset_iff.mpr fun x hx => hf_maps (hB_sub hx)) + obtain ⟨himg_disc, himg_bd⟩ := + hB_disc.image (hf_cont.mono hB_sub) hf'_B (hf_left.mono hB_sub) + refine ⟨himg_disc, ?_⟩ + rw [IsClosedDisc.subBd_eq_discBd hS himg_disc, himg_bd, + IsClosedDisc.subBd_eq_discBd hS hB_disc] + +omit [T2Space S] in +/-- Applying `(8.1)` (`theorem_8_1_proof`) on `↥Δ` and transporting the resulting arrangement into +`Δ ⊆ S` so that it matches `α_pt` on `localSociety.Ω.bar`. -/ +private theorem exists_surface_arrangement_in_disc_of_8_1 {α : Type v} {β : Type w} + (hS : IsClosedSurface S) + {Δ : Set S} (hΔ : IsClosedDisc Δ) + (localSociety : Society α β) + (hno_crooked2 : ∀ P_set : Set (Graph α β), localSociety.IsCrookedTransaction P_set + → P_set.ncard ≠ 2) + (α_pt : α → S) (hinj_bar : InjOn α_pt localSociety.Ω.bar) + (hNat_bar : IsNaturalOrderFrom α_pt localSociety.Ω (subBd Δ)) : + ∃ (S_seg_0 : Set (Society α β)) + (α_disc_0 : Society α β → Set S) (α_pt_0 : α → S), + IsThreeSegregation localSociety.G S_seg_0 ∧ + localSociety.Ω.bar ⊆ segregationVertices S_seg_0 ∧ + IsSurfaceArrangement S_seg_0 α_disc_0 α_pt_0 ∧ + (∀ B ∈ S_seg_0, α_disc_0 B ⊆ Δ) ∧ + (∀ v ∈ localSociety.Ω.bar, α_pt_0 v = α_pt v) ∧ + (∀ v ∈ segregationVertices S_seg_0, α_pt_0 v ∈ Δ) ∧ + (∀ v ∈ segregationVertices S_seg_0, v ∉ localSociety.Ω.bar → α_pt_0 v ∈ Δ \ subBd Δ) ∧ + (∀ B ∈ S_seg_0, α_disc_0 B ∩ subBd Δ ⊆ α_pt_0 '' (B.Ω.bar ∩ localSociety.Ω.bar)) := by + classical + have : T2Space S := hS.2.1 + have ⟨φ_Δ⟩ := hΔ + have : CompactSpace ↥Δ := isCompact_iff_compactSpace.mp hΔ.isCompact + have hUniv_D : IsClosedDisc (univ : Set ↥Δ) := + ⟨φ_Δ.trans (Homeomorph.Set.univ ↥Δ).symm⟩ + have hSurf_D : IsSurface ↥Δ := + ⟨inferInstance, inferInstance, fun y => isManifoldPoint_of_disc hUniv_D Filter.univ_mem⟩ + obtain ⟨S_seg_0, α_disc_D, α_pt_D, h3seg_0, hbar_0, harr_D, hpull_D⟩ := + (theorem_8_1_proof.{v, w, u} localSociety hSurf_D ⟨φ_Δ.symm⟩).mp hno_crooked2 + let disc₁ : Society α β → Set S := fun B => Subtype.val '' (α_disc_D B) + let pt₁ : α → S := fun v => (α_pt_D v).1 + have hinj_pt₁ : InjOn pt₁ (segregationVertices S_seg_0) := + Subtype.val_injective.comp_injOn harr_D.injOn_pts + have hbd_S : subBd Δ = discBd Δ := IsClosedDisc.subBd_eq_discBd hS hΔ + have hbd_Δ_eq : subBd Δ = Subtype.val '' (bd ↥Δ) := hbd_S + -- Push `hpull_D.2 : IsNaturalOrderFrom α_pt_D localSociety.Ω (bd ↥Δ)` along `Subtype.val` to + -- `subBd + -- Δ`. + obtain ⟨_, φ_D, hA_D⟩ := hpull_D.2 + let g_bd : Circle → subBd Δ := fun z => + ⟨(φ_D z).1.1, hbd_Δ_eq.symm ▸ mem_image_of_mem Subtype.val (φ_D z).2⟩ + have hg_bd_cont : Continuous g_bd := by fun_prop + have hg_bd_bij : Function.Bijective g_bd := by + refine ⟨fun z₁ z₂ h => ?_, fun y => ?_⟩ + · have h0 : (g_bd z₁).1 = (g_bd z₂).1 := congrArg Subtype.val h + exact φ_D.injective (Subtype.ext (Subtype.ext h0)) + · have hy2 : y.1 ∈ Subtype.val '' (bd ↥Δ) := hbd_Δ_eq ▸ y.2 + obtain ⟨x, hx, hxy⟩ := hy2 + refine ⟨φ_D.symm ⟨x, hx⟩, Subtype.ext ?_⟩ + change ((φ_D (φ_D.symm ⟨x, hx⟩)).1).1 = y.1 + rw [φ_D.apply_symm_apply] + exact hxy + let φ₁ : Circle ≃ₜ subBd Δ := + hg_bd_cont.homeoOfEquivCompactToT2 (f := Equiv.ofBijective g_bd hg_bd_bij) + have hA₁ : AgreesWithOArcHomeo pt₁ localSociety.Ω (subBd Δ) φ₁ := by + refine ⟨fun v hv => hbd_Δ_eq.symm ▸ mem_image_of_mem Subtype.val (hA_D.1 v hv), + fun v₁ v₂ v₃ hcw3 => ?_⟩ + obtain ⟨t₁, t₂, t₃, ht12, ht23, ht31, h1, h2, h3⟩ := hA_D.2 v₁ v₂ v₃ hcw3 + exact ⟨t₁, t₂, t₃, ht12, ht23, ht31, + congrArg Subtype.val h1, congrArg Subtype.val h2, congrArg Subtype.val h3⟩ + obtain ⟨_, φ₂, hA₂⟩ := hNat_bar + obtain ⟨e_subBd, he_subBd⟩ := + exists_bd_homeo_of_agreesWithOArcHomeo hA₁ hA₂ (hinj_pt₁.mono hbar_0) hinj_bar + let e_bd : discBd Δ ≃ₜ discBd Δ := + (Homeomorph.setCongr hbd_S.symm).trans (e_subBd.trans (Homeomorph.setCongr hbd_S)) + obtain ⟨f, f', hf_maps, hf'_maps, hf_cont, hf'_cont, hf_left, _, hf_bd⟩ := + exists_disc_extension_of_bd_homeo hΔ hΔ e_bd + have hf_subBd : ∀ x (hx : x ∈ subBd Δ), f x = (e_subBd ⟨x, hx⟩).1 := by + intro x hx + have hx' : x ∈ discBd Δ := hbd_S ▸ hx + exact hf_bd ⟨x, hx'⟩ + have hf_mem_subBd_iff : ∀ x ∈ Δ, f x ∈ subBd Δ ↔ x ∈ subBd Δ := by + intro x hx + constructor + · intro hfx + have hfx' : f x ∈ discBd Δ := hbd_S ▸ hfx + let x₀ : discBd Δ := e_bd.symm ⟨f x, hfx'⟩ + have hx₀_eq : f x₀.1 = f x := by + rw [hf_bd x₀, e_bd.apply_symm_apply] + have hx_eq : x₀.1 = x := hf_left.injOn (Surface.discBd_subset Δ x₀.2) hx hx₀_eq + rw [← hx_eq, hbd_S] + exact x₀.2 + · intro hx_bd + rw [hf_subBd x hx_bd] + exact (e_subBd ⟨x, hx_bd⟩).2 + -- Establish closed-disc and boundary properties of `(disc₁, pt₁)` in `Δ ⊆ S`. + have hdisc₁_closed : ∀ B ∈ S_seg_0, IsClosedDisc (disc₁ B) ∧ disc₁ B ⊆ Δ := by + intro B hB + obtain ⟨⟨φ_B⟩, _⟩ := harr_D.isClosedDisc B hB + let g_B : ClosedUnitDisc → disc₁ B := fun z => + ⟨(φ_B z).1.1, mem_image_of_mem Subtype.val (φ_B z).2⟩ + have hg_B_cont : Continuous g_B := by fun_prop + have hg_B_bij : Function.Bijective g_B := by + refine ⟨fun z₁ z₂ h => ?_, fun y => ?_⟩ + · have h0 : (g_B z₁).1 = (g_B z₂).1 := congrArg Subtype.val h + exact φ_B.injective (Subtype.ext (Subtype.ext h0)) + · obtain ⟨x, hx, hxy⟩ := y.2 + refine ⟨φ_B.symm ⟨x, hx⟩, Subtype.ext ?_⟩ + change ((φ_B (φ_B.symm ⟨x, hx⟩)).1).1 = y.1 + rw [φ_B.apply_symm_apply] + exact hxy + exact ⟨⟨hg_B_cont.homeoOfEquivCompactToT2 (f := Equiv.ofBijective g_B hg_B_bij)⟩, + by rintro _ ⟨x, _, rfl⟩; exact x.2⟩ + have hdisc₁_subBd_eq : ∀ B ∈ S_seg_0, + subBd (disc₁ B) = Subtype.val '' subBd (α_disc_D B) := by + exact embedded_cell_boundary_is_image (S := S) (α := α) (β := β) hS (Δ := Δ) S_seg_0 α_disc_D + α_pt_D harr_D hdisc₁_closed + have hdisc₁_bd : ∀ B ∈ S_seg_0, ∃ φ : Circle ≃ₜ subBd (disc₁ B), + AgreesWithOArcHomeo pt₁ B.Ω (subBd (disc₁ B)) φ := by + exact embedded_cell_boundary_retains_cyclic_order (S := S) (α := α) (β := β) (Δ := Δ) S_seg_0 + α_disc_D α_pt_D harr_D hdisc₁_subBd_eq + have hdisc₁_inter_bd : ∀ B ∈ S_seg_0, + disc₁ B ∩ subBd Δ ⊆ pt₁ '' (B.Ω.bar ∩ localSociety.Ω.bar) := by + rintro B hB _ ⟨⟨x, hxB, rfl⟩, hx_bdΔ⟩ + have hx_bdD : x.1 ∈ Subtype.val '' (bd ↥Δ) := hbd_Δ_eq ▸ hx_bdΔ + obtain ⟨y, hy_bdD, hyx⟩ := hx_bdD + have hy_eq : y = x := Subtype.val_injective hyx + subst hy_eq + obtain ⟨w, hwB, hwx⟩ := harr_D.inter_bd B hB ⟨hxB, hy_bdD⟩ + have hw_star : w ∈ localSociety.Ω.bar := by + rw [hpull_D.1] + exact ⟨mem_biUnion hB hwB, hwx ▸ hy_bdD⟩ + exact ⟨w, ⟨hwB, hw_star⟩, congrArg Subtype.val hwx⟩ + have hdisc₁_inter : ∀ B₁ ∈ S_seg_0, ∀ B₂ ∈ S_seg_0, B₁ ≠ B₂ → + disc₁ B₁ ∩ disc₁ B₂ ⊆ pt₁ '' (B₁.Ω.bar ∩ B₂.Ω.bar) := by + rintro B₁ hB₁ B₂ hB₂ hne _ ⟨⟨x₁, hx₁, rfl⟩, ⟨x₂, hx₂, hx_eq⟩⟩ + have hx12 : x₁ = x₂ := Subtype.val_injective hx_eq.symm + subst hx12 + obtain ⟨v, hv, hxv⟩ := harr_D.inter_discs B₁ hB₁ B₂ hB₂ hne ⟨hx₁, hx₂⟩ + exact ⟨v, hv, congrArg Subtype.val hxv⟩ + have hpt₁_mem : ∀ v ∈ segregationVertices S_seg_0, pt₁ v ∈ Δ := fun v _ => (α_pt_D v).2 + -- Push `(disc₁, pt₁)` along `f : Δ → Δ`. + let α_disc_0 : Society α β → Set S := fun B => f '' disc₁ B + let α_pt_0 : α → S := fun v => f (pt₁ v) + have hB_img : ∀ B ∈ S_seg_0, + IsClosedDisc (α_disc_0 B) ∧ subBd (α_disc_0 B) = f '' subBd (disc₁ B) := by + exact extended_cell_homeomorphism_preserves_boundary (S := S) (α := α) (β := β) hS (Δ := Δ) + S_seg_0 f f' hf_maps hf_cont hf'_cont hf_left disc₁ hdisc₁_closed + refine ⟨S_seg_0, α_disc_0, α_pt_0, h3seg_0, hbar_0, ⟨?_, ?_, ?_, ?_, ?_⟩, + ?_, ?_, ?_, ?_, ?_⟩ + · -- `isClosedDisc` + intro B hB + obtain ⟨hdisc_B, hbd_B⟩ := hB_img B hB + refine ⟨hdisc_B, fun x hx => ?_⟩ + obtain ⟨φ_B, hA_B⟩ := hdisc₁_bd B hB + rw [hbd_B] + exact mem_image_of_mem f (hA_B.1 x hx) + · -- `inter_discs` + rintro B₁ hB₁ B₂ hB₂ hne _ ⟨⟨x₁, hx₁, rfl⟩, ⟨x₂, hx₂, hx_eq⟩⟩ + have hx12 : x₁ = x₂ := + hf_left.injOn ((hdisc₁_closed B₁ hB₁).2 hx₁) ((hdisc₁_closed B₂ hB₂).2 hx₂) hx_eq.symm + subst hx12 + obtain ⟨v, hv, hxv⟩ := hdisc₁_inter B₁ hB₁ B₂ hB₂ hne ⟨hx₁, hx₂⟩ + exact ⟨v, hv, congrArg f hxv⟩ + · -- `inter_bd` + rintro B _ x ⟨_, hxbd⟩ + exact (hxbd (hS.2.2 x)).elim + · -- `injOn_pts` + intro u hu v hv huv + exact hinj_pt₁ hu hv (hf_left.injOn (hpt₁_mem u hu) (hpt₁_mem v hv) huv) + · -- `natural_order` + intro B hB + obtain ⟨hdisc_B, hbd_B⟩ := hB_img B hB + obtain ⟨φ_B, hA_B⟩ := hdisc₁_bd B hB + have hsub_B : subBd (disc₁ B) ⊆ Δ := by + rw [IsClosedDisc.subBd_eq_discBd hS (hdisc₁_closed B hB).1] + exact (Surface.discBd_subset (disc₁ B)).trans (hdisc₁_closed B hB).2 + have hf'_bdB : ContinuousOn f' (f '' subBd (disc₁ B)) := + hf'_cont.mono (image_subset_iff.mpr fun x hx => hf_maps (hsub_B hx)) + obtain ⟨e_B, he_B⟩ := exists_homeomorph_image (hf_cont.mono hsub_B) hf'_bdB + (hf_left.mono hsub_B) + let φ_B_S : Circle ≃ₜ subBd (α_disc_0 B) := + φ_B.trans (e_B.trans (Homeomorph.setCongr hbd_B.symm)) + refine ⟨⟨φ_B_S⟩, φ_B_S, ?_, ?_⟩ + · intro v hv + rw [hbd_B] + exact mem_image_of_mem f (hA_B.1 v hv) + · intro v₁ v₂ v₃ hcw3 + obtain ⟨t₁, t₂, t₃, ht12, ht23, ht31, h1, h2, h3⟩ := hA_B.2 v₁ v₂ v₃ hcw3 + refine ⟨t₁, t₂, t₃, ht12, ht23, ht31, ?_, ?_, ?_⟩ + · exact (he_B (φ_B (Circle.exp t₁))).trans (congrArg f h1) + · exact (he_B (φ_B (Circle.exp t₂))).trans (congrArg f h2) + · exact (he_B (φ_B (Circle.exp t₃))).trans (congrArg f h3) + · -- `∀ B ∈ S_seg_0, α_disc_0 B ⊆ Δ` + intro B hB + exact image_subset_iff.mpr fun x hx => hf_maps ((hdisc₁_closed B hB).2 hx) + · -- `∀ v ∈ localSociety.Ω.bar, α_pt_0 v = α_pt v` + intro v hv + dsimp only [α_pt_0] + rw [hf_subBd (pt₁ v) (hA₁.1 v hv), he_subBd v hv] + · -- `∀ v ∈ segregationVertices S_seg_0, α_pt_0 v ∈ Δ` + intro v hv + exact hf_maps (hpt₁_mem v hv) + · -- `∀ v ∈ segregationVertices S_seg_0, v ∉ localSociety.Ω.bar → α_pt_0 v ∈ Δ \ subBd Δ` + intro v hv hv_not + refine ⟨hf_maps (hpt₁_mem v hv), fun hbd => ?_⟩ + have hx_bd : pt₁ v ∈ subBd Δ := (hf_mem_subBd_iff (pt₁ v) (hpt₁_mem v hv)).mp hbd + rcases mem_iUnion₂.mp hv with ⟨B, hB, hvB⟩ + obtain ⟨φ_B, hA_B⟩ := hdisc₁_bd B hB + have hsub : subBd (disc₁ B) ⊆ disc₁ B := by + rw [IsClosedDisc.subBd_eq_discBd hS (hdisc₁_closed B hB).1] + exact Surface.discBd_subset (disc₁ B) + have hmem_inter : pt₁ v ∈ disc₁ B ∩ subBd Δ := ⟨hsub (hA_B.1 v hvB), hx_bd⟩ + obtain ⟨w, ⟨hwB, hwS⟩, hw_eq⟩ := hdisc₁_inter_bd B hB hmem_inter + have hw_seg : w ∈ segregationVertices S_seg_0 := mem_biUnion hB hwB + have hvw : w = v := hinj_pt₁ hw_seg hv hw_eq + exact hv_not (hvw ▸ hwS) + · -- `∀ B ∈ S_seg_0, α_disc_0 B ∩ subBd Δ ⊆ α_pt_0 '' (B.Ω.bar ∩ localSociety.Ω.bar)` + rintro B hB _ ⟨⟨x, hxB, rfl⟩, hy_bd⟩ + have hx_Δ : x ∈ Δ := (hdisc₁_closed B hB).2 hxB + have hx_bd : x ∈ subBd Δ := (hf_mem_subBd_iff x hx_Δ).mp hy_bd + obtain ⟨v, hv, hxv⟩ := hdisc₁_inter_bd B hB ⟨hxB, hx_bd⟩ + exact ⟨v, hv, congrArg f hxv⟩ + +/-- The glued arrangement `(α'_disc, α'_pt)` on `S_seg' = S_seg₂ ∪ S_seg*` in the proof of +`(10.1)` (page 50): +"For $v \in V(\mathscr{S}')$, define $\alpha'(v) = \alpha(v)$ if $v \in V(\mathscr{S}_2)$, +and $\alpha'(v) = \alpha^*(v)$ otherwise. For $(A, \Omega) \in \mathscr{S}'$, define +$\alpha'(A, \Omega) = \alpha(A, \Omega)$ if $(A, \Omega) \in \mathscr{S}_2$, and $\alpha'(A, +\Omega) = \alpha^*(A, \Omega)$ otherwise." -/ +noncomputable def gluedArrangementDisc {S : Type u} {α : Type v} {β : Type w} + (S_seg₂ : Set (Society α β)) + (α_disc α_disc_star : Society α β → Set S) : Society α β → Set S := + open Classical in + fun S₀ => if S₀ ∈ S_seg₂ then α_disc S₀ else α_disc_star S₀ + +/-- The glued point map `α'_pt` on `V(S_seg')` in the proof of `(10.1)` (page 50). -/ +noncomputable def gluedArrangementPt {S : Type u} {α : Type v} {β : Type w} + (S_seg₂ : Set (Society α β)) + (α_pt α_pt_star : α → S) : α → S := + open Classical in + fun v => if v ∈ segregationVertices S_seg₂ then α_pt v else α_pt_star v + +/-- If `(A, Ω) ∈ S_seg` and `¬ α_disc A ⊆ Δ`, then `E(localSociety.G ∩ A) = ∅` and +`V(localSociety.G ∩ A) ⊆ localSociety.Ω.bar` (Graph Minors XIV, Section 10, page 50). -/ +private theorem claim_1_of_10_1 {α : Type v} {β : Type w} + (hS : IsClosedSurface S) + {G₀ G' J : Graph α β} {H : Drawing S} {η₀ : SpanEmbedding H G₀} {η' : SpanEmbedding H G'} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + {Δ : Set S} {localSociety : Society α β} + (hJ : IsBridge G₀ η₀.imageGraph J) + (hG'_le : G' ≤ G₀) + (hDisj_E : Disjoint E(G') E(J)) + (hInter_V : V(G') ∩ V(J) ⊆ V(η₀.imageGraph)) + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η₀.vMap v) + (hSeg : IsThreeSegregation G' S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hΔ : IsClosedDisc Δ) + (hNorm : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) + (hVJ_Δ : ∀ v ∈ H.V, η₀.vMap v ∈ V(J) → v ∈ Δ \ subBd Δ) + (hsoc_star_G : localSociety.G = subgraphUnion G₀ J (arrangementPullbackGraph G' S_seg α_disc + α_pt + Δ)) + (hsoc_star_Ω : IsPullbackPerm S_seg α_pt (subBd Δ) localSociety.Ω) + {A : Society α β} (hA : A ∈ S_seg) (hA_not : ¬ α_disc A ⊆ Δ) : + Disjoint E(localSociety.G) E(A.G) ∧ + V(localSociety.G) ∩ V(A.G) ⊆ localSociety.Ω.bar := by + let P_Δ := arrangementPullbackGraph G' S_seg α_disc α_pt Δ + have hA_le : A.G ≤ G' := hSeg.1.le A hA + have hP_le : P_Δ ≤ G' := restrict_le.trans (G'.induce_le inter_subset_right) + have hseg_in_bar : ∀ {v' : α}, v' ∈ V(A.G) → v' ∈ segregationVertices S_seg → v' ∈ A.Ω.bar := by + intro v' hv'A hv'seg + obtain ⟨A', hA', hv'A'_bar⟩ := mem_iUnion₂.mp hv'seg + by_cases hAA' : A = A' + · subst hAA'; exact hv'A'_bar + · exact (hSeg.1.vertex_inter_subset A hA A' hA' hAA' ⟨hv'A, A'.bar_subset hv'A'_bar⟩).1 + obtain ⟨hinter_subBd, _⟩ := + inter_disc_subset_subBd_of_not_subset hS hArr hΔ hNorm hA hA_not + refine ⟨?_, ?_⟩ + · rw [hsoc_star_G, edgeSet_subgraphUnion hJ.2.1 (hP_le.trans hG'_le)] + refine Set.disjoint_left.mpr ?_ + rintro e (heJ | heP) heA + · exact Set.disjoint_left.mp hDisj_E (hA_le.edgeSet_mono heA) heJ + · change e ∈ E(arrangementPullbackGraph G' S_seg α_disc α_pt Δ) at heP + rw [arrangementPullbackGraph, edgeSet_restrict] at heP + obtain ⟨A', ⟨hA'_S, hA'_sub⟩, heA'⟩ := mem_iUnion₂.mp heP.2 + have hAA'_ne : A ≠ A' := fun hEq => hA_not (hEq ▸ hA'_sub) + exact Set.disjoint_left.mp (hSeg.1.edge_disjoint A hA A' hA'_S hAA'_ne) heA heA' + · rintro x ⟨hx_star, hxA⟩ + rw [hsoc_star_G, vertexSet_subgraphUnion] at hx_star + rcases hx_star with hxJ | hxP + · exfalso + have hxG' : x ∈ V(G') := hA_le.vertexSet_mono hxA + obtain ⟨u, huH, rfl⟩ := η₀.bijOn_v.surjOn (hInter_V ⟨hxG', hxJ⟩) + have hu_int : u ∈ Δ \ subBd Δ := hVJ_Δ u huH hxJ + have hu_A : u ∈ α_disc A := by + rw [hComp.inter_V_iff A hA u huH, hη'_v u huH] + exact hxA + exact hu_int.2 (hinter_subBd ⟨hu_A, hu_int.1⟩) + · change x ∈ V(arrangementPullbackGraph G' S_seg α_disc α_pt Δ) at hxP + rw [arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce] at hxP + have hx_seg_and_Δ : x ∈ segregationVertices S_seg ∧ α_pt x ∈ Δ := by + rcases hxP.1 with hx_union | hx_seg_Δ + · obtain ⟨A', ⟨hA'_S, hA'_sub⟩, hxA'⟩ := mem_iUnion₂.mp hx_union + have hAA'_ne : A ≠ A' := fun hEq => hA_not (hEq ▸ hA'_sub) + have hx_bars := hSeg.1.vertex_inter_subset A hA A' hA'_S hAA'_ne ⟨hxA, hxA'⟩ + have hx_bdA' : α_pt x ∈ subBd (α_disc A') := (hArr.isClosedDisc A' hA'_S).2 x hx_bars.2 + have hx_discA' : α_pt x ∈ α_disc A' := + (hArr.isClosedDisc A' hA'_S).1.isClosed.closure_subset_iff.mpr Subset.rfl hx_bdA'.1 + exact ⟨mem_biUnion hA hx_bars.1, hA'_sub hx_discA'⟩ + · exact hx_seg_Δ + have hx_bar : x ∈ A.Ω.bar := hseg_in_bar hxA hx_seg_and_Δ.1 + have hx_bdA : α_pt x ∈ subBd (α_disc A) := (hArr.isClosedDisc A hA).2 x hx_bar + have hx_discA : α_pt x ∈ α_disc A := + (hArr.isClosedDisc A hA).1.isClosed.closure_subset_iff.mpr Subset.rfl hx_bdA.1 + have hx_bdΔ : α_pt x ∈ subBd Δ := hinter_subBd ⟨hx_discA, hx_seg_and_Δ.2⟩ + rw [hsoc_star_Ω.1] + exact ⟨hx_seg_and_Δ.1, hx_bdΔ⟩ + +private theorem replacement_bridge_pieces_form_three_segregation + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {α : Type v} + {β : Type w} + (G₀ : Graph α β) + (G' : Graph α β) + (J : Graph α β) + (H : Drawing S) + (η₀ : SpanEmbedding H G₀) + (η' : SpanEmbedding H G') + (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) + (α_pt : α → S) + (Δ : Set S) + (localSociety : Society α β) + (hS : IsClosedSurface S) + (hJ : IsBridge G₀ η₀.imageGraph J) + (hG'_le : G' ≤ G₀) + (hG₀_eq : G₀ = subgraphUnion G₀ G' J) + (hDisj_E : Disjoint E(G') E(J)) + (hInter_V : V(G') ∩ V(J) ⊆ V(η₀.imageGraph)) + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η₀.vMap v) + (hSeg : IsThreeSegregation G' S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hΔ : IsClosedDisc Δ) + (hNorm : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) + (hVJ_Δ : ∀ v ∈ H.V, η₀.vMap v ∈ V(J) → v ∈ Δ \ subBd Δ) + (hsoc_star_G : localSociety.G = subgraphUnion G₀ J (arrangementPullbackGraph G' S_seg α_disc + α_pt + Δ)) + (hsoc_star_Ω : IsPullbackPerm S_seg α_pt (subBd Δ) localSociety.Ω) + (hP_le_G₀ : (arrangementPullbackGraph G' S_seg α_disc α_pt Δ) ≤ G₀) + (S_seg_0 : Set (Society α β)) + (h3seg_0 : IsThreeSegregation localSociety.G S_seg_0) + (hbar_0 : localSociety.Ω.bar ⊆ segregationVertices S_seg_0) + (hS_seg'_eq : (({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ}) ∪ (S_seg_0 \ ({A | A ∈ S_seg ∧ ¬α_disc A ⊆ + Δ}))) = ({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ}) ∪ S_seg_0) + (hFin' : (({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ}) ∪ (S_seg_0 \ ({A | A ∈ S_seg ∧ ¬α_disc A ⊆ + Δ}))).Finite) + (hLe' : ∀ B ∈ (({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ}) ∪ (S_seg_0 \ ({A | A ∈ S_seg ∧ ¬α_disc A ⊆ + Δ}))), B.G ≤ G₀) : + IsThreeSegregation G₀ (({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ}) ∪ (S_seg_0 \ ({A | A ∈ S_seg ∧ + ¬α_disc A ⊆ Δ}))) := by + let P_Δ := arrangementPullbackGraph G' S_seg α_disc α_pt Δ + let S_seg₂ := {A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ} + let S_seg_star := S_seg_0 \ S_seg₂ + let S_seg' := S_seg₂ ∪ S_seg_star + refine ⟨⟨hFin', hLe', ?_, ?_, ?_⟩, ?_⟩ + · have hU_le : subgraphSUnion G₀ ((fun B : Society α β => B.G) '' S_seg') ≤ G₀ := + subgraphSUnion_le (by rintro _ ⟨B, hB, rfl⟩; exact hLe' B hB) + have hV_G₀ : V(G₀) = V(G') ∪ V(J) := + (congrArg Graph.vertexSet hG₀_eq).trans (vertexSet_subgraphUnion G₀ G' J) + have hE_G₀ : E(G₀) = E(G') ∪ E(J) := + (congrArg Graph.edgeSet hG₀_eq).trans (edgeSet_subgraphUnion hG'_le hJ.2.1) + have hCover_star_V : ∀ {v : α}, v ∈ V(localSociety.G) → ∃ B ∈ S_seg', v ∈ V(B.G) := by + intro v hv + have hv_u : v ∈ V(subgraphSUnion localSociety.G ((fun B : Society α β => B.G) '' S_seg_0)) + := by + rw [h3seg_0.1.union_eq]; exact hv + rw [vertexSet_subgraphSUnion] at hv_u + obtain ⟨_, ⟨B, hB, rfl⟩, hvB⟩ := mem_iUnion₂.mp hv_u + refine ⟨B, ?_, hvB⟩ + change B ∈ S_seg₂ ∪ (S_seg_0 \ S_seg₂) + exact hS_seg'_eq.symm ▸ (show B ∈ S_seg₂ ∪ S_seg_0 from Or.inr hB) + have hCover_star_E : ∀ {e : β}, e ∈ E(localSociety.G) → ∃ B ∈ S_seg', e ∈ E(B.G) := by + intro e he + have he_u : e ∈ E(subgraphSUnion localSociety.G ((fun B : Society α β => B.G) '' S_seg_0)) + := by + rw [h3seg_0.1.union_eq]; exact he + rw [edgeSet_subgraphSUnion (by rintro _ ⟨B, hB, rfl⟩; exact h3seg_0.1.le B hB)] at he_u + obtain ⟨_, ⟨B, hB, rfl⟩, heB⟩ := mem_iUnion₂.mp he_u + refine ⟨B, ?_, heB⟩ + change B ∈ S_seg₂ ∪ (S_seg_0 \ S_seg₂) + exact hS_seg'_eq.symm ▸ (show B ∈ S_seg₂ ∪ S_seg_0 from Or.inr hB) + refine (Compatible.of_le_le hU_le le_rfl).ext ?_ ?_ + · ext v + rw [vertexSet_subgraphSUnion] + refine ⟨fun h => hU_le.vertexSet_mono (vertexSet_subgraphSUnion _ _ ▸ h), fun hvG₀ => ?_⟩ + rcases hV_G₀ ▸ hvG₀ with hvG' | hvJ + · have hv_u : v ∈ V(subgraphSUnion G' ((fun A : Society α β => A.G) '' S_seg)) := by + rw [hSeg.1.union_eq]; exact hvG' + rw [vertexSet_subgraphSUnion] at hv_u + obtain ⟨_, ⟨A, hA, rfl⟩, hvA⟩ := mem_iUnion₂.mp hv_u + by_cases hA_sub : α_disc A ⊆ Δ + · have hv_star : v ∈ V(localSociety.G) := by + rw [hsoc_star_G, vertexSet_subgraphUnion] + refine Or.inr ?_ + rw [arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce] + exact ⟨Or.inl (mem_iUnion₂.mpr ⟨A, ⟨hA, hA_sub⟩, hvA⟩), hvG'⟩ + obtain ⟨B, hB, hvB⟩ := hCover_star_V hv_star + exact mem_iUnion₂.mpr ⟨B.G, ⟨B, hB, rfl⟩, hvB⟩ + · exact mem_iUnion₂.mpr ⟨A.G, ⟨A, Or.inl ⟨hA, hA_sub⟩, rfl⟩, hvA⟩ + · have hv_star : v ∈ V(localSociety.G) := by + rw [hsoc_star_G, vertexSet_subgraphUnion] + exact Or.inl hvJ + obtain ⟨B, hB, hvB⟩ := hCover_star_V hv_star + exact mem_iUnion₂.mpr ⟨B.G, ⟨B, hB, rfl⟩, hvB⟩ + · ext e + rw [edgeSet_subgraphSUnion (by rintro _ ⟨B, hB, rfl⟩; exact hLe' B hB)] + refine ⟨fun h => ?_, fun heG₀ => ?_⟩ + · obtain ⟨_, ⟨B, hB, rfl⟩, heB⟩ := mem_iUnion₂.mp h + exact (hLe' B hB).edgeSet_mono heB + · rcases hE_G₀ ▸ heG₀ with heG' | heJ + · have he_u : e ∈ E(subgraphSUnion G' ((fun A : Society α β => A.G) '' S_seg)) := by + rw [hSeg.1.union_eq]; exact heG' + rw [edgeSet_subgraphSUnion (by rintro _ ⟨A, hA, rfl⟩; exact hSeg.1.le A hA)] at he_u + obtain ⟨_, ⟨A, hA, rfl⟩, heA⟩ := mem_iUnion₂.mp he_u + by_cases hA_sub : α_disc A ⊆ Δ + · have he_star : e ∈ E(localSociety.G) := by + rw [hsoc_star_G, edgeSet_subgraphUnion hJ.2.1 hP_le_G₀] + refine Or.inr ?_ + rw [arrangementPullbackGraph, edgeSet_restrict] + obtain ⟨x, y, hxy_A⟩ := A.G.exists_isLink_of_mem_edgeSet heA + have hxy_G' : G'.IsLink e x y := hxy_A.mono (hSeg.1.le A hA) + exact ⟨⟨x, y, hxy_G', + ⟨Or.inl (mem_iUnion₂.mpr ⟨A, ⟨hA, hA_sub⟩, hxy_A.left_mem⟩), hxy_G'.left_mem⟩, + ⟨Or.inl (mem_iUnion₂.mpr ⟨A, ⟨hA, hA_sub⟩, hxy_A.right_mem⟩), hxy_G'.right_mem⟩⟩, + mem_iUnion₂.mpr ⟨A, ⟨hA, hA_sub⟩, heA⟩⟩ + obtain ⟨B, hB, heB⟩ := hCover_star_E he_star + exact mem_iUnion₂.mpr ⟨B.G, ⟨B, hB, rfl⟩, heB⟩ + · exact mem_iUnion₂.mpr ⟨A.G, ⟨A, Or.inl ⟨hA, hA_sub⟩, rfl⟩, heA⟩ + · have he_star : e ∈ E(localSociety.G) := by + rw [hsoc_star_G, edgeSet_subgraphUnion hJ.2.1 hP_le_G₀] + exact Or.inl heJ + obtain ⟨B, hB, heB⟩ := hCover_star_E he_star + exact mem_iUnion₂.mpr ⟨B.G, ⟨B, hB, rfl⟩, heB⟩ + · have hV_inter_S₂_0 : ∀ {A B : Society α β}, + A ∈ S_seg₂ → B ∈ S_seg_0 → V(A.G) ∩ V(B.G) ⊆ A.Ω.bar ∩ B.Ω.bar := by + intro A B hA_S₂ hB_0 v ⟨hvA, hvB⟩ + have hv_star : v ∈ V(localSociety.G) := (h3seg_0.1.le B hB_0).vertexSet_mono hvB + have hv_bar_star : v ∈ localSociety.Ω.bar := + (claim_1_of_10_1 hS hJ hG'_le hDisj_E hInter_V hη'_v hSeg hArr hComp + hΔ hNorm hVJ_Δ hsoc_star_G hsoc_star_Ω hA_S₂.1 hA_S₂.2).2 + ⟨hv_star, hvA⟩ + have hv_seg : v ∈ segregationVertices S_seg := (hsoc_star_Ω.1 ▸ hv_bar_star).1 + have hv_seg_0 : v ∈ segregationVertices S_seg_0 := hbar_0 hv_bar_star + have hv_barA : v ∈ A.Ω.bar := by + obtain ⟨A', hA', hvA'⟩ := mem_iUnion₂.mp hv_seg + by_cases hAA' : A = A' + · subst hAA'; exact hvA' + · exact (hSeg.1.vertex_inter_subset A hA_S₂.1 A' hA' hAA' ⟨hvA, A'.bar_subset hvA'⟩).1 + have hv_barB : v ∈ B.Ω.bar := by + obtain ⟨B', hB', hvB'⟩ := mem_iUnion₂.mp hv_seg_0 + by_cases hBB' : B = B' + · subst hBB'; exact hvB' + · exact (h3seg_0.1.vertex_inter_subset B hB_0 B' hB' hBB' ⟨hvB, B'.bar_subset hvB'⟩).1 + exact ⟨hv_barA, hv_barB⟩ + rintro B₁ (hB₁_S₂ | hB₁_star) B₂ (hB₂_S₂ | hB₂_star) hne + · exact hSeg.1.vertex_inter_subset B₁ hB₁_S₂.1 B₂ hB₂_S₂.1 hne + · exact hV_inter_S₂_0 hB₁_S₂ hB₂_star.1 + · intro v ⟨hv1, hv2⟩ + have h := hV_inter_S₂_0 hB₂_S₂ hB₁_star.1 ⟨hv2, hv1⟩ + exact ⟨h.2, h.1⟩ + · exact h3seg_0.1.vertex_inter_subset B₁ hB₁_star.1 B₂ hB₂_star.1 hne + · rintro B₁ (hB₁_S₂ | hB₁_star) B₂ (hB₂_S₂ | hB₂_star) hne + · exact hSeg.1.edge_disjoint B₁ hB₁_S₂.1 B₂ hB₂_S₂.1 hne + · have hdisj := + (claim_1_of_10_1 hS hJ hG'_le hDisj_E hInter_V hη'_v hSeg hArr hComp + hΔ hNorm hVJ_Δ hsoc_star_G hsoc_star_Ω hB₁_S₂.1 hB₁_S₂.2).1 + exact hdisj.symm.mono_right (h3seg_0.1.le B₂ hB₂_star.1).edgeSet_mono + · have hdisj := + (claim_1_of_10_1 hS hJ hG'_le hDisj_E hInter_V hη'_v hSeg hArr hComp + hΔ hNorm hVJ_Δ hsoc_star_G hsoc_star_Ω hB₂_S₂.1 hB₂_S₂.2).1 + exact hdisj.mono_left (h3seg_0.1.le B₁ hB₁_star.1).edgeSet_mono + · exact h3seg_0.1.edge_disjoint B₁ hB₁_star.1 B₂ hB₂_star.1 hne + · rintro B (hB_S₂ | hB_star) + · exact hSeg.2 B hB_S₂.1 + · exact h3seg_0.2 B hB_star.1 + +private theorem replacement_bridge_segregation_is_tangle_local + {S : Type u} + [TopologicalSpace S] + {α : Type v} + {β : Type w} + (G₀ : Graph α β) + (G' : Graph α β) + (H : Drawing S) + (η₀ : SpanEmbedding H G₀) + (η' : SpanEmbedding H G') + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) + (Δ : Set S) + (hG'_le : G' ≤ G₀) + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η₀.vMap v) + (hη'_e : ∀ e ∈ H.E, η'.eMap e = η₀.eMap e) + (hSeg : IsThreeSegregation G' S_seg) + (hLoc : IsTangleLocal G' H η' T S_seg) + (S_seg_0 : Set (Society α β)) + (hLoc_star : IsTangleLocal G₀ H η₀ T (S_seg_0 \ ({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ}))) : + IsTangleLocal G₀ H η₀ T (({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ}) ∪ (S_seg_0 \ ({A | A ∈ S_seg ∧ + ¬α_disc A ⊆ Δ}))) := by + let S_seg₂ := {A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ} + let S_seg_star := S_seg_0 \ S_seg₂ + let S_seg' := S_seg₂ ∪ S_seg_star + rintro S₀ (hS₀_S₂ | hS₀_star) B hsepB hVB_eq + · let B' : Graph α β := (G'.induce (V(B) ∩ V(G'))).restrict E(B) + have hV_B' : V(B') = V(B) ∩ V(G') := by simp [B'] + have hE_B' : E(B') = E(B) ∩ E(G') := by + ext e + simp only [B', edgeSet_restrict, edgeSet_induce, mem_inter_iff] + refine ⟨fun ⟨⟨u_e, v_e, hlink, _, _⟩, heB⟩ => ⟨heB, hlink.edge_mem⟩, fun ⟨heB, + heG'⟩ => ?_⟩ + obtain ⟨u_e, v_e, hlink⟩ := G'.exists_isLink_of_mem_edgeSet heG' + have hlink_B : B.IsLink e u_e v_e := + (hsepB.2.1.isLink_iff heB).mpr (hlink.mono hG'_le) + exact ⟨⟨u_e, v_e, hlink, ⟨hlink_B.left_mem, hlink.left_mem⟩, + ⟨hlink_B.right_mem, hlink.right_mem⟩⟩, heB⟩ + have hB'_le : B' ≤ G' := restrict_le.trans (G'.induce_le inter_subset_right) + have hS₀_le : S₀.G ≤ G' := hSeg.1.le S₀ hS₀_S₂.1 + have hsepB' : IsGraphSeparation G' S₀.G B' := by + refine ⟨hS₀_le, hB'_le, ?_, ?_, ?_⟩ + · rw [← inter_eq_left.mpr hS₀_le.vertexSet_mono, hV_B', ← union_inter_distrib_right, + hsepB.2.2.1] + exact inter_eq_right.mpr hG'_le.vertexSet_mono + · rw [← inter_eq_left.mpr hS₀_le.edgeSet_mono, hE_B', ← union_inter_distrib_right, + hsepB.2.2.2.1] + exact inter_eq_right.mpr hG'_le.edgeSet_mono + · rw [hE_B'] + exact hsepB.2.2.2.2.mono_right inter_subset_left + have hVB'_eq : V(S₀.G) ∩ V(B') = S₀.Ω.bar := by + rw [hV_B', ← Set.inter_assoc, inter_eq_left.mpr + (inter_subset_left.trans hS₀_le.vertexSet_mono)] + exact hVB_eq + obtain ⟨A_H, B_H, hsep_H, hAH_V, hBH_V, hAH_E, hBH_E, hT_mem⟩ := + hLoc S₀ hS₀_S₂.1 B' hsepB' hVB'_eq + refine ⟨A_H, B_H, hsep_H, ?_, ?_, ?_, ?_, hT_mem⟩ + · rw [hAH_V] + ext v + simp only [mem_sep_iff] + exact ⟨fun ⟨hv, hvS⟩ => ⟨hv, hη'_v v hv ▸ hvS⟩, + fun ⟨hv, hvS⟩ => ⟨hv, (hη'_v v hv).symm ▸ hvS⟩⟩ + · rw [hBH_V, hV_B'] + ext v + simp only [mem_sep_iff, mem_inter_iff] + exact ⟨fun ⟨hv, hvB, _⟩ => ⟨hv, hη'_v v hv ▸ hvB⟩, + fun ⟨hv, hvB⟩ => ⟨hv, (hη'_v v hv).symm ▸ hvB, + η'.imageGraph_le.vertexSet_mono (η'.bijOn_v.mapsTo hv)⟩⟩ + · rw [hAH_E] + ext e + simp only [mem_sep_iff] + exact ⟨fun ⟨he, heS⟩ => ⟨he, hη'_e e he ▸ heS⟩, + fun ⟨he, heS⟩ => ⟨he, (hη'_e e he).symm ▸ heS⟩⟩ + · rw [hBH_E, hE_B'] + ext e + simp only [mem_sep_iff, mem_inter_iff] + exact ⟨fun ⟨he, heB, _⟩ => ⟨he, hη'_e e he ▸ heB⟩, + fun ⟨he, heB⟩ => ⟨he, (hη'_e e he).symm ▸ heB, + η'.imageGraph_le.edgeSet_mono (η'.bijOn_e.mapsTo he)⟩⟩ + · exact hLoc_star S₀ hS₀_star B hsepB hVB_eq + +private theorem replacement_bridge_discs_form_surface_arrangement + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {α : Type v} + {β : Type w} + (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) + (α_pt : α → S) + (Δ : Set S) + (localSociety : Society α β) + (hS : IsClosedSurface S) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hΔ : IsClosedDisc Δ) + (hNorm : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) + (hsoc_star_Ω : IsPullbackPerm S_seg α_pt (subBd Δ) localSociety.Ω) + (S_seg_0 : Set (Society α β)) + (hbar_0 : localSociety.Ω.bar ⊆ segregationVertices S_seg_0) + (α_disc_star : Society α β → Set S) + (α_pt_star : α → S) + (harr_star : IsSurfaceArrangement S_seg_0 α_disc_star α_pt_star) + (hdisc_star_sub : ∀ S₀ ∈ S_seg_0, α_disc_star S₀ ⊆ Δ) + (hpt_star_eq : ∀ v ∈ localSociety.Ω.bar, α_pt_star v = α_pt v) + (hpt_star_mem : ∀ v ∈ segregationVertices S_seg_0, α_pt_star v ∈ Δ) + (hdisc_star_inter_bd : ∀ B ∈ S_seg_0, α_disc_star B ∩ subBd Δ ⊆ α_pt_star '' (B.Ω.bar ∩ + localSociety.Ω.bar)) + (α'_disc : Society α β → Set S) + (α'_pt : α → S) + (hα'_disc_S₂ : ∀ {B : Society α β}, B ∈ ({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ}) → α'_disc B = α_disc + B) + (hα'_disc_star : ∀ {B : Society α β}, B ∈ (S_seg_0 \ ({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ})) → + α'_disc B = α_disc_star B) + (hα'_pt_S₂ : ∀ {v : α}, v ∈ segregationVertices ({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ}) → α'_pt v = + α_pt v) + (hα'_pt_0 : ∀ {v : α}, v ∈ segregationVertices S_seg_0 → α'_pt v = α_pt_star v) : + IsSurfaceArrangement (({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ}) ∪ (S_seg_0 \ ({A | A ∈ S_seg ∧ ¬α_disc + A ⊆ Δ}))) α'_disc α'_pt := by + let S_seg₂ := {A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ} + let S_seg_star := S_seg_0 \ S_seg₂ + let S_seg' := S_seg₂ ∪ S_seg_star + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · rintro B (hB_S₂ | hB_star) + · rw [hα'_disc_S₂ hB_S₂] + refine ⟨(hArr.isClosedDisc B hB_S₂.1).1, fun x hx => ?_⟩ + rw [hα'_pt_S₂ (mem_biUnion hB_S₂ hx)] + exact (hArr.isClosedDisc B hB_S₂.1).2 x hx + · rw [hα'_disc_star hB_star] + refine ⟨(harr_star.isClosedDisc B hB_star.1).1, fun x hx => ?_⟩ + rw [hα'_pt_0 (mem_biUnion hB_star.1 hx)] + exact (harr_star.isClosedDisc B hB_star.1).2 x hx + · have hinter_star_S₂ : ∀ {B A : Society α β}, + B ∈ S_seg_star → A ∈ S_seg₂ → + α'_disc B ∩ α'_disc A ⊆ α'_pt '' (B.Ω.bar ∩ A.Ω.bar) := by + intro B A hB_star hA_S₂ x ⟨hxB, hxA⟩ + rw [hα'_disc_star hB_star] at hxB + rw [hα'_disc_S₂ hA_S₂] at hxA + have hx_Δ : x ∈ Δ := hdisc_star_sub B hB_star.1 hxB + have hx_bdΔ : x ∈ subBd Δ := + (inter_disc_subset_subBd_of_not_subset hS hArr hΔ hNorm hA_S₂.1 hA_S₂.2).1 ⟨hxA, hx_Δ⟩ + obtain ⟨v, hvA_bar, rfl⟩ := hNorm A hA_S₂.1 ⟨hx_bdΔ, hxA⟩ + obtain ⟨w, ⟨hwB_bar, hw_star_bar⟩, hw_eq⟩ := hdisc_star_inter_bd B hB_star.1 ⟨hxB, hx_bdΔ⟩ + have hw_eq_0 : α_pt w = α_pt v := by + rw [← hpt_star_eq w hw_star_bar, hw_eq] + have hv_seg : v ∈ segregationVertices S_seg := mem_biUnion hA_S₂.1 hvA_bar + have hw_seg : w ∈ segregationVertices S_seg := (hsoc_star_Ω.1 ▸ hw_star_bar).1 + have hvw : w = v := hArr.injOn_pts hw_seg hv_seg hw_eq_0 + subst hvw + exact ⟨w, ⟨hwB_bar, hvA_bar⟩, hα'_pt_S₂ (mem_biUnion hA_S₂ hvA_bar)⟩ + rintro B₁ (hB₁_S₂ | hB₁_star) B₂ (hB₂_S₂ | hB₂_star) hne + · rw [hα'_disc_S₂ hB₁_S₂, hα'_disc_S₂ hB₂_S₂] + intro x hx + obtain ⟨v, hv, rfl⟩ := hArr.inter_discs B₁ hB₁_S₂.1 B₂ hB₂_S₂.1 hne hx + exact ⟨v, hv, hα'_pt_S₂ (mem_biUnion hB₁_S₂ hv.1)⟩ + · rw [Set.inter_comm, Set.inter_comm B₁.Ω.bar] + exact hinter_star_S₂ hB₂_star hB₁_S₂ + · exact hinter_star_S₂ hB₁_star hB₂_S₂ + · rw [hα'_disc_star hB₁_star, hα'_disc_star hB₂_star] + intro x hx + obtain ⟨v, hv, rfl⟩ := harr_star.inter_discs B₁ hB₁_star.1 B₂ hB₂_star.1 hne hx + exact ⟨v, hv, hα'_pt_0 (mem_biUnion hB₁_star.1 hv.1)⟩ + · rintro B _ x ⟨_, hxbd⟩ + exact (hxbd (hS.2.2 x)).elim + · have hseg'_cases : ∀ {v : α}, v ∈ segregationVertices S_seg' → + v ∈ segregationVertices S_seg₂ ∨ v ∈ segregationVertices S_seg_0 := by + intro v hv + rcases mem_iUnion₂.mp hv with ⟨B, hB_S₂ | hB_star, hvB⟩ + · exact Or.inl (mem_biUnion hB_S₂ hvB) + · exact Or.inr (mem_biUnion hB_star.1 hvB) + have hinj_0_S₂ : ∀ {u v : α}, + u ∈ segregationVertices S_seg_0 → v ∈ segregationVertices S_seg₂ → + α'_pt u = α'_pt v → u = v := by + intro u v hu_0 hv_S₂ huv + by_cases hv_0 : v ∈ segregationVertices S_seg_0 + · rw [hα'_pt_0 hu_0, hα'_pt_0 hv_0] at huv + exact harr_star.injOn_pts hu_0 hv_0 huv + · exfalso + have hv_not_bar_star : v ∉ localSociety.Ω.bar := fun hbar => hv_0 (hbar_0 hbar) + obtain ⟨A, hA_S₂, hvA_bar⟩ := mem_iUnion₂.mp hv_S₂ + have hv_seg : v ∈ segregationVertices S_seg := mem_biUnion hA_S₂.1 hvA_bar + have hv_not_bdΔ : α_pt v ∉ subBd Δ := by + intro hbd + apply hv_not_bar_star + rw [hsoc_star_Ω.1] + exact ⟨hv_seg, hbd⟩ + have hv_bdA : α_pt v ∈ subBd (α_disc A) := (hArr.isClosedDisc A hA_S₂.1).2 v hvA_bar + have hv_discA : α_pt v ∈ α_disc A := + (hArr.isClosedDisc A hA_S₂.1).1.isClosed.closure_subset_iff.mpr Subset.rfl hv_bdA.1 + have hv_not_Δ : α_pt v ∉ Δ := fun hxΔ => + hv_not_bdΔ ((inter_disc_subset_subBd_of_not_subset hS hArr hΔ hNorm hA_S₂.1 hA_S₂.2).1 + ⟨hv_discA, hxΔ⟩) + rw [hα'_pt_0 hu_0, hα'_pt_S₂ hv_S₂] at huv + exact hv_not_Δ (huv ▸ hpt_star_mem u hu_0) + intro u hu v hv huv + rcases hseg'_cases hu with hu_S₂ | hu_0 <;> rcases hseg'_cases hv with hv_S₂ | hv_0 + · rw [hα'_pt_S₂ hu_S₂, hα'_pt_S₂ hv_S₂] at huv + have hsub : segregationVertices S_seg₂ ⊆ segregationVertices S_seg := + biUnion_mono (fun _ h => h.1) (fun _ _ => Subset.rfl) + exact hArr.injOn_pts (hsub hu_S₂) (hsub hv_S₂) huv + · exact (hinj_0_S₂ hv_0 hu_S₂ huv.symm).symm + · exact hinj_0_S₂ hu_0 hv_S₂ huv + · rw [hα'_pt_0 hu_0, hα'_pt_0 hv_0] at huv + exact harr_star.injOn_pts hu_0 hv_0 huv + · have hnat_congr : ∀ {ν₁ ν₂ : α → S} {Ω : CyclicPerm α} {F : Set S}, + (∀ v ∈ Ω.bar, ν₁ v = ν₂ v) → IsNaturalOrderFrom ν₁ Ω F → IsNaturalOrderFrom ν₂ Ω F := by + intro ν₁ ν₂ Ω F heq ⟨hOArc, φ, hmem, hcw3⟩ + refine ⟨hOArc, φ, fun v hv => heq v hv ▸ hmem v hv, fun v₁ v₂ v₃ hcw => ?_⟩ + obtain ⟨t₁, t₂, t₃, h12, h23, h31, h1, h2, h3⟩ := hcw3 v₁ v₂ v₃ hcw + have hv1 : v₁ ∈ Ω.bar := hcw.2.1 v₁ (by simp) + have hv2 : v₂ ∈ Ω.bar := hcw.2.1 v₂ (by simp) + have hv3 : v₃ ∈ Ω.bar := hcw.2.1 v₃ (by simp) + exact ⟨t₁, t₂, t₃, h12, h23, h31, h1.trans (heq v₁ hv1), + h2.trans (heq v₂ hv2), h3.trans (heq v₃ hv3)⟩ + rintro B (hB_S₂ | hB_star) + · rw [hα'_disc_S₂ hB_S₂] + exact hnat_congr (fun v hv => (hα'_pt_S₂ (mem_biUnion hB_S₂ hv)).symm) + (hArr.natural_order B hB_S₂.1) + · rw [hα'_disc_star hB_star] + exact hnat_congr (fun v hv => (hα'_pt_0 (mem_biUnion hB_star.1 hv)).symm) + (harr_star.natural_order B hB_star.1) + +private theorem replacement_bridge_arrangement_is_compatible + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {α : Type v} + {β : Type w} + (G₀ : Graph α β) + (G' : Graph α β) + (J : Graph α β) + (H : Drawing S) + (η₀ : SpanEmbedding H G₀) + (η' : SpanEmbedding H G') + (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) + (α_pt : α → S) + (Δ : Set S) + (localSociety : Society α β) + (hJ : IsBridge G₀ η₀.imageGraph J) + (hDisj_E : Disjoint E(G') E(J)) + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η₀.vMap v) + (hη'_e : ∀ e ∈ H.E, η'.eMap e = η₀.eMap e) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hΔ : IsClosedDisc Δ) + (hsoc_star_G : localSociety.G = subgraphUnion G₀ J (arrangementPullbackGraph G' S_seg α_disc + α_pt + Δ)) + (hP_le_G₀ : (arrangementPullbackGraph G' S_seg α_disc α_pt Δ) ≤ G₀) + (S_seg_0 : Set (Society α β)) + (h3seg_0 : IsThreeSegregation localSociety.G S_seg_0) + (hseg_0_sub_V : segregationVertices S_seg_0 ⊆ V(localSociety.G)) + (hV_HΔ : (H.interSet Δ).V = H.V ∩ Δ) + (hU_HΔ : (H.interSet Δ).U = H.U ∩ Δ) + (hE_HΔ : (H.interSet Δ).E = {e | e ∈ H.E ∧ e ⊆ Δ}) + (η_Δ : SpanEmbedding (H.interSet Δ) localSociety.G) + (hvMap : η_Δ.vMap = η₀.vMap) (heMap : η_Δ.eMap = η₀.eMap) + (α_disc_star : Society α β → Set S) + (α_pt_star : α → S) + (hdisc_star_sub : ∀ S₀ ∈ S_seg_0, α_disc_star S₀ ⊆ Δ) + (hcomp_star : IsCompatibleWith localSociety.G (H.interSet Δ) η_Δ S_seg_0 α_disc_star α_pt_star) + (α'_disc : Society α β → Set S) + (α'_pt : α → S) + (hα'_disc_S₂ : ∀ {B : Society α β}, B ∈ ({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ}) → α'_disc B = α_disc + B) + (hα'_disc_star : ∀ {B : Society α β}, B ∈ (S_seg_0 \ ({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ})) → + α'_disc B = α_disc_star B) + (hα'_pt_S₂ : ∀ {v : α}, v ∈ segregationVertices ({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ}) → α'_pt v = + α_pt v) + (hα'_pt_0 : ∀ {v : α}, v ∈ segregationVertices S_seg_0 → α'_pt v = α_pt_star v) + (hHV_mem_star_imp_Δ : ∀ v ∈ H.V, η₀.vMap v ∈ V(localSociety.G) → v ∈ Δ) : + IsCompatibleWith G₀ H η₀ (({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ}) ∪ (S_seg_0 \ ({A | A ∈ S_seg ∧ + ¬α_disc A ⊆ Δ}))) α'_disc α'_pt := by + let P_Δ := arrangementPullbackGraph G' S_seg α_disc α_pt Δ + let S_seg₂ := {A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ} + let S_seg_star := S_seg_0 \ S_seg₂ + let S_seg' := S_seg₂ ∪ S_seg_star + refine ⟨?_, ?_, ?_, ?_⟩ + · intro v hvH hv_seg' + rcases mem_iUnion₂.mp hv_seg' with ⟨B, hB_S₂ | hB_star, hvB⟩ + · rw [hα'_pt_S₂ (mem_biUnion hB_S₂ hvB), ← hη'_v v hvH] + exact hComp.pt_eq v hvH (hη'_v v hvH ▸ mem_biUnion hB_S₂.1 hvB) + · have hv_0 : η₀.vMap v ∈ segregationVertices S_seg_0 := mem_biUnion hB_star.1 hvB + have hvΔ : v ∈ Δ := hHV_mem_star_imp_Δ v hvH (hseg_0_sub_V hv_0) + rw [hα'_pt_0 hv_0] + rw [← hvMap] + exact hcomp_star.pt_eq v (hV_HΔ.symm ▸ ⟨hvH, hvΔ⟩) (hvMap.symm ▸ hv_0) + · rintro B (hB_S₂ | hB_star) + · rw [hα'_disc_S₂ hB_S₂, hComp.bd_inter_eq B hB_S₂.1] + ext v + simp only [mem_sep_iff] + exact ⟨fun ⟨hv, hvB⟩ => ⟨hv, hη'_v v hv ▸ hvB⟩, + fun ⟨hv, hvB⟩ => ⟨hv, (hη'_v v hv).symm ▸ hvB⟩⟩ + · rw [hα'_disc_star hB_star] + have hsub_bd : subBd (α_disc_star B) ⊆ Δ := fun _ hx => + hΔ.isClosed.closure_subset_iff.mpr (hdisc_star_sub B hB_star.1) hx.1 + have hU_eq : H.U ∩ subBd (α_disc_star B) = (H.interSet Δ).U ∩ subBd (α_disc_star B) := by + rw [hU_HΔ] + ext x + simp only [mem_inter_iff] + exact ⟨fun ⟨hxU, hxbd⟩ => ⟨⟨hxU, hsub_bd hxbd⟩, hxbd⟩, fun ⟨⟨hxU, _⟩, hxbd⟩ => ⟨hxU, + hxbd⟩⟩ + rw [hU_eq, hcomp_star.bd_inter_eq B hB_star.1, hV_HΔ, hvMap] + ext v + simp only [mem_sep_iff, mem_inter_iff] + refine ⟨fun ⟨⟨hvH, _⟩, hvB⟩ => ⟨hvH, hvB⟩, fun ⟨hvH, hvB⟩ => ⟨⟨hvH, ?_⟩, hvB⟩⟩ + exact hHV_mem_star_imp_Δ v hvH ((h3seg_0.1.le B hB_star.1).vertexSet_mono (B.bar_subset hvB)) + · rintro B (hB_S₂ | hB_star) v hvH + · rw [hα'_disc_S₂ hB_S₂, hComp.inter_V_iff B hB_S₂.1 v hvH, hη'_v v hvH] + · rw [hα'_disc_star hB_star] + by_cases hvΔ : v ∈ Δ + · simpa only [hvMap] using hcomp_star.inter_V_iff B hB_star.1 v (hV_HΔ.symm ▸ ⟨hvH, hvΔ⟩) + · refine ⟨fun hv_disc => (hvΔ (hdisc_star_sub B hB_star.1 hv_disc)).elim, + fun hvB => (hvΔ (hHV_mem_star_imp_Δ v hvH + ((h3seg_0.1.le B hB_star.1).vertexSet_mono hvB))).elim⟩ + · rintro B (hB_S₂ | hB_star) e heH + · rw [hα'_disc_S₂ hB_S₂, hComp.inter_E_iff B hB_S₂.1 e heH, hη'_e e heH] + · rw [hα'_disc_star hB_star] + by_cases heΔ : e ⊆ Δ + · simpa only [heMap] using hcomp_star.inter_E_iff B hB_star.1 e (hE_HΔ.symm ▸ ⟨heH, heΔ⟩) + · refine ⟨fun he_disc => (heΔ (he_disc.trans (hdisc_star_sub B hB_star.1))).elim, + fun heB => ?_⟩ + have he_star : η₀.eMap e ∈ E(localSociety.G) := (h3seg_0.1.le B hB_star.1).edgeSet_mono heB + rw [hsoc_star_G, edgeSet_subgraphUnion hJ.2.1 hP_le_G₀] at he_star + have he_G' : η₀.eMap e ∈ E(G') := + hη'_e e heH ▸ η'.imageGraph_le.edgeSet_mono (η'.bijOn_e.mapsTo heH) + have he_P : η₀.eMap e ∈ E(P_Δ) := + he_star.resolve_left (fun heJ => Set.disjoint_left.mp hDisj_E he_G' heJ) + rw [← hη'_e e heH] at he_P + change η'.eMap e ∈ E(arrangementPullbackGraph G' S_seg α_disc α_pt Δ) at he_P + rw [arrangementPullbackGraph, edgeSet_restrict] at he_P + obtain ⟨A', ⟨hA'_S, hA'_sub⟩, heA'⟩ := mem_iUnion₂.mp he_P.2 + exact (heΔ (((hComp.inter_E_iff A' hA'_S e heH).mpr heA').trans hA'_sub)).elim + +private theorem edges_meeting_replacement_disc_are_carried_inside + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {α : Type v} + {β : Type w} + (G' : Graph α β) + (H : Drawing S) + (η' : SpanEmbedding H G') + (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) + (α_pt : α → S) + (Δ : Set S) + (hS : IsClosedSurface S) + (hSeg : IsThreeSegregation G' S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hΔ : IsClosedDisc Δ) + (hNorm : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) : + ∀ e ∈ H.E, (e ∩ Δ).Nonempty → ∃ A ∈ S_seg, α_disc A ⊆ Δ ∧ η'.eMap e ∈ E(A.G) ∧ e ⊆ Δ := by + rintro e he ⟨x, hxe, hxΔ⟩ + have he_G' : η'.eMap e ∈ E(G') := η'.imageGraph_le.edgeSet_mono (η'.bijOn_e.mapsTo he) + have he_u : η'.eMap e ∈ E(subgraphSUnion G' ((fun A : Society α β => A.G) '' S_seg)) := by + rw [hSeg.1.union_eq]; exact he_G' + rw [edgeSet_subgraphSUnion (by rintro _ ⟨A, hA, rfl⟩; exact hSeg.1.le A hA)] at he_u + obtain ⟨_, ⟨A, hA, rfl⟩, heA⟩ := mem_iUnion₂.mp he_u + have he_disc : e ⊆ α_disc A := (hComp.inter_E_iff A hA e he).mpr heA + have hA_sub : α_disc A ⊆ Δ := by + by_contra hnot + obtain ⟨_, hbar⟩ := inter_disc_subset_subBd_of_not_subset hS hArr hΔ hNorm hA hnot + obtain ⟨y, hy_bar, rfl⟩ := hbar ⟨he_disc hxe, hxΔ⟩ + have hx_bdA : α_pt y ∈ H.U ∩ subBd (α_disc A) := + ⟨(he.2.1 hxe).1, (hArr.isClosedDisc A hA).2 y hy_bar⟩ + rw [hComp.bd_inter_eq A hA] at hx_bdA + exact (he.2.1 hxe).2 hx_bdA.1 + exact ⟨A, hA, hA_sub, heA, he_disc.trans hA_sub⟩ + +private theorem vertices_in_replacement_disc_belong_to_pullback + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {α : Type v} + {β : Type w} + (G₀ : Graph α β) + (G' : Graph α β) + (H : Drawing S) + (η₀ : SpanEmbedding H G₀) + (η' : SpanEmbedding H G') + (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) + (α_pt : α → S) + (Δ : Set S) + (hS : IsClosedSurface S) + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η₀.vMap v) + (hSeg : IsThreeSegregation G' S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hΔ : IsClosedDisc Δ) + (hNorm : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) : + ∀ v ∈ H.V, v ∈ Δ → η₀.vMap v ∈ V((arrangementPullbackGraph G' S_seg α_disc α_pt Δ)) := by + let P_Δ := arrangementPullbackGraph G' S_seg α_disc α_pt Δ + intro v hvH hvΔ + have hv_G' : η'.vMap v ∈ V(G') := η'.imageGraph_le.vertexSet_mono (η'.bijOn_v.mapsTo hvH) + have hv_u : η'.vMap v ∈ V(subgraphSUnion G' ((fun A : Society α β => A.G) '' S_seg)) := by + rw [hSeg.1.union_eq]; exact hv_G' + rw [vertexSet_subgraphSUnion] at hv_u + obtain ⟨_, ⟨A, hA, rfl⟩, hvA⟩ := mem_iUnion₂.mp hv_u + have hv_disc : v ∈ α_disc A := (hComp.inter_V_iff A hA v hvH).mpr hvA + rw [ ← hη'_v v hvH] + change η'.vMap v ∈ V(arrangementPullbackGraph G' S_seg α_disc α_pt Δ) + rw [arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce] + by_cases hA_sub : α_disc A ⊆ Δ + · exact ⟨Or.inl (mem_iUnion₂.mpr ⟨A, ⟨hA, hA_sub⟩, hvA⟩), hv_G'⟩ + · obtain ⟨_, hbar⟩ := inter_disc_subset_subBd_of_not_subset hS hArr hΔ hNorm hA hA_sub + obtain ⟨y, hy_bar, rfl⟩ := hbar ⟨hv_disc, hvΔ⟩ + have hv_bdA : α_pt y ∈ H.U ∩ subBd (α_disc A) := + ⟨H.V_subset_U hvH, (hArr.isClosedDisc A hA).2 y hy_bar⟩ + rw [hComp.bd_inter_eq A hA] at hv_bdA + have hv_seg : η'.vMap (α_pt y) ∈ segregationVertices S_seg := mem_biUnion hA hv_bdA.2 + have hpt_eq : α_pt (η'.vMap (α_pt y)) = α_pt y := hComp.pt_eq (α_pt y) hvH hv_seg + exact ⟨Or.inr ⟨hv_seg, hpt_eq.symm ▸ hvΔ⟩, hv_G'⟩ + +private theorem vertices_on_replacement_boundary_belong_to_society + {S : Type u} + [TopologicalSpace S] + {α : Type v} + {β : Type w} + (G₀ : Graph α β) + (G' : Graph α β) + (H : Drawing S) + (η₀ : SpanEmbedding H G₀) + (η' : SpanEmbedding H G') + (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) + (α_pt : α → S) + (Δ : Set S) + (localSociety : Society α β) + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η₀.vMap v) + (hSeg : IsThreeSegregation G' S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hNorm : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) + (hsoc_star_Ω : IsPullbackPerm S_seg α_pt (subBd Δ) localSociety.Ω) : + ∀ v ∈ H.V, v ∈ subBd Δ → η₀.vMap v ∈ localSociety.Ω.bar ∧ α_pt (η₀.vMap v) = v := by + intro v hvH hv_bd + have hv_G' : η'.vMap v ∈ V(G') := η'.imageGraph_le.vertexSet_mono (η'.bijOn_v.mapsTo hvH) + have hv_u : η'.vMap v ∈ V(subgraphSUnion G' ((fun A : Society α β => A.G) '' S_seg)) := by + rw [hSeg.1.union_eq]; exact hv_G' + rw [vertexSet_subgraphSUnion] at hv_u + obtain ⟨_, ⟨A, hA, rfl⟩, hvA⟩ := mem_iUnion₂.mp hv_u + have hv_disc : v ∈ α_disc A := (hComp.inter_V_iff A hA v hvH).mpr hvA + obtain ⟨y, hy_bar, rfl⟩ := hNorm A hA ⟨hv_bd, hv_disc⟩ + have hv_bdA : α_pt y ∈ H.U ∩ subBd (α_disc A) := + ⟨H.V_subset_U hvH, (hArr.isClosedDisc A hA).2 y hy_bar⟩ + rw [hComp.bd_inter_eq A hA] at hv_bdA + have hv_seg : η₀.vMap (α_pt y) ∈ segregationVertices S_seg := + hη'_v (α_pt y) hvH ▸ mem_biUnion hA hv_bdA.2 + have hpt_eq : α_pt (η₀.vMap (α_pt y)) = α_pt y := by + rw [← hη'_v (α_pt y) hvH] + exact hComp.pt_eq (α_pt y) hvH (hη'_v (α_pt y) hvH ▸ hv_seg) + rw [hsoc_star_Ω.1] + exact ⟨⟨hv_seg, hpt_eq.symm ▸ hv_bd⟩, hpt_eq⟩ + +private theorem replacement_society_uses_vertices_inside_disc + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {α : Type v} + {β : Type w} + (G₀ : Graph α β) + (G' : Graph α β) + (J : Graph α β) + (H : Drawing S) + (η₀ : SpanEmbedding H G₀) + (η' : SpanEmbedding H G') + (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) + (α_pt : α → S) + (Δ : Set S) + (localSociety : Society α β) + (hS : IsClosedSurface S) + (hJ : IsBridge G₀ η₀.imageGraph J) + (hG'_le : G' ≤ G₀) + (hDisj_E : Disjoint E(G') E(J)) + (hInter_V : V(G') ∩ V(J) ⊆ V(η₀.imageGraph)) + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η₀.vMap v) + (hSeg : IsThreeSegregation G' S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hΔ : IsClosedDisc Δ) + (hNorm : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) + (hVJ_Δ : ∀ v ∈ H.V, η₀.vMap v ∈ V(J) → v ∈ Δ \ subBd Δ) + (hsoc_star_G : localSociety.G = subgraphUnion G₀ J (arrangementPullbackGraph G' S_seg α_disc + α_pt + Δ)) + (hsoc_star_Ω : IsPullbackPerm S_seg α_pt (subBd Δ) localSociety.Ω) : + ∀ v ∈ H.V, η₀.vMap v ∈ V(localSociety.G) → v ∈ Δ := by + intro v hvH hv_star + by_contra hv_not_Δ + have hv_G' : η'.vMap v ∈ V(G') := η'.imageGraph_le.vertexSet_mono (η'.bijOn_v.mapsTo hvH) + have hv_u : η'.vMap v ∈ V(subgraphSUnion G' ((fun A : Society α β => A.G) '' S_seg)) := by + rw [hSeg.1.union_eq]; exact hv_G' + rw [vertexSet_subgraphSUnion] at hv_u + obtain ⟨_, ⟨A, hA, rfl⟩, hvA⟩ := mem_iUnion₂.mp hv_u + have hv_disc : v ∈ α_disc A := (hComp.inter_V_iff A hA v hvH).mpr hvA + have hA_not : ¬ (α_disc A ⊆ Δ) := fun hsub => hv_not_Δ (hsub hv_disc) + rw [hη'_v v hvH] at hvA + have hv_bar_star : η₀.vMap v ∈ localSociety.Ω.bar := + (claim_1_of_10_1 hS hJ hG'_le hDisj_E hInter_V hη'_v hSeg hArr hComp + hΔ hNorm hVJ_Δ hsoc_star_G hsoc_star_Ω hA hA_not).2 + ⟨hv_star, hvA⟩ + have hv_seg : η₀.vMap v ∈ segregationVertices S_seg := (hsoc_star_Ω.1 ▸ hv_bar_star).1 + have hpt_v : α_pt (η₀.vMap v) = v := by + rw [← hη'_v v hvH] + exact hComp.pt_eq v hvH (hη'_v v hvH ▸ hv_seg) + have hv_bdΔ : v ∈ subBd Δ := hpt_v ▸ (hsoc_star_Ω.1 ▸ hv_bar_star).2 + exact hv_not_Δ (hΔ.isClosed.closure_subset_iff.mpr Subset.rfl hv_bdΔ.1) + +private theorem replacement_disc_segregation_is_tangle_local + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {α : Type v} + {β : Type w} + (G₀ : Graph α β) + (G' : Graph α β) + (J : Graph α β) + (H : Drawing S) + (η₀ : SpanEmbedding H G₀) + (η' : SpanEmbedding H G') + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (θ : ℕ) + (beta : ℕ) + (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) + (α_pt : α → S) + (Δ : Set S) + (localSociety : Society α β) + (hMetric : HasTangleMetric H θ T d) + (hθ : 16 * beta + 17 ≤ θ) + (hJ : IsBridge G₀ η₀.imageGraph J) + (hDisj_E : Disjoint E(G') E(J)) + (hη'_e : ∀ e ∈ H.E, η'.eMap e = η₀.eMap e) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hsoc_star_G : localSociety.G = subgraphUnion G₀ J (arrangementPullbackGraph G' S_seg α_disc + α_pt + Δ)) + (hP_le_G₀ : (arrangementPullbackGraph G' S_seg α_disc α_pt Δ) ≤ G₀) + (S_seg_0 : Set (Society α β)) + (h3seg_0 : IsThreeSegregation localSociety.G S_seg_0) : + ∀ S₀ ∈ (S_seg_0 \ ({A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ})), ∀ (B : Graph α β), IsGraphSeparation G₀ + S₀.G B → V(S₀.G) ∩ V(B) = S₀.Ω.bar → ∃ A_H B_H, H.toHypergraph.IsSeparation A_H B_H ∧ + A_H.vertexSet = {v | v ∈ H.V ∧ η₀.vMap v ∈ V(S₀.G)} ∧ B_H.vertexSet = {v | v ∈ H.V ∧ η₀.vMap + v ∈ V(B)} ∧ A_H.edgeSet = {e | e ∈ H.E ∧ η₀.eMap e ∈ E(S₀.G)} ∧ B_H.edgeSet = {e | e ∈ H.E ∧ + η₀.eMap e ∈ E(B)} ∧ ((A_H, B_H) ∈ T ∨ (B_H, A_H) ∈ T) ∧ B_H.separationOrder A_H ≤ 3 ∧ ∀ e ∈ + A_H.edgeSet, (e ∩ Δ).Nonempty := by + let P_Δ := arrangementPullbackGraph G' S_seg α_disc α_pt Δ + let S_seg₂ := {A | A ∈ S_seg ∧ ¬α_disc A ⊆ Δ} + let S_seg_star := S_seg_0 \ S_seg₂ + intro S₀ hS₀ B hsepB hVB_eq + have hS₀_0 : S₀ ∈ S_seg_0 := hS₀.1 + have hS₀_le_star : S₀.G ≤ localSociety.G := h3seg_0.1.le S₀ hS₀_0 + let mkSub (X : Graph α β) (hX : X ≤ G₀) : Hypergraph S (Set S) := + { vertexSet := {v ∈ H.V | η₀.vMap v ∈ V(X)} + edgeSet := {e ∈ H.E | η₀.eMap e ∈ E(X)} + Inc := fun e v => H.toHypergraph.Inc e v ∧ e ∈ H.E ∧ η₀.eMap e ∈ E(X) + vertex_mem_of_inc := fun e v h => by + refine ⟨h.1.2.1, ?_⟩ + obtain ⟨w, hlink_im⟩ := (η₀.inc_iff e h.2.1 v h.1.2.1).mpr h.1.2.2 + have hlink_G₀ : G₀.IsLink (η₀.eMap e) (η₀.vMap v) w := + (η₀.imageGraph_le.isLink_iff (η₀.bijOn_e.mapsTo h.2.1)).mp hlink_im + exact ((hX.isLink_iff h.2.2).mpr hlink_G₀).left_mem + edge_mem_of_inc := fun _ _ h => h.2 + vertexSet_finite := H.finite_V.subset fun _ h => h.1 + edgeSet_finite := H.finite_edges.subset fun _ h => h.1 } + have hmk_le : ∀ (X : Graph α β) (hX : X ≤ G₀), mkSub X hX ≤ H.toHypergraph := by + intro X hX + refine ⟨fun _ h => h.1, fun _ h => h.1, fun e he => ?_⟩ + ext v + change H.toHypergraph.Inc e v ↔ H.toHypergraph.Inc e v ∧ e ∈ H.E ∧ η₀.eMap e ∈ E(X) + exact ⟨fun h => ⟨h, he.1, he.2⟩, fun h => h.1⟩ + let A_H := mkSub S₀.G hsepB.1 + let B_H := mkSub B hsepB.2.1 + have hAl : A_H ≤ H.toHypergraph := hmk_le S₀.G hsepB.1 + have hBl : B_H ≤ H.toHypergraph := hmk_le B hsepB.2.1 + have hsep_H : H.toHypergraph.IsSeparation A_H B_H := by + refine (GM10.isSeparation_iff_of_le hAl hBl).mpr ⟨?_, ?_, ?_⟩ + · ext v + change (v ∈ H.V ∧ η₀.vMap v ∈ V(S₀.G) ∨ v ∈ H.V ∧ η₀.vMap v ∈ V(B)) ↔ v ∈ H.V + refine ⟨by rintro (⟨hv, _⟩ | ⟨hv, _⟩) <;> exact hv, fun hv => ?_⟩ + have hvG₀ : η₀.vMap v ∈ V(S₀.G) ∪ V(B) := by + rw [hsepB.2.2.1] + exact η₀.imageGraph_le.vertexSet_mono (η₀.bijOn_v.mapsTo hv) + rcases hvG₀ with hvA | hvB + · exact Or.inl ⟨hv, hvA⟩ + · exact Or.inr ⟨hv, hvB⟩ + · ext e + change (e ∈ H.E ∧ η₀.eMap e ∈ E(S₀.G) ∨ e ∈ H.E ∧ η₀.eMap e ∈ E(B)) ↔ e ∈ H.E + refine ⟨by rintro (⟨he, _⟩ | ⟨he, _⟩) <;> exact he, fun he => ?_⟩ + have heG₀ : η₀.eMap e ∈ E(S₀.G) ∪ E(B) := by + rw [hsepB.2.2.2.1] + exact η₀.imageGraph_le.edgeSet_mono (η₀.bijOn_e.mapsTo he) + rcases heG₀ with heA | heB + · exact Or.inl ⟨he, heA⟩ + · exact Or.inr ⟨he, heB⟩ + · ext e + change ((e ∈ H.E ∧ η₀.eMap e ∈ E(S₀.G)) ∧ (e ∈ H.E ∧ η₀.eMap e ∈ E(B))) ↔ + e ∈ (∅ : Set (Set S)) + simp only [mem_empty_iff_false, iff_false] + rintro ⟨⟨_, heA⟩, ⟨_, heB⟩⟩ + exact Set.disjoint_left.mp hsepB.2.2.2.2 heA heB + have hord_BA : separationOrder B_H A_H ≤ 3 := by + have hsub_img : η₀.vMap '' (B_H ∩ A_H).vertexSet ⊆ S₀.Ω.bar := by + rintro x ⟨v, ⟨hvB, hvA⟩, rfl⟩ + rw [← hVB_eq] + exact ⟨hvA.2, hvB.2⟩ + have hinj : InjOn η₀.vMap (B_H ∩ A_H).vertexSet := + η₀.bijOn_v.injOn.mono fun v ⟨hvB, _⟩ => hvB.1 + calc separationOrder B_H A_H + _ = (η₀.vMap '' (B_H ∩ A_H).vertexSet).ncard := hinj.ncard_image.symm + _ ≤ S₀.Ω.bar.ncard := Set.ncard_le_ncard hsub_img S₀.Ω.finite_bar + _ ≤ 3 := h3seg_0.2 S₀ hS₀_0 + have hord_AB : separationOrder A_H B_H < θ := by + have hcomm : (A_H ∩ B_H).vertexSet = (B_H ∩ A_H).vertexSet := Set.inter_comm _ _ + have hle3 : separationOrder A_H B_H ≤ 3 := by + simpa [separationOrder, hcomm] using hord_BA + omega + have hor_T : (A_H, B_H) ∈ T ∨ (B_H, A_H) ∈ T := + hMetric.1.2.1.axiom1 hsep_H hord_AB + refine ⟨A_H, B_H, hsep_H, rfl, rfl, rfl, rfl, hor_T, hord_BA, ?_⟩ + rintro e ⟨heH, heS₀⟩ + have he_star : η₀.eMap e ∈ E(localSociety.G) := hS₀_le_star.edgeSet_mono heS₀ + rw [hsoc_star_G, edgeSet_subgraphUnion hJ.2.1 hP_le_G₀] at he_star + have he_G' : η₀.eMap e ∈ E(G') := + hη'_e e heH ▸ η'.imageGraph_le.edgeSet_mono (η'.bijOn_e.mapsTo heH) + have he_P : η₀.eMap e ∈ E(P_Δ) := + he_star.resolve_left (fun heJ => Set.disjoint_left.mp hDisj_E he_G' heJ) + rw [← hη'_e e heH] at he_P + change η'.eMap e ∈ E(arrangementPullbackGraph G' S_seg α_disc α_pt Δ) at he_P + rw [arrangementPullbackGraph, edgeSet_restrict] at he_P + obtain ⟨A', ⟨hA'_S, hA'_sub⟩, heA'⟩ := mem_iUnion₂.mp he_P.2 + have he_sub_Δ : e ⊆ Δ := ((hComp.inter_E_iff A' hA'_S e heH).mpr heA').trans hA'_sub + obtain ⟨p, hp⟩ := heH.1 + exact ⟨p, hp, he_sub_Δ hp⟩ + +/-- Local disc-replacement and arrangement-gluing step in Case 2 of the proof of Graph Minors XIV, +(10.1) (page 50), proved from `(8.1)` (`theorem_8_1_proof`) and `(6.5)` (`theorem_6_5_proof`). -/ +private theorem disc_replacement_gluing_10_1 {α : Type v} {β : Type w} + (G₀ G' J : Graph α β) (H : Drawing S) (η₀ : SpanEmbedding H G₀) (η' : SpanEmbedding H G') + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (θ beta : ℕ) + (S_seg : Set (Society α β)) (α_disc : Society α β → Set S) (α_pt : α → S) + (Δ : Set S) (localSociety : Society α β) + (hS : IsClosedSurface S) + (hMetric : HasTangleMetric H θ T d) (hθ : 16 * beta + 17 ≤ θ) + (hJ : IsBridge G₀ η₀.imageGraph J) + (hG'_le : G' ≤ G₀) (hG₀_eq : G₀ = subgraphUnion G₀ G' J) + (hDisj_E : Disjoint E(G') E(J)) (hInter_V : V(G') ∩ V(J) ⊆ V(η₀.imageGraph)) + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η₀.vMap v) + (hη'_e : ∀ e ∈ H.E, η'.eMap e = η₀.eMap e) + (hSeg : IsThreeSegregation G' S_seg) + (hLoc : IsTangleLocal G' H η' T S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hΔ : IsClosedDisc Δ) + (hNorm : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) + (hRig_Δ : IsRigidIn (H.interSet Δ) Δ) + (hVJ_Δ : ∀ v ∈ H.V, η₀.vMap v ∈ V(J) → v ∈ Δ \ subBd Δ) + (hsoc_star_G : localSociety.G = subgraphUnion G₀ J (arrangementPullbackGraph G' S_seg α_disc + α_pt + Δ)) + (hsoc_star_Ω : IsPullbackPerm S_seg α_pt (subBd Δ) localSociety.Ω) + (hno_crooked2 : ∀ P_set : Set (Graph α β), localSociety.IsCrookedTransaction P_set + → P_set.ncard ≠ 2) : + ∃ (S_seg_star : Set (Society α β)) + (α_disc_star : Society α β → Set S) (α_pt_star : α → S), + (∀ S₀ ∈ S_seg_star, ∀ B : Graph α β, + IsGraphSeparation G₀ S₀.G B → V(S₀.G) ∩ V(B) = S₀.Ω.bar → + ∃ A_H B_H : Hypergraph S (Set S), + H.toHypergraph.IsSeparation A_H B_H ∧ + A_H.vertexSet = {v ∈ H.V | η₀.vMap v ∈ V(S₀.G)} ∧ + B_H.vertexSet = {v ∈ H.V | η₀.vMap v ∈ V(B)} ∧ + A_H.edgeSet = {e ∈ H.E | η₀.eMap e ∈ E(S₀.G)} ∧ + B_H.edgeSet = {e ∈ H.E | η₀.eMap e ∈ E(B)} ∧ + ((A_H, B_H) ∈ T ∨ (B_H, A_H) ∈ T) ∧ + separationOrder B_H A_H ≤ 3 ∧ + (∀ e ∈ A_H.edgeSet, (e ∩ Δ).Nonempty)) ∧ + (IsTangleLocal G₀ H η₀ T S_seg_star → + let S_seg₂ := {S₀ ∈ S_seg | ¬ (α_disc S₀ ⊆ Δ)} + let S_seg' := S_seg₂ ∪ S_seg_star + IsThreeSegregation G₀ S_seg' ∧ + IsTangleLocal G₀ H η₀ T S_seg' ∧ + IsSurfaceArrangement S_seg' + (gluedArrangementDisc S_seg₂ α_disc α_disc_star) + (gluedArrangementPt S_seg₂ α_pt α_pt_star) ∧ + IsCompatibleWith G₀ H η₀ S_seg' + (gluedArrangementDisc S_seg₂ α_disc α_disc_star) + (gluedArrangementPt S_seg₂ α_pt α_pt_star)) := by + classical + let P_Δ := arrangementPullbackGraph G' S_seg α_disc α_pt Δ + have hP_le_G' : P_Δ ≤ G' := restrict_le.trans (G'.induce_le inter_subset_right) + have hP_le_G₀ : P_Δ ≤ G₀ := hP_le_G'.trans hG'_le + have hstar_le : localSociety.G ≤ G₀ := by + rw [hsoc_star_G] + exact subgraphUnion_le hJ.2.1 hP_le_G₀ + -- Step 1: Apply `(8.1)` (`exists_surface_arrangement_in_disc_of_8_1`) to `localSociety` in `Δ`. + have hinj_bar : InjOn α_pt localSociety.Ω.bar := + hArr.injOn_pts.mono (fun v hv => (hsoc_star_Ω.1 ▸ hv).1) + obtain ⟨S_seg_0, α_disc_0, α_pt_0, h3seg_0, hbar_0, harr_0, + hdisc_0_sub, hpt_0_eq, hpt_0_mem, hpt_0_int, hdisc_0_inter_bd⟩ := + exists_surface_arrangement_in_disc_of_8_1 hS hΔ localSociety hno_crooked2 + α_pt hinj_bar hsoc_star_Ω.2 + have hseg_0_sub_V : segregationVertices S_seg_0 ⊆ V(localSociety.G) := by + intro v hv + rcases mem_iUnion₂.mp hv with ⟨B, hB, hvB⟩ + exact (h3seg_0.1.le B hB).vertexSet_mono (B.bar_subset hvB) + -- Step 2: Establish properties of `H.interSet Δ` and construct `η_Δ : SpanEmbedding (H.interSet + -- Δ) localSociety.G`. + have hEdges_Δ : ∀ e ∈ H.E, (e ∩ Δ).Nonempty → + ∃ A ∈ S_seg, α_disc A ⊆ Δ ∧ η'.eMap e ∈ E(A.G) ∧ e ⊆ Δ := by + exact edges_meeting_replacement_disc_are_carried_inside (S := S) (α := α) (β := β) G' H η' + S_seg α_disc α_pt Δ hS hSeg hArr hComp hΔ hNorm + obtain ⟨hV_HΔ, hU_HΔ⟩ := + interSet_V_and_U_of_edges hΔ.isClosed (fun e he hne => (hEdges_Δ e he hne).choose_spec.2.2.2) + have hE_HΔ : (H.interSet Δ).E = {e ∈ H.E | e ⊆ Δ} := Drawing.interSet_E H Δ + have hHV_Δ_mem_P : ∀ v ∈ H.V, v ∈ Δ → η₀.vMap v ∈ V(P_Δ) := by + exact vertices_in_replacement_disc_belong_to_pullback (S := S) (α := α) (β := β) G₀ G' H η₀ η' + S_seg α_disc α_pt Δ hS hη'_v hSeg hArr hComp hΔ hNorm + have hHV_bdΔ_mem_bar : ∀ v ∈ H.V, v ∈ subBd Δ → + η₀.vMap v ∈ localSociety.Ω.bar ∧ α_pt (η₀.vMap v) = v := by + exact vertices_on_replacement_boundary_belong_to_society (S := S) (α := α) (β := β) G₀ G' H η₀ + η' S_seg α_disc α_pt Δ localSociety hη'_v hSeg hArr hComp hNorm hsoc_star_Ω + let η_Δ₀ : SpanEmbedding (H.interSet Δ) G₀ := + restrictSpan η₀ (H.V ∩ Δ) {e | e ∈ H.E ∧ e ⊆ Δ} + have hle_star : η_Δ₀.imageGraph ≤ localSociety.G := by + refine ⟨?_, fun b x y hlink => ?_⟩ + · rw [← η_Δ₀.bijOn_v.image_eq, hV_HΔ] + rintro _ ⟨v, ⟨hvH, hvΔ⟩, rfl⟩ + rw [hsoc_star_G, vertexSet_subgraphUnion] + exact Or.inr (hHV_Δ_mem_P v hvH hvΔ) + · have hb_im : b ∈ E(η_Δ₀.imageGraph) := hlink.edge_mem + rw [← η_Δ₀.bijOn_e.image_eq, hE_HΔ] at hb_im + obtain ⟨e, ⟨heH, he_sub⟩, rfl⟩ := hb_im + obtain ⟨p, hp⟩ := heH.1 + obtain ⟨A, hA, hA_sub, heA, _⟩ := hEdges_Δ e heH ⟨p, hp, he_sub hp⟩ + have hb_star : η₀.eMap e ∈ E(localSociety.G) := by + rw [hsoc_star_G, edgeSet_subgraphUnion hJ.2.1 hP_le_G₀] + refine Or.inr ?_ + rw [← hη'_e e heH] + change η'.eMap e ∈ E(arrangementPullbackGraph G' S_seg α_disc α_pt Δ) + rw [arrangementPullbackGraph, edgeSet_restrict] + obtain ⟨u_e, v_e, huv_A⟩ := A.G.exists_isLink_of_mem_edgeSet heA + have huv_G' : G'.IsLink (η'.eMap e) u_e v_e := huv_A.mono (hSeg.1.le A hA) + exact ⟨⟨u_e, v_e, huv_G', + ⟨Or.inl (mem_iUnion₂.mpr ⟨A, ⟨hA, hA_sub⟩, huv_A.left_mem⟩), huv_G'.left_mem⟩, + ⟨Or.inl (mem_iUnion₂.mpr ⟨A, ⟨hA, hA_sub⟩, huv_A.right_mem⟩), huv_G'.right_mem⟩⟩, + mem_iUnion₂.mpr ⟨A, ⟨hA, hA_sub⟩, heA⟩⟩ + exact (hstar_le.isLink_iff hb_star).mpr (hlink.mono η_Δ₀.imageGraph_le) + let η_Δ : SpanEmbedding (H.interSet Δ) localSociety.G := + { η_Δ₀ with imageGraph_le := hle_star } + -- Step 3: Apply `(6.5)` (`theorem_6_5_proof`) to obtain `(α_disc_star, α_pt_star)` compatible + -- with `H.interSet Δ`. + have hHΔ_U : (H.interSet Δ).U ⊆ Δ := hU_HΔ ▸ inter_subset_right + have hbd_in_seg_0 : ∀ v ∈ (H.interSet Δ).V ∩ subBd Δ, η_Δ.vMap v ∈ segregationVertices S_seg_0 + := by + rintro v ⟨hv_HΔ, hv_bd⟩ + rw [hV_HΔ] at hv_HΔ + exact hbar_0 (hHV_bdΔ_mem_bar v hv_HΔ.1 hv_bd).1 + have hα_0_id : ∀ v ∈ (H.interSet Δ).V ∩ subBd Δ, α_pt_0 (η_Δ.vMap v) = v := by + rintro v ⟨hv_HΔ, hv_bd⟩ + rw [hV_HΔ] at hv_HΔ + obtain ⟨hv_bar, hpt_v⟩ := hHV_bdΔ_mem_bar v hv_HΔ.1 hv_bd + exact (hpt_0_eq (η₀.vMap v) hv_bar).trans hpt_v + have hbdΔ : subBd Δ = discBd Δ := by + rw [← IsClosedDisc.frontier_eq_discBd hS hΔ, frontier_eq_closure_inter_closure, subBd, + Set.compl_eq_univ_sdiff] + have hHΔ_bd : (H.interSet Δ).U ∩ subBd Δ ⊆ (H.interSet Δ).V := by + rintro p ⟨hpU, hpbd⟩ + rw [hU_HΔ] at hpU + rw [hV_HΔ] + refine ⟨?_, hpU.2⟩ + by_contra hpV + obtain ⟨e, he, hpe⟩ := H.exists_edge_of_mem hpU.1 hpV + obtain ⟨A, hA, -, heA, -⟩ := hEdges_Δ e he ⟨p, hpe, hpU.2⟩ + obtain ⟨y, hy_bar, rfl⟩ := hNorm A hA ⟨hpbd, (hComp.inter_E_iff A hA e he).mpr heA hpe⟩ + have hx_bdA : α_pt y ∈ H.U ∩ subBd (α_disc A) := + ⟨hpU.1, (hArr.isClosedDisc A hA).2 y hy_bar⟩ + rw [hComp.bd_inter_eq A hA] at hx_bdA + exact hpV hx_bdA.1 + have hα_0_bd : ∀ v ∈ (H.interSet Δ).V, η_Δ.vMap v ∈ segregationVertices S_seg_0 → + α_pt_0 (η_Δ.vMap v) ∈ subBd Δ → v ∈ subBd Δ := by + intro v hv hv_seg hv_bd + rw [hV_HΔ] at hv + have hbar : η_Δ.vMap v ∈ localSociety.Ω.bar := by + by_contra hn + exact (hpt_0_int _ hv_seg hn).2 hv_bd + have hbar' := hbar + rw [hsoc_star_Ω.1] at hbar' + have hseg' : η'.vMap v ∈ segregationVertices S_seg := (hη'_v v hv.1).symm ▸ hbar'.1 + have hpt : α_pt (η'.vMap v) = v := hComp.pt_eq v hv.1 hseg' + have hbd' : α_pt (η'.vMap v) ∈ subBd Δ := (hη'_v v hv.1).symm ▸ hbar'.2 + rwa [hpt] at hbd' + obtain ⟨α_disc_star, α_pt_star, harr_star, hdisc_star_sub, hcomp_star, + hpt_star_bd, hpt_star_int, hdisc_star_bd_eq⟩ := + theorem_6_5_proof hΔ hbdΔ hHΔ_U hHΔ_bd hRig_Δ η_Δ + h3seg_0 hbd_in_seg_0 harr_0 hdisc_0_sub hα_0_id hα_0_bd + have hpt_star_eq : ∀ v ∈ localSociety.Ω.bar, α_pt_star v = α_pt v := by + intro v hv + have hv_bd : α_pt_0 v ∈ subBd Δ := hpt_0_eq v hv ▸ (hsoc_star_Ω.1 ▸ hv).2 + exact (hpt_star_bd v hv_bd).trans (hpt_0_eq v hv) + have hpt_star_mem : ∀ v ∈ segregationVertices S_seg_0, α_pt_star v ∈ Δ := by + intro v hv + by_cases hv_bar : v ∈ localSociety.Ω.bar + · rw [hpt_star_eq v hv_bar] + exact hΔ.isClosed.closure_subset_iff.mpr Subset.rfl ((hsoc_star_Ω.1 ▸ hv_bar).2.1) + · exact (hpt_star_int v (hpt_0_int v hv hv_bar)).1 + have hdisc_star_inter_bd : ∀ B ∈ S_seg_0, + α_disc_star B ∩ subBd Δ ⊆ α_pt_star '' (B.Ω.bar ∩ localSociety.Ω.bar) := by + intro B hB x hx + rw [hdisc_star_bd_eq B hB] at hx + obtain ⟨v, ⟨hvB, hv_star⟩, rfl⟩ := hdisc_0_inter_bd B hB hx + refine ⟨v, ⟨hvB, hv_star⟩, ?_⟩ + rw [hpt_star_eq v hv_star, hpt_0_eq v hv_star] + -- Define `S_seg₂` and `S_seg_star = S_seg_0 \ S_seg₂`. + let S_seg₂ : Set (Society α β) := {A ∈ S_seg | ¬ (α_disc A ⊆ Δ)} + let S_seg_star : Set (Society α β) := S_seg_0 \ S_seg₂ + refine ⟨S_seg_star, α_disc_star, α_pt_star, ?_, ?_⟩ + · exact replacement_disc_segregation_is_tangle_local (S := S) (α := α) (β := β) G₀ G' J H η₀ η' + T d θ beta S_seg α_disc α_pt Δ localSociety hMetric hθ hJ hDisj_E hη'_e hComp hsoc_star_G + hP_le_G₀ S_seg_0 h3seg_0 + · -- Part 2: Gluing `S_seg₂` and `S_seg_star` once `IsTangleLocal G₀ H η₀ T S_seg_star` holds. + intro hLoc_star + let S_seg' : Set (Society α β) := S_seg₂ ∪ S_seg_star + have hS_seg'_eq : S_seg' = S_seg₂ ∪ S_seg_0 := by + ext B + simp only [S_seg', S_seg_star, mem_union, mem_sdiff] + tauto + let α'_disc := gluedArrangementDisc S_seg₂ α_disc α_disc_star + let α'_pt := gluedArrangementPt S_seg₂ α_pt α_pt_star + have hα'_disc_S₂ : ∀ {B : Society α β}, B ∈ S_seg₂ → α'_disc B = α_disc B := by + intro B hB + simp [α'_disc, gluedArrangementDisc, hB] + have hα'_disc_star : ∀ {B : Society α β}, B ∈ S_seg_star → α'_disc B = α_disc_star B := by + intro B hB + have hnot : B ∉ S_seg₂ := hB.2 + simp [α'_disc, gluedArrangementDisc, hnot] + have hα'_pt_S₂ : ∀ {v : α}, v ∈ segregationVertices S_seg₂ → α'_pt v = α_pt v := by + intro v hv + simp [α'_pt, gluedArrangementPt, hv] + have hα'_pt_0 : ∀ {v : α}, v ∈ segregationVertices S_seg_0 → α'_pt v = α_pt_star v := by + intro v hv_0 + by_cases hv_S₂ : v ∈ segregationVertices S_seg₂ + · rw [hα'_pt_S₂ hv_S₂] + obtain ⟨A, hA_S₂, hvA⟩ := mem_iUnion₂.mp hv_S₂ + have hv_bar_star : v ∈ localSociety.Ω.bar := + (claim_1_of_10_1 hS hJ hG'_le hDisj_E hInter_V hη'_v hSeg hArr hComp + hΔ hNorm hVJ_Δ hsoc_star_G hsoc_star_Ω hA_S₂.1 hA_S₂.2).2 + ⟨hseg_0_sub_V hv_0, A.bar_subset hvA⟩ + exact (hpt_star_eq v hv_bar_star).symm + · simp [α'_pt, gluedArrangementPt, hv_S₂] + have hS₂fin : S_seg₂.Finite := hSeg.1.finite.subset fun _ h => h.1 + have hFin' : S_seg'.Finite := hS₂fin.union (h3seg_0.1.finite.subset sdiff_subset) + have hLe' : ∀ B ∈ S_seg', B.G ≤ G₀ := by + rintro B (hB_S₂ | hB_star) + · exact (hSeg.1.le B hB_S₂.1).trans hG'_le + · exact (h3seg_0.1.le B hB_star.1).trans hstar_le + -- `IsThreeSegregation G₀ S_seg'` + have h3seg' : IsThreeSegregation G₀ S_seg' := by + exact replacement_bridge_pieces_form_three_segregation (S := S) (α := α) (β := β) G₀ G' J H + η₀ η' S_seg α_disc α_pt Δ localSociety hS hJ hG'_le hG₀_eq hDisj_E hInter_V hη'_v hSeg hArr + hComp hΔ hNorm hVJ_Δ hsoc_star_G hsoc_star_Ω hP_le_G₀ S_seg_0 h3seg_0 hbar_0 hS_seg'_eq + hFin' hLe' + -- `IsTangleLocal G₀ H η₀ T S_seg'` + have hLoc' : IsTangleLocal G₀ H η₀ T S_seg' := by + exact replacement_bridge_segregation_is_tangle_local (S := S) (α := α) (β := β) G₀ G' H η₀ + η' T S_seg α_disc Δ hG'_le hη'_v hη'_e hSeg hLoc S_seg_0 hLoc_star + -- `IsSurfaceArrangement S_seg' α'_disc α'_pt` + have hArr' : IsSurfaceArrangement S_seg' α'_disc α'_pt := by + exact replacement_bridge_discs_form_surface_arrangement (S := S) (α := α) (β := β) S_seg + α_disc α_pt Δ localSociety hS hArr hΔ hNorm hsoc_star_Ω S_seg_0 hbar_0 α_disc_star α_pt_star + harr_star hdisc_star_sub hpt_star_eq hpt_star_mem hdisc_star_inter_bd α'_disc α'_pt + hα'_disc_S₂ hα'_disc_star hα'_pt_S₂ hα'_pt_0 + -- `IsCompatibleWith G₀ H η₀ S_seg' α'_disc α'_pt` + have hHV_mem_star_imp_Δ : ∀ v ∈ H.V, η₀.vMap v ∈ V(localSociety.G) → v ∈ Δ := by + exact replacement_society_uses_vertices_inside_disc (S := S) (α := α) (β := β) G₀ G' J H η₀ + η' S_seg α_disc α_pt Δ localSociety hS hJ hG'_le hDisj_E hInter_V hη'_v hSeg hArr hComp hΔ + hNorm hVJ_Δ hsoc_star_G hsoc_star_Ω + have hComp' : IsCompatibleWith G₀ H η₀ S_seg' α'_disc α'_pt := by + exact replacement_bridge_arrangement_is_compatible (S := S) (α := α) (β := β) G₀ G' J H η₀ + η' S_seg α_disc α_pt Δ localSociety hJ hDisj_E hη'_v hη'_e hComp hΔ hsoc_star_G hP_le_G₀ + S_seg_0 h3seg_0 hseg_0_sub_V hV_HΔ hU_HΔ hE_HΔ η_Δ rfl rfl α_disc_star α_pt_star + hdisc_star_sub + hcomp_star α'_disc α'_pt hα'_disc_S₂ hα'_disc_star hα'_pt_S₂ hα'_pt_0 hHV_mem_star_imp_Δ + exact ⟨h3seg', hLoc', hArr', hComp'⟩ + +/-! ## Inductive Bridge Step for (10.1) (pages 49–50) -/ + +/-- **Inductive bridge step in the proof of (10.1)** (Graph Minors XIV, Section 10, pages 49–50): +given a bridge `J` of `H` in `G₀` with `u ∈ H.V` and `η₀(u) ∈ V(J)`, a `T`-local 3-segregation +`S_seg` of `G'` (the union of `H` and all other bridges), and an arrangement `α` compatible with +`H`, we apply `(9.6)` (`theorem_9_6_proof` with `π = 2`), rule out `(9.6)(iv)(a)` via hypothesis +`(ii)`, +and apply `(8.1)` (`Theorem81Statement`), `(6.1)` (`theorem_6_1_proof`), `(6.5)` +(`theorem_6_5_proof`), and +`(7.3)` (`theorem_7_3_proof`) to construct a `T`-local 3-segregation of `G₀` and an arrangement +compatible with `H`. -/ +theorem bridge_step_10_1 {α : Type v} {β : Type w} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + (G₀ G' J : Graph α β) (B_rem : Set (Graph α β)) + (H : Drawing S) (η₀ : SpanEmbedding H G₀) (η' : SpanEmbedding H G') + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (θ beta : ℕ) + (hV_fin : V(G₀).Finite) (hE_fin : E(G₀).Finite) + (hRig : IsRigid H) (hMetric : HasTangleMetric H θ T d) + (hbeta : 12 ≤ beta ∧ Even beta) (hθ : 16 * beta + 17 ≤ θ) + (hJ : IsBridge G₀ η₀.imageGraph J) + (hB_rem : ∀ B ∈ B_rem, IsBridge G₀ η₀.imageGraph B) + (hJ_not_rem : J ∉ B_rem) + (hJ_eq : J = subgraphSUnion G₀ {J}) + (hG'_eq : G' = subgraphSUnion G₀ {η₀.imageGraph, subgraphSUnion G₀ B_rem}) + (hG'_le : G' ≤ G₀) + (hG₀_eq : G₀ = subgraphUnion G₀ G' J) + (hDisj_E : Disjoint E(G') E(J)) + (hInter_V : V(G') ∩ V(J) ⊆ V(η₀.imageGraph)) + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η₀.vMap v) + (hη'_e : ∀ e ∈ H.E, η'.eMap e = η₀.eMap e) + (u : S) (huV : u ∈ H.V) + (hJ_dist : ∀ v ∈ H.V, η₀.vMap v ∈ V(J) → d {u} {v} < beta) + (hii_no_eye : ∀ (Λ : Set S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) + (η_cl : SpanEmbedding (clearedSubdrawing H Λ) G₀), + IsLambdaZoneAround H d (3 * beta + 3) {u} Λ → + IsClearedTangle H T d θ (3 * beta + 3) Λ T' d' → + IsRigid (clearedSubdrawing H Λ) → + (∀ v ∈ (clearedSubdrawing H Λ).V, η_cl.vMap v = η₀.vMap v) → + (∀ e ∈ (clearedSubdrawing H Λ).E, η_cl.eMap e = η₀.eMap e) → + ¬ IsDrawingEye G₀ (clearedSubdrawing H Λ) η_cl (θ - 4 * (3 * beta + 3) - 2) T' Λ) + (S_seg : Set (Society α β)) (α_disc : Society α β → Set S) (α_pt : α → S) + (hSeg : IsThreeSegregation G' S_seg) + (hLoc : IsTangleLocal G' H η' T S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) : + ∃ (S_seg_G : Set (Society α β)) (α_disc_G : Society α β → Set S) (α_pt_G : α → S), + IsThreeSegregation G₀ S_seg_G ∧ IsTangleLocal G₀ H η₀ T S_seg_G ∧ + IsSurfaceArrangement S_seg_G α_disc_G α_pt_G ∧ + IsCompatibleWith G₀ H η₀ S_seg_G α_disc_G α_pt_G := by + have huA : ({u} : Set S) ∈ H.A := Or.inl (Or.inl ⟨u, huV, rfl⟩) + have hB_J : ∀ B ∈ ({J} : Set (Graph α β)), IsBridge G₀ η₀.imageGraph B := by + rintro B rfl; exact hJ + have hDisj_B : Disjoint ({J} : Set (Graph α β)) B_rem := + Set.disjoint_singleton_left.mpr hJ_not_rem + -- Step 1: Apply `(9.6)` (`theorem_9_6_proof`) with `π = 2` and `z = {u}` + obtain ⟨Λ, Δ, T₁, d₁, clearedEmbedding, clearedSociety, localSociety, + hZone, hCleared, hΔ_disc, hNorm_Δ, hΛ_sub_Δ, + h96_i, h96_ii, hCout, hRig_Λ, + hη_Λ_v, hη_Λ_e, _, _, hNat_Λ, + hsoc_star_G, hsoc_star_Ω, h96_iv⟩ := + theorem_9_6_proof G₀ G₀ G' J {J} B_rem H η₀ η' θ 2 beta T d {u} + S_seg α_disc α_pt hS hConn hV_fin hE_fin hRig hMetric huA + (by decide) (by decide) hbeta.1 hbeta.2 hθ + hB_J hB_rem hDisj_B hJ_eq hG'_eq hG₀_eq hη'_v hη'_e hJ_dist + hSeg hLoc hArr hComp + -- Step 2: Rule out `(9.6)(iv)(a)` using `hii_no_eye` and `isDrawingEye_of_crookedTransaction` + have hno_crooked2 : ∀ P_set : Set (Graph α β), localSociety.IsCrookedTransaction P_set → + P_set.ncard ≠ 2 := by + rcases h96_iv with ⟨P_set, X, hCrooked, hCard2, hPaths, hX_sub, hEnds, hFreeX⟩ | h_iv_b + · exfalso + have heye : IsDrawingEye G₀ (clearedSubdrawing H Λ) clearedEmbedding (θ - 4 * + (3 * beta + 3) - 2) T₁ Λ := + isDrawingEye_of_crookedTransaction hZone hNat_Λ hCrooked hCard2 hPaths hX_sub hEnds hFreeX + hCleared.hasMetric.1.2.1 + exact hii_no_eye Λ T₁ d₁ clearedEmbedding hZone hCleared hRig_Λ hη_Λ_v hη_Λ_e heye + · intro P_set hCr hCardEq + exact h_iv_b P_set hCr (by omega) + -- Step 3: By `(6.1)` (`isRigidIn_of_normal_closedDisc`), `H ∩ Δ` is rigid in `Δ` + have hRig_Δ : IsRigidIn (H.interSet Δ) Δ := + isRigidIn_of_normal_closedDisc hS hConn hRig hSeg hArr hComp hΔ_disc hNorm_Δ hCout + have hVJ_Δ : ∀ v ∈ H.V, η₀.vMap v ∈ V(J) → v ∈ Δ \ subBd Δ := by + intro v hvV hvJ + exact h96_ii {v} (Or.inl (Or.inl ⟨v, hvV, rfl⟩)) (hJ_dist v hvV hvJ) (mem_singleton v) + -- Step 4: Apply `disc_replacement_gluing_10_1` (`(8.1)` and `(6.5)`) to `localSociety` in `Δ` + obtain ⟨S_seg_star, α_disc_star, α_pt_star, h73_sep, hglue⟩ := + disc_replacement_gluing_10_1 + G₀ G' J H η₀ η' T d θ beta S_seg α_disc α_pt Δ localSociety + hS hMetric hθ hJ hG'_le hG₀_eq hDisj_E hInter_V + hη'_v hη'_e hSeg hLoc hArr hComp hΔ_disc hNorm_Δ hRig_Δ hVJ_Δ + hsoc_star_G hsoc_star_Ω hno_crooked2 + -- Step 5: Prove `IsTangleLocal G₀ H η₀ T S_seg_star` using `(7.3)` (`theorem_7_3_proof`) and + -- `(9.6)(i)` + have hE_ne : H.E.Nonempty := by + obtain ⟨C_out, hCout_cir, hCout_sub⟩ := hCout + obtain ⟨e₀, he₀⟩ := IsCircuit.E_nonempty hCout_cir + exact ⟨e₀, (H.span_isSubdrawing _ _).2 (hCout_sub.2 he₀)⟩ + have hu_not_E : ({u} : Set S) ∉ H.E := fun huE => + (huE.2.1 (mem_singleton u)).2 huV + have hlocal_star : IsTangleLocal G₀ H η₀ T S_seg_star := by + intro S₀ hS₀ B hsepB hVB_eq + rcases h73_sep S₀ hS₀ B hsepB hVB_eq with + ⟨A_H, B_H, hsep_H, hAH_V, hBH_V, hAH_E, hBH_E, hor_T, _, hAH_Δ⟩ + refine ⟨A_H, B_H, hsep_H, hAH_V, hBH_V, hAH_E, hBH_E, ?_⟩ + rcases hor_T with hAB_in | hBA_in + · exact hAB_in + · exfalso + have hAH_ne_u : A_H.edgeSet ≠ {{u}} := fun h_eq => + hu_not_E (hsep_H.left_le.edgeSet_subset (h_eq ▸ mem_singleton {u})) + obtain ⟨e, he_in_A, hge⟩ := + theorem_7_3_proof H θ T d B_H A_H {u} hS hConn hE_ne hMetric huA hBA_in hAH_ne_u + have heE : e ∈ H.E := hsep_H.left_le.edgeSet_subset he_in_A + have heA : e ∈ H.A := Or.inl (Or.inr heE) + have hle : d {u} e ≤ 3 * beta + 6 := h96_i e heA (hAH_Δ e he_in_A) + omega + -- Step 6: Glue `S_seg₂` and `S_seg_star` to obtain `S_seg'` and `(α'_disc, α'_pt)` + rcases hglue hlocal_star with ⟨h3seg', hlocal', harr', hcompat'⟩ + exact ⟨{S₀ ∈ S_seg | ¬ (α_disc S₀ ⊆ Δ)} ∪ S_seg_star, + gluedArrangementDisc {S₀ ∈ S_seg | ¬ (α_disc S₀ ⊆ Δ)} α_disc α_disc_star, + gluedArrangementPt {S₀ ∈ S_seg | ¬ (α_disc S₀ ⊆ Δ)} α_pt α_pt_star, + h3seg', hlocal', harr', hcompat'⟩ + +/-! ## Theorem (10.1) (pages 49–50) -/ + +/-- **Graph Minors XIV, (10.1)** (pages 49–50): +"Let $H$ be a 2-cell, rigid drawing in $\Sigma$, and let $\mathscr{T}$ be a respectful tangle +in $H$ of order $\theta$, with metric $d$. Let $H$ be a subgraph of $G$, let $\beta \ge 12$ +be an even integer with $\theta \ge 16\beta + 17$, and suppose that* (i) $d(u, v) < \beta$ +*for every $H$-path in $G$ with ends $u$, $v$ and* (ii) *if $\mathscr{T}'$ is the tangle of +order $\theta - 4(3\beta + 3) - 2$ obtained from $\mathscr{T}$ by clearing some $(3\beta + +3)$-zone $\Lambda$ such that $H \cap (\Sigma - \Lambda)$ is a rigid drawing in $\Sigma$, +then $\Lambda$ is not an eye of $H \cap (\Sigma - \Lambda)$ in $G$ with respect to +$\mathscr{T}'$.* *Then there is a $\mathscr{T}$-local 3-segregation of $G$ and an +arrangement of it in $\Sigma$ compatible with $H$." -/ +theorem theorem_10_1_proof {α : Type v} {β : Type w} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (θ beta : ℕ) + (hV_fin : V(G).Finite) (hE_fin : E(G).Finite) + (_h2cell : H.IsTwoCell) (hrigid : IsRigid H) + (_hT : IsRespectfulDrawingTangle H θ T) (hmetric : HasTangleMetric H θ T d) + (hbeta : 12 ≤ beta ∧ Even beta) (hθ : 16 * beta + 17 ≤ θ) + (hi_path : ∀ (P : Graph α β) (u v : S), + u ∈ H.V → v ∈ H.V → + IsHPathWithEnds G η.imageGraph P (η.vMap u) (η.vMap v) → + d {u} {v} < beta) + (hii_no_eye : ∀ (Λ : Set S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) + (η_cl : SpanEmbedding (clearedSubdrawing H Λ) G), + IsLambdaZone H d (3 * beta + 3) Λ → + IsRigid (clearedSubdrawing H Λ) → + IsClearedTangle H T d θ (3 * beta + 3) Λ T' d' → + (∀ v ∈ (clearedSubdrawing H Λ).V, η_cl.vMap v = η.vMap v) → + (∀ e ∈ (clearedSubdrawing H Λ).E, η_cl.eMap e = η.eMap e) → + ¬ IsDrawingEye G (clearedSubdrawing H Λ) η_cl (θ - 4 * (3 * beta + 3) - 2) T' Λ) : + ∃ (S_seg : Set (Society α β)) (α_disc : Society α β → Set S) (α_pt : α → S), + IsThreeSegregation G S_seg ∧ IsTangleLocal G H η T S_seg ∧ + IsSurfaceArrangement S_seg α_disc α_pt ∧ IsCompatibleWith G H η S_seg α_disc α_pt := by + have : ConnectedSpace S := hConn + have hd_refl : ∀ x ∈ H.A, d x x = 0 := by + obtain ⟨_, K, ins, _, _, hd_eq⟩ := hmetric + intro x hx + rw [hd_eq x hx x hx] + simp [tangleMetric] + -- Proceed by strong induction on `n = |V(G₀)| + |E(G₀)|` for `G₀ ≤ G` with `η₀(H) = η(H)` + suffices hind : ∀ (n : ℕ) (G₀ : Graph α β) (η₀ : SpanEmbedding H G₀), + V(G₀).ncard + E(G₀).ncard = n → G₀ ≤ G → η₀.imageGraph = η.imageGraph → + (∀ v ∈ H.V, η₀.vMap v = η.vMap v) → + (∀ e ∈ H.E, η₀.eMap e = η.eMap e) → + ∃ (S_seg : Set (Society α β)) (α_disc : Society α β → Set S) (α_pt : α → S), + IsThreeSegregation G₀ S_seg ∧ IsTangleLocal G₀ H η₀ T S_seg ∧ + IsSurfaceArrangement S_seg α_disc α_pt ∧ IsCompatibleWith G₀ H η₀ S_seg α_disc α_pt by + exact hind (V(G).ncard + E(G).ncard) G η rfl (Preorder.le_refl G) rfl + (fun _ _ => rfl) (fun _ _ => rfl) + intro n + induction n using Nat.strongRecOn with + | ind n ih => + intro G₀ η₀ hn hG₀_le hη₀_eq hη₀_v hη₀_e + have hV₀_fin : V(G₀).Finite := hV_fin.subset hG₀_le.vertexSet_mono + have hE₀_fin : E(G₀).Finite := hE_fin.subset hG₀_le.edgeSet_mono + have h17_le_θ : 17 ≤ θ := by omega + -- Base case: `G₀ = η₀(H)` + by_cases hbase : G₀ = η₀.imageGraph + · exact base_case_10_1 hS hConn hV₀_fin hE₀_fin hrigid hmetric h17_le_θ hbase + · -- Inductive step: decompose `G₀` into a bridge `J` and the union `G'` of `H` and all other + -- bridges of `H` in `G₀` + obtain ⟨J, G', B_rem, η', hJ, hB_rem, hJ_not_rem, hJ_eq, hG'_eq, hG'_le, hG₀_eq, + hDisj_E, hInter_V, hη'_eq, hη'_v, hη'_e, hcard_lt⟩ := + exists_bridge_decomposition_of_ne η₀ hV₀_fin hE₀_fin hbase + rw [hn] at hcard_lt + have hG'_le_G : G' ≤ G := hG'_le.trans hG₀_le + have hη'_eq_G : η'.imageGraph = η.imageGraph := hη'_eq.trans hη₀_eq + have hη'_v_G : ∀ v ∈ H.V, η'.vMap v = η.vMap v := + fun v hv => (hη'_v v hv).trans (hη₀_v v hv) + have hη'_e_G : ∀ e ∈ H.E, η'.eMap e = η.eMap e := + fun e he => (hη'_e e he).trans (hη₀_e e he) + -- Apply the induction hypothesis to `G'` + obtain ⟨S_seg, α_disc, α_pt, h3seg, hlocal, harr, hcompat⟩ := + ih (V(G').ncard + E(G').ncard) hcard_lt G' η' rfl hG'_le_G hη'_eq_G hη'_v_G hη'_e_G + -- Split on whether `V(H ∩ J)` is empty or contains some `u ∈ V(H)` + by_cases hVJ : ∃ u ∈ H.V, η₀.vMap u ∈ V(J) + · rcases hVJ with ⟨u, huV, huJ⟩ + have hJ_dist : ∀ v ∈ H.V, η₀.vMap v ∈ V(J) → d {u} {v} < beta := by + intro v hvV hvJ + by_cases huv : u = v + · subst huv + rw [hd_refl {u} (Or.inl (Or.inl ⟨u, huV, rfl⟩))] + omega + · have hvu_ne : η₀.vMap u ≠ η₀.vMap v := + fun hEq => huv (η₀.bijOn_v.injOn huV hvV hEq) + obtain ⟨P, hP₀⟩ := + exists_isHPathWithEnds_of_isBridge hJ huJ hvJ + (η₀.bijOn_v.mapsTo huV) (η₀.bijOn_v.mapsTo hvV) hvu_ne + have hP_G : IsHPathWithEnds G η.imageGraph P (η.vMap u) (η.vMap v) := by + rw [← hη₀_eq, ← hη₀_v u huV, ← hη₀_v v hvV] + exact isHPathWithEnds_mono hG₀_le hP₀ + exact hi_path P u v huV hvV hP_G + have hii_G₀ : ∀ (Λ : Set S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) + (η_cl₀ : SpanEmbedding (clearedSubdrawing H Λ) G₀), + IsLambdaZoneAround H d (3 * beta + 3) {u} Λ → + IsClearedTangle H T d θ (3 * beta + 3) Λ T' d' → + IsRigid (clearedSubdrawing H Λ) → + (∀ v ∈ (clearedSubdrawing H Λ).V, η_cl₀.vMap v = η₀.vMap v) → + (∀ e ∈ (clearedSubdrawing H Λ).E, η_cl₀.eMap e = η₀.eMap e) → + ¬ IsDrawingEye G₀ (clearedSubdrawing H Λ) η_cl₀ (θ - 4 * (3 * beta + 3) - 2) T' Λ := by + intro Λ T' d' η_cl₀ hzone hT' hrig hcl_v hcl_e heye₀ + have hSub_cl : (clearedSubdrawing H Λ).IsSubdrawing H := + clearedSubdrawing_isSubdrawing H Λ + have hzone_lam : IsLambdaZone H d (3 * beta + 3) Λ := + ⟨{u}, Or.inl (Or.inl ⟨u, huV, rfl⟩), hzone⟩ + exact hii_no_eye Λ T' d' (spanEmbeddingMono hG₀_le η_cl₀) hzone_lam hrig hT' + (fun v hv => (hcl_v v hv).trans (hη₀_v v (hSub_cl.1 hv))) + (fun e he => (hcl_e e he).trans (hη₀_e e (hSub_cl.2 he))) + (isDrawingEye_mono hG₀_le η_cl₀ heye₀) + exact bridge_step_10_1 + hS hConn G₀ G' J B_rem H η₀ η' T d θ beta hV₀_fin hE₀_fin hrigid hmetric hbeta hθ + hJ hB_rem hJ_not_rem hJ_eq hG'_eq hG'_le hG₀_eq hDisj_E hInter_V hη'_v hη'_e + u huV hJ_dist hii_G₀ S_seg α_disc α_pt h3seg hlocal harr hcompat + · have hVJ_empty : ∀ v ∈ H.V, η₀.vMap v ∉ V(J) := by + intro v hv hvJ + exact hVJ ⟨v, hv, hvJ⟩ + exact disjoint_bridge_step_10_1 hV₀_fin hE₀_fin hmetric h17_le_θ hJ hG'_le hG₀_eq + hDisj_E hInter_V hVJ_empty hη'_v hη'_e h3seg hlocal harr hcompat + +/-! ## Theorem (4.1) (page 30) -/ + +/-- **Graph Minors XIV, (4.1)** (page 30): +"Let $H$ be a 2-cell rigid drawing in a surface $\Sigma$, and let $\mathscr{T}$ be a +respectful tangle in $H$ of order $\theta \ge 209$ with metric $d$. Let $H$ be a subgraph of +$G$, and suppose that* (i) *$d(u, v) \le 3$ for every $H$-path in $G$ with ends $u, v$, and* +(ii) *if $\mathscr{T}'$ is the tangle of order $\theta - 158$ obtained by clearing some +39-zone $\Lambda$ such that $H \cap (\Sigma - \Lambda)$ is a rigid drawing in $\Sigma$, then +$\Lambda$ is not an eye of $H \cap (\Sigma - \Lambda)$ in $G$ with respect to +$\mathscr{T}'$.* *Then there is a $\mathscr{T}$-local 3-segregation of $G$ and an +arrangement of it in $\Sigma$ compatible with $H$." + +Proved by setting `β = 12` in `(10.1)` (`theorem_10_1_proof`), since `16 * 12 + 17 = 209`, +`3 * 12 + 3 = 39`, `4 * 39 + 2 = 158`, and `3 < 12`. -/ +theorem theorem_4_1_proof {α : Type v} {β : Type w} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (θ : ℕ) + (hV_fin : V(G).Finite) (hE_fin : E(G).Finite) + (h2cell : H.IsTwoCell) (hrigid : IsRigid H) + (hT : IsRespectfulDrawingTangle H θ T) (hmetric : HasTangleMetric H θ T d) + (hθ : 209 ≤ θ) + (hi_path : ∀ (P : Graph α β) (u v : S), + u ∈ H.V → v ∈ H.V → + IsHPathWithEnds G η.imageGraph P (η.vMap u) (η.vMap v) → + d {u} {v} ≤ 3) + (hii_no_eye : ∀ (Λ : Set S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) + (η_cl : SpanEmbedding (clearedSubdrawing H Λ) G), + IsLambdaZone H d 39 Λ → + IsRigid (clearedSubdrawing H Λ) → + IsClearedTangle H T d θ 39 Λ T' d' → + (∀ v ∈ (clearedSubdrawing H Λ).V, η_cl.vMap v = η.vMap v) → + (∀ e ∈ (clearedSubdrawing H Λ).E, η_cl.eMap e = η.eMap e) → + ¬ IsDrawingEye G (clearedSubdrawing H Λ) η_cl (θ - 158) T' Λ) : + ∃ (S_seg : Set (Society α β)) (α_disc : Society α β → Set S) (α_pt : α → S), + IsThreeSegregation G S_seg ∧ IsTangleLocal G H η T S_seg ∧ + IsSurfaceArrangement S_seg α_disc α_pt ∧ IsCompatibleWith G H η S_seg α_disc α_pt := by + -- Set `beta = 12` in `theorem_10_1_proof` + have hbeta12 : 12 ≤ 12 ∧ Even 12 := ⟨le_rfl, ⟨6, rfl⟩⟩ + have hθ12 : 16 * 12 + 17 ≤ θ := by omega + have hi_12 : ∀ (P : Graph α β) (u v : S), + u ∈ H.V → v ∈ H.V → + IsHPathWithEnds G η.imageGraph P (η.vMap u) (η.vMap v) → + d {u} {v} < 12 := by + intro P u v hu hv hP + have hle := hi_path P u v hu hv hP + omega + have hii_12 : ∀ (Λ : Set S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) + (η_cl : SpanEmbedding (clearedSubdrawing H Λ) G), + IsLambdaZone H d (3 * 12 + 3) Λ → + IsRigid (clearedSubdrawing H Λ) → + IsClearedTangle H T d θ (3 * 12 + 3) Λ T' d' → + (∀ v ∈ (clearedSubdrawing H Λ).V, η_cl.vMap v = η.vMap v) → + (∀ e ∈ (clearedSubdrawing H Λ).E, η_cl.eMap e = η.eMap e) → + ¬ IsDrawingEye G (clearedSubdrawing H Λ) η_cl (θ - 4 * (3 * 12 + 3) - 2) T' Λ := by + intro Λ T' d' η_cl hzone hrig hT' hcl_v hcl_e + have h39 : 3 * 12 + 3 = 39 := rfl + have h158 : θ - 4 * (3 * 12 + 3) - 2 = θ - 158 := by omega + rw [h39] at hzone hT' + rw [h158] + exact hii_no_eye Λ T' d' η_cl hzone hrig hT' hcl_v hcl_e + exact theorem_10_1_proof + hS hConn G H η T d θ 12 hV_fin hE_fin h2cell hrigid hT hmetric hbeta12 hθ12 hi_12 hii_12 + +/-! ## Theorem (1.1) (pages 24–25) -/ + +/-- **Graph Minors XIV, (1.1)** (pages 24–25): +"Let $G$ be a 4-connected graph, and let $H$ be a subgraph of $G$ which is a subdivision of a +simple 3-connected graph. Let $\Sigma$ be a connected surface without boundary, not a +sphere, and let $H$ be drawn in $\Sigma$. Suppose that every closed curve in $\Sigma$ that +meets $H$ at most 208 times is null-homotopic. For such a curve $\phi$, let +$\operatorname{ins}(\phi)$ denote the union of the points of $\Sigma$ appearing in $\phi$ +together with all discs in $\Sigma$ with boundary in this set. Then either* (i) *the drawing +of $H$ can be extended to one of $G$, or* (ii) *there is a path of $G$ with distinct ends +$u, v \in V(H)$ and with no other vertex or edge in $H$, such that there is no closed curve +$\phi$ meeting $H$ at most 3 times with $u, v \in \operatorname{ins}(\phi)$, or* (iii) +*there is a circuit $C$ of $H$ bounding an open disc $\Lambda \subseteq \Sigma$, and a point +$x$ of $\Lambda$, and four vertices $a, b, c, d$ of $C$ in order, such that* ... (i) *$H \cap +(\Sigma - \Lambda)$ is a subdivision of a simple 3-connected graph* (ii) *for every $y \in +\Lambda$ there is a closed curve $\phi$ meeting $H$ at most 39 times, with $\{x, y\} +\subseteq \operatorname{ins}(\phi)$* (iii) *$\operatorname{bd}(\Delta) - \Lambda$ meets $H$ +at least 4 times, for every closed disc $\Delta \subseteq \Sigma$ with $a, b, c, d \in +\Delta$, and* (iv) *there are two disjoint paths of $G$ with ends $a, c$ and $b, d$ each +meeting $H$ only within $\Lambda \cup \{a, b, c, d\}$." -/ +theorem theorem_1_1_proof {α : Type v} {β : Type w} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) (hnot_sphere : ¬ IsSphere S) + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (hV_fin : V(G).Finite) (hE_fin : E(G).Finite) + (hG_4conn : 5 ≤ V(G).ncard ∧ + ∀ G₁ G₂ : Graph α β, IsGraphSeparation G G₁ G₂ → + (V(G₁) ∩ V(G₂)).ncard < 4 → V(G₁) = V(G) ∨ V(G₂) = V(G)) + (hH_subdiv : IsSubdivisionOfSimpleThreeConnected η.imageGraph) + (hrep : H.IsRepresentative 209) : + -- `(i)` The drawing of `H` can be extended to one of `G`, OR + (∃ (Γ_G : GraphDrawing G S), H.IsSubdrawing Γ_G.drawing) ∨ + -- `(ii)` There is an `H`-path in `G` whose ends are not enclosed by any closed curve meeting + -- `H` at most 3 times, OR + (∃ (P_G : Graph α β) (u_H v_H : S), + u_H ∈ H.V ∧ v_H ∈ H.V ∧ + IsHPathWithEnds G η.imageGraph P_G (η.vMap u_H) (η.vMap v_H) ∧ + ¬ ∃ φ : C(Circle, S), + (range φ ∩ H.U).encard ≤ 3 ∧ u_H ∈ curveIns φ ∧ v_H ∈ curveIns φ) ∨ + -- `(iii)` There is an eye configuration `(C, Λ₀, x, a, b, c, d)` satisfying `(iii)(i)–(iv)`: + (∃ (C : Drawing S) (Λ₀ : Set S) (x : S) (a b c d_v : S) (P₁ P₂ : Graph α β), + C.IsCircuit ∧ C.IsSubdrawing H ∧ IsOpenDisc Λ₀ ∧ subBd Λ₀ = C.U ∧ x ∈ Λ₀ ∧ + a ∈ C.V ∧ b ∈ C.V ∧ c ∈ C.V ∧ d_v ∈ C.V ∧ + OccurInCircuitOrder C a b c d_v ∧ + IsSubdivisionOfSimpleThreeConnected (clearedSubdrawing H Λ₀).toGraph ∧ + (∀ y ∈ Λ₀, ∃ φ : C(Circle, S), + (range φ ∩ H.U).encard ≤ 39 ∧ x ∈ curveIns φ ∧ y ∈ curveIns φ) ∧ + (∀ Δ : Set S, IsClosedDisc Δ → ({a, b, c, d_v} : Set S) ⊆ Δ → + 4 ≤ ((subBd Δ \ Λ₀) ∩ H.U).encard) ∧ + Disjoint V(P₁) V(P₂) ∧ + IsGraphPathWithEnds G P₁ (η.vMap a) (η.vMap c) ∧ + IsGraphPathWithEnds G P₂ (η.vMap b) (η.vMap d_v)) := by + obtain ⟨T, d, h2cell, hrigid, hT, hmetric, h_ii_from_dist, h_iii_from_eye, h_i_from_3seg⟩ := + theorem11TranslationStatement_proved hS hConn hnot_sphere G H η hV_fin hE_fin hG_4conn + hH_subdiv hrep + -- Check whether `(10.1)(i)` with `β = 12` holds for all `H`-paths in `G` + by_cases hi : ∀ (P : Graph α β) (u v : S), + u ∈ H.V → v ∈ H.V → + IsHPathWithEnds G η.imageGraph P (η.vMap u) (η.vMap v) → + d {u} {v} < 12 + · -- Check whether `(10.1)(ii)` with `β = 12` holds for all 39-zones `Λ` + by_cases hii : ∀ (Λ : Set S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) + (η_cl : SpanEmbedding (clearedSubdrawing H Λ) G), + IsLambdaZone H d 39 Λ → + IsRigid (clearedSubdrawing H Λ) → + IsClearedTangle H T d 209 39 Λ T' d' → + (∀ v ∈ (clearedSubdrawing H Λ).V, η_cl.vMap v = η.vMap v) → + (∀ e ∈ (clearedSubdrawing H Λ).E, η_cl.eMap e = η.eMap e) → + ¬ IsDrawingEye G (clearedSubdrawing H Λ) η_cl (209 - 158) T' Λ + · -- Both `(10.1)(i)` and `(10.1)(ii)` hold (`β = 12`): apply `theorem_10_1_proof` to get + -- `(1.1)(i)` + left + have hbeta12 : 12 ≤ 12 ∧ Even 12 := ⟨le_rfl, ⟨6, rfl⟩⟩ + exact h_i_from_3seg (theorem_10_1_proof + hS hConn G H η T d 209 12 hV_fin hE_fin h2cell hrigid hT hmetric hbeta12 le_rfl hi hii) + · -- `(10.1)(ii)` fails: some 39-zone `Λ` is an eye, giving `(1.1)(iii)` + right; right + by_contra hnot_iii + apply hii + intro Λ T' d' η_cl hzone hrig hT' hv_cl _ heye + exact hnot_iii (h_iii_from_eye Λ T' d' η_cl hzone hrig hT' hv_cl heye) + · -- `(10.1)(i)` fails: some `H`-path has `¬ d({u}, {v}) < 12`, giving `(1.1)(ii)` + right; left + by_contra hnot_ii + apply hi + intro P u v hu hv hP + by_contra hgt + exact hnot_ii (h_ii_from_dist P u v hu hv hP hgt) + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section10Translation1.lean b/LeanPool/GraphMinor/GM14/Section10Translation1.lean new file mode 100644 index 0000000000..2808cef022 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section10Translation1.lean @@ -0,0 +1,651 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.SubDataSep +public import LeanPool.GraphMinor.GM12.Section4MetricExistence +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM11.Theorem66 +import LeanPool.GraphMinor.GM11.FlatCover + +/-! +# Graph Minors XIV – Section 10 Translation (Part 1: Rigidity, 2-Cell, Tangle, and Metric) + +This file proves the first two steps of the translation from the hypotheses of Graph Minors XIV, +(1.1) (pages 24–25) to the hypotheses of (4.1) (pages 30–31): +- `isTwoCell_of_subdivision_and_representative`: a drawing `H` of representativity `≥ 1` on a + connected closed non-spherical surface `S` whose graph is a subdivision of a simple 3-connected + graph is a 2-cell drawing (`H.IsTwoCell`). +- `exists_respectful_tangle_and_metric`: such a drawing `H` admits a respectful tangle `T` of + order `209` and a tangle metric `d` (`IsRespectfulDrawingTangle H 209 T ∧ HasTangleMetric H 209 T + d`). +- `isRigid_of_subdivision_and_respectful_tangle`: such a drawing `H` is rigid (`IsRigid H`). +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Metric Graph Hypergraph +open GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 +open GraphMinor.GM11 GraphMinor.GM12 GraphMinor.GM14.Whitney + +universe u v w + +/-! ## 1. Tangle Orientation of Path Separations -/ + +section TanglePathSep + +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- Left side of the canonical hypergraph separation of `Γ.toHypergraph` induced by an edge set +`E₀ ⊆ Γ.E`. -/ +noncomputable def drawingEdgeSepA (Γ : Drawing S) (E₀ : Set (Set S)) : Hypergraph S (Set S) where + vertexSet := verts Γ.toGraph E₀ + edgeSet := E₀ ∩ Γ.E + Inc e v := Γ.toHypergraph.Inc e v ∧ e ∈ E₀ + vertex_mem_of_inc e _ h := ⟨e, h.2, inc_of_mem_closure h.1.1 h.1.2.2 h.1.2.1⟩ + edge_mem_of_inc _ _ h := ⟨h.2, h.1.1⟩ + vertexSet_finite := Γ.finite_V.subset (fun _ ⟨_, _, _, hl⟩ => hl.left_mem) + edgeSet_finite := Γ.finite_edges.subset inter_subset_right + +/-- Right side of the canonical hypergraph separation of `Γ.toHypergraph` induced by an edge set +`E₀ ⊆ Γ.E`. -/ +noncomputable def drawingEdgeSepB (Γ : Drawing S) (E₀ : Set (Set S)) : Hypergraph S (Set S) where + vertexSet := (Γ.V \ verts Γ.toGraph E₀) ∪ verts Γ.toGraph (Γ.E \ E₀) + edgeSet := Γ.E \ E₀ + Inc e v := Γ.toHypergraph.Inc e v ∧ e ∉ E₀ + vertex_mem_of_inc e _ h := + Or.inr ⟨e, ⟨h.1.1, h.2⟩, inc_of_mem_closure h.1.1 h.1.2.2 h.1.2.1⟩ + edge_mem_of_inc _ _ h := ⟨h.1.1, h.2⟩ + vertexSet_finite := + Γ.finite_V.subset (union_subset sdiff_subset (fun _ ⟨_, _, _, hl⟩ => hl.left_mem)) + edgeSet_finite := Γ.finite_edges.subset sdiff_subset + +omit [T2Space S] in +theorem drawingEdgeSepA_le (Γ : Drawing S) (E₀ : Set (Set S)) : + drawingEdgeSepA Γ E₀ ≤ Γ.toHypergraph where + vertexSet_subset := fun _ ⟨_, _, _, hl⟩ => hl.left_mem + edgeSet_subset := inter_subset_right + ends_eq e he := by + ext v + exact ⟨fun h => ⟨h, he.1⟩, fun h => h.1⟩ + +omit [T2Space S] in +theorem drawingEdgeSepB_le (Γ : Drawing S) (E₀ : Set (Set S)) : + drawingEdgeSepB Γ E₀ ≤ Γ.toHypergraph where + vertexSet_subset := union_subset sdiff_subset (fun _ ⟨_, _, _, hl⟩ => hl.left_mem) + edgeSet_subset := sdiff_subset + ends_eq e he := by + ext v + exact ⟨fun h => ⟨h, he.2⟩, fun h => h.1⟩ + +omit [T2Space S] in +theorem isSeparation_drawingEdgeSep (Γ : Drawing S) (E₀ : Set (Set S)) : + Γ.toHypergraph.IsSeparation (drawingEdgeSepA Γ E₀) (drawingEdgeSepB Γ E₀) := by + rw [isSeparation_iff_of_le (drawingEdgeSepA_le Γ E₀) (drawingEdgeSepB_le Γ E₀)] + refine ⟨?_, ?_, ?_⟩ + · change verts Γ.toGraph E₀ ∪ ((Γ.V \ verts Γ.toGraph E₀) ∪ verts Γ.toGraph (Γ.E \ E₀)) = Γ.V + have hs1 : verts Γ.toGraph E₀ ⊆ Γ.V := fun _ ⟨_, _, _, hl⟩ => hl.left_mem + have hs2 : verts Γ.toGraph (Γ.E \ E₀) ⊆ Γ.V := fun _ ⟨_, _, _, hl⟩ => hl.left_mem + rw [← Set.union_assoc, union_sdiff_self, union_eq_self_of_subset_left hs1, + union_eq_self_of_subset_right hs2] + · change (E₀ ∩ Γ.E) ∪ (Γ.E \ E₀) = Γ.E + rw [Set.inter_comm, inter_union_sdiff] + · change (E₀ ∩ Γ.E) ∩ (Γ.E \ E₀) = ∅ + ext e + simp only [mem_inter_iff, mem_sdiff, mem_empty_iff_false, iff_false, not_and] + exact fun h1 _ h2 => h2 h1.1 + +omit [T2Space S] in +theorem inter_vertexSet_drawingEdgeSep (Γ : Drawing S) (E₀ : Set (Set S)) : + (drawingEdgeSepA Γ E₀ ∩ drawingEdgeSepB Γ E₀).vertexSet = bdry Γ.toGraph E₀ := by + change verts Γ.toGraph E₀ ∩ ((Γ.V \ verts Γ.toGraph E₀) ∪ verts Γ.toGraph (Γ.E \ E₀)) = + verts Γ.toGraph E₀ ∩ verts Γ.toGraph (Γ.E \ E₀) + ext x + simp only [mem_inter_iff, mem_union, mem_sdiff] + exact ⟨fun ⟨h1, h2⟩ => ⟨h1, h2.resolve_left (fun h => h.2 h1)⟩, + fun ⟨h1, h2⟩ => ⟨h1, Or.inr h2⟩⟩ + +omit [T2Space S] in +theorem suffix_bdry_subset {Γ : Drawing S} {x u y : S} + (W₁ : GraphWalk Γ.toGraph x u) (W₂ : GraphWalk Γ.toGraph u y) + (hs : (W₁.append W₂).IsSimple) + (hbd : bdry Γ.toGraph {g | g ∈ (W₁.append W₂).edges} ⊆ {x, y}) : + bdry Γ.toGraph {g | g ∈ W₂.edges} ⊆ {u, y} := by + have hnd : (W₁.support ++ W₂.support.tail).Nodup := by + have h1 : (W₁.append W₂).support.Nodup := hs + rwa [GraphWalk.support_append] at h1 + have hd := List.nodup_append.mp hnd + intro z ⟨⟨g₁, hg₁, hig₁⟩, g₂, ⟨hg₂E, hg₂_not⟩, hig₂⟩ + have hzW₂ : z ∈ W₂.support := inc_mem_support W₂ hg₁ hig₁ + by_contra hz_not + have hzu : z ≠ u := fun h => hz_not (Or.inl h) + have hzy : z ≠ y := fun h => hz_not (Or.inr h) + have hz_tail : z ∈ W₂.support.tail := by + rw [W₂.support_eq_cons] at hzW₂ + exact (List.mem_cons.mp hzW₂).resolve_left hzu + have hg₂_not₁ : g₂ ∉ W₁.edges := by + intro hg₂_1 + have hzW₁ : z ∈ W₁.support := inc_mem_support W₁ hg₂_1 hig₂ + exact hd.2.2 z hzW₁ z hz_tail rfl + have hg₁_full : g₁ ∈ (W₁.append W₂).edges := by + rw [GraphWalk.edges_append] + exact List.mem_append_right _ hg₁ + have hg₂_not_full : g₂ ∉ (W₁.append W₂).edges := by + rw [GraphWalk.edges_append] + exact fun h => (List.mem_append.mp h).elim hg₂_not₁ hg₂_not + have hz_xy : z ∈ ({x, y} : Set S) := + hbd ⟨⟨g₁, hg₁_full, hig₁⟩, g₂, ⟨hg₂E, hg₂_not_full⟩, hig₂⟩ + rcases hz_xy with rfl | rfl + · exact hd.2.2 z W₁.start_mem_support z hz_tail rfl + · exact hzy rfl + +omit [T2Space S] in +theorem walk_edgeSep_mem_tangle {Γ : Drawing S} {ord : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph ord T) (hord : 4 ≤ ord) + {u y : S} (W : GraphWalk Γ.toGraph u y) + (hsuff : ∀ ⦃w : S⦄ (W_a : GraphWalk Γ.toGraph u w) (W_b : GraphWalk Γ.toGraph w y), + W = W_a.append W_b → bdry Γ.toGraph {g | g ∈ W_b.edges} ⊆ {w, y}) : + (drawingEdgeSepA Γ {g | g ∈ W.edges}, drawingEdgeSepB Γ {g | g ∈ W.edges}) ∈ T := by + induction W with + | @nil u hu => + have hemp : {g : Set S | g ∈ (GraphWalk.nil hu : GraphWalk Γ.toGraph u u).edges} = ∅ := by + ext g; simp [GraphWalk.edges] + rw [hemp] + have hsep := isSeparation_drawingEdgeSep Γ ∅ + have hbd_emp : bdry Γ.toGraph ∅ = ∅ := by + ext z; simp [bdry, verts] + have hord0 : separationOrder (drawingEdgeSepA Γ ∅) (drawingEdgeSepB Γ ∅) < ord := by + rw [separationOrder, inter_vertexSet_drawingEdgeSep, hbd_emp, Set.ncard_empty] + omega + rcases hT.axiom1 hsep hord0 with h | h + · exact h + · exfalso + refine hT.axiom3 h ?_ + change (Γ.V \ verts Γ.toGraph ∅) ∪ verts Γ.toGraph (Γ.E \ ∅) = Γ.V + have hv0 : verts Γ.toGraph ∅ = ∅ := by ext z; simp [verts] + have hsub : verts Γ.toGraph (Γ.E \ ∅) ⊆ Γ.V := fun _ ⟨_, _, _, hl⟩ => hl.left_mem + rw [hv0, sdiff_empty, union_eq_self_of_subset_right hsub] + | @cons u v y e hlink rest ih => + have hrest_mem : (drawingEdgeSepA Γ {g | g ∈ rest.edges}, + drawingEdgeSepB Γ {g | g ∈ rest.edges}) ∈ T := + ih fun w W_a W_b h_eq => + hsuff (GraphWalk.cons hlink W_a) W_b (by rw [h_eq]; rfl) + have hends_sub : Γ.toHypergraph.ends e ⊆ {u, v} := by + intro z hz + have hinc : Γ.toGraph.Inc e z := inc_of_mem_closure hz.1 hz.2.2 hz.2.1 + obtain ⟨w, hlk⟩ := hinc + exact Γ.toGraph.eq_or_eq_of_isLink_of_isLink hlk hlink + have he_size : edgeSize Γ.toHypergraph e < ord := by + have hle : (Γ.toHypergraph.ends e).ncard ≤ 2 := + (Set.ncard_le_ncard hends_sub (Set.toFinite _)).trans + (Set.ncard_insert_le u {v} |>.trans (by simp)) + unfold edgeSize + omega + have hKe_mem : (edgeHypergraph Γ.toHypergraph e, Γ.toHypergraph.deleteEdges {e}) ∈ T := + (GM10.theorem_2_7_proof (by omega) hT.isSeparation hT.order_lt hT.axiom1 hT.axiom2).mp + hT e hlink.edge_mem he_size + let A₀ := drawingEdgeSepA Γ {g | g ∈ rest.edges} + let B₀ := drawingEdgeSepB Γ {g | g ∈ rest.edges} + let Ke := edgeHypergraph Γ.toHypergraph e + let De := Γ.toHypergraph.deleteEdges {e} + have hbd_rest : bdry Γ.toGraph {g | g ∈ rest.edges} ⊆ {v, y} := + hsuff (GraphWalk.cons hlink (.nil hlink.right_mem)) rest rfl + have hinter_sub : ((A₀ ∪ Ke) ∩ (B₀ ∩ De)).vertexSet ⊆ {u, v, y} := by + intro z ⟨hzA, hzB, _⟩ + rcases hzA with hzA₀ | hzKe + · have hz_bd : z ∈ bdry Γ.toGraph {g | g ∈ rest.edges} := by + rw [← inter_vertexSet_drawingEdgeSep] + exact ⟨hzA₀, hzB⟩ + rcases hbd_rest hz_bd with rfl | rfl + · exact Or.inr (Or.inl rfl) + · exact Or.inr (Or.inr rfl) + · rcases hends_sub hzKe with rfl | rfl + · exact Or.inl rfl + · exact Or.inr (Or.inl rfl) + have hord_union : separationOrder (A₀ ∪ Ke) (B₀ ∩ De) < ord := by + have hle : ((A₀ ∪ Ke) ∩ (B₀ ∩ De)).vertexSet.ncard ≤ 3 := + (Set.ncard_le_ncard hinter_sub (Set.toFinite _)).trans + ((Set.ncard_insert_le u {v, y}).trans + (Nat.add_le_add_right ((Set.ncard_insert_le v {y}).trans (by simp)) 1)) + unfold separationOrder + omega + have hunion_mem : (A₀ ∪ Ke, B₀ ∩ De) ∈ T := + GM10.theorem_2_2_proof hT hrest_mem hKe_mem hord_union + let E₁ : Set (Set S) := {g | g ∈ (GraphWalk.cons hlink rest).edges} + have hbd₁ : bdry Γ.toGraph E₁ ⊆ {u, y} := + hsuff (.nil hlink.left_mem) (GraphWalk.cons hlink rest) rfl + have hord₁ : separationOrder (drawingEdgeSepA Γ E₁) (drawingEdgeSepB Γ E₁) < ord := by + rw [separationOrder, inter_vertexSet_drawingEdgeSep] + have hle : (bdry Γ.toGraph E₁).ncard ≤ 2 := + (Set.ncard_le_ncard hbd₁ (Set.toFinite _)).trans + (Set.ncard_insert_le u {y} |>.trans (by simp)) + omega + have hE₁_sub : (drawingEdgeSepA Γ E₁).edgeSet ⊆ (A₀ ∪ Ke).edgeSet := by + rintro g ⟨hg, hgE⟩ + simp only [E₁, GraphWalk.edges, List.mem_cons, mem_ofPred_eq] at hg + rcases hg with rfl | hg_rest + · exact Or.inr (mem_singleton g) + · exact Or.inl ⟨hg_rest, hgE⟩ + exact GM10.theorem_2_9_proof hT hunion_mem (isSeparation_drawingEdgeSep Γ E₁) hord₁ + (Or.inr (Or.inr ⟨by omega, hE₁_sub⟩)) + +omit [T2Space S] in +/-- Any separation `(A, B)` of `Γ.toHypergraph` of order `< ord` (`4 ≤ ord`) whose left-hand edge +set `A.edgeSet` is contained in the edge set `E(Q)` of a path `Q` (`IsGraphPathWithEnds Γ.toGraph Q +x y`) +with `bdry Γ.toGraph E(Q) ⊆ {x, y}` belongs to the tangle `T`. -/ +theorem path_sep_mem_tangle {Γ : Drawing S} {ord : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle Γ.toHypergraph ord T) (hord : 4 ≤ ord) + {x y : S} {Q : Graph S (Set S)} (hQ : IsGraphPathWithEnds Γ.toGraph Q x y) + (hbd : bdry Γ.toGraph E(Q) ⊆ {x, y}) + {A B : Hypergraph S (Set S)} (hsep : Γ.toHypergraph.IsSeparation A B) + (hAB_ord : separationOrder A B < ord) (hAE : A.edgeSet ⊆ E(Q)) : + (A, B) ∈ T := by + obtain ⟨hle, W, hs, _, hE⟩ := hQ + obtain ⟨W_Γ, hsupp, hedges⟩ := W.exists_transfer (G' := Γ.toGraph) + (fun _ _ _ _ hlk => hlk.mono hle) + (fun z hz => hle.vertexSet_mono (W.mem_vertexSet_of_mem_support hz)) + have hs_Γ : W_Γ.IsSimple := by + change W_Γ.support.Nodup + rw [hsupp] + exact hs + have hEQ : E(Q) = {g | g ∈ W_Γ.edges} := by + rw [hE, hedges] + have hbd_W : bdry Γ.toGraph {g | g ∈ W_Γ.edges} ⊆ {x, y} := hEQ ▸ hbd + have hmem_EQ : (drawingEdgeSepA Γ E(Q), drawingEdgeSepB Γ E(Q)) ∈ T := by + rw [hEQ] + exact walk_edgeSep_mem_tangle hT hord W_Γ fun w W_a W_b h_eq => + suffix_bdry_subset W_a W_b (h_eq ▸ hs_Γ) (h_eq ▸ hbd_W) + have hA_sub : A.edgeSet ⊆ (drawingEdgeSepA Γ E(Q)).edgeSet := + fun e he => ⟨hAE he, hsep.left_le.edgeSet_subset he⟩ + exact GM10.theorem_2_9_proof hT hmem_EQ hsep hAB_ord (Or.inr (Or.inr ⟨by omega, hA_sub⟩)) + +/-- In a closed disc `Δ` with `subBd Δ = F` and `F ∩ Γ.U ⊆ Γ.V`, every vertex of `Γ` in `Δ \ F` +belongs to `verts Γ.toGraph {e ∈ Γ.E | e ⊆ Δ}` (when `SubData Γ.toGraph G₀ P`). -/ +theorem mem_verts_inter_of_mem_diff_bd {Γ : Drawing S} {G₀ : Graph S (Set S)} + {P : Set S → Graph S (Set S)} (hS : IsClosedSurface S) + (hsd : SubData Γ.toGraph G₀ P) {Δ F : Set S} (hΔ : IsClosedDisc Δ) + (hbd : subBd Δ = F) (hF_norm : F ∩ Γ.U ⊆ Γ.V) {v : S} (hvV : v ∈ Γ.V) (hvΔ : v ∈ Δ \ F) : + v ∈ verts Γ.toGraph {e ∈ Γ.E | e ⊆ Δ} := by + obtain ⟨g, hgE, hig⟩ := SubDataSepGeneral.exists_inc_of_mem_V hsd hvV + have hvc : v ∈ closure g := mem_closure_of_inc hig + have hOpen : IsOpen (Δ \ F) := hbd ▸ (IsClosedDisc.isOpenDisc_diff_subBd hS hΔ).1.1 + obtain ⟨y, hy_open, hyg⟩ := mem_closure_iff.mp hvc (Δ \ F) hOpen hvΔ + have hgΔ : g ⊆ Δ := + edge_subset_of_inter_nonempty hΔ.isClosed (hbd ▸ hF_norm) hgE ⟨y, hyg, hy_open.1⟩ + exact ⟨g, ⟨hgE, hgΔ⟩, hig⟩ + +/-! ## 2. Proof of `H.IsTwoCell`, Respectful Tangle, Metric, and `IsRigid H` -/ + +/-- On a connected closed non-spherical surface `S`, a drawing `H` with `H.IsRepresentative θ` +(`1 ≤ θ`) cannot have `H.U` contained in a closed disc `Δ ⊆ S`. -/ +theorem not_U_subset_closedDisc_of_representative [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) {H : Drawing S} {θ : ℕ} + (hθ : 1 ≤ θ) (hrep : H.IsRepresentative θ) {Δ : Set S} (hΔ : IsClosedDisc Δ) + (hU_sub : H.U ⊆ Δ) : False := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + obtain ⟨Δ', hΔ', h₁, -⟩ := exists_disc_around hman hΔ (fun x _ => hS.2.2 x) isOpen_univ + (subset_univ _) + have hO := IsClosedDisc.isOArc_discBd hΔ' + have hif : Δ' \ discBd Δ' = interior Δ' := by + have := IsClosedDisc.frontier_eq_discBd hS hΔ' + rw [← this, frontier, (IsClosedDisc.isCompact hΔ').isClosed.closure_eq] + ext x + constructor + · rintro ⟨ha, hb⟩ + by_contra h + exact hb ⟨ha, h⟩ + · exact fun h => ⟨interior_subset h, fun h' => h'.2 h⟩ + let Y : Set S := (interior Δ')ᶜ + have hYc : IsClosed Y := isOpen_interior.isClosed_compl + have hbY : discBd Δ' ⊆ Y := fun x hx hi => by + rw [← hif] at hi + exact hi.2 hx + have hY_disj_Δ : Disjoint Y Δ := disjoint_left.mpr fun x hxY hxΔ => + hxY (hif ▸ h₁ hxΔ) + obtain ⟨a, ha⟩ := (infinite_of_isOArc hO).nonempty + obtain ⟨N, hNU, -⟩ := exists_drawing_on_oArc hO (finite_singleton a) + (singleton_nonempty a) (singleton_subset_iff.mpr ha) + have hYn : GM11.IsNice Y := ⟨N, isGammaNice_of_frontier (Drawing.IsSubdrawing.refl N) (hNU ▸ hbY) + (by + rw [hNU, frontier_compl, ← IsClosedDisc.frontier_eq_discBd hS hΔ'] + exact frontier_interior_subset)⟩ + have hu : Y ≠ univ := fun h => by + obtain ⟨x, hx⟩ := (infinite_of_isOArc (IsClosedDisc.isOArc_discBd hΔ)).nonempty + exact (h ▸ mem_univ x : x ∈ Y) (hif ▸ h₁ (Surface.discBd_subset Δ hx)) + obtain ⟨E, hE, -, hYE⟩ := GM11.theorem_7_5_proof hS hYc hYn hu finite_empty (disjoint_empty _) + fun F hFY hF => by + rw [sdiff_empty] + have hF_disj : Disjoint F H.U := + disjoint_left.mpr fun x hxF hxU => disjoint_left.mp hY_disj_Δ (hFY hxF) (hU_sub hxU) + have hF_norm : H.IsNormal F := fun x ⟨hxF, hxU⟩ => (disjoint_left.mp hF_disj hxF hxU).elim + have hF_V : F ∩ H.V = ∅ := eq_empty_iff_forall_notMem.mpr fun x ⟨hxF, hxV⟩ => + disjoint_left.mp hF_disj hxF (H.V_subset_U hxV) + have hcard : (F ∩ H.V).ncard < θ := by + rw [hF_V, Set.ncard_empty] + exact hθ + exact hrep.2 F hF hF_norm hcard + obtain ⟨D, ⟨hDE, hD, hb, -⟩, -⟩ := disc_oArc E (discBd Δ') hE (hbY.trans hYE) hO + obtain rfl : D = Δ' := eq_of_discBd_eq (IsClosedSurface.isSurface hS) hns hD hΔ' hb + have huE : E = univ := by + refine eq_univ_of_forall fun x => ?_ + by_cases hx : x ∈ interior D + · exact hDE (interior_subset hx) + · exact hYE hx + have hfr := IsClosedDisc.frontier_eq_discBd hS hE + rw [huE, frontier_univ] at hfr + have hO' := IsClosedDisc.isOArc_discBd hE + rw [huE, ← hfr] at hO' + exact (infinite_of_isOArc hO').nonempty.ne_empty rfl + +/-- When `SubData H.toGraph G₀ P` holds, `E(H.toGraph) \ {e ∈ H.E | e ⊆ Δ}` is nonempty for every +closed disc `Δ ⊆ S` with `subBd Δ ∩ H.U ⊆ H.V` on a non-spherical surface `S` where `H` is +`θ`-representative (`1 ≤ θ`). -/ +theorem compl_disc_edges_nonempty [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) {H : Drawing S} {G₀ : Graph S (Set S)} + {P : Set S → Graph S (Set S)} (hsd : SubData H.toGraph G₀ P) {θ : ℕ} + (hθ : 1 ≤ θ) (hrep : H.IsRepresentative θ) {Δ : Set S} (hΔ : IsClosedDisc Δ) : + (E(H.toGraph) \ {e ∈ H.E | e ⊆ Δ}).Nonempty := by + by_contra hemp + rw [not_nonempty_iff_eq_empty] at hemp + have hE_sub : ∀ e ∈ H.E, e ⊆ Δ := by + intro e he + by_contra hnot + have : e ∈ E(H.toGraph) \ {e ∈ H.E | e ⊆ Δ} := ⟨he, fun h => hnot h.2⟩ + rw [hemp] at this + exact this + have hV_sub : H.V ⊆ Δ := by + intro v hv + obtain ⟨g, hgE, hig⟩ := SubDataSepGeneral.exists_inc_of_mem_V hsd hv + exact hΔ.isClosed.closure_subset_iff.mpr (hE_sub g hgE) (mem_closure_of_inc hig) + have hU_sub : H.U ⊆ Δ := by + intro x hxU + by_cases hxV : x ∈ H.V + · exact hV_sub hxV + · obtain ⟨e, heE, hxe⟩ := H.exists_edge_of_mem hxU hxV + exact hE_sub e heE hxe + exact not_U_subset_closedDisc_of_representative hS hns hθ hrep hΔ hU_sub + +/-- **Lemma 1a (`H.IsTwoCell`):** If `H` is a drawing of representativity `≥ 1` on a connected +closed non-spherical surface `S` whose graph is a subdivision of a simple 3-connected graph, then +`H.IsTwoCell`. -/ +theorem isTwoCell_of_subdivision_and_representative [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) {H : Drawing S} + (hsub : IsSubdivisionOfSimpleThreeConnected H.toGraph) + {θ : ℕ} (hθ : 1 ≤ θ) (hrep : H.IsRepresentative θ) : + H.IsTwoCell := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨G₀, P, hsd⟩ := exists_subData hsub + have hU_ne : H.U.Nonempty := by + have h4 := hsd.simple.2.1 + have hV₀_ne : V(G₀).Nonempty := by + by_contra hemp + rw [not_nonempty_iff_eq_empty] at hemp + rw [hemp, Set.ncard_empty] at h4 + omega + obtain ⟨v₀, hv₀⟩ := hV₀_ne + exact ⟨v₀, H.V_subset_U (hsd.sub hv₀)⟩ + refine ⟨inferInstance, fun r hr => ?_⟩ + have h_od := open_disc S r hS ‹ConnectedSpace S› + ⟨region_nonempty hr, region_isPreconnected hr⟩ (region_isOpen hr) + (fun F hFr hF => by + have hFU_emp : F ∩ H.U = ∅ := + eq_empty_iff_forall_notMem.mpr fun x ⟨hxF, hxU⟩ => region_subset hr (hFr hxF) hxU + have hF_norm : H.IsNormal F := by + change F ∩ H.U ⊆ H.V + rw [hFU_emp] + exact empty_subset _ + have hFV_emp : F ∩ H.V = ∅ := + eq_empty_of_subset (inter_subset_inter_right F H.V_subset_U) hFU_emp + have hcard : (F ∩ H.V).ncard < θ := by + rw [hFV_emp, Set.ncard_empty] + exact hθ + have hnull := hrep.2 F hF hF_norm hcard + have hbdS : Disjoint F (bd S) := disjoint_left.mpr fun x _ hx => hx (hS.2.2 x) + obtain ⟨Δ, -, hΔ, hbΔ⟩ := + (epstein S univ F (IsClosedSurface.isSurface hS) inferInstance hF + (subset_univ F) hbdS).1 hnull + have hsbΔ : subBd Δ = F := (IsClosedDisc.subBd_eq_discBd hS hΔ).trans hbΔ + let A_E : Set (Set S) := {e ∈ H.E | e ⊆ Δ} + have hAE_emp : A_E = ∅ := by + by_contra hAE_ne + rw [← Ne, ← nonempty_iff_ne_empty] at hAE_ne + have hcompl_ne := compl_disc_edges_nonempty hS hns hsd hθ hrep hΔ + have hbd_sub : bdry H.toGraph A_E ⊆ F ∩ H.V := by + rintro z ⟨⟨e₁, ⟨he₁E, he₁Δ⟩, hie₁⟩, e₂, ⟨he₂E, he₂_not⟩, hie₂⟩ + have hzV : z ∈ H.V := hie₁.vertex_mem + have hzΔ : z ∈ Δ := hΔ.isClosed.closure_subset_iff.mpr he₁Δ (mem_closure_of_inc hie₁) + have hzF : z ∈ F := by + by_contra hz_not_F + have hOpen : IsOpen (Δ \ F) := + hsbΔ ▸ (IsClosedDisc.isOpenDisc_diff_subBd hS hΔ).1.1 + obtain ⟨y, hy_open, hye₂⟩ := + mem_closure_iff.mp (mem_closure_of_inc hie₂) (Δ \ F) hOpen ⟨hzΔ, hz_not_F⟩ + have he₂Δ : e₂ ⊆ Δ := + edge_subset_of_inter_nonempty hΔ.isClosed (hsbΔ ▸ hF_norm) he₂E ⟨y, hye₂, hy_open.1⟩ + exact he₂_not ⟨he₂E, he₂Δ⟩ + exact ⟨hzF, hzV⟩ + rw [hFV_emp, subset_empty_iff] at hbd_sub + have hbd_card : (bdry H.toGraph A_E).ncard ≤ 2 := by + rw [hbd_sub, Set.ncard_empty] + omega + have hAE_sub : A_E ⊆ E(H.toGraph) := fun _ he => he.1 + obtain ⟨_, x, y, _, _, _, hbd_eq, _, _, _⟩ := + SubDataSepGeneral.sep_general hsd hAE_sub hbd_card hAE_ne hcompl_ne + rw [hbd_sub] at hbd_eq + exact (Set.insert_nonempty x {y}).ne_empty hbd_eq.symm + have hΔ_disj : Disjoint Δ H.U := by + refine disjoint_left.mpr fun z hzΔ hzU => ?_ + by_cases hzF : z ∈ F + · exact (eq_empty_iff_forall_notMem.mp hFU_emp z) ⟨hzF, hzU⟩ + · by_cases hzV : z ∈ H.V + · have hz_verts := + mem_verts_inter_of_mem_diff_bd hS hsd hΔ hsbΔ hF_norm hzV ⟨hzΔ, hzF⟩ + change z ∈ verts H.toGraph A_E at hz_verts + rw [hAE_emp] at hz_verts + rcases hz_verts with ⟨_, hg, _⟩ + exact hg + · obtain ⟨g, hgE, hzg⟩ := H.exists_edge_of_mem hzU hzV + have hgΔ : g ⊆ Δ := + edge_subset_of_inter_nonempty hΔ.isClosed (hsbΔ ▸ hF_norm) hgE ⟨z, hzg, hzΔ⟩ + have hg_AE : g ∈ A_E := ⟨hgE, hgΔ⟩ + rw [hAE_emp] at hg_AE + exact hg_AE + obtain ⟨φ⟩ := hF + have hpF : (φ 1).1 ∈ F := (φ 1).2 + have hpΔ : (φ 1).1 ∈ Δ := Surface.discBd_subset Δ (hbΔ.symm ▸ hpF) + have hΔr : Δ ⊆ r := + subset_region hr hΔ.isPathConnected.isConnected.isPreconnected hΔ_disj hpΔ (hFr hpF) + exact ⟨Δ, hΔr, hΔ, hbΔ⟩) + rcases h_od with ⟨_, hr_univ⟩ | hr_disc + · exfalso + obtain ⟨x, hx⟩ := hU_ne + exact region_subset hr (hr_univ ▸ mem_univ x) hx + · exact hr_disc + +/-- **Lemma 2 (`IsRespectfulDrawingTangle` and `HasTangleMetric`):** From `H.IsTwoCell` and +`H.IsRepresentative θ` (`1 ≤ θ`) on a connected closed non-spherical surface `S`, constructs the +respectful tangle `T` of order `θ` and its metric `d`. -/ +theorem exists_respectful_tangle_and_metric [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) {H : Drawing S} {θ : ℕ} + (hθ : 1 ≤ θ) (h2cell : H.IsTwoCell) (hrep : H.IsRepresentative θ) : + ∃ (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ), + IsRespectfulDrawingTangle H θ T ∧ HasTangleMetric H θ T d := by + obtain ⟨T, ⟨hT_tangle, hT_resp⟩, _⟩ := + GM11.theorem_4_1_proof (Γ := PaintingOrDrawing.drawing H) hS hns hθ h2cell hrep + have hT : IsRespectfulDrawingTangle H θ T := ⟨h2cell, hT_tangle, hT_resp⟩ + obtain ⟨d, hd⟩ := GM12.exists_metric_of_respectful_drawing_tangle hS hT + exact ⟨T, d, hT, hd⟩ + +/-- **Lemma 1b (`IsRigid H`):** If `H` is a drawing on a connected closed non-spherical surface `S` +whose graph is a subdivision of a simple 3-connected graph and `H` has a respectful tangle `T` of +order `θ ≥ 4` and is `θ`-representative, then `IsRigid H`. -/ +theorem isRigid_of_subdivision_and_respectful_tangle [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) {H : Drawing S} + (hsub : IsSubdivisionOfSimpleThreeConnected H.toGraph) + {θ : ℕ} (hθ : 4 ≤ θ) (hrep : H.IsRepresentative θ) + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsRespectfulDrawingTangle H θ T) : + IsRigid H := by + obtain ⟨G₀, P, hsd⟩ := exists_subData hsub + intro F hF_oarc hF_norm hF_card + have hcard_lt : (F ∩ H.V).ncard < θ := by omega + obtain ⟨Δ, hΔ, hsbΔ, hmem_in⟩ := hT.2.2.2 F hF_oarc hF_norm hcard_lt + refine ⟨Δ, ⟨hΔ, hsbΔ, ?_⟩⟩ + let A_E : Set (Set S) := {e ∈ H.E | e ⊆ Δ} + have hA_E_sub : A_E ⊆ E(H.toGraph) := fun _ he => he.1 + have hinter_E : (H.interSet Δ).E = A_E := by + change (H.span _ _).E = _ + rw [H.span_E] + ext e + simp only [A_E, mem_inter_iff, mem_ofPred_eq] + tauto + obtain ⟨hinter_V, _⟩ := interSet_V_and_U hΔ.isClosed (hsbΔ ▸ hF_norm) + by_cases hAE_ne : A_E.Nonempty + · right + have hcompl_ne : (E(H.toGraph) \ A_E).Nonempty := + compl_disc_edges_nonempty hS hns hsd (by omega) hrep hΔ + have hbd_AE_sub : bdry H.toGraph A_E ⊆ F ∩ H.V := by + rintro z ⟨⟨e₁, ⟨he₁E, he₁Δ⟩, hie₁⟩, e₂, ⟨he₂E, he₂_not⟩, hie₂⟩ + have hzV : z ∈ H.V := hie₁.vertex_mem + have hzΔ : z ∈ Δ := hΔ.isClosed.closure_subset_iff.mpr he₁Δ (mem_closure_of_inc hie₁) + have hzF : z ∈ F := by + by_contra hz_not_F + have hOpen : IsOpen (Δ \ F) := + hsbΔ ▸ (IsClosedDisc.isOpenDisc_diff_subBd hS hΔ).1.1 + obtain ⟨y, hy_open, hye₂⟩ := + mem_closure_iff.mp (mem_closure_of_inc hie₂) (Δ \ F) hOpen ⟨hzΔ, hz_not_F⟩ + have he₂Δ : e₂ ⊆ Δ := + edge_subset_of_inter_nonempty hΔ.isClosed (hsbΔ ▸ hF_norm) he₂E ⟨y, hye₂, hy_open.1⟩ + exact he₂_not ⟨he₂E, he₂Δ⟩ + exact ⟨hzF, hzV⟩ + have hbd_AE_card : (bdry H.toGraph A_E).ncard ≤ 2 := + (Set.ncard_le_ncard hbd_AE_sub (H.finite_V.subset inter_subset_right)).trans hF_card + obtain ⟨_, x, y, Q, _, hxy, hbd_eq, _, hQ_path, hcases⟩ := + SubDataSepGeneral.sep_general hsd hA_E_sub hbd_AE_card hAE_ne hcompl_ne + have hFV_eq : F ∩ H.V = {x, y} := by + have hsub_xy : ({x, y} : Set S) ⊆ F ∩ H.V := hbd_eq ▸ hbd_AE_sub + exact (Set.eq_of_subset_of_ncard_le hsub_xy + (by rw [Set.ncard_pair hxy]; exact hF_card) + (H.finite_V.subset inter_subset_right)).symm + rcases hcases with ⟨hAE_eq, hAV_eq⟩ | ⟨hcompl_eq, _⟩ + · refine ⟨x, y, hxy, hFV_eq, ?_⟩ + obtain ⟨hle_Q, W_Q, hs_Q, hV_Q, hE_Q⟩ := hQ_path + have hP_V : (H.interSet Δ).V = V(Q) := by + rw [hinter_V, ← hAV_eq] + ext z + constructor + · rintro ⟨hzV, hzΔ⟩ + by_cases hzF : z ∈ F + · have hz_xy : z ∈ bdry H.toGraph A_E := by + rw [hbd_eq, ← hFV_eq] + exact ⟨hzF, hzV⟩ + exact hz_xy.1 + · exact mem_verts_inter_of_mem_diff_bd hS hsd hΔ hsbΔ hF_norm hzV ⟨hzΔ, hzF⟩ + · rintro ⟨g, ⟨hgE, hgΔ⟩, hig⟩ + exact ⟨hig.vertex_mem, hΔ.isClosed.closure_subset_iff.mpr hgΔ (mem_closure_of_inc hig)⟩ + have hP_E : (H.interSet Δ).E = E(Q) := hinter_E.trans hAE_eq + have hP_sub : (H.interSet Δ).IsSubdrawing H := H.span_isSubdrawing _ _ + obtain ⟨W_P, hsupp_P, hedges_P⟩ := W_Q.exists_transfer (G' := (H.interSet Δ).toGraph) + (fun _ _ _ _ hlk => (hP_sub.isLink_iff (hP_E.symm ▸ hlk.edge_mem)).mpr (hlk.mono hle_Q)) + (fun z hz => by + change z ∈ (H.interSet Δ).V + rw [hP_V, hV_Q] + exact hz) + have hs_P : W_P.IsSimple := by + change W_P.support.Nodup + rw [hsupp_P] + exact hs_Q + exact ⟨W_P, hs_P, by rw [hP_V, hV_Q, hsupp_P], by rw [hP_E, hE_Q, hedges_P]⟩ + · exfalso + have hfrΔ : frontier Δ = F := by rw [← subBd_eq_frontier, hsbΔ] + have hsep₁ : H.toHypergraph.IsSeparation + ((PaintingOrDrawing.drawing H).inter Δ) + ((PaintingOrDrawing.drawing H).interOutside Δ) := + GM11.isSeparation_inter (Γ := PaintingOrDrawing.drawing H) hΔ.isClosed + (by rw [hfrΔ]; exact hF_norm) + have hsep₂ : H.toHypergraph.IsSeparation + ((PaintingOrDrawing.drawing H).interOutside Δ) + ((PaintingOrDrawing.drawing H).inter Δ) := + hsep₁.symm + have hinter_sub : + ((PaintingOrDrawing.drawing H).interOutside Δ ∩ + (PaintingOrDrawing.drawing H).inter Δ).vertexSet ⊆ F ∩ H.V := by + intro z ⟨hz_out, hz_in⟩ + rw [← hfrΔ] + exact GM11.inter_outside_subset (Γ := PaintingOrDrawing.drawing H) ⟨hz_in, hz_out⟩ + have hord₂_le : separationOrder + ((PaintingOrDrawing.drawing H).interOutside Δ) + ((PaintingOrDrawing.drawing H).inter Δ) ≤ 2 := + (Set.ncard_le_ncard hinter_sub (H.finite_V.subset inter_subset_right)).trans hF_card + have hE₂_sub : ((PaintingOrDrawing.drawing H).interOutside Δ).edgeSet ⊆ E(Q) := by + rw [← hcompl_eq] + rintro g ⟨hgE, hg_out⟩ + refine ⟨hgE, fun ⟨_, hgΔ⟩ => ?_⟩ + obtain ⟨z, hz⟩ := hgE.1 + have hzF : z ∈ F := by + rw [← hfrΔ, frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] + exact ⟨subset_closure (hgΔ hz), hg_out hz⟩ + exact (hgE.2.1 hz).2 (hF_norm ⟨hzF, (hgE.2.1 hz).1⟩) + have hbd_Q : bdry H.toGraph E(Q) ⊆ {x, y} := by + rw [← hcompl_eq, bdry_compl hA_E_sub, hbd_eq] + have hmem_out : + ((PaintingOrDrawing.drawing H).interOutside Δ, + (PaintingOrDrawing.drawing H).inter Δ) ∈ T := + path_sep_mem_tangle hT.2.1 hθ hQ_path hbd_Q hsep₂ (by omega) hE₂_sub + exact hT.2.1.axiom2 hmem_in hmem_out hmem_out + (by rw [GM10.union_assoc, GM10.union_self, hsep₁.union_eq]) + · left + rw [not_nonempty_iff_eq_empty] at hAE_ne + rintro z ⟨hzΔ, hzU⟩ + by_contra hz_not_F + by_cases hzV : z ∈ H.V + · have hz_verts := + mem_verts_inter_of_mem_diff_bd hS hsd hΔ hsbΔ hF_norm hzV ⟨hzΔ, hz_not_F⟩ + change z ∈ verts H.toGraph A_E at hz_verts + rw [hAE_ne] at hz_verts + rcases hz_verts with ⟨_, hg, _⟩ + exact hg + · obtain ⟨g, hgE, hzg⟩ := H.exists_edge_of_mem hzU hzV + have hgΔ : g ⊆ Δ := + edge_subset_of_inter_nonempty hΔ.isClosed (hsbΔ ▸ hF_norm) hgE ⟨z, hzg, hzΔ⟩ + have hg_AE : g ∈ A_E := ⟨hgE, hgΔ⟩ + rw [hAE_ne] at hg_AE + exact hg_AE + +/-- Combined first part of the Section 10 translation: under the hypotheses of (1.1), `H` is 2-cell +and rigid and admits a respectful tangle `T` of order `209` with tangle metric `d`. -/ +theorem isRigid_and_isTwoCell_of_subdivision_and_representative + [ConnectedSpace S] (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + {α : Type u} {β : Type v} {G : Graph α β} {H : Drawing S} (η : SpanEmbedding H G) + (hH_subdiv : IsSubdivisionOfSimpleThreeConnected η.imageGraph) + (hrep : H.IsRepresentative 209) : + ∃ (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ), + H.IsTwoCell ∧ IsRigid H ∧ + IsRespectfulDrawingTangle H 209 T ∧ HasTangleMetric H 209 T d := by + have hsub_H : IsSubdivisionOfSimpleThreeConnected H.toGraph := + isSubdivision_toGraph_of_spanEmbedding η hH_subdiv + have h2cell : H.IsTwoCell := + isTwoCell_of_subdivision_and_representative hS hns hsub_H (by omega) hrep + obtain ⟨T, d, hT, hd⟩ := + exists_respectful_tangle_and_metric hS hns (by omega) h2cell hrep + have hrigid : IsRigid H := + isRigid_of_subdivision_and_respectful_tangle hS hns hsub_H (by omega) hrep hT + exact ⟨T, d, h2cell, hrigid, hT, hd⟩ + +end TanglePathSep + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section10Translation2.lean b/LeanPool/GraphMinor/GM14/Section10Translation2.lean new file mode 100644 index 0000000000..35a51ceac4 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section10Translation2.lean @@ -0,0 +1,347 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +import LeanPool.GraphMinor.GM14.PieceDrawing + +public import LeanPool.GraphMinor.GM14.Section10Translation1 +public import LeanPool.GraphMinor.GM14.Section7 +public import LeanPool.GraphMinor.GM14.SegregationDrawing +import LeanPool.GraphMinor.GM11.Section810 + +/-! +# Graph Minors XIV – Section 10 Translation (Part 2: Extending the Drawing from a 3-Segregation) + +This file proves the 3-segregation extension step of Section 10 of Graph Minors XIV (pages 49–50): +if `G` is a 4-connected graph, `H` is a rigid 2-cell drawing in a connected closed +non-spherical surface `S` with respectful tangle `T` of order `θ`, and `G` admits a `T`-local +3-segregation `S_seg` with an `H`-compatible arrangement `(α_disc, α_pt)` in `S`, then `G` has a +drawing `Γ_G : GraphDrawing G S` in `S` extending `H` (`H.IsSubdrawing Γ_G.drawing`). +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Metric Graph Hypergraph +open GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 +open GraphMinor.GM11 GraphMinor.GM14.Whitney + +universe u v w + +variable {α : Type u} {β : Type v} {S : Type w} [TopologicalSpace S] [T2Space S] + +/-! ## 1. Finite Graphs on at Most 3 Vertices Have a Boundary Drawing and Piece Drawing -/ + +omit [T2Space S] in +/-- In a cyclic permutation `Ω` of at most 3 elements, for any two distinct `u, w ∈ Ω.bar`, +one of the two intervals `Ω.interval u w` or `Ω.interval w u` is empty. -/ +theorem interval_eq_empty_or_swap_of_ncard_le_three (Ω : CyclicPerm α) + (hcard : Ω.bar.ncard ≤ 3) {u w : α} (hu : u ∈ Ω.bar) (hw : w ∈ Ω.bar) (huw : u ≠ w) : + Ω.interval u w = ∅ ∨ Ω.interval w u = ∅ := by + by_contra! h + obtain ⟨⟨x, hx⟩, ⟨y, hy⟩⟩ := h + have hxy : x ≠ y := fun h => Set.disjoint_left.mp (Ω.disjoint_interval_swap u w) hx (h ▸ hy) + have hxu : x ≠ u := fun h => Ω.not_mem_interval_left u w (h ▸ hx) + have hxw : x ≠ w := fun h => Ω.not_mem_interval_right u w (h ▸ hx) + have hyu : y ≠ u := fun h => Ω.not_mem_interval_right w u (h ▸ hy) + have hyw : y ≠ w := fun h => Ω.not_mem_interval_left w u (h ▸ hy) + have hsub : ({x, y, u, w} : Set α) ⊆ Ω.bar := by + rintro z (rfl | rfl | rfl | rfl) + · exact Ω.interval_subset_bar u w hx + · exact Ω.interval_subset_bar w u hy + · exact hu + · exact hw + have hc4 : ({x, y, u, w} : Set α).ncard = 4 := by + rw [Set.ncard_insert_of_notMem, Set.ncard_insert_of_notMem, Set.ncard_pair huw] + · simp [hyu, hyw] + · simp [hxy, hxu, hxw] + have hle := Set.ncard_le_ncard hsub Ω.finite_bar + omega + +omit [T2Space S] in +/-- Every finite graph `K` with a vertex and `V(K).ncard ≤ 3` has a rural drawing with all its +vertices on the boundary. -/ +theorem exists_boundaryRural_of_ncard_le_three {K : Graph α β} + (hV : V(K).Finite) (hE : E(K).Finite) (hc : V(K).ncard ≤ 3) (hne : V(K).Nonempty) : + ∃ L, BoundaryRural K L := by + let K₀ : Graph α β := K.restrict ∅ + have hVK₀ : V(K₀) = V(K) := vertexSet_restrict K ∅ + have hEK₀ : E(K₀) = ∅ := by simp [K₀, edgeSet_restrict] + have hc₀ : {C : Graph α β | IsGraphCircuit K₀ C}.ncard ≤ 1 := by + have hemp : {C : Graph α β | IsGraphCircuit K₀ C} = ∅ := by + refine eq_empty_of_forall_notMem fun C hC => ?_ + obtain ⟨hCK₀, u, W, _, hpos, _, _⟩ := hC + cases W with + | nil _ => simp [GraphWalk.length, GraphWalk.edges] at hpos + | cons hl _ => + have he : _ ∈ E(K₀) := hCK₀.edgeSet_mono hl.edge_mem + rw [hEK₀] at he + exact he + rw [hemp, Set.ncard_empty] + omega + obtain ⟨L, hL₀⟩ := exists_boundaryRural (hVK₀ ▸ hV) (hEK₀ ▸ finite_empty) hc₀ (hVK₀ ▸ hne) + suffices hstep : ∀ (n : ℕ) (F : Set β), F ⊆ E(K) → F.ncard = n → + BoundaryRural (K.restrict F) L by + have hK_eq : K.restrict E(K) = K := + le_antisymm restrict_le ⟨by simp, fun {_ _ _} hl => ⟨hl.edge_mem, hl⟩⟩ + exact ⟨L, hK_eq ▸ hstep E(K).ncard E(K) Subset.rfl rfl⟩ + intro n + induction n with + | zero => + intro F hF hn + have hF_fin : F.Finite := hE.subset hF + have hF_empty : F = ∅ := (Set.ncard_eq_zero hF_fin).mp hn + subst hF_empty + exact hL₀ + | succ n ih => + intro F hF hn + have hF_fin : F.Finite := hE.subset hF + obtain ⟨e, heF⟩ := (Set.ncard_pos hF_fin).mp (by omega) + let F' : Set β := F \ {e} + have hF'_sub : F' ⊆ E(K) := sdiff_subset.trans hF + have hF'_card : F'.ncard = n := by + change (F \ {e}).ncard = n + rw [Set.ncard_sdiff_singleton_of_mem heF, hn] + omega + have ih' := ih F' hF'_sub hF'_card + let K' : Graph α β := K.restrict F' + let K₁ : Graph α β := K.restrict F + have hle : K' ≤ K₁ := ⟨by simp [K', K₁], fun {_ _ _} hl => ⟨sdiff_subset hl.1, hl.2⟩⟩ + have hV_eq : V(K₁) = V(K') := by simp [K', K₁, vertexSet_restrict] + have hE_eq : E(K₁) = insert e E(K') := by + ext f + simp only [K', K₁, F', edgeSet_restrict, mem_inter_iff, mem_insert_iff, mem_sdiff, + mem_singleton_iff] + by_cases hfe : f = e + · subst hfe + exact ⟨fun _ => Or.inl rfl, fun _ => ⟨hF heF, heF⟩⟩ + · tauto + have he_not : e ∉ E(K') := by simp [K', F', edgeSet_restrict] + have hV₁_fin : V(K₁).Finite := by simpa [K₁, vertexSet_restrict] using hV + have hE₁_fin : E(K₁).Finite := hE.subset (by simp [K₁, edgeSet_restrict]) + obtain ⟨u, w, hlK⟩ := K.exists_isLink_of_mem_edgeSet (hF heF) + have hl₁ : K₁.IsLink e u w := ⟨heF, hlK⟩ + by_cases huw : u = w + · subst huw + exact ih'.add_loop hV₁_fin hE₁_fin hle hV_eq hE_eq he_not hl₁ + · obtain ⟨hLV, hnd, hne', _⟩ := id ih' + have hbar_eq : (CyclicPerm.ofNodupList L hnd hne').bar = V(K) := by + change {x | x ∈ L} = V(K) + rw [hLV] + exact vertexSet_restrict K F' + have hu_bar : u ∈ (CyclicPerm.ofNodupList L hnd hne').bar := hbar_eq.symm ▸ hlK.left_mem + have hw_bar : w ∈ (CyclicPerm.ofNodupList L hnd hne').bar := hbar_eq.symm ▸ hlK.right_mem + rcases interval_eq_empty_or_swap_of_ncard_le_three + (CyclicPerm.ofNodupList L hnd hne') (hbar_eq.symm ▸ hc) hu_bar hw_bar huw with hgap | hgap + · exact ih'.add_edge hV₁_fin hE₁_fin hle hV_eq hE_eq he_not hl₁ huw (fun _ _ => hgap) + · exact ih'.add_edge hV₁_fin hE₁_fin hle hV_eq hE_eq he_not hl₁.symm (Ne.symm huw) (fun _ _ + => hgap) + +omit [T2Space S] in +/-- Every finite graph `K` with `V(K).ncard ≤ 3` can be drawn in the plane inside a closed disc `Δ` +with all its vertices on `subBd Δ`. -/ +theorem exists_boundary_drawing_of_ncard_le_three {K : Graph α β} + (hV : V(K).Finite) (hE : E(K).Finite) (hc : V(K).ncard ≤ 3) : + ∃ (Γ : GraphDrawing K EuclideanPlane) (Δ : Set EuclideanPlane), IsClosedDisc Δ ∧ + Γ.drawing.U ⊆ Δ ∧ Γ.drawing.V ⊆ subBd Δ := by + by_cases hne : V(K).Nonempty + · obtain ⟨L, hL, hnd, hne', N, rfl, hΩ, -, Γ, Δ, Δ₀, hΔ, -, hU, hbd, -⟩ := + exists_boundaryRural_of_ncard_le_three hV hE hc hne + refine ⟨Γ, Δ, hΔ, fun x hx => (hU hx).1, ?_⟩ + intro x hx + let v := Γ.iso.vertexEquiv.symm ⟨x, hx⟩ + have hv : v.1 ∈ N.Ω.bar := by + rw [hΩ] + change v.1 ∈ {x | x ∈ L} + rw [hL] + exact v.2 + have hsub := (hbd v.1 v.2).mpr hv + apply hsub + refine ⟨v.2, ?_⟩ + simp [v] + · have hVe : V(K) = ∅ := not_nonempty_iff_eq_empty.mp hne + have hEe : E(K) = ∅ := by + refine eq_empty_of_forall_notMem fun f hf => ?_ + obtain ⟨x, y, hxy⟩ := K.exists_isLink_of_mem_edgeSet hf + exact hne ⟨x, hxy.left_mem⟩ + obtain ⟨Γ, hU, _⟩ := GraphDrawing.of_edgeless (S := EuclideanPlane) hV hEe + (ν := fun _ => 0) (by rw [hVe]; exact injOn_empty _) + refine ⟨Γ, ClosedUnitDisc, ⟨Homeomorph.refl ClosedUnitDisc⟩, ?_, ?_⟩ + · rw [hU, hVe] + simp + · have : Γ.drawing.V ⊆ Γ.drawing.U := Γ.drawing.V_subset_U + rw [hU, hVe, image_empty] at this + exact this.trans (empty_subset _) + +/-- A finite graph `K` with `V(K).ncard ≤ 3` can be drawn in a closed disc `D`, with a subset +`X ⊆ V(K)` of at most three vertices at given points of `discBd D` and nothing else on `discBd D`. +-/ +theorem exists_disc_drawing_of_ncard_le_three {K : Graph α β} + (hV : V(K).Finite) (hE : E(K).Finite) (hc : V(K).ncard ≤ 3) + {D : Set S} (hD : IsClosedDisc D) {X : Set α} + (hXK : X ⊆ V(K)) (hX : X.ncard ≤ 3) {g : α → S} (hg : InjOn g X) + (hgD : MapsTo g X (discBd D)) : + ∃ Γ : GraphDrawing K S, Γ.drawing.U ⊆ D ∧ Γ.drawing.U ∩ discBd D = g '' X ∧ + ∀ v : V(K), v.1 ∈ X → (Γ.iso.vertexEquiv v).1 = g v.1 := by + classical + obtain ⟨Y, Δ, hΔ, hYU, hYV⟩ := exists_boundary_drawing_of_ncard_le_three hV hE hc + exact place_boundary_drawing hV Y hΔ hYU hYV hD hXK hX hg hgD + +/-- Suppose `H₁` is drawn in the closed disc `D`, is a subgraph `η(H₁)` of `K`, is rigid in `D`, +and `V(K).ncard ≤ 3`. Then `K` has a drawing in `D` extending `H₁`, with the vertices of `X` at +given points of `subBd D` and nothing else on `subBd D`. -/ +theorem exists_piece_drawing_of_ncard_le_three {H₁ : Drawing S} {K : Graph α β} + (η : SpanEmbedding H₁ K) (hV : V(K).Finite) (hE : E(K).Finite) (hc : V(K).ncard ≤ 3) + {D : Set S} (hD : IsClosedDisc D) (hbdD : subBd D = discBd D) + (hH₁D : H₁.U ⊆ D) (hH₁bd : H₁.U ∩ subBd D ⊆ H₁.V) + {X : Set α} (hXK : X ⊆ V(K)) (hX : X.ncard ≤ 3) {g : α → S} (hg : InjOn g X) + (hgD : MapsTo g X (subBd D)) (hXH : ∀ v ∈ H₁.V, v ∈ subBd D ↔ η.vMap v ∈ X) + (hgH : ∀ v ∈ H₁.V, η.vMap v ∈ X → g (η.vMap v) = v) + (hrigid : ∀ F : Set S, F ⊆ D → IsOArc F → F ∩ H₁.U ⊆ H₁.V → + (F ∩ H₁.V).ncard ≤ 2 → ∃ Δ' : Set S, Δ' ⊆ D ∧ IsDial H₁ F Δ') : + ∃ Γ : GraphDrawing K S, Γ.drawing.U ⊆ D ∧ Γ.drawing.U ∩ subBd D = g '' X ∧ + (∀ v : V(K), v.1 ∈ X → (Γ.iso.vertexEquiv v).1 = g v.1) ∧ + (∀ v ∈ H₁.V, graphDrawingVertexSet Γ (η.vMap v) = {v}) ∧ + ∀ e ∈ H₁.E, graphDrawingEdgeSet Γ (η.eMap e) = e := by + obtain ⟨Y, hYU, hYbd, hYg⟩ := exists_disc_drawing_of_ncard_le_three hV hE hc hD hXK hX hg + (by rw [← hbdD]; exact hgD) + rw [← hbdD] at hYbd + exact extend_piece_drawing η hD hbdD hH₁D hH₁bd hXK hgD hXH hgH hrigid Y hYU hYbd hYg + +/-- If `H` is rigid on a connected closed non-spherical surface `S` and `d ⊆ S` is a closed disc +with `subBd d ∩ H.U ⊆ H.V`, then `H.interSet d` is rigid inside `d`. -/ +theorem isRigidIn_interSet_of_isRigid [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) {H : Drawing S} (hrig : IsRigid H) + {d : Set S} (hd : IsClosedDisc d) (hbd : subBd d ∩ H.U ⊆ H.V) : + ∀ F : Set S, F ⊆ d → IsOArc F → F ∩ (H.interSet d).U ⊆ (H.interSet d).V → + (F ∩ (H.interSet d).V).ncard ≤ 2 → ∃ Δ' : Set S, Δ' ⊆ d ∧ IsDial (H.interSet d) F Δ' := by + have hcl : IsClosed d := hd.isClosed + obtain ⟨hV, hU⟩ := interSet_V_and_U hcl hbd + intro F hFd hF hFn hFc + have hFV : F ∩ (H.interSet d).V = F ∩ H.V := by + rw [hV] + ext x + exact ⟨fun h => ⟨h.1, h.2.1⟩, fun h => ⟨h.1, h.2, hFd h.1⟩⟩ + have hFn' : F ∩ H.U ⊆ H.V := by + rintro x ⟨hx, hxU⟩ + have : x ∈ F ∩ (H.interSet d).U := ⟨hx, hU.superset ⟨hxU, hFd hx⟩⟩ + have := hFn this + rw [hV] at this + exact this.1 + obtain ⟨Δ, hΔd, hΔb, hor⟩ := hrig F hF hFn' (hFV ▸ hFc) + have hbdΔ : discBd Δ = F := (IsClosedDisc.subBd_eq_discBd hS hΔd).symm.trans hΔb + obtain ⟨D', ⟨hD'd, hD'disc, hbD', -⟩, -⟩ := disc_oArc d F hd hFd hF + have hD'_eq : D' = Δ := + eq_of_discBd_eq (IsClosedSurface.isSurface hS) hns hD'disc hΔd (hbD'.trans hbdΔ.symm) + have hsub : Δ ⊆ d := hD'_eq ▸ hD'd + refine ⟨Δ, hsub, hΔd, hΔb, ?_⟩ + rcases hor with h | ⟨u, v, huv, hcap, hp⟩ + · left + rw [hU] + exact fun x hx => h ⟨hx.1, hx.2.1⟩ + · right + refine ⟨u, v, huv, hFV.trans hcap, ?_⟩ + have heq : (H.interSet d).interSet Δ = H.interSet Δ := by + have hE₁ : ((H.interSet d).interSet Δ).E = (H.interSet Δ).E := by + rw [Whitney.interSet_E, Whitney.interSet_E, Whitney.interSet_E] + ext e + exact ⟨fun h => ⟨h.1.1, h.2⟩, fun h => ⟨⟨h.1, h.2.trans hsub⟩, h.2⟩⟩ + refine Drawing.ext_of_V_E ?_ hE₁ + ext x + rw [GM11.mem_interSet_V_iff hΔd.isClosed, GM11.mem_interSet_V_iff hΔd.isClosed, hV] + exact ⟨fun h => ⟨h.1.1, h.2⟩, fun h => ⟨⟨h.1, hsub h.2⟩, h.2⟩⟩ + rwa [heq] + +/-! ## 3. Extending the Drawing across a `T`-Local 3-Segregation -/ + +/-- **Lemma 3 (`exists_extending_drawing_of_threeSegregation`):** Under the hypotheses of (1.1), +if `G` is a 4-connected graph, `H` is rigid with a respectful tangle `T` of order `θ`, and +`S_seg` is a `T`-local 3-segregation of `G` with an `H`-compatible arrangement `(α_disc, α_pt)` in +`S`, then `G` has a drawing `Γ_G : GraphDrawing G S` in `S` such that `H.IsSubdrawing Γ_G.drawing`. +-/ +theorem exists_extending_drawing_of_threeSegregation [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + (hG_4conn : 5 ≤ V(G).ncard ∧ + ∀ A B : Graph α β, IsGraphSeparation G A B → (V(A) ∩ V(B)).ncard < 4 → + V(A) = V(G) ∨ V(B) = V(G)) + (hrig : IsRigid H) {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsRespectfulDrawingTangle H θ T) + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + (hseg : IsThreeSegregation G S_seg) + (hloc : IsTangleLocal G H η T S_seg) + (harr : IsSurfaceArrangement S_seg α_disc α_pt) + (hcompat : IsCompatibleWith G H η S_seg α_disc α_pt) : + ∃ Γ_G : GraphDrawing G S, H.IsSubdrawing Γ_G.drawing := by + obtain ⟨hs, h3⟩ := id hseg + have hmember : ∀ S₀ ∈ S_seg, + ∃ Γ : GraphDrawing S₀.G S, Γ.drawing.U ⊆ α_disc S₀ ∧ + Γ.drawing.U ∩ subBd (α_disc S₀) = α_pt '' S₀.Ω.bar ∧ + (∀ v : V(S₀.G), v.1 ∈ S₀.Ω.bar → (Γ.iso.vertexEquiv v).1 = α_pt v.1) ∧ + (∀ v ∈ H.V, v ∈ α_disc S₀ → graphDrawingVertexSet Γ (η.vMap v) = {v}) ∧ + ∀ e ∈ H.E, e ⊆ α_disc S₀ → graphDrawingEdgeSet Γ (η.eMap e) = e := by + intro S₀ hS₀ + have hle₀ : S₀.G ≤ G := hs.le S₀ hS₀ + obtain ⟨B, hsepB, hV_inter, _, _⟩ := exists_separation_of_segregation hs hS₀ + have hcard_lt : (V(S₀.G) ∩ V(B)).ncard < 4 := by + rw [hV_inter] + exact Nat.lt_succ_of_le (h3 S₀ hS₀) + have hVB_eq : V(B) = V(G) := by + rcases hG_4conn.2 S₀.G B hsepB hcard_lt with hVS₀ | hVB + · exfalso + obtain ⟨A_H, B_H, _, hAV, _, _, _, _, hmemT⟩ := + exists_tangle_separation_of_threeSegregation hseg hloc hS₀ + have hAV_eq : A_H.vertexSet = H.V := by + rw [hAV] + ext v + simp only [mem_ofPred_eq, and_iff_left_iff_imp] + intro hv + rw [hVS₀] + exact η.imageGraph_le.vertexSet_mono (η.bijOn_v.mapsTo hv) + exact hT.2.1.axiom3 hmemT hAV_eq + · exact hVB + have hVS₀_eq : V(S₀.G) = S₀.Ω.bar := by + rw [← hV_inter, hVB_eq, eq_comm, inter_eq_left] + exact hle₀.vertexSet_mono + have hVS₀_card : V(S₀.G).ncard ≤ 3 := hVS₀_eq ▸ h3 S₀ hS₀ + obtain ⟨hd, hbarpt⟩ := harr.isClosedDisc S₀ hS₀ + have hbdd : subBd (α_disc S₀) = discBd (α_disc S₀) := IsClosedDisc.subBd_eq_discBd hS hd + obtain ⟨η₁, _, hv, he, hbd, hIV, hU, hn, hXH⟩ := + exists_compatible_pieceEmbedding hS₀ hle₀ hd.isClosed hcompat + have hrig₁ := isRigidIn_interSet_of_isRigid hS hns hrig hd hbd + obtain ⟨Γ, h₁, h₂, h₃', h₄, h₅⟩ := exists_piece_drawing_of_ncard_le_three η₁ + S₀.finite_V S₀.finite_E hVS₀_card hd hbdd hU hn + S₀.bar_subset (h3 S₀ hS₀) + (harr.injOn_pts.mono fun x hx => mem_iUnion₂.mpr ⟨S₀, hS₀, hx⟩) hbarpt hXH + (fun v hv' h => by + rw [hIV] at hv' + rw [hv] at h ⊢ + exact hcompat.pt_eq v hv'.1 (mem_iUnion₂.mpr ⟨S₀, hS₀, h⟩)) + hrig₁ + refine ⟨Γ, h₁, h₂, h₃', fun v hv' hvd => ?_, fun e he' hed => ?_⟩ + · have := h₄ v (by rw [hIV]; exact ⟨hv', hvd⟩) + rwa [hv] at this + · have := h₅ e (by rw [Whitney.interSet_E]; exact ⟨he', hed⟩) + rwa [he] at this + choose Γs h₁ h₂ h₃ h₄ h₅ using hmember + obtain ⟨Γ, ν, _, hv, _, hηv, hηe, _⟩ := + exists_drawing_of_compatible_members hs harr hcompat Γs h₁ h₂ h₃ h₄ h₅ + refine ⟨Γ, ⟨?_, ?_⟩⟩ + · intro v hv' + have hvG : η.vMap v ∈ V(G) := η.imageGraph_le.vertexSet_mono (η.bijOn_v.mapsTo hv') + have heq := (hv ⟨η.vMap v, hvG⟩).trans (hηv v hv') + exact heq ▸ (Γ.iso.vertexEquiv ⟨η.vMap v, hvG⟩).2 + · intro e he' + have heG : η.eMap e ∈ E(G) := η.imageGraph_le.edgeSet_mono (η.bijOn_e.mapsTo he') + have heq := (graphDrawingEdgeSet_eq Γ heG).symm.trans (hηe e he') + exact heq ▸ (Γ.iso.edgeEquiv ⟨η.eMap e, heG⟩).2 + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section10Translation3.lean b/LeanPool/GraphMinor/GM14/Section10Translation3.lean new file mode 100644 index 0000000000..93a4cb158d --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section10Translation3.lean @@ -0,0 +1,459 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section10Translation2 +public import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.GM12.Section2 +import LeanPool.GraphMinor.GM12.Section1 +import LeanPool.GraphMinor.GM11.Section64 +import LeanPool.GraphMinor.GM11.Section91 +import LeanPool.GraphMinor.Surface.ArcTools + +/-! +# Graph Minors XIV – Section 10 Translation (Part 3: Tangle Metric vs. Curve Distance Bounds) + +This file proves the two curve-enclosure translation lemmas for Graph Minors XIV (1.1): +1. **Lemma 4 (`not_exists_curve_of_dist_gt_three`):** If `d {u} {v} > 3` for `u, v ∈ V(H)`, then + there is no `H`-normal `O`-arc `φ : C(Circle, S)` meeting `H.U` at most 3 times with + `u, v ∈ curveIns φ`. +2. **Lemma 5a (`exists_curve_le_39_of_mem_lambdaZone`):** If `Λ₀` is a `39`-zone around `z ∈ H.A` + in `H` with `subBd Λ₀ = C.U` for a circuit `C` of `H`, then there exists `x ∈ Λ₀` such that for + every `y ∈ Λ₀`, there is a closed curve `φ : C(Circle, S)` meeting `H.U` at most 39 times with + `x ∈ curveIns φ` and `y ∈ curveIns φ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Metric unitInterval Graph Hypergraph +open GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 +open GraphMinor.GM11 GraphMinor.GM12 GraphMinor.GM14.Whitney + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-! ## 1. Monotonicity of `curveIns` and Inclusion of `insWalk` in `curveIns` -/ + +omit [T2Space S] in +/-- If `range φ ⊆ range ψ`, then `curveIns φ ⊆ curveIns ψ`. -/ +theorem curveIns_mono {φ ψ : C(Circle, S)} (hsub : range φ ⊆ range ψ) : + curveIns φ ⊆ curveIns ψ := by + rintro x (hx | hx) + · exact Or.inl (hsub hx) + · obtain ⟨Δ, ⟨hΔ, hbd⟩, hxΔ⟩ := mem_iUnion₂.mp hx + exact Or.inr (mem_iUnion₂.mpr ⟨Δ, ⟨hΔ, hbd.trans hsub⟩, hxΔ⟩) + +omit [T2Space S] in +/-- If `range φ = range ψ`, then `curveIns φ = curveIns ψ`. -/ +theorem curveIns_eq_of_range_eq {φ ψ : C(Circle, S)} (heq : range φ = range ψ) : + curveIns φ = curveIns ψ := + Subset.antisymm (curveIns_mono heq.subset) (curveIns_mono heq.superset) + +/-- For a closed walk `W` of length `< 2 * θ` in a radial drawing `K` with derived slope `ins`, +any curve `φ : C(Circle, S)` with `range φ = (walkDrawing K W).U` satisfies +`insWalk ins K W ⊆ curveIns φ`. -/ +theorem insWalk_subset_curveIns {H K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + (hslope : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + {u : S} {W : GraphWalk K.toGraph u u} (hW_lt : W.length < 2 * θ) + {φ : C(Circle, S)} (hran : range φ = (walkDrawing K W).U) : + insWalk ins K W ⊆ curveIns φ := by + classical + have hLs : (walkDrawing K W).IsSubdrawing K := walkDrawing_isSubdrawing K W + rintro x (hxU | hxC) + · exact Or.inl (hran.symm ▸ hxU) + · obtain ⟨C, ⟨hC, hCs⟩, hx_ins⟩ := mem_iUnion₂.mp hxC + have hlen : C.length < 2 * θ := by + refine lt_of_le_of_lt ?_ hW_lt + have hsub : C.E ⊆ {e | e ∈ W.edges} := by + have := hCs.2 + rwa [walkDrawing_E] at this + calc C.E.ncard ≤ ({e | e ∈ W.edges} : Set (Set S)).ncard := + Set.ncard_le_ncard hsub (List.finite_toSet _) + _ ≤ W.edges.length := by + rw [show ({e | e ∈ W.edges} : Set (Set S)) = ↑W.edges.toFinset by ext; simp, + Set.ncard_coe_finset] + exact List.toFinset_card_le _ + _ = W.length := rfl + obtain ⟨hdisc, hbd, -⟩ := hslope C hC (hCs.trans hLs) hlen + refine Or.inr (mem_iUnion₂.mpr ⟨ins C, ⟨hdisc, ?_⟩, hx_ins⟩) + rw [hbd, hran] + exact hCs.U_subset + +/-! ## 2. Lemma 4: `d {u} {v} > 3` Precludes a 3-Hit Normal `O`-Arc Enclosing `u` and `v` -/ + +/-- **Lemma 4 (`not_exists_curve_of_dist_gt_three`):** Let `H` be a drawing in a connected closed +non-spherical surface `S` with a respectful tangle `T` of order `θ ≥ 4` and metric `d`. If +`u, v ∈ H.V` satisfy `¬ d {u} {v} ≤ 3`, then there is no `φ : C(Circle, S)` such that `range φ` is +an `H`-normal `O`-arc with `(range φ ∩ H.U).ncard ≤ 3`, `u ∈ curveIns φ`, and `v ∈ curveIns φ`. -/ +theorem not_exists_curve_of_dist_gt_three [ConnectedSpace S] + (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hθ : 4 ≤ θ) (hd : HasTangleMetric H θ T d) + {u v : S} (hu : u ∈ H.V) (hv : v ∈ H.V) (hdist : ¬ d {u} {v} ≤ 3) : + ¬ ∃ φ : C(Circle, S), + IsOArc (range φ) ∧ H.IsNormal (range φ) ∧ + (range φ ∩ H.U).ncard ≤ 3 ∧ u ∈ curveIns φ ∧ v ∈ curveIns φ := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + rintro ⟨φ, hO, hnorm, hcard, hu_ins, hv_ins⟩ + obtain ⟨hResp, K, ins, hrad, hslope, hd_eq⟩ := id hd + have hVU_eq : range φ ∩ H.V = range φ ∩ H.U := + Subset.antisymm (inter_subset_inter_right _ H.V_subset_U) (fun x hx => ⟨hx.1, hnorm hx⟩) + have hcard_V : (range φ ∩ H.V).ncard ≤ 3 := hVU_eq.symm ▸ hcard + obtain ⟨ψ, hranψ, hnormψ, hlenψ⟩ := GM12.exists_closedCurve_of_isOArc hO hnorm + have hlenψ_le : GM12.curveLength H ψ ≤ 3 := hlenψ ▸ hcard_V + have hlenψ_lt : GM12.curveLength H ψ < θ := by omega + have h21_app := GM12.theorem_2_1_statement S hS H K θ T ins hrad hResp.2.1.one_le + hResp.2.1 hResp.2.2 hslope ψ hnormψ hlenψ_lt + obtain ⟨⟨w₀, W, htr⟩, h21_prop⟩ := h21_app + obtain ⟨hW_lt, h21_disc⟩ := h21_prop w₀ W htr + have hW_len : W.length = 2 * GM12.curveLength H ψ := by + rcases htr.2 with ⟨h0, hW0, -⟩ | ⟨-, hW2, -⟩ + · rw [h0, hW0] + · exact hW2 + have hmeet_of_ins : ∀ x ∈ H.V, x ∈ curveIns φ → ({x} ∩ insWalk ins K W).Nonempty := by + intro x hxV hx_ins + have hxA : ({x} : Set S) ∈ H.A := Or.inl (Or.inl ⟨x, hxV, rfl⟩) + rcases hx_ins with hx_ran | hx_disc + · obtain ⟨y, hyx, hyU⟩ := + GM12.meets_walkDrawing_of_isTrace htr hxA ⟨x, rfl, hranψ.symm ▸ hx_ran⟩ + exact ⟨y, hyx, Or.inl hyU⟩ + · obtain ⟨Δ, ⟨hΔ, hbd_sub⟩, hxΔ⟩ := mem_iUnion₂.mp hx_disc + let F : Set S := subBd Δ + have hbd_eq : subBd Δ = discBd Δ := IsClosedDisc.subBd_eq_discBd hS hΔ + have hF_oarc : IsOArc F := by + change IsOArc (subBd Δ) + rw [hbd_eq] + exact hΔ.isOArc_discBd + have hF_norm : H.IsNormal F := fun z hz => hnorm ⟨hbd_sub hz.1, hz.2⟩ + have hFV_sub : F ∩ H.V ⊆ range φ ∩ H.V := inter_subset_inter_left _ hbd_sub + have hFV_lt : (F ∩ H.V).ncard < θ := by + have hle := Set.ncard_le_ncard hFV_sub (H.finite_V.subset inter_subset_right) + omega + obtain ⟨Δ', hΔ'_disc, hbdΔ', hΔ'_memT⟩ := hResp.2.2.2 F hF_oarc hF_norm hFV_lt + have hbdΔ'_eq : discBd Δ' = discBd Δ := + (IsClosedDisc.subBd_eq_discBd hS hΔ'_disc).symm.trans (hbdΔ'.trans hbd_eq) + have hΔ_eq : Δ = Δ' := + eq_of_discBd_eq (IsClosedSurface.isSurface hS) hns hΔ hΔ'_disc hbdΔ'_eq.symm + have hΔ_memT : + ((PaintingOrDrawing.drawing H).inter Δ, + (PaintingOrDrawing.drawing H).interOutside Δ) ∈ T := hΔ_eq ▸ hΔ'_memT + exact h21_disc {x} hxA F Δ hF_oarc (hranψ.symm ▸ hbd_sub) hΔ rfl hΔ_memT ⟨x, rfl, hxΔ⟩ + have huW := hmeet_of_ins u hu hu_ins + have hvW := hmeet_of_ins v hv hv_ins + have huA : ({u} : Set S) ∈ H.A := Or.inl (Or.inl ⟨u, hu, rfl⟩) + have hvA : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hv, rfl⟩) + have hd_le : d {u} {v} ≤ 3 := by + by_cases huv : ({u} : Set S) = {v} + · rw [huv, GM12.metric_self hd hvA] + omega + · obtain ⟨u_K, hu_K, -⟩ := GM12.existsUnique_correspondingAtom' hrad huA + obtain ⟨v_K, hv_K, -⟩ := GM12.existsUnique_correspondingAtom' hrad hvA + have hu_sub : u_K ⊆ insWalk ins K W := + (GM12.corresponding_atom_subset_iff hS hrad hslope hu_K W hW_lt).mpr huW + have hv_sub : v_K ⊆ insWalk ins K W := + (GM12.corresponding_atom_subset_iff hS hrad hslope hv_K W hW_lt).mpr hvW + have hwit : GM11.MetricWitness H K ins θ {u} {v} (GM12.curveLength H ψ) := + ⟨w₀, W, u_K, v_K, hu_K, hv_K, hW_lt, hW_len, hu_sub, hv_sub⟩ + rw [hd_eq {u} huA {v} hvA] + exact (GM11.tangleMetric_le hwit).trans hlenψ_le + exact hdist hd_le + +/-! ## 3. Constructing Closed Curves from Radial Walks and Appending Region Paths -/ + +omit [T2Space S] in +/-- Any closed path `p : Path u u` in `S` lifts to a continuous closed curve `φ : C(Circle, S)` +with `range φ = range p`. -/ +theorem exists_closedCurve_of_loop {u : S} (p : Path u u) : + ∃ φ : C(Circle, S), range φ = range p := by + obtain ⟨φ, hRange, _⟩ := GM12.exists_closedCurve_of_loop_with_parameter p + exact ⟨φ, hRange⟩ + +omit [T2Space S] in +/-- Given any closed curve `φ : C(Circle, S)`, a point `z₀ : Circle`, and a path `γ : Path (φ z₀) +y`, +there is a closed curve `φ' : C(Circle, S)` with `range φ' = range φ ∪ range γ`. -/ +theorem exists_closedCurve_union_path (φ : C(Circle, S)) (z₀ : Circle) {y : S} + (γ : Path (φ z₀) y) : + ∃ φ' : C(Circle, S), range φ' = range φ ∪ range γ := by + let p₀ : Path (φ z₀) (φ z₀) := + { toFun := fun t => φ (z₀ * Circle.exp (2 * Real.pi * t.1)) + continuous_toFun := + φ.continuous.comp (continuous_const.mul + (Circle.exp.continuous.comp (continuous_const.mul continuous_subtype_val))) + source' := by simp + target' := by simp [Circle.exp_two_pi] } + have hran₀ : range p₀ = range φ := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact mem_range_self _ + · rintro ⟨z, rfl⟩ + obtain ⟨s, hs, hsz⟩ := (GM12.circle_parameter_bijOn 0).surjOn (mem_univ (z₀⁻¹ * z)) + rw [zero_add] at hs + let t : unitInterval := ⟨s, hs.1, hs.2.le⟩ + have hsz' : Circle.exp (2 * Real.pi * s) = z₀⁻¹ * z := hsz + refine ⟨t, ?_⟩ + change φ (z₀ * Circle.exp (2 * Real.pi * s)) = φ z + rw [hsz', mul_inv_cancel_left] + let p₁ : Path (φ z₀) (φ z₀) := p₀.trans (γ.trans γ.symm) + obtain ⟨φ', hran'⟩ := exists_closedCurve_of_loop p₁ + refine ⟨φ', ?_⟩ + rw [hran', Path.trans_range, Path.trans_range, Path.symm_range, Set.union_self, hran₀] + +/-- Every closed walk `W` of positive length `≤ 2 * m` in a radial drawing `K` of `Γ` is traced by +a closed curve `φ : C(Circle, S)` with `range φ = (walkDrawing K W).U` and +`(range φ ∩ Γ.U).encard ≤ m`. -/ +theorem exists_closedCurve_of_radial_walk_ncard {Γ K : Drawing S} + (hrad : (PaintingOrDrawing.drawing Γ).IsPreRadialDrawing K) + {u : S} (W : GraphWalk K.toGraph u u) (hpos : 0 < W.length) + {m : ℕ} (hlen : W.length ≤ 2 * m) : + ∃ φ : C(Circle, S), + range φ = (walkDrawing K W).U ∧ (range φ ∩ Γ.U).encard ≤ m := by + classical + obtain ⟨p, hran, -, -⟩ := GM12.exists_path_of_radial_walk hrad W hpos + obtain ⟨φ, hranφ⟩ := exists_closedCurve_of_loop p + have hran_W : range φ = (walkDrawing K W).U := hranφ.trans hran + refine ⟨φ, hran_W, ?_⟩ + rw [hran_W, Set.encard_le_coe_iff_finite_ncard_le] + have hsub_V : (walkDrawing K W).U ∩ Γ.U ⊆ {x | x ∈ W.support.tail ∧ x ∈ Γ.V} := by + rintro x ⟨hxW, hxΓ⟩ + have hxV : x ∈ Γ.V := by + have hrad1 : Γ.U ∩ K.U = Γ.V := hrad.1 + have : x ∈ Γ.U ∩ K.U := ⟨hxΓ, (walkDrawing_isSubdrawing K W).U_subset hxW⟩ + rwa [hrad1] at this + have hxWV : x ∈ (walkDrawing K W).V := by + by_cases h : x ∈ (walkDrawing K W).V + · exact h + · obtain ⟨e, he, hxe⟩ := (walkDrawing K W).exists_edge_of_mem hxW h + have heK : e ∈ K.E := (walkDrawing_isSubdrawing K W).2 he + exact absurd (hrad.2.1 hxV) ((heK.2.1 hxe).2) + rw [walkDrawing_V] at hxWV + refine ⟨?_, hxV⟩ + cases W with + | nil _ => simp [GraphWalk.length, GraphWalk.edges] at hpos + | cons hl rest => + simp only [GraphWalk.support_cons, List.tail_cons, List.mem_cons] at hxWV ⊢ + rcases hxWV with rfl | hx_rest + · exact rest.end_mem_support + · exact hx_rest + have hfin_supp : {x | x ∈ W.support.tail ∧ x ∈ Γ.V}.Finite := + (List.finite_toSet W.support.tail).subset fun x hx => hx.1 + refine ⟨hfin_supp.subset hsub_V, ?_⟩ + have hcard_le : ((walkDrawing K W).U ∩ Γ.U).ncard ≤ + (W.support.tail.filter (· ∈ Γ.V)).length := by + calc ((walkDrawing K W).U ∩ Γ.U).ncard + _ ≤ {x | x ∈ W.support.tail ∧ x ∈ Γ.V}.ncard := Set.ncard_le_ncard hsub_V hfin_supp + _ = (W.support.tail.filter (· ∈ Γ.V)).toFinset.card := by + rw [← Set.ncard_coe_finset] + congr 1 + ext x + simp + _ ≤ (W.support.tail.filter (· ∈ Γ.V)).length := List.toFinset_card_le _ + -- Count bipartite alternations along `W` to show `2 * (filter length) ≤ W.length` + have hb := GM11.bipartite_of_preRadial hrad + have hcount : ∀ {a b : S} (W₀ : GraphWalk K.toGraph a b), + 2 * (W₀.support.tail.filter (· ∈ Γ.V)).length + (if b ∈ Γ.V then 0 else 1) ≤ + W₀.length + (if a ∈ Γ.V then 0 else 1) := by + intro a b W₀ + induction W₀ with + | nil _ => simp + | @cons x y z e hl r ih => + have hx : x ∈ Γ.V ↔ y ∉ Γ.V := hb _ _ _ hl + have hlen₀ : (GraphWalk.cons hl r).length = r.length + 1 := rfl + have hsup₀ : (GraphWalk.cons hl r).support.tail = r.support := rfl + rw [hlen₀, hsup₀, r.support_eq_cons, List.filter_cons] + by_cases hy : y ∈ Γ.V + · have hx' : x ∉ Γ.V := fun h => hx.mp h hy + simp only [hy, hx', ite_true, ite_false, decide_true, List.length_cons] at ih ⊢ + omega + · have hx' : x ∈ Γ.V := hx.mpr hy + simp only [hy, hx', ite_true, ite_false, decide_false, Bool.false_eq_true] at ih ⊢ + omega + have hcount_W := hcount W + omega + +/-! ## 4. Lemma 5a: 39-Zone Curve Enclosure (`(1.1)(iii)(ii)`) -/ + +/-- Every atom `a ∈ H.A` that meets a `λ`-zone `Λ` around `z` is contained in `Λ`. -/ +theorem atom_subset_zone_of_inter_nonempty {H : Drawing S} + {d : Set S → Set S → ℕ} {lam : ℕ} {z Λ a : Set S} + (hZone : IsLambdaZoneAround H d lam z Λ) (ha : a ∈ H.A) (hmeet : (a ∩ Λ).Nonempty) : + a ⊆ Λ := by + obtain ⟨y, hya, hyΛ⟩ := hmeet + rcases ha with (⟨v, -, rfl⟩ | haE) | haR + · rw [mem_singleton_iff.mp hya] at hyΛ + exact singleton_subset_iff.mpr hyΛ + · rcases edge_subset_or_subset_compl_of_zone hZone haE with hsub | hsub + · exact hsub + · exact absurd hyΛ (hsub hya).2 + · obtain ⟨_, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hZone.isOpenDisc.1 + let O₂ : Set S := univ \ (H.U ∪ closure Λ) + have hO₂ : IsOpen O₂ := isOpen_univ.sdiff (H.isClosed_U.union isClosed_closure) + have hdisO : Disjoint Λ O₂ := + disjoint_left.mpr fun x hx hxO => hxO.2 (Or.inr (subset_closure hx)) + have hcov : a ⊆ Λ ∪ O₂ := by + intro w hwa + have hwU : w ∉ H.U := region_subset haR hwa + by_cases hwcl : w ∈ closure Λ + · rw [hclL] at hwcl + exact Or.inl (hwcl.resolve_right fun hbd => hwU (hZone.bd_subset_U hbd)) + · exact Or.inr ⟨mem_univ _, fun h => h.elim hwU hwcl⟩ + exact (region_isPreconnected haR).subset_left_of_subset_union + hZone.isOpenDisc.1 hO₂ hdisO hcov ⟨y, hya, hyΛ⟩ + +/-- **Lemma 5a (`exists_curve_le_39_of_mem_lambdaZone`):** Let `H` have tangle metric `d` of order +`θ ≥ 209`, and let `Λ₀` be a `lam`-zone around `z` in `H` (`lam ≤ 39`) whose boundary is a circuit +`C` of `H`. Then there exists `x ∈ Λ₀` such that for every `y ∈ Λ₀`, there is a closed curve +`φ : C(Circle, S)` with `(range φ ∩ H.U).encard ≤ lam`, `x ∈ curveIns φ`, and `y ∈ curveIns φ`. -/ +theorem exists_curve_le_of_mem_lambdaZone + (hS : IsClosedSurface S) + {H : Drawing S} {θ lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hlam : lam < θ) (hd : HasTangleMetric H θ T d) + {z Λ₀ : Set S} (hZone : IsLambdaZoneAround H d lam z Λ₀) + {C : Drawing S} (hC_circ : C.IsCircuit) (hC_sub : C.IsSubdrawing H) (hC_bd : C.U = subBd Λ₀) : + ∃ x ∈ Λ₀, ∀ y ∈ Λ₀, + ∃ φ : C(Circle, S), (range φ ∩ H.U).encard ≤ lam ∧ x ∈ curveIns φ ∧ y ∈ curveIns φ := by + classical + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hResp, K, ins, hrad, hslope, hd_eq⟩ := id hd + obtain ⟨z', hz', -⟩ := GM12.existsUnique_correspondingAtom' hrad hZone.z_mem + have hzz'_ne : (z ∩ z').Nonempty := by + obtain ⟨-, -, hcase⟩ := hz' + rcases hcase with ⟨v, -, rfl, rfl⟩ | ⟨he, _, hsub⟩ | ⟨_, v, hv, rfl⟩ + · exact ⟨v, rfl, rfl⟩ + · obtain ⟨w, hw⟩ := he.1 + exact ⟨w, hw, hsub hw⟩ + · exact ⟨v, hv.2, rfl⟩ + obtain ⟨x, hxz, hxz'⟩ := hzz'_ne + refine ⟨x, hZone.z_subset hxz, fun y hyΛ => ?_⟩ + obtain ⟨a_y, ha_y, hya⟩ := GM11.exists_atom H y + have hay_sub : a_y ⊆ Λ₀ := atom_subset_zone_of_inter_nonempty hZone ha_y ⟨y, hya, hyΛ⟩ + obtain ⟨ay', hay', -⟩ := GM12.existsUnique_correspondingAtom' hrad ha_y + -- Find a partner atom `b ∈ H.A` with `b ⊆ closure Λ₀`, `z ≠ b`, `d z b ≤ lam`, and `ay' ⊆ ...` + have hex_walk : ∃ (u₀ : S) (W : GraphWalk K.toGraph u₀ u₀), + 0 < W.length ∧ W.length < 2 * θ ∧ W.length ≤ 2 * lam ∧ + z' ⊆ insWalk ins K W ∧ ay' ⊆ insWalk ins K W := by + by_cases hz_ay : z = a_y + · subst hz_ay + have hay'_eq : ay' = z' := + (GM12.existsUnique_correspondingAtom' hrad hZone.z_mem).unique hay' hz' + rw [hay'_eq] + obtain ⟨u_c, W_c, _, hpos_c, hVC, _⟩ := id hC_circ + have hu_cV : u_c ∈ C.V := hVC ▸ W_c.start_mem_support + have hu_H : u_c ∈ H.V := hC_sub.1 hu_cV + have hu_bd : u_c ∈ subBd Λ₀ := hC_bd ▸ C.V_subset_U hu_cV + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hZone.isOpenDisc.1 + have hu_cl : ({u_c} : Set S) ⊆ closure Λ₀ := + singleton_subset_iff.mpr (hclL ▸ Or.inr hu_bd) + have hu_A : ({u_c} : Set S) ∈ H.A := Or.inl (Or.inl ⟨u_c, hu_H, rfl⟩) + have hzu_ne : z ≠ {u_c} := by + intro h + have hu_Λ : u_c ∈ Λ₀ := hZone.z_subset (h ▸ mem_singleton u_c) + exact disjoint_left.mp hdisL hu_Λ hu_bd + have hd_le : d z {u_c} ≤ lam := hZone.dist_le {u_c} hu_A hu_cl + have hd_lt : d z {u_c} < θ := lt_of_le_of_lt hd_le hlam + have hd_pos : 0 < d z {u_c} := + Nat.pos_of_ne_zero fun h0 => hzu_ne ((GM12.tangleMetric_eq_zero_iff hS hd hZone.z_mem + hu_A).mp h0) + have hd_zu : d z {u_c} = tangleMetric H K ins θ z {u_c} := hd_eq z hZone.z_mem {u_c} hu_A + rcases GM11.tangleMetric_cases (ins := ins) (θ := θ) hrad.2.1 hzu_ne with h_eq_θ | ⟨_, hwit⟩ + · omega + · rw [← hd_zu] at hwit + obtain ⟨u₀, W, z₁', _, hz₁', _, hW_lt, hW_len, hz₁_sub, _⟩ := hwit + have hz₁_eq : z₁' = z' := + (GM12.existsUnique_correspondingAtom' hrad hZone.z_mem).unique hz₁' hz' + rw [hz₁_eq] at hz₁_sub + refine ⟨u₀, W, by omega, hW_lt, by omega, hz₁_sub, hz₁_sub⟩ + · have hd_le : d z a_y ≤ lam := + hZone.dist_le a_y ha_y (hay_sub.trans subset_closure) + have hd_lt : d z a_y < θ := lt_of_le_of_lt hd_le hlam + have hd_pos : 0 < d z a_y := + Nat.pos_of_ne_zero fun h0 => hz_ay ((GM12.tangleMetric_eq_zero_iff hS hd hZone.z_mem + ha_y).mp h0) + have hd_za : d z a_y = tangleMetric H K ins θ z a_y := hd_eq z hZone.z_mem a_y ha_y + rcases GM11.tangleMetric_cases (ins := ins) (θ := θ) hrad.2.1 hz_ay with h_eq_θ | ⟨_, hwit⟩ + · omega + · rw [← hd_za] at hwit + obtain ⟨u₀, W, z₁', ay₁', hz₁', hay₁', hW_lt, hW_len, hz₁_sub, hay₁_sub⟩ := hwit + have hz₁_eq : z₁' = z' := + (GM12.existsUnique_correspondingAtom' hrad hZone.z_mem).unique hz₁' hz' + have hay₁_eq : ay₁' = ay' := + (GM12.existsUnique_correspondingAtom' hrad ha_y).unique hay₁' hay' + rw [hz₁_eq] at hz₁_sub + rw [hay₁_eq] at hay₁_sub + refine ⟨u₀, W, by omega, hW_lt, by omega, hz₁_sub, hay₁_sub⟩ + obtain ⟨u₀, W, hposW, hW_lt, hW_le, hz'_sub, hay'_sub⟩ := hex_walk + obtain ⟨φ, hranφ, hcardφ⟩ := exists_closedCurve_of_radial_walk_ncard hrad.2.1 W hposW hW_le + have hins_sub : insWalk ins K W ⊆ curveIns φ := insWalk_subset_curveIns hslope hW_lt hranφ + have hx_ins : x ∈ curveIns φ := hins_sub (hz'_sub hxz') + by_cases hy_ins : y ∈ curveIns φ + · exact ⟨φ, hcardφ, hx_ins, hy_ins⟩ + · -- `y ∉ curveIns φ`, so `a_y` must be a region `r ∈ H.R` meeting `range φ` + obtain ⟨-, -, hcase⟩ := hay' + rcases hcase with ⟨v, -, rfl, rfl⟩ | ⟨_, _, hsub⟩ | ⟨hr, w_y, hwy, rfl⟩ + · exact (hy_ins (hins_sub (hay'_sub hya))).elim + · exact (hy_ins (hins_sub (hay'_sub (hsub hya)))).elim + · have hwy_ins : w_y ∈ insWalk ins K W := hay'_sub (mem_singleton w_y) + have hy_not_insW : y ∉ insWalk ins K W := fun h => hy_ins (hins_sub h) + have hr_meet_W : (a_y ∩ range φ).Nonempty := by + rw [hranφ] + rcases hwy_ins with hwy_U | hwy_C + · exact ⟨w_y, hwy.2, hwy_U⟩ + · obtain ⟨C₀, ⟨hC₀, hC₀s⟩, hwy_C₀⟩ := mem_iUnion₂.mp hwy_C + have hy_not_C₀ : y ∉ ins C₀ := fun hyC₀ => + hy_not_insW (Or.inr (mem_iUnion₂.mpr ⟨C₀, ⟨hC₀, hC₀s⟩, hyC₀⟩)) + have hLs : (walkDrawing K W).IsSubdrawing K := walkDrawing_isSubdrawing K W + have hlen₀ : C₀.length < 2 * θ := by + refine lt_of_le_of_lt ?_ hW_lt + have hsub₀ : C₀.E ⊆ {e | e ∈ W.edges} := by + have := hC₀s.2 + rwa [walkDrawing_E] at this + calc C₀.E.ncard ≤ ({e | e ∈ W.edges} : Set (Set S)).ncard := + Set.ncard_le_ncard hsub₀ (List.finite_toSet _) + _ ≤ W.edges.length := by + rw [show ({e | e ∈ W.edges} : Set (Set S)) = ↑W.edges.toFinset by ext; simp, + Set.ncard_coe_finset] + exact List.toFinset_card_le _ + _ = W.length := rfl + obtain ⟨hdisc₀, hbd₀, -⟩ := hslope C₀ hC₀ (hC₀s.trans hLs) hlen₀ + have hcl₀ : IsClosed (ins C₀) := hdisc₀.isClosed + have hfr₀ : frontier (ins C₀) = C₀.U := by rw [subBd_eq_frontier', hbd₀] + have hnot_dis : ¬ Disjoint a_y (frontier (ins C₀)) := fun hdis => + hy_not_C₀ (GM12.subset_of_disjoint_frontier (region_isPreconnected hr) hcl₀ hdis hwy.2 + hwy_C₀ hya) + rw [Set.not_disjoint_iff] at hnot_dis + obtain ⟨p₀, hp₀_ay, hp₀_fr⟩ := hnot_dis + rw [hfr₀] at hp₀_fr + exact ⟨p₀, hp₀_ay, hC₀s.U_subset hp₀_fr⟩ + obtain ⟨p₀, hp₀_ay, z₀, rfl⟩ := hr_meet_W + have hpc_ay : IsPathConnected a_y := (hResp.1.2 a_y hr).isPathConnected + obtain ⟨γ, hγ_sub⟩ := hpc_ay.joinedIn (φ z₀) hp₀_ay y hya + obtain ⟨φ', hranφ'⟩ := exists_closedCurve_union_path φ z₀ γ + have hγ_disj : range γ ∩ H.U = ∅ := by + refine eq_empty_of_forall_notMem fun q ⟨⟨t, hqt⟩, hqU⟩ => ?_ + subst hqt + exact region_subset hr (hγ_sub t) hqU + have hran_inter : range φ' ∩ H.U = range φ ∩ H.U := by + rw [hranφ', union_inter_distrib_right, hγ_disj, union_empty] + refine ⟨φ', hran_inter.symm ▸ hcardφ, ?_, ?_⟩ + · exact curveIns_mono (hranφ'.symm ▸ subset_union_left) hx_ins + · refine Or.inl ?_ + rw [hranφ'] + exact Or.inr ⟨1, γ.target⟩ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section10Translation4.lean b/LeanPool/GraphMinor/GM14/Section10Translation4.lean new file mode 100644 index 0000000000..088cb41123 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section10Translation4.lean @@ -0,0 +1,937 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section10Translation1 +public import LeanPool.GraphMinor.GM14.Section10Translation2 +public import LeanPool.GraphMinor.GM14.Section10Translation3 +public import LeanPool.GraphMinor.GM14.Adapted +import LeanPool.GraphMinor.GM14.DiscTangleSep +import LeanPool.GraphMinor.GM14.RigidGood +import LeanPool.GraphMinor.GM14.Section7a +import LeanPool.GraphMinor.GM11.Theorem64 +import LeanPool.GraphMinor.Surface.Epstein + +/-! +# Graph Minors XIV – Section 10 Translation (Part 4: Eye Obstruction and Main Translation) + +This file completes the translation between the hypotheses and conclusions of Graph Minors XIV, +(1.1) (pages 24–25) and (4.1) (pages 30–31): +- `isSubdivisionOfSimpleThreeConnected_clearedSubdrawing_of_drawingEye`: for a 39-zone `Λ₀` around + `z` such that `H' = H ∩ (Σ - Λ₀)` is rigid and `Λ₀` is an eye of `H'` in `G` with respect to the + cleared tangle `T'` of order `51`, the graph of `H'` is a subdivision of a simple 3-connected + graph (`(1.1)(iii)(i)`). +- `four_le_subBd_diff_zone_encard`: for any closed disc `Δ ⊆ Σ` containing `{a, b, c, d}`, + `4 ≤ ((bd(Δ) \ Λ₀) ∩ U(H)).encard` (`(1.1)(iii)(iii)`). +- `eye_obstruction_of_drawingEye`: combines `(1.1)(iii)(i)–(iv)` when a 39-zone `Λ` is an eye of + `H ∩ (Σ - Λ)` in `G` with respect to the cleared tangle `T'`. +- `theorem11TranslationStatement_proved`: proves `Theorem11TranslationStatement`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Metric Graph Hypergraph +open GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 +open GraphMinor.GM11 GraphMinor.GM12 GraphMinor.GM14.Whitney + +universe u v w + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-! ## 1. Basic Facts on `clearedSubdrawing` -/ + +omit [T2Space S] in +theorem clearedSubdrawing_E [T1Space S] (H : Drawing S) (Λ : Set S) : + (clearedSubdrawing H Λ).E = {e | e ∈ H.E ∧ e ⊆ univ \ Λ} := by + change (H.span _ _).E = _ + rw [H.span_E] + ext e + simp only [mem_inter_iff, mem_ofPred_eq] + tauto + +theorem clearedSubdrawing_V {H : Drawing S} {d : Set S → Set S → ℕ} {lam : ℕ} {z Λ : Set S} + (hZone : IsLambdaZoneAround H d lam z Λ) : + (clearedSubdrawing H Λ).V = H.V \ Λ := by + apply subset_antisymm + · intro x hx + have hxH : x ∈ H.V := (clearedSubdrawing_isSubdrawing H Λ).1 hx + have hxU : x ∈ (clearedSubdrawing H Λ).U := (clearedSubdrawing H Λ).V_subset_U hx + rw [clearedSubdrawing_U hZone] at hxU + exact ⟨hxH, hxU.2⟩ + · rintro x ⟨hxV, hxΛ⟩ + exact Or.inl ⟨⟨hxV, mem_univ _, hxΛ⟩, hxV⟩ + +omit [T2Space S] in +theorem clearedSubdrawing_no_loop [T1Space S] {H : Drawing S} {Λ : Set S} + (hnl : ∀ e v, ¬ H.toGraph.IsLink e v v) : + ∀ e v, ¬ (clearedSubdrawing H Λ).toGraph.IsLink e v v := by + intro e v hl + have hs := clearedSubdrawing_isSubdrawing H Λ + refine hnl e v ⟨hs.2 hl.1, hs.1 hl.2.1, hs.1 hl.2.2.1, ?_⟩ + rw [← hs.closure_inter_V hl.1] + exact hl.2.2.2 + +/-! ## 2. Tangle Dials and Threads on a Non-Spherical Surface -/ + +theorem rad_normal_arc {J Γ' : Drawing S} (r : Rad J Γ') (hS : IsClosedSurface S) + {A : Set (Set S)} (hA : A ⊆ J.E) {F : Set S} + (hFN : F ⊆ (boundaryDrawing Γ' (tiles Γ' A)).U) : + F ∩ J.U ⊆ J.V ∧ F ∩ J.V ⊆ Whitney.bdry J.toGraph A := by + have hNs : (boundaryDrawing Γ' (tiles Γ' A)).IsSubdrawing Γ' := Drawing.span_isSubdrawing Γ' _ _ + refine ⟨fun x hx => ?_, fun x hx => ?_⟩ + · have : x ∈ J.U ∩ Γ'.U := ⟨hx.2, hNs.U_subset (hFN hx.1)⟩ + rwa [r.cap] at this + · have hxN : x ∈ (boundaryDrawing Γ' (tiles Γ' A)).V := by + rcases hFN hx.1 with h₁ | h₁ + · exact h₁ + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp h₁ + exact Or.inr (mem_iUnion₂.mpr ⟨e, he, hxe, r.vsub hx.2⟩) + exact r.mem_bdry hS hx.2 hxN hA + +theorem holder_inner_edges_self {J : Drawing S} {F D : Set S} {x y : S} + (h : Holder J univ F D x y) (hS : IsClosedSurface S) + {v : S} (hv : v ∈ (J.interSet D).V) (hx : v ≠ x) (hy : v ≠ y) : + ∀ g ∈ J.E, J.toGraph.Inc g v → g ∈ (J.interSet D).E := by + have hi := h.inner hS hv hx hy + intro g hg hinc + have hc := mem_closure_of_inc hinc + obtain ⟨q, hqi, hqg⟩ := mem_closure_iff.mp hc _ isOpen_interior hi + exact mem_interSet_E.mpr ⟨hg, h.meets hS hg ⟨q, hqg, interior_subset hqi⟩⟩ + +/-- Each edge of a set `A ⊆ J.E` with `|bdry(A)| ≤ 2` and `(drawingEdgeSepA J A, drawingEdgeSepB J +A) ∈ T'` +lies in a dial bounded by a circuit of `N(tiles Γ' A)` that holds a path of `J`. -/ +theorem exists_dial_of_edge_tangle [ConnectedSpace S] {J Γ' : Drawing S} {θ : ℕ} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins' : Drawing S → Set S} + (r : Rad J Γ') (hrig : IsRigid J) (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + (hd' : IsDerivedSlope (PaintingOrDrawing.drawing J) Γ' θ T' ins') + (hT_eq : T' = inducedPretangle (PaintingOrDrawing.drawing J) Γ' θ ins') + {A : Set (Set S)} (hA : A ⊆ J.E) (hb : (Whitney.bdry J.toGraph A).ncard ≤ 2) + (hmem : (drawingEdgeSepA J A, drawingEdgeSepB J A) ∈ T') + {e : Set S} (he : e ∈ A) : + ∃ F D x y, IsOArc F ∧ F ⊆ (boundaryDrawing Γ' (tiles Γ' A)).U ∧ + IsClosedDisc D ∧ discBd D = F ∧ e ⊆ D ∧ x ≠ y ∧ F ∩ J.V = {x, y} ∧ + (J.interSet D).IsPathBetween x y ∧ F ∩ J.U ⊆ J.V ∧ + F ∩ J.V ⊆ Whitney.bdry J.toGraph A := by + have hmem_ind : (drawingEdgeSepA J A, drawingEdgeSepB J A) ∈ + inducedPretangle (PaintingOrDrawing.drawing J) Γ' θ ins' := hT_eq ▸ hmem + have hreg_eq : PaintingOrDrawing.regionsIncludingEdge Γ' (drawingEdgeSepA J A) = tiles Γ' A := by + ext s + simp only [PaintingOrDrawing.regionsIncludingEdge, tiles, drawingEdgeSepA, + inter_eq_self_of_subset_left hA] + have hsmall : IsSmall Γ' ins' (2 * θ) J.V θ (tiles Γ' A) := by + have hs := hmem_ind.2.2 + rwa [hreg_eq] at hs + obtain ⟨s, hs, hes⟩ := r.exists_tile (hA he) + have hsZ : s ∈ tiles Γ' A := ⟨hs, e, he, hes⟩ + obtain ⟨C₁, hC₁, hC₁N, hlen, hs_ins⟩ := hsmall.2 s hsZ + have hNs : (boundaryDrawing Γ' (tiles Γ' A)).IsSubdrawing Γ' := Drawing.span_isSubdrawing Γ' _ _ + have hC₁Γ' : C₁.IsSubdrawing Γ' := hC₁N.trans hNs + obtain ⟨hdisc, hbd_sub, -⟩ := hd' C₁ hC₁ hC₁Γ' hlen + set F := C₁.U + set D := ins' C₁ + have hF : IsOArc F := IsCircuit.isOArc_U hC₁ + have hFN : F ⊆ (boundaryDrawing Γ' (tiles Γ' A)).U := hC₁N.U_subset + obtain ⟨h₁, h₂⟩ := rad_normal_arc r hS hA hFN + have hbfin : (Whitney.bdry J.toGraph A).Finite := + J.finite_V.subset (fun _ ⟨⟨_, _, hi⟩, _⟩ => hi.vertex_mem) + have hFV_le : (F ∩ J.V).ncard ≤ 2 := (ncard_le_ncard h₂ hbfin).trans hb + obtain ⟨D', hdisc', hbd', hcases⟩ := hrig F hF h₁ hFV_le + have hbd : discBd D = F := (IsClosedDisc.subBd_eq_discBd hS hdisc).symm.trans hbd_sub + have hbd_D' : discBd D' = F := (IsClosedDisc.subBd_eq_discBd hS hdisc').symm.trans hbd' + have hDD' : D = D' := + eq_of_discBd_eq (IsClosedSurface.isSurface hS) hns hdisc hdisc' (hbd.trans hbd_D'.symm) + subst hDD' + have heD : e ⊆ D := hes.trans hs_ins + obtain ⟨p, hp⟩ := (hA he).1 + have hpD : p ∈ D := heD hp + have heF : Disjoint e F := disjoint_left.mpr fun x hx hxF => + Whitney.edge_notMem_V (hA he) hx (h₁ ⟨hxF, J.closure_subset_U (hA he) (subset_closure hx)⟩) + rcases hcases with h₃ | ⟨x, y, hxy, hc, hpath⟩ + · exact absurd (h₃ ⟨hpD, J.closure_subset_U (hA he) (subset_closure hp)⟩) + (disjoint_left.mp heF hp) + · exact ⟨F, D, x, y, hF, hFN, hdisc, hbd, heD, hxy, hc, hpath, h₁, h₂⟩ + +/-- Two paths of dials with an edge in only one of them and whose union is null-homotopic cannot +both exist. -/ +theorem no_two_paths_tangle [ConnectedSpace S] {J Γ' : Drawing S} {θ : ℕ} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins' : Drawing S → Set S} + (r : Rad J Γ') (hrig : IsRigid J) (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + (h2cell : (PaintingOrDrawing.drawing J).IsTwoCell) + (hT : IsPretangle (PaintingOrDrawing.drawing J).toHypergraph θ T') + (hresp : (PaintingOrDrawing.drawing J).IsRespectful θ T') + (hd' : IsDerivedSlope (PaintingOrDrawing.drawing J) Γ' θ T' ins') + (hT_eq : T' = inducedPretangle (PaintingOrDrawing.drawing J) Γ' θ ins') + (hθ : 3 ≤ θ) + {F D F' D' : Set S} {x y : S} + (h₁ : Holder J univ F D x y) (h₂ : Holder J univ F' D' x y) + {e e' : Set S} (he : e ∈ (J.interSet D).E) (he' : e' ∈ (J.interSet D').E) + (hne : e' ∉ (J.interSet D).E) + (hdisj_K : Disjoint (J.interSet D').E (J.interSet D).E → + (J.interSet D).V ∩ (J.interSet D').V = {x, y} → + IsNullHomotopicOArc (J.sup (J.interSet D) (J.interSet D')).U) : False := by + classical + set P := J.interSet D + set P' := J.interSet D' + have hPs : P.IsSubdrawing J := Drawing.span_isSubdrawing J _ _ + have hPs' : P'.IsSubdrawing J := Drawing.span_isSubdrawing J _ _ + have hxy := h₁.ne + obtain ⟨hV, hE, hK⟩ := h₁.paths_form_circuit hS h₂ he' hne + let K := J.sup P P' + have hKU : K.U = P.U ∪ P'.U := sup_U hPs hPs' + have hKE : K.E = P.E ∪ P'.E := Drawing.sup_E hPs hPs' + have hKs : K.IsSubdrawing J := Drawing.sup_isSubdrawing _ _ _ + have hKarc : IsOArc K.U := IsCircuit.isOArc_U hK + have hKnull : IsNullHomotopicOArc K.U := hdisj_K hE.symm hV + obtain ⟨E₀, -, hE₀, hbE⟩ := epstein_first (IsClosedSurface.isSurface hS) hKarc (subset_univ _) + (disjoint_left.mpr fun x _ hbd => hbd (hS.2.2 x)) hKnull + have hfrE : frontier E₀ = K.U := (IsClosedDisc.frontier_eq_discBd hS hE₀).trans hbE + have hKE₀ : K.U ⊆ E₀ := hbE ▸ Surface.discBd_subset E₀ + let A' : Set (Set S) := {g | g ∈ J.E ∧ g ⊆ E₀} + have hKA' : K.E ⊆ A' := fun g hg => + ⟨hKs.2 hg, (K.closure_subset_U hg).trans hKE₀ |>.trans' subset_closure⟩ + have hinA : ∀ {g q}, g ∈ J.E → q ∈ g → q ∈ interior E₀ → g ∈ A' := by + intro g q hg hq hqi + by_cases hgK : g ∈ K.E + · exact hKA' hgK + · refine ⟨hg, ?_⟩ + have hdisj : Disjoint g K.U := edge_disjoint_U hKs hg hgK + rcases subset_or_disjoint_of_frontier hE₀.isClosed hg.2.2.1.isConnected.isPreconnected + (by rwa [hfrE]) with h₃ | h₃ + · exact h₃ + · exact absurd (interior_subset hqi) (disjoint_left.mp h₃ hq) + have hBoundaryEdges : ∀ {v g}, v ∈ J.V → v ∈ K.U → v ≠ x → v ≠ y → + g ∈ J.E → J.toGraph.Inc g v → g ∈ K.E := by + intro v g' hvJ hvK hvx hvy hg'J hg'i + rw [hKU] at hvK + rcases hvK with hv | hv + · have hvP : v ∈ P.V := by + rw [(h₁.VU hS).1] + rw [(h₁.VU hS).2] at hv + exact ⟨hvJ, hv.2⟩ + exact hKE ▸ Or.inl (holder_inner_edges_self h₁ hS hvP hvx hvy g' hg'J hg'i) + · have hvP : v ∈ P'.V := by + rw [(h₂.VU hS).1] + rw [(h₂.VU hS).2] at hv + exact ⟨hvJ, hv.2⟩ + exact hKE ▸ Or.inr (holder_inner_edges_self h₂ hS hvP hvx hvy g' hg'J hg'i) + obtain ⟨hbdry, htile⟩ := enclosed_edges_boundary_and_tiles (A' := A') r hE₀.isClosed hfrE hKs + (fun _ h => h.2) hKA' hinA hBoundaryEdges + have hbc : (Whitney.bdry J.toGraph A').ncard ≤ 2 := + (ncard_le_ncard hbdry (toFinite _)).trans (ncard_pair hxy).le + have hA'J : A' ⊆ J.E := fun _ hg => hg.1 + have heA' : e ∈ A' := hKA' (hKE ▸ Or.inl he) + -- Show `(drawingEdgeSepA J A', drawingEdgeSepB J A') ∈ T'` via (6.4). + have hsepA' : (PaintingOrDrawing.drawing J).toHypergraph.IsSeparation + (drawingEdgeSepA J A') (drawingEdgeSepB J A') := + isSeparation_drawingEdgeSep J A' + have hordA' : separationOrder (drawingEdgeSepA J A') (drawingEdgeSepB J A') < θ := by + change (drawingEdgeSepA J A' ∩ drawingEdgeSepB J A').vertexSet.ncard < θ + rw [inter_vertexSet_drawingEdgeSep] + omega + have hundA' : PaintingOrDrawing.underlying (drawingEdgeSepA J A') ⊆ E₀ := by + rintro z (⟨g, hgA', hinc⟩ | ⟨g, hgA', hzg⟩) + · exact closure_minimal hgA'.2 hE₀.isClosed (mem_closure_of_inc hinc) + · exact hgA'.1.2 hzg + have hmemA' : (drawingEdgeSepA J A', drawingEdgeSepB J A') ∈ T' := by + have h64 := (GM11.theorem_6_4_proof hS hns h2cell hT hresp).1 + (drawingEdgeSepA J A') (drawingEdgeSepB J A') hsepA' hordA' + exact h64.1.mpr fun F₀ hF₀A' hF₀ => + isNullHomotopicOArcIn_of_subset_disc hF₀ (subset_univ _) hE₀ (hF₀A'.trans hundA') + obtain ⟨F₁, D₁, x₁, y₁, hF₁, hF₁N, hD₁, hbD₁, heD₁, hxy₁, hcap₁, hpath₁, hn₁, -⟩ := + exists_dial_of_edge_tangle r hrig hS hns hd' hT_eq hA'J hbc hmemA' heA' + have hF₁int := radial_boundary_disjoint_interior hS hF₁N htile + have hfrD₁ : frontier D₁ = F₁ := (IsClosedDisc.frontier_eq_discBd hS hD₁).trans hbD₁ + have hInt : E₀ \ frontier E₀ ⊆ interior E₀ := fun z hz => by + by_contra hn + exact hz.2 ⟨subset_closure hz.1, hn⟩ + obtain ⟨p, hp⟩ := (hPs.2 he).1 + have hpF₁ : p ∉ F₁ := fun h' => by + have hh : p ∈ J.U := J.closure_subset_U (hPs.2 he) (subset_closure hp) + exact Whitney.edge_notMem_V (hPs.2 he) hp (hn₁ ⟨h', hh⟩) + have hpi : p ∈ interior D₁ := by + by_contra hn + exact hpF₁ (hfrD₁ ▸ ⟨subset_closure (heD₁ hp), hn⟩) + have hpE₀ : p ∈ E₀ := hKE₀ (hKU ▸ Or.inl (P.closure_subset_U he (subset_closure hp))) + have hsubInt : E₀ \ frontier E₀ ⊆ D₁ := by + rcases subset_or_disjoint_of_frontier hD₁.isClosed + (IsClosedDisc.isPreconnected_diff_frontier hS hE₀) + (by + rw [hfrD₁] + exact disjoint_left.mpr fun z hz hzF => disjoint_left.mp hF₁int hzF (hInt hz)) with h₃ | h₃ + · exact h₃ + · exfalso + obtain ⟨q, hqi, hqm⟩ := mem_closure_iff.mp + (IsClosedDisc.subset_closure_diff_frontier hS hE₀ hpE₀) _ isOpen_interior hpi + exact disjoint_left.mp h₃ hqm (interior_subset hqi) + have hE₀D₁ : E₀ ⊆ D₁ := (IsClosedDisc.subset_closure_diff_frontier hS hE₀).trans + (closure_minimal hsubInt hD₁.isClosed) + have hh₁ : Holder J univ F₁ D₁ x₁ y₁ := ⟨hD₁, subset_univ _, hbD₁, hxy₁, hcap₁, hpath₁, hn₁⟩ + have hline₁ := isLine_of_isPathBetween hpath₁ hxy₁ + refine not_oArc_subset_line hKarc hline₁ fun z hz => ?_ + rw [(hh₁.VU hS).2] + exact ⟨hKs.U_subset hz, hE₀D₁ (hKE₀ hz)⟩ + +/-- A nonempty edge set `A ⊆ J.E` with `|bdry(A)| ≤ 2` and `(drawingEdgeSepA J A, drawingEdgeSepB J +A) ∈ T'` +is the edge set of a path of `J`. -/ +theorem exists_thread_tangle [ConnectedSpace S] {J Γ' : Drawing S} {θ : ℕ} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins' : Drawing S → Set S} + (r : Rad J Γ') (hrig : IsRigid J) (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + (h2cell : (PaintingOrDrawing.drawing J).IsTwoCell) + (hT : IsPretangle (PaintingOrDrawing.drawing J).toHypergraph θ T') + (hresp : (PaintingOrDrawing.drawing J).IsRespectful θ T') + (hd' : IsDerivedSlope (PaintingOrDrawing.drawing J) Γ' θ T' ins') + (hT_eq : T' = inducedPretangle (PaintingOrDrawing.drawing J) Γ' θ ins') + (hθ : 3 ≤ θ) + {A : Set (Set S)} (hA : A ⊆ J.E) (hb : (Whitney.bdry J.toGraph A).ncard ≤ 2) + (hmem : (drawingEdgeSepA J A, drawingEdgeSepB J A) ∈ T') (hne : A.Nonempty) : + ∃ (x y : S) (P : Drawing S), x ≠ y ∧ Whitney.bdry J.toGraph A = {x, y} ∧ + P.IsSubdrawing J ∧ P.IsPathBetween x y ∧ P.E = A ∧ + (∀ v ∈ P.V, v ≠ x → v ≠ y → ∀ g ∈ J.E, J.toGraph.Inc g v → g ∈ P.E) := by + classical + obtain ⟨e₀, he₀⟩ := hne + have hbfin : (Whitney.bdry J.toGraph A).Finite := + J.finite_V.subset (fun _ ⟨⟨_, _, hi⟩, _⟩ => hi.vertex_mem) + have key : ∀ e ∈ A, ∃ F D x y, Holder J univ F D x y ∧ e ∈ (J.interSet D).E ∧ + Whitney.bdry J.toGraph A = {x, y} ∧ (J.interSet D).E ⊆ A := by + intro e he + obtain ⟨F, D, x, y, hF, -, hD, hbd, heD, hxy, hcap, hpath, hn, hsub⟩ := + exists_dial_of_edge_tangle r hrig hS hns hd' hT_eq hA hb hmem he + have hh : Holder J univ F D x y := ⟨hD, subset_univ _, hbd, hxy, hcap, hpath, hn⟩ + have heP : e ∈ (J.interSet D).E := mem_interSet_E.mpr ⟨hA he, heD⟩ + have hbd_eq : Whitney.bdry J.toGraph A = {x, y} := by + have h₁ : ({x, y} : Set S) ⊆ Whitney.bdry J.toGraph A := hcap ▸ hsub + exact (eq_of_subset_of_ncard_le h₁ (by rw [ncard_pair hxy]; exact hb) hbfin).symm + refine ⟨F, D, x, y, hh, heP, hbd_eq, ?_⟩ + obtain ⟨W, hs, hV, hE⟩ := hpath + intro g hg + have hPs : (J.interSet D).IsSubdrawing J := Drawing.span_isSubdrawing J _ _ + have hg' : g ∈ W.edges := by rw [hE] at hg; exact hg + have he' : e ∈ W.edges := by rw [hE] at heP; exact heP + refine walk_same_side hPs.1 hPs.2 W hs (fun v _ h₃ h₄ hvb => ?_) e he' g hg' he + rw [hbd_eq] at hvb + rcases hvb with h₅ | h₅ + · exact h₃ h₅ + · exact h₄ h₅ + obtain ⟨F, D, x, y, h₁, he₀P, hbd, hPE_sub⟩ := key e₀ he₀ + have hsepA : (PaintingOrDrawing.drawing J).toHypergraph.IsSeparation + (drawingEdgeSepA J A) (drawingEdgeSepB J A) := + isSeparation_drawingEdgeSep J A + have hordA : separationOrder (drawingEdgeSepA J A) (drawingEdgeSepB J A) < θ := by + change (drawingEdgeSepA J A ∩ drawingEdgeSepB J A).vertexSet.ncard < θ + rw [inter_vertexSet_drawingEdgeSep] + omega + have hnull_of_A : ∀ {P₁ P₂ : Drawing S}, P₁.IsSubdrawing J → P₂.IsSubdrawing J → + P₁.IsPathBetween x y → P₂.IsPathBetween x y → + P₁.V ∩ P₂.V = {x, y} → Disjoint P₁.E P₂.E → + P₁.E ⊆ A → P₂.E ⊆ A → + IsNullHomotopicOArc (J.sup P₁ P₂).U := by + intro P₁ P₂ hPs₁ hPs₂ hp₁ hp₂ hV₁₂ hE₁₂ hsub₁ hsub₂ + let K := J.sup P₁ P₂ + have hK : K.IsCircuit := Drawing.isCircuit_sup hp₁ hp₂ hPs₁ hPs₂ h₁.ne hV₁₂ hE₁₂ + have hKE : K.E = P₁.E ∪ P₂.E := Drawing.sup_E hPs₁ hPs₂ + have hKA : K.E ⊆ A := hKE ▸ union_subset hsub₁ hsub₂ + have hKs : K.IsSubdrawing J := ⟨by + rw [Drawing.sup_V hPs₁ hPs₂] + exact union_subset hPs₁.1 hPs₂.1, hKA.trans hA⟩ + have hund : K.U ⊆ PaintingOrDrawing.underlying (drawingEdgeSepA J A) := by + intro z hz + rw [Drawing.U_eq] at hz + rcases hz with hz | hz + · obtain ⟨e₁, he₁K, hinc₁⟩ : ∃ e₁ ∈ K.E, J.toGraph.Inc e₁ z := by + obtain ⟨u, W, -, hpos, hCV, hCE⟩ := hK + have hzW : z ∈ W.support := by rw [hCV] at hz; exact hz + obtain ⟨W₁, W₂, rfl⟩ := W.exists_append_of_mem hzW + set Rot := W₂.append W₁ + have hlen : 0 < Rot.length := by + rw [GraphWalk.length_append] + rw [GraphWalk.length_append] at hpos + omega + cases hR : Rot with + | nil => simp [hR, GraphWalk.length] at hlen + | @cons _ w₁ _ e₁ hl₁ rest => + have he₁R : e₁ ∈ Rot.edges := by simp [hR] + have he₁W : e₁ ∈ (W₁.append W₂).edges := by + rw [GraphWalk.edges_append, List.mem_append] at he₁R ⊢ + exact he₁R.symm + have he₁C : e₁ ∈ K.E := by rw [hCE]; exact he₁W + have hinc : J.toGraph.Inc e₁ z := + ⟨w₁, hKs.2 hl₁.1, hKs.1 hl₁.2.1, hKs.1 hl₁.2.2.1, by + rw [← hKs.closure_inter_V hl₁.1]; exact hl₁.2.2.2⟩ + exact ⟨e₁, he₁C, hinc⟩ + exact Or.inl ⟨e₁, hKA he₁K, hinc₁⟩ + · obtain ⟨g, hgK, hzg⟩ := mem_iUnion₂.mp hz + by_cases hzV : z ∈ J.V + · exact Or.inl ⟨g, hKA hgK, inc_of_mem_closure (hKs.2 hgK) hzg hzV⟩ + · have hzg' : z ∈ g := by + rw [← J.closure_diff_V (hKs.2 hgK)] + exact ⟨hzg, hzV⟩ + exact Or.inr ⟨g, ⟨hKA hgK, hKs.2 hgK⟩, hzg'⟩ + have h64 := (GM11.theorem_6_4_proof hS hns h2cell hT hresp).1 + (drawingEdgeSepA J A) (drawingEdgeSepB J A) hsepA hordA + exact h64.1.mp hmem K.U hund (IsCircuit.isOArc_U hK) + refine ⟨x, y, J.interSet D, h₁.ne, hbd, Drawing.span_isSubdrawing J _ _, h₁.path, + subset_antisymm hPE_sub ?_, fun v hv h₃ h₄ => holder_inner_edges_self h₁ hS hv h₃ h₄⟩ + intro e he + by_contra hn + obtain ⟨F', D', x', y', h₂, heP, hbd', hPE'_sub⟩ := key e he + have hset : ({x, y} : Set S) = {x', y'} := hbd.symm.trans hbd' + have hx' : x ∈ ({x', y'} : Set S) := hset ▸ Or.inl rfl + rcases hx' with rfl | hx' + · have hy' : y' = y := by + have : y' ∈ ({x, y} : Set S) := hset ▸ Or.inr rfl + rcases this with h₃ | h₃ + · exact absurd h₃.symm h₂.ne + · exact h₃ + subst hy' + exact no_two_paths_tangle r hrig hS hns h2cell hT hresp hd' hT_eq hθ h₁ h₂ he₀P heP hn + (fun hdisj hV => hnull_of_A (Drawing.span_isSubdrawing J _ _) + (Drawing.span_isSubdrawing J _ _) + h₁.path h₂.path hV hdisj.symm hPE_sub hPE'_sub) + · obtain rfl : x = y' := hx' + have hy' : x' = y := by + have : x' ∈ ({x, y} : Set S) := hset ▸ Or.inl rfl + rcases this with h₃ | h₃ + · exact absurd h₃ h₂.ne + · exact h₃ + subst hy' + have h₂' : Holder J univ F' D' x x' := ⟨h₂.disc, h₂.sub, h₂.bd, h₁.ne, by + rw [pair_comm]; exact h₂.cap, isPathBetween_symm h₂.path, h₂.norm⟩ + exact no_two_paths_tangle r hrig hS hns h2cell hT hresp hd' hT_eq hθ h₁ h₂' he₀P heP hn + (fun hdisj hV => hnull_of_A (Drawing.span_isSubdrawing J _ _) + (Drawing.span_isSubdrawing J _ _) + h₁.path h₂'.path hV hdisj.symm hPE_sub hPE'_sub) + +/-- If `(drawingEdgeSepA J E(G₂), drawingEdgeSepB J E(G₂)) ∈ T'` for a separation `(G₁, G₂)` of +`J.toGraph` of order `≤ 2`, then `Thin J.toGraph G₂ G₁`. -/ +theorem thin_of_edge_tangle [ConnectedSpace S] {J Γ' : Drawing S} {θ : ℕ} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins' : Drawing S → Set S} + (r : Rad J Γ') (hrig : IsRigid J) (hS : IsClosedSurface S) (hns : ¬ IsSphere S) + (h2cell : (PaintingOrDrawing.drawing J).IsTwoCell) + (hT : IsPretangle (PaintingOrDrawing.drawing J).toHypergraph θ T') + (hresp : (PaintingOrDrawing.drawing J).IsRespectful θ T') + (hd' : IsDerivedSlope (PaintingOrDrawing.drawing J) Γ' θ T' ins') + (hT_eq : T' = inducedPretangle (PaintingOrDrawing.drawing J) Γ' θ ins') + (hθ : 3 ≤ θ) + {G₁ G₂ : Graph S (Set S)} (hs : IsGraphSeparation J.toGraph G₁ G₂) + (hord : (V(G₁) ∩ V(G₂)).ncard ≤ 2) + (hmem : (drawingEdgeSepA J E(G₂), drawingEdgeSepB J E(G₂)) ∈ T') : + Thin J.toGraph G₂ G₁ := by + obtain ⟨hl₁, hl₂, hV, hE, hdis⟩ := id hs + set X := V(G₁) ∩ V(G₂) with hX + have hXfin : X.Finite := J.finite_V.subset fun z hz => hl₁.vertexSet_mono hz.1 + have hside : ∀ {v g}, v ∈ V(G₂) → v ∉ X → g ∈ J.E → J.toGraph.Inc g v → g ∈ E(G₂) := by + intro v g h₁ h₂ hg hi + have : g ∈ E(G₁) ∪ E(G₂) := hE ▸ hg + rcases this with h₃ | h₃ + · exact absurd ⟨mem_V_of_closure hl₁ h₃ (mem_closure_of_inc hi) hi.vertex_mem, h₁⟩ h₂ + · exact h₃ + have hbX : Whitney.bdry J.toGraph E(G₂) ⊆ X := by + rintro v ⟨⟨g, hg, hi⟩, ⟨g', ⟨hg', hgA⟩, hi'⟩⟩ + by_contra hn + have hv₂ : v ∈ V(G₂) := mem_V_of_closure hl₂ hg (mem_closure_of_inc hi) hi.vertex_mem + exact hgA (hside hv₂ hn hg' hi') + have hbc : (Whitney.bdry J.toGraph E(G₂)).ncard ≤ 2 := (ncard_le_ncard hbX hXfin).trans hord + have hedge : ∀ {v}, v ∈ J.V → ∃ g ∈ J.E, J.toGraph.Inc g v := by + intro v hv + obtain ⟨g, hg, hc⟩ := exists_edge_of_regionFacts hS r.facts hv + exact ⟨g, hg, inc_of_mem_closure hg hc hv⟩ + by_cases hA : E(G₂) = ∅ + · refine Or.inl ⟨fun v hv => ?_, hA⟩ + by_contra hn + have hnX : v ∉ X := fun h₃ => hn h₃.1 + obtain ⟨g, hg, hi⟩ := hedge (hl₂.vertexSet_mono hv) + have hg₂ := hside hv hnX hg hi + rw [hA] at hg₂ + exact hg₂ + · obtain ⟨x, y, P, hxy, hbd, hPs, hpath, hPE, hin⟩ := + exists_thread_tangle r hrig hS hns h2cell hT hresp hd' hT_eq hθ + hl₂.edgeSet_mono hbc hmem (nonempty_iff_ne_empty.mpr hA) + have hxX : x ∈ X := hbX (hbd ▸ Or.inl rfl) + have hyX : y ∈ X := hbX (hbd ▸ Or.inr rfl) + have hXeq : X = {x, y} := by + have hsub : ({x, y} : Set S) ⊆ X := by + rintro z (rfl | rfl) + · exact hxX + · exact hyX + exact (eq_of_subset_of_ncard_le hsub (by rw [ncard_pair hxy]; exact hord) hXfin).symm + have hE₂ : E(G₂) = P.E := hPE.symm + have hxP : x ∈ P.V := by + obtain ⟨W₀, -, hV₀, -⟩ := id hpath + rw [hV₀] + exact start_mem_support W₀ + have hyP : y ∈ P.V := by + obtain ⟨W₀, -, hV₀, -⟩ := id hpath + rw [hV₀] + exact end_mem_support W₀ + have hX₂ : (V(G₂) ∩ V(G₁)).encard = 2 := by + rw [Set.inter_comm, ← hX, hXeq, encard_pair hxy] + have hPinV : ∀ {v}, v ∈ P.V → v ≠ x → v ≠ y → v ∈ V(G₂) \ V(G₁) := by + intro v hv h₁ h₂ + have hedgeP : ∃ g ∈ P.E, P.toGraph.Inc g v := by + obtain ⟨W₀, hs₀, hV₀, hE₀⟩ := id hpath + have hvs : v ∈ W₀.support := by rw [hV₀] at hv; exact hv + obtain ⟨e, he, -, -, -, hie, -⟩ := exists_two_edges_at_inner W₀ hs₀ hvs h₁ h₂ + exact ⟨e, by rw [hE₀]; exact he, hie⟩ + obtain ⟨g, hg, hi⟩ := hedgeP + have hv₂ : v ∈ V(G₂) := mem_V_of_closure hl₂ (hE₂ ▸ hg) (mem_closure_of_inc hi) (hPs.1 hv) + refine ⟨hv₂, fun hv₁ => ?_⟩ + have : v ∈ X := ⟨hv₁, hv₂⟩ + rw [hXeq] at this + rcases this with h₃ | h₃ + · exact h₁ h₃ + · exact h₂ h₃ + have hV₂P : ∀ {v}, v ∈ V(G₂) \ V(G₁) → v ∈ P.V ∧ v ≠ x ∧ v ≠ y := by + rintro v ⟨hv, hn⟩ + have hnX : v ∉ X := fun h₃ => hn h₃.1 + have hvx : v ≠ x := fun h₃ => hnX (h₃ ▸ hxX) + have hvy : v ≠ y := fun h₃ => hnX (h₃ ▸ hyX) + obtain ⟨g, hg, hi⟩ := hedge (hl₂.vertexSet_mono hv) + have hg₂ := hside hv hnX hg hi + have hgP : g ∈ P.E := hE₂ ▸ hg₂ + exact ⟨mem_V_of_inc_sub hPs hgP hi, hvx, hvy⟩ + refine Or.inr ⟨hX₂, fun v hv => ?_, ?_⟩ + · obtain ⟨hvP, h₁, h₂⟩ := hV₂P hv + have hall := hin v hvP h₁ h₂ + have hset : {g | J.toGraph.Inc g v} = {g | P.toGraph.Inc g v} := by + ext g + constructor + · intro hi + have hgP := hall g hi.edge_mem hi + exact inc_of_mem_closure hgP (mem_closure_of_inc hi) hvP + · intro hi + exact inc_of_mem_closure (hPs.2 hi.edge_mem) (mem_closure_of_inc hi) (hPs.1 hvP) + change {g | J.toGraph.Inc g v}.encard = 2 + have hfin : {g | P.toGraph.Inc g v}.Finite := + P.finite_edges.subset fun _ hg => hg.edge_mem + rw [hset, ← hfin.cast_ncard_eq] + exact_mod_cast path_two hpath hvP h₁ h₂ + · rw [hE₂] + have hsub : P.V \ {x, y} ⊆ V(G₂) \ V(G₁) := fun v hv => + hPinV hv.1 (fun h₃ => hv.2 (Or.inl h₃)) (fun h₃ => hv.2 (Or.inr h₃)) + have hfinV : (V(G₂) \ V(G₁)).Finite := + J.finite_V.subset fun z hz => hl₂.vertexSet_mono hz.1 + have hfinE : P.E.Finite := P.finite_edges + rw [← hfinE.cast_ncard_eq, ← hfinV.cast_ncard_eq] + exact_mod_cast (path_count hpath hxy hxP hyP).trans (by + have := ncard_le_ncard hsub hfinV + omega) + +/-! ## 3. Degree and Boundary Lower Bounds for `H' = H ∩ (Σ - Λ₀)` -/ + +omit [T2Space S] in +/-- Every vertex of a circuit `C` in a loop-free drawing `J` is incident with two distinct edges +of `C`. -/ +theorem two_edges_of_mem_circuit {J C : Drawing S} (hC : C.IsCircuit) (hCs : C.IsSubdrawing J) + (hnl : ∀ e v, ¬ J.toGraph.IsLink e v v) {v : S} (hv : v ∈ C.V) : + ∃ e₁ ∈ C.E, ∃ e₂ ∈ C.E, e₁ ≠ e₂ ∧ J.toGraph.Inc e₁ v ∧ J.toGraph.Inc e₂ v := by + obtain ⟨u, W, ⟨_, hed⟩, hpos, hCV, hCE⟩ := hC + have hvW : v ∈ W.support := by rw [hCV] at hv; exact hv + obtain ⟨W₁, W₂, rfl⟩ := W.exists_append_of_mem hvW + set Rot := W₂.append W₁ with hRot + have hedRot : Rot.edges.Nodup := by + rw [hRot, GraphWalk.edges_append] + rw [GraphWalk.edges_append] at hed + exact (List.perm_append_comm.nodup_iff).mp hed + have hmemE : ∀ e, e ∈ Rot.edges → e ∈ C.E := by + intro e he + rw [hCE] + change e ∈ (W₁.append W₂).edges + rw [hRot, GraphWalk.edges_append, List.mem_append] at he + rw [GraphWalk.edges_append, List.mem_append] + exact he.symm + have hlen : 0 < Rot.length := by + rw [hRot, GraphWalk.length_append] + rw [GraphWalk.length_append] at hpos + omega + cases hR : Rot with + | nil => simp [hR, GraphWalk.length] at hlen + | @cons _ w₁ _ e₁ hl₁ rest => + have he₁C : e₁ ∈ C.E := hmemE e₁ (by simp [hR]) + have hinc₁ : J.toGraph.Inc e₁ v := + ⟨w₁, hCs.2 hl₁.1, hCs.1 hl₁.2.1, hCs.1 hl₁.2.2.1, by + rw [← hCs.closure_inter_V hl₁.1]; exact hl₁.2.2.2⟩ + have hnd_cons : e₁ ∉ rest.edges ∧ rest.edges.Nodup := by + have hed' : (e₁ :: rest.edges).Nodup := by simpa [hR, GraphWalk.edges] using hedRot + exact List.nodup_cons.mp hed' + cases hrest_nil : rest with + | nil => + exact absurd ⟨hCs.2 hl₁.1, hCs.1 hl₁.2.1, hCs.1 hl₁.2.2.1, by + rw [← hCs.closure_inter_V hl₁.1]; exact hl₁.2.2.2⟩ (hnl e₁ v) + | @cons _ w₀ _ e₀ hl₀ rest₀ => + have hlen_rev : 0 < rest.reverse.length := by + rw [GraphWalk.length_reverse, hrest_nil] + simp [GraphWalk.length] + cases hrest : rest.reverse with + | nil => simp [hrest, GraphWalk.length] at hlen_rev + | @cons _ w₂ _ e₂ hl₂ rest₂ => + have he₂_rev : e₂ ∈ rest.reverse.edges := by simp [hrest] + have he₂_rest : e₂ ∈ rest.edges := by + rwa [GraphWalk.edges_reverse, List.mem_reverse] at he₂_rev + have he₂C : e₂ ∈ C.E := hmemE e₂ (by simp [hR, he₂_rest]) + have hinc₂ : J.toGraph.Inc e₂ v := + ⟨w₂, hCs.2 hl₂.1, hCs.1 hl₂.2.1, hCs.1 hl₂.2.2.1, by + rw [← hCs.closure_inter_V hl₂.1]; exact hl₂.2.2.2⟩ + have hne : e₁ ≠ e₂ := fun h => hnd_cons.1 (h ▸ he₂_rest) + exact ⟨e₁, he₁C, e₂, he₂C, hne, hinc₁, hinc₂⟩ + +omit [T2Space S] in +/-- Every vertex in `bdry J.toGraph C.E` for a circuit `C` of a loop-free drawing `J` has degree +at least `3` in `J.toGraph`. -/ +theorem mem_deg_ne_two_of_mem_bdry_circuit {J C : Drawing S} (hC : C.IsCircuit) + (hCs : C.IsSubdrawing J) (hnl : ∀ e v, ¬ J.toGraph.IsLink e v v) : + Whitney.bdry J.toGraph C.E ⊆ {v | v ∈ V(J.toGraph) ∧ Whitney.deg J.toGraph v ≠ 2} := by + rintro v ⟨⟨e₀, he₀C, hinc₀⟩, ⟨e₃, ⟨he₃J, he₃nC⟩, hinc₃⟩⟩ + have hvC : v ∈ C.V := mem_V_of_inc_sub hCs he₀C hinc₀ + obtain ⟨e₁, he₁C, e₂, he₂C, hne₁₂, hinc₁, hinc₂⟩ := two_edges_of_mem_circuit hC hCs hnl hvC + refine ⟨hinc₀.vertex_mem, ?_⟩ + have hsub : ({e₁, e₂, e₃} : Set (Set S)) ⊆ {g | J.toGraph.Inc g v} := by + rintro g (rfl | rfl | rfl) + · exact hinc₁ + · exact hinc₂ + · exact hinc₃ + have hfin : {g | J.toGraph.Inc g v}.Finite := + J.finite_edges.subset fun g hg => hg.edge_mem + have hne₁₃ : e₁ ≠ e₃ := fun h => he₃nC (h ▸ he₁C) + have hne₂₃ : e₂ ≠ e₃ := fun h => he₃nC (h ▸ he₂C) + have hcard3 : ({e₁, e₂, e₃} : Set (Set S)).ncard = 3 := by + rw [ncard_insert_of_notMem (by simp [hne₁₂, hne₁₃]), ncard_pair hne₂₃] + have hle := ncard_le_ncard hsub hfin + rw [hcard3] at hle + change {g | J.toGraph.Inc g v}.encard ≠ 2 + rw [← hfin.cast_ncard_eq] + exact_mod_cast (show {g | J.toGraph.Inc g v}.ncard ≠ 2 by omega) + +/-- Part 6(i) of the Section 10 translation: if a 39-zone `Λ₀` around `z` is an eye of +`H' = clearedSubdrawing H Λ₀` with respect to the cleared tangle `T'` of order `51` and `H'` is +rigid, then `H'.toGraph` is a subdivision of a simple 3-connected graph. -/ +theorem isSubdivisionOfSimpleThreeConnected_clearedSubdrawing_of_drawingEye + {α : Type v} {β : Type w} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) (hnot_sphere : ¬ IsSphere S) + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + (hH_subdiv : IsSubdivisionOfSimpleThreeConnected η.imageGraph) + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z Λ₀ : Set S} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d' : Set S → Set S → ℕ} + {η_cl : SpanEmbedding (clearedSubdrawing H Λ₀) G} + (hZone : IsLambdaZoneAround H d 39 z Λ₀) + (hrig : IsRigid (clearedSubdrawing H Λ₀)) + (hCleared : IsClearedTangle H T d 209 39 Λ₀ T' d') + (heye : IsDrawingEye G (clearedSubdrawing H Λ₀) η_cl (209 - 158) T' Λ₀) : + IsSubdivisionOfSimpleThreeConnected (clearedSubdrawing H Λ₀).toGraph := by + have : ConnectedSpace S := hConn + set H' := clearedSubdrawing H Λ₀ + obtain ⟨G₀, Q, hsd⟩ := exists_subData (isSubdivision_toGraph_of_spanEmbedding η hH_subdiv) + have hnl : ∀ e v, ¬ H'.toGraph.IsLink e v v := + clearedSubdrawing_no_loop (fun e u hl => Whitney.no_loop hsd hl) + obtain ⟨hΛ₀R, C, a, b, c, d_v, P₁, P₂, hC, hCs, hCU, ha, hb, hc, hd_v, hnodup, -, hfree, -⟩ := + heye + have hMetric' : HasTangleMetric H' 51 T' d' := hCleared.hasMetric + rcases hMetric' with ⟨hResp', K', ins', hK', hd', hd'_eq⟩ + have hMetric' : HasTangleMetric H' 51 T' d' := ⟨hResp', K', ins', hK', hd', hd'_eq⟩ + have h2cell' : (PaintingOrDrawing.drawing H').IsTwoCell := hResp'.1 + have hT' : GM10.IsTangle H'.toHypergraph 51 T' := hResp'.2.1 + have hresp' : (PaintingOrDrawing.drawing H').IsRespectful 51 T' := hResp'.2.2 + obtain ⟨e₀, he₀C⟩ := IsCircuit.E_nonempty hC + have hE' : H'.E.Nonempty := ⟨e₀, hCs.2 he₀C⟩ + have hrad_facts : RegionFacts (PaintingOrDrawing.drawing H') K' := + GM11.regionFacts_of_radial ⟨hK'.1, hK'.2.1⟩ hS hK'.2.2 hE' + have r : Rad H' K' := ⟨hK'.2.1.1, hK'.2.1.2.1, hrad_facts⟩ + have hT_eq : T' = inducedPretangle (PaintingOrDrawing.drawing H') K' 51 ins' := + (GM11.theorem_6_3_proof S hS hConn (PaintingOrDrawing.drawing H') K' 51 T' ins' + h2cell' hE' hT'.isPretangle hresp' hK' hd').2 + -- Show `4 ≤ {v | v ∈ V(H'.toGraph) ∧ deg H'.toGraph v ≠ 2}.ncard`. + have hfour : 4 ≤ {v | v ∈ V(H'.toGraph) ∧ Whitney.deg H'.toGraph v ≠ 2}.ncard := by + have hbd_sub := mem_deg_ne_two_of_mem_bdry_circuit hC hCs hnl + have hfin_deg : {v | v ∈ V(H'.toGraph) ∧ Whitney.deg H'.toGraph v ≠ 2}.Finite := + H'.finite_V.subset fun _ h => h.1 + suffices hbd4 : 4 ≤ (Whitney.bdry H'.toGraph C.E).ncard from + hbd4.trans (ncard_le_ncard hbd_sub hfin_deg) + by_contra hlt4 + have hlt4' : (Whitney.bdry H'.toGraph C.E).ncard < 4 := Nat.lt_of_not_le hlt4 + let A₁ := drawingEdgeSepA H' C.E + let A₂ := drawingEdgeSepB H' C.E + have hsep12 : H'.toHypergraph.IsSeparation A₁ A₂ := isSeparation_drawingEdgeSep H' C.E + have hord12 : separationOrder A₁ A₂ < 4 := by + change (A₁ ∩ A₂).vertexSet.ncard < 4 + rwa [inter_vertexSet_drawingEdgeSep] + have hCV_sub : C.V ⊆ A₁.vertexSet := by + intro v hv + obtain ⟨e₁, he₁C, -, -, -, hinc₁, -⟩ := two_edges_of_mem_circuit hC hCs hnl hv + exact ⟨e₁, he₁C, hinc₁⟩ + have habcd_sub : ({a, b, c, d_v} : Set S) ⊆ A₁.vertexSet := by + rintro v (rfl | rfl | rfl | rfl) + · exact hCV_sub ha + · exact hCV_sub hb + · exact hCV_sub hc + · exact hCV_sub hd_v + have habcd_card : ({a, b, c, d_v} : Set S).ncard = 4 := by + classical + have h1 : ({a, b, c, d_v} : Set S) = ↑([a, b, c, d_v].toFinset) := by + ext x; simp + rw [h1, ncard_coe_finset, List.toFinset_card_of_nodup hnodup] + rfl + have hnot_A₁ : (A₁, A₂) ∉ T' := by + intro hmem + have hle := hfree.2.2 hmem habcd_sub + omega + have hA₂A₁ : (A₂, A₁) ∈ T' := + (hT'.axiom1 hsep12 (by omega)).resolve_left hnot_A₁ + have hA₁_ne : A₁.edgeSet ≠ {Λ₀} := by + intro heq + have he₀A₁ : e₀ ∈ A₁.edgeSet := ⟨he₀C, hCs.2 he₀C⟩ + rw [heq, mem_singleton_iff] at he₀A₁ + subst he₀A₁ + obtain ⟨p, hp⟩ := (hCs.2 he₀C).1 + exact region_subset hΛ₀R hp (H'.closure_subset_U (hCs.2 he₀C) (subset_closure hp)) + obtain ⟨e, heA₁, hdist_ge⟩ := + theorem_7_3_proof H' 51 T' d' A₂ A₁ Λ₀ hS hConn hE' hMetric' (Or.inr hΛ₀R) hA₂A₁ hA₁_ne + have hord21 : separationOrder A₂ A₁ < 4 := by + rwa [separationOrder_comm] + have heC : e ∈ C.E := heA₁.1 + have heH' : e ∈ H'.E := heA₁.2 + have heH : e ∈ H.E := (clearedSubdrawing_isSubdrawing H Λ₀).2 heH' + have he_cl : e ⊆ closure Λ₀ := by + have heCU : e ⊆ C.U := (C.closure_subset_U heC).trans' subset_closure + rw [hCU, subBd_eq_frontier] at heCU + exact heCU.trans frontier_subset_closure + have hle_zone : d z e ≤ 39 := hZone.dist_le e (Or.inl (Or.inr heH)) he_cl + have hle_clear : d' Λ₀ e ≤ d z e := + (hCleared.dist_bounds z hZone.z_mem e (Or.inl (Or.inr heH)) + Λ₀ (Or.inr hΛ₀R) e (Or.inl (Or.inr heH')) hZone.z_subset subset_rfl).2 + omega + -- Show `Good H'.toGraph`. + have hgood : Whitney.Good H'.toGraph := by + refine ⟨H'.finite_V, H'.finite_edges, hnl, hfour, ?_⟩ + intro G₁ G₂ hs hord + obtain ⟨hl₁, hl₂, hV, hE, hdis⟩ := id hs + have hb₁ : Whitney.bdry H'.toGraph E(G₁) ⊆ V(G₁) ∩ V(G₂) := by + rintro v ⟨⟨g, hg, hi⟩, ⟨g', ⟨hg', hgA⟩, hi'⟩⟩ + have hv₁ : v ∈ V(G₁) := mem_V_of_closure hl₁ hg (mem_closure_of_inc hi) hi.vertex_mem + have hg'₂ : g' ∈ E(G₂) := by + have : g' ∈ E(G₁) ∪ E(G₂) := hE ▸ hg' + exact this.resolve_left hgA + have hv₂ : v ∈ V(G₂) := mem_V_of_closure hl₂ hg'₂ (mem_closure_of_inc hi') hi'.vertex_mem + exact ⟨hv₁, hv₂⟩ + have hfinX : (V(G₁) ∩ V(G₂)).Finite := + H'.finite_V.subset fun z hz => hl₁.vertexSet_mono hz.1 + have hord₁ : separationOrder (drawingEdgeSepA H' E(G₁)) (drawingEdgeSepB H' E(G₁)) < 51 := by + change (drawingEdgeSepA H' E(G₁) ∩ drawingEdgeSepB H' E(G₁)).vertexSet.ncard < 51 + rw [inter_vertexSet_drawingEdgeSep] + have := (ncard_le_ncard hb₁ hfinX).trans hord + omega + rcases hT'.axiom1 (isSeparation_drawingEdgeSep H' E(G₁)) hord₁ with hmem₁ | hmem₂ + · left + have hs_symm : IsGraphSeparation H'.toGraph G₂ G₁ := + ⟨hl₂, hl₁, Set.union_comm _ _ ▸ hV, Set.union_comm _ _ ▸ hE, hdis.symm⟩ + exact thin_of_edge_tangle r hrig hS hnot_sphere h2cell' hT'.isPretangle hresp' hd' hT_eq + (by decide) hs_symm (by rwa [Set.inter_comm]) hmem₁ + · right + have hE_diff₁ : H'.E \ E(G₁) = E(G₂) := by + ext g + constructor + · rintro ⟨hg, hg₁⟩ + have : g ∈ E(G₁) ∪ E(G₂) := hE ▸ hg + exact this.resolve_left hg₁ + · intro hg₂ + exact ⟨hl₂.edgeSet_mono hg₂, disjoint_right.mp hdis hg₂⟩ + have hE_diff₂ : H'.E \ E(G₂) = E(G₁) := by + ext g + constructor + · rintro ⟨hg, hg₂⟩ + have : g ∈ E(G₁) ∪ E(G₂) := hE ▸ hg + exact this.resolve_right hg₂ + · intro hg₁ + exact ⟨hl₁.edgeSet_mono hg₁, disjoint_left.mp hdis hg₁⟩ + have hverts_union : + Whitney.verts H'.toGraph E(G₁) ∪ Whitney.verts H'.toGraph E(G₂) = H'.V := by + refine subset_antisymm (union_subset + (fun _ ⟨_, _, _, hl⟩ => hl.left_mem) (fun _ ⟨_, _, _, hl⟩ => hl.left_mem)) ?_ + intro v hv + obtain ⟨g, hg, hc⟩ := exists_edge_of_regionFacts hS r.facts hv + have hinc : H'.toGraph.Inc g v := inc_of_mem_closure hg hc hv + have : g ∈ E(G₁) ∪ E(G₂) := hE ▸ hg + rcases this with hg₁ | hg₂ + · exact Or.inl ⟨g, hg₁, hinc⟩ + · exact Or.inr ⟨g, hg₂, hinc⟩ + have hB₁_eq : drawingEdgeSepB H' E(G₁) = drawingEdgeSepA H' E(G₂) := by + refine Hypergraph.ext ?_ ?_ ?_ + · change (H'.V \ Whitney.verts H'.toGraph E(G₁)) ∪ Whitney.verts H'.toGraph (H'.E \ E(G₁)) = + Whitney.verts H'.toGraph E(G₂) + rw [hE_diff₁] + refine union_eq_self_of_subset_left fun v ⟨hv, hnv₁⟩ => ?_ + rw [← hverts_union] at hv + exact hv.resolve_left hnv₁ + · change H'.E \ E(G₁) = E(G₂) ∩ H'.E + rw [hE_diff₁] + exact (inter_eq_self_of_subset_left hl₂.edgeSet_mono).symm + · funext g v + apply propext + change H'.toHypergraph.Inc g v ∧ g ∉ E(G₁) ↔ H'.toHypergraph.Inc g v ∧ g ∈ E(G₂) + exact ⟨fun ⟨hi, hn⟩ => ⟨hi, hE_diff₁ ▸ ⟨hi.1, hn⟩⟩, + fun ⟨hi, hg₂⟩ => ⟨hi, disjoint_right.mp hdis hg₂⟩⟩ + have hA₁_eq : drawingEdgeSepA H' E(G₁) = drawingEdgeSepB H' E(G₂) := by + refine Hypergraph.ext ?_ ?_ ?_ + · change Whitney.verts H'.toGraph E(G₁) = + (H'.V \ Whitney.verts H'.toGraph E(G₂)) ∪ Whitney.verts H'.toGraph (H'.E \ E(G₂)) + rw [hE_diff₂] + symm + refine union_eq_self_of_subset_left fun v ⟨hv, hnv₂⟩ => ?_ + rw [← hverts_union] at hv + exact hv.resolve_right hnv₂ + · change E(G₁) ∩ H'.E = H'.E \ E(G₂) + rw [hE_diff₂] + exact inter_eq_self_of_subset_left hl₁.edgeSet_mono + · funext g v + apply propext + change H'.toHypergraph.Inc g v ∧ g ∈ E(G₁) ↔ H'.toHypergraph.Inc g v ∧ g ∉ E(G₂) + exact ⟨fun ⟨hi, hg₁⟩ => ⟨hi, disjoint_left.mp hdis hg₁⟩, + fun ⟨hi, hn⟩ => ⟨hi, hE_diff₂ ▸ ⟨hi.1, hn⟩⟩⟩ + rw [hB₁_eq, hA₁_eq] at hmem₂ + exact thin_of_edge_tangle r hrig hS hnot_sphere h2cell' hT'.isPretangle hresp' hd' hT_eq + (by decide) hs hord hmem₂ + exact Whitney.good_sub hgood + +/-! ## 4. Disc Boundary Intersection and Eye Obstruction -/ + +/-- Part 6(iii) of the Section 10 translation: if `Λ₀` is a 39-zone around `z` with cleared tangle +`T'` of order `51` and `{a, b, c, d_v}` is a 4-element free set with respect to `T'`, then for any +closed disc `Δ ⊆ Σ` containing `{a, b, c, d_v}`, `4 ≤ ((subBd Δ \ Λ₀) ∩ H.U).encard`. -/ +theorem four_le_subBd_diff_zone_encard + (hS : IsClosedSurface S) (hnot_sphere : ¬ IsSphere S) + {H : Drawing S} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z Λ₀ : Set S} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d' : Set S → Set S → ℕ} + (hZone : IsLambdaZoneAround H d 39 z Λ₀) + (hCleared : IsClearedTangle H T d 209 39 Λ₀ T' d') + (hE' : (clearedSubdrawing H Λ₀).E.Nonempty) + {a b c d_v : S} + (hnodup : [a, b, c, d_v].Nodup) + (hfree : IsFreeSet (clearedSubdrawing H Λ₀).toHypergraph T' (209 - 158) {a, b, c, d_v}) + (Δ : Set S) (hΔ : IsClosedDisc Δ) + (habcd : ({a, b, c, d_v} : Set S) ⊆ Δ) : + 4 ≤ ((subBd Δ \ Λ₀) ∩ H.U).encard := by + set H' := clearedSubdrawing H Λ₀ + have hU' : H'.U = H.U \ Λ₀ := clearedSubdrawing_U hZone + have hcap_eq : (subBd Δ \ Λ₀) ∩ H.U = subBd Δ ∩ H'.U := by + rw [hU'] + ext x + simp only [mem_inter_iff, mem_sdiff] + tauto + rw [hcap_eq] + by_contra hlt4 + have hfin : (subBd Δ ∩ H'.U).Finite := by + by_contra hinf + rw [encard_eq_top_iff.mpr hinf] at hlt4 + exact hlt4 le_top + have hncard_lt : ¬ 4 ≤ (subBd Δ ∩ H'.U).ncard := by + intro h4 + apply hlt4 + rw [← hfin.cast_ncard_eq] + exact_mod_cast h4 + have hncard_le : (subBd Δ ∩ H'.U).ncard ≤ 3 := by omega + have hResp' : IsRespectfulDrawingTangle H' 51 T' := hCleared.hasMetric.1 + have : ConnectedSpace S := hResp'.1.1 + obtain ⟨A, B, hAB, hAV, hord_le, -⟩ := + disc_sep_mem_tangle hS hnot_sphere (by decide) hE' hResp' hΔ hfin hncard_le + have habcd_A : ({a, b, c, d_v} : Set S) ⊆ A.vertexSet := by + rw [hAV] + exact subset_inter hfree.1 habcd + have habcd_card : ({a, b, c, d_v} : Set S).ncard = 4 := by + classical + have h1 : ({a, b, c, d_v} : Set S) = ↑([a, b, c, d_v].toFinset) := by + ext x; simp + rw [h1, ncard_coe_finset, List.toFinset_card_of_nodup hnodup] + rfl + have hfree_le : ({a, b, c, d_v} : Set S).ncard ≤ separationOrder A B := + hfree.2.2 hAB habcd_A + omega + +/-- Part 6 of the Section 10 translation: if a 39-zone `Λ` is an eye of `H ∩ (Σ - Λ)` in `G` with +respect to the cleared tangle `T'` of order `51` and `H ∩ (Σ - Λ)` is rigid, then the eye +obstruction `(1.1)(iii)` holds. -/ +theorem eye_obstruction_of_drawingEye + {α : Type v} {β : Type w} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) (hnot_sphere : ¬ IsSphere S) + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (hH_subdiv : IsSubdivisionOfSimpleThreeConnected η.imageGraph) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (hMetric : HasTangleMetric H 209 T d) + (Λ : Set S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) + (η_cl : SpanEmbedding (clearedSubdrawing H Λ) G) + (hzone : IsLambdaZone H d 39 Λ) + (hrig : IsRigid (clearedSubdrawing H Λ)) + (hCleared : IsClearedTangle H T d 209 39 Λ T' d') + (hv_cl : ∀ v ∈ (clearedSubdrawing H Λ).V, η_cl.vMap v = η.vMap v) + (heye : IsDrawingEye G (clearedSubdrawing H Λ) η_cl (209 - 158) T' Λ) : + ∃ (C : Drawing S) (Λ₀ : Set S) (x : S) (a b c d_v : S) (P₁ P₂ : Graph α β), + C.IsCircuit ∧ C.IsSubdrawing H ∧ IsOpenDisc Λ₀ ∧ subBd Λ₀ = C.U ∧ x ∈ Λ₀ ∧ + a ∈ C.V ∧ b ∈ C.V ∧ c ∈ C.V ∧ d_v ∈ C.V ∧ + OccurInCircuitOrder C a b c d_v ∧ + IsSubdivisionOfSimpleThreeConnected (clearedSubdrawing H Λ₀).toGraph ∧ + (∀ y ∈ Λ₀, ∃ φ : C(Circle, S), + (range φ ∩ H.U).encard ≤ 39 ∧ x ∈ curveIns φ ∧ y ∈ curveIns φ) ∧ + (∀ Δ : Set S, IsClosedDisc Δ → ({a, b, c, d_v} : Set S) ⊆ Δ → + 4 ≤ ((subBd Δ \ Λ₀) ∩ H.U).encard) ∧ + Disjoint V(P₁) V(P₂) ∧ + IsGraphPathWithEnds G P₁ (η.vMap a) (η.vMap c) ∧ + IsGraphPathWithEnds G P₂ (η.vMap b) (η.vMap d_v) := by + have : ConnectedSpace S := hConn + obtain ⟨z, _, hZone⟩ := hzone + have hsub3 : IsSubdivisionOfSimpleThreeConnected (clearedSubdrawing H Λ).toGraph := + isSubdivisionOfSimpleThreeConnected_clearedSubdrawing_of_drawingEye + hS hConn hnot_sphere hH_subdiv hZone hrig hCleared heye + obtain ⟨hΛR, C, a, b, c, d_v, P₁, P₂, hC, hCs, hCU, ha, hb, hc, hd_v, hnodup, hord, hfree, + hdisj, hP₁, hP₂⟩ := heye + obtain ⟨e₀, he₀C⟩ := IsCircuit.E_nonempty hC + have hE' : (clearedSubdrawing H Λ).E.Nonempty := ⟨e₀, hCs.2 he₀C⟩ + have hCH : C.IsSubdrawing H := hCs.trans (clearedSubdrawing_isSubdrawing H Λ) + obtain ⟨x, hxΛ, hcurve⟩ := + exists_curve_le_of_mem_lambdaZone hS (by decide) hMetric hZone hC hCH hCU + refine ⟨C, Λ, x, a, b, c, d_v, P₁, P₂, hC, hCH, hZone.isOpenDisc, hCU.symm, hxΛ, + ha, hb, hc, hd_v, hord, hsub3, hcurve, ?_, hdisj, ?_, ?_⟩ + · exact four_le_subBd_diff_zone_encard hS hnot_sphere hZone hCleared hE' hnodup hfree + · rw [← hv_cl a (hCs.1 ha), ← hv_cl c (hCs.1 hc)] + exact hP₁.2.1 + · rw [← hv_cl b (hCs.1 hb), ← hv_cl d_v (hCs.1 hd_v)] + exact hP₂.2.1 + +/-- Complete proof of `Theorem11TranslationStatement` combining Parts 1–4 +(`isRigid_and_isTwoCell_of_subdivision_and_representative`), Part 5 +(`not_exists_curve_of_dist_ge_twelve`), Part 6 (`eye_obstruction_of_drawingEye`), and Part 7 +(`exists_extending_drawing_of_threeSegregation`). -/ +theorem theorem11TranslationStatement_proved : Theorem11TranslationStatement.{u, v, w} := by + intro S _ _ α β hS hConn hnot_sphere G H η hV_fin hE_fin hG_4conn hH_subdiv hrep + have : ConnectedSpace S := hConn + obtain ⟨T, d, h2cell, hrigid, hT, hmetric⟩ := + isRigid_and_isTwoCell_of_subdivision_and_representative hS hnot_sphere η hH_subdiv hrep + refine ⟨T, d, h2cell, hrigid, hT, hmetric, ?_, ?_, ?_⟩ + · intro P u v hu hv hP hgt + obtain ⟨G₀, Q, hsd⟩ := exists_subData (isSubdivision_toGraph_of_spanEmbedding η hH_subdiv) + obtain ⟨e₀, he₀, -⟩ := SubDataSepGeneral.exists_inc_of_mem_V hsd hu + have hE : H.E.Nonempty := ⟨e₀, he₀⟩ + exact ⟨P, u, v, hu, hv, hP, + not_exists_curve_of_dist_ge_twelve hS hnot_sphere (by decide) hE hmetric hu hv hgt⟩ + · intro Λ T' d' η_cl hzone hrig_cl hCleared hv_cl heye + exact eye_obstruction_of_drawingEye hS hConn hnot_sphere G H η hH_subdiv T d hmetric + Λ T' d' η_cl hzone hrig_cl hCleared hv_cl heye + · rintro ⟨S_seg, α_disc, α_pt, hSeg3, hLocal, hArr, hCompat⟩ + exact exists_extending_drawing_of_threeSegregation hS hnot_sphere + hG_4conn hrigid hT hSeg3 hLocal hArr hCompat + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section3.lean b/LeanPool/GraphMinor/GM14/Section3.lean new file mode 100644 index 0000000000..3507bf2dd7 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section3.lean @@ -0,0 +1,483 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Cited +import LeanPool.GraphMinor.GM10.Section12 +import LeanPool.GraphMinor.GM11.Section4c +import LeanPool.GraphMinor.GM12.Section1 + +/-! +# Graph Minors XIV, Section 3: tangles, zones, and clearing + +This file formalizes Section 3 of N. Robertson and P. D. Seymour, +*Graph Minors. XIV. Extending an embedding*, J. Combin. Theory Ser. B **65** (1995) 23–50 +(pages 27–29): + +- `theorem_3_1`: Graph Minors XIV, (3.1) (page 28), showing that for a closed walk `W` of a radial + drawing `K` of `H` with length `< 2θ` and an atom `x ∈ A(H)` with corresponding atom `x'` of `K`, + `x' ⊆ ins(W)` if and only if `x ∩ ins(W) ≠ ∅`. +- `clearedSubdrawing_isTwoCell`: for a `λ`-zone `Λ` around `z` in a 2-cell drawing `H`, the cleared + subdrawing `H' = H ∩ (Σ - Λ)` has `Λ` as a region and every other region of `H'` is a region of + `H`, so `H'` is a 2-cell subdrawing of `H`. +- `theorem_3_2`: Graph Minors XIV, (3.2) (page 28), existence and uniqueness of a tangle of order + `θ - 4λ - 2` obtained by clearing a `λ`-zone `Λ`, proved from Graph Minors XII, (7.10) + (`GM12Theorem710Statement`), in `Section3Proved.lean`. +- `freeSet_subset`: any subset of a free set is free (Graph Minors X, (12.2), cited on page 28). +-/ + +public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +/-! ## Proof of (3.1) -/ + +omit [T1Space S] in +/-- A preconnected set that meets a closed set `D` and misses its frontier lies in `D`. -/ +theorem subset_of_disjoint_frontier {A D : Set S} (hA : IsPreconnected A) (hD : IsClosed D) + (hdis : Disjoint A (frontier D)) {x : S} (hx : x ∈ A) (hxD : x ∈ D) : A ⊆ D := + GM12.subset_of_disjoint_frontier hA hD hdis hx hxD + +/-- Graph Minors XIV, (3.1) (page 28): +"If $W$ is a closed walk of $K$ with length $<2\theta$ (so that $ins(W)$ is defined), and $x +\in A(H)$, and $x'$ is the corresponding atom of $K$, then $x' \subseteq ins(W)$ if and only +if $x \cap ins(W) \ne \emptyset$." -/ +theorem theorem_3_1_proof {H K : Drawing S} (hS : IsClosedSurface S) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) {x x' : Set S} + (hx : IsCorrespondingAtom H K x x') {u : S} (W : GraphWalk K.toGraph u u) + (hl : W.length < 2 * θ) : + x' ⊆ insWalk ins K W ↔ (x ∩ insWalk ins K W).Nonempty := + GM12.corresponding_atom_subset_iff hS hK hd hx W hl + +omit [T1Space S] in +/-- An `O`-arc in a Hausdorff space is closed. -/ +theorem IsOArc.isClosed [T2Space S] {F : Set S} (hF : IsOArc F) : IsClosed F := by + obtain ⟨φ⟩ := hF + have : CompactSpace F := φ.compactSpace + exact (isCompact_iff_compactSpace.mpr this).isClosed + +omit [T1Space S] in +private theorem exists_circle_arc_in_edge [T2Space S] {H : Drawing S} {F e : Set S} + (φ : Circle ≃ₜ F) (hFU : F ⊆ H.U) (he : e ∈ H.E) + {p : S} (hpF : p ∈ F) (hpe : p ∈ e) : + ∃ (g : ℝ → S) (ε : ℝ), Continuous g ∧ g 0 = p ∧ 0 < ε ∧ + (∀ t ∈ Icc (-ε) ε, g t ∈ e) ∧ InjOn g (Icc (-ε) ε) ∧ range g ⊆ F := by + let z₀ : Circle := φ.symm ⟨p, hpF⟩ + let g : ℝ → S := fun θ => (φ (z₀ * Circle.exp θ)).1 + have hg : Continuous g := by fun_prop + have hg0 : g 0 = p := by simp [g, z₀] + have hge : IsOpen {θ : ℝ | g θ ∈ e} := by + have hEq : {θ : ℝ | g θ ∈ e} = g ⁻¹' (H.U \ e)ᶜ := by + ext θ + simp only [mem_ofPred_eq, mem_preimage, mem_compl_iff, mem_sdiff, not_and, not_not] + exact ⟨fun h _ => h, fun h => h (hFU (φ _).2)⟩ + rw [hEq] + exact (isClosed_U_sdiff_edge H he).isOpen_compl.preimage hg + have hg0e : (0 : ℝ) ∈ {θ : ℝ | g θ ∈ e} := by + change g 0 ∈ e + rwa [hg0] + obtain ⟨δ₀, hδ₀, hball⟩ := Metric.isOpen_iff.mp hge 0 hg0e + have hpi := Real.pi_pos + let ε : ℝ := min (δ₀ / 2) (Real.pi / 2) + have hε : 0 < ε := lt_min (half_pos hδ₀) (half_pos hpi) + have hεpi : ε ≤ Real.pi / 2 := min_le_right _ _ + let J : Set ℝ := Icc (-ε) ε + have hJe : ∀ x ∈ J, g x ∈ e := by + intro x hx + refine hball ?_ + rw [Metric.mem_ball, Real.dist_0_eq_abs, abs_lt] + have hlt : ε < δ₀ := lt_of_le_of_lt (min_le_left _ _) (half_lt_self hδ₀) + exact ⟨by linarith [hx.1], by linarith [hx.2]⟩ + have hginj : InjOn g J := by + intro x hx y hy hxy + have h₁ : z₀ * Circle.exp x = z₀ * Circle.exp y := φ.injective (Subtype.ext hxy) + have h₂ : Circle.exp x = Circle.exp y := mul_left_cancel h₁ + have hb : ε - (-ε) < 2 * Real.pi := by linarith + exact Circle.exp_injOn_Icc hb hx hy h₂ + exact ⟨g, ε, hg, hg0, hε, hJe, hginj, by rintro _ ⟨t, rfl⟩; exact (φ _).2⟩ + +omit [T1Space S] in +/-- For an `O`-arc `F ⊆ U(H)` and an edge `e ∈ E(H)`, either `e ⊆ F` or `e` is disjoint from `F`. +Every point of `e ∩ F` has a small arc of `F` around it inside `e`, whose preimage in the open +unit interval is open by the intermediate value theorem; since `e` is connected and `F` is closed, +`e ∩ F` is clopen in `e`. -/ +theorem edge_subset_or_disjoint_of_isOArc [T2Space S] {H : Drawing S} {F e : Set S} + (hF : IsOArc F) (hFU : F ⊆ H.U) (he : e ∈ H.E) : e ⊆ F ∨ Disjoint e F := by + by_cases hdis : Disjoint e F + · exact Or.inr hdis + refine Or.inl ?_ + by_contra hnot + obtain ⟨p, hpe, hpF⟩ := not_disjoint_iff.mp hdis + obtain ⟨q, hqe, hqF⟩ := not_subset.mp hnot + obtain ⟨γ, hγ, hγ0, hγ1, hinj, hγe⟩ := exists_edge_param H he + have hFcl : IsClosed F := IsOArc.isClosed hF + obtain ⟨φ⟩ := hF + -- `γ ⁻¹' F` is closed in `unitInterval`, and we show `Ioo 0 1 ∩ γ ⁻¹' F` is open in `Ioo 0 1`. + let T : Set unitInterval := {t ∈ Ioo (0 : unitInterval) 1 | γ t ∈ F} + have hTopen : ∃ U : Set unitInterval, IsOpen U ∧ T = Ioo (0 : unitInterval) 1 ∩ U := by + have hstep : ∀ t₀ ∈ T, ∃ U : Set unitInterval, IsOpen U ∧ t₀ ∈ U ∧ + Ioo (0 : unitInterval) 1 ∩ U ⊆ T := by + rintro t₀ ⟨ht₀, ht₀F⟩ + have ht₀e : γ t₀ ∈ e := by rw [← hγe]; exact mem_image_of_mem γ ht₀ + obtain ⟨g, ε, hg, hg0, hε, hJe, hginj, hgF⟩ := exists_circle_arc_in_edge φ hFU he ht₀F ht₀e + let J : Set ℝ := Icc (-ε) ε + -- Pull `g '' J` back along `γ` to `Ioo 0 1`. + let Y : Set S := g '' J + have hYcpt : IsCompact Y := isCompact_Icc.image hg + let K : Set unitInterval := γ ⁻¹' Y + have hKcpt : IsCompact K := (hYcpt.isClosed.preimage hγ).isCompact + have : CompactSpace K := isCompact_iff_compactSpace.mp hKcpt + have hKIoo : K ⊆ Ioo 0 1 := by + intro t ⟨x, hxJ, hxt⟩ + have hte : γ t ∈ e := hxt ▸ hJe x hxJ + refine ⟨unitInterval.pos_iff_ne_zero.mpr ?_, unitInterval.lt_one_iff_ne_one.mpr ?_⟩ + · rintro rfl; exact (he.2.1 hte).2 hγ0 + · rintro rfl; exact (he.2.1 hte).2 hγ1 + let γK : K → S := fun t => γ t.1 + have hγK : Continuous γK := hγ.comp continuous_subtype_val + have hγKinj : Function.Injective γK := fun s t h => + Subtype.ext (hinj (hKIoo s.2) (hKIoo t.2) h) + have hγKemb : IsClosedEmbedding γK := hγK.isClosedEmbedding hγKinj + have hch : ∀ x : J, ∃ t : K, γK t = g x.1 := by + intro x + have hmem : g x.1 ∈ e := hJe x.1 x.2 + rw [← hγe] at hmem + obtain ⟨t, ht, htx⟩ := hmem + exact ⟨⟨t, ⟨x.1, x.2, htx.symm⟩⟩, htx⟩ + choose τ hτ using hch + have hτc : Continuous τ := by + refine hγKemb.isInducing.continuous_iff.mpr ?_ + have : γK ∘ τ = fun x : J => g x.1 := funext hτ + rw [this] + exact hg.comp continuous_subtype_val + let τR : J → ℝ := fun x => (τ x).1.1 + have hτRc : Continuous τR := + continuous_subtype_val.comp (continuous_subtype_val.comp hτc) + have hτRinj : Function.Injective τR := by + intro x y hxy + have h₁ : τ x = τ y := Subtype.ext (Subtype.ext hxy) + have h₂ : g x.1 = g y.1 := by rw [← hτ, ← hτ, h₁] + exact Subtype.ext (hginj x.2 y.2 h₂) + let xL : J := ⟨-ε, by simp [J, hε.le]⟩ + let xM : J := ⟨0, by simp [J, hε.le]⟩ + let xR : J := ⟨ε, by simp [J, hε.le]⟩ + have hτM : (τ xM).1 = t₀ := by + apply hinj (hKIoo (τ xM).2) ht₀ + change γK (τ xM) = γ t₀ + rw [hτ xM] + exact hg0 + have hτMR : τR xM = (t₀ : ℝ) := congrArg Subtype.val hτM + -- By IVT on `[-ε, 0]` and `[0, ε]`, `τR xM` lies strictly between `τR xL` and `τR xR`. + let JL : Set J := {x : J | x.1 ≤ 0} + let JR : Set J := {x : J | 0 ≤ x.1} + have hJL : IsPreconnected JL := by + have hEq : JL = Subtype.val ⁻¹' Icc (-ε) 0 := by + ext x; simp [JL, x.2.1] + rw [hEq] + refine (IsInducing.subtypeVal : IsInducing (Subtype.val : J → ℝ)).isPreconnected_image.mp ?_ + rw [Subtype.image_preimage_coe, inter_eq_right.mpr (Icc_subset_Icc_right hε.le)] + exact isPreconnected_Icc + have hJR : IsPreconnected JR := by + have hEq : JR = Subtype.val ⁻¹' Icc 0 ε := by + ext x; simp [JR, x.2.2] + rw [hEq] + refine (IsInducing.subtypeVal : IsInducing (Subtype.val : J → ℝ)).isPreconnected_image.mp ?_ + rw [Subtype.image_preimage_coe, inter_eq_right.mpr (Icc_subset_Icc_left (by linarith))] + exact isPreconnected_Icc + have hivL : Icc (min (τR xL) (τR xM)) (max (τR xL) (τR xM)) ⊆ τR '' JL := by + rcases le_total (τR xL) (τR xM) with h | h + · rw [min_eq_left h, max_eq_right h] + exact hJL.intermediate_value (by simp [JL, xL, hε.le]) (by simp [JL, + xM]) hτRc.continuousOn + · rw [min_eq_right h, max_eq_left h] + exact hJL.intermediate_value (by simp [JL, xM]) (by simp [JL, xL, + hε.le]) hτRc.continuousOn + have hivR : Icc (min (τR xM) (τR xR)) (max (τR xM) (τR xR)) ⊆ τR '' JR := by + rcases le_total (τR xM) (τR xR) with h | h + · rw [min_eq_left h, max_eq_right h] + exact hJR.intermediate_value (by simp [JR, xM]) (by simp [JR, xR, + hε.le]) hτRc.continuousOn + · rw [min_eq_right h, max_eq_left h] + exact hJR.intermediate_value (by simp [JR, xR, hε.le]) (by simp [JR, + xM]) hτRc.continuousOn + have hbetween : (τR xL < τR xM ∧ τR xM < τR xR) ∨ (τR xR < τR xM ∧ τR xM < τR xL) := by + let f := τR ∘ Set.projIcc (-ε) ε (by linarith : -ε ≤ ε) + have hfc : Continuous f := hτRc.comp continuous_projIcc + have hfi : InjOn f J := by + intro x hx y hy hxy + change τR (Set.projIcc _ _ _ x) = τR (Set.projIcc _ _ _ y) at hxy + have h := congrArg Subtype.val (hτRinj hxy) + simpa only [Set.projIcc_of_mem _ hx, Set.projIcc_of_mem _ hy] using h + have hval (x : J) : f x = τR x := by + change τR (Set.projIcc _ _ _ (x : ℝ)) = τR x + rw [Set.projIcc_val] + have hLM : (xL : ℝ) < xM := by change -ε < 0; linarith + have hMR : (xM : ℝ) < xR := hε + rcases hfc.continuousOn.strictMonoOn_of_injOn_Icc' (by linarith : -ε ≤ ε) hfi with h | h + · left + simpa only [hval] using And.intro + (h xL.2 xM.2 hLM) (h xM.2 xR.2 hMR) + · right + simpa only [hval] using And.intro + (h xM.2 xR.2 hMR) (h xL.2 xM.2 hLM) + let aR : ℝ := min (τR xL) (τR xR) + let bR : ℝ := max (τR xL) (τR xR) + refine ⟨Subtype.val ⁻¹' Ioo aR bR, isOpen_Ioo.preimage continuous_subtype_val, ?_, ?_⟩ + · change aR < (t₀ : ℝ) ∧ (t₀ : ℝ) < bR + rw [← hτMR] + rcases hbetween with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact ⟨lt_of_le_of_lt (min_le_left _ _) h₁, lt_of_lt_of_le h₂ (le_max_right _ _)⟩ + · exact ⟨lt_of_le_of_lt (min_le_right _ _) h₁, lt_of_lt_of_le h₂ (le_max_left _ _)⟩ + · rintro t ⟨htI, hta, htb⟩ + have hta' : min (τR xL) (τR xR) < (t : ℝ) := hta + have htb' : (t : ℝ) < max (τR xL) (τR xR) := htb + refine ⟨htI, ?_⟩ + have hcov : (t : ℝ) ∈ τR '' JL ∪ τR '' JR := by + rcases le_total (t : ℝ) (τR xM) with hle | hle + · rcases hbetween with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · refine Or.inl (hivL ⟨?_, ?_⟩) + · rw [min_eq_left h₁.le] + rw [min_eq_left (h₁.trans h₂).le] at hta' + exact hta'.le + · rw [max_eq_right h₁.le] + exact hle + · refine Or.inr (hivR ⟨?_, ?_⟩) + · rw [min_eq_right h₁.le] + rw [min_eq_right (h₁.trans h₂).le] at hta' + exact hta'.le + · rw [max_eq_left h₁.le] + exact hle + · rcases hbetween with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · refine Or.inr (hivR ⟨?_, ?_⟩) + · rw [min_eq_left h₂.le] + exact hle + · rw [max_eq_right h₂.le] + rw [max_eq_right (h₁.trans h₂).le] at htb' + exact htb'.le + · refine Or.inl (hivL ⟨?_, ?_⟩) + · rw [min_eq_right h₂.le] + exact hle + · rw [max_eq_left h₂.le] + rw [max_eq_left (h₁.trans h₂).le] at htb' + exact htb'.le + have hmem : ∃ x : J, τR x = (t : ℝ) := by + rcases hcov with ⟨x, -, hx⟩ | ⟨x, -, hx⟩ <;> exact ⟨x, hx⟩ + obtain ⟨x, hx⟩ := hmem + have htx : t = (τ x).1 := Subtype.ext hx.symm + rw [htx] + change γK (τ x) ∈ F + rw [hτ x] + exact hgF (mem_range_self _) + choose! U hUo htU hUs using hstep + refine ⟨⋃ t ∈ T, U t, isOpen_biUnion fun t ht => hUo t ht, ?_⟩ + ext t + constructor + · intro ht + exact ⟨ht.1, mem_iUnion₂.mpr ⟨t, ht, htU t ht⟩⟩ + · rintro ⟨htI, htU'⟩ + obtain ⟨s, hs, hts⟩ := mem_iUnion₂.mp htU' + exact hUs s hs ⟨htI, hts⟩ + obtain ⟨U, hUo, hTU⟩ := hTopen + have hcov : Ioo (0 : unitInterval) 1 ⊆ U ∪ (γ ⁻¹' F)ᶜ := by + intro t ht + by_cases htF : γ t ∈ F + · have htT : t ∈ T := ⟨ht, htF⟩ + rw [hTU] at htT + exact Or.inl htT.2 + · exact Or.inr htF + obtain ⟨t₁, ht₁, rfl⟩ : p ∈ γ '' Ioo 0 1 := by rwa [hγe] + obtain ⟨t₂, ht₂, rfl⟩ : q ∈ γ '' Ioo 0 1 := by rwa [hγe] + have ht₁U : t₁ ∈ U := by + have : t₁ ∈ T := ⟨ht₁, hpF⟩ + rw [hTU] at this + exact this.2 + obtain ⟨t, htI, htU, htF⟩ := isPreconnected_Ioo U (γ ⁻¹' F)ᶜ hUo + (hFcl.preimage hγ).isOpen_compl hcov ⟨t₁, ht₁, ht₁U⟩ ⟨t₂, ht₂, hqF⟩ + have htT : t ∈ T := by rw [hTU]; exact ⟨htI, htU⟩ + exact htF htT.2 + +omit [T1Space S] in +/-- For an open set `Λ ⊆ Σ`, `Λ` is disjoint from `subBd Λ`, and `closure Λ = Λ ∪ subBd Λ`. -/ +theorem isOpen_disjoint_subBd_and_closure_eq {Λ : Set S} (hΛ : IsOpen Λ) : + Disjoint Λ (subBd Λ) ∧ closure Λ = Λ ∪ subBd Λ := by + have hdis : Disjoint Λ (subBd Λ) := by + refine disjoint_left.mpr fun x hx ⟨_, hxout⟩ => ?_ + obtain ⟨y, hyΛ, hyn⟩ := mem_closure_iff.mp hxout Λ hΛ hx + exact hyn.2 hyΛ + refine ⟨hdis, subset_antisymm ?_ (union_subset subset_closure fun _ h => h.1)⟩ + intro x hx + by_cases hxΛ : x ∈ Λ + · exact Or.inl hxΛ + · exact Or.inr ⟨hx, subset_closure ⟨mem_univ _, hxΛ⟩⟩ + +omit [T1Space S] in +/-- Every edge of `H` either lies in `Λ` or lies in `Σ - Λ`, when `Λ` is a `λ`-zone around `z`. -/ +theorem edge_subset_or_subset_compl_of_zone [T2Space S] {H : Drawing S} + {d : Set S → Set S → ℕ} {lam : ℕ} {z Λ e : Set S} + (hZone : IsLambdaZoneAround H d lam z Λ) (he : e ∈ H.E) : + e ⊆ Λ ∨ e ⊆ univ \ Λ := by + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hZone.isOpenDisc.1 + rcases edge_subset_or_disjoint_of_isOArc hZone.isOArc_bd hZone.bd_subset_U he with hsub | hdis + · exact Or.inr fun x hx => ⟨mem_univ _, fun hxΛ => disjoint_left.mp hdisL hxΛ (hsub hx)⟩ + · have hcov : e ⊆ Λ ∪ (closure Λ)ᶜ := by + intro x hx + by_cases hxcl : x ∈ closure Λ + · rw [hclL] at hxcl + exact Or.inl (hxcl.resolve_right (disjoint_left.mp hdis hx)) + · exact Or.inr hxcl + have hdisO : Disjoint Λ (closure Λ)ᶜ := + disjoint_left.mpr fun x hx hxc => hxc (subset_closure hx) + by_cases hmeet : (e ∩ Λ).Nonempty + · obtain ⟨x, hxe, hxΛ⟩ := hmeet + exact Or.inl ((he.2.2.1.isConnected.isPreconnected).subset_left_of_subset_union + hZone.isOpenDisc.1 isClosed_closure.isOpen_compl hdisO hcov ⟨x, hxe, hxΛ⟩) + · refine Or.inr fun x hxe => ⟨mem_univ _, fun hxΛ => hmeet ⟨x, hxe, hxΛ⟩⟩ + +/-- `clearedSubdrawing H Λ` is a subdrawing of `H`. -/ +theorem clearedSubdrawing_isSubdrawing (H : Drawing S) (Λ : Set S) : + (clearedSubdrawing H Λ).IsSubdrawing H := + Drawing.span_isSubdrawing H _ _ + +/-- For a `λ`-zone `Λ` around `z`, the point set of `H' = H ∩ (Σ - Λ)` is `U(H) \ Λ`. -/ +theorem clearedSubdrawing_U [T2Space S] {H : Drawing S} + {d : Set S → Set S → ℕ} {lam : ℕ} {z Λ : Set S} + (hZone : IsLambdaZoneAround H d lam z Λ) : + (clearedSubdrawing H Λ).U = H.U \ Λ := by + have hcl_compl : IsClosed (univ \ Λ) := by + rw [← compl_eq_univ_sdiff] + exact hZone.isOpenDisc.1.isClosed_compl + have hE : (clearedSubdrawing H Λ).E = {e | e ∈ H.E ∧ e ⊆ univ \ Λ} := by + change (H.span _ _).E = _ + rw [H.span_E] + ext e + simp only [mem_inter_iff, mem_ofPred_eq] + tauto + apply subset_antisymm + · rw [(clearedSubdrawing H Λ).U_eq] + refine union_subset ?_ (iUnion₂_subset fun e he => ?_) + · rintro x (⟨hx, hxV⟩ | hx) + · exact ⟨H.V_subset_U hxV, hx.2.2⟩ + · obtain ⟨e, he', hxe, hxV⟩ := mem_iUnion₂.mp hx + exact ⟨H.V_subset_U hxV, (hcl_compl.closure_subset_iff.mpr he'.1.2 hxe).2⟩ + · rw [hE] at he + exact fun x hx => ⟨H.closure_subset_U he.1 hx, + (hcl_compl.closure_subset_iff.mpr he.2 hx).2⟩ + · rintro x ⟨hxU, hxΛ⟩ + by_cases hxV : x ∈ H.V + · refine (clearedSubdrawing H Λ).V_subset_U ?_ + exact Or.inl ⟨⟨hxV, mem_univ _, hxΛ⟩, hxV⟩ + · obtain ⟨e, he, hxe⟩ := H.exists_edge_of_mem hxU hxV + rcases edge_subset_or_subset_compl_of_zone hZone he with heΛ | hec + · exact absurd (heΛ hxe) hxΛ + · have he' : e ∈ (clearedSubdrawing H Λ).E := by + rw [hE] + exact ⟨he, hec⟩ + exact (clearedSubdrawing H Λ).closure_subset_U he' (subset_closure hxe) + +/-- Graph Minors XIV, Section 3 (page 28): +"Let $\Lambda$ be a $\lambda$-zone around $z$ and let $H' = H \cap (\Sigma - \Lambda)$. Since +$H \cap bd(\Lambda)$ is a circuit it follows that $\Lambda$ is a region of $H'$, and every +other region of $H'$ is a region of $H$. Consequently $H'$ is a 2-cell drawing in $\Sigma$." -/ +theorem clearedSubdrawing_region_eq_or_mem_R [T2Space S] {H : Drawing S} + {d : Set S → Set S → ℕ} {lam : ℕ} {z Λ : Set S} + (hZone : IsLambdaZoneAround H d lam z Λ) {r' : Set S} + (hr' : r' ∈ (clearedSubdrawing H Λ).R) : + r' = Λ ∨ r' ∈ H.R := by + have hU := clearedSubdrawing_U hZone + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hZone.isOpenDisc.1 + have hbdU' : subBd Λ ⊆ (clearedSubdrawing H Λ).U := by + rw [hU] + exact fun x hx => ⟨hZone.bd_subset_U hx, disjoint_right.mp hdisL hx⟩ + let O₂ : Set S := univ \ (H.U ∪ closure Λ) + have hO₂ : IsOpen O₂ := isOpen_univ.sdiff (H.isClosed_U.union isClosed_closure) + have hdisO : Disjoint Λ O₂ := + disjoint_left.mpr fun x hx hxO => hxO.2 (Or.inr (subset_closure hx)) + have hcompl : univ \ (clearedSubdrawing H Λ).U = Λ ∪ O₂ := by + rw [hU] + ext x + constructor + · rintro ⟨_, hx⟩ + by_cases hxΛ : x ∈ Λ + · exact Or.inl hxΛ + · refine Or.inr ⟨mem_univ _, ?_⟩ + rintro (hxU | hxcl) + · exact hx ⟨hxU, hxΛ⟩ + · rw [hclL] at hxcl + exact hx ⟨hZone.bd_subset_U (hxcl.resolve_left hxΛ), hxΛ⟩ + · rintro (hxΛ | ⟨_, hx⟩) + · exact ⟨mem_univ _, fun h => h.2 hxΛ⟩ + · exact ⟨mem_univ _, fun h => hx (Or.inl h.1)⟩ + obtain ⟨x, hxU', rfl⟩ := (mem_R_iff (clearedSubdrawing H Λ)).mp hr' + have hx_mem : x ∈ univ \ (clearedSubdrawing H Λ).U := ⟨mem_univ _, hxU'⟩ + have hcov' : connectedComponentIn (univ \ (clearedSubdrawing H Λ).U) x ⊆ Λ ∪ O₂ := by + rw [← hcompl] + exact connectedComponentIn_subset _ _ + rcases hcompl ▸ hx_mem with hxΛ | hxO₂ + · refine Or.inl (subset_antisymm ?_ ?_) + · exact isPreconnected_connectedComponentIn.subset_left_of_subset_union + hZone.isOpenDisc.1 hO₂ hdisO hcov' ⟨x, mem_connectedComponentIn hx_mem, hxΛ⟩ + · refine hZone.isOpenDisc.isPathConnected.isConnected.isPreconnected.subset_connectedComponentIn + hxΛ ?_ + rw [hcompl] + exact subset_union_left + · refine Or.inr ?_ + have hxHU : x ∉ H.U := fun h => hxO₂.2 (Or.inl h) + refine (mem_R_iff H).mpr ⟨x, hxHU, subset_antisymm ?_ ?_⟩ + · have hsubO₂ : connectedComponentIn (univ \ (clearedSubdrawing H Λ).U) x ⊆ O₂ := + isPreconnected_connectedComponentIn.subset_right_of_subset_union + hZone.isOpenDisc.1 hO₂ hdisO hcov' ⟨x, mem_connectedComponentIn hx_mem, hxO₂⟩ + refine isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn hx_mem) ?_ + exact hsubO₂.trans fun y hy => ⟨mem_univ _, fun h => hy.2 (Or.inl h)⟩ + · have hrH : connectedComponentIn (univ \ H.U) x ∈ H.R := + (mem_R_iff H).mpr ⟨x, hxHU, rfl⟩ + have hcovH : connectedComponentIn (univ \ H.U) x ⊆ Λ ∪ O₂ := by + intro y hy + have hyU : y ∉ H.U := (connectedComponentIn_subset _ _ hy).2 + by_cases hycl : y ∈ closure Λ + · rw [hclL] at hycl + exact Or.inl (hycl.resolve_right fun hbd => hyU (hZone.bd_subset_U hbd)) + · exact Or.inr ⟨mem_univ _, fun h => h.elim hyU hycl⟩ + have hsubO₂ : connectedComponentIn (univ \ H.U) x ⊆ O₂ := + isPreconnected_connectedComponentIn.subset_right_of_subset_union + hZone.isOpenDisc.1 hO₂ hdisO hcovH + ⟨x, mem_connectedComponentIn ⟨mem_univ _, hxHU⟩, hxO₂⟩ + refine isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn ⟨mem_univ _, hxHU⟩) ?_ + rw [hcompl] + exact hsubO₂.trans subset_union_right + +/-- If `H` is a 2-cell drawing and `Λ` is a `λ`-zone around `z`, then `H ∩ (Σ - Λ)` is a 2-cell +drawing in `Σ` (Graph Minors XIV, Section 3, page 28). -/ +theorem clearedSubdrawing_isTwoCell [T2Space S] {H : Drawing S} + {d : Set S → Set S → ℕ} {lam : ℕ} {z Λ : Set S} + (h2cell : (PaintingOrDrawing.drawing H).IsTwoCell) + (hZone : IsLambdaZoneAround H d lam z Λ) : + (PaintingOrDrawing.drawing (clearedSubdrawing H Λ)).IsTwoCell := by + refine ⟨h2cell.1, fun r' hr' => ?_⟩ + rcases clearedSubdrawing_region_eq_or_mem_R hZone hr' with rfl | hr'H + · exact hZone.isOpenDisc + · exact h2cell.2 r' hr'H + +/-- Graph Minors XIV, Section 3 (page 28): +"It is easy to see and was shown in [4, theorem (12.2)] that any subset of a free set is free." -/ +theorem freeSet_subset {α β : Type*} {G : Hypergraph α β} + {T : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} {X X' : Set α} + (hT : IsTangle G θ T) (hX : IsFreeSet G T θ X) (hsub : X' ⊆ X) : IsFreeSet G T θ X' := + hX.subset hT hsub + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section3Proved.lean b/LeanPool/GraphMinor/GM14/Section3Proved.lean new file mode 100644 index 0000000000..f3a5731848 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section3Proved.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.GM12.Section710 + +/-! +# Graph Minors XIV, (3.2) + +Apply the proved XII (7.10) to the subdrawing obtained by clearing the zone. +The preliminary clearing lemmas stay in Section3, since XII uses them too. +-/ + +public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +/-- Graph Minors XIV, (3.2) (page 28): +"If $\theta \ge 4\lambda + 3$ then there is a unique tangle of order $\theta - 4\lambda - 2$ +obtained by clearing $\Lambda$." +Follows from Graph Minors XII, (7.10) (`GM12Theorem710Statement`). -/ +theorem theorem_3_2_of_710 + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H : Drawing S} {θ lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z Λ : Set S} + (hθ : 4 * lam + 3 ≤ θ) + (hMetric : HasTangleMetric H θ T d) + (hZone : IsLambdaZoneAround H d lam z Λ) : + ∃ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (d' : Set S → Set S → ℕ), + IsClearedTangle H T d θ lam Λ T' d' ∧ + ∀ (T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (d'' : Set S → Set S → ℕ), + IsClearedTangle H T d θ lam Λ T'' d'' → T'' = T' := by + have : T2Space S := hS.2.1 + have hSub : (clearedSubdrawing H Λ).IsSubdrawing H := clearedSubdrawing_isSubdrawing H Λ + have h2cell' : (PaintingOrDrawing.drawing (clearedSubdrawing H Λ)).IsTwoCell := + clearedSubdrawing_isTwoCell hMetric.1.1 hZone + have hEdist : ∀ e ∈ H.E \ (clearedSubdrawing H Λ).E, d z e ≤ lam := by + rintro e ⟨heH, henot⟩ + rcases edge_subset_or_subset_compl_of_zone hZone heH with heΛ | hec + · exact hZone.dist_le e (Or.inl (Or.inr heH)) (heΛ.trans subset_closure) + · exfalso + apply henot + change e ∈ (H.span _ _).E + rw [H.span_E] + exact ⟨⟨heH, hec⟩, heH⟩ + have hEdge2 : z ∈ H.E \ (clearedSubdrawing H Λ).E → 2 ≤ lam := + fun hz => hZone.two_le_of_edge hz.1 + obtain ⟨T', d', ⟨hM', hMem', hDist'⟩, hUniq⟩ := + GraphMinor.GM12.gm14_theorem_7_10.{u} S hS hConn H (clearedSubdrawing H Λ) θ lam T d z + hθ hMetric hZone.z_mem hSub h2cell' hEdist hEdge2 + refine ⟨T', d', ⟨hM', hMem', hDist'⟩, fun T'' d'' hC'' => ?_⟩ + exact hUniq T'' d'' hC''.hasMetric fun a ha b hb a' ha' b' hb' haa' hbb' => + (hC''.dist_bounds a ha b hb a' ha' b' hb' haa' hbb').1 + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section3b.lean b/LeanPool/GraphMinor/GM14/Section3b.lean new file mode 100644 index 0000000000..564196efb8 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section3b.lean @@ -0,0 +1,48 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.GM14.Section3Proved + +/-! +# Graph Minors XIV, (3.2): Unconditional Clearing Theorem + +This file proves **Graph Minors XIV, (3.2)** (`theorem_3_2`, page 28) unconditionally from +the closed clearing proof `theorem_3_2_of_710`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +/-- Graph Minors XIV, (3.2) (page 28): +"If $\theta \ge 4\lambda + 3$ then there is a unique tangle of order $\theta - 4\lambda - 2$ +obtained by clearing $\Lambda$." -/ +theorem theorem_3_2_proof + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H : Drawing S} {θ lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z Λ : Set S} + (hθ : 4 * lam + 3 ≤ θ) + (hMetric : HasTangleMetric H θ T d) + (hZone : IsLambdaZoneAround H d lam z Λ) : + ∃ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (d' : Set S → Set S → ℕ), + IsClearedTangle H T d θ lam Λ T' d' ∧ + ∀ (T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (d'' : Set S → Set S → ℕ), + IsClearedTangle H T d θ lam Λ T'' d'' → T'' = T' := + theorem_3_2_of_710 hS hConn hθ hMetric hZone + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section5.lean b/LeanPool/GraphMinor/GM14/Section5.lean new file mode 100644 index 0000000000..0047a53178 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section5.lean @@ -0,0 +1,887 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.GM11.Section5b +import LeanPool.GraphMinor.GM11.ForestRegions +import LeanPool.GraphMinor.Surface.InvarianceOfDomain + +/-! +# Graph Minors XIV, Section 5: Circuits in Cylinders + +This file formalizes Section 5 (pages 31–32) of Robertson and Seymour, +*Graph Minors. XIV. Extending an embedding*, J. Combin. Theory Ser. B 65 (1995), 23–50. The +formal statements use connected closed surfaces: + +- `theorem_5_1_proof` ((5.1), page 31): Given a nonempty connected set `R_set` of regions of `H` + in the interior `Δ \ bd(Δ)` of a closed disc `Δ`, there is a circuit `C` of `H` with `U(C) ⊆ Δ` + bounding an open disc `Λ ⊆ Δ` that includes every member of `R_set`. Every edge of `C` is + incident with some member of `R_set`. +- `theorem_5_2_proof` ((5.2), page 31): Given a nonempty arc-wise connected + subset `Z ⊆ Δ \ bd(Δ)` such that every region `r` of `H` with `closure r ∩ Z ≠ ∅` satisfies + `r ⊆ Δ \ bd(Δ)`, there is a circuit `C` of `H` with `U(C) ⊆ Δ` bounding an open disc `Λ ⊆ Δ` + including `Z`, with every edge of `C` incident with a region `r` satisfying `closure r ∩ Z ≠ ∅`. +- `theorem_5_3_proof` ((5.3), page 32): A circuit around `Z` reduces the regional distance + to `Σ \ Δ` by at most `1`. +- `theorem_5_4_proof` ((5.4), page 32): `k - 1` disjoint circuits in `Δ` bound open discs + including `Z` when the regional distance between `Z` and `Σ \ Δ` is at least `k ≥ 2`. +- `theorem_5_5_step` and `theorem_5_5_proof` ((5.5), page 32): Single-step and + `(k - 1)`-circuit versions in `Δ \ bd(Δ)` when the regional distance between `Z` and + `bd(Δ)` is at least `k ≥ 1`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Preliminaries on Regions, Arc-Connectedness, and Closed Discs -/ + +/-- An arc-connected subset `Z ⊆ S` is preconnected. -/ +theorem IsArcConnected.isPreconnected {Z : Set S} (hZ : IsArcConnected Z) : IsPreconnected Z := by + refine isPreconnected_of_forall_pair fun a ha b hb => ?_ + by_cases hab : a = b + · exact ⟨{a}, singleton_subset_iff.mpr ha, mem_singleton a, hab ▸ mem_singleton a, + isPreconnected_singleton⟩ + · obtain ⟨L, hLZ, f, hf0, hf1⟩ := hZ a ha b hb hab + have hLconn : IsPreconnected L := by + have hEq : Subtype.val '' (range f) = L := by + rw [f.surjective.range_eq] + simp + rw [← hEq, ← range_comp, ← image_univ] + exact isPreconnected_univ.image _ (continuous_subtype_val.comp f.continuous).continuousOn + exact ⟨L, hLZ, hf0 ▸ (f 0).2, hf1 ▸ (f 1).2, hLconn⟩ + +/-- A closed disc `D ⊆ S` is nonempty and preconnected. -/ +theorem IsClosedDisc.nonempty {D : Set S} (hD : IsClosedDisc D) : D.Nonempty := by + obtain ⟨f⟩ := hD + have h0 : (0 : EuclideanPlane) ∈ ClosedUnitDisc := by simp [ClosedUnitDisc] + exact ⟨(f ⟨0, h0⟩).1, (f ⟨0, h0⟩).2⟩ + +theorem IsClosedDisc.isPreconnected {D : Set S} (hD : IsClosedDisc D) : IsPreconnected D := by + obtain ⟨f⟩ := hD + have hc : IsPreconnected ClosedUnitDisc := by + have : ClosedUnitDisc = Metric.closedBall (0 : EuclideanPlane) 1 := by + ext x; simp [ClosedUnitDisc] + rw [this] + exact (convex_closedBall (0 : EuclideanPlane) 1).isPreconnected + have : PreconnectedSpace ClosedUnitDisc := isPreconnected_iff_preconnectedSpace.mp hc + have hEq : Subtype.val '' (range f) = D := by + rw [f.surjective.range_eq] + simp + rw [← hEq, ← range_comp, ← image_univ] + exact isPreconnected_univ.image _ (continuous_subtype_val.comp f.continuous).continuousOn + +/-- In a drawing `H` on a connected closed surface `S`, every point of `S` lies in the closure of +some region of `H`. -/ +private theorem exists_region_closure_mem [ConnectedSpace S] (hS : IsClosedSurface S) + (H : Drawing S) (x : S) : + ∃ r ∈ H.R, x ∈ closure r := by + have : T2Space S := hS.2.1 + have hfin : H.R.Finite := finite_R hS H + by_contra hnot + push Not at hnot + have hcl : IsClosed (⋃ r ∈ H.R, closure r) := + hfin.isClosed_biUnion fun r _ => isClosed_closure + have hx : x ∈ (⋃ r ∈ H.R, closure r)ᶜ := by + simp only [mem_compl_iff, mem_iUnion, not_exists] + exact hnot + obtain ⟨y, hyO, hyU⟩ := exists_notMem_U (Γ := H) hS hcl.isOpen_compl ⟨x, hx⟩ + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem hyU + exact hyO (mem_iUnion₂.mpr ⟨r, hr, subset_closure hyr⟩) + +/-! ## 2. Proof of (5.1) (page 31) -/ + +/-- Closed-surface form of Graph Minors XIV (5.1) (page 31): +"Let $H$ be a drawing in a surface $\Sigma$, and let $\Delta \subseteq \Sigma$ be a closed +disc. Let $\mathscr{R}$ be a non-empty connected set of regions of $H$, such that $r +\subseteq \Delta - \text{bd}(\Delta)$ for all $r \in \mathscr{R}$. Then there is a circuit +$C$ of $H$ with $U(C) \subseteq \Delta$, bounding a disc in $\Delta$ including each member +of $\mathscr{R}$, and such that every edge of $C$ is incident with a member of +$\mathscr{R}$." -/ +theorem theorem_5_1_proof [ConnectedSpace S] (hS : IsClosedSurface S) + (H : Drawing S) {Δ : Set S} (hΔ : IsClosedDisc Δ) + {R_set : Set (Set S)} (hne : R_set.Nonempty) (hconn : IsConnectedRegionSet H R_set) + (hsub : ∀ r ∈ R_set, r ⊆ Δ \ subBd Δ) : + ∃ (C : Drawing S) (Λ : Set S), + C.IsSubdrawing H ∧ C.IsCircuit ∧ C.U ⊆ Δ ∧ + IsOpenDisc Λ ∧ closure Λ ⊆ Δ ∧ IsClosedDisc (closure Λ) ∧ + subBd Λ = C.U ∧ subBd (closure Λ) = C.U ∧ closure Λ \ C.U = Λ ∧ + (∀ r ∈ R_set, r ⊆ Λ) ∧ + ∀ e ∈ C.E, ∃ r ∈ R_set, H.EdgeRegionIncident e r := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hΔcl : IsClosed Δ := hΔ.isCompact.isClosed + set N := boundaryDrawing H R_set with hN + have hNs : N.IsSubdrawing H := Drawing.span_isSubdrawing H _ _ + have hNE_sub : ∀ e ∈ N.E, closure e ⊆ Δ := by + intro e he + obtain ⟨⟨r, hrR, hinc⟩, -⟩ := (mem_boundaryDrawing_E (Γ := H)).mp he + have hes : e ⊆ closure r := + edge_subset_closure_of_incident hS (hNs.2 he) (hconn.1 hrR) hinc.2.2 + have hrΔ : closure r ⊆ Δ := hΔcl.closure_subset_iff.mpr ((hsub r hrR).trans sdiff_subset) + exact (closure_minimal hes isClosed_closure).trans hrΔ + have hNU : N.U ⊆ Δ := by + rw [N.U_eq] + refine union_subset ?_ (iUnion₂_subset hNE_sub) + intro v hv + obtain ⟨⟨r, hrR, hinc⟩, -⟩ := + (mem_boundaryDrawing_V (Γ := H) hS).mp hv + exact hΔcl.closure_subset_iff.mpr ((hsub r hrR).trans sdiff_subset) hinc.2.2 + let k : ℕ := N.E.ncard + 2 + have hk : 2 ≤ k := Nat.le_add_left 2 _ + have hs : IsSlope N k (discIns Δ) := isSlope_discIns hS hΔ hNU hk + have hconf : IsConfined k N := by + intro C _ hCs + change C.E.ncard < N.E.ncard + 2 + have hle : C.E.ncard ≤ N.E.ncard := Set.ncard_le_ncard hCs.2 N.finite_edges + omega + obtain ⟨r₁, hr₁⟩ := hne + obtain ⟨r', hr', hr₁'⟩ := exists_region_superset hNs (hconn.1 hr₁) + have hstep : ∀ a b : Set S, a ∈ R_set → b ∈ R_set → + (∃ e ∈ H.E, H.EdgeRegionIncident e a ∧ H.EdgeRegionIncident e b) → a ⊆ r' → b ⊆ r' := by + rintro a b ha hb ⟨e, heH, hia, hib⟩ har' + by_cases hab : a = b + · exact hab ▸ har' + · have heN : e ∉ N.E := by + intro heN + obtain ⟨-, c, ⟨hcR, hcnot⟩, hic⟩ := (mem_boundaryDrawing_E (Γ := H)).mp heN + have hea := edge_subset_closure_of_incident hS heH (hconn.1 ha) hia.2.2 + have heb := edge_subset_closure_of_incident hS heH (hconn.1 hb) hib.2.2 + have hec := edge_subset_closure_of_incident hS heH hcR hic.2.2 + rcases region_incident_two hS heH (hconn.1 ha) (hconn.1 hb) hcR + hea heb hec with h | h | h + · exact hab h + · exact hcnot (h ▸ ha) + · exact hcnot (h ▸ hb) + have hea := edge_subset_closure_of_incident hS heH (hconn.1 ha) hia.2.2 + have heb := edge_subset_closure_of_incident hS heH (hconn.1 hb) hib.2.2 + obtain ⟨p, hp⟩ := heH.1 + have hpNU : p ∉ N.U := by + intro hpU + have hpV : p ∉ N.V := fun hpV => (heH.2.1 hp).2 (hNs.1 hpV) + obtain ⟨f, hfN, hpf⟩ := N.exists_edge_of_mem hpU hpV + have hfe := H.edge_eq_of_mem (hNs.2 hfN) heH hpf hp + exact heN (hfe ▸ hfN) + obtain ⟨rp, hrp, hprp⟩ := exists_region_of_notMem hpNU + obtain ⟨x, hxr, hxa⟩ := mem_closure_iff.mp (hea hp) rp (region_isOpen hrp) hprp + have hrp_eq : rp = r' := region_eq_of_mem hrp hr' hxr (har' hxa) + have hpr' : p ∈ r' := hrp_eq ▸ hprp + obtain ⟨y, hyr', hyb⟩ := mem_closure_iff.mp (heb hp) r' (region_isOpen hr') hpr' + refine subset_region hr' (region_isPreconnected (hconn.1 hb)) ?_ hyb hyr' + exact disjoint_left.mpr fun z hz hzN => region_subset (hconn.1 hb) hz (hNs.U_subset hzN) + have hall_r' : ∀ r ∈ R_set, r ⊆ r' := by + intro r hr + have hrel := hconn.2 r₁ hr₁ r hr + clear hr + induction hrel with + | refl => exact hr₁' + | @tail a b _ hab ih => + exact hstep a b hab.1 hab.2.1 hab.2.2 ih + have hr₀ : univ \ insOf (discIns Δ) N ∈ N.R := + GM11.theorem_4_4_proof hS hs (Drawing.IsSubdrawing.refl N) hconf + set r₀ := univ \ insOf (discIns Δ) N + have hins_sub : insOf (discIns Δ) N ⊆ Δ := by + refine union_subset hNU (iUnion₂_subset ?_) + rintro C ⟨hC, hCs⟩ + exact (discIns_spec hΔ hC (hCs.U_subset.trans hNU)).1.1 + have hcompl_ne : Δᶜ.Nonempty := by + obtain ⟨f⟩ := hΔ.isOArc_discBd + have hbd_ne : (discBd Δ).Nonempty := ⟨(f 1).1, (f 1).2⟩ + obtain ⟨w, hw⟩ := hbd_ne + rw [← IsClosedDisc.frontier_eq_discBd hS hΔ] at hw + by_contra hemp + rw [not_nonempty_iff_eq_empty, compl_eq_univ_sdiff, sdiff_eq_empty] at hemp + have hΔuniv : Δ = univ := subset_antisymm (subset_univ _) hemp + rw [hΔuniv, frontier_univ] at hw + exact hw + obtain ⟨y, hyΔ, hyHU⟩ := exists_notMem_U (Γ := H) hS + hΔcl.isOpen_compl hcompl_ne + obtain ⟨r_out, hr_out, hy_out⟩ := exists_region_of_notMem hyHU + have hr_out_not : r_out ∉ R_set := fun h => hyΔ ((hsub r_out h hy_out).1) + have hy_r₀ : y ∈ r₀ := ⟨mem_univ y, fun h => hyΔ (hins_sub h)⟩ + have hr_out_r₀ : r_out ⊆ r₀ := by + refine subset_region hr₀ (region_isPreconnected hr_out) ?_ hy_out hy_r₀ + exact disjoint_left.mpr fun z hz hzN => region_subset hr_out hz (hNs.U_subset hzN) + have hne_r' : r' ≠ r₀ := by + intro heq + obtain ⟨e, -, heN, a, b, haR, hbR, -, -, hia, hib⟩ := + GM11.theorem_5_1_proof hS hNs hr₀ (hconn.1 hr₁) hr₁ hr_out hr_out_not + (heq ▸ hr₁') hr_out_r₀ + exact heN ((mem_boundaryDrawing_E (Γ := H)).mpr ⟨⟨a, haR, hia⟩, b, ⟨hib.2.1, hbR⟩, hib⟩) + have hnot_r₀ : ¬ Captures (discIns Δ) k N r₀ := by + rintro ⟨C, hC, hCs, -, hin⟩ + exact hy_r₀.2 (Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, hCs⟩, hin hy_r₀⟩)) + have hcap : Captures (discIns Δ) k N r' := by + rcases captures_of_ne hS hs (Drawing.IsSubdrawing.refl N) hconf + hr' hr₀ hne_r' with h | h + · exact h + · exact absurd h hnot_r₀ + obtain ⟨C, hC, hCs, -, hr'_sub⟩ := hcap + have hCH : C.IsSubdrawing H := hCs.trans hNs + have hCU : C.U ⊆ Δ := hCs.U_subset.trans hNU + obtain ⟨⟨hDΔ, hDdisc, hDbd⟩, -⟩ := discIns_spec hΔ hC hCU + have hDsubBd : subBd (discIns Δ C) = C.U := by + rw [IsClosedDisc.subBd_eq_discBd hS hDdisc, hDbd] + obtain ⟨hOpenΛ, hclΛ, hbdΛ⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hDdisc + refine ⟨C, discIns Δ C \ subBd (discIns Δ C), hCH, hC, hCU, hOpenΛ, + hclΛ.symm ▸ hDΔ, hclΛ.symm ▸ hDdisc, hbdΛ.trans hDsubBd, + hclΛ.symm ▸ hDsubBd, by rw [hclΛ, hDsubBd], ?_, ?_⟩ + · intro r hr x hxr + refine ⟨hr'_sub (hall_r' r hr hxr), ?_⟩ + rw [hDsubBd] + exact fun hxC => region_subset (hconn.1 hr) hxr (hCH.U_subset hxC) + · intro e he + obtain ⟨⟨r, hrR, hinc⟩, -⟩ := (mem_boundaryDrawing_E (Γ := H)).mp (hCs.2 he) + exact ⟨r, hrR, hinc⟩ + +/-! ## 3. Proof of (5.2) (page 31) -/ + +/-- If every region `r ∈ H.R` whose closure meets `Z` is contained in a closed set `D`, then +`Z ⊆ interior D`. -/ +private theorem subset_interior_of_regions_subset [ConnectedSpace S] (hS : IsClosedSurface S) + {H : Drawing S} {Z D : Set S} (hD : IsClosed D) + (hrD : ∀ r ∈ H.R, (closure r ∩ Z).Nonempty → r ⊆ D) : + Z ⊆ interior D := by + have : T2Space S := hS.2.1 + let R_set : Set (Set S) := {r ∈ H.R | (closure r ∩ Z).Nonempty} + let K : Set S := ⋃ r ∈ H.R \ R_set, closure r + have hfin : (H.R \ R_set).Finite := (finite_R hS H).subset sdiff_subset + have hK : IsClosed K := hfin.isClosed_biUnion fun r _ => isClosed_closure + have hZK : Z ⊆ Kᶜ := by + intro z hz hzK + obtain ⟨r, ⟨hrR, hrnot⟩, hzr⟩ := mem_iUnion₂.mp hzK + exact hrnot ⟨hrR, z, hzr, hz⟩ + have hKD : Kᶜ ⊆ D := by + intro w hwK + by_contra hwD + obtain ⟨y, ⟨hyK, hyD⟩, hyU⟩ := exists_notMem_U (Γ := H) hS + (hK.isOpen_compl.sdiff hD) ⟨w, hwK, hwD⟩ + obtain ⟨r, hrR, hyr⟩ := exists_region_of_notMem hyU + by_cases hrZ : (closure r ∩ Z).Nonempty + · exact hyD (hrD r hrR hrZ hyr) + · exact hyK (mem_iUnion₂.mpr ⟨r, ⟨hrR, fun h => hrZ h.2⟩, subset_closure hyr⟩) + exact hZK.trans (interior_maximal hKD hK.isOpen_compl) + +/-- The set of regions `r` of `H` whose closure meets a preconnected set `Z` is connected +in the sense of Section 5 (page 31). -/ +private theorem isConnectedRegionSet_of_isPreconnected [ConnectedSpace S] (hS : IsClosedSurface S) + (H : Drawing S) {Z : Set S} (hZ : IsPreconnected Z) : + IsConnectedRegionSet H {r ∈ H.R | (closure r ∩ Z).Nonempty} := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let R_set : Set (Set S) := {r ∈ H.R | (closure r ∩ Z).Nonempty} + refine ⟨fun _ h => h.1, fun r₀ hr₀ r_t hr_t => ?_⟩ + let Adj : Set S → Set S → Prop := fun r₁ r₂ => + r₁ ∈ R_set ∧ r₂ ∈ R_set ∧ ∃ e ∈ H.E, H.EdgeRegionIncident e r₁ ∧ H.EdgeRegionIncident e r₂ + let R₁ : Set (Set S) := {r ∈ R_set | Relation.ReflTransGen Adj r₀ r} + let R₂ : Set (Set S) := R_set \ R₁ + by_contra hnot + have hr_t₂ : r_t ∈ R₂ := ⟨hr_t, fun h => hnot h.2⟩ + have hr₀₁ : r₀ ∈ R₁ := ⟨hr₀, Relation.ReflTransGen.refl⟩ + have hfinR : H.R.Finite := finite_R hS H + let K₁ : Set S := ⋃ r ∈ R₁, closure r + let K₂ : Set S := ⋃ r ∈ R₂, closure r + let K₃ : Set S := ⋃ r ∈ H.R \ R_set, closure r + have hR₁fin : R₁.Finite := hfinR.subset fun _ h => h.1.1 + have hR₂fin : R₂.Finite := hfinR.subset fun _ h => h.1.1 + have hK₁ : IsClosed K₁ := hR₁fin.isClosed_biUnion fun _ _ => isClosed_closure + have hK₂ : IsClosed K₂ := hR₂fin.isClosed_biUnion fun _ _ => isClosed_closure + have hK₃ : IsClosed K₃ := + (hfinR.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure + have hcov_univ : ∀ x : S, x ∉ K₃ → x ∈ K₁ ∪ K₂ := by + intro x hxK₃ + obtain ⟨r, hrR, hxr⟩ := exists_region_closure_mem hS H x + by_cases hr_in : r ∈ R_set + · by_cases hr₁ : r ∈ R₁ + · exact Or.inl (mem_iUnion₂.mpr ⟨r, hr₁, hxr⟩) + · exact Or.inr (mem_iUnion₂.mpr ⟨r, ⟨hr_in, hr₁⟩, hxr⟩) + · exact absurd (mem_iUnion₂.mpr ⟨r, ⟨hrR, hr_in⟩, hxr⟩) hxK₃ + have hinter_V : K₁ ∩ K₂ ⊆ H.V := by + rintro x ⟨hx₁, hx₂⟩ + by_contra hxV + obtain ⟨a, ha₁, hxa⟩ := mem_iUnion₂.mp hx₁ + obtain ⟨b, hb₂, hxb⟩ := mem_iUnion₂.mp hx₂ + by_cases hxU : x ∈ H.U + · obtain ⟨e, he, hxe⟩ := H.exists_edge_of_mem hxU hxV + have hia : H.EdgeRegionIncident e a := ⟨he, ha₁.1.1, x, hxe, hxa⟩ + have hib : H.EdgeRegionIncident e b := ⟨he, hb₂.1.1, x, hxe, hxb⟩ + exact hb₂.2 ⟨hb₂.1, Relation.ReflTransGen.tail ha₁.2 ⟨ha₁.1, hb₂.1, e, he, hia, hib⟩⟩ + · obtain ⟨s, hs, hxs⟩ := exists_region_of_notMem hxU + obtain ⟨y₁, hy₁s, hy₁a⟩ := mem_closure_iff.mp hxa s (region_isOpen hs) hxs + obtain ⟨y₂, hy₂s, hy₂b⟩ := mem_closure_iff.mp hxb s (region_isOpen hs) hxs + have has : a = s := region_eq_of_mem ha₁.1.1 hs hy₁a hy₁s + have hbs : b = s := region_eq_of_mem hb₂.1.1 hs hy₂b hy₂s + exact hb₂.2 (hbs.trans has.symm ▸ ha₁) + have hZK₃ : ∀ z ∈ Z, z ∉ K₃ := by + intro z hz hzK₃ + obtain ⟨r, ⟨hrR, hrnot⟩, hzr⟩ := mem_iUnion₂.mp hzK₃ + exact hrnot ⟨hrR, z, hzr, hz⟩ + have hZ_cov : Z ⊆ K₁ᶜ ∪ K₂ᶜ := by + intro v hvZ + rw [mem_union, mem_compl_iff, mem_compl_iff, ← not_and_or] + rintro ⟨hv₁, hv₂⟩ + have hvV : v ∈ H.V := hinter_V ⟨hv₁, hv₂⟩ + have hvK₃ : v ∈ K₃ᶜ := hZK₃ v hvZ + have hV_cl : IsClosed (H.V \ {v}) := (H.finite_V.subset sdiff_subset).isClosed + have hO : IsOpen (K₃ᶜ \ (H.V \ {v})) := hK₃.isOpen_compl.sdiff hV_cl + have hvO : v ∈ K₃ᶜ \ (H.V \ {v}) := ⟨hvK₃, fun h => h.2 rfl⟩ + obtain ⟨W, hWopen, hvW, hWO, hWconn, -⟩ := exists_punctured_nbhd hS hO hvO + have hW_cov : W \ {v} ⊆ K₁ᶜ ∪ K₂ᶜ := by + rintro y ⟨hyW, hyv⟩ + rw [mem_union, mem_compl_iff, mem_compl_iff, ← not_and_or] + rintro ⟨hy₁, hy₂⟩ + exact (hWO hyW).2 ⟨hinter_V ⟨hy₁, hy₂⟩, hyv⟩ + have hW_disj : (W \ {v}) ∩ (K₁ᶜ ∩ K₂ᶜ) = ∅ := by + ext y + simp only [mem_inter_iff, mem_sdiff, mem_singleton_iff, mem_compl_iff, mem_empty_iff_false, + iff_false, not_and] + intro hy hy₁ hy₂ + rcases hcov_univ y (hWO hy.1).1 with h | h + · exact hy₁ h + · exact hy₂ h + rcases (isPreconnected_iff_subset_of_disjoint.mp hWconn) K₁ᶜ K₂ᶜ + hK₁.isOpen_compl hK₂.isOpen_compl hW_cov hW_disj with hsub₁ | hsub₂ + · obtain ⟨a, ha₁, hva⟩ := mem_iUnion₂.mp hv₁ + obtain ⟨y, hyW, hya⟩ := mem_closure_iff.mp hva W hWopen hvW + have hyv : y ≠ v := fun h => region_subset ha₁.1.1 hya (H.V_subset_U (h ▸ hvV)) + exact hsub₁ ⟨hyW, hyv⟩ (mem_iUnion₂.mpr ⟨a, ha₁, subset_closure hya⟩) + · obtain ⟨b, hb₂, hvb⟩ := mem_iUnion₂.mp hv₂ + obtain ⟨y, hyW, hyb⟩ := mem_closure_iff.mp hvb W hWopen hvW + have hyv : y ≠ v := fun h => region_subset hb₂.1.1 hyb (H.V_subset_U (h ▸ hvV)) + exact hsub₂ ⟨hyW, hyv⟩ (mem_iUnion₂.mpr ⟨b, hb₂, subset_closure hyb⟩) + have hZ_disj : Z ∩ (K₁ᶜ ∩ K₂ᶜ) = ∅ := by + ext z + simp only [mem_inter_iff, mem_compl_iff, mem_empty_iff_false, iff_false, not_and] + intro hzZ hz₁ hz₂ + rcases hcov_univ z (hZK₃ z hzZ) with h | h + · exact hz₁ h + · exact hz₂ h + rcases (isPreconnected_iff_subset_of_disjoint.mp hZ) K₁ᶜ K₂ᶜ + hK₁.isOpen_compl hK₂.isOpen_compl hZ_cov hZ_disj with hZ₁ | hZ₂ + · obtain ⟨z₀, hz₀r, hz₀Z⟩ := hr₀.2 + exact hZ₁ hz₀Z (mem_iUnion₂.mpr ⟨r₀, hr₀₁, hz₀r⟩) + · obtain ⟨zt, hztr, hztZ⟩ := hr_t.2 + exact hZ₂ hztZ (mem_iUnion₂.mpr ⟨r_t, hr_t₂, hztr⟩) + +/-- Stronger internal form of Graph Minors XIV, (5.2) (page 31), taking `IsPreconnected Z` and +recording that `closure Λ ⊆ Δ` is a closed disc with `subBd (closure Λ) = C.U` and +`closure Λ \ C.U = Λ`. -/ +theorem theorem_5_2_full [ConnectedSpace S] (hS : IsClosedSurface S) + (H : Drawing S) {Δ Z : Set S} (hΔ : IsClosedDisc Δ) + (hZne : Z.Nonempty) (hZconn : IsPreconnected Z) + (hsub : ∀ r ∈ H.R, (closure r ∩ Z).Nonempty → r ⊆ Δ \ subBd Δ) : + ∃ (C : Drawing S) (Λ : Set S), + C.IsSubdrawing H ∧ C.IsCircuit ∧ C.U ⊆ Δ ∧ + IsOpenDisc Λ ∧ closure Λ ⊆ Δ ∧ IsClosedDisc (closure Λ) ∧ + subBd Λ = C.U ∧ subBd (closure Λ) = C.U ∧ closure Λ \ C.U = Λ ∧ + Z ⊆ Λ ∧ + ∀ e ∈ C.E, ∃ r ∈ H.R, H.EdgeRegionIncident e r ∧ (closure r ∩ Z).Nonempty := by + have : T2Space S := hS.2.1 + let R_set : Set (Set S) := {r ∈ H.R | (closure r ∩ Z).Nonempty} + have hR_ne : R_set.Nonempty := by + obtain ⟨z₀, hz₀⟩ := hZne + obtain ⟨r₀, hr₀, hz₀r⟩ := exists_region_closure_mem hS H z₀ + exact ⟨r₀, hr₀, z₀, hz₀r, hz₀⟩ + have hR_conn : IsConnectedRegionSet H R_set := + isConnectedRegionSet_of_isPreconnected hS H hZconn + obtain ⟨C, Λ, hCH, hC, hCU, hOpenΛ, hclΛ_sub, hclΛ_disc, hbdΛ, hbd_clΛ, hdiffΛ, hrΛ, heR⟩ := + theorem_5_1_proof hS H hΔ hR_ne hR_conn (fun r hr => hsub r hr.1 hr.2) + have hZΛ : Z ⊆ Λ := by + have hDcl : IsClosed (closure Λ) := isClosed_closure + have hint : Z ⊆ interior (closure Λ) := + subset_interior_of_regions_subset hS hDcl fun r hrR hrZ => + (hrΛ r ⟨hrR, hrZ⟩).trans subset_closure + rw [← hdiffΛ] + intro z hz + have hzi := hint hz + refine ⟨interior_subset hzi, fun hzC => ?_⟩ + rw [← hbd_clΛ, subBd_eq_frontier] at hzC + exact hzC.2 hzi + refine ⟨C, Λ, hCH, hC, hCU, hOpenΛ, hclΛ_sub, hclΛ_disc, hbdΛ, hbd_clΛ, hdiffΛ, hZΛ, ?_⟩ + intro e he + obtain ⟨r, ⟨hrR, hrZ⟩, hinc⟩ := heR e he + exact ⟨r, hrR, hinc, hrZ⟩ + +/-- Closed-surface form of Graph Minors XIV (5.2) (page 31), cited in XIX on pages 345 and 363: +"(5.2) *Let $H$ be a drawing in $\Sigma$, and let $\Delta \subseteq \Sigma$ be a closed disc. +Let $Z \subseteq \Delta - \text{bd}(\Delta)$ be non-empty and arc-wise connected, and such +that $r \subseteq \Delta - \text{bd}(\Delta)$ for every region $r$ of $H$ with $\bar{r} \cap +Z \ne \emptyset$. Then there is a circuit $C$ of $H$ with $U(C) \subseteq \Delta$, bounding +an open disc in $\Delta$ including $Z$, such that every edge of $C$ is incident with a +region $r$ of $H$ satisfying $\bar{r} \cap Z \ne \emptyset$." -/ +theorem theorem_5_2_proof : + ∀ (S : Type u) [TopologicalSpace S], + IsClosedSurface S → ConnectedSpace S → + ∀ (H : Drawing S) (Δ Z : Set S), + IsClosedDisc Δ → Z ⊆ Δ \ subBd Δ → Z.Nonempty → IsArcConnected Z → + (∀ r ∈ H.R, (closure r ∩ Z).Nonempty → r ⊆ Δ \ subBd Δ) → + ∃ (C : Surface.Drawing S) (Λ : Set S), + C.IsSubdrawing H ∧ C.IsCircuit ∧ C.U ⊆ Δ ∧ + IsOpenDisc Λ ∧ Λ ⊆ Δ ∧ subBd Λ = C.U ∧ + Z ⊆ Λ ∧ + ∀ e ∈ C.E, ∃ r ∈ H.R, H.EdgeRegionIncident e r ∧ (closure r ∩ Z).Nonempty := by + intro S _ hS hconnS H Δ Z hΔ _ hZne hZconn hsub + obtain ⟨C, Λ, hCH, hC, hCU, hOpenΛ, hclΛ_sub, -, hbdΛ, -, -, hZΛ, heR⟩ := + theorem_5_2_full hS H hΔ hZne (IsArcConnected.isPreconnected hZconn) hsub + exact ⟨C, Λ, hCH, hC, hCU, hOpenΛ, subset_closure.trans hclΛ_sub, hbdΛ, hZΛ, heR⟩ + +/-! ## 4. Regional Distance and Proofs of (5.3), (5.4), and (5.5) (page 32) -/ + +/-- On a connected closed surface `S`, between any two nonempty sets `X` and `Y` there exists a +region chain in `H`. -/ +private theorem exists_regionChain [ConnectedSpace S] (hS : IsClosedSurface S) + (H : Drawing S) {X Y : Set S} (hX : X.Nonempty) (hY : Y.Nonempty) : + ∃ (k : ℕ) (v_seq : Fin (k + 1) → S) (r_seq : Fin k → Set S), + IsRegionChain H X Y v_seq r_seq := by + have : T2Space S := hS.2.1 + let Reach : Set S := {z : S | ∃ (k : ℕ) (v_seq : Fin (k + 1) → S) (r_seq : Fin k → Set S), + IsRegionChain H X {z} v_seq r_seq} + have hReach_ext : ∀ r ∈ H.R, (closure r ∩ Reach).Nonempty → closure r ⊆ Reach := by + rintro r hrR ⟨z, hzr, k, v_seq, r_seq, hv0, hvlast, hsteps⟩ w hwr + refine ⟨k + 1, Fin.snoc v_seq w, Fin.snoc r_seq r, ?_, ?_, ?_⟩ + · simpa [Fin.snoc] using hv0 + · simp [Fin.snoc] + · intro i + refine Fin.lastCases ?_ (fun j => ?_) i + · simp only [Fin.snoc_last, Fin.snoc_castSucc, Fin.succ_last] + have hzj : v_seq (Fin.last k) = z := mem_singleton_iff.mp hvlast + exact ⟨hrR, hzj ▸ hzr, hwr⟩ + · simp only [Fin.snoc_castSucc, Fin.succ_castSucc] + exact hsteps j + obtain ⟨x₀, hx₀⟩ := hX + have hx₀_reach : x₀ ∈ Reach := + ⟨0, fun _ => x₀, Fin.elim0, hx₀, rfl, fun i => i.elim0⟩ + let R_reach : Set (Set S) := {r ∈ H.R | (closure r ∩ Reach).Nonempty} + have hfinR : H.R.Finite := finite_R hS H + have hReach_eq : Reach = ⋃ r ∈ R_reach, closure r := by + apply subset_antisymm + · intro z hz + obtain ⟨r, hrR, hzr⟩ := exists_region_closure_mem hS H z + exact mem_iUnion₂.mpr ⟨r, ⟨hrR, z, hzr, hz⟩, hzr⟩ + · exact iUnion₂_subset fun r hr => hReach_ext r hr.1 hr.2 + have hReach_compl : Reachᶜ = ⋃ r ∈ H.R \ R_reach, closure r := by + apply subset_antisymm + · intro z hz + obtain ⟨r, hrR, hzr⟩ := exists_region_closure_mem hS H z + refine mem_iUnion₂.mpr ⟨r, ⟨hrR, ?_⟩, hzr⟩ + intro hr_in + exact hz (hReach_ext r hrR hr_in.2 hzr) + · rintro z ⟨_, ⟨r, rfl⟩, _, ⟨⟨hrR, hrnot⟩, rfl⟩, hzr⟩ hzR + exact hrnot ⟨hrR, z, hzr, hzR⟩ + have hClopen : IsClopen Reach := by + refine ⟨?_, ?_⟩ + · rw [hReach_eq] + have hRfin : R_reach.Finite := hfinR.subset fun _ h => h.1 + exact hRfin.isClosed_biUnion fun _ _ => isClosed_closure + · rw [← isClosed_compl_iff, hReach_compl] + exact (hfinR.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure + have hReach_univ : Reach = univ := + (isClopen_iff.mp hClopen).resolve_left (nonempty_iff_ne_empty.mp ⟨x₀, hx₀_reach⟩) + obtain ⟨y₀, hy₀⟩ := hY + have hy₀_reach : y₀ ∈ Reach := hReach_univ ▸ mem_univ y₀ + obtain ⟨k, v_seq, r_seq, hv0, hvlast, hsteps⟩ := hy₀_reach + exact ⟨k, v_seq, r_seq, hv0, (mem_singleton_iff.mp hvlast) ▸ hy₀, hsteps⟩ + +theorem regionalDistance_spec [ConnectedSpace S] (hS : IsClosedSurface S) + (H : Drawing S) {X Y : Set S} (hX : X.Nonempty) (hY : Y.Nonempty) : + ∃ (v_seq : Fin (regionalDistance H X Y + 1) → S) (r_seq : Fin (regionalDistance H X Y) → Set S), + IsRegionChain H X Y v_seq r_seq := by + let lengths : Set ℕ := + {k | ∃ (v_seq : Fin (k + 1) → S) (r_seq : Fin k → Set S), IsRegionChain H X Y v_seq r_seq} + have hnonempty : lengths.Nonempty := exists_regionChain hS H hX hY + exact Nat.sInf_mem (s := lengths) hnonempty + +theorem regionalDistance_le {H : Drawing S} {X Y : Set S} {k : ℕ} + {v_seq : Fin (k + 1) → S} {r_seq : Fin k → Set S} (hc : IsRegionChain H X Y v_seq r_seq) : + regionalDistance H X Y ≤ k := + Nat.sInf_le ⟨v_seq, r_seq, hc⟩ + +/-- Prepending a region incident with an edge of `C` to a shortest chain from `D = closure Λ` to +`W` shows that `regionalDistance H D W ≥ regionalDistance H Z W - 1`. -/ +private theorem regionalDistance_closure_disc_ge [ConnectedSpace S] (hS : IsClosedSurface S) + {H C : Drawing S} {Z D W : Set S} {k : ℕ} + (hCH : C.IsSubdrawing H) (hC : C.IsCircuit) + (hD : IsClosedDisc D) (hbdD : subBd D = C.U) + (hZD : Z ⊆ D) (hZne : Z.Nonempty) (hWne : W.Nonempty) (hDW : Disjoint D W) + (heR : ∀ e ∈ C.E, ∃ r ∈ H.R, H.EdgeRegionIncident e r ∧ (closure r ∩ Z).Nonempty) + (hk : k ≤ regionalDistance H Z W) : + k - 1 ≤ regionalDistance H D W := by + have : T2Space S := hS.2.1 + have hDcl : IsClosed D := hD.isCompact.isClosed + have hDne : D.Nonempty := hZne.mono hZD + have hspec := regionalDistance_spec hS H hDne hWne + generalize hk' : regionalDistance H D W = k' at hspec ⊢ + obtain ⟨v_seq, r_seq, hv0, hvlast, hsteps⟩ := hspec + rcases k' with _ | m + · exfalso + have h0 : Fin.last 0 = (0 : Fin 1) := rfl + rw [h0] at hvlast + exact disjoint_left.mp hDW hv0 hvlast + · have hv1_not_D : v_seq 1 ∉ D := by + intro hv1D + have hchain' : IsRegionChain H D W (fun i : Fin (m + 1) => v_seq i.succ) + (fun i : Fin m => r_seq i.succ) := by + refine ⟨hv1D, ?_, fun i => ?_⟩ + · simpa [Fin.last] using hvlast + · exact hsteps i.succ + have hle : m + 1 ≤ m := hk' ▸ regionalDistance_le hchain' + omega + have hr0_R : r_seq 0 ∈ H.R := (hsteps 0).1 + have hv0_r0 : v_seq 0 ∈ closure (r_seq 0) := (hsteps 0).2.1 + have hv1_r0 : v_seq 1 ∈ closure (r_seq 0) := (hsteps 0).2.2 + have hr0_not_sub : ¬ r_seq 0 ⊆ D := + fun hsub => hv1_not_D (hDcl.closure_subset_iff.mpr hsub hv1_r0) + have hfrD : frontier D = C.U := by rw [← subBd_eq_frontier, hbdD] + have hr0_disj_fr : Disjoint (r_seq 0) (frontier D) := by + rw [hfrD] + exact disjoint_left.mpr fun x hxr hxC => region_subset hr0_R hxr (hCH.U_subset hxC) + have hr0_disj_D : Disjoint (r_seq 0) D := + (subset_or_disjoint_of_frontier hDcl (region_isPreconnected hr0_R) hr0_disj_fr).resolve_left + hr0_not_sub + have hv0_CU : v_seq 0 ∈ C.U := by + rw [← hbdD] + refine ⟨subset_closure hv0, closure_mono ?_ hv0_r0⟩ + exact fun x hxr => ⟨mem_univ x, disjoint_left.mp hr0_disj_D hxr⟩ + have hv0_edge : ∃ e ∈ C.E, v_seq 0 ∈ closure e := by + by_cases hv0V : v_seq 0 ∈ C.V + · obtain ⟨W_walk, -, hpos, -, -⟩ := exists_walk_at hC hv0V + cases W_walk with + | nil _ => simp at hpos + | @cons _ w _ e hl _ => + have : v_seq 0 ∈ closure e ∩ C.V := by rw [hl.2.2.2]; simp + exact ⟨e, hl.1, this.1⟩ + · obtain ⟨e, heC, hv0e⟩ := C.exists_edge_of_mem hv0_CU hv0V + exact ⟨e, heC, subset_closure hv0e⟩ + obtain ⟨e, heC, hv0_e⟩ := hv0_edge + obtain ⟨r, hrR, hinc, z, hzr, hzZ⟩ := heR e heC + have her : e ⊆ closure r := + edge_subset_closure_of_incident hS (hCH.2 heC) hrR hinc.2.2 + have hv0_r : v_seq 0 ∈ closure r := closure_minimal her isClosed_closure hv0_e + have hchain_ext : IsRegionChain H Z W (Fin.cons z v_seq) (Fin.cons r r_seq) := by + refine ⟨hzZ, ?_, fun i => ?_⟩ + · rw [← Fin.succ_last (m + 1), Fin.cons_succ] + exact hvlast + · refine Fin.cases ?_ (fun j => ?_) i + · exact ⟨hrR, hzr, hv0_r⟩ + · simpa using hsteps j + have hle : k ≤ (m + 1) + 1 := hk.trans (regionalDistance_le (k := m + 1 + 1) hchain_ext) + omega + +/-- Preconnected version of Graph Minors XIV, (5.3) (page 32), used in the induction for (5.4). -/ +theorem theorem_5_3_of_isPreconnected [ConnectedSpace S] (hS : IsClosedSurface S) + (H : Drawing S) {Δ Z : Set S} (hΔ : IsClosedDisc Δ) + (hZne : Z.Nonempty) (hZconn : IsPreconnected Z) + {k : ℕ} (hk2 : 2 ≤ k) (hdist : k ≤ regionalDistance H Z (univ \ Δ)) : + ∃ (C : Drawing S) (Λ : Set S), + C.IsSubdrawing H ∧ C.IsCircuit ∧ C.U ⊆ Δ ∧ + IsOpenDisc Λ ∧ closure Λ ⊆ Δ ∧ IsClosedDisc (closure Λ) ∧ + subBd Λ = C.U ∧ subBd (closure Λ) = C.U ∧ closure Λ \ C.U = Λ ∧ + Z ⊆ Λ ∧ k - 1 ≤ regionalDistance H (closure Λ) (univ \ Δ) := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hsub : ∀ r ∈ H.R, (closure r ∩ Z).Nonempty → r ⊆ Δ \ subBd Δ := by + rintro r hrR ⟨z, hzr, hzZ⟩ + by_contra hnot + have hr_not_Δ : ¬ r ⊆ Δ := by + intro hrΔ + apply hnot + have hopen : IsOpen r := region_isOpen hrR + have hint : r ⊆ interior Δ := interior_maximal hrΔ hopen + intro x hxr + exact ⟨hrΔ hxr, fun hxbd => ((subBd_eq_frontier Δ ▸ hxbd : x ∈ frontier Δ)).2 (hint hxr)⟩ + obtain ⟨y, hyr, hyΔ⟩ := not_subset.mp hr_not_Δ + have hchain1 : IsRegionChain H Z (univ \ Δ) ![z, y] ![r] := by + refine ⟨hzZ, ⟨mem_univ y, hyΔ⟩, fun i => ?_⟩ + fin_cases i + exact ⟨hrR, hzr, subset_closure hyr⟩ + have hle1 : regionalDistance H Z (univ \ Δ) ≤ 1 := regionalDistance_le hchain1 + omega + obtain ⟨C, Λ, hCH, hC, hCU, hOpenΛ, hclΛ_sub, hclΛ_disc, hbdΛ, hbd_clΛ, hdiffΛ, hZΛ, heR⟩ := + theorem_5_2_full hS H hΔ hZne hZconn hsub + have hcompl_ne : (univ \ Δ).Nonempty := by + obtain ⟨f⟩ := hΔ.isOArc_discBd + have hbd_ne : (discBd Δ).Nonempty := ⟨(f 1).1, (f 1).2⟩ + obtain ⟨w, hw⟩ := hbd_ne + rw [← IsClosedDisc.frontier_eq_discBd hS hΔ] at hw + by_contra hemp + rw [not_nonempty_iff_eq_empty, sdiff_eq_empty] at hemp + have hΔuniv : Δ = univ := subset_antisymm (subset_univ _) hemp + rw [hΔuniv, frontier_univ] at hw + exact hw + have hdisj : Disjoint (closure Λ) (univ \ Δ) := + disjoint_left.mpr fun _ hx hnot => hnot.2 (hclΛ_sub hx) + have hdist' := regionalDistance_closure_disc_ge hS hCH hC hclΛ_disc hbd_clΛ + (hZΛ.trans subset_closure) hZne hcompl_ne hdisj heR hdist + exact ⟨C, Λ, hCH, hC, hCU, hOpenΛ, hclΛ_sub, hclΛ_disc, hbdΛ, hbd_clΛ, hdiffΛ, hZΛ, hdist'⟩ + +/-- Closed-surface form of Graph Minors XIV (5.3) (page 32): +"Let $H$ be a drawing in $\Sigma$, and let $\Delta \subseteq \Sigma$ be a closed disc. Let $Z +\subseteq \Delta - \text{bd}(\Delta)$ be non-empty and arc-wise connected, such that the +regional distance between $Z$ and $\Sigma - \Delta$ is $\ge k \ge 2$. Then there is a +circuit $C$ of $H$ with $U(C) \subseteq \Delta$, bounding an open disc $\Lambda$ including +$Z$, such that the regional distance between $\bar{\Lambda}$ and $\Sigma - \Delta$ is $\ge k +- 1$." -/ +theorem theorem_5_3_proof [ConnectedSpace S] (hS : IsClosedSurface S) + (H : Drawing S) {Δ Z : Set S} (hΔ : IsClosedDisc Δ) + (_hZ : Z ⊆ Δ \ subBd Δ) (hZne : Z.Nonempty) (hZconn : IsArcConnected Z) + {k : ℕ} (hk2 : 2 ≤ k) (hdist : k ≤ regionalDistance H Z (univ \ Δ)) : + ∃ (C : Drawing S) (Λ : Set S), + C.IsSubdrawing H ∧ C.IsCircuit ∧ C.U ⊆ Δ ∧ + IsOpenDisc Λ ∧ closure Λ ⊆ Δ ∧ IsClosedDisc (closure Λ) ∧ subBd Λ = C.U ∧ + Z ⊆ Λ ∧ k - 1 ≤ regionalDistance H (closure Λ) (univ \ Δ) := by + obtain ⟨C, Λ, hCH, hC, hCU, hOpenΛ, hclΛ_sub, hclΛ_disc, hbdΛ, -, -, hZΛ, hdist'⟩ := + theorem_5_3_of_isPreconnected hS H hΔ hZne (IsArcConnected.isPreconnected hZconn) hk2 hdist + exact ⟨C, Λ, hCH, hC, hCU, hOpenΛ, hclΛ_sub, hclΛ_disc, hbdΛ, hZΛ, hdist'⟩ + +/-- Inductive helper for (5.4): produces `m` nested circuits and open discs around `Z` when +`m + 1 ≤ regionalDistance H Z (univ \ Δ)`. -/ +private theorem theorem_5_4_aux [ConnectedSpace S] (hS : IsClosedSurface S) + (H : Drawing S) {Δ : Set S} (hΔ : IsClosedDisc Δ) : + ∀ (m : ℕ) {Z : Set S}, Z.Nonempty → IsPreconnected Z → + m + 1 ≤ regionalDistance H Z (univ \ Δ) → + ∃ (C : Fin m → Drawing S) (Λ : Fin m → Set S), + (∀ i : Fin m, (C i).IsSubdrawing H ∧ (C i).IsCircuit ∧ (C i).U ⊆ Δ ∧ + IsOpenDisc (Λ i) ∧ closure (Λ i) ⊆ Δ ∧ subBd (Λ i) = (C i).U ∧ + closure (Λ i) \ (C i).U = Λ i ∧ Z ⊆ Λ i) ∧ + (∀ i j : Fin m, i < j → closure (Λ i) ⊆ Λ j) + | 0, Z, _, _, _ => ⟨Fin.elim0, Fin.elim0, fun i => i.elim0, fun i => i.elim0⟩ + | m + 1, Z, hZne, hZconn, hdist => by + have hk2 : 2 ≤ m + 2 := Nat.le_add_left 2 m + obtain ⟨C₀, Λ₀, hC₀H, hC₀, hC₀U, hOpen₀, hcl₀_sub, hcl₀_disc, hbd₀, hbd_cl₀, hdiff₀, + hZΛ₀, hdist₀⟩ := + theorem_5_3_of_isPreconnected hS H hΔ hZne hZconn hk2 hdist + obtain ⟨C_rest, Λ_rest, hrest, hnest⟩ := + theorem_5_4_aux hS H hΔ m (IsClosedDisc.nonempty hcl₀_disc) + (IsClosedDisc.isPreconnected hcl₀_disc) hdist₀ + refine ⟨Fin.cons C₀ C_rest, Fin.cons Λ₀ Λ_rest, ?_, ?_⟩ + · intro i + refine Fin.cases ?_ (fun j => ?_) i + · exact ⟨hC₀H, hC₀, hC₀U, hOpen₀, hcl₀_sub, hbd₀, hdiff₀, hZΛ₀⟩ + · obtain ⟨h1, h2, h3, h4, h5, h6, h7, h8⟩ := hrest j + exact ⟨h1, h2, h3, h4, h5, h6, h7, (hZΛ₀.trans subset_closure).trans h8⟩ + · intro i j + refine Fin.cases ?_ (fun i' => ?_) i <;> refine Fin.cases ?_ (fun j' => ?_) j <;> intro hij + · exact absurd hij (lt_irrefl 0) + · exact (hrest j').2.2.2.2.2.2.2 + · exact absurd hij (Nat.not_lt_zero _) + · exact hnest i' j' (Fin.succ_lt_succ_iff.mp hij) + +/-- Closed-surface form of Graph Minors XIV (5.4) (page 32): +"Let $H, \Sigma, \Delta, Z, k$ be as in (5.3). Then there are mutually disjoint circuits +$C_1, \dots, C_{k-1}$ of $H$ with $U(C_1), \dots, U(C_{k-1}) \subseteq \Delta$, all bounding +open discs including $Z$." -/ +theorem theorem_5_4_proof [ConnectedSpace S] (hS : IsClosedSurface S) + (H : Drawing S) {Δ Z : Set S} (hΔ : IsClosedDisc Δ) + (_hZ : Z ⊆ Δ \ subBd Δ) (hZne : Z.Nonempty) (hZconn : IsArcConnected Z) + {k : ℕ} (hk2 : 2 ≤ k) (hdist : k ≤ regionalDistance H Z (univ \ Δ)) : + ∃ (C : Fin (k - 1) → Drawing S) (Λ : Fin (k - 1) → Set S), + (∀ i : Fin (k - 1), (C i).IsSubdrawing H ∧ (C i).IsCircuit ∧ (C i).U ⊆ Δ ∧ + IsOpenDisc (Λ i) ∧ closure (Λ i) ⊆ Δ ∧ subBd (Λ i) = (C i).U ∧ Z ⊆ Λ i) ∧ + (∀ i j : Fin (k - 1), i < j → closure (Λ i) ⊆ Λ j) ∧ + Pairwise (fun i j => Disjoint (C i).U (C j).U) := by + have hdist' : (k - 1) + 1 ≤ regionalDistance H Z (univ \ Δ) := by omega + obtain ⟨C, Λ, hprops, hnest⟩ := + theorem_5_4_aux hS H hΔ (k - 1) hZne (IsArcConnected.isPreconnected hZconn) hdist' + refine ⟨C, Λ, fun i => ?_, hnest, ?_⟩ + · obtain ⟨h1, h2, h3, h4, h5, h6, -, h8⟩ := hprops i + exact ⟨h1, h2, h3, h4, h5, h6, h8⟩ + · intro i j hij + have hlt_or_gt : i < j ∨ j < i := lt_or_gt_of_ne hij + have key : ∀ a b : Fin (k - 1), a < b → Disjoint (C a).U (C b).U := by + intro a b hab + have hCa_cl : (C a).U ⊆ closure (Λ a) := by + rw [← (hprops a).2.2.2.2.2.1] + exact fun _ hx => hx.1 + have hsub_b : (C a).U ⊆ Λ b := hCa_cl.trans (hnest a b hab) + have hdiff_b : closure (Λ b) \ (C b).U = Λ b := (hprops b).2.2.2.2.2.2.1 + rw [disjoint_left] + intro x hxa hxb + have hxΛb : x ∈ Λ b := hsub_b hxa + rw [← hdiff_b] at hxΛb + exact hxΛb.2 hxb + rcases hlt_or_gt with h | h + · exact key i j h + · exact (key j i h).symm + +/-- Single-step version of Graph Minors XIV, (5.5) (page 32, used on page 48 in the proof of (9.6)): +if `Z ⊆ Δ \ subBd Δ` is nonempty and preconnected and the regional distance between `Z` and +`subBd Δ` is `≥ k ≥ 2`, there is a circuit `C` of `H` with `U(C) ⊆ Δ \ subBd Δ` bounding an open +disc `Λ` with `closure Λ ⊆ Δ \ subBd Δ`, `Z ⊆ Λ`, and +`regionalDistance H (closure Λ) (subBd Δ) ≥ k - 1`. -/ +theorem theorem_5_5_step_of_isPreconnected [ConnectedSpace S] (hS : IsClosedSurface S) + (H : Drawing S) {Δ Z : Set S} (hΔ : IsClosedDisc Δ) + (hZ : Z ⊆ Δ \ subBd Δ) (hZne : Z.Nonempty) (hZconn : IsPreconnected Z) + {k : ℕ} (hk2 : 2 ≤ k) (hdist : k ≤ regionalDistance H Z (subBd Δ)) : + ∃ (C : Drawing S) (Λ : Set S), + C.IsSubdrawing H ∧ C.IsCircuit ∧ C.U ⊆ Δ \ subBd Δ ∧ + IsOpenDisc Λ ∧ closure Λ ⊆ Δ \ subBd Δ ∧ IsClosedDisc (closure Λ) ∧ + subBd Λ = C.U ∧ subBd (closure Λ) = C.U ∧ closure Λ \ C.U = Λ ∧ + Z ⊆ Λ ∧ k - 1 ≤ regionalDistance H (closure Λ) (subBd Δ) := by + have : T2Space S := hS.2.1 + have hΔcl : IsClosed Δ := hΔ.isCompact.isClosed + have hcl_r_sub : ∀ r ∈ H.R, (closure r ∩ Z).Nonempty → closure r ⊆ Δ \ subBd Δ := by + rintro r hrR ⟨z, hzr, hzZ⟩ + have hdisj_bd : Disjoint (closure r) (subBd Δ) := by + rw [disjoint_left] + intro y hyr hybd + have hchain1 : IsRegionChain H Z (subBd Δ) ![z, y] ![r] := by + refine ⟨hzZ, hybd, fun i => ?_⟩ + fin_cases i + exact ⟨hrR, hzr, hyr⟩ + have hle1 : regionalDistance H Z (subBd Δ) ≤ 1 := regionalDistance_le hchain1 + omega + have hr_disj_fr : Disjoint r (frontier Δ) := by + rw [← subBd_eq_frontier] + exact hdisj_bd.mono_left subset_closure + have hr_sub_Δ : r ⊆ Δ := by + rcases subset_or_disjoint_of_frontier hΔcl (region_isPreconnected hrR) hr_disj_fr with h | h + · exact h + · exfalso + have hz_int : z ∈ interior Δ := by + have hzΔ := hZ hzZ + rw [subBd_eq_frontier] at hzΔ + by_contra hni + exact hzΔ.2 ⟨subset_closure hzΔ.1, hni⟩ + obtain ⟨x, hxi, hxr⟩ := mem_closure_iff.mp hzr (interior Δ) isOpen_interior hz_int + exact disjoint_left.mp h hxr (interior_subset hxi) + have hcl_Δ : closure r ⊆ Δ := hΔcl.closure_subset_iff.mpr hr_sub_Δ + exact fun x hxr => ⟨hcl_Δ hxr, disjoint_left.mp hdisj_bd hxr⟩ + have hsub : ∀ r ∈ H.R, (closure r ∩ Z).Nonempty → r ⊆ Δ \ subBd Δ := + fun r hrR hrZ => subset_closure.trans (hcl_r_sub r hrR hrZ) + obtain ⟨C, Λ, hCH, hC, hCU, hOpenΛ, hclΛ_sub, hclΛ_disc, hbdΛ, hbd_clΛ, hdiffΛ, hZΛ, heR⟩ := + theorem_5_2_full hS H hΔ hZne hZconn hsub + have hCU_int : C.U ⊆ Δ \ subBd Δ := by + rw [C.U_eq] + have he_sub : ∀ e ∈ C.E, closure e ⊆ Δ \ subBd Δ := by + intro e he + obtain ⟨r, hrR, hinc, hrZ⟩ := heR e he + have her := edge_subset_closure_of_incident hS (hCH.2 he) hrR hinc.2.2 + exact (closure_minimal her isClosed_closure).trans (hcl_r_sub r hrR hrZ) + refine union_subset ?_ (iUnion₂_subset he_sub) + intro v hv + obtain ⟨W_walk, -, hpos, -, -⟩ := exists_walk_at hC hv + cases W_walk with + | nil _ => simp at hpos + | @cons _ w _ e hl _ => + have : v ∈ closure e ∩ C.V := by rw [hl.2.2.2]; simp + exact he_sub e hl.1 this.1 + have hclΛ_int : closure Λ ⊆ Δ \ subBd Δ := by + intro x hx + refine ⟨hclΛ_sub hx, fun hxbd => ?_⟩ + rw [subBd_eq_frontier] at hxbd + have hx_fr : x ∈ frontier (closure Λ) := + ⟨subset_closure hx, fun hxi => hxbd.2 (interior_mono hclΛ_sub hxi)⟩ + rw [← subBd_eq_frontier, hbd_clΛ] at hx_fr + exact (hCU_int hx_fr).2 (by rwa [subBd_eq_frontier]) + have hbd_ne : (subBd Δ).Nonempty := by + rw [IsClosedDisc.subBd_eq_discBd hS hΔ] + obtain ⟨f⟩ := hΔ.isOArc_discBd + exact ⟨(f 1).1, (f 1).2⟩ + have hdisj : Disjoint (closure Λ) (subBd Δ) := + disjoint_left.mpr fun _ hx hxbd => (hclΛ_int hx).2 hxbd + have hdist' := regionalDistance_closure_disc_ge hS hCH hC hclΛ_disc hbd_clΛ + (hZΛ.trans subset_closure) hZne hbd_ne hdisj heR hdist + exact ⟨C, Λ, hCH, hC, hCU_int, hOpenΛ, hclΛ_int, hclΛ_disc, hbdΛ, hbd_clΛ, hdiffΛ, hZΛ, hdist'⟩ + +/-- Single-step version of Graph Minors XIV, (5.5) (page 32) for arc-connected `Z`. -/ +theorem theorem_5_5_step [ConnectedSpace S] (hS : IsClosedSurface S) + (H : Drawing S) {Δ Z : Set S} (hΔ : IsClosedDisc Δ) + (hZ : Z ⊆ Δ \ subBd Δ) (hZne : Z.Nonempty) (hZconn : IsArcConnected Z) + {k : ℕ} (hk2 : 2 ≤ k) (hdist : k ≤ regionalDistance H Z (subBd Δ)) : + ∃ (C : Drawing S) (Λ : Set S), + C.IsSubdrawing H ∧ C.IsCircuit ∧ C.U ⊆ Δ \ subBd Δ ∧ + IsOpenDisc Λ ∧ closure Λ ⊆ Δ \ subBd Δ ∧ IsClosedDisc (closure Λ) ∧ + subBd Λ = C.U ∧ Z ⊆ Λ ∧ k - 1 ≤ regionalDistance H (closure Λ) (subBd Δ) := by + obtain ⟨C, Λ, hCH, hC, hCU, hOpenΛ, hclΛ_sub, hclΛ_disc, hbdΛ, -, -, hZΛ, hdist'⟩ := + theorem_5_5_step_of_isPreconnected hS H hΔ hZ hZne (IsArcConnected.isPreconnected hZconn) + hk2 hdist + exact ⟨C, Λ, hCH, hC, hCU, hOpenΛ, hclΛ_sub, hclΛ_disc, hbdΛ, hZΛ, hdist'⟩ + +/-- Inductive helper for (5.5): produces `m` nested circuits and open discs in `Δ \ subBd Δ` around +`Z` when `m + 1 ≤ regionalDistance H Z (subBd Δ)`. -/ +theorem theorem_5_5_aux [ConnectedSpace S] (hS : IsClosedSurface S) + (H : Drawing S) {Δ : Set S} (hΔ : IsClosedDisc Δ) : + ∀ (m : ℕ) {Z : Set S}, Z ⊆ Δ \ subBd Δ → Z.Nonempty → IsPreconnected Z → + m + 1 ≤ regionalDistance H Z (subBd Δ) → + ∃ (C : Fin m → Drawing S) (Λ : Fin m → Set S), + (∀ i : Fin m, (C i).IsSubdrawing H ∧ (C i).IsCircuit ∧ (C i).U ⊆ Δ \ subBd Δ ∧ + IsOpenDisc (Λ i) ∧ closure (Λ i) ⊆ Δ \ subBd Δ ∧ IsClosedDisc (closure (Λ i)) ∧ + subBd (Λ i) = (C i).U ∧ subBd (closure (Λ i)) = (C i).U ∧ + closure (Λ i) \ (C i).U = Λ i ∧ Z ⊆ Λ i) ∧ + (∀ i j : Fin m, i < j → closure (Λ i) ⊆ Λ j) + | 0, Z, _, _, _, _ => ⟨Fin.elim0, Fin.elim0, fun i => i.elim0, fun i => i.elim0⟩ + | m + 1, Z, hZ, hZne, hZconn, hdist => by + have hk2 : 2 ≤ m + 2 := Nat.le_add_left 2 m + obtain ⟨C₀, Λ₀, hC₀H, hC₀, hC₀U, hOpen₀, hcl₀_sub, hcl₀_disc, hbd₀, hbd_cl₀, hdiff₀, + hZΛ₀, hdist₀⟩ := + theorem_5_5_step_of_isPreconnected hS H hΔ hZ hZne hZconn hk2 hdist + obtain ⟨C_rest, Λ_rest, hrest, hnest⟩ := + theorem_5_5_aux hS H hΔ m hcl₀_sub (IsClosedDisc.nonempty hcl₀_disc) + (IsClosedDisc.isPreconnected hcl₀_disc) hdist₀ + refine ⟨Fin.cons C₀ C_rest, Fin.cons Λ₀ Λ_rest, ?_, ?_⟩ + · intro i + refine Fin.cases ?_ (fun j => ?_) i + · exact ⟨hC₀H, hC₀, hC₀U, hOpen₀, hcl₀_sub, hcl₀_disc, hbd₀, hbd_cl₀, hdiff₀, hZΛ₀⟩ + · obtain ⟨h1, h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ := hrest j + exact ⟨h1, h2, h3, h4, h5, h6, h7, h8, h9, (hZΛ₀.trans subset_closure).trans h10⟩ + · intro i j + refine Fin.cases ?_ (fun i' => ?_) i <;> refine Fin.cases ?_ (fun j' => ?_) j <;> intro hij + · exact absurd hij (lt_irrefl 0) + · exact (hrest j').2.2.2.2.2.2.2.2.2 + · exact absurd hij (Nat.not_lt_zero _) + · exact hnest i' j' (Fin.succ_lt_succ_iff.mp hij) + +/-- Closed-surface form of Graph Minors XIV (5.5) (page 32): +"Let $H$ be a drawing in $\Sigma$, and let $\Delta \subseteq \Sigma$ be a closed disc. Let $Z +\subseteq \Delta - \text{bd}(\Delta)$ be non-empty and arc-wise connected, such that the +regional distance between $Z$ and $\text{bd}(\Delta)$ is $\ge k \ge 1$. Then there are $k - +1$ mutually disjoint circuits $C_1, \dots, C_{k-1}$ of $H$ with $U(C_1), \dots, U(C_{k-1}) +\subseteq \Delta - \text{bd}(\Delta)$, all bounding open discs including $Z$." -/ +theorem theorem_5_5_proof [ConnectedSpace S] (hS : IsClosedSurface S) + (H : Drawing S) {Δ Z : Set S} (hΔ : IsClosedDisc Δ) + (hZ : Z ⊆ Δ \ subBd Δ) (hZne : Z.Nonempty) (hZconn : IsArcConnected Z) + {k : ℕ} (hk1 : 1 ≤ k) (hdist : k ≤ regionalDistance H Z (subBd Δ)) : + ∃ (C : Fin (k - 1) → Drawing S) (Λ : Fin (k - 1) → Set S), + (∀ i : Fin (k - 1), (C i).IsSubdrawing H ∧ (C i).IsCircuit ∧ (C i).U ⊆ Δ \ subBd Δ ∧ + IsOpenDisc (Λ i) ∧ closure (Λ i) ⊆ Δ \ subBd Δ ∧ IsClosedDisc (closure (Λ i)) ∧ + subBd (Λ i) = (C i).U ∧ subBd (closure (Λ i)) = (C i).U ∧ + closure (Λ i) \ (C i).U = Λ i ∧ Z ⊆ Λ i) ∧ + (∀ i j : Fin (k - 1), i < j → closure (Λ i) ⊆ Λ j) ∧ + Pairwise (fun i j => Disjoint (C i).U (C j).U) := by + have hdist' : (k - 1) + 1 ≤ regionalDistance H Z (subBd Δ) := by omega + obtain ⟨C, Λ, hprops, hnest⟩ := + theorem_5_5_aux hS H hΔ (k - 1) hZ hZne (IsArcConnected.isPreconnected hZconn) hdist' + refine ⟨C, Λ, hprops, hnest, ?_⟩ + intro i j hij + have hlt_or_gt : i < j ∨ j < i := lt_or_gt_of_ne hij + have key : ∀ a b : Fin (k - 1), a < b → Disjoint (C a).U (C b).U := by + intro a b hab + have hCa_cl : (C a).U ⊆ closure (Λ a) := by + rw [← (hprops a).2.2.2.2.2.2.1] + exact fun _ hx => hx.1 + have hsub_b : (C a).U ⊆ Λ b := hCa_cl.trans (hnest a b hab) + have hdiff_b : closure (Λ b) \ (C b).U = Λ b := (hprops b).2.2.2.2.2.2.2.2.1 + rw [disjoint_left] + intro x hxa hxb + have hxΛb : x ∈ Λ b := hsub_b hxa + rw [← hdiff_b] at hxΛb + exact hxΛb.2 hxb + rcases hlt_or_gt with h | h + · exact key i j h + · exact (key j i h).symm + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section6.lean b/LeanPool/GraphMinor/GM14/Section6.lean new file mode 100644 index 0000000000..9b5c73a35d --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section6.lean @@ -0,0 +1,341 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section6a +public import LeanPool.GraphMinor.GM14.Section6b +public import LeanPool.GraphMinor.GM14.Section6c +public import LeanPool.GraphMinor.GM14.Section8a +public import LeanPool.GraphMinor.GM14.Cited +public import LeanPool.GraphMinor.GM14.Adapted +public import LeanPool.GraphMinor.GM14.RigidExtension +public import LeanPool.GraphMinor.GM14.RigidSegregation + +/-! +# Graph Minors XIV, Section 6: Rigidity + +This file completes the formalization of Section 6 ("Rigidity", pages 33–35) of +N. Robertson and P. D. Seymour, *Graph Minors. XIV. Extending an embedding*, J. Combin. Theory +Ser. B **65** (1995) 23–50, re-exporting `GraphMinor.GM14.Section6a` (`(6.1)`, `(6.2)`), +`GraphMinor.GM14.Section6b`, and `GraphMinor.GM14.Section6c` (`(6.3)`), and proving: + +- `theorem_6_4` (Graph Minors XIV, (6.4), page 34): an isomorphism between drawings `H₁, H₂` in a + closed disc `Δ` that is the identity on `V(H₁) ∩ bd(Δ)` extends to a homeomorphism of `Δ` when + `H₁` is rigid in `Δ`, from `Whitney.extension_64`. +- `claim_2_three_disjoint_paths_to_bar_6_5` and `theorem_6_5` + (Graph Minors XIV, (6.5), pages 34–35): any arrangement `α` of a 3-segregation of `G` in `Δ` that + fixes `V(H) ∩ bd(Δ)` can be modified to an arrangement `α'` compatible with `H`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 + GraphMinor.GM11 + +universe u v w + +variable {S : Type u} [TopologicalSpace S] + +/-! ## Homeomorphism Pushforwards for Surface Arrangements -/ + +/-- If `y ∈ f '' D` for a homeomorphism `f : S ≃ₜ S`, then `f.symm y ∈ D`. -/ +theorem symm_mem_of_mem_image (f : S ≃ₜ S) {D : Set S} (y : f '' D) : f.symm y.1 ∈ D := by + rcases y with ⟨_, x, hx, rfl⟩ + simpa using hx + +/-- Restriction of a homeomorphism `f : S ≃ₜ S` to a subset `D : Set S` onto `f '' D`. -/ +def homeomorphImageSet (f : S ≃ₜ S) (D : Set S) : D ≃ₜ f '' D where + toFun x := ⟨f x.1, mem_image_of_mem f x.2⟩ + invFun y := ⟨f.symm y.1, symm_mem_of_mem_image f y⟩ + left_inv x := Subtype.ext (f.symm_apply_apply x.1) + right_inv y := Subtype.ext (f.apply_symm_apply y.1) + continuous_toFun := + (f.continuous.comp continuous_subtype_val).subtype_mk (fun x => mem_image_of_mem f x.2) + continuous_invFun := + (f.symm.continuous.comp continuous_subtype_val).subtype_mk (symm_mem_of_mem_image f) + +/-- The image of a closed disc under a homeomorphism of `S` is a closed disc. -/ +theorem isClosedDisc_image_homeomorph {D : Set S} (hD : IsClosedDisc D) + (f : S ≃ₜ S) : IsClosedDisc (f '' D) := by + obtain ⟨φ⟩ := hD + exact ⟨φ.trans (homeomorphImageSet f D)⟩ + +/-- The image of an `O`-arc under a homeomorphism of `S` is an `O`-arc. -/ +theorem isOArc_image_homeomorph {F : Set S} (hF : IsOArc F) (f : S ≃ₜ S) : + IsOArc (f '' F) := by + obtain ⟨φ⟩ := hF + exact ⟨φ.trans (homeomorphImageSet f F)⟩ + +/-- A homeomorphism `f : S ≃ₜ S` commutes with `subBd`. -/ +theorem image_subBd (f : S ≃ₜ S) (D : Set S) : f '' subBd D = subBd (f '' D) := by + rw [subBd_eq_frontier, subBd_eq_frontier, Homeomorph.image_frontier] + +/-- A homeomorphism `f : S ≃ₜ S` preserves interior points of `S`. -/ +theorem isInteriorPoint_map_iff (f : S ≃ₜ S) (x : S) : + IsInteriorPoint (f x) ↔ IsInteriorPoint x := by + constructor + · rintro ⟨U, hU, hfxU, ⟨φ⟩⟩ + refine ⟨f.symm '' U, f.symm.isOpenMap U hU, ⟨f x, hfxU, f.symm_apply_apply x⟩, ?_⟩ + exact ⟨(homeomorphImageSet f.symm U).symm.trans φ⟩ + · rintro ⟨U, hU, hxU, ⟨φ⟩⟩ + refine ⟨f '' U, f.isOpenMap U hU, mem_image_of_mem f hxU, ?_⟩ + exact ⟨(homeomorphImageSet f U).symm.trans φ⟩ + +/-- A homeomorphism `f : S ≃ₜ S` preserves `bd S`. -/ +theorem mem_bd_map_iff (f : S ≃ₜ S) (x : S) : f x ∈ bd S ↔ x ∈ bd S := + not_congr (isInteriorPoint_map_iff f x) + +/-- Pushing a surface arrangement through a homeomorphism `f : S ≃ₜ S` yields a surface +arrangement. -/ +theorem IsSurfaceArrangement.map_homeomorph {α : Type v} {β : Type w} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + (harr : IsSurfaceArrangement S_seg α_disc α_pt) (f : S ≃ₜ S) : + IsSurfaceArrangement S_seg (fun S₀ => f '' α_disc S₀) (fun x => f (α_pt x)) where + isClosedDisc S₀ hS₀ := by + obtain ⟨hd, hpt⟩ := harr.isClosedDisc S₀ hS₀ + refine ⟨isClosedDisc_image_homeomorph hd f, fun x hx => ?_⟩ + rw [← image_subBd] + exact mem_image_of_mem f (hpt x hx) + inter_discs S₁ hS₁ S₂ hS₂ hne := by + rw [← image_inter f.injective] + exact (image_mono (harr.inter_discs S₁ hS₁ S₂ hS₂ hne)).trans (by rw [image_image]) + inter_bd S₀ hS₀ := by + rintro _ ⟨⟨z, hzD, rfl⟩, hzbd⟩ + have hz_in : z ∈ α_disc S₀ ∩ bd S := ⟨hzD, (mem_bd_map_iff f z).mp hzbd⟩ + obtain ⟨v, hv, rfl⟩ := harr.inter_bd S₀ hS₀ hz_in + exact ⟨v, hv, rfl⟩ + injOn_pts := f.injective.comp_injOn harr.injOn_pts + natural_order S₀ hS₀ := by + obtain ⟨hFo, φ, hpt, hcw⟩ := harr.natural_order S₀ hS₀ + rw [← image_subBd] + refine ⟨isOArc_image_homeomorph hFo f, φ.trans (homeomorphImageSet f (subBd (α_disc S₀))), + ?_, ?_⟩ + · intro v hv + exact mem_image_of_mem f (hpt v hv) + · intro v₁ v₂ v₃ h123 + obtain ⟨t₁, t₂, t₃, ht12, ht23, htpi, h1, h2, h3⟩ := hcw v₁ v₂ v₃ h123 + refine ⟨t₁, t₂, t₃, ht12, ht23, htpi, ?_, ?_, ?_⟩ + · change f (φ (Circle.exp t₁)).1 = f (α_pt v₁); rw [h1] + · change f (φ (Circle.exp t₂)).1 = f (α_pt v₂); rw [h2] + · change f (φ (Circle.exp t₃)).1 = f (α_pt v₃); rw [h3] + +/-! ## Theorems (6.4) and (6.5) -/ + +variable [T2Space S] + +/-- **Graph Minors XIV, (6.4)** (page 34): +"Let $\Delta$ be a closed disc, let $H_1, H_2$ be drawings in $\Delta$ with $V(H_1) \cap +\text{bd}(\Delta) = V(H_2) \cap \text{bd}(\Delta)$, and let $\phi \colon H_1 \to H_2$ be an +isomorphism such that $\phi(v) = v$ for all $v \in V(H_1) \cap \text{bd}(\Delta)$. If $H_1$ is +rigid in $\Delta$ then there is a homeomorphism $\psi \colon \Delta \to \Delta$ extending $\phi$." +-/ +theorem theorem_6_4_proof {Δ : Set S} (hΔ : IsClosedDisc Δ) (hbdΔ : subBd Δ = discBd Δ) + {H₁ H₂ : Drawing S} (hH₁Δ : H₁.U ⊆ Δ) (hH₂Δ : H₂.U ⊆ Δ) + (hH₁bd : H₁.U ∩ subBd Δ ⊆ H₁.V) (hH₂bd : H₂.U ∩ subBd Δ ⊆ H₂.V) + (hbdV : H₁.V ∩ subBd Δ = H₂.V ∩ subBd Δ) + (φ : Iso H₁.toGraph H₂.toGraph) + (hφ_bd : ∀ v : V(H₁.toGraph), v.1 ∈ subBd Δ → (φ.vertexEquiv v).1 = v.1) + (hrigid : ∀ F : Set S, F ⊆ Δ → IsOArc F → F ∩ H₁.U ⊆ H₁.V → + (F ∩ H₁.V).ncard ≤ 2 → ∃ Δ' : Set S, Δ' ⊆ Δ ∧ IsDial H₁ F Δ') : + ∃ ψ : S ≃ₜ S, + ψ '' Δ = Δ ∧ + (∀ v : V(H₁.toGraph), ψ v.1 = (φ.vertexEquiv v).1) ∧ + (∀ e : E(H₁.toGraph), ψ '' e.1 = (φ.edgeEquiv e).1) ∧ + ψ '' H₁.V = H₂.V ∧ + ψ '' H₁.U = H₂.U ∧ + (∀ v ∈ H₁.V ∩ subBd Δ, ψ v = v) ∧ + (∀ x ∈ subBd Δ, ψ x = x) := by + obtain ⟨ψ, hψΔ, hψ_bd, hψHV, hψHE⟩ := + Whitney.extension_64 hΔ hbdΔ hH₁Δ hH₂Δ hH₁bd hH₂bd hbdV φ hφ_bd hrigid + have hVH : ψ '' H₁.V = H₂.V := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + have := hψHV ⟨x, hx⟩ + rw [this] + exact (φ.vertexEquiv ⟨x, hx⟩).2 + · intro hy + let v : V(H₁.toGraph) := φ.vertexEquiv.symm ⟨y, hy⟩ + refine ⟨v.1, v.2, ?_⟩ + rw [hψHV v, Equiv.apply_symm_apply] + have hUH : ψ '' H₁.U = H₂.U := by + rw [H₁.U_eq, H₂.U_eq, image_union, hVH] + refine congrArg (H₂.V ∪ ·) ?_ + ext y + simp only [mem_image, mem_iUnion, exists_prop] + constructor + · rintro ⟨x, ⟨e, he, hxe⟩, rfl⟩ + let e' : E(H₂.toGraph) := φ.edgeEquiv ⟨e, he⟩ + refine ⟨e'.1, e'.2, ?_⟩ + rw [← hψHE ⟨e, he⟩, ← Homeomorph.image_closure ψ] + exact mem_image_of_mem ψ hxe + · rintro ⟨f, hf, hyf⟩ + let e : E(H₁.toGraph) := φ.edgeEquiv.symm ⟨f, hf⟩ + have he_eq : ψ '' e.1 = f := by + simpa [e] using hψHE e + have hcl_eq : ψ '' closure e.1 = closure f := by + rw [Homeomorph.image_closure ψ, he_eq] + rw [← hcl_eq] at hyf + obtain ⟨x, hxe, rfl⟩ := hyf + exact ⟨x, ⟨e.1, e.2, hxe⟩, rfl⟩ + refine ⟨ψ, hψΔ, hψHV, hψHE, hVH, hUH, ?_, hψ_bd⟩ + rintro v ⟨hvV, hvbd⟩ + have h1 := hψHV ⟨v, hvV⟩ + have h2 := hφ_bd ⟨v, hvV⟩ hvbd + exact h1.trans h2 + +omit [T2Space S] in +/-- **Graph Minors XIV, (6.5), Claim (2), path-truncation step** (page 35): +Let `(A_H, B_H)` be the separation of `H` induced by `(A, Ω) ∈ S_seg` with +`V(A_H) ∩ V(B_H) = Ω_bar_H` and `|S₀.Ω.bar| ≤ 3`. If `A_H` contains a circuit `C` and there are +three mutually vertex-disjoint paths in `H` from `V(C)` to `V(B_H) ∪ Ω_bar_H` (by Claim (1), since +`V(H) ∩ bd(Δ) ⊆ V(B_H) ∪ Ω_bar_H`), then there are three mutually vertex-disjoint paths in `A_H` +from `V(C)` to `S₀.Ω.bar`, and hence `S₀.Ω.bar ⊆ V(A_H)` and `PreservesBarPaths S₀ A_H`. -/ +theorem claim_2_three_disjoint_paths_to_bar_6_5 {α : Type v} {β : Type w} + {H_G A_H B_H C : Graph α β} {S₀ : Society α β} + (hSep : IsGraphSeparation H_G A_H B_H) + (hInter : V(A_H) ∩ V(B_H) = S₀.Ω.bar) + (hBar3 : S₀.Ω.bar.ncard ≤ 3) + (hC : IsGraphCircuit A_H C) + {P : Fin 3 → Graph α β} {u v : Fin 3 → α} + (hP : ∀ i, IsGraphPathWithEnds H_G (P i) (u i) (v i) ∧ u i ∈ V(C) ∧ v i ∈ V(B_H) ∪ S₀.Ω.bar) + (hDisj : Pairwise (fun i j => Disjoint V(P i) V(P j))) : + (∃ (Q : Fin 3 → Graph α β) (x y : Fin 3 → α), + (∀ i, Q i ≤ P i ∧ IsFromToPathWithEnds A_H (Q i) V(C) S₀.Ω.bar (x i) (y i)) ∧ + Pairwise (fun i j => Disjoint V(Q i) V(Q j))) ∧ + S₀.Ω.bar ⊆ V(A_H) ∧ E(A_H).Nonempty ∧ PreservesBarPaths S₀ A_H := by + obtain ⟨Q, x, y, hQ, hQ_disj⟩ := + exists_three_disjoint_paths_from_circuit_to_bar hSep hInter hC.1 hP hDisj + refine ⟨⟨Q, x, y, hQ, hQ_disj⟩, + preservesBarPaths_of_three_disjoint_paths_from_circuit hBar3 hC (fun i => (hQ i).2) hQ_disj⟩ + +/-- **Graph Minors XIV, (6.5)** (pages 34–35): +"Let $H$ be a rigid drawing in a closed disc $\Delta$. Let $H$ be a subgraph of $G$, let +$\mathscr{S}$ be a 3-segregation of $G$ with $V(H) \cap \text{bd}(\Delta) \subseteq +V(\mathscr{S})$, and let $\alpha$ be an arrangement of $\mathscr{S}$ in $\Delta$ such that +$\alpha(v) = v$ for all $v \in V(H) \cap \text{bd}(\Delta)$. Then there is an arrangement +$\alpha'$ of $\mathscr{S}$ in $\Delta$ such that $\alpha'$ is compatible with $H$." -/ +theorem theorem_6_5_proof {α : Type v} {β : Type w} + {G : Graph α β} {H : Drawing S} {Δ : Set S} (hΔ : IsClosedDisc Δ) (hbdΔ : subBd Δ = discBd Δ) + (hHΔ : H.U ⊆ Δ) (hHbd : H.U ∩ subBd Δ ⊆ H.V) + (hrigid : ∀ F : Set S, F ⊆ Δ → IsOArc F → F ∩ H.U ⊆ H.V → + (F ∩ H.V).ncard ≤ 2 → ∃ Δ' : Set S, Δ' ⊆ Δ ∧ IsDial H F Δ') + (η : SpanEmbedding H G) + {S_seg : Set (Society α β)} (hseg : IsThreeSegregation G S_seg) + (hbd_in_seg : ∀ v ∈ H.V ∩ subBd Δ, η.vMap v ∈ segregationVertices S_seg) + {α_disc : Society α β → Set S} {α_pt : α → S} + (harr : IsSurfaceArrangement S_seg α_disc α_pt) + (harr_Δ : ∀ S₀ ∈ S_seg, α_disc S₀ ⊆ Δ) + (hα_id : ∀ v ∈ H.V ∩ subBd Δ, α_pt (η.vMap v) = v) + (hα_bd : ∀ v ∈ H.V, η.vMap v ∈ segregationVertices S_seg → α_pt (η.vMap v) ∈ subBd Δ → + v ∈ subBd Δ) : + ∃ (α'_disc : Society α β → Set S) (α'_pt : α → S), + IsSurfaceArrangement S_seg α'_disc α'_pt ∧ + (∀ S₀ ∈ S_seg, α'_disc S₀ ⊆ Δ) ∧ + IsCompatibleWith G H η S_seg α'_disc α'_pt ∧ + (∀ x, α_pt x ∈ subBd Δ → α'_pt x = α_pt x) ∧ + (∀ x, α_pt x ∈ Δ \ subBd Δ → α'_pt x ∈ Δ \ subBd Δ) ∧ + (∀ S₀ ∈ S_seg, α'_disc S₀ ∩ subBd Δ = α_disc S₀ ∩ subBd Δ) := by + obtain ⟨H', φ, hH'Δ, hH'bd, hbdV, h_i, h_ii⟩ := + Whitney.union_drawing_65 hΔ hbdΔ hHΔ hHbd hrigid η hseg hbd_in_seg harr harr_Δ hα_id hα_bd + -- From (i), `φ(v) = v` for all `v ∈ V(H) ∩ bd(Δ)` since `α(v) = v` on `V(H) ∩ bd(Δ)`. + have hφ_bd : ∀ v : V(H.toGraph), v.1 ∈ subBd Δ → (φ.vertexEquiv v).1 = v.1 := by + intro v hvbd + have hv_mem : v.1 ∈ H.V ∩ subBd Δ := ⟨v.2, hvbd⟩ + have h1 := (h_i v (hbd_in_seg v.1 hv_mem)).symm + have h2 := hα_id v.1 hv_mem + exact h1.trans h2 + -- By (6.4), there is a homeomorphism `ψ : Δ → Δ` extending `φ`. + obtain ⟨ψ, hψΔ, hψV, hψE, _, hψHU, _, hψ_bd⟩ := + theorem_6_4_proof hΔ hbdΔ hHΔ hH'Δ hHbd hH'bd hbdV φ hφ_bd hrigid + -- Define `α'(A, Ω) = ψ⁻¹(α(A, Ω))` and `α'(v) = ψ⁻¹(α(v))`. + let α'_disc : Society α β → Set S := fun S₀ => ψ.symm '' α_disc S₀ + let α'_pt : α → S := fun x => ψ.symm (α_pt x) + have hψ_symm_bd : ∀ y ∈ subBd Δ, ψ.symm y = y := fun y hy => + ψ.symm_apply_eq.mpr (hψ_bd y hy).symm + refine ⟨α'_disc, α'_pt, harr.map_homeomorph ψ.symm, ?_, ?_, ?_, ?_, ?_⟩ + · intro S₀ hS₀ + rintro _ ⟨y, hy, rfl⟩ + have hyΔ : y ∈ ψ '' Δ := hψΔ.symm ▸ harr_Δ S₀ hS₀ hy + obtain ⟨x, hxΔ, rfl⟩ := hyΔ + simpa using hxΔ + · refine ⟨?_, ?_, ?_, ?_⟩ + · -- `(i)` `α'(η(v)) = v` for `v ∈ V(H)` with `η(v) ∈ V(S_seg)`. + intro v hvV hsegv + change ψ.symm (α_pt (η.vMap v)) = v + rw [h_i ⟨v, hvV⟩ hsegv, ← hψV ⟨v, hvV⟩, ψ.symm_apply_apply] + · -- `(ii)` `U(H) ∩ bd(α'(A, Ω)) = {v ∈ V(H) : η(v) ∈ ΩBar}`. + intro S₀ hS₀ + obtain ⟨hbd_S₀, -, -⟩ := h_ii S₀ hS₀ + ext x + simp only [α'_disc, ← image_subBd ψ.symm (α_disc S₀), mem_inter_iff] + constructor + · rintro ⟨hxU, y, hybd, rfl⟩ + have hyH'U : y ∈ H'.U := by + rw [← hψHU] + exact ⟨ψ.symm y, hxU, ψ.apply_symm_apply y⟩ + have hy_in : y ∈ H'.U ∩ subBd (α_disc S₀) := ⟨hyH'U, hybd⟩ + rw [hbd_S₀] at hy_in + obtain ⟨v, rfl, hv_bar⟩ := hy_in + rw [← hψV v, ψ.symm_apply_apply] + exact ⟨v.2, hv_bar⟩ + · rintro ⟨hxV, hx_bar⟩ + refine ⟨H.V_subset_U hxV, ψ x, ?_, ψ.symm_apply_apply x⟩ + have hxH' : ψ x ∈ H'.U ∩ subBd (α_disc S₀) := by + rw [hbd_S₀] + exact ⟨⟨x, hxV⟩, (hψV ⟨x, hxV⟩).symm, hx_bar⟩ + exact hxH'.2 + · -- `(ii)` `v ∈ α'(A, Ω) ↔ η(v) ∈ V(A)` for `v ∈ V(H)`. + intro S₀ hS₀ v hvV + obtain ⟨-, hV_S₀, -⟩ := h_ii S₀ hS₀ + have h1 := (hV_S₀ ⟨v, hvV⟩).symm + have h2 : ψ v = (φ.vertexEquiv ⟨v, hvV⟩).1 := hψV ⟨v, hvV⟩ + rw [h1, ← h2] + exact ⟨fun ⟨y, hy, hy_eq⟩ => by rwa [← hy_eq, ψ.apply_symm_apply], + fun h => ⟨ψ v, h, ψ.symm_apply_apply v⟩⟩ + · -- `(ii)` `e ⊆ α'(A, Ω) ↔ η(e) ∈ E(A)` for `e ∈ E(H)`. + intro S₀ hS₀ e heE + obtain ⟨-, -, hE_S₀⟩ := h_ii S₀ hS₀ + have h1 := (hE_S₀ ⟨e, heE⟩).symm + have h2 : ψ '' e = (φ.edgeEquiv ⟨e, heE⟩).1 := hψE ⟨e, heE⟩ + rw [h1, ← h2] + constructor + · rintro hsub _ ⟨x, hxe, rfl⟩ + obtain ⟨y, hy, hy_eq⟩ := hsub hxe + rwa [← hy_eq, ψ.apply_symm_apply] + · intro hsub x hxe + exact ⟨ψ x, hsub (mem_image_of_mem ψ hxe), ψ.symm_apply_apply x⟩ + · intro x hx + exact hψ_symm_bd (α_pt x) hx + · rintro x ⟨hxΔ, hxnot⟩ + refine ⟨?_, fun hbd => hxnot ?_⟩ + · have hyΔ : α_pt x ∈ ψ '' Δ := hψΔ.symm ▸ hxΔ + obtain ⟨y, hy, hy_eq⟩ := hyΔ + simpa [α'_pt, ← hy_eq] using hy + · have h_eq := hψ_bd (ψ.symm (α_pt x)) hbd + rw [ψ.apply_symm_apply] at h_eq + rw [h_eq] + exact hbd + · intro S₀ hS₀ + ext y + simp only [α'_disc, mem_inter_iff, mem_image] + constructor + · rintro ⟨⟨z, hz, rfl⟩, hybd⟩ + have hz_eq : ψ.symm z = z := by + have h1 := hψ_bd (ψ.symm z) hybd + rw [ψ.apply_symm_apply] at h1 + exact h1.symm + refine ⟨?_, hybd⟩ + rwa [hz_eq] + · rintro ⟨hyS₀, hybd⟩ + exact ⟨⟨y, hyS₀, hψ_symm_bd y hybd⟩, hybd⟩ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section6a.lean b/LeanPool/GraphMinor/GM14/Section6a.lean new file mode 100644 index 0000000000..8261a80448 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section6a.lean @@ -0,0 +1,533 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.GM14.DiscSlope +public import LeanPool.GraphMinor.GM14.Section3 +public import LeanPool.GraphMinor.GM11.RadialFaces +import LeanPool.GraphMinor.Surface.Collar + +/-! +# Graph Minors XIV, Section 6 (Part 1): Rigidity in Subsurfaces and Regions of Rigid Drawings + +This file formalizes the first part of Section 6 (pages 33–34) of N. Robertson and P. D. Seymour, +*Graph Minors. XIV. Extending an embedding*, J. Combin. Theory Ser. B **65** (1995) 23–50: + +- `IsRigidIn`: rigidity of a drawing `H` inside a subset `S' ⊆ Σ`. +- `no_circuit_in_dial`: a dial `Δ` for `F, H` cannot contain any circuit `C` of `H`. +- `theorem_6_1`: Graph Minors XIV, (6.1) (page 33), showing that if `H` is rigid in `Σ` and + `Σ' ⊆ Σ` is a subsurface with `bd(Σ') ∩ U(H) ⊆ V(H)` such that every closed disc `Δ' ⊆ Σ` with + `Δ' ∩ Σ' = bd(Δ') ⊆ bd(Σ')` contains a circuit of `H`, then `H ∩ Σ'` is rigid in `Σ'`, together + with concrete instances for `Σ \ Λ`, closed discs `Δ₀`, and cylinders `Δ₀ \ (Δ₂ \ bd(Δ₂))`. +- `theorem_6_2`: Graph Minors XIV, (6.2) (page 33), showing that around any vertex `v ∈ V(H)` of a + rigid drawing `H`, the incident regions in cyclic order around `v` are all distinct + (`corner_regions_injective`), and every region `r ∈ H.R` is simply-connected + (`isArcSimplyConnected_region`) and (when `U(H) ≠ ∅`) an open disc + (`isOpenDisc_region_of_isRigid`). +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Graph Hypergraph unitInterval +open GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Rigidity in a Subset and Basic Dial Lemmas -/ + +/-- `H` is a rigid drawing in `S' ⊆ Σ` if for every `O`-arc `F ⊆ S'` with `F ∩ U(H) ⊆ V(H)` and +`|F ∩ V(H)| ≤ 2`, there is a dial `Δ ⊆ S'` for `F, H` +(Graph Minors XIV, Section 4, page 29, and Section 6, page 33). -/ +def IsRigidIn [T1Space S] (H : Drawing S) (S' : Set S) : Prop := + ∀ F : Set S, F ⊆ S' → IsOArc F → F ∩ H.U ⊆ H.V → (F ∩ H.V).ncard ≤ 2 → + ∃ Δ : Set S, Δ ⊆ S' ∧ IsDial H F Δ + +/-- Rigidity in `univ` is equivalent to `IsRigid`. -/ +theorem isRigidIn_univ_iff [T1Space S] {H : Drawing S} : + IsRigidIn H univ ↔ IsRigid H := by + constructor + · intro h F hF hFU hFV + obtain ⟨Δ, _, hDial⟩ := h F (subset_univ F) hF hFU hFV + exact ⟨Δ, hDial⟩ + · intro h F _ hF hFU hFV + obtain ⟨Δ, hDial⟩ := h F hF hFU hFV + exact ⟨Δ, subset_univ Δ, hDial⟩ + +/-- Two drawings with the same point set and vertex set are equal. -/ +theorem Drawing.ext_UV {Γ₁ Γ₂ : Drawing S} (hU : Γ₁.U = Γ₂.U) (hV : Γ₁.V = Γ₂.V) : + Γ₁ = Γ₂ := by + cases Γ₁ + cases Γ₂ + congr + +/-- Two drawings with the same vertex set and edge set are equal. -/ +theorem Drawing.ext_VE {Γ₁ Γ₂ : Drawing S} (hV : Γ₁.V = Γ₂.V) (hE : Γ₁.E = Γ₂.E) : + Γ₁ = Γ₂ := by + refine Drawing.ext_UV ?_ hV + rw [Γ₁.U_eq, Γ₂.U_eq, hV, hE] + +/-- A path drawing `P` between distinct vertices `u ≠ v` cannot contain the point set of a circuit +`C`. -/ +theorem no_circuit_in_path [T2Space S] {P C : Drawing S} {u v : S} + (hP : P.IsPathBetween u v) (huv : u ≠ v) (hC : C.IsCircuit) (hsub : C.U ⊆ P.U) : False := by + obtain ⟨φ_L, _, _⟩ := isLine_of_isPathBetween hP huv + obtain ⟨φ_C⟩ := isOArc_of_isCircuit hC + let f : Circle → ℝ := fun z => (φ_L.symm ⟨(φ_C z).1, hsub (φ_C z).2⟩).1 + have hf_cont : Continuous f := by fun_prop + have hf_inj : Function.Injective f := by + intro z₁ z₂ hz + have h₁ := φ_L.symm.injective (Subtype.ext hz) + have h₂ : (φ_C z₁).1 = (φ_C z₂).1 := congrArg (·.1) h₁ + exact φ_C.injective (Subtype.ext h₂) + exact not_injective_circle_real hf_cont hf_inj + +/-- A dial `Δ` for `F, H` (where `F ∩ U(H) ⊆ V(H)`) cannot contain any circuit `C` of `H`. -/ +theorem no_circuit_in_dial [T2Space S] {H C : Drawing S} {F Δ : Set S} + (hDial : IsDial H F Δ) (hFV : F ∩ H.U ⊆ H.V) + (hC : C.IsCircuit) (hCs : C.IsSubdrawing H) (hCU : C.U ⊆ Δ) : False := by + rcases hDial.2.2 with h1 | ⟨u, v, huv, _, hP⟩ + · obtain ⟨e, he⟩ := IsCircuit.E_nonempty hC + obtain ⟨x, hxe⟩ := he.1 + have hxCU : x ∈ C.U := (he.2.1 hxe).1 + have hxHU : x ∈ H.U := hCs.U_subset hxCU + have hxF : x ∈ F := h1 ⟨hCU hxCU, hxHU⟩ + have hxV : x ∈ H.V := hFV ⟨hxF, hxHU⟩ + have heH : e ∈ H.E := hCs.2 he + exact (heH.2.1 hxe).2 hxV + · have hsub : C.U ⊆ (H.interSet Δ).U := by + intro x hx + by_cases hxV : x ∈ C.V + · exact (H.interSet Δ).V_subset_U (Or.inl ⟨⟨hCs.1 hxV, hCU hx⟩, hCs.1 hxV⟩) + · obtain ⟨e, he, hxe⟩ := C.exists_edge_of_mem hx hxV + have heH : e ∈ H.E := hCs.2 he + have heΔ : e ⊆ Δ := fun z hz => hCU (he.2.1 hz).1 + have he_inter : e ∈ (H.interSet Δ).E := by + change e ∈ (H.span _ _).E + rw [H.span_E] + exact ⟨⟨heH, heΔ⟩, heH⟩ + exact (H.interSet Δ).closure_subset_U he_inter (subset_closure hxe) + exact no_circuit_in_path hP huv hC hsub + +/-! ## 2. Subdrawings on Closed Subsets `S'` with `subBd S' ∩ U(H) ⊆ V(H)` -/ + +/-- Iterated `interSet` for `Δ ⊆ S'` equals `H.interSet Δ`. -/ +theorem interSet_interSet_of_subset [T2Space S] (H : Drawing S) {S' Δ : Set S} (hsub : Δ ⊆ S') : + (H.interSet S').interSet Δ = H.interSet Δ := by + have hE_S' : (H.interSet S').E = {e ∈ H.E | e ⊆ S'} := by + change (H.span _ _).E = _ + rw [H.span_E] + ext e + simp only [mem_inter_iff, mem_ofPred_eq] + tauto + have hE_set : {e | e ∈ (H.interSet S').E ∧ e ⊆ Δ} ∩ (H.interSet S').E = + {e | e ∈ H.E ∧ e ⊆ Δ} ∩ H.E := by + rw [hE_S'] + ext e + simp only [mem_inter_iff, mem_ofPred_eq] + exact ⟨fun ⟨⟨⟨he, _⟩, heΔ⟩, _⟩ => ⟨⟨he, heΔ⟩, he⟩, + fun ⟨⟨he, heΔ⟩, _⟩ => ⟨⟨⟨he, heΔ.trans hsub⟩, heΔ⟩, he, heΔ.trans hsub⟩⟩ + have hE_eq : ((H.interSet S').interSet Δ).E = (H.interSet Δ).E := by + change ((H.interSet S').span _ _).E = (H.span _ _).E + rw [(H.interSet S').span_E, H.span_E, hE_set] + have hV_sub1 : H.V ∩ S' ⊆ (H.interSet S').V := fun x hx => Or.inl ⟨hx, hx.1⟩ + have hV_sub2 : (H.interSet S').V ⊆ H.V := H.spanV_subset _ _ + have hV_inter : (H.interSet S').V ∩ Δ = H.V ∩ Δ := by + ext x + exact ⟨fun ⟨hxV, hxΔ⟩ => ⟨hV_sub2 hxV, hxΔ⟩, + fun ⟨hxV, hxΔ⟩ => ⟨hV_sub1 ⟨hxV, hsub hxΔ⟩, hxΔ⟩⟩ + have hV_eq : ((H.interSet S').interSet Δ).V = (H.interSet Δ).V := by + change (H.interSet S').spanV ((H.interSet S').V ∩ Δ) _ = H.spanV (H.V ∩ Δ) _ + unfold Drawing.spanV + rw [hE_set, hV_inter] + ext x + simp only [mem_union, mem_inter_iff, mem_iUnion] + refine or_congr + ⟨fun ⟨hx, _⟩ => ⟨hx, hx.1⟩, fun ⟨hx, _⟩ => ⟨hx, hV_sub1 ⟨hx.1, hsub hx.2⟩⟩⟩ ⟨?_, ?_⟩ + · rintro ⟨e, he, hxe, hxV⟩ + exact ⟨e, he, hxe, hV_sub2 hxV⟩ + · rintro ⟨e, he, hxe, hxV⟩ + have heS' : e ∈ {e | e ∈ H.E ∧ e ⊆ S'} ∩ H.E := + ⟨⟨he.2, he.1.2.trans hsub⟩, he.2⟩ + exact ⟨e, he, hxe, Or.inr (mem_iUnion₂.mpr ⟨e, heS', hxe, hxV⟩)⟩ + exact Drawing.ext_VE hV_eq hE_eq + +/-- If `S'` is closed and `subBd S' ∩ U(H) ⊆ V(H)`, every edge of `H` that meets `S'` is contained +in `S'`. -/ +theorem edge_subset_of_inter_nonempty {H : Drawing S} {S' e : Set S} + (hS'_cl : IsClosed S') (hbd : subBd S' ∩ H.U ⊆ H.V) (he : e ∈ H.E) + (hmeet : (e ∩ S').Nonempty) : e ⊆ S' := by + obtain ⟨x, hxe, hxS'⟩ := hmeet + have hdis : Disjoint e (frontier S') := by + rw [← subBd_eq_frontier] + refine disjoint_left.mpr fun y hye hybd => ?_ + have hyU : y ∈ H.U := (he.2.1 hye).1 + have hyV : y ∈ H.V := hbd ⟨hybd, hyU⟩ + exact (he.2.1 hye).2 hyV + exact subset_of_disjoint_frontier he.2.2.1.isConnected.isPreconnected hS'_cl hdis hxe hxS' + +/-- If `S'` is closed and every edge of `H` meeting `S'` is contained in `S'`, then +`(H.interSet S').V = H.V ∩ S'` and `(H.interSet S').U = H.U ∩ S'`. -/ +theorem interSet_V_and_U_of_edges [T2Space S] {H : Drawing S} {S' : Set S} + (hS'_cl : IsClosed S') (hEdges : ∀ e ∈ H.E, (e ∩ S').Nonempty → e ⊆ S') : + (H.interSet S').V = H.V ∩ S' ∧ (H.interSet S').U = H.U ∩ S' := by + have hE : (H.interSet S').E = {e | e ∈ H.E ∧ e ⊆ S'} := by + change (H.span _ _).E = _ + rw [H.span_E] + ext e + simp only [mem_inter_iff, mem_ofPred_eq] + tauto + have hV : (H.interSet S').V = H.V ∩ S' := by + apply subset_antisymm + · rintro x (⟨hx, _⟩ | hx) + · exact hx + · obtain ⟨e, he, hxe, hxV⟩ := mem_iUnion₂.mp hx + exact ⟨hxV, hS'_cl.closure_subset_iff.mpr he.1.2 hxe⟩ + · exact fun x hx => Or.inl ⟨hx, hx.1⟩ + refine ⟨hV, subset_antisymm ?_ ?_⟩ + · rw [(H.interSet S').U_eq, hV, hE] + refine union_subset (fun x hx => ⟨H.V_subset_U hx.1, hx.2⟩) (iUnion₂_subset fun e he x hx => ?_) + exact ⟨H.closure_subset_U he.1 hx, hS'_cl.closure_subset_iff.mpr he.2 hx⟩ + · rintro x ⟨hxU, hxS'⟩ + by_cases hxV : x ∈ H.V + · exact (H.interSet S').V_subset_U (hV.symm ▸ ⟨hxV, hxS'⟩) + · obtain ⟨e, he, hxe⟩ := H.exists_edge_of_mem hxU hxV + have heS' : e ⊆ S' := hEdges e he ⟨x, hxe, hxS'⟩ + have he' : e ∈ (H.interSet S').E := hE.symm ▸ ⟨he, heS'⟩ + exact (H.interSet S').closure_subset_U he' (subset_closure hxe) + +/-- If `S'` is closed and every edge of `H` meeting `S'` is contained in `S'`, then for `F ⊆ S'` +and `Δ ⊆ S'`, `IsDial (H.interSet S') F Δ ↔ IsDial H F Δ`. -/ +theorem isDial_interSet_iff_of_edges [T2Space S] {H : Drawing S} {S' F Δ : Set S} + (hS'_cl : IsClosed S') (hEdges : ∀ e ∈ H.E, (e ∩ S').Nonempty → e ⊆ S') + (hF : F ⊆ S') (hΔ : Δ ⊆ S') : + IsDial (H.interSet S') F Δ ↔ IsDial H F Δ := by + obtain ⟨hV, hU⟩ := interSet_V_and_U_of_edges hS'_cl hEdges + have hΔU : Δ ∩ (H.interSet S').U = Δ ∩ H.U := by + rw [hU] + ext x + exact ⟨fun ⟨hxΔ, hxU, _⟩ => ⟨hxΔ, hxU⟩, fun ⟨hxΔ, hxU⟩ => ⟨hxΔ, hxU, hΔ hxΔ⟩⟩ + have hFV : F ∩ (H.interSet S').V = F ∩ H.V := by + rw [hV] + ext x + exact ⟨fun ⟨hxF, hxV, _⟩ => ⟨hxF, hxV⟩, fun ⟨hxF, hxV⟩ => ⟨hxF, hxV, hF hxF⟩⟩ + have hinter : (H.interSet S').interSet Δ = H.interSet Δ := + interSet_interSet_of_subset H hΔ + unfold IsDial + rw [hΔU, hFV, hinter] + +/-- If `S'` is closed and `subBd S' ∩ U(H) ⊆ V(H)`, then `(H.interSet S').V = H.V ∩ S'` and +`(H.interSet S').U = H.U ∩ S'`. -/ +theorem interSet_V_and_U [T2Space S] {H : Drawing S} {S' : Set S} + (hS'_cl : IsClosed S') (hbd : subBd S' ∩ H.U ⊆ H.V) : + (H.interSet S').V = H.V ∩ S' ∧ (H.interSet S').U = H.U ∩ S' := + interSet_V_and_U_of_edges hS'_cl (fun _ => edge_subset_of_inter_nonempty hS'_cl hbd) + +/-- If `S'` is closed and `subBd S' ∩ U(H) ⊆ V(H)`, then for `F ⊆ S'` and `Δ ⊆ S'`, `Δ` is a dial +for `F, H.interSet S'` if and only if `Δ` is a dial for `F, H`. -/ +theorem isDial_interSet_iff [T2Space S] {H : Drawing S} {S' F Δ : Set S} + (hS'_cl : IsClosed S') (hbd : subBd S' ∩ H.U ⊆ H.V) (hF : F ⊆ S') (hΔ : Δ ⊆ S') : + IsDial (H.interSet S') F Δ ↔ IsDial H F Δ := + isDial_interSet_iff_of_edges hS'_cl (fun _ => edge_subset_of_inter_nonempty hS'_cl hbd) hF hΔ + +/-! ## 3. Proof of (6.1) (page 33) -/ + +/-- Graph Minors XIV, (6.1) (page 33): +"Let $H$ be a rigid drawing in a surface $\Sigma$, and let $\Sigma' \subseteq \Sigma$ be a +surface, such that $\text{bd}(\Sigma') \cap U(H) \subseteq V(H)$. Suppose that for every +closed disc $\Delta' \subseteq \Sigma$ with $\Delta' \cap \Sigma' = \text{bd}(\Delta') +\subseteq \text{bd}(\Sigma')$ there is a circuit $C$ of $H$ with $U(C) \subseteq \Delta'$. +Then $H \cap \Sigma'$ is a rigid drawing in $\Sigma'$." -/ +theorem theorem_6_1_proof [T2Space S] {H : Drawing S} {S' : Set S} + (hRig : IsRigid H) (hS'_cl : IsClosed S') (hbd : subBd S' ∩ H.U ⊆ H.V) + (hSubsurf : ∀ Δ : Set S, IsClosedDisc Δ → subBd Δ ⊆ S' → ¬ (Δ ⊆ S') → + ∃ Δ' : Set S, IsClosedDisc Δ' ∧ Δ' ⊆ Δ ∧ Δ' ∩ S' = subBd Δ' ∧ subBd Δ' ⊆ subBd S') + (hCirc : ∀ Δ' : Set S, IsClosedDisc Δ' → Δ' ∩ S' = subBd Δ' → subBd Δ' ⊆ subBd S' → + ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing H ∧ C.U ⊆ Δ') : + IsRigidIn (H.interSet S') S' := by + obtain ⟨hV, hU⟩ := interSet_V_and_U hS'_cl hbd + intro F hFS' hF_oArc hFU' hFV_card' + have hFU : F ∩ H.U = F ∩ (H.interSet S').U := by + rw [hU] + ext x + exact ⟨fun ⟨hxF, hxU⟩ => ⟨hxF, hxU, hFS' hxF⟩, fun ⟨hxF, hxU, _⟩ => ⟨hxF, hxU⟩⟩ + have hFV : F ∩ H.V = F ∩ (H.interSet S').V := by + rw [hV] + ext x + exact ⟨fun ⟨hxF, hxV⟩ => ⟨hxF, hxV, hFS' hxF⟩, fun ⟨hxF, hxV, _⟩ => ⟨hxF, hxV⟩⟩ + have hFU_sub : F ∩ H.U ⊆ H.V := by + rw [hFU] + exact hFU'.trans (H.spanV_subset _ _) + have hFV_card : (F ∩ H.V).ncard ≤ 2 := by + rwa [hFV] + obtain ⟨Δ, hDial⟩ := hRig F hF_oArc hFU_sub hFV_card + have hΔ_sub : Δ ⊆ S' := by + by_contra hnot + obtain ⟨Δ', hΔ'_disc, hΔ'_sub, hΔ'_inter, hΔ'_bd⟩ := + hSubsurf Δ hDial.1 (hDial.2.1 ▸ hFS') hnot + obtain ⟨C, hC, hCs, hCU⟩ := hCirc Δ' hΔ'_disc hΔ'_inter hΔ'_bd + exact no_circuit_in_dial hDial hFU_sub hC hCs (hCU.trans hΔ'_sub) + exact ⟨Δ, hΔ_sub, (isDial_interSet_iff hS'_cl hbd hFS' hΔ_sub).mpr hDial⟩ + +/-- Helper: `subBd (closure Λ) = subBd Λ` when `Λ` is an open disc whose boundary `subBd Λ` is an +`O`-arc and whose closure `closure Λ` is a closed disc. -/ +theorem subBd_closure_eq_subBd_of_isOpenDisc (hS : IsClosedSurface S) {Λ : Set S} + (hΛ_open : IsOpenDisc Λ) (hΛ_bd : IsOArc (subBd Λ)) (hΛ_cl : IsClosedDisc (closure Λ)) : + subBd (closure Λ) = subBd Λ := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨Δ₀, ⟨hΔ₀sub, hΔ₀disc, hΔ₀bd, -⟩, -⟩ := + disc_oArc (closure Λ) (subBd Λ) hΛ_cl (fun x hx => hx.1) hΛ_bd + have hΔ₀bd_sub : subBd Δ₀ = subBd Λ := by + rw [IsClosedDisc.subBd_eq_discBd hS hΔ₀disc, hΔ₀bd] + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open.1 + have hOD₀ : IsOpenDisc (Δ₀ \ subBd Λ) := + hΔ₀bd_sub ▸ (IsClosedDisc.isOpenDisc_diff_subBd hS hΔ₀disc).1 + obtain ⟨φ⟩ := hOD₀.2 + have h0 : (0 : EuclideanPlane) ∈ OpenUnitDisc := by simp [OpenUnitDisc] + have hp : (φ ⟨0, h0⟩).1 ∈ Δ₀ \ subBd Λ := (φ ⟨0, h0⟩).2 + have hpΛ : (φ ⟨0, h0⟩).1 ∈ Λ := by + have hp_cl : (φ ⟨0, h0⟩).1 ∈ closure Λ := hΔ₀sub hp.1 + rw [hclL] at hp_cl + exact hp_cl.resolve_right hp.2 + have hfr₀ : frontier Δ₀ = subBd Λ := by rw [← subBd_eq_frontier, hΔ₀bd_sub] + have hΛ_sub : Λ ⊆ Δ₀ := + subset_of_disjoint_frontier hΛ_open.isPathConnected.isConnected.isPreconnected hΔ₀disc.isClosed + (hfr₀ ▸ hdisL) hpΛ hp.1 + have h_eq : closure Λ = Δ₀ := + subset_antisymm (hΔ₀disc.isClosed.closure_subset_iff.mpr hΛ_sub) hΔ₀sub + rw [h_eq, hΔ₀bd_sub] + +/-- Subsurface disc property for `S' = univ \ Λ`, where `Λ` is an open disc whose boundary is an +`O`-arc and whose closure is a closed disc. -/ +theorem subsurf_compl_openDisc (hS : IsClosedSurface S) {Λ Δ : Set S} + (hΛ_open : IsOpenDisc Λ) (hΛ_bd : IsOArc (subBd Λ)) (hΛ_cl : IsClosedDisc (closure Λ)) + (hΔ : IsClosedDisc Δ) (hbd : subBd Δ ⊆ univ \ Λ) (hnot : ¬ (Δ ⊆ univ \ Λ)) : + ∃ Δ' : Set S, IsClosedDisc Δ' ∧ Δ' ⊆ Δ ∧ + Δ' ∩ (univ \ Λ) = subBd Δ' ∧ subBd Δ' ⊆ subBd (univ \ Λ) := by + have : T2Space S := hS.2.1 + have hmeet : (Λ ∩ Δ).Nonempty := by + by_contra h + apply hnot + intro x hx + exact ⟨mem_univ x, fun hxΛ => h ⟨x, hxΛ, hx⟩⟩ + obtain ⟨x, hxΛ, hxΔ⟩ := hmeet + have hdis : Disjoint Λ (frontier Δ) := by + rw [← subBd_eq_frontier] + exact disjoint_left.mpr fun y hyΛ hybd => (hbd hybd).2 hyΛ + have hΛ_sub : Λ ⊆ Δ := + subset_of_disjoint_frontier hΛ_open.isPathConnected.isConnected.isPreconnected + hΔ.isClosed hdis hxΛ hxΔ + have hcl_sub : closure Λ ⊆ Δ := hΔ.isClosed.closure_subset_iff.mpr hΛ_sub + obtain ⟨hdis_bd, hcl_eq⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open.1 + have hbd_cl : subBd (closure Λ) = subBd Λ := + subBd_closure_eq_subBd_of_isOpenDisc hS hΛ_open hΛ_bd hΛ_cl + refine ⟨closure Λ, hΛ_cl, hcl_sub, ?_, ?_⟩ + · rw [hbd_cl, hcl_eq] + ext y + simp only [mem_inter_iff, mem_union, mem_sdiff, mem_univ, true_and] + exact ⟨fun ⟨h, hyn⟩ => h.resolve_left hyn, + fun hy => ⟨Or.inr hy, disjoint_right.mp hdis_bd hy⟩⟩ + · rw [hbd_cl, subBd_eq_frontier, subBd_eq_frontier, ← compl_eq_univ_sdiff, frontier_compl] + +/-- Subsurface disc property for `S' = Δ₀`, where `Δ₀` is a closed disc in a connected closed +surface `S`. -/ +theorem subsurf_closedDisc [ConnectedSpace S] (hS : IsClosedSurface S) {Δ₀ Δ : Set S} + (hΔ₀ : IsClosedDisc Δ₀) (hΔ : IsClosedDisc Δ) + (hbd : subBd Δ ⊆ Δ₀) (hnot : ¬ (Δ ⊆ Δ₀)) : + ∃ Δ' : Set S, IsClosedDisc Δ' ∧ Δ' ⊆ Δ ∧ + Δ' ∩ Δ₀ = subBd Δ' ∧ subBd Δ' ⊆ subBd Δ₀ := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hF_oArc : IsOArc (subBd Δ) := by + rw [IsClosedDisc.subBd_eq_discBd hS hΔ] + exact hΔ.isOArc_discBd + obtain ⟨Δ₁, ⟨hΔ₁_sub, hΔ₁_disc, hΔ₁_bd, -⟩, -⟩ := disc_oArc Δ₀ (subBd Δ) hΔ₀ hbd hF_oArc + have hΔ_bd : discBd Δ = subBd Δ := (IsClosedDisc.subBd_eq_discBd hS hΔ).symm + have hb_eq : discBd Δ = discBd Δ₁ := hΔ_bd.trans hΔ₁_bd.symm + have hne : Δ ≠ Δ₁ := fun h => hnot (h ▸ hΔ₁_sub) + have hcov : Δ ∪ Δ₁ = univ := cover_of_discBd_eq hS hΔ hΔ₁_disc hb_eq hne + have hsph : IsSphere S := by + by_contra hns + exact hne (eq_of_discBd_eq (IsClosedSurface.isSurface hS) hns hΔ hΔ₁_disc hb_eq) + obtain ⟨D₁, D₂, hne_D, hD₁, hD₂, hb₁, hb₂, hcov_D, hmeet_D, _, huniq_D⟩ := + sphere_disc S hsph (discBd Δ₀) hΔ₀.isOArc_discBd + have haux : ∀ D' : Set S, IsClosedDisc D' → discBd D' = discBd Δ₀ → + Δ₀ ∪ D' = univ → Δ₀ ∩ D' = discBd Δ₀ → + IsClosedDisc D' ∧ D' ⊆ Δ ∧ D' ∩ Δ₀ = subBd D' ∧ subBd D' ⊆ subBd Δ₀ := by + intro D' hD' hb' hcov' hmeet' + have hbd_D' : subBd D' = discBd Δ₀ := + (IsClosedDisc.subBd_eq_discBd hS hD').trans hb' + have hbd_Δ₀ : subBd Δ₀ = discBd Δ₀ := + IsClosedDisc.subBd_eq_discBd hS hΔ₀ + obtain ⟨_, hcl_D', _⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hD' + have hdiff_sub : D' \ subBd D' ⊆ Δ := by + intro x ⟨hxD', hxb⟩ + rw [hbd_D'] at hxb + have hx_not_0 : x ∉ Δ₀ := fun hx0 => hxb (hmeet' ▸ ⟨hx0, hxD'⟩) + have hx_not_1 : x ∉ Δ₁ := fun hx1 => hx_not_0 (hΔ₁_sub hx1) + have hx_univ : x ∈ Δ ∪ Δ₁ := hcov.symm ▸ mem_univ x + exact hx_univ.resolve_right hx_not_1 + have hD'_sub : D' ⊆ Δ := hcl_D' ▸ hΔ.isClosed.closure_subset_iff.mpr hdiff_sub + refine ⟨hD', hD'_sub, ?_, ?_⟩ + · rw [inter_comm, hmeet', hbd_D'] + · rw [hbd_D', hbd_Δ₀] + rcases huniq_D Δ₀ hΔ₀ rfl with rfl | rfl + · exact ⟨D₂, haux D₂ hD₂ hb₂ hcov_D hmeet_D⟩ + · refine ⟨D₁, haux D₁ hD₁ hb₁ (union_comm D₁ Δ₀ ▸ hcov_D) (inter_comm D₁ Δ₀ ▸ hmeet_D)⟩ + +/-! ## 4. Proof of (6.2) (page 33) -/ + +/-- Graph Minors XIV, (6.2), Part 1 (page 33), in a subset `S' ⊆ Σ`: +at any vertex `v ∈ V(H) ∩ S'` of a drawing `H` that is rigid in `S'`, if `ρ k ⊆ S'`, then no other +corner `k' ≠ k` at `v` has `ρ k' = ρ k`. -/ +theorem corner_regions_ne_in [T2Space S] (hS : IsClosedSurface S) {H : Drawing S} {S' : Set S} + (hRig : IsRigidIn H S') {γ : Set S → I → S} {v : S} (hv : v ∈ H.V) (hvS' : v ∈ S') + {next : halfEdges H γ v → halfEdges H γ v} + {ρ P Q : halfEdges H γ v → Set S} {W : Set S} {τ : halfEdges H γ v → I} + (hsec : IsSectors H γ v next ρ P W Q τ) + {k k' : halfEdges H γ v} (hρ_sub : ρ k ⊆ S') (hkk : k ≠ k') : + ρ k ≠ ρ k' := by + refine GM11.corner_regions_ne_of_free_disc hS (H.V_subset_U hv) hsec hkk ?_ + intro J hJ hvJ hJp + have hpR : ρ k ∈ H.R := IsCorners.region (IsSectors.corners hsec) k + have hJS' : J ⊆ S' := fun y hy => (hJp y hy).elim (fun h => h ▸ hvS') (fun h => hρ_sub h) + have hJU : J ∩ H.U ⊆ {v} := by + rintro y ⟨hyJ, hyU⟩ + rcases hJp y hyJ with rfl | hyr + · rfl + · exact (region_subset hpR hyr hyU).elim + have hJV : J ∩ H.V = {v} := by + apply subset_antisymm + · exact fun y ⟨hyJ, hyV⟩ => hJU ⟨hyJ, H.V_subset_U hyV⟩ + · rintro y rfl + exact ⟨hvJ, hv⟩ + have hJU_sub : J ∩ H.U ⊆ H.V := hJU.trans (singleton_subset_iff.mpr hv) + have hJV_card : (J ∩ H.V).ncard ≤ 2 := by + rw [hJV, ncard_singleton] + omega + obtain ⟨Δ, _, hΔ, hbd_Δ, hDial_cases⟩ := hRig J hJS' hJ hJU_sub hJV_card + have hb : discBd Δ = J := (IsClosedDisc.subBd_eq_discBd hS hΔ).symm.trans hbd_Δ + have hfree : Disjoint (Δ \ discBd Δ) H.U := by + rcases hDial_cases with h1 | ⟨u₁, u₂, hu12, hJV_eq, _⟩ + · exact disjoint_left.mpr fun y ⟨hyΔ, hyb⟩ hyU => hyb (hb ▸ h1 ⟨hyΔ, hyU⟩) + · exfalso + have h1 : (J ∩ H.V).ncard = 1 := by rw [hJV, ncard_singleton] + have h2 : (J ∩ H.V).ncard = 2 := by rw [hJV_eq, ncard_pair hu12] + omega + exact ⟨Δ, hΔ, hb, hfree⟩ + +/-- Graph Minors XIV, (6.2), Part 1 (page 33): +"Let $H$ be a rigid drawing in a surface $\Sigma$. Let $v \in V(H)$, and let the regions of +$H$ incident with $v$ be $r_1, \dots, r_k$, enumerated in the cyclic order of their +occurrence around $v$. Then $r_1, \dots, r_k$ are all distinct." -/ +theorem corner_regions_injective [T2Space S] (hS : IsClosedSurface S) {H : Drawing S} + (hRig : IsRigid H) {γ : Set S → I → S} {v : S} (hv : v ∈ H.V) + {next : halfEdges H γ v → halfEdges H γ v} + {ρ P Q : halfEdges H γ v → Set S} {W : Set S} {τ : halfEdges H γ v → I} + (hsec : IsSectors H γ v next ρ P W Q τ) : + Function.Injective ρ := by + intro k k' hρ + by_contra hkk + exact corner_regions_ne_in hS (isRigidIn_univ_iff.mpr hRig) hv (mem_univ v) hsec + (subset_univ (ρ k)) hkk hρ + +/-- Every region `r` of a drawing `H` that is rigid in `S'` (with `r ⊆ S'`) is simply-connected in +the sense of Section 6 (`IsArcSimplyConnected r`). -/ +theorem isArcSimplyConnected_region_in [T2Space S] (hS : IsClosedSurface S) {H : Drawing S} + {S' r : Set S} (hRig : IsRigidIn H S') (hr : r ∈ H.R) (hr_sub : r ⊆ S') : + IsArcSimplyConnected r := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨y₀, hy₀⟩ := region_nonempty hr + have hpath : IsPathConnected r := + isPathConnected_of_isOpen hS (region_isOpen hr) (region_isPreconnected hr) ⟨y₀, hy₀⟩ + have harc : IsArcConnected r := by + intro a ha b hb hab + obtain ⟨m, hm⟩ := hpath.joinedIn a ha b hb + obtain ⟨e, he, hi, he0, he1, hsub⟩ := + exists_arc_of_path (γ := m) m.continuous (by simpa using hab) + have he0' : e 0 = a := by simpa using he0 + have he1' : e 1 = b := by simpa using he1 + exact ⟨range e, hsub.trans (range_subset_iff.mpr hm), he0' ▸ he1' ▸ isLine_range he hi⟩ + refine ⟨harc, fun F hF hFr => ?_⟩ + have hFS' : F ⊆ S' := hFr.trans hr_sub + have hFU_emp : F ∩ H.U = ∅ := + eq_empty_iff_forall_notMem.mpr fun x ⟨hxF, hxU⟩ => region_subset hr (hFr hxF) hxU + have hFU : F ∩ H.U ⊆ H.V := by + rw [hFU_emp] + exact empty_subset _ + have hFV_emp : F ∩ H.V = ∅ := + eq_empty_of_subset (inter_subset_inter_right F H.V_subset_U) hFU_emp + have hFV_card : (F ∩ H.V).ncard ≤ 2 := by + rw [hFV_emp, ncard_empty] + omega + obtain ⟨Δ, _, hΔ, hbd_Δ, hDial_cases⟩ := hRig F hFS' hF hFU hFV_card + have hΔ_disj : Disjoint Δ H.U := by + rcases hDial_cases with h1 | ⟨u₁, u₂, hu12, hJV_eq, _⟩ + · exact disjoint_left.mpr fun x hxΔ hxU => + (eq_empty_iff_forall_notMem.mp hFU_emp x) ⟨h1 ⟨hxΔ, hxU⟩, hxU⟩ + · exfalso + have h1 : (F ∩ H.V).ncard = 0 := by rw [hFV_emp, ncard_empty] + have h2 : (F ∩ H.V).ncard = 2 := by rw [hJV_eq, ncard_pair hu12] + omega + obtain ⟨φ⟩ := hF + have hpF : (φ 1).1 ∈ F := (φ 1).2 + have hpΔ : (φ 1).1 ∈ Δ := by + have hbd_disc : discBd Δ = F := (IsClosedDisc.subBd_eq_discBd hS hΔ).symm.trans hbd_Δ + exact Surface.discBd_subset Δ (hbd_disc.symm ▸ hpF) + have hΔ_r : Δ ⊆ r := + subset_region hr hΔ.isPathConnected.isConnected.isPreconnected hΔ_disj hpΔ (hFr hpF) + exact ⟨Δ, hΔ, hbd_Δ, hΔ_r⟩ + +/-- Every region `r` of a rigid drawing `H` is simply-connected (`IsArcSimplyConnected r`). -/ +theorem isArcSimplyConnected_region [T2Space S] (hS : IsClosedSurface S) {H : Drawing S} + (hRig : IsRigid H) {r : Set S} (hr : r ∈ H.R) : + IsArcSimplyConnected r := + isArcSimplyConnected_region_in hS (isRigidIn_univ_iff.mpr hRig) hr (subset_univ r) + +/-- Every region `r` of a rigid drawing `H` with `U(H) ≠ ∅` in a connected closed surface `S` is an +open disc (`IsOpenDisc r`), so `H` is a 2-cell drawing. -/ +theorem isOpenDisc_region_of_isRigid [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {H : Drawing S} (hRig : IsRigid H) (hU : H.U.Nonempty) {r : Set S} (hr : r ∈ H.R) : + IsOpenDisc r := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hsc := isArcSimplyConnected_region hS hRig hr + have h_od := open_disc S r hS ‹ConnectedSpace S› + ⟨region_nonempty hr, region_isPreconnected hr⟩ (region_isOpen hr) + (fun F hFr hF => by + obtain ⟨Δ, hΔ, hbd, hΔr⟩ := hsc.2 F hF hFr + exact ⟨Δ, hΔr, hΔ, (IsClosedDisc.subBd_eq_discBd hS hΔ).symm.trans hbd⟩) + rcases h_od with ⟨_, hr_univ⟩ | hr_disc + · exfalso + obtain ⟨x, hx⟩ := hU + exact region_subset hr (hr_univ ▸ mem_univ x) hx + · exact hr_disc + +/-- Graph Minors XIV, (6.2) (page 33): +"Let $H$ be a rigid drawing in a surface $\Sigma$. Let $v \in V(H)$, and let the regions of +$H$ incident with $v$ be $r_1, \dots, r_k$, enumerated in the cyclic order of their +occurrence around $v$. Then $r_1, \dots, r_k$ are all distinct. Consequently $\bar{r}$ is +simply-connected for every region $r$ of $H$." -/ +theorem theorem_6_2_proof [T2Space S] (hS : IsClosedSurface S) {H : Drawing S} (hRig : IsRigid H) : + (∀ {γ : Set S → I → S} {v : S}, v ∈ H.V → + ∀ {next : halfEdges H γ v → halfEdges H γ v} + {ρ P Q : halfEdges H γ v → Set S} {W : Set S} {τ : halfEdges H γ v → I}, + IsSectors H γ v next ρ P W Q τ → Function.Injective ρ) ∧ + (∀ r ∈ H.R, IsArcSimplyConnected r) := by + refine ⟨?_, ?_⟩ + · intro γ v hv next ρ P Q W τ hsec + exact corner_regions_injective hS hRig hv hsec + · intro r hr + exact isArcSimplyConnected_region hS hRig hr + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section6b.lean b/LeanPool/GraphMinor/GM14/Section6b.lean new file mode 100644 index 0000000000..2f0a870258 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section6b.lean @@ -0,0 +1,1094 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section6a +import LeanPool.GraphMinor.GM11.ThreeCircuits +import LeanPool.GraphMinor.Surface.PushOff +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Graph Minors XIV, Section 6 (Part 2): Clearing an Open Disc in a Rigid Drawing ((6.3)) + +This file formalizes result (6.3) (pages 33–34) of N. Robertson and P. D. Seymour, +*Graph Minors. XIV. Extending an embedding*, J. Combin. Theory Ser. B **65** (1995) 23–50: + +- `theorem_6_3`: Graph Minors XIV, (6.3) (page 33), showing that if `H` is a rigid drawing in `Σ`, + `Λ ⊆ Σ` is an open disc whose closure is a closed disc and whose boundary `bd(Λ) = U(C)` is a + circuit `C` of `H`, and `closure r ∩ closure Λ` is preconnected for every region `r ∈ H.R` + disjoint from `Λ`, then `clearedSubdrawing H Λ = H ∩ (Σ - Λ)` is a rigid drawing in `Σ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Graph Hypergraph unitInterval +open GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Pushing an Arc off a Closed Disc -/ + +local notation "𝕀" => unitInterval + +/-- Given a closed disc `D` in a closed surface `S`, a line `L ⊆ subBd D` with ends `a, b`, and a +closed set `Y ⊆ S` with `Y ∩ D ⊆ subBd D`, `a ∈ Y`, `b ∈ Y`, and `Y ∩ L ⊆ {a, b}`, there is a +homeomorphism `h : S ≃ₜ S` fixing `Y` pointwise such that `h '' L ∩ D ⊆ {a, b}`. -/ +private theorem push_arc_of_fixed_boundary (hS : IsClosedSurface S) {D L Y : Set S} {a b : S} + (hD : IsClosedDisc D) (hL : IsLineWithEnds L a b) (hLD : L ⊆ subBd D) + (hY : IsClosed Y) (hYD : Y ∩ D ⊆ subBd D) (haY : a ∈ Y) (hbY : b ∈ Y) (hYL : Y ∩ L ⊆ {a, b}) : + ∃ h : S ≃ₜ S, (∀ y ∈ Y, h y = y) ∧ h '' L ∩ D ⊆ {a, b} := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hint : ∀ x : S, IsInteriorPoint x := hS.2.2 + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hint x).isManifoldPoint + have hbd_eq : subBd D = discBd D := IsClosedDisc.subBd_eq_discBd hS hD + have hLD' : L ⊆ discBd D := hbd_eq ▸ hLD + obtain ⟨u, v, huv, hr, h0, h1, hun⟩ := exists_arcs_of_line hD.isOArc_discBd hL hLD' + subst h0 h1 hr + have hvu : IsTwoArcs v u := huv.symm + have hun' : range v ∪ range u = discBd D := by rw [Set.union_comm, hun] + have hv0 : v 0 ∈ Y := huv.zero ▸ haY + have hv1 : v 1 ∈ Y := huv.one ▸ hbY + have hYD' : Y ∩ D ⊆ range v := by + intro x hx + have hx_bd : x ∈ range v ∪ range u := hun' ▸ hbd_eq ▸ hYD hx + rcases hx_bd with hxv | hxu + · exact hxv + · rcases hYL ⟨hx.1, hxu⟩ with rfl | rfl + · exact ⟨0, huv.zero⟩ + · exact ⟨1, huv.one⟩ + have hC : IsClosed (range u) := (isCompact_range huv.arc_left.1).isClosed + have hCv : range u ∩ range v ⊆ {v 0, v 1} := by + rintro x ⟨⟨s, rfl⟩, ⟨t, hst⟩⟩ + rcases huv.meet s t hst.symm with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl huv.zero.symm + · exact Or.inr huv.one.symm + obtain ⟨h, hhY, hhL⟩ := + push_side hman hD (fun x _ => hint x) hvu hun' hY hYD' hv0 hv1 hC hCv + refine ⟨h, hhY, ?_⟩ + rwa [huv.zero, huv.one] at hhL + +/-! ## 2. Subdrawing Outside an Open Disc Bounded by a Circuit -/ + +/-- Every edge of `H` is either contained in `Λ` or contained in `univ \ Λ` when `Λ` is an open +disc whose boundary `subBd Λ` is an `O`-arc in `H.U`. -/ +theorem edge_subset_or_subset_compl_of_openDisc [T2Space S] {H : Drawing S} {Λ e : Set S} + (hΛ_open : IsOpenDisc Λ) (hΛ_bd : IsOArc (subBd Λ)) (hbd_U : subBd Λ ⊆ H.U) (he : e ∈ H.E) : + e ⊆ Λ ∨ e ⊆ univ \ Λ := by + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open.1 + rcases edge_subset_or_disjoint_of_isOArc hΛ_bd hbd_U he with hsub | hdis + · exact Or.inr fun x hx => ⟨mem_univ _, fun hxΛ => disjoint_left.mp hdisL hxΛ (hsub hx)⟩ + · have hcov : e ⊆ Λ ∪ (closure Λ)ᶜ := by + intro x hx + by_cases hxcl : x ∈ closure Λ + · rw [hclL] at hxcl + exact Or.inl (hxcl.resolve_right (disjoint_left.mp hdis hx)) + · exact Or.inr hxcl + have hdisO : Disjoint Λ (closure Λ)ᶜ := + disjoint_left.mpr fun x hx hxc => hxc (subset_closure hx) + by_cases hmeet : (e ∩ Λ).Nonempty + · obtain ⟨x, hxe, hxΛ⟩ := hmeet + exact Or.inl ((he.2.2.1.isConnected.isPreconnected).subset_left_of_subset_union + hΛ_open.1 isClosed_closure.isOpen_compl hdisO hcov ⟨x, hxe, hxΛ⟩) + · refine Or.inr fun x hxe => ⟨mem_univ _, fun hxΛ => hmeet ⟨x, hxe, hxΛ⟩⟩ + +/-- Basic properties of `H' = clearedSubdrawing H Λ` when `Λ` is an open disc with `subBd Λ = C.U` +for a circuit `C` of `H`. -/ +theorem clearedSubdrawing_props_of_circuit [T2Space S] {H C : Drawing S} {Λ : Set S} + (hΛ_open : IsOpenDisc Λ) (hC : C.IsCircuit) (hCs : C.IsSubdrawing H) (hbd : subBd Λ = C.U) : + (clearedSubdrawing H Λ).V = H.V \ Λ ∧ + (clearedSubdrawing H Λ).E = {e ∈ H.E | e ⊆ univ \ Λ} ∧ + (clearedSubdrawing H Λ).U = H.U \ Λ ∧ + C.IsSubdrawing (clearedSubdrawing H Λ) ∧ + Λ ∈ (clearedSubdrawing H Λ).R ∧ + (∀ r' ∈ (clearedSubdrawing H Λ).R, r' = Λ ∨ (r' ∈ H.R ∧ Disjoint r' Λ)) ∧ + (∀ r ∈ H.R, Disjoint r Λ → r ∈ (clearedSubdrawing H Λ).R) := by + have hS'_cl : IsClosed (univ \ Λ) := by + rw [← compl_eq_univ_sdiff] + exact hΛ_open.1.isClosed_compl + have hO : IsOArc (subBd Λ) := hbd ▸ isOArc_of_isCircuit hC + have hbd_U : subBd Λ ⊆ H.U := hbd ▸ hCs.U_subset + have hEdges : ∀ e ∈ H.E, (e ∩ (univ \ Λ)).Nonempty → e ⊆ univ \ Λ := by + rintro e he ⟨x, hxe, hx⟩ + rcases edge_subset_or_subset_compl_of_openDisc hΛ_open hO hbd_U he with heΛ | hec + · exact absurd (heΛ hxe) hx.2 + · exact hec + obtain ⟨hV, hU⟩ := interSet_V_and_U_of_edges hS'_cl hEdges + have hV' : (clearedSubdrawing H Λ).V = H.V \ Λ := by + change (H.interSet (univ \ Λ)).V = _ + rw [hV] + ext x + simp only [mem_inter_iff, mem_sdiff, mem_univ, true_and] + have hU' : (clearedSubdrawing H Λ).U = H.U \ Λ := by + change (H.interSet (univ \ Λ)).U = _ + rw [hU] + ext x + simp only [mem_inter_iff, mem_sdiff, mem_univ, true_and] + have hE' : (clearedSubdrawing H Λ).E = {e ∈ H.E | e ⊆ univ \ Λ} := by + change (H.span _ _).E = _ + rw [H.span_E] + ext e + simp only [mem_inter_iff, mem_ofPred_eq] + tauto + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open.1 + have hCU_dis : Disjoint C.U Λ := hbd ▸ hdisL.symm + have hC_sub' : C.IsSubdrawing (clearedSubdrawing H Λ) := by + refine ⟨?_, ?_⟩ + · rw [hV'] + exact fun v hv => ⟨hCs.1 hv, disjoint_left.mp hCU_dis (C.V_subset_U hv)⟩ + · rw [hE'] + exact fun e he => ⟨hCs.2 he, fun x hx => + ⟨mem_univ _, disjoint_left.mp hCU_dis (C.closure_subset_U he (subset_closure hx))⟩⟩ + let O₂ : Set S := univ \ (H.U ∪ closure Λ) + have hO₂ : IsOpen O₂ := isOpen_univ.sdiff (H.isClosed_U.union isClosed_closure) + have hdisO : Disjoint Λ O₂ := + disjoint_left.mpr fun x hx hxO => hxO.2 (Or.inr (subset_closure hx)) + have hcompl : univ \ (clearedSubdrawing H Λ).U = Λ ∪ O₂ := by + rw [hU'] + ext x + constructor + · rintro ⟨_, hx⟩ + by_cases hxΛ : x ∈ Λ + · exact Or.inl hxΛ + · refine Or.inr ⟨mem_univ _, ?_⟩ + rintro (hxU | hxcl) + · exact hx ⟨hxU, hxΛ⟩ + · rw [hclL] at hxcl + exact hx ⟨hbd_U (hxcl.resolve_left hxΛ), hxΛ⟩ + · rintro (hxΛ | ⟨_, hx⟩) + · exact ⟨mem_univ _, fun h => h.2 hxΛ⟩ + · exact ⟨mem_univ _, fun h => hx (Or.inl h.1)⟩ + have hΛ_R : Λ ∈ (clearedSubdrawing H Λ).R := by + obtain ⟨φ⟩ := hΛ_open.2 + have h0 : (0 : EuclideanPlane) ∈ OpenUnitDisc := by simp [OpenUnitDisc] + let x₀ : S := (φ ⟨0, h0⟩).1 + have hx₀Λ : x₀ ∈ Λ := (φ ⟨0, h0⟩).2 + have hx₀_mem : x₀ ∈ univ \ (clearedSubdrawing H Λ).U := hcompl ▸ Or.inl hx₀Λ + refine (mem_R_iff (clearedSubdrawing H Λ)).mpr ⟨x₀, hx₀_mem.2, subset_antisymm ?_ ?_⟩ + · refine hΛ_open.isPathConnected.isConnected.isPreconnected.subset_connectedComponentIn + hx₀Λ ?_ + rw [hcompl] + exact subset_union_left + · have hcov' : connectedComponentIn (univ \ (clearedSubdrawing H Λ).U) x₀ ⊆ Λ ∪ O₂ := by + rw [← hcompl] + exact connectedComponentIn_subset _ _ + exact isPreconnected_connectedComponentIn.subset_left_of_subset_union + hΛ_open.1 hO₂ hdisO hcov' ⟨x₀, mem_connectedComponentIn hx₀_mem, hx₀Λ⟩ + have hR_or : ∀ r' ∈ (clearedSubdrawing H Λ).R, r' = Λ ∨ (r' ∈ H.R ∧ Disjoint r' Λ) := by + intro r' hr' + obtain ⟨x, hxU', rfl⟩ := (mem_R_iff (clearedSubdrawing H Λ)).mp hr' + have hx_mem : x ∈ univ \ (clearedSubdrawing H Λ).U := ⟨mem_univ _, hxU'⟩ + have hcov' : connectedComponentIn (univ \ (clearedSubdrawing H Λ).U) x ⊆ Λ ∪ O₂ := by + rw [← hcompl] + exact connectedComponentIn_subset _ _ + rcases hcompl ▸ hx_mem with hxΛ | hxO₂ + · refine Or.inl (subset_antisymm ?_ ?_) + · exact isPreconnected_connectedComponentIn.subset_left_of_subset_union + hΛ_open.1 hO₂ hdisO hcov' ⟨x, mem_connectedComponentIn hx_mem, hxΛ⟩ + · refine hΛ_open.isPathConnected.isConnected.isPreconnected.subset_connectedComponentIn + hxΛ ?_ + rw [hcompl] + exact subset_union_left + · refine Or.inr ?_ + have hxHU : x ∉ H.U := fun h => hxO₂.2 (Or.inl h) + have hsubO₂ : connectedComponentIn (univ \ (clearedSubdrawing H Λ).U) x ⊆ O₂ := + isPreconnected_connectedComponentIn.subset_right_of_subset_union + hΛ_open.1 hO₂ hdisO hcov' ⟨x, mem_connectedComponentIn hx_mem, hxO₂⟩ + have heq_comp : connectedComponentIn (univ \ (clearedSubdrawing H Λ).U) x = + connectedComponentIn (univ \ H.U) x := by + apply subset_antisymm + · refine isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn hx_mem) ?_ + exact hsubO₂.trans fun y hy => ⟨mem_univ _, fun h => hy.2 (Or.inl h)⟩ + · have hcovH : connectedComponentIn (univ \ H.U) x ⊆ Λ ∪ O₂ := by + intro y hy + have hyU : y ∉ H.U := (connectedComponentIn_subset _ _ hy).2 + by_cases hycl : y ∈ closure Λ + · rw [hclL] at hycl + exact Or.inl (hycl.resolve_right fun hbd' => hyU (hbd_U hbd')) + · exact Or.inr ⟨mem_univ _, fun h => h.elim hyU hycl⟩ + have hsubO₂' : connectedComponentIn (univ \ H.U) x ⊆ O₂ := + isPreconnected_connectedComponentIn.subset_right_of_subset_union + hΛ_open.1 hO₂ hdisO hcovH + ⟨x, mem_connectedComponentIn ⟨mem_univ _, hxHU⟩, hxO₂⟩ + refine isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn ⟨mem_univ _, hxHU⟩) ?_ + rw [hcompl] + exact hsubO₂'.trans subset_union_right + exact ⟨(mem_R_iff H).mpr ⟨x, hxHU, heq_comp⟩, hdisO.symm.mono_left hsubO₂⟩ + have hR_in : ∀ r ∈ H.R, Disjoint r Λ → r ∈ (clearedSubdrawing H Λ).R := by + intro r hr hdis_r + obtain ⟨x, hxHU, rfl⟩ := (mem_R_iff H).mp hr + have hxr : x ∈ connectedComponentIn (univ \ H.U) x := + mem_connectedComponentIn ⟨mem_univ _, hxHU⟩ + have hxΛ : x ∉ Λ := disjoint_left.mp hdis_r hxr + have hxU' : x ∉ (clearedSubdrawing H Λ).U := by + rw [hU'] + exact fun h => hxHU h.1 + have hr' : connectedComponentIn (univ \ (clearedSubdrawing H Λ).U) x ∈ + (clearedSubdrawing H Λ).R := + (mem_R_iff (clearedSubdrawing H Λ)).mpr ⟨x, hxU', rfl⟩ + rcases hR_or _ hr' with heq | ⟨hr_H, _⟩ + · exact absurd (heq ▸ mem_connectedComponentIn ⟨mem_univ _, hxU'⟩) hxΛ + · have heq : connectedComponentIn (univ \ H.U) x = + connectedComponentIn (univ \ (clearedSubdrawing H Λ).U) x := + region_eq_of_mem hr hr_H hxr (mem_connectedComponentIn ⟨mem_univ _, hxU'⟩) + exact heq ▸ hr' + exact ⟨hV', hE', hU', hC_sub', hΛ_R, hR_or, hR_in⟩ + +/-- By (6.1), `clearedSubdrawing H Λ` is rigid in `univ \ Λ`. -/ +theorem isRigidIn_clearedSubdrawing [T2Space S] (hS : IsClosedSurface S) {H C : Drawing S} + {Λ : Set S} (hRig : IsRigid H) (hΛ_open : IsOpenDisc Λ) (hΛ_cl : IsClosedDisc (closure Λ)) + (hC : C.IsCircuit) (hCs : C.IsSubdrawing H) (hbd : subBd Λ = C.U) : + IsRigidIn (clearedSubdrawing H Λ) (univ \ Λ) := by + have hS'_cl : IsClosed (univ \ Λ) := by + rw [← compl_eq_univ_sdiff] + exact hΛ_open.1.isClosed_compl + have hO : IsOArc (subBd Λ) := hbd ▸ isOArc_of_isCircuit hC + have hbd_U : subBd Λ ⊆ H.U := hbd ▸ hCs.U_subset + have hEdges : ∀ e ∈ H.E, (e ∩ (univ \ Λ)).Nonempty → e ⊆ univ \ Λ := by + rintro e he ⟨x, hxe, hx⟩ + rcases edge_subset_or_subset_compl_of_openDisc hΛ_open hO hbd_U he with heΛ | hec + · exact absurd (heΛ hxe) hx.2 + · exact hec + obtain ⟨hV, hU⟩ := interSet_V_and_U_of_edges hS'_cl hEdges + intro F hFS' hF_oArc hFU' hFV_card' + have hFU : F ∩ H.U = F ∩ (clearedSubdrawing H Λ).U := by + change F ∩ H.U = F ∩ (H.interSet (univ \ Λ)).U + rw [hU] + ext x + exact ⟨fun ⟨hxF, hxU⟩ => ⟨hxF, hxU, hFS' hxF⟩, fun ⟨hxF, hxU, _⟩ => ⟨hxF, hxU⟩⟩ + have hFV : F ∩ H.V = F ∩ (clearedSubdrawing H Λ).V := by + change F ∩ H.V = F ∩ (H.interSet (univ \ Λ)).V + rw [hV] + ext x + exact ⟨fun ⟨hxF, hxV⟩ => ⟨hxF, hxV, hFS' hxF⟩, fun ⟨hxF, hxV, _⟩ => ⟨hxF, hxV⟩⟩ + have hFU_sub : F ∩ H.U ⊆ H.V := by + rw [hFU] + exact hFU'.trans (H.spanV_subset _ _) + have hFV_card : (F ∩ H.V).ncard ≤ 2 := by + rwa [hFV] + obtain ⟨Δ, hDial⟩ := hRig F hF_oArc hFU_sub hFV_card + have hΔ_sub : Δ ⊆ univ \ Λ := by + by_contra hnot + obtain ⟨Δ', hΔ'_disc, hΔ'_sub, hΔ'_inter, _⟩ := + subsurf_compl_openDisc hS hΛ_open hO hΛ_cl hDial.1 (hDial.2.1 ▸ hFS') hnot + have hCU_Δ : C.U ⊆ Δ := by + intro x hxC + have hx_bd : x ∈ subBd Λ := hbd.symm ▸ hxC + have hx_cl : x ∈ closure Λ := hx_bd.1 + -- In `subsurf_compl_openDisc`, `closure Λ ⊆ Δ`. + have hmeet : (Λ ∩ Δ).Nonempty := by + by_contra h + apply hnot + exact fun y hy => ⟨mem_univ y, fun hyΛ => h ⟨y, hyΛ, hy⟩⟩ + obtain ⟨z, hzΛ, hzΔ⟩ := hmeet + have hdis : Disjoint Λ (frontier Δ) := by + rw [← subBd_eq_frontier] + exact disjoint_left.mpr fun y hyΛ hybd => (hFS' (hDial.2.1 ▸ hybd)).2 hyΛ + have hΛ_sub : Λ ⊆ Δ := + subset_of_disjoint_frontier hΛ_open.isPathConnected.isConnected.isPreconnected + hDial.1.isClosed hdis hzΛ hzΔ + exact hDial.1.isClosed.closure_subset_iff.mpr hΛ_sub hx_cl + exact no_circuit_in_dial hDial hFU_sub hC hCs hCU_Δ + exact ⟨Δ, hΔ_sub, (isDial_interSet_iff_of_edges hS'_cl hEdges hFS' hΔ_sub).mpr hDial⟩ + +/-! ## 3. Circuit Path Selection and Corner Uniqueness Along `P` -/ + +/-- If a circuit `C` splits at `v₁ ≠ v₂` into paths `P₁, P₂`, and `K ⊆ C.U` is preconnected with +`v₁ ∈ K` and `v₂ ∈ K`, then either `P₁.U ⊆ K` or `P₂.U ⊆ K`. -/ +theorem path_subset_of_isPreconnected_inter_circuit [T2Space S] {C P₁ P₂ : Drawing S} + {v₁ v₂ : S} {K : Set S} + (hP₁ : P₁.IsPathBetween v₁ v₂) (hP₂ : P₂.IsPathBetween v₁ v₂) + (hP₁s : P₁.IsSubdrawing C) (hP₂s : P₂.IsSubdrawing C) + (hv12 : v₁ ≠ v₂) (hV_inter : P₁.V ∩ P₂.V = {v₁, v₂}) + (hE_disj : Disjoint P₁.E P₂.E) (hU_union : P₁.U ∪ P₂.U = C.U) + (hK_conn : IsPreconnected K) (hK_sub : K ⊆ C.U) (hv₁K : v₁ ∈ K) (hv₂K : v₂ ∈ K) : + P₁.U ⊆ K ∨ P₂.U ⊆ K := by + by_contra hnot + rw [not_or, Set.not_subset, Set.not_subset] at hnot + obtain ⟨⟨p, hp₁, hpK⟩, ⟨q, hq₂, hqK⟩⟩ := hnot + obtain ⟨f₁, hf₁0, hf₁1⟩ := isLine_of_isPathBetween hP₁ hv12 + obtain ⟨f₂, hf₂0, hf₂1⟩ := isLine_of_isPathBetween hP₂ hv12 + have hU_inter : P₁.U ∩ P₂.U = {v₁, v₂} := by + rw [U_inter_of_disjoint hP₁s hP₂s hE_disj, hV_inter] + let t₁ : I := f₁.symm ⟨p, hp₁⟩ + let t₂ : I := f₂.symm ⟨q, hq₂⟩ + have ht₁_val : (f₁ t₁).1 = p := by simp [t₁] + have ht₂_val : (f₂ t₂).1 = q := by simp [t₂] + have ht₁_0 : t₁ ≠ 0 := fun h => hpK (by rw [← ht₁_val, h, hf₁0]; exact hv₁K) + have ht₁_1 : t₁ ≠ 1 := fun h => hpK (by rw [← ht₁_val, h, hf₁1]; exact hv₂K) + have ht₂_0 : t₂ ≠ 0 := fun h => hqK (by rw [← ht₂_val, h, hf₂0]; exact hv₁K) + have ht₂_1 : t₂ ≠ 1 := fun h => hqK (by rw [← ht₂_val, h, hf₂1]; exact hv₂K) + let A : Set S := (fun s : I => (f₁ s).1) '' Iic t₁ ∪ (fun s : I => (f₂ s).1) '' Iic t₂ + let B : Set S := (fun s : I => (f₁ s).1) '' Ici t₁ ∪ (fun s : I => (f₂ s).1) '' Ici t₂ + have hA_cl : IsClosed A := + ((isClosed_Iic.isCompact.image (by fun_prop)).union + (isClosed_Iic.isCompact.image (by fun_prop))).isClosed + have hB_cl : IsClosed B := + ((isClosed_Ici.isCompact.image (by fun_prop)).union + (isClosed_Ici.isCompact.image (by fun_prop))).isClosed + have hAB : C.U ⊆ A ∪ B := by + rw [← hU_union] + rintro x (hx₁ | hx₂) + · obtain ⟨s, hs⟩ := f₁.surjective ⟨x, hx₁⟩ + have hxs : (f₁ s).1 = x := congrArg Subtype.val hs + rcases le_total s t₁ with h | h + · exact Or.inl (Or.inl ⟨s, h, hxs⟩) + · exact Or.inr (Or.inl ⟨s, h, hxs⟩) + · obtain ⟨s, hs⟩ := f₂.surjective ⟨x, hx₂⟩ + have hxs : (f₂ s).1 = x := congrArg Subtype.val hs + rcases le_total s t₂ with h | h + · exact Or.inl (Or.inr ⟨s, h, hxs⟩) + · exact Or.inr (Or.inr ⟨s, h, hxs⟩) + have hv₁A : v₁ ∈ A := Or.inl ⟨0, unitInterval.nonneg', hf₁0⟩ + have hv₂B : v₂ ∈ B := Or.inl ⟨1, unitInterval.le_one', hf₁1⟩ + obtain ⟨x, hxK, hxA, hxB⟩ := isPreconnected_closed_iff.mp hK_conn A B hA_cl hB_cl + (hK_sub.trans hAB) ⟨v₁, hv₁K, hv₁A⟩ ⟨v₂, hv₂K, hv₂B⟩ + have hx_pq : x = p ∨ x = q := by + rcases hxA with ⟨s₁, hs₁, rfl⟩ | ⟨s₂, hs₂, rfl⟩ <;> + rcases hxB with ⟨s₁', hs₁', heq⟩ | ⟨s₂', hs₂', heq⟩ + · have hs : s₁ = s₁' := f₁.injective (Subtype.ext heq.symm) + subst hs + have hst : s₁ = t₁ := le_antisymm hs₁ hs₁' + subst hst + exact Or.inl ht₁_val + · exfalso + have heq' : (f₂ s₂').1 = (f₁ s₁).1 := heq + have hmem : (f₁ s₁).1 ∈ P₁.U ∩ P₂.U := ⟨(f₁ s₁).2, heq' ▸ (f₂ s₂').2⟩ + rw [hU_inter] at hmem + rcases hmem with h1 | h2 + · have hs0' : s₂' = 0 := f₂.injective (Subtype.ext ((heq'.trans h1).trans hf₂0.symm)) + exact ht₂_0 (le_antisymm (hs0' ▸ hs₂') unitInterval.nonneg') + · have hs1 : s₁ = 1 := f₁.injective (Subtype.ext (h2.trans hf₁1.symm)) + exact ht₁_1 (le_antisymm unitInterval.le_one' (hs1 ▸ hs₁)) + · exfalso + have heq' : (f₁ s₁').1 = (f₂ s₂).1 := heq + have hmem : (f₂ s₂).1 ∈ P₁.U ∩ P₂.U := ⟨heq' ▸ (f₁ s₁').2, (f₂ s₂).2⟩ + rw [hU_inter] at hmem + rcases hmem with h1 | h2 + · have hs0' : s₁' = 0 := f₁.injective (Subtype.ext ((heq'.trans h1).trans hf₁0.symm)) + exact ht₁_0 (le_antisymm (hs0' ▸ hs₁') unitInterval.nonneg') + · have hs1 : s₂ = 1 := f₂.injective (Subtype.ext (h2.trans hf₂1.symm)) + exact ht₂_1 (le_antisymm unitInterval.le_one' (hs1 ▸ hs₂)) + · have hs : s₂ = s₂' := f₂.injective (Subtype.ext heq.symm) + subst hs + have hst : s₂ = t₂ := le_antisymm hs₂ hs₂' + subst hst + exact Or.inr ht₂_val + rcases hx_pq with rfl | rfl + · exact hpK hxK + · exact hqK hxK + +/-- At any vertex `w` of a circuit `C` of `H'` that has at least two vertices (`v₁, v₂ ∈ C.V`, +`v₁ ≠ v₂`), there are at least two half-edges of `H'` at `w`. -/ +theorem two_le_card_halfEdges_of_circuit [T2Space S] {H' C : Drawing S} + {γ : Set S → I → S} (hγ : EdgePar H' γ) (hC : C.IsCircuit) (hCs : C.IsSubdrawing H') + {w v₁ v₂ : S} (hw : w ∈ C.V) (hv₁ : v₁ ∈ C.V) (hv₂ : v₂ ∈ C.V) (hv12 : v₁ ≠ v₂) : + 2 ≤ Nat.card (halfEdges H' γ w) := by + have hex_other : ∃ v ∈ C.V, v ≠ w := by + by_cases h : v₁ = w + · exact ⟨v₂, hv₂, h ▸ hv12.symm⟩ + · exact ⟨v₁, hv₁, h⟩ + obtain ⟨v, hvC, hvw⟩ := hex_other + obtain ⟨W, ⟨hnd, hed⟩, hpos, hV, hE⟩ := exists_walk_at hC hw + cases W with + | nil _ => simp at hpos + | @cons _ u _ e₁ h₁ r => + have hr : r.IsSimple := hnd + have huw : u ≠ w := by + rintro rfl + have h0 := support_of_length_zero hr.length_eq_zero + have hv_sup : v ∈ (GraphWalk.cons h₁ r).support := by + rw [hV] at hvC + exact hvC + simp only [GraphWalk.support_cons, h0.1, List.mem_cons, List.not_mem_nil, or_false, + or_self] at hv_sup + exact hvw hv_sup + obtain ⟨e₂, he₂_r, hw_e₂⟩ := exists_edge_at_end r huw + have he₁C : e₁ ∈ C.E := by rw [hE]; exact List.mem_cons_self + have he₂C : e₂ ∈ C.E := by rw [hE]; exact List.mem_cons_of_mem _ he₂_r + have he12 : e₁ ≠ e₂ := fun h => (List.nodup_cons.mp hed).1 (h ▸ he₂_r) + have hw_e₁ : w ∈ closure e₁ := by + have : w ∈ closure e₁ ∩ C.V := by rw [h₁.2.2.2]; simp + exact this.1 + have hwH' : w ∈ H'.V := hCs.1 hw + have he₁H' : e₁ ∈ H'.E := hCs.2 he₁C + have he₂H' : e₂ ∈ H'.E := hCs.2 he₂C + obtain ⟨b₁, hb₁⟩ := exists_end_eq hγ he₁H' hwH' hw_e₁ + obtain ⟨b₂, hb₂⟩ := exists_end_eq hγ he₂H' hwH' hw_e₂ + have hk₁ : (e₁, b₁) ∈ halfEdges H' γ w := ⟨he₁H', hb₁⟩ + have hk₂ : (e₂, b₂) ∈ halfEdges H' γ w := ⟨he₂H', hb₂⟩ + have hk12 : ((e₁, b₁) : Set S × Bool) ≠ (e₂, b₂) := fun h => he12 (congrArg Prod.fst h) + have hfin := finite_halfEdges H' γ w + rw [Nat.card_coe_set_eq] + have hsub : ({(e₁, b₁), (e₂, b₂)} : Set (Set S × Bool)) ⊆ halfEdges H' γ w := by + rintro x (rfl | rfl) + · exact hk₁ + · exact hk₂ + have hcard_pair : ({(e₁, b₁), (e₂, b₂)} : Set (Set S × Bool)).ncard = 2 := + ncard_pair hk12 + linarith [ncard_le_ncard hsub hfin] + +/-- At any internal vertex `w ∈ P.V \ {v₁, v₂}` of the path `P` of `C` with `P.U ⊆ closure r`, +every edge of `H'` incident with `w` belongs to `P.E`, and the only regions of `H'` with `w` in +their closure are `Λ` and `r`. -/ +theorem internal_vertex_edges_and_regions [T2Space S] (hS : IsClosedSurface S) + {H' C P P' : Drawing S} {Λ r : Set S} {v₁ v₂ w : S} + (hRig' : IsRigidIn H' (univ \ Λ)) (hΛ_open : IsOpenDisc Λ) + (hC : C.IsCircuit) (hC_sub' : C.IsSubdrawing H') (hbd : subBd Λ = C.U) + (hE'_sub : ∀ e ∈ H'.E, e ⊆ univ \ Λ) (hΛ_R : Λ ∈ H'.R) + (hv₁C : v₁ ∈ C.V) (hv₂C : v₂ ∈ C.V) (hv12 : v₁ ≠ v₂) + (hPs : P.IsSubdrawing C) (hP's : P'.IsSubdrawing C) + (hV_inter : P.V ∩ P'.V = {v₁, v₂}) (hsup : C.sup P P' = C) + (hr_R' : r ∈ H'.R) (hr_sub : r ⊆ univ \ Λ) (hPU_r : P.U ⊆ closure r) + (hwP : w ∈ P.V) (hw1 : w ≠ v₁) (hw2 : w ≠ v₂) : + (∀ e ∈ H'.E, w ∈ closure e → e ∈ P.E) ∧ + (∀ s ∈ H'.R, w ∈ closure s → s = Λ ∨ s = r) := by + have hwC : w ∈ C.V := hPs.1 hwP + have hwH' : w ∈ H'.V := hC_sub'.1 hwC + have hw_not_P' : w ∉ P'.V := by + intro hwP' + have hmem : w ∈ P.V ∩ P'.V := ⟨hwP, hwP'⟩ + rw [hV_inter] at hmem + rcases hmem with rfl | rfl + · exact hw1 rfl + · exact hw2 rfl + have hCE_union : C.E = P.E ∪ P'.E := by + rw [← hsup, Drawing.sup_E hPs hP's] + have hC_to_P : ∀ e ∈ C.E, w ∈ closure e → e ∈ P.E := by + intro e heC hwe + rcases (hCE_union ▸ heC) with heP | heP' + · exact heP + · have hmem : w ∈ closure e ∩ C.V := ⟨hwe, hwC⟩ + rw [← hP's.closure_inter_V heP'] at hmem + exact absurd hmem.2 hw_not_P' + obtain ⟨_, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open.1 + have hΛ_to_P : ∀ e ∈ H'.E, w ∈ closure e → e ⊆ closure Λ → e ∈ P.E := by + intro e heH' hwe he_cl + have he_CU : e ⊆ C.U := by + intro x hxe + have hx_cl : x ∈ closure Λ := he_cl hxe + have hx_not_Λ : x ∉ Λ := (hE'_sub e heH' hxe).2 + rw [← hbd] + exact (hclL ▸ hx_cl).resolve_left hx_not_Λ + have heC : e ∈ C.E := by + by_contra he_not_C + obtain ⟨p, hp⟩ := heH'.1 + exact disjoint_left.mp (edge_disjoint_U hC_sub' heH' he_not_C) hp (he_CU hp) + exact hC_to_P e heC hwe + have : Nonempty S := ⟨w⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar H' + have h2 : 2 ≤ Nat.card (halfEdges H' γ w) := + two_le_card_halfEdges_of_circuit hγ hC hC_sub' hwC hv₁C hv₂C hv12 + obtain ⟨next, ρ, P_sec, W_sec, Q_sec, τ, hsec⟩ := + exists_sectors hS H' hγ hwH' h2 + have hcor := hsec.corners + have : Finite (halfEdges H' γ w) := (finite_halfEdges H' γ w).to_subtype + have hsurj : Function.Surjective next := Finite.injective_iff_surjective.mp hcor.inj + have hw_clΛ : w ∈ closure Λ := by + have hwCU : w ∈ C.U := C.V_subset_U hwC + rw [← hbd] at hwCU + exact hwCU.1 + obtain ⟨j, hj_ρ⟩ := hcor.all Λ hΛ_R hw_clΛ + have hj_ρ' : ρ j = Λ := hj_ρ.symm + obtain ⟨j_prev, hj_prev⟩ := hsurj j + have hw_cl_edge : ∀ k : halfEdges H' γ w, w ∈ closure k.1.1 := by + intro k + have h := end_mem_closure hγ k.2.1 k.1.2 + rwa [k.2.2] at h + have hnext_j_P : (next j).1.1 ∈ P.E := by + refine hΛ_to_P (next j).1.1 (next j).2.1 (hw_cl_edge (next j)) ?_ + rw [← hj_ρ'] + exact hcor.left j + have hj_P : j.1.1 ∈ P.E := by + refine hΛ_to_P j.1.1 j.2.1 (hw_cl_edge j) ?_ + have h := hcor.right j_prev + rwa [hj_prev, hj_ρ'] at h + have hr_ne_Λ : r ≠ Λ := by + intro hrΛ + obtain ⟨p, hp⟩ := region_nonempty hr_R' + exact (hr_sub hp).2 (hrΛ ▸ hp) + have hρ_next : ρ (next j) = r := by + have hsub_r : (next j).1.1 ⊆ closure r := + (subset_closure.trans (P.closure_subset_U hnext_j_P)).trans hPU_r + rcases hcor.sides j r hr_R' hsub_r with h | h + · exact absurd (h.trans hj_ρ') hr_ne_Λ + · exact h.symm + have hρ_prev : ρ j_prev = r := by + have hsub_r : (next j_prev).1.1 ⊆ closure r := by + rw [hj_prev] + exact (subset_closure.trans (P.closure_subset_U hj_P)).trans hPU_r + rcases hcor.sides j_prev r hr_R' hsub_r with h | h + · exact h.symm + · rw [hj_prev, hj_ρ'] at h + exact absurd h hr_ne_Λ + have hwS' : w ∈ univ \ Λ := by + refine ⟨mem_univ w, fun hwΛ => ?_⟩ + have hw_bd : w ∈ subBd Λ := hbd.symm ▸ C.V_subset_U hwC + exact disjoint_left.mp (isOpen_disjoint_subBd_and_closure_eq hΛ_open.1).1 hwΛ hw_bd + have hnext_eq_prev : next j = j_prev := by + by_contra hne + exact corner_regions_ne_in hS hRig' hwH' hwS' hsec (hρ_next ▸ hr_sub) hne + (hρ_next.trans hρ_prev.symm) + have hnext_next : next (next j) = j := by + rw [hnext_eq_prev, hj_prev] + have hall_two : ∀ k : halfEdges H' γ w, k = j ∨ k = next j := by + intro k + induction hcor.reach j k with + | refl => exact Or.inl rfl + | tail _ hyz ih => + rcases ih with rfl | rfl + · exact Or.inr hyz + · exact Or.inl (hyz.trans hnext_next) + refine ⟨fun e heH' hwe => ?_, fun s hsR' hws => ?_⟩ + · obtain ⟨b, hb⟩ := exists_end_eq hγ heH' hwH' hwe + let k : halfEdges H' γ w := ⟨(e, b), heH', hb⟩ + rcases hall_two k with hk | hk + · have : e = j.1.1 := congrArg (fun x : halfEdges H' γ w => x.1.1) hk + exact this ▸ hj_P + · have : e = (next j).1.1 := congrArg (fun x : halfEdges H' γ w => x.1.1) hk + exact this ▸ hnext_j_P + · obtain ⟨k, rfl⟩ := hcor.all s hsR' hws + rcases hall_two k with rfl | rfl + · exact Or.inl hj_ρ' + · exact Or.inr hρ_next + +/-- If `F' ⊆ univ \ Λ` is an `O`-arc with `F' ∩ H'.U = {v₁, v₂}` and `F' \ {v₁, v₂} ⊆ r` +(`r ∈ H'.R`, `r ⊆ univ \ Λ`), then any dial `Δ' ⊆ univ \ Λ` for `F', H'` satisfies +`Δ' ∩ H'.U ⊆ F'`. -/ +theorem dial_inter_sub_of_pushed [T2Space S] (hS : IsClosedSurface S) {H' C : Drawing S} + {Λ r F' Δ' : Set S} {v₁ v₂ : S} + (hRig' : IsRigidIn H' (univ \ Λ)) (hΛ_open : IsOpenDisc Λ) + (hC : C.IsCircuit) (hC_sub' : C.IsSubdrawing H') (hbd : subBd Λ = C.U) + (hv₁C : v₁ ∈ C.V) (hv₂C : v₂ ∈ C.V) (hv12 : v₁ ≠ v₂) + (hr_R' : r ∈ H'.R) (hr_sub : r ⊆ univ \ Λ) + (hF'_r : F' \ {v₁, v₂} ⊆ r) (hF'_V : F' ∩ H'.V = {v₁, v₂}) + (hDial' : IsDial H' F' Δ') : + Δ' ∩ H'.U ⊆ F' := by + rcases hDial'.2.2 with h1 | ⟨x, y, hxy, hFV_xy, hQ⟩ + · exact h1 + · exfalso + let Q : Drawing S := H'.interSet Δ' + have hQs : Q.IsSubdrawing H' := Drawing.span_isSubdrawing H' _ _ + have hFU'_sub : F' ∩ H'.U ⊆ H'.V := by + rintro z ⟨hzF', hzU'⟩ + by_cases hz : z ∈ ({v₁, v₂} : Set S) + · rcases hz with rfl | rfl + · exact hC_sub'.1 hv₁C + · exact hC_sub'.1 hv₂C + · exact absurd hzU' (region_subset hr_R' (hF'_r ⟨hzF', hz⟩)) + have hEdgesΔ' : ∀ e ∈ H'.E, (e ∩ Δ').Nonempty → e ⊆ Δ' := + fun e he hne => edge_subset_of_inter_nonempty hDial'.1.isClosed (hDial'.2.1 ▸ hFU'_sub) he hne + obtain ⟨_, hQU_eq⟩ := interSet_V_and_U_of_edges hDial'.1.isClosed hEdgesΔ' + have hΔ'U : Δ' ∩ H'.U = Q.U := by + change Δ' ∩ H'.U = (H'.interSet Δ').U + rw [inter_comm, ← hQU_eq] + have hbdΔ' : discBd Δ' = F' := + (IsClosedDisc.subBd_eq_discBd hS hDial'.1).symm.trans hDial'.2.1 + have hQU_sub : Q.U ⊆ Δ' := by + rw [← hΔ'U] + exact inter_subset_left + have hQU_bd : Q.U ∩ discBd Δ' = {x, y} := by + rw [hbdΔ', ← hΔ'U, ← hFV_xy] + ext z + refine ⟨fun ⟨⟨_, hzU⟩, hzF'⟩ => ⟨hzF', hFU'_sub ⟨hzF', hzU⟩⟩, + fun ⟨hzF', hzV'⟩ => ⟨⟨hDial'.1.isClosed.closure_eq ▸ (hDial'.2.1 ▸ hzF').1, + H'.V_subset_U hzV'⟩, hzF'⟩⟩ + have hQU_line : IsLineWithEnds Q.U x y := by + obtain ⟨f, hf0, hf1⟩ := isLine_of_isPathBetween hQ hxy + exact ⟨f, hf0, hf1⟩ + obtain ⟨A₁, A₂, D₁, D₂, _, hcompA, _, _, hD_union, _, hbd₁, hbd₂, hcompD⟩ := + disc_iArc Δ' Q.U x y hDial'.1 hQU_sub hxy hQU_line hQU_bd + have hxy_eq : ({x, y} : Set S) = {v₁, v₂} := hFV_xy.symm.trans hF'_V + have hsub_r : ∀ D_i A_i, D_i \ Q.U ∈ componentsIn (Δ' \ Q.U) → + A_i ∈ componentsIn (discBd Δ' \ {x, y}) → discBd D_i = A_i ∪ Q.U → D_i \ Q.U ⊆ r := by + intro D_i A_i hDi_mem hAi_mem hbd_i + obtain ⟨p, hp, hDi_eq⟩ := hDi_mem + obtain ⟨a, ha, hAi_eq⟩ := hAi_mem + have ha_Ai : a ∈ A_i := hAi_eq ▸ mem_connectedComponentIn ha + have ha_bd : a ∈ discBd Δ' \ {x, y} := ha + have ha_r : a ∈ r := by + rw [hbdΔ', hxy_eq] at ha_bd + exact hF'_r ha_bd + have ha_Di : a ∈ D_i \ Q.U := by + refine ⟨Surface.discBd_subset D_i (hbd_i ▸ Or.inl ha_Ai), fun haQ => ?_⟩ + exact ha_bd.2 (hQU_bd ▸ ⟨haQ, ha_bd.1⟩) + have hpre : IsPreconnected (D_i \ Q.U) := hDi_eq ▸ isPreconnected_connectedComponentIn + have hdis : Disjoint (D_i \ Q.U) H'.U := by + refine disjoint_left.mpr fun z hz hzU => hz.2 ?_ + have hzΔ' : z ∈ Δ' := (connectedComponentIn_subset (Δ' \ Q.U) p (hDi_eq ▸ hz)).1 + exact hΔ'U ▸ ⟨hzΔ', hzU⟩ + exact subset_region hr_R' hpre hdis ha_Di ha_r + have hD₁_r : D₁ \ Q.U ⊆ r := + hsub_r D₁ A₁ (hcompD ▸ Or.inl rfl) (hcompA ▸ Or.inl rfl) hbd₁ + have hD₂_r : D₂ \ Q.U ⊆ r := + hsub_r D₂ A₂ (hcompD ▸ Or.inr rfl) (hcompA ▸ Or.inr rfl) hbd₂ + have hΔ'_diff_r : Δ' \ H'.U ⊆ r := by + rw [show Δ' \ H'.U = Δ' \ Q.U by ext z; simp [← hΔ'U], ← hD_union, union_sdiff_distrib] + exact union_subset hD₁_r hD₂_r + obtain ⟨W_Q, _, _, hEQ⟩ := hQ + obtain ⟨e, heW, hxe⟩ := exists_edge_at_end W_Q.reverse hxy.symm + rw [GraphWalk.edges_reverse, List.mem_reverse] at heW + have heQ : e ∈ Q.E := by rw [hEQ]; exact heW + have heH' : e ∈ H'.E := hQs.2 heQ + have hx_v12 : x ∈ ({v₁, v₂} : Set S) := by + rw [← hxy_eq] + exact Or.inl rfl + have hxC : x ∈ C.V := by + rcases hx_v12 with rfl | rfl + · exact hv₁C + · exact hv₂C + have hxH' : x ∈ H'.V := hC_sub'.1 hxC + have hxS' : x ∈ univ \ Λ := by + refine ⟨mem_univ x, fun hxΛ => ?_⟩ + have hx_bd : x ∈ subBd Λ := hbd.symm ▸ C.V_subset_U hxC + exact disjoint_left.mp (isOpen_disjoint_subBd_and_closure_eq hΛ_open.1).1 hxΛ hx_bd + have : Nonempty S := ⟨x⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar H' + have h2 : 2 ≤ Nat.card (halfEdges H' γ x) := + two_le_card_halfEdges_of_circuit hγ hC hC_sub' hxC hv₁C hv₂C hv12 + obtain ⟨next, ρ, P_sec, W_sec, Q_sec, τ, hsec⟩ := + exists_sectors hS H' hγ hxH' h2 + have hcor := hsec.corners + have : Finite (halfEdges H' γ x) := (finite_halfEdges H' γ x).to_subtype + have hsurj : Function.Surjective next := Finite.injective_iff_surjective.mp hcor.inj + obtain ⟨b, hb⟩ := exists_end_eq hγ heH' hxH' hxe + obtain ⟨k', hk'⟩ := hsurj ⟨(e, b), heH', hb⟩ + have hk'_edge : (next k').1.1 = e := congrArg (fun k : halfEdges H' γ x => k.1.1) hk' + let U_open : Set S := Δ' \ subBd Δ' + have hU_open : IsOpen U_open := ((IsClosedDisc.isOpenDisc_diff_subBd hS hDial'.1).1).1 + obtain ⟨p₀, hp₀⟩ := heH'.1 + have hp₀_U : p₀ ∈ U_open := by + refine ⟨hQU_sub (Q.closure_subset_U heQ (subset_closure hp₀)), fun hp_bd => ?_⟩ + have hp_xy : p₀ ∈ ({x, y} : Set S) := + hQU_bd ▸ ⟨Q.closure_subset_U heQ (subset_closure hp₀), + (IsClosedDisc.subBd_eq_discBd hS hDial'.1) ▸ hp_bd⟩ + have hpV' : p₀ ∈ H'.V := (hFV_xy ▸ hp_xy).2 + exact (heH'.2.1 hp₀).2 hpV' + have hρ_eq_r : ∀ l : halfEdges H' γ x, p₀ ∈ closure (ρ l) → ρ l = r := by + intro l hpl + obtain ⟨z, hzU, hzl⟩ := mem_closure_iff.mp hpl U_open hU_open hp₀_U + have hz_not_U : z ∉ H'.U := region_subset (hcor.region l) hzl + have hzr : z ∈ r := hΔ'_diff_r ⟨hzU.1, hz_not_U⟩ + exact region_eq_of_mem (hcor.region l) hr_R' hzl hzr + have hρ1 : ρ k' = r := hρ_eq_r k' (hcor.left k' (hk'_edge.symm ▸ hp₀)) + have hρ2 : ρ (next k') = r := hρ_eq_r (next k') (hcor.right k' (hk'_edge.symm ▸ hp₀)) + exact corner_regions_ne_in hS hRig' hxH' hxS' hsec (hρ1 ▸ hr_sub) (hsec.next_ne k').symm + (hρ1.trans hρ2.symm) + +/-! ## 4. Constructing the Exterior Disc `Δ₂` and Proof of (6.3) -/ + +/-- A line in a T2 space is closed. -/ +private theorem isClosed_of_isLineWithEnds [T2Space S] {L : Set S} {a b : S} + (hL : IsLineWithEnds L a b) : IsClosed L := by + obtain ⟨f, _, _⟩ := hL + have h : L = range (fun t : I => (f t).1) := by + ext x + exact ⟨fun hx => ⟨f.symm ⟨x, hx⟩, by simp⟩, fun ⟨t, ht⟩ => ht ▸ (f t).2⟩ + rw [h] + exact (isCompact_range (continuous_subtype_val.comp f.continuous)).isClosed + +private theorem push_path_into_adjacent_region [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) + {H' C P P' : Drawing S} {Λ r F₂ : Set S} {v₁ v₂ : S} + (hRig' : IsRigidIn H' (univ \ Λ)) (hΛ_open : IsOpenDisc Λ) (hΛ_cl : IsClosedDisc (closure Λ)) + (hC : C.IsCircuit) (hC_sub' : C.IsSubdrawing H') (hbd : subBd Λ = C.U) + (hE'_sub : ∀ e ∈ H'.E, e ⊆ univ \ Λ) (hΛ_R : Λ ∈ H'.R) + (hv₁C : v₁ ∈ C.V) (hv₂C : v₂ ∈ C.V) (hv12 : v₁ ≠ v₂) + (hPs : P.IsSubdrawing C) (hP's : P'.IsSubdrawing C) + (hV_inter : P.V ∩ P'.V = {v₁, v₂}) (hsup : C.sup P P' = C) + (hr_R' : r ∈ H'.R) (hr_sub : r ⊆ univ \ Λ) (hPU_r : P.U ⊆ closure r) + (hF₂_line : IsLineWithEnds F₂ v₁ v₂) (hF₂_r : F₂ \ {v₁, v₂} ⊆ r) + (hL_line : IsLineWithEnds P.U v₁ v₂) (hsubBd_cl : subBd (closure Λ) = C.U) + (hL_cl : P.U ⊆ closure Λ) : + let L : Set S := P.U + let Z_edges : Set S := (H'.V \ L) ∪ ⋃ e ∈ H'.E \ P.E, closure e + let K_reg : Set S := ⋃ s ∈ H'.R \ {r, Λ}, closure s + let Y : Set S := Z_edges ∪ K_reg ∪ F₂ + Disjoint r (closure Λ) ∧ ∃ h : S ≃ₜ S, + (∀ x ∈ Y, h x = x) ∧ (h '' L) \ {v₁, v₂} ⊆ r := by + intro L Z_edges K_reg Y + have : CompactSpace S := hS.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hv₁F₂, hv₂F₂⟩ := IsLineWithEnds.ends_mem hF₂_line + have hL_bd : L ⊆ subBd (closure Λ) := hsubBd_cl.symm ▸ hPs.U_subset + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open.1 + have hr_ne_Λ : r ≠ Λ := by + intro hrΛ + obtain ⟨p, hp⟩ := region_nonempty hr_R' + exact (hr_sub hp).2 (hrΛ ▸ hp) + have hdis_r_clΛ : Disjoint r (closure Λ) := by + have hdis_rΛ : Disjoint r Λ := disjoint_left.mpr fun x hxr hxΛ => (hr_sub hxr).2 hxΛ + rw [hclL, disjoint_union_right, hbd] + exact ⟨hdis_rΛ, disjoint_left.mpr fun x hxr hxC => region_subset hr_R' hxr + (hC_sub'.U_subset hxC)⟩ + have hZ_cl : IsClosed Z_edges := + (H'.finite_V.subset sdiff_subset).isClosed.union + ((H'.finite_edges.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure) + have hK_cl : IsClosed K_reg := + ((finite_R hS H').subset sdiff_subset).isClosed_biUnion + fun _ _ => isClosed_closure + have hY_cl : IsClosed Y := (hZ_cl.union hK_cl).union (isClosed_of_isLineWithEnds hF₂_line) + have hv₁Y : v₁ ∈ Y := Or.inr hv₁F₂ + have hv₂Y : v₂ ∈ Y := Or.inr hv₂F₂ + have hP_H' : P.IsSubdrawing H' := hPs.trans hC_sub' + have hYL : Y ∩ L ⊆ {v₁, v₂} := by + rintro x ⟨hxY, hxL⟩ + by_contra hx_not + have hx1 : x ≠ v₁ := fun h => hx_not (Or.inl h) + have hx2 : x ≠ v₂ := fun h => hx_not (Or.inr h) + rcases hxY with (hxZ | hxK) | hxF₂ + · rcases hxZ with hxV | hxE + · exact hxV.2 hxL + · obtain ⟨e, ⟨heH', he_not_P⟩, hxe⟩ := mem_iUnion₂.mp hxE + by_cases hxPV : x ∈ P.V + · exact he_not_P ((internal_vertex_edges_and_regions hS hRig' hΛ_open hC hC_sub' hbd + hE'_sub hΛ_R hv₁C hv₂C hv12 hPs hP's hV_inter hsup hr_R' hr_sub hPU_r hxPV hx1 hx2).1 + e heH' hxe) + · obtain ⟨e₀, he₀P, hxe₀⟩ := P.exists_edge_of_mem hxL hxPV + have he₀H' : e₀ ∈ H'.E := hP_H'.2 he₀P + have hx_not_V' : x ∉ H'.V := (he₀H'.2.1 hxe₀).2 + have hxe' : x ∈ e := (H'.closure_diff_V heH').symm ▸ ⟨hxe, hx_not_V'⟩ + exact he_not_P (H'.edge_eq_of_mem heH' he₀H' hxe' hxe₀ ▸ he₀P) + · obtain ⟨s, ⟨hsR', hs_not⟩, hxs⟩ := mem_iUnion₂.mp hxK + by_cases hxPV : x ∈ P.V + · rcases (internal_vertex_edges_and_regions hS hRig' hΛ_open hC hC_sub' hbd hE'_sub hΛ_R + hv₁C hv₂C hv12 hPs hP's hV_inter hsup hr_R' hr_sub hPU_r hxPV hx1 hx2).2 s hsR' hxs + with rfl | rfl + · exact hs_not (Or.inr rfl) + · exact hs_not (Or.inl rfl) + · obtain ⟨e₀, he₀P, hxe₀⟩ := P.exists_edge_of_mem hxL hxPV + have he₀H' : e₀ ∈ H'.E := hP_H'.2 he₀P + have he₀_s : e₀ ⊆ closure s := + edge_subset_closure_of_incident hS he₀H' hsR' ⟨x, hxe₀, hxs⟩ + have he₀_r : e₀ ⊆ closure r := + (subset_closure.trans (P.closure_subset_U he₀P)).trans hPU_r + have he₀_Λ : e₀ ⊆ closure Λ := + (subset_closure.trans (P.closure_subset_U he₀P)).trans hL_cl + rcases region_incident_two hS he₀H' hr_R' hΛ_R hsR' + he₀_r he₀_Λ he₀_s with h | h | h + · exact hr_ne_Λ h + · exact hs_not (Or.inl h.symm) + · exact hs_not (Or.inr h.symm) + · exact region_subset hr_R' (hF₂_r ⟨hxF₂, hx_not⟩) (hP_H'.U_subset hxL) + have hY_dis_Λ : Disjoint Y Λ := by + refine disjoint_left.mpr fun x hxY hxΛ => ?_ + rcases hxY with (hxZ | hxK) | hxF₂ + · have hxU' : x ∈ H'.U := by + rcases hxZ with ⟨hxV, _⟩ | hxE + · exact H'.V_subset_U hxV + · obtain ⟨e, ⟨heH', _⟩, hxe⟩ := mem_iUnion₂.mp hxE + exact H'.closure_subset_U heH' hxe + exact region_subset hΛ_R hxΛ hxU' + · obtain ⟨s, ⟨hsR', hs_not⟩, hxs⟩ := mem_iUnion₂.mp hxK + have hs_ne : s ≠ Λ := fun h => hs_not (Or.inr h) + have hdis_sΛ : Disjoint s Λ := + disjoint_left.mpr fun z hzs hzΛ => hs_ne (region_eq_of_mem hsR' hΛ_R hzs hzΛ) + exact disjoint_left.mp (hdis_sΛ.closure_left hΛ_open.1) hxs hxΛ + · by_cases hx12 : x ∈ ({v₁, v₂} : Set S) + · have hxC : x ∈ C.U := by + rcases hx12 with rfl | rfl + · exact C.V_subset_U hv₁C + · exact C.V_subset_U hv₂C + exact disjoint_left.mp hdisL hxΛ (hbd.symm ▸ hxC) + · exact disjoint_left.mp hdis_r_clΛ (hF₂_r ⟨hxF₂, hx12⟩) (subset_closure hxΛ) + have hYD : Y ∩ closure Λ ⊆ subBd (closure Λ) := by + rintro x ⟨hxY, hx_cl⟩ + rw [hsubBd_cl, ← hbd] + exact (hclL ▸ hx_cl).resolve_left (disjoint_left.mp hY_dis_Λ hxY) + obtain ⟨h, hhY, hhL⟩ := push_arc_of_fixed_boundary hS hΛ_cl hL_line hL_bd hY_cl hYD hv₁Y hv₂Y hYL + have h_compl_r : univ \ (Y ∪ closure Λ) ⊆ r := by + rintro y ⟨_, hy_not⟩ + have hyY : y ∉ Y := fun h => hy_not (Or.inl h) + have hy_clΛ : y ∉ closure Λ := fun h => hy_not (Or.inr h) + have hyU' : y ∉ H'.U := by + intro hyU' + by_cases hyV' : y ∈ H'.V + · by_cases hyL : y ∈ L + · exact hy_clΛ (hL_cl hyL) + · exact hyY (Or.inl (Or.inl (Or.inl ⟨hyV', hyL⟩))) + · obtain ⟨e, heH', hye⟩ := H'.exists_edge_of_mem hyU' hyV' + by_cases heP : e ∈ P.E + · exact hy_clΛ (hL_cl (P.closure_subset_U heP (subset_closure hye))) + · exact hyY (Or.inl (Or.inl (Or.inr (mem_iUnion₂.mpr ⟨e, ⟨heH', heP⟩, + subset_closure hye⟩)))) + obtain ⟨s, hsR', hys⟩ := exists_region_of_notMem hyU' + by_cases hs_r : s = r + · exact hs_r ▸ hys + · by_cases hs_Λ : s = Λ + · exact absurd (subset_closure (hs_Λ ▸ hys)) hy_clΛ + · exact absurd (Or.inl (Or.inr (mem_iUnion₂.mpr ⟨s, ⟨hsR', fun h => h.elim hs_r hs_Λ⟩, + subset_closure hys⟩))) hyY + have hhL_r : (h '' L) \ {v₁, v₂} ⊆ r := by + rintro y ⟨⟨x, hxL, rfl⟩, hy12⟩ + refine h_compl_r ⟨mem_univ _, ?_⟩ + rintro (hyY | hy_clΛ) + · have hhx : h (h x) = h x := hhY (h x) hyY + have hx_eq : h x = x := h.injective hhx + have hxY : x ∈ Y := hx_eq ▸ hyY + exact hy12 (hx_eq.symm ▸ hYL ⟨hxY, hxL⟩) + · exact hy12 (hhL ⟨⟨x, hxL, rfl⟩, hy_clΛ⟩) + exact ⟨hdis_r_clΛ, h, hhY, hhL_r⟩ + +private theorem frontier_of_pushed_cycle [T2Space S] {H' C P P' : Drawing S} + {Λ r F₂ : Set S} {v₁ v₂ : S} + (hC_sub' : C.IsSubdrawing H') (hPs : P.IsSubdrawing C) (hP's : P'.IsSubdrawing C) + (hV_inter : P.V ∩ P'.V = {v₁, v₂}) (hE_disj : Disjoint P.E P'.E) (hsup : C.sup P P' = C) + (hsubBd_cl : subBd (closure Λ) = C.U) + (hv₁F₂ : v₁ ∈ F₂) (hv₂F₂ : v₂ ∈ F₂) + (h : S ≃ₜ S) : + let L : Set S := P.U + let Y : Set S := ((H'.V \ L) ∪ ⋃ e ∈ H'.E \ P.E, closure e) ∪ + (⋃ s ∈ H'.R \ {r, Λ}, closure s) ∪ F₂ + (∀ x ∈ Y, h x = x) → frontier (h '' closure Λ) = h '' L ∪ P'.U := by + intro L Y hhY + have hv₁Y : v₁ ∈ Y := Or.inr hv₁F₂ + have hv₂Y : v₂ ∈ Y := Or.inr hv₂F₂ + have hP_H' : P.IsSubdrawing H' := hPs.trans hC_sub' + have hP'U_Y : P'.U ⊆ Y := by + rw [P'.U_eq] + refine union_subset (fun x hx => ?_) (iUnion₂_subset fun e heP' x hxe => ?_) + · by_cases hxL : x ∈ L + · have hxV_P : x ∈ P.V := by + by_contra hx_not_PV + obtain ⟨e₀, he₀P, hxe₀⟩ := P.exists_edge_of_mem hxL hx_not_PV + exact ((hP_H'.2 he₀P).2.1 hxe₀).2 (hC_sub'.1 (hP's.1 hx)) + have hx12 : x ∈ ({v₁, v₂} : Set S) := hV_inter ▸ ⟨hxV_P, hx⟩ + rcases hx12 with rfl | rfl + · exact hv₁Y + · exact hv₂Y + · exact Or.inl (Or.inl (Or.inl ⟨hC_sub'.1 (hP's.1 hx), hxL⟩)) + · have he_not_P : e ∉ P.E := disjoint_right.mp hE_disj heP' + exact Or.inl (Or.inl (Or.inr (mem_iUnion₂.mpr ⟨e, ⟨hC_sub'.2 (hP's.2 heP'), he_not_P⟩, hxe⟩))) + have hCU_union : C.U = L ∪ P'.U := by + rw [← hsup, Drawing.sup_U hPs hP's] + let D_pushed : Set S := h '' (closure Λ) + have hfr_D_pushed : frontier D_pushed = h '' L ∪ P'.U := by + rw [← h.image_frontier, ← subBd_eq_frontier, hsubBd_cl, hCU_union, image_union] + congr 1 + ext x + exact ⟨fun ⟨y, hy, hyx⟩ => hyx ▸ (hhY y (hP'U_Y hy)).symm ▸ hy, + fun hx => ⟨x, hx, hhY x (hP'U_Y hx)⟩⟩ + exact hfr_D_pushed + +/-- Given the path `P` of `C` between `v₁` and `v₂` with `P.U ⊆ closure r` (`r ∈ H'.R`, +`r ⊆ univ \ Λ`) and an arc `F₂` between `v₁` and `v₂` with `F₂ \ {v₁, v₂} ⊆ r`, pushing `P.U` into +`r` and applying rigidity of `H'` in `univ \ Λ` produces a closed disc `Δ₂` bounded by `F₂ ∪ P.U` +with `Δ₂ ∩ closure Λ = P.U` and `Δ₂ ∩ H'.U = P.U`. -/ +theorem exists_pushed_disc_of_arc [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {H' C P P' : Drawing S} {Λ r F₂ : Set S} {v₁ v₂ : S} + (hRig' : IsRigidIn H' (univ \ Λ)) (hΛ_open : IsOpenDisc Λ) (hΛ_cl : IsClosedDisc (closure Λ)) + (hC : C.IsCircuit) (hC_sub' : C.IsSubdrawing H') (hbd : subBd Λ = C.U) + (hE'_sub : ∀ e ∈ H'.E, e ⊆ univ \ Λ) (hΛ_R : Λ ∈ H'.R) + (hv₁C : v₁ ∈ C.V) (hv₂C : v₂ ∈ C.V) (hv12 : v₁ ≠ v₂) + (hP : P.IsPathBetween v₁ v₂) (hPs : P.IsSubdrawing C) (hP's : P'.IsSubdrawing C) + (hV_inter : P.V ∩ P'.V = {v₁, v₂}) (hE_disj : Disjoint P.E P'.E) (hsup : C.sup P P' = C) + (hr_R' : r ∈ H'.R) (hr_sub : r ⊆ univ \ Λ) (hPU_r : P.U ⊆ closure r) + (hF₂_line : IsLineWithEnds F₂ v₁ v₂) (hF₂_r : F₂ \ {v₁, v₂} ⊆ r) : + ∃ Δ₂ : Set S, IsClosedDisc Δ₂ ∧ subBd Δ₂ = F₂ ∪ P.U ∧ + Δ₂ ∩ closure Λ = P.U ∧ Δ₂ ∩ H'.U = P.U := by + have : CompactSpace S := hS.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let L : Set S := P.U + obtain ⟨f_L, hfL0, hfL1⟩ := isLine_of_isPathBetween hP hv12 + have hL_line : IsLineWithEnds L v₁ v₂ := ⟨f_L, hfL0, hfL1⟩ + obtain ⟨hv₁L, hv₂L⟩ := IsLineWithEnds.ends_mem hL_line + obtain ⟨hv₁F₂, hv₂F₂⟩ := IsLineWithEnds.ends_mem hF₂_line + have hO_bd : IsOArc (subBd Λ) := hbd ▸ isOArc_of_isCircuit hC + have hsubBd_cl : subBd (closure Λ) = C.U := + (subBd_closure_eq_subBd_of_isOpenDisc hS hΛ_open hO_bd hΛ_cl).trans hbd + have hL_cl : L ⊆ closure Λ := hPs.U_subset.trans (hbd ▸ fun _ h => h.1) + obtain ⟨hdisL, _⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open.1 + let Z_edges : Set S := (H'.V \ L) ∪ ⋃ e ∈ H'.E \ P.E, closure e + let K_reg : Set S := ⋃ s ∈ H'.R \ {r, Λ}, closure s + let Y : Set S := Z_edges ∪ K_reg ∪ F₂ + have hv₁Y : v₁ ∈ Y := Or.inr hv₁F₂ + have hv₂Y : v₂ ∈ Y := Or.inr hv₂F₂ + have hP_H' : P.IsSubdrawing H' := hPs.trans hC_sub' + obtain ⟨hdis_r_clΛ, h, hhY, hhL_r⟩ := + push_path_into_adjacent_region hS hRig' hΛ_open hΛ_cl hC hC_sub' hbd hE'_sub hΛ_R + hv₁C hv₂C hv12 hPs hP's hV_inter hsup hr_R' hr_sub hPU_r hF₂_line hF₂_r + hL_line hsubBd_cl hL_cl + have hh_v₁ : h v₁ = v₁ := hhY v₁ hv₁Y + have hh_v₂ : h v₂ = v₂ := hhY v₂ hv₂Y + let F' : Set S := F₂ ∪ h '' L + have hF₂_img : h '' F₂ = F₂ := by + ext x + exact ⟨fun ⟨y, hy, hyx⟩ => hyx ▸ (hhY y (Or.inr hy)).symm ▸ hy, + fun hx => ⟨x, hx, hhY x (Or.inr hx)⟩⟩ + have hF'_img : F' = h '' (F₂ ∪ L) := by + change F₂ ∪ h '' L = _ + rw [image_union, hF₂_img] + have hF₂L_inter : F₂ ∩ L ⊆ {v₁, v₂} := by + rintro x ⟨hxF₂, hxL⟩ + by_contra hx12 + exact region_subset hr_R' (hF₂_r ⟨hxF₂, hx12⟩) (hP_H'.U_subset hxL) + have hF'_oArc : IsOArc F' := by + rw [hF'_img] + exact (isOArc_union hF₂_line hL_line hF₂L_inter).image h.continuous.continuousOn + h.symm.continuous.continuousOn (fun x _ => h.symm_apply_apply x) + have hF'_r : F' \ {v₁, v₂} ⊆ r := by + rintro x ⟨hxF₂ | hxL', hx12⟩ + · exact hF₂_r ⟨hxF₂, hx12⟩ + · exact hhL_r ⟨hxL', hx12⟩ + have hv₁_S' : v₁ ∈ univ \ Λ := + ⟨mem_univ v₁, fun hv₁Λ => disjoint_left.mp hdisL hv₁Λ (hbd.symm ▸ C.V_subset_U hv₁C)⟩ + have hv₂_S' : v₂ ∈ univ \ Λ := + ⟨mem_univ v₂, fun hv₂Λ => disjoint_left.mp hdisL hv₂Λ (hbd.symm ▸ C.V_subset_U hv₂C)⟩ + have hF'_sub : F' ⊆ univ \ Λ := by + intro x hxF' + by_cases hx12 : x ∈ ({v₁, v₂} : Set S) + · rcases hx12 with rfl | rfl + · exact hv₁_S' + · exact hv₂_S' + · exact hr_sub (hF'_r ⟨hxF', hx12⟩) + have hv₁F' : v₁ ∈ F' := Or.inl hv₁F₂ + have hv₂F' : v₂ ∈ F' := Or.inl hv₂F₂ + have hF'_U : F' ∩ H'.U = {v₁, v₂} := by + apply subset_antisymm + · rintro x ⟨hxF', hxU'⟩ + by_contra hx12 + exact region_subset hr_R' (hF'_r ⟨hxF', hx12⟩) hxU' + · rintro x (rfl | rfl) + · exact ⟨hv₁F', H'.V_subset_U (hC_sub'.1 hv₁C)⟩ + · exact ⟨hv₂F', H'.V_subset_U (hC_sub'.1 hv₂C)⟩ + have hF'_V : F' ∩ H'.V = {v₁, v₂} := by + apply subset_antisymm + · exact (inter_subset_inter_right F' H'.V_subset_U).trans (hF'_U.subset) + · rintro x (rfl | rfl) + · exact ⟨hv₁F', hC_sub'.1 hv₁C⟩ + · exact ⟨hv₂F', hC_sub'.1 hv₂C⟩ + have hFU'_sub : F' ∩ H'.U ⊆ H'.V := by + rw [hF'_U, ← hF'_V] + exact inter_subset_right + have hFV'_card : (F' ∩ H'.V).ncard ≤ 2 := by + rw [hF'_V, ncard_pair hv12] + obtain ⟨Δ', hΔ'_sub, hDial'⟩ := hRig' F' hF'_sub hF'_oArc hFU'_sub hFV'_card + have hF'_sub_Δ' : F' ⊆ Δ' := by + intro x hx + have hx_bd : x ∈ subBd Δ' := hDial'.2.1.symm ▸ hx + exact hDial'.1.isClosed.closure_eq ▸ hx_bd.1 + have hΔ'U_sub : Δ' ∩ H'.U ⊆ F' := + dial_inter_sub_of_pushed hS hRig' hΛ_open hC hC_sub' hbd hv₁C hv₂C hv12 hr_R' hr_sub + hF'_r hF'_V hDial' + have hΔ'U_eq : Δ' ∩ H'.U = {v₁, v₂} := by + apply subset_antisymm + · intro x hx + exact hF'_U ▸ ⟨hΔ'U_sub hx, hx.2⟩ + · rintro x (rfl | rfl) + · exact ⟨hF'_sub_Δ' hv₁F', H'.V_subset_U (hC_sub'.1 hv₁C)⟩ + · exact ⟨hF'_sub_Δ' hv₂F', H'.V_subset_U (hC_sub'.1 hv₂C)⟩ + -- Next show `Δ' \ subBd Δ' ⊆ r` and `Δ' ∩ h '' (closure Λ) = h '' L`. + let U_open : Set S := Δ' \ subBd Δ' + have hU_open_disc : IsOpenDisc U_open := (IsClosedDisc.isOpenDisc_diff_subBd hS hDial'.1).1 + have hU_open_cl : closure U_open = Δ' := ((IsClosedDisc.isOpenDisc_diff_subBd hS hDial'.1).2).1 + have hU_dis_U' : Disjoint U_open H'.U := by + refine disjoint_left.mpr fun x hxU_open hxU' => hxU_open.2 ?_ + rw [hDial'.2.1] + exact hΔ'U_sub ⟨hxU_open.1, hxU'⟩ + obtain ⟨f₂, hf₂0, hf₂1⟩ := hF₂_line + let mid : I := ⟨1 / 2, by norm_num, by norm_num⟩ + let p₂ : S := (f₂ mid).1 + have hp₂_F₂ : p₂ ∈ F₂ \ {v₁, v₂} := by + refine ⟨(f₂ mid).2, ?_⟩ + rintro (h1 | h2) + · have : mid = 0 := f₂.injective (Subtype.ext (h1.trans hf₂0.symm)) + exact absurd (congrArg Subtype.val this) (by norm_num [mid]) + · have : mid = 1 := f₂.injective (Subtype.ext (h2.trans hf₂1.symm)) + exact absurd (congrArg Subtype.val this) (by norm_num [mid]) + have hp₂_r : p₂ ∈ r := hF₂_r hp₂_F₂ + have hp₂_cl : p₂ ∈ closure U_open := by + rw [hU_open_cl] + exact hF'_sub_Δ' (Or.inl hp₂_F₂.1) + obtain ⟨z₀, hz₀_r, hz₀_U⟩ := mem_closure_iff.mp hp₂_cl r (region_isOpen hr_R') hp₂_r + have hU_sub_r : U_open ⊆ r := + subset_region hr_R' hU_open_disc.isPathConnected.isConnected.isPreconnected hU_dis_U' + hz₀_U hz₀_r + let D_pushed : Set S := h '' (closure Λ) + have hD_pushed_cl : IsClosed D_pushed := h.isClosedMap _ isClosed_closure + have hfr_D_pushed : frontier D_pushed = h '' L ∪ P'.U := + frontier_of_pushed_cycle hC_sub' hPs hP's hV_inter hE_disj hsup hsubBd_cl hv₁F₂ hv₂F₂ h hhY + have hU_dis_fr : Disjoint U_open (frontier D_pushed) := by + rw [hfr_D_pushed, disjoint_union_right] + refine ⟨disjoint_left.mpr fun x hxU hxL' => hxU.2 (hDial'.2.1 ▸ Or.inr hxL'), ?_⟩ + exact disjoint_left.mpr fun x hxU hxP' => + region_subset hr_R' (hU_sub_r hxU) (hC_sub'.U_subset (hP's.U_subset hxP')) + have hU_dis_Dp : Disjoint U_open D_pushed := by + rcases subset_or_disjoint_of_frontier hD_pushed_cl + hU_open_disc.isPathConnected.isConnected.isPreconnected hU_dis_fr with hsub | hdis + · exfalso + have hΔ'_Dp : Δ' ⊆ D_pushed := hU_open_cl ▸ hD_pushed_cl.closure_subset_iff.mpr hsub + have hp₂_Dp : p₂ ∈ D_pushed := hΔ'_Dp (hF'_sub_Δ' (Or.inl hp₂_F₂.1)) + obtain ⟨w, hw_cl, hwp₂⟩ := hp₂_Dp + have hw_eq : w = p₂ := h.injective (hwp₂.trans (hhY p₂ (Or.inr hp₂_F₂.1)).symm) + exact disjoint_left.mp hdis_r_clΛ hp₂_r (hw_eq ▸ hw_cl) + · exact hdis + have hΔ'_inter_Dp : Δ' ∩ D_pushed = h '' L := by + apply subset_antisymm + · rintro x ⟨hxΔ', hxDp⟩ + by_cases hx_bd : x ∈ subBd Δ' + · rw [hDial'.2.1] at hx_bd + rcases hx_bd with hxF₂ | hxL' + · obtain ⟨w, hw_cl, hwx⟩ := hxDp + have hhw : h x = x := hhY x (Or.inr hxF₂) + have hw_eq : w = x := h.injective (hwx.trans hhw.symm) + rw [← hw_eq] at hxF₂ ⊢ + by_cases hw12 : w ∈ ({v₁, v₂} : Set S) + · rcases mem_insert_iff.mp hw12 with hw1 | hw2 + · rw [hw1] + exact ⟨v₁, hv₁L, hh_v₁⟩ + · rw [mem_singleton_iff.mp hw2] + exact ⟨v₂, hv₂L, hh_v₂⟩ + · exact absurd hw_cl (disjoint_left.mp hdis_r_clΛ (hF₂_r ⟨hxF₂, hw12⟩)) + · exact hxL' + · exact absurd hxDp (disjoint_left.mp hU_dis_Dp ⟨hxΔ', hx_bd⟩) + · rintro x ⟨w, hwL, rfl⟩ + exact ⟨hF'_sub_Δ' (Or.inr ⟨w, hwL, rfl⟩), ⟨w, hL_cl hwL, rfl⟩⟩ + let Δ₂ : Set S := h.symm '' Δ' + have hΔ₂_disc : IsClosedDisc Δ₂ := + (hDial'.1.image h.symm.continuous.continuousOn h.continuous.continuousOn + (fun x _ => h.apply_symm_apply x)).1 + have hΔ₂_bd : subBd Δ₂ = F₂ ∪ L := by + rw [subBd_eq_frontier, ← h.symm.image_frontier, ← subBd_eq_frontier, hDial'.2.1, + hF'_img, ← image_comp, h.symm_comp_self, image_id] + have hΔ₂_clΛ : Δ₂ ∩ closure Λ = L := by + have h1 : closure Λ = h.symm '' D_pushed := by + change closure Λ = h.symm '' (h '' (closure Λ)) + rw [← image_comp, h.symm_comp_self, image_id] + have h2 : L = h.symm '' (h '' L) := by + rw [← image_comp, h.symm_comp_self, image_id] + rw [h1, h2, ← image_inter h.symm.injective, hΔ'_inter_Dp] + have hΔ₂_U' : Δ₂ ∩ H'.U = L := by + apply subset_antisymm + · rintro x ⟨⟨y, hyΔ', rfl⟩, hxU'⟩ + by_contra hxL + have hxY : h.symm y ∈ Y := by + by_cases hxV' : h.symm y ∈ H'.V + · exact Or.inl (Or.inl (Or.inl ⟨hxV', hxL⟩)) + · obtain ⟨e, heH', hxe⟩ := H'.exists_edge_of_mem hxU' hxV' + have he_not_P : e ∉ P.E := fun heP => + hxL (P.closure_subset_U heP (subset_closure hxe)) + exact Or.inl (Or.inl (Or.inr (mem_iUnion₂.mpr ⟨e, ⟨heH', he_not_P⟩, subset_closure hxe⟩))) + have hy_eq : h (h.symm y) = h.symm y := hhY (h.symm y) hxY + rw [h.apply_symm_apply] at hy_eq + rw [← hy_eq] at hxU' hxL + have hy12 : y ∈ ({v₁, v₂} : Set S) := hΔ'U_eq ▸ ⟨hyΔ', hxU'⟩ + rcases mem_insert_iff.mp hy12 with hy1 | hy2 + · exact hxL (hy1 ▸ hv₁L) + · exact hxL (mem_singleton_iff.mp hy2 ▸ hv₂L) + · intro x hxL + exact ⟨⟨h x, hF'_sub_Δ' (Or.inr ⟨x, hxL, rfl⟩), h.symm_apply_apply x⟩, hP_H'.U_subset hxL⟩ + exact ⟨Δ₂, hΔ₂_disc, hΔ₂_bd, hΔ₂_clΛ, hΔ₂_U'⟩ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section6c.lean b/LeanPool/GraphMinor/GM14/Section6c.lean new file mode 100644 index 0000000000..ccd8a796fd --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section6c.lean @@ -0,0 +1,483 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section6b +import LeanPool.GraphMinor.GM14.Section7a +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.DiscUnion +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Graph Minors XIV, Section 6 (Part 3): Rigidity after Clearing a Zone (`(6.3)`) + +This file proves `(6.3)` (`theorem_6_3`, pages 33–34) of N. Robertson and P. D. Seymour, +*Graph Minors. XIV. Extending an embedding*, J. Combin. Theory Ser. B **65** (1995) 23–50: +if `H` is a rigid drawing in a closed surface `Σ`, `Λ ⊆ Σ` is an open disc bounded by the point set +of a circuit `C` of `H`, and `closure r ∩ closure Λ` is preconnected for every region `r` of `H` +disjoint from `Λ`, then `H ∩ (Σ - Λ)` is a rigid drawing in `Σ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Graph Hypergraph unitInterval +open GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] + +local notation "𝕀" => unitInterval + +/-! ## 1. Splitting an `O`-Arc Across `bd(Λ)` -/ + +/-- Every line is contained in the closure of its interior. -/ +theorem IsLineWithEnds.subset_closure_sdiff_pair {L : Set S} {a b : S} + (h : IsLineWithEnds L a b) : L ⊆ closure (L \ {a, b}) := by + obtain ⟨f, hf0, hf1⟩ := h + intro x hxL + rw [mem_closure_iff] + intro U hU hxU + let t : 𝕀 := f.symm ⟨x, hxL⟩ + have ht : (f t).1 = x := congrArg Subtype.val (f.apply_symm_apply ⟨x, hxL⟩) + have hcont : Continuous (fun s : 𝕀 => (f s).1) := continuous_subtype_val.comp f.continuous + have hOpen_pre : IsOpen ((fun s : 𝕀 => (f s).1) ⁻¹' U) := hU.preimage hcont + have ht_pre : t ∈ (fun s : 𝕀 => (f s).1) ⁻¹' U := by simp [ht, hxU] + obtain ⟨V, hV_open, hV_eq⟩ := isOpen_induced_iff.mp hOpen_pre + have htV : t.1 ∈ V := by + have : t ∈ Subtype.val ⁻¹' V := hV_eq ▸ ht_pre + exact this + have ht_cl : t.1 ∈ closure (Ioo (0 : ℝ) 1) := by + rw [closure_Ioo (zero_ne_one' ℝ)] + exact t.2 + obtain ⟨r, hrV, hr_Ioo⟩ := mem_closure_iff.mp ht_cl V hV_open htV + let s : 𝕀 := ⟨r, hr_Ioo.1.le, hr_Ioo.2.le⟩ + have hs_pre : s ∈ (fun s : 𝕀 => (f s).1) ⁻¹' U := hV_eq ▸ hrV + refine ⟨(f s).1, hs_pre, (f s).2, ?_⟩ + rintro (h1 | h2) + · have : s = 0 := f.injective (Subtype.ext (h1.trans hf0.symm)) + exact hr_Ioo.1.ne (congrArg Subtype.val this).symm + · have : s = 1 := f.injective (Subtype.ext (h2.trans hf1.symm)) + exact hr_Ioo.2.ne (congrArg Subtype.val this) + +/-- The interior of a line is nonempty. -/ +theorem IsLineWithEnds.nonempty_sdiff_pair {L : Set S} {a b : S} + (h : IsLineWithEnds L a b) : (L \ {a, b}).Nonempty := + Surface.IsLineWithEnds.nonempty_sdiff h + +/-- An `O`-arc `F` that meets both `Λ` and `Σ \ closure Λ` meets `subBd Λ` in at least two points. +-/ +private theorem two_le_ncard_inter_subBd (hS : IsClosedSurface S) {F Λ : Set S} + (hF : IsOArc F) (hΛ_open : IsOpenDisc Λ) (hΛ_cl : IsClosedDisc (closure Λ)) + (hO_bd : IsOArc (subBd Λ)) (hF_in : (F ∩ Λ).Nonempty) (hF_out : (F \ closure Λ).Nonempty) + (hfin : (F ∩ subBd Λ).Finite) : 2 ≤ (F ∩ subBd Λ).ncard := by + by_contra hlt + have hle1 : (F ∩ subBd Λ).ncard ≤ 1 := Nat.lt_succ_iff.mp (not_le.mp hlt) + obtain ⟨x₁, hx₁F, hx₁Λ⟩ := hF_in + obtain ⟨x₂, hx₂F, hx₂_out⟩ := hF_out + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open.1 + have hfr_cl : frontier (closure Λ) = subBd Λ := by + rw [← subBd_eq_frontier, subBd_closure_eq_subBd_of_isOpenDisc hS hΛ_open hO_bd hΛ_cl] + by_cases hne : (F ∩ subBd Λ).Nonempty + · obtain ⟨z, hz⟩ := hne + have hsub_z : F ∩ subBd Λ ⊆ {z} := fun w hw => + mem_singleton_iff.mpr ((Set.ncard_le_one_iff hfin).mp hle1 hw hz) + have hz_bd : z ∈ subBd Λ := hz.2 + have hpre : IsPreconnected (F \ {z}) := + (isPathConnected_oArc_diff hF hz.1).isConnected.isPreconnected + have hdis_fr : Disjoint (F \ {z}) (frontier (closure Λ)) := by + rw [hfr_cl] + exact disjoint_left.mpr fun w hw hw_bd => hw.2 (hsub_z ⟨hw.1, hw_bd⟩) + have hx₁_ne : x₁ ≠ z := fun h => disjoint_left.mp hdisL hx₁Λ (h ▸ hz_bd) + have hx₂_ne : x₂ ≠ z := fun h => hx₂_out (h ▸ hz_bd.1) + rcases subset_or_disjoint_of_frontier isClosed_closure hpre hdis_fr with hsub | hdis + · exact hx₂_out (hsub ⟨hx₂F, hx₂_ne⟩) + · exact disjoint_left.mp hdis ⟨hx₁F, hx₁_ne⟩ (subset_closure hx₁Λ) + · have h_empty : F ∩ subBd Λ = ∅ := not_nonempty_iff_eq_empty.mp hne + have hdis_fr : Disjoint F (frontier (closure Λ)) := by + rw [hfr_cl, disjoint_iff_inter_eq_empty] + exact h_empty + obtain ⟨φ⟩ := hF + have hF_pre : IsPreconnected F := by + have hEq : F = (fun w : Circle => (φ w).1) '' univ := by + ext x + exact ⟨fun hx => ⟨φ.symm ⟨x, hx⟩, trivial, by simp⟩, fun ⟨w, _, hw⟩ => hw ▸ (φ w).2⟩ + rw [hEq] + exact isPreconnected_univ.image _ (continuous_subtype_val.comp φ.continuous).continuousOn + rcases subset_or_disjoint_of_frontier isClosed_closure hF_pre hdis_fr with hsub | hdis + · exact hx₂_out (hsub hx₂F) + · exact disjoint_left.mp hdis hx₁F (subset_closure hx₁Λ) + +/-- If an `O`-arc `F` with `F ∩ H'.U ⊆ H'.V` and `(F ∩ H'.V).ncard ≤ 2` meets both `Λ` and +`Σ \ closure Λ`, then `F ∩ H'.V = {v₁, v₂}` for two distinct vertices `v₁, v₂ ∈ C.V`, and `F` splits +into two lines `F₁, F₂` between `v₁` and `v₂` with `F₁ ⊆ closure Λ` and `F₂ \ {v₁, v₂} ⊆ r` for a +region `r ∈ H'.R` disjoint from `Λ`. -/ +private theorem split_oArc_across_openDisc [T2Space S] (hS : IsClosedSurface S) + {H H' C : Drawing S} {Λ F : Set S} + (hΛ_open : IsOpenDisc Λ) (hΛ_cl : IsClosedDisc (closure Λ)) + (hC : C.IsCircuit) (hC_sub' : C.IsSubdrawing H') (hbd : subBd Λ = C.U) + (hR'_other : ∀ r ∈ H'.R, r ≠ Λ → r ∈ H.R ∧ Disjoint r Λ) + (hF : IsOArc F) (hFU : F ∩ H'.U ⊆ H'.V) (hFV : (F ∩ H'.V).ncard ≤ 2) + (hF_in : (F ∩ Λ).Nonempty) (hF_out : (F \ closure Λ).Nonempty) : + ∃ (v₁ v₂ : S) (F₁ F₂ r : Set S), + v₁ ≠ v₂ ∧ v₁ ∈ C.V ∧ v₂ ∈ C.V ∧ + F ∩ H'.V = {v₁, v₂} ∧ F ∩ H'.U = {v₁, v₂} ∧ F ∩ subBd Λ = {v₁, v₂} ∧ + IsLineWithEnds F₁ v₁ v₂ ∧ IsLineWithEnds F₂ v₁ v₂ ∧ + F = F₁ ∪ F₂ ∧ F₁ ∩ F₂ = {v₁, v₂} ∧ + F₁ ⊆ closure Λ ∧ F₁ \ {v₁, v₂} ⊆ Λ ∧ + r ∈ H'.R ∧ r ∈ H.R ∧ Disjoint r Λ ∧ r ⊆ univ \ Λ ∧ + F₂ \ {v₁, v₂} ⊆ r ∧ v₁ ∈ closure r ∧ v₂ ∈ closure r := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hO_bd : IsOArc (subBd Λ) := hbd ▸ isOArc_of_isCircuit hC + have hbd_sub_U' : subBd Λ ⊆ H'.U := hbd ▸ hC_sub'.U_subset + have hsub1 : F ∩ subBd Λ ⊆ F ∩ H'.U := inter_subset_inter_right F hbd_sub_U' + have hsub2 : F ∩ H'.U ⊆ F ∩ H'.V := fun x hx => ⟨hx.1, hFU hx⟩ + have hfin_FV : (F ∩ H'.V).Finite := H'.finite_V.subset inter_subset_right + have hfin_FU : (F ∩ H'.U).Finite := hfin_FV.subset hsub2 + have hfin_Fbd : (F ∩ subBd Λ).Finite := hfin_FU.subset hsub1 + have h2_le : 2 ≤ (F ∩ subBd Λ).ncard := + two_le_ncard_inter_subBd hS hF hΛ_open hΛ_cl hO_bd hF_in hF_out hfin_Fbd + have h_eq_bd_V : F ∩ subBd Λ = F ∩ H'.V := + eq_of_subset_of_ncard_le (hsub1.trans hsub2) (hFV.trans h2_le) hfin_FV + have h_eq_U_V : F ∩ H'.U = F ∩ H'.V := + eq_of_subset_of_ncard_le hsub2 + (hFV.trans (h2_le.trans (ncard_le_ncard hsub1 hfin_FU))) hfin_FV + have h_card2 : (F ∩ H'.V).ncard = 2 := + le_antisymm hFV (h_eq_bd_V ▸ h2_le) + obtain ⟨v₁, v₂, hv12, hFV_eq⟩ := ncard_eq_two.mp h_card2 + have hFU_eq : F ∩ H'.U = {v₁, v₂} := h_eq_U_V.trans hFV_eq + have hFbd_eq : F ∩ subBd Λ = {v₁, v₂} := h_eq_bd_V.trans hFV_eq + have hv₁_mem : v₁ ∈ F ∩ subBd Λ := by rw [hFbd_eq]; exact mem_insert v₁ {v₂} + have hv₂_mem : v₂ ∈ F ∩ subBd Λ := by rw [hFbd_eq]; exact mem_insert_of_mem v₁ rfl + have hv₁_V' : v₁ ∈ H'.V := by + have : v₁ ∈ F ∩ H'.V := by rw [hFV_eq]; exact mem_insert v₁ {v₂} + exact this.2 + have hv₂_V' : v₂ ∈ H'.V := by + have : v₂ ∈ F ∩ H'.V := by rw [hFV_eq]; exact mem_insert_of_mem v₁ rfl + exact this.2 + have hv_CV : ∀ v, v ∈ subBd Λ → v ∈ H'.V → v ∈ C.V := by + intro v hv_bd hv_V + by_contra hv_not_CV + obtain ⟨e, heC, hve⟩ := C.exists_edge_of_mem (hbd ▸ hv_bd) hv_not_CV + exact ((hC_sub'.2 heC).2.1 hve).2 hv_V + have hv₁C : v₁ ∈ C.V := hv_CV v₁ hv₁_mem.2 hv₁_V' + have hv₂C : v₂ ∈ C.V := hv_CV v₂ hv₂_mem.2 hv₂_V' + obtain ⟨a, b, hab, ha0, ha1, hun⟩ := IsOArc.exists_arcs hF hv₁_mem.1 hv₂_mem.1 hv12 + have hb0 : b 0 = v₁ := hab.zero.trans ha0 + have hb1 : b 1 = v₂ := hab.one.trans ha1 + have ha_line : IsLineWithEnds (range a) v₁ v₂ := ha0 ▸ ha1 ▸ hab.arc_left.isLineWithEnds + have hb_line : IsLineWithEnds (range b) v₁ v₂ := hb0 ▸ hb1 ▸ hab.arc_right.isLineWithEnds + have hab_inter : range a ∩ range b = {v₁, v₂} := by + apply subset_antisymm + · rintro x ⟨⟨s, rfl⟩, ⟨t, hst⟩⟩ + rcases hab.meet s t hst.symm with ⟨rfl, _⟩ | ⟨rfl, _⟩ + · exact Or.inl ha0 + · exact Or.inr ha1 + · rintro x (rfl | rfl) + · exact ⟨⟨0, ha0⟩, ⟨0, hb0⟩⟩ + · exact ⟨⟨1, ha1⟩, ⟨1, hb1⟩⟩ + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open.1 + have hfr_cl : frontier (closure Λ) = subBd Λ := by + rw [← subBd_eq_frontier, subBd_closure_eq_subBd_of_isOpenDisc hS hΛ_open hO_bd hΛ_cl] + have h_arc_side : ∀ L' : Set S, IsLineWithEnds L' v₁ v₂ → L' ⊆ F → + (L' \ {v₁, v₂} ⊆ Λ ∧ L' ⊆ closure Λ) ∨ Disjoint (L' \ {v₁, v₂}) (closure Λ) := by + intro L' hL' hL'F + have hdis_fr : Disjoint (L' \ {v₁, v₂}) (frontier (closure Λ)) := by + rw [hfr_cl] + refine disjoint_left.mpr fun x hx hx_bd => hx.2 ?_ + exact hFbd_eq ▸ ⟨hL'F hx.1, hx_bd⟩ + rcases subset_or_disjoint_of_frontier isClosed_closure + (IsLineWithEnds.isPreconnected_sdiff_pair hL') hdis_fr with hsub | hdis + · left + have hsub_Λ : L' \ {v₁, v₂} ⊆ Λ := by + intro x hx + have hx_cl : x ∈ Λ ∪ subBd Λ := hclL ▸ hsub hx + exact hx_cl.resolve_right fun hx_bd => hx.2 (hFbd_eq ▸ ⟨hL'F hx.1, hx_bd⟩) + refine ⟨hsub_Λ, fun x hx => ?_⟩ + by_cases hx12 : x ∈ ({v₁, v₂} : Set S) + · rcases hx12 with rfl | rfl + · exact hv₁_mem.2.1 + · exact hv₂_mem.2.1 + · exact subset_closure (hsub_Λ ⟨hx, hx12⟩) + · exact Or.inr hdis + obtain ⟨x₁, hx₁F, hx₁Λ⟩ := hF_in + obtain ⟨x₂, hx₂F, hx₂_out⟩ := hF_out + have hx₁_not12 : x₁ ∉ ({v₁, v₂} : Set S) := by + rintro (rfl | rfl) + · exact disjoint_left.mp hdisL hx₁Λ hv₁_mem.2 + · exact disjoint_left.mp hdisL hx₁Λ hv₂_mem.2 + have hx₂_not12 : x₂ ∉ ({v₁, v₂} : Set S) := by + rintro (rfl | rfl) + · exact hx₂_out hv₁_mem.2.1 + · exact hx₂_out hv₂_mem.2.1 + have hF₁₂_exists : ∃ F₁ F₂ : Set S, + IsLineWithEnds F₁ v₁ v₂ ∧ IsLineWithEnds F₂ v₁ v₂ ∧ + F = F₁ ∪ F₂ ∧ F₁ ∩ F₂ = {v₁, v₂} ∧ + F₁ ⊆ closure Λ ∧ F₁ \ {v₁, v₂} ⊆ Λ ∧ Disjoint (F₂ \ {v₁, v₂}) (closure Λ) := by + have ha_F : range a ⊆ F := hun ▸ subset_union_left + have hb_F : range b ⊆ F := hun ▸ subset_union_right + rcases h_arc_side (range a) ha_line ha_F with ⟨ha_in, ha_cl⟩ | ha_out + · rcases h_arc_side (range b) hb_line hb_F with ⟨_, hb_cl⟩ | hb_out + · exfalso + have : F ⊆ closure Λ := hun ▸ union_subset ha_cl hb_cl + exact hx₂_out (this hx₂F) + · exact ⟨range a, range b, ha_line, hb_line, hun.symm, hab_inter, ha_cl, ha_in, hb_out⟩ + · rcases h_arc_side (range b) hb_line hb_F with ⟨hb_in, hb_cl⟩ | hb_out + · exact ⟨range b, range a, hb_line, ha_line, by rw [Set.union_comm, hun], + by rw [Set.inter_comm, hab_inter], hb_cl, hb_in, ha_out⟩ + · exfalso + rcases hun ▸ hx₁F with hx₁a | hx₁b + · exact disjoint_left.mp ha_out ⟨hx₁a, hx₁_not12⟩ (subset_closure hx₁Λ) + · exact disjoint_left.mp hb_out ⟨hx₁b, hx₁_not12⟩ (subset_closure hx₁Λ) + obtain ⟨F₁, F₂, hF₁_line, hF₂_line, hF_union, hF12_inter, hF₁_cl, hF₁_Λ, hF₂_dis⟩ := + hF₁₂_exists + have hF₂_sub_F : F₂ ⊆ F := hF_union ▸ subset_union_right + have hF₂_dis_U' : Disjoint (F₂ \ {v₁, v₂}) H'.U := by + refine disjoint_left.mpr fun x hx hxU' => hx.2 ?_ + exact hFU_eq ▸ ⟨hF₂_sub_F hx.1, hxU'⟩ + obtain ⟨p₂, hp₂⟩ := IsLineWithEnds.nonempty_sdiff_pair hF₂_line + have hp₂_not_U' : p₂ ∉ H'.U := disjoint_left.mp hF₂_dis_U' hp₂ + obtain ⟨r, hr_R', hp₂_r⟩ := exists_region_of_notMem hp₂_not_U' + have hF₂_r : F₂ \ {v₁, v₂} ⊆ r := + subset_region hr_R' (IsLineWithEnds.isPreconnected_sdiff_pair hF₂_line) hF₂_dis_U' hp₂ hp₂_r + have hr_ne_Λ : r ≠ Λ := by + intro hrΛ + exact disjoint_left.mp hF₂_dis hp₂ (subset_closure (hrΛ ▸ hp₂_r)) + obtain ⟨hr_H, hdis_rΛ⟩ := hR'_other r hr_R' hr_ne_Λ + have hr_sub : r ⊆ univ \ Λ := fun x hxr => ⟨mem_univ x, disjoint_left.mp hdis_rΛ hxr⟩ + obtain ⟨hv₁F₂, hv₂F₂⟩ := IsLineWithEnds.ends_mem hF₂_line + have hv₁_cl_r : v₁ ∈ closure r := + closure_mono hF₂_r (IsLineWithEnds.subset_closure_sdiff_pair hF₂_line hv₁F₂) + have hv₂_cl_r : v₂ ∈ closure r := + closure_mono hF₂_r (IsLineWithEnds.subset_closure_sdiff_pair hF₂_line hv₂F₂) + exact ⟨v₁, v₂, F₁, F₂, r, hv12, hv₁C, hv₂C, hFV_eq, hFU_eq, hFbd_eq, + hF₁_line, hF₂_line, hF_union, hF12_inter, hF₁_cl, hF₁_Λ, + hr_R', hr_H, hdis_rΛ, hr_sub, hF₂_r, hv₁_cl_r, hv₂_cl_r⟩ + +/-! ## 2. Proof of (6.3) -/ + +/-- Criterion for `IsRigid (clearedSubdrawing H Λ)` in terms of circuit arcs between any two +vertices `v₁ ≠ v₂ ∈ C.V` joined by an interior arc `F₂ \ {v₁, v₂} ⊆ r` of a region `r ∈ H.R` +disjoint from `Λ`. -/ +theorem isRigid_clearedSubdrawing_of_arc_subset [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {H C : Drawing S} {Λ : Set S} + (hRig : IsRigid H) (hΛ_open : IsOpenDisc Λ) (hΛ_cl : IsClosedDisc (closure Λ)) + (hC : C.IsCircuit) (hCs : C.IsSubdrawing H) (hbd : subBd Λ = C.U) + (harc : ∀ (r : Set S) (v₁ v₂ : S) (F₂ : Set S) (P₁ P₂ : Drawing S), + r ∈ H.R → Disjoint r Λ → v₁ ≠ v₂ → v₁ ∈ C.V → v₂ ∈ C.V → + IsLineWithEnds F₂ v₁ v₂ → F₂ \ {v₁, v₂} ⊆ r → + P₁.IsPathBetween v₁ v₂ → P₂.IsPathBetween v₁ v₂ → + P₁.IsSubdrawing C → P₂.IsSubdrawing C → + P₁.V ∩ P₂.V = {v₁, v₂} → Disjoint P₁.E P₂.E → C.sup P₁ P₂ = C → + P₁.U ⊆ closure r ∨ P₂.U ⊆ closure r) : + IsRigid (clearedSubdrawing H Λ) := by + have : CompactSpace S := hS.1 + let H' : Drawing S := clearedSubdrawing H Λ + obtain ⟨_, hE'_eq, hU'_eq, hC_sub', hΛ_R, hR_or, _⟩ := + clearedSubdrawing_props_of_circuit hΛ_open hC hCs hbd + have hE'_sub : ∀ e ∈ H'.E, e ⊆ univ \ Λ := fun e he => (hE'_eq ▸ he).2 + have hR'_other : ∀ r ∈ H'.R, r ≠ Λ → r ∈ H.R ∧ Disjoint r Λ := + fun r hr hne => (hR_or r hr).resolve_left hne + have hRig' : IsRigidIn H' (univ \ Λ) := + isRigidIn_clearedSubdrawing hS hRig hΛ_open hΛ_cl hC hCs hbd + have hO_bd : IsOArc (subBd Λ) := hbd ▸ isOArc_of_isCircuit hC + have hsubBd_cl : subBd (closure Λ) = C.U := + (subBd_closure_eq_subBd_of_isOpenDisc hS hΛ_open hO_bd hΛ_cl).trans hbd + have hdiscBd_cl : discBd (closure Λ) = C.U := + (IsClosedDisc.subBd_eq_discBd hS hΛ_cl).symm.trans hsubBd_cl + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open.1 + have hU'_sub : H'.U ⊆ univ \ Λ := by + rw [hU'_eq] + exact fun x hx => ⟨mem_univ x, hx.2⟩ + intro F hF hFU hFV + by_cases hF_sub_out : F ⊆ univ \ Λ + · obtain ⟨Δ, _, hDial⟩ := hRig' F hF_sub_out hF hFU hFV + exact ⟨Δ, hDial⟩ + · by_cases hF_sub_cl : F ⊆ closure Λ + · obtain ⟨Δ, ⟨hΔ_sub, hΔ_disc, hΔ_bd, -, hΔ_dis, -⟩, -⟩ := + disc_oArc (closure Λ) F hΛ_cl hF_sub_cl hF + have hΔ_subBd : subBd Δ = F := + (IsClosedDisc.subBd_eq_discBd hS hΔ_disc).trans hΔ_bd + refine ⟨Δ, hΔ_disc, hΔ_subBd, Or.inl ?_⟩ + rintro x ⟨hxΔ, hxU'⟩ + by_contra hxF + have hx_cl : x ∈ Λ ∪ subBd Λ := hclL ▸ hΔ_sub hxΔ + have hx_bd : x ∈ subBd Λ := hx_cl.resolve_left (hU'_sub hxU').2 + exact disjoint_left.mp hΔ_dis ⟨hxΔ, hxF⟩ (hdiscBd_cl.symm ▸ (hbd ▸ hx_bd)) + · have hF_in : (F ∩ Λ).Nonempty := by + rw [Set.not_subset] at hF_sub_out + obtain ⟨x, hxF, hx_not⟩ := hF_sub_out + exact ⟨x, hxF, by_contra fun hxΛ => hx_not ⟨mem_univ x, hxΛ⟩⟩ + have hF_out : (F \ closure Λ).Nonempty := by + rw [Set.not_subset] at hF_sub_cl + obtain ⟨x, hxF, hx_not⟩ := hF_sub_cl + exact ⟨x, hxF, hx_not⟩ + obtain ⟨v₁, v₂, F₁, F₂, r, hv12, hv₁C, hv₂C, hFV_eq, hFU_eq, hFbd_eq, + hF₁_line, hF₂_line, hF_union, hF12_inter, hF₁_cl, hF₁_Λ, + hr_R', hr_H, hdis_rΛ, hr_sub, hF₂_r, _, _⟩ := + split_oArc_across_openDisc hS hΛ_open hΛ_cl hC hC_sub' hbd hR'_other + hF hFU hFV hF_in hF_out + have hCU_cl : C.U ⊆ closure Λ := hbd ▸ fun _ hx => hx.1 + obtain ⟨P₁, P₂, hP₁, hP₂, hP₁s, hP₂s, _, _, hV_inter12, hE_disj12, hsup12⟩ := + hC.exists_two_paths hv₁C hv₂C hv12 + have hPP'_exists : ∃ P P' : Drawing S, + P.IsPathBetween v₁ v₂ ∧ P.IsSubdrawing C ∧ P'.IsSubdrawing C ∧ + P.V ∩ P'.V = {v₁, v₂} ∧ Disjoint P.E P'.E ∧ C.sup P P' = C ∧ + P.U ⊆ closure r := by + rcases harc r v₁ v₂ F₂ P₁ P₂ hr_H hdis_rΛ hv12 hv₁C hv₂C hF₂_line hF₂_r + hP₁ hP₂ hP₁s hP₂s hV_inter12 hE_disj12 hsup12 with hsub1 | hsub2 + · exact ⟨P₁, P₂, hP₁, hP₁s, hP₂s, hV_inter12, hE_disj12, hsup12, hsub1⟩ + · have hsup21 : C.sup P₂ P₁ = C := by + apply Drawing.ext_VE + · rw [C.sup_V hP₂s hP₁s, Set.union_comm, ← C.sup_V hP₁s hP₂s, hsup12] + · rw [C.sup_E hP₂s hP₁s, Set.union_comm, ← C.sup_E hP₁s hP₂s, hsup12] + exact ⟨P₂, P₁, hP₂, hP₂s, hP₁s, by rw [Set.inter_comm, hV_inter12], + hE_disj12.symm, hsup21, hsub2⟩ + obtain ⟨P, P', hP, hPs, hP's, hV_inter, hE_disj, hsup, hPU_r⟩ := hPP'_exists + let L : Set S := P.U + obtain ⟨f_L, hfL0, hfL1⟩ := isLine_of_isPathBetween hP hv12 + have hL_line : IsLineWithEnds L v₁ v₂ := ⟨f_L, hfL0, hfL1⟩ + obtain ⟨hv₁L, hv₂L⟩ := IsLineWithEnds.ends_mem hL_line + obtain ⟨hv₁F₁, hv₂F₁⟩ := IsLineWithEnds.ends_mem hF₁_line + obtain ⟨hv₁F₂, hv₂F₂⟩ := IsLineWithEnds.ends_mem hF₂_line + have hL_CU : L ⊆ C.U := hPs.U_subset + have hL_cl : L ⊆ closure Λ := hL_CU.trans hCU_cl + have hF₁L_inter : F₁ ∩ L ⊆ {v₁, v₂} := by + rintro x ⟨hxF₁, hxL⟩ + by_contra hx12 + exact disjoint_left.mp hdisL (hF₁_Λ ⟨hxF₁, hx12⟩) (hbd.symm ▸ hL_CU hxL) + have hF₁L_oArc : IsOArc (F₁ ∪ L) := isOArc_union hF₁_line hL_line hF₁L_inter + have hF₁L_cl : F₁ ∪ L ⊆ closure Λ := union_subset hF₁_cl hL_cl + obtain ⟨Δ₁, ⟨hΔ₁_sub, hΔ₁_disc, hΔ₁_bd_disc, -, hΔ₁_dis, -⟩, -⟩ := + disc_oArc (closure Λ) (F₁ ∪ L) hΛ_cl hF₁L_cl hF₁L_oArc + have hΔ₁_bd : subBd Δ₁ = F₁ ∪ L := + (IsClosedDisc.subBd_eq_discBd hS hΔ₁_disc).trans hΔ₁_bd_disc + have hP_H' : P.IsSubdrawing H' := hPs.trans hC_sub' + have hΔ₁_U' : Δ₁ ∩ H'.U = L := by + apply subset_antisymm + · rintro x ⟨hxΔ₁, hxU'⟩ + have hx_cl : x ∈ Λ ∪ subBd Λ := hclL ▸ hΔ₁_sub hxΔ₁ + have hx_bd : x ∈ subBd Λ := hx_cl.resolve_left (hU'_sub hxU').2 + have hx_F₁L : x ∈ F₁ ∪ L := by + by_contra hx_not + exact disjoint_left.mp hΔ₁_dis ⟨hxΔ₁, hx_not⟩ (hdiscBd_cl.symm ▸ (hbd ▸ hx_bd)) + rcases hx_F₁L with hxF₁ | hxL + · by_cases hx12 : x ∈ ({v₁, v₂} : Set S) + · rcases mem_insert_iff.mp hx12 with hx1 | hx2 + · exact hx1 ▸ hv₁L + · exact mem_singleton_iff.mp hx2 ▸ hv₂L + · exact absurd (hbd ▸ hx_bd) (disjoint_left.mp hdisL (hF₁_Λ ⟨hxF₁, hx12⟩) ∘ + (fun h => hbd.symm ▸ h)) + · exact hxL + · intro x hxL + have hx_bd₁ : x ∈ subBd Δ₁ := hΔ₁_bd ▸ Or.inr hxL + exact ⟨hΔ₁_disc.isClosed.closure_eq ▸ hx_bd₁.1, hP_H'.U_subset hxL⟩ + obtain ⟨Δ₂, hΔ₂_disc, hΔ₂_bd, hΔ₂_clΛ, hΔ₂_U'⟩ := + exists_pushed_disc_of_arc hS hRig' hΛ_open hΛ_cl hC hC_sub' hbd hE'_sub hΛ_R + hv₁C hv₂C hv12 hP hPs hP's hV_inter hE_disj hsup hr_R' hr_sub hPU_r hF₂_line hF₂_r + have hΔ12_inter : Δ₁ ∩ Δ₂ = L := by + apply subset_antisymm + · rintro x ⟨hxΔ₁, hxΔ₂⟩ + change x ∈ P.U + rw [← hΔ₂_clΛ] + exact ⟨hxΔ₂, hΔ₁_sub hxΔ₁⟩ + · intro x hxL + have hxΔ₁ : x ∈ Δ₁ := by + have : x ∈ Δ₁ ∩ H'.U := by rw [hΔ₁_U']; exact hxL + exact this.1 + have hxΔ₂ : x ∈ Δ₂ := by + have : x ∈ Δ₂ ∩ H'.U := by rw [hΔ₂_U']; exact hxL + exact this.1 + exact ⟨hxΔ₁, hxΔ₂⟩ + have hL_bd₁ : L ⊆ discBd Δ₁ := hΔ₁_bd_disc ▸ subset_union_right + have hL_bd₂ : L ⊆ discBd Δ₂ := + (IsClosedDisc.subBd_eq_discBd hS hΔ₂_disc).symm ▸ hΔ₂_bd ▸ subset_union_right + obtain ⟨hΔ_disc, hΔ_bd_disc⟩ := + disc_union Δ₁ Δ₂ L v₁ v₂ hΔ₁_disc hΔ₂_disc hL_line hΔ12_inter hL_bd₁ hL_bd₂ + have hΔ_bd : subBd (Δ₁ ∪ Δ₂) = F := by + rw [IsClosedDisc.subBd_eq_discBd hS hΔ_disc, hΔ_bd_disc, + ← IsClosedDisc.subBd_eq_discBd hS hΔ₁_disc, ← IsClosedDisc.subBd_eq_discBd hS hΔ₂_disc, + hΔ₁_bd, hΔ₂_bd, hF_union] + ext x + constructor + · rintro ⟨(hxF₁ | hxL) | (hxF₂ | hxL), hx_not⟩ + · exact Or.inl hxF₁ + · have hx12 : x ∈ ({v₁, v₂} : Set S) := by_contra fun hn => hx_not ⟨hxL, hn⟩ + rcases mem_insert_iff.mp hx12 with hx1 | hx2 + · exact Or.inl (hx1 ▸ hv₁F₁) + · exact Or.inl (mem_singleton_iff.mp hx2 ▸ hv₂F₁) + · exact Or.inr hxF₂ + · have hx12 : x ∈ ({v₁, v₂} : Set S) := by_contra fun hn => hx_not ⟨hxL, hn⟩ + rcases mem_insert_iff.mp hx12 with hx1 | hx2 + · exact Or.inl (hx1 ▸ hv₁F₁) + · exact Or.inl (mem_singleton_iff.mp hx2 ▸ hv₂F₁) + · rintro (hxF₁ | hxF₂) + · refine ⟨Or.inl (Or.inl hxF₁), fun ⟨hxL, hx12⟩ => hx12 (hF₁L_inter ⟨hxF₁, hxL⟩)⟩ + · refine ⟨Or.inr (Or.inl hxF₂), fun ⟨hxL, hx12⟩ => ?_⟩ + exact region_subset hr_R' (hF₂_r ⟨hxF₂, hx12⟩) (hP_H'.U_subset hxL) + have hΔ_U' : (Δ₁ ∪ Δ₂) ∩ H'.U = P.U := by + rw [union_inter_distrib_right, hΔ₁_U', hΔ₂_U', Set.union_self] + obtain ⟨hinter_V, hinter_U⟩ := interSet_V_and_U hΔ_disc.isClosed (hΔ_bd ▸ hFU) + have hΔ_interSet : H'.interSet (Δ₁ ∪ Δ₂) = P := by + apply Drawing.ext_UV + · rw [hinter_U, Set.inter_comm, hΔ_U'] + · rw [hinter_V] + apply subset_antisymm + · rintro x ⟨hxV', hxΔ⟩ + have hxPU : x ∈ P.U := hΔ_U' ▸ ⟨hxΔ, H'.V_subset_U hxV'⟩ + by_contra hxPV + obtain ⟨e, heP, hxe⟩ := P.exists_edge_of_mem hxPU hxPV + exact ((hP_H'.2 heP).2.1 hxe).2 hxV' + · intro x hxPV + exact ⟨hP_H'.1 hxPV, (hΔ_U' ▸ P.V_subset_U hxPV).1⟩ + refine ⟨Δ₁ ∪ Δ₂, hΔ_disc, hΔ_bd, Or.inr ⟨v₁, v₂, hv12, hFV_eq, ?_⟩⟩ + rwa [hΔ_interSet] + +/-- **Graph Minors XIV, (6.3)** (page 33): +"Let $H$ be a rigid drawing in a surface $\Sigma$, and let $\Lambda \subseteq \Sigma$ be an +open disc with $\text{bd}(\Lambda) \subseteq U(H)$ such that $\text{bd}(\Lambda)$ is an +O-arc. Suppose that $\bar{r} \cap \bar{\Lambda}$ is null or connected for every region $r$ +of $H$ with $r \cap \Lambda = \emptyset$. Then $H \cap (\Sigma - \Lambda)$ is a rigid +drawing in $\Sigma$." -/ +theorem theorem_6_3_proof [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {H C : Drawing S} {Λ : Set S} + (hRig : IsRigid H) (hΛ_open : IsOpenDisc Λ) (hΛ_cl : IsClosedDisc (closure Λ)) + (hC : C.IsCircuit) (hCs : C.IsSubdrawing H) (hbd : subBd Λ = C.U) + (hconn : ∀ r ∈ H.R, Disjoint r Λ → IsPreconnected (closure r ∩ closure Λ)) : + IsRigid (clearedSubdrawing H Λ) := by + refine isRigid_clearedSubdrawing_of_arc_subset hS hRig hΛ_open hΛ_cl hC hCs hbd ?_ + intro r v₁ v₂ F₂ P₁ P₂ hr_H hdis_rΛ hv12 hv₁C hv₂C hF₂_line hF₂_r + hP₁ hP₂ hP₁s hP₂s hV_inter12 hE_disj12 hsup12 + obtain ⟨_, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open.1 + have hCU_cl : C.U ⊆ closure Λ := hbd ▸ fun _ hx => hx.1 + have hdis_clr_Λ : Disjoint (closure r) Λ := hdis_rΛ.closure_left hΛ_open.1 + have hK_eq : closure r ∩ closure Λ = closure r ∩ C.U := by + apply subset_antisymm + · rintro x ⟨hxr, hxcl⟩ + have hx_bd : x ∈ subBd Λ := (hclL ▸ hxcl).resolve_left (disjoint_left.mp hdis_clr_Λ hxr) + exact ⟨hxr, hbd ▸ hx_bd⟩ + · exact inter_subset_inter_right (closure r) hCU_cl + have hK_pre : IsPreconnected (closure r ∩ C.U) := hK_eq ▸ hconn r hr_H hdis_rΛ + obtain ⟨hv₁F₂, hv₂F₂⟩ := IsLineWithEnds.ends_mem hF₂_line + have hv₁_cl_r : v₁ ∈ closure r := + closure_mono hF₂_r (IsLineWithEnds.subset_closure_sdiff_pair hF₂_line hv₁F₂) + have hv₂_cl_r : v₂ ∈ closure r := + closure_mono hF₂_r (IsLineWithEnds.subset_closure_sdiff_pair hF₂_line hv₂F₂) + have hU_union12 : P₁.U ∪ P₂.U = C.U := by + rw [← hsup12] + exact (Drawing.sup_U hP₁s hP₂s).symm + rcases path_subset_of_isPreconnected_inter_circuit hP₁ hP₂ hP₁s hP₂s hv12 + hV_inter12 hE_disj12 hU_union12 hK_pre inter_subset_right + ⟨hv₁_cl_r, C.V_subset_U hv₁C⟩ ⟨hv₂_cl_r, C.V_subset_U hv₂C⟩ with hsub1 | hsub2 + · exact Or.inl (hsub1.trans inter_subset_left) + · exact Or.inr (hsub2.trans inter_subset_left) + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section7.lean b/LeanPool/GraphMinor/GM14/Section7.lean new file mode 100644 index 0000000000..4bf83a9887 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section7.lean @@ -0,0 +1,1322 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section7a +public import LeanPool.GraphMinor.GM14.Section7b +import LeanPool.GraphMinor.GM14.Section5 +import LeanPool.GraphMinor.GM11.ArcDrawings +import LeanPool.GraphMinor.Surface.PushOff + +/-! +# Graph Minors XIV, Section 7: Distance and Freedom (Complete) + +This file completes Section 7 (pages 35–39) of N. Robertson and P. D. Seymour, +*Graph Minors. XIV. Extending an embedding*, J. Combin. Theory Ser. B **65** (1995) 23–50, by +proving `(7.7)` (`theorem_7_7`, pages 37–38) and re-exporting `(7.1)`–`(7.6)` from `Section7a.lean` +and `(7.8)` from `Section7b.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Graph Hypergraph +open GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 + +universe u v w + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Pushing a Boundary Arc off a Closed Disc -/ + +local notation "𝕀" => unitInterval + +/-- Given a closed disc `D` in a closed surface `S`, a line `L ⊆ subBd D` with ends `a, b`, and a +closed set `Y ⊆ S` with `a ∈ Y`, `b ∈ Y`, and `Y ∩ L ⊆ {a, b}`, there is a homeomorphism `h : S ≃ₜ +S` +fixing `Y` pointwise such that `h '' L ∩ D ⊆ {a, b}`. -/ +private theorem push_arc (hS : IsClosedSurface S) {D L Y : Set S} {a b : S} + (hD : IsClosedDisc D) (hL : IsLineWithEnds L a b) (hLD : L ⊆ subBd D) + (hY : IsClosed Y) (haY : a ∈ Y) (hbY : b ∈ Y) (hYL : Y ∩ L ⊆ {a, b}) : + ∃ h : S ≃ₜ S, (∀ y ∈ Y, h y = y) ∧ h '' L ∩ D ⊆ {a, b} := by + classical + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hint : ∀ x : S, IsInteriorPoint x := hS.2.2 + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hint x).isManifoldPoint + have hLD' : L ⊆ discBd D := by + rwa [← IsClosedDisc.subBd_eq_discBd hS hD] + obtain ⟨u, v, huv, hr, h0, h1, hun⟩ := exists_arcs_of_line hD.isOArc_discBd hL hLD' + subst h0 h1 hr + have hvu : IsTwoArcs v u := huv.symm + have hun' : range v ∪ range u = discBd D := by rw [Set.union_comm, hun] + obtain ⟨E, c, c', hE, q1, q2, q3, q4, q5, q6, q7, q8, cl, ch⟩ := + exists_chart_two_arcs hman hD (fun x _ => hint x) hvu hun' + have hb12 : Metric.closedBall (0 : ℂ) 1 ⊆ Metric.closedBall 0 2 := + Metric.closedBall_subset_closedBall (by norm_num) + have hinj : InjOn c (Metric.closedBall 0 2) := q5.injOn + have hDE : D ⊆ E := by + rw [← q7] + exact (image_mono hb12).trans q3.image_subset + have hlow : ∀ t, lowArc t ∈ Metric.closedBall (0 : ℂ) 1 := fun t => by + rw [mem_closedBall_zero_iff] + exact (norm_of_capH (y := - capH _) (abs_two_sub_one_le t) (by ring)).le + have hhigh : ∀ t, highArc t ∈ Metric.closedBall (0 : ℂ) 1 := fun t => by + rw [mem_closedBall_zero_iff] + exact (norm_of_capH (abs_two_sub_one_le t) rfl).le + have hnsq : ∀ z : ℂ, z.re ^ 2 + z.im ^ 2 = ‖z‖ ^ 2 := fun z => by + rw [Complex.sq_norm, Complex.normSq_apply] + ring + have hpt : ∀ x : ℝ, |x| < 1 → ∃ t : 𝕀, t ≠ 0 ∧ t ≠ 1 ∧ 2 * t.1 - 1 = x := fun x hx => by + obtain ⟨h3, h4⟩ := abs_lt.mp hx + refine ⟨⟨(x + 1) / 2, by linarith, by linarith⟩, fun he => ?_, fun he => ?_, by simp; ring⟩ + · have := congrArg Subtype.val he + simp only [Set.Icc.coe_zero] at this + linarith + · have := congrArg Subtype.val he + simp only [Set.Icc.coe_one] at this + linarith + let Yc : Set ℂ := Metric.closedBall 0 2 ∩ c ⁻¹' Y + have hYc : IsClosed Yc := q1.preimage_isClosed_of_isClosed Metric.isClosed_closedBall hY + have hYne : Yc.Nonempty := ⟨lowArc 0, hb12 (hlow 0), by + change c _ ∈ Y + rw [cl, huv.zero] + exact haY⟩ + let d : ℝ → ℝ := fun x => Metric.infDist (⟨x, capH x⟩ : ℂ) Yc + have hpc : ∀ {f : ℝ → ℝ}, Continuous f → Continuous fun x : ℝ => (⟨x, f x⟩ : ℂ) := fun hf => + Complex.equivRealProdCLM.symm.continuous.comp (continuous_id.prodMk hf) + have hdc : Continuous d := (Metric.continuous_infDist_pt Yc).comp (hpc continuous_capH) + have hdpos : ∀ x, |x| < 1 → 0 < d x := fun x hx => by + refine (hYc.notMem_iff_infDist_pos hYne).mp fun hmem => ?_ + obtain ⟨t, ht0, ht1, ht⟩ := hpt x hx + have he : highArc t = ⟨x, capH x⟩ := by simp only [highArc, ht] + have h3 : u t ∈ Y := by + have := hmem.2 + rwa [mem_preimage, ← he, ch] at this + rcases hYL ⟨h3, t, rfl⟩ with h4 | h4 + · exact ht0 (huv.arc_left.2 h4) + · exact ht1 (huv.arc_left.2 h4) + let e : ℝ → ℝ := fun x => min (d x / 2) (min (1 / 2) (capH x)) + have hHc := continuous_capH + have hec : Continuous e := (hdc.div_const 2).min (continuous_const.min hHc) + have hepos : ∀ x, |x| < 1 → 0 < e x := fun x hx => + lt_min (half_pos (hdpos x hx)) (lt_min (by norm_num) (capH_pos hx)) + have hele : ∀ x, e x ≤ 1 / 2 := fun x => (min_le_right _ _).trans (min_le_left _ _) + have hdata : IsPushData (fun x => capH x - e x) capH + (fun x => capH x + e x / 2) (fun x => capH x + e x) := by + refine ⟨hHc.sub hec, hHc, hHc.add (hec.div_const 2), hHc.add hec, + fun x hx => ?_, fun x hx => ?_⟩ + · have a2 := hepos x hx + refine ⟨?_, ?_, ?_, ?_⟩ <;> simp only <;> linarith + · have a1 := capH_eq_zero hx + have a2 : e x = 0 := by + simp only [e, a1] + rw [min_eq_right (by norm_num : (0 : ℝ) ≤ 1 / 2)] + exact min_eq_right (div_nonneg Metric.infDist_nonneg (by norm_num)) + simp [a1, a2] + obtain ⟨Θ, hre, him⟩ := exists_vertical_push hdata + have hfix : ∀ z : ℂ, + (1 ≤ |z.re| ∨ z.im ≤ capH z.re - e z.re ∨ capH z.re + e z.re ≤ z.im) → Θ z = z := by + intro z hz + refine Complex.ext (hre z) ?_ + rw [him] + rcases lt_or_ge |z.re| 1 with hx | hx + · obtain ⟨a1, a2, -, -⟩ := hdata.2.2.2.2.1 _ hx + rcases hz with hz | hz | hz + · exact absurd hx (not_lt.mpr hz) + · rw [tentMap, tent_low a1 a2 hz, mul_zero, add_zero] + · rw [tentMap, tent_high a1 a2 hz, mul_zero, add_zero] + · have a1 := (hdata.2.2.2.2.2 _ hx).2.1 + simp only at a1 + rw [tentMap, show capH z.re + e z.re / 2 - capH z.re = 0 by linarith, zero_mul, add_zero] + have hHle : ∀ x, capH x ≤ 1 := fun x => by + rw [capH] + exact Real.sqrt_le_one.mpr (by nlinarith [sq_nonneg x]) + have hHnn : ∀ x, 0 ≤ capH x := fun x => Real.sqrt_nonneg _ + have hfar : ∀ z : ℂ, 3 / 2 ≤ ‖z‖ → Θ z = z := by + intro z hz + refine hfix z ?_ + by_contra hcon + push Not at hcon + obtain ⟨a1, a2, a3⟩ := hcon + have a4 := capH_sq a1.le + have a5 := hele z.re + have a6 := hHle z.re + have a7 := hHnn z.re + have a8 : z.im ^ 2 < (capH z.re + 1 / 2) ^ 2 := sq_lt_sq' (by linarith) (by linarith) + have a9 := hnsq z + nlinarith + have hmap2 : ∀ z ∈ Metric.closedBall (0 : ℂ) 2, Θ z ∈ Metric.closedBall (0 : ℂ) 2 := by + intro z hz + by_contra hcon + have h3 : 2 < ‖Θ z‖ := by + rw [mem_closedBall_zero_iff, not_le] at hcon + exact hcon + have h4 := Θ.injective (hfar (Θ z) (by linarith)) + rw [h4] at h3 + linarith [mem_closedBall_zero_iff.mp hz] + obtain ⟨h, hh1, hh2⟩ := exists_homeomorph_of_collar hman hE q1 q2 q3 q4 q5 q6 q8 Θ hfar + have hfixY : ∀ y ∈ Y, h y = y := by + intro y hy + by_cases hyE : y ∈ E + · have hz := q4 hyE + have hcz : c (c' y) = y := q6 hyE + set z := c' y + have hzY : z ∈ Yc := ⟨hz, by rw [mem_preimage, hcz]; exact hy⟩ + have hfixz : Θ z = z := by + refine hfix z ?_ + by_contra hcon + push Not at hcon + obtain ⟨a1, a2, a3⟩ := hcon + have a5 : d z.re ≤ dist (⟨z.re, capH z.re⟩ : ℂ) z := Metric.infDist_le_dist_of_mem hzY + rw [Complex.dist_of_re_eq (show (⟨z.re, capH z.re⟩ : ℂ).re = z.re from rfl), + Real.dist_eq] at a5 + have a6 : e z.re ≤ d z.re / 2 := min_le_left _ _ + have a7 := hdpos z.re a1 + have a8 : |capH z.re - z.im| < e z.re := abs_lt.mpr ⟨by linarith, by linarith⟩ + simp only [d] at a5 a6 a7 + linarith + rw [← hcz, hh1 z hz, hfixz] + · exact hh2 y hyE + refine ⟨h, hfixY, ?_⟩ + rintro _ ⟨⟨_, ⟨s, rfl⟩, rfl⟩, hxD⟩ + by_cases hs0 : s = 0 + · subst hs0 + exact Or.inl (hfixY (u 0) haY) + by_cases hs1 : s = 1 + · subst hs1 + exact Or.inr (hfixY (u 1) hbY) + exfalso + have hs_pos : (0 : ℝ) < s.1 := lt_of_le_of_ne s.2.1 fun h => hs0 (Subtype.ext h.symm) + have hs_lt : s.1 < 1 := lt_of_le_of_ne s.2.2 fun h => hs1 (Subtype.ext h) + set x := 2 * s.1 - 1 + have hx1 : |x| < 1 := abs_lt.mpr ⟨by linarith, by linarith⟩ + have hhs : highArc s = ⟨x, capH x⟩ := rfl + have hz2 : highArc s ∈ Metric.closedBall (0 : ℂ) 2 := hb12 (hhigh s) + rw [← ch s, hh1 (highArc s) hz2] at hxD + obtain ⟨ζ, hζ, he⟩ : c (Θ (highArc s)) ∈ c '' Metric.closedBall 0 1 := q7 ▸ hxD + have hΘz : ζ = Θ (highArc s) := hinj (hb12 hζ) (hmap2 (highArc s) hz2) he + have hn1 : ‖Θ (highArc s)‖ ≤ 1 := mem_closedBall_zero_iff.mp (hΘz ▸ hζ) + have hn2 : (Θ (highArc s)).re ^ 2 + (Θ (highArc s)).im ^ 2 ≤ 1 := by + rw [hnsq] + nlinarith [norm_nonneg (Θ (highArc s))] + have hre_s : (Θ (highArc s)).re = x := hre (highArc s) + obtain ⟨a1, a2, -, -⟩ := hdata.2.2.2.2.1 x hx1 + simp only at a1 a2 + have him_s : (Θ (highArc s)).im = capH x + e x / 2 := by + rw [him (highArc s), hhs] + simp only [tentMap, tent_left a1 a2 a1.le le_rfl, div_self (sub_ne_zero.mpr a1.ne')] + ring + rw [hre_s, him_s] at hn2 + have hsq := capH_sq hx1.le + have hcpos := capH_pos hx1 + have hepos' := hepos x hx1 + nlinarith + +/-! ## 2. Tangle Separations from a Segregation -/ + +/-- For each society `S₀ ∈ S_seg` in a segregation of `G`, there is a complementary subgraph `B` +such that `IsGraphSeparation G S₀.G B` and `V(S₀.G) ∩ V(B) = S₀.Ω.bar`. -/ +theorem exists_separation_of_segregation {α : Type v} {β : Type w} {G : Graph α β} + {S_seg : Set (Society α β)} (hSeg : IsGraphSegregation G S_seg) + {S₀ : Society α β} (hS₀ : S₀ ∈ S_seg) : + ∃ B : Graph α β, IsGraphSeparation G S₀.G B ∧ V(S₀.G) ∩ V(B) = S₀.Ω.bar ∧ + V(B) = (V(G) \ V(S₀.G)) ∪ S₀.Ω.bar ∧ E(B) = E(G) \ E(S₀.G) := by + have hle₀ : S₀.G ≤ G := hSeg.le S₀ hS₀ + have hbar₀ : S₀.Ω.bar ⊆ V(S₀.G) := S₀.bar_subset + let X_B : Set α := (V(G) \ V(S₀.G)) ∪ S₀.Ω.bar + have hXB_sub : X_B ⊆ V(G) := + union_subset sdiff_subset (hbar₀.trans hle₀.vertexSet_mono) + let B : Graph α β := (G.induce X_B).restrict (E(G) \ E(S₀.G)) + have hB_le : B ≤ G := restrict_le.trans (induce_le hXB_sub) + have hVB : V(B) = X_B := by simp [B] + have hV_inter : V(S₀.G) ∩ V(B) = S₀.Ω.bar := by + rw [hVB] + ext v + simp only [X_B, mem_inter_iff, mem_union, mem_sdiff] + exact ⟨fun ⟨hv0, h⟩ => h.elim (fun ⟨_, hnot⟩ => (hnot hv0).elim) id, + fun hvbar => ⟨hbar₀ hvbar, Or.inr hvbar⟩⟩ + have hV_union : V(S₀.G) ∪ V(B) = V(G) := by + rw [hVB] + ext v + simp only [X_B, mem_union, mem_sdiff] + constructor + · rintro (hv0 | (⟨hvG, _⟩ | hvbar)) + · exact hle₀.vertexSet_mono hv0 + · exact hvG + · exact hle₀.vertexSet_mono (hbar₀ hvbar) + · intro hvG + by_cases hv0 : v ∈ V(S₀.G) + · exact Or.inl hv0 + · exact Or.inr (Or.inl ⟨hvG, hv0⟩) + have hEB : E(B) = E(G) \ E(S₀.G) := by + ext e + simp only [B, edgeSet_restrict, mem_inter_iff, edgeSet_induce, Set.mem_ofPred_eq] + refine ⟨fun h => h.2, fun ⟨heG, he_not_0⟩ => ⟨?_, heG, he_not_0⟩⟩ + have he_union : e ∈ E(subgraphSUnion G ((fun S₁ : Society α β => S₁.G) '' S_seg)) := + hSeg.union_eq.symm ▸ heG + simp only [subgraphSUnion, edgeSet_restrict, mem_inter_iff, mem_iUnion, mem_image, + exists_prop] at he_union + obtain ⟨_, ⟨S₁, hS₁, rfl⟩, heS₁⟩ := he_union.2 + have hne : S₀ ≠ S₁ := fun h => he_not_0 (h ▸ heS₁) + obtain ⟨x, y, hlink⟩ := exists_isLink_of_mem_edgeSet heG + have hlink₁ : S₁.G.IsLink e x y := ((hSeg.le S₁ hS₁).isLink_iff heS₁).mpr hlink + have hx_B : x ∈ X_B := by + by_cases hx0 : x ∈ V(S₀.G) + · exact Or.inr ((hSeg.vertex_inter_subset S₀ hS₀ S₁ hS₁ hne ⟨hx0, hlink₁.left_mem⟩).1) + · exact Or.inl ⟨hlink.left_mem, hx0⟩ + have hy_B : y ∈ X_B := by + by_cases hy0 : y ∈ V(S₀.G) + · exact Or.inr ((hSeg.vertex_inter_subset S₀ hS₀ S₁ hS₁ hne ⟨hy0, hlink₁.right_mem⟩).1) + · exact Or.inl ⟨hlink.right_mem, hy0⟩ + exact ⟨x, y, hlink, hx_B, hy_B⟩ + have hE_union : E(S₀.G) ∪ E(B) = E(G) := by + rw [hEB] + ext e + exact ⟨fun h => h.elim (fun he => hle₀.edgeSet_mono he) (fun he => he.1), + fun he => by by_cases h : e ∈ E(S₀.G) <;> [exact Or.inl h; exact Or.inr ⟨he, h⟩]⟩ + have hE_disj : Disjoint E(S₀.G) E(B) := by + rw [hEB] + exact disjoint_sdiff_self_right + exact ⟨B, ⟨hle₀, hB_le, hV_union, hE_union, hE_disj⟩, hV_inter, hVB, hEB⟩ + +/-- Applying `IsTangleLocal` to a society `S₀ ∈ S_seg` in a 3-segregation yields a separation +`(A_H, B_H) ∈ T` of `H` with `(A_H ∩ B_H).vertexSet = {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar}` of size +`≤ 3`. -/ +theorem exists_tangle_separation_of_threeSegregation {α : Type v} {β : Type w} {G : Graph α β} + {H : Drawing S} {η : SpanEmbedding H G} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {S_seg : Set (Society α β)} + (hSeg : IsThreeSegregation G S_seg) (hLoc : IsTangleLocal G H η T S_seg) + {S₀ : Society α β} (hS₀ : S₀ ∈ S_seg) : + ∃ A_H B_H : Hypergraph S (Set S), + H.toHypergraph.IsSeparation A_H B_H ∧ + A_H.vertexSet = {v ∈ H.V | η.vMap v ∈ V(S₀.G)} ∧ + (A_H ∩ B_H).vertexSet = {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar} ∧ + A_H.edgeSet = {e ∈ H.E | η.eMap e ∈ E(S₀.G)} ∧ + B_H.edgeSet = {e ∈ H.E | η.eMap e ∉ E(S₀.G)} ∧ + (A_H ∩ B_H).vertexSet.ncard ≤ 3 ∧ + (A_H, B_H) ∈ T := by + obtain ⟨B, hsepB, hV_inter, _, hEB⟩ := exists_separation_of_segregation hSeg.1 hS₀ + obtain ⟨A_H, B_H, hsepH, hAV, hBV, hAE, hBE, hmemT⟩ := hLoc S₀ hS₀ B hsepB hV_inter + have hinterV : (A_H ∩ B_H).vertexSet = {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar} := by + change A_H.vertexSet ∩ B_H.vertexSet = _ + rw [hAV, hBV, ← hV_inter] + ext v + simp only [mem_inter_iff, mem_ofPred_eq] + tauto + have hBE' : B_H.edgeSet = {e ∈ H.E | η.eMap e ∉ E(S₀.G)} := by + rw [hBE, hEB] + ext e + simp only [mem_ofPred_eq, mem_sdiff] + exact ⟨fun ⟨he, _, hnot⟩ => ⟨he, hnot⟩, + fun ⟨he, hnot⟩ => ⟨he, η.imageGraph_le.edgeSet_mono (η.bijOn_e.mapsTo he), hnot⟩⟩ + have hcard : (A_H ∩ B_H).vertexSet.ncard ≤ 3 := by + rw [hinterV] + have hsub : η.vMap '' {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar} ⊆ S₀.Ω.bar := by + rintro _ ⟨v, ⟨_, hv⟩, rfl⟩ + exact hv + have hinj : InjOn η.vMap {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar} := + η.bijOn_v.injOn.mono fun _ hv => hv.1 + have hfin : S₀.Ω.bar.Finite := S₀.Ω.finite_bar + calc + {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar}.ncard + = (η.vMap '' {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar}).ncard := hinj.ncard_image.symm + _ ≤ S₀.Ω.bar.ncard := ncard_le_ncard hsub hfin + _ ≤ 3 := hSeg.2 S₀ hS₀ + exact ⟨A_H, B_H, hsepH, hAV, hinterV, hAE, hBE', hcard, hmemT⟩ + +/-! ## 3. Proof of (7.7) (pages 37–38) -/ + +/-- Core contradiction in the proof of (7.7): if `C_i` (`i = 1` or `2`) is a circuit of `H` bounding +a closed disc `Δ_i ⊆ Δ₁` with `Δ₂ ⊆ Δ_i`, and `S₀ ∈ S_seg` contains an edge `e_i ∈ C_i.E` while +`C_i.V` contains at most one vertex of `{v ∈ H.V | η.vMap v ∈ S₀.Ω.bar}`, we obtain a contradiction +from (7.4), (7.6), and hypothesis (iii). -/ +private theorem no_circuit_in_arrangement_piece [T2Space S] + (hS : IsClosedSurface S) + (hConn : ConnectedSpace S) {α : Type v} {β : Type w} + {G : Graph α β} {H C_i : Drawing S} {η : SpanEmbedding H G} + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z Δ₁ Δ₂ Δ_i : Set S} + {S_seg : Set (Society α β)} (hθ : 6 ≤ θ) (hd : HasTangleMetric H θ T d) + (hz : z ∈ H.A) (hΔ_i : IsClosedDisc Δ_i) + (hz_sub : z ⊆ Δ₂ \ subBd Δ₂) + (hΔ₂_sub_i : Δ₂ ⊆ Δ_i) (hΔ_i_sub₁ : Δ_i ⊆ Δ₁) + (hii : ∀ x ∈ H.A, x ⊆ Δ₁ → d z x ≤ θ - 4) + (hiii : ∀ x ∈ H.A, d z x ≤ 3 → x ⊆ Δ₂ \ subBd Δ₂) + (hC_i : C_i.IsCircuit) (hC_is : C_i.IsSubdrawing H) (hbd_i : subBd Δ_i = C_i.U) + (hSeg : IsThreeSegregation G S_seg) (hLoc : IsTangleLocal G H η T S_seg) + {S₀ : Society α β} (hS₀ : S₀ ∈ S_seg) {e_i : Set S} (he_i : e_i ∈ C_i.E) + (he_S₀ : η.eMap e_i ∈ E(S₀.G)) + (hle1 : (C_i.V ∩ {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar}).ncard ≤ 1) : False := by + obtain ⟨hResp, K, ins, hK, hins, hd_eq⟩ := hd + obtain ⟨A_H, B_H, hsepH, _, hinterV, hAE, _, hcard, hmemT⟩ := + exists_tangle_separation_of_threeSegregation hSeg hLoc hS₀ + have hle1' : (C_i.V ∩ (A_H ∩ B_H).vertexSet).ncard ≤ 1 := by rwa [hinterV] + have he_A : e_i ∈ A_H.edgeSet := by + rw [hAE] + exact ⟨hC_is.2 he_i, he_S₀⟩ + have hsubA := circuit_subset_of_inter_ncard_le_one hsepH hC_i hC_is hle1' + (Or.inr ⟨e_i, he_i, he_A⟩) + obtain ⟨D, hD, hDs, hlen2θ, hDV_sub, hCU_sub⟩ := + theorem_7_4_proof hS hConn hResp hK hins hmemT hC_i hC_is hsubA.1 hsubA.2 + have hfin_AB : (A_H ∩ B_H).vertexSet.Finite := + hinterV ▸ H.finite_V.subset fun _ hv => hv.1 + have hDV_card : (D.V ∩ H.V).ncard ≤ 3 := + (ncard_le_ncard hDV_sub hfin_AB).trans hcard + have hDeq := (circuit_length_eq_two_mul_ncard hK.2.1 hD hDs).1 + have hDlen : D.length < 2 * (θ - (θ - 4)) := by omega + have hint_sub : Δ₂ \ subBd Δ₂ ⊆ Δ_i \ subBd Δ_i := by + have h₁ : Δ₂ \ subBd Δ₂ = interior Δ₂ := by + rw [← subBd_eq_frontier'] + exact self_sdiff_frontier _ + have h₂ : Δ_i \ subBd Δ_i = interior Δ_i := by + rw [← subBd_eq_frontier'] + exact self_sdiff_frontier _ + rw [h₁, h₂] + exact interior_mono hΔ₂_sub_i + have hZone_i : IsLambdaZoneAround H d (θ - 4) z (Δ_i \ subBd Δ_i) := by + obtain ⟨hOD_i, hcl_i, hbd_i'⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hΔ_i + refine ⟨hz, hOD_i, hz_sub.trans hint_sub, ?_, ?_, ?_, ?_, fun _ => by omega⟩ + · rw [hbd_i', hbd_i] + exact isOArc_of_isCircuit hC_i + · rw [hcl_i] + exact hΔ_i + · rw [hbd_i', hbd_i] + exact hC_is.U_subset + · intro x hx hsub + rw [hcl_i] at hsub + exact hii x hx (hsub.trans hΔ_i_sub₁) + obtain ⟨_, hcl_i, hbd_i'⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hΔ_i + have hbd_in_D : subBd (Δ_i \ subBd Δ_i) ⊆ ins D := by + rw [hbd_i', hbd_i] + exact hCU_sub + have hΔ_i_in_D : Δ_i ⊆ ins D := by + have h := theorem_7_6_proof hS hConn ⟨hResp, K, ins, hK, hins, hd_eq⟩ hK hins hZone_i + hD hDs hDlen hbd_in_D + rwa [hcl_i] at h + obtain ⟨p_z, hp_z⟩ := atom_nonempty hz + have hz_D : (z ∩ ins D).Nonempty := + ⟨p_z, hp_z, hΔ_i_in_D ((hz_sub.trans hint_sub hp_z).1)⟩ + have he_iH : e_i ∈ H.E := hC_is.2 he_i + have he_iA : e_i ∈ H.A := Or.inl (Or.inr he_iH) + obtain ⟨p_e, hp_e⟩ := atom_nonempty he_iA + have hp_e_CU : p_e ∈ C_i.U := (he_i.2.1 hp_e).1 + have he_D : (e_i ∩ ins D).Nonempty := + ⟨p_e, hp_e, hCU_sub hp_e_CU⟩ + have hd_le : d z e_i ≤ 3 := by + rw [hd_eq z hz e_i he_iA] + exact (tangleMetric_le_of_circuit hS hK hins hD hDs hlen2θ hz he_iA hz_D he_D).2.trans hDV_card + have he_in₂ : p_e ∈ Δ₂ \ subBd Δ₂ := hiii e_i he_iA hd_le hp_e + have he_in_i : p_e ∈ Δ_i \ subBd Δ_i := hint_sub he_in₂ + exact he_in_i.2 (hbd_i ▸ hp_e_CU) + +/-- No society `S₀ ∈ S_seg` can contain both an edge of `C₁` and an edge of `C₂`. -/ +private theorem no_two_circuits_in_arrangement_piece [T2Space S] + (hS : IsClosedSurface S) + (hConn : ConnectedSpace S) {α : Type v} {β : Type w} + {G : Graph α β} {H C₁ C₂ : Drawing S} {η : SpanEmbedding H G} + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z Δ₁ Δ₂ : Set S} + {S_seg : Set (Society α β)} (hθ : 6 ≤ θ) (hd : HasTangleMetric H θ T d) + (hz : z ∈ H.A) (hΔ₁ : IsClosedDisc Δ₁) (hΔ₂ : IsClosedDisc Δ₂) + (hz_sub : z ⊆ Δ₂ \ subBd Δ₂) (hΔ₂_sub₁ : Δ₂ ⊆ Δ₁ \ subBd Δ₁) + (hii : ∀ x ∈ H.A, x ⊆ Δ₁ → d z x ≤ θ - 4) + (hiii : ∀ x ∈ H.A, d z x ≤ 3 → x ⊆ Δ₂ \ subBd Δ₂) + (hC₁ : C₁.IsCircuit) (hC₁s : C₁.IsSubdrawing H) (hbd₁ : subBd Δ₁ = C₁.U) + (hC₂ : C₂.IsCircuit) (hC₂s : C₂.IsSubdrawing H) (hbd₂ : subBd Δ₂ = C₂.U) + (hdisj : Disjoint C₁.V C₂.V) + (hSeg : IsThreeSegregation G S_seg) (hLoc : IsTangleLocal G H η T S_seg) + {S₀ : Society α β} (hS₀ : S₀ ∈ S_seg) + {e₁ e₂ : Set S} (he₁ : e₁ ∈ C₁.E) (he₁_S₀ : η.eMap e₁ ∈ E(S₀.G)) + (he₂ : e₂ ∈ C₂.E) (he₂_S₀ : η.eMap e₂ ∈ E(S₀.G)) : False := by + obtain ⟨A_H, B_H, _, _, hinterV, _, _, hcard, _⟩ := + exists_tangle_separation_of_threeSegregation hSeg hLoc hS₀ + let X_S₀ : Set S := {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar} + have hX_fin : X_S₀.Finite := H.finite_V.subset fun _ hv => hv.1 + have hX_lt : X_S₀.ncard < 2 * 2 := by + have : X_S₀.ncard ≤ 3 := by + change {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar}.ncard ≤ 3 + rwa [← hinterV] + omega + let P_fam : Fin 2 → Set S := ![C₁.V, C₂.V] + have hP_disj : Pairwise (fun i j : Fin 2 => Disjoint (P_fam i) (P_fam j)) := by + intro i j hij + fin_cases i <;> fin_cases j + · exact absurd rfl hij + · exact hdisj + · exact hdisj.symm + · exact absurd rfl hij + obtain ⟨i, hi⟩ := exists_inter_ncard_le_one_of_ncard_lt_two_mul hP_disj hX_fin hX_lt + fin_cases i + · exact no_circuit_in_arrangement_piece hS hConn hθ hd hz hΔ₁ hz_sub + (hΔ₂_sub₁.trans sdiff_subset) subset_rfl hii hiii hC₁ hC₁s hbd₁ hSeg hLoc hS₀ + he₁ he₁_S₀ hi + · exact no_circuit_in_arrangement_piece hS hConn hθ hd hz hΔ₂ hz_sub + subset_rfl (hΔ₂_sub₁.trans sdiff_subset) hii hiii hC₂ hC₂s hbd₂ hSeg hLoc hS₀ + he₂ he₂_S₀ hi + +/-- If `S₀ ∈ S_seg` contains an edge of `C₂`, then `(α_pt '' S₀.Ω.bar).ncard ≥ 2`. -/ +private theorem two_le_bar_image_ncard_of_mem_C2 [T2Space S] + (hS : IsClosedSurface S) + (hConn : ConnectedSpace S) {α : Type v} {β : Type w} + {G : Graph α β} {H C₂ : Drawing S} {η : SpanEmbedding H G} + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z Δ₁ Δ₂ : Set S} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + (hθ : 6 ≤ θ) (hd : HasTangleMetric H θ T d) + (hz : z ∈ H.A) (hΔ₂ : IsClosedDisc Δ₂) + (hz_sub : z ⊆ Δ₂ \ subBd Δ₂) (hΔ₂_sub₁ : Δ₂ ⊆ Δ₁ \ subBd Δ₁) + (hii : ∀ x ∈ H.A, x ⊆ Δ₁ → d z x ≤ θ - 4) + (hiii : ∀ x ∈ H.A, d z x ≤ 3 → x ⊆ Δ₂ \ subBd Δ₂) + (hC₂ : C₂.IsCircuit) (hC₂s : C₂.IsSubdrawing H) (hbd₂ : subBd Δ₂ = C₂.U) + (hSeg : IsThreeSegregation G S_seg) (hLoc : IsTangleLocal G H η T S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + {S₀ : Society α β} (hS₀ : S₀ ∈ S_seg) + {e₂ : Set S} (he₂ : e₂ ∈ C₂.E) (he₂_S₀ : η.eMap e₂ ∈ E(S₀.G)) : + 2 ≤ (α_pt '' S₀.Ω.bar).ncard ∧ S₀.Ω.bar.Nonempty := by + have hinj_α : InjOn α_pt S₀.Ω.bar := + hArr.injOn_pts.mono (subset_biUnion_of_mem (u := fun S₁ : Society α β => S₁.Ω.bar) hS₀) + have hcard_eq : (α_pt '' S₀.Ω.bar).ncard = S₀.Ω.bar.ncard := hinj_α.ncard_image + have h2 : 2 ≤ S₀.Ω.bar.ncard := by + by_contra hlt + push Not at hlt + have hle1_bar : S₀.Ω.bar.ncard ≤ 1 := by omega + have hsub : η.vMap '' (C₂.V ∩ {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar}) ⊆ S₀.Ω.bar := by + rintro _ ⟨v, ⟨_, _, hv⟩, rfl⟩ + exact hv + have hinj_η : InjOn η.vMap (C₂.V ∩ {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar}) := + η.bijOn_v.injOn.mono fun _ hv => hv.2.1 + have hle1 : (C₂.V ∩ {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar}).ncard ≤ 1 := by + calc + (C₂.V ∩ {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar}).ncard + = (η.vMap '' (C₂.V ∩ {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar})).ncard := hinj_η.ncard_image.symm + _ ≤ S₀.Ω.bar.ncard := ncard_le_ncard hsub S₀.Ω.finite_bar + _ ≤ 1 := hle1_bar + exact no_circuit_in_arrangement_piece hS hConn hθ hd hz hΔ₂ hz_sub + subset_rfl (hΔ₂_sub₁.trans sdiff_subset) hii hiii hC₂ hC₂s hbd₂ hSeg hLoc hS₀ + he₂ he₂_S₀ hle1 + refine ⟨hcard_eq ▸ h2, ?_⟩ + exact (ncard_pos S₀.Ω.finite_bar).mp (by omega) + +/-- Gluing a finite family of drawings that pairwise meet only in common vertices. -/ +private theorem exists_glued_drawing {ι : Type*} (s : Finset ι) (D_fam : ι → Drawing S) + (hmeet : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → (D_fam i).U ∩ (D_fam j).U ⊆ (D_fam i).V ∩ (D_fam j).V) : + ∃ J : Drawing S, + J.U = (⋃ i ∈ s, (D_fam i).U) ∧ + J.V = (⋃ i ∈ s, (D_fam i).V) ∧ + J.E = (⋃ i ∈ s, (D_fam i).E) := by + classical + induction s using Finset.induction_on with + | empty => + have hE_emp : arcComponentsIn ((∅ : Set S) \ ∅) = ∅ := by + ext C + simp only [sdiff_self, mem_empty_iff_false, iff_false] + rintro ⟨⟨x, hx⟩, hsub, -⟩ + exact hsub hx + refine ⟨{ U := ∅, V := ∅, V_subset_U := subset_rfl, isClosed_U := isClosed_empty, + finite_V := finite_empty, finite_edges := by rw [hE_emp]; exact finite_empty, + edge_cond := fun e he => by rw [hE_emp] at he; exact False.elim he }, + by simp, by simp, by change arcComponentsIn (∅ \ ∅) = _; rw [hE_emp]; simp⟩ + | @insert a s ha ih => + obtain ⟨J₀, hU₀, hV₀, hE₀⟩ := + ih (fun i hi j hj hij => hmeet i (Finset.mem_insert_of_mem hi) j + (Finset.mem_insert_of_mem hj) hij) + have hm : (D_fam a).U ∩ J₀.U ⊆ (D_fam a).V ∩ J₀.V := by + rw [hU₀, hV₀] + rintro x ⟨hxa, hxU⟩ + obtain ⟨i, hi, hxi⟩ := mem_iUnion₂.mp hxU + have hne : a ≠ i := fun h => ha (h ▸ hi) + have h := hmeet a (Finset.mem_insert_self a s) i (Finset.mem_insert_of_mem hi) hne ⟨hxa, hxi⟩ + exact ⟨h.1, mem_iUnion₂.mpr ⟨i, hi, h.2⟩⟩ + refine ⟨(D_fam a).glue J₀ hm, ?_, ?_, ?_⟩ + · change (D_fam a).U ∪ J₀.U = _ + rw [hU₀, Finset.set_biUnion_insert] + · change (D_fam a).V ∪ J₀.V = _ + rw [hV₀, Finset.set_biUnion_insert] + · rw [Drawing.glue_E hm, hE₀, Finset.set_biUnion_insert] + +/-- Every point of `C.U` in a circuit `C` belongs to the closure of some edge `e ∈ C.E`. -/ +theorem exists_edge_closure_of_mem_circuit_U {C : Drawing S} (hC : C.IsCircuit) + {x : S} (hx : x ∈ C.U) : ∃ e ∈ C.E, x ∈ closure e := by + by_cases hxV : x ∈ C.V + · obtain ⟨W, _, hpos, _, hE⟩ := exists_walk_at hC hxV + cases W with + | nil _ => exact absurd hpos (Nat.lt_irrefl 0) + | @cons _ w _ e hl r => + have he : e ∈ C.E := by rw [hE]; exact List.mem_cons_self + have hx_cl : x ∈ closure e ∩ C.V := by rw [hl.2.2.2]; exact Or.inl rfl + exact ⟨e, he, hx_cl.1⟩ + · have hx_diff : x ∈ C.U \ C.V := ⟨hx, hxV⟩ + have he : pathComponentIn (C.U \ C.V) x ∈ C.E := + GraphMinor.Surface.mem_arcComponentsIn_of_mem hx_diff + exact ⟨pathComponentIn (C.U \ C.V) x, he, subset_closure (mem_pathComponentIn_self hx_diff)⟩ + +/-- Any `O`-arc contained in the boundary `subBd D` of a closed disc `D` equals `subBd D`. -/ +theorem eq_subBd_of_isOArc_subset [T2Space S] (hS : IsClosedSurface S) {D F : Set S} + (hD : IsClosedDisc D) (hF : IsOArc F) (hF_sub : F ⊆ subBd D) : F = subBd D := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨Δ₀, ⟨hΔ₀_sub, hΔ₀_disc, hΔ₀_bd, -⟩, -⟩ := + disc_oArc D F hD (hF_sub.trans fun _ hx => hD.isClosed.closure_eq ▸ hx.1) hF + have hbd₀ : subBd Δ₀ = F := by + rw [IsClosedDisc.subBd_eq_discBd hS hΔ₀_disc, hΔ₀_bd] + have hfr₀ : frontier Δ₀ = F := by rw [subBd_eq_frontier', hbd₀] + obtain ⟨hOD₀, _, _⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hΔ₀_disc + obtain ⟨p, hp⟩ := IsOpenDisc.nonempty hOD₀ + have hp_int₀ : p ∈ interior Δ₀ := by + by_contra hni + exact hp.2 (by rw [← subBd_eq_frontier']; exact ⟨subset_closure hp.1, hni⟩) + have hp_intD : p ∈ interior D := interior_mono hΔ₀_sub hp_int₀ + obtain ⟨hOD, hclD, _⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hD + have hp_D : p ∈ D \ subBd D := + ⟨interior_subset hp_intD, fun hf => by rw [← subBd_eq_frontier'] at hf; exact hf.2 hp_intD⟩ + have hdisj : Disjoint (D \ subBd D) (frontier Δ₀) := by + rw [hfr₀] + exact disjoint_sdiff_left.mono_right hF_sub + have hsub : D \ subBd D ⊆ Δ₀ := + subset_of_disjoint_frontier hOD.isPathConnected.isConnected.isPreconnected + hΔ₀_disc.isClosed hdisj hp_D hp.1 + have h_eq : D = Δ₀ := + subset_antisymm (hclD ▸ hΔ₀_disc.isClosed.closure_subset_iff.mpr hsub) hΔ₀_sub + rw [h_eq, hbd₀] + +/-- For each `S₀ ∈ S_seg`, the open disc `α_disc S₀ \ subBd (α_disc S₀)` is a region of `J` when +`J.U = ⋃ S₁ ∈ S_seg, subBd (α_disc S₁)`. -/ +private theorem region_of_glued_arrangement [T2Space S] (hS : IsClosedSurface S) + {α : Type v} {β : Type w} {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} {α_pt : α → S} {J : Drawing S} + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hJU : J.U = ⋃ S₁ ∈ S_seg, subBd (α_disc S₁)) + {S₀ : Society α β} (hS₀ : S₀ ∈ S_seg) : + α_disc S₀ \ subBd (α_disc S₀) ∈ J.R := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hD₀ : IsClosedDisc (α_disc S₀) := (hArr.isClosedDisc S₀ hS₀).1 + obtain ⟨hOD₀, _, _⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hD₀ + have hsub_compl : α_disc S₀ \ subBd (α_disc S₀) ⊆ univ \ J.U := by + rintro x ⟨hxD, hxnot⟩ + refine ⟨mem_univ x, fun hxJ => ?_⟩ + rw [hJU] at hxJ + obtain ⟨S₁, hS₁, hx₁⟩ := mem_iUnion₂.mp hxJ + by_cases h_eq : S₁ = S₀ + · exact hxnot (h_eq ▸ hx₁) + · have hx_inter : x ∈ α_disc S₀ ∩ α_disc S₁ := + ⟨hxD, (hArr.isClosedDisc S₁ hS₁).1.isClosed.closure_eq ▸ hx₁.1⟩ + obtain ⟨v, ⟨hv₀, _⟩, rfl⟩ := hArr.inter_discs S₀ hS₀ S₁ hS₁ (Ne.symm h_eq) hx_inter + exact hxnot ((hArr.isClosedDisc S₀ hS₀).2 v hv₀) + obtain ⟨p, hp⟩ := IsOpenDisc.nonempty hOD₀ + have hp_compl : p ∈ univ \ J.U := hsub_compl hp + refine ⟨p, hp_compl, subset_antisymm ?_ + (hOD₀.isPathConnected.isConnected.isPreconnected.subset_connectedComponentIn hp hsub_compl)⟩ + have hbd_sub : subBd (α_disc S₀) ⊆ J.U := by + rw [hJU] + exact subset_biUnion_of_mem (u := fun S₁ : Society α β => subBd (α_disc S₁)) hS₀ + have hfr₀ : frontier (α_disc S₀) = subBd (α_disc S₀) := subBd_eq_frontier' _ + have hC_sub_compl : connectedComponentIn (univ \ J.U) p ⊆ univ \ J.U := + connectedComponentIn_subset (univ \ J.U) p + have hdisj : Disjoint (connectedComponentIn (univ \ J.U) p) (frontier (α_disc S₀)) := by + rw [hfr₀] + refine disjoint_left.mpr fun x hxC hxbd => (hC_sub_compl hxC).2 (hbd_sub hxbd) + have hC_sub_D₀ : connectedComponentIn (univ \ J.U) p ⊆ α_disc S₀ := + subset_of_disjoint_frontier isPreconnected_connectedComponentIn hD₀.isClosed hdisj + (mem_connectedComponentIn hp_compl) hp.1 + exact fun x hxC => ⟨hC_sub_D₀ hxC, fun hxbd => (hC_sub_compl hxC).2 (hbd_sub hxbd)⟩ + +/-- Every edge `e ∈ H.E` is contained in `α_disc S₀ \ subBd (α_disc S₀)` for some `S₀ ∈ S_seg` with +`η.eMap e ∈ E(S₀.G)`, and any region `r ∈ J.R` meeting `e` equals `α_disc S₀ \ subBd (α_disc S₀)`. +-/ +private theorem edge_in_arrangement_disc [T2Space S] (hS : IsClosedSurface S) + {α : Type v} {β : Type w} {G : Graph α β} {H J : Drawing S} {η : SpanEmbedding H G} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + (hSeg : IsThreeSegregation G S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G H η S_seg α_disc α_pt) + (hJU : J.U = ⋃ S₁ ∈ S_seg, subBd (α_disc S₁)) + {e : Set S} (he : e ∈ H.E) : + ∃ S₀ ∈ S_seg, η.eMap e ∈ E(S₀.G) ∧ e ⊆ α_disc S₀ \ subBd (α_disc S₀) ∧ + ∀ r ∈ J.R, (r ∩ e).Nonempty → r = α_disc S₀ \ subBd (α_disc S₀) := by + have he_G : η.eMap e ∈ E(G) := η.imageGraph_le.edgeSet_mono (η.bijOn_e.mapsTo he) + have he_union : η.eMap e ∈ E(subgraphSUnion G ((fun S₁ : Society α β => S₁.G) '' S_seg)) := + hSeg.1.union_eq.symm ▸ he_G + simp only [subgraphSUnion, edgeSet_restrict, mem_inter_iff, mem_iUnion, mem_image, + exists_prop] at he_union + obtain ⟨_, ⟨S₀, hS₀, rfl⟩, he_S₀⟩ := he_union.2 + have he_disc : e ⊆ α_disc S₀ := (hComp.inter_E_iff S₀ hS₀ e he).mpr he_S₀ + have he_diff : e ⊆ α_disc S₀ \ subBd (α_disc S₀) := by + intro x hxe + refine ⟨he_disc hxe, fun hxbd => ?_⟩ + have hx_inter : x ∈ H.U ∩ subBd (α_disc S₀) := ⟨(he.2.1 hxe).1, hxbd⟩ + rw [hComp.bd_inter_eq S₀ hS₀] at hx_inter + exact (he.2.1 hxe).2 hx_inter.1 + refine ⟨S₀, hS₀, he_S₀, he_diff, fun r hr ⟨x, hxr, hxe⟩ => ?_⟩ + have hreg₀ : α_disc S₀ \ subBd (α_disc S₀) ∈ J.R := + region_of_glued_arrangement hS hArr hJU hS₀ + exact region_eq_of_mem hr hreg₀ hxr (he_diff hxe) + +/-- Claim (1) in the proof of (7.7) (page 38): +"$r \subseteq \Delta_1 - bd(\Delta_1)$ for every region $r$ of $J$ with $\bar{r} \cap +(\Delta_2 - bd(\Delta_2)) \ne \emptyset$." -/ +private theorem lemma_7_7_claim_1 [T2Space S] + (hS : IsClosedSurface S) + (hConn : ConnectedSpace S) {α : Type v} {β : Type w} + {G : Graph α β} {H C₁ C₂ J : Drawing S} {η : SpanEmbedding H G} + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z Δ₁ Δ₂ : Set S} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + (hθ : 6 ≤ θ) (hd : HasTangleMetric H θ T d) + (hz : z ∈ H.A) (hΔ₁ : IsClosedDisc Δ₁) (hΔ₂ : IsClosedDisc Δ₂) + (hz_sub : z ⊆ Δ₂ \ subBd Δ₂) (hΔ₂_sub₁ : Δ₂ ⊆ Δ₁ \ subBd Δ₁) + (hii : ∀ x ∈ H.A, x ⊆ Δ₁ → d z x ≤ θ - 4) + (hiii : ∀ x ∈ H.A, d z x ≤ 3 → x ⊆ Δ₂ \ subBd Δ₂) + (hC₁ : C₁.IsCircuit) (hC₁s : C₁.IsSubdrawing H) (hbd₁ : subBd Δ₁ = C₁.U) + (hC₂ : C₂.IsCircuit) (hC₂s : C₂.IsSubdrawing H) (hbd₂ : subBd Δ₂ = C₂.U) + (hdisj : Disjoint C₁.V C₂.V) + (hSeg : IsThreeSegregation G S_seg) (hLoc : IsTangleLocal G H η T S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G H η S_seg α_disc α_pt) + (hJU : J.U = ⋃ S₁ ∈ S_seg, subBd (α_disc S₁)) + {r : Set S} (hr : r ∈ J.R) (hinter : (closure r ∩ (Δ₂ \ subBd Δ₂)).Nonempty) : + r ⊆ Δ₁ \ subBd Δ₁ := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + by_contra hnot_sub + obtain ⟨hOD₂, _, _⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hΔ₂ + obtain ⟨y₀, hy₀_cl, hy₀_Δ₂⟩ := hinter + obtain ⟨x₂, hx₂_Δ₂, hx₂_r⟩ := mem_closure_iff.mp hy₀_cl (Δ₂ \ subBd Δ₂) hOD₂.1 hy₀_Δ₂ + obtain ⟨y, hy_r, hy_not₁⟩ := not_subset.mp hnot_sub + have hr_open : IsOpen r := region_isOpen hr + have hr_conn : IsPreconnected r := region_isPreconnected hr + have hfr₁ : frontier Δ₁ = C₁.U := by rw [subBd_eq_frontier', hbd₁] + have hfr₂ : frontier Δ₂ = C₂.U := by rw [subBd_eq_frontier', hbd₂] + have hr_C₁ : (r ∩ C₁.U).Nonempty := by + by_cases hy_Δ₁ : y ∈ Δ₁ + · have hy_bd₁ : y ∈ subBd Δ₁ := by_contra fun hn => hy_not₁ ⟨hy_Δ₁, hn⟩ + exact ⟨y, hy_r, hbd₁ ▸ hy_bd₁⟩ + · by_contra h_emp + rw [not_nonempty_iff_eq_empty, ← disjoint_iff_inter_eq_empty, ← hfr₁] at h_emp + have hsub₁ : r ⊆ Δ₁ := + subset_of_disjoint_frontier hr_conn hΔ₁.isClosed h_emp hx₂_r (hΔ₂_sub₁ hx₂_Δ₂.1).1 + exact hy_Δ₁ (hsub₁ hy_r) + have hr_C₂ : (r ∩ C₂.U).Nonempty := by + by_contra h_emp + rw [not_nonempty_iff_eq_empty, ← disjoint_iff_inter_eq_empty, ← hfr₂] at h_emp + have hsub₂ : r ⊆ Δ₂ := + subset_of_disjoint_frontier hr_conn hΔ₂.isClosed h_emp hx₂_r hx₂_Δ₂.1 + exact hy_not₁ (hΔ₂_sub₁ (hsub₂ hy_r)) + obtain ⟨p₁, hp₁_r, hp₁_C₁⟩ := hr_C₁ + obtain ⟨e₁, he₁, hp₁_cl⟩ := exists_edge_closure_of_mem_circuit_U hC₁ hp₁_C₁ + have hre₁ : (r ∩ e₁).Nonempty := mem_closure_iff.mp hp₁_cl r hr_open hp₁_r + obtain ⟨p₂, hp₂_r, hp₂_C₂⟩ := hr_C₂ + obtain ⟨e₂, he₂, hp₂_cl⟩ := exists_edge_closure_of_mem_circuit_U hC₂ hp₂_C₂ + have hre₂ : (r ∩ e₂).Nonempty := mem_closure_iff.mp hp₂_cl r hr_open hp₂_r + obtain ⟨S₁, hS₁, he₁_S₁, _, hr_eq₁⟩ := + edge_in_arrangement_disc hS hSeg hArr hComp hJU (hC₁s.2 he₁) + obtain ⟨S₂, hS₂, he₂_S₂, _, hr_eq₂⟩ := + edge_in_arrangement_disc hS hSeg hArr hComp hJU (hC₂s.2 he₂) + have hr₁ : r = α_disc S₁ \ subBd (α_disc S₁) := hr_eq₁ r hr hre₁ + have hr₂ : r = α_disc S₂ \ subBd (α_disc S₂) := hr_eq₂ r hr hre₂ + have hS_eq : S₁ = S₂ := by + by_contra hne + obtain ⟨q, hq⟩ := region_nonempty hr + have hq₁ : q ∈ α_disc S₁ \ subBd (α_disc S₁) := hr₁ ▸ hq + have hq₂ : q ∈ α_disc S₂ \ subBd (α_disc S₂) := hr₂ ▸ hq + obtain ⟨v, ⟨hv₁, _⟩, rfl⟩ := hArr.inter_discs S₁ hS₁ S₂ hS₂ hne ⟨hq₁.1, hq₂.1⟩ + exact hq₁.2 ((hArr.isClosedDisc S₁ hS₁).2 v hv₁) + subst hS_eq + exact no_two_circuits_in_arrangement_piece hS hConn hθ hd hz hΔ₁ hΔ₂ hz_sub + hΔ₂_sub₁ hii hiii hC₁ hC₁s hbd₁ hC₂ hC₂s hbd₂ hdisj hSeg hLoc hS₁ he₁ he₁_S₁ he₂ he₂_S₂ + +/-- Every edge `e ∈ C.E` belonging to `(D_J S₀).E` is a line with two distinct ends in `(D_J S₀).V` +(and cannot be a loop). -/ +private theorem circuit_edge_isLineWithEnds [T2Space S] + (hS : IsClosedSurface S) + (hConn : ConnectedSpace S) {α : Type v} {β : Type w} + {G : Graph α β} {H C₁ C₂ J C D₀ : Drawing S} {η : SpanEmbedding H G} + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z Δ₁ Δ₂ Λ : Set S} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + (hθ : 6 ≤ θ) (hd : HasTangleMetric H θ T d) + (hz : z ∈ H.A) (hΔ₁ : IsClosedDisc Δ₁) (hΔ₂ : IsClosedDisc Δ₂) + (hz_sub : z ⊆ Δ₂ \ subBd Δ₂) (hΔ₂_sub₁ : Δ₂ ⊆ Δ₁ \ subBd Δ₁) + (hii : ∀ x ∈ H.A, x ⊆ Δ₁ → d z x ≤ θ - 4) + (hiii : ∀ x ∈ H.A, d z x ≤ 3 → x ⊆ Δ₂ \ subBd Δ₂) + (hC₁ : C₁.IsCircuit) (hC₁s : C₁.IsSubdrawing H) (hbd₁ : subBd Δ₁ = C₁.U) + (hC₂ : C₂.IsCircuit) (hC₂s : C₂.IsSubdrawing H) (hbd₂ : subBd Δ₂ = C₂.U) + (hSeg : IsThreeSegregation G S_seg) (hLoc : IsTangleLocal G H η T S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G H η S_seg α_disc α_pt) + (hJU : J.U = ⋃ S₁ ∈ S_seg, subBd (α_disc S₁)) + (hOpenΛ : IsOpenDisc Λ) (hclΛ_sub : closure Λ ⊆ Δ₁) (hclΛ_disc : IsClosedDisc (closure Λ)) + (hbd_clΛ : subBd (closure Λ) = C.U) (hdiffΛ : closure Λ \ C.U = Λ) + (hZΛ : Δ₂ \ subBd Δ₂ ⊆ Λ) + {S₀ : Society α β} (hS₀ : S₀ ∈ S_seg) + (hD₀U : D₀.U = subBd (α_disc S₀)) (hD₀V : α_pt '' S₀.Ω.bar ⊆ D₀.V) + {e : Set S} (heC : e ∈ C.E) (heD₀ : e ∈ D₀.E) : + ∃ a b : S, a ≠ b ∧ closure e ∩ D₀.V = {a, b} ∧ IsLineWithEnds (closure e) a b := by + rcases D₀.edge_cond e heD₀ with hline | ⟨u, huV, hO_e⟩ + · exact hline + · exfalso + have hD₀_disc : IsClosedDisc (α_disc S₀) := (hArr.isClosedDisc S₀ hS₀).1 + have hcl_sub_bd₀ : closure e ⊆ subBd (α_disc S₀) := + hD₀U ▸ D₀.closure_subset_U heD₀ + have hcl_eq_bd₀ : closure e = subBd (α_disc S₀) := + eq_subBd_of_isOArc_subset hS hD₀_disc hO_e hcl_sub_bd₀ + have hcl_sub_CU : closure e ⊆ subBd (closure Λ) := + hbd_clΛ.symm ▸ C.closure_subset_U heC + have hcl_eq_CU : closure e = subBd (closure Λ) := + eq_subBd_of_isOArc_subset hS hclΛ_disc hO_e hcl_sub_CU + have hbd_eq : subBd (closure Λ) = subBd (α_disc S₀) := + hcl_eq_CU.symm.trans hcl_eq_bd₀ + have hbar_sub_u : α_pt '' S₀.Ω.bar ⊆ {u} := by + rw [← huV, hcl_eq_bd₀, ← hD₀U, inter_eq_right.mpr D₀.V_subset_U] + exact hD₀V + by_cases h_eq : closure Λ = α_disc S₀ + · obtain ⟨p₂, hp₂⟩ := IsOArc.nonempty (isOArc_of_isCircuit hC₂) + obtain ⟨e₂, he₂, _⟩ := exists_edge_closure_of_mem_circuit_U hC₂ hp₂ + obtain ⟨_, hcl₂, _⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hΔ₂ + have hΔ₂_sub_clΛ : Δ₂ ⊆ closure Λ := + hcl₂ ▸ isClosed_closure.closure_subset_iff.mpr (hZΛ.trans subset_closure) + have he₂_sub : e₂ ⊆ α_disc S₀ := by + intro x hxe₂ + exact h_eq ▸ hΔ₂_sub_clΛ (hΔ₂.isClosed.closure_eq ▸ (hbd₂ ▸ (he₂.2.1 hxe₂).1).1) + have he₂_S₀ : η.eMap e₂ ∈ E(S₀.G) := + (hComp.inter_E_iff S₀ hS₀ e₂ (hC₂s.2 he₂)).mp he₂_sub + have h2 := (two_le_bar_image_ncard_of_mem_C2 hS hConn hθ hd hz hΔ₂ hz_sub + hΔ₂_sub₁ hii hiii hC₂ hC₂s hbd₂ hSeg hLoc hArr hS₀ he₂ he₂_S₀).1 + have hle1 : (α_pt '' S₀.Ω.bar).ncard ≤ 1 := + (ncard_le_ncard hbar_sub_u (finite_singleton u)).trans (by simp) + omega + · have hdiscBd_eq : discBd (closure Λ) = discBd (α_disc S₀) := by + rw [← IsClosedDisc.subBd_eq_discBd hS hclΛ_disc, + ← IsClosedDisc.subBd_eq_discBd hS hD₀_disc, hbd_eq] + have hcov : closure Λ ∪ α_disc S₀ = univ := + cover_of_discBd_eq hS hclΛ_disc hD₀_disc hdiscBd_eq h_eq + obtain ⟨p₁, hp₁⟩ := IsOArc.nonempty (isOArc_of_isCircuit hC₁) + obtain ⟨e₁, he₁, _⟩ := exists_edge_closure_of_mem_circuit_U hC₁ hp₁ + obtain ⟨S₁, hS₁, he₁_S₁, he₁_diff, _⟩ := + edge_in_arrangement_disc hS hSeg hArr hComp hJU (hC₁s.2 he₁) + by_cases hS_eq : S₁ = S₀ + · subst hS_eq + have hinj_α : InjOn α_pt S₁.Ω.bar := + hArr.injOn_pts.mono (subset_biUnion_of_mem (u := fun S₂ : Society α β => S₂.Ω.bar) hS₁) + have hbar_le1 : S₁.Ω.bar.ncard ≤ 1 := by + rw [← hinj_α.ncard_image] + exact (ncard_le_ncard hbar_sub_u (finite_singleton u)).trans (by simp) + have hsub : η.vMap '' (C₁.V ∩ {v ∈ H.V | η.vMap v ∈ S₁.Ω.bar}) ⊆ S₁.Ω.bar := by + rintro _ ⟨v, ⟨_, _, hv⟩, rfl⟩ + exact hv + have hinj_η : InjOn η.vMap (C₁.V ∩ {v ∈ H.V | η.vMap v ∈ S₁.Ω.bar}) := + η.bijOn_v.injOn.mono fun _ hv => hv.2.1 + have hle1 : (C₁.V ∩ {v ∈ H.V | η.vMap v ∈ S₁.Ω.bar}).ncard ≤ 1 := by + calc + (C₁.V ∩ {v ∈ H.V | η.vMap v ∈ S₁.Ω.bar}).ncard + = (η.vMap '' (C₁.V ∩ {v ∈ H.V | η.vMap v ∈ S₁.Ω.bar})).ncard := + hinj_η.ncard_image.symm + _ ≤ S₁.Ω.bar.ncard := ncard_le_ncard hsub S₁.Ω.finite_bar + _ ≤ 1 := hbar_le1 + exact no_circuit_in_arrangement_piece hS hConn hθ hd hz hΔ₁ hz_sub + (hΔ₂_sub₁.trans sdiff_subset) subset_rfl hii hiii hC₁ hC₁s hbd₁ hSeg hLoc hS₁ + he₁ he₁_S₁ hle1 + · obtain ⟨q₁, hq₁⟩ := atom_nonempty (Or.inl (Or.inr (hC₁s.2 he₁))) + have hq₁_S₁ : q₁ ∈ α_disc S₁ \ subBd (α_disc S₁) := he₁_diff hq₁ + have hq₁_not₀ : q₁ ∉ α_disc S₀ := by + intro hq₁_0 + obtain ⟨v, ⟨hv₁, _⟩, rfl⟩ := hArr.inter_discs S₁ hS₁ S₀ hS₀ hS_eq ⟨hq₁_S₁.1, hq₁_0⟩ + exact hq₁_S₁.2 ((hArr.isClosedDisc S₁ hS₁).2 v hv₁) + have hq₁_clΛ : q₁ ∈ closure Λ := by + have h_univ : q₁ ∈ closure Λ ∪ α_disc S₀ := hcov.symm ▸ mem_univ q₁ + exact h_univ.resolve_right hq₁_not₀ + have hq₁_not_CU : q₁ ∉ C.U := by + intro hq₁_CU + exact hq₁_not₀ (hD₀_disc.isClosed.closure_eq ▸ (hbd_eq ▸ hbd_clΛ ▸ hq₁_CU).1) + have hq₁_Λ : q₁ ∈ Λ := hdiffΛ ▸ ⟨hq₁_clΛ, hq₁_not_CU⟩ + have hq₁_int₁ : q₁ ∈ interior Δ₁ := + interior_maximal (subset_closure.trans hclΛ_sub) hOpenΛ.1 hq₁_Λ + have hq₁_bd₁ : q₁ ∈ frontier Δ₁ := by + rw [subBd_eq_frontier', hbd₁] + exact (he₁.2.1 hq₁).1 + exact hq₁_bd₁.2 hq₁_int₁ + +open Classical in +private noncomputable abbrev arrangement_boundary_vertices + {α β : Type*} {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} + {α_pt : α → S} (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (p_S : S) (S₀ : Society α β) : Set S := + if h : S₀ ∈ S_seg then + if S₀.Ω.bar.Nonempty then α_pt '' S₀.Ω.bar + else {(IsOArc.nonempty (hArr.natural_order S₀ h).1).some} + else {p_S} + +private theorem disc_boundary_drawing_exists + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {α : Type v} + {β : Type w} + {H : Drawing S} + {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} + {α_pt : α → S} + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (p_S : S) : + ∀ (S₀ : Society α β), ∃ D : Drawing S, + S₀ ∈ S_seg → D.U = subBd (α_disc S₀) ∧ + D.V = arrangement_boundary_vertices hArr p_S S₀ := by + classical + let V_J := arrangement_boundary_vertices hArr p_S + intro S₀ + by_cases hS₀ : S₀ ∈ S_seg + · have hO₀ : IsOArc (subBd (α_disc S₀)) := (hArr.natural_order S₀ hS₀).1 + have hfin : (V_J S₀).Finite := by + by_cases hne : S₀.Ω.bar.Nonempty + · simp only [V_J, arrangement_boundary_vertices, hS₀, hne, ↓reduceDIte, ↓reduceIte] + exact S₀.Ω.finite_bar.image α_pt + · simp only [V_J, arrangement_boundary_vertices, hS₀, hne, ↓reduceDIte, ↓reduceIte] + exact finite_singleton _ + have hne_V : (V_J S₀).Nonempty := by + by_cases hne : S₀.Ω.bar.Nonempty + · simp only [V_J, arrangement_boundary_vertices, hS₀, hne, ↓reduceDIte, ↓reduceIte] + exact hne.image α_pt + · simp only [V_J, arrangement_boundary_vertices, hS₀, hne, ↓reduceDIte, ↓reduceIte] + exact singleton_nonempty _ + have hsub_V : V_J S₀ ⊆ subBd (α_disc S₀) := by + by_cases hne : S₀.Ω.bar.Nonempty + · simp only [V_J, arrangement_boundary_vertices, hS₀, hne, ↓reduceDIte, ↓reduceIte] + rintro _ ⟨v, hv, rfl⟩ + exact (hArr.isClosedDisc S₀ hS₀).2 v hv + · simp only [V_J, arrangement_boundary_vertices, hS₀, hne, ↓reduceDIte, ↓reduceIte, + singleton_subset_iff] + exact (IsOArc.nonempty hO₀).some_mem + obtain ⟨D, hDU, hDV⟩ := exists_drawing_on_oArc hO₀ hfin hne_V hsub_V + exact ⟨D, fun _ => ⟨hDU, hDV⟩⟩ + · exact ⟨H, fun h => absurd h hS₀⟩ + +private theorem push_finite_boundary_edges + {S : Type u} + [TopologicalSpace S] + [T2Space S] + (hS : IsClosedSurface S) + {α : Type v} + {β : Type w} + {G : Graph α β} + {H : Drawing S} + {C₁ : Drawing S} + {C₂ : Drawing S} + {η : SpanEmbedding H G} + {Δ₁ : Set S} + {Δ₂ : Set S} + {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} + {α_pt : α → S} + (hΔ₁ : IsClosedDisc Δ₁) + (hΔ₂ : IsClosedDisc Δ₂) + (hC₁s : C₁.IsSubdrawing H) + (hbd₁ : subBd Δ₁ = C₁.U) + (hC₂s : C₂.IsSubdrawing H) + (hbd₂ : subBd Δ₂ = C₂.U) + (hSeg : IsThreeSegregation G S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G H η S_seg α_disc α_pt) + (V_J : Society α β → Set S) + (D_J : Society α β → Drawing S) + (hDJ : ∀ S₀ ∈ S_seg, (D_J S₀).U = subBd (α_disc S₀) ∧ (D_J S₀).V = V_J S₀) + (J : Drawing S) + (hJV : J.V = ⋃ S₀ ∈ S_seg, (D_J S₀).V) + (hJE : J.E = ⋃ S₀ ∈ S_seg, (D_J S₀).E) + (C : Drawing S) + (Λ : Set S) + (hCJ : C.IsSubdrawing J) + (hCU : C.U ⊆ Δ₁) + (hdiffΛ : closure Λ \ C.U = Λ) + (hZΛ : Δ₂ \ subBd Δ₂ ⊆ Λ) + (hline : ∀ e ∈ C.E, ∀ S₀ ∈ S_seg, e ∈ (D_J S₀).E → ∃ a b, a ≠ b ∧ closure e ∩ (D_J S₀).V = {a, + b} ∧ IsLineWithEnds (closure e) a b ∧ (D_J S₀).V = α_pt '' S₀.Ω.bar) : + ∀ (s : Finset (Set S)), ↑s ⊆ C.E → ∃ Ψ : S ≃ₜ S, + (∀ x ∈ Δ₂ ∪ univ \ (Δ₁ \ subBd Δ₁) ∪ J.V, Ψ x = x) ∧ + (∀ e ∈ C.E \ ↑s, ∀ x ∈ closure e, Ψ x = x) ∧ ∀ e ∈ s, ∀ S₁ ∈ S_seg, ⇑Ψ '' closure e ∩ α_disc + S₁ ⊆ α_pt '' S₁.Ω.bar := by + intro s + induction s using Finset.induction_on with + | empty => + intro _ + refine ⟨Homeomorph.refl S, fun _ _ => rfl, fun _ _ _ _ => rfl, + fun _ h => False.elim (by simp at h)⟩ + | @insert e₀ s he₀_not ih => + intro hs_sub + have he₀C : e₀ ∈ C.E := hs_sub (Finset.mem_insert_self e₀ s) + have hs_sub' : (s : Set (Set S)) ⊆ C.E := + fun e he => hs_sub (Finset.mem_insert_of_mem he) + obtain ⟨Ψ₀, hΨ₀_fix, hΨ₀_unpushed, hΨ₀_pushed⟩ := ih hs_sub' + have he₀_unpushed : ∀ x ∈ closure e₀, Ψ₀ x = x := + hΨ₀_unpushed e₀ ⟨he₀C, he₀_not⟩ + have he₀_img : Ψ₀ '' (closure e₀) = closure e₀ := by + ext x + exact ⟨fun ⟨y, hy, hyx⟩ => hyx ▸ (he₀_unpushed y hy).symm ▸ hy, + fun hx => ⟨x, hx, he₀_unpushed x hx⟩⟩ + have he₀J : e₀ ∈ J.E := hCJ.2 he₀C + rw [hJE] at he₀J + obtain ⟨S₀, hS₀, he₀_D₀⟩ := mem_iUnion₂.mp he₀J + obtain ⟨a, b, hab, hV_ab, hL, hDV_eq⟩ := hline e₀ he₀C S₀ hS₀ he₀_D₀ + have hD₀_disc : IsClosedDisc (α_disc S₀) := (hArr.isClosedDisc S₀ hS₀).1 + have hL_bd₀ : closure e₀ ⊆ subBd (α_disc S₀) := + (hDJ S₀ hS₀).1 ▸ (D_J S₀).closure_subset_U he₀_D₀ + let Y : Set S := + Δ₂ ∪ (univ \ (Δ₁ \ subBd Δ₁)) ∪ J.V ∪ + (⋃ S₁ ∈ S_seg \ {S₀}, α_disc S₁) ∪ + (⋃ e ∈ C.E \ {e₀}, Ψ₀ '' (closure e)) + have hY_closed : IsClosed Y := by + refine ((((hΔ₂.isClosed.union ?_).union J.finite_V.isClosed).union ?_).union ?_) + · exact isClosed_univ.sdiff (IsClosedDisc.isOpenDisc_diff_subBd hS hΔ₁).1.1 + · exact (hSeg.1.finite.subset sdiff_subset).isClosed_biUnion fun S₁ hS₁ => + (hArr.isClosedDisc S₁ hS₁.1).1.isClosed + · exact (C.finite_edges.subset sdiff_subset).isClosed_biUnion fun e _ => + Ψ₀.isClosed_image.mpr isClosed_closure + have ha_JV : a ∈ J.V := by + rw [hJV] + have ha_V₀ : a ∈ (D_J S₀).V := by + have : a ∈ closure e₀ ∩ (D_J S₀).V := by rw [hV_ab]; exact mem_insert a {b} + exact this.2 + exact mem_iUnion₂.mpr ⟨S₀, hS₀, ha_V₀⟩ + have hb_JV : b ∈ J.V := by + rw [hJV] + have hb_V₀ : b ∈ (D_J S₀).V := by + have : b ∈ closure e₀ ∩ (D_J S₀).V := by rw [hV_ab]; exact mem_insert_of_mem a rfl + exact this.2 + exact mem_iUnion₂.mpr ⟨S₀, hS₀, hb_V₀⟩ + have haY : a ∈ Y := Or.inl (Or.inl (Or.inr ha_JV)) + have hbY : b ∈ Y := Or.inl (Or.inl (Or.inr hb_JV)) + have hHU_inter : H.U ∩ closure e₀ ⊆ {a, b} := by + rintro x ⟨hxH, hxe₀⟩ + have hx_bd : x ∈ H.U ∩ subBd (α_disc S₀) := ⟨hxH, hL_bd₀ hxe₀⟩ + rw [hComp.bd_inter_eq S₀ hS₀] at hx_bd + have hx_pt : α_pt (η.vMap x) = x := + hComp.pt_eq x hx_bd.1 (subset_biUnion_of_mem (u := fun S₁ : Society α β + => S₁.Ω.bar) hS₀ hx_bd.2) + have hx_V₀ : x ∈ (D_J S₀).V := by + rw [hDV_eq] + exact ⟨η.vMap x, hx_bd.2, hx_pt⟩ + rw [← hV_ab] + exact ⟨hxe₀, hx_V₀⟩ + have hJV_inter : J.V ∩ closure e₀ ⊆ {a, b} := by + rintro x ⟨hxJV, hxe₀⟩ + rw [hJV] at hxJV + obtain ⟨S₁, hS₁, hxV₁⟩ := mem_iUnion₂.mp hxJV + by_cases h_eq : S₁ = S₀ + · subst h_eq + rw [← hV_ab] + exact ⟨hxe₀, hxV₁⟩ + · have hx_D₁ : x ∈ α_disc S₁ := + (hArr.isClosedDisc S₁ hS₁).1.isClosed.closure_eq ▸ + ((hDJ S₁ hS₁).1 ▸ (D_J S₁).V_subset_U hxV₁).1 + have hx_D₀ : x ∈ α_disc S₀ := + hD₀_disc.isClosed.closure_eq ▸ (hL_bd₀ hxe₀).1 + obtain ⟨v, ⟨_, hv₀⟩, rfl⟩ := hArr.inter_discs S₁ hS₁ S₀ hS₀ h_eq ⟨hx_D₁, hx_D₀⟩ + have hx_V₀ : α_pt v ∈ (D_J S₀).V := by + rw [hDV_eq] + exact ⟨v, hv₀, rfl⟩ + rw [← hV_ab] + exact ⟨hxe₀, hx_V₀⟩ + have hYL : Y ∩ closure e₀ ⊆ {a, b} := by + rintro x ⟨hxY, hxe₀⟩ + have hx_CU : x ∈ C.U := C.closure_subset_U he₀C hxe₀ + rcases hxY with (((hxΔ₂ | hx_out₁) | hxJV) | hxS₁) | hxe + · have hx_not_int₂ : x ∉ Δ₂ \ subBd Δ₂ := by + intro hx_int₂ + have hx_Λ : x ∈ Λ := hZΛ hx_int₂ + rw [← hdiffΛ] at hx_Λ + exact hx_Λ.2 hx_CU + have hx_bd₂ : x ∈ subBd Δ₂ := by_contra fun hn => hx_not_int₂ ⟨hxΔ₂, hn⟩ + exact hHU_inter ⟨hC₂s.U_subset (hbd₂ ▸ hx_bd₂), hxe₀⟩ + · have hx_Δ₁ : x ∈ Δ₁ := hCU hx_CU + have hx_bd₁ : x ∈ subBd Δ₁ := by_contra fun hn => hx_out₁.2 ⟨hx_Δ₁, hn⟩ + exact hHU_inter ⟨hC₁s.U_subset (hbd₁ ▸ hx_bd₁), hxe₀⟩ + · exact hJV_inter ⟨hxJV, hxe₀⟩ + · obtain ⟨S₁, ⟨hS₁, hne⟩, hxD₁⟩ := mem_iUnion₂.mp hxS₁ + have hx_D₀ : x ∈ α_disc S₀ := hD₀_disc.isClosed.closure_eq ▸ (hL_bd₀ hxe₀).1 + obtain ⟨v, ⟨_, hv₀⟩, rfl⟩ := hArr.inter_discs S₁ hS₁ S₀ hS₀ hne ⟨hxD₁, hx_D₀⟩ + rw [← hV_ab, hDV_eq] + exact ⟨hxe₀, ⟨v, hv₀, rfl⟩⟩ + · obtain ⟨e, ⟨heC, hne⟩, hx_img⟩ := mem_iUnion₂.mp hxe + by_cases hes : e ∈ s + · have hx_bar : x ∈ α_pt '' S₀.Ω.bar := + hΨ₀_pushed e hes S₀ hS₀ ⟨hx_img, hD₀_disc.isClosed.closure_eq ▸ (hL_bd₀ hxe₀).1⟩ + rw [← hV_ab, hDV_eq] + exact ⟨hxe₀, hx_bar⟩ + · have hx_cl_e : x ∈ closure e := by + obtain ⟨y, hy, rfl⟩ := hx_img + rwa [hΨ₀_unpushed e ⟨heC, hes⟩ y hy] + have hx_JV : x ∈ J.V := by + by_contra hx_not_V + have hxe' : x ∈ e := J.closure_diff_V (hCJ.2 heC) ▸ ⟨hx_cl_e, hx_not_V⟩ + have hxe₀' : x ∈ e₀ := J.closure_diff_V (hCJ.2 he₀C) ▸ ⟨hxe₀, hx_not_V⟩ + exact hne (J.edge_eq_of_mem (hCJ.2 heC) (hCJ.2 he₀C) hxe' hxe₀') + exact hJV_inter ⟨hx_JV, hxe₀⟩ + obtain ⟨h, hh_fix, hh_push⟩ := + push_arc hS hD₀_disc hL hL_bd₀ hY_closed haY hbY hYL + refine ⟨Ψ₀.trans h, ?_, ?_, ?_⟩ + · intro x hx + change h (Ψ₀ x) = x + rw [hΨ₀_fix x hx] + exact hh_fix x (Or.inl (Or.inl hx)) + · intro e he x hx + change h (Ψ₀ x) = x + have he_not_s : e ∉ s := fun hes => he.2 (Finset.mem_insert_of_mem hes) + have he_ne : e ≠ e₀ := fun h_eq => he.2 (h_eq ▸ Finset.mem_insert_self e₀ s) + have hΨ₀x : Ψ₀ x = x := hΨ₀_unpushed e ⟨he.1, he_not_s⟩ x hx + rw [hΨ₀x] + refine hh_fix x (Or.inr (mem_iUnion₂.mpr ⟨e, ⟨he.1, he_ne⟩, ⟨x, hx, hΨ₀x⟩⟩)) + · intro e he S₁ hS₁ + rcases Finset.mem_insert.mp he with he_eq | hes + · subst he_eq + have himg_eq : (Ψ₀.trans h) '' (closure e) = h '' (closure e) := by + change (h ∘ Ψ₀) '' (closure e) = _ + rw [image_comp, he₀_img] + rw [himg_eq] + by_cases hS_eq : S₁ = S₀ + · subst hS_eq + refine hh_push.trans ?_ + rw [← hDV_eq, ← hV_ab] + exact inter_subset_right + · rintro x ⟨⟨y, hy, rfl⟩, hxD₁⟩ + have hy_Y : h y ∈ Y := + Or.inl (Or.inr (mem_iUnion₂.mpr ⟨S₁, ⟨hS₁, hS_eq⟩, hxD₁⟩)) + have hhy : h (h y) = h y := hh_fix (h y) hy_Y + have hy_eq : h y = y := h.injective hhy + rw [hy_eq] at hxD₁ ⊢ + have hyD₀ : y ∈ α_disc S₀ := hD₀_disc.isClosed.closure_eq ▸ (hL_bd₀ hy).1 + obtain ⟨v, ⟨_, hv₁⟩, rfl⟩ := + hArr.inter_discs S₀ hS₀ S₁ hS₁ (Ne.symm hS_eq) ⟨hyD₀, hxD₁⟩ + exact ⟨v, hv₁, rfl⟩ + · have he_ne : e ≠ e₀ := fun h_eq => he₀_not (h_eq ▸ hes) + have himg_eq : (Ψ₀.trans h) '' (closure e) = Ψ₀ '' (closure e) := by + change (h ∘ Ψ₀) '' (closure e) = _ + rw [image_comp] + ext x + exact ⟨fun ⟨y, hy, hyx⟩ => + hyx ▸ (hh_fix y (Or.inr (mem_iUnion₂.mpr ⟨e, ⟨hs_sub' hes, he_ne⟩, hy⟩))).symm ▸ hy, + fun hx => ⟨x, hx, hh_fix x (Or.inr (mem_iUnion₂.mpr ⟨e, ⟨hs_sub' hes, he_ne⟩, hx⟩))⟩⟩ + rw [himg_eq] + exact hΨ₀_pushed e hes S₁ hS₁ + +private theorem proper_arrangement_boundary_edge_is_arc + {S : Type u} + [TopologicalSpace S] + [T2Space S] + (hS : IsClosedSurface S) + [hConn : ConnectedSpace S] + {α : Type v} + {β : Type w} + {G : Graph α β} + {H : Drawing S} + {C₁ : Drawing S} + {C₂ : Drawing S} + {η : SpanEmbedding H G} + {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {z : Set S} + {Δ₁ : Set S} + {Δ₂ : Set S} + {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} + {α_pt : α → S} + (hθ : 6 ≤ θ) + (hd : HasTangleMetric H θ T d) + (hz : z ∈ H.A) + (hΔ₁ : IsClosedDisc Δ₁) + (hΔ₂ : IsClosedDisc Δ₂) + (hz_sub : z ⊆ Δ₂ \ subBd Δ₂) + (hΔ₂_sub₁ : Δ₂ ⊆ Δ₁ \ subBd Δ₁) + (hii : ∀ x ∈ H.A, x ⊆ Δ₁ → d z x ≤ θ - 4) + (hiii : ∀ x ∈ H.A, d z x ≤ 3 → x ⊆ Δ₂ \ subBd Δ₂) + (hC₁ : C₁.IsCircuit) + (hC₁s : C₁.IsSubdrawing H) + (hbd₁ : subBd Δ₁ = C₁.U) + (hC₂ : C₂.IsCircuit) + (hC₂s : C₂.IsSubdrawing H) + (hbd₂ : subBd Δ₂ = C₂.U) + (hSeg : IsThreeSegregation G S_seg) + (hLoc : IsTangleLocal G H η T S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G H η S_seg α_disc α_pt) + (p_S : S) + (hVJ_sub_bar : ∀ S₀ ∈ S_seg, α_pt '' S₀.Ω.bar ⊆ arrangement_boundary_vertices hArr p_S S₀) + (D_J : Society α β → Drawing S) + (hDJ : ∀ S₀ ∈ S_seg, + (D_J S₀).U = subBd (α_disc S₀) ∧ (D_J S₀).V = arrangement_boundary_vertices hArr p_S S₀) + (J : Drawing S) + (hJU : J.U = ⋃ S₀ ∈ S_seg, subBd (α_disc S₀)) + (C : Drawing S) + (Λ : Set S) + (hOpenΛ : IsOpenDisc Λ) + (hclΛ_sub : closure Λ ⊆ Δ₁) + (hclΛ_disc : IsClosedDisc (closure Λ)) + (hbd_clΛ : subBd (closure Λ) = C.U) + (hdiffΛ : closure Λ \ C.U = Λ) + (hZΛ : Δ₂ \ subBd Δ₂ ⊆ Λ) : + ∀ e ∈ C.E, ∀ S₀ ∈ S_seg, e ∈ (D_J S₀).E → ∃ a b, a ≠ b ∧ closure e ∩ (D_J S₀).V = {a, b} ∧ + IsLineWithEnds (closure e) a b ∧ (D_J S₀).V = α_pt '' S₀.Ω.bar := by + classical + intro e heC S₀ hS₀ heD₀ + obtain ⟨a, b, hab, hV_ab, hL⟩ := + circuit_edge_isLineWithEnds hS hConn hθ hd hz hΔ₁ hΔ₂ hz_sub hΔ₂_sub₁ + hii hiii hC₁ hC₁s hbd₁ hC₂ hC₂s hbd₂ hSeg hLoc hArr hComp hJU hOpenΛ hclΛ_sub hclΛ_disc + hbd_clΛ hdiffΛ hZΛ hS₀ (hDJ S₀ hS₀).1 ((hDJ S₀ hS₀).2 ▸ hVJ_sub_bar S₀ hS₀) heC heD₀ + refine ⟨a, b, hab, hV_ab, hL, ?_⟩ + rw [(hDJ S₀ hS₀).2] + have hne_bar : S₀.Ω.bar.Nonempty := by + by_contra hnot + have hV_sing : arrangement_boundary_vertices hArr p_S S₀ = + {(IsOArc.nonempty (hArr.natural_order S₀ hS₀).1).some} := by + simp [arrangement_boundary_vertices, hS₀, hnot] + have ha_mem : a ∈ arrangement_boundary_vertices hArr p_S S₀ := by + rw [← (hDJ S₀ hS₀).2] + have : a ∈ closure e ∩ (D_J S₀).V := by rw [hV_ab]; exact mem_insert a {b} + exact this.2 + have hb_mem : b ∈ arrangement_boundary_vertices hArr p_S S₀ := by + rw [← (hDJ S₀ hS₀).2] + have : b ∈ closure e ∩ (D_J S₀).V := by rw [hV_ab]; exact mem_insert_of_mem a rfl + exact this.2 + rw [hV_sing, mem_singleton_iff] at ha_mem hb_mem + exact hab (ha_mem.trans hb_mem.symm) + simp [arrangement_boundary_vertices, hS₀, hne_bar] + +/-- Graph Minors XIV, (7.7) (pages 37–38): +"Let $H$ be a 2-cell drawing in $\Sigma$, and let $\mathscr{T}$ be a respectful tangle in $H$ +of order $\theta \ge 6$. Let $z \in A(H)$, let $C_1$, $C_2$ be disjoint circuits of $H$, and +let $U(C_1)$, $U(C_2)$ bound closed discs $\Delta_1$, $\Delta_2 \subseteq \Sigma$ with the +following properties:* (i) $z \subseteq \Delta_2 - bd(\Delta_2)$, and $\Delta_2 \subseteq +\Delta_1 - bd(\Delta_1)$ (ii) $d(z, x) \le \theta - 4$ for all $x \in A(H)$ with $x +\subseteq \Delta_1$ (iii) $x \subseteq \Delta_2 - bd(\Delta_2)$ for all $x \in A(H)$ with +$d(z, x) \le 3$. *Let $H$ be a subgraph of $G$, let $\mathscr{S}$ be a $\mathscr{T}$-local +3-segregation of $G$, and let $\alpha$ be an arrangement of $\mathscr{S}$ in $\Sigma$ +compatible with $H$. Then there is an $\alpha$-normal $O$-arc $F \subseteq \Delta_1$, +bounding a closed disc in $\Delta_1$ including $\Delta_2$." -/ +theorem theorem_7_7_proof + [T2Space S] (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {α : Type v} {β : Type w} + {G : Graph α β} {H C₁ C₂ : Drawing S} {η : SpanEmbedding H G} + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z Δ₁ Δ₂ : Set S} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + (hθ : 6 ≤ θ) (hd : HasTangleMetric H θ T d) + (hz : z ∈ H.A) (hΔ₁ : IsClosedDisc Δ₁) (hΔ₂ : IsClosedDisc Δ₂) + (hz_sub : z ⊆ Δ₂ \ subBd Δ₂) (hΔ₂_sub₁ : Δ₂ ⊆ Δ₁ \ subBd Δ₁) + (hii : ∀ x ∈ H.A, x ⊆ Δ₁ → d z x ≤ θ - 4) + (hiii : ∀ x ∈ H.A, d z x ≤ 3 → x ⊆ Δ₂ \ subBd Δ₂) + (hC₁ : C₁.IsCircuit) (hC₁s : C₁.IsSubdrawing H) (hbd₁ : subBd Δ₁ = C₁.U) + (hC₂ : C₂.IsCircuit) (hC₂s : C₂.IsSubdrawing H) (hbd₂ : subBd Δ₂ = C₂.U) + (hdisj : Disjoint C₁.V C₂.V) + (hSeg : IsThreeSegregation G S_seg) (hLoc : IsTangleLocal G H η T S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G H η S_seg α_disc α_pt) : + ∃ F Δ : Set S, + IsOArc F ∧ F ⊆ Δ₁ ∧ IsArrangementNormal S_seg α_disc α_pt F ∧ + IsClosedDisc Δ ∧ subBd Δ = F ∧ Δ ⊆ Δ₁ ∧ Δ₂ ⊆ Δ := by + classical + have : ConnectedSpace S := hConn + obtain ⟨p_S⟩ : Nonempty S := inferInstance + let V_J := arrangement_boundary_vertices hArr p_S + have hVJ_sub_bar : ∀ S₀ ∈ S_seg, α_pt '' S₀.Ω.bar ⊆ V_J S₀ := by + intro S₀ hS₀ + by_cases hne : S₀.Ω.bar.Nonempty + · simp [V_J, arrangement_boundary_vertices, hS₀, hne] + · rw [not_nonempty_iff_eq_empty.mp hne, image_empty] + exact empty_subset _ + have hDJ_exists : ∀ S₀ : Society α β, ∃ D : Drawing S, + (S₀ ∈ S_seg → D.U = subBd (α_disc S₀) ∧ D.V = V_J S₀) := by + exact disc_boundary_drawing_exists (S := S) (α := α) (β := β) (H := H) (S_seg := S_seg) + (α_disc := α_disc) (α_pt := α_pt) hArr p_S + choose D_J hDJ using hDJ_exists + let s_seg : Finset (Society α β) := hSeg.1.finite.toFinset + have hs_seg : ∀ S₀, S₀ ∈ s_seg ↔ S₀ ∈ S_seg := fun S₀ => Finite.mem_toFinset _ + have hmeet : ∀ S₁ ∈ s_seg, ∀ S₂ ∈ s_seg, S₁ ≠ S₂ → + (D_J S₁).U ∩ (D_J S₂).U ⊆ (D_J S₁).V ∩ (D_J S₂).V := by + intro S₁ hS₁ S₂ hS₂ hne x ⟨hx₁, hx₂⟩ + have hS₁' : S₁ ∈ S_seg := (hs_seg S₁).mp hS₁ + have hS₂' : S₂ ∈ S_seg := (hs_seg S₂).mp hS₂ + rw [(hDJ S₁ hS₁').1] at hx₁ + rw [(hDJ S₂ hS₂').1] at hx₂ + have hx_inter : x ∈ α_disc S₁ ∩ α_disc S₂ := + ⟨(hArr.isClosedDisc S₁ hS₁').1.isClosed.closure_eq ▸ hx₁.1, + (hArr.isClosedDisc S₂ hS₂').1.isClosed.closure_eq ▸ hx₂.1⟩ + obtain ⟨v, ⟨hv₁, hv₂⟩, rfl⟩ := hArr.inter_discs S₁ hS₁' S₂ hS₂' hne hx_inter + rw [(hDJ S₁ hS₁').2, (hDJ S₂ hS₂').2] + exact ⟨hVJ_sub_bar S₁ hS₁' ⟨v, hv₁, rfl⟩, hVJ_sub_bar S₂ hS₂' ⟨v, hv₂, rfl⟩⟩ + obtain ⟨J, hJU_fin, hJV_fin, hJE_fin⟩ := exists_glued_drawing s_seg D_J hmeet + have hJU : J.U = ⋃ S₀ ∈ S_seg, subBd (α_disc S₀) := by + rw [hJU_fin] + ext x + simp only [mem_iUnion, hs_seg] + exact ⟨fun ⟨S₀, hS₀, hx⟩ => ⟨S₀, hS₀, (hDJ S₀ hS₀).1 ▸ hx⟩, + fun ⟨S₀, hS₀, hx⟩ => ⟨S₀, hS₀, (hDJ S₀ hS₀).1.symm ▸ hx⟩⟩ + have hJV : J.V = ⋃ S₀ ∈ S_seg, (D_J S₀).V := by + rw [hJV_fin] + ext x + simp only [mem_iUnion, hs_seg] + have hJE : J.E = ⋃ S₀ ∈ S_seg, (D_J S₀).E := by + rw [hJE_fin] + ext e + simp only [mem_iUnion, hs_seg] + obtain ⟨hOD₂, hcl₂, _⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hΔ₂ + have hZne : (Δ₂ \ subBd Δ₂).Nonempty := IsOpenDisc.nonempty hOD₂ + have hZconn : IsPreconnected (Δ₂ \ subBd Δ₂) := hOD₂.isPathConnected.isConnected.isPreconnected + have hClaim1 : ∀ r ∈ J.R, (closure r ∩ (Δ₂ \ subBd Δ₂)).Nonempty → r ⊆ Δ₁ \ subBd Δ₁ := + fun r hr hinter => lemma_7_7_claim_1 hS hConn hθ hd hz hΔ₁ hΔ₂ hz_sub hΔ₂_sub₁ + hii hiii hC₁ hC₁s hbd₁ hC₂ hC₂s hbd₂ hdisj hSeg hLoc hArr hComp hJU hr hinter + obtain ⟨C, Λ, hCJ, hC, hCU, hOpenΛ, hclΛ_sub, hclΛ_disc, _, hbd_clΛ, hdiffΛ, hZΛ, _⟩ := + theorem_5_2_full hS J hΔ₁ hZne hZconn hClaim1 + have hline : ∀ e ∈ C.E, ∀ S₀ ∈ S_seg, e ∈ (D_J S₀).E → + ∃ a b : S, a ≠ b ∧ closure e ∩ (D_J S₀).V = {a, b} ∧ IsLineWithEnds (closure e) a b ∧ + (D_J S₀).V = α_pt '' S₀.Ω.bar := by + exact proper_arrangement_boundary_edge_is_arc (S := S) hS (α := α) (β := β) (G := G) (H := H) + (C₁ := C₁) (C₂ := C₂) (η := η) (θ := θ) (T := T) (d := d) (z := z) (Δ₁ := Δ₁) (Δ₂ := Δ₂) + (S_seg := S_seg) (α_disc := α_disc) (α_pt := α_pt) hθ hd hz hΔ₁ hΔ₂ hz_sub hΔ₂_sub₁ hii hiii + hC₁ hC₁s hbd₁ hC₂ hC₂s hbd₂ hSeg hLoc hArr hComp p_S hVJ_sub_bar D_J hDJ J hJU C Λ + hOpenΛ hclΛ_sub hclΛ_disc hbd_clΛ hdiffΛ hZΛ + have hpush_ind : ∀ (s : Finset (Set S)), (s : Set (Set S)) ⊆ C.E → + ∃ Ψ : S ≃ₜ S, + (∀ x ∈ Δ₂ ∪ (univ \ (Δ₁ \ subBd Δ₁)) ∪ J.V, Ψ x = x) ∧ + (∀ e ∈ C.E \ (s : Set (Set S)), ∀ x ∈ closure e, Ψ x = x) ∧ + (∀ e ∈ s, ∀ S₁ ∈ S_seg, Ψ '' (closure e) ∩ α_disc S₁ ⊆ α_pt '' S₁.Ω.bar) := by + exact push_finite_boundary_edges (S := S) hS (α := α) (β := β) (G := G) (H := H) (C₁ := C₁) + (C₂ := C₂) (η := η) (Δ₁ := Δ₁) (Δ₂ := Δ₂) (S_seg := S_seg) (α_disc := α_disc) (α_pt := α_pt) + hΔ₁ hΔ₂ hC₁s hbd₁ hC₂s hbd₂ hSeg hArr hComp V_J D_J hDJ J hJV hJE C Λ hCJ hCU hdiffΛ hZΛ + hline + let s_all : Finset (Set S) := C.finite_edges.toFinset + have hs_all : (s_all : Set (Set S)) ⊆ C.E := by + intro e he + exact (Finite.mem_toFinset _).mp he + obtain ⟨Ψ, hΨ_fix, _, hΨ_pushed⟩ := hpush_ind s_all hs_all + refine ⟨Ψ '' C.U, Ψ '' (closure Λ), ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · exact (isOArc_of_isCircuit hC).image Ψ.continuous.continuousOn + Ψ.symm.continuous.continuousOn (fun x _ => Ψ.symm_apply_apply x) + · rintro _ ⟨x, hx, rfl⟩ + by_contra hx_not₁ + have hΨx_out : Ψ x ∈ univ \ (Δ₁ \ subBd Δ₁) := ⟨mem_univ _, fun h => hx_not₁ h.1⟩ + have hΨΨx : Ψ (Ψ x) = Ψ x := hΨ_fix (Ψ x) (Or.inl (Or.inr hΨx_out)) + have hx_eq : Ψ x = x := Ψ.injective hΨΨx + exact hx_not₁ (hx_eq.symm ▸ hCU hx) + · rintro S₁ hS₁ _ ⟨⟨x, hxCU, rfl⟩, hyD₁⟩ + obtain ⟨e, heC, hx_cl⟩ := exists_edge_closure_of_mem_circuit_U hC hxCU + have hes : e ∈ s_all := (Finite.mem_toFinset _).mpr heC + exact hΨ_pushed e hes S₁ hS₁ ⟨⟨x, hx_cl, rfl⟩, hyD₁⟩ + · exact (hclΛ_disc.image Ψ.continuous.continuousOn + Ψ.symm.continuous.continuousOn (fun x _ => Ψ.symm_apply_apply x)).1 + · rw [← subBd_eq_frontier', ← Ψ.image_frontier, subBd_eq_frontier', hbd_clΛ] + · rintro _ ⟨x, hx, rfl⟩ + by_contra hx_not₁ + have hΨx_out : Ψ x ∈ univ \ (Δ₁ \ subBd Δ₁) := ⟨mem_univ _, fun h => hx_not₁ h.1⟩ + have hΨΨx : Ψ (Ψ x) = Ψ x := hΨ_fix (Ψ x) (Or.inl (Or.inr hΨx_out)) + have hx_eq : Ψ x = x := Ψ.injective hΨΨx + exact hx_not₁ (hx_eq.symm ▸ hclΛ_sub hx) + · have hΔ₂_sub_clΛ : Δ₂ ⊆ closure Λ := + hcl₂ ▸ isClosed_closure.closure_subset_iff.mpr (hZΛ.trans subset_closure) + intro x hx + exact ⟨x, hΔ₂_sub_clΛ hx, hΨ_fix x (Or.inl (Or.inl hx))⟩ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section7a.lean b/LeanPool/GraphMinor/GM14/Section7a.lean new file mode 100644 index 0000000000..39de23a6cd --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section7a.lean @@ -0,0 +1,933 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.RadialAtoms +import LeanPool.GraphMinor.GM12.Section1b +import LeanPool.GraphMinor.GM12.Section4WalkMetric + +public import LeanPool.GraphMinor.GM14.Section3 +public import LeanPool.GraphMinor.GM14.DiscSlope +public import LeanPool.GraphMinor.GM15.Cited +public import LeanPool.GraphMinor.GM16.Cited +public import LeanPool.GraphMinor.GM19.Cited +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM11.PaintingFacts +import LeanPool.GraphMinor.GM11.RadialFacts +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.Section91 +import LeanPool.GraphMinor.GM11.Theorem63 +import LeanPool.GraphMinor.Surface.Circle + +/-! +# Graph Minors XIV, Section 7 (Part 1): (7.1)–(7.6) + +This file formalizes the first six results of Section 7 (*Distance and Freedom*, pages 35–37) of +N. Robertson and P. D. Seymour, *Graph Minors. XIV. Extending an embedding*, +J. Combin. Theory Ser. B **65** (1995) 23–50: + +- `theorem_7_1`: Graph Minors XIV, (7.1) (page 35), showing that for a 2-cell drawing `H` with + `|E(H)| ≥ 2` and a respectful tangle `T` of order `θ ≥ 1` with metric `d`, for every `z ∈ A(H)` + there exists `e ∈ E(H)` with `d(z, e) = θ`. Deduced from Graph Minors XI, (8.12) and (8.5). +- `theorem_7_2`: Graph Minors XIV, (7.2) (page 36), showing that for `(A, B) ∈ T` and `e ∈ E(A)`, + there is a circuit `D` of a radial drawing `K` of `H` with `V(D) ∩ V(H) ⊆ V(A ∩ B)` and + `e ⊆ ins(D)`. Deduced from Graph Minors XI, (6.3) (`GM11.theorem_6_3_proof`). +- `theorem_7_3`: Graph Minors XIV, (7.3) (page 36), proving `GM15.GM14Theorem73Statement`. +- `theorem_7_4`: Graph Minors XIV, (7.4) (page 36), showing that a circuit `C` of `A` with + `|V(B ∩ C)| ≤ 1` has `U(C) ⊆ ins(D)` for some circuit `D` of `K` with `V(D) ∩ V(H) ⊆ V(A ∩ B)`. +- `theorem_7_5`: Graph Minors XIV, (7.5) (page 36), proving `GM16.GM14Theorem75Statement`. +- `theorem_7_6`: Graph Minors XIV, (7.6) (page 37), showing that if `D` is a circuit of `K` with + `|E(D)| < 2(θ - λ)` and `bd(Λ) ⊆ ins(D)` for a `λ`-zone `Λ`, then `closure Λ ⊆ ins(D)`. +-/ + +public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 Hypergraph + +universe u w + +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +/-! ## Helper lemmas on corresponding atoms and radial walks -/ + +/-- Every tangle is a pretangle. -/ +theorem _root_.GraphMinor.GM10.IsTangle.isPretangle {α β : Type*} {G : Hypergraph α β} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} (hT : IsTangle G θ T) : + IsPretangle G θ T := + ⟨hT.one_le, hT.isSeparation, hT.order_lt, hT.axiom1, hT.axiom2⟩ + +omit [T1Space S] in +/-- An `O`-arc is nonempty. -/ +theorem IsOArc.nonempty {F : Set S} (hF : IsOArc F) : F.Nonempty := by + obtain ⟨φ⟩ := hF + exact ⟨(φ 1).1, (φ 1).2⟩ + +omit [T1Space S] in +/-- An open disc is nonempty. -/ +theorem IsOpenDisc.nonempty {D : Set S} (hD : IsOpenDisc D) : D.Nonempty := by + obtain ⟨φ⟩ := hD.2 + have h0 : (0 : EuclideanPlane) ∈ OpenUnitDisc := by simp [OpenUnitDisc] + exact ⟨(φ ⟨0, h0⟩).1, (φ ⟨0, h0⟩).2⟩ + +omit [T1Space S] in +/-- An `O`-arc is preconnected. -/ +theorem IsOArc.isPreconnected {F : Set S} (hF : IsOArc F) : IsPreconnected F := + GraphMinor.Surface.IsOArc.isPreconnected hF + +omit [T1Space S] in +/-- An `O`-arc minus one of its points is path-connected. -/ +theorem isPathConnected_oArc_diff {F : Set S} (hF : IsOArc F) {u : S} (hu : u ∈ F) : + IsPathConnected (F \ {u}) := + hF.isPathConnected_sdiff_singleton hu + +omit [T1Space S] in +/-- An atom of a drawing is nonempty. -/ +theorem atom_nonempty {Γ : Drawing S} {x : Set S} (hx : x ∈ Γ.A) : x.Nonempty := by + rcases hx with (⟨v, -, rfl⟩ | hx) | hx + · exact singleton_nonempty v + · exact hx.1 + · exact region_nonempty hx + +omit [T1Space S] in +/-- Any two distinct atoms of a drawing are disjoint. -/ +theorem disjoint_of_mem_A_ne {Γ : Drawing S} {x y : Set S} + (hx : x ∈ Γ.A) (hy : y ∈ Γ.A) (hne : x ≠ y) : Disjoint x y := by + rcases hx with (⟨u, hu, rfl⟩ | hxE) | hxR <;> rcases hy with (⟨v, hv, rfl⟩ | hyE) | hyR + · exact disjoint_singleton.mpr fun h => hne (h ▸ rfl) + · exact disjoint_singleton_left.mpr fun h => (hyE.2.1 h).2 hu + · exact disjoint_singleton_left.mpr fun h => region_subset hyR h (Γ.V_subset_U hu) + · exact disjoint_singleton_right.mpr fun h => (hxE.2.1 h).2 hv + · refine disjoint_left.mpr fun p hpx hpy => hne (Γ.edge_eq_of_mem hxE hyE hpx hpy) + · exact disjoint_left.mpr fun p hpx hpy => region_subset hyR hpy (hxE.2.1 hpx).1 + · exact disjoint_singleton_right.mpr fun h => region_subset hxR h (Γ.V_subset_U hv) + · exact disjoint_left.mpr fun p hpx hpy => region_subset hxR hpx (hyE.2.1 hpy).1 + · exact disjoint_left.mpr fun p hpx hpy => hne (region_eq_of_mem hxR hyR hpx hpy) + +omit [T1Space S] in +/-- When `E(H) ≠ ∅`, distinct atoms of `H` have distinct corresponding atoms in `K`. -/ +theorem correspondingAtom_inj [ConnectedSpace S] (hS : IsClosedSurface S) {H K : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) (hE : H.E.Nonempty) + {x y x' : Set S} (hx : IsCorrespondingAtom H K x x') (hy : IsCorrespondingAtom H K y x') : + x = y := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hrf := GM11.regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hE + obtain ⟨hxA, hx'A, hxc⟩ := hx + obtain ⟨hyA, -, hyc⟩ := hy + rcases hxc with ⟨u, hu, rfl, rfl⟩ | ⟨hxE, hxr, hxsub⟩ | ⟨hxR, u, ⟨huK, hux⟩, rfl⟩ <;> + rcases hyc with ⟨v, hv, rfl, hveq⟩ | ⟨hyE, hyr, hysub⟩ | ⟨hyR, v, ⟨hvK, hvy⟩, hveq⟩ + · exact hveq + · exact absurd (K.V_subset_U (hK.2.1.2.1 hu)) (region_subset hyr (mem_singleton u)) + · have huv : v = u := singleton_eq_singleton_iff.mp hveq.symm + subst huv + exact absurd (H.V_subset_U hu) (region_subset hyR hvy) + · exact absurd (K.V_subset_U (hK.2.1.2.1 hv)) (region_subset hxr (hveq ▸ mem_singleton v)) + · exact hrf.2.1 x' hxr x hxE y hyE hxsub hysub + · exact absurd (K.V_subset_U hvK) (region_subset hxr (hveq ▸ mem_singleton v)) + · have huv : v = u := singleton_eq_singleton_iff.mp hveq.symm + subst huv + exact absurd (H.V_subset_U hv) (region_subset hxR hux) + · exact absurd (K.V_subset_U huK) (region_subset hyr (mem_singleton u)) + · have huv : v = u := singleton_eq_singleton_iff.mp hveq.symm + subst huv + exact region_eq_of_mem hxR hyR hux hvy + +omit [T1Space S] in +/-- Every closed walk of a pre-radial drawing `K` of `H` has even length, equal to twice the number +of visits to `V(H)`. -/ +theorem closed_walk_length_eq_two_mul {H K : Drawing S} + (hP : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) {u : S} + (W : GraphWalk K.toGraph u u) : + by classical exact W.length = 2 * (W.support.tail.countP (· ∈ H.V)) := by + exact GM12.closed_walk_length_eq_two_mul hP W + +omit [T1Space S] in +/-- Every circuit `D` of a pre-radial drawing `K` of `H` has length `2 * |V(D) ∩ V(H)|` and +contains a vertex of `H`. -/ +theorem circuit_length_eq_two_mul_ncard {H K D : Drawing S} + (hP : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) + (hD : D.IsCircuit) (hDs : D.IsSubdrawing K) : + D.length = 2 * (D.V ∩ H.V).ncard ∧ (D.V ∩ H.V).Nonempty := by + exact GM12.circuit_length_eq_two_mul_ncard hP hD hDs + +/-- For a closed walk `W` of length `0` in `K`, `insWalk ins K W = {u}`. -/ +theorem insWalk_of_length_zero (ins : Drawing S → Set S) (K : Drawing S) {u : S} + (W : GraphWalk K.toGraph u u) (h0 : W.length = 0) : + insWalk ins K W = {u} := by + cases W with + | nil h => + have hE : (walkDrawing K (GraphWalk.nil h)).E = ∅ := by + rw [walkDrawing_E] + ext e + simp + have hV : (walkDrawing K (GraphWalk.nil h)).V = {u} := by + rw [walkDrawing_V] + ext x + simp + have hU : (walkDrawing K (GraphWalk.nil h)).U = {u} := by + rw [Drawing.U_eq, hV, hE] + simp + have hnoC : {C : Drawing S | C.IsCircuit ∧ + C.IsSubdrawing (walkDrawing K (GraphWalk.nil h))} = ∅ := by + ext C + simp only [mem_ofPred_eq, mem_empty_iff_false, iff_false, not_and] + intro hC hCs + obtain ⟨_, W_C, _, hpos, _, hCE⟩ := hC + cases W_C with + | nil _ => exact Nat.lt_irrefl 0 hpos + | @cons _ _ _ e _ _ => + have heC : e ∈ C.E := by rw [hCE]; exact List.mem_cons_self + have heW := hCs.2 heC + rw [hE] at heW + exact heW + change (walkDrawing K (GraphWalk.nil h)).U ∪ + ⋃ C ∈ {C : Drawing S | C.IsCircuit ∧ + C.IsSubdrawing (walkDrawing K (GraphWalk.nil h))}, ins C = {u} + rw [hU, hnoC] + simp + | cons _ _ => + change (_ + 1 = 0) at h0 + omega + +/-- `insWalk ins K W` is closed when `W.length < 2 * θ` and `ins` is a derived slope. -/ +theorem isClosed_insWalk (hS : IsClosedSurface S) {H K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) {u : S} + (W : GraphWalk K.toGraph u u) (hW : W.length < 2 * θ) : + IsClosed (insWalk ins K W) := by + have : T2Space S := hS.2.1 + set D := walkDrawing K W + have hDs : D.IsSubdrawing K := walkDrawing_isSubdrawing K W + have hfinC : {C : Drawing S | C.IsCircuit ∧ C.IsSubdrawing D}.Finite := by + refine Set.Finite.of_finite_image (f := fun C : Drawing S => (C.V, C.E)) ?_ ?_ + · refine (D.finite_V.finite_subsets.prod D.finite_edges.finite_subsets).subset ?_ + rintro _ ⟨C, ⟨-, hs'⟩, rfl⟩ + exact ⟨hs'.1, hs'.2⟩ + · intro C _ C' _ h + exact Drawing.ext_of_V_E (congrArg Prod.fst h) (congrArg Prod.snd h) + refine D.isClosed_U.union (hfinC.isClosed_biUnion fun C hC => ?_) + have hlen : C.length < 2 * θ := by + refine lt_of_le_of_lt ?_ hW + refine (ncard_le_ncard ?_ (W.edges.finite_toSet)).trans (GM11.ncard_mem_list_le W.edges) + intro e he + have h := hC.2.2 he + rwa [walkDrawing_E] at h + exact (hd C hC.1 (hC.2.trans hDs) hlen).1.isClosed + +/-- If `x, y ∈ A(H)` and there is a closed walk `W` of `K` of length `< 2θ` with `x', y' ⊆ ins(W)`, +then `2 * d(x, y) ≤ W.length`. -/ +theorem two_mul_tangleMetric_le_walk_length {H K : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) {ins : Drawing S → Set S} {θ : ℕ} + {x y x' y' : Set S} (hx : IsCorrespondingAtom H K x x') (hy : IsCorrespondingAtom H K y y') + {u : S} (W : GraphWalk K.toGraph u u) (hW : W.length < 2 * θ) + (hxW : x' ⊆ insWalk ins K W) (hyW : y' ⊆ insWalk ins K W) : + 2 * tangleMetric H K ins θ x y ≤ W.length := by + obtain ⟨k, hk⟩ := GM11.even_length_of_closed hK.2.1 W + have heven : W.length = 2 * k := by omega + have hle := GM11.tangleMetric_le_of_walk W hx hy hW heven hxW hyW + omega + +/-- When `E(H) ≠ ∅`, `1 ≤ θ`, and `x, y ∈ A(H)` with `x ≠ y`, we have `1 ≤ d(x, y)`. -/ +theorem one_le_tangleMetric_of_ne [ConnectedSpace S] (hS : IsClosedSurface S) {H K : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) (hE : H.E.Nonempty) + {ins : Drawing S → Set S} {θ : ℕ} (hθ : 1 ≤ θ) {x y : Set S} + (_hx : x ∈ H.A) (_hy : y ∈ H.A) (hne : x ≠ y) : + 1 ≤ tangleMetric H K ins θ x y := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + rcases GM11.tangleMetric_cases (ins := ins) (θ := θ) hK.2.1 hne with h | ⟨_, hw⟩ + · rw [h] + exact hθ + obtain ⟨u, W, x', y', hx', hy', _, hlen, hxW, hyW⟩ := hw + by_contra hlt + have hW0 : W.length = 0 := by omega + rw [insWalk_of_length_zero ins K W hW0] at hxW hyW + obtain ⟨p, hp⟩ := atom_nonempty hx'.2.1 + obtain ⟨q, hq⟩ := atom_nonempty hy'.2.1 + have hpu : p = u := mem_singleton_iff.mp (hxW hp) + have hqu : q = u := mem_singleton_iff.mp (hyW hq) + have hxy' : x' = y' := by + by_contra hne' + exact disjoint_left.mp (disjoint_of_mem_A_ne hx'.2.1 hy'.2.1 hne') hp + (hpu.trans hqu.symm ▸ hq) + exact hne (correspondingAtom_inj hS hK hE hx' (hxy' ▸ hy')) + +private theorem singleton_subset_insWalk_of_edge_atom (hS : IsClosedSurface S) + {H K : Drawing S} {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + {f f' : Set S} {v u : S} (hf : f ∈ H.E) (hvf : v ∈ closure f) + (hf' : IsCorrespondingAtom H K f f') (W : GraphWalk K.toGraph u u) + (hW : W.length < 2 * θ) (hfW : f' ⊆ insWalk ins K W) : + ({v} : Set S) ⊆ insWalk ins K W := by + have hf_sub : f ⊆ f' := by + rcases hf'.2.2 with ⟨w, hw, hfw, -⟩ | ⟨-, -, hsub⟩ | ⟨hr, -⟩ + · exact absurd hw (hf.2.1 (hfw ▸ mem_singleton w)).2 + · exact hsub + · obtain ⟨p, hp⟩ := hf.1 + exact absurd (hf.2.1 hp).1 (region_subset hr hp) + rw [singleton_subset_iff] + exact (isClosed_insWalk hS hd W hW).closure_subset_iff.mpr (hf_sub.trans hfW) hvf + +/-- If `f ∈ E(H)`, `v ∈ V(H)`, `v ∈ closure f`, and `z ∈ A(H)` with `z ≠ f`, then +`d(z, {v}) ≤ d(z, f)`. -/ +theorem tangleMetric_le_of_vertex_mem_closure_edge (hS : IsClosedSurface S) + {H K : Drawing S} (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + {z f : Set S} {v : S} (hz : z ∈ H.A) (hf : f ∈ H.E) (hv : v ∈ H.V) (hvf : v ∈ closure f) + (hzf : z ≠ f) : + tangleMetric H K ins θ z {v} ≤ tangleMetric H K ins θ z f := by + have : T2Space S := hS.2.1 + have hv_corr : IsCorrespondingAtom H K {v} {v} := + ⟨Or.inl (Or.inl ⟨v, hv, rfl⟩), Or.inl (Or.inl ⟨v, hK.2.1.2.1 hv, rfl⟩), + Or.inl ⟨v, hv, rfl, rfl⟩⟩ + rcases GM11.tangleMetric_cases (ins := ins) (θ := θ) hK.2.1 hzf with h | ⟨_, hw⟩ + · rw [h] + exact GM11.tangleMetric_le_order hK.2.1 z {v} + obtain ⟨u, W, z', f', hz', hf', hW, hlen, hzW, hfW⟩ := hw + exact GM11.tangleMetric_le + ⟨u, W, z', {v}, ⟨hz, hz'.2⟩, hv_corr, hW, hlen, hzW, + singleton_subset_insWalk_of_edge_atom hS hd hf hvf hf' W hW hfW⟩ + +/-- If `v` is an end of the edge `f` and `y ≠ f`, then `d(f, v) ≤ d(f, y)`. The inside of a closed +walk +is closed, so a walk whose inside holds the atom of `f` also holds `v`. This replaces the step +"`1 ≥ d(z, v)`" in the proof of (7.3) (page 36), which fails on a grid, where `d(z, v) = 2`. -/ +theorem tangleMetric_edge_vertex_le (hS : IsClosedSurface S) + {H K : Drawing S} (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + {f y : Set S} {v : S} (hf : f ∈ H.E) (hv : v ∈ H.V) (hvf : v ∈ closure f) (hfy : f ≠ y) : + tangleMetric H K ins θ f {v} ≤ tangleMetric H K ins θ f y := by + have : T2Space S := hS.2.1 + have hv_corr : IsCorrespondingAtom H K {v} {v} := + ⟨Or.inl (Or.inl ⟨v, hv, rfl⟩), Or.inl (Or.inl ⟨v, hK.2.1.2.1 hv, rfl⟩), + Or.inl ⟨v, hv, rfl, rfl⟩⟩ + rcases GM11.tangleMetric_cases (ins := ins) (θ := θ) hK.2.1 hfy with h | ⟨_, hw⟩ + · rw [h] + exact GM11.tangleMetric_le_order hK.2.1 f {v} + obtain ⟨u, W, f', _, hf', _, hW, hlen, hfW, _⟩ := hw + exact GM11.tangleMetric_le + ⟨u, W, f', {v}, hf', hv_corr, hW, hlen, hfW, + singleton_subset_insWalk_of_edge_atom hS hd hf hvf hf' W hW hfW⟩ + +/-- If `D` is a circuit of `K` with `D.length < 2 * θ`, `v ∈ V(D) ∩ V(H)`, and `x ∈ A(H)` meets +`ins(D)`, then `2 * d({v}, x) ≤ D.length` and `d({v}, x) ≤ |V(D) ∩ V(H)|`. -/ +theorem tangleMetric_vertex_le_of_circuit (hS : IsClosedSurface S) {H K D : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hD : D.IsCircuit) (hDs : D.IsSubdrawing K) (hlen : D.length < 2 * θ) + {v : S} (hv : v ∈ D.V ∩ H.V) {x : Set S} (hx : x ∈ H.A) (hxD : (x ∩ ins D).Nonempty) : + 2 * tangleMetric H K ins θ {v} x ≤ D.length ∧ + tangleMetric H K ins θ {v} x ≤ (D.V ∩ H.V).ncard := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hD' := hD + obtain ⟨u, W_D, ⟨hnd, hed⟩, hpos, hDV, hDE⟩ := hD + obtain ⟨W, hs, he⟩ := hDs.exists_walk_up W_D + have hWD_eq : walkDrawing K W = D := by + apply Drawing.ext_of_V_E + · rw [walkDrawing_V, hs, hDV] + · rw [walkDrawing_E, he, hDE] + have hWlen : W.length = D.length := by + rw [Drawing.length, hDE, ← he] + have h : {e | e ∈ W.edges} = (W.edges.toFinset : Set (Set S)) := by ext; simp + rw [h, ncard_coe_finset, List.toFinset_card_of_nodup (he ▸ hed)] + rfl + have hWlt : W.length < 2 * θ := hWlen ▸ hlen + have hinsD_sub : ins D ⊆ insWalk ins K W := by + intro p hp + refine Or.inr (mem_iUnion₂.mpr ⟨D, ⟨hD', ?_⟩, hp⟩) + rw [hWD_eq] + exact ⟨subset_rfl, subset_rfl⟩ + have hvW : ({v} : Set S) ⊆ insWalk ins K W := by + rw [singleton_subset_iff] + refine Or.inl ?_ + rw [hWD_eq] + exact D.V_subset_U hv.1 + have hv_corr : IsCorrespondingAtom H K {v} {v} := + ⟨Or.inl (Or.inl ⟨v, hv.2, rfl⟩), Or.inl (Or.inl ⟨v, hK.2.1.2.1 hv.2, rfl⟩), + Or.inl ⟨v, hv.2, rfl, rfl⟩⟩ + obtain ⟨x', hx', -⟩ := existsUnique_correspondingAtom hK hx + have hx'W : x' ⊆ insWalk ins K W := + (theorem_3_1_proof hS hK hd hx' W hWlt).mpr (hxD.mono (inter_subset_inter_right x hinsD_sub)) + have h2le : 2 * tangleMetric H K ins θ {v} x ≤ D.length := by + rw [← hWlen] + exact two_mul_tangleMetric_le_walk_length hK hv_corr hx' W hWlt hvW hx'W + have hDeq := (circuit_length_eq_two_mul_ncard hK.2.1 hD' hDs).1 + refine ⟨h2le, ?_⟩ + omega + +/-! ## Proof of (7.1) -/ + +/-- General form of (7.1): if `E(H) ≠ ∅`, `z ∈ A(H)`, and either `|E(H)| ≥ 2` or `z ∉ E(H)`, +then there exists `e ∈ E(H)` with `d(z, e) = θ`. -/ +theorem exists_edge_dist_eq_theta + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hMetric : HasTangleMetric H θ T d) (hE : H.E.Nonempty) + {z : Set S} (hz : z ∈ H.A) (hzE : 2 ≤ H.E.ncard ∨ z ∉ H.E) : + ∃ e ∈ H.E, d z e = θ := by + exact GM12.exists_edge_dist_eq_theta_of_metric hS hConn hMetric hE hz hzE + +/-- Graph Minors XIV, (7.1) (page 35): +"Let $H$ be a 2-cell drawing with $|E(H)| \ge 2$ in a surface $\Sigma$, and let $\mathscr{T}$ +be a respectful tangle in $H$ of order $\theta \ge 1$, with metric $d$. Then for every $z +\in A(H)$ there exists $e \in E(H)$ with $d(z, e) = \theta$." -/ +theorem theorem_7_1_proof + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hMetric : HasTangleMetric H θ T d) (hE2 : 2 ≤ H.E.ncard) + {z : Set S} (hz : z ∈ H.A) : + ∃ e ∈ H.E, d z e = θ := by + have hpos : 0 < H.E.ncard := by omega + have hE : H.E.Nonempty := (ncard_pos H.finite_edges).mp hpos + exact exists_edge_dist_eq_theta hS hConn hMetric hE hz (Or.inl hE2) + +/-! ## Proof of (7.2) -/ + +/-- Graph Minors XIV, (7.2) (page 36): +"Let $H$ be a 2-cell drawing in $\Sigma$ with $E(H) \ne \emptyset$, and let $\mathscr{T}$ be +a respectful tangle in $H$. Let $K$ be a radial drawing of $H$, and let $(A, B) \in +\mathscr{T}$. Then for every edge $e$ of $A$ there is a circuit $D$ of $K$ with $V(D) \cap +V(H) \subseteq V(A \cap B)$ and with $e \subseteq ins(D)$." -/ +theorem theorem_7_2_proof (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} {A B : Hypergraph S (Set S)} {e : Set S} + (hE : H.E.Nonempty) + (hResp : IsRespectfulDrawingTangle H θ T) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hAB : (A, B) ∈ T) (he : e ∈ A.edgeSet) : + ∃ D : Drawing S, D.IsCircuit ∧ D.IsSubdrawing K ∧ D.length < 2 * θ ∧ + D.V ∩ H.V ⊆ (A ∩ B).vertexSet ∧ e ⊆ ins D := by + have : T2Space S := hS.2.1 + have h63 := (GM11.theorem_6_3_proof S hS hConn (PaintingOrDrawing.drawing H) K θ T ins + hResp.1 hE hResp.2.1.isPretangle hResp.2.2 hK hd).1 + have hsep := hResp.2.1.isSeparation hAB + have hord := hResp.2.1.order_lt hAB + obtain ⟨k, C, hC, hin⟩ := (h63 A B hsep hord).mp hAB + obtain ⟨i, hi⟩ := hin e he + exact ⟨C i, (hC i).1, (hC i).2.1, (hC i).2.2.1, (hC i).2.2.2, hi⟩ + +/-- The one-edge small side gives a short radial circuit enclosing that edge. -/ +theorem exists_circuit_around_drawing_edge (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H K : Drawing S} {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} (hResp : IsRespectfulDrawingTangle H θ T) (hθ : 2 < θ) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) {e : Set S} (he : e ∈ H.E) : + ∃ D : Drawing S, D.IsCircuit ∧ D.IsSubdrawing K ∧ D.length < 2 * θ ∧ + D.V ∩ H.V ⊆ (edgeHypergraph H.toHypergraph e ∩ (H.toHypergraph.deleteEdges {e})).vertexSet ∧ + e ⊆ ins D := + theorem_7_2_proof hS hConn ⟨e, he⟩ hResp hK hd + (GM12.drawing_edge_small_side_mem_of_order_three hResp.2.1 hθ he) rfl + +/-! ## Proof of (7.3) -/ + +/-- Graph Minors XIV, (7.3) (page 36), proving `GM15.GM14Theorem73Statement`: +"Let $H$ be a 2-cell drawing in $\Sigma$ with $E(H) \ne \emptyset$, and let $\mathscr{T}$ be +a respectful tangle in $H$ of order $\theta$, with metric $d$. Let $z \in A(H)$, and let +$(A, B) \in \mathscr{T}$ with $E(B) \ne \{z\}$. Then there exists $e \in E(B)$ with $d(z, e) +\ge \theta - |V(A \cap B)|$." -/ +theorem theorem_7_3_proof : + GM15.GM14Theorem73Statement.{u} := by + intro S _ _ H θ T d A₀ B₀ z hS hConn hE hMetric hz hAB₀ hBz₀ + have : ConnectedSpace S := hConn + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + rcases hMetric with ⟨hResp, K, ins, hK, hd, hd_eq⟩ + have hMetric' : HasTangleMetric H θ T d := ⟨hResp, K, ins, hK, hd, hd_eq⟩ + have hT := hResp.2.1 + have hsl : IsSlope K (2 * θ) ins := + GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) hS hT.isPretangle hK.2.1.1 hd + have htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c := fun a ha b hb c hc => by + rw [hd_eq a ha c hc, hd_eq a ha b hb, hd_eq b hb c hc] + exact GM11.tangleMetric_triangle hS hK.2.1 hsl a b c + have hrf := GM11.regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hE + -- Induction on `|V(B)|`. + suffices hind : ∀ n : ℕ, ∀ B : Hypergraph S (Set S), B.vertexSet.ncard = n → + (A₀, B) ∈ T → B.edgeSet ≠ {z} → + ∃ e ∈ B.edgeSet, θ - separationOrder A₀ B ≤ d z e by + exact hind B₀.vertexSet.ncard B₀ rfl hAB₀ hBz₀ + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro B hBn hAB hBz + have hsep : H.toHypergraph.IsSeparation A₀ B := hT.isSeparation hAB + have hord : separationOrder A₀ B < θ := hT.order_lt hAB + -- Step 1: check if some `v ∈ V(A₀ ∩ B)` has no incident edge in `B`. + by_cases hex_iso : ∃ v ∈ (A₀ ∩ B).vertexSet, ∀ f ∈ B.edgeSet, ¬ B.Inc f v + · obtain ⟨v, hvAB, hiso⟩ := hex_iso + set B' := B.deleteVertices {v} + have hB'le : B' ≤ H.toHypergraph := (deleteVertices_le B {v}).trans hsep.right_le + have hB'E : B'.edgeSet = B.edgeSet := by + ext f + simp only [B', deleteVertices, mem_ofPred_eq, and_iff_left_iff_imp] + intro hf w hw + rw [mem_singleton_iff.mp hw] + exact hiso f hf + have hsep' : H.toHypergraph.IsSeparation A₀ B' := by + rw [isSeparation_iff_of_le hsep.left_le hB'le] + refine ⟨?_, by rw [hB'E, hsep.edgeSet_union], by rw [hB'E]; exact hsep.edgeSet_inter_eq⟩ + ext w + simp only [B', deleteVertices, mem_union, mem_sdiff, mem_singleton_iff] + constructor + · rintro (hwA | ⟨hwB, -⟩) + · exact hsep.left_le.vertexSet_subset hwA + · exact hsep.right_le.vertexSet_subset hwB + · intro hwH + have hwU : w ∈ A₀.vertexSet ∪ B.vertexSet := hsep.vertexSet_union ▸ hwH + by_cases hwv : w = v + · subst hwv + exact Or.inl hvAB.1 + · rcases hwU with hwA | hwB + · exact Or.inl hwA + · exact Or.inr ⟨hwB, hwv⟩ + have hord_le : separationOrder A₀ B' ≤ separationOrder A₀ B := by + refine ncard_le_ncard ?_ (A₀ ∩ B).vertexSet_finite + intro w hw + exact ⟨hw.1, hw.2.1⟩ + have hord' : separationOrder A₀ B' < θ := lt_of_le_of_lt hord_le hord + have hAB' : (A₀, B') ∈ T := + GM10.theorem_2_9_proof hT hAB hsep' hord' (Or.inr (Or.inl subset_rfl)) + have hB'lt : B'.vertexSet.ncard < n := by + rw [← hBn] + refine ncard_lt_ncard ?_ B.vertexSet_finite + refine ⟨sdiff_subset, fun hsub => ?_⟩ + exact (hsub hvAB.2).2 (mem_singleton v) + obtain ⟨e, heB', hde⟩ := ih B'.vertexSet.ncard hB'lt B' rfl hAB' (hB'E ▸ hBz) + refine ⟨e, hB'E ▸ heB', ?_⟩ + omega + · push Not at hex_iso + have hBE_ne : B.edgeSet.Nonempty := by + by_contra hBE_empty + rw [not_nonempty_iff_eq_empty] at hBE_empty + have hAE : A₀.edgeSet = H.E := by + have hU := hsep.edgeSet_union + rw [hBE_empty, union_empty] at hU + exact hU + have hAV : A₀.vertexSet = H.V := by + apply subset_antisymm hsep.left_le.vertexSet_subset + intro v hv + obtain ⟨e, he, hve⟩ := GM11.exists_edge_of_regionFacts hS hrf hv + have heA : e ∈ A₀.edgeSet := hAE.symm ▸ he + have hincH : H.toHypergraph.Inc e v := + (PaintingOrDrawing.toHypergraph_inc (Γ := PaintingOrDrawing.drawing H)).mpr ⟨he, hv, + hve⟩ + have hincA : A₀.Inc e v := (inc_iff_of_le hsep.left_le heA).mpr hincH + exact A₀.vertex_mem_of_inc hincA + exact hT.axiom3 hAB hAV + by_cases hE2 : 2 ≤ H.E.ncard + · obtain ⟨e, heH, hze⟩ := theorem_7_1_proof hS hConn hMetric' hE2 hz + have heU : e ∈ A₀.edgeSet ∪ B.edgeSet := hsep.edgeSet_union.symm ▸ heH + rcases heU with heA | heB + · obtain ⟨D, hD, hDs, hDlen, hDV, heD⟩ := + theorem_7_2_proof hS hConn hE hResp hK hd hAB heA + obtain ⟨v, hv⟩ := (circuit_length_eq_two_mul_ncard hK.2.1 hD hDs).2 + have hvAB : v ∈ (A₀ ∩ B).vertexSet := hDV hv + obtain ⟨p, hp⟩ := heH.1 + have hve_le : d {v} e ≤ (A₀ ∩ B).vertexSet.ncard := by + rw [hd_eq {v} (Or.inl (Or.inl ⟨v, hv.2, rfl⟩)) e (Or.inl (Or.inr heH))] + refine (tangleMetric_vertex_le_of_circuit hS hK hd hD hDs hDlen hv + (Or.inl (Or.inr heH)) ⟨p, hp, heD hp⟩).2.trans ?_ + exact ncard_le_ncard hDV (A₀ ∩ B).vertexSet_finite + have hvA : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hv.2, rfl⟩) + have he_mem_A : e ∈ H.A := Or.inl (Or.inr heH) + have hzv_tri : d z e ≤ d z {v} + d {v} e := htri z hz {v} hvA e he_mem_A + have hzv_ge : θ - separationOrder A₀ B ≤ d z {v} := by + change θ - (A₀ ∩ B).vertexSet.ncard ≤ d z {v} + omega + obtain ⟨f, hfB, hfv⟩ := hex_iso v hvAB + have hfH : f ∈ H.E := hsep.right_le.edgeSet_subset hfB + have hf_inc : H.toHypergraph.Inc f v := inc_of_le hsep.right_le hfv + have hvf : v ∈ closure f := + ((PaintingOrDrawing.toHypergraph_inc (Γ := PaintingOrDrawing.drawing H)).mp hf_inc).2.2 + by_cases hzf : z = f + · subst hzf + have hex_g : ∃ g ∈ B.edgeSet, g ≠ z := by + by_contra hno_g + push Not at hno_g + apply hBz + exact subset_antisymm hno_g (singleton_subset_iff.mpr hfB) + obtain ⟨g, hgB, hgz⟩ := hex_g + have hgH : g ∈ H.E := hsep.right_le.edgeSet_subset hgB + -- The paper writes `d(z, g) ≥ 1 ≥ d(z, v)` here, but `d(z, v)` can be 2. The bound + -- `d(z, v) ≤ d(z, g)` is what is needed, and it holds for the reason of the next case. + have hle_zg : d z {v} ≤ d z g := by + rw [hd_eq z hz {v} hvA, hd_eq z hz g (Or.inl (Or.inr hgH))] + exact tangleMetric_edge_vertex_le hS hK hd hfH hv.2 hvf hgz.symm + refine ⟨g, hgB, ?_⟩ + omega + · refine ⟨f, hfB, ?_⟩ + have hle_zf : d z {v} ≤ d z f := by + rw [hd_eq z hz {v} hvA, hd_eq z hz f (Or.inl (Or.inr hfH))] + exact tangleMetric_le_of_vertex_mem_closure_edge hS hK hd hz hfH hv.2 hvf hzf + omega + · refine ⟨e, heB, ?_⟩ + omega + · obtain ⟨e, heB⟩ := hBE_ne + have heH : e ∈ H.E := hsep.right_le.edgeSet_subset heB + have hHE_eq : H.E = {e} := by + have h1 : H.E.ncard ≤ 1 := by omega + exact (eq_of_subset_of_ncard_le (singleton_subset_iff.mpr heH) + (by rw [ncard_singleton]; exact h1) H.finite_edges).symm + have hBE_eq : B.edgeSet = {e} := + subset_antisymm (hsep.right_le.edgeSet_subset.trans (hHE_eq ▸ subset_rfl)) + (singleton_subset_iff.mpr heB) + have hze : z ≠ e := fun h => hBz (h ▸ hBE_eq) + have hz_not_E : z ∉ H.E := by + rw [hHE_eq, mem_singleton_iff] + exact hze + obtain ⟨e', he'H, hze'⟩ := exists_edge_dist_eq_theta hS hConn hMetric' hE hz + (Or.inr hz_not_E) + have he'e : e = e' := (mem_singleton_iff.mp (hHE_eq ▸ he'H)).symm + subst he'e + refine ⟨e, heB, ?_⟩ + omega + +/-! ## Proof of (7.4) -/ + +/-- Graph Minors XIV, (7.4) (page 36): +"Let $H$ be a 2-cell drawing in $\Sigma$, and let $\mathscr{T}$ be a respectful tangle in +$H$. Let $K$ be a radial drawing of $H$, let $(A, B) \in \mathscr{T}$, and let $C$ be a +circuit of $A$ with $|V(B \cap C)| \le 1$. Then there is a circuit $D$ of $K$ with $V(D) +\cap V(H) \subseteq V(A \cap B)$ and $U(C) \subseteq ins(D)$." -/ +theorem theorem_7_4_proof (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H K C : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} {A B : Hypergraph S (Set S)} + (hResp : IsRespectfulDrawingTangle H θ T) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hAB : (A, B) ∈ T) + (hC : C.IsCircuit) (hCs : C.IsSubdrawing H) + (hCA : C.V ⊆ A.vertexSet ∧ C.E ⊆ A.edgeSet) + (hBC : (B.vertexSet ∩ C.V).ncard ≤ 1) : + ∃ D : Drawing S, D.IsCircuit ∧ D.IsSubdrawing K ∧ D.length < 2 * θ ∧ + D.V ∩ H.V ⊆ (A ∩ B).vertexSet ∧ C.U ⊆ ins D := by + have : T2Space S := hS.2.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hsep := hResp.2.1.isSeparation hAB + have hC' := hC + obtain ⟨_, W_C, _, hpos, _, hCE⟩ := hC + have hCE_ne : C.E.Nonempty := by + cases W_C with + | nil _ => exact absurd hpos (Nat.lt_irrefl 0) + | @cons _ _ _ e _ _ => exact ⟨e, by rw [hCE]; exact List.mem_cons_self⟩ + obtain ⟨e, heC⟩ := hCE_ne + have heA : e ∈ A.edgeSet := hCA.2 heC + have heH : e ∈ H.E := hsep.left_le.edgeSet_subset heA + obtain ⟨D, hD, hDs, hDlen, hDV, heD⟩ := + theorem_7_2_proof hS hConn ⟨e, heH⟩ hResp hK hd hAB heA + refine ⟨D, hD, hDs, hDlen, hDV, ?_⟩ + obtain ⟨hDdisc, hDbd, -⟩ := hd D hD hDs hDlen + have hDcl : IsClosed (ins D) := hDdisc.isClosed + have hDfr : frontier (ins D) = D.U := by rw [subBd_eq_frontier', hDbd] + have hDU_sub : D.U ⊆ ins D := hDfr ▸ hDcl.frontier_subset + have hCU_oArc : IsOArc C.U := isOArc_of_isCircuit hC' + have hUU : H.U ∩ K.U = H.V := hK.2.1.1 + have hcap_sub : C.U ∩ D.U ⊆ B.vertexSet ∩ C.V := by + rintro x ⟨hxC, hxD⟩ + have hxHV : x ∈ H.V := by + have : x ∈ H.U ∩ K.U := ⟨hCs.U_subset hxC, hDs.U_subset hxD⟩ + rwa [hUU] at this + have hxCV : x ∈ C.V := by + by_contra hxCV + obtain ⟨f, hfC, hxf⟩ := C.exists_edge_of_mem hxC hxCV + exact ((hCs.2 hfC).2.1 hxf).2 hxHV + have hxDV : x ∈ D.V := by + by_contra hxDV + obtain ⟨g, hgD, hxg⟩ := D.exists_edge_of_mem hxD hxDV + exact ((hDs.2 hgD).2.1 hxg).2 (hK.2.1.2.1 hxHV) + exact ⟨(hDV ⟨hxDV, hxHV⟩).2, hxCV⟩ + have hcap_le1 : (C.U ∩ D.U).ncard ≤ 1 := + (ncard_le_ncard hcap_sub ((B.vertexSet_finite).subset inter_subset_left)).trans hBC + have hcap_fin : (C.U ∩ D.U).Finite := + (B.vertexSet_finite.subset inter_subset_left).subset hcap_sub + have hconn_diff : IsPreconnected (C.U \ D.U) := by + have heq : C.U \ D.U = C.U \ (C.U ∩ D.U) := by ext; simp + rw [heq] + by_cases hne : (C.U ∩ D.U).Nonempty + · obtain ⟨u, hu⟩ := hne + have hsing : C.U ∩ D.U = {u} := + (eq_of_subset_of_ncard_le (singleton_subset_iff.mpr hu) + (by rw [ncard_singleton]; exact hcap_le1) hcap_fin).symm + rw [hsing] + exact (isPathConnected_oArc_diff hCU_oArc hu.1).isConnected.isPreconnected + · rw [not_nonempty_iff_eq_empty.mp hne, sdiff_empty] + exact IsOArc.isPreconnected hCU_oArc + have he_sub_diff : e ⊆ C.U \ D.U := by + intro p hp + refine ⟨(heC.2.1 hp).1, fun hpD => ?_⟩ + exact (heC.2.1 hp).2 (hcap_sub ⟨(heC.2.1 hp).1, hpD⟩).2 + obtain ⟨p₀, hp₀⟩ := heC.1 + have hdis_fr : Disjoint (C.U \ D.U) (frontier (ins D)) := by + rw [hDfr] + exact disjoint_sdiff_left + have hdiff_sub : C.U \ D.U ⊆ ins D := + subset_of_disjoint_frontier hconn_diff hDcl hdis_fr (he_sub_diff hp₀) (heD hp₀) + intro x hxC + by_cases hxD : x ∈ D.U + · exact hDU_sub hxD + · exact hdiff_sub ⟨hxC, hxD⟩ + +/-! ## Proof of (7.5) -/ + +/-- Graph Minors XIV, (7.5) (pages 36–37), proving `GM16.GM14Theorem75Statement`: +"Let $H$ be a 2-cell drawing in $\Sigma$, and let $\mathscr{T}$ be a respectful tangle in $H$ of +order $\theta$. Let $\lambda \ge 0$ be an integer, and let $\Lambda \subseteq \Sigma$ be an +$\lambda$-zone. Let $K$ be ... a radial drawing of $H$, and let $D$ be a circuit of $K$ with $U(D) +\subseteq \bar{\Lambda}$ and $|E(D)| < 2(\theta - \lambda)$. Then $ins(D) \subseteq +\bar{\Lambda}$." -/ +theorem theorem_7_5_proof : + GM16.GM14Theorem75Statement.{w} := by + intro S _ _ H K D θ lam T d ins z Λ hS hConn hMetric hK hd hZone hD hDs hDU_sub hDlen + have : ConnectedSpace S := hConn + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + rcases hMetric with ⟨hResp, K₀, ins₀, hK₀, hd₀, hd_eq⟩ + have hMetric' : HasTangleMetric H θ T d := ⟨hResp, K₀, ins₀, hK₀, hd₀, hd_eq⟩ + have hsl₀ : IsSlope K₀ (2 * θ) ins₀ := + GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) hS hResp.2.1.isPretangle hK₀.2.1.1 + hd₀ + have htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c := fun a ha b hb c hc => by + rw [hd_eq a ha c hc, hd_eq a ha b hb, hd_eq b hb c hc] + exact GM11.tangleMetric_triangle hS hK₀.2.1 hsl₀ a b c + have hDlt : D.length < 2 * θ := by omega + obtain ⟨hDdisc, hDbd, hDsep⟩ := hd D hD hDs hDlt + have hDU_oArc : IsOArc D.U := isOArc_of_isCircuit hD + obtain ⟨Δ, ⟨hΔsub, hΔdisc, hΔbd, -⟩, -⟩ := + disc_oArc (closure Λ) D.U hZone.isClosedDisc_closure hDU_sub hDU_oArc + have hΔbd_sub : subBd Δ = D.U := by + rw [IsClosedDisc.subBd_eq_discBd hS hΔdisc, hΔbd] + by_cases h_eq : ins D = Δ + · exact h_eq ▸ hΔsub + · exfalso + have hbd_eq : discBd (ins D) = discBd Δ := by + rw [← IsClosedDisc.subBd_eq_discBd hS hDdisc, hDbd, hΔbd] + have hcov : ins D ∪ Δ = univ := cover_of_discBd_eq hS hDdisc hΔdisc hbd_eq h_eq + have hOD₁ : IsOpenDisc (ins D \ D.U) := + hDbd ▸ (IsClosedDisc.isOpenDisc_diff_subBd hS hDdisc).1 + have hOD₂ : IsOpenDisc (Δ \ D.U) := + hΔbd_sub ▸ (IsClosedDisc.isOpenDisc_diff_subBd hS hΔdisc).1 + have hO₁ : IsOpen (ins D \ D.U) := hOD₁.1 + have hne₁ : (ins D \ D.U).Nonempty := IsOpenDisc.nonempty hOD₁ + have hO₂ : IsOpen (Δ \ D.U) := hOD₂.1 + have hne₂ : (Δ \ D.U).Nonempty := IsOpenDisc.nonempty hOD₂ + have hdis_int : Disjoint (ins D \ D.U) (Δ \ D.U) := by + have hcl_sub : Δ \ D.U ⊆ univ \ ins D := by + intro x ⟨hxΔ, hxU⟩ + refine ⟨mem_univ x, fun hxin => ?_⟩ + have hfrΔ : frontier Δ = D.U := by rw [subBd_eq_frontier', hΔbd_sub] + have hfrD : frontier (ins D) = D.U := by rw [subBd_eq_frontier', hDbd] + have hsub₁ : ins D \ D.U ⊆ Δ := + subset_of_disjoint_frontier + (hfrD ▸ IsClosedDisc.isPreconnected_diff_frontier hS hDdisc) + hΔdisc.isClosed (hfrΔ ▸ disjoint_sdiff_left) ⟨hxin, hxU⟩ hxΔ + have hsub₁' : ins D ⊆ Δ := by + intro y hy + exact hΔdisc.isClosed.closure_subset_iff.mpr hsub₁ + (hfrD ▸ IsClosedDisc.subset_closure_diff_frontier hS hDdisc hy) + have hsub₂ : Δ \ D.U ⊆ ins D := + subset_of_disjoint_frontier + (hfrΔ ▸ IsClosedDisc.isPreconnected_diff_frontier hS hΔdisc) + hDdisc.isClosed (hfrD ▸ disjoint_sdiff_left) ⟨hxΔ, hxU⟩ hxin + have hsub₂' : Δ ⊆ ins D := by + intro y hy + exact hDdisc.isClosed.closure_subset_iff.mpr hsub₂ + (hfrΔ ▸ IsClosedDisc.subset_closure_diff_frontier hS hΔdisc hy) + exact h_eq (subset_antisymm hsub₁' hsub₂') + exact disjoint_left.mpr fun x hx₁ hx₂ => (hcl_sub hx₂).2 hx₁.1 + obtain ⟨y₁, hy₁, hy₁K⟩ := exists_notMem_U (Γ := K) hS hO₁ hne₁ + obtain ⟨r₁, hr₁, hy₁r₁⟩ := exists_region_of_notMem hy₁K + obtain ⟨y₂, hy₂, hy₂K⟩ := exists_notMem_U (Γ := K) hS hO₂ hne₂ + obtain ⟨r₂, hr₂, hy₂r₂⟩ := exists_region_of_notMem hy₂K + have hbd_inf : (subBd Λ).Infinite := GM11.infinite_of_isOArc hZone.isOArc_bd + obtain ⟨x₀, hx₀bd, hx₀V⟩ := hbd_inf.exists_notMem_finite H.finite_V + obtain ⟨e₀, he₀, -⟩ := H.exists_edge_of_mem (hZone.bd_subset_U hx₀bd) hx₀V + have hE_ne : H.E.Nonempty := ⟨e₀, he₀⟩ + have hrf := GM11.regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hE_ne + obtain ⟨e₁, he₁, he₁r₁⟩ := hrf.1 r₁ hr₁ + obtain ⟨e₂, he₂, he₂r₂⟩ := hrf.1 r₂ hr₂ + have hr₁_sub : r₁ ⊆ ins D \ D.U := by + have hdis : Disjoint r₁ (frontier (ins D)) := by + rw [subBd_eq_frontier', hDbd] + exact disjoint_left.mpr fun x hxr hxD => region_subset hr₁ hxr (hDs.U_subset hxD) + have hsub := subset_of_disjoint_frontier (region_isPreconnected hr₁) hDdisc.isClosed hdis + hy₁r₁ hy₁.1 + exact fun x hx => ⟨hsub hx, fun hxD => region_subset hr₁ hx (hDs.U_subset hxD)⟩ + have hr₂_sub : r₂ ⊆ Δ \ D.U := by + have hdis : Disjoint r₂ (frontier Δ) := by + rw [subBd_eq_frontier', hΔbd_sub] + exact disjoint_left.mpr fun x hxr hxD => region_subset hr₂ hxr (hDs.U_subset hxD) + have hsub := subset_of_disjoint_frontier (region_isPreconnected hr₂) hΔdisc.isClosed hdis + hy₂r₂ hy₂.1 + exact fun x hx => ⟨hsub hx, fun hxD => region_subset hr₂ hx (hDs.U_subset hxD)⟩ + have he₁_ne_e₂ : e₁ ≠ e₂ := by + intro heq + subst heq + obtain ⟨p, hp⟩ := he₁.1 + exact disjoint_left.mp hdis_int (hr₁_sub (he₁r₁ hp)) (hr₂_sub (he₂r₂ hp)) + have hE2 : 2 ≤ H.E.ncard := + (one_lt_ncard H.finite_edges).mpr ⟨e₁, he₁, e₂, he₂, he₁_ne_e₂⟩ + obtain ⟨e, heH, hze⟩ := theorem_7_1_proof hS hConn hMetric' hE2 hZone.z_mem + have he_not_cl : ¬ e ⊆ closure Λ := by + intro hsub + have hle := hZone.dist_le e (Or.inl (Or.inr heH)) hsub + have hpos : 0 < D.length := by + obtain ⟨v, hv⟩ := (circuit_length_eq_two_mul_ncard hK.2.1 hD hDs).2 + have := (circuit_length_eq_two_mul_ncard hK.2.1 hD hDs).1 + have : 0 < (D.V ∩ H.V).ncard := + (ncard_pos (D.finite_V.subset inter_subset_left)).mpr ⟨v, hv⟩ + omega + omega + have hUU : H.U ∩ K.U = H.V := hK.2.1.1 + have he_dis_DU : Disjoint e D.U := by + refine disjoint_left.mpr fun x hxe hxD => ?_ + have : x ∈ H.U ∩ K.U := ⟨(heH.2.1 hxe).1, hDs.U_subset hxD⟩ + rw [hUU] at this + exact (heH.2.1 hxe).2 this + have he_sub_insD : e ⊆ ins D := by + have he_not_Δ : ¬ (e ∩ Δ).Nonempty := by + rintro ⟨x, hxe, hxΔ⟩ + have hfrΔ : frontier Δ = D.U := by rw [subBd_eq_frontier', hΔbd_sub] + have hsub : e ⊆ Δ := + subset_of_disjoint_frontier heH.2.2.1.isConnected.isPreconnected hΔdisc.isClosed + (hfrΔ ▸ he_dis_DU) hxe hxΔ + exact he_not_cl (hsub.trans hΔsub) + intro x hxe + have hx_univ : x ∈ ins D ∪ Δ := hcov.symm ▸ mem_univ x + exact hx_univ.resolve_right fun hxΔ => he_not_Δ ⟨x, hxe, hxΔ⟩ + set A := (PaintingOrDrawing.drawing H).inter (ins D) + set B := (PaintingOrDrawing.drawing H).interOutside (ins D) + have heA : e ∈ A.edgeSet := ⟨heH, he_sub_insD⟩ + have hAB_V : (A ∩ B).vertexSet ⊆ D.V ∩ H.V := by + intro x hx + have hfrD : frontier (ins D) = D.U := by rw [subBd_eq_frontier', hDbd] + exact inter_outside_vertex hK.2.1.2.1 hDs hfrD hx + obtain ⟨D₀, hD₀, hD₀s, hD₀len, hD₀V, heD₀⟩ := + theorem_7_2_proof hS hConn hE_ne hResp hK₀ hd₀ hDsep heA + obtain ⟨v, hv₀⟩ := (circuit_length_eq_two_mul_ncard hK₀.2.1 hD₀ hD₀s).2 + have hvD : v ∈ D.V ∩ H.V := hAB_V (hD₀V hv₀) + have hv_cl : ({v} : Set S) ⊆ closure Λ := + singleton_subset_iff.mpr (hDU_sub (D.V_subset_U hvD.1)) + have hvA : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hvD.2, rfl⟩) + have hzv_le : d z {v} ≤ lam := hZone.dist_le {v} hvA hv_cl + obtain ⟨p, hp⟩ := heH.1 + have hve_le : d {v} e ≤ (D.V ∩ H.V).ncard := by + rw [hd_eq {v} hvA e (Or.inl (Or.inr heH))] + refine (tangleMetric_vertex_le_of_circuit hS hK₀ hd₀ hD₀ hD₀s hD₀len hv₀ + (Or.inl (Or.inr heH)) ⟨p, hp, heD₀ hp⟩).2.trans ?_ + exact ncard_le_ncard (hD₀V.trans hAB_V) (D.finite_V.subset inter_subset_left) + have hDeq := (circuit_length_eq_two_mul_ncard hK.2.1 hD hDs).1 + have htri' := htri z hZone.z_mem {v} hvA e (Or.inl (Or.inr heH)) + omega + +/-! ## Proof of (7.6) -/ + +/-- For an open disc `Λ` whose boundary `subBd Λ` is an `O`-arc and whose closure `closure Λ` is a +closed disc, `discBd (closure Λ) = subBd Λ`. -/ +theorem discBd_closure_eq_subBd {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Λ : Set S} (hΛ : IsOpenDisc Λ) (hO : IsOArc (subBd Λ)) + (hcl : IsClosedDisc (closure Λ)) : + discBd (closure Λ) = subBd Λ := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨Δ₀, ⟨hΔ₀sub, hΔ₀disc, hΔ₀bd, -⟩, -⟩ := + disc_oArc (closure Λ) (subBd Λ) hcl (fun x hx => hx.1) hO + have hΔ₀bd_sub : subBd Δ₀ = subBd Λ := by + rw [IsClosedDisc.subBd_eq_discBd hS hΔ₀disc, hΔ₀bd] + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ.1 + have hOD₀ : IsOpenDisc (Δ₀ \ subBd Λ) := + hΔ₀bd_sub ▸ (IsClosedDisc.isOpenDisc_diff_subBd hS hΔ₀disc).1 + obtain ⟨p, hp⟩ := IsOpenDisc.nonempty hOD₀ + have hpΛ : p ∈ Λ := by + have hp_cl : p ∈ closure Λ := hΔ₀sub hp.1 + rw [hclL] at hp_cl + exact hp_cl.resolve_right hp.2 + have hfr₀ : frontier Δ₀ = subBd Λ := by rw [subBd_eq_frontier', hΔ₀bd_sub] + have hΛ_sub : Λ ⊆ Δ₀ := + subset_of_disjoint_frontier hΛ.isPathConnected.isConnected.isPreconnected hΔ₀disc.isClosed + (hfr₀ ▸ hdisL) hpΛ hp.1 + have h_eq : closure Λ = Δ₀ := + subset_antisymm (hΔ₀disc.isClosed.closure_subset_iff.mpr hΛ_sub) hΔ₀sub + rw [h_eq, hΔ₀bd] + +/-- Graph Minors XIV, (7.6) (page 37): +"Let $H$ be a 2-cell drawing in $\Sigma$, and let $\mathscr{T}$ be a respectful tangle in $H$ +of order $\theta$. Let $\lambda \ge 0$ be an integer, and let $\Lambda \subseteq \Sigma$ be +a $\lambda$-zone. Let $K$ be a radial drawing of $H$, and let $D$ be a circuit of $K$ with +$|E(D)| < 2(\theta - \lambda)$ and $bd(\Lambda) \subseteq ins(D)$. Then $\bar{\Lambda} +\subseteq ins(D)$." -/ +theorem theorem_7_6_proof + {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H K D : Drawing S} {θ lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {ins : Drawing S → Set S} {z Λ : Set S} + (hMetric : HasTangleMetric H θ T d) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hZone : IsLambdaZoneAround H d lam z Λ) + (hD : D.IsCircuit) (hDs : D.IsSubdrawing K) + (hDlen : D.length < 2 * (θ - lam)) + (hbd_sub : subBd Λ ⊆ ins D) : + closure Λ ⊆ ins D := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hDlt : D.length < 2 * θ := by omega + obtain ⟨hDdisc, hDbd, -⟩ := hd D hD hDs hDlt + obtain ⟨Δ', ⟨hΔ'sub, hΔ'disc, hΔ'bd, -⟩, -⟩ := + disc_oArc (ins D) (subBd Λ) hDdisc hbd_sub hZone.isOArc_bd + by_cases h_eq : closure Λ = Δ' + · exact h_eq ▸ hΔ'sub + · exfalso + have hcl_bd : discBd (closure Λ) = subBd Λ := + discBd_closure_eq_subBd hS hZone.isOpenDisc hZone.isOArc_bd hZone.isClosedDisc_closure + have hcov : closure Λ ∪ Δ' = univ := + cover_of_discBd_eq hS hZone.isClosedDisc_closure hΔ'disc (hcl_bd.trans hΔ'bd.symm) h_eq + have hΔ'bd_sub : subBd Δ' = subBd Λ := by + rw [IsClosedDisc.subBd_eq_discBd hS hΔ'disc, hΔ'bd] + have hOD' : IsOpenDisc (Δ' \ subBd Λ) := + hΔ'bd_sub ▸ (IsClosedDisc.isOpenDisc_diff_subBd hS hΔ'disc).1 + have hO' : IsOpen (Δ' \ subBd Λ) := hOD'.1 + have hfrD : frontier (ins D) = D.U := by rw [subBd_eq_frontier', hDbd] + have hDU_dis : Disjoint D.U (Δ' \ subBd Λ) := by + refine disjoint_left.mpr fun x hxD hxΔ' => ?_ + have hx_int : x ∈ interior (ins D) := + interior_maximal (sdiff_subset.trans hΔ'sub) hO' hxΔ' + have hx_fr : x ∈ frontier (ins D) := hfrD ▸ hxD + exact hx_fr.2 hx_int + have hDU_sub : D.U ⊆ closure Λ := by + intro x hxD + have hx_univ : x ∈ closure Λ ∪ Δ' := hcov.symm ▸ mem_univ x + rcases hx_univ with hxcl | hxΔ' + · exact hxcl + · by_cases hxbd : x ∈ subBd Λ + · exact hxbd.1 + · exact absurd ⟨hxΔ', hxbd⟩ (disjoint_left.mp hDU_dis hxD) + have hins_sub : ins D ⊆ closure Λ := + theorem_7_5_proof H K D θ lam T d ins z Λ hS hConn hMetric hK hd hZone hD hDs + hDU_sub hDlen + have hΔ'_sub_cl : Δ' ⊆ closure Λ := hΔ'sub.trans hins_sub + have hcl_univ : closure Λ = univ := by + rw [← hcov, union_eq_left.mpr hΔ'_sub_cl] + have hbd_empty : subBd (closure Λ) = ∅ := by + rw [← subBd_eq_frontier', hcl_univ, frontier_univ] + have hbd_eq' : subBd (closure Λ) = subBd Λ := by + rw [IsClosedDisc.subBd_eq_discBd hS hZone.isClosedDisc_closure, hcl_bd] + obtain ⟨q, hq⟩ := IsOArc.nonempty hZone.isOArc_bd + rw [← hbd_eq', hbd_empty] at hq + exact hq + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section7b.lean b/LeanPool/GraphMinor/GM14/Section7b.lean new file mode 100644 index 0000000000..ab62058fd2 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section7b.lean @@ -0,0 +1,1088 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section7a + +import LeanPool.GraphMinor.GM11.OArcCircuit + +/-! +# Graph Minors XIV, Section 7: Proof of (7.8) + +This file formalizes (7.8) (`theorem_7_8`, pages 38–39) of Robertson and Seymour, +*Graph Minors. XIV. Extending an embedding*, J. Combin. Theory Ser. B 65 (1995), 23–50. +-/ + +public section + +namespace GraphMinor.GM14 + +open Set Function Topology +open Graph SimpleGraph Hypergraph Surface GM09 GM10 GM11 + +universe u v w + +variable {S : Type u} [TopologicalSpace S] + +/-! ## Helper Lemmas on Disjoint Families and Subdrawings -/ + +/-- If two subdrawings `Γ₁, Γ₂` of `H` have disjoint vertex sets, then their point sets `Γ₁.U` and +`Γ₂.U` are disjoint. -/ +theorem disjoint_U_of_disjoint_V {H Γ₁ Γ₂ : Drawing S} + (h₁ : Γ₁.IsSubdrawing H) (h₂ : Γ₂.IsSubdrawing H) (hdis : Disjoint Γ₁.V Γ₂.V) : + Disjoint Γ₁.U Γ₂.U := by + refine disjoint_left.mpr fun x hx₁ hx₂ => ?_ + by_cases hxV₁ : x ∈ Γ₁.V + · by_cases hxV₂ : x ∈ Γ₂.V + · exact disjoint_left.mp hdis hxV₁ hxV₂ + · obtain ⟨e₂, he₂, hxe₂⟩ := Γ₂.exists_edge_of_mem hx₂ hxV₂ + exact ((h₂.2 he₂).2.1 hxe₂).2 (h₁.1 hxV₁) + · obtain ⟨e₁, he₁, hxe₁⟩ := Γ₁.exists_edge_of_mem hx₁ hxV₁ + by_cases hxV₂ : x ∈ Γ₂.V + · exact ((h₁.2 he₁).2.1 hxe₁).2 (h₂.1 hxV₂) + · obtain ⟨e₂, he₂, hxe₂⟩ := Γ₂.exists_edge_of_mem hx₂ hxV₂ + have he₁H : e₁ ∈ H.E := h₁.2 he₁ + have he₂H : e₂ ∈ H.E := h₂.2 he₂ + have heq : e₁ = e₂ := H.edge_eq_of_mem he₁H he₂H hxe₁ hxe₂ + obtain ⟨a, b, _, haV₁, _, hcap₁⟩ := (Γ₁.toGraph.edge_mem_iff_exists_isLink e₁).mp he₁ + have ha_cl : a ∈ closure e₁ := by + have : a ∈ closure e₁ ∩ Γ₁.V := hcap₁ ▸ mem_insert a {b} + exact this.1 + have haV₂ : a ∈ Γ₂.V := by + have haU₂ : a ∈ Γ₂.U := Γ₂.closure_subset_U (heq ▸ he₂) (heq ▸ ha_cl) + by_contra haV₂ + obtain ⟨f, hf, haf⟩ := Γ₂.exists_edge_of_mem haU₂ haV₂ + exact ((h₂.2 hf).2.1 haf).2 (h₁.1 haV₁) + exact disjoint_left.mp hdis haV₁ haV₂ + +/-- If two subdrawings `Γ₁, Γ₂` of `H` have intersecting point sets `(Γ₁.U ∩ Γ₂.U).Nonempty`, then +their vertex sets intersect `(Γ₁.V ∩ Γ₂.V).Nonempty`. -/ +theorem nonempty_inter_V_of_nonempty_inter_U {H Γ₁ Γ₂ : Drawing S} + (h₁ : Γ₁.IsSubdrawing H) (h₂ : Γ₂.IsSubdrawing H) (hne : (Γ₁.U ∩ Γ₂.U).Nonempty) : + (Γ₁.V ∩ Γ₂.V).Nonempty := by + by_contra hempty + rw [not_nonempty_iff_eq_empty, ← disjoint_iff_inter_eq_empty] at hempty + obtain ⟨x, hx₁, hx₂⟩ := hne + exact disjoint_left.mp (disjoint_U_of_disjoint_V h₁ h₂ hempty) hx₁ hx₂ + +/-- Pigeonhole principle for pairwise disjoint sets: if `P : Fin m → Set α` is pairwise disjoint +and `X` is a finite set with `X.ncard < m`, then some `P j` is disjoint from `X`. -/ +theorem exists_disjoint_of_ncard_lt {α : Type*} {m : ℕ} {P : Fin m → Set α} {X : Set α} + (hdis : Pairwise (fun j₁ j₂ => Disjoint (P j₁) (P j₂))) (hfin : X.Finite) + (hlt : X.ncard < m) : + ∃ j : Fin m, Disjoint (P j) X := by + by_contra hno + push Not at hno + have hex : ∀ j : Fin m, ∃ x, x ∈ P j ∧ x ∈ X := fun j => + not_disjoint_iff.mp (hno j) + choose f hfP hfX using hex + have hinj : Injective f := by + intro j₁ j₂ hfj + by_contra hne + exact disjoint_left.mp (hdis hne) (hfP j₁) (hfj ▸ hfP j₂) + have hle : (range f).ncard ≤ X.ncard := + ncard_le_ncard (range_subset_iff.mpr hfX) hfin + rw [ncard_range_of_injective hinj, Nat.card_eq_fintype_card, Fintype.card_fin] at hle + omega + +/-- Pigeonhole principle for pairs in pairwise disjoint sets: if `C : Fin m → Set α` is pairwise +disjoint and `X` is a finite set with `X.ncard < 2 * m`, then some `C i ∩ X` has cardinality +`≤ 1`. -/ +theorem exists_inter_ncard_le_one_of_ncard_lt_two_mul {α : Type*} {m : ℕ} + {C : Fin m → Set α} {X : Set α} + (hdis : Pairwise (fun i₁ i₂ => Disjoint (C i₁) (C i₂))) (hfin : X.Finite) + (hlt : X.ncard < 2 * m) : + ∃ i : Fin m, (C i ∩ X).ncard ≤ 1 := by + by_contra hno + push Not at hno + have hex : ∀ i : Fin m, ∃ x ∈ C i ∩ X, ∃ y ∈ C i ∩ X, x ≠ y := fun i => + (one_lt_ncard (hfin.subset inter_subset_right)).mp (hno i) + choose f hf g hg hne using hex + let fg : Fin m ⊕ Fin m → α := Sum.elim f g + have hinj : Injective fg := by + rintro (i₁ | i₁) (i₂ | i₂) heq + · change f i₁ = f i₂ at heq + congr 1 + by_contra hne_i + exact Set.disjoint_left.mp (hdis hne_i) (hf i₁).1 (heq ▸ (hf i₂).1) + · change f i₁ = g i₂ at heq + exfalso + have hi : i₁ = i₂ := by + by_contra hne_i + exact Set.disjoint_left.mp (hdis hne_i) (hf i₁).1 (heq ▸ (hg i₂).1) + subst hi + exact hne i₁ heq + · change g i₁ = f i₂ at heq + exfalso + have hi : i₁ = i₂ := by + by_contra hne_i + exact Set.disjoint_left.mp (hdis hne_i) (hg i₁).1 (heq ▸ (hf i₂).1) + subst hi + exact hne i₁ heq.symm + · change g i₁ = g i₂ at heq + congr 1 + by_contra hne_i + exact Set.disjoint_left.mp (hdis hne_i) (hg i₁).1 (heq ▸ (hg i₂).1) + have hsub : range fg ⊆ X := by + rintro x ⟨i | i, rfl⟩ + · exact (hf i).2 + · exact (hg i).2 + have hle : (range fg).ncard ≤ X.ncard := ncard_le_ncard hsub hfin + rw [ncard_range_of_injective hinj, Nat.card_eq_fintype_card, Fintype.card_sum, + Fintype.card_fin] at hle + omega + +/-! ## Helper Lemmas on `clearedSubdrawing` -/ + +/-- For a `λ`-zone `Λ` around `z`, the vertex set of `H' = H ∩ (Σ - Λ)` is `H.V \ Λ` and its edge +set is `{e ∈ H.E | e ⊆ univ \ Λ}`. -/ +theorem clearedSubdrawing_V_and_E [T2Space S] {H : Drawing S} + {d : Set S → Set S → ℕ} {lam : ℕ} {z Λ : Set S} + (hZone : IsLambdaZoneAround H d lam z Λ) : + (clearedSubdrawing H Λ).V = H.V \ Λ ∧ + (clearedSubdrawing H Λ).E = {e | e ∈ H.E ∧ e ⊆ univ \ Λ} := by + have hU := clearedSubdrawing_U hZone + have hSub := clearedSubdrawing_isSubdrawing H Λ + have hE : (clearedSubdrawing H Λ).E = {e | e ∈ H.E ∧ e ⊆ univ \ Λ} := by + change (H.span _ _).E = _ + rw [H.span_E] + ext e + simp only [mem_inter_iff, mem_ofPred_eq] + tauto + refine ⟨subset_antisymm ?_ ?_, hE⟩ + · intro v hv + have hvU : v ∈ H.U \ Λ := hU ▸ (clearedSubdrawing H Λ).V_subset_U hv + exact ⟨hSub.1 hv, hvU.2⟩ + · rintro v ⟨hvV, hvΛ⟩ + exact Or.inl ⟨⟨hvV, mem_univ _, hvΛ⟩, hvV⟩ + +/-- Clearing a zone preserves its boundary circuit. -/ +theorem clearedSubdrawing_boundary [T2Space S] [ConnectedSpace S] {H : Drawing S} + {d : Set S → Set S → ℕ} {lam : ℕ} {z Λ : Set S} + (hZone : IsLambdaZoneAround H d lam z Λ) : + let C := (clearedSubdrawing H Λ).interSet (subBd Λ) + C = H.interSet (subBd Λ) ∧ C.IsCircuit ∧ C.U = subBd Λ := by + obtain ⟨hV, hE⟩ := clearedSubdrawing_V_and_E hZone + have hbd : subBd Λ ⊆ univ \ Λ := fun _ hx => + (isClosed_univ.sdiff hZone.isOpenDisc.1).closure_eq ▸ hx.2 + have hclosed : IsClosed (subBd Λ) := isClosed_closure.inter isClosed_closure + have heq : (clearedSubdrawing H Λ).interSet (subBd Λ) = H.interSet (subBd Λ) := by + refine Drawing.ext_of_V_E ?_ ?_ + · rw [Drawing.interSet_V_of_isClosed _ hclosed, Drawing.interSet_V_of_isClosed _ hclosed, hV] + ext x + simp only [mem_inter_iff, mem_sdiff] + exact ⟨fun ⟨⟨hxV, _⟩, hxbd⟩ => ⟨hxV, hxbd⟩, + fun ⟨hxV, hxbd⟩ => ⟨⟨hxV, (hbd hxbd).2⟩, hxbd⟩⟩ + · rw [Drawing.interSet_E, Drawing.interSet_E, hE] + ext e + simp only [mem_ofPred_eq] + exact ⟨fun ⟨⟨heE, _⟩, hebd⟩ => ⟨heE, hebd⟩, + fun ⟨heE, hebd⟩ => ⟨⟨heE, hebd.trans hbd⟩, hebd⟩⟩ + exact ⟨heq, heq.symm ▸ + interSet_isCircuit_and_U_of_isOArc hZone.isOArc_bd hclosed hZone.bd_subset_U⟩ + +/-- If `Γ` is a subdrawing of `H` and `Γ.U` is disjoint from a `λ`-zone `Λ`, then `Γ` is a +subdrawing of `clearedSubdrawing H Λ`. -/ +theorem isSubdrawing_clearedSubdrawing [T2Space S] {H Γ : Drawing S} + {d : Set S → Set S → ℕ} {lam : ℕ} {z Λ : Set S} + (hZone : IsLambdaZoneAround H d lam z Λ) (hΓ : Γ.IsSubdrawing H) (hdis : Disjoint Γ.U Λ) : + Γ.IsSubdrawing (clearedSubdrawing H Λ) := by + obtain ⟨hV, hE⟩ := clearedSubdrawing_V_and_E hZone + refine ⟨?_, ?_⟩ + · rw [hV] + exact fun v hv => ⟨hΓ.1 hv, disjoint_left.mp hdis (Γ.V_subset_U hv)⟩ + · rw [hE] + exact fun e he => ⟨hΓ.2 he, fun x hx => + ⟨mem_univ _, disjoint_left.mp hdis (Γ.closure_subset_U he (subset_closure hx))⟩⟩ + +/-- For a `λ`-zone `Λ` around `z`, `Λ` is a region of `clearedSubdrawing H Λ`, and every atom +`x' ∈ (clearedSubdrawing H Λ).A` with `x' ≠ Λ` belongs to `H.A`. -/ +theorem clearedSubdrawing_mem_R_and_atom [T2Space S] {H : Drawing S} + {d : Set S → Set S → ℕ} {lam : ℕ} {z Λ : Set S} + (hZone : IsLambdaZoneAround H d lam z Λ) : + Λ ∈ (clearedSubdrawing H Λ).R ∧ + ∀ x' ∈ (clearedSubdrawing H Λ).A, x' ≠ Λ → x' ∈ H.A := by + have hU := clearedSubdrawing_U hZone + have hSub := clearedSubdrawing_isSubdrawing H Λ + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hZone.isOpenDisc.1 + let O₂ : Set S := univ \ (H.U ∪ closure Λ) + have hO₂ : IsOpen O₂ := isOpen_univ.sdiff (H.isClosed_U.union isClosed_closure) + have hdisO : Disjoint Λ O₂ := + disjoint_left.mpr fun x hx hxO => hxO.2 (Or.inr (subset_closure hx)) + have hcompl : univ \ (clearedSubdrawing H Λ).U = Λ ∪ O₂ := by + rw [hU] + ext x + constructor + · rintro ⟨_, hx⟩ + by_cases hxΛ : x ∈ Λ + · exact Or.inl hxΛ + · refine Or.inr ⟨mem_univ _, ?_⟩ + rintro (hxU | hxcl) + · exact hx ⟨hxU, hxΛ⟩ + · rw [hclL] at hxcl + exact hx ⟨hZone.bd_subset_U (hxcl.resolve_left hxΛ), hxΛ⟩ + · rintro (hxΛ | ⟨_, hx⟩) + · exact ⟨mem_univ _, fun h => h.2 hxΛ⟩ + · exact ⟨mem_univ _, fun h => hx (Or.inl h.1)⟩ + obtain ⟨p, hp⟩ := IsOpenDisc.nonempty hZone.isOpenDisc + have hpU' : p ∉ (clearedSubdrawing H Λ).U := by + rw [hU] + exact fun h => h.2 hp + have hp_mem : p ∈ univ \ (clearedSubdrawing H Λ).U := ⟨mem_univ _, hpU'⟩ + have hcov' : connectedComponentIn (univ \ (clearedSubdrawing H Λ).U) p ⊆ Λ ∪ O₂ := by + rw [← hcompl] + exact connectedComponentIn_subset _ _ + have hΛ_eq : connectedComponentIn (univ \ (clearedSubdrawing H Λ).U) p = Λ := by + refine subset_antisymm ?_ ?_ + · exact isPreconnected_connectedComponentIn.subset_left_of_subset_union + hZone.isOpenDisc.1 hO₂ hdisO hcov' ⟨p, mem_connectedComponentIn hp_mem, hp⟩ + · refine hZone.isOpenDisc.isPathConnected.isConnected.isPreconnected.subset_connectedComponentIn + hp ?_ + rw [hcompl] + exact subset_union_left + have hΛR : Λ ∈ (clearedSubdrawing H Λ).R := + (mem_R_iff (clearedSubdrawing H Λ)).mpr ⟨p, hpU', hΛ_eq.symm⟩ + refine ⟨hΛR, ?_⟩ + rintro x' ((⟨v, hv, rfl⟩ | he) | hr) hne + · exact Or.inl (Or.inl ⟨v, hSub.1 hv, rfl⟩) + · exact Or.inl (Or.inr (hSub.2 he)) + · exact Or.inr ((clearedSubdrawing_region_eq_or_mem_R hZone hr).resolve_left hne) + +/-! ## Helper Lemmas on Separations, Paths, Circuits, and Zones -/ + +/-- If `P` is a path of `H` between `v` and `u`, then `P.U` is preconnected. -/ +theorem isPreconnected_of_isPathBetween [T2Space S] {P : Drawing S} {v u : S} + (hP : P.IsPathBetween v u) : IsPreconnected P.U := by + by_cases hvu : v = u + · subst hvu + obtain ⟨W, hW, hPV, hPE⟩ := hP + cases W with + | nil _ => + have hV : P.V = {v} := by + rw [hPV] + ext x + simp [GraphWalk.support_nil] + have hE : P.E = ∅ := by + rw [hPE] + ext e + simp [GraphWalk.edges] + have hU : P.U = {v} := by + rw [P.U_eq, hV, hE] + simp + rw [hU] + exact isPreconnected_singleton + | cons h r => + exact absurd r.end_mem_support (List.nodup_cons.mp hW).1 + · obtain ⟨φ, -⟩ := isLine_of_isPathBetween hP hvu + have h_eq : P.U = (fun z => (φ z).1) '' univ := by + ext x + exact ⟨fun hx => ⟨φ.symm ⟨x, hx⟩, mem_univ _, by simp⟩, + fun ⟨z, _, hz⟩ => hz ▸ (φ z).2⟩ + rw [h_eq] + exact isPreconnected_univ.image _ (continuous_subtype_val.comp φ.continuous).continuousOn + +/-- If `(A, B)` is a separation of `H.toHypergraph` and `P` is a path of `H` with initial vertex +`v ∈ A.vertexSet` and `Disjoint P.V (A ∩ B).vertexSet`, then `P.V ⊆ A.vertexSet \ B.vertexSet`. -/ +theorem path_vertexSet_subset_diff {H P : Drawing S} {A B : Hypergraph S (Set S)} {v u : S} + (hsep : H.toHypergraph.IsSeparation A B) (hP : P.IsPathBetween v u) (hPs : P.IsSubdrawing H) + (hvA : v ∈ A.vertexSet) (hdis : Disjoint P.V (A ∩ B).vertexSet) : + P.V ⊆ A.vertexSet \ B.vertexSet := by + obtain ⟨W, _, hPV, _⟩ := hP + have hwalk : ∀ {x y : S} (W' : GraphWalk P.toGraph x y), + (∀ z ∈ W'.support, z ∈ P.V) → x ∈ A.vertexSet → + ∀ z ∈ W'.support, z ∈ A.vertexSet ∧ z ∉ B.vertexSet := by + intro x y W' + induction W' with + | @nil x hx => + intro hsup hxA z hz + rw [GraphWalk.support_nil, List.mem_singleton] at hz + subst hz + have hxP : z ∈ P.V := hsup z (by simp) + refine ⟨hxA, fun hxB => Set.disjoint_left.mp hdis hxP ⟨hxA, hxB⟩⟩ + | @cons x w y e hlink W' ih => + intro hsup hxA z hz + have hxP : x ∈ P.V := hsup x (by simp) + have hwP : w ∈ P.V := hsup w (List.mem_cons_of_mem x W'.start_mem_support) + have hxB : x ∉ B.vertexSet := fun hxB => Set.disjoint_left.mp hdis hxP ⟨hxA, hxB⟩ + have heP : e ∈ P.E := hlink.1 + have heH : e ∈ H.E := hPs.2 heP + have hxe_cl : x ∈ closure e := by + have : x ∈ closure e ∩ P.V := hlink.2.2.2 ▸ mem_insert x {w} + exact this.1 + have hwe_cl : w ∈ closure e := by + have : w ∈ closure e ∩ P.V := hlink.2.2.2 ▸ mem_insert_of_mem x rfl + exact this.1 + have hinc_x : H.toHypergraph.Inc e x := + (PaintingOrDrawing.toHypergraph_inc (Γ := PaintingOrDrawing.drawing H)).mpr + ⟨heH, hPs.1 hxP, hxe_cl⟩ + have hinc_w : H.toHypergraph.Inc e w := + (PaintingOrDrawing.toHypergraph_inc (Γ := PaintingOrDrawing.drawing H)).mpr + ⟨heH, hPs.1 hwP, hwe_cl⟩ + have heU : e ∈ A.edgeSet ∪ B.edgeSet := by + rw [hsep.edgeSet_union] + exact heH + have heA : e ∈ A.edgeSet := by + rcases heU with heA | heB + · exact heA + · exfalso + have hincB : B.Inc e x := (inc_iff_of_le hsep.right_le heB).mpr hinc_x + exact hxB (B.vertex_mem_of_inc hincB) + have hwA : w ∈ A.vertexSet := + A.vertex_mem_of_inc ((inc_iff_of_le hsep.left_le heA).mpr hinc_w) + rw [GraphWalk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz' + · exact ⟨hxA, hxB⟩ + · exact ih (fun q hq => hsup q (by simp [hq])) hwA z hz' + intro z hzP + have hzW : z ∈ W.support := by rwa [hPV] at hzP + exact hwalk W (fun q hq => by rw [hPV]; exact hq) hvA z hzW + +/-- If `(A, B)` is a separation of `H.toHypergraph` and `C` is a circuit of `H` with +`(C.V ∩ (A ∩ B).vertexSet).ncard ≤ 1`, and either some vertex of `C` is not in `B.vertexSet` or +some edge of `C` is in `A.edgeSet`, then `C.V ⊆ A.vertexSet`, `C.E ⊆ A.edgeSet`, and +`(B.vertexSet ∩ C.V).ncard ≤ 1`. -/ +theorem circuit_subset_of_inter_ncard_le_one [T2Space S] {H C : Drawing S} + {A B : Hypergraph S (Set S)} + (hsep : H.toHypergraph.IsSeparation A B) (hC : C.IsCircuit) (hCs : C.IsSubdrawing H) + (hle : (C.V ∩ (A ∩ B).vertexSet).ncard ≤ 1) + (hside : (∃ w₀ ∈ C.V, w₀ ∉ B.vertexSet) ∨ (∃ e₀ ∈ C.E, e₀ ∈ A.edgeSet)) : + (C.V ⊆ A.vertexSet ∧ C.E ⊆ A.edgeSet) ∧ (B.vertexSet ∩ C.V).ncard ≤ 1 := by + have hC' := hC + obtain ⟨u, W_C, ⟨hnd, hed⟩, hpos, hCV, hCE⟩ := hC + have hv_inc : ∀ v ∈ C.V, ∃ e ∈ C.E, v ∈ closure e := by + intro v hv + rw [hCV] at hv + cases W_C with + | nil _ => exact absurd hpos (Nat.lt_irrefl 0) + | @cons _ w _ e₀ hlink W' => + by_cases hvu : v = u + · subst hvu + have hue₀ : v ∈ closure e₀ := by + have : v ∈ closure e₀ ∩ C.V := hlink.2.2.2 ▸ mem_insert v {w} + exact this.1 + exact ⟨e₀, by rw [hCE]; exact List.mem_cons_self, hue₀⟩ + · have hv_mem : v ∈ (GraphWalk.cons hlink W').support := hv + have hex_link : ∀ {b y : S} (W₁ : GraphWalk C.toGraph b y) {a : S} {f₀ : Set S} + (hlink₀ : C.toGraph.IsLink f₀ a b), + v ≠ a → v ∈ (GraphWalk.cons hlink₀ W₁).support → + ∃ x e, C.toGraph.IsLink e x v ∧ e ∈ (GraphWalk.cons hlink₀ W₁).edges := by + intro b y W₁ + induction W₁ with + | nil hby => + intro a f₀ hlink₀ hva hv_m + rw [GraphWalk.support_cons, GraphWalk.support_nil, List.mem_cons, + List.mem_singleton] at hv_m + rcases hv_m with rfl | rfl + · exact absurd rfl hva + · exact ⟨a, f₀, hlink₀, List.mem_cons_self⟩ + | @cons b y z e₁ hlink₁ W'' ih => + intro a f₀ hlink₀ hva hv_m + rw [GraphWalk.support_cons, List.mem_cons] at hv_m + rcases hv_m with rfl | hv' + · exact absurd rfl hva + · by_cases hvb : v = b + · subst hvb + exact ⟨a, f₀, hlink₀, List.mem_cons_self⟩ + · obtain ⟨x, e, hl, hem⟩ := ih hlink₁ hvb hv' + exact ⟨x, e, hl, List.mem_cons_of_mem f₀ hem⟩ + obtain ⟨x, e, hlink', he_mem⟩ := hex_link W' hlink hvu hv_mem + have hve : v ∈ closure e := by + have : v ∈ closure e ∩ C.V := hlink'.2.2.2 ▸ mem_insert_of_mem x rfl + exact this.1 + exact ⟨e, by rw [hCE]; exact he_mem, hve⟩ + have hCE_sub : C.E ⊆ A.edgeSet := by + by_contra hnot_sub + obtain ⟨eB, heBC, heB_notA⟩ := not_subset.mp hnot_sub + have heBH : eB ∈ H.E := hCs.2 heBC + have heBU : eB ∈ A.edgeSet ∪ B.edgeSet := by + rw [hsep.edgeSet_union] + exact heBH + have heBB : eB ∈ B.edgeSet := heBU.resolve_left heB_notA + have hex_eA : ∃ eA ∈ C.E, eA ∈ A.edgeSet := by + rcases hside with ⟨w₀, hw₀C, hw₀B⟩ | hex + · obtain ⟨e₀, he₀C, hw₀e₀⟩ := hv_inc w₀ hw₀C + have he₀H : e₀ ∈ H.E := hCs.2 he₀C + have hinc₀ : H.toHypergraph.Inc e₀ w₀ := + (PaintingOrDrawing.toHypergraph_inc (Γ := PaintingOrDrawing.drawing H)).mpr + ⟨he₀H, hCs.1 hw₀C, hw₀e₀⟩ + have he₀U : e₀ ∈ A.edgeSet ∪ B.edgeSet := by + rw [hsep.edgeSet_union] + exact he₀H + refine ⟨e₀, he₀C, he₀U.resolve_right fun he₀B => ?_⟩ + exact hw₀B (B.vertex_mem_of_inc ((inc_iff_of_le hsep.right_le he₀B).mpr hinc₀)) + · exact hex + obtain ⟨eA, heAC, heAA⟩ := hex_eA + set S_AB := C.V ∩ (A ∩ B).vertexSet + have hfin_AB : S_AB.Finite := C.finite_V.subset inter_subset_left + have hCU_oArc : IsOArc C.U := isOArc_of_isCircuit hC' + have hconn_Z : IsPreconnected (C.U \ S_AB) := by + by_cases hne : S_AB.Nonempty + · obtain ⟨z₀, hz₀⟩ := hne + have hsing : S_AB = {z₀} := + (eq_of_subset_of_ncard_le (singleton_subset_iff.mpr hz₀) + (by rw [ncard_singleton]; exact hle) hfin_AB).symm + rw [hsing] + exact (isPathConnected_oArc_diff hCU_oArc (C.V_subset_U hz₀.1)).isConnected.isPreconnected + · rw [not_nonempty_iff_eq_empty.mp hne, sdiff_empty] + exact IsOArc.isPreconnected hCU_oArc + set U_A := ⋃ e ∈ C.E ∩ A.edgeSet, closure e + set U_B := ⋃ e ∈ C.E ∩ B.edgeSet, closure e + have hcl_A : IsClosed U_A := + (C.finite_edges.subset inter_subset_left).isClosed_biUnion fun _ _ => isClosed_closure + have hcl_B : IsClosed U_B := + (C.finite_edges.subset inter_subset_left).isClosed_biUnion fun _ _ => isClosed_closure + have hcov : C.U \ S_AB ⊆ U_A ∪ U_B := by + rintro x ⟨hxU, -⟩ + by_cases hxV : x ∈ C.V + · obtain ⟨e, heC, hxe⟩ := hv_inc x hxV + have heU : e ∈ A.edgeSet ∪ B.edgeSet := by + rw [hsep.edgeSet_union] + exact hCs.2 heC + rcases heU with heA' | heB' + · exact Or.inl (mem_iUnion₂.mpr ⟨e, ⟨heC, heA'⟩, hxe⟩) + · exact Or.inr (mem_iUnion₂.mpr ⟨e, ⟨heC, heB'⟩, hxe⟩) + · obtain ⟨e, heC, hxe⟩ := C.exists_edge_of_mem hxU hxV + have heU : e ∈ A.edgeSet ∪ B.edgeSet := by + rw [hsep.edgeSet_union] + exact hCs.2 heC + rcases heU with heA' | heB' + · exact Or.inl (mem_iUnion₂.mpr ⟨e, ⟨heC, heA'⟩, subset_closure hxe⟩) + · exact Or.inr (mem_iUnion₂.mpr ⟨e, ⟨heC, heB'⟩, subset_closure hxe⟩) + obtain ⟨pA, hpA⟩ := heAC.1 + have hpA_Z : pA ∈ C.U \ S_AB := + ⟨(heAC.2.1 hpA).1, fun h => (heAC.2.1 hpA).2 h.1⟩ + have hpA_UA : pA ∈ U_A := mem_iUnion₂.mpr ⟨eA, ⟨heAC, heAA⟩, subset_closure hpA⟩ + obtain ⟨pB, hpB⟩ := heBC.1 + have hpB_Z : pB ∈ C.U \ S_AB := + ⟨(heBC.2.1 hpB).1, fun h => (heBC.2.1 hpB).2 h.1⟩ + have hpB_UB : pB ∈ U_B := mem_iUnion₂.mpr ⟨eB, ⟨heBC, heBB⟩, subset_closure hpB⟩ + obtain ⟨z, ⟨hzU, hz_notAB⟩, hzUA, hzUB⟩ := + isPreconnected_closed_iff.mp hconn_Z U_A U_B hcl_A hcl_B hcov + ⟨pA, hpA_Z, hpA_UA⟩ ⟨pB, hpB_Z, hpB_UB⟩ + obtain ⟨fA, ⟨hfAC, hfAA⟩, hzfA⟩ := mem_iUnion₂.mp hzUA + obtain ⟨fB, ⟨hfBC, hfBB⟩, hzfB⟩ := mem_iUnion₂.mp hzUB + have hf_ne : fA ≠ fB := by + intro heq + subst heq + have : fA ∈ (A ∩ B).edgeSet := ⟨hfAA, hfBB⟩ + rw [hsep.edgeSet_inter_eq] at this + exact this + have hzCV : z ∈ C.V := by + by_contra hzCV + have hzfA' : z ∈ fA := by rw [← C.closure_diff_V hfAC]; exact ⟨hzfA, hzCV⟩ + have hzfB' : z ∈ fB := by rw [← C.closure_diff_V hfBC]; exact ⟨hzfB, hzCV⟩ + exact hf_ne (C.edge_eq_of_mem hfAC hfBC hzfA' hzfB') + have hincA : H.toHypergraph.Inc fA z := + (PaintingOrDrawing.toHypergraph_inc (Γ := PaintingOrDrawing.drawing H)).mpr + ⟨hCs.2 hfAC, hCs.1 hzCV, hzfA⟩ + have hincB : H.toHypergraph.Inc fB z := + (PaintingOrDrawing.toHypergraph_inc (Γ := PaintingOrDrawing.drawing H)).mpr + ⟨hCs.2 hfBC, hCs.1 hzCV, hzfB⟩ + have hzA : z ∈ A.vertexSet := + A.vertex_mem_of_inc ((inc_iff_of_le hsep.left_le hfAA).mpr hincA) + have hzB : z ∈ B.vertexSet := + B.vertex_mem_of_inc ((inc_iff_of_le hsep.right_le hfBB).mpr hincB) + exact hz_notAB ⟨hzCV, hzA, hzB⟩ + have hCV_sub : C.V ⊆ A.vertexSet := by + intro v hv + obtain ⟨e, heC, hve⟩ := hv_inc v hv + have hinc : H.toHypergraph.Inc e v := + (PaintingOrDrawing.toHypergraph_inc (Γ := PaintingOrDrawing.drawing H)).mpr + ⟨hCs.2 heC, hCs.1 hv, hve⟩ + exact A.vertex_mem_of_inc ((inc_iff_of_le hsep.left_le (hCE_sub heC)).mpr hinc) + refine ⟨⟨hCV_sub, hCE_sub⟩, ?_⟩ + have hsub_inter : B.vertexSet ∩ C.V ⊆ C.V ∩ (A ∩ B).vertexSet := + fun x ⟨hxB, hxC⟩ => ⟨hxC, hCV_sub hxC, hxB⟩ + exact (ncard_le_ncard hsub_inter (C.finite_V.subset inter_subset_left)).trans hle + +/-- If `C` is a circuit of `H` bounding a closed disc `Δ ⊆ Δ₁` (`subBd Δ = C.U`), and `P` is a path +of `H` between `v ∈ Δ` and `u ∈ subBd Δ₁`, then `(C.V ∩ P.V).Nonempty`. -/ +theorem circuit_inter_path_nonempty [T2Space S] (hS : IsClosedSurface S) {H C P : Drawing S} + {Δ Δ₁ : Set S} {v u : S} + (hΔ : IsClosedDisc Δ) (_hΔ₁ : IsClosedDisc Δ₁) (hΔ_sub : Δ ⊆ Δ₁) + (hCs : C.IsSubdrawing H) (hbd : subBd Δ = C.U) + (hP : P.IsPathBetween v u) (hPs : P.IsSubdrawing H) + (hv : v ∈ Δ) (hu : u ∈ subBd Δ₁) : + (C.V ∩ P.V).Nonempty := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + refine nonempty_inter_V_of_nonempty_inter_U hCs hPs ?_ + have hP' := hP + obtain ⟨W, _, hPV, _⟩ := hP + have hvP : v ∈ P.U := P.V_subset_U (by rw [hPV]; exact W.start_mem_support) + have huP : u ∈ P.U := P.V_subset_U (by rw [hPV]; exact W.end_mem_support) + by_cases huC : u ∈ C.U + · exact ⟨u, huC, huP⟩ + · have hu_not_Δ : u ∉ Δ := by + intro huΔ + have hfrΔ : frontier Δ = C.U := by rw [subBd_eq_frontier', hbd] + have hclΔ : closure Δ = Δ := hΔ.isClosed.closure_eq + have hu_int : u ∈ interior Δ := by + by_contra hu_nint + have : u ∈ frontier Δ := ⟨hclΔ.symm ▸ huΔ, hu_nint⟩ + exact huC (hfrΔ ▸ this) + have hu_int₁ : u ∈ interior Δ₁ := interior_mono hΔ_sub hu_int + have hfr₁ : u ∈ frontier Δ₁ := by rwa [subBd_eq_frontier'] + exact hfr₁.2 hu_int₁ + have hconnP : IsPreconnected P.U := isPreconnected_of_isPathBetween hP' + have hnot_dis : ¬ Disjoint P.U (frontier Δ) := by + intro hdis + exact hu_not_Δ (subset_of_disjoint_frontier hconnP hΔ.isClosed hdis hvP hv huP) + rw [subBd_eq_frontier', hbd] at hnot_dis + obtain ⟨x, hxP, hxC⟩ := not_disjoint_iff.mp hnot_dis + exact ⟨x, hxC, hxP⟩ + +/-- If `Δ₁ \ subBd Δ₁` is a `λ₁`-zone around `z` in `H`, and `C` is a circuit of `H` bounding a +closed disc `Δ ⊆ Δ₁` with `z ⊆ Δ \ subBd Δ`, then `Δ \ subBd Δ` is a `λ₁`-zone around `z` in `H`. -/ +theorem zone_of_closedDisc_subset [T2Space S] (hS : IsClosedSurface S) {H C : Drawing S} + {d : Set S → Set S → ℕ} {lam₁ : ℕ} {z Δ Δ₁ : Set S} + (hZone₁ : IsLambdaZoneAround H d lam₁ z (Δ₁ \ subBd Δ₁)) + (hΔ₁ : IsClosedDisc Δ₁) (hΔ : IsClosedDisc Δ) (hΔ_sub : Δ ⊆ Δ₁) + (hC : C.IsCircuit) (hCs : C.IsSubdrawing H) (hbd : subBd Δ = C.U) + (hz : z ⊆ Δ \ subBd Δ) : + IsLambdaZoneAround H d lam₁ z (Δ \ subBd Δ) := by + obtain ⟨hOD, hcl_eq, hbd_eq⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hΔ + obtain ⟨_, hcl₁_eq, _⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hΔ₁ + refine ⟨hZone₁.z_mem, hOD, hz, ?_, ?_, ?_, ?_, hZone₁.two_le_of_edge⟩ + · rw [hbd_eq, hbd] + exact isOArc_of_isCircuit hC + · rw [hcl_eq] + exact hΔ + · rw [hbd_eq, hbd] + exact hCs.U_subset + · intro x hx hsub + rw [hcl_eq] at hsub + exact hZone₁.dist_le x hx (hcl₁_eq.symm ▸ hsub.trans hΔ_sub) + +/-- If `Δ \ subBd Δ` is a `λ₁`-zone around `z` in `H` (`IsClosedDisc Δ`), `Λ₂ = Δ₂ \ subBd Δ₂` is a +`λ`-zone around `z` (`IsClosedDisc Δ₂`) with `Δ₂ ⊆ Δ`, and `(T', d')` is obtained by clearing `Λ₂`, +then `Δ \ subBd Δ` is a `λ₁`-zone around `Λ₂` in `clearedSubdrawing H Λ₂`. -/ +theorem cleared_zone_of_closedDisc_subset + [T2Space S] (hS : IsClosedSurface S) + {H C : Drawing S} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {θ lam lam₁ : ℕ} {z Δ Δ₂ : Set S} + (hZone : IsLambdaZoneAround H d lam₁ z (Δ \ subBd Δ)) + (hZone₂ : IsLambdaZoneAround H d lam z (Δ₂ \ subBd Δ₂)) + (hCleared : IsClearedTangle H T d θ lam (Δ₂ \ subBd Δ₂) T' d') + (hΔ : IsClosedDisc Δ) (_hΔ₂ : IsClosedDisc Δ₂) (hΔ₂_sub : Δ₂ ⊆ Δ) + (_hC : C.IsCircuit) (hCs : C.IsSubdrawing H) (hbd : subBd Δ = C.U) : + IsLambdaZoneAround (clearedSubdrawing H (Δ₂ \ subBd Δ₂)) d' lam₁ + (Δ₂ \ subBd Δ₂) (Δ \ subBd Δ) := by + set Λ₂ := Δ₂ \ subBd Δ₂ + set H' := clearedSubdrawing H Λ₂ + obtain ⟨hOD, _, hbd_eq⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hΔ + obtain ⟨hΛ₂R, hatom'⟩ := clearedSubdrawing_mem_R_and_atom hZone₂ + have hΛ₂A : Λ₂ ∈ H'.A := Or.inr hΛ₂R + have hΛ₂_sub : Λ₂ ⊆ Δ \ subBd Δ := by + have h₁ : Λ₂ = interior Δ₂ := by + change Δ₂ \ subBd Δ₂ = interior Δ₂ + rw [← subBd_eq_frontier'] + exact self_sdiff_frontier _ + have h₂ : Δ \ subBd Δ = interior Δ := by + rw [← subBd_eq_frontier'] + exact self_sdiff_frontier _ + rw [h₁, h₂] + exact interior_mono hΔ₂_sub + obtain ⟨_, K', ins', _, _, hd'_eq⟩ := hCleared.hasMetric + refine ⟨hΛ₂A, hOD, hΛ₂_sub, hZone.isOArc_bd, hZone.isClosedDisc_closure, ?_, ?_, ?_⟩ + · rw [hbd_eq, hbd, clearedSubdrawing_U hZone₂] + intro x hxC + refine ⟨hCs.U_subset hxC, fun hxΛ₂ => ?_⟩ + exact (hΛ₂_sub hxΛ₂).2 (hbd ▸ hxC) + · intro x' hx' hsub + by_cases hx'Λ₂ : x' = Λ₂ + · subst hx'Λ₂ + rw [hd'_eq Λ₂ hΛ₂A Λ₂ hΛ₂A] + simp [tangleMetric] + · have hx'H : x' ∈ H.A := hatom' x' hx' hx'Λ₂ + have hle := (hCleared.dist_bounds z hZone₂.z_mem x' hx'H Λ₂ hΛ₂A x' hx' + hZone₂.z_subset subset_rfl).2 + exact hle.trans (hZone.dist_le x' hx'H hsub) + · intro hΛ₂E + obtain ⟨p, hp⟩ := hΛ₂E.1 + exact absurd (hΛ₂E.2.1 hp).1 (region_subset hΛ₂R hp) + +/-! ## Proof of (7.8) -/ + +/-- If `D` is a circuit of a radial drawing `K` of `H` with `D.length < 2 * θ`, and `x, y ∈ A(H)` +both meet `ins(D)`, then `2 * d(x, y) ≤ D.length` and `d(x, y) ≤ |V(D) ∩ V(H)|`. -/ +theorem tangleMetric_le_of_circuit [T2Space S] (hS : IsClosedSurface S) {H K D : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ins : Drawing S → Set S} + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hD : D.IsCircuit) (hDs : D.IsSubdrawing K) (hlen : D.length < 2 * θ) + {x y : Set S} (hx : x ∈ H.A) (hy : y ∈ H.A) + (hxD : (x ∩ ins D).Nonempty) (hyD : (y ∩ ins D).Nonempty) : + 2 * tangleMetric H K ins θ x y ≤ D.length ∧ + tangleMetric H K ins θ x y ≤ (D.V ∩ H.V).ncard := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hD' := hD + obtain ⟨u, W_D, ⟨_, hed⟩, _, hDV, hDE⟩ := hD + obtain ⟨W, hs, he⟩ := hDs.exists_walk_up W_D + have hWD_eq : walkDrawing K W = D := by + apply Drawing.ext_of_V_E + · rw [walkDrawing_V, hs, hDV] + · rw [walkDrawing_E, he, hDE] + have hWlen : W.length = D.length := by + rw [Drawing.length, hDE, ← he] + have h : {e | e ∈ W.edges} = (W.edges.toFinset : Set (Set S)) := by ext; simp + rw [h, ncard_coe_finset, List.toFinset_card_of_nodup (he ▸ hed)] + rfl + have hWlt : W.length < 2 * θ := hWlen ▸ hlen + have hinsD_sub : ins D ⊆ insWalk ins K W := by + intro p hp + refine Or.inr (mem_iUnion₂.mpr ⟨D, ⟨hD', ?_⟩, hp⟩) + rw [hWD_eq] + exact ⟨subset_rfl, subset_rfl⟩ + obtain ⟨x', hx', -⟩ := existsUnique_correspondingAtom hK hx + obtain ⟨y', hy', -⟩ := existsUnique_correspondingAtom hK hy + have hx'W : x' ⊆ insWalk ins K W := + (theorem_3_1_proof hS hK hd hx' W hWlt).mpr (hxD.mono (inter_subset_inter_right x hinsD_sub)) + have hy'W : y' ⊆ insWalk ins K W := + (theorem_3_1_proof hS hK hd hy' W hWlt).mpr (hyD.mono (inter_subset_inter_right y hinsD_sub)) + have h2le : 2 * tangleMetric H K ins θ x y ≤ D.length := by + rw [← hWlen] + exact two_mul_tangleMetric_le_walk_length hK hx' hy' W hWlt hx'W hy'W + have hDeq := (circuit_length_eq_two_mul_ncard hK.2.1 hD' hDs).1 + refine ⟨h2le, ?_⟩ + omega + +/-- Combined application of (7.4) and (7.6) for a separation `(A₀, B₀) ∈ T₀`, a circuit `C₀` +bounding a closed disc `Δ₀` whose interior `Δ₀ \ subBd Δ₀` is a `lam₀`-zone around `z₀`, and a path +`P₀` starting at `v₀ ∈ Δ₀ ∩ A₀.vertexSet` disjoint from `(A₀ ∩ B₀).vertexSet`. -/ +private theorem circuit_of_sep_in_zone + [T2Space S] (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H₀ K₀ C₀ P₀ : Drawing S} {θ₀ lam₀ : ℕ} + {T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d₀ : Set S → Set S → ℕ} {ins₀ : Drawing S → Set S} + {A₀ B₀ : Hypergraph S (Set S)} {z₀ Δ₀ : Set S} {v₀ u₀ : S} + (hMetric₀ : HasTangleMetric H₀ θ₀ T₀ d₀) + (hK₀ : (PaintingOrDrawing.drawing H₀).IsRadialDrawing K₀) + (hd₀ : IsDerivedSlope (PaintingOrDrawing.drawing H₀) K₀ θ₀ T₀ ins₀) + (hAB₀ : (A₀, B₀) ∈ T₀) + (hZone₀ : IsLambdaZoneAround H₀ d₀ lam₀ z₀ (Δ₀ \ subBd Δ₀)) + (hΔ₀ : IsClosedDisc Δ₀) + (hC₀ : C₀.IsCircuit) (hC₀s : C₀.IsSubdrawing H₀) (hbd₀ : subBd Δ₀ = C₀.U) + (hord₀ : separationOrder A₀ B₀ + lam₀ < θ₀) + (hP₀ : P₀.IsPathBetween v₀ u₀) (hP₀s : P₀.IsSubdrawing H₀) + (hv₀_Δ : v₀ ∈ Δ₀) (hv₀_A : v₀ ∈ A₀.vertexSet) + (hdis_P : Disjoint P₀.V (A₀ ∩ B₀).vertexSet) + (hne_CP : (C₀.V ∩ P₀.V).Nonempty) + (hle_C : (C₀.V ∩ (A₀ ∩ B₀).vertexSet).ncard ≤ 1) : + ∃ D₀ : Drawing S, D₀.IsCircuit ∧ D₀.IsSubdrawing K₀ ∧ D₀.length < 2 * θ₀ ∧ + D₀.V ∩ H₀.V ⊆ (A₀ ∩ B₀).vertexSet ∧ Δ₀ ⊆ ins₀ D₀ ∧ P₀.U ⊆ ins₀ D₀ \ D₀.U := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hsep₀ : H₀.toHypergraph.IsSeparation A₀ B₀ := hMetric₀.1.2.1.isSeparation hAB₀ + have hPV_sub : P₀.V ⊆ A₀.vertexSet \ B₀.vertexSet := + path_vertexSet_subset_diff hsep₀ hP₀ hP₀s hv₀_A hdis_P + obtain ⟨w₀, hw₀C, hw₀P⟩ := hne_CP + have hw₀B : w₀ ∉ B₀.vertexSet := (hPV_sub hw₀P).2 + obtain ⟨hC₀_A, hBC₀⟩ := + circuit_subset_of_inter_ncard_le_one hsep₀ hC₀ hC₀s hle_C (Or.inl ⟨w₀, hw₀C, hw₀B⟩) + obtain ⟨D₀, hD₀, hD₀s, hD₀len, hD₀V, hCU_sub⟩ := + theorem_7_4_proof hS hConn hMetric₀.1 hK₀ hd₀ hAB₀ hC₀ hC₀s hC₀_A hBC₀ + have hDeq := (circuit_length_eq_two_mul_ncard hK₀.2.1 hD₀ hD₀s).1 + have hfin_AB : (A₀ ∩ B₀).vertexSet.Finite := + H₀.finite_V.subset hsep₀.left_le.vertexSet_subset |>.subset inter_subset_left + have hncard_le : (D₀.V ∩ H₀.V).ncard ≤ (A₀ ∩ B₀).vertexSet.ncard := + ncard_le_ncard hD₀V hfin_AB + change (A₀ ∩ B₀).vertexSet.ncard + lam₀ < θ₀ at hord₀ + have hD₀len_lam : D₀.length < 2 * (θ₀ - lam₀) := by omega + obtain ⟨_, hcl₀_eq, hbd₀_eq⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hΔ₀ + have hbd_sub : subBd (Δ₀ \ subBd Δ₀) ⊆ ins₀ D₀ := by + rw [hbd₀_eq, hbd₀] + exact hCU_sub + have hcl_sub : closure (Δ₀ \ subBd Δ₀) ⊆ ins₀ D₀ := + theorem_7_6_proof hS hConn hMetric₀ hK₀ hd₀ hZone₀ hD₀ hD₀s hD₀len_lam hbd_sub + have hΔ₀_sub : Δ₀ ⊆ ins₀ D₀ := hcl₀_eq ▸ hcl_sub + obtain ⟨hD₀disc, hD₀bd, -⟩ := hd₀ D₀ hD₀ hD₀s hD₀len + have hfrD₀ : frontier (ins₀ D₀) = D₀.U := by rw [subBd_eq_frontier', hD₀bd] + have hUU₀ : H₀.U ∩ K₀.U = H₀.V := hK₀.2.1.1 + have hdis_PU_DU : Disjoint P₀.U D₀.U := by + refine Set.disjoint_left.mpr fun x hxP hxD => ?_ + have hxHV : x ∈ H₀.V := by + have : x ∈ H₀.U ∩ K₀.U := ⟨hP₀s.U_subset hxP, hD₀s.U_subset hxD⟩ + rwa [hUU₀] at this + have hxPV : x ∈ P₀.V := by + by_contra hxPV + obtain ⟨e, heP, hxe⟩ := P₀.exists_edge_of_mem hxP hxPV + exact ((hP₀s.2 heP).2.1 hxe).2 hxHV + have hxDV : x ∈ D₀.V := by + by_contra hxDV + obtain ⟨g, hgD, hxg⟩ := D₀.exists_edge_of_mem hxD hxDV + exact ((hD₀s.2 hgD).2.1 hxg).2 (hK₀.2.1.2.1 hxHV) + exact Set.disjoint_left.mp hdis_P hxPV (hD₀V ⟨hxDV, hxHV⟩) + have hP₀' := hP₀ + obtain ⟨W_P, _, hPV_iff, _⟩ := hP₀ + have hv₀P : v₀ ∈ P₀.U := P₀.V_subset_U (by rw [hPV_iff]; exact W_P.start_mem_support) + have hPU_sub : P₀.U ⊆ ins₀ D₀ := + subset_of_disjoint_frontier (isPreconnected_of_isPathBetween hP₀') hD₀disc.isClosed + (hfrD₀ ▸ hdis_PU_DU) hv₀P (hΔ₀_sub hv₀_Δ) + refine ⟨D₀, hD₀, hD₀s, hD₀len, hD₀V, hΔ₀_sub, fun x hxP => ⟨hPU_sub hxP, ?_⟩⟩ + exact Set.disjoint_left.mp hdis_PU_DU hxP + +/-- If `D` is a circuit of a radial drawing `K'` of `H' = clearedSubdrawing H Λ₂` with +`|V(D) ∩ V(H')| < θ - 4λ - 2` and `Δ₂ ⊆ ins' D`, then `(H.inter (ins' D), H.interOutside (ins' D)) ∈ +T` +and its separator vertex set is `D.V ∩ H'.V`. -/ +private theorem inter_ins_mem_of_cleared [T2Space S] (hS : IsClosedSurface S) + {H K' D : Drawing S} {θ lam : ℕ} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {ins' : Drawing S → Set S} {z Δ₂ : Set S} + (hMetric : HasTangleMetric H θ T d) + (hZone₂ : IsLambdaZoneAround H d lam z (Δ₂ \ subBd Δ₂)) + (hCleared : IsClearedTangle H T d θ lam (Δ₂ \ subBd Δ₂) T' d') + (hK' : (PaintingOrDrawing.drawing (clearedSubdrawing H (Δ₂ \ subBd Δ₂))).IsRadialDrawing K') + (hd' : IsDerivedSlope (PaintingOrDrawing.drawing (clearedSubdrawing H (Δ₂ \ subBd Δ₂))) + K' (θ - 4 * lam - 2) T' ins') + (hD : D.IsCircuit) (hDs : D.IsSubdrawing K') + (hlen : D.length < 2 * (θ - 4 * lam - 2)) + (hΔ₂_sub : Δ₂ ⊆ ins' D) : + ((PaintingOrDrawing.drawing H).inter (ins' D), + (PaintingOrDrawing.drawing H).interOutside (ins' D)) ∈ T ∧ + ((PaintingOrDrawing.drawing H).inter (ins' D) ∩ + (PaintingOrDrawing.drawing H).interOutside (ins' D)).vertexSet ⊆ + D.V ∩ (clearedSubdrawing H (Δ₂ \ subBd Δ₂)).V := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have : ConnectedSpace S := hMetric.1.2.2.1 + set Λ₂ := Δ₂ \ subBd Δ₂ + set H' := clearedSubdrawing H Λ₂ + set θ' := θ - 4 * lam - 2 + obtain ⟨hDdisc, hDbd, hDsep'⟩ := hd' D hD hDs hlen + have hfrD : frontier (ins' D) = D.U := by rw [subBd_eq_frontier', hDbd] + have hΛ₂_int : Λ₂ ⊆ ins' D \ D.U := by + have h₁ : Λ₂ = interior Δ₂ := by + change Δ₂ \ subBd Δ₂ = interior Δ₂ + rw [← subBd_eq_frontier'] + exact self_sdiff_frontier _ + have h₂ : ins' D \ D.U = interior (ins' D) := by + rw [← hfrD] + exact self_sdiff_frontier _ + rw [h₁, h₂] + exact interior_mono hΔ₂_sub + have hdis_DU_Λ₂ : Disjoint D.U Λ₂ := + Set.disjoint_left.mpr fun x hxD hxΛ₂ => (hΛ₂_int hxΛ₂).2 hxD + have hU' := clearedSubdrawing_U hZone₂ + obtain ⟨hV', hE'⟩ := clearedSubdrawing_V_and_E hZone₂ + have hSub' := clearedSubdrawing_isSubdrawing H Λ₂ + have hUU' : H'.U ∩ K'.U = H'.V := hK'.2.1.1 + have hDU_inter_HU : D.U ∩ H.U = D.V ∩ H'.V := by + ext x + constructor + · rintro ⟨hxD, hxH⟩ + have hxH'U : x ∈ H'.U := by + rw [hU'] + exact ⟨hxH, Set.disjoint_left.mp hdis_DU_Λ₂ hxD⟩ + have hxH'V : x ∈ H'.V := by + have : x ∈ H'.U ∩ K'.U := ⟨hxH'U, hDs.U_subset hxD⟩ + rwa [hUU'] at this + have hxDV : x ∈ D.V := by + by_contra hxDV + obtain ⟨g, hgD, hxg⟩ := D.exists_edge_of_mem hxD hxDV + exact ((hDs.2 hgD).2.1 hxg).2 (hK'.2.1.2.1 hxH'V) + exact ⟨hxDV, hxH'V⟩ + · rintro ⟨hxDV, hxH'V⟩ + exact ⟨D.V_subset_U hxDV, H.V_subset_U (hSub'.1 hxH'V)⟩ + have hDU_inter_HV : D.U ∩ H.V = D.V ∩ H'.V := by + refine subset_antisymm ?_ ?_ + · intro x ⟨hxD, hxHV⟩ + exact hDU_inter_HU ▸ ⟨hxD, H.V_subset_U hxHV⟩ + · intro x ⟨hxDV, hxH'V⟩ + exact ⟨D.V_subset_U hxDV, hSub'.1 hxH'V⟩ + have hDU_norm : D.U ∩ H.U ⊆ H.V := by + rw [hDU_inter_HU] + exact fun x hx => hSub'.1 hx.2 + have hDeq' := (circuit_length_eq_two_mul_ncard hK'.2.1 hD hDs).1 + have hDU_lt : (D.U ∩ H.V).ncard < θ := by + rw [hDU_inter_HV] + omega + have hDU_oArc : IsOArc D.U := isOArc_of_isCircuit hD + obtain ⟨Δ_H, hΔ_H_disc, hΔ_H_bd, hΔ_H_sep⟩ := + hMetric.1.2.2.2 D.U hDU_oArc hDU_norm hDU_lt + have hAB_V_sub : ((PaintingOrDrawing.drawing H).inter (ins' D) ∩ + (PaintingOrDrawing.drawing H).interOutside (ins' D)).vertexSet ⊆ D.V ∩ H'.V := by + rintro x ⟨⟨hxHV, hx_in⟩, ⟨_, hx_out⟩⟩ + have hx_fr : x ∈ frontier (ins' D) := by + rw [frontier_eq_closure_inter_closure, compl_eq_univ_sdiff] + exact ⟨subset_closure hx_in, hx_out⟩ + rw [hfrD] at hx_fr + exact hDU_inter_HV ▸ ⟨hx_fr, hxHV⟩ + refine ⟨?_, hAB_V_sub⟩ + by_cases h_eq : ins' D = Δ_H + · exact h_eq ▸ hΔ_H_sep + · exfalso + have hbd_eq : discBd (ins' D) = discBd Δ_H := by + rw [← IsClosedDisc.subBd_eq_discBd hS hDdisc, ← IsClosedDisc.subBd_eq_discBd hS hΔ_H_disc, + hDbd, hΔ_H_bd] + have hcov : ins' D ∪ Δ_H = univ := + cover_of_discBd_eq hS hDdisc hΔ_H_disc hbd_eq h_eq + have hfr_H : frontier Δ_H = D.U := by rw [subBd_eq_frontier', hΔ_H_bd] + have hint_D_dis_H : Disjoint (ins' D \ D.U) Δ_H := by + obtain ⟨hOD_H, hcl_H, _⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hΔ_H_disc + rw [hΔ_H_bd] at hOD_H hcl_H + have hdis_int : Disjoint (ins' D \ D.U) (Δ_H \ D.U) := by + by_contra hnot + obtain ⟨p, hpD, hpH⟩ := not_disjoint_iff.mp hnot + have hsub : Δ_H \ D.U ⊆ ins' D := + subset_of_disjoint_frontier hOD_H.isPathConnected.isConnected.isPreconnected + hDdisc.isClosed (hfrD ▸ disjoint_sdiff_self_left) hpH hpD.1 + have hΔ_H_sub : Δ_H ⊆ ins' D := + hcl_H ▸ hDdisc.isClosed.closure_subset_iff.mpr hsub + have hins_univ : ins' D = univ := by + rw [← hcov, union_eq_left.mpr hΔ_H_sub] + have hbd_empty : D.U = ∅ := by + rw [← hfrD, hins_univ, frontier_univ] + obtain ⟨q, hq⟩ := IsOArc.nonempty hDU_oArc + rw [hbd_empty] at hq + exact hq + refine Set.disjoint_left.mpr fun x hxD hxH => ?_ + by_cases hxU : x ∈ D.U + · exact hxD.2 hxU + · exact Set.disjoint_left.mp hdis_int hxD ⟨hxH, hxU⟩ + have hcompl_D : univ \ ins' D = Δ_H \ D.U := by + ext x + constructor + · rintro ⟨hx_u, hx_not_D⟩ + rcases hcov.symm ▸ hx_u with hxD | hxH + · exact absurd hxD hx_not_D + · exact ⟨hxH, fun hxU => hx_not_D (hDdisc.isClosed.frontier_subset (hfrD.symm ▸ hxU))⟩ + · rintro ⟨hxH, hx_not_U⟩ + refine ⟨mem_univ _, fun hxD => ?_⟩ + exact Set.disjoint_left.mp hint_D_dis_H ⟨hxD, hx_not_U⟩ hxH + have hcompl_H : univ \ Δ_H = ins' D \ D.U := by + ext x + constructor + · rintro ⟨hx_u, hx_not_H⟩ + rcases hcov.symm ▸ hx_u with hxD | hxH + · exact ⟨hxD, fun hxU => hx_not_H (hΔ_H_disc.isClosed.frontier_subset (hfr_H.symm ▸ hxU))⟩ + · exact absurd hxH hx_not_H + · rintro ⟨hxD, hx_not_U⟩ + refine ⟨mem_univ _, fun hxH => ?_⟩ + exact Set.disjoint_left.mp hint_D_dis_H ⟨hxD, hx_not_U⟩ hxH + obtain ⟨_, hcl_H_eq, _⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hΔ_H_disc + obtain ⟨_, hcl_D_eq, _⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hDdisc + rw [hΔ_H_bd] at hcl_H_eq + rw [hDbd] at hcl_D_eq + have hcl_compl_D : closure (univ \ ins' D) = Δ_H := by + rw [hcompl_D, hcl_H_eq] + have hcl_compl_H : closure (univ \ Δ_H) = ins' D := by + rw [hcompl_H, hcl_D_eq] + set A₀ := (PaintingOrDrawing.drawing H).inter Δ_H + set B₀ := (PaintingOrDrawing.drawing H).interOutside Δ_H + have hB₀_eq : B₀ = (PaintingOrDrawing.drawing H).inter (ins' D) := by + change (PaintingOrDrawing.drawing H).inter (closure (univ \ Δ_H)) = _ + rw [hcl_compl_H] + have hA₀_eq : A₀ = (PaintingOrDrawing.drawing H).interOutside (ins' D) := by + symm + change (PaintingOrDrawing.drawing H).inter (closure (univ \ ins' D)) = _ + rw [hcl_compl_D] + have hord₀ : separationOrder A₀ B₀ < θ' := by + have hsub₀ : (A₀ ∩ B₀).vertexSet ⊆ D.V ∩ H'.V := by + rw [hA₀_eq, hB₀_eq] + rintro x ⟨h1, h2⟩ + exact hAB_V_sub ⟨h2, h1⟩ + have hle₀ := ncard_le_ncard hsub₀ (D.finite_V.subset inter_subset_left) + change (A₀ ∩ B₀).vertexSet.ncard < θ' + omega + have hmem' := hCleared.mem_of_order_lt A₀ B₀ hΔ_H_sep hord₀ + have hinter_eq : ∀ X : Set S, + (PaintingOrDrawing.drawing H).inter X ∩ H'.toHypergraph = + (PaintingOrDrawing.drawing H').inter X := by + intro X + refine Hypergraph.ext ?_ ?_ ?_ + · change (H.V ∩ X) ∩ H'.V = H'.V ∩ X + ext v + exact ⟨fun ⟨⟨_, hvX⟩, hv'⟩ => ⟨hv', hvX⟩, + fun ⟨hv', hvX⟩ => ⟨⟨hSub'.1 hv', hvX⟩, hv'⟩⟩ + · change {e ∈ H.E | e ⊆ X} ∩ H'.E = {e ∈ H'.E | e ⊆ X} + ext e + exact ⟨fun ⟨⟨_, heX⟩, he'⟩ => ⟨he', heX⟩, + fun ⟨he', heX⟩ => ⟨⟨hSub'.2 he', heX⟩, he'⟩⟩ + · funext e v + apply propext + change ((H.toHypergraph.Inc e v ∧ e ⊆ X ∧ v ∈ X) ∧ H'.toHypergraph.Inc e v) ↔ + (H'.toHypergraph.Inc e v ∧ e ⊆ X ∧ v ∈ X) + exact ⟨fun ⟨⟨_, heX, hvX⟩, hinc'⟩ => ⟨hinc', heX, hvX⟩, + fun ⟨⟨he', hv', hve⟩, heX, hvX⟩ => + ⟨⟨⟨hSub'.2 he', hSub'.1 hv', hve⟩, heX, hvX⟩, he', hv', hve⟩⟩ + have hA₀_inter : A₀ ∩ H'.toHypergraph = (PaintingOrDrawing.drawing H').interOutside (ins' D) + := by + rw [hA₀_eq] + exact hinter_eq (closure (univ \ ins' D)) + have hB₀_inter : B₀ ∩ H'.toHypergraph = (PaintingOrDrawing.drawing H').inter (ins' D) := by + rw [hB₀_eq] + exact hinter_eq (ins' D) + rw [hA₀_inter, hB₀_inter] at hmem' + have hsep_D' := hCleared.hasMetric.1.2.1.isSeparation hDsep' + refine hCleared.hasMetric.1.2.1.axiom2 hDsep' hmem' hmem' ?_ + rw [GM10.union_assoc, GM10.union_self, hsep_D'.union_eq] + +/-- Graph Minors XIV, (7.8) (pages 38–39): +"Let $\beta \ge 4$ be even, let $\lambda \ge 0$, and let $\theta \ge 4\lambda + 2$. Let $H$ +be a 2-cell drawing in $\Sigma$, and let $\mathscr{T}$ be a respectful tangle in $H$ of +order $\theta$. Let $z \in A(H)$, let $C_1$, $C_2$ be disjoint circuits of $H$, and let +$U(C_1)$, $U(C_2)$ bound closed discs $\Delta_1$, $\Delta_2 \subseteq \Sigma$ with the +following properties:* (i) $z \subseteq \Delta_2 - bd(\Delta_2)$, and $\Delta_2 \subseteq +\Delta_1 - bd(\Delta_1)$ (ii) $\Delta_1 - bd(\Delta_1)$ is a $(\theta - \beta - 4\lambda - +2)$-zone around $z$ (iii) $\Delta_2 - bd(\Delta_2)$ is a $\lambda$-zone around $z$ (iv) $x +\subseteq \Delta_1 - bd(\Delta_1)$ for every $x \in A(H)$ with $d(z, x) < \beta$, and (v) +*there are circuits $C_3, \dots, C_{\beta/2}$ of $H \cap \Delta_1$ such that $C_1$, $C_2$, +$\dots$, $C_{\beta/2}$ are mutually disjoint and $U(C_3), \dots, U(C_{\beta/2})$ all bound +closed discs in $\Delta_1$ including $\Delta_2$.* ... *Let $P_1, \dots, P_\beta$ be disjoint +paths of $H$ from $V(C_2)$ to $V(C_1)$, such that for $1 \le i \le \beta$, $P_i$ has initial +vertex $v_i \in V(C_2)$ and $U(P_i) \cap (\Delta_2 - bd(\Delta_2)) = \emptyset$. Then +$\{v_1, \dots, v_\beta\}$ is free with respect to the tangle of order $\theta - 4\lambda - +2$ obtained from $\mathscr{T}$ by clearing the $\lambda$-zone $\Delta_2 - bd(\Delta_2)$." -/ +theorem theorem_7_8_proof + [T2Space S] (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H C₁ C₂ : Drawing S} {θ beta lam : ℕ} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z Δ₁ Δ₂ : Set S} + {C : Fin (beta / 2) → Drawing S} {Δ : Fin (beta / 2) → Set S} + {P : Fin beta → Drawing S} {v u : Fin beta → S} + (_hbeta : 4 ≤ beta) (heven : Even beta) (hθ : beta + 4 * lam + 2 ≤ θ) + (hMetric : HasTangleMetric H θ T d) + (hCleared : IsClearedTangle H T d θ lam (Δ₂ \ subBd Δ₂) T' d') + (_hC₁ : C₁.IsCircuit) (hC₁s : C₁.IsSubdrawing H) + (hΔ₁ : IsClosedDisc Δ₁) (hbd₁ : subBd Δ₁ = C₁.U) + (_hC₂ : C₂.IsCircuit) (hC₂s : C₂.IsSubdrawing H) + (hΔ₂ : IsClosedDisc Δ₂) (hbd₂ : subBd Δ₂ = C₂.U) + (hi : z ⊆ Δ₂ \ subBd Δ₂ ∧ Δ₂ ⊆ Δ₁ \ subBd Δ₁) + (hii : IsLambdaZoneAround H d (θ - beta - 4 * lam - 2) z (Δ₁ \ subBd Δ₁)) + (hiii : IsLambdaZoneAround H d lam z (Δ₂ \ subBd Δ₂)) + (hiv : ∀ x ∈ H.A, d z x < beta → x ⊆ Δ₁ \ subBd Δ₁) + (hv_C : ∀ i : Fin (beta / 2), + (C i).IsCircuit ∧ (C i).IsSubdrawing H ∧ IsClosedDisc (Δ i) ∧ + subBd (Δ i) = (C i).U ∧ Δ₂ ⊆ Δ i ∧ Δ i ⊆ Δ₁) + (hv_dis : Pairwise (fun i₁ i₂ : Fin (beta / 2) => Disjoint (C i₁).V (C i₂).V)) + (hP : ∀ j : Fin beta, + (P j).IsPathBetween (v j) (u j) ∧ (P j).IsSubdrawing H ∧ + v j ∈ C₂.V ∧ u j ∈ C₁.V ∧ Disjoint (P j).U (Δ₂ \ subBd Δ₂)) + (hP_dis : Pairwise (fun j₁ j₂ : Fin beta => Disjoint (P j₁).V (P j₂).V)) : + IsFreeSet (clearedSubdrawing H (Δ₂ \ subBd Δ₂)).toHypergraph T' (θ - 4 * lam - 2) (range v) + := by + set Λ₂ := Δ₂ \ subBd Δ₂ + set H' := clearedSubdrawing H Λ₂ + set θ' := θ - 4 * lam - 2 + obtain ⟨hV', _⟩ := clearedSubdrawing_V_and_E hiii + have hv_in_P : ∀ j : Fin beta, v j ∈ (P j).V := by + intro j + obtain ⟨W, _, hPV, _⟩ := (hP j).1 + rw [hPV] + exact W.start_mem_support + have hv_inj : Injective v := by + intro j₁ j₂ hveq + by_contra hne + exact Set.disjoint_left.mp (hP_dis hne) (hv_in_P j₁) (hveq ▸ hv_in_P j₂) + have hrange_ncard : (range v).ncard = beta := by + rw [ncard_range_of_injective hv_inj, Nat.card_eq_fintype_card, Fintype.card_fin] + have hrange_sub : range v ⊆ H'.toHypergraph.vertexSet := by + rintro x ⟨j, rfl⟩ + change v j ∈ H'.V + rw [hV'] + refine ⟨hC₂s.1 (hP j).2.2.1, fun hxΛ₂ => ?_⟩ + exact hxΛ₂.2 (hbd₂ ▸ C₂.V_subset_U (hP j).2.2.1) + refine ⟨hrange_sub, by omega, ?_⟩ + intro A' B' hAB' hrange_A' + by_contra hlt_ord + push Not at hlt_ord + rw [hrange_ncard] at hlt_ord + change (A' ∩ B').vertexSet.ncard < beta at hlt_ord + have hsep' : H'.toHypergraph.IsSeparation A' B' := hCleared.hasMetric.1.2.1.isSeparation hAB' + have hfin_AB' : (A' ∩ B').vertexSet.Finite := + H'.finite_V.subset hsep'.left_le.vertexSet_subset |>.subset inter_subset_left + obtain ⟨j, hdis_Pj⟩ := exists_disjoint_of_ncard_lt hP_dis hfin_AB' hlt_ord + have h2m : (A' ∩ B').vertexSet.ncard < 2 * (beta / 2) := by + obtain ⟨k, rfl⟩ := heven + omega + obtain ⟨i, hle_Ci⟩ := exists_inter_ncard_le_one_of_ncard_lt_two_mul hv_dis hfin_AB' h2m + have hPj_sub_H' : (P j).IsSubdrawing H' := + isSubdrawing_clearedSubdrawing hiii (hP j).2.1 (hP j).2.2.2.2 + have hΔ₂_int_Δi : Λ₂ ⊆ Δ i \ subBd (Δ i) := by + have h₁ : Λ₂ = interior Δ₂ := by + change Δ₂ \ subBd Δ₂ = interior Δ₂ + rw [← subBd_eq_frontier'] + exact self_sdiff_frontier _ + have h₂ : Δ i \ subBd (Δ i) = interior (Δ i) := by + rw [← subBd_eq_frontier'] + exact self_sdiff_frontier _ + rw [h₁, h₂] + exact interior_mono (hv_C i).2.2.2.2.1 + have hdis_Ci_Λ₂ : Disjoint (C i).U Λ₂ := by + refine Set.disjoint_left.mpr fun x hxCi hxΛ₂ => ?_ + exact (hΔ₂_int_Δi hxΛ₂).2 ((hv_C i).2.2.2.1 ▸ hxCi) + have hCi_sub_H' : (C i).IsSubdrawing H' := + isSubdrawing_clearedSubdrawing hiii (hv_C i).2.1 hdis_Ci_Λ₂ + have hvj_Δ₂ : v j ∈ Δ₂ := by + have : v j ∈ subBd Δ₂ := hbd₂ ▸ C₂.V_subset_U (hP j).2.2.1 + rw [← subBd_eq_frontier'] at this + exact hΔ₂.isClosed.frontier_subset this + have hvj_Δi : v j ∈ Δ i := (hv_C i).2.2.2.2.1 hvj_Δ₂ + have huj_bd₁ : u j ∈ subBd Δ₁ := hbd₁ ▸ C₁.V_subset_U (hP j).2.2.2.1 + have hne_Ci_Pj : ((C i).V ∩ (P j).V).Nonempty := + circuit_inter_path_nonempty hS (hv_C i).2.2.1 hΔ₁ (hv_C i).2.2.2.2.2 (hv_C i).2.1 + (hv_C i).2.2.2.1 (hP j).1 (hP j).2.1 hvj_Δi huj_bd₁ + have hz_Δi : z ⊆ Δ i \ subBd (Δ i) := hi.1.trans hΔ₂_int_Δi + have hZone_i_H : IsLambdaZoneAround H d (θ - beta - 4 * lam - 2) z (Δ i \ subBd (Δ i)) := + zone_of_closedDisc_subset hS hii hΔ₁ (hv_C i).2.2.1 (hv_C i).2.2.2.2.2 (hv_C i).1 + (hv_C i).2.1 (hv_C i).2.2.2.1 hz_Δi + have hZone_i_H' : IsLambdaZoneAround H' d' (θ - beta - 4 * lam - 2) Λ₂ (Δ i \ subBd (Δ i)) := + cleared_zone_of_closedDisc_subset hS hZone_i_H hiii hCleared (hv_C i).2.2.1 hΔ₂ + (hv_C i).2.2.2.2.1 (hv_C i).1 (hv_C i).2.1 (hv_C i).2.2.2.1 + obtain ⟨_, K', ins', hK', hd', _⟩ := hCleared.hasMetric + have hord'_lam : separationOrder A' B' + (θ - beta - 4 * lam - 2) < θ' := by + change (A' ∩ B').vertexSet.ncard + (θ - beta - 4 * lam - 2) < θ' + omega + obtain ⟨D, hD, hDs, hDlen, hDV, hΔi_sub_D, -⟩ := + circuit_of_sep_in_zone hS hConn hCleared.hasMetric hK' hd' hAB' hZone_i_H' + (hv_C i).2.2.1 (hv_C i).1 hCi_sub_H' (hv_C i).2.2.2.1 hord'_lam (hP j).1 hPj_sub_H' + hvj_Δi (hrange_A' ⟨j, rfl⟩) hdis_Pj hne_Ci_Pj hle_Ci + have hΔ₂_sub_D : Δ₂ ⊆ ins' D := (hv_C i).2.2.2.2.1.trans hΔi_sub_D + obtain ⟨hAB_H, hAB_H_sub⟩ := + inter_ins_mem_of_cleared hS hMetric hiii hCleared hK' hd' hD hDs hDlen hΔ₂_sub_D + set A_H := (PaintingOrDrawing.drawing H).inter (ins' D) + set B_H := (PaintingOrDrawing.drawing H).interOutside (ins' D) + have hAB_H_sub_AB' : (A_H ∩ B_H).vertexSet ⊆ (A' ∩ B').vertexSet := hAB_H_sub.trans hDV + have hord_H_lt : (A_H ∩ B_H).vertexSet.ncard < beta := + (ncard_le_ncard hAB_H_sub_AB' hfin_AB').trans_lt hlt_ord + have hord_H_lam : separationOrder A_H B_H + (θ - beta - 4 * lam - 2) < θ := by + change (A_H ∩ B_H).vertexSet.ncard + (θ - beta - 4 * lam - 2) < θ + omega + have hvj_AH : v j ∈ A_H.vertexSet := ⟨hC₂s.1 (hP j).2.2.1, hΔ₂_sub_D hvj_Δ₂⟩ + have hdis_Pj_H : Disjoint (P j).V (A_H ∩ B_H).vertexSet := + hdis_Pj.mono_right hAB_H_sub_AB' + have hle_Ci_H : ((C i).V ∩ (A_H ∩ B_H).vertexSet).ncard ≤ 1 := by + refine (ncard_le_ncard (inter_subset_inter_right (C i).V hAB_H_sub_AB') ?_).trans hle_Ci + exact (C i).finite_V.subset inter_subset_left + obtain ⟨hResp, K, ins, hK, hd, hd_eq⟩ := hMetric + have hMetric' : HasTangleMetric H θ T d := ⟨hResp, K, ins, hK, hd, hd_eq⟩ + obtain ⟨D_star, hD_star, hD_star_s, hD_star_len, hD_star_V, hΔi_sub_star, hPj_sub_star⟩ := + circuit_of_sep_in_zone hS hConn hMetric' hK hd hAB_H hZone_i_H + (hv_C i).2.2.1 (hv_C i).1 (hv_C i).2.1 (hv_C i).2.2.2.1 hord_H_lam (hP j).1 (hP j).2.1 + hvj_Δi hvj_AH hdis_Pj_H hne_Ci_Pj hle_Ci_H + obtain ⟨p_z, hp_z⟩ := atom_nonempty hiii.z_mem + have hz_star : (z ∩ ins D_star).Nonempty := + ⟨p_z, hp_z, hΔi_sub_star ((hv_C i).2.2.2.2.1 (hi.1 hp_z).1)⟩ + have huj_HV : u j ∈ H.V := hC₁s.1 (hP j).2.2.2.1 + have huj_A : ({u j} : Set S) ∈ H.A := Or.inl (Or.inl ⟨u j, huj_HV, rfl⟩) + obtain ⟨W_Pj, _, hPV_j, _⟩ := (hP j).1 + have huj_PjU : u j ∈ (P j).U := (P j).V_subset_U (by rw [hPV_j]; exact W_Pj.end_mem_support) + have huj_star : (({u j} : Set S) ∩ ins D_star).Nonempty := + ⟨u j, mem_singleton (u j), (hPj_sub_star huj_PjU).1⟩ + have hd_le : d z {u j} ≤ (D_star.V ∩ H.V).ncard := by + rw [hd_eq z hiii.z_mem {u j} huj_A] + exact (tangleMetric_le_of_circuit hS hK hd hD_star hD_star_s hD_star_len hiii.z_mem huj_A + hz_star huj_star).2 + have hncard_star : (D_star.V ∩ H.V).ncard < beta := by + refine (ncard_le_ncard (hD_star_V.trans hAB_H_sub_AB') hfin_AB').trans_lt hlt_ord + have hd_lt : d z {u j} < beta := hd_le.trans_lt hncard_star + have huj_in_int₁ : u j ∈ Δ₁ \ subBd Δ₁ := hiv {u j} huj_A hd_lt (mem_singleton (u j)) + exact huj_in_int₁.2 huj_bd₁ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section8.lean b/LeanPool/GraphMinor/GM14/Section8.lean new file mode 100644 index 0000000000..ea0d603a1b --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section8.lean @@ -0,0 +1,980 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.SpanRestriction + +public import LeanPool.GraphMinor.GM14.Section5 +public import LeanPool.GraphMinor.GM14.Section6c +public import LeanPool.GraphMinor.GM14.Section8a +public import LeanPool.GraphMinor.GM14.Section83Proof +public import LeanPool.GraphMinor.GM14.CylinderParts +public import LeanPool.GraphMinor.GM14.Form84 +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Bridge +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM16.CircleListing +import LeanPool.GraphMinor.GM16.FiniteCircleCycle +import LeanPool.GraphMinor.GM16.CyclicOrderTransport +import Mathlib.Data.Fintype.Card +import Mathlib.Tactic.Linarith + + +/-! +# Graph Minors XIV, Section 8: Segregation in a Rural Neighbourhood + +This file completes the formalization of Section 8 ("Segregation in a Rural Neighbourhood", +pages 39–42) of N. Robertson and P. D. Seymour, *Graph Minors. XIV. Extending an embedding*, +J. Combin. Theory Ser. B **65** (1995) 23–50, re-exporting `GraphMinor.GM14.Section8a` and proving: + +- `restrictSpan` and `restrictCleared`: restriction of a `SpanEmbedding H G` to `H.span V' E'` and + `clearedSubdrawing H Λ`. +- `exists_cyclicPerm_agrees_injOn`, `exists_natural_order_injOn`, `exists_pullbackPerm`, and + `exists_natural_order_spanEmbedding_subBd`: construction of natural orders on `O`-arcs and + pullback permutations `α⁻¹(F)`. +- `theorem_8_4` (Graph Minors XIV, (8.4), pages 41–42). Claim (1) is `exists_reduced` in + `ClaimOneReduction.lean` and Claim (2) is `claim_2_of_8_4` in `ForestClaim.lean`. The drawing of + `G_1` is `exists_reduced_drawing` in `PieceFacts.lean`, and the rest of the proof is `drawn_8_4`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 + GraphMinor.GM16 + +universe u v w + +variable {S : Type w} [TopologicalSpace S] [T1Space S] + +/-! ## 1. Restriction of `SpanEmbedding` and Construction of Natural / Pullback Orders -/ + +omit [T1Space S] in +/-- Any finite subset `Y : Set α` injected into an `O`-arc `F` by `α_pt : α → S` has a cyclic +permutation `Ω : CyclicPerm α` with `Ω.bar = Y` agreeing with a given homeomorphism +`φ : Circle ≃ₜ F`. -/ +theorem exists_cyclicPerm_agrees_injOn {α : Type u} {F : Set S} (φ : Circle ≃ₜ F) + {Y : Set α} (hY : Y.Finite) {α_pt : α → S} (hinj : InjOn α_pt Y) (hYF : MapsTo α_pt Y F) : + ∃ Ω : CyclicPerm α, Ω.bar = Y ∧ AgreesWithOArcHomeo α_pt Ω F φ := by + classical + rcases Y.eq_empty_or_nonempty with rfl | hNe + · let Ω₀ : CyclicPerm α := ⟨∅, id, finite_empty, bijOn_empty id, fun _ hx => False.elim hx⟩ + refine ⟨Ω₀, rfl, fun _ hx => False.elim hx, ?_⟩ + intro x y z hCW + exact False.elim (CyclicPerm.isClockwise3_iff.mp hCW).2.2.2.1 + · exact GM16.exists_cyclicPerm_from_circle φ α_pt hY hNe hinj (fun _ hx => hYF hx) + +omit [T1Space S] in +/-- Any finite subset `Y : Set α` injected into an `O`-arc `F` by `α_pt : α → S` has a natural +order `Ω : CyclicPerm α` from `F` with `Ω.bar = Y`. -/ +theorem exists_natural_order_injOn {α : Type u} {F : Set S} (hF : IsOArc F) + {Y : Set α} (hY : Y.Finite) {α_pt : α → S} (hinj : InjOn α_pt Y) (hYF : MapsTo α_pt Y F) : + ∃ Ω : CyclicPerm α, Ω.bar = Y ∧ IsNaturalOrderFrom α_pt Ω F := by + obtain ⟨φ⟩ := hF + obtain ⟨Ω, hbar, hAgree⟩ := exists_cyclicPerm_agrees_injOn φ hY hinj hYF + exact ⟨Ω, hbar, ⟨φ⟩, φ, hAgree⟩ + +omit [T1Space S] in +/-- For any segregation `S_seg` with a surface arrangement `(α_disc, α_pt)` and any `O`-arc `F`, +there exists a pullback cyclic permutation `Ω = α⁻¹(F)` on `{v ∈ V(S_seg) | α_pt v ∈ F}`. -/ +theorem exists_pullbackPerm {α : Type u} {β : Type v} + {G : Graph α β} {S_seg : Set (Society α β)} (hseg : IsGraphSegregation G S_seg) + {α_disc : Society α β → Set S} {α_pt : α → S} (harr : IsSurfaceArrangement S_seg α_disc α_pt) + {F : Set S} (hF : IsOArc F) : + ∃ Ω : CyclicPerm α, IsPullbackPerm S_seg α_pt F Ω := by + have hsegV_fin : (segregationVertices S_seg).Finite := + hseg.finite.biUnion fun S₀ _ => S₀.Ω.finite_bar + let Y : Set α := {v ∈ segregationVertices S_seg | α_pt v ∈ F} + have hY_fin : Y.Finite := hsegV_fin.subset (fun _ hv => hv.1) + have hinj : InjOn α_pt Y := harr.injOn_pts.mono (fun _ hv => hv.1) + have hYF : MapsTo α_pt Y F := fun _ hv => hv.2 + obtain ⟨Ω, hbar, hNat⟩ := exists_natural_order_injOn hF hY_fin hinj hYF + exact ⟨Ω, hbar, hNat⟩ + +omit [T1Space S] in +/-- Given a `SpanEmbedding clearedEmbedding` of a drawing `H_Λ` into `G_amb` and an `O`-arc `F`, +there is a +cyclic permutation `Ω` on `clearedEmbedding.vMap '' (H_Λ.V ∩ F)` and a right-inverse map `inv_v : α +→ S` on +`Ω.bar` such that `Ω` is a natural order from `F` under `inv_v`. -/ +theorem exists_natural_order_spanEmbedding_subBd {α : Type u} {β : Type v} + {H_Λ : Drawing S} {G_amb : Graph α β} (clearedEmbedding : SpanEmbedding H_Λ G_amb) + {F : Set S} (hF : IsOArc F) : + ∃ (Ω : CyclicPerm α) (inv_v : α → S), + Ω.bar = clearedEmbedding.vMap '' (H_Λ.V ∩ F) ∧ + (∀ x ∈ Ω.bar, inv_v x ∈ H_Λ.V ∩ F ∧ clearedEmbedding.vMap (inv_v x) = x) ∧ + IsNaturalOrderFrom inv_v Ω F := by + classical + obtain ⟨φ_F⟩ := hF + let p₀ : S := (φ_F 1).1 + have hp₀ : IsOArc F := ⟨φ_F⟩ + let V_bd : Set S := H_Λ.V ∩ F + let Y : Set α := clearedEmbedding.vMap '' V_bd + have hY_fin : Y.Finite := (H_Λ.finite_V.subset inter_subset_left).image clearedEmbedding.vMap + let inv_v : α → S := fun x => + if hx : ∃ v ∈ V_bd, clearedEmbedding.vMap v = x then Classical.choose hx else p₀ + have hinv_prop : ∀ x ∈ Y, inv_v x ∈ V_bd ∧ clearedEmbedding.vMap (inv_v x) = x := by + intro x hx + have hx' : ∃ v ∈ V_bd, clearedEmbedding.vMap v = x := by + rcases hx with ⟨v, hv, rfl⟩ + exact ⟨v, hv, rfl⟩ + simp only [inv_v, hx', ↓reduceDIte] + exact Classical.choose_spec hx' + have hinj : InjOn inv_v Y := by + intro x₁ hx₁ x₂ hx₂ heq + rw [← (hinv_prop x₁ hx₁).2, ← (hinv_prop x₂ hx₂).2, heq] + have hYF : MapsTo inv_v Y F := fun x hx => (hinv_prop x hx).1.2 + obtain ⟨Ω, hbar, hNat⟩ := exists_natural_order_injOn hp₀ hY_fin hinj hYF + exact ⟨Ω, inv_v, hbar, fun x hx => hinv_prop x (hbar ▸ hx), hNat⟩ + +/-! ## 2. Proof of Claim (2) of (8.4) and (8.4) (pages 41–42) -/ + +private theorem nested_circuits_lie_in_outer_neighborhood + {S : Type w} + [TopologicalSpace S] + {α : Type u} + {β : Type v} + {H : Drawing S} + {C₂ : Drawing S} + {E₁ : Set S} + {E₂ : Set S} + (hE₂ : IsClosedDisc E₂) + {pi : ℕ} + {N : Neighborhood α β} + (η : SpanEmbedding H N.G) + (Y : GraphDrawing N.G S) + {ν : α → S} + (hη : ∀ v ∈ H.V, ν (η.vMap v) = v) + (hηe : ∀ e ∈ H.E, graphDrawingEdgeSet Y (η.eMap e) = e) + (hman : ∀ (x : S), IsManifoldPoint x) + (hVU : ∀ {R : Drawing S} {v : S}, v ∈ R.V → v ∈ R.U) + (hRG : ∀ {R : Drawing S}, R.IsCircuit → R.IsSubdrawing H → R.toGraph ≤ H.toGraph) + (Nin : Neighborhood α β) + (Yin : GraphDrawing Nin.G S) + (hei : ∀ e ∈ E(Nin.G), graphDrawingEdgeSet Yin e = graphDrawingEdgeSet Y e) + (hKin : ∀ {R : Drawing S}, R.IsCircuit → R.IsSubdrawing H → R.U ⊆ E₁ → (fun R : Drawing S => + η.gmap.sub R.toGraph) R ≤ Nin.G) + (Nout₂ : Neighborhood α β) + (Nin₂ : Neighborhood α β) + (hOutle₂ : Nout₂.G ≤ Nin.G) + (hOutV₂ : V(Nout₂.G) = {v | v ∈ V(Nin.G) ∧ ν v ∉ discInt E₂}) + (hTO₂ : E((fun R : Drawing S => η.gmap.sub R.toGraph) C₂) ⊆ E(Nout₂.G)) + (hEun₂ : E(Nin₂.G) ∪ E(Nout₂.G) = E(Nin.G)) + (hIc₂ : ∀ e ∈ E(Nin₂.G), closure (graphDrawingEdgeSet Yin e) ⊆ E₂) + (R : Fin (pi + 3 + 2) → Drawing S) + (A' : Fin (pi + 3 + 2) → Set S) + (hRA : ∀ (i : Fin (pi + 3 + 2)), (R i).IsCircuit ∧ (R i).IsSubdrawing H ∧ IsClosedDisc (A' i) + ∧ discBd (A' i) = (R i).U ∧ E₂ ⊆ A' i ∧ A' i ⊆ E₁) + (hlt : ∀ (i j : Fin (pi + 3 + 2)), i < j → A' i ⊆ A' j \ (R j).U) + (hR0 : R 0 = C₂) + (hA0 : A' 0 = E₂) + (hRU : ∀ (i : Fin (pi + 3 + 2)), (R i).U ⊆ A' i) : + ∀ (i : Fin (pi + 3 + 2)), (fun R : Drawing S => η.gmap.sub R.toGraph) (R i) ≤ Nout₂.G := by + let K := fun R : Drawing S => η.gmap.sub R.toGraph + intro i + obtain ⟨hc, hs, hdi, hb, h₂, h₁⟩ := hRA i + have hin : K (R i) ≤ Nin.G := hKin hc hs ((hRU i).trans h₁) + refine le_of_subset_of_subset (hin.trans (le_refl _)) (hOutle₂) ?_ ?_ + · rintro _ ⟨v, hv, rfl⟩ + rw [hOutV₂] + refine ⟨hin.vertexSet_mono (mem_image_of_mem _ hv), ?_⟩ + rw [hη v (hs.1 hv)] + intro hi + refine (discInt_mono hman hE₂ h₂ hi).2 ?_ + rw [hb] + exact hVU hv + · intro a ha + by_cases hi : i = 0 + · subst hi + rw [hR0] at ha + exact hTO₂ ha + · have ha' := ha + rw [show E(K (R i)) = _ from η.gmap.edgeSet_sub (hRG hc hs)] at ha' + obtain ⟨e, he, rfl⟩ := ha' + rcases hEun₂.superset (hin.edgeSet_mono ha) with h | h + · exfalso + have hcl := hIc₂ _ h + rw [hei _ (hin.edgeSet_mono ha), hηe e (hs.2 he)] at hcl + obtain ⟨x, hx⟩ := (hs.2 he).2.2.1.isConnected.nonempty + have hx₂ : x ∈ E₂ := hcl (subset_closure hx) + have hpos : (0 : Fin (pi + 3 + 2)) < i := Fin.pos_iff_ne_zero.mpr hi + have h₃ := hlt 0 i hpos (hA0.symm ▸ hx₂) + exact h₃.2 (edge_subset_U he hx) + · exact h + +private theorem nested_circuits_give_neighborhood_breadth + {S : Type w} + [TopologicalSpace S] + {α : Type u} + {β : Type v} + {H : Drawing S} + {E₁ : Set S} + {E₂ : Set S} + {pi : ℕ} + {N : Neighborhood α β} + (η : SpanEmbedding H N.G) + (Y : GraphDrawing N.G S) + (hVU : ∀ {R : Drawing S} {v : S}, v ∈ R.V → v ∈ R.U) + (hKU : ∀ {R : Drawing S}, R.IsCircuit → R.IsSubdrawing H → graphDrawingSubgraphU Y ((fun R : + Drawing S => η.gmap.sub R.toGraph) R) = R.U) + (Nin : Neighborhood α β) + (Yin : GraphDrawing Nin.G S) + (hpi' : ∀ P ≤ Nin.G, graphDrawingSubgraphU Yin P = graphDrawingSubgraphU Y P) + (Nout₂ : Neighborhood α β) + (Yout₂ : GraphDrawing Nout₂.G S) + (hOutle₂ : Nout₂.G ≤ Nin.G) + (hpo₂ : ∀ P ≤ Nout₂.G, graphDrawingSubgraphU Yout₂ P = graphDrawingSubgraphU Yin P) + (Pr₂ : Presentation Nout₂) + (f : S → EuclideanPlane) + (hΔ : Pr₂.Δ = f '' E₁) + (hΔ₀ : Pr₂.Δ₀ = f '' E₂) + (hdisc : ∀ E ⊆ E₁, IsClosedDisc E → IsClosedDisc (f '' E) ∧ subBd (f '' E) = f '' discBd E) + (hpts : ∀ (J : Graph α β), graphDrawingSubgraphU Pr₂.Γ J = f '' graphDrawingSubgraphU Yout₂ J) + (R : Fin (pi + 3 + 2) → Drawing S) + (A' : Fin (pi + 3 + 2) → Set S) + (hRA : ∀ (i : Fin (pi + 3 + 2)), (R i).IsCircuit ∧ (R i).IsSubdrawing H ∧ IsClosedDisc (A' i) + ∧ discBd (A' i) = (R i).U ∧ E₂ ⊆ A' i ∧ A' i ⊆ E₁) + (hlt : ∀ (i j : Fin (pi + 3 + 2)), i < j → A' i ⊆ A' j \ (R j).U) + (hKR : ∀ (i : Fin (pi + 3 + 2)), (fun R : Drawing S => η.gmap.sub R.toGraph) (R i) ≤ Nout₂.G) + (hdjU : ∀ (i j : Fin (pi + 3 + 2)), i < j → Disjoint (R i).U (R j).U) : + Nout₂.HasBreadthGe (pi + 5) := by + let K := fun R : Drawing S => η.gmap.sub R.toGraph + have hdis : Pairwise fun i j => Disjoint V(K (R i)) V(K (R j)) := by + have hone : ∀ i j, i < j → Disjoint V(K (R i)) V(K (R j)) := by + intro i j h + refine disjoint_left.mpr ?_ + rintro _ ⟨a, ha, rfl⟩ ⟨b, hb, hab⟩ + have hba : b = a := η.gmap.bijV.injOn ((hRA j).2.1.1 hb) ((hRA i).2.1.1 ha) hab + exact disjoint_left.mp (hdjU i j h) (hVU ha) (hba ▸ hVU hb) + intro i j hij + rcases lt_or_gt_of_ne hij with h | h + · exact hone i j h + · exact (hone j i h).symm + refine hasBreadthGe_of_presentation (s := pi + 3 + 2) Pr₂ Yout₂ hΔ hΔ₀ hdisc hpts + (fun i => K (R i)) A' (fun i => ⟨hKR i, (η.gmap.circuit + (isGraphCircuit_of_isCircuit (hRA i).1 (hRA i).2.1)).2⟩) hdis (fun i => ?_) ?_ + · obtain ⟨hc, hs, hdi, hb, h₂, h₁⟩ := hRA i + refine ⟨hdi, ?_, h₂, h₁⟩ + rw [hpo₂ _ (hKR i), hpi' _ ((hKR i).trans hOutle₂), hKU hc hs, hb] + · intro i j hij + rcases eq_or_lt_of_le hij with rfl | h + · exact Subset.rfl + · exact (hlt i j h).trans sdiff_subset + +private theorem inner_and_outer_neighborhoods_meet_in_first_circuit + {S : Type w} + [TopologicalSpace S] + {α : Type u} + {β : Type v} + {H : Drawing S} + {C₁ : Drawing S} + {E₁ : Set S} + {S_G0 : Society α β} + {N : Neighborhood α β} + (η : SpanEmbedding H N.G) + {ν : α → S} + (hΩ₀ : S_G0.Ω.bar = η.vMap '' C₁.V) + (hbarE₁ : ∀ v ∈ V(N.G), ν v ∈ discBd E₁ ↔ v ∈ S_G0.Ω.bar) + (Nout : Neighborhood α β) + (Nin : Neighborhood α β) + (hInV : V(Nin.G) = {v | v ∈ V(N.G) ∧ ν v ∈ E₁}) + (hOutV : V(Nout.G) = {v | v ∈ V(N.G) ∧ ν v ∉ discInt E₁}) : + V(Nin.G) ∩ V(Nout.G) ⊆ η.vMap '' C₁.V := by + rintro v ⟨h₁, h₂⟩ + rw [hInV] at h₁ + rw [hOutV] at h₂ + have hb : ν v ∈ discBd E₁ := by + by_contra hn + exact h₂.2 ⟨h₁.2, hn⟩ + have := (hbarE₁ v h₁.1).mp hb + rwa [hΩ₀] at this + +private theorem inner_and_outer_neighborhoods_meet_in_second_circuit + {S : Type w} + [TopologicalSpace S] + {α : Type u} + {β : Type v} + {C₂ : Drawing S} + {E₂ : Set S} + {N : Neighborhood α β} + {ν : α → S} + (K : Drawing S → Graph α β) + (hbdE₂ : ∀ v ∈ V(N.G), ν v ∈ discBd E₂ ↔ v ∈ V(K C₂)) + (Nin : Neighborhood α β) + (hInle : Nin.G ≤ N.G) + (Nout₂ : Neighborhood α β) + (Nin₂ : Neighborhood α β) + (hInV₂ : V(Nin₂.G) = {v | v ∈ V(Nin.G) ∧ ν v ∈ E₂}) + (hOutV₂ : V(Nout₂.G) = {v | v ∈ V(Nin.G) ∧ ν v ∉ discInt E₂}) : + V(Nout₂.G) ∩ V(Nin₂.G) ⊆ V(K C₂) := by + rintro v ⟨h₁, h₂⟩ + rw [hOutV₂] at h₁ + rw [hInV₂] at h₂ + refine (hbdE₂ v (hInle.vertexSet_mono h₂.1)).mp ?_ + by_contra hn + exact h₁.2 ⟨h₂.2, hn⟩ + +private theorem path_to_second_circuit_lies_in_inner_neighborhood + {S : Type w} + [TopologicalSpace S] + {α : Type u} + {β : Type v} + {H : Drawing S} + {C₁ : Drawing S} + {C₂ : Drawing S} + {E₁ : Set S} + {pi : ℕ} + {N : Neighborhood α β} + (η : SpanEmbedding H N.G) + {ν : α → S} + (hη : ∀ v ∈ H.V, ν (η.vMap v) = v) + (hs₂ : C₂.IsSubdrawing H) + (hVU : ∀ {R : Drawing S} {v : S}, v ∈ R.V → v ∈ R.U) + (hηN : ∀ {v : S}, v ∈ H.V → η.vMap v ∈ V(N.G)) + (Nout : Neighborhood α β) + (Nin : Neighborhood α β) + (hInle : Nin.G ≤ N.G) + (hOutle : Nout.G ≤ N.G) + (hInV : V(Nin.G) = {v | v ∈ V(N.G) ∧ ν v ∈ E₁}) + (hEun : E(Nin.G) ∪ E(Nout.G) = E(N.G)) + (hC₂U : C₂.U ⊆ E₁) + (x : Fin (2 * pi + 8) → S) + (y : Fin (2 * pi + 8) → S) + (Q' : Fin (2 * pi + 8) → Graph α β) + (hQ'f : ∀ (i : Fin (2 * pi + 8)), IsFromToPathWithEnds η.imageGraph (Q' i) (η.vMap '' C₁.V) + (η.vMap '' C₂.V) (η.vMap (x i)) (η.vMap (y i))) + (hyH : ∀ (i : Fin (2 * pi + 8)), y i ∈ C₂.V) + (hZ₁ : V(Nin.G) ∩ V(Nout.G) ⊆ η.vMap '' C₁.V) : + ∀ (i : Fin (2 * pi + 8)), Q' i ≤ Nin.G := by + intro i + refine path_in_side hOutle hInle hEun.superset hZ₁ + (((hQ'f i).1.symm).mono η.imageGraph_le) ?_ (hQ'f i).2.1.subset + rw [hInV] + refine ⟨hηN (hs₂.1 (hyH i)), ?_⟩ + rw [hη _ (hs₂.1 (hyH i))] + exact hC₂U (hVU (hyH i)) + +private theorem path_to_second_circuit_stays_in_outer_neighborhood + {S : Type w} + [TopologicalSpace S] + {α : Type u} + {β : Type v} + {H : Drawing S} + {C₁ : Drawing S} + {C₂ : Drawing S} + {E₁ : Set S} + {E₂ : Set S} + (hbd₁ : discBd E₁ = C₁.U) + (hE₂E₁ : E₂ ⊆ E₁ \ C₁.U) + {pi : ℕ} + {N : Neighborhood α β} + (η : SpanEmbedding H N.G) + {ν : α → S} + (hη : ∀ v ∈ H.V, ν (η.vMap v) = v) + (hs₁ : C₁.IsSubdrawing H) + (hVU : ∀ {R : Drawing S} {v : S}, v ∈ R.V → v ∈ R.U) + (hηN : ∀ {v : S}, v ∈ H.V → η.vMap v ∈ V(N.G)) + (Nin : Neighborhood α β) + (hInV : V(Nin.G) = {v | v ∈ V(N.G) ∧ ν v ∈ E₁}) + (Nout₂ : Neighborhood α β) + (Nin₂ : Neighborhood α β) + (hInle₂ : Nin₂.G ≤ Nin.G) + (hOutle₂ : Nout₂.G ≤ Nin.G) + (hOutV₂ : V(Nout₂.G) = {v | v ∈ V(Nin.G) ∧ ν v ∉ discInt E₂}) + (hEun₂ : E(Nin₂.G) ∪ E(Nout₂.G) = E(Nin.G)) + (x : Fin (2 * pi + 8) → S) + (y : Fin (2 * pi + 8) → S) + (Q' : Fin (2 * pi + 8) → Graph α β) + (hQ'f : ∀ (i : Fin (2 * pi + 8)), IsFromToPathWithEnds η.imageGraph (Q' i) (η.vMap '' C₁.V) + (η.vMap '' C₂.V) (η.vMap (x i)) (η.vMap (y i))) + (hxH : ∀ (i : Fin (2 * pi + 8)), x i ∈ C₁.V) + (hZ₂ : V(Nout₂.G) ∩ V(Nin₂.G) ⊆ η.vMap '' C₂.V) + (hinNin : ∀ (i : Fin (2 * pi + 8)), Q' i ≤ Nin.G) : + ∀ (i : Fin (2 * pi + 8)), Q' i ≤ Nout₂.G := by + intro i + refine path_in_side (G := Nin.G) hInle₂ hOutle₂ (fun e he => Or.symm (hEun₂.superset he)) hZ₂ + (⟨hinNin i, (hQ'f i).1.2⟩ : IsGraphPathWithEnds Nin.G _ _ _) ?_ (hQ'f i).2.2.subset + rw [hOutV₂] + have hx₀ := hVU (hxH i) + refine ⟨?_, ?_⟩ + · rw [hInV] + refine ⟨hηN (hs₁.1 (hxH i)), ?_⟩ + rw [hη _ (hs₁.1 (hxH i))] + rw [← hbd₁] at hx₀ + exact GraphMinor.Surface.discBd_subset E₁ hx₀ + · rw [hη _ (hs₁.1 (hxH i))] + exact fun hi => (hE₂E₁ hi.1).2 hx₀ + +private theorem transaction_path_has_only_endpoints_on_society_boundary + {α : Type u} + {β : Type v} + {S_G0 : Society α β} + (Ω₀' : CyclicPerm α) + (hΩ₀'_bar : Ω₀'.bar = S_G0.Ω.bar) + (Sm : Society α β) + (hSmΩ : Sm.Ω = Ω₀') + (p : Graph α β) + (a : α) + (b : α) + (hint : Disjoint (pathInternalVerts Sm.G p) Sm.Ω.bar) + (hpe : pathEnds Sm.G p = {a, b}) : + ∀ z ∈ V(p), z ∈ S_G0.Ω.bar → z = a ∨ z = b := by + intro z hz hb + by_contra hn + refine disjoint_left.mp hint ⟨hz, ?_⟩ (hSmΩ.symm ▸ hΩ₀'_bar.symm ▸ hb) + rw [hpe] + simpa using hn + +private theorem interior_society_vertices_lie_in_first_disc + {S : Type w} + {α : Type u} + {β : Type v} + {E₁ : Set S} + {E₂ : Set S} + {S₂ : Society α β} + {N : Neighborhood α β} + {ν : α → S} + (hbarE₂ : ∀ v ∈ N.Ω₀.bar, ν v ∈ E₂) + (hE₂sub : E₂ ⊆ E₁) + (Sm : Society α β) + (Nin : Neighborhood α β) + (hInV : V(Nin.G) = {v | v ∈ V(N.G) ∧ ν v ∈ E₁}) + (hSmV : V(Sm.G) = V(S₂.G) ∪ V(Nin.G)) + (hN₀ : N.Ω₀ = S₂.Ω) + (hS₂b : S₂.Ω.bar = V(S₂.G) ∩ V(N.G)) : + ∀ u ∈ V(N.G), u ∈ V(Sm.G) → ν u ∈ E₁ := by + intro u hu hm + rw [hSmV] at hm + rcases hm with h | h + · have hb : u ∈ N.Ω₀.bar := by + rw [hN₀, hS₂b] + exact ⟨h, hu⟩ + exact hE₂sub (hbarE₂ u hb) + · rw [hInV] at h + exact h.2 + +private theorem crooked_transaction_paths_restrict_to_first_disc + {S : Type w} + [TopologicalSpace S] + {α : Type u} + {β : Type v} + {H : Drawing S} + {C₁ : Drawing S} + {E₁ : Set S} + {E₂ : Set S} + (hbd₁ : discBd E₁ = C₁.U) + {S_G : Society α β} + {S₂ : Society α β} + {S_G0 : Society α β} + {N : Neighborhood α β} + (η : SpanEmbedding H N.G) + (hcomp : S_G.IsComposition S₂ N) + (Y : GraphDrawing N.G S) + {ν : α → S} + (hν : ∀ v : V(N.G), (Y.iso.vertexEquiv v).1 = ν v.1) + (hη : ∀ v ∈ H.V, ν (η.vMap v) = v) + (hηe : ∀ e ∈ H.E, graphDrawingEdgeSet Y (η.eMap e) = e) + (hbarE₂ : ∀ v ∈ N.Ω₀.bar, ν v ∈ E₂) + (hΩ₀ : S_G0.Ω.bar = η.vMap '' C₁.V) + (hc₁ : C₁.IsCircuit) + (hs₁ : C₁.IsSubdrawing H) + (hE₂sub : E₂ ⊆ E₁) + (hRG : ∀ {R : Drawing S}, R.IsCircuit → R.IsSubdrawing H → R.toGraph ≤ H.toGraph) + (hKle : ∀ {R : Drawing S}, R.IsCircuit → R.IsSubdrawing H → (fun R : Drawing S => η.gmap.sub + R.toGraph) R ≤ N.G) + (hKU : ∀ {R : Drawing S}, R.IsCircuit → R.IsSubdrawing H → graphDrawingSubgraphU Y ((fun R : + Drawing S => η.gmap.sub R.toGraph) R) = R.U) + (hηN : ∀ {v : S}, v ∈ H.V → η.vMap v ∈ V(N.G)) + (hηEN : ∀ {e : Set S}, e ∈ H.E → η.eMap e ∈ E(N.G)) + (hbarE₁ : ∀ v ∈ V(N.G), ν v ∈ discBd E₁ ↔ v ∈ S_G0.Ω.bar) + (Ω₀' : CyclicPerm α) + (hΩ₀'_bar : Ω₀'.bar = S_G0.Ω.bar) + (hnat₀' : IsNaturalOrderFrom ν Ω₀' (discBd E₁)) + (hΩ₀' : Ω₀'.bar = η.vMap '' C₁.V) + (Sm : Society α β) + (Nin : Neighborhood α β) + (hSmΩ : Sm.Ω = Ω₀') + (hSmle : Sm.G ≤ S_G.G) + (hInV : V(Nin.G) = {v | v ∈ V(N.G) ∧ ν v ∈ E₁}) + (hIc : ∀ e ∈ E(Nin.G), closure (graphDrawingEdgeSet Y e) ⊆ E₁) + (hSmV : V(Sm.G) = V(S₂.G) ∪ V(Nin.G)) + (hSmE : E(Sm.G) = E(S₂.G) ∪ E(Nin.G)) + (P₂ : Set (Graph α β)) + (hcr₂ : Sm.IsCrookedTransaction P₂) + (hint₂ : ∀ Q ∈ P₂, Disjoint (pathInternalVerts Sm.G Q) Sm.Ω.bar) + (hle : Sm.G ≤ S_G0.G) : + ∀ p ∈ P₂, ∃ a b, S_G0.IsOmegaPathWithEnds p a b ∧ (∀ v ∈ H.V, η.vMap v ∈ V(p) → η.vMap v = a ∨ + η.vMap v = b ∨ v ∈ E₁ \ C₁.U) ∧ ∀ e ∈ H.E, η.eMap e ∈ E(p) → e ⊆ E₁ \ C₁.U := by + let K := fun R : Drawing S => η.gmap.sub R.toGraph + intro p hp + obtain ⟨_, _, hfence⟩ := hcr₂.1 + obtain ⟨a, b, hω⟩ := hfence.1.1 p hp + have hint := hint₂ p hp + have hpe : pathEnds Sm.G p = {a, b} := hω.1.pathEnds_eq + have hoff : ∀ z ∈ V(p), z ∈ S_G0.Ω.bar → z = a ∨ z = b := by + exact transaction_path_has_only_endpoints_on_society_boundary (α := α) (β := β) (S_G0 := S_G0) + Ω₀' hΩ₀'_bar Sm hSmΩ p a b hint hpe + have hpG : p ≤ Sm.G := hω.1.1 + obtain ⟨⟨⟨-, hNG, -, -, hEd⟩, -⟩, -, hN₀, hS₂b⟩ := hcomp + have hSmE₁ : ∀ u ∈ V(N.G), u ∈ V(Sm.G) → ν u ∈ E₁ := by + exact interior_society_vertices_lie_in_first_disc (S := S) (α := α) (β := β) (E₁ := E₁) (E₂ := + E₂) (S₂ := S₂) (N := N) (ν := ν) hbarE₂ hE₂sub Sm Nin hInV hSmV hN₀ hS₂b + refine ⟨a, b, ⟨hω.1.mono hle, hω.2.1, hΩ₀'_bar ▸ hSmΩ ▸ hω.2.2.1, hΩ₀'_bar ▸ hSmΩ ▸ hω.2.2.2⟩, + ?_, ?_⟩ + · intro v hv hm + have hmN := hηN hv + have hvE : v ∈ E₁ := by + have := hSmE₁ _ hmN (hpG.vertexSet_mono hm) + rwa [hη v hv] at this + by_cases hc : v ∈ C₁.U + · have hb : η.vMap v ∈ S_G0.Ω.bar := (hbarE₁ _ hmN).mp (by + rw [hη v hv, hbd₁] + exact hc) + rcases hoff _ hm hb with h | h + · exact Or.inl h + · exact Or.inr (Or.inl h) + · exact Or.inr (Or.inr ⟨hvE, hc⟩) + · intro e he hm x hx + have haE := hηEN he + have hmSm : η.eMap e ∈ E(Nin.G) := by + have h := hpG.edgeSet_mono hm + rw [hSmE] at h + rcases h with h | h + · exact absurd haE (disjoint_left.mp hEd h) + · exact h + have hcl := hIc _ hmSm + have heE : e ⊆ E₁ := by + have := subset_closure.trans hcl + rwa [hηe e he] at this + refine ⟨heE hx, fun hxC => ?_⟩ + -- The edge is an edge of `C₁`, joining the two ends of `p`. Then `p` is peripheral. + have hxV : x ∉ H.V := (he.2.1 hx).2 + have heC : e ∈ C₁.E := by + rw [C₁.U_eq] at hxC + rcases hxC with h | h + · exact absurd (hs₁.1 h) hxV + · obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h + have hx' : x ∈ g := by + rw [← H.closure_diff_V (hs₁.2 hg)] + exact ⟨hxg, hxV⟩ + have := H.edge_eq_of_mem he (hs₁.2 hg) hx hx' + exact this ▸ hg + obtain ⟨c, d, hl⟩ := C₁.toGraph.exists_isLink_of_mem_edgeSet heC + have hlK : (K C₁).IsLink (η.eMap e) (η.vMap c) (η.vMap d) := η.gmap.sub_isLink (hRG hc₁ hs₁) hl + have hlN : N.G.IsLink (η.eMap e) (η.vMap c) (η.vMap d) := hlK.mono (hKle hc₁ hs₁) + have hlS : S_G.G.IsLink (η.eMap e) (η.vMap c) (η.vMap d) := hlN.mono hNG + obtain ⟨c', d', hlp⟩ := p.exists_isLink_of_mem_edgeSet hm + have hlp' : S_G.G.IsLink (η.eMap e) c' d' := hlp.mono (hpG.trans hSmle) + have hlp₂ : p.IsLink (η.eMap e) (η.vMap c) (η.vMap d) := by + rcases hlS.eq_and_eq_or_eq_and_eq hlp' with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · rw [h₁, h₂] + exact hlp + · rw [h₁, h₂] + exact hlp.symm + have hcb : η.vMap c ∈ S_G0.Ω.bar := by + rw [hΩ₀] + exact mem_image_of_mem _ hl.left_mem + have hdb : η.vMap d ∈ S_G0.Ω.bar := by + rw [hΩ₀] + exact mem_image_of_mem _ hl.right_mem + have hcd : η.vMap c ≠ η.vMap d := fun h => by + rw [h] at hlp₂ + exact IsGraphPathWithEnds.no_loop hω.1 hlp₂ + have hab : (η.vMap c = a ∧ η.vMap d = b) ∨ (η.vMap c = b ∧ η.vMap d = a) := by + rcases hoff _ hlp₂.left_mem hcb with h₁ | h₁ <;> + rcases hoff _ hlp₂.right_mem hdb with h₂ | h₂ + · exact absurd (h₁.trans h₂.symm) hcd + · exact Or.inl ⟨h₁, h₂⟩ + · exact Or.inr ⟨h₁, h₂⟩ + · exact absurd (h₁.trans h₂.symm) hcd + have hends := ends_of_drawing hν hlN + have hcL : ν (η.vMap c) ∈ closure (graphDrawingEdgeSet Y (η.eMap e)) := + (hends.superset (mem_insert _ _)).1 + have hdL : ν (η.vMap d) ∈ closure (graphDrawingEdgeSet Y (η.eMap e)) := + (hends.superset (mem_insert_of_mem _ rfl)).1 + have hLsub : closure (graphDrawingEdgeSet Y (η.eMap e)) ⊆ discBd E₁ := by + rw [hbd₁, ← hKU hc₁ hs₁] + intro y hy + exact Or.inr (mem_iUnion₂.mpr ⟨η.eMap e, hlK.edge_mem, hy⟩) + have hLpre : IsPreconnected (closure (graphDrawingEdgeSet Y (η.eMap e))) := + (edge_mem_of_drawing (Y := Y) haE).2.2.1.isConnected.isPreconnected.closure + have hoffL : ∀ v ∈ Ω₀'.bar, ν v ∈ closure (graphDrawingEdgeSet Y (η.eMap e)) → + v = a ∨ v = b := by + intro v hvb hvL + have hvN : v ∈ V(N.G) := by + rw [hΩ₀'] at hvb + obtain ⟨w, hw, rfl⟩ := hvb + exact hηN (hs₁.1 hw) + have hm' : ν v ∈ closure (graphDrawingEdgeSet Y (η.eMap e)) ∩ Y.drawing.V := + ⟨hvL, mem_V_of_drawing hν hvN⟩ + rw [hends] at hm' + have hinj := inj_of_drawing hν + rcases hm' with h | h + · have := hinj hvN hlN.left_mem h + rcases hab with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact Or.inl (this.trans h₁) + · exact Or.inr (this.trans h₁) + · have := hinj hvN hlN.right_mem h + rcases hab with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact Or.inr (this.trans h₂) + · exact Or.inl (this.trans h₂) + have haL : ν a ∈ closure (graphDrawingEdgeSet Y (η.eMap e)) := by + rcases hab with ⟨h₁, -⟩ | ⟨-, h₂⟩ + · exact h₁ ▸ hcL + · exact h₂ ▸ hdL + have hbL : ν b ∈ closure (graphDrawingEdgeSet Y (η.eMap e)) := by + rcases hab with ⟨-, h₂⟩ | ⟨h₁, -⟩ + · exact h₂ ▸ hdL + · exact h₁ ▸ hcL + have hemp := interval_empty_of_arc hnat₀' hLsub hLpre haL hbL hoffL + refine hcr₂.2 p hp ⟨hp, a, b, hω, ?_⟩ + rw [hSmΩ] + rcases hemp with h | h + · exact Or.inl (by + rw [h] + exact empty_disjoint _) + · exact Or.inr (by + rw [h] + exact empty_disjoint _) + +omit [T1Space S] in +/-- The part of the proof of (8.4) after "we may assume, to simplify notation, that $G_1$ is a +drawing in $\Sigma$". Here `Y` is that drawing of `N.G`, and `ν` gives the point of each vertex. + +We cut at `C₁` and get the separation `(A, B)` of the paper. Then we cut at `C₂` and apply (8.2) to +the part between `C₁` and `C₂`, with `V(C₂)` in place of `ΩBar₂`. The paths of the hypothesis end in +`V(C₂)`, so this is the neighbourhood they cross. -/ +theorem drawn_8_4 [T2Space S] [ConnectedSpace S] {α : Type u} {β : Type v} + (hS : IsClosedSurface S) {H C₁ C₂ : Drawing S} {D E₁ E₂ : Set S} + (hD : IsClosedDisc D) (hE₁ : IsClosedDisc E₁) (hE₂ : IsClosedDisc E₂) + (hC₁ : C₁.IsCircuit ∧ C₁.IsSubdrawing H) (hC₂ : C₂.IsCircuit ∧ C₂.IsSubdrawing H) + (hbd₁ : discBd E₁ = C₁.U) (hbd₂ : discBd E₂ = C₂.U) (hE₂E₁ : E₂ ⊆ E₁ \ C₁.U) (hE₁D : E₁ ⊆ D) + {pi : ℕ} (hpi1 : pi ≠ 1) (hpi3 : pi ≠ 3) (hdist : pi + 4 ≤ regionalDistance H C₂.U C₁.U) + {X : Set S} (hX : X ⊆ C₁.V) (P : Fin (2 * pi + 8) → Graph S (Set S)) + (hP : ∀ i, ∃ x ∈ X, ∃ y ∈ C₂.V, IsGraphPathWithEnds H.toGraph (P i) x y ∧ V(P i) ∩ C₁.V = {x}) + (hPd : Pairwise fun i j => Disjoint V(P i) V(P j)) + {S_G S₂ S_G0 : Society α β} {N : Neighborhood α β} (η : SpanEmbedding H N.G) + (hcomp : S_G.IsComposition S₂ N) (Y : GraphDrawing N.G S) {ν : α → S} + (hν : ∀ v : V(N.G), (Y.iso.vertexEquiv v).1 = ν v.1) (hYU : Y.drawing.U ⊆ D) + (hη : ∀ v ∈ H.V, ν (η.vMap v) = v) + (hηe : ∀ e ∈ H.E, graphDrawingEdgeSet Y (η.eMap e) = e) + (hbarD : ∀ v ∈ V(N.G), ν v ∈ discBd D ↔ v ∈ N.Ω.bar) + (hbarE₂ : ∀ v ∈ N.Ω₀.bar, ν v ∈ E₂) (hnat₁ : IsNaturalOrderFrom ν N.Ω (discBd D)) + (hΩ₀ : S_G0.Ω.bar = η.vMap '' C₁.V) (hnat₀ : IsNaturalOrderFrom ν S_G0.Ω (discBd E₁)) + (hG0 : S_G0.G = S_G.G) + (hcr : ∃ P_set : Set (Graph α β), S_G.IsCrookedTransaction P_set ∧ pi ≤ P_set.ncard) : + ∃ P_set : Set (Graph α β), S_G0.IsCrookedTransaction P_set ∧ pi ≤ P_set.ncard ∧ + S_G0.transactionEnds P_set ⊆ η.vMap '' X ∧ + ∀ p ∈ P_set, ∃ a b : α, S_G0.IsOmegaPathWithEnds p a b ∧ + (∀ v ∈ H.V, η.vMap v ∈ V(p) → η.vMap v = a ∨ η.vMap v = b ∨ v ∈ E₁ \ C₁.U) ∧ + (∀ e ∈ H.E, η.eMap e ∈ E(p) → e ⊆ E₁ \ C₁.U) := by + classical + have : CompactSpace S := hS.1 + have hman : ∀ x : S, IsManifoldPoint x := (IsClosedSurface.isSurface hS).2.2 + obtain ⟨hc₁, hs₁⟩ := id hC₁ + obtain ⟨hc₂, hs₂⟩ := id hC₂ + have hE₂sub : E₂ ⊆ E₁ := hE₂E₁.trans sdiff_subset + have hVU : ∀ {R : Drawing S} {v : S}, v ∈ R.V → v ∈ R.U := fun {R v} hv => by + rw [R.U_eq] + exact Or.inl hv + -- The circuits of `H`, as subgraphs of `N.G`. + let K : Drawing S → Graph α β := fun R => η.gmap.sub R.toGraph + have hRG : ∀ {R : Drawing S}, R.IsCircuit → R.IsSubdrawing H → R.toGraph ≤ H.toGraph := + fun hc hs => (isGraphCircuit_of_isCircuit hc hs).1 + have hKle : ∀ {R : Drawing S}, R.IsCircuit → R.IsSubdrawing H → K R ≤ N.G := + fun hc hs => (η.gmap.sub_le (hRG hc hs)).trans η.imageGraph_le + have hKU : ∀ {R : Drawing S}, R.IsCircuit → R.IsSubdrawing H → + graphDrawingSubgraphU Y (K R) = R.U := fun hc hs => + subgraphU_image hs η Y hν η.imageGraph_le hη hηe (hRG hc hs) + have hηN : ∀ {v : S}, v ∈ H.V → η.vMap v ∈ V(N.G) := fun hv => + η.imageGraph_le.vertexSet_mono (η.gmap.bijV.mapsTo hv) + have hηEN : ∀ {e : Set S}, e ∈ H.E → η.eMap e ∈ E(N.G) := fun he => + η.imageGraph_le.edgeSet_mono (η.gmap.bijE.mapsTo he) + have hbarE₁ : ∀ v ∈ V(N.G), ν v ∈ discBd E₁ ↔ v ∈ S_G0.Ω.bar := by + intro v hv + rw [hbd₁, ← hKU hc₁ hs₁, hΩ₀] + exact mem_subgraphU_iff hν (hKle hc₁ hs₁) hv + have hbdE₂ : ∀ v ∈ V(N.G), ν v ∈ discBd E₂ ↔ v ∈ V(K C₂) := by + intro v hv + rw [hbd₂, ← hKU hc₂ hs₂] + exact mem_subgraphU_iff hν (hKle hc₂ hs₂) hv + -- The separation `(A, B)` at `C₁`. Then `(G, Ω_1)` is the composition of `(A ∪ G_2, Ω_0)` with + -- `(B, Ω_1, Ω_0)`, and the latter is rural. + obtain ⟨Ω₀', hΩ₀'_or, hΩ₀'_bar, hnat₀', hpres₁⟩ := + exists_presentation_of_drawing hD hE₁ hE₁D hnat₁ hnat₀ + have hΩ₀' : Ω₀'.bar = η.vMap '' C₁.V := hΩ₀'_bar.trans hΩ₀ + obtain ⟨Sm, Nout, Nin, Yin, Yout, hSmΩ, hOutΩ, hOutΩ₀, hInΩ, hInΩ₀, hInle, hOutle, hSmle, hInV, + hOutV, -, -, hEun, hIc, hOT, hSmV, hSmE, hcomp₁, hcomp₂, hνi, hνo, hUi, hUo, hei, -, hpi', -⟩ := + exists_cut_society hS hcomp Y hν hD hE₁ hE₂sub hE₁D + (fun v hv => (hbarD v (N.bar_subset hv)).mpr hv) hbarE₂ (C := K C₁) (hKle hc₁ hs₁) + (hbd₁.trans (hKU hc₁ hs₁).symm) (T := ∅) (empty_subset _) Ω₀' hΩ₀' + have hIn₁ : ∀ a ∈ E(N.G), graphDrawingEdgeSet Y a ⊆ E₁ → a ∈ E(Nin.G) := by + intro a ha hsub + rcases hEun.superset ha with h | h + · exact h + · rcases hOT a h with h' | h' + · exact absurd h' (notMem_empty a) + · exact absurd hsub h' + have hKin : ∀ {R : Drawing S}, R.IsCircuit → R.IsSubdrawing H → R.U ⊆ E₁ → K R ≤ Nin.G := by + intro R hc hs hU + refine le_of_subset_of_subset (hKle hc hs) hInle ?_ ?_ + · rintro _ ⟨v, hv, rfl⟩ + rw [hInV] + refine ⟨hηN (hs.1 hv), ?_⟩ + rw [hη v (hs.1 hv)] + exact hU (hVU hv) + · intro a ha + rw [show E(K R) = _ from η.gmap.edgeSet_sub (hRG hc hs)] at ha + obtain ⟨e, he, rfl⟩ := ha + refine hIn₁ _ (hηEN (hs.2 he)) ?_ + rw [hηe e (hs.2 he)] + exact (edge_subset_U he).trans hU + have hrural : Nout.IsRural := by + obtain ⟨Pr, -, -, -, -, -, -, -⟩ := hpres₁ Nout Yout hOutΩ hOutΩ₀ + (fun x hx => ⟨hYU (hUo hx).1, (hUo hx).2⟩) hνo + (fun v hv => by + rw [hOutΩ] + exact hbarD v (hOutle.vertexSet_mono hv)) + (fun v hv => by + rw [hOutΩ₀, hΩ₀'_bar] + exact hbarE₁ v (hOutle.vertexSet_mono hv)) + exact ⟨Pr.Γ, Pr.Δ, Pr.Δ₀, Pr.isClosedDisc_Δ, Pr.Δ₀_subset_Δ, Pr.U_subset, Pr.mem_bd_Δ_iff, + Pr.mem_bd_Δ₀_iff, Pr.agrees_Δ, Pr.agrees_Δ₀⟩ + -- By [3, theorem (9.1)], `(A ∪ G_2, Ω_0)` has a crooked transaction of order `≥ π`. + obtain ⟨P₀, hcr₀, hcard₀⟩ := hcr + obtain ⟨P₁, hcr₁, hcard₁⟩ := GM09.gm14_theorem_9_1 S_G Sm Nout pi P₀ hrural hcomp₁ hcr₀ hcard₀ + -- The cut at `C₂`. The edges of `C₂` stay with the outer part. + have hC₂U : C₂.U ⊆ E₁ := by + rw [← hbd₂] + exact (GraphMinor.Surface.discBd_subset E₂).trans hE₂sub + have hC₂in : K C₂ ≤ Nin.G := hKin hc₂ hs₂ hC₂U + have hfin : V(K C₂).Finite := N.finite_V.subset (hKle hc₂ hs₂).vertexSet_mono + obtain ⟨Ω₂_raw, hbar₂_raw, hnat₂_raw⟩ := exists_natural_order_injOn hE₂.isOArc_discBd hfin + ((inj_of_drawing hν).mono (hKle hc₂ hs₂).vertexSet_mono) + (fun v hv => (hbdE₂ v ((hKle hc₂ hs₂).vertexSet_mono hv)).mpr hv) + obtain ⟨Ω₂', -, hbar₂'_eq, hnat₂', hpres₂⟩ := + exists_presentation_of_drawing hE₁ hE₂ hE₂sub hnat₀' hnat₂_raw + have hbar₂' : Ω₂'.bar = V(K C₂) := hbar₂'_eq.trans hbar₂_raw + obtain ⟨Sm₂, Nout₂, Nin₂, -, Yout₂, -, hOutΩ', hOutΩ₀', -, -, hInle₂, hOutle₂, -, hInV₂, hOutV₂, + -, hTO₂, hEun₂, hIc₂, -, -, -, hcomp₂₁, -, -, hνo₂, -, hUo₂, -, -, -, hpo₂⟩ := + exists_cut_society hS hcomp₂ Yin hνi hE₁ hE₂ Subset.rfl hE₂sub + (fun v hv => (hbarE₁ v (hInle.vertexSet_mono (Nin.bar_subset hv))).mpr (hΩ₀'_bar ▸ hInΩ ▸ hv)) + (fun v hv => hbarE₂ v (hInΩ₀ ▸ hv)) (C := K C₂) hC₂in + (hbd₂.trans (((hpi' _ hC₂in).trans (hKU hc₂ hs₂)).symm)) (T := E(K C₂)) Subset.rfl Ω₂' hbar₂' + have hNout₂V : ∀ v ∈ V(Nout₂.G), v ∈ V(N.G) := fun v hv => + hInle.vertexSet_mono (hOutle₂.vertexSet_mono hv) + obtain ⟨Pr₂, f, -, -, hΔ, hΔ₀, hdisc, hpts⟩ := hpres₂ Nout₂ Yout₂ (hOutΩ'.trans hInΩ) hOutΩ₀' + (fun x hx => ⟨(hUi (hUo₂ hx).1).2, (hUo₂ hx).2⟩) hνo₂ + (fun v hv => by + rw [hOutΩ', hInΩ, hΩ₀'_bar] + exact hbarE₁ v (hNout₂V v hv)) + (fun v hv => by + rw [hOutΩ₀', hbar₂'] + exact hbdE₂ v (hNout₂V v hv)) + -- The neighbourhood has breadth `≥ π + 5`, because `C₁, C₂` have regional distance `≥ π + 4`. + obtain ⟨R, A', hRA, ⟨hR0, hA0⟩, hlt⟩ := + exists_nest_between hS H hE₁ hE₂ hC₁ hC₂ hbd₁ hbd₂ hE₂E₁ (m := pi + 3) hdist + have hRU : ∀ i, (R i).U ⊆ A' i := fun i => by + rw [← (hRA i).2.2.2.1] + exact GraphMinor.Surface.discBd_subset _ + have hKR : ∀ i, K (R i) ≤ Nout₂.G := by + exact nested_circuits_lie_in_outer_neighborhood (S := S) (α := α) (β := β) (H := H) (C₂ := C₂) + (E₁ := E₁) (E₂ := E₂) hE₂ (pi := pi) (N := N) η Y (ν := ν) hη hηe hman hVU hRG Nin Yin hei + hKin Nout₂ Nin₂ hOutle₂ hOutV₂ hTO₂ hEun₂ hIc₂ R A' hRA hlt hR0 hA0 hRU + have hdjU : ∀ i j, i < j → Disjoint (R i).U (R j).U := fun i j h => + disjoint_left.mpr fun x h₁ h₂ => (hlt i j h (hRU i h₁)).2 h₂ + have hbreadth : Nout₂.HasBreadthGe (pi + 5) := by + exact nested_circuits_give_neighborhood_breadth (S := S) (α := α) (β := β) (H := H) (E₁ := E₁) + (E₂ := E₂) (pi := pi) (N := N) η Y hVU hKU Nin Yin hpi' Nout₂ Yout₂ hOutle₂ hpo₂ Pr₂ f hΔ + hΔ₀ hdisc hpts R A' hRA hlt hKR hdjU + -- The paths, cut at their first vertex of `C₂`. + have hQ : ∀ i, ∃ (Q : Graph S (Set S)) (x y : S), Q ≤ P i ∧ + IsFromToPathWithEnds H.toGraph Q C₁.V C₂.V x y ∧ x ∈ X := by + intro i + obtain ⟨x, hx, y, hy, hp, hcap⟩ := hP i + obtain ⟨x', hx', y', -, Q, hle, hQ⟩ := hp.exists_isFromToPathWithEnds (hX hx) hy + have hxx : x' = x := hcap.subset ⟨hle.vertexSet_mono hQ.1.left_mem, hx'⟩ + exact ⟨Q, x', y', hle, hQ, hxx ▸ hx⟩ + choose Q x y hQP hQf hxX using hQ + let Q' : Fin (2 * pi + 8) → Graph α β := fun i => η.gmap.sub (Q i) + have hQ'f : ∀ i, IsFromToPathWithEnds η.imageGraph (Q' i) (η.vMap '' C₁.V) (η.vMap '' C₂.V) + (η.vMap (x i)) (η.vMap (y i)) := fun i => η.gmap.fromTo hs₁.1 hs₂.1 (hQf i) + have hxH : ∀ i, x i ∈ C₁.V := fun i => (hQf i).left_mem_X + have hyH : ∀ i, y i ∈ C₂.V := fun i => (hQf i).right_mem_Y + have hZ₁ : V(Nin.G) ∩ V(Nout.G) ⊆ V(K C₁) := by + exact inner_and_outer_neighborhoods_meet_in_first_circuit (S := S) (α := α) (β := β) (H := H) + (C₁ := C₁) (E₁ := E₁) (S_G0 := S_G0) (N := N) η (ν := ν) hΩ₀ hbarE₁ Nout Nin hInV hOutV + have hZ₂ : V(Nout₂.G) ∩ V(Nin₂.G) ⊆ V(K C₂) := by + exact inner_and_outer_neighborhoods_meet_in_second_circuit (S := S) (α := α) (β := β) (C₂ := + C₂) (E₂ := E₂) (N := N) (ν := ν) K hbdE₂ Nin hInle Nout₂ Nin₂ hInV₂ hOutV₂ + have hinNin : ∀ i, Q' i ≤ Nin.G := by + exact path_to_second_circuit_lies_in_inner_neighborhood (S := S) (α := α) (β := β) (H := H) + (C₁ := C₁) (C₂ := C₂) (E₁ := E₁) (pi := pi) (N := N) η (ν := ν) hη hs₂ hVU hηN Nout Nin + hInle hOutle hInV hEun hC₂U x y Q' hQ'f hyH hZ₁ + have hinOut : ∀ i, Q' i ≤ Nout₂.G := by + exact path_to_second_circuit_stays_in_outer_neighborhood (S := S) (α := α) (β := β) (H := H) + (C₁ := C₁) (C₂ := C₂) (E₁ := E₁) (E₂ := E₂) hbd₁ hE₂E₁ (pi := pi) (N := N) η (ν := ν) hη hs₁ + hVU hηN Nin hInV Nout₂ Nin₂ hInle₂ hOutle₂ hOutV₂ hEun₂ x y Q' hQ'f hxH hZ₂ hinNin + have hpaths : ∀ i, IsFromToPathWithEnds Nout₂.G (Q' i) Nout₂.Ω.bar Nout₂.Ω₀.bar + (η.vMap (x i)) (η.vMap (y i)) ∧ η.vMap (x i) ∈ η.vMap '' X := by + intro i + refine ⟨⟨⟨hinOut i, (hQ'f i).1.2⟩, ?_, ?_⟩, mem_image_of_mem _ (hxX i)⟩ + · rw [hOutΩ', hInΩ, hΩ₀'] + exact (hQ'f i).2.1 + · rw [hOutΩ₀', hbar₂'] + exact (hQ'f i).2.2 + have hdisj : Pairwise fun i j => Disjoint V(Q' i) V(Q' j) := by + intro i j hij + refine disjoint_left.mpr ?_ + rintro _ ⟨a, ha, rfl⟩ ⟨b, hb, hab⟩ + have hba : b = a := η.gmap.bijV.injOn ((hQf j).1.1.vertexSet_mono hb) + ((hQf i).1.1.vertexSet_mono ha) hab + exact disjoint_left.mp (hPd hij) ((hQP i).vertexSet_mono ha) + ((hQP j).vertexSet_mono (hba ▸ hb)) + have hX' : η.vMap '' X ⊆ Nout₂.Ω.bar := by + rw [hOutΩ', hInΩ, hΩ₀'] + exact image_mono hX + -- By (8.2), `(A ∪ G_2, Ω_0)` has a crooked transaction with ends in `X` and no internal vertex + -- in `ΩBar_0`. + obtain ⟨P₂, hcr₂, hcard₂, hends₂, hint₂⟩ := theorem_8_2_proof pi Sm Sm₂ Nout₂ (η.vMap '' X) Q' + (fun i => η.vMap (x i)) (fun i => η.vMap (y i)) P₁ hpi1 hpi3 hcomp₂₁ hbreadth hX' hpaths hdisj + hcr₁ hcard₁ + -- Then `P_set` is a crooked transaction in `(G, Ω_0)`. + have hle : Sm.G ≤ S_G0.G := hSmle.trans hG0.ge + let S_G0' : Society α β := + { G := S_G0.G + Ω := Ω₀' + finite_V := S_G0.finite_V + finite_E := S_G0.finite_E + bar_subset := hΩ₀'_bar ▸ S_G0.bar_subset } + obtain ⟨hcrG', hendsG'⟩ := IsCrookedTransaction.mono (S_sup := S_G0') hle hSmΩ hcr₂ + have hcrG : S_G0.IsCrookedTransaction P₂ := + (isCrookedTransaction_of_eq_or_reverse (S₁ := S_G0') (S₂ := S_G0) rfl hΩ₀'_or).mp hcrG' + have hendsG : S_G0.transactionEnds P₂ = Sm.transactionEnds P₂ := + (transactionEnds_of_eq_or_reverse (S₁ := S_G0') (S₂ := S_G0) rfl hΩ₀'_or P₂).symm.trans hendsG' + have hpathsRegion : ∀ p ∈ P₂, ∃ a b : α, S_G0.IsOmegaPathWithEnds p a b ∧ + (∀ v ∈ H.V, η.vMap v ∈ V(p) → η.vMap v = a ∨ η.vMap v = b ∨ v ∈ E₁ \ C₁.U) ∧ + (∀ e ∈ H.E, η.eMap e ∈ E(p) → e ⊆ E₁ \ C₁.U) := by + exact crooked_transaction_paths_restrict_to_first_disc (S := S) (α := α) (β := β) (H := H) (C₁ + := C₁) (E₁ := E₁) (E₂ := E₂) hbd₁ (S_G := S_G) (S₂ := S₂) (S_G0 := S_G0) (N := N) η hcomp Y + (ν := ν) hν hη hηe hbarE₂ hΩ₀ hc₁ hs₁ hE₂sub hRG hKle hKU hηN hηEN hbarE₁ Ω₀' hΩ₀'_bar + hnat₀' hΩ₀' Sm Nin hSmΩ hSmle hInV hIc hSmV hSmE P₂ hcr₂ hint₂ hle + exact ⟨P₂, hcrG, hcard₂, hendsG.symm ▸ hends₂, hpathsRegion⟩ + +omit [T1Space S] in +/-- Graph Minors XIV, (8.4) (pages 41–42): +"Let $\Sigma$ be a closed cylinder with ends $F_1, F_2$, and let $H$ be a rigid drawing in +$\Sigma$. Let $C_1, C_2$ be disjoint circuits of $H$, both winding around $\Sigma$, and such +that $F_2$ and $U(C_2)$ both lie in the same component of $\Sigma - U(C_1)$. Let $\pi \ge 0$ +with $\pi \ne 1, 3$ and let the regional distance between $U(C_1)$ and $U(C_2)$ be at least +$\pi + 4$. Let $X \subseteq V(C_1)$, and let there be $2\pi + 8$ mutually disjoint paths of +$H$ from $X$ to $V(C_2)$, each with no vertex in $C_1$ except its initial vertex. Let $H$ be +a subgraph of $G_1$, let $\mathscr{S}$ be a 3-segregation of $G_1$, and let $\alpha$ be an +arrangement of $\mathscr{S}$ in $\Sigma$ compatible with $H$. Let $\Omega_i = +\alpha^{-1}(F_i) \, (i = 1, 2)$, and let $\Omega_0$ be a natural order of $V(C_1)$ from +$U(C_1)$. Now let $(G, \Omega_1)$ be a society which is the composition of a society $(G_2, +\Omega_2)$ and the neighbourhood $(G_1, \Omega_1, \Omega_2)$, and let $(G, \Omega_1)$ have a +crooked transaction of cardinality $\ge \pi$. Then $(G, \Omega_0)$ has a crooked transaction +$\mathscr{P}$ of cardinality $\ge \pi$ such that for each $P \in \mathscr{P}$ with ends $u, +v$ say, $u, v \in X$ and $U(P \cap H) - \{u, v\}$ is included in the component of $\Sigma - +U(C_1)$ which includes $U(C_2)$." -/ +theorem theorem_8_4_proof : Theorem84DiscStatement.{u, v, w} := by + intro S _ _ _ α β H C₁ C₂ D D₂ E₁ E₂ X pi N S_seg α_disc α_pt S_G S₂ S_G0 μ P η hS hD _ hE₁ hE₂ + hD₂E₂ hE₂E₁ hE₁D hrig hC₁ hC₂ hbd₁ hbd₂ hpi1 hpi3 hdist hX hP hPd hseg harr hcompat hdiscs + hpull₁ hpull₂ hcomp hG0 hΩ₀ hμ hnat₀ hcr + classical + have hman : ∀ x : S, IsManifoldPoint x := (IsClosedSurface.isSurface hS).2.2 + have hCyl : D \ discInt D₂ ⊆ D := sdiff_subset + -- Claim (1): we pass to a smaller graph for which (1) holds, by induction on + -- `|V(G_1)| + |E(G_1)|`. + have hbar₁ : N.Ω.bar ⊆ segregationVertices S_seg := fun v hv => by + rw [hpull₁.1] at hv + exact hv.1 + have hbar₂ : N.Ω₀.bar ⊆ segregationVertices S_seg := fun v hv => by + rw [hpull₂.1] at hv + exact hv.1 + obtain ⟨N', S_G', η', S_seg', α_disc', -, hΩ, hΩ₂, -, hGle, hseg', harr', hcompat', hsv, -, hvm, + hem, hdisc', hcomp', hcr', hone⟩ := exists_reduced _ S_G N η S_seg α_disc rfl hseg harr hcompat + hbar₁ hbar₂ hcomp hcr + have hdisc'' : ∀ S₀ ∈ S_seg', α_disc' S₀ ⊆ D \ discInt D₂ := fun S' hS' => by + obtain ⟨S₁, hS₁, he⟩ := hdisc' S' hS' + rw [he] + exact hdiscs S₁ hS₁ + -- By (2) and the rigidity of `H`, we may assume that `G_1` is a drawing in `Σ`. + obtain ⟨Y, ν, hYU, hν, hνα, hνη, hνe, hlast⟩ := + exists_reduced_drawing hS hD hCyl hrig hseg' harr' hcompat' hdisc'' hone + have hYD : Y.drawing.U ⊆ D := hYU.trans (iUnion₂_subset fun S₀ h => (hdisc'' S₀ h).trans hCyl) + have hsv' : ∀ {v : α}, v ∈ segregationVertices S_seg → ν v = α_pt v := fun {v} hv => + hνα v (hsv ▸ hv) + have hbarD : ∀ v ∈ V(N'.G), ν v ∈ discBd D ↔ v ∈ N'.Ω.bar := by + intro v hv + rw [hΩ, hpull₁.1] + constructor + · intro hb + obtain ⟨S₀, hS₀, hd, hin⟩ := hlast v hv + have hdi := (harr'.isClosedDisc S₀ hS₀).1 + have hb' : ν v ∈ subBd (α_disc' S₀) := by + rw [IsClosedDisc.subBd_eq_discBd hS hdi] + exact mem_discBd_of_subset hman hdi ((hdisc'' S₀ hS₀).trans hCyl) hd hb + have hm : v ∈ segregationVertices S_seg := by + rw [← hsv] + exact mem_iUnion₂.mpr ⟨S₀, hS₀, hin hb'⟩ + exact ⟨hm, hsv' hm ▸ hb⟩ + · rintro ⟨hm, hb⟩ + rw [hsv' hm] + exact hb + have hbarE₂ : ∀ v ∈ N'.Ω₀.bar, ν v ∈ E₂ := by + intro v hv + rw [hΩ₂, hpull₂.1] at hv + rw [hsv' hv.1] + exact hD₂E₂ (GraphMinor.Surface.discBd_subset D₂ hv.2) + have hnat₁ : IsNaturalOrderFrom ν N'.Ω (discBd D) := by + rw [hΩ] + exact hpull₁.2.congr fun v hv => hsv' (hbar₁ hv) + have hsoc : S_G0.Ω.bar ⊆ V(S_G'.G) := by + rw [hΩ₀] + rintro _ ⟨v, hv, rfl⟩ + have h : η'.vMap v ∈ V(N'.G) := + η'.imageGraph_le.vertexSet_mono (η'.gmap.bijV.mapsTo (hC₁.2.1 hv)) + rw [hvm] at h + exact hcomp'.1.1.2.1.vertexSet_mono h + let soc : Society α β := ⟨S_G'.G, S_G0.Ω, S_G'.finite_V, S_G'.finite_E, hsoc⟩ + have hΩ₀' : soc.Ω.bar = η'.vMap '' C₁.V := by + rw [hvm] + exact hΩ₀ + have hnat' : IsNaturalOrderFrom ν soc.Ω (discBd E₁) := by + refine hnat₀.congr fun v hv => ?_ + rw [hΩ₀] at hv + obtain ⟨w, hw, rfl⟩ := hv + rw [hμ w hw, ← hvm] + exact hνη w (hC₁.2.1 hw) + obtain ⟨P_set, hcrs, hcard, hends, hrest⟩ := drawn_8_4 hS hD hE₁ hE₂ hC₁ hC₂ hbd₁ hbd₂ + hE₂E₁ hE₁D hpi1 hpi3 hdist hX P hP hPd (S_G0 := soc) η' hcomp' Y hν hYD hνη hνe hbarD hbarE₂ + hnat₁ hΩ₀' hnat' rfl hcr' + -- A crooked transaction in the smaller graph is one in `G`. + have hle : soc.G ≤ S_G0.G := hGle.trans hG0.ge + obtain ⟨hcrG, hendsG⟩ := IsCrookedTransaction.mono hle rfl hcrs + refine ⟨P_set, hcrG, hcard, ?_, ?_⟩ + · rw [hendsG, ← hvm] + exact hends + · intro p hp + obtain ⟨a, b, hω, hv, he⟩ := hrest p hp + refine ⟨a, b, ⟨hω.1.mono hle, hω.2.1, hω.2.2.1, hω.2.2.2⟩, ?_, ?_⟩ + · intro w hw hm + have := hv w hw (by + rw [hvm] + exact hm) + rwa [hvm] at this + · intro e heH hm + exact he e heH (by + rw [hem] + exact hm) + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section83Proof.lean b/LeanPool/GraphMinor/GM14/Section83Proof.lean new file mode 100644 index 0000000000..bf83b756c4 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section83Proof.lean @@ -0,0 +1,875 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM14.Section8a +import LeanPool.GraphMinor.GM14.Section8Core +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2a +import LeanPool.GraphMinor.GM09.Section2d +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section3c +import LeanPool.GraphMinor.GM09.Section4a +import LeanPool.GraphMinor.GM09.Section4b +import LeanPool.GraphMinor.GM09.Section4c +import LeanPool.GraphMinor.GM09.Section5a +import LeanPool.GraphMinor.GM09.Section9 +import LeanPool.GraphMinor.GM09.Section10b +import LeanPool.GraphMinor.GM09.Section10d +import LeanPool.GraphMinor.GM09.Section10e +import LeanPool.GraphMinor.GM09.Section10f +import LeanPool.GraphMinor.GM09.Section10g +import Mathlib.Data.Set.Card + +/-! +# Graph Minors XIV, (8.3): Numerical Refinement of (8.2) for Crosses (`π = 2`) + +This file proves `(8.3)` (`theorem_8_3`, pages 40–41) of N. Robertson and P. D. Seymour, +*Graph Minors. XIV. Extending an embedding*, J. Combin. Theory Ser. B **65** (1995) 23–50: + +- `Society.theorem_5_2_p2` and `Society.theorem_5_2_p2_without_no_internal`: refinement of + Graph Minors IX, `(5.2)` for `p = 2` using `2` separating paths `Q₀, Q₁` instead of `p + 4 = 6`. +- `theorem_10_3_p2_step` and `theorem_10_3_p2`: refinement of Graph Minors IX, `(10.3)` for + `p = 2` under breadth `≥ 2` and `4 ≤ X.ncard`. +- `exists_clean_paths_p2` and `theorem_10_4_p2`: refinement of Graph Minors IX, `(10.4)` for + `p = 2` under breadth `≥ 3` and `4 ≤ X.ncard`. +- `theorem_8_3`: Graph Minors XIV, `(8.3)` (pages 40–41). +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 + GraphMinor.GM11 + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## 1. Refinement of GM09 (5.2) for `p = 2` with `2` Separating Paths -/ + +/-- A transaction of cardinality `2` has no overpass. -/ +private theorem not_isOverpass_of_ncard_eq_two (S : Society α β) + {P_set : Set (Graph α β)} (hfin : P_set.Finite) (hcard : P_set.ncard = 2) : + ¬ ∃ P₁ ∈ P_set, S.IsOverpass P_set P₁ := by + rintro ⟨P₁, hP₁_in, _, _, M₁, hM₁, M₂, hM₂, hM12, _, _⟩ + have hcard_diff : (P_set \ {P₁}).ncard = 1 := by + have h := ncard_sdiff_singleton_add_one hP₁_in hfin + omega + have hsub : ({M₁, M₂} : Set (Graph α β)) ⊆ P_set \ {P₁} := by + rintro M (rfl | rfl) <;> assumption + have hle : ({M₁, M₂} : Set (Graph α β)).ncard ≤ (P_set \ {P₁}).ncard := + ncard_le_ncard hsub hfin.sdiff + rw [ncard_pair hM12, hcard_diff] at hle + omega + +/-- Structure of a crooked transaction `P_set` of cardinality `2` when a separating `Ω`-path `Q` +with ends `a_Q, b_Q` is half-covered by `P_set`. -/ +private theorem halfCovered_of_ncard_eq_two (S : Society α β) + {P_set : Set (Graph α β)} (hcr : S.IsCrookedTransaction P_set) (hcard : P_set.ncard = 2) + {Q : Graph α β} {a_Q b_Q : α} + (hQ_ends : S.IsOmegaPathWithEnds Q a_Q b_Q) + (hQ_sep : S.IsSeparatingOmegaPath Q) + (hcov : S.IsHalfCovered P_set Q) : + ∃ (P₁ P₂ : Graph α β) (s₁ t₁ s₂ t₂ c : α), + P_set = {P₁, P₂} ∧ P₁ ≠ P₂ ∧ + S.OmegaPathsCross P₁ P₂ ∧ + Disjoint V(P₂) V(Q) ∧ + S.IsOmegaPathWithEnds P₁ s₁ t₁ ∧ + S.IsOmegaPathWithEnds P₂ s₂ t₂ ∧ + (s₁ = a_Q ∨ s₁ = b_Q) ∧ + IsGraphPathWithEnds S.G (subgraphInter S.G P₁ Q) s₁ c ∧ + S.transactionEnds P_set = {s₁, t₁, s₂, t₂} ∧ + ((t₁ ∈ S.Ω.interval a_Q b_Q ∧ s₂ ∈ S.Ω.interval a_Q b_Q ∧ t₂ ∈ S.Ω.interval a_Q b_Q) ∨ + (t₁ ∈ S.Ω.interval b_Q a_Q ∧ s₂ ∈ S.Ω.interval b_Q a_Q ∧ t₂ ∈ S.Ω.interval b_Q a_Q)) := by + rcases hcov with ⟨P₁, hP₁_in, _, huniq, s₁, t₁, a', b', c, hP₁_ends, hQ_ends', rfl, _, + hinter_path⟩ + obtain ⟨A, B, hfence⟩ := hcr.1 + have hfin : P_set.Finite := hfence.1.finite S + have hcard_diff : (P_set \ {P₁}).ncard = 1 := by + have h := ncard_sdiff_singleton_add_one hP₁_in hfin + omega + obtain ⟨P₂, hP₂_eq⟩ := ncard_eq_one.mp hcard_diff + have hP₂_in_diff : P₂ ∈ P_set \ {P₁} := hP₂_eq ▸ mem_singleton P₂ + have hP₂_in : P₂ ∈ P_set := hP₂_in_diff.1 + have hP12 : P₁ ≠ P₂ := Ne.symm hP₂_in_diff.2 + have hP_set_eq : P_set = {P₁, P₂} := by + ext R + simp only [mem_insert_iff, mem_singleton_iff] + constructor + · intro hR + by_cases hRP₁ : R = P₁ + · exact Or.inl hRP₁ + · have hR_diff : R ∈ P_set \ {P₁} := ⟨hR, hRP₁⟩ + rw [hP₂_eq, mem_singleton_iff] at hR_diff + exact Or.inr hR_diff + · rintro (rfl | rfl) <;> assumption + have hcr_pair : S.IsCrookedTransaction {P₁, P₂} := hP_set_eq ▸ hcr + have hcross : S.OmegaPathsCross P₁ P₂ := + Society.omegaPathsCross_of_isCrookedTransaction_pair S hP12 hcr_pair + have hdisj_P₂Q : Disjoint V(P₂) V(Q) := by + by_contra hnot + rw [not_disjoint_iff_nonempty_inter] at hnot + exact hP12 (huniq P₂ hP₂_in hnot).symm + obtain ⟨s₂, _, t₂, _, hP₂_ends⟩ := hfence.2.2 P₂ hP₂_in + have hs₁_ab : s₁ = a_Q ∨ s₁ = b_Q := by + rcases hQ_ends.ends_eq S hQ_ends' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl rfl + · exact Or.inr rfl + have hW_eq : S.transactionEnds P_set = {s₁, t₁, s₂, t₂} := by + rw [hP_set_eq] + ext v + simp only [Society.transactionEnds, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨R, rfl | rfl, u, hR_vu⟩ + · rcases hP₁_ends.ends_eq S hR_vu with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl rfl + · exact Or.inr (Or.inl rfl) + · rcases hP₂_ends.ends_eq S hR_vu with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inr (Or.inr (Or.inl rfl)) + · exact Or.inr (Or.inr (Or.inr rfl)) + · rintro (rfl | rfl | rfl | rfl) + · exact ⟨P₁, Or.inl rfl, t₁, hP₁_ends⟩ + · exact ⟨P₁, Or.inl rfl, s₁, hP₁_ends.symm S⟩ + · exact ⟨P₂, Or.inr rfl, t₂, hP₂_ends⟩ + · exact ⟨P₂, Or.inr rfl, s₂, hP₂_ends.symm S⟩ + -- Determine the interval containing `s₂, t₂, t₁`. + have hs₂_ne_a : s₂ ≠ a_Q := + fun h => disjoint_left.mp hdisj_P₂Q hP₂_ends.1.left_mem (h ▸ hQ_ends.1.left_mem) + have hs₂_ne_b : s₂ ≠ b_Q := + fun h => disjoint_left.mp hdisj_P₂Q hP₂_ends.1.left_mem (h ▸ hQ_ends.1.right_mem) + have hcross_ends : S.Ω.Crosses s₁ t₁ s₂ t₂ := by + rcases hcross with ⟨_, u₁, v₁, u₂, v₂, h₁', h₂', hcr'⟩ + have hcr1 : S.Ω.Crosses s₁ t₁ u₂ v₂ := by + rcases hP₁_ends.ends_eq S h₁' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hcr' + · exact hcr'.swap_left + rcases hP₂_ends.ends_eq S h₂' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hcr1 + · exact hcr1.swap_right + have haux_side : ∀ {x_Q y_Q : α}, + S.IsOmegaPathWithEnds Q x_Q y_Q → + (s₁ = x_Q ∨ s₁ = y_Q) → + s₂ ∈ S.Ω.interval x_Q y_Q → + t₁ ∈ S.Ω.interval x_Q y_Q ∧ s₂ ∈ S.Ω.interval x_Q y_Q ∧ t₂ ∈ S.Ω.interval x_Q y_Q := by + intro x_Q y_Q hQ_xy hs₁_xy hs₂_xy + have ht₂_xy : t₂ ∈ S.Ω.interval x_Q y_Q := + S.both_ends_mem_interval_of_separating hQ_xy hQ_sep hP₂_ends hdisj_P₂Q hs₂_xy + have hs₁_not_xy : s₁ ∉ S.Ω.interval x_Q y_Q := by + rcases hs₁_xy with rfl | rfl + · exact S.Ω.not_mem_interval_left s₁ y_Q + · exact S.Ω.not_mem_interval_right x_Q s₁ + have ht₁_xy : t₁ ∈ S.Ω.interval x_Q y_Q := by + rcases S.Ω.interval_subset_interval_or_swap hs₂_xy ht₂_xy hP₂_ends.2.1 with hsub | hsub + · rcases S.Ω.crosses_iff_interval.mp hcross_ends.symm with ⟨h1, _⟩ | ⟨h1, _⟩ + · exact (hs₁_not_xy (hsub h1)).elim + · exact hsub h1 + · rcases S.Ω.crosses_iff_interval.mp hcross_ends.symm with ⟨_, h2⟩ | ⟨_, h2⟩ + · exact hsub h2 + · exact (hs₁_not_xy (hsub h2)).elim + exact ⟨ht₁_xy, hs₂_xy, ht₂_xy⟩ + refine ⟨P₁, P₂, s₁, t₁, s₂, t₂, c, hP_set_eq, hP12, hcross, hdisj_P₂Q, + hP₁_ends, hP₂_ends, hs₁_ab, hinter_path, hW_eq, ?_⟩ + rcases S.Ω.mem_interval_or_interval_swap hQ_ends.2.2.1 hQ_ends.2.2.2 hP₂_ends.2.2.1 + hQ_ends.2.1 hs₂_ne_a hs₂_ne_b with hs₂_ab | hs₂_ba + · exact Or.inl (haux_side hQ_ends hs₁_ab hs₂_ab) + · exact Or.inr (haux_side (hQ_ends.symm S) hs₁_ab.symm hs₂_ba) + +/-- If `Q_m` is an `Ω`-path with `Q_m ≤ G₁` where `V(G₁) ∩ V(G₂) = V(Q_m)`, and `P₁` is an +`Ω`-path with ends `s₁, t₁ ∈ V(G₁)` such that `subgraphInter S.G P₁ Q_m` is a path with ends +`s₁, c`, then `P₁ ≤ G₁`. -/ +private theorem halfCovered_le_left_of_separation (S : Society α β) + {Q_m P₁ G₁ G₂ : Graph α β} {s₁ t₁ c : α} + (hQm_le_G : Q_m ≤ S.G) + (hQm_le_G₁ : Q_m ≤ G₁) + (hsep_G : IsGraphSeparation S.G G₁ G₂) + (hinter_G : V(G₁) ∩ V(G₂) = V(Q_m)) + (hP₁_ends : S.IsOmegaPathWithEnds P₁ s₁ t₁) + (ht₁_G₁ : t₁ ∈ V(G₁)) + (hinter_path : IsGraphPathWithEnds S.G (subgraphInter S.G P₁ Q_m) s₁ c) : + P₁ ≤ G₁ := by + have hP₁_le : P₁ ≤ S.G := hP₁_ends.1.le + have hc_inter : c ∈ V(subgraphInter S.G P₁ Q_m) := hinter_path.right_mem + rw [vertexSet_subgraphInter] at hc_inter + obtain ⟨R₁, R₂, hR₁_P₁, hR₂_P₁, hR₁, hR₂, hP₁_union, hinter_R₁R₂, _⟩ := + hP₁_ends.1.exists_split_at hc_inter.1 + have hinter_sub_P₁ : IsGraphPathWithEnds P₁ (subgraphInter S.G P₁ Q_m) s₁ c := + hinter_path.of_le (subgraphInter_le_left hP₁_le hQm_le_G) + have hR₁_eq : R₁ = subgraphInter S.G P₁ Q_m := + hP₁_ends.1.subpath_unique_of_left hR₁ hinter_sub_P₁ + have hR₁_le_G₁ : R₁ ≤ G₁ := by + rw [hR₁_eq] + exact (subgraphInter_le_right hP₁_le hQm_le_G).trans hQm_le_G₁ + have hVR₂_inter : V(R₂) ∩ (V(G₂) ∩ V(G₁)) ⊆ {c} := by + rw [inter_comm V(G₂), hinter_G] + intro z ⟨hzR₂, hzQm⟩ + have hzR₁ : z ∈ V(R₁) := by + rw [hR₁_eq, vertexSet_subgraphInter] + exact ⟨hR₂_P₁.vertexSet_mono hzR₂, hzQm⟩ + have hz_both : z ∈ V(R₁) ∩ V(R₂) := ⟨hzR₁, hzR₂⟩ + rwa [hinter_R₁R₂] at hz_both + have hc_G₁ : c ∈ V(G₁) := hQm_le_G₁.vertexSet_mono hc_inter.2 + have hR₂_le_G₁ : R₂ ≤ G₁ := + ((hR₂.mono hP₁_le).symm).le_right_of_inter_subset (IsGraphSeparation.symm hsep_G) + hVR₂_inter ht₁_G₁ hc_G₁ + refine (Compatible.of_le_le hP₁_le hsep_G.1).le_iff.mpr ⟨?_, ?_⟩ + · intro v hv + have hv' : v ∈ V(R₁) ∪ V(R₂) := by + rw [← vertexSet_subgraphUnion, hP₁_union] + exact hv + rcases hv' with hv₁ | hv₂ + · exact hR₁_le_G₁.vertexSet_mono hv₁ + · exact hR₂_le_G₁.vertexSet_mono hv₂ + · intro e he + have he' : e ∈ E(R₁) ∪ E(R₂) := by + rw [← edgeSet_subgraphUnion hR₁_P₁ hR₂_P₁, hP₁_union] + exact he + rcases he' with he₁ | he₂ + · exact hR₁_le_G₁.edgeSet_mono he₁ + · exact hR₂_le_G₁.edgeSet_mono he₂ + +/-- Refinement of Graph Minors IX, `(5.2)` for `p = 2` with `2` separating paths `Q 0, Q 1`. -/ +theorem theorem_5_2_p2 (S : Society α β) [Finite V(S.G)] [Finite E(S.G)] + (hex_cr : ∃ P₀ : Set (Graph α β), S.IsCrookedTransaction P₀ ∧ 2 ≤ P₀.ncard) + {Q : Fin 2 → Graph α β} {a b : Fin 2 → α} + (hinj_Q : Function.Injective Q) + (htr_Q : S.IsTransaction (range Q)) + (hsep_Q : ∀ i : Fin 2, S.IsSeparatingOmegaPath (Q i)) + (hno_int : ∀ i : Fin 2, Disjoint (pathInternalVerts S.G (Q i)) S.Ω.bar) + (hends_Q : ∀ i : Fin 2, S.IsOmegaPathWithEnds (Q i) (a i) (b i)) + (hcw : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) + {G₁ G₂ : Graph α β} (hsep_G : IsGraphSeparation S.G G₁ G₂) + (hinter_G : V(G₁) ∩ V(G₂) = V(Q 1)) + (hQ1_le : Q 1 ≤ G₁) + (hint_G₁ : S.Ω.interval (a 1) (b 1) ⊆ V(G₁)) + (_hint_G₂ : S.Ω.interval (b 1) (a 1) ⊆ V(G₂)) : + (∃ P₁ P₂ : Graph α β, S.OmegaPathsCross P₁ P₂ ∧ P₁ ≤ G₁ ∧ P₂ ≤ G₁) ∨ + (∃ P_set : Set (Graph α β), S.IsCrookedTransaction P_set ∧ P_set.ncard = 2 ∧ + Disjoint (S.Ω.interval (a 0) (b 0)) (S.transactionEnds P_set)) := by + let Q_set : Set (Graph α β) := range Q + have hno_int_Q : ∀ R ∈ Q_set, Disjoint (pathInternalVerts S.G R) S.Ω.bar := by + rintro _ ⟨i, rfl⟩ + exact hno_int i + obtain ⟨P_set, A, B, hS⟩ := S.exists_statementS (by decide : 2 ≤ 2) htr_Q hno_int_Q hex_cr + have hcard_P : P_set.ncard = 2 := hS.card_P_eq S (by decide : (2 : ℕ) ≠ 3) + by_cases hdisj_0 : + Disjoint (S.Ω.interval (a 0) (b 0)) (S.transactionEnds P_set) + · exact Or.inr ⟨P_set, hS.isCrooked_P, hcard_P, hdisj_0⟩ + · left + have hint_01 := S.Ω.mem_intervals_of_isClockwiseSeq_ofFn hcw (by decide : (0 : Fin 2) < 1) + have ha0_1 : a 0 ∈ S.Ω.interval (a 1) (b 1) := hint_01.1 + have hb0_1 : b 0 ∈ S.Ω.interval (a 1) (b 1) := hint_01.2.1 + have hsub_01 : S.Ω.interval (a 0) (b 0) ⊆ S.Ω.interval (a 1) (b 1) := hint_01.2.2.1 + have ha1_0 : a 1 ∈ S.Ω.interval (b 0) (a 0) := hint_01.2.2.2.1 + have hb1_0 : b 1 ∈ S.Ω.interval (b 0) (a 0) := hint_01.2.2.2.2 + -- Helper to deduce `P ≤ G₁` when `P` is an `Ω`-path disjoint from `Q j` with ends in `Ω(a j, b + -- j)`. + have hle_G₁_of_ends : ∀ (j : Fin 2) {P : Graph α β} {s t : α}, + S.IsOmegaPathWithEnds P s t → + Disjoint V(P) V(Q j) → + s ∈ S.Ω.interval (a j) (b j) → + t ∈ S.Ω.interval (a j) (b j) → + P ≤ G₁ := by + intro j P s t hP_ends hdisj_PQj hs_j ht_j + have hsub_j1 : S.Ω.interval (a j) (b j) ⊆ S.Ω.interval (a 1) (b 1) := by + fin_cases j + · exact hsub_01 + · exact Subset.rfl + have hj_last : Q j = Q 1 ∨ + (Disjoint V(Q j) V(Q 1) ∧ + a 1 ∈ S.Ω.interval (b j) (a j) ∧ b 1 ∈ S.Ω.interval (b j) (a j)) := by + fin_cases j + · right + obtain ⟨_, _, hfence_Q⟩ := htr_Q + have hne_Q : Q 0 ≠ Q 1 := fun h => (by decide : (0 : Fin 2) ≠ 1) (hinj_Q h) + exact ⟨hfence_Q.1.2 (mem_range_self 0) (mem_range_self 1) hne_Q, ha1_0, hb1_0⟩ + · exact Or.inl rfl + have hdisj_G₂ : Disjoint V(P) V(G₂) := + S.disjoint_right_of_ends_in_interval_of_separating + (hends_Q j) (hsep_Q j) (hends_Q 1) (hno_int 1) + hsub_j1 hj_last hsep_G hinter_G hint_G₁ hP_ends hdisj_PQj hs_j ht_j + exact IsGraphSeparation.le_left_of_disjoint hsep_G hP_ends.1.le hdisj_G₂ + by_cases hex_disj : ∃ j : Fin 2, Disjoint V(Q j) V(S.transactionUnion P_set) + · rcases hex_disj with ⟨j, hdisj_Qj⟩ + have hsub_0j : S.Ω.interval (a 0) (b 0) ⊆ S.Ω.interval (a j) (b j) := by + fin_cases j + · exact Subset.rfl + · exact hsub_01 + have hne_j : (S.transactionEnds P_set ∩ S.Ω.interval (a j) (b j)).Nonempty := by + rw [not_disjoint_iff_nonempty_inter] at hdisj_0 + rcases hdisj_0 with ⟨x, hx0, hxP⟩ + exact ⟨x, hxP, hsub_0j hx0⟩ + obtain ⟨P₁, hP₁_in, P₂, hP₂_in, hcr_12, hends₁_j, hends₂_j⟩ := + S.theorem_5_1_proof (hends_Q j) (hsep_Q j) hS.isCrooked_P hdisj_Qj hne_j + have hP_le_G₁ : ∀ P ∈ P_set, pathEnds S.G P ⊆ S.Ω.interval (a j) (b j) → P ≤ G₁ := by + intro P hP_in hends_P + obtain ⟨s, t, hP_ends⟩ := hS.isFenceFor_P.1.1 P hP_in + have hs_j : s ∈ S.Ω.interval (a j) (b j) := + hends_P (by rw [hP_ends.1.pathEnds_eq]; exact Or.inl rfl) + have ht_j : t ∈ S.Ω.interval (a j) (b j) := + hends_P (by rw [hP_ends.1.pathEnds_eq]; exact Or.inr rfl) + have hdisj_PQj : Disjoint V(P) V(Q j) := by + rw [disjoint_left] + intro z hzP hzQj + exact disjoint_left.mp hdisj_Qj hzQj (mem_iUnion₂.mpr ⟨P, hP_in, hzP⟩) + exact hle_G₁_of_ends j hP_ends hdisj_PQj hs_j ht_j + exact ⟨P₁, P₂, hcr_12, hP_le_G₁ P₁ hP₁_in hends₁_j, hP_le_G₁ P₂ hP₂_in hends₂_j⟩ + · push Not at hex_disj + have hfin_P : P_set.Finite := hS.isFenceFor_P.1.finite S + have hno_over : ¬ ∃ P₁ ∈ P_set, S.IsOverpass P_set P₁ := + not_isOverpass_of_ncard_eq_two S hfin_P hcard_P + have h43 : ∀ j : Fin 2, + pathEnds S.G (Q j) ⊆ S.transactionEnds P_set ∨ S.IsHalfCovered P_set (Q j) := by + intro j + by_contra hnot + push Not at hnot + exact hno_over ((S.theorem_4_3_proof hS).2 (Q j) (mem_range_self j) + (by rintro (hd | hb | hc); exacts [hex_disj j hd, hnot.1 hb, hnot.2 hc])) + rw [not_disjoint_iff_nonempty_inter] at hdisj_0 + rcases hdisj_0 with ⟨x₀, hx₀_ab, hx₀_W⟩ + -- At least one of `a 1, b 1` is in `S.transactionEnds P_set`, hence in `Ω(b 0, a 0)`. + have hex_w₁ : ∃ w₁ ∈ S.Ω.interval (b 0) (a 0), w₁ ∈ S.transactionEnds P_set := by + rcases h43 1 with hboth₁ | hcov₁ + · refine ⟨a 1, ha1_0, hboth₁ ?_⟩ + rw [(hends_Q 1).1.pathEnds_eq] + exact Or.inl rfl + · rcases hcov₁ with ⟨P, hP_in, _, _, s, t, a', b', _, hP_ends, hQ₁_ends', rfl, _, _⟩ + have hs_W : s ∈ S.transactionEnds P_set := hP_ends.mem_transactionEnds_left S hP_in + rcases (hends_Q 1).ends_eq S hQ₁_ends' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨a 1, ha1_0, hs_W⟩ + · exact ⟨b 1, hb1_0, hs_W⟩ + rcases hex_w₁ with ⟨w₁, hw₁_ba, hw₁_W⟩ + -- `Q 0` cannot be half-covered, because `S.transactionEnds P_set` meets both `Ω(a 0, b 0)` + -- and `Ω(b 0, a 0)`. + have hnot_cov₀ : ¬ S.IsHalfCovered P_set (Q 0) := by + intro hcov₀ + obtain ⟨P₁, P₂, s₁, t₁, s₂, t₂, _, _, _, _, _, _, _, hs₁_0, _, hW_eq, hside⟩ := + halfCovered_of_ncard_eq_two S hS.isCrooked_P hcard_P (hends_Q 0) (hsep_Q 0) hcov₀ + rcases hside with ⟨ht₁, hs₂, ht₂⟩ | ⟨ht₁, hs₂, ht₂⟩ + · have hw₁_in : w₁ ∈ ({s₁, t₁, s₂, t₂} : Set α) := hW_eq ▸ hw₁_W + have hw₁_ab : w₁ ∈ S.Ω.interval (a 0) (b 0) := by + rcases hw₁_in with rfl | rfl | rfl | rfl + · rcases hs₁_0 with rfl | rfl + · exact (S.Ω.not_mem_interval_right (b 0) (a 0) hw₁_ba).elim + · exact (S.Ω.not_mem_interval_left (b 0) (a 0) hw₁_ba).elim + · exact ht₁ + · exact hs₂ + · exact ht₂ + exact disjoint_left.mp (S.Ω.disjoint_interval_swap (a 0) (b 0)) hw₁_ab hw₁_ba + · have hx₀_in : x₀ ∈ ({s₁, t₁, s₂, t₂} : Set α) := hW_eq ▸ hx₀_W + have hx₀_ba : x₀ ∈ S.Ω.interval (b 0) (a 0) := by + rcases hx₀_in with rfl | rfl | rfl | rfl + · rcases hs₁_0 with rfl | rfl + · exact (S.Ω.not_mem_interval_left (a 0) (b 0) hx₀_ab).elim + · exact (S.Ω.not_mem_interval_right (a 0) (b 0) hx₀_ab).elim + · exact ht₁ + · exact hs₂ + · exact ht₂ + exact disjoint_left.mp (S.Ω.disjoint_interval_swap (a 0) (b 0)) hx₀_ab hx₀_ba + have hboth₀ : pathEnds S.G (Q 0) ⊆ S.transactionEnds P_set := + (h43 0).resolve_right hnot_cov₀ + have ha0_W : a 0 ∈ S.transactionEnds P_set := + hboth₀ (by rw [(hends_Q 0).1.pathEnds_eq]; exact Or.inl rfl) + have hb0_W : b 0 ∈ S.transactionEnds P_set := + hboth₀ (by rw [(hends_Q 0).1.pathEnds_eq]; exact Or.inr rfl) + -- `Q 1` cannot have both ends in `S.transactionEnds P_set`, so `Q 1` is half-covered. + have hcov₁ : S.IsHalfCovered P_set (Q 1) := by + refine (h43 1).resolve_left fun hboth₁ => ?_ + have ha1_W : a 1 ∈ S.transactionEnds P_set := + hboth₁ (by rw [(hends_Q 1).1.pathEnds_eq]; exact Or.inl rfl) + have hb1_W : b 1 ∈ S.transactionEnds P_set := + hboth₁ (by rw [(hends_Q 1).1.pathEnds_eq]; exact Or.inr rfl) + obtain ⟨_, hinj_a, hinj_b, hab_ne, _, _⟩ := CyclicPerm.isClockwise3_of_ofFn hcw + have ha0_ne_a1 : a 0 ≠ a 1 := fun h => (by decide : (0 : Fin 2) ≠ 1) (hinj_a h) + have hb0_ne_b1 : b 0 ≠ b 1 := fun h => (by decide : (0 : Fin 2) ≠ 1) (hinj_b h) + have hx₀_ne_a0 : x₀ ≠ a 0 := fun h => S.Ω.not_mem_interval_left (a 0) (b 0) (h ▸ hx₀_ab) + have hx₀_ne_b0 : x₀ ≠ b 0 := fun h => S.Ω.not_mem_interval_right (a 0) (b 0) (h ▸ hx₀_ab) + have hx₀_ne_a1 : x₀ ≠ a 1 := + fun h => disjoint_left.mp (S.Ω.disjoint_interval_swap (a 0) (b 0)) hx₀_ab (h ▸ ha1_0) + have hx₀_ne_b1 : x₀ ≠ b 1 := + fun h => disjoint_left.mp (S.Ω.disjoint_interval_swap (a 0) (b 0)) hx₀_ab (h ▸ hb1_0) + let Z : Set α := {x₀, a 0, b 0, a 1, b 1} + have hZ_sub : Z ⊆ S.transactionEnds P_set := by + rintro z (rfl | rfl | rfl | rfl | rfl) <;> assumption + have hfin_W : (S.transactionEnds P_set).Finite := + S.Ω.finite_bar.subset (S.transactionEnds_subset_bar P_set) + have hZ_le : Z.ncard ≤ (S.transactionEnds P_set).ncard := + ncard_le_ncard hZ_sub hfin_W + have hW_card : (S.transactionEnds P_set).ncard = 4 := by + rw [(hS.isFenceFor_P.ncard_transactionEnds S).2.2, hcard_P] + have hx₀_not : x₀ ∉ ({a 0, b 0, a 1, b 1} : Set α) := by + simp [hx₀_ne_a0, hx₀_ne_b0, hx₀_ne_a1, hx₀_ne_b1] + have ha0_not : a 0 ∉ ({b 0, a 1, b 1} : Set α) := by + simp [hab_ne 0 0, ha0_ne_a1, hab_ne 0 1] + have hb0_not : b 0 ∉ ({a 1, b 1} : Set α) := by + simp [(hab_ne 1 0).symm, hb0_ne_b1] + have hZ_card : Z.ncard = 5 := by + dsimp [Z] + rw [ncard_insert_of_notMem hx₀_not (by simp), + ncard_insert_of_notMem ha0_not (by simp), + ncard_insert_of_notMem hb0_not (by simp), + ncard_pair (hab_ne 1 1)] + omega + obtain ⟨P₁, P₂, s₁, t₁, s₂, t₂, c, _, _, hcross, hdisj_P₂Q₁, + hP₁_ends, hP₂_ends, hs₁_1, hinter_path, hW_eq, hside⟩ := + halfCovered_of_ncard_eq_two S hS.isCrooked_P hcard_P (hends_Q 1) (hsep_Q 1) hcov₁ + have hx₀_a1b1 : x₀ ∈ S.Ω.interval (a 1) (b 1) := hsub_01 hx₀_ab + have hside_ab : + t₁ ∈ S.Ω.interval (a 1) (b 1) ∧ + s₂ ∈ S.Ω.interval (a 1) (b 1) ∧ + t₂ ∈ S.Ω.interval (a 1) (b 1) := by + refine hside.resolve_right fun ⟨ht₁_ba, hs₂_ba, ht₂_ba⟩ => ?_ + have hx₀_in : x₀ ∈ ({s₁, t₁, s₂, t₂} : Set α) := hW_eq ▸ hx₀_W + have hx₀_ba : x₀ ∈ S.Ω.interval (b 1) (a 1) := by + rcases hx₀_in with rfl | rfl | rfl | rfl + · rcases hs₁_1 with rfl | rfl + · exact (S.Ω.not_mem_interval_left (a 1) (b 1) hx₀_a1b1).elim + · exact (S.Ω.not_mem_interval_right (a 1) (b 1) hx₀_a1b1).elim + · exact ht₁_ba + · exact hs₂_ba + · exact ht₂_ba + exact disjoint_left.mp (S.Ω.disjoint_interval_swap (a 1) (b 1)) hx₀_a1b1 hx₀_ba + have hP₂_le_G₁ : P₂ ≤ G₁ := + hle_G₁_of_ends 1 hP₂_ends hdisj_P₂Q₁ hside_ab.2.1 hside_ab.2.2 + have hP₁_le_G₁ : P₁ ≤ G₁ := + halfCovered_le_left_of_separation S (hends_Q 1).1.le hQ1_le hsep_G hinter_G + hP₁_ends (hint_G₁ hside_ab.1) hinter_path + exact ⟨P₁, P₂, hcross, hP₁_le_G₁, hP₂_le_G₁⟩ + +/-- `theorem_5_2_p2` without `hno_int`, deduced by applying `theorem_5_2_p2` to `Society.spiked S`. +-/ +theorem theorem_5_2_p2_without_no_internal (S : Society α β) + (hex_cr : ∃ P₀ : Set (Graph α β), S.IsCrookedTransaction P₀ ∧ 2 ≤ P₀.ncard) + {Q : Fin 2 → Graph α β} {a b : Fin 2 → α} + (hinj_Q : Function.Injective Q) + (htr_Q : S.IsTransaction (range Q)) + (hsep_Q : ∀ i : Fin 2, S.IsSeparatingOmegaPath (Q i)) + (hends_Q : ∀ i : Fin 2, S.IsOmegaPathWithEnds (Q i) (a i) (b i)) + (hcw : S.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b)) + {G₁ G₂ : Graph α β} (hsep_G : IsGraphSeparation S.G G₁ G₂) + (hinter_G : V(G₁) ∩ V(G₂) = V(Q 1)) + (hQ1_le : Q 1 ≤ G₁) + (hint_G₁ : S.Ω.interval (a 1) (b 1) ⊆ V(G₁)) + (hint_G₂ : S.Ω.interval (b 1) (a 1) ⊆ V(G₂)) : + (∃ P₁ P₂ : Graph α β, S.OmegaPathsCross P₁ P₂ ∧ P₁ ≤ G₁ ∧ P₂ ≤ G₁) ∨ + (∃ P_set : Set (Graph α β), S.IsCrookedTransaction P_set ∧ P_set.ncard = 2 ∧ + Disjoint (S.Ω.interval (a 0) (b 0)) (S.transactionEnds P_set)) := by + let S' := Society.spiked S + have : Finite V(S'.G) := S'.finite_V + have : Finite E(S'.G) := S'.finite_E + let m : Fin 2 := 1 + let Q' : Fin 2 → Graph (α ⊕ α) (β ⊕ α) := fun i => spikeOmegaPath S (Q i) + let a' : Fin 2 → α ⊕ α := inrV ∘ a + let b' : Fin 2 → α ⊕ α := inrV ∘ b + let G₁' := spikeGraph G₁ ({a m, b m} ∪ S.Ω.interval (a m) (b m)) + let G₂' := spikeGraphWithVerts G₂ (S.Ω.interval (b m) (a m)) {a m, b m} + obtain ⟨hex_cr', hinj_Q', htr_Q', hsep_Q', hno_int', hends_Q', hcw', hsep_G', hinter_G', + hint_G₁', hint_G₂', hQ'_le⟩ := + S.spikeTransactionAndSeparation m hex_cr hinj_Q htr_Q hsep_Q hends_Q hcw + hsep_G hinter_G hint_G₁ hint_G₂ + rcases theorem_5_2_p2 S' hex_cr' hinj_Q' htr_Q' hsep_Q' hno_int' hends_Q' hcw' + hsep_G' hinter_G' (hQ'_le hQ1_le) hint_G₁' hint_G₂' with + ⟨K₁, K₂, ⟨hdisj_K12, s₁', t₁', s₂', t₂', hK₁_ends, hK₂_ends, hcr_K12⟩, hK₁_le, hK₂_le⟩ | + ⟨P_set', hcr_P', hcard_P', hdisj_P'⟩ + · left + rcases hK₁_ends.2.2.1 with ⟨s₁, _, rfl⟩ + rcases hK₁_ends.2.2.2 with ⟨t₁, _, rfl⟩ + rcases hK₂_ends.2.2.1 with ⟨s₂, _, rfl⟩ + rcases hK₂_ends.2.2.2 with ⟨t₂, _, rfl⟩ + obtain ⟨hP₁_ends, hVK₁⟩ := isOmegaPathWithEnds_unspikeGraph S hK₁_ends + obtain ⟨hP₂_ends, hVK₂⟩ := isOmegaPathWithEnds_unspikeGraph S hK₂_ends + have hunspike_le : ∀ {K : Graph (α ⊕ α) (β ⊕ α)} {s t : α}, + S.IsOmegaPathWithEnds (unspikeGraph S.G K) s t → K ≤ G₁' → unspikeGraph S.G K ≤ G₁ := by + intro K s t hP_ends hK_le + refine (Compatible.of_le_le hP_ends.1.le hsep_G.1).le_iff.mpr ⟨?_, ?_⟩ + · intro u hu + have hu' : inlV u ∈ V(G₁') := hK_le.vertexSet_mono hu + rcases hu' with ⟨w, hw, hw_eq⟩ | ⟨w, _, hw_eq⟩ + · exact inlV_injective hw_eq ▸ hw + · exact (Sum.inl_ne_inr hw_eq.symm).elim + · intro e he + have he' : inlE e ∈ E(G₁') := hK_le.edgeSet_mono he.2 + rcases he' with ⟨f, hf, hf_eq⟩ | ⟨w, _, hw_eq⟩ + · exact inlE_injective hf_eq ▸ hf + · exact (Sum.inl_ne_inr hw_eq.symm).elim + refine ⟨unspikeGraph S.G K₁, unspikeGraph S.G K₂, ⟨?_, s₁, t₁, s₂, t₂, hP₁_ends, hP₂_ends, + (S.Ω.mapInr_crosses_iff s₁ t₁ s₂ t₂).mp hcr_K12⟩, + hunspike_le hP₁_ends hK₁_le, hunspike_le hP₂_ends hK₂_le⟩ + rw [disjoint_left] at hdisj_K12 ⊢ + intro u hu₁ hu₂ + exact hdisj_K12 (by rw [hVK₁]; exact Or.inl ⟨u, hu₁, rfl⟩) + (by rw [hVK₂]; exact Or.inl ⟨u, hu₂, rfl⟩) + · right + obtain ⟨hcr_P, hcard_P, hW_eq⟩ := isCrookedTransaction_unspikeGraph S hcr_P' + refine ⟨unspikeGraph S.G '' P_set', hcr_P, hcard_P.trans hcard_P', ?_⟩ + change Disjoint (S.Ω.mapInr.interval (inrV (a 0)) (inrV (b 0))) _ at hdisj_P' + rwa [S.Ω.mapInr_interval, hW_eq, Set.disjoint_image_iff inrV_injective] at hdisj_P' + +/-! ## 2. Refinement of GM09 (10.3) and (10.4) for `p = 2` -/ + +/-- One step of `(10.3)` for `p = 2` under breadth `≥ 2` and `4 ≤ X.ncard`. -/ +private theorem theorem_10_3_p2_step {S_comp S₀ : Society α β} {N : Neighborhood α β} {X Y : Set α} + (hrural : N.IsRural) (hbreadth : N.HasBreadthGe 2) + (hX : N.IsWeaklyLinked X) (hcard : 4 ≤ X.ncard) (hcomp : S_comp.IsComposition S₀ N) + (hXY : X ⊆ Y) (hY : Y ⊆ S_comp.Ω.bar) {x : α} (hxY : x ∈ Y) (hxX : x ∉ X) + {P₀ : Set (Graph α β)} (hP₀ : S_comp.IsCrookedTransaction P₀) (hp : 2 ≤ P₀.ncard) + (hends : S_comp.transactionEnds P₀ ⊆ Y) : + ∃ P' : Set (Graph α β), S_comp.IsCrookedTransaction P' ∧ P'.ncard = 2 ∧ + S_comp.transactionEnds P' ⊆ Y \ {x} := by + classical + obtain ⟨P_pres, C, hC⟩ := hbreadth + have hΩ : N.Ω = S_comp.Ω := hcomp.2.1 + have hXb : X ⊆ N.Ω.bar := hX.1 + obtain ⟨a, b, ha, hb, hL⟩ := CyclicPerm.exists_ofFn_around (s := 2) hXb + (hΩ ▸ hY hxY : x ∈ N.Ω.bar) hxX (by omega) + have hL₀ : N.Ω.IsClockwiseSeq ((List.ofFn a).reverse ++ List.ofFn b) := + hL.sublist (List.Sublist.append_left (List.sublist_cons_self _ _) _) + have hW : N.IsWeaklyLinked (range a ∪ range b) := hX.mono <| by + rintro _ (⟨i, rfl⟩ | ⟨i, rfl⟩) + · exact ha i + · exact hb i + let S' := S_comp.restrictOmega Y hY + have hbarS' : S'.Ω.bar = Y := S_comp.Ω.restrict_bar hY + obtain ⟨Q, hinj, hcw', hendsQ, htr, hsep_Q, hint, hQs⟩ := + exists_restricted_separating_transaction (s := 0) hcomp hY P_pres ⟨C, hC⟩ + (fun i => hXY (ha i)) (fun i => hXY (hb i)) hW hL₀ + obtain ⟨G₁, G₂, hsep, hinter, hQ1_le, h₁, h₂, h₀⟩ := hQs 1 + obtain ⟨hs2, hV2⟩ := hcomp.isGraphSeparation_union hsep h₀ + rcases theorem_5_2_p2_without_no_internal S' + ⟨P₀, (S_comp.isCrookedTransaction_restrictOmega_iff hY).mpr ⟨hP₀, hends⟩, hp⟩ hinj htr hsep_Q + hendsQ hcw' hs2 (hV2.trans hinter) hQ1_le ((hint 1).1.trans (hΩ ▸ h₁)) + ((hint 1).2.trans ((hΩ ▸ h₂).trans subset_union_left)) with + ⟨P₁, P₂, ⟨hdisj, s₁, t₁, s₂, t₂, hP₁, hP₂, hc⟩, hle₁, hle₂⟩ | ⟨P', hcr, hcard', hdis⟩ + · exfalso + have hlift : ∀ {R : Graph α β} {u w : α}, S'.IsOmegaPathWithEnds R u w → + R ≤ G₁ → u ≠ w → u ∈ N.Ω.bar → w ∈ N.Ω.bar → + ({ G := N.G, Ω := N.Ω, finite_V := N.finite_V, finite_E := N.finite_E, + bar_subset := N.bar_subset } : Society α β).IsOmegaPathWithEnds R u w := by + intro R u w hR hle hne hu hw + exact ⟨hR.1.of_le (hle.trans hsep.1), hne, hu, hw⟩ + have hYN : ∀ {v}, v ∈ S'.Ω.bar → v ∈ N.Ω.bar := fun {v} hv => by + rw [hbarS'] at hv + exact hΩ ▸ hY hv + exact not_omegaPathsCross_of_isRural hrural ⟨hdisj, s₁, t₁, s₂, t₂, + hlift hP₁ hle₁ hP₁.2.1 (hYN hP₁.2.2.1) (hYN hP₁.2.2.2), + hlift hP₂ hle₂ hP₂.2.1 (hYN hP₂.2.2.1) (hYN hP₂.2.2.2), + show N.Ω.Crosses s₁ t₁ s₂ t₂ by + rw [hΩ] + exact ((S_comp.Ω.crosses_restrict_iff hY).mp hc).2.2.2.2⟩ + · obtain ⟨hcS, hsub⟩ := (S_comp.isCrookedTransaction_restrictOmega_iff hY).mp hcr + refine ⟨P', hcS, hcard', fun v hv => ⟨hsub hv, ?_⟩⟩ + rintro rfl + have hx : v ∈ S_comp.Ω.interval (a 0) (b 0) := + hΩ ▸ CyclicPerm.mem_interval_of_around (s := 1) hL + have hx' : v ∈ S'.Ω.interval (a 0) (b 0) := by + change v ∈ (S_comp.Ω.restrict Y hY).interval _ _ + rw [S_comp.Ω.interval_restrict hY _ _ (hXY (ha _)) (hXY (hb _))] + exact ⟨hx, hxY⟩ + refine Set.disjoint_left.mp hdis hx' ?_ + rwa [S_comp.transactionEnds_restrictOmega_eq hY hsub] + +/-- Refinement of Graph Minors IX, `(10.3)` for `p = 2` under breadth `≥ 2` and `4 ≤ X.ncard`. -/ +private theorem theorem_10_3_p2 {S_comp S₀ : Society α β} {N : Neighborhood α β} {X : Set α} + (hrural : N.IsRural) (hbreadth : N.HasBreadthGe 2) + (hX : N.IsWeaklyLinked X) (hcard : 4 ≤ X.ncard) (hcomp : S_comp.IsComposition S₀ N) + {P₀ : Set (Graph α β)} (hP₀ : S_comp.IsCrookedTransaction P₀) (hp : 2 ≤ P₀.ncard) : + ∃ P' : Set (Graph α β), S_comp.IsCrookedTransaction P' ∧ P'.ncard = 2 ∧ + S_comp.transactionEnds P' ⊆ X := by + have hΩ : N.Ω = S_comp.Ω := hcomp.2.1 + have hXb : X ⊆ S_comp.Ω.bar := hΩ ▸ hX.1 + have hfin : S_comp.Ω.bar.Finite := S_comp.Ω.finite_bar + have key : ∀ (n : ℕ) (Y : Set α), (Y \ X).ncard = n → X ⊆ Y → Y ⊆ S_comp.Ω.bar → + ∀ P₁ : Set (Graph α β), S_comp.IsCrookedTransaction P₁ → 2 ≤ P₁.ncard → + S_comp.transactionEnds P₁ ⊆ Y → + ∃ P' : Set (Graph α β), S_comp.IsCrookedTransaction P' ∧ P'.ncard = 2 ∧ + S_comp.transactionEnds P' ⊆ X := by + intro n + induction n with + | zero => + intro Y hn _ hY P₁ hP₁ hp₁ hends + have hYX : Y \ X = ∅ := (ncard_eq_zero (hfin.subset (sdiff_subset.trans hY))).mp hn + obtain ⟨P', hsub, hcard', hcr'⟩ := S_comp.theorem_3_4_proof (by decide : 2 ≤ 2) + (by decide : 2 ≠ 3) hP₁ hp₁ + have hends' : S_comp.transactionEnds P' ⊆ S_comp.transactionEnds P₁ := + fun v ⟨Q, hQ, u, hQu⟩ => ⟨Q, hsub hQ, u, hQu⟩ + exact ⟨P', hcr', hcard', hends'.trans (hends.trans (sdiff_eq_empty.mp hYX))⟩ + | succ n ih => + intro Y hn hXY hY P₁ hP₁ hp₁ hends + obtain ⟨x, hxY, hxX⟩ : (Y \ X).Nonempty := by + rw [← Set.ncard_pos (hfin.subset (sdiff_subset.trans hY))] + omega + obtain ⟨P₂, hP₂, hp₂_eq, hends₂⟩ := theorem_10_3_p2_step hrural hbreadth hX hcard hcomp hXY + hY hxY hxX hP₁ hp₁ hends + refine ih (Y \ {x}) ?_ (fun v hv => ⟨hXY hv, fun e => hxX (e ▸ hv)⟩) + (sdiff_subset.trans hY) P₂ hP₂ hp₂_eq.symm.le hends₂ + have hsets : (Y \ {x}) \ X = (Y \ X) \ {x} := by + ext v + simp only [mem_sdiff, mem_singleton_iff] + tauto + rw [hsets, ncard_sdiff_singleton_of_mem (show x ∈ Y \ X from ⟨hxY, hxX⟩), hn] + rfl + exact key _ _ rfl hXb Subset.rfl P₀ hP₀ hp fun v hv => by + obtain ⟨P, _, b, hb⟩ := hv + exact hb.2.2.1 + +/-- `exists_clean_paths` for a nest of `3` circuits (giving `2` clean circuits). -/ +private theorem exists_clean_paths_p2 {N : Neighborhood α β} (P_pres : Presentation N) + {C' : Fin 3 → Graph α β} (hC' : N.IsNest P_pres C') {X : Set α} (hX : N.IsLinked X) : + ∃ (C : Fin 2 → Graph α β) (P : Fin X.ncard → Graph α β) (x t : Fin X.ncard → α), + N.IsNest P_pres C ∧ (∀ j, Disjoint V(C j) N.Ω.bar) ∧ + (∀ i, IsFromToPathWithEnds N.G (P i) X N.Ω₀.bar (x i) (t i) ∧ V(P i) ∩ N.Ω.bar = {x i}) ∧ + Pairwise (fun i j => Disjoint V(P i) V(P j)) ∧ + ∀ i j, ∃ I, IsGraphPath N.G I ∧ I ≤ P i ∧ I ≤ C j ∧ V(I) = V(P i) ∩ V(C j) := + GM09.exists_clean_paths_of_nest P_pres (n := 2) (by decide) hC' hX + +private theorem paths_split_at_last_circuit + {α : Type u} + {β : Type v} + {N : Neighborhood α β} + {X : Set α} + (C : Fin 2 → Graph α β) + (P : Fin X.ncard → Graph α β) + (x : Fin X.ncard → α) + (t : Fin X.ncard → α) + (hP : ∀ (i : Fin X.ncard), IsFromToPathWithEnds N.G (P i) X N.Ω₀.bar (x i) (t i) ∧ V(P i) ∩ + N.Ω.bar = {x i}) + (hI : ∀ (i : Fin X.ncard) (j : Fin 2), ∃ I, IsGraphPath N.G I ∧ I ≤ P i ∧ I ≤ C j ∧ V(I) = V(P + i) ∩ V(C j)) + (last : Fin 2) + (H₁ : Graph α β) + (H₂ : Graph α β) + (hsep : IsGraphSeparation N.G H₁ H₂) + (hcut : V(H₁) ∩ V(H₂) = V(C last)) + (hKH₁ : C last ≤ H₁) + (hK₂ : V(C last) ⊆ V(H₂)) + (hbarH₂ : N.Ω.bar ⊆ V(H₂)) + (hbar₀H₁ : N.Ω₀.bar ⊆ V(H₁)) + (hPN : ∀ (i : Fin X.ncard), IsGraphPathWithEnds N.G (P i) (x i) (t i)) : + ∀ (i : Fin X.ncard), ∃ y R W, y ∈ V(C last) ∧ IsGraphPathWithEnds H₂ R (x i) y ∧ V(R) ⊆ V(P i) + ∧ V(R) ∩ V(C last) = {y} ∧ IsGraphPathWithEnds H₁ W y (t i) ∧ V(W) ⊆ V(P i) := by + intro i + obtain ⟨I, ⟨u, w, hIp⟩, hIP, hIK, hVI⟩ := hI i last + have hne : (V(P i) ∩ V(C last)).Nonempty := ⟨u, hVI ▸ hIp.left_mem⟩ + have hne' := hne + obtain ⟨y, hy, R, -, hRP, -, hRp, -, -, -, -, hRd⟩ := + (hPN i).exists_first_split_at_mem hne + obtain ⟨z, hz, T, -, hTP, -, hTp, -, -, -, -, hTd⟩ := + (hPN i).symm.exists_first_split_at_mem hne' + have hinter : ∀ {Q : Graph α β} {q : α}, q ∈ V(Q) → q ∈ V(C last) → + Disjoint (V(Q) \ {q}) V(C last) → V(Q) ∩ V(C last) = {q} := by + intro Q q hq hqK hd + apply Subset.antisymm + · rintro v ⟨hv, hvK⟩ + by_contra hne + exact Set.disjoint_left.mp hd ⟨hv, hne⟩ hvK + · rintro _ rfl + exact ⟨hq, hqK⟩ + have hRV := hinter hRp.right_mem hy.2 hRd + have hTV := hinter hTp.right_mem hz.2 hTd + have hRN : IsGraphPathWithEnds N.G R (x i) y := hRp.mono (hPN i).le + have hTN : IsGraphPathWithEnds N.G T (t i) z := hTp.mono (hPN i).le + have hxb : x i ∈ N.Ω.bar := by + have : x i ∈ V(P i) ∩ N.Ω.bar := (hP i).2.symm ▸ mem_singleton _ + exact this.2 + have ht₀ : t i ∈ N.Ω₀.bar := by + have : t i ∈ V(P i) ∩ N.Ω₀.bar := (hP i).1.2.2.symm ▸ mem_singleton _ + exact this.2 + have hRH₂ : R ≤ H₂ := hRN.le_right_of_inter_subset hsep + (by rw [hcut, hRV]) (hbarH₂ hxb) (hK₂ hy.2) + have hTH₁ : T ≤ H₁ := hTN.le_right_of_inter_subset (IsGraphSeparation.symm hsep) + (by rw [inter_comm V(H₂), hcut, hTV]) (hbar₀H₁ ht₀) (hKH₁.vertexSet_mono hz.2) + have hyI : y ∈ V(I) := hVI ▸ hy + have hzI : z ∈ V(I) := hVI ▸ hz + obtain ⟨M, hMI, hMp, -⟩ := hIp.exists_subpath hyI hzI + have hMH₁ : IsGraphPathWithEnds H₁ M y z := hMp.mono (hIK.trans hKH₁) + have hTH : IsGraphPathWithEnds H₁ T z (t i) := (hTN.of_le hTH₁).symm + have hMT : V(M) ∩ V(T) = {z} := by + apply Subset.antisymm + · rintro v ⟨hv, hvT⟩ + have : v ∈ V(T) ∩ V(C last) := ⟨hvT, (hMI.trans hIK).vertexSet_mono hv⟩ + rwa [hTV] at this + · rintro _ rfl + exact ⟨hMp.right_mem, hTp.right_mem⟩ + refine ⟨y, R, _, hy.2, hRN.of_le hRH₂, hRP.vertexSet_mono, hRV, hMH₁.subgraphUnion hTH hMT, ?_⟩ + rw [vertexSet_subgraphUnion] + exact union_subset (hMI.trans hIP).vertexSet_mono hTP.vertexSet_mono + +private theorem inner_segments_form_weak_linkage + {α : Type u} + {β : Type v} + {N : Neighborhood α β} + {X : Set α} + (P : Fin X.ncard → Graph α β) + (x : Fin X.ncard → α) + (t : Fin X.ncard → α) + (hP : ∀ (i : Fin X.ncard), IsFromToPathWithEnds N.G (P i) X N.Ω₀.bar (x i) (t i) ∧ V(P i) ∩ + N.Ω.bar = {x i}) + (hPd : Pairwise fun i j => Disjoint V(P i) V(P j)) + (N₁ : Neighborhood α β) (hΩ₀ : N₁.Ω₀ = N.Ω₀) + (y : Fin X.ncard → α) + (R : Fin X.ncard → Graph α β) + (W : Fin X.ncard → Graph α β) + (hyK : ∀ (i : Fin X.ncard), y i ∈ N₁.Ω.bar) + (hRP : ∀ (i : Fin X.ncard), V(R i) ⊆ V(P i)) + (hW : ∀ (i : Fin X.ncard), IsGraphPathWithEnds N₁.G (W i) (y i) (t i)) + (hWP : ∀ (i : Fin X.ncard), V(W i) ⊆ V(P i)) + (hyR : ∀ (i : Fin X.ncard), y i ∈ V(R i)) + (hYcard : (range y).ncard = X.ncard) : + N₁.IsWeaklyLinked (range y) := by + refine ⟨by rintro _ ⟨i, rfl⟩; exact hyK i, + fun j => W (Fin.cast hYcard j), fun j => ?_, fun i j hij => ?_⟩ + · set i := Fin.cast hYcard j + refine ⟨y i, t i, hW i, ?_, ?_⟩ + · apply Subset.antisymm + · rintro v ⟨hv, ⟨k, rfl⟩⟩ + by_cases hik : i = k + · subst hik + rfl + · exact (Set.disjoint_left.mp (hPd hik) (hWP i hv) (hRP k (hyR k))).elim + · rintro _ rfl + exact ⟨(hW i).left_mem, mem_range_self i⟩ + · apply Subset.antisymm + · rintro v ⟨hv, hv₀⟩ + have : v ∈ V(P i) ∩ N.Ω₀.bar := ⟨hWP i hv, hΩ₀ ▸ hv₀⟩ + rwa [(hP i).1.2.2] at this + · rintro _ rfl + have : t i ∈ V(P i) ∩ N.Ω₀.bar := (hP i).1.2.2.symm ▸ mem_singleton _ + exact ⟨(hW i).right_mem, hΩ₀.symm ▸ this.2⟩ + · refine (hPd fun e => hij ?_).mono (hWP _) (hWP _) + exact Fin.cast_injective hYcard e + +/-- Refinement of Graph Minors IX, `(10.4)` for `p = 2` under breadth `≥ 3` and `4 ≤ X.ncard`. -/ +private theorem theorem_10_4_p2 {S_comp S₀ : Society α β} {N : Neighborhood α β} {X : Set α} + (hbreadth : N.HasBreadthGe 3) + (hX : N.IsLinked X) (hcard : 4 ≤ X.ncard) (hcomp : S_comp.IsComposition S₀ N) + {P₀ : Set (Graph α β)} (hP₀ : S_comp.IsCrookedTransaction P₀) (hp : 2 ≤ P₀.ncard) : + ∃ P' : Set (Graph α β), S_comp.IsCrookedTransaction P' ∧ P'.ncard = 2 ∧ + S_comp.transactionEnds P' ⊆ X ∧ + ∀ P ∈ P', Disjoint (pathInternalVerts S_comp.G P) S_comp.Ω.bar := by + classical + obtain ⟨P_pres, C', hC'⟩ := hbreadth + have hXb : X ⊆ N.Ω.bar := hX.1 + obtain ⟨C, P, x, t, hC, hCbar, hP, hPd, hI⟩ := exists_clean_paths_p2 P_pres hC' hX + have hΩ : N.Ω = S_comp.Ω := hcomp.2.1 + have hNG : N.G ≤ S_comp.G := hcomp.1.1.2.1 + let last : Fin 2 := 1 + obtain ⟨hcir, hdisj, D, hDd, hDs, hDm⟩ := hC + obtain ⟨N₁, N₂, P₁, S₁, hsep, hcut, hKH₁, hΩ₁, hbarH₂, hbar₀H₁, hrural₁, hrural₂, + hnest₁, hS₁S, hcutU, hcomp₁, hcomp₂⟩ := + exists_nested_neighborhood_composition P_pres C D last (fun i => Fin.le_last i) + hcir hdisj hDd hDs hDm (hCbar last) hcomp + let H₁ := N₁.G + let H₂ := N₂.G + have hK₂ : V(C last) ⊆ V(H₂) := fun v hv => + (hcut.symm ▸ hv : v ∈ V(H₁) ∩ V(H₂)).2 + have hPN : ∀ i, IsGraphPathWithEnds N.G (P i) (x i) (t i) := fun i => (hP i).1.1 + have hsplit : ∀ i, ∃ (y : α) (R W : Graph α β), y ∈ V(C last) ∧ + IsGraphPathWithEnds H₂ R (x i) y ∧ V(R) ⊆ V(P i) ∧ V(R) ∩ V(C last) = {y} ∧ + IsGraphPathWithEnds H₁ W y (t i) ∧ V(W) ⊆ V(P i) := by + exact paths_split_at_last_circuit (α := α) (β := β) (N := N) (X := X) C P x t hP hI last H₁ H₂ + hsep hcut hKH₁ hK₂ hbarH₂ hbar₀H₁ hPN + choose y R W hyK hR hRP hRK hW hWP using hsplit + have hyR : ∀ i, y i ∈ V(R i) := fun i => (hR i).right_mem + have hy_inj : Injective y := by + intro i j e + by_contra hne + exact Set.disjoint_left.mp (hPd hne) (hRP i (hyR i)) (e ▸ hRP j (hyR j)) + have hx_inj : Injective x := by + intro i j e + by_contra hne + exact Set.disjoint_left.mp (hPd hne) (hPN i).left_mem (e ▸ (hPN j).left_mem) + have hRd : ∀ {i j}, i ≠ j → Disjoint V(R i) V(R j) := fun hne => + (hPd hne).mono (hRP _) (hRP _) + have hYcard : (range y).ncard = X.ncard := by + rw [← image_univ, ncard_image_of_injective _ hy_inj, ncard_univ, Nat.card_fin] + have hΩ₀ : N₁.Ω₀ = N.Ω₀ := hcomp₁.2.2.1.trans hcomp.2.2.1.symm + have hweak_after_split : N₁.IsWeaklyLinked (range y) := by + exact inner_segments_form_weak_linkage (α := α) (β := β) (N := N) (X := X) P x t hP hPd + N₁ hΩ₀ y R W (fun i => hΩ₁.symm ▸ hyK i) hRP hW hWP hyR hYcard + obtain ⟨T₀, hT₀, hpT₀⟩ := GraphMinor.GM09.theorem_9_1_proof hcomp₂ hrural₂ hP₀ hp + obtain ⟨T, hT, hpT, hTends⟩ := theorem_10_3_p2 hrural₁ ⟨P₁, C, hnest₁⟩ hweak_after_split + (by rw [hYcard]; exact hcard) hcomp₁ hT₀ hpT₀ + have hxb : ∀ i, x i ∈ S_comp.Ω.bar := by + intro i + have hx : x i ∈ V(P i) ∩ N.Ω.bar := (hP i).2.symm ▸ mem_singleton _ + exact hΩ ▸ hx.2 + have hxX : ∀ i, x i ∈ X := fun i => + ((hP i).1.2.1.symm ▸ mem_singleton _ : x i ∈ V(P i) ∩ X).2 + have hRbar : ∀ i, V(R i) ∩ S_comp.Ω.bar = {x i} := by + intro i + apply Subset.antisymm + · intro v hv + have hmem : v ∈ V(P i) ∩ N.Ω.bar := ⟨hRP i hv.1, hΩ ▸ hv.2⟩ + rwa [(hP i).2] at hmem + · rintro _ rfl + exact ⟨(hR i).left_mem, hxb i⟩ + obtain ⟨T', hT', hsize, hends, hinternal⟩ := + extend_crooked_transaction_across_neighborhood (N₂ := N₂) (K := C last) (by omega) + hS₁S (hsep.2.1.trans hNG) hcutU hcomp₂.2.1 hcomp₂.2.2.1 + hrural₂ (fun v hv => hbarH₂ (hΩ ▸ hv)) (hΩ ▸ hCbar last) + hR hRK hy_inj hx_inj hRd (fun i => hcomp₁.2.1 ▸ (hΩ₁.symm ▸ hyK i)) + hxb hxX hRbar hT hTends + exact ⟨T', hT', hsize.trans hpT, hends, hinternal⟩ + +/-! ## 3. Proof of Graph Minors XIV, (8.3) (pages 40–41) -/ + +/-- **Graph Minors XIV, (8.3)** (pages 40–41): +"Let $(G, \Omega_1)$ be the composition of a society $(G_2, \Omega_2)$ with a rural neighbourhood +$(G_1, \Omega_1, \Omega_2)$ of breadth $\ge 3$. Suppose that $X \subseteq \bar{\Omega}_1$ and +there are $4$ mutually disjoint paths in $G_1$, each from $X$ to $\bar{\Omega}_2$ with no vertex +in $\bar{\Omega}_1$ except its initial vertex. If there is a cross $\mathscr{P}$ in $(G, \Omega_1)$ +then $\mathscr{P}$ may be chosen so that in addition $V(\mathscr{P}) \subseteq X$ and no member of +$\mathscr{P}$ has any internal vertex in $\bar{\Omega}$." -/ +theorem theorem_8_3_proof + (S_comp S₂ : Society α β) (N : Neighborhood α β) (X : Set α) + (P : Fin 4 → Graph α β) (x y : Fin 4 → α) + (P_set : Set (Graph α β)) + (hcomp : S_comp.IsComposition S₂ N) + (hbreadth : N.HasBreadthGe 3) + (hX : X ⊆ N.Ω.bar) + (hP_path : ∀ i, IsFromToPathWithEnds N.G (P i) N.Ω.bar N.Ω₀.bar (x i) (y i) ∧ x i ∈ X) + (hP_disj : Pairwise (fun i j => Disjoint V(P i) V(P j))) + (hCrooked : S_comp.IsCrookedTransaction P_set) + (hcard : P_set.ncard = 2) : + ∃ P_set' : Set (Graph α β), + S_comp.IsCrookedTransaction P_set' ∧ + P_set'.ncard = 2 ∧ + S_comp.transactionEnds P_set' ⊆ X ∧ + ∀ Q ∈ P_set', Disjoint (pathInternalVerts S_comp.G Q) S_comp.Ω.bar := by + let X' : Set α := range x + have hX'_sub : X' ⊆ X := by + rintro _ ⟨i, rfl⟩ + exact (hP_path i).2 + have hx_inj : Injective x := by + intro i j hxy + by_contra hne + have hxi : x i ∈ V(P i) := (hP_path i).1.1.left_mem + have hxj : x i ∈ V(P j) := hxy ▸ (hP_path j).1.1.left_mem + exact disjoint_left.mp (hP_disj hne) hxi hxj + have hX'_card : X'.ncard = 4 := by + rw [ncard_range_of_injective hx_inj, Nat.card_eq_fintype_card, Fintype.card_fin] + have hLinked : N.IsLinked X' := by + refine ⟨hX'_sub.trans hX, fun k => P (Fin.cast hX'_card k), fun k => ?_, fun i j hne => ?_⟩ + · let i := Fin.cast hX'_card k + have hy_bar : y i ∈ N.Ω₀.bar := by + have : y i ∈ V(P i) ∩ N.Ω₀.bar := by + rw [(hP_path i).1.2.2] + exact mem_singleton (y i) + exact this.2 + exact ⟨x i, mem_range_self i, y i, hy_bar, (hP_path i).1⟩ + · have hne' : Fin.cast hX'_card i ≠ Fin.cast hX'_card j := + fun h => hne ((Fin.cast_injective hX'_card) h) + exact hP_disj hne' + obtain ⟨P_set', hCr', hcard', hEnds', hInt'⟩ := + theorem_10_4_p2 hbreadth hLinked (Nat.le_of_eq hX'_card.symm) hcomp hCrooked hcard.symm.le + exact ⟨P_set', hCr', hcard', hEnds'.trans hX'_sub, hInt'⟩ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section8Core.lean b/LeanPool/GraphMinor/GM14/Section8Core.lean new file mode 100644 index 0000000000..75a8292f4c --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section8Core.lean @@ -0,0 +1,759 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Adapted +public import LeanPool.GraphMinor.GM09.Section11d +public import LeanPool.GraphMinor.GM09.Section9 +public import LeanPool.GraphMinor.GM09.Section2e +public import LeanPool.GraphMinor.GM06.DiscRegions +public import LeanPool.GraphMinor.Surface.Crossing +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section4a +import LeanPool.GraphMinor.GM09.DiscDrawing +import LeanPool.GraphMinor.GM07.Section8 + +/-! +# Graph Minors XIV, (8.1) + +This file proves `(8.1)` of N. Robertson and P. D. Seymour, *Graph Minors. XIV. Extending an +embedding*, J. Combin. Theory Ser. B 65 (1995) 23–50, page 40: +"A society $(G, \Omega)$ has no cross if and only if there is a 3-segregation $\mathscr{S}$ of $G$ +with +$\bar{\Omega} \subseteq V(\mathscr{S})$ and an arrangement $\alpha$ of $\mathscr{S}$ in a closed +disc $\Delta$ with $\Omega = \alpha^{-1}(bd(\Delta))$." + +The paper says that the proof of (11.11) of Graph Minors IX may be adapted. For the forward +direction we keep that proof, with one change. A society with no cross has a core with no cross and +no tripod, by (2.3) of Graph Minors IX. So the core is rural by (2.4), and we do not need (6.1) or +(11.5). The set `ΩBar₀` of (11.11) is then empty, so the society `(A₀, Ω₀)` also has at most three +vertices on its boundary, and the arrangement moves from the plane to `Σ` by a homeomorphism. + +For the reverse direction, each path of a cross runs through the discs of the arrangement, and we +replace each passage by a chord. This gives one connected set for each path. Two disjoint paths +cannot both pass through a disc with at most three boundary vertices. So the two connected sets are +disjoint, which contradicts the way that their ends cross on `bd(Δ)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM06 + +universe u v w + +variable {α : Type u} {β : Type v} + +/-! ## 1. Crooked transactions of size two -/ + +/-- A crooked transaction `{P₁, P₂}` with `P₁ ≠ P₂` is a cross: `S.OmegaPathsCross P₁ P₂`. -/ +theorem Society.omegaPathsCross_of_isCrookedTransaction_pair (S : Society α β) + {P₁ P₂ : Graph α β} (hne : P₁ ≠ P₂) (hcr : S.IsCrookedTransaction {P₁, P₂}) : + S.OmegaPathsCross P₁ P₂ := by + obtain ⟨⟨A, B, hF⟩, hnp⟩ := hcr + obtain ⟨a₁, -, b₁, -, h₁⟩ := hF.2.2 P₁ (Or.inl rfl) + obtain ⟨a₂, -, b₂, -, h₂⟩ := hF.2.2 P₂ (Or.inr rfl) + have hdisj : Disjoint V(P₁) V(P₂) := hF.1.2 (Or.inl rfl) (Or.inr rfl) hne + have hends : ∀ v ∈ S.transactionEnds {P₁, P₂}, (v = a₁ ∨ v = b₁) ∨ (v = a₂ ∨ v = b₂) := by + rintro v ⟨P, hP, b, hv⟩ + have hmem : v ∈ pathEnds S.G P := by + rw [hv.1.pathEnds_eq] + exact Or.inl rfl + rcases hP with rfl | rfl + · rw [h₁.1.pathEnds_eq] at hmem + exact Or.inl hmem + · rw [h₂.1.pathEnds_eq] at hmem + exact Or.inr hmem + have hnd₁ : ¬ Disjoint (S.Ω.interval a₁ b₁) (S.transactionEnds {P₁, P₂}) := fun hd => + hnp P₁ (Or.inl rfl) ⟨Or.inl rfl, a₁, b₁, h₁, Or.inl hd⟩ + have hnd₂ : ¬ Disjoint (S.Ω.interval b₁ a₁) (S.transactionEnds {P₁, P₂}) := fun hd => + hnp P₁ (Or.inl rfl) ⟨Or.inl rfl, a₁, b₁, h₁, Or.inr hd⟩ + obtain ⟨x, hx, hxe⟩ := Set.not_disjoint_iff.mp hnd₁ + obtain ⟨y, hy, hye⟩ := Set.not_disjoint_iff.mp hnd₂ + have hxe' : x = a₂ ∨ x = b₂ := by + rcases hends x hxe with (rfl | rfl) | h + · exact (S.Ω.not_mem_interval_left _ _ hx).elim + · exact (S.Ω.not_mem_interval_right _ _ hx).elim + · exact h + have hye' : y = a₂ ∨ y = b₂ := by + rcases hends y hye with (rfl | rfl) | h + · exact (S.Ω.not_mem_interval_right _ _ hy).elim + · exact (S.Ω.not_mem_interval_left _ _ hy).elim + · exact h + have hxy : x ≠ y := fun h => + Set.disjoint_left.mp (S.Ω.disjoint_interval_swap a₁ b₁) hx (h ▸ hy) + refine ⟨hdisj, a₁, b₁, a₂, b₂, h₁, h₂, S.Ω.crosses_iff_interval.mpr ?_⟩ + rcases hxe' with rfl | rfl <;> rcases hye' with rfl | rfl + · exact (hxy rfl).elim + · exact Or.inl ⟨hx, hy⟩ + · exact Or.inr ⟨hx, hy⟩ + · exact (hxy rfl).elim + +/-- A crooked transaction of size two is a cross. Neither path is peripheral, so each of the two +intervals between the ends of the first path holds an end of the second path. -/ +theorem Society.exists_isCross_of_isCrookedTransaction {S : Society α β} + {P_set : Set (Graph α β)} (h : S.IsCrookedTransaction P_set) (hc : P_set.ncard = 2) : + ∃ P₁ P₂ : Graph α β, S.IsCross P₁ P₂ := by + obtain ⟨P₁, P₂, hne, rfl⟩ := Set.ncard_eq_two.mp hc + exact ⟨P₁, P₂, Society.omegaPathsCross_of_isCrookedTransaction_pair S hne h⟩ + +/-! ## 2. Moving discs by a homeomorphism -/ + +section Transport + +variable {A : Type u} {B : Type v} [TopologicalSpace A] [TopologicalSpace B] + +/-- A homeomorphism between two subsets extends to maps of the whole spaces, which are continuous +on those subsets and are inverse to each other there. -/ +theorem exists_extensions [Nonempty A] [Nonempty B] {Δ : Set A} {Δ' : Set B} (e : Δ ≃ₜ Δ') : + ∃ (f : A → B) (f' : B → A), (∀ x : Δ, f x.1 = (e x).1) ∧ ContinuousOn f Δ ∧ + ContinuousOn f' Δ' ∧ f '' Δ = Δ' ∧ LeftInvOn f' f Δ := by + classical + let f : A → B := fun x => if h : x ∈ Δ then (e ⟨x, h⟩).1 else Classical.arbitrary B + let f' : B → A := fun y => if h : y ∈ Δ' then (e.symm ⟨y, h⟩).1 else Classical.arbitrary A + have hf : ∀ x : Δ, f x.1 = (e x).1 := fun x => by simp [f] + have hf' : ∀ y : Δ', f' y.1 = (e.symm y).1 := fun y => by simp [f'] + refine ⟨f, f', hf, ?_, ?_, ?_, ?_⟩ + · refine continuousOn_iff_continuous_domRestrict.mpr ?_ + have hc : Continuous fun x : Δ => (e x).1 := continuous_subtype_val.comp e.continuous + exact hc.congr fun x => (hf x).symm + · refine continuousOn_iff_continuous_domRestrict.mpr ?_ + have hc : Continuous fun y : Δ' => (e.symm y).1 := + continuous_subtype_val.comp e.symm.continuous + exact hc.congr fun y => (hf' y).symm + · ext y + constructor + · rintro ⟨x, hx, rfl⟩ + rw [hf ⟨x, hx⟩] + exact (e ⟨x, hx⟩).2 + · intro hy + refine ⟨(e.symm ⟨y, hy⟩).1, (e.symm ⟨y, hy⟩).2, ?_⟩ + rw [hf (e.symm ⟨y, hy⟩)] + simp + · intro x hx + rw [hf ⟨x, hx⟩, hf' (e ⟨x, hx⟩)] + simp + +/-- The image of a line under a map with a continuous inverse. -/ +theorem isLineWithEnds_image {L : Set A} {a b : A} (hL : IsLineWithEnds L a b) + {f : A → B} {f' : B → A} (hf : ContinuousOn f L) (hf' : ContinuousOn f' (f '' L)) + (hl : LeftInvOn f' f L) : IsLineWithEnds (f '' L) (f a) (f b) := by + obtain ⟨e, he⟩ := exists_homeomorph_image hf hf' hl + obtain ⟨g, h₀, h₁⟩ := hL + refine ⟨g.trans e, ?_, ?_⟩ + · rw [Homeomorph.trans_apply, he, h₀] + · rw [Homeomorph.trans_apply, he, h₁] + +end Transport + +/-- Chords of a closed disc in a space of any universe. -/ +theorem exists_chord_of_isClosedDisc {D : Type w} [TopologicalSpace D] {Δ : Set D} + (hΔ : IsClosedDisc Δ) {a b : D} (ha : a ∈ discBd Δ) (hb : b ∈ discBd Δ) (hab : a ≠ b) : + ∃ F, IsLineWithEnds F a b ∧ F ⊆ Δ ∧ F ∩ discBd Δ = {a, b} := by + obtain ⟨φ⟩ := id hΔ + have hY : IsClosedDisc ClosedUnitDisc := ⟨Homeomorph.refl _⟩ + have : Nonempty D := ⟨a⟩ + obtain ⟨f, f', -, hf, hf', him, hl⟩ := exists_extensions φ + have hbd : discBd Δ = f '' discBd ClosedUnitDisc := by + have h := (IsClosedDisc.image hY hf (by rwa [him]) hl).2 + rwa [him] at h + have hinj : InjOn f ClosedUnitDisc := hl.injOn + have hsub : discBd ClosedUnitDisc ⊆ ClosedUnitDisc := discBd_subset _ + rw [hbd] at ha hb ⊢ + obtain ⟨a', ha', rfl⟩ := ha + obtain ⟨b', hb', rfl⟩ := hb + have hab' : a' ≠ b' := fun h => hab (h ▸ rfl) + obtain ⟨F, hF, hFsub, hFcap⟩ := Surface.exists_chord hY ha' hb' hab' + refine ⟨f '' F, isLineWithEnds_image hF (hf.mono hFsub) (hf'.mono ?_) (hl.mono hFsub), ?_, ?_⟩ + · rw [← him] + exact image_mono hFsub + · rw [← him] + exact image_mono hFsub + · rw [← hinj.image_inter hFsub hsub, hFcap, image_pair] + +/-- If a closed disc in a space homeomorphic to `ClosedUnitDisc` has a point `x` in the closure of +its complement, then `x` is on the boundary of the disc. To see this, move the disc to the plane. -/ +theorem subBd_subset_discBd {D : Type w} [TopologicalSpace D] + (h : D ≃ₜ ClosedUnitDisc) {X : Set D} (hX : IsClosedDisc X) : subBd X ⊆ discBd X := by + have : Nonempty ClosedUnitDisc := ⟨⟨0, by simp [ClosedUnitDisc]⟩⟩ + have : Nonempty D := ⟨h.symm (Classical.arbitrary _)⟩ + obtain ⟨f, f', hfe, hf, hf', him, hl⟩ := + exists_extensions ((Homeomorph.Set.univ D).trans h) + have hfc : Continuous f := continuousOn_univ.mp hf + have hinj : Function.Injective f := injOn_univ.mp hl.injOn + have hl' : LeftInvOn f' f X := hl.mono (subset_univ X) + have hf'' : ContinuousOn f' (f '' X) := + hf'.mono (by rw [← him]; exact image_mono (subset_univ X)) + obtain ⟨hdisc, hbd⟩ := IsClosedDisc.image hX hfc.continuousOn hf'' hl' + rintro x ⟨hx₁, hx₂⟩ + have hc₂ : f x ∈ closure (univ \ f '' X) := by + refine closure_mono ?_ (map_mem_closure hfc hx₂ (mapsTo_image f _)) + rintro _ ⟨y, ⟨-, hy⟩, rfl⟩ + exact ⟨mem_univ _, fun ⟨z, hz, hzy⟩ => hy (hinj hzy ▸ hz)⟩ + have hc₁ : f x ∈ closure (f '' X) := map_mem_closure hfc hx₁ (mapsTo_image f _) + have hmem : f x ∈ subBd (f '' X) := ⟨hc₁, hc₂⟩ + rw [subBd_eq_discBd_plane hdisc, hbd] at hmem + obtain ⟨y, hy, hyx⟩ := hmem + exact hinj hyx ▸ hy + +/-! ## 3. The set of points used by a path -/ + +section Cover + +variable {D : Type w} [TopologicalSpace D] + +/-- The part of `Σ` that we use to follow a path `P`: the points of its vertices in `V(𝒮)`, and +chords of discs between two vertices of `P` on the boundary of the same disc. -/ +def arrangementCover (S_seg : Set (Society α β)) (α_disc : Society α β → Set D) (α_pt : α → D) + (P : Graph α β) : Set D := + (α_pt '' (V(P) ∩ segregationVertices S_seg)) ∪ + {x | ∃ T ∈ S_seg, ∃ u ∈ T.Ω.bar ∩ V(P), ∃ v ∈ T.Ω.bar ∩ V(P), u ≠ v ∧ ∃ F, x ∈ F ∧ + F ⊆ α_disc T ∧ F ∩ discBd (α_disc T) = {α_pt u, α_pt v}} + +variable {G : Graph α β} {S_seg : Set (Society α β)} {α_disc : Society α β → Set D} + {α_pt : α → D} + +/-- A vertex of `V(𝒮)` in a member of `𝒮` is on the boundary of that member. -/ +theorem IsGraphSegregation.mem_bar {v : α} (hseg : IsGraphSegregation G S_seg) + (hv : v ∈ segregationVertices S_seg) {T : Society α β} (hT : T ∈ S_seg) + (hvT : v ∈ V(T.G)) : v ∈ T.Ω.bar := by + obtain ⟨T', hT', hvb⟩ := mem_iUnion₂.mp hv + by_cases hTT : T' = T + · exact hTT ▸ hvb + · exact (hseg.vertex_inter_subset T' hT' T hT hTT ⟨T'.bar_subset hvb, hvT⟩).2 + +/-- Each edge of `G` lies in a member of `𝒮`. -/ +theorem IsGraphSegregation.exists_mem_edgeSet {e : β} (hseg : IsGraphSegregation G S_seg) + (he : e ∈ E(G)) : ∃ T ∈ S_seg, e ∈ E(T.G) := by + have hle : ∀ Q ∈ (fun S₀ : Society α β => S₀.G) '' S_seg, Q ≤ G := by + rintro _ ⟨T, hT, rfl⟩ + exact hseg.le T hT + rw [← hseg.union_eq, edgeSet_subgraphSUnion hle] at he + obtain ⟨_, ⟨T, hT, rfl⟩, heT⟩ := mem_iUnion₂.mp he + exact ⟨T, hT, heT⟩ + +/-- Following a walk of `P` backwards from its last vertex `b`, we build a connected set in the +cover of `P`. It holds the point of the current vertex, if that vertex is in `V(𝒮)`. Also, for each +member of `𝒮` that holds the current vertex, it holds the point of some vertex of `P` on the +boundary of that member. An edge of the walk lies in one member, so a step adds at most one chord +of that member's disc. -/ +theorem exists_connected_cover (hseg : IsGraphSegregation G S_seg) + (hbd : ∀ T ∈ S_seg, ∀ v ∈ T.Ω.bar, α_pt v ∈ discBd (α_disc T)) + (hdisc : ∀ T ∈ S_seg, IsClosedDisc (α_disc T)) + (hinj : InjOn α_pt (segregationVertices S_seg)) + {P : Graph α β} (hP : P ≤ G) {u b : α} (W : GraphWalk P u b) + (hb : b ∈ segregationVertices S_seg) : + ∃ K : Set D, IsCompact K ∧ IsConnected K ∧ K ⊆ arrangementCover S_seg α_disc α_pt P ∧ + α_pt b ∈ K ∧ (u ∈ segregationVertices S_seg → α_pt u ∈ K) ∧ + ∀ T ∈ S_seg, u ∈ V(T.G) → ∃ x ∈ T.Ω.bar ∩ V(P), α_pt x ∈ K := by + induction W with + | @nil v hv => + refine ⟨{α_pt v}, isCompact_singleton, isConnected_singleton, ?_, rfl, fun _ => rfl, ?_⟩ + · rintro _ rfl + exact Or.inl ⟨v, ⟨hv, hb⟩, rfl⟩ + · exact fun T hT hvT => ⟨v, ⟨hseg.mem_bar hb hT hvT, hv⟩, rfl⟩ + | @cons u v w e hlink rest ih => + obtain ⟨K, hKc, hKconn, hKsub, hbK, -, hstep⟩ := ih hb + have heG : e ∈ E(G) := (hlink.mono hP).edge_mem + obtain ⟨T₀, hT₀, heT⟩ := hseg.exists_mem_edgeSet heG + have hl₀ : T₀.G.IsLink e u v := + ((hseg.le T₀ hT₀).isLink_iff heT).mpr (hlink.mono hP) + obtain ⟨x, hx, hxK⟩ := hstep T₀ hT₀ hl₀.right_mem + have huP : u ∈ V(P) := hlink.left_mem + by_cases hu : u ∈ T₀.Ω.bar + · have huV : u ∈ segregationVertices S_seg := mem_iUnion₂.mpr ⟨T₀, hT₀, hu⟩ + have hfin : ∀ K' : Set D, α_pt u ∈ K' → ∀ T ∈ S_seg, u ∈ V(T.G) → + ∃ x ∈ T.Ω.bar ∩ V(P), α_pt x ∈ K' := fun K' hK' T hT huT => + ⟨u, ⟨hseg.mem_bar huV hT huT, huP⟩, hK'⟩ + by_cases hxu : x = u + · subst hxu + exact ⟨K, hKc, hKconn, hKsub, hbK, fun _ => hxK, hfin K hxK⟩ + · have hxV : x ∈ segregationVertices S_seg := mem_iUnion₂.mpr ⟨T₀, hT₀, hx.1⟩ + have hne : α_pt x ≠ α_pt u := fun h => hxu (hinj hxV huV h) + obtain ⟨F, hF, hFsub, hFcap⟩ := exists_chord_of_isClosedDisc (hdisc T₀ hT₀) + (hbd T₀ hT₀ x hx.1) (hbd T₀ hT₀ u hu) hne + have huK : α_pt u ∈ K ∪ F := Or.inr hF.right_mem + refine ⟨K ∪ F, hKc.union hF.isCompact, ?_, ?_, Or.inl hbK, fun _ => huK, hfin _ huK⟩ + · exact ⟨⟨_, Or.inl hbK⟩, hKconn.isPreconnected.union (α_pt x) hxK hF.left_mem + (GraphMinor.GM07.IsLineWithEnds.isConnected hF).isPreconnected⟩ + · rintro y (hy | hy) + · exact hKsub hy + · exact Or.inr ⟨T₀, hT₀, x, hx, u, ⟨hu, huP⟩, hxu, F, hy, hFsub, hFcap⟩ + · refine ⟨K, hKc, hKconn, hKsub, hbK, fun huV => ?_, fun T hT huT => ?_⟩ + · exact (hu (hseg.mem_bar huV hT₀ hl₀.left_mem)).elim + · by_cases hTT : T = T₀ + · subst hTT + exact ⟨x, hx, hxK⟩ + · exact (hu (hseg.vertex_inter_subset T hT T₀ hT₀ hTT ⟨huT, hl₀.left_mem⟩).2).elim + +/-- A vertex of `V(𝒮)` whose point lies on a chord is an end of the chord. -/ +theorem eq_or_eq_of_mem_chord (hbd : ∀ T ∈ S_seg, ∀ v ∈ T.Ω.bar, α_pt v ∈ discBd (α_disc T)) + (hinter : ∀ S₁ ∈ S_seg, ∀ S₂ ∈ S_seg, S₁ ≠ S₂ → + α_disc S₁ ∩ α_disc S₂ ⊆ α_pt '' (S₁.Ω.bar ∩ S₂.Ω.bar)) + (hinj : InjOn α_pt (segregationVertices S_seg)) + {T : Society α β} (hT : T ∈ S_seg) {u v w : α} (hu : u ∈ T.Ω.bar) (hv : v ∈ T.Ω.bar) + {F : Set D} (hFsub : F ⊆ α_disc T) (hcap : F ∩ discBd (α_disc T) = {α_pt u, α_pt v}) + (hw : w ∈ segregationVertices S_seg) (hwF : α_pt w ∈ F) : w = u ∨ w = v := by + have huV : u ∈ segregationVertices S_seg := mem_iUnion₂.mpr ⟨T, hT, hu⟩ + have hvV : v ∈ segregationVertices S_seg := mem_iUnion₂.mpr ⟨T, hT, hv⟩ + have hwT : w ∈ T.Ω.bar := by + obtain ⟨T', hT', hwb⟩ := mem_iUnion₂.mp hw + by_cases hTT : T = T' + · exact hTT ▸ hwb + · obtain ⟨w', hw', hww⟩ := + hinter T hT T' hT' hTT ⟨hFsub hwF, discBd_subset _ (hbd T' hT' w hwb)⟩ + have hw'V : w' ∈ segregationVertices S_seg := mem_iUnion₂.mpr ⟨T, hT, hw'.1⟩ + exact hinj hw'V hw hww ▸ hw'.1 + have hm : α_pt w ∈ F ∩ discBd (α_disc T) := ⟨hwF, hbd T hT w hwT⟩ + rw [hcap] at hm + rcases hm with h | h + · exact Or.inl (hinj hw huV h) + · exact Or.inr (hinj hw hvV h) + +/-- Two disjoint paths have disjoint covers. Inside one disc, two chords would need four vertices +on its boundary. Two chords of different discs can only meet at the point of a vertex that is an +end of both chords. -/ +theorem disjoint_arrangementCover (hthree : ∀ T ∈ S_seg, T.Ω.bar.ncard ≤ 3) + (hbd : ∀ T ∈ S_seg, ∀ v ∈ T.Ω.bar, α_pt v ∈ discBd (α_disc T)) + (hinter : ∀ S₁ ∈ S_seg, ∀ S₂ ∈ S_seg, S₁ ≠ S₂ → + α_disc S₁ ∩ α_disc S₂ ⊆ α_pt '' (S₁.Ω.bar ∩ S₂.Ω.bar)) + (hinj : InjOn α_pt (segregationVertices S_seg)) + {P₁ P₂ : Graph α β} (hdisj : Disjoint V(P₁) V(P₂)) : + Disjoint (arrangementCover S_seg α_disc α_pt P₁) (arrangementCover S_seg α_disc α_pt P₂) := by + classical + have hne : ∀ {v : α}, v ∈ V(P₁) → v ∈ V(P₂) → False := fun h h' => + Set.disjoint_left.mp hdisj h h' + rw [Set.disjoint_left] + rintro x (⟨v₁, ⟨hv₁, hV₁⟩, rfl⟩ | ⟨T₁, hT₁, u₁, hu₁, w₁, hw₁, huw₁, F₁, hx₁, hF₁, hc₁⟩) + (⟨v₂, ⟨hv₂, hV₂⟩, h₂⟩ | ⟨T₂, hT₂, u₂, hu₂, w₂, hw₂, huw₂, F₂, hx₂, hF₂, hc₂⟩) + · exact hne hv₁ (hinj hV₂ hV₁ h₂ ▸ hv₂) + · rcases eq_or_eq_of_mem_chord hbd hinter hinj hT₂ hu₂.1 hw₂.1 hF₂ hc₂ hV₁ hx₂ with rfl | rfl + · exact hne hv₁ hu₂.2 + · exact hne hv₁ hw₂.2 + · subst h₂ + rcases eq_or_eq_of_mem_chord hbd hinter hinj hT₁ hu₁.1 hw₁.1 hF₁ hc₁ hV₂ hx₁ with rfl | rfl + · exact hne hu₁.2 hv₂ + · exact hne hw₁.2 hv₂ + · by_cases hTT : T₁ = T₂ + · subst hTT + have hne₁ : u₁ ≠ w₁ := huw₁ + have hne₂ : u₂ ≠ w₂ := huw₂ + have hsub : (({u₁, w₁, u₂, w₂} : Finset α) : Set α) ⊆ T₁.Ω.bar := by + intro y hy + simp only [Finset.coe_insert, Finset.coe_singleton, mem_insert_iff, mem_singleton_iff] at hy + rcases hy with rfl | rfl | rfl | rfl + · exact hu₁.1 + · exact hw₁.1 + · exact hu₂.1 + · exact hw₂.1 + have hcard : ({u₁, w₁, u₂, w₂} : Finset α).card = 4 := by + have h₁₂ : u₁ ≠ u₂ := fun h => hne hu₁.2 (h ▸ hu₂.2) + have h₁₃ : u₁ ≠ w₂ := fun h => hne hu₁.2 (h ▸ hw₂.2) + have h₂₂ : w₁ ≠ u₂ := fun h => hne hw₁.2 (h ▸ hu₂.2) + have h₂₃ : w₁ ≠ w₂ := fun h => hne hw₁.2 (h ▸ hw₂.2) + rw [Finset.card_insert_of_notMem (by simp [hne₁, h₁₂, h₁₃]), + Finset.card_insert_of_notMem (by simp [h₂₂, h₂₃]), + Finset.card_insert_of_notMem (by simp [hne₂]), Finset.card_singleton] + have hle := Set.ncard_le_ncard hsub (T₁.finite_V.subset T₁.bar_subset) + rw [Set.ncard_coe_finset, hcard] at hle + have := hthree T₁ hT₁ + omega + · obtain ⟨y, hy, rfl⟩ := hinter T₁ hT₁ T₂ hT₂ hTT ⟨hF₁ hx₁, hF₂ hx₂⟩ + have hyV : y ∈ segregationVertices S_seg := mem_iUnion₂.mpr ⟨T₁, hT₁, hy.1⟩ + have hyP₁ : y ∈ V(P₁) := by + rcases eq_or_eq_of_mem_chord hbd hinter hinj hT₁ hu₁.1 hw₁.1 hF₁ hc₁ hyV hx₁ with rfl | rfl + · exact hu₁.2 + · exact hw₁.2 + have hyP₂ : y ∈ V(P₂) := by + rcases eq_or_eq_of_mem_chord hbd hinter hinj hT₂ hu₂.1 hw₂.1 hF₂ hc₂ hyV hx₂ with rfl | rfl + · exact hu₂.2 + · exact hw₂.2 + exact hne hyP₁ hyP₂ + +end Cover + +/-- The reverse direction of (8.1): a society with an arrangement of this kind has no cross. -/ +theorem not_isCross_of_arrangement {D : Type w} [TopologicalSpace D] + (S : Society α β) (hD : Nonempty (D ≃ₜ ClosedUnitDisc)) {S_seg : Set (Society α β)} + {α_disc : Society α β → Set D} {α_pt : α → D} (h3 : IsThreeSegregation S.G S_seg) + (hbar : S.Ω.bar ⊆ segregationVertices S_seg) (harr : IsSurfaceArrangement S_seg α_disc α_pt) + (hpb : IsPullbackPerm S_seg α_pt (bd D) S.Ω) {P₁ P₂ : Graph α β} (hcr : S.IsCross P₁ P₂) : + False := by + classical + obtain ⟨h⟩ := id hD + obtain ⟨hdisj, s₁, t₁, s₂, t₂, h₁, h₂, hc⟩ := hcr + have hseg := h3.1 + have hdisc : ∀ T ∈ S_seg, IsClosedDisc (α_disc T) := fun T hT => (harr.isClosedDisc T hT).1 + have hbd : ∀ T ∈ S_seg, ∀ v ∈ T.Ω.bar, α_pt v ∈ discBd (α_disc T) := fun T hT v hv => + subBd_subset_discBd h (hdisc T hT) ((harr.isClosedDisc T hT).2 v hv) + obtain ⟨W₁, -⟩ := h₁.1.2 + obtain ⟨W₂, -⟩ := h₂.1.2 + have hs₁ := hbar h₁.2.2.1 + have ht₁ := hbar h₁.2.2.2 + have hs₂ := hbar h₂.2.2.1 + have ht₂ := hbar h₂.2.2.2 + obtain ⟨K₁, hK₁c, hK₁conn, hK₁sub, hK₁t, hK₁s, -⟩ := + exists_connected_cover hseg hbd hdisc harr.injOn_pts h₁.1.1 W₁ ht₁ + obtain ⟨K₂, hK₂c, hK₂conn, hK₂sub, hK₂t, hK₂s, -⟩ := + exists_connected_cover hseg hbd hdisc harr.injOn_pts h₂.1.1 W₂ ht₂ + obtain ⟨φ, hag⟩ := hpb.2.2 + let ν : α → Set D := fun v => if v ∈ S.Ω.bar then {α_pt v} else ∅ + have hν : ∀ {v p}, p ∈ ν v → v ∈ S.Ω.bar ∧ p = α_pt v := by + intro v p hp + by_cases hv : v ∈ S.Ω.bar + · simpa [ν, hv] using hp + · simp [ν, hv] at hp + have hνm : ∀ {v}, v ∈ S.Ω.bar → α_pt v ∈ ν v := fun {v} hv => by simp [ν, hv] + have hagν : SetAgreesWithOArcHomeo ν S.Ω (bd D) φ := by + refine ⟨fun v _ p hp => (hν hp).2 ▸ hag.1 v (hν hp).1, fun v₁ v₂ v₃ hcl => ?_⟩ + obtain ⟨t₁, t₂, t₃, h12, h23, h31, e₁, e₂, e₃⟩ := hag.2 v₁ v₂ v₃ hcl + have hcl' := S.Ω.isClockwise3_iff.mp hcl + refine ⟨t₁, t₂, t₃, h12, h23, h31, ?_, ?_, ?_⟩ + · rw [e₁]; exact hνm hcl'.2.2.2.1 + · rw [e₂]; exact hνm hcl'.2.2.2.2.1 + · rw [e₃]; exact hνm hcl'.2.2.2.2.2.1 + have hcross : PairsCrossOn (bd D) (α_pt s₁) (α_pt t₁) (α_pt s₂) (α_pt t₂) := + pairsCrossOn_of_crosses_set (fun hp hq => (hν hp).2.trans (hν hq).2.symm) + (fun hp hq => harr.injOn_pts (hbar (hν hp).1) (hbar (hν hq).1) + ((hν hp).2.symm.trans (hν hq).2)) hagν hc + (hνm h₁.2.2.1) (hνm h₁.2.2.2) (hνm h₂.2.2.1) (hνm h₂.2.2.2) + rw [← discBd_univ] at hcross + obtain ⟨x, hx₁, hx₂⟩ := disc_crossing (univ : Set D) K₁ K₂ (α_pt s₁) (α_pt t₁) (α_pt s₂) (α_pt t₂) + ⟨h.symm.trans (Homeomorph.Set.univ D).symm⟩ (subset_univ _) (subset_univ _) hK₁c hK₂c hK₁conn + hK₂conn (hK₁s hs₁) hK₁t (hK₂s hs₂) hK₂t hcross + exact Set.disjoint_left.mp + (disjoint_arrangementCover (fun T hT => h3.2 T hT) hbd harr.inter_discs harr.injOn_pts + hdisj) (hK₁sub hx₁) (hK₂sub hx₂) + +/-! ## 4. Moving an arrangement from the plane to `Σ` -/ + +/-- Let `X` be a closed disc inside a closed disc `Δ` of the plane, meeting `bd(Δ)` in a finite set. +Then the points of `X` that are limits of points of `Δ \ X` are the boundary of `X`. At an interior +point of `Δ` this is the same as being on the boundary of `X` in the plane. A point of `bd(Δ)` is a +limit of the other points of `bd(Δ)`, and only finitely many of those are in `X`. -/ +theorem inter_closure_sdiff_eq_discBd {X Δ : Set EuclideanPlane} (hX : IsClosedDisc X) + (hΔ : IsClosedDisc Δ) (hsub : X ⊆ Δ) (hfin : (X ∩ discBd Δ).Finite) : + X ∩ closure (Δ \ X) = discBd X := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨hx, hc⟩ + rw [← subBd_eq_discBd_plane hX] + exact ⟨subset_closure hx, closure_mono (show Δ \ X ⊆ univ \ X from fun y hy => ⟨mem_univ _, + hy.2⟩) hc⟩ + · intro x hx + have hxX : x ∈ X := discBd_subset _ hx + refine ⟨hxX, ?_⟩ + rw [← subBd_eq_discBd_plane hX] at hx + by_cases hi : x ∈ interior Δ + · have hc : x ∈ closure (interior Δ ∩ (univ \ X)) := isOpen_interior.inter_closure ⟨hi, hx.2⟩ + exact closure_mono (show interior Δ ∩ (univ \ X) ⊆ Δ \ X from + fun y hy => ⟨interior_subset hy.1, hy.2.2⟩) hc + · have hxb : x ∈ discBd Δ := by + rw [interior_eq_discInt_plane hΔ] at hi + by_contra hn + exact hi ⟨hsub hxX, hn⟩ + obtain ⟨φ⟩ := hΔ.isOArc_discBd + let g : Circle → EuclideanPlane := fun z => (φ z).1 + have hg : Continuous g := continuous_subtype_val.comp φ.continuous + have hginj : Function.Injective g := fun a b hab => φ.injective (Subtype.ext hab) + have hF : {z | g z ∈ X}.Finite := + (hfin.preimage hginj.injOn).subset fun z hz => ⟨hz, (φ z).2⟩ + have hn : Nontrivial Circle := ⟨1, Circle.exp Real.pi, fun h => by + have h' := congrArg (fun z : Circle => (z : ℂ)) h + norm_num [Circle.coe_exp, Complex.exp_pi_mul_I] at h'⟩ + have hd : Dense (univ \ {z | g z ∈ X}) := dense_univ.sdiff_finite hF + have hc := map_mem_closure (t := Δ \ X) hg (hd (φ.symm ⟨x, hxb⟩)) + (fun z hz => ⟨discBd_subset _ (φ z).2, hz.2⟩) + have hz : g (φ.symm ⟨x, hxb⟩) = x := by simp [g] + rwa [hz] at hc + +/-- The closure of the complement of a set, under a map that is a homeomorphism from a compact set +`Δ` onto all of `D`. -/ +theorem subBd_image_eq {D : Type w} [TopologicalSpace D] [T2Space D] {Δ X : Set EuclideanPlane} + {f : EuclideanPlane → D} (hΔ : IsCompact Δ) (hX : IsCompact X) (hsub : X ⊆ Δ) + (hf : ContinuousOn f Δ) (hinj : InjOn f Δ) (him : f '' Δ = univ) : + subBd (f '' X) = f '' (X ∩ closure (Δ \ X)) := by + have hcl : closure (Δ \ X) ⊆ Δ := closure_minimal sdiff_subset hΔ.isClosed + have hXc : IsClosed (f '' X) := (hX.image_of_continuousOn (hf.mono hsub)).isClosed + have hcompl : univ \ f '' X = f '' (Δ \ X) := by + ext y + constructor + · rintro ⟨-, hy⟩ + have hy' : y ∈ f '' Δ := by rw [him]; exact mem_univ _ + obtain ⟨x, hx, rfl⟩ := hy' + exact ⟨x, ⟨hx, fun h => hy ⟨x, h, rfl⟩⟩, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨mem_univ _, fun ⟨z, hz, hzx⟩ => hx.2 (hinj hx.1 (hsub hz) hzx.symm ▸ hz)⟩ + have hclo : closure (f '' (Δ \ X)) = f '' closure (Δ \ X) := by + refine Subset.antisymm (closure_minimal (image_mono subset_closure) ?_) + ((hf.mono hcl).image_closure) + exact ((hΔ.of_isClosed_subset isClosed_closure hcl).image_of_continuousOn + (hf.mono hcl)).isClosed + unfold subBd + rw [hXc.closure_eq, hcompl, hclo, hinj.image_inter hsub hcl] + +/-- Clockwise agreement moves along a map with a continuous inverse, with the same angles. -/ +theorem isNaturalOrderFrom_image {D : Type w} [TopologicalSpace D] {F : Set EuclideanPlane} + {f : EuclideanPlane → D} {f' : D → EuclideanPlane} (hf : ContinuousOn f F) + (hf' : ContinuousOn f' (f '' F)) (hl : LeftInvOn f' f F) {ν : α → EuclideanPlane} + {Ω : CyclicPerm α} {φ : Circle ≃ₜ F} (hag : AgreesWithOArcHomeo ν Ω F φ) : + IsNaturalOrderFrom (f ∘ ν) Ω (f '' F) := by + obtain ⟨e, he⟩ := exists_homeomorph_image hf hf' hl + refine ⟨⟨φ.trans e⟩, φ.trans e, fun v hv => ⟨_, hag.1 v hv, rfl⟩, fun v₁ v₂ v₃ hcl => ?_⟩ + obtain ⟨t₁, t₂, t₃, h12, h23, h31, e₁, e₂, e₃⟩ := hag.2 v₁ v₂ v₃ hcl + refine ⟨t₁, t₂, t₃, h12, h23, h31, ?_, ?_, ?_⟩ + · rw [Homeomorph.trans_apply, he, e₁]; rfl + · rw [Homeomorph.trans_apply, he, e₂]; rfl + · rw [Homeomorph.trans_apply, he, e₃]; rfl + +/-- A feasible segregation of Graph Minors IX in which every member has at most three boundary +vertices gives the data on the right side of (8.1). We put `(A₀, Ω₀), …, (A_k, Ω_k)` into one +family, and move discs and points by a homeomorphism from `Δ` to `Σ`. The discs stay away from +`bd(Δ)` except at finitely many points, so the boundary of a disc in `Σ` is the image of its +boundary in the plane. -/ +theorem exists_surface_arrangement {D : Type w} [TopologicalSpace D] [T2Space D] + (S : Society α β) (h : D ≃ₜ ClosedUnitDisc) {k : ℕ} {A₀ : Society α β} + {A : Fin k → Society α β} (hF : IsFeasibleSegregation S A₀ A) + (h₀ : A₀.Ω.bar.ncard ≤ 3) (hA : ∀ i : Fin k, (A i).Ω.bar.ncard ≤ 3) : + ∃ (S_seg : Set (Society α β)) (α_disc : Society α β → Set D) (α_pt : α → D), + IsThreeSegregation S.G S_seg ∧ S.Ω.bar ⊆ segregationVertices S_seg ∧ + IsSurfaceArrangement S_seg α_disc α_pt ∧ IsPullbackPerm S_seg α_pt (bd D) S.Ω := by + classical + obtain ⟨hs, Δ, α₀, α_d, α_p, ha⟩ := hF + let B : Option (Fin k) → Society α β := fun o => o.elim A₀ A + let E : Option (Fin k) → Set EuclideanPlane := fun o => o.elim α₀ α_d + have hEd : ∀ o, IsClosedDisc (E o) ∧ E o ⊆ Δ := by + rintro (_ | i) + · exact ha.isClosedDisc_zero + · exact ha.isClosedDisc_succ i + have hEag : ∀ o, ∃ φ : Circle ≃ₜ subBd (E o), AgreesWithOArcHomeo α_p (B o).Ω (subBd (E o)) φ + := by + rintro (_ | i) + · obtain ⟨φ, _, hφ⟩ := ha.bd_zero; exact ⟨φ, hφ⟩ + · obtain ⟨φ, _, hφ⟩ := ha.bd_succ i; exact ⟨φ, hφ⟩ + have hEint : ∀ o o', o ≠ o' → E o ∩ E o' ⊆ α_p '' ((B o).Ω.bar ∩ (B o').Ω.bar) := by + rintro (_ | i) (_ | j) hne + · exact (hne rfl).elim + · exact ha.inter_zero j + · change α_d i ∩ α₀ ⊆ α_p '' ((A i).Ω.bar ∩ A₀.Ω.bar) + rw [inter_comm, inter_comm (A i).Ω.bar] + exact ha.inter_zero i + · exact ha.inter_succ i j fun h => hne (h ▸ rfl) + have hEbd : ∀ o, E o ∩ subBd Δ ⊆ α_p '' ((B o).Ω.bar ∩ S.Ω.bar) := by + rintro (_ | i) + · exact ha.inter_bd_zero + · exact ha.inter_bd_succ i + have hinj : InjOn α_p (⋃ o, (B o).Ω.bar) := by + rw [iUnion_option] + exact ha.injOn_pts + have hVint : ∀ o o', o ≠ o' → V((B o).G) ∩ V((B o').G) ⊆ (B o).Ω.bar ∩ (B o').Ω.bar := by + rintro (_ | i) (_ | j) hne + · exact (hne rfl).elim + · exact hs.inter_zero_subset j + · change V((A i).G) ∩ V(A₀.G) ⊆ (A i).Ω.bar ∩ A₀.Ω.bar + rw [inter_comm, inter_comm (A i).Ω.bar] + exact hs.inter_zero_subset i + · exact hs.inter_succ_subset i j fun h => hne (h ▸ rfl) + have hEdisj : ∀ o o', o ≠ o' → Disjoint E((B o).G) E((B o').G) := by + rintro (_ | i) (_ | j) hne + · exact (hne rfl).elim + · exact hs.disjoint_zero j + · exact (hs.disjoint_zero i).symm + · exact hs.disjoint_succ fun h => hne (h ▸ rfl) + have hle : ∀ o, (B o).G ≤ S.G := by + rintro (_ | i) + · exact hs.le_zero + · exact hs.le_succ i + have hVun : (⋃ o, V((B o).G)) = V(S.G) := by + rw [iUnion_option] + exact hs.vertexSet_union + have hEun : (⋃ o, E((B o).G)) = E(S.G) := by + rw [iUnion_option] + exact hs.edgeSet_union + have hbaru : S.Ω.bar ⊆ ⋃ o, (B o).Ω.bar := by + rw [iUnion_option] + exact hs.bar_subset_union + have hb3 : ∀ o, (B o).Ω.bar.ncard ≤ 3 := by + rintro (_ | i) + · exact h₀ + · exact hA i + have hsegV : segregationVertices (range B) = ⋃ o, (B o).Ω.bar := by + simp [segregationVertices] + have hBne : ∀ {o o'}, B o ≠ B o' → o ≠ o' := fun h h' => h (h' ▸ rfl) + have hseg : IsGraphSegregation S.G (range B) := by + have hle' : ∀ Q ∈ (fun S₀ : Society α β => S₀.G) '' range B, Q ≤ S.G := by + rintro _ ⟨_, ⟨o, rfl⟩, rfl⟩ + exact hle o + refine ⟨finite_range B, ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨o, rfl⟩ + exact hle o + · refine (Compatible.of_le_le (subgraphSUnion_le hle') le_rfl).ext ?_ ?_ + · rw [vertexSet_subgraphSUnion, ← hVun] + simp + · rw [edgeSet_subgraphSUnion hle', ← hEun] + simp + · rintro _ ⟨o, rfl⟩ _ ⟨o', rfl⟩ hne + exact hVint o o' (hBne hne) + · rintro _ ⟨o, rfl⟩ _ ⟨o', rfl⟩ hne + exact hEdisj o o' (hBne hne) + have h3 : IsThreeSegregation S.G (range B) := by + refine ⟨hseg, ?_⟩ + rintro _ ⟨o, rfl⟩ + exact hb3 o + obtain ⟨φ⟩ := id ha.isClosedDisc_Δ + let ψ : Δ ≃ₜ D := φ.symm.trans h.symm + have : Nonempty ClosedUnitDisc := ⟨⟨0, by simp [ClosedUnitDisc]⟩⟩ + have : Nonempty D := ⟨h.symm (Classical.arbitrary _)⟩ + obtain ⟨f, f', hfe, hf, hf', him, hl⟩ := + exists_extensions (ψ.trans (Homeomorph.Set.univ D).symm) + have hfe' : ∀ x : Δ, f x.1 = ψ x := hfe + have hfinj : InjOn f Δ := hl.injOn + have hΔc : IsCompact Δ := ha.isClosedDisc_Δ.isCompact + have hbdD : bd D = f '' subBd Δ := by + rw [subBd_eq_discBd_plane ha.isClosedDisc_Δ, ← image_bd_homeomorph ψ] + unfold discBd + rw [image_image] + exact (image_congr fun x _ => hfe' x).symm + have hsubBd : ∀ o, subBd (f '' E o) = f '' subBd (E o) := by + intro o + have hfin : (E o ∩ discBd Δ).Finite := by + rw [← subBd_eq_discBd_plane ha.isClosedDisc_Δ] + exact (((B o).finite_V.subset (B o).bar_subset).image α_p).subset fun x hx => + image_mono inter_subset_left (hEbd o hx) + rw [subBd_image_eq hΔc (hEd o).1.isCompact (hEd o).2 hf hfinj him, + inter_closure_sdiff_eq_discBd (hEd o).1 ha.isClosedDisc_Δ (hEd o).2 hfin, + subBd_eq_discBd_plane (hEd o).1] + have hfEl : ∀ {F : Set EuclideanPlane}, F ⊆ Δ → + ContinuousOn f F ∧ ContinuousOn f' (f '' F) ∧ LeftInvOn f' f F := fun hF => + ⟨hf.mono hF, hf'.mono (subset_univ _), hl.mono hF⟩ + have hsubE : ∀ o, subBd (E o) ⊆ E o := fun o => by + rw [subBd_eq_discBd_plane (hEd o).1] + exact discBd_subset _ + have hmemE : ∀ o, ∀ v ∈ (B o).Ω.bar, α_p v ∈ subBd (E o) := fun o v hv => by + obtain ⟨φ₀, hφ₀⟩ := hEag o + exact hφ₀.1 v hv + have hmemΔ : ∀ o, ∀ v ∈ (B o).Ω.bar, α_p v ∈ Δ := fun o v hv => + (hEd o).2 (hsubE o (hmemE o v hv)) + have hmemΔ' : ∀ v ∈ ⋃ o, (B o).Ω.bar, α_p v ∈ Δ := fun v hv => by + obtain ⟨o, hv⟩ := mem_iUnion.mp hv + exact hmemΔ o v hv + let α_disc' : Society α β → Set D := fun T => f '' E (Function.invFun B T) + have hrep : ∀ T ∈ range B, ∃ o, B o = T ∧ α_disc' T = f '' E o := fun T hT => + ⟨Function.invFun B T, Function.invFun_eq hT, rfl⟩ + have hinjf' : InjOn (f ∘ α_p) (⋃ o, (B o).Ω.bar) := fun v hv w hw hvw => + hinj hv hw (hfinj (hmemΔ' v hv) (hmemΔ' w hw) hvw) + have hbarV : S.Ω.bar ⊆ segregationVertices (range B) := by + rw [hsegV] + exact hbaru + obtain ⟨φ₁, _, hφ₁⟩ := ha.bd_outer + have harr : IsSurfaceArrangement (range B) α_disc' (f ∘ α_p) := by + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · intro T hT + obtain ⟨o, rfl, hd⟩ := hrep T hT + rw [hd, hsubBd o] + obtain ⟨h₁, h₂, h₃⟩ := hfEl (hEd o).2 + exact ⟨(IsClosedDisc.image (hEd o).1 h₁ h₂ h₃).1, fun x hx => ⟨_, hmemE o x hx, rfl⟩⟩ + · intro T₁ hT₁ T₂ hT₂ hne + obtain ⟨o₁, rfl, hd₁⟩ := hrep T₁ hT₁ + obtain ⟨o₂, rfl, hd₂⟩ := hrep T₂ hT₂ + rw [hd₁, hd₂, ← hfinj.image_inter (hEd o₁).2 (hEd o₂).2] + rintro _ ⟨y, hy, rfl⟩ + obtain ⟨w, hw, rfl⟩ := hEint o₁ o₂ (hBne hne) hy + exact ⟨w, hw, rfl⟩ + · intro T hT + obtain ⟨o, rfl, hd⟩ := hrep T hT + rw [hd, hbdD] + rintro _ ⟨⟨y, hy, rfl⟩, ⟨z, hz, hzy⟩⟩ + have hsΔ : subBd Δ ⊆ Δ := by + rw [subBd_eq_discBd_plane ha.isClosedDisc_Δ] + exact discBd_subset _ + have hzeq : z = y := hfinj (hsΔ hz) ((hEd o).2 hy) hzy + obtain ⟨w, hw, rfl⟩ := hEbd o ⟨hy, hzeq ▸ hz⟩ + exact ⟨w, hw.1, rfl⟩ + · rw [hsegV] + exact hinjf' + · intro T hT + obtain ⟨o, rfl, hd⟩ := hrep T hT + obtain ⟨φ₀, hφ₀⟩ := hEag o + rw [hd, hsubBd o] + have hs' : subBd (E o) ⊆ Δ := (hsubE o).trans (hEd o).2 + obtain ⟨h₁, h₂, h₃⟩ := hfEl hs' + exact isNaturalOrderFrom_image h₁ h₂ h₃ hφ₀ + have hpb : IsPullbackPerm (range B) (f ∘ α_p) (bd D) S.Ω := by + have hsΔ : subBd Δ ⊆ Δ := by + rw [subBd_eq_discBd_plane ha.isClosedDisc_Δ] + exact discBd_subset _ + refine ⟨?_, ?_⟩ + · ext v + refine ⟨fun hv => ⟨hbarV hv, ?_⟩, ?_⟩ + · rw [hbdD] + exact ⟨_, hφ₁.1 v hv, rfl⟩ + · rintro ⟨hv, hvb⟩ + rw [hsegV] at hv + obtain ⟨o, hvo⟩ := mem_iUnion.mp hv + rw [hbdD] at hvb + obtain ⟨z, hz, hzv⟩ := hvb + have hzeq : z = α_p v := hfinj (hsΔ hz) (hmemΔ o v hvo) hzv + obtain ⟨w, hw, hwv⟩ := hEbd o ⟨hsubE o (hmemE o v hvo), hzeq ▸ hz⟩ + have hwv' : w = v := hinj (mem_iUnion.mpr ⟨o, hw.1⟩) (mem_iUnion.mpr ⟨o, hvo⟩) hwv + exact hwv' ▸ hw.2 + · rw [hbdD] + obtain ⟨h₁, h₂, h₃⟩ := hfEl hsΔ + exact isNaturalOrderFrom_image h₁ h₂ h₃ hφ₁ + exact ⟨range B, α_disc', f ∘ α_p, h3, hbarV, harr, hpb⟩ + +/-! ## 5. Proof of (8.1) -/ + +/-- The forward direction of (8.1), in the language of Graph Minors IX. We follow the proof of +(11.11) of that paper. The core of a least consolidation is 4-connected and has no cross. It has no +tripod, because (2.3) would then give a cross or a 3-separation. So it is rural by (2.4), and +`C₁` of the split may be dropped. -/ +theorem exists_feasibleSegregation_of_no_cross (S : Society α β) + (hno : ∀ P_set : Set (Graph α β), S.IsCrookedTransaction P_set → P_set.ncard ≠ 2) : + ∃ (k : ℕ) (S₀ : Society α β) (S_fam : Fin k → Society α β), + IsFeasibleSegregation S S₀ S_fam ∧ S₀.Ω.bar = ∅ ∧ + ∀ i : Fin k, (S_fam i).Ω.bar.ncard ≤ 3 := by + obtain ⟨D_set, hD, hmin_core, hmin_card⟩ := exists_minimal_consolidation S + let CS := consolidationCoreSociety S D_set hD + have hCS_conn : CS.IsKConnected 4 := GraphMinor.GM09.theorem_11_9_proof S D_set hD hmin_core + have hCS_no_crooked : ∀ Q_set : Set (Graph α (Sym2 α)), + CS.IsCrookedTransaction Q_set → Q_set.ncard ≠ 2 := + no_crooked_transaction_consolidationCoreSociety hD hno + have hsimple : IsSimpleGraph CS.G := isSimpleGraph_consolidationCore S D_set + have hnocross : ¬ ∃ Q₁ Q₂ : Graph α (Sym2 α), CS.IsCross Q₁ Q₂ := by + rintro ⟨Q₁, Q₂, hQ⟩ + obtain ⟨hc, hn⟩ := Society.OmegaPathsCross.isCrookedTransaction_pair CS hQ + exact hCS_no_crooked _ hc hn + have hnotripod : ¬ ∃ T₁ T₂ T₃ : Graph α (Sym2 α), CS.IsTripod T₁ T₂ T₃ := by + rintro ⟨T₁, T₂, T₃, ht⟩ + rcases GraphMinor.GM09.theorem_2_3_proof CS ht with hc | ⟨G₁, G₂, hsep, -⟩ + · exact hnocross hc + · exact hCS_conn 3 (by omega) G₁ G₂ hsep.1 + obtain ⟨Ω₀, h₀, -, hr⟩ := + GraphMinor.GM09.theorem_2_4_proof CS (fun k' hk' => hCS_conn k' (by omega)) hnocross hnotripod + obtain ⟨S₁, N, P, hdec, hT, hΔ, hbar⟩ := exists_core_decomposition_of_eq hsimple hr rfl rfl 0 + obtain ⟨k, S₀, S_fam, hF, hΩ, hfam, -⟩ := + exists_feasible_of_core_decomposition S hD hmin_card hCS_conn hsimple hdec hT (Or.inl hΔ) + exact ⟨k, S₀, S_fam, hF, by rw [hΩ, hbar], hfam⟩ + +/-- **Graph Minors XIV, (8.1)** (page 40): +"A society $(G, \Omega)$ has no cross if and only if there is a 3-segregation $\mathscr{S}$ +of $G$ with $\bar{\Omega} \subseteq V(\mathscr{S})$ and an arrangement $\alpha$ of +$\mathscr{S}$ in a closed disc $\Delta$ with $\Omega = \alpha^{-1}(bd(\Delta))$." -/ +theorem theorem_8_1_proof : Theorem81Statement.{u, v, w} := by + intro D _ _ α β S _ hD + refine ⟨fun hno => ?_, ?_⟩ + · obtain ⟨h⟩ := hD + obtain ⟨k, S₀, S_fam, hF, h₀, hfam⟩ := exists_feasibleSegregation_of_no_cross S hno + exact exists_surface_arrangement S h hF (by simp [h₀]) hfam + · rintro ⟨S_seg, α_disc, α_pt, h3, hbar, harr, hpb⟩ P_set hP hc + obtain ⟨P₁, P₂, hcr⟩ := Society.exists_isCross_of_isCrookedTransaction hP hc + exact not_isCross_of_arrangement S hD h3 hbar harr hpb hcr + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section8a.lean b/LeanPool/GraphMinor/GM14/Section8a.lean new file mode 100644 index 0000000000..34ebe187b3 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section8a.lean @@ -0,0 +1,1261 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.GraphCircuits + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.GM14.Cited +public import LeanPool.GraphMinor.GM14.Adapted +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2a +import LeanPool.GraphMinor.GM09.Section2d +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Section3c +import LeanPool.GraphMinor.GM09.PlanarNests +import LeanPool.GraphMinor.GM09.Bridge + + +/-! +# Graph Minors XIV, Section 8 (Part 1): (8.2) and Claim (1) of (8.4) + +This file formalizes the first part of Section 8 (pages 39–41) of N. Robertson and P. D. Seymour, +*Graph Minors. XIV. Extending an embedding*, J. Combin. Theory Ser. B **65** (1995) 23–50: + +- `empty_isCrookedTransaction`: the empty set of paths `∅` is a crooked transaction in any society. +- `unique_path_of_two_le_inter_bar`: in any transaction `P_set`, at most one path `P ∈ P_set` has + `≥ 2` vertices in `S₀.Ω.bar` when `|S₀.Ω.bar| ≤ 3`. +- `IsCrookedTransaction.mono`: monotonicity of `IsCrookedTransaction` when enlarging the graph of a + society while keeping its cyclic permutation fixed. +- `theorem_8_2`: Graph Minors XIV, (8.2) (page 40), deduced from Graph Minors IX, (10.4) + (`GM09Theorem104Statement`). +- `claim_1_of_8_4`: Claim (1) in the proof of Graph Minors XIV, (8.4) (page 41), showing that + if a society `S₀` in a 3-segregation is replaced by a subgraph `A' ≤ S₀.G` with + `S₀.Ω.bar ⊆ V(A')` that preserves `S₀.Ω.bar`-avoiding paths between pairs of vertices in + `S₀.Ω.bar`, then any crooked transaction of cardinality `≥ π` can be routed through `A'`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Graph GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 + +universe u v w + +/-! ## 1. Basic Lemmas on Transactions and 3-Societies -/ + +/-- The empty set `∅` is a crooked transaction in any society `S`, with +`S.transactionEnds ∅ = ∅`. -/ +theorem empty_isCrookedTransaction {α : Type u} {β : Type v} (S : Society α β) : + S.IsCrookedTransaction ∅ := by + refine ⟨⟨S.Ω.bar, ∅, ⟨fun _ h => False.elim h, fun _ h => False.elim h⟩, ?_, + fun _ h => False.elim h⟩, fun _ h => False.elim h⟩ + exact ⟨Subset.rfl, empty_subset S.Ω.bar, disjoint_empty S.Ω.bar, union_empty S.Ω.bar, + fun _ _ _ _ _ _ hb => False.elim hb⟩ + +/-- The transaction ends of `∅` is `∅`. -/ +@[simp] +theorem transactionEnds_empty {α : Type u} {β : Type v} (S : Society α β) : + S.transactionEnds ∅ = ∅ := by + ext v + simp [Society.transactionEnds] + +/-- Two disjoint sets `X₁, X₂` cannot both intersect a set `B` of cardinality `≤ 3` in `≥ 2` +elements. -/ +theorem not_both_two_le_inter_of_ncard_le_three {α : Type u} {B X₁ X₂ : Set α} + (hB_fin : B.Finite) (hB : B.ncard ≤ 3) (hdisj : Disjoint X₁ X₂) + (h₁ : 2 ≤ (X₁ ∩ B).ncard) (h₂ : 2 ≤ (X₂ ∩ B).ncard) : False := by + have hfin₁ : (X₁ ∩ B).Finite := hB_fin.subset inter_subset_right + have hfin₂ : (X₂ ∩ B).Finite := hB_fin.subset inter_subset_right + have hd : Disjoint (X₁ ∩ B) (X₂ ∩ B) := + hdisj.mono inter_subset_left inter_subset_left + have hsub : (X₁ ∩ B) ∪ (X₂ ∩ B) ⊆ B := + union_subset inter_subset_right inter_subset_right + have hunion : ((X₁ ∩ B) ∪ (X₂ ∩ B)).ncard = (X₁ ∩ B).ncard + (X₂ ∩ B).ncard := + ncard_union_eq hd hfin₁ hfin₂ + have hle : ((X₁ ∩ B) ∪ (X₂ ∩ B)).ncard ≤ B.ncard := + ncard_le_ncard hsub hB_fin + omega + +/-- In any set of pairwise vertex-disjoint paths `P_set`, at most one path `P ∈ P_set` can contain +at least two vertices of a set `B` with `|B| ≤ 3`. -/ +theorem unique_path_of_two_le_inter_bar {α : Type u} {β : Type v} + {S : Society α β} {P_set : Set (Graph α β)} {B : Set α} + (hdisj : S.IsDisjointOmegaPathSet P_set) (hB_fin : B.Finite) (hB : B.ncard ≤ 3) + {P₁ P₂ : Graph α β} (hP₁ : P₁ ∈ P_set) (hP₂ : P₂ ∈ P_set) + (h₁ : 2 ≤ (V(P₁) ∩ B).ncard) (h₂ : 2 ≤ (V(P₂) ∩ B).ncard) : P₁ = P₂ := by + by_contra hne + exact not_both_two_le_inter_of_ncard_le_three hB_fin hB (hdisj.2 hP₁ hP₂ hne) h₁ h₂ + +/-- If `S_sub.G ≤ S_sup.G`, `S_sub.Ω = S_sup.Ω`, and `P ≤ S_sub.G`, then `P` is an `Ω`-path with +ends `u, v` in `S_sup` if and only if it is an `Ω`-path with ends `u, v` in `S_sub`. -/ +theorem isOmegaPathWithEnds_iff_of_le {α : Type u} {β : Type v} + {S_sub S_sup : Society α β} (hle : S_sub.G ≤ S_sup.G) (hΩ : S_sub.Ω = S_sup.Ω) + {P : Graph α β} (hP : P ≤ S_sub.G) {u v : α} : + S_sup.IsOmegaPathWithEnds P u v ↔ S_sub.IsOmegaPathWithEnds P u v := by + unfold Society.IsOmegaPathWithEnds + rw [hΩ] + exact ⟨fun ⟨hp, hrest⟩ => ⟨hp.of_le hP, hrest⟩, + fun ⟨hp, hrest⟩ => ⟨hp.mono hle, hrest⟩⟩ + +/-- Monotonicity of `IsCrookedTransaction` when enlarging the underlying graph of a society while +keeping its cyclic permutation fixed. -/ +theorem IsCrookedTransaction.mono {α : Type u} {β : Type v} + {S_sub S_sup : Society α β} (hle : S_sub.G ≤ S_sup.G) (hΩ : S_sub.Ω = S_sup.Ω) + {P_set : Set (Graph α β)} (hCrooked : S_sub.IsCrookedTransaction P_set) : + S_sup.IsCrookedTransaction P_set ∧ + S_sup.transactionEnds P_set = S_sub.transactionEnds P_set := by + obtain ⟨⟨A, B, ⟨hPaths, hDisj⟩, hFence, hAB⟩, hCross⟩ := hCrooked + have hP_le : ∀ P ∈ P_set, P ≤ S_sub.G := by + intro P hP + obtain ⟨_, _, hp⟩ := hPaths P hP + exact hp.1.le + have hEnds_eq : S_sup.transactionEnds P_set = S_sub.transactionEnds P_set := by + ext x + simp only [Society.transactionEnds, mem_ofPred_eq] + refine exists_congr fun P => and_congr_right fun hP => exists_congr fun b => ?_ + exact isOmegaPathWithEnds_iff_of_le hle hΩ (hP_le P hP) + refine ⟨⟨⟨A, B, ⟨fun P hP => ?_, hDisj⟩, hΩ ▸ hFence, fun P hP => ?_⟩, ?_⟩, hEnds_eq⟩ + · obtain ⟨a, b, hp⟩ := hPaths P hP + exact ⟨a, b, (isOmegaPathWithEnds_iff_of_le hle hΩ (hP_le P hP)).mpr hp⟩ + · obtain ⟨a, ha, b, hb, hp⟩ := hAB P hP + exact ⟨a, ha, b, hb, (isOmegaPathWithEnds_iff_of_le hle hΩ (hP_le P hP)).mpr hp⟩ + · intro P hP + rw [Society.IsPeripheralIn, hEnds_eq, ← hΩ] + intro ⟨_, a, b, hp, hdisj⟩ + have hp_sub := (isOmegaPathWithEnds_iff_of_le hle hΩ (hP_le P hP)).mp hp + exact hCross P hP ⟨hP, a, b, hp_sub, hdisj⟩ + +/-- If `P` is an `Ω`-path with ends `a, b` in `S` and `pathInternalVerts S.G P` is disjoint from +`S.Ω.bar`, then `V(P) ∩ S.Ω.bar = {a, b}`. -/ +theorem inter_bar_eq_pair_of_disjoint_pathInternalVerts {α : Type u} {β : Type v} + {S : Society α β} {P : Graph α β} {a b : α} + (hP : S.IsOmegaPathWithEnds P a b) + (hdisj : Disjoint (pathInternalVerts S.G P) S.Ω.bar) : + V(P) ∩ S.Ω.bar = {a, b} := by + rw [hP.1.pathInternalVerts_eq] at hdisj + apply subset_antisymm + · rintro x ⟨hxP, hxBar⟩ + by_contra hne + exact disjoint_left.mp hdisj ⟨hxP, hne⟩ hxBar + · rintro x (rfl | rfl) + · exact ⟨hP.1.left_mem, hP.2.2.1⟩ + · exact ⟨hP.1.right_mem, hP.2.2.2⟩ + +/-! ## 2. Proof of (8.2) (page 40) -/ + +/-- Graph Minors XIV, (8.2) (page 40): +"Let $\pi \ge 0$ be an integer with $\pi \ne 1, 3$, and let $(G, \Omega_1)$ be the +composition of a society $(G_2, \Omega_2)$ with a rural neighbourhood $(G_1, \Omega_1, +\Omega_2)$ of breadth $\ge \pi + 5$. Suppose that $X \subseteq \bar{\Omega}_1$ and there are +$2\pi + 8$ mutually disjoint paths of $G_1$, each from $X$ to $\bar{\Omega}_2$ with no +vertex in $\bar{\Omega}_1$ except its initial vertex. If there is a crooked transaction +$\mathscr{P}$ in $(G, \Omega_1)$ with cardinality $\ge \pi$, then $\mathscr{P}$ may be +chosen so that in addition $V(\mathscr{P}) \subseteq X$ and no member of $\mathscr{P}$ has +any internal vertex in $\bar{\Omega}_1$." -/ +theorem theorem_8_2_proof + {α : Type u} {β : Type v} + (pi : ℕ) (S_comp S₂ : Society α β) (N : Neighborhood α β) (X : Set α) + (P : Fin (2 * pi + 8) → Graph α β) (x y : Fin (2 * pi + 8) → α) + (P_set : Set (Graph α β)) + (hpi1 : pi ≠ 1) (hpi3 : pi ≠ 3) + (hcomp : S_comp.IsComposition S₂ N) + (hbreadth : N.HasBreadthGe (pi + 5)) + (hX : X ⊆ N.Ω.bar) + (hP_path : ∀ i, IsFromToPathWithEnds N.G (P i) N.Ω.bar N.Ω₀.bar (x i) (y i) ∧ x i ∈ X) + (hP_disj : Pairwise (fun i j => Disjoint V(P i) V(P j))) + (hCrooked : S_comp.IsCrookedTransaction P_set) + (hcard : pi ≤ P_set.ncard) : + ∃ P_set' : Set (Graph α β), + S_comp.IsCrookedTransaction P_set' ∧ + pi ≤ P_set'.ncard ∧ + S_comp.transactionEnds P_set' ⊆ X ∧ + ∀ Q ∈ P_set', Disjoint (pathInternalVerts S_comp.G Q) S_comp.Ω.bar := by + by_cases hpi0 : pi = 0 + · subst hpi0 + refine ⟨∅, empty_isCrookedTransaction S_comp, Nat.zero_le _, ?_, fun _ h => False.elim h⟩ + rw [transactionEnds_empty] + exact empty_subset X + · have hpi2 : 2 ≤ pi := by omega + rcases hbreadth with ⟨P_pres, hbreadth_ge⟩ + have hRural : N.IsRural := + ⟨P_pres.Γ, P_pres.Δ, P_pres.Δ₀, P_pres.isClosedDisc_Δ, P_pres.Δ₀_subset_Δ, + P_pres.U_subset, P_pres.mem_bd_Δ_iff, P_pres.mem_bd_Δ₀_iff, + P_pres.agrees_Δ, P_pres.agrees_Δ₀⟩ + let X' : Set α := range x + have hX'_sub : X' ⊆ X := by + rintro _ ⟨i, rfl⟩ + exact (hP_path i).2 + have hx_inj : Injective x := by + intro i j hxy + by_contra hne + have hxi : x i ∈ V(P i) := (hP_path i).1.1.left_mem + have hxj : x i ∈ V(P j) := hxy ▸ (hP_path j).1.1.left_mem + exact disjoint_left.mp (hP_disj hne) hxi hxj + have hX'_card : X'.ncard = 2 * pi + 8 := by + rw [ncard_range_of_injective hx_inj, Nat.card_eq_fintype_card, Fintype.card_fin] + have hLinked : N.IsLinked X' := by + refine ⟨hX'_sub.trans hX, fun k => P (Fin.cast hX'_card k), fun k => ?_, fun i j hne => ?_⟩ + · let i := Fin.cast hX'_card k + have hy_bar : y i ∈ N.Ω₀.bar := by + have : y i ∈ V(P i) ∩ N.Ω₀.bar := by + rw [(hP_path i).1.2.2] + exact mem_singleton (y i) + exact this.2 + exact ⟨x i, mem_range_self i, y i, hy_bar, (hP_path i).1⟩ + · have hne' : Fin.cast hX'_card i ≠ Fin.cast hX'_card j := + fun h => hne ((Fin.cast_injective hX'_card) h) + exact hP_disj hne' + obtain ⟨P_set', hCr', hcard', hEnds', hInt'⟩ := + GM09.gm14_theorem_10_4 S_comp S₂ N pi X' P_set hpi2 hpi3 hRural ⟨P_pres, hbreadth_ge⟩ hLinked + (Nat.le_of_eq hX'_card.symm) hcomp hCrooked hcard + exact ⟨P_set', hCr', hcard', hEnds'.trans hX'_sub, hInt'⟩ + +/-! ## 3. Claim (1) of (8.4): Subgraph Replacement in a 3-Segregation (page 41) -/ + +/-- In a simple walk `W` from `a` to `b`, if an edge `f ∈ W.edges` links `a` and `b`, then `W` has +support `[a, b]` and edges `[f]`. -/ +private theorem walk_eq_single_edge_of_isLink_ends {α : Type u} {β : Type v} + {G : Graph α β} {a b : α} {W : GraphWalk G a b} (hW : W.IsSimple) + {f : β} (hf : f ∈ W.edges) (hlink : G.IsLink f a b) : + W.support = [a, b] ∧ W.edges = [f] := by + cases W with + | nil _ => simp [GraphWalk.edges] at hf + | @cons _ y _ e hxy W' => + cases W' with + | nil _ => + simp only [GraphWalk.edges, List.mem_singleton] at hf + subst hf + exact ⟨rfl, rfl⟩ + | @cons _ z _ e₂ hyz W'' => + have hnd : (a :: y :: W''.support).Nodup := hW + have ha_not : a ∉ y :: W''.support := (List.nodup_cons.mp hnd).1 + have hy_not : y ∉ W''.support := (List.nodup_cons.mp (List.nodup_cons.mp hnd).2).1 + rcases List.mem_cons.mp hf with rfl | hf' + · have hyb : y = b := by + rcases hxy.symm.left_eq_or_eq hlink.symm with rfl | rfl + · rfl + · exact False.elim (ha_not List.mem_cons_self) + exact False.elim (hy_not (hyb ▸ W''.end_mem_support)) + · have ha_mem : a ∈ (GraphWalk.cons hyz W'').support := + (GraphWalk.cons hyz W'').left_mem_support_of_mem_edges hf' hlink + exact False.elim (ha_not ha_mem) + +/-- Every walk in `G` from `u ∈ V(B)` to `v ∈ V(A)` in a separation `(A, B)` of `G` with +`V(A) ∩ V(B) = Ω_bar` meets `Ω_bar`. -/ +theorem walk_inter_bar_of_isGraphSeparation {α : Type u} {β : Type v} + {G A B : Graph α β} {Ω_bar : Set α} + (hSep : IsGraphSeparation G A B) (hInter : V(A) ∩ V(B) = Ω_bar) + {u v : α} (R : GraphWalk G u v) (huB : u ∈ V(B)) (hvA : v ∈ V(A)) : + ∃ w ∈ R.support, w ∈ Ω_bar := by + obtain ⟨w, hw, hwAB⟩ := exists_mem_inter_of_graphWalk (IsGraphSeparation.symm hSep) R huB hvA + exact ⟨w, hw, hInter ▸ ⟨hwAB.2, hwAB.1⟩⟩ + +/-- Any path `R` in `G` starting at `s ∈ V(B)` with `V(R) ∩ Ω_bar ⊆ {t}` lies in `B`. -/ +theorem path_le_right_of_inter_bar_sub_singleton {α : Type u} {β : Type v} + {G A B R : Graph α β} {Ω_bar : Set α} {s t : α} + (hSep : IsGraphSeparation G A B) (hInter : V(A) ∩ V(B) = Ω_bar) + (hR : IsGraphPathWithEnds G R s t) (hsB : s ∈ V(B)) (hR_bar : V(R) ∩ Ω_bar ⊆ {t}) : + R ≤ B := by + have hAG : A ≤ G := hSep.1 + have hBG : B ≤ G := hSep.2.1 + have hRG : R ≤ G := hR.le + obtain ⟨_, WR, hWR, hVR, hER⟩ := hR + have hV_sub : V(R) ⊆ V(B) := by + intro x hx + have hxW : x ∈ WR.support := by + have hx' := hx + rwa [hVR, mem_ofPred_eq] at hx' + by_contra hxB + have hxG : x ∈ V(G) := hRG.vertexSet_mono hx + have hxA : x ∈ V(A) := by + have hxAB : x ∈ V(A) ∪ V(B) := hSep.2.2.1.symm ▸ hxG + exact hxAB.resolve_right hxB + obtain ⟨W_pre, W_suf, hW_eq⟩ := WR.exists_append_of_mem hxW + obtain ⟨W_pre_G, hs_pre, _⟩ := exists_walk_up_of_le hRG W_pre + obtain ⟨w, hw_pre_G, hwBar⟩ := walk_inter_bar_of_isGraphSeparation hSep hInter W_pre_G hsB hxA + have hw_pre : w ∈ W_pre.support := hs_pre ▸ hw_pre_G + have hwR : w ∈ V(R) := by + rw [hVR, hW_eq, mem_ofPred_eq, GraphWalk.mem_support_append] + exact Or.inl hw_pre + have hwt : w = t := mem_singleton_iff.mp (hR_bar ⟨hwR, hwBar⟩) + subst hwt + have hnd : (W_pre.support ++ W_suf.support.tail).Nodup := by + have h' : (W_pre.append W_suf).support.Nodup := hW_eq ▸ hWR + rwa [GraphWalk.support_append] at h' + have hx_ne_w : x ≠ w := fun hxw => hxB (hxw ▸ (hInter ▸ hwBar).2) + have hw_tail : w ∈ W_suf.support.tail := by + have hw_end : w ∈ W_suf.support := W_suf.end_mem_support + rw [W_suf.support_eq_cons] at hw_end + rcases List.mem_cons.mp hw_end with hwx | htail + · exact False.elim (hx_ne_w hwx.symm) + · exact htail + exact (List.nodup_append.mp hnd).2.2 w hw_pre w hw_tail rfl + rw [(Compatible.of_le_le hRG hBG).le_iff] + refine ⟨hV_sub, fun e he => ?_⟩ + by_contra heB + have heG : e ∈ E(G) := hRG.edgeSet_mono he + have heA : e ∈ E(A) := (hSep.2.2.2.1.symm ▸ heG).resolve_right heB + obtain ⟨x, y, hxyR⟩ := R.exists_isLink_of_mem_edgeSet he + have hxyA : A.IsLink e x y := (hAG.isLink_iff heA).mpr (hxyR.mono hRG) + have hxBar : x ∈ Ω_bar := hInter ▸ ⟨hxyA.left_mem, hV_sub hxyR.left_mem⟩ + have hyBar : y ∈ Ω_bar := hInter ▸ ⟨hxyA.right_mem, hV_sub hxyR.right_mem⟩ + have hxt : x = t := mem_singleton_iff.mp (hR_bar ⟨hxyR.left_mem, hxBar⟩) + have hyt : y = t := mem_singleton_iff.mp (hR_bar ⟨hxyR.right_mem, hyBar⟩) + have hloop : G.IsLink e t t := by + have hxyG : G.IsLink e x y := hxyR.mono hRG + rwa [hxt, hyt] at hxyG + exact IsGraphPathWithEnds.not_isLoopAt ⟨hRG, WR, hWR, hVR, hER⟩ he t hloop + +/-- If `P` is a path in `G` with ends `a, b ∈ V(B)` such that `¬ (P ≤ B)`, then `V(P) ∩ Ω_bar` has +at least 2 vertices. -/ +theorem two_le_ncard_inter_bar_of_not_le_right {α : Type u} {β : Type v} + {G A B P : Graph α β} {Ω_bar : Set α} {a b : α} + (hSep : IsGraphSeparation G A B) (hInter : V(A) ∩ V(B) = Ω_bar) + (hBar_fin : Ω_bar.Finite) (hP : IsGraphPathWithEnds G P a b) + (haB : a ∈ V(B)) (hbB : b ∈ V(B)) (hnotB : ¬ (P ≤ B)) : + 2 ≤ (V(P) ∩ Ω_bar).ncard := by + by_contra! hlt + have hfin : (V(P) ∩ Ω_bar).Finite := hBar_fin.subset inter_subset_right + rcases (V(P) ∩ Ω_bar).eq_empty_or_nonempty with hemp | ⟨t, htP, htBar⟩ + · have hsub : V(P) ∩ Ω_bar ⊆ {b} := by rw [hemp]; exact empty_subset _ + exact hnotB (path_le_right_of_inter_bar_sub_singleton hSep hInter hP haB hsub) + · have hsub : V(P) ∩ Ω_bar ⊆ {t} := by + intro z hz + rw [mem_singleton_iff] + by_contra hzt + have hpair : ({z, t} : Set α) ⊆ V(P) ∩ Ω_bar := by + rintro w (rfl | rfl) + · exact hz + · exact ⟨htP, htBar⟩ + have h2 : 2 ≤ (V(P) ∩ Ω_bar).ncard := by + rw [← ncard_pair hzt] + exact ncard_le_ncard hpair hfin + omega + obtain ⟨P₁, P₂, hP₁P, hP₂P, hP₁, hP₂, hunion, _, _⟩ := hP.exists_split_at htP + have hP₁B : P₁ ≤ B := path_le_right_of_inter_bar_sub_singleton hSep hInter + (hP₁.mono hP.le) haB ((inter_subset_inter_left _ hP₁P.vertexSet_mono).trans hsub) + have hP₂B : P₂ ≤ B := path_le_right_of_inter_bar_sub_singleton hSep hInter + (hP₂.symm.mono hP.le) hbB ((inter_subset_inter_left _ hP₂P.vertexSet_mono).trans hsub) + have hPB : P ≤ B := by + rw [(Compatible.of_le_le hP.le hSep.2.1).le_iff] + have hVP : V(P) = V(P₁) ∪ V(P₂) := by + rw [← vertexSet_subgraphUnion P P₁ P₂, hunion] + have hEP : E(P) = E(P₁) ∪ E(P₂) := by + rw [← edgeSet_subgraphUnion hP₁P hP₂P, hunion] + rw [hVP, hEP] + exact ⟨union_subset hP₁B.vertexSet_mono hP₂B.vertexSet_mono, + union_subset hP₁B.edgeSet_mono hP₂B.edgeSet_mono⟩ + exact hnotB hPB + +/-- If `P` is a path in `G` with ends `a, b ∈ V(B)` such that `¬ (P ≤ B)` and `V(P) ∩ Ω_bar ⊆ {a, +b}`, +then `P ≤ A`, `a ∈ Ω_bar`, `b ∈ Ω_bar`, and `a ≠ b`. -/ +private theorem path_le_left_of_not_le_right_of_inter_sub_ends {α : Type u} {β : Type v} + {G A B P : Graph α β} {Ω_bar : Set α} {a b : α} + (hSep : IsGraphSeparation G A B) (hInter : V(A) ∩ V(B) = Ω_bar) + (hP : IsGraphPathWithEnds G P a b) (haB : a ∈ V(B)) (hbB : b ∈ V(B)) + (hnotB : ¬ (P ≤ B)) (hBar_sub : V(P) ∩ Ω_bar ⊆ {a, b}) : + P ≤ A ∧ a ∈ Ω_bar ∧ b ∈ Ω_bar ∧ a ≠ b := by + have hAG : A ≤ G := hSep.1 + have hBG : B ≤ G := hSep.2.1 + have hPG : P ≤ G := hP.le + have hSep_symm : IsGraphSeparation G B A := IsGraphSeparation.symm hSep + have hInter_symm : V(B) ∩ V(A) = Ω_bar := inter_comm V(B) V(A) ▸ hInter + by_cases hVB : V(P) ⊆ V(B) + · have hexE : ∃ f ∈ E(P), f ∉ E(B) := by + by_contra! hEB + exact hnotB ((Compatible.of_le_le hPG hBG).le_iff.mpr ⟨hVB, hEB⟩) + obtain ⟨f, hfP, hfB⟩ := hexE + have hfG : f ∈ E(G) := hPG.edgeSet_mono hfP + have hfA : f ∈ E(A) := (hSep.2.2.2.1.symm ▸ hfG).resolve_right hfB + obtain ⟨u, v, huvP⟩ := P.exists_isLink_of_mem_edgeSet hfP + have huvA : A.IsLink f u v := (hAG.isLink_iff hfA).mpr (huvP.mono hPG) + have huBar : u ∈ Ω_bar := hInter ▸ ⟨huvA.left_mem, hVB huvP.left_mem⟩ + have hvBar : v ∈ Ω_bar := hInter ▸ ⟨huvA.right_mem, hVB huvP.right_mem⟩ + have hu_ab : u = a ∨ u = b := + mem_insert_iff.mp (hBar_sub ⟨huvP.left_mem, huBar⟩) + have hv_ab : v = a ∨ v = b := + mem_insert_iff.mp (hBar_sub ⟨huvP.right_mem, hvBar⟩) + have huv_ne : u ≠ v := by + intro huv_eq + have hloop : G.IsLink f u u := by + have huvG : G.IsLink f u v := huvP.mono hPG + rwa [← huv_eq] at huvG + exact IsGraphPathWithEnds.not_isLoopAt hP hfP u hloop + have hlink_ab : P.IsLink f a b ∧ a ∈ Ω_bar ∧ b ∈ Ω_bar ∧ a ≠ b := by + rcases hu_ab with rfl | rfl <;> rcases hv_ab with rfl | rfl + · exact False.elim (huv_ne rfl) + · exact ⟨huvP, huBar, hvBar, huv_ne⟩ + · exact ⟨huvP.symm, hvBar, huBar, huv_ne.symm⟩ + · exact False.elim (huv_ne rfl) + obtain ⟨_, W, hW, hVP, hEP⟩ := hP + have hfW : f ∈ W.edges := by + have hfP' := hfP + rwa [hEP, mem_ofPred_eq] at hfP' + obtain ⟨hsupp, hedges⟩ := walk_eq_single_edge_of_isLink_ends hW hfW hlink_ab.1 + have hPA : P ≤ A := by + rw [(Compatible.of_le_le hPG hAG).le_iff] + refine ⟨?_, ?_⟩ + · intro x hx + rw [hVP, mem_ofPred_eq, hsupp] at hx + rcases List.mem_cons.mp hx with rfl | hx' + · exact (hInter ▸ hlink_ab.2.1).1 + · rcases List.mem_singleton.mp hx' with rfl + exact (hInter ▸ hlink_ab.2.2.1).1 + · intro e he + rw [hEP, mem_ofPred_eq, hedges] at he + rcases List.mem_singleton.mp he with rfl + exact hfA + exact ⟨hPA, hlink_ab.2.1, hlink_ab.2.2.1, hlink_ab.2.2.2⟩ + · obtain ⟨y, hyP, hyB⟩ := not_subset.mp hVB + have hyA : y ∈ V(A) := (hSep.2.2.1.symm ▸ hPG.vertexSet_mono hyP).resolve_right hyB + have hya : y ≠ a := fun h => hyB (h ▸ haB) + have hyb : y ≠ b := fun h => hyB (h ▸ hbB) + obtain ⟨P₁, P₂, hP₁P, hP₂P, hP₁, hP₂, hunion, hinter, _⟩ := hP.exists_split_at hyP + have hb_not_P₁ : b ∉ V(P₁) := fun hb₁ => by + have : b ∈ V(P₁) ∩ V(P₂) := ⟨hb₁, hP₂.right_mem⟩ + rw [hinter, mem_singleton_iff] at this + exact hyb this.symm + have ha_not_P₂ : a ∉ V(P₂) := fun ha₂ => by + have : a ∈ V(P₁) ∩ V(P₂) := ⟨hP₁.left_mem, ha₂⟩ + rw [hinter, mem_singleton_iff] at this + exact hya this.symm + have hP₁_bar : V(P₁) ∩ Ω_bar ⊆ {a} := by + intro z hz + have hz_ab := hBar_sub ⟨hP₁P.vertexSet_mono hz.1, hz.2⟩ + rcases mem_insert_iff.mp hz_ab with rfl | hzb + · rfl + · exact False.elim (hb_not_P₁ (mem_singleton_iff.mp hzb ▸ hz.1)) + have hP₂_bar : V(P₂) ∩ Ω_bar ⊆ {b} := by + intro z hz + have hz_ab := hBar_sub ⟨hP₂P.vertexSet_mono hz.1, hz.2⟩ + rcases mem_insert_iff.mp hz_ab with rfl | hzb + · exact False.elim (ha_not_P₂ hz.1) + · exact hzb + have haBar : a ∈ Ω_bar := by + obtain ⟨w, hwP₁, hwAB⟩ := + exists_mem_inter_of_isGraphPathWithEnds hSep_symm (hP₁.mono hPG) haB hyA + have hwBar : w ∈ Ω_bar := hInter ▸ ⟨hwAB.2, hwAB.1⟩ + have hwa : w = a := mem_singleton_iff.mp (hP₁_bar ⟨hwP₁, hwBar⟩) + exact hwa ▸ hwBar + have hbBar : b ∈ Ω_bar := by + obtain ⟨w, hwP₂, hwAB⟩ := + exists_mem_inter_of_isGraphPathWithEnds hSep_symm (hP₂.symm.mono hPG) hbB hyA + have hwBar : w ∈ Ω_bar := hInter ▸ ⟨hwAB.2, hwAB.1⟩ + have hwb : w = b := mem_singleton_iff.mp (hP₂_bar ⟨hwP₂, hwBar⟩) + exact hwb ▸ hwBar + have hab : a ≠ b := fun hab_eq => hb_not_P₁ (hab_eq ▸ hP₁.left_mem) + have hP₁A : P₁ ≤ A := + path_le_right_of_inter_bar_sub_singleton hSep_symm hInter_symm + (hP₁.symm.mono hPG) hyA hP₁_bar + have hP₂A : P₂ ≤ A := + path_le_right_of_inter_bar_sub_singleton hSep_symm hInter_symm + (hP₂.mono hPG) hyA hP₂_bar + have hPA : P ≤ A := by + rw [(Compatible.of_le_le hPG hAG).le_iff] + have hVP : V(P) = V(P₁) ∪ V(P₂) := by + rw [← vertexSet_subgraphUnion P P₁ P₂, hunion] + have hEP : E(P) = E(P₁) ∪ E(P₂) := by + rw [← edgeSet_subgraphUnion hP₁P hP₂P, hunion] + rw [hVP, hEP] + exact ⟨union_subset hP₁A.vertexSet_mono hP₂A.vertexSet_mono, + union_subset hP₁A.edgeSet_mono hP₂A.edgeSet_mono⟩ + exact ⟨hPA, haBar, hbBar, hab⟩ + +/-- If `(A, B)` is a separation of `G` with `V(A) ∩ V(B) = Ω_bar`, `A' ≤ A` with `Ω_bar ⊆ V(A')`, +and `P` is a path in `G` with ends `a, b ∈ V(B)`, then under the chord-replacement hypothesis +`hRepl`, there is a path `P'` in `subgraphUnion G A' B` with ends `a, b` such that +`V(P') ⊆ V(P) ∪ V(A')` and `V(P') ∩ V(B) ⊆ V(P) ∩ V(B)`. -/ +theorem exists_chord_endpoints_of_not_le {α : Type u} {β : Type v} + {G A B A' P : Graph α β} {Ω_bar : Set α} {a b : α} + (hSep : IsGraphSeparation G A B) (hInter : V(A) ∩ V(B) = Ω_bar) + (hA'_le : A' ≤ A) + (hP : IsGraphPathWithEnds G P a b) (haB : a ∈ V(B)) (hbB : b ∈ V(B)) + (hRepl : ∀ u ∈ Ω_bar, ∀ v ∈ Ω_bar, u ≠ v → + (∃ Q : Graph α β, IsGraphPathWithEnds A Q u v ∧ V(Q) ∩ Ω_bar = {u, v}) → + ∃ Q' : Graph α β, IsGraphPathWithEnds A' Q' u v ∧ V(Q') ∩ Ω_bar = {u, v}) : + ∃ P' : Graph α β, + IsGraphPathWithEnds (subgraphUnion G A' B) P' a b ∧ + V(P') ⊆ V(P) ∪ V(A') ∧ + V(P') ∩ V(B) ⊆ V(P) ∩ V(B) := by + classical + have hAG : A ≤ G := hSep.1 + have hBG : B ≤ G := hSep.2.1 + have hA'G : A' ≤ G := hA'_le.trans hAG + let U := subgraphUnion G A' B + have hA'U : A' ≤ U := le_subgraphUnion_left hA'G hBG + have hBU : B ≤ U := le_subgraphUnion_right hA'G hBG + have hind : ∀ (n : ℕ) {a₁ b₁ : α} {R : Graph α β}, + IsGraphPathWithEnds G R a₁ b₁ → V(R).ncard = n → a₁ ∈ V(B) → b₁ ∈ V(B) → + ∃ R' : Graph α β, + IsGraphPathWithEnds U R' a₁ b₁ ∧ + V(R') ⊆ V(R) ∪ V(A') ∧ + V(R') ∩ V(B) ⊆ V(R) ∩ V(B) := by + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro a₁ b₁ R hR hcard ha₁B hb₁B + by_cases hRB : R ≤ B + · exact ⟨R, (hR.of_le hRB).mono hBU, subset_union_left, Subset.rfl⟩ + · by_cases hInt : ∃ w ∈ V(R) ∩ Ω_bar, w ≠ a₁ ∧ w ≠ b₁ + · obtain ⟨w, ⟨hwR, hwBar⟩, hwa₁, hwb₁⟩ := hInt + have hwB : w ∈ V(B) := (hInter ▸ hwBar).2 + obtain ⟨R₁, R₂, hR₁R, hR₂R, hR₁, hR₂, hunion, hinter, _⟩ := hR.exists_split_at hwR + have hfin : V(R).Finite := hR.vertexSet_finite + have hb₁_not_R₁ : b₁ ∉ V(R₁) := fun hb₁ => by + have : b₁ ∈ V(R₁) ∩ V(R₂) := ⟨hb₁, hR₂.right_mem⟩ + rw [hinter, mem_singleton_iff] at this + exact hwb₁ this.symm + have ha₁_not_R₂ : a₁ ∉ V(R₂) := fun ha₁ => by + have : a₁ ∈ V(R₁) ∩ V(R₂) := ⟨hR₁.left_mem, ha₁⟩ + rw [hinter, mem_singleton_iff] at this + exact hwa₁ this.symm + have hlt₁ : V(R₁).ncard < n := by + rw [← hcard] + exact Set.ncard_lt_ncard + ⟨hR₁R.vertexSet_mono, fun hsub => hb₁_not_R₁ (hsub hR.right_mem)⟩ hfin + have hlt₂ : V(R₂).ncard < n := by + rw [← hcard] + exact Set.ncard_lt_ncard + ⟨hR₂R.vertexSet_mono, fun hsub => ha₁_not_R₂ (hsub hR.left_mem)⟩ hfin + obtain ⟨R₁', hR₁', hV₁_sub, hV₁_B⟩ := + ih V(R₁).ncard hlt₁ (hR₁.mono hR.le) rfl ha₁B hwB + obtain ⟨R₂', hR₂', hV₂_sub, hV₂_B⟩ := + ih V(R₂).ncard hlt₂ (hR₂.mono hR.le) rfl hwB hb₁B + obtain ⟨hR₁'U, W₁, _, hVR₁', _⟩ := hR₁' + obtain ⟨hR₂'U, W₂, _, hVR₂', _⟩ := hR₂' + obtain ⟨W₁', hs₁, _⟩ := exists_walk_up_of_le hR₁'U W₁ + obtain ⟨W₂', hs₂, _⟩ := exists_walk_up_of_le hR₂'U W₂ + obtain ⟨W₀, hW₀, hsupp₀, _⟩ := exists_isSimple_subwalk (W₁'.append W₂') + let R' := walkSubgraph W₀ + have hR'_path : IsGraphPathWithEnds U R' a₁ b₁ := isGraphPathWithEnds_walkSubgraph hW₀ + have hVR'_sub : V(R') ⊆ V(R₁') ∪ V(R₂') := by + intro x hx + rw [vertexSet_walkSubgraph, mem_ofPred_eq] at hx + have hx_app := hsupp₀ x hx + rw [GraphWalk.mem_support_append, hs₁, hs₂] at hx_app + rcases hx_app with hx₁ | hx₂ + · exact Or.inl (by rw [hVR₁', mem_ofPred_eq]; exact hx₁) + · exact Or.inr (by rw [hVR₂', mem_ofPred_eq]; exact hx₂) + refine ⟨R', hR'_path, ?_, ?_⟩ + · intro x hx + rcases hVR'_sub hx with hx₁ | hx₂ + · rcases hV₁_sub hx₁ with hxR₁ | hxA' + · exact Or.inl (hR₁R.vertexSet_mono hxR₁) + · exact Or.inr hxA' + · rcases hV₂_sub hx₂ with hxR₂ | hxA' + · exact Or.inl (hR₂R.vertexSet_mono hxR₂) + · exact Or.inr hxA' + · intro x ⟨hxR', hxB⟩ + rcases hVR'_sub hxR' with hx₁ | hx₂ + · exact ⟨hR₁R.vertexSet_mono (hV₁_B ⟨hx₁, hxB⟩).1, hxB⟩ + · exact ⟨hR₂R.vertexSet_mono (hV₂_B ⟨hx₂, hxB⟩).1, hxB⟩ + · have hBar_sub : V(R) ∩ Ω_bar ⊆ {a₁, b₁} := by + intro w hw + simp only [mem_insert_iff, mem_singleton_iff] + by_contra! hne + exact hInt ⟨w, hw, hne.1, hne.2⟩ + obtain ⟨hRA, ha₁Bar, hb₁Bar, hab₁⟩ := + path_le_left_of_not_le_right_of_inter_sub_ends hSep hInter hR ha₁B hb₁B hRB hBar_sub + have hR_bar : V(R) ∩ Ω_bar = {a₁, b₁} := by + refine Subset.antisymm hBar_sub ?_ + rintro w (rfl | rfl) + · exact ⟨hR.left_mem, ha₁Bar⟩ + · exact ⟨hR.right_mem, hb₁Bar⟩ + obtain ⟨Q', hQ', hQ'_bar⟩ := + hRepl a₁ ha₁Bar b₁ hb₁Bar hab₁ ⟨R, hR.of_le hRA, hR_bar⟩ + refine ⟨Q', hQ'.mono hA'U, ?_, ?_⟩ + · exact hQ'.le.vertexSet_mono.trans subset_union_right + · intro x ⟨hxQ', hxB⟩ + have hxA : x ∈ V(A) := hA'_le.vertexSet_mono (hQ'.le.vertexSet_mono hxQ') + have hxBar : x ∈ Ω_bar := hInter ▸ ⟨hxA, hxB⟩ + have hx_ab : x ∈ ({a₁, b₁} : Set α) := hQ'_bar ▸ ⟨hxQ', hxBar⟩ + rw [← hR_bar] at hx_ab + exact ⟨hx_ab.1, hxB⟩ + exact hind V(P).ncard hP rfl haB hbB + +/-- **Claim (1) of Graph Minors XIV, (8.4)** (page 41): +If `(A, B)` is a separation of `S₁.G` with `V(A) ∩ V(B) = Ω_bar` (`|Ω_bar| ≤ 3`), `A' ≤ A` with +`Ω_bar ⊆ V(A')` preserves the existence of paths between pairs of vertices in `Ω_bar`, and +`S₁.Ω.bar ⊆ V(B)`, then any crooked transaction of cardinality `≥ pi` in `S₁` yields a crooked +transaction of cardinality `≥ pi` in `S₁'` (where `S₁'.G = subgraphUnion S₁.G A' B` and +`S₁'.Ω = S₁.Ω`). -/ +theorem claim_1_of_8_4 {α : Type u} {β : Type v} + {S₁ S₁' : Society α β} {A B A' : Graph α β} {Ω_bar : Set α} + (hSep : IsGraphSeparation S₁.G A B) (hInter : V(A) ∩ V(B) = Ω_bar) + (hBar_fin : Ω_bar.Finite) (hBar_card : Ω_bar.ncard ≤ 3) + (hA'_le : A' ≤ A) + (hRepl : ∀ u ∈ Ω_bar, ∀ v ∈ Ω_bar, u ≠ v → + (∃ Q : Graph α β, IsGraphPathWithEnds A Q u v ∧ V(Q) ∩ Ω_bar = {u, v}) → + ∃ Q' : Graph α β, IsGraphPathWithEnds A' Q' u v ∧ V(Q') ∩ Ω_bar = {u, v}) + (hΩ₁_B : S₁.Ω.bar ⊆ V(B)) + (hS₁'_G : S₁'.G = subgraphUnion S₁.G A' B) (hS₁'_Ω : S₁'.Ω = S₁.Ω) + {P_set : Set (Graph α β)} {pi : ℕ} + (hCrooked : S₁.IsCrookedTransaction P_set) + (hcard : pi ≤ P_set.ncard) : + ∃ P_set' : Set (Graph α β), + S₁'.IsCrookedTransaction P_set' ∧ + pi ≤ P_set'.ncard := by + classical + have hAG : A ≤ S₁.G := hSep.1 + have hBG : B ≤ S₁.G := hSep.2.1 + have hA'G : A' ≤ S₁.G := hA'_le.trans hAG + have hUG : S₁'.G ≤ S₁.G := hS₁'_G ▸ subgraphUnion_le hA'G hBG + have hBU : B ≤ S₁'.G := hS₁'_G ▸ le_subgraphUnion_right hA'G hBG + obtain ⟨⟨A_f, B_f, ⟨hPaths, hDisj⟩, hFence, hAB_f⟩, hCross⟩ := hCrooked + by_cases hall : ∀ P ∈ P_set, P ≤ S₁'.G + · refine ⟨P_set, ?_, hcard⟩ + have hEnds_eq : S₁'.transactionEnds P_set = S₁.transactionEnds P_set := by + ext x + simp only [Society.transactionEnds, mem_ofPred_eq] + refine exists_congr fun P => and_congr_right fun hP => exists_congr fun b => ?_ + exact (isOmegaPathWithEnds_iff_of_le hUG hS₁'_Ω (hall P hP)).symm + refine ⟨⟨A_f, B_f, ⟨fun P hP => ?_, hDisj⟩, hS₁'_Ω ▸ hFence, fun P hP => ?_⟩, ?_⟩ + · obtain ⟨a, b, hp⟩ := hPaths P hP + exact ⟨a, b, (isOmegaPathWithEnds_iff_of_le hUG hS₁'_Ω (hall P hP)).mp hp⟩ + · obtain ⟨a, ha, b, hb, hp⟩ := hAB_f P hP + exact ⟨a, ha, b, hb, (isOmegaPathWithEnds_iff_of_le hUG hS₁'_Ω (hall P hP)).mp hp⟩ + · intro P hP ⟨_, a, b, hp, hdisj⟩ + have hp_sup := (isOmegaPathWithEnds_iff_of_le hUG hS₁'_Ω (hall P hP)).mpr hp + exact hCross P hP ⟨hP, a, b, hp_sup, hEnds_eq ▸ hS₁'_Ω ▸ hdisj⟩ + · obtain ⟨P₀, hP₀_mem, hP₀_notU⟩ : ∃ P ∈ P_set, ¬ P ≤ S₁'.G := by + by_contra! h + exact hall h + have hP₀_notB : ¬ (P₀ ≤ B) := fun hB => hP₀_notU (hB.trans hBU) + obtain ⟨a₀, ha₀_Af, b₀, hb₀_Bf, hP₀_ends⟩ := hAB_f P₀ hP₀_mem + have ha₀B : a₀ ∈ V(B) := hΩ₁_B hP₀_ends.2.2.1 + have hb₀B : b₀ ∈ V(B) := hΩ₁_B hP₀_ends.2.2.2 + obtain ⟨P₀', hP₀'_path_U, hP₀'_V, hP₀'_B⟩ := + exists_chord_endpoints_of_not_le hSep hInter hA'_le hP₀_ends.1 ha₀B hb₀B hRepl + have hP₀'_path : IsGraphPathWithEnds S₁'.G P₀' a₀ b₀ := hS₁'_G ▸ hP₀'_path_U + have hP₀'_omega : S₁'.IsOmegaPathWithEnds P₀' a₀ b₀ := + ⟨hP₀'_path, hP₀_ends.2.1, hS₁'_Ω ▸ hP₀_ends.2.2.1, hS₁'_Ω ▸ hP₀_ends.2.2.2⟩ + have hother_B : ∀ Q ∈ P_set, Q ≠ P₀ → Q ≤ B := by + intro Q hQ_mem hQP₀ + by_contra hQ_notB + obtain ⟨a_Q, b_Q, hQ_ends⟩ := hPaths Q hQ_mem + have h2_P₀ : 2 ≤ (V(P₀) ∩ Ω_bar).ncard := + two_le_ncard_inter_bar_of_not_le_right hSep hInter hBar_fin hP₀_ends.1 + ha₀B hb₀B hP₀_notB + have h2_Q : 2 ≤ (V(Q) ∩ Ω_bar).ncard := + two_le_ncard_inter_bar_of_not_le_right hSep hInter hBar_fin hQ_ends.1 + (hΩ₁_B hQ_ends.2.2.1) (hΩ₁_B hQ_ends.2.2.2) hQ_notB + exact not_both_two_le_inter_of_ncard_le_three hBar_fin hBar_card + (hDisj hP₀_mem hQ_mem hQP₀.symm) h2_P₀ h2_Q + let P_set' : Set (Graph α β) := insert P₀' (P_set \ {P₀}) + have hP₀'_not_diff : P₀' ∉ P_set \ {P₀} := by + rintro ⟨hP₀'_in, hne⟩ + have ha₀_in : a₀ ∈ V(P₀') ∩ V(P₀) := ⟨hP₀'_path.left_mem, hP₀_ends.1.left_mem⟩ + exact disjoint_left.mp (hDisj hP₀'_in hP₀_mem hne) ha₀_in.1 ha₀_in.2 + have hEnds_eq : S₁'.transactionEnds P_set' = S₁.transactionEnds P_set := by + ext v + simp only [Society.transactionEnds, mem_ofPred_eq, P_set', mem_insert_iff, mem_sdiff, + mem_singleton_iff] + constructor + · rintro ⟨Q, rfl | ⟨hQ_in, hQP₀⟩, c, hQc⟩ + · rcases hP₀'_omega.ends_eq S₁' hQc with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨P₀, hP₀_mem, c, hP₀_ends⟩ + · exact ⟨P₀, hP₀_mem, c, hP₀_ends.symm S₁⟩ + · exact ⟨Q, hQ_in, c, + (isOmegaPathWithEnds_iff_of_le hUG hS₁'_Ω ((hother_B Q hQ_in hQP₀).trans hBU)).mpr hQc⟩ + · rintro ⟨Q, hQ_in, c, hQc⟩ + by_cases hQP₀ : Q = P₀ + · subst hQP₀ + rcases hP₀_ends.ends_eq S₁ hQc with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨P₀', Or.inl rfl, c, hP₀'_omega⟩ + · exact ⟨P₀', Or.inl rfl, c, hP₀'_omega.symm S₁'⟩ + · exact ⟨Q, Or.inr ⟨hQ_in, hQP₀⟩, c, + (isOmegaPathWithEnds_iff_of_le hUG hS₁'_Ω ((hother_B Q hQ_in hQP₀).trans hBU)).mp hQc⟩ + have hDisj' : S₁'.IsDisjointOmegaPathSet P_set' := by + refine ⟨?_, ?_⟩ + · rintro Q (rfl | ⟨hQ_in, hQP₀⟩) + · exact ⟨a₀, b₀, hP₀'_omega⟩ + · obtain ⟨a_Q, b_Q, hQ_ends⟩ := hPaths Q hQ_in + exact ⟨a_Q, b_Q, + (isOmegaPathWithEnds_iff_of_le hUG hS₁'_Ω ((hother_B Q hQ_in hQP₀).trans hBU)).mp + hQ_ends⟩ + · rintro Q₁ (rfl | ⟨hQ₁_in, hQ₁P₀⟩) Q₂ (rfl | ⟨hQ₂_in, hQ₂P₀⟩) hne + · exact False.elim (hne rfl) + · rw [disjoint_left] + intro x hx₁ hx₂ + have hQ₂_ne : Q₂ ≠ P₀ := hQ₂P₀ + have hxB : x ∈ V(B) := (hother_B Q₂ hQ₂_in hQ₂_ne).vertexSet_mono hx₂ + have hxP₀ : x ∈ V(P₀) := (hP₀'_B ⟨hx₁, hxB⟩).1 + exact disjoint_left.mp (hDisj hP₀_mem hQ₂_in hQ₂_ne.symm) hxP₀ hx₂ + · rw [disjoint_left] + intro x hx₁ hx₂ + have hQ₁_ne : Q₁ ≠ P₀ := hQ₁P₀ + have hxB : x ∈ V(B) := (hother_B Q₁ hQ₁_in hQ₁_ne).vertexSet_mono hx₁ + have hxP₀ : x ∈ V(P₀) := (hP₀'_B ⟨hx₂, hxB⟩).1 + exact disjoint_left.mp (hDisj hQ₁_in hP₀_mem hQ₁_ne) hx₁ hxP₀ + · exact hDisj hQ₁_in hQ₂_in hne + have hFenceFor' : S₁'.IsFenceFor P_set' A_f B_f := by + refine ⟨hDisj', hS₁'_Ω ▸ hFence, ?_⟩ + rintro Q (rfl | ⟨hQ_in, hQP₀⟩) + · exact ⟨a₀, ha₀_Af, b₀, hb₀_Bf, hP₀'_omega⟩ + · obtain ⟨a_Q, ha_Q, b_Q, hb_Q, hQ_ends⟩ := hAB_f Q hQ_in + exact ⟨a_Q, ha_Q, b_Q, hb_Q, + (isOmegaPathWithEnds_iff_of_le hUG hS₁'_Ω ((hother_B Q hQ_in hQP₀).trans hBU)).mp hQ_ends⟩ + have hCrooked' : S₁'.IsCrookedTransaction P_set' := by + refine ⟨⟨A_f, B_f, hFenceFor'⟩, ?_⟩ + rintro Q (rfl | ⟨hQ_in, hQP₀⟩) ⟨_, a_Q, b_Q, hQ_ends, hdisj_int⟩ + · rcases hP₀'_omega.ends_eq S₁' hQ_ends with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hCross P₀ hP₀_mem ⟨hP₀_mem, a_Q, b_Q, hP₀_ends, hEnds_eq ▸ hS₁'_Ω ▸ hdisj_int⟩ + · exact hCross P₀ hP₀_mem ⟨hP₀_mem, a_Q, b_Q, hP₀_ends.symm S₁, + hEnds_eq ▸ hS₁'_Ω ▸ hdisj_int⟩ + · have hQ_ends_G : S₁.IsOmegaPathWithEnds Q a_Q b_Q := + (isOmegaPathWithEnds_iff_of_le hUG hS₁'_Ω ((hother_B Q hQ_in hQP₀).trans hBU)).mpr hQ_ends + exact hCross Q hQ_in ⟨hQ_in, a_Q, b_Q, hQ_ends_G, hEnds_eq ▸ hS₁'_Ω ▸ hdisj_int⟩ + have hcard' : P_set'.ncard = P_set.ncard := by + have hfin : P_set.Finite := Society.IsDisjointOmegaPathSet.finite S₁ ⟨hPaths, hDisj⟩ + have hfin_diff : (P_set \ {P₀}).Finite := hfin.subset sdiff_subset + rw [ncard_insert_of_notMem hP₀'_not_diff hfin_diff] + have h_ins : insert P₀ (P_set \ {P₀}) = P_set := + insert_sdiff_singleton.trans (insert_eq_of_mem hP₀_mem) + have hP₀_not_diff : P₀ ∉ P_set \ {P₀} := fun h => h.2 rfl + rw [← h_ins, ncard_insert_of_notMem hP₀_not_diff hfin_diff, h_ins] + exact ⟨P_set', hCrooked', hcard' ▸ hcard⟩ + +/-! ## 4. Circuit and Forest Lemmas for Claim (2) of (8.4) (page 42) -/ + +/-- A subgraph `A' ≤ S₀.G` preserves `ΩBar`-chords if for all distinct `u, v ∈ ΩBar`, whenever `u` +and +`v` are joined by a path `Q` of `S₀.G` with `V(Q) ∩ ΩBar = {u, v}`, they are also joined by such a +path in `A'` (Graph Minors XIV, Section 8, Claim (1) of (8.4), page 41). -/ +def PreservesBarPaths {α : Type u} {β : Type v} (S₀ : Society α β) (A' : Graph α β) : Prop := + ∀ u ∈ S₀.Ω.bar, ∀ v ∈ S₀.Ω.bar, u ≠ v → + (∃ Q : Graph α β, IsGraphPathWithEnds S₀.G Q u v ∧ V(Q) ∩ S₀.Ω.bar = {u, v}) → + ∃ Q' : Graph α β, IsGraphPathWithEnds A' Q' u v ∧ V(Q') ∩ S₀.Ω.bar = {u, v} + +export _root_.GraphMinor.GM09 (isGraphCircuit_subgraphUnion IsGraphCircuit.exists_two_paths) + +/-- If `s` is finite and `s.ncard ≤ 1`, any two elements of `s` are equal. -/ +private theorem eq_of_mem_of_ncard_le_one {γ : Type*} {s : Set γ} + (hs : s.Finite) (h : s.ncard ≤ 1) {a b : γ} (ha : a ∈ s) (hb : b ∈ s) : a = b := by + by_contra hab + have hsub : ({a, b} : Set γ) ⊆ s := by + rintro x (rfl | rfl) + · exact ha + · exact hb + have h2 : 2 ≤ s.ncard := by + rw [← ncard_pair hab] + exact ncard_le_ncard hsub hs + omega + +/-- Given a circuit `C` in `G`, two distinct vertices `a ≠ b` of `C`, and a finite set `Z` with +`Z.ncard ≤ 1`, at least one of the two arcs of `C` between `a` and `b` avoids `Z \ {a, b}`. -/ +theorem exists_path_in_circuit_avoiding_of_ncard_le_one {α : Type u} {β : Type v} + {G C : Graph α β} {a b : α} {Z : Set α} + (hC : IsGraphCircuit G C) (ha : a ∈ V(C)) (hb : b ∈ V(C)) (hab : a ≠ b) + (hZ_fin : Z.Finite) (hZ : Z.ncard ≤ 1) : + ∃ R : Graph α β, IsGraphPathWithEnds C R a b ∧ V(R) ∩ Z ⊆ {a, b} := by + obtain ⟨Q₁, Q₂, hQ₁C, hQ₂C, hQ₁, hQ₂, -, -, hV, -, -⟩ := + IsGraphCircuit.exists_two_paths hC ha hb hab + by_cases hz : ∃ z ∈ Z, z ∈ V(Q₁) \ {a, b} + · obtain ⟨z, hzZ, hzQ₁⟩ := hz + refine ⟨Q₂, hQ₂.of_le hQ₂C, ?_⟩ + rintro x ⟨hxQ₂, hxZ⟩ + have hxz : x = z := eq_of_mem_of_ncard_le_one hZ_fin hZ hxZ hzZ + subst hxz + have hx_inter : x ∈ V(Q₁) ∩ V(Q₂) := ⟨hzQ₁.1, hxQ₂⟩ + rwa [hV] at hx_inter + · refine ⟨Q₁, hQ₁.of_le hQ₁C, ?_⟩ + rintro x ⟨hxQ₁, hxZ⟩ + by_contra hx_ab + exact hz ⟨x, hxZ, hxQ₁, hx_ab⟩ + +/-- Along a simple walk `W : GraphWalk G a b` with `a, b ∈ V(C)` (where `C ≤ G`), either every +vertex and edge of `W` lies in `C`, or there is a detour path `P_sub` in `G` between distinct +vertices `v, v' ∈ V(C)` with `V(P_sub) ∩ V(C) = {v, v'}` and `Disjoint E(P_sub) E(C)`. -/ +private theorem walk_le_or_exists_detour {α : Type u} {β : Type v} + {G C : Graph α β} (hCG : C ≤ G) {a b : α} (W : GraphWalk G a b) + (hW : W.IsSimple) (ha : a ∈ V(C)) (hb : b ∈ V(C)) : + ((∀ x ∈ W.support, x ∈ V(C)) ∧ (∀ e ∈ W.edges, e ∈ E(C))) ∨ + ∃ v ∈ V(C), ∃ v' ∈ V(C), v ≠ v' ∧ + ∃ P_sub : Graph α β, IsGraphPathWithEnds G P_sub v v' ∧ + V(P_sub) ∩ V(C) = {v, v'} ∧ Disjoint E(P_sub) E(C) := by + induction W with + | @nil a _ => + left + exact ⟨fun x hx => (List.mem_singleton.mp hx) ▸ ha, fun _ he => (List.not_mem_nil he).elim⟩ + | @cons a w b e hl r ih => + have ha_not_r : a ∉ r.support := (List.nodup_cons.mp hW).1 + have hr_s : r.IsSimple := (List.nodup_cons.mp hW).2 + by_cases heC : e ∈ E(C) + · have hlC : C.IsLink e a w := (hCG.isLink_iff heC).mpr hl + have hwC : w ∈ V(C) := hlC.right_mem + rcases ih hr_s hwC hb with ⟨hV_r, hE_r⟩ | hex + · left + refine ⟨fun x hx => ?_, fun f hf => ?_⟩ + · rcases List.mem_cons.mp hx with rfl | hxr + · exact ha + · exact hV_r x hxr + · rcases List.mem_cons.mp hf with rfl | hfr + · exact heC + · exact hE_r f hfr + · exact Or.inr hex + · right + have hhit : ∃ x ∈ r.support, x ∈ V(C) := ⟨b, r.end_mem_support, hb⟩ + obtain ⟨v', hv'C, r₁, r₂, hsplit_r, hr₁_first⟩ := + GM09.PlanarNests.exists_first_hit_split r hhit + have hr₁_s : r₁.IsSimple := (isSimple_of_append (hsplit_r ▸ hr_s)).1 + have ha_not_r₁ : a ∉ r₁.support := fun ha_in => + ha_not_r (hsplit_r ▸ (GraphWalk.mem_support_append r₁ r₂).mpr (Or.inl ha_in)) + have hcons_r₁_s : (GraphWalk.cons hl r₁).IsSimple := + List.nodup_cons.mpr ⟨ha_not_r₁, hr₁_s⟩ + have hav' : a ≠ v' := fun h => ha_not_r₁ (h ▸ r₁.end_mem_support) + have hr₁_no_edge : ∀ f ∈ r₁.edges, f ∉ E(C) := by + intro f hf₁ hfC + obtain ⟨x, y, hxyC⟩ := C.exists_isLink_of_mem_edgeSet hfC + have hxyG : G.IsLink f x y := hxyC.mono hCG + have hx_s : x ∈ r₁.support := r₁.left_mem_support_of_mem_edges hf₁ hxyG + have hy_s : y ∈ r₁.support := r₁.left_mem_support_of_mem_edges hf₁ hxyG.symm + have hxv' : x = v' := hr₁_first x hx_s hxyC.left_mem + have hyv' : y = v' := hr₁_first y hy_s hxyC.right_mem + subst hxv' hyv' + exact GM09.PlanarNests.not_isLink_self_of_mem_edges_of_isSimple r₁ hr₁_s hf₁ hxyG + refine ⟨a, ha, v', hv'C, hav', walkSubgraph (GraphWalk.cons hl r₁), + isGraphPathWithEnds_walkSubgraph hcons_r₁_s, ?_, ?_⟩ + · rw [vertexSet_walkSubgraph] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, GraphWalk.support_cons, List.mem_cons, + mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨rfl | hx₁, hxC⟩ + · exact Or.inl rfl + · exact Or.inr (hr₁_first x hx₁ hxC) + · rintro (rfl | rfl) + · exact ⟨Or.inl rfl, ha⟩ + · exact ⟨Or.inr r₁.end_mem_support, hv'C⟩ + · rw [edgeSet_walkSubgraph] + refine disjoint_left.mpr fun f hf hfC => ?_ + rcases List.mem_cons.mp hf with rfl | hf₁ + · exact heC hfC + · exact hr₁_no_edge f hf₁ hfC + +/-- In a graph `G` with no circuits (a forest), any two paths `P₁, P₂` with the same ends `u, v` +are equal. -/ +theorem eq_of_isGraphPathWithEnds_of_no_circuit {α : Type u} {β : Type v} + {G P₁ P₂ : Graph α β} {u v : α} + (hForest : ¬ ∃ C : Graph α β, IsGraphCircuit G C) + (hP₁ : IsGraphPathWithEnds G P₁ u v) + (hP₂ : IsGraphPathWithEnds G P₂ u v) : + P₁ = P₂ := by + have hle : ∀ {A B : Graph α β}, + IsGraphPathWithEnds G A u v → IsGraphPathWithEnds G B u v → A ≤ B := by + intro A B hA hB + obtain ⟨hAG, W, hW, hVA, hEA⟩ := hA + obtain ⟨WG, hsG, heG⟩ := exists_walk_up_of_le hAG W + have hWG_s : WG.IsSimple := by unfold GraphWalk.IsSimple; rw [hsG]; exact hW + rcases walk_le_or_exists_detour hB.1 WG hWG_s hB.left_mem hB.right_mem with + ⟨hV_sub, hE_sub⟩ | ⟨x, hxB, y, hyB, hxy, P_sub, hP_sub, hVC, hEC⟩ + · rw [(Compatible.of_le_le hAG hB.1).le_iff, hVA, hEA] + refine ⟨fun z hz => hV_sub z (hsG ▸ hz), fun e he => hE_sub e (heG ▸ he)⟩ + · exfalso + obtain ⟨Q, hQB, hQ_path, hQG⟩ := hB.exists_subpath hxB hyB + have hVQ : V(P_sub) ∩ V(Q) = {x, y} := by + refine Subset.antisymm ?_ ?_ + · rw [← hVC] + exact inter_subset_inter_right _ hQB.vertexSet_mono + · rintro z (rfl | rfl) + · exact ⟨hP_sub.left_mem, hQ_path.left_mem⟩ + · exact ⟨hP_sub.right_mem, hQ_path.right_mem⟩ + have hEQ : Disjoint E(P_sub) E(Q) := + hEC.mono_right hQB.edgeSet_mono + exact hForest ⟨subgraphUnion G P_sub Q, + isGraphCircuit_subgraphUnion hP_sub hQG hxy hVQ hEQ⟩ + exact (Compatible.of_le_le hP₁.1 hP₂.1).ext + (Subset.antisymm (hle hP₁ hP₂).vertexSet_mono (hle hP₂ hP₁).vertexSet_mono) + (Subset.antisymm (hle hP₁ hP₂).edgeSet_mono (hle hP₂ hP₁).edgeSet_mono) + +/-- If every two elements of `s` are equal, then `s.ncard ≤ 1`. -/ +private theorem ncard_le_one_of_subsingleton_set {γ : Type*} {s : Set γ} + (h : ∀ a ∈ s, ∀ b ∈ s, a = b) : s.ncard ≤ 1 := by + by_cases hne : s.Nonempty + · obtain ⟨a, ha⟩ := hne + have heq : s = {a} := Subset.antisymm + (fun b hb => mem_singleton_iff.mpr (h b hb a ha)) + (singleton_subset_iff.mpr ha) + rw [heq, ncard_singleton] + · rw [not_nonempty_iff_eq_empty.mp hne, ncard_empty] + exact Nat.zero_le 1 + +/-- If a graph `G` has at most 1 edge (`E(G).Subsingleton`), then it has at most 1 circuit. -/ +theorem ncard_circuits_le_one_of_ncard_edges_le_one {α : Type u} {β : Type v} + {G : Graph α β} (hE : E(G).Subsingleton) : + {C : Graph α β | IsGraphCircuit G C}.ncard ≤ 1 := by + refine ncard_le_one_of_subsingleton_set fun C₁ hC₁ C₂ hC₂ => ?_ + have hchar : ∀ {C : Graph α β}, IsGraphCircuit G C → + ∃ e ∈ E(G), ∃ x y : α, G.IsLink e x y ∧ V(C) = {x, y} ∧ E(C) = {e} := by + intro C ⟨hCG, u, W, _, hlen, hVC, hEC⟩ + cases W with + | nil _ => simp [GraphWalk.length] at hlen + | @cons u w _ e₁ hl₁ r₁ => + have he₁C : e₁ ∈ E(C) := by rw [hEC]; exact List.mem_cons_self + have he₁G : e₁ ∈ E(G) := hCG.edgeSet_mono he₁C + have hl₁G : G.IsLink e₁ u w := hl₁.mono hCG + have hEC_eq : E(C) = {e₁} := by + refine Subset.antisymm (fun f hf => ?_) (singleton_subset_iff.mpr he₁C) + have hfG : f ∈ E(G) := hCG.edgeSet_mono hf + exact mem_singleton_iff.mpr (hE hfG he₁G) + have hVC_eq : V(C) = {u, w} := by + refine Subset.antisymm (fun z hz => ?_) ?_ + · rw [hVC, mem_ofPred_eq] at hz + rcases List.mem_cons.mp hz with rfl | hzr₁ + · exact Or.inl rfl + · have hwalk : ∀ {a b : α} (R : GraphWalk C a b), + b ∈ ({u, w} : Set α) → ∀ x ∈ R.support, x ∈ ({u, w} : Set α) := by + intro a b R hbR + induction R with + | nil _ => + intro x hx + rw [List.mem_singleton.mp hx] + exact hbR + | @cons a a' b f hlf Rf ih => + intro x hx + rcases List.mem_cons.mp hx with rfl | hxRf + · have hfC : f ∈ E(C) := hlf.edge_mem + rw [hEC_eq, mem_singleton_iff] at hfC + subst hfC + rcases hlf.left_eq_or_eq hl₁ with h | h + · exact Or.inl h + · exact Or.inr h + · exact ih hbR x hxRf + exact hwalk r₁ (Or.inl rfl) z hzr₁ + · rintro z (rfl | rfl) + · exact hl₁.left_mem + · exact hl₁.right_mem + exact ⟨e₁, he₁G, u, w, hl₁G, hVC_eq, hEC_eq⟩ + obtain ⟨e₁, he₁G, x₁, y₁, hl₁, hV₁, hE₁⟩ := hchar hC₁ + obtain ⟨e₂, he₂G, x₂, y₂, hl₂, hV₂, hE₂⟩ := hchar hC₂ + have he₁₂ : e₁ = e₂ := hE he₁G he₂G + subst he₁₂ + have hxy_eq : ({x₁, y₁} : Set α) = {x₂, y₂} := by + ext z + simp only [mem_insert_iff, mem_singleton_iff] + exact ⟨fun h => by + rcases h with rfl | rfl + · exact hl₁.left_eq_or_eq hl₂ + · exact hl₁.symm.left_eq_or_eq hl₂, + fun h => by + rcases h with rfl | rfl + · exact hl₂.left_eq_or_eq hl₁ + · exact hl₂.symm.left_eq_or_eq hl₁⟩ + exact (Compatible.of_le_le hC₁.1 hC₂.1).ext + (hV₁.trans (hxy_eq.trans hV₂.symm)) + (hE₁.trans hE₂.symm) + +/-- If a graph `G` has no circuits, then `{C | IsGraphCircuit G C}.ncard ≤ 1`. -/ +theorem ncard_circuits_le_one_of_no_circuits {α : Type u} {β : Type v} + {G : Graph α β} (hForest : ¬ ∃ C : Graph α β, IsGraphCircuit G C) : + {C : Graph α β | IsGraphCircuit G C}.ncard ≤ 1 := by + refine ncard_le_one_of_subsingleton_set fun C hC => (hForest ⟨C, hC⟩).elim + +/-- If `W : GraphWalk G x y` is a simple walk and `e ∈ W.edges` satisfies `G.IsLink e x y`, then +`V(walkSubgraph W) = {x, y}` and `E(walkSubgraph W) = {e}`. -/ +private theorem walkSubgraph_eq_of_mem_edges_isLink_ends {α : Type u} {β : Type v} + {G : Graph α β} {x y : α} {e : β} (W : GraphWalk G x y) (hW : W.IsSimple) + (he : e ∈ W.edges) (hl : G.IsLink e x y) : + V(walkSubgraph W) = {x, y} ∧ E(walkSubgraph W) = {e} := by + cases W with + | nil _ => simp at he + | @cons x w y e₀ hl₀ r => + have hx_not_r : x ∉ r.support := (List.nodup_cons.mp hW).1 + have hr_s : r.IsSimple := (List.nodup_cons.mp hW).2 + have he_not_r : e ∉ r.edges := fun he_r => + hx_not_r (r.left_mem_support_of_mem_edges he_r hl) + have he_eq : e = e₀ := (List.mem_cons.mp he).resolve_right he_not_r + subst he_eq + have hwy : w = y := by + rcases hl₀.symm.left_eq_or_eq hl.symm with h | h + · exact h + · exact (hx_not_r (h ▸ r.start_mem_support)).elim + subst hwy + cases r with + | nil _ => + rw [vertexSet_walkSubgraph, edgeSet_walkSubgraph] + refine ⟨?_, ?_⟩ + · ext z + simp [GraphWalk.support_cons, GraphWalk.support_nil] + · ext f + simp [GraphWalk.edges_cons, GraphWalk.edges_nil] + | @cons w _ _ e₁ hl₁ r₁ => + exfalso + exact (List.nodup_cons.mp hr_s).1 r₁.end_mem_support + +/-- Adding a single edge `e` (with distinct endpoints `x ≠ y`) to a forest `B` produces a graph `G` +with at most one circuit. -/ +theorem ncard_circuits_le_one_of_insert_edge {α : Type u} {β : Type v} + {G B : Graph α β} {e : β} {x y : α} + (hBG : B ≤ G) + (hForest : ¬ ∃ C : Graph α β, IsGraphCircuit B C) + (hl : G.IsLink e x y) + (hxy : x ≠ y) + (hV : V(G) = V(B)) + (hE : E(G) ⊆ insert e E(B)) : + {C : Graph α β | IsGraphCircuit G C}.ncard ≤ 1 := by + have hchar : ∀ {C : Graph α β}, IsGraphCircuit G C → + ∃ Q : Graph α β, IsGraphPathWithEnds B Q x y ∧ + V(C) = V(Q) ∧ E(C) = insert e E(Q) := by + intro C hC + have heC : e ∈ E(C) := by + by_contra he_not + have hCB : C ≤ B := by + rw [(Compatible.of_le_le hC.1 hBG).le_iff] + refine ⟨hV ▸ hC.1.vertexSet_mono, fun f hf => ?_⟩ + rcases mem_insert_iff.mp (hE (hC.1.edgeSet_mono hf)) with rfl | hfB + · exact (he_not hf).elim + · exact hfB + obtain ⟨_, u, W, hW_sc, hW_len, hVC, hEC⟩ := hC + exact hForest ⟨C, hCB, u, W, hW_sc, hW_len, hVC, hEC⟩ + have hlC : C.IsLink e x y := (hC.1.isLink_iff heC).mpr hl + have hxC : x ∈ V(C) := hlC.left_mem + have hyC : y ∈ V(C) := hlC.right_mem + obtain ⟨Q₁, Q₂, hQ₁C, hQ₂C, hQ₁, hQ₂, -, -, hVQ, hEQ, hUnion⟩ := + IsGraphCircuit.exists_two_paths hC hxC hyC hxy + have he_union : e ∈ E(Q₁) ∪ E(Q₂) := by + rw [← edgeSet_subgraphUnion (hQ₁C.trans hC.1) (hQ₂C.trans hC.1), hUnion] + exact heC + have hbranch : ∀ {A D : Graph α β}, + A ≤ C → D ≤ C → + IsGraphPathWithEnds G A x y → IsGraphPathWithEnds G D x y → + Disjoint E(A) E(D) → subgraphUnion G A D = C → e ∈ E(A) → + IsGraphPathWithEnds B D x y ∧ V(C) = V(D) ∧ E(C) = insert e E(D) := by + intro A D _ _ hA hD hED hAD heA + obtain ⟨hAG, WA, hWA_s, hVA, hEA⟩ := hA + obtain ⟨WAG, hsA, heA_walk⟩ := exists_walk_up_of_le hAG WA + have hWAG_s : WAG.IsSimple := by unfold GraphWalk.IsSimple; rw [hsA]; exact hWA_s + have he_WAG : e ∈ WAG.edges := by + rw [heA_walk] + rwa [hEA] at heA + obtain ⟨hVA_eq, hEA_eq⟩ := walkSubgraph_eq_of_mem_edges_isLink_ends WAG hWAG_s he_WAG hl + have hVA' : V(A) = {x, y} := by + rw [hVA, ← hsA, ← vertexSet_walkSubgraph, hVA_eq] + have hEA' : E(A) = {e} := by + rw [hEA, ← heA_walk, ← edgeSet_walkSubgraph, hEA_eq] + have he_not_D : e ∉ E(D) := disjoint_left.mp hED heA + have hDB : D ≤ B := by + rw [(Compatible.of_le_le hD.1 hBG).le_iff] + refine ⟨hV ▸ hD.1.vertexSet_mono, fun f hf => ?_⟩ + rcases mem_insert_iff.mp (hE (hD.1.edgeSet_mono hf)) with rfl | hfB + · exact (he_not_D hf).elim + · exact hfB + refine ⟨hD.of_le hDB, ?_, ?_⟩ + · rw [← hAD, vertexSet_subgraphUnion, hVA'] + exact union_eq_right.mpr (by + rintro z (rfl | rfl) + · exact hD.left_mem + · exact hD.right_mem) + · rw [← hAD, edgeSet_subgraphUnion hAG hD.1, hEA', singleton_union] + rcases he_union with he₁ | he₂ + · obtain ⟨hQ₂B, hVC, hEC⟩ := hbranch hQ₁C hQ₂C hQ₁ hQ₂ hEQ hUnion he₁ + exact ⟨Q₂, hQ₂B, hVC, hEC⟩ + · have hUnion' : subgraphUnion G Q₂ Q₁ = C := by + rw [← hUnion] + refine (Compatible.of_le_le (subgraphUnion_le hQ₂.1 hQ₁.1) + (subgraphUnion_le hQ₁.1 hQ₂.1)).ext ?_ ?_ + · rw [vertexSet_subgraphUnion, vertexSet_subgraphUnion, union_comm] + · rw [edgeSet_subgraphUnion hQ₂.1 hQ₁.1, edgeSet_subgraphUnion hQ₁.1 hQ₂.1, union_comm] + obtain ⟨hQ₁B, hVC, hEC⟩ := hbranch hQ₂C hQ₁C hQ₂ hQ₁ hEQ.symm hUnion' he₂ + exact ⟨Q₁, hQ₁B, hVC, hEC⟩ + refine ncard_le_one_of_subsingleton_set fun C₁ hC₁ C₂ hC₂ => ?_ + obtain ⟨Q₁, hQ₁, hV₁, hE₁⟩ := hchar hC₁ + obtain ⟨Q₂, hQ₂, hV₂, hE₂⟩ := hchar hC₂ + have hQ_eq : Q₁ = Q₂ := eq_of_isGraphPathWithEnds_of_no_circuit hForest hQ₁ hQ₂ + subst hQ_eq + exact (Compatible.of_le_le hC₁.1 hC₂.1).ext (hV₁.trans hV₂.symm) (hE₁.trans hE₂.symm) + +/-- Given a separation `(A, B)` of `G` with `V(A) ∩ V(B) = Ω_bar`, a subgraph `C ≤ A`, and three +mutually vertex-disjoint paths `P₀, P₁, P₂` in `G` from `u i ∈ V(C)` to `v i ∈ V(B) ∪ Ω_bar`, there +are three mutually vertex-disjoint paths `Q₀, Q₁, Q₂` in `A` (`Q i ≤ P i`) with +`IsFromToPathWithEnds A (Q i) V(C) Ω_bar (x i) (y i)` (Graph Minors XIV, Section 6, Claim (2) of +(6.5), page 35, and Section 8, Claim (2) of (8.4), page 42). -/ +theorem exists_three_disjoint_paths_from_circuit_to_bar {α : Type u} {β : Type v} + {G A B C : Graph α β} {Ω_bar : Set α} + (hSep : IsGraphSeparation G A B) (hInter : V(A) ∩ V(B) = Ω_bar) (hCA : C ≤ A) + {P : Fin 3 → Graph α β} {u v : Fin 3 → α} + (hP : ∀ i, IsGraphPathWithEnds G (P i) (u i) (v i) ∧ u i ∈ V(C) ∧ v i ∈ V(B) ∪ Ω_bar) + (hDisj : Pairwise (fun i j => Disjoint V(P i) V(P j))) : + ∃ (Q : Fin 3 → Graph α β) (x y : Fin 3 → α), + (∀ i, Q i ≤ P i ∧ IsFromToPathWithEnds A (Q i) V(C) Ω_bar (x i) (y i)) ∧ + Pairwise (fun i j => Disjoint V(Q i) V(Q j)) := by + have hSep_symm : IsGraphSeparation G B A := IsGraphSeparation.symm hSep + have hInter_symm : V(B) ∩ V(A) = Ω_bar := inter_comm V(B) V(A) ▸ hInter + have hex : ∀ i : Fin 3, ∃ x y : α, ∃ Q : Graph α β, + Q ≤ P i ∧ IsFromToPathWithEnds A Q V(C) Ω_bar x y := by + intro i + obtain ⟨hPi, huC, hvB⟩ := hP i + have huA : u i ∈ V(A) := hCA.vertexSet_mono huC + have hw_ex : ∃ w ∈ V(P i), w ∈ Ω_bar := by + rcases hvB with hv_in_B | hv_in_bar + · obtain ⟨hPiG, W, _, hVP, _⟩ := hPi + obtain ⟨WG, hsG, _⟩ := exists_walk_up_of_le hPiG W + obtain ⟨w, hwW, hwBar⟩ := + walk_inter_bar_of_isGraphSeparation hSep_symm hInter_symm WG huA hv_in_B + exact ⟨w, by rw [hVP, mem_ofPred_eq]; exact hsG ▸ hwW, hwBar⟩ + · exact ⟨v i, hPi.right_mem, hv_in_bar⟩ + obtain ⟨w, hwP, hwBar⟩ := hw_ex + obtain ⟨P₁, _, hP₁P, _, hP₁, _, _, _, _⟩ := hPi.exists_split_at hwP + obtain ⟨x, _, y, _, Q, hQP₁, hQ_ft⟩ := + (hP₁.mono hPi.le).exists_isFromToPathWithEnds huC hwBar + have hxC : x ∈ V(C) := (hQ_ft.2.1 ▸ mem_singleton x).2 + have hQA : Q ≤ A := + path_le_right_of_inter_bar_sub_singleton hSep_symm hInter_symm hQ_ft.1 + (hCA.vertexSet_mono hxC) (le_of_eq hQ_ft.2.2) + exact ⟨x, y, Q, hQP₁.trans hP₁P, hQ_ft.1.of_le hQA, hQ_ft.2⟩ + choose x y Q hQ using hex + refine ⟨Q, x, y, hQ, fun i j hij => ?_⟩ + exact (hDisj hij).mono (hQ i).1.vertexSet_mono (hQ j).1.vertexSet_mono + +/-- Circuit case of Claim (2) of (8.4) (page 42): if `H_inter_A ≤ S₀.G` contains a circuit `C` and +three mutually vertex-disjoint paths `P₀, P₁, P₂` from `V(C)` to `S₀.Ω.bar` (with +`S₀.Ω.bar.ncard ≤ 3`), then `S₀.Ω.bar ⊆ V(H_inter_A)`, `E(H_inter_A).Nonempty`, and +`PreservesBarPaths S₀ H_inter_A`. -/ +theorem preservesBarPaths_of_three_disjoint_paths_from_circuit {α : Type u} {β : Type v} + {S₀ : Society α β} {H_inter_A C : Graph α β} + (hBar3 : S₀.Ω.bar.ncard ≤ 3) + (hC : IsGraphCircuit H_inter_A C) + {P : Fin 3 → Graph α β} {x y : Fin 3 → α} + (hP : ∀ i, IsFromToPathWithEnds H_inter_A (P i) V(C) S₀.Ω.bar (x i) (y i)) + (hDisj : Pairwise (fun i j => Disjoint V(P i) V(P j))) : + S₀.Ω.bar ⊆ V(H_inter_A) ∧ E(H_inter_A).Nonempty ∧ PreservesBarPaths S₀ H_inter_A := by + classical + have hy_mem_bar : ∀ i, y i ∈ S₀.Ω.bar := fun i => + ((hP i).2.2 ▸ mem_singleton (y i)).2 + have hx_mem_C : ∀ i, x i ∈ V(C) := fun i => + ((hP i).2.1 ▸ mem_singleton (x i)).2 + have hy_inj : Function.Injective y := by + intro i j hij + by_contra hne + have hyi : y i ∈ V(P i) := (hP i).1.right_mem + have hyj : y i ∈ V(P j) := hij ▸ (hP j).1.right_mem + exact disjoint_left.mp (hDisj hne) hyi hyj + have hx_inj : Function.Injective x := by + intro i j hij + by_contra hne + have hxi : x i ∈ V(P i) := (hP i).1.left_mem + have hxj : x i ∈ V(P j) := hij ▸ (hP j).1.left_mem + exact disjoint_left.mp (hDisj hne) hxi hxj + have hy_range_sub : range y ⊆ S₀.Ω.bar := by + rintro z ⟨i, rfl⟩ + exact hy_mem_bar i + have hy_range_card : (range y).ncard = 3 := by + rw [ncard_range_of_injective hy_inj, Nat.card_eq_fintype_card, Fintype.card_fin] + have hy_range_eq : range y = S₀.Ω.bar := + eq_of_subset_of_ncard_le hy_range_sub (by omega) S₀.Ω.finite_bar + have hBar_sub : S₀.Ω.bar ⊆ V(H_inter_A) := by + intro z hz + rw [← hy_range_eq] at hz + rcases hz with ⟨i, rfl⟩ + exact (hP i).1.1.vertexSet_mono (hP i).1.right_mem + have hE_ne : E(H_inter_A).Nonempty := by + obtain ⟨hCH, u, W, _, hlen, _, hEC⟩ := hC + have hW_ne : W.edges ≠ [] := fun h => by simp [GraphWalk.length, h] at hlen + obtain ⟨e, he⟩ := List.exists_mem_of_ne_nil _ hW_ne + exact ⟨e, hCH.edgeSet_mono (by rw [hEC]; exact he)⟩ + refine ⟨hBar_sub, hE_ne, ?_⟩ + intro u hu v hv huv _ + have hu_r : u ∈ range y := hy_range_eq.symm ▸ hu + have hv_r : v ∈ range y := hy_range_eq.symm ▸ hv + rcases hu_r with ⟨i, rfl⟩ + rcases hv_r with ⟨j, rfl⟩ + have hij : i ≠ j := fun h => huv (h ▸ rfl) + have hxi_C : x i ∈ V(C) := hx_mem_C i + have hxj_C : x j ∈ V(C) := hx_mem_C j + have hxi_ne_xj : x i ≠ x j := fun h => hij (hx_inj h) + let Z : Set α := (fun k => x k) '' {k : Fin 3 | k ≠ i ∧ k ≠ j} + have hZ_fin : Z.Finite := (toFinite _).image _ + have hZ_le : Z.ncard ≤ 1 := by + refine ncard_le_one_of_subsingleton_set ?_ + rintro z₁ ⟨k₁, ⟨hk₁i, hk₁j⟩, rfl⟩ z₂ ⟨k₂, ⟨hk₂i, hk₂j⟩, rfl⟩ + have hk_eq : k₁ = k₂ := by omega + rw [hk_eq] + obtain ⟨R, hR_path, hRZ⟩ := + exists_path_in_circuit_avoiding_of_ncard_le_one hC hxi_C hxj_C hxi_ne_xj hZ_fin hZ_le + have hR_H : IsGraphPathWithEnds H_inter_A R (x i) (x j) := hR_path.mono hC.1 + obtain ⟨hPi_le, Wi, hWi_s, hVi, _⟩ := (hP i).1.symm + obtain ⟨hR_le, WR, hWR_s, hVR, _⟩ := hR_H + obtain ⟨hPj_le, Wj, hWj_s, hVj, _⟩ := (hP j).1 + obtain ⟨Wi', hs_i, _⟩ := exists_walk_up_of_le hPi_le Wi + obtain ⟨WR', hs_R, _⟩ := exists_walk_up_of_le hR_le WR + obtain ⟨Wj', hs_j, _⟩ := exists_walk_up_of_le hPj_le Wj + obtain ⟨W₀, hW₀_s, hsupp₀, _⟩ := exists_isSimple_subwalk ((Wi'.append WR').append Wj') + let Q' := walkSubgraph W₀ + refine ⟨Q', isGraphPathWithEnds_walkSubgraph hW₀_s, ?_⟩ + refine Subset.antisymm ?_ ?_ + · rintro z ⟨hzQ', hzBar⟩ + rw [vertexSet_walkSubgraph, mem_ofPred_eq] at hzQ' + have hz_app := hsupp₀ z hzQ' + rw [GraphWalk.mem_support_append, GraphWalk.mem_support_append, hs_i, hs_R, hs_j] at hz_app + have hz_V : z ∈ (V(P i) ∪ V(R)) ∪ V(P j) := by + rcases hz_app with (hzi | hzR) | hzj + · exact Or.inl (Or.inl (by rw [hVi]; exact hzi)) + · exact Or.inl (Or.inr (by rw [hVR]; exact hzR)) + · exact Or.inr (by rw [hVj]; exact hzj) + rcases hz_V with (hzi | hzR) | hzj + · have : z ∈ V(P i) ∩ S₀.Ω.bar := ⟨hzi, hzBar⟩ + rw [(hP i).2.2, mem_singleton_iff] at this + exact Or.inl this + · have hzC : z ∈ V(C) := hR_path.1.vertexSet_mono hzR + have hz_r : z ∈ range y := hy_range_eq.symm ▸ hzBar + rcases hz_r with ⟨m, rfl⟩ + have hym_C : y m ∈ V(P m) ∩ V(C) := ⟨(hP m).1.right_mem, hzC⟩ + rw [(hP m).2.1, mem_singleton_iff] at hym_C + by_cases hmi : m = i + · subst hmi; exact Or.inl rfl + · by_cases hmj : m = j + · subst hmj; exact Or.inr rfl + · exfalso + have hxm_Z : x m ∈ Z := ⟨m, ⟨hmi, hmj⟩, rfl⟩ + have hxm_R : x m ∈ V(R) := hym_C ▸ hzR + have hxm_ij : x m ∈ {x i, x j} := hRZ ⟨hxm_R, hxm_Z⟩ + rcases hxm_ij with h_eq | h_eq + · exact hmi (hx_inj h_eq) + · exact hmj (hx_inj h_eq) + · have : z ∈ V(P j) ∩ S₀.Ω.bar := ⟨hzj, hzBar⟩ + rw [(hP j).2.2, mem_singleton_iff] at this + exact Or.inr this + · rintro z (rfl | rfl) + · exact ⟨by rw [vertexSet_walkSubgraph]; exact W₀.start_mem_support, hy_mem_bar i⟩ + · exact ⟨by rw [vertexSet_walkSubgraph]; exact W₀.end_mem_support, hy_mem_bar j⟩ + +/-- In the forest case of Claim (2) of (8.4) (page 42), if `P₁` is a path in `A'` from `u` to `x` +with `V(P₁) ∩ S₀.Ω.bar ⊆ {u, v}`, `A'.IsLink e x y`, and `P₂` is a path in `A'` from `y` to `v` with +`V(P₂) ∩ S₀.Ω.bar ⊆ {u, v}` (for `u, v ∈ S₀.Ω.bar`), then there is a path `Q'` in `A'` from `u` to +`v` with `V(Q') ∩ S₀.Ω.bar = {u, v}`. -/ +theorem exists_bar_chord_of_link_between_branches {α : Type u} {β : Type v} + {S₀ : Society α β} {A' P₁ P₂ : Graph α β} {u v x y : α} {e : β} + (hu : u ∈ S₀.Ω.bar) (hv : v ∈ S₀.Ω.bar) + (hP₁ : IsGraphPathWithEnds A' P₁ u x) (hP₁_bar : V(P₁) ∩ S₀.Ω.bar ⊆ {u, v}) + (hl : A'.IsLink e x y) + (hP₂ : IsGraphPathWithEnds A' P₂ y v) (hP₂_bar : V(P₂) ∩ S₀.Ω.bar ⊆ {u, v}) : + ∃ Q' : Graph α β, IsGraphPathWithEnds A' Q' u v ∧ V(Q') ∩ S₀.Ω.bar = {u, v} := by + obtain ⟨hP₁_le, W₁, _, hV₁, _⟩ := hP₁ + obtain ⟨hP₂_le, W₂, _, hV₂, _⟩ := hP₂ + obtain ⟨W₁', hs₁, _⟩ := exists_walk_up_of_le hP₁_le W₁ + obtain ⟨W₂', hs₂, _⟩ := exists_walk_up_of_le hP₂_le W₂ + obtain ⟨W₀, hW₀_s, hsupp₀, _⟩ := exists_isSimple_subwalk (W₁'.append (GraphWalk.cons hl W₂')) + let Q' := walkSubgraph W₀ + refine ⟨Q', isGraphPathWithEnds_walkSubgraph hW₀_s, ?_⟩ + refine Subset.antisymm ?_ ?_ + · rintro z ⟨hzQ', hzBar⟩ + rw [vertexSet_walkSubgraph, mem_ofPred_eq] at hzQ' + have hz_app := hsupp₀ z hzQ' + rw [GraphWalk.mem_support_append, GraphWalk.support_cons, List.mem_cons, hs₁, hs₂] at hz_app + rcases hz_app with hz₁ | (rfl | hz₂) + · exact hP₁_bar ⟨by rw [hV₁]; exact hz₁, hzBar⟩ + · exact hP₁_bar ⟨by rw [hV₁]; exact W₁.end_mem_support, hzBar⟩ + · exact hP₂_bar ⟨by rw [hV₂]; exact hz₂, hzBar⟩ + · rintro z (rfl | rfl) + · exact ⟨by rw [vertexSet_walkSubgraph]; exact W₀.start_mem_support, hu⟩ + · exact ⟨by rw [vertexSet_walkSubgraph]; exact W₀.end_mem_support, hv⟩ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section9.lean b/LeanPool/GraphMinor/GM14/Section9.lean new file mode 100644 index 0000000000..03a1042912 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section9.lean @@ -0,0 +1,428 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section9a +public import LeanPool.GraphMinor.GM14.Section9b +public import LeanPool.GraphMinor.GM14.Section9Reroute +public import LeanPool.GraphMinor.GM14.Section8 +public import LeanPool.GraphMinor.GM15.Cited +import LeanPool.GraphMinor.GM14.Section5 +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM10.Section12 + +import LeanPool.GraphMinor.GM09.Bridge + +import LeanPool.GraphMinor.GM12.Section710 + +/-! +# Graph Minors XIV, Section 9: Constant Radius Discs and Battlefields + +This file completes the formalization of Section 9 ("Constant Radius Discs", pages 43–49) of +N. Robertson and P. D. Seymour, *Graph Minors. XIV. Extending an embedding*, J. Combin. Theory +Ser. B **65** (1995) 23–50, re-exporting `GraphMinor.GM14.Section9a` (`(9.1)`, `(9.2)`, `(9.4)`) and +`GraphMinor.GM14.Section9b` (`(9.3)`, `(9.5)`) and proving: + +- `theorem_9_6` (Graph Minors XIV, (9.6), pages 47–49): existence of a `(3β + 3)`-zone `Λ` and an + `α`-normal closed disc `Δ ⊇ Λ` around `z ∈ A(H)` such that either `(G, Ω₀)` has a crooked + transaction of cardinality `≥ π` whose ends are free in the cleared tangle `T'` and whose paths + are + `H ∩ (Σ - Λ)`-paths in `G`, or `(α⁻¹(Δ) ∪ J, α⁻¹(bd(Δ)))` has no crooked transaction of + cardinality `≥ π`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM10 + GraphMinor.GM11 Hypergraph + +universe u v w + +variable {S : Type w} [TopologicalSpace S] + +/-- Any vertex `v ∈ H.V` on `subBd Λ` for an open set `Λ` belongs to `(clearedSubdrawing H Λ).V`. -/ +theorem mem_clearedSubdrawing_V_of_mem_subBd [T1Space S] {H : Drawing S} {Λ : Set S} + (hOpen : IsOpen Λ) {v : S} (hvH : v ∈ H.V) (hvBd : v ∈ subBd Λ) : + v ∈ (clearedSubdrawing H Λ).V := by + have hv_not_Λ : v ∉ Λ := fun hvΛ => by + rw [subBd_eq_frontier] at hvBd + exact hvBd.2 (hOpen.interior_eq.symm ▸ hvΛ) + exact Or.inl ⟨⟨hvH, mem_univ v, hv_not_Λ⟩, hvH⟩ + +/-- If `Λ` is open, `Λ ⊆ Δ`, and `x ⊆ Λ`, then `x ⊆ Δ \ subBd Δ`. -/ +theorem subset_diff_subBd_of_subset_open {Λ Δ x : Set S} + (hOpen : IsOpen Λ) (hΛ_sub : Λ ⊆ Δ) (hx_sub : x ⊆ Λ) : + x ⊆ Δ \ subBd Δ := by + intro p hp + have hpΛ : p ∈ Λ := hx_sub hp + refine ⟨hΛ_sub hpΛ, fun hpBd => ?_⟩ + rw [subBd_eq_frontier] at hpBd + exact hpBd.2 (interior_maximal hΛ_sub hOpen hpΛ) + +/-- If `G' ≤ G_amb`, `J ≤ G_amb`, `IsGraphSegregation G' S_seg`, `IsClosed Δ`, and +`IsPullbackPerm S_seg α_pt (subBd Δ) Ω_star`, then +`Ω_star.bar ⊆ V(subgraphUnion G_amb J (arrangementPullbackGraph G' S_seg α_disc α_pt Δ))`. -/ +theorem pullback_bar_subset_subgraphUnion {α : Type u} {β : Type v} + {G_amb G' J : Graph α β} {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} {α_pt : α → S} {Δ : Set S} {Ω_star : CyclicPerm α} + (hG'_le : G' ≤ G_amb) (hJ_le : J ≤ G_amb) + (hSeg : IsGraphSegregation G' S_seg) (hClosed : IsClosed Δ) + (hPull : IsPullbackPerm S_seg α_pt (subBd Δ) Ω_star) : + Ω_star.bar ⊆ V(subgraphUnion G_amb J (arrangementPullbackGraph G' S_seg α_disc α_pt Δ)) := by + intro x hx + rw [hPull.1] at hx + obtain ⟨hx_seg, hx_bd⟩ := hx + obtain ⟨S₀, hS₀_in, hx_bar₀⟩ := mem_iUnion₂.mp hx_seg + have hx_G' : x ∈ V(G') := (hSeg.le S₀ hS₀_in).vertexSet_mono (S₀.bar_subset hx_bar₀) + have hx_Δ : α_pt x ∈ Δ := by + have hcl : α_pt x ∈ closure Δ := hx_bd.1 + rwa [hClosed.closure_eq] at hcl + have hx_pull : x ∈ V(arrangementPullbackGraph G' S_seg α_disc α_pt Δ) := by + simp only [arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce, mem_inter_iff, + mem_union, mem_ofPred_eq] + exact ⟨Or.inr ⟨hx_seg, hx_Δ⟩, hx_G'⟩ + have hPull_le : arrangementPullbackGraph G' S_seg α_disc α_pt Δ ≤ G_amb := + (Graph.restrict_le.trans (G'.induce_le inter_subset_right)).trans hG'_le + exact (le_subgraphUnion_right hJ_le hPull_le).vertexSet_mono hx_pull + +/-- First part of the proof of Graph Minors XIV, (9.6) (page 48): +Given a battlefield `(Λ, C, X_bf)` around `z` of size `β`, let `D₀ = discIns (closure Λ) C` be the +closed disc bounded by `U(C)`. By (5.5) (`theorem_5_5_step_of_isPreconnected`), there is a circuit +`C₂` of `H` in `Λ` bounding a closed disc `closure Λ_C₂ ⊆ Λ` with `D₀ ⊆ Λ_C₂` and +`regionalDistance H (closure Λ_C₂) (subBd Λ) ≥ β / 2`; and by (7.7) (`theorem_7_7_proof`), there is +an +`α`-normal `O`-arc `F₂ ⊆ closure Λ_C₂` bounding a closed disc `Δ₂ ⊆ closure Λ_C₂` with `D₀ ⊆ Δ₂` +and `x ⊆ Δ₂ \ subBd Δ₂` for every `x ∈ A(H)` with `d(z, x) < β`. -/ +theorem exists_nested_discs_9_6 [T2Space S] {α : Type u} {β : Type v} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {G' : Graph α β} {H : Drawing S} {η' : SpanEmbedding H G'} + {θ beta : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z Λ : Set S} {C : Drawing S} {X_bf : Set S} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + (hMetric : HasTangleMetric H θ T d) + (hBf : IsBattlefield H T d θ beta z Λ C X_bf) + (hSeg : IsThreeSegregation G' S_seg) + (hLoc : IsTangleLocal G' H η' T S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) : + ∃ (C₂ : Drawing S) (Λ_C₂ F₂ Δ₂ : Set S), + C₂.IsSubdrawing H ∧ C₂.IsCircuit ∧ + IsOpenDisc Λ_C₂ ∧ closure Λ_C₂ ⊆ Λ ∧ IsClosedDisc (closure Λ_C₂) ∧ + subBd (closure Λ_C₂) = C₂.U ∧ closure Λ_C₂ \ C₂.U = Λ_C₂ ∧ + beta / 2 ≤ regionalDistance H (closure Λ_C₂) (subBd Λ) ∧ + IsOArc F₂ ∧ F₂ ⊆ closure Λ_C₂ ∧ IsArrangementNormal S_seg α_disc α_pt F₂ ∧ + IsClosedDisc Δ₂ ∧ subBd Δ₂ = F₂ ∧ Δ₂ ⊆ closure Λ_C₂ ∧ + discIns (closure Λ) C ⊆ Δ₂ ∧ + ∀ x ∈ H.A, d z x < beta → x ⊆ Δ₂ \ subBd Δ₂ := by + have : ConnectedSpace S := hConn + obtain ⟨hbeta4, _, hθ_bf, hz⟩ := hBf.params_valid + have hZone : IsLambdaZoneAround H d (3 * beta + 3) z Λ := hBf.isZone + obtain ⟨hC, hCs, hCU_sub_Λ, _⟩ := hBf.circuit_and_paths + have hdist_ge : 1 + beta / 2 ≤ regionalDistance H C.U (subBd Λ) := hBf.regionalDistance_ge + obtain ⟨Δ₀, hOD₀, hΔ₀_sub_Λ, hbd_Δ₀, hΔ₀_atoms⟩ := hBf.openDisc_includes + have hbd_clΛ : subBd (closure Λ) = subBd Λ := by + rw [IsClosedDisc.subBd_eq_discBd hS hZone.isClosedDisc_closure, + discBd_closure_eq_subBd hS hZone.isOpenDisc hZone.isOArc_bd hZone.isClosedDisc_closure] + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hZone.isOpenDisc.1 + have hdiffΛ : closure Λ \ subBd (closure Λ) = Λ := by + rw [hbd_clΛ] + ext y + exact ⟨fun ⟨hycl, hynot⟩ => (hclL ▸ hycl).resolve_right hynot, + fun hy => ⟨subset_closure hy, disjoint_left.mp hdisL hy⟩⟩ + have hCU_oArc : IsOArc C.U := isOArc_of_isCircuit hC + -- Apply (5.5) (`theorem_5_5_step_of_isPreconnected`) to `Z = C.U` in `closure Λ`. + obtain ⟨C₂, Λ_C₂, hC₂H, hC₂, hC₂U_sub, hOpen_C₂, hcl_C₂_sub, hcl_C₂_disc, + hbd_C₂, hbd_cl_C₂, hdiff_C₂, hCU_sub_Λ_C₂, hdist_C₂⟩ := + theorem_5_5_step_of_isPreconnected hS H hZone.isClosedDisc_closure + (hdiffΛ.symm ▸ hCU_sub_Λ) (IsOArc.nonempty hCU_oArc) (IsOArc.isPreconnected hCU_oArc) + (k := 1 + beta / 2) (by omega) (hbd_clΛ.symm ▸ hdist_ge) + rw [hdiffΛ] at hcl_C₂_sub + rw [hbd_clΛ] at hdist_C₂ + -- Show `D₀ = discIns (closure Λ) C` satisfies `D₀ ⊆ Λ_C₂` and `D₀ \ C.U = Δ₀`. + let D₀ := discIns (closure Λ) C + have hCU_sub_clΛ : C.U ⊆ closure Λ := hCU_sub_Λ.trans subset_closure + obtain ⟨⟨hD₀_sub_clΛ, hD₀_disc, hD₀_bd⟩, hD₀_uniq⟩ := + discIns_spec hZone.isClosedDisc_closure hC hCU_sub_clΛ + have hbd_D₀ : subBd D₀ = C.U := by + rw [IsClosedDisc.subBd_eq_discBd hS hD₀_disc, hD₀_bd] + obtain ⟨D₀', ⟨hD₀'_sub, hD₀'_disc, hD₀'_bd, -⟩, -⟩ := + disc_oArc (closure Λ_C₂) C.U hcl_C₂_disc (hCU_sub_Λ_C₂.trans subset_closure) hCU_oArc + have hD₀'_eq : D₀' = D₀ := + hD₀_uniq D₀' (hD₀'_sub.trans (hcl_C₂_sub.trans subset_closure)) hD₀'_disc hD₀'_bd + have hD₀_sub_cl_C₂ : D₀ ⊆ closure Λ_C₂ := hD₀'_eq ▸ hD₀'_sub + have hD₀_sub_Λ_C₂ : D₀ ⊆ Λ_C₂ := by + rw [← hdiff_C₂] + intro x hxD + refine ⟨hD₀_sub_cl_C₂ hxD, fun hxC₂ => ?_⟩ + have hx_fr_C₂ : x ∈ frontier (closure Λ_C₂) := by + rwa [← subBd_eq_frontier, hbd_cl_C₂] + have hx_fr_D₀ : x ∈ frontier D₀ := + ⟨subset_closure hxD, fun hxi => hx_fr_C₂.2 (interior_mono hD₀_sub_cl_C₂ hxi)⟩ + rw [← subBd_eq_frontier, hbd_D₀] at hx_fr_D₀ + exact (hdiff_C₂ ▸ hCU_sub_Λ_C₂ hx_fr_D₀).2 hxC₂ + -- Show `Δ₀ = D₀ \ C.U`. + obtain ⟨p₀, hp₀⟩ := hOD₀.isPathConnected.isConnected.nonempty + obtain ⟨hdis₀, hcl₀⟩ := isOpen_disjoint_subBd_and_closure_eq hOD₀.1 + have hΔ₀_sub_diff : Δ₀ ⊆ closure Λ \ C.U := fun x hx => + ⟨subset_closure (hΔ₀_sub_Λ hx), disjoint_left.mp (hbd_Δ₀ ▸ hdis₀) hx⟩ + let K := connectedComponentIn (closure Λ \ C.U) p₀ + have hΔ₀_sub_K : Δ₀ ⊆ K := + hOD₀.isPathConnected.isConnected.isPreconnected.subset_connectedComponentIn hp₀ hΔ₀_sub_diff + have hK_sub_diff : K ⊆ closure Λ \ C.U := connectedComponentIn_subset (closure Λ \ C.U) p₀ + have hK_dis_fr : Disjoint K (frontier Δ₀) := by + rw [← subBd_eq_frontier, hbd_Δ₀] + exact disjoint_of_subset_left hK_sub_diff disjoint_sdiff_left + have hK_sub_cl₀ : K ⊆ closure Δ₀ := + subset_of_disjoint_frontier isPreconnected_connectedComponentIn isClosed_closure + (hK_dis_fr.mono_right frontier_closure_subset) + (mem_connectedComponentIn (hΔ₀_sub_diff hp₀)) (subset_closure hp₀) + have hK_sub_Δ₀ : K ⊆ Δ₀ := fun x hx => + ((hbd_Δ₀ ▸ hcl₀) ▸ hK_sub_cl₀ hx).resolve_right (hK_sub_diff hx).2 + have hK_eq_Δ₀ : K = Δ₀ := subset_antisymm hK_sub_Δ₀ hΔ₀_sub_K + have hΔ₀_comp : Δ₀ ∈ componentsIn (closure Λ \ C.U) := ⟨p₀, hΔ₀_sub_diff hp₀, hK_eq_Δ₀⟩ + have hdis_Δ₀_bd : Disjoint Δ₀ (discBd (closure Λ)) := by + rw [← IsClosedDisc.subBd_eq_discBd hS hZone.isClosedDisc_closure, hbd_clΛ] + exact disjoint_of_subset_left hΔ₀_sub_Λ hdisL + have hD₀_eq_choose : D₀ = (disc_oArc (closure Λ) C.U hZone.isClosedDisc_closure hCU_sub_clΛ + hCU_oArc).choose := by + simp only [D₀, discIns, hZone.isClosedDisc_closure, hCU_sub_clΛ, hCU_oArc, and_self, dite_true] + have hΔ₀_eq_D₀_diff : Δ₀ = D₀ \ subBd D₀ := by + rw [hbd_D₀, hD₀_eq_choose] + exact (disc_oArc (closure Λ) C.U hZone.isClosedDisc_closure hCU_sub_clΛ + hCU_oArc).choose_spec.1.2.2.2.2.2 + Δ₀ hΔ₀_comp hdis_Δ₀_bd + have hdisj_C₂_C : Disjoint C₂.V C.V := by + refine disjoint_left.mpr fun v hv₂ hv => ?_ + have hv_Λ_C₂ : v ∈ Λ_C₂ := hCU_sub_Λ_C₂ (C.V_subset_U hv) + exact (hdiff_C₂ ▸ hv_Λ_C₂).2 (C₂.V_subset_U hv₂) + have hrefl := (GM11.gm15_theorem_9_1 H θ T d hS hConn hMetric).2.1 z hz + -- Apply (7.7) (`theorem_7_7_proof`) to `Δ₁ = closure Λ_C₂` and `Δ₂ = D₀`. + obtain ⟨F₂, Δ₂, hF₂_O, hF₂_sub, hF₂_norm, hΔ₂_disc, hbd_Δ₂, hΔ₂_sub_cl_C₂, hD₀_sub_Δ₂⟩ := + theorem_7_7_proof hS hConn (by omega) hMetric hz hcl_C₂_disc hD₀_disc + (hΔ₀_eq_D₀_diff ▸ hΔ₀_atoms z hz (by omega)) + (by rwa [hbd_cl_C₂, hdiff_C₂]) + (fun x hx hx_sub => (hZone.dist_le x hx (hx_sub.trans (hcl_C₂_sub.trans + subset_closure))).trans (by omega)) + (fun x hx hle => hΔ₀_eq_D₀_diff ▸ hΔ₀_atoms x hx (by omega)) + hC₂ hC₂H hbd_cl_C₂ hC hCs hbd_D₀ hdisj_C₂_C hSeg hLoc hArr hComp + refine ⟨C₂, Λ_C₂, F₂, Δ₂, hC₂H, hC₂, hOpen_C₂, hcl_C₂_sub, hcl_C₂_disc, + hbd_cl_C₂, hdiff_C₂, by omega, hF₂_O, hF₂_sub, hF₂_norm, hΔ₂_disc, hbd_Δ₂, + hΔ₂_sub_cl_C₂, hD₀_sub_Δ₂, fun x hx hlt => ?_⟩ + exact subset_diff_subBd_of_subset_open hOD₀.1 + ((hΔ₀_eq_D₀_diff.trans_subset sdiff_subset).trans hD₀_sub_Δ₂) (hΔ₀_atoms x hx hlt) + +/-- **Graph Minors XIV, (9.6)** (pages 47–49): +"Let $H$ be a 2-cell, rigid drawing in $\Sigma$, let $z \in A(H)$, and let $\mathscr{T}$ be a +respectful tangle in $H$ of order $\theta$, with metric $d$. Let $\pi \ge 0$ with $\pi \ne 1, 3$, +let $\beta \ge 2\pi + 8$ be even, and let $\theta \ge 16\beta + 17$. Let $H$ be a subgraph of $G$, +let $J$ be the union of some bridges of $H$ in $G$ such that $d(z, v) < \beta$ for each ... $v \in +V(H +\cap J)$, and let $G'$ be the union of $H$ and all the other bridges of $H$ in $G$. Let +$\mathscr{S}$ be a $\mathscr{T}$-local 3-segregation of $G'$, and let $\alpha$ be an arrangement of +$\mathscr{S}$ in $\Sigma$ compatible with $H$. Then there is a $(3\beta + 3)$-zone $\Lambda$ around +$z$, and a closed disc $\Delta \subseteq \Sigma$ with $bd(\Delta)$ $\alpha$-normal and with +$\Lambda \subseteq \Delta$, with the following properties: +(i) $d(z, x) \le 3\beta + 6$ for all $x \in A(H)$ with $x \cap \Delta \ne \emptyset$ +(ii) $x \subseteq \Delta - bd(\Delta)$ for all $x \in A(H)$ with $d(z, x) < \beta$ +(iii) $H \cap \overline{\Sigma - \Delta}$ has a circuit, and $H \cap (\Sigma - \Lambda)$ is a rigid +drawing in $\Sigma$ +(iv) one of the following alternatives holds: +(a) there is a crooked transaction $\mathscr{P}$ of cardinality $\ge \pi$ in $(G, \Omega_0)$ (where +$\Omega_0$ is a natural order of $V(H) \cap bd(\Lambda)$ from $bd(\Lambda)$), such that +$V(\mathscr{P})$ is free with respect to the tangle of order $\theta - 4(3\beta + 3) - 2$ obtained +from $\mathscr{T}$ by clearing $\Lambda$, and each $P \in \mathscr{P}$ meets $H \cap (\Sigma - +\Lambda)$ in precisely the ends of $P$ +(b) there is no crooked transaction of cardinality $\ge \pi$ in $(\alpha^{-1}(\Delta) \cup J, +\alpha^{-1}(bd(\Delta)))$." -/ +theorem theorem_9_6_proof [T2Space S] {α : Type u} {β : Type v} + (G_amb G G' J : Graph α β) (B_J B_rem : Set (Graph α β)) + (H : Drawing S) (η : SpanEmbedding H G_amb) (η' : SpanEmbedding H G') + (θ π beta : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (z : Set S) + (S_seg : Set (Society α β)) (α_disc : Society α β → Set S) (α_pt : α → S) + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + (hV_fin : V(G_amb).Finite) (hE_fin : E(G_amb).Finite) + (hRig : IsRigid H) (hMetric : HasTangleMetric H θ T d) (hz : z ∈ H.A) + (hπ1 : π ≠ 1) (hπ3 : π ≠ 3) (hbeta : 2 * π + 8 ≤ beta) (heven : Even beta) + (hθ : 16 * beta + 17 ≤ θ) + (hB_J : ∀ B ∈ B_J, IsBridge G_amb η.imageGraph B) + (hB_rem : ∀ B ∈ B_rem, IsBridge G_amb η.imageGraph B) + (hDisj_B : Disjoint B_J B_rem) + (hJ_eq : J = subgraphSUnion G_amb B_J) + (hG'_eq : G' = subgraphSUnion G_amb {η.imageGraph, subgraphSUnion G_amb B_rem}) + (hG_eq : G = subgraphUnion G_amb G' J) + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η.vMap v) + (hη'_e : ∀ e ∈ H.E, η'.eMap e = η.eMap e) + (hJ_dist : ∀ v ∈ H.V, η.vMap v ∈ V(J) → d z {v} < beta) + (hSeg : IsThreeSegregation G' S_seg) + (hLoc : IsTangleLocal G' H η' T S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) : + ∃ (Λ Δ : Set S) + (T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₁ : Set S → Set S → ℕ) + (clearedEmbedding : SpanEmbedding (clearedSubdrawing H Λ) G_amb) + (clearedSociety localSociety : Society α β), + IsLambdaZoneAround H d (3 * beta + 3) z Λ ∧ + IsClearedTangle H T d θ (3 * beta + 3) Λ T₁ d₁ ∧ + IsClosedDisc Δ ∧ + IsArrangementNormal S_seg α_disc α_pt (subBd Δ) ∧ + Λ ⊆ Δ ∧ + (∀ x ∈ H.A, (x ∩ Δ).Nonempty → d z x ≤ 3 * beta + 6) ∧ + (∀ x ∈ H.A, d z x < beta → x ⊆ Δ \ subBd Δ) ∧ + (∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing (H.interSet (closure (univ \ Δ)))) ∧ + IsRigid (clearedSubdrawing H Λ) ∧ + (∀ v ∈ (clearedSubdrawing H Λ).V, clearedEmbedding.vMap v = η.vMap v) ∧ + (∀ e ∈ (clearedSubdrawing H Λ).E, clearedEmbedding.eMap e = η.eMap e) ∧ + clearedSociety.G = G ∧ + clearedSociety.Ω.bar = clearedEmbedding.vMap '' ((clearedSubdrawing H Λ).V ∩ subBd Λ) ∧ + (∃ inv_v : α → S, + (∀ x ∈ clearedSociety.Ω.bar, inv_v x ∈ (clearedSubdrawing H Λ).V ∩ subBd Λ + ∧ clearedEmbedding.vMap (inv_v x) = x) + ∧ + IsNaturalOrderFrom inv_v clearedSociety.Ω (subBd Λ)) ∧ + localSociety.G = subgraphUnion G_amb J (arrangementPullbackGraph G' S_seg α_disc α_pt Δ) ∧ + IsPullbackPerm S_seg α_pt (subBd Δ) localSociety.Ω ∧ + ((∃ (P_set : Set (Graph α β)) (X : Set S), + clearedSociety.IsCrookedTransaction P_set ∧ + π ≤ P_set.ncard ∧ + (∀ P ∈ P_set, ∀ a b : α, + clearedSociety.IsOmegaPathWithEnds P a b → + IsHPathWithEnds G_amb clearedEmbedding.imageGraph P a b) ∧ + X ⊆ (clearedSubdrawing H Λ).V ∩ subBd Λ ∧ + clearedSociety.transactionEnds P_set = clearedEmbedding.vMap '' X ∧ + IsFreeSet (clearedSubdrawing H Λ).toHypergraph T₁ (θ - 4 * (3 * beta + 3) - 2) X) ∨ + (∀ P_set : Set (Graph α β), localSociety.IsCrookedTransaction P_set → ¬ π ≤ P_set.ncard)) + := by + have : ConnectedSpace S := hConn + -- Step 1: By (9.5) (`theorem_9_5_proof`), obtain a battlefield `(Λ, C, X_bf)` around `z` of size + -- `beta`. + obtain ⟨Λ, C, X_bf0, hBf0⟩ := + theorem_9_5_proof H θ beta T d z hS hConn hRig hMetric hz (by omega) heven hθ + obtain ⟨X_bf, _, hBf⟩ := hBf0.normalize + have hZone : IsLambdaZoneAround H d (3 * beta + 3) z Λ := hBf.isZone + have hRig_Λ : IsRigid (clearedSubdrawing H Λ) := hBf.isRigid_cleared + obtain ⟨hX_bf_sub, _, T₁, d₁, hCleared, hFree_X_bf⟩ := hBf.isFree_X + obtain ⟨Δ₀, _, hΔ₀_sub_Λ, _, hΔ₀_atoms⟩ := hBf.openDisc_includes + -- Step 2: By (9.4) (`theorem_9_4_proof`), obtain `F`, `Δ`, `C_out` with `closure Λ ⊆ Δ`. + have hΛ_le3 : ∀ x ∈ H.A, d z x ≤ 3 → x ⊆ Λ := + fun x hx hle => (hΔ₀_atoms x hx (by omega)).trans hΔ₀_sub_Λ + obtain ⟨F, Δ, C_out, hFO, hFnorm, hΔ_disc, hbdΔ, hclΛ_sub_Δ, hCout_cir, hCout_sub, _, hΔ_dist⟩ := + theorem_9_4_proof hS hConn hMetric hz (by omega : 1 ≤ 3 * beta + 3) + (by omega : 3 * beta + 3 + 7 ≤ θ) + hZone hΛ_le3 hSeg hLoc hArr hComp + have hNorm_Δ : IsArrangementNormal S_seg α_disc α_pt (subBd Δ) := hbdΔ ▸ hFnorm + have hΛ_sub_Δ : Λ ⊆ Δ := subset_closure.trans hclΛ_sub_Δ + have hΔ_lt_beta : ∀ x ∈ H.A, d z x < beta → x ⊆ Δ \ subBd Δ := + fun x hx hlt => subset_diff_subBd_of_subset_open hZone.isOpenDisc.1 hΛ_sub_Δ + ((hΔ₀_atoms x hx hlt).trans hΔ₀_sub_Λ) + -- Step 3: Construct `clearedEmbedding`, `clearedSociety`, and `localSociety`. + let clearedEmbedding : SpanEmbedding (clearedSubdrawing H Λ) G_amb := restrictCleared η Λ + obtain ⟨Ω_Λ, inv_v, hΩ_Λ_bar, hinv_v_prop, hΩ_Λ_nat⟩ := + exists_natural_order_spanEmbedding_subBd clearedEmbedding hZone.isOArc_bd + have hJ_le : J ≤ G_amb := by + rw [hJ_eq] + exact subgraphSUnion_le fun B hB => (hB_J B hB).2.1 + have hBrem_le : subgraphSUnion G_amb B_rem ≤ G_amb := + subgraphSUnion_le fun B hB => (hB_rem B hB).2.1 + have hG'_le : G' ≤ G_amb := by + rw [hG'_eq] + refine subgraphSUnion_le ?_ + rintro K (rfl | rfl) + · exact η.imageGraph_le + · exact hBrem_le + have hη_le_G' : η.imageGraph ≤ G' := by + rw [hG'_eq] + refine le_subgraphSUnion ?_ (Or.inl rfl) + rintro K (rfl | rfl) + · exact η.imageGraph_le + · exact hBrem_le + have hG_le : G ≤ G_amb := by + rw [hG_eq] + exact subgraphUnion_le hG'_le hJ_le + have hG'_le_G : G' ≤ G := by + rw [hG_eq] + exact le_subgraphUnion_left hG'_le hJ_le + have hΩ_Λ_sub_G : Ω_Λ.bar ⊆ V(G) := by + rw [hΩ_Λ_bar] + rintro x ⟨v, hv, rfl⟩ + have hv_img : clearedEmbedding.vMap v ∈ V(clearedEmbedding.imageGraph) + := clearedEmbedding.bijOn_v.mapsTo hv.1 + have h_le : clearedEmbedding.imageGraph ≤ G := + ((restrictCleared_imageGraph_le η Λ).trans hη_le_G').trans hG'_le_G + exact h_le.vertexSet_mono hv_img + let clearedSociety : Society α β := + ⟨G, Ω_Λ, hV_fin.subset hG_le.vertexSet_mono, hE_fin.subset hG_le.edgeSet_mono, hΩ_Λ_sub_G⟩ + obtain ⟨Ω_star, hPull_star⟩ := exists_pullbackPerm hSeg.1 hArr (hbdΔ ▸ hFO) + let G_star : Graph α β := subgraphUnion G_amb J (arrangementPullbackGraph G' S_seg α_disc α_pt Δ) + have hPull_le_G_amb : arrangementPullbackGraph G' S_seg α_disc α_pt Δ ≤ G_amb := + (Graph.restrict_le.trans (G'.induce_le inter_subset_right)).trans hG'_le + have hG_star_le : G_star ≤ G_amb := subgraphUnion_le hJ_le hPull_le_G_amb + have hΩ_star_sub : Ω_star.bar ⊆ V(G_star) := + pullback_bar_subset_subgraphUnion hG'_le hJ_le hSeg.1 + hΔ_disc.isCompact.isClosed hPull_star + let localSociety : Society α β := + ⟨G_star, Ω_star, hV_fin.subset hG_star_le.vertexSet_mono, + hE_fin.subset hG_star_le.edgeSet_mono, hΩ_star_sub⟩ + refine ⟨Λ, Δ, T₁, d₁, clearedEmbedding, clearedSociety, localSociety, + hZone, hCleared, hΔ_disc, hNorm_Δ, hΛ_sub_Δ, hΔ_dist, hΔ_lt_beta, + ⟨C_out, hCout_cir, hCout_sub⟩, hRig_Λ, + fun _ _ => rfl, fun _ _ => rfl, rfl, hΩ_Λ_bar, ⟨inv_v, hinv_v_prop, hΩ_Λ_nat⟩, + rfl, hPull_star, ?_⟩ + -- Step 4: Verify alternative (iv)(a) or (iv)(b). + by_cases h_no_cr : ∀ P_set : Set (Graph α β), localSociety.IsCrookedTransaction P_set → ¬ π + ≤ P_set.ncard + · exact Or.inr h_no_cr + · left + push Not at h_no_cr + obtain ⟨P_star, hCr_star, hCard_star⟩ := h_no_cr + by_cases hπ0 : π = 0 + · subst hπ0 + refine ⟨∅, ∅, empty_isCrookedTransaction clearedSociety, Nat.zero_le _, + fun _ h => False.elim h, empty_subset _, ?_, + hFree_X_bf.subset hCleared.hasMetric.1.2.1 (empty_subset X_bf)⟩ + rw [transactionEnds_empty, image_empty] + · obtain ⟨C₂, Λ_C₂, F₂, Δ₂, hC₂H, hC₂, hOpen_C₂, hcl_C₂_sub, hcl_C₂_disc, + hbd_cl_C₂, hdiff_C₂, hdist_C₂, _, _, hF₂_norm, hΔ₂_disc, hbd_Δ₂, + hΔ₂_sub_cl_C₂, hD₀_sub_Δ₂, hΔ₂_atoms⟩ := + exists_nested_discs_9_6 hS hConn hMetric hBf hSeg hLoc hArr hComp + obtain ⟨P_set, hCr_Λ, hCard_Λ, hEnds_sub, hHPath⟩ := + cylinder_reroute_9_6 hS hConn hV_fin hE_fin hRig hπ1 hπ3 hbeta + hB_J hB_rem hDisj_B hJ_eq hG'_eq hG_eq hη'_v hη'_e hJ_dist hSeg hArr hComp + hBf hΔ_disc hNorm_Δ hclΛ_sub_Δ hCout_cir hCout_sub + (fun _ _ => rfl) (fun _ _ => rfl) (rfl : clearedSociety.G = G) hΩ_Λ_bar hinv_v_prop + hΩ_Λ_nat + (rfl : localSociety.G = _) hPull_star ⟨P_star, hCr_star, hCard_star⟩ + hC₂H hC₂ hOpen_C₂ hcl_C₂_sub hcl_C₂_disc hbd_cl_C₂ hdiff_C₂ hdist_C₂ + hF₂_norm hΔ₂_disc hbd_Δ₂ hΔ₂_sub_cl_C₂ hD₀_sub_Δ₂ hΔ₂_atoms + let X : Set S := {v ∈ X_bf | clearedEmbedding.vMap v ∈ clearedSociety.transactionEnds P_set} + have hX_sub_bf : X ⊆ X_bf := fun _ hv => hv.1 + have hX_sub_cleared : X ⊆ (clearedSubdrawing H Λ).V ∩ subBd Λ := by + intro v hv + have hv_bf := hX_bf_sub (hX_sub_bf hv) + exact ⟨mem_clearedSubdrawing_V_of_mem_subBd hZone.isOpenDisc.1 hv_bf.1 hv_bf.2, hv_bf.2⟩ + have hEnds_eq : clearedSociety.transactionEnds P_set = clearedEmbedding.vMap '' X := by + ext y + simp only [X, mem_image, mem_sep_iff] + constructor + · intro hy + obtain ⟨v, hv_bf, rfl⟩ := hEnds_sub hy + exact ⟨v, ⟨hv_bf, hy⟩, rfl⟩ + · rintro ⟨v, ⟨_, hy⟩, rfl⟩ + exact hy + have hFree_X : IsFreeSet (clearedSubdrawing H Λ).toHypergraph T₁ (θ - 4 * + (3 * beta + 3) - 2) X := + hFree_X_bf.subset hCleared.hasMetric.1.2.1 hX_sub_bf + exact ⟨P_set, X, hCr_Λ, hCard_Λ, hHPath, hX_sub_cleared, hEnds_eq, hFree_X⟩ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section9Reroute.lean b/LeanPool/GraphMinor/GM14/Section9Reroute.lean new file mode 100644 index 0000000000..f80d1b54a5 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section9Reroute.lean @@ -0,0 +1,2784 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section9a +public import LeanPool.GraphMinor.GM14.Section9b +public import LeanPool.GraphMinor.GM14.Form84 +import LeanPool.GraphMinor.GM14.BridgeFacts +import LeanPool.GraphMinor.GM14.Section5 +import LeanPool.GraphMinor.GM14.Section6b +import LeanPool.GraphMinor.GM14.Section8 +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.GM14.DiscArrangement + +/-! +# Graph Minors XIV, Section 9: Cylinder Rerouting Lemmas for (9.6) + +This file proves the cylinder rerouting steps used in the proof of Graph Minors XIV, (9.6) +(pages 48–49) of N. Robertson and P. D. Seymour, *Graph Minors. XIV. Extending an embedding*, +J. Combin. Theory Ser. B **65** (1995) 23–50: + +- `isRigidIn_cylinder_9_6`: by (6.1) (`theorem_6_1`), `H' = H.interSet (Δ \ discInt Δ₂)` is a + rigid drawing in the closed cylinder `Δ \ discInt Δ₂`. +- `circuits_cylinder_9_6`: `C₁ = H'.interSet (subBd Λ)` and `C₂` are circuit subdrawings of `H'` + bounding `E₁ = closure Λ` and `E₂ = closure Λ_C₂`. +- `regionalDistance_cylinder_9_6`: the regional distance `regionalDistance H' C₂.U C₁.U` in `H'` + is at least `π + 4`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 + GraphMinor.GM11 Hypergraph + +universe u v w + +variable {S : Type w} [TopologicalSpace S] + +/-! ## 1. Boundary Normality and Rigidity of `H' = H.interSet (Δ \ discInt Δ₂)` -/ + +/-- If `subBd D` is `α`-normal for a 3-segregation `S_seg` of `G'` compatible with `H`, then +`subBd D ∩ H.U ⊆ H.V`. -/ +theorem subBd_inter_U_subset_V_of_normal {α : Type u} {β : Type v} + {G' : Graph α β} {H : Drawing S} {η' : SpanEmbedding H G'} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + {D : Set S} + (hSeg : IsThreeSegregation G' S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hNorm : IsArrangementNormal S_seg α_disc α_pt (subBd D)) : + subBd D ∩ H.U ⊆ H.V := by + rintro x ⟨hxbd, hxU⟩ + by_contra hxnotV + obtain ⟨e, he, hxe⟩ := H.exists_edge_of_mem hxU hxnotV + have he_G' : η'.eMap e ∈ E(G') := η'.imageGraph_le.edgeSet_mono (η'.bijOn_e.mapsTo he) + have he_union : η'.eMap e ∈ E(subgraphSUnion G' ((fun S₁ : Society α β => S₁.G) '' S_seg)) := + hSeg.1.union_eq.symm ▸ he_G' + simp only [subgraphSUnion, edgeSet_restrict, mem_inter_iff, mem_iUnion, mem_image, + exists_prop] at he_union + obtain ⟨_, ⟨S₀, hS₀, rfl⟩, he_S₀⟩ := he_union.2 + have he_disc : e ⊆ α_disc S₀ := (hComp.inter_E_iff S₀ hS₀ e he).mpr he_S₀ + obtain ⟨y, hy_bar, rfl⟩ := hNorm S₀ hS₀ ⟨hxbd, he_disc hxe⟩ + have hx_bd_S₀ : α_pt y ∈ H.U ∩ subBd (α_disc S₀) := + ⟨hxU, (hArr.isClosedDisc S₀ hS₀).2 y hy_bar⟩ + rw [hComp.bd_inter_eq S₀ hS₀] at hx_bd_S₀ + exact hxnotV hx_bd_S₀.1 + +private theorem frontier_sdiff_subset (A B : Set S) : + frontier (A \ B) ⊆ frontier A ∪ frontier B := by + have h1 : A \ B = A ∩ Bᶜ := rfl + rw [h1] + refine (frontier_inter_subset A Bᶜ).trans ?_ + rintro x (⟨hx1, _⟩ | ⟨_, hx2⟩) + · exact Or.inl hx1 + · rw [frontier_compl] at hx2 + exact Or.inr hx2 + +/-- For closed discs `Δ₂ ⊆ Δ \ subBd Δ` on a closed surface `S`, the cylinder `Δ \ discInt Δ₂` is +closed, `subBd (Δ \ discInt Δ₂) = subBd Δ ∪ subBd Δ₂`, and `Disjoint (subBd Δ) (subBd Δ₂)`. -/ +theorem cylinder_closed_and_subBd [T2Space S] (hS : IsClosedSurface S) + {Δ Δ₂ : Set S} (hΔ : IsClosedDisc Δ) (hΔ₂ : IsClosedDisc Δ₂) + (hΔ₂_sub : Δ₂ ⊆ Δ \ subBd Δ) : + IsClosed (Δ \ discInt Δ₂) ∧ + subBd (Δ \ discInt Δ₂) = subBd Δ ∪ subBd Δ₂ ∧ + Disjoint (subBd Δ) (subBd Δ₂) := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hcl_Cyl : IsClosed (Δ \ discInt Δ₂) := + hΔ.isClosed.sdiff (hΔ₂.isOpen_discInt hman) + have hbd_Δ : subBd Δ = discBd Δ := IsClosedDisc.subBd_eq_discBd hS hΔ + have hbd_Δ₂ : subBd Δ₂ = discBd Δ₂ := IsClosedDisc.subBd_eq_discBd hS hΔ₂ + have hbd₂_sub : subBd Δ₂ ⊆ Δ₂ := fun x hx => Surface.discBd_subset Δ₂ (hbd_Δ₂ ▸ hx) + have hdisj_bd : Disjoint (subBd Δ) (subBd Δ₂) := + disjoint_left.mpr fun x hxΔ hxΔ₂ => (hΔ₂_sub (hbd₂_sub hxΔ₂)).2 hxΔ + obtain ⟨hOD₂, hcl_int₂, hbd_int₂⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hΔ₂ + have hdiscInt_eq : discInt Δ₂ = Δ₂ \ subBd Δ₂ := by + rw [discInt, hbd_Δ₂] + have hfr_int₂ : frontier (discInt Δ₂) = subBd Δ₂ := by + rw [hdiscInt_eq, ← subBd_eq_frontier, hbd_int₂] + have hsubBd_eq : subBd (Δ \ discInt Δ₂) = subBd Δ ∪ subBd Δ₂ := by + rw [subBd_eq_frontier, subBd_eq_frontier Δ] + apply Subset.antisymm + · intro x hx + have hx_diff := frontier_sdiff_subset Δ (discInt Δ₂) hx + rw [hfr_int₂] at hx_diff + exact hx_diff + · rintro x (hxΔ | hxΔ₂) + · have hx_in_Δ : x ∈ Δ := hΔ.isClosed.closure_eq ▸ hxΔ.1 + have hx_not_Δ₂ : x ∉ Δ₂ := fun h => (hΔ₂_sub h).2 ((subBd_eq_frontier Δ).symm ▸ hxΔ) + have hx_in_Cyl : x ∈ Δ \ discInt Δ₂ := ⟨hx_in_Δ, fun h => hx_not_Δ₂ h.1⟩ + refine ⟨subset_closure hx_in_Cyl, fun hx_int => ?_⟩ + exact hxΔ.2 (interior_mono sdiff_subset hx_int) + · have hx_in_Δ₂ : x ∈ Δ₂ := hbd₂_sub hxΔ₂ + have hx_in_Cyl : x ∈ Δ \ discInt Δ₂ := + ⟨(hΔ₂_sub hx_in_Δ₂).1, fun h => h.2 (hbd_Δ₂ ▸ hxΔ₂)⟩ + refine ⟨subset_closure hx_in_Cyl, fun hx_int => ?_⟩ + have hx_cl_int₂ : x ∈ closure (discInt Δ₂) := by + rw [hdiscInt_eq, hcl_int₂] + exact hx_in_Δ₂ + obtain ⟨y, hy_int, hy_int₂⟩ := + mem_closure_iff.mp hx_cl_int₂ (interior (Δ \ discInt Δ₂)) isOpen_interior hx_int + exact (interior_subset hy_int).2 hy_int₂ + exact ⟨hcl_Cyl, hsubBd_eq, hdisj_bd⟩ + +/-- By (6.1) (`theorem_6_1_proof`), `H' = H.interSet (Δ \ discInt Δ₂)` is a rigid drawing in the +closed +cylinder `Δ \ discInt Δ₂` when `H ∩ closure (univ \ Δ)` has a circuit `C_out` and `H` has a circuit +`C` with `C.U ⊆ Δ₂`. -/ +theorem isRigidIn_cylinder_9_6 [T2Space S] [ConnectedSpace S] {α : Type u} {β : Type v} + (hS : IsClosedSurface S) + {G' : Graph α β} {H C C_out : Drawing S} {η' : SpanEmbedding H G'} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + {Δ Δ₂ : Set S} + (hRig : IsRigid H) + (hSeg : IsThreeSegregation G' S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hΔ : IsClosedDisc Δ) (hΔ₂ : IsClosedDisc Δ₂) + (hΔ₂_sub : Δ₂ ⊆ Δ \ subBd Δ) + (hNorm_Δ : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) + (hNorm_Δ₂ : IsArrangementNormal S_seg α_disc α_pt (subBd Δ₂)) + (hCout_cir : C_out.IsCircuit) + (hCout_sub : C_out.IsSubdrawing (H.interSet (closure (univ \ Δ)))) + (hC_cir : C.IsCircuit) (hC_sub : C.IsSubdrawing H) (hCU_sub : C.U ⊆ Δ₂) : + IsRigidIn (H.interSet (Δ \ discInt Δ₂)) (Δ \ discInt Δ₂) := by + let Cyl := Δ \ discInt Δ₂ + obtain ⟨hcl_Cyl, hbd_Cyl, hdisj_bd⟩ := cylinder_closed_and_subBd hS hΔ hΔ₂ hΔ₂_sub + have hbd_Δ_HV : subBd Δ ∩ H.U ⊆ H.V := + subBd_inter_U_subset_V_of_normal hSeg hArr hComp hNorm_Δ + have hbd_Δ₂_HV : subBd Δ₂ ∩ H.U ⊆ H.V := + subBd_inter_U_subset_V_of_normal hSeg hArr hComp hNorm_Δ₂ + have hbd_Cyl_HV : subBd Cyl ∩ H.U ⊆ H.V := by + rw [hbd_Cyl, union_inter_distrib_right] + exact union_subset hbd_Δ_HV hbd_Δ₂_HV + have hbd_Δ_eq : subBd Δ = discBd Δ := IsClosedDisc.subBd_eq_discBd hS hΔ + have hbd_Δ₂_eq : subBd Δ₂ = discBd Δ₂ := IsClosedDisc.subBd_eq_discBd hS hΔ₂ + obtain ⟨hOD₂, hcl_int₂, hbd_int₂⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hΔ₂ + have hdiscInt_eq : discInt Δ₂ = Δ₂ \ subBd Δ₂ := by rw [discInt, hbd_Δ₂_eq] + refine theorem_6_1_proof hRig hcl_Cyl hbd_Cyl_HV ?_ ?_ + · intro D hD hD_bd hD_not + by_cases hD_sub_Δ : D ⊆ Δ + · have hD_not_compl : ¬ (D ⊆ univ \ discInt Δ₂) := fun hsub => + hD_not (fun x hx => ⟨hD_sub_Δ hx, (hsub hx).2⟩) + have hD_bd_compl : subBd D ⊆ univ \ discInt Δ₂ := + hD_bd.trans (fun x hx => ⟨mem_univ x, hx.2⟩) + have hO_int₂ : IsOArc (subBd (discInt Δ₂)) := by + rw [hdiscInt_eq, hbd_int₂, hbd_Δ₂_eq] + exact hΔ₂.isOArc_discBd + have hcl_int₂_disc : IsClosedDisc (closure (discInt Δ₂)) := by + rw [hdiscInt_eq, hcl_int₂] + exact hΔ₂ + obtain ⟨Δ', hΔ'_disc, hΔ'_sub_D, hΔ'_inter_compl, hΔ'_bd_compl⟩ := + subsurf_compl_openDisc hS (hdiscInt_eq ▸ hOD₂) hO_int₂ hcl_int₂_disc + hD hD_bd_compl hD_not_compl + have hΔ'_sub_Δ : Δ' ⊆ Δ := hΔ'_sub_D.trans hD_sub_Δ + have hbd_compl_eq : subBd (univ \ discInt Δ₂) = subBd Δ₂ := by + rw [subBd_eq_frontier, ← compl_eq_univ_sdiff, frontier_compl, + hdiscInt_eq, ← subBd_eq_frontier, hbd_int₂] + refine ⟨Δ', hΔ'_disc, hΔ'_sub_D, ?_, ?_⟩ + · rw [← hΔ'_inter_compl] + ext x + exact ⟨fun ⟨hxΔ', hxΔ, hxnot⟩ => ⟨hxΔ', mem_univ x, hxnot⟩, + fun ⟨hxΔ', _, hxnot⟩ => ⟨hxΔ', hΔ'_sub_Δ hxΔ', hxnot⟩⟩ + · rw [hbd_Cyl] + exact (hbd_compl_eq ▸ hΔ'_bd_compl).trans subset_union_right + · obtain ⟨Δ', hΔ'_disc, hΔ'_sub_D, hΔ'_inter_Δ, hΔ'_bd_Δ⟩ := + subsurf_closedDisc hS hΔ hD (hD_bd.trans sdiff_subset) hD_sub_Δ + refine ⟨Δ', hΔ'_disc, hΔ'_sub_D, ?_, ?_⟩ + · apply Subset.antisymm + · intro x ⟨hxΔ', hxΔ, _⟩ + exact hΔ'_inter_Δ ▸ ⟨hxΔ', hxΔ⟩ + · intro x hx_bd' + have hx_in : x ∈ Δ' ∩ Δ := hΔ'_inter_Δ.symm ▸ hx_bd' + have hx_bdΔ : x ∈ subBd Δ := hΔ'_bd_Δ hx_bd' + exact ⟨hx_in.1, hx_in.2, fun hx_int₂ => (hΔ₂_sub hx_int₂.1).2 hx_bdΔ⟩ + · rw [hbd_Cyl] + exact hΔ'_bd_Δ.trans subset_union_left + · intro Δ' hΔ' hΔ'_inter hΔ'_bd + rw [hbd_Cyl] at hΔ'_bd + have hO_Δ' : IsOArc (subBd Δ') := + IsClosedDisc.subBd_eq_discBd hS hΔ' ▸ hΔ'.isOArc_discBd + have hconn_bd' : IsPreconnected (subBd Δ') := IsOArc.isPreconnected hO_Δ' + have hcl_bdΔ : IsClosed (subBd Δ) := isClosed_closure.inter isClosed_closure + have hcl_bdΔ₂ : IsClosed (subBd Δ₂) := isClosed_closure.inter isClosed_closure + rcases subset_or_subset_of_closed hconn_bd' hcl_bdΔ hcl_bdΔ₂ hΔ'_bd + (fun x _ hx1 hx2 => disjoint_left.mp hdisj_bd hx1 hx2) with hsub_Δ | hsub_Δ₂ + · have hbd_eq : subBd Δ' = subBd Δ := + eq_of_oArc_subset hO_Δ' (hbd_Δ_eq ▸ hΔ.isOArc_discBd) hsub_Δ + have hdiscBd_eq : discBd Δ' = discBd Δ := by + rw [← IsClosedDisc.subBd_eq_discBd hS hΔ', ← hbd_Δ_eq, hbd_eq] + have hne_Δ' : Δ' ≠ Δ := by + intro hEq + subst hEq + obtain ⟨p₀, hp₀⟩ := IsOArc.nonempty (hbd_Δ₂_eq ▸ hΔ₂.isOArc_discBd) + have hp₀_Δ₂ : p₀ ∈ Δ₂ := Surface.discBd_subset Δ₂ (hbd_Δ₂_eq ▸ hp₀) + have hp₀_Cyl : p₀ ∈ Cyl := + ⟨(hΔ₂_sub hp₀_Δ₂).1, fun h => h.2 (hbd_Δ₂_eq ▸ hp₀)⟩ + have hp₀_bdΔ : p₀ ∈ subBd Δ' := hΔ'_inter ▸ ⟨(hΔ₂_sub hp₀_Δ₂).1, hp₀_Cyl⟩ + exact disjoint_left.mp hdisj_bd (hbd_eq ▸ hp₀_bdΔ) hp₀ + have hcov : Δ' ∪ Δ = univ := cover_of_discBd_eq hS hΔ' hΔ hdiscBd_eq hne_Δ' + have hcompl_sub : univ \ Δ ⊆ Δ' := + fun x ⟨hxU, hxnot⟩ => (hcov.symm ▸ hxU).resolve_right hxnot + have hcl_sub : closure (univ \ Δ) ⊆ Δ' := hΔ'.isClosed.closure_subset_iff.mpr hcompl_sub + refine ⟨C_out, hCout_cir, hCout_sub.trans (H.span_isSubdrawing _ _), ?_⟩ + intro x hx + exact hcl_sub (interSet_U_subset isClosed_closure (hCout_sub.U_subset hx)) + · have hbd_eq : subBd Δ' = subBd Δ₂ := + eq_of_oArc_subset hO_Δ' (hbd_Δ₂_eq ▸ hΔ₂.isOArc_discBd) hsub_Δ₂ + have hdiscBd_eq : discBd Δ' = discBd Δ₂ := by + rw [← IsClosedDisc.subBd_eq_discBd hS hΔ', ← hbd_Δ₂_eq, hbd_eq] + by_cases hEq : Δ' = Δ₂ + · exact ⟨C, hC_cir, hC_sub, hEq ▸ hCU_sub⟩ + · exfalso + have hcov : Δ' ∪ Δ₂ = univ := cover_of_discBd_eq hS hΔ' hΔ₂ hdiscBd_eq hEq + obtain ⟨p₁, hp₁⟩ := IsOArc.nonempty (hbd_Δ_eq ▸ hΔ.isOArc_discBd) + have hp₁_Δ : p₁ ∈ Δ := Surface.discBd_subset Δ (hbd_Δ_eq ▸ hp₁) + have hp₁_not_Δ₂ : p₁ ∉ Δ₂ := fun h => (hΔ₂_sub h).2 hp₁ + have hp₁_Δ' : p₁ ∈ Δ' := (hcov.symm ▸ mem_univ p₁).resolve_right hp₁_not_Δ₂ + have hp₁_Cyl : p₁ ∈ Cyl := ⟨hp₁_Δ, fun h => hp₁_not_Δ₂ h.1⟩ + have hp₁_bdΔ₂ : p₁ ∈ subBd Δ₂ := hbd_eq ▸ hΔ'_inter ▸ ⟨hp₁_Δ', hp₁_Cyl⟩ + exact disjoint_left.mp hdisj_bd hp₁ hp₁_bdΔ₂ + +/-! ## 2. Circuits `C₁ = H'.interSet (subBd Λ)` and `C₂` of `H'` -/ + +/-- For a closed subset `K`, `(H.interSet K).V = H.V ∩ K` and `(H.interSet K).E = {e ∈ H.E | e ⊆ +K}`. -/ +theorem interSet_V_and_E_of_isClosed [T2Space S] (H : Drawing S) {K : Set S} (hK : IsClosed K) : + (H.interSet K).V = H.V ∩ K ∧ (H.interSet K).E = {e ∈ H.E | e ⊆ K} := + ⟨H.interSet_V_of_isClosed hK, H.interSet_E K⟩ + +/-- In the cylinder `Cyl = Δ \ discInt Δ₂`, `C₁ = H'.interSet (subBd Λ)` and `C₂` are circuit +subdrawings of `H' = H.interSet Cyl` with `discBd (closure Λ) = C₁.U`, +`discBd (closure Λ_C₂) = C₂.U`, and `C₁.V = (clearedSubdrawing H Λ).V ∩ subBd Λ`. -/ +theorem circuits_cylinder_9_6 [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {H C₂ : Drawing S} {d : Set S → Set S → ℕ} {k : ℕ} {z Λ Λ_C₂ Δ Δ₂ : Set S} + (hZone : IsLambdaZoneAround H d k z Λ) + (hΔ : IsClosedDisc Δ) (hΔ₂ : IsClosedDisc Δ₂) + (hclΛ_sub_Δ : closure Λ ⊆ Δ) + (hC₂_sub : C₂.IsSubdrawing H) (hC₂_cir : C₂.IsCircuit) + (hcl_C₂_sub : closure Λ_C₂ ⊆ Λ) + (hcl_C₂_disc : IsClosedDisc (closure Λ_C₂)) + (hbd_cl_C₂ : subBd (closure Λ_C₂) = C₂.U) + (hΔ₂_sub_cl_C₂ : Δ₂ ⊆ closure Λ_C₂) : + let Cyl := Δ \ discInt Δ₂ + let H' := H.interSet Cyl + let C₁ := H'.interSet (subBd Λ) + C₁.IsCircuit ∧ C₁.IsSubdrawing H' ∧ + C₂.IsCircuit ∧ C₂.IsSubdrawing H' ∧ + discBd (closure Λ) = C₁.U ∧ + discBd (closure Λ_C₂) = C₂.U ∧ + closure Λ \ C₁.U = Λ ∧ + closure Λ_C₂ ⊆ closure Λ \ C₁.U ∧ + C₁.V = H.V ∩ subBd Λ ∧ + C₁.V = (clearedSubdrawing H Λ).V ∩ subBd Λ := by + intro Cyl H' C₁ + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hcl_Cyl : IsClosed Cyl := hΔ.isClosed.sdiff (hΔ₂.isOpen_discInt hman) + have hcl_bdΛ : IsClosed (subBd Λ) := isClosed_closure.inter isClosed_closure + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hZone.isOpenDisc.1 + have hbdΛ_sub_Cyl : subBd Λ ⊆ Cyl := by + intro x hx + refine ⟨hclΛ_sub_Δ hx.1, fun hx_int₂ => ?_⟩ + have hx_Λ : x ∈ Λ := hcl_C₂_sub (hΔ₂_sub_cl_C₂ hx_int₂.1) + exact disjoint_left.mp hdisL hx_Λ hx + have hC₁_eq : C₁ = H.interSet (subBd Λ) := + interSet_interSet_of_subset H hbdΛ_sub_Cyl + obtain ⟨C₀, hC₀_cir, hC₀_sub, hC₀_U⟩ := + exists_circuit_of_oArc hZone.isOArc_bd hZone.bd_subset_U + obtain ⟨hV_Hbd, hE_Hbd⟩ := interSet_V_and_E_of_isClosed H hcl_bdΛ + have hInter_eq_C₀ : H.interSet (subBd Λ) = C₀ := by + refine Drawing.ext_VE ?_ ?_ + · rw [hV_Hbd] + ext x + simp only [mem_inter_iff] + refine ⟨fun ⟨hxV, hxbd⟩ => ?_, fun hxC => ⟨hC₀_sub.1 hxC, hC₀_U ▸ C₀.V_subset_U hxC⟩⟩ + by_contra hxnot + obtain ⟨e, heC, hxe⟩ := C₀.exists_edge_of_mem (hC₀_U.symm ▸ hxbd) hxnot + exact ((hC₀_sub.2 heC).2.1 hxe).2 hxV + · rw [hE_Hbd] + ext e + simp only [mem_ofPred_eq] + refine ⟨fun ⟨heH, hebd⟩ => ?_, + fun heC => ⟨hC₀_sub.2 heC, hC₀_U ▸ subset_closure.trans (C₀.closure_subset_U heC)⟩⟩ + obtain ⟨x, hxe⟩ := heH.1 + have hxnotV : x ∉ C₀.V := fun hxC => (heH.2.1 hxe).2 (hC₀_sub.1 hxC) + obtain ⟨f, hfC, hxf⟩ := C₀.exists_edge_of_mem (hC₀_U.symm ▸ hebd hxe) hxnotV + have hef : e = f := arcComponent_eq heH (hC₀_sub.2 hfC) hxe hxf + exact hef ▸ hfC + have hC₁_cir : C₁.IsCircuit := hC₁_eq ▸ hInter_eq_C₀ ▸ hC₀_cir + have hC₁_sub : C₁.IsSubdrawing H' := H'.span_isSubdrawing _ _ + have hC₁_U : C₁.U = subBd Λ := by + rw [hC₁_eq, hInter_eq_C₀, hC₀_U] + have hdiscBd_clΛ : discBd (closure Λ) = C₁.U := by + rw [← IsClosedDisc.subBd_eq_discBd hS hZone.isClosedDisc_closure, + subBd_closure_eq_subBd_of_isOpenDisc hS hZone.isOpenDisc hZone.isOArc_bd + hZone.isClosedDisc_closure, hC₁_U] + have hdiscBd_clC₂ : discBd (closure Λ_C₂) = C₂.U := by + rw [← IsClosedDisc.subBd_eq_discBd hS hcl_C₂_disc, hbd_cl_C₂] + have hdiff_clΛ : closure Λ \ C₁.U = Λ := by + rw [hC₁_U] + ext y + exact ⟨fun ⟨hycl, hynot⟩ => (hclL ▸ hycl).resolve_right hynot, + fun hy => ⟨subset_closure hy, disjoint_left.mp hdisL hy⟩⟩ + -- Show `C₂.U ⊆ Cyl`, hence `C₂.IsSubdrawing H'` + have hC₂U_sub_Cyl : C₂.U ⊆ Cyl := by + intro x hx + have hx_clC₂ : x ∈ closure Λ_C₂ := by + rw [← hbd_cl_C₂] at hx + simpa only [closure_closure] using hx.1 + refine ⟨hclΛ_sub_Δ (subset_closure (hcl_C₂_sub hx_clC₂)), fun hx_int₂ => ?_⟩ + have hx_in_int_clC₂ : x ∈ discInt (closure Λ_C₂) := + discInt_mono hman hΔ₂ hΔ₂_sub_cl_C₂ hx_int₂ + exact hx_in_int_clC₂.2 (hdiscBd_clC₂ ▸ hx) + obtain ⟨hV_H', hE_H'⟩ := interSet_V_and_E_of_isClosed H hcl_Cyl + have hC₂_sub_H' : C₂.IsSubdrawing H' := by + refine ⟨fun v hv => ?_, fun e he => ?_⟩ + · rw [hV_H'] + exact ⟨hC₂_sub.1 hv, hC₂U_sub_Cyl (C₂.V_subset_U hv)⟩ + · rw [hE_H'] + exact ⟨hC₂_sub.2 he, + subset_closure.trans ((C₂.closure_subset_U he).trans hC₂U_sub_Cyl)⟩ + have hC₁_V : C₁.V = H.V ∩ subBd Λ := by + rw [hC₁_eq, hV_Hbd] + obtain ⟨hV_cl, _⟩ := clearedSubdrawing_V_and_E hZone + have hC₁_V_cl : C₁.V = (clearedSubdrawing H Λ).V ∩ subBd Λ := by + rw [hC₁_V, hV_cl] + ext x + simp only [mem_inter_iff, mem_sdiff] + exact ⟨fun ⟨hxV, hxbd⟩ => ⟨⟨hxV, disjoint_left.mp hdisL.symm hxbd⟩, hxbd⟩, + fun ⟨⟨hxV, _⟩, hxbd⟩ => ⟨hxV, hxbd⟩⟩ + exact ⟨hC₁_cir, hC₁_sub, hC₂_cir, hC₂_sub_H', hdiscBd_clΛ, hdiscBd_clC₂, + hdiff_clΛ, hdiff_clΛ.symm ▸ hcl_C₂_sub, hC₁_V, hC₁_V_cl⟩ + +/-! ## 3. Regional Distance `π + 4 ≤ regionalDistance H' C₂.U C₁.U` -/ + +/-- Any region `r' ∈ H'.R` that meets `Λ` and is not contained in `E₂ = closure Λ_C₂` lies in +`Λ \ E₂` and belongs to `H.R`. -/ +private theorem mem_R_and_subset_of_region_in_annulus [T2Space S] + {H C₁ C₂ : Drawing S} {Cyl Λ E₂ r' : Set S} + (hCyl_cl : IsClosed Cyl) + (hEdges_Cyl : ∀ e ∈ H.E, (e ∩ Cyl).Nonempty → e ⊆ Cyl) + (hΛ_open : IsOpenDisc Λ) (hE₂_disc : IsClosedDisc E₂) + (hΛ_sub_Δ : Λ ⊆ Cyl ∪ E₂) + (hC₁_sub : C₁.IsSubdrawing (H.interSet Cyl)) (hC₁_U : C₁.U = subBd Λ) + (hC₂_sub : C₂.IsSubdrawing (H.interSet Cyl)) (hC₂_U : C₂.U = subBd E₂) + (hr' : r' ∈ (H.interSet Cyl).R) + (hmeet_Λ : (r' ∩ Λ).Nonempty) + (hnot_E₂ : ¬ (r' ⊆ E₂)) : + r' ⊆ Λ \ E₂ ∧ r' ∈ H.R := by + let H' := H.interSet Cyl + obtain ⟨_, hU_H'⟩ := interSet_V_and_U_of_edges hCyl_cl hEdges_Cyl + have hr'_conn : IsPreconnected r' := region_isPreconnected hr' + have hr'_disj_U' : Disjoint r' H'.U := + disjoint_left.mpr fun x hxr => region_subset hr' hxr + have hfr_Λ : frontier Λ = C₁.U := by rw [← subBd_eq_frontier, hC₁_U] + have hfr_E₂ : frontier E₂ = C₂.U := by rw [← subBd_eq_frontier, hC₂_U] + have hr'_disj_frΛ : Disjoint r' (frontier Λ) := by + rw [hfr_Λ] + exact hr'_disj_U'.mono_right hC₁_sub.U_subset + have hr'_disj_frE₂ : Disjoint r' (frontier E₂) := by + rw [hfr_E₂] + exact hr'_disj_U'.mono_right hC₂_sub.U_subset + obtain ⟨x₀, hx₀r', hx₀Λ⟩ := hmeet_Λ + have hr'_sub_clΛ : r' ⊆ closure Λ := + subset_of_disjoint_frontier hr'_conn isClosed_closure + (hr'_disj_frΛ.mono_right frontier_closure_subset) hx₀r' (subset_closure hx₀Λ) + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open.1 + have hr'_sub_Λ : r' ⊆ Λ := by + intro x hxr + have hx_cl : x ∈ closure Λ := hr'_sub_clΛ hxr + rw [hclL] at hx_cl + exact hx_cl.resolve_right fun hx_bd => + disjoint_left.mp hr'_disj_frΛ hxr (hfr_Λ ▸ hC₁_U.symm ▸ hx_bd) + have hr'_disj_E₂ : Disjoint r' E₂ := + (subset_or_disjoint_of_frontier hE₂_disc.isClosed hr'_conn hr'_disj_frE₂).resolve_left hnot_E₂ + have hr'_sub_ann : r' ⊆ Λ \ E₂ := + fun x hxr => ⟨hr'_sub_Λ hxr, disjoint_left.mp hr'_disj_E₂ hxr⟩ + -- Show `r' ∈ H.R` using the open set `O₁ = (Λ \ E₂) \ H.U`. + let U_ann := Λ \ E₂ + have hU_ann_open : IsOpen U_ann := hΛ_open.1.sdiff hE₂_disc.isClosed + have hU_ann_sub_Cyl : U_ann ⊆ Cyl := by + intro x ⟨hxΛ, hxnotE₂⟩ + exact (hΛ_sub_Δ hxΛ).resolve_right hxnotE₂ + have hfr_ann_sub : frontier U_ann ⊆ C₁.U ∪ C₂.U := by + intro x hx + have hx_diff := frontier_sdiff_subset Λ E₂ hx + rwa [hfr_Λ, hfr_E₂] at hx_diff + have hfr_ann_H' : frontier U_ann ⊆ H'.U := + hfr_ann_sub.trans (union_subset hC₁_sub.U_subset hC₂_sub.U_subset) + have hfr_ann_H : frontier U_ann ⊆ H.U := + hfr_ann_H'.trans (hU_H' ▸ inter_subset_left) + obtain ⟨p, hp_not_U', rfl⟩ := (mem_R_iff H').mp hr' + have hp_ann : p ∈ U_ann := + hr'_sub_ann (mem_connectedComponentIn ⟨mem_univ p, hp_not_U'⟩) + have hp_not_U : p ∉ H.U := fun hpU => + hp_not_U' (hU_H'.symm ▸ ⟨hpU, hU_ann_sub_Cyl hp_ann⟩) + refine ⟨hr'_sub_ann, (mem_R_iff H).mpr ⟨p, hp_not_U, ?_⟩⟩ + apply Subset.antisymm + · refine isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn ⟨mem_univ p, hp_not_U'⟩) ?_ + intro x hxr + have hx_ann : x ∈ U_ann := hr'_sub_ann hxr + have hx_not_U' : x ∉ H'.U := (connectedComponentIn_subset _ _ hxr).2 + exact ⟨mem_univ x, fun hxU => hx_not_U' (hU_H'.symm ▸ ⟨hxU, hU_ann_sub_Cyl hx_ann⟩)⟩ + · have hcompH_disj : Disjoint (connectedComponentIn (univ \ H.U) p) (frontier U_ann) := + disjoint_left.mpr fun x hx hfr => + (connectedComponentIn_subset _ _ hx).2 (hfr_ann_H hfr) + have hcompH_sub_cl : connectedComponentIn (univ \ H.U) p ⊆ closure U_ann := + subset_of_disjoint_frontier isPreconnected_connectedComponentIn isClosed_closure + (hcompH_disj.mono_right frontier_closure_subset) + (mem_connectedComponentIn ⟨mem_univ p, hp_not_U⟩) (subset_closure hp_ann) + have hcompH_sub_ann : connectedComponentIn (univ \ H.U) p ⊆ U_ann := by + intro x hx + have hx_cl : x ∈ closure U_ann := hcompH_sub_cl hx + rw [closure_eq_interior_union_frontier, hU_ann_open.interior_eq] at hx_cl + exact hx_cl.resolve_right (disjoint_left.mp hcompH_disj hx) + refine isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn ⟨mem_univ p, hp_not_U⟩) ?_ + intro x hx + have hx_not_U : x ∉ H.U := (connectedComponentIn_subset _ _ hx).2 + exact ⟨mem_univ x, fun hxU' => hx_not_U (hU_H' ▸ hxU').1⟩ + +/-- Every region chain in `H' = H.interSet Cyl` from `E₂` to `univ \ Λ` has length at least +`regionalDistance H E₂ C₁.U`. -/ +private theorem regionalDistance_le_of_chain_in_cylinder [T2Space S] + {H C₁ C₂ : Drawing S} {Cyl Λ E₂ : Set S} + (hCyl_cl : IsClosed Cyl) + (hEdges_Cyl : ∀ e ∈ H.E, (e ∩ Cyl).Nonempty → e ⊆ Cyl) + (hΛ_open : IsOpenDisc Λ) (hE₂_disc : IsClosedDisc E₂) + (hE₂_sub_Λ : E₂ ⊆ Λ) + (hΛ_sub_Cyl : Λ ⊆ Cyl ∪ E₂) + (hC₁_sub : C₁.IsSubdrawing (H.interSet Cyl)) (hC₁_U : C₁.U = subBd Λ) + (hC₂_sub : C₂.IsSubdrawing (H.interSet Cyl)) (hC₂_U : C₂.U = subBd E₂) : + ∀ (k : ℕ) (v_seq : Fin (k + 1) → S) (r_seq : Fin k → Set S), + IsRegionChain (H.interSet Cyl) E₂ (univ \ Λ) v_seq r_seq → + regionalDistance H E₂ C₁.U ≤ k := by + intro k + induction k using Nat.strong_induction_on with + | _ k ih => + intro v_seq r_seq ⟨hv0, hvlast, hsteps⟩ + rcases k with _ | m + · exfalso + have h0 : Fin.last 0 = (0 : Fin 1) := rfl + rw [h0] at hvlast + exact hvlast.2 (hE₂_sub_Λ hv0) + · by_cases hv1 : v_seq 1 ∈ E₂ + · let v' : Fin (m + 1) → S := fun i => v_seq i.succ + let r' : Fin m → Set S := fun i => r_seq i.succ + have hc' : IsRegionChain (H.interSet Cyl) E₂ (univ \ Λ) v' r' := + ⟨hv1, hvlast, fun i => hsteps i.succ⟩ + exact (ih m (Nat.lt_succ_self m) v' r' hc').trans (Nat.le_succ m) + · by_cases hvm : v_seq (Fin.castSucc (Fin.last m)) ∈ univ \ Λ + · let v' : Fin (m + 1) → S := fun i => v_seq i.castSucc + let r' : Fin m → Set S := fun i => r_seq i.castSucc + have hc' : IsRegionChain (H.interSet Cyl) E₂ (univ \ Λ) v' r' := + ⟨hv0, hvm, fun i => hsteps i.castSucc⟩ + exact (ih m (Nat.lt_succ_self m) v' r' hc').trans (Nat.le_succ m) + · by_cases hex_E₂ : ∃ i : Fin (m + 1), v_seq i.succ ∈ E₂ + · obtain ⟨i, hi_E₂⟩ := hex_E₂ + have hi_pos : 0 < i.1 := by + by_contra h0 + have hi0 : i.succ = 1 := Fin.ext (by simp [Nat.eq_zero_of_not_pos h0]) + exact hv1 (hi0 ▸ hi_E₂) + let k' := m - i.1 + have hk'_lt : k' < m + 1 := by omega + let v' : Fin (k' + 1) → S := fun j => v_seq ⟨i.1 + 1 + j.1, by omega⟩ + let r' : Fin k' → Set S := fun j => r_seq ⟨i.1 + 1 + j.1, by omega⟩ + have hc' : IsRegionChain (H.interSet Cyl) E₂ (univ \ Λ) v' r' := by + refine ⟨?_, ?_, fun j => ?_⟩ + · change v_seq ⟨i.1 + 1 + 0, _⟩ ∈ E₂ + have h_idx : (⟨i.1 + 1 + 0, by omega⟩ : Fin (m + 2)) = i.succ := + Fin.ext (by simp) + rwa [h_idx] + · change v_seq ⟨i.1 + 1 + k', _⟩ ∈ univ \ Λ + have h_idx : (⟨i.1 + 1 + k', by omega⟩ : Fin (m + 2)) = Fin.last (m + 1) := + Fin.ext (by simp [k']; omega) + rwa [h_idx] + · have h_step := hsteps ⟨i.1 + 1 + j.1, by omega⟩ + exact h_step + exact (ih k' hk'_lt v' r' hc').trans (by omega) + · by_cases hex_out : ∃ i : Fin (m + 1), v_seq i.castSucc ∈ univ \ Λ + · obtain ⟨i, hi_out⟩ := hex_out + have hi_pos : 0 < i.1 := by + by_contra h0 + have hi0 : i.castSucc = 0 := Fin.ext (by simp [Nat.eq_zero_of_not_pos h0]) + exact (hi0 ▸ hi_out).2 (hE₂_sub_Λ hv0) + have hi_lt : i.1 < m + 1 := i.2 + let v' : Fin (i.1 + 1) → S := fun j => v_seq ⟨j.1, by omega⟩ + let r' : Fin i.1 → Set S := fun j => r_seq ⟨j.1, by omega⟩ + have hc' : IsRegionChain (H.interSet Cyl) E₂ (univ \ Λ) v' r' := by + refine ⟨hv0, ?_, fun j => hsteps ⟨j.1, by omega⟩⟩ + change v_seq ⟨i.1, _⟩ ∈ univ \ Λ + exact hi_out + exact (ih i.1 hi_lt v' r' hc').trans (by omega) + · push Not at hex_E₂ hex_out + have hr_in_H : ∀ i : Fin (m + 1), r_seq i ⊆ Λ \ E₂ ∧ r_seq i ∈ H.R := by + intro i + have hvi_Λ : v_seq i.castSucc ∈ Λ := by + by_contra hnot + exact hex_out i ⟨mem_univ _, hnot⟩ + have hvi_cl : v_seq i.castSucc ∈ closure (r_seq i) := (hsteps i).2.1 + have hmeet_Λ : (r_seq i ∩ Λ).Nonempty := by + obtain ⟨y, hyΛ, hyr⟩ := + mem_closure_iff.mp hvi_cl Λ hΛ_open.1 hvi_Λ + exact ⟨y, hyr, hyΛ⟩ + have hnot_E₂ : ¬ (r_seq i ⊆ E₂) := fun hsub => + hex_E₂ i (hE₂_disc.isClosed.closure_subset_iff.mpr hsub (hsteps i).2.2) + exact mem_R_and_subset_of_region_in_annulus hCyl_cl hEdges_Cyl + hΛ_open hE₂_disc hΛ_sub_Cyl hC₁_sub hC₁_U hC₂_sub hC₂_U + (hsteps i).1 hmeet_Λ hnot_E₂ + have hvlast_C₁ : v_seq (Fin.last (m + 1)) ∈ C₁.U := by + have hlast_cl : v_seq (Fin.last (m + 1)) ∈ closure (r_seq (Fin.last m)) := + (hsteps (Fin.last m)).2.2 + have hr_sub_Λ : r_seq (Fin.last m) ⊆ Λ := + (hr_in_H (Fin.last m)).1.trans sdiff_subset + have hlast_clΛ : v_seq (Fin.last (m + 1)) ∈ closure Λ := + closure_mono hr_sub_Λ hlast_cl + obtain ⟨_, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open.1 + rw [hclL] at hlast_clΛ + rw [hC₁_U] + exact hlast_clΛ.resolve_left hvlast.2 + have hc_H : IsRegionChain H E₂ C₁.U v_seq r_seq := + ⟨hv0, hvlast_C₁, fun i => ⟨(hr_in_H i).2, (hsteps i).2.1, (hsteps i).2.2⟩⟩ + exact regionalDistance_le hc_H + +/-- In `H' = H.interSet (Δ \ discInt Δ₂)`, the regional distance `regionalDistance H' C₂.U C₁.U` +is at least `π + 4`. -/ +theorem regionalDistance_cylinder_9_6 [T2Space S] [ConnectedSpace S] {α : Type u} {β : Type v} + (hS : IsClosedSurface S) + {G' : Graph α β} {H C₁ C₂ : Drawing S} {η' : SpanEmbedding H G'} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + {Λ Λ_C₂ Δ Δ₂ : Set S} {π beta : ℕ} + (hSeg : IsThreeSegregation G' S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hΔ : IsClosedDisc Δ) (hΔ₂ : IsClosedDisc Δ₂) + (hNorm_Δ : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) + (hNorm_Δ₂ : IsArrangementNormal S_seg α_disc α_pt (subBd Δ₂)) + (hΛ_open : IsOpenDisc Λ) (hclΛ_sub_Δ : closure Λ ⊆ Δ) + (hcl_C₂_sub : closure Λ_C₂ ⊆ Λ) (hcl_C₂_disc : IsClosedDisc (closure Λ_C₂)) + (hbd_cl_C₂ : subBd (closure Λ_C₂) = C₂.U) + (hΔ₂_sub_cl_C₂ : Δ₂ ⊆ closure Λ_C₂) + (hC₁_cir : C₁.IsCircuit) (hC₁_sub : C₁.IsSubdrawing (H.interSet (Δ \ discInt Δ₂))) + (hC₁_U : C₁.U = subBd Λ) + (hC₂_cir : C₂.IsCircuit) (hC₂_sub : C₂.IsSubdrawing (H.interSet (Δ \ discInt Δ₂))) + (hbeta : 2 * π + 8 ≤ beta) + (hdist : beta / 2 ≤ regionalDistance H (closure Λ_C₂) (subBd Λ)) : + π + 4 ≤ regionalDistance (H.interSet (Δ \ discInt Δ₂)) C₂.U C₁.U := by + let Cyl := Δ \ discInt Δ₂ + let H' := H.interSet Cyl + let E₂ := closure Λ_C₂ + have hΔ₂_sub : Δ₂ ⊆ Δ \ subBd Δ := by + have hΛ_sub_int : Λ ⊆ Δ \ subBd Δ := by + intro x hxΛ + refine ⟨hclΛ_sub_Δ (subset_closure hxΛ), fun hx_bd => ?_⟩ + obtain ⟨y, hyΛ, hyn⟩ := mem_closure_iff.mp hx_bd.2 Λ hΛ_open.1 hxΛ + exact hyn.2 (hclΛ_sub_Δ (subset_closure hyΛ)) + exact hΔ₂_sub_cl_C₂.trans (hcl_C₂_sub.trans hΛ_sub_int) + obtain ⟨hcl_Cyl, hbd_Cyl, _⟩ := cylinder_closed_and_subBd hS hΔ hΔ₂ hΔ₂_sub + have hbd_Cyl_HV : subBd Cyl ∩ H.U ⊆ H.V := by + rw [hbd_Cyl, union_inter_distrib_right] + exact union_subset + (subBd_inter_U_subset_V_of_normal hSeg hArr hComp hNorm_Δ) + (subBd_inter_U_subset_V_of_normal hSeg hArr hComp hNorm_Δ₂) + have hEdges_Cyl : ∀ e ∈ H.E, (e ∩ Cyl).Nonempty → e ⊆ Cyl := + fun e he hne => edge_subset_of_inter_nonempty hcl_Cyl hbd_Cyl_HV he hne + have hΛ_sub_Cyl : Λ ⊆ Cyl ∪ E₂ := by + intro x hx + by_cases hxE₂ : x ∈ E₂ + · exact Or.inr hxE₂ + · refine Or.inl ⟨hclΛ_sub_Δ (subset_closure hx), fun hx_int₂ => ?_⟩ + exact hxE₂ (hΔ₂_sub_cl_C₂ hx_int₂.1) + have hC₂_ne : C₂.U.Nonempty := IsOArc.nonempty (isOArc_of_isCircuit hC₂_cir) + have hC₁_ne : C₁.U.Nonempty := IsOArc.nonempty (isOArc_of_isCircuit hC₁_cir) + obtain ⟨v_seq, r_seq, hc⟩ := regionalDistance_spec hS H' hC₂_ne hC₁_ne + have hv0_E₂ : v_seq 0 ∈ E₂ := by + have hv0_bd : v_seq 0 ∈ subBd E₂ := hbd_cl_C₂.symm ▸ hc.1 + simpa only [E₂, closure_closure] using hv0_bd.1 + obtain ⟨hdisL, _⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open.1 + have hvlast_out : v_seq (Fin.last (regionalDistance H' C₂.U C₁.U)) ∈ univ \ Λ := by + have hv_bd : v_seq (Fin.last _) ∈ subBd Λ := hC₁_U ▸ hc.2.1 + exact ⟨mem_univ _, disjoint_right.mp hdisL hv_bd⟩ + have hc' : IsRegionChain H' E₂ (univ \ Λ) v_seq r_seq := ⟨hv0_E₂, hvlast_out, hc.2.2⟩ + have hle := regionalDistance_le_of_chain_in_cylinder hcl_Cyl hEdges_Cyl hΛ_open hcl_C₂_disc + hcl_C₂_sub hΛ_sub_Cyl hC₁_sub hC₁_U hC₂_sub hbd_cl_C₂.symm + (regionalDistance H' C₂.U C₁.U) v_seq r_seq hc' + rw [← hC₁_U] at hdist + change π + 4 ≤ regionalDistance H' C₂.U C₁.U + omega + +/-! ## 4. Truncating the Battlefield Paths to Cylinder Paths from `X_bf` to `C₂.V` -/ + +/-- Along a simple walk `W` in `H.toGraph` starting at `a ∈ closure Λ` and ending at `v`, if no +vertex `x ≠ v` of `W` is in `subBd Λ` and every edge of `W` is disjoint from `subBd Λ`, then every +vertex of `W` lies in `closure Λ` and every edge of `W` lies in `Λ`. -/ +private theorem walk_in_closure_and_edges_in_open {H : Drawing S} {Λ : Set S} + (hΛ_open : IsOpen Λ) {a v : S} (W : GraphWalk H.toGraph a v) + (hW : W.IsSimple) (ha : a ∈ closure Λ) + (hV_bd : ∀ x ∈ W.support, x ∈ subBd Λ → x = v) + (hE_bd : ∀ e ∈ W.edges, Disjoint e (subBd Λ)) : + (∀ x ∈ W.support, x ∈ closure Λ) ∧ (∀ e ∈ W.edges, e ⊆ Λ) := by + obtain ⟨_, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open + induction W with + | nil _ => + exact ⟨fun x hx => (List.mem_singleton.mp hx) ▸ ha, fun _ he => False.elim + (List.not_mem_nil he)⟩ + | @cons a c v e hl r ih => + have ha_not_r : a ∉ r.support := (List.nodup_cons.mp hW).1 + have ha_ne_v : a ≠ v := fun h => ha_not_r (h ▸ r.end_mem_support) + have ha_not_bd : a ∉ subBd Λ := fun hbd => ha_ne_v (hV_bd a List.mem_cons_self hbd) + have ha_Λ : a ∈ Λ := (hclL ▸ ha).resolve_right ha_not_bd + have he_H : e ∈ H.E := hl.1 + have ha_cl_e : a ∈ closure e := by + have : a ∈ closure e ∩ H.V := hl.2.2.2 ▸ Or.inl rfl + exact this.1 + have hc_cl_e : c ∈ closure e := by + have : c ∈ closure e ∩ H.V := hl.2.2.2 ▸ Or.inr rfl + exact this.1 + obtain ⟨p, hpΛ, hpe⟩ := mem_closure_iff.mp ha_cl_e Λ hΛ_open ha_Λ + have hdis_fr : Disjoint e (frontier Λ) := by + rw [← subBd_eq_frontier] + exact hE_bd e List.mem_cons_self + have he_sub_cl : e ⊆ closure Λ := + subset_of_disjoint_frontier he_H.2.2.1.isConnected.isPreconnected isClosed_closure + (hdis_fr.mono_right frontier_closure_subset) hpe (subset_closure hpΛ) + have he_sub_Λ : e ⊆ Λ := fun y hye => + (hclL ▸ he_sub_cl hye).resolve_right + (disjoint_left.mp (hE_bd e List.mem_cons_self) hye) + have hc_cl_Λ : c ∈ closure Λ := closure_mono he_sub_Λ hc_cl_e + obtain ⟨ihV, ihE⟩ := ih hW.of_cons hc_cl_Λ + (fun x hx => hV_bd x (List.mem_cons_of_mem a hx)) + (fun f hf => hE_bd f (List.mem_cons_of_mem e hf)) + refine ⟨fun x hx => ?_, fun f hf => ?_⟩ + · rcases List.mem_cons.mp hx with rfl | hxr + · exact ha + · exact ihV x hxr + · rcases List.mem_cons.mp hf with rfl | hfr + · exact he_sub_Λ + · exact ihE f hfr + +/-- Any simple walk `W` in `H.toGraph` from `a ∉ closure Λ_C₂` to `b ∈ closure Λ_C₂` has a simple +prefix `W'` from `a` to some `y ∈ C₂.V` such that no vertex of `W'` lies in `Λ_C₂` and every edge +of `W'` lies in `univ \ closure Λ_C₂`. -/ +private theorem exists_prefix_to_C₂ {H C₂ : Drawing S} {Λ_C₂ : Set S} + (hC₂_sub : C₂.IsSubdrawing H) (hOpen_C₂ : IsOpen Λ_C₂) + (hbd_cl_C₂ : subBd (closure Λ_C₂) = C₂.U) (hdiff_C₂ : closure Λ_C₂ \ C₂.U = Λ_C₂) + {a b : S} (W : GraphWalk H.toGraph a b) (hW : W.IsSimple) + (ha : a ∉ closure Λ_C₂) (hb : b ∈ closure Λ_C₂) : + ∃ (y : S) (W' : GraphWalk H.toGraph a y), + y ∈ C₂.V ∧ W'.IsSimple ∧ + (∀ x ∈ W'.support, x ∈ W.support ∧ x ∉ Λ_C₂) ∧ + (∀ e ∈ W'.edges, e ∈ W.edges ∧ e ⊆ univ \ closure Λ_C₂) := by + induction W with + | nil _ => exact absurd hb ha + | @cons a c _ e hl r ih => + have he_H : e ∈ H.E := hl.1 + have hc_V : c ∈ H.V := hl.2.2.1 + have ha_cl_e : a ∈ closure e := by + have : a ∈ closure e ∩ H.V := hl.2.2.2 ▸ Or.inl rfl + exact this.1 + have hc_cl_e : c ∈ closure e := by + have : c ∈ closure e ∩ H.V := hl.2.2.2 ▸ Or.inr rfl + exact this.1 + have hdis_C₂ : Disjoint e C₂.U := by + refine disjoint_left.mpr fun p hpe hpC₂ => ?_ + have hp_not_V : p ∉ C₂.V := fun hpV => (he_H.2.1 hpe).2 (hC₂_sub.1 hpV) + obtain ⟨f, hfC₂, hpf⟩ := C₂.exists_edge_of_mem hpC₂ hp_not_V + have hef : e = f := arcComponent_eq he_H (hC₂_sub.2 hfC₂) hpe hpf + have ha_C₂ : a ∈ C₂.U := C₂.closure_subset_U (hef ▸ hfC₂) ha_cl_e + have ha_cl : a ∈ closure Λ_C₂ := by + rw [← hbd_cl_C₂] at ha_C₂ + simpa only [closure_closure] using ha_C₂.1 + exact ha ha_cl + obtain ⟨z, hzc, hze⟩ := + mem_closure_iff.mp ha_cl_e (closure Λ_C₂)ᶜ isClosed_closure.isOpen_compl ha + have he_cov : e ⊆ Λ_C₂ ∪ (closure Λ_C₂)ᶜ := by + intro p hpe + by_cases hp_cl : p ∈ closure Λ_C₂ + · exact Or.inl (hdiff_C₂ ▸ ⟨hp_cl, disjoint_left.mp hdis_C₂ hpe⟩) + · exact Or.inr hp_cl + have hdis_open : Disjoint Λ_C₂ (closure Λ_C₂)ᶜ := + disjoint_left.mpr fun p hpΛ hpc => hpc (subset_closure hpΛ) + have he_sub_compl : e ⊆ (closure Λ_C₂)ᶜ := + he_H.2.2.1.isConnected.isPreconnected.subset_right_of_subset_union + hOpen_C₂ isClosed_closure.isOpen_compl hdis_open he_cov ⟨z, hze, hzc⟩ + have he_sub_sdiff : e ⊆ univ \ closure Λ_C₂ := fun p hpe => ⟨mem_univ p, he_sub_compl hpe⟩ + have hc_not_Λ : c ∉ Λ_C₂ := fun hcΛ => by + obtain ⟨w, hwΛ, hwe⟩ := mem_closure_iff.mp hc_cl_e Λ_C₂ hOpen_C₂ hcΛ + exact he_sub_compl hwe (subset_closure hwΛ) + by_cases hc : c ∈ closure Λ_C₂ + · have hc_C₂U : c ∈ C₂.U := by + by_contra hnot + exact hc_not_Λ (hdiff_C₂ ▸ ⟨hc, hnot⟩) + have hc_C₂V : c ∈ C₂.V := by + by_contra hnot + obtain ⟨f, hfC₂, hcf⟩ := C₂.exists_edge_of_mem hc_C₂U hnot + exact ((hC₂_sub.2 hfC₂).2.1 hcf).2 hc_V + let W' : GraphWalk H.toGraph a c := GraphWalk.cons hl (GraphWalk.nil hc_V) + have ha_ne_c : a ≠ c := fun hEq => ha (hEq ▸ hc) + have hW'_simple : W'.IsSimple := + List.nodup_cons.mpr ⟨fun ha_in => ha_ne_c (List.mem_singleton.mp ha_in), + List.nodup_singleton c⟩ + refine ⟨c, W', hc_C₂V, hW'_simple, ?_, ?_⟩ + · intro x hx + rcases List.mem_cons.mp hx with rfl | hx' + · exact ⟨List.mem_cons_self, fun haΛ => ha (subset_closure haΛ)⟩ + · rcases List.mem_singleton.mp hx' with rfl + exact ⟨List.mem_cons_of_mem a r.start_mem_support, hc_not_Λ⟩ + · intro f hf + rcases List.mem_singleton.mp hf with rfl + exact ⟨List.mem_cons_self, he_sub_sdiff⟩ + · obtain ⟨y, W₀, hy, hW₀, hsupp₀, hedges₀⟩ := ih hW.of_cons hc hb + let W' : GraphWalk H.toGraph a y := GraphWalk.cons hl W₀ + have ha_not_W₀ : a ∉ W₀.support := + fun ha₀ => (List.nodup_cons.mp hW).1 (hsupp₀ a ha₀).1 + have hW'_simple : W'.IsSimple := List.nodup_cons.mpr ⟨ha_not_W₀, hW₀⟩ + refine ⟨y, W', hy, hW'_simple, ?_, ?_⟩ + · intro x hx + rcases List.mem_cons.mp hx with rfl | hx₀ + · exact ⟨List.mem_cons_self, fun haΛ => ha (subset_closure haΛ)⟩ + · exact ⟨List.mem_cons_of_mem a (hsupp₀ x hx₀).1, (hsupp₀ x hx₀).2⟩ + · intro f hf + rcases List.mem_cons.mp hf with rfl | hf₀ + · exact ⟨List.mem_cons_self, he_sub_sdiff⟩ + · exact ⟨List.mem_cons_of_mem e (hedges₀ f hf₀).1, (hedges₀ f hf₀).2⟩ + +/-- From the `beta` disjoint battlefield paths `P_bf` in `H` between `C.V` and `X_bf` +(`2 * π + 8 ≤ beta`), construct `2 * π + 8` vertex-disjoint graph paths `P` in +`(H.interSet (Δ \ discInt Δ₂)).toGraph` from `X_bf` to `C₂.V` meeting `C₁.V` only at their start +vertices. -/ +theorem exists_cylinder_paths_9_6 [T2Space S] (hS : IsClosedSurface S) + {H C C₁ C₂ : Drawing S} {Λ Λ_C₂ Δ Δ₂ X_bf : Set S} {π beta : ℕ} + (hΛ_open : IsOpenDisc Λ) (hclΛ_sub_Δ : closure Λ ⊆ Δ) + (hΔ : IsClosedDisc Δ) (hΔ₂ : IsClosedDisc Δ₂) + (hOpen_C₂ : IsOpenDisc Λ_C₂) (hcl_C₂_sub : closure Λ_C₂ ⊆ Λ) + (hbd_cl_C₂ : subBd (closure Λ_C₂) = C₂.U) + (hdiff_C₂ : closure Λ_C₂ \ C₂.U = Λ_C₂) + (hΔ₂_sub_cl_C₂ : Δ₂ ⊆ closure Λ_C₂) + (hC_sub_Δ₂ : C.U ⊆ Δ₂) + (hC₁_V : C₁.V = H.V ∩ subBd Λ) + (hC₂_sub : C₂.IsSubdrawing H) + (hX_bf_sub : X_bf ⊆ H.V ∩ subBd Λ) + (hbeta : 2 * π + 8 ≤ beta) + (P_bf : Fin beta → Drawing S) + (hP_bf : ∀ k, ∃ u ∈ C.V, ∃ v ∈ X_bf, + (P_bf k).IsPathBetween u v ∧ (P_bf k).IsSubdrawing H ∧ + (P_bf k).U ∩ (H.U ∩ subBd Λ) = {v}) + (hDisj_bf : Pairwise (fun i j => Disjoint (P_bf i).V (P_bf j).V)) : + let H' := H.interSet (Δ \ discInt Δ₂) + X_bf ⊆ C₁.V ∧ + ∃ P : Fin (2 * π + 8) → Graph S (Set S), + (∀ i, ∃ x ∈ X_bf, ∃ y ∈ C₂.V, + IsGraphPathWithEnds H'.toGraph (P i) x y ∧ V(P i) ∩ C₁.V = {x}) ∧ + Pairwise (fun i j => Disjoint V(P i) V(P j)) := by + intro H' + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hcl_Cyl : IsClosed (Δ \ discInt Δ₂) := hΔ.isClosed.sdiff (hΔ₂.isOpen_discInt hman) + obtain ⟨hV_H', hE_H'⟩ := interSet_V_and_E_of_isClosed H hcl_Cyl + obtain ⟨hdisL, _⟩ := isOpen_disjoint_subBd_and_closure_eq hΛ_open.1 + have hdiscInt_sub_Λ_C₂ : discInt Δ₂ ⊆ Λ_C₂ := by + intro x hx + rw [← hdiff_C₂] + refine ⟨hΔ₂_sub_cl_C₂ hx.1, fun hxC₂ => ?_⟩ + rw [← hbd_cl_C₂] at hxC₂ + obtain ⟨y, hyint, hynot⟩ := + mem_closure_iff.mp hxC₂.2 (discInt Δ₂) (hΔ₂.isOpen_discInt hman) hx + exact hynot.2 (hΔ₂_sub_cl_C₂ hyint.1) + have hstep : ∀ i : Fin (2 * π + 8), + let k : Fin beta := ⟨i.1, by omega⟩ + ∃ x ∈ X_bf, ∃ y ∈ C₂.V, ∃ P_i : Graph S (Set S), + IsGraphPathWithEnds H'.toGraph P_i x y ∧ + V(P_i) ∩ C₁.V = {x} ∧ + V(P_i) ⊆ (P_bf k).V := by + intro i + let k : Fin beta := ⟨i.1, by omega⟩ + obtain ⟨u, huC, v, hvX, ⟨W₀, hW₀_simple, hV_P, hE_P⟩, hP_sub, hP_bd⟩ := hP_bf k + obtain ⟨W₁, hW₁_supp, hW₁_edges⟩ := hP_sub.exists_walk_up W₀ + have hW₁_simple : W₁.IsSimple := by + unfold GraphWalk.IsSimple + rw [hW₁_supp] + exact hW₀_simple + have hu_cl_Λ : u ∈ closure Λ := + subset_closure (hcl_C₂_sub (hΔ₂_sub_cl_C₂ (hC_sub_Δ₂ (C.V_subset_U huC)))) + have hV_bd : ∀ x ∈ W₁.support, x ∈ subBd Λ → x = v := by + intro x hx hx_bd + have hx_PV : x ∈ (P_bf k).V := by + rw [hV_P, mem_ofPred_eq, ← hW₁_supp] + exact hx + have hx_inter : x ∈ (P_bf k).U ∩ (H.U ∩ subBd Λ) := + ⟨(P_bf k).V_subset_U hx_PV, H.V_subset_U (hP_sub.1 hx_PV), hx_bd⟩ + rw [hP_bd, mem_singleton_iff] at hx_inter + exact hx_inter + have hE_bd : ∀ e ∈ W₁.edges, Disjoint e (subBd Λ) := by + intro e he + have he_PE : e ∈ (P_bf k).E := by + rw [hE_P, mem_ofPred_eq, ← hW₁_edges] + exact he + refine disjoint_left.mpr fun x hxe hx_bd => ?_ + have hx_inter : x ∈ (P_bf k).U ∩ (H.U ∩ subBd Λ) := + ⟨(P_bf k).closure_subset_U he_PE (subset_closure hxe), + ((hP_sub.2 he_PE).2.1 hxe).1, hx_bd⟩ + rw [hP_bd, mem_singleton_iff] at hx_inter + exact ((hP_sub.2 he_PE).2.1 hxe).2 (hx_inter ▸ (hX_bf_sub hvX).1) + obtain ⟨hW₁_in_cl, hW₁_edges_Λ⟩ := + walk_in_closure_and_edges_in_open hΛ_open.1 W₁ hW₁_simple hu_cl_Λ hV_bd hE_bd + let W₂ : GraphWalk H.toGraph v u := W₁.reverse + have hW₂_simple : W₂.IsSimple := hW₁_simple.reverse + have hv_not_clC₂ : v ∉ closure Λ_C₂ := fun hv_cl => + disjoint_left.mp hdisL (hcl_C₂_sub hv_cl) (hX_bf_sub hvX).2 + have hu_clC₂ : u ∈ closure Λ_C₂ := hΔ₂_sub_cl_C₂ (hC_sub_Δ₂ (C.V_subset_U huC)) + obtain ⟨y, W₃, hyC₂, hW₃_simple, hW₃_supp, hW₃_edges⟩ := + exists_prefix_to_C₂ hC₂_sub hOpen_C₂.1 hbd_cl_C₂ hdiff_C₂ W₂ hW₂_simple hv_not_clC₂ hu_clC₂ + have hW₃_V_H' : ∀ x ∈ W₃.support, x ∈ H'.V := by + intro x hx + obtain ⟨hx_W₂, hx_not_ΛC₂⟩ := hW₃_supp x hx + have hx_W₁ : x ∈ W₁.support := by + rw [GraphWalk.support_reverse, List.mem_reverse] at hx_W₂ + exact hx_W₂ + rw [hV_H'] + exact ⟨W₃.mem_vertexSet_of_mem_support hx, + hclΛ_sub_Δ (hW₁_in_cl x hx_W₁), fun hx_int => hx_not_ΛC₂ (hdiscInt_sub_Λ_C₂ hx_int)⟩ + have hW₃_E_H' : ∀ e ∈ W₃.edges, e ∈ H'.E := by + intro e he + obtain ⟨he_W₂, he_not_clC₂⟩ := hW₃_edges e he + have he_W₁ : e ∈ W₁.edges := by + rw [GraphWalk.edges_reverse, List.mem_reverse] at he_W₂ + exact he_W₂ + rw [hE_H'] + refine ⟨walk_edges_subset_edgeSet W₃ e he, fun p hpe => ?_⟩ + exact ⟨hclΛ_sub_Δ (subset_closure (hW₁_edges_Λ e he_W₁ hpe)), + fun hp_int => (he_not_clC₂ hpe).2 (hΔ₂_sub_cl_C₂ hp_int.1)⟩ + obtain ⟨W₄, hW₄_supp, _⟩ := (H.span_isSubdrawing _ _).exists_walk_down W₃ hW₃_V_H' hW₃_E_H' + have hW₄_simple : W₄.IsSimple := by + unfold GraphWalk.IsSimple + rw [hW₄_supp] + exact hW₃_simple + let P_i : Graph S (Set S) := walkSubgraph W₄ + have hPath_i : IsGraphPathWithEnds H'.toGraph P_i v y := + isGraphPathWithEnds_walkSubgraph hW₄_simple + have hVP_sub : V(P_i) ⊆ (P_bf k).V := by + intro x hx + rw [vertexSet_walkSubgraph, mem_ofPred_eq, hW₄_supp] at hx + have hx_W₂ : x ∈ W₂.support := (hW₃_supp x hx).1 + rw [GraphWalk.support_reverse, List.mem_reverse, hW₁_supp] at hx_W₂ + rw [hV_P] + exact hx_W₂ + have hVP_inter : V(P_i) ∩ C₁.V = {v} := by + ext x + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hxP, hxC₁⟩ => ?_, fun hEq => ?_⟩ + · have hx_W₃ : x ∈ W₃.support := by + rw [vertexSet_walkSubgraph, mem_ofPred_eq, hW₄_supp] at hxP + exact hxP + have hx_W₁ : x ∈ W₁.support := by + have hx_W₂ := (hW₃_supp x hx_W₃).1 + rwa [GraphWalk.support_reverse, List.mem_reverse] at hx_W₂ + exact hV_bd x hx_W₁ (hC₁_V ▸ hxC₁).2 + · subst hEq + exact ⟨hPath_i.left_mem, hC₁_V.symm ▸ hX_bf_sub hvX⟩ + exact ⟨v, hvX, y, hyC₂, P_i, hPath_i, hVP_inter, hVP_sub⟩ + choose x hx y hy P hPath hInter hSub using hstep + refine ⟨hC₁_V.symm ▸ hX_bf_sub, P, fun i => ⟨x i, hx i, y i, hy i, hPath i, hInter i⟩, ?_⟩ + intro i j hij + have hk_ne : (⟨i.1, by omega⟩ : Fin beta) ≠ ⟨j.1, by omega⟩ := + fun h => hij (Fin.ext (Fin.mk.inj_iff.mp h)) + exact (hDisj_bf hk_ne).mono (hSub i) (hSub j) + +/-! ## 5. Cylinder Society Composition and 3-Segregation for (9.6) -/ + +/-- Given nested closed discs `Δ₂ ⊆ Δ \ subBd Δ` on a closed surface `S`, there are inverse +continuous maps `c : ℂ → S` and `c' : S → ℂ` between `closedBall 0 2` and `Δ` such that +`c '' closedBall 0 1 = Δ₂`, `c '' sphere 0 2 = discBd Δ`, and `c '' sphere 0 1 = discBd Δ₂`. -/ +private theorem exists_collar_coords (hS : IsClosedSurface S) + {Δ Δ₂ : Set S} (hΔ : IsClosedDisc Δ) (hΔ₂ : IsClosedDisc Δ₂) + (hin : Δ₂ ⊆ Δ \ subBd Δ) : + ∃ (c : ℂ → S) (c' : S → ℂ), + ContinuousOn c (Metric.closedBall 0 2) ∧ ContinuousOn c' Δ ∧ + MapsTo c (Metric.closedBall 0 2) Δ ∧ MapsTo c' Δ (Metric.closedBall 0 2) ∧ + LeftInvOn c' c (Metric.closedBall 0 2) ∧ RightInvOn c' c Δ ∧ + c '' Metric.closedBall 0 1 = Δ₂ ∧ + c '' Metric.sphere 0 2 = discBd Δ ∧ + c '' Metric.sphere 0 1 = discBd Δ₂ := by + have hin' : Δ₂ ⊆ Δ \ discBd Δ := IsClosedDisc.subBd_eq_discBd hS hΔ ▸ hin + obtain ⟨p⟩ := hΔ₂.isOArc_discBd + obtain ⟨c, c', hc, hc', hmc, hmc', hleft, hright, hΔ₂_eq, hbdΔ_eq, hp_eq⟩ := + exists_disc_collar hΔ₂ hΔ hin' p + refine ⟨c, c', hc, hc', hmc, hmc', hleft, hright, hΔ₂_eq, hbdΔ_eq, ?_⟩ + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + let w : Circle := ⟨z, by simpa [Submonoid.unitSphere] using hz⟩ + have hcw : c z = (p w).1 := hp_eq w + rw [hcw] + exact (p w).2 + · intro hx + let w : Circle := p.symm ⟨x, hx⟩ + refine ⟨w.1, mem_sphere_zero_iff_norm.mpr (Circle.norm_coe w), ?_⟩ + rw [hp_eq w, Homeomorph.apply_symm_apply] + +/-- Given collar coordinates `(c, c')` for `Δ₂ ⊆ Δ \ subBd Δ` on a closed surface `S`, a boundary +point `p ∈ subBd Δ ∪ subBd Δ₂`, an open neighborhood `U_open` of `p`, and `ε > 0`, there is a +closed disc `D ⊆ (Δ \ discInt Δ₂) ∩ U_open` such that `p ∈ subBd D` and +`∀ x ∈ D, dist (c' x) (c' p) < ε`. -/ +private theorem exists_small_collar_disc (hS : IsClosedSurface S) + {Δ Δ₂ U_open : Set S} {c : ℂ → S} {c' : S → ℂ} {p : S} {ε : ℝ} + (hΔ : IsClosedDisc Δ) (hΔ₂ : IsClosedDisc Δ₂) + (hc : ContinuousOn c (Metric.closedBall 0 2)) + (hc' : ContinuousOn c' Δ) + (hmc : MapsTo c (Metric.closedBall 0 2) Δ) + (hmc' : MapsTo c' Δ (Metric.closedBall 0 2)) + (hleft : LeftInvOn c' c (Metric.closedBall 0 2)) + (hright : RightInvOn c' c Δ) + (hΔ₂_eq : c '' Metric.closedBall 0 1 = Δ₂) + (hbdΔ_eq : c '' Metric.sphere 0 2 = discBd Δ) + (hbdΔ₂_eq : c '' Metric.sphere 0 1 = discBd Δ₂) + (hp : p ∈ subBd Δ ∪ subBd Δ₂) + (hU_open : IsOpen U_open) (hp_U : p ∈ U_open) (hε : 0 < ε) : + ∃ D : Set S, IsClosedDisc D ∧ D ⊆ (Δ \ discInt Δ₂) ∩ U_open ∧ p ∈ subBd D ∧ + ∀ x ∈ D, dist (c' x) (c' p) < ε := by + classical + have hp_Δ : p ∈ Δ := by + rcases hp with hp1 | hp2 + · exact Surface.discBd_subset Δ (IsClosedDisc.subBd_eq_discBd hS hΔ ▸ hp1) + · have hp_Δ₂ : p ∈ Δ₂ := Surface.discBd_subset Δ₂ (IsClosedDisc.subBd_eq_discBd hS hΔ₂ ▸ hp2) + rw [← hΔ₂_eq] at hp_Δ₂ + obtain ⟨z, hz, rfl⟩ := hp_Δ₂ + exact hmc (Metric.closedBall_subset_closedBall (by norm_num) hz) + have hz₀_ball : c' p ∈ Metric.closedBall (0 : ℂ) 2 := hmc' hp_Δ + have hc_z₀ : c (c' p) = p := hright hp_Δ + obtain ⟨V_open, hV_open, hp_V, hV_sub⟩ := + continuousOn_iff.mp hc (c' p) hz₀_ball U_open hU_open (hc_z₀.symm ▸ hp_U) + obtain ⟨δ, hδ_pos, hδ_V⟩ := Metric.isOpen_iff.mp hV_open (c' p) hp_V + have hδ_U : ∀ z ∈ Metric.closedBall (0 : ℂ) 2, dist z (c' p) < δ → c z ∈ U_open := + fun z hz hdist => hV_sub ⟨hδ_V hdist, hz⟩ + let r : ℝ := min (1 / 4) (min (δ / 4) (ε / 4)) + have hr_pos : 0 < r := by positivity + have hr_le_quarter : r ≤ 1 / 4 := min_le_left _ _ + have hr_lt_δ : 2 * r < δ := by + have : r ≤ δ / 4 := (min_le_right _ _).trans (min_le_left _ _) + linarith + have hr_lt_ε : 2 * r < ε := by + have : r ≤ ε / 4 := (min_le_right _ _).trans (min_le_right _ _) + linarith + let w₀ : ℂ := + if p ∈ subBd Δ then ((1 - r / 2 : ℝ) : ℂ) * c' p else ((1 + r : ℝ) : ℂ) * c' p + have hw₀_props : dist (c' p) w₀ = r ∧ + ∀ z ∈ Metric.closedBall w₀ r, 1 ≤ ‖z‖ ∧ ‖z‖ ≤ 2 := by + by_cases hp1 : p ∈ subBd Δ + · have hp_bd : p ∈ discBd Δ := IsClosedDisc.subBd_eq_discBd hS hΔ ▸ hp1 + rw [← hbdΔ_eq] at hp_bd + obtain ⟨u, hu_sph, hu_eq⟩ := hp_bd + have hc'p_eq : c' p = u := by + rw [← hu_eq] + exact hleft (Metric.sphere_subset_closedBall hu_sph) + have hz₀_norm : ‖c' p‖ = 2 := hc'p_eq ▸ mem_sphere_zero_iff_norm.mp hu_sph + have hw₀_eq : w₀ = ((1 - r / 2 : ℝ) : ℂ) * c' p := by simp [w₀, hp1] + have hw₀_dist : dist (c' p) w₀ = r := by + have hdiff : c' p - w₀ = ((r / 2 : ℝ) : ℂ) * c' p := by + rw [hw₀_eq]; push_cast; ring + rw [dist_eq_norm, hdiff, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (by linarith), hz₀_norm] + ring + have hw₀_norm : ‖w₀‖ = 2 - r := by + rw [hw₀_eq, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (by linarith), hz₀_norm] + ring + refine ⟨hw₀_dist, fun z hz => ?_⟩ + have hz_w₀ : ‖z - w₀‖ ≤ r := dist_eq_norm z w₀ ▸ Metric.mem_closedBall.mp hz + have h_upper : ‖z‖ ≤ 2 := by + calc ‖z‖ = ‖(z - w₀) + w₀‖ := by ring_nf + _ ≤ ‖z - w₀‖ + ‖w₀‖ := norm_add_le _ _ + _ ≤ r + (2 - r) := by linarith + _ = 2 := by ring + have h_lower : 1 ≤ ‖z‖ := by + have h1 : ‖w₀‖ ≤ ‖z‖ + ‖w₀ - z‖ := by + calc ‖w₀‖ = ‖z + (w₀ - z)‖ := by ring_nf + _ ≤ ‖z‖ + ‖w₀ - z‖ := norm_add_le _ _ + rw [norm_sub_rev] at h1 + linarith + exact ⟨h_lower, h_upper⟩ + · have hp2 : p ∈ subBd Δ₂ := hp.resolve_left hp1 + have hp_bd : p ∈ discBd Δ₂ := IsClosedDisc.subBd_eq_discBd hS hΔ₂ ▸ hp2 + rw [← hbdΔ₂_eq] at hp_bd + obtain ⟨u, hu_sph, hu_eq⟩ := hp_bd + have hc'p_eq : c' p = u := by + rw [← hu_eq] + exact hleft (Metric.closedBall_subset_closedBall (by norm_num) + (Metric.sphere_subset_closedBall hu_sph)) + have hz₀_norm : ‖c' p‖ = 1 := hc'p_eq ▸ mem_sphere_zero_iff_norm.mp hu_sph + have hw₀_eq : w₀ = ((1 + r : ℝ) : ℂ) * c' p := by simp [w₀, hp1] + have hw₀_dist : dist (c' p) w₀ = r := by + have hdiff : w₀ - c' p = (r : ℂ) * c' p := by + rw [hw₀_eq]; push_cast; ring + rw [dist_comm, dist_eq_norm, hdiff, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos hr_pos, hz₀_norm, mul_one] + have hw₀_norm : ‖w₀‖ = 1 + r := by + rw [hw₀_eq, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (by linarith), hz₀_norm, mul_one] + refine ⟨hw₀_dist, fun z hz => ?_⟩ + have hz_w₀ : ‖z - w₀‖ ≤ r := dist_eq_norm z w₀ ▸ Metric.mem_closedBall.mp hz + have h_upper : ‖z‖ ≤ 2 := by + calc ‖z‖ = ‖(z - w₀) + w₀‖ := by ring_nf + _ ≤ ‖z - w₀‖ + ‖w₀‖ := norm_add_le _ _ + _ ≤ r + (1 + r) := by linarith + _ ≤ 2 := by linarith + have h_lower : 1 ≤ ‖z‖ := by + have h1 : ‖w₀‖ ≤ ‖z‖ + ‖w₀ - z‖ := by + calc ‖w₀‖ = ‖z + (w₀ - z)‖ := by ring_nf + _ ≤ ‖z‖ + ‖w₀ - z‖ := norm_add_le _ _ + rw [norm_sub_rev] at h1 + linarith + exact ⟨h_lower, h_upper⟩ + obtain ⟨hw₀_dist, hB_ann⟩ := hw₀_props + have hB_sub : Metric.closedBall w₀ r ⊆ Metric.closedBall (0 : ℂ) 2 := + fun z hz => mem_closedBall_zero_iff.mpr (hB_ann z hz).2 + have hB_dist : ∀ z ∈ Metric.closedBall w₀ r, dist z (c' p) < min δ ε := by + intro z hz + have hz_w₀ : dist z w₀ ≤ r := Metric.mem_closedBall.mp hz + have htri : dist z (c' p) ≤ dist z w₀ + dist w₀ (c' p) := dist_triangle z w₀ (c' p) + rw [dist_comm w₀ (c' p), hw₀_dist] at htri + exact lt_min (by linarith) (by linarith) + have hB_int_ne : (interior (Metric.closedBall w₀ r)).Nonempty := by + rw [interior_closedBall w₀ hr_pos.ne'] + exact ⟨w₀, Metric.mem_ball_self hr_pos⟩ + obtain ⟨hB_disc, hB_bd⟩ := + isClosedDisc_of_convex (convex_closedBall w₀ r) hB_int_ne + Metric.isBounded_closedBall Metric.isClosed_closedBall + rw [frontier_closedBall w₀ hr_pos.ne'] at hB_bd + obtain ⟨hD_disc, hD_bd⟩ := + hB_disc.image (hc.mono hB_sub) (hc'.mono (hmc.mono_left hB_sub).image_subset) + (hleft.mono hB_sub) + rw [hB_bd] at hD_bd + refine ⟨c '' Metric.closedBall w₀ r, hD_disc, ?_, ?_, ?_⟩ + · rintro x ⟨z, hz, rfl⟩ + refine ⟨⟨hmc (hB_sub hz), ?_⟩, + hδ_U z (hB_sub hz) (lt_of_lt_of_le (hB_dist z hz) (min_le_left _ _))⟩ + rintro ⟨hcz_Δ₂, hcz_not_bd⟩ + rw [← hΔ₂_eq] at hcz_Δ₂ + obtain ⟨u, hu, hu_eq⟩ := hcz_Δ₂ + have hu_z : u = z := by + have h1 := congrArg c' hu_eq + rwa [hleft (Metric.closedBall_subset_closedBall (by norm_num) hu), + hleft (hB_sub hz)] at h1 + subst hu_z + have hz_norm1 : ‖u‖ = 1 := + le_antisymm (mem_closedBall_zero_iff.mp hu) (hB_ann u hz).1 + apply hcz_not_bd + rw [← hbdΔ₂_eq] + exact ⟨u, mem_sphere_zero_iff_norm.mpr hz_norm1, rfl⟩ + · rw [IsClosedDisc.subBd_eq_discBd hS hD_disc, hD_bd] + exact ⟨c' p, Metric.mem_sphere.mpr hw₀_dist, hc_z₀⟩ + · rintro x ⟨z, hz, rfl⟩ + rw [hleft (hB_sub hz)] + exact lt_of_lt_of_le (hB_dist z hz) (min_le_right _ _) + +/-- Disjointness of edges and vertex intersection for disjoint families of bridges `B_J` and +`B_rem`. -/ +private theorem bridge_sUnion_disjoint_and_inter {α : Type u} {β : Type v} + {G_amb H_sub G' J : Graph α β} {B_J B_rem : Set (Graph α β)} + (hH_le : H_sub ≤ G_amb) + (hB_J : ∀ B ∈ B_J, IsBridge G_amb H_sub B) + (hB_rem : ∀ B ∈ B_rem, IsBridge G_amb H_sub B) + (hDisj_B : Disjoint B_J B_rem) + (hJ_eq : J = subgraphSUnion G_amb B_J) + (hG'_eq : G' = subgraphSUnion G_amb {H_sub, subgraphSUnion G_amb B_rem}) : + Disjoint E(G') E(J) ∧ V(G') ∩ V(J) ⊆ V(H_sub) := by + let U_rem := subgraphSUnion G_amb B_rem + have hU_rem_le : U_rem ≤ G_amb := subgraphSUnion_le fun B hB => (hB_rem B hB).2.1 + have hPair_le : ∀ Q ∈ ({H_sub, U_rem} : Set (Graph α β)), Q ≤ G_amb := by + rintro Q (rfl | rfl) + · exact hH_le + · exact hU_rem_le + have hBJ_le : ∀ B ∈ B_J, B ≤ G_amb := fun B hB => (hB_J B hB).2.1 + have hBrem_le : ∀ B ∈ B_rem, B ≤ G_amb := fun B hB => (hB_rem B hB).2.1 + refine ⟨?_, ?_⟩ + · refine Set.disjoint_left.mpr fun e heG' heJ => ?_ + rw [hJ_eq, edgeSet_subgraphSUnion hBJ_le] at heJ + obtain ⟨B₁, hB₁, heB₁⟩ := mem_iUnion₂.mp heJ + rw [hG'_eq, edgeSet_subgraphSUnion hPair_le] at heG' + obtain ⟨Q, rfl | rfl, heQ⟩ := mem_iUnion₂.mp heG' + · exact Set.disjoint_left.mp (isBridge_disjoint_edgeSet (hB_J B₁ hB₁)) heB₁ heQ + · rw [edgeSet_subgraphSUnion hBrem_le] at heQ + obtain ⟨B₂, hB₂, heB₂⟩ := mem_iUnion₂.mp heQ + have hEq : B₁ = B₂ := (isBridge_eq_of_inter (hB_J B₁ hB₁) (hB_rem B₂ hB₂)).2 e ⟨heB₁, heB₂⟩ + exact Set.disjoint_left.mp hDisj_B hB₁ (hEq ▸ hB₂) + · rintro v ⟨hvG', hvJ⟩ + by_contra hv_not_H + rw [hJ_eq, vertexSet_subgraphSUnion] at hvJ + obtain ⟨B₁, hB₁, hvB₁⟩ := mem_iUnion₂.mp hvJ + rw [hG'_eq, vertexSet_subgraphSUnion] at hvG' + obtain ⟨Q, rfl | rfl, hvQ⟩ := mem_iUnion₂.mp hvG' + · exact hv_not_H hvQ + · rw [vertexSet_subgraphSUnion] at hvQ + obtain ⟨B₂, hB₂, hvB₂⟩ := mem_iUnion₂.mp hvQ + have hEq : B₁ = B₂ := + (isBridge_eq_of_inter (hB_J B₁ hB₁) (hB_rem B₂ hB₂)).1 v ⟨hvB₁, hvB₂⟩ hv_not_H + exact Set.disjoint_left.mp hDisj_B hB₁ (hEq ▸ hB₂) + +/-- Dichotomy for discs of `S_seg` with respect to the cylinder `Δ \ discInt Δ₂` when both `subBd Δ` +and `subBd Δ₂` are `α`-normal. -/ +private theorem disc_subset_cyl_iff [T2Space S] {α : Type u} {β : Type v} + (hS : IsClosedSurface S) + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + {Δ Δ₂ : Set S} (hΔ : IsClosedDisc Δ) (hΔ₂ : IsClosedDisc Δ₂) + (hNorm_Δ : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) + (hNorm_Δ₂ : IsArrangementNormal S_seg α_disc α_pt (subBd Δ₂)) + {A : Society α β} (hA : A ∈ S_seg) : + (α_disc A ⊆ Δ \ discInt Δ₂ ↔ (α_disc A ⊆ Δ ∧ ¬ α_disc A ⊆ Δ₂)) ∧ + (¬ α_disc A ⊆ Δ \ discInt Δ₂ → + α_disc A ∩ (Δ \ discInt Δ₂) ⊆ (subBd Δ ∪ subBd Δ₂) ∧ + α_disc A ∩ (Δ \ discInt Δ₂) ⊆ α_pt '' A.Ω.bar) := by + obtain ⟨hD, hD_bd⟩ := hArr.isClosedDisc A hA + refine ⟨⟨?_, ?_⟩, ?_⟩ + · intro hsub_cyl + refine ⟨hsub_cyl.trans sdiff_subset, fun hsub_Δ₂ => ?_⟩ + obtain ⟨x, hx_int⟩ := hD.nonempty_discInt + have hx_D : x ∈ α_disc A := hx_int.1 + have hx_not_bdD : x ∉ subBd (α_disc A) := by + rw [IsClosedDisc.subBd_eq_discBd hS hD] + exact hx_int.2 + have hx_bdΔ₂ : x ∈ subBd Δ₂ := by + rw [IsClosedDisc.subBd_eq_discBd hS hΔ₂] + by_contra hx_not_bd₂ + exact (hsub_cyl hx_D).2 ⟨hsub_Δ₂ hx_D, hx_not_bd₂⟩ + obtain ⟨v, hv, rfl⟩ := hNorm_Δ₂ A hA ⟨hx_bdΔ₂, hx_D⟩ + exact hx_not_bdD (hD_bd v hv) + · rintro ⟨hsub_Δ, hnot_Δ₂⟩ x hxD + obtain ⟨hinter_bd₂, _⟩ := + inter_disc_subset_subBd_of_not_subset hS hArr hΔ₂ hNorm_Δ₂ hA hnot_Δ₂ + refine ⟨hsub_Δ hxD, fun hx_int₂ => ?_⟩ + have hx_bd₂ : x ∈ discBd Δ₂ := + IsClosedDisc.subBd_eq_discBd hS hΔ₂ ▸ hinter_bd₂ ⟨hxD, hx_int₂.1⟩ + exact hx_int₂.2 hx_bd₂ + · intro hnot_cyl + by_cases hsub_Δ : α_disc A ⊆ Δ + · have hsub_Δ₂ : α_disc A ⊆ Δ₂ := by + by_contra hnot_Δ₂ + apply hnot_cyl + intro x hxD + obtain ⟨hinter_bd₂, _⟩ := + inter_disc_subset_subBd_of_not_subset hS hArr hΔ₂ hNorm_Δ₂ hA hnot_Δ₂ + refine ⟨hsub_Δ hxD, fun hx_int₂ => ?_⟩ + have hx_bd₂ : x ∈ discBd Δ₂ := + IsClosedDisc.subBd_eq_discBd hS hΔ₂ ▸ hinter_bd₂ ⟨hxD, hx_int₂.1⟩ + exact hx_int₂.2 hx_bd₂ + have hinter_bd₂ : α_disc A ∩ (Δ \ discInt Δ₂) ⊆ subBd Δ₂ := by + rintro x ⟨hxD, _, hx_not_int₂⟩ + rw [IsClosedDisc.subBd_eq_discBd hS hΔ₂] + by_contra hx_not_bd₂ + exact hx_not_int₂ ⟨hsub_Δ₂ hxD, hx_not_bd₂⟩ + refine ⟨fun x hx => Or.inr (hinter_bd₂ hx), fun x hx => ?_⟩ + exact hNorm_Δ₂ A hA ⟨hinter_bd₂ hx, hx.1⟩ + · obtain ⟨hinter_bd, hinter_bar⟩ := + inter_disc_subset_subBd_of_not_subset hS hArr hΔ hNorm_Δ hA hsub_Δ + refine ⟨fun x hx => Or.inl (hinter_bd ⟨hx.1, hx.2.1⟩), + fun x hx => hinter_bar ⟨hx.1, hx.2.1⟩⟩ + +private theorem inner_society_boundary_matches_cylindrical_pullback + {S : Type w} + [TopologicalSpace S] + {α : Type u} + {β : Type v} + (hS : IsClosedSurface S) + {G_amb : Graph α β} + {G' : Graph α β} + {J : Graph α β} + {H : Drawing S} + {η : SpanEmbedding H G_amb} + {η' : SpanEmbedding H G'} + {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} + {α_pt : α → S} + {Δ : Set S} + {Δ₂ : Set S} + (hInter_V : V(G') ∩ V(J) ⊆ V(η.imageGraph)) + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η.vMap v) + (hSeg : IsThreeSegregation G' S_seg) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hΔ₂ : IsClosedDisc Δ₂) + (hVJ_Δ₂ : ∀ v ∈ H.V, η.vMap v ∈ V(J) → v ∈ Δ₂ \ subBd Δ₂) + (hP_le : ∀ (X : Set S), arrangementPullbackGraph G' S_seg α_disc α_pt X ≤ G') + (Ω₂ : CyclicPerm α) + (hPull₂ : IsPullbackPerm S_seg α_pt (subBd Δ₂) Ω₂) + (G₂ : Graph α β) + (hG₂ : G₂ = subgraphUnion G_amb J (arrangementPullbackGraph G' S_seg α_disc α_pt Δ₂)) + (hΩ₂_sub_G₂ : Ω₂.bar ⊆ V(G₂)) + (hΩ₂_sub_PCyl : Ω₂.bar ⊆ V((arrangementPullbackGraph G' S_seg α_disc α_pt (Δ \ discInt Δ₂)))) + (S₂ : Society α β) + (hS₂G : S₂.G = G₂) (hS₂Ω : S₂.Ω = Ω₂) + (hA_iff : ∀ {A : Society α β}, A ∈ S_seg → (α_disc A ⊆ Δ ↔ α_disc A ⊆ Δ₂ ∨ α_disc A ⊆ (Δ \ + discInt Δ₂)) ∧ ¬(α_disc A ⊆ Δ₂ ∧ α_disc A ⊆ (Δ \ discInt Δ₂))) + (hseg_in_bar : ∀ {A : Society α β}, A ∈ S_seg → ∀ {x : α}, x ∈ V(A.G) → x ∈ + segregationVertices S_seg → x ∈ A.Ω.bar) + (hbar_pt_in_disc : ∀ {A : Society α β}, A ∈ S_seg → ∀ {x : α}, x ∈ A.Ω.bar → α_pt x ∈ α_disc + A) : + S₂.Ω.bar = V(S₂.G) ∩ V((arrangementPullbackGraph G' S_seg α_disc α_pt (Δ \ discInt Δ₂))) := by + let Cyl := Δ \ discInt Δ₂ + let P_Δ₂ := arrangementPullbackGraph G' S_seg α_disc α_pt Δ₂ + let P_Cyl := arrangementPullbackGraph G' S_seg α_disc α_pt Cyl + rw [hS₂G, hS₂Ω] + refine Subset.antisymm (subset_inter hΩ₂_sub_G₂ hΩ₂_sub_PCyl) ?_ + rintro x ⟨hx_G₂, hx_Cyl⟩ + change x ∈ V(G₂) at hx_G₂ + rw [hG₂, vertexSet_subgraphUnion] at hx_G₂ + have hx_PCyl' : (∃ A ∈ S_seg, α_disc A ⊆ Cyl ∧ x ∈ V(A.G)) ∨ + (x ∈ segregationVertices S_seg ∧ α_pt x ∈ Cyl) := by + simp only [arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce, + mem_inter_iff, mem_union, mem_iUnion, mem_sep_iff] at hx_Cyl + rcases hx_Cyl.1 with ⟨A, ⟨hA, hA_Cyl⟩, hxA⟩ | h2 + · exact Or.inl ⟨A, hA, hA_Cyl, hxA⟩ + · exact Or.inr h2 + rcases hx_G₂ with hx_J | hx_PΔ₂ + · exfalso + have hx_G' : x ∈ V(G') := (hP_le Cyl).vertexSet_mono hx_Cyl + obtain ⟨v, hvH, rfl⟩ := η.bijOn_v.surjOn (hInter_V ⟨hx_G', hx_J⟩) + have hv_int₂ : v ∈ discInt Δ₂ := by + rw [discInt, ← IsClosedDisc.subBd_eq_discBd hS hΔ₂] + exact hVJ_Δ₂ v hvH hx_J + have hv_Cyl : v ∈ Cyl := by + rcases hx_PCyl' with ⟨A, hA, hA_Cyl, hvA⟩ | ⟨hv_seg, hv_pt_Cyl⟩ + · rw [← hη'_v v hvH, ← hComp.inter_V_iff A hA v hvH] at hvA + exact hA_Cyl hvA + · have hpt : α_pt (η'.vMap v) = v := hComp.pt_eq v hvH (hη'_v v hvH ▸ hv_seg) + rwa [← hη'_v v hvH, hpt] at hv_pt_Cyl + exact hv_Cyl.2 hv_int₂ + · have hx_PΔ₂' : (∃ A ∈ S_seg, α_disc A ⊆ Δ₂ ∧ x ∈ V(A.G)) ∨ + (x ∈ segregationVertices S_seg ∧ α_pt x ∈ Δ₂) := by + simp only [arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce, + mem_inter_iff, mem_union, mem_iUnion, mem_sep_iff] at hx_PΔ₂ + rcases hx_PΔ₂.1 with ⟨A, ⟨hA, hA_Δ₂⟩, hxA⟩ | h2 + · exact Or.inl ⟨A, hA, hA_Δ₂, hxA⟩ + · exact Or.inr h2 + have hx_seg_both : x ∈ segregationVertices S_seg ∧ α_pt x ∈ Δ₂ ∧ α_pt x ∈ Cyl := by + rcases hx_PΔ₂' with ⟨A₁, hA₁, hA₁_Δ₂, hxA₁⟩ | ⟨hx_seg, hx_Δ₂⟩ <;> + rcases hx_PCyl' with ⟨A₂, hA₂, hA₂_Cyl, hxA₂⟩ | ⟨hx_seg', hx_Cyl'⟩ + · have hne : A₁ ≠ A₂ := fun hEq => (hA_iff hA₁).2 ⟨hA₁_Δ₂, hEq ▸ hA₂_Cyl⟩ + have hbars := hSeg.1.vertex_inter_subset A₁ hA₁ A₂ hA₂ hne ⟨hxA₁, hxA₂⟩ + exact ⟨mem_biUnion hA₁ hbars.1, + hA₁_Δ₂ (hbar_pt_in_disc hA₁ hbars.1), + hA₂_Cyl (hbar_pt_in_disc hA₂ hbars.2)⟩ + · have hbar₁ := hseg_in_bar hA₁ hxA₁ hx_seg' + exact ⟨hx_seg', hA₁_Δ₂ (hbar_pt_in_disc hA₁ hbar₁), hx_Cyl'⟩ + · have hbar₂ := hseg_in_bar hA₂ hxA₂ hx_seg + exact ⟨hx_seg, hx_Δ₂, hA₂_Cyl (hbar_pt_in_disc hA₂ hbar₂)⟩ + · exact ⟨hx_seg, hx_Δ₂, hx_Cyl'⟩ + change x ∈ Ω₂.bar + rw [hPull₂.1] + refine ⟨hx_seg_both.1, ?_⟩ + rw [IsClosedDisc.subBd_eq_discBd hS hΔ₂] + by_contra hx_not_bd₂ + exact hx_seg_both.2.2.2 ⟨hx_seg_both.2.1, hx_not_bd₂⟩ + +private theorem cylinder_and_inner_disc_cover_pullback_vertices + {S : Type w} + [TopologicalSpace S] + {α : Type u} + {β : Type v} + {G' : Graph α β} + {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} + {α_pt : α → S} + {Δ : Set S} + {Δ₂ : Set S} + (hin : Δ₂ ⊆ Δ \ subBd Δ) + (hΔ_union : Δ = Δ₂ ∪ (Δ \ discInt Δ₂)) + (hA_iff : ∀ {A : Society α β}, A ∈ S_seg → (α_disc A ⊆ Δ ↔ α_disc A ⊆ Δ₂ ∨ α_disc A ⊆ (Δ \ + discInt Δ₂)) ∧ ¬(α_disc A ⊆ Δ₂ ∧ α_disc A ⊆ (Δ \ discInt Δ₂))) : + V((arrangementPullbackGraph G' S_seg α_disc α_pt Δ)) = V((arrangementPullbackGraph G' S_seg + α_disc α_pt Δ₂)) ∪ V((arrangementPullbackGraph G' S_seg α_disc α_pt (Δ \ discInt Δ₂))) := by + let Cyl := Δ \ discInt Δ₂ + let P_Δ := arrangementPullbackGraph G' S_seg α_disc α_pt Δ + let P_Δ₂ := arrangementPullbackGraph G' S_seg α_disc α_pt Δ₂ + let P_Cyl := arrangementPullbackGraph G' S_seg α_disc α_pt Cyl + ext x + simp only [arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce, + mem_union, mem_inter_iff, mem_iUnion, mem_sep_iff] + constructor + · rintro ⟨(⟨A, ⟨hA, hA_Δ⟩, hxA⟩ | ⟨hx_seg, hx_Δ⟩), hxG'⟩ + · rcases (hA_iff hA).1.mp hA_Δ with hA_Δ₂ | hA_Cyl + · exact Or.inl ⟨Or.inl ⟨A, ⟨hA, hA_Δ₂⟩, hxA⟩, hxG'⟩ + · exact Or.inr ⟨Or.inl ⟨A, ⟨hA, hA_Cyl⟩, hxA⟩, hxG'⟩ + · rw [hΔ_union] at hx_Δ + rcases hx_Δ with hx_Δ₂ | hx_Cyl + · exact Or.inl ⟨Or.inr ⟨hx_seg, hx_Δ₂⟩, hxG'⟩ + · exact Or.inr ⟨Or.inr ⟨hx_seg, hx_Cyl⟩, hxG'⟩ + · rintro (⟨(⟨A, ⟨hA, hA_Δ₂⟩, hxA⟩ | ⟨hx_seg, hx_Δ₂⟩), hxG'⟩ | + ⟨(⟨A, ⟨hA, hA_Cyl⟩, hxA⟩ | ⟨hx_seg, hx_Cyl⟩), hxG'⟩) + · exact ⟨Or.inl ⟨A, ⟨hA, (hA_iff hA).1.mpr (Or.inl hA_Δ₂)⟩, hxA⟩, hxG'⟩ + · exact ⟨Or.inr ⟨hx_seg, (hin hx_Δ₂).1⟩, hxG'⟩ + · exact ⟨Or.inl ⟨A, ⟨hA, (hA_iff hA).1.mpr (Or.inr hA_Cyl)⟩, hxA⟩, hxG'⟩ + · exact ⟨Or.inr ⟨hx_seg, hx_Cyl.1⟩, hxG'⟩ + +private theorem cylinder_and_inner_disc_cover_pullback_edges + {S : Type w} [TopologicalSpace S] + {α : Type u} + {β : Type v} + {G' : Graph α β} + {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} + {α_pt : α → S} + {Δ : Set S} + {Δ₂ : Set S} + (hA_iff : ∀ {A : Society α β}, A ∈ S_seg → (α_disc A ⊆ Δ ↔ α_disc A ⊆ Δ₂ ∨ α_disc A ⊆ (Δ \ + discInt Δ₂)) ∧ ¬(α_disc A ⊆ Δ₂ ∧ α_disc A ⊆ (Δ \ discInt Δ₂))) + (hEP_eq : ∀ (X : Set S), E(arrangementPullbackGraph G' S_seg α_disc α_pt X) = ⋃ A ∈ {A | A ∈ + S_seg ∧ α_disc A ⊆ X}, E(A.G)) : + E((arrangementPullbackGraph G' S_seg α_disc α_pt Δ)) = E((arrangementPullbackGraph G' S_seg + α_disc α_pt Δ₂)) ∪ E((arrangementPullbackGraph G' S_seg α_disc α_pt (Δ \ discInt Δ₂))) := by + let Cyl := Δ \ discInt Δ₂ + let P_Δ := arrangementPullbackGraph G' S_seg α_disc α_pt Δ + let P_Δ₂ := arrangementPullbackGraph G' S_seg α_disc α_pt Δ₂ + let P_Cyl := arrangementPullbackGraph G' S_seg α_disc α_pt Cyl + rw [hEP_eq Δ, hEP_eq Δ₂, hEP_eq Cyl] + ext e + simp only [mem_union, mem_iUnion, mem_sep_iff] + constructor + · rintro ⟨A, ⟨hA, hA_Δ⟩, heA⟩ + rcases (hA_iff hA).1.mp hA_Δ with hA_Δ₂ | hA_Cyl + · exact Or.inl ⟨A, ⟨hA, hA_Δ₂⟩, heA⟩ + · exact Or.inr ⟨A, ⟨hA, hA_Cyl⟩, heA⟩ + · rintro (⟨A, ⟨hA, hA_Δ₂⟩, heA⟩ | ⟨A, ⟨hA, hA_Cyl⟩, heA⟩) + · exact ⟨A, ⟨hA, (hA_iff hA).1.mpr (Or.inl hA_Δ₂)⟩, heA⟩ + · exact ⟨A, ⟨hA, (hA_iff hA).1.mpr (Or.inr hA_Cyl)⟩, heA⟩ + +private theorem cylindrical_and_inner_disc_pullback_edges_disjoint + {S : Type w} [TopologicalSpace S] + {α : Type u} + {β : Type v} + {G' : Graph α β} + {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} + {α_pt : α → S} + {Δ : Set S} + {Δ₂ : Set S} + (hSeg : IsThreeSegregation G' S_seg) + (hA_iff : ∀ {A : Society α β}, A ∈ S_seg → (α_disc A ⊆ Δ ↔ α_disc A ⊆ Δ₂ ∨ α_disc A ⊆ (Δ \ + discInt Δ₂)) ∧ ¬(α_disc A ⊆ Δ₂ ∧ α_disc A ⊆ (Δ \ discInt Δ₂))) + (hEP_eq : ∀ (X : Set S), E(arrangementPullbackGraph G' S_seg α_disc α_pt X) = ⋃ A ∈ {A | A ∈ + S_seg ∧ α_disc A ⊆ X}, E(A.G)) : + Disjoint E((arrangementPullbackGraph G' S_seg α_disc α_pt Δ₂)) E((arrangementPullbackGraph G' + S_seg α_disc α_pt (Δ \ discInt Δ₂))) := by + let Cyl := Δ \ discInt Δ₂ + let P_Δ₂ := arrangementPullbackGraph G' S_seg α_disc α_pt Δ₂ + let P_Cyl := arrangementPullbackGraph G' S_seg α_disc α_pt Cyl + rw [hEP_eq Δ₂, hEP_eq Cyl] + refine Set.disjoint_left.mpr fun e he₁ he₂ => ?_ + obtain ⟨A₁, ⟨hA₁, hA₁_Δ₂⟩, heA₁⟩ := mem_iUnion₂.mp he₁ + obtain ⟨A₂, ⟨hA₂, hA₂_Cyl⟩, heA₂⟩ := mem_iUnion₂.mp he₂ + have hne : A₁ ≠ A₂ := fun hEq => (hA_iff hA₁).2 ⟨hA₁_Δ₂, hEq ▸ hA₂_Cyl⟩ + exact Set.disjoint_left.mp (hSeg.1.edge_disjoint A₁ hA₁ A₂ hA₂ hne) heA₁ heA₂ + +/-- Construction of the inner society `S₂`, the cylinder neighborhood `N`, the society composition +`localSociety.IsComposition S₂ N`, and the span embedding `η_1 : SpanEmbedding H' N.G` for Graph +Minors +XIV, (9.6) (page 49). -/ +private theorem cylinder_composition_9_6 [T2Space S] {α : Type u} {β : Type v} + (hS : IsClosedSurface S) + {G_amb G' J : Graph α β} + {H : Drawing S} {η : SpanEmbedding H G_amb} {η' : SpanEmbedding H G'} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + {Δ Δ₂ : Set S} {localSociety : Society α β} + (hV_fin : V(G_amb).Finite) (hE_fin : E(G_amb).Finite) + (hJ_le : J ≤ G_amb) (hG'_le : G' ≤ G_amb) + (hDisj_E : Disjoint E(G') E(J)) (hInter_V : V(G') ∩ V(J) ⊆ V(η.imageGraph)) + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η.vMap v) + (hSeg : IsThreeSegregation G' S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hΔ : IsClosedDisc Δ) (hΔ₂ : IsClosedDisc Δ₂) + (hin : Δ₂ ⊆ Δ \ subBd Δ) + (hNorm_Δ : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) + (hNorm_Δ₂ : IsArrangementNormal S_seg α_disc α_pt (subBd Δ₂)) + (hVJ_Δ₂ : ∀ v ∈ H.V, η.vMap v ∈ V(J) → v ∈ Δ₂ \ subBd Δ₂) + (hsoc_star_G : localSociety.G = subgraphUnion G_amb J (arrangementPullbackGraph G' S_seg α_disc + α_pt Δ)) + (hsoc_star_Ω : IsPullbackPerm S_seg α_pt (subBd Δ) localSociety.Ω) : + ∃ (S₂ : Society α β) (N : Neighborhood α β) + (η_1 : SpanEmbedding (H.interSet (Δ \ discInt Δ₂)) N.G), + S₂.G = subgraphUnion G_amb J (arrangementPullbackGraph G' S_seg α_disc α_pt Δ₂) ∧ + IsPullbackPerm S_seg α_pt (subBd Δ₂) S₂.Ω ∧ + N.G = arrangementPullbackGraph G' S_seg α_disc α_pt (Δ \ discInt Δ₂) ∧ + N.Ω = localSociety.Ω ∧ + N.Ω₀ = S₂.Ω ∧ + localSociety.IsComposition S₂ N ∧ + (∀ v ∈ (H.interSet (Δ \ discInt Δ₂)).V, η_1.vMap v = η'.vMap v) ∧ + (∀ e ∈ (H.interSet (Δ \ discInt Δ₂)).E, η_1.eMap e = η'.eMap e) ∧ + (H.interSet (Δ \ discInt Δ₂)).V = H.V ∩ (Δ \ discInt Δ₂) ∧ + (H.interSet (Δ \ discInt Δ₂)).U = H.U ∩ (Δ \ discInt Δ₂) ∧ + (H.interSet (Δ \ discInt Δ₂)).E = {e ∈ H.E | e ⊆ Δ \ discInt Δ₂} := by + classical + let Cyl := Δ \ discInt Δ₂ + let P_Δ := arrangementPullbackGraph G' S_seg α_disc α_pt Δ + let P_Δ₂ := arrangementPullbackGraph G' S_seg α_disc α_pt Δ₂ + let P_Cyl := arrangementPullbackGraph G' S_seg α_disc α_pt Cyl + obtain ⟨hCyl_cl, hCyl_bd, _⟩ := + cylinder_closed_and_subBd hS hΔ hΔ₂ hin + have hbd_sub_Cyl : subBd Δ ∪ subBd Δ₂ ⊆ Cyl := by + rw [← hCyl_bd] + exact fun x hx => hCyl_cl.closure_subset_iff.mpr Subset.rfl hx.1 + have hbdΔ_sub_Cyl : subBd Δ ⊆ Cyl := subset_union_left.trans hbd_sub_Cyl + have hbdΔ₂_sub_Cyl : subBd Δ₂ ⊆ Cyl := subset_union_right.trans hbd_sub_Cyl + have hP_le : ∀ X : Set S, arrangementPullbackGraph G' S_seg α_disc α_pt X ≤ G' := + fun X => Graph.restrict_le.trans (G'.induce_le inter_subset_right) + have hP_Δ_le_amb : P_Δ ≤ G_amb := (hP_le Δ).trans hG'_le + have hP_Δ₂_le_amb : P_Δ₂ ≤ G_amb := (hP_le Δ₂).trans hG'_le + have hP_Cyl_le_amb : P_Cyl ≤ G_amb := (hP_le Cyl).trans hG'_le + have hseg_sub_G' : segregationVertices S_seg ⊆ V(G') := by + intro x hx + obtain ⟨A, hA, hx_bar⟩ := mem_iUnion₂.mp hx + exact (hSeg.1.le A hA).vertexSet_mono (A.bar_subset hx_bar) + have hbar_sub_pull : ∀ {F X : Set S} {Ω : CyclicPerm α}, + IsPullbackPerm S_seg α_pt F Ω → F ⊆ X → + Ω.bar ⊆ V(arrangementPullbackGraph G' S_seg α_disc α_pt X) := by + intro F X Ω hPull hFX x hx + rw [hPull.1] at hx + simp only [arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce, mem_inter_iff, + mem_union, mem_sep_iff] + exact ⟨Or.inr ⟨hx.1, hFX hx.2⟩, hseg_sub_G' hx.1⟩ + have hF₂_OArc : IsOArc (subBd Δ₂) := + IsClosedDisc.subBd_eq_discBd hS hΔ₂ ▸ hΔ₂.isOArc_discBd + obtain ⟨Ω₂, hPull₂⟩ := exists_pullbackPerm hSeg.1 hArr hF₂_OArc + let G₂ := subgraphUnion G_amb J P_Δ₂ + have hG₂_le_amb : G₂ ≤ G_amb := subgraphUnion_le hJ_le hP_Δ₂_le_amb + have hbdΔ₂_sub_Δ₂ : subBd Δ₂ ⊆ Δ₂ := + IsClosedDisc.subBd_eq_discBd hS hΔ₂ ▸ Surface.discBd_subset Δ₂ + have hΩ₂_sub_PΔ₂ : Ω₂.bar ⊆ V(P_Δ₂) := hbar_sub_pull hPull₂ hbdΔ₂_sub_Δ₂ + have hΩ₂_sub_G₂ : Ω₂.bar ⊆ V(G₂) := + hΩ₂_sub_PΔ₂.trans (le_subgraphUnion_right hJ_le hP_Δ₂_le_amb).vertexSet_mono + have hΩ₂_sub_PCyl : Ω₂.bar ⊆ V(P_Cyl) := + hbar_sub_pull hPull₂ hbdΔ₂_sub_Cyl + have hΩ_star_sub_PCyl : localSociety.Ω.bar ⊆ V(P_Cyl) := + hbar_sub_pull hsoc_star_Ω hbdΔ_sub_Cyl + let S₂ : Society α β := + ⟨G₂, Ω₂, hV_fin.subset hG₂_le_amb.vertexSet_mono, + hE_fin.subset hG₂_le_amb.edgeSet_mono, hΩ₂_sub_G₂⟩ + let N : Neighborhood α β := + ⟨P_Cyl, localSociety.Ω, Ω₂, hV_fin.subset hP_Cyl_le_amb.vertexSet_mono, + hE_fin.subset hP_Cyl_le_amb.edgeSet_mono, hΩ_star_sub_PCyl, hΩ₂_sub_PCyl⟩ + -- Decomposition of `Δ` into `Δ₂` and `Cyl` + have hΔ_union : Δ = Δ₂ ∪ Cyl := by + ext p + refine ⟨fun hp => ?_, fun h => h.elim (fun h₂ => (hin h₂).1) (fun hc => hc.1)⟩ + by_cases hp_int : p ∈ discInt Δ₂ + · exact Or.inl hp_int.1 + · exact Or.inr ⟨hp, hp_int⟩ + have hA_iff : ∀ {A : Society α β}, A ∈ S_seg → + (α_disc A ⊆ Δ ↔ (α_disc A ⊆ Δ₂ ∨ α_disc A ⊆ Cyl)) ∧ + ¬ (α_disc A ⊆ Δ₂ ∧ α_disc A ⊆ Cyl) := by + intro A hA + obtain ⟨hcyl_iff, _⟩ := disc_subset_cyl_iff hS hArr hΔ hΔ₂ hNorm_Δ hNorm_Δ₂ hA + refine ⟨⟨fun hsub_Δ => ?_, fun h => h.elim (fun h₂ => h₂.trans fun _ hx => (hin hx).1) + (fun hc => (hcyl_iff.mp hc).1)⟩, fun ⟨h₂, hc⟩ => (hcyl_iff.mp hc).2 h₂⟩ + by_cases h₂ : α_disc A ⊆ Δ₂ + · exact Or.inl h₂ + · exact Or.inr (hcyl_iff.mpr ⟨hsub_Δ, h₂⟩) + have hVP_union : V(P_Δ) = V(P_Δ₂) ∪ V(P_Cyl) := by + exact cylinder_and_inner_disc_cover_pullback_vertices (S := S) (α := α) (β := β) (G' := G') + (S_seg := S_seg) (α_disc := α_disc) (α_pt := α_pt) (Δ := Δ) (Δ₂ := Δ₂) hin hΔ_union hA_iff + have hEP_eq : ∀ X : Set S, + E(arrangementPullbackGraph G' S_seg α_disc α_pt X) = + ⋃ A ∈ {A ∈ S_seg | α_disc A ⊆ X}, E(A.G) := by + intro X + ext e + simp only [arrangementPullbackGraph, edgeSet_restrict, mem_inter_iff, edgeSet_induce] + refine ⟨fun h => h.2, fun he => ⟨?_, he⟩⟩ + obtain ⟨A, ⟨hA, hA_X⟩, heA⟩ := mem_iUnion₂.mp he + obtain ⟨u, v, huv⟩ := A.G.exists_isLink_of_mem_edgeSet heA + have huv_G' : G'.IsLink e u v := huv.mono (hSeg.1.le A hA) + exact ⟨u, v, huv_G', + ⟨Or.inl (mem_iUnion₂.mpr ⟨A, ⟨hA, hA_X⟩, huv.left_mem⟩), huv_G'.left_mem⟩, + ⟨Or.inl (mem_iUnion₂.mpr ⟨A, ⟨hA, hA_X⟩, huv.right_mem⟩), huv_G'.right_mem⟩⟩ + have hEP_union : E(P_Δ) = E(P_Δ₂) ∪ E(P_Cyl) := by + exact cylinder_and_inner_disc_cover_pullback_edges (S := S) (α := α) (β := β) (G' := G') + (S_seg := S_seg) (α_disc := α_disc) (α_pt := α_pt) (Δ := Δ) (Δ₂ := Δ₂) hA_iff hEP_eq + have hEP_disj : Disjoint E(P_Δ₂) E(P_Cyl) := by + exact cylindrical_and_inner_disc_pullback_edges_disjoint (S := S) (α := α) (β := β) (G' := G') + (S_seg := S_seg) (α_disc := α_disc) (α_pt := α_pt) (Δ := Δ) (Δ₂ := Δ₂) hSeg hA_iff hEP_eq + have hstar_le_amb : localSociety.G ≤ G_amb := by + rw [hsoc_star_G] + exact subgraphUnion_le hJ_le hP_Δ_le_amb + have hV_sep_union : V(S₂.G) ∪ V(P_Cyl) = V(localSociety.G) := by + change V(G₂) ∪ V(P_Cyl) = V(localSociety.G) + rw [hsoc_star_G, vertexSet_subgraphUnion, vertexSet_subgraphUnion, hVP_union, Set.union_assoc] + have hE_sep_union : E(S₂.G) ∪ E(P_Cyl) = E(localSociety.G) := by + change E(G₂) ∪ E(P_Cyl) = E(localSociety.G) + rw [hsoc_star_G, edgeSet_subgraphUnion hJ_le hP_Δ_le_amb, + edgeSet_subgraphUnion hJ_le hP_Δ₂_le_amb, hEP_union, Set.union_assoc] + have hE_sep_disj : Disjoint E(S₂.G) E(P_Cyl) := by + change Disjoint E(G₂) E(P_Cyl) + rw [edgeSet_subgraphUnion hJ_le hP_Δ₂_le_amb] + refine Disjoint.union_left ?_ hEP_disj + exact Disjoint.mono_right (hP_le Cyl).edgeSet_mono hDisj_E.symm + have hS₂_le_star : S₂.G ≤ localSociety.G := + ⟨hV_sep_union ▸ subset_union_left, fun _ _ _ hlink => + (hstar_le_amb.isLink_iff (hE_sep_union ▸ Or.inl hlink.edge_mem)).mpr + (hlink.mono hG₂_le_amb)⟩ + have hPCyl_le_star : P_Cyl ≤ localSociety.G := + ⟨hV_sep_union ▸ subset_union_right, fun _ _ _ hlink => + (hstar_le_amb.isLink_iff (hE_sep_union ▸ Or.inr hlink.edge_mem)).mpr + (hlink.mono hP_Cyl_le_amb)⟩ + have hseg_in_bar : ∀ {A : Society α β}, A ∈ S_seg → + ∀ {x : α}, x ∈ V(A.G) → x ∈ segregationVertices S_seg → x ∈ A.Ω.bar := by + intro A hA x hxA hx_seg + obtain ⟨A', hA', hx_bar'⟩ := mem_iUnion₂.mp hx_seg + by_cases hEq : A = A' + · subst hEq; exact hx_bar' + · exact (hSeg.1.vertex_inter_subset A hA A' hA' hEq ⟨hxA, A'.bar_subset hx_bar'⟩).1 + have hbar_pt_in_disc : ∀ {A : Society α β}, A ∈ S_seg → + ∀ {x : α}, x ∈ A.Ω.bar → α_pt x ∈ α_disc A := by + intro A hA x hx_bar + obtain ⟨hD, hD_bd⟩ := hArr.isClosedDisc A hA + exact hD.isClosed.closure_subset_iff.mpr Subset.rfl (hD_bd x hx_bar).1 + have hV_inter_eq : S₂.Ω.bar = V(S₂.G) ∩ V(P_Cyl) := by + exact inner_society_boundary_matches_cylindrical_pullback (S := S) (α := α) (β := β) hS (G_amb + := G_amb) (G' := G') (J := J) (H := H) (η := η) (η' := η') (S_seg := S_seg) (α_disc := + α_disc) (α_pt := α_pt) (Δ := Δ) (Δ₂ := Δ₂) hInter_V hη'_v hSeg hComp hΔ₂ hVJ_Δ₂ hP_le Ω₂ + hPull₂ G₂ rfl hΩ₂_sub_G₂ hΩ₂_sub_PCyl S₂ rfl rfl hA_iff hseg_in_bar hbar_pt_in_disc + have hComp_soc : localSociety.IsComposition S₂ N := + ⟨⟨⟨hS₂_le_star, hPCyl_le_star, hV_sep_union, hE_sep_union, hE_sep_disj⟩, hΩ_star_sub_PCyl⟩, + rfl, rfl, hV_inter_eq⟩ + -- Construct `η_1 : SpanEmbedding (H.interSet Cyl) P_Cyl` + have hEdges_Cyl : ∀ e ∈ H.E, (e ∩ Cyl).Nonempty → + ∃ A ∈ S_seg, α_disc A ⊆ Cyl ∧ η'.eMap e ∈ E(A.G) ∧ e ⊆ Cyl := by + rintro e he ⟨p, hpe, hpCyl⟩ + have he_G' : η'.eMap e ∈ E(G') := η'.imageGraph_le.edgeSet_mono (η'.bijOn_e.mapsTo he) + have he_u : η'.eMap e ∈ E(subgraphSUnion G' ((fun A : Society α β => A.G) '' S_seg)) := by + rw [hSeg.1.union_eq]; exact he_G' + rw [edgeSet_subgraphSUnion (by rintro _ ⟨A, hA, rfl⟩; exact hSeg.1.le A hA)] at he_u + obtain ⟨_, ⟨A, hA, rfl⟩, heA⟩ := mem_iUnion₂.mp he_u + have he_disc : e ⊆ α_disc A := (hComp.inter_E_iff A hA e he).mpr heA + have hA_sub : α_disc A ⊆ Cyl := by + by_contra hnot + obtain ⟨_, hbar⟩ := + disc_subset_cyl_iff hS hArr hΔ hΔ₂ hNorm_Δ hNorm_Δ₂ hA + obtain ⟨y, hy_bar, rfl⟩ := (hbar hnot).2 ⟨he_disc hpe, hpCyl⟩ + have hx_bdA : α_pt y ∈ H.U ∩ subBd (α_disc A) := + ⟨(he.2.1 hpe).1, (hArr.isClosedDisc A hA).2 y hy_bar⟩ + rw [hComp.bd_inter_eq A hA] at hx_bdA + exact (he.2.1 hpe).2 hx_bdA.1 + exact ⟨A, hA, hA_sub, heA, he_disc.trans hA_sub⟩ + obtain ⟨hV_HCyl, hU_HCyl⟩ := + interSet_V_and_U_of_edges hCyl_cl (fun e he hne => (hEdges_Cyl e he hne).choose_spec.2.2.2) + have hE_HCyl : (H.interSet Cyl).E = {e ∈ H.E | e ⊆ Cyl} := by + change (H.span _ _).E = _ + rw [H.span_E] + ext e + simp only [mem_inter_iff, mem_ofPred_eq] + tauto + have hHV_Cyl_mem_P : ∀ v ∈ H.V, v ∈ Cyl → η'.vMap v ∈ V(P_Cyl) := by + intro v hvH hvCyl + have hv_G' : η'.vMap v ∈ V(G') := η'.imageGraph_le.vertexSet_mono (η'.bijOn_v.mapsTo hvH) + have hv_u : η'.vMap v ∈ V(subgraphSUnion G' ((fun A : Society α β => A.G) '' S_seg)) := by + rw [hSeg.1.union_eq]; exact hv_G' + rw [vertexSet_subgraphSUnion] at hv_u + obtain ⟨_, ⟨A, hA, rfl⟩, hvA⟩ := mem_iUnion₂.mp hv_u + have hv_disc : v ∈ α_disc A := (hComp.inter_V_iff A hA v hvH).mpr hvA + change η'.vMap v ∈ V(arrangementPullbackGraph G' S_seg α_disc α_pt Cyl) + rw [arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce] + by_cases hA_sub : α_disc A ⊆ Cyl + · exact ⟨Or.inl (mem_iUnion₂.mpr ⟨A, ⟨hA, hA_sub⟩, hvA⟩), hv_G'⟩ + · obtain ⟨_, hbar⟩ := + disc_subset_cyl_iff hS hArr hΔ hΔ₂ hNorm_Δ hNorm_Δ₂ hA + obtain ⟨y, hy_bar, rfl⟩ := (hbar hA_sub).2 ⟨hv_disc, hvCyl⟩ + have hv_bdA : α_pt y ∈ H.U ∩ subBd (α_disc A) := + ⟨H.V_subset_U hvH, (hArr.isClosedDisc A hA).2 y hy_bar⟩ + rw [hComp.bd_inter_eq A hA] at hv_bdA + have hv_seg : η'.vMap (α_pt y) ∈ segregationVertices S_seg := mem_biUnion hA hv_bdA.2 + have hpt_eq : α_pt (η'.vMap (α_pt y)) = α_pt y := hComp.pt_eq (α_pt y) hvH hv_seg + exact ⟨Or.inr ⟨hv_seg, hpt_eq.symm ▸ hvCyl⟩, hv_G'⟩ + let η_1₀ : SpanEmbedding (H.interSet Cyl) G' := + restrictSpan η' (H.V ∩ Cyl) {e | e ∈ H.E ∧ e ⊆ Cyl} + have hle_PCyl : η_1₀.imageGraph ≤ P_Cyl := by + refine ⟨?_, fun b x y hlink => ?_⟩ + · rw [← η_1₀.bijOn_v.image_eq, hV_HCyl] + rintro _ ⟨v, ⟨hvH, hvCyl⟩, rfl⟩ + exact hHV_Cyl_mem_P v hvH hvCyl + · have hb_im : b ∈ E(η_1₀.imageGraph) := hlink.edge_mem + rw [← η_1₀.bijOn_e.image_eq, hE_HCyl] at hb_im + obtain ⟨e, ⟨heH, he_sub⟩, rfl⟩ := hb_im + obtain ⟨p, hp⟩ := heH.1 + obtain ⟨A, hA, hA_sub, heA, _⟩ := hEdges_Cyl e heH ⟨p, hp, he_sub hp⟩ + have hb_PCyl : η'.eMap e ∈ E(P_Cyl) := by + rw [hEP_eq Cyl] + exact mem_iUnion₂.mpr ⟨A, ⟨hA, hA_sub⟩, heA⟩ + exact ((hP_le Cyl).isLink_iff hb_PCyl).mpr (hlink.mono η_1₀.imageGraph_le) + let η_1 : SpanEmbedding (H.interSet Cyl) N.G := + { η_1₀ with imageGraph_le := hle_PCyl } + exact ⟨S₂, N, η_1, rfl, hPull₂, rfl, rfl, rfl, hComp_soc, + fun _ _ => rfl, fun _ _ => rfl, hV_HCyl, hU_HCyl, hE_HCyl⟩ + +/-- A graph with a single vertex `u` and no edges. -/ +private abbrev oneVertexGraph {α : Type u} {β : Type v} (u : α) : Graph α β where + vertexSet := {u} + edgeSet := ∅ + IsLink _ _ _ := False + isLink_symm _ _ := ⟨fun _ _ h => h.elim⟩ + eq_or_eq_of_isLink_of_isLink _ _ _ _ _ h := h.elim + edge_mem_iff_exists_isLink _ := ⟨False.elim, fun ⟨_, _, h⟩ => h.elim⟩ + left_mem_of_isLink _ _ _ h := h.elim + +/-- The cyclic permutation on a singleton `{u}`. -/ +private abbrev singletonCyclicPerm {α : Type u} (u : α) : CyclicPerm α where + bar := {u} + toFun := id + finite_bar := finite_singleton u + bijOn := bijOn_id {u} + single_orbit x hx y hy := by + rw [mem_singleton_iff] at hx hy + subst hx hy + exact ⟨0, rfl⟩ + +/-- The trivial 1-vertex society `({u}, ∅)` with cyclic permutation `{u}`. -/ +private abbrev oneVertexSociety {α : Type u} {β : Type v} (u : α) : Society α β where + G := oneVertexGraph u + Ω := singletonCyclicPerm u + finite_V := finite_singleton u + finite_E := finite_empty + bar_subset := Subset.rfl + +@[simp] +private theorem oneVertexSociety_V {α : Type u} {β : Type v} (u : α) : + V((oneVertexSociety u : Society α β).G) = {u} := rfl + +@[simp] +private theorem oneVertexSociety_E {α : Type u} {β : Type v} (u : α) : + E((oneVertexSociety u : Society α β).G) = ∅ := rfl + +@[simp] +private theorem oneVertexSociety_bar {α : Type u} {β : Type v} (u : α) : + (oneVertexSociety u : Society α β).Ω.bar = {u} := rfl + +private theorem oneVertexSociety_inj {α : Type u} {β : Type v} : + Function.Injective (oneVertexSociety : α → Society α β) := by + intro u v h + have hV : V((oneVertexSociety u : Society α β).G) = V((oneVertexSociety v : Society α β).G) := by + rw [h] + rw [oneVertexSociety_V, oneVertexSociety_V] at hV + exact Set.singleton_eq_singleton_iff.mp hV + +/-- If `F` is a finite set and `g : γ → ℝ` is positive on `F`, there is `ε > 0` with `ε < g x` for +all `x ∈ F`. -/ +private theorem exists_pos_lt_of_finite {γ : Type*} {F : Set γ} (hF : F.Finite) + {g : γ → ℝ} (hg : ∀ x ∈ F, 0 < g x) : + ∃ ε : ℝ, 0 < ε ∧ ∀ x ∈ F, ε < g x := by + induction F, hF using Set.Finite.induction_on with + | empty => exact ⟨1, zero_lt_one, fun _ h => h.elim⟩ + | @insert a s _ _ ih => + obtain ⟨ε, hε, hlt⟩ := ih (fun x hx => hg x (mem_insert_of_mem a hx)) + have hga : 0 < g a := hg a (mem_insert a s) + refine ⟨min ε (g a / 2), lt_min hε (half_pos hga), ?_⟩ + rintro x (rfl | hxs) + · exact lt_of_le_of_lt (min_le_right _ _) (half_lt_self hga) + · exact lt_of_le_of_lt (min_le_left _ _) (hlt x hxs) + +private theorem cylindrical_cells_and_orphans_form_three_segregation + {S : Type w} + [TopologicalSpace S] + {α : Type u} + {β : Type v} + {G' : Graph α β} + {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} + {α_pt : α → S} + {Δ : Set S} + {Δ₂ : Set S} + {N : Neighborhood α β} + (hSeg : IsThreeSegregation G' S_seg) + (hN_G : N.G = arrangementPullbackGraph G' S_seg α_disc α_pt (Δ \ discInt Δ₂)) + (Cyl : Set S) + (hCyl : Cyl = Δ \ discInt Δ₂) + (Orphans : Set α) + (hOrphans : Orphans = {u ∈ segregationVertices S_seg | α_pt u ∈ Cyl} \ + ⋃ A ∈ {A | A ∈ S_seg ∧ α_disc A ⊆ Cyl}, V(A.G)) + (hOrphans_fin : Orphans.Finite) + (hScyl_fin : ({A | A ∈ S_seg ∧ α_disc A ⊆ Cyl}).Finite) + (hEP_Cyl : E(N.G) = ⋃ A ∈ ({A | A ∈ S_seg ∧ α_disc A ⊆ Cyl}), E(A.G)) + (hSeg1_le : ∀ S₀ ∈ (({A | A ∈ S_seg ∧ α_disc A ⊆ Cyl}) ∪ (oneVertexSociety '' Orphans)), S₀.G + ≤ N.G) : + IsThreeSegregation N.G (({A | A ∈ S_seg ∧ α_disc A ⊆ Cyl}) ∪ (oneVertexSociety '' Orphans)) + := by + subst Orphans + subst Cyl + let Cyl := Δ \ discInt Δ₂ + let S_seg_cyl := {A | A ∈ S_seg ∧ α_disc A ⊆ Cyl} + let Orphans := {u ∈ segregationVertices S_seg | α_pt u ∈ Cyl} \ ⋃ A ∈ S_seg_cyl, V(A.G) + let S_seg_orph : Set (Society α β) := oneVertexSociety '' Orphans + let S_seg_1 := S_seg_cyl ∪ S_seg_orph + refine ⟨⟨hScyl_fin.union (hOrphans_fin.image _), hSeg1_le, ?_, ?_, ?_⟩, ?_⟩ + · have hFam_le : ∀ K ∈ (fun S₀ : Society α β => S₀.G) '' S_seg_1, K ≤ N.G := by + rintro _ ⟨S₀, hS₀, rfl⟩ + exact hSeg1_le S₀ hS₀ + refine (Compatible.of_le_le (subgraphSUnion_le hFam_le) le_rfl).ext ?_ ?_ + · rw [vertexSet_subgraphSUnion] + refine Subset.antisymm (iUnion₂_subset fun K hK => (hFam_le K hK).vertexSet_mono) ?_ + intro v hv + rw [hN_G, arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce] at hv + rcases hv.1 with hv_cyl | hv_seg_cyl + · obtain ⟨A, hA, hvA⟩ := mem_iUnion₂.mp hv_cyl + exact mem_iUnion₂.mpr ⟨A.G, ⟨A, Or.inl hA, rfl⟩, hvA⟩ + · by_cases hv_in : v ∈ ⋃ A ∈ S_seg_cyl, V(A.G) + · obtain ⟨A, hA, hvA⟩ := mem_iUnion₂.mp hv_in + exact mem_iUnion₂.mpr ⟨A.G, ⟨A, Or.inl hA, rfl⟩, hvA⟩ + · have hv_orph : v ∈ Orphans := ⟨hv_seg_cyl, hv_in⟩ + exact mem_iUnion₂.mpr ⟨(oneVertexSociety v).G, + ⟨oneVertexSociety v, Or.inr ⟨v, hv_orph, rfl⟩, rfl⟩, by simp⟩ + · rw [edgeSet_subgraphSUnion hFam_le] + refine Subset.antisymm (iUnion₂_subset fun K hK => (hFam_le K hK).edgeSet_mono) ?_ + intro e he + rw [hEP_Cyl] at he + obtain ⟨A, hA, heA⟩ := mem_iUnion₂.mp he + exact mem_iUnion₂.mpr ⟨A.G, ⟨A, Or.inl hA, rfl⟩, heA⟩ + · rintro S₁ (hA₁ | ⟨u₁, hu₁, rfl⟩) S₂ (hA₂ | ⟨u₂, hu₂, rfl⟩) hne + · exact hSeg.1.vertex_inter_subset S₁ hA₁.1 S₂ hA₂.1 hne + · rintro x ⟨hx₁, hx₂⟩ + rw [oneVertexSociety_V, mem_singleton_iff] at hx₂ + subst hx₂ + exact (hu₂.2 (mem_iUnion₂.mpr ⟨S₁, hA₁, hx₁⟩)).elim + · rintro x ⟨hx₁, hx₂⟩ + rw [oneVertexSociety_V, mem_singleton_iff] at hx₁ + subst hx₁ + exact (hu₁.2 (mem_iUnion₂.mpr ⟨S₂, hA₂, hx₂⟩)).elim + · rintro x ⟨hx₁, hx₂⟩ + rw [oneVertexSociety_V, mem_singleton_iff] at hx₁ hx₂ + exact (hne (congrArg oneVertexSociety (hx₁.symm.trans hx₂))).elim + · rintro S₁ (hA₁ | ⟨u₁, _, rfl⟩) S₂ (hA₂ | ⟨u₂, _, rfl⟩) hne + · exact hSeg.1.edge_disjoint S₁ hA₁.1 S₂ hA₂.1 hne + · rw [oneVertexSociety_E]; exact disjoint_bot_right + · rw [oneVertexSociety_E]; exact disjoint_bot_left + · rw [oneVertexSociety_E]; exact disjoint_bot_left + · rintro S₀ (hA | ⟨u, _, rfl⟩) + · exact hSeg.2 S₀ hA.1 + · rw [oneVertexSociety_bar, ncard_singleton] + omega + +private theorem cylindrical_cells_and_orphans_form_arrangement + {S : Type w} + [TopologicalSpace S] + {α : Type u} + {β : Type v} + (hS : IsClosedSurface S) + {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} + {α_pt : α → S} + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (Cyl : Set S) + (H' : Drawing S) + (Orphans : Set α) + (c' : S → ℂ) + (ε : ℝ) + (D_orph : α → Set S) + (hD_orph : ∀ u ∈ Orphans, IsClosedDisc (D_orph u) ∧ D_orph u ⊆ Cyl ∩ (fun u => ((⋃ A ∈ ({A | A + ∈ S_seg ∧ α_disc A ⊆ Cyl}), α_disc A) ∪ H'.V \ {α_pt u})ᶜ) u ∧ α_pt u ∈ subBd (D_orph u) ∧ ∀ + x ∈ D_orph u, dist (c' x) (c' (α_pt u)) < ε) + (α_disc_1 : Society α β → Set S) + (hα_disc_1_cyl : ∀ {A : Society α β}, A ∈ ({A | A ∈ S_seg ∧ α_disc A ⊆ Cyl}) → α_disc_1 A = + α_disc A) + (hα_disc_1_orph : ∀ {u : α}, u ∈ Orphans → α_disc_1 (oneVertexSociety u) = D_orph u) + (hD_orph_disj : ∀ {u₁ u₂ : α}, u₁ ∈ Orphans → u₂ ∈ Orphans → u₁ ≠ u₂ → Disjoint (D_orph u₁) + (D_orph u₂)) + (hseg1_sub_seg : segregationVertices (({A | A ∈ S_seg ∧ α_disc A ⊆ Cyl}) ∪ (oneVertexSociety + '' Orphans)) ⊆ segregationVertices S_seg) : + IsSurfaceArrangement (({A | A ∈ S_seg ∧ α_disc A ⊆ Cyl}) ∪ (oneVertexSociety '' Orphans)) + α_disc_1 α_pt := by + let S_seg_cyl := {A | A ∈ S_seg ∧ α_disc A ⊆ Cyl} + let S_seg_orph : Set (Society α β) := oneVertexSociety '' Orphans + let S_seg_1 := S_seg_cyl ∪ S_seg_orph + let K_cyl := ⋃ A ∈ S_seg_cyl, α_disc A + let U_open := fun u => (K_cyl ∪ H'.V \ {α_pt u})ᶜ + refine ⟨?_, ?_, ?_, hArr.injOn_pts.mono hseg1_sub_seg, ?_⟩ + · rintro S₀ (hA | ⟨u, hu, rfl⟩) + · rw [hα_disc_1_cyl hA] + exact hArr.isClosedDisc S₀ hA.1 + · rw [hα_disc_1_orph hu] + refine ⟨(hD_orph u hu).1, ?_⟩ + intro x hx + simp only [mem_singleton_iff] at hx + rw [hx] + exact (hD_orph u hu).2.2.1 + · rintro S₁ (hA₁ | ⟨u₁, hu₁, rfl⟩) S₂ (hA₂ | ⟨u₂, hu₂, rfl⟩) hne + · rw [hα_disc_1_cyl hA₁, hα_disc_1_cyl hA₂] + exact hArr.inter_discs S₁ hA₁.1 S₂ hA₂.1 hne + · rw [hα_disc_1_cyl hA₁, hα_disc_1_orph hu₂] + rintro x ⟨hx₁, hx₂⟩ + have hx_U : x ∈ U_open u₂ := ((hD_orph u₂ hu₂).2.1 hx₂).2 + exact (hx_U (Or.inl (mem_iUnion₂.mpr ⟨S₁, hA₁, hx₁⟩))).elim + · rw [hα_disc_1_orph hu₁, hα_disc_1_cyl hA₂] + rintro x ⟨hx₁, hx₂⟩ + have hx_U : x ∈ U_open u₁ := ((hD_orph u₁ hu₁).2.1 hx₁).2 + exact (hx_U (Or.inl (mem_iUnion₂.mpr ⟨S₂, hA₂, hx₂⟩))).elim + · rw [hα_disc_1_orph hu₁, hα_disc_1_orph hu₂] + have hu_ne : u₁ ≠ u₂ := fun hEq => hne (congrArg oneVertexSociety hEq) + rintro x ⟨hx₁, hx₂⟩ + exact (Set.disjoint_left.mp (hD_orph_disj hu₁ hu₂ hu_ne) hx₁ hx₂).elim + · rintro S₀ _ x ⟨_, hx_bd⟩ + exact (hx_bd (hS.2.2 x)).elim + · rintro S₀ (hA | ⟨u, hu, rfl⟩) + · rw [hα_disc_1_cyl hA] + exact hArr.natural_order S₀ hA.1 + · rw [hα_disc_1_orph hu] + have hD_u : IsClosedDisc (D_orph u) := (hD_orph u hu).1 + have hF_OArc : IsOArc (subBd (D_orph u)) := + IsClosedDisc.subBd_eq_discBd hS hD_u ▸ hD_u.isOArc_discBd + obtain ⟨φ⟩ := id hF_OArc + refine ⟨hF_OArc, φ, ?_, ?_⟩ + · intro v hv + simp only [mem_singleton_iff] at hv + rw [hv] + exact (hD_orph u hu).2.2.1 + · intro v₁ v₂ v₃ hcw + have hv₁ : v₁ ∈ (oneVertexSociety u : Society α β).Ω.bar := hcw.2.1 v₁ (by simp) + have hv₂ : v₂ ∈ (oneVertexSociety u : Society α β).Ω.bar := hcw.2.1 v₂ (by simp) + simp only [mem_singleton_iff] at hv₁ hv₂ + exact False.elim ((List.nodup_cons.mp hcw.1).1 (by simp [hv₁, hv₂])) + +private theorem cylindrical_arrangement_is_compatible + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (hS : IsClosedSurface S) + {G' : Graph α β} + {H : Drawing S} + {η' : SpanEmbedding H G'} + {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} + {α_pt : α → S} + {Δ : Set S} + {Δ₂ : Set S} + {N : Neighborhood α β} + {η_1 : SpanEmbedding (H.interSet (Δ \ discInt Δ₂)) N.G} + (hSeg : IsThreeSegregation G' S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hΔ : IsClosedDisc Δ) + (hΔ₂ : IsClosedDisc Δ₂) + (hNorm_Δ : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) + (hNorm_Δ₂ : IsArrangementNormal S_seg α_disc α_pt (subBd Δ₂)) + (hη_1_v : ∀ v ∈ (H.interSet (Δ \ discInt Δ₂)).V, η_1.vMap v = η'.vMap v) + (hη_1_e : ∀ e ∈ (H.interSet (Δ \ discInt Δ₂)).E, η_1.eMap e = η'.eMap e) + (hV_H' : (H.interSet (Δ \ discInt Δ₂)).V = H.V ∩ (Δ \ discInt Δ₂)) + (hU_H' : (H.interSet (Δ \ discInt Δ₂)).U = H.U ∩ (Δ \ discInt Δ₂)) + (hE_H' : (H.interSet (Δ \ discInt Δ₂)).E = {e | e ∈ H.E ∧ e ⊆ Δ \ discInt Δ₂}) + (Orphans : Set α) + (hOrphans : Orphans = {u ∈ segregationVertices S_seg | α_pt u ∈ (Δ \ discInt Δ₂)} \ + ⋃ A ∈ {A | A ∈ S_seg ∧ α_disc A ⊆ (Δ \ discInt Δ₂)}, V(A.G)) + (c' : S → ℂ) + (ε : ℝ) + (D_orph : α → Set S) + (hD_orph : ∀ u ∈ Orphans, IsClosedDisc (D_orph u) ∧ D_orph u ⊆ (Δ \ discInt Δ₂) ∩ (fun u => + ((⋃ A ∈ ({A | A + ∈ S_seg ∧ α_disc A ⊆ (Δ \ discInt Δ₂)}), α_disc A) ∪ (H.interSet + (Δ \ discInt Δ₂)).V \ {α_pt u})ᶜ) u ∧ α_pt u ∈ subBd (D_orph u) ∧ ∀ + x ∈ D_orph u, dist (c' x) (c' (α_pt u)) < ε) + (α_disc_1 : Society α β → Set S) + (hα_disc_1_cyl : ∀ {A : Society α β}, A ∈ ({A | A ∈ S_seg ∧ α_disc A ⊆ (Δ \ discInt Δ₂)}) + → α_disc_1 A = + α_disc A) + (hα_disc_1_orph : ∀ {u : α}, u ∈ Orphans → α_disc_1 (oneVertexSociety u) = D_orph u) + (hseg1_sub_seg : segregationVertices (({A | A ∈ S_seg ∧ α_disc A ⊆ (Δ \ discInt Δ₂)}) ∪ + (oneVertexSociety + '' Orphans)) ⊆ segregationVertices S_seg) : + IsCompatibleWith N.G (H.interSet (Δ \ discInt Δ₂)) η_1 (({A | A ∈ S_seg ∧ α_disc A ⊆ + (Δ \ discInt Δ₂)}) ∪ (oneVertexSociety '' + Orphans)) α_disc_1 α_pt := by + subst Orphans + let Cyl := Δ \ discInt Δ₂ + let H' := H.interSet Cyl + let S_seg_cyl := {A | A ∈ S_seg ∧ α_disc A ⊆ (Δ \ discInt Δ₂)} + let Orphans := {u ∈ segregationVertices S_seg | α_pt u ∈ Cyl} \ ⋃ A ∈ S_seg_cyl, V(A.G) + let S_seg_orph : Set (Society α β) := oneVertexSociety '' Orphans + let S_seg_1 := S_seg_cyl ∪ S_seg_orph + let K_cyl := ⋃ A ∈ S_seg_cyl, α_disc A + let U_open := fun u => (K_cyl ∪ H'.V \ {α_pt u})ᶜ + have hEdges_in_K : ∀ e ∈ H'.E, e ⊆ K_cyl := by + intro e he + rw [hE_H'] at he + obtain ⟨p, hp⟩ := he.1.1 + have he_G' : η'.eMap e ∈ E(G') := η'.imageGraph_le.edgeSet_mono (η'.bijOn_e.mapsTo he.1) + have he_u : η'.eMap e ∈ E(subgraphSUnion G' ((fun A : Society α β => A.G) '' S_seg)) := by + rw [hSeg.1.union_eq]; exact he_G' + rw [edgeSet_subgraphSUnion (by rintro _ ⟨A, hA, rfl⟩; exact hSeg.1.le A hA)] at he_u + obtain ⟨_, ⟨A, hA, rfl⟩, heA⟩ := mem_iUnion₂.mp he_u + have he_disc : e ⊆ α_disc A := (hComp.inter_E_iff A hA e he.1).mpr heA + have hA_sub : α_disc A ⊆ (Δ \ discInt Δ₂) := by + by_contra hnot + obtain ⟨_, hbar⟩ := + disc_subset_cyl_iff hS hArr hΔ hΔ₂ hNorm_Δ hNorm_Δ₂ hA + obtain ⟨y, hy_bar, rfl⟩ := (hbar hnot).2 ⟨he_disc hp, he.2 hp⟩ + have hx_bdA : α_pt y ∈ H.U ∩ subBd (α_disc A) := + ⟨(he.1.2.1 hp).1, (hArr.isClosedDisc A hA).2 y hy_bar⟩ + rw [hComp.bd_inter_eq A hA] at hx_bdA + exact (he.1.2.1 hp).2 hx_bdA.1 + exact he_disc.trans (subset_biUnion_of_mem ⟨hA, hA_sub⟩) + have hOrph_pt_vMap : ∀ {u : α}, u ∈ Orphans → ∀ {v : S}, v ∈ H'.V → + (v = α_pt u ↔ η_1.vMap v = u) := by + intro u hu v hv + rw [hη_1_v v hv] + rw [hV_H'] at hv + constructor + · rintro rfl + obtain ⟨B, hB, hu_barB⟩ := mem_iUnion₂.mp hu.1.1 + have hbdB : α_pt u ∈ H.U ∩ subBd (α_disc B) := + ⟨H.V_subset_U hv.1, (hArr.isClosedDisc B hB).2 u hu_barB⟩ + rw [hComp.bd_inter_eq B hB] at hbdB + have hv_seg : η'.vMap (α_pt u) ∈ segregationVertices S_seg := mem_biUnion hB hbdB.2 + have hpt_eq : α_pt (η'.vMap (α_pt u)) = α_pt u := hComp.pt_eq (α_pt u) hv.1 hv_seg + exact hArr.injOn_pts hv_seg hu.1.1 hpt_eq + · rintro rfl + exact (hComp.pt_eq v hv.1 hu.1.1).symm + refine ⟨?_, ?_, ?_, ?_⟩ + · intro v hv hv_seg1 + rw [hη_1_v v hv] + rw [hV_H'] at hv + exact hComp.pt_eq v hv.1 (hseg1_sub_seg (hη_1_v v (hV_H'.symm ▸ hv) ▸ hv_seg1)) + · rintro S₀ (hA | ⟨u, hu, rfl⟩) + · rw [hα_disc_1_cyl hA] + ext x + simp only [mem_inter_iff, mem_sep_iff] + constructor + · rintro ⟨hxU', hx_bd⟩ + rw [hU_H'] at hxU' + have hx_in : x ∈ H.U ∩ subBd (α_disc S₀) := ⟨hxU'.1, hx_bd⟩ + rw [hComp.bd_inter_eq S₀ hA.1] at hx_in + have hxV' : x ∈ H'.V := hV_H'.symm ▸ ⟨hx_in.1, hxU'.2⟩ + exact ⟨hxV', (hη_1_v x hxV').symm ▸ hx_in.2⟩ + · rintro ⟨hxV', hx_bar⟩ + rw [hη_1_v x hxV'] at hx_bar + rw [hV_H'] at hxV' + have hx_in : x ∈ H.U ∩ subBd (α_disc S₀) := by + rw [hComp.bd_inter_eq S₀ hA.1] + exact ⟨hxV'.1, hx_bar⟩ + exact ⟨hU_H'.symm ▸ ⟨hx_in.1, hxV'.2⟩, hx_in.2⟩ + · rw [hα_disc_1_orph hu, oneVertexSociety_bar] + have hD_u : IsClosedDisc (D_orph u) := (hD_orph u hu).1 + have hbd_sub_D : subBd (D_orph u) ⊆ D_orph u := + fun x hx => hD_u.isClosed.closure_subset_iff.mpr Subset.rfl hx.1 + ext x + simp only [mem_inter_iff, mem_sep_iff, mem_singleton_iff] + constructor + · rintro ⟨hxU', hx_bd⟩ + have hx_D : x ∈ D_orph u := hbd_sub_D hx_bd + have hx_Uopen : x ∈ U_open u := ((hD_orph u hu).2.1 hx_D).2 + have hxV' : x ∈ H'.V := by + by_contra hx_not_V' + rw [hU_H'] at hxU' + have hx_not_HV : x ∉ H.V := fun hxHV => hx_not_V' (hV_H'.symm ▸ ⟨hxHV, hxU'.2⟩) + obtain ⟨e, heH, hxe⟩ := H.exists_edge_of_mem hxU'.1 hx_not_HV + have heH' : e ∈ H'.E := by + rw [hE_H'] + refine ⟨heH, ?_⟩ + have he_G' : η'.eMap e ∈ E(G') := + η'.imageGraph_le.edgeSet_mono (η'.bijOn_e.mapsTo heH) + have he_u : η'.eMap e ∈ + E(subgraphSUnion G' ((fun A : Society α β => A.G) '' S_seg)) := by + rw [hSeg.1.union_eq]; exact he_G' + rw [edgeSet_subgraphSUnion + (by rintro _ ⟨A, hA, rfl⟩; exact hSeg.1.le A hA)] at he_u + obtain ⟨_, ⟨A, hA, rfl⟩, heA⟩ := mem_iUnion₂.mp he_u + have he_disc : e ⊆ α_disc A := (hComp.inter_E_iff A hA e heH).mpr heA + have hA_sub : α_disc A ⊆ (Δ \ discInt Δ₂) := by + by_contra hnot + obtain ⟨_, hbar⟩ := + disc_subset_cyl_iff hS hArr hΔ hΔ₂ hNorm_Δ hNorm_Δ₂ hA + obtain ⟨y, hy_bar, rfl⟩ := (hbar hnot).2 ⟨he_disc hxe, hxU'.2⟩ + have hx_bdA : α_pt y ∈ H.U ∩ subBd (α_disc A) := + ⟨hxU'.1, (hArr.isClosedDisc A hA).2 y hy_bar⟩ + rw [hComp.bd_inter_eq A hA] at hx_bdA + exact hx_not_HV hx_bdA.1 + exact he_disc.trans hA_sub + exact hx_Uopen (Or.inl (hEdges_in_K e heH' hxe)) + have hx_eq : x = α_pt u := by + by_contra hne + exact hx_Uopen (Or.inr ⟨hxV', hne⟩) + exact ⟨hxV', (hOrph_pt_vMap hu hxV').mp hx_eq⟩ + · rintro ⟨hxV', hx_bar⟩ + have hx_eq : x = α_pt u := (hOrph_pt_vMap hu hxV').mpr hx_bar + exact ⟨H'.V_subset_U hxV', hx_eq ▸ (hD_orph u hu).2.2.1⟩ + · rintro S₀ (hA | ⟨u, hu, rfl⟩) v hv + · rw [hα_disc_1_cyl hA, hη_1_v v hv] + rw [hV_H'] at hv + exact hComp.inter_V_iff S₀ hA.1 v hv.1 + · rw [hα_disc_1_orph hu, oneVertexSociety_V, mem_singleton_iff, ← hOrph_pt_vMap hu hv] + constructor + · intro hv_D + have hv_U : v ∈ U_open u := ((hD_orph u hu).2.1 hv_D).2 + by_contra hne + exact hv_U (Or.inr ⟨hv, hne⟩) + · rintro rfl + have hD_u : IsClosedDisc (D_orph u) := (hD_orph u hu).1 + exact hD_u.isClosed.closure_subset_iff.mpr Subset.rfl (hD_orph u hu).2.2.1.1 + · rintro S₀ (hA | ⟨u, hu, rfl⟩) e he + · rw [hα_disc_1_cyl hA, hη_1_e e he] + rw [hE_H'] at he + exact hComp.inter_E_iff S₀ hA.1 e he.1 + · rw [hα_disc_1_orph hu, oneVertexSociety_E] + simp only [mem_empty_iff_false, iff_false] + intro hsub + have he_H : e ∈ H.E := (hE_H' ▸ he).1 + obtain ⟨p, hp⟩ := he_H.1 + have hp_U : p ∈ U_open u := ((hD_orph u hu).2.1 (hsub hp)).2 + exact hp_U (Or.inl (hEdges_in_K e he hp)) + +private theorem small_orphan_discs_are_pairwise_disjoint + {S : Type w} + [TopologicalSpace S] + {α : Type u} + {α_pt : α → S} + (Cyl : Set S) + (Orphans : Set α) + (c' : S → ℂ) + (ε : ℝ) + (hε_lt : ∀ x ∈ ({p : α × α | p.1 ∈ Orphans ∧ p.2 ∈ Orphans ∧ p.1 ≠ p.2}), ε < dist (c' + (α_pt x.1)) (c' + (α_pt x.2)) / 2) + (U_open : α → Set S) + (D_orph : α → Set S) + (hD_orph : ∀ u ∈ Orphans, IsClosedDisc (D_orph u) ∧ D_orph u ⊆ Cyl ∩ U_open u ∧ α_pt u ∈ subBd + (D_orph u) ∧ ∀ x ∈ D_orph u, dist (c' x) (c' (α_pt u)) < ε) : + ∀ {u₁ u₂ : α}, u₁ ∈ Orphans → u₂ ∈ Orphans → u₁ ≠ u₂ → Disjoint (D_orph u₁) (D_orph u₂) := by + let Pairs : Set (α × α) := {p | p.1 ∈ Orphans ∧ p.2 ∈ Orphans ∧ p.1 ≠ p.2} + intro u₁ u₂ hu₁ hu₂ hne + refine Set.disjoint_left.mpr fun x hx₁ hx₂ => ?_ + have hd₁ : dist (c' x) (c' (α_pt u₁)) < ε := (hD_orph u₁ hu₁).2.2.2 x hx₁ + have hd₂ : dist (c' x) (c' (α_pt u₂)) < ε := (hD_orph u₂ hu₂).2.2.2 x hx₂ + have hpair : ε < dist (c' (α_pt u₁)) (c' (α_pt u₂)) / 2 := + hε_lt (u₁, u₂) ⟨hu₁, hu₂, hne⟩ + have htri : dist (c' (α_pt u₁)) (c' (α_pt u₂)) ≤ + dist (c' (α_pt u₁)) (c' x) + dist (c' x) (c' (α_pt u₂)) := + dist_triangle _ _ _ + rw [dist_comm (c' (α_pt u₁)) (c' x)] at htri + linarith + +/-- Construction of the 3-segregation `S_seg_1` of `N.G` and its compatible surface arrangement +`(α_disc_1, α_pt)` in the cylinder `Δ \ discInt Δ₂` for Graph Minors XIV, (9.6) (page 49). -/ +private theorem cylinder_segregation_9_6 [T2Space S] {α : Type u} {β : Type v} + (hS : IsClosedSurface S) + {G' : Graph α β} {H : Drawing S} {η' : SpanEmbedding H G'} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + {Δ Δ₂ : Set S} {N : Neighborhood α β} + {η_1 : SpanEmbedding (H.interSet (Δ \ discInt Δ₂)) N.G} + (hSeg : IsThreeSegregation G' S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + (hΔ : IsClosedDisc Δ) (hΔ₂ : IsClosedDisc Δ₂) + (hin : Δ₂ ⊆ Δ \ subBd Δ) + (hNorm_Δ : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) + (hNorm_Δ₂ : IsArrangementNormal S_seg α_disc α_pt (subBd Δ₂)) + (hN_G : N.G = arrangementPullbackGraph G' S_seg α_disc α_pt (Δ \ discInt Δ₂)) + (hPull_Ω : IsPullbackPerm S_seg α_pt (subBd Δ) N.Ω) + (hPull_Ω₀ : IsPullbackPerm S_seg α_pt (subBd Δ₂) N.Ω₀) + (hη_1_v : ∀ v ∈ (H.interSet (Δ \ discInt Δ₂)).V, η_1.vMap v = η'.vMap v) + (hη_1_e : ∀ e ∈ (H.interSet (Δ \ discInt Δ₂)).E, η_1.eMap e = η'.eMap e) + (hV_H' : (H.interSet (Δ \ discInt Δ₂)).V = H.V ∩ (Δ \ discInt Δ₂)) + (hU_H' : (H.interSet (Δ \ discInt Δ₂)).U = H.U ∩ (Δ \ discInt Δ₂)) + (hE_H' : (H.interSet (Δ \ discInt Δ₂)).E = {e ∈ H.E | e ⊆ Δ \ discInt Δ₂}) : + ∃ (S_seg_1 : Set (Society α β)) (α_disc_1 : Society α β → Set S), + IsThreeSegregation N.G S_seg_1 ∧ + IsSurfaceArrangement S_seg_1 α_disc_1 α_pt ∧ + IsCompatibleWith N.G (H.interSet (Δ \ discInt Δ₂)) η_1 S_seg_1 α_disc_1 α_pt ∧ + (∀ S₀ ∈ S_seg_1, α_disc_1 S₀ ⊆ Δ \ discInt Δ₂) ∧ + IsPullbackPerm S_seg_1 α_pt (discBd Δ) N.Ω ∧ + IsPullbackPerm S_seg_1 α_pt (discBd Δ₂) N.Ω₀ := by + classical + let Cyl := Δ \ discInt Δ₂ + let H' := H.interSet Cyl + let S_seg_cyl : Set (Society α β) := {A ∈ S_seg | α_disc A ⊆ Cyl} + let Orphans : Set α := + {u ∈ segregationVertices S_seg | α_pt u ∈ Cyl} \ ⋃ A ∈ S_seg_cyl, V(A.G) + let S_seg_orph : Set (Society α β) := (oneVertexSociety : α → Society α β) '' Orphans + let S_seg_1 : Set (Society α β) := S_seg_cyl ∪ S_seg_orph + have hseg_sub_G' : segregationVertices S_seg ⊆ V(G') := by + intro x hx + obtain ⟨A, hA, hx_bar⟩ := mem_iUnion₂.mp hx + exact (hSeg.1.le A hA).vertexSet_mono (A.bar_subset hx_bar) + have hbar_pt_in_disc : ∀ {A : Society α β}, A ∈ S_seg → + ∀ {x : α}, x ∈ A.Ω.bar → α_pt x ∈ α_disc A := by + intro A hA x hx_bar + obtain ⟨hD, hD_bd⟩ := hArr.isClosedDisc A hA + exact hD.isClosed.closure_subset_iff.mpr Subset.rfl (hD_bd x hx_bar).1 + have hOrphans_bd : ∀ u ∈ Orphans, α_pt u ∈ subBd Δ ∪ subBd Δ₂ := by + rintro u ⟨⟨hu_seg, hu_Cyl⟩, hu_not_cyl⟩ + obtain ⟨A, hA, hu_bar⟩ := mem_iUnion₂.mp hu_seg + have hA_not_cyl : ¬ (α_disc A ⊆ Cyl) := fun hsub => + hu_not_cyl (mem_iUnion₂.mpr ⟨A, ⟨hA, hsub⟩, A.bar_subset hu_bar⟩) + obtain ⟨_, hbar⟩ := disc_subset_cyl_iff hS hArr hΔ hΔ₂ hNorm_Δ hNorm_Δ₂ hA + exact (hbar hA_not_cyl).1 ⟨hbar_pt_in_disc hA hu_bar, hu_Cyl⟩ + have hOrphans_not_in_K : ∀ u ∈ Orphans, ∀ A ∈ S_seg_cyl, α_pt u ∉ α_disc A := by + rintro u ⟨⟨hu_seg, _⟩, hu_not_cyl⟩ A ⟨hA, hA_Cyl⟩ hpt_in_A + obtain ⟨B, hB, hu_barB⟩ := mem_iUnion₂.mp hu_seg + have hAB_ne : B ≠ A := fun hEq => + hu_not_cyl (mem_iUnion₂.mpr ⟨A, ⟨hA, hA_Cyl⟩, hEq ▸ B.bar_subset hu_barB⟩) + have hpt_inter : α_pt u ∈ α_disc B ∩ α_disc A := ⟨hbar_pt_in_disc hB hu_barB, hpt_in_A⟩ + obtain ⟨w, ⟨hwB, hwA⟩, hw_eq⟩ := hArr.inter_discs B hB A hA hAB_ne hpt_inter + have hwu : w = u := hArr.injOn_pts (mem_biUnion hB hwB) hu_seg hw_eq + exact hu_not_cyl (mem_iUnion₂.mpr ⟨A, ⟨hA, hA_Cyl⟩, hwu ▸ A.bar_subset hwA⟩) + have hOrphans_fin : Orphans.Finite := by + refine (N.Ω.finite_bar.union N.Ω₀.finite_bar).subset ?_ + intro u hu + rcases hOrphans_bd u hu with hbd₁ | hbd₂ + · exact Or.inl (hPull_Ω.1.symm ▸ ⟨hu.1.1, hbd₁⟩) + · exact Or.inr (hPull_Ω₀.1.symm ▸ ⟨hu.1.1, hbd₂⟩) + have hDisj_cyl_orph : Disjoint S_seg_cyl S_seg_orph := by + refine Set.disjoint_left.mpr ?_ + rintro A hA ⟨u, hu_orph, rfl⟩ + have hu_in_A : u ∈ V((oneVertexSociety u : Society α β).G) := mem_singleton u + exact hu_orph.2 (mem_iUnion₂.mpr ⟨oneVertexSociety u, hA, hu_in_A⟩) + -- Construct small discs `D_orph u` for `u ∈ Orphans` + obtain ⟨c, c', hc, hc', hmc, hmc', hleft, hright, hΔ₂_eq, hbdΔ_eq, hbdΔ₂_eq⟩ := + exists_collar_coords hS hΔ hΔ₂ hin + let Pairs : Set (α × α) := {p : α × α | p.1 ∈ Orphans ∧ p.2 ∈ Orphans ∧ p.1 ≠ p.2} + have hPairs_fin : Pairs.Finite := + (hOrphans_fin.prod hOrphans_fin).subset fun _ hp => ⟨hp.1, hp.2.1⟩ + have hPairs_pos : ∀ p ∈ Pairs, 0 < dist (c' (α_pt p.1)) (c' (α_pt p.2)) / 2 := by + rintro ⟨u, v⟩ ⟨hu, hv, huv⟩ + refine half_pos (dist_pos.mpr fun hEq => huv ?_) + have hpt_eq : α_pt u = α_pt v := by + have h1 := congrArg c hEq + rwa [hright hu.1.2.1, hright hv.1.2.1] at h1 + exact hArr.injOn_pts hu.1.1 hv.1.1 hpt_eq + obtain ⟨ε, hε_pos, hε_lt⟩ := exists_pos_lt_of_finite hPairs_fin hPairs_pos + let K_cyl : Set S := ⋃ A ∈ S_seg_cyl, α_disc A + have hScyl_fin : S_seg_cyl.Finite := hSeg.1.finite.subset fun _ h => h.1 + have hK_cl : IsClosed K_cyl := + hScyl_fin.isClosed_biUnion fun A hA => (hArr.isClosedDisc A hA.1).1.isClosed + have hH'V_fin : H'.V.Finite := H.finite_V.subset (hV_H' ▸ inter_subset_left) + let U_open : α → Set S := fun u => (K_cyl ∪ (H'.V \ {α_pt u}))ᶜ + have hU_open : ∀ u, IsOpen (U_open u) := fun u => + (hK_cl.union ((hH'V_fin.subset sdiff_subset).isClosed)).isOpen_compl + have hu_in_U : ∀ u ∈ Orphans, α_pt u ∈ U_open u := by + rintro u hu (hK | ⟨_, hne⟩) + · obtain ⟨A, hA, huA⟩ := mem_iUnion₂.mp hK + exact hOrphans_not_in_K u hu A hA huA + · exact hne rfl + have hex_D : ∀ u : α, ∃ D : Set S, + u ∈ Orphans → + IsClosedDisc D ∧ D ⊆ Cyl ∩ U_open u ∧ α_pt u ∈ subBd D ∧ + ∀ x ∈ D, dist (c' x) (c' (α_pt u)) < ε := by + intro u + by_cases hu : u ∈ Orphans + · obtain ⟨D, hD⟩ := exists_small_collar_disc hS hΔ hΔ₂ hc hc' hmc hmc' hleft hright + hΔ₂_eq hbdΔ_eq hbdΔ₂_eq (hOrphans_bd u hu) (hU_open u) (hu_in_U u hu) hε_pos + exact ⟨D, fun _ => hD⟩ + · exact ⟨∅, fun h => (hu h).elim⟩ + choose D_orph hD_orph using hex_D + let α_disc_1 : Society α β → Set S := fun S₀ => + if h : ∃ u ∈ Orphans, S₀ = oneVertexSociety u then D_orph h.choose else α_disc S₀ + have hα_disc_1_cyl : ∀ {A : Society α β}, A ∈ S_seg_cyl → α_disc_1 A = α_disc A := by + intro A hA + have hnot : ¬ ∃ u ∈ Orphans, A = oneVertexSociety u := by + rintro ⟨u, hu, rfl⟩ + exact Set.disjoint_left.mp hDisj_cyl_orph hA ⟨u, hu, rfl⟩ + simp [α_disc_1, hnot] + have hα_disc_1_orph : ∀ {u : α}, u ∈ Orphans → α_disc_1 (oneVertexSociety u) = D_orph u := by + intro u hu + have hex : ∃ v ∈ Orphans, (oneVertexSociety u : Society α β) = oneVertexSociety v := + ⟨u, hu, rfl⟩ + have hchoose : hex.choose = u := oneVertexSociety_inj hex.choose_spec.2.symm + dsimp only [α_disc_1] + rw [dite_eq_left_of_eq_true (eq_true hex), hchoose] + have hD_orph_disj : ∀ {u₁ u₂ : α}, u₁ ∈ Orphans → u₂ ∈ Orphans → u₁ ≠ u₂ → + Disjoint (D_orph u₁) (D_orph u₂) := by + exact small_orphan_discs_are_pairwise_disjoint (S := S) (α := α) (α_pt := α_pt) Cyl Orphans c' + ε hε_lt U_open D_orph hD_orph + -- Helper facts about `N.G` and `segregationVertices S_seg_1` + have hEP_Cyl : E(N.G) = ⋃ A ∈ S_seg_cyl, E(A.G) := by + rw [hN_G] + ext e + simp only [arrangementPullbackGraph, edgeSet_restrict, mem_inter_iff, edgeSet_induce] + refine ⟨fun h => h.2, fun he => ⟨?_, he⟩⟩ + obtain ⟨A, hA, heA⟩ := mem_iUnion₂.mp he + obtain ⟨u, v, huv⟩ := A.G.exists_isLink_of_mem_edgeSet heA + have huv_G' : G'.IsLink e u v := huv.mono (hSeg.1.le A hA.1) + exact ⟨u, v, huv_G', + ⟨Or.inl (mem_iUnion₂.mpr ⟨A, hA, huv.left_mem⟩), huv_G'.left_mem⟩, + ⟨Or.inl (mem_iUnion₂.mpr ⟨A, hA, huv.right_mem⟩), huv_G'.right_mem⟩⟩ + have hNG_le_G' : N.G ≤ G' := + hN_G ▸ Graph.restrict_le.trans (G'.induce_le inter_subset_right) + have hSeg1_le : ∀ S₀ ∈ S_seg_1, S₀.G ≤ N.G := by + rintro S₀ (hA | ⟨u, hu, rfl⟩) + · refine ⟨?_, fun e x y hlink => ?_⟩ + · intro v hv + rw [hN_G, arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce] + exact ⟨Or.inl (mem_iUnion₂.mpr ⟨S₀, hA, hv⟩), (hSeg.1.le S₀ hA.1).vertexSet_mono hv⟩ + · have he : e ∈ E(N.G) := hEP_Cyl ▸ mem_iUnion₂.mpr ⟨S₀, hA, hlink.edge_mem⟩ + exact (hNG_le_G'.isLink_iff he).mpr (hlink.mono (hSeg.1.le S₀ hA.1)) + · refine ⟨?_, fun _ _ _ h => h.elim⟩ + rintro x (rfl : x = u) + rw [hN_G, arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce] + exact ⟨Or.inr hu.1, hseg_sub_G' hu.1.1⟩ + have hseg_in_bar : ∀ {A : Society α β}, A ∈ S_seg → + ∀ {x : α}, x ∈ V(A.G) → x ∈ segregationVertices S_seg → x ∈ A.Ω.bar := by + intro A hA x hxA hx_seg + obtain ⟨A', hA', hx_bar'⟩ := mem_iUnion₂.mp hx_seg + by_cases hEq : A = A' + · subst hEq; exact hx_bar' + · exact (hSeg.1.vertex_inter_subset A hA A' hA' hEq ⟨hxA, A'.bar_subset hx_bar'⟩).1 + have hseg1_sub_seg : segregationVertices S_seg_1 ⊆ segregationVertices S_seg := by + intro v hv + obtain ⟨S₀, hS₀, hv_bar⟩ := mem_iUnion₂.mp hv + rcases hS₀ with hA | ⟨u, hu, rfl⟩ + · exact mem_biUnion hA.1 hv_bar + · change v ∈ ({u} : Set α) at hv_bar + rw [mem_singleton_iff] at hv_bar + exact hv_bar ▸ hu.1.1 + have hseg1_cyl_iff : ∀ {v : α}, α_pt v ∈ Cyl → + (v ∈ segregationVertices S_seg_1 ↔ v ∈ segregationVertices S_seg) := by + intro v hvCyl + refine ⟨fun hv1 => hseg1_sub_seg hv1, fun hv_seg => ?_⟩ + by_cases hv_in : v ∈ ⋃ A ∈ S_seg_cyl, V(A.G) + · obtain ⟨A, hA, hvA⟩ := mem_iUnion₂.mp hv_in + exact mem_biUnion (Or.inl hA) (hseg_in_bar hA.1 hvA hv_seg) + · have hv_orph : v ∈ Orphans := ⟨⟨hv_seg, hvCyl⟩, hv_in⟩ + exact mem_biUnion (Or.inr ⟨v, hv_orph, rfl⟩) (by simp) + have hcylSeg : IsThreeSegregation N.G S_seg_1 := by + exact cylindrical_cells_and_orphans_form_three_segregation (S := S) (α := α) (β := β) (G' := + G') (S_seg := S_seg) (α_disc := α_disc) (α_pt := α_pt) (Δ := Δ) (Δ₂ := Δ₂) (N := N) hSeg + hN_G Cyl rfl Orphans rfl hOrphans_fin hScyl_fin hEP_Cyl hSeg1_le + have hcylArr : IsSurfaceArrangement S_seg_1 α_disc_1 α_pt := by + exact cylindrical_cells_and_orphans_form_arrangement (S := S) (α := α) (β := β) hS (S_seg := + S_seg) (α_disc := α_disc) (α_pt := α_pt) hArr Cyl H' Orphans c' ε D_orph hD_orph α_disc_1 + hα_disc_1_cyl hα_disc_1_orph hD_orph_disj hseg1_sub_seg + have hcylComp : IsCompatibleWith N.G H' η_1 S_seg_1 α_disc_1 α_pt := by + exact cylindrical_arrangement_is_compatible (S := S) (α := α) (β := β) hS (G' := G') (H := H) + (η' := η') (S_seg := S_seg) (α_disc := α_disc) (α_pt := α_pt) (Δ := Δ) (Δ₂ := Δ₂) (N := N) + (η_1 := η_1) hSeg hArr hComp hΔ hΔ₂ hNorm_Δ hNorm_Δ₂ hη_1_v hη_1_e hV_H' hU_H' hE_H' + Orphans rfl c' ε D_orph hD_orph α_disc_1 hα_disc_1_cyl hα_disc_1_orph hseg1_sub_seg + refine ⟨S_seg_1, α_disc_1, hcylSeg, hcylArr, hcylComp, ?_, ?_, ?_⟩ + · -- 4. `∀ S₀ ∈ S_seg_1, α_disc_1 S₀ ⊆ Cyl` + rintro S₀ (hA | ⟨u, hu, rfl⟩) + · rw [hα_disc_1_cyl hA] + exact hA.2 + · rw [hα_disc_1_orph hu] + exact fun x hx => ((hD_orph u hu).2.1 hx).1 + · -- 5. `IsPullbackPerm S_seg_1 α_pt (discBd Δ) N.Ω` + obtain ⟨hCyl_cl, hCyl_bd, _⟩ := cylinder_closed_and_subBd hS hΔ hΔ₂ hin + have hbdΔ_sub_Cyl : subBd Δ ⊆ Cyl := by + intro x hx + have hx_bd : x ∈ subBd Cyl := hCyl_bd.symm ▸ Or.inl hx + exact hCyl_cl.closure_subset_iff.mpr Subset.rfl hx_bd.1 + rw [← IsClosedDisc.subBd_eq_discBd hS hΔ] + refine ⟨?_, hPull_Ω.2⟩ + rw [hPull_Ω.1] + ext v + simp only [mem_sep_iff] + exact ⟨fun ⟨hv, hbd⟩ => ⟨(hseg1_cyl_iff (hbdΔ_sub_Cyl hbd)).mpr hv, hbd⟩, + fun ⟨hv, hbd⟩ => ⟨(hseg1_cyl_iff (hbdΔ_sub_Cyl hbd)).mp hv, hbd⟩⟩ + · -- 6. `IsPullbackPerm S_seg_1 α_pt (discBd Δ₂) N.Ω₀` + obtain ⟨hCyl_cl, hCyl_bd, _⟩ := cylinder_closed_and_subBd hS hΔ hΔ₂ hin + have hbdΔ₂_sub_Cyl : subBd Δ₂ ⊆ Cyl := by + intro x hx + have hx_bd : x ∈ subBd Cyl := hCyl_bd.symm ▸ Or.inr hx + exact hCyl_cl.closure_subset_iff.mpr Subset.rfl hx_bd.1 + rw [← IsClosedDisc.subBd_eq_discBd hS hΔ₂] + refine ⟨?_, hPull_Ω₀.2⟩ + rw [hPull_Ω₀.1] + ext v + simp only [mem_sep_iff] + exact ⟨fun ⟨hv, hbd⟩ => ⟨(hseg1_cyl_iff (hbdΔ₂_sub_Cyl hbd)).mpr hv, hbd⟩, + fun ⟨hv, hbd⟩ => ⟨(hseg1_cyl_iff (hbdΔ₂_sub_Cyl hbd)).mp hv, hbd⟩⟩ + +/-! ## 6. Assembling the Cylinder Rerouting Step of (9.6) from (8.4) -/ + +private theorem inner_society_is_subgraph_of_replaced_graph + {S : Type w} + {α : Type u} + {β : Type v} + {G_amb : Graph α β} + {G : Graph α β} + {G' : Graph α β} + {J : Graph α β} + {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} + {α_pt : α → S} + (hG_eq : G = subgraphUnion G_amb G' J) + {Δ : Set S} + {localSociety : Society α β} + (hsoc_star_G : localSociety.G = subgraphUnion G_amb J (arrangementPullbackGraph G' S_seg α_disc + α_pt Δ)) + (hJ_le : J ≤ G_amb) + (hG'_le : G' ≤ G_amb) + (hP_Δ_le_G' : arrangementPullbackGraph G' S_seg α_disc α_pt Δ ≤ G') + (hP_Δ_le_amb : arrangementPullbackGraph G' S_seg α_disc α_pt Δ ≤ G_amb) + (hstar_le_amb : localSociety.G ≤ G_amb) + (hG_le_amb : G ≤ G_amb) : + localSociety.G ≤ G := by + refine ⟨?_, fun e x y hlink => ?_⟩ + · intro x hx + rw [hsoc_star_G, vertexSet_subgraphUnion] at hx + rw [hG_eq, vertexSet_subgraphUnion] + exact hx.elim Or.inr (fun hxP => Or.inl (hP_Δ_le_G'.vertexSet_mono hxP)) + · have he_G : e ∈ E(G) := by + have he_star := hlink.edge_mem + rw [hsoc_star_G, edgeSet_subgraphUnion hJ_le hP_Δ_le_amb] at he_star + rw [hG_eq, edgeSet_subgraphUnion hG'_le hJ_le] + exact he_star.elim Or.inr (fun heP => Or.inl (hP_Δ_le_G'.edgeSet_mono heP)) + exact (hG_le_amb.isLink_iff he_G).mpr (hlink.mono hstar_le_amb) + +private theorem rerouted_crooked_transaction_extends_to_replacement_society + {α : Type u} + {β : Type v} + {clearedSociety : Society α β} + (S_G0 : Society α β) + (P_set : Set (Graph α β)) + (hΩ : clearedSociety.Ω = S_G0.Ω) + (hCr_G0 : S_G0.IsCrookedTransaction P_set) + (hOmegaPath_iff : ∀ p ∈ P_set, ∀ (u v : α), clearedSociety.IsOmegaPathWithEnds p u v ↔ + S_G0.IsOmegaPathWithEnds p u v) + (hEnds_eq_G0 : clearedSociety.transactionEnds P_set = S_G0.transactionEnds P_set) : + clearedSociety.IsCrookedTransaction P_set := by + obtain ⟨⟨A, B, ⟨hDisj_paths, hPairwise⟩, hFence, hAB⟩, hNoPeriph⟩ := hCr_G0 + refine ⟨⟨A, B, ⟨fun p hp => ?_, hPairwise⟩, hΩ.symm ▸ hFence, fun p hp => ?_⟩, fun p hp hPer + => ?_⟩ + · obtain ⟨u, v, huv⟩ := hDisj_paths p hp + exact ⟨u, v, (hOmegaPath_iff p hp u v).mpr huv⟩ + · obtain ⟨u, hu, v, hv, huv⟩ := hAB p hp + exact ⟨u, hu, v, hv, (hOmegaPath_iff p hp u v).mpr huv⟩ + · obtain ⟨_, u, v, huv, hDisj_int⟩ := hPer + exact hNoPeriph p hp ⟨hp, u, v, (hOmegaPath_iff p hp u v).mp huv, hEnds_eq_G0 ▸ hΩ ▸ hDisj_int⟩ + +private theorem rerouted_path_meets_cleared_drawing_only_at_ends + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + {G_amb : Graph α β} + {G' : Graph α β} + {J : Graph α β} + {H : Drawing S} + {η : SpanEmbedding H G_amb} + {η' : SpanEmbedding H G'} + {beta : ℕ} + {d : Set S → Set S → ℕ} + {z : Set S} + {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} + {α_pt : α → S} + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η.vMap v) + (hJ_dist : ∀ v ∈ H.V, η.vMap v ∈ V(J) → d z {v} < beta) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + {Λ : Set S} + {Δ : Set S} + {clearedEmbedding : SpanEmbedding (clearedSubdrawing H Λ) G_amb} + {clearedSociety : Society α β} + {localSociety : Society α β} + (hη_Λ_v : ∀ v ∈ (clearedSubdrawing H Λ).V, clearedEmbedding.vMap v = η.vMap v) + (hsoc_star_G : localSociety.G = subgraphUnion G_amb J (arrangementPullbackGraph G' S_seg α_disc + α_pt Δ)) + {Λ_C₂ : Set S} + {Δ₂ : Set S} + (hcl_C₂_sub : closure Λ_C₂ ⊆ Λ) + (hΔ₂_sub_cl_C₂ : Δ₂ ⊆ closure Λ_C₂) + (Δ₀ : Set S) + (hΔ₀_sub_Λ : Δ₀ ⊆ Λ) + (hΔ₀_atoms : ∀ x ∈ H.A, d z x < beta → x ⊆ Δ₀) + (hdiff_E₁ : closure Λ \ ((H.interSet (Δ \ discInt Δ₂)).interSet (subBd Λ)).U = Λ) + (N : Neighborhood α β) + (η_1 : SpanEmbedding (H.interSet (Δ \ discInt Δ₂)) N.G) + (hη_1_v : ∀ v ∈ (H.interSet (Δ \ discInt Δ₂)).V, η_1.vMap v = η'.vMap v) + (hV_H' : (H.interSet (Δ \ discInt Δ₂)).V = H.V ∩ (Δ \ discInt Δ₂)) + (hCleared_V_sub : (clearedSubdrawing H Λ).V ⊆ H.V ∩ (univ \ Λ)) + (p : Graph α β) + (a' : α) + (b' : α) + (hp_a'b' : clearedSociety.IsOmegaPathWithEnds p a' b') + (a : α) + (b : α) + (hv_H' : ∀ v ∈ (H.interSet (Δ \ discInt Δ₂)).V, η_1.vMap v ∈ V(p) → η_1.vMap v = a ∨ η_1.vMap + v = b ∨ v ∈ closure Λ \ ((H.interSet (Δ \ discInt Δ₂)).interSet (subBd Λ)).U) + (hp_le_star : p ≤ localSociety.G) + (ha'_ab : a' = a ∨ a' = b) + (hb'_ab : b' = a ∨ b' = b) + (hpair_eq : ({a', b'} : Set α) = {a, b}) + (hbar_sub_img : clearedSociety.Ω.bar ⊆ V(clearedEmbedding.imageGraph)) : + V(p) ∩ V(clearedEmbedding.imageGraph) = {a', b'} := by + refine Subset.antisymm ?_ ?_ + · rintro w ⟨hw_p, hw_img⟩ + obtain ⟨v, hv_cl, rfl⟩ := clearedEmbedding.bijOn_v.surjOn hw_img + obtain ⟨hvH, hv_not_Λ⟩ := hCleared_V_sub hv_cl + have hw_star : clearedEmbedding.vMap v ∈ V(localSociety.G) := hp_le_star.vertexSet_mono hw_p + rw [hη_Λ_v v hv_cl, hsoc_star_G, vertexSet_subgraphUnion] at hw_star + have hv_Δ : v ∈ Δ := by + rcases hw_star with hw_J | hw_PΔ + · exfalso + have hv_atom : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hvH, rfl⟩) + have hv_in_Λ : v ∈ Λ := + hΔ₀_sub_Λ (hΔ₀_atoms {v} hv_atom (hJ_dist v hvH hw_J) (mem_singleton v)) + exact hv_not_Λ.2 hv_in_Λ + · rw [← hη'_v v hvH] at hw_PΔ + simp only [arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce, + mem_inter_iff, mem_union, mem_iUnion, mem_sep_iff] at hw_PΔ + rcases hw_PΔ.1 with ⟨A, ⟨hA, hA_Δ⟩, hvA⟩ | ⟨hv_seg, hv_pt_Δ⟩ + · exact hA_Δ ((hComp.inter_V_iff A hA v hvH).mpr hvA) + · rwa [hComp.pt_eq v hvH hv_seg] at hv_pt_Δ + have hv_not_int₂ : v ∉ discInt Δ₂ := + fun hv_int₂ => hv_not_Λ.2 (hcl_C₂_sub (hΔ₂_sub_cl_C₂ hv_int₂.1)) + have hv_H'V : v ∈ (H.interSet (Δ \ discInt Δ₂)).V := hV_H'.symm ▸ ⟨hvH, hv_Δ, hv_not_int₂⟩ + have hw_vMap1 : η_1.vMap v = clearedEmbedding.vMap v := by + rw [hη_1_v v hv_H'V, hη'_v v hvH, hη_Λ_v v hv_cl] + have hv_res := hv_H' v hv_H'V (hw_vMap1.symm ▸ hw_p) + rw [hw_vMap1, hdiff_E₁] at hv_res + rw [hpair_eq] + rcases hv_res with h1 | h2 | hv_Λ + · exact Or.inl h1 + · exact Or.inr h2 + · exact (hv_not_Λ.2 hv_Λ).elim + · rintro w (rfl | rfl) + · exact ⟨hp_a'b'.1.left_mem, hbar_sub_img hp_a'b'.2.2.1⟩ + · exact ⟨hp_a'b'.1.right_mem, hbar_sub_img hp_a'b'.2.2.2⟩ + +private theorem rerouted_path_avoids_cleared_drawing_edges + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + {G_amb : Graph α β} + {G' : Graph α β} + {J : Graph α β} + {B_rem : Set (Graph α β)} + {H : Drawing S} + {η : SpanEmbedding H G_amb} + {η' : SpanEmbedding H G'} + {S_seg : Set (Society α β)} + {α_disc : Society α β → Set S} + {α_pt : α → S} + (hG'_eq : G' = subgraphSUnion G_amb {η.imageGraph, subgraphSUnion G_amb B_rem}) + (hη'_e : ∀ e ∈ H.E, η'.eMap e = η.eMap e) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + {Λ : Set S} + {Δ : Set S} + {clearedEmbedding : SpanEmbedding (clearedSubdrawing H Λ) G_amb} + {localSociety : Society α β} + (hη_Λ_e : ∀ e ∈ (clearedSubdrawing H Λ).E, clearedEmbedding.eMap e = η.eMap e) + (hsoc_star_G : localSociety.G = subgraphUnion G_amb J (arrangementPullbackGraph G' S_seg α_disc + α_pt Δ)) + {Λ_C₂ : Set S} + {Δ₂ : Set S} + (hcl_C₂_sub : closure Λ_C₂ ⊆ Λ) + (hΔ₂_sub_cl_C₂ : Δ₂ ⊆ closure Λ_C₂) + (hdiff_E₁ : closure Λ \ ((H.interSet (Δ \ discInt Δ₂)).interSet (subBd Λ)).U = Λ) + (hJ_le : J ≤ G_amb) + (hBrem_le : subgraphSUnion G_amb B_rem ≤ G_amb) + (hDisj_E : Disjoint E(G') E(J)) + (N : Neighborhood α β) + (η_1 : SpanEmbedding (H.interSet (Δ \ discInt Δ₂)) N.G) + (hη_1_e : ∀ e ∈ (H.interSet (Δ \ discInt Δ₂)).E, η_1.eMap e = η'.eMap e) + (hE_H' : (H.interSet (Δ \ discInt Δ₂)).E = {e | e ∈ H.E ∧ e ⊆ Δ \ discInt Δ₂}) + (hP_Δ_le_amb : arrangementPullbackGraph G' S_seg α_disc α_pt Δ ≤ G_amb) + (hCleared_E_sub : (clearedSubdrawing H Λ).E ⊆ {e | e ∈ H.E ∧ e ⊆ univ \ Λ}) + (p : Graph α β) + (he_H' : ∀ e ∈ (H.interSet (Δ \ discInt Δ₂)).E, η_1.eMap e ∈ E(p) → e ⊆ closure Λ \ + ((H.interSet (Δ \ discInt Δ₂)).interSet (subBd Λ)).U) + (hp_le_star : p ≤ localSociety.G) : + Disjoint E(p) E(clearedEmbedding.imageGraph) := by + refine Set.disjoint_left.mpr fun b_edge hb_p hb_img => ?_ + obtain ⟨e, he_cl, rfl⟩ := clearedEmbedding.bijOn_e.surjOn hb_img + obtain ⟨heH, he_not_Λ⟩ := hCleared_E_sub he_cl + have hb_star : clearedEmbedding.eMap e ∈ E(localSociety.G) := hp_le_star.edgeSet_mono hb_p + rw [hη_Λ_e e he_cl, hsoc_star_G, edgeSet_subgraphUnion hJ_le hP_Δ_le_amb] at hb_star + have he_Δ : e ⊆ Δ := by + rcases hb_star with hb_J | hb_PΔ + · exfalso + have hη_le_G' : η.imageGraph ≤ G' := by + rw [hG'_eq] + refine le_subgraphSUnion ?_ (Or.inl rfl) + rintro K (rfl | rfl) + · exact η.imageGraph_le + · exact hBrem_le + exact Set.disjoint_left.mp hDisj_E + (hη_le_G'.edgeSet_mono (η.bijOn_e.mapsTo heH)) hb_J + · rw [← hη'_e e heH] at hb_PΔ + simp only [arrangementPullbackGraph, edgeSet_restrict, mem_inter_iff, + mem_iUnion, mem_sep_iff] at hb_PΔ + obtain ⟨A, ⟨hA, hA_Δ⟩, heA⟩ := hb_PΔ.2 + exact ((hComp.inter_E_iff A hA e heH).mpr heA).trans hA_Δ + have he_Cyl : e ⊆ Δ \ discInt Δ₂ := by + intro x hxe + refine ⟨he_Δ hxe, fun hx_int₂ => ?_⟩ + exact (he_not_Λ hxe).2 (hcl_C₂_sub (hΔ₂_sub_cl_C₂ hx_int₂.1)) + have he_H'E : e ∈ (H.interSet (Δ \ discInt Δ₂)).E := hE_H'.symm ▸ ⟨heH, he_Cyl⟩ + have hb_eMap1 : η_1.eMap e = clearedEmbedding.eMap e := by + rw [hη_1_e e he_H'E, hη'_e e heH, hη_Λ_e e he_cl] + have he_sub_Λ : e ⊆ Λ := hdiff_E₁ ▸ he_H' e he_H'E (hb_eMap1.symm ▸ hb_p) + obtain ⟨x₀, hx₀⟩ := heH.1 + exact (he_not_Λ hx₀).2 (he_sub_Λ hx₀) + +/-- The cylinder rerouting step of Graph Minors XIV, (9.6) (pages 48–49), proved from (8.4) +(`Theorem84DiscStatement`). -/ +theorem cylinder_reroute_9_6 [T2Space S] {α : Type u} {β : Type v} + {G_amb G G' J : Graph α β} {B_J B_rem : Set (Graph α β)} + {H : Drawing S} {η : SpanEmbedding H G_amb} {η' : SpanEmbedding H G'} + {θ π beta : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {z : Set S} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + (hV_fin : V(G_amb).Finite) (hE_fin : E(G_amb).Finite) + (hRig : IsRigid H) + (hπ1 : π ≠ 1) (hπ3 : π ≠ 3) (hbeta : 2 * π + 8 ≤ beta) + (hB_J : ∀ B ∈ B_J, IsBridge G_amb η.imageGraph B) + (hB_rem : ∀ B ∈ B_rem, IsBridge G_amb η.imageGraph B) + (hDisj_B : Disjoint B_J B_rem) + (hJ_eq : J = subgraphSUnion G_amb B_J) + (hG'_eq : G' = subgraphSUnion G_amb {η.imageGraph, subgraphSUnion G_amb B_rem}) + (hG_eq : G = subgraphUnion G_amb G' J) + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η.vMap v) + (hη'_e : ∀ e ∈ H.E, η'.eMap e = η.eMap e) + (hJ_dist : ∀ v ∈ H.V, η.vMap v ∈ V(J) → d z {v} < beta) + (hSeg : IsThreeSegregation G' S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G' H η' S_seg α_disc α_pt) + {Λ Δ : Set S} {C C_out : Drawing S} {X_bf : Set S} + {clearedEmbedding : SpanEmbedding (clearedSubdrawing H Λ) G_amb} + {clearedSociety localSociety : Society α β} {inv_v : α → S} + (hBf : IsBattlefield H T d θ beta z Λ C X_bf) + (hΔ_disc : IsClosedDisc Δ) + (hNorm_Δ : IsArrangementNormal S_seg α_disc α_pt (subBd Δ)) + (hclΛ_sub_Δ : closure Λ ⊆ Δ) + (hCout_cir : C_out.IsCircuit) + (hCout_sub : C_out.IsSubdrawing (H.interSet (closure (univ \ Δ)))) + (hη_Λ_v : ∀ v ∈ (clearedSubdrawing H Λ).V, clearedEmbedding.vMap v = η.vMap v) + (hη_Λ_e : ∀ e ∈ (clearedSubdrawing H Λ).E, clearedEmbedding.eMap e = η.eMap e) + (hsoc_Λ_G : clearedSociety.G = G) + (hsoc_Λ_bar : clearedSociety.Ω.bar = clearedEmbedding.vMap '' ((clearedSubdrawing H Λ).V ∩ + subBd Λ)) + (hinv_v_prop : ∀ x ∈ clearedSociety.Ω.bar, + inv_v x ∈ (clearedSubdrawing H Λ).V ∩ subBd Λ ∧ clearedEmbedding.vMap (inv_v x) = x) + (hΩ_Λ_nat : IsNaturalOrderFrom inv_v clearedSociety.Ω (subBd Λ)) + (hsoc_star_G : localSociety.G = subgraphUnion G_amb J (arrangementPullbackGraph G' S_seg α_disc + α_pt Δ)) + (hsoc_star_Ω : IsPullbackPerm S_seg α_pt (subBd Δ) localSociety.Ω) + (hCr_star : ∃ P_set : Set (Graph α β), localSociety.IsCrookedTransaction P_set ∧ π + ≤ P_set.ncard) + {C₂ : Drawing S} {Λ_C₂ F₂ Δ₂ : Set S} + (hC₂H : C₂.IsSubdrawing H) (hC₂ : C₂.IsCircuit) + (hOpen_C₂ : IsOpenDisc Λ_C₂) (hcl_C₂_sub : closure Λ_C₂ ⊆ Λ) + (hcl_C₂_disc : IsClosedDisc (closure Λ_C₂)) + (hbd_cl_C₂ : subBd (closure Λ_C₂) = C₂.U) + (hdiff_C₂ : closure Λ_C₂ \ C₂.U = Λ_C₂) + (hdist_C₂ : beta / 2 ≤ regionalDistance H (closure Λ_C₂) (subBd Λ)) + (hF₂_norm : IsArrangementNormal S_seg α_disc α_pt F₂) + (hΔ₂_disc : IsClosedDisc Δ₂) (hbd_Δ₂ : subBd Δ₂ = F₂) + (hΔ₂_sub_cl_C₂ : Δ₂ ⊆ closure Λ_C₂) + (hD₀_sub_Δ₂ : discIns (closure Λ) C ⊆ Δ₂) + (hΔ₂_atoms : ∀ x ∈ H.A, d z x < beta → x ⊆ Δ₂ \ subBd Δ₂) : + ∃ P_set : Set (Graph α β), + clearedSociety.IsCrookedTransaction P_set ∧ + π ≤ P_set.ncard ∧ + clearedSociety.transactionEnds P_set ⊆ clearedEmbedding.vMap '' X_bf ∧ + ∀ P ∈ P_set, ∀ a b : α, + clearedSociety.IsOmegaPathWithEnds P a b → + IsHPathWithEnds G_amb clearedEmbedding.imageGraph P a b := by + have : ConnectedSpace S := hConn + have hZone : IsLambdaZoneAround H d (3 * beta + 3) z Λ := hBf.isZone + obtain ⟨hC_cir, hC_sub, hCU_sub_Λ, P_bf, hP_bf, hDisj_bf⟩ := hBf.circuit_and_paths + obtain ⟨hX_bf_sub, _, _, _, _, _⟩ := hBf.isFree_X + obtain ⟨Δ₀, _, hΔ₀_sub_Λ, _, hΔ₀_atoms⟩ := hBf.openDisc_includes + have hNorm_Δ₂ : IsArrangementNormal S_seg α_disc α_pt (subBd Δ₂) := hbd_Δ₂ ▸ hF₂_norm + have hΔ₂_sub_diff : Δ₂ ⊆ Δ \ subBd Δ := by + have hΛ_sub_int : Λ ⊆ Δ \ subBd Δ := by + intro x hxΛ + refine ⟨hclΛ_sub_Δ (subset_closure hxΛ), fun hx_bd => ?_⟩ + obtain ⟨y, hyΛ, hyn⟩ := mem_closure_iff.mp hx_bd.2 Λ hZone.isOpenDisc.1 hxΛ + exact hyn.2 (hclΛ_sub_Δ (subset_closure hyΛ)) + exact hΔ₂_sub_cl_C₂.trans (hcl_C₂_sub.trans hΛ_sub_int) + have hCU_sub_Δ₂ : C.U ⊆ Δ₂ := by + obtain ⟨⟨_, _, hD₀_bd⟩, _⟩ := + discIns_spec hZone.isClosedDisc_closure hC_cir (hCU_sub_Λ.trans subset_closure) + exact (hD₀_bd ▸ Surface.discBd_subset (discIns (closure Λ) C)).trans hD₀_sub_Δ₂ + -- Step 1: Rigidity of `H' = H.interSet (Δ \ discInt Δ₂)` + have hRig_H' : IsRigidIn (H.interSet (Δ \ discInt Δ₂)) (Δ \ discInt Δ₂) := + isRigidIn_cylinder_9_6 hS hRig hSeg hArr hComp hΔ_disc hΔ₂_disc hΔ₂_sub_diff + hNorm_Δ hNorm_Δ₂ hCout_cir hCout_sub hC_cir hC_sub hCU_sub_Δ₂ + -- Step 2: Circuits `C₁` and `C₂` of `H'` + obtain ⟨hC₁_cir, hC₁_sub, hC₂_cir, hC₂_sub, hbd_E₁, hbd_E₂, + hdiff_E₁, hE₂_sub_diff, hC₁_V_eq, hC₁_V_cleared⟩ := + circuits_cylinder_9_6 hS hZone hΔ_disc hΔ₂_disc hclΛ_sub_Δ + hC₂H hC₂ hcl_C₂_sub hcl_C₂_disc hbd_cl_C₂ hΔ₂_sub_cl_C₂ + -- Step 3: Regional distance in `H'` + have hC₁_U_eq : ((H.interSet (Δ \ discInt Δ₂)).interSet (subBd Λ)).U = subBd Λ := by + rw [← hbd_E₁] + exact discBd_closure_eq_subBd hS hZone.isOpenDisc hZone.isOArc_bd hZone.isClosedDisc_closure + have hDist_H' : π + 4 ≤ + regionalDistance (H.interSet (Δ \ discInt Δ₂)) C₂.U ((H.interSet (Δ \ discInt Δ₂)).interSet + (subBd Λ)).U := + regionalDistance_cylinder_9_6 hS hSeg hArr hComp hΔ_disc hΔ₂_disc hNorm_Δ hNorm_Δ₂ + hZone.isOpenDisc hclΛ_sub_Δ hcl_C₂_sub hcl_C₂_disc hbd_cl_C₂ hΔ₂_sub_cl_C₂ + hC₁_cir hC₁_sub hC₁_U_eq hC₂_cir hC₂_sub hbeta hdist_C₂ + -- Step 4: Paths `P` in `H'.toGraph` from `X_bf` to `C₂.V` + obtain ⟨hX_bf_C₁, P, hP_paths, hP_disj⟩ := + exists_cylinder_paths_9_6 hS hZone.isOpenDisc hclΛ_sub_Δ hΔ_disc hΔ₂_disc + hOpen_C₂ hcl_C₂_sub hbd_cl_C₂ hdiff_C₂ hΔ₂_sub_cl_C₂ hCU_sub_Δ₂ + hC₁_V_eq hC₂H hX_bf_sub hbeta P_bf hP_bf hDisj_bf + -- Step 5: Society composition `localSociety.IsComposition S₂ N` and 3-segregation `S_seg_1` + have hJ_le : J ≤ G_amb := hJ_eq ▸ subgraphSUnion_le fun B hB => (hB_J B hB).2.1 + have hBrem_le : subgraphSUnion G_amb B_rem ≤ G_amb := + subgraphSUnion_le fun B hB => (hB_rem B hB).2.1 + have hG'_le : G' ≤ G_amb := by + rw [hG'_eq] + refine subgraphSUnion_le ?_ + rintro K (rfl | rfl) + · exact η.imageGraph_le + · exact hBrem_le + obtain ⟨hDisj_E, hInter_V⟩ := + bridge_sUnion_disjoint_and_inter η.imageGraph_le hB_J hB_rem hDisj_B hJ_eq hG'_eq + have hVJ_Δ₂ : ∀ v ∈ H.V, η.vMap v ∈ V(J) → v ∈ Δ₂ \ subBd Δ₂ := by + intro v hvH hvJ + have hv_atom : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hvH, rfl⟩) + exact hΔ₂_atoms {v} hv_atom (hJ_dist v hvH hvJ) (mem_singleton v) + obtain ⟨S₂, N, η_1, _, hPull_S₂, hN_G, hN_Ω, hN_Ω₀, hComp_soc, + hη_1_v, hη_1_e, hV_H', hU_H', hE_H'⟩ := + cylinder_composition_9_6 hS hV_fin hE_fin hJ_le hG'_le hDisj_E hInter_V hη'_v + hSeg hArr hComp hΔ_disc hΔ₂_disc hΔ₂_sub_diff hNorm_Δ hNorm_Δ₂ hVJ_Δ₂ + hsoc_star_G hsoc_star_Ω + obtain ⟨S_seg_1, α_disc_1, hSeg_1, hArr_1, hComp_1, hDisc_1_sub, hPull_1_Δ, hPull_1_Δ₂⟩ := + cylinder_segregation_9_6 hS hSeg hArr hComp hΔ_disc hΔ₂_disc hΔ₂_sub_diff + hNorm_Δ hNorm_Δ₂ hN_G (hN_Ω ▸ hsoc_star_Ω) (hN_Ω₀ ▸ hPull_S₂) + hη_1_v hη_1_e hV_H' hU_H' hE_H' + -- Step 6: Construct `S_G0 = (localSociety.G, clearedSociety.Ω)` and apply + -- `GraphMinor.GM14.theorem_8_4_proof.{u, v, w}` + let H' := H.interSet (Δ \ discInt Δ₂) + let C₁ := H'.interSet (subBd Λ) + have hC₁_vMap_eq : ∀ v ∈ C₁.V, η_1.vMap v = clearedEmbedding.vMap v := by + intro v hv + have hv_H' : v ∈ H'.V := hC₁_sub.1 hv + have hv_cl : v ∈ (clearedSubdrawing H Λ).V := (hC₁_V_cleared ▸ hv).1 + rw [hη_1_v v hv_H', hη'_v v (hV_H' ▸ hv_H').1, ← hη_Λ_v v hv_cl] + have hbar_G0_eq : clearedSociety.Ω.bar = η_1.vMap '' C₁.V := by + rw [hsoc_Λ_bar, ← hC₁_V_cleared] + exact image_congr fun v hv => (hC₁_vMap_eq v hv).symm + have hPCyl_le_star : N.G ≤ localSociety.G := hComp_soc.1.1.2.1 + have hbar_sub_star : clearedSociety.Ω.bar ⊆ V(localSociety.G) := by + rw [hbar_G0_eq] + rintro _ ⟨v, hvC₁, rfl⟩ + exact hPCyl_le_star.vertexSet_mono + (η_1.imageGraph_le.vertexSet_mono (η_1.bijOn_v.mapsTo (hC₁_sub.1 hvC₁))) + let S_G0 : Society α β := + ⟨localSociety.G, clearedSociety.Ω, localSociety.finite_V, localSociety.finite_E, hbar_sub_star⟩ + have hinv_v_C₁ : ∀ v ∈ C₁.V, inv_v (η_1.vMap v) = v := by + intro v hv + rw [hC₁_vMap_eq v hv] + have hv_cl : v ∈ (clearedSubdrawing H Λ).V ∩ subBd Λ := hC₁_V_cleared ▸ hv + have hx_bar : clearedEmbedding.vMap v ∈ clearedSociety.Ω.bar := hsoc_Λ_bar ▸ mem_image_of_mem + clearedEmbedding.vMap hv_cl + obtain ⟨hinv_in, hinv_eq⟩ := hinv_v_prop (clearedEmbedding.vMap v) hx_bar + exact clearedEmbedding.bijOn_v.injOn hinv_in.1 hv_cl.1 hinv_eq + have hbd_E₁_eq_subBd : discBd (closure Λ) = subBd Λ := + discBd_closure_eq_subBd hS hZone.isOpenDisc hZone.isOArc_bd hZone.isClosedDisc_closure + have hNat_E₁ : IsNaturalOrderFrom inv_v S_G0.Ω (discBd (closure Λ)) := + hbd_E₁_eq_subBd.symm ▸ hΩ_Λ_nat + obtain ⟨P_set, hCr_G0, hCard_P, hEnds_G0, hPaths_G0⟩ := + GraphMinor.GM14.theorem_8_4_proof.{u, v, w} P η_1 hS hΔ_disc hΔ₂_disc + hZone.isClosedDisc_closure hcl_C₂_disc + hΔ₂_sub_cl_C₂ hE₂_sub_diff hclΛ_sub_Δ hRig_H' + ⟨hC₁_cir, hC₁_sub⟩ ⟨hC₂_cir, hC₂_sub⟩ hbd_E₁ hbd_E₂ + hπ1 hπ3 hDist_H' hX_bf_C₁ hP_paths hP_disj + hSeg_1 hArr_1 hComp_1 hDisc_1_sub hPull_1_Δ hPull_1_Δ₂ + hComp_soc (rfl : S_G0.G = localSociety.G) hbar_G0_eq hinv_v_C₁ hNat_E₁ hCr_star + -- Step 7: Transfer `P_set` from `S_G0` to `clearedSociety` and verify `IsHPathWithEnds` + have hP_Δ_le_G' : arrangementPullbackGraph G' S_seg α_disc α_pt Δ ≤ G' := + Graph.restrict_le.trans (G'.induce_le inter_subset_right) + have hP_Δ_le_amb : arrangementPullbackGraph G' S_seg α_disc α_pt Δ ≤ G_amb := + hP_Δ_le_G'.trans hG'_le + have hstar_le_amb : localSociety.G ≤ G_amb := + hsoc_star_G ▸ subgraphUnion_le hJ_le hP_Δ_le_amb + have hG_le_amb : G ≤ G_amb := hG_eq ▸ subgraphUnion_le hG'_le hJ_le + have hstar_le_G : localSociety.G ≤ G := by + exact inner_society_is_subgraph_of_replaced_graph (S := S) (α := α) (β := β) (G_amb := G_amb) + (G := G) (G' := G') (J := J) (S_seg := S_seg) (α_disc := α_disc) (α_pt := α_pt) hG_eq (Δ := + Δ) (localSociety := localSociety) hsoc_star_G hJ_le hG'_le hP_Δ_le_G' hP_Δ_le_amb hstar_le_amb + hG_le_amb + have hG0_le_soc_Λ : S_G0.G ≤ clearedSociety.G := hsoc_Λ_G ▸ hstar_le_G + have hOmegaPath_iff : ∀ p ∈ P_set, ∀ u v : α, + clearedSociety.IsOmegaPathWithEnds p u v ↔ S_G0.IsOmegaPathWithEnds p u v := by + intro p hp u v + obtain ⟨a₀, b₀, hp₀, _, _⟩ := hPaths_G0 p hp + have hp_le_G0 : p ≤ S_G0.G := hp₀.1.le + exact ⟨fun ⟨hpath, hne, hu, hv⟩ => ⟨hpath.of_le hp_le_G0, hne, hu, hv⟩, + fun ⟨hpath, hne, hu, hv⟩ => ⟨hpath.mono hG0_le_soc_Λ, hne, hu, hv⟩⟩ + have hEnds_eq_G0 : clearedSociety.transactionEnds P_set = S_G0.transactionEnds P_set := by + ext v + simp only [Society.transactionEnds, mem_ofPred_eq] + exact ⟨fun ⟨p, hp, b, h⟩ => ⟨p, hp, b, (hOmegaPath_iff p hp v b).mp h⟩, + fun ⟨p, hp, b, h⟩ => ⟨p, hp, b, (hOmegaPath_iff p hp v b).mpr h⟩⟩ + have hCr_Λ : clearedSociety.IsCrookedTransaction P_set := by + exact rerouted_crooked_transaction_extends_to_replacement_society (α := α) (β := β) + (clearedSociety := + clearedSociety) S_G0 P_set rfl hCr_G0 hOmegaPath_iff hEnds_eq_G0 + have hEnds_sub_Λ : clearedSociety.transactionEnds P_set ⊆ clearedEmbedding.vMap '' X_bf := by + rw [hEnds_eq_G0] + refine hEnds_G0.trans ?_ + rintro _ ⟨v, hvX, rfl⟩ + exact ⟨v, hvX, (hC₁_vMap_eq v (hX_bf_C₁ hvX)).symm⟩ + -- Prove `IsHPathWithEnds G_amb clearedEmbedding.imageGraph p a' b'` for every `p ∈ P_set` + have hCleared_V_sub : (clearedSubdrawing H Λ).V ⊆ H.V ∩ (univ \ Λ) := by + have hcl_compl : IsClosed (univ \ Λ) := isClosed_univ.sdiff hZone.isOpenDisc.1 + rintro x (⟨hx, _⟩ | hx) + · exact hx + · obtain ⟨e, he, hxe, hxV⟩ := mem_iUnion₂.mp hx + exact ⟨hxV, hcl_compl.closure_subset_iff.mpr he.1.2 hxe⟩ + have hCleared_E_sub : (clearedSubdrawing H Λ).E ⊆ {e ∈ H.E | e ⊆ univ \ Λ} := by + intro e he + change e ∈ (H.span _ _).E at he + rw [H.span_E] at he + exact ⟨he.2, he.1.2⟩ + refine ⟨P_set, hCr_Λ, hCard_P, hEnds_sub_Λ, ?_⟩ + intro p hp a' b' hp_a'b' + obtain ⟨a, b, hp_ab, hv_H', he_H'⟩ := hPaths_G0 p hp + have hp_le_star : p ≤ localSociety.G := hp_ab.1.le + -- Show `{a', b'} = {a, b}` using `a', b' ∈ clearedSociety.Ω.bar = η_1.vMap '' C₁.V` + have hbar_in_ab : ∀ x ∈ clearedSociety.Ω.bar, x ∈ V(p) → x = a ∨ x = b := by + intro x hx_bar hx_Vp + rw [hbar_G0_eq] at hx_bar + obtain ⟨v, hvC₁, rfl⟩ := hx_bar + have hv_H'V : v ∈ H'.V := hC₁_sub.1 hvC₁ + have hv_not_diff : v ∉ closure Λ \ C₁.U := fun h => h.2 (C₁.V_subset_U hvC₁) + rcases hv_H' v hv_H'V hx_Vp with h1 | h2 | h3 + · exact Or.inl h1 + · exact Or.inr h2 + · exact (hv_not_diff h3).elim + have ha'_ab : a' = a ∨ a' = b := hbar_in_ab a' hp_a'b'.2.2.1 hp_a'b'.1.left_mem + have hb'_ab : b' = a ∨ b' = b := hbar_in_ab b' hp_a'b'.2.2.2 hp_a'b'.1.right_mem + have hpair_eq : ({a', b'} : Set α) = {a, b} := by + have hne' : a' ≠ b' := hp_a'b'.2.1 + rcases ha'_ab with rfl | rfl <;> rcases hb'_ab with rfl | rfl + · exact (hne' rfl).elim + · rfl + · exact Set.pair_comm _ _ + · exact (hne' rfl).elim + have hbar_sub_img : clearedSociety.Ω.bar ⊆ V(clearedEmbedding.imageGraph) := by + rw [hsoc_Λ_bar] + rintro _ ⟨v, hv, rfl⟩ + exact clearedEmbedding.bijOn_v.mapsTo hv.1 + have hpath_vertices : V(p) ∩ V(clearedEmbedding.imageGraph) = {a', b'} := by + exact rerouted_path_meets_cleared_drawing_only_at_ends (S := S) (α := α) (β := β) (G_amb := + G_amb) (G' := G') (J := J) (H := H) (η := η) (η' := η') (beta := beta) (d := d) (z := z) + (S_seg := S_seg) (α_disc := α_disc) (α_pt := α_pt) hη'_v hJ_dist hComp (Λ := Λ) (Δ := Δ) + (clearedEmbedding := clearedEmbedding) (clearedSociety := clearedSociety) (localSociety + := localSociety) hη_Λ_v hsoc_star_G (Λ_C₂ := Λ_C₂) (Δ₂ + := Δ₂) hcl_C₂_sub hΔ₂_sub_cl_C₂ Δ₀ hΔ₀_sub_Λ hΔ₀_atoms hdiff_E₁ N η_1 hη_1_v hV_H' + hCleared_V_sub p a' b' hp_a'b' a b hv_H' hp_le_star ha'_ab hb'_ab hpair_eq hbar_sub_img + have hpath_edges : Disjoint E(p) E(clearedEmbedding.imageGraph) := by + exact rerouted_path_avoids_cleared_drawing_edges (S := S) (α := α) (β := β) (G_amb := G_amb) + (G' := G') (J := J) (B_rem := B_rem) (H := H) (η := η) (η' := η') (S_seg := S_seg) (α_disc + := α_disc) (α_pt := α_pt) hG'_eq hη'_e hComp (Λ := Λ) (Δ := Δ) (clearedEmbedding + := clearedEmbedding) (localSociety := + localSociety) hη_Λ_e hsoc_star_G (Λ_C₂ := Λ_C₂) (Δ₂ := Δ₂) hcl_C₂_sub hΔ₂_sub_cl_C₂ hdiff_E₁ + hJ_le hBrem_le hDisj_E N η_1 hη_1_e hE_H' hP_Δ_le_amb hCleared_E_sub p he_H' hp_le_star + refine ⟨clearedEmbedding.imageGraph_le, hp_a'b'.1.mono (hsoc_Λ_G ▸ hG_le_amb), hp_a'b'.2.1, + hbar_sub_img hp_a'b'.2.2.1, hbar_sub_img hp_a'b'.2.2.2, hpath_vertices, hpath_edges⟩ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section9a.lean b/LeanPool/GraphMinor/GM14/Section9a.lean new file mode 100644 index 0000000000..f681033cf9 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section9a.lean @@ -0,0 +1,1161 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section7 +public import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM14.Section5 +import LeanPool.GraphMinor.GM11.OArcCircuit +import LeanPool.GraphMinor.GM12.Section4WalkMetric + +/-! +# Graph Minors XIV, Section 9 (Part 1): (9.1), (9.2), and (9.4) + +This file formalizes `(9.1)`, `(9.2)`, and `(9.4)` of Section 9 (*Constant Radius Discs*, +pages 43–45) of N. Robertson and P. D. Seymour, *Graph Minors. XIV. Extending an embedding*, +J. Combin. Theory Ser. B **65** (1995) 23–50: + +- `theorem_9_1`: Graph Minors XIV, (9.1) (page 43), showing that the union `Z` of `ins(W)` over + all closed walks `W` of a radial drawing `K` of length `< 2κ` (`1 ≤ κ ≤ θ`) with `z ⊆ ins(W)` + (`z ∈ A(K)`) is included in the interior `Δ \ subBd Δ` of some closed disc `Δ ⊆ Σ`. +- `full_of_9_2` / `theorem_9_2`: Graph Minors XIV, (9.2) (page 43), proving + `GM16.GM14Theorem92Statement` (existence of a `(κ + 2)`-zone `Λ` around `z ∈ A(H)` including all + atoms `x ∈ A(H)` with `d(z, x) < κ`, for `2 ≤ κ ≤ θ - 3`). +- `theorem_9_4`: Graph Minors XIV, (9.4) (page 45), constructing a closed disc `Δ ⊆ Σ` with + `α`-normal boundary around a `κ`-zone `Λ` (`1 ≤ κ ≤ θ - 7`) such that `Λ ⊆ Δ \ subBd Δ`, + `H ∩ closure (Σ - Δ)` has a circuit, and `d(z, x) ≤ κ + 3` for all `x ∈ A(H)` meeting `Δ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Graph Hypergraph Metric +open GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 + +universe u v w + +variable {S : Type u} [TopologicalSpace S] + +/-! ## 1. Walk Unions, Restraint Unions, and Proof of (9.1) (page 43) -/ + +/-- The union of `insWalk ins K W` over all closed walks `W` of `K` of length `< k` with +`z ⊆ insWalk ins K W` (Graph Minors XIV, (9.1), page 43). -/ +def walkUnion [T1Space S] (K : Drawing S) (ins : Drawing S → Set S) (k : ℕ) (z : Set S) : Set S := + ⋃ X ∈ {X : Set S | ∃ (u : S) (W : GraphWalk K.toGraph u u), + W.length < k ∧ z ⊆ insWalk ins K W ∧ X = insWalk ins K W}, X + +/-- For `z ∈ A(K)`, `c ∈ z`, and `1 ≤ κ ≤ θ`, the union `walkUnion K ins (2 * κ) z` over closed +walks of length `< 2κ` equals `restraintUnion K ins (2 * θ) c (2 * κ - 1)`. -/ +theorem walkUnion_eq_restraintUnion [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) + {K : Drawing S} {ins : Drawing S → Set S} {θ κ : ℕ} + (hsl : IsSlope K (2 * θ) ins) {z : Set S} (hz : z ∈ K.A) {c : S} (hc : c ∈ z) + (hκ1 : 1 ≤ κ) (hκθ : κ ≤ θ) : + walkUnion K ins (2 * κ) z = restraintUnion K ins (2 * θ) c (2 * κ - 1) := by + apply subset_antisymm + · refine iUnion₂_subset ?_ + rintro X ⟨u, W, hW, hzW, rfl⟩ + have hWθ : W.length < 2 * θ := by omega + obtain ⟨hrest, hlen⟩ := GM11.theorem_8_5_proof hS hsl W hWθ + have hle : perimeterWalkLength K (insWalk ins K W) ≤ 2 * κ - 1 := by omega + exact subset_biUnion_of_mem (u := id) ⟨hrest, hle, hzW hc⟩ + · refine iUnion₂_subset ?_ + rintro X ⟨hrest, hlen, hcX⟩ + obtain ⟨u, W, -, hWlen, hWθ, -, hd⟩ := hrest.exists_walk hS + have hins_eq : insWalk ins K W = X := GM11.insWalk_eq hS hsl hrest hd + have hWκ : W.length < 2 * κ := by omega + have hzX : z ⊆ insWalk ins K W := hins_eq ▸ GM11.nice_atom hrest.isGammaNice hz ⟨c, hc, hcX⟩ + intro x hx + rw [← hins_eq] at hx + exact mem_iUnion₂.mpr ⟨insWalk ins K W, ⟨u, W, hWκ, hzX, rfl⟩, hx⟩ + +/-- A closed subset `Z` of an open disc `Λ` in a closed surface `S` is contained in the interior +`Δ \ subBd Δ` of some closed disc `Δ ⊆ Λ`. -/ +theorem exists_closedDisc_interior_superset [T2Space S] + (hS : IsClosedSurface S) {Λ Z : Set S} (hΛ : IsOpenDisc Λ) (hZ : IsClosed Z) (hZΛ : Z ⊆ Λ) : + ∃ Δ : Set S, Δ ⊆ Λ ∧ IsClosedDisc Δ ∧ Z ⊆ Δ \ subBd Δ := by + have : CompactSpace S := hS.1 + obtain ⟨hΛopen, ⟨φ⟩⟩ := hΛ + have hZc : IsCompact Z := hZ.isCompact + let T : Set Λ := Subtype.val ⁻¹' Z + have hT : IsCompact T := Topology.IsEmbedding.subtypeVal.isCompact_iff.mpr (by + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hZΛ] + exact hZc) + have hT' : IsCompact (φ.symm '' T) := hT.image φ.symm.continuous + have hbd : ∃ ρ : ℝ, 0 < ρ ∧ ρ < 1 ∧ ∀ x ∈ φ.symm '' T, ‖(x : EuclideanPlane)‖ < ρ := by + by_cases hne : (φ.symm '' T).Nonempty + · obtain ⟨x₀, hx₀, hmax⟩ := hT'.exists_isMaxOn hne + (f := fun x : OpenUnitDisc => ‖(x : EuclideanPlane)‖) (by fun_prop) + have hn : ‖(x₀ : EuclideanPlane)‖ < 1 := by + have := x₀.2 + simpa [OpenUnitDisc] using this + refine ⟨(‖(x₀ : EuclideanPlane)‖ + 1) / 2, by positivity, by linarith, fun x hx => ?_⟩ + have hle : ‖(x : EuclideanPlane)‖ ≤ ‖(x₀ : EuclideanPlane)‖ := hmax hx + linarith + · refine ⟨1 / 2, by norm_num, by norm_num, fun x hx => ?_⟩ + exact absurd ⟨x, hx⟩ hne + obtain ⟨ρ, h0, h1, hρ⟩ := hbd + have hin : ∀ x : ClosedUnitDisc, ρ • (x : EuclideanPlane) ∈ OpenUnitDisc := by + intro x + have hx : ‖(x : EuclideanPlane)‖ ≤ 1 := by + have := x.2 + simpa [ClosedUnitDisc] using this + have : ‖ρ • (x : EuclideanPlane)‖ < 1 := by + rw [norm_smul, Real.norm_of_nonneg h0.le] + nlinarith + simpa [OpenUnitDisc] using this + let m : ClosedUnitDisc → S := fun x => (φ ⟨ρ • x.1, hin x⟩).1 + have hmc : Continuous m := + continuous_subtype_val.comp (φ.continuous.comp (Continuous.subtype_mk (by fun_prop) _)) + have hmi : Function.Injective m := by + intro x y hxy + have h₁ := φ.injective (Subtype.ext hxy) + have h₂ : ρ • x.1 = ρ • y.1 := congrArg Subtype.val h₁ + exact Subtype.ext (smul_right_injective _ h0.ne' h₂) + have : CompactSpace ClosedUnitDisc := + isCompact_iff_compactSpace.mp (isCompact_closedBall 0 1) + have hemb := hmc.isClosedEmbedding hmi + have hD : IsClosedDisc (range m) := ⟨hemb.isEmbedding.toHomeomorph⟩ + have hsubΛ : range m ⊆ Λ := by + rintro _ ⟨x, rfl⟩ + exact (φ _).2 + let U₀ : Set OpenUnitDisc := {x : OpenUnitDisc | ‖(x : EuclideanPlane)‖ < ρ} + have hU₀_open : IsOpen U₀ := isOpen_lt (by fun_prop) continuous_const + let V : Set S := Subtype.val '' (φ '' U₀) + have hV_open : IsOpen V := + hΛopen.isOpenMap_subtype_val _ (φ.isOpenMap U₀ hU₀_open) + have hZV : Z ⊆ V := by + intro y hy + have hyΛ : y ∈ Λ := hZΛ hy + refine ⟨⟨y, hyΛ⟩, ⟨φ.symm ⟨y, hyΛ⟩, ?_, φ.apply_symm_apply _⟩, rfl⟩ + exact hρ _ ⟨⟨y, hyΛ⟩, hy, rfl⟩ + have hVm : V ⊆ range m := by + rintro _ ⟨_, ⟨z, hz, rfl⟩, rfl⟩ + have hzn : ‖(z : EuclideanPlane)‖ ≤ ρ := le_of_lt hz + have hmem : ρ⁻¹ • (z : EuclideanPlane) ∈ ClosedUnitDisc := by + have : ‖ρ⁻¹ • (z : EuclideanPlane)‖ ≤ 1 := by + rw [norm_smul, norm_inv, Real.norm_of_nonneg h0.le] + exact (inv_mul_le_iff₀ h0).mpr (by simpa using hzn) + simpa [ClosedUnitDisc] using this + refine ⟨⟨_, hmem⟩, ?_⟩ + have heq : (⟨ρ • (ρ⁻¹ • (z : EuclideanPlane)), hin ⟨_, hmem⟩⟩ : OpenUnitDisc) = z := + Subtype.ext (smul_inv_smul₀ h0.ne' _) + change (φ _).1 = (φ z).1 + rw [heq] + have hint : Z ⊆ interior (range m) := hZV.trans (interior_maximal hVm hV_open) + refine ⟨range m, hsubΛ, hD, fun y hy => ⟨ interior_subset (hint hy), fun hybd => ?_⟩⟩ + rw [← subBd_eq_frontier'] at hybd + exact hybd.2 (hint hy) + +/-- **Graph Minors XIV, (9.1)** (page 43): +"Let $H$ be a 2-cell drawing in $\Sigma$, with radial drawing $K$. Let $\mathscr{T}$ be a +respectful tangle in $H$ of order $\theta$, let $\kappa$ be an integer with $1 \le \kappa +\le \theta$, let $z \in A(K)$, and let $Z$ be the union of $ins(W)$, taken over all closed +walks $W$ of $K$ of length $< 2\kappa$ with $z \subseteq ins(W)$. Then there is a closed +disc $\Delta \subseteq \Sigma$ with $Z \subseteq \Delta - bd(\Delta)$." -/ +theorem theorem_9_1_proof + [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {H K : Drawing S} {θ κ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} {z : Set S} + (hResp : IsRespectfulDrawingTangle H θ T) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hκ1 : 1 ≤ κ) (hκθ : κ ≤ θ) (hz : z ∈ K.A) : + ∃ Δ : Set S, IsClosedDisc Δ ∧ walkUnion K ins (2 * κ) z ⊆ Δ \ subBd Δ := by + have hsl : IsSlope K (2 * θ) ins := + GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) hS hResp.2.1.isPretangle hK.2.1.1 hd + obtain ⟨c, hc⟩ := atom_nonempty hz + have hZ_eq : walkUnion K ins (2 * κ) z = restraintUnion K ins (2 * θ) c (2 * κ - 1) := + walkUnion_eq_restraintUnion hS hsl hz hc hκ1 hκθ + set Z := restraintUnion K ins (2 * θ) c (2 * κ - 1) + have hZcl : IsClosed Z := GM11.isClosed_restraintUnion hS c (2 * κ - 1) + have hZnice : IsGammaNice K Z := GM11.isGammaNice_restraintUnion c (2 * κ - 1) + obtain ⟨r₀, hr₀, hno₀⟩ := GM11.theorem_8_12_proof hS hsl c + obtain ⟨p₀, hp₀⟩ := region_nonempty hr₀ + have hp₀_not : p₀ ∉ Z := by + intro hpZ + obtain ⟨X, ⟨hrest, -, hcX⟩, hpX⟩ := mem_iUnion₂.mp hpZ + have hrX : r₀ ⊆ X := GM11.nice_region hrest.isGammaNice hr₀ ⟨p₀, hp₀, hpX⟩ + exact hno₀ X hrest ⟨hcX, hrX⟩ + have hZ_ne_univ : Z ≠ univ := fun h => hp₀_not (h ▸ mem_univ p₀) + by_cases hZne : Z.Nonempty + · have hZsc : IsSimplyConnectedSet Z := GM11.theorem_8_10_proof hS hsl hZne + obtain ⟨Λ, hΛ, hZΛ⟩ := GM11.exists_openDisc_around hS hZcl hZnice hZsc hZ_ne_univ + obtain ⟨Δ, -, hΔ, hZΔ⟩ := exists_closedDisc_interior_superset hS hΛ hZcl hZΛ + exact ⟨Δ, hΔ, hZ_eq ▸ hZΔ⟩ + · have hZ_emp : walkUnion K ins (2 * κ) z = ∅ := + hZ_eq.trans (not_nonempty_iff_eq_empty.mp hZne) + obtain ⟨Δ, -, hΔ, -⟩ := exists_closedDisc_nbhd hS isOpen_univ (mem_univ c) + exact ⟨Δ, hΔ, hZ_emp.symm ▸ empty_subset _⟩ + +/-! ## 2. Region-Edge Distance and Proof of (9.2) (page 43) -/ + +/-- If `T` is a tangle of order `θ ≥ 2` in a hypergraph `G`, then `E(G)` is nonempty. -/ +theorem edgeSet_nonempty_of_isTangle {α β : Type*} {G : Hypergraph α β} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} (hT : IsTangle G θ T) (hθ : 2 ≤ θ) : + G.edgeSet.Nonempty := + GM10.IsTangle.edgeSet_nonempty_of_two_le hT hθ + +/-- If `r ∈ H.R` and `r' ∈ K.R` have nonempty intersection `(r ∩ r').Nonempty`, and `w ∈ K.V ∩ r` +is the hub of `r` in `K`, then `w ∈ closure r'`. -/ +theorem hub_mem_closure_of_inter_nonempty + (hS : IsClosedSurface S) {H K : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + {r r' : Set S} (hr : r ∈ H.R) (hr' : r' ∈ K.R) (hne : (r ∩ r').Nonempty) + {w : S} (hw : w ∈ K.V ∩ r) : + w ∈ closure r' := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨y, hyr, hyr'⟩ := hne + have hrad : PreRad (PaintingOrDrawing.drawing H) K := ⟨hK.1, hK.2.1⟩ + have hyU : y ∉ (radialUnion hrad).U := + fun h => h.elim (region_subset hr hyr) (region_subset hr' hyr') + obtain ⟨p, hp, hyp⟩ := exists_region_of_notMem hyU + have hpr' : p ⊆ r' := GM11.region_sub_of_mem hrad hS hr' hp (subset_closure hyp) hyr' + have hpr : p ⊆ r := subset_region hr (region_isPreconnected hp) + (disjoint_left.mpr fun z hz hzU => region_subset hp hz (Or.inl hzU)) hyp hyr + exact closure_mono hpr' (GM11.hub_mem_closure hrad hS hr hp hpr hw.2 hw.1) + +/-- If `r ∈ H.R`, `e ∈ H.E`, `r' ∈ K.R`, `e ⊆ r'`, and `(r ∩ r').Nonempty`, then +`tangleMetric H K ins θ r e ≤ 2` (Graph Minors XIV, proof of (9.2), pages 43–44). -/ +theorem tangleMetric_region_edge_le [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {H K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} + (hResp : IsRespectfulDrawingTangle H θ T) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + {r e r' : Set S} (hr : r ∈ H.R) (he : e ∈ H.E) (hr' : r' ∈ K.R) + (her' : e ⊆ r') (hne : (r ∩ r').Nonempty) : + tangleMetric H K ins θ r e ≤ 2 := by + classical + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hP := hK.2.1 + by_cases hθ : θ ≤ 2 + · exact (GM11.tangleMetric_le_order hP _ _).trans hθ + push Not at hθ + have hT := hResp.2.1 + have hefin : (H.toHypergraph.ends e).Finite := + H.toHypergraph.vertexSet_finite.subset fun _ hx => H.toHypergraph.vertex_mem_of_inc hx + have h2 := GM12.drawing_edge_ends_ncard_le_two he + obtain ⟨D, hD, hDs, hDl, hDV, heD⟩ := + GM14.exists_circuit_around_drawing_edge hS ‹_› hResp (by omega) hK hd he + have hT' : IsPretangle (PaintingOrDrawing.drawing H).toHypergraph θ T := hT.isPretangle + have hs := GM11.isSlope_of_derived hS hT' hP.1 hd + obtain ⟨-, -, hnice⟩ := GM11.ins_slope_facts hS hs hD hDs hDl + have hcl : IsClosed (ins D) := (hs.isClosedDisc D hD hDs hDl).isCompact.isClosed + obtain ⟨u, W₀, hW₀, -, hV, hE⟩ := id hD + obtain ⟨W, hsu, hed⟩ := hDs.exists_walk_up W₀ + have hDeq := (circuit_length_eq_two_mul_ncard hP hD hDs).1 + have hWlen : W.length = D.length := by + rw [Drawing.length, hE, ← hed] + have h : {f | f ∈ W.edges} = (W.edges.toFinset : Set (Set S)) := by ext; simp + rw [h, ncard_coe_finset, List.toFinset_card_of_nodup (hed ▸ hW₀.2)] + rfl + have hDV_ends : D.V ∩ H.V ⊆ H.toHypergraph.ends e := fun x hx => (hDV hx).1 + have hncard_le : (D.V ∩ H.V).ncard ≤ 2 := + (ncard_le_ncard hDV_ends hefin).trans h2 + set n := (D.V ∩ H.V).ncard + have hsub : D.IsSubdrawing (walkDrawing K W) := by + refine ⟨fun x hx => ?_, fun f hf => ?_⟩ + · rw [walkDrawing_V, hsu] + rw [hV] at hx + exact hx + · rw [walkDrawing_E, hed] + rw [hE] at hf + exact hf + have hins : ins D ⊆ insWalk ins K W := fun x hx => + Or.inr (mem_iUnion₂.mpr ⟨D, ⟨hD, hsub⟩, hx⟩) + obtain ⟨y, hy⟩ := he.1 + have hr'D : r' ⊆ ins D := GM11.nice_atom hnice (Or.inr hr') ⟨y, her' hy, heD hy⟩ + obtain ⟨w, ⟨hwr, hwV⟩, -⟩ := hP.2.2.1 r hr + have hw_cl : w ∈ closure r' := + hub_mem_closure_of_inter_nonempty hS hK hr hr' hne ⟨hwV, hwr⟩ + have hwit : GM11.MetricWitness H K ins θ r e n := by + refine ⟨u, W, {w}, r', ?_, ?_, by omega, by omega, ?_, hr'D.trans hins⟩ + · exact ⟨Or.inr hr, Or.inl (Or.inl ⟨w, hwV, rfl⟩), Or.inr (Or.inr ⟨hr, w, ⟨hwV, hwr⟩, rfl⟩)⟩ + · exact ⟨Or.inl (Or.inr he), Or.inr hr', Or.inr (Or.inl ⟨he, hr', her'⟩)⟩ + · rw [singleton_subset_iff] + exact hins (closure_minimal hr'D hcl hw_cl) + exact (GM11.tangleMetric_le hwit).trans hncard_le + +/-- For any atom `z' ∈ A(K)`, if `3 ≤ θ`, then there is a closed walk `W` of `K` of length `< 2θ` +with `z' ⊆ insWalk ins K W`, so `z' ⊆ walkUnion K ins (2 * θ) z'`. -/ +theorem atom_subset_walkUnion_of_three_le [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {H K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} + (hResp : IsRespectfulDrawingTangle H θ T) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hθ : 3 ≤ θ) {z' : Set S} (hz' : z' ∈ K.A) : + z' ⊆ walkUnion K ins (2 * θ) z' := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hP := hK.2.1 + rcases hz' with (⟨v, hv, rfl⟩ | hg) | hr' + · let W : GraphWalk K.toGraph v v := GraphWalk.nil hv + have hWlen : W.length < 2 * θ := by + change 0 < 2 * θ + omega + have hvW : ({v} : Set S) ⊆ insWalk ins K W := by + rw [singleton_subset_iff] + refine Or.inl ((walkDrawing K W).V_subset_U ?_) + rw [walkDrawing_V] + exact W.start_mem_support + exact fun x hx => mem_iUnion₂.mpr ⟨insWalk ins K W, ⟨v, W, hWlen, hvW, rfl⟩, hvW hx⟩ + · obtain ⟨v, hv, r, hr, w, hwr, hwV, hcap, -⟩ := GM11.spoke_ends ⟨hK.1, hK.2.1⟩ hS hg + have hlink : K.toGraph.IsLink z' v w := ⟨hg, hK.2.1.2.1 hv, hwV, hcap⟩ + let W : GraphWalk K.toGraph v v := + GraphWalk.cons hlink (GraphWalk.cons hlink.symm (GraphWalk.nil (hK.2.1.2.1 hv))) + have hWlen : W.length < 2 * θ := by + change 2 < 2 * θ + omega + have hgW : z' ⊆ insWalk ins K W := by + intro x hx + refine Or.inl ?_ + have heW : z' ∈ (walkDrawing K W).E := by + rw [walkDrawing_E] + simp [W] + exact (walkDrawing K W).closure_subset_U heW (subset_closure hx) + exact fun x hx => mem_iUnion₂.mpr ⟨insWalk ins K W, ⟨v, W, hWlen, hgW, rfl⟩, hgW hx⟩ + · have hE : H.E.Nonempty := edgeSet_nonempty_of_isTangle hResp.2.1 (by omega) + have hrf := GM11.regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hE + obtain ⟨e, he, her'⟩ := hrf.1 z' hr' + have hT := hResp.2.1 + have hefin : (H.toHypergraph.ends e).Finite := + H.toHypergraph.vertexSet_finite.subset fun _ hx => H.toHypergraph.vertex_mem_of_inc hx + have h2 := GM12.drawing_edge_ends_ncard_le_two he + obtain ⟨D, hD, hDs, hDl, hDV, heD⟩ := + GM14.exists_circuit_around_drawing_edge hS ‹_› hResp (by omega) hK hd he + have hT' : IsPretangle (PaintingOrDrawing.drawing H).toHypergraph θ T := hT.isPretangle + have hs := GM11.isSlope_of_derived hS hT' hP.1 hd + obtain ⟨-, -, hnice⟩ := GM11.ins_slope_facts hS hs hD hDs hDl + obtain ⟨u, W₀, hW₀, -, hV, hE_D⟩ := id hD + obtain ⟨W, hsu, hed⟩ := hDs.exists_walk_up W₀ + have hDeq := (circuit_length_eq_two_mul_ncard hP hD hDs).1 + have hWlen : W.length = D.length := by + rw [Drawing.length, hE_D, ← hed] + have h : {f | f ∈ W.edges} = (W.edges.toFinset : Set (Set S)) := by ext; simp + rw [h, ncard_coe_finset, List.toFinset_card_of_nodup (hed ▸ hW₀.2)] + rfl + have hDV_ends : D.V ∩ H.V ⊆ H.toHypergraph.ends e := fun x hx => (hDV hx).1 + have hncard_le : (D.V ∩ H.V).ncard ≤ 2 := + (ncard_le_ncard hDV_ends hefin).trans h2 + have hWlt : W.length < 2 * θ := by omega + have hsub : D.IsSubdrawing (walkDrawing K W) := by + refine ⟨fun x hx => ?_, fun f hf => ?_⟩ + · rw [walkDrawing_V, hsu] + rw [hV] at hx + exact hx + · rw [walkDrawing_E, hed] + rw [hE_D] at hf + exact hf + have hins : ins D ⊆ insWalk ins K W := fun x hx => + Or.inr (mem_iUnion₂.mpr ⟨D, ⟨hD, hsub⟩, hx⟩) + obtain ⟨y, hy⟩ := he.1 + have hr'W : z' ⊆ insWalk ins K W := + (GM11.nice_atom hnice (Or.inr hr') ⟨y, her' hy, heD hy⟩).trans hins + exact fun x hx => mem_iUnion₂.mpr ⟨insWalk ins K W, ⟨u, W, hWlt, hr'W, rfl⟩, hr'W hx⟩ + +/-- If `Λ` is an open disc with `IsClosedDisc (closure Λ)` and `subBd (closure Λ) = C.U` for a +subdrawing `C` of `H`, and `closure Λ \ C.U = Λ`, then any atom `x ∈ A(H)` meeting `Λ` satisfies +`x ⊆ Λ`. -/ +theorem atom_subset_open_of_inter_nonempty + (hS : IsClosedSurface S) {H C : Drawing S} {Λ x : Set S} + (hCH : C.IsSubdrawing H) (_hcl_disc : IsClosedDisc (closure Λ)) + (hbd_cl : subBd (closure Λ) = C.U) (hdiff : closure Λ \ C.U = Λ) + (hx : x ∈ H.A) (hne : (x ∩ Λ).Nonempty) : + x ⊆ Λ := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨p, hpx, hpΛ⟩ := hne + have hp_cl : p ∈ closure Λ := by + rw [← hdiff] at hpΛ + exact hpΛ.1 + have hp_not_CU : p ∉ C.U := by + rw [← hdiff] at hpΛ + exact hpΛ.2 + have hfr : frontier (closure Λ) = C.U := by rw [subBd_eq_frontier', hbd_cl] + rcases hx with (⟨v, -, rfl⟩ | he) | hr + · rwa [singleton_subset_iff, ← mem_singleton_iff.mp hpx] + · have hdis : Disjoint x C.U := by + refine disjoint_left.mpr fun y hyx hyCU => ?_ + have hyV : y ∉ C.V := fun hyV => (he.2.1 hyx).2 (hCH.1 hyV) + obtain ⟨f, hfC, hyf⟩ := C.exists_edge_of_mem hyCU hyV + have hxf : x = f := H.edge_eq_of_mem he (hCH.2 hfC) hyx hyf + exact hp_not_CU (C.closure_subset_U hfC (subset_closure (hxf ▸ hpx))) + have hsub : x ⊆ closure Λ := + subset_of_disjoint_frontier he.2.2.1.isConnected.isPreconnected isClosed_closure + (hfr ▸ hdis) hpx hp_cl + rw [← hdiff] + exact fun y hy => ⟨hsub hy, disjoint_left.mp hdis hy⟩ + · have hdis : Disjoint x C.U := + disjoint_left.mpr fun y hyx hyCU => region_subset hr hyx (hCH.U_subset hyCU) + have hsub : x ⊆ closure Λ := + subset_of_disjoint_frontier (region_isPreconnected hr) isClosed_closure + (hfr ▸ hdis) hpx hp_cl + rw [← hdiff] + exact fun y hy => ⟨hsub hy, disjoint_left.mp hdis hy⟩ + +/-- If `Λ` is an open disc with `IsClosedDisc (closure Λ)` and `subBd (closure Λ) = C.U` for a +subdrawing `C` of `H`, and `closure Λ \ C.U = Λ`, then any atom `x ∈ A(H)` meeting `closure Λ` +satisfies `x ⊆ closure Λ`. -/ +theorem atom_subset_closure_of_inter_nonempty + (hS : IsClosedSurface S) {H C : Drawing S} {Λ x : Set S} + (hCH : C.IsSubdrawing H) (hcl_disc : IsClosedDisc (closure Λ)) + (hbd_cl : subBd (closure Λ) = C.U) (hdiff : closure Λ \ C.U = Λ) + (hx : x ∈ H.A) (hne : (x ∩ closure Λ).Nonempty) : + x ⊆ closure Λ := by + by_cases hneΛ : (x ∩ Λ).Nonempty + · have hsub : Λ ⊆ closure Λ := fun y hy => ((Set.ext_iff.mp hdiff y).mpr hy).1 + exact (atom_subset_open_of_inter_nonempty hS hCH hcl_disc hbd_cl hdiff hx hneΛ).trans hsub + · obtain ⟨p, hpx, hpcl⟩ := hne + have hpCU : p ∈ C.U := by + by_contra hpnot + exact hneΛ ⟨p, hpx, hdiff ▸ ⟨hpcl, hpnot⟩⟩ + rcases hx with (⟨v, -, rfl⟩ | he) | hr + · rwa [singleton_subset_iff, ← mem_singleton_iff.mp hpx] + · have hpV : p ∉ C.V := fun hpV => (he.2.1 hpx).2 (hCH.1 hpV) + obtain ⟨f, hfC, hpf⟩ := C.exists_edge_of_mem hpCU hpV + have hxf : x = f := H.edge_eq_of_mem he (hCH.2 hfC) hpx hpf + have hCU_sub : C.U ⊆ closure Λ := by + rw [← hbd_cl] + intro y hy + have hy' := hy.1 + rwa [closure_closure] at hy' + exact hxf ▸ (subset_closure.trans (C.closure_subset_U hfC)).trans hCU_sub + · exact absurd (hCH.U_subset hpCU) (region_subset hr hpx) + +/-- Every atom `x ∈ A(H)` of a drawing `H` on `S` is preconnected. -/ +theorem atom_isPreconnected {H : Drawing S} {x : Set S} (hx : x ∈ H.A) : IsPreconnected x := by + rcases hx with (⟨v, -, rfl⟩ | he) | hr + · exact isPreconnected_singleton + · exact he.2.2.1.isConnected.isPreconnected + · exact region_isPreconnected hr + +/-- If `x'` is the atom of `K` corresponding to `x ∈ A(H)`, then `(x ∩ x').Nonempty`. -/ +theorem correspondingAtom_inter_nonempty {H K : Drawing S} {x x' : Set S} + (hx' : IsCorrespondingAtom H K x x') : (x ∩ x').Nonempty := by + rcases hx'.2.2 with ⟨v, -, rfl, rfl⟩ | ⟨he, -, hsub⟩ | ⟨-, v, ⟨-, hvx⟩, rfl⟩ + · exact ⟨v, rfl, rfl⟩ + · obtain ⟨q, hq⟩ := he.1 + exact ⟨q, hq, hsub hq⟩ + · exact ⟨v, hvx, rfl⟩ + +/-- Every point of a closed surface `S` belongs to some atom `x ∈ A(H)` of a drawing `H` on `S`. -/ +theorem exists_atom_mem_of_point (H : Drawing S) (p : S) : + ∃ x ∈ H.A, p ∈ x := by + obtain ⟨x, hx, hpx⟩ := GM11.exists_atom H p + exact ⟨x, hx, hpx⟩ + +/-- If `Λ` is a `λ`-zone around `z` in `H`, then `closure Λ` is covered by the atoms `x ∈ A(H)` +with `x ⊆ closure Λ` (each of which satisfies `d(z, x) ≤ λ`). Consequently, if `U ⊆ S` contains +every `x ∈ A(H)` with `d(z, x) ≤ λ`, then `closure Λ ⊆ U`. -/ +theorem closure_zone_subset [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {H : Drawing S} {d : Set S → Set S → ℕ} {lam : ℕ} {z Λ U : Set S} + (hZone : IsLambdaZoneAround H d lam z Λ) + (hU : ∀ x ∈ H.A, d z x ≤ lam → x ⊆ U) : + closure Λ ⊆ U := by + obtain ⟨C, hC, hCH, hCU⟩ := GM11.exists_circuit_of_oArc hZone.isOArc_bd hZone.bd_subset_U + have hbd_cl : subBd (closure Λ) = C.U := by + rw [IsClosedDisc.subBd_eq_discBd hS hZone.isClosedDisc_closure, + discBd_closure_eq_subBd hS hZone.isOpenDisc hZone.isOArc_bd hZone.isClosedDisc_closure, hCU] + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hZone.isOpenDisc.1 + have hdiff : closure Λ \ C.U = Λ := by + rw [hCU] + ext y + exact ⟨fun ⟨hycl, hynot⟩ => (hclL ▸ hycl).resolve_right hynot, + fun hy => ⟨subset_closure hy, disjoint_left.mp hdisL hy⟩⟩ + intro p hp + obtain ⟨x, hxA, hpx⟩ := exists_atom_mem_of_point H p + have hx_sub : x ⊆ closure Λ := + atom_subset_closure_of_inter_nonempty hS hCH hZone.isClosedDisc_closure hbd_cl hdiff + hxA ⟨p, hpx, hp⟩ + exact hU x hxA (hZone.dist_le x hxA hx_sub) hpx + +private theorem close_corresponding_atom_lies_in_walk_union + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (H : Drawing S) + (θ : ℕ) + (d : Set S → Set S → ℕ) + (z : Set S) + (hz : z ∈ H.A) + (K : Drawing S) + (ins : Drawing S → Set S) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd_eq : ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = tangleMetric H K ins θ x y) + (z' : Set S) + (hz' : IsCorrespondingAtom H K z z') + (hz'_uniq : ∀ (y : Set S), (fun x' => IsCorrespondingAtom H K z x') y → y = z') + (c : S) + (hc : c ∈ z') + (Δ : Set S) + (hWθ_sub : walkUnion K ins (2 * θ) z' ⊆ Δ \ subBd Δ) + (hz'_sub_Wθ : z' ⊆ walkUnion K ins (2 * θ) z') + (hz'_sub_Δ : z' ⊆ Δ \ subBd Δ) : + ∀ {m : ℕ} {x x' : Set S}, m ≤ θ → IsCorrespondingAtom H K x x' → d z x < m → x' ⊆ z' ∪ + walkUnion K ins (2 * m) z' := by + intro m x x' hm hx' hlt + by_cases hzx : z = x + · subst hzx + have heq : x' = z' := hz'_uniq x' hx' + exact heq ▸ subset_union_left + · rw [hd_eq z hz x hx'.1] at hlt + rcases (GM11.tangleMetric_cases (ins := ins) (θ := θ) hK.2.1 hzx).resolve_left (by omega) with + ⟨-, u, W, z₁', x₁', hz₁, hx₁, hWθ, hWlen, hzW, hxW⟩ + have hz₁_eq : z₁' = z' := hz'_uniq z₁' hz₁ + have hx₁_eq : x₁' = x' := + (existsUnique_correspondingAtom hK hx'.1).unique hx₁ hx' + subst hz₁_eq hx₁_eq + have hWm : W.length < 2 * m := by omega + exact fun y hy => Or.inr (mem_iUnion₂.mpr ⟨insWalk ins K W, ⟨u, W, hWm, hzW, rfl⟩, hxW hy⟩) + +private theorem atom_outside_disc_is_distant_region + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (hS : IsClosedSurface S) + (H : Drawing S) + (θ : ℕ) + (κ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (z : Set S) + (hz : z ∈ H.A) + (hκ2 : 2 ≤ κ) + (hκθ : κ + 3 ≤ θ) + [ConnectedSpace S] + [LocallyConnectedSpace S] + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) + (hResp : IsRespectfulDrawingTangle H θ T) + (K : Drawing S) + (ins : Drawing S → Set S) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hd_eq : ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = tangleMetric H K ins θ x y) + (hsl : IsSlope K (2 * θ) ins) + (hrf : RegionFacts (PaintingOrDrawing.drawing H) K) + (z' : Set S) + (hz' : IsCorrespondingAtom H K z z') + (c : S) + (hc : c ∈ z') + (Δ : Set S) + (hWθ_sub : walkUnion K ins (2 * θ) z' ⊆ Δ \ subBd Δ) + (hz'_sub_Wθ : z' ⊆ walkUnion K ins (2 * θ) z') + (hcorr_sub_walkUnion : ∀ {m : ℕ} {x x' : Set S}, m ≤ θ → IsCorrespondingAtom H K x x' → d z x + < m → x' ⊆ z' ∪ walkUnion K ins (2 * m) z') : + ∀ x ∈ H.A, d z x < θ → ¬x ⊆ Δ \ subBd Δ → x ∈ H.R ∧ θ - 2 ≤ d z x := by + intro x hx hlt hnot + obtain ⟨x', hx', -⟩ := existsUnique_correspondingAtom hK hx + have hx'_sub_Wθ : x' ⊆ walkUnion K ins (2 * θ) z' := by + rcases union_subset hz'_sub_Wθ Subset.rfl with hsub + exact (hcorr_sub_walkUnion le_rfl hx' hlt).trans hsub + have hx'_sub_Δ : x' ⊆ Δ \ subBd Δ := hx'_sub_Wθ.trans hWθ_sub + have hx_not_x' : ¬ (x ⊆ x') := fun h => hnot (h.trans hx'_sub_Δ) + have hxR : x ∈ H.R := by + rcases hx'.2.2 with ⟨v, -, rfl, rfl⟩ | ⟨-, -, hsub⟩ | ⟨hr, -⟩ + · exact absurd Subset.rfl hx_not_x' + · exact absurd hsub hx_not_x' + · exact hr + set Z_θ := walkUnion K ins (2 * θ) z' + have hZθ_eq : Z_θ = restraintUnion K ins (2 * θ) c (2 * θ - 1) := + walkUnion_eq_restraintUnion hS hsl hz'.2.1 hc (by omega) le_rfl + have hZθ_cl : IsClosed Z_θ := hZθ_eq ▸ GM11.isClosed_restraintUnion hS c (2 * θ - 1) + have hx_not_Zθ : ¬ (x ⊆ Z_θ) := fun h => hnot (h.trans hWθ_sub) + obtain ⟨y₀, hy₀x, hy₀Z⟩ := not_subset.mp hx_not_Zθ + have hO : IsOpen (x \ Z_θ) := (region_isOpen hxR).sdiff hZθ_cl + obtain ⟨y, ⟨hyx, hyZ⟩, hyK⟩ := GM11.exists_off_U hS K hO ⟨y₀, hy₀x, hy₀Z⟩ + obtain ⟨r', hr', hyr'⟩ := exists_region_of_notMem hyK + have hr'_not_Zθ : ¬ (r' ⊆ Z_θ) := fun h => hyZ (h hyr') + obtain ⟨e, he, her'⟩ := hrf.1 r' hr' + have he_corr : IsCorrespondingAtom H K e r' := + ⟨Or.inl (Or.inr he), Or.inr hr', Or.inr (Or.inl ⟨he, hr', her'⟩)⟩ + have hze_θ : d z e = θ := by + by_contra hne_θ + have hle_θ : d z e ≤ θ := by + rw [hd_eq z hz e (Or.inl (Or.inr he))] + exact GM11.tangleMetric_le_order hK.2.1 z e + have hlt_θ : d z e < θ := lt_of_le_of_ne hle_θ hne_θ + have hr'_sub : r' ⊆ Z_θ := + (hcorr_sub_walkUnion le_rfl he_corr hlt_θ).trans (union_subset hz'_sub_Wθ Subset.rfl) + exact hr'_not_Zθ hr'_sub + have hxe_le : d x e ≤ 2 := by + rw [hd_eq x hx e (Or.inl (Or.inr he))] + exact tangleMetric_region_edge_le hS hResp hK hd hxR he hr' her' ⟨y, hyx, hyr'⟩ + have htri' := htri z hz x hx e (Or.inl (Or.inr he)) + refine ⟨hxR, by omega⟩ + +private theorem atom_meeting_walk_union_is_close + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (hS : IsClosedSurface S) + (H : Drawing S) + (θ : ℕ) + (d : Set S → Set S → ℕ) + (z : Set S) + (hz : z ∈ H.A) + [ConnectedSpace S] + (hrefl : ∀ a ∈ H.A, d a a = 0) + (K : Drawing S) + (ins : Drawing S → Set S) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd_eq : ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = tangleMetric H K ins θ x y) + (hsl : IsSlope K (2 * θ) ins) + (z' : Set S) + (hz' : IsCorrespondingAtom H K z z') : + ∀ {m : ℕ} {x x' : Set S}, 1 ≤ m → m ≤ θ → IsCorrespondingAtom H K x x' → (x' ∩ walkUnion K ins + (2 * m) z').Nonempty → d z x < m := by + intro m x x' hm1 hmθ hx' ⟨p, hpx', hpW⟩ + by_cases hzx : z = x + · subst hzx + rw [hrefl z hz] + omega + · obtain ⟨X, ⟨u, W, hWm, hzW, rfl⟩, hpX⟩ := mem_iUnion₂.mp hpW + have hWθ : W.length < 2 * θ := by omega + obtain ⟨hrest, -⟩ := GM11.theorem_8_5_proof hS hsl W hWθ + have hx'W : x' ⊆ insWalk ins K W := + GM11.nice_atom hrest.isGammaNice hx'.2.1 ⟨p, hpx', hpX⟩ + have h2le := two_mul_tangleMetric_le_walk_length hK hz' hx' W hWθ hzW hx'W + rw [hd_eq z hz x hx'.1] + omega + +private theorem restraint_with_selected_regions_is_preconnected + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (hS : IsClosedSurface S) + (H : Drawing S) + (θ : ℕ) + (κ : ℕ) + (z : Set S) + [ConnectedSpace S] + (K : Drawing S) + (ins : Drawing S → Set S) + (hsl : IsSlope K (2 * θ) ins) + (z' : Set S) + (hz' : IsCorrespondingAtom H K z z') + (c : S) + (hWκ_eq : (walkUnion K ins (2 * κ) z') = restraintUnion K ins (2 * θ) c (2 * κ - 1)) : + IsPreconnected (z' ∪ (walkUnion K ins (2 * κ) z')) := by + let W_κ := walkUnion K ins (2 * κ) z' + let Z := z' ∪ W_κ + change IsPreconnected Z + change W_κ = _ at hWκ_eq + by_cases hne : W_κ.Nonempty + · obtain ⟨q, hq⟩ := id hne + obtain ⟨X, ⟨u, W, hW, hzW, rfl⟩, -⟩ := mem_iUnion₂.mp hq + have hz'_Wκ : z' ⊆ W_κ := fun x hx => + mem_iUnion₂.mpr ⟨insWalk ins K W, ⟨u, W, hW, hzW, rfl⟩, hzW hx⟩ + have hZ_eq_Wκ : Z = W_κ := union_eq_right.mpr hz'_Wκ + have hsc : IsSimplyConnectedSet W_κ := + hWκ_eq ▸ GM11.theorem_8_10_proof hS hsl (hWκ_eq ▸ hne) + exact hZ_eq_Wκ ▸ hsc.1.isConnected.isPreconnected + · have hWκ_emp : W_κ = ∅ := not_nonempty_iff_eq_empty.mp hne + have hZ_eq_z' : Z = z' := by simp [Z, hWκ_emp] + exact hZ_eq_z' ▸ atom_isPreconnected hz'.2.1 + +private theorem region_meeting_restraint_is_close + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (hS : IsClosedSurface S) + (H : Drawing S) + (θ : ℕ) + (κ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (z : Set S) + (hz : z ∈ H.A) + (hκ2 : 2 ≤ κ) + (hκθ : κ + 3 ≤ θ) + [this : ConnectedSpace S] + [LocallyConnectedSpace S] + (hrefl : ∀ a ∈ H.A, d a a = 0) + (hsymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) + (hv_reg : H.E.Nonempty → ∀ v ∈ H.V, ∀ r ∈ H.R, v ∈ closure r → d {v} r ≤ 1) + (hResp : IsRespectfulDrawingTangle H θ T) + (K : Drawing S) + (ins : Drawing S → Set S) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hd_eq : ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = tangleMetric H K ins θ x y) + (hE : H.E.Nonempty) + (z' : Set S) + (hz' : IsCorrespondingAtom H K z z') + (hz'_uniq : ∀ (y : Set S), (fun x' => IsCorrespondingAtom H K z x') y → y = z') + (c : S) + (hc : c ∈ z') + (Δ : Set S) + (hWθ_sub : walkUnion K ins (2 * θ) z' ⊆ Δ \ subBd Δ) + (hz'_sub_Wθ : z' ⊆ walkUnion K ins (2 * θ) z') + (hz'_sub_Δ : z' ⊆ Δ \ subBd Δ) + (hcorr_sub_walkUnion : ∀ {m : ℕ} {x x' : Set S}, m ≤ θ → IsCorrespondingAtom H K x x' → d z x + < m → x' ⊆ z' ∪ walkUnion K ins (2 * m) z') + (hclaim1 : ∀ x ∈ H.A, d z x < θ → ¬x ⊆ Δ \ subBd Δ → x ∈ H.R ∧ θ - 2 ≤ d z x) + (hWκ_eq : (walkUnion K ins (2 * κ) z') = restraintUnion K ins (2 * θ) c (2 * κ - 1)) + (hWκ_cl : IsClosed (walkUnion K ins (2 * κ) z')) + (hWκ_nice : IsGammaNice K (walkUnion K ins (2 * κ) z')) + (hZne : (z' ∪ (walkUnion K ins (2 * κ) z')).Nonempty) + (hZconn : IsPreconnected (z' ∪ (walkUnion K ins (2 * κ) z'))) + (hdist_lt_of_inter_walkUnion : ∀ {m : ℕ} {x x' : Set S}, 1 ≤ m → m ≤ θ → IsCorrespondingAtom H + K x x' → (x' ∩ walkUnion K ins (2 * m) z').Nonempty → d z x < m) : + ∀ r ∈ H.R, (closure r ∩ (z' ∪ (walkUnion K ins (2 * κ) z'))).Nonempty → d z r ≤ κ ∧ r ⊆ Δ \ + subBd Δ := by + let W_κ := walkUnion K ins (2 * κ) z' + let Z := z' ∪ W_κ + intro r hr ⟨p, hpr, hpZ⟩ + have hrA : r ∈ H.A := Or.inr hr + obtain ⟨w, ⟨hwr, hwV⟩, -⟩ := hK.2.1.2.2.1 r hr + have hr_corr : IsCorrespondingAtom H K r {w} := + ⟨hrA, Or.inl (Or.inl ⟨w, hwV, rfl⟩), Or.inr (Or.inr ⟨hr, w, ⟨hwV, hwr⟩, rfl⟩)⟩ + have hzr_le : d z r ≤ κ := by + rcases hpZ with hpz' | hpW + · rcases hz'.2.2 with ⟨v, hv, rfl, rfl⟩ | ⟨he, hr', her'⟩ | ⟨hzR, v, ⟨-, hcz⟩, rfl⟩ + · have hvp : p = v := mem_singleton_iff.mp hpz' + have hvr : d {v} r ≤ 1 := hv_reg hE v hv r hr (hvp ▸ hpr) + omega + · obtain ⟨q, hqr', hqr⟩ := mem_closure_iff.mp hpr z' (region_isOpen hr') hpz' + have hrz : d r z ≤ 2 := by + rw [hd_eq r hrA z hz] + exact tangleMetric_region_edge_le hS hResp hK hd hr he hr' her' ⟨q, hqr, hqr'⟩ + rw [hsymm z hz r hrA] + omega + · obtain ⟨q, hqz, hqr⟩ := mem_closure_iff.mp hpr z (region_isOpen hzR) + (mem_singleton_iff.mp hpz' ▸ hcz) + have hrz_eq : r = z := region_eq_of_mem hr hzR hqr hqz + subst hrz_eq + rw [hrefl r hrA] + omega + · by_cases hpHV : p ∈ H.V + · have hp_corr : IsCorrespondingAtom H K {p} {p} := + ⟨Or.inl (Or.inl ⟨p, hpHV, rfl⟩), Or.inl (Or.inl ⟨p, hK.2.1.2.1 hpHV, rfl⟩), + Or.inl ⟨p, hpHV, rfl, rfl⟩⟩ + have hzp_lt : d z {p} < κ := + hdist_lt_of_inter_walkUnion (by omega) (by omega) hp_corr ⟨p, rfl, hpW⟩ + have hpr_le : d {p} r ≤ 1 := hv_reg hE p hpHV r hr hpr + have htri' := htri z hz {p} (Or.inl (Or.inl ⟨p, hpHV, rfl⟩)) r hrA + omega + · -- Show `w ∈ W_κ`, so `d z r < κ`. + have hHUK_eq : H.U ∩ K.U = H.V := hK.2.1.1 + have hwW : w ∈ W_κ := by + by_cases hpKV : p ∈ K.V + · have hp_in_r : p ∈ r := by + by_contra hp_not_r + have hpHU : p ∈ H.U := by + by_contra hp_not_HU + obtain ⟨r₀, hr₀, hpr₀⟩ := exists_region_of_notMem hp_not_HU + obtain ⟨q, hqr₀, hqr⟩ := mem_closure_iff.mp hpr r₀ (region_isOpen hr₀) hpr₀ + exact hp_not_r (region_eq_of_mem hr₀ hr hqr₀ hqr ▸ hpr₀) + have : p ∈ H.U ∩ K.U := ⟨hpHU, K.V_subset_U hpKV⟩ + rw [hHUK_eq] at this + exact hpHV this + have hpw : p = w := + GM11.hub_unique ⟨hK.1, hK.2.1⟩ hr hwr hwV hp_in_r hpKV + exact hpw ▸ hpW + · by_cases hpKU : p ∈ K.U + · obtain ⟨g, hg, hpg⟩ := K.exists_edge_of_mem hpKU hpKV + obtain ⟨v₀, -, r₀, hr₀, w₀, hw₀r, hw₀V, hcap, hsubr₀⟩ := + GM11.spoke_ends ⟨hK.1, hK.2.1⟩ hS hg + obtain ⟨q, hqr₀, hqr⟩ := + mem_closure_iff.mp hpr r₀ (region_isOpen hr₀) (hsubr₀ hpg) + have hr₀_eq : r₀ = r := region_eq_of_mem hr₀ hr hqr₀ hqr + subst hr₀_eq + have hw₀_eq : w₀ = w := + GM11.hub_unique ⟨hK.1, hK.2.1⟩ hr hwr hwV hw₀r hw₀V + have hgW : g ⊆ W_κ := + GM11.nice_atom hWκ_nice (Or.inl (Or.inr hg)) ⟨p, hpg, hpW⟩ + have hw_clg : w ∈ closure g := by + have : w ∈ closure g ∩ K.V := by rw [hcap, hw₀_eq]; simp + exact this.1 + exact hWκ_cl.closure_subset_iff.mpr hgW hw_clg + · obtain ⟨r', hr', hpr'⟩ := exists_region_of_notMem hpKU + have hr'W : r' ⊆ W_κ := + GM11.nice_atom hWκ_nice (Or.inr hr') ⟨p, hpr', hpW⟩ + obtain ⟨q, hqr', hqr⟩ := + mem_closure_iff.mp hpr r' (region_isOpen hr') hpr' + have hw_clr' : w ∈ closure r' := + hub_mem_closure_of_inter_nonempty hS hK hr hr' ⟨q, hqr, hqr'⟩ ⟨hwV, hwr⟩ + exact hWκ_cl.closure_subset_iff.mpr hr'W hw_clr' + have hzr_lt : d z r < κ := + hdist_lt_of_inter_walkUnion (by omega) (by omega) hr_corr ⟨w, rfl, hwW⟩ + omega + refine ⟨hzr_le, ?_⟩ + by_contra hnot + have h1 := hclaim1 r hrA (by omega) hnot + omega + +private theorem circuit_edge_closures_in_enlarged_restraint + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (hS : IsClosedSurface S) + (H : Drawing S) + (θ : ℕ) + (κ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (z : Set S) + (hz : z ∈ H.A) + (hκ2 : 2 ≤ κ) + (hκθ : κ + 3 ≤ θ) + [this : ConnectedSpace S] + [LocallyConnectedSpace S] + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) + (hResp : IsRespectfulDrawingTangle H θ T) + (K : Drawing S) + (ins : Drawing S → Set S) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hd_eq : ∀ x ∈ H.A, ∀ y ∈ H.A, d x y = tangleMetric H K ins θ x y) + (hsl : IsSlope K (2 * θ) ins) + (hE : H.E.Nonempty) + (z' : Set S) + (hz' : IsCorrespondingAtom H K z z') + (hz'_uniq : ∀ (y : Set S), (fun x' => IsCorrespondingAtom H K z x') y → y = z') + (Δ : Set S) + (hcorr_sub_walkUnion : ∀ {m : ℕ} {x x' : Set S}, m ≤ θ → IsCorrespondingAtom H K x x' → d z x + < m → x' ⊆ z' ∪ walkUnion K ins (2 * m) z') + (hclaim2 : ∀ r ∈ H.R, (closure r ∩ (z' ∪ walkUnion K ins (2 * κ) z')).Nonempty → + d z r ≤ κ ∧ r ⊆ Δ \ subBd Δ) + (C : Drawing S) + (hCH : C.IsSubdrawing H) + (heR : ∀ e ∈ C.E, ∃ r ∈ H.R, H.EdgeRegionIncident e r ∧ + (closure r ∩ (z' ∪ walkUnion K ins (2 * κ) z')).Nonempty) + (hY_cl : IsClosed (walkUnion K ins (2 * (κ + 3)) z')) + (hHUK_eq : H.U ∩ K.U = H.V) : + ∀ e ∈ C.E, closure e ⊆ (walkUnion K ins (2 * (κ + 3)) z') := by + let Z := z' ∪ walkUnion K ins (2 * κ) z' + let Y := walkUnion K ins (2 * (κ + 3)) z' + intro e heC + obtain ⟨r, hr, hinc, hrZ⟩ := heR e heC + have heH : e ∈ H.E := hCH.2 heC + obtain ⟨p, hpe⟩ := heH.1 + have hpK : p ∉ K.U := by + intro hpK + have : p ∈ H.U ∩ K.U := ⟨(heH.2.1 hpe).1, hpK⟩ + rw [hHUK_eq] at this + exact (heH.2.1 hpe).2 this + obtain ⟨r', hr', hpr'⟩ := exists_region_of_notMem hpK + have her' : e ⊆ r' := + subset_region hr' heH.2.2.1.isConnected.isPreconnected + (disjoint_left.mpr fun y hye hyK => (heH.2.1 hye).2 (hHUK_eq ▸ ⟨(heH.2.1 hye).1, hyK⟩)) + hpe hpr' + obtain ⟨q₀, hq₀e, hq₀r⟩ := hinc.2.2 + obtain ⟨q, hqr', hqr⟩ := mem_closure_iff.mp hq₀r r' (region_isOpen hr') (her' hq₀e) + have hre_le : d r e ≤ 2 := by + rw [hd_eq r (Or.inr hr) e (Or.inl (Or.inr heH))] + exact tangleMetric_region_edge_le hS hResp hK hd hr heH hr' her' ⟨q, hqr, hqr'⟩ + have hzr_le : d z r ≤ κ := (hclaim2 r hr hrZ).1 + have htri' := htri z hz r (Or.inr hr) e (Or.inl (Or.inr heH)) + have hze_lt : d z e < κ + 3 := by omega + have he_corr : IsCorrespondingAtom H K e r' := + ⟨Or.inl (Or.inr heH), Or.inr hr', Or.inr (Or.inl ⟨heH, hr', her'⟩)⟩ + have hr'_sub_Y : r' ⊆ Y := by + by_cases hze : z = e + · have hz'_eq : r' = z' := hz'_uniq r' (hze.symm ▸ he_corr) + have hefin : (H.toHypergraph.ends e).Finite := + H.toHypergraph.vertexSet_finite.subset fun _ hx => H.toHypergraph.vertex_mem_of_inc hx + have h2 := GM12.drawing_edge_ends_ncard_le_two heH + obtain ⟨D, hD, hDs, hDl, hDV, heD⟩ := + GM14.exists_circuit_around_drawing_edge hS ‹_› hResp (by omega) hK hd heH + obtain ⟨-, -, hnice⟩ := GM11.ins_slope_facts hS hsl hD hDs hDl + obtain ⟨u, W₀, hW₀, -, hV, hE_D⟩ := id hD + obtain ⟨W, hsu, hed⟩ := hDs.exists_walk_up W₀ + have hDeq := (circuit_length_eq_two_mul_ncard hK.2.1 hD hDs).1 + have hWlen : W.length = D.length := by + rw [Drawing.length, hE_D, ← hed] + have h : {f | f ∈ W.edges} = (W.edges.toFinset : Set (Set S)) := by ext; simp + rw [h, ncard_coe_finset, List.toFinset_card_of_nodup (hed ▸ hW₀.2)] + rfl + have hDV_ends : D.V ∩ H.V ⊆ H.toHypergraph.ends e := fun x hx => (hDV hx).1 + have hncard_le : (D.V ∩ H.V).ncard ≤ 2 := + (ncard_le_ncard hDV_ends hefin).trans h2 + have hWlt : W.length < 2 * (κ + 3) := by omega + have hsub : D.IsSubdrawing (walkDrawing K W) := by + refine ⟨fun x hx => ?_, fun f hf => ?_⟩ + · rw [walkDrawing_V, hsu] + rw [hV] at hx + exact hx + · rw [walkDrawing_E, hed] + rw [hE_D] at hf + exact hf + have hins : ins D ⊆ insWalk ins K W := fun x hx => + Or.inr (mem_iUnion₂.mpr ⟨D, ⟨hD, hsub⟩, hx⟩) + have hr'W : r' ⊆ insWalk ins K W := + (GM11.nice_atom hnice (Or.inr hr') ⟨p, hpr', heD hpe⟩).trans hins + exact fun x hx => mem_iUnion₂.mpr ⟨insWalk ins K W, ⟨u, W, hWlt, hz'_eq ▸ hr'W, rfl⟩, + hr'W hx⟩ + · have hsub := hcorr_sub_walkUnion (by omega) he_corr hze_lt + intro x hx + rcases hsub hx with hxz' | hxY + · exfalso + exact hze (correspondingAtom_inj hS hK hE hz' + ⟨Or.inl (Or.inr heH), hz'.2.1, by + have hr'_eq : z' = r' := by + by_contra hne' + exact disjoint_left.mp (disjoint_of_mem_A_ne hz'.2.1 (Or.inr hr') hne') hxz' hx + exact hr'_eq ▸ he_corr.2.2⟩) + · exact hxY + exact hY_cl.closure_subset_iff.mpr (her'.trans hr'_sub_Y) + +/-- Stronger internal form of Graph Minors XIV, (9.2) (page 43), also returning the bounding +circuit `C` of `H` with `subBd Λ = C.U`, `subBd (closure Λ) = C.U`, and `closure Λ \ C.U = Λ`. -/ +theorem full_of_9_2 + {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + (H : Drawing S) (θ κ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (z : Set S) + (hMetric : HasTangleMetric H θ T d) (hz : z ∈ H.A) + (hκ2 : 2 ≤ κ) (hκθ : κ + 3 ≤ θ) : + ∃ (C : Drawing S) (Λ : Set S), + C.IsSubdrawing H ∧ C.IsCircuit ∧ + subBd Λ = C.U ∧ subBd (closure Λ) = C.U ∧ closure Λ \ C.U = Λ ∧ + IsLambdaZoneAround H d (κ + 2) z Λ ∧ + ∀ x ∈ H.A, d z x < κ → x ⊆ Λ := by + have : ConnectedSpace S := hConn + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have h91_prop := GM11.gm15_theorem_9_1 H θ T d hS hConn hMetric + have hrefl := h91_prop.2.1 + have hsymm := h91_prop.2.2.2.1 + have htri := h91_prop.2.2.2.2.1 + have hv_reg := h91_prop.2.2.2.2.2.1 + obtain ⟨hResp, K, ins, hK, hd, hd_eq⟩ := hMetric + have hsl : IsSlope K (2 * θ) ins := + GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) hS hResp.2.1.isPretangle hK.2.1.1 hd + have hE : H.E.Nonempty := edgeSet_nonempty_of_isTangle hResp.2.1 (by omega) + have hrf := GM11.regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hE + obtain ⟨z', hz', hz'_uniq⟩ := existsUnique_correspondingAtom hK hz + obtain ⟨c, hc⟩ := atom_nonempty hz'.2.1 + -- Apply (9.1) with `κ = θ` to get a closed disc `Δ` with `walkUnion K ins (2 * θ) z' ⊆ Δ \ subBd + -- Δ`. + obtain ⟨Δ, hΔ, hWθ_sub⟩ := theorem_9_1_proof hS hResp hK hd (by omega) le_rfl hz'.2.1 + have hz'_sub_Wθ : z' ⊆ walkUnion K ins (2 * θ) z' := + atom_subset_walkUnion_of_three_le hS hResp hK hd (by omega) hz'.2.1 + have hz'_sub_Δ : z' ⊆ Δ \ subBd Δ := hz'_sub_Wθ.trans hWθ_sub + -- Helper: if `x ∈ A(H)` and `d z x < m` (`m ≤ θ`), then the atom `x'` of `K` corresponding to `x` + -- satisfies `x' ⊆ z' ∪ walkUnion K ins (2 * m) z'`. + have hcorr_sub_walkUnion : ∀ {m : ℕ} {x x' : Set S}, m ≤ θ → + IsCorrespondingAtom H K x x' → d z x < m → + x' ⊆ z' ∪ walkUnion K ins (2 * m) z' := by + exact close_corresponding_atom_lies_in_walk_union (S := S) H θ d z hz K ins hK hd_eq z' + hz' hz'_uniq c hc Δ hWθ_sub hz'_sub_Wθ hz'_sub_Δ + -- Claim (1): For every `x ∈ A(H)` with `d z x < θ`, if `¬ (x ⊆ Δ \ subBd Δ)`, then `x ∈ H.R` and + -- `θ - 2 ≤ d z x`. + have hclaim1 : ∀ x ∈ H.A, d z x < θ → ¬ (x ⊆ Δ \ subBd Δ) → x ∈ H.R ∧ θ - 2 ≤ d z x := by + exact atom_outside_disc_is_distant_region (S := S) hS H θ κ T d z hz hκ2 hκθ htri hResp K + ins hK hd hd_eq hsl hrf z' hz' c hc Δ hWθ_sub hz'_sub_Wθ hcorr_sub_walkUnion + -- Define `Z = z' ∪ walkUnion K ins (2 * κ) z'`. + set W_κ := walkUnion K ins (2 * κ) z' + set Z := z' ∪ W_κ + have hWκ_eq : W_κ = restraintUnion K ins (2 * θ) c (2 * κ - 1) := + walkUnion_eq_restraintUnion hS hsl hz'.2.1 hc (by omega) (by omega) + have hWκ_cl : IsClosed W_κ := hWκ_eq ▸ GM11.isClosed_restraintUnion hS c (2 * κ - 1) + have hWκ_nice : IsGammaNice K W_κ := hWκ_eq ▸ GM11.isGammaNice_restraintUnion c (2 * κ - 1) + have hZne : Z.Nonempty := ⟨c, Or.inl hc⟩ + have hZconn : IsPreconnected Z := by + exact restraint_with_selected_regions_is_preconnected (S := S) hS H θ κ z K ins hsl z' hz' c + hWκ_eq + -- Helper: if `x' ∈ A(K)` corresponds to `x ∈ A(H)` and `(x' ∩ W_m).Nonempty`, then `d z x < m`. + have hdist_lt_of_inter_walkUnion : ∀ {m : ℕ} {x x' : Set S}, + 1 ≤ m → m ≤ θ → IsCorrespondingAtom H K x x' → + (x' ∩ walkUnion K ins (2 * m) z').Nonempty → d z x < m := by + exact atom_meeting_walk_union_is_close (S := S) hS H θ d z hz hrefl K ins hK hd_eq hsl + z' hz' + -- Claim (2): For every `r ∈ H.R` with `(closure r ∩ Z).Nonempty`, `d z r ≤ κ` and + -- `r ⊆ Δ \ subBd Δ`. + have hclaim2 : ∀ r ∈ H.R, (closure r ∩ Z).Nonempty → d z r ≤ κ ∧ r ⊆ Δ \ subBd Δ := by + exact region_meeting_restraint_is_close (S := S) hS H θ κ T d z hz hκ2 hκθ hrefl hsymm + htri hv_reg hResp K ins hK hd hd_eq hE z' hz' hz'_uniq c hc Δ hWθ_sub hz'_sub_Wθ hz'_sub_Δ + hcorr_sub_walkUnion hclaim1 hWκ_eq hWκ_cl hWκ_nice hZne hZconn hdist_lt_of_inter_walkUnion + -- Apply (5.2) (`theorem_5_2_full`) to `H`, `Δ`, `Z`. + obtain ⟨C, Λ, hCH, hC, hCU, hOpenΛ, hclΛ_sub, hclΛ_disc, hbdΛ, hbd_clΛ, hdiffΛ, hZΛ, heR⟩ := + theorem_5_2_full hS H hΔ hZne hZconn (fun r hr hrZ => (hclaim2 r hr hrZ).2) + -- Show `x ⊆ Λ` for every `x ∈ A(H)` with `d z x < κ`. + have hx_sub_Λ : ∀ x ∈ H.A, d z x < κ → x ⊆ Λ := by + intro x hx hlt + obtain ⟨x', hx', -⟩ := existsUnique_correspondingAtom hK hx + have hx'_Z : x' ⊆ Z := hcorr_sub_walkUnion (by omega) hx' hlt + have hx'_Λ : x' ⊆ Λ := hx'_Z.trans hZΛ + obtain ⟨q, hq⟩ := correspondingAtom_inter_nonempty hx' + exact atom_subset_open_of_inter_nonempty hS hCH hclΛ_disc hbd_clΛ hdiffΛ hx ⟨q, hq.1, + hx'_Λ hq.2⟩ + have hz_sub_Λ : z ⊆ Λ := hx_sub_Λ z hz (by rw [hrefl z hz]; omega) + -- Let `Y = walkUnion K ins (2 * (κ + 3)) z'`. Show `C.U ⊆ Y` and `closure Λ ⊆ Y`. + set Y := walkUnion K ins (2 * (κ + 3)) z' + have hY_eq : Y = restraintUnion K ins (2 * θ) c (2 * (κ + 3) - 1) := + walkUnion_eq_restraintUnion hS hsl hz'.2.1 hc (by omega) (by omega) + have hY_cl : IsClosed Y := hY_eq ▸ GM11.isClosed_restraintUnion hS c (2 * (κ + 3) - 1) + have hY_sub_Wθ : Y ⊆ walkUnion K ins (2 * θ) z' := by + refine iUnion₂_subset ?_ + rintro X ⟨u, W, hW, hzW, rfl⟩ + exact subset_biUnion_of_mem (u := id) ⟨u, W, by omega, hzW, rfl⟩ + have hY_sub_Δ : Y ⊆ Δ := hY_sub_Wθ.trans (hWθ_sub.trans sdiff_subset) + have hHUK_eq : H.U ∩ K.U = H.V := hK.2.1.1 + have hCE_sub_Y : ∀ e ∈ C.E, closure e ⊆ Y := by + exact circuit_edge_closures_in_enlarged_restraint (S := S) hS H θ κ T d z hz hκ2 hκθ htri + hResp K ins hK hd hd_eq hsl hE z' hz' hz'_uniq Δ hcorr_sub_walkUnion hclaim2 C hCH heR hY_cl + hHUK_eq + have hCU_sub_Y : C.U ⊆ Y := by + rw [C.U_eq] + refine union_subset (fun v hv => ?_) (iUnion₂_subset hCE_sub_Y) + obtain ⟨e, he, hve⟩ := exists_edge_closure_of_mem_circuit_U hC (C.V_subset_U hv) + exact hCE_sub_Y e he hve + have hO : IsOArc C.U := isOArc_of_isCircuit hC + have hYne : Y.Nonempty := (IsOArc.nonempty hO).mono hCU_sub_Y + have hYsc : IsSimplyConnectedSet Y := + hY_eq ▸ GM11.theorem_8_10_proof hS hsl (hY_eq ▸ hYne) + have hnull : IsNullHomotopicOArcIn Y C.U := by + obtain ⟨ψ⟩ := id hO + refine ⟨ψ, hYsc.2 _ ?_⟩ + rintro _ ⟨x, rfl⟩ + exact hCU_sub_Y (ψ x).2 + obtain ⟨Δ₁, hΔ₁Y, hd₁, hb₁⟩ := GM11.theorem_7_2_proof hS hO hCU_sub_Y hnull + have hb₁' : discBd Δ₁ = C.U := by + rw [← IsClosedDisc.subBd_eq_discBd hS hd₁, hb₁] + have hb₂' : discBd (closure Λ) = C.U := by + rw [← IsClosedDisc.subBd_eq_discBd hS hclΛ_disc, hbd_clΛ] + have hclΛ_eq_Δ₁ : closure Λ = Δ₁ := by + by_contra hne_eq + have hcov : closure Λ ∪ Δ₁ = univ := + cover_of_discBd_eq hS hclΛ_disc hd₁ (hb₂'.trans hb₁'.symm) hne_eq + have hΔ_univ : Δ = univ := + subset_antisymm (subset_univ _) + (hcov ▸ union_subset hclΛ_sub (hΔ₁Y.trans hY_sub_Δ)) + obtain ⟨q, hq⟩ := IsOArc.nonempty hΔ.isOArc_discBd + rw [← IsClosedDisc.frontier_eq_discBd hS hΔ, hΔ_univ, frontier_univ] at hq + exact hq + have hclΛ_sub_Y : closure Λ ⊆ Y := hclΛ_eq_Δ₁ ▸ hΔ₁Y + have hZone : IsLambdaZoneAround H d (κ + 2) z Λ := by + refine ⟨hz, hOpenΛ, hz_sub_Λ, hbdΛ ▸ hO, hclΛ_disc, hbdΛ ▸ hCH.U_subset, ?_, fun _ => by omega⟩ + intro x hx hx_cl + obtain ⟨x', hx', -⟩ := existsUnique_correspondingAtom hK hx + obtain ⟨q, hqx, hqx'⟩ := correspondingAtom_inter_nonempty hx' + have hlt : d z x < κ + 3 := + hdist_lt_of_inter_walkUnion (by omega) (by omega) hx' ⟨q, hqx', hclΛ_sub_Y (hx_cl hqx)⟩ + omega + exact ⟨C, Λ, hCH, hC, hbdΛ, hbd_clΛ, hdiffΛ, hZone, hx_sub_Λ⟩ + +/-- **Graph Minors XIV, (9.2)** (page 43), proving `GM16.GM14Theorem92Statement`: +"Let $H$ be a 2-cell drawing in $\Sigma$, and let $\mathscr{T}$ be a respectful tangle in $H$ +of order $\theta$, with metric $d$. Let $z \in A(H)$ and let $\kappa$ be an integer with $2 +\le \kappa \le \theta - 3$. Then there is a $(\kappa + 2)$-zone $\Lambda$ around $z$ such +that $x \subseteq \Lambda$ for every $x \in A(H)$ with $d(z, x) < \kappa$." -/ +theorem theorem_9_2_proof : + GM16.GM14Theorem92Statement.{w} := by + intro S _ _ H θ κ T d z hS hConn hMetric hz hκ2 hκθ + obtain ⟨_, Λ, -, -, -, -, -, hZone, hx_sub⟩ := + full_of_9_2 hS hConn H θ κ T d z hMetric hz hκ2 hκθ + exact ⟨Λ, hZone, hx_sub⟩ + +/-! ## 3. Proof of (9.4) (page 45) -/ + +/-- **Graph Minors XIV, (9.4)** (page 45): +"Let $H$ be a 2-cell drawing in $\Sigma$, let $z \in A(H)$, and let $\mathscr{T}$ be a respectful +tangle in $H$ of order $\theta$, with metric $d$. Let $1 \le \kappa \le \theta - 7$, and let +$\Lambda$ be a $\kappa$-zone around $z$, including every $x \in A(H)$ with $d(z, x) \le 3$. Let $H$ +be a subgraph of $G$, let $\mathscr{S}$ be a $\mathscr{T}$-local 3-segregation of $G$, and let +$\alpha$ be an arrangement of $\mathscr{S}$ in $\Sigma$ compatible with $H$. Then there is a closed +disc $\Delta \subseteq \Sigma$ such that $\Lambda \subseteq \Delta$, $bd(\Delta)$ is +$\alpha$-normal, $H \cap \Sigma - \Delta$ has a circuit, and $d(z, x) \le \kappa + 3$ for all $x +\in A(H)$ with $x \cap \Delta \ne \emptyset$." -/ +theorem theorem_9_4_proof + [T2Space S] (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {α : Type v} {β : Type w} + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ κ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z Λ : Set S} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + (hMetric : HasTangleMetric H θ T d) (hz : z ∈ H.A) + (hκ1 : 1 ≤ κ) (hκθ : κ + 7 ≤ θ) + (hZone : IsLambdaZoneAround H d κ z Λ) + (hΛ_le3 : ∀ x ∈ H.A, d z x ≤ 3 → x ⊆ Λ) + (hSeg : IsThreeSegregation G S_seg) (hLoc : IsTangleLocal G H η T S_seg) + (hArr : IsSurfaceArrangement S_seg α_disc α_pt) + (hComp : IsCompatibleWith G H η S_seg α_disc α_pt) : + ∃ (F Δ : Set S) (C_out : Drawing S), + IsOArc F ∧ IsArrangementNormal S_seg α_disc α_pt F ∧ + IsClosedDisc Δ ∧ subBd Δ = F ∧ closure Λ ⊆ Δ ∧ + C_out.IsCircuit ∧ C_out.IsSubdrawing (H.interSet (closure (univ \ Δ))) ∧ + C_out.IsSubdrawing (clearedSubdrawing H Δ) ∧ + ∀ x ∈ H.A, (x ∩ Δ).Nonempty → d z x ≤ κ + 3 := by + have : ConnectedSpace S := hConn + -- Apply (9.2) with `κ + 1` to obtain a `(κ + 3)`-zone `Λ₁` around `z`. + obtain ⟨C₁, Λ₁, hC₁H, hC₁, hbdΛ₁, hbd_clΛ₁, hdiffΛ₁, hZone₁, hx_sub_Λ₁⟩ := + full_of_9_2 hS hConn H θ (κ + 1) T d z hMetric hz (by omega) (by omega) + -- Apply (9.2) with `κ + 4` to obtain a `(κ + 6)`-zone `Λ₂` around `z` with `closure Λ₁ ⊆ Λ₂`. + obtain ⟨C_out, Λ₂, hCoutH, hCout, hbdΛ₂, hbd_clΛ₂, hdiffΛ₂, hZone₂, hx_sub_Λ₂⟩ := + full_of_9_2 hS hConn H θ (κ + 4) T d z hMetric hz (by omega) (by omega) + have hclΛ_sub_Λ₁ : closure Λ ⊆ Λ₁ := + closure_zone_subset hS hZone (fun x hx hle => hx_sub_Λ₁ x hx (by omega)) + have hclΛ₁_sub_Λ₂ : closure Λ₁ ⊆ Λ₂ := + closure_zone_subset hS hZone₁ (fun x hx hle => hx_sub_Λ₂ x hx (by omega)) + -- Obtain the circuit `C₂ = H ∩ bd(Λ)` of `H` bounding `closure Λ`. + obtain ⟨C₂, hC₂, hC₂H, hC₂U⟩ := GM11.exists_circuit_of_oArc hZone.isOArc_bd hZone.bd_subset_U + have hbd_clΛ : subBd (closure Λ) = C₂.U := by + rw [IsClosedDisc.subBd_eq_discBd hS hZone.isClosedDisc_closure, + discBd_closure_eq_subBd hS hZone.isOpenDisc hZone.isOArc_bd hZone.isClosedDisc_closure, hC₂U] + obtain ⟨hdisL, hclL⟩ := isOpen_disjoint_subBd_and_closure_eq hZone.isOpenDisc.1 + have hdiffΛ : closure Λ \ subBd (closure Λ) = Λ := by + rw [hbd_clΛ, hC₂U] + ext y + exact ⟨fun ⟨hycl, hynot⟩ => (hclL ▸ hycl).resolve_right hynot, + fun hy => ⟨subset_closure hy, disjoint_left.mp hdisL hy⟩⟩ + have hdisj_C₁_C₂ : Disjoint C₁.V C₂.V := by + refine disjoint_left.mpr fun v hv₁ hv₂ => ?_ + have hv_clΛ : v ∈ closure Λ := by + have h1 : v ∈ subBd (closure Λ) := hbd_clΛ ▸ C₂.V_subset_U hv₂ + have h2 := h1.1 + rwa [closure_closure] at h2 + have hv_Λ₁ : v ∈ Λ₁ := hclΛ_sub_Λ₁ hv_clΛ + rw [← hdiffΛ₁] at hv_Λ₁ + exact hv_Λ₁.2 (C₁.V_subset_U hv₁) + -- Apply (7.7) (`theorem_7_7_proof`) to `Δ₁ = closure Λ₁` and `Δ₂ = closure Λ`. + obtain ⟨F, Δ, hFO, -, hFnorm, hΔdisc, hbdΔ, hΔ_sub_clΛ₁, hclΛ_sub_Δ⟩ := + theorem_7_7_proof hS hConn (by omega) hMetric hz + hZone₁.isClosedDisc_closure hZone.isClosedDisc_closure + (hZone.z_subset.trans (by rw [hdiffΛ])) + (hclΛ_sub_Λ₁.trans (by rw [hbd_clΛ₁, hdiffΛ₁])) + (fun x hx hx_sub => (hZone₁.dist_le x hx hx_sub).trans (by omega)) + (fun x hx hle => (hΛ_le3 x hx hle).trans (by rw [hdiffΛ])) + hC₁ hC₁H hbd_clΛ₁ hC₂ hC₂H hbd_clΛ hdisj_C₁_C₂ + hSeg hLoc hArr hComp + -- Show `C_out.U ⊆ univ \ Δ ⊆ closure (univ \ Δ)`. + have hCout_disj_Δ : C_out.U ⊆ univ \ Δ := by + intro y hy + refine ⟨mem_univ y, fun hyΔ => ?_⟩ + have hyΛ₂ : y ∈ Λ₂ := hclΛ₁_sub_Λ₂ (hΔ_sub_clΛ₁ hyΔ) + rw [← hdiffΛ₂] at hyΛ₂ + exact hyΛ₂.2 hy + have hCout_sub_cl : C_out.IsSubdrawing (H.interSet (closure (univ \ Δ))) := by + refine ⟨fun v hv => ?_, fun e he => ?_⟩ + · exact GM11.mem_interSet_V (hCoutH.1 hv) (subset_closure (hCout_disj_Δ (C_out.V_subset_U hv))) + · rw [GM11.mem_interSet_E_iff] + exact ⟨hCoutH.2 he, + (subset_closure.trans (C_out.closure_subset_U he)).trans + (hCout_disj_Δ.trans subset_closure)⟩ + have hCout_sub_cleared : C_out.IsSubdrawing (clearedSubdrawing H Δ) := by + refine ⟨fun v hv => ?_, fun e he => ?_⟩ + · exact GM11.mem_interSet_V (hCoutH.1 hv) (hCout_disj_Δ (C_out.V_subset_U hv)) + · rw [clearedSubdrawing, GM11.mem_interSet_E_iff] + exact ⟨hCoutH.2 he, + (subset_closure.trans (C_out.closure_subset_U he)).trans hCout_disj_Δ⟩ + refine ⟨F, Δ, C_out, hFO, hFnorm, hΔdisc, hbdΔ, hclΛ_sub_Δ, hCout, hCout_sub_cl, + hCout_sub_cleared, ?_⟩ + intro x hx hne + have hx_clΛ₁ : x ⊆ closure Λ₁ := + atom_subset_closure_of_inter_nonempty hS hC₁H hZone₁.isClosedDisc_closure hbd_clΛ₁ hdiffΛ₁ hx + (hne.mono (inter_subset_inter_right x hΔ_sub_clΛ₁)) + exact hZone₁.dist_le x hx hx_clΛ₁ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Section9b.lean b/LeanPool/GraphMinor/GM14/Section9b.lean new file mode 100644 index 0000000000..192ecb0883 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Section9b.lean @@ -0,0 +1,1873 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Battlefields +public import LeanPool.GraphMinor.GM16.Cited +public import LeanPool.GraphMinor.GM14.Cited +import LeanPool.GraphMinor.GM14.Section9a +import LeanPool.GraphMinor.GM14.Section7b +import LeanPool.GraphMinor.GM14.Section6c +import LeanPool.GraphMinor.GM14.Section5 +import LeanPool.GraphMinor.GM14.Section3b +import LeanPool.GraphMinor.GM09.PlanarNests +import LeanPool.GraphMinor.GM11.RadialFacts +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.Theorem63 +import LeanPool.GraphMinor.Thomas.Separator +import LeanPool.GraphMinor.Menger.Basic + +import LeanPool.GraphMinor.GM12.Section710 +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Graph Minors XIV, Section 9 (Part 2): Rigid Zones (9.3) and Battlefields (9.5) + +This file formalizes (9.3) and (9.5) of N. Robertson and P. D. Seymour, +*Graph Minors. XIV. Extending an embedding*, J. Combin. Theory Ser. B **65** (1995) 23–50 +(pages 44–47): + +- `enlarge_disc_past_disconnected_region`: if a circuit `C` of a rigid drawing `H` bounds an open + disc `Λ` with `closure Λ ⊆ Δ_out \ subBd Δ_out` (`subBd Δ_out ⊆ H.U`) and + `clearedSubdrawing H Λ` is not rigid, then by (6.3) and (5.2) there is a circuit `C'` of `H` + bounding a strictly larger open disc `Λ'` in `Δ_out \ subBd Δ_out` containing `Λ` and at least + one edge `e₀ ∈ C.E`. +- `theorem_9_3`: Graph Minors XIV, (9.3) (pages 44–45), proving `GM16.GM14Theorem93Statement`. +- `theorem_9_5`: Graph Minors XIV, (9.5) (pages 45–47), proving `GM16.GM14Theorem95Statement`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM09.PlanarNests + GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM16 GraphMinor.Thomas Hypergraph + +universe u w + +variable {S : Type w} [TopologicalSpace S] + +/-! ## 1. Enlarging a Disc Past a Disconnected Region -/ + +private theorem exists_edge_of_mem_walk_support {P : Drawing S} {a b : S} + (W : GraphWalk P.toGraph a b) (hpos : 0 < W.length) {v : S} (hv : v ∈ W.support) : + ∃ e ∈ W.edges, v ∈ closure e := by + induction W with + | nil _ => exact absurd hpos (Nat.lt_irrefl 0) + | @cons u₀ w₀ c e hl r ih => + rcases List.mem_cons.mp hv with rfl | hvr + · have : v ∈ closure e ∩ P.V := by rw [hl.2.2.2]; exact Or.inl rfl + exact ⟨e, List.mem_cons_self, this.1⟩ + · cases r with + | nil _ => + rcases List.mem_singleton.mp hvr with rfl + have : v ∈ closure e ∩ P.V := by rw [hl.2.2.2]; exact Or.inr rfl + exact ⟨e, List.mem_cons_self, this.1⟩ + | cons hl' r' => + obtain ⟨f, hf, hvf⟩ := ih (Nat.succ_pos _) hvr + exact ⟨f, List.mem_cons_of_mem _ hf, hvf⟩ + +private theorem disc_on_other_side_gives_larger_zone + {S : Type w} + [TopologicalSpace S] + [T2Space S] + [ConnectedSpace S] + (hS : IsClosedSurface S) + {H : Drawing S} + {C : Drawing S} + {Δ_out : Set S} + {Λ : Set S} + (hΔ_out : IsClosedDisc Δ_out) + (hC : C.IsCircuit) + (hCs : C.IsSubdrawing H) + (hΛ_open : IsOpenDisc Λ) + (hΛ_cl : IsClosedDisc (closure Λ)) + (hbd_cl : subBd (closure Λ) = C.U) + (hdiff : closure Λ \ C.U = Λ) + (hcl_sub : closure Λ ⊆ Δ_out \ subBd Δ_out) + (r : Set S) + (v₁ : S) + (v₂ : S) + (F₂ : Set S) + (P₂ : Drawing S) + (hr : r ∈ H.R) + (hdis_rΛ : Disjoint r Λ) + (hv12 : v₁ ≠ v₂) + (hv₁C : v₁ ∈ C.V) + (hv₂C : v₂ ∈ C.V) + (hF₂_r : F₂ \ {v₁, v₂} ⊆ r) + (hCU_sub_cl : C.U ⊆ closure Λ) + (hCU_sub_int : C.U ⊆ Δ_out \ subBd Δ_out) + (hfr_out : frontier Δ_out = subBd Δ_out) + (hF₂_sub_int : F₂ ⊆ Δ_out \ subBd Δ_out) + (hI_2F : P₂.U ∩ F₂ = {v₁, v₂}) : + ∀ (P P' : Drawing S) (D_big : Set S), P.IsSubdrawing C → P'.IsSubdrawing C → P.IsPathBetween + v₁ v₂ → Disjoint P.E P'.E → C.U = P.U ∪ P'.U → ¬P.U ⊆ closure r → D_big ⊆ Δ_out → + IsClosedDisc D_big → discBd D_big = F₂ ∪ P'.U → P.U ⊆ D_big → ∃ (C' : Drawing S) (Λ' : Set S), + C'.IsSubdrawing H ∧ + C'.IsCircuit ∧ C'.U ⊆ Δ_out \ subBd Δ_out ∧ IsOpenDisc Λ' ∧ closure Λ' ⊆ Δ_out \ subBd Δ_out + ∧ IsClosedDisc (closure Λ') ∧ subBd Λ' = C'.U ∧ subBd (closure Λ') = C'.U ∧ closure Λ' \ + C'.U = Λ' ∧ Λ ⊆ Λ' ∧ closure Λ ⊆ closure Λ' ∧ {e | e ∈ H.E ∧ e ⊆ Λ}.ncard < {e | e ∈ H.E ∧ e + ⊆ Λ'}.ncard := by + intro P P' D_big hPC hP'C hP_path hPE_dis hCU_PP' hnot_P_r hD_sub hD_disc hD_bd hPU_D + have hPH : P.IsSubdrawing H := hPC.trans hCs + have hP'H : P'.IsSubdrawing H := hP'C.trans hCs + have hD_cl : IsClosed D_big := hD_disc.isCompact.isClosed + have hD_fr : frontier D_big = F₂ ∪ P'.U := + (IsClosedDisc.frontier_eq_discBd hS hD_disc).trans hD_bd + have hD_subBd : subBd D_big = F₂ ∪ P'.U := by + rw [subBd_eq_frontier, hD_fr] + have hfr_in_D : F₂ ∪ P'.U ⊆ D_big := hD_fr ▸ hD_cl.frontier_subset + have hCU_in_D : C.U ⊆ D_big := + hCU_PP' ▸ union_subset hPU_D (subset_union_right.trans hfr_in_D) + -- Show `closure Λ ⊆ D_big`. + have hclΛ_in_D : closure Λ ⊆ D_big := by + obtain ⟨D₀, ⟨hD₀_sub, hD₀_disc, hD₀_bd, -⟩, _⟩ := + disc_oArc D_big C.U hD_disc hCU_in_D (isOArc_of_isCircuit hC) + obtain ⟨_, huniq_out⟩ := discIns_spec hΔ_out hC (hCU_sub_int.trans sdiff_subset) + have h1 : D₀ = discIns Δ_out C := huniq_out D₀ (hD₀_sub.trans hD_sub) hD₀_disc hD₀_bd + have h2 : closure Λ = discIns Δ_out C := + huniq_out (closure Λ) (hcl_sub.trans sdiff_subset) hΛ_cl + ((IsClosedDisc.subBd_eq_discBd hS hΛ_cl).symm.trans hbd_cl) + exact (h2.trans h1.symm) ▸ hD₀_sub + -- Show `D_big ⊆ Δ_out \ subBd Δ_out`. + have hD_sub_int : D_big ⊆ Δ_out \ subBd Δ_out := by + intro x hxD + refine ⟨hD_sub hxD, fun hxbd => ?_⟩ + have hx_fr_out : x ∈ frontier Δ_out := hfr_out.symm ▸ hxbd + have hx_fr_D : x ∈ frontier D_big := + ⟨subset_closure hxD, fun hxi => hx_fr_out.2 (interior_mono hD_sub hxi)⟩ + rw [hD_fr] at hx_fr_D + rcases hx_fr_D with hxF₂ | hxP' + · exact (hF₂_sub_int hxF₂).2 hxbd + · exact (hCU_sub_int (hP'C.U_subset hxP')).2 hxbd + -- Find an edge `e₀ ∈ P.E` with `¬ e₀ ⊆ closure r`. + have hex_e₀ : ∃ e₀ ∈ P.E, ¬ e₀ ⊆ closure r := by + by_contra hno_e₀ + push Not at hno_e₀ + apply hnot_P_r + obtain ⟨W, _, hPV, hPE⟩ := hP_path + have hW_pos : 0 < W.length := by + cases W with + | nil _ => exact absurd rfl hv12 + | cons _ _ => exact Nat.succ_pos _ + rw [P.U_eq] + refine union_subset ?_ (iUnion₂_subset fun e he => + isClosed_closure.closure_subset_iff.mpr (hno_e₀ e he)) + intro v hv + rw [hPV, mem_ofPred_eq] at hv + obtain ⟨e, he, hve⟩ := exists_edge_of_mem_walk_support W hW_pos hv + have heP : e ∈ P.E := by rw [hPE]; exact he + exact isClosed_closure.closure_subset_iff.mpr (hno_e₀ e heP) hve + obtain ⟨e₀, he₀P, hnot_e₀_r⟩ := hex_e₀ + have he₀C : e₀ ∈ C.E := hPC.2 he₀P + have he₀H : e₀ ∈ H.E := hCs.2 he₀C + have hdis_cl_r_e₀ : Disjoint (closure r) e₀ := by + rw [disjoint_iff_inter_eq_empty, ← not_nonempty_iff_eq_empty] + rintro ⟨p, hpr, hpe₀⟩ + exact hnot_e₀_r (edge_subset_closure_of_incident hS he₀H hr ⟨p, hpe₀, hpr⟩) + have hdis_cl_r_Λ : Disjoint (closure r) Λ := + Disjoint.closure_left hdis_rΛ hΛ_open.1 + have he₀_sub_CU : e₀ ⊆ C.U := fun x hx => (he₀C.2.1 hx).1 + have he₀_dis_bdD : Disjoint e₀ (subBd D_big) := by + rw [hD_subBd] + refine disjoint_union_right.mpr ⟨?_, ?_⟩ + · refine disjoint_left.mpr fun x hxe₀ hxF₂ => ?_ + by_cases hx12 : x ∈ ({v₁, v₂} : Set S) + · rcases hx12 with rfl | rfl + · exact (he₀H.2.1 hxe₀).2 (hCs.1 hv₁C) + · exact (he₀H.2.1 hxe₀).2 (hCs.1 hv₂C) + · exact region_subset hr (hF₂_r ⟨hxF₂, hx12⟩) (he₀H.2.1 hxe₀).1 + · refine disjoint_left.mpr fun x hxe₀ hxP' => ?_ + have hxV : x ∉ P'.V := fun hxV => (he₀H.2.1 hxe₀).2 (hP'H.1 hxV) + obtain ⟨f, hfP', hxf⟩ := P'.exists_edge_of_mem hxP' hxV + have heq : e₀ = f := H.edge_eq_of_mem he₀H (hP'H.2 hfP') hxe₀ hxf + exact disjoint_left.mp hPE_dis he₀P (heq ▸ hfP') + have hΛ_dis_bdD : Disjoint Λ (subBd D_big) := by + rw [hD_subBd] + refine disjoint_union_right.mpr ⟨?_, ?_⟩ + · refine disjoint_left.mpr fun x hxΛ hxF₂ => ?_ + have hx_not_CU : x ∉ C.U := fun hxC => (hdiff ▸ hxΛ).2 hxC + have hx12 : x ∉ ({v₁, v₂} : Set S) := by + rintro (rfl | rfl) + · exact hx_not_CU (C.V_subset_U hv₁C) + · exact hx_not_CU (C.V_subset_U hv₂C) + exact disjoint_left.mp hdis_rΛ (hF₂_r ⟨hxF₂, hx12⟩) hxΛ + · refine disjoint_left.mpr fun x hxΛ hxP' => ?_ + exact (hdiff ▸ hxΛ).2 (hP'C.U_subset hxP') + -- Define `Z = Λ ∪ e₀`. + set Z := Λ ∪ e₀ + have hΛ_sub_D_int : Λ ⊆ D_big \ subBd D_big := + fun x hx => ⟨hclΛ_in_D (subset_closure hx), disjoint_left.mp hΛ_dis_bdD hx⟩ + have he₀_sub_D_int : e₀ ⊆ D_big \ subBd D_big := + fun x hx => ⟨hCU_in_D (he₀_sub_CU hx), disjoint_left.mp he₀_dis_bdD hx⟩ + have hZ_sub_D_int : Z ⊆ D_big \ subBd D_big := union_subset hΛ_sub_D_int he₀_sub_D_int + obtain ⟨q₀, hq₀⟩ := he₀H.1 + have hZne : Z.Nonempty := ⟨q₀, Or.inr hq₀⟩ + have hZconn : IsPreconnected Z := + hΛ_open.isPathConnected.isConnected.isPreconnected.subset_closure + subset_union_left (union_subset subset_closure (he₀_sub_CU.trans hCU_sub_cl)) + have hdis_cl_r_Z : Disjoint (closure r) Z := + disjoint_union_right.mpr ⟨hdis_cl_r_Λ, hdis_cl_r_e₀⟩ + have hint_D_eq : D_big \ subBd D_big = interior D_big := by + rw [subBd_eq_frontier] + exact self_sdiff_frontier _ + have hreg_sub : ∀ s ∈ H.R, (closure s ∩ Z).Nonempty → s ⊆ D_big \ subBd D_big := by + rintro s hs ⟨p, hps, hpZ⟩ + have hsr : s ≠ r := fun heq => disjoint_left.mp hdis_cl_r_Z (heq ▸ hps) hpZ + have hdis_sr : Disjoint s r := + disjoint_left.mpr fun x hxs hxr => hsr (region_eq_of_mem hs hr hxs hxr) + have hdis_s_fr : Disjoint s (frontier D_big) := by + rw [hD_fr] + refine disjoint_union_right.mpr ⟨?_, ?_⟩ + · refine disjoint_left.mpr fun x hxs hxF₂ => ?_ + by_cases hx12 : x ∈ ({v₁, v₂} : Set S) + · rcases hx12 with rfl | rfl + · exact region_subset hs hxs (H.V_subset_U (hCs.1 hv₁C)) + · exact region_subset hs hxs (H.V_subset_U (hCs.1 hv₂C)) + · exact disjoint_left.mp hdis_sr hxs (hF₂_r ⟨hxF₂, hx12⟩) + · exact disjoint_left.mpr fun x hxs hxP' => + region_subset hs hxs (hP'H.U_subset hxP') + have hp_int : p ∈ interior D_big := hint_D_eq ▸ hZ_sub_D_int hpZ + obtain ⟨y, hy_int, hys⟩ := mem_closure_iff.mp hps (interior D_big) isOpen_interior hp_int + have hs_D : s ⊆ D_big := + subset_of_disjoint_frontier (region_isPreconnected hs) hD_cl hdis_s_fr hys + (interior_subset hy_int) + exact fun x hxs => ⟨hs_D hxs, disjoint_left.mp (subBd_eq_frontier D_big ▸ hdis_s_fr) hxs⟩ + obtain ⟨C', Λ', hC'H, hC', hC'U_D, hOpenΛ', hclΛ'_D, hclΛ'_disc, hbdΛ', hbd_clΛ', + hdiffΛ', hZΛ', -⟩ := + theorem_5_2_full hS H hD_disc hZne hZconn hreg_sub + have hΛ_sub_Λ' : Λ ⊆ Λ' := subset_union_left.trans hZΛ' + have he₀_sub_Λ' : e₀ ⊆ Λ' := subset_union_right.trans hZΛ' + have hcl_sub_cl' : closure Λ ⊆ closure Λ' := closure_mono hΛ_sub_Λ' + have hC'U_int : C'.U ⊆ Δ_out \ subBd Δ_out := hC'U_D.trans hD_sub_int + have hclΛ'_int : closure Λ' ⊆ Δ_out \ subBd Δ_out := hclΛ'_D.trans hD_sub_int + have he₀_not_Λ : ¬ e₀ ⊆ Λ := by + intro hsub + exact (hdiff ▸ hsub hq₀).2 (he₀_sub_CU hq₀) + have hlt_ncard : {e ∈ H.E | e ⊆ Λ}.ncard < {e ∈ H.E | e ⊆ Λ'}.ncard := by + refine Set.ncard_lt_ncard ⟨fun e he => ⟨he.1, he.2.trans hΛ_sub_Λ'⟩, ?_⟩ + (H.finite_edges.subset fun _ h => h.1) + intro hsub + exact he₀_not_Λ (hsub ⟨he₀H, he₀_sub_Λ'⟩).2 + exact ⟨C', Λ', hC'H, hC', hC'U_int, hOpenΛ', hclΛ'_int, hclΛ'_disc, hbdΛ', hbd_clΛ', + hdiffΛ', hΛ_sub_Λ', hcl_sub_cl', hlt_ncard⟩ + +/-- If `C` is a circuit of a rigid drawing `H` bounding an open disc `Λ` with +`closure Λ ⊆ Δ_out \ subBd Δ_out` in a closed disc `Δ_out` (`subBd Δ_out ⊆ H.U`), and +`clearedSubdrawing H Λ` is not rigid, then there is a circuit `C'` of `H` bounding an open disc +`Λ'` with `closure Λ' ⊆ Δ_out \ subBd Δ_out`, `Λ ⊆ Λ'`, `closure Λ ⊆ closure Λ'`, and strictly +more edges of `H` included in `Λ'`. -/ +theorem enlarge_disc_past_disconnected_region [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {H C : Drawing S} {Δ_out Λ : Set S} + (hRig : IsRigid H) (hΔ_out : IsClosedDisc Δ_out) (hbd_out_U : subBd Δ_out ⊆ H.U) + (hC : C.IsCircuit) (hCs : C.IsSubdrawing H) + (hΛ_open : IsOpenDisc Λ) (hΛ_cl : IsClosedDisc (closure Λ)) + (hbd : subBd Λ = C.U) (hbd_cl : subBd (closure Λ) = C.U) (hdiff : closure Λ \ C.U = Λ) + (hcl_sub : closure Λ ⊆ Δ_out \ subBd Δ_out) + (hnot_rig : ¬ IsRigid (clearedSubdrawing H Λ)) : + ∃ (C' : Drawing S) (Λ' : Set S), + C'.IsSubdrawing H ∧ C'.IsCircuit ∧ C'.U ⊆ Δ_out \ subBd Δ_out ∧ + IsOpenDisc Λ' ∧ closure Λ' ⊆ Δ_out \ subBd Δ_out ∧ IsClosedDisc (closure Λ') ∧ + subBd Λ' = C'.U ∧ subBd (closure Λ') = C'.U ∧ closure Λ' \ C'.U = Λ' ∧ + Λ ⊆ Λ' ∧ closure Λ ⊆ closure Λ' ∧ + {e ∈ H.E | e ⊆ Λ}.ncard < {e ∈ H.E | e ⊆ Λ'}.ncard := by + have : CompactSpace S := hS.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hex : ∃ (r : Set S) (v₁ v₂ : S) (F₂ : Set S) (P₁ P₂ : Drawing S), + r ∈ H.R ∧ Disjoint r Λ ∧ v₁ ≠ v₂ ∧ v₁ ∈ C.V ∧ v₂ ∈ C.V ∧ + IsLineWithEnds F₂ v₁ v₂ ∧ F₂ \ {v₁, v₂} ⊆ r ∧ + P₁.IsPathBetween v₁ v₂ ∧ P₂.IsPathBetween v₁ v₂ ∧ + P₁.IsSubdrawing C ∧ P₂.IsSubdrawing C ∧ + P₁.V ∩ P₂.V = {v₁, v₂} ∧ Disjoint P₁.E P₂.E ∧ C.sup P₁ P₂ = C ∧ + ¬ (P₁.U ⊆ closure r ∨ P₂.U ⊆ closure r) := by + by_contra hno + push Not at hno + exact hnot_rig (isRigid_clearedSubdrawing_of_arc_subset hS hRig hΛ_open hΛ_cl hC hCs hbd hno) + obtain ⟨r, v₁, v₂, F₂, P₁, P₂, hr, hdis_rΛ, hv12, hv₁C, hv₂C, hF₂_line, hF₂_r, + hP₁, hP₂, hP₁C, hP₂C, hV12, hE12, hsup12, hnot_or⟩ := hex + rw [not_or] at hnot_or + obtain ⟨hnot_P₁_r, hnot_P₂_r⟩ := hnot_or + have hP₁H : P₁.IsSubdrawing H := hP₁C.trans hCs + have hP₂H : P₂.IsSubdrawing H := hP₂C.trans hCs + have hCU_eq : C.U = P₁.U ∪ P₂.U := by + have := congrArg Drawing.U hsup12.symm + rwa [PlanarNests.Drawing.sup_U hP₁C hP₂C] at this + have hCU_sub_cl : C.U ⊆ closure Λ := by + rw [← hbd_cl, subBd_eq_frontier] + exact isClosed_closure.frontier_subset + have hCU_sub_int : C.U ⊆ Δ_out \ subBd Δ_out := hCU_sub_cl.trans hcl_sub + -- Show `r ⊆ Δ_out \ subBd Δ_out` and `F₂ ⊆ Δ_out \ subBd Δ_out`. + have hΔ_cl : IsClosed Δ_out := hΔ_out.isCompact.isClosed + have hfr_out : frontier Δ_out = subBd Δ_out := (subBd_eq_frontier Δ_out).symm + have hint_out_eq : Δ_out \ subBd Δ_out = interior Δ_out := by + rw [← hfr_out] + exact self_sdiff_frontier _ + obtain ⟨hv₁F₂, hv₂F₂⟩ := IsLineWithEnds.ends_mem hF₂_line + have hv₁_cl_r : v₁ ∈ closure r := + closure_mono hF₂_r (IsLineWithEnds.subset_closure_sdiff_pair hF₂_line hv₁F₂) + have hv₁_int : v₁ ∈ interior Δ_out := + hint_out_eq ▸ hCU_sub_int (C.V_subset_U hv₁C) + obtain ⟨q_r, hq_int, hq_r⟩ := mem_closure_iff.mp hv₁_cl_r (interior Δ_out) isOpen_interior hv₁_int + have hdis_r_fr_out : Disjoint r (frontier Δ_out) := by + rw [hfr_out] + exact disjoint_left.mpr fun x hxr hxbd => region_subset hr hxr (hbd_out_U hxbd) + have hr_sub_Δ : r ⊆ Δ_out := + subset_of_disjoint_frontier (region_isPreconnected hr) hΔ_cl hdis_r_fr_out hq_r + (interior_subset hq_int) + have hr_sub_int : r ⊆ Δ_out \ subBd Δ_out := + fun x hxr => ⟨hr_sub_Δ hxr, disjoint_left.mp (hfr_out ▸ hdis_r_fr_out) hxr⟩ + have hF₂_sub_int : F₂ ⊆ Δ_out \ subBd Δ_out := by + intro x hx + by_cases hx12 : x ∈ ({v₁, v₂} : Set S) + · rcases hx12 with rfl | rfl + · exact hCU_sub_int (C.V_subset_U hv₁C) + · exact hCU_sub_int (C.V_subset_U hv₂C) + · exact hr_sub_int (hF₂_r ⟨hx, hx12⟩) + -- The three lines `F₂`, `P₁.U`, `P₂.U` between `v₁` and `v₂`. + have hL₁ : IsLineWithEnds P₁.U v₁ v₂ := isLine_of_isPathBetween hP₁ hv12 + have hL₂ : IsLineWithEnds P₂.U v₁ v₂ := isLine_of_isPathBetween hP₂ hv12 + have hI_12 : P₁.U ∩ P₂.U = {v₁, v₂} := by + rw [U_inter_of_disjoint hP₁H hP₂H hE12, hV12] + have hI_F1 : F₂ ∩ P₁.U = {v₁, v₂} := by + apply subset_antisymm + · rintro x ⟨hxF, hxP⟩ + by_contra hx12 + exact region_subset hr (hF₂_r ⟨hxF, hx12⟩) (hP₁H.U_subset hxP) + · rintro x (rfl | rfl) + · exact ⟨hv₁F₂, (IsLineWithEnds.ends_mem hL₁).1⟩ + · exact ⟨hv₂F₂, (IsLineWithEnds.ends_mem hL₁).2⟩ + have hI_2F : P₂.U ∩ F₂ = {v₁, v₂} := by + apply subset_antisymm + · rintro x ⟨hxP, hxF⟩ + by_contra hx12 + exact region_subset hr (hF₂_r ⟨hxF, hx12⟩) (hP₂H.U_subset hxP) + · rintro x (rfl | rfl) + · exact ⟨(IsLineWithEnds.ends_mem hL₂).1, hv₁F₂⟩ + · exact ⟨(IsLineWithEnds.ends_mem hL₂).2, hv₂F₂⟩ + have hO_c₂ : IsOArc (F₂ ∪ P₂.U) := + isOArc_union hF₂_line hL₂ (by rw [Set.inter_comm, hI_2F]) + have hO_c₁ : IsOArc (F₂ ∪ P₁.U) := + isOArc_union hF₂_line hL₁ hI_F1.subset + have hU_c₂_out : F₂ ∪ P₂.U ⊆ Δ_out := + union_subset (hF₂_sub_int.trans sdiff_subset) + ((hP₂C.U_subset.trans hCU_sub_int).trans sdiff_subset) + have hU_c₁_out : F₂ ∪ P₁.U ⊆ Δ_out := + union_subset (hF₂_sub_int.trans sdiff_subset) + ((hP₁C.U_subset.trans hCU_sub_int).trans sdiff_subset) + obtain ⟨D_c₂, ⟨sub_c₂, d_c₂, b_c₂, -⟩, _⟩ := disc_oArc Δ_out (F₂ ∪ P₂.U) hΔ_out hU_c₂_out hO_c₂ + obtain ⟨D_c₁, ⟨sub_c₁, d_c₁, b_c₁, -⟩, uniq_c₁⟩ := + disc_oArc Δ_out (F₂ ∪ P₁.U) hΔ_out hU_c₁_out hO_c₁ + have f_c₂ : frontier D_c₂ = P₂.U ∪ F₂ := by + rw [IsClosedDisc.frontier_eq_discBd hS d_c₂, b_c₂, Set.union_comm] + have f_c₁ : frontier D_c₁ = F₂ ∪ P₁.U := by + rw [IsClosedDisc.frontier_eq_discBd hS d_c₁, b_c₁] + have f_Λ : frontier (closure Λ) = P₁.U ∪ P₂.U := by + rw [← subBd_eq_frontier, hbd_cl, hCU_eq] + have hnot_F₂_in : ¬ F₂ ⊆ closure Λ := by + intro hsub + obtain ⟨p, hp⟩ := IsLineWithEnds.nonempty_sdiff_pair hF₂_line + have hpr : p ∈ r := hF₂_r hp + have hp_cl : p ∈ closure Λ := hsub hp.1 + rw [← hdiff] at hdis_rΛ + by_cases hpC : p ∈ C.U + · exact region_subset hr hpr (hCs.U_subset hpC) + · exact disjoint_left.mp hdis_rΛ hpr ⟨hp_cl, hpC⟩ + -- Symmetric helper once we know `P.U ⊆ D_big` for `(P, P', D_big) ∈ {(P₁, P₂, D_c₂), (P₂, P₁, + -- D_c₁)}`. + have henlarge : ∀ (P P' : Drawing S) (D_big : Set S), + P.IsSubdrawing C → P'.IsSubdrawing C → + P.IsPathBetween v₁ v₂ → Disjoint P.E P'.E → + C.U = P.U ∪ P'.U → ¬ P.U ⊆ closure r → + D_big ⊆ Δ_out → IsClosedDisc D_big → discBd D_big = F₂ ∪ P'.U → + P.U ⊆ D_big → + ∃ (C' : Drawing S) (Λ' : Set S), + C'.IsSubdrawing H ∧ C'.IsCircuit ∧ C'.U ⊆ Δ_out \ subBd Δ_out ∧ + IsOpenDisc Λ' ∧ closure Λ' ⊆ Δ_out \ subBd Δ_out ∧ IsClosedDisc (closure Λ') ∧ + subBd Λ' = C'.U ∧ subBd (closure Λ') = C'.U ∧ closure Λ' \ C'.U = Λ' ∧ + Λ ⊆ Λ' ∧ closure Λ ⊆ closure Λ' ∧ + {e ∈ H.E | e ⊆ Λ}.ncard < {e ∈ H.E | e ⊆ Λ'}.ncard := by + exact disc_on_other_side_gives_larger_zone (S := S) hS (H := H) (C := C) (Δ_out := Δ_out) (Λ + := Λ) hΔ_out hC hCs hΛ_open hΛ_cl hbd_cl hdiff hcl_sub r v₁ v₂ F₂ P₂ hr hdis_rΛ hv12 hv₁C + hv₂C hF₂_r hCU_sub_cl hCU_sub_int hfr_out hF₂_sub_int hI_2F + by_cases h₁ : P₁.U ⊆ D_c₂ + · exact henlarge P₁ P₂ D_c₂ hP₁C hP₂C hP₁ hE12 hCU_eq hnot_P₁_r sub_c₂ d_c₂ b_c₂ h₁ + by_cases h₂ : P₂.U ⊆ D_c₁ + · exact henlarge P₂ P₁ D_c₁ hP₂C hP₁C hP₂ hE12.symm (by rw [hCU_eq, Set.union_comm]) + hnot_P₂_r sub_c₁ d_c₁ b_c₁ h₂ + exfalso + obtain ⟨dU, hbdU, hneU⟩ := + theta_disc_union hS hF₂_line hL₁ hL₂ hI_F1 hI_12 hI_2F + hΛ_cl d_c₂ d_c₁ f_Λ f_c₂ f_c₁ hnot_F₂_in h₁ h₂ + have heq := uniq_c₁ _ (union_subset (hcl_sub.trans sdiff_subset) sub_c₂) dU (hbdU.trans b_c₁) + exact hneU heq + +/-! ## 2. Proof of (9.3) (pages 44–45) -/ + +/-- Graph Minors XIV, (9.3) (page 44), proving `GM16.GM14Theorem93Statement`: +"Let $H$ be a 2-cell rigid drawing in $\Sigma$, and let $\mathscr{T}$ be a respectful tangle +in $H$ of order $\theta$, with metric $d$. Let $z \in A(H)$, and let $\kappa$ be an integer +with $2 \le \kappa \le \theta - 6$. Then there is a $(\kappa + 5)$-zone $\Lambda$ around $z$ +such that $H \cap (\Sigma - \Lambda)$ is rigid and $x \subseteq \Lambda$ for every $x \in +A(H)$ with $d(z, x) < \kappa$." -/ +theorem theorem_9_3_proof : GM16.GM14Theorem93Statement.{w} := by + intro S _ _ H θ κ T d z hS hConn hRig hMetric hz hκ2 hκθ + have : ConnectedSpace S := hConn + obtain ⟨C₁, Λ₁, hC₁H, hC₁, hbd₁, hbd_cl₁, hdiff₁, hZone₁, hsub₁⟩ := + full_of_9_2 hS hConn H θ κ T d z hMetric hz hκ2 (by omega) + obtain ⟨C₂, Λ₂, hC₂H, hC₂, hbd₂, hbd_cl₂, hdiff₂, hZone₂, hsub₂⟩ := + full_of_9_2 hS hConn H θ (κ + 3) T d z hMetric hz (by omega) (by omega) + have hcl₁_sub_Λ₂ : closure Λ₁ ⊆ Λ₂ := + closure_zone_subset hS hZone₁ fun x hx hle => hsub₂ x hx (by omega) + have hcl₁_sub_int₂ : closure Λ₁ ⊆ closure Λ₂ \ subBd (closure Λ₂) := by + rw [hbd_cl₂, hdiff₂] + exact hcl₁_sub_Λ₂ + let Valid : Drawing S → Set S → Prop := fun C Λ => + C.IsSubdrawing H ∧ C.IsCircuit ∧ + IsOpenDisc Λ ∧ IsClosedDisc (closure Λ) ∧ + subBd Λ = C.U ∧ subBd (closure Λ) = C.U ∧ closure Λ \ C.U = Λ ∧ + closure Λ ⊆ closure Λ₂ \ subBd (closure Λ₂) ∧ Λ₁ ⊆ Λ + have hValid₁ : Valid C₁ Λ₁ := + ⟨hC₁H, hC₁, hZone₁.isOpenDisc, hZone₁.isClosedDisc_closure, + hbd₁, hbd_cl₁, hdiff₁, hcl₁_sub_int₂, Subset.rfl⟩ + let S_k : Set ℕ := {k | ∃ C Λ, Valid C Λ ∧ H.E.ncard - {e ∈ H.E | e ⊆ Λ}.ncard = k} + have hS_ne : S_k.Nonempty := ⟨_, C₁, Λ₁, hValid₁, rfl⟩ + obtain ⟨C, Λ, hV, hk_eq⟩ := Nat.sInf_mem hS_ne + obtain ⟨hCH, hC, hΛ_open, hΛ_cl, hbd, hbd_cl, hdiff, hcl_sub, hΛ₁_sub⟩ := hV + have hZone₂_eq : closure Λ₂ \ subBd (closure Λ₂) = Λ₂ := by rw [hbd_cl₂, hdiff₂] + have hZone : IsLambdaZoneAround H d (κ + 5) z Λ := by + have h := zone_of_closedDisc_subset hS (hZone₂_eq.symm ▸ hZone₂) + hZone₂.isClosedDisc_closure hΛ_cl (hcl_sub.trans sdiff_subset) hC hCH hbd_cl + (by rw [hbd_cl, hdiff]; exact hZone₁.z_subset.trans hΛ₁_sub) + rwa [hbd_cl, hdiff] at h + refine ⟨Λ, hZone, ?_, fun x hx hlt => (hsub₁ x hx hlt).trans hΛ₁_sub⟩ + by_contra hnot_rig + obtain ⟨C', Λ', hC'H, hC', _, hOpenΛ', hclΛ'_sub, hclΛ'_disc, hbdΛ', hbd_clΛ', + hdiffΛ', hΛ_sub_Λ', _, hlt_ncard⟩ := + enlarge_disc_past_disconnected_region hS hRig hZone₂.isClosedDisc_closure + (hbd_cl₂ ▸ hC₂H.U_subset) hC hCH hΛ_open hΛ_cl hbd hbd_cl hdiff hcl_sub hnot_rig + have hV' : Valid C' Λ' := + ⟨hC'H, hC', hOpenΛ', hclΛ'_disc, hbdΛ', hbd_clΛ', hdiffΛ', hclΛ'_sub, + hΛ₁_sub.trans hΛ_sub_Λ'⟩ + have hle_H : {e ∈ H.E | e ⊆ Λ'}.ncard ≤ H.E.ncard := + Set.ncard_le_ncard (fun _ h => h.1) H.finite_edges + have hmin : sInf S_k ≤ H.E.ncard - {e ∈ H.E | e ⊆ Λ'}.ncard := + Nat.sInf_le ⟨C', Λ', hV', rfl⟩ + omega + +/-! ## 3. Regional Distance along a Nest and Claim (1) of (9.5) -/ + +/-- If `D ⊆ S` is closed, `frontier D ⊆ H.U`, `X ⊆ D \ frontier D` is nonempty, `Y` is nonempty, +and `Disjoint (D \ frontier D) Y`, then `regionalDistance H D Y + 1 ≤ regionalDistance H X Y`. -/ +private theorem regionalDistance_add_one_le [ConnectedSpace S] (hS : IsClosedSurface S) + {H : Drawing S} {X D Y : Set S} + (hD : IsClosed D) (hfr : frontier D ⊆ H.U) + (hX : X ⊆ D \ frontier D) (hXne : X.Nonempty) (hYne : Y.Nonempty) + (hdis : Disjoint (D \ frontier D) Y) : + regionalDistance H D Y + 1 ≤ regionalDistance H X Y := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hspec := regionalDistance_spec hS H hXne hYne + generalize hk : regionalDistance H X Y = k at hspec ⊢ + obtain ⟨v_seq, r_seq, hv0, hvlast, hsteps⟩ := hspec + rcases k with _ | m + · exfalso + have h0 : Fin.last 0 = (0 : Fin 1) := rfl + rw [h0] at hvlast + exact disjoint_left.mp hdis (hX hv0) hvlast + · have hint_eq : D \ frontier D = interior D := by + exact self_sdiff_frontier _ + have hv0_int : v_seq 0 ∈ interior D := hint_eq ▸ hX hv0 + have hr0_R : r_seq 0 ∈ H.R := (hsteps 0).1 + have hv0_r0 : v_seq 0 ∈ closure (r_seq 0) := (hsteps 0).2.1 + have hv1_r0 : v_seq 1 ∈ closure (r_seq 0) := (hsteps 0).2.2 + obtain ⟨q, hq_int, hq_r0⟩ := mem_closure_iff.mp hv0_r0 (interior D) isOpen_interior hv0_int + have hdis_r0_fr : Disjoint (r_seq 0) (frontier D) := + disjoint_left.mpr fun x hxr hxfr => region_subset hr0_R hxr (hfr hxfr) + have hr0_D : r_seq 0 ⊆ D := + subset_of_disjoint_frontier (region_isPreconnected hr0_R) hD hdis_r0_fr hq_r0 + (interior_subset hq_int) + have hv1_D : v_seq 1 ∈ D := hD.closure_subset_iff.mpr hr0_D hv1_r0 + have hchain' : IsRegionChain H D Y (fun i : Fin (m + 1) => v_seq i.succ) + (fun i : Fin m => r_seq i.succ) := by + refine ⟨hv1_D, ?_, fun i => hsteps i.succ⟩ + simpa [Fin.last] using hvlast + have hle := regionalDistance_le hchain' + omega + +/-- In a disc nest `C : Fin s → Drawing S` (`0 < s`), for every `h : Fin s`, the regional distance +between `(C 0).U` and `(C h).U` is at least `h.1`. -/ +private theorem nest_regionalDistance_ge [T2Space S] [ConnectedSpace S] (hS : IsClosedSurface S) + {s : ℕ} {H C_in C_out : Drawing S} {Δ_out : Set S} {C : Fin s → Drawing S} + (hs : 0 < s) (hΔ_out : IsClosedDisc Δ_out) (hC : IsDiscNest H Δ_out C_in C_out C) + (h : Fin s) : + h.1 ≤ regionalDistance H (C ⟨0, hs⟩).U (C h).U := by + have hYne : (C h).U.Nonempty := IsOArc.nonempty (isOArc_of_isCircuit (hC.1 h).2.1) + have hstep : ∀ k : ℕ, (hk : k ≤ h.1) → + k ≤ regionalDistance H (discIns Δ_out (C ⟨h.1 - k, by omega⟩)) (C h).U := by + intro k + induction k with + | zero => intro _; exact Nat.zero_le _ + | succ k ih => + intro hk + let j₀ : Fin s := ⟨h.1 - (k + 1), by omega⟩ + let j₁ : Fin s := ⟨h.1 - k, by omega⟩ + have hj₀₁ : j₀ < j₁ := by change h.1 - (k + 1) < h.1 - k; omega + have hp₀ := hC.disc_props hS hΔ_out j₀ + have hp₁ := hC.disc_props hS hΔ_out j₁ + have hsub_diff : discIns Δ_out (C j₀) ⊆ discIns Δ_out (C j₁) \ frontier (discIns Δ_out + (C j₁)) := by + rw [hp₁.2.2.2.1] + exact (hC.discIns_subset_diff hS hΔ_out hj₀₁).2 + have hdis_Y : Disjoint (discIns Δ_out (C j₁) \ frontier (discIns Δ_out (C j₁))) (C h).U := by + rw [hp₁.2.2.2.1] + by_cases hj₁h : j₁ = h + · rw [hj₁h] + exact disjoint_sdiff_left + · have hj₁_ne : h.1 - k ≠ h.1 := fun heq => hj₁h (Fin.ext heq) + have hj₁_lt_h : j₁ < h := by change h.1 - k < h.1; omega + exact disjoint_of_subset_left sdiff_subset (hC.discIns_subset_diff hS hΔ_out hj₁_lt_h).1 + have hXne : (discIns Δ_out (C j₀)).Nonempty := IsClosedDisc.nonempty hp₀.2.1 + have hfr_U : frontier (discIns Δ_out (C j₁)) ⊆ H.U := + hp₁.2.2.2.1 ▸ (hC.1 j₁).1.U_subset + have hadd : regionalDistance H (discIns Δ_out (C j₁)) (C h).U + 1 ≤ + regionalDistance H (discIns Δ_out (C j₀)) (C h).U := + regionalDistance_add_one_le hS hp₁.2.2.2.2.1 hfr_U hsub_diff hXne hYne hdis_Y + have hih : k ≤ regionalDistance H (discIns Δ_out (C j₁)) (C h).U := ih (by omega) + change k + 1 ≤ regionalDistance H (discIns Δ_out (C j₀)) (C h).U + omega + have h0_eq : (⟨h.1 - h.1, by omega⟩ : Fin s) = ⟨0, hs⟩ := by ext; simp + have hle_D0 : h.1 ≤ regionalDistance H (discIns Δ_out (C ⟨0, hs⟩)) (C h).U := by + have := hstep h.1 le_rfl + rwa [h0_eq] at this + have hp0 := hC.disc_props hS hΔ_out ⟨0, hs⟩ + have hC0ne : (C ⟨0, hs⟩).U.Nonempty := IsOArc.nonempty (isOArc_of_isCircuit (hC.1 ⟨0, hs⟩).2.1) + obtain ⟨v_seq, r_seq, hc⟩ := regionalDistance_spec hS H hC0ne hYne + have hc' : IsRegionChain H (discIns Δ_out (C ⟨0, hs⟩)) (C h).U v_seq r_seq := + ⟨hp0.2.2.2.2.2 hc.1, hc.2.1, hc.2.2⟩ + exact hle_D0.trans (regionalDistance_le hc') + +/-- For any point `p ∈ x ∩ closure r` where `x ∈ A(H)` and `r ∈ R(H)`, either `x = r` or there is a +vertex `v ∈ V(H)` with `v ∈ closure x` and `v ∈ closure r` (and if `r₁, r₂ ∈ R(H)` both contain `p` +in their closures, the same `v` belongs to `closure r₁ ∩ closure r₂`). -/ +private theorem eq_or_exists_vertex_of_mem_closure_region + (hS : IsClosedSurface S) {H : Drawing S} {r x : Set S} {p : S} + (hr : r ∈ H.R) (hx : x ∈ H.A) (hpx : p ∈ x) (hpr : p ∈ closure r) : + x = r ∨ (x ⊆ closure r ∧ ∃ v ∈ H.V, v ∈ closure x ∧ v ∈ closure r) := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + rcases hx with (⟨v, hv, rfl⟩ | he) | hs + · have hvp : p = v := mem_singleton_iff.mp hpx + subst hvp + exact Or.inr ⟨singleton_subset_iff.mpr hpr, p, hv, subset_closure (mem_singleton p), hpr⟩ + · have her : x ⊆ closure r := edge_subset_closure_of_incident hS he hr ⟨p, hpx, hpr⟩ + have hcl_er : closure x ⊆ closure r := isClosed_closure.closure_subset_iff.mpr her + have hex_v : ∃ v ∈ H.V, v ∈ closure x := by + rcases H.edge_cond x he with ⟨u, v, _, hcap, _⟩ | ⟨u, hcap, _⟩ + · have hu : u ∈ closure x ∩ H.V := by rw [hcap]; exact Or.inl rfl + exact ⟨u, hu.2, hu.1⟩ + · have hu : u ∈ closure x ∩ H.V := by rw [hcap]; exact rfl + exact ⟨u, hu.2, hu.1⟩ + obtain ⟨v, hvH, hve⟩ := hex_v + exact Or.inr ⟨her, v, hvH, hve, hcl_er hve⟩ + · obtain ⟨q, hqs, hqr⟩ := mem_closure_iff.mp hpr x (region_isOpen hs) hpx + exact Or.inl (region_eq_of_mem hs hr hqs hqr) + +/-- Two regions `r₁, r₂ ∈ R(H)` whose closures share a point `p` have tangle distance `≤ 2`. -/ +private theorem tangleMetric_regions_le_two_of_inter_closures [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hMetric : HasTangleMetric H θ T d) (hE : H.E.Nonempty) + {r₁ r₂ : Set S} (hr₁ : r₁ ∈ H.R) (hr₂ : r₂ ∈ H.R) + {p : S} (hp₁ : p ∈ closure r₁) (hp₂ : p ∈ closure r₂) : + d r₁ r₂ ≤ 2 := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have h91 := GM11.gm15_theorem_9_1 H θ T d hS hConn hMetric + have hrefl := h91.2.1 + have hsymm := h91.2.2.2.1 + have htri := h91.2.2.2.2.1 + have hv_reg := h91.2.2.2.2.2.1 + obtain ⟨x, hxA, hpx⟩ := exists_atom_mem_of_point H p + rcases eq_or_exists_vertex_of_mem_closure_region hS hr₁ hxA hpx hp₁ with rfl | ⟨_, v, hvH, hvx, + hvr₁⟩ + · obtain ⟨q, hqx, hqr₂⟩ := mem_closure_iff.mp hp₂ x (region_isOpen hr₁) hpx + have heq : r₂ = x := region_eq_of_mem hr₂ hr₁ hqr₂ hqx + subst heq + rw [hrefl r₂ (Or.inr hr₁)] + exact Nat.zero_le 2 + · rcases eq_or_exists_vertex_of_mem_closure_region hS hr₂ hxA hpx hp₂ with rfl | ⟨hsub₂, _⟩ + · obtain ⟨q, hqx, hqr₁⟩ := mem_closure_iff.mp hp₁ x (region_isOpen hr₂) hpx + have heq : r₁ = x := region_eq_of_mem hr₁ hr₂ hqr₁ hqx + subst heq + rw [hrefl r₁ (Or.inr hr₂)] + exact Nat.zero_le 2 + · have hvr₂ : v ∈ closure r₂ := isClosed_closure.closure_subset_iff.mpr hsub₂ hvx + have hvA : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hvH, rfl⟩) + have h1 : d r₁ {v} ≤ 1 := by + rw [hsymm r₁ (Or.inr hr₁) {v} hvA] + exact hv_reg hE v hvH r₁ hr₁ hvr₁ + have h2 : d {v} r₂ ≤ 1 := hv_reg hE v hvH r₂ hr₂ hvr₂ + have h3 := htri r₁ (Or.inr hr₁) {v} hvA r₂ (Or.inr hr₂) + omega + +/-- Claim (1) in the proof of Graph Minors XIV, (9.5) (pages 45–46): +"There are $\beta + 1$ mutually disjoint circuits $C_1, \dots, C_{\beta + 1}$ of $H \cap +\bar{\Lambda}_1$, bounding closed discs $\Delta_1, \dots, \Delta_{\beta + 1} \subseteq +\bar{\Lambda}_1$, respectively, such that $\bar{\Lambda}_2 \subseteq \Delta_1 \subseteq +\Delta_2 \subseteq \dots \subseteq \Delta_{\beta + 1} \subseteq \bar{\Lambda}_1$." -/ +private theorem lemma_9_5_claim_1 [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H : Drawing S} {θ beta : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z : Set S} + (hMetric : HasTangleMetric H θ T d) (hz : z ∈ H.A) + (hbeta : 4 ≤ beta) (hθ : 16 * beta + 17 ≤ θ) : + ∃ (C_in C_out : Drawing S) (Λ₁ Λ₂ : Set S) (C₀ : Fin (beta + 1) → Drawing S), + C_in.IsSubdrawing H ∧ C_in.IsCircuit ∧ + subBd Λ₂ = C_in.U ∧ subBd (closure Λ₂) = C_in.U ∧ closure Λ₂ \ C_in.U = Λ₂ ∧ + IsLambdaZoneAround H d (beta + 2) z Λ₂ ∧ + (∀ x ∈ H.A, d z x < beta → x ⊆ Λ₂) ∧ + C_out.IsSubdrawing H ∧ C_out.IsCircuit ∧ + subBd Λ₁ = C_out.U ∧ subBd (closure Λ₁) = C_out.U ∧ closure Λ₁ \ C_out.U = Λ₁ ∧ + IsLambdaZoneAround H d (3 * beta + 3) z Λ₁ ∧ + (∀ x ∈ H.A, d z x < 3 * beta + 1 → x ⊆ Λ₁) ∧ + closure Λ₂ ⊆ Λ₁ ∧ + IsDiscNest H (closure Λ₁) C_in C_out C₀ ∧ + discIns (closure Λ₁) (C₀ ⟨0, Nat.succ_pos beta⟩) = closure Λ₂ := by + have h91 := GM11.gm15_theorem_9_1 H θ T d hS hConn hMetric + have hsymm := h91.2.2.2.1 + have htri := h91.2.2.2.2.1 + have hv_reg := h91.2.2.2.2.2.1 + have hE : H.E.Nonempty := edgeSet_nonempty_of_isTangle hMetric.1.2.1 (by omega) + obtain ⟨C_in, Λ₂, hCinH, hCin, hbd₂, hbd_cl₂, hdiff₂, hZone₂, hsub₂⟩ := + full_of_9_2 hS hConn H θ beta T d z hMetric hz (by omega) (by omega) + obtain ⟨C_out, Λ₁, hCoutH, hCout, hbd₁, hbd_cl₁, hdiff₁, hZone₁, hsub₁⟩ := + full_of_9_2 hS hConn H θ (3 * beta + 1) T d z hMetric hz (by omega) (by omega) + have hcl₂_sub_Λ₁ : closure Λ₂ ⊆ Λ₁ := + closure_zone_subset hS hZone₂ fun x hx hle => hsub₁ x hx (by omega) + have hcl₂_sub_int₁ : closure Λ₂ ⊆ closure Λ₁ \ subBd (closure Λ₁) := by + rw [hbd_cl₁, hdiff₁] + exact hcl₂_sub_Λ₁ + -- Show `beta ≤ regionalDistance H (closure Λ₂) (subBd (closure Λ₁))`. + have hdist_ge : beta ≤ regionalDistance H (closure Λ₂) (subBd (closure Λ₁)) := by + have hcl₂_ne : (closure Λ₂).Nonempty := IsClosedDisc.nonempty hZone₂.isClosedDisc_closure + have hbd₁_ne : (subBd (closure Λ₁)).Nonempty := by + rw [hbd_cl₁] + exact IsOArc.nonempty (isOArc_of_isCircuit hCout) + have hspec := regionalDistance_spec hS H hcl₂_ne hbd₁_ne + generalize hk : regionalDistance H (closure Λ₂) (subBd (closure Λ₁)) = k at hspec ⊢ + obtain ⟨v_seq, r_seq, hv0, hvlast, hsteps⟩ := hspec + rcases k with _ | m + · exfalso + have h0 : Fin.last 0 = (0 : Fin 1) := rfl + rw [h0] at hvlast + exact (hcl₂_sub_int₁ hv0).2 hvlast + · -- First region `r_seq 0` has `d z (r_seq 0) ≤ beta + 3`. + have hr0_le : d z (r_seq 0) ≤ beta + 3 := by + have hr0_R : r_seq 0 ∈ H.R := (hsteps 0).1 + have hv0_r0 : v_seq 0 ∈ closure (r_seq 0) := (hsteps 0).2.1 + obtain ⟨x₀, hx₀A, hv0_x₀⟩ := exists_atom_mem_of_point H (v_seq 0) + have hx₀_cl₂ : x₀ ⊆ closure Λ₂ := + atom_subset_closure_of_inter_nonempty hS hCinH hZone₂.isClosedDisc_closure + hbd_cl₂ hdiff₂ hx₀A ⟨v_seq 0, hv0_x₀, hv0⟩ + rcases eq_or_exists_vertex_of_mem_closure_region hS hr0_R hx₀A hv0_x₀ hv0_r0 with + rfl | ⟨_, v, hvH, hv_x₀, hv_r0⟩ + · have hle := hZone₂.dist_le (r_seq 0) hx₀A hx₀_cl₂ + omega + · have hv_cl₂ : ({v} : Set S) ⊆ closure Λ₂ := + singleton_subset_iff.mpr (isClosed_closure.closure_subset_iff.mpr hx₀_cl₂ hv_x₀) + have hvA : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hvH, rfl⟩) + have h1 := hZone₂.dist_le {v} hvA hv_cl₂ + have h2 := hv_reg hE v hvH (r_seq 0) hr0_R hv_r0 + have h3 := htri z hz {v} hvA (r_seq 0) (Or.inr hr0_R) + omega + -- Induction: `d z (r_seq ⟨j, hj⟩) ≤ beta + 3 + 2 * j`. + have hind_r : ∀ j : ℕ, (hj : j < m + 1) → d z (r_seq ⟨j, hj⟩) ≤ beta + 3 + 2 * j := by + intro j + induction j with + | zero => intro _; simpa using hr0_le + | succ j ih => + intro hj + have hj' : j < m + 1 := Nat.lt_of_succ_lt hj + have hih := ih hj' + have hr_j : r_seq ⟨j, hj'⟩ ∈ H.R := (hsteps ⟨j, hj'⟩).1 + have hr_j1 : r_seq ⟨j + 1, hj⟩ ∈ H.R := (hsteps ⟨j + 1, hj⟩).1 + have hp_j : v_seq (⟨j, hj'⟩ : Fin (m + 1)).succ ∈ closure (r_seq ⟨j, hj'⟩) := + (hsteps ⟨j, hj'⟩).2.2 + have hp_j1 : v_seq (⟨j + 1, hj⟩ : Fin (m + 1)).castSucc ∈ closure (r_seq ⟨j + 1, hj⟩) := + (hsteps ⟨j + 1, hj⟩).2.1 + have heq_idx : (⟨j, hj'⟩ : Fin (m + 1)).succ = (⟨j + 1, hj⟩ : Fin (m + 1)).castSucc := rfl + rw [← heq_idx] at hp_j1 + have hstep_le := + tangleMetric_regions_le_two_of_inter_closures hS hConn hMetric hE hr_j hr_j1 hp_j hp_j1 + have htri_j := htri z hz (r_seq ⟨j, hj'⟩) (Or.inr hr_j) (r_seq ⟨j + 1, hj⟩) (Or.inr hr_j1) + omega + -- Last region `r_seq ⟨m, _⟩` has `3 * beta ≤ d z (r_seq ⟨m, _⟩)`. + let i_last : Fin (m + 1) := ⟨m, Nat.lt_succ_self m⟩ + have hr_last_R : r_seq i_last ∈ H.R := (hsteps i_last).1 + have hv_last_r : v_seq (Fin.last (m + 1)) ∈ closure (r_seq i_last) := (hsteps i_last).2.2 + have hv_last_CU : v_seq (Fin.last (m + 1)) ∈ C_out.U := hbd_cl₁ ▸ hvlast + obtain ⟨x_l, hx_lA, hv_xl⟩ := exists_atom_mem_of_point H (v_seq (Fin.last (m + 1))) + rcases eq_or_exists_vertex_of_mem_closure_region hS hr_last_R hx_lA hv_xl hv_last_r with + rfl | ⟨_, v_l, hv_lH, hv_l_xl, hv_l_r⟩ + · exact absurd (hCoutH.U_subset hv_last_CU) (region_subset hr_last_R hv_xl) + · have hv_l_CU : v_l ∈ C_out.U := by + rcases hx_lA with (⟨w, _, rfl⟩ | he) | hs + · have hvw : v_l = w := + mem_singleton_iff.mp ((isClosed_singleton (x := w)).closure_eq ▸ hv_l_xl) + have hpw : v_seq (Fin.last (m + 1)) = w := mem_singleton_iff.mp hv_xl + exact hvw ▸ hpw ▸ hv_last_CU + · have hp_not_V : v_seq (Fin.last (m + 1)) ∉ C_out.V := + fun hV => (he.2.1 hv_xl).2 (hCoutH.1 hV) + obtain ⟨f, hfC, hpf⟩ := C_out.exists_edge_of_mem hv_last_CU hp_not_V + have heq : x_l = f := H.edge_eq_of_mem he (hCoutH.2 hfC) hv_xl hpf + exact C_out.closure_subset_U hfC (heq ▸ hv_l_xl) + · exact absurd (hCoutH.U_subset hv_last_CU) (region_subset hs hv_xl) + have hv_l_not_Λ₁ : ¬ ({v_l} : Set S) ⊆ Λ₁ := by + intro hsub + exact (hdiff₁ ▸ hsub (mem_singleton v_l)).2 hv_l_CU + have hv_lA : ({v_l} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v_l, hv_lH, rfl⟩) + have hge_vl : 3 * beta + 1 ≤ d z {v_l} := by + by_contra hlt + exact hv_l_not_Λ₁ (hsub₁ {v_l} hv_lA (by omega)) + have hle_rv : d (r_seq i_last) {v_l} ≤ 1 := by + rw [hsymm (r_seq i_last) (Or.inr hr_last_R) {v_l} hv_lA] + exact hv_reg hE v_l hv_lH (r_seq i_last) hr_last_R hv_l_r + have htri_last := htri z hz (r_seq i_last) (Or.inr hr_last_R) {v_l} hv_lA + have hle_last : d z (r_seq i_last) ≤ beta + 3 + 2 * m := hind_r m (Nat.lt_succ_self m) + omega + -- Apply `theorem_5_5_aux` with `m = beta - 1`. + have hdist_ge' : (beta - 1) + 1 ≤ regionalDistance H (closure Λ₂) (subBd (closure Λ₁)) := by + omega + obtain ⟨C_mid, Λ_mid, hmid_props, hmid_nest⟩ := + theorem_5_5_aux hS H hZone₁.isClosedDisc_closure (beta - 1) hcl₂_sub_int₁ + (IsClosedDisc.nonempty hZone₂.isClosedDisc_closure) + (IsClosedDisc.isPreconnected hZone₂.isClosedDisc_closure) hdist_ge' + -- Assemble `C₀ : Fin (beta + 1) → Drawing S` and `Δ₀ : Fin (beta + 1) → Set S`. + let C₀ : Fin (beta + 1) → Drawing S := fun j => + if hj0 : j.1 = 0 then C_in + else if hjb : j.1 - 1 < beta - 1 then C_mid ⟨j.1 - 1, hjb⟩ + else C_out + let Δ_seq : Fin (beta + 1) → Set S := fun j => + if hj0 : j.1 = 0 then closure Λ₂ + else if hjb : j.1 - 1 < beta - 1 then closure (Λ_mid ⟨j.1 - 1, hjb⟩) + else closure Λ₁ + let Λ_seq : Fin (beta + 1) → Set S := fun j => + if hj0 : j.1 = 0 then Λ₂ + else if hjb : j.1 - 1 < beta - 1 then Λ_mid ⟨j.1 - 1, hjb⟩ + else Λ₁ + have hCinU_sub : C_in.U ⊆ closure Λ₂ := by + rw [← hbd_cl₂, subBd_eq_frontier] + exact hZone₂.isClosedDisc_closure.isCompact.isClosed.frontier_subset + have hCoutU_sub : C_out.U ⊆ closure Λ₁ := by + rw [← hbd_cl₁, subBd_eq_frontier] + exact hZone₁.isClosedDisc_closure.isCompact.isClosed.frontier_subset + have hseq_props : ∀ j : Fin (beta + 1), + (C₀ j).IsSubdrawing H ∧ (C₀ j).IsCircuit ∧ (C₀ j).U ⊆ closure Λ₁ ∧ + IsClosedDisc (Δ_seq j) ∧ Δ_seq j ⊆ closure Λ₁ ∧ + subBd (Δ_seq j) = (C₀ j).U ∧ Δ_seq j \ (C₀ j).U = Λ_seq j ∧ + discIns (closure Λ₁) (C₀ j) = Δ_seq j := by + intro j + have hmain : (C₀ j).IsSubdrawing H ∧ (C₀ j).IsCircuit ∧ (C₀ j).U ⊆ closure Λ₁ ∧ + IsClosedDisc (Δ_seq j) ∧ Δ_seq j ⊆ closure Λ₁ ∧ + subBd (Δ_seq j) = (C₀ j).U ∧ Δ_seq j \ (C₀ j).U = Λ_seq j := by + dsimp only [C₀, Δ_seq, Λ_seq] + split_ifs with hj0 hjb + · exact ⟨hCinH, hCin, hCinU_sub.trans (hcl₂_sub_int₁.trans sdiff_subset), + hZone₂.isClosedDisc_closure, hcl₂_sub_int₁.trans sdiff_subset, hbd_cl₂, hdiff₂⟩ + · obtain ⟨h1, h2, h3, _, h5, h6, _, h8, h9, _⟩ := hmid_props ⟨j.1 - 1, hjb⟩ + exact ⟨h1, h2, h3.trans sdiff_subset, h6, h5.trans sdiff_subset, h8, h9⟩ + · exact ⟨hCoutH, hCout, hCoutU_sub, hZone₁.isClosedDisc_closure, Subset.rfl, hbd_cl₁, hdiff₁⟩ + obtain ⟨h1, h2, h3, h4, h5, h6, h7⟩ := hmain + obtain ⟨_, huniq⟩ := discIns_spec hZone₁.isClosedDisc_closure h2 h3 + have hdiscIns_eq : discIns (closure Λ₁) (C₀ j) = Δ_seq j := + (huniq (Δ_seq j) h5 h4 ((IsClosedDisc.subBd_eq_discBd hS h4).symm.trans h6)).symm + exact ⟨h1, h2, h3, h4, h5, h6, h7, hdiscIns_eq⟩ + have hnest_strict : ∀ j₁ j₂ : Fin (beta + 1), j₁ < j₂ → Δ_seq j₁ ⊆ Λ_seq j₂ := by + intro j₁ j₂ hj12 + dsimp only [Δ_seq, Λ_seq] + split_ifs with h10 h20 h2b h1b h20' h2b' + · omega + · exact (hmid_props ⟨j₂.1 - 1, h2b⟩).2.2.2.2.2.2.2.2.2 + · exact hcl₂_sub_Λ₁ + · omega + · exact hmid_nest ⟨j₁.1 - 1, h1b⟩ ⟨j₂.1 - 1, h2b'⟩ (by change j₁.1 - 1 < j₂.1 - 1; omega) + · rw [← hdiff₁, ← hbd_cl₁] + exact (hmid_props ⟨j₁.1 - 1, h1b⟩).2.2.2.2.1 + · omega + · omega + · omega + have hdisj_U : Pairwise (fun j₁ j₂ : Fin (beta + 1) => Disjoint (C₀ j₁).U (C₀ j₂).U) := by + have key : ∀ j₁ j₂ : Fin (beta + 1), j₁ < j₂ → Disjoint (C₀ j₁).U (C₀ j₂).U := by + intro j₁ j₂ hj12 + have hp₁ := hseq_props j₁ + have hp₂ := hseq_props j₂ + have hCU₁_sub_Δ₁ : (C₀ j₁).U ⊆ Δ_seq j₁ := by + rw [← hp₁.2.2.2.2.2.1, subBd_eq_frontier] + exact hp₁.2.2.2.1.isCompact.isClosed.frontier_subset + have hsub_Λ₂ : (C₀ j₁).U ⊆ Λ_seq j₂ := hCU₁_sub_Δ₁.trans (hnest_strict j₁ j₂ hj12) + refine disjoint_left.mpr fun x hx₁ hx₂ => ?_ + have hx_in : x ∈ Λ_seq j₂ := hsub_Λ₂ hx₁ + rw [← hp₂.2.2.2.2.2.2.1] at hx_in + exact hx_in.2 hx₂ + intro j₁ j₂ hj12 + rcases lt_or_gt_of_ne hj12 with h | h + · exact key j₁ j₂ h + · exact (key j₂ j₁ h).symm + have hC₀_nest : IsDiscNest H (closure Λ₁) C_in C_out C₀ := by + refine ⟨fun j => ⟨(hseq_props j).1, (hseq_props j).2.1, (hseq_props j).2.2.1⟩, + fun j₁ j₂ hj12 => disjoint_of_subset (C₀ j₁).V_subset_U (C₀ j₂).V_subset_U (hdisj_U hj12), + fun j₁ j₂ hj12 => ?_, fun hs => ⟨?_, ?_⟩⟩ + · change discIns (closure Λ₁) (C₀ j₁) ⊆ discIns (closure Λ₁) (C₀ j₂) + rw [(hseq_props j₁).2.2.2.2.2.2.2, (hseq_props j₂).2.2.2.2.2.2.2] + rcases eq_or_lt_of_le hj12 with rfl | hlt + · exact Subset.rfl + · exact (hnest_strict j₁ j₂ hlt).trans + ((hseq_props j₂).2.2.2.2.2.2.1 ▸ sdiff_subset) + · simp [C₀] + · dsimp only [C₀] + split_ifs with h1 h2 + · omega + · omega + · rfl + have hdiscIns_0 : discIns (closure Λ₁) (C₀ ⟨0, Nat.succ_pos beta⟩) = closure Λ₂ := by + rw [(hseq_props ⟨0, Nat.succ_pos beta⟩).2.2.2.2.2.2.2] + simp [Δ_seq] + exact ⟨C_in, C_out, Λ₁, Λ₂, C₀, hCinH, hCin, hbd₂, hbd_cl₂, hdiff₂, hZone₂, hsub₂, + hCoutH, hCout, hbd₁, hbd_cl₁, hdiff₁, hZone₁, hsub₁, hcl₂_sub_Λ₁, hC₀_nest, hdiscIns_0⟩ + +/-! ## 4. Claim (2) of (9.5): Menger Paths Between `bd(Λ₂)` and `bd(Λ₁)` -/ + +/-- If `C` is a subdrawing of `H`, every vertex of `H` in `C.U` belongs to `C.V`. -/ +private theorem mem_subdrawing_V_of_mem_U {H C : Drawing S} (hCH : C.IsSubdrawing H) {v : S} + (hvH : v ∈ H.V) (hvU : v ∈ C.U) : v ∈ C.V := by + by_contra hvC + obtain ⟨e, heC, hve⟩ := C.exists_edge_of_mem hvU hvC + exact ((hCH.2 heC).2.1 hve).2 hvH + +/-- Every walk in `H.toHypergraph.skeleton` lifts to a `GraphWalk H.toGraph` with the same vertex +support. -/ +private theorem lift_skeleton_walk {H : Drawing S} {u v : S} (hu : u ∈ H.V) + (w : H.toHypergraph.skeleton.Walk u v) : + ∃ W : GraphWalk H.toGraph u v, W.support = w.support := by + induction w with + | nil => exact ⟨.nil hu, rfl⟩ + | @cons u x v hadj rest ih => + obtain ⟨hux, e, ⟨heE, huV, hue⟩, ⟨_, hxV, hxe⟩⟩ := hadj + obtain ⟨W', hW'⟩ := ih hxV + obtain ⟨a, b, hl⟩ := (H.toGraph.edge_mem_iff_exists_isLink e).mp heE + have hcap := hl.2.2.2 + have hu_ab : u = a ∨ u = b := by + have : u ∈ ({a, b} : Set S) := hcap ▸ ⟨hue, huV⟩ + simpa using this + have hx_ab : x = a ∨ x = b := by + have : x ∈ ({a, b} : Set S) := hcap ▸ ⟨hxe, hxV⟩ + simpa using this + have hl_ux : H.toGraph.IsLink e u x := by + rcases hu_ab with rfl | rfl <;> rcases hx_ab with rfl | rfl + · exact (hux rfl).elim + · exact hl + · exact hl.symm + · exact (hux rfl).elim + exact ⟨.cons hl_ux W', congrArg (u :: ·) hW'⟩ + +/-- If a simple walk `W` in `H` starts at `u ∈ closure Λ₂` and ends at `v ∉ closure Λ₂` (where +`C_in` is a circuit of `H` with `subBd (closure Λ₂) = C_in.U` and `closure Λ₂ \ C_in.U = Λ₂`), +then `W` has a suffix `W₁` starting at some `a ∈ C_in.V` with `W₁.support ⊆ W.support`. -/ +private theorem exists_suffix_from_inner_circuit + (hS : IsClosedSurface S) {H C_in : Drawing S} {Λ₂ : Set S} + (hCinH : C_in.IsSubdrawing H) + (hOD₂ : IsOpenDisc Λ₂) (hCD₂ : IsClosedDisc (closure Λ₂)) + (hbd_cl₂ : subBd (closure Λ₂) = C_in.U) (hdiff₂ : closure Λ₂ \ C_in.U = Λ₂) + {u v : S} (W : GraphWalk H.toGraph u v) (hWs : W.IsSimple) + (hu : u ∈ closure Λ₂) (hv : v ∉ closure Λ₂) : + ∃ a ∈ C_in.V, ∃ W₁ : GraphWalk H.toGraph a v, + W₁.IsSimple ∧ ∀ x ∈ W₁.support, x ∈ W.support := by + induction W with + | nil _ => exact (hv hu).elim + | @cons u w v e hl rest ih => + have hr_s : rest.IsSimple := (List.nodup_cons.mp hWs).2 + by_cases huC : u ∈ C_in.U + · exact ⟨u, mem_subdrawing_V_of_mem_U hCinH hl.2.1 huC, .cons hl rest, hWs, fun _ hx => hx⟩ + · have hu_Λ₂ : u ∈ Λ₂ := hdiff₂ ▸ ⟨hu, huC⟩ + have hu_cl_e : u ∈ closure e := by + have : u ∈ closure e ∩ H.V := hl.2.2.2 ▸ Or.inl rfl + exact this.1 + obtain ⟨q, hq_Λ₂, hqe⟩ := mem_closure_iff.mp hu_cl_e Λ₂ hOD₂.1 hu_Λ₂ + have he_Λ₂ : e ⊆ Λ₂ := + atom_subset_open_of_inter_nonempty hS hCinH hCD₂ hbd_cl₂ hdiff₂ + (Or.inl (Or.inr hl.1)) ⟨q, hqe, hq_Λ₂⟩ + have hw_cl_e : w ∈ closure e := by + have : w ∈ closure e ∩ H.V := hl.2.2.2 ▸ Or.inr rfl + exact this.1 + have hw_cl₂ : w ∈ closure Λ₂ := closure_mono he_Λ₂ hw_cl_e + obtain ⟨a, haC, W₁, hW₁s, hsupp⟩ := ih hr_s hw_cl₂ hv + exact ⟨a, haC, W₁, hW₁s, fun x hx => List.mem_cons_of_mem _ (hsupp x hx)⟩ + +/-- If a simple walk `W₂` in `H` from `a` to `b` satisfies `∀ x ∈ W₂.support, x ≠ b → x ∈ Λ₁`, +then every edge of `W₂` is a subset of `Λ₁`, and if `a ≠ b` then `b ∈ closure Λ₁`. -/ +private theorem edges_subset_and_end_mem_closure_of_before_end + (hS : IsClosedSurface S) {H C_out : Drawing S} {Λ₁ : Set S} + (hCoutH : C_out.IsSubdrawing H) + (hOD₁ : IsOpenDisc Λ₁) (hCD₁ : IsClosedDisc (closure Λ₁)) + (hbd_cl₁ : subBd (closure Λ₁) = C_out.U) (hdiff₁ : closure Λ₁ \ C_out.U = Λ₁) + {a b : S} (W₂ : GraphWalk H.toGraph a b) (hW₂s : W₂.IsSimple) + (hbefore : ∀ x ∈ W₂.support, x ≠ b → x ∈ Λ₁) : + (∀ e ∈ W₂.edges, e ⊆ Λ₁) ∧ (a ≠ b → b ∈ closure Λ₁) := by + induction W₂ with + | nil _ => exact ⟨nofun, fun hne => (hne rfl).elim⟩ + | @cons a w b e hl rest ih => + have ha_not : a ∉ rest.support := (List.nodup_cons.mp hW₂s).1 + have hr_s : rest.IsSimple := (List.nodup_cons.mp hW₂s).2 + have hab : a ≠ b := fun h => ha_not (h ▸ rest.end_mem_support) + have ha_Λ₁ : a ∈ Λ₁ := hbefore a (List.Mem.head _) hab + have ha_cl_e : a ∈ closure e := by + have : a ∈ closure e ∩ H.V := hl.2.2.2 ▸ Or.inl rfl + exact this.1 + obtain ⟨q, hq_Λ₁, hqe⟩ := mem_closure_iff.mp ha_cl_e Λ₁ hOD₁.1 ha_Λ₁ + have he_Λ₁ : e ⊆ Λ₁ := + atom_subset_open_of_inter_nonempty hS hCoutH hCD₁ hbd_cl₁ hdiff₁ + (Or.inl (Or.inr hl.1)) ⟨q, hqe, hq_Λ₁⟩ + obtain ⟨hed, hend⟩ := ih hr_s (fun x hx hxb => hbefore x (List.mem_cons_of_mem _ hx) hxb) + refine ⟨fun f hf => ?_, fun _ => ?_⟩ + · rcases List.mem_cons.mp hf with rfl | hfr + · exact he_Λ₁ + · exact hed f hfr + · by_cases hwb : w = b + · subst hwb + have hw_cl_e : w ∈ closure e := by + have : w ∈ closure e ∩ H.V := hl.2.2.2 ▸ Or.inr rfl + exact this.1 + exact closure_mono he_Λ₁ hw_cl_e + · exact hend hwb + +private theorem path_separator_partitions_the_drawing + {H : Drawing S} (Z₁ X : Set S) + {A B : Hypergraph S (Set S)} + (hA : A ≤ H.toHypergraph) (hB : B ≤ H.toHypergraph) + (hAV : A.vertexSet = sepCompLeft H.toHypergraph.skeleton H.V X Z₁ ∪ X) + (hBV : B.vertexSet = sepCompRight H.toHypergraph.skeleton H.V X Z₁ ∪ X) + (hBE : B.edgeSet = H.E \ A.edgeSet) : H.toHypergraph.IsSeparation A B := by + refine (isSeparation_iff_of_le hA hB).mpr ⟨?_, ?_, ?_⟩ + · refine Subset.antisymm (union_subset hA.vertexSet_subset hB.vertexSet_subset) ?_ + intro v hv + rw [hAV, hBV] + rcases subset_sepComp_union H.toHypergraph.skeleton Z₁ hv with (h | h) | h + · exact Or.inl (Or.inl h) + · exact Or.inr (Or.inl h) + · exact Or.inl (Or.inr h) + · rw [hBE] + ext e + constructor + · exact fun h => h.elim (fun he => hA.edgeSet_subset he) And.left + · exact fun he => (em (e ∈ A.edgeSet)).imp_right fun hn => ⟨he, hn⟩ + · rw [hBE] + exact (disjoint_left.mpr fun _ h₁ h₂ => h₂.2 h₁ : Disjoint A.edgeSet (H.E \ A.edgeSet)).inter_eq + +private theorem inner_zone_regions_are_on_first_tangle_side + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (hS : IsClosedSurface S) + {H : Drawing S} + {C_in : Drawing S} + {beta : ℕ} + {d : Set S → Set S → ℕ} + {z : Set S} + {Λ₂ : Set S} + (hCinH : C_in.IsSubdrawing H) + (hbd_cl₂ : subBd (closure Λ₂) = C_in.U) + (hdiff₂ : closure Λ₂ \ C_in.U = Λ₂) + (hZone₂ : IsLambdaZoneAround H d (beta + 2) z Λ₂) + (A : Hypergraph S (Set S)) + (he_E₁_of_cl₂ : ∀ e ∈ H.E, e ⊆ closure Λ₂ → e ∈ A.edgeSet) + (K : Drawing S) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hrf : RegionFacts (PaintingOrDrawing.drawing H) K) : + ∀ r ∈ K.R, (r ∩ Λ₂).Nonempty → r ∈ (PaintingOrDrawing.regionsIncludingEdge K A) := by + let Z_A := PaintingOrDrawing.regionsIncludingEdge K A + intro r hr ⟨y, hyr, hy_Λ₂⟩ + obtain ⟨e, heH, her⟩ := hrf.1 r hr + have he_cl₂ : e ⊆ closure Λ₂ := by + by_cases hmeet : (e ∩ closure Λ₂).Nonempty + · exact atom_subset_closure_of_inter_nonempty hS hCinH hZone₂.isClosedDisc_closure + hbd_cl₂ hdiff₂ (Or.inl (Or.inr heH)) hmeet + · have hdis_r_CU : Disjoint r C_in.U := by + refine disjoint_left.mpr fun x hxr hxCU => ?_ + have hx_not_KV : x ∉ K.V := fun hxV => (region_subset hr hxr) (K.V_subset_U hxV) + have hx_not_HV : x ∉ H.V := fun hxV => hx_not_KV (hK.2.1.2.1 hxV) + have hx_not_CV : x ∉ C_in.V := fun hxV => hx_not_HV (hCinH.1 hxV) + obtain ⟨f, hfC, hxf⟩ := C_in.exists_edge_of_mem hxCU hx_not_CV + have hfH : f ∈ H.E := hCinH.2 hfC + obtain ⟨hf_pre, hf_disjV, hf_U, _⟩ := (PaintingOrDrawing.drawing H).edge_props hfH + have hf_off_KU : ∀ z ∈ f, z ∉ K.U := fun z hzf hzKU => by + have hz_in : z ∈ (PaintingOrDrawing.drawing H).U ∩ K.U := ⟨hf_U hzf, hzKU⟩ + rw [hK.2.1.1] at hz_in + exact disjoint_left.mp hf_disjV hzf hz_in + have hr_eq : r = connectedComponentIn (univ \ K.U) x := + region_eq_of_mem hr ((mem_R_iff K).mpr ⟨x, fun hxKU => region_subset hr hxr hxKU, + rfl⟩) + hxr (mem_connectedComponentIn ⟨mem_univ x, fun hxKU => region_subset hr hxr hxKU⟩) + have hfr : f ⊆ r := by + rw [hr_eq] + exact hf_pre.subset_connectedComponentIn hxf fun z hzf => ⟨mem_univ z, + hf_off_KU z hzf⟩ + have hfe : f = e := hrf.2.1 r hr f hfH e heH hfr her + subst hfe + exact hmeet ⟨x, hxf, hZone₂.isClosedDisc_closure.isCompact.isClosed.frontier_subset + (subBd_eq_frontier (closure Λ₂) ▸ hbd_cl₂ ▸ hxCU)⟩ + have hdis_fr : Disjoint r (frontier (closure Λ₂)) := by + rwa [← subBd_eq_frontier, hbd_cl₂] + have hr_cl₂ : r ⊆ closure Λ₂ := + subset_of_disjoint_frontier (region_isPreconnected hr) isClosed_closure + hdis_fr hyr (subset_closure hy_Λ₂) + exact her.trans hr_cl₂ + exact ⟨hr, e, he_E₁_of_cl₂ e heH he_cl₂, her⟩ + +private theorem first_tangle_side_boundary_avoids_inner_zone + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (hS : IsClosedSurface S) + {H : Drawing S} + {beta : ℕ} + {d : Set S → Set S → ℕ} + {z : Set S} + {Λ₂ : Set S} + (hZone₂ : IsLambdaZoneAround H d (beta + 2) z Λ₂) + (K : Drawing S) + (A : Hypergraph S (Set S)) + (hNs : (boundaryDrawing K (PaintingOrDrawing.regionsIncludingEdge K A)).IsSubdrawing K) + (hr_in_ZA : ∀ r ∈ K.R, (r ∩ Λ₂).Nonempty → r ∈ (PaintingOrDrawing.regionsIncludingEdge K A)) : + Disjoint (boundaryDrawing K (PaintingOrDrawing.regionsIncludingEdge K A)).U Λ₂ := by + let Z_A := PaintingOrDrawing.regionsIncludingEdge K A + let N := boundaryDrawing K Z_A + rw [N.U_eq] + refine disjoint_union_left.mpr ⟨disjoint_left.mpr fun v hvN hv_Λ₂ => ?_, + disjoint_iUnion₂_left.mpr fun f hfN => disjoint_left.mpr fun x hxf hx_Λ₂ => ?_⟩ + · obtain ⟨-, r₂, ⟨hr₂R, hr₂not⟩, hinc⟩ := (mem_boundaryDrawing_V (Γ := K) hS).mp hvN + obtain ⟨q, hq_Λ₂, hqr₂⟩ := mem_closure_iff.mp hinc.2.2 Λ₂ hZone₂.isOpenDisc.1 hv_Λ₂ + exact hr₂not (hr_in_ZA r₂ hr₂R ⟨q, hqr₂, hq_Λ₂⟩) + · obtain ⟨-, r₂, ⟨hr₂R, hr₂not⟩, hinc⟩ := (mem_boundaryDrawing_E (Γ := K)).mp hfN + have hfr₂ : f ⊆ closure r₂ := + edge_subset_closure_of_incident hS (hNs.2 hfN) hr₂R hinc.2.2 + have hx_r₂ : x ∈ closure r₂ := isClosed_closure.closure_subset_iff.mpr hfr₂ hxf + obtain ⟨q, hq_Λ₂, hqr₂⟩ := mem_closure_iff.mp hx_r₂ Λ₂ hZone₂.isOpenDisc.1 hx_Λ₂ + exact hr₂not (hr_in_ZA r₂ hr₂R ⟨q, hqr₂, hq_Λ₂⟩) + +private theorem disjoint_skeleton_paths_restrict_to_annulus + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (hS : IsClosedSurface S) + {H : Drawing S} + {C_in : Drawing S} + {C_out : Drawing S} + {beta : ℕ} + {d : Set S → Set S → ℕ} + {z : Set S} + {Λ₁ : Set S} + {Λ₂ : Set S} + (hCinH : C_in.IsSubdrawing H) + (hbd_cl₂ : subBd (closure Λ₂) = C_in.U) + (hdiff₂ : closure Λ₂ \ C_in.U = Λ₂) + (hZone₂ : IsLambdaZoneAround H d (beta + 2) z Λ₂) + (hCoutH : C_out.IsSubdrawing H) + (hbd_cl₁ : subBd (closure Λ₁) = C_out.U) + (hdiff₁ : closure Λ₁ \ C_out.U = Λ₁) + (hZone₁ : IsLambdaZoneAround H d (3 * beta + 3) z Λ₁) + (hcl₂_sub_Λ₁ : closure Λ₂ ⊆ Λ₁) + (P_skel : Fin beta → PathFromTo H.toHypergraph.skeleton (H.V ∩ closure Λ₂) (H.V \ Λ₁)) : + ∀ (i : Fin beta), ∃ (a b : S) (W₂ : GraphWalk H.toGraph a b), + a ∈ C_in.V ∧ b ∈ C_out.V ∧ W₂.IsSimple ∧ (walkDrawing H W₂).U ⊆ closure Λ₁ ∧ + ∀ x ∈ W₂.support, x ∈ (P_skel i).walk.support := by + let Z₁ := H.V ∩ closure Λ₂ + let Z₂ := H.V \ Λ₁ + intro i + obtain ⟨W₀, hW₀_supp⟩ := lift_skeleton_walk (P_skel i).first_mem.1 (P_skel i).walk + have hW₀s : W₀.IsSimple := by + change W₀.support.Nodup + rw [hW₀_supp] + exact (P_skel i).isPath.support_nodup + have hu₀_cl₂ : (P_skel i).first ∈ closure Λ₂ := (P_skel i).first_mem.2 + have hv₀_not_Λ₁ : (P_skel i).last ∉ Λ₁ := (P_skel i).last_mem.2 + have hv₀_not_cl₂ : (P_skel i).last ∉ closure Λ₂ := + fun h => hv₀_not_Λ₁ (hcl₂_sub_Λ₁ h) + obtain ⟨a, haC, W₁, hW₁s, hW₁_supp⟩ := + exists_suffix_from_inner_circuit hS hCinH hZone₂.isOpenDisc + hZone₂.isClosedDisc_closure hbd_cl₂ hdiff₂ W₀ hW₀s hu₀_cl₂ hv₀_not_cl₂ + have hhit_out : ∃ x ∈ W₁.support, x ∈ H.V \ Λ₁ := + ⟨(P_skel i).last, W₁.end_mem_support, (P_skel i).last_mem⟩ + obtain ⟨b, hb_out, W₂, W_rest, hsplit₁, hW₂_first⟩ := exists_first_hit_split W₁ hhit_out + have hW₂s : W₂.IsSimple := (GM09.isSimple_of_append (hsplit₁ ▸ hW₁s)).1 + have ha_Λ₁ : a ∈ Λ₁ := hcl₂_sub_Λ₁ + (hZone₂.isClosedDisc_closure.isCompact.isClosed.frontier_subset + (subBd_eq_frontier (closure Λ₂) ▸ hbd_cl₂ ▸ C_in.V_subset_U haC)) + have hab : a ≠ b := fun h => hb_out.2 (h ▸ ha_Λ₁) + have hbefore : ∀ x ∈ W₂.support, x ≠ b → x ∈ Λ₁ := by + intro x hx hxb + by_contra hx_not + exact hxb (hW₂_first x hx ⟨mem_V_of_mem_support W₂ hx, hx_not⟩) + obtain ⟨hed_Λ₁, hb_cl₁⟩ := + edges_subset_and_end_mem_closure_of_before_end hS hCoutH hZone₁.isOpenDisc + hZone₁.isClosedDisc_closure hbd_cl₁ hdiff₁ W₂ hW₂s hbefore + have hb_CU : b ∈ C_out.U := by + by_contra hb_not_CU + exact hb_out.2 (hdiff₁ ▸ ⟨hb_cl₁ hab, hb_not_CU⟩) + have hbC : b ∈ C_out.V := mem_subdrawing_V_of_mem_U hCoutH hb_out.1 hb_CU + have hW₂_U : (walkDrawing H W₂).U ⊆ closure Λ₁ := by + intro z hz + rcases walk_U_cases hz with hz_supp | ⟨e, he, hze⟩ + · by_cases hzb : z = b + · exact hzb ▸ hb_cl₁ hab + · exact subset_closure (hbefore z hz_supp hzb) + · exact subset_closure (hed_Λ₁ e he hze) + have hW₂_supp : ∀ x ∈ W₂.support, x ∈ (P_skel i).walk.support := by + intro x hx + rw [← hW₀_supp] + exact hW₁_supp x (hsplit₁ ▸ (GraphWalk.mem_support_append W₂ W_rest).mpr (Or.inl hx)) + exact ⟨a, b, W₂, haC, hbC, hW₂s, hW₂_U, hW₂_supp⟩ + +/-- Claim (2) in the proof of Graph Minors XIV, (9.5) (page 46): +"There are $\beta$ mutually disjoint paths $P_1, \dots, P_\beta$ of $H \cap \bar{\Lambda}_1$ +from $bd(\Lambda_2)$ to $bd(\Lambda_1)$." -/ +private theorem lemma_9_5_claim_2 [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {H C_in C_out : Drawing S} {θ beta : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z Λ₁ Λ₂ : Set S} + (hMetric : HasTangleMetric H θ T d) (hz : z ∈ H.A) + (hbeta : 4 ≤ beta) (hθ : 16 * beta + 17 ≤ θ) + (hCinH : C_in.IsSubdrawing H) (hCin : C_in.IsCircuit) + (hbd_cl₂ : subBd (closure Λ₂) = C_in.U) (hdiff₂ : closure Λ₂ \ C_in.U = Λ₂) + (hZone₂ : IsLambdaZoneAround H d (beta + 2) z Λ₂) + (hsub₂ : ∀ x ∈ H.A, d z x < beta → x ⊆ Λ₂) + (hCoutH : C_out.IsSubdrawing H) + (hbd_cl₁ : subBd (closure Λ₁) = C_out.U) (hdiff₁ : closure Λ₁ \ C_out.U = Λ₁) + (hZone₁ : IsLambdaZoneAround H d (3 * beta + 3) z Λ₁) + (hcl₂_sub_Λ₁ : closure Λ₂ ⊆ Λ₁) : + ∃ P₀ : Fin beta → Drawing S, IsDiscPaths H (closure Λ₁) C_in C_out P₀ := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let Z₁ : Set S := H.V ∩ closure Λ₂ + let Z₂ : Set S := H.V \ Λ₁ + have hZ₁_sub : Z₁ ⊆ H.toHypergraph.vertexSet := inter_subset_left + have hZ₂_sub : Z₂ ⊆ H.toHypergraph.vertexSet := sdiff_subset + by_cases hpaths : HasDisjointPaths H.toHypergraph.skeleton Z₁ Z₂ beta + · -- Case 1: Menger gives `beta` disjoint paths in `H.toHypergraph.skeleton` from `Z₁` to `Z₂`. + obtain ⟨P_skel, hP_disj⟩ := hpaths + have hex_sub : ∀ i : Fin beta, ∃ (a b : S) (W₂ : GraphWalk H.toGraph a b), + a ∈ C_in.V ∧ b ∈ C_out.V ∧ W₂.IsSimple ∧ + (walkDrawing H W₂).U ⊆ closure Λ₁ ∧ + ∀ x ∈ W₂.support, x ∈ (P_skel i).walk.support := by + exact disjoint_skeleton_paths_restrict_to_annulus (S := S) hS (H := H) (C_in := C_in) (C_out + := C_out) (beta := beta) (d := d) (z := z) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hCinH hbd_cl₂ hdiff₂ + hZone₂ hCoutH hbd_cl₁ hdiff₁ hZone₁ hcl₂_sub_Λ₁ P_skel + choose a b W₂ haC hbC hW₂s hW₂_U hW₂_supp using hex_sub + refine ⟨fun i => walkDrawing H (W₂ i), + fun i => ⟨walkDrawing_isSubdrawing H (W₂ i), hW₂_U i, + ⟨a i, haC i, b i, hbC i, walkDrawing_isPathBetween H (hW₂s i)⟩⟩, + fun i₁ i₂ hne => ?_⟩ + change Disjoint (walkDrawing H (W₂ i₁)).V (walkDrawing H (W₂ i₂)).V + rw [walkDrawing_V, walkDrawing_V] + exact disjoint_left.mpr fun x hx₁ hx₂ => + disjoint_left.mp (hP_disj hne) (hW₂_supp i₁ x hx₁) (hW₂_supp i₂ x hx₂) + · -- Case 2: Menger gives a vertex separator `X ⊆ H.V` of `Z₁` and `Z₂` with `|X| < beta`. + exfalso + obtain ⟨X, hsep_X, hX_lt⟩ := + exists_separates_lt_of_not_hasDisjointPaths H.toHypergraph hZ₁_sub hZ₂_sub hpaths + let C₁ := sepCompLeft H.toHypergraph.skeleton H.toHypergraph.vertexSet X Z₁ + let C₂ := sepCompRight H.toHypergraph.skeleton H.toHypergraph.vertexSet X Z₁ + have hC₁_sub : C₁ ⊆ H.V := sepCompLeft_subset _ _ _ _ + have hC₂_sub : C₂ ⊆ H.V := sepCompRight_subset _ _ _ _ + have hX_sub : X ⊆ H.V := hsep_X.1 + have hZ₁_C₁X : Z₁ ⊆ C₁ ∪ X := subset_sepCompLeft_union H.toHypergraph.skeleton hZ₁_sub + have hZ₂_C₂X : Z₂ ⊆ C₂ ∪ X := subset_sepCompRight_union hZ₂_sub hsep_X + have hC₁_Λ₁ : ∀ u ∈ C₁, u ∈ Λ₁ := by + intro u hu + by_contra hu_not + have hu_Z₂ : u ∈ Z₂ := ⟨hC₁_sub hu, hu_not⟩ + rcases hZ₂_C₂X hu_Z₂ with huC₂ | huX + · exact disjoint_left.mp (disjoint_sepCompLeft_sepCompRight _ _ _ _) hu huC₂ + · exact disjoint_left.mp (disjoint_sepCompLeft_sep _ _ _ _) hu huX + let E₁ : Set (Set S) := {e ∈ H.E | e ⊆ closure Λ₁ ∧ H.toHypergraph.ends e ⊆ C₁ ∪ X} + have hE₁_of_C₁ : ∀ e ∈ H.E, ∀ u ∈ H.toHypergraph.ends e, u ∈ C₁ → e ∈ E₁ := by + intro e he u hu_end huC₁ + have hu_Λ₁ : u ∈ Λ₁ := hC₁_Λ₁ u huC₁ + obtain ⟨q, hq_Λ₁, hqe⟩ := mem_closure_iff.mp hu_end.2.2 Λ₁ hZone₁.isOpenDisc.1 hu_Λ₁ + have he_Λ₁ : e ⊆ Λ₁ := + atom_subset_open_of_inter_nonempty hS hCoutH + hZone₁.isClosedDisc_closure hbd_cl₁ hdiff₁ (Or.inl (Or.inr he)) ⟨q, hqe, hq_Λ₁⟩ + refine ⟨he, he_Λ₁.trans subset_closure, fun v hv_end => ?_⟩ + have hvV : v ∈ H.V := hv_end.2.1 + by_cases huv : u = v + · exact Or.inl (huv ▸ huC₁) + · have hadj : H.toHypergraph.skeleton.Adj u v := ⟨huv, e, hu_end, hv_end⟩ + rcases subset_sepComp_union H.toHypergraph.skeleton Z₁ hvV with (hv1 | hv2) | hvX + · exact Or.inl hv1 + · exact (not_adj_sepCompLeft_sepCompRight huC₁ hv2 hadj).elim + · exact Or.inr hvX + have hE₂_ends : ∀ e ∈ H.E \ E₁, H.toHypergraph.ends e ⊆ C₂ ∪ X := by + intro e ⟨he, he_not⟩ v hv_end + have hvV : v ∈ H.V := hv_end.2.1 + rcases subset_sepComp_union H.toHypergraph.skeleton Z₁ hvV with (hv1 | hv2) | hvX + · exact (he_not (hE₁_of_C₁ e he v hv_end hv1)).elim + · exact Or.inl hv2 + · exact Or.inr hvX + let A : Hypergraph S (Set S) := + { vertexSet := C₁ ∪ X + edgeSet := E₁ + Inc := fun e v => e ∈ E₁ ∧ H.toHypergraph.Inc e v + vertex_mem_of_inc := fun _ _ ⟨he, hv⟩ => he.2.2 hv + edge_mem_of_inc := fun _ _ h => h.1 + vertexSet_finite := H.finite_V.subset (union_subset hC₁_sub hX_sub) + edgeSet_finite := H.finite_edges.subset fun _ h => h.1 } + let B : Hypergraph S (Set S) := + { vertexSet := C₂ ∪ X + edgeSet := H.E \ E₁ + Inc := fun e v => e ∈ H.E \ E₁ ∧ H.toHypergraph.Inc e v + vertex_mem_of_inc := fun e _ ⟨he, hv⟩ => hE₂_ends e he hv + edge_mem_of_inc := fun _ _ h => h.1 + vertexSet_finite := H.finite_V.subset (union_subset hC₂_sub hX_sub) + edgeSet_finite := H.finite_edges.subset sdiff_subset } + have hsep_AB : H.toHypergraph.IsSeparation A B := by + have hA : A ≤ H.toHypergraph := + ⟨union_subset hC₁_sub hX_sub, fun _ h => h.1, fun e he => by + ext v + exact ⟨fun h => ⟨he, h⟩, fun h => h.2⟩⟩ + have hB : B ≤ H.toHypergraph := + ⟨union_subset hC₂_sub hX_sub, sdiff_subset, fun e he => by + ext v + exact ⟨fun h => ⟨he, h⟩, fun h => h.2⟩⟩ + exact path_separator_partitions_the_drawing Z₁ X hA hB rfl rfl rfl + have hinter_AB : (A ∩ B).vertexSet = X := by + change (C₁ ∪ X) ∩ (C₂ ∪ X) = X + ext v + simp only [mem_inter_iff, mem_union] + constructor + · rintro ⟨h1 | hX1, h2 | hX2⟩ + · exact (disjoint_left.mp (disjoint_sepCompLeft_sepCompRight _ _ _ _) h1 h2).elim + · exact hX2 + · exact hX1 + · exact hX1 + · intro hv + exact ⟨Or.inr hv, Or.inr hv⟩ + have hord_AB : separationOrder A B = X.ncard := by + unfold Hypergraph.separationOrder + rw [hinter_AB] + -- Every edge `e ∈ H.E` with `e ⊆ closure Λ₂` belongs to `E₁ = A.edgeSet`. + have he_E₁_of_cl₂ : ∀ e ∈ H.E, e ⊆ closure Λ₂ → e ∈ E₁ := by + intro e he he_cl₂ + refine ⟨he, he_cl₂.trans (hcl₂_sub_Λ₁.trans subset_closure), fun v hv_end => ?_⟩ + exact hZ₁_C₁X ⟨hv_end.2.1, isClosed_closure.closure_subset_iff.mpr he_cl₂ hv_end.2.2⟩ + -- Pick an edge `e₀ ∈ C_in.E`. + have hCinE_ne : C_in.E.Nonempty := by + obtain ⟨_, W_C, _, hpos, _, hCE⟩ := hCin + cases W_C with + | nil _ => exact absurd hpos (Nat.lt_irrefl 0) + | @cons _ _ _ f _ _ => exact ⟨f, by rw [hCE]; exact List.mem_cons_self⟩ + obtain ⟨e₀, he₀C⟩ := hCinE_ne + have he₀H : e₀ ∈ H.E := hCinH.2 he₀C + have he₀_CU : e₀ ⊆ C_in.U := fun x hx => (he₀C.2.1 hx).1 + have he₀_cl₂ : e₀ ⊆ closure Λ₂ := + he₀_CU.trans (hbd_cl₂ ▸ subBd_eq_frontier (closure Λ₂) ▸ + hZone₂.isClosedDisc_closure.isCompact.isClosed.frontier_subset) + have he₀_E₁ : e₀ ∈ A.edgeSet := he_E₁_of_cl₂ e₀ he₀H he₀_cl₂ + have hAE_ne_z : A.edgeSet ≠ {z} := by + intro heq + have he₀z : e₀ = z := mem_singleton_iff.mp (heq ▸ he₀_E₁) + obtain ⟨p, hp⟩ := he₀C.1 + have hp_Λ₂ : p ∈ Λ₂ := hZone₂.z_subset (he₀z ▸ hp) + exact (hdiff₂ ▸ hp_Λ₂).2 (he₀_CU hp) + have hE : H.E.Nonempty := ⟨e₀, he₀H⟩ + -- By `(7.3)` (`theorem_7_3_proof`), `(B, A) ∉ T`, so `(A, B) ∈ T`. + have hBA_not_T : (B, A) ∉ T := by + intro hBA + obtain ⟨e, heA, hdist_ge⟩ := + theorem_7_3_proof H θ T d B A z hS hConn hE hMetric hz hBA hAE_ne_z + have hle_e : d z e ≤ 3 * beta + 3 := hZone₁.dist_le e (Or.inl (Or.inr heA.1)) heA.2.1 + have hord_BA : separationOrder B A = X.ncard := by + rw [GM10.separationOrder_comm, hord_AB] + omega + have hAB_T : (A, B) ∈ T := by + rcases hMetric.1.2.1.isPretangle.axiom1 hsep_AB (by omega) with hAB | hBA + · exact hAB + · exact (hBA_not_T hBA).elim + -- Unpack radial drawing `K` and derived slope `ins`, and apply XI (6.3). + rcases hMetric with ⟨hResp, K, ins, hK, hd, hd_eq⟩ + have hrf := GM11.regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hE + have hT_eq := (GM11.theorem_6_3_proof S hS hConn (PaintingOrDrawing.drawing H) K θ T ins + hResp.1 hE hResp.2.1.isPretangle hResp.2.2 hK hd).2 + have hsm : IsSmall K ins (2 * θ) H.V θ (PaintingOrDrawing.regionsIncludingEdge K A) := by + have hmem : (A, B) ∈ inducedPretangle (PaintingOrDrawing.drawing H) K θ ins := + hT_eq ▸ hAB_T + exact hmem.2.2 + let Z_A := PaintingOrDrawing.regionsIncludingEdge K A + let N := boundaryDrawing K Z_A + have hNs : N.IsSubdrawing K := Drawing.span_isSubdrawing K _ _ + -- Every region `r ∈ K.R` meeting `Λ₂` belongs to `Z_A`. + have hr_in_ZA : ∀ r ∈ K.R, (r ∩ Λ₂).Nonempty → r ∈ Z_A := by + exact inner_zone_regions_are_on_first_tangle_side (S := S) hS (H := H) (C_in := C_in) (beta + := beta) (d := d) (z := z) (Λ₂ := Λ₂) hCinH hbd_cl₂ hdiff₂ hZone₂ A he_E₁_of_cl₂ K hK + hrf + -- Hence `N.U` is disjoint from `Λ₂`. + have hdis_NU_Λ₂ : Disjoint N.U Λ₂ := by + exact first_tangle_side_boundary_avoids_inner_zone (S := S) hS (H := H) (beta := beta) (d := + d) (z := z) (Λ₂ := Λ₂) hZone₂ K A hNs hr_in_ZA + -- Choose a point `y₀ ∈ Λ₂ \ K.U` and its region `r₀ ∈ Z_A`. + obtain ⟨y₀, hy₀_Λ₂, hy₀_not_KU⟩ := + exists_notMem_U hS hZone₂.isOpenDisc.1 (IsOpenDisc.nonempty hZone₂.isOpenDisc) + let r₀ := connectedComponentIn (univ \ K.U) y₀ + have hr₀R : r₀ ∈ K.R := (mem_R_iff K).mpr ⟨y₀, hy₀_not_KU, rfl⟩ + have hy₀_r₀ : y₀ ∈ r₀ := mem_connectedComponentIn ⟨mem_univ y₀, hy₀_not_KU⟩ + have hr₀_ZA : r₀ ∈ Z_A := hr_in_ZA r₀ hr₀R ⟨y₀, hy₀_r₀, hy₀_Λ₂⟩ + obtain ⟨D, hD, hDsN, hDlen, hr₀_D⟩ := hsm.2 r₀ hr₀_ZA + have hDsK : D.IsSubdrawing K := hDsN.trans hNs + obtain ⟨hDdisc, hDbd, -⟩ := hd D hD hDsK hDlen + have hdis_Λ₂_frD : Disjoint Λ₂ (frontier (ins D)) := by + rw [← subBd_eq_frontier, hDbd] + exact (disjoint_of_subset_left hDsN.U_subset hdis_NU_Λ₂).symm + have hΛ₂_in_D : Λ₂ ⊆ ins D := + subset_of_disjoint_frontier hZone₂.isOpenDisc.isPathConnected.isConnected.isPreconnected + hDdisc.isCompact.isClosed hdis_Λ₂_frD hy₀_Λ₂ (hr₀_D hy₀_r₀) + have hcl₂_in_D : closure Λ₂ ⊆ ins D := + hDdisc.isCompact.isClosed.closure_subset_iff.mpr hΛ₂_in_D + -- Bound `d z e₀ ≤ (D.V ∩ H.V).ncard ≤ X.ncard < beta`. + obtain ⟨p_z, hp_z⟩ := atom_nonempty hz + have hz_D : (z ∩ ins D).Nonempty := ⟨p_z, hp_z, hΛ₂_in_D (hZone₂.z_subset hp_z)⟩ + have he₀A : e₀ ∈ H.A := Or.inl (Or.inr he₀H) + obtain ⟨p_e, hp_e⟩ := he₀C.1 + have he₀_D : (e₀ ∩ ins D).Nonempty := ⟨p_e, hp_e, hcl₂_in_D (he₀_cl₂ hp_e)⟩ + have hDV_sub_X : D.V ∩ H.V ⊆ X := by + rintro v ⟨hvD, hvH⟩ + rw [← hinter_AB] + exact GM11.boundary_vertex hS hrf hsep_AB hvH (hDsN.1 hvD) + have hcard_le : (D.V ∩ H.V).ncard ≤ X.ncard := + ncard_le_ncard hDV_sub_X (H.finite_V.subset hX_sub) + have hd_le : d z e₀ ≤ X.ncard := by + rw [hd_eq z hz e₀ he₀A] + exact (tangleMetric_le_of_circuit hS hK hd hD hDsK hDlen hz he₀A hz_D he₀_D).2.trans hcard_le + have he₀_sub_Λ₂ : e₀ ⊆ Λ₂ := hsub₂ e₀ he₀A (by omega) + exact (hdiff₂ ▸ he₀_sub_Λ₂ hp_e).2 (he₀_CU hp_e) + +/-! ## 5. Splitting Uncrossed Paths and Proof of (9.5) -/ + +private theorem no_self_loop_in_simple_walk {α β : Type*} {G : Graph α β} {a b x : α} {f : β} + (W : GraphWalk G a b) (hnd : W.IsSimple) (hf : f ∈ W.edges) (hlink : G.IsLink f x x) : + False := by + induction W with + | nil _ => simp at hf + | @cons u w _ e₀ hl₀ r₀ ih => + rcases List.mem_cons.mp hf with rfl | hfr₀ + · have huv : u = x := by rcases hl₀.left_eq_or_eq hlink with h | h <;> exact h + have hwv : w = x := by rcases hl₀.symm.left_eq_or_eq hlink with h | h <;> exact h + exact (List.nodup_cons.mp hnd).1 ((huv.trans hwv.symm) ▸ r₀.start_mem_support) + · exact ih (List.nodup_cons.mp hnd).2 hfr₀ + +/-- If `P` is a path of `H` from `a` to `b ∉ Δ` (where `C` is a circuit of `H` bounding the closed +disc `Δ` with `subBd Δ = C.U` and `Λ = Δ \ C.U`) such that `Drawing.inf H C P` is a path, then +splitting `P` at its first vertex `v ∈ C.V` yields: +- an inner path `P_in` of `H` from `a` to `v` with `P_in.U ∩ (H.U ∩ C.U) = {v}`, and +- an outer path `P_out` of `H` from `v` to `b` with `Disjoint P_out.U Λ`, +both with vertex sets contained in `P.V`. -/ +private theorem split_uncrossed_path_at_circuit [T2Space S] + (hS : IsClosedSurface S) {H C P : Drawing S} {Δ : Set S} {a b : S} + (hCH : C.IsSubdrawing H) (hΔ : IsClosedDisc Δ) (hbd : subBd Δ = C.U) + (hPH : P.IsSubdrawing H) (hP : P.IsPathBetween a b) (hb_not_Δ : b ∉ Δ) + (hinf : IsDrawingPath (Drawing.inf H C P)) : + ∃ v ∈ C.V, ∃ P_in P_out : Drawing S, + P_in.IsPathBetween a v ∧ P_in.IsSubdrawing H ∧ P_in.V ⊆ P.V ∧ + P_in.U ∩ (H.U ∩ C.U) = {v} ∧ + P_out.IsPathBetween v b ∧ P_out.IsSubdrawing H ∧ P_out.V ⊆ P.V ∧ + Disjoint P_out.U (Δ \ C.U) := by + obtain ⟨W₀, hW₀s, hVP, hEP⟩ := hP + obtain ⟨W, hsW, heW⟩ := hPH.exists_walk_up W₀ + have hWs : W.IsSimple := by change W.support.Nodup; rw [hsW]; exact hW₀s + have hP_eq : P = walkDrawing H W := by + apply Drawing.ext_of_V_E + · rw [hVP, walkDrawing_V, hsW] + · rw [hEP, walkDrawing_E, heW] + have hne_W : ∃ x ∈ W.support, x ∈ C.V := by + obtain ⟨x, _, WI, _, hVI, _⟩ := hinf + have hxI : x ∈ (Drawing.inf H C P).V := by rw [hVI]; exact WI.start_mem_support + rw [Drawing.inf_V hCH hPH, hVP, ← hsW] at hxI + exact ⟨x, hxI.2, hxI.1⟩ + obtain ⟨v, hvC, W_in, W_out, hsplit, hW_in_first⟩ := exists_first_hit_split W hne_W + have hsp := GM09.isSimple_of_append (hsplit ▸ hWs) + let P_in := walkDrawing H W_in + let P_out := walkDrawing H W_out + have hPin_V : P_in.V ⊆ P.V := by + intro x hx + rw [hP_eq, hsplit, walkDrawing_V, mem_ofPred_eq, GraphWalk.mem_support_append] + rw [walkDrawing_V, mem_ofPred_eq] at hx + exact Or.inl hx + have hPout_V : P_out.V ⊆ P.V := by + intro x hx + rw [hP_eq, hsplit, walkDrawing_V, mem_ofPred_eq, GraphWalk.mem_support_append] + rw [walkDrawing_V, mem_ofPred_eq] at hx + exact Or.inr hx + have hW_in_no_edge : ∀ f ∈ W_in.edges, f ∉ C.E := by + intro f hf hfC + obtain ⟨x, y, hxyH⟩ := (H.toGraph.edge_mem_iff_exists_isLink f).mp (hCH.2 hfC) + have hxyC : C.toGraph.IsLink f x y := (hCH.isLink_iff hfC).mpr hxyH + have hx_s : x ∈ W_in.support := W_in.left_mem_support_of_mem_edges hf hxyH + have hy_s : y ∈ W_in.support := W_in.left_mem_support_of_mem_edges hf hxyH.symm + have hxv : x = v := hW_in_first x hx_s hxyC.2.1 + have hyv : y = v := hW_in_first y hy_s hxyC.2.2.1 + exact no_self_loop_in_simple_walk W_in hsp.1 hf ((hxv.trans hyv.symm) ▸ hxyH) + have hdisjE_in : Disjoint P_in.E C.E := by + rw [walkDrawing_E] + exact disjoint_left.mpr hW_in_no_edge + have hPin_inter : P_in.U ∩ (H.U ∩ C.U) = {v} := by + rw [inter_eq_right.mpr hCH.U_subset, + U_inter_of_disjoint (walkDrawing_isSubdrawing H W_in) hCH hdisjE_in, walkDrawing_V] + ext x + simp only [mem_inter_iff, mem_ofPred_eq, mem_singleton_iff] + refine ⟨fun ⟨hx₁, hxC⟩ => hW_in_first x hx₁ hxC, ?_⟩ + rintro rfl + exact ⟨W_in.end_mem_support, hvC⟩ + -- Show `Disjoint P_out.U (Δ \ C.U)` using `walk_subset_disc_or_exists_outer_detour`. + have hPout_disj : Disjoint P_out.U (Δ \ C.U) := by + let Λ := Δ \ C.U + let Δ_ext := univ \ Λ + have hΛ_eq_int : Λ = interior Δ := by + change Δ \ C.U = interior Δ + rw [← hbd, subBd_eq_frontier] + exact self_sdiff_frontier _ + have hΛ_open : IsOpen Λ := hΛ_eq_int ▸ isOpen_interior + have hΔ_ext_closed : IsClosed Δ_ext := isClosed_univ.sdiff hΛ_open + have hfr_ext : frontier Δ_ext = C.U := by + change frontier (univ \ (Δ \ C.U)) = C.U + rw [← compl_eq_univ_sdiff, frontier_compl, ← subBd_eq_frontier, ← hbd] + exact (IsClosedDisc.isOpenDisc_diff_subBd hS hΔ).2.2 + have hb_ext : b ∈ Δ_ext \ C.U := by + refine ⟨⟨mem_univ b, fun hbΛ => hb_not_Δ hbΛ.1⟩, fun hbCU => hb_not_Δ ?_⟩ + exact hΔ.isCompact.isClosed.frontier_subset (subBd_eq_frontier Δ ▸ hbd ▸ hbCU) + rcases walk_subset_disc_or_exists_outer_detour hCH hΔ_ext_closed hfr_ext W_out hsp.2 hvC hb_ext + with hsub_ext | ⟨u₁, hu₁C, u₂, hu₂C, hu12, W_pre, W_sub, W_post, hout_eq, hVC, hEC, _⟩ + · exact disjoint_left.mpr fun x hxP hxΛ => (hsub_ext hxP).2 hxΛ + · exfalso + let W_A := W_in.append W_pre + let W_B := W_post + have hW_eq : W = W_A.append (W_sub.append W_B) := by + rw [hsplit, hout_eq, GraphWalk.append_assoc] + let P_A := walkDrawing H W_A + let P_sub := walkDrawing H W_sub + let P_B := walkDrawing H W_B + let I := Drawing.inf H C P + have hsub_CU : P_sub.U ∩ C.U = {u₁, u₂} := by + rw [U_inter_of_disjoint (walkDrawing_isSubdrawing H W_sub) hCH hEC, hVC] + have hI_U : I.U = C.U ∩ P.U := Drawing.inf_U hCH hPH + have hP_U : P.U = P_A.U ∪ (P_sub.U ∪ P_B.U) := by + rw [hP_eq, hW_eq, walkDrawing_append_U H W_A (W_sub.append W_B), + walkDrawing_append_U H W_sub W_B] + have hu₁_PA : u₁ ∈ P_A.U := + (walkDrawing H W_A).V_subset_U (by rw [walkDrawing_V]; exact W_A.end_mem_support) + have hu₂_PB : u₂ ∈ P_B.U := + (walkDrawing H W_B).V_subset_U (by rw [walkDrawing_V]; exact W_B.start_mem_support) + have hI_sub : I.U ⊆ P_A.U ∪ P_B.U := by + intro x hxI + rw [hI_U, hP_U] at hxI + rcases hxI with ⟨hxC, hxA | hx_sub | hxB⟩ + · exact Or.inl hxA + · have hx12 : x ∈ ({u₁, u₂} : Set S) := hsub_CU ▸ ⟨hx_sub, hxC⟩ + rcases hx12 with rfl | rfl + · exact Or.inl hu₁_PA + · exact Or.inr hu₂_PB + · exact Or.inr hxB + have hu₁_I : u₁ ∈ I.U := by + rw [hI_U, hP_U] + exact ⟨C.V_subset_U hu₁C, Or.inl hu₁_PA⟩ + have hu₂_I : u₂ ∈ I.U := by + rw [hI_U, hP_U] + exact ⟨C.V_subset_U hu₂C, Or.inr (Or.inr hu₂_PB)⟩ + obtain ⟨z, _, hzA, hzB⟩ := + isPreconnected_closed_iff.mp hinf.isPreconnected_U P_A.U P_B.U P_A.isClosed_U + P_B.isClosed_U hI_sub ⟨u₁, hu₁_I, hu₁_PA⟩ ⟨u₂, hu₂_I, hu₂_PB⟩ + have hA_inter : P_A.U ∩ (walkDrawing H (W_sub.append W_B)).U = {u₁} := + walkDrawing_append_U_inter W_A (W_sub.append W_B) (hW_eq ▸ hWs) + have hB_inter : (walkDrawing H (W_A.append W_sub)).U ∩ P_B.U = {u₂} := + walkDrawing_append_U_inter (W_A.append W_sub) W_B + (by rw [GraphWalk.append_assoc, ← hW_eq]; exact hWs) + have hzu₁ : z = u₁ := by + have hz_in : z ∈ P_A.U ∩ (walkDrawing H (W_sub.append W_B)).U := by + rw [walkDrawing_append_U H W_sub W_B] + exact ⟨hzA, Or.inr hzB⟩ + rwa [hA_inter, mem_singleton_iff] at hz_in + have hzu₂ : z = u₂ := by + have hz_in : z ∈ (walkDrawing H (W_A.append W_sub)).U ∩ P_B.U := by + rw [walkDrawing_append_U H W_A W_sub] + exact ⟨Or.inl hzA, hzB⟩ + rwa [hB_inter, mem_singleton_iff] at hz_in + exact hu12 (hzu₁.symm.trans hzu₂) + exact ⟨v, hvC, P_in, P_out, + walkDrawing_isPathBetween H hsp.1, walkDrawing_isSubdrawing H W_in, hPin_V, hPin_inter, + walkDrawing_isPathBetween H hsp.2, walkDrawing_isSubdrawing H W_out, hPout_V, hPout_disj⟩ + +private theorem optimal_circuit_gives_rigid_cleared_zone + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (H : Drawing S) + (beta : ℕ) + (d : Set S → Set S → ℕ) + (z : Set S) + (hS : IsClosedSurface S) + (hRig : IsRigid H) + (hbeta : 4 ≤ beta) + [this : ConnectedSpace S] + (C_in : Drawing S) + (C_out : Drawing S) + (Λ₁ : Set S) + (C₀ : Fin (beta + 1) → Drawing S) + (hZone₁ : IsLambdaZoneAround H d (3 * beta + 3) z Λ₁) + (hbd_disc₁ : discBd (closure Λ₁) = C_out.U) + (h : Fin (beta + 1)) + (hh : h.val = beta / 2 + 1) + (C : Fin (beta + 1) → Drawing S) + (P : Fin beta → Drawing S) + (hC : IsDiscNest H (closure Λ₁) C_in C_out C) + (hmono : ∀ (j : Fin (beta + 1)), discIns (closure Λ₁) (C₀ j) ⊆ discIns (closure Λ₁) (C j)) + (hP : IsDiscPaths H (closure Λ₁) C_in C_out P) + (hk_eq : sInf ({k | ∃ C P, IsDiscNest H (closure Λ₁) C_in C_out C ∧ (∀ (j : Fin (beta + 1)), + discIns (closure Λ₁) (C₀ j) ⊆ discIns (closure Λ₁) (C j)) ∧ IsDiscPaths H (closure Λ₁) C_in + C_out P ∧ (∀ (j : Fin (beta + 1)) (i : Fin beta), IsDrawingPath (Drawing.inf H (C j) (P i))) + ∧ k = H.E.ncard - {e | e ∈ H.E ∧ e ⊆ discIns (closure Λ₁) (C h) \ (C h).U}.ncard}) = + H.E.ncard - {e | e ∈ H.E ∧ e ⊆ discIns (closure Λ₁) (C h) \ (C h).U}.ncard) + (hp_h : discIns (closure Λ₁) (C h) ⊆ closure Λ₁ ∧ IsClosedDisc (discIns (closure Λ₁) (C h)) ∧ + discBd (discIns (closure Λ₁) (C h)) = (C h).U ∧ frontier (discIns (closure Λ₁) (C h)) = (C + h).U ∧ IsClosed (discIns (closure Λ₁) (C h)) ∧ (C h).U ⊆ discIns (closure Λ₁) (C h)) + (hbd_Δ_h : subBd (discIns (closure Λ₁) (C h)) = (C h).U) + (hOD_h' : IsOpenDisc ((discIns (closure Λ₁) (C h)) \ (C h).U)) + (hcl_Λ_h' : closure ((discIns (closure Λ₁) (C h)) \ (C h).U) = (discIns (closure Λ₁) (C h))) + (hbd_Λ_h' : subBd ((discIns (closure Λ₁) (C h)) \ (C h).U) = (C h).U) : + IsRigid (clearedSubdrawing H ((discIns (closure Λ₁) (C h)) \ (C h).U)) := by + let S_cost := {k | ∃ C P, IsDiscNest H (closure Λ₁) C_in C_out C ∧ (∀ (j : Fin (beta + 1)), + discIns (closure Λ₁) (C₀ j) ⊆ discIns (closure Λ₁) (C j)) ∧ IsDiscPaths H (closure Λ₁) C_in + C_out P ∧ (∀ (j : Fin (beta + 1)) (i : Fin beta), IsDrawingPath (Drawing.inf H (C j) (P i))) ∧ + k = H.E.ncard - {e | e ∈ H.E ∧ e ⊆ discIns (closure Λ₁) (C h) \ (C h).U}.ncard} + let Δ_h := discIns (closure Λ₁) (C h) + let Λ_h := Δ_h \ (C h).U + by_contra hnot_rig + let h_next : Fin (beta + 1) := ⟨beta / 2 + 2, by omega⟩ + have hh_lt_next : h < h_next := by + change h.val < beta / 2 + 2 + omega + let Δ_next := discIns (closure Λ₁) (C h_next) + have hp_next := hC.disc_props hS hZone₁.isClosedDisc_closure h_next + have hbd_Δ_next : subBd Δ_next = (C h_next).U := by + rw [subBd_eq_frontier, hp_next.2.2.2.1] + have hcl_h_sub_next : closure Λ_h ⊆ Δ_next \ subBd Δ_next := by + rw [hcl_Λ_h', hbd_Δ_next] + exact (hC.discIns_subset_diff hS hZone₁.isClosedDisc_closure hh_lt_next).2 + have hCD_h : IsClosedDisc (closure Λ_h) := hcl_Λ_h' ▸ hp_h.2.1 + have hbd_cl_h : subBd (closure Λ_h) = (C h).U := hcl_Λ_h' ▸ hbd_Δ_h + have hdiff_h : closure Λ_h \ (C h).U = Λ_h := by rw [hcl_Λ_h'] + obtain ⟨C'_h, Λ'_h, hC'H, hC'circ, _, hOD', hcl'_sub, hCD', hbd', hbd_cl', hdiff', + hΛ_sub, _, hncard_lt⟩ := + enlarge_disc_past_disconnected_region hS hRig hp_next.2.1 + (hbd_Δ_next ▸ (hC.1 h_next).1.U_subset) (hC.1 h).2.1 (hC.1 h).1 hOD_h' + hCD_h hbd_Λ_h' hbd_cl_h hdiff_h hcl_h_sub_next hnot_rig + have hcl'_sub_₁ : closure Λ'_h ⊆ closure Λ₁ := + (hcl'_sub.trans sdiff_subset).trans hp_next.1 + have hC'_U_sub_cl' : C'_h.U ⊆ closure Λ'_h := by + rw [← hbd_cl', subBd_eq_frontier] + exact hCD'.isCompact.isClosed.frontier_subset + have hC'_U_sub_₁ : C'_h.U ⊆ closure Λ₁ := hC'_U_sub_cl'.trans hcl'_sub_₁ + obtain ⟨_, huniq_C'⟩ := discIns_spec hZone₁.isClosedDisc_closure hC'circ hC'_U_sub_₁ + have hdiscIns_C' : discIns (closure Λ₁) C'_h = closure Λ'_h := + (huniq_C' (closure Λ'_h) hcl'_sub_₁ hCD' + ((IsClosedDisc.subBd_eq_discBd hS hCD').symm.trans hbd_cl')).symm + let C_new : Fin (beta + 1) → Drawing S := Function.update C h C'_h + have hC_new_strict : ∀ j₁ j₂ : Fin (beta + 1), j₁ < j₂ → + discIns (closure Λ₁) (C_new j₁) ⊆ discIns (closure Λ₁) (C_new j₂) \ (C_new j₂).U := by + intro j₁ j₂ hj12 + by_cases hj₁h : j₁ = h + · subst j₁ + have hj₂_ne_h : j₂ ≠ h := hj12.ne' + simp only [C_new, Function.update_self, Function.update_of_ne hj₂_ne_h, hdiscIns_C'] + have hnext_le_j₂ : h_next ≤ j₂ := by + change beta / 2 + 2 ≤ j₂.val + change h.val < j₂.val at hj12 + omega + rcases eq_or_lt_of_le hnext_le_j₂ with rfl | hlt_j₂ + · rwa [← hbd_Δ_next] + · exact (hcl'_sub.trans sdiff_subset).trans + (hC.discIns_subset_diff hS hZone₁.isClosedDisc_closure hlt_j₂).2 + · by_cases hj₂h : j₂ = h + · subst j₂ + simp only [C_new, Function.update_self, Function.update_of_ne hj₁h, hdiscIns_C', hdiff'] + exact (hC.discIns_subset_diff hS hZone₁.isClosedDisc_closure hj12).2.trans hΛ_sub + · simp only [C_new, Function.update_of_ne hj₁h, Function.update_of_ne hj₂h] + exact (hC.discIns_subset_diff hS hZone₁.isClosedDisc_closure hj12).2 + have hC_new_U_sub : ∀ j : Fin (beta + 1), (C_new j).U ⊆ discIns (closure Λ₁) (C_new j) := by + intro j + by_cases hjh : j = h + · subst j + simp only [C_new, Function.update_self, hdiscIns_C'] + exact hC'_U_sub_cl' + · simp only [C_new, Function.update_of_ne hjh] + exact (hC.disc_props hS hZone₁.isClosedDisc_closure j).2.2.2.2.2 + have hC_new_nest : IsDiscNest H (closure Λ₁) C_in C_out C_new := by + refine ⟨fun j => ?_, fun j₁ j₂ hj12 => ?_, fun j₁ j₂ hj12 => ?_, fun hs => ⟨?_, ?_⟩⟩ + · by_cases hjh : j = h + · subst j + simp only [C_new, Function.update_self] + exact ⟨hC'H, hC'circ, hC'_U_sub_₁⟩ + · simp only [C_new, Function.update_of_ne hjh] + exact hC.1 j + · have key : ∀ a b : Fin (beta + 1), a < b → Disjoint (C_new a).V (C_new b).V := by + intro a b hab + refine disjoint_of_subset (C_new a).V_subset_U (C_new b).V_subset_U ?_ + refine disjoint_left.mpr fun x hxa hxb => ?_ + exact (hC_new_strict a b hab (hC_new_U_sub a hxa)).2 hxb + rcases lt_or_gt_of_ne hj12 with hlt | hgt + · exact key j₁ j₂ hlt + · exact (key j₂ j₁ hgt).symm + · rcases eq_or_lt_of_le hj12 with rfl | hlt + · exact Subset.rfl + · exact (hC_new_strict j₁ j₂ hlt).trans sdiff_subset + · have h0_ne : (⟨0, hs⟩ : Fin (beta + 1)) ≠ h := by + intro heq + have : 0 = h.val := congrArg Fin.val heq + omega + simp only [C_new, Function.update_of_ne h0_ne] + exact (hC.2.2.2 hs).1 + · have hlast_ne : (⟨beta + 1 - 1, Nat.sub_lt hs zero_lt_one⟩ : Fin (beta + 1)) ≠ h := by + intro heq + have : beta + 1 - 1 = h.val := congrArg Fin.val heq + omega + simp only [C_new, Function.update_of_ne hlast_ne] + exact (hC.2.2.2 hs).2 + have hmono_new : ∀ j : Fin (beta + 1), + discIns (closure Λ₁) (C₀ j) ⊆ discIns (closure Λ₁) (C_new j) := by + intro j + by_cases hjh : j = h + · subst j + simp only [C_new, Function.update_self, hdiscIns_C'] + refine (hmono h).trans ?_ + have hs : closure (discIns (closure Λ₁) (C h) \ (C h).U) ⊆ closure Λ'_h := + closure_mono hΛ_sub + rw [hcl_Λ_h'] at hs + exact hs + · simp only [C_new, Function.update_of_ne hjh] + exact hmono j + obtain ⟨C'', P'', hC'', hmono'', hP'', hinf''⟩ := + planar_nest_uncrossing_mono hS hZone₁.isClosedDisc_closure hbd_disc₁ C_new hC_new_nest ⟨P, hP⟩ + have hcl'_sub_C'' : closure Λ'_h ⊆ discIns (closure Λ₁) (C'' h) := by + have := hmono'' h + simpa [C_new, hdiscIns_C'] using this + have hp''_h := hC''.disc_props hS hZone₁.isClosedDisc_closure h + have hint_C'' : interior (discIns (closure Λ₁) (C'' h)) = + discIns (closure Λ₁) (C'' h) \ (C'' h).U := by + rw [← hp''_h.2.2.2.1] + exact (self_sdiff_frontier _).symm + have hΛ'_sub_C'' : Λ'_h ⊆ discIns (closure Λ₁) (C'' h) \ (C'' h).U := by + rw [← hint_C'', ← hOD'.1.interior_eq] + exact interior_mono (subset_closure.trans hcl'_sub_C'') + let E_old := {e ∈ H.E | e ⊆ Λ_h} + let E_new := {e ∈ H.E | e ⊆ discIns (closure Λ₁) (C'' h) \ (C'' h).U} + have hcard_lt : E_old.ncard < E_new.ncard := + lt_of_lt_of_le hncard_lt (ncard_le_ncard + (fun e ⟨heH, he_sub⟩ => ⟨heH, he_sub.trans hΛ'_sub_C''⟩) + (H.finite_edges.subset fun _ h => h.1)) + have hnew_le_H : E_new.ncard ≤ H.E.ncard := + ncard_le_ncard (fun _ h => h.1) H.finite_edges + have hmem_new : H.E.ncard - E_new.ncard ∈ S_cost := + ⟨C'', P'', hC'', fun j => (hmono_new j).trans (hmono'' j), hP'', hinf'', rfl⟩ + have hle_sInf : sInf S_cost ≤ H.E.ncard - E_new.ncard := Nat.sInf_le hmem_new + change sInf S_cost = H.E.ncard - E_old.ncard at hk_eq + omega + +/-- **Graph Minors XIV, (9.5)** (pages 45–47), proving `GM16.GM14Theorem95Statement`: +"Let $H$ be a 2-cell, rigid drawing in $\Sigma$, let $z \in A(H)$, and let $\mathscr{T}$ be a +respectful tangle in $H$ of order $\theta$. Let $\beta \ge 4$ be an even integer with +$\theta \ge 16\beta + 17$. Then there is a battlefield around $z$ of size $\beta$." -/ +theorem theorem_9_5_proof : + GM16.GM14Theorem95Statement.{w} := by + intro S _ _ H θ beta T d z hS hConn hRig hMetric hz hbeta heven hθ + have : ConnectedSpace S := hConn + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + -- Step 1: Claim (1) gives `C_in`, `C_out`, `Λ₁`, `Λ₂`, and the initial nest `C₀`. + obtain ⟨C_in, C_out, Λ₁, Λ₂, C₀, hCinH, hCin, hbd₂, hbd_cl₂, hdiff₂, hZone₂, hsub₂, + hCoutH, hCout, hbd₁, hbd_cl₁, hdiff₁, hZone₁, hsub₁, hcl₂_sub_Λ₁, hC₀_nest, hdiscIns_0⟩ := + lemma_9_5_claim_1 hS hConn hMetric hz hbeta hθ + -- Step 2: Claim (2) gives `beta` disjoint paths `P₀` between `C_in.V` and `C_out.V` in `closure + -- Λ₁`. + obtain ⟨P₀, hP₀⟩ := + lemma_9_5_claim_2 hS hConn hMetric hz hbeta hθ hCinH hCin hbd_cl₂ hdiff₂ hZone₂ hsub₂ + hCoutH hbd_cl₁ hdiff₁ hZone₁ hcl₂_sub_Λ₁ + -- Step 3: Claim (3) and choosing `(C, P)` maximizing `Δ_h` (`h = beta / 2 + 1` in 0-indexed `Fin + -- (beta + 1)`). + have hbd_disc₁ : discBd (closure Λ₁) = C_out.U := by + rw [← IsClosedDisc.subBd_eq_discBd hS hZone₁.isClosedDisc_closure, hbd_cl₁] + let h : Fin (beta + 1) := ⟨beta / 2 + 1, by omega⟩ + let S_cost : Set ℕ := {k : ℕ | ∃ (C : Fin (beta + 1) → Drawing S) (P : Fin beta → Drawing S), + IsDiscNest H (closure Λ₁) C_in C_out C ∧ + (∀ j : Fin (beta + 1), discIns (closure Λ₁) (C₀ j) ⊆ discIns (closure Λ₁) (C j)) ∧ + IsDiscPaths H (closure Λ₁) C_in C_out P ∧ + (∀ (j : Fin (beta + 1)) (i : Fin beta), IsDrawingPath (Drawing.inf H (C j) (P i))) ∧ + k = H.E.ncard - {e ∈ H.E | e ⊆ discIns (closure Λ₁) (C h) \ (C h).U}.ncard} + have hScost_ne : S_cost.Nonempty := by + obtain ⟨C, P, hC, hmono, hP, hinf⟩ := + planar_nest_uncrossing_mono hS hZone₁.isClosedDisc_closure hbd_disc₁ C₀ hC₀_nest ⟨P₀, hP₀⟩ + exact ⟨_, C, P, hC, hmono, hP, hinf, rfl⟩ + obtain ⟨C, P, hC, hmono, hP, hinf, hk_eq⟩ := Nat.sInf_mem hScost_ne + let Δ_h := discIns (closure Λ₁) (C h) + let Λ_h := Δ_h \ (C h).U + have hp_h := hC.disc_props hS hZone₁.isClosedDisc_closure h + have hbd_Δ_h : subBd Δ_h = (C h).U := by + rw [subBd_eq_frontier, hp_h.2.2.2.1] + obtain ⟨hOD_h, hcl_Λ_h, hbd_Λ_h⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hp_h.2.1 + have hOD_h' : IsOpenDisc Λ_h := by + change IsOpenDisc (Δ_h \ (C h).U) + rwa [← hbd_Δ_h] + have hcl_Λ_h' : closure Λ_h = Δ_h := by + change closure (Δ_h \ (C h).U) = Δ_h + rwa [← hbd_Δ_h] + have hbd_Λ_h' : subBd Λ_h = (C h).U := by + change subBd (Δ_h \ (C h).U) = (C h).U + rw [← hbd_Δ_h, hbd_Λ_h, hbd_Δ_h] + -- Step 4: Claim (4) (`IsRigid (clearedSubdrawing H Λ_h)`). + have hRig_h : IsRigid (clearedSubdrawing H Λ_h) := by + exact optimal_circuit_gives_rigid_cleared_zone (S := S) H beta d z hS hRig hbeta C_in C_out + Λ₁ C₀ hZone₁ hbd_disc₁ h rfl C P hC hmono hP hk_eq hp_h hbd_Δ_h hOD_h' hcl_Λ_h' hbd_Λ_h' + -- Step 5: Assemble the battlefield `(Λ_h, C 0, range v)`. + have h0_pos : 0 < beta + 1 := Nat.succ_pos beta + let i₀ : Fin (beta + 1) := ⟨0, h0_pos⟩ + let i_last : Fin (beta + 1) := ⟨beta, Nat.lt_succ_self beta⟩ + have hC0_eq : C i₀ = C_in := (hC.2.2.2 h0_pos).1 + have hClast_eq : C i_last = C_out := (hC.2.2.2 h0_pos).2 + let Δ₀ := discIns (closure Λ₁) (C i₀) + let Λ₀ := Δ₀ \ (C i₀).U + have hp_0 := hC.disc_props hS hZone₁.isClosedDisc_closure i₀ + have hbd_Δ₀ : subBd Δ₀ = (C i₀).U := by rw [subBd_eq_frontier, hp_0.2.2.2.1] + obtain ⟨hOD_0, _, hbd_Λ₀⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS hp_0.2.1 + have hbd_Λ₀' : subBd Λ₀ = (C i₀).U := by + change subBd (Δ₀ \ (C i₀).U) = (C i₀).U + rw [← hbd_Δ₀, hbd_Λ₀, hbd_Δ₀] + have hcl₂_sub_Δ₀ : closure Λ₂ ⊆ Δ₀ := hdiscIns_0 ▸ hmono i₀ + have hΛ₂_sub_Λ₀ : Λ₂ ⊆ Λ₀ := by + have hint_0 : interior Δ₀ = Λ₀ := by + change interior Δ₀ = Δ₀ \ (C i₀).U + rw [← hp_0.2.2.2.1] + exact (self_sdiff_frontier _).symm + rw [← hint_0, ← hZone₂.isOpenDisc.1.interior_eq] + exact interior_mono (subset_closure.trans hcl₂_sub_Δ₀) + have hi₀_lt_h : i₀ < h := by change 0 < beta / 2 + 1; omega + have hΔ₀_sub_Λ_h : Δ₀ ⊆ Λ_h := + (hC.discIns_subset_diff hS hZone₁.isClosedDisc_closure hi₀_lt_h).2 + have hC0U_sub_Λ_h : (C i₀).U ⊆ Λ_h := hp_0.2.2.2.2.2.trans hΔ₀_sub_Λ_h + have hΛ₀_sub_Λ_h : Λ₀ ⊆ Λ_h := sdiff_subset.trans hΔ₀_sub_Λ_h + have hz_sub_Λ_h : z ⊆ Λ_h := hZone₂.z_subset.trans (hΛ₂_sub_Λ₀.trans hΛ₀_sub_Λ_h) + have hh_lt_last : h < i_last := by + obtain ⟨m, rfl⟩ := heven + change (m + m) / 2 + 1 < m + m + omega + have hΔ_h_sub_Λ₁ : Δ_h ⊆ Λ₁ := by + have hsub := (hC.discIns_subset_diff hS hZone₁.isClosedDisc_closure hh_lt_last).2 + have hlast_eq : discIns (closure Λ₁) (C i_last) = closure Λ₁ := by + rw [hClast_eq] + obtain ⟨_, huniq⟩ := discIns_spec hZone₁.isClosedDisc_closure hCout + (hbd_cl₁ ▸ subBd_eq_frontier (closure Λ₁) ▸ + hZone₁.isClosedDisc_closure.isCompact.isClosed.frontier_subset) + exact (huniq (closure Λ₁) Subset.rfl hZone₁.isClosedDisc_closure hbd_disc₁).symm + rwa [hlast_eq, hClast_eq, hdiff₁] at hsub + have hZone_h : IsLambdaZoneAround H d (3 * beta + 3) z Λ_h := + ⟨hZone₁.z_mem, hOD_h', hz_sub_Λ_h, hbd_Λ_h' ▸ isOArc_of_isCircuit (hC.1 h).2.1, + hcl_Λ_h' ▸ hp_h.2.1, hbd_Λ_h' ▸ (hC.1 h).1.U_subset, + fun x hx hsub => hZone₁.dist_le x hx ((hcl_Λ_h' ▸ hsub).trans hp_h.1), + hZone₁.two_le_of_edge⟩ + -- Split each path `P k` at `(C h).V`. + have hex_split : ∀ k : Fin beta, ∃ a_k ∈ (C i₀).V, ∃ v_k ∈ (C h).V, ∃ b_k ∈ C_out.V, + ∃ P_in P_out : Drawing S, + P_in.IsPathBetween a_k v_k ∧ P_in.IsSubdrawing H ∧ P_in.V ⊆ (P k).V ∧ + P_in.U ∩ (H.U ∩ subBd Λ_h) = {v_k} ∧ + P_out.IsPathBetween v_k b_k ∧ P_out.IsSubdrawing H ∧ P_out.V ⊆ (P k).V ∧ + Disjoint P_out.U Λ_h := by + intro k + obtain ⟨hPkH, _, a_k, ha_k, b_k, hb_k, hPk_path⟩ := hP.1 k + have ha_k' : a_k ∈ (C i₀).V := hC0_eq.symm ▸ ha_k + have hb_k_not_Δ_h : b_k ∉ Δ_h := by + intro hb_in + have hb_Λ₁ : b_k ∈ Λ₁ := hΔ_h_sub_Λ₁ hb_in + exact (hdiff₁ ▸ hb_Λ₁).2 (C_out.V_subset_U hb_k) + obtain ⟨v_k, hv_kC, P_in, P_out, hPin_p, hPin_H, hPin_V, hPin_inter, + hPout_p, hPout_H, hPout_V, hPout_disj⟩ := + split_uncrossed_path_at_circuit hS (hC.1 h).1 hp_h.2.1 hbd_Δ_h hPkH hPk_path + hb_k_not_Δ_h (hinf h k) + rw [← hbd_Λ_h'] at hPin_inter + exact ⟨a_k, ha_k', v_k, hv_kC, b_k, hb_k, P_in, P_out, + hPin_p, hPin_H, hPin_V, hPin_inter, hPout_p, hPout_H, hPout_V, hPout_disj⟩ + choose a_v ha_v v_v hv_v b_v hb_v P_in P_out hPin_p hPin_H hPin_V hPin_inter + hPout_p hPout_H hPout_V hPout_disj using hex_split + -- Obtain cleared tangle `(T', d')` on `clearedSubdrawing H Λ_h` by `(3.2)` (`theorem_3_2_proof`). + obtain ⟨T', d', hCleared, _⟩ := + theorem_3_2_proof hS hConn (by omega) hMetric hZone_h + -- Apply `(7.8)` (`theorem_7_8_proof`) to prove `IsFreeSet ... (range v_v)`. + have hFree_X : IsFreeSet (clearedSubdrawing H Λ_h).toHypergraph T' + (θ - 4 * (3 * beta + 3) - 2) (range v_v) := by + let idx_78 : Fin (beta / 2) → Fin (beta + 1) := fun i => + ⟨beta / 2 + 1 + i.1, by obtain ⟨m, rfl⟩ := heven; have := i.2; omega⟩ + let C_78 : Fin (beta / 2) → Drawing S := fun i => C (idx_78 i) + let Δ_78 : Fin (beta / 2) → Set S := fun i => discIns (closure Λ₁) (C_78 i) + have hv_C : ∀ i : Fin (beta / 2), + (C_78 i).IsCircuit ∧ (C_78 i).IsSubdrawing H ∧ IsClosedDisc (Δ_78 i) ∧ + subBd (Δ_78 i) = (C_78 i).U ∧ Δ_h ⊆ Δ_78 i ∧ Δ_78 i ⊆ closure Λ₁ := by + intro i + have hp_i := hC.disc_props hS hZone₁.isClosedDisc_closure (idx_78 i) + have hh_le_i : h ≤ idx_78 i := by change beta / 2 + 1 ≤ beta / 2 + 1 + i.1; omega + exact ⟨(hC.1 (idx_78 i)).2.1, (hC.1 (idx_78 i)).1, hp_i.2.1, + by rw [subBd_eq_frontier, hp_i.2.2.2.1], hC.2.2.1 hh_le_i, hp_i.1⟩ + have hv_dis : Pairwise (fun i₁ i₂ : Fin (beta / 2) => Disjoint (C_78 i₁).V (C_78 i₂).V) := by + intro i₁ i₂ hne + have hne' : idx_78 i₁ ≠ idx_78 i₂ := fun heq => hne (Fin.ext (by + have := congrArg Fin.val heq; dsimp [idx_78] at this; omega)) + exact hC.2.1 hne' + have hZone₁_mono : IsLambdaZoneAround H d (θ - beta - 4 * (3 * beta + 3) - 2) z + (closure Λ₁ \ subBd (closure Λ₁)) := by + rw [hbd_cl₁, hdiff₁] + obtain ⟨hz_m, hOD₁, hz_s, hOA₁, hCD₁, hbd_s₁, hdist₁, _⟩ := hZone₁ + exact ⟨hz_m, hOD₁, hz_s, hOA₁, hCD₁, hbd_s₁, + fun x hx hsub => (hdist₁ x hx hsub).trans (by omega), + fun _ => by omega⟩ + have hCleared' : IsClearedTangle H T d θ (3 * beta + 3) (Δ_h \ subBd Δ_h) T' d' := by + rwa [hbd_Δ_h] + have hZone_h' : IsLambdaZoneAround H d (3 * beta + 3) z (Δ_h \ subBd Δ_h) := by + rwa [hbd_Δ_h] + have hFree := theorem_7_8_proof hS hConn hbeta heven (by omega) hMetric hCleared' + hCout hCoutH hZone₁.isClosedDisc_closure hbd_cl₁ + (hC.1 h).2.1 (hC.1 h).1 hp_h.2.1 hbd_Δ_h + ⟨by rwa [hbd_Δ_h], by rw [hbd_cl₁, hdiff₁]; exact hΔ_h_sub_Λ₁⟩ + hZone₁_mono hZone_h' + (fun x hx hlt => by rw [hbd_cl₁, hdiff₁]; exact hsub₁ x hx (by omega)) + hv_C hv_dis + (fun k => ⟨hPout_p k, hPout_H k, hv_v k, hb_v k, by rw [hbd_Δ_h]; exact hPout_disj k⟩) + (fun k₁ k₂ hne => disjoint_of_subset (hPout_V k₁) (hPout_V k₂) (hP.2 hne)) + rwa [hbd_Δ_h] at hFree + -- Regional distance bound `(iv)`. + have hdist_iv : 1 + beta / 2 ≤ regionalDistance H (C i₀).U (subBd Λ_h) := by + rw [hbd_Λ_h'] + have hle := nest_regionalDistance_ge hS h0_pos hZone₁.isClosedDisc_closure hC h + change beta / 2 + 1 ≤ regionalDistance H (C i₀).U (C h).U at hle + omega + have hOD_0' : IsOpenDisc Λ₀ := by + change IsOpenDisc (Δ₀ \ (C i₀).U) + rwa [← hbd_Δ₀] + refine ⟨Λ_h, C i₀, range v_v, ?_⟩ + refine ⟨⟨hbeta, heven, by omega, hz⟩, hZone_h, hRig_h, ⟨?_, T', d', hCleared, hFree_X⟩, + ⟨(hC.1 i₀).2.1, (hC.1 i₀).1, hC0U_sub_Λ_h, P_in, + fun k => ⟨a_v k, ha_v k, v_v k, mem_range_self k, hPin_p k, hPin_H k, hPin_inter k⟩, + fun k₁ k₂ hne => disjoint_of_subset (hPin_V k₁) (hPin_V k₂) (hP.2 hne)⟩, + hdist_iv, + ⟨Λ₀, hOD_0', hΛ₀_sub_Λ_h, hbd_Λ₀', fun x hx hlt => (hsub₂ x hx hlt).trans hΛ₂_sub_Λ₀⟩⟩ + rintro x ⟨k, rfl⟩ + rw [hbd_Λ_h'] + exact ⟨(hC.1 h).1.1 (hv_v k), (C h).V_subset_U (hv_v k)⟩ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/SegregationDrawing.lean b/LeanPool/GraphMinor/GM14/SegregationDrawing.lean new file mode 100644 index 0000000000..d67860bb0d --- /dev/null +++ b/LeanPool/GraphMinor/GM14/SegregationDrawing.lean @@ -0,0 +1,378 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.PieceDrawing +public import LeanPool.GraphMinor.GM14.RigidThread + +/-! +# From drawings of the members of a segregation to a drawing of the graph + +"It follows that we may assume, to simplify notation, that $G_1$ is a drawing in $\Sigma$" (Graph +Minors +XIV, proof of (8.4), page 42). If each member of a segregation is drawn in its disc, then the +drawings meet only in the common vertices, and they glue to a drawing of the whole graph. +-/ + + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor GraphMinor.GM09 GraphMinor.Surface GraphMinor.GM11 + +universe u v w + +variable {α : Type u} {β : Type v} {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- The drawings `Γs` of the members of a segregation of `G` have a common vertex map `ν`, and their +union is a drawing of `G`. -/ +theorem exists_glued_drawing {G : Graph α β} {S_seg : Set (Society α β)} + (hseg : IsGraphSegregation G S_seg) {ν : α → S} (hinj : InjOn ν V(G)) + (Γs : ∀ S₀ ∈ S_seg, GraphDrawing S₀.G S) + (hν : ∀ S₀ (h : S₀ ∈ S_seg), ∀ v : V(S₀.G), ((Γs S₀ h).iso.vertexEquiv v).1 = ν v.1) + (hmeet : ∀ S₁ (h₁ : S₁ ∈ S_seg), ∀ S₂ (h₂ : S₂ ∈ S_seg), S₁ ≠ S₂ → + (Γs S₁ h₁).drawing.U ∩ (Γs S₂ h₂).drawing.U ⊆ ν '' (V(S₁.G) ∩ V(S₂.G))) : + ∃ Γ : GraphDrawing G S, Γ.drawing.U = ⋃ (S₀) (h : S₀ ∈ S_seg), (Γs S₀ h).drawing.U ∧ + (∀ v : V(G), (Γ.iso.vertexEquiv v).1 = ν v.1) ∧ + ∀ S₀ (h : S₀ ∈ S_seg), ∀ e ∈ E(S₀.G), + graphDrawingEdgeSet Γ e = graphDrawingEdgeSet (Γs S₀ h) e := by + classical + let Us : Society α β → Set S := fun S₀ => if h : S₀ ∈ S_seg then (Γs S₀ h).drawing.U else ∅ + have hUs : ∀ S₀ (h : S₀ ∈ S_seg), Us S₀ = (Γs S₀ h).drawing.U := fun S₀ h => by + simp only [Us, h, dite_true] + let Es : Society α β → β → Set S := fun S₀ e => + if h : S₀ ∈ S_seg then graphDrawingEdgeSet (Γs S₀ h) e else ∅ + have hEs : ∀ S₀ (h : S₀ ∈ S_seg) e, Es S₀ e = graphDrawingEdgeSet (Γs S₀ h) e := fun S₀ h e => by + simp only [Es, h, dite_true] + let part (T : Set (Society α β)) : Graph α β := + subgraphSUnion G ((fun S₀ : Society α β => S₀.G) '' T) + have hle : ∀ T ⊆ S_seg, part T ≤ G := fun T hT => + subgraphSUnion_le (by rintro _ ⟨S₀, hS₀, rfl⟩; exact hseg.le S₀ (hT hS₀)) + have hV : ∀ T ⊆ S_seg, V(part T) = ⋃ S₀ ∈ T, V(S₀.G) := fun T hT => by + simp [part, vertexSet_subgraphSUnion] + have hE : ∀ T ⊆ S_seg, E(part T) = ⋃ S₀ ∈ T, E(S₀.G) := fun T hT => by + rw [edgeSet_subgraphSUnion (by rintro _ ⟨S₀, hS₀, rfl⟩; exact hseg.le S₀ (hT hS₀))] + simp + have key : ∀ T : Set (Society α β), T.Finite → T ⊆ S_seg → ∃ Γ : GraphDrawing (part T) S, + Γ.drawing.U = (⋃ S₀ ∈ T, Us S₀) ∧ + (∀ v : V(part T), (Γ.iso.vertexEquiv v).1 = ν v.1) ∧ + ∀ S₀ ∈ T, ∀ e ∈ E(S₀.G), graphDrawingEdgeSet Γ e = Es S₀ e := by + intro T hT + induction T, hT using Set.Finite.induction_on with + | empty => + intro _ + have hVe : V(part ∅) = ∅ := by simpa using hV ∅ (empty_subset _) + have hEe : E(part ∅) = ∅ := by simpa using hE ∅ (empty_subset _) + obtain ⟨Γ, hU, hv⟩ := GraphDrawing.of_edgeless (hVe ▸ finite_empty) hEe + (ν := ν) (hVe ▸ injOn_empty ν) + refine ⟨Γ, by rw [hU, hVe]; simp, hv, by simp⟩ + | @insert S₁ T hS₁ hT ih => + intro hsub + have hT' : T ⊆ S_seg := (subset_insert _ _).trans hsub + have hS₁' : S₁ ∈ S_seg := hsub (mem_insert _ _) + obtain ⟨Γ, hU, hv, he⟩ := ih hT' + have hl₁ : part T ≤ part (insert S₁ T) := by + refine le_of_subset_of_subset (hle T hT') (hle _ hsub) ?_ ?_ + · rw [hV T hT', hV _ hsub] + exact biUnion_subset_biUnion_left (subset_insert _ _) + · rw [hE T hT', hE _ hsub] + exact biUnion_subset_biUnion_left (subset_insert _ _) + have hl₂ : S₁.G ≤ part (insert S₁ T) := by + refine le_of_subset_of_subset (hseg.le S₁ hS₁') (hle _ hsub) ?_ ?_ + · rw [hV _ hsub] + exact subset_biUnion_of_mem (u := fun S₀ : Society α β => V(S₀.G)) (mem_insert _ _) + · rw [hE _ hsub] + exact subset_biUnion_of_mem (u := fun S₀ : Society α β => E(S₀.G)) (mem_insert _ _) + have hne : ∀ S₀ ∈ T, S₀ ≠ S₁ := fun S₀ h => by + rintro rfl + exact hS₁ h + obtain ⟨Γ', hU', hv', he'⟩ := GraphDrawing.glue_edges hl₁ hl₂ + (by rw [hV T hT', hV _ hsub, biUnion_insert, union_comm]) + (by rw [hE T hT', hE _ hsub, biUnion_insert, union_comm]) + (by + rw [hE T hT'] + refine disjoint_iUnion₂_left.mpr fun S₀ hS₀ => ?_ + exact hseg.edge_disjoint S₀ (hT' hS₀) S₁ hS₁' (hne S₀ hS₀)) + (hinj.mono (hle _ hsub).vertexSet_mono) Γ (Γs S₁ hS₁') hv (hν S₁ hS₁') + (by + rintro x ⟨hx₁, hx₂⟩ + rw [hU] at hx₁ + obtain ⟨S₀, hS₀, hx₁⟩ := mem_iUnion₂.mp hx₁ + rw [hUs S₀ (hT' hS₀)] at hx₁ + obtain ⟨y, ⟨hy₁, hy₂⟩, rfl⟩ := hmeet S₀ (hT' hS₀) S₁ hS₁' (hne S₀ hS₀) ⟨hx₁, hx₂⟩ + refine ⟨y, ⟨?_, hy₂⟩, rfl⟩ + rw [hV T hT'] + exact mem_iUnion₂.mpr ⟨S₀, hS₀, hy₁⟩) + refine ⟨Γ', ?_, hv', ?_⟩ + · rw [hU', hU, biUnion_insert, union_comm, hUs S₁ hS₁'] + · intro S₀ hS₀ e heS₀ + rw [he' e] + rcases hS₀ with rfl | hS₀ + · have hn : e ∉ E(part T) := by + rw [hE T hT'] + intro h + obtain ⟨S₂, hS₂, h⟩ := mem_iUnion₂.mp h + exact disjoint_left.mp (hseg.edge_disjoint S₂ (hT' hS₂) S₀ hS₁' (hne S₂ hS₂)) h heS₀ + have : graphDrawingEdgeSet Γ e = ∅ := by + ext x + simp [graphDrawingEdgeSet, hn] + rw [this, empty_union, hEs S₀ hS₁'] + · have hn : e ∉ E(S₁.G) := disjoint_left.mp + (hseg.edge_disjoint S₀ (hT' hS₀) S₁ hS₁' (hne S₀ hS₀)) heS₀ + have : graphDrawingEdgeSet (Γs S₁ hS₁') e = ∅ := by + ext x + simp [graphDrawingEdgeSet, hn] + rw [this, union_empty, he S₀ hS₀ e heS₀] + obtain ⟨Γ, hU, hv, he⟩ := key S_seg hseg.finite Subset.rfl + have hpart : part S_seg = G := hseg.union_eq + have hU₀ : (⋃ S₀ ∈ S_seg, Us S₀) = ⋃ (S₀) (h : S₀ ∈ S_seg), (Γs S₀ h).drawing.U := + iUnion₂_congr hUs + have : ∀ G' : Graph α β, G' = G → ∀ Γ : GraphDrawing G' S, + Γ.drawing.U = (⋃ S₀ ∈ S_seg, Us S₀) → + (∀ v : V(G'), (Γ.iso.vertexEquiv v).1 = ν v.1) → + (∀ S₀ ∈ S_seg, ∀ e ∈ E(S₀.G), graphDrawingEdgeSet Γ e = Es S₀ e) → + ∃ Γ : GraphDrawing G S, Γ.drawing.U = (⋃ (S₀) (h : S₀ ∈ S_seg), (Γs S₀ h).drawing.U) ∧ + (∀ v : V(G), (Γ.iso.vertexEquiv v).1 = ν v.1) ∧ + ∀ S₀ (h : S₀ ∈ S_seg), ∀ e ∈ E(S₀.G), + graphDrawingEdgeSet Γ e = graphDrawingEdgeSet (Γs S₀ h) e := by + rintro _ rfl Γ h₁ h₂ h₃ + exact ⟨Γ, h₁.trans hU₀, h₂, fun S₀ h e he => (h₃ S₀ h e he).trans (hEs S₀ h e)⟩ + exact this _ hpart Γ hU hv he + +/-- Compatible drawings of the members of a segregation assemble into a drawing that preserves +the vertices and edges of the embedded drawing and records how vertices lie in the discs. -/ +theorem exists_drawing_of_compatible_members {H : Drawing S} {G : Graph α β} + {η : SpanEmbedding H G} {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} + {α_pt : α → S} (hs : IsGraphSegregation G S_seg) + (harr : IsSurfaceArrangement S_seg α_disc α_pt) + (hcompat : IsCompatibleWith G H η S_seg α_disc α_pt) + (Γs : ∀ S₀ ∈ S_seg, GraphDrawing S₀.G S) + (h₁ : ∀ S₀ (h : S₀ ∈ S_seg), (Γs S₀ h).drawing.U ⊆ α_disc S₀) + (h₂ : ∀ S₀ (h : S₀ ∈ S_seg), (Γs S₀ h).drawing.U ∩ subBd (α_disc S₀) = α_pt '' S₀.Ω.bar) + (h₃ : ∀ S₀ (h : S₀ ∈ S_seg) (v : V(S₀.G)), + v.1 ∈ S₀.Ω.bar → ((Γs S₀ h).iso.vertexEquiv v).1 = α_pt v.1) + (h₄ : ∀ S₀ (h : S₀ ∈ S_seg), ∀ v ∈ H.V, + v ∈ α_disc S₀ → graphDrawingVertexSet (Γs S₀ h) (η.vMap v) = {v}) + (h₅ : ∀ S₀ (h : S₀ ∈ S_seg), ∀ e ∈ H.E, + e ⊆ α_disc S₀ → graphDrawingEdgeSet (Γs S₀ h) (η.eMap e) = e) : + ∃ (Γ : GraphDrawing G S) (ν : α → S), Γ.drawing.U ⊆ ⋃ S₀ ∈ S_seg, α_disc S₀ ∧ + (∀ v : V(G), (Γ.iso.vertexEquiv v).1 = ν v.1) ∧ + (∀ v ∈ segregationVertices S_seg, ν v = α_pt v) ∧ + (∀ v ∈ H.V, ν (η.vMap v) = v) ∧ + (∀ e ∈ H.E, graphDrawingEdgeSet Γ (η.eMap e) = e) ∧ + ∀ v ∈ V(G), ∃ S₀ ∈ S_seg, ν v ∈ α_disc S₀ ∧ (ν v ∈ subBd (α_disc S₀) → v ∈ S₀.Ω.bar) := by + classical + have hpick : ∀ v : α, ∃ p : S, ∀ S₀ (h : S₀ ∈ S_seg) (hv : v ∈ V(S₀.G)), + ((Γs S₀ h).iso.vertexEquiv ⟨v, hv⟩).1 = p := by + intro v + by_cases hv : ∃ S₀ ∈ S_seg, v ∈ V(S₀.G) + · obtain ⟨S₀, h, hv₀⟩ := hv + refine ⟨((Γs S₀ h).iso.vertexEquiv ⟨v, hv₀⟩).1, fun S₁ h' hv₁ => ?_⟩ + by_cases he : S₁ = S₀ + · subst he + rfl + · obtain ⟨hb₁, hb₀⟩ := hs.vertex_inter_subset S₁ h' S₀ h he ⟨hv₁, hv₀⟩ + rw [h₃ S₁ h' ⟨v, hv₁⟩ hb₁, h₃ S₀ h ⟨v, hv₀⟩ hb₀] + · refine ⟨α_pt v, fun S₀ h hv₀ => absurd ⟨S₀, h, hv₀⟩ hv⟩ + choose ν hν using hpick + have hVG : V(G) = ⋃ S₁ ∈ S_seg, V(S₁.G) := by + conv_lhs => rw [← hs.union_eq] + simp [vertexSet_subgraphSUnion] + have hEG : E(G) = ⋃ S₁ ∈ S_seg, E(S₁.G) := by + conv_lhs => rw [← hs.union_eq] + rw [edgeSet_subgraphSUnion (by rintro _ ⟨S₁, hS₁, rfl⟩; exact hs.le S₁ hS₁)] + simp + have hbarν : ∀ S₀ (h : S₀ ∈ S_seg), ∀ b ∈ S₀.Ω.bar, ν b = α_pt b := fun S₀ h b hb => + (hν b S₀ h (S₀.bar_subset hb)).symm.trans (h₃ S₀ h ⟨b, S₀.bar_subset hb⟩ hb) + have hνU : ∀ S₀ (h : S₀ ∈ S_seg) (v : α), v ∈ V(S₀.G) → ν v ∈ (Γs S₀ h).drawing.U := by + intro S₀ h v hv + rw [← hν v S₀ h hv] + exact (Γs S₀ h).drawing.V_subset_U ((Γs S₀ h).iso.vertexEquiv ⟨v, hv⟩).2 + have hinj₀ : ∀ S₀ (h : S₀ ∈ S_seg), InjOn ν V(S₀.G) := by + intro S₀ h a ha b hb hab + rw [← hν a S₀ h ha, ← hν b S₀ h hb] at hab + exact congrArg Subtype.val ((Γs S₀ h).iso.vertexEquiv.injective (Subtype.ext hab)) + have hinj : InjOn ν V(G) := by + intro a ha b hb hab + rw [hVG] at ha hb + obtain ⟨S₁, h₁', ha'⟩ := mem_iUnion₂.mp ha + obtain ⟨S₂, h₂', hb'⟩ := mem_iUnion₂.mp hb + by_cases he : S₁ = S₂ + · subst he + exact hinj₀ S₁ h₁' ha' hb' hab + · have hp : ν a ∈ α_disc S₁ ∩ α_disc S₂ := + ⟨h₁ S₁ h₁' (hνU S₁ h₁' a ha'), hab ▸ h₁ S₂ h₂' (hνU S₂ h₂' b hb')⟩ + obtain ⟨c, ⟨hc₁, hc₂⟩, hc⟩ := harr.inter_discs S₁ h₁' S₂ h₂' he hp + have e₁ : a = c := hinj₀ S₁ h₁' ha' (S₁.bar_subset hc₁) + ((hc.symm.trans (hbarν S₁ h₁' c hc₁).symm).symm ▸ rfl) + have e₂ : b = c := hinj₀ S₂ h₂' hb' (S₂.bar_subset hc₂) + (by rw [← hab, ← hc, hbarν S₂ h₂' c hc₂]) + rw [e₁, e₂] + obtain ⟨Γ, hU, hv, he⟩ := exists_glued_drawing hs hinj Γs + (fun S₀ h v => hν v.1 S₀ h v.2) + (fun S₁ h₁' S₂ h₂' hne x hx => by + have hp : x ∈ α_disc S₁ ∩ α_disc S₂ := ⟨h₁ S₁ h₁' hx.1, h₁ S₂ h₂' hx.2⟩ + obtain ⟨c, ⟨hc₁, hc₂⟩, rfl⟩ := harr.inter_discs S₁ h₁' S₂ h₂' hne hp + exact ⟨c, ⟨S₁.bar_subset hc₁, S₂.bar_subset hc₂⟩, hbarν S₁ h₁' c hc₁⟩) + refine ⟨Γ, ν, ?_, hv, ?_, ?_, ?_, ?_⟩ + · rw [hU] + refine iUnion₂_subset fun S₀ h => ?_ + exact (h₁ S₀ h).trans (subset_biUnion_of_mem (u := α_disc) h) + · intro v hv' + obtain ⟨S₀, h, hb⟩ := mem_iUnion₂.mp hv' + exact hbarν S₀ h v hb + · intro v hv' + have hx := η.imageGraph_le.vertexSet_mono (η.bijOn_v.mapsTo hv') + rw [hVG] at hx + obtain ⟨S₀, h, hx⟩ := mem_iUnion₂.mp hx + have hvd := (hcompat.inter_V_iff S₀ h v hv').mpr hx + have h₆ := h₄ S₀ h v hv' hvd + rw [graphDrawingVertexSet_eq_singleton (Γs S₀ h) hx, hν _ S₀ h hx] at h₆ + exact singleton_eq_singleton_iff.mp h₆ + · intro e he' + have hx := η.imageGraph_le.edgeSet_mono (η.bijOn_e.mapsTo he') + rw [hEG] at hx + obtain ⟨S₀, h, hx⟩ := mem_iUnion₂.mp hx + rw [he S₀ h _ hx] + exact h₅ S₀ h e he' ((hcompat.inter_E_iff S₀ h e he').mpr hx) + · intro v hv' + rw [hVG] at hv' + obtain ⟨S₀, h, hx⟩ := mem_iUnion₂.mp hv' + refine ⟨S₀, h, h₁ S₀ h (hνU S₀ h v hx), fun hb => ?_⟩ + have hm : ν v ∈ (Γs S₀ h).drawing.U ∩ subBd (α_disc S₀) := ⟨hνU S₀ h v hx, hb⟩ + rw [h₂ S₀ h] at hm + obtain ⟨c, hc, hce⟩ := hm + have := hinj₀ S₀ h hx (S₀.bar_subset hc) (by rw [← hce, hbarν S₀ h c hc]) + exact this ▸ hc + +/-- The subgraph `H ∩ A` of `A`, for a subgraph `H = η(H)` of `G`. -/ +def pieceGraph {H : Drawing S} {G : Graph α β} (η : SpanEmbedding H G) (A : Graph α β) : + Graph α β := + (η.imageGraph.induce (V(η.imageGraph) ∩ V(A))).restrict E(A) + +omit [T2Space S] in +theorem vertexSet_pieceGraph {H : Drawing S} {G : Graph α β} (η : SpanEmbedding H G) + (A : Graph α β) : V(pieceGraph η A) = V(η.imageGraph) ∩ V(A) := rfl + +omit [T2Space S] in +theorem pieceGraph_le_image {H : Drawing S} {G : Graph α β} (η : SpanEmbedding H G) + (A : Graph α β) : pieceGraph η A ≤ η.imageGraph := + restrict_le.trans (η.imageGraph.induce_le inter_subset_left) + +omit [T2Space S] in +theorem edgeSet_pieceGraph {H : Drawing S} {G : Graph α β} (η : SpanEmbedding H G) + {A : Graph α β} (hA : A ≤ G) : E(pieceGraph η A) = E(η.imageGraph) ∩ E(A) := by + ext e + constructor + · intro he + exact ⟨(pieceGraph_le_image η A).edgeSet_mono he, (edgeSet_restrict _ _ ▸ he).2⟩ + · rintro ⟨he, heA⟩ + obtain ⟨x, y, hl⟩ := η.imageGraph.exists_isLink_of_mem_edgeSet he + have hlG := hl.mono η.imageGraph_le + have hlA := (hA.isLink_iff heA).mpr hlG + refine (edgeSet_restrict _ _ ▸ ⟨?_, heA⟩ : e ∈ E(pieceGraph η A)) + exact (show (η.imageGraph.induce (V(η.imageGraph) ∩ V(A))).IsLink e x y from + ⟨hl, ⟨hl.left_mem, hlA.left_mem⟩, ⟨hl.right_mem, hlA.right_mem⟩⟩).edge_mem + +omit [T2Space S] in +theorem pieceGraph_le {H : Drawing S} {G : Graph α β} (η : SpanEmbedding H G) + {A : Graph α β} (hA : A ≤ G) : pieceGraph η A ≤ A := by + refine le_of_subset_of_subset ((pieceGraph_le_image η A).trans η.imageGraph_le) hA ?_ ?_ + · exact inter_subset_right + · rw [edgeSet_pieceGraph η hA] + exact inter_subset_right + +/-- `H ∩ α(A, Ω)` is the subgraph `H ∩ A` of `A`, by compatibility. -/ +theorem exists_pieceEmbedding {H : Drawing S} {G : Graph α β} (η : SpanEmbedding H G) + {A : Graph α β} (hA : A ≤ G) {D : Set S} (hD : IsClosed D) (hbd : subBd D ∩ H.U ⊆ H.V) + (hV : ∀ v ∈ H.V, v ∈ D ↔ η.vMap v ∈ V(A)) (hE : ∀ e ∈ H.E, e ⊆ D ↔ η.eMap e ∈ E(A)) : + ∃ η₁ : SpanEmbedding (H.interSet D) A, η₁.imageGraph = pieceGraph η A ∧ + η₁.vMap = η.vMap ∧ η₁.eMap = η.eMap := by + have hIV := (interSet_V_and_U hD hbd).1 + have hIE : (H.interSet D).E = {e | e ∈ H.E ∧ e ⊆ D} := by + ext g + exact Whitney.mem_interSet_E + have hEP := edgeSet_pieceGraph η hA + refine ⟨⟨pieceGraph η A, η.vMap, η.eMap, pieceGraph_le η hA, ⟨?_, ?_, ?_⟩, ⟨?_, ?_, ?_⟩, ?_⟩, + rfl, rfl, rfl⟩ + · rw [hIV] + intro v hv + exact ⟨η.bijOn_v.mapsTo hv.1, (hV v hv.1).mp hv.2⟩ + · rw [hIV] + exact η.bijOn_v.injOn.mono inter_subset_left + · rw [hIV] + rintro a ⟨ha, haA⟩ + obtain ⟨v, hv, rfl⟩ := η.bijOn_v.surjOn ha + exact ⟨v, ⟨hv, (hV v hv).mpr haA⟩, rfl⟩ + · rw [hIE, hEP] + intro e he + exact ⟨η.bijOn_e.mapsTo he.1, (hE e he.1).mp he.2⟩ + · rw [hIE] + exact η.bijOn_e.injOn.mono fun e he => he.1 + · rw [hIE, hEP] + rintro a ⟨ha, haA⟩ + obtain ⟨e, he, rfl⟩ := η.bijOn_e.surjOn ha + exact ⟨e, ⟨he, (hE e he).mpr haA⟩, rfl⟩ + · intro e he v hv + have he' : e ∈ H.E := (hIE.subset he).1 + have hv' : v ∈ H.V := by rw [hIV] at hv; exact hv.1 + rw [← η.inc_iff e he' v hv'] + constructor + · exact fun ⟨z, hz⟩ => ⟨z, hz.mono (pieceGraph_le_image η A)⟩ + · rintro ⟨z, hz⟩ + have hm : η.eMap e ∈ E(pieceGraph η A) := by + rw [hEP] + exact ⟨η.bijOn_e.mapsTo he', (hE e he').mp (hIE.subset he).2⟩ + exact ⟨z, ((pieceGraph_le_image η A).isLink_iff hm).mpr hz⟩ + +/-- The restriction to a member's disc inherits its vertex and edge maps, and its boundary +vertices correspond to the society's cyclic order. -/ +theorem exists_compatible_pieceEmbedding {H : Drawing S} {G : Graph α β} + {η : SpanEmbedding H G} {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} + {α_pt : α → S} {S₀ : Society α β} (hS₀ : S₀ ∈ S_seg) (hle : S₀.G ≤ G) + (hcl : IsClosed (α_disc S₀)) (hcompat : IsCompatibleWith G H η S_seg α_disc α_pt) : + ∃ η₁ : SpanEmbedding (H.interSet (α_disc S₀)) S₀.G, + η₁.imageGraph = pieceGraph η S₀.G ∧ η₁.vMap = η.vMap ∧ η₁.eMap = η.eMap ∧ + subBd (α_disc S₀) ∩ H.U ⊆ H.V ∧ + (H.interSet (α_disc S₀)).V = H.V ∩ α_disc S₀ ∧ + (H.interSet (α_disc S₀)).U ⊆ α_disc S₀ ∧ + (H.interSet (α_disc S₀)).U ∩ subBd (α_disc S₀) ⊆ (H.interSet (α_disc S₀)).V ∧ + ∀ v ∈ (H.interSet (α_disc S₀)).V, v ∈ subBd (α_disc S₀) ↔ η₁.vMap v ∈ S₀.Ω.bar := by + have hbd : subBd (α_disc S₀) ∩ H.U ⊆ H.V := by + rintro x ⟨h₁, h₂⟩ + have : x ∈ H.U ∩ subBd (α_disc S₀) := ⟨h₂, h₁⟩ + rw [hcompat.bd_inter_eq S₀ hS₀] at this + exact this.1 + obtain ⟨η₁, him, hv, he⟩ := exists_pieceEmbedding η hle hcl hbd + (hcompat.inter_V_iff S₀ hS₀) (hcompat.inter_E_iff S₀ hS₀) + obtain ⟨hIV, hIU⟩ := interSet_V_and_U hcl hbd + have hU : (H.interSet (α_disc S₀)).U ⊆ α_disc S₀ := by + rw [hIU] + exact inter_subset_right + have hn : (H.interSet (α_disc S₀)).U ∩ subBd (α_disc S₀) ⊆ (H.interSet (α_disc S₀)).V := by + rw [hIU, hIV] + rintro x ⟨⟨h₁, h₂⟩, h₃⟩ + exact ⟨hbd ⟨h₃, h₁⟩, h₂⟩ + have hXH : ∀ v ∈ (H.interSet (α_disc S₀)).V, v ∈ subBd (α_disc S₀) ↔ η₁.vMap v ∈ S₀.Ω.bar := by + intro v hv' + rw [hIV] at hv' + rw [hv] + constructor + · intro h + have : v ∈ H.U ∩ subBd (α_disc S₀) := ⟨H.V_subset_U hv'.1, h⟩ + rw [hcompat.bd_inter_eq S₀ hS₀] at this + exact this.2 + · intro h + have : v ∈ {v ∈ H.V | η.vMap v ∈ S₀.Ω.bar} := ⟨hv'.1, h⟩ + rw [← hcompat.bd_inter_eq S₀ hS₀] at this + exact this.2 + exact ⟨η₁, him, hv, he, hbd, hIV, hU, hn, hXH⟩ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/SegregationReplace.lean b/LeanPool/GraphMinor/GM14/SegregationReplace.lean new file mode 100644 index 0000000000..4330287d97 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/SegregationReplace.lean @@ -0,0 +1,296 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.SegregationDrawing + +/-! +# Replacing one member of a segregation + +This is the first half of the proof of Claim (1) of (8.4) (page 41). We replace `(A, Ω)` by `(A', +Ω)`, +where `A'` is a smaller subgraph that holds `ΩBar` and `H ∩ A`, and that has an edge. All the +conditions +stay true, and the arrangement stays the same. As the paper says, the edge of `A'` keeps the new +society from already being in the segregation. +-/ + + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Topology Graph GraphMinor GraphMinor.GM09 GraphMinor.Surface GraphMinor.GM11 + +universe u v w + +variable {α : Type u} {β : Type v} {S : Type w} [TopologicalSpace S] + +/-- Two subgraphs with the same vertices and edges are equal. -/ +theorem eq_of_le_le {G A B : Graph α β} (hA : A ≤ G) (hB : B ≤ G) (hV : V(A) = V(B)) + (hE : E(A) = E(B)) : A = B := + le_antisymm (le_of_subset_of_subset hA hB hV.subset hE.subset) + (le_of_subset_of_subset hB hA hV.superset hE.superset) + +private theorem replacing_smaller_society_decreases_size + {α : Type u} + {β : Type v} + {G₁ : Graph α β} + {S_seg : Set (Society α β)} + (hVf : V(G₁).Finite) + (hEf : E(G₁).Finite) + {S₀ : Society α β} + (hS₀ : S₀ ∈ S_seg) + {A' : Graph α β} + (hA' : A' ≤ S₀.G) + (hbar : S₀.Ω.bar ⊆ V(A')) + (hne : A' ≠ S₀.G) + (hs : IsGraphSegregation G₁ S_seg) + (hS₀G : S₀.G ≤ G₁) + (G₁' : Graph α β) + (hV' : V(G₁') = V(A') ∪ ⋃ S₁ ∈ S_seg \ {S₀}, V(S₁.G)) + (hE' : E(G₁') = E(A') ∪ ⋃ S₁ ∈ S_seg \ {S₀}, E(S₁.G)) + (hVsub : V(G₁') ⊆ V(G₁)) + (hEsub : E(G₁') ⊆ E(G₁)) + (hcount₁ : V(G₁').ncard ≤ V(G₁).ncard) + (hcount₂ : E(G₁').ncard ≤ E(G₁).ncard) : + V(G₁').ncard + E(G₁').ncard < V(G₁).ncard + E(G₁).ncard := by + by_cases hV'eq : V(A') = V(S₀.G) + · have hEne : E(A') ≠ E(S₀.G) := fun h => hne (eq_of_le_le hA' le_rfl hV'eq h) + obtain ⟨e, heS, heA⟩ : ∃ e ∈ E(S₀.G), e ∉ E(A') := by + by_contra hcon + push Not at hcon + exact hEne (Subset.antisymm hA'.edgeSet_mono hcon) + have : e ∉ E(G₁') := by + rw [hE'] + rintro (h | h) + · exact heA h + · obtain ⟨S₁, ⟨h₁, hn₁⟩, h⟩ := mem_iUnion₂.mp h + exact disjoint_left.mp (hs.edge_disjoint S₀ hS₀ S₁ h₁ (Ne.symm hn₁)) heS h + have hlt := ncard_lt_ncard (⟨hEsub, fun h => this (h (hS₀G.edgeSet_mono heS))⟩ : + E(G₁') ⊂ E(G₁)) hEf + omega + · obtain ⟨x, hxS, hxA⟩ : ∃ x ∈ V(S₀.G), x ∉ V(A') := by + by_contra hcon + push Not at hcon + exact hV'eq (Subset.antisymm hA'.vertexSet_mono hcon) + have : x ∉ V(G₁') := by + rw [hV'] + rintro (h | h) + · exact hxA h + · obtain ⟨S₁, ⟨h₁, hn₁⟩, h⟩ := mem_iUnion₂.mp h + exact hxA (hbar (hs.vertex_inter_subset S₀ hS₀ S₁ h₁ (Ne.symm hn₁) ⟨hxS, h⟩).1) + have hlt := ncard_lt_ncard (⟨hVsub, fun h => this (h (hS₀G.vertexSet_mono hxS))⟩ : + V(G₁') ⊂ V(G₁)) hVf + omega + +/-- See the module docstring. -/ +theorem exists_replacement {H : Drawing S} {G₁ : Graph α β} {η : SpanEmbedding H G₁} + {S_seg : Set (Society α β)} {α_disc : Society α β → Set S} {α_pt : α → S} + (hVf : V(G₁).Finite) (hEf : E(G₁).Finite) + (hseg : IsThreeSegregation G₁ S_seg) (harr : IsSurfaceArrangement S_seg α_disc α_pt) + (hcompat : IsCompatibleWith G₁ H η S_seg α_disc α_pt) {S₀ : Society α β} (hS₀ : S₀ ∈ S_seg) + {A' : Graph α β} (hA' : A' ≤ S₀.G) (hbar : S₀.Ω.bar ⊆ V(A')) (hH : pieceGraph η S₀.G ≤ A') + (hE : E(A').Nonempty) (hne : A' ≠ S₀.G) : + ∃ (S_seg' : Set (Society α β)) (α_disc' : Society α β → Set S) (G₁' : Graph α β) + (η' : SpanEmbedding H G₁'), + G₁' ≤ G₁ ∧ IsThreeSegregation G₁' S_seg' ∧ IsSurfaceArrangement S_seg' α_disc' α_pt ∧ + IsCompatibleWith G₁' H η' S_seg' α_disc' α_pt ∧ + segregationVertices S_seg' = segregationVertices S_seg ∧ + η'.imageGraph = η.imageGraph ∧ η'.vMap = η.vMap ∧ η'.eMap = η.eMap ∧ + (∀ S' ∈ S_seg', ∃ S₁ ∈ S_seg, α_disc' S' = α_disc S₁) ∧ + V(G₁').ncard + E(G₁').ncard < V(G₁).ncard + E(G₁).ncard ∧ + V(G₁') = V(A') ∪ ⋃ S₁ ∈ S_seg \ {S₀}, V(S₁.G) ∧ + E(G₁') = E(A') ∪ ⋃ S₁ ∈ S_seg \ {S₀}, E(S₁.G) := by + classical + obtain ⟨hs, h3⟩ := hseg + have hS₀G := hs.le S₀ hS₀ + have hVG : V(G₁) = ⋃ S₁ ∈ S_seg, V(S₁.G) := by + conv_lhs => rw [← hs.union_eq] + simp [vertexSet_subgraphSUnion] + have hEG : E(G₁) = ⋃ S₁ ∈ S_seg, E(S₁.G) := by + conv_lhs => rw [← hs.union_eq] + rw [edgeSet_subgraphSUnion (by rintro _ ⟨S₁, hS₁, rfl⟩; exact hs.le S₁ hS₁)] + simp + have hA'V : ∀ x ∈ V(A'), x ∈ V(G₁) := fun x hx => hS₀G.vertexSet_mono (hA'.vertexSet_mono hx) + let S₀' : Society α β := ⟨A', S₀.Ω, S₀.finite_V.subset hA'.vertexSet_mono, + S₀.finite_E.subset hA'.edgeSet_mono, hbar⟩ + have hS₀'S₀ : S₀' ≠ S₀ := fun h => hne (congrArg Society.G h) + have hS₀'E : ∀ S₁ ∈ S_seg, S₁ ≠ S₀ → Disjoint E(A') E(S₁.G) := fun S₁ hS₁ h => + (hs.edge_disjoint S₀ hS₀ S₁ hS₁ (Ne.symm h)).mono_left hA'.edgeSet_mono + have hS₀'not : S₀' ∉ S_seg := by + intro hin + obtain ⟨e, he⟩ := hE + exact disjoint_left.mp (hS₀'E S₀' hin hS₀'S₀) he he + let S_seg' : Set (Society α β) := insert S₀' (S_seg \ {S₀}) + let α_disc' : Society α β → Set S := Function.update α_disc S₀' (α_disc S₀) + have hd₀ : α_disc' S₀' = α_disc S₀ := Function.update_self .. + have hd₁ : ∀ S₁ ∈ S_seg, α_disc' S₁ = α_disc S₁ := fun S₁ hS₁ => + Function.update_of_ne (fun (h : S₁ = S₀') => hS₀'not (h ▸ hS₁)) .. + -- The new graph. + let G₁' : Graph α β := subgraphSUnion G₁ ((fun S₁ : Society α β => S₁.G) '' S_seg') + have hpiece : ∀ T ∈ (fun S₁ : Society α β => S₁.G) '' S_seg', T ≤ G₁ := by + rintro _ ⟨S₁, rfl | ⟨hS₁, -⟩, rfl⟩ + · exact hA'.trans hS₀G + · exact hs.le S₁ hS₁ + have hG₁'le : G₁' ≤ G₁ := subgraphSUnion_le hpiece + have hV' : V(G₁') = V(A') ∪ ⋃ S₁ ∈ S_seg \ {S₀}, V(S₁.G) := by + simp only [G₁', vertexSet_subgraphSUnion, S_seg', biUnion_image, biUnion_insert] + rfl + have hE' : E(G₁') = E(A') ∪ ⋃ S₁ ∈ S_seg \ {S₀}, E(S₁.G) := by + simp only [G₁'] + rw [edgeSet_subgraphSUnion hpiece] + simp only [S_seg', biUnion_image, biUnion_insert] + rfl + have hle' : ∀ S' ∈ S_seg', S'.G ≤ G₁' := by + rintro S' (rfl | ⟨hS₁, hne₁⟩) + · refine le_of_subset_of_subset (hA'.trans hS₀G) hG₁'le ?_ ?_ + · rw [hV'] + exact subset_union_left + · rw [hE'] + exact subset_union_left + · refine le_of_subset_of_subset (hs.le S' hS₁) hG₁'le ?_ ?_ + · rw [hV'] + exact (subset_biUnion_of_mem (u := fun S₁ : Society α β => V(S₁.G)) + (show S' ∈ S_seg \ {S₀} from ⟨hS₁, hne₁⟩)).trans subset_union_right + · rw [hE'] + exact (subset_biUnion_of_mem (u := fun S₁ : Society α β => E(S₁.G)) + (show S' ∈ S_seg \ {S₀} from ⟨hS₁, hne₁⟩)).trans subset_union_right + have hseg' : IsThreeSegregation G₁' S_seg' := by + refine ⟨⟨(hs.finite.subset sdiff_subset).insert _, hle', ?_, ?_, ?_⟩, ?_⟩ + · refine eq_of_le_le (subgraphSUnion_le ?_) le_rfl ?_ ?_ + · rintro _ ⟨S₁, hS₁, rfl⟩ + exact hle' S₁ hS₁ + · rfl + · rw [edgeSet_subgraphSUnion] + · simp only [G₁'] + rw [edgeSet_subgraphSUnion hpiece] + · rintro _ ⟨S₁, hS₁, rfl⟩ + exact hle' S₁ hS₁ + · rintro S₁ (rfl | ⟨h₁, hn₁⟩) S₂ (rfl | ⟨h₂, hn₂⟩) hne₁₂ + · exact absurd rfl hne₁₂ + · have := hs.vertex_inter_subset S₀ hS₀ S₂ h₂ (Ne.symm hn₂) + exact (inter_subset_inter_left _ hA'.vertexSet_mono).trans this + · have := hs.vertex_inter_subset S₁ h₁ S₀ hS₀ hn₁ + exact (inter_subset_inter_right _ hA'.vertexSet_mono).trans this + · exact hs.vertex_inter_subset S₁ h₁ S₂ h₂ hne₁₂ + · rintro S₁ (rfl | ⟨h₁, hn₁⟩) S₂ (rfl | ⟨h₂, hn₂⟩) hne₁₂ + · exact absurd rfl hne₁₂ + · exact hS₀'E S₂ h₂ hn₂ + · exact (hS₀'E S₁ h₁ hn₁).symm + · exact hs.edge_disjoint S₁ h₁ S₂ h₂ hne₁₂ + · rintro S₁ (rfl | ⟨h₁, -⟩) + · exact h3 S₀ hS₀ + · exact h3 S₁ h₁ + have hsegV : segregationVertices S_seg' = segregationVertices S_seg := by + simp only [segregationVertices] + ext x + simp only [mem_iUnion, exists_prop] + constructor + · rintro ⟨S₁, rfl | ⟨h₁, -⟩, hx⟩ + · exact ⟨S₀, hS₀, hx⟩ + · exact ⟨S₁, h₁, hx⟩ + · rintro ⟨S₁, h₁, hx⟩ + by_cases h : S₁ = S₀ + · subst h + exact ⟨S₀', Or.inl rfl, hx⟩ + · exact ⟨S₁, Or.inr ⟨h₁, h⟩, hx⟩ + -- The image of `H`. + have hIV : ∀ v ∈ H.V, η.vMap v ∈ V(S₀.G) → η.vMap v ∈ V(A') := fun v hv h => + hH.vertexSet_mono ⟨η.bijOn_v.mapsTo hv, h⟩ + have hIE : ∀ e ∈ H.E, η.eMap e ∈ E(S₀.G) → η.eMap e ∈ E(A') := fun e he h => + hH.edgeSet_mono ((edgeSet_pieceGraph η hS₀G).superset ⟨η.bijOn_e.mapsTo he, h⟩) + have hIle : η.imageGraph ≤ G₁' := by + refine le_of_subset_of_subset η.imageGraph_le hG₁'le ?_ ?_ + · intro x hx + obtain ⟨v, hv, rfl⟩ := η.bijOn_v.surjOn hx + have hxG := η.imageGraph_le.vertexSet_mono hx + rw [hVG] at hxG + obtain ⟨S₁, hS₁, hxS⟩ := mem_iUnion₂.mp hxG + rw [hV'] + by_cases h : S₁ = S₀ + · subst h + exact Or.inl (hIV v hv hxS) + · exact Or.inr (mem_iUnion₂.mpr ⟨S₁, ⟨hS₁, h⟩, hxS⟩) + · intro x hx + obtain ⟨e, he, rfl⟩ := η.bijOn_e.surjOn hx + have hxG := η.imageGraph_le.edgeSet_mono hx + rw [hEG] at hxG + obtain ⟨S₁, hS₁, hxS⟩ := mem_iUnion₂.mp hxG + rw [hE'] + by_cases h : S₁ = S₀ + · subst h + exact Or.inl (hIE e he hxS) + · exact Or.inr (mem_iUnion₂.mpr ⟨S₁, ⟨hS₁, h⟩, hxS⟩) + let η' : SpanEmbedding H G₁' := + ⟨η.imageGraph, η.vMap, η.eMap, hIle, η.bijOn_v, η.bijOn_e, η.inc_iff⟩ + -- The arrangement. + have harr' : IsSurfaceArrangement S_seg' α_disc' α_pt := by + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · rintro S₁ (rfl | ⟨h₁, -⟩) + · rw [hd₀] + exact harr.isClosedDisc S₀ hS₀ + · rw [hd₁ S₁ h₁] + exact harr.isClosedDisc S₁ h₁ + · rintro S₁ (rfl | ⟨h₁, hn₁⟩) S₂ (rfl | ⟨h₂, hn₂⟩) hne₁₂ + · exact absurd rfl hne₁₂ + · rw [hd₀, hd₁ S₂ h₂] + exact harr.inter_discs S₀ hS₀ S₂ h₂ (Ne.symm hn₂) + · rw [hd₀, hd₁ S₁ h₁] + exact harr.inter_discs S₁ h₁ S₀ hS₀ hn₁ + · rw [hd₁ S₁ h₁, hd₁ S₂ h₂] + exact harr.inter_discs S₁ h₁ S₂ h₂ hne₁₂ + · rintro S₁ (rfl | ⟨h₁, -⟩) + · rw [hd₀] + exact harr.inter_bd S₀ hS₀ + · rw [hd₁ S₁ h₁] + exact harr.inter_bd S₁ h₁ + · rw [hsegV] + exact harr.injOn_pts + · rintro S₁ (rfl | ⟨h₁, -⟩) + · rw [hd₀] + exact harr.natural_order S₀ hS₀ + · rw [hd₁ S₁ h₁] + exact harr.natural_order S₁ h₁ + have hcompat' : IsCompatibleWith G₁' H η' S_seg' α_disc' α_pt := by + refine ⟨?_, ?_, ?_, ?_⟩ + · intro v hv h + rw [hsegV] at h + exact hcompat.pt_eq v hv h + · rintro S₁ (rfl | ⟨h₁, -⟩) + · rw [hd₀] + exact hcompat.bd_inter_eq S₀ hS₀ + · rw [hd₁ S₁ h₁] + exact hcompat.bd_inter_eq S₁ h₁ + · rintro S₁ (rfl | ⟨h₁, -⟩) v hv + · rw [hd₀, hcompat.inter_V_iff S₀ hS₀ v hv] + exact ⟨hIV v hv, fun h => hA'.vertexSet_mono h⟩ + · rw [hd₁ S₁ h₁] + exact hcompat.inter_V_iff S₁ h₁ v hv + · rintro S₁ (rfl | ⟨h₁, -⟩) e he + · rw [hd₀, hcompat.inter_E_iff S₀ hS₀ e he] + exact ⟨hIE e he, fun h => hA'.edgeSet_mono h⟩ + · rw [hd₁ S₁ h₁] + exact hcompat.inter_E_iff S₁ h₁ e he + -- The size drops. + have hVsub : V(G₁') ⊆ V(G₁) := hG₁'le.vertexSet_mono + have hEsub : E(G₁') ⊆ E(G₁) := hG₁'le.edgeSet_mono + have hcount₁ := ncard_le_ncard hVsub hVf + have hcount₂ := ncard_le_ncard hEsub hEf + have hdrop : V(G₁').ncard + E(G₁').ncard < V(G₁).ncard + E(G₁).ncard := by + exact replacing_smaller_society_decreases_size (α := α) (β := β) (G₁ := G₁) (S_seg := S_seg) + hVf hEf (S₀ := S₀) hS₀ (A' := A') hA' hbar hne hs hS₀G G₁' hV' hE' hVsub hEsub hcount₁ + hcount₂ + refine ⟨S_seg', α_disc', G₁', η', hG₁'le, hseg', harr', hcompat', hsegV, rfl, rfl, rfl, ?_, hdrop, + hV', hE'⟩ + rintro S₁ (rfl | ⟨h₁, -⟩) + · exact ⟨S₀, hS₀, hd₀⟩ + · exact ⟨S₁, h₁, hd₁ S₁ h₁⟩ + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/SpanRestriction.lean b/LeanPool/GraphMinor/GM14/SpanRestriction.lean new file mode 100644 index 0000000000..e43e1085ce --- /dev/null +++ b/LeanPool/GraphMinor/GM14/SpanRestriction.lean @@ -0,0 +1,122 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs + +/-! +# Restricting a span embedding + +A span embedding restricts to a spanned subdrawing with the same vertex and edge maps. +The image of a cleared subdrawing lies in the original image. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Graph Surface GM11 + +universe u v w + +variable {S : Type w} [TopologicalSpace S] [T1Space S] + +/-- Restriction of a `SpanEmbedding H G` to a spanned subdrawing `H.span V' E'`. -/ +def restrictSpan {α : Type u} {β : Type v} {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) (V' : Set S) (E' : Set (Set S)) : + SpanEmbedding (H.span V' E') G where + imageGraph := + (η.imageGraph.induce (η.vMap '' (H.span V' E').V)).restrict (η.eMap '' (H.span V' E').E) + vMap := η.vMap + eMap := η.eMap + imageGraph_le := by + have hV_sub : η.vMap '' (H.span V' E').V ⊆ V(η.imageGraph) := by + rw [← η.bijOn_v.image_eq] + exact image_mono (H.spanV_subset V' E') + exact (Graph.restrict_le.trans (Graph.induce_le hV_sub)).trans η.imageGraph_le + bijOn_v := by + have hV_eq : + V((η.imageGraph.induce (η.vMap '' (H.span V' E').V)).restrict + (η.eMap '' (H.span V' E').E)) = η.vMap '' (H.span V' E').V := by + simp + rw [hV_eq] + exact (η.bijOn_v.injOn.mono (H.spanV_subset V' E')).bijOn_image + bijOn_e := by + have hE_eq : + E((η.imageGraph.induce (η.vMap '' (H.span V' E').V)).restrict + (η.eMap '' (H.span V' E').E)) = η.eMap '' (H.span V' E').E := by + apply Subset.antisymm + · intro b hb + rw [edge_mem_iff_exists_isLink] at hb + obtain ⟨x, y, hb, _⟩ := hb + exact hb + · rintro b ⟨e, he, rfl⟩ + have he_span : e ∈ E' ∩ H.E := by rwa [← H.span_E V' E'] + have he_img : η.eMap e ∈ E(η.imageGraph) := η.bijOn_e.mapsTo he_span.2 + rw [edge_mem_iff_exists_isLink] at he_img ⊢ + obtain ⟨x, y, hlink⟩ := he_img + have hx_V : x ∈ V(η.imageGraph) := η.imageGraph.left_mem_of_isLink hlink + have hy_V : y ∈ V(η.imageGraph) := η.imageGraph.left_mem_of_isLink hlink.symm + rw [← η.bijOn_v.image_eq] at hx_V hy_V + obtain ⟨u, huH, rfl⟩ := hx_V + obtain ⟨v, hvH, rfl⟩ := hy_V + have hu_cl : u ∈ closure e := (η.inc_iff e he_span.2 u huH).mp ⟨η.vMap v, hlink⟩ + have hv_cl : v ∈ closure e := (η.inc_iff e he_span.2 v hvH).mp ⟨η.vMap u, hlink.symm⟩ + have hu_span : u ∈ (H.span V' E').V := + Or.inr (mem_iUnion₂.mpr ⟨e, he_span, hu_cl, huH⟩) + have hv_span : v ∈ (H.span V' E').V := + Or.inr (mem_iUnion₂.mpr ⟨e, he_span, hv_cl, hvH⟩) + exact ⟨η.vMap u, η.vMap v, ⟨e, he, rfl⟩, hlink, + ⟨u, hu_span, rfl⟩, ⟨v, hv_span, rfl⟩⟩ + rw [hE_eq] + have hE_sub : (H.span V' E').E ⊆ H.E := by + rw [H.span_E V' E'] + exact inter_subset_right + exact (η.bijOn_e.injOn.mono hE_sub).bijOn_image + inc_iff e he v hv := by + have he_span : e ∈ E' ∩ H.E := by rwa [← H.span_E V' E'] + have hv_H : v ∈ H.V := H.spanV_subset V' E' hv + rw [← η.inc_iff e he_span.2 v hv_H] + constructor + · rintro ⟨w, _, hlink, _, _⟩ + exact ⟨w, hlink⟩ + · rintro ⟨w, hlink⟩ + have hw_V : w ∈ V(η.imageGraph) := η.imageGraph.left_mem_of_isLink hlink.symm + rw [← η.bijOn_v.image_eq] at hw_V + obtain ⟨u, huH, rfl⟩ := hw_V + have hu_cl : u ∈ closure e := (η.inc_iff e he_span.2 u huH).mp ⟨η.vMap v, hlink.symm⟩ + have hu_span : u ∈ (H.span V' E').V := + Or.inr (mem_iUnion₂.mpr ⟨e, he_span, hu_cl, huH⟩) + exact ⟨η.vMap u, ⟨e, he, rfl⟩, hlink, ⟨v, hv, rfl⟩, ⟨u, hu_span, rfl⟩⟩ + +/-- Restriction of a `SpanEmbedding H G` to `clearedSubdrawing H Λ = H.interSet (univ \ Λ)`. -/ +def restrictCleared {α : Type u} {β : Type v} {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) (Λ : Set S) : + SpanEmbedding (clearedSubdrawing H Λ) G := + restrictSpan η (H.V ∩ (univ \ Λ)) {e | e ∈ H.E ∧ e ⊆ univ \ Λ} + +@[simp] +theorem restrictCleared_vMap {α : Type u} {β : Type v} {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) (Λ : Set S) : + (restrictCleared η Λ).vMap = η.vMap := rfl + +@[simp] +theorem restrictCleared_eMap {α : Type u} {β : Type v} {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) (Λ : Set S) : + (restrictCleared η Λ).eMap = η.eMap := rfl + +theorem restrictCleared_imageGraph_le {α : Type u} {β : Type v} {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) (Λ : Set S) : + (restrictCleared η Λ).imageGraph ≤ η.imageGraph := by + have hV_sub : η.vMap '' (clearedSubdrawing H Λ).V ⊆ V(η.imageGraph) := by + rw [← η.bijOn_v.image_eq] + exact image_mono (H.spanV_subset _ _) + exact Graph.restrict_le.trans (Graph.induce_le hV_sub) + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/SubDataSep.lean b/LeanPool/GraphMinor/GM14/SubDataSep.lean new file mode 100644 index 0000000000..e3ee380074 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/SubDataSep.lean @@ -0,0 +1,920 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Section6 +public import LeanPool.GraphMinor.GM14.PieceDrawing +public import LeanPool.GraphMinor.GM14.WhitneyGraph + +/-! +# Graph Minors XIV – Separations of Order at Most 2 in Subdivisions of Simple 3-Connected Graphs + +This file proves general 2-separation lemmas for subdivisions of simple 3-connected graphs: +- `isSubdivision_toGraph_of_spanEmbedding`: if `η.imageGraph` is a subdivision of a simple + 3-connected graph, then so is `H.toGraph`. +- `SubDataSepGeneral.sep_general`: for any `A ⊆ E(G)` with `(bdry G A).ncard ≤ 2`, `A.Nonempty`, + and `(E(G) \ A).Nonempty` in a subdivision `G` of a simple 3-connected graph `G₀`, either `A` + or `E(G) \ A` is the edge set of a subpath `Q` of some subdivision path `P e` (`e ∈ E(G₀)`) + joining the two vertices of `bdry G A`. +-/ + +@[expose] public section + +namespace GraphMinor.GM14 + +open Set Function Topology Metric Graph Hypergraph +open GraphMinor GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 +open GraphMinor.GM11 GraphMinor.GM14.Whitney + +universe u v u' v' w + +/-! ## 1. Moving subdivisions between span embeddings -/ + +/-- If `η : SpanEmbedding H G` has `IsSubdivisionOfSimpleThreeConnected η.imageGraph`, then +`IsSubdivisionOfSimpleThreeConnected H.toGraph`. -/ +theorem isSubdivision_toGraph_of_spanEmbedding {S : Type w} [TopologicalSpace S] + {α : Type u} {β : Type v} {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) (h : IsSubdivisionOfSimpleThreeConnected η.imageGraph) : + IsSubdivisionOfSimpleThreeConnected H.toGraph := by + obtain ⟨G₀, hsimple, hsub⟩ := h + have h4 := hsimple.2.1 + have hV₀_ne : V(G₀).Nonempty := by + by_contra hemp + rw [not_nonempty_iff_eq_empty] at hemp + rw [hemp, Set.ncard_empty] at h4 + omega + obtain ⟨v₀, hv₀⟩ := hV₀_ne + have hv₀_im : v₀ ∈ V(η.imageGraph) := hsub.1 hv₀ + obtain ⟨s₀, hs₀, _⟩ := η.bijOn_v.surjOn hv₀_im + have : Nonempty S := ⟨s₀⟩ + obtain ⟨ι, _, _⟩ := η.exists_iso + exact isSubdivision_of_iso_het ⟨G₀, hsimple, hsub⟩ (isoSymm ι) + +/-! ## 2. General Separations of Order at Most 2 in a Subdivision of a Simple 3-Connected Graph -/ + +namespace SubDataSepGeneral + +variable {α : Type u} {β : Type v} +variable {G G₀ : Graph α β} {P : β → Graph α β} + +/-- Along any walk `W` from `a` to `b`, if `a ∈ verts G A` and `b ∉ verts G A`, some vertex on `W` +other than `b` belongs to `bdry G A`. -/ +theorem exists_bdry_of_walk {A : Set β} {a b : α} (W : GraphWalk G a b) + (ha : a ∈ verts G A) (hb : b ∉ verts G A) : + ∃ z ∈ W.support, z ≠ b ∧ z ∈ bdry G A := by + induction W with + | nil _ => exact (hb ha).elim + | @cons u v w g hlink rest ih => + by_cases hv : v ∈ verts G A + · obtain ⟨z, hz, hzb, hbd⟩ := ih hv hb + exact ⟨z, by simp [GraphWalk.support, hz], hzb, hbd⟩ + · have hgA : g ∉ A := fun hg => hv ⟨g, hg, u, hlink.symm⟩ + have hu_out : u ∈ verts G (E(G) \ A) := ⟨g, ⟨hlink.edge_mem, hgA⟩, v, hlink⟩ + exact ⟨u, by simp [GraphWalk.support], fun h => hb (h ▸ ha), ha, hu_out⟩ + +/-- Every edge of `G` incident with an internal vertex `x ∈ V(P e) \ V(G₀)` belongs to `E(P e)`. -/ +theorem inc_mem_path_of_notMem_V₀ (h : SubData G G₀ P) {e g : β} {x : α} + (he : e ∈ E(G₀)) (hxP : x ∈ V(P e)) (hx₀ : x ∉ V(G₀)) (hg : g ∈ E(G)) (hinc : G.Inc g x) : + g ∈ E(P e) := by + rw [h.eunion] at hg + obtain ⟨f, hf, hgf⟩ := mem_iUnion₂.mp hg + by_cases hfe : f = e + · exact hfe ▸ hgf + · obtain ⟨_, _, -, hp, -, -⟩ := h.path f hf + obtain ⟨y, hy⟩ := hinc + have hxPf : x ∈ V(P f) := ((hp.le.isLink_iff hgf).mpr hy).left_mem + exact (hx₀ ((h.disj e he f hf (Ne.symm hfe)).2 ⟨hxP, hxPf⟩)).elim + +/-- Every vertex in `bdry G A` belongs to `V(G)`. -/ +theorem bdry_subset_V (A : Set β) : bdry G A ⊆ V(G) := by + rintro x ⟨_, g, ⟨hg, _⟩, y, hlink⟩ + exact hlink.left_mem + +/-- For any `SubData G G₀ P`, `E(G₀)`, `V(G)`, and `bdry G A` are finite. -/ +theorem finite_V (h : SubData G G₀ P) : V(G).Finite := by + classical + have hfinV₀ : V(G₀).Finite := h.finite_V₀ + have : Finite V(G₀) := hfinV₀.to_subtype + have hfinE₀ : E(G₀).Finite := by + have hex : ∀ e : E(G₀), ∃ u v : V(G₀), G₀.IsLink e.1 u.1 v.1 := by + intro e + obtain ⟨u, v, hl, -⟩ := h.path e.1 e.2 + exact ⟨⟨u, hl.left_mem⟩, ⟨v, hl.right_mem⟩, hl⟩ + choose u v hlink using hex + have hinj : Function.Injective (fun e : E(G₀) => (u e, v e)) := by + intro e₁ e₂ heq + have h1 : (u e₁).1 = (u e₂).1 := congrArg (fun p => p.1.1) heq + have h2 : (v e₁).1 = (v e₂).1 := congrArg (fun p => p.2.1) heq + apply Subtype.ext + exact h.simple.1.2 e₁.1 e₁.2 e₂.1 e₂.2 (u e₁).1 (v e₁).1 (hlink e₁) + (h1 ▸ h2 ▸ hlink e₂) + exact Finite.of_injective _ hinj + rw [h.vunion] + refine hfinV₀.union (hfinE₀.biUnion fun e he => ?_) + obtain ⟨_, _, -, ⟨_, W, _, hV, _⟩, -⟩ := h.path e he + rw [hV] + exact W.support.toFinset.finite_toSet.subset fun x hx => List.mem_toFinset.mpr hx + +theorem finite_bdry (h : SubData G G₀ P) (A : Set β) : (bdry G A).Finite := + (finite_V h).subset (bdry_subset_V A) + +/-- If `x ∈ V(G)` is not in `V(P e)`, no edge of `E(P e)` is incident with `x` in `G`. -/ +theorem not_inc_of_notMem_path (h : SubData G G₀ P) {e g : β} {x : α} + (he : e ∈ E(G₀)) (hx : x ∉ V(P e)) (hg : g ∈ E(P e)) : ¬ G.Inc g x := by + obtain ⟨_, _, -, hp, -, -⟩ := h.path e he + rintro ⟨y, hy⟩ + exact hx (((hp.le.isLink_iff hg).mpr hy).left_mem) + +/-- In a simple 3-connected graph `G₀`, for any edge `e₁ ∈ E(G₀)` there exist three distinct edges +in `E(G₀) \ {e₁}`. -/ +theorem exists_three_edges_outside (h : SubData G G₀ P) {e₁ : β} (he₁ : e₁ ∈ E(G₀)) : + ∃ a₁ a₂ a₃ : β, a₁ ∈ E(G₀) \ {e₁} ∧ a₂ ∈ E(G₀) \ {e₁} ∧ a₃ ∈ E(G₀) \ {e₁} ∧ + a₁ ≠ a₂ ∧ a₁ ≠ a₃ ∧ a₂ ≠ a₃ := by + obtain ⟨u₁, v₁, hl₁, -, -, -⟩ := h.path e₁ he₁ + have h4 := h.simple.2.1 + have hne : (V(G₀) \ {u₁, v₁}).Nonempty := by + by_contra hemp + have hsub : V(G₀) ⊆ {u₁, v₁} := fun x hx => by + by_contra hx_not + exact hemp ⟨x, hx, hx_not⟩ + have hle := (Set.ncard_le_ncard hsub (Set.toFinite _)).trans (Set.ncard_insert_le u₁ {v₁}) + rw [Set.ncard_singleton] at hle + omega + obtain ⟨x, hxV₀, hx_not⟩ := hne + obtain ⟨a₁, a₂, a₃, h12, h13, h23, hi₁, hi₂, hi₃⟩ := + IsSimpleThreeConnected.exists_three_edges h.simple hxV₀ + have hnot_e₁ : ∀ {a : β}, G₀.Inc a x → a ∈ E(G₀) \ {e₁} := by + rintro a ⟨y, hlink⟩ + refine ⟨hlink.edge_mem, ?_⟩ + rintro rfl + rcases G₀.eq_or_eq_of_isLink_of_isLink hlink hl₁ with rfl | rfl + · exact hx_not (Or.inl rfl) + · exact hx_not (Or.inr rfl) + exact ⟨a₁, a₂, a₃, hnot_e₁ hi₁, hnot_e₁ hi₂, hnot_e₁ hi₃, h12, h13, h23⟩ + +/-- It is impossible to have a set `B₁ ⊆ E(G)` disjoint from `E(P e₁)` (`e₁ ∈ E(G₀)`) such that +`B₁.Nonempty`, `(E(G) \ (B₁ ∪ E(P e₁))).Nonempty`, and both `B₁` and `B₁ ∪ E(P e₁)` have boundary +in `V(G₀)` of size `≤ 2`. -/ +theorem not_both_sep_of_union_path (h : SubData G G₀ P) {e₁ : β} (he₁ : e₁ ∈ E(G₀)) + {B₁ : Set β} (hB₁ : B₁ ⊆ E(G)) (hdisj : Disjoint B₁ E(P e₁)) + (hne₁ : B₁.Nonempty) (hne₂ : (E(G) \ (B₁ ∪ E(P e₁))).Nonempty) + (hbd₁ : bdry G B₁ ⊆ V(G₀)) (hc₁ : (bdry G B₁).ncard ≤ 2) + (hbd₂ : bdry G (B₁ ∪ E(P e₁)) ⊆ V(G₀)) (hc₂ : (bdry G (B₁ ∪ E(P e₁))).ncard ≤ 2) : + False := by + have hPe₁_sub : E(P e₁) ⊆ E(G) := by + intro g hg + rw [h.eunion] + exact mem_iUnion₂.mpr ⟨e₁, he₁, hg⟩ + obtain ⟨_, _, -, -, hPe₁_ne, -⟩ := h.path e₁ he₁ + have hne₁' : (E(G) \ B₁).Nonempty := by + obtain ⟨g, hg⟩ := hPe₁_ne + exact ⟨g, hPe₁_sub hg, disjoint_right.mp hdisj hg⟩ + have hB₂_sub : B₁ ∪ E(P e₁) ⊆ E(G) := union_subset hB₁ hPe₁_sub + have hne₂_left : (B₁ ∪ E(P e₁)).Nonempty := hne₁.mono subset_union_left + obtain ⟨f₁, hf₁, hsep₁⟩ := h.sep hB₁ hbd₁ hc₁ hne₁ hne₁' + obtain ⟨f₂, hf₂, hsep₂⟩ := h.sep hB₂_sub hbd₂ hc₂ hne₂_left hne₂ + have hB₁_eq : B₁ = E(P f₁) := by + rcases hsep₁ with h1 | h1 + · exact h1 + · exfalso + obtain ⟨g₁, hg₁⟩ := hPe₁_ne + have hg₁_in : g₁ ∈ E(P f₁) := h1 ▸ ⟨hPe₁_sub hg₁, disjoint_right.mp hdisj hg₁⟩ + have hf₁_eq : f₁ = e₁ := by + by_contra hne + exact disjoint_left.mp (h.disj f₁ hf₁ e₁ he₁ hne).1 hg₁_in hg₁ + subst hf₁_eq + obtain ⟨g₂, hg₂E, hg₂_not⟩ := hne₂ + have hg₂_in : g₂ ∈ E(P f₁) := h1 ▸ ⟨hg₂E, fun h => hg₂_not (Or.inl h)⟩ + exact hg₂_not (Or.inr hg₂_in) + have hB₂_compl_eq : E(G) \ (B₁ ∪ E(P e₁)) = E(P f₂) := by + rcases hsep₂ with h2 | h2 + · exfalso + obtain ⟨g₁, hg₁⟩ := hPe₁_ne + have hg₁_in : g₁ ∈ E(P f₂) := h2 ▸ Or.inr hg₁ + have hf₂_eq : f₂ = e₁ := by + by_contra hne + exact disjoint_left.mp (h.disj f₂ hf₂ e₁ he₁ hne).1 hg₁_in hg₁ + subst hf₂_eq + obtain ⟨g₀, hg₀⟩ := hne₁ + have hg₀_in : g₀ ∈ E(P f₂) := h2 ▸ Or.inl hg₀ + exact disjoint_left.mp hdisj hg₀ hg₀_in + · exact h2 + obtain ⟨a₁, a₂, a₃, ha₁, ha₂, ha₃, h12, h13, h23⟩ := exists_three_edges_outside h he₁ + have hmem_f : ∀ a ∈ E(G₀) \ {e₁}, a = f₁ ∨ a = f₂ := by + rintro a ⟨ha, ha_ne⟩ + obtain ⟨_, _, -, -, ⟨g, hg⟩, -⟩ := h.path a ha + have hgE : g ∈ E(G) := by + rw [h.eunion] + exact mem_iUnion₂.mpr ⟨a, ha, hg⟩ + have hg_not_e₁ : g ∉ E(P e₁) := + disjoint_left.mp (h.disj a ha e₁ he₁ ha_ne).1 hg + by_cases hgB₁ : g ∈ B₁ + · left + rw [hB₁_eq] at hgB₁ + by_contra hne + exact disjoint_left.mp (h.disj a ha f₁ hf₁ hne).1 hg hgB₁ + · right + have hg_in : g ∈ E(P f₂) := hB₂_compl_eq ▸ ⟨hgE, not_or.mpr ⟨hgB₁, hg_not_e₁⟩⟩ + by_contra hne + exact disjoint_left.mp (h.disj a ha f₂ hf₂ hne).1 hg hg_in + rcases hmem_f a₁ ha₁ with h1 | h1 <;> + rcases hmem_f a₂ ha₂ with h2 | h2 <;> + rcases hmem_f a₃ ha₃ with h3 | h3 + · exact h12 (h1.trans h2.symm) + · exact h12 (h1.trans h2.symm) + · exact h13 (h1.trans h3.symm) + · exact h23 (h2.trans h3.symm) + · exact h23 (h2.trans h3.symm) + · exact h13 (h1.trans h3.symm) + · exact h12 (h1.trans h2.symm) + · exact h12 (h1.trans h2.symm) + +/-- If `e ∈ E(G₀)` has ends `u, v` and `bdry G A ∩ (V(P e) \ V(G₀)) = {w}`, then removing `E(P e)` +from `A` and adding `E(P e)` to `A` move `w` to `{u, v}` without increasing the boundary size. -/ +theorem move_internal_bdry (h : SubData G G₀ P) {A : Set β} (hA : A ⊆ E(G)) + {e : β} (he : e ∈ E(G₀)) {w : α} (hw : bdry G A ∩ (V(P e) \ V(G₀)) = {w}) : + ∃ u v : α, G₀.IsLink e u v ∧ + bdry G (A \ E(P e)) ⊆ (bdry G A \ (V(P e) \ V(G₀))) ∪ {u} ∧ + bdry G (A ∪ E(P e)) ⊆ (bdry G A \ (V(P e) \ V(G₀))) ∪ {v} := by + obtain ⟨u, v, hl, ⟨hle, W, hs, hV, hE⟩, _, hcap⟩ := h.path e he + have hw_mem : w ∈ bdry G A ∧ w ∈ V(P e) \ V(G₀) := by + have : w ∈ bdry G A ∩ (V(P e) \ V(G₀)) := hw.symm ▸ mem_singleton w + exact this + have hwP : w ∈ V(P e) := hw_mem.2.1 + have hwW : w ∈ W.support := by rwa [hV] at hwP + obtain ⟨W₁, W₂, hW_eq⟩ := W.exists_append_of_mem hwW + have hs' : (W₁.append W₂).IsSimple := hW_eq ▸ hs + have hsp := GM09.isSimple_of_append hs' + have hnd_V : (W₁.support ++ W₂.support.tail).Nodup := by + have h1 : (W₁.append W₂).support.Nodup := hs' + rwa [GraphWalk.support_append] at h1 + have hd_V := List.nodup_append.mp hnd_V + have hmemE : ∀ {g : β}, g ∈ W.edges → g ∈ E(G) := fun {g} hg => + hle.edgeSet_mono (by rw [hE]; exact hg) + have hincG : ∀ {g x}, (P e).Inc g x → G.Inc g x := fun ⟨y, hy⟩ => ⟨y, hy.mono hle⟩ + have hW₁_pure : ∀ e₁ ∈ W₁.edges, ∀ e₂ ∈ W₁.edges, e₁ ∈ A ↔ e₂ ∈ A := by + refine walk_pure W₁ hsp.1 fun x hx hxu hxw e₁ he₁ e₂ he₂ hi₁ hi₂ => ?_ + have hxW : x ∈ W.support := by + rw [hW_eq, GraphWalk.mem_support_append] + exact Or.inl hx + have hxv : x ≠ v := by + rintro rfl + have hv₂ : x ∈ W₂.support := W₂.end_mem_support + rw [W₂.support_eq_cons] at hv₂ + rcases List.mem_cons.mp hv₂ with rfl | hv_tail + · exact hxw rfl + · exact hd_V.2.2 x hx x hv_tail rfl + have hx_not_V₀ : x ∉ V(G₀) := by + intro hx₀ + have hm : x ∈ V(P e) ∩ V(G₀) := ⟨hV ▸ hxW, hx₀⟩ + rw [hcap] at hm + exact hm.elim hxu hxv + have hx_not_bd : x ∉ bdry G A := by + intro hbd + have : x ∈ bdry G A ∩ (V(P e) \ V(G₀)) := ⟨hbd, hV ▸ hxW, hx_not_V₀⟩ + rw [hw] at this + exact hxw this + have he₁W : e₁ ∈ W.edges := by + rw [hW_eq, GraphWalk.edges_append] + exact List.mem_append_left _ he₁ + have he₂W : e₂ ∈ W.edges := by + rw [hW_eq, GraphWalk.edges_append] + exact List.mem_append_left _ he₂ + constructor <;> intro h₁ <;> by_contra h₂ + · exact hx_not_bd ⟨⟨e₁, h₁, hincG hi₁⟩, e₂, ⟨hmemE he₂W, h₂⟩, hincG hi₂⟩ + · exact hx_not_bd ⟨⟨e₂, h₁, hincG hi₂⟩, e₁, ⟨hmemE he₁W, h₂⟩, hincG hi₁⟩ + have hW₂_pure : ∀ e₁ ∈ W₂.edges, ∀ e₂ ∈ W₂.edges, e₁ ∈ A ↔ e₂ ∈ A := by + refine walk_pure W₂ hsp.2 fun x hx hxw hxv e₁ he₁ e₂ he₂ hi₁ hi₂ => ?_ + have hxW : x ∈ W.support := by + rw [hW_eq, GraphWalk.mem_support_append] + exact Or.inr hx + have hxu : x ≠ u := by + rintro rfl + have hu₁ : x ∈ W₁.support := W₁.start_mem_support + rw [W₂.support_eq_cons] at hx + rcases List.mem_cons.mp hx with rfl | hx_tail + · exact hxw rfl + · exact hd_V.2.2 x hu₁ x hx_tail rfl + have hx_not_V₀ : x ∉ V(G₀) := by + intro hx₀ + have hm : x ∈ V(P e) ∩ V(G₀) := ⟨hV ▸ hxW, hx₀⟩ + rw [hcap] at hm + exact hm.elim hxu hxv + have hx_not_bd : x ∉ bdry G A := by + intro hbd + have : x ∈ bdry G A ∩ (V(P e) \ V(G₀)) := ⟨hbd, hV ▸ hxW, hx_not_V₀⟩ + rw [hw] at this + exact hxw this + have he₁W : e₁ ∈ W.edges := by + rw [hW_eq, GraphWalk.edges_append] + exact List.mem_append_right _ he₁ + have he₂W : e₂ ∈ W.edges := by + rw [hW_eq, GraphWalk.edges_append] + exact List.mem_append_right _ he₂ + constructor <;> intro h₁ <;> by_contra h₂ + · exact hx_not_bd ⟨⟨e₁, h₁, hincG hi₁⟩, e₂, ⟨hmemE he₂W, h₂⟩, hincG hi₂⟩ + · exact hx_not_bd ⟨⟨e₂, h₁, hincG hi₂⟩, e₁, ⟨hmemE he₁W, h₂⟩, hincG hi₁⟩ + have huw : u ≠ w := fun h => hw_mem.2.2 (h ▸ hl.left_mem) + have hvw : v ≠ w := fun h => hw_mem.2.2 (h ▸ hl.right_mem) + obtain ⟨gu, hgu₁, hiu⟩ := exists_edge_at_start W₁ huw + obtain ⟨gv, hgv₂_rev, hiv⟩ := exists_edge_at_start W₂.reverse hvw + have hgv₂ : gv ∈ W₂.edges := by + rw [GraphWalk.edges_reverse] at hgv₂_rev + exact List.mem_reverse.mp hgv₂_rev + have hgu_Pe : gu ∈ E(P e) := by + rw [hE, hW_eq, GraphWalk.edges_append] + exact List.mem_append_left _ hgu₁ + have hgv_Pe : gv ∈ E(P e) := by + rw [hE, hW_eq, GraphWalk.edges_append] + exact List.mem_append_right _ hgv₂ + have hnot_iff : ¬ (gu ∈ A ↔ gv ∈ A) := by + intro hiff + obtain ⟨⟨f₁, hf₁A, hif₁⟩, f₂, ⟨hf₂E, hf₂A⟩, hif₂⟩ := hw_mem.1 + have hf₁_Pe : f₁ ∈ E(P e) := + inc_mem_path_of_notMem_V₀ h he hw_mem.2.1 hw_mem.2.2 (hA hf₁A) hif₁ + have hf₂_Pe : f₂ ∈ E(P e) := + inc_mem_path_of_notMem_V₀ h he hw_mem.2.1 hw_mem.2.2 hf₂E hif₂ + have hall : ∀ g ∈ E(P e), g ∈ A ↔ gu ∈ A := by + intro g hg + rw [hE, hW_eq, mem_ofPred_eq, GraphWalk.edges_append] at hg + rcases List.mem_append.mp hg with hg₁ | hg₂ + · exact hW₁_pure g hg₁ gu hgu₁ + · exact (hW₂_pure g hg₂ gv hgv₂).trans hiff.symm + exact hf₂A ((hall f₂ hf₂_Pe).mpr ((hall f₁ hf₁_Pe).mp hf₁A)) + have hstep : ∀ (u' v' : α) (gu' gv' : β), + G₀.IsLink e u' v' → ({u', v'} : Set α) = {u, v} → + gu' ∈ E(P e) → gv' ∈ E(P e) → G.Inc gu' u' → G.Inc gv' v' → + gu' ∈ A → gv' ∉ A → + bdry G (A \ E(P e)) ⊆ (bdry G A \ (V(P e) \ V(G₀))) ∪ {u'} ∧ + bdry G (A ∪ E(P e)) ⊆ (bdry G A \ (V(P e) \ V(G₀))) ∪ {v'} := by + intro u' v' gu' gv' hl' hpair hgu' hgv' hiu' hiv' hgu'A hgv'A + refine ⟨?_, ?_⟩ + · intro x hx + by_cases hxu' : x = u' + · exact Or.inr hxu' + · left + have hx_not_int : x ∉ V(P e) \ V(G₀) := by + rintro ⟨hxP, hx₀⟩ + obtain ⟨⟨g, ⟨hgA, hgPe⟩, hig⟩, -⟩ := hx + exact hgPe (inc_mem_path_of_notMem_V₀ h he hxP hx₀ (hA hgA) hig) + refine ⟨?_, hx_not_int⟩ + obtain ⟨⟨g₁, ⟨hg₁A, _⟩, hig₁⟩, g₂, ⟨hg₂E, hg₂_not⟩, hig₂⟩ := hx + refine ⟨⟨g₁, hg₁A, hig₁⟩, g₂, ⟨hg₂E, fun hg₂A => hg₂_not ⟨hg₂A, fun hg₂Pe => ?_⟩⟩, hig₂⟩ + have hxP : x ∈ V(P e) := ((hle.isLink_iff hg₂Pe).mpr hig₂.choose_spec).left_mem + have hxV₀ : x ∈ V(G₀) := by_contra fun hx₀ => hx_not_int ⟨hxP, hx₀⟩ + have hx_uv : x ∈ ({u', v'} : Set α) := hpair.symm ▸ (hcap ▸ ⟨hxP, hxV₀⟩) + have hxv' : x = v' := hx_uv.resolve_left hxu' + subst hxv' + have hgeq : g₂ = gv' := h.eq_of_end he hl'.right_mem hg₂Pe hgv' hig₂ hiv' + exact hgv'A (hgeq ▸ hg₂A) + · intro x hx + by_cases hxv' : x = v' + · exact Or.inr hxv' + · left + have hx_not_int : x ∉ V(P e) \ V(G₀) := by + rintro ⟨hxP, hx₀⟩ + obtain ⟨-, g, ⟨hgE, hg_not⟩, hig⟩ := hx + exact hg_not (Or.inr (inc_mem_path_of_notMem_V₀ h he hxP hx₀ hgE hig)) + refine ⟨?_, hx_not_int⟩ + obtain ⟨⟨g₁, hg₁_in, hig₁⟩, g₂, ⟨hg₂E, hg₂_not⟩, hig₂⟩ := hx + refine ⟨⟨g₁, ?_, hig₁⟩, g₂, ⟨hg₂E, fun hg₂A => hg₂_not (Or.inl hg₂A)⟩, hig₂⟩ + rcases hg₁_in with hg₁A | hg₁Pe + · exact hg₁A + · have hxP : x ∈ V(P e) := ((hle.isLink_iff hg₁Pe).mpr hig₁.choose_spec).left_mem + have hxV₀ : x ∈ V(G₀) := by_contra fun hx₀ => hx_not_int ⟨hxP, hx₀⟩ + have hx_uv : x ∈ ({u', v'} : Set α) := hpair.symm ▸ (hcap ▸ ⟨hxP, hxV₀⟩) + have hxu' : x = u' := hx_uv.resolve_right hxv' + subst hxu' + have hgeq : g₁ = gu' := h.eq_of_end he hl'.left_mem hg₁Pe hgu' hig₁ hiu' + exact hgeq ▸ hgu'A + by_cases hguA : gu ∈ A + · have hgvA : gv ∉ A := fun h => hnot_iff ⟨fun _ => h, fun _ => hguA⟩ + exact ⟨u, v, hl, (hstep u v gu gv hl rfl hgu_Pe hgv_Pe (hincG hiu) (hincG hiv) hguA hgvA).1, + (hstep u v gu gv hl rfl hgu_Pe hgv_Pe (hincG hiu) (hincG hiv) hguA hgvA).2⟩ + · have hgvA : gv ∈ A := by_contra fun h => hnot_iff ⟨fun h1 => (hguA h1).elim, fun h2 => + (h h2).elim⟩ + exact ⟨v, u, hl.symm, + (hstep v u gv gu hl.symm (pair_comm v u) hgv_Pe hgu_Pe (hincG hiv) (hincG hiu) hgvA hguA).1, + (hstep v u gv gu hl.symm (pair_comm v u) hgv_Pe hgu_Pe (hincG hiv) (hincG hiu) hgvA hguA).2⟩ + +/-- For any `A ⊆ E(G)` with `(bdry G A).ncard ≤ 2`, `A.Nonempty`, and `(E(G) \ A).Nonempty`, +`bdry G A` is contained in `V(P e)` for some `e ∈ E(G₀)`. -/ +theorem bdry_subset_path (h : SubData G G₀ P) {A : Set β} (hA : A ⊆ E(G)) + (hc : (bdry G A).ncard ≤ 2) (hne : A.Nonempty) (hne' : (E(G) \ A).Nonempty) : + ∃ e ∈ E(G₀), bdry G A ⊆ V(P e) := by + by_cases hbd₀ : bdry G A ⊆ V(G₀) + · obtain ⟨e, he, heq | heq⟩ := h.sep hA hbd₀ hc hne hne' + · refine ⟨e, he, ?_⟩ + intro x hx + obtain ⟨⟨g, hgA, y, hlink⟩, -⟩ := hx + rw [heq] at hgA + obtain ⟨_, _, -, hp, -, -⟩ := h.path e he + exact ((hp.le.isLink_iff hgA).mpr hlink).left_mem + · refine ⟨e, he, ?_⟩ + intro x hx + obtain ⟨-, g, hgA, y, hlink⟩ := hx + rw [heq] at hgA + obtain ⟨_, _, -, hp, -, -⟩ := h.path e he + exact ((hp.le.isLink_iff hgA).mpr hlink).left_mem + · obtain ⟨w₁, hw₁_bd, hw₁_not₀⟩ := not_subset.mp hbd₀ + have hw₁_V : w₁ ∈ V(G) := bdry_subset_V A hw₁_bd + rw [h.vunion] at hw₁_V + have hw₁_union : w₁ ∈ ⋃ e ∈ E(G₀), V(P e) := hw₁_V.resolve_left hw₁_not₀ + obtain ⟨e₁, he₁, hw₁_Pe₁⟩ := mem_iUnion₂.mp hw₁_union + refine ⟨e₁, he₁, ?_⟩ + by_contra hnot_sub + obtain ⟨z, hz_bd, hz_not_Pe₁⟩ := not_subset.mp hnot_sub + have hzw₁ : z ≠ w₁ := fun h => hz_not_Pe₁ (h ▸ hw₁_Pe₁) + have hbd_eq : bdry G A = {w₁, z} := by + have hsub : ({w₁, z} : Set α) ⊆ bdry G A := by + rintro x (rfl | rfl) + · exact hw₁_bd + · exact hz_bd + exact (Set.eq_of_subset_of_ncard_le hsub + (by rw [Set.ncard_pair hzw₁.symm]; exact hc) (finite_bdry h A)).symm + have hex_A' : ∃ (A' : Set β) (u' : α), + A' ⊆ E(G) ∧ u' ∈ V(G₀) ∧ bdry G A' ⊆ {w₁, u'} ∧ w₁ ∈ bdry G A' ∧ + (A' \ E(P e₁)).Nonempty ∧ (E(G) \ (A' ∪ E(P e₁))).Nonempty := by + by_cases hz₀ : z ∈ V(G₀) + · refine ⟨A, z, hA, hz₀, hbd_eq.subset, hw₁_bd, ?_, ?_⟩ + · obtain ⟨⟨g, hgA, hig⟩, -⟩ := hz_bd + exact ⟨g, hgA, fun hgP => not_inc_of_notMem_path h he₁ hz_not_Pe₁ hgP hig⟩ + · obtain ⟨-, g, ⟨hgE, hgA⟩, hig⟩ := hz_bd + exact ⟨g, hgE, not_or.mpr ⟨hgA, fun hgP => not_inc_of_notMem_path h he₁ hz_not_Pe₁ hgP + hig⟩⟩ + · have hz_V : z ∈ V(G) := bdry_subset_V A hz_bd + rw [h.vunion] at hz_V + obtain ⟨e₂, he₂, hz_Pe₂⟩ := mem_iUnion₂.mp (hz_V.resolve_left hz₀) + have he12 : e₁ ≠ e₂ := fun heq => hz_not_Pe₁ (heq ▸ hz_Pe₂) + have hdisj12 : Disjoint E(P e₁) E(P e₂) := (h.disj e₁ he₁ e₂ he₂ he12).1 + have hPe₂_sub : E(P e₂) ⊆ E(G) := fun g hg => by + rw [h.eunion]; exact mem_iUnion₂.mpr ⟨e₂, he₂, hg⟩ + obtain ⟨_, _, -, -, ⟨g₂, hg₂_Pe₂⟩, -⟩ := h.path e₂ he₂ + have hz_inter : bdry G A ∩ (V(P e₂) \ V(G₀)) = {z} := by + ext x + rw [hbd_eq] + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff, mem_sdiff] + constructor + · exact fun ⟨hx, hxP, hx₀⟩ => hx.resolve_left (fun hxw => + hx₀ ((h.disj e₁ he₁ e₂ he₂ he12).2 ⟨hxw ▸ hw₁_Pe₁, hxP⟩)) + · rintro rfl + exact ⟨Or.inr rfl, hz_Pe₂, hz₀⟩ + obtain ⟨u₂, v₂, hl₂, hs₁, hs₂⟩ := move_internal_bdry h hA he₂ hz_inter + have hdiff₂ : bdry G A \ (V(P e₂) \ V(G₀)) = {w₁} := by + ext x + rw [hbd_eq] + simp only [mem_sdiff, mem_insert_iff, mem_singleton_iff] + constructor + · exact fun ⟨hx, hnot⟩ => hx.resolve_right (fun hxz => hnot (hxz ▸ ⟨hz_Pe₂, hz₀⟩)) + · rintro rfl + exact ⟨Or.inl rfl, fun ⟨hwP₂, _⟩ => + hw₁_not₀ ((h.disj e₁ he₁ e₂ he₂ he12).2 ⟨hw₁_Pe₁, hwP₂⟩)⟩ + rw [hdiff₂] at hs₁ hs₂ + obtain ⟨⟨gw₁, hgw₁A, higw₁⟩, fw₁, ⟨hfw₁E, hfw₁A⟩, hifw₁⟩ := hw₁_bd + have hgw₁_Pe₁ : gw₁ ∈ E(P e₁) := + inc_mem_path_of_notMem_V₀ h he₁ hw₁_Pe₁ hw₁_not₀ (hA hgw₁A) higw₁ + have hfw₁_Pe₁ : fw₁ ∈ E(P e₁) := + inc_mem_path_of_notMem_V₀ h he₁ hw₁_Pe₁ hw₁_not₀ hfw₁E hifw₁ + have hw₁_in_diff : w₁ ∈ bdry G (A \ E(P e₂)) := + ⟨⟨gw₁, ⟨hgw₁A, disjoint_left.mp hdisj12 hgw₁_Pe₁⟩, higw₁⟩, + fw₁, ⟨hfw₁E, fun h => hfw₁A h.1⟩, hifw₁⟩ + have hw₁_in_union : w₁ ∈ bdry G (A ∪ E(P e₂)) := + ⟨⟨gw₁, Or.inl hgw₁A, higw₁⟩, fw₁, + ⟨hfw₁E, not_or.mpr ⟨hfw₁A, disjoint_left.mp hdisj12 hfw₁_Pe₁⟩⟩, hifw₁⟩ + by_cases hrem : (E(G) \ ((A ∪ E(P e₂)) ∪ E(P e₁))).Nonempty + · refine ⟨A ∪ E(P e₂), v₂, union_subset hA hPe₂_sub, hl₂.right_mem, hs₂, hw₁_in_union, + ⟨g₂, Or.inr hg₂_Pe₂, disjoint_right.mp hdisj12 hg₂_Pe₂⟩, hrem⟩ + · refine ⟨A \ E(P e₂), u₂, sdiff_subset.trans hA, hl₂.left_mem, hs₁, hw₁_in_diff, ?_, + ⟨g₂, hPe₂_sub hg₂_Pe₂, not_or.mpr ⟨fun h => h.2 hg₂_Pe₂, disjoint_right.mp hdisj12 + hg₂_Pe₂⟩⟩⟩ + obtain ⟨a₁, a₂, a₃, ha₁, ha₂, ha₃, h12, h13, _⟩ := exists_three_edges_outside h he₁ + have hex_a : ∃ a ∈ E(G₀) \ {e₁}, a ≠ e₂ := by + by_cases ha₁_eq : a₁ = e₂ + · exact ⟨a₂, ha₂, fun h2 => h12 (ha₁_eq.trans h2.symm)⟩ + · exact ⟨a₁, ha₁, ha₁_eq⟩ + obtain ⟨a, ⟨ha, ha_ne₁⟩, ha_ne₂⟩ := hex_a + obtain ⟨_, _, -, -, ⟨ga, hga⟩, -⟩ := h.path a ha + have hgaE : ga ∈ E(G) := by rw [h.eunion]; exact mem_iUnion₂.mpr ⟨a, ha, hga⟩ + have hga_not₁ : ga ∉ E(P e₁) := disjoint_left.mp (h.disj a ha e₁ he₁ ha_ne₁).1 hga + have hga_not₂ : ga ∉ E(P e₂) := disjoint_left.mp (h.disj a ha e₂ he₂ ha_ne₂).1 hga + have hgaA : ga ∈ A := by + by_contra hgaA + exact hrem ⟨ga, hgaE, not_or.mpr ⟨not_or.mpr ⟨hgaA, hga_not₂⟩, hga_not₁⟩⟩ + exact ⟨ga, ⟨hgaA, hga_not₂⟩, hga_not₁⟩ + obtain ⟨A', u', hA', hu'₀, hbdA', hw₁A', hB₁_ne, hB₂_ne⟩ := hex_A' + have hw₁_inter' : bdry G A' ∩ (V(P e₁) \ V(G₀)) = {w₁} := by + ext x + simp only [mem_inter_iff, mem_sdiff, mem_singleton_iff] + constructor + · exact fun ⟨hx, _, hx₀⟩ => (hbdA' hx).resolve_right (fun hxu => hx₀ (hxu ▸ hu'₀)) + · rintro rfl + exact ⟨hw₁A', hw₁_Pe₁, hw₁_not₀⟩ + obtain ⟨u₁', v₁', hl₁', hsub₁', hsub₂'⟩ := move_internal_bdry h hA' he₁ hw₁_inter' + have hdiff_sub' : bdry G A' \ (V(P e₁) \ V(G₀)) ⊆ {u'} := by + rintro x ⟨hx, hx_not⟩ + exact (hbdA' hx).resolve_left (fun hxw => hx_not (hxw ▸ ⟨hw₁_Pe₁, hw₁_not₀⟩)) + have hs₁' : bdry G (A' \ E(P e₁)) ⊆ {u', u₁'} := + hsub₁'.trans (union_subset_union_left _ hdiff_sub') + have hs₂' : bdry G (A' ∪ E(P e₁)) ⊆ {u', v₁'} := + hsub₂'.trans (union_subset_union_left _ hdiff_sub') + have hbd₁_V₀ : bdry G (A' \ E(P e₁)) ⊆ V(G₀) := by + refine hs₁'.trans ?_ + rintro x (rfl | rfl) + · exact hu'₀ + · exact hl₁'.left_mem + have hc₁ : (bdry G (A' \ E(P e₁))).ncard ≤ 2 := + (Set.ncard_le_ncard hs₁' (Set.toFinite _)).trans (Set.ncard_insert_le _ _ |>.trans (by simp)) + have hbd₂_V₀ : bdry G (A' ∪ E(P e₁)) ⊆ V(G₀) := by + refine hs₂'.trans ?_ + rintro x (rfl | rfl) + · exact hu'₀ + · exact hl₁'.right_mem + have hc₂ : (bdry G (A' ∪ E(P e₁))).ncard ≤ 2 := + (Set.ncard_le_ncard hs₂' (Set.toFinite _)).trans (Set.ncard_insert_le _ _ |>.trans (by simp)) + have hB₂_eq : A' \ E(P e₁) ∪ E(P e₁) = A' ∪ E(P e₁) := sdiff_union_self + have hB₂_ne' : (E(G) \ (A' \ E(P e₁) ∪ E(P e₁))).Nonempty := hB₂_eq.symm ▸ hB₂_ne + exact (not_both_sep_of_union_path h he₁ (sdiff_subset.trans hA') disjoint_sdiff_left + hB₁_ne hB₂_ne' hbd₁_V₀ hc₁ (hB₂_eq ▸ hbd₂_V₀) (hB₂_eq ▸ hc₂)).elim + +/-- If `bdry G A ⊆ V(P e)` (`e ∈ E(G₀)`), then `A ⊆ E(P e)` or `E(G) \ A ⊆ E(P e)`. -/ +theorem subset_or_compl_subset_path (h : SubData G G₀ P) {A : Set β} (hA : A ⊆ E(G)) + {e : β} (he : e ∈ E(G₀)) (hbd : bdry G A ⊆ V(P e)) : + A ⊆ E(P e) ∨ E(G) \ A ⊆ E(P e) := by + by_contra! hnot + obtain ⟨u, v, hl, ⟨hle, _, _, _, _⟩, _, hcap⟩ := h.path e he + have hB₁_ne : (A \ E(P e)).Nonempty := not_subset.mp hnot.1 + have hB₂_ne : (E(G) \ (A \ E(P e) ∪ E(P e))).Nonempty := by + rw [sdiff_union_self] + obtain ⟨g, ⟨hgE, hgA⟩, hgP⟩ := not_subset.mp hnot.2 + exact ⟨g, hgE, not_or.mpr ⟨hgA, hgP⟩⟩ + have hbd_B₁ : bdry G (A \ E(P e)) ⊆ {u, v} := by + intro x hx + rw [← hcap] + have hxP : x ∈ V(P e) := by + by_contra hxP + obtain ⟨⟨g₁, ⟨hg₁A, _⟩, hig₁⟩, g₂, ⟨hg₂E, hg₂_not⟩, hig₂⟩ := hx + have hg₂A : g₂ ∉ A := fun hg₂A => + hg₂_not ⟨hg₂A, fun hg₂P => not_inc_of_notMem_path h he hxP hg₂P hig₂⟩ + exact hxP (hbd ⟨⟨g₁, hg₁A, hig₁⟩, g₂, ⟨hg₂E, hg₂A⟩, hig₂⟩) + refine ⟨hxP, ?_⟩ + by_contra hx₀ + obtain ⟨⟨g₁, ⟨hg₁A, hg₁P⟩, hig₁⟩, -⟩ := hx + exact hg₁P (inc_mem_path_of_notMem_V₀ h he hxP hx₀ (hA hg₁A) hig₁) + have hbd_B₂ : bdry G (A ∪ E(P e)) ⊆ {u, v} := by + intro x hx + rw [← hcap] + have hxP : x ∈ V(P e) := by + by_contra hxP + obtain ⟨⟨g₁, hg₁_in, hig₁⟩, g₂, ⟨hg₂E, hg₂_not⟩, hig₂⟩ := hx + have hg₁A : g₁ ∈ A := hg₁_in.resolve_right fun hg₁P => + not_inc_of_notMem_path h he hxP hg₁P hig₁ + exact hxP (hbd ⟨⟨g₁, hg₁A, hig₁⟩, g₂, ⟨hg₂E, fun hg₂A => hg₂_not (Or.inl hg₂A)⟩, hig₂⟩) + refine ⟨hxP, ?_⟩ + by_contra hx₀ + obtain ⟨-, g₂, ⟨hg₂E, hg₂_not⟩, hig₂⟩ := hx + exact hg₂_not (Or.inr (inc_mem_path_of_notMem_V₀ h he hxP hx₀ hg₂E hig₂)) + have huv_V₀ : ({u, v} : Set α) ⊆ V(G₀) := by + rintro x (rfl | rfl) + · exact hl.left_mem + · exact hl.right_mem + have hc₁ : (bdry G (A \ E(P e))).ncard ≤ 2 := + (Set.ncard_le_ncard hbd_B₁ (Set.toFinite _)).trans (Set.ncard_insert_le _ _ |>.trans (by simp)) + have hc₂ : (bdry G (A ∪ E(P e))).ncard ≤ 2 := + (Set.ncard_le_ncard hbd_B₂ (Set.toFinite _)).trans (Set.ncard_insert_le _ _ |>.trans (by simp)) + have hB₂_eq : A \ E(P e) ∪ E(P e) = A ∪ E(P e) := sdiff_union_self + exact not_both_sep_of_union_path h he (sdiff_subset.trans hA) disjoint_sdiff_left + hB₁_ne hB₂_ne (hbd_B₁.trans huv_V₀) hc₁ + (hB₂_eq ▸ hbd_B₂.trans huv_V₀) (hB₂_eq ▸ hc₂) + +/-- Associativity of `GraphWalk.append`. -/ +theorem walk_append_assoc {H : Graph α β} {a b c d : α} + (W₁ : GraphWalk H a b) (W₂ : GraphWalk H b c) (W₃ : GraphWalk H c d) : + (W₁.append W₂).append W₃ = W₁.append (W₂.append W₃) := by + induction W₁ with + | nil _ => rfl + | cons hlk rest ih => exact congrArg (GraphWalk.cons hlk) (ih W₂) + +/-- Decomposing a walk at one of its edges. -/ +theorem exists_decomp_of_mem_edges {H : Graph α β} {a b : α} (W : GraphWalk H a b) + {g : β} (hg : g ∈ W.edges) : + ∃ (x₀ y₀ : α) (hl : H.IsLink g x₀ y₀) (W₁ : GraphWalk H a x₀) (W₂ : GraphWalk H y₀ b), + W = W₁.append (GraphWalk.cons hl W₂) := by + induction W with + | nil _ => simp [GraphWalk.edges] at hg + | @cons u v w f hlink rest ih => + simp only [GraphWalk.edges, List.mem_cons] at hg + rcases hg with rfl | hg + · exact ⟨u, v, hlink, .nil hlink.left_mem, rest, rfl⟩ + · obtain ⟨x₀, y₀, hl, W₁, W₂, rfl⟩ := ih hg + exact ⟨x₀, y₀, hl, .cons hlink W₁, W₂, rfl⟩ + +private theorem middle_walk_edges_have_uniform_side + {α : Type u} + {β : Type v} + {G : Graph α β} + {P : β → Graph α β} + {e : β} + {A : Set β} + (u : α) + (v : α) + (W : GraphWalk (P e) u v) + (x : α) + (y : α) + (hbd_eq : bdry G A = {x, y}) + (W_ux : GraphWalk (P e) u x) + (W_yv : GraphWalk (P e) y v) + (W_mid : GraphWalk (P e) x y) + (hW_full : W = W_ux.append (W_mid.append W_yv)) + (hs_mid : W_mid.IsSimple) + (hmemE : ∀ {g : β}, g ∈ W.edges → g ∈ E(G)) + (hincG : ∀ {g : β} {z : α}, (P e).Inc g z → G.Inc g z) : + ∀ e₁ ∈ W_mid.edges, ∀ e₂ ∈ W_mid.edges, e₁ ∈ A ↔ e₂ ∈ A := by + refine walk_pure W_mid hs_mid fun z hz hzx hzy e₁ he₁ e₂ he₂ hi₁ hi₂ => ?_ + have hz_not_bd : z ∉ bdry G A := by + rw [hbd_eq] + exact not_or.mpr ⟨hzx, hzy⟩ + have he₁W : e₁ ∈ W.edges := by + rw [hW_full, GraphWalk.edges_append, GraphWalk.edges_append] + exact List.mem_append_right _ (List.mem_append_left _ he₁) + have he₂W : e₂ ∈ W.edges := by + rw [hW_full, GraphWalk.edges_append, GraphWalk.edges_append] + exact List.mem_append_right _ (List.mem_append_left _ he₂) + constructor <;> intro h₁ <;> by_contra h₂ + · exact hz_not_bd ⟨⟨e₁, h₁, hincG hi₁⟩, e₂, ⟨hmemE he₂W, h₂⟩, hincG hi₂⟩ + · exact hz_not_bd ⟨⟨e₂, h₁, hincG hi₂⟩, e₁, ⟨hmemE he₁W, h₂⟩, hincG hi₁⟩ + +/-- When `A ⊆ E(P e)` is nonempty and `(bdry G A).ncard ≤ 2`, `A` is the edge set of a subpath `Q` +of `P e` between the two distinct vertices of `bdry G A`. -/ +theorem sep_of_subset_path (h : SubData G G₀ P) {e : β} (he : e ∈ E(G₀)) + {A : Set β} (hA : A ⊆ E(P e)) (hc : (bdry G A).ncard ≤ 2) (hne : A.Nonempty) : + ∃ (x y : α) (Q : Graph α β), + x ≠ y ∧ bdry G A = {x, y} ∧ Q ≤ P e ∧ + IsGraphPathWithEnds G Q x y ∧ A = E(Q) ∧ verts G A = V(Q) := by + obtain ⟨u, v, hl, ⟨hle, W, hs, hV, hE⟩, _, hcap⟩ := h.path e he + obtain ⟨g₀, hg₀A⟩ := hne + have hg₀W : g₀ ∈ W.edges := by + have : g₀ ∈ E(P e) := hA hg₀A + rwa [hE] at this + obtain ⟨x₀, y₀, hl₀, W₁, W₂, hW_eq⟩ := exists_decomp_of_mem_edges W hg₀W + have hsupp_eq : W.support = W₁.support ++ W₂.support := by + rw [hW_eq, GraphWalk.support_append] + rfl + have hnd_12 : (W₁.support ++ W₂.support).Nodup := hsupp_eq ▸ hs + have hd_12 := List.nodup_append.mp hnd_12 + obtain ⟨fu, hfuE, hfu_not, hifu⟩ := h.exists_other_edge hl + obtain ⟨fv, hfvE, hfv_not, hifv⟩ := h.exists_other_edge hl.symm + have hu_out : u ∈ verts G (E(G) \ A) := ⟨fu, ⟨hfuE, fun h => hfu_not (hA h)⟩, hifu⟩ + have hv_out : v ∈ verts G (E(G) \ A) := ⟨fv, ⟨hfvE, fun h => hfv_not (hA h)⟩, hifv⟩ + have hx₀_in : x₀ ∈ verts G A := ⟨g₀, hg₀A, y₀, hl₀.mono hle⟩ + have hy₀_in : y₀ ∈ verts G A := ⟨g₀, hg₀A, x₀, (hl₀.mono hle).symm⟩ + have hex_x : ∃ x ∈ W₁.support, x ∈ bdry G A := by + by_cases hu_in : u ∈ verts G A + · exact ⟨u, W₁.start_mem_support, hu_in, hu_out⟩ + · obtain ⟨W₁G, hsupp₁, _⟩ := W₁.reverse.exists_transfer (G' := G) + (fun _ _ _ _ hlk => hlk.mono hle) + (fun z hz => hle.vertexSet_mono (W₁.reverse.mem_vertexSet_of_mem_support hz)) + obtain ⟨x, hxG, _, hxbd⟩ := exists_bdry_of_walk W₁G hx₀_in hu_in + rw [hsupp₁, GraphWalk.support_reverse, List.mem_reverse] at hxG + exact ⟨x, hxG, hxbd⟩ + have hex_y : ∃ y ∈ W₂.support, y ∈ bdry G A := by + by_cases hv_in : v ∈ verts G A + · exact ⟨v, W₂.end_mem_support, hv_in, hv_out⟩ + · obtain ⟨W₂G, hsupp₂, _⟩ := W₂.exists_transfer (G' := G) + (fun _ _ _ _ hlk => hlk.mono hle) + (fun z hz => hle.vertexSet_mono (W₂.mem_vertexSet_of_mem_support hz)) + obtain ⟨y, hyG, _, hybd⟩ := exists_bdry_of_walk W₂G hy₀_in hv_in + rw [hsupp₂] at hyG + exact ⟨y, hyG, hybd⟩ + obtain ⟨x, hxW₁, hx_bd⟩ := hex_x + obtain ⟨y, hyW₂, hy_bd⟩ := hex_y + have hxy : x ≠ y := fun heq => hd_12.2.2 x hxW₁ y hyW₂ heq + have hbd_eq : bdry G A = {x, y} := by + have hsub : ({x, y} : Set α) ⊆ bdry G A := by + rintro z (rfl | rfl) + · exact hx_bd + · exact hy_bd + exact (Set.eq_of_subset_of_ncard_le hsub + (by rw [Set.ncard_pair hxy]; exact hc) (finite_bdry h A)).symm + obtain ⟨W_ux, W_xx₀, hW₁_eq⟩ := W₁.exists_append_of_mem hxW₁ + obtain ⟨W_y₀y, W_yv, hW₂_eq⟩ := W₂.exists_append_of_mem hyW₂ + let W_mid : GraphWalk (P e) x y := W_xx₀.append (GraphWalk.cons hl₀ W_y₀y) + have hW_full : W = W_ux.append (W_mid.append W_yv) := by + dsimp [W_mid] + rw [hW_eq, hW₁_eq, hW₂_eq, walk_append_assoc] + exact congrArg (W_ux.append ·) (walk_append_assoc W_xx₀ (GraphWalk.cons hl₀ W_y₀y) W_yv).symm + have hs_full : (W_ux.append (W_mid.append W_yv)).IsSimple := hW_full ▸ hs + have hs_ux : W_ux.IsSimple := (GM09.isSimple_of_append hs_full).1 + have hs_mid_yv : (W_mid.append W_yv).IsSimple := (GM09.isSimple_of_append hs_full).2 + have hs_mid : W_mid.IsSimple := (GM09.isSimple_of_append hs_mid_yv).1 + have hs_yv : W_yv.IsSimple := (GM09.isSimple_of_append hs_mid_yv).2 + have hnd_ux_rest : (W_ux.support ++ (W_mid.append W_yv).support.tail).Nodup := by + have h1 : (W_ux.append (W_mid.append W_yv)).support.Nodup := hs_full + rwa [GraphWalk.support_append] at h1 + have hd_ux_rest := List.nodup_append.mp hnd_ux_rest + have hnd_mid_yv : (W_mid.support ++ W_yv.support.tail).Nodup := by + have h1 : (W_mid.append W_yv).support.Nodup := hs_mid_yv + rwa [GraphWalk.support_append] at h1 + have hd_mid_yv := List.nodup_append.mp hnd_mid_yv + have hmemE : ∀ {g : β}, g ∈ W.edges → g ∈ E(G) := fun {g} hg => + hle.edgeSet_mono (by rw [hE]; exact hg) + have hincG : ∀ {g z}, (P e).Inc g z → G.Inc g z := fun ⟨w, hw⟩ => ⟨w, hw.mono hle⟩ + have hmid_pure : ∀ e₁ ∈ W_mid.edges, ∀ e₂ ∈ W_mid.edges, e₁ ∈ A ↔ e₂ ∈ A := by + exact middle_walk_edges_have_uniform_side (α := α) (β := β) (G := G) (P := P) (e := e) (A := + A) u v W x y hbd_eq W_ux W_yv W_mid hW_full hs_mid hmemE hincG + have hg₀_mid : g₀ ∈ W_mid.edges := by + dsimp [W_mid] + rw [GraphWalk.edges_append] + exact List.mem_append_right _ List.mem_cons_self + have hmid_sub_A : ∀ a ∈ W_mid.edges, a ∈ A := + fun a ha => (hmid_pure a ha g₀ hg₀_mid).mpr hg₀A + have hux_disj_A : ∀ a ∈ W_ux.edges, a ∉ A := by + intro a ha + have hux_ne : u ≠ x := by + rintro rfl + have hlen0 := GraphWalk.IsSimple.length_eq_zero hs_ux + exact List.ne_nil_of_mem ha (List.length_eq_zero_iff.mp hlen0) + have huy : u ≠ y := by + rintro rfl + exact hd_12.2.2 u W₁.start_mem_support u hyW₂ rfl + have hu_not_bd : u ∉ bdry G A := by + rw [hbd_eq] + exact not_or.mpr ⟨hux_ne, huy⟩ + have hu_not_in : u ∉ verts G A := fun hu_in => hu_not_bd ⟨hu_in, hu_out⟩ + obtain ⟨gu, hgu, hiu⟩ := exists_edge_at_start W_ux hux_ne + have hgu_not_A : gu ∉ A := fun h => hu_not_in ⟨gu, h, hincG hiu⟩ + have hux_pure : ∀ e₁ ∈ W_ux.edges, ∀ e₂ ∈ W_ux.edges, e₁ ∈ A ↔ e₂ ∈ A := by + refine walk_pure W_ux hs_ux fun z hz hzu hzx e₁ he₁ e₂ he₂ hi₁ hi₂ => ?_ + have hzy : z ≠ y := by + rintro rfl + have hy_rest : z ∈ (W_mid.append W_yv).support := by + rw [GraphWalk.mem_support_append] + exact Or.inl W_mid.end_mem_support + rw [(W_mid.append W_yv).support_eq_cons] at hy_rest + rcases List.mem_cons.mp hy_rest with rfl | hy_tail + · exact hzx rfl + · exact hd_ux_rest.2.2 z hz z hy_tail rfl + have hz_not_bd : z ∉ bdry G A := by + rw [hbd_eq] + exact not_or.mpr ⟨hzx, hzy⟩ + have he₁W : e₁ ∈ W.edges := by + rw [hW_full, GraphWalk.edges_append] + exact List.mem_append_left _ he₁ + have he₂W : e₂ ∈ W.edges := by + rw [hW_full, GraphWalk.edges_append] + exact List.mem_append_left _ he₂ + constructor <;> intro h₁ <;> by_contra h₂ + · exact hz_not_bd ⟨⟨e₁, h₁, hincG hi₁⟩, e₂, ⟨hmemE he₂W, h₂⟩, hincG hi₂⟩ + · exact hz_not_bd ⟨⟨e₂, h₁, hincG hi₂⟩, e₁, ⟨hmemE he₁W, h₂⟩, hincG hi₁⟩ + exact fun haA => hgu_not_A ((hux_pure a ha gu hgu).mp haA) + have hyv_disj_A : ∀ a ∈ W_yv.edges, a ∉ A := by + intro a ha + have hyv_ne : y ≠ v := by + rintro rfl + have hlen0 := GraphWalk.IsSimple.length_eq_zero hs_yv + exact List.ne_nil_of_mem ha (List.length_eq_zero_iff.mp hlen0) + have hxv : x ≠ v := by + rintro rfl + exact hd_12.2.2 x hxW₁ x W₂.end_mem_support rfl + have hv_not_bd : v ∉ bdry G A := by + rw [hbd_eq] + exact not_or.mpr ⟨Ne.symm hxv, Ne.symm hyv_ne⟩ + have hv_not_in : v ∉ verts G A := fun hv_in => hv_not_bd ⟨hv_in, hv_out⟩ + obtain ⟨gv, hgv_rev, hiv⟩ := exists_edge_at_start W_yv.reverse hyv_ne.symm + have hgv : gv ∈ W_yv.edges := by + rw [GraphWalk.edges_reverse] at hgv_rev + exact List.mem_reverse.mp hgv_rev + have hgv_not_A : gv ∉ A := fun h => hv_not_in ⟨gv, h, hincG hiv⟩ + have hyv_pure : ∀ e₁ ∈ W_yv.edges, ∀ e₂ ∈ W_yv.edges, e₁ ∈ A ↔ e₂ ∈ A := by + refine walk_pure W_yv hs_yv fun z hz hzy hzv e₁ he₁ e₂ he₂ hi₁ hi₂ => ?_ + have hzx : z ≠ x := by + rintro rfl + have hx_mid : z ∈ W_mid.support := W_mid.start_mem_support + rw [W_yv.support_eq_cons] at hz + rcases List.mem_cons.mp hz with rfl | hz_tail + · exact hzy rfl + · exact hd_mid_yv.2.2 z hx_mid z hz_tail rfl + have hz_not_bd : z ∉ bdry G A := by + rw [hbd_eq] + exact not_or.mpr ⟨hzx, hzy⟩ + have he₁W : e₁ ∈ W.edges := by + rw [hW_full, GraphWalk.edges_append, GraphWalk.edges_append] + exact List.mem_append_right _ (List.mem_append_right _ he₁) + have he₂W : e₂ ∈ W.edges := by + rw [hW_full, GraphWalk.edges_append, GraphWalk.edges_append] + exact List.mem_append_right _ (List.mem_append_right _ he₂) + constructor <;> intro h₁ <;> by_contra h₂ + · exact hz_not_bd ⟨⟨e₁, h₁, hincG hi₁⟩, e₂, ⟨hmemE he₂W, h₂⟩, hincG hi₂⟩ + · exact hz_not_bd ⟨⟨e₂, h₁, hincG hi₂⟩, e₁, ⟨hmemE he₁W, h₂⟩, hincG hi₁⟩ + exact fun haA => hgv_not_A ((hyv_pure a ha gv hgv).mp haA) + let Q : Graph α β := walkSubgraph W_mid + have hQ_le_Pe : Q ≤ P e := walkSubgraph_le W_mid + have hQ_path : IsGraphPathWithEnds G Q x y := + (isGraphPathWithEnds_walkSubgraph hs_mid).of_le (hQ_le_Pe.trans hle) + have hA_eq_EQ : A = E(Q) := by + rw [edgeSet_walkSubgraph] + ext a + simp only [mem_ofPred_eq] + constructor + · intro haA + have haW : a ∈ W.edges := by + have : a ∈ E(P e) := hA haA + rwa [hE] at this + rw [hW_full, GraphWalk.edges_append, GraphWalk.edges_append] at haW + rcases List.mem_append.mp haW with hux | hrest + · exact (hux_disj_A a hux haA).elim + · rcases List.mem_append.mp hrest with hmid | hyv + · exact hmid + · exact (hyv_disj_A a hyv haA).elim + · exact fun ha => hmid_sub_A a ha + have hverts_eq_VQ : verts G A = V(Q) := by + rw [hA_eq_EQ, edgeSet_walkSubgraph, vertexSet_walkSubgraph] + ext z + simp only [verts, mem_ofPred_eq] + constructor + · rintro ⟨a, ha, hia⟩ + have haQ : a ∈ E(Q) := by rw [edgeSet_walkSubgraph]; exact ha + exact inc_mem_support W_mid ha (SubData.inc_path hle (hQ_le_Pe.edgeSet_mono haQ) hia) + · intro hz + by_cases hzx : z = x + · subst hzx + obtain ⟨a, ha, hia⟩ := exists_edge_at_start W_mid hxy + exact ⟨a, ha, hincG hia⟩ + · by_cases hzy : z = y + · subst hzy + obtain ⟨a, ha_rev, hia⟩ := exists_edge_at_start W_mid.reverse hxy.symm + rw [GraphWalk.edges_reverse] at ha_rev + exact ⟨a, List.mem_reverse.mp ha_rev, hincG hia⟩ + · obtain ⟨a, ha, _, _, _, hia, _⟩ := exists_two_edges_at_inner W_mid hs_mid hz hzx hzy + exact ⟨a, ha, hincG hia⟩ + exact ⟨x, y, Q, hxy, hbd_eq, hQ_le_Pe, hQ_path, hA_eq_EQ, hverts_eq_VQ⟩ + +/-- **General 2-Separation Theorem for Subdivisions of Simple 3-Connected Graphs**: +For any `A ⊆ E(G)` with `(bdry G A).ncard ≤ 2`, `A.Nonempty`, and `(E(G) \ A).Nonempty`, either +`A` or `E(G) \ A` is the edge set of a subpath `Q` of some subdivision path `P e` (`e ∈ E(G₀)`) +joining the two vertices of `bdry G A`. -/ +theorem sep_general (h : SubData G G₀ P) {A : Set β} (hA : A ⊆ E(G)) + (hc : (bdry G A).ncard ≤ 2) (hne : A.Nonempty) (hne' : (E(G) \ A).Nonempty) : + ∃ (e : β) (x y : α) (Q : Graph α β), + e ∈ E(G₀) ∧ x ≠ y ∧ bdry G A = {x, y} ∧ Q ≤ P e ∧ + IsGraphPathWithEnds G Q x y ∧ + ((A = E(Q) ∧ verts G A = V(Q)) ∨ + (E(G) \ A = E(Q) ∧ verts G (E(G) \ A) = V(Q))) := by + obtain ⟨e, he, hbd_Pe⟩ := bdry_subset_path h hA hc hne hne' + rcases subset_or_compl_subset_path h hA he hbd_Pe with hsub | hsub + · obtain ⟨x, y, Q, hxy, hbd_eq, hQ_le, hQ_path, hAE, hAV⟩ := + sep_of_subset_path h he hsub hc hne + exact ⟨e, x, y, Q, he, hxy, hbd_eq, hQ_le, hQ_path, Or.inl ⟨hAE, hAV⟩⟩ + · have hc' : (bdry G (E(G) \ A)).ncard ≤ 2 := by rwa [bdry_compl hA] + obtain ⟨x, y, Q, hxy, hbd_eq, hQ_le, hQ_path, hAE, hAV⟩ := + sep_of_subset_path h he hsub hc' hne' + rw [bdry_compl hA] at hbd_eq + exact ⟨e, x, y, Q, he, hxy, hbd_eq, hQ_le, hQ_path, Or.inr ⟨hAE, hAV⟩⟩ + +/-- Every vertex of a subdivision of a simple 3-connected graph is incident with an edge. -/ +theorem exists_inc_of_mem_V (h : SubData G G₀ P) {x : α} (hx : x ∈ V(G)) : + ∃ g ∈ E(G), G.Inc g x := by + have hex_P : ∃ e ∈ E(G₀), x ∈ V(P e) := by + rw [h.vunion] at hx + rcases hx with hx₀ | hxP + · obtain ⟨e, _, _, _, _, _, ⟨y, hl⟩, _, _⟩ := + IsSimpleThreeConnected.exists_three_edges h.simple hx₀ + obtain ⟨u, v, hlu, _, _, hcap⟩ := h.path e hl.edge_mem + have hx_uv : x = u ∨ x = v := G₀.eq_or_eq_of_isLink_of_isLink hl hlu + have hx_cap : x ∈ V(P e) ∩ V(G₀) := by + rw [hcap] + exact hx_uv + exact ⟨e, hl.edge_mem, hx_cap.1⟩ + · obtain ⟨e, he, hxP⟩ := mem_iUnion₂.mp hxP + exact ⟨e, he, hxP⟩ + obtain ⟨e, he, hxP⟩ := hex_P + obtain ⟨u, v, hl, ⟨hle, W, hs, hV, hE⟩, ⟨g₀, hg₀⟩, _⟩ := h.path e he + have huv : u ≠ v := by + rintro rfl + have hlen0 := GraphWalk.IsSimple.length_eq_zero hs + have hg₀W : g₀ ∈ W.edges := by rwa [hE] at hg₀ + exact List.ne_nil_of_mem hg₀W (List.length_eq_zero_iff.mp hlen0) + have hxW : x ∈ W.support := by rwa [hV] at hxP + by_cases hxu : x = u + · subst hxu + obtain ⟨g, hg, w, hlk⟩ := exists_edge_at_start W huv + have hgP : g ∈ E(P e) := by rw [hE]; exact hg + exact ⟨g, hle.edgeSet_mono hgP, w, hlk.mono hle⟩ + · by_cases hxv : x = v + · subst hxv + obtain ⟨g, hg_rev, w, hlk⟩ := exists_edge_at_start W.reverse huv.symm + rw [GraphWalk.edges_reverse] at hg_rev + have hgP : g ∈ E(P e) := by rw [hE]; exact List.mem_reverse.mp hg_rev + exact ⟨g, hle.edgeSet_mono hgP, w, hlk.mono hle⟩ + · obtain ⟨g, hg, _, _, _, ⟨w, hlk⟩, _⟩ := exists_two_edges_at_inner W hs hxW hxu hxv + have hgP : g ∈ E(P e) := by rw [hE]; exact hg + exact ⟨g, hle.edgeSet_mono hgP, w, hlk.mono hle⟩ + +end SubDataSepGeneral + +end GraphMinor.GM14 diff --git a/LeanPool/GraphMinor/GM14/Suppress.lean b/LeanPool/GraphMinor/GM14/Suppress.lean new file mode 100644 index 0000000000..830caa68c3 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Suppress.lean @@ -0,0 +1,1003 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.WhitneyGraph + +/-! +# Recognising a subdivision of a 3-connected graph + +To use Whitney's theorem in the proof of (6.4) we must show that a graph is a subdivision of a +simple +3-connected graph. The paper does this by suppressing the vertices of valency 2. Here we record what +we +need in `Good`: a finite graph with no loops, with four vertices of valency other than 2, such that +for +each separation of order at most 2 one side is `Thin`. A thin side is either empty or looks by its +counts like a path that joins the two common vertices through vertices of valency 2. + +`good_sub` proves that a good graph is a subdivision of a simple 3-connected graph. We suppress one +vertex of valency 2 at a time (`susp`). The new graph is again good (`Good.susp`), and a subdivision +of +it gives one of the old graph (`sub_step`). When no vertex of valency 2 is left, thin sides are +trivial, +so the graph itself is simple and 3-connected. +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Graph GraphMinor.GM06 GraphMinor.GM09 GraphMinor.Surface + +universe u v + +variable {α : Type u} {β : Type v} + +/-- The extended number of edges at `v`. For a loopless graph this is the valency of `v`. -/ +noncomputable def deg (G : Graph α β) (v : α) : ℕ∞ := {e | G.Inc e v}.encard + +/-- The side `G₁` of a separation `(G₁, G₂)` of `G` has nothing beyond `G₂`, or it has two common +vertices with `G₂`, its other vertices have valency 2, and it has at most one more edge than it has +other vertices. -/ +def Thin (G G₁ G₂ : Graph α β) : Prop := + (V(G₁) ⊆ V(G₂) ∧ E(G₁) = ∅) ∨ + ((V(G₁) ∩ V(G₂)).encard = 2 ∧ (∀ v ∈ V(G₁) \ V(G₂), deg G v = 2) ∧ + E(G₁).encard ≤ (V(G₁) \ V(G₂)).encard + 1) + +/-- A graph that we can show to be a subdivision of a simple 3-connected graph. -/ +structure Good (G : Graph α β) : Prop where + finV : V(G).Finite + finE : E(G).Finite + no_loop : ∀ e v, ¬ G.IsLink e v v + four : 4 ≤ {v | v ∈ V(G) ∧ deg G v ≠ 2}.ncard + sep : ∀ G₁ G₂ : Graph α β, IsGraphSeparation G G₁ G₂ → (V(G₁) ∩ V(G₂)).ncard ≤ 2 → + Thin G G₁ G₂ ∨ Thin G G₂ G₁ + +/-- The subgraph of `G` with vertices `X` and the ends of `F`, and with edges `F`. -/ +def part (G : Graph α β) (X : Set α) (F : Set β) : Graph α β where + vertexSet := X ∪ {u | ∃ g ∈ F, G.Inc g u} + IsLink g u v := g ∈ F ∧ G.IsLink g u v + isLink_symm := fun _ _ => ⟨fun _ _ hxy => ⟨hxy.1, hxy.2.symm⟩⟩ + eq_or_eq_of_isLink_of_isLink := fun _ _ _ _ _ h₁ h₂ => G.eq_or_eq_of_isLink_of_isLink h₁.2 h₂.2 + left_mem_of_isLink := fun _ u v hl => Or.inr ⟨_, hl.1, v, hl.2⟩ + +theorem part_link {G : Graph α β} {X : Set α} {F : Set β} {g : β} {u v : α} : + (part G X F).IsLink g u v ↔ g ∈ F ∧ G.IsLink g u v := Iff.rfl + +theorem V_part {G : Graph α β} {X : Set α} {F : Set β} (h : ∀ g ∈ F, ∀ u, G.Inc g u → u ∈ X) : + V(part G X F) = X := by + apply subset_antisymm + · rintro u (hu | ⟨g, hg, hi⟩) + · exact hu + · exact h g hg u hi + · exact fun u hu => Or.inl hu + +theorem E_part {G : Graph α β} {X : Set α} {F : Set β} (h : F ⊆ E(G)) : E(part G X F) = F := by + ext g + rw [(part G X F).edge_mem_iff_exists_isLink] + constructor + · rintro ⟨_, _, hl⟩ + exact hl.1 + · intro hg + obtain ⟨x, y, hl⟩ := (G.edge_mem_iff_exists_isLink g).mp (h hg) + exact ⟨x, y, hg, hl⟩ + +theorem part_le {G : Graph α β} {X : Set α} {F : Set β} (hX : X ⊆ V(G)) : part G X F ≤ G := by + refine ⟨?_, fun _ _ _ hl => hl.2⟩ + rintro u (hu | ⟨g, -, y, hl⟩) + · exact hX hu + · exact hl.left_mem + +/-- The vertex `w` has exactly the edges `e` and `f`, to different vertices `x` and `y`. -/ +structure Susp (G : Graph α β) (w x y : α) (e f : β) : Prop where + ne : e ≠ f + le : G.IsLink e w x + lf : G.IsLink f w y + only : ∀ g, G.Inc g w → g = e ∨ g = f + hxw : x ≠ w + hyw : y ≠ w + hxy : x ≠ y + +variable {G : Graph α β} {w x y : α} {e f : β} + +theorem Susp.ne_w (h : Susp G w x y e f) {g : β} {u v : α} (hl : G.IsLink g u v) (hge : g ≠ e) + (hgf : g ≠ f) : u ≠ w := by + rintro rfl + rcases h.only g ⟨v, hl⟩ with rfl | rfl + · exact hge rfl + · exact hgf rfl + +/-- Suppress the vertex `w`: delete it and `f`, and let `e` join `x` to `y`. -/ +def susp (G : Graph α β) (w x y : α) (e f : β) (h : Susp G w x y e f) : Graph α β where + vertexSet := V(G) \ {w} + IsLink g u v := (g ≠ e ∧ g ≠ f ∧ G.IsLink g u v) ∨ (g = e ∧ ((u = x ∧ v = y) ∨ (u = y ∧ v = x))) + isLink_symm := fun _ _ => ⟨fun _ _ hxy => by + rcases hxy with ⟨a, b, c⟩ | ⟨a, ⟨p, q⟩ | ⟨p, q⟩⟩ + · exact Or.inl ⟨a, b, c.symm⟩ + · exact Or.inr ⟨a, Or.inr ⟨q, p⟩⟩ + · exact Or.inr ⟨a, Or.inl ⟨q, p⟩⟩⟩ + eq_or_eq_of_isLink_of_isLink := fun g a b c d h₁ h₂ => by + rcases h₁ with ⟨p, q, r⟩ | ⟨p, ha⟩ + · rcases h₂ with ⟨_, _, r'⟩ | ⟨p', -⟩ + · exact G.eq_or_eq_of_isLink_of_isLink r r' + · exact absurd p' p + · rcases h₂ with ⟨p', -⟩ | ⟨-, hc⟩ + · exact absurd p p' + · rcases ha with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> rcases hc with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> simp + left_mem_of_isLink := fun g u v hl => by + rcases hl with ⟨p, q, r⟩ | ⟨-, ⟨rfl, -⟩ | ⟨rfl, -⟩⟩ + · exact ⟨r.left_mem, h.ne_w r p q⟩ + · exact ⟨h.le.right_mem, h.hxw⟩ + · exact ⟨h.lf.right_mem, h.hyw⟩ + +theorem susp_link (h : Susp G w x y e f) {g : β} {u v : α} : + (susp G w x y e f h).IsLink g u v ↔ + (g ≠ e ∧ g ≠ f ∧ G.IsLink g u v) ∨ (g = e ∧ ((u = x ∧ v = y) ∨ (u = y ∧ v = x))) := Iff.rfl + +theorem V_susp (h : Susp G w x y e f) : V(susp G w x y e f h) = V(G) \ {w} := rfl + +theorem E_susp (h : Susp G w x y e f) : E(susp G w x y e f h) = E(G) \ {f} := by + ext g + rw [(susp G w x y e f h).edge_mem_iff_exists_isLink] + constructor + · rintro ⟨u, v, ⟨p, q, r⟩ | ⟨rfl, -⟩⟩ + · exact ⟨r.edge_mem, q⟩ + · exact ⟨h.le.edge_mem, h.ne⟩ + · rintro ⟨hg, hgf⟩ + by_cases hge : g = e + · exact ⟨x, y, Or.inr ⟨hge, Or.inl ⟨rfl, rfl⟩⟩⟩ + · obtain ⟨u, v, hl⟩ := (G.edge_mem_iff_exists_isLink g).mp hg + exact ⟨u, v, Or.inl ⟨hge, hgf, hl⟩⟩ + +theorem susp_inc (h : Susp G w x y e f) {g : β} {v : α} : + (susp G w x y e f h).Inc g v ↔ (g ≠ e ∧ g ≠ f ∧ G.Inc g v) ∨ (g = e ∧ (v = x ∨ v = y)) := by + constructor + · rintro ⟨u, ⟨p, q, r⟩ | ⟨p, ⟨rfl, -⟩ | ⟨rfl, -⟩⟩⟩ + · exact Or.inl ⟨p, q, u, r⟩ + · exact Or.inr ⟨p, Or.inl rfl⟩ + · exact Or.inr ⟨p, Or.inr rfl⟩ + · rintro (⟨p, q, u, r⟩ | ⟨p, rfl | rfl⟩) + · exact ⟨u, Or.inl ⟨p, q, r⟩⟩ + · exact ⟨y, Or.inr ⟨p, Or.inl ⟨rfl, rfl⟩⟩⟩ + · exact ⟨x, Or.inr ⟨p, Or.inr ⟨rfl, rfl⟩⟩⟩ + +theorem inc_of_ne (h : Susp G w x y e f) {g : β} {v : α} (hv : v ≠ w) : + G.Inc g v ↔ (g ≠ e ∧ g ≠ f ∧ G.Inc g v) ∨ (g = e ∧ v = x) ∨ (g = f ∧ v = y) := by + constructor + · intro hi + by_cases h₁ : g = e + · subst h₁ + obtain ⟨u, hu⟩ := hi + rcases G.eq_or_eq_of_isLink_of_isLink hu h.le with rfl | rfl + · exact absurd rfl hv + · exact Or.inr (Or.inl ⟨rfl, rfl⟩) + by_cases h₂ : g = f + · subst h₂ + obtain ⟨u, hu⟩ := hi + rcases G.eq_or_eq_of_isLink_of_isLink hu h.lf with rfl | rfl + · exact absurd rfl hv + · exact Or.inr (Or.inr ⟨rfl, rfl⟩) + exact Or.inl ⟨h₁, h₂, hi⟩ + · rintro (⟨-, -, hi⟩ | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) + · exact hi + · exact ⟨w, h.le.symm⟩ + · exact ⟨w, h.lf.symm⟩ + +/-- Suppressing `w` does not change the number of edges at another vertex. -/ +theorem deg_susp (h : Susp G w x y e f) {v : α} (hv : v ≠ w) : + deg (susp G w x y e f h) v = deg G v := by + classical + let T : Set β := {g | g ≠ e ∧ g ≠ f ∧ G.Inc g v} + have heT : e ∉ T := fun hh => hh.1 rfl + have hfT : f ∉ T := fun hh => hh.2.1 rfl + by_cases hx : v = x + · have h₁ : {g | (susp G w x y e f h).Inc g v} = insert e T := by + ext g + rw [mem_ofPred_eq, susp_inc] + simp only [mem_insert_iff, T, mem_ofPred_eq] + constructor + · rintro (a | ⟨a, -⟩) + · exact Or.inr a + · exact Or.inl a + · rintro (a | a) + · exact Or.inr ⟨a, Or.inl hx⟩ + · exact Or.inl a + have h₂ : {g | G.Inc g v} = insert e T := by + ext g + rw [mem_ofPred_eq, inc_of_ne h hv] + simp only [mem_insert_iff, T, mem_ofPred_eq] + constructor + · rintro (a | ⟨a, -⟩ | ⟨-, b⟩) + · exact Or.inr a + · exact Or.inl a + · exact absurd (hx.symm.trans b) h.hxy + · rintro (a | a) + · exact Or.inr (Or.inl ⟨a, hx⟩) + · exact Or.inl a + simp only [deg, h₁, h₂] + by_cases hy : v = y + · have h₁ : {g | (susp G w x y e f h).Inc g v} = insert e T := by + ext g + rw [mem_ofPred_eq, susp_inc] + simp only [mem_insert_iff, T, mem_ofPred_eq] + constructor + · rintro (a | ⟨a, -⟩) + · exact Or.inr a + · exact Or.inl a + · rintro (a | a) + · exact Or.inr ⟨a, Or.inr hy⟩ + · exact Or.inl a + have h₂ : {g | G.Inc g v} = insert f T := by + ext g + rw [mem_ofPred_eq, inc_of_ne h hv] + simp only [mem_insert_iff, T, mem_ofPred_eq] + constructor + · rintro (a | ⟨-, b⟩ | ⟨a, -⟩) + · exact Or.inr a + · exact absurd b hx + · exact Or.inl a + · rintro (a | a) + · exact Or.inr (Or.inr ⟨a, hy⟩) + · exact Or.inl a + simp only [deg, h₁, h₂] + rw [encard_insert_of_notMem heT, encard_insert_of_notMem hfT] + · have h₁ : {g | (susp G w x y e f h).Inc g v} = T := by + ext g + rw [mem_ofPred_eq, susp_inc] + constructor + · rintro (a | ⟨-, b | b⟩) + · exact a + · exact absurd b hx + · exact absurd b hy + · exact Or.inl + have h₂ : {g | G.Inc g v} = T := by + ext g + rw [mem_ofPred_eq, inc_of_ne h hv] + constructor + · rintro (a | ⟨-, b⟩ | ⟨-, b⟩) + · exact a + · exact absurd b hx + · exact absurd b hy + · exact Or.inl + simp only [deg, h₁, h₂] + +/-- A separation of the suppressed graph with `e` on the left gives one of `G`, by adding `w` and +`f` +to the left side. -/ +theorem thin_of_lift (hG : Good G) (h : Susp G w x y e f) (hw2 : deg G w = 2) {G₁ G₂ : Graph α β} + (hs : IsGraphSeparation (susp G w x y e f h) G₁ G₂) (hord : (V(G₁) ∩ V(G₂)).ncard ≤ 2) + (he : e ∈ E(G₁)) : + Thin (susp G w x y e f h) G₁ G₂ ∨ Thin (susp G w x y e f h) G₂ G₁ := by + classical + obtain ⟨hl₁, hl₂, hV, hE, hdis⟩ := hs + set G' := susp G w x y e f h with hG' + have hV' : V(G') = V(G) \ {w} := rfl + have hE' : E(G') = E(G) \ {f} := E_susp h + have hV₁ : V(G₁) ⊆ V(G') := hl₁.vertexSet_mono + have hV₂ : V(G₂) ⊆ V(G') := hl₂.vertexSet_mono + have hE₁ : E(G₁) ⊆ E(G) \ {f} := hE' ▸ hl₁.edgeSet_mono + have hE₂ : E(G₂) ⊆ E(G) \ {f} := hE' ▸ hl₂.edgeSet_mono + have hw₁ : w ∉ V(G₁) := fun hh => (hV₁ hh).2 rfl + have hw₂ : w ∉ V(G₂) := fun hh => (hV₂ hh).2 rfl + have hf₁ : f ∉ E(G₁) := fun hh => (hE₁ hh).2 rfl + have hf₂ : f ∉ E(G₂) := fun hh => (hE₂ hh).2 rfl + have he₂ : e ∉ E(G₂) := fun hh => disjoint_left.mp hdis he hh + -- The ends of `e` are on the left. + obtain ⟨a, b, hab⟩ := (G₁.edge_mem_iff_exists_isLink e).mp he + have hab' := hl₁.isLink_mono hab + have hxy₁ : x ∈ V(G₁) ∧ y ∈ V(G₁) := by + rcases hab' with ⟨p, -⟩ | ⟨-, ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩⟩ + · exact absurd rfl p + · exact ⟨hab.left_mem, hab.right_mem⟩ + · exact ⟨hab.right_mem, hab.left_mem⟩ + have hsub₁ : ∀ g ∈ E(G₁) ∪ {f}, ∀ u, G.Inc g u → u ∈ V(G₁) ∪ {w} := by + rintro g (hg | rfl) u ⟨v, hl⟩ + · by_cases hge : g = e + · subst hge + rcases G.eq_or_eq_of_isLink_of_isLink hl h.le with rfl | rfl + · exact Or.inr rfl + · exact Or.inl hxy₁.1 + · obtain ⟨c, d, hcd⟩ := (G₁.edge_mem_iff_exists_isLink g).mp hg + have hgf : g ≠ f := fun hh => hf₁ (hh ▸ hg) + have : G'.IsLink g c d := hl₁.isLink_mono hcd + have hcd' : G.IsLink g c d := by + rcases this with ⟨-, -, r⟩ | ⟨p, -⟩ + · exact r + · exact absurd p hge + rcases G.eq_or_eq_of_isLink_of_isLink hl hcd' with rfl | rfl + · exact Or.inl hcd.left_mem + · exact Or.inl hcd.right_mem + · rcases G.eq_or_eq_of_isLink_of_isLink hl h.lf with rfl | rfl + · exact Or.inr rfl + · exact Or.inl hxy₁.2 + have hsub₂ : ∀ g ∈ E(G₂), ∀ u, G.Inc g u → u ∈ V(G₂) := by + rintro g hg u ⟨v, hl⟩ + have hge : g ≠ e := fun hh => he₂ (hh ▸ hg) + have hgf : g ≠ f := fun hh => hf₂ (hh ▸ hg) + obtain ⟨c, d, hcd⟩ := (G₂.edge_mem_iff_exists_isLink g).mp hg + have : G'.IsLink g c d := hl₂.isLink_mono hcd + have hcd' : G.IsLink g c d := by + rcases this with ⟨-, -, r⟩ | ⟨p, -⟩ + · exact r + · exact absurd p hge + rcases G.eq_or_eq_of_isLink_of_isLink hl hcd' with rfl | rfl + · exact hcd.left_mem + · exact hcd.right_mem + have hE₁G : E(G₁) ∪ {f} ⊆ E(G) := by + rintro g (hg | rfl) + · exact (hE₁ hg).1 + · exact h.lf.edge_mem + have hE₂G : E(G₂) ⊆ E(G) := fun g hg => (hE₂ hg).1 + let A := part G (V(G₁) ∪ {w}) (E(G₁) ∪ {f}) + let B := part G V(G₂) E(G₂) + have hVA : V(A) = V(G₁) ∪ {w} := V_part hsub₁ + have hVB : V(B) = V(G₂) := V_part hsub₂ + have hEA : E(A) = E(G₁) ∪ {f} := E_part hE₁G + have hEB : E(B) = E(G₂) := E_part hE₂G + have hcap : V(A) ∩ V(B) = V(G₁) ∩ V(G₂) := by + rw [hVA, hVB] + ext z + constructor + · rintro ⟨hz | rfl, hz'⟩ + · exact ⟨hz, hz'⟩ + · exact absurd hz' hw₂ + · exact fun hz => ⟨Or.inl hz.1, hz.2⟩ + have hsep : IsGraphSeparation G A B := by + refine ⟨part_le ?_, part_le fun z hz => (hV₂ hz).1, ?_, ?_, ?_⟩ + · rintro z (hz | rfl) + · exact (hV₁ hz).1 + · exact h.le.left_mem + · rw [hVA, hVB] + ext z + constructor + · rintro ((hz | rfl) | hz) + · exact (hV₁ hz).1 + · exact h.le.left_mem + · exact (hV₂ hz).1 + · intro hz + by_cases hzw : z = w + · exact Or.inl (Or.inr hzw) + · have : z ∈ V(G₁) ∪ V(G₂) := hV ▸ (⟨hz, hzw⟩ : z ∈ V(G')) + rcases this with h' | h' + · exact Or.inl (Or.inl h') + · exact Or.inr h' + · rw [hEA, hEB] + ext g + constructor + · rintro ((hg | rfl) | hg) + · exact (hE₁ hg).1 + · exact h.lf.edge_mem + · exact (hE₂ hg).1 + · intro hg + by_cases hgf : g = f + · exact Or.inl (Or.inr hgf) + · have : g ∈ E(G₁) ∪ E(G₂) := hE ▸ (hE' ▸ ⟨hg, hgf⟩ : g ∈ E(G')) + rcases this with h' | h' + · exact Or.inl (Or.inl h') + · exact Or.inr h' + · rw [hEA, hEB] + refine disjoint_left.mpr ?_ + rintro g (hg | rfl) hg' + · exact disjoint_left.mp hdis hg hg' + · exact hf₂ hg' + have hdeg : ∀ z, z ≠ w → deg G' z = deg G z := fun z hz => deg_susp h hz + have hdiff₂ : V(B) \ V(A) = V(G₂) \ V(G₁) := by + rw [hVA, hVB] + ext z + constructor + · exact fun hz => ⟨hz.1, fun hh => hz.2 (Or.inl hh)⟩ + · refine fun hz => ⟨hz.1, ?_⟩ + rintro (hh | rfl) + · exact hz.2 hh + · exact hw₂ hz.1 + have hdiff₁ : V(A) \ V(B) = insert w (V(G₁) \ V(G₂)) := by + rw [hVA, hVB] + ext z + constructor + · rintro ⟨hz | rfl, hz'⟩ + · exact Or.inr ⟨hz, hz'⟩ + · exact Or.inl rfl + · rintro (rfl | ⟨hz, hz'⟩) + · exact ⟨Or.inr rfl, hw₂⟩ + · exact ⟨Or.inl hz, hz'⟩ + have hfinV₁ : (V(G₁) \ V(G₂)).Finite := hG.finV.subset fun z hz => (hV₁ hz.1).1 + have hfinE₁ : E(G₁).Finite := hG.finE.subset fun g hg => (hE₁ hg).1 + have hw_not : w ∉ V(G₁) \ V(G₂) := fun hh => hw₁ hh.1 + rw [← hcap] at hord + rcases hG.sep A B hsep hord with ht | ht + · rcases ht with ⟨-, hemp⟩ | ⟨hc, hd, hn⟩ + · have : e ∈ E(A) := hEA ▸ Or.inl he + rw [hemp] at this + exact absurd this (notMem_empty _) + · refine Or.inl (Or.inr ⟨hcap ▸ hc, fun z hz => ?_, ?_⟩) + · have hzw : z ≠ w := fun hh => hw₁ (hh ▸ hz.1) + rw [hdeg z hzw] + exact hd z (hdiff₁ ▸ Or.inr hz) + · rw [hEA, hdiff₁, union_singleton, encard_insert_of_notMem hf₁, + encard_insert_of_notMem hw_not, ← hfinE₁.cast_ncard_eq, ← hfinV₁.cast_ncard_eq] at hn + rw [← hfinE₁.cast_ncard_eq, ← hfinV₁.cast_ncard_eq] + exact_mod_cast (show E(G₁).ncard ≤ (V(G₁) \ V(G₂)).ncard + 1 from by + have hle : E(G₁).ncard + 1 ≤ (V(G₁) \ V(G₂)).ncard + 1 + 1 := by exact_mod_cast hn + omega) + · rcases ht with ⟨hsub, hemp⟩ | ⟨hc, hd, hn⟩ + · refine Or.inr (Or.inl ⟨fun z hz => ?_, by rw [← hEB]; exact hemp⟩) + have hz' : z ∈ V(B) := hVB ▸ hz + have := hsub hz' + rw [hVA] at this + rcases this with h' | rfl + · exact h' + · exact absurd hz hw₂ + · refine Or.inr (Or.inr ⟨by rw [inter_comm, ← hcap, inter_comm]; exact hc, fun z hz => ?_, ?_⟩) + · have hzw : z ≠ w := fun hh => hw₂ (hh ▸ hz.1) + rw [hdeg z hzw] + exact hd z (hdiff₂ ▸ hz) + · rwa [hEB, hdiff₂] at hn + +/-- A good graph stays good when a vertex of valency 2 is suppressed. -/ +theorem Good.susp (hG : Good G) (h : Susp G w x y e f) (hw2 : deg G w = 2) : + Good (susp G w x y e f h) := by + classical + have hE' := E_susp h + have hV' : V(GraphMinor.GM14.Whitney.susp G w x y e f h) = V(G) \ {w} := rfl + refine ⟨hG.finV.subset sdiff_subset, ?_, ?_, ?_, ?_⟩ + · rw [hE'] + exact hG.finE.subset sdiff_subset + · rintro g v (⟨-, -, r⟩ | ⟨-, ⟨rfl, b⟩ | ⟨rfl, b⟩⟩) + · exact hG.no_loop _ _ r + · exact h.hxy b + · exact h.hxy b.symm + · have heq : {v | v ∈ V(GraphMinor.GM14.Whitney.susp G w x y e f h) ∧ + deg (GraphMinor.GM14.Whitney.susp G w x y e f h) v ≠ 2} = {v | v ∈ V(G) ∧ deg G v ≠ 2} := by + ext z + simp only [mem_ofPred_eq, hV'] + constructor + · rintro ⟨⟨hz, hzw⟩, hd⟩ + exact ⟨hz, by rwa [deg_susp h hzw] at hd⟩ + · rintro ⟨hz, hd⟩ + have hzw : z ≠ w := fun hh => hd (hh ▸ hw2) + exact ⟨⟨hz, hzw⟩, by rwa [deg_susp h hzw]⟩ + rw [heq] + exact hG.four + · intro G₁ G₂ hs hord + have heE : e ∈ E(G₁) ∪ E(G₂) := by + rw [hs.2.2.2.1, hE'] + exact ⟨h.le.edge_mem, h.ne⟩ + rcases heE with he | he + · exact thin_of_lift hG h hw2 hs hord he + · have hs' : IsGraphSeparation (GraphMinor.GM14.Whitney.susp G w x y e f h) G₂ G₁ := + ⟨hs.2.1, hs.1, by rw [union_comm]; exact hs.2.2.1, by rw [union_comm]; exact hs.2.2.2.1, + hs.2.2.2.2.symm⟩ + rw [inter_comm] at hord + exact (thin_of_lift hG h hw2 hs' hord he).symm + +/-- A walk of the suppressed graph gives a walk of `G`, which goes through `w` in place of `e`. -/ +theorem lift_walk (h : Susp G w x y e f) {Q' Q : Graph α β} (hle : Q' ≤ susp G w x y e f h) + (hV : V(Q') ⊆ V(Q)) (hl : ∀ g u v, Q'.IsLink g u v → g ≠ e → Q.IsLink g u v) + (he : e ∈ E(Q') → Q.IsLink e w x ∧ Q.IsLink f w y) : + ∀ {a b : α} (W' : GraphWalk Q' a b), ∃ W : GraphWalk Q a b, + (∀ z, z ≠ w → (z ∈ W.support ↔ z ∈ W'.support)) ∧ (w ∈ W.support ↔ e ∈ W'.edges) ∧ + (∀ g, g ∈ W.edges ↔ g ∈ W'.edges ∨ (g = f ∧ e ∈ W'.edges)) ∧ + (W'.IsSimple → W.IsSimple) := by + intro a b W' + induction W' with + | nil hv => + refine ⟨.nil (hV hv), fun z _ => Iff.rfl, ?_, ?_, ?_⟩ + · have := (hle.vertexSet_mono hv).2 + simp only [GraphWalk.support, GraphWalk.edges, List.mem_singleton, List.not_mem_nil, + iff_false] + exact fun hh => this hh.symm + · simp [GraphWalk.edges] + · exact fun _ => by simp [GraphWalk.IsSimple, GraphWalk.support] + | @cons u v t g hlink rest ih => + obtain ⟨W₀, h₁, h₂, h₃, h₄⟩ := ih + have huw : u ≠ w := (hle.vertexSet_mono hlink.left_mem).2 + have hvw : v ≠ w := (hle.vertexSet_mono hlink.right_mem).2 + by_cases hg : g = e + · subst hg + have hee := he hlink.edge_mem + have hlk := hle.isLink_mono hlink + have hset : (u = x ∧ v = y) ∨ (u = y ∧ v = x) := by + rcases hlk with ⟨p, -⟩ | ⟨-, hc⟩ + · exact absurd rfl p + · exact hc + have hnotin : ∀ (hs : (GraphWalk.cons hlink rest).IsSimple), g ∉ rest.edges := by + intro hs hin + exact (List.nodup_cons.mp hs).1 (inc_mem_support rest hin ⟨v, hlink⟩) + rcases hset with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · refine ⟨.cons hee.1.symm (.cons hee.2 W₀), fun z hz => ?_, ?_, fun g' => ?_, fun hs => ?_⟩ + · simp only [GraphWalk.support, List.mem_cons, hz, false_or, h₁ z hz] + · simp [GraphWalk.support, GraphWalk.edges] + · simp only [GraphWalk.edges, List.mem_cons, h₃ g', true_or, and_true] + tauto + · have hrs : rest.IsSimple := (List.nodup_cons.mp hs).2 + have hun : u ∉ rest.support := (List.nodup_cons.mp hs).1 + have hne := hnotin hs + refine List.nodup_cons.mpr ⟨?_, List.nodup_cons.mpr ⟨?_, h₄ hrs⟩⟩ + · simp only [GraphWalk.support, List.mem_cons, not_or] + exact ⟨huw, fun hh => hun ((h₁ u huw).mp hh)⟩ + · exact fun hh => hne (h₂.mp hh) + · refine ⟨.cons hee.2.symm (.cons hee.1 W₀), fun z hz => ?_, ?_, fun g' => ?_, fun hs => ?_⟩ + · simp only [GraphWalk.support, List.mem_cons, hz, false_or, h₁ z hz] + · simp [GraphWalk.support, GraphWalk.edges] + · simp only [GraphWalk.edges, List.mem_cons, h₃ g', true_or, and_true] + tauto + · have hrs : rest.IsSimple := (List.nodup_cons.mp hs).2 + have hun : u ∉ rest.support := (List.nodup_cons.mp hs).1 + have hne := hnotin hs + refine List.nodup_cons.mpr ⟨?_, List.nodup_cons.mpr ⟨?_, h₄ hrs⟩⟩ + · simp only [GraphWalk.support, List.mem_cons, not_or] + exact ⟨huw, fun hh => hun ((h₁ u huw).mp hh)⟩ + · exact fun hh => hne (h₂.mp hh) + · refine ⟨.cons (hl _ _ _ hlink hg) W₀, fun z hz => ?_, ?_, fun g' => ?_, fun hs => ?_⟩ + · simp only [GraphWalk.support, List.mem_cons, h₁ z hz] + · simp only [GraphWalk.support, GraphWalk.edges, List.mem_cons, h₂] + constructor + · rintro (hh | hh) + · exact absurd hh.symm huw + · exact Or.inr hh + · rintro (hh | hh) + · exact absurd hh.symm hg + · exact Or.inr hh + · have heg : ¬ e = g := fun hh => hg hh.symm + simp only [GraphWalk.edges, List.mem_cons, h₃ g', heg, false_or, or_assoc] + · have hrs : rest.IsSimple := (List.nodup_cons.mp hs).2 + have hun : u ∉ rest.support := (List.nodup_cons.mp hs).1 + have hu₀ : u ∉ W₀.support := fun hz => hun ((h₁ u huw).mp hz) + have hsimple : List.Nodup W₀.support := h₄ hrs + change List.Nodup (u :: W₀.support) + exact List.nodup_cons.mpr ⟨hu₀, hsimple⟩ + +/-- The graph `Q'` with `w` and `f` added if `e` is in `Q'`. -/ +def lift (G : Graph α β) (w : α) (e f : β) (Q' : Graph α β) : Graph α β := + part G (V(Q') ∪ {z | z = w ∧ e ∈ E(Q')}) (E(Q') ∪ {g | g = f ∧ e ∈ E(Q')}) + +/-- A subdivision of the suppressed graph gives a subdivision of `G`. -/ +theorem sub_step (h : Susp G w x y e f) {G₀ : Graph α β} + (hs : IsSubdivisionOf (susp G w x y e f h) G₀) : IsSubdivisionOf G G₀ := by + classical + obtain ⟨hV₀, P', h₁, h₂, h₃, h₄⟩ := hs + set G' := susp G w x y e f h with hG' + have hV' : V(G') = V(G) \ {w} := rfl + have hE' : E(G') = E(G) \ {f} := E_susp h + have hlk : ∀ {g u v}, G'.IsLink g u v → g ≠ e → G.IsLink g u v := by + intro g u v hl hg + rcases hl with ⟨-, -, r⟩ | ⟨p, -⟩ + · exact r + · exact absurd p hg + have hw₀ : w ∉ V(G₀) := fun hh => (hV₀ hh).2 rfl + -- Facts on the lift of a subgraph. + have hfacts : ∀ Q' : Graph α β, Q' ≤ G' → + V(lift G w e f Q') = V(Q') ∪ {z | z = w ∧ e ∈ E(Q')} ∧ + E(lift G w e f Q') = E(Q') ∪ {g | g = f ∧ e ∈ E(Q')} ∧ lift G w e f Q' ≤ G := by + intro Q' hQ + have hsub : V(Q') ∪ {z | z = w ∧ e ∈ E(Q')} ⊆ V(G) := by + rintro z (hz | ⟨rfl, -⟩) + · exact (hQ.vertexSet_mono hz).1 + · exact h.le.left_mem + have hinc : ∀ g ∈ E(Q') ∪ {g | g = f ∧ e ∈ E(Q')}, ∀ u, G.Inc g u → + u ∈ V(Q') ∪ {z | z = w ∧ e ∈ E(Q')} := by + rintro g (hg | ⟨rfl, hee⟩) u ⟨v, hl⟩ + · by_cases hge : g = e + · subst hge + rcases G.eq_or_eq_of_isLink_of_isLink hl h.le with rfl | rfl + · exact Or.inr ⟨rfl, hg⟩ + · obtain ⟨c, d, hcd⟩ := (Q'.edge_mem_iff_exists_isLink g).mp hg + rcases hQ.isLink_mono hcd with ⟨p, -⟩ | ⟨-, ⟨rfl, -⟩ | ⟨-, rfl⟩⟩ + · exact absurd rfl p + · exact Or.inl hcd.left_mem + · exact Or.inl hcd.right_mem + · obtain ⟨c, d, hcd⟩ := (Q'.edge_mem_iff_exists_isLink g).mp hg + rcases G.eq_or_eq_of_isLink_of_isLink hl (hlk (hQ.isLink_mono hcd) hge) with rfl | rfl + · exact Or.inl hcd.left_mem + · exact Or.inl hcd.right_mem + · rcases G.eq_or_eq_of_isLink_of_isLink hl h.lf with rfl | rfl + · exact Or.inr ⟨rfl, hee⟩ + · obtain ⟨c, d, hcd⟩ := (Q'.edge_mem_iff_exists_isLink e).mp hee + rcases hQ.isLink_mono hcd with ⟨p, -⟩ | ⟨-, ⟨-, rfl⟩ | ⟨rfl, -⟩⟩ + · exact absurd rfl p + · exact Or.inl hcd.right_mem + · exact Or.inl hcd.left_mem + have hsubE : E(Q') ∪ {g | g = f ∧ e ∈ E(Q')} ⊆ E(G) := by + rintro g (hg | ⟨rfl, -⟩) + · exact (hE' ▸ hQ.edgeSet_mono hg : g ∈ E(G) \ {f}).1 + · exact h.lf.edge_mem + exact ⟨V_part hinc, E_part hsubE, part_le hsub⟩ + refine ⟨fun z hz => (hV₀ hz).1, lift G w e f ∘ P', fun e₀ he₀ => ?_, fun e₁ he₁ e₂ he₂ hne => ?_, + ?_, ?_⟩ + · obtain ⟨u, v, hl₀, hp, hne, hcap⟩ := h₁ e₀ he₀ + obtain ⟨hle, W', hsimp, hVw, hEw⟩ := hp + obtain ⟨hVl, hEl, hle'⟩ := hfacts _ hle + obtain ⟨W, a, b, c, d⟩ := lift_walk (Q := lift G w e f (P' e₀)) h hle + (fun z hz => hVl ▸ Or.inl hz) + (fun g p q hl hg => ⟨Or.inl ((P' e₀).edge_mem_iff_exists_isLink g |>.mpr ⟨p, q, hl⟩), + hlk (hle.isLink_mono hl) hg⟩) + (fun hee => ⟨⟨Or.inl hee, h.le⟩, ⟨Or.inr ⟨rfl, hee⟩, h.lf⟩⟩) W' + refine ⟨u, v, hl₀, ⟨hle', W, d hsimp, ?_, ?_⟩, ?_, ?_⟩ + · ext z + simp only [Function.comp_apply, hVl, mem_union, mem_ofPred_eq, hVw, hEw] + by_cases hz : z = w + · subst hz + have : z ∉ W'.support := fun hh => (hle.vertexSet_mono (hVw ▸ hh)).2 rfl + simp [this, b] + · simp [hz, a z hz] + · ext g + simp only [Function.comp_apply, hEl, mem_union, mem_ofPred_eq, hEw, c g] + · exact hne.mono fun g hg => hEl ▸ Or.inl hg + · simp only [Function.comp_apply, hVl] + rw [union_inter_distrib_right, ← hcap] + have : {z | z = w ∧ e ∈ E(P' e₀)} ∩ V(G₀) = ∅ := by + ext z + simp only [mem_inter_iff, mem_ofPred_eq, mem_empty_iff_false, iff_false] + rintro ⟨⟨rfl, -⟩, hz⟩ + exact hw₀ hz + rw [this, union_empty] + · obtain ⟨u₁, v₁, -, hp₁, -⟩ := h₁ e₁ he₁ + obtain ⟨u₂, v₂, -, hp₂, -⟩ := h₁ e₂ he₂ + obtain ⟨hV₁, hE₁, -⟩ := hfacts _ hp₁.1 + obtain ⟨hV₂, hE₂, -⟩ := hfacts _ hp₂.1 + obtain ⟨hd, hi⟩ := h₂ e₁ he₁ e₂ he₂ hne + have hfnot : ∀ {Q'}, Q' ≤ G' → f ∉ E(Q') := fun hQ hh => + (hE' ▸ hQ.edgeSet_mono hh : f ∈ E(G) \ {f}).2 rfl + have hwnot : ∀ {Q'}, Q' ≤ G' → w ∉ V(Q') := fun hQ hh => (hQ.vertexSet_mono hh).2 rfl + simp only [Function.comp_apply] + refine ⟨?_, ?_⟩ + · rw [hE₁, hE₂] + refine disjoint_left.mpr ?_ + rintro g (hg | ⟨hgf, hee⟩) (hg' | ⟨hgf', hee'⟩) + · exact disjoint_left.mp hd hg hg' + · exact hfnot hp₁.1 (hgf' ▸ hg) + · exact hfnot hp₂.1 (hgf ▸ hg') + · exact disjoint_left.mp hd hee hee' + · rw [hV₁, hV₂] + rintro z ⟨hz | ⟨hzw, hee⟩, hz' | ⟨hzw', hee'⟩⟩ + · exact hi ⟨hz, hz'⟩ + · exact absurd (hzw' ▸ hz) (hwnot hp₁.1) + · exact absurd (hzw ▸ hz') (hwnot hp₂.1) + · exact absurd hee' (disjoint_left.mp hd hee) + · ext z + constructor + · intro hz + by_cases hzw : z = w + · subst hzw + have heE : e ∈ E(G') := by + rw [hE'] + exact ⟨h.le.edge_mem, h.ne⟩ + rw [h₄] at heE + obtain ⟨e₀, he₀, hee⟩ := mem_iUnion₂.mp heE + obtain ⟨u, v, -, hp, -⟩ := h₁ e₀ he₀ + refine Or.inr (mem_iUnion₂.mpr ⟨e₀, he₀, ?_⟩) + simp only [Function.comp_apply] + rw [(hfacts _ hp.1).1] + exact Or.inr ⟨rfl, hee⟩ + · have : z ∈ V(G') := ⟨hz, hzw⟩ + rw [h₃] at this + rcases this with hh | hh + · exact Or.inl hh + · obtain ⟨e₀, he₀, hzz⟩ := mem_iUnion₂.mp hh + obtain ⟨u, v, -, hp, -⟩ := h₁ e₀ he₀ + refine Or.inr (mem_iUnion₂.mpr ⟨e₀, he₀, ?_⟩) + simp only [Function.comp_apply] + rw [(hfacts _ hp.1).1] + exact Or.inl hzz + · rintro (hz | hz) + · exact (hV₀ hz).1 + · obtain ⟨e₀, he₀, hzz⟩ := mem_iUnion₂.mp hz + obtain ⟨u, v, -, hp, -⟩ := h₁ e₀ he₀ + exact (hfacts _ hp.1).2.2.vertexSet_mono hzz + · ext g + constructor + · intro hg + by_cases hgf : g = f + · subst hgf + have heE : e ∈ E(G') := by + rw [hE'] + exact ⟨h.le.edge_mem, h.ne⟩ + rw [h₄] at heE + obtain ⟨e₀, he₀, hee⟩ := mem_iUnion₂.mp heE + obtain ⟨u, v, -, hp, -⟩ := h₁ e₀ he₀ + refine mem_iUnion₂.mpr ⟨e₀, he₀, ?_⟩ + simp only [Function.comp_apply] + rw [(hfacts _ hp.1).2.1] + exact Or.inr ⟨rfl, hee⟩ + · have : g ∈ E(G') := hE' ▸ ⟨hg, hgf⟩ + rw [h₄] at this + obtain ⟨e₀, he₀, hzz⟩ := mem_iUnion₂.mp this + obtain ⟨u, v, -, hp, -⟩ := h₁ e₀ he₀ + refine mem_iUnion₂.mpr ⟨e₀, he₀, ?_⟩ + simp only [Function.comp_apply] + rw [(hfacts _ hp.1).2.1] + exact Or.inl hzz + · intro hg + obtain ⟨e₀, he₀, hzz⟩ := mem_iUnion₂.mp hg + obtain ⟨u, v, -, hp, -⟩ := h₁ e₀ he₀ + exact (hfacts _ hp.1).2.2.edgeSet_mono hzz + +/-- A good graph with no vertex of valency 2 is simple and 3-connected. -/ +theorem simple_of_good (hG : Good G) (h2 : ∀ v ∈ V(G), deg G v ≠ 2) : + IsSimpleThreeConnectedGraph G := by + classical + have hfour : 4 ≤ V(G).ncard := + hG.four.trans (ncard_le_ncard (fun _ hv => hv.1) hG.finV) + have hnot : ∀ {u v : α}, ¬ V(G) ⊆ {u, v} := fun {u v} hsub => by + have := ncard_le_ncard hsub (toFinite _) + have h2' := ncard_insert_le u ({v} : Set α) + rw [ncard_singleton] at h2' + omega + refine ⟨⟨fun e _ v => hG.no_loop e v, ?_⟩, hfour, ?_⟩ + · intro e₁ he₁ e₂ he₂ u v hl₁ hl₂ + by_contra hne + have huv : u ≠ v := fun hh => hG.no_loop e₁ v (hh ▸ hl₁) + have hu := hl₁.left_mem + have hv := hl₁.right_mem + have hinc : ∀ g ∈ ({e₁, e₂} : Set β), ∀ z, G.Inc g z → z ∈ ({u, v} : Set α) := by + rintro g (rfl | rfl) z ⟨t, ht⟩ + · rcases G.eq_or_eq_of_isLink_of_isLink ht hl₁ with rfl | rfl <;> simp + · rcases G.eq_or_eq_of_isLink_of_isLink ht hl₂ with rfl | rfl <;> simp + let A := part G {u, v} {e₁, e₂} + let B := part G V(G) (E(G) \ {e₁, e₂}) + have hVA : V(A) = {u, v} := V_part hinc + have hVB : V(B) = V(G) := V_part fun g hg z ⟨t, ht⟩ => ht.left_mem + have hEA : E(A) = {e₁, e₂} := E_part (by + rintro g (rfl | rfl) + · exact he₁ + · exact he₂) + have hEB : E(B) = E(G) \ {e₁, e₂} := E_part sdiff_subset + have hsub : ({u, v} : Set α) ⊆ V(G) := by + rintro z (rfl | rfl) + · exact hu + · exact hv + have hcap : V(A) ∩ V(B) = {u, v} := by + rw [hVA, hVB] + exact inter_eq_left.mpr hsub + have hc2 : ({u, v} : Set α).ncard = 2 := ncard_pair huv + have hsep : IsGraphSeparation G A B := by + refine ⟨part_le hsub, part_le subset_rfl, ?_, ?_, ?_⟩ + · rw [hVA, hVB] + exact union_eq_right.mpr hsub + · rw [hEA, hEB] + ext g + constructor + · rintro ((rfl | rfl) | hg) + · exact he₁ + · exact he₂ + · exact hg.1 + · intro hg + by_cases hh : g ∈ ({e₁, e₂} : Set β) + · exact Or.inl hh + · exact Or.inr ⟨hg, hh⟩ + · rw [hEA, hEB] + exact disjoint_sdiff_right + rcases hG.sep A B hsep (by rw [hcap, hc2]) with ht | ht + · rcases ht with ⟨-, hemp⟩ | ⟨-, -, hn⟩ + · have : e₁ ∈ E(A) := hEA ▸ Or.inl rfl + rw [hemp] at this + exact absurd this (notMem_empty _) + · have hd : V(A) \ V(B) = ∅ := by + rw [hVA, hVB] + exact eq_empty_of_forall_notMem fun z hz => hz.2 (hsub hz.1) + simp [hd, hEA, encard_pair hne] at hn + · have hemp : ∀ z ∈ V(B) \ V(A), False := by + rcases ht with ⟨hs', -⟩ | ⟨-, hd, -⟩ + · exact fun z hz => hz.2 (hs' hz.1) + · exact fun z hz => h2 z (hVB ▸ hz.1) (hd z hz) + refine hnot (u := u) (v := v) fun z hz => ?_ + by_contra hn + exact hemp z ⟨hVB ▸ hz, hVA ▸ hn⟩ + · intro G₁ G₂ hs hord + obtain ⟨-, -, hV, -, -⟩ := id hs + have hkey : ∀ {A B : Graph α β}, V(A) ∪ V(B) = V(G) → Thin G A B → V(B) = V(G) := by + intro A B hU ht + have : V(A) ⊆ V(B) := by + rcases ht with ⟨hs', -⟩ | ⟨-, hd, -⟩ + · exact hs' + · intro z hz + by_contra hn + have hzG : z ∈ V(G) := hU ▸ Or.inl hz + exact h2 z hzG (hd z ⟨hz, hn⟩) + rw [← hU] + exact (union_eq_right.mpr this).symm + rcases hG.sep G₁ G₂ hs (by omega) with ht | ht + · exact Or.inr (hkey hV ht) + · exact Or.inl (hkey (by rw [union_comm]; exact hV) ht) + +/-- Each graph is a subdivision of itself, if it has no loops. -/ +theorem isSubdivisionOf_self (hl : ∀ e v, ¬ G.IsLink e v v) : IsSubdivisionOf G G := by + classical + refine ⟨subset_rfl, fun e => part G {z | G.Inc e z} {e}, fun e he => ?_, + fun e₁ he₁ e₂ he₂ hne => ?_, + ?_, ?_⟩ + · obtain ⟨u, v, huv⟩ := (G.edge_mem_iff_exists_isLink e).mp he + have hne : u ≠ v := fun hh => hl e v (hh ▸ huv) + have hV : V(part G {z | G.Inc e z} {e}) = {u, v} := by + rw [V_part (fun g hg z hz => (mem_singleton_iff.mp hg) ▸ hz)] + ext z + constructor + · rintro ⟨t, ht⟩ + rcases G.eq_or_eq_of_isLink_of_isLink ht huv with rfl | rfl <;> simp + · rintro (rfl | rfl) + · exact ⟨v, huv⟩ + · exact ⟨u, huv.symm⟩ + have hE : E(part G {z | G.Inc e z} {e}) = {e} := E_part (singleton_subset_iff.mpr he) + have hlk : (part G {z | G.Inc e z} {e}).IsLink e u v := ⟨rfl, huv⟩ + refine ⟨u, v, huv, ⟨part_le fun z ⟨t, ht⟩ => ht.left_mem, .cons hlk (.nil hlk.right_mem), ?_, + ?_, ?_⟩, + ?_, ?_⟩ + · simp [GraphWalk.IsSimple, GraphWalk.support, hne] + · rw [hV] + ext z + simp [GraphWalk.support] + · rw [hE] + ext z + simp [GraphWalk.edges] + · rw [hE] + exact singleton_nonempty e + · rw [hV] + refine inter_eq_left.mpr ?_ + rintro z (rfl | rfl) + · exact huv.left_mem + · exact huv.right_mem + · refine ⟨?_, fun z hz => ?_⟩ + · rw [E_part (singleton_subset_iff.mpr he₁), E_part (singleton_subset_iff.mpr he₂)] + exact disjoint_singleton.mpr hne + · obtain ⟨hz₁, -⟩ := hz + rcases hz₁ with ⟨t, ht⟩ | ⟨g, -, t, ht⟩ <;> exact ht.left_mem + · ext z + constructor + · exact Or.inl + · rintro (hz | hz) + · exact hz + · obtain ⟨e, -, hz'⟩ := mem_iUnion₂.mp hz + rcases hz' with ⟨t, ht⟩ | ⟨g, -, t, ht⟩ <;> exact ht.left_mem + · ext g + constructor + · intro hg + refine mem_iUnion₂.mpr ⟨g, hg, ?_⟩ + rw [E_part (singleton_subset_iff.mpr hg)] + exact rfl + · intro hg + obtain ⟨e, he, hz'⟩ := mem_iUnion₂.mp hg + rw [E_part (singleton_subset_iff.mpr he)] at hz' + exact (mem_singleton_iff.mp hz') ▸ he + +/-- A vertex of valency 2 in a good graph can be suppressed. -/ +theorem exists_susp (hG : Good G) {w : α} (hw : w ∈ V(G)) (h2 : deg G w = 2) : + ∃ x y e f, Susp G w x y e f := by + classical + obtain ⟨e, f, hne, hset⟩ := encard_eq_two.mp h2 + have hIe : G.Inc e w := by + have : e ∈ {g | G.Inc g w} := hset ▸ Or.inl rfl + exact this + have hIf : G.Inc f w := by + have : f ∈ {g | G.Inc g w} := hset ▸ Or.inr rfl + exact this + obtain ⟨x, hx⟩ := hIe + obtain ⟨y, hy⟩ := hIf + have honly : ∀ g, G.Inc g w → g = e ∨ g = f := fun g hg => by + have : g ∈ ({e, f} : Set β) := hset ▸ hg + exact this + have hxw : x ≠ w := fun hh => hG.no_loop e w (hh ▸ hx) + have hyw : y ≠ w := fun hh => hG.no_loop f w (hh ▸ hy) + refine ⟨x, y, e, f, hne, hx, hy, honly, hxw, hyw, ?_⟩ + rintro rfl + have hinc : ∀ g ∈ ({e, f} : Set β), ∀ z, G.Inc g z → z ∈ ({w, x} : Set α) := by + rintro g (rfl | rfl) z ⟨t, ht⟩ + · rcases G.eq_or_eq_of_isLink_of_isLink ht hx with rfl | rfl <;> simp + · rcases G.eq_or_eq_of_isLink_of_isLink ht hy with rfl | rfl <;> simp + have hinc₂ : ∀ g ∈ E(G) \ {e, f}, ∀ z, G.Inc g z → z ∈ V(G) \ {w} := by + rintro g hg z ⟨t, ht⟩ + refine ⟨ht.left_mem, ?_⟩ + rintro rfl + exact hg.2 (honly g ⟨t, ht⟩) + let A := part G {w, x} {e, f} + let B := part G (V(G) \ {w}) (E(G) \ {e, f}) + have hVA : V(A) = {w, x} := V_part hinc + have hVB : V(B) = V(G) \ {w} := V_part hinc₂ + have hxV : x ∈ V(G) := hx.right_mem + have hEA : E(A) = {e, f} := E_part (by + rintro g (rfl | rfl) + · exact hx.edge_mem + · exact hy.edge_mem) + have hEB : E(B) = E(G) \ {e, f} := E_part sdiff_subset + have hcap : V(A) ∩ V(B) = {x} := by + rw [hVA, hVB] + ext z + constructor + · rintro ⟨rfl | rfl, hz⟩ + · exact absurd rfl hz.2 + · rfl + · rintro rfl + exact ⟨Or.inr rfl, hxV, hxw⟩ + have hsep : IsGraphSeparation G A B := by + refine ⟨part_le ?_, part_le sdiff_subset, ?_, ?_, ?_⟩ + · rintro z (rfl | rfl) + · exact hw + · exact hxV + · rw [hVA, hVB] + ext z + constructor + · rintro ((rfl | rfl) | hz) + · exact hw + · exact hxV + · exact hz.1 + · intro hz + by_cases hzw : z = w + · exact Or.inl (Or.inl hzw) + · exact Or.inr ⟨hz, hzw⟩ + · rw [hEA, hEB] + ext g + constructor + · rintro ((rfl | rfl) | hg) + · exact hx.edge_mem + · exact hy.edge_mem + · exact hg.1 + · intro hg + by_cases hh : g ∈ ({e, f} : Set β) + · exact Or.inl hh + · exact Or.inr ⟨hg, hh⟩ + · rw [hEA, hEB] + exact disjoint_sdiff_right + have hc1 : (V(A) ∩ V(B)).ncard = 1 := by rw [hcap, ncard_singleton] + have hc1_extended : (V(A) ∩ V(B)).encard = 1 := by simp [hcap] + have hc1' : (V(B) ∩ V(A)).encard = 1 := by simpa only [inter_comm] using hc1_extended + have hfour : 4 ≤ V(G).ncard := hG.four.trans (ncard_le_ncard (fun _ hv => hv.1) hG.finV) + rcases hG.sep A B hsep (by omega) with ht | ht + · rcases ht with ⟨hs', -⟩ | ⟨hc, -, -⟩ + · have : w ∈ V(B) := hs' (hVA ▸ Or.inl rfl) + exact (hVB ▸ this : w ∈ V(G) \ {w}).2 rfl + · exact (by decide : (1 : ℕ∞) ≠ 2) (hc1_extended.symm.trans hc) + · rcases ht with ⟨hs', -⟩ | ⟨hc, -, -⟩ + · have hsub : V(G) ⊆ {w, x} := by + intro z hz + by_cases hzw : z = w + · exact Or.inl hzw + · exact hVA ▸ hs' (hVB ▸ ⟨hz, hzw⟩) + have := ncard_le_ncard hsub (toFinite _) + have h2' := ncard_insert_le w ({x} : Set α) + rw [ncard_singleton] at h2' + omega + · exact (by decide : (1 : ℕ∞) ≠ 2) (hc1'.symm.trans hc) + +/-- **A good graph is a subdivision of a simple 3-connected graph.** -/ +theorem good_sub (hG : Good G) : IsSubdivisionOfSimpleThreeConnected G := by + classical + suffices key : ∀ (n : ℕ) (G : Graph α β), Good G → {v | v ∈ V(G) ∧ deg G v = 2}.ncard = n → + IsSubdivisionOfSimpleThreeConnected G from key _ G hG rfl + intro n + induction n with + | zero => + intro G hG hn + have hfin : {v | v ∈ V(G) ∧ deg G v = 2}.Finite := hG.finV.subset fun _ hv => hv.1 + have hemp := (ncard_eq_zero hfin).mp hn + have h2 : ∀ v ∈ V(G), deg G v ≠ 2 := fun v hv hd => by + have : v ∈ {v | v ∈ V(G) ∧ deg G v = 2} := ⟨hv, hd⟩ + rw [hemp] at this + exact this + exact ⟨G, simple_of_good hG h2, isSubdivisionOf_self hG.no_loop⟩ + | succ n ih => + intro G hG hn + have hfin : {v | v ∈ V(G) ∧ deg G v = 2}.Finite := hG.finV.subset fun _ hv => hv.1 + obtain ⟨w, hw⟩ := nonempty_of_ncard_ne_zero (s := {v | v ∈ V(G) ∧ deg G v = 2}) (by omega) + obtain ⟨x, y, e, f, h⟩ := exists_susp hG hw.1 hw.2 + have hset : {v | v ∈ V(susp G w x y e f h) ∧ deg (susp G w x y e f h) v = 2} = + {v | v ∈ V(G) ∧ deg G v = 2} \ {w} := by + ext z + simp only [V_susp] + constructor + · rintro ⟨⟨hz, hzw⟩, hd⟩ + exact ⟨⟨hz, by rwa [deg_susp h hzw] at hd⟩, hzw⟩ + · rintro ⟨⟨hz, hd⟩, hzw⟩ + exact ⟨⟨hz, hzw⟩, by rwa [deg_susp h hzw]⟩ + have hc : {v | v ∈ V(susp G w x y e f h) ∧ deg (susp G w x y e f h) v = 2}.ncard = n := by + rw [hset, ncard_sdiff_singleton_of_mem hw] + omega + obtain ⟨G₀, h₁, h₂⟩ := ih _ (hG.susp h hw.2) hc + exact ⟨G₀, h₁, sub_step h h₂⟩ + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM14/Whitney.lean b/LeanPool/GraphMinor/GM14/Whitney.lean new file mode 100644 index 0000000000..edc7ef748e --- /dev/null +++ b/LeanPool/GraphMinor/GM14/Whitney.lean @@ -0,0 +1,852 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.WhitneyPeripheral +public import LeanPool.GraphMinor.GM14.Cited +import LeanPool.GraphMinor.GM14.Section8Core +import LeanPool.GraphMinor.GM11.PerimeterPull +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM06.Section3Dual +import LeanPool.GraphMinor.Surface.DomainHomeo +import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! +# Whitney's theorem on planar drawings + +Two drawings in a sphere of a subdivision of a simple 3-connected graph are related by a +homeomorphism of the sphere that extends the given graph isomorphism. + +The route is the classical one through peripheral circuits: the circuits that bound faces are +exactly the peripheral circuits, and that property depends only on the graph. So an isomorphism of +graphs carries faces to faces. We build the homeomorphism edge by edge, and then extend it over each +face, which is a closed disc. +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Topology Graph Metric GraphMinor.GM09 GraphMinor.GM11 GraphMinor.Surface + +universe u + +section PH + +variable {X Y Z : Type*} [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace Z] + +/-- `f` and `f'` restrict to inverse homeomorphisms between `A` and `B`. -/ +def PH (A : Set X) (B : Set Y) (f : X → Y) (f' : Y → X) : Prop := + MapsTo f A B ∧ MapsTo f' B A ∧ LeftInvOn f' f A ∧ RightInvOn f' f B ∧ ContinuousOn f A ∧ + ContinuousOn f' B + +variable {A A₀ : Set X} {B B₀ : Set Y} {C : Set Z} {f : X → Y} {f' : Y → X} + +theorem PH.symm (h : PH A B f f') : PH B A f' f := + ⟨h.2.1, h.1, h.2.2.2.1, h.2.2.1, h.2.2.2.2.2, h.2.2.2.2.1⟩ + +theorem PH.comp (h : PH A B f f') {k : Y → Z} {k' : Z → Y} (h' : PH B C k k') : + PH A C (k ∘ f) (f' ∘ k') := by + obtain ⟨m, n, l, r, c, d⟩ := h + obtain ⟨m', n', l', r', c', d'⟩ := h' + refine ⟨m'.comp m, n.comp n', ?_, ?_, c'.comp c m, d.comp d' n'⟩ + · intro x hx + simp only [Function.comp] + rw [l' (m hx), l hx] + · intro z hz + simp only [Function.comp] + rw [r (n' hz), r' hz] + +theorem PH.image_eq (h : PH A B f f') : f '' A = B := by + refine Subset.antisymm (image_subset_iff.mpr h.1) fun y hy => ?_ + exact ⟨f' y, h.2.1 hy, h.2.2.2.1 hy⟩ + +theorem PH.restrict (h : PH A B f f') (hA : A₀ ⊆ A) (hB : B₀ ⊆ B) (hm : MapsTo f A₀ B₀) + (hm' : MapsTo f' B₀ A₀) : PH A₀ B₀ f f' := + ⟨hm, hm', fun _ hx => h.2.2.1 (hA hx), fun _ hy => h.2.2.2.1 (hB hy), + h.2.2.2.2.1.mono hA, h.2.2.2.2.2.mono hB⟩ + +omit [TopologicalSpace X] [TopologicalSpace Y] in +/-- Functions that agree on overlaps have a common extension. -/ +theorem exists_common {ι : Type*} [Nonempty Y] {A : ι → Set X} {f : ι → X → Y} + (hag : ∀ i j x, x ∈ A i → x ∈ A j → f i x = f j x) : + ∃ F : X → Y, ∀ i, EqOn F (f i) (A i) := by + classical + refine ⟨fun x => if h : ∃ i, x ∈ A i then f h.choose x else Classical.arbitrary Y, ?_⟩ + intro i x hx + have h : ∃ i, x ∈ A i := ⟨i, hx⟩ + simp only [dite_eq_left h] + exact hag _ _ _ h.choose_spec hx + +/-- Gluing finitely many partial homeomorphisms over closed sets. -/ +theorem exists_glue {ι : Type*} [Finite ι] [Nonempty X] [Nonempty Y] {A : ι → Set X} + {B : ι → Set Y} {f : ι → X → Y} {f' : ι → Y → X} (hA : ∀ i, IsClosed (A i)) + (hB : ∀ i, IsClosed (B i)) (hP : ∀ i, PH (A i) (B i) (f i) (f' i)) + (hag : ∀ i j x, x ∈ A i → x ∈ A j → f i x = f j x) + (hag' : ∀ i j y, y ∈ B i → y ∈ B j → f' i y = f' j y) : + ∃ F F', PH (⋃ i, A i) (⋃ i, B i) F F' ∧ (∀ i, EqOn F (f i) (A i)) ∧ + ∀ i, EqOn F' (f' i) (B i) := by + obtain ⟨F, hF⟩ := exists_common hag + obtain ⟨F', hF'⟩ := exists_common hag' + refine ⟨F, F', ⟨?_, ?_, ?_, ?_, ?_, ?_⟩, hF, hF'⟩ + · intro x hx + obtain ⟨i, hi⟩ := mem_iUnion.mp hx + rw [hF i hi] + exact mem_iUnion.mpr ⟨i, (hP i).1 hi⟩ + · intro y hy + obtain ⟨i, hi⟩ := mem_iUnion.mp hy + rw [hF' i hi] + exact mem_iUnion.mpr ⟨i, (hP i).2.1 hi⟩ + · intro x hx + obtain ⟨i, hi⟩ := mem_iUnion.mp hx + rw [hF i hi, hF' i ((hP i).1 hi)] + exact (hP i).2.2.1 hi + · intro y hy + obtain ⟨i, hi⟩ := mem_iUnion.mp hy + rw [hF' i hi, hF i ((hP i).2.1 hi)] + exact (hP i).2.2.2.1 hi + · exact (locallyFinite_of_finite A).continuousOn_iUnion hA fun i => + (hP i).2.2.2.2.1.congr (hF i) + · exact (locallyFinite_of_finite B).continuousOn_iUnion hB fun i => + (hP i).2.2.2.2.2.congr (hF' i) + +/-- Two lines are homeomorphic, with ends going to ends. -/ +theorem exists_line_PH [Nonempty X] [Nonempty Y] {L : Set X} {L' : Set Y} {a b : X} {a' b' : Y} + (hL : IsLineWithEnds L a b) (hL' : IsLineWithEnds L' a' b') : + ∃ f f', PH L L' f f' ∧ f a = a' ∧ f b = b' := by + obtain ⟨p, hp0, hp1⟩ := hL + obtain ⟨q, hq0, hq1⟩ := hL' + let e : L ≃ₜ L' := p.symm.trans q + obtain ⟨f, f', hf, hc, hc', him, hl⟩ := exists_extensions e + have hPH : PH L L' f f' := by + refine ⟨fun x hx => him ▸ mem_image_of_mem f hx, ?_, hl, ?_, hc, hc'⟩ + · intro y hy + obtain ⟨x, hx, rfl⟩ := him.symm ▸ hy + rw [hl hx] + exact hx + · intro y hy + obtain ⟨x, hx, rfl⟩ := him.symm ▸ hy + rw [hl hx] + refine ⟨f, f', hPH, ?_, ?_⟩ + · have h := hf (p 0) + rw [hp0] at h + rw [h] + simp [e, hq0] + · have h := hf (p 1) + rw [hp1] at h + rw [h] + simp [e, hq1] + +end PH + +theorem closedInner_sphere_one : + Nonempty (Circle ≃ₜ sphere (0 : ℂ) 1) ∧ closedInner (sphere (0 : ℂ) 1) = closedBall 0 1 := by + have hd := isClosedDisc_of_convex (K := closedBall (0 : ℂ) 1) (convex_closedBall 0 1) + (by rw [interior_closedBall _ (by norm_num)]; exact ⟨0, by simp⟩) isBounded_closedBall + isClosed_closedBall + rw [frontier_closedBall _ (by norm_num)] at hd + have h1 : Nonempty (Circle ≃ₜ sphere (0 : ℂ) 1) := by + have := hd.1.isOArc_discBd + rwa [hd.2] at this + exact ⟨h1, (eq_closedInner_of_discBd h1 hd.1 hd.2).symm⟩ + +/-- A homeomorphism between the boundaries of two closed discs extends over the discs. This is the +Schoenflies theorem for the unit circle. -/ +theorem exists_disc_PH {S : Type u} {S' : Type*} [TopologicalSpace S] [TopologicalSpace S'] + {D : Set S} {D' : Set S'} + (hD : IsClosedDisc D) (hD' : IsClosedDisc D') {g : S → S'} {g' : S' → S} + (h : PH (discBd D) (discBd D') g g') : + ∃ f f', PH D D' f f' ∧ EqOn f g (discBd D) ∧ EqOn f' g' (discBd D') := by + obtain ⟨a, b, ha, hb, hm, hn, hl, hr, him⟩ := hD.exists_chart + obtain ⟨a', b', ha', hb', hm', hn', hl', hr', him'⟩ := hD'.exists_chart + have hch : PH D (closedBall 0 1) a b := ⟨hm, hn, hl, hr, ha, hb⟩ + have hch' : PH D' (closedBall 0 1) a' b' := ⟨hm', hn', hl', hr', ha', hb'⟩ + have hsub : discBd D ⊆ D := Surface.discBd_subset _ + have hsub' : discBd D' ⊆ D' := Surface.discBd_subset _ + have hs : sphere (0 : ℂ) 1 ⊆ closedBall 0 1 := sphere_subset_closedBall + have hbd : PH (discBd D) (sphere 0 1) a b := hch.restrict hsub hs + (fun p hp => him ▸ mem_image_of_mem a hp) (fun z hz => by + obtain ⟨p, hp, rfl⟩ := him.symm ▸ hz + rw [hl (hsub hp)] + exact hp) + have hbd' : PH (discBd D') (sphere 0 1) a' b' := hch'.restrict hsub' hs + (fun p hp => him' ▸ mem_image_of_mem a' hp) (fun z hz => by + obtain ⟨p, hp, rfl⟩ := him'.symm ▸ hz + rw [hl' (hsub' hp)] + exact hp) + have hcirc := (hbd.symm.comp h).comp hbd' + obtain ⟨hF, hcl⟩ := closedInner_sphere_one + obtain ⟨Ψ, hΨ⟩ := exists_homeomorph_closedInner hF hF hcirc + obtain ⟨ψ, χ, hmatch, hv⟩ := exists_bdMatch Ψ + have hPH : PH (closedBall (0 : ℂ) 1) (closedBall 0 1) ψ χ := by + rw [← hcl] + exact hmatch + have hF1 : sphere (0 : ℂ) 1 ⊆ closedInner (sphere 0 1) := subset_union_right + have hψ : EqOn ψ (a' ∘ g ∘ b) (sphere 0 1) := by + intro z hz + rw [hv ⟨z, hF1 hz⟩] + exact hΨ ⟨z, hF1 hz⟩ hz + have hχ : EqOn χ ((a ∘ g') ∘ b') (sphere 0 1) := by + intro z hz + have hw : ((a ∘ g') ∘ b') z ∈ sphere (0 : ℂ) 1 := hcirc.2.1 hz + have hz' : ψ (((a ∘ g') ∘ b') z) = z := (hψ hw).trans (hcirc.2.2.2.1 hz) + have := hPH.2.2.1 (hs hw) + rwa [hz'] at this + refine ⟨_, _, (hch.comp hPH).comp hch'.symm, ?_, ?_⟩ + · intro p hp + have h₁ : ψ (a p) = a' (g (b (a p))) := hψ (hbd.1 hp) + simp only [Function.comp] + rw [h₁, hl (hsub hp), hl' (hsub' (h.1 hp))] + · intro y hy + have h₁ : χ (a' y) = a (g' (b' (a' y))) := hχ (hbd'.1 hy) + simp only [Function.comp] + rw [h₁, hl' (hsub' hy), hl (hsub (h.2.1 hy))] + +section Assembly + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- Total functions that carry an isomorphism between the graphs of two drawings. -/ +structure IsoD (J₁ J₂ : Drawing S) (fv gv : S → S) (fe ge : Set S → Set S) : Prop where + v₁ : ∀ x ∈ J₁.V, fv x ∈ J₂.V + v₂ : ∀ y ∈ J₂.V, gv y ∈ J₁.V + vl : ∀ x ∈ J₁.V, gv (fv x) = x + vr : ∀ y ∈ J₂.V, fv (gv y) = y + e₁ : ∀ e ∈ J₁.E, fe e ∈ J₂.E + e₂ : ∀ e ∈ J₂.E, ge e ∈ J₁.E + el : ∀ e ∈ J₁.E, ge (fe e) = e + er : ∀ e ∈ J₂.E, fe (ge e) = e + link₁ : ∀ e x y, J₁.toGraph.IsLink e x y → J₂.toGraph.IsLink (fe e) (fv x) (fv y) + link₂ : ∀ e x y, J₂.toGraph.IsLink e x y → J₁.toGraph.IsLink (ge e) (gv x) (gv y) + +variable {J J₁ J₂ : Drawing S} {fv gv : S → S} {fe ge : Set S → Set S} + +omit [T2Space S] in +theorem IsoD.symm (h : IsoD J₁ J₂ fv gv fe ge) : IsoD J₂ J₁ gv fv ge fe := + ⟨h.v₂, h.v₁, h.vr, h.vl, h.e₂, h.e₁, h.er, h.el, h.link₂, h.link₁⟩ + +omit [T2Space S] in +/-- The closure of an edge with distinct ends is a line. -/ +theorem closure_line {e : Set S} {x y : S} (hl : J.toGraph.IsLink e x y) (hxy : x ≠ y) : + IsLineWithEnds (closure e) x y := by + obtain ⟨he, -, -, hcap⟩ := hl + rcases J.edge_cond e he with ⟨u, v, -, hc, hL⟩ | ⟨u, hc, -⟩ + · rw [hc] at hcap + rcases Set.pair_eq_pair_iff.mp hcap with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hL + · exact hL.symm + · rw [hc] at hcap + have hx : x ∈ ({u} : Set S) := hcap ▸ Or.inl rfl + have hy : y ∈ ({u} : Set S) := hcap ▸ Or.inr rfl + exact (hxy (hx.trans hy.symm)).elim + +omit [T2Space S] in +/-- Two edges meet only in vertices. -/ +theorem common_closure (hloop : ∀ e u, ¬ J.toGraph.IsLink e u u) {e e' : Set S} (he : e ∈ J.E) + (he' : e' ∈ J.E) (hne : e ≠ e') {p : S} (hp : p ∈ closure e) (hp' : p ∈ closure e') : + p ∈ J.V := by + by_contra hn + obtain ⟨a, b, hl⟩ := (J.toGraph.edge_mem_iff_exists_isLink e).mp he + obtain ⟨a', b', hl'⟩ := (J.toGraph.edge_mem_iff_exists_isLink e').mp he' + have hab : a ≠ b := fun h' => hloop e a (h' ▸ hl) + have hab' : a' ≠ b' := fun h' => hloop e' a' (h' ▸ hl') + have hin : ∀ {f : Set S} {u v : S}, J.toGraph.IsLink f u v → u ≠ v → p ∈ closure f → p ∈ f := by + intro f u v hf huv hpf + rw [GM06.closure_edge_eq_union_ends J hf huv] at hpf + rcases hpf with h' | rfl | h' + · exact h' + · exact (hn hf.2.1).elim + · rw [mem_singleton_iff] at h' + subst h' + exact (hn hf.2.2.1).elim + exact Set.disjoint_left.mp (GM06.disjoint_edges_of_ne J he he' hne) (hin hl hab hp) + (hin hl' hab' hp') + +omit [T2Space S] in +theorem U_eq_closures (hinc : ∀ v ∈ J.V, ∃ e ∈ J.E, J.toGraph.Inc e v) : + J.U = ⋃ e : J.E, closure e.1 := by + rw [J.U_eq] + ext p + simp only [mem_union, mem_iUnion, exists_prop, Subtype.exists] + constructor + · rintro (hp | ⟨e, he, hp⟩) + · obtain ⟨e, he, hi⟩ := hinc p hp + exact ⟨e, he, mem_closure_of_inc hi⟩ + · exact ⟨e, he, hp⟩ + · rintro ⟨e, he, hp⟩ + exact Or.inr ⟨e, he, hp⟩ + +/-- A homeomorphism between the point sets of two drawings that extends an isomorphism. -/ +structure ArcD (J₁ J₂ : Drawing S) (fv gv : S → S) (fe ge : Set S → Set S) (g g' : S → S) : + Prop where + ph : PH J₁.U J₂.U g g' + v₁ : ∀ v ∈ J₁.V, g v = fv v + v₂ : ∀ v ∈ J₂.V, g' v = gv v + e₁ : ∀ e ∈ J₁.E, MapsTo g (closure e) (closure (fe e)) + e₂ : ∀ e ∈ J₂.E, MapsTo g' (closure e) (closure (ge e)) + +variable {g g' : S → S} + +omit [T2Space S] in +theorem ArcD.symm (h : ArcD J₁ J₂ fv gv fe ge g g') : ArcD J₂ J₁ gv fv ge fe g' g := + ⟨h.ph.symm, h.v₂, h.v₁, h.e₂, h.e₁⟩ + +omit [T2Space S] in +/-- Building the homeomorphism edge by edge. On the edges in `W`, where the isomorphism is the +identity, we use the identity. -/ +theorem exists_arcD [Nonempty S] (hd : IsoD J₁ J₂ fv gv fe ge) (W : Set (Set S)) + (hW : ∀ e ∈ W, e ∈ J₁.E → fe e = e ∧ ∀ v ∈ closure e, v ∈ J₁.V → fv v = v) + (hl₁ : ∀ e u, ¬ J₁.toGraph.IsLink e u u) (hl₂ : ∀ e u, ¬ J₂.toGraph.IsLink e u u) + (hi₁ : ∀ v ∈ J₁.V, ∃ e ∈ J₁.E, J₁.toGraph.Inc e v) + (hi₂ : ∀ v ∈ J₂.V, ∃ e ∈ J₂.E, J₂.toGraph.Inc e v) : + ∃ g g', ArcD J₁ J₂ fv gv fe ge g g' ∧ ∀ e ∈ W, e ∈ J₁.E → ∀ p ∈ closure e, g p = p := by + have hfin : Finite J₁.E := J₁.finite_edges.to_subtype + have hex : ∀ e : J₁.E, ∃ a a' : S → S, PH (closure e.1) (closure (fe e.1)) a a' ∧ + (∀ v, v ∈ closure e.1 → v ∈ J₁.V → a v = fv v) ∧ + (∀ v, v ∈ closure (fe e.1) → v ∈ J₂.V → a' v = gv v) ∧ + (e.1 ∈ W → ∀ p ∈ closure e.1, a p = p) := by + rintro ⟨e, he⟩ + obtain ⟨x, y, hl⟩ := (J₁.toGraph.edge_mem_iff_exists_isLink e).mp he + have hxy : x ≠ y := fun h' => hl₁ e x (h' ▸ hl) + have hl' := hd.link₁ e x y hl + have hxy' : fv x ≠ fv y := fun h' => hl₂ (fe e) _ (h' ▸ hl') + have hxc : x ∈ closure e := mem_closure_of_inc ⟨y, hl⟩ + have hyc : y ∈ closure e := mem_closure_of_inc ⟨x, hl.symm⟩ + by_cases heW : e ∈ W + · obtain ⟨h₁, h₂⟩ := hW e heW he + refine ⟨id, id, ?_, fun v hv hvV => (h₂ v hv hvV).symm, ?_, fun _ _ _ => rfl⟩ + · simp only [h₁] + exact ⟨mapsTo_id _, mapsTo_id _, fun _ _ => rfl, fun _ _ => rfl, continuousOn_id, + continuousOn_id⟩ + · intro v hv hvV + have hm : v ∈ closure (fe e) ∩ J₂.V := ⟨hv, hvV⟩ + rw [hl'.2.2.2] at hm + rcases hm with rfl | hm + · rw [hd.vl x hl.left_mem] + exact h₂ x hxc hl.left_mem + · obtain rfl : v = fv y := hm + rw [hd.vl y hl.right_mem] + exact h₂ y hyc hl.right_mem + obtain ⟨a, a', hP, h₀, h₁⟩ := exists_line_PH (closure_line hl hxy) (closure_line hl' hxy') + refine ⟨a, a', hP, ?_, ?_, fun h' => absurd h' heW⟩ + · intro v hv hvV + have hm : v ∈ closure e ∩ J₁.V := ⟨hv, hvV⟩ + rw [hl.2.2.2] at hm + rcases hm with rfl | hm + · exact h₀ + · obtain rfl : v = y := hm + exact h₁ + · intro v hv hvV + have hm : v ∈ closure (fe e) ∩ J₂.V := ⟨hv, hvV⟩ + rw [hl'.2.2.2] at hm + rcases hm with rfl | hm + · rw [hd.vl x hl.left_mem, ← h₀] + exact hP.2.2.1 hxc + · obtain rfl : v = fv y := hm + rw [hd.vl y hl.right_mem, ← h₁] + exact hP.2.2.1 hyc + choose a a' hP hv hv' hvW using hex + have hinj : ∀ {e e' : Set S}, e ∈ J₁.E → e' ∈ J₁.E → fe e = fe e' → e = e' := by + intro e e' he he' h' + rw [← hd.el e he, ← hd.el e' he', h'] + obtain ⟨g, g', hPH, hg, hg'⟩ := exists_glue (A := fun e : J₁.E => closure e.1) + (B := fun e : J₁.E => closure (fe e.1)) (fun _ => isClosed_closure) + (fun _ => isClosed_closure) hP + (fun i j x hi hj => by + by_cases hij : i = j + · rw [hij] + · have hx := common_closure hl₁ i.2 j.2 (fun h' => hij (Subtype.ext h')) hi hj + rw [hv i x hi hx, hv j x hj hx]) + (fun i j y hi hj => by + by_cases hij : i = j + · rw [hij] + · have hy := common_closure hl₂ (hd.e₁ _ i.2) (hd.e₁ _ j.2) + (fun h' => hij (Subtype.ext (hinj i.2 j.2 h'))) hi hj + rw [hv' i y hi hy, hv' j y hj hy]) + have hU₁ := U_eq_closures hi₁ + have hU₂ : J₂.U = ⋃ e : J₁.E, closure (fe e.1) := by + rw [U_eq_closures hi₂] + ext p + simp only [mem_iUnion, Subtype.exists, exists_prop] + constructor + · rintro ⟨e, he, hp⟩ + exact ⟨ge e, hd.e₂ e he, by rwa [hd.er e he]⟩ + · rintro ⟨e, he, hp⟩ + exact ⟨fe e, hd.e₁ e he, hp⟩ + refine ⟨g, g', ⟨by rw [hU₁, hU₂]; exact hPH, ?_, ?_, ?_, ?_⟩, fun e heW he p hp => ?_⟩ + · intro v hv₀ + obtain ⟨e, he, hi⟩ := hi₁ v hv₀ + have hc := mem_closure_of_inc hi + rw [hg ⟨e, he⟩ hc] + exact hv ⟨e, he⟩ v hc hv₀ + · intro v hv₀ + obtain ⟨e, he, hi⟩ := hi₂ v hv₀ + have hc : v ∈ closure (fe (ge e)) := by + rw [hd.er e he] + exact mem_closure_of_inc hi + rw [hg' ⟨ge e, hd.e₂ e he⟩ hc] + exact hv' ⟨ge e, hd.e₂ e he⟩ v hc hv₀ + · intro e he p hp + rw [hg ⟨e, he⟩ hp] + exact (hP ⟨e, he⟩).1 hp + · intro e he p hp + have hc : p ∈ closure (fe (ge e)) := by rwa [hd.er e he] + rw [hg' ⟨ge e, hd.e₂ e he⟩ hc] + exact (hP ⟨ge e, hd.e₂ e he⟩).2.1 hc + · rw [hg ⟨e, he⟩ hp] + exact hvW ⟨e, he⟩ heW p hp + +theorem walk_length_eq {α β : Type*} {G : Graph α β} {a b : α} (W : GraphWalk G a b) : + W.length = W.edges.length := by + induction W with + | nil _ => rfl + | cons _ _ ih => simp [GraphWalk.length, GraphWalk.edges] + +/-- An isomorphism carries circuits to circuits. -/ +theorem transport_circuit (hd : IsoD J₁ J₂ fv gv fe ge) {C : Drawing S} (hC : C.IsCircuit) + (hs : C.IsSubdrawing J₁) : + ∃ C' : Drawing S, C'.IsCircuit ∧ C'.IsSubdrawing J₂ ∧ C'.V = fv '' C.V ∧ C'.E = fe '' C.E := by + obtain ⟨u, W, ⟨hn, he⟩, hpos, hV, hE⟩ := hC + obtain ⟨W₁, hs₁, he₁⟩ := hs.exists_walk_up W + obtain ⟨W₂, hs₂, he₂⟩ := exists_walk_map (f := fv) (g := fe) hd.v₁ hd.link₁ W₁ + have hsub := walkDrawing_isSubdrawing J₂ W₂ + obtain ⟨W₃, hs₃, he₃⟩ := hsub.exists_walk_down W₂ + (by rw [walkDrawing_V]; exact fun x hx => hx) (by rw [walkDrawing_E]; exact fun e he => he) + have hsup : W₃.support = W.support.map fv := by rw [hs₃, hs₂, hs₁] + have hedg : W₃.edges = W.edges.map fe := by rw [he₃, he₂, he₁] + have hVm : ∀ x, x ∈ W.support → x ∈ J₁.V := fun x hx => hs.1 (by rw [hV]; exact hx) + have hEm : ∀ e, e ∈ W.edges → e ∈ J₁.E := fun e hx => hs.2 (by rw [hE]; exact hx) + refine ⟨walkDrawing J₂ W₂, ⟨fv u, W₃, ⟨?_, ?_⟩, ?_, ?_, ?_⟩, hsub, ?_, ?_⟩ + · rw [hsup, ← List.map_tail] + refine List.Nodup.map_on ?_ hn + intro x hx y hy hxy + rw [← hd.vl x (hVm x (List.mem_of_mem_tail hx)), hxy, + hd.vl y (hVm y (List.mem_of_mem_tail hy))] + · rw [hedg] + refine List.Nodup.map_on ?_ he + intro x hx y hy hxy + rw [← hd.el x (hEm x hx), hxy, hd.el y (hEm y hy)] + · rw [walk_length_eq, hedg, List.length_map, ← walk_length_eq] + exact hpos + · rw [walkDrawing_V, hs₃] + · rw [walkDrawing_E, he₃] + · rw [walkDrawing_V, hs₂, hs₁, hV] + ext x + simp + · rw [walkDrawing_E, he₂, he₁, hE] + ext x + simp + +omit [T2Space S] in +/-- An isomorphism carries peripheral circuits to peripheral circuits. -/ +theorem peripheral_map (hd : IsoD J₁ J₂ fv gv fe ge) {C C' : Drawing S} (hs : C.IsSubdrawing J₁) + (hP : IsPeripheral J₁ C) (hV : C'.V = fv '' C.V) (hE : C'.E = fe '' C.E) : + IsPeripheral J₂ C' := by + have hM : ∀ {a}, a ∈ J₁.E \ C.E → fe a ∈ J₂.E \ C'.E := by + rintro a ⟨ha, hn⟩ + refine ⟨hd.e₁ a ha, fun hc => hn ?_⟩ + rw [hE] at hc + obtain ⟨b, hb, hab⟩ := hc + rw [← hd.el a ha, ← hab, hd.el b (hs.2 hb)] + exact hb + have hchain : ∀ {e f}, f ∈ cls J₁.toGraph C.V (J₁.E \ C.E) e → + fe f ∈ cls J₂.toGraph C'.V (J₂.E \ C'.E) (fe e) := by + intro e f hf + induction hf with + | refl => exact mem_cls_self + | @tail a b _ hadj ih => + obtain ⟨ha, hb, w, hw, ⟨p, hp⟩, ⟨q, hq⟩⟩ := hadj + refine cls_step ih ⟨hM ha, hM hb, fv w, ?_, ⟨fv p, hd.link₁ _ _ _ hp⟩, + ⟨fv q, hd.link₁ _ _ _ hq⟩⟩ + rw [hV] + rintro ⟨c, hc, hcw⟩ + apply hw + rw [← hd.vl w hp.left_mem, ← hcw, hd.vl c (hs.1 hc)] + exact hc + intro e he f hf + have hback : ∀ {a}, a ∈ J₂.E \ C'.E → ge a ∈ J₁.E \ C.E := by + rintro a ⟨ha, hn⟩ + refine ⟨hd.e₂ a ha, fun hc => hn ?_⟩ + rw [hE, ← hd.er a ha] + exact mem_image_of_mem fe hc + have := hchain (hP _ (hback he) _ (hback hf)) + rwa [hd.er e he.1, hd.er f hf.1] at this + +/-- The face of a cell structure lies on one side of its boundary, and all of `J` on the other. -/ +theorem peripheral_of_face {G₀ : Graph S (Set S)} {P : Set S → Graph S (Set S)} (hS : IsSphere S) + (h : SubData J.toGraph G₀ P) {𝓕 : Set (Set S)} (hF : IsFaceSys J J 𝓕) {D : Set S} + (hD : D ∈ 𝓕) {C : Drawing S} (hC : C.IsCircuit) (hs : C.IsSubdrawing J) + (hU : C.U = discBd D) : IsPeripheral J C := by + have hcl := (IsSphere.isClosedSurface hS).1 + obtain ⟨Δ₁, Δ₂, -, hd₁, hd₂, hb₁, hb₂, hun, -, -, huniq⟩ := + sphere_disc S hS C.U (GM11.IsCircuit.isOArc_U hC) + have hother : ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = C.U ∧ D ∪ Δ = univ := by + rcases huniq D (hF.disc D hD) hU.symm with rfl | rfl + · exact ⟨Δ₂, hd₂, hb₂, hun⟩ + · exact ⟨Δ₁, hd₁, hb₁, (union_comm _ _).trans hun⟩ + obtain ⟨Δ, hΔ, hb, hu⟩ := hother + refine peripheral_of_side hcl h hC hs hΔ hb fun p hp => ?_ + have hm : p ∈ D ∪ Δ := by rw [hu]; exact mem_univ p + rcases hm with hm | hm + · by_cases hpb : p ∈ discBd D + · exact Surface.discBd_subset _ (hb ▸ hU ▸ hpb) + · exact (Set.disjoint_left.mp (hF.free D hD) ⟨hm, hpb⟩ hp).elim + · exact hm + +/-- A circuit has at most two edges at a vertex. -/ +theorem circuit_not_three {G₀ : Graph S (Set S)} {P : Set S → Graph S (Set S)} + (h : SubData J.toGraph G₀ P) {C : Drawing S} (hC : C.IsCircuit) (hs : C.IsSubdrawing J) {v : S} + {a b d : Set S} (ha : a ∈ C.E) (hb : b ∈ C.E) (hd : d ∈ C.E) (hab : a ≠ b) (had : a ≠ d) + (hbd : b ≠ d) (ia : J.toGraph.Inc a v) (ib : J.toGraph.Inc b v) (id' : J.toGraph.Inc d v) : + False := by + have hv : v ∈ C.V := by + have hm : v ∈ closure a ∩ J.V := ⟨mem_closure_of_inc ia, ia.vertex_mem⟩ + rw [← hs.closure_inter_V ha] at hm + exact hm.2 + obtain ⟨w, hw, hne⟩ : ∃ w ∈ C.V, w ≠ v := by + obtain ⟨p, hp⟩ := ia + refine ⟨p, ?_, fun h' => no_loop h (h' ▸ hp)⟩ + have hm : p ∈ closure a ∩ J.V := ⟨mem_closure_of_inc ⟨v, hp.symm⟩, hp.right_mem⟩ + rw [← hs.closure_inter_V ha] at hm + exact hm.2 + obtain ⟨P₁, P₂, hP₁, hP₂, hs₁, hs₂, -, -, -, -, hsup⟩ := + Drawing.IsCircuit.exists_two_paths hC hv hw hne.symm + obtain ⟨X₁, hX₁, hU₁, -, -⟩ := exists_walk_of_path hP₁ (hs₁.trans hs) + obtain ⟨X₂, hX₂, hU₂, -, -⟩ := exists_walk_of_path hP₂ (hs₂.trans hs) + have hmem : ∀ {Q : Drawing S} {r t : S} {X : GraphWalk J.toGraph r t}, Q.IsSubdrawing J → + wU J X = Q.U → ∀ {c}, c ∈ Q.E → c ∈ X.edges := by + intro Q r t X hQ hU c hc + obtain ⟨p, hp⟩ : c.Nonempty := (hQ.2 hc).1 + refine edge_mem_of_meets (hQ.2 hc) hp ?_ + rw [hU, Q.U_eq] + exact Or.inr (mem_iUnion₂.mpr ⟨c, hc, subset_closure hp⟩) + have hsplit : ∀ {c}, c ∈ C.E → c ∈ X₁.edges ∨ c ∈ X₂.edges := by + intro c hc + have hE := Drawing.sup_E (Γ := C) hs₁ hs₂ + rw [hsup] at hE + rw [hE] at hc + rcases hc with hc | hc + · exact Or.inl (hmem (hs₁.trans hs) hU₁ hc) + · exact Or.inr (hmem (hs₂.trans hs) hU₂ hc) + have one : ∀ {p q}, p ∈ X₁.edges → q ∈ X₁.edges → J.toGraph.Inc p v → J.toGraph.Inc q v → p = q := + fun hp hq ip iq => eq_of_inc_start X₁ hX₁ hp hq ip iq + have two : ∀ {p q}, p ∈ X₂.edges → q ∈ X₂.edges → J.toGraph.Inc p v → J.toGraph.Inc q v → p = q := + fun hp hq ip iq => eq_of_inc_start X₂ hX₂ hp hq ip iq + rcases hsplit ha with h₁ | h₁ <;> rcases hsplit hb with h₂ | h₂ <;> rcases hsplit hd with h₃ | h₃ + · exact hab (one h₁ h₂ ia ib) + · exact hab (one h₁ h₂ ia ib) + · exact had (one h₁ h₃ ia id') + · exact hbd (two h₂ h₃ ib id') + · exact hbd (one h₂ h₃ ib id') + · exact had (two h₁ h₃ ia id') + · exact hab (two h₁ h₂ ia ib) + · exact hab (two h₁ h₂ ia ib) + +/-- Two faces with the same boundary are equal, since `J` is not a circuit. -/ +theorem faces_inj {G₀ : Graph S (Set S)} {P : Set S → Graph S (Set S)} (hS : IsSphere S) + (h : SubData J.toGraph G₀ P) {𝓕 : Set (Set S)} (hF : IsFaceSys J J 𝓕) {D D' : Set S} + (hD : D ∈ 𝓕) (hD' : D' ∈ 𝓕) (hb : discBd D = discBd D') : D = D' := by + by_contra hne + obtain ⟨C, hC, hs, hU⟩ := hF.circuit D hD + obtain ⟨Δ₁, Δ₂, -, -, -, -, -, hun, -, -, huniq⟩ := + sphere_disc S hS C.U (GM11.IsCircuit.isOArc_U hC) + have hcov : D ∪ D' = univ := by + rcases huniq D (hF.disc D hD) hU.symm with rfl | rfl <;> + rcases huniq D' (hF.disc D' hD') (hb.symm.trans hU.symm) with h' | h' + · exact (hne h'.symm).elim + · rw [h'] + exact hun + · rw [h', union_comm] + exact hun + · exact (hne h'.symm).elim + have hall : J.U ⊆ C.U := by + intro p hp + have hm : p ∈ D ∪ D' := by rw [hcov]; exact mem_univ p + rcases hm with hm | hm + · by_contra hn + exact Set.disjoint_left.mp (hF.free D hD) ⟨hm, fun h' => hn (hU ▸ h')⟩ hp + · by_contra hn + exact Set.disjoint_left.mp (hF.free D' hD') ⟨hm, fun h' => hn (hU ▸ hb ▸ h')⟩ hp + have hedges : ∀ e ∈ J.E, e ∈ C.E := by + intro e he + by_contra hn + obtain ⟨p, hp⟩ : e.Nonempty := he.1 + exact Set.disjoint_left.mp (edge_disjoint_U hs he hn) hp (hall (he.2.1 hp).1) + obtain ⟨v, hv⟩ : ∃ v, v ∈ V(G₀) := by + have hpos : 0 < V(G₀).ncard := by have := h.simple.2.1; omega + exact (Set.ncard_pos h.finite_V₀).mp hpos + obtain ⟨e₁, e₂, e₃, h12, h13, h23, ⟨y₁, l₁⟩, ⟨y₂, l₂⟩, ⟨y₃, l₃⟩⟩ := + IsSimpleThreeConnected.exists_three_edges h.simple hv + have hpick : ∀ {e y}, G₀.IsLink e v y → ∃ a ∈ E(P e), a ∈ C.E ∧ J.toGraph.Inc a v := by + intro e y hl + obtain ⟨a, ha, hi⟩ := (h.exists_edge_at_ends hl).1 + exact ⟨a, ha, hedges a hi.edge_mem, hi⟩ + obtain ⟨a, ha, haC, ia⟩ := hpick l₁ + obtain ⟨b, hb', hbC, ib⟩ := hpick l₂ + obtain ⟨d, hd, hdC, id'⟩ := hpick l₃ + have hdist : ∀ {e f p q}, e ∈ E(G₀) → f ∈ E(G₀) → e ≠ f → p ∈ E(P e) → q ∈ E(P f) → p ≠ q := by + intro e f p q he hf hef hp hq hpq + exact Set.disjoint_left.mp (h.disj e he f hf hef).1 hp (hpq ▸ hq) + exact circuit_not_three h hC hs haC hbC hdC (hdist l₁.edge_mem l₂.edge_mem h12 ha hb') + (hdist l₁.edge_mem l₃.edge_mem h13 ha hd) (hdist l₂.edge_mem l₃.edge_mem h23 hb' hd) ia ib id' + +omit [T2Space S] in +/-- Two faces meet only in their boundaries. -/ +theorem IsFaceSys.overlap {𝓕 : Set (Set S)} (hF : IsFaceSys J J 𝓕) {D D' : Set S} (hD : D ∈ 𝓕) + (hD' : D' ∈ 𝓕) (hne : D ≠ D') {p : S} (hp : p ∈ D) (hp' : p ∈ D') : + p ∈ discBd D ∧ p ∈ discBd D' := by + have hbd : ∀ {X}, X ∈ 𝓕 → discBd X ⊆ J.U := by + intro X hX + obtain ⟨C, -, hs, hU⟩ := hF.circuit X hX + rw [← hU] + exact hs.U_subset + by_cases h₁ : p ∈ discBd D <;> by_cases h₂ : p ∈ discBd D' + · exact ⟨h₁, h₂⟩ + · exact (Set.disjoint_left.mp (hF.free D' hD') ⟨hp', h₂⟩ (hbd hD h₁)).elim + · exact (Set.disjoint_left.mp (hF.free D hD) ⟨hp, h₁⟩ (hbd hD' h₂)).elim + · exact (Set.disjoint_left.mp (hF.disj D hD D' hD' hne) ⟨hp, h₁⟩ ⟨hp', h₂⟩).elim + +omit [T2Space S] in +theorem mapsTo_U {C C' : Drawing S} (hV : ∀ v ∈ C.V, g v ∈ C'.V) + (hE : ∀ e ∈ C.E, ∃ e' ∈ C'.E, MapsTo g (closure e) (closure e')) : MapsTo g C.U C'.U := by + intro p hp + rw [C.U_eq] at hp + rw [C'.U_eq] + rcases hp with hp | hp + · exact Or.inl (hV p hp) + · obtain ⟨e, he, hpe⟩ := mem_iUnion₂.mp hp + obtain ⟨e', he', hm⟩ := hE e he + exact Or.inr (mem_iUnion₂.mpr ⟨e', he', hm hpe⟩) + +/-- An isomorphism carries faces to faces. -/ +theorem exists_face_image {G₀ : Graph S (Set S)} {P : Set S → Graph S (Set S)} (hS : IsSphere S) + (h : SubData J₁.toGraph G₀ P) (hi₂ : ∀ v ∈ J₂.V, ∃ e ∈ J₂.E, J₂.toGraph.Inc e v) + (hd : IsoD J₁ J₂ fv gv fe ge) (ha : ArcD J₁ J₂ fv gv fe ge g g') {𝓕₁ 𝓕₂ : Set (Set S)} + (hF₁ : IsFaceSys J₁ J₁ 𝓕₁) (hF₂ : IsFaceSys J₂ J₂ 𝓕₂) {D : Set S} (hD : D ∈ 𝓕₁) : + ∃ D' ∈ 𝓕₂, PH (discBd D) (discBd D') g g' := by + have hcl := (IsSphere.isClosedSurface hS).1 + obtain ⟨C, hC, hs, hU⟩ := hF₁.circuit D hD + have per := peripheral_of_face hS h hF₁ hD hC hs hU + obtain ⟨C', hC', hs', hV, hE⟩ := transport_circuit hd hC hs + have per' := peripheral_map hd hs per hV hE + obtain ⟨D', hD', hb, hfree⟩ := exists_free_side_of_peripheral hS hC' hs' hi₂ per' + refine ⟨D', hF₂.eq_of_free hcl hD' (hb ▸ hs'.U_subset) hfree, ?_⟩ + rw [← hU, hb] + refine ha.ph.restrict hs.U_subset hs'.U_subset ?_ ?_ + · refine mapsTo_U (fun v hv => ?_) fun e he => ?_ + · rw [ha.v₁ v (hs.1 hv), hV] + exact mem_image_of_mem fv hv + · exact ⟨fe e, hE ▸ mem_image_of_mem fe he, ha.e₁ e (hs.2 he)⟩ + · refine mapsTo_U (fun v hv => ?_) fun e he => ?_ + · rw [hV] at hv + obtain ⟨c, hc, rfl⟩ := hv + rw [ha.v₂ _ (hd.v₁ c (hs.1 hc)), hd.vl c (hs.1 hc)] + exact hc + · rw [hE] at he + obtain ⟨c, hc, rfl⟩ := he + refine ⟨c, hc, ?_⟩ + have := ha.e₂ _ (hd.e₁ c (hs.2 hc)) + rwa [hd.el c (hs.2 hc)] at this + +/-- The main step of Whitney's theorem, for total functions that carry the isomorphism. -/ +theorem exists_homeo {G₁ G₂ : Graph S (Set S)} {P₁ P₂ : Set S → Graph S (Set S)} (hS : IsSphere S) + (h₁ : SubData J₁.toGraph G₁ P₁) (h₂ : SubData J₂.toGraph G₂ P₂) + (hd : IsoD J₁ J₂ fv gv fe ge) (W : Set (Set S)) + (hW : ∀ e ∈ W, e ∈ J₁.E → fe e = e ∧ ∀ v ∈ closure e, v ∈ J₁.V → fv v = v) : + ∃ h : S ≃ₜ S, (∀ v ∈ J₁.V, h v = fv v) ∧ (∀ e ∈ J₁.E, h '' e = fe e) ∧ + ∀ e ∈ W, e ∈ J₁.E → ∀ p ∈ closure e, h p = p := by + classical + have hne : Nonempty S := by + obtain ⟨e⟩ := hS + exact ⟨e.symm OnePoint.infty⟩ + have hi₁ : ∀ v ∈ J₁.V, ∃ e ∈ J₁.E, J₁.toGraph.Inc e v := fun v hv => by + obtain ⟨e, he, -, -, -, ie, -⟩ := h₁.exists_two_edges (x := v) hv + exact ⟨e, he, ie⟩ + have hi₂ : ∀ v ∈ J₂.V, ∃ e ∈ J₂.E, J₂.toGraph.Inc e v := fun v hv => by + obtain ⟨e, he, -, -, -, ie, -⟩ := h₂.exists_two_edges (x := v) hv + exact ⟨e, he, ie⟩ + have hl₁ : ∀ e u, ¬ J₁.toGraph.IsLink e u u := fun e u hl => no_loop h₁ hl + have hl₂ : ∀ e u, ¬ J₂.toGraph.IsLink e u u := fun e u hl => no_loop h₂ hl + obtain ⟨𝓕₁, hF₁⟩ := exists_faces hS h₁ + obtain ⟨𝓕₂, hF₂⟩ := exists_faces hS h₂ + obtain ⟨g, g', ha, hgW⟩ := exists_arcD hd W hW hl₁ hl₂ hi₁ hi₂ + have hstep : ∀ D : 𝓕₁, ∃ D' ∈ 𝓕₂, PH (discBd D.1) (discBd D') g g' := fun D => + exists_face_image hS h₁ hi₂ hd ha hF₁ hF₂ D.2 + have hback : ∀ {D'}, D' ∈ 𝓕₂ → ∃ D ∈ 𝓕₁, PH (discBd D') (discBd D) g' g := fun hD => + exists_face_image hS h₂ hi₁ hd.symm ha.symm hF₂ hF₁ hD + choose τ hτ hPτ using hstep + have hext : ∀ D : 𝓕₁, ∃ f f', PH D.1 (τ D) f f' ∧ EqOn f g (discBd D.1) ∧ + EqOn f' g' (discBd (τ D)) := fun D => + exists_disc_PH (hF₁.disc _ D.2) (hF₂.disc _ (hτ D)) (hPτ D) + choose f f' hf hfg hfg' using hext + have hτinj : ∀ i j, i ≠ j → τ i ≠ τ j := by + intro i j hij heq + apply hij + apply Subtype.ext + refine faces_inj hS h₁ hF₁ i.2 j.2 ?_ + rw [← (hPτ i).symm.image_eq, ← (hPτ j).symm.image_eq, heq] + have hfin : Finite 𝓕₁ := hF₁.finite.to_subtype + obtain ⟨F, F', hPH, hFe, hFe'⟩ := exists_glue (A := fun D : 𝓕₁ => D.1) (B := τ) + (fun D => (hF₁.disc _ D.2).isClosed) (fun D => (hF₂.disc _ (hτ D)).isClosed) hf + (fun i j x hi hj => by + by_cases hij : i = j + · rw [hij] + · obtain ⟨h₃, h₄⟩ := hF₁.overlap i.2 j.2 (fun h' => hij (Subtype.ext h')) hi hj + rw [hfg i h₃, hfg j h₄]) + (fun i j y hi hj => by + by_cases hij : i = j + · rw [hij] + · obtain ⟨h₃, h₄⟩ := hF₂.overlap (hτ i) (hτ j) (hτinj i j hij) hi hj + rw [hfg' i h₃, hfg' j h₄]) + have hA : (⋃ D : 𝓕₁, D.1) = univ := by + rw [← sUnion_eq_iUnion] + exact hF₁.cover + have hB : (⋃ D : 𝓕₁, τ D) = univ := by + refine eq_univ_of_univ_subset fun y _ => ?_ + have hy : y ∈ ⋃₀ 𝓕₂ := by rw [hF₂.cover]; exact mem_univ y + obtain ⟨D', hD', hyD⟩ := hy + obtain ⟨D, hD, hP⟩ := hback hD' + have heq : τ ⟨D, hD⟩ = D' := by + refine faces_inj hS h₂ hF₂ (hτ _) hD' ?_ + rw [← (hPτ ⟨D, hD⟩).image_eq] + exact hP.symm.image_eq + exact mem_iUnion.mpr ⟨⟨D, hD⟩, heq ▸ hyD⟩ + rw [hA, hB] at hPH + let h : S ≃ₜ S := + { toFun := F + invFun := F' + left_inv := fun x => hPH.2.2.1 (mem_univ x) + right_inv := fun x => hPH.2.2.2.1 (mem_univ x) + continuous_toFun := continuousOn_univ.mp hPH.2.2.2.2.1 + continuous_invFun := continuousOn_univ.mp hPH.2.2.2.2.2 } + have hFg : ∀ p ∈ J₁.U, F p = g p := by + intro p hp + have hc : p ∈ ⋃₀ 𝓕₁ := by rw [hF₁.cover]; exact mem_univ p + obtain ⟨D, hD, hpD⟩ := hc + have hpb : p ∈ discBd D := by + by_contra hn + exact Set.disjoint_left.mp (hF₁.free D hD) ⟨hpD, hn⟩ hp + rw [hFe ⟨D, hD⟩ hpD] + exact hfg ⟨D, hD⟩ hpb + refine ⟨h, fun v hv => (hFg v (J₁.V_subset_U hv)).trans (ha.v₁ v hv), fun e he => ?_, + fun e heW he p hp => ?_⟩ + swap + · have hpU : p ∈ J₁.U := J₁.closure_subset_U he hp + exact (hFg p hpU).trans (hgW e heW he p hp) + obtain ⟨x, y, hl⟩ := (J₁.toGraph.edge_mem_iff_exists_isLink e).mp he + have hxy : x ≠ y := fun h' => hl₁ e x (h' ▸ hl) + have hl' := hd.link₁ e x y hl + have heU : e ⊆ J₁.U := fun p hp => (he.2.1 hp).1 + have heU' : fe e ⊆ J₂.U := fun p hp => ((hd.e₁ e he).2.1 hp).1 + have hclU : closure e ⊆ J₁.U := by + rw [J₁.U_eq] + exact fun p hp => Or.inr (mem_iUnion₂.mpr ⟨e, he, hp⟩) + ext q + constructor + · rintro ⟨p, hp, rfl⟩ + change F p ∈ fe e + rw [hFg p (heU hp)] + have hin := ha.e₁ e he (subset_closure hp) + rw [GM06.closure_edge_eq_union_ends J₂ hl' (fun h' => hl₂ _ _ (h' ▸ hl'))] at hin + have hpV : p ∉ J₁.V := (he.2.1 hp).2 + rcases hin with h₃ | h₃ | h₃ + · exact h₃ + · rw [← ha.v₁ x hl.left_mem] at h₃ + have := congrArg g' h₃ + rw [ha.ph.2.2.1 (heU hp), ha.ph.2.2.1 (J₁.V_subset_U hl.left_mem)] at this + exact (hpV (this ▸ hl.left_mem)).elim + · rw [mem_singleton_iff, ← ha.v₁ y hl.right_mem] at h₃ + have := congrArg g' h₃ + rw [ha.ph.2.2.1 (heU hp), ha.ph.2.2.1 (J₁.V_subset_U hl.right_mem)] at this + exact (hpV (this ▸ hl.right_mem)).elim + · intro hq + have hin := ha.e₂ _ (hd.e₁ e he) (subset_closure hq) + rw [hd.el e he] at hin + have hgq : g (g' q) = q := ha.ph.2.2.2.1 (heU' hq) + have hqV : q ∉ J₂.V := ((hd.e₁ e he).2.1 hq).2 + have hmem : g' q ∈ e := by + rw [GM06.closure_edge_eq_union_ends J₁ hl hxy] at hin + rcases hin with h₃ | h₃ | h₃ + · exact h₃ + · rw [h₃, ha.v₁ x hl.left_mem] at hgq + exact (hqV (hgq ▸ hl'.2.1)).elim + · rw [mem_singleton_iff] at h₃ + rw [h₃, ha.v₁ y hl.right_mem] at hgq + exact (hqV (hgq ▸ hl'.2.2.1)).elim + exact ⟨g' q, hmem, (hFg _ (heU hmem)).trans hgq⟩ + +end Assembly + +/-- Whitney's theorem, with a homeomorphism that fixes each point of the edges in `W`, given that +the +isomorphism fixes these edges and their ends. -/ +theorem whitney_fixing {S : Type u} [TopologicalSpace S] (hSurf : IsSurface S) + (hS : IsSphere S) (J₁ J₂ : Drawing S) (hsub : IsSubdivisionOfSimpleThreeConnected J₁.toGraph) + (φ : Iso J₁.toGraph J₂.toGraph) (W : Set (Set S)) + (hW : ∀ e : E(J₁.toGraph), e.1 ∈ W → (φ.edgeEquiv e).1 = e.1 ∧ + ∀ v : V(J₁.toGraph), v.1 ∈ closure e.1 → (φ.vertexEquiv v).1 = v.1) : + ∃ h : S ≃ₜ S, (∀ v : V(J₁.toGraph), h v.1 = (φ.vertexEquiv v).1) ∧ + (∀ e : E(J₁.toGraph), h '' e.1 = (φ.edgeEquiv e).1) ∧ + ∀ e ∈ W, e ∈ J₁.E → ∀ p ∈ closure e, h p = p := by + classical + have : T2Space S := hSurf.2.1 + obtain ⟨G₁, P₁, h₁⟩ := exists_subData hsub + obtain ⟨G₂, P₂, h₂⟩ := exists_subData (isSubdivision_of_iso hsub φ) + let fv : S → S := fun x => if hx : x ∈ J₁.V then (φ.vertexEquiv ⟨x, hx⟩).1 else x + let gv : S → S := fun x => if hx : x ∈ J₂.V then (φ.vertexEquiv.symm ⟨x, hx⟩).1 else x + let fe : Set S → Set S := fun x => if hx : x ∈ J₁.E then (φ.edgeEquiv ⟨x, hx⟩).1 else x + let ge : Set S → Set S := fun x => if hx : x ∈ J₂.E then (φ.edgeEquiv.symm ⟨x, hx⟩).1 else x + have hfv : ∀ x : V(J₁.toGraph), fv x.1 = (φ.vertexEquiv x).1 := fun x => dite_eq_left x.2 + have hgv : ∀ x : V(J₂.toGraph), gv x.1 = (φ.vertexEquiv.symm x).1 := fun x => dite_eq_left x.2 + have hfe : ∀ x : E(J₁.toGraph), fe x.1 = (φ.edgeEquiv x).1 := fun x => dite_eq_left x.2 + have hge : ∀ x : E(J₂.toGraph), ge x.1 = (φ.edgeEquiv.symm x).1 := fun x => dite_eq_left x.2 + have hd : IsoD J₁ J₂ fv gv fe ge := by + refine ⟨fun x hx => ?_, fun y hy => ?_, fun x hx => ?_, fun y hy => ?_, fun x hx => ?_, + fun y hy => ?_, fun x hx => ?_, fun y hy => ?_, fun e x y hl => ?_, fun e x y hl => ?_⟩ + · rw [hfv ⟨x, hx⟩] + exact (φ.vertexEquiv ⟨x, hx⟩).2 + · rw [hgv ⟨y, hy⟩] + exact (φ.vertexEquiv.symm ⟨y, hy⟩).2 + · rw [hfv ⟨x, hx⟩, hgv (φ.vertexEquiv ⟨x, hx⟩), Equiv.symm_apply_apply] + · rw [hgv ⟨y, hy⟩, hfv (φ.vertexEquiv.symm ⟨y, hy⟩), Equiv.apply_symm_apply] + · rw [hfe ⟨x, hx⟩] + exact (φ.edgeEquiv ⟨x, hx⟩).2 + · rw [hge ⟨y, hy⟩] + exact (φ.edgeEquiv.symm ⟨y, hy⟩).2 + · rw [hfe ⟨x, hx⟩, hge (φ.edgeEquiv ⟨x, hx⟩), Equiv.symm_apply_apply] + · rw [hge ⟨y, hy⟩, hfe (φ.edgeEquiv.symm ⟨y, hy⟩), Equiv.apply_symm_apply] + · have := (φ.isLink_iff ⟨e, hl.edge_mem⟩ ⟨x, hl.left_mem⟩ ⟨y, hl.right_mem⟩).mp hl + rw [hfe ⟨e, hl.edge_mem⟩, hfv ⟨x, hl.left_mem⟩, hfv ⟨y, hl.right_mem⟩] + exact this + · rw [hge ⟨e, hl.edge_mem⟩, hgv ⟨x, hl.left_mem⟩, hgv ⟨y, hl.right_mem⟩] + refine (φ.isLink_iff _ _ _).mpr ?_ + rw [Equiv.apply_symm_apply, Equiv.apply_symm_apply, Equiv.apply_symm_apply] + exact hl + obtain ⟨h, hv, he, hfix⟩ := exists_homeo hS h₁ h₂ hd W (fun e heW he => by + have h₃ := hW ⟨e, he⟩ heW + refine ⟨(hfe ⟨e, he⟩).trans h₃.1, fun v hv hvV => ?_⟩ + exact (hfv ⟨v, hvV⟩).trans (h₃.2 ⟨v, hvV⟩ hv)) + exact ⟨h, fun v => (hv v.1 v.2).trans (hfv v), fun e => (he e.1 e.2).trans (hfe e), hfix⟩ + +/-- **Whitney's theorem.** Two drawings in a sphere of a subdivision of a simple 3-connected graph +are related by a homeomorphism of the sphere that extends the graph isomorphism. Graph Minors XIV +uses it in the proof of (6.4) (page 34). The route is the one recorded in M. Grohe and S. Kiefer, +arXiv:1904.07216v1, Section 2, page 6: the face boundaries of a 3-connected plane graph are its +chordless non-separating circuits, so they do not depend on the drawing. Here that fact is +`peripheral_of_side` and `exists_free_side_of_peripheral`. The homeomorphism is then built edge by +edge and face by face with the Schoenflies theorem. The original source is H. Whitney, *Congruent +graphs and the connectivity of graphs*, Amer. J. Math. 54 (1932), 150--168, named here as Grohe and +Kiefer cite it. That paper was not read for this proof. -/ +theorem whitney_planar_uniqueness : WhitneyPlanarUniquenessStatement.{u} := by + intro S _ _ hSurf hS J₁ J₂ hsub φ + obtain ⟨h, h₁, h₂, -⟩ := whitney_fixing hSurf hS J₁ J₂ hsub φ ∅ (fun _ h' => absurd h' + (notMem_empty _)) + exact ⟨h, h₁, h₂⟩ + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM14/WhitneyFaces.lean b/LeanPool/GraphMinor/GM14/WhitneyFaces.lean new file mode 100644 index 0000000000..0c63794f8c --- /dev/null +++ b/LeanPool/GraphMinor/GM14/WhitneyFaces.lean @@ -0,0 +1,640 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.WhitneyGraph +public import LeanPool.GraphMinor.GM12.Section2DiscChordSplit +public import LeanPool.GraphMinor.GM11.OArcCircuit +public import LeanPool.GraphMinor.GM11.CircuitRegions +import LeanPool.GraphMinor.GM11.PerimeterPull +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.GM06.Section3Dual + +/-! +# The faces of a drawing of a subdivision of a 3-connected graph + +Let `J` be a drawing in a sphere of a subdivision of a simple 3-connected graph. We show that the +sphere is a finite union of closed discs with disjoint interiors that miss `U(J)`, and that the +boundary of each disc is a circuit of `J`. + +We build the discs by adding ears. A first circuit cuts the sphere into two discs. Each later ear is +a path of `J` that has only its two ends on the part already drawn, so all of it except its ends +lies in the interior of one disc. It cuts that disc into two. +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Topology Graph GraphMinor.GM09 GraphMinor.GM11 GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +theorem line_interior_nonempty {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) : + (L \ {a, b}).Nonempty := + Surface.IsLineWithEnds.nonempty_sdiff hL + +variable [T2Space S] + +/-- Cutting a disc along a line between the two common ends of its boundary arcs. -/ +theorem disc_split {D L A B : Set S} {a b : S} (hD : IsClosedDisc D) + (hL : IsLineWithEnds L a b) (hA : IsLineWithEnds A a b) (hB : IsLineWithEnds B a b) + (hAB : A ∩ B = {a, b}) (hLA : L ∩ A = {a, b}) (hLB : L ∩ B = {a, b}) + (hbd : discBd D = A ∪ B) (hLD : L ⊆ D) (hab : a ≠ b) : + ∃ E₁ E₂ : Set S, IsClosedDisc E₁ ∧ IsClosedDisc E₂ ∧ E₁ ∪ E₂ = D ∧ E₁ ∩ E₂ = L ∧ + discBd E₁ = A ∪ L ∧ discBd E₂ = B ∪ L := + GM12.disc_split_with_boundary_arcs_inter hD hL hA hB hAB hLA hLB hbd hLD hab + +section Basics + +variable {J : Drawing S} + +omit [T2Space S] in +/-- A vertex of `J` on a subdrawing is a vertex of the subdrawing. -/ +theorem mem_V_of_mem_U {C : Drawing S} (hC : C.IsSubdrawing J) {v : S} (hv : v ∈ J.V) + (hU : v ∈ C.U) : v ∈ C.V := by + by_contra hn + obtain ⟨e, he, hve⟩ := C.exists_edge_of_mem hU hn + exact ((hC.2 he).2.1 hve).2 hv + +theorem sup_U {P Q : Drawing S} (hP : P.IsSubdrawing J) (hQ : Q.IsSubdrawing J) : + (J.sup P Q).U = P.U ∪ Q.U := by + rw [Drawing.U_eq, Drawing.sup_V hP hQ, Drawing.sup_E hP hQ, P.U_eq, Q.U_eq] + ext x + simp only [mem_union, mem_iUnion, exists_prop] + constructor + · rintro ((hx | hx) | ⟨e, he | he, hx⟩) + · exact Or.inl (Or.inl hx) + · exact Or.inr (Or.inl hx) + · exact Or.inl (Or.inr ⟨e, he, hx⟩) + · exact Or.inr (Or.inr ⟨e, he, hx⟩) + · rintro ((hx | ⟨e, he, hx⟩) | (hx | ⟨e, he, hx⟩)) + · exact Or.inl (Or.inl hx) + · exact Or.inr ⟨e, Or.inl he, hx⟩ + · exact Or.inl (Or.inr hx) + · exact Or.inr ⟨e, Or.inr he, hx⟩ + +omit [T2Space S] in +/-- `J` has no loops. -/ +theorem no_loop {G₀ : Graph S (Set S)} {P : Set S → Graph S (Set S)} + (h : SubData J.toGraph G₀ P) {e : Set S} {v : S} (hl : J.toGraph.IsLink e v v) : False := by + have he := hl.edge_mem + rw [h.eunion] at he + obtain ⟨a, ha, hea⟩ := mem_iUnion₂.mp he + obtain ⟨u, w, -, ⟨hle, W, hs, -, hE⟩, -⟩ := h.path a ha + rw [hE] at hea + have hl' : (P a).IsLink e v v := (hle.isLink_iff (by rw [hE]; exact hea)).mpr hl + have key : ∀ {x y : S} (W : GraphWalk (P a) x y), W.IsSimple → e ∈ W.edges → False := by + intro x y W + induction W with + | nil _ => intro _ h'; simp [GraphWalk.edges] at h' + | @cons p q r f hlink rest ih => + intro hs hm + have hs' : rest.IsSimple := (List.nodup_cons.mp hs).2 + simp only [GraphWalk.edges, List.mem_cons] at hm + rcases hm with rfl | hm + · have h₁ := (P a).eq_or_eq_of_isLink_of_isLink hlink hl' + have h₂ := (P a).eq_or_eq_of_isLink_of_isLink hlink.symm hl' + have hpq : p = q := by + rcases h₁ with rfl | rfl <;> rcases h₂ with h₂ | h₂ <;> simp_all + exact (List.nodup_cons.mp hs).1 (hpq ▸ rest.start_mem_support) + · exact ih hs' hm + exact key W hs hea + +omit [T2Space S] in +/-- An end of an edge is in its closure. -/ +theorem mem_closure_of_inc {e : Set S} {v : S} (hi : J.toGraph.Inc e v) : v ∈ closure e := by + obtain ⟨w, -, -, -, hcap⟩ := hi + have : v ∈ closure e ∩ J.V := by rw [hcap]; exact Or.inl rfl + exact this.1 + +omit [T2Space S] in +/-- A vertex in the closure of an edge is an end of the edge. -/ +theorem inc_of_mem_closure {e : Set S} (he : e ∈ J.E) {v : S} (hv : v ∈ closure e) + (hvV : v ∈ J.V) : J.toGraph.Inc e v := by + obtain ⟨a, b, hab⟩ := (J.toGraph.edge_mem_iff_exists_isLink e).mp he + have hm : v ∈ closure e ∩ J.V := ⟨hv, hvV⟩ + rw [hab.2.2.2] at hm + rcases hm with rfl | rfl + · exact ⟨b, hab⟩ + · exact ⟨a, hab.symm⟩ + +/-- Each vertex of a circuit of `J` meets two edges of the circuit. -/ +theorem circuit_two_edges {G₀ : Graph S (Set S)} {P : Set S → Graph S (Set S)} + (h : SubData J.toGraph G₀ P) {C : Drawing S} (hC : C.IsCircuit) (hs : C.IsSubdrawing J) {v : S} + (hv : v ∈ C.V) : + ∃ e ∈ C.E, ∃ f ∈ C.E, e ≠ f ∧ J.toGraph.Inc e v ∧ J.toGraph.Inc f v := by + have hb : ∃ b ∈ C.V, b ≠ v := by + obtain ⟨u, W, -, hpos, hV, hE⟩ := id hC + cases W with + | nil _ => simp [GraphWalk.length, GraphWalk.edges] at hpos + | @cons _ m _ f hl rest => + have hf : f ∈ C.E := by rw [hE]; simp [GraphWalk.edges] + have hl' : J.toGraph.IsLink f u m := (hs.isLink_iff hf).mp hl + have hum : u ≠ m := fun h' => no_loop h (h' ▸ hl') + have hu : u ∈ C.V := hl.left_mem + have hm : m ∈ C.V := hl.right_mem + by_cases huv : u = v + · exact ⟨m, hm, fun h' => hum (huv.trans h'.symm)⟩ + · exact ⟨u, hu, huv⟩ + obtain ⟨b, hb, hne⟩ := hb + obtain ⟨P₁, Q, ⟨W₁, hW₁, -, hE₁⟩, ⟨W₂, hW₂, -, hE₂⟩, hP₁, hQ, -, -, -, hd, -⟩ := + Drawing.IsCircuit.exists_two_paths hC hv hb hne.symm + obtain ⟨e, he, ie⟩ := exists_edge_at_start W₁ hne.symm + obtain ⟨f, hf, if'⟩ := exists_edge_at_start W₂ hne.symm + have he' : e ∈ P₁.E := by rw [hE₁]; exact he + have hf' : f ∈ Q.E := by rw [hE₂]; exact hf + have hconv : ∀ {D : Drawing S} {g : Set S}, D.IsSubdrawing J → g ∈ D.E → D.toGraph.Inc g v → + J.toGraph.Inc g v := by + rintro D g hD hg ⟨w, hw⟩ + exact ⟨w, (hD.isLink_iff hg).mp hw⟩ + refine ⟨e, hP₁.2 he', f, hQ.2 hf', fun hef => Set.disjoint_left.mp hd he' (hef ▸ hf'), + hconv (hP₁.trans hs) he' ie, hconv (hQ.trans hs) hf' if'⟩ + +end Basics + +section FaceSystem + +variable {J : Drawing S} + +/-- A cell structure on the sphere for a subdrawing `H` of `J`: finitely many closed discs with +disjoint interiors that cover the sphere and miss `U(H)` in their interiors, each with a circuit of +`H` as boundary. -/ +structure IsFaceSys (J H : Drawing S) (𝓕 : Set (Set S)) : Prop where + sub : H.IsSubdrawing J + finite : 𝓕.Finite + disc : ∀ D ∈ 𝓕, IsClosedDisc D + circuit : ∀ D ∈ 𝓕, ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing H ∧ C.U = discBd D + free : ∀ D ∈ 𝓕, Disjoint (D \ discBd D) H.U + disj : ∀ D ∈ 𝓕, ∀ D' ∈ 𝓕, D ≠ D' → Disjoint (D \ discBd D) (D' \ discBd D') + cover : ⋃₀ 𝓕 = univ + onbd : ∀ v ∈ H.V, ∃ D ∈ 𝓕, v ∈ discBd D + +/-- The first end of a simple walk is in the closure of the rest of its point set. -/ +theorem ends_mem_closure_inner {a b : S} {W : GraphWalk J.toGraph a b} (hW : W.IsSimple) + (hab : a ≠ b) : a ∈ closure ((walkDrawing J W).U \ {a, b}) := by + obtain ⟨e, he, ie⟩ := exists_edge_at_start W hab + have heE : e ∈ J.E := ie.edge_mem + refine closure_mono ?_ (mem_closure_of_inc ie) + intro x hx + refine ⟨(mem_walkDrawing_U J W).mpr (Or.inr ⟨e, he, subset_closure hx⟩), ?_⟩ + have hxV : x ∉ J.V := (heE.2.1 hx).2 + rintro (rfl | rfl) + · exact hxV (W.mem_vertexSet_of_mem_support W.start_mem_support) + · exact hxV (W.mem_vertexSet_of_mem_support W.end_mem_support) + +private theorem IsFaceSys.step_in_disc {H L : Drawing S} {𝓕 : Set (Set S)} + (hF : IsFaceSys J H 𝓕) {x y : S} + (hxy : x ≠ y) (hx : x ∈ H.V) (hy : y ∈ H.V) + (hLs : L.IsSubdrawing J) (hLp : L.IsPathBetween x y) + (hLl : IsLineWithEnds L.U x y) (hHL : Disjoint L.E H.E) + (hxL : x ∈ L.V) (hyL : y ∈ L.V) (hcap : L.U ∩ H.U = {x, y}) + {D : Set S} (hD : D ∈ 𝓕) (hLD : L.U ⊆ D) + (hin : ∀ z ∈ L.V, z ∉ H.V ∨ z = x ∨ z = y) : + ∃ H' 𝓕', IsFaceSys J H' 𝓕' ∧ H'.E = H.E ∪ L.E := by + classical + have hDd := hF.disc D hD + obtain ⟨C, hCc, hCH, hCU⟩ := hF.circuit D hD + have hbdH : discBd D ⊆ H.U := by rw [← hCU]; exact hCH.U_subset + have hxD := hLD (L.V_subset_U hxL) + have hyD := hLD (L.V_subset_U hyL) + have hbdp : ∀ {p}, p ∈ D → p ∈ H.U → p ∈ discBd D := fun {p} hp hpH => by + by_contra hn + exact Set.disjoint_left.mp (hF.free D hD) ⟨hp, hn⟩ hpH + have hxH : x ∈ H.U := H.V_subset_U hx + have hyH : y ∈ H.U := H.V_subset_U hy + have hxC : x ∈ C.V := mem_V_of_mem_U (hCH.trans hF.sub) (hF.sub.1 hx) (hCU ▸ hbdp hxD hxH) + have hyC : y ∈ C.V := mem_V_of_mem_U (hCH.trans hF.sub) (hF.sub.1 hy) (hCU ▸ hbdp hyD hyH) + obtain ⟨P₁, Q₁, hP, hQ, hPC, hQC, -, -, hPQ, hdPQ, hsup⟩ := + Drawing.IsCircuit.exists_two_paths hCc hxC hyC hxy + have hCs : C.IsSubdrawing J := hCH.trans hF.sub + have hPs := hPC.trans hCs + have hQs := hQC.trans hCs + have hPl := isLine_of_isPathBetween hP hxy + have hQl := isLine_of_isPathBetween hQ hxy + have hCUeq : C.U = P₁.U ∪ Q₁.U := by + have := sup_U (J := C) hPC hQC + rwa [hsup] at this + have hPQU : P₁.U ∩ Q₁.U = {x, y} := by + rw [U_inter_of_disjoint hPC hQC hdPQ, hPQ] + have hPH : P₁.IsSubdrawing H := hPC.trans hCH + have hQH : Q₁.IsSubdrawing H := hQC.trans hCH + have hxPQ : x ∈ P₁.V ∩ Q₁.V := hPQ.symm ▸ (Or.inl rfl : x ∈ ({x, y} : Set S)) + have hyPQ : y ∈ P₁.V ∩ Q₁.V := hPQ.symm ▸ (Or.inr rfl : y ∈ ({x, y} : Set S)) + have hLP : L.U ∩ P₁.U = {x, y} := by + refine Subset.antisymm ?_ ?_ + · rintro p ⟨h₁, h₂⟩ + rw [← hcap] + exact ⟨h₁, hPH.U_subset h₂⟩ + · rintro p (rfl | rfl) + · exact ⟨L.V_subset_U hxL, P₁.V_subset_U hxPQ.1⟩ + · exact ⟨L.V_subset_U hyL, P₁.V_subset_U hyPQ.1⟩ + have hLQ : L.U ∩ Q₁.U = {x, y} := by + refine Subset.antisymm ?_ ?_ + · rintro p ⟨h₁, h₂⟩ + rw [← hcap] + exact ⟨h₁, hQH.U_subset h₂⟩ + · rintro p (rfl | rfl) + · exact ⟨L.V_subset_U hxL, Q₁.V_subset_U hxPQ.2⟩ + · exact ⟨L.V_subset_U hyL, Q₁.V_subset_U hyPQ.2⟩ + obtain ⟨E₁, E₂, hE₁, hE₂, hun, hint, hb₁, hb₂⟩ := disc_split hDd hLl hPl hQl hPQU hLP hLQ + (by rw [← hCU, hCUeq]) hLD hxy + have hE₁D : E₁ ⊆ D := hun ▸ subset_union_left + have hE₂D : E₂ ⊆ D := hun ▸ subset_union_right + have hiE₁ : E₁ \ discBd E₁ ⊆ D \ discBd D := by + rintro p ⟨hp, hn⟩ + refine ⟨hE₁D hp, fun hpb => hn ?_⟩ + rw [← hCU, hCUeq] at hpb + rw [hb₁] + rcases hpb with h | h + · exact Or.inl h + · have hpE₂ : p ∈ E₂ := Surface.discBd_subset _ (hb₂ ▸ Or.inl h) + exact Or.inr (hint ▸ ⟨hp, hpE₂⟩) + have hiE₂ : E₂ \ discBd E₂ ⊆ D \ discBd D := by + rintro p ⟨hp, hn⟩ + refine ⟨hE₂D hp, fun hpb => hn ?_⟩ + rw [← hCU, hCUeq] at hpb + rw [hb₂] + rcases hpb with h | h + · have hpE₁ : p ∈ E₁ := Surface.discBd_subset _ (hb₁ ▸ Or.inl h) + exact Or.inr (hint ▸ ⟨hpE₁, hp⟩) + · exact Or.inl h + have hHLs : (J.sup H L).IsSubdrawing J := Drawing.sup_isSubdrawing J H L + have hHle : H.IsSubdrawing (J.sup H L) := Drawing.le_sup_left hF.sub hLs + have hLle : L.IsSubdrawing (J.sup H L) := Drawing.le_sup_right hF.sub hLs + have hU' : (J.sup H L).U = H.U ∪ L.U := sup_U hF.sub hLs + have hfree' : ∀ {Y : Set S}, Y ⊆ D \ discBd D → Y ∩ L.U = ∅ → Disjoint Y (J.sup H L).U := by + intro Y hY hYL + rw [hU', Set.disjoint_left] + rintro p hp (hpH | hpL) + · exact Set.disjoint_left.mp (hF.free D hD) (hY hp) hpH + · have : p ∈ Y ∩ L.U := ⟨hp, hpL⟩ + rw [hYL] at this + exact this + have hLb₁ : L.U ⊆ discBd E₁ := by rw [hb₁]; exact subset_union_right + have hLb₂ : L.U ⊆ discBd E₂ := by rw [hb₂]; exact subset_union_right + have hnew : ∀ {X : Drawing S}, X.IsPathBetween x y → X.IsSubdrawing H → + X.V ∩ L.V = {x, y} → Disjoint X.E L.E → ∃ C' : Drawing S, C'.IsCircuit ∧ + C'.IsSubdrawing (J.sup H L) ∧ C'.U = X.U ∪ L.U := by + intro X hX hXH hV hd + have hXJ := hXH.trans hF.sub + refine ⟨J.sup X L, Drawing.isCircuit_sup hX hLp hXJ hLs hxy hV hd, ?_, sup_U hXJ hLs⟩ + refine ⟨?_, ?_⟩ + · rw [Drawing.sup_V hXJ hLs] + exact union_subset (hXH.trans hHle).1 hLle.1 + · intro e he + have he' : e ∈ (J.sup X L).E := he + rw [Drawing.sup_E hXJ hLs] at he' + rcases he' with he' | he' + · exact (hXH.trans hHle).2 he' + · exact hLle.2 he' + have hVcap : ∀ {X : Drawing S}, X.IsSubdrawing H → x ∈ X.V → y ∈ X.V → X.V ∩ L.V = {x, y} := by + intro X hXH hxX hyX + refine Subset.antisymm ?_ ?_ + · rintro p ⟨h₁, h₂⟩ + rcases hin p h₂ with h | h + · exact (h (hXH.1 h₁)).elim + · exact h + · rintro p (rfl | rfl) + · exact ⟨hxX, hxL⟩ + · exact ⟨hyX, hyL⟩ + have hPV : x ∈ P₁.V ∧ y ∈ P₁.V := by + have h₁ : x ∈ P₁.V ∩ Q₁.V := by rw [hPQ]; exact Or.inl rfl + have h₂ : y ∈ P₁.V ∩ Q₁.V := by rw [hPQ]; exact Or.inr rfl + exact ⟨h₁.1, h₂.1⟩ + have hQV : x ∈ Q₁.V ∧ y ∈ Q₁.V := by + have h₁ : x ∈ P₁.V ∩ Q₁.V := by rw [hPQ]; exact Or.inl rfl + have h₂ : y ∈ P₁.V ∩ Q₁.V := by rw [hPQ]; exact Or.inr rfl + exact ⟨h₁.2, h₂.2⟩ + have hdE : ∀ {X : Drawing S}, X.IsSubdrawing H → Disjoint X.E L.E := fun hX => + Set.disjoint_of_subset_left hX.2 hHL.symm + refine ⟨J.sup H L, insert E₁ (insert E₂ (𝓕 \ {D})), ?_, ?_⟩ + · refine ⟨hHLs, ((hF.finite.subset sdiff_subset).insert _).insert _, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rintro X (rfl | rfl | ⟨hX, -⟩) + · exact hE₁ + · exact hE₂ + · exact hF.disc X hX + · rintro X (rfl | rfl | ⟨hX, -⟩) + · obtain ⟨C', h₁, h₂, h₃⟩ := hnew hP hPH (hVcap hPH hPV.1 hPV.2) (hdE hPH) + exact ⟨C', h₁, h₂, by rw [h₃, hb₁]⟩ + · obtain ⟨C', h₁, h₂, h₃⟩ := hnew hQ hQH (hVcap hQH hQV.1 hQV.2) (hdE hQH) + exact ⟨C', h₁, h₂, by rw [h₃, hb₂]⟩ + · obtain ⟨C', h₁, h₂, h₃⟩ := hF.circuit X hX + exact ⟨C', h₁, h₂.trans hHle, h₃⟩ + · rintro X (rfl | rfl | ⟨hX, hne⟩) + · refine hfree' hiE₁ (Set.eq_empty_iff_forall_notMem.mpr ?_) + rintro p ⟨hp, hpL⟩ + exact hp.2 (hLb₁ hpL) + · refine hfree' hiE₂ (Set.eq_empty_iff_forall_notMem.mpr ?_) + rintro p ⟨hp, hpL⟩ + exact hp.2 (hLb₂ hpL) + · rw [hU', Set.disjoint_left] + rintro p hp (hpH | hpL) + · exact Set.disjoint_left.mp (hF.free X hX) hp hpH + · have hzz : p ∈ D \ discBd D := by + by_cases hpb : p ∈ discBd D + · have : p ∈ L.U ∩ H.U := ⟨hpL, hbdH hpb⟩ + rw [hcap] at this + have hbp : p ∈ H.U := by + rcases this with rfl | rfl + · exact hxH + · exact hyH + exact (Set.disjoint_left.mp (hF.free X hX) hp hbp).elim + · exact ⟨hLD hpL, hpb⟩ + exact Set.disjoint_left.mp (hF.disj X hX D hD hne) hp hzz + · have hE₁₂ : Disjoint (E₁ \ discBd E₁) (E₂ \ discBd E₂) := by + rw [Set.disjoint_left] + rintro p ⟨h₁, h₂⟩ ⟨h₃, -⟩ + exact h₂ (hLb₁ (hint ▸ ⟨h₁, h₃⟩)) + have hold : ∀ X ∈ 𝓕 \ {D}, ∀ {Y : Set S}, Y ⊆ D \ discBd D → + Disjoint Y (X \ discBd X) := by + rintro X ⟨hX, hne⟩ Y hY + exact Set.disjoint_of_subset_left hY (hF.disj D hD X hX (Ne.symm hne)) + rintro X (rfl | rfl | hX) X' (rfl | rfl | hX') hne + · exact (hne rfl).elim + · exact hE₁₂ + · exact hold X' hX' hiE₁ + · exact hE₁₂.symm + · exact (hne rfl).elim + · exact hold X' hX' hiE₂ + · exact (hold X hX hiE₁).symm + · exact (hold X hX hiE₂).symm + · exact hF.disj X hX.1 X' hX'.1 hne + · refine eq_univ_of_univ_subset ?_ + intro p _ + have hpc : p ∈ ⋃₀ 𝓕 := by rw [hF.cover]; exact mem_univ p + obtain ⟨X, hX, hpX⟩ := hpc + by_cases hXD : X = D + · subst hXD + rw [← hun] at hpX + rcases hpX with h | h + · exact ⟨E₁, Or.inl rfl, h⟩ + · exact ⟨E₂, Or.inr (Or.inl rfl), h⟩ + · exact ⟨X, Or.inr (Or.inr ⟨hX, hXD⟩), hpX⟩ + · intro v hv + rw [Drawing.sup_V hF.sub hLs] at hv + rcases hv with hv | hv + · obtain ⟨X, hX, hvX⟩ := hF.onbd v hv + by_cases hXD : X = D + · subst hXD + rw [← hCU, hCUeq] at hvX + rcases hvX with h | h + · exact ⟨E₁, Or.inl rfl, hb₁ ▸ Or.inl h⟩ + · exact ⟨E₂, Or.inr (Or.inl rfl), hb₂ ▸ Or.inl h⟩ + · exact ⟨X, Or.inr (Or.inr ⟨hX, hXD⟩), hvX⟩ + · exact ⟨E₁, Or.inl rfl, hLb₁ (L.V_subset_U hv)⟩ + · exact Drawing.sup_E hF.sub hLs + +/-- Adding an ear to a cell structure. The ear lies in one disc and cuts it in two. -/ +theorem IsFaceSys.step (hS : IsClosedSurface S) {H : Drawing S} {𝓕 : Set (Set S)} + (hF : IsFaceSys J H 𝓕) {x y : S} {W : GraphWalk J.toGraph x y} (hxy : x ≠ y) + (hW : W.IsSimple) (hx : x ∈ H.V) (hy : y ∈ H.V) (hE : ∀ e ∈ W.edges, e ∉ H.E) + (hin : ∀ z ∈ W.support, z ∉ H.V ∨ z = x ∨ z = y) : + ∃ H' 𝓕', IsFaceSys J H' 𝓕' ∧ H'.E = H.E ∪ {e | e ∈ W.edges} := by + classical + set L := walkDrawing J W with hLdef + have hLs : L.IsSubdrawing J := walkDrawing_isSubdrawing J W + have hLp : L.IsPathBetween x y := walkDrawing_isPathBetween J hW + have hLl : IsLineWithEnds L.U x y := isLine_of_isPathBetween hLp hxy + have hLE : L.E = {e | e ∈ W.edges} := walkDrawing_E J W + have hLV : L.V = {z | z ∈ W.support} := walkDrawing_V J W + have hHL : Disjoint L.E H.E := by + rw [hLE, Set.disjoint_left] + exact fun e he => hE e he + have hxL : x ∈ L.V := by rw [hLV]; exact W.start_mem_support + have hyL : y ∈ L.V := by rw [hLV]; exact W.end_mem_support + have hcap : L.U ∩ H.U = {x, y} := by + rw [U_inter_of_disjoint hLs hF.sub hHL] + ext z + constructor + · rintro ⟨hz, hzH⟩ + rw [hLV] at hz + rcases hin z hz with h | h + · exact (h hzH).elim + · exact h + · rintro (rfl | rfl) + · exact ⟨hxL, hx⟩ + · exact ⟨hyL, hy⟩ + obtain ⟨z, hzL, hzn⟩ := line_interior_nonempty hLl + have hzH : z ∉ H.U := fun h => hzn (hcap ▸ (⟨hzL, h⟩ : z ∈ L.U ∩ H.U)) + have hzc : z ∈ ⋃₀ 𝓕 := by rw [hF.cover]; exact mem_univ z + obtain ⟨D, hD, hzD⟩ := hzc + have hDd := hF.disc D hD + have hDc : IsClosed D := hDd.isClosed + obtain ⟨C, _, hCH, hCU⟩ := hF.circuit D hD + have hbdH : discBd D ⊆ H.U := by rw [← hCU]; exact hCH.U_subset + have hLo : IsPreconnected (L.U \ {x, y}) := + GraphMinor.GM11.IsLineWithEnds.isPreconnected_sdiff_pair hLl + have hofH : ∀ {p}, p ∈ L.U \ {x, y} → p ∉ H.U := fun {p} hp h => + hp.2 (hcap ▸ (⟨hp.1, h⟩ : p ∈ L.U ∩ H.U)) + have hsubD : L.U \ {x, y} ⊆ D := by + rcases subset_or_disjoint_of_frontier hDc hLo (by + rw [IsClosedDisc.frontier_eq_discBd hS hDd, Set.disjoint_left] + exact fun p hp hb => hofH hp (hbdH hb)) with h | h + · exact h + · exact (Set.disjoint_left.mp h ⟨hzL, hzn⟩ hzD).elim + have hend : ∀ {p}, p ∈ closure (L.U \ {x, y}) → p ∈ D := fun {p} hp => + closure_minimal hsubD hDc hp + have hxD : x ∈ D := hend (ends_mem_closure_inner hW hxy) + have hyD : y ∈ D := by + have h' := ends_mem_closure_inner (W := W.reverse) (GraphWalk.IsSimple.reverse hW) hxy.symm + have hsame : (walkDrawing J W.reverse).U = L.U := by + ext p + rw [mem_walkDrawing_U, hLdef, mem_walkDrawing_U, GraphWalk.support_reverse, + GraphWalk.edges_reverse] + simp + rw [hsame, pair_comm] at h' + exact hend h' + have hLD : L.U ⊆ D := by + intro p hp + by_cases hpe : p ∈ ({x, y} : Set S) + · rcases hpe with rfl | rfl + · exact hxD + · exact hyD + · exact hsubD ⟨hp, hpe⟩ + obtain ⟨H', 𝓕', hsys, hE'⟩ := + hF.step_in_disc hxy hx hy hLs hLp hLl hHL hxL hyL hcap hD hLD + (fun z hz => hin z (by + change z ∈ {z | z ∈ W.support} + rwa [← hLV])) + exact ⟨H', 𝓕', hsys, hE'.trans (congrArg (H.E ∪ ·) hLE)⟩ + +/-- The vertices of a subdrawing with a cell structure meet two of its edges. -/ +theorem IsFaceSys.two_edges {G₀ : Graph S (Set S)} {P : Set S → Graph S (Set S)} + (h : SubData J.toGraph G₀ P) {H : Drawing S} {𝓕 : Set (Set S)} (hF : IsFaceSys J H 𝓕) {v : S} + (hv : v ∈ H.V) : + ∃ e ∈ H.E, ∃ f ∈ H.E, e ≠ f ∧ J.toGraph.Inc e v ∧ J.toGraph.Inc f v := by + obtain ⟨D, hD, hvD⟩ := hF.onbd v hv + obtain ⟨C, hCc, hCH, hCU⟩ := hF.circuit D hD + obtain ⟨e, he, f, hf, hef, ie, if'⟩ := circuit_two_edges h hCc (hCH.trans hF.sub) + (mem_V_of_mem_U (hCH.trans hF.sub) (hF.sub.1 hv) (hCU ▸ hvD)) + exact ⟨e, hCH.2 he, f, hCH.2 hf, hef, ie, if'⟩ + +/-- The start of the ear decomposition. -/ +theorem exists_base (hS : IsSphere S) {G₀ : Graph S (Set S)} {P : Set S → Graph S (Set S)} + (h : SubData J.toGraph G₀ P) : ∃ H 𝓕, IsFaceSys J H 𝓕 ∧ H.E.Nonempty := by + obtain ⟨e, he⟩ : ∃ e, e ∈ E(G₀) := by + have hpos : 0 < V(G₀).ncard := by have := h.simple.2.1; omega + obtain ⟨v, hv⟩ := (Set.ncard_pos h.finite_V₀).mp hpos + obtain ⟨e, -, -, ie, -⟩ := IsSimpleThreeConnected.exists_two_edges h.simple hv + exact ⟨e, ie.edge_mem⟩ + obtain ⟨x, y, W₁, W₂, hxy, hs₁, hs₂, hcap, hE⟩ := h.exists_two_paths he + have hp₁ := walkDrawing_isPathBetween J hs₁ + have hp₂ := walkDrawing_isPathBetween J hs₂ + have hsub₁ := walkDrawing_isSubdrawing J W₁ + have hsub₂ := walkDrawing_isSubdrawing J W₂ + have hV : (walkDrawing J W₁).V ∩ (walkDrawing J W₂).V = {x, y} := by + rw [walkDrawing_V, walkDrawing_V] + refine Subset.antisymm (fun z hz => hcap z hz.1 hz.2) ?_ + rintro z (rfl | rfl) + · exact ⟨W₁.start_mem_support, W₂.start_mem_support⟩ + · exact ⟨W₁.end_mem_support, W₂.end_mem_support⟩ + have hd : Disjoint (walkDrawing J W₁).E (walkDrawing J W₂).E := by + rw [walkDrawing_E, walkDrawing_E, Set.disjoint_left] + exact fun a ha => hE a ha + have hC := Drawing.isCircuit_sup hp₁ hp₂ hsub₁ hsub₂ hxy hV hd + set C := J.sup (walkDrawing J W₁) (walkDrawing J W₂) with hCdef + have hCs : C.IsSubdrawing J := Drawing.sup_isSubdrawing J _ _ + obtain ⟨Δ₁, Δ₂, hne, hd₁, hd₂, hb₁, hb₂, hun, hint, -, -⟩ := sphere_disc S hS C.U + (GM11.IsCircuit.isOArc_U hC) + have hne' : C.E.Nonempty := by + obtain ⟨a, ha, -⟩ := exists_edge_at_start W₁ hxy + refine ⟨a, ?_⟩ + rw [hCdef, Drawing.sup_E hsub₁ hsub₂, walkDrawing_E] + exact Or.inl ha + refine ⟨C, {Δ₁, Δ₂}, ⟨hCs, by simp, ?_, ?_, ?_, ?_, ?_, ?_⟩, hne'⟩ + · rintro D (rfl | rfl) + · exact hd₁ + · exact hd₂ + · rintro D (rfl | rfl) + · exact ⟨C, hC, ⟨fun _ h => h, fun _ h => h⟩, hb₁.symm⟩ + · exact ⟨C, hC, ⟨fun _ h => h, fun _ h => h⟩, hb₂.symm⟩ + · rintro D (rfl | rfl) + · rw [hb₁] + exact disjoint_sdiff_left + · rw [hb₂] + exact disjoint_sdiff_left + · have hdj : Disjoint (Δ₁ \ discBd Δ₁) (Δ₂ \ discBd Δ₂) := by + rw [Set.disjoint_left] + rintro p ⟨h₁, h₂⟩ ⟨h₃, -⟩ + exact h₂ (by rw [hb₁, ← hint]; exact ⟨h₁, h₃⟩) + rintro D (rfl | rfl) D' (rfl | rfl) hn + · exact (hn rfl).elim + · exact hdj + · exact hdj.symm + · exact (hn rfl).elim + · rw [sUnion_pair] + exact hun + · intro v hv + exact ⟨Δ₁, Or.inl rfl, by rw [hb₁]; exact C.V_subset_U hv⟩ + +/-- A drawing of a subdivision of a simple 3-connected graph in a sphere has a cell structure. -/ +theorem exists_faces (hS : IsSphere S) {G₀ : Graph S (Set S)} {P : Set S → Graph S (Set S)} + (h : SubData J.toGraph G₀ P) : ∃ 𝓕, IsFaceSys J J 𝓕 := by + classical + have hcl : IsClosedSurface S := (IsSphere.isClosedSurface hS).1 + have key : ∀ n : ℕ, ∀ H 𝓕, IsFaceSys J H 𝓕 → H.E.Nonempty → (J.E \ H.E).ncard = n → + ∃ 𝓕', IsFaceSys J J 𝓕' := by + intro n + induction n using Nat.strong_induction_on with + | _ n ih => + intro H 𝓕 hF hne hn + by_cases hall : J.E ⊆ H.E + · have hE : H.E = J.E := Subset.antisymm hF.sub.2 hall + have hV : H.V = J.V := by + refine Subset.antisymm hF.sub.1 fun v hv => ?_ + obtain ⟨e, he, -, -, -, ie, -⟩ := h.exists_two_edges (x := v) hv + have hmem : v ∈ closure e ∩ J.V := ⟨mem_closure_of_inc ie, hv⟩ + have heH : e ∈ H.E := hall he + rw [← hF.sub.closure_inter_V heH] at hmem + exact hmem.2 + have heq : H = J := Drawing.ext_of_V_E hV hE + exact ⟨𝓕, heq ▸ hF⟩ + · obtain ⟨g, hg, hgn⟩ := Set.not_subset.mp hall + obtain ⟨x, y, W, hxy, hs, hx, hy, -, -, hE, hin⟩ := h.exists_ear (Hv := H.V) (Hs := H.E) + hF.sub.2 hne + (fun e he v hv => by + have hm : v ∈ closure e ∩ J.V := ⟨mem_closure_of_inc hv, hv.vertex_mem⟩ + rw [← hF.sub.closure_inter_V he] at hm + exact hm.2) + (fun v hv f hf hfn hif => by + obtain ⟨a, ha, b, hb, hab, ia, ib⟩ := hF.two_edges h hv + exact h.mem_V₀_of_three (hF.sub.2 ha) (hF.sub.2 hb) hf ia ib hif hab + (fun h' => hfn (h' ▸ ha)) (fun h' => hfn (h' ▸ hb))) + hg hgn + have hE' : ∀ e ∈ W.edges, e ∉ H.E := fun e he => + (cls_subset (G := J.toGraph) (B := H.V) (M := E(J.toGraph) \ H.E) ⟨hg, hgn⟩ (hE e he)).2 + obtain ⟨H', 𝓕', hF', hE''⟩ := hF.step hcl hxy hs hx hy hE' hin + obtain ⟨a, ha, -⟩ := exists_edge_at_start W hxy + have hsub : J.E \ H'.E ⊂ J.E \ H.E := by + rw [hE''] + refine ⟨fun p hp => ⟨hp.1, fun h' => hp.2 (Or.inl h')⟩, fun hc => ?_⟩ + have haJ : a ∈ J.E := by + have := (walkDrawing_isSubdrawing J W).2 (by rw [walkDrawing_E]; exact ha) + exact this + exact (hc ⟨haJ, hE' a ha⟩).2 (Or.inr ha) + have hfin : (J.E \ H.E).Finite := J.finite_edges.subset sdiff_subset + exact ih _ (hn ▸ Set.ncard_lt_ncard hsub hfin) H' 𝓕' hF' + (by rw [hE'']; exact hne.mono subset_union_left) rfl + obtain ⟨H, 𝓕, hF, hne⟩ := exists_base hS h + exact key _ H 𝓕 hF hne rfl + +/-- A closed disc with boundary in `U(J)` and interior disjoint from `U(J)` is a face. -/ +theorem IsFaceSys.eq_of_free (hS : IsClosedSurface S) {𝓕 : Set (Set S)} (hF : IsFaceSys J J 𝓕) + {D₀ : Set S} (hD₀ : IsClosedDisc D₀) (hbd : discBd D₀ ⊆ J.U) + (hfree : Disjoint (D₀ \ discBd D₀) J.U) : D₀ ∈ 𝓕 := by + have hnonempty : (D₀ \ discBd D₀).Nonempty := by + by_contra hemp + have hsub : D₀ ⊆ closure (D₀ \ frontier D₀) := IsClosedDisc.subset_closure_diff_frontier hS hD₀ + rw [IsClosedDisc.frontier_eq_discBd hS hD₀, Set.not_nonempty_iff_eq_empty.mp hemp, + closure_empty] at hsub + obtain ⟨f⟩ := hD₀ + exact hsub (f ⟨0, by simp [ClosedUnitDisc]⟩).2 + obtain ⟨p, hpD, hpb⟩ := hnonempty + have hpc : p ∈ ⋃₀ 𝓕 := by rw [hF.cover]; exact mem_univ p + obtain ⟨D, hD, hpD'⟩ := hpc + have hDd := hF.disc D hD + have hpU : p ∉ J.U := fun h' => Set.disjoint_left.mp hfree ⟨hpD, hpb⟩ h' + obtain ⟨C, -, hCs, hCU⟩ := hF.circuit D hD + have hbdJ : discBd D ⊆ J.U := by rw [← hCU]; exact hCs.U_subset + have hc₁ : IsPreconnected (D₀ \ discBd D₀) := by + have := IsClosedDisc.isPreconnected_diff_frontier hS hD₀ + rwa [IsClosedDisc.frontier_eq_discBd hS hD₀] at this + have hc₂ : IsPreconnected (D \ discBd D) := by + have := IsClosedDisc.isPreconnected_diff_frontier hS hDd + rwa [IsClosedDisc.frontier_eq_discBd hS hDd] at this + have h₁ : D₀ \ discBd D₀ ⊆ D \ discBd D := by + have hdisj : Disjoint (D₀ \ discBd D₀) (frontier D) := by + rw [IsClosedDisc.frontier_eq_discBd hS hDd] + exact Set.disjoint_of_subset_right hbdJ hfree + rcases subset_or_disjoint_of_frontier hDd.isClosed hc₁ hdisj with h' | h' + · exact fun q hq => ⟨h' hq, fun hb => Set.disjoint_left.mp hfree hq (hbdJ hb)⟩ + · exact (Set.disjoint_left.mp h' ⟨hpD, hpb⟩ hpD').elim + have hpi : p ∈ D \ discBd D := h₁ ⟨hpD, hpb⟩ + have h₂ : D \ discBd D ⊆ D₀ \ discBd D₀ := by + have hdisj : Disjoint (D \ discBd D) (frontier D₀) := by + rw [IsClosedDisc.frontier_eq_discBd hS hD₀] + exact Set.disjoint_of_subset_right hbd (hF.free D hD) + rcases subset_or_disjoint_of_frontier hD₀.isClosed hc₂ hdisj with h' | h' + · exact fun q hq => ⟨h' hq, fun hb => Set.disjoint_left.mp (hF.free D hD) hq (hbd hb)⟩ + · exact (Set.disjoint_left.mp h' hpi hpD).elim + have heq : D₀ \ discBd D₀ = D \ discBd D := Subset.antisymm h₁ h₂ + have hclo : ∀ {X : Set S}, IsClosedDisc X → closure (X \ discBd X) = X := by + intro X hX + refine Subset.antisymm (closure_minimal sdiff_subset hX.isClosed) ?_ + have := IsClosedDisc.subset_closure_diff_frontier hS hX + rwa [IsClosedDisc.frontier_eq_discBd hS hX] at this + have : D₀ = D := by rw [← hclo hD₀, heq, hclo hDd] + exact this ▸ hD + +end FaceSystem + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM14/WhitneyGraph.lean b/LeanPool/GraphMinor/GM14/WhitneyGraph.lean new file mode 100644 index 0000000000..b3417b87c5 --- /dev/null +++ b/LeanPool/GraphMinor/GM14/WhitneyGraph.lean @@ -0,0 +1,1323 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Separations of a subdivision of a 3-connected graph + +This file is the graph part of the proof of Whitney's theorem. Let `G` be a subdivision of a simple +3-connected graph `G₀`. Think of the edges of `G` as cut into two sets `A` and `E(G) \ A`, and let +`bdry G A` be the set of vertices that meet both sets. We show that if `bdry G A` lies in `V(G₀)` +and is not empty of edges on either side, then it has at least two vertices, and if it has exactly +two then one side is one of the paths that replace an edge of `G₀`. + +Such facts need the vertices of `V(G₀)`. So we also show that a vertex that meets three edges of `G` +is in `V(G₀)`, and that each vertex meets at least two edges. +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Graph GraphMinor.GM09 GraphMinor.Surface + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## 1. Simple walks -/ + +section Walks + +variable {P : Graph α β} + +/-- An end of an edge of a walk is on the walk. -/ +theorem inc_mem_support {a b : α} (W : GraphWalk P a b) {e : β} {x : α} (he : e ∈ W.edges) + (hx : P.Inc e x) : x ∈ W.support := by + induction W with + | nil _ => simp [GraphWalk.edges] at he + | @cons u v w f hlink rest ih => + simp only [GraphWalk.edges, List.mem_cons] at he + simp only [GraphWalk.support, List.mem_cons] + rcases he with rfl | he + · obtain ⟨y, hy⟩ := hx + rcases P.eq_or_eq_of_isLink_of_isLink hy hlink with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rest.start_mem_support + · exact Or.inr (ih he) + +/-- At most one edge of a simple walk meets its first vertex. -/ +theorem eq_of_inc_start {a b : α} (W : GraphWalk P a b) (hW : W.IsSimple) {e f : β} + (he : e ∈ W.edges) (hf : f ∈ W.edges) (hea : P.Inc e a) (hfa : P.Inc f a) : e = f := by + cases W with + | nil _ => simp [GraphWalk.edges] at he + | @cons _ v _ g hlink rest => + have hnd : a ∉ rest.support := (List.nodup_cons.mp hW).1 + simp only [GraphWalk.edges, List.mem_cons] at he hf + rcases he with rfl | he + · rcases hf with rfl | hf + · rfl + · exact (hnd (inc_mem_support rest hf hfa)).elim + · exact (hnd (inc_mem_support rest he hea)).elim + +/-- A simple walk has no three distinct edges at one vertex. -/ +theorem not_three_edges {a b : α} (W : GraphWalk P a b) (hW : W.IsSimple) {x : α} {e₁ e₂ e₃ : β} + (h₁ : e₁ ∈ W.edges) (h₂ : e₂ ∈ W.edges) (h₃ : e₃ ∈ W.edges) (hx₁ : P.Inc e₁ x) + (hx₂ : P.Inc e₂ x) (hx₃ : P.Inc e₃ x) (h12 : e₁ ≠ e₂) (h13 : e₁ ≠ e₃) (h23 : e₂ ≠ e₃) : + False := by + induction W with + | nil _ => simp [GraphWalk.edges] at h₁ + | @cons u v w g hlink rest ih => + have hs : rest.IsSimple := (List.nodup_cons.mp hW).2 + by_cases hxu : x = u + · subst hxu + exact h12 (eq_of_inc_start _ hW h₁ h₂ hx₁ hx₂) + have hrest : ∀ {e : β}, e ∈ (GraphWalk.cons hlink rest).edges → P.Inc e x → e ≠ g → + e ∈ rest.edges := by + intro e he _ hne + simp only [GraphWalk.edges, List.mem_cons] at he + exact he.resolve_left hne + have hgv : e₁ = g ∨ e₂ = g ∨ e₃ = g → x = v := by + intro hg + have hinc : P.Inc g x := by + rcases hg with rfl | rfl | rfl <;> assumption + obtain ⟨y, hy⟩ := hinc + rcases P.eq_or_eq_of_isLink_of_isLink hy hlink with h | h + · exact (hxu h).elim + · exact h + by_cases hg₁ : e₁ = g + · have hv := hgv (Or.inl hg₁) + subst hv + exact h23 (eq_of_inc_start rest hs (hrest h₂ hx₂ (hg₁ ▸ h12.symm)) + (hrest h₃ hx₃ (hg₁ ▸ h13.symm)) hx₂ hx₃) + by_cases hg₂ : e₂ = g + · have hv := hgv (Or.inr (Or.inl hg₂)) + subst hv + exact h13 (eq_of_inc_start rest hs (hrest h₁ hx₁ hg₁) + (hrest h₃ hx₃ (hg₂ ▸ h23.symm)) hx₁ hx₃) + by_cases hg₃ : e₃ = g + · have hv := hgv (Or.inr (Or.inr hg₃)) + subst hv + exact h12 (eq_of_inc_start rest hs (hrest h₁ hx₁ hg₁) (hrest h₂ hx₂ hg₂) hx₁ hx₂) + exact ih hs (hrest h₁ hx₁ hg₁) (hrest h₂ hx₂ hg₂) (hrest h₃ hx₃ hg₃) + +/-- A walk between two distinct vertices has an edge at its first vertex. -/ +theorem exists_edge_at_start {a b : α} (W : GraphWalk P a b) (hab : a ≠ b) : + ∃ e ∈ W.edges, P.Inc e a := by + cases W with + | nil _ => exact (hab rfl).elim + | @cons _ v _ g hlink rest => exact ⟨g, by simp [GraphWalk.edges], v, hlink⟩ + +/-- A simple walk has two distinct edges at each inner vertex. -/ +theorem exists_two_edges_at_inner {a b : α} (W : GraphWalk P a b) (hW : W.IsSimple) {x : α} + (hx : x ∈ W.support) (hxa : x ≠ a) (hxb : x ≠ b) : + ∃ e ∈ W.edges, ∃ f ∈ W.edges, e ≠ f ∧ P.Inc e x ∧ P.Inc f x := by + induction W with + | nil _ => exact (hxa (by simpa [GraphWalk.support] using hx)).elim + | @cons u v w g hlink rest ih => + have hs : rest.IsSimple := (List.nodup_cons.mp hW).2 + have hnd : u ∉ rest.support := (List.nodup_cons.mp hW).1 + have hxr : x ∈ rest.support := by + simp only [GraphWalk.support, List.mem_cons] at hx + exact hx.resolve_left hxa + by_cases hxv : x = v + · subst hxv + obtain ⟨f, hf, hfx⟩ := exists_edge_at_start rest hxb + refine ⟨g, by simp [GraphWalk.edges], f, by simp [GraphWalk.edges, hf], ?_, + ⟨u, hlink.symm⟩, hfx⟩ + rintro rfl + obtain ⟨y, hy⟩ := hfx + have huy := P.eq_or_eq_of_isLink_of_isLink hlink hy + rcases huy with rfl | rfl + · exact hxa rfl + · exact hnd (inc_mem_support rest hf ⟨x, hy.symm⟩) + · obtain ⟨e, he, f, hf, hne, h₁, h₂⟩ := ih hs hxr hxv hxb + exact ⟨e, by simp [GraphWalk.edges, he], f, by simp [GraphWalk.edges, hf], hne, h₁, h₂⟩ + +/-- If at each inner vertex of a simple walk the edges of the walk are on the same side of a set +`A`, then all edges of the walk are on the same side. -/ +theorem walk_pure {a b : α} (W : GraphWalk P a b) (hW : W.IsSimple) {A : Set β} + (hA : ∀ x ∈ W.support, x ≠ a → x ≠ b → ∀ e ∈ W.edges, ∀ f ∈ W.edges, P.Inc e x → P.Inc f x → + (e ∈ A ↔ f ∈ A)) : + ∀ e ∈ W.edges, ∀ f ∈ W.edges, e ∈ A ↔ f ∈ A := by + induction W with + | nil _ => intro e he; simp [GraphWalk.edges] at he + | @cons u v w g hlink rest ih => + have hs : rest.IsSimple := (List.nodup_cons.mp hW).2 + have hnd : u ∉ rest.support := (List.nodup_cons.mp hW).1 + have hsub : ∀ {e : β}, e ∈ rest.edges → e ∈ (GraphWalk.cons hlink rest).edges := fun h => by + simp [GraphWalk.edges, h] + have hir : ∀ e ∈ rest.edges, ∀ f ∈ rest.edges, e ∈ A ↔ f ∈ A := by + refine ih hs fun x hx hxv hxw e he f hf => ?_ + refine hA x (by simp [GraphWalk.support, hx]) ?_ hxw e (hsub he) f (hsub hf) + rintro rfl + exact hnd hx + have hgr : ∀ f ∈ rest.edges, g ∈ A ↔ f ∈ A := by + intro f hf + have hvw : v ≠ w := by + rintro rfl + have := GraphWalk.IsSimple.length_eq_zero hs + have hne : rest.edges ≠ [] := List.ne_nil_of_mem hf + exact hne (List.length_eq_zero_iff.mp this) + obtain ⟨f', hf', hinc⟩ := exists_edge_at_start rest hvw + have hvu : v ≠ u := by + rintro rfl + exact hnd rest.start_mem_support + have h₁ : g ∈ A ↔ f' ∈ A := + hA v (by simp [GraphWalk.support, rest.start_mem_support]) hvu hvw g + (by simp [GraphWalk.edges]) f' (hsub hf') ⟨u, hlink.symm⟩ hinc + exact h₁.trans (hir f' hf' f hf) + intro e he f hf + simp only [GraphWalk.edges, List.mem_cons] at he hf + rcases he with rfl | he <;> rcases hf with rfl | hf + · rfl + · exact hgr f hf + · exact (hgr e he).symm + · exact hir e he f hf + +end Walks + +/-! ## 2. Separations of the simple graph -/ + +section ThreeConnected + +variable {G₀ : Graph α β} + +/-- The form of 3-connectivity that we use: a separation given by sets. -/ +theorem IsSimpleThreeConnected.sep (hG : IsSimpleThreeConnectedGraph G₀) {Vx Vy : Set α} + {Ex Ey : Set β} (hV : Vx ∪ Vy = V(G₀)) (hE : Ex ∪ Ey = E(G₀)) (hd : Disjoint Ex Ey) + (hlx : ∀ e ∈ Ex, ∀ x y, G₀.IsLink e x y → x ∈ Vx ∧ y ∈ Vx) + (hly : ∀ e ∈ Ey, ∀ x y, G₀.IsLink e x y → x ∈ Vy ∧ y ∈ Vy) + (hc : (Vx ∩ Vy).ncard < 3) : Vx = V(G₀) ∨ Vy = V(G₀) := by + have hE' : ∀ {T Z : Set β} {W : Set α}, T ⊆ E(G₀) → + (∀ e ∈ T, ∀ x y, G₀.IsLink e x y → x ∈ W ∧ y ∈ W) → Z = T → + E((G₀.induce W).restrict Z) = T := by + intro T Z W hT hl hZ + subst hZ + rw [edgeSet_restrict, inter_eq_right] + intro e he + obtain ⟨x, y, hxy⟩ := G₀.exists_isLink_of_mem_edgeSet (hT he) + obtain ⟨h₁, h₂⟩ := hl e he x y hxy + exact ⟨x, y, hxy, h₁, h₂⟩ + have hsx : Vx ⊆ V(G₀) := hV ▸ subset_union_left + have hsy : Vy ⊆ V(G₀) := hV ▸ subset_union_right + have hTx : Ex ⊆ E(G₀) := hE ▸ subset_union_left + have hTy : Ey ⊆ E(G₀) := hE ▸ subset_union_right + have hex := hE' (Z := Ex) hTx hlx rfl + have hey := hE' (Z := Ey) hTy hly rfl + refine hG.2.2 ((G₀.induce Vx).restrict Ex) ((G₀.induce Vy).restrict Ey) ⟨?_, ?_, hV, ?_, ?_⟩ hc + · exact restrict_le.trans (induce_le hsx) + · exact restrict_le.trans (induce_le hsy) + · rw [hex, hey] + exact hE + · rw [hex, hey] + exact hd + +/-- Each vertex of a simple 3-connected graph meets at least three edges. -/ +theorem IsSimpleThreeConnected.exists_three_edges (hG : IsSimpleThreeConnectedGraph G₀) {v : α} + (hv : v ∈ V(G₀)) : + ∃ e f g, e ≠ f ∧ e ≠ g ∧ f ≠ g ∧ G₀.Inc e v ∧ G₀.Inc f v ∧ G₀.Inc g v := by + classical + by_contra hno + push Not at hno + have hcard4 := hG.2.1 + have hfin : V(G₀).Finite := by + by_contra hinf + rw [Set.Infinite.ncard hinf] at hcard4 + omega + let N : Set α := {w | ∃ e, G₀.IsLink e v w} + have hNfin : N.Finite := hfin.subset fun w ⟨e, he⟩ => he.right_mem + have hN : N.ncard ≤ 2 := by + by_contra hlt + obtain ⟨a, b, c, ⟨e₁, h₁⟩, ⟨e₂, h₂⟩, ⟨e₃, h₃⟩, hab, hac, hbc⟩ := + (Set.two_lt_ncard_iff hNfin).mp (by omega) + have hne : ∀ {e f x y}, G₀.IsLink e v x → G₀.IsLink f v y → x ≠ y → e ≠ f := by + rintro e f x y hx hy hxy rfl + apply hxy + rcases G₀.eq_or_eq_of_isLink_of_isLink hx.symm hy with h | h + · subst h + exact (hG.1.1 e hx.edge_mem x hx).elim + · exact h + exact hno e₁ e₂ e₃ (hne h₁ h₂ hab) (hne h₁ h₃ hac) (hne h₂ h₃ hbc) ⟨a, h₁⟩ ⟨b, h₂⟩ ⟨c, h₃⟩ + have hle3 : ({v} ∪ N).ncard ≤ 3 := + (Set.ncard_union_le _ _).trans (by rw [Set.ncard_singleton]; omega) + have hs := IsSimpleThreeConnected.sep hG (Vx := {v} ∪ N) (Vy := V(G₀) \ {v}) + (Ex := {e | G₀.Inc e v}) (Ey := E(G₀) \ {e | G₀.Inc e v}) ?_ ?_ disjoint_sdiff_right ?_ ?_ ?_ + · rcases hs with hs | hs + · rw [hs] at hle3 + omega + · have hvv : v ∈ V(G₀) \ {v} := by rw [hs]; exact hv + exact hvv.2 rfl + · ext y + constructor + · rintro ((hy | ⟨e, hy⟩) | hy) + · rw [mem_singleton_iff.mp hy] + exact hv + · exact hy.right_mem + · exact hy.1 + · intro hy + by_cases hyv : y = v + · exact Or.inl (Or.inl hyv) + · exact Or.inr ⟨hy, hyv⟩ + · ext e + constructor + · rintro (he | he) + · exact Graph.Inc.edge_mem he + · exact he.1 + · intro he + by_cases hev : G₀.Inc e v + · exact Or.inl hev + · exact Or.inr ⟨he, hev⟩ + · rintro e ⟨z, hz⟩ x y hxy + have hmem : ∀ t, t = v ∨ t = z → t ∈ ({v} ∪ N) := by + rintro t (rfl | rfl) + · exact Or.inl rfl + · exact Or.inr ⟨e, hz⟩ + exact ⟨hmem x (G₀.eq_or_eq_of_isLink_of_isLink hxy hz), + hmem y (G₀.eq_or_eq_of_isLink_of_isLink hxy.symm hz)⟩ + · rintro e he x y hxy + refine ⟨⟨hxy.left_mem, ?_⟩, ⟨hxy.right_mem, ?_⟩⟩ + · rintro rfl + exact he.2 ⟨y, hxy⟩ + · rintro rfl + exact he.2 ⟨x, hxy.symm⟩ + · have hsub : ({v} ∪ N) ∩ (V(G₀) \ {v}) ⊆ N := by + rintro y ⟨hy | hy, -, hyv⟩ + · exact (hyv hy).elim + · exact hy + have := Set.ncard_le_ncard hsub hNfin + omega + +/-- Each vertex of a simple 3-connected graph meets at least two edges. -/ +theorem IsSimpleThreeConnected.exists_two_edges (hG : IsSimpleThreeConnectedGraph G₀) {v : α} + (hv : v ∈ V(G₀)) : ∃ e f, e ≠ f ∧ G₀.Inc e v ∧ G₀.Inc f v := by + classical + by_contra hno + push Not at hno + have huniq : ∀ e f, G₀.Inc e v → G₀.Inc f v → e = f := by + intro e f he hf + by_contra hne + exact hno e f hne he hf + let Vx : Set α := {v} ∪ {w | ∃ e, G₀.IsLink e v w} + have hVx : ∃ w, Vx ⊆ {v, w} := by + by_cases hex : ∃ e w, G₀.IsLink e v w + · obtain ⟨e, w, hw⟩ := hex + refine ⟨w, ?_⟩ + rintro y (rfl | ⟨e', hy⟩) + · exact Or.inl rfl + · have hee : e' = e := huniq _ _ ⟨y, hy⟩ ⟨w, hw⟩ + subst hee + rcases G₀.eq_or_eq_of_isLink_of_isLink hy.symm hw with h | h + · exact Or.inl h + · exact Or.inr h + · refine ⟨v, ?_⟩ + rintro y (rfl | ⟨e', hy⟩) + · exact Or.inl rfl + · exact (hex ⟨e', y, hy⟩).elim + obtain ⟨w, hw⟩ := hVx + have hcard4 := hG.2.1 + have hfin : V(G₀).Finite := by + by_contra hinf + rw [Set.Infinite.ncard hinf] at hcard4 + omega + have hle2 : Vx.ncard ≤ 2 := + (Set.ncard_le_ncard hw (Set.toFinite _)).trans (Set.ncard_insert_le v {w} |>.trans (by simp)) + have hs := IsSimpleThreeConnected.sep hG (Vx := Vx) (Vy := V(G₀) \ {v}) + (Ex := {e | G₀.Inc e v}) (Ey := E(G₀) \ {e | G₀.Inc e v}) ?_ ?_ disjoint_sdiff_right ?_ ?_ ?_ + · rcases hs with hs | hs + · rw [hs] at hle2 + omega + · have hvv : v ∈ V(G₀) \ {v} := by rw [hs]; exact hv + exact hvv.2 rfl + · ext y + constructor + · rintro ((hy | ⟨e, hy⟩) | hy) + · rw [mem_singleton_iff.mp hy] + exact hv + · exact hy.right_mem + · exact hy.1 + · intro hy + by_cases hyv : y = v + · exact Or.inl (Or.inl hyv) + · exact Or.inr ⟨hy, hyv⟩ + · ext e + constructor + · rintro (he | he) + · exact Graph.Inc.edge_mem he + · exact he.1 + · intro he + by_cases hev : G₀.Inc e v + · exact Or.inl hev + · exact Or.inr ⟨he, hev⟩ + · rintro e ⟨z, hz⟩ x y hxy + have hmem : ∀ t, t = v ∨ t = z → t ∈ Vx := by + rintro t (rfl | rfl) + · exact Or.inl rfl + · exact Or.inr ⟨e, hz⟩ + exact ⟨hmem x (G₀.eq_or_eq_of_isLink_of_isLink hxy hz), + hmem y (G₀.eq_or_eq_of_isLink_of_isLink hxy.symm hz)⟩ + · rintro e he x y hxy + refine ⟨⟨hxy.left_mem, ?_⟩, ⟨hxy.right_mem, ?_⟩⟩ + · rintro rfl + exact he.2 ⟨y, hxy⟩ + · rintro rfl + exact he.2 ⟨x, hxy.symm⟩ + · have hsub : Vx ∩ (V(G₀) \ {v}) ⊆ {w} := by + rintro y ⟨hy, -, hyv⟩ + rcases hw hy with h | h + · exact (hyv h).elim + · exact h + have := Set.ncard_le_ncard hsub (Set.toFinite _) + rw [Set.ncard_singleton] at this + omega + +end ThreeConnected + +/-! ## 3. Subdivisions -/ + +/-- The set of vertices that meet an edge of `A`. -/ +def verts (G : Graph α β) (A : Set β) : Set α := {v | ∃ e ∈ A, G.Inc e v} + +/-- The vertices that meet an edge of `A` and an edge of `G` outside `A`. -/ +def bdry (G : Graph α β) (A : Set β) : Set α := verts G A ∩ verts G (E(G) \ A) + +theorem bdry_compl {G : Graph α β} {A : Set β} (hA : A ⊆ E(G)) : + bdry G (E(G) \ A) = bdry G A := by + unfold bdry + rw [sdiff_sdiff_eq_self hA, inter_comm] + +/-- The data of a subdivision, as a structure. -/ +structure SubData (G G₀ : Graph α β) (P : β → Graph α β) : Prop where + simple : IsSimpleThreeConnectedGraph G₀ + sub : V(G₀) ⊆ V(G) + path : ∀ e ∈ E(G₀), ∃ u v : α, G₀.IsLink e u v ∧ IsGraphPathWithEnds G (P e) u v ∧ + E(P e).Nonempty ∧ V(P e) ∩ V(G₀) = {u, v} + disj : ∀ e₁ ∈ E(G₀), ∀ e₂ ∈ E(G₀), e₁ ≠ e₂ → + Disjoint E(P e₁) E(P e₂) ∧ V(P e₁) ∩ V(P e₂) ⊆ V(G₀) + vunion : V(G) = V(G₀) ∪ (⋃ e ∈ E(G₀), V(P e)) + eunion : E(G) = ⋃ e ∈ E(G₀), E(P e) + +theorem exists_subData {G : Graph α β} (h : IsSubdivisionOfSimpleThreeConnected G) : + ∃ G₀ P, SubData G G₀ P := by + obtain ⟨G₀, hs, hsub, P, h₁, h₂, h₃, h₄⟩ := h + exact ⟨G₀, P, hs, hsub, h₁, h₂, h₃, h₄⟩ + +namespace SubData + +variable {G G₀ : Graph α β} {P : β → Graph α β} (h : SubData G G₀ P) +include h + +theorem ne_of_link {e : β} {u v : α} (hl : G₀.IsLink e u v) : u ≠ v := by + rintro rfl + exact h.simple.1.1 e hl.edge_mem u hl + +theorem finite_V₀ : V(G₀).Finite := by + by_contra hinf + have := h.simple.2.1 + rw [Set.Infinite.ncard hinf] at this + omega + +/-- An inner vertex of a path is not in `V(G₀)`, so the edges of the path are on one side of any +set whose boundary lies in `V(G₀)`. -/ +theorem pure {e : β} (he : e ∈ E(G₀)) {A : Set β} (hbd : bdry G A ⊆ V(G₀)) : + E(P e) ⊆ A ∨ Disjoint E(P e) A := by + obtain ⟨u, v, -, ⟨hle, W, hs, hV, hE⟩, -, hcap⟩ := h.path e he + have hall : ∀ e' ∈ W.edges, ∀ f' ∈ W.edges, e' ∈ A ↔ f' ∈ A := by + refine walk_pure W hs fun x hx hxu hxv e' he' f' hf' hi hi' => ?_ + have hxV : x ∉ V(G₀) := by + intro hx₀ + have hm : x ∈ V(P e) ∩ V(G₀) := ⟨hV ▸ hx, hx₀⟩ + rw [hcap] at hm + rcases hm with hm | hm + · exact hxu hm + · exact hxv hm + have hmemE : ∀ {g}, g ∈ W.edges → g ∈ E(G) := fun {g} hg => by + have : g ∈ E(P e) := by rw [hE]; exact hg + exact hle.edgeSet_mono this + have hincG : ∀ {g}, P e |>.Inc g x → G.Inc g x := fun ⟨y, hy⟩ => ⟨y, hy.mono hle⟩ + constructor + · intro h₁ + by_contra h₂ + exact hxV (hbd ⟨⟨e', h₁, hincG hi⟩, f', ⟨hmemE hf', h₂⟩, hincG hi'⟩) + · intro h₁ + by_contra h₂ + exact hxV (hbd ⟨⟨f', h₁, hincG hi'⟩, e', ⟨hmemE he', h₂⟩, hincG hi⟩) + by_cases hex : ∃ e' ∈ W.edges, e' ∈ A + · obtain ⟨e', he', hA⟩ := hex + left + intro f hf + rw [hE] at hf + exact (hall e' he' f hf).mp hA + · right + rw [Set.disjoint_left] + intro f hf hA + rw [hE] at hf + exact hex ⟨f, hf, hA⟩ + +/-- A path has an edge at each of its two ends. -/ +theorem exists_edge_at_ends {e : β} {u v : α} (hl : G₀.IsLink e u v) : + (∃ g ∈ E(P e), G.Inc g u) ∧ ∃ g ∈ E(P e), G.Inc g v := by + obtain ⟨u', v', hl', ⟨hle, W, hs, -, hE⟩, -, -⟩ := h.path e hl.edge_mem + have huv := h.ne_of_link hl' + obtain ⟨g₁, hg₁, y₁, hy₁⟩ := exists_edge_at_start W huv + obtain ⟨g₂, hg₂, y₂, hy₂⟩ := exists_edge_at_start W.reverse huv.symm + have hg₂' : g₂ ∈ W.edges := by + rw [GraphWalk.edges_reverse] at hg₂ + exact List.mem_reverse.mp hg₂ + have hm₁ : g₁ ∈ E(P e) := by rw [hE]; exact hg₁ + have hm₂ : g₂ ∈ E(P e) := by rw [hE]; exact hg₂' + have hu : (∃ g ∈ E(P e), G.Inc g u') ∧ ∃ g ∈ E(P e), G.Inc g v' := + ⟨⟨g₁, hm₁, y₁, hy₁.mono hle⟩, ⟨g₂, hm₂, y₂, hy₂.mono hle⟩⟩ + have hc : (u = u' ∧ v = v') ∨ (u = v' ∧ v = u') := by + rcases G₀.eq_or_eq_of_isLink_of_isLink hl hl' with rfl | rfl + · left + refine ⟨rfl, ?_⟩ + rcases G₀.eq_or_eq_of_isLink_of_isLink hl.symm hl' with h' | h' + · exact (h.ne_of_link hl h'.symm).elim + · exact h' + · right + refine ⟨rfl, ?_⟩ + rcases G₀.eq_or_eq_of_isLink_of_isLink hl.symm hl' with h' | h' + · exact h' + · exact (h.ne_of_link hl h'.symm).elim + rcases hc with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hu + · exact ⟨hu.2, hu.1⟩ + +/-- A vertex of `V(G₀)` meets two paths. -/ +theorem exists_other_edge {e : β} {u v : α} (hl : G₀.IsLink e u v) : + ∃ g, g ∈ E(G) ∧ g ∉ E(P e) ∧ G.Inc g u := by + obtain ⟨e₁, e₂, hne, h₁, h₂⟩ := IsSimpleThreeConnected.exists_two_edges h.simple hl.left_mem + have hkey : ∀ {f : β}, f ≠ e → G₀.Inc f u → ∃ g, g ∈ E(G) ∧ g ∉ E(P e) ∧ G.Inc g u := by + rintro f hfe ⟨w, hw⟩ + obtain ⟨g, hg, hinc⟩ := (h.exists_edge_at_ends hw).1 + refine ⟨g, ?_, ?_, hinc⟩ + · rw [h.eunion] + exact mem_iUnion₂.mpr ⟨f, hw.edge_mem, hg⟩ + · intro hg' + exact Set.disjoint_left.mp (h.disj f hw.edge_mem e hl.edge_mem hfe).1 hg hg' + by_cases he₁ : e₁ = e + · exact hkey (fun h' => hne (he₁.trans h'.symm)) h₂ + · exact hkey he₁ h₁ + +/-- The ends of a path are on the boundary of its edge set. -/ +theorem ends_mem_bdry {e : β} {u v : α} (hl : G₀.IsLink e u v) : + u ∈ bdry G E(P e) ∧ v ∈ bdry G E(P e) := by + obtain ⟨⟨g₁, hg₁, hi₁⟩, g₂, hg₂, hi₂⟩ := h.exists_edge_at_ends hl + obtain ⟨f₁, hf₁, hn₁, hj₁⟩ := h.exists_other_edge hl + obtain ⟨f₂, hf₂, hn₂, hj₂⟩ := h.exists_other_edge hl.symm + exact ⟨⟨⟨g₁, hg₁, hi₁⟩, f₁, ⟨hf₁, hn₁⟩, hj₁⟩, ⟨g₂, hg₂, hi₂⟩, f₂, ⟨hf₂, hn₂⟩, hj₂⟩ + +/-- One half of `sep`: if the vertices of the side outside `A` are all on the boundary, then that +side is one path. -/ +theorem sep_aux {A : Set β} (hbd : bdry G A ⊆ V(G₀)) (hc : (bdry G A).ncard ≤ 2) + (hne : (E(G) \ A).Nonempty) (hV : V(G₀) ⊆ bdry G A ∪ (V(G₀) ∩ verts G A)) : + ∃ e ∈ E(G₀), E(G) \ A = E(P e) := by + have hEdge : ∀ f ∈ E(G) \ A, ∃ e ∈ E(G₀), ∃ u v, G₀.IsLink e u v ∧ f ∈ E(P e) ∧ + Disjoint E(P e) A ∧ u ∈ bdry G A ∧ v ∈ bdry G A := by + intro f hf + have hf' := hf.1 + rw [h.eunion] at hf' + obtain ⟨e, he, hfe⟩ := mem_iUnion₂.mp hf' + obtain ⟨u, v, hl, -, -, -⟩ := h.path e he + have hd : Disjoint E(P e) A := by + rcases h.pure he hbd with h' | h' + · exact (hf.2 (h' hfe)).elim + · exact h' + have hmem : ∀ {x y}, G₀.IsLink e x y → x ∈ bdry G A := by + intro x y hxy + obtain ⟨g, hg, hinc⟩ := (h.exists_edge_at_ends hxy).1 + have hgE : g ∈ E(G) := by + rw [h.eunion] + exact mem_iUnion₂.mpr ⟨e, he, hg⟩ + have hgA : g ∉ A := Set.disjoint_left.mp hd hg + rcases hV hxy.left_mem with hb | ⟨-, hv⟩ + · exact hb + · exact ⟨hv, g, ⟨hgE, hgA⟩, hinc⟩ + exact ⟨e, he, u, v, hl, hfe, hd, hmem hl, hmem hl.symm⟩ + obtain ⟨f, hf⟩ := hne + obtain ⟨e, he, u, v, hl, hfe, hd, hu, hv⟩ := hEdge f hf + refine ⟨e, he, Subset.antisymm ?_ ?_⟩ + · intro f' hf' + obtain ⟨e', he', u', v', hl', hfe', -, hu', hv'⟩ := hEdge f' hf' + have huv := h.ne_of_link hl + have hfin : (bdry G A).Finite := h.finite_V₀.subset hbd + have heqb : bdry G A = {u, v} := by + symm + refine Set.eq_of_subset_of_ncard_le ?_ ?_ hfin + · rintro x (rfl | rfl) + · exact hu + · exact hv + · rw [Set.ncard_pair huv] + exact hc + rw [heqb] at hu' hv' + have huv' := h.ne_of_link hl' + have hee : e' = e := by + rcases hu' with rfl | rfl <;> rcases hv' with rfl | rfl + · exact (huv' rfl).elim + · exact h.simple.1.2 e' hl'.edge_mem e hl.edge_mem _ _ hl' hl + · exact h.simple.1.2 e' hl'.edge_mem e hl.edge_mem _ _ hl' hl.symm + · exact (huv' rfl).elim + exact hee ▸ hfe' + · intro g hg + have hgE : g ∈ E(G) := by + rw [h.eunion] + exact mem_iUnion₂.mpr ⟨e, he, hg⟩ + exact ⟨hgE, Set.disjoint_left.mp hd hg⟩ + +/-- A separation of `G` of order at most two at vertices of `V(G₀)` has a path as one side. -/ +theorem sep {A : Set β} (hA : A ⊆ E(G)) (hbd : bdry G A ⊆ V(G₀)) (hc : (bdry G A).ncard ≤ 2) + (hne : A.Nonempty) (hne' : (E(G) \ A).Nonempty) : + ∃ e ∈ E(G₀), A = E(P e) ∨ E(G) \ A = E(P e) := by + have hat : ∀ {x}, x ∈ V(G₀) → x ∈ verts G A ∨ x ∈ verts G (E(G) \ A) := by + intro x hx + obtain ⟨e, -, -, ⟨y, hy⟩, -⟩ := IsSimpleThreeConnected.exists_two_edges h.simple hx + obtain ⟨g, hg, hinc⟩ := (h.exists_edge_at_ends hy).1 + have hgE : g ∈ E(G) := by + rw [h.eunion] + exact mem_iUnion₂.mpr ⟨e, hy.edge_mem, hg⟩ + by_cases hgA : g ∈ A + · exact Or.inl ⟨g, hgA, hinc⟩ + · exact Or.inr ⟨g, ⟨hgE, hgA⟩, hinc⟩ + let Vx : Set α := bdry G A ∪ (V(G₀) ∩ verts G A) + let Vy : Set α := bdry G A ∪ (V(G₀) ∩ verts G (E(G) \ A)) + have hVx : ∀ {e u v}, G₀.IsLink e u v → E(P e) ⊆ A → u ∈ Vx := by + intro e u v hl hs + obtain ⟨g, hg, hinc⟩ := (h.exists_edge_at_ends hl).1 + exact Or.inr ⟨hl.left_mem, g, hs hg, hinc⟩ + have hVy : ∀ {e u v}, G₀.IsLink e u v → Disjoint E(P e) A → u ∈ Vy := by + intro e u v hl hs + obtain ⟨g, hg, hinc⟩ := (h.exists_edge_at_ends hl).1 + have hgE : g ∈ E(G) := by + rw [h.eunion] + exact mem_iUnion₂.mpr ⟨e, hl.edge_mem, hg⟩ + exact Or.inr ⟨hl.left_mem, g, ⟨hgE, Set.disjoint_left.mp hs hg⟩, hinc⟩ + have hs := IsSimpleThreeConnected.sep h.simple (Vx := Vx) (Vy := Vy) (Ex + := {e ∈ E(G₀) | E(P e) ⊆ A}) + (Ey := {e ∈ E(G₀) | Disjoint E(P e) A}) ?_ ?_ ?_ ?_ ?_ ?_ + · rcases hs with hs | hs + · obtain ⟨e, he, heq⟩ := h.sep_aux hbd hc hne' hs.symm.subset + exact ⟨e, he, Or.inr heq⟩ + · have hbd' : bdry G (E(G) \ A) ⊆ V(G₀) := by rwa [bdry_compl hA] + have hc' : (bdry G (E(G) \ A)).ncard ≤ 2 := by rwa [bdry_compl hA] + have hne'' : (E(G) \ (E(G) \ A)).Nonempty := by rwa [sdiff_sdiff_eq_self hA] + obtain ⟨e, he, heq⟩ := h.sep_aux hbd' hc' hne'' (by + rw [bdry_compl hA] + exact hs.symm.subset) + rw [sdiff_sdiff_eq_self hA] at heq + exact ⟨e, he, Or.inl heq⟩ + · ext x + constructor + · rintro ((hx | hx) | (hx | hx)) + · exact hbd hx + · exact hx.1 + · exact hbd hx + · exact hx.1 + · intro hx + rcases hat hx with hv | hv + · exact Or.inl (Or.inr ⟨hx, hv⟩) + · exact Or.inr (Or.inr ⟨hx, hv⟩) + · ext e + constructor + · rintro (he | he) <;> exact he.1 + · intro he + rcases h.pure he hbd with hp | hp + · exact Or.inl ⟨he, hp⟩ + · exact Or.inr ⟨he, hp⟩ + · rw [Set.disjoint_left] + rintro e ⟨he, h₁⟩ ⟨-, h₂⟩ + obtain ⟨u, v, -, -, ⟨g, hg⟩, -⟩ := h.path e he + exact Set.disjoint_left.mp h₂ hg (h₁ hg) + · rintro e ⟨-, hs⟩ x y hxy + exact ⟨hVx hxy hs, hVx hxy.symm hs⟩ + · rintro e ⟨-, hs⟩ x y hxy + exact ⟨hVy hxy hs, hVy hxy.symm hs⟩ + · have hsub : Vx ∩ Vy ⊆ bdry G A := by + rintro x ⟨hx | ⟨-, hx⟩, hy | ⟨-, hy⟩⟩ + · exact hx + · exact hx + · exact hy + · exact ⟨hx, hy⟩ + have := Set.ncard_le_ncard hsub (h.finite_V₀.subset hbd) + omega + +/-- A cut with at most one vertex, at a vertex of `V(G₀)`, does not exist: such a boundary has at +least two vertices. -/ +theorem two_le_bdry {A : Set β} (hA : A ⊆ E(G)) (hbd : bdry G A ⊆ V(G₀)) (hne : A.Nonempty) + (hne' : (E(G) \ A).Nonempty) : 2 ≤ (bdry G A).ncard := by + by_contra hlt + push Not at hlt + obtain ⟨e, he, heq | heq⟩ := h.sep hA hbd (by omega) hne hne' + · obtain ⟨u, v, hl, -⟩ := h.path e he + obtain ⟨hu, hv⟩ := h.ends_mem_bdry hl + rw [← heq] at hu hv + have huv := h.ne_of_link hl + have hsub : ({u, v} : Set α) ⊆ bdry G A := by + rintro x (rfl | rfl) + · exact hu + · exact hv + have := Set.ncard_le_ncard hsub (h.finite_V₀.subset hbd) + rw [Set.ncard_pair huv] at this + omega + · obtain ⟨u, v, hl, -⟩ := h.path e he + obtain ⟨hu, hv⟩ := h.ends_mem_bdry hl + rw [← heq, bdry_compl hA] at hu hv + have huv := h.ne_of_link hl + have hsub : ({u, v} : Set α) ⊆ bdry G A := by + rintro x (rfl | rfl) + · exact hu + · exact hv + have := Set.ncard_le_ncard hsub (h.finite_V₀.subset hbd) + rw [Set.ncard_pair huv] at this + omega + +omit h in +/-- An edge of a path of `G` at a vertex gives a link in the path. -/ +theorem inc_path {e g : β} {x : α} (hle : P e ≤ G) (hg : g ∈ E(P e)) (hx : G.Inc g x) : + (P e).Inc g x := by + obtain ⟨y, hy⟩ := hx + exact ⟨y, (hle.isLink_iff hg).mpr hy⟩ + +/-- Two edges of one path `P e` at a vertex of `V(G₀)` are equal. -/ +theorem eq_of_end {e a b : β} {x : α} (he : e ∈ E(G₀)) (hx : x ∈ V(G₀)) (ha : a ∈ E(P e)) + (hb : b ∈ E(P e)) (hax : G.Inc a x) (hbx : G.Inc b x) : a = b := by + obtain ⟨u, v, -, ⟨hle, W, hs, hV, hE⟩, -, hcap⟩ := h.path e he + have hia := SubData.inc_path hle ha hax + have hib := SubData.inc_path hle hb hbx + have hmem : x ∈ V(P e) ∩ V(G₀) := ⟨hia.vertex_mem, hx⟩ + rw [hcap] at hmem + have ha' : a ∈ W.edges := by rw [hE] at ha; exact ha + have hb' : b ∈ W.edges := by rw [hE] at hb; exact hb + rcases hmem with rfl | hmem + · exact eq_of_inc_start W hs ha' hb' hia hib + · obtain rfl : x = v := hmem + refine eq_of_inc_start W.reverse hs.reverse ?_ ?_ hia hib + · rw [GraphWalk.edges_reverse, List.mem_reverse]; exact ha' + · rw [GraphWalk.edges_reverse, List.mem_reverse]; exact hb' + +/-- A vertex that meets three edges of `G` is in `V(G₀)`. -/ +theorem mem_V₀_of_three {x : α} {e₁ e₂ e₃ : β} (h₁ : e₁ ∈ E(G)) (h₂ : e₂ ∈ E(G)) (h₃ : e₃ ∈ E(G)) + (hx₁ : G.Inc e₁ x) (hx₂ : G.Inc e₂ x) (hx₃ : G.Inc e₃ x) (h12 : e₁ ≠ e₂) (h13 : e₁ ≠ e₃) + (h23 : e₂ ≠ e₃) : x ∈ V(G₀) := by + by_contra hx + have hfind : ∀ g, g ∈ E(G) → G.Inc g x → ∃ e ∈ E(G₀), g ∈ E(P e) ∧ x ∈ V(P e) := by + intro g hg hi + rw [h.eunion] at hg + obtain ⟨e, he, hge⟩ := mem_iUnion₂.mp hg + obtain ⟨u, v, -, hp, -, -⟩ := h.path e he + obtain ⟨y, hy⟩ := hi + exact ⟨e, he, hge, ((hp.le.isLink_iff hge).mpr hy).left_mem⟩ + obtain ⟨a₁, ha₁, hm₁, hv₁⟩ := hfind e₁ h₁ hx₁ + obtain ⟨a₂, ha₂, hm₂, hv₂⟩ := hfind e₂ h₂ hx₂ + obtain ⟨a₃, ha₃, hm₃, hv₃⟩ := hfind e₃ h₃ hx₃ + have hsame : ∀ {a b}, a ∈ E(G₀) → b ∈ E(G₀) → x ∈ V(P a) → x ∈ V(P b) → a = b := by + intro a b ha hb hxa hxb + by_contra hne + exact hx ((h.disj a ha b hb hne).2 ⟨hxa, hxb⟩) + obtain rfl := hsame ha₁ ha₂ hv₁ hv₂ + obtain rfl := hsame ha₁ ha₃ hv₁ hv₃ + obtain ⟨u, v, -, ⟨hle, W, hs, -, hE⟩, -, -⟩ := h.path a₁ ha₁ + rw [hE] at hm₁ hm₂ hm₃ + have hm₁' : e₁ ∈ E(P a₁) := by rw [hE]; exact hm₁ + have hm₂' : e₂ ∈ E(P a₁) := by rw [hE]; exact hm₂ + have hm₃' : e₃ ∈ E(P a₁) := by rw [hE]; exact hm₃ + exact not_three_edges W hs hm₁ hm₂ hm₃ (SubData.inc_path hle hm₁' hx₁) + (SubData.inc_path hle hm₂' hx₂) + (SubData.inc_path hle hm₃' hx₃) h12 h13 h23 + +/-- Each vertex of `G` meets at least two edges. -/ +theorem exists_two_edges {x : α} (hx : x ∈ V(G)) : + ∃ e ∈ E(G), ∃ f ∈ E(G), e ≠ f ∧ G.Inc e x ∧ G.Inc f x := by + by_cases hx₀ : x ∈ V(G₀) + · obtain ⟨e, -, -, ⟨y, hy⟩, -⟩ := IsSimpleThreeConnected.exists_two_edges h.simple hx₀ + obtain ⟨g, hg, hinc⟩ := (h.exists_edge_at_ends hy).1 + obtain ⟨f, hf, hn, hj⟩ := h.exists_other_edge hy + have hgE : g ∈ E(G) := by + rw [h.eunion] + exact mem_iUnion₂.mpr ⟨e, hy.edge_mem, hg⟩ + exact ⟨g, hgE, f, hf, fun heq => hn (heq ▸ hg), hinc, hj⟩ + · rw [h.vunion] at hx + rcases hx with hx | hx + · exact (hx₀ hx).elim + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + obtain ⟨u, v, -, ⟨hle, W, hs, hV, hE⟩, -, hcap⟩ := h.path e he + have hne : ∀ {t}, t ∈ ({u, v} : Set α) → x ≠ t := by + intro t ht hxt + rw [← hcap] at ht + exact hx₀ (hxt ▸ ht.2) + obtain ⟨a, ha, b, hb, hab, h₁, h₂⟩ := exists_two_edges_at_inner W hs + (by rw [hV] at hxe; exact hxe) (hne (Or.inl rfl)) (hne (Or.inr rfl)) + have hm : ∀ {g}, g ∈ W.edges → g ∈ E(G) := fun {g} hg => by + have : g ∈ E(P e) := by rw [hE]; exact hg + exact hle.edgeSet_mono this + obtain ⟨y₁, hy₁⟩ := h₁ + obtain ⟨y₂, hy₂⟩ := h₂ + exact ⟨a, hm ha, b, hm hb, hab, ⟨y₁, hy₁.mono hle⟩, ⟨y₂, hy₂.mono hle⟩⟩ + +end SubData + +/-! ## 4. Bridges -/ + +section Bridges + +variable {G : Graph α β} {B : Set α} {M : Set β} + +/-- Two edges of `M` that share a vertex outside `B`. -/ +def adj (G : Graph α β) (B : Set α) (M : Set β) (e f : β) : Prop := + e ∈ M ∧ f ∈ M ∧ ∃ w, w ∉ B ∧ G.Inc e w ∧ G.Inc f w + +/-- The bridge of `e`: the edges of `M` joined to `e` through vertices outside `B`. -/ +def cls (G : Graph α β) (B : Set α) (M : Set β) (e : β) : Set β := + {f | Relation.ReflTransGen (adj G B M) e f} + +theorem mem_cls_self {e : β} : e ∈ cls G B M e := Relation.ReflTransGen.refl + +theorem cls_step {e f g : β} (hf : f ∈ cls G B M e) (h : adj G B M f g) : g ∈ cls G B M e := + Relation.ReflTransGen.tail hf h + +theorem cls_subset {e : β} (he : e ∈ M) : cls G B M e ⊆ M := by + intro f hf + induction hf with + | refl => exact he + | tail _ h _ => exact h.2.1 + +theorem cls_symm {e f : β} (hf : f ∈ cls G B M e) : e ∈ cls G B M f := by + induction hf with + | refl => exact Relation.ReflTransGen.refl + | tail _ h ih => + obtain ⟨h₁, h₂, w, hw, i₁, i₂⟩ := h + exact Relation.ReflTransGen.head ⟨h₂, h₁, w, hw, i₂, i₁⟩ ih + +theorem cls_trans {e f g : β} (hf : f ∈ cls G B M e) (hg : g ∈ cls G B M f) : g ∈ cls G B M e := + Relation.ReflTransGen.trans hf hg + +/-- A bridge meets the rest of the graph only in `B`, if each edge outside `M` has its ends in +`B`. -/ +theorem bdry_cls {e : β} (he : e ∈ M) (hB : ∀ v, v ∉ B → ∀ h ∈ E(G), G.Inc h v → h ∈ M) : + bdry G (cls G B M e) ⊆ B := by + rintro v ⟨⟨f, hf, hv⟩, h, ⟨hE, hn⟩, hi⟩ + by_contra hvB + exact hn (cls_step hf ⟨cls_subset he hf, hB v hvB h hE hi, v, hvB, hv, hi⟩) + +/-- Walks inside a bridge. -/ +theorem exists_walk_in_cls {e f₀ : β} (_he : e ∈ M) (hf₀ : f₀ ∈ cls G B M e) {a m : α} + (hl : G.IsLink f₀ a m) {f : β} (hf : f ∈ cls G B M f₀) {p : α} (hp : G.Inc f p) : + ∃ W : GraphWalk G a p, (∀ g ∈ W.edges, g ∈ cls G B M e) ∧ + ∀ x ∈ W.support, x ∉ B ∨ x = a ∨ x = p := by + induction hf generalizing p with + | refl => + obtain ⟨y, hy⟩ := hp + rcases G.eq_or_eq_of_isLink_of_isLink hy hl with rfl | rfl + · refine ⟨.nil hl.left_mem, by simp [GraphWalk.edges], ?_⟩ + intro x hx + simp only [GraphWalk.support, List.mem_singleton] at hx + exact Or.inr (Or.inl hx) + · refine ⟨.cons hl (.nil hl.right_mem), ?_, ?_⟩ + · intro g hg + simp only [GraphWalk.edges, List.mem_cons, List.not_mem_nil, or_false] at hg + exact hg ▸ hf₀ + · intro x hx + simp only [GraphWalk.support, List.mem_cons, List.not_mem_nil, + or_false] at hx + rcases hx with rfl | rfl + · exact Or.inr (Or.inl rfl) + · exact Or.inr (Or.inr rfl) + | @tail f g hfr hadj ih => + have hgc : g ∈ cls G B M e := cls_trans hf₀ (Relation.ReflTransGen.tail hfr hadj) + obtain ⟨-, -, w, hw, hfw, hgw⟩ := hadj + obtain ⟨W, hE, hS⟩ := ih hfw + obtain ⟨y, hy⟩ := hp + obtain ⟨z, hz⟩ := hgw + rcases G.eq_or_eq_of_isLink_of_isLink hy hz with rfl | rfl + · refine ⟨W, hE, fun x hx => ?_⟩ + rcases hS x hx with h | h | h + · exact Or.inl h + · exact Or.inr (Or.inl h) + · exact Or.inl (h ▸ hw) + · refine ⟨W.append (.cons hz (.nil hz.right_mem)), ?_, ?_⟩ + · intro g' hg' + rw [GraphWalk.edges_append] at hg' + rcases List.mem_append.mp hg' with h | h + · exact hE g' h + · simp only [GraphWalk.edges, List.mem_cons, List.not_mem_nil, or_false] at h + exact h ▸ hgc + · intro x hx + rw [GraphWalk.mem_support_append] at hx + rcases hx with hx | hx + · rcases hS x hx with h | h | h + · exact Or.inl h + · exact Or.inr (Or.inl h) + · exact Or.inl (h ▸ hw) + · simp only [GraphWalk.support, List.mem_cons, List.not_mem_nil, + or_false] at hx + rcases hx with rfl | rfl + · exact Or.inl hw + · exact Or.inr (Or.inr rfl) + +end Bridges + +namespace SubData + +variable {G G₀ : Graph α β} {P : β → Graph α β} (h : SubData G G₀ P) +include h + +/-- An ear. Let `Hs` be a nonempty set of edges with its ends in `Hv`, and let `g` be another edge. +If the vertices of `Hv` that meet edges outside `Hs` are in `V(G₀)`, then the bridge of `g` has a +path between two distinct vertices of `Hv`, with no other vertex in `Hv`. -/ +theorem exists_ear {Hv : Set α} {Hs : Set β} (hHs : Hs ⊆ E(G)) (hne : Hs.Nonempty) + (hinc : ∀ e ∈ Hs, ∀ v, G.Inc e v → v ∈ Hv) + (hV₀ : ∀ v ∈ Hv, ∀ f ∈ E(G), f ∉ Hs → G.Inc f v → v ∈ V(G₀)) {g : β} (hg : g ∈ E(G)) + (hgH : g ∉ Hs) : + ∃ (x y : α) (W : GraphWalk G x y), x ≠ y ∧ W.IsSimple ∧ x ∈ Hv ∧ y ∈ Hv ∧ x ∈ V(G₀) ∧ + y ∈ V(G₀) ∧ (∀ e ∈ W.edges, e ∈ cls G Hv (E(G) \ Hs) g) ∧ + ∀ z ∈ W.support, z ∉ Hv ∨ z = x ∨ z = y := by + have hgM : g ∈ E(G) \ Hs := ⟨hg, hgH⟩ + set c := cls G Hv (E(G) \ Hs) g with hc + have hcsub : c ⊆ E(G) \ Hs := cls_subset hgM + have hbd : bdry G c ⊆ Hv := bdry_cls hgM fun v hv f hf hi => + ⟨hf, fun hfH => hv (hinc f hfH v hi)⟩ + have hbd₀ : bdry G c ⊆ V(G₀) := by + rintro v hv + obtain ⟨⟨f, hf, hi⟩, -⟩ := id hv + exact hV₀ v (hbd hv) f (hcsub hf).1 (hcsub hf).2 hi + obtain ⟨t, ht⟩ := hne + have htc : t ∉ c := fun h' => (hcsub h').2 ht + have h2 := h.two_le_bdry (A := c) (fun e he => (hcsub he).1) hbd₀ ⟨g, mem_cls_self⟩ + ⟨t, hHs ht, htc⟩ + obtain ⟨x, hx, y, hy, hxy⟩ := (Set.one_lt_ncard (h.finite_V₀.subset hbd₀)).mp (by omega) + obtain ⟨⟨f₀, hf₀, a, hl⟩, -⟩ := id hx + obtain ⟨⟨f₁, hf₁, hy'⟩, -⟩ := id hy + obtain ⟨W, hE, hS⟩ := exists_walk_in_cls hgM hf₀ hl (cls_trans (cls_symm hf₀) hf₁) hy' + obtain ⟨W', hs, hsupp, hedges⟩ := GM09.exists_isSimple_subwalk W + exact ⟨x, y, W', hxy, hs, hbd hx, hbd hy, hbd₀ hx, hbd₀ hy, fun e he => hE e (hedges e he), + fun z hz => hS z (hsupp z hz)⟩ + +/-- `G` has two paths with the same ends and no other common vertex, and no common edge. -/ +theorem exists_two_paths {e : β} (he : e ∈ E(G₀)) : + ∃ (x y : α) (W₁ W₂ : GraphWalk G x y), x ≠ y ∧ W₁.IsSimple ∧ W₂.IsSimple ∧ + (∀ z, z ∈ W₁.support → z ∈ W₂.support → z = x ∨ z = y) ∧ + ∀ a ∈ W₁.edges, a ∉ W₂.edges := by + obtain ⟨u, v, hl, ⟨hle, W, hs, hV, hE⟩, hne, hcap⟩ := h.path e he + have hedges : ∀ {f}, f ∈ E(G₀) → E(P f) ⊆ E(G) := fun {f} hf a ha => by + rw [h.eunion] + exact mem_iUnion₂.mpr ⟨f, hf, ha⟩ + have hin₀ : ∀ z ∈ V(P e), z ∉ V(G₀) → z ≠ u ∧ z ≠ v := by + refine fun z _ hz => ⟨fun h' => hz (h' ▸ hl.left_mem), fun h' => hz (h' ▸ hl.right_mem)⟩ + obtain ⟨g, hgE, hgn⟩ : ∃ g ∈ E(G), g ∉ E(P e) := by + obtain ⟨a, b, hab, ia, ib⟩ := IsSimpleThreeConnected.exists_two_edges h.simple hl.left_mem + obtain ⟨f, hf, hfe⟩ : ∃ f ∈ E(G₀), f ≠ e := by + by_cases hae : a = e + · exact ⟨b, ib.edge_mem, fun h' => hab (hae.trans h'.symm)⟩ + · exact ⟨a, ia.edge_mem, hae⟩ + obtain ⟨u', v', -, -, ⟨g, hg⟩, -⟩ := h.path f hf + exact ⟨g, hedges hf hg, Set.disjoint_right.mp (h.disj e he f hf hfe.symm).1 hg⟩ + obtain ⟨x, y, W₂, hxy, hs₂, hx, hy, hx₀, hy₀, hE₂, hin⟩ := h.exists_ear (Hv := V(P e)) + (Hs := E(P e)) (hedges he) hne (fun a ha z hz => (SubData.inc_path hle ha hz).vertex_mem) + (by + intro z hz f hf hfn hif + by_contra hz₀ + obtain ⟨hzu, hzv⟩ := hin₀ z hz hz₀ + obtain ⟨a, ha, b, hb, hab, ia, ib⟩ := exists_two_edges_at_inner W hs + (by rw [hV] at hz; exact hz) hzu hzv + have ha' : a ∈ E(P e) := by rw [hE]; exact ha + have hb' : b ∈ E(P e) := by rw [hE]; exact hb + have hia : G.Inc a z := by obtain ⟨w, hw⟩ := ia; exact ⟨w, hw.mono hle⟩ + have hib : G.Inc b z := by obtain ⟨w, hw⟩ := ib; exact ⟨w, hw.mono hle⟩ + exact hz₀ (h.mem_V₀_of_three (hedges he ha') (hedges he hb') hf hia hib hif hab + (fun h' => hfn (h' ▸ ha')) (fun h' => hfn (h' ▸ hb')))) + hgE hgn + obtain ⟨W₀, hw₀, he₀⟩ := W.exists_transfer (G' := G) (fun a p q _ hlk => hlk.mono hle) + (fun z hz => hle.vertexSet_mono (W.mem_vertexSet_of_mem_support hz)) + have hs₀ : W₀.IsSimple := by unfold GraphWalk.IsSimple; rw [hw₀]; exact hs + have hmemV : ∀ z, z ∈ W₀.support → z ∈ V(P e) := fun z hz => by + rw [hV, ← hw₀]; exact hz + have hmemE : ∀ a, a ∈ W₀.edges → a ∈ E(P e) := fun a ha => by + rw [hE, ← he₀]; exact ha + have hE₂' : ∀ a ∈ W₂.edges, a ∉ E(P e) := fun a ha => + (cls_subset (G := G) (B := V(P e)) (M := E(G) \ E(P e)) ⟨hgE, hgn⟩ (hE₂ a ha)).2 + have hcapmem : ∀ z, z ∈ V(P e) → z ∈ V(G₀) → z = u ∨ z = v := fun z h₁ h₂ => by + have : z ∈ V(P e) ∩ V(G₀) := ⟨h₁, h₂⟩ + rw [hcap] at this + exact this + rcases hcapmem x hx hx₀ with rfl | rfl <;> rcases hcapmem y hy hy₀ with rfl | rfl + · exact (hxy rfl).elim + · refine ⟨x, y, W₀, W₂, hxy, hs₀, hs₂, fun z h₁ h₂ => ?_, fun a ha ha' => hE₂' a ha' (hmemE a ha)⟩ + rcases hin z h₂ with h' | h' + · exact (h' (hmemV z h₁)).elim + · exact h' + · refine ⟨x, y, W₀.reverse, W₂, hxy, hs₀.reverse, hs₂, fun z h₁ h₂ => ?_, fun a ha ha' => ?_⟩ + · rw [GraphWalk.support_reverse, List.mem_reverse] at h₁ + rcases hin z h₂ with h' | h' + · exact (h' (hmemV z h₁)).elim + · exact h' + · rw [GraphWalk.edges_reverse, List.mem_reverse] at ha + exact hE₂' a ha' (hmemE a ha) + · exact (hxy rfl).elim + +/-- A simple walk between two vertices of `V(G₀)` with all its edges in one path `P e` uses all +edges +of that path. -/ +theorem thread_subset {e : β} (he : e ∈ E(G₀)) {x y : α} (hx : x ∈ V(G₀)) (hy : y ∈ V(G₀)) + (hxy : x ≠ y) (W' : GraphWalk G x y) (hs' : W'.IsSimple) (hE' : ∀ a ∈ W'.edges, a ∈ E(P e)) : + E(P e) ⊆ {a | a ∈ W'.edges} := by + obtain ⟨u, v, -, ⟨hle, W, hs, hV, hE⟩, -, hcap⟩ := h.path e he + have hinner : ∀ z ∈ W.support, z ≠ u → z ≠ v → z ∉ V(G₀) := by + intro z hz hzu hzv hz₀ + have hm : z ∈ V(P e) ∩ V(G₀) := ⟨by rw [hV]; exact hz, hz₀⟩ + rw [hcap] at hm + rcases hm with hm | hm + · exact hzu hm + · exact hzv hm + have hmemP : ∀ {a}, a ∈ W.edges → a ∈ E(P e) := fun {a} ha => by rw [hE]; exact ha + have hall := walk_pure W hs (A := {a | a ∈ W'.edges}) (by + intro z hz hzu hzv e₁ he₁ e₂ he₂ hi₁ hi₂ + have key : ∀ {e₁ e₂ : β}, e₁ ∈ W.edges → e₂ ∈ W.edges → (P e).Inc e₁ z → (P e).Inc e₂ z → + e₁ ∈ W'.edges → e₂ ∈ W'.edges := by + intro e₁ e₂ he₁ he₂ hi₁ hi₂ hin + by_contra hno + have hiG : ∀ {a}, (P e).Inc a z → G.Inc a z := fun ⟨w, hw⟩ => ⟨w, hw.mono hle⟩ + have hzW' : z ∈ W'.support := inc_mem_support W' hin (hiG hi₁) + have hzx : z ≠ x := fun h' => hinner z hz hzu hzv (h' ▸ hx) + have hzy : z ≠ y := fun h' => hinner z hz hzu hzv (h' ▸ hy) + obtain ⟨a, ha, b, hb, hab, ia, ib⟩ := exists_two_edges_at_inner W' hs' hzW' hzx hzy + have hconv : ∀ {c}, c ∈ W'.edges → G.Inc c z → (P e).Inc c z ∧ c ∈ W.edges := by + intro c hc hi + have hcP := hE' c hc + refine ⟨SubData.inc_path hle hcP hi, ?_⟩ + rw [hE] at hcP + exact hcP + exact not_three_edges W hs (hconv ha ia).2 (hconv hb ib).2 he₂ (hconv ha ia).1 (hconv hb ib).1 + hi₂ hab (fun h' => hno (h' ▸ ha)) (fun h' => hno (h' ▸ hb)) + exact ⟨key he₁ he₂ hi₁ hi₂, key he₂ he₁ hi₂ hi₁⟩) + have hx' : x ≠ y := hxy + obtain ⟨a, ha, -⟩ := exists_edge_at_start W' hx' + have haW : a ∈ W.edges := by + have := hE' a ha + rw [hE] at this + exact this + intro b hb + rw [hE] at hb + exact (hall a haW b hb).mp ha + +end SubData + +end GraphMinor.GM14.Whitney + +namespace GraphMinor.GM14 + +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM14.Whitney + +universe u v u' v' + +/-- Push forward a simple walk along vertex and edge maps `f : α → α'` and `g : β → β'`. -/ +theorem exists_walk_map_het {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + {P : Graph α β} {P' : Graph α' β'} {f : α → α'} {g : β → β'} + (hV : ∀ x ∈ V(P), f x ∈ V(P')) + (hL : ∀ e x y, P.IsLink e x y → P'.IsLink (g e) (f x) (f y)) : + ∀ {a b : α} (W : Surface.GraphWalk P a b), + ∃ W' : Surface.GraphWalk P' (f a) (f b), + W'.support = W.support.map f ∧ W'.edges = W.edges.map g + | _, _, .nil ha => ⟨.nil (hV _ ha), rfl, rfl⟩ + | _, _, .cons hl rest => by + obtain ⟨W', h₁, h₂⟩ := exists_walk_map_het hV hL rest + refine ⟨.cons (hL _ _ _ hl) W', ?_, ?_⟩ + · simp [Surface.GraphWalk.support, h₁] + · simp [Surface.GraphWalk.edges, h₂] + +/-- Push forward a graph `G₀ : Graph α β` along `f : α → α'` and `g₀ : β → β'` when `g₀` is +injective on `E(G₀)`. -/ +def mapGraphOn {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + (f : α → α') (g₀ : β → β') (G₀ : Graph α β) (hg₀ : InjOn g₀ E(G₀)) : Graph α' β' where + vertexSet := f '' V(G₀) + edgeSet := g₀ '' E(G₀) + IsLink e' x' y' := ∃ e x y, G₀.IsLink e x y ∧ g₀ e = e' ∧ f x = x' ∧ f y = y' + isLink_symm _ _ := ⟨fun _ _ ⟨e, x, y, hl, he, hx, hy⟩ => ⟨e, y, x, hl.symm, he, hy, hx⟩⟩ + eq_or_eq_of_isLink_of_isLink := by + rintro _ _ _ _ _ ⟨e₁, x₁, y₁, hl₁, rfl, rfl, rfl⟩ ⟨e₂, x₂, y₂, hl₂, he, rfl, rfl⟩ + have he12 : e₁ = e₂ := hg₀ hl₁.edge_mem hl₂.edge_mem he.symm + subst he12 + rcases G₀.eq_or_eq_of_isLink_of_isLink hl₁ hl₂ with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + edge_mem_iff_exists_isLink e' := by + constructor + · rintro ⟨e, he, rfl⟩ + obtain ⟨x, y, hl⟩ := G₀.exists_isLink_of_mem_edgeSet he + exact ⟨f x, f y, e, x, y, hl, rfl, rfl, rfl⟩ + · rintro ⟨_, _, e, x, y, hl, rfl, rfl, rfl⟩ + exact ⟨e, hl.edge_mem, rfl⟩ + left_mem_of_isLink := by + rintro _ _ _ ⟨e, x, y, hl, rfl, rfl, rfl⟩ + exact ⟨x, hl.left_mem, rfl⟩ + +/-- `mapGraphOn` preserves `IsSimpleThreeConnectedGraph` when `f` is injective on `V(G₀)` and +`g₀` is injective on `E(G₀)`. -/ +theorem isSimpleThreeConnectedGraph_mapGraphOn + {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + {f : α → α'} {g₀ : β → β'} {G₀ : Graph α β} + (hsimple : IsSimpleThreeConnectedGraph G₀) (hVfin : V(G₀).Finite) + (hfi₀ : InjOn f V(G₀)) (hg₀ : InjOn g₀ E(G₀)) : + IsSimpleThreeConnectedGraph (mapGraphOn f g₀ G₀ hg₀) := by + let G₀' := mapGraphOn f g₀ G₀ hg₀ + obtain ⟨hs, h4, _⟩ := id hsimple + refine ⟨⟨?_, ?_⟩, ?_, ?_⟩ + · rintro _ - _ ⟨e, x, y, hxy, rfl, rfl, hyx⟩ + have := hfi₀ hxy.left_mem hxy.right_mem hyx.symm + subst this + exact hs.1 e hxy.edge_mem x hxy + · rintro _ - _ - _ _ ⟨e₁, x, y, hxy, rfl, rfl, rfl⟩ ⟨e₂, x', y', hxy', rfl, hx, hy⟩ + have h₁ := hfi₀ hxy'.left_mem hxy.left_mem hx + have h₂ := hfi₀ hxy'.right_mem hxy.right_mem hy + subst h₁ h₂ + exact congrArg g₀ (hs.2 e₁ hxy.edge_mem e₂ hxy'.edge_mem _ _ hxy hxy') + · change 4 ≤ (f '' V(G₀)).ncard + rw [hfi₀.ncard_image] + exact h4 + · rintro G₁ G₂ ⟨hle₁, hle₂, hVU, hEU, hdisj⟩ hcard + have hmem : ∀ {H : Graph α' β'} {e x y}, H ≤ G₀' → g₀ e ∈ E(H) → G₀.IsLink e x y → + f x ∈ V(H) ∧ f y ∈ V(H) := by + intro H e x y hH he hxy + have hl : H.IsLink (g₀ e) (f x) (f y) := + (hH.isLink_iff he).mpr ⟨e, x, y, hxy, rfl, rfl, rfl⟩ + exact ⟨hl.left_mem, hl.right_mem⟩ + have hsep := IsSimpleThreeConnected.sep hsimple + (Vx := V(G₀) ∩ f ⁻¹' V(G₁)) (Vy := V(G₀) ∩ f ⁻¹' V(G₂)) + (Ex := E(G₀) ∩ g₀ ⁻¹' E(G₁)) (Ey := E(G₀) ∩ g₀ ⁻¹' E(G₂)) ?_ ?_ ?_ + (fun e he x y hxy => ⟨⟨hxy.left_mem, (hmem hle₁ he.2 hxy).1⟩, + ⟨hxy.right_mem, (hmem hle₁ he.2 hxy).2⟩⟩) + (fun e he x y hxy => ⟨⟨hxy.left_mem, (hmem hle₂ he.2 hxy).1⟩, + ⟨hxy.right_mem, (hmem hle₂ he.2 hxy).2⟩⟩) ?_ + · have hup : ∀ {H : Graph α' β'}, H ≤ G₀' → V(G₀) ∩ f ⁻¹' V(H) = V(G₀) → V(H) = V(G₀') := by + intro H hH heq + refine Subset.antisymm hH.vertexSet_mono ?_ + rintro _ ⟨x, hx, rfl⟩ + rw [← heq] at hx + exact hx.2 + rcases hsep with h' | h' + · exact Or.inl (hup hle₁ h') + · exact Or.inr (hup hle₂ h') + · ext x + constructor + · rintro (hx | hx) <;> exact hx.1 + · intro hx + have hfx : f x ∈ V(G₀') := ⟨x, hx, rfl⟩ + rw [← hVU] at hfx + rcases hfx with h' | h' + · exact Or.inl ⟨hx, h'⟩ + · exact Or.inr ⟨hx, h'⟩ + · ext e + constructor + · rintro (he | he) <;> exact he.1 + · intro he + have hge : g₀ e ∈ E(G₀') := ⟨e, he, rfl⟩ + rw [← hEU] at hge + rcases hge with h' | h' + · exact Or.inl ⟨he, h'⟩ + · exact Or.inr ⟨he, h'⟩ + · rw [Set.disjoint_left] + rintro e ⟨_, he₁⟩ ⟨_, he₂⟩ + exact Set.disjoint_left.mp hdisj he₁ he₂ + · have hsub : f '' ((V(G₀) ∩ f ⁻¹' V(G₁)) ∩ (V(G₀) ∩ f ⁻¹' V(G₂))) ⊆ V(G₁) ∩ V(G₂) := by + rintro _ ⟨x, ⟨⟨-, h₁⟩, -, h₂⟩, rfl⟩ + exact ⟨h₁, h₂⟩ + have hfin : (V(G₁) ∩ V(G₂)).Finite := + (hVfin.image f).subset fun y hy => hle₁.vertexSet_mono hy.1 + have hle := Set.ncard_le_ncard hsub hfin + have hsub₀ : (V(G₀) ∩ f ⁻¹' V(G₁)) ∩ (V(G₀) ∩ f ⁻¹' V(G₂)) ⊆ V(G₀) := + fun _ hx => hx.1.1 + rw [(hfi₀.mono hsub₀).ncard_image] at hle + omega + +/-- Transport a subdivision using ambient maps agreeing with a graph isomorphism. -/ +theorem isSubdivision_of_iso_with_maps + {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + {G : Graph α β} {G' : Graph α' β'} + (h : IsSubdivisionOfSimpleThreeConnected G) (ι : Iso G G') (f : α → α') (g : β → β') + (hfv : ∀ x : V(G), f x.1 = (ι.vertexEquiv x).1) + (hge : ∀ e : E(G), g e.1 = (ι.edgeEquiv e).1) : + IsSubdivisionOfSimpleThreeConnected G' := by + classical + obtain ⟨G₀, P, hd⟩ := exists_subData h + have hfm : ∀ {x}, x ∈ V(G) → f x ∈ V(G') := fun {x} hx => by + rw [hfv ⟨x, hx⟩]; exact (ι.vertexEquiv _).2 + have hfi : InjOn f V(G) := by + intro x hx y hy hxy + rw [hfv ⟨x, hx⟩, hfv ⟨y, hy⟩] at hxy + exact congrArg Subtype.val (ι.vertexEquiv.injective (Subtype.ext hxy)) + have hgi : InjOn g E(G) := by + intro x hx y hy hxy + rw [hge ⟨x, hx⟩, hge ⟨y, hy⟩] at hxy + exact congrArg Subtype.val (ι.edgeEquiv.injective (Subtype.ext hxy)) + have hlink : ∀ {e x y}, G.IsLink e x y → G'.IsLink (g e) (f x) (f y) := by + intro e x y hxy + have := (ι.isLink_iff ⟨e, hxy.edge_mem⟩ ⟨x, hxy.left_mem⟩ ⟨y, hxy.right_mem⟩).mp hxy + rw [hge ⟨e, hxy.edge_mem⟩, hfv ⟨x, hxy.left_mem⟩, hfv ⟨y, hxy.right_mem⟩] + exact this + have hVim : V(G') = f '' V(G) := by + ext y + constructor + · intro hy + obtain ⟨x, hx⟩ := ι.vertexEquiv.surjective ⟨y, hy⟩ + exact ⟨x.1, x.2, by rw [hfv x, hx]⟩ + · rintro ⟨x, hx, rfl⟩; exact hfm hx + have hEim : E(G') = g '' E(G) := by + ext y + constructor + · intro hy + obtain ⟨x, hx⟩ := ι.edgeEquiv.surjective ⟨y, hy⟩ + exact ⟨x.1, x.2, by rw [hge x, hx]⟩ + · rintro ⟨x, hx, rfl⟩ + rw [hge ⟨x, hx⟩]; exact (ι.edgeEquiv _).2 + have hPV : ∀ e, ∀ {x}, e ∈ E(G₀) → x ∈ V(P e) → x ∈ V(G) := by + intro e x he hx + obtain ⟨u, v, -, hp, -⟩ := hd.path e he + exact hp.le.vertexSet_mono hx + have hPE : ∀ e, ∀ {x}, e ∈ E(G₀) → x ∈ E(P e) → x ∈ E(G) := by + intro e x he hx + obtain ⟨u, v, -, hp, -⟩ := hd.path e he + exact hp.le.edgeSet_mono hx + let rep : β → β := fun e => + if he : e ∈ E(G₀) then (hd.path e he).choose_spec.choose_spec.2.2.1.some else e + have hrep_mem : ∀ {e}, e ∈ E(G₀) → rep e ∈ E(P e) := by + intro e he + simp only [rep, he, ↓reduceDIte] + exact (hd.path e he).choose_spec.choose_spec.2.2.1.some_mem + let g₀ : β → β' := fun e => g (rep e) + have hg₀ : InjOn g₀ E(G₀) := by + intro e₁ he₁ e₂ he₂ heq + by_contra hne + have hrep_eq : rep e₁ = rep e₂ := + hgi (hPE e₁ he₁ (hrep_mem he₁)) (hPE e₂ he₂ (hrep_mem he₂)) heq + exact Set.disjoint_left.mp (hd.disj e₁ he₁ e₂ he₂ hne).1 (hrep_mem he₁) (hrep_eq ▸ hrep_mem he₂) + have hV₀ := hd.sub + have hfi₀ : InjOn f V(G₀) := hfi.mono hV₀ + let G₀' : Graph α' β' := mapGraphOn f g₀ G₀ hg₀ + have hsimple' : IsSimpleThreeConnectedGraph G₀' := + isSimpleThreeConnectedGraph_mapGraphOn hd.simple hd.finite_V₀ hfi₀ hg₀ + let P₀ : β → Graph α' β' := fun e => (G'.induce (f '' V(P e))).restrict (g '' E(P e)) + let P' : β' → Graph α' β' := fun e' => + if h : ∃ e ∈ E(G₀), g₀ e = e' then P₀ (Classical.choose h) else ⊥ + have hP'eq : ∀ {e}, e ∈ E(G₀) → P' (g₀ e) = P₀ e := by + intro e he + have hex : ∃ e₁ ∈ E(G₀), g₀ e₁ = g₀ e := ⟨e, he, rfl⟩ + have heq : Classical.choose hex = e := hg₀ (Classical.choose_spec hex).1 he + (Classical.choose_spec hex).2 + simp only [P', hex, ↓reduceDIte, heq] + have hP₀link : ∀ {e a x y}, e ∈ E(G₀) → (P e).IsLink a x y → (P₀ e).IsLink (g a) (f x) (f y) := by + intro e a x y he hl + obtain ⟨u, v, -, hp, -⟩ := hd.path e he + exact ⟨⟨a, hl.edge_mem, rfl⟩, hlink (hl.mono hp.le), ⟨x, hl.left_mem, rfl⟩, + ⟨y, hl.right_mem, rfl⟩⟩ + have hP₀E : ∀ {e}, e ∈ E(G₀) → E(P₀ e) = g '' E(P e) := by + intro e he + change E((G'.induce (f '' V(P e))).restrict (g '' E(P e))) = _ + rw [Graph.edgeSet_restrict, inter_eq_right] + rintro _ ⟨a, ha, rfl⟩ + obtain ⟨x, y, hxy⟩ := (P e).exists_isLink_of_mem_edgeSet ha + exact (show (G'.induce (f '' V(P e))).IsLink _ _ _ from (hP₀link he hxy).2).edge_mem + have hP₀V : ∀ e, V(P₀ e) = f '' V(P e) := fun _ => rfl + have hle' : ∀ {e}, e ∈ E(G₀) → P₀ e ≤ G' := by + intro e he + refine Graph.restrict_le.trans (Graph.induce_le ?_) + rintro _ ⟨x, hx, rfl⟩ + exact hfm (hPV e he hx) + refine ⟨G₀', hsimple', ?_, P', ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + exact hfm (hV₀ hx) + · rintro _ ⟨e, he, rfl⟩ + rw [hP'eq he] + obtain ⟨u, v, hl, ⟨hle, W, hs, hV, hE⟩, hne, hcap⟩ := hd.path e he + obtain ⟨W', h₁, h₂⟩ := exists_walk_map_het (P := P e) (P' := P₀ e) (f := f) (g := g) + (fun x hx => ⟨x, hx, rfl⟩) (fun a x y h' => hP₀link he h') W + refine ⟨f u, f v, ⟨e, u, v, hl, rfl, rfl, rfl⟩, ⟨hle' he, W', ?_, ?_, ?_⟩, ?_, ?_⟩ + · change W'.support.Nodup + rw [h₁] + refine (List.nodup_map_iff_inj_on hs).mpr fun x hx y hy hxy => ?_ + exact hfi (hPV e he (hV ▸ hx)) (hPV e he (hV ▸ hy)) hxy + · rw [hP₀V, hV]; ext y; simp [h₁] + · rw [hP₀E he, hE]; ext y; simp [h₂] + · rw [hP₀E he]; exact hne.image g + · change f '' V(P e) ∩ f '' V(G₀) = _ + have hsubP : V(P e) ⊆ V(G) := fun x hx => hPV e he hx + rw [← hfi.image_inter hsubP hV₀, hcap, image_pair] + · rintro _ ⟨e₁, he₁, rfl⟩ _ ⟨e₂, he₂, rfl⟩ hne + have hne₀ : e₁ ≠ e₂ := fun h0 => hne (congrArg g₀ h0) + rw [hP'eq he₁, hP'eq he₂] + have hd₁ := hd.disj e₁ he₁ e₂ he₂ hne₀ + refine ⟨?_, ?_⟩ + · rw [hP₀E he₁, hP₀E he₂, Set.disjoint_left] + rintro _ ⟨a, ha, rfl⟩ ⟨b, hb, hab⟩ + have := hgi (hPE e₂ he₂ hb) (hPE e₁ he₁ ha) hab + exact Set.disjoint_left.mp hd₁.1 ha (this ▸ hb) + · rintro _ ⟨⟨a, ha, rfl⟩, ⟨b, hb, hab⟩⟩ + have := hfi (hPV e₂ he₂ hb) (hPV e₁ he₁ ha) hab + exact ⟨a, hd₁.2 ⟨ha, this ▸ hb⟩, rfl⟩ + · rw [hVim, hd.vunion, image_union, image_iUnion₂] + change f '' V(G₀) ∪ ⋃ e ∈ E(G₀), f '' V(P e) = + f '' V(G₀) ∪ ⋃ e' ∈ g₀ '' E(G₀), V(P' e') + rw [biUnion_image] + refine congrArg (f '' V(G₀) ∪ ·) (iUnion₂_congr fun e he => ?_) + rw [hP'eq he, hP₀V] + · rw [hEim, hd.eunion, image_iUnion₂] + change (⋃ e ∈ E(G₀), g '' E(P e)) = ⋃ e' ∈ g₀ '' E(G₀), E(P' e') + rw [biUnion_image] + refine iUnion₂_congr fun e he => ?_ + rw [hP'eq he, hP₀E he] + +/-- Heterogeneous version of `Whitney.isSubdivision_of_iso`: a graph `G' : Graph α' β'` +isomorphic to a subdivision `G : Graph α β` of a simple 3-connected graph is one too. -/ +theorem isSubdivision_of_iso_het {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + [Nonempty α'] [Nonempty β'] {G : Graph α β} {G' : Graph α' β'} + (h : IsSubdivisionOfSimpleThreeConnected G) (ι : Iso G G') : + IsSubdivisionOfSimpleThreeConnected G' := by + classical + let a₀ : α' := Classical.arbitrary α' + let b₀ : β' := Classical.arbitrary β' + let f : α → α' := fun x => if hx : x ∈ V(G) then (ι.vertexEquiv ⟨x, hx⟩).1 else a₀ + let g : β → β' := fun e => if he : e ∈ E(G) then (ι.edgeEquiv ⟨e, he⟩).1 else b₀ + have hfv : ∀ x : V(G), f x.1 = (ι.vertexEquiv x).1 := fun x => by simp [f] + have hge : ∀ e : E(G), g e.1 = (ι.edgeEquiv e).1 := fun e => by simp [g] + exact isSubdivision_of_iso_with_maps h ι f g hfv hge + +end GraphMinor.GM14 + +namespace GraphMinor.GM14.Whitney + +open Set Graph GraphMinor.Surface + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## 5. Moving a subdivision along an isomorphism -/ + +/-- A walk moves along a map of links. -/ +theorem exists_walk_map {P P' : Graph α β} {f : α → α} {g : β → β} + (hv : ∀ x ∈ V(P), f x ∈ V(P')) + (hl : ∀ e x y, P.IsLink e x y → P'.IsLink (g e) (f x) (f y)) {a b : α} + (W : GraphWalk P a b) : + ∃ W' : GraphWalk P' (f a) (f b), W'.support = W.support.map f ∧ + W'.edges = W.edges.map g := + GraphMinor.GM14.exists_walk_map_het hv hl W + +/-- A graph isomorphic to a subdivision of a simple 3-connected graph is one too. -/ +theorem isSubdivision_of_iso {G G' : Graph α β} (h : IsSubdivisionOfSimpleThreeConnected G) + (ι : Iso G G') : IsSubdivisionOfSimpleThreeConnected G' := by + classical + let f : α → α := fun x => if hx : x ∈ V(G) then (ι.vertexEquiv ⟨x, hx⟩).1 else x + let g : β → β := fun e => if he : e ∈ E(G) then (ι.edgeEquiv ⟨e, he⟩).1 else e + have hfv : ∀ x : V(G), f x.1 = (ι.vertexEquiv x).1 := fun x => by simp [f] + have hge : ∀ e : E(G), g e.1 = (ι.edgeEquiv e).1 := fun e => by simp [g] + exact GraphMinor.GM14.isSubdivision_of_iso_with_maps h ι f g hfv hge + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM14/WhitneyPeripheral.lean b/LeanPool/GraphMinor/GM14/WhitneyPeripheral.lean new file mode 100644 index 0000000000..0ff3971c9d --- /dev/null +++ b/LeanPool/GraphMinor/GM14/WhitneyPeripheral.lean @@ -0,0 +1,981 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.WhitneyFaces +import LeanPool.GraphMinor.GM11.PerimeterPull +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Face boundaries are the peripheral circuits + +Let `J` be a drawing in a sphere of a subdivision of a simple 3-connected graph. Call a circuit +`C` of `J` *peripheral* if the edges of `J` outside `C` form one bridge of `C`. We show: + +* the boundary of a face of `J` is a peripheral circuit (`peripheral_of_side`); +* a peripheral circuit bounds a disc whose interior misses `J` + (`exists_free_side_of_peripheral`). + +So the set of boundaries of faces depends only on the graph. This is the key to Whitney's theorem. +-/ + +@[expose] public section + +namespace GraphMinor.GM14.Whitney + +open Set Topology Graph GraphMinor.GM09 GraphMinor.GM11 GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +section Walks + +variable {α β : Type*} {G : Graph α β} + +/-- Two simple walks that share only their common end have a simple concatenation. -/ +theorem isSimple_append {a b c : α} (W₁ : GraphWalk G a b) (W₂ : GraphWalk G b c) + (h₁ : W₁.IsSimple) (h₂ : W₂.IsSimple) (hc : ∀ p, p ∈ W₁.support → p ∈ W₂.support → p = b) : + (W₁.append W₂).IsSimple := by + induction W₁ with + | nil _ => exact h₂ + | @cons u v w f hl rest ih => + have hnd := List.nodup_cons.mp h₁ + refine List.nodup_cons.mpr ⟨?_, ih W₂ hnd.2 h₂ fun p hp hp' => hc p + (List.mem_cons_of_mem _ hp) hp'⟩ + rw [GraphWalk.mem_support_append] + rintro (h' | h') + · exact hnd.1 h' + · have hub : u = _ := hc u (List.mem_cons_self) h' + exact hnd.1 (hub ▸ rest.end_mem_support) + +/-- Two walks that form a simple walk share only the middle vertex. -/ +theorem append_cap {a b c : α} {W₁ : GraphWalk G a b} {W₂ : GraphWalk G b c} + (h : (W₁.append W₂).IsSimple) (p : α) (h₁ : p ∈ W₁.support) (h₂ : p ∈ W₂.support) : p = b := by + have hs : (W₁.support ++ W₂.support.tail).Nodup := by + have h' : (W₁.append W₂).support.Nodup := h + rwa [GraphWalk.support_append] at h' + have hd := List.nodup_append.mp hs + rw [W₂.support_eq_cons, List.mem_cons] at h₂ + rcases h₂ with h₂ | h₂ + · exact h₂ + · exact (hd.2.2 p h₁ p h₂ rfl).elim + +/-- Two walks in a loopless graph that share at most one vertex have no common edge. -/ +theorem edge_not_mem_of_cap {a b c d q : α} (hl : ∀ e u, ¬ G.IsLink e u u) {W₁ : GraphWalk G a b} + {W₂ : GraphWalk G c d} (hc : ∀ p, p ∈ W₁.support → p ∈ W₂.support → p = q) {e : β} + (he₁ : e ∈ W₁.edges) : e ∉ W₂.edges := by + intro he₂ + obtain ⟨u, v, huv⟩ : ∃ u v, G.IsLink e u v := by + induction W₁ with + | nil _ => simp [GraphWalk.edges] at he₁ + | @cons p r s f hlk rest ih => + simp only [GraphWalk.edges, List.mem_cons] at he₁ + rcases he₁ with rfl | h' + · exact ⟨_, _, hlk⟩ + · exact ih (fun p h₁ h₂ => hc p (List.mem_cons_of_mem _ h₁) h₂) h' + have h₁ := hc u (inc_mem_support W₁ he₁ ⟨v, huv⟩) (inc_mem_support W₂ he₂ ⟨v, huv⟩) + have h₂ := hc v (inc_mem_support W₁ he₁ ⟨u, huv.symm⟩) (inc_mem_support W₂ he₂ ⟨u, huv.symm⟩) + subst h₁ + subst h₂ + exact hl e _ huv + +end Walks + +section WalkSets + +variable [T2Space S] {J : Drawing S} + +/-- The point set of the part of `J` on a walk. -/ +abbrev wU (J : Drawing S) {a b : S} (W : GraphWalk J.toGraph a b) : Set S := (walkDrawing J W).U + +theorem mem_wU_of_support {a b p : S} {W : GraphWalk J.toGraph a b} (hp : p ∈ W.support) : + p ∈ wU J W := + (mem_walkDrawing_U J W).mpr (Or.inl hp) + +theorem closure_subset_wU {a b : S} {W : GraphWalk J.toGraph a b} {e : Set S} (he : e ∈ W.edges) : + closure e ⊆ wU J W := + fun _ hp => (mem_walkDrawing_U J W).mpr (Or.inr ⟨e, he, hp⟩) + +theorem subset_wU {a b : S} {W : GraphWalk J.toGraph a b} {e : Set S} (he : e ∈ W.edges) : + e ⊆ wU J W := + subset_closure.trans (closure_subset_wU he) + +theorem support_of_wU {a b p : S} {W : GraphWalk J.toGraph a b} (hp : p ∈ wU J W) + (hv : p ∈ J.V) : p ∈ W.support := by + have := mem_V_of_mem_U (walkDrawing_isSubdrawing J W) hv hp + rwa [walkDrawing_V] at this + +theorem wU_reverse {a b : S} (W : GraphWalk J.toGraph a b) : wU J W.reverse = wU J W := by + ext p + rw [mem_walkDrawing_U, mem_walkDrawing_U, GraphWalk.support_reverse, GraphWalk.edges_reverse] + simp + +theorem wU_append {a b c : S} (W₁ : GraphWalk J.toGraph a b) (W₂ : GraphWalk J.toGraph b c) : + wU J (W₁.append W₂) = wU J W₁ ∪ wU J W₂ := by + ext p + simp only [mem_union, mem_walkDrawing_U, GraphWalk.mem_support_append, GraphWalk.edges_append, + List.mem_append] + constructor + · rintro ((h | h) | ⟨e, he | he, hp⟩) + · exact Or.inl (Or.inl h) + · exact Or.inr (Or.inl h) + · exact Or.inl (Or.inr ⟨e, he, hp⟩) + · exact Or.inr (Or.inr ⟨e, he, hp⟩) + · rintro ((h | ⟨e, he, hp⟩) | (h | ⟨e, he, hp⟩)) + · exact Or.inl (Or.inl h) + · exact Or.inr ⟨e, Or.inl he, hp⟩ + · exact Or.inl (Or.inr h) + · exact Or.inr ⟨e, Or.inr he, hp⟩ + +theorem wU_line {a b : S} {W : GraphWalk J.toGraph a b} (hW : W.IsSimple) (hab : a ≠ b) : + IsLineWithEnds (wU J W) a b := + isLine_of_isPathBetween (walkDrawing_isPathBetween J hW) hab + +/-- An edge of `J` that meets the part of `J` on a walk is an edge of the walk. -/ +theorem edge_mem_of_meets {a b : S} {W : GraphWalk J.toGraph a b} {e : Set S} (he : e ∈ J.E) + {p : S} (hpe : p ∈ e) (hp : p ∈ wU J W) : e ∈ W.edges := by + by_contra hn + have hdis := edge_disjoint_U (walkDrawing_isSubdrawing J W) he + (by rw [walkDrawing_E]; exact hn) + exact Set.disjoint_left.mp hdis hpe hp + +/-- Two walks with no common edge meet only in common vertices. -/ +theorem wU_inter {a b c d : S} {W : GraphWalk J.toGraph a b} {W' : GraphWalk J.toGraph c d} + (hE : ∀ e ∈ W.edges, e ∉ W'.edges) : + wU J W ∩ wU J W' = {p | p ∈ W.support ∧ p ∈ W'.support} := by + rw [U_inter_of_disjoint (walkDrawing_isSubdrawing J W) (walkDrawing_isSubdrawing J W') + (by rw [walkDrawing_E, walkDrawing_E, Set.disjoint_left]; exact hE), + walkDrawing_V, walkDrawing_V] + rfl + +/-- An edge that misses the boundary of a disc is inside the disc or misses it. -/ +theorem edge_side (hS : IsClosedSurface S) {D : Set S} (hD : IsClosedDisc D) {e : Set S} + (he : e ∈ J.E) (hdis : Disjoint e (discBd D)) : e ⊆ D ∨ Disjoint e D := + subset_or_disjoint_of_frontier hD.isClosed he.2.2.1.isConnected.isPreconnected + (by rwa [IsClosedDisc.frontier_eq_discBd hS hD]) + +end WalkSets + +section Free + +variable [T2Space S] {J : Drawing S} + +/-- A circuit `C` of `J` is *peripheral* if the edges of `J` outside `C` form one bridge. -/ +def IsPeripheral (J C : Drawing S) : Prop := + ∀ e ∈ J.E \ C.E, ∀ f ∈ J.E \ C.E, f ∈ cls J.toGraph C.V (J.E \ C.E) e + +omit [T2Space S] in +theorem free_of_side {C : Drawing S} (hs : C.IsSubdrawing J) + (hinc : ∀ v ∈ J.V, ∃ e ∈ J.E, J.toGraph.Inc e v) {Δ Δ' : Set S} (hdisj : Δ ∩ Δ' = C.U) + (hcl : IsClosed Δ) (hM : ∀ e ∈ J.E \ C.E, e ⊆ Δ) : Disjoint (Δ' \ C.U) J.U := by + rw [Set.disjoint_left] + rintro p ⟨hp, hpC⟩ hpU + have hoff : ∀ {e}, e ∈ J.E → e ∉ C.E → p ∈ closure e → False := fun {e} he hn hpe => + hpC (hdisj ▸ ⟨closure_minimal (hM e ⟨he, hn⟩) hcl hpe, hp⟩) + by_cases hpV : p ∈ J.V + · obtain ⟨e, he, ie⟩ := hinc p hpV + refine hoff he (fun heC => hpC ?_) (mem_closure_of_inc ie) + have hm : p ∈ closure e ∩ J.V := ⟨mem_closure_of_inc ie, hpV⟩ + rw [← hs.closure_inter_V heC] at hm + exact C.V_subset_U hm.2 + · obtain ⟨e, he, hpe⟩ := J.exists_edge_of_mem hpU hpV + refine hoff he (fun heC => hpC ?_) (subset_closure hpe) + rw [C.U_eq] + exact Or.inr (mem_iUnion₂.mpr ⟨e, heC, subset_closure hpe⟩) + +omit [T2Space S] in +/-- All edges in a bridge of `C` lie on one side of `C`. -/ +theorem cls_side {C : Drawing S} (hs : C.IsSubdrawing J) {Δ Δ' : Set S} (hdisj : Δ ∩ Δ' = C.U) + (hcl : IsClosed Δ) (hcl' : IsClosed Δ') (hside : ∀ e ∈ J.E \ C.E, e ⊆ Δ ∨ e ⊆ Δ') {e₀ f : Set S} + (he₀ : e₀ ⊆ Δ) (hf : f ∈ cls J.toGraph C.V (J.E \ C.E) e₀) : f ⊆ Δ := by + induction hf with + | refl => exact he₀ + | @tail a b _ hadj ih => + obtain ⟨-, hb, w, hw, ia, ib⟩ := hadj + rcases hside b hb with h' | h' + · exact h' + · exfalso + have hwΔ : w ∈ Δ := closure_minimal ih hcl (mem_closure_of_inc ia) + have hwΔ' : w ∈ Δ' := closure_minimal h' hcl' (mem_closure_of_inc ib) + have hwU : w ∈ C.U := hdisj ▸ ⟨hwΔ, hwΔ'⟩ + exact hw (mem_V_of_mem_U hs ia.vertex_mem hwU) + +/-- A peripheral circuit bounds a disc whose interior misses `J`. -/ +theorem exists_free_side_of_peripheral (hS : IsSphere S) {C : Drawing S} (hC : C.IsCircuit) + (hs : C.IsSubdrawing J) (hinc : ∀ v ∈ J.V, ∃ e ∈ J.E, J.toGraph.Inc e v) + (hP : IsPeripheral J C) : + ∃ D : Set S, IsClosedDisc D ∧ discBd D = C.U ∧ Disjoint (D \ discBd D) J.U := by + have hcl := (IsSphere.isClosedSurface hS).1 + obtain ⟨Δ₁, Δ₂, -, hd₁, hd₂, hb₁, hb₂, hun, hint, -, -⟩ := + sphere_disc S hS C.U (GM11.IsCircuit.isOArc_U hC) + have hside : ∀ e ∈ J.E \ C.E, e ⊆ Δ₁ ∨ e ⊆ Δ₂ := by + rintro e ⟨he, hn⟩ + have hdis : Disjoint e (discBd Δ₁) := by + rw [hb₁] + exact edge_disjoint_U hs he hn + rcases edge_side hcl hd₁ he hdis with h' | h' + · exact Or.inl h' + · refine Or.inr fun p hp => ?_ + have : p ∈ Δ₁ ∪ Δ₂ := by rw [hun]; exact mem_univ p + exact this.resolve_left (Set.disjoint_left.mp h' hp) + have hint' : Δ₂ ∩ Δ₁ = C.U := by rw [inter_comm]; exact hint + by_cases hM : (J.E \ C.E).Nonempty + · obtain ⟨e₀, he₀⟩ := hM + rcases hside e₀ he₀ with h' | h' + · refine ⟨Δ₂, hd₂, hb₂, ?_⟩ + rw [hb₂] + exact free_of_side hs hinc hint hd₁.isClosed fun e he => + cls_side hs hint hd₁.isClosed hd₂.isClosed hside h' (hP e₀ he₀ e he) + · refine ⟨Δ₁, hd₁, hb₁, ?_⟩ + rw [hb₁] + refine free_of_side hs hinc hint' hd₂.isClosed fun e he => + cls_side hs hint' hd₂.isClosed hd₁.isClosed (fun a ha => (hside a ha).symm) h' + (hP e₀ he₀ e he) + · refine ⟨Δ₂, hd₂, hb₂, ?_⟩ + rw [hb₂] + exact free_of_side hs hinc hint hd₁.isClosed fun e he => (hM ⟨e, he⟩).elim + +end Free + +section Main + +variable [T2Space S] {J C₀ : Drawing S} {Δ : Set S} {c : Set (Set S)} + +/-- The set up for showing that a circuit `C₀` with all of `J` on one side `Δ` is peripheral. Here +`c` is a bridge of `C₀`. -/ +structure Env (J C₀ : Drawing S) (Δ : Set S) (c : Set (Set S)) : Prop where + circ : C₀.IsCircuit + sub : C₀.IsSubdrawing J + U : J.U ⊆ Δ + cE : ∀ e ∈ c, e ∈ J.E ∧ e ∉ C₀.E + stepc : ∀ e f, e ∈ c → adj J.toGraph C₀.V (J.E \ C₀.E) e f → f ∈ c + +/-- A disc `D` cut from `Δ` by a path `T` in the bridge `c`, with boundary `T` and a path `Q` of +`C₀`. It contains an edge `g` that is not in `T`, `Q` or `c`. We show that no such disc exists, +by taking one with the fewest edges. -/ +structure Cand (J C₀ : Drawing S) (Δ : Set S) (c : Set (Set S)) (g D D' : Set S) {x y : S} + (T Q : GraphWalk J.toGraph x y) : Prop where + ne : x ≠ y + hT : T.IsSimple + hQ : Q.IsSimple + disc : IsClosedDisc D + closed : IsClosed D' + union : D ∪ D' = Δ + inter : D ∩ D' = wU J T + bd : discBd D = wU J T ∪ wU J Q + Tc : ∀ e ∈ T.edges, e ∈ c + QC : ∀ e ∈ Q.edges, e ∈ C₀.E + Tbd : wU J T ∩ C₀.U = {x, y} + Qbd : C₀.U ∩ D = wU J Q + gE : g ∈ J.E + gD : g ⊆ D + gT : g ∉ T.edges + gQ : g ∉ Q.edges + gc : g ∉ c + +/-- The edges strictly inside `D`, with those on `Q` and `T` left out. -/ +def MM (J : Drawing S) (D : Set S) {x y : S} (T Q : GraphWalk J.toGraph x y) : Set (Set S) := + {e | e ∈ J.E ∧ e ⊆ D ∧ e ∉ T.edges ∧ e ∉ Q.edges} + +/-- The vertices on the boundary of `D`. -/ +def BB {J : Drawing S} {x y : S} (T Q : GraphWalk J.toGraph x y) : Set S := + {p | p ∈ T.support ∨ p ∈ Q.support} + +/-- The bridge of `e` inside `D`. -/ +abbrev icls (J : Drawing S) (D : Set S) {x y : S} (T Q : GraphWalk J.toGraph x y) (e : Set S) : + Set (Set S) := + cls J.toGraph (BB T Q) (MM J D T Q) e + +/-- The bridge of `e` inside `D` meets the walk `W` at a vertex other than its ends. -/ +def Att (J : Drawing S) (D : Set S) {x y a b : S} (T Q : GraphWalk J.toGraph x y) + (W : GraphWalk J.toGraph a b) (e : Set S) : Prop := + ∃ f ∈ icls J D T Q e, ∃ z ∈ W.support, z ≠ a ∧ z ≠ b ∧ J.toGraph.Inc f z + +namespace Cand + +variable {g D D' : Set S} {x y : S} {T Q : GraphWalk J.toGraph x y} + +theorem symm (hc : Cand J C₀ Δ c g D D' T Q) : Cand J C₀ Δ c g D D' T.reverse Q.reverse where + ne := hc.ne.symm + hT := hc.hT.reverse + hQ := hc.hQ.reverse + disc := hc.disc + closed := hc.closed + union := hc.union + inter := by rw [wU_reverse]; exact hc.inter + bd := by rw [wU_reverse, wU_reverse]; exact hc.bd + Tc e he := hc.Tc e (by rwa [GraphWalk.edges_reverse, List.mem_reverse] at he) + QC e he := hc.QC e (by rwa [GraphWalk.edges_reverse, List.mem_reverse] at he) + Tbd := by rw [wU_reverse, pair_comm]; exact hc.Tbd + Qbd := by rw [wU_reverse]; exact hc.Qbd + gE := hc.gE + gD := hc.gD + gT := by rw [GraphWalk.edges_reverse, List.mem_reverse]; exact hc.gT + gQ := by rw [GraphWalk.edges_reverse, List.mem_reverse]; exact hc.gQ + gc := hc.gc + +theorem wT_sub (hc : Cand J C₀ Δ c g D D' T Q) : wU J T ⊆ D := + fun _ hp => Surface.discBd_subset D (hc.bd ▸ Or.inl hp) + +theorem wQ_sub (hc : Cand J C₀ Δ c g D D' T Q) : wU J Q ⊆ D := + fun _ hp => Surface.discBd_subset D (hc.bd ▸ Or.inr hp) + +theorem wQ_sub_C (hc : Cand J C₀ Δ c g D D' T Q) : wU J Q ⊆ C₀.U := + fun _ hp => (hc.Qbd ▸ hp : _ ∈ C₀.U ∩ D).1 + +theorem cap (hc : Cand J C₀ Δ c g D D' T Q) (p : S) (h₁ : p ∈ T.support) (h₂ : p ∈ Q.support) : + p = x ∨ p = y := by + have : p ∈ wU J T ∩ C₀.U := ⟨mem_wU_of_support h₁, hc.wQ_sub_C (mem_wU_of_support h₂)⟩ + rw [hc.Tbd] at this + exact this + +theorem offE (hc : Cand J C₀ Δ c g D D' T Q) {e : Set S} (he : e ∈ J.E) (hT : e ∉ T.edges) + (hQ : e ∉ Q.edges) : Disjoint e (discBd D) := by + rw [hc.bd] + exact Set.disjoint_union_right.mpr + ⟨edge_disjoint_U (walkDrawing_isSubdrawing J T) he (by rw [walkDrawing_E]; exact hT), + edge_disjoint_U (walkDrawing_isSubdrawing J Q) he (by rw [walkDrawing_E]; exact hQ)⟩ + +/-- An edge at a vertex of `D` off `T` lies in `D`, unless it is an edge of `Q`. -/ +theorem mem_MM (hS : IsClosedSurface S) (hE : Env J C₀ Δ c) (hc : Cand J C₀ Δ c g D D' T Q) + {v : S} {e : Set S} (hvT : v ∉ T.support) (hvD : v ∈ D) (he : e ∈ J.E) + (hi : J.toGraph.Inc e v) (hQ : e ∉ Q.edges) : e ∈ MM J D T Q := by + have hT : e ∉ T.edges := fun h' => hvT (inc_mem_support T h' hi) + refine ⟨he, ?_, hT, hQ⟩ + rcases edge_side hS hc.disc he (hc.offE he hT hQ) with h' | h' + · exact h' + · exfalso + have heD' : e ⊆ D' := by + intro p hp + have hpU : p ∈ J.U := (he.2.1 hp).1 + have : p ∈ D ∪ D' := by rw [hc.union]; exact hE.U hpU + exact this.resolve_left (Set.disjoint_left.mp h' hp) + have hvD' : v ∈ D' := closure_minimal heD' hc.closed (mem_closure_of_inc hi) + have hvU : v ∈ wU J T := hc.inter ▸ ⟨hvD, hvD'⟩ + exact hvT (support_of_wU hvU hi.vertex_mem) + +theorem MM_not_C (hc : Cand J C₀ Δ c g D D' T Q) {e : Set S} (he : e ∈ MM J D T Q) : + e ∉ C₀.E := by + intro heC + obtain ⟨p, hp⟩ : e.Nonempty := he.1.1 + have hpU : p ∈ C₀.U := by + rw [C₀.U_eq] + exact Or.inr (mem_iUnion₂.mpr ⟨e, heC, subset_closure hp⟩) + exact he.2.2.2 (edge_mem_of_meets he.1 hp (hc.Qbd ▸ ⟨hpU, he.2.1 hp⟩)) + +theorem off_V (hc : Cand J C₀ Δ c g D D' T Q) {p : S} (hp : p ∉ BB T Q) + (hpD : p ∈ D) (hpJ : p ∈ J.V) : p ∉ C₀.V := by + intro hpC + have hm : p ∈ wU J Q := hc.Qbd ▸ ⟨C₀.V_subset_U hpC, hpD⟩ + exact hp (Or.inr (support_of_wU hm hpJ)) + +theorem cls_sub (hE : Env J C₀ Δ c) (hc : Cand J C₀ Δ c g D D' T Q) {a b : Set S} (ha : a ∈ c) + (hb : b ∈ icls J D T Q a) : b ∈ c := by + induction hb with + | refl => exact ha + | @tail p q _ hadj ih => + obtain ⟨hp, hq, w, hw, i₁, i₂⟩ := hadj + have hwD : w ∈ D := closure_minimal hp.2.1 hc.disc.isClosed (mem_closure_of_inc i₁) + exact hE.stepc p q ih ⟨⟨hp.1, hc.MM_not_C hp⟩, ⟨hq.1, hc.MM_not_C hq⟩, w, + hc.off_V hw hwD i₁.vertex_mem, i₁, i₂⟩ + +/-- A bridge inside `D` that meets the inside of `T` belongs to `c`. -/ +theorem att_c (hE : Env J C₀ Δ c) (hc : Cand J C₀ Δ c g D D' T Q) {a : Set S} + (ha : a ∈ MM J D T Q) (hatt : Att J D T Q T a) : a ∈ c := by + obtain ⟨f, hf, z, hz, hzx, hzy, iz⟩ := hatt + obtain ⟨t, ht, -, -, -, it, -⟩ := exists_two_edges_at_inner T hc.hT hz hzx hzy + have htc := hc.Tc t ht + have hfM : f ∈ MM J D T Q := cls_subset ha hf + have hzC : z ∉ C₀.V := by + intro hzC + have : z ∈ wU J T ∩ C₀.U := ⟨mem_wU_of_support hz, C₀.V_subset_U hzC⟩ + rw [hc.Tbd] at this + rcases this with h' | h' + · exact hzx h' + · exact hzy h' + have hfc : f ∈ c := hE.stepc t f htc + ⟨hE.cE t htc, ⟨hfM.1, hc.MM_not_C hfM⟩, z, hzC, it, iz⟩ + exact hc.cls_sub hE hfc (cls_symm hf) + +/-- The first end of `T` is a branch vertex, with an edge of `C₀` outside `Q`. -/ +theorem start_data {G₀ : Graph S (Set S)} {P : Set S → Graph S (Set S)} + (h : SubData J.toGraph G₀ P) (hE : Env J C₀ Δ c) (hc : Cand J C₀ Δ c g D D' T Q) : + x ∈ V(G₀) ∧ (∃ t ∈ T.edges, J.toGraph.Inc t x) ∧ + ∃ k ∈ C₀.E, J.toGraph.Inc k x ∧ k ∉ Q.edges := by + have hxU : x ∈ wU J T ∩ C₀.U := by rw [hc.Tbd]; exact Or.inl rfl + have hxV : x ∈ C₀.V := mem_V_of_mem_U hE.sub + (T.mem_vertexSet_of_mem_support T.start_mem_support) hxU.2 + obtain ⟨k₁, hk₁, k₂, hk₂, hne, i₁, i₂⟩ := circuit_two_edges h hE.circ hE.sub hxV + obtain ⟨t, ht, it⟩ := exists_edge_at_start T hc.ne + have htc := hE.cE t (hc.Tc t ht) + refine ⟨h.mem_V₀_of_three htc.1 (hE.sub.2 hk₁) (hE.sub.2 hk₂) it i₁ i₂ + (fun h' => htc.2 (h' ▸ hk₁)) (fun h' => htc.2 (h' ▸ hk₂)) hne, ⟨t, ht, it⟩, ?_⟩ + by_cases hk : k₁ ∈ Q.edges + · refine ⟨k₂, hk₂, i₂, fun hk' => hne ?_⟩ + have hconv : ∀ {a}, J.toGraph.Inc a x → J.toGraph.Inc a x := id + exact eq_of_inc_start Q hc.hQ hk hk' (hconv i₁) (hconv i₂) + · exact ⟨k₁, hk₁, i₁, hk⟩ + +/-- If no bridge inside `D` joins the inside of `T` to the inside of `Q`, then the edges on the `Q` +side form a side of a separation with `x` and `y` as its middle. By 3-connectivity that side is a +single path `Q`, which leaves no room for `g`. -/ +theorem caseB {G₀ : Graph S (Set S)} {P : Set S → Graph S (Set S)} (hS : IsClosedSurface S) + (h : SubData J.toGraph G₀ P) (hE : Env J C₀ Δ c) (hc : Cand J C₀ Δ c g D D' T Q) + (hno : ∀ e ∈ MM J D T Q, Att J D T Q T e → Att J D T Q Q e → False) : False := by + classical + set X : Set (Set S) := {e | e ∈ Q.edges} ∪ {e | e ∈ MM J D T Q ∧ ¬ Att J D T Q T e} with hX + have hedgeJ : ∀ e ∈ Q.edges, e ∈ J.E := fun e he => hE.sub.2 (hc.QC e he) + have hXE : X ⊆ E(J.toGraph) := by + rintro e (he | he) + · exact hedgeJ e he + · exact he.1.1 + have hgM : g ∈ MM J D T Q := ⟨hc.gE, hc.gD, hc.gT, hc.gQ⟩ + have hgX : g ∈ X := Or.inr ⟨hgM, fun hatt => hc.gc (hc.att_c hE hgM hatt)⟩ + have hbd : bdry J.toGraph X ⊆ {x, y} := by + rintro v ⟨⟨a, ha, hia⟩, f, ⟨hfE, hfX⟩, hif⟩ + by_contra hvxy + have hvx : v ≠ x := fun h' => hvxy (Or.inl h') + have hvy : v ≠ y := fun h' => hvxy (Or.inr h') + have hfQ : f ∉ Q.edges := fun h' => hfX (Or.inl h') + have key : f ∈ MM J D T Q → Att J D T Q T f := fun hfM => by + by_contra hn + exact hfX (Or.inr ⟨hfM, hn⟩) + rcases ha with haQ | ⟨haM, hna⟩ + · have hvQ : v ∈ Q.support := inc_mem_support Q haQ hia + have hvT : v ∉ T.support := fun hvT => (hc.cap v hvT hvQ).elim hvx hvy + have fM := hc.mem_MM hS hE hvT (hc.wQ_sub (mem_wU_of_support hvQ)) hfE hif hfQ + exact hno f fM (key fM) ⟨f, mem_cls_self, v, hvQ, hvx, hvy, hif⟩ + · by_cases hvT : v ∈ T.support + · exact hna ⟨a, mem_cls_self, v, hvT, hvx, hvy, hia⟩ + · have hvD : v ∈ D := closure_minimal haM.2.1 hc.disc.isClosed (mem_closure_of_inc hia) + have fM := hc.mem_MM hS hE hvT hvD hfE hif hfQ + have hatt := key fM + by_cases hvQ : v ∈ Q.support + · exact hno f fM hatt ⟨f, mem_cls_self, v, hvQ, hvx, hvy, hif⟩ + · have hvB : v ∉ BB T Q := fun h' => h'.elim hvT hvQ + have hfa : f ∈ icls J D T Q a := + Relation.ReflTransGen.single ⟨haM, fM, v, hvB, hia, hif⟩ + obtain ⟨p, hp, r⟩ := hatt + exact hna ⟨p, cls_trans hfa hp, r⟩ + obtain ⟨hx₀, ⟨t, ht, it⟩, k, hk, ik, hkQ⟩ := hc.start_data h hE + obtain ⟨hy₀, -⟩ := hc.symm.start_data h hE + have htc := hE.cE t (hc.Tc t ht) + have htn : t ∉ X := by + rintro (h' | h') + · exact htc.2 (hc.QC t h') + · exact h'.1.2.2.1 ht + have hkn : k ∉ X := by + rintro (h' | h') + · exact hkQ h' + · exact hc.MM_not_C h'.1 hk + have hpair : ({x, y} : Set S).ncard = 2 := Set.ncard_pair hc.ne + obtain ⟨e, he, heq | heq⟩ := h.sep hXE + (hbd.trans (by rintro p (rfl | rfl); exacts [hx₀, hy₀])) + (by rw [← hpair]; exact Set.ncard_le_ncard hbd (Set.toFinite _)) ⟨g, hgX⟩ ⟨t, htc.1, htn⟩ + · have hsub := h.thread_subset he hx₀ hy₀ hc.ne Q hc.hQ fun a ha => by + rw [← heq] + exact Or.inl ha + exact hc.gQ (hsub (heq ▸ hgX)) + · have ht' : t ∈ E(J.toGraph) \ X := ⟨htc.1, htn⟩ + have hk' : k ∈ E(J.toGraph) \ X := ⟨hE.sub.2 hk, hkn⟩ + rw [heq] at ht' hk' + have := h.eq_of_end he hx₀ ht' hk' it ik + exact htc.2 (this ▸ hk) + +/-- A path `R` in the bridge `c` from the inside of `T` to the inside of `Q` cuts `D` in two. The +part +that holds `g` is a smaller candidate. -/ +theorem shrink (hc : Cand J C₀ Δ c g D D' T Q) {z w : S} + {T₁ : GraphWalk J.toGraph x z} {T₂ : GraphWalk J.toGraph z y} + {Q₁ : GraphWalk J.toGraph x w} {Q₂ : GraphWalk J.toGraph w y} {R : GraphWalk J.toGraph z w} + (hTu : wU J T = wU J T₁ ∪ wU J T₂) (hQu : wU J Q = wU J Q₁ ∪ wU J Q₂) + (hsT₁ : T₁.IsSimple) (hsQ₁ : Q₁.IsSimple) (hsR : R.IsSimple) + (hT₁ : ∀ p, p ∈ T₁.support → p ∈ T.support) (hT₁e : ∀ e, e ∈ T₁.edges → e ∈ T.edges) + (hT₂ : ∀ p, p ∈ T₂.support → p ∈ T.support) + (hQ₁ : ∀ p, p ∈ Q₁.support → p ∈ Q.support) (hQ₁e : ∀ e, e ∈ Q₁.edges → e ∈ Q.edges) + (hQ₂ : ∀ p, p ∈ Q₂.support → p ∈ Q.support) + (hTcap : ∀ p, p ∈ T₁.support → p ∈ T₂.support → p = z) + (hRin : ∀ p ∈ R.support, (p ∉ T.support ∧ p ∉ Q.support) ∨ p = z ∨ p = w) + (hRc : ∀ e ∈ R.edges, e ∈ c) (hRT : ∀ e ∈ R.edges, e ∉ T.edges) + (hRQ : ∀ e ∈ R.edges, e ∉ Q.edges) + (hzy : z ≠ y) (hwx : w ≠ x) (hwT : w ∉ T.support) (hzQ : z ∉ Q.support) + {E₁ E₂ : Set S} (hE₁ : IsClosedDisc E₁) (hE₂ : IsClosedDisc E₂) (hun : E₁ ∪ E₂ = D) + (hint : E₁ ∩ E₂ = wU J R) (hb₁ : discBd E₁ = (wU J T₁ ∪ wU J Q₁) ∪ wU J R) + (hb₂ : discBd E₂ = (wU J T₂ ∪ wU J Q₂) ∪ wU J R) (hg : g ⊆ E₁) : + Cand J C₀ Δ c g E₁ (E₂ ∪ D') (T₁.append R) Q₁ ∧ + {e | e ∈ J.E ∧ e ⊆ E₁} ⊂ {e | e ∈ J.E ∧ e ⊆ D} := by + have hsub₁ : E₁ ⊆ D := hun ▸ subset_union_left + have hb₁' : discBd E₁ ⊆ E₁ := Surface.discBd_subset _ + have hb₂' : discBd E₂ ⊆ E₂ := Surface.discBd_subset _ + have hTinE₁ : wU J T₁ ⊆ E₁ := fun p hp => hb₁' (hb₁ ▸ Or.inl (Or.inl hp)) + have hQinE₁ : wU J Q₁ ⊆ E₁ := fun p hp => hb₁' (hb₁ ▸ Or.inl (Or.inr hp)) + have hTinE₂ : wU J T₂ ⊆ E₂ := fun p hp => hb₂' (hb₂ ▸ Or.inl (Or.inl hp)) + have hQinE₂ : wU J Q₂ ⊆ E₂ := fun p hp => hb₂' (hb₂ ▸ Or.inl (Or.inr hp)) + have hRC : ∀ p, p ∈ wU J R → p ∈ C₀.U → p = w := by + intro p hp hpC + have hRD : p ∈ D := hsub₁ (hb₁' (hb₁ ▸ Or.inr hp)) + have hpQ : p ∈ wU J Q := hc.Qbd ▸ ⟨hpC, hRD⟩ + have hm : p ∈ wU J R ∩ wU J Q := ⟨hp, hpQ⟩ + rw [wU_inter hRQ] at hm + rcases hRin p hm.1 with h' | h' | h' + · exact (h'.2 hm.2).elim + · exact (hzQ (h' ▸ hm.2)).elim + · exact h' + have hwQ₁ : w ∈ wU J Q₁ := mem_wU_of_support Q₁.end_mem_support + have hyT₁ : y ∉ wU J T₁ := by + intro hy + have hyJ : y ∈ J.V := T.mem_vertexSet_of_mem_support T.end_mem_support + exact hzy (hTcap y (support_of_wU hy hyJ) T₂.end_mem_support).symm + refine ⟨?_, ⟨fun e he => ⟨he.1, he.2.trans hsub₁⟩, fun hle => ?_⟩⟩ + · refine ⟨hwx.symm, isSimple_append T₁ R hsT₁ hsR ?_, hsQ₁, hE₁, hE₂.isClosed.union hc.closed, + ?_, ?_, ?_, ?_, ?_, ?_, ?_, hc.gE, hg, ?_, ?_, hc.gc⟩ + · intro p h₁ h₂ + rcases hRin p h₂ with h' | h' | h' + · exact (h'.1 (hT₁ p h₁)).elim + · exact h' + · exact (hwT (h' ▸ hT₁ p h₁)).elim + · rw [← union_assoc, hun] + exact hc.union + · rw [wU_append, inter_union_distrib_left, hint] + refine Subset.antisymm ?_ ?_ + · rintro p (hp | ⟨hp₁, hp₂⟩) + · exact Or.inr hp + · have hpT : p ∈ wU J T := hc.inter ▸ ⟨hsub₁ hp₁, hp₂⟩ + rw [hTu] at hpT + rcases hpT with h' | h' + · exact Or.inl h' + · exact Or.inr (hint ▸ ⟨hp₁, hTinE₂ h'⟩) + · rintro p (hp | hp) + · have hpT : p ∈ D ∩ D' := by + rw [hc.inter, hTu] + exact Or.inl hp + exact Or.inr ⟨hTinE₁ hp, hpT.2⟩ + · exact Or.inl hp + · rw [hb₁, wU_append] + ext p + simp only [mem_union] + tauto + · intro e he + rw [GraphWalk.edges_append, List.mem_append] at he + rcases he with he | he + · exact hc.Tc e (hT₁e e he) + · exact hRc e he + · exact fun e he => hc.QC e (hQ₁e e he) + · rw [wU_append] + refine Subset.antisymm ?_ ?_ + · rintro p ⟨hp | hp, hpC⟩ + · have hm : p ∈ wU J T ∩ C₀.U := ⟨hTu ▸ Or.inl hp, hpC⟩ + rw [hc.Tbd] at hm + rcases hm with h' | h' + · exact Or.inl h' + · exact (hyT₁ (h' ▸ hp)).elim + · exact Or.inr (hRC p hp hpC) + · rintro p (rfl | rfl) + · refine ⟨Or.inl (mem_wU_of_support T₁.start_mem_support), ?_⟩ + exact hc.wQ_sub_C (hQu ▸ Or.inl (mem_wU_of_support Q₁.start_mem_support)) + · exact ⟨Or.inr (mem_wU_of_support R.end_mem_support), + hc.wQ_sub_C (hQu ▸ Or.inl hwQ₁)⟩ + · refine Subset.antisymm ?_ ?_ + · rintro p ⟨hpC, hpE⟩ + have hpQ : p ∈ wU J Q := hc.Qbd ▸ ⟨hpC, hsub₁ hpE⟩ + rw [hQu] at hpQ + rcases hpQ with h' | h' + · exact h' + · have hpR : p ∈ wU J R := hint ▸ ⟨hpE, hQinE₂ h'⟩ + exact (hRC p hpR hpC) ▸ hwQ₁ + · exact fun p hp => ⟨hc.wQ_sub_C (hQu ▸ Or.inl hp), hQinE₁ hp⟩ + · rw [GraphWalk.edges_append, List.mem_append] + rintro (h' | h') + · exact hc.gT (hT₁e g h') + · exact hc.gc (hRc g h') + · exact fun h' => hc.gQ (hQ₁e g h') + · obtain ⟨t, ht, -⟩ := exists_edge_at_start T₂ hzy + have htJ : t ∈ J.E := (walkDrawing_isSubdrawing J T₂).2 (by rw [walkDrawing_E]; exact ht) + have htE₂ : t ⊆ E₂ := (subset_wU ht).trans hTinE₂ + have htD : t ⊆ D := htE₂.trans (hun ▸ subset_union_right) + have htE₁ : t ⊆ E₁ := (hle ⟨htJ, htD⟩).2 + obtain ⟨p, hp⟩ : t.Nonempty := htJ.1 + have htR : t ∈ R.edges := edge_mem_of_meets htJ hp (hint ▸ ⟨htE₁ hp, htE₂ hp⟩) + have htT : t ∈ T.edges := by + by_contra hn + have hdis := edge_disjoint_U (walkDrawing_isSubdrawing J T) htJ + (by rw [walkDrawing_E]; exact hn) + apply Set.disjoint_left.mp hdis hp + change p ∈ wU J T + rw [hTu] + exact Or.inr (subset_wU ht hp) + exact hRT t htR htT + +omit [T2Space S] in +/-- The support of a walk lies in a closed set that holds its start and its edges. -/ +theorem support_subset_of_edges {X : Set S} (hX : IsClosed X) {a b : S} + (W : GraphWalk J.toGraph a b) (ha : a ∈ X) (hW : ∀ e ∈ W.edges, e ⊆ X) : + ∀ p ∈ W.support, p ∈ X := by + induction W with + | nil _ => + intro p hp + simp only [GraphWalk.support, List.mem_singleton] at hp + exact hp ▸ ha + | @cons u v w f hl rest ih => + intro p hp + have hf : f ⊆ X := hW f (by simp [GraphWalk.edges]) + have hv : v ∈ X := closure_minimal hf hX (mem_closure_of_inc ⟨u, hl.symm⟩) + rcases List.mem_cons.mp hp with rfl | hp + · exact ha + · exact ih hv (fun e he => hW e (List.mem_cons_of_mem _ he)) p hp + +/-- There is no candidate. The proof takes one with the fewest edges in `D`. -/ +theorem false_aux {G₀ : Graph S (Set S)} {P : Set S → Graph S (Set S)} (hS : IsClosedSurface S) + (h : SubData J.toGraph G₀ P) (hE : Env J C₀ Δ c) : + ∀ n : ℕ, ∀ (D D' : Set S) (x y : S) (T Q : GraphWalk J.toGraph x y), + Cand J C₀ Δ c g D D' T Q → {e | e ∈ J.E ∧ e ⊆ D}.ncard = n → False := by + intro n + induction n using Nat.strong_induction_on with + | _ n ih => + intro D D' x y T Q hc hn + by_cases hex : ∃ e ∈ MM J D T Q, Att J D T Q T e ∧ Att J D T Q Q e + swap + · exact hc.caseB hS h hE fun e he h₁ h₂ => hex ⟨e, he, h₁, h₂⟩ + obtain ⟨e, heM, hatT, hatQ⟩ := hex + have hnl : ∀ (e : Set S) (u : S), ¬ J.toGraph.IsLink e u u := fun e u => fun hl => no_loop h hl + obtain ⟨f₁, hf₁, z, hzT, hzx, hzy, iz⟩ := hatT + obtain ⟨f₂, hf₂, w, hwQ, hwx, hwy, iw⟩ := hatQ + obtain ⟨z', hl⟩ := id iz + have hf₁M : f₁ ∈ MM J D T Q := cls_subset heM hf₁ + have hf₁c : f₁ ∈ c := hc.att_c hE hf₁M ⟨f₁, mem_cls_self, z, hzT, hzx, hzy, iz⟩ + obtain ⟨W, hWe, hWs⟩ := exists_walk_in_cls hf₁M (mem_cls_self (e := f₁)) hl + (cls_trans (cls_symm hf₁) hf₂) iw + obtain ⟨R, hsR, hRs, hRe⟩ := GM09.exists_isSimple_subwalk W + have hRM : ∀ a ∈ R.edges, a ∈ MM J D T Q := fun a ha => cls_subset hf₁M (hWe a (hRe a ha)) + have hRc : ∀ a ∈ R.edges, a ∈ c := fun a ha => hc.cls_sub hE hf₁c (hWe a (hRe a ha)) + have hRin : ∀ p ∈ R.support, (p ∉ T.support ∧ p ∉ Q.support) ∨ p = z ∨ p = w := by + intro p hp + rcases hWs p (hRs p hp) with h' | h' + · exact Or.inl ⟨fun h₁ => h' (Or.inl h₁), fun h₁ => h' (Or.inr h₁)⟩ + · exact Or.inr h' + obtain ⟨T₁, T₂, hTa⟩ := T.exists_append_of_mem hzT + obtain ⟨Q₁, Q₂, hQa⟩ := Q.exists_append_of_mem hwQ + have hTs := hc.hT + have hQs := hc.hQ + rw [hTa] at hTs + rw [hQa] at hQs + obtain ⟨hsT₁, hsT₂⟩ := GM09.isSimple_of_append hTs + obtain ⟨hsQ₁, hsQ₂⟩ := GM09.isSimple_of_append hQs + have hTcap := append_cap hTs + have hQcap := append_cap hQs + have hTm : ∀ p, p ∈ T.support ↔ p ∈ T₁.support ∨ p ∈ T₂.support := fun p => by + rw [hTa, GraphWalk.mem_support_append] + have hQm : ∀ p, p ∈ Q.support ↔ p ∈ Q₁.support ∨ p ∈ Q₂.support := fun p => by + rw [hQa, GraphWalk.mem_support_append] + have hTe : ∀ a, a ∈ T.edges ↔ a ∈ T₁.edges ∨ a ∈ T₂.edges := fun a => by + rw [hTa, GraphWalk.edges_append, List.mem_append] + have hQe : ∀ a, a ∈ Q.edges ↔ a ∈ Q₁.edges ∨ a ∈ Q₂.edges := fun a => by + rw [hQa, GraphWalk.edges_append, List.mem_append] + have hTu : wU J T = wU J T₁ ∪ wU J T₂ := by rw [hTa, wU_append] + have hQu : wU J Q = wU J Q₁ ∪ wU J Q₂ := by rw [hQa, wU_append] + have hzQ : z ∉ Q.support := fun h' => (hc.cap z hzT h').elim hzx hzy + have hwT : w ∉ T.support := fun h' => (hc.cap w h' hwQ).elim hwx hwy + have hzw : z ≠ w := fun h' => hwT (h' ▸ hzT) + have hTQe : ∀ a ∈ T.edges, a ∉ Q.edges := fun a ha ha' => (hE.cE a (hc.Tc a ha)).2 (hc.QC a ha') + set A := T₁.reverse.append Q₁ with hA + set B := T₂.append Q₂.reverse with hB + have hsA : A.IsSimple := by + refine isSimple_append _ _ hsT₁.reverse hsQ₁ fun p h₁ h₂ => ?_ + rw [GraphWalk.support_reverse, List.mem_reverse] at h₁ + rcases hc.cap p ((hTm p).mpr (Or.inl h₁)) ((hQm p).mpr (Or.inl h₂)) with h' | h' + · exact h' + · subst h' + exact (hzy (hTcap _ h₁ T₂.end_mem_support).symm).elim + have hsB : B.IsSimple := by + refine isSimple_append _ _ hsT₂ hsQ₂.reverse fun p h₁ h₂ => ?_ + rw [GraphWalk.support_reverse, List.mem_reverse] at h₂ + rcases hc.cap p ((hTm p).mpr (Or.inr h₁)) ((hQm p).mpr (Or.inr h₂)) with h' | h' + · subst h' + exact (hzx (hTcap _ T₁.start_mem_support h₁).symm).elim + · exact h' + have hAu : wU J A = wU J T₁ ∪ wU J Q₁ := by rw [hA, wU_append, wU_reverse] + have hBu : wU J B = wU J T₂ ∪ wU J Q₂ := by rw [hB, wU_append, wU_reverse] + have hAs : ∀ p, p ∈ A.support ↔ p ∈ T₁.support ∨ p ∈ Q₁.support := fun p => by + rw [hA, GraphWalk.mem_support_append, GraphWalk.support_reverse, List.mem_reverse] + have hBs : ∀ p, p ∈ B.support ↔ p ∈ T₂.support ∨ p ∈ Q₂.support := fun p => by + rw [hB, GraphWalk.mem_support_append, GraphWalk.support_reverse, List.mem_reverse] + have hAe : ∀ a, a ∈ A.edges ↔ a ∈ T₁.edges ∨ a ∈ Q₁.edges := fun a => by + rw [hA, GraphWalk.edges_append, GraphWalk.edges_reverse, List.mem_append, List.mem_reverse] + have hBe : ∀ a, a ∈ B.edges ↔ a ∈ T₂.edges ∨ a ∈ Q₂.edges := fun a => by + rw [hB, GraphWalk.edges_append, GraphWalk.edges_reverse, List.mem_append, List.mem_reverse] + have hABe : ∀ a ∈ A.edges, a ∉ B.edges := by + intro a ha hb + rcases (hAe a).mp ha with h₁ | h₁ <;> rcases (hBe a).mp hb with h₂ | h₂ + · exact edge_not_mem_of_cap hnl hTcap h₁ h₂ + · exact hTQe a ((hTe a).mpr (Or.inl h₁)) ((hQe a).mpr (Or.inr h₂)) + · exact hTQe a ((hTe a).mpr (Or.inr h₂)) ((hQe a).mpr (Or.inl h₁)) + · exact edge_not_mem_of_cap hnl hQcap h₁ h₂ + have hAB : wU J A ∩ wU J B = {z, w} := by + rw [wU_inter hABe] + refine Subset.antisymm ?_ ?_ + · rintro p ⟨h₁, h₂⟩ + rcases (hAs p).mp h₁ with h₁ | h₁ <;> rcases (hBs p).mp h₂ with h₂ | h₂ + · exact Or.inl (hTcap p h₁ h₂) + · rcases hc.cap p ((hTm p).mpr (Or.inl h₁)) ((hQm p).mpr (Or.inr h₂)) with rfl | rfl + · exact (hwx (hQcap _ Q₁.start_mem_support h₂).symm).elim + · exact (hzy (hTcap _ h₁ T₂.end_mem_support).symm).elim + · rcases hc.cap p ((hTm p).mpr (Or.inr h₂)) ((hQm p).mpr (Or.inl h₁)) with rfl | rfl + · exact (hzx (hTcap _ T₁.start_mem_support h₂).symm).elim + · exact (hwy (hQcap _ h₁ Q₂.end_mem_support).symm).elim + · exact Or.inr (hQcap p h₁ h₂) + · rintro p (rfl | rfl) + · exact ⟨A.start_mem_support, B.start_mem_support⟩ + · exact ⟨A.end_mem_support, B.end_mem_support⟩ + have hRA : ∀ a ∈ R.edges, a ∉ A.edges := fun a ha h' => by + rcases (hAe a).mp h' with h₁ | h₁ + · exact (hRM a ha).2.2.1 ((hTe a).mpr (Or.inl h₁)) + · exact (hRM a ha).2.2.2 ((hQe a).mpr (Or.inl h₁)) + have hRB : ∀ a ∈ R.edges, a ∉ B.edges := fun a ha h' => by + rcases (hBe a).mp h' with h₁ | h₁ + · exact (hRM a ha).2.2.1 ((hTe a).mpr (Or.inr h₁)) + · exact (hRM a ha).2.2.2 ((hQe a).mpr (Or.inr h₁)) + have hcapR : ∀ {a b : S} {X : GraphWalk J.toGraph z w}, (∀ p ∈ X.support, p ∈ BB T Q) → + (∀ e ∈ R.edges, e ∉ X.edges) → wU J R ∩ wU J X = {z, w} := by + intro _ _ X hX hEd + rw [wU_inter hEd] + refine Subset.antisymm ?_ ?_ + · rintro p ⟨h₁, h₂⟩ + rcases hRin p h₁ with h' | h' + · exact ((hX p h₂).elim h'.1 h'.2).elim + · exact h' + · rintro p (rfl | rfl) + · exact ⟨R.start_mem_support, X.start_mem_support⟩ + · exact ⟨R.end_mem_support, X.end_mem_support⟩ + have hAB' : ∀ p ∈ A.support, p ∈ BB T Q := fun p hp => by + rcases (hAs p).mp hp with h' | h' + · exact Or.inl ((hTm p).mpr (Or.inl h')) + · exact Or.inr ((hQm p).mpr (Or.inl h')) + have hBB' : ∀ p ∈ B.support, p ∈ BB T Q := fun p hp => by + rcases (hBs p).mp hp with h' | h' + · exact Or.inl ((hTm p).mpr (Or.inr h')) + · exact Or.inr ((hQm p).mpr (Or.inr h')) + have hbdD : discBd D = wU J A ∪ wU J B := by + rw [hc.bd, hTu, hQu, hAu, hBu] + ext p + simp only [mem_union] + tauto + have hRD : wU J R ⊆ D := by + intro p hp + rcases (mem_walkDrawing_U J R).mp hp with h' | ⟨a, ha, hpa⟩ + · exact support_subset_of_edges hc.disc.isClosed R + (hc.wT_sub (mem_wU_of_support hzT)) (fun a ha => (hRM a ha).2.1) p h' + · exact closure_minimal (hRM a ha).2.1 hc.disc.isClosed hpa + obtain ⟨E₁, E₂, hE₁, hE₂, hun, hint, hb₁, hb₂⟩ := disc_split hc.disc (wU_line hsR hzw) + (wU_line hsA hzw) (wU_line hsB hzw) hAB (hcapR (a := z) (b := w) hAB' hRA) + (hcapR (a := z) (b := w) hBB' hRB) hbdD hRD hzw + have hgR : g ∉ R.edges := fun h' => hc.gc (hRc g h') + have hgoff := hc.offE hc.gE hc.gT hc.gQ + have hgdis : Disjoint g (discBd E₁) := by + rw [hb₁] + refine Set.disjoint_union_right.mpr ⟨?_, edge_disjoint_U (walkDrawing_isSubdrawing J R) hc.gE + (by rw [walkDrawing_E]; exact hgR)⟩ + exact Set.disjoint_of_subset_right (fun p hp => hbdD ▸ Or.inl hp) hgoff + have hfin : {e | e ∈ J.E ∧ e ⊆ D}.Finite := J.finite_edges.subset fun e he => he.1 + rcases edge_side hS hE₁ hc.gE hgdis with h' | h' + · obtain ⟨hc', hss⟩ := hc.shrink hTu hQu hsT₁ hsQ₁ hsR + (fun p hp => (hTm p).mpr (Or.inl hp)) (fun a ha => (hTe a).mpr (Or.inl ha)) + (fun p hp => (hTm p).mpr (Or.inr hp)) + (fun p hp => (hQm p).mpr (Or.inl hp)) (fun a ha => (hQe a).mpr (Or.inl ha)) + (fun p hp => (hQm p).mpr (Or.inr hp)) hTcap hRin hRc (fun a ha => (hRM a ha).2.2.1) + (fun a ha => (hRM a ha).2.2.2) hzy hwx hwT hzQ hE₁ hE₂ hun hint (by rw [hb₁, hAu]) + (by rw [hb₂, hBu]) h' + exact ih _ (hn ▸ Set.ncard_lt_ncard hss hfin) _ _ _ _ _ _ hc' rfl + · have hgE₂ : g ⊆ E₂ := by + intro p hp + have : p ∈ E₁ ∪ E₂ := by rw [hun]; exact hc.gD hp + exact this.resolve_left (Set.disjoint_left.mp h' hp) + have hrevT : ∀ p, p ∈ T.reverse.support ↔ p ∈ T.support := fun p => by + rw [GraphWalk.support_reverse, List.mem_reverse] + have hrevQ : ∀ p, p ∈ Q.reverse.support ↔ p ∈ Q.support := fun p => by + rw [GraphWalk.support_reverse, List.mem_reverse] + have hrevTe : ∀ a, a ∈ T.reverse.edges ↔ a ∈ T.edges := fun a => by + rw [GraphWalk.edges_reverse, List.mem_reverse] + have hrevQe : ∀ a, a ∈ Q.reverse.edges ↔ a ∈ Q.edges := fun a => by + rw [GraphWalk.edges_reverse, List.mem_reverse] + have hms : ∀ {a b : S} {W : GraphWalk J.toGraph a b} {p : S}, + p ∈ W.reverse.support → p ∈ W.support := fun {a b W p} hp => by + rwa [GraphWalk.support_reverse, List.mem_reverse] at hp + have hme : ∀ {a b : S} {W : GraphWalk J.toGraph a b} {p : Set S}, + p ∈ W.reverse.edges → p ∈ W.edges := fun {a b W p} hp => by + rwa [GraphWalk.edges_reverse, List.mem_reverse] at hp + obtain ⟨hc', hss⟩ := hc.symm.shrink (T₁ := T₂.reverse) (T₂ := T₁.reverse) + (Q₁ := Q₂.reverse) (Q₂ := Q₁.reverse) (R := R) + (by rw [wU_reverse, wU_reverse, wU_reverse, hTu, union_comm]) + (by rw [wU_reverse, wU_reverse, wU_reverse, hQu, union_comm]) + hsT₂.reverse hsQ₂.reverse hsR + (fun p hp => (hrevT p).mpr ((hTm p).mpr (Or.inr (hms hp)))) + (fun a ha => (hrevTe a).mpr ((hTe a).mpr (Or.inr (hme ha)))) + (fun p hp => (hrevT p).mpr ((hTm p).mpr (Or.inl (hms hp)))) + (fun p hp => (hrevQ p).mpr ((hQm p).mpr (Or.inr (hms hp)))) + (fun a ha => (hrevQe a).mpr ((hQe a).mpr (Or.inr (hme ha)))) + (fun p hp => (hrevQ p).mpr ((hQm p).mpr (Or.inl (hms hp)))) + (fun p h₁ h₂ => hTcap p (hms h₂) (hms h₁)) + (fun p hp => by + rcases hRin p hp with h₁ | h₁ + · exact Or.inl ⟨fun h₂ => h₁.1 ((hrevT p).mp h₂), fun h₂ => h₁.2 ((hrevQ p).mp h₂)⟩ + · exact Or.inr h₁) + hRc (fun a ha h₂ => (hRM a ha).2.2.1 ((hrevTe a).mp h₂)) + (fun a ha h₂ => (hRM a ha).2.2.2 ((hrevQe a).mp h₂)) hzx hwy + (fun h₂ => hwT ((hrevT w).mp h₂)) (fun h₂ => hzQ ((hrevQ z).mp h₂)) hE₂ hE₁ + ((union_comm _ _).trans hun) ((inter_comm _ _).trans hint) + (by rw [hb₂, hBu, wU_reverse, wU_reverse]) + (by rw [hb₁, hAu, wU_reverse, wU_reverse]) hgE₂ + exact ih _ (hn ▸ Set.ncard_lt_ncard hss hfin) _ _ _ _ _ _ hc' rfl + +end Cand + +/-- A path of `J` from a subdrawing is a walk of `J` with the same point set and edges. -/ +theorem exists_walk_of_path {P : Drawing S} {a b : S} (hP : P.IsPathBetween a b) + (hs : P.IsSubdrawing J) : + ∃ W : GraphWalk J.toGraph a b, W.IsSimple ∧ wU J W = P.U ∧ (∀ e ∈ W.edges, e ∈ P.E) ∧ + ∀ p ∈ W.support, p ∈ P.V := by + obtain ⟨W, hW, hV, hE⟩ := hP + obtain ⟨W', hs', he'⟩ := hs.exists_walk_up W + have hsim : W'.IsSimple := by unfold GraphWalk.IsSimple; rw [hs']; exact hW + refine ⟨W', hsim, ?_, ?_, ?_⟩ + · change (walkDrawing J W').U = P.U + rw [Drawing.U_eq (Γ := walkDrawing J W'), Drawing.U_eq (Γ := P), walkDrawing_V, + walkDrawing_E, hV, + hE, hs', he'] + · intro e he + rw [hE, ← he'] + exact he + · intro p hp + rw [hV, ← hs'] + exact hp + +/-- The first candidate. -/ +theorem start_cand {x y : S} {g E₁ E₂ : Set S} + {W P₁ : GraphWalk J.toGraph x y} (hxy : x ≠ y) (hsW : W.IsSimple) (hsP : P₁.IsSimple) + (hE₁ : IsClosedDisc E₁) (hE₂ : IsClosed E₂) (hun : E₁ ∪ E₂ = Δ) (hint : E₁ ∩ E₂ = wU J W) + (hb₁ : discBd E₁ = wU J W ∪ wU J P₁) (hWc : ∀ e ∈ W.edges, e ∈ c) + (hP₁ : ∀ e ∈ P₁.edges, e ∈ C₀.E) {X : Set S} (hC : C₀.U = wU J P₁ ∪ X) (hX : X ⊆ E₂) + (hXcap : ∀ p ∈ X, p ∈ wU J W → p ∈ wU J P₁) + (hWcap : wU J W ∩ C₀.U = {x, y}) (hgJ : g ∈ J.E) (hgD : g ⊆ E₁) (hgC : g ∉ C₀.E) + (hgc : g ∉ c) : Cand J C₀ Δ c g E₁ E₂ W P₁ := by + refine ⟨hxy, hsW, hsP, hE₁, hE₂, hun, hint, hb₁, hWc, hP₁, hWcap, ?_, hgJ, hgD, + fun h' => hgc (hWc g h'), fun h' => hgC (hP₁ g h'), hgc⟩ + refine Subset.antisymm ?_ ?_ + · rintro p ⟨hpC, hpE⟩ + rw [hC] at hpC + rcases hpC with h' | h' + · exact h' + · exact hXcap p h' (hint ▸ ⟨hpE, hX h'⟩) + · intro p hp + refine ⟨hC ▸ Or.inl hp, Surface.discBd_subset _ (hb₁ ▸ Or.inr hp)⟩ + +/-- **A circuit with all of `J` on one side is peripheral.** Here `Δ` is a closed disc with boundary +the circuit, and it holds all of `J`. -/ +theorem peripheral_of_side {G₀ : Graph S (Set S)} {P : Set S → Graph S (Set S)} + (hS : IsClosedSurface S) (h : SubData J.toGraph G₀ P) (hC : C₀.IsCircuit) + (hs : C₀.IsSubdrawing J) (hΔ : IsClosedDisc Δ) (hb : discBd Δ = C₀.U) (hU : J.U ⊆ Δ) : + IsPeripheral J C₀ := by + classical + intro e he f hf + by_contra hn + set c := cls J.toGraph C₀.V (J.E \ C₀.E) e with hcdef + have hcsub : c ⊆ J.E \ C₀.E := cls_subset he + have hEnv : Env J C₀ Δ c := ⟨hC, hs, hU, fun a ha => hcsub ha, fun a b ha hab => cls_step ha hab⟩ + have hCne : C₀.E.Nonempty := by + obtain ⟨u, W, -, hpos, -, hE⟩ := id hC + cases W with + | nil _ => simp [GraphWalk.length] at hpos + | @cons _ m _ a hl rest => + exact ⟨a, by rw [hE]; simp [GraphWalk.edges]⟩ + obtain ⟨x, y, W, hxy, hsW, hx, hy, -, -, hEc, hin⟩ := h.exists_ear (Hv := C₀.V) (Hs := C₀.E) + hs.2 hCne + (fun a ha v hv => by + have hm : v ∈ closure a ∩ J.V := ⟨mem_closure_of_inc hv, hv.vertex_mem⟩ + rw [← hs.closure_inter_V ha] at hm + exact hm.2) + (fun v hv a ha han hia => by + obtain ⟨p, hp, q, hq, hpq, ip, iq⟩ := circuit_two_edges h hC hs hv + exact h.mem_V₀_of_three (hs.2 hp) (hs.2 hq) ha ip iq hia hpq + (fun h' => han (h' ▸ hp)) (fun h' => han (h' ▸ hq))) + he.1 he.2 + obtain ⟨P₁, P₂, hP₁, hP₂, hsP₁, hsP₂, -, -, hPV, hPd, hsup⟩ := + Drawing.IsCircuit.exists_two_paths hC hx hy hxy + obtain ⟨X₁, hX₁s, hX₁U, hX₁E, hX₁V⟩ := exists_walk_of_path hP₁ (hsP₁.trans hs) + obtain ⟨X₂, hX₂s, hX₂U, hX₂E, hX₂V⟩ := exists_walk_of_path hP₂ (hsP₂.trans hs) + have hCU : C₀.U = wU J X₁ ∪ wU J X₂ := by + have := sup_U (J := C₀) hsP₁ hsP₂ + rw [hsup] at this + rw [this, hX₁U, hX₂U] + have hc₁₂ : wU J X₁ ∩ wU J X₂ = {x, y} := by + rw [hX₁U, hX₂U, U_inter_of_disjoint hsP₁ hsP₂ hPd, hPV] + have hWoff : ∀ a ∈ W.edges, a ∉ C₀.E := fun a ha => (hcsub (hEc a ha)).2 + have hcapX : ∀ {X : GraphWalk J.toGraph x y}, (∀ a ∈ X.edges, a ∈ C₀.E) → + (∀ p ∈ X.support, p ∈ C₀.V) → wU J W ∩ wU J X = {x, y} := by + intro X h₁ h₂ + rw [wU_inter fun a ha h' => hWoff a ha (h₁ a h')] + refine Subset.antisymm ?_ ?_ + · rintro p ⟨hp, hp'⟩ + rcases hin p hp with h' | h' + · exact (h' (h₂ p hp')).elim + · exact h' + · rintro p (rfl | rfl) + · exact ⟨W.start_mem_support, X.start_mem_support⟩ + · exact ⟨W.end_mem_support, X.end_mem_support⟩ + have hX₁C : ∀ a ∈ X₁.edges, a ∈ C₀.E := fun a ha => hsP₁.2 (hX₁E a ha) + have hX₂C : ∀ a ∈ X₂.edges, a ∈ C₀.E := fun a ha => hsP₂.2 (hX₂E a ha) + have hc₁ := hcapX hX₁C fun p hp => hsP₁.1 (hX₁V p hp) + have hc₂ := hcapX hX₂C fun p hp => hsP₂.1 (hX₂V p hp) + have hWsub : wU J W ⊆ J.U := (walkDrawing_isSubdrawing J W).U_subset + obtain ⟨E₁, E₂, hE₁, hE₂, hun, hint, hb₁, hb₂⟩ := disc_split hΔ (wU_line hsW hxy) + (wU_line hX₁s hxy) (wU_line hX₂s hxy) hc₁₂ hc₁ hc₂ (by rw [hb, hCU]) (hWsub.trans hU) hxy + have hWcap : wU J W ∩ C₀.U = {x, y} := by + rw [hCU, inter_union_distrib_left, hc₁, hc₂, union_self] + have hend : ∀ {X : GraphWalk J.toGraph x y}, ({x, y} : Set S) ⊆ wU J X := by + rintro X p (rfl | rfl) + · exact mem_wU_of_support X.start_mem_support + · exact mem_wU_of_support X.end_mem_support + have hfW : f ∉ W.edges := fun h' => hn (hEc f h') + have hfdis : Disjoint f (discBd E₁) := by + rw [hb₁] + refine Set.disjoint_union_right.mpr ⟨?_, edge_disjoint_U (walkDrawing_isSubdrawing J W) hf.1 + (by rw [walkDrawing_E]; exact hfW)⟩ + refine Set.disjoint_of_subset_right ?_ (edge_disjoint_U hs hf.1 hf.2) + exact fun p hp => hCU ▸ Or.inl hp + have hb₁' : discBd E₁ = wU J W ∪ wU J X₁ := by rw [hb₁, union_comm] + have hb₂' : discBd E₂ = wU J W ∪ wU J X₂ := by rw [hb₂, union_comm] + rcases edge_side hS hE₁ hf.1 hfdis with h' | h' + · have hX₂in : wU J X₂ ⊆ E₂ := fun p hp => Surface.discBd_subset _ (hb₂' ▸ Or.inr hp) + have hc := start_cand (Δ := Δ) (C₀ := C₀) hxy hsW hX₁s hE₁ hE₂.isClosed hun hint hb₁' hEc hX₁C + hCU hX₂in + (fun p h₁ h₂ => by + have : p ∈ wU J W ∩ wU J X₂ := ⟨h₂, h₁⟩ + rw [hc₂] at this + exact hend this) + hWcap hf.1 h' hf.2 hn + exact Cand.false_aux hS h hEnv _ _ _ _ _ _ _ hc rfl + · have hfE₂ : f ⊆ E₂ := by + intro p hp + have : p ∈ E₁ ∪ E₂ := by rw [hun]; exact hU (hf.1.2.1 hp).1 + exact this.resolve_left (Set.disjoint_left.mp h' hp) + have hX₁in : wU J X₁ ⊆ E₁ := fun p hp => Surface.discBd_subset _ (hb₁' ▸ Or.inr hp) + have hc := start_cand (Δ := Δ) (C₀ := C₀) hxy hsW hX₂s hE₂ hE₁.isClosed + ((union_comm _ _).trans hun) + ((inter_comm _ _).trans hint) hb₂' hEc hX₂C (by rw [hCU, union_comm]) hX₁in + (fun p h₁ h₂ => by + have : p ∈ wU J W ∩ wU J X₁ := ⟨h₂, h₁⟩ + rw [hc₁] at this + exact hend this) + hWcap hf.1 hfE₂ hf.2 hn + exact Cand.false_aux hS h hEnv _ _ _ _ _ _ _ hc rfl + +end Main + +end GraphMinor.GM14.Whitney diff --git a/LeanPool/GraphMinor/GM15/ChordMove.lean b/LeanPool/GraphMinor/GM15/ChordMove.lean new file mode 100644 index 0000000000..b738c6f9ba --- /dev/null +++ b/LeanPool/GraphMinor/GM15/ChordMove.lean @@ -0,0 +1,409 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Section3Parallel +public import LeanPool.GraphMinor.GM15.LineMove +import LeanPool.GraphMinor.Surface.Cap +import LeanPool.GraphMinor.Surface.DiscPolygon +import LeanPool.GraphMinor.Surface.TriPath +import LeanPool.GraphMinor.GM11.RadialChord + +/-! +# Moving disjoint lines onto vertical chords + +Graph Minors XV, (3.4), page 122, takes a drawing $H' = H \cup P_1 \cup \dots \cup P_{k-1}$ whose +paths cross the closed disc $\bar\Lambda$. The proof in `GraphMinor/GM15/Section3Parallel.lean` +works in a chart of $\bar\Lambda$ in which the paths are vertical chords of the unit disc. This +file shows that such a chart exists for any such paths: disjoint lines `M j` across the unit disc, +with the ends of the chord at `x j` and meeting the circle only there, are the images of the +chords under a homeomorphism of the unit disc that fixes the circle +(`exists_ballHomeo_moving_chords`). + +The proof moves one line at a time. After the first `n` lines are straight, the next line lies to +the left of the last straight chord, so it is moved onto its chord inside the closed left cap by +`exists_homeo_moving_line`, and the rest of the disc is fixed. +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +open Set Function Topology Metric Surface + +/-- `Φ` is a homeomorphism of the closed unit disc onto itself, with inverse `Φ'`, that fixes the +unit circle. -/ +structure IsBallHomeo (Φ Φ' : ℂ → ℂ) : Prop where + maps : MapsTo Φ (closedBall 0 1) (closedBall 0 1) + maps' : MapsTo Φ' (closedBall 0 1) (closedBall 0 1) + cont : ContinuousOn Φ (closedBall 0 1) + cont' : ContinuousOn Φ' (closedBall 0 1) + left : LeftInvOn Φ' Φ (closedBall 0 1) + right : LeftInvOn Φ Φ' (closedBall 0 1) + fix : ∀ z ∈ sphere (0 : ℂ) 1, Φ z = z + +namespace IsBallHomeo + +theorem id : IsBallHomeo id id := + ⟨mapsTo_id _, mapsTo_id _, continuousOn_id, continuousOn_id, fun _ _ => rfl, fun _ _ => rfl, + fun _ _ => rfl⟩ + +theorem comp {Φ Φ' Ψ Ψ' : ℂ → ℂ} (h₁ : IsBallHomeo Φ Φ') (h₂ : IsBallHomeo Ψ Ψ') : + IsBallHomeo (Φ ∘ Ψ) (Ψ' ∘ Φ') where + maps := h₁.maps.comp h₂.maps + maps' := h₂.maps'.comp h₁.maps' + cont := h₁.cont.comp h₂.cont h₂.maps + cont' := h₂.cont'.comp h₁.cont' h₁.maps' + left := fun z hz => by + simp only [Function.comp_apply] + rw [h₁.left (h₂.maps hz), h₂.left hz] + right := fun z hz => by + simp only [Function.comp_apply] + rw [h₂.right (h₁.maps' hz), h₁.right hz] + fix := fun z hz => by + simp only [Function.comp_apply] + rw [h₂.fix z hz, h₁.fix z hz] + +theorem fix' {Φ Φ' : ℂ → ℂ} (h : IsBallHomeo Φ Φ') {z : ℂ} (hz : z ∈ sphere (0 : ℂ) 1) : + Φ' z = z := by + conv_lhs => rw [← h.fix z hz] + exact h.left (sphere_subset_closedBall hz) + +end IsBallHomeo + +/-- A vertical chord is a line between its ends. -/ +theorem isLineWithEnds_vertChord {r y : ℝ} (hry : r ^ 2 + y ^ 2 = 1) (hy : 0 < y) : + IsLineWithEnds (vertChord r) ⟨r, y⟩ ⟨r, -y⟩ := by + have h0 : vertChordMap r y 0 = ⟨r, y⟩ := by + apply Complex.ext <;> simp [vertChordMap] + have h1 : vertChordMap r y 1 = ⟨r, -y⟩ := by + apply Complex.ext <;> simp [vertChordMap] + ring + rw [← range_vertChordMap hry hy, ← h0, ← h1] + exact GM11.isLine_range (continuous_vertChordMap r y) (injective_vertChordMap hy) + +/-! ## The closed left cap -/ + +section Cap + +variable {r : ℝ} + +theorem leftClosedCap_subset_closedBall (r : ℝ) : leftClosedCap r ⊆ closedBall (0 : ℂ) 1 := + fun _ hz => hz.1 + +theorem isClosedDisc_leftClosedCap (hr : -1 < r) (hr1 : r ≤ 1) : + IsClosedDisc (leftClosedCap r) ∧ discBd (leftClosedCap r) = frontier (leftClosedCap r) := by + refine isClosedDisc_of_convex (convex_leftClosedCap r) ?_ + (isBounded_closedBall.subset (leftClosedCap_subset_closedBall r)) (isClosed_leftClosedCap r) + refine ⟨⟨(r - 1) / 2, 0⟩, ?_⟩ + have hsub : leftOpenCap r ⊆ interior (leftClosedCap r) := + interior_maximal (fun z hz => ⟨ball_subset_closedBall hz.1, hz.2.le⟩) (isOpen_leftOpenCap r) + refine hsub ⟨?_, ?_⟩ + · rw [mem_ball_unit_iff] + simp only + nlinarith + · simp only + linarith + +/-- A point of a closed set with points outside it arbitrarily close is on its frontier. -/ +theorem mem_frontier_of_approx {K : Set ℂ} (hK : IsClosed K) {z : ℂ} (hz : z ∈ K) + (h : ∀ ε > 0, ∃ w, dist w z < ε ∧ w ∉ K) : z ∈ frontier K := by + rw [frontier, hK.closure_eq] + refine ⟨hz, ?_⟩ + intro hint + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp isOpen_interior z hint + obtain ⟨w, hw, hwK⟩ := h ε hε + exact hwK (interior_subset (hball hw)) + +theorem frontier_leftClosedCap_subset (z : ℂ) (hz : z ∈ frontier (leftClosedCap r)) : + z ∈ sphere (0 : ℂ) 1 ∨ z ∈ vertChord r := by + have hzK : z ∈ leftClosedCap r := (isClosed_leftClosedCap r).frontier_subset hz + by_contra hne + push Not at hne + have hball : z ∈ ball (0 : ℂ) 1 := by + have h1 : ‖z‖ ≤ 1 := mem_closedBall_zero_iff.mp hzK.1 + have h2 : ‖z‖ ≠ 1 := fun h => hne.1 (mem_sphere_zero_iff_norm.mpr h) + exact mem_ball_zero_iff.mpr (lt_of_le_of_ne h1 h2) + have hlt : z.re < r := lt_of_le_of_ne hzK.2 fun h => hne.2 ⟨hzK.1, h⟩ + have hint : z ∈ interior (leftClosedCap r) := + interior_maximal (show leftOpenCap r ⊆ leftClosedCap r from + fun w hw => ⟨ball_subset_closedBall hw.1, hw.2.le⟩) (isOpen_leftOpenCap r) + (show z ∈ leftOpenCap r from ⟨hball, hlt⟩) + exact hz.2 hint + +theorem sphere_inter_subset_frontier : + sphere (0 : ℂ) 1 ∩ leftClosedCap r ⊆ frontier (leftClosedCap r) := by + rintro z ⟨hzs, hzK⟩ + refine mem_frontier_of_approx (isClosed_leftClosedCap r) hzK fun ε hε => ?_ + have hn : ‖z‖ = 1 := mem_sphere_zero_iff_norm.mp hzs + refine ⟨(1 + ε / 2 : ℝ) • z, ?_, fun hw => ?_⟩ + · rw [dist_eq_norm] + have : (1 + ε / 2 : ℝ) • z - z = (ε / 2 : ℝ) • z := by + rw [add_smul, one_smul] + abel + rw [this, norm_smul, hn, mul_one, Real.norm_eq_abs, abs_of_pos (by linarith)] + linarith + · have h1 := mem_closedBall_zero_iff.mp hw.1 + rw [norm_smul, hn, mul_one, Real.norm_eq_abs, abs_of_pos (by linarith)] at h1 + linarith + +theorem vertChord_subset_frontier : vertChord r ⊆ frontier (leftClosedCap r) := by + intro z hz + have hzK : z ∈ leftClosedCap r := ⟨hz.1, hz.2.le⟩ + refine mem_frontier_of_approx (isClosed_leftClosedCap r) hzK fun ε hε => ?_ + refine ⟨z + ((ε / 2 : ℝ) : ℂ), ?_, fun hw => ?_⟩ + · rw [dist_eq_norm, add_sub_cancel_left, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (by linarith)] + linarith + · have h1 := hw.2 + simp only [Complex.add_re, Complex.ofReal_re] at h1 + rw [hz.2] at h1 + linarith + +end Cap + +/-- If a preconnected set in the unit disc has a point left of the vertical line `re = r` and +misses the chord at `r`, it lies left of that line. -/ +theorem re_lt_of_isPreconnected {N : Set ℂ} (hN : IsPreconnected N) + (hNB : N ⊆ closedBall (0 : ℂ) 1) {r : ℝ} {z₀ : ℂ} (hz₀ : z₀ ∈ N) (hz₀r : z₀.re < r) + (hNr : Disjoint N (vertChord r)) : ∀ z ∈ N, z.re < r := by + intro z hz + by_contra hle + push Not at hle + have hre : IsPreconnected (Complex.re '' N) := hN.image _ Complex.continuous_re.continuousOn + obtain ⟨w, hw, hwr⟩ := hre.Icc_subset (mem_image_of_mem _ hz₀) (mem_image_of_mem _ hz) + ⟨hz₀r.le, hle⟩ + exact disjoint_left.mp hNr hw ⟨hNB hw, hwr⟩ + +/-! ## One step -/ + +open Classical in +/-- Extending a homeomorphism of the closed left cap that fixes its boundary by the identity. -/ +theorem isBallHomeo_extend {r : ℝ} {Ψ Ψ' : ℂ → ℂ} + (hm : MapsTo Ψ (leftClosedCap r) (leftClosedCap r)) + (hm' : MapsTo Ψ' (leftClosedCap r) (leftClosedCap r)) + (hc : ContinuousOn Ψ (leftClosedCap r)) (hc' : ContinuousOn Ψ' (leftClosedCap r)) + (hl : LeftInvOn Ψ' Ψ (leftClosedCap r)) (hr : LeftInvOn Ψ Ψ' (leftClosedCap r)) + (hfix : ∀ z ∈ frontier (leftClosedCap r), Ψ z = z) : + IsBallHomeo (fun z => if z ∈ leftClosedCap r then Ψ z else z) + (fun z => if z ∈ leftClosedCap r then Ψ' z else z) ∧ + ∀ z ∈ rightClosedCap r, (if z ∈ leftClosedCap r then Ψ z else z) = z := by + classical + have hfix' : ∀ z ∈ frontier (leftClosedCap r), Ψ' z = z := fun z hz => by + have hzK := (isClosed_leftClosedCap r).frontier_subset hz + conv_lhs => rw [← hfix z hz] + exact hl hzK + have hB : closedBall (0 : ℂ) 1 = leftClosedCap r ∪ rightClosedCap r := by + ext z + refine ⟨fun hz => ?_, fun hz => hz.elim (·.1) (·.1)⟩ + rcases le_total z.re r with h | h + · exact Or.inl ⟨hz, h⟩ + · exact Or.inr ⟨hz, h⟩ + have hKK' : ∀ z ∈ rightClosedCap r, z ∈ leftClosedCap r → z ∈ frontier (leftClosedCap r) := + fun z hz hzK => vertChord_subset_frontier ⟨hz.1, le_antisymm hzK.2 hz.2⟩ + have hright : ∀ {Θ : ℂ → ℂ}, (∀ z ∈ frontier (leftClosedCap r), Θ z = z) → + ∀ z ∈ rightClosedCap r, (if z ∈ leftClosedCap r then Θ z else z) = z := by + intro Θ hΘ z hz + by_cases hzK : z ∈ leftClosedCap r + · rw [ite_eq_left hzK] + exact hΘ z (hKK' z hz hzK) + · rw [ite_eq_right hzK] + have hcont : ∀ {Θ : ℂ → ℂ}, ContinuousOn Θ (leftClosedCap r) → + (∀ z ∈ frontier (leftClosedCap r), Θ z = z) → + ContinuousOn (fun z => if z ∈ leftClosedCap r then Θ z else z) (closedBall 0 1) := by + intro Θ hΘ hΘf + rw [hB] + refine ContinuousOn.union_of_isClosed (hΘ.congr fun z hz => ite_eq_left hz) + (continuousOn_id.congr fun z hz => hright hΘf z hz) (isClosed_leftClosedCap r) + (isClosed_rightClosedCap r) + have hmaps : ∀ {Θ : ℂ → ℂ}, MapsTo Θ (leftClosedCap r) (leftClosedCap r) → + MapsTo (fun z => if z ∈ leftClosedCap r then Θ z else z) (closedBall 0 1) (closedBall 0 1) + := by + intro Θ hΘ z hz + by_cases hzK : z ∈ leftClosedCap r + · simp only [ite_eq_left hzK] + exact (hΘ hzK).1 + · simpa [hzK] using hz + have hinv : ∀ {Θ Θ' : ℂ → ℂ}, MapsTo Θ (leftClosedCap r) (leftClosedCap r) → + LeftInvOn Θ' Θ (leftClosedCap r) → + LeftInvOn (fun z => if z ∈ leftClosedCap r then Θ' z else z) + (fun z => if z ∈ leftClosedCap r then Θ z else z) (closedBall 0 1) := by + intro Θ Θ' hΘ hl z _ + by_cases hzK : z ∈ leftClosedCap r + · simp only [ite_eq_left hzK, ite_eq_left (hΘ hzK)] + exact hl hzK + · simp [hzK] + refine ⟨⟨hmaps hm, hmaps hm', hcont hc hfix, hcont hc' hfix', hinv hm hl, hinv hm' hr, + fun z hz => ?_⟩, hright hfix⟩ + by_cases hzK : z ∈ leftClosedCap r + · simp only [ite_eq_left hzK] + exact hfix z (sphere_inter_subset_frontier ⟨hz, hzK⟩) + · simp [hzK] + +/-- One step of the induction: if `Φ` already straightens the lines with index `< n`, and the line +`M j₀` is moved by `Φ⁻¹` to a line left of the chord at `r`, it is straightened inside the left +cap at `r`. -/ +theorem exists_step {m : ℕ} {x y : Fin m → ℝ} (hxy : ∀ j, x j ^ 2 + y j ^ 2 = 1) + (hy : ∀ j, 0 < y j) {M : Fin m → Set ℂ} (hMB : ∀ j, M j ⊆ closedBall (0 : ℂ) 1) + (hM : ∀ j, IsLineWithEnds (M j) ⟨x j, y j⟩ ⟨x j, -y j⟩) + (hMs : ∀ j, M j ∩ sphere (0 : ℂ) 1 = {⟨x j, y j⟩, ⟨x j, -y j⟩}) + {Φ Φ' : ℂ → ℂ} (hΦ : IsBallHomeo Φ Φ') {n : ℕ} (j₀ : Fin m) (hj₀ : j₀.1 = n) + (hprev : ∀ j : Fin m, j.1 < n → Φ '' vertChord (x j) = M j) {r : ℝ} (hxr : x j₀ < r) + (hr : ∀ j : Fin m, j.1 < n → r ≤ x j) (hr1' : r ≤ 1) (hNr : Disjoint (Φ' '' M j₀) + (vertChord r)) : + ∃ Θ Θ' : ℂ → ℂ, IsBallHomeo Θ Θ' ∧ ∀ j : Fin m, j.1 < n + 1 → Θ '' vertChord (x j) = M j := by + classical + set e₁ : ℂ := ⟨x j₀, y j₀⟩ + set e₂ : ℂ := ⟨x j₀, -y j₀⟩ + set N := Φ' '' M j₀ with hN + have hy₀ := hy j₀ + have hx₀ : -1 < x j₀ := by nlinarith [hxy j₀] + have hr1 : -1 < r := by linarith + have he₁₂ : e₁ ≠ e₂ := fun h => by + have := congrArg Complex.im h + simp only [e₁, e₂] at this + linarith + have he₁s : e₁ ∈ sphere (0 : ℂ) 1 := by + rw [mem_sphere_unit_iff] + exact hxy j₀ + have he₂s : e₂ ∈ sphere (0 : ℂ) 1 := by + rw [mem_sphere_unit_iff] + simp only [e₂] + nlinarith [hxy j₀] + -- `N` is a line in the closed disc with the same ends, meeting the circle only in them. + have hNB : N ⊆ closedBall (0 : ℂ) 1 := image_subset_iff.mpr fun w hw => hΦ.maps' (hMB j₀ hw) + have hNline : IsLineWithEnds N e₁ e₂ := by + have h := (hM j₀).image_injOn (hΦ.cont'.mono (hMB j₀)) + (hΦ.right.injOn.mono (hMB j₀)) + rwa [hΦ.fix' he₁s, hΦ.fix' he₂s] at h + have hNs : N ∩ sphere (0 : ℂ) 1 = {e₁, e₂} := by + ext z + constructor + · rintro ⟨⟨w, hw, rfl⟩, hzs⟩ + have hw' : Φ (Φ' w) = w := hΦ.right (hMB j₀ hw) + have hzw : Φ' w = w := by + conv_rhs => rw [← hw', hΦ.fix _ hzs] + rw [hzw] at hzs ⊢ + have hmem : w ∈ M j₀ ∩ sphere (0 : ℂ) 1 := ⟨hw, hzs⟩ + rw [hMs j₀] at hmem + exact hmem + · rintro (rfl | rfl) + · refine ⟨⟨e₁, ?_, hΦ.fix' he₁s⟩, he₁s⟩ + have hmem : e₁ ∈ M j₀ ∩ sphere (0 : ℂ) 1 := by + rw [hMs j₀] + exact Or.inl rfl + exact hmem.1 + · refine ⟨⟨e₂, ?_, hΦ.fix' he₂s⟩, he₂s⟩ + have hmem : e₂ ∈ M j₀ ∩ sphere (0 : ℂ) 1 := by + rw [hMs j₀] + exact Or.inr rfl + exact hmem.1 + have he₁N : e₁ ∈ N := by + have hmem : e₁ ∈ N ∩ sphere (0 : ℂ) 1 := by + rw [hNs] + exact Or.inl rfl + exact hmem.1 + -- `N` lies left of the chord at `r`, so in the closed left cap. + have hNlt : ∀ z ∈ N, z.re < r := + re_lt_of_isPreconnected hNline.isPreconnected_self hNB he₁N hxr hNr + have hNK : N ⊆ leftClosedCap r := fun z hz => ⟨hNB hz, (hNlt z hz).le⟩ + have hCK : vertChord (x j₀) ⊆ leftClosedCap r := fun z hz => ⟨hz.1, hz.2 ▸ hxr.le⟩ + obtain ⟨hK, hKbd⟩ := isClosedDisc_leftClosedCap hr1 hr1' + have hbdK : ∀ {L : Set ℂ}, L ⊆ leftClosedCap r → L ∩ sphere (0 : ℂ) 1 = {e₁, e₂} → + (∀ z ∈ L, z.re < r) → L ∩ discBd (leftClosedCap r) = {e₁, e₂} := by + intro L hLK hLs hLr + rw [hKbd, ← hLs] + ext z + constructor + · rintro ⟨hzL, hzf⟩ + rcases frontier_leftClosedCap_subset z hzf with h | h + · exact ⟨hzL, h⟩ + · exact absurd h.2 (hLr z hzL).ne + · rintro ⟨hzL, hzs⟩ + exact ⟨hzL, sphere_inter_subset_frontier ⟨hzs, hLK hzL⟩⟩ + have hCs : vertChord (x j₀) ∩ sphere (0 : ℂ) 1 = {e₁, e₂} := vertChord_inter_sphere (hxy j₀) + obtain ⟨Ψ, Ψ', hm, hm', hc, hc', hl, hr', hfix, himg⟩ := + exists_homeo_moving_line hK he₁₂ (isLineWithEnds_vertChord (hxy j₀) hy₀) hNline hCK hNK + (hbdK hCK hCs fun z hz => hz.2 ▸ hxr) (hbdK hNK hNs hNlt) + obtain ⟨hext, hextfix⟩ := isBallHomeo_extend hm hm' hc hc' hl hr' fun z hz => + hfix z (hKbd ▸ hz) + refine ⟨_, _, hΦ.comp hext, fun j hj => ?_⟩ + rw [image_comp] + rcases Nat.lt_succ_iff_lt_or_eq.mp hj with hjn | hjn + · -- An earlier chord lies in the right cap, which the new map fixes. + have hfixC : ∀ z ∈ vertChord (x j), (if z ∈ leftClosedCap r then Ψ z else z) = z := + fun z hz => hextfix z ⟨hz.1, hz.2 ▸ hr j hjn⟩ + rw [image_congr hfixC, image_id', hprev j hjn] + · have hjj : j = j₀ := Fin.ext (hjn.trans hj₀.symm) + subst hjj + have h1 : (fun z => if z ∈ leftClosedCap r then Ψ z else z) '' vertChord (x j) = N := by + rw [← himg] + exact image_congr fun z hz => ite_eq_left (hCK hz) + rw [h1, hN, image_image] + conv_rhs => rw [← image_id (M j)] + exact image_congr fun w hw => hΦ.right (hMB j hw) + +/-- **Straightening disjoint lines.** Let `x` be strictly decreasing with `x j ^ 2 + y j ^ 2 = 1` +and `y j > 0`, and let `M j` be disjoint lines in the closed unit disc, with ends `⟨x j, y j⟩` and +`⟨x j, -y j⟩` and meeting the unit circle only there. Then a homeomorphism of the closed unit disc +fixing the circle maps each vertical chord `vertChord (x j)` onto `M j`. -/ +theorem exists_ballHomeo_moving_chords {m : ℕ} {x y : Fin m → ℝ} (hx : StrictAnti x) + (hxy : ∀ j, x j ^ 2 + y j ^ 2 = 1) (hy : ∀ j, 0 < y j) {M : Fin m → Set ℂ} + (hMB : ∀ j, M j ⊆ closedBall (0 : ℂ) 1) + (hM : ∀ j, IsLineWithEnds (M j) ⟨x j, y j⟩ ⟨x j, -y j⟩) + (hMs : ∀ j, M j ∩ sphere (0 : ℂ) 1 = {⟨x j, y j⟩, ⟨x j, -y j⟩}) + (hdisj : Pairwise fun i j => Disjoint (M i) (M j)) : + ∃ Φ Φ' : ℂ → ℂ, IsBallHomeo Φ Φ' ∧ ∀ j, Φ '' vertChord (x j) = M j := by + suffices h : ∀ n ≤ m, ∃ Φ Φ' : ℂ → ℂ, IsBallHomeo Φ Φ' ∧ + ∀ j : Fin m, j.1 < n → Φ '' vertChord (x j) = M j by + obtain ⟨Φ, Φ', hΦ, h⟩ := h m le_rfl + exact ⟨Φ, Φ', hΦ, fun j => h j j.2⟩ + intro n + induction n with + | zero => exact fun _ => ⟨_, _, IsBallHomeo.id, fun j hj => absurd hj (Nat.not_lt_zero _)⟩ + | succ n ih => + intro hn + obtain ⟨Φ, Φ', hΦ, hprev⟩ := ih (by omega) + let j₀ : Fin m := ⟨n, by omega⟩ + have hx₀ : x j₀ < 1 := by nlinarith [hxy j₀, hy j₀] + rcases Nat.eq_zero_or_pos n with rfl | hpos + · -- No chord is straight yet: work in the whole disc, the left cap at `1`. + refine exists_step hxy hy hMB hM hMs hΦ j₀ rfl hprev hx₀ + (fun j hj => absurd hj (Nat.not_lt_zero _)) le_rfl ?_ + refine disjoint_left.mpr fun z hz hz1 => ?_ + have hzs : z ∈ sphere (0 : ℂ) 1 := by + have h1 := (mem_closedBall_unit_iff z).mp hz1.1 + rw [hz1.2] at h1 + rw [mem_sphere_unit_iff, hz1.2] + nlinarith [sq_nonneg z.im] + obtain ⟨w, hw, rfl⟩ := hz + have hw' : Φ (Φ' w) = w := hΦ.right (hMB j₀ hw) + rw [hΦ.fix _ hzs] at hw' + rw [hw'] at hzs hz1 + have hwe : w ∈ M j₀ ∩ sphere (0 : ℂ) 1 := ⟨hw, hzs⟩ + rw [hMs j₀] at hwe + have hre : w.re = x j₀ := by + rcases hwe with rfl | rfl <;> rfl + linarith [hz1.2] + · -- The last straight chord is at `x (n - 1)`. + let jp : Fin m := ⟨n - 1, by omega⟩ + have hjp : jp ≠ j₀ := fun h => by + have := congrArg Fin.val h + simp only [jp, j₀] at this + omega + refine exists_step hxy hy hMB hM hMs hΦ j₀ rfl hprev (hx (show jp < j₀ from + Fin.mk_lt_mk.mpr (by omega))) (fun j hj => hx.antitone (Fin.mk_le_mk.mpr (by omega))) + (by nlinarith [hxy jp, hy jp]) ?_ + refine disjoint_left.mpr fun z hz hzC => ?_ + obtain ⟨w, hw, rfl⟩ := hz + have h1 : Φ (Φ' w) ∈ M jp := hprev jp (by simp only [jp]; omega) ▸ mem_image_of_mem Φ hzC + rw [hΦ.right (hMB j₀ hw)] at h1 + exact disjoint_left.mp (hdisj hjp.symm) hw h1 + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/Cited.lean b/LeanPool/GraphMinor/GM15/Cited.lean new file mode 100644 index 0000000000..28ee538364 --- /dev/null +++ b/LeanPool/GraphMinor/GM15/Cited.lean @@ -0,0 +1,505 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Minor.CompleteGraph + +public import LeanPool.GraphMinor.GM14.Cited +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM15.Defs + +/-! +# Results from Graph Minors IX, XI, XII, and XIV cited in Graph Minors XV + +This file states as `Prop`s the results from *Graph Minors IX. Disjoint crossed paths* (JCTB 49 +(1990) 40–77), *Graph Minors XI. Circuits on a surface* (JCTB 60 (1994) 72–106), +*Graph Minors XII. Distance on a surface* (JCTB 64 (1995) 240–272), and +*Graph Minors XIV. Extending an embedding* (JCTB 65 (1995) 23–50) that are cited in +*Graph Minors XV. Giant steps* (JCTB 68 (1996) 112–148) over the shared definitions in +`GraphMinor.GM09.Defs`, `GraphMinor.GM10.Defs`, `GraphMinor.GM11.Defs`, `GraphMinor.GM12.Defs`, +`GraphMinor.GM14.Defs`, and `GraphMinor.GM15.Defs`: + +- **Re-exported from `GraphMinor.GM14.Cited`:** + - `GM11Theorem63Statement`: Graph Minors XI, (6.3) (page 89), used in (4.1) of Graph Minors XV. + - `GM11Theorem810Statement`: Graph Minors XI, (8.10) (page 100). + - `GM11Theorem812Statement`: Graph Minors XI, (8.12) (page 102), used in (4.1) of Graph Minors XV. + - `GM12Theorem710Statement`: Graph Minors XII, (7.10) (page 270), used in (4.4) of Graph Minors + XV. +- **From Graph Minors IX:** + - `GM09Theorem71Statement`: (7.1) (page 59), quoted with a misprint as XV (6.2) (page 134). + - `GM09Theorem81Statement`: (8.1) (page 60), nonempty-boundary case used in XV (2.1) (page 116). + - `GM09Theorem1111Statement`: (11.11) (page 74), used to deduce (6.1) of Graph Minors XV + (page 134). +- **From Graph Minors XI:** + - `GM11Theorem91Statement`: metric facts for `HasTangleMetric`, including the triangle + inequality from (9.1) (page 104). +- **From Graph Minors XII:** + - `GM12Theorem41Statement`: (4.1) (page 248), used in (4.7) of Graph Minors XV (page 127). + - `GM12Theorem45Statement`: (4.5) (page 252), used in (8.1) of Graph Minors XV (page 145). + - `GM12Theorem51Statement`: (5.1) (page 254), used in (3.5) of Graph Minors XV (page 123). + - `GM12Theorem52Statement`: corrected (5.2) with `2 ≤ θ` (page 254), used in XV (3.3) (page 121). + - `GM12Theorem61Statement`: corrected (6.1) with `2 ≤ k` (pages 257–258), used in XV (3.4). + - `GM12Theorem711Statement`: (7.11) (page 271), used in (4.3) of Graph Minors XV (page 125). +- **From Graph Minors XIV:** + - `GM14Theorem73Statement`: (7.3) (page 36), used in claim (4) of XV (7.7) (page 141). + - `GM14Theorem96Statement`: (9.6) (page 47), used in Section 7 of Graph Minors XV (pages 138–144). + - `GM14Theorem101Statement`: (10.1) (page 49), used in (7.4) of Graph Minors XV (page 137). +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +open Set Function Topology +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM14 + +universe u v w + +export GM14 (GM11Theorem63Statement GM11Theorem810Statement GM11Theorem812Statement + GM12Theorem710Statement) + +/-! ## 1. Results from Graph Minors IX -/ + +/-- Statement of Graph Minors IX, (7.1) (page 59). XV (6.2) (page 134) quotes it with a misprint +in the threshold, printing $2\tau_i$ for $2\tau_1$. +"Let $\phi \ge 2$, $\tau_1 \ge 3$, $\tau_2 \ge 4$ be integers. Let $\mathcal{P}$ be a crooked +transaction in a society $(G, \Omega)$ such that $|\mathcal{P}| \ge (\phi - 1)(2\tau_1 + +\tau_2 - 7)$. Then there exists $\mathcal{P}' \subseteq \mathcal{P}$ such that either* (i) +*$|\mathcal{P}'| = \phi$ and $\mathcal{P}'$ is a crosscap transaction, or* (ii) +*$|\mathcal{P}'| = \tau_1$ and $\mathcal{P}'$ is a leap transaction, or* (iii) +*$|\mathcal{P}'| = \tau_2$ and $\mathcal{P}'$ is a doublecross transaction." -/ +def GM09Theorem71Statement : Prop := + ∀ {α : Type u} {β : Type v} (S : Society α β) (φ τ₁ τ₂ : ℕ) + (P_set : Set (Graph α β)), + 2 ≤ φ → 3 ≤ τ₁ → 4 ≤ τ₂ → + S.IsCrookedTransaction P_set → + (φ - 1) * (2 * τ₁ + τ₂ - 7) ≤ P_set.ncard → + ∃ P' ⊆ P_set, + (P'.ncard = φ ∧ S.IsCrosscapTransaction P') ∨ + (P'.ncard = τ₁ ∧ S.IsLeapTransaction P') ∨ + (P'.ncard = τ₂ ∧ S.IsDoublecrossTransaction P') + +/-- The nonempty-boundary case of Graph Minors IX, (8.1) (page 60), used in (2.1) of XV +(page 116) and (3.2) of XVI (page 50). The corrected full theorem also covers the null graph. +Every society `(G, Ω)` with `ΩBar ≠ ∅` and with no transaction of cardinality `> k` has a linear +decomposition of depth `≤ k`. -/ +def GM09Theorem81Statement : Prop := + ∀ {α : Type u} {β : Type v} (S : Society α β) (k : ℕ), + S.Ω.bar.Nonempty → S.IsPVortex k → S.HasLinearDecompositionOfDepthLE k + +/-- Statement of Graph Minors IX, (11.11) (page 74), used to deduce (6.1) of Graph Minors XV +(page 134): +"Let $p \ge 2$, with $p \neq 3$. Let $(G, \Omega)$ be a society with no crooked transaction +of cardinality $p$. Then there is a feasible segregation $\{(A_0, \Omega_0), \dots, (A_k, +\Omega_k)\}$ of $(G, \Omega)$ such that $|\bar{\Omega}_1|, \dots, |\bar{\Omega}_k| \le 3$ +and $(A_0, \Omega_0)$ has no transaction of cardinality $> 3p + 9$." -/ +def GM09Theorem1111Statement : Prop := + ∀ {α : Type u} {β : Type v} (S : Society α β) (p : ℕ), + 2 ≤ p → p ≠ 3 → + (∀ P_set : Set (Graph α β), S.IsCrookedTransaction P_set → P_set.ncard ≠ p) → + ∃ (k : ℕ) (A₀ : Society α β) (A : Fin k → Society α β), + IsFeasibleSegregation S A₀ A ∧ + (∀ i : Fin k, (A i).Ω.bar.ncard ≤ 3) ∧ + (∀ P_set : Set (Graph α β), A₀.IsTransaction P_set → P_set.ncard ≤ 3 * p + 9) + +/-! ## 2. Results from Graph Minors XI -/ + +/-- Metric facts for a respectful tangle, including the triangle inequality from Graph Minors XI, +(9.1) (page 104), transferred from the radial slope distance. + +For a respectful tangle `T` of order `θ` in a 2-cell drawing `H` in `Σ` with metric `d`: +(i) `A(H)` partitions `Σ`; +(ii) `d` satisfies the following laws on `A(H)` (`d(a, b) ≤ θ`, `d(a, a) = 0`, `d(a, b) = d(b, a)`, +`d(a, b) + d(b, c) ≥ d(a, c)`); +(iii) if `E(H) ≠ ∅`, `v ∈ V(H)`, `r ∈ R(H)` and `v ∈ closure r`, then `d(v, r) ≤ 1`; +(iv) if `v ∈ V(H)`, `e ∈ E(H)` and `v ∈ closure e`, then `d(v, e) ≤ 2`. +Parts (iii) and (iv) follow from the definition of the metric in Graph Minors XIV, page 27. +The bound in (iv) cannot be lowered to 1, although XIV writes this on page 36. The atom of `K` +for `e` is a region bounded by a circuit of length 4, and on a grid `K` has no circuit of length 2. +-/ +def GM11Theorem91Statement : Prop := + ∀ {S : Type u} [TopologicalSpace S] [T2Space S] + (H : Drawing S) (θ : ℕ) (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ), + IsClosedSurface S → ConnectedSpace S → + HasTangleMetric H θ T d → + (∀ σ : S, ∃! a : Set S, a ∈ H.A ∧ σ ∈ a) ∧ + (∀ a ∈ H.A, d a a = 0) ∧ + (∀ a ∈ H.A, ∀ b ∈ H.A, d a b ≤ θ) ∧ + (∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) ∧ + (∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) ∧ + (H.E.Nonempty → ∀ v ∈ H.V, ∀ r ∈ H.R, v ∈ closure r → d {v} r ≤ 1) ∧ + (∀ v ∈ H.V, ∀ e ∈ H.E, v ∈ closure e → d {v} e ≤ 2) + +/-! ## 3. Results from Graph Minors XII -/ + +/-- Statement of Graph Minors XII, (1.2) (page 242), derived from Graph Minors XI, (8.12) +(page 102) and used in (4.1) of Graph Minors XV (page 125), with the necessary hypothesis +`2 ≤ Γ.E.ncard` (as in Graph Minors XIV, (7.1), page 35; see the correction to (1.2) in +`corrections/GM12.md`): +Let `T` be a respectful tangle of order `θ ≥ 2` in a 2-cell drawing `Γ` with `|E(Γ)| ≥ 2` in a +connected surface `Σ`, and let its metric be `d`. Let `c ∈ A(Γ)`; then there is an edge `e` of `Γ` +with `d(c, e) = θ`. -/ +def GM12Theorem12Statement : Prop := + ∀ {S : Type u} [TopologicalSpace S] [T2Space S] + (Γ : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (c : Set S), + IsClosedSurface S → ConnectedSpace S → + 2 ≤ θ → HasTangleMetric Γ θ T d → 2 ≤ Γ.E.ncard → c ∈ Γ.A → + ∃ e ∈ Γ.E, d c e = θ + +/-- Statement of Graph Minors XII, (4.1) (page 248), used in the proof of (4.7) of Graph Minors XV +(page 127): +"Let $\mathscr{T}$ be a respectful tangle in a 2-cell drawing $\Gamma$ in a connected surface +$\Sigma$, with metric $d$. Let $u, v \in V(\Gamma)$, and let $P$ be a path of $\Gamma$ between $u$ +and $v$. If $(A, B) \in \mathscr{T}$ and $V(P) \subseteq V(A)$ then $(A, B)$ has order $\ge +\frac{1}{2} d(u, v)$." -/ +def GM12Theorem41Statement : Prop := + ∀ {S : Type u} [TopologicalSpace S] [T2Space S] + (Γ P : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (A B : Hypergraph S (Set S)) (u v : S), + IsClosedSurface S → ConnectedSpace S → + HasTangleMetric Γ θ T d → + u ∈ Γ.V → v ∈ Γ.V → + P.IsPathBetween u v → P.IsSubdrawing Γ → + (A, B) ∈ T → P.V ⊆ A.vertexSet → + d {u} {v} ≤ 2 * separationOrder A B + +/-- The complete simple graph `K_p` on `Fin p` (with unordered pairs of distinct vertices as edges), +used for `GM12.ControlsMinor` in `GM12Theorem45Statement`. -/ +abbrev completeGraph (n : ℕ) : Graph (Fin n) (Sym2 (Fin n)) := GraphMinor.completeGraph n + +/-- Statement of Graph Minors XII, (4.5) (page 252), used in (8.1) of Graph Minors XV (page 145): +For any connected surface `Σ` with `bd(Σ) = ∅` and any integer `p ≥ 0`, there exist `κ, ϕ ≥ 0` such +that if `T*` is a tangle of order `≥ p` in a graph `G` and `H, η, T` is a `Σ`-span of order `≥ ϕ` in +`G` with respect to `T*` with `≥ κ` independent eyes, then `T*` controls a `K_p` minor of `G` in the +sense of `GM12.ControlsMinor`. -/ +def GM12Theorem45Statement : Prop := + ∀ (S : Type w) [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ p : ℕ, ∃ κ φ : ℕ, + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (hSpan : IsSigmaSpan G H η θ_star θ T_star T), + HasTangleMetric H θ T d → + p ≤ θ_star → φ ≤ θ → + HasIndependentEyes G H η θ T d κ → + GM12.ControlsMinor + (Hypergraph.ofGraph G hSpan.isControlling.isTangle_star.finite_V + hSpan.isControlling.isTangle_star.finite_E) + θ_star T_star (completeGraph p) + +/-- Statement of Graph Minors XII, (5.1) (page 254), used in (3.5) of Graph Minors XV (page 123): +"Let $\Sigma_2$ be a handle of $\Sigma$, and let $\Sigma_1, \hat{\Sigma}_1$ be defined as above. +Let the two components of $\Sigma_1 \cap \Sigma_2$ be $C_1, C_2$. Let $\Gamma$ be a drawing in +$\Sigma$ such that $C_1, C_2$ are $\Gamma$-normal, and $$|V(\Gamma) \cap C_1| = |V(\Gamma) \cap +C_2| = \theta,$$ and such that $\Gamma \cap \Sigma_2$ has $\theta$ components, each a path with one +end in $C_1$ and the other in $C_2$. Suppose that every $\Gamma$-normal line $F \subseteq +\Sigma_1$ with one end in $C_1$ and one end in $C_2$ satisfies $|F \cap V(\Gamma)| \ge \theta$. Let +$\mathscr{T}_1$ be a tangle in $\Gamma \cap \hat{\Sigma}_1$, respectful towards $\hat{\Sigma}_1$, +of order $\theta$, such that $V(\Gamma) \cap C_1, V(\Gamma) \cap C_2$ are free with respect to +$\mathscr{T}_1$. Then the tangle in $\Gamma$ induced by $\mathscr{T}_1$ is respectful towards +$\Sigma$." -/ +def GM12Theorem51Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + {S_hat : Type w} [TopologicalSpace S_hat] [T2Space S_hat] + (C : Fin 2 → Set S) (P₁ P₂ : Set S) (ι : P₁ → S_hat) (D : Fin 2 → Set S_hat) + (Γ : Drawing S) (Γ₁ : Drawing S_hat) (θ : ℕ) + (T₁ : Set (Hypergraph S_hat (Set S_hat) × Hypergraph S_hat (Set S_hat))) + (P : Fin θ → Drawing S) (a b : Fin θ → S), + IsClosedSurface S → ConnectedSpace S → + GM12.IsHandleSplit C P₁ P₂ ι D → + GM12.IsCappedDrawing ι Γ Γ₁ → + Γ.IsNormal (C 0) → Γ.IsNormal (C 1) → + (Γ.V ∩ C 0).ncard = θ → (Γ.V ∩ C 1).ncard = θ → + (∀ i : Fin θ, a i ∈ Γ.V ∩ C 0 ∧ b i ∈ Γ.V ∩ C 1 ∧ + (P i).IsPathBetween (a i) (b i) ∧ (P i).IsSubdrawing (Γ.interSet P₂)) → + Pairwise (fun i j => Disjoint (P i).U (P j).U) → + (Γ.interSet P₂).U = ⋃ i : Fin θ, (P i).U → + (∀ F : Set S, IsLine F → Γ.IsNormal F → F ⊆ P₁ → + (F ∩ C 0).Nonempty → (F ∩ C 1).Nonempty → θ ≤ (F ∩ Γ.V).ncard) → + IsTangle Γ₁.toHypergraph θ T₁ → + (PaintingOrDrawing.drawing Γ₁).IsRespectful θ T₁ → + IsFreeSet Γ₁.toHypergraph T₁ θ (ι '' ((↑) ⁻¹' (Γ.V ∩ C 0))) → + IsFreeSet Γ₁.toHypergraph T₁ θ (ι '' ((↑) ⁻¹' (Γ.V ∩ C 1))) → + (PaintingOrDrawing.drawing Γ).IsRespectful θ (GM12.inducedAcross ι Γ Γ₁ θ T₁) + +/-- Statement of Graph Minors XII, (5.2) (page 254), used in (3.3) of Graph Minors XV (page 121): +"Let $\Sigma_2$ be a crosscap of $\Sigma$, and let $\Sigma_1, \hat{\Sigma}_1$ be defined as above. +Let $\Gamma$ be a drawing in $\Sigma$ such that $\Sigma_1 \cap \Sigma_2$ is $\Gamma$-normal, and +$|V(\Gamma) \cap \Sigma_1 \cap \Sigma_2| = 2\theta$, and $\Gamma \cap \Sigma_2$ has $\theta$ +components, each a path with ends some opposite pair of vertices in $V(\Gamma) \cap \Sigma_1 \cap +\Sigma_2$, in the natural sense. Suppose that $\mathscr{T}_1$ is a tangle in $\Gamma \cap +\hat{\Sigma}_1$, respectful towards $\hat{\Sigma}_1$, of order $\theta$, and every subset +$V(\Gamma) \cap \Sigma_1 \cap \Sigma_2$ of cardinality $\le \theta$ is free with respect to +$\mathscr{T}_1$. Then the tangle in $\Gamma$ induced by $\mathscr{T}_1$ is respectful towards +$\Sigma$." +The paper allows `θ = 1`, which is false: the one path may run along the boundary of the band, and +then the core of the band misses `Γ` and bounds no disc. So we assume `2 ≤ θ`. The use in XV (3.3) +has `3 ≤ φ`. -/ +def GM12Theorem52Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + {S_hat : Type w} [TopologicalSpace S_hat] [T2Space S_hat] + (C : Fin 1 → Set S) (P₁ P₂ : Set S) (ι : P₁ → S_hat) (D : Fin 1 → Set S_hat) + (Γ : Drawing S) (Γ₁ : Drawing S_hat) (θ : ℕ) + (T₁ : Set (Hypergraph S_hat (Set S_hat) × Hypergraph S_hat (Set S_hat))) + (P : Fin θ → Drawing S) (a b : Fin θ → S), + 2 ≤ θ → + IsClosedSurface S → ConnectedSpace S → + GM12.IsCrosscapSplit C P₁ P₂ ι D → + GM12.IsCappedDrawing ι Γ Γ₁ → + Γ.IsNormal (C 0) → + (Γ.V ∩ C 0).ncard = 2 * θ → + ((List.ofFn a ++ List.ofFn b).Nodup) → + GM12.IsListedInOrderOn (C 0) (List.ofFn a ++ List.ofFn b) → + range a ∪ range b = Γ.V ∩ C 0 → + (∀ i : Fin θ, (P i).IsPathBetween (a i) (b i) ∧ (P i).IsSubdrawing (Γ.interSet P₂)) → + Pairwise (fun i j => Disjoint (P i).U (P j).U) → + (Γ.interSet P₂).U = ⋃ i : Fin θ, (P i).U → + IsTangle Γ₁.toHypergraph θ T₁ → + (PaintingOrDrawing.drawing Γ₁).IsRespectful θ T₁ → + (∀ X ⊆ ι '' ((↑) ⁻¹' (Γ.V ∩ C 0)), X.ncard ≤ θ → IsFreeSet Γ₁.toHypergraph T₁ θ X) → + (PaintingOrDrawing.drawing Γ).IsRespectful θ (GM12.inducedAcross ι Γ Γ₁ θ T₁) + +/-- Statement of Graph Minors XII, (6.1) (pages 257–258, written with `θ = 2k`), used in the +proof of Graph Minors XV (3.4) (page 123): +"Let $\Gamma$ be a 2-cell drawing in a connected surface $\Sigma$, and let $F$ be a $\Gamma$-normal +$O$-arc bounding a closed disc $\Delta \subseteq \Sigma$. Let $|F \cap V(\Gamma)| = \theta \ge 2$, +where $\theta$ is even, and let $$F \cap V(\Gamma) = \{v_1, v_2, \dots, v_\theta\}$$ numbered in +order on $F$. Let the components of $\Gamma \cap \Delta$ be $P_1, P_2, \dots, P_{\theta/2}$, where +for $1 \le i \le \theta/2$ $P_i$ is a path with ends $v_i, v_{\theta+1-i}$. Let $e_i$ be an edge of +$P_i$ ($1 \le i \le \theta/2$). Let $\Sigma_1 = \overline{\Sigma - \Delta}$, let $\Gamma_1 = \Gamma +\cap \Sigma_1$ be 2-cell (in $\Sigma$), and let $\mathscr{T}_1$ be a tangle in $\Gamma_1$ of order +$\theta_1 > \theta$, respectful towards $\Sigma$. Let $\mathscr{T}$ be the tangle in $\Gamma$ +induced by $\mathscr{T}_1$; then $\mathscr{T}$ is clearly respectful towards $\Sigma$. Let $d$ be +the metric derived from $\mathscr{T}$. Finally, let $F \cap V(\Gamma_1)$ be free with respect to +$\mathscr{T}_1$. ... (6.1) In these circumstances, $d(e_1, e_{\theta/2}) \ge \theta$." +We assume `2 ≤ k` since `k = 1` would give `e₁ = e_k` and `d(e₁, e₁) = 0`. Its use in +the proof of XV (3.4) gives `d'(v_k, v_{2k}) ≥ 2k - 8`, as stated on page 122. +The proof on page 123 misprints those vertices as `v₁` and `v₂`. -/ +def GM12Theorem61Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + (Γ : Drawing S) (F Δ : Set S) (k θ₁ : ℕ) + (T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (a b : Fin k → S) (P : Fin k → Drawing S) (e_path : Fin k → Set S) + (i₀ i_last : Fin k), + IsClosedSurface S → ConnectedSpace S → + 2 ≤ k → 2 * k < θ₁ → + (PaintingOrDrawing.drawing Γ).IsTwoCell → + IsOArc F → Γ.IsNormal F → IsClosedDisc Δ → subBd Δ = F → + ((List.ofFn a ++ (List.ofFn b).reverse).Nodup) → + GM12.IsListedInOrderOn F (List.ofFn a ++ (List.ofFn b).reverse) → + range a ∪ range b = F ∩ Γ.V → + (∀ i : Fin k, (P i).IsPathBetween (a i) (b i) ∧ (P i).IsSubdrawing (Γ.interSet Δ)) → + Pairwise (fun i j => Disjoint (P i).U (P j).U) → + (Γ.interSet Δ).U = ⋃ i : Fin k, (P i).U → + (∀ i : Fin k, e_path i ∈ (P i).E) → + (PaintingOrDrawing.drawing (Γ.interSet (closure (univ \ Δ)))).IsTwoCell → + IsRespectfulDrawingTangle (Γ.interSet (closure (univ \ Δ))) θ₁ T₁ → + HasTangleMetric Γ θ₁ + (GM12.inducedBySubgraph Γ.toHypergraph (Γ.interSet (closure (univ \ Δ))).toHypergraph θ₁ T₁) + d → + IsFreeSet (Γ.interSet (closure (univ \ Δ))).toHypergraph T₁ θ₁ + (F ∩ (Γ.interSet (closure (univ \ Δ))).V) → + i₀.1 = 0 → i_last.1 = k - 1 → + 2 * k ≤ d (e_path i₀) (e_path i_last) + +/-- Statement of Graph Minors XII, (7.7) (page 268), used in (4.5) of Graph Minors XV (page 126): +"Let $\mathscr{T}$ be a respectful tangle of order $\theta$ in a 2-cell drawing $\Gamma$ in a +connected surface $\Sigma$; let its metric be $d$. Let $\Gamma'$ be a 2-cell subdrawing of +$\Gamma$, and let $\mathscr{T}'$ be a respectful tangle of order $\theta' \le \theta$ in $\Gamma'$, +with metric $d'$. Then +(i) for $k \ge 0$, if $d'(a', b') \ge d(a, b) - k$ for all $a, b \in A(\Gamma)$ and $a', b' \in +A(\Gamma')$ with $a \subseteq a'$ and $b \subseteq b'$, then $d(a, b) \ge \min(d'(a', b'), \theta - +k)$ for all such $a, b, a', b'$ +(ii) if $\theta = \theta'$ and $\mathscr{T}$ is the tangle in $\Gamma$ induced by $\mathscr{T}'$, +then $d(a, b) \ge d'(a', b')$ for all $a, b \in A(\Gamma)$ and $a', b' \in A(\Gamma')$ with $a +\subseteq a'$ and $b \subseteq b'$." -/ +def GM12Theorem77Statement : Prop := + ∀ {S : Type u} [TopologicalSpace S] [T2Space S] + (Γ Γ' : Drawing S) (θ θ' : ℕ) + (T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d d' : Set S → Set S → ℕ), + IsClosedSurface S → ConnectedSpace S → + HasTangleMetric Γ θ T d → + Γ'.IsSubdrawing Γ → (PaintingOrDrawing.drawing Γ').IsTwoCell → + θ' ≤ θ → HasTangleMetric Γ' θ' T' d' → + (∀ k : ℕ, + (∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → d a b - k ≤ d' a' b') → + ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → min (d' a' b') (θ - k) ≤ d a b) ∧ + (θ = θ' → T = GM12.inducedBySubgraph Γ.toHypergraph Γ'.toHypergraph θ' T' → + ∀ a ∈ Γ.A, ∀ b ∈ Γ.A, ∀ a' ∈ Γ'.A, ∀ b' ∈ Γ'.A, + a ⊆ a' → b ⊆ b' → d' a' b' ≤ d a b) + +/-- Statement of Graph Minors XII, (7.11) (page 271), used in (4.3) of Graph Minors XV (page 125), +with the added hypothesis "if `z ∈ E(H)` then `λ ≥ 2`". A central edge has distance zero from +itself and belongs to the deleted neighborhood. This is the deleted-edge bound in the corrected +(7.8) and the printed (7.10). Without it the statement is false for a path of three edges on the +sphere with `θ = 2`, `z` the middle edge and `λ ≤ 1` (see the correction to (7.11) in +`corrections/GM12.md`): +Let `H` be a 2-cell drawing with `E(H) ≠ ∅` in a connected surface `Σ`, with a respectful tangle +`T` of order `θ` with metric `d`. Let `z ∈ A(H)` and let `λ ≥ 0` be an integer with `λ < θ`, such +that if `z ∈ E(H)` then `λ ≥ 2`. Then `H - z^λ` is 2-cell. -/ +def GM12Theorem711Statement : Prop := + ∀ {S : Type u} [TopologicalSpace S] [T2Space S] + (H : Drawing S) (θ lam : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (z : Set S), + IsClosedSurface S → ConnectedSpace S → + HasTangleMetric H θ T d → H.E.Nonempty → z ∈ H.A → lam < θ → (z ∈ H.E → 2 ≤ lam) → + (PaintingOrDrawing.drawing (deleteAtomNeighborhood H d z lam)).IsTwoCell + +/-! ## 4. Results from Graph Minors XIV -/ + +/-- Statement of Graph Minors XIV, (7.3) (page 36), used in claim (4) of XV (7.7) (page 141). +Let `H` be a 2-cell drawing in `Σ` with `E(H) ≠ ∅`, and let `T` be a respectful tangle in `H` of +order `θ`, with metric `d`. Let `z ∈ A(H)`, and let `(A, B) ∈ T` with `E(B) ≠ {z}`. Then there +exists `e ∈ E(B)` with `d(z, e) ≥ θ - |V(A ∩ B)|`. -/ +def GM14Theorem73Statement : Prop := + ∀ {S : Type u} [TopologicalSpace S] [T2Space S] + (H : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (A B : Hypergraph S (Set S)) (z : Set S), + IsClosedSurface S → ConnectedSpace S → H.E.Nonempty → + HasTangleMetric H θ T d → z ∈ H.A → (A, B) ∈ T → B.edgeSet ≠ {z} → + ∃ e ∈ B.edgeSet, θ - separationOrder A B ≤ d z e + +/-- Statement of Graph Minors XIV, (9.6) (pages 47–48), used in (7.5) of Graph Minors XV +(page 138): +"Let $H$ be a 2-cell, rigid drawing in $\Sigma$, let $z \in A(H)$, and let $\mathscr{T}$ be a +respectful tangle in $H$ of order $\theta$, with metric $d$. Let $\pi \ge 0$ with $\pi \ne 1, 3$, +let $\beta \ge 2\pi + 8$ be even, and let $\theta \ge 16\beta + 17$. Let $H$ be a subgraph of $G$, +let $J$ be the union of some bridges of $H$ in $G$ such that $d(z, v) < \beta$ for each ... $v \in +V(H +\cap J)$, and let $G'$ be the union of $H$ and all the other bridges of $H$ in $G$. Let +$\mathscr{S}$ be a $\mathscr{T}$-local 3-segregation of $G'$, and let $\alpha$ be an arrangement of +$\mathscr{S}$ in $\Sigma$ compatible with $H$. Then there is a $(3\beta + 3)$-zone $\Lambda$ around +$z$, and a closed disc $\Delta \subseteq \Sigma$ with $bd(\Delta)$ $\alpha$-normal and with +$\Lambda \subseteq \Delta$, with the following properties: +(i) $d(z, x) \le 3\beta + 6$ for all $x \in A(H)$ with $x \cap \Delta \ne \emptyset$ +(ii) $x \subseteq \Delta - bd(\Delta)$ for all $x \in A(H)$ with $d(z, x) < \beta$ +(iii) $H \cap \overline{\Sigma - \Delta}$ has a circuit, and $H \cap (\Sigma - \Lambda)$ is a rigid +drawing in $\Sigma$ +(iv) one of the following alternatives holds: +(a) there is a crooked transaction $\mathscr{P}$ of cardinality $\ge \pi$ in $(G, \Omega_0)$ (where +$\Omega_0$ is a natural order of $V(H) \cap bd(\Lambda)$ from $bd(\Lambda)$), such that +$V(\mathscr{P})$ is free with respect to the tangle of order $\theta - 4(3\beta + 3) - 2$ obtained +from $\mathscr{T}$ by clearing $\Lambda$, and each $P \in \mathscr{P}$ meets $H \cap (\Sigma - +\Lambda)$ in precisely the ends of $P$ +(b) there is no crooked transaction of cardinality $\ge \pi$ in $(\alpha^{-1}(\Delta) \cup J, +\alpha^{-1}(bd(\Delta)))$." -/ +def GM14Theorem96Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G_amb G G' J : Graph α β) (B_J B_rem : Set (Graph α β)) + (H : Drawing S) (η : SpanEmbedding H G_amb) (η' : SpanEmbedding H G') + (θ π beta : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (z : Set S) + (S_seg : Set (Society α β)) (α_disc : Society α β → Set S) (α_pt : α → S), + IsClosedSurface S → ConnectedSpace S → + V(G_amb).Finite → E(G_amb).Finite → + IsRigid H → HasTangleMetric H θ T d → z ∈ H.A → + π ≠ 1 → π ≠ 3 → 2 * π + 8 ≤ beta → Even beta → 16 * beta + 17 ≤ θ → + (∀ B ∈ B_J, IsBridge G_amb η.imageGraph B) → + (∀ B ∈ B_rem, IsBridge G_amb η.imageGraph B) → + Disjoint B_J B_rem → + J = subgraphSUnion G_amb B_J → + G' = subgraphSUnion G_amb {η.imageGraph, subgraphSUnion G_amb B_rem} → + G = subgraphUnion G_amb G' J → + (∀ v ∈ H.V, η'.vMap v = η.vMap v) → + (∀ e ∈ H.E, η'.eMap e = η.eMap e) → + (∀ v ∈ H.V, η.vMap v ∈ V(J) → d z {v} < beta) → + IsThreeSegregation G' S_seg → + IsTangleLocal G' H η' T S_seg → + IsSurfaceArrangement S_seg α_disc α_pt → + IsCompatibleWith G' H η' S_seg α_disc α_pt → + ∃ (Λ Δ : Set S) + (T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₁ : Set S → Set S → ℕ) + (clearedEmbedding : SpanEmbedding (clearedSubdrawing H Λ) G_amb) + (clearedSociety localSociety : Society α β), + IsLambdaZoneAround H d (3 * beta + 3) z Λ ∧ + IsClearedTangle H T d θ (3 * beta + 3) Λ T₁ d₁ ∧ + IsClosedDisc Δ ∧ + IsArrangementNormal S_seg α_disc α_pt (subBd Δ) ∧ + Λ ⊆ Δ ∧ + (∀ x ∈ H.A, (x ∩ Δ).Nonempty → d z x ≤ 3 * beta + 6) ∧ + (∀ x ∈ H.A, d z x < beta → x ⊆ Δ \ subBd Δ) ∧ + (∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing (H.interSet (closure (univ \ Δ)))) ∧ + IsRigid (clearedSubdrawing H Λ) ∧ + (∀ v ∈ (clearedSubdrawing H Λ).V, clearedEmbedding.vMap v = η.vMap v) ∧ + (∀ e ∈ (clearedSubdrawing H Λ).E, clearedEmbedding.eMap e = η.eMap e) ∧ + clearedSociety.G = G ∧ + clearedSociety.Ω.bar = clearedEmbedding.vMap '' ((clearedSubdrawing H Λ).V ∩ subBd Λ) ∧ + (∃ inv_v : α → S, + (∀ x ∈ clearedSociety.Ω.bar, inv_v x ∈ (clearedSubdrawing H Λ).V ∩ subBd Λ + ∧ clearedEmbedding.vMap (inv_v x) = x) + ∧ + IsNaturalOrderFrom inv_v clearedSociety.Ω (subBd Λ)) ∧ + localSociety.G = subgraphUnion G_amb J (arrangementPullbackGraph G' S_seg α_disc α_pt Δ) ∧ + IsPullbackPerm S_seg α_pt (subBd Δ) localSociety.Ω ∧ + ((∃ (P_set : Set (Graph α β)) (X : Set S), + clearedSociety.IsCrookedTransaction P_set ∧ + π ≤ P_set.ncard ∧ + (∀ P ∈ P_set, ∀ a b : α, + clearedSociety.IsOmegaPathWithEnds P a b → + IsHPathWithEnds G_amb clearedEmbedding.imageGraph P a b) ∧ + X ⊆ (clearedSubdrawing H Λ).V ∩ subBd Λ ∧ + clearedSociety.transactionEnds P_set = clearedEmbedding.vMap '' X ∧ + IsFreeSet (clearedSubdrawing H Λ).toHypergraph T₁ (θ - 4 * (3 * beta + 3) - 2) X) ∨ + (∀ P_set : Set (Graph α β), localSociety.IsCrookedTransaction P_set → ¬ π ≤ P_set.ncard)) + +/-- Statement of Graph Minors XIV, (10.1) (page 49), used in (7.4) of Graph Minors XV (page 137): +Let `H` be a 2-cell, rigid drawing in `Σ`, and let `T` be a respectful tangle in `H` of order `θ`, +with metric `d`. Let `η` embed `H` in `G₀`, let `μ ≥ 12` be an even integer with `θ ≥ 16μ + 17`, +and suppose that +(i) `d(u, v) < μ` for every `η(H)`-path in `G₀` with ends `η(u), η(v)`, and +(ii) if `T'` is the tangle of order `θ - 4(3μ + 3) - 2` obtained from `T` by clearing some +`(3μ + 3)`-zone `Λ` such that `H ∩ (Σ - Λ)` is a rigid drawing in `Σ`, then `Λ` is not an eye of +`H ∩ (Σ - Λ)` in `G₀` with respect to `T'`. +Then there is a `T`-local 3-segregation of `G₀` and an arrangement of it in `Σ` compatible with +`H`. -/ +def GM14Theorem101Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G₀ : Graph α β) (H : Drawing S) (η : SpanEmbedding H G₀) (θ μ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ), + IsClosedSurface S → ConnectedSpace S → + V(G₀).Finite → E(G₀).Finite → + IsRigid H → HasTangleMetric H θ T d → + 12 ≤ μ → Even μ → 16 * μ + 17 ≤ θ → + ¬ IsMuSteppedSpan G₀ H η d μ → + (∀ (z Λ : Set S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) + (η' : SpanEmbedding (clearedSubdrawing H Λ) G₀), + IsLambdaZoneAround H d (3 * μ + 3) z Λ → + IsClearedTangle H T d θ (3 * μ + 3) Λ T' d' → + IsRigid (clearedSubdrawing H Λ) → + (∀ v ∈ (clearedSubdrawing H Λ).V, η'.vMap v = η.vMap v) → + (∀ e ∈ (clearedSubdrawing H Λ).E, η'.eMap e = η.eMap e) → + ¬ IsDrawingEye G₀ (clearedSubdrawing H Λ) η' (θ - 4 * (3 * μ + 3) - 2) T' Λ) → + ∃ (S_seg : Set (Society α β)) (α_disc : Society α β → Set S) (α_pt : α → S), + IsThreeSegregation G₀ S_seg ∧ + IsTangleLocal G₀ H η T S_seg ∧ + IsSurfaceArrangement S_seg α_disc α_pt ∧ + IsCompatibleWith G₀ H η S_seg α_disc α_pt + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/ControllingTangle.lean b/LeanPool/GraphMinor/GM15/ControllingTangle.lean new file mode 100644 index 0000000000..d8e43ba446 --- /dev/null +++ b/LeanPool/GraphMinor/GM15/ControllingTangle.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + + +module + +public import LeanPool.GraphMinor.GM15.Defs +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Truncation of a controlling tangle +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +open Set Graph Hypergraph Surface GM10 GM14 + +universe u v w + +variable {α : Type u} {β : Type v} + +/-- If `T*` controls `T` via `η` of order `θ` and `1 ≤ θ₁ ≤ θ`, then `T*` controls the +`θ₁`-truncation `GM10.truncation T θ₁` of order `θ₁` (Graph Minors XV, Section 5, page 129). -/ +theorem IsControllingTangle.truncation {S : Type w} [TopologicalSpace S] + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ θ₁ : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (h : IsControllingTangle G H η θ_star θ T_star T) (h1 : 1 ≤ θ₁) (hle : θ₁ ≤ θ) : + IsControllingTangle G H η θ_star θ₁ T_star (GM10.truncation T θ₁) where + theta_le := hle.trans h.theta_le + isTangle_star := h.isTangle_star + isTangle_H := h.isTangle_H.truncation h1 hle + controls A B hsep hlt A_H B_H hrest := by + have hlt_θ : separationOrder A B < θ := lt_of_lt_of_le hlt hle + have hiff := h.controls hsep hlt_θ hrest + constructor + · intro hAB + have hAB_H : (A_H, B_H) ∈ T := hiff.mp hAB + refine ⟨hAB_H, ?_⟩ + have hsub : A_H.vertexSet ∩ B_H.vertexSet ⊆ η.vMap ⁻¹' (A.vertexSet ∩ B.vertexSet) := by + intro x ⟨hxA, hxB⟩ + have hxA' : η.vMap x ∈ A.vertexSet ∩ V(η.imageGraph) := by + rw [← hrest.2.1] + exact mem_image_of_mem _ hxA + have hxB' : η.vMap x ∈ B.vertexSet ∩ V(η.imageGraph) := by + rw [← hrest.2.2.2.1] + exact mem_image_of_mem _ hxB + exact ⟨hxA'.1, hxB'.1⟩ + have hcard_le : separationOrder A_H B_H ≤ separationOrder A B := by + have hfin : (A.vertexSet ∩ B.vertexSet).Finite := (A ∩ B).vertexSet_finite + have hinj : InjOn η.vMap (A_H.vertexSet ∩ B_H.vertexSet) := + η.bijOn_v.injOn.mono (inter_subset_left.trans hrest.1.left_le.vertexSet_subset) + calc + separationOrder A_H B_H = (A_H.vertexSet ∩ B_H.vertexSet).ncard := rfl + _ = (η.vMap '' (A_H.vertexSet ∩ B_H.vertexSet)).ncard := (hinj.ncard_image).symm + _ ≤ (A.vertexSet ∩ B.vertexSet).ncard := + ncard_le_ncard (image_subset_iff.mpr hsub) hfin + _ = separationOrder A B := rfl + exact lt_of_le_of_lt hcard_le hlt + · intro hAB_H + exact hiff.mpr hAB_H.1 + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/Defs.lean b/LeanPool/GraphMinor/GM15/Defs.lean new file mode 100644 index 0000000000..1bcb3b2b7a --- /dev/null +++ b/LeanPool/GraphMinor/GM15/Defs.lean @@ -0,0 +1,441 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.GM17.Defs +public import LeanPool.GraphMinor.Minor.Model +public import LeanPool.GraphMinor.Surface.TopologyStatements + +/-! +# Definitions for Graph Minors XV (Giant Steps) + +This file formalizes the definitions introduced in N. Robertson and P. D. Seymour, +*Graph Minors. XV. Giant steps*, J. Combin. Theory Ser. B 68 (1996) 112–148. + +Shared definitions from Graph Minors IX, X, XI, and XIV are imported from +`GraphMinor.GM09.Defs`, `GraphMinor.GM10.Defs`, `GraphMinor.GM10.Defs2`, +`GraphMinor.GM11.Defs`, and `GraphMinor.GM14.Defs`: +- **Societies and transactions (`GM09`):** `CyclicPerm`, `Society`, `Society.IsTransaction`, + `Society.IsCrookedTransaction`, `Society.IsCrosscapTransaction`, `Society.IsLeapTransaction`, + `Society.IsDoublecrossTransaction`, `Society.IsLinearDecomposition`, + `Society.HasLinearDecompositionOfDepthLE`, `IsFeasibleSegregation`. +- **Tangles (`GM10`):** `GM10.IsTangle`, `GM10.truncation`, `GM10.inducedTangle`, + `GM10.deleteVerticesTangle`, `GM10.IsFreeSet`. +- **Drawings, metrics, zones, segregations, and arrangements (`GM14`):** + `IsRespectfulDrawingTangle`, `tangleMetric`, `HasTangleMetric`, `IsLambdaZoneAround`, + `IsLambdaZone`, `clearedSubdrawing`, `IsClearedTangle`, `IsHPathWithEnds`, `IsHPath`, + `OccurInCircuitOrder`, `SpanEmbedding`, `IsDrawingEye`, `IsDial`, `IsRigid`, + `IsNaturalOrderFrom`, `IsGraphSegregation`, `segregationVertices`, `IsThreeSegregation`, + `IsSurfaceArrangement`, `IsCompatibleWith`, `IsTangleLocal`, `IsBridge`, + `IsArrangementNormal`, `IsPullbackPerm`, `arrangementPullbackGraph`. + +The definitions new to Graph Minors XV are: +- **Section 1 (pages 113–115):** + - `Society.IsPVortex` (`IsPVortex`): a `p`-vortex is a society with no transaction of + cardinality `> p`. + - `IsSegregationOfType`: a segregation of `G` of type `(p, κ)`. + - `IsGraphTangle`: a tangle of order `θ` in a finite graph `G` (via `Hypergraph.ofGraph`). + - `IsCentralSegregation`: a `T*`-central segregation of `G`. + - `IsRestrictedSeparation`, `IsControllingTangle`, `IsSigmaSpan`: `Σ`-spans `H, η, T` of order + `θ` in `G` with respect to `T*`. + - `pointAtomDist`, `pointDist`: point-to-atom and point-to-point tangle distances `d(σ, b)` and + `d(σ₁, σ₂)`. + - `IsLambdaCompression`: a `λ`-compression `T'` of `T` in `H'`. + - `IsRearrangedWithin`: a `Σ`-span `H', η', T'` obtained from `H, η, T` by rearranging within `λ` + of `z ∈ A(H)`. + - `IsMuStepped`, `IsMuSteppedSpan`, `IsFlatSpan`: `μ`-stepped `H`-paths, `μ`-stepped `Σ`-spans, + and `(λ, μ)`-flat `Σ`-spans. + - `IsEyeWithPaths`, `IsEye`, `HasEyesAtDistance`, `HasIndependentEyes`: eyes and independent eyes + of a `Σ`-span. + - `IsObtainedByAddingCrosscap`: a surface obtained by adding a crosscap to `Σ`. +- **Section 3 (page 118):** + - `IsObtainedByAddingHandle`: a surface obtained by adding a handle to `Σ`. +- **Section 4 (page 125):** + - `deleteAtomNeighborhood`: the subdrawing `H - z^λ` formed by edges at distance `> λ` from `z` + and their ends. +- **Section 8 (pages 145–146):** + - `ControlsCliqueMinor`: a tangle `T*` controlling a `K_p`-minor of `G`. + - `IsLevelSpan`: a `(λ, μ)`-level `Σ`-span. +-/ + +@[expose] public section + +namespace GraphMinor + +open Set Function TopologicalSpace Topology +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM14 + +universe u v w + +variable {α : Type u} {β : Type v} + +/-! ## Section 1: Vortices, Segregations, `Σ`-Spans, Compression, Flatness, and Eyes -/ + +/-- A society `(G, Ω)` is a `p`-vortex (Graph Minors XV, Section 1, page 114): +"For $\rho \ge 0$, a $\rho$-vortex is a society with no transaction of cardinality $> \rho$." -/ +def GM09.Society.IsPVortex (S : Society α β) (p : ℕ) : Prop := + ∀ ⦃P_set : Set (Graph α β)⦄, S.IsTransaction P_set → P_set.ncard ≤ p + +namespace GM15 + +export GM09.Society (IsPVortex) + +/-- A segregation `S_seg` of a graph `G` is of type `(p, κ)` +(Graph Minors XV, Section 1, page 114): +"A segregation $\mathscr{S}$ of a graph $G$ is of type $(\rho, \kappa)$, where $\rho, \kappa \ge 0$ +are integers, if there are at most $\kappa$ members $(A, \Omega) \in \mathscr{S}$ with +$|\bar{\Omega}| > 3$, and each is a $\rho$-vortex." -/ +structure IsSegregationOfType (G : Graph α β) (p κ : ℕ) (S_seg : Set (Society α β)) : Prop where + /-- `S_seg` is a segregation of `G`. -/ + isSegregation : IsGraphSegregation G S_seg + /-- At most `κ` members `(A, Ω) ∈ S_seg` satisfy `|ΩBar| > 3`. -/ + vortex_count_le : {S ∈ S_seg | 3 < S.Ω.bar.ncard}.ncard ≤ κ + /-- Every member `(A, Ω) ∈ S_seg` with `|ΩBar| > 3` is a `p`-vortex. -/ + is_p_vortex : ∀ ⦃S : Society α β⦄, S ∈ S_seg → 3 < S.Ω.bar.ncard → S.IsPVortex p + +/-- `T` is a tangle of order `θ` in a finite graph `G`, viewed as a hypergraph via +`Hypergraph.ofGraph` (Graph Minors X, Section 1, page 154; Graph Minors XV, Section 1, page 113). -/ +structure IsGraphTangle (G : Graph α β) (θ : ℕ) + (T : Set (Hypergraph α β × Hypergraph α β)) : Prop where + /-- `V(G)` is finite. -/ + finite_V : V(G).Finite + /-- `E(G)` is finite. -/ + finite_E : E(G).Finite + /-- `T` is a tangle of order `θ` in `Hypergraph.ofGraph G`. -/ + isTangle : GM10.IsTangle (Hypergraph.ofGraph G finite_V finite_E) θ T + +/-- A subhypergraph `B` of `Hypergraph.ofGraph G` is contained in a subgraph `A ≤ G`: +`V(B) ⊆ V(A)` and `E(B) ⊆ E(A)`. -/ +def SubhypergraphInGraph (B : Hypergraph α β) (A : Graph α β) : Prop := + B.vertexSet ⊆ V(A) ∧ B.edgeSet ⊆ E(A) + +/-- A segregation `S_seg` of `G` is `T*`-central (Graph Minors XV, Section 1, page 114): +"If $\mathscr{T}^*$ is a tangle in $G$, a segregation $\mathscr{S}$ of $G$ is +$\mathscr{T}^*$-central if for each $(A, \Omega) \in \mathscr{S}$ there is no $(A^*, B^*) +\in \mathscr{T}^*$ with $B^* \subseteq A$." -/ +def IsCentralSegregation (G : Graph α β) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (S_seg : Set (Society α β)) : Prop := + IsGraphSegregation G S_seg ∧ + ∀ ⦃S : Society α β⦄, S ∈ S_seg → + ∀ ⦃A_star B_star : Hypergraph α β⦄, (A_star, B_star) ∈ T_star → + ¬ SubhypergraphInGraph B_star S.G + +/-- Given an embedding `η` of a drawing `H` as a subgraph `η(H) ≤ G` and a separation `(A, B)` of +`G`, `(A_H, B_H)` is the restricted separation `(η⁻¹(A ∩ η(H)), η⁻¹(B ∩ η(H)))` of `H` +(Graph Minors XV, Section 1, page 114). -/ +def IsRestrictedSeparation {S : Type w} [TopologicalSpace S] + (H : Drawing S) (G : Graph α β) (η : SpanEmbedding H G) + (A B : Hypergraph α β) (A_H B_H : Hypergraph S (Set S)) : Prop := + H.toHypergraph.IsSeparation A_H B_H ∧ + η.vMap '' A_H.vertexSet = A.vertexSet ∩ V(η.imageGraph) ∧ + η.eMap '' A_H.edgeSet = A.edgeSet ∩ E(η.imageGraph) ∧ + η.vMap '' B_H.vertexSet = B.vertexSet ∩ V(η.imageGraph) ∧ + η.eMap '' B_H.edgeSet = B.edgeSet ∩ E(η.imageGraph) + +/-- Condition (iv) in the definition of a `Σ`-span (Graph Minors XV, Section 1, page 114): +"$\theta \le ord(\mathscr{T}^*)$, and $(A \cap \eta(H), B \cap \eta(H)) \in +\eta(\mathscr{T})$, for every $(A, B) \in \mathscr{T}^*$ of order $< \theta$." -/ +structure IsControllingTangle {S : Type w} [TopologicalSpace S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ : ℕ) (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) : Prop where + /-- `θ ≤ ord(T*)`. -/ + theta_le : θ ≤ θ_star + /-- `T*` is a tangle in `G` of order `θ_star`. -/ + isTangle_star : IsGraphTangle G θ_star T_star + /-- `T` is a tangle in `H` of order `θ`. -/ + isTangle_H : GM10.IsTangle H.toHypergraph θ T + /-- For every `(A, B) ∈ T*` of order `< θ` (and thus for every separation `(A, B)` of `G` of + order `< θ`), `(A, B) ∈ T*` if and only if `(η⁻¹(A ∩ η(H)), η⁻¹(B ∩ η(H))) ∈ T`. -/ + controls : ∀ ⦃A B : Hypergraph α β⦄, + (Hypergraph.ofGraph G isTangle_star.finite_V isTangle_star.finite_E).IsSeparation A B → + separationOrder A B < θ → + ∀ ⦃A_H B_H : Hypergraph S (Set S)⦄, + IsRestrictedSeparation H G η A B A_H B_H → + ((A, B) ∈ T_star ↔ (A_H, B_H) ∈ T) + +/-- A triple `H, η, T` is a `Σ`-span of order `θ` in `G` with respect to `T*` +(Graph Minors XV, Section 1, page 114): +"Let $\mathscr{T}^*$ be a tangle in $G$, and let $\Sigma$ be a surface with $bd(\Sigma) = +\emptyset$. A triple $H, \eta, \mathscr{T}$ is a $\Sigma$-span of order $\theta$ (in $G$, +with respect to $\mathscr{T}^*$) if (i) $H$ is a rigid drawing in $\Sigma$ (ii) $\eta$ is an +isomorphism from $H$ to a subgraph $\eta(H)$ of $G$ (iii) $\mathscr{T}$ is a respectful +tangle in $H$ of order $\theta$ (iv) $\theta \le ord(\mathscr{T}^*)$, and $(A \cap \eta(H), +B \cap \eta(H)) \in \eta(\mathscr{T})$, for every $(A, B) \in \mathscr{T}^*$ of order $< +\theta$." -/ +structure IsSigmaSpan {S : Type w} [TopologicalSpace S] [T2Space S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ : ℕ) (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) : Prop where + /-- `Σ` is a surface. -/ + isSurface : IsSurface S + /-- `Σ` is connected. -/ + isConnected : ConnectedSpace S + /-- `bd(Σ) = ∅`. -/ + bd_empty : bd S = ∅ + /-- `(i)` `H` is a rigid drawing in `Σ`. -/ + isRigid : IsRigid H + /-- `(iii)` `T` is a respectful tangle in `H` of order `θ`. -/ + isRespectful : IsRespectfulDrawingTangle H θ T + /-- `(iv)` `θ ≤ ord(T*)` and `T*` controls `T` via `η`. -/ + isControlling : IsControllingTangle G H η θ_star θ T_star T + +/-- Point-to-atom distance `d(σ, b)` for `σ ∈ Σ` and `b ∈ A(H)` +(Graph Minors XV, Section 1, page 114): +"If $H$ is a 2-cell drawing in $\Sigma$, and $\mathscr{T}$ is a respectful tangle in $H$ with +metric $d$, then for $\sigma \in \Sigma$ and $b \in A(H)$, we define $d(\sigma, b) = d(a, +b)$ where $\sigma \in a \in A(H)$; and for $\sigma_1, \sigma_2 \in \Sigma$ we define +$d(\sigma_1, \sigma_2) = d(a_1, a_2)$ where $\sigma_1 \in a_1 \in A(H)$ and $\sigma_2 \in +a_2 \in A(H)$." -/ +noncomputable def pointAtomDist {S : Type w} [TopologicalSpace S] + (H : Drawing S) (d : Set S → Set S → ℕ) (σ : S) (b : Set S) : ℕ := + sInf {k : ℕ | ∃ a ∈ H.A, σ ∈ a ∧ d a b = k} + +/-- Point-to-point distance `d(σ₁, σ₂)` for `σ₁, σ₂ ∈ Σ` +(Graph Minors XV, Section 1, page 114). -/ +noncomputable def pointDist {S : Type w} [TopologicalSpace S] + (H : Drawing S) (d : Set S → Set S → ℕ) (σ₁ σ₂ : S) : ℕ := + sInf {k : ℕ | ∃ a₁ ∈ H.A, ∃ a₂ ∈ H.A, σ₁ ∈ a₁ ∧ σ₂ ∈ a₂ ∧ d a₁ a₂ = k} + +/-- `T'` is a `λ`-compression of `T` in `H'` (Graph Minors XV, Section 1, page 114): +"If $H'$ is another 2-cell drawing in $\Sigma$ with a respectful tangle $\mathscr{T}'$ with +metric $d'$, we say that $\mathscr{T}'$ is a $\lambda$-compression of $\mathscr{T}$ (where +$\lambda \ge 0$ is an integer) if $d'(\sigma_1, \sigma_2) \ge d(\sigma_1, \sigma_2) - +\lambda$ for all $\sigma_1, \sigma_2 \in \Sigma$, and $ord(\mathscr{T}') = ord(\mathscr{T}) +- \lambda$." -/ +structure IsLambdaCompression {S : Type w} [TopologicalSpace S] [T2Space S] + (H H' : Drawing S) (θ lam : ℕ) + (T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d d' : Set S → Set S → ℕ) : Prop where + /-- `λ < θ` (so `ord(T') = θ - λ ≥ 1`). -/ + lam_lt : lam < θ + /-- `T` is a respectful tangle of order `θ` in the 2-cell drawing `H` with metric `d`. -/ + hasMetric : HasTangleMetric H θ T d + /-- `T'` is a respectful tangle of order `θ - λ` in the 2-cell drawing `H'` with metric `d'`. -/ + hasMetric' : HasTangleMetric H' (θ - lam) T' d' + /-- For all `σ₁, σ₂ ∈ Σ`, `d'(σ₁, σ₂) ≥ d(σ₁, σ₂) - λ`. -/ + dist_le : ∀ σ₁ σ₂ : S, pointDist H d σ₁ σ₂ ≤ pointDist H' d' σ₁ σ₂ + lam + +/-- `H', η', T'` is obtained from `H, η, T` by rearranging within `λ` of `z ∈ A(H)` +(Graph Minors XV, Section 1, page 114): +"If $\Sigma, H, \eta, \mathscr{T}, H', \eta', \mathscr{T}', G^*, \mathscr{T}^*$ are as above, +and $z \in A(H)$, we say that $H', \eta', \mathscr{T}'$ is obtained from $H, \eta, +\mathscr{T}$ by rearranging within $\lambda$ of $z$, where $\lambda \ge 0$ is an integer, if +(i) $a \in A(H')$ for all $a \in A(H)$ with $d(z, a) > \lambda$, where $d$ is the metric of +$\mathscr{T}$, (ii) $\eta(x) = \eta'(x)$ for every vertex or edge $x$ of $H$ with $d(z, x) > +\lambda$, and (iii) $\mathscr{T}'$ is a $(4\lambda + 2)$-compression of $\mathscr{T}$." -/ +structure IsRearrangedWithin {S : Type w} [TopologicalSpace S] [T2Space S] + (G : Graph α β) (H H' : Drawing S) (η : SpanEmbedding H G) (η' : SpanEmbedding H' G) + (θ_star θ lam : ℕ) (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d d' : Set S → Set S → ℕ) (z : Set S) : Prop where + /-- `z ∈ A(H)`. -/ + z_mem : z ∈ H.A + /-- `H, η, T` is a `Σ`-span of order `θ` in `G` with respect to `T*`. -/ + isSpan : IsSigmaSpan G H η θ_star θ T_star T + /-- `H', η', T'` is a `Σ`-span of order `θ - (4λ + 2)` in `G` with respect to `T*`. -/ + isSpan' : IsSigmaSpan G H' η' θ_star (θ - (4 * lam + 2)) T_star T' + /-- `(i)` `a ∈ A(H')` for all `a ∈ A(H)` with `d(z, a) > λ`. -/ + atom_mem : ∀ a ∈ H.A, lam < d z a → a ∈ H'.A + /-- `(ii)` `η(v) = η'(v)` for every vertex `v ∈ V(H)` with `d(z, {v}) > λ`. -/ + vMap_eq : ∀ v ∈ H.V, lam < d z {v} → v ∈ H'.V ∧ η'.vMap v = η.vMap v + /-- `(ii)` `η(e) = η'(e)` for every edge `e ∈ E(H)` with `d(z, e) > λ`. -/ + eMap_eq : ∀ e ∈ H.E, lam < d z e → e ∈ H'.E ∧ η'.eMap e = η.eMap e + /-- `(iii)` `T'` is a `(4λ + 2)`-compression of `T`. -/ + isCompression : IsLambdaCompression H H' θ (4 * lam + 2) T T' d d' + +/-- An `η(H)`-path `P` in `G` with ends `η(u), η(v)` is `μ`-stepped with respect to `(H, η, T, d)` +(Graph Minors XV, Section 1, page 115). -/ +def IsMuStepped {S : Type w} [TopologicalSpace S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (d : Set S → Set S → ℕ) (μ : ℕ) (P : Graph α β) (u v : S) : Prop := + u ∈ H.V ∧ v ∈ H.V ∧ IsHPathWithEnds G η.imageGraph P (η.vMap u) (η.vMap v) ∧ μ ≤ d {u} {v} + +/-- A `Σ`-span `H, η, T` is `μ`-stepped (Graph Minors XV, Section 1, page 115): +"A $\Sigma$-span $H, \eta, \mathscr{T}$ is $\mu$-stepped if there is an $\eta(H)$-path in $G$ +with ends $\eta(u), \eta(v)$ such that $d(u, v) \ge \mu$, where $d$ is the metric of +$\mathscr{T}$." -/ +def IsMuSteppedSpan {S : Type w} [TopologicalSpace S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (d : Set S → Set S → ℕ) (μ : ℕ) : Prop := + ∃ (P : Graph α β) (u v : S), IsMuStepped G H η d μ P u v + +/-- A `Σ`-span `H, η, T` is `(λ, μ)`-flat (Graph Minors XV, Section 1, page 115): +"A $\Sigma$-span $H, \eta, \mathscr{T}$ is $(\lambda, \mu)$-flat, where $\lambda, \mu \ge 0$ +are integers, if $ord(\mathscr{T}) \ge 4\lambda + \mu + 2$ and there is no $\mu$-stepped +$\Sigma$-span $H', \eta', \mathscr{T}'$ which can be obtained from $H, \eta, \mathscr{T}$ by +rearranging within $\lambda$ of any $z \in A(H)$." -/ +structure IsFlatSpan {S : Type w} [TopologicalSpace S] [T2Space S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ lam μ : ℕ) (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) : Prop where + /-- `H, η, T` is a `Σ`-span of order `θ` in `G` with respect to `T*`. -/ + isSpan : IsSigmaSpan G H η θ_star θ T_star T + /-- `ord(T) ≥ 4λ + μ + 2`. -/ + order_ge : 4 * lam + μ + 2 ≤ θ + /-- No `Σ`-span obtained from `H, η, T` by rearranging within `λ` of any `z ∈ A(H)` is + `μ`-stepped. -/ + no_stepped_rearrangement : + ∀ ⦃H' : Drawing S⦄ ⦃η' : SpanEmbedding H' G⦄ + ⦃T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))⦄ + ⦃d d' : Set S → Set S → ℕ⦄ ⦃z : Set S⦄, + IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z → + ¬ IsMuSteppedSpan G H' η' d' μ + +/-- A region `r` of `H` is an eye of `H, η, T` in `G` witnessed by disjoint `η(H)`-paths `P₁, P₂` +(Graph Minors XIV, Section 3, pages 28–29; Graph Minors XV, Section 1, page 115). -/ +def IsEyeWithPaths {S : Type w} [TopologicalSpace S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ : ℕ) (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (r : Set S) (P₁ P₂ : Graph α β) : Prop := + r ∈ H.R ∧ + ∃ (C : Drawing S) (a b c d : S), + C.IsCircuit ∧ C.IsSubdrawing H ∧ C.U = subBd r ∧ + a ∈ C.V ∧ b ∈ C.V ∧ c ∈ C.V ∧ d ∈ C.V ∧ + ([a, b, c, d]).Nodup ∧ OccurInCircuitOrder C a b c d ∧ + IsFreeSet H.toHypergraph T θ {a, b, c, d} ∧ + Disjoint V(P₁) V(P₂) ∧ + IsHPathWithEnds G η.imageGraph P₁ (η.vMap a) (η.vMap c) ∧ + IsHPathWithEnds G η.imageGraph P₂ (η.vMap b) (η.vMap d) + +/-- Alias for `GM14.IsDrawingEye` (Graph Minors XV, Section 1, page 115). -/ +abbrev IsEye {S : Type w} [TopologicalSpace S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ : ℕ) (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (r : Set S) : Prop := + IsDrawingEye G H η θ T r + +/-- `H, η, T` has `k` eyes mutually at distance `≥ δ` +(Graph Minors XV, Section 1, (1.2), page 115). -/ +def HasEyesAtDistance {S : Type w} [TopologicalSpace S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ : ℕ) (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (k δ : ℕ) : Prop := + ∃ r : Fin k → Set S, + Injective r ∧ + (∀ i : Fin k, IsDrawingEye G H η θ T (r i)) ∧ + ∀ i j : Fin k, i ≠ j → δ ≤ d (r i) (r j) + +/-- `r₁, ..., r_κ` are independent eyes of `H, η, T` in `G` +(Graph Minors XV, Section 1, page 115): +"Now let $r_1, ..., r_\kappa$ be eyes, with corresponding $\eta(H)$-paths $P_i, Q_i$ ($1 \le +i \le \kappa$). We say that $r_1, ..., r_\kappa$ are *independent eyes* if the paths $P_i, +Q_i$ can be chosen so that (i) for $1 \le i < j \le \kappa$, $d(r_i, r_j) = +ord(\mathscr{T})$, where $d$ is the metric of $\mathscr{T}$ (ii) for $1 \le i < j \le +\kappa$, $P_i \cup Q_i$ is disjoint from $P_j \cup Q_j$." -/ +def HasIndependentEyes {S : Type w} [TopologicalSpace S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ : ℕ) (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (κ : ℕ) : Prop := + ∃ (r : Fin κ → Set S) (P Q : Fin κ → Graph α β), + Injective r ∧ + (∀ i : Fin κ, IsEyeWithPaths G H η θ T (r i) (P i) (Q i)) ∧ + (∀ i j : Fin κ, i ≠ j → d (r i) (r j) = θ) ∧ + ∀ i j : Fin κ, i ≠ j → Disjoint (V(P i) ∪ V(Q i)) (V(P j) ∪ V(Q j)) + +/-- A surface `S'` is obtained by adding a crosscap to `S` +(Graph Minors XV, Section 3, page 121): +"Let $\Sigma_1 = \Sigma - \Lambda$. We may assume that $\Sigma' = \Sigma_1 \cup \Sigma_2$, +where $\Sigma_2$ is homeomorphic to a Möbius band and $\Sigma_1 \cap \Sigma_2 = bd(\Sigma_1) += bd(\Sigma_2)$." -/ +def IsObtainedByAddingCrosscap + (S : Type w) [TopologicalSpace S] (S' : Type w) [TopologicalSpace S'] : Prop := + IsSurface S ∧ IsSurface S' ∧ bd S' = ∅ ∧ + ∃ (Λ : Set S) (S₁ S₂ : Set S'), + IsOpenDisc Λ ∧ Disjoint (closure Λ) (bd S) ∧ + S₁ ∪ S₂ = univ ∧ + S₁ ∩ S₂ = (↑) '' bd S₁ ∧ + S₁ ∩ S₂ = (↑) '' bd S₂ ∧ + Nonempty (↥((univ : Set S) \ Λ) ≃ₜ S₁) ∧ + Nonempty (MobiusBand ≃ₜ S₂) + +/-! ## Section 3: Adding a Handle -/ + +/-- A surface `S'` is obtained from `S` by adding a handle (Graph Minors XV, Section 3, page 123): +"Let $\Sigma_1 = \Sigma - (\Lambda_1 \cup \Lambda_2)$. Let $\Sigma_2$ be homeomorphic to a +closed cylinder, with boundary $U(C_1) \cup U(C_2)$, such that $\Sigma' = \Sigma_1 \cup +\Sigma_2$ is a surface obtained from $\Sigma$ by adding a handle". -/ +def IsObtainedByAddingHandle + (S : Type w) [TopologicalSpace S] (S' : Type w) [TopologicalSpace S'] : Prop := + IsSurface S ∧ IsSurface S' ∧ bd S' = ∅ ∧ + ∃ (Λ₁ Λ₂ : Set S) (S₁ S₂ : Set S'), + IsOpenDisc Λ₁ ∧ IsOpenDisc Λ₂ ∧ Disjoint (closure Λ₁) (closure Λ₂) ∧ + Disjoint (closure Λ₁) (bd S) ∧ Disjoint (closure Λ₂) (bd S) ∧ + S₁ ∪ S₂ = univ ∧ + S₁ ∩ S₂ = (↑) '' bd S₁ ∧ + S₁ ∩ S₂ = (↑) '' bd S₂ ∧ + Nonempty (↥((univ : Set S) \ (Λ₁ ∪ Λ₂)) ≃ₜ S₁) ∧ + Nonempty (ClosedCylinder ≃ₜ S₂) + +/-! ## Section 4: Deleting an Atom Neighborhood `H - z^λ` -/ + +open Classical in +/-- The subdrawing `H - z^λ` (Graph Minors XV, Section 4, page 125): +for a 2-cell drawing `H` in `Σ`, a respectful tangle `T` in `H` of order `θ` with metric `d`, +an integer `λ ≥ 0` with `λ < θ`, and `z ∈ A(H)`, `H - z^λ` is the subdrawing of `H` formed by all +edges `e` of `H` with `d(z, e) > λ` and their ends (or `H` if `E(H) = ∅`). -/ +noncomputable def deleteAtomNeighborhood {S : Type w} [TopologicalSpace S] [T1Space S] + (H : Drawing S) (d : Set S → Set S → ℕ) (z : Set S) (lam : ℕ) : Drawing S := + if H.E = ∅ then H else H.span ∅ {e ∈ H.E | lam < d z e} + +/-! ## Section 8: Controlling a Clique Minor and `(λ, μ)`-Level `Σ`-Spans -/ + +/-- A tangle `T*` in `G` controls a `K_p` minor of `G` (Graph Minors XV, Section 8, page 145): +`T*` has order `≥ p` and there are `p` non-null disjoint connected subgraphs `X₁, ..., X_p` of `G` +such that (i) for `1 ≤ i < j ≤ p` there is an edge of `G` with one end in `V(X_i)` and the other in +`V(X_j)`, and (ii) there is no `(A, B) ∈ T*` of order `< p` such that `V(X_i) ⊆ V(A)` for some `i` +(`1 ≤ i ≤ p`). -/ +def ControlsCliqueMinor (G : Graph α β) (p : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) : Prop := + ∃ X_sub : Fin p → Graph α β, + (∀ i : Fin p, X_sub i ≤ G ∧ V(X_sub i).Nonempty ∧ GraphConnected (X_sub i)) ∧ + (∀ i j : Fin p, i ≠ j → Disjoint V(X_sub i) V(X_sub j)) ∧ + (∀ i j : Fin p, i < j → + ∃ e ∈ E(G), ∃ u ∈ V(X_sub i), ∃ v ∈ V(X_sub j), G.IsLink e u v) ∧ + ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ T_star → separationOrder A B < p → + ∀ i : Fin p, ¬ V(X_sub i) ⊆ A.vertexSet + +/-- A `Σ`-span `H, η, T` of order `θ` in `G` with respect to `T*` is `(λ, μ)`-level +(Graph Minors XV, Section 8, page 146): +"If $\mathcal{T}^*$ is a tangle in $G$ and $H, \eta, \mathcal{T}$ is a $\Sigma$-span of order +$\theta$, where $\Sigma$ is a surface with $\text{bd}(\Sigma) = \emptyset$, we say that $H, +\eta, \mathcal{T}$ is $(\lambda, \mu)$-level if (i) $\theta \ge 4\lambda + \mu + 2$ (ii) $H, +\eta, \mathcal{T}$ is not $\mu$-stepped, and (iii) for every $\Sigma$-span $H', \eta', +\mathcal{T}'$, obtained from $H, \eta, \mathcal{T}$ by rearranging within $\lambda$ of some +$z \in A(H)$, there is no $\eta'(H')$-path in $G$ with ends $\eta'(u), \eta'(v)$ with $d'(u, +v) \ge \mu$ and $d(z, u), d(z, v) \le \lambda$." -/ +structure IsLevelSpan {S : Type w} [TopologicalSpace S] [T2Space S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ lam μ : ℕ) (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) : Prop where + /-- `H, η, T` is a `Σ`-span of order `θ` in `G` with respect to `T*`. -/ + isSpan : IsSigmaSpan G H η θ_star θ T_star T + /-- `d` is the metric of `T`. -/ + hasMetric : HasTangleMetric H θ T d + /-- `(i)` `θ ≥ 4λ + μ + 2`. -/ + order_ge : 4 * lam + μ + 2 ≤ θ + /-- `(ii)` `H, η, T` is not `μ`-stepped. -/ + not_stepped : ¬ IsMuSteppedSpan G H η d μ + /-- `(iii)` For every `Σ`-span `H', η', T'` obtained from `H, η, T` by rearranging within `λ` of + some `z ∈ A(H)`, there is no `η'(H')`-path in `G` with ends `η'(u), η'(v)` with `d'(u, v) ≥ μ` and + `d(z, u), d(z, v) ≤ λ`. -/ + no_local_stepped_rearrangement : + ∀ ⦃H' : Drawing S⦄ ⦃η' : SpanEmbedding H' G⦄ + ⦃T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))⦄ + ⦃d' : Set S → Set S → ℕ⦄ ⦃z : Set S⦄, + IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z → + ∀ ⦃P : Graph α β⦄ ⦃u v : S⦄, + IsMuStepped G H' η' d' μ P u v → + ¬ (pointAtomDist H d u z ≤ lam ∧ pointAtomDist H d v z ≤ lam) + +end GM15 + +end GraphMinor diff --git a/LeanPool/GraphMinor/GM15/EyeInductionParameters.lean b/LeanPool/GraphMinor/GM15/EyeInductionParameters.lean new file mode 100644 index 0000000000..4b9d247727 --- /dev/null +++ b/LeanPool/GraphMinor/GM15/EyeInductionParameters.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + + +module + +public import Mathlib.Algebra.Group.Nat.Even +meta import Lean.Elab.Tactic.Omega + +/-! +# Parameters for the eye induction in Graph Minors XV and XVI +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +/-- The tangle orders and size bounds used by the eye induction. -/ +structure EyeInductionParameters where + /-- The enlarged order `θ''` of the next span. -/ + enlargedOrder : ℕ + /-- The first crooked-transaction threshold `τ₁`. -/ + firstThreshold : ℕ + /-- The second crooked-transaction threshold `τ₂`. -/ + secondThreshold : ℕ + /-- The size `π` of the crooked transaction. -/ + transactionSize : ℕ + /-- The size `β` of the battlefield. -/ + battlefieldSize : ℕ + /-- The order `θ_k` of the previous span. -/ + order : ℕ + /-- The flatness threshold `λ_k` of the previous span. -/ + flatness : ℕ + /-- The width `p_k` of the final segregation. -/ + segregationWidth : ℕ + +/-- Parameters for the induction step in Graph Minors XV (1.2). -/ +abbrev eyeInductionParameters (φ μ θ' : ℕ) : EyeInductionParameters := + let θ'' := 2 * (θ' + 3 * μ + 8) + let τ₁ := 4 + μ / 2 + let τ₂ := 6 + θ'' / 2 + let π := (φ - 1) * (2 * τ₁ + τ₂ - 7) + let beta := 2 * π + 8 + ⟨θ'', τ₁, τ₂, π, beta, 100 * beta, 20 * beta, 3 * π + 9⟩ + +/-- Arithmetic bounds for the Section 7 parameters `θ'', τ₁, τ₂, π, beta, θ_k, lam_k, p_k` +(Graph Minors XV, Section 7, page 135). -/ +theorem eye_induction_parameter_bounds {φ μ lam' θ' : ℕ} + (hφ8 : 8 ≤ φ) (hμ12 : 12 ≤ μ) (hlam'4 : 4 ≤ lam') (hθ'_ge : 4 * lam' + μ + 2 ≤ θ') : + let θ'' := (eyeInductionParameters φ μ θ').enlargedOrder + let τ₁ := (eyeInductionParameters φ μ θ').firstThreshold + let τ₂ := (eyeInductionParameters φ μ θ').secondThreshold + let π := (eyeInductionParameters φ μ θ').transactionSize + let beta := (eyeInductionParameters φ μ θ').battlefieldSize + let θ_k := (eyeInductionParameters φ μ θ').order + let lam_k := (eyeInductionParameters φ μ θ').flatness + Even θ'' ∧ θ' ≤ θ'' ∧ 4 ≤ θ' ∧ 4 ≤ θ_k ∧ + 4 * lam' + μ + 2 ≤ θ'' ∧ 6 * μ + 14 < θ'' ∧ + 2 ≤ φ ∧ 3 ≤ φ ∧ 3 ≤ τ₁ ∧ 4 ≤ τ₂ ∧ + 2 ≤ π ∧ π ≠ 3 ∧ + 4 * lam_k + μ + 2 ≤ θ_k ∧ + 6 * (3 * μ + 3) + 5 * lam' + 3 * μ + 4 ≤ lam_k ∧ + θ'' + 16 * μ + 17 ≤ θ_k ∧ + θ'' + 13 * μ + 14 ≤ beta ∧ + 16 * beta + 17 ≤ θ_k ∧ + 6 * beta + 12 < θ_k ∧ + φ ≤ θ_k - 4 * (3 * beta + 3) - 2 ∧ + 3 * beta + 3 ≤ lam_k ∧ + 2 * τ₁ < θ_k - 4 * (3 * beta + 3) - 2 ∧ + 6 * (3 * beta + 3) + 5 * lam' + 3 * μ + 4 ≤ lam_k := by + let parameters := eyeInductionParameters φ μ θ' + have hθ''_even : Even parameters.enlargedOrder := by + dsimp only [parameters, eyeInductionParameters] + exact ⟨θ' + 3 * μ + 8, by omega⟩ + have hτ_sum : θ' + 4 * μ + 11 ≤ + 2 * parameters.firstThreshold + parameters.secondThreshold - 7 := by + dsimp only [parameters, eyeInductionParameters] + omega + have hφ_sub : 7 ≤ φ - 1 := by omega + have hπ_ge : 7 * (θ' + 4 * μ + 11) ≤ parameters.transactionSize := Nat.mul_le_mul hφ_sub hτ_sum + have hπ_ge_φ : φ ≤ parameters.transactionSize := by + have h2 : 2 ≤ 2 * parameters.firstThreshold + parameters.secondThreshold - 7 := + Nat.le_trans (by omega) hτ_sum + have h3 := Nat.mul_le_mul_left (φ - 1) h2 + dsimp only [parameters, eyeInductionParameters] at h3 ⊢ + omega + dsimp only [parameters, eyeInductionParameters] at hπ_ge hπ_ge_φ + dsimp only [eyeInductionParameters] + refine ⟨hθ''_even, by omega, by omega, by omega, by omega, by omega, by omega, + by omega, by omega, by omega, by omega, by omega, by omega, by omega, + by omega, by omega, by omega, by omega, by omega, by omega, by omega, by omega⟩ + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/LineMove.lean b/LeanPool/GraphMinor/GM15/LineMove.lean new file mode 100644 index 0000000000..b17c5e892e --- /dev/null +++ b/LeanPool/GraphMinor/GM15/LineMove.lean @@ -0,0 +1,362 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscArcs +public import LeanPool.GraphMinor.GM12.Section3DiscBoundaryExtension +import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.InvarianceOfDomain + +/-! +# Moving one line across a closed disc + +Graph Minors XV, (3.4), page 122, takes any drawing $H' = H \cup P_1 \cup \dots \cup P_{k-1}$ +with the paths drawn in the closed disc $\bar\Lambda$. To use a chart of $\bar\Lambda$ in which +the paths are straight chords, we move the paths onto chords by a homeomorphism of the disc +that fixes its boundary. + +This file gives the step for one line. Let $L, L'$ be two lines in a closed disc $D$ with the +same ends $a, b$, each meeting the boundary only in its ends. Cutting $D$ along $L$ and along +$L'$ gives two pairs of closed discs, and the discs of each pair have the same part of the +boundary of $D$. On the boundary of each piece we map $L$ onto $L'$ and fix the rest, extend +this to the pieces, and glue (`exists_homeo_moving_line`). +-/ + +public section + +namespace GraphMinor.GM15 + +open Set Topology Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The boundary of a closed disc is closed. -/ +theorem isClosed_discBd [T2Space S] {D : Set S} (hD : IsClosedDisc D) : IsClosed (discBd D) := by + obtain ⟨φ⟩ := hD.isOArc_discBd + have h : discBd D = range (fun w => (φ w).1) := by + ext x + exact ⟨fun hx => ⟨φ.symm ⟨x, hx⟩, by simp⟩, fun ⟨w, hw⟩ => hw ▸ (φ w).2⟩ + rw [h] + exact (isCompact_range (continuous_subtype_val.comp φ.continuous)).isClosed + +/-- A line is closed. -/ +theorem isClosed_of_isLineWithEnds [T2Space S] {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) : + IsClosed L := by + obtain ⟨f, -, -⟩ := hL + have h : L = range (fun t => (f t).1) := by + ext x + exact ⟨fun hx => ⟨f.symm ⟨x, hx⟩, by simp⟩, fun ⟨t, ht⟩ => ht ▸ (f t).2⟩ + rw [h] + exact (isCompact_range (continuous_subtype_val.comp f.continuous)).isClosed + +section LineSwap + +variable {L L' : Set S} (f : unitInterval ≃ₜ L) (f' : unitInterval ≃ₜ L') + +open Classical in +/-- The map that sends the line `L` onto `L'`, following their parametrizations `f` and `f'`, +and fixes every other point. -/ +noncomputable def lineSwap (x : S) : S := + if hx : x ∈ L then (f' (f.symm ⟨x, hx⟩)).1 else x + +variable {f f'} + +theorem lineSwap_of_mem {x : S} (hx : x ∈ L) : lineSwap f f' x = (f' (f.symm ⟨x, hx⟩)).1 := by + simp [lineSwap, hx] + +theorem lineSwap_of_notMem {x : S} (hx : x ∉ L) : lineSwap f f' x = x := by + simp [lineSwap, hx] + +theorem lineSwap_mem {x : S} (hx : x ∈ L) : lineSwap f f' x ∈ L' := by + rw [lineSwap_of_mem hx] + exact (f' _).2 + +theorem lineSwap_lineSwap {x : S} (hx : x ∈ L) : lineSwap f' f (lineSwap f f' x) = x := by + have key : ∀ t, lineSwap f' f (f' t).1 = (f t).1 := fun t => by + rw [lineSwap_of_mem (f' t).2] + simp + rw [lineSwap_of_mem hx, key] + simp + +/-- `lineSwap` fixes the common first end of the two lines. -/ +theorem lineSwap_zero {a : S} (hf : (f 0).1 = a) (hf' : (f' 0).1 = a) : + lineSwap f f' a = a := by + have ha : a ∈ L := hf ▸ (f 0).2 + rw [lineSwap_of_mem ha] + have : (⟨a, ha⟩ : L) = f 0 := Subtype.ext hf.symm + rw [this, Homeomorph.symm_apply_apply, hf'] + +/-- `lineSwap` fixes the common last end of the two lines. -/ +theorem lineSwap_one {b : S} (hf : (f 1).1 = b) (hf' : (f' 1).1 = b) : + lineSwap f f' b = b := by + have hb : b ∈ L := hf ▸ (f 1).2 + rw [lineSwap_of_mem hb] + have : (⟨b, hb⟩ : L) = f 1 := Subtype.ext hf.symm + rw [this, Homeomorph.symm_apply_apply, hf'] + +/-- `lineSwap` fixes every point that is not an inner point of `L`. -/ +theorem lineSwap_eq_self {a b x : S} (hfa : (f 0).1 = a) (hfa' : (f' 0).1 = a) + (hfb : (f 1).1 = b) (hfb' : (f' 1).1 = b) (hx : x ∈ L → x = a ∨ x = b) : + lineSwap f f' x = x := by + by_cases hxL : x ∈ L + · rcases hx hxL with rfl | rfl + · exact lineSwap_zero hfa hfa' + · exact lineSwap_one hfb hfb' + · exact lineSwap_of_notMem hxL + +theorem continuousOn_lineSwap_line : ContinuousOn (lineSwap f f') L := by + rw [continuousOn_iff_continuous_domRestrict] + have : L.domRestrict (lineSwap f f') = fun x : L => (f' (f.symm x)).1 := by + funext x + simp only [domRestrict_apply, lineSwap_of_mem x.2] + rw [this] + exact continuous_subtype_val.comp (f'.continuous.comp f.symm.continuous) + +/-- `lineSwap` is continuous on `K ∪ L` when `K` is closed and meets `L` only in its ends. -/ +theorem continuousOn_lineSwap [T2Space S] {a b : S} {K : Set S} (hK : IsClosed K) + (hfa : (f 0).1 = a) (hfa' : (f' 0).1 = a) (hfb : (f 1).1 = b) (hfb' : (f' 1).1 = b) + (hKL : K ∩ L ⊆ {a, b}) : ContinuousOn (lineSwap f f') (K ∪ L) := by + have hL : IsLineWithEnds L a b := ⟨f, hfa, hfb⟩ + refine ContinuousOn.union_of_isClosed ?_ continuousOn_lineSwap_line hK + (isClosed_of_isLineWithEnds hL) + refine continuousOn_id.congr fun x hx => ?_ + exact lineSwap_eq_self hfa hfa' hfb hfb' fun hxL => hKL ⟨hx, hxL⟩ + +end LineSwap + +/-- One side of `exists_homeo_moving_line`. Let `Δ, Δ'` be closed discs with boundaries `A ∪ L` +and `A ∪ L'`, where `L, L'` are lines with ends `a, b` and `A` misses both lines and has closure +meeting them only in `a, b`. Then there is a homeomorphism `Δ → Δ'` that is `lineSwap` on the +boundary. -/ +theorem exists_half_homeo [T2Space S] {Δ Δ' A L L' : Set S} {a b : S} + (hΔ : IsClosedDisc Δ) (hΔ' : IsClosedDisc Δ') (f : unitInterval ≃ₜ L) (f' : unitInterval ≃ₜ L') + (hfa : (f 0).1 = a) (hfa' : (f' 0).1 = a) (hfb : (f 1).1 = b) (hfb' : (f' 1).1 = b) + (hbd : discBd Δ = A ∪ L) (hbd' : discBd Δ' = A ∪ L') + (hAL : Disjoint A L) (hAL' : Disjoint A L') + (hcl : closure A ∩ L ⊆ {a, b}) (hcl' : closure A ∩ L' ⊆ {a, b}) : + ∃ F F' : S → S, MapsTo F Δ Δ' ∧ MapsTo F' Δ' Δ ∧ ContinuousOn F Δ ∧ ContinuousOn F' Δ' ∧ + LeftInvOn F' F Δ ∧ LeftInvOn F F' Δ' ∧ (∀ x ∈ discBd Δ, F x = lineSwap f f' x) ∧ + (∀ y ∈ discBd Δ', F' y = lineSwap f' f y) := by + classical + -- `lineSwap` maps `A ∪ L` onto `A ∪ L'`, with inverse `lineSwap f' f`. + have hmaps : ∀ x ∈ A ∪ L, lineSwap f f' x ∈ A ∪ L' := by + rintro x (hx | hx) + · rw [lineSwap_of_notMem (disjoint_left.mp hAL hx)] + exact Or.inl hx + · exact Or.inr (lineSwap_mem hx) + have hmaps' : ∀ y ∈ A ∪ L', lineSwap f' f y ∈ A ∪ L := by + rintro y (hy | hy) + · rw [lineSwap_of_notMem (disjoint_left.mp hAL' hy)] + exact Or.inl hy + · exact Or.inr (lineSwap_mem hy) + have hinv : ∀ x ∈ A ∪ L, lineSwap f' f (lineSwap f f' x) = x := by + rintro x (hx | hx) + · rw [lineSwap_of_notMem (disjoint_left.mp hAL hx), + lineSwap_of_notMem (disjoint_left.mp hAL' hx)] + · exact lineSwap_lineSwap hx + have hinv' : ∀ y ∈ A ∪ L', lineSwap f f' (lineSwap f' f y) = y := by + rintro y (hy | hy) + · rw [lineSwap_of_notMem (disjoint_left.mp hAL' hy), + lineSwap_of_notMem (disjoint_left.mp hAL hy)] + · exact lineSwap_lineSwap hy + have hc : ContinuousOn (lineSwap f f') (A ∪ L) := + (continuousOn_lineSwap isClosed_closure hfa hfa' hfb hfb' hcl).mono + (union_subset_union_left _ subset_closure) + have hc' : ContinuousOn (lineSwap f' f) (A ∪ L') := + (continuousOn_lineSwap isClosed_closure hfa' hfa hfb' hfb hcl').mono + (union_subset_union_left _ subset_closure) + let e : discBd Δ ≃ₜ discBd Δ' := + { toFun := fun x => ⟨lineSwap f f' x.1, hbd' ▸ hmaps x.1 (hbd ▸ x.2)⟩ + invFun := fun y => ⟨lineSwap f' f y.1, hbd ▸ hmaps' y.1 (hbd' ▸ y.2)⟩ + left_inv := fun x => Subtype.ext (hinv x.1 (hbd ▸ x.2)) + right_inv := fun y => Subtype.ext (hinv' y.1 (hbd' ▸ y.2)) + continuous_toFun := Continuous.subtype_mk + (hc.comp_continuous continuous_subtype_val fun x => hbd ▸ x.2) _ + continuous_invFun := Continuous.subtype_mk + (hc'.comp_continuous continuous_subtype_val fun y => hbd' ▸ y.2) _ } + obtain ⟨Φ, hΦ⟩ := GM12.exists_disc_homeomorph_extending_boundary hΔ hΔ' e + let F : S → S := fun x => if hx : x ∈ Δ then (Φ ⟨x, hx⟩).1 else x + let F' : S → S := fun y => if hy : y ∈ Δ' then (Φ.symm ⟨y, hy⟩).1 else y + have hF : ∀ x (hx : x ∈ Δ), F x = (Φ ⟨x, hx⟩).1 := fun x hx => by simp [F, hx] + have hF' : ∀ y (hy : y ∈ Δ'), F' y = (Φ.symm ⟨y, hy⟩).1 := fun y hy => by simp [F', hy] + have hFbd : ∀ x ∈ discBd Δ, F x = lineSwap f f' x := fun x hx => by + rw [hF x (discBd_subset Δ hx)] + exact hΦ ⟨x, hx⟩ + refine ⟨F, F', fun x hx => ?_, fun y hy => ?_, ?_, ?_, fun x hx => ?_, fun y hy => ?_, + hFbd, fun y hy => ?_⟩ + · rw [hF x hx] + exact (Φ _).2 + · rw [hF' y hy] + exact (Φ.symm _).2 + · rw [continuousOn_iff_continuous_domRestrict] + have : Δ.domRestrict F = fun x : Δ => (Φ x).1 := by + funext x + exact hF x.1 x.2 + rw [this] + exact continuous_subtype_val.comp Φ.continuous + · rw [continuousOn_iff_continuous_domRestrict] + have : Δ'.domRestrict F' = fun y : Δ' => (Φ.symm y).1 := by + funext y + exact hF' y.1 y.2 + rw [this] + exact continuous_subtype_val.comp Φ.symm.continuous + · rw [hF x hx, hF' _ (Φ _).2] + simp + · rw [hF' y hy, hF _ (Φ.symm _).2] + simp + · -- `y = F x` for the boundary point `x = lineSwap f' f y`. + have hx : lineSwap f' f y ∈ discBd Δ := hbd ▸ hmaps' y (hbd' ▸ hy) + have hFx : F (lineSwap f' f y) = y := by + rw [hFbd _ hx, hinv' y (hbd' ▸ hy)] + have hxΔ := discBd_subset Δ hx + calc F' y = F' (F (lineSwap f' f y)) := by rw [hFx] + _ = lineSwap f' f y := by + rw [hF _ hxΔ, hF' _ (Φ _).2] + simp + +/-- **Moving one line across a closed disc.** Let `L, L'` be lines in a closed disc `D` with the +same ends `a ≠ b`, each meeting the boundary of `D` only in `a, b`. Then there is a homeomorphism +of `D` onto itself that fixes the boundary of `D` pointwise and maps `L` onto `L'`. -/ +theorem exists_homeo_moving_line [T2Space S] {D L L' : Set S} {a b : S} (hD : IsClosedDisc D) + (hab : a ≠ b) (hL : IsLineWithEnds L a b) (hL' : IsLineWithEnds L' a b) (hLD : L ⊆ D) + (hL'D : L' ⊆ D) (hLbd : L ∩ discBd D = {a, b}) (hL'bd : L' ∩ discBd D = {a, b}) : + ∃ Ψ Ψ' : S → S, MapsTo Ψ D D ∧ MapsTo Ψ' D D ∧ ContinuousOn Ψ D ∧ ContinuousOn Ψ' D ∧ + LeftInvOn Ψ' Ψ D ∧ LeftInvOn Ψ Ψ' D ∧ (∀ x ∈ discBd D, Ψ x = x) ∧ Ψ '' L = L' := by + classical + obtain ⟨f, hfa, hfb⟩ := hL + obtain ⟨f', hfa', hfb'⟩ := hL' + -- Cut `D` along `L` and along `L'`. + obtain ⟨A₁, A₂, Δ₁, Δ₂, hA₁₂, hcomp, hΔ₁, hΔ₂, hU, hI, hb₁, hb₂, -⟩ := + disc_iArc D L a b hD hLD hab ⟨f, hfa, hfb⟩ hLbd + obtain ⟨B₁, B₂, E₁', E₂', hB₁₂, hcomp', hE₁', hE₂', hU', hI', hc₁', hc₂', -⟩ := + disc_iArc D L' a b hD hL'D hab ⟨f', hfa', hfb'⟩ hL'bd + -- Name the pieces of the cut along `L'` so that they have the boundary parts `A₁, A₂`. + obtain ⟨E₁, E₂, hE₁, hE₂, hUE, hIE, hd₁, hd₂⟩ : ∃ E₁ E₂ : Set S, IsClosedDisc E₁ ∧ + IsClosedDisc E₂ ∧ E₁ ∪ E₂ = D ∧ E₁ ∩ E₂ = L' ∧ discBd E₁ = A₁ ∪ L' ∧ + discBd E₂ = A₂ ∪ L' := by + have hB₁ : B₁ ∈ ({A₁, A₂} : Set (Set S)) := hcomp ▸ hcomp' ▸ Or.inl rfl + have hB₂ : B₂ ∈ ({A₁, A₂} : Set (Set S)) := hcomp ▸ hcomp' ▸ Or.inr rfl + rcases hB₁ with rfl | rfl + · rcases hB₂ with rfl | rfl + · exact absurd rfl hB₁₂ + · exact ⟨E₁', E₂', hE₁', hE₂', hU', hI', hc₁', hc₂'⟩ + · rcases hB₂ with rfl | rfl + · exact ⟨E₂', E₁', hE₂', hE₁', union_comm E₁' E₂' ▸ hU', inter_comm E₁' E₂' ▸ hI', hc₂', + hc₁'⟩ + · exact absurd rfl hB₁₂ + -- Facts about the boundary parts `A₁, A₂`. + have hAsub : ∀ A ∈ componentsIn (discBd D \ {a, b}), A ⊆ discBd D \ {a, b} := by + rintro _ ⟨x, -, rfl⟩ + exact connectedComponentIn_subset _ _ + have hA₁ : A₁ ⊆ discBd D \ {a, b} := hAsub A₁ (hcomp ▸ Or.inl rfl) + have hA₂ : A₂ ⊆ discBd D \ {a, b} := hAsub A₂ (hcomp ▸ Or.inr rfl) + have hcover : discBd D \ {a, b} ⊆ A₁ ∪ A₂ := fun x hx => by + have hmem : connectedComponentIn (discBd D \ {a, b}) x ∈ ({A₁, A₂} : Set (Set S)) := + hcomp ▸ ⟨x, hx, rfl⟩ + have hx' := mem_connectedComponentIn hx + rcases hmem with h | h + · exact Or.inl (h ▸ hx') + · exact Or.inr (h ▸ hx') + have hdisj : ∀ {A M : Set S}, A ⊆ discBd D \ {a, b} → M ∩ discBd D = {a, b} → Disjoint A M := + fun {A M} hA hM => disjoint_left.mpr fun x hxA hxM => by + have : x ∈ M ∩ discBd D := ⟨hxM, (hA hxA).1⟩ + rw [hM] at this + exact (hA hxA).2 this + have hclos : ∀ {A M : Set S}, A ⊆ discBd D \ {a, b} → M ∩ discBd D = {a, b} → + closure A ∩ M ⊆ {a, b} := fun {A M} hA hM x hx => by + have hxbd : x ∈ discBd D := + (isClosed_discBd hD).closure_subset_iff.mpr (hA.trans sdiff_subset) hx.1 + rw [← hM] + exact ⟨hx.2, hxbd⟩ + -- The two halves. + obtain ⟨F₁, F₁', hm₁, hm₁', hc₁, hc₁'', hl₁, hr₁, hbd₁, hbd₁'⟩ := + exists_half_homeo hΔ₁ hE₁ f f' hfa hfa' hfb hfb' hb₁ hd₁ (hdisj hA₁ hLbd) (hdisj hA₁ hL'bd) + (hclos hA₁ hLbd) (hclos hA₁ hL'bd) + obtain ⟨F₂, F₂', hm₂, hm₂', hc₂, hc₂'', hl₂, hr₂, hbd₂, hbd₂'⟩ := + exists_half_homeo hΔ₂ hE₂ f f' hfa hfa' hfb hfb' hb₂ hd₂ (hdisj hA₂ hLbd) (hdisj hA₂ hL'bd) + (hclos hA₂ hLbd) (hclos hA₂ hL'bd) + have hLb₁ : L ⊆ discBd Δ₁ := hb₁ ▸ subset_union_right + have hLb₂ : L ⊆ discBd Δ₂ := hb₂ ▸ subset_union_right + have hL'b₁ : L' ⊆ discBd E₁ := hd₁ ▸ subset_union_right + have hL'b₂ : L' ⊆ discBd E₂ := hd₂ ▸ subset_union_right + -- The halves agree on the cut lines. + have hagree : ∀ x ∈ L, F₁ x = F₂ x := fun x hx => by + rw [hbd₁ x (hLb₁ hx), hbd₂ x (hLb₂ hx)] + have hagree' : ∀ y ∈ L', F₁' y = F₂' y := fun y hy => by + rw [hbd₁' y (hL'b₁ hy), hbd₂' y (hL'b₂ hy)] + let Ψ : S → S := fun x => if x ∈ Δ₁ then F₁ x else F₂ x + let Ψ' : S → S := fun y => if y ∈ E₁ then F₁' y else F₂' y + have hΨ₁ : ∀ x ∈ Δ₁, Ψ x = F₁ x := fun x hx => by simp [Ψ, hx] + have hΨ₂ : ∀ x ∈ Δ₂, Ψ x = F₂ x := fun x hx => by + by_cases h : x ∈ Δ₁ + · rw [hΨ₁ x h] + exact hagree x (hI ▸ ⟨h, hx⟩) + · simp [Ψ, h] + have hΨ'₁ : ∀ y ∈ E₁, Ψ' y = F₁' y := fun y hy => by simp [Ψ', hy] + have hΨ'₂ : ∀ y ∈ E₂, Ψ' y = F₂' y := fun y hy => by + by_cases h : y ∈ E₁ + · rw [hΨ'₁ y h] + exact hagree' y (hIE ▸ ⟨h, hy⟩) + · simp [Ψ', h] + have hD₁ : ∀ x ∈ D, x ∈ Δ₁ ∨ x ∈ Δ₂ := fun x hx => by rw [← hU] at hx; exact hx + have hE₁₂ : ∀ y ∈ D, y ∈ E₁ ∨ y ∈ E₂ := fun y hy => by rw [← hUE] at hy; exact hy + have hsub₁ : E₁ ⊆ D := hUE ▸ subset_union_left + have hsub₂ : E₂ ⊆ D := hUE ▸ subset_union_right + have hsubΔ₁ : Δ₁ ⊆ D := hU ▸ subset_union_left + have hsubΔ₂ : Δ₂ ⊆ D := hU ▸ subset_union_right + refine ⟨Ψ, Ψ', fun x hx => ?_, fun y hy => ?_, ?_, ?_, fun x hx => ?_, fun y hy => ?_, + fun x hx => ?_, ?_⟩ + · rcases hD₁ x hx with h | h + · rw [hΨ₁ x h] + exact hsub₁ (hm₁ h) + · rw [hΨ₂ x h] + exact hsub₂ (hm₂ h) + · rcases hE₁₂ y hy with h | h + · rw [hΨ'₁ y h] + exact hsubΔ₁ (hm₁' h) + · rw [hΨ'₂ y h] + exact hsubΔ₂ (hm₂' h) + · rw [← hU] + exact ContinuousOn.union_of_isClosed (hc₁.congr hΨ₁) (hc₂.congr hΨ₂) hΔ₁.isClosed + hΔ₂.isClosed + · rw [← hUE] + exact ContinuousOn.union_of_isClosed (hc₁''.congr hΨ'₁) (hc₂''.congr hΨ'₂) hE₁.isClosed + hE₂.isClosed + · rcases hD₁ x hx with h | h + · rw [hΨ₁ x h, hΨ'₁ _ (hm₁ h), hl₁ h] + · rw [hΨ₂ x h, hΨ'₂ _ (hm₂ h), hl₂ h] + · rcases hE₁₂ y hy with h | h + · rw [hΨ'₁ y h, hΨ₁ _ (hm₁' h), hr₁ h] + · rw [hΨ'₂ y h, hΨ₂ _ (hm₂' h), hr₂ h] + · -- A boundary point of `D` lies in `A₁`, in `A₂` or in `{a, b} ⊆ L`, and `lineSwap` fixes it. + have hfix : lineSwap f f' x = x := lineSwap_eq_self hfa hfa' hfb hfb' fun hxL => by + have : x ∈ L ∩ discBd D := ⟨hxL, hx⟩ + rw [hLbd] at this + exact this + by_cases hxab : x ∈ ({a, b} : Set S) + · have hxL : x ∈ L := (hLbd ▸ hxab : x ∈ L ∩ discBd D).1 + rw [hΨ₁ x (hLb₁.trans (discBd_subset _) hxL), hbd₁ x (hLb₁ hxL), hfix] + · rcases hcover ⟨hx, hxab⟩ with h | h + · have hx₁ : x ∈ discBd Δ₁ := hb₁ ▸ Or.inl h + rw [hΨ₁ x (discBd_subset _ hx₁), hbd₁ x hx₁, hfix] + · have hx₂ : x ∈ discBd Δ₂ := hb₂ ▸ Or.inl h + rw [hΨ₂ x (discBd_subset _ hx₂), hbd₂ x hx₂, hfix] + · ext y + constructor + · rintro ⟨x, hx, rfl⟩ + rw [hΨ₁ x (hLb₁.trans (discBd_subset _) hx), hbd₁ x (hLb₁ hx)] + exact lineSwap_mem hx + · intro hy + refine ⟨lineSwap f' f y, lineSwap_mem hy, ?_⟩ + have hx := lineSwap_mem (f := f') (f' := f) hy + rw [hΨ₁ _ (hLb₁.trans (discBd_subset _) hx), hbd₁ _ (hLb₁ hx), lineSwap_lineSwap hy] + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/Section2.lean b/LeanPool/GraphMinor/GM15/Section2.lean new file mode 100644 index 0000000000..eaf7b00b1e --- /dev/null +++ b/LeanPool/GraphMinor/GM15/Section2.lean @@ -0,0 +1,1454 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Cited +import LeanPool.GraphMinor.GM10.TangleLemmas +import Mathlib.Data.Set.Card + +import LeanPool.GraphMinor.GM09.Bridge + +/-! +# Graph Minors XV, Section 2: Tangles and Transactions + +This file formalizes Section 2 ("Tangles and transactions", pages 116–119) of N. Robertson and +P. D. Seymour, *Graph Minors. XV. Giant steps*, J. Combin. Theory Ser. B 68 (1996) 112–148, over the +shared definitions in `GraphMinor.GM09.Defs`, `GraphMinor.GM10.Defs`, `GraphMinor.GM14.Defs`, and +`GraphMinor.GM15.Defs`: + +- Equivalence lemmas between the wording of Graph Minors XV and the shared definitions of + `GraphMinor.GM09.Defs` (`isCrookedTransaction_iff_exists_ends_in_intervals`, + `isTransaction_of_fence_partition`, `isPVortex_of_bar_ncard_le_three`). +- `minimalComplementarySubgraph` ($\hat{X}$) and `boundaryVertices` ($N(X) = V(X \cap \hat{X})$): + for any subgraph $X \le G$, the unique minimal subgraph $\hat{X} \le G$ such that $(X, \hat{X})$ + is a separation of $G$, with $N(X)$ consisting of all $v \in V(X)$ incident with an edge of $G$ + not in $E(X)$ (page 117). +- `IsSmallSubgraph` ($X \le G$ is small relative to $\mathcal{T}$ if $(X, \hat{X}) \in \mathcal{T}$, + page 117). +- Intermediate numbered claims `(5)`–`(10)` of the proof of (2.1) (`lemma_2_1_claim_5`, + `lemma_2_1_claim_6`, `lemma_2_1_claim_7`, `lemma_2_1_claim_8`, `lemma_2_1_claim_9`, + `lemma_2_1_claim_10`, pages 117–119). +- `theorem_2_1` (**Graph Minors XV, (2.1)**, page 116): if $\mathcal{T}$ is a tangle in $G$ of + order $\ge 5\rho + 2$ ($\rho \ge 1$) and $\mathcal{S}$ is a segregation of $G$ of type $(\rho, + \kappa)$ + such that for every $(C, \Omega) \in \mathcal{S}$ there is no $(A, B) \in \mathcal{T}$ of order + $\le 2\rho + 1$ with $B \subseteq C$, then $\mathcal{S}$ is $\mathcal{T}$-central. +-/ + +public section + +namespace GraphMinor.GM15 + +open Set Function Graph SimpleGraph Hypergraph +open GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM14 + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Equivalence of Wording for Transactions and Crooked Transactions -/ + +private lemma graphWalk_start_mem_support {G : Graph α β} {u v : α} (W : GraphWalk G u v) : + u ∈ W.support := by + cases W <;> simp [GraphWalk.support] + +private lemma graphWalk_end_mem_support {G : Graph α β} {u v : α} (W : GraphWalk G u v) : + v ∈ W.support := by + induction W with + | nil _ => simp [GraphWalk.support] + | cons _ _ ih => simp [GraphWalk.support, ih] + +private lemma endpoints_mem_of_isGraphPathWithEnds {G P : Graph α β} {a b : α} + (h : IsGraphPathWithEnds G P a b) : a ∈ V(P) ∧ b ∈ V(P) := by + rcases h with ⟨_, W, _, hV, _⟩ + rw [hV] + exact ⟨graphWalk_start_mem_support W, graphWalk_end_mem_support W⟩ + +private lemma isOmegaPathWithEnds_symm {S : Society α β} {P : Graph α β} {a b : α} + (h : S.IsOmegaPathWithEnds P a b) : + a ∈ V(P) ∧ b ∈ V(P) ∧ a ≠ b ∧ a ∈ S.Ω.bar ∧ b ∈ S.Ω.bar := by + have hab := endpoints_mem_of_isGraphPathWithEnds h.1 + exact ⟨hab.1, hab.2, h.2.1, h.2.2.1, h.2.2.2⟩ + +/-- Equivalence between the shared definition of a crooked transaction +(`GM09.Society.IsCrookedTransaction`, +having no peripheral member) and the interval wording of Graph Minors XIV (Section 8, page 40) and +Graph Minors XV: a transaction `P_set` in `S` is crooked if and only if for every `P ∈ P_set` and +every pair of ends `a, b` of `P`, both open intervals `S.Ω.interval a b` and `S.Ω.interval b a` +contain an end in `S.transactionEnds P_set`. -/ +theorem isCrookedTransaction_iff_exists_ends_in_intervals (S : Society α β) + (P_set : Set (Graph α β)) : + S.IsCrookedTransaction P_set ↔ + S.IsTransaction P_set ∧ + ∀ P ∈ P_set, ∀ a b : α, S.IsOmegaPathWithEnds P a b → + (∃ u' ∈ S.transactionEnds P_set, u' ∈ S.Ω.interval a b) ∧ + (∃ v' ∈ S.transactionEnds P_set, v' ∈ S.Ω.interval b a) := by + constructor + · rintro ⟨htrans, hno_periph⟩ + refine ⟨htrans, fun P hP a b hab => ?_⟩ + have hnot : ¬ (Disjoint (S.Ω.interval a b) (S.transactionEnds P_set) ∨ + Disjoint (S.Ω.interval b a) (S.transactionEnds P_set)) := by + intro hdisj + exact hno_periph P hP ⟨hP, a, b, hab, hdisj⟩ + rw [not_or, Set.not_disjoint_iff, Set.not_disjoint_iff] at hnot + rcases hnot with ⟨⟨u', hu'1, hu'2⟩, ⟨v', hv'1, hv'2⟩⟩ + exact ⟨⟨u', hu'2, hu'1⟩, ⟨v', hv'2, hv'1⟩⟩ + · rintro ⟨htrans, hex⟩ + refine ⟨htrans, fun P hP ⟨_, a, b, hab, hdisj⟩ => ?_⟩ + rcases hex P hP a b hab with ⟨⟨u', hu'1, hu'2⟩, ⟨v', hv'1, hv'2⟩⟩ + rcases hdisj with h1 | h2 + · exact h1.le_bot ⟨hu'2, hu'1⟩ + · exact h2.le_bot ⟨hv'2, hv'1⟩ + +/-- If `(A, B)` is a fence of `S.Ω` and `P_set` is a set of mutually vertex-disjoint `Ω`-paths in +`S` +such that each `P ∈ P_set` has one end in `A` and one end in `B`, then `P_set` is a transaction in +`S` +(`GM09.Society.IsTransaction`). -/ +theorem isTransaction_of_fence_partition (S : Society α β) (P_set : Set (Graph α β)) + (A B : Set α) (hdisj : S.IsDisjointOmegaPathSet P_set) (hfence : S.Ω.IsFence A B) + (hends : ∀ P ∈ P_set, ∃ a ∈ A, ∃ b ∈ B, S.IsOmegaPathWithEnds P a b) : + S.IsTransaction P_set := + ⟨A, B, hdisj, hfence, hends⟩ + +/-! ## Every society with $|\bar{\Omega}| \le 3$ is a $\rho$-vortex for $\rho \ge 1$ (page 116) -/ + +/-- Remark at the start of the proof of (2.1) (page 116): +"If $|\bar{\Omega}| \le 3$ then $(C, \Omega)$ has no transaction of cardinality $\ge 2$, and again +it is a $\rho$-vortex since $\rho \ge 1$." -/ +theorem isPVortex_of_bar_ncard_le_three {S : Society α β} {p : ℕ} + (hbar : S.Ω.bar.ncard ≤ 3) (hp : 1 ≤ p) : + S.IsPVortex p := by + intro P_set ⟨A, B, hdisj, hfence, hends⟩ + by_contra! hgt + have h2 : 1 < P_set.ncard := by omega + obtain ⟨P₁, hP₁⟩ := Set.nonempty_of_ncard_ne_zero (by omega : P_set.ncard ≠ 0) + obtain ⟨P₂, hP₂, hne⟩ := Set.exists_ne_of_one_lt_ncard h2 P₁ + obtain ⟨a₁, ha₁, b₁, hb₁, hpath₁⟩ := hends P₁ hP₁ + obtain ⟨a₂, ha₂, b₂, hb₂, hpath₂⟩ := hends P₂ hP₂ + have hdisj₁₂ : Disjoint V(P₁) V(P₂) := hdisj.2 hP₁ hP₂ hne.symm + obtain ⟨ha₁_V, hb₁_V, hab₁, ha₁_bar, hb₁_bar⟩ := isOmegaPathWithEnds_symm hpath₁ + obtain ⟨ha₂_V, hb₂_V, hab₂, ha₂_bar, hb₂_bar⟩ := isOmegaPathWithEnds_symm hpath₂ + have ha₁a₂ : a₁ ≠ a₂ := fun h => hdisj₁₂.le_bot ⟨ha₁_V, h ▸ ha₂_V⟩ + have ha₁b₂ : a₁ ≠ b₂ := fun h => hdisj₁₂.le_bot ⟨ha₁_V, h ▸ hb₂_V⟩ + have hb₁a₂ : b₁ ≠ a₂ := fun h => hdisj₁₂.le_bot ⟨hb₁_V, h ▸ ha₂_V⟩ + have hb₁b₂ : b₁ ≠ b₂ := fun h => hdisj₁₂.le_bot ⟨hb₁_V, h ▸ hb₂_V⟩ + have hsub : ({a₁, b₁, a₂, b₂} : Set α) ⊆ S.Ω.bar := by + rintro x (rfl | rfl | rfl | rfl) + · exact ha₁_bar + · exact hb₁_bar + · exact ha₂_bar + · exact hb₂_bar + have hcard4 : ({a₁, b₁, a₂, b₂} : Set α).ncard = 4 := by + rw [Set.ncard_insert_of_notMem, Set.ncard_insert_of_notMem, Set.ncard_pair hab₂] + · simp [hb₁a₂, hb₁b₂] + · simp [hab₁, ha₁a₂, ha₁b₂] + have hle : ({a₁, b₁, a₂, b₂} : Set α).ncard ≤ S.Ω.bar.ncard := + Set.ncard_le_ncard hsub S.Ω.finite_bar + omega + +/-! ## Minimal complementary subgraph $\hat{X}$ and boundary $N(X)$ (page 117) -/ + +/-- For a subgraph $X \le G$, its boundary $N(X)$ is the set of all $v \in V(X)$ incident in $G$ +with an edge of $G$ not in $E(X)$. +Graph Minors XV, Section 2 (page 117): "Thus, $N(X)$ is the set of all $v \in V(X)$ incident with +an edge of $G$ not in $E(X)$." -/ +def boundaryVertices (G X : Hypergraph α β) : Set α := + {v ∈ X.vertexSet | ∃ e ∈ G.edgeSet \ X.edgeSet, G.Inc e v} + +/-- For a subgraph $X \le G$, $\hat{X}$ is the unique minimal subgraph of $G$ such that +$(X, \hat{X})$ is a separation of $G$: its edge set is $E(G) \setminus E(X)$ and its vertex set is +$(V(G) \setminus V(X)) \cup N(X)$. +Graph Minors XV, Section 2 (page 117): "For any subgraph $X$ of $G$, let $\hat{X}$ be the unique +minimal subgraph so that $(X, \hat{X})$ is a separation of $G$, and let $N(X) = V(X \cap \hat{X})$." +-/ +def minimalComplementarySubgraph (G X : Hypergraph α β) : Hypergraph α β where + vertexSet := (G.vertexSet \ X.vertexSet) ∪ boundaryVertices G X + edgeSet := G.edgeSet \ X.edgeSet + Inc e v := e ∈ G.edgeSet \ X.edgeSet ∧ G.Inc e v + vertex_mem_of_inc e v h := by + by_cases hv : v ∈ X.vertexSet + · exact Or.inr ⟨hv, e, h.1, h.2⟩ + · exact Or.inl ⟨G.vertex_mem_of_inc h.2, hv⟩ + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := (G.vertexSet_finite.sdiff).union (X.vertexSet_finite.subset fun _ h => h.1) + edgeSet_finite := G.edgeSet_finite.sdiff + +/-- A subgraph $X \le G$ is *small* with respect to $\mathcal{T}$ if $(X, \hat{X}) \in \mathcal{T}$. +Graph Minors XV, Section 2 (page 117): "Let us say that $X \subseteq G$ is *small* if +$(X, \hat{X}) \in \mathscr{T}$." -/ +def IsSmallSubgraph (G : Hypergraph α β) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (X : Hypergraph α β) : Prop := + (X, minimalComplementarySubgraph G X) ∈ 𝒯 + +private lemma minimalComplementarySubgraph_le (G X : Hypergraph α β) : + minimalComplementarySubgraph G X ≤ G where + vertexSet_subset := by + rintro v (⟨hv, _⟩ | ⟨hv, e, he, hinc⟩) + · exact hv + · exact G.vertex_mem_of_inc hinc + edgeSet_subset := sdiff_subset + ends_eq e he := by + ext v + exact ⟨fun h => ⟨he, h⟩, fun h => h.2⟩ + +private lemma isSeparation_minimalComplementarySubgraph {G X : Hypergraph α β} (hX : X ≤ G) : + G.IsSeparation X (minimalComplementarySubgraph G X) := by + rw [isSeparation_iff_of_le hX (minimalComplementarySubgraph_le G X)] + refine ⟨?_, ?_, ?_⟩ + · ext v + simp only [mem_union, minimalComplementarySubgraph, mem_sdiff, boundaryVertices, + Set.mem_ofPred_eq] + constructor + · rintro (hv | ⟨hv, _⟩ | ⟨hv, _⟩) + · exact hX.vertexSet_subset hv + · exact hv + · exact hX.vertexSet_subset hv + · intro hvG + by_cases hvX : v ∈ X.vertexSet + · exact Or.inl hvX + · exact Or.inr (Or.inl ⟨hvG, hvX⟩) + · exact union_sdiff_self.trans (Set.union_eq_right.mpr hX.edgeSet_subset) + · exact inter_sdiff_self X.edgeSet G.edgeSet + +private lemma inter_vertexSet_minimalComplementarySubgraph (G X : Hypergraph α β) : + (X ∩ minimalComplementarySubgraph G X).vertexSet = boundaryVertices G X := by + ext v + simp only [inter_vertexSet, minimalComplementarySubgraph, mem_inter_iff, mem_union, mem_sdiff, + boundaryVertices, Set.mem_ofPred_eq] + constructor + · rintro ⟨hvX, ⟨_, hvnot⟩ | ⟨_, h⟩⟩ + · exact (hvnot hvX).elim + · exact ⟨hvX, h⟩ + · rintro ⟨hvX, h⟩ + exact ⟨hvX, Or.inr ⟨hvX, h⟩⟩ + +private lemma separationOrder_minimalComplementarySubgraph (G X : Hypergraph α β) : + separationOrder X (minimalComplementarySubgraph G X) = (boundaryVertices G X).ncard := + congrArg Set.ncard (inter_vertexSet_minimalComplementarySubgraph G X) + +private lemma boundaryVertices_bot (G : Hypergraph α β) : + boundaryVertices G (⊥ : Hypergraph α β) = ∅ := by + ext v + simp [boundaryVertices] + +private lemma minimalComplementarySubgraph_bot (G : Hypergraph α β) : + minimalComplementarySubgraph G (⊥ : Hypergraph α β) = G := by + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq (minimalComplementarySubgraph_le G ⊥) le_rfl + · simp [minimalComplementarySubgraph, boundaryVertices_bot] + · simp [minimalComplementarySubgraph] + +private lemma isSmallSubgraph_bot {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) (hθ : 1 ≤ θ) : + IsSmallSubgraph G 𝒯 ⊥ := by + rw [IsSmallSubgraph, minimalComplementarySubgraph_bot] + have hsep : G.IsSeparation ⊥ G := by + simpa [minimalComplementarySubgraph_bot] using + isSeparation_minimalComplementarySubgraph (bot_le : (⊥ : Hypergraph α β) ≤ G) + have hord : separationOrder (⊥ : Hypergraph α β) G < θ := by + have : separationOrder (⊥ : Hypergraph α β) G = 0 := by simp [separationOrder] + omega + rcases h𝒯.axiom1 hsep hord with h | h + · exact h + · exact (h𝒯.axiom3 h rfl).elim + +private lemma boundaryVertices_union_subset (G X Y : Hypergraph α β) : + boundaryVertices G (X ∪ Y) ⊆ boundaryVertices G X ∪ boundaryVertices G Y := by + rintro v ⟨hv, e, ⟨heG, heXY⟩, hinc⟩ + simp only [union_edgeSet, mem_union, not_or] at heXY + rcases hv with hvX | hvY + · exact Or.inl ⟨hvX, e, ⟨heG, heXY.1⟩, hinc⟩ + · exact Or.inr ⟨hvY, e, ⟨heG, heXY.2⟩, hinc⟩ + +/-! ## Claims (5)–(10) and Proof of (2.1) (pages 117–119) -/ + +/-- Indexed subgraphs $X_k$ ($0 \le k \le n + 1$) of $C$ for a linear decomposition of $(C, +\Omega)$, +where $X_0 = X_{n+1} = \bot$ and $X_{i+1} = X(i)$ for $i \in \operatorname{Fin} n$ +(Graph Minors XV, Section 2, page 117). -/ +private def decompPiece {n : ℕ} (X : Fin n → Hypergraph α β) (k : ℕ) : Hypergraph α β := + if h : 1 ≤ k ∧ k ≤ n then X ⟨k - 1, by omega⟩ else ⊥ + +/-- Prefix union $P_i = \bigcup_{1 \le j \le i} X_j$ for $0 \le i \le n$, with $P_0 = \bot$ +(Graph Minors XV, Section 2, page 118). -/ +private def prefixUnion {n : ℕ} (X : Fin n → Hypergraph α β) : ℕ → Hypergraph α β + | 0 => ⊥ + | i + 1 => prefixUnion X i ∪ decompPiece X (i + 1) + +private def suffixUnionAux {n : ℕ} (X : Fin n → Hypergraph α β) : ℕ → Hypergraph α β + | 0 => ⊥ + | d + 1 => decompPiece X (n + 1 - (d + 1)) ∪ suffixUnionAux X d + +/-- Suffix union $Q_k = \bigcup_{k \le j \le n} X_j$ for $1 \le k \le n + 1$, with $Q_{n+1} = \bot$ +(Graph Minors XV, Section 2, page 118). -/ +private def suffixUnion {n : ℕ} (X : Fin n → Hypergraph α β) (k : ℕ) : Hypergraph α β := + suffixUnionAux X (n + 1 - k) + +private lemma suffixUnion_n_add_one {n : ℕ} (X : Fin n → Hypergraph α β) : + suffixUnion X (n + 1) = ⊥ := by + simp [suffixUnion, suffixUnionAux] + +private lemma suffixUnion_eq_union {n : ℕ} (X : Fin n → Hypergraph α β) {k : ℕ} (hk : k ≤ n) : + suffixUnion X k = decompPiece X k ∪ suffixUnion X (k + 1) := by + unfold suffixUnion + have h1 : n + 1 - k = (n - k) + 1 := by omega + have h2 : n + 1 - (k + 1) = n - k := by omega + have h3 : n + 1 - ((n - k) + 1) = k := by omega + rw [h1, suffixUnionAux, h3, h2] + +private lemma decompPiece_le {G : Hypergraph α β} {n : ℕ} {X : Fin n → Hypergraph α β} + (hX : ∀ i, X i ≤ G) (k : ℕ) : decompPiece X k ≤ G := by + unfold decompPiece + split_ifs with h + · exact hX _ + · exact bot_le + +private lemma prefixUnion_le {G : Hypergraph α β} {n : ℕ} {X : Fin n → Hypergraph α β} + (hX : ∀ i, X i ≤ G) (i : ℕ) : prefixUnion X i ≤ G := by + induction i with + | zero => exact bot_le + | succ i ih => exact union_le ih (decompPiece_le hX (i + 1)) + +private lemma suffixUnionAux_le {G : Hypergraph α β} {n : ℕ} {X : Fin n → Hypergraph α β} + (hX : ∀ i, X i ≤ G) (d : ℕ) : suffixUnionAux X d ≤ G := by + induction d with + | zero => exact bot_le + | succ d ih => exact union_le (decompPiece_le hX _) ih + +private lemma suffixUnion_le {G : Hypergraph α β} {n : ℕ} {X : Fin n → Hypergraph α β} + (hX : ∀ i, X i ≤ G) (k : ℕ) : suffixUnion X k ≤ G := + suffixUnionAux_le hX _ + +private lemma mem_prefixUnion_vertexSet {n : ℕ} (X : Fin n → Hypergraph α β) (i : ℕ) (v : α) : + v ∈ (prefixUnion X i).vertexSet ↔ ∃ j : Fin n, j.1 < i ∧ v ∈ (X j).vertexSet := by + induction i with + | zero => simp [prefixUnion] + | succ i ih => + simp only [prefixUnion, union_vertexSet, mem_union, ih] + constructor + · rintro (⟨j, hj, hv⟩ | hv) + · exact ⟨j, by omega, hv⟩ + · by_cases hi : i < n + · have hcond : 1 ≤ i + 1 ∧ i + 1 ≤ n := ⟨by omega, by omega⟩ + simp only [decompPiece, hcond, and_self, ↓reduceDIte, Nat.add_sub_cancel] at hv + exact ⟨⟨i, hi⟩, Nat.lt_succ_self i, hv⟩ + · have hbot : decompPiece X (i + 1) = ⊥ := + dite_eq_right_iff.mpr fun h => ((by omega : ¬ (1 ≤ i + 1 ∧ i + 1 ≤ n)) h).elim + rw [hbot] at hv + exact hv.elim + · rintro ⟨j, hj, hv⟩ + rcases Nat.lt_succ_iff_lt_or_eq.mp hj with hlt | heq + · exact Or.inl ⟨j, hlt, hv⟩ + · right + have hcond : 1 ≤ i + 1 ∧ i + 1 ≤ n := ⟨by omega, by omega⟩ + simp only [decompPiece, hcond, and_self, ↓reduceDIte, Nat.add_sub_cancel] + have hj_eq : (⟨i, by omega⟩ : Fin n) = j := Fin.ext heq.symm + rwa [hj_eq] + +private lemma mem_prefixUnion_edgeSet {n : ℕ} (X : Fin n → Hypergraph α β) (i : ℕ) (e : β) : + e ∈ (prefixUnion X i).edgeSet ↔ ∃ j : Fin n, j.1 < i ∧ e ∈ (X j).edgeSet := by + induction i with + | zero => simp [prefixUnion] + | succ i ih => + simp only [prefixUnion, union_edgeSet, mem_union, ih] + constructor + · rintro (⟨j, hj, he⟩ | he) + · exact ⟨j, by omega, he⟩ + · by_cases hi : i < n + · have hcond : 1 ≤ i + 1 ∧ i + 1 ≤ n := ⟨by omega, by omega⟩ + simp only [decompPiece, hcond, and_self, ↓reduceDIte, Nat.add_sub_cancel] at he + exact ⟨⟨i, hi⟩, Nat.lt_succ_self i, he⟩ + · have hbot : decompPiece X (i + 1) = ⊥ := + dite_eq_right_iff.mpr fun h => ((by omega : ¬ (1 ≤ i + 1 ∧ i + 1 ≤ n)) h).elim + rw [hbot] at he + exact he.elim + · rintro ⟨j, hj, he⟩ + rcases Nat.lt_succ_iff_lt_or_eq.mp hj with hlt | heq + · exact Or.inl ⟨j, hlt, he⟩ + · right + have hcond : 1 ≤ i + 1 ∧ i + 1 ≤ n := ⟨by omega, by omega⟩ + simp only [decompPiece, hcond, and_self, ↓reduceDIte, Nat.add_sub_cancel] + have hj_eq : (⟨i, by omega⟩ : Fin n) = j := Fin.ext heq.symm + rwa [hj_eq] + +private lemma mem_suffixUnionAux_vertexSet {n : ℕ} (X : Fin n → Hypergraph α β) (d : ℕ) + (hd : d ≤ n) (v : α) : + v ∈ (suffixUnionAux X d).vertexSet ↔ ∃ j : Fin n, n - d ≤ j.1 ∧ v ∈ (X j).vertexSet := by + induction d with + | zero => + simp only [suffixUnionAux, bot_vertexSet, mem_empty_iff_false, Nat.sub_zero, false_iff, + not_exists, not_and] + intro j hj + exact absurd hj (not_le_of_gt j.2) + | succ d ih => + have hd_lt : d < n := Nat.lt_of_succ_le hd + simp only [suffixUnionAux, union_vertexSet, mem_union, ih (le_of_lt hd_lt)] + have hcond : 1 ≤ n + 1 - (d + 1) ∧ n + 1 - (d + 1) ≤ n := ⟨by omega, by omega⟩ + constructor + · rintro (hv | ⟨j, hj, hv⟩) + · simp only [decompPiece, hcond, and_self, ↓reduceDIte] at hv + exact ⟨⟨n + 1 - (d + 1) - 1, by omega⟩, by dsimp; omega, hv⟩ + · exact ⟨j, by omega, hv⟩ + · rintro ⟨j, hj, hv⟩ + by_cases heq : j.1 = n - (d + 1) + · left + simp only [decompPiece, hcond, and_self, ↓reduceDIte] + have hj_eq : (⟨n + 1 - (d + 1) - 1, by omega⟩ : Fin n) = j := Fin.ext (by dsimp; omega) + rwa [hj_eq] + · right + exact ⟨j, by omega, hv⟩ + +private lemma mem_suffixUnionAux_edgeSet {n : ℕ} (X : Fin n → Hypergraph α β) (d : ℕ) + (hd : d ≤ n) (e : β) : + e ∈ (suffixUnionAux X d).edgeSet ↔ ∃ j : Fin n, n - d ≤ j.1 ∧ e ∈ (X j).edgeSet := by + induction d with + | zero => + simp only [suffixUnionAux, bot_edgeSet, mem_empty_iff_false, Nat.sub_zero, false_iff, + not_exists, not_and] + intro j hj + exact absurd hj (not_le_of_gt j.2) + | succ d ih => + have hd_lt : d < n := Nat.lt_of_succ_le hd + simp only [suffixUnionAux, union_edgeSet, mem_union, ih (le_of_lt hd_lt)] + have hcond : 1 ≤ n + 1 - (d + 1) ∧ n + 1 - (d + 1) ≤ n := ⟨by omega, by omega⟩ + constructor + · rintro (he | ⟨j, hj, he⟩) + · simp only [decompPiece, hcond, and_self, ↓reduceDIte] at he + exact ⟨⟨n + 1 - (d + 1) - 1, by omega⟩, by dsimp; omega, he⟩ + · exact ⟨j, by omega, he⟩ + · rintro ⟨j, hj, he⟩ + by_cases heq : j.1 = n - (d + 1) + · left + simp only [decompPiece, hcond, and_self, ↓reduceDIte] + have hj_eq : (⟨n + 1 - (d + 1) - 1, by omega⟩ : Fin n) = j := Fin.ext (by dsimp; omega) + rwa [hj_eq] + · right + exact ⟨j, by omega, he⟩ + +private lemma mem_suffixUnion_vertexSet {n : ℕ} (X : Fin n → Hypergraph α β) {k : ℕ} + (hk1 : 1 ≤ k) (hkn : k ≤ n + 1) (v : α) : + v ∈ (suffixUnion X k).vertexSet ↔ ∃ j : Fin n, k - 1 ≤ j.1 ∧ v ∈ (X j).vertexSet := by + unfold suffixUnion + rw [mem_suffixUnionAux_vertexSet X (n + 1 - k) (by omega)] + have hsub : n - (n + 1 - k) = k - 1 := by omega + rw [hsub] + +private lemma mem_suffixUnion_edgeSet {n : ℕ} (X : Fin n → Hypergraph α β) {k : ℕ} + (hk1 : 1 ≤ k) (hkn : k ≤ n + 1) (e : β) : + e ∈ (suffixUnion X k).edgeSet ↔ ∃ j : Fin n, k - 1 ≤ j.1 ∧ e ∈ (X j).edgeSet := by + unfold suffixUnion + rw [mem_suffixUnionAux_edgeSet X (n + 1 - k) (by omega)] + have hsub : n - (n + 1 - k) = k - 1 := by omega + rw [hsub] + +/-- Claim (5) in the proof of Graph Minors XV, (2.1) (page 117): +"For $1 \le i \le n$, $N(X_i) \subseteq V(X_i \cap X_{i-1}) \cup V(X_i \cap X_{i+1}) \cup \{t_i\}$, +and consequently $|N(X_i)| \le 2\rho+1$." -/ +private lemma lemma_2_1_claim_5 {G C : Hypergraph α β} {n p : ℕ} + {t : Fin n → α} {X : Fin n → Hypergraph α β} + (hC_le : C ≤ G) + (hbd_C : boundaryVertices G C ⊆ range t) + (hX_le : ∀ i, X i ≤ C) + (hX_E : ∀ e ∈ C.edgeSet, ∃ i, e ∈ (X i).edgeSet) + (hX_disj : ∀ i j : Fin n, i < j → + Disjoint (X i).edgeSet (X j).edgeSet ∧ ((X i).vertexSet ∩ (X j).vertexSet).ncard ≤ p) + (hX_betw : ∀ i j k : Fin n, i ≤ j → j ≤ k → + (X i).vertexSet ∩ (X k).vertexSet ⊆ (X j).vertexSet) + (hX_t : ∀ i : Fin n, t i ∈ (X i).vertexSet) + (i : Fin n) : + boundaryVertices G (X i) ⊆ + ((X i).vertexSet ∩ (decompPiece X i.1).vertexSet) ∪ + ((X i).vertexSet ∩ (decompPiece X (i.1 + 2)).vertexSet) ∪ + {t i} ∧ + (boundaryVertices G (X i)).ncard ≤ 2 * p + 1 := by + have hsub : boundaryVertices G (X i) ⊆ + ((X i).vertexSet ∩ (decompPiece X i.1).vertexSet) ∪ + ((X i).vertexSet ∩ (decompPiece X (i.1 + 2)).vertexSet) ∪ + {t i} := by + rintro v ⟨hvXi, e, ⟨heG, heXi⟩, hinc⟩ + by_cases hlt : ∃ j : Fin n, j < i ∧ v ∈ (X j).vertexSet + · rcases hlt with ⟨j, hj, hvXj⟩ + left; left + refine ⟨hvXi, ?_⟩ + have hi1 : 1 ≤ i.1 ∧ i.1 ≤ n := ⟨by omega, le_of_lt i.2⟩ + simp only [decompPiece, hi1, and_self, ↓reduceDIte] + exact hX_betw j ⟨i.1 - 1, by omega⟩ i (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) + (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) ⟨hvXj, hvXi⟩ + · by_cases hgt : ∃ j : Fin n, i < j ∧ v ∈ (X j).vertexSet + · rcases hgt with ⟨j, hj, hvXj⟩ + left; right + refine ⟨hvXi, ?_⟩ + have hi2 : 1 ≤ i.1 + 2 ∧ i.1 + 2 ≤ n := ⟨by omega, by omega⟩ + simp only [decompPiece, hi2, and_self, ↓reduceDIte] + exact hX_betw i ⟨i.1 + 2 - 1, by omega⟩ j (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) + (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) ⟨hvXi, hvXj⟩ + · right + push Not at hlt hgt + have he_not_C : e ∉ C.edgeSet := by + intro heC + obtain ⟨j, hj⟩ := hX_E e heC + have hvXj : v ∈ (X j).vertexSet := + (X j).vertex_mem_of_inc ((inc_iff_of_le ((hX_le j).trans hC_le) hj).mpr hinc) + rcases lt_trichotomy j i with h1 | rfl | h2 + · exact hlt j h1 hvXj + · exact heXi hj + · exact hgt j h2 hvXj + have hv_bd : v ∈ boundaryVertices G C := + ⟨(hX_le i).vertexSet_subset hvXi, e, ⟨heG, he_not_C⟩, hinc⟩ + obtain ⟨j, hj_eq⟩ := hbd_C hv_bd + have hvXj : v ∈ (X j).vertexSet := by + rw [← hj_eq] + exact hX_t j + have hji : j = i := by + rcases lt_trichotomy j i with h1 | h | h2 + · exact (hlt j h1 hvXj).elim + · exact h + · exact (hgt j h2 hvXj).elim + subst hji + exact mem_singleton_iff.mpr hj_eq.symm + refine ⟨hsub, ?_⟩ + have h1 : ((X i).vertexSet ∩ (decompPiece X i.1).vertexSet).ncard ≤ p := by + by_cases hi : 1 ≤ i.1 ∧ i.1 ≤ n + · simp only [decompPiece, hi, and_self, ↓reduceDIte] + rw [Set.inter_comm] + exact (hX_disj ⟨i.1 - 1, by omega⟩ i (Fin.lt_def.mpr (by dsimp; omega))).2 + · have hbot : decompPiece X i.1 = ⊥ := dite_eq_right_iff.mpr fun h => (hi h).elim + rw [hbot] + simp + have h2 : ((X i).vertexSet ∩ (decompPiece X (i.1 + 2)).vertexSet).ncard ≤ p := by + by_cases hi : 1 ≤ i.1 + 2 ∧ i.1 + 2 ≤ n + · simp only [decompPiece, hi, and_self, ↓reduceDIte] + exact (hX_disj i ⟨i.1 + 2 - 1, by omega⟩ (Fin.lt_def.mpr (by dsimp; omega))).2 + · have hbot : decompPiece X (i.1 + 2) = ⊥ := dite_eq_right_iff.mpr fun h => (hi h).elim + rw [hbot] + simp + have hfin1 : ((X i).vertexSet ∩ (decompPiece X i.1).vertexSet).Finite := + (X i).vertexSet_finite.inter_of_left _ + have hfin2 : ((X i).vertexSet ∩ (decompPiece X (i.1 + 2)).vertexSet).Finite := + (X i).vertexSet_finite.inter_of_left _ + have hfin_union := (hfin1.union hfin2).union (Set.finite_singleton (t i)) + have hle1 := Set.ncard_le_ncard hsub hfin_union + have hle2 := Set.ncard_union_le + (((X i).vertexSet ∩ (decompPiece X i.1).vertexSet) ∪ + ((X i).vertexSet ∩ (decompPiece X (i.1 + 2)).vertexSet)) {t i} + have hle3 := Set.ncard_union_le + ((X i).vertexSet ∩ (decompPiece X i.1).vertexSet) + ((X i).vertexSet ∩ (decompPiece X (i.1 + 2)).vertexSet) + rw [Set.ncard_singleton] at hle2 + omega + +/-- Claim (6) in the proof of Graph Minors XV, (2.1) (page 117): +"$X_1, \dots, X_n$ are small." -/ +private lemma lemma_2_1_claim_6 {G C : Hypergraph α β} {θ p : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + (hθ : 2 * p + 2 ≤ θ) + (hno_small : ∀ A B : Hypergraph α β, (A, B) ∈ 𝒯 → separationOrder A B ≤ 2 * p + 1 → + ¬ (B ≤ C)) + {X : Hypergraph α β} (hX_le : X ≤ C) (hX_G : X ≤ G) + (hbd : (boundaryVertices G X).ncard ≤ 2 * p + 1) : + IsSmallSubgraph G 𝒯 X := by + have hsep := isSeparation_minimalComplementarySubgraph hX_G + have hord : separationOrder X (minimalComplementarySubgraph G X) ≤ 2 * p + 1 := by + rw [separationOrder_minimalComplementarySubgraph] + exact hbd + rcases h𝒯.axiom1 hsep (by omega) with h | h + · exact h + · exfalso + rw [separationOrder_comm] at hord + exact hno_small (minimalComplementarySubgraph G X) X h hord hX_le + +/-- Claim (7) in the proof of Graph Minors XV, (2.1) (page 117): +"If $Z \subseteq X \cup Y \subseteq G$ and $X, Y$ are small and $|N(Z)| < ord(\mathscr{T})$, +then $Z$ is small." -/ +private lemma lemma_2_1_claim_7 {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {X Y Z : Hypergraph α β} (hX : X ≤ G) (hY : Y ≤ G) (hZ : Z ≤ G) + (hZ_sub : Z ≤ X ∪ Y) (hX_small : IsSmallSubgraph G 𝒯 X) (hY_small : IsSmallSubgraph G 𝒯 Y) + (hbd : (boundaryVertices G Z).ncard < θ) : + IsSmallSubgraph G 𝒯 Z := by + have hsep := isSeparation_minimalComplementarySubgraph hZ + have hord : separationOrder Z (minimalComplementarySubgraph G Z) < θ := by + rwa [separationOrder_minimalComplementarySubgraph] + rcases h𝒯.axiom1 hsep hord with h | h + · exact h + · exfalso + have hunion : X ∪ Y ∪ minimalComplementarySubgraph G Z = G := by + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (union_le (union_le hX hY) (minimalComplementarySubgraph_le G Z)) le_rfl + · ext v + simp only [union_vertexSet, mem_union] + constructor + · rintro ((hvX | hvY) | hvZ) + · exact hX.vertexSet_subset hvX + · exact hY.vertexSet_subset hvY + · exact (minimalComplementarySubgraph_le G Z).vertexSet_subset hvZ + · intro hvG + have hv_sep : v ∈ Z.vertexSet ∪ (minimalComplementarySubgraph G Z).vertexSet := by + rw [hsep.vertexSet_union] + exact hvG + rcases hv_sep with hvZ | hvZ' + · exact Or.inl (hZ_sub.vertexSet_subset hvZ) + · exact Or.inr hvZ' + · ext e + simp only [union_edgeSet, mem_union] + constructor + · rintro ((heX | heY) | heZ) + · exact hX.edgeSet_subset heX + · exact hY.edgeSet_subset heY + · exact (minimalComplementarySubgraph_le G Z).edgeSet_subset heZ + · intro heG + have he_sep : e ∈ Z.edgeSet ∪ (minimalComplementarySubgraph G Z).edgeSet := by + rw [hsep.edgeSet_union] + exact heG + rcases he_sep with heZ | heZ' + · exact Or.inl (hZ_sub.edgeSet_subset heZ) + · exact Or.inr heZ' + exact h𝒯.axiom2 hX_small hY_small h hunion + +private lemma bot_inter (B : Hypergraph α β) : (⊥ : Hypergraph α β) ∩ B = ⊥ := by + ext <;> exact ⟨And.left, False.elim⟩ + +private lemma boundaryVertices_prefixUnion_inter_subset {G C A B : Hypergraph α β} {n : ℕ} + {X : Fin n → Hypergraph α β} + (hsep_AB : G.IsSeparation A B) (hB_le_C : B ≤ C) (hC_le : C ≤ G) + (hX_le : ∀ j, X j ≤ C) + (hX_E : ∀ e ∈ C.edgeSet, ∃ j, e ∈ (X j).edgeSet) + (hX_betw : ∀ a b c : Fin n, a ≤ b → b ≤ c → + (X a).vertexSet ∩ (X c).vertexSet ⊆ (X b).vertexSet) + (i : ℕ) (hi : i ≤ n) : + boundaryVertices G (prefixUnion X i ∩ B) ⊆ + ((prefixUnion X i).vertexSet ∩ (A ∩ B).vertexSet) ∪ + ((decompPiece X i).vertexSet ∩ (decompPiece X (i + 1)).vertexSet) := by + rintro v ⟨⟨hvPi, hvB⟩, e, ⟨heG, hePiB⟩, hinc⟩ + simp only [inter_edgeSet, mem_inter_iff, not_and] at hePiB + by_cases heB : e ∈ B.edgeSet + · right + have he_not_Pi : e ∉ (prefixUnion X i).edgeSet := fun h => hePiB h heB + have heC : e ∈ C.edgeSet := hB_le_C.edgeSet_subset heB + obtain ⟨j, hjE⟩ := hX_E e heC + have hij : i ≤ j.1 := by + by_contra! hlt + exact he_not_Pi ((mem_prefixUnion_edgeSet X i e).mpr ⟨j, hlt, hjE⟩) + obtain ⟨j₀, hj₀_lt, hvXj₀⟩ := (mem_prefixUnion_vertexSet X i v).mp hvPi + have hvXj : v ∈ (X j).vertexSet := + (X j).vertex_mem_of_inc ((inc_iff_of_le ((hX_le j).trans hC_le) hjE).mpr hinc) + have hi1 : 1 ≤ i ∧ i ≤ n := ⟨by omega, hi⟩ + have hi2 : 1 ≤ i + 1 ∧ i + 1 ≤ n := ⟨by omega, by omega⟩ + simp only [decompPiece, hi1, hi2, and_self, ↓reduceDIte, Nat.add_sub_cancel] + refine ⟨?_, ?_⟩ + · exact hX_betw j₀ ⟨i - 1, by omega⟩ j + (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) + (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) ⟨hvXj₀, hvXj⟩ + · exact hX_betw j₀ ⟨i, by omega⟩ j + (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) + (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) ⟨hvXj₀, hvXj⟩ + · left + have heA : e ∈ A.edgeSet := by + have he_union : e ∈ A.edgeSet ∪ B.edgeSet := by + rw [hsep_AB.edgeSet_union] + exact heG + exact he_union.resolve_right heB + have hvA : v ∈ A.vertexSet := + A.vertex_mem_of_inc ((inc_iff_of_le hsep_AB.left_le heA).mpr hinc) + exact ⟨hvPi, hvA, hvB⟩ + +/-- Claim (8) in the proof of Graph Minors XV, (2.1) (page 118): +"For $0 \le i \le n$, if $|V(P_i) \cap R| < ord(\mathscr{T}) - \rho$ then $P_i \cap B$ is small." -/ +private lemma lemma_2_1_claim_8 {G C A B : Hypergraph α β} {n θ p : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {X : Fin n → Hypergraph α β} + (h𝒯 : IsTangle G θ 𝒯) (hθ : 1 ≤ θ) + (hsep_AB : G.IsSeparation A B) (hB_le_C : B ≤ C) (hC_le : C ≤ G) + (hX_le : ∀ j, X j ≤ C) + (hX_E : ∀ e ∈ C.edgeSet, ∃ j, e ∈ (X j).edgeSet) + (hX_disj : ∀ a b : Fin n, a < b → + Disjoint (X a).edgeSet (X b).edgeSet ∧ ((X a).vertexSet ∩ (X b).vertexSet).ncard ≤ p) + (hX_betw : ∀ a b c : Fin n, a ≤ b → b ≤ c → + (X a).vertexSet ∩ (X c).vertexSet ⊆ (X b).vertexSet) + (hX_small : ∀ j : Fin n, IsSmallSubgraph G 𝒯 (X j)) + (i : ℕ) (hi : i ≤ n) + (hcard : ((prefixUnion X i).vertexSet ∩ (A ∩ B).vertexSet).ncard + p < θ) : + IsSmallSubgraph G 𝒯 (prefixUnion X i ∩ B) := by + induction i with + | zero => + rw [prefixUnion, bot_inter] + exact isSmallSubgraph_bot h𝒯 hθ + | succ i ih => + have hi_le : i ≤ n := le_of_lt hi + have hsub_R : (prefixUnion X i).vertexSet ∩ (A ∩ B).vertexSet ⊆ + (prefixUnion X (i + 1)).vertexSet ∩ (A ∩ B).vertexSet := by + intro v ⟨hv1, hv2⟩ + exact ⟨Or.inl hv1, hv2⟩ + have hfin_R : ((prefixUnion X (i + 1)).vertexSet ∩ (A ∩ B).vertexSet).Finite := + (prefixUnion X (i + 1)).vertexSet_finite.inter_of_left _ + have hcard_prev : ((prefixUnion X i).vertexSet ∩ (A ∩ B).vertexSet).ncard + p < θ := by + have hle := Set.ncard_le_ncard hsub_R hfin_R + omega + have hsmall_prev : IsSmallSubgraph G 𝒯 (prefixUnion X i ∩ B) := ih hi_le hcard_prev + have hsmall_Xi : IsSmallSubgraph G 𝒯 (decompPiece X (i + 1)) := by + have hcond : 1 ≤ i + 1 ∧ i + 1 ≤ n := ⟨by omega, hi⟩ + simp only [decompPiece, hcond, and_self, ↓reduceDIte] + exact hX_small _ + have hZ_sub : prefixUnion X (i + 1) ∩ B ≤ (prefixUnion X i ∩ B) ∪ decompPiece X (i + 1) := by + refine ⟨?_, ?_, ?_⟩ + · rintro v ⟨hv1 | hv2, hvB⟩ + · exact Or.inl ⟨hv1, hvB⟩ + · exact Or.inr hv2 + · rintro e ⟨he1 | he2, heB⟩ + · exact Or.inl ⟨he1, heB⟩ + · exact Or.inr he2 + · intro e he + have hle1 : prefixUnion X (i + 1) ∩ B ≤ G := + inter_le (prefixUnion_le (fun j => (hX_le j).trans hC_le) (i + 1)) hsep_AB.right_le + have hle2 : (prefixUnion X i ∩ B) ∪ decompPiece X (i + 1) ≤ G := + union_le (inter_le (prefixUnion_le (fun j => (hX_le j).trans hC_le) i) hsep_AB.right_le) + (decompPiece_le (fun j => (hX_le j).trans hC_le) (i + 1)) + have he_union : e ∈ ((prefixUnion X i ∩ B) ∪ decompPiece X (i + 1)).edgeSet := by + rcases he with ⟨he1 | he2, heB⟩ + · exact Or.inl ⟨he1, heB⟩ + · exact Or.inr he2 + exact (hle2.ends_eq e he_union).symm.trans (hle1.ends_eq e he) + have hbd_sub := boundaryVertices_prefixUnion_inter_subset hsep_AB hB_le_C hC_le hX_le hX_E + hX_betw (i + 1) hi + have hcap_le : ((decompPiece X (i + 1)).vertexSet ∩ (decompPiece X + (i + 1 + 1)).vertexSet).ncard ≤ p := by + by_cases hi2 : 1 ≤ i + 1 + 1 ∧ i + 1 + 1 ≤ n + · have hi1 : 1 ≤ i + 1 ∧ i + 1 ≤ n := ⟨by omega, hi⟩ + simp only [decompPiece, hi1, hi2, and_self, ↓reduceDIte] + exact (hX_disj ⟨i + 1 - 1, by omega⟩ ⟨i + 1 + 1 - 1, by omega⟩ + (Fin.lt_def.mpr (by dsimp; omega))).2 + · have hbot : decompPiece X (i + 1 + 1) = ⊥ := + dite_eq_right_iff.mpr fun h => (hi2 h).elim + rw [hbot] + simp + have hbd_lt : (boundaryVertices G (prefixUnion X (i + 1) ∩ B)).ncard < θ := by + have hfin2 : ((decompPiece X (i + 1)).vertexSet ∩ (decompPiece X + (i + 1 + 1)).vertexSet).Finite := + (decompPiece X (i + 1)).vertexSet_finite.inter_of_left _ + have hle1 := Set.ncard_le_ncard hbd_sub (hfin_R.union hfin2) + have hle2 := Set.ncard_union_le + ((prefixUnion X (i + 1)).vertexSet ∩ (A ∩ B).vertexSet) + ((decompPiece X (i + 1)).vertexSet ∩ (decompPiece X (i + 1 + 1)).vertexSet) + omega + exact lemma_2_1_claim_7 h𝒯 + (inter_le (prefixUnion_le (fun j => (hX_le j).trans hC_le) i) hsep_AB.right_le) + (decompPiece_le (fun j => (hX_le j).trans hC_le) (i + 1)) + (inter_le (prefixUnion_le (fun j => (hX_le j).trans hC_le) (i + 1)) hsep_AB.right_le) + hZ_sub hsmall_prev hsmall_Xi hbd_lt + +private lemma boundaryVertices_suffixUnion_inter_subset {G C A B : Hypergraph α β} {n : ℕ} + {X : Fin n → Hypergraph α β} + (hsep_AB : G.IsSeparation A B) (hB_le_C : B ≤ C) (hC_le : C ≤ G) + (hX_le : ∀ j, X j ≤ C) + (hX_E : ∀ e ∈ C.edgeSet, ∃ j, e ∈ (X j).edgeSet) + (hX_betw : ∀ a b c : Fin n, a ≤ b → b ≤ c → + (X a).vertexSet ∩ (X c).vertexSet ⊆ (X b).vertexSet) + (k : ℕ) (hk1 : 1 ≤ k) (hkn : k ≤ n) : + boundaryVertices G (suffixUnion X k ∩ B) ⊆ + ((suffixUnion X k).vertexSet ∩ (A ∩ B).vertexSet) ∪ + ((decompPiece X (k - 1)).vertexSet ∩ (decompPiece X k).vertexSet) := by + rintro v ⟨⟨hvQk, hvB⟩, e, ⟨heG, heQkB⟩, hinc⟩ + simp only [inter_edgeSet, mem_inter_iff, not_and] at heQkB + by_cases heB : e ∈ B.edgeSet + · right + have he_not_Qk : e ∉ (suffixUnion X k).edgeSet := fun h => heQkB h heB + have heC : e ∈ C.edgeSet := hB_le_C.edgeSet_subset heB + obtain ⟨j, hjE⟩ := hX_E e heC + have hjk : j.1 < k - 1 := by + by_contra! hge + exact he_not_Qk ((mem_suffixUnion_edgeSet X hk1 (by omega) e).mpr ⟨j, hge, hjE⟩) + obtain ⟨j₀, hj₀_ge, hvXj₀⟩ := (mem_suffixUnion_vertexSet X hk1 (by omega) v).mp hvQk + have hvXj : v ∈ (X j).vertexSet := + (X j).vertex_mem_of_inc ((inc_iff_of_le ((hX_le j).trans hC_le) hjE).mpr hinc) + have hk_prev : 1 ≤ k - 1 ∧ k - 1 ≤ n := ⟨by omega, by omega⟩ + have hk_curr : 1 ≤ k ∧ k ≤ n := ⟨hk1, hkn⟩ + simp only [decompPiece, hk_prev, hk_curr, and_self, ↓reduceDIte] + refine ⟨?_, ?_⟩ + · exact hX_betw j ⟨k - 1 - 1, by omega⟩ j₀ + (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) + (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) ⟨hvXj, hvXj₀⟩ + · exact hX_betw j ⟨k - 1, by omega⟩ j₀ + (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) + (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) ⟨hvXj, hvXj₀⟩ + · left + have heA : e ∈ A.edgeSet := by + have he_union : e ∈ A.edgeSet ∪ B.edgeSet := by + rw [hsep_AB.edgeSet_union] + exact heG + exact he_union.resolve_right heB + have hvA : v ∈ A.vertexSet := + A.vertex_mem_of_inc ((inc_iff_of_le hsep_AB.left_le heA).mpr hinc) + exact ⟨hvQk, hvA, hvB⟩ + +private lemma suffixUnion_inter_isSmall {G C A B : Hypergraph α β} {n θ p : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {X : Fin n → Hypergraph α β} + (h𝒯 : IsTangle G θ 𝒯) (hθ : 1 ≤ θ) + (hsep_AB : G.IsSeparation A B) (hB_le_C : B ≤ C) (hC_le : C ≤ G) + (hX_le : ∀ j, X j ≤ C) + (hX_E : ∀ e ∈ C.edgeSet, ∃ j, e ∈ (X j).edgeSet) + (hX_disj : ∀ a b : Fin n, a < b → + Disjoint (X a).edgeSet (X b).edgeSet ∧ ((X a).vertexSet ∩ (X b).vertexSet).ncard ≤ p) + (hX_betw : ∀ a b c : Fin n, a ≤ b → b ≤ c → + (X a).vertexSet ∩ (X c).vertexSet ⊆ (X b).vertexSet) + (hX_small : ∀ j : Fin n, IsSmallSubgraph G 𝒯 (X j)) + (k : ℕ) (hk1 : 1 ≤ k) (hkn : k ≤ n + 1) + (hcard : ((suffixUnion X k).vertexSet ∩ (A ∩ B).vertexSet).ncard + p < θ) : + IsSmallSubgraph G 𝒯 (suffixUnion X k ∩ B) := by + obtain ⟨d, hd⟩ : ∃ d, d = n + 1 - k := ⟨n + 1 - k, rfl⟩ + have hk_eq : k = n + 1 - d := by omega + have hd_le : d ≤ n := by omega + subst hk_eq + induction d with + | zero => + rw [Nat.sub_zero, suffixUnion_n_add_one, bot_inter] + exact isSmallSubgraph_bot h𝒯 hθ + | succ d ih => + have hd_lt : d < n := Nat.lt_of_succ_le hd_le + let k := n + 1 - (d + 1) + have hk_succ : n + 1 - d = k + 1 := by omega + have hk_le_n : k ≤ n := by omega + have hk_ge_1 : 1 ≤ k := by omega + rw [ suffixUnion_eq_union X hk_le_n ] at hcard + have hsub_R : (suffixUnion X (k + 1)).vertexSet ∩ (A ∩ B).vertexSet ⊆ + (suffixUnion X k).vertexSet ∩ (A ∩ B).vertexSet := by + rw [suffixUnion_eq_union X hk_le_n] + intro v ⟨hv1, hv2⟩ + exact ⟨Or.inr hv1, hv2⟩ + have hfin_R : ((suffixUnion X k).vertexSet ∩ (A ∩ B).vertexSet).Finite := + (suffixUnion X k).vertexSet_finite.inter_of_left _ + have hcard_next : ((suffixUnion X (k + 1)).vertexSet ∩ (A ∩ B).vertexSet).ncard + p < θ := by + have hle := Set.ncard_le_ncard hsub_R hfin_R + rw [suffixUnion_eq_union X hk_le_n] at hle + omega + have hsmall_next : IsSmallSubgraph G 𝒯 (suffixUnion X (k + 1) ∩ B) := by + rw [← hk_succ] at hcard_next ⊢ + exact ih (le_of_lt hd_lt) (by omega) (by omega) hcard_next (by omega) + have hsmall_Xk : IsSmallSubgraph G 𝒯 (decompPiece X k) := by + have hcond : 1 ≤ k ∧ k ≤ n := ⟨hk_ge_1, hk_le_n⟩ + simp only [decompPiece, hcond, and_self, ↓reduceDIte] + exact hX_small _ + have hZ_sub : suffixUnion X k ∩ B ≤ decompPiece X k ∪ (suffixUnion X (k + 1) ∩ B) := by + have heq_u := suffixUnion_eq_union X hk_le_n + refine ⟨?_, ?_, ?_⟩ + · intro v hv + rw [heq_u] at hv + rcases hv with ⟨hv1 | hv2, hvB⟩ + · exact Or.inl hv1 + · exact Or.inr ⟨hv2, hvB⟩ + · intro e he + rw [heq_u] at he + rcases he with ⟨he1 | he2, heB⟩ + · exact Or.inl he1 + · exact Or.inr ⟨he2, heB⟩ + · intro e he + have hle1 : suffixUnion X k ∩ B ≤ G := + inter_le (suffixUnion_le (fun j => (hX_le j).trans hC_le) k) hsep_AB.right_le + have hle2 : decompPiece X k ∪ (suffixUnion X (k + 1) ∩ B) ≤ G := + union_le (decompPiece_le (fun j => (hX_le j).trans hC_le) k) + (inter_le (suffixUnion_le (fun j => (hX_le j).trans hC_le) (k + 1)) hsep_AB.right_le) + have he_union : e ∈ (decompPiece X k ∪ (suffixUnion X (k + 1) ∩ B)).edgeSet := by + rw [heq_u] at he + rcases he with ⟨he1 | he2, heB⟩ + · exact Or.inl he1 + · exact Or.inr ⟨he2, heB⟩ + exact (hle2.ends_eq e he_union).symm.trans (hle1.ends_eq e he) + have hbd_sub := boundaryVertices_suffixUnion_inter_subset hsep_AB hB_le_C hC_le hX_le hX_E + hX_betw k hk_ge_1 hk_le_n + have hcap_le : ((decompPiece X (k - 1)).vertexSet ∩ (decompPiece X k).vertexSet).ncard ≤ p := by + by_cases hk2 : 1 ≤ k - 1 ∧ k - 1 ≤ n + · have hk_c : 1 ≤ k ∧ k ≤ n := ⟨hk_ge_1, hk_le_n⟩ + simp only [decompPiece, hk2, hk_c, and_self, ↓reduceDIte] + exact (hX_disj ⟨k - 1 - 1, by omega⟩ ⟨k - 1, by omega⟩ + (Fin.lt_def.mpr (by dsimp; omega))).2 + · have hbot : decompPiece X (k - 1) = ⊥ := + dite_eq_right_iff.mpr fun h => (hk2 h).elim + rw [hbot] + simp + have hbd_lt : (boundaryVertices G (suffixUnion X k ∩ B)).ncard < θ := by + have hfin2 : ((decompPiece X (k - 1)).vertexSet ∩ (decompPiece X k).vertexSet).Finite := + (decompPiece X (k - 1)).vertexSet_finite.inter_of_left _ + have hle1 := Set.ncard_le_ncard hbd_sub (hfin_R.union hfin2) + have hle2 := Set.ncard_union_le + ((suffixUnion X k).vertexSet ∩ (A ∩ B).vertexSet) + ((decompPiece X (k - 1)).vertexSet ∩ (decompPiece X k).vertexSet) + rw [← suffixUnion_eq_union X hk_le_n] at hcard + omega + exact lemma_2_1_claim_7 h𝒯 + (decompPiece_le (fun j => (hX_le j).trans hC_le) k) + (inter_le (suffixUnion_le (fun j => (hX_le j).trans hC_le) (k + 1)) hsep_AB.right_le) + (inter_le (suffixUnion_le (fun j => (hX_le j).trans hC_le) k) hsep_AB.right_le) + hZ_sub hsmall_Xk hsmall_next hbd_lt + +private lemma not_isSmallSubgraph_of_mem_tangle {G A B : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : IsTangle G θ 𝒯) (hAB : (A, B) ∈ 𝒯) : + ¬ IsSmallSubgraph G 𝒯 B := by + intro hsmall + have hsep_AB := h𝒯.isSeparation hAB + have hunion : A ∪ B ∪ B = G := by + rw [GM10.union_assoc, GM10.union_self, hsep_AB.union_eq] + exact h𝒯.axiom2 hAB hsmall hsmall hunion + +/-- Claim (9) in the proof of Graph Minors XV, (2.1) (page 118): +"$j < n$, and $(P_j \cap B) \cup X_{j+1}$ is small, and $|P_{j+1} \cap R| \ge ord(\mathscr{T}) - +2\rho - 1$." -/ +private lemma lemma_2_1_claim_9 {G C A B : Hypergraph α β} {n θ p : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {t : Fin n → α} {X : Fin n → Hypergraph α β} + (h𝒯 : IsTangle G θ 𝒯) (hp : 1 ≤ p) (hθ : 5 * p + 2 ≤ θ) + (hAB : (A, B) ∈ 𝒯) (hB_le_C : B ≤ C) (hC_le : C ≤ G) + (hbd_C : boundaryVertices G C ⊆ range t) + (hX_le : ∀ j, X j ≤ C) + (hX_V : ∀ v ∈ C.vertexSet, ∃ j, v ∈ (X j).vertexSet) + (hX_E : ∀ e ∈ C.edgeSet, ∃ j, e ∈ (X j).edgeSet) + (hX_disj : ∀ a b : Fin n, a < b → + Disjoint (X a).edgeSet (X b).edgeSet ∧ ((X a).vertexSet ∩ (X b).vertexSet).ncard ≤ p) + (hX_betw : ∀ a b c : Fin n, a ≤ b → b ≤ c → + (X a).vertexSet ∩ (X c).vertexSet ⊆ (X b).vertexSet) + (hX_t : ∀ j : Fin n, t j ∈ (X j).vertexSet) + (hX_small : ∀ j : Fin n, IsSmallSubgraph G 𝒯 (X j)) + (j : ℕ) (hj_le : j ≤ n) + (hj_lt_bound : ((prefixUnion X j).vertexSet ∩ (A ∩ B).vertexSet).ncard + 2 * p + 1 < θ) + (hj_max : ∀ m : ℕ, m ≤ n → + ((prefixUnion X m).vertexSet ∩ (A ∩ B).vertexSet).ncard + 2 * p + 1 < θ → m ≤ j) : + j < n ∧ + IsSmallSubgraph G 𝒯 ((prefixUnion X j ∩ B) ∪ decompPiece X (j + 1)) ∧ + θ ≤ ((prefixUnion X (j + 1)).vertexSet ∩ (A ∩ B).vertexSet).ncard + 2 * p + 1 := by + have hsep_AB := h𝒯.isSeparation hAB + have hsmall_PjB : IsSmallSubgraph G 𝒯 (prefixUnion X j ∩ B) := + lemma_2_1_claim_8 h𝒯 (by omega) hsep_AB hB_le_C hC_le hX_le hX_E hX_disj hX_betw hX_small + j hj_le (by omega) + have hj_lt_n : j < n := by + by_contra! hge + have hjeq : j = n := le_antisymm hj_le hge + subst hjeq + have hPn_B : prefixUnion X j ∩ B = B := by + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (inter_le_right (prefixUnion_le (fun i => (hX_le i).trans hC_le) j) hsep_AB.right_le) le_rfl + · ext v + simp only [inter_vertexSet, mem_inter_iff] + refine ⟨fun h => h.2, fun hvB => ⟨?_, hvB⟩⟩ + obtain ⟨i, hi⟩ := hX_V v (hB_le_C.vertexSet_subset hvB) + exact (mem_prefixUnion_vertexSet X j v).mpr ⟨i, i.2, hi⟩ + · ext e + simp only [inter_edgeSet, mem_inter_iff] + refine ⟨fun h => h.2, fun heB => ⟨?_, heB⟩⟩ + obtain ⟨i, hi⟩ := hX_E e (hB_le_C.edgeSet_subset heB) + exact (mem_prefixUnion_edgeSet X j e).mpr ⟨i, i.2, hi⟩ + rw [hPn_B] at hsmall_PjB + exact not_isSmallSubgraph_of_mem_tangle h𝒯 hAB hsmall_PjB + have hge_next : θ ≤ ((prefixUnion X (j + 1)).vertexSet ∩ (A ∩ B).vertexSet).ncard + 2 * p + 1 + := by + by_contra! hlt + have hle := hj_max (j + 1) hj_lt_n hlt + omega + have hbd_PjB_sub := boundaryVertices_prefixUnion_inter_subset hsep_AB hB_le_C hC_le hX_le hX_E + hX_betw j hj_le + have hcond_j1 : 1 ≤ j + 1 ∧ j + 1 ≤ n := ⟨by omega, hj_lt_n⟩ + have hpiece_j1 : decompPiece X (j + 1) = X ⟨j, hj_lt_n⟩ := by + simp [decompPiece, hcond_j1] + have hsmall_Xj1 : IsSmallSubgraph G 𝒯 (decompPiece X (j + 1)) := by + rw [hpiece_j1] + exact hX_small ⟨j, hj_lt_n⟩ + have hbd_union_lt : (boundaryVertices G ((prefixUnion X j ∩ B) ∪ decompPiece X + (j + 1))).ncard < θ := by + let j_fin : Fin n := ⟨j, hj_lt_n⟩ + let S_j1 : Set α := + ((X j_fin).vertexSet ∩ (decompPiece X j).vertexSet) ∪ + ((X j_fin).vertexSet ∩ (decompPiece X (j + 2)).vertexSet) ∪ + {t j_fin} + have hclaim5_sub : boundaryVertices G (decompPiece X (j + 1)) ⊆ S_j1 := by + rw [hpiece_j1] + exact (lemma_2_1_claim_5 hC_le hbd_C hX_le hX_E hX_disj hX_betw hX_t j_fin).1 + have hsub_total : boundaryVertices G ((prefixUnion X j ∩ B) ∪ decompPiece X (j + 1)) ⊆ + ((prefixUnion X j).vertexSet ∩ (A ∩ B).vertexSet) ∪ S_j1 := by + intro v hv + rcases boundaryVertices_union_subset G (prefixUnion X j ∩ B) (decompPiece X + (j + 1)) hv with hv1 | hv2 + · rcases hbd_PjB_sub hv1 with hvR | ⟨hv_dj, hv_dj1⟩ + · exact Or.inl hvR + · rw [hpiece_j1] at hv_dj1 + exact Or.inr (Or.inl (Or.inl ⟨hv_dj1, hv_dj⟩)) + · exact Or.inr (hclaim5_sub hv2) + have h1 : ((X j_fin).vertexSet ∩ (decompPiece X j).vertexSet).ncard ≤ p := by + by_cases hi : 1 ≤ j ∧ j ≤ n + · simp only [decompPiece, hi, and_self, ↓reduceDIte] + rw [Set.inter_comm] + exact (hX_disj ⟨j - 1, by omega⟩ j_fin (Fin.lt_def.mpr (by dsimp [j_fin]; omega))).2 + · have hbot : decompPiece X j = ⊥ := dite_eq_right_iff.mpr fun h => (hi h).elim + rw [hbot] + simp + have h2 : ((X j_fin).vertexSet ∩ (decompPiece X (j + 2)).vertexSet).ncard ≤ p := by + by_cases hi : 1 ≤ j + 2 ∧ j + 2 ≤ n + · simp only [decompPiece, hi, and_self, ↓reduceDIte] + exact (hX_disj j_fin ⟨j + 2 - 1, by omega⟩ (Fin.lt_def.mpr (by dsimp [j_fin]; omega))).2 + · have hbot : decompPiece X (j + 2) = ⊥ := dite_eq_right_iff.mpr fun h => (hi h).elim + rw [hbot] + simp + have hfin1 : ((X j_fin).vertexSet ∩ (decompPiece X j).vertexSet).Finite := + (X j_fin).vertexSet_finite.inter_of_left _ + have hfin2 : ((X j_fin).vertexSet ∩ (decompPiece X (j + 2)).vertexSet).Finite := + (X j_fin).vertexSet_finite.inter_of_left _ + have hfin_Sj1 : S_j1.Finite := (hfin1.union hfin2).union (Set.finite_singleton (t j_fin)) + have hSj1_le : S_j1.ncard ≤ 2 * p + 1 := by + have hle_a : S_j1.ncard ≤ + (((X j_fin).vertexSet ∩ (decompPiece X j).vertexSet) ∪ + ((X j_fin).vertexSet ∩ (decompPiece X (j + 2)).vertexSet)).ncard + + ({t j_fin} : Set α).ncard := Set.ncard_union_le _ _ + have hle_b := Set.ncard_union_le + ((X j_fin).vertexSet ∩ (decompPiece X j).vertexSet) + ((X j_fin).vertexSet ∩ (decompPiece X (j + 2)).vertexSet) + rw [Set.ncard_singleton] at hle_a + omega + have hfin_R : ((prefixUnion X j).vertexSet ∩ (A ∩ B).vertexSet).Finite := + (prefixUnion X j).vertexSet_finite.inter_of_left _ + have hle1 := Set.ncard_le_ncard hsub_total (hfin_R.union hfin_Sj1) + have hle2 := Set.ncard_union_le + ((prefixUnion X j).vertexSet ∩ (A ∩ B).vertexSet) S_j1 + omega + have hsmall_union : IsSmallSubgraph G 𝒯 ((prefixUnion X j ∩ B) ∪ decompPiece X (j + 1)) := + lemma_2_1_claim_7 h𝒯 + (inter_le (prefixUnion_le (fun i => (hX_le i).trans hC_le) j) hsep_AB.right_le) + (decompPiece_le (fun i => (hX_le i).trans hC_le) (j + 1)) + (union_le (inter_le (prefixUnion_le (fun i => (hX_le i).trans hC_le) j) hsep_AB.right_le) + (decompPiece_le (fun i => (hX_le i).trans hC_le) (j + 1))) + le_rfl hsmall_PjB hsmall_Xj1 hbd_union_lt + exact ⟨hj_lt_n, hsmall_union, hge_next⟩ + +/-- Claim (10) in the proof of Graph Minors XV, (2.1) (page 119): +"$k > 1$, and $(Q_k \cap B) \cup X_{k-1}$ is small, and $|Q_{k-1} \cap R| \ge ord(\mathscr{T}) - +2\rho - 1$." -/ +private lemma lemma_2_1_claim_10 {G C A B : Hypergraph α β} {n θ p : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {t : Fin n → α} {X : Fin n → Hypergraph α β} + (h𝒯 : IsTangle G θ 𝒯) (hp : 1 ≤ p) (hθ : 5 * p + 2 ≤ θ) + (hAB : (A, B) ∈ 𝒯) (hB_le_C : B ≤ C) (hC_le : C ≤ G) + (hbd_C : boundaryVertices G C ⊆ range t) + (hX_le : ∀ j, X j ≤ C) + (hX_V : ∀ v ∈ C.vertexSet, ∃ j, v ∈ (X j).vertexSet) + (hX_E : ∀ e ∈ C.edgeSet, ∃ j, e ∈ (X j).edgeSet) + (hX_disj : ∀ a b : Fin n, a < b → + Disjoint (X a).edgeSet (X b).edgeSet ∧ ((X a).vertexSet ∩ (X b).vertexSet).ncard ≤ p) + (hX_betw : ∀ a b c : Fin n, a ≤ b → b ≤ c → + (X a).vertexSet ∩ (X c).vertexSet ⊆ (X b).vertexSet) + (hX_t : ∀ j : Fin n, t j ∈ (X j).vertexSet) + (hX_small : ∀ j : Fin n, IsSmallSubgraph G 𝒯 (X j)) + (k : ℕ) (hk1 : 1 ≤ k) (hkn : k ≤ n + 1) + (hk_lt_bound : ((suffixUnion X k).vertexSet ∩ (A ∩ B).vertexSet).ncard + 2 * p + 1 < θ) + (hk_min : ∀ m : ℕ, 1 ≤ m → m ≤ n + 1 → + ((suffixUnion X m).vertexSet ∩ (A ∩ B).vertexSet).ncard + 2 * p + 1 < θ → k ≤ m) : + 1 < k ∧ + IsSmallSubgraph G 𝒯 ((suffixUnion X k ∩ B) ∪ decompPiece X (k - 1)) ∧ + θ ≤ ((suffixUnion X (k - 1)).vertexSet ∩ (A ∩ B).vertexSet).ncard + 2 * p + 1 := by + have hsep_AB := h𝒯.isSeparation hAB + have hsmall_QkB : IsSmallSubgraph G 𝒯 (suffixUnion X k ∩ B) := + suffixUnion_inter_isSmall h𝒯 (by omega) hsep_AB hB_le_C hC_le hX_le hX_E hX_disj hX_betw + hX_small k hk1 hkn (by omega) + have hk_gt_1 : 1 < k := by + by_contra! hle + have hkeq : k = 1 := le_antisymm hle hk1 + subst hkeq + have hQ1_B : suffixUnion X 1 ∩ B = B := by + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (inter_le_right (suffixUnion_le (fun i => (hX_le i).trans hC_le) 1) hsep_AB.right_le) le_rfl + · ext v + simp only [inter_vertexSet, mem_inter_iff] + refine ⟨fun h => h.2, fun hvB => ⟨?_, hvB⟩⟩ + obtain ⟨i, hi⟩ := hX_V v (hB_le_C.vertexSet_subset hvB) + exact (mem_suffixUnion_vertexSet X le_rfl (by omega) v).mpr ⟨i, by omega, hi⟩ + · ext e + simp only [inter_edgeSet, mem_inter_iff] + refine ⟨fun h => h.2, fun heB => ⟨?_, heB⟩⟩ + obtain ⟨i, hi⟩ := hX_E e (hB_le_C.edgeSet_subset heB) + exact (mem_suffixUnion_edgeSet X le_rfl (by omega) e).mpr ⟨i, by omega, hi⟩ + rw [hQ1_B] at hsmall_QkB + exact not_isSmallSubgraph_of_mem_tangle h𝒯 hAB hsmall_QkB + have hge_prev : θ ≤ ((suffixUnion X (k - 1)).vertexSet ∩ (A ∩ B).vertexSet).ncard + 2 * p + 1 + := by + by_contra! hlt + have hle := hk_min (k - 1) (by omega) (by omega) hlt + omega + have hcond_k1 : 1 ≤ k - 1 ∧ k - 1 ≤ n := ⟨by omega, by omega⟩ + have hpiece_k1 : decompPiece X (k - 1) = X ⟨k - 1 - 1, by omega⟩ := by + simp [decompPiece, hcond_k1] + have hsmall_Xk1 : IsSmallSubgraph G 𝒯 (decompPiece X (k - 1)) := by + rw [hpiece_k1] + exact hX_small ⟨k - 1 - 1, by omega⟩ + have hbd_union_lt : (boundaryVertices G ((suffixUnion X k ∩ B) ∪ decompPiece X + (k - 1))).ncard < θ := by + let k_fin : Fin n := ⟨k - 1 - 1, by omega⟩ + let S_k1 : Set α := + ((X k_fin).vertexSet ∩ (decompPiece X (k - 1 - 1)).vertexSet) ∪ + ((X k_fin).vertexSet ∩ (decompPiece X (k - 1 - 1 + 2)).vertexSet) ∪ + {t k_fin} + have hclaim5_sub : boundaryVertices G (decompPiece X (k - 1)) ⊆ S_k1 := by + rw [hpiece_k1] + exact (lemma_2_1_claim_5 hC_le hbd_C hX_le hX_E hX_disj hX_betw hX_t k_fin).1 + have hk_add : k - 1 - 1 + 2 = k := by omega + have hsub_total : boundaryVertices G ((suffixUnion X k ∩ B) ∪ decompPiece X (k - 1)) ⊆ + ((suffixUnion X k).vertexSet ∩ (A ∩ B).vertexSet) ∪ S_k1 := by + intro v hv + rcases boundaryVertices_union_subset G (suffixUnion X k ∩ B) (decompPiece X + (k - 1)) hv with hv1 | hv2 + · by_cases hkn_eq : k = n + 1 + · subst hkn_eq + rw [suffixUnion_n_add_one, bot_inter, boundaryVertices_bot] at hv1 + exact hv1.elim + · have hk_le_n : k ≤ n := by omega + have hbd_sub := boundaryVertices_suffixUnion_inter_subset hsep_AB hB_le_C hC_le hX_le hX_E + hX_betw k hk1 hk_le_n + rcases hbd_sub hv1 with hvR | ⟨hv_dk1, hv_dk⟩ + · exact Or.inl hvR + · rw [hpiece_k1] at hv_dk1 + rw [← hk_add] at hv_dk + exact Or.inr (Or.inl (Or.inr ⟨hv_dk1, hv_dk⟩)) + · exact Or.inr (hclaim5_sub hv2) + have h1 : ((X k_fin).vertexSet ∩ (decompPiece X (k - 1 - 1)).vertexSet).ncard ≤ p := by + by_cases hi : 1 ≤ k - 1 - 1 ∧ k - 1 - 1 ≤ n + · simp only [decompPiece, hi, and_self, ↓reduceDIte] + rw [Set.inter_comm] + exact (hX_disj ⟨k - 1 - 1 - 1, by omega⟩ k_fin (Fin.lt_def.mpr (by dsimp [k_fin]; omega))).2 + · have hbot : decompPiece X (k - 1 - 1) = ⊥ := dite_eq_right_iff.mpr fun h => (hi h).elim + rw [hbot] + simp + have h2 : ((X k_fin).vertexSet ∩ (decompPiece X (k - 1 - 1 + 2)).vertexSet).ncard ≤ p := by + by_cases hi : 1 ≤ k - 1 - 1 + 2 ∧ k - 1 - 1 + 2 ≤ n + · simp only [decompPiece, hi, and_self, ↓reduceDIte] + exact (hX_disj k_fin ⟨k - 1 - 1 + 2 - 1, by omega⟩ (Fin.lt_def.mpr + (by dsimp [k_fin]; omega))).2 + · have hbot : decompPiece X (k - 1 - 1 + 2) = ⊥ := dite_eq_right_iff.mpr fun h => (hi h).elim + rw [hbot] + simp + have hfin1 : ((X k_fin).vertexSet ∩ (decompPiece X (k - 1 - 1)).vertexSet).Finite := + (X k_fin).vertexSet_finite.inter_of_left _ + have hfin2 : ((X k_fin).vertexSet ∩ (decompPiece X (k - 1 - 1 + 2)).vertexSet).Finite := + (X k_fin).vertexSet_finite.inter_of_left _ + have hfin_Sk1 : S_k1.Finite := (hfin1.union hfin2).union (Set.finite_singleton (t k_fin)) + have hSk1_le : S_k1.ncard ≤ 2 * p + 1 := by + have hle_a : S_k1.ncard ≤ + (((X k_fin).vertexSet ∩ (decompPiece X (k - 1 - 1)).vertexSet) ∪ + ((X k_fin).vertexSet ∩ (decompPiece X (k - 1 - 1 + 2)).vertexSet)).ncard + + ({t k_fin} : Set α).ncard := Set.ncard_union_le _ _ + have hle_b := Set.ncard_union_le + ((X k_fin).vertexSet ∩ (decompPiece X (k - 1 - 1)).vertexSet) + ((X k_fin).vertexSet ∩ (decompPiece X (k - 1 - 1 + 2)).vertexSet) + rw [Set.ncard_singleton] at hle_a + omega + have hfin_R : ((suffixUnion X k).vertexSet ∩ (A ∩ B).vertexSet).Finite := + (suffixUnion X k).vertexSet_finite.inter_of_left _ + have hle1 := Set.ncard_le_ncard hsub_total (hfin_R.union hfin_Sk1) + have hle2 := Set.ncard_union_le + ((suffixUnion X k).vertexSet ∩ (A ∩ B).vertexSet) S_k1 + omega + have hsmall_union : IsSmallSubgraph G 𝒯 ((suffixUnion X k ∩ B) ∪ decompPiece X (k - 1)) := + lemma_2_1_claim_7 h𝒯 + (inter_le (suffixUnion_le (fun i => (hX_le i).trans hC_le) k) hsep_AB.right_le) + (decompPiece_le (fun i => (hX_le i).trans hC_le) (k - 1)) + (union_le (inter_le (suffixUnion_le (fun i => (hX_le i).trans hC_le) k) hsep_AB.right_le) + (decompPiece_le (fun i => (hX_le i).trans hC_le) (k - 1))) + le_rfl hsmall_QkB hsmall_Xk1 hbd_union_lt + exact ⟨hk_gt_1, hsmall_union, hge_prev⟩ + +private lemma exists_max_nat_le (n : ℕ) (P : ℕ → Prop) (h0 : P 0) : + ∃ j ≤ n, P j ∧ ∀ m ≤ n, P m → m ≤ j := by + classical + induction n with + | zero => exact ⟨0, le_rfl, h0, fun m hm _ => hm⟩ + | succ n ih => + by_cases hsucc : P (n + 1) + · exact ⟨n + 1, le_rfl, hsucc, fun m hm _ => hm⟩ + · rcases ih with ⟨j, hj_le, hjP, hj_max⟩ + refine ⟨j, by omega, hjP, fun m hm hmP => ?_⟩ + rcases Nat.le_or_eq_of_le_succ hm with hle | rfl + · exact hj_max m hle hmP + · exact (hsucc hmP).elim + +private lemma exists_min_nat_ge_one (n : ℕ) (P : ℕ → Prop) (hn : P (n + 1)) : + ∃ k, 1 ≤ k ∧ k ≤ n + 1 ∧ P k ∧ ∀ m, 1 ≤ m → m ≤ n + 1 → P m → k ≤ m := by + obtain ⟨d, hd_le, hdP, hd_max⟩ := exists_max_nat_le n (fun d => P (n + 1 - d)) (by simpa using hn) + refine ⟨n + 1 - d, by omega, by omega, hdP, fun m hm1 hmn hmP => ?_⟩ + have h := hd_max (n + 1 - m) (by omega) (by + have heq : n + 1 - (n + 1 - m) = m := by omega + rwa [heq]) + omega + +/-- Convert a subgraph `H ≤ G` of a finite graph `G` to a subhypergraph of +`Hypergraph.ofGraph G hV hE`. -/ +private def subgraphToHypergraph {G : Graph α β} (hV : V(G).Finite) (hE : E(G).Finite) + (H : Graph α β) (hH : H ≤ G) : Hypergraph α β := + Hypergraph.ofGraph H (hV.subset hH.vertexSet_mono) (hE.subset hH.edgeSet_mono) + +private lemma subgraphToHypergraph_le {G : Graph α β} (hV : V(G).Finite) (hE : E(G).Finite) + {H₁ H₂ : Graph α β} (h₁ : H₁ ≤ G) (h₂ : H₂ ≤ G) (hle : H₁ ≤ H₂) : + subgraphToHypergraph hV hE H₁ h₁ ≤ subgraphToHypergraph hV hE H₂ h₂ where + vertexSet_subset := hle.vertexSet_mono + edgeSet_subset := hle.edgeSet_mono + ends_eq e he := by + ext v + exact (hle.inc_congr he).symm + +private lemma subgraphToHypergraph_le_ofGraph {G : Graph α β} (hV : V(G).Finite) (hE : E(G).Finite) + {H : Graph α β} (hH : H ≤ G) : + subgraphToHypergraph hV hE H hH ≤ Hypergraph.ofGraph G hV hE := + subgraphToHypergraph_le hV hE hH le_rfl hH + +private theorem le_union_of_close_decomp {G B : Hypergraph α β} {n j k : ℕ} + {X : Fin n → Hypergraph α β} + (hB_le : B ≤ G) (hX_le : ∀ i, X i ≤ G) + (hX_V : ∀ v ∈ B.vertexSet, ∃ i : Fin n, v ∈ (X i).vertexSet) + (hX_E : ∀ e ∈ B.edgeSet, ∃ i : Fin n, e ∈ (X i).edgeSet) + (hj_lt_n : j < n) (hk_gt_1 : 1 < k) (hkn : k ≤ n + 1) (hkj : k ≤ j + 3) : + B ≤ ((prefixUnion X j ∩ B) ∪ decompPiece X (j + 1)) ∪ + ((suffixUnion X k ∩ B) ∪ decompPiece X (k - 1)) := by + have hk1 : 1 ≤ k := by omega + have hv : B.vertexSet ⊆ + (((prefixUnion X j ∩ B) ∪ decompPiece X (j + 1)) ∪ + ((suffixUnion X k ∩ B) ∪ decompPiece X (k - 1))).vertexSet := by + intro v hvB + obtain ⟨i, hvi⟩ := hX_V v hvB + by_cases hi1 : i.1 < j + · exact Or.inl (Or.inl ⟨(mem_prefixUnion_vertexSet X j v).mpr ⟨i, hi1, hvi⟩, hvB⟩) + · by_cases hi2 : i.1 = j + · left; right + have hcond : 1 ≤ j + 1 ∧ j + 1 ≤ n := ⟨by omega, hj_lt_n⟩ + simp only [decompPiece, hcond, and_self, ↓reduceDIte, Nat.add_sub_cancel] + have hi_eq : (⟨j, hj_lt_n⟩ : Fin n) = i := Fin.ext hi2.symm + rwa [hi_eq] + · by_cases hi3 : k - 1 ≤ i.1 + · exact Or.inr (Or.inl ⟨(mem_suffixUnion_vertexSet X hk1 hkn v).mpr ⟨i, hi3, hvi⟩, hvB⟩) + · right; right + have hcond : 1 ≤ k - 1 ∧ k - 1 ≤ n := ⟨by omega, by omega⟩ + simp only [decompPiece, hcond, and_self, ↓reduceDIte] + have hi_eq : (⟨k - 1 - 1, by omega⟩ : Fin n) = i := Fin.ext (by dsimp; omega) + rwa [hi_eq] + have he : B.edgeSet ⊆ + (((prefixUnion X j ∩ B) ∪ decompPiece X (j + 1)) ∪ + ((suffixUnion X k ∩ B) ∪ decompPiece X (k - 1))).edgeSet := by + intro e heB + obtain ⟨i, hei⟩ := hX_E e heB + by_cases hi1 : i.1 < j + · exact Or.inl (Or.inl ⟨(mem_prefixUnion_edgeSet X j e).mpr ⟨i, hi1, hei⟩, heB⟩) + · by_cases hi2 : i.1 = j + · left; right + have hcond : 1 ≤ j + 1 ∧ j + 1 ≤ n := ⟨by omega, hj_lt_n⟩ + simp only [decompPiece, hcond, and_self, ↓reduceDIte, Nat.add_sub_cancel] + have hi_eq : (⟨j, hj_lt_n⟩ : Fin n) = i := Fin.ext hi2.symm + rwa [hi_eq] + · by_cases hi3 : k - 1 ≤ i.1 + · exact Or.inr (Or.inl ⟨(mem_suffixUnion_edgeSet X hk1 hkn e).mpr ⟨i, hi3, hei⟩, heB⟩) + · right; right + have hcond : 1 ≤ k - 1 ∧ k - 1 ≤ n := ⟨by omega, by omega⟩ + simp only [decompPiece, hcond, and_self, ↓reduceDIte] + have hi_eq : (⟨k - 1 - 1, by omega⟩ : Fin n) = i := Fin.ext (by dsimp; omega) + rwa [hi_eq] + refine ⟨hv, he, fun e heB => ?_⟩ + have hle_u : ((prefixUnion X j ∩ B) ∪ decompPiece X (j + 1)) ∪ + ((suffixUnion X k ∩ B) ∪ decompPiece X (k - 1)) ≤ G := + union_le + (union_le (inter_le (prefixUnion_le hX_le j) hB_le) + (decompPiece_le hX_le (j + 1))) + (union_le (inter_le (suffixUnion_le hX_le k) hB_le) + (decompPiece_le hX_le (k - 1))) + exact (hle_u.ends_eq e (he heB)).symm.trans (hB_le.ends_eq e heB) + +/-- **Graph Minors XV, (2.1)** (page 116): +"Let $\mathscr{T}$ be a tangle in a graph $G$, let $\rho \ge 1$ with $ord(\mathscr{T}) \ge 5\rho+2$, +and +let $\mathscr{S}$ be a segregation of $G$ of type $(\rho, \kappa)$ for some $\kappa$. Suppose that +for +every $(C, \Omega) \in \mathscr{S}$ there is no $(A, B) \in \mathscr{T}$ of order $\le 2\rho+1$ with +$B \subseteq C$. Then $\mathscr{S}$ is $\mathscr{T}$-central." -/ +theorem theorem_2_1_proof + (G : Graph α β) (θ p κ : ℕ) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (𝒮 : Set (Society α β)) + (h𝒯 : IsGraphTangle G θ 𝒯) + (hp : 1 ≤ p) + (hθ : 5 * p + 2 ≤ θ) + (h𝒮 : IsSegregationOfType G p κ 𝒮) + (hno_small : ∀ S₀ ∈ 𝒮, ∀ A B : Hypergraph α β, (A, B) ∈ 𝒯 → + separationOrder A B ≤ 2 * p + 1 → ¬ SubhypergraphInGraph B S₀.G) : + IsCentralSegregation G 𝒯 𝒮 := by + refine ⟨h𝒮.isSegregation, fun S₀ hS₀ A B hAB hB_sub => ?_⟩ + let G_H := Hypergraph.ofGraph G h𝒯.finite_V h𝒯.finite_E + have hS₀_le : S₀.G ≤ G := h𝒮.isSegregation.le S₀ hS₀ + let C := subgraphToHypergraph h𝒯.finite_V h𝒯.finite_E S₀.G hS₀_le + have hC_le : C ≤ G_H := subgraphToHypergraph_le_ofGraph h𝒯.finite_V h𝒯.finite_E hS₀_le + have hsep_AB : G_H.IsSeparation A B := h𝒯.isTangle.isSeparation hAB + have hB_le_C : B ≤ C := by + refine ⟨hB_sub.1, hB_sub.2, fun e he => ?_⟩ + have h1 := hsep_AB.right_le.ends_eq e he + have h2 := hC_le.ends_eq e (hB_sub.2 he) + exact h2.symm.trans h1 + have hno_small_C : ∀ A' B' : Hypergraph α β, (A', B') ∈ 𝒯 → + separationOrder A' B' ≤ 2 * p + 1 → ¬ (B' ≤ C) := by + intro A' B' hA'B' hord hle + exact hno_small S₀ hS₀ A' B' hA'B' hord ⟨hle.vertexSet_subset, hle.edgeSet_subset⟩ + have hPV : S₀.IsPVortex p := by + by_cases hgt3 : 3 < S₀.Ω.bar.ncard + · exact h𝒮.is_p_vortex hS₀ hgt3 + · exact isPVortex_of_bar_ncard_le_three (not_lt.mp hgt3) hp + have hbd_C_bar : boundaryVertices G_H C ⊆ S₀.Ω.bar := by + rintro v ⟨hvC, e, ⟨heG, heC⟩, hinc⟩ + have he_union : e ∈ E(subgraphSUnion G ((fun S' : Society α β => S'.G) '' 𝒮)) := by + rw [h𝒮.isSegregation.union_eq] + exact heG + simp only [subgraphSUnion, edgeSet_restrict, mem_inter_iff, mem_iUnion, exists_prop] at he_union + rcases he_union.2 with ⟨_, ⟨S', hS', rfl⟩, heS'⟩ + have hne : S₀ ≠ S' := by + rintro rfl + exact heC heS' + have hvS' : v ∈ V(S'.G) := by + rcases hinc with ⟨w, hlink⟩ + have hlink' : S'.G.IsLink e v w := + ((h𝒮.isSegregation.le S' hS').isLink_iff heS').mpr hlink + exact hlink'.left_mem + exact (h𝒮.isSegregation.vertex_inter_subset S₀ hS₀ S' hS' hne ⟨hvC, hvS'⟩).1 + by_cases hbar : S₀.Ω.bar.Nonempty + swap + · have hbar_eq : S₀.Ω.bar = ∅ := Set.not_nonempty_iff_eq_empty.mp hbar + have hbd_empty : boundaryVertices G_H C = ∅ := Set.eq_empty_of_subset hbd_C_bar hbar_eq + have hC_small : IsSmallSubgraph G_H 𝒯 C := + lemma_2_1_claim_6 h𝒯.isTangle (by omega) hno_small_C le_rfl hC_le + (by rw [hbd_empty]; simp) + have hACC : A ∪ C ∪ C = G_H := by + rw [GM10.union_assoc, GM10.union_self] + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq (union_le hsep_AB.left_le hC_le) le_rfl + · ext v + refine ⟨fun h => (union_le hsep_AB.left_le hC_le).vertexSet_subset h, fun hv => ?_⟩ + rw [← hsep_AB.vertexSet_union] at hv + exact hv.imp_right fun h => hB_le_C.vertexSet_subset h + · ext e + refine ⟨fun h => (union_le hsep_AB.left_le hC_le).edgeSet_subset h, fun he => ?_⟩ + rw [← hsep_AB.edgeSet_union] at he + exact he.imp_right fun h => hB_le_C.edgeSet_subset h + exact h𝒯.isTangle.axiom2 hAB hC_small hC_small hACC + obtain ⟨n, t, X_gr, hlin, hdepth⟩ := GraphMinor.GM09.gm15_theorem_8_1.{u, v} S₀ p hbar hPV + let X : Fin n → Hypergraph α β := fun i => + subgraphToHypergraph h𝒯.finite_V h𝒯.finite_E (X_gr i) ((hlin.le_G i).trans hS₀_le) + have hX_le : ∀ i : Fin n, X i ≤ C := fun i => + subgraphToHypergraph_le h𝒯.finite_V h𝒯.finite_E + ((hlin.le_G i).trans hS₀_le) hS₀_le (hlin.le_G i) + have hX_V : ∀ v ∈ C.vertexSet, ∃ i : Fin n, v ∈ (X i).vertexSet := by + intro v hv + have hv_union : v ∈ V(subgraphSUnion S₀.G (range X_gr)) := by + rw [hlin.union_eq] + exact hv + change v ∈ ⋃ P ∈ range X_gr, V(P) at hv_union + simp only [mem_iUnion, mem_range, exists_prop] at hv_union + rcases hv_union with ⟨_, ⟨i, rfl⟩, hvi⟩ + exact ⟨i, hvi⟩ + have hX_E : ∀ e ∈ C.edgeSet, ∃ i : Fin n, e ∈ (X i).edgeSet := by + intro e he + have he_union : e ∈ E(subgraphSUnion S₀.G (range X_gr)) := by + rw [hlin.union_eq] + exact he + simp only [subgraphSUnion, edgeSet_restrict, mem_inter_iff, mem_iUnion, exists_prop] at he_union + rcases he_union.2 with ⟨_, ⟨i, rfl⟩, hei⟩ + exact ⟨i, hei⟩ + have hX_disj : ∀ i j : Fin n, i < j → + Disjoint (X i).edgeSet (X j).edgeSet ∧ ((X i).vertexSet ∩ (X j).vertexSet).ncard ≤ p := + fun i j hij => ⟨hlin.edge_disjoint i j hij, hdepth i j hij⟩ + have hX_betw : ∀ i j k : Fin n, i ≤ j → j ≤ k → + (X i).vertexSet ∩ (X k).vertexSet ⊆ (X j).vertexSet := by + intro i j k hij hjk v ⟨hvi, hvk⟩ + have hle := hlin.inter_le i j k hij hjk + have hv_inter : v ∈ V(subgraphInter S₀.G (X_gr i) (X_gr k)) := ⟨hvi, hvk⟩ + exact hle.vertexSet_mono hv_inter + have hX_t : ∀ i : Fin n, t i ∈ (X i).vertexSet := hlin.mem_vertexSet + have hbd_C : boundaryVertices G_H C ⊆ range t := by + rw [hlin.range_t] + exact hbd_C_bar + have hX_small : ∀ i : Fin n, IsSmallSubgraph G_H 𝒯 (X i) := by + intro i + have hbd_i := (lemma_2_1_claim_5 hC_le hbd_C hX_le hX_E hX_disj hX_betw hX_t i).2 + exact lemma_2_1_claim_6 h𝒯.isTangle (by omega) hno_small_C (hX_le i) + ((hX_le i).trans hC_le) hbd_i + classical + obtain ⟨j, hj_le, hj_lt, hj_max⟩ := exists_max_nat_le n + (fun m => ((prefixUnion X m).vertexSet ∩ (A ∩ B).vertexSet).ncard + 2 * p + 1 < θ) + (by simp [prefixUnion]; omega) + obtain ⟨hj_lt_n, hsmall_left, hge_left⟩ := + lemma_2_1_claim_9 h𝒯.isTangle hp hθ hAB hB_le_C hC_le hbd_C hX_le hX_V hX_E hX_disj + hX_betw hX_t hX_small j hj_le hj_lt hj_max + obtain ⟨k, hk1, hkn, hk_lt, hk_min⟩ := exists_min_nat_ge_one n + (fun m => ((suffixUnion X m).vertexSet ∩ (A ∩ B).vertexSet).ncard + 2 * p + 1 < θ) + (by rw [suffixUnion_n_add_one]; simp; omega) + obtain ⟨hk_gt_1, hsmall_right, hge_right⟩ := + lemma_2_1_claim_10 h𝒯.isTangle hp hθ hAB hB_le_C hC_le hbd_C hX_le hX_V hX_E hX_disj + hX_betw hX_t hX_small k hk1 hkn hk_lt hk_min + by_cases hkj : k ≤ j + 3 + · have hB_sub_union := le_union_of_close_decomp hsep_AB.right_le + (fun i => (hX_le i).trans hC_le) + (fun v hv => hX_V v (hB_le_C.vertexSet_subset hv)) + (fun e he => hX_E e (hB_le_C.edgeSet_subset he)) + hj_lt_n hk_gt_1 hkn hkj + have hbd_B_lt : (boundaryVertices G_H B).ncard < θ := by + have hsub_R : boundaryVertices G_H B ⊆ (A ∩ B).vertexSet := by + rintro v ⟨hvB, e, ⟨heG, heB⟩, hinc⟩ + have heA : e ∈ A.edgeSet := by + have he_u : e ∈ A.edgeSet ∪ B.edgeSet := by + rw [hsep_AB.edgeSet_union] + exact heG + exact he_u.resolve_right heB + exact ⟨A.vertex_mem_of_inc ((inc_iff_of_le hsep_AB.left_le heA).mpr hinc), hvB⟩ + have hle := Set.ncard_le_ncard hsub_R (A ∩ B).vertexSet_finite + have hord := h𝒯.isTangle.order_lt hAB + unfold separationOrder at hord + omega + have hB_small : IsSmallSubgraph G_H 𝒯 B := + lemma_2_1_claim_7 h𝒯.isTangle + (union_le (inter_le (prefixUnion_le (fun i => (hX_le i).trans hC_le) j) hsep_AB.right_le) + (decompPiece_le (fun i => (hX_le i).trans hC_le) (j + 1))) + (union_le (inter_le (suffixUnion_le (fun i => (hX_le i).trans hC_le) k) hsep_AB.right_le) + (decompPiece_le (fun i => (hX_le i).trans hC_le) (k - 1))) + hsep_AB.right_le hB_sub_union hsmall_left hsmall_right hbd_B_lt + exact not_isSmallSubgraph_of_mem_tangle h𝒯.isTangle hAB hB_small + · have hkj4 : j + 4 ≤ k := by omega + have hj1_lt_n : j + 1 < n := by omega + have hinter_sub : ((prefixUnion X (j + 1)).vertexSet ∩ (A ∩ B).vertexSet) ∩ + ((suffixUnion X (k - 1)).vertexSet ∩ (A ∩ B).vertexSet) ⊆ + (X ⟨j, hj_lt_n⟩).vertexSet ∩ (X ⟨j + 1, hj1_lt_n⟩).vertexSet := by + rintro v ⟨⟨hvP, _⟩, ⟨hvQ, _⟩⟩ + obtain ⟨a, ha_lt, hva⟩ := (mem_prefixUnion_vertexSet X (j + 1) v).mp hvP + obtain ⟨b, hb_ge, hvb⟩ := (mem_suffixUnion_vertexSet X (by omega) (by omega) v).mp hvQ + refine ⟨?_, ?_⟩ + · exact hX_betw a ⟨j, hj_lt_n⟩ b + (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) + (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) ⟨hva, hvb⟩ + · exact hX_betw a ⟨j + 1, hj1_lt_n⟩ b + (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) + (Fin.le_iff_val_le_val.mpr (by dsimp; omega)) ⟨hva, hvb⟩ + have hinter_le_p : (((prefixUnion X (j + 1)).vertexSet ∩ (A ∩ B).vertexSet) ∩ + ((suffixUnion X (k - 1)).vertexSet ∩ (A ∩ B).vertexSet)).ncard ≤ p := by + have hfin_cap : ((X ⟨j, hj_lt_n⟩).vertexSet ∩ (X ⟨j + 1, hj1_lt_n⟩).vertexSet).Finite := + (X ⟨j, hj_lt_n⟩).vertexSet_finite.inter_of_left _ + have hle1 := Set.ncard_le_ncard hinter_sub hfin_cap + have hle2 := (hX_disj ⟨j, hj_lt_n⟩ ⟨j + 1, hj1_lt_n⟩ (Fin.lt_def.mpr (by dsimp; omega))).2 + omega + have hunion_sub : ((prefixUnion X (j + 1)).vertexSet ∩ (A ∩ B).vertexSet) ∪ + ((suffixUnion X (k - 1)).vertexSet ∩ (A ∩ B).vertexSet) ⊆ (A ∩ B).vertexSet := by + rintro v (⟨_, hvR⟩ | ⟨_, hvR⟩) <;> exact hvR + have hunion_lt_theta : (((prefixUnion X (j + 1)).vertexSet ∩ (A ∩ B).vertexSet) ∪ + ((suffixUnion X (k - 1)).vertexSet ∩ (A ∩ B).vertexSet)).ncard < θ := by + have hle := Set.ncard_le_ncard hunion_sub (A ∩ B).vertexSet_finite + have hord := h𝒯.isTangle.order_lt hAB + unfold separationOrder at hord + omega + have hfin_L : ((prefixUnion X (j + 1)).vertexSet ∩ (A ∩ B).vertexSet).Finite := + (prefixUnion X (j + 1)).vertexSet_finite.inter_of_left _ + have hfin_R : ((suffixUnion X (k - 1)).vertexSet ∩ (A ∩ B).vertexSet).Finite := + (suffixUnion X (k - 1)).vertexSet_finite.inter_of_left _ + have hadd := Set.ncard_union_add_ncard_inter + ((prefixUnion X (j + 1)).vertexSet ∩ (A ∩ B).vertexSet) + ((suffixUnion X (k - 1)).vertexSet ∩ (A ∩ B).vertexSet) hfin_L hfin_R + omega + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/Section3.lean b/LeanPool/GraphMinor/GM15/Section3.lean new file mode 100644 index 0000000000..30ddbda587 --- /dev/null +++ b/LeanPool/GraphMinor/GM15/Section3.lean @@ -0,0 +1,2807 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM15.Cited +import LeanPool.GraphMinor.GM10.Section6 +import LeanPool.GraphMinor.GM10.Section12 +import LeanPool.GraphMinor.GM11.DrawingOps +import LeanPool.GraphMinor.GM11.OArcCircuit +import LeanPool.GraphMinor.GM11.RadialAccess +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.GM14.Section6c +import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.Surface.CutLift +import LeanPool.GraphMinor.Surface.DiscUnion + +/-! +# Graph Minors XV, Section 3: Rigidity + +This file formalizes Section 3 ("Rigidity", pages 119–124) of N. Robertson and P. D. Seymour, +*Graph Minors. XV. Giant steps*, J. Combin. Theory Ser. B 68 (1996) 112–148: +- **Graph Minors XV, (3.1)** (`GM15Theorem31Statement`, page 119): characterization of dials in a + rigid drawing with a tangle of order `≥ 3`. +- **Graph Minors XV, (3.2)** (`GM15Theorem32Statement`, page 119): gluing lemma for rigidity of a + drawing in `Σ = Σ₁ ∪ Σ₂`. +- **Graph Minors XV, (3.3)** (`GM15Theorem33Statement`, page 120) and Claim (2) of its proof + (`theorem_3_3_claim_2`, page 121): adding a crosscap in a region `Λ` of `H` using `φ` disjoint + `η(H)`-paths whose ends are in order on `H ∩ bd(Λ)` and free with respect to `T`. +- **Graph Minors XV, (3.4)** (`GM15Theorem34Statement`, page 122): a drawing $H'$ that adds + `k - 1` parallel paths across a region `Λ` of `H` has regions `r₁, r₂` with + `d'(r₁, r₂) ≥ 2k - 6` and `d'({v_k}, {v_{2k}}) ≥ 2k - 8`. The formal statement also records + distance monotonicity and boundary order. `GM15Theorem34DrawnStatement` first draws paths of `G`. +- **Graph Minors XV, (3.5)** (`GM15Theorem35Statement`, page 123): adding a handle between two + distinct regions `Λ₁, Λ₂` of `H` using `φ` disjoint `η(H)`-paths. +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +open Set Function Topology +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM14 + +universe u v w + +/-- Statement of Graph Minors XV, (3.1) (page 119): +"Let $H$ be a rigid drawing in a surface $\Sigma$, and let $\mathscr{T}$ be a tangle in $H$ of +order $\ge 3$. Let $\Delta \subseteq \Sigma$ be a closed disc with $bd(\Delta) \cap U(H) \subseteq +V(H)$ and $|bd(\Delta) \cap V(H)| \le 2$. Then $(H \cap \Delta, H \cap \overline{\Sigma - \Delta}) +\in \mathscr{T}$ if and only if $\Delta$ is a dial for $bd(\Delta)$." -/ +def GM15Theorem31Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + (H : Drawing S) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (Δ : Set S), + IsClosedSurface S → ConnectedSpace S → IsRigid H → IsTangle H.toHypergraph θ T → 3 ≤ θ → + IsClosedDisc Δ → subBd Δ ∩ H.U ⊆ H.V → (subBd Δ ∩ H.V).ncard ≤ 2 → + (((H.interSet Δ).toHypergraph, (H.interSet (closure (univ \ Δ))).toHypergraph) ∈ T ↔ + IsDial H (subBd Δ) Δ) + +/-- For a closed subset `K`, the vertex set of `H.interSet K` is `H.V ∩ K`. -/ +theorem interSet_V_of_isClosed {S : Type w} [TopologicalSpace S] [T1Space S] + (H : Drawing S) {K : Set S} (hK : IsClosed K) : + (H.interSet K).V = H.V ∩ K := + H.interSet_V_of_isClosed hK + +/-- The edge set of `H.interSet K` is `{e ∈ H.E | e ⊆ K}`. -/ +theorem interSet_E {S : Type w} [TopologicalSpace S] [T1Space S] + (H : Drawing S) (K : Set S) : + (H.interSet K).E = {e ∈ H.E | e ⊆ K} := + H.interSet_E K + +/-- In any drawing `Γ`, the ends of an edge `e ∈ Γ.E` in `Γ.toHypergraph` are `closure e ∩ Γ.V`. -/ +theorem toHypergraph_ends_eq {S : Type w} [TopologicalSpace S] (Γ : Drawing S) + {e : Set S} (he : e ∈ Γ.E) : + Γ.toHypergraph.ends e = closure e ∩ Γ.V := by + ext v + simp only [Hypergraph.ends, mem_ofPred_eq, Drawing.toHypergraph, mem_inter_iff] + exact ⟨fun ⟨_, hv, hve⟩ => ⟨hve, hv⟩, fun ⟨hve, hv⟩ => ⟨he, hv, hve⟩⟩ + +/-- Any subdrawing `Γ₁` of `Γ₂` induces a subhypergraph `Γ₁.toHypergraph ≤ Γ₂.toHypergraph`. -/ +theorem toHypergraph_le_of_isSubdrawing {S : Type w} [TopologicalSpace S] + {Γ₁ Γ₂ : Drawing S} (h : Γ₁.IsSubdrawing Γ₂) : + Γ₁.toHypergraph ≤ Γ₂.toHypergraph := by + refine ⟨h.1, h.2, fun e he => ?_⟩ + have he₁ : e ∈ Γ₁.E := he + rw [toHypergraph_ends_eq Γ₂ (h.2 he₁), toHypergraph_ends_eq Γ₁ he₁, h.closure_inter_V he₁] + +/-- For a closed subset `K`, `(H.interSet K).toHypergraph` is a subhypergraph of +`H.toHypergraph`. -/ +theorem interSet_toHypergraph_le_of_isClosed {S : Type w} [TopologicalSpace S] [T1Space S] + (H : Drawing S) {K : Set S} (_hK : IsClosed K) : + (H.interSet K).toHypergraph ≤ H.toHypergraph := + toHypergraph_le_of_isSubdrawing (Drawing.span_isSubdrawing H _ _) + +/-- Monotonicity of `(H.interSet K).toHypergraph` with respect to closed sets `K₁ ⊆ K₂`. -/ +theorem interSet_toHypergraph_mono_of_isClosed {S : Type w} [TopologicalSpace S] [T1Space S] + (H : Drawing S) {K₁ K₂ : Set S} (hK₁ : IsClosed K₁) (hK₂ : IsClosed K₂) (hsub : K₁ ⊆ K₂) : + (H.interSet K₁).toHypergraph ≤ (H.interSet K₂).toHypergraph := by + have hsubD : (H.interSet K₁).IsSubdrawing (H.interSet K₂) := by + refine ⟨?_, ?_⟩ + · rw [interSet_V_of_isClosed H hK₁, interSet_V_of_isClosed H hK₂] + exact inter_subset_inter_right _ hsub + · rw [interSet_E, interSet_E] + exact fun _ h => ⟨h.1, h.2.trans hsub⟩ + exact toHypergraph_le_of_isSubdrawing hsubD + +private lemma isAcyclic_of_leaf {α : Type*} {K₁ K₂ : SimpleGraph α} {a w : α} + (hleaf : ∀ x, K₂.Adj a x → x = w) + (hsub : ∀ x y, x ≠ a → y ≠ a → K₂.Adj x y → K₁.Adj x y) + (hAcyc : K₁.IsAcyclic) : + K₂.IsAcyclic := by + classical + intro u c hc + have ha_not : a ∉ c.support := by + intro ha + let p := c.rotate a ha + have hp : p.IsCycle := hc.rotate ha + have h1 : p.snd = w := hleaf _ (p.adj_snd hp.not_nil) + have h2 : p.penultimate = w := hleaf _ (p.adj_penultimate hp.not_nil).symm + exact hp.snd_ne_penultimate (h1.trans h2.symm) + have hed : ∀ e ∈ c.edges, e ∈ K₁.edgeSet := by + intro e he + induction e using Sym2.ind with + | _ x y => + have hx : x ≠ a := fun h => ha_not (h ▸ c.fst_mem_support_of_mem_edges he) + have hy : y ≠ a := fun h => ha_not (h ▸ c.snd_mem_support_of_mem_edges he) + exact hsub x y hx hy (c.adj_of_mem_edges he) + exact hAcyc (c.transfer K₁ hed) (hc.transfer hed) + +private lemma not_hasCircuit_of_edgeSet_empty {α β : Type*} {G : Hypergraph α β} + (hE : G.edgeSet = ∅) : + ¬ GM10.HasCircuit G := by + rintro (⟨e, he, _⟩ | ⟨e₁, he₁, _⟩ | hacyc) + · exact absurd he (hE ▸ notMem_empty e) + · exact absurd he₁ (hE ▸ notMem_empty e₁) + · apply hacyc + have hbot : G.skeleton = ⊥ := by + ext x y + simp only [SimpleGraph.bot_adj, iff_false] + rintro ⟨_, e, hx, _⟩ + exact notMem_empty e (hE ▸ G.edge_mem_of_inc hx) + rw [hbot] + exact SimpleGraph.isAcyclic_bot + +private lemma not_hasCircuit_walkDrawing {S : Type w} [TopologicalSpace S] [T1Space S] + (P : Drawing S) {u v : S} {W : GraphWalk P.toGraph u v} (hW : W.IsSimple) : + ¬ GM10.HasCircuit (walkDrawing P W).toHypergraph := by + induction W with + | nil hu => + apply not_hasCircuit_of_edgeSet_empty + change (walkDrawing P (GraphWalk.nil hu)).E = ∅ + rw [walkDrawing_E] + simp + | @cons a w _ e h r ih => + have hnd := List.nodup_cons.mp hW + have ha_not : a ∉ r.support := hnd.1 + have ih' : ¬ GM10.HasCircuit (walkDrawing P r).toHypergraph := ih hnd.2 + have haw : a ≠ w := fun heq => ha_not (heq ▸ r.start_mem_support) + set H₁ := (walkDrawing P r).toHypergraph + set H₂ := (walkDrawing P (GraphWalk.cons h r)).toHypergraph + have hle₁ : H₁ ≤ P.toHypergraph := toHypergraph_le_of_isSubdrawing + (walkDrawing_isSubdrawing P r) + have hle₂ : H₂ ≤ P.toHypergraph := + toHypergraph_le_of_isSubdrawing (walkDrawing_isSubdrawing P (GraphWalk.cons h r)) + have hE₁ : H₁.edgeSet = {f | f ∈ r.edges} := walkDrawing_E P r + have hE₂ : H₂.edgeSet = {f | f ∈ e :: r.edges} := walkDrawing_E P (GraphWalk.cons h r) + have hends_r : ∀ f ∈ r.edges, H₁.ends f = closure f ∩ P.V ∧ H₂.ends f = closure f ∩ P.V ∧ + closure f ∩ P.V ⊆ {x | x ∈ r.support} ∧ a ∉ closure f ∩ P.V := by + intro f hf + have hf₁ : f ∈ H₁.edgeSet := by rw [hE₁]; exact hf + have hf₂ : f ∈ H₂.edgeSet := by rw [hE₂]; exact List.mem_cons_of_mem e hf + have hfP : f ∈ P.E := hle₁.edgeSet_subset hf₁ + obtain ⟨x, y, hxy⟩ := (P.toGraph.edge_mem_iff_exists_isLink f).mp hfP + have hsub : closure f ∩ P.V ⊆ {z | z ∈ r.support} := by + rw [hxy.2.2.2] + rintro z (rfl | hz) + · exact r.left_mem_support_of_mem_edges hf hxy + · rw [mem_singleton_iff.mp hz] + exact r.left_mem_support_of_mem_edges hf hxy.symm + refine ⟨(hle₁.ends_eq f hf₁).symm.trans (toHypergraph_ends_eq P hfP), + (hle₂.ends_eq f hf₂).symm.trans (toHypergraph_ends_eq P hfP), + hsub, fun ha => ha_not (hsub ha)⟩ + have he₂ : e ∈ H₂.edgeSet := by rw [hE₂]; exact List.mem_cons_self + have hends_e : H₂.ends e = {a, w} := by + rw [← hle₂.ends_eq e he₂, toHypergraph_ends_eq P h.1, h.2.2.2] + rintro (⟨f, hf, hcard⟩ | ⟨f₁, hf₁, f₂, hf₂, hne, hcard⟩ | hacyc) + · rw [hE₂, mem_ofPred_eq, List.mem_cons] at hf + rcases hf with rfl | hf + · rw [hends_e, Set.ncard_pair haw] at hcard + omega + · obtain ⟨he₁, he₂', _, _⟩ := hends_r f hf + exact ih' (Or.inl ⟨f, by rw [hE₁]; exact hf, by rwa [he₁, ← he₂']⟩) + · have hf₁' : f₁ = e ∨ f₁ ∈ r.edges := by rwa [hE₂, mem_ofPred_eq, List.mem_cons] at hf₁ + have hf₂' : f₂ = e ∨ f₂ ∈ r.edges := by rwa [hE₂, mem_ofPred_eq, List.mem_cons] at hf₂ + rcases hf₁' with rfl | hf₁' <;> rcases hf₂' with rfl | hf₂' + · exact hne rfl + · obtain ⟨_, he₂', _, ha_not_f⟩ := hends_r f₂ hf₂' + have hsub : H₂.ends f₁ ∩ H₂.ends f₂ ⊆ {w} := by + rw [hends_e, he₂'] + rintro z ⟨rfl | hzw, hzf⟩ + · exact (ha_not_f hzf).elim + · exact hzw + have hle := Set.ncard_le_ncard hsub (Set.finite_singleton w) + rw [Set.ncard_singleton] at hle + omega + · obtain ⟨_, he₁', _, ha_not_f⟩ := hends_r f₁ hf₁' + have hsub : H₂.ends f₁ ∩ H₂.ends f₂ ⊆ {w} := by + rw [hends_e, he₁'] + rintro z ⟨hzf, rfl | hzw⟩ + · exact (ha_not_f hzf).elim + · exact hzw + have hle := Set.ncard_le_ncard hsub (Set.finite_singleton w) + rw [Set.ncard_singleton] at hle + omega + · obtain ⟨he₁₁, he₁₂, _, _⟩ := hends_r f₁ hf₁' + obtain ⟨he₂₁, he₂₂, _, _⟩ := hends_r f₂ hf₂' + refine ih' (Or.inr (Or.inl ⟨f₁, by rw [hE₁]; exact hf₁', f₂, by rw [hE₁]; exact hf₂', + hne, ?_⟩)) + rwa [he₁₁, he₂₁, ← he₁₂, ← he₂₂] + · apply hacyc + have hAcyc₁ : H₁.skeleton.IsAcyclic := by + by_contra hnot + exact ih' (Or.inr (Or.inr hnot)) + refine isAcyclic_of_leaf (K₁ := H₁.skeleton) (a := a) (w := w) ?_ ?_ hAcyc₁ + · intro x ⟨hax, f, hfa, hfx⟩ + have hf : f ∈ H₂.edgeSet := H₂.edge_mem_of_inc hfa + rw [hE₂, mem_ofPred_eq, List.mem_cons] at hf + rcases hf with rfl | hf + · have hx : x ∈ H₂.ends f := hfx + rw [hends_e] at hx + rcases hx with rfl | hxw + · exact (hax rfl).elim + · exact mem_singleton_iff.mp hxw + · obtain ⟨_, he₂', _, ha_not_f⟩ := hends_r f hf + have ha' : a ∈ H₂.ends f := hfa + rw [he₂'] at ha' + exact (ha_not_f ha').elim + · intro x y hx hy ⟨hxy, f, hfx, hfy⟩ + have hf : f ∈ H₂.edgeSet := H₂.edge_mem_of_inc hfx + rw [hE₂, mem_ofPred_eq, List.mem_cons] at hf + rcases hf with rfl | hf + · have hx' : x ∈ H₂.ends f := hfx + have hy' : y ∈ H₂.ends f := hfy + rw [hends_e] at hx' hy' + have hxw : x = w := mem_singleton_iff.mp (hx'.resolve_left hx) + have hyw : y = w := mem_singleton_iff.mp (hy'.resolve_left hy) + exact (hxy (hxw.trans hyw.symm)).elim + · obtain ⟨he₁', he₂', _, _⟩ := hends_r f hf + have hx' : x ∈ H₁.ends f := by + have : x ∈ H₂.ends f := hfx + rwa [he₁', ← he₂'] + have hy' : y ∈ H₁.ends f := by + have : y ∈ H₂.ends f := hfy + rwa [he₁', ← he₂'] + exact ⟨hxy, f, hx', hy'⟩ + +/-- A path drawing `P` (`P.IsPathBetween u v`) has no circuit in `P.toHypergraph`. -/ +theorem not_hasCircuit_of_isPathBetween {S : Type w} [TopologicalSpace S] [T1Space S] + {P : Drawing S} {u v : S} (hP : P.IsPathBetween u v) : + ¬ GM10.HasCircuit P.toHypergraph := by + obtain ⟨W, hW, hV, hE⟩ := hP + have hEq : P = walkDrawing P W := + Drawing.ext_of_V_E (hV.trans (walkDrawing_V P W).symm) (hE.trans (walkDrawing_E P W).symm) + rw [hEq] + exact not_hasCircuit_walkDrawing P hW + +/-- For any dial `Δ` for `F, H` with `F ∩ H.U ⊆ H.V`, `H ∩ Δ` has no circuit. -/ +theorem not_hasCircuit_of_isDial {S : Type w} [TopologicalSpace S] [T1Space S] + {H : Drawing S} {F Δ : Set S} (hU : F ∩ H.U ⊆ H.V) (hDial : IsDial H F Δ) : + ¬ GM10.HasCircuit (H.interSet Δ).toHypergraph := by + rcases hDial.2.2 with hsub | ⟨u, v, _, _, hPath⟩ + · apply not_hasCircuit_of_edgeSet_empty + change (H.interSet Δ).E = ∅ + rw [interSet_E] + ext e + simp only [mem_ofPred_eq, mem_empty_iff_false, iff_false, not_and] + intro he heΔ + obtain ⟨_, hdV, heU, ⟨x, hxe⟩⟩ := GM14.PaintingOrDrawing.edge_props (Γ := .drawing H) he + exact Set.disjoint_left.mp hdV hxe (hU ⟨hsub ⟨heΔ hxe, heU hxe⟩, heU hxe⟩) + · exact not_hasCircuit_of_isPathBetween hPath + +/-- For a closed subset `K` with `subBd K ∩ H.U ⊆ H.V`, `H ∩ K` and `H ∩ closure(Σ - K)` form a +separation of `H` of order `|subBd K ∩ H.V|`. -/ +theorem isSeparation_interSet_of_isClosed {S : Type w} [TopologicalSpace S] [T1Space S] + (H : Drawing S) {K : Set S} (hK : IsClosed K) (hU : subBd K ∩ H.U ⊆ H.V) : + H.toHypergraph.IsSeparation (H.interSet K).toHypergraph + (H.interSet (closure (univ \ K))).toHypergraph ∧ + separationOrder (H.interSet K).toHypergraph + (H.interSet (closure (univ \ K))).toHypergraph = (subBd K ∩ H.V).ncard := by + have hK' : IsClosed (closure (univ \ K)) := isClosed_closure + have hle₁ := interSet_toHypergraph_le_of_isClosed H hK + have hle₂ := interSet_toHypergraph_le_of_isClosed H hK' + have hedge : ∀ e ∈ H.E, (e ⊆ K ∨ e ⊆ closure (univ \ K)) ∧ ¬ (e ⊆ K ∧ e ⊆ closure (univ \ K)) + := by + intro e he + obtain ⟨hp, hdV, heU, hne⟩ := GM14.PaintingOrDrawing.edge_props (Γ := .drawing H) he + have hdfr : Disjoint e (frontier K) := by + rw [← subBd_eq_frontier, Set.disjoint_left] + intro x hxe hxbd + exact Set.disjoint_left.mp hdV hxe (hU ⟨hxbd, heU hxe⟩) + constructor + · rcases GM14.subset_or_disjoint_of_frontier hK hp hdfr with hsub | hdisj + · exact Or.inl hsub + · refine Or.inr (Subset.trans ?_ subset_closure) + intro x hxe + exact ⟨mem_univ x, Set.disjoint_left.mp hdisj hxe⟩ + · rintro ⟨hsub₁, hsub₂⟩ + obtain ⟨x, hxe⟩ := hne + have hxbd : x ∈ subBd K := ⟨subset_closure (hsub₁ hxe), hsub₂ hxe⟩ + exact Set.disjoint_left.mp hdV hxe (hU ⟨hxbd, heU hxe⟩) + refine ⟨?_, ?_⟩ + · rw [isSeparation_iff_of_le hle₁ hle₂] + refine ⟨?_, ?_, ?_⟩ + · ext v + simp only [mem_union, Drawing.toHypergraph, interSet_V_of_isClosed H hK, + interSet_V_of_isClosed H hK', mem_inter_iff] + refine ⟨fun h => h.elim And.left And.left, fun hv => ?_⟩ + by_cases hvK : v ∈ K + · exact Or.inl ⟨hv, hvK⟩ + · exact Or.inr ⟨hv, subset_closure ⟨mem_univ v, hvK⟩⟩ + · ext e + simp only [mem_union, Drawing.toHypergraph, interSet_E, mem_ofPred_eq] + exact ⟨fun h => h.elim And.left And.left, + fun he => (hedge e he).1.elim (fun h => Or.inl ⟨he, h⟩) (fun h => Or.inr ⟨he, h⟩)⟩ + · ext e + simp only [mem_inter_iff, Drawing.toHypergraph, interSet_E, mem_ofPred_eq, + mem_empty_iff_false, iff_false, not_and] + intro h₁ _ h₂ + exact (hedge e h₁.1).2 ⟨h₁.2, h₂⟩ + · have hinter : ((H.interSet K).toHypergraph ∩ + (H.interSet (closure (univ \ K))).toHypergraph).vertexSet = subBd K ∩ H.V := by + ext v + simp only [inter_vertexSet, mem_inter_iff, Drawing.toHypergraph, + interSet_V_of_isClosed H hK, interSet_V_of_isClosed H hK', subBd, hK.closure_eq] + tauto + rw [separationOrder, hinter] + +/-- **Graph Minors XV, (3.1)** (page 119): +In a rigid drawing `H` in a connected closed surface `Σ` with a tangle `T` of order `≥ 3`, for any +closed disc `Δ ⊆ Σ` with `bd(Δ) ∩ U(H) ⊆ V(H)` and `|bd(Δ) ∩ V(H)| ≤ 2`, +`(H ∩ Δ, H ∩ closure(Σ - Δ)) ∈ T` if and only if `Δ` is a dial for `bd(Δ)`. -/ +theorem theorem_3_1_proof : GM15Theorem31Statement.{w} := by + intro S _ _ H θ T Δ hS hConn hRigid hT hθ hΔ hU hV + obtain ⟨hsep, hord⟩ := isSeparation_interSet_of_isClosed H hΔ.isClosed hU + constructor + · intro hAB + have hbd_eq : subBd Δ = discBd Δ := IsClosedDisc.subBd_eq_discBd hS hΔ + have hOArc : IsOArc (subBd Δ) := hbd_eq ▸ hΔ.isOArc_discBd + obtain ⟨Δ', hDial'⟩ := hRigid (subBd Δ) hOArc hU hV + by_cases hEq : Δ = Δ' + · subst hEq + exact hDial' + · exfalso + have hΔ' : IsClosedDisc Δ' := hDial'.1 + have hbd' : subBd Δ' = subBd Δ := hDial'.2.1 + have hdiscBd_eq : discBd Δ = discBd Δ' := by + rw [← hbd_eq, ← hbd', IsClosedDisc.subBd_eq_discBd hS hΔ'] + have hcov : Δ ∪ Δ' = univ := GM14.cover_of_discBd_eq hS hΔ hΔ' hdiscBd_eq hEq + have hsub : closure (univ \ Δ) ⊆ Δ' := by + refine hΔ'.isClosed.closure_subset_iff.mpr (fun x hx => ?_) + have hx' : x ∈ Δ ∪ Δ' := hcov ▸ mem_univ x + exact hx'.resolve_left hx.2 + have hle : (H.interSet (closure (univ \ Δ))).toHypergraph ≤ (H.interSet Δ').toHypergraph := + interSet_toHypergraph_mono_of_isClosed H isClosed_closure hΔ'.isClosed hsub + have hcircB : GM10.HasCircuit (H.interSet (closure (univ \ Δ))).toHypergraph := + GM10.theorem_2_10_proof hT hθ hAB + exact not_hasCircuit_of_isDial hU hDial' (hcircB.mono hle) + · intro hDial + have hord' : separationOrder (H.interSet (closure (univ \ Δ))).toHypergraph + (H.interSet Δ).toHypergraph < θ := by + rw [separationOrder_comm, hord] + omega + rcases hT.axiom1 hsep.symm hord' with hBA | hAB + · exfalso + exact not_hasCircuit_of_isDial hU hDial (GM10.theorem_2_10_proof hT hθ hBA) + · exact hAB + +/-- Statement of Graph Minors XV, (3.2) (pages 119–120): +"Let $\Sigma$ be a surface with $bd(\Sigma) = \emptyset$, and let $\Sigma_1, \Sigma_2 \subseteq +\Sigma$ be surfaces with $\Sigma_1 \cup \Sigma_2 = \Sigma$ and $\Sigma_1 \cap \Sigma_2 = +bd(\Sigma_1) = bd(\Sigma_2)$. Let $H$ be a drawing in $\Sigma$ with $\Sigma_1 \cap \Sigma_2 +\subseteq U(H)$, and let $X \subseteq V(H) \cap \Sigma_1 \cap \Sigma_2$. Let $\hat{\Sigma}_1$ be a +surface with $\Sigma_1 \subseteq \hat{\Sigma}_1$ and $bd(\hat{\Sigma}_1) = \emptyset$, such that +each O-arc in $bd(\Sigma_1)$ bounds an open disc in $\hat{\Sigma}_1$ disjoint from $\Sigma_1$ +(thus, $\hat{\Sigma}_1$ is obtained from $\Sigma_1$ by “pasting” a disc onto each O-arc in +$bd(\Sigma_1)$). Suppose that ... +(i) if $r$ is a region of $H$ in $\Sigma$ and $r \subseteq \Sigma_1$, there is at most one +component $F$ of $\Sigma_1 \cap \Sigma_2$ with $\bar{r} \cap F \ne \emptyset$ +(ii) for every $O$-arc $F \subseteq \hat{\Sigma}_1$, with $F \cap U(H) \subseteq V(H)$ and $|F +\cap V(H)| \le 2$, there is a dial $\Delta \subseteq \hat{\Sigma}_1$ for $F, H \cap \Sigma_1$ with +$|X \cap \Delta| \le |F \cap V(H)|$ +(iii) for every $O$-arc $F \subseteq \Sigma_2$ with $F \cap U(H) \subseteq V(H)$ and $|F \cap +V(H)| \le 2$, there is a dial $\Delta \subseteq \Sigma_2$ for $F, H$ +(iv) if $F \subseteq \Sigma_2$ is a line with ends $u, v \in \Sigma_1 \cap \Sigma_2 \cap V(H)$ and +is otherwise disjoint from $U(H)$, and $P$ is a path of $H \cap \Sigma_1 \cap \Sigma_2$ with ends +$u, v$ and with $|V(P) \cap X| \le 2$, then the $O$-arc $U(P) \cup F$ bounds an open disc in +$\Sigma_2$ disjoint from $U(H)$. +Then $H$ is rigid in $\Sigma$." -/ +def GM15Theorem32Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + {S_hat : Type w} [TopologicalSpace S_hat] [T2Space S_hat] + {t : ℕ} (C : Fin t → Set S) (P₁ P₂ : Set S) (ι : P₁ → S_hat) (D : Fin t → Set S_hat) + (H : Drawing S) (H₁ : Drawing S_hat) (X : Set S), + GM12.IsCappedSplit C P₁ P₂ ι D → + GM12.IsCappedDrawing ι H H₁ → + P₁ ∩ P₂ ⊆ H.U → + X ⊆ H.V ∩ (P₁ ∩ P₂) → + (∀ r ∈ H.R, r ⊆ P₁ → ∀ i j : Fin t, + (closure r ∩ C i).Nonempty → (closure r ∩ C j).Nonempty → i = j) → + (∀ F : Set S_hat, IsOArc F → F ∩ H₁.U ⊆ H₁.V → (F ∩ H₁.V).ncard ≤ 2 → + ∃ Δ : Set S_hat, IsDial H₁ F Δ ∧ ((ι '' ((↑) ⁻¹' X)) ∩ Δ).ncard ≤ (F ∩ H₁.V).ncard) → + (∀ F : Set S, F ⊆ P₂ → IsOArc F → F ∩ H.U ⊆ H.V → (F ∩ H.V).ncard ≤ 2 → + ∃ Δ : Set S, Δ ⊆ P₂ ∧ IsDial H F Δ) → + (∀ (F : Set S) (u v : S) (P : Drawing S), + F ⊆ P₂ → u ∈ (P₁ ∩ P₂) ∩ H.V → v ∈ (P₁ ∩ P₂) ∩ H.V → + IsLineWithEnds F u v → F ∩ H.U ⊆ {u, v} → + P.IsSubdrawing (H.interSet (P₁ ∩ P₂)) → P.IsPathBetween u v → + (P.V ∩ X).ncard ≤ 2 → + ∃ U₀ : Set S, IsOpenDisc U₀ ∧ IsClosedDisc (closure U₀) ∧ U₀ ⊆ P₂ ∧ + subBd U₀ = P.U ∪ F ∧ Disjoint U₀ H.U) → + IsRigid H + +/-- Monotonicity of `H.interSet K` as a subdrawing with respect to closed sets `K₁ ⊆ K₂`. -/ +theorem interSet_isSubdrawing_of_isClosed {S : Type w} [TopologicalSpace S] [T1Space S] + (H : Drawing S) {K₁ K₂ : Set S} (hK₁ : IsClosed K₁) (hK₂ : IsClosed K₂) (hsub : K₁ ⊆ K₂) : + (H.interSet K₁).IsSubdrawing (H.interSet K₂) := by + refine ⟨?_, ?_⟩ + · rw [interSet_V_of_isClosed H hK₁, interSet_V_of_isClosed H hK₂] + exact inter_subset_inter_right _ hsub + · rw [interSet_E, interSet_E] + exact fun _ h => ⟨h.1, h.2.trans hsub⟩ + +private lemma isPathBetween_symm {S : Type*} [TopologicalSpace S] {P : Drawing S} {a b : S} + (hP : P.IsPathBetween a b) : P.IsPathBetween b a := by + obtain ⟨W, hW, hV, hE⟩ := hP + refine ⟨W.reverse, hW.reverse, ?_, ?_⟩ + · rw [hV]; ext x; simp [GraphWalk.support_reverse] + · rw [hE]; ext e; simp [GraphWalk.edges_reverse] + +private lemma ends_mem_of_isLineWithEnds {S : Type*} [TopologicalSpace S] + {B : Set S} {u v : S} (hB : IsLineWithEnds B u v) : u ∈ B ∧ v ∈ B := by + obtain ⟨ψ, hψ0, hψ1⟩ := hB + exact ⟨hψ0 ▸ (ψ 0).2, hψ1 ▸ (ψ 1).2⟩ + +private lemma isPreconnected_of_isLineWithEnds {S : Type*} [TopologicalSpace S] + {B : Set S} {u v : S} (hB : IsLineWithEnds B u v) : IsPreconnected B := by + obtain ⟨ψ, _, _⟩ := hB + have hEq : B = range (fun s : unitInterval => (ψ s).1) := by + ext x + exact ⟨fun hx => ⟨ψ.symm ⟨x, hx⟩, by simp⟩, fun ⟨s, hs⟩ => hs ▸ (ψ s).2⟩ + rw [hEq] + exact isPreconnected_range (continuous_subtype_val.comp ψ.continuous) + +private lemma isCompact_of_isLineWithEnds {S : Type*} [TopologicalSpace S] + {B : Set S} {u v : S} (hB : IsLineWithEnds B u v) : IsCompact B := by + obtain ⟨ψ, _, _⟩ := hB + have hEq : B = range (fun s : unitInterval => (ψ s).1) := by + ext x + exact ⟨fun hx => ⟨ψ.symm ⟨x, hx⟩, by simp⟩, fun ⟨s, hs⟩ => hs ▸ (ψ s).2⟩ + rw [hEq] + exact isCompact_range (continuous_subtype_val.comp ψ.continuous) + +private lemma isLineWithEnds_image {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + {B : Set S} {u v : S} (hB : IsLineWithEnds B u v) {f : S → T} {f' : T → S} + (hf : ContinuousOn f B) (hf' : ContinuousOn f' (f '' B)) (hl : LeftInvOn f' f B) : + IsLineWithEnds (f '' B) (f u) (f v) := by + obtain ⟨e, he⟩ := exists_homeomorph_image hf hf' hl + obtain ⟨ψ, hψ0, hψ1⟩ := hB + exact ⟨ψ.trans e, (he (ψ 0)).trans (congr_arg f hψ0), (he (ψ 1)).trans (congr_arg f hψ1)⟩ + +private lemma eq_of_isLineWithEnds_subset {S : Type*} [TopologicalSpace S] {B L : Set S} {u v : S} + (hB : IsLineWithEnds B u v) (hL : IsLineWithEnds L u v) (hsub : B ⊆ L) : + B = L := by + refine Subset.antisymm hsub (fun x hx => ?_) + obtain ⟨ψ, hψ0, hψ1⟩ := hB + obtain ⟨φ, hφ0, hφ1⟩ := hL + let α : unitInterval → unitInterval := fun s => φ.symm ⟨(ψ s).1, hsub (ψ s).2⟩ + have hα : Continuous α := + φ.symm.continuous.comp ((continuous_subtype_val.comp ψ.continuous).subtype_mk _) + have hα0 : α 0 = 0 := by + apply φ.injective + rw [Homeomorph.apply_symm_apply] + exact Subtype.ext (hψ0.trans hφ0.symm) + have hα1 : α 1 = 1 := by + apply φ.injective + rw [Homeomorph.apply_symm_apply] + exact Subtype.ext (hψ1.trans hφ1.symm) + have hmem0 : (0 : unitInterval) ∈ range α := ⟨0, hα0⟩ + have hmem1 : (1 : unitInterval) ∈ range α := ⟨1, hα1⟩ + have ht : φ.symm ⟨x, hx⟩ ∈ Icc (0 : unitInterval) 1 := + ⟨(φ.symm ⟨x, hx⟩).2.1, (φ.symm ⟨x, hx⟩).2.2⟩ + obtain ⟨s, hs⟩ := (isPreconnected_range hα).ordConnected.out hmem0 hmem1 ht + have hφs : φ (α s) = ⟨x, hx⟩ := by rw [hs, Homeomorph.apply_symm_apply] + have hψs : (ψ s).1 = x := by + have h1 : (φ (α s)).1 = (ψ s).1 := by + simp only [α, Homeomorph.apply_symm_apply] + exact h1.symm.trans (congr_arg Subtype.val hφs) + exact hψs ▸ (ψ s).2 + +private lemma not_isOArc_subset_isLineWithEnds {S : Type*} [TopologicalSpace S] + {J L : Set S} {u v : S} (hJ : IsOArc J) (hL : IsLineWithEnds L u v) (hsub : J ⊆ L) : + False := by + obtain ⟨φ, _, _⟩ := hL + obtain ⟨γ⟩ := hJ + let g : Circle → ℝ := fun z => (φ.symm ⟨(γ z).1, hsub (γ z).2⟩).1 + have hg : Continuous g := + continuous_subtype_val.comp (φ.symm.continuous.comp + ((continuous_subtype_val.comp γ.continuous).subtype_mk _)) + refine GM11.not_injective_circle_real hg fun z₁ z₂ h => ?_ + have h1 := congr_arg Subtype.val (congr_arg φ (Subtype.ext h)) + simp only [Homeomorph.apply_symm_apply] at h1 + exact γ.injective (Subtype.ext h1) + +open Classical in +private noncomputable def cappedFwd {S S_hat : Type*} (P₁ : Set S) (ι : P₁ → S_hat) (p₀ : P₁) + (x : S) : S_hat := + if hx : x ∈ P₁ then ι ⟨x, hx⟩ else ι p₀ + +open Classical in +private noncomputable def cappedInv {S S_hat : Type*} [TopologicalSpace S] [TopologicalSpace S_hat] + (P₁ : Set S) (ι : P₁ → S_hat) (hEmb : IsEmbedding ι) (p₀ : P₁) (y : S_hat) : S := + if hy : y ∈ range ι then (hEmb.toHomeomorph.symm ⟨y, hy⟩).1 else p₀.1 + +private lemma cappedFwd_apply_of_mem {S S_hat : Type*} {P₁ : Set S} {ι : P₁ → S_hat} {p₀ : P₁} + {x : S} (hx : x ∈ P₁) : cappedFwd P₁ ι p₀ x = ι ⟨x, hx⟩ := by + unfold cappedFwd + split_ifs + rfl + +private lemma cappedInv_apply_of_mem {S S_hat : Type*} [TopologicalSpace S] [TopologicalSpace S_hat] + {P₁ : Set S} {ι : P₁ → S_hat} {hEmb : IsEmbedding ι} {p₀ : P₁} + {y : S_hat} (hy : y ∈ range ι) : + cappedInv P₁ ι hEmb p₀ y = (hEmb.toHomeomorph.symm ⟨y, hy⟩).1 := by + unfold cappedInv + split_ifs + rfl + +private lemma mapsTo_cappedFwd {S S_hat : Type*} {P₁ : Set S} {ι : P₁ → S_hat} {p₀ : P₁} : + MapsTo (cappedFwd P₁ ι p₀) P₁ (range ι) := + fun x hx => by rw [cappedFwd_apply_of_mem hx]; exact mem_range_self (⟨x, hx⟩ : P₁) + +private lemma mapsTo_cappedInv {S S_hat : Type*} [TopologicalSpace S] [TopologicalSpace S_hat] + {P₁ : Set S} {ι : P₁ → S_hat} {hEmb : IsEmbedding ι} {p₀ : P₁} : + MapsTo (cappedInv P₁ ι hEmb p₀) (range ι) P₁ := + fun y hy => by rw [cappedInv_apply_of_mem hy]; exact (hEmb.toHomeomorph.symm ⟨y, hy⟩).2 + +private lemma leftInvOn_cappedInv {S S_hat : Type*} [TopologicalSpace S] [TopologicalSpace S_hat] + {P₁ : Set S} {ι : P₁ → S_hat} {hEmb : IsEmbedding ι} {p₀ : P₁} : + LeftInvOn (cappedInv P₁ ι hEmb p₀) (cappedFwd P₁ ι p₀) P₁ := by + intro x hx + have hfx : cappedFwd P₁ ι p₀ x ∈ range ι := mapsTo_cappedFwd hx + rw [cappedInv_apply_of_mem hfx] + have hsub : (⟨cappedFwd P₁ ι p₀ x, hfx⟩ : range ι) = hEmb.toHomeomorph ⟨x, hx⟩ := by + ext; exact cappedFwd_apply_of_mem hx + rw [hsub, Homeomorph.symm_apply_apply] + +private lemma leftInvOn_cappedFwd {S S_hat : Type*} [TopologicalSpace S] [TopologicalSpace S_hat] + {P₁ : Set S} {ι : P₁ → S_hat} {hEmb : IsEmbedding ι} {p₀ : P₁} : + LeftInvOn (cappedFwd P₁ ι p₀) (cappedInv P₁ ι hEmb p₀) (range ι) := by + intro y hy + have hgy : cappedInv P₁ ι hEmb p₀ y ∈ P₁ := mapsTo_cappedInv hy + rw [cappedFwd_apply_of_mem hgy] + have hsub : (⟨cappedInv P₁ ι hEmb p₀ y, hgy⟩ : P₁) = hEmb.toHomeomorph.symm ⟨y, hy⟩ := by + ext; exact cappedInv_apply_of_mem hy + exact congr_arg Subtype.val + ((congr_arg hEmb.toHomeomorph hsub).trans (Homeomorph.apply_symm_apply _ _)) + +private lemma continuousOn_cappedFwd {S S_hat : Type*} [TopologicalSpace S] [TopologicalSpace S_hat] + {P₁ : Set S} {ι : P₁ → S_hat} (hEmb : IsEmbedding ι) (p₀ : P₁) : + ContinuousOn (cappedFwd P₁ ι p₀) P₁ := by + rw [continuousOn_iff_continuous_domRestrict] + have hEq : P₁.domRestrict (cappedFwd P₁ ι p₀) = ι := by + ext x; exact cappedFwd_apply_of_mem x.2 + rw [hEq] + exact hEmb.continuous + +private lemma continuousOn_cappedInv {S S_hat : Type*} [TopologicalSpace S] [TopologicalSpace S_hat] + {P₁ : Set S} {ι : P₁ → S_hat} (hEmb : IsEmbedding ι) (p₀ : P₁) : + ContinuousOn (cappedInv P₁ ι hEmb p₀) (range ι) := by + rw [continuousOn_iff_continuous_domRestrict] + have hEq : (range ι).domRestrict (cappedInv P₁ ι hEmb p₀) = + Subtype.val ∘ hEmb.toHomeomorph.symm := by + ext y; exact cappedInv_apply_of_mem y.2 + rw [hEq] + exact continuous_subtype_val.comp hEmb.toHomeomorph.symm.continuous + +private lemma cappedFwd_image_eq_of_subset {S S_hat : Type*} {P₁ : Set S} {ι : P₁ → S_hat} + {p₀ : P₁} {A : Set S} (hA : A ⊆ P₁) : + cappedFwd P₁ ι p₀ '' A = ι '' ((↑) ⁻¹' A) := by + ext y + constructor + · rintro ⟨x, hxA, rfl⟩ + exact ⟨⟨x, hA hxA⟩, hxA, (cappedFwd_apply_of_mem (hA hxA)).symm⟩ + · rintro ⟨⟨x, hxP⟩, hxA, rfl⟩ + exact ⟨x, hxA, cappedFwd_apply_of_mem hxP⟩ + +private lemma cappedFwd_image_inter_P₁ {S S_hat : Type*} {P₁ : Set S} {ι : P₁ → S_hat} + {p₀ : P₁} (A : Set S) : + cappedFwd P₁ ι p₀ '' (A ∩ P₁) = ι '' ((↑) ⁻¹' A) := by + rw [cappedFwd_image_eq_of_subset inter_subset_right] + ext y + simp only [mem_image, mem_preimage, mem_inter_iff, Subtype.exists] + exact ⟨fun ⟨x, hxP, ⟨hxA, _⟩, hy⟩ => ⟨x, hxP, hxA, hy⟩, + fun ⟨x, hxP, hxA, hy⟩ => ⟨x, hxP, ⟨hxA, hxP⟩, hy⟩⟩ + +private lemma walk_transfer_of_image {S S_hat : Type*} [TopologicalSpace S] [T2Space S] + [TopologicalSpace S_hat] [T2Space S_hat] + {K : Set S_hat} (hK : IsCompact K) + {f : S → S_hat} {g : S_hat → S} + (hg : ContinuousOn g K) (hf : ContinuousOn f (g '' K)) + (hl : LeftInvOn f g K) + {Q_hat : Drawing S_hat} {Q : Drawing S} + (hU_sub : Q_hat.U ⊆ K) (hU : Q.U = g '' Q_hat.U) (hV : Q.V = g '' Q_hat.V) : + Q.E = image g '' Q_hat.E ∧ + ∀ {u_hat v_hat : S_hat} (W_hat : GraphWalk Q_hat.toGraph u_hat v_hat), + ∃ W : GraphWalk Q.toGraph (g u_hat) (g v_hat), + W.support = W_hat.support.map g ∧ + W.edges = W_hat.edges.map (image g) := by + have hinj : InjOn g K := hl.injOn + have hUV : Q.U \ Q.V = g '' (Q_hat.U \ Q_hat.V) := by + rw [hU, hV] + ext x + constructor + · rintro ⟨⟨y, hyU, rfl⟩, hyV⟩ + exact ⟨y, ⟨hyU, fun h => hyV ⟨y, h, rfl⟩⟩, rfl⟩ + · rintro ⟨y, ⟨hyU, hyV⟩, rfl⟩ + refine ⟨⟨y, hyU, rfl⟩, ?_⟩ + rintro ⟨z, hzV, hzy⟩ + exact hyV (hinj (Q_hat.V_subset_U.trans hU_sub hzV) (hU_sub hyU) hzy ▸ hzV) + have hUV_sub : Q_hat.U \ Q_hat.V ⊆ K := sdiff_subset.trans hU_sub + have hE : Q.E = image g '' Q_hat.E := by + change arcComponentsIn (Q.U \ Q.V) = image g '' arcComponentsIn (Q_hat.U \ Q_hat.V) + rw [hUV] + exact GM11.arcComponentsIn_image (hg.mono hUV_sub) + (hf.mono (image_mono hUV_sub)) (hl.mono hUV_sub) + refine ⟨hE, ?_⟩ + have hLink : ∀ {e_hat : Set S_hat} {x_hat y_hat : S_hat}, + Q_hat.toGraph.IsLink e_hat x_hat y_hat → + Q.toGraph.IsLink (g '' e_hat) (g x_hat) (g y_hat) := by + rintro e_hat x_hat y_hat ⟨he_hat, hx_hat, hy_hat, hcl_hat⟩ + have he_sub : e_hat ⊆ K := + (GM14.PaintingOrDrawing.edge_props (Γ := .drawing Q_hat) he_hat).2.2.1.trans hU_sub + have hcl_sub : closure e_hat ⊆ K := hK.isClosed.closure_subset_iff.mpr he_sub + have hcl_comp : IsCompact (closure e_hat) := hK.of_isClosed_subset isClosed_closure hcl_sub + have hcl_img : g '' closure e_hat = closure (g '' e_hat) := + image_closure_of_isCompact hcl_comp (hg.mono hcl_sub) + refine ⟨hE ▸ mem_image_of_mem (image g) he_hat, + hV ▸ mem_image_of_mem g hx_hat, hV ▸ mem_image_of_mem g hy_hat, ?_⟩ + rw [← hcl_img, hV, ← hinj.image_inter hcl_sub (Q_hat.V_subset_U.trans hU_sub), hcl_hat] + simp [image_insert_eq] + intro u_hat v_hat W_hat + induction W_hat with + | @nil v₀ hu => + have hgu : g v₀ ∈ V(Q.toGraph) := by + change g v₀ ∈ Q.V + rw [hV] + exact mem_image_of_mem g hu + exact ⟨GraphWalk.nil hgu, rfl, rfl⟩ + | @cons a w _ e h r ih => + obtain ⟨W', hs', he'⟩ := ih + refine ⟨GraphWalk.cons (hLink h) W', ?_, ?_⟩ + · simp [GraphWalk.support_cons, hs'] + · simp [GraphWalk.edges, he'] + +private lemma isPathBetween_of_image {S S_hat : Type*} [TopologicalSpace S] [T2Space S] + [TopologicalSpace S_hat] [T2Space S_hat] + {K : Set S_hat} (hK : IsCompact K) + {f : S → S_hat} {g : S_hat → S} + (hg : ContinuousOn g K) (hf : ContinuousOn f (g '' K)) + (hl : LeftInvOn f g K) + {Q_hat : Drawing S_hat} {Q : Drawing S} {u_hat v_hat : S_hat} + (hU_sub : Q_hat.U ⊆ K) (hU : Q.U = g '' Q_hat.U) (hV : Q.V = g '' Q_hat.V) + (hPath : Q_hat.IsPathBetween u_hat v_hat) : + Q.IsPathBetween (g u_hat) (g v_hat) := by + obtain ⟨hE, hWalk⟩ := walk_transfer_of_image hK hg hf hl hU_sub hU hV + obtain ⟨W_hat, hW_hat, hV_hat, hE_hat⟩ := hPath + obtain ⟨W, hs, he⟩ := hWalk W_hat + have hinj : InjOn g K := hl.injOn + have hsupp_sub : ∀ x ∈ W_hat.support, x ∈ K := by + intro x hx + have hxV : x ∈ Q_hat.V := by rw [hV_hat]; exact hx + exact hU_sub (Q_hat.V_subset_U hxV) + refine ⟨W, ?_, ?_, ?_⟩ + · unfold GraphWalk.IsSimple + rw [hs] + exact hW_hat.map_on fun x hx y hy hxy => hinj (hsupp_sub x hx) (hsupp_sub y hy) hxy + · rw [hV, hV_hat, hs] + ext x + simp [List.mem_map] + · rw [hE, hE_hat, he] + ext e + simp [List.mem_map] + +private lemma halfEdges_nonempty_of_isOArc {S : Type*} [TopologicalSpace S] [T2Space S] + {Γ : Drawing S} {γ : Set S → unitInterval → S} (hγ : GM11.EdgePar Γ γ) + {J : Set S} (hJ : IsOArc J) (hJU : J ⊆ Γ.U) {x : S} (hxJ : x ∈ J) (hxV : x ∈ Γ.V) : + (GM11.halfEdges Γ γ x).Nonempty := by + by_contra hne + have hno : ∀ g ∈ Γ.E, x ∉ closure g := by + intro g hg hxg + obtain ⟨b, hb⟩ := GM11.exists_end_eq hγ hg hxV hxg + exact hne ⟨(g, b), hg, hb⟩ + have hcl : IsClosed (Γ.U \ {x}) := by + have heq : Γ.U \ {x} = (Γ.V \ {x}) ∪ ⋃ g ∈ Γ.E, closure g := by + ext y + rw [Γ.U_eq] + constructor + · rintro ⟨hy | hy, hyx⟩ + · exact Or.inl ⟨hy, hyx⟩ + · exact Or.inr hy + · rintro (⟨hy, hyx⟩ | hy) + · exact ⟨Or.inl hy, hyx⟩ + · refine ⟨Or.inr hy, fun h => ?_⟩ + obtain ⟨g, hg, hyg⟩ := mem_iUnion₂.mp hy + exact hno g hg (mem_singleton_iff.mp h ▸ hyg) + rw [heq] + exact (Γ.finite_V.subset sdiff_subset).isClosed.union + (Γ.finite_edges.isClosed_biUnion fun _ _ => isClosed_closure) + have hJx_sub : J \ {x} ⊆ Γ.U \ {x} := sdiff_subset_sdiff hJU Subset.rfl + have hcl_sub : closure (J \ {x}) ⊆ Γ.U \ {x} := hcl.closure_subset_iff.mpr hJx_sub + have hx_not_cl : x ∉ closure (J \ {x}) := fun hxcl => (hcl_sub hxcl).2 rfl + have hJ_conn : IsPreconnected J := by + obtain ⟨φ⟩ := hJ + have hEq : J = range (fun z : Circle => (φ z).1) := by + ext y + exact ⟨fun hy => ⟨φ.symm ⟨y, hy⟩, by simp⟩, fun ⟨z, hz⟩ => hz ▸ (φ z).2⟩ + rw [hEq] + exact isPreconnected_range (continuous_subtype_val.comp φ.continuous) + have hJ_cov : J ⊆ (closure (J \ {x}))ᶜ ∪ ({x} : Set S)ᶜ := by + intro y hy + by_cases hyx : y = x + · subst hyx; exact Or.inl hx_not_cl + · exact Or.inr hyx + obtain ⟨w, hwJ, hw_not⟩ := + ((GM11.infinite_of_isOArc hJ).sdiff (finite_singleton x)).nonempty + obtain ⟨y, hyJ, hy_not_cl, hy_ne⟩ := + hJ_conn (closure (J \ {x}))ᶜ ({x} : Set S)ᶜ + isClosed_closure.isOpen_compl isClosed_singleton.isOpen_compl hJ_cov + ⟨x, hxJ, hx_not_cl⟩ ⟨w, hwJ, hw_not⟩ + exact hy_not_cl (subset_closure ⟨hyJ, hy_ne⟩) + +private lemma exists_chord_in_cappingDisc {S_hat : Type*} [TopologicalSpace S_hat] [T2Space S_hat] + (hS_hat : IsClosedSurface S_hat) {H₁ : Drawing S_hat} {D_i : Set S_hat} + (hOpen : IsOpenDisc D_i) (hDisj : Disjoint D_i H₁.U) + (hOArc : IsOArc (subBd D_i)) (hBdU : subBd D_i ⊆ H₁.U) + {u' v' : S_hat} (hu' : u' ∈ subBd D_i ∩ H₁.V) (hv' : v' ∈ subBd D_i ∩ H₁.V) + (huv' : u' ≠ v') : + ∃ L_D : Set S_hat, IsLineWithEnds L_D u' v' ∧ L_D \ {u', v'} ⊆ D_i := by + have : LocallyConnectedSpace S_hat := IsClosedSurface.locallyConnectedSpace hS_hat + have hConn : IsPreconnected D_i := hOpen.isPathConnected.isConnected.isPreconnected + obtain ⟨x₀, hx₀⟩ : D_i.Nonempty := by + obtain ⟨φ⟩ := hOpen.2 + exact ⟨(φ ⟨0, by simp [OpenUnitDisc]⟩).1, (φ _).2⟩ + have : Nonempty S_hat := ⟨x₀⟩ + obtain ⟨r, hr, hx₀r⟩ := GM11.exists_region_of_notMem (Γ := H₁) (disjoint_left.mp hDisj hx₀) + have hDr : D_i ⊆ r := GM11.subset_region hr hConn hDisj hx₀ hx₀r + obtain ⟨_, hclD⟩ := isOpen_disjoint_subBd_and_closure_eq hOpen.1 + have hrD : r ⊆ D_i := by + have hdis_fr : Disjoint r (frontier (closure D_i)) := by + refine disjoint_left.mpr fun y hyr hyfr => ?_ + exact GM11.region_subset hr hyr (hBdU (subBd_eq_frontier D_i ▸ frontier_closure_subset hyfr)) + have hr_cl : r ⊆ closure D_i := + GM14.subset_of_disjoint_frontier (GM11.region_isPreconnected hr) isClosed_closure + hdis_fr hx₀r (subset_closure hx₀) + intro y hyr + rcases hclD ▸ hr_cl hyr with hyD | hyBd + · exact hyD + · exact (GM11.region_subset hr hyr (hBdU hyBd)).elim + have hR : D_i ∈ H₁.R := Subset.antisymm hDr hrD ▸ hr + obtain ⟨γ, hγ⟩ := GM11.exists_edgePar H₁ + have hne_u : (GM11.halfEdges H₁ γ u').Nonempty := + halfEdges_nonempty_of_isOArc hγ hOArc hBdU hu'.1 hu'.2 + have hne_v : (GM11.halfEdges H₁ γ v').Nonempty := + halfEdges_nonempty_of_isOArc hγ hOArc hBdU hv'.1 hv'.2 + obtain ⟨g₁, hg₁, hg₁0, hg₁p⟩ := + GM11.exists_access hS_hat H₁ hγ hu'.2 hne_u hR hu'.1.1 + obtain ⟨g₂, hg₂, hg₂0, hg₂p⟩ := + GM11.exists_access hS_hat H₁ hγ hv'.2 hne_v hR hv'.1.1 + have hu'_not_D : u' ∉ D_i := fun h => disjoint_left.mp hDisj h (H₁.V_subset_U hu'.2) + obtain ⟨a, ha_cont, ha_inj, ha0, ha1, hap, -⟩ := + GM11.exists_chord hOpen.isPathConnected huv' hu'_not_D hg₁ hg₂ hg₁0 hg₂0 hg₁p hg₂p + refine ⟨range a, ha0 ▸ ha1 ▸ GM11.isLine_range ha_cont ha_inj, ?_⟩ + rintro z ⟨⟨t, rfl⟩, hzt⟩ + have ht0 : t ≠ 0 := fun h => hzt (Or.inl (by rw [← ha0, h])) + have ht1 : t ≠ 1 := fun h => hzt (Or.inr (by rw [mem_singleton_iff, ← ha1, h])) + exact hap t ht0 ht1 + +private theorem capped_disc_without_cap_lies_in_range + {S : Type w} + [TopologicalSpace S] + {S_hat : Type w} + [TopologicalSpace S_hat] + [T2Space S_hat] + {t : ℕ} + (C : Fin t → Set S) + (P₁ : Set S) + (P₂ : Set S) + (ι : ↑P₁ → S_hat) + (D : Fin t → Set S_hat) + (H₁ : Drawing S_hat) + (hSplit : GM12.IsCappedSplit C P₁ P₂ ι D) + (hDi_bd_U : ∀ (i : Fin t), subBd (D i) ⊆ H₁.U) + (hDi_disj_range : ∀ (i : Fin t), Disjoint (D i) (range ι)) : + ∀ {Δ_hat : Set S_hat}, IsClosedDisc Δ_hat → subBd Δ_hat ⊆ range ι → (∀ (i : Fin t), ¬subBd (D + i) ⊆ Δ_hat ∩ H₁.U) → Δ_hat ⊆ range ι := by + intro Δ_hat hΔ_hat hbd_range hno y hy + by_contra hy_not + have hy_iUnion : y ∈ ⋃ i, D i := hSplit.compl ▸ hy_not + obtain ⟨i, hyDi⟩ := mem_iUnion.mp hy_iUnion + have hdis_fr : Disjoint (D i) (frontier Δ_hat) := by + rw [← subBd_eq_frontier] + exact (hDi_disj_range i).mono_right hbd_range + have hDi_sub : D i ⊆ Δ_hat := + GM14.subset_of_disjoint_frontier + (hSplit.isOpenDisc i).isPathConnected.isConnected.isPreconnected + hΔ_hat.isClosed hdis_fr hyDi hy + have hbdDi_sub : subBd (D i) ⊆ Δ_hat := + Subset.trans (fun _ hz => hz.1) (hΔ_hat.isClosed.closure_subset_iff.mpr hDi_sub) + exact hno i (subset_inter hbdDi_sub (hDi_bd_U i)) + +private theorem pullback_of_capped_disc + {S : Type w} + [TopologicalSpace S] + {S_hat : Type w} + [TopologicalSpace S_hat] + (P₁ : Set S) + (ι : ↑P₁ → S_hat) + (hS : IsClosedSurface S) + (hS_hat : IsClosedSurface S_hat) + (f : S → S_hat) + (g : S_hat → S) + (hf_cont : ContinuousOn f P₁) + (hg_cont : ContinuousOn g (range ι)) + (hgf_inv : LeftInvOn f g (range ι)) + (hg_maps : MapsTo g (range ι) P₁) : + ∀ {Δ_hat : Set S_hat}, IsClosedDisc Δ_hat → Δ_hat ⊆ range ι → IsClosedDisc (g '' Δ_hat) ∧ + subBd (g '' Δ_hat) = g '' subBd Δ_hat ∧ g '' Δ_hat ⊆ P₁ := by + intro Δ_hat hΔ_hat hΔ_range + have hsub_P₁ : g '' Δ_hat ⊆ P₁ := (hg_maps.mono hΔ_range Subset.rfl).image_subset + obtain ⟨hDisc, hdiscBd⟩ := + hΔ_hat.image (hg_cont.mono hΔ_range) (hf_cont.mono hsub_P₁) (hgf_inv.mono hΔ_range) + refine ⟨hDisc, ?_, hsub_P₁⟩ + rw [IsClosedDisc.subBd_eq_discBd hS hDisc, hdiscBd, + ← IsClosedDisc.subBd_eq_discBd hS_hat hΔ_hat] + +private theorem boundary_arcs_meet_first_disc {S : Type*} [TopologicalSpace S] + {P₁ P₂ : Set S} {x₁ x₂ : S} (hP₁ : IsClosed P₁) + (hx₁P₁ : x₁ ∈ P₁) (hx₂_not_P₁ : x₂ ∉ P₁) (hx₁_not_P₂ : x₁ ∉ P₂) + (hfrP₁ : frontier P₁ ⊆ P₁ ∩ P₂) : + ∀ {A : Set S}, IsLineWithEnds A x₁ x₂ → + ∃ w ∈ A ∩ (P₁ ∩ P₂), w ∉ ({x₁, x₂} : Set S) := by + intro A hA + obtain ⟨hx₁A, hx₂A⟩ := ends_mem_of_isLineWithEnds hA + have hne : (A ∩ frontier P₁).Nonempty := by + by_contra h + have hdis : Disjoint A (frontier P₁) := disjoint_iff_inter_eq_empty.mpr + (not_nonempty_iff_eq_empty.mp h) + exact hx₂_not_P₁ (GM14.subset_of_disjoint_frontier (isPreconnected_of_isLineWithEnds hA) + hP₁ hdis hx₁A hx₁P₁ hx₂A) + obtain ⟨w, hwA, hwfr⟩ := hne + have hw12 : w ∈ P₁ ∩ P₂ := hfrP₁ hwfr + refine ⟨w, ⟨hwA, hw12⟩, ?_⟩ + rintro (rfl | rfl) + · exact hx₁_not_P₂ hw12.2 + · exact hx₂_not_P₁ hw12.1 + +private theorem boundary_arc_lies_on_one_side + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {S_hat : Type w} + [TopologicalSpace S_hat] + {t : ℕ} + (C : Fin t → Set S) + (P₁ : Set S) + (P₂ : Set S) + (ι : ↑P₁ → S_hat) + (D : Fin t → Set S_hat) + (hSplit : GM12.IsCappedSplit C P₁ P₂ ι D) + (F : Set S) + (hP₁_cl : IsClosed P₁) + (hP₂_cl : IsClosed P₂) + (hfrP₁ : frontier P₁ ⊆ P₁ ∩ P₂) + (hfrP₂ : frontier P₂ ⊆ P₁ ∩ P₂) + (u : S) + (v : S) + (hF12_eq : F ∩ (P₁ ∩ P₂) = {u, v}) : + ∀ {L : Set S}, IsLineWithEnds L u v → L ⊆ F → L ⊆ P₁ ∨ L ⊆ P₂ := by + intro L hL hLF + have hconn : IsPreconnected (L \ {u, v}) := + (GM11.isPathConnected_sdiff_pair hL).isConnected.isPreconnected + obtain ⟨w, hw⟩ := (GM11.isPathConnected_sdiff_pair hL).nonempty + have hdis₁ : Disjoint (L \ {u, v}) (frontier P₁) := by + refine disjoint_left.mpr fun z hz hzfr => hz.2 ?_ + exact hF12_eq ▸ ⟨hLF hz.1, hfrP₁ hzfr⟩ + have hdis₂ : Disjoint (L \ {u, v}) (frontier P₂) := by + refine disjoint_left.mpr fun z hz hzfr => hz.2 ?_ + exact hF12_eq ▸ ⟨hLF hz.1, hfrP₂ hzfr⟩ + have hsub_cl : L ⊆ closure (L \ {u, v}) := + (GM11.closure_sdiff_pair hL).symm.subset + rcases eq_univ_iff_forall.mp hSplit.union w with hwP₁ | hwP₂ + · left + have h1 : L \ {u, v} ⊆ P₁ := + GM14.subset_of_disjoint_frontier hconn hP₁_cl hdis₁ hw hwP₁ + exact hsub_cl.trans (hP₁_cl.closure_subset_iff.mpr h1) + · right + have h2 : L \ {u, v} ⊆ P₂ := + GM14.subset_of_disjoint_frontier hconn hP₂_cl hdis₂ hw hwP₂ + exact hsub_cl.trans (hP₂_cl.closure_subset_iff.mpr h2) + +private theorem split_circle_at_two_boundary_points + {S : Type w} + [TopologicalSpace S] + (P₁ : Set S) + (P₂ : Set S) + (F : Set S) + (hF₂ : ¬F ⊆ P₂) + (hF₁ : ¬F ⊆ P₁) + (u : S) + (v : S) + (F₁_0 : Set S) + (F₂_0 : Set S) + (hF₁_0 : IsLineWithEnds F₁_0 u v) + (hF₂_0 : IsLineWithEnds F₂_0 u v) + (hF_0_union : F₁_0 ∪ F₂_0 = F) + (hF_0_inter : F₁_0 ∩ F₂_0 = {u, v}) + (hArc_side : ∀ {L : Set S}, IsLineWithEnds L u v → L ⊆ F → L ⊆ P₁ ∨ L ⊆ P₂) : + ∃ F₁ F₂, IsLineWithEnds F₁ u v ∧ IsLineWithEnds F₂ u v ∧ F₁ ∪ F₂ = F ∧ F₁ ∩ F₂ = {u, v} ∧ F₁ ⊆ + P₁ ∧ F₂ ⊆ P₂ := by + have hsub₁ : F₁_0 ⊆ F := hF_0_union ▸ subset_union_left + have hsub₂ : F₂_0 ⊆ F := hF_0_union ▸ subset_union_right + rcases hArc_side hF₁_0 hsub₁ with h1P₁ | h1P₂ <;> + rcases hArc_side hF₂_0 hsub₂ with h2P₁ | h2P₂ + · exact (hF₁ (hF_0_union ▸ union_subset h1P₁ h2P₁)).elim + · exact ⟨F₁_0, F₂_0, hF₁_0, hF₂_0, hF_0_union, hF_0_inter, h1P₁, h2P₂⟩ + · exact ⟨F₂_0, F₁_0, hF₂_0, hF₁_0, Set.union_comm F₂_0 F₁_0 ▸ hF_0_union, + Set.inter_comm F₂_0 F₁_0 ▸ hF_0_inter, h2P₁, h1P₂⟩ + · exact (hF₂ (hF_0_union ▸ union_subset h1P₂ h2P₂)).elim + +private theorem boundary_arc_mem_disc + {S_hat : Type w} + [TopologicalSpace S_hat] + [T2Space S_hat] + (H₁ : Drawing S_hat) + (u' : S_hat) + (v' : S_hat) + (F_hat : Set S_hat) + (hF_hat_U : F_hat ∩ H₁.U = {u', v'}) + (Δ_hat : Set S_hat) + (hΔ_hat_disc : IsClosedDisc Δ_hat) + (hΔ_hat_bd : subBd Δ_hat = F_hat) + (hu'Δ : u' ∈ Δ_hat) (hv'Δ : v' ∈ Δ_hat) + (z₀ : S_hat) + (hz₀_Δ : z₀ ∈ Δ_hat) + (B₁ : Set S_hat) + (hB₁_line : IsLineWithEnds B₁ u' v') + (hz₀_B₁ : z₀ ∈ B₁) + (hz₀_not_uv : z₀ ∉ ({u', v'} : Set S_hat)) + (hB₁_U : B₁ ⊆ H₁.U) : + B₁ ⊆ Δ_hat := by + have hdis_fr : Disjoint (B₁ \ {u', v'}) (frontier Δ_hat) := by + rw [← subBd_eq_frontier, hΔ_hat_bd] + refine disjoint_left.mpr fun z hz hzF => hz.2 ?_ + exact hF_hat_U ▸ ⟨hzF, hB₁_U hz.1⟩ + have hdiff_sub : B₁ \ {u', v'} ⊆ Δ_hat := + GM14.subset_of_disjoint_frontier + (GM11.isPathConnected_sdiff_pair hB₁_line).isConnected.isPreconnected + hΔ_hat_disc.isClosed hdis_fr ⟨hz₀_B₁, hz₀_not_uv⟩ hz₀_Δ + intro z hz + by_cases hzuv : z ∈ ({u', v'} : Set S_hat) + · rcases hzuv with rfl | rfl + · exact hu'Δ + · exact hv'Δ + · exact hdiff_sub ⟨hz, hzuv⟩ + +private theorem capped_path_avoids_cap + {S_hat : Type w} + [TopologicalSpace S_hat] + [T2Space S_hat] + (H₁ : Drawing S_hat) + (u' : S_hat) + (v' : S_hat) + (hu'v' : u' ≠ v') + (F_hat : Set S_hat) + (hF_hat_V : F_hat ∩ H₁.V = {u', v'}) + (Δ_hat : Set S_hat) + (hDial_hat : IsDial H₁ F_hat Δ_hat) + (z₀ : S_hat) + (hz₀_Δ : z₀ ∈ Δ_hat) + (hz₀_not_F : z₀ ∉ F_hat) + (B₁ : Set S_hat) + (hz₀_B₁ : z₀ ∈ B₁) + (hB₁_U : B₁ ⊆ H₁.U) : + (H₁.interSet Δ_hat).IsPathBetween u' v' := by + rcases hDial_hat.2.2 with hsubF | ⟨u'', v'', _, hFV'', hPath''⟩ + · exact (hz₀_not_F (hsubF ⟨hz₀_Δ, hB₁_U hz₀_B₁⟩)).elim + · have hpair : ({u', v'} : Set S_hat) = {u'', v''} := hF_hat_V.symm.trans hFV'' + have hu'_mem : u' ∈ ({u'', v''} : Set S_hat) := hpair ▸ Or.inl rfl + have hv'_mem : v' ∈ ({u'', v''} : Set S_hat) := hpair ▸ Or.inr rfl + rcases mem_insert_iff.mp hu'_mem with hu1 | hu2 <;> + rcases mem_insert_iff.mp hv'_mem with hv1 | hv2 + · exact (hu'v' (hu1.trans hv1.symm)).elim + · rw [hu1, mem_singleton_iff.mp hv2] + exact hPath'' + · rw [mem_singleton_iff.mp hu2, hv1] + exact isPathBetween_symm hPath'' + · exact (hu'v' ((mem_singleton_iff.mp hu2).trans (mem_singleton_iff.mp hv2).symm)).elim + +private theorem first_capped_disc_lies_in_range + {S : Type w} + {S_hat : Type w} + [TopologicalSpace S_hat] + {t : ℕ} + (P₁ : Set S) + (ι : ↑P₁ → S_hat) + (D : Fin t → Set S_hat) + (H₁ : Drawing S_hat) + (hDi_bd_oArc : ∀ (i : Fin t), IsOArc (subBd (D i))) + (hDisc_sub_range : ∀ {Δ_hat : Set S_hat}, IsClosedDisc Δ_hat → subBd Δ_hat ⊆ range ι → (∀ (i : + Fin t), ¬subBd (D i) ⊆ Δ_hat ∩ H₁.U) → Δ_hat ⊆ range ι) + (u' : S_hat) + (v' : S_hat) + (F₁' : Set S_hat) + (hF₁'_range : F₁' ⊆ range ι) + (B₁ : Set S_hat) + (hB₁_line : IsLineWithEnds B₁ u' v') + (hB₁_range : B₁ ⊆ range ι) + (Δ_hat₁ : Set S_hat) + (hΔ_hat₁_disc : IsClosedDisc Δ_hat₁) + (hΔ_hat₁_bd : subBd Δ_hat₁ = F₁' ∪ B₁) + (hΔ_hat₁_U : Δ_hat₁ ∩ H₁.U = B₁) : + Δ_hat₁ ⊆ range ι := by + refine hDisc_sub_range hΔ_hat₁_disc (hΔ_hat₁_bd ▸ union_subset hF₁'_range hB₁_range) + fun j hsub => ?_ + exact not_isOArc_subset_isLineWithEnds (hDi_bd_oArc j) hB₁_line (hΔ_hat₁_U ▸ hsub) + +private theorem path_vertices_in_image + {S : Type w} + [TopologicalSpace S] + {S_hat : Type w} + [TopologicalSpace S_hat] + [T2Space S_hat] + (P₁ : Set S) + (ι : ↑P₁ → S_hat) + (H : Drawing S) + (H₁ : Drawing S_hat) + (f : S → S_hat) + (g : S_hat → S) + (hfg_inv : LeftInvOn g f P₁) + (hgf_inv : LeftInvOn f g (range ι)) + (hH₁_V : H₁.V = f '' (H.V ∩ P₁)) + (Δ_hat : Set S_hat) + (B₁ : Set S_hat) + (hB₁_range : B₁ ⊆ range ι) + (P : Drawing S) + (hL_P₁ : (g '' B₁) ⊆ P₁) + (hP_V : P.V = H.V ∩ (g '' B₁)) + (hQ_hat_V : (H₁.interSet Δ_hat).V = H₁.V ∩ B₁) : + P.V = g '' (H₁.interSet Δ_hat).V := by + rw [hP_V, hQ_hat_V, hH₁_V] + have h1 : f '' (H.V ∩ P₁) ∩ B₁ = f '' (H.V ∩ (g '' B₁)) := by + ext y + constructor + · rintro ⟨⟨x, ⟨hxV, hxP₁⟩, rfl⟩, hyB₁⟩ + exact ⟨x, ⟨hxV, f x, hyB₁, hfg_inv hxP₁⟩, rfl⟩ + · rintro ⟨_, ⟨hxV, z, hzB₁, rfl⟩, rfl⟩ + exact ⟨⟨g z, ⟨hxV, hL_P₁ (mem_image_of_mem g hzB₁)⟩, rfl⟩, + (hgf_inv (hB₁_range hzB₁)).symm ▸ hzB₁⟩ + rw [h1] + exact (hfg_inv.mono (inter_subset_right.trans hL_P₁)).image_image.symm + +private theorem augmented_path_avoids_drawing_except_vertices + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {S_hat : Type w} + [TopologicalSpace S_hat] + [T2Space S_hat] + (P₁ : Set S) + (ι : ↑P₁ → S_hat) + (H : Drawing S) + (H₁ : Drawing S_hat) + (f : S → S_hat) + (g : S_hat → S) + (hf_cont : ContinuousOn f P₁) + (hg_cont : ContinuousOn g (range ι)) + (hgf_inv : LeftInvOn f g (range ι)) + (hg_inj : InjOn g (range ι)) + (hH₁_V : H₁.V = f '' (H.V ∩ P₁)) + (u' : S_hat) + (v' : S_hat) + (Δ_hat : Set S_hat) + (hΔ_hat_inter_U : (H₁.interSet Δ_hat).U = H₁.U ∩ Δ_hat) + (B₁ : Set S_hat) + (hB₁_line : IsLineWithEnds B₁ u' v') + (hB₁_range : B₁ ⊆ range ι) + (hΔ_hat_U_eq : (H₁.interSet Δ_hat).U = B₁) + (L : Set S) (hL : L = g '' B₁) + (hL_P₁ : L ⊆ P₁) + (hL_U : L ⊆ H.U) + (hL_cl : IsClosed L) + (hB₁_cl : IsClosed B₁) + (hP_V : (H.interSet L).V = H.V ∩ L) + (hQ_hat_V : (H₁.interSet Δ_hat).V = H₁.V ∩ B₁) + (hP_V_img : (H.interSet L).V = g '' (H₁.interSet Δ_hat).V) : + (H.interSet L).U = L := by + refine Subset.antisymm ?_ ?_ + · rw [(H.interSet L).U_eq, hP_V, interSet_E] + refine union_subset inter_subset_right (iUnion₂_subset fun e he => ?_) + exact hL_cl.closure_subset_iff.mpr he.2 + · have hB₁_decomp : B₁ = (H₁.interSet Δ_hat).V ∪ + ⋃ e_hat ∈ (H₁.interSet Δ_hat).E, closure e_hat := + hΔ_hat_U_eq.symm.trans (H₁.interSet Δ_hat).U_eq + conv_lhs => rw [hL] + rw [hB₁_decomp, image_union, ← hP_V_img] + refine union_subset (H.interSet L).V_subset_U ?_ + rintro _ ⟨y, hy, rfl⟩ + obtain ⟨e_hat, he_hat, hy_cl⟩ := mem_iUnion₂.mp hy + have he_hat' : e_hat ∈ H₁.E ∧ e_hat ⊆ Δ_hat := by rwa [interSet_E] at he_hat + have he_hat_B₁ : e_hat ⊆ B₁ := by + rw [← hΔ_hat_U_eq, hΔ_hat_inter_U] + exact subset_inter (he_hat'.1.2.1.trans sdiff_subset) he_hat'.2 + have hcl_B₁ : closure e_hat ⊆ B₁ := hB₁_cl.closure_subset_iff.mpr he_hat_B₁ + have hge_UV : g '' e_hat ⊆ H.U \ H.V := by + rintro _ ⟨z, hz, rfl⟩ + refine ⟨hL_U (hL.symm ▸ mem_image_of_mem g (he_hat_B₁ hz)), fun hgzV => ?_⟩ + have hzV : z ∈ H₁.V := by + rw [← hgf_inv (hB₁_range (he_hat_B₁ hz)), hH₁_V] + exact mem_image_of_mem f ⟨hgzV, hL_P₁ (hL.symm ▸ mem_image_of_mem g (he_hat_B₁ hz))⟩ + exact (he_hat'.1.2.1 hz).2 hzV + obtain ⟨y₀, hy₀⟩ := he_hat'.1.1 + have hgy₀_UV : g y₀ ∈ H.U \ H.V := hge_UV (mem_image_of_mem g hy₀) + obtain ⟨e, he, hgy₀_e⟩ := H.exists_edge_of_mem hgy₀_UV.1 hgy₀_UV.2 + have hge_pc : IsPathConnected (g '' e_hat) := + he_hat'.1.2.2.1.image' (hg_cont.mono (he_hat_B₁.trans hB₁_range)) + have hge_sub_e : g '' e_hat ⊆ e := by + have hun : e ∪ g '' e_hat = e := + he.2.2.2 (e ∪ g '' e_hat) (union_subset he.2.1 hge_UV) + (he.2.2.1.union hge_pc ⟨g y₀, hgy₀_e, mem_image_of_mem g hy₀⟩) subset_union_left + exact subset_union_right.trans hun.subset + have hcl_sub_e : g '' closure e_hat ⊆ closure e := + ((hg_cont.mono (hcl_B₁.trans hB₁_range)).image_closure).trans (closure_mono hge_sub_e) + rcases H₁.edge_cond e_hat he_hat'.1 with + ⟨a', b', ha'b', hcap_hat, hLine_hat⟩ | ⟨a', _, hOArc⟩ + · have ha' : a' ∈ closure e_hat ∩ H₁.V := hcap_hat ▸ Or.inl rfl + have hb' : b' ∈ closure e_hat ∩ H₁.V := hcap_hat ▸ Or.inr rfl + have ha'B₁ : a' ∈ B₁ := hcl_B₁ ha'.1 + have hb'B₁ : b' ∈ B₁ := hcl_B₁ hb'.1 + have ha'Q : a' ∈ (H₁.interSet Δ_hat).V := hQ_hat_V.symm ▸ ⟨ha'.2, ha'B₁⟩ + have hb'Q : b' ∈ (H₁.interSet Δ_hat).V := hQ_hat_V.symm ▸ ⟨hb'.2, hb'B₁⟩ + have hga'b' : g a' ≠ g b' := + fun h => ha'b' (hg_inj (hB₁_range ha'B₁) (hB₁_range hb'B₁) h) + have hga'_eV : g a' ∈ closure e ∩ H.V := + ⟨hcl_sub_e (mem_image_of_mem g ha'.1), (hP_V ▸ hP_V_img ▸ mem_image_of_mem g ha'Q).1⟩ + have hgb'_eV : g b' ∈ closure e ∩ H.V := + ⟨hcl_sub_e (mem_image_of_mem g hb'.1), (hP_V ▸ hP_V_img ▸ mem_image_of_mem g hb'Q).1⟩ + have hLine_img : IsLineWithEnds (g '' closure e_hat) (g a') (g b') := + isLineWithEnds_image hLine_hat (hg_cont.mono (hcl_B₁.trans hB₁_range)) + (hf_cont.mono ((image_mono hcl_B₁).trans (hL ▸ hL_P₁))) + (hgf_inv.mono (hcl_B₁.trans hB₁_range)) + have hcl_eq : g '' closure e_hat = closure e := by + rcases H.edge_cond e he with ⟨a, b, _, hcap, hLine⟩ | ⟨a, hcap, _⟩ + · have ha'ab : g a' ∈ ({a, b} : Set S) := hcap ▸ hga'_eV + have hb'ab : g b' ∈ ({a, b} : Set S) := hcap ▸ hgb'_eV + have hLine' : IsLineWithEnds (closure e) (g a') (g b') := by + rcases mem_insert_iff.mp ha'ab with ha1 | ha2 <;> + rcases mem_insert_iff.mp hb'ab with hb1 | hb2 + · exact (hga'b' (ha1.trans hb1.symm)).elim + · rw [ha1, mem_singleton_iff.mp hb2] + exact hLine + · rw [mem_singleton_iff.mp ha2, hb1] + exact hLine.symm + · exact (hga'b' ((mem_singleton_iff.mp ha2).trans + (mem_singleton_iff.mp hb2).symm)).elim + exact eq_of_isLineWithEnds_subset hLine_img hLine' hcl_sub_e + · have ha1 : g a' = a := mem_singleton_iff.mp (hcap ▸ hga'_eV) + have ha2 : g b' = a := mem_singleton_iff.mp (hcap ▸ hgb'_eV) + exact (hga'b' (ha1.trans ha2.symm)).elim + have he_P : e ∈ (H.interSet L).E := by + rw [interSet_E] + exact ⟨he, subset_closure.trans (hL.symm ▸ hcl_eq.symm ▸ image_mono hcl_B₁)⟩ + exact (H.interSet L).closure_subset_U he_P (hcl_sub_e (mem_image_of_mem g hy_cl)) + · exact (not_isOArc_subset_isLineWithEnds hOArc hB₁_line hcl_B₁).elim + +private theorem path_cut_size_le + {S : Type w} + [TopologicalSpace S] + {S_hat : Type w} + [TopologicalSpace S_hat] + (P₁ : Set S) + (P₂ : Set S) + (ι : ↑P₁ → S_hat) + (H : Drawing S) + (H₁ : Drawing S_hat) + (X : Set S) + (hCap : GM12.IsCappedDrawing ι H H₁) + (hX : X ⊆ H.V ∩ (P₁ ∩ P₂)) + (p₀ : ↑P₁) + (g : S_hat → S) + (hgf_inv : LeftInvOn (cappedFwd P₁ ι p₀) g (range ι)) + (hf_inj : InjOn (cappedFwd P₁ ι p₀) P₁) + (F_hat : Set S_hat) + (hF_hat_card : (F_hat ∩ H₁.V).ncard ≤ 2) + (Δ_hat : Set S_hat) + (hX_hat : (ι '' Subtype.val ⁻¹' X ∩ Δ_hat).ncard ≤ (F_hat ∩ H₁.V).ncard) + (B₁ : Set S_hat) + (hB₁_range : B₁ ⊆ range ι) + (hB₁_sub_Δ : B₁ ⊆ Δ_hat) + (P : Drawing S) + (hP_V : P.V = H.V ∩ (g '' B₁)) : + (P.V ∩ X).ncard ≤ 2 := by + let f := cappedFwd P₁ ι p₀ + have hsub : f '' (P.V ∩ X) ⊆ (ι '' ((↑) ⁻¹' X)) ∩ Δ_hat := by + rintro _ ⟨x, ⟨hxPV, hxX⟩, rfl⟩ + have hxP₁ : x ∈ P₁ := (hX hxX).2.1 + have hfx_X : f x ∈ ι '' ((↑) ⁻¹' X) := by + rw [← cappedFwd_image_eq_of_subset (hX.trans (inter_subset_right.trans inter_subset_left))] + exact mem_image_of_mem f hxX + have hfx_Δ : f x ∈ Δ_hat := by + have hxL : x ∈ g '' B₁ := (hP_V ▸ hxPV).2 + obtain ⟨y, hyB₁, rfl⟩ := hxL + change cappedFwd P₁ ι p₀ (g y) ∈ Δ_hat + rw [hgf_inv (hB₁_range hyB₁)] + exact hB₁_sub_Δ hyB₁ + exact ⟨hfx_X, hfx_Δ⟩ + have hfin_rhs : ((ι '' ((↑) ⁻¹' X)) ∩ Δ_hat).Finite := by + refine (H₁.finite_V.subset ?_) + rintro y ⟨hyX, _⟩ + rw [hCap.2] + exact image_mono (preimage_mono (hX.trans inter_subset_left)) hyX + have heq_card : (f '' (P.V ∩ X)).ncard = (P.V ∩ X).ncard := + (hf_inj.mono (inter_subset_right.trans + (hX.trans (inter_subset_right.trans inter_subset_left)))).ncard_image + calc (P.V ∩ X).ncard = (f '' (P.V ∩ X)).ncard := heq_card.symm + _ ≤ ((ι '' ((↑) ⁻¹' X)) ∩ Δ_hat).ncard := Set.ncard_le_ncard hsub hfin_rhs + _ ≤ (F_hat ∩ H₁.V).ncard := hX_hat + _ ≤ 2 := hF_hat_card + +private theorem first_disc_contains_drawing_boundary + {S : Type w} + [TopologicalSpace S] + {S_hat : Type w} + [TopologicalSpace S_hat] + (P₁ : Set S) + (ι : ↑P₁ → S_hat) + (H : Drawing S) + (H₁ : Drawing S_hat) + (f : S → S_hat) + (g : S_hat → S) + (hfg_inv : LeftInvOn g f P₁) + (hgf_inv : LeftInvOn f g (range ι)) + (hH₁_U : H₁.U = f '' (H.U ∩ P₁)) + (B₁ : Set S_hat) + (Δ_hat₁ : Set S_hat) + (hΔ_hat₁_U : Δ_hat₁ ∩ H₁.U = B₁) + (hΔ_hat₁_range : Δ_hat₁ ⊆ range ι) + (hΔ₁_P₁ : g '' Δ_hat₁ ⊆ P₁) + (P : Drawing S) + (hP_U : P.U = g '' B₁) : + (g '' Δ_hat₁) ∩ H.U = P.U := by + rw [hP_U] + have h1 : (g '' Δ_hat₁) ∩ H.U = g '' (Δ_hat₁ ∩ H₁.U) := by + rw [hH₁_U] + ext x + constructor + · rintro ⟨⟨y, hyΔ, rfl⟩, hxU⟩ + exact ⟨y, ⟨hyΔ, g y, ⟨hxU, hΔ₁_P₁ (mem_image_of_mem g hyΔ)⟩, + hgf_inv (hΔ_hat₁_range hyΔ)⟩, rfl⟩ + · rintro ⟨y, ⟨hyΔ, x, ⟨hxU, hxP₁⟩, rfl⟩, rfl⟩ + rw [hfg_inv hxP₁] + exact ⟨⟨f x, hyΔ, hfg_inv hxP₁⟩, hxU⟩ + rw [h1, hΔ_hat₁_U] + +private theorem final_disc_intersection + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (H : Drawing S) + (F : Set S) + (hFU : F ∩ H.U ⊆ H.V) + (Δ₁ : Set S) + (L : Set S) + (P : Drawing S) + (hP_V : P.V = H.V ∩ L) + (hP_U : P.U = L) + (Δ₂ : Set S) + (hΔ_disc : IsClosedDisc (Δ₁ ∪ Δ₂)) + (hΔ_bd : subBd (Δ₁ ∪ Δ₂) = F) + (hΔ_U : (Δ₁ ∪ Δ₂) ∩ H.U = P.U) : + H.interSet (Δ₁ ∪ Δ₂) = P := by + apply GM14.Drawing.ext_UV + · rw [(GM14.interSet_V_and_U hΔ_disc.isClosed (hΔ_bd ▸ hFU)).2, Set.inter_comm, hΔ_U] + · rw [interSet_V_of_isClosed H hΔ_disc.isClosed, hP_V] + ext x + constructor + · rintro ⟨hxV, hxΔ⟩ + exact ⟨hxV, hP_U ▸ hΔ_U ▸ ⟨hxΔ, H.V_subset_U hxV⟩⟩ + · rintro ⟨hxV, hxL⟩ + exact ⟨hxV, (hΔ_U ▸ hP_U.symm ▸ hxL).1⟩ + +private theorem second_disc_contains_drawing_boundary + {S : Type*} {U P F R : Set S} {u v : S} + (hRU : Disjoint R U) (hPU : P ⊆ U) (hFU : F ∩ U = {u, v}) + (hPF : P ∩ F = {u, v}) : + (R ∪ (P ∪ F)) ∩ U = P := by + refine Subset.antisymm ?_ (fun x hx => ⟨Or.inr (Or.inl hx), hPU hx⟩) + rintro x ⟨hxR | hxP | hxF, hxU⟩ + · exact (disjoint_left.mp hRU hxR hxU).elim + · exact hxP + · have hx : x ∈ P ∩ F := (hFU.trans hPF.symm) ▸ (show x ∈ F ∩ U from ⟨hxF, hxU⟩) + exact hx.1 + +private theorem joined_discs_have_original_boundary + {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {Δ₁ Δ₂ F₁ F₂ P : Set S} {u v : S} + (hΔ₁ : IsClosedDisc Δ₁) (hΔ₂ : IsClosedDisc Δ₂) (hΔ : IsClosedDisc (Δ₁ ∪ Δ₂)) + (hΔ_bd : discBd (Δ₁ ∪ Δ₂) = (discBd Δ₁ ∪ discBd Δ₂) \ (P \ {u, v})) + (hΔ₁_bd : subBd Δ₁ = F₁ ∪ P) (hΔ₂_bd : subBd Δ₂ = P ∪ F₂) + (hF₁P : F₁ ∩ P = {u, v}) (hPF₂ : P ∩ F₂ = {u, v}) : + subBd (Δ₁ ∪ Δ₂) = F₁ ∪ F₂ := by + rw [IsClosedDisc.subBd_eq_discBd hS hΔ, hΔ_bd, + ← IsClosedDisc.subBd_eq_discBd hS hΔ₁, ← IsClosedDisc.subBd_eq_discBd hS hΔ₂, + hΔ₁_bd, hΔ₂_bd] + have hlo : ({u, v} : Set S) ⊆ F₁ := hF₁P ▸ inter_subset_left + refine Subset.antisymm ?_ ?_ + · rintro x ⟨(hxF₁ | hxP) | (hxP | hxF₂), hx_not⟩ + · exact Or.inl hxF₁ + · exact Or.inl (hlo (by_contra fun hx => hx_not ⟨hxP, hx⟩)) + · exact Or.inl (hlo (by_contra fun hx => hx_not ⟨hxP, hx⟩)) + · exact Or.inr hxF₂ + · rintro x (hxF₁ | hxF₂) + · exact ⟨Or.inl (Or.inl hxF₁), fun ⟨hxP, hxuv⟩ => hxuv (hF₁P ▸ ⟨hxF₁, hxP⟩)⟩ + · exact ⟨Or.inr (Or.inr hxF₂), fun ⟨hxP, hxuv⟩ => hxuv (hPF₂ ▸ ⟨hxP, hxF₂⟩)⟩ + +private theorem fitting_first_side_disc + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {S_hat : Type w} + [TopologicalSpace S_hat] + [T2Space S_hat] + {t : ℕ} + (P₁ : Set S) + (ι : ↑P₁ → S_hat) + (D : Fin t → Set S_hat) + (H : Drawing S) + (H₁ : Drawing S_hat) + (X : Set S) + (hCond2 : ∀ (F : Set S_hat), IsOArc F → F ∩ H₁.U ⊆ H₁.V → (F ∩ H₁.V).ncard ≤ 2 → ∃ Δ, IsDial + H₁ F Δ ∧ (ι '' Subtype.val ⁻¹' X ∩ Δ).ncard ≤ (F ∩ H₁.V).ncard) + (F : Set S) + (hF : IsOArc F) + (hFU : F ∩ H.U ⊆ H.V) + (hFV : (F ∩ H.V).ncard ≤ 2) + (hRange_comp : IsCompact (range ι)) + (f : S → S_hat) + (g : S_hat → S) + (hf_cont : ContinuousOn f P₁) + (hg_cont : ContinuousOn g (range ι)) + (hfg_inv : LeftInvOn g f P₁) + (hgf_inv : LeftInvOn f g (range ι)) + (hf_maps : MapsTo f P₁ (range ι)) + (hg_maps : MapsTo g (range ι) P₁) + (hf_inj : InjOn f P₁) + (hg_inj : InjOn g (range ι)) + (hH₁_U : H₁.U = f '' (H.U ∩ P₁)) + (hH₁_V : H₁.V = f '' (H.V ∩ P₁)) + (hH₁_U_sub : H₁.U ⊆ range ι) + (hH₁_V_sub : H₁.V ⊆ range ι) + (hDi_bd_oArc : ∀ (i : Fin t), IsOArc (subBd (D i))) + (hDisc_sub_range : ∀ {Δ_hat : Set S_hat}, IsClosedDisc Δ_hat → subBd Δ_hat ⊆ range ι → (∀ (i : + Fin t), ¬subBd (D i) ⊆ Δ_hat ∩ H₁.U) → Δ_hat ⊆ range ι) + (hPullback_disc : ∀ {Δ_hat : Set S_hat}, IsClosedDisc Δ_hat → Δ_hat ⊆ range ι → IsClosedDisc + (g '' Δ_hat) ∧ subBd (g '' Δ_hat) = g '' subBd Δ_hat ∧ g '' Δ_hat ⊆ P₁) + (hF₁ : F ⊆ P₁) : + ∃ Δ, IsDial H F Δ := by + let F_hat : Set S_hat := f '' F + have hF_hat_range : F_hat ⊆ range ι := (hf_maps.mono hF₁ Subset.rfl).image_subset + have hF_hat_oArc : IsOArc F_hat := + hF.image (hf_cont.mono hF₁) (hg_cont.mono hF_hat_range) (hfg_inv.mono hF₁) + have hF_hat_U : F_hat ∩ H₁.U = f '' (F ∩ H.U) := by + rw [hH₁_U, ← hf_inj.image_inter hF₁ inter_subset_right] + congr 1; ext x; exact ⟨fun ⟨hxF, hxU, _⟩ => ⟨hxF, hxU⟩, fun ⟨hxF, hxU⟩ => ⟨hxF, hxU, hF₁ hxF⟩⟩ + have hF_hat_V : F_hat ∩ H₁.V = f '' (F ∩ H.V) := by + rw [hH₁_V, ← hf_inj.image_inter hF₁ inter_subset_right] + congr 1; ext x; exact ⟨fun ⟨hxF, hxV, _⟩ => ⟨hxF, hxV⟩, fun ⟨hxF, hxV⟩ => ⟨hxF, hxV, hF₁ hxF⟩⟩ + have hF_hat_UV : F_hat ∩ H₁.U ⊆ H₁.V := by + rw [hF_hat_U, hH₁_V] + exact image_mono fun x hx => ⟨hFU hx, hF₁ hx.1⟩ + have hF_hat_card : (F_hat ∩ H₁.V).ncard ≤ 2 := by + rw [hF_hat_V] + exact (Set.ncard_image_le (H.finite_V.subset inter_subset_right)).trans hFV + obtain ⟨Δ_hat, hDial_hat, _⟩ := hCond2 F_hat hF_hat_oArc hF_hat_UV hF_hat_card + have hΔ_hat_inter_U : (H₁.interSet Δ_hat).U = H₁.U ∩ Δ_hat := + (GM14.interSet_V_and_U hDial_hat.1.isClosed (hDial_hat.2.1 ▸ hF_hat_UV)).2 + have hΔ_hat_range : Δ_hat ⊆ range ι := by + refine hDisc_sub_range hDial_hat.1 (hDial_hat.2.1.symm ▸ hF_hat_range) fun i hsub => ?_ + rcases hDial_hat.2.2 with hsubF | ⟨u', v', hu'v', _, hPath⟩ + · have hfin : (subBd (D i)).Finite := + H₁.finite_V.subset (hsub.trans (fun z hz => hF_hat_UV ⟨hsubF hz, hz.2⟩)) + exact GM11.infinite_of_isOArc (hDi_bd_oArc i) hfin + · have hLine : IsLineWithEnds (H₁.interSet Δ_hat).U u' v' := + GM14.isLine_of_isPathBetween hPath hu'v' + have hsub' : subBd (D i) ⊆ (H₁.interSet Δ_hat).U := by + rw [hΔ_hat_inter_U, Set.inter_comm] + exact hsub + exact not_isOArc_subset_isLineWithEnds (hDi_bd_oArc i) hLine hsub' + obtain ⟨hΔ_disc, hΔ_bd, hΔ_P₁⟩ := hPullback_disc hDial_hat.1 hΔ_hat_range + let Δ : Set S := g '' Δ_hat + have hΔ_bd_eq : subBd Δ = F := by + rw [hΔ_bd, hDial_hat.2.1] + exact (hfg_inv.mono hF₁).image_image + have hΔ_inter_U : (H.interSet Δ).U = H.U ∩ Δ := + (GM14.interSet_V_and_U hΔ_disc.isClosed (hΔ_bd_eq ▸ hFU)).2 + have hΔ_U : (H.interSet Δ).U = g '' (H₁.interSet Δ_hat).U := by + rw [hΔ_inter_U, hΔ_hat_inter_U, hH₁_U] + have h1 : f '' (H.U ∩ P₁) ∩ Δ_hat = f '' (H.U ∩ Δ) := by + ext y + constructor + · rintro ⟨⟨x, ⟨hxU, hxP₁⟩, rfl⟩, hyΔ⟩ + exact ⟨x, ⟨hxU, f x, hyΔ, hfg_inv hxP₁⟩, rfl⟩ + · rintro ⟨_, ⟨hxU, z, hzΔ, rfl⟩, rfl⟩ + exact ⟨⟨g z, ⟨hxU, hΔ_P₁ (mem_image_of_mem g hzΔ)⟩, rfl⟩, + (hgf_inv (hΔ_hat_range hzΔ)).symm ▸ hzΔ⟩ + rw [h1] + exact (hfg_inv.mono (inter_subset_right.trans hΔ_P₁)).image_image.symm + have hΔ_V : (H.interSet Δ).V = g '' (H₁.interSet Δ_hat).V := by + rw [interSet_V_of_isClosed H hΔ_disc.isClosed, + interSet_V_of_isClosed H₁ hDial_hat.1.isClosed, hH₁_V] + have h1 : f '' (H.V ∩ P₁) ∩ Δ_hat = f '' (H.V ∩ Δ) := by + ext y + constructor + · rintro ⟨⟨x, ⟨hxV, hxP₁⟩, rfl⟩, hyΔ⟩ + exact ⟨x, ⟨hxV, f x, hyΔ, hfg_inv hxP₁⟩, rfl⟩ + · rintro ⟨_, ⟨hxV, z, hzΔ, rfl⟩, rfl⟩ + exact ⟨⟨g z, ⟨hxV, hΔ_P₁ (mem_image_of_mem g hzΔ)⟩, rfl⟩, + (hgf_inv (hΔ_hat_range hzΔ)).symm ▸ hzΔ⟩ + rw [h1] + exact (hfg_inv.mono (inter_subset_right.trans hΔ_P₁)).image_image.symm + refine ⟨Δ, hΔ_disc, hΔ_bd_eq, ?_⟩ + rcases hDial_hat.2.2 with hsubF | ⟨u', v', hu'v', hFV_hat, hPath⟩ + · left + have h1 : (H.interSet Δ).U ⊆ g '' F_hat := by + rw [hΔ_U, hΔ_hat_inter_U, Set.inter_comm] + exact image_mono hsubF + rw [hΔ_inter_U, Set.inter_comm, (hfg_inv.mono hF₁).image_image] at h1 + exact h1 + · right + have hu'_range : u' ∈ range ι := by + have hu'V : u' ∈ F_hat ∩ H₁.V := hFV_hat ▸ Or.inl rfl + exact hH₁_V_sub hu'V.2 + have hv'_range : v' ∈ range ι := by + have hv'V : v' ∈ F_hat ∩ H₁.V := hFV_hat ▸ Or.inr rfl + exact hH₁_V_sub hv'V.2 + have hguv : g u' ≠ g v' := fun h => hu'v' (hg_inj hu'_range hv'_range h) + have hFV_eq : F ∩ H.V = {g u', g v'} := by + have h1 : g '' (F_hat ∩ H₁.V) = F ∩ H.V := by + rw [hF_hat_V] + exact (hfg_inv.mono (inter_subset_left.trans hF₁)).image_image + rw [← h1, hFV_hat] + simp [image_insert_eq] + have hQ_sub : (H₁.interSet Δ_hat).U ⊆ range ι := by + rw [hΔ_hat_inter_U] + exact inter_subset_left.trans hH₁_U_sub + have hPath_S : (H.interSet Δ).IsPathBetween (g u') (g v') := + isPathBetween_of_image hRange_comp hg_cont + (hf_cont.mono (hg_maps.image_subset)) + hgf_inv hQ_sub hΔ_U hΔ_V hPath + exact ⟨g u', g v', hguv, hFV_eq, hPath_S⟩ + +private theorem crossing_boundary_has_two_interface_points + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {S_hat : Type w} + [TopologicalSpace S_hat] + {t : ℕ} + (C : Fin t → Set S) + (P₁ : Set S) + (P₂ : Set S) + (ι : ↑P₁ → S_hat) + (D : Fin t → Set S_hat) + (H : Drawing S) + (hSplit : GM12.IsCappedSplit C P₁ P₂ ι D) + (hInterU : P₁ ∩ P₂ ⊆ H.U) + (F : Set S) + (hF : IsOArc F) + (hFU : F ∩ H.U ⊆ H.V) + (hFV : (F ∩ H.V).ncard ≤ 2) + (hP₁_cl : IsClosed P₁) + (x₁ : S) + (hx₁F : x₁ ∈ F) + (hx₁_not_P₂ : x₁ ∉ P₂) + (hx₁P₁ : x₁ ∈ P₁) + (hF₁ : ¬F ⊆ P₁) + (hfrP₁ : frontier P₁ ⊆ P₁ ∩ P₂) : + ∃ u v, u ≠ v ∧ u ∈ F ∧ v ∈ F ∧ u ∈ H.V ∧ v ∈ H.V ∧ u ∈ P₁ ∩ P₂ ∧ v ∈ P₁ ∩ P₂ ∧ F ∩ H.V = {u, + v} ∧ F ∩ H.U = {u, v} ∧ F ∩ (P₁ ∩ P₂) = {u, v} := by + obtain ⟨x₂, hx₂F, hx₂_not_P₁⟩ := not_subset.mp hF₁ + have hx₂P₂ : x₂ ∈ P₂ := (eq_univ_iff_forall.mp hSplit.union x₂).resolve_left hx₂_not_P₁ + have hx₁₂ : x₁ ≠ x₂ := fun h => hx₂_not_P₁ (h ▸ hx₁P₁) + obtain ⟨A₁, A₂, hA₁, hA₂, hA_union, hA_inter⟩ := hF.lines hx₁F hx₂F hx₁₂ + have hA_meets : ∀ {A : Set S}, IsLineWithEnds A x₁ x₂ → + ∃ w ∈ A ∩ (P₁ ∩ P₂), w ∉ ({x₁, x₂} : Set S) := by + exact boundary_arcs_meet_first_disc hP₁_cl hx₁P₁ hx₂_not_P₁ hx₁_not_P₂ hfrP₁ + obtain ⟨u, ⟨huA₁, hu12⟩, hu_not_x⟩ := hA_meets hA₁ + obtain ⟨v, ⟨hvA₂, hv12⟩, hv_not_x⟩ := hA_meets hA₂ + have huv : u ≠ v := fun h => hu_not_x (hA_inter ▸ ⟨huA₁, h ▸ hvA₂⟩) + have huF : u ∈ F := hA_union ▸ Or.inl huA₁ + have hvF : v ∈ F := hA_union ▸ Or.inr hvA₂ + have huV : u ∈ H.V := hFU ⟨huF, hInterU hu12⟩ + have hvV : v ∈ H.V := hFU ⟨hvF, hInterU hv12⟩ + have huv_sub_F12 : ({u, v} : Set S) ⊆ F ∩ (P₁ ∩ P₂) := by + rintro z (rfl | rfl) + · exact ⟨huF, hu12⟩ + · exact ⟨hvF, hv12⟩ + have hF12_sub_FV : F ∩ (P₁ ∩ P₂) ⊆ F ∩ H.V := + fun z hz => ⟨hz.1, hFU ⟨hz.1, hInterU hz.2⟩⟩ + have hFV_sub_FU : F ∩ H.V ⊆ F ∩ H.U := + inter_subset_inter_right _ H.V_subset_U + have hFU_sub_FV : F ∩ H.U ⊆ F ∩ H.V := + fun z hz => ⟨hz.1, hFU hz⟩ + have hFV_eq : F ∩ H.V = {u, v} := by + refine (Set.eq_of_subset_of_ncard_le (huv_sub_F12.trans hF12_sub_FV) ?_ + (H.finite_V.subset inter_subset_right)).symm + rw [Set.ncard_pair huv] + exact hFV + have hFU_eq : F ∩ H.U = {u, v} := + Subset.antisymm (hFU_sub_FV.trans hFV_eq.subset) (hFV_eq ▸ hFV_sub_FU) + have hF12_eq : F ∩ (P₁ ∩ P₂) = {u, v} := + Subset.antisymm (hF12_sub_FV.trans hFV_eq.subset) huv_sub_F12 + exact ⟨u, v, huv, huF, hvF, huV, hvV, hu12, hv12, hFV_eq, hFU_eq, hF12_eq⟩ + +private theorem capped_disc_contains_spanning_boundary_path + {S : Type w} + [TopologicalSpace S] + {S_hat : Type w} + [TopologicalSpace S_hat] + [T2Space S_hat] + {t : ℕ} + (C : Fin t → Set S) + (P₁ : Set S) + (P₂ : Set S) + (ι : ↑P₁ → S_hat) + (D : Fin t → Set S_hat) + (H₁ : Drawing S_hat) + (hSplit : GM12.IsCappedSplit C P₁ P₂ ι D) + (hS_hat : IsClosedSurface S_hat) + (hDi_bd_U : ∀ (i : Fin t), subBd (D i) ⊆ H₁.U) + (hDi_bd_oArc : ∀ (i : Fin t), IsOArc (subBd (D i))) + (hDi_disj_range : ∀ (i : Fin t), Disjoint (D i) (range ι)) + (i : Fin t) + (u' : S_hat) + (v' : S_hat) + (F₁' : Set S_hat) + (hu'_bd : u' ∈ subBd (D i)) + (hv'_bd : v' ∈ subBd (D i)) + (hu'v' : u' ≠ v') + (hF₁'_range : F₁' ⊆ range ι) + (hF₁'_line : IsLineWithEnds F₁' u' v') + (hF₁'_U : F₁' ∩ H₁.U = {u', v'}) + (L_D : Set S_hat) + (hL_D_line : IsLineWithEnds L_D u' v') + (hL_D_sub : L_D \ {u', v'} ⊆ D i) + (hu'F₁' : u' ∈ F₁') + (hv'F₁' : v' ∈ F₁') + (hF_hat_U : (F₁' ∪ L_D) ∩ H₁.U = {u', v'}) + (hF_hat_V : (F₁' ∪ L_D) ∩ H₁.V = {u', v'}) + (Δ_hat : Set S_hat) + (hDial_hat : IsDial H₁ (F₁' ∪ L_D) Δ_hat) + (hΔ_hat_disc : IsClosedDisc Δ_hat) + (hΔ_hat_bd : subBd Δ_hat = F₁' ∪ L_D) + (hΔ_hat_inter_U : (H₁.interSet Δ_hat).U = H₁.U ∩ Δ_hat) + (hF_hat_sub_Δ : (F₁' ∪ L_D) ⊆ Δ_hat) : + ∃ B₁, IsLineWithEnds B₁ u' v' ∧ B₁ ⊆ subBd (D i) ∧ B₁ ⊆ Δ_hat ∧ (H₁.interSet + Δ_hat).IsPathBetween u' v' ∧ (H₁.interSet Δ_hat).U = B₁ := by + let F_hat := F₁' ∪ L_D + let U_hat : Set S_hat := Δ_hat \ frontier Δ_hat + have hU_hat_eq : U_hat = Δ_hat \ F_hat := by + change Δ_hat \ frontier Δ_hat = Δ_hat \ F_hat + rw [← subBd_eq_frontier, hΔ_hat_bd] + have hU_hat_conn : IsPreconnected U_hat := + GM11.IsClosedDisc.isPreconnected_diff_frontier hS_hat hΔ_hat_disc + have hΔ_hat_sub_cl : Δ_hat ⊆ closure U_hat := + GM11.IsClosedDisc.subset_closure_diff_frontier hS_hat hΔ_hat_disc + obtain ⟨y₁, hy₁⟩ := (GM11.isPathConnected_sdiff_pair hL_D_line).nonempty + have hy₁_Di : y₁ ∈ D i := hL_D_sub hy₁ + have hy₁_cl : y₁ ∈ closure U_hat := + hΔ_hat_sub_cl (hF_hat_sub_Δ (Or.inr hy₁.1)) + obtain ⟨z₁, hz₁_Di, hz₁_U⟩ := mem_closure_iff.mp hy₁_cl (D i) (hSplit.isOpenDisc i).1 hy₁_Di + obtain ⟨y₂, hy₂⟩ := (GM11.isPathConnected_sdiff_pair hF₁'_line).nonempty + obtain ⟨_, hcl_Di⟩ := isOpen_disjoint_subBd_and_closure_eq (hSplit.isOpenDisc i).1 + have hy₂_not_cl : y₂ ∈ (closure (D i))ᶜ := by + rw [hcl_Di] + rintro (hy₂_Di | hy₂_bd) + · exact disjoint_left.mp (hDi_disj_range i) hy₂_Di (hF₁'_range hy₂.1) + · exact hy₂.2 (hF₁'_U ▸ ⟨hy₂.1, hDi_bd_U i hy₂_bd⟩) + have hy₂_cl : y₂ ∈ closure U_hat := + hΔ_hat_sub_cl (hF_hat_sub_Δ (Or.inl hy₂.1)) + obtain ⟨z₂, hz₂_not_cl, hz₂_U⟩ := + mem_closure_iff.mp hy₂_cl (closure (D i))ᶜ isClosed_closure.isOpen_compl hy₂_not_cl + have hU_hat_meets_bd : (U_hat ∩ subBd (D i)).Nonempty := by + by_contra h + have hdis_bd : Disjoint U_hat (subBd (D i)) := + disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp h) + have hdis_fr : Disjoint U_hat (frontier (closure (D i))) := + hdis_bd.mono_right (subBd_eq_frontier (D i) ▸ frontier_closure_subset) + exact hz₂_not_cl (GM14.subset_of_disjoint_frontier hU_hat_conn isClosed_closure + hdis_fr hz₁_U (subset_closure hz₁_Di) hz₂_U) + obtain ⟨z₀, hz₀_U, hz₀_bd⟩ := hU_hat_meets_bd + have hz₀_Δ : z₀ ∈ Δ_hat := (hU_hat_eq ▸ hz₀_U).1 + have hz₀_not_F : z₀ ∉ F_hat := (hU_hat_eq ▸ hz₀_U).2 + obtain ⟨B₁_0, B₂_0, hB₁_0, hB₂_0, hB_union, hB_inter⟩ := + (hDi_bd_oArc i).lines hu'_bd hv'_bd hu'v' + have hB₁_exists : ∃ B₁ : Set S_hat, + IsLineWithEnds B₁ u' v' ∧ B₁ ⊆ subBd (D i) ∧ z₀ ∈ B₁ := by + rcases hB_union ▸ hz₀_bd with hz₀1 | hz₀2 + · exact ⟨B₁_0, hB₁_0, hB_union ▸ subset_union_left, hz₀1⟩ + · exact ⟨B₂_0, hB₂_0, hB_union ▸ subset_union_right, hz₀2⟩ + obtain ⟨B₁, hB₁_line, hB₁_bd, hz₀_B₁⟩ := hB₁_exists + obtain ⟨hu'B₁, hv'B₁⟩ := ends_mem_of_isLineWithEnds hB₁_line + have hz₀_not_uv : z₀ ∉ ({u', v'} : Set S_hat) := by + rintro (rfl | rfl) + · exact hz₀_not_F (Or.inl hu'F₁') + · exact hz₀_not_F (Or.inl hv'F₁') + have hB₁_U : B₁ ⊆ H₁.U := hB₁_bd.trans (hDi_bd_U i) + have hB₁_sub_Δ : B₁ ⊆ Δ_hat := by + exact boundary_arc_mem_disc (S_hat := S_hat) H₁ u' v' F_hat hF_hat_U + Δ_hat hΔ_hat_disc hΔ_hat_bd (hF_hat_sub_Δ (Or.inl hu'F₁')) + (hF_hat_sub_Δ (Or.inl hv'F₁')) z₀ hz₀_Δ B₁ hB₁_line hz₀_B₁ hz₀_not_uv hB₁_U + have hPath_hat : (H₁.interSet Δ_hat).IsPathBetween u' v' := by + exact capped_path_avoids_cap (S_hat := S_hat) H₁ u' v' hu'v' F_hat hF_hat_V Δ_hat hDial_hat z₀ + hz₀_Δ hz₀_not_F B₁ hz₀_B₁ hB₁_U + have hΔ_hat_U_eq : (H₁.interSet Δ_hat).U = B₁ := by + have hLine : IsLineWithEnds (H₁.interSet Δ_hat).U u' v' := + GM14.isLine_of_isPathBetween hPath_hat hu'v' + have hsub : B₁ ⊆ (H₁.interSet Δ_hat).U := by + rw [hΔ_hat_inter_U] + exact subset_inter hB₁_U hB₁_sub_Δ + exact (eq_of_isLineWithEnds_subset hB₁_line hLine hsub).symm + -- Cut out `Δ_hat₁ ⊆ Δ_hat` bounded by `F₁' ∪ B₁`. + exact ⟨B₁, hB₁_line, hB₁_bd, hB₁_sub_Δ, hPath_hat, hΔ_hat_U_eq⟩ + +private theorem glue_discs_across_boundary_path + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {S_hat : Type w} + [TopologicalSpace S_hat] + (P₁ : Set S) + (P₂ : Set S) + (ι : ↑P₁ → S_hat) + (H : Drawing S) + (H₁ : Drawing S_hat) + (X : Set S) + (hInterU : P₁ ∩ P₂ ⊆ H.U) + (hCond4 : ∀ (F : Set S) (u v : S) (P : Drawing S), F ⊆ P₂ → u ∈ P₁ ∩ P₂ ∩ H.V → v ∈ P₁ ∩ P₂ ∩ + H.V → IsLineWithEnds F u v → F ∩ H.U ⊆ {u, v} → P.IsSubdrawing (H.interSet (P₁ ∩ P₂)) → + P.IsPathBetween u v → (P.V ∩ X).ncard ≤ 2 → ∃ U₀, IsOpenDisc U₀ ∧ IsClosedDisc (closure U₀) + ∧ U₀ ⊆ P₂ ∧ subBd U₀ = P.U ∪ F ∧ Disjoint U₀ H.U) + (F : Set S) + (hFU : F ∩ H.U ⊆ H.V) + (hS : IsClosedSurface S) + (hP₂_cl : IsClosed P₂) + (f : S → S_hat) + (g : S_hat → S) + (hfg_inv : LeftInvOn g f P₁) + (hgf_inv : LeftInvOn f g (range ι)) + (hH₁_U : H₁.U = f '' (H.U ∩ P₁)) + (u : S) + (v : S) + (huv : u ≠ v) + (huV : u ∈ H.V) + (hvV : v ∈ H.V) + (hu12 : u ∈ P₁ ∩ P₂) + (hv12 : v ∈ P₁ ∩ P₂) + (hFV_eq : F ∩ H.V = {u, v}) + (F₁ : Set S) + (F₂ : Set S) + (hF₂_line : IsLineWithEnds F₂ u v) + (hF_union : F₁ ∪ F₂ = F) + (hF₁_P₁ : F₁ ⊆ P₁) + (hF₂_P₂ : F₂ ⊆ P₂) + (huF₁ : u ∈ F₁) + (hvF₁ : v ∈ F₁) + (huF₂ : u ∈ F₂) + (hvF₂ : v ∈ F₂) + (hF₁_U : F₁ ∩ H.U = {u, v}) + (hF₂_U : F₂ ∩ H.U = {u, v}) + (u' : S_hat) + (v' : S_hat) + (B₁ : Set S_hat) + (hu'B₁ : u' ∈ B₁) + (hv'B₁ : v' ∈ B₁) + (Δ_hat₁ : Set S_hat) + (hΔ_hat₁_bd : subBd Δ_hat₁ = (f '' F₁) ∪ B₁) + (hΔ_hat₁_U : Δ_hat₁ ∩ H₁.U = B₁) + (hΔ_hat₁_range : Δ_hat₁ ⊆ range ι) + (hΔ₁_disc : IsClosedDisc (g '' Δ_hat₁)) + (hΔ₁_bd_img : subBd (g '' Δ_hat₁) = g '' subBd Δ_hat₁) + (hΔ₁_P₁ : g '' Δ_hat₁ ⊆ P₁) + (P : Drawing S) + (hL_U : (g '' B₁) ⊆ H.U) + (hgu' : g u' = u) + (hgv' : g v' = v) + (hL_line : IsLineWithEnds (g '' B₁) u v) + (hP_V : P.V = H.V ∩ (g '' B₁)) + (hP_sub : P.IsSubdrawing (H.interSet (P₁ ∩ P₂))) + (hP_U : P.U = (g '' B₁)) + (hP_path : P.IsPathBetween u v) + (hPX_card : (P.V ∩ X).ncard ≤ 2) : + ∃ Δ, IsDial H F Δ := by + let Δ₁ := g '' Δ_hat₁ + let L := g '' B₁ + obtain ⟨U₀, hU₀_open, hU₀_cl_disc, hU₀_P₂, hU₀_bd, hU₀_disj⟩ := + hCond4 F₂ u v P hF₂_P₂ ⟨hu12, huV⟩ ⟨hv12, hvV⟩ hF₂_line hF₂_U.subset hP_sub hP_path hPX_card + let Δ₂ : Set S := closure U₀ + have hΔ₂_P₂ : Δ₂ ⊆ P₂ := hP₂_cl.closure_subset_iff.mpr hU₀_P₂ + have hP_F₂_inter : P.U ∩ F₂ = {u, v} := by + rw [hP_U] + refine Subset.antisymm ?_ ?_ + · intro z ⟨hzL, hzF₂⟩ + exact hF₂_U ▸ ⟨hzF₂, hL_U hzL⟩ + · rintro z (rfl | rfl) + · exact ⟨hgu' ▸ mem_image_of_mem g hu'B₁, huF₂⟩ + · exact ⟨hgv' ▸ mem_image_of_mem g hv'B₁, hvF₂⟩ + have hP_F₂_oArc : IsOArc (P.U ∪ F₂) := + Surface.oArc_of_lines (hP_U ▸ hL_line) hF₂_line hP_F₂_inter + have hΔ₂_bd : subBd Δ₂ = P.U ∪ F₂ := by + rw [GM14.subBd_closure_eq_subBd_of_isOpenDisc hS hU₀_open (hU₀_bd ▸ hP_F₂_oArc) hU₀_cl_disc, + hU₀_bd] + obtain ⟨_, hcl_U₀⟩ := isOpen_disjoint_subBd_and_closure_eq hU₀_open.1 + have hΔ₂_eq : Δ₂ = U₀ ∪ (P.U ∪ F₂) := hcl_U₀.trans (by rw [hU₀_bd]) + have hΔ₁_bd : subBd Δ₁ = F₁ ∪ P.U := by + rw [hΔ₁_bd_img, hΔ_hat₁_bd, image_union, (hfg_inv.mono hF₁_P₁).image_image, hP_U] + have hΔ₁_U : Δ₁ ∩ H.U = P.U := by + exact first_disc_contains_drawing_boundary (S := S) (S_hat := S_hat) P₁ ι H H₁ f g hfg_inv + hgf_inv hH₁_U B₁ Δ_hat₁ hΔ_hat₁_U hΔ_hat₁_range hΔ₁_P₁ P hP_U + have hΔ₂_U : Δ₂ ∩ H.U = P.U := by + rw [hΔ₂_eq] + exact second_disc_contains_drawing_boundary hU₀_disj (hP_U.symm ▸ hL_U) + hF₂_U hP_F₂_inter + have hΔ12_inter : Δ₁ ∩ Δ₂ = P.U := by + refine Subset.antisymm ?_ ?_ + · intro x ⟨hxΔ₁, hxΔ₂⟩ + have hxU : x ∈ H.U := hInterU ⟨hΔ₁_P₁ hxΔ₁, hΔ₂_P₂ hxΔ₂⟩ + exact hΔ₁_U ▸ ⟨hxΔ₁, hxU⟩ + · intro x hxPU + exact ⟨(hΔ₁_U ▸ hxPU).1, (hΔ₂_U ▸ hxPU).1⟩ + have hL_bd₁ : P.U ⊆ discBd Δ₁ := by + rw [← IsClosedDisc.subBd_eq_discBd hS hΔ₁_disc, hΔ₁_bd] + exact subset_union_right + have hL_bd₂ : P.U ⊆ discBd Δ₂ := by + rw [← IsClosedDisc.subBd_eq_discBd hS hU₀_cl_disc, hΔ₂_bd] + exact subset_union_left + obtain ⟨hΔ_disc, hΔ_discBd⟩ := + disc_union Δ₁ Δ₂ P.U u v hΔ₁_disc hU₀_cl_disc (hP_U ▸ hL_line) hΔ12_inter hL_bd₁ hL_bd₂ + have hF₁_P_inter : F₁ ∩ P.U = {u, v} := by + rw [hP_U] + refine Subset.antisymm ?_ ?_ + · intro z ⟨hzF₁, hzL⟩ + exact hF₁_U ▸ ⟨hzF₁, hL_U hzL⟩ + · rintro z (rfl | rfl) + · exact ⟨huF₁, hgu' ▸ mem_image_of_mem g hu'B₁⟩ + · exact ⟨hvF₁, hgv' ▸ mem_image_of_mem g hv'B₁⟩ + have hΔ_bd : subBd (Δ₁ ∪ Δ₂) = F := by + rw [← hF_union] + exact joined_discs_have_original_boundary hS hΔ₁_disc hU₀_cl_disc hΔ_disc hΔ_discBd hΔ₁_bd + hΔ₂_bd hF₁_P_inter hP_F₂_inter + have hΔ_U : (Δ₁ ∪ Δ₂) ∩ H.U = P.U := by + rw [union_inter_distrib_right, hΔ₁_U, hΔ₂_U, Set.union_self] + have hΔ_interSet : H.interSet (Δ₁ ∪ Δ₂) = P := by + exact final_disc_intersection (S := S) H F hFU Δ₁ L P hP_V hP_U Δ₂ hΔ_disc hΔ_bd hΔ_U + refine ⟨Δ₁ ∪ Δ₂, hΔ_disc, hΔ_bd, Or.inr ⟨u, v, huv, hFV_eq, ?_⟩⟩ + rwa [hΔ_interSet] + +private theorem cap_boundary_arc_closes_curve + {S : Type w} + [TopologicalSpace S] + {S_hat : Type w} + [TopologicalSpace S_hat] + [T2Space S_hat] + {t : ℕ} + (C : Fin t → Set S) + (P₁ : Set S) + (P₂ : Set S) + (ι : ↑P₁ → S_hat) + (D : Fin t → Set S_hat) + (H₁ : Drawing S_hat) + (hSplit : GM12.IsCappedSplit C P₁ P₂ ι D) + (hS_hat : IsClosedSurface S_hat) + (hDi_bd_U : ∀ (i : Fin t), subBd (D i) ⊆ H₁.U) + (hDi_bd_oArc : ∀ (i : Fin t), IsOArc (subBd (D i))) + (hDi_disj_range : ∀ (i : Fin t), Disjoint (D i) (range ι)) + (hDi_disj_U : ∀ (i : Fin t), Disjoint (D i) H₁.U) + (i : Fin t) + (u' : S_hat) + (v' : S_hat) + (F₁' : Set S_hat) + (hu'_bd : u' ∈ subBd (D i)) + (hv'_bd : v' ∈ subBd (D i)) + (hu'_V : u' ∈ H₁.V) + (hv'_V : v' ∈ H₁.V) + (hu'v' : u' ≠ v') + (hF₁'_range : F₁' ⊆ range ι) + (hF₁'_line : IsLineWithEnds F₁' u' v') + (hF₁'_U : F₁' ∩ H₁.U = {u', v'}) : + ∃ L_D, IsLineWithEnds L_D u' v' ∧ L_D \ {u', v'} ⊆ D i ∧ F₁' ∩ L_D = {u', v'} ∧ IsOArc (F₁' ∪ + L_D) ∧ L_D ∩ H₁.U = {u', v'} ∧ + (F₁' ∪ L_D) ∩ H₁.U = {u', v'} ∧ (F₁' ∪ L_D) ∩ H₁.V = {u', v'} := by + obtain ⟨L_D, hL_D_line, hL_D_sub⟩ := + exists_chord_in_cappingDisc hS_hat (hSplit.isOpenDisc i) (hDi_disj_U i) + (hDi_bd_oArc i) (hDi_bd_U i) ⟨hu'_bd, hu'_V⟩ ⟨hv'_bd, hv'_V⟩ hu'v' + obtain ⟨hu'F₁', hv'F₁'⟩ := ends_mem_of_isLineWithEnds hF₁'_line + obtain ⟨hu'L_D, hv'L_D⟩ := ends_mem_of_isLineWithEnds hL_D_line + have hF₁'_L_D_inter : F₁' ∩ L_D = {u', v'} := by + refine Subset.antisymm ?_ ?_ + · rintro y ⟨hyF₁', hyL_D⟩ + by_contra hy_not + exact disjoint_left.mp (hDi_disj_range i) (hL_D_sub ⟨hyL_D, hy_not⟩) (hF₁'_range hyF₁') + · rintro y (rfl | rfl) + · exact ⟨hu'F₁', hu'L_D⟩ + · exact ⟨hv'F₁', hv'L_D⟩ + let F_hat : Set S_hat := F₁' ∪ L_D + have hF_hat_oArc : IsOArc F_hat := Surface.oArc_of_lines hF₁'_line hL_D_line hF₁'_L_D_inter + have hL_D_U : L_D ∩ H₁.U = {u', v'} := by + refine Subset.antisymm ?_ ?_ + · rintro y ⟨hyL_D, hyU⟩ + by_contra hy_not + exact disjoint_left.mp (hDi_disj_U i) (hL_D_sub ⟨hyL_D, hy_not⟩) hyU + · rintro y (rfl | rfl) + · exact ⟨hu'L_D, H₁.V_subset_U hu'_V⟩ + · exact ⟨hv'L_D, H₁.V_subset_U hv'_V⟩ + have hF_hat_U : F_hat ∩ H₁.U = {u', v'} := by + rw [union_inter_distrib_right, hF₁'_U, hL_D_U, Set.union_self] + have hF_hat_V : F_hat ∩ H₁.V = {u', v'} := by + refine Subset.antisymm ?_ ?_ + · exact (inter_subset_inter_right _ H₁.V_subset_U).trans hF_hat_U.subset + · rintro y (rfl | rfl) + · exact ⟨Or.inl hu'F₁', hu'_V⟩ + · exact ⟨Or.inl hv'F₁', hv'_V⟩ + exact ⟨L_D, hL_D_line, hL_D_sub, hF₁'_L_D_inter, hF_hat_oArc, hL_D_U, hF_hat_U, hF_hat_V⟩ + +private theorem capped_boundary_path_spans_subdisc + {S : Type w} + {S_hat : Type w} + [TopologicalSpace S_hat] + [T2Space S_hat] + {t : ℕ} + (P₁ : Set S) + (ι : ↑P₁ → S_hat) + (D : Fin t → Set S_hat) + (H₁ : Drawing S_hat) + (hS_hat : IsClosedSurface S_hat) + (hDi_bd_oArc : ∀ (i : Fin t), IsOArc (subBd (D i))) + (hDisc_sub_range : ∀ {Δ_hat : Set S_hat}, IsClosedDisc Δ_hat → subBd Δ_hat ⊆ range ι → (∀ (i : + Fin t), ¬subBd (D i) ⊆ Δ_hat ∩ H₁.U) → Δ_hat ⊆ range ι) + (u' : S_hat) + (v' : S_hat) + (F₁' : Set S_hat) + (hF₁'_range : F₁' ⊆ range ι) + (hF₁'_line : IsLineWithEnds F₁' u' v') + (hF₁'_U : F₁' ∩ H₁.U = {u', v'}) + (hu'F₁' : u' ∈ F₁') + (hv'F₁' : v' ∈ F₁') + (Δ_hat : Set S_hat) + (hΔ_hat_disc : IsClosedDisc Δ_hat) + (hΔ_hat_inter_U : (H₁.interSet Δ_hat).U = H₁.U ∩ Δ_hat) + (hF₁'_sub_Δ : F₁' ⊆ Δ_hat) + (B₁ : Set S_hat) + (hB₁_line : IsLineWithEnds B₁ u' v') + (hB₁_sub_Δ : B₁ ⊆ Δ_hat) + (hΔ_hat_U_eq : (H₁.interSet Δ_hat).U = B₁) + (hu'B₁ : u' ∈ B₁) + (hv'B₁ : v' ∈ B₁) + (hB₁_U : B₁ ⊆ H₁.U) + (hB₁_range : B₁ ⊆ range ι) : + ∃ Δ_hat₁, F₁' ∩ B₁ = {u', v'} ∧ IsClosedDisc Δ_hat₁ ∧ subBd Δ_hat₁ = F₁' ∪ B₁ ∧ Δ_hat₁ ∩ H₁.U + = B₁ ∧ Δ_hat₁ ⊆ range ι := by + have hF₁'_B₁_inter : F₁' ∩ B₁ = {u', v'} := by + refine Subset.antisymm ?_ ?_ + · intro z ⟨hzF₁', hzB₁⟩ + exact hF₁'_U ▸ ⟨hzF₁', hB₁_U hzB₁⟩ + · rintro z (rfl | rfl) + · exact ⟨hu'F₁', hu'B₁⟩ + · exact ⟨hv'F₁', hv'B₁⟩ + have hF₁'_B₁_oArc : IsOArc (F₁' ∪ B₁) := + Surface.oArc_of_lines hF₁'_line hB₁_line hF₁'_B₁_inter + have hF₁'_B₁_sub_Δ : F₁' ∪ B₁ ⊆ Δ_hat := + union_subset hF₁'_sub_Δ hB₁_sub_Δ + obtain ⟨Δ_hat₁, ⟨hΔ_hat₁_sub, hΔ_hat₁_disc, hΔ_hat₁_discBd, -⟩, -⟩ := + disc_oArc Δ_hat (F₁' ∪ B₁) hΔ_hat_disc hF₁'_B₁_sub_Δ hF₁'_B₁_oArc + have hΔ_hat₁_bd : subBd Δ_hat₁ = F₁' ∪ B₁ := + (IsClosedDisc.subBd_eq_discBd hS_hat hΔ_hat₁_disc).trans hΔ_hat₁_discBd + have hΔ_hat₁_U : Δ_hat₁ ∩ H₁.U = B₁ := by + refine Subset.antisymm ?_ ?_ + · calc Δ_hat₁ ∩ H₁.U ⊆ Δ_hat ∩ H₁.U := inter_subset_inter_left _ hΔ_hat₁_sub + _ = (H₁.interSet Δ_hat).U := by rw [hΔ_hat_inter_U, Set.inter_comm] + _ = B₁ := hΔ_hat_U_eq + · refine subset_inter ?_ hB₁_U + intro z hz + have hbd_z : z ∈ subBd Δ_hat₁ := hΔ_hat₁_bd.symm ▸ Or.inr hz + exact hΔ_hat₁_disc.isClosed.closure_eq ▸ hbd_z.1 + have hΔ_hat₁_range : Δ_hat₁ ⊆ range ι := by + exact first_capped_disc_lies_in_range (S := S) (S_hat := S_hat) (t := t) P₁ ι D H₁ hDi_bd_oArc + hDisc_sub_range u' v' F₁' hF₁'_range B₁ hB₁_line hB₁_range Δ_hat₁ hΔ_hat₁_disc hΔ_hat₁_bd + hΔ_hat₁_U + -- Pull back `Δ₁ := g '' Δ_hat₁` and `P := H.interSet (g '' B₁)`. + exact ⟨Δ_hat₁, hF₁'_B₁_inter, hΔ_hat₁_disc, hΔ_hat₁_bd, hΔ_hat₁_U, hΔ_hat₁_range⟩ + +private theorem disc_in_capped_drawing_pulls_back + {S : Type w} + [TopologicalSpace S] + {S_hat : Type w} + [TopologicalSpace S_hat] + (P₁ : Set S) + (ι : ↑P₁ → S_hat) + (hS : IsClosedSurface S) + (hS_hat : IsClosedSurface S_hat) + (f : S → S_hat) + (g : S_hat → S) + (hf_cont : ContinuousOn f P₁) + (hg_cont : ContinuousOn g (range ι)) + (hgf_inv : LeftInvOn f g (range ι)) + (hg_maps : MapsTo g (range ι) P₁) : + ∀ {Δ_hat : Set S_hat}, IsClosedDisc Δ_hat → Δ_hat ⊆ range ι → IsClosedDisc (g '' Δ_hat) ∧ + subBd (g '' Δ_hat) = g '' subBd Δ_hat ∧ g '' Δ_hat ⊆ P₁ := by + exact pullback_of_capped_disc (S := S) (S_hat := S_hat) P₁ ι hS hS_hat f g hf_cont hg_cont + hgf_inv hg_maps + +private theorem boundary_path_pulls_back_with_bounded_cut + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {S_hat : Type w} + [TopologicalSpace S_hat] + [T2Space S_hat] + (P₁ : Set S) + (P₂ : Set S) + (ι : ↑P₁ → S_hat) + (H : Drawing S) + (H₁ : Drawing S_hat) + (X : Set S) + (hCap : GM12.IsCappedDrawing ι H H₁) + (hX : X ⊆ H.V ∩ (P₁ ∩ P₂)) + (hRange_comp : IsCompact (range ι)) + (p₀ : ↑P₁) + (g : S_hat → S) + (hf_cont : ContinuousOn (cappedFwd P₁ ι p₀) P₁) + (hg_cont : ContinuousOn g (range ι)) + (hfg_inv : LeftInvOn g (cappedFwd P₁ ι p₀) P₁) + (hgf_inv : LeftInvOn (cappedFwd P₁ ι p₀) g (range ι)) + (hg_maps : MapsTo g (range ι) P₁) + (hf_inj : InjOn (cappedFwd P₁ ι p₀) P₁) + (hg_inj : InjOn g (range ι)) + (hH₁_V : H₁.V = cappedFwd P₁ ι p₀ '' (H.V ∩ P₁)) + (u : S) + (v : S) + (u' : S_hat) + (v' : S_hat) + (F_hat : Set S_hat) + (hF_hat_card : (F_hat ∩ H₁.V).ncard ≤ 2) + (Δ_hat : Set S_hat) + (hX_hat : (ι '' Subtype.val ⁻¹' X ∩ Δ_hat).ncard ≤ (F_hat ∩ H₁.V).ncard) + (hΔ_hat_disc : IsClosedDisc Δ_hat) + (hΔ_hat_inter_U : (H₁.interSet Δ_hat).U = H₁.U ∩ Δ_hat) + (B₁ : Set S_hat) + (hB₁_line : IsLineWithEnds B₁ u' v') + (hB₁_sub_Δ : B₁ ⊆ Δ_hat) + (hPath_hat : (H₁.interSet Δ_hat).IsPathBetween u' v') + (hΔ_hat_U_eq : (H₁.interSet Δ_hat).U = B₁) + (hB₁_range : B₁ ⊆ range ι) + (hL_P₁ : (g '' B₁) ⊆ P₁) + (hL_U : (g '' B₁) ⊆ H.U) + (hgu' : g u' = u) + (hgv' : g v' = v) + (hL_cl : IsClosed (g '' B₁)) + (hB₁_cl : IsClosed B₁) + (hP_V : (H.interSet (g '' B₁)).V = H.V ∩ (g '' B₁)) : + (H.interSet (g '' B₁)).U = (g '' B₁) ∧ (H.interSet (g '' B₁)).IsPathBetween u v ∧ ((H.interSet + (g '' B₁)).V ∩ X).ncard ≤ 2 := by + let f := cappedFwd P₁ ι p₀ + let L := g '' B₁ + let P := H.interSet L + have hQ_hat_V : (H₁.interSet Δ_hat).V = H₁.V ∩ B₁ := by + rw [interSet_V_of_isClosed H₁ hΔ_hat_disc.isClosed] + have h1 : H₁.V ∩ Δ_hat = H₁.V ∩ (H₁.U ∩ Δ_hat) := by + ext y + exact ⟨fun ⟨hyV, hyΔ⟩ => ⟨hyV, H₁.V_subset_U hyV, hyΔ⟩, fun ⟨hyV, _, hyΔ⟩ => ⟨hyV, hyΔ⟩⟩ + rw [h1, ← hΔ_hat_inter_U, hΔ_hat_U_eq] + have hP_V_img : P.V = g '' (H₁.interSet Δ_hat).V := by + exact path_vertices_in_image (S := S) (S_hat := S_hat) P₁ ι H H₁ f g hfg_inv hgf_inv hH₁_V + Δ_hat B₁ hB₁_range P hL_P₁ hP_V hQ_hat_V + have hP_U : P.U = L := by + exact augmented_path_avoids_drawing_except_vertices (S := S) (S_hat := S_hat) P₁ ι H H₁ f g + hf_cont hg_cont hgf_inv hg_inj hH₁_V u' v' Δ_hat hΔ_hat_inter_U B₁ hB₁_line hB₁_range + hΔ_hat_U_eq L rfl hL_P₁ hL_U hL_cl hB₁_cl hP_V hQ_hat_V hP_V_img + have hP_path : P.IsPathBetween u v := by + rw [← hgu', ← hgv'] + exact isPathBetween_of_image hRange_comp hg_cont + (hf_cont.mono (hg_maps.image_subset)) + hgf_inv (hΔ_hat_U_eq ▸ hB₁_range) + (hP_U.trans (congr_arg (image g) hΔ_hat_U_eq.symm)) hP_V_img hPath_hat + have hPX_card : (P.V ∩ X).ncard ≤ 2 := by + exact path_cut_size_le (S := S) (S_hat := S_hat) P₁ P₂ ι H H₁ X hCap hX p₀ g hgf_inv hf_inj + F_hat hF_hat_card Δ_hat hX_hat B₁ hB₁_range hB₁_sub_Δ P hP_V + exact ⟨hP_U, hP_path, hPX_card⟩ + +private theorem arc_ends_lie_on_same_interface + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {S_hat : Type w} + [TopologicalSpace S_hat] + {t : ℕ} + (C : Fin t → Set S) + (P₁ : Set S) + (P₂ : Set S) + (ι : ↑P₁ → S_hat) + (D : Fin t → Set S_hat) + (H : Drawing S) + (hSplit : GM12.IsCappedSplit C P₁ P₂ ι D) + (hInterU : P₁ ∩ P₂ ⊆ H.U) + (hCond1 : ∀ r ∈ H.R, r ⊆ P₁ → ∀ (i j : Fin t), (closure r ∩ C i).Nonempty → (closure r ∩ C + j).Nonempty → i = j) + (hP₁_cl : IsClosed P₁) + (hfrP₁ : frontier P₁ ⊆ P₁ ∩ P₂) + (u : S) + (v : S) + (hu12 : u ∈ P₁ ∩ P₂) + (hv12 : v ∈ P₁ ∩ P₂) + (F₁ : Set S) + (hF₁_line : IsLineWithEnds F₁ u v) + (hF₁_P₁ : F₁ ⊆ P₁) + (huF₁ : u ∈ F₁) + (hvF₁ : v ∈ F₁) + (hF₁_U : F₁ ∩ H.U = {u, v}) : + ∃ i, u ∈ C i ∧ v ∈ C i := by + obtain ⟨w₁, hw₁⟩ := (GM11.isPathConnected_sdiff_pair hF₁_line).nonempty + have hw₁_not_U : w₁ ∉ H.U := fun h => hw₁.2 (hF₁_U ▸ ⟨hw₁.1, h⟩) + obtain ⟨r₁, hr₁, hw₁_r₁⟩ := GM11.exists_region_of_notMem hw₁_not_U + have hF₁_diff_U : Disjoint (F₁ \ {u, v}) H.U := + disjoint_left.mpr fun z hz hzU => hz.2 (hF₁_U ▸ ⟨hz.1, hzU⟩) + have hF₁_diff_r₁ : F₁ \ {u, v} ⊆ r₁ := + GM11.subset_region hr₁ (GM11.isPathConnected_sdiff_pair hF₁_line).isConnected.isPreconnected + hF₁_diff_U hw₁ hw₁_r₁ + have hF₁_cl_r₁ : F₁ ⊆ closure r₁ := + (GM11.closure_sdiff_pair hF₁_line).symm.subset.trans (closure_mono hF₁_diff_r₁) + have hr₁_P₁ : r₁ ⊆ P₁ := by + have hdis_r₁ : Disjoint r₁ (frontier P₁) := + disjoint_left.mpr fun z hzr₁ hzfr => GM11.region_subset hr₁ hzr₁ (hInterU (hfrP₁ hzfr)) + exact GM14.subset_of_disjoint_frontier (GM11.region_isPreconnected hr₁) hP₁_cl + hdis_r₁ hw₁_r₁ (hF₁_P₁ hw₁.1) + obtain ⟨i, hu_Ci⟩ := mem_iUnion.mp (hSplit.inter ▸ hu12) + obtain ⟨j, hv_Cj⟩ := mem_iUnion.mp (hSplit.inter ▸ hv12) + have hij : i = j := + hCond1 r₁ hr₁ hr₁_P₁ i j ⟨u, hF₁_cl_r₁ huF₁, hu_Ci⟩ ⟨v, hF₁_cl_r₁ hvF₁, hv_Cj⟩ + have hv_Ci : v ∈ C i := hij ▸ hv_Cj + exact ⟨i, hu_Ci, hv_Ci⟩ + +private theorem frontier_first_side_is_on_interface + {S : Type w} + [TopologicalSpace S] + {S_hat : Type w} + [TopologicalSpace S_hat] + {t : ℕ} + (C : Fin t → Set S) + (P₁ : Set S) + (P₂ : Set S) + (ι : ↑P₁ → S_hat) + (D : Fin t → Set S_hat) + (hSplit : GM12.IsCappedSplit C P₁ P₂ ι D) + (hP₁_cl : IsClosed P₁) + (hP₂_cl : IsClosed P₂) : + frontier P₁ ⊆ P₁ ∩ P₂ := by + rintro z ⟨hz₁, hz₂⟩ + refine ⟨hP₁_cl.closure_eq ▸ hz₁, by_contra fun hzP₂ => hz₂ ?_⟩ + exact interior_maximal (fun w hw => (eq_univ_iff_forall.mp hSplit.union w).resolve_right hw) + hP₂_cl.isOpen_compl hzP₂ + +private theorem frontier_second_side_is_on_interface + {S : Type w} + [TopologicalSpace S] + {S_hat : Type w} + [TopologicalSpace S_hat] + {t : ℕ} + (C : Fin t → Set S) + (P₁ : Set S) + (P₂ : Set S) + (ι : ↑P₁ → S_hat) + (D : Fin t → Set S_hat) + (hSplit : GM12.IsCappedSplit C P₁ P₂ ι D) + (hP₁_cl : IsClosed P₁) + (hP₂_cl : IsClosed P₂) : + frontier P₂ ⊆ P₁ ∩ P₂ := by + rintro z ⟨hz₁, hz₂⟩ + refine ⟨by_contra fun hzP₁ => hz₂ ?_, hP₂_cl.closure_eq ▸ hz₁⟩ + exact interior_maximal (fun w hw => (eq_univ_iff_forall.mp hSplit.union w).resolve_left hw) + hP₁_cl.isOpen_compl hzP₁ + +private theorem arc_inter_drawing_at_ends {S : Type w} [TopologicalSpace S] + {H : Drawing S} {F L : Set S} {u v : S} (hFU : F ∩ H.U = {u, v}) + (hLF : L ⊆ F) (huL : u ∈ L) (hvL : v ∈ L) (huU : u ∈ H.U) (hvU : v ∈ H.U) : + L ∩ H.U = {u, v} := by + refine Subset.antisymm ((inter_subset_inter_left _ hLF).trans hFU.subset) ?_ + rintro z (rfl | rfl) + · exact ⟨huL, huU⟩ + · exact ⟨hvL, hvU⟩ + +/-- **Graph Minors XV, (3.2)** (pages 119–120): +Gluing lemma for rigidity of a drawing `H` across a decomposition `Σ = Σ₁ ∪ Σ₂`. -/ +theorem theorem_3_2_proof : GM15Theorem32Statement.{w} := by + intro S _ _ S_hat _ _ t C P₁ P₂ ι D H H₁ X + hSplit hCap hInterU hX hCond1 hCond2 hCond3 hCond4 F hF hFU hFV + have hS : IsClosedSurface S := hSplit.surface.1 + have hS_hat : IsClosedSurface S_hat := hSplit.surface_hat + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have : LocallyConnectedSpace S_hat := IsClosedSurface.locallyConnectedSpace hS_hat + have : CompactSpace P₁ := hSplit.manifold₁.1 + have : CompactSpace P₂ := hSplit.manifold₂.1 + have hP₁_comp : IsCompact P₁ := isCompact_iff_compactSpace.mpr inferInstance + have hP₂_comp : IsCompact P₂ := isCompact_iff_compactSpace.mpr inferInstance + have hP₁_cl : IsClosed P₁ := hP₁_comp.isClosed + have hP₂_cl : IsClosed P₂ := hP₂_comp.isClosed + have hRange_comp : IsCompact (range ι) := isCompact_range hSplit.isEmbedding.continuous + have hRange_cl : IsClosed (range ι) := hRange_comp.isClosed + by_cases hF₂ : F ⊆ P₂ + · obtain ⟨Δ, _, hDial⟩ := hCond3 F hF₂ hF hFU hFV + exact ⟨Δ, hDial⟩ + obtain ⟨x₁, hx₁F, hx₁_not_P₂⟩ := not_subset.mp hF₂ + have hx₁P₁ : x₁ ∈ P₁ := (eq_univ_iff_forall.mp hSplit.union x₁).resolve_right hx₁_not_P₂ + let p₀ : P₁ := ⟨x₁, hx₁P₁⟩ + let f : S → S_hat := cappedFwd P₁ ι p₀ + let g : S_hat → S := cappedInv P₁ ι hSplit.isEmbedding p₀ + have hf_cont : ContinuousOn f P₁ := continuousOn_cappedFwd hSplit.isEmbedding p₀ + have hg_cont : ContinuousOn g (range ι) := continuousOn_cappedInv hSplit.isEmbedding p₀ + have hfg_inv : LeftInvOn g f P₁ := leftInvOn_cappedInv + have hgf_inv : LeftInvOn f g (range ι) := leftInvOn_cappedFwd + have hf_maps : MapsTo f P₁ (range ι) := mapsTo_cappedFwd + have hg_maps : MapsTo g (range ι) P₁ := mapsTo_cappedInv + have hf_inj : InjOn f P₁ := hfg_inv.injOn + have hg_inj : InjOn g (range ι) := hgf_inv.injOn + have hH₁_U : H₁.U = f '' (H.U ∩ P₁) := + hCap.1.trans (cappedFwd_image_inter_P₁ H.U).symm + have hH₁_V : H₁.V = f '' (H.V ∩ P₁) := + hCap.2.trans (cappedFwd_image_inter_P₁ H.V).symm + have hH₁_U_sub : H₁.U ⊆ range ι := + hH₁_U ▸ (hf_maps.mono inter_subset_right Subset.rfl).image_subset + have hH₁_V_sub : H₁.V ⊆ range ι := H₁.V_subset_U.trans hH₁_U_sub + have hCi_sub : ∀ i, C i ⊆ P₁ ∩ P₂ := fun i => hSplit.inter.symm ▸ subset_iUnion C i + have hCi_P₁ : ∀ i, C i ⊆ P₁ := fun i => (hCi_sub i).trans inter_subset_left + have hCi_U : ∀ i, C i ⊆ H.U := fun i => (hCi_sub i).trans hInterU + have hDi_bd : ∀ i, subBd (D i) = f '' C i := fun i => + (hSplit.bounds i).trans (cappedFwd_image_eq_of_subset (hCi_P₁ i)).symm + have hDi_bd_range : ∀ i, subBd (D i) ⊆ range ι := fun i => + hDi_bd i ▸ (hf_maps.mono (hCi_P₁ i) Subset.rfl).image_subset + have hDi_bd_U : ∀ i, subBd (D i) ⊆ H₁.U := fun i => by + rw [hDi_bd i, hH₁_U] + exact image_mono (subset_inter (hCi_U i) (hCi_P₁ i)) + have hDi_bd_oArc : ∀ i, IsOArc (subBd (D i)) := fun i => by + rw [hDi_bd i] + exact (hSplit.isOArc i).image (hf_cont.mono (hCi_P₁ i)) + (hg_cont.mono (hDi_bd i ▸ hDi_bd_range i)) (hfg_inv.mono (hCi_P₁ i)) + have hDi_disj_range : ∀ i, Disjoint (D i) (range ι) := fun i => + disjoint_compl_left.mono_left (hSplit.compl ▸ subset_iUnion D i) + have hDi_disj_U : ∀ i, Disjoint (D i) H₁.U := fun i => + (hDi_disj_range i).mono_right hH₁_U_sub + have hDisc_sub_range : ∀ {Δ_hat : Set S_hat}, IsClosedDisc Δ_hat → subBd Δ_hat ⊆ range ι → + (∀ i : Fin t, ¬ (subBd (D i) ⊆ Δ_hat ∩ H₁.U)) → Δ_hat ⊆ range ι := by + exact capped_disc_without_cap_lies_in_range (S := S) (S_hat := S_hat) (t := t) C P₁ P₂ ι D H₁ + hSplit hDi_bd_U hDi_disj_range + have hPullback_disc : ∀ {Δ_hat : Set S_hat}, IsClosedDisc Δ_hat → Δ_hat ⊆ range ι → + IsClosedDisc (g '' Δ_hat) ∧ subBd (g '' Δ_hat) = g '' subBd Δ_hat ∧ g '' Δ_hat ⊆ P₁ := by + exact disc_in_capped_drawing_pulls_back (S := S) (S_hat := S_hat) P₁ ι hS hS_hat f g hf_cont + hg_cont hgf_inv hg_maps + by_cases hF₁ : F ⊆ P₁ + · exact fitting_first_side_disc (S := S) (S_hat := S_hat) (t := t) P₁ ι D H H₁ X hCond2 F hF hFU + hFV hRange_comp f g hf_cont hg_cont hfg_inv hgf_inv hf_maps hg_maps hf_inj hg_inj hH₁_U + hH₁_V hH₁_U_sub hH₁_V_sub hDi_bd_oArc hDisc_sub_range hPullback_disc hF₁ + -- Case 3: `F` meets both `P₁ \ P₂` and `P₂ \ P₁`. + have hfrP₁ : frontier P₁ ⊆ P₁ ∩ P₂ := by + exact frontier_first_side_is_on_interface (S := S) (S_hat := S_hat) (t := t) C P₁ P₂ ι D + hSplit hP₁_cl hP₂_cl + have hfrP₂ : frontier P₂ ⊆ P₁ ∩ P₂ := by + exact frontier_second_side_is_on_interface (S := S) (S_hat := S_hat) (t := t) C P₁ P₂ ι D + hSplit hP₁_cl hP₂_cl + have hCut : ∃ u v : S, u ≠ v ∧ u ∈ F ∧ v ∈ F ∧ u ∈ H.V ∧ v ∈ H.V ∧ + u ∈ P₁ ∩ P₂ ∧ v ∈ P₁ ∩ P₂ ∧ F ∩ H.V = {u, v} ∧ + F ∩ H.U = {u, v} ∧ F ∩ (P₁ ∩ P₂) = {u, v} := by + exact crossing_boundary_has_two_interface_points (S := S) (S_hat := S_hat) (t := t) + C P₁ P₂ ι D H hSplit hInterU F hF hFU hFV hP₁_cl x₁ hx₁F hx₁_not_P₂ hx₁P₁ hF₁ hfrP₁ + obtain ⟨u, v, huv, huF, hvF, huV, hvV, hu12, hv12, hFV_eq, hFU_eq, hF12_eq⟩ := hCut + obtain ⟨F₁_0, F₂_0, hF₁_0, hF₂_0, hF_0_union, hF_0_inter⟩ := hF.lines huF hvF huv + have hArc_side : ∀ {L : Set S}, IsLineWithEnds L u v → L ⊆ F → L ⊆ P₁ ∨ L ⊆ P₂ := by + exact boundary_arc_lies_on_one_side (S := S) (S_hat := S_hat) (t := t) C P₁ P₂ ι D hSplit F + hP₁_cl hP₂_cl hfrP₁ hfrP₂ u v hF12_eq + have hSplit_F : ∃ F₁ F₂ : Set S, + IsLineWithEnds F₁ u v ∧ IsLineWithEnds F₂ u v ∧ + F₁ ∪ F₂ = F ∧ F₁ ∩ F₂ = {u, v} ∧ F₁ ⊆ P₁ ∧ F₂ ⊆ P₂ := by + exact split_circle_at_two_boundary_points (S := S) P₁ P₂ F hF₂ hF₁ u v F₁_0 F₂_0 hF₁_0 hF₂_0 + hF_0_union hF_0_inter hArc_side + obtain ⟨F₁, F₂, hF₁_line, hF₂_line, hF_union, hF_inter, hF₁_P₁, hF₂_P₂⟩ := hSplit_F + obtain ⟨huF₁, hvF₁⟩ := ends_mem_of_isLineWithEnds hF₁_line + obtain ⟨huF₂, hvF₂⟩ := ends_mem_of_isLineWithEnds hF₂_line + have hF₁_U := arc_inter_drawing_at_ends (H := H) hFU_eq + (hF_union ▸ subset_union_left) huF₁ hvF₁ (H.V_subset_U huV) (H.V_subset_U hvV) + have hF₂_U := arc_inter_drawing_at_ends (H := H) hFU_eq + (hF_union ▸ subset_union_right) huF₂ hvF₂ (H.V_subset_U huV) (H.V_subset_U hvV) + -- Find the region `r₁ ⊆ P₁` containing `F₁ \ {u, v}`, and deduce `u, v ∈ C i` for some `i`. + have hEndsOnSameInterface : ∃ i, u ∈ C i ∧ v ∈ C i := by + exact arc_ends_lie_on_same_interface (S := S) (S_hat := S_hat) (t := t) C P₁ P₂ ι D H hSplit + hInterU hCond1 hP₁_cl hfrP₁ u v hu12 hv12 F₁ hF₁_line hF₁_P₁ huF₁ hvF₁ hF₁_U + obtain ⟨i, hu_Ci, hv_Ci⟩ := hEndsOnSameInterface + -- Map `F₁, u, v` to `S_hat` and add a chord `L_D` across `D i`. + let u' : S_hat := f u + let v' : S_hat := f v + let F₁' : Set S_hat := f '' F₁ + have hu'_bd : u' ∈ subBd (D i) := hDi_bd i ▸ mem_image_of_mem f hu_Ci + have hv'_bd : v' ∈ subBd (D i) := hDi_bd i ▸ mem_image_of_mem f hv_Ci + have hu'_V : u' ∈ H₁.V := hH₁_V ▸ mem_image_of_mem f ⟨huV, hu12.1⟩ + have hv'_V : v' ∈ H₁.V := hH₁_V ▸ mem_image_of_mem f ⟨hvV, hv12.1⟩ + have hu'v' : u' ≠ v' := fun h => huv (hf_inj hu12.1 hv12.1 h) + have hF₁'_range : F₁' ⊆ range ι := (hf_maps.mono hF₁_P₁ Subset.rfl).image_subset + have hF₁'_line : IsLineWithEnds F₁' u' v' := + isLineWithEnds_image hF₁_line (hf_cont.mono hF₁_P₁) (hg_cont.mono hF₁'_range) + (hfg_inv.mono hF₁_P₁) + have hF₁'_U : F₁' ∩ H₁.U = {u', v'} := by + rw [hH₁_U, ← hf_inj.image_inter hF₁_P₁ inter_subset_right] + have h1 : F₁ ∩ (H.U ∩ P₁) = {u, v} := by + rw [← Set.inter_assoc, hF₁_U] + exact inter_eq_left.mpr (by rintro z (rfl | rfl); exacts [hu12.1, hv12.1]) + rw [h1] + simp [u', v', image_insert_eq] + have hCapArc : ∃ L_D : Set S_hat, IsLineWithEnds L_D u' v' ∧ L_D \ {u', v'} ⊆ D i ∧ + F₁' ∩ L_D = {u', v'} ∧ IsOArc (F₁' ∪ L_D) ∧ + L_D ∩ H₁.U = {u', v'} ∧ (F₁' ∪ L_D) ∩ H₁.U = {u', v'} ∧ + (F₁' ∪ L_D) ∩ H₁.V = {u', v'} := by + exact cap_boundary_arc_closes_curve (S := S) (S_hat := S_hat) (t := t) C P₁ P₂ ι D H₁ hSplit + hS_hat hDi_bd_U hDi_bd_oArc hDi_disj_range hDi_disj_U i u' v' F₁' hu'_bd hv'_bd hu'_V hv'_V + hu'v' hF₁'_range hF₁'_line hF₁'_U + obtain ⟨L_D, hL_D_line, hL_D_sub, hF₁'_L_D_inter, hF_hat_oArc, hL_D_U, hF_hat_U, hF_hat_V⟩ := + hCapArc + obtain ⟨hu'F₁', hv'F₁'⟩ := ends_mem_of_isLineWithEnds hF₁'_line + obtain ⟨hu'L_D, hv'L_D⟩ := ends_mem_of_isLineWithEnds hL_D_line + let F_hat : Set S_hat := F₁' ∪ L_D + have hF_hat_UV : F_hat ∩ H₁.U ⊆ H₁.V := by + rw [hF_hat_U] + rintro y (rfl | rfl) <;> assumption + have hF_hat_card : (F_hat ∩ H₁.V).ncard ≤ 2 := by + rw [hF_hat_V, Set.ncard_pair hu'v'] + obtain ⟨Δ_hat, hDial_hat, hX_hat⟩ := hCond2 F_hat hF_hat_oArc hF_hat_UV hF_hat_card + have hΔ_hat_disc : IsClosedDisc Δ_hat := hDial_hat.1 + have hΔ_hat_bd : subBd Δ_hat = F_hat := hDial_hat.2.1 + have hΔ_hat_inter_U : (H₁.interSet Δ_hat).U = H₁.U ∩ Δ_hat := + (GM14.interSet_V_and_U hΔ_hat_disc.isClosed (hΔ_hat_bd ▸ hF_hat_UV)).2 + have hF_hat_sub_Δ : F_hat ⊆ Δ_hat := by + intro y hy + exact hΔ_hat_disc.isClosed.closure_eq ▸ (hΔ_hat_bd.symm ▸ hy).1 + -- Show that `Δ_hat \ F_hat` meets `subBd (D i)` at some point `z₀ ∉ F_hat`. + have hCappedBoundaryPath : ∃ B₁ : Set S_hat, IsLineWithEnds B₁ u' v' ∧ B₁ ⊆ subBd (D i) ∧ + B₁ ⊆ Δ_hat ∧ (H₁.interSet Δ_hat).IsPathBetween u' v' ∧ + (H₁.interSet Δ_hat).U = B₁ := by + exact capped_disc_contains_spanning_boundary_path (S := S) (S_hat := S_hat) (t := t) C P₁ P₂ ι + D H₁ hSplit hS_hat hDi_bd_U hDi_bd_oArc hDi_disj_range i u' v' F₁' hu'_bd + hv'_bd hu'v' hF₁'_range hF₁'_line hF₁'_U L_D hL_D_line hL_D_sub hu'F₁' hv'F₁' hF_hat_U + hF_hat_V Δ_hat hDial_hat hΔ_hat_disc hΔ_hat_bd hΔ_hat_inter_U hF_hat_sub_Δ + obtain ⟨B₁, hB₁_line, hB₁_bd, hB₁_sub_Δ, hPath_hat, hΔ_hat_U_eq⟩ := hCappedBoundaryPath + obtain ⟨hu'B₁, hv'B₁⟩ := ends_mem_of_isLineWithEnds hB₁_line + have hB₁_U : B₁ ⊆ H₁.U := hB₁_bd.trans (hDi_bd_U i) + have hB₁_range : B₁ ⊆ range ι := hB₁_bd.trans (hDi_bd_range i) + have hCapSubdisc : ∃ Δ_hat₁ : Set S_hat, F₁' ∩ B₁ = {u', v'} ∧ + IsClosedDisc Δ_hat₁ ∧ subBd Δ_hat₁ = F₁' ∪ B₁ ∧ Δ_hat₁ ∩ H₁.U = B₁ ∧ Δ_hat₁ ⊆ range ι := by + exact capped_boundary_path_spans_subdisc (S := S) (S_hat := S_hat) (t := t) P₁ ι D H₁ hS_hat + hDi_bd_oArc hDisc_sub_range u' v' F₁' hF₁'_range hF₁'_line hF₁'_U hu'F₁' hv'F₁' + Δ_hat hΔ_hat_disc hΔ_hat_inter_U (subset_union_left.trans hF_hat_sub_Δ) B₁ hB₁_line hB₁_sub_Δ + hΔ_hat_U_eq hu'B₁ hv'B₁ hB₁_U hB₁_range + obtain ⟨Δ_hat₁, hF₁'_B₁_inter, hΔ_hat₁_disc, hΔ_hat₁_bd, hΔ_hat₁_U, hΔ_hat₁_range⟩ := + hCapSubdisc + obtain ⟨hΔ₁_disc, hΔ₁_bd_img, hΔ₁_P₁⟩ := hPullback_disc hΔ_hat₁_disc hΔ_hat₁_range + let Δ₁ : Set S := g '' Δ_hat₁ + let L : Set S := g '' B₁ + let P : Drawing S := H.interSet L + have hL_Ci : L ⊆ C i := by + have h1 : g '' subBd (D i) = C i := by + rw [hDi_bd i] + exact (hfg_inv.mono (hCi_P₁ i)).image_image + rw [← h1] + exact image_mono hB₁_bd + have hL_12 : L ⊆ P₁ ∩ P₂ := hL_Ci.trans (hCi_sub i) + have hL_P₁ : L ⊆ P₁ := hL_12.trans inter_subset_left + have hL_U : L ⊆ H.U := hL_12.trans hInterU + have hgu' : g u' = u := hfg_inv hu12.1 + have hgv' : g v' = v := hfg_inv hv12.1 + have hL_line : IsLineWithEnds L u v := by + rw [← hgu', ← hgv'] + exact isLineWithEnds_image hB₁_line (hg_cont.mono hB₁_range) + (hf_cont.mono hL_P₁) (hgf_inv.mono hB₁_range) + have hL_cl : IsClosed L := (isCompact_of_isLineWithEnds hL_line).isClosed + have hB₁_cl : IsClosed B₁ := (isCompact_of_isLineWithEnds hB₁_line).isClosed + have hP_V : P.V = H.V ∩ L := interSet_V_of_isClosed H hL_cl + have hP_sub : P.IsSubdrawing (H.interSet (P₁ ∩ P₂)) := + interSet_isSubdrawing_of_isClosed H hL_cl (hP₁_cl.inter hP₂_cl) hL_12 + have hLiftedPath : P.U = L ∧ P.IsPathBetween u v ∧ (P.V ∩ X).ncard ≤ 2 := by + exact boundary_path_pulls_back_with_bounded_cut (S := S) (S_hat := S_hat) P₁ P₂ ι H H₁ X hCap + hX hRange_comp p₀ g hf_cont hg_cont hfg_inv hgf_inv hg_maps hf_inj hg_inj hH₁_V u v u' v' + F_hat hF_hat_card Δ_hat hX_hat hΔ_hat_disc hΔ_hat_inter_U B₁ hB₁_line hB₁_sub_Δ hPath_hat + hΔ_hat_U_eq hB₁_range hL_P₁ hL_U hgu' hgv' hL_cl hB₁_cl hP_V + obtain ⟨hP_U, hP_path, hPX_card⟩ := hLiftedPath + -- Apply Condition (iv) to `F₂, u, v, P`. + have hJoinedSides : ∃ Δ, IsDial H F Δ := by + exact glue_discs_across_boundary_path (S := S) (S_hat := S_hat) P₁ P₂ ι H H₁ X hInterU hCond4 + F hFU hS hP₂_cl f g hfg_inv hgf_inv hH₁_U u v huv huV hvV hu12 hv12 hFV_eq F₁ F₂ hF₂_line + hF_union hF₁_P₁ hF₂_P₂ huF₁ hvF₁ huF₂ hvF₂ hF₁_U hF₂_U u' v' B₁ hu'B₁ hv'B₁ Δ_hat₁ + hΔ_hat₁_bd hΔ_hat₁_U hΔ_hat₁_range hΔ₁_disc hΔ₁_bd_img hΔ₁_P₁ P hL_U hgu' hgv' hL_line hP_V + hP_sub hP_U hP_path hPX_card + exact hJoinedSides + +/-- Statement of Graph Minors XV, (3.3) (pages 120–121): +"Let $\Sigma$ be a surface and let $\phi \ge 3$ be an integer. Let $\mathscr{T}^*$ be a +tangle in a graph $G$, and let $H, \eta, \mathscr{T}$ be a $\Sigma$-span. Let $\Lambda +\subseteq \Sigma$ be a region of $H$ such that $H \cap bd(\Lambda)$ is a circuit, and let +$a_1, \dots, a_\phi, b_1, \dots, b_\phi$ be distinct vertices of this circuit, in order, +such that $\{a_1, \dots, a_\phi, b_1, \dots, b_\phi\}$ is free with respect to +$\mathscr{T}$. For $1 \le i \le \phi$ let $P_i$ be an $\eta(H)$-path with ends $\eta(a_i), +\eta(b_i)$, such that* ... *$P_1, \dots, P_\phi$ are mutually disjoint. Then there is a +$\Sigma'$-span of order $\phi$, where $\Sigma'$ is the surface obtained by adding a crosscap +to $\Sigma$." -/ +def GM15Theorem33Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ φ : ℕ) (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (Λ : Set S) (P : Fin φ → Graph α β) (a b : Fin φ → S), + IsSigmaSpan G H η θ_star θ T_star T → + Λ ∈ H.R → IsOArc (subBd Λ) → (H.interSet (subBd Λ)).IsCircuit → + 3 ≤ φ → φ ≤ θ → + ((List.ofFn a ++ List.ofFn b).Nodup) → + GM12.IsListedInOrderOn (subBd Λ) (List.ofFn a ++ List.ofFn b) → + (∀ i : Fin φ, a i ∈ H.V ∩ subBd Λ ∧ b i ∈ H.V ∩ subBd Λ) → + (∀ i : Fin φ, IsHPathWithEnds G η.imageGraph (P i) (η.vMap (a i)) (η.vMap (b i))) → + Pairwise (fun i j => Disjoint V(P i) V(P j)) → + IsFreeSet H.toHypergraph T θ (range a ∪ range b) → + ∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S'), + IsObtainedByAddingCrosscap S S' ∧ + ∃ (H' : Drawing S') (η' : SpanEmbedding H' G) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsSigmaSpan G H' η' θ_star φ T_star T' + +/-- **Graph Minors XV, (3.3), Claim (2)** (page 121): +"Every $X \subseteq \{a_1, \dots, a_\phi, b_1, \dots, b_\phi\}$ with $|X| \le \phi$ is free +with respect to $\mathscr{T}_1$." -/ +theorem theorem_3_3_claim_2 {S : Type w} [TopologicalSpace S] + {H : Drawing S} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {θ φ : ℕ} {Y X : Set S} + (hT : IsTangle H.toHypergraph θ T) + (hFree : IsFreeSet H.toHypergraph T θ Y) + (hXY : X ⊆ Y) (hX : X.ncard ≤ φ) : + IsFreeSet H.toHypergraph (GM10.truncation T φ) φ X := by + have hFreeX : IsFreeSet H.toHypergraph T θ X := hFree.subset hT hXY + exact ⟨hFreeX.1, hX, fun _ _ hAB hXA => hFreeX.2.2 hAB.1 hXA⟩ + +/-- **Graph Minors XV, (3.3), Claim (3)** (page 121): +"For every $O$-arc $F \subseteq \Sigma$ with $F \cap U(H') \subseteq V(H')$ and $|F \cap +V(H')| \le 2$, there is a dial $\Delta \subseteq \Sigma$ for $F, H' \cap \Sigma_1$ with $|X +\cap \Delta| \le |F \cap V(H')|$." -/ +theorem theorem_3_3_claim_3 {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) [ConnectedSpace S] + {H : Drawing S} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {θ : ℕ} {X F : Set S} + (hRigid : IsRigid H) + (hT : IsTangle H.toHypergraph θ T) + (hθ : 3 ≤ θ) + (hFree : IsFreeSet H.toHypergraph T θ X) + (hF : IsOArc F) (hFU : F ∩ H.U ⊆ H.V) (hFV : (F ∩ H.V).ncard ≤ 2) : + ∃ Δ : Set S, IsDial H F Δ ∧ (X ∩ Δ).ncard ≤ (F ∩ H.V).ncard := by + obtain ⟨Δ, hDial⟩ := hRigid F hF hFU hFV + have hMemT : + ((H.interSet Δ).toHypergraph, (H.interSet (closure (univ \ Δ))).toHypergraph) ∈ T := + (theorem_3_1_proof H θ T Δ hS inferInstance hRigid hT hθ hDial.1 + (hDial.2.1 ▸ hFU) (hDial.2.1 ▸ hFV)).mpr (hDial.2.1.symm ▸ hDial) + obtain ⟨_, hOrd⟩ := isSeparation_interSet_of_isClosed H hDial.1.isClosed (hDial.2.1 ▸ hFU) + have hFree_sub : IsFreeSet H.toHypergraph T θ (X ∩ Δ) := + hFree.subset hT inter_subset_left + have hSubA : X ∩ Δ ⊆ (H.interSet Δ).toHypergraph.vertexSet := by + change X ∩ Δ ⊆ (H.interSet Δ).V + rw [interSet_V_of_isClosed H hDial.1.isClosed] + exact inter_subset_inter_left Δ hFree.1 + have hLe : (X ∩ Δ).ncard ≤ separationOrder (H.interSet Δ).toHypergraph + (H.interSet (closure (univ \ Δ))).toHypergraph := + hFree_sub.2.2 hMemT hSubA + exact ⟨Δ, hDial, hDial.2.1 ▸ hOrd ▸ hLe⟩ + +/-- Graph Minors XV, (3.4) (page 122), with auxiliary conclusions. + +"Let $\Sigma$ be a surface and let $k \ge 3$ be an integer. Let $\mathscr{T}^*$ be a tangle +in a graph $G$, and let $H, \mathscr{T}$ be a $\Sigma$-span of order $\theta$. Let $\Lambda +\subseteq \Sigma$ be a region of $H$ such that $H \cap bd(\Lambda)$ is a circuit, and let +$v_1, \dots, v_{2k}$ be distinct vertices of this circuit, in order, such that $\{v_1, +\dots, v_{2k}\}$ is free with respect to $\mathscr{T}$. Let $H' \subseteq G$ be a drawing in +$\Sigma$ such that $H' \cap (\Sigma - \Lambda) = H$ and $H' = H \cup P_1 \cup \dots \cup +P_{k-1}$, where $P_i$ is a path with ends $v_i, v_{2k-i}$ for $1 \le i \le k - 1$. Let +$\mathscr{T}'$ be a tangle in $H'$ induced by $\mathscr{T}$; then $H', \mathscr{T}'$ is a +$\Sigma$-span of order $\theta$. Moreover, let $r_1, r_2 \subseteq \Lambda$ be the regions +of $H'$ incident with $v_k, v_{2k}$ respectively; then $d'(r_1, r_2) \ge 2k - 6$, and +$d'(v_k, v_{2k}) \ge 2k - 8$, where $d'$ is the metric of $\mathscr{T}'." + +Here "$H' \subseteq G$" means that the span embedding `η'` of $H'$ agrees with `η` on $H$. The +printed statement is false unless each $P_i$ meets $H$ only in its ends and the paths are disjoint +(see the correction to (3.4) in `corrections/GM15.md`), so we add these two hypotheses. The proof +uses both ("the disjoint paths $P_1, \dots, P_{k-1}$"), and so do the uses in Section 7. + +The formal statement also identifies the old drawing outside $\Lambda$ and the induced tangle, +gives monotonicity of distance on atoms of $H$, and describes each new region boundary as a circuit +drawn on an $O$-arc. It records membership and cyclic order of specified sets of four vertices on +these boundaries. Section 7 uses the boundary conclusions. -/ +def GM15Theorem34Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ k : ℕ) (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (Λ : Set S) (v : Fin (2 * k) → S) (H' : Drawing S) (η' : SpanEmbedding H' G) + (P : Fin (k - 1) → Drawing S) (i_k i_last : Fin (2 * k)), + IsSigmaSpan G H η θ_star θ T_star T → + HasTangleMetric H θ T d → + Λ ∈ H.R → IsOArc (subBd Λ) → (H.interSet (subBd Λ)).IsCircuit → + 3 ≤ k → + (List.ofFn v).Nodup → + GM12.IsListedInOrderOn (subBd Λ) (List.ofFn v) → + (∀ i : Fin (2 * k), v i ∈ H.V ∩ subBd Λ) → + IsFreeSet H.toHypergraph T θ (range v) → + (∀ x ∈ H.V, η'.vMap x = η.vMap x) → (∀ e ∈ H.E, η'.eMap e = η.eMap e) → + H'.interSet (univ \ Λ) = H → + H'.V = H.V ∪ ⋃ j : Fin (k - 1), (P j).V → + H'.E = H.E ∪ ⋃ j : Fin (k - 1), (P j).E → + (∀ j : Fin (k - 1), + (P j).IsPathBetween (v ⟨j.1, by omega⟩) (v ⟨2 * k - 2 - j.1, by omega⟩)) → + (∀ j : Fin (k - 1), (P j).U ∩ H.U = {v ⟨j.1, by omega⟩, v ⟨2 * k - 2 - j.1, by omega⟩}) → + Pairwise (fun j₁ j₂ => Disjoint (P j₁).U (P j₂).U) → + i_k.1 = k - 1 → i_last.1 = 2 * k - 1 → + ∃ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r₁ r₂ : Set S), + IsSigmaSpan G H' η' θ_star θ T_star T' ∧ + HasTangleMetric H' θ T' d' ∧ + r₁ ∈ H'.R ∧ r₂ ∈ H'.R ∧ r₁ ⊆ Λ ∧ r₂ ⊆ Λ ∧ + H'.U \ Λ = H.U ∧ + T' = GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ ∧ + (∀ x ∈ H.A, ∀ y ∈ H.A, d x y ≤ d' x y) ∧ + IsOArc (subBd r₁) ∧ IsOArc (subBd r₂) ∧ + (H'.interSet (subBd r₁)).IsCircuit ∧ (H'.interSet (subBd r₂)).IsCircuit ∧ + v i_k ∈ subBd r₁ ∧ v i_last ∈ subBd r₂ ∧ + (∀ w₁ w₂ w₃ w₄ : S, + w₁ ∈ H.V ∩ subBd Λ → w₂ ∈ H.V ∩ subBd Λ → + w₃ ∈ H.V ∩ subBd Λ → w₄ ∈ H.V ∩ subBd Λ → + (List.ofFn (fun j : Fin (k - 1) => v ⟨j.1, by omega⟩) ++ [w₁, w₂, w₃, w₄] ++ + List.ofFn (fun j : Fin k => v ⟨k + j.1, by omega⟩)).Nodup → + GM12.IsListedInOrderOn (subBd Λ) + (List.ofFn (fun j : Fin (k - 1) => v ⟨j.1, by omega⟩) ++ [w₁, w₂, w₃, w₄] ++ + List.ofFn (fun j : Fin k => v ⟨k + j.1, by omega⟩)) → + w₁ ∈ (H'.interSet (subBd r₁)).V ∧ w₂ ∈ (H'.interSet (subBd r₁)).V ∧ + w₃ ∈ (H'.interSet (subBd r₁)).V ∧ w₄ ∈ (H'.interSet (subBd r₁)).V ∧ + OccurInCircuitOrder (H'.interSet (subBd r₁)) w₁ w₂ w₃ w₄) ∧ + (∀ u₁ u₂ u₃ u₄ : S, + u₁ ∈ H.V ∩ subBd Λ → u₂ ∈ H.V ∩ subBd Λ → + u₃ ∈ H.V ∩ subBd Λ → u₄ ∈ H.V ∩ subBd Λ → + (List.ofFn (fun j : Fin (2 * k - 1) => v ⟨j.1, by omega⟩) ++ [u₁, u₂, u₃, u₄]).Nodup → + GM12.IsListedInOrderOn (subBd Λ) + (List.ofFn (fun j : Fin (2 * k - 1) => v ⟨j.1, by omega⟩) ++ [u₁, u₂, u₃, u₄]) → + u₁ ∈ (H'.interSet (subBd r₂)).V ∧ u₂ ∈ (H'.interSet (subBd r₂)).V ∧ + u₃ ∈ (H'.interSet (subBd r₂)).V ∧ u₄ ∈ (H'.interSet (subBd r₂)).V ∧ + OccurInCircuitOrder (H'.interSet (subBd r₂)) u₁ u₂ u₃ u₄) ∧ + 2 * k - 6 ≤ d' r₁ r₂ ∧ 2 * k - 8 ≤ d' {v i_k} {v i_last} + +/-- Graph Minors XV, (3.4) (page 122), with the auxiliary conclusions of +`GM15Theorem34Statement`, applied to a constructed drawing $H'$. Given paths +$P_1, \dots, P_{k-1}$ of $G$ that meet $\eta(H)$ only in their ends, there is a drawing +$H' = H \cup P_1 \cup \dots \cup P_{k-1}$ in $\Sigma$ with the paths drawn across $\Lambda$, and +(3.4) applies to it. This is the form used in Section 7; it is proved from +`GM15Theorem34Statement` in `GraphMinor/GM15/Section3Given.lean`. -/ +def GM15Theorem34DrawnStatement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ k : ℕ) (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (Λ : Set S) (v : Fin (2 * k) → S) (P : Fin (k - 1) → Graph α β) + (i_k i_last : Fin (2 * k)), + IsSigmaSpan G H η θ_star θ T_star T → + HasTangleMetric H θ T d → + Λ ∈ H.R → IsOArc (subBd Λ) → (H.interSet (subBd Λ)).IsCircuit → + 3 ≤ k → + (List.ofFn v).Nodup → + GM12.IsListedInOrderOn (subBd Λ) (List.ofFn v) → + (∀ i : Fin (2 * k), v i ∈ H.V ∩ subBd Λ) → + IsFreeSet H.toHypergraph T θ (range v) → + (∀ j : Fin (k - 1), ∃ i₁ i₂ : Fin (2 * k), + i₁.1 = j.1 ∧ i₂.1 = 2 * k - 2 - j.1 ∧ + IsHPathWithEnds G η.imageGraph (P j) (η.vMap (v i₁)) (η.vMap (v i₂))) → + Pairwise (fun j₁ j₂ => Disjoint V(P j₁) V(P j₂)) → + i_k.1 = k - 1 → i_last.1 = 2 * k - 1 → + ∃ (H' : Drawing S) (η' : SpanEmbedding H' G) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r₁ r₂ : Set S), + IsSigmaSpan G H' η' θ_star θ T_star T' ∧ + HasTangleMetric H' θ T' d' ∧ + r₁ ∈ H'.R ∧ r₂ ∈ H'.R ∧ r₁ ⊆ Λ ∧ r₂ ⊆ Λ ∧ + H'.interSet (univ \ Λ) = H ∧ + H'.U \ Λ = H.U ∧ + H.IsSubdrawing H' ∧ + (∀ x ∈ H.V, η'.vMap x = η.vMap x) ∧ + (∀ e ∈ H.E, η'.eMap e = η.eMap e) ∧ + η'.imageGraph = subgraphUnion G η.imageGraph (subgraphSUnion G (range P)) ∧ + T' = GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ ∧ + (∀ x ∈ H.A, ∀ y ∈ H.A, d x y ≤ d' x y) ∧ + IsOArc (subBd r₁) ∧ IsOArc (subBd r₂) ∧ + (H'.interSet (subBd r₁)).IsCircuit ∧ (H'.interSet (subBd r₂)).IsCircuit ∧ + v i_k ∈ subBd r₁ ∧ v i_last ∈ subBd r₂ ∧ + (∀ w₁ w₂ w₃ w₄ : S, + w₁ ∈ H.V ∩ subBd Λ → w₂ ∈ H.V ∩ subBd Λ → + w₃ ∈ H.V ∩ subBd Λ → w₄ ∈ H.V ∩ subBd Λ → + (List.ofFn (fun j : Fin (k - 1) => v ⟨j.1, by omega⟩) ++ [w₁, w₂, w₃, w₄] ++ + List.ofFn (fun j : Fin k => v ⟨k + j.1, by omega⟩)).Nodup → + GM12.IsListedInOrderOn (subBd Λ) + (List.ofFn (fun j : Fin (k - 1) => v ⟨j.1, by omega⟩) ++ [w₁, w₂, w₃, w₄] ++ + List.ofFn (fun j : Fin k => v ⟨k + j.1, by omega⟩)) → + w₁ ∈ (H'.interSet (subBd r₁)).V ∧ w₂ ∈ (H'.interSet (subBd r₁)).V ∧ + w₃ ∈ (H'.interSet (subBd r₁)).V ∧ w₄ ∈ (H'.interSet (subBd r₁)).V ∧ + OccurInCircuitOrder (H'.interSet (subBd r₁)) w₁ w₂ w₃ w₄) ∧ + (∀ u₁ u₂ u₃ u₄ : S, + u₁ ∈ H.V ∩ subBd Λ → u₂ ∈ H.V ∩ subBd Λ → + u₃ ∈ H.V ∩ subBd Λ → u₄ ∈ H.V ∩ subBd Λ → + (List.ofFn (fun j : Fin (2 * k - 1) => v ⟨j.1, by omega⟩) ++ [u₁, u₂, u₃, u₄]).Nodup → + GM12.IsListedInOrderOn (subBd Λ) + (List.ofFn (fun j : Fin (2 * k - 1) => v ⟨j.1, by omega⟩) ++ [u₁, u₂, u₃, u₄]) → + u₁ ∈ (H'.interSet (subBd r₂)).V ∧ u₂ ∈ (H'.interSet (subBd r₂)).V ∧ + u₃ ∈ (H'.interSet (subBd r₂)).V ∧ u₄ ∈ (H'.interSet (subBd r₂)).V ∧ + OccurInCircuitOrder (H'.interSet (subBd r₂)) u₁ u₂ u₃ u₄) ∧ + 2 * k - 6 ≤ d' r₁ r₂ ∧ 2 * k - 8 ≤ d' {v i_k} {v i_last} + +/-- Statement of Graph Minors XV, (3.5) (page 123): +"Let $\Sigma$ be a surface and let $\phi \ge 3$ be an integer. Let $\mathscr{T}^*$ be a +tangle in a graph $G$, and let $H, \eta, \mathscr{T}$ be a $\Sigma$-span. Let $\Lambda_1, +\Lambda_2 \subseteq \Sigma$ be distinct regions of $H$ so that $H \cap bd(\Lambda_i)$ is a +circuit $C_i$ ($i = 1, 2$), and no region of $H$ is incident with a vertex in $C_1$ and with +a vertex in $C_2$. Let $a_1, \dots, a_\phi$ be distinct vertices of $C_1$ in order, and let +$b_1, \dots, b_\phi$ be distinct vertices of $C_2$ in order (under some orientations of +$C_1$ and $C_2$), such that $\{a_1, \dots, a_\phi\}$ and $\{b_1, \dots, b_\phi\}$ are free +with respect to $\mathscr{T}$. For $1 \le i \le \phi$ let $P_i$ be an $\eta(H)$-path with +ends $\eta(a_i), \eta(b_i)$, such that $P_1, \dots, P_\phi$ are mutually disjoint. Then +there is a $\Sigma'$-span of order $\phi$, where $\Sigma'$ is the surface obtained by adding +a handle to $\Sigma$." + +Here we depart from the paper by also assuming the line condition required by Graph Minors XII, +(5.1): every `H`-normal line `F ⊆ Σ - (Λ₁ ∪ Λ₂)` meeting both `bd(Λ₁)` and `bd(Λ₂)` satisfies +`ϕ ≤ |F ∩ V(H)|` (at `ϕ = 3` this follows from the hypothesis that no region meets both `C₁` and +`C₂`, as proved in `line_ncard_ge_three_of_no_common_region`). -/ +def GM15Theorem35Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ φ : ℕ) (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (Λ₁ Λ₂ : Set S) (P : Fin φ → Graph α β) (a b : Fin φ → S), + IsSigmaSpan G H η θ_star θ T_star T → + Λ₁ ∈ H.R → Λ₂ ∈ H.R → Λ₁ ≠ Λ₂ → + IsOArc (subBd Λ₁) → IsOArc (subBd Λ₂) → + (H.interSet (subBd Λ₁)).IsCircuit → (H.interSet (subBd Λ₂)).IsCircuit → + (∀ r ∈ H.R, (closure r ∩ (H.V ∩ subBd Λ₁)).Nonempty → + Disjoint (closure r) (H.V ∩ subBd Λ₂)) → + (∀ F : Set S, IsLine F → H.IsNormal F → F ⊆ univ \ (Λ₁ ∪ Λ₂) → + (F ∩ subBd Λ₁).Nonempty → (F ∩ subBd Λ₂).Nonempty → φ ≤ (F ∩ H.V).ncard) → + 3 ≤ φ → φ ≤ θ → + (List.ofFn a).Nodup → (List.ofFn b).Nodup → + GM12.IsListedInOrderOn (subBd Λ₁) (List.ofFn a) → + GM12.IsListedInOrderOn (subBd Λ₂) (List.ofFn b) → + (∀ i : Fin φ, a i ∈ H.V ∩ subBd Λ₁ ∧ b i ∈ H.V ∩ subBd Λ₂) → + (∀ i : Fin φ, IsHPathWithEnds G η.imageGraph (P i) (η.vMap (a i)) (η.vMap (b i))) → + Pairwise (fun i j => Disjoint V(P i) V(P j)) → + IsFreeSet H.toHypergraph T θ (range a) → + IsFreeSet H.toHypergraph T θ (range b) → + ∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S'), + IsObtainedByAddingHandle S S' ∧ + ∃ (H' : Drawing S') (η' : SpanEmbedding H' G) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsSigmaSpan G H' η' θ_star φ T_star T' + +/-- At `φ = 3`, the line condition in `GM15Theorem35Statement` follows from the paper's hypothesis +that no region of `H` meets both `H.V ∩ subBd Λ₁` and `H.V ∩ subBd Λ₂`: if an `H`-normal line `F` +meeting both `subBd Λ₁` and `subBd Λ₂` had `|F ∩ H.V| < 3`, its subline between those two boundary +points would have interior disjoint from `H.U` and hence lie in a single region meeting both +circuits. -/ +theorem line_ncard_ge_three_of_no_common_region {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) + {H : Drawing S} {Λ₁ Λ₂ F : Set S} + (hΛ₁ : Λ₁ ∈ H.R) (hΛ₂ : Λ₂ ∈ H.R) + (hNo_common_region : ∀ r ∈ H.R, (closure r ∩ (H.V ∩ subBd Λ₁)).Nonempty → + Disjoint (closure r) (H.V ∩ subBd Λ₂)) + (hF : IsLine F) (hFN : H.IsNormal F) + (hF₁ : (F ∩ subBd Λ₁).Nonempty) (hF₂ : (F ∩ subBd Λ₂).Nonempty) : + 3 ≤ (F ∩ H.V).ncard := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hSubBd_U : ∀ {Λ : Set S}, Λ ∈ H.R → subBd Λ ⊆ H.U := by + intro Λ hΛ z hz + by_contra hz_not_U + obtain ⟨r, hr, hzr⟩ := GM11.exists_region_of_notMem hz_not_U + obtain ⟨w, hwr, hwΛ⟩ := mem_closure_iff.mp hz.1 r (GM11.region_isOpen hr) hzr + have hrΛ : r = Λ := GM11.region_eq_of_mem hr hΛ hwr hwΛ + have hzΛ : z ∈ Λ := hrΛ ▸ hzr + have hz_fr : z ∈ frontier Λ := subBd_eq_frontier Λ ▸ hz + exact ((GM11.region_isOpen hΛ).interior_eq ▸ hz_fr.2) hzΛ + obtain ⟨z₁, hz₁F, hz₁_bd⟩ := hF₁ + obtain ⟨z₂, hz₂F, hz₂_bd⟩ := hF₂ + have hz₁V : z₁ ∈ H.V := hFN ⟨hz₁F, hSubBd_U hΛ₁ hz₁_bd⟩ + have hz₂V : z₂ ∈ H.V := hFN ⟨hz₂F, hSubBd_U hΛ₂ hz₂_bd⟩ + have hz₁₂ : z₁ ≠ z₂ := by + intro h + subst h + exact disjoint_left.mp + (hNo_common_region Λ₁ hΛ₁ ⟨z₁, hz₁_bd.1, hz₁V, hz₁_bd⟩) + hz₁_bd.1 ⟨hz₁V, hz₂_bd⟩ + by_contra hlt + have hFV : (F ∩ H.V).ncard ≤ 2 := by omega + have hpair_sub : ({z₁, z₂} : Set S) ⊆ F ∩ H.V := by + rintro z (rfl | rfl) + · exact ⟨hz₁F, hz₁V⟩ + · exact ⟨hz₂F, hz₂V⟩ + have hFV_eq : F ∩ H.V = {z₁, z₂} := by + refine (Set.eq_of_subset_of_ncard_le hpair_sub ?_ + (H.finite_V.subset inter_subset_right)).symm + rw [Set.ncard_pair hz₁₂] + exact hFV + have hFU_sub_FV : F ∩ H.U ⊆ F ∩ H.V := fun z hz => ⟨hz.1, hFN hz⟩ + have hFU_eq : F ∩ H.U = {z₁, z₂} := + Subset.antisymm (hFU_sub_FV.trans hFV_eq.subset) + (hFV_eq ▸ inter_subset_inter_right _ H.V_subset_U) + obtain ⟨f⟩ := hF + have hLuv : IsLineWithEnds F (f 0).1 (f 1).1 := ⟨f, rfl, rfl⟩ + obtain ⟨a, ha, rfl, -, -⟩ := hLuv.exists_arc + obtain ⟨t₁, rfl⟩ := hz₁F + obtain ⟨t₂, rfl⟩ := hz₂F + have ht₁₂ : (t₁ : ℝ) ≠ (t₂ : ℝ) := fun he => hz₁₂ (congrArg a (Subtype.ext he)) + have hex_sub : ∃ F₁ : Set S, F₁ ⊆ range a ∧ + (IsLineWithEnds F₁ (a t₁) (a t₂) ∨ IsLineWithEnds F₁ (a t₂) (a t₁)) := by + rcases lt_or_gt_of_ne ht₁₂ with hlt_t | hgt_t + · refine ⟨range (pieceA a t₁ t₂), ?_, Or.inl ?_⟩ + · rw [range_pieceA a t₁.2.1 hlt_t.le t₂.2.2] + rintro x ⟨r, hr, rfl⟩ + exact ⟨⟨r, ⟨t₁.2.1.trans hr.1, hr.2.trans t₂.2.2⟩⟩, (extI_of_mem a _).symm⟩ + · have h := (isArcMap_pieceA ha t₁.2.1 hlt_t t₂.2.2).isLineWithEnds + rwa [pieceA_zero, pieceA_one, extI_coe, extI_coe] at h + · refine ⟨range (pieceA a t₂ t₁), ?_, Or.inr ?_⟩ + · rw [range_pieceA a t₂.2.1 hgt_t.le t₁.2.2] + rintro x ⟨r, hr, rfl⟩ + exact ⟨⟨r, ⟨t₂.2.1.trans hr.1, hr.2.trans t₁.2.2⟩⟩, (extI_of_mem a _).symm⟩ + · have h := (isArcMap_pieceA ha t₂.2.1 hgt_t t₁.2.2).isLineWithEnds + rwa [pieceA_zero, pieceA_one, extI_coe, extI_coe] at h + obtain ⟨F₁, hF₁_sub, hF₁_ends⟩ := hex_sub + have hF₁_line : IsLineWithEnds F₁ (a t₁) (a t₂) := + hF₁_ends.elim id Surface.IsLineWithEnds.symm + obtain ⟨hz₁F₁, hz₂F₁⟩ := ends_mem_of_isLineWithEnds hF₁_line + obtain ⟨w, hw⟩ := (GM11.isPathConnected_sdiff_pair hF₁_line).nonempty + have hF₁_diff_U : Disjoint (F₁ \ {a t₁, a t₂}) H.U := + disjoint_left.mpr fun z hz hzU => hz.2 (hFU_eq ▸ ⟨hF₁_sub hz.1, hzU⟩) + have hw_not_U : w ∉ H.U := disjoint_left.mp hF₁_diff_U hw + obtain ⟨r, hr, hw_r⟩ := GM11.exists_region_of_notMem hw_not_U + have hF₁_diff_r : F₁ \ {a t₁, a t₂} ⊆ r := + GM11.subset_region hr (GM11.isPathConnected_sdiff_pair hF₁_line).isConnected.isPreconnected + hF₁_diff_U hw hw_r + have hF₁_cl_r : F₁ ⊆ closure r := + (GM11.closure_sdiff_pair hF₁_line).symm.subset.trans (closure_mono hF₁_diff_r) + exact disjoint_left.mp + (hNo_common_region r hr ⟨a t₁, hF₁_cl_r hz₁F₁, hz₁V, hz₁_bd⟩) + (hF₁_cl_r hz₂F₁) ⟨hz₂V, hz₂_bd⟩ + +/-- **Graph Minors XV, (3.5), Claim (1)** (page 124): +"For every $O$-arc $F \subseteq \Sigma$ with $F \cap U(H') \subseteq V(H')$ and $|F \cap +V(H')| \le 2$, there is a dial $\Delta \subseteq \Sigma$ for $F, H' \cap \Sigma_1$ with $|X +\cap \Delta| \le |F \cap V(H')|$." -/ +theorem theorem_3_5_claim_1 {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) [ConnectedSpace S] + {H : Drawing S} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {θ : ℕ} {Λ₁ Λ₂ X₁ X₂ F : Set S} + (hRigid : IsRigid H) + (hT : IsTangle H.toHypergraph θ T) + (hθ : 3 ≤ θ) + (hΛ₁ : Λ₁ ∈ H.R) (hΛ₂ : Λ₂ ∈ H.R) + (hOArc₁ : IsOArc (subBd Λ₁)) (hOArc₂ : IsOArc (subBd Λ₂)) + (hNo_common_region : ∀ r ∈ H.R, (closure r ∩ (H.V ∩ subBd Λ₁)).Nonempty → + Disjoint (closure r) (H.V ∩ subBd Λ₂)) + (hX₁_sub : X₁ ⊆ H.V ∩ subBd Λ₁) (hX₂_sub : X₂ ⊆ H.V ∩ subBd Λ₂) + (hX₁_card : 2 < X₁.ncard) (hX₂_card : 2 < X₂.ncard) + (hFree₁ : IsFreeSet H.toHypergraph T θ X₁) + (hFree₂ : IsFreeSet H.toHypergraph T θ X₂) + (hF : IsOArc F) (hFU : F ∩ H.U ⊆ H.V) (hFV : (F ∩ H.V).ncard ≤ 2) : + ∃ Δ : Set S, IsDial H F Δ ∧ ((X₁ ∪ X₂) ∩ Δ).ncard ≤ (F ∩ H.V).ncard := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨Δ, hDial, hCard₁⟩ := theorem_3_3_claim_3 hS hRigid hT hθ hFree₁ hF hFU hFV + have hMemT : + ((H.interSet Δ).toHypergraph, (H.interSet (closure (univ \ Δ))).toHypergraph) ∈ T := + (theorem_3_1_proof H θ T Δ hS inferInstance hRigid hT hθ hDial.1 + (hDial.2.1 ▸ hFU) (hDial.2.1 ▸ hFV)).mpr (hDial.2.1.symm ▸ hDial) + obtain ⟨_, hOrd⟩ := isSeparation_interSet_of_isClosed H hDial.1.isClosed (hDial.2.1 ▸ hFU) + have hCard₂ : (X₂ ∩ Δ).ncard ≤ (F ∩ H.V).ncard := by + have hFree_sub : IsFreeSet H.toHypergraph T θ (X₂ ∩ Δ) := + hFree₂.subset hT inter_subset_left + have hSubA : X₂ ∩ Δ ⊆ (H.interSet Δ).toHypergraph.vertexSet := by + change X₂ ∩ Δ ⊆ (H.interSet Δ).V + rw [interSet_V_of_isClosed H hDial.1.isClosed] + exact inter_subset_inter_left Δ hFree₂.1 + exact hDial.2.1 ▸ hOrd ▸ hFree_sub.2.2 hMemT hSubA + refine ⟨Δ, hDial, ?_⟩ + by_cases hne₁ : (X₁ ∩ Δ).Nonempty + · by_cases hne₂ : (X₂ ∩ Δ).Nonempty + · exfalso + have hSubBd_U : ∀ {Λ : Set S}, Λ ∈ H.R → subBd Λ ⊆ H.U := by + intro Λ hΛ z hz + by_contra hz_not_U + obtain ⟨r, hr, hzr⟩ := GM11.exists_region_of_notMem hz_not_U + obtain ⟨w, hwr, hwΛ⟩ := mem_closure_iff.mp hz.1 r (GM11.region_isOpen hr) hzr + have hrΛ : r = Λ := GM11.region_eq_of_mem hr hΛ hwr hwΛ + have hzΛ : z ∈ Λ := hrΛ ▸ hzr + have hz_not_Λ : z ∉ Λ := by + have hz_fr : z ∈ frontier Λ := subBd_eq_frontier Λ ▸ hz + exact (GM11.region_isOpen hΛ).interior_eq ▸ hz_fr.2 + exact hz_not_Λ hzΛ + have hMeets : ∀ {Λ Y : Set S}, Λ ∈ H.R → IsOArc (subBd Λ) → Y ⊆ H.V ∩ subBd Λ → + 2 < Y.ncard → (Y ∩ Δ).ncard ≤ (F ∩ H.V).ncard → (Y ∩ Δ).Nonempty → + ∃ z, z ∈ F ∧ z ∈ H.V ∧ z ∈ subBd Λ := by + intro Λ Y hΛ hOArc hY_sub hY_card hY_le ⟨y₀, hy₀Y, hy₀Δ⟩ + have hnot_sub : ¬ (subBd Λ ⊆ Δ) := by + intro hsub + have hYΔ : Y ∩ Δ = Y := inter_eq_left.mpr (hY_sub.trans (inter_subset_right.trans hsub)) + have hle2 : Y.ncard ≤ 2 := hYΔ ▸ hY_le.trans hFV + omega + obtain ⟨y₁, hy₁_bd, hy₁_not_Δ⟩ := not_subset.mp hnot_sub + have hConn_bd : IsPreconnected (subBd Λ) := by + obtain ⟨φ⟩ := hOArc + have hEq : subBd Λ = range (fun z : Circle => (φ z).1) := by + ext w + exact ⟨fun hw => ⟨φ.symm ⟨w, hw⟩, by simp⟩, fun ⟨z, hz⟩ => hz ▸ (φ z).2⟩ + rw [hEq] + exact isPreconnected_range (continuous_subtype_val.comp φ.continuous) + have hne_fr : (subBd Λ ∩ frontier Δ).Nonempty := by + by_contra h + have hdis : Disjoint (subBd Λ) (frontier Δ) := + disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp h) + exact hy₁_not_Δ (GM14.subset_of_disjoint_frontier hConn_bd hDial.1.isClosed + hdis (hY_sub hy₀Y).2 hy₀Δ hy₁_bd) + obtain ⟨z, hz_bd, hz_fr⟩ := hne_fr + have hz_F : z ∈ F := hDial.2.1 ▸ (subBd_eq_frontier Δ).symm ▸ hz_fr + have hz_U : z ∈ H.U := hSubBd_U hΛ hz_bd + exact ⟨z, hz_F, hFU ⟨hz_F, hz_U⟩, hz_bd⟩ + obtain ⟨z₁, hz₁F, hz₁V, hz₁_bd⟩ := hMeets hΛ₁ hOArc₁ hX₁_sub hX₁_card hCard₁ hne₁ + obtain ⟨z₂, hz₂F, hz₂V, hz₂_bd⟩ := hMeets hΛ₂ hOArc₂ hX₂_sub hX₂_card hCard₂ hne₂ + have hz₁₂ : z₁ ≠ z₂ := by + intro h + subst h + exact disjoint_left.mp + (hNo_common_region Λ₁ hΛ₁ ⟨z₁, hz₁_bd.1, hz₁V, hz₁_bd⟩) + hz₁_bd.1 ⟨hz₁V, hz₂_bd⟩ + have hpair_sub : ({z₁, z₂} : Set S) ⊆ F ∩ H.V := by + rintro z (rfl | rfl) + · exact ⟨hz₁F, hz₁V⟩ + · exact ⟨hz₂F, hz₂V⟩ + have hFV_eq : F ∩ H.V = {z₁, z₂} := by + refine (Set.eq_of_subset_of_ncard_le hpair_sub ?_ + (H.finite_V.subset inter_subset_right)).symm + rw [Set.ncard_pair hz₁₂] + exact hFV + have hFU_sub_FV : F ∩ H.U ⊆ F ∩ H.V := fun z hz => ⟨hz.1, hFU hz⟩ + have hFU_eq : F ∩ H.U = {z₁, z₂} := + Subset.antisymm (hFU_sub_FV.trans hFV_eq.subset) + (hFV_eq ▸ inter_subset_inter_right _ H.V_subset_U) + obtain ⟨F₁, _, hF₁_line, _, hF_union, _⟩ := hF.lines hz₁F hz₂F hz₁₂ + have hF₁_sub : F₁ ⊆ F := hF_union ▸ subset_union_left + obtain ⟨hz₁F₁, hz₂F₁⟩ := ends_mem_of_isLineWithEnds hF₁_line + obtain ⟨w, hw⟩ := (GM11.isPathConnected_sdiff_pair hF₁_line).nonempty + have hF₁_diff_U : Disjoint (F₁ \ {z₁, z₂}) H.U := + disjoint_left.mpr fun z hz hzU => hz.2 (hFU_eq ▸ ⟨hF₁_sub hz.1, hzU⟩) + have hw_not_U : w ∉ H.U := disjoint_left.mp hF₁_diff_U hw + obtain ⟨r, hr, hw_r⟩ := GM11.exists_region_of_notMem hw_not_U + have hF₁_diff_r : F₁ \ {z₁, z₂} ⊆ r := + GM11.subset_region hr (GM11.isPathConnected_sdiff_pair hF₁_line).isConnected.isPreconnected + hF₁_diff_U hw hw_r + have hF₁_cl_r : F₁ ⊆ closure r := + (GM11.closure_sdiff_pair hF₁_line).symm.subset.trans (closure_mono hF₁_diff_r) + exact disjoint_left.mp + (hNo_common_region r hr ⟨z₁, hF₁_cl_r hz₁F₁, hz₁V, hz₁_bd⟩) + (hF₁_cl_r hz₂F₁) ⟨hz₂V, hz₂_bd⟩ + · rw [not_nonempty_iff_eq_empty] at hne₂ + rw [union_inter_distrib_right, hne₂, union_empty] + exact hCard₁ + · rw [not_nonempty_iff_eq_empty] at hne₁ + rw [union_inter_distrib_right, hne₁, empty_union] + exact hCard₂ + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/Section3Crosscap.lean b/LeanPool/GraphMinor/GM15/Section3Crosscap.lean new file mode 100644 index 0000000000..4dfff23ff1 --- /dev/null +++ b/LeanPool/GraphMinor/GM15/Section3Crosscap.lean @@ -0,0 +1,3921 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Section3Handle +import LeanPool.GraphMinor.GM14.DiscSlope + +import LeanPool.GraphMinor.GM12.Section5Final + +/-! +# Graph Minors XV, (3.3): Adding a Crosscap to a Surface Span + +This file proves **Graph Minors XV, (3.3)** (`theorem_3_3 : GM12Theorem52Statement → +GM15Theorem33Statement`): +given a `Σ`-span `(H, η, T)` of order `θ`, a region `Λ` of `H` bounded by a circuit containing +vertices `a₁, …, a_φ, b₁, …, b_φ` in circular order (`3 ≤ φ ≤ θ`) such that +`{a₁, …, a_φ, b₁, …, b_φ}` is free with respect to `T`, and `φ` pairwise vertex-disjoint +`η(H)`-paths `P₁, …, P_φ` in `G` joining `η(a_i)` and `η(b_i)`, there exists a `Σ'`-span +`(H', η', T')` of order `φ` on the surface `Σ'` obtained from `Σ` by adding a crosscap. + +The proof follows Robertson and Seymour, *Graph Minors. XV. Giant Steps*, pages 120–121: +1. Characterize `bd MobiusBand` as the range of a boundary circle embedding `mobBd : Circle → + MobiusBand` + sending antipodal points `z` and `-z` (`z.im > 0`) to `[(u, 0)]` and `[(u, 1)]` + (`bd_mobiusBand`). +2. Cut `MobiusBand` along one vertical line `{u₀} × [0, 1]` to obtain a striped closed disc in + `MobiusBand` (`exists_striped_disc_in_mobiusBand`). +3. Construct the unpinched and pinched crosscap splits (`isCappedSplit_crosscap_unpinched`, + `exists_pinched_crosscapSplit`), verify `IsRigid H'` via `theorem_3_2`, `theorem_3_3_claim_2`, + and `theorem_3_3_claim_3`, and apply XII (5.2) (`GM12Theorem52Statement`) to conclude + `theorem_3_3`. +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +open Set Function Topology Metric +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM12 GM14 +open scoped unitInterval + +universe u v w + +/-! ## 1. Boundary and Striped Discs in `MobiusBand` -/ + +/-- Vertical flip `(u, v) ↦ (u, 1 - v)` on `MobiusBand`. -/ +def mobFlip : MobiusBand → MobiusBand := + Quotient.lift + (fun p : unitInterval × unitInterval => + Quotient.mk Surface.mobiusSetoid (p.1, unitInterval.symm p.2)) + (by + intro p q h + apply Quotient.sound + rcases mobius_rel h with rfl | ⟨h1, h2, h3⟩ | ⟨h1, h2, h3⟩ + · exact Relation.EqvGen.refl _ + · exact Relation.EqvGen.rel _ _ ⟨h1, h2, by rw [h3]⟩ + · exact Relation.EqvGen.symm _ _ (Relation.EqvGen.rel _ _ ⟨h1, h2, by rw [h3]⟩)) + +theorem continuous_mobFlip : Continuous mobFlip := + Continuous.quotient_lift (continuous_quotient_mk'.comp + (continuous_fst.prodMk (unitInterval.continuous_symm.comp continuous_snd))) _ + +theorem mobFlip_involutive : Function.Involutive mobFlip := by + intro y + obtain ⟨⟨u, v⟩, rfl⟩ := Quotient.exists_rep y + change Quotient.mk Surface.mobiusSetoid (u, unitInterval.symm (unitInterval.symm v)) = + Quotient.mk Surface.mobiusSetoid (u, v) + simp + +/-- Horizontal half-shift on `unitInterval × unitInterval` into `MobiusBand`. -/ +noncomputable def mobShiftAux (p : unitInterval × unitInterval) : MobiusBand := + if (p.1 : ℝ) ≤ 1 / 2 then + Quotient.mk Surface.mobiusSetoid + (projIcc 0 1 zero_le_one ((p.1 : ℝ) + 1 / 2), p.2) + else + Quotient.mk Surface.mobiusSetoid + (projIcc 0 1 zero_le_one ((p.1 : ℝ) - 1 / 2), unitInterval.symm p.2) + +theorem continuous_mobShiftAux : Continuous mobShiftAux := by + unfold mobShiftAux + refine Continuous.if_le ?_ ?_ (continuous_subtype_val.comp continuous_fst) continuous_const ?_ + · exact continuous_quotient_mk'.comp (by fun_prop) + · exact continuous_quotient_mk'.comp (by fun_prop) + · intro p hp + have h1 : projIcc 0 1 zero_le_one ((p.1 : ℝ) + 1 / 2) = 1 := by + rw [projIcc_of_mem zero_le_one ⟨by linarith, by linarith⟩] + ext + dsimp + linarith + have h0 : projIcc 0 1 zero_le_one ((p.1 : ℝ) - 1 / 2) = 0 := by + rw [projIcc_of_mem zero_le_one ⟨by linarith, by linarith⟩] + ext + dsimp + linarith + rw [h1, h0] + apply Quotient.sound + exact Relation.EqvGen.symm _ _ (Relation.EqvGen.rel _ _ ⟨rfl, rfl, by simp⟩) + +/-- Horizontal half-shift on `MobiusBand`, sending `[(0, v)]` to `[(1/2, v)]`. -/ +noncomputable def mobShift : MobiusBand → MobiusBand := + Quotient.lift mobShiftAux (by + have hrel : ∀ p q : unitInterval × unitInterval, + p.1 = 0 → q.1 = 1 → q.2 = unitInterval.symm p.2 → mobShiftAux p = mobShiftAux q := by + intro p q hp1 hq1 hq2 + dsimp [mobShiftAux] + simp only [hp1, hq1, hq2, Icc.coe_zero, Icc.coe_one, zero_add, unitInterval.symm_symm] + norm_num + intro p q h + rcases mobius_rel h with rfl | ⟨h1, h2, h3⟩ | ⟨h1, h2, h3⟩ + · rfl + · exact hrel p q h1 h2 h3 + · exact (hrel q p h1 h2 h3).symm) + +theorem continuous_mobShift : Continuous mobShift := + Continuous.quotient_lift continuous_mobShiftAux _ + +theorem mobShift_mobShift (y : MobiusBand) : mobShift (mobShift y) = mobFlip y := by + obtain ⟨⟨u, v⟩, rfl⟩ := Quotient.exists_rep y + change mobShift (mobShiftAux (u, v)) = + Quotient.mk Surface.mobiusSetoid (u, unitInterval.symm v) + dsimp [mobShiftAux] + split_ifs with hu + · have hmem : (u : ℝ) + 1 / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [u.2.1], by linarith⟩ + have hproj : projIcc 0 1 zero_le_one ((u : ℝ) + 1 / 2) = ⟨(u : ℝ) + 1 / 2, hmem⟩ := + projIcc_of_mem zero_le_one hmem + change mobShiftAux (projIcc 0 1 zero_le_one ((u : ℝ) + 1 / 2), v) = _ + rw [hproj] + dsimp [mobShiftAux] + by_cases hzero : (u : ℝ) = 0 + · have hu0 : u = 0 := Subtype.ext hzero + subst hu0 + simp only [Icc.coe_zero, zero_add, le_refl, ↓reduceIte] + have h1 : projIcc 0 1 zero_le_one ((1 / 2 : ℝ) + 1 / 2) = 1 := by + rw [projIcc_of_mem zero_le_one ⟨by norm_num, by norm_num⟩] + ext; dsimp; norm_num + rw [h1] + apply Quotient.sound + exact Relation.EqvGen.symm _ _ (Relation.EqvGen.rel _ _ ⟨rfl, rfl, by simp⟩) + · have hgt : 0 < (u : ℝ) := lt_of_le_of_ne u.2.1 (Ne.symm hzero) + have hnot : ¬ ((u : ℝ) + 1 / 2 ≤ 1 / 2) := by linarith + simp only [hnot, ↓reduceIte, add_sub_cancel_right] + have hp : projIcc 0 1 zero_le_one (u : ℝ) = u := by + rw [projIcc_of_mem zero_le_one u.2] + rw [hp] + · have hmem : (u : ℝ) - 1 / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith, by linarith [u.2.2]⟩ + have hproj : projIcc 0 1 zero_le_one ((u : ℝ) - 1 / 2) = ⟨(u : ℝ) - 1 / 2, hmem⟩ := + projIcc_of_mem zero_le_one hmem + change mobShiftAux (projIcc 0 1 zero_le_one ((u : ℝ) - 1 / 2), unitInterval.symm v) = _ + rw [hproj] + dsimp [mobShiftAux] + have hle : (u : ℝ) - 1 / 2 ≤ 1 / 2 := by linarith [u.2.2] + simp only [hle, ↓reduceIte, sub_add_cancel] + have hp : projIcc 0 1 zero_le_one (u : ℝ) = u := by + rw [projIcc_of_mem zero_le_one u.2] + rw [hp] + +/-- Homeomorphism of `MobiusBand` shifting the horizontal coordinate by `1 / 2`. -/ +noncomputable def mobShiftHomeo : MobiusBand ≃ₜ MobiusBand where + toFun := mobShift + invFun := fun y => mobFlip (mobShift y) + left_inv y := by + dsimp + rw [mobShift_mobShift, mobFlip_involutive] + right_inv y := by + dsimp + have hflip : ∀ x, mobShift (mobFlip x) = mobFlip (mobShift x) := by + intro x + have h1 : mobShift (mobShift (mobShift x)) = mobShift (mobFlip x) := + congrArg mobShift (mobShift_mobShift x) + rw [mobShift_mobShift (mobShift x)] at h1 + exact h1.symm + rw [hflip, mobShift_mobShift, mobFlip_involutive] + continuous_toFun := continuous_mobShift + continuous_invFun := continuous_mobFlip.comp continuous_mobShift + +/-- Any point `[(u, v)]` in `MobiusBand` with `0 < u < 1` and `0 < v < 1` is an interior point. -/ +theorem mobius_interior_strict {u v : unitInterval} + (hu0 : 0 < (u : ℝ)) (hu1 : (u : ℝ) < 1) + (hv0 : 0 < (v : ℝ)) (hv1 : (v : ℝ) < 1) : + IsInteriorPoint (Quotient.mk Surface.mobiusSetoid (u, v)) := by + set s : ℝ := 1 - 2 * (u : ℝ) + set d : ℝ := 2 * (v : ℝ) - 1 + let w : ℂ := ⟨(s + d) / 2, (s - d) / 2⟩ + have hw : nn w < 1 := by + simp only [nn, w] + rcases abs_cases ((s + d) / 2) with h1 | h1 <;> + rcases abs_cases ((s - d) / 2) with h2 | h2 <;> + linarith + have hz : ‖mu w‖ < 1 := by rwa [norm_mu] + have hmem : ((0 : ℕ), mu w) ∈ Dsk (sW mobW) := by + refine ⟨?_, hz.le⟩ + rw [sW_zero] + simp [mobW] + have hz' : ‖((0 : ℕ), mu w).2‖ < 1 := hz + have h3 : IsInteriorPoint ((fun a : ℕ × ℂ => mobG a.2) (0, mu w)) := + isInteriorPoint_of_lt (W := sW mobW) (finW_sW mobW) presents_mob hmem hz' + replace h3 : IsInteriorPoint (mobG (mu w)) := h3 + have e : mobP (mu w) = (u, v) := by + apply Prod.ext + · apply Subtype.ext + rw [mobP_fst hz.le] + simp only [mobU, cylS, nu_mu, w] + linarith + · apply Subtype.ext + rw [mobP_snd hz.le] + simp only [mobV, nu_mu, w] + linarith + have h4 : mobG (mu w) = Quotient.mk Surface.mobiusSetoid (u, v) := by + simp only [mobG, e] + rwa [h4] at h3 + +/-- Any point `[(u, v)]` in `MobiusBand` with `0 < v < 1` is an interior point. -/ +theorem mobius_interior {u v : unitInterval} (hv0 : 0 < (v : ℝ)) (hv1 : (v : ℝ) < 1) : + IsInteriorPoint (Quotient.mk Surface.mobiusSetoid (u, v)) := by + rcases eq_or_lt_of_le u.2.1 with hu0 | hu0 + · have hu : u = 0 := Subtype.ext hu0.symm + subst hu + let half : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have hshift : mobShiftHomeo (Quotient.mk Surface.mobiusSetoid (0, v)) = + Quotient.mk Surface.mobiusSetoid (half, v) := by + change mobShiftAux (0, v) = Quotient.mk Surface.mobiusSetoid (half, v) + dsimp [mobShiftAux] + have hle : (0 : ℝ) ≤ 1 / 2 := by norm_num + simp only [hle, ↓reduceIte, zero_add] + congr 2 + exact projIcc_of_mem zero_le_one ⟨by norm_num, by norm_num⟩ + have hint : IsInteriorPoint (Quotient.mk Surface.mobiusSetoid (half, v)) := + mobius_interior_strict (by change (0 : ℝ) < 1 / 2; norm_num) + (by change (1 / 2 : ℝ) < 1; norm_num) hv0 hv1 + rw [← hshift] at hint + exact (isInteriorPoint_homeomorph_iff mobShiftHomeo _).mp hint + · rcases eq_or_lt_of_le u.2.2 with hu1 | hu1 + · have hu : u = 1 := Subtype.ext hu1 + subst hu + have heq : Quotient.mk Surface.mobiusSetoid (1, v) = + Quotient.mk Surface.mobiusSetoid (0, unitInterval.symm v) := by + apply Quotient.sound + exact Relation.EqvGen.symm _ _ (Relation.EqvGen.rel _ _ ⟨rfl, rfl, by simp⟩) + rw [heq] + let half : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have hshift : mobShiftHomeo (Quotient.mk Surface.mobiusSetoid (0, unitInterval.symm v)) = + Quotient.mk Surface.mobiusSetoid (half, unitInterval.symm v) := by + change mobShiftAux (0, unitInterval.symm v) = _ + dsimp [mobShiftAux] + have hle : (0 : ℝ) ≤ 1 / 2 := by norm_num + simp only [hle, ↓reduceIte, zero_add] + congr 2 + exact projIcc_of_mem zero_le_one ⟨by norm_num, by norm_num⟩ + have hint : IsInteriorPoint (Quotient.mk Surface.mobiusSetoid (half, unitInterval.symm v)) := + mobius_interior_strict (by change (0 : ℝ) < 1 / 2; norm_num) + (by change (1 / 2 : ℝ) < 1; norm_num) + (by simp only [unitInterval.coe_symm_eq]; linarith) + (by simp only [unitInterval.coe_symm_eq]; linarith) + rw [← hshift] at hint + exact (isInteriorPoint_homeomorph_iff mobShiftHomeo _).mp hint + · exact mobius_interior_strict hu0 hu1 hv0 hv1 + +/-- Upper semicircle parametrization from `unitInterval` to `Circle`: +`u ↦ ⟨1 - 2u, √(1 - (1 - 2u)²)⟩`. -/ +noncomputable def circleTop (u : unitInterval) : Circle := + ⟨⟨1 - 2 * (u : ℝ), Real.sqrt (1 - (1 - 2 * (u : ℝ)) ^ 2)⟩, by + refine mem_sphere_zero_iff_norm.mpr ?_ + rw [Complex.norm_eq_sqrt_sq_add_sq] + dsimp + have hnonneg : 0 ≤ 1 - (1 - 2 * (u : ℝ)) ^ 2 := by + have : 1 - (1 - 2 * (u : ℝ)) ^ 2 = 4 * (u : ℝ) * (1 - (u : ℝ)) := by ring + rw [this] + nlinarith [u.2.1, u.2.2] + rw [Real.sq_sqrt hnonneg, add_sub_cancel, Real.sqrt_one]⟩ + +/-- Lower semicircle parametrization from `unitInterval` to `Circle`: +`u ↦ ⟨2u - 1, -√(1 - (1 - 2u)²)⟩`. -/ +noncomputable def circleBot (u : unitInterval) : Circle := + ⟨⟨2 * (u : ℝ) - 1, - Real.sqrt (1 - (1 - 2 * (u : ℝ)) ^ 2)⟩, by + refine mem_sphere_zero_iff_norm.mpr ?_ + rw [Complex.norm_eq_sqrt_sq_add_sq] + dsimp + have hnonneg : 0 ≤ 1 - (1 - 2 * (u : ℝ)) ^ 2 := by + have : 1 - (1 - 2 * (u : ℝ)) ^ 2 = 4 * (u : ℝ) * (1 - (u : ℝ)) := by ring + rw [this] + nlinarith [u.2.1, u.2.2] + have hsq : (2 * (u : ℝ) - 1) ^ 2 = (1 - 2 * (u : ℝ)) ^ 2 := by ring + rw [neg_sq, Real.sq_sqrt hnonneg, hsq, add_sub_cancel, Real.sqrt_one]⟩ + +theorem continuous_circleTop : Continuous circleTop := by + unfold circleTop + refine Continuous.subtype_mk ?_ _ + have h1 : Continuous (fun u : unitInterval => (1 - 2 * (u : ℝ) : ℂ)) := by fun_prop + have h2 : Continuous (fun u : unitInterval => + ((Real.sqrt (1 - (1 - 2 * (u : ℝ)) ^ 2) : ℝ) : ℂ) * Complex.I) := by fun_prop + refine (h1.add h2).congr fun u => ?_ + apply Complex.ext <;> simp + +theorem continuous_circleBot : Continuous circleBot := by + unfold circleBot + refine Continuous.subtype_mk ?_ _ + have h1 : Continuous (fun u : unitInterval => (2 * (u : ℝ) - 1 : ℂ)) := by fun_prop + have h2 : Continuous (fun u : unitInterval => + ((- Real.sqrt (1 - (1 - 2 * (u : ℝ)) ^ 2) : ℝ) : ℂ) * Complex.I) := by fun_prop + refine (h1.add h2).congr fun u => ?_ + apply Complex.ext <;> simp + +@[simp] +theorem circleTop_zero : circleTop 0 = 1 := by + apply Subtype.ext + apply Complex.ext <;> simp [circleTop] + +@[simp] +theorem circleTop_one : circleTop 1 = -1 := by + apply Subtype.ext + apply Complex.ext <;> norm_num [circleTop] + +@[simp] +theorem circleBot_zero : circleBot 0 = -1 := by + apply Subtype.ext + apply Complex.ext <;> norm_num [circleBot] + +@[simp] +theorem circleBot_one : circleBot 1 = 1 := by + apply Subtype.ext + apply Complex.ext <;> norm_num [circleBot] + +theorem circleTop_im_nonneg (u : unitInterval) : 0 ≤ (circleTop u : ℂ).im := + Real.sqrt_nonneg _ + +theorem circleBot_im_nonpos (u : unitInterval) : (circleBot u : ℂ).im ≤ 0 := by + change - Real.sqrt _ ≤ 0 + linarith [Real.sqrt_nonneg (1 - (1 - 2 * (u : ℝ)) ^ 2)] + +/-- First coordinate on `unitInterval` of a point `z : Circle` on the upper semicircle. -/ +noncomputable def mobBdTopU (z : Circle) : unitInterval := + projIcc 0 1 zero_le_one ((1 - (z : ℂ).re) / 2) + +/-- First coordinate on `unitInterval` of a point `z : Circle` on the lower semicircle. -/ +noncomputable def mobBdBotU (z : Circle) : unitInterval := + projIcc 0 1 zero_le_one ((1 + (z : ℂ).re) / 2) + +theorem circle_re_mem_Icc (z : Circle) : (z : ℂ).re ∈ Icc (-1 : ℝ) 1 := by + have h1 : |(z : ℂ).re| ≤ ‖(z : ℂ)‖ := Complex.abs_re_le_norm z + rw [Circle.norm_coe] at h1 + exact abs_le.mp h1 + +theorem circle_re_sq_add_im_sq (z : Circle) : (z : ℂ).re ^ 2 + (z : ℂ).im ^ 2 = 1 := by + have h := Complex.normSq_eq_norm_sq (z : ℂ) + rw [Circle.norm_coe, one_pow, Complex.normSq_apply] at h + linarith + +theorem mobBdTopU_coe (z : Circle) : (mobBdTopU z : ℝ) = (1 - (z : ℂ).re) / 2 := by + have hre := circle_re_mem_Icc z + exact congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith [hre.2], by linarith [hre.1]⟩) + +theorem mobBdBotU_coe (z : Circle) : (mobBdBotU z : ℝ) = (1 + (z : ℂ).re) / 2 := by + have hre := circle_re_mem_Icc z + exact congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith [hre.1], by linarith [hre.2]⟩) + +@[simp] +theorem mobBdTopU_circleTop (u : unitInterval) : mobBdTopU (circleTop u) = u := by + apply Subtype.ext + rw [mobBdTopU_coe] + change (1 - (1 - 2 * (u : ℝ))) / 2 = (u : ℝ) + ring + +@[simp] +theorem mobBdBotU_circleBot (u : unitInterval) : mobBdBotU (circleBot u) = u := by + apply Subtype.ext + rw [mobBdBotU_coe] + change (1 + (2 * (u : ℝ) - 1)) / 2 = (u : ℝ) + ring + +theorem circleTop_mobBdTopU {z : Circle} (hz : 0 ≤ (z : ℂ).im) : + circleTop (mobBdTopU z) = z := by + have hsq := circle_re_sq_add_im_sq z + apply Subtype.ext + apply Complex.ext + · change 1 - 2 * (mobBdTopU z : ℝ) = (z : ℂ).re + rw [mobBdTopU_coe] + ring + · change Real.sqrt (1 - (1 - 2 * (mobBdTopU z : ℝ)) ^ 2) = (z : ℂ).im + rw [mobBdTopU_coe] + have heq : 1 - (1 - 2 * ((1 - (z : ℂ).re) / 2)) ^ 2 = (z : ℂ).im ^ 2 := by linarith + rw [heq, Real.sqrt_sq hz] + +theorem circleBot_mobBdBotU {z : Circle} (hz : (z : ℂ).im ≤ 0) : + circleBot (mobBdBotU z) = z := by + have hsq := circle_re_sq_add_im_sq z + apply Subtype.ext + apply Complex.ext + · change 2 * (mobBdBotU z : ℝ) - 1 = (z : ℂ).re + rw [mobBdBotU_coe] + ring + · change - Real.sqrt (1 - (1 - 2 * (mobBdBotU z : ℝ)) ^ 2) = (z : ℂ).im + rw [mobBdBotU_coe] + have heq : 1 - (1 - 2 * ((1 + (z : ℂ).re) / 2)) ^ 2 = (- (z : ℂ).im) ^ 2 := by linarith + rw [heq, Real.sqrt_sq (by linarith), neg_neg] + +/-- Boundary circle parametrization of `MobiusBand`: +maps the upper semicircle (`0 ≤ z.im`) to `[(mobBdTopU z, 0)]` and the lower semicircle +(`z.im ≤ 0`) to `[(mobBdBotU z, 1)]`. -/ +noncomputable def mobBd (z : Circle) : MobiusBand := + if 0 ≤ (z : ℂ).im then + Quotient.mk Surface.mobiusSetoid (mobBdTopU z, 0) + else + Quotient.mk Surface.mobiusSetoid (mobBdBotU z, 1) + +theorem mobBd_of_im_nonneg {z : Circle} (hz : 0 ≤ (z : ℂ).im) : + mobBd z = Quotient.mk Surface.mobiusSetoid (mobBdTopU z, 0) := by + dsimp [mobBd] + simp only [hz, ↓reduceIte] + +theorem mobBd_of_im_nonpos {z : Circle} (hz : (z : ℂ).im ≤ 0) : + mobBd z = Quotient.mk Surface.mobiusSetoid (mobBdBotU z, 1) := by + dsimp [mobBd] + split_ifs with h + · have him0 : (z : ℂ).im = 0 := le_antisymm hz h + have hsq := circle_re_sq_add_im_sq z + rw [him0] at hsq + have hre_sq : (z : ℂ).re ^ 2 = 1 := by linarith + rcases sq_eq_one_iff.mp hre_sq with hre1 | hre_neg1 + · have ht : mobBdTopU z = 0 := by + apply Subtype.ext; rw [mobBdTopU_coe, hre1]; norm_num + have hb : mobBdBotU z = 1 := by + apply Subtype.ext; rw [mobBdBotU_coe, hre1]; norm_num + rw [ht, hb] + apply Quotient.sound + exact Relation.EqvGen.rel _ _ ⟨rfl, rfl, by simp⟩ + · have ht : mobBdTopU z = 1 := by + apply Subtype.ext; rw [mobBdTopU_coe, hre_neg1]; norm_num + have hb : mobBdBotU z = 0 := by + apply Subtype.ext; rw [mobBdBotU_coe, hre_neg1]; norm_num + rw [ht, hb] + apply Quotient.sound + exact Relation.EqvGen.symm _ _ (Relation.EqvGen.rel _ _ ⟨rfl, rfl, by simp⟩) + · rfl + +@[simp] +theorem mobBd_circleTop (u : unitInterval) : + mobBd (circleTop u) = Quotient.mk Surface.mobiusSetoid (u, 0) := by + rw [mobBd_of_im_nonneg (circleTop_im_nonneg u), mobBdTopU_circleTop] + +@[simp] +theorem mobBd_circleBot (u : unitInterval) : + mobBd (circleBot u) = Quotient.mk Surface.mobiusSetoid (u, 1) := by + rw [mobBd_of_im_nonpos (circleBot_im_nonpos u), mobBdBotU_circleBot] + +theorem continuous_mobBd : Continuous mobBd := by + unfold mobBd + refine Continuous.if_le ?_ ?_ continuous_const + (Complex.continuous_im.comp continuous_subtype_val) ?_ + · unfold mobBdTopU + exact continuous_quotient_mk'.comp (by fun_prop) + · unfold mobBdBotU + exact continuous_quotient_mk'.comp (by fun_prop) + · intro z hz + have h := mobBd_of_im_nonpos (z := z) (by linarith) + dsimp [mobBd] at h + have h0 : 0 ≤ (z : ℂ).im := by linarith + simpa [h0] using h + +theorem injective_mobBd : Function.Injective mobBd := by + intro z₁ z₂ heq + by_cases h1 : 0 ≤ (z₁ : ℂ).im <;> by_cases h2 : 0 ≤ (z₂ : ℂ).im + · rw [mobBd_of_im_nonneg h1, mobBd_of_im_nonneg h2] at heq + rcases mobius_rel (Quotient.exact heq) with h | ⟨_, _, h3⟩ | ⟨_, _, h3⟩ + · have hu : mobBdTopU z₁ = mobBdTopU z₂ := Prod.ext_iff.mp h |>.1 + rw [← circleTop_mobBdTopU h1, ← circleTop_mobBdTopU h2, hu] + · exact absurd (congrArg Subtype.val h3) (by simp) + · exact absurd (congrArg Subtype.val h3) (by simp) + · have h2' : (z₂ : ℂ).im < 0 := lt_of_not_ge h2 + rw [mobBd_of_im_nonneg h1, mobBd_of_im_nonpos h2'.le] at heq + rcases mobius_rel (Quotient.exact heq) with h | ⟨hu1, hu2, _⟩ | ⟨hu2, hu1, _⟩ + · exact absurd (congrArg Subtype.val (Prod.ext_iff.mp h).2) (by simp) + · have hre : (z₂ : ℂ).re = 1 := by + have hval : (mobBdBotU z₂ : ℝ) = 1 := congrArg Subtype.val hu2 + rw [mobBdBotU_coe] at hval + linarith + have hsq := circle_re_sq_add_im_sq z₂ + rw [hre] at hsq + nlinarith + · have hre : (z₂ : ℂ).re = -1 := by + have hval : (mobBdBotU z₂ : ℝ) = 0 := congrArg Subtype.val hu2 + rw [mobBdBotU_coe] at hval + linarith + have hsq := circle_re_sq_add_im_sq z₂ + rw [hre] at hsq + nlinarith + · have h1' : (z₁ : ℂ).im < 0 := lt_of_not_ge h1 + rw [mobBd_of_im_nonpos h1'.le, mobBd_of_im_nonneg h2] at heq + rcases mobius_rel (Quotient.exact heq) with h | ⟨hu1, hu2, _⟩ | ⟨hu2, hu1, _⟩ + · exact absurd (congrArg Subtype.val (Prod.ext_iff.mp h).2) (by simp) + · have hre : (z₁ : ℂ).re = -1 := by + have hval : (mobBdBotU z₁ : ℝ) = 0 := congrArg Subtype.val hu1 + rw [mobBdBotU_coe] at hval + linarith + have hsq := circle_re_sq_add_im_sq z₁ + rw [hre] at hsq + nlinarith + · have hre : (z₁ : ℂ).re = 1 := by + have hval : (mobBdBotU z₁ : ℝ) = 1 := congrArg Subtype.val hu1 + rw [mobBdBotU_coe] at hval + linarith + have hsq := circle_re_sq_add_im_sq z₁ + rw [hre] at hsq + nlinarith + · have h1' : (z₁ : ℂ).im < 0 := lt_of_not_ge h1 + have h2' : (z₂ : ℂ).im < 0 := lt_of_not_ge h2 + rw [mobBd_of_im_nonpos h1'.le, mobBd_of_im_nonpos h2'.le] at heq + rcases mobius_rel (Quotient.exact heq) with h | ⟨_, _, h3⟩ | ⟨_, _, h3⟩ + · have hu : mobBdBotU z₁ = mobBdBotU z₂ := Prod.ext_iff.mp h |>.1 + rw [← circleBot_mobBdBotU h1'.le, ← circleBot_mobBdBotU h2'.le, hu] + · exact absurd (congrArg Subtype.val h3) (by simp) + · exact absurd (congrArg Subtype.val h3) (by simp) + +theorem isEmbedding_mobBd : IsEmbedding mobBd := + (continuous_mobBd.isClosedEmbedding injective_mobBd).isEmbedding + +theorem range_mobBd : + range mobBd = {y : MobiusBand | ∃ u : unitInterval, + y = Quotient.mk Surface.mobiusSetoid (u, 0) ∨ + y = Quotient.mk Surface.mobiusSetoid (u, 1)} := by + ext y + constructor + · rintro ⟨z, rfl⟩ + by_cases hz : 0 ≤ (z : ℂ).im + · exact ⟨mobBdTopU z, .inl (mobBd_of_im_nonneg hz)⟩ + · exact ⟨mobBdBotU z, .inr (mobBd_of_im_nonpos (lt_of_not_ge hz).le)⟩ + · rintro ⟨u, rfl | rfl⟩ + · exact ⟨circleTop u, mobBd_circleTop u⟩ + · exact ⟨circleBot u, mobBd_circleBot u⟩ + +/-- The boundary of `MobiusBand` is the range of `mobBd`. -/ +theorem bd_mobiusBand : bd MobiusBand = range mobBd := by + have hsub : bd MobiusBand ⊆ range mobBd := by + intro y hy + obtain ⟨⟨u, v⟩, rfl⟩ := Quotient.exists_rep y + rw [range_mobBd] + rcases eq_or_lt_of_le v.2.1 with hv0 | hv0 + · exact ⟨u, .inl (by congr 2; exact Subtype.ext hv0.symm)⟩ + · rcases eq_or_lt_of_le v.2.2 with hv1 | hv1 + · exact ⟨u, .inr (by congr 2; exact Subtype.ext hv1)⟩ + · exact (hy (mobius_interior hv0 hv1)).elim + obtain ⟨m_mob⟩ := nonempty_mob_homeo + have hO : IsOArc (bd MobiusBand) := isOArc_bd_one m_mob + exact oarc_eq isEmbedding_mobBd.toHomeomorph hO hsub + +/-- Map from `ℂ` to `MobiusBand` used to build striped closed discs by cutting along `{u₀} × [0, +1]`. +Here `z.re - 1 ∈ [0, 1]` is the vertical coordinate `v`, and `z.im` (or `z.im - 1`) is the +horizontal coordinate `u`. -/ +noncomputable def mobRectMap (z : ℂ) : MobiusBand := + if z.im ≤ 1 then + Quotient.mk Surface.mobiusSetoid + (projIcc 0 1 zero_le_one z.im, projIcc 0 1 zero_le_one (z.re - 1)) + else + Quotient.mk Surface.mobiusSetoid + (projIcc 0 1 zero_le_one (z.im - 1), + unitInterval.symm (projIcc 0 1 zero_le_one (z.re - 1))) + +theorem continuous_mobRectMap : Continuous mobRectMap := by + unfold mobRectMap + refine Continuous.if_le ?_ ?_ Complex.continuous_im continuous_const ?_ + · exact continuous_quotient_mk'.comp (by fun_prop) + · exact continuous_quotient_mk'.comp (by fun_prop) + · intro z hz + have h1 : projIcc 0 1 zero_le_one z.im = 1 := by + rw [hz, projIcc_of_mem zero_le_one ⟨by norm_num, by norm_num⟩] + rfl + have h0 : projIcc 0 1 zero_le_one (z.im - 1) = 0 := by + rw [hz, sub_self, projIcc_of_mem zero_le_one ⟨by norm_num, by norm_num⟩] + rfl + rw [h1, h0] + apply Quotient.sound + exact Relation.EqvGen.symm _ _ (Relation.EqvGen.rel _ _ ⟨rfl, rfl, by simp⟩) + +theorem injOn_mobRectMap (u₀ : unitInterval) (ε : ℝ) + (hε0 : 0 < ε) (hε_u0 : ε < (u₀ : ℝ)) (hε_u1 : ε < 1 - (u₀ : ℝ)) : + InjOn mobRectMap (Icc (1 : ℝ) 2 ×ℂ Icc ((u₀ : ℝ) + ε) ((u₀ : ℝ) + 1 - ε)) := by + intro z₁ hz₁ z₂ hz₂ heq + obtain ⟨hz₁_re, hz₁_im⟩ := Complex.mem_reProdIm.mp hz₁ + obtain ⟨hz₂_re, hz₂_im⟩ := Complex.mem_reProdIm.mp hz₂ + have hv₁ : (projIcc 0 1 zero_le_one (z₁.re - 1) : ℝ) = z₁.re - 1 := + congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith [hz₁_re.1], by linarith + [hz₁_re.2]⟩) + have hv₂ : (projIcc 0 1 zero_le_one (z₂.re - 1) : ℝ) = z₂.re - 1 := + congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith [hz₂_re.1], by linarith + [hz₂_re.2]⟩) + dsimp [mobRectMap] at heq + split_ifs at heq with h1 h2 h2 + · have hu₁ : (projIcc 0 1 zero_le_one z₁.im : ℝ) = z₁.im := + congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith [hz₁_im.1], h1⟩) + have hu₂ : (projIcc 0 1 zero_le_one z₂.im : ℝ) = z₂.im := + congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith [hz₂_im.1], h2⟩) + rcases mobius_rel (Quotient.exact heq) with h | ⟨ha, _, _⟩ | ⟨ha, _, _⟩ + · have hp := Prod.ext_iff.mp h + have him : z₁.im = z₂.im := by linarith [congrArg Subtype.val hp.1] + have hre : z₁.re = z₂.re := by linarith [congrArg Subtype.val hp.2] + exact Complex.ext hre him + · have : (projIcc 0 1 zero_le_one z₁.im : ℝ) = 0 := congrArg Subtype.val ha + linarith [hz₁_im.1] + · have : (projIcc 0 1 zero_le_one z₂.im : ℝ) = 0 := congrArg Subtype.val ha + linarith [hz₂_im.1] + · have hu₁ : (projIcc 0 1 zero_le_one z₁.im : ℝ) = z₁.im := + congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith [hz₁_im.1], h1⟩) + have hu₂ : (projIcc 0 1 zero_le_one (z₂.im - 1) : ℝ) = z₂.im - 1 := + congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith, by linarith [hz₂_im.2]⟩) + rcases mobius_rel (Quotient.exact heq) with h | ⟨ha, _, _⟩ | ⟨ha, _, _⟩ + · have hp := Prod.ext_iff.mp h + have : z₁.im = z₂.im - 1 := by linarith [congrArg Subtype.val hp.1] + linarith [hz₁_im.1, hz₂_im.2] + · have : (projIcc 0 1 zero_le_one z₁.im : ℝ) = 0 := congrArg Subtype.val ha + linarith [hz₁_im.1] + · have : (projIcc 0 1 zero_le_one (z₂.im - 1) : ℝ) = 0 := congrArg Subtype.val ha + linarith + · have hu₁ : (projIcc 0 1 zero_le_one (z₁.im - 1) : ℝ) = z₁.im - 1 := + congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith, by linarith [hz₁_im.2]⟩) + have hu₂ : (projIcc 0 1 zero_le_one z₂.im : ℝ) = z₂.im := + congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith [hz₂_im.1], h2⟩) + rcases mobius_rel (Quotient.exact heq) with h | ⟨ha, _, _⟩ | ⟨ha, _, _⟩ + · have hp := Prod.ext_iff.mp h + have : z₁.im - 1 = z₂.im := by linarith [congrArg Subtype.val hp.1] + linarith [hz₁_im.2, hz₂_im.1] + · have : (projIcc 0 1 zero_le_one (z₁.im - 1) : ℝ) = 0 := congrArg Subtype.val ha + linarith + · have : (projIcc 0 1 zero_le_one z₂.im : ℝ) = 0 := congrArg Subtype.val ha + linarith [hz₂_im.1] + · have hu₁ : (projIcc 0 1 zero_le_one (z₁.im - 1) : ℝ) = z₁.im - 1 := + congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith, by linarith [hz₁_im.2]⟩) + have hu₂ : (projIcc 0 1 zero_le_one (z₂.im - 1) : ℝ) = z₂.im - 1 := + congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith, by linarith [hz₂_im.2]⟩) + rcases mobius_rel (Quotient.exact heq) with h | ⟨ha, _, _⟩ | ⟨ha, _, _⟩ + · have hp := Prod.ext_iff.mp h + have him : z₁.im = z₂.im := by linarith [congrArg Subtype.val hp.1] + have hsymm : projIcc 0 1 zero_le_one (z₁.re - 1) = projIcc 0 1 zero_le_one (z₂.re - 1) := by + have := congrArg unitInterval.symm hp.2 + simpa using this + have hre : z₁.re = z₂.re := by linarith [congrArg Subtype.val hsymm] + exact Complex.ext hre him + · have : (projIcc 0 1 zero_le_one (z₁.im - 1) : ℝ) = 0 := congrArg Subtype.val ha + linarith + · have : (projIcc 0 1 zero_le_one (z₂.im - 1) : ℝ) = 0 := congrArg Subtype.val ha + linarith + +private theorem compact_set_avoiding_vertical_line_lies_in_open_strip + (u₀ : unitInterval) + {K_all : Set MobiusBand} : + let Q_all : Set (unitInterval × unitInterval) := Quotient.mk Surface.mobiusSetoid ⁻¹' K_all + let U_set : Set unitInterval := Prod.fst '' Q_all ∪ {0, 1} + ∀ (ε : ℝ), + (0 < ε) → + (ε < (u₀ : ℝ)) → + (ε < 1 - (u₀ : ℝ)) → + (ε < infDist u₀ U_set) → + let U_ε : Set ℂ := Icc (1 : ℝ) 2 ×ℂ Ioo ((u₀ : ℝ) + ε) ((u₀ : ℝ) + 1 - ε) + K_all ⊆ mobRectMap '' U_ε := by + intro Q_all U_set ε hε0 hε_u0 hε_u1 hε_dist U_ε y hy + obtain ⟨⟨u, v⟩, rfl⟩ := Quotient.exists_rep y + have hu_U : u ∈ U_set := .inl ⟨(u, v), hy, rfl⟩ + have hdist : Metric.infDist u₀ U_set ≤ dist u₀ u := Metric.infDist_le_dist_of_mem hu_U + have h_abs : ε < |(u : ℝ) - (u₀ : ℝ)| := by + have : Dist.dist u₀ u = |(u : ℝ) - (u₀ : ℝ)| := by + rw [_root_.dist_comm] + exact Real.dist_eq (u : ℝ) (u₀ : ℝ) + exact hε_dist.trans_le (this ▸ hdist) + have hu_ne : (u : ℝ) ≠ (u₀ : ℝ) := by + intro heq + rw [heq, sub_self, abs_zero] at h_abs + exact (not_lt.mpr hε0.le h_abs) + rcases lt_or_gt_of_ne hu_ne with hlt | hgt + · have hu_lt : (u : ℝ) < (u₀ : ℝ) - ε := by + rw [abs_of_neg (by linarith)] at h_abs + linarith + rcases eq_or_lt_of_le u.2.1 with hu0_eq | hu0_pos + · have hu0 : u = 0 := Subtype.ext hu0_eq.symm + subst hu0 + let z : ℂ := ⟨1 + (1 - (v : ℝ)), 1⟩ + have hz_re : z.re ∈ Icc (1 : ℝ) 2 := by + constructor <;> dsimp [z] <;> linarith [v.2.2, v.2.1] + have hz_im : z.im ∈ Ioo ((u₀ : ℝ) + ε) ((u₀ : ℝ) + 1 - ε) := + ⟨by dsimp [z]; linarith [hε_u1], by dsimp [z]; linarith [hε_u0, hu_lt]⟩ + refine ⟨z, Complex.mem_reProdIm.mpr ⟨hz_re, hz_im⟩, ?_⟩ + dsimp [mobRectMap, z] + simp only [le_refl, ↓reduceIte, add_sub_cancel_left] + have h1 : projIcc 0 1 zero_le_one (1 : ℝ) = 1 := + projIcc_of_mem zero_le_one ⟨by norm_num, by norm_num⟩ + have hv' : projIcc 0 1 zero_le_one (1 - (v : ℝ)) = unitInterval.symm v := + projIcc_of_mem zero_le_one (unitInterval.symm v).2 + rw [h1, hv'] + apply Quotient.sound + exact Relation.EqvGen.symm _ _ (Relation.EqvGen.rel _ _ ⟨rfl, rfl, rfl⟩) + · let z : ℂ := ⟨1 + (1 - (v : ℝ)), (u : ℝ) + 1⟩ + have hz_re : z.re ∈ Icc (1 : ℝ) 2 := by + constructor <;> dsimp [z] <;> linarith [v.2.2, v.2.1] + have hz_im : z.im ∈ Ioo ((u₀ : ℝ) + ε) ((u₀ : ℝ) + 1 - ε) := + ⟨by dsimp [z]; linarith, by dsimp [z]; linarith⟩ + refine ⟨z, Complex.mem_reProdIm.mpr ⟨hz_re, hz_im⟩, ?_⟩ + dsimp [mobRectMap, z] + have hnot : ¬ ((u : ℝ) + 1 ≤ 1) := by linarith + simp only [hnot, ↓reduceIte, add_sub_cancel_right, add_sub_cancel_left] + have hu' : projIcc 0 1 zero_le_one (u : ℝ) = u := projIcc_of_mem zero_le_one u.2 + have hv' : projIcc 0 1 zero_le_one (1 - (v : ℝ)) = unitInterval.symm v := + projIcc_of_mem zero_le_one (unitInterval.symm v).2 + rw [hu', hv', unitInterval.symm_symm] + · have hu_gt : (u₀ : ℝ) + ε < (u : ℝ) := by + rw [abs_of_pos (by linarith)] at h_abs + linarith + let z : ℂ := ⟨1 + (v : ℝ), (u : ℝ)⟩ + have hz_re : z.re ∈ Icc (1 : ℝ) 2 := by + constructor <;> dsimp [z] <;> linarith [v.2.1, v.2.2] + have hz_im : z.im ∈ Ioo ((u₀ : ℝ) + ε) ((u₀ : ℝ) + 1 - ε) := + ⟨by dsimp [z]; linarith, by dsimp [z]; linarith [u.2.2]⟩ + refine ⟨z, Complex.mem_reProdIm.mpr ⟨hz_re, hz_im⟩, ?_⟩ + dsimp [mobRectMap, z] + simp only [u.2.2, ↓reduceIte, add_sub_cancel_left] + have hu' : projIcc 0 1 zero_le_one (u : ℝ) = u := projIcc_of_mem zero_le_one u.2 + have hv' : projIcc 0 1 zero_le_one (v : ℝ) = v := projIcc_of_mem zero_le_one v.2 + rw [hu', hv'] + +private theorem closed_strip_avoids_vertical_line + (u₀ : unitInterval) + (ε : ℝ) + (hε0 : 0 < ε) + (hε_u0 : ε < (u₀ : ℝ)) + (hε_u1 : ε < 1 - (u₀ : ℝ)) : + let R_ε : Set ℂ := Icc (1 : ℝ) 2 ×ℂ Icc ((u₀ : ℝ) + ε) ((u₀ : ℝ) + 1 - ε) + let D_mob : Set MobiusBand := mobRectMap '' R_ε + Disjoint D_mob (Quotient.mk Surface.mobiusSetoid '' {u₀} ×ˢ univ) := by + intro R_ε D_mob + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨z, hzR, rfl⟩ ⟨⟨u', v⟩, ⟨hu'_eq, _⟩, heq⟩ + have hu' : u₀ = u' := hu'_eq.symm + subst hu' + replace heq := heq.symm + obtain ⟨_, hz_im⟩ := Complex.mem_reProdIm.mp hzR + dsimp [mobRectMap] at heq + split_ifs at heq with h1 + · have hu : (projIcc 0 1 zero_le_one z.im : ℝ) = z.im := + congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith [hz_im.1], h1⟩) + rcases mobius_rel (Quotient.exact heq) with h | ⟨ha, _, _⟩ | ⟨ha, _, _⟩ + · have : z.im = (u₀ : ℝ) := by linarith [congrArg Subtype.val (Prod.ext_iff.mp h).1] + linarith [hz_im.1] + · have : (projIcc 0 1 zero_le_one z.im : ℝ) = 0 := congrArg Subtype.val ha + linarith [hz_im.1] + · have : (u₀ : ℝ) = 0 := congrArg Subtype.val ha + linarith + · have hu : (projIcc 0 1 zero_le_one (z.im - 1) : ℝ) = z.im - 1 := + congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith, by linarith [hz_im.2]⟩) + rcases mobius_rel (Quotient.exact heq) with h | ⟨ha, _, _⟩ | ⟨ha, _, _⟩ + · have : z.im - 1 = (u₀ : ℝ) := by linarith [congrArg Subtype.val (Prod.ext_iff.mp h).1] + linarith [hz_im.2] + · have : (projIcc 0 1 zero_le_one (z.im - 1) : ℝ) = 0 := congrArg Subtype.val ha + linarith + · have : (u₀ : ℝ) = 0 := congrArg Subtype.val ha + linarith + +/-- Cutting `MobiusBand` along a vertical line `{u₀} × [0, 1]` (`0 < u₀ < 1`) disjoint from a +closed set `K_all ⊆ MobiusBand` yields a closed disc `D_mob ⊆ MobiusBand` containing `K_all`. -/ +theorem exists_striped_disc_in_mobiusBand (u₀ : unitInterval) + (hu₀0 : 0 < (u₀ : ℝ)) (hu₀1 : (u₀ : ℝ) < 1) + {K_all : Set MobiusBand} (hK_cl : IsClosed K_all) + (hK_disj : Disjoint K_all (Quotient.mk Surface.mobiusSetoid '' ({u₀} ×ˢ univ))) : + ∃ D_mob : Set MobiusBand, + IsClosedDisc D_mob ∧ + K_all ⊆ D_mob ∧ + Disjoint D_mob (Quotient.mk Surface.mobiusSetoid '' ({u₀} ×ˢ univ)) ∧ + D_mob ∩ bd MobiusBand ⊆ discBd D_mob ∧ + ∀ u_j : unitInterval, 0 < (u_j : ℝ) → (u_j : ℝ) < 1 → + Quotient.mk Surface.mobiusSetoid '' ({u_j} ×ˢ univ) ⊆ K_all → + Quotient.mk Surface.mobiusSetoid '' ({u_j} ×ˢ univ) ⊆ D_mob ∧ + (Quotient.mk Surface.mobiusSetoid '' ({u_j} ×ˢ univ)) ∩ discBd D_mob = + {Quotient.mk Surface.mobiusSetoid (u_j, 0), + Quotient.mk Surface.mobiusSetoid (u_j, 1)} := by + let Q_all : Set (unitInterval × unitInterval) := + Quotient.mk Surface.mobiusSetoid ⁻¹' K_all + have hQ_cl : IsClosed Q_all := hK_cl.preimage continuous_quotient_mk' + let U_set : Set unitInterval := (Prod.fst '' Q_all) ∪ {0, 1} + have hU_cl : IsClosed U_set := + (hQ_cl.isCompact.image continuous_fst).isClosed.union + ((isClosed_singleton.union isClosed_singleton)) + have hU_ne : U_set.Nonempty := ⟨0, .inr (.inl rfl)⟩ + have hu₀_not_U : u₀ ∉ U_set := by + rintro (⟨⟨u, v⟩, hp, rfl⟩ | rfl | rfl) + · exact Set.disjoint_left.mp hK_disj hp ⟨(u, v), ⟨rfl, mem_univ _⟩, rfl⟩ + · exact hu₀0.ne rfl + · exact hu₀1.ne rfl + have hdist_pos : 0 < Metric.infDist u₀ U_set := + (hU_cl.notMem_iff_infDist_pos hU_ne).mp hu₀_not_U + let ε : ℝ := min ((u₀ : ℝ) / 2) (min ((1 - (u₀ : ℝ)) / 2) (Metric.infDist u₀ U_set / 2)) + have hε0 : 0 < ε := by + dsimp [ε] + refine lt_min (by linarith) (lt_min (by linarith) (by linarith)) + have hε_u0 : ε < (u₀ : ℝ) := by + have : ε ≤ (u₀ : ℝ) / 2 := min_le_left _ _ + linarith + have hε_u1 : ε < 1 - (u₀ : ℝ) := by + have : ε ≤ (1 - (u₀ : ℝ)) / 2 := (min_le_right _ _).trans (min_le_left _ _) + linarith + have hε_dist : ε < Metric.infDist u₀ U_set := by + have : ε ≤ Metric.infDist u₀ U_set / 2 := (min_le_right _ _).trans (min_le_right _ _) + linarith + let R_ε : Set ℂ := Icc (1 : ℝ) 2 ×ℂ Icc ((u₀ : ℝ) + ε) ((u₀ : ℝ) + 1 - ε) + let U_ε : Set ℂ := Icc (1 : ℝ) 2 ×ℂ Ioo ((u₀ : ℝ) + ε) ((u₀ : ℝ) + 1 - ε) + have hR_comp : IsCompact R_ε := isCompact_Icc.reProdIm isCompact_Icc + have hinj : InjOn mobRectMap R_ε := + injOn_mobRectMap u₀ ε hε0 hε_u0 hε_u1 + let D_mob : Set MobiusBand := mobRectMap '' R_ε + obtain ⟨hD_rect, hbd_rect⟩ := + isClosedDisc_rect (a := 1) (b := 2) + (c := (u₀ : ℝ) + ε) (d := (u₀ : ℝ) + 1 - ε) (by norm_num) (by linarith) + obtain ⟨hD_img, hbd_img⟩ := hD_rect.image_injOn continuous_mobRectMap.continuousOn hinj + have hD_disc : IsClosedDisc D_mob := hD_img + have hD_bd : discBd D_mob = mobRectMap '' frontier R_ε := + hbd_img.trans (congrArg (mobRectMap '' ·) hbd_rect) + have hK_sub_U : K_all ⊆ mobRectMap '' U_ε := by + exact compact_set_avoiding_vertical_line_lies_in_open_strip u₀ (K_all := K_all) ε + hε0 hε_u0 hε_u1 hε_dist + have hU_sub_R : U_ε ⊆ R_ε := fun z hz => + Complex.mem_reProdIm.mpr + ⟨(Complex.mem_reProdIm.mp hz).1, Ioo_subset_Icc_self (Complex.mem_reProdIm.mp hz).2⟩ + have hK_sub_D : K_all ⊆ D_mob := hK_sub_U.trans (image_mono hU_sub_R) + have hD_disj : Disjoint D_mob (Quotient.mk Surface.mobiusSetoid '' ({u₀} ×ˢ univ)) := by + exact closed_strip_avoids_vertical_line u₀ ε hε0 hε_u0 hε_u1 + have hbd_sub : D_mob ∩ bd MobiusBand ⊆ discBd D_mob := by + rw [hD_bd, bd_mobiusBand, range_mobBd] + rintro _ ⟨⟨z, hzR, rfl⟩, ⟨u, heq⟩⟩ + obtain ⟨hz_re, _⟩ := Complex.mem_reProdIm.mp hzR + have hv : (projIcc 0 1 zero_le_one (z.re - 1) : ℝ) = z.re - 1 := + congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith [hz_re.1], by linarith + [hz_re.2]⟩) + have hre_12 : z.re = 1 ∨ z.re = 2 := by + dsimp [mobRectMap] at heq + split_ifs at heq with h1 + · rcases heq with heq | heq <;> + rcases mobius_rel (Quotient.exact heq) with h | ⟨_, _, h3⟩ | ⟨_, _, h3⟩ + · left; have := congrArg Subtype.val (Prod.ext_iff.mp h).2; simp only [Icc.coe_zero] + at this; linarith + · right; have := congrArg Subtype.val h3; simp only [unitInterval.coe_symm_eq, + Icc.coe_zero] at this; linarith + · right; have := congrArg Subtype.val h3; simp only [unitInterval.coe_symm_eq, + Icc.coe_zero] at this; linarith + · right; have := congrArg Subtype.val (Prod.ext_iff.mp h).2; simp only [Icc.coe_one] + at this; linarith + · left; have := congrArg Subtype.val h3; simp only [unitInterval.coe_symm_eq, Icc.coe_one] + at this; linarith + · left; have := congrArg Subtype.val h3; simp only [unitInterval.coe_symm_eq, Icc.coe_one] + at this; linarith + · rcases heq with heq | heq <;> + rcases mobius_rel (Quotient.exact heq) with h | ⟨_, _, h3⟩ | ⟨_, _, h3⟩ + · right; have := congrArg Subtype.val (Prod.ext_iff.mp h).2; simp only + [unitInterval.coe_symm_eq, Icc.coe_zero] at this; linarith + · left; have := congrArg Subtype.val h3; simp only [unitInterval.coe_symm_eq, Icc.coe_zero] + at this; linarith + · left; have := congrArg Subtype.val h3; simp only [unitInterval.coe_symm_eq, Icc.coe_zero] + at this; linarith + · left; have := congrArg Subtype.val (Prod.ext_iff.mp h).2; simp only + [unitInterval.coe_symm_eq, Icc.coe_one] at this; linarith + · right; have := congrArg Subtype.val h3; simp only [unitInterval.coe_symm_eq, Icc.coe_one] + at this; linarith + · right; have := congrArg Subtype.val h3; simp only [unitInterval.coe_symm_eq, Icc.coe_one] + at this; linarith + exact ⟨z, reProdIm_mem_frontier_of_re_eq hzR hre_12, rfl⟩ + refine ⟨D_mob, hD_disc, hK_sub_D, hD_disj, hbd_sub, fun u_j hu_j0 hu_j1 hu_j_sub => ?_⟩ + have hu_j_D : Quotient.mk Surface.mobiusSetoid '' ({u_j} ×ˢ univ) ⊆ D_mob := + hu_j_sub.trans hK_sub_D + refine ⟨hu_j_D, Subset.antisymm ?_ ?_⟩ + · rintro y ⟨⟨⟨u', v⟩, ⟨hu'_eq, _⟩, rfl⟩, hy_bd⟩ + have hu' : u_j = u' := hu'_eq.symm + subst hu' + obtain ⟨z₁, hz₁U, h₁⟩ := hK_sub_U (hu_j_sub ⟨(u_j, v), ⟨rfl, mem_univ _⟩, rfl⟩) + rw [hD_bd] at hy_bd + obtain ⟨z₂, hz₂_fr, h₂⟩ := hy_bd + have hz₂R : z₂ ∈ R_ε := (hR_comp.isClosed.frontier_eq ▸ hz₂_fr).1 + have hz_eq : z₁ = z₂ := hinj (hU_sub_R hz₁U) hz₂R (h₁.trans h₂.symm) + subst hz_eq + obtain ⟨hz₁_re, hz₁_im⟩ := Complex.mem_reProdIm.mp hz₁U + have hre : z₁.re = 1 ∨ z₁.re = 2 := re_eq_of_mem_frontier_reProdIm hz₂_fr hz₁_im + dsimp [mobRectMap] at h₁ + split_ifs at h₁ with h1 + · have hu₁ : (projIcc 0 1 zero_le_one z₁.im : ℝ) = z₁.im := + congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith [hz₁_im.1], h1⟩) + have hu_eq : projIcc 0 1 zero_le_one z₁.im = u_j := by + rcases mobius_rel (Quotient.exact h₁) with h | ⟨ha, _, _⟩ | ⟨ha, _, _⟩ + · exact (Prod.ext_iff.mp h).1 + · have : (projIcc 0 1 zero_le_one z₁.im : ℝ) = 0 := congrArg Subtype.val ha + linarith [hz₁_im.1] + · have : (u_j : ℝ) = 0 := congrArg Subtype.val ha + linarith + rcases hre with hre1 | hre2 + · left + rw [← h₁, hre1, sub_self, hu_eq] + have h0 : projIcc 0 1 zero_le_one (0 : ℝ) = 0 := + projIcc_of_mem zero_le_one ⟨by norm_num, by norm_num⟩ + rw [h0] + · right + rw [← h₁, hre2, show (2 : ℝ) - 1 = 1 by ring, hu_eq] + have h1' : projIcc 0 1 zero_le_one (1 : ℝ) = 1 := + projIcc_of_mem zero_le_one ⟨by norm_num, by norm_num⟩ + rw [h1'] + rfl + · have hu₁ : (projIcc 0 1 zero_le_one (z₁.im - 1) : ℝ) = z₁.im - 1 := + congrArg Subtype.val (projIcc_of_mem zero_le_one ⟨by linarith, by linarith [hz₁_im.2]⟩) + have hu_eq : projIcc 0 1 zero_le_one (z₁.im - 1) = u_j := by + rcases mobius_rel (Quotient.exact h₁) with h | ⟨ha, _, _⟩ | ⟨ha, _, _⟩ + · exact (Prod.ext_iff.mp h).1 + · have : (projIcc 0 1 zero_le_one (z₁.im - 1) : ℝ) = 0 := congrArg Subtype.val ha + linarith + · have : (u_j : ℝ) = 0 := congrArg Subtype.val ha + linarith + rcases hre with hre1 | hre2 + · right + rw [← h₁, hre1, sub_self, hu_eq] + have h0 : projIcc 0 1 zero_le_one (0 : ℝ) = 0 := + projIcc_of_mem zero_le_one ⟨by norm_num, by norm_num⟩ + rw [h0, unitInterval.symm_zero] + rfl + · left + rw [← h₁, hre2, show (2 : ℝ) - 1 = 1 by ring, hu_eq] + have h1' : projIcc 0 1 zero_le_one (1 : ℝ) = 1 := + projIcc_of_mem zero_le_one ⟨by norm_num, by norm_num⟩ + rw [h1', unitInterval.symm_one] + · rintro y (rfl | rfl) + · refine ⟨⟨(u_j, 0), ⟨rfl, mem_univ _⟩, rfl⟩, hbd_sub ⟨hu_j_D ⟨(u_j, 0), ⟨rfl, mem_univ _⟩, + rfl⟩, ?_⟩⟩ + rw [bd_mobiusBand, range_mobBd] + exact ⟨u_j, .inl rfl⟩ + · refine ⟨⟨(u_j, 1), ⟨rfl, mem_univ _⟩, rfl⟩, hbd_sub ⟨hu_j_D ⟨(u_j, 1), ⟨rfl, mem_univ _⟩, + rfl⟩, ?_⟩⟩ + rw [bd_mobiusBand, range_mobBd] + exact ⟨u_j, .inr rfl⟩ + +/-! ## 2. Unpinched and Pinched Crosscap Splits -/ + +/-- A vertical segment `{u} × [0, 1]` (`0 < u < 1`) in `MobiusBand` is a line with ends +`[(u, 0)]` and `[(u, 1)]`. -/ +theorem isLineWithEnds_mobVertical (u : unitInterval) + (hu0 : 0 < (u : ℝ)) (hu1 : (u : ℝ) < 1) : + IsLineWithEnds (Quotient.mk Surface.mobiusSetoid '' ({u} ×ˢ univ)) + (Quotient.mk Surface.mobiusSetoid (u, 0)) + (Quotient.mk Surface.mobiusSetoid (u, 1)) := by + let f : unitInterval → MobiusBand := fun v => Quotient.mk Surface.mobiusSetoid (u, v) + have hf_cont : Continuous f := + continuous_quotient_mk'.comp (continuous_const.prodMk continuous_id) + have hf_inj : Function.Injective f := by + intro v₁ v₂ heq + rcases mobius_rel (Quotient.exact heq) with h | ⟨ha, _, _⟩ | ⟨ha, _, _⟩ + · exact (Prod.ext_iff.mp h).2 + · have : (u : ℝ) = 0 := congrArg Subtype.val ha + linarith + · have : (u : ℝ) = 0 := congrArg Subtype.val ha + linarith + have hf_emb : IsEmbedding f := (hf_cont.isClosedEmbedding hf_inj).isEmbedding + have hrange : range f = Quotient.mk Surface.mobiusSetoid '' ({u} ×ˢ univ) := by + ext y + constructor + · rintro ⟨v, rfl⟩ + exact ⟨(u, v), ⟨rfl, mem_univ _⟩, rfl⟩ + · rintro ⟨⟨u', v⟩, ⟨hu', _⟩, rfl⟩ + have : u' = u := hu' + subst this + exact ⟨v, rfl⟩ + exact ⟨hf_emb.toHomeomorph.trans (Homeomorph.setCongr hrange), rfl, rfl⟩ + +/-- Homeomorphism between `Circle` and `bd MobiusBand` induced by `mobBd`. -/ +noncomputable def mobBdHomeo : Circle ≃ₜ ↥(bd MobiusBand) := + isEmbedding_mobBd.toHomeomorph.trans (Homeomorph.setCongr bd_mobiusBand.symm) + +@[simp] +theorem mobBdHomeo_coe (z : Circle) : (mobBdHomeo z : MobiusBand) = mobBd z := rfl + +@[simp] +theorem mobBdHomeo_symm_mobBd (z : Circle) (hz : mobBd z ∈ bd MobiusBand) : + mobBdHomeo.symm ⟨mobBd z, hz⟩ = z := by + apply mobBdHomeo.injective + rw [mobBdHomeo.apply_symm_apply] + rfl + +/-- Gluing map from `bd MobiusBand` to `univ \ Λ` sending `mobBd z` to `g z`. -/ +noncomputable def crosscapGlueMap {S : Type w} [TopologicalSpace S] {Λ : Set S} + (hΛ_open : IsOpen Λ) (g : Circle ≃ₜ ↥(subBd Λ)) + (p : ↥(bd MobiusBand)) : ↥(univ \ Λ : Set S) := + ⟨(g (mobBdHomeo.symm p)).1, by + have hmem : (g (mobBdHomeo.symm p)).1 ∈ closure Λ \ Λ := by + rw [← hΛ_open.frontier_eq, ← subBd_eq_frontier] + exact (g (mobBdHomeo.symm p)).2 + exact ⟨mem_univ _, hmem.2⟩⟩ + +@[simp] +theorem crosscapGlueMap_mobBd {S : Type w} [TopologicalSpace S] {Λ : Set S} + (hΛ_open : IsOpen Λ) (g : Circle ≃ₜ ↥(subBd Λ)) (z : Circle) : + (crosscapGlueMap hΛ_open g ⟨mobBd z, bd_mobiusBand.symm ▸ ⟨z, rfl⟩⟩).1 = (g z).1 := by + dsimp [crosscapGlueMap] + rw [mobBdHomeo_symm_mobBd] + +theorem continuous_crosscapGlueMap {S : Type w} [TopologicalSpace S] {Λ : Set S} + (hΛ_open : IsOpen Λ) (g : Circle ≃ₜ ↥(subBd Λ)) : + Continuous (crosscapGlueMap hΛ_open g) := + Continuous.subtype_mk + (continuous_subtype_val.comp (g.continuous.comp mobBdHomeo.symm.continuous)) _ + +theorem injective_crosscapGlueMap {S : Type w} [TopologicalSpace S] {Λ : Set S} + (hΛ_open : IsOpen Λ) (g : Circle ≃ₜ ↥(subBd Λ)) : + Function.Injective (crosscapGlueMap hΛ_open g) := by + intro p q hpq + have hval := congrArg Subtype.val hpq + exact mobBdHomeo.symm.injective (g.injective (Subtype.ext hval)) + +theorem range_crosscapGlueMap {S : Type w} [TopologicalSpace S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Λ : Set S} + (hΛ_open : IsOpen Λ) (hOArc : IsOArc (subBd Λ)) + (hout : ∀ x ∈ closure Λ \ Λ, x ∈ closure (closure Λ)ᶜ) + (g : Circle ≃ₜ ↥(subBd Λ)) : + range (crosscapGlueMap hΛ_open g) = bd ↥(univ \ Λ : Set S) := by + obtain ⟨_, _, hbd_eq, _⟩ := compl_open_isSurface hS hΛ_open hOArc hout + rw [hbd_eq] + apply Subset.antisymm + · rintro _ ⟨p, rfl⟩ + exact (g (mobBdHomeo.symm p)).2 + · intro y hy + let z := g.symm ⟨y.1, hy⟩ + have hz : (g z).1 = y.1 := congrArg Subtype.val (g.apply_symm_apply ⟨y.1, hy⟩) + refine ⟨mobBdHomeo z, Subtype.ext ?_⟩ + dsimp [crosscapGlueMap] + rw [mobBdHomeo.symm_apply_apply, hz] + +/-- Unpinched capped split on `GluedSpace hb_inj` for adding a crosscap. -/ +theorem isCappedSplit_crosscap_unpinched {S : Type w} [TopologicalSpace S] [T2Space S] + [ConnectedSpace S] (hS : IsClosedSurface S) {Λ : Set S} + (hΛ_open : IsOpen Λ) (hΛ : IsOpenDisc Λ) (hOArc : IsOArc (subBd Λ)) + (hout : ∀ x ∈ closure Λ \ Λ, x ∈ closure (closure Λ)ᶜ) + (g : Circle ≃ₜ ↥(subBd Λ)) + (hb_inj : Function.Injective (crosscapGlueMap hΛ_open g)) : + let S' := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let S₂ : Set S' := range (GluedSpace.inr hb_inj) + ∃ (C_unp : Fin 1 → Set S') (ι_unp : ↥S₁ → S), + GM12.IsCappedSplit C_unp S₁ S₂ ι_unp ![Λ] ∧ + C_unp 0 = GluedSpace.inr hb_inj '' bd MobiusBand ∧ + range ι_unp = univ \ Λ ∧ + ∀ y : ↥(univ \ Λ : Set S), + ι_unp ⟨GluedSpace.inl hb_inj y, ⟨y, rfl⟩⟩ = y.1 := by + have : CompactSpace S := hS.1 + have hX_closed : IsClosed (univ \ Λ : Set S) := isClosed_univ.sdiff hΛ_open + have : CompactSpace ↥(univ \ Λ : Set S) := isCompact_iff_compactSpace.mp hX_closed.isCompact + obtain ⟨m_mob⟩ := nonempty_mob_homeo + have hMob_surf : IsSurface MobiusBand := isSurface_of_homeo m_mob (isSurface_model 0 1 1).1 + have : CompactSpace MobiusBand := hMob_surf.1 + have hb_cont := continuous_crosscapGlueMap hΛ_open g + have hb_range := range_crosscapGlueMap hS hΛ_open hOArc hout g + have : T2Space (GluedSpace hb_inj) := GluedSpace.t2Space (isClosed_bd MobiusBand) hb_cont hb_inj + obtain ⟨hS', hConn', _, hS₁_surf, hS₂_surf, hU_eq, hbd₁_eq, hbd₂_eq⟩ := + isClosedSurface_of_crosscap_glue hS hΛ hOArc hout hb_cont hb_inj hb_range + let S' := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let S₂ : Set S' := range (GluedSpace.inr hb_inj) + have hinl_emb : IsClosedEmbedding (GluedSpace.inl hb_inj) := + (GluedSpace.continuous_inl hb_inj).isClosedEmbedding (GluedSpace.inl_injective hb_inj) + have hinr_emb : IsClosedEmbedding (GluedSpace.inr hb_inj) := + (GluedSpace.continuous_inr hb_inj).isClosedEmbedding (GluedSpace.inr_injective hb_inj) + let e₁ : ↥(univ \ Λ : Set S) ≃ₜ ↥S₁ := hinl_emb.isEmbedding.toHomeomorph + let C_unp : Fin 1 → Set S' := ![GluedSpace.inr hb_inj '' bd MobiusBand] + let ι_unp : ↥S₁ → S := fun x => (e₁.symm x).1 + have hι_emb : IsEmbedding ι_unp := + hX_closed.isClosedEmbedding_subtypeVal.isEmbedding.comp e₁.symm.isEmbedding + have hι_inl : ∀ y : ↥(univ \ Λ : Set S), + ι_unp ⟨GluedSpace.inl hb_inj y, ⟨y, rfl⟩⟩ = y.1 := by + intro y + change (e₁.symm (e₁ y)).1 = y.1 + rw [e₁.symm_apply_apply] + have hι_range : range ι_unp = univ \ Λ := by + ext x + constructor + · rintro ⟨p, rfl⟩ + exact (e₁.symm p).2 + · intro hx + exact ⟨e₁ ⟨x, hx⟩, hι_inl ⟨x, hx⟩⟩ + have hiUnion1 : ∀ (F : Fin 1 → Set S'), (⋃ i, F i) = F 0 := by + intro F; ext x; simp + have hinter_eq : S₁ ∩ S₂ = ⋃ i, C_unp i := by + rw [hiUnion1] + exact GluedSpace.range_inl_inter_range_inr_eq_inr hb_inj + refine ⟨C_unp, ι_unp, ?_, rfl, hι_range, hι_inl⟩ + refine + { surface := ⟨hS', hConn'⟩ + isOArc := fun i => by + fin_cases i + change IsOArc (GluedSpace.inr hb_inj '' bd MobiusBand) + exact isOArc_image hinr_emb.isEmbedding (isOArc_bd_one m_mob) + disjoint := fun i j hij => (hij (Subsingleton.elim i j)).elim + manifold₁ := hS₁_surf + manifold₂ := hS₂_surf + union := hU_eq + inter := hinter_eq + bd₁ := hbd₁_eq.symm.trans hinter_eq + bd₂ := hbd₂_eq.symm.trans hinter_eq + surface_hat := hS + isEmbedding := hι_emb + isOpenDisc := fun i => by fin_cases i; exact hΛ + bounds := fun i => by + fin_cases i + change subBd Λ = ι_unp '' (Subtype.val ⁻¹' (GluedSpace.inr hb_inj '' bd MobiusBand)) + ext x + constructor + · intro hx + have hx_mem : x ∈ univ \ Λ := by + have hmem : x ∈ closure Λ \ Λ := by + rw [← hΛ_open.frontier_eq, ← subBd_eq_frontier] + exact hx + exact ⟨mem_univ _, hmem.2⟩ + let z := g.symm ⟨x, hx⟩ + have hz_bd : mobBd z ∈ bd MobiusBand := by rw [bd_mobiusBand]; exact ⟨z, rfl⟩ + have hb_z : crosscapGlueMap hΛ_open g ⟨mobBd z, hz_bd⟩ = ⟨x, hx_mem⟩ := by + apply Subtype.ext + rw [crosscapGlueMap_mobBd] + exact congrArg Subtype.val (g.apply_symm_apply ⟨x, hx⟩) + have hinl_eq : GluedSpace.inl hb_inj ⟨x, hx_mem⟩ = + GluedSpace.inr hb_inj (mobBd z) := by + rw [← hb_z] + exact (GluedSpace.inl_eq_inr hb_inj).mpr ⟨hz_bd, rfl⟩ + refine ⟨⟨GluedSpace.inl hb_inj ⟨x, hx_mem⟩, ⟨⟨x, hx_mem⟩, rfl⟩⟩, ?_, hι_inl ⟨x, hx_mem⟩⟩ + change GluedSpace.inl hb_inj ⟨x, hx_mem⟩ ∈ GluedSpace.inr hb_inj '' bd MobiusBand + rw [hinl_eq] + exact ⟨mobBd z, hz_bd, rfl⟩ + · rintro ⟨⟨_, ⟨y, rfl⟩⟩, ⟨p, hp_bd, heq⟩, rfl⟩ + rw [hι_inl y] + obtain ⟨hp_bd', rfl⟩ := (GluedSpace.inl_eq_inr hb_inj).mp heq.symm + exact (g (mobBdHomeo.symm ⟨p, hp_bd'⟩)).2 + disjoint_D := fun i j hij => (hij (Subsingleton.elim i j)).elim + compl := by + rw [hι_range] + ext x + simp only [mem_compl_iff, mem_sdiff, mem_univ, true_and, mem_iUnion, + Fin.exists_fin_one, Matrix.cons_val_zero, not_not] } + +/-- Homeomorphism between `MobiusBand` (`Quotient Surface.mobiusSetoid`) and +`Quotient GM12.mobiusSetoid`. -/ +def mobiusSetoidHomeo : MobiusBand ≃ₜ Quotient GM12.mobiusSetoid := + Homeomorph.refl _ + +/-- Given `δ : Circle → ℝ`, the pinched subset `Q_mid` of `unitInterval × unitInterval`. -/ +def mobPinchPairSet (δ : Circle → ℝ) : Set (unitInterval × unitInterval) := + {p | δ (circleTop p.1) ≤ (p.2 : ℝ) ∧ (p.2 : ℝ) ≤ 1 - δ (circleBot p.1)} + +theorem mobPinchPairSet_saturated (δ : Circle → ℝ) {p q : unitInterval × unitInterval} + (h : Surface.mobiusSetoid p q) (hp : p ∈ mobPinchPairSet δ) : + q ∈ mobPinchPairSet δ := by + rcases mobius_rel h with rfl | ⟨h1, h2, h3⟩ | ⟨h1, h2, h3⟩ + · exact hp + · obtain ⟨hp1, hp2⟩ := hp + refine ⟨?_, ?_⟩ + · rw [h2, circleTop_one, h3, unitInterval.coe_symm_eq] + rw [h1, circleBot_zero] at hp2 + linarith + · rw [h2, circleBot_one, h3, unitInterval.coe_symm_eq] + rw [h1, circleTop_zero] at hp1 + linarith + · obtain ⟨hp1, hp2⟩ := hp + refine ⟨?_, ?_⟩ + · rw [h1, circleTop_zero] + have h3' : (q.2 : ℝ) = 1 - (p.2 : ℝ) := by + have := congrArg Subtype.val h3 + simp only [unitInterval.coe_symm_eq] at this + linarith + rw [h2, circleBot_one] at hp2 + linarith + · rw [h1, circleBot_zero] + have h3' : (q.2 : ℝ) = 1 - (p.2 : ℝ) := by + have := congrArg Subtype.val h3 + simp only [unitInterval.coe_symm_eq] at this + linarith + rw [h2, circleTop_one] at hp1 + linarith + +theorem mk_mem_image_mobPinchPairSet_iff (δ : Circle → ℝ) (p : unitInterval × unitInterval) : + Quotient.mk Surface.mobiusSetoid p ∈ + Quotient.mk Surface.mobiusSetoid '' mobPinchPairSet δ ↔ p ∈ mobPinchPairSet δ := by + constructor + · rintro ⟨q, hq, heq⟩ + exact mobPinchPairSet_saturated δ (Quotient.exact heq) hq + · intro hp + exact ⟨p, hp, rfl⟩ + +/-- Forward map of `pinchMobHomeo` on `unitInterval × unitInterval`. -/ +noncomputable def pinchMobPair (δ : Circle → ℝ) + (p : unitInterval × unitInterval) : unitInterval × unitInterval := + (p.1, projIcc 0 1 zero_le_one + (δ (circleTop p.1) + (p.2 : ℝ) * (1 - δ (circleTop p.1) - δ (circleBot p.1)))) + +theorem pinchMobPair_snd_coe {δ : Circle → ℝ} + (hδ_bd : ∀ z, 0 ≤ δ z ∧ δ z ≤ 1 / 4) (p : unitInterval × unitInterval) : + ((pinchMobPair δ p).2 : ℝ) = + δ (circleTop p.1) + (p.2 : ℝ) * (1 - δ (circleTop p.1) - δ (circleBot p.1)) := by + have h1 := hδ_bd (circleTop p.1) + have h2 := hδ_bd (circleBot p.1) + have hv := p.2.2 + exact congrArg Subtype.val (projIcc_of_mem zero_le_one + ⟨by nlinarith [h1.1, h1.2, h2.1, h2.2, hv.1, hv.2], + by nlinarith [h1.1, h1.2, h2.1, h2.2, hv.1, hv.2]⟩) + +theorem pinchMobPair_mem {δ : Circle → ℝ} + (hδ_bd : ∀ z, 0 ≤ δ z ∧ δ z ≤ 1 / 4) (p : unitInterval × unitInterval) : + pinchMobPair δ p ∈ mobPinchPairSet δ := by + have h1 := hδ_bd (circleTop p.1) + have h2 := hδ_bd (circleBot p.1) + have hv := p.2.2 + refine ⟨?_, ?_⟩ + · change δ (circleTop p.1) ≤ ((pinchMobPair δ p).2 : ℝ) + rw [pinchMobPair_snd_coe hδ_bd] + nlinarith [h1.1, h1.2, h2.1, h2.2, hv.1, hv.2] + · change ((pinchMobPair δ p).2 : ℝ) ≤ 1 - δ (circleBot p.1) + rw [pinchMobPair_snd_coe hδ_bd] + nlinarith [h1.1, h1.2, h2.1, h2.2, hv.1, hv.2] + +/-- Homeomorphism between `MobiusBand` and its pinched sub-band +`Quotient.mk Surface.mobiusSetoid '' mobPinchPairSet δ`. -/ +noncomputable def pinchMobHomeo {δ : Circle → ℝ} + (hδ_cont : Continuous δ) (hδ_bd : ∀ z, 0 ≤ δ z ∧ δ z ≤ 1 / 4) : + MobiusBand ≃ₜ ↥(Quotient.mk Surface.mobiusSetoid '' mobPinchPairSet δ) := by + let f_aux : unitInterval × unitInterval → MobiusBand := + fun p => Quotient.mk Surface.mobiusSetoid (pinchMobPair δ p) + have hf_aux_cont : Continuous f_aux := by + unfold f_aux pinchMobPair + have := continuous_circleTop + have := continuous_circleBot + exact continuous_quotient_mk'.comp (by fun_prop) + have hf_rel : ∀ p q : unitInterval × unitInterval, + Surface.mobiusSetoid p q → f_aux p = f_aux q := by + have hstep : ∀ p q : unitInterval × unitInterval, + p.1 = 0 → q.1 = 1 → q.2 = unitInterval.symm p.2 → f_aux p = f_aux q := by + intro p q hp1 hq1 hq2 + apply Quotient.sound + refine Relation.EqvGen.rel _ _ ⟨hp1, hq1, ?_⟩ + apply Subtype.ext + change ((pinchMobPair δ q).2 : ℝ) = 1 - ((pinchMobPair δ p).2 : ℝ) + rw [pinchMobPair_snd_coe hδ_bd, pinchMobPair_snd_coe hδ_bd, + hp1, hq1, hq2, circleTop_zero, circleBot_zero, circleTop_one, circleBot_one, + unitInterval.coe_symm_eq] + ring + intro p q h + rcases mobius_rel h with rfl | ⟨h1, h2, h3⟩ | ⟨h1, h2, h3⟩ + · rfl + · exact hstep p q h1 h2 h3 + · exact (hstep q p h1 h2 h3).symm + let f_mob : MobiusBand → MobiusBand := Quotient.lift f_aux hf_rel + have hf_mob_cont : Continuous f_mob := Continuous.quotient_lift hf_aux_cont _ + have hf_mob_mem : ∀ y : MobiusBand, + f_mob y ∈ Quotient.mk Surface.mobiusSetoid '' mobPinchPairSet δ := by + intro y + obtain ⟨p, rfl⟩ := Quotient.exists_rep y + exact ⟨pinchMobPair δ p, pinchMobPair_mem hδ_bd p, rfl⟩ + let f : MobiusBand → ↥(Quotient.mk Surface.mobiusSetoid '' mobPinchPairSet δ) := + fun y => ⟨f_mob y, hf_mob_mem y⟩ + have hf_cont : Continuous f := Continuous.subtype_mk hf_mob_cont _ + have hf_bij : Function.Bijective f := by + refine ⟨?_, ?_⟩ + · intro y₁ y₂ heq + obtain ⟨p, rfl⟩ := Quotient.exists_rep y₁ + obtain ⟨q, rfl⟩ := Quotient.exists_rep y₂ + have h_eq : f_aux p = f_aux q := congrArg Subtype.val heq + apply Quotient.sound + rcases mobius_rel (Quotient.exact h_eq) with h | ⟨h1, h2, h3⟩ | ⟨h1, h2, h3⟩ + · have hpq := Prod.ext_iff.mp h + have hu : p.1 = q.1 := hpq.1 + have hv_eq : ((pinchMobPair δ p).2 : ℝ) = ((pinchMobPair δ q).2 : ℝ) := + congrArg Subtype.val hpq.2 + rw [pinchMobPair_snd_coe hδ_bd, pinchMobPair_snd_coe hδ_bd, ← hu] at hv_eq + have hpos : 0 < 1 - δ (circleTop p.1) - δ (circleBot p.1) := by + linarith [(hδ_bd (circleTop p.1)).2, (hδ_bd (circleBot p.1)).2] + have hv : p.2 = q.2 := Subtype.ext (by nlinarith) + rw [Prod.ext hu hv] + · change p.1 = 0 at h1 + change q.1 = 1 at h2 + refine Relation.EqvGen.rel _ _ ⟨h1, h2, ?_⟩ + apply Subtype.ext + simp only [unitInterval.coe_symm_eq] + have hv_eq : ((pinchMobPair δ q).2 : ℝ) = 1 - ((pinchMobPair δ p).2 : ℝ) := by + have := congrArg Subtype.val h3 + simpa [unitInterval.coe_symm_eq] using this + rw [pinchMobPair_snd_coe hδ_bd, pinchMobPair_snd_coe hδ_bd, + h1, h2, circleTop_zero, circleBot_zero, circleTop_one, circleBot_one] at hv_eq + have hpos : 0 < 1 - δ 1 - δ (-1) := by + linarith [(hδ_bd 1).2, (hδ_bd (-1)).2] + nlinarith + · change q.1 = 0 at h1 + change p.1 = 1 at h2 + refine Relation.EqvGen.symm _ _ (Relation.EqvGen.rel _ _ ⟨h1, h2, ?_⟩) + apply Subtype.ext + simp only [unitInterval.coe_symm_eq] + have hv_eq : ((pinchMobPair δ p).2 : ℝ) = 1 - ((pinchMobPair δ q).2 : ℝ) := by + have := congrArg Subtype.val h3 + simpa [unitInterval.coe_symm_eq] using this + rw [pinchMobPair_snd_coe hδ_bd, pinchMobPair_snd_coe hδ_bd, + h1, h2, circleTop_zero, circleBot_zero, circleTop_one, circleBot_one] at hv_eq + have hpos : 0 < 1 - δ 1 - δ (-1) := by + linarith [(hδ_bd 1).2, (hδ_bd (-1)).2] + nlinarith + · rintro ⟨_, ⟨⟨u, w⟩, ⟨hw1, hw2⟩, rfl⟩⟩ + dsimp at hw1 hw2 + have hpos : 0 < 1 - δ (circleTop u) - δ (circleBot u) := by + linarith [(hδ_bd (circleTop u)).2, (hδ_bd (circleBot u)).2] + let v_val : ℝ := ((w : ℝ) - δ (circleTop u)) / (1 - δ (circleTop u) - δ (circleBot u)) + have hv_mem : v_val ∈ Icc (0 : ℝ) 1 := by + dsimp [v_val] + exact ⟨div_nonneg (by linarith) hpos.le, (div_le_one hpos).mpr (by linarith)⟩ + let v : unitInterval := ⟨v_val, hv_mem⟩ + refine ⟨Quotient.mk Surface.mobiusSetoid (u, v), Subtype.ext ?_⟩ + change Quotient.mk Surface.mobiusSetoid (pinchMobPair δ (u, v)) = + Quotient.mk Surface.mobiusSetoid (u, w) + congr 1 + refine Prod.ext rfl (Subtype.ext ?_) + rw [pinchMobPair_snd_coe hδ_bd] + change δ (circleTop u) + v_val * (1 - δ (circleTop u) - δ (circleBot u)) = (w : ℝ) + dsimp [v_val] + rw [div_mul_cancel₀ _ hpos.ne'] + ring + exact Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective f hf_bij) hf_cont + +/-- Collar coordinate map on `unitInterval × unitInterval`: +maps `(u, v)` with `v < 1 / 2` to `(v, circleTop u)` and `(u, v)` with `1 / 2 < v` to +`(1 - v, circleBot u)`. -/ +noncomputable def collarCoordsAux (p : unitInterval × unitInterval) : ℝ × Circle := + if (p.2 : ℝ) < 1 / 2 then + ((p.2 : ℝ), circleTop p.1) + else if 1 / 2 < (p.2 : ℝ) then + (1 - (p.2 : ℝ), circleBot p.1) + else + (1 / 2, 1) + +theorem collarCoordsAux_rel {p q : unitInterval × unitInterval} + (h : Surface.mobiusSetoid p q) : collarCoordsAux p = collarCoordsAux q := by + have hstep : ∀ p q : unitInterval × unitInterval, + p.1 = 0 → q.1 = 1 → q.2 = unitInterval.symm p.2 → collarCoordsAux p = collarCoordsAux q := by + intro p q hp1 hq1 hq2 + dsimp [collarCoordsAux] + have hq2_coe : (q.2 : ℝ) = 1 - (p.2 : ℝ) := by + rw [hq2, unitInterval.coe_symm_eq] + rw [hp1, hq1, hq2_coe, circleTop_zero, circleBot_zero, circleTop_one, circleBot_one] + rcases lt_trichotomy (p.2 : ℝ) (1 / 2) with hlt | heq | hgt + · have hnot1 : ¬ (1 - (p.2 : ℝ) < 1 / 2) := by linarith + have hgt1 : 1 / 2 < 1 - (p.2 : ℝ) := by linarith + simp only [hlt, hnot1, hgt1, ↓reduceIte, sub_sub_cancel] + · have hnot1 : ¬ ((p.2 : ℝ) < 1 / 2) := by linarith + have hnot2 : ¬ (1 / 2 < (p.2 : ℝ)) := by linarith + have hnot3 : ¬ (1 - (p.2 : ℝ) < 1 / 2) := by linarith + have hnot4 : ¬ (1 / 2 < 1 - (p.2 : ℝ)) := by linarith + simp only [hnot1, hnot2, hnot3, hnot4, ↓reduceIte] + · have hnot1 : ¬ ((p.2 : ℝ) < 1 / 2) := by linarith + have hlt1 : 1 - (p.2 : ℝ) < 1 / 2 := by linarith + simp only [hnot1, hgt, hlt1, ↓reduceIte] + rcases mobius_rel h with rfl | ⟨h1, h2, h3⟩ | ⟨h1, h2, h3⟩ + · rfl + · exact hstep p q h1 h2 h3 + · exact (hstep q p h1 h2 h3).symm + +/-- Collar coordinate map on `MobiusBand`. -/ +noncomputable def collarCoords : MobiusBand → ℝ × Circle := + Quotient.lift collarCoordsAux (fun _ _ h => collarCoordsAux_rel h) + +@[simp] +theorem collarCoords_mobBd (z : Circle) : collarCoords (mobBd z) = (0, z) := by + by_cases hz : 0 ≤ (z : ℂ).im + · rw [mobBd_of_im_nonneg hz] + change collarCoordsAux (mobBdTopU z, 0) = (0, z) + dsimp [collarCoordsAux] + have hlt : (0 : ℝ) < 1 / 2 := by norm_num + simp only [hlt, ↓reduceIte, circleTop_mobBdTopU hz] + · have hz' : (z : ℂ).im ≤ 0 := (lt_of_not_ge hz).le + rw [mobBd_of_im_nonpos hz'] + change collarCoordsAux (mobBdBotU z, 1) = (0, z) + dsimp [collarCoordsAux] + have hnot : ¬ ((1 : ℝ) < 1 / 2) := by norm_num + have hgt : (1 / 2 : ℝ) < 1 := by norm_num + simp only [hnot, hgt, ↓reduceIte, sub_self, circleBot_mobBdBotU hz'] + +/-- The collar subset of `unitInterval × unitInterval` for `δ : Circle → ℝ`. -/ +def mobCollarPairSet (δ : Circle → ℝ) : Set (unitInterval × unitInterval) := + {p | (p.2 : ℝ) ≤ δ (circleTop p.1) ∨ 1 - δ (circleBot p.1) ≤ (p.2 : ℝ)} + +/-- The cuff subset of `unitInterval × unitInterval` for `δ : Circle → ℝ`. -/ +def mobCuffPairSet (δ : Circle → ℝ) : Set (unitInterval × unitInterval) := + {p | (p.2 : ℝ) = δ (circleTop p.1) ∨ (p.2 : ℝ) = 1 - δ (circleBot p.1)} + +theorem mobCollarPairSet_saturated (δ : Circle → ℝ) {p q : unitInterval × unitInterval} + (h : Surface.mobiusSetoid p q) (hp : p ∈ mobCollarPairSet δ) : + q ∈ mobCollarPairSet δ := by + rcases mobius_rel h with rfl | ⟨h1, h2, h3⟩ | ⟨h1, h2, h3⟩ + · exact hp + · rcases hp with hp1 | hp2 + · right + rw [h2, circleBot_one, h3, unitInterval.coe_symm_eq] + rw [h1, circleTop_zero] at hp1 + linarith + · left + rw [h2, circleTop_one, h3, unitInterval.coe_symm_eq] + rw [h1, circleBot_zero] at hp2 + linarith + · have h3' : (q.2 : ℝ) = 1 - (p.2 : ℝ) := by + have := congrArg Subtype.val h3 + simp only [unitInterval.coe_symm_eq] at this + linarith + rcases hp with hp1 | hp2 + · right + rw [h1, circleBot_zero, h3'] + rw [h2, circleTop_one] at hp1 + linarith + · left + rw [h1, circleTop_zero, h3'] + rw [h2, circleBot_one] at hp2 + linarith + +theorem mk_mem_image_mobCollarPairSet_iff (δ : Circle → ℝ) (p : unitInterval × unitInterval) : + Quotient.mk Surface.mobiusSetoid p ∈ + Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ ↔ p ∈ mobCollarPairSet δ := by + constructor + · rintro ⟨q, hq, heq⟩ + exact mobCollarPairSet_saturated δ (Quotient.exact heq) hq + · intro hp + exact ⟨p, hp, rfl⟩ + +theorem continuousOn_collarCoords {δ : Circle → ℝ} + (hδ_cont : Continuous δ) (hδ_bd : ∀ z, 0 ≤ δ z ∧ δ z ≤ 1 / 4) : + ContinuousOn collarCoords (Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ) := by + let Q₁ : Set (unitInterval × unitInterval) := {p | (p.2 : ℝ) ≤ δ (circleTop p.1)} + let Q₂ : Set (unitInterval × unitInterval) := {p | 1 - δ (circleBot p.1) ≤ (p.2 : ℝ)} + have hQ₁_cl : IsClosed Q₁ := by + have := continuous_circleTop + refine isClosed_le (continuous_subtype_val.comp continuous_snd) (by fun_prop) + have hQ₂_cl : IsClosed Q₂ := by + have := continuous_circleBot + refine isClosed_le (by fun_prop) (continuous_subtype_val.comp continuous_snd) + have hQ_eq : mobCollarPairSet δ = Q₁ ∪ Q₂ := rfl + have hQ_cl : IsClosed (mobCollarPairSet δ) := hQ₁_cl.union hQ₂_cl + have : CompactSpace ↥(mobCollarPairSet δ) := isCompact_iff_compactSpace.mp hQ_cl.isCompact + have hcont_Q₁ : ContinuousOn collarCoordsAux Q₁ := by + have := continuous_circleTop + refine (Continuous.prodMk (continuous_subtype_val.comp continuous_snd) + (continuous_circleTop.comp continuous_fst)).continuousOn.congr ?_ + intro p hp + have hlt : (p.2 : ℝ) < 1 / 2 := by + linarith [show (p.2 : ℝ) ≤ δ (circleTop p.1) from hp, (hδ_bd (circleTop p.1)).2] + dsimp [collarCoordsAux] + simp only [hlt, ↓reduceIte] + have hcont_Q₂ : ContinuousOn collarCoordsAux Q₂ := by + have h_fn : Continuous (fun p : unitInterval × unitInterval => + (1 - (p.2 : ℝ), circleBot p.1)) := + (continuous_const.sub (continuous_subtype_val.comp continuous_snd)).prodMk + (continuous_circleBot.comp continuous_fst) + refine h_fn.continuousOn.congr ?_ + intro p hp + have hgt : 1 / 2 < (p.2 : ℝ) := by + linarith [show 1 - δ (circleBot p.1) ≤ (p.2 : ℝ) from hp, (hδ_bd (circleBot p.1)).2] + have hnot : ¬ ((p.2 : ℝ) < 1 / 2) := by linarith + dsimp [collarCoordsAux] + simp only [hnot, hgt, ↓reduceIte] + have hcont_Q : ContinuousOn collarCoordsAux (mobCollarPairSet δ) := + hcont_Q₁.union_of_isClosed hcont_Q₂ hQ₁_cl hQ₂_cl + let A_col := Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ + let q_col : ↥(mobCollarPairSet δ) → ↥A_col := + fun p => ⟨Quotient.mk Surface.mobiusSetoid p.1, ⟨p.1, p.2, rfl⟩⟩ + have hq_cont : Continuous q_col := + Continuous.subtype_mk (continuous_quotient_mk'.comp continuous_subtype_val) _ + have hq_surj : Function.Surjective q_col := by + rintro ⟨_, ⟨p, hp, rfl⟩⟩ + exact ⟨⟨p, hp⟩, rfl⟩ + have hq_quot : IsQuotientMap q_col := + hq_cont.isClosedMap.isQuotientMap hq_cont hq_surj + rw [continuousOn_iff_continuous_domRestrict, hq_quot.continuous_iff] + exact continuousOn_iff_continuous_domRestrict.mp hcont_Q + +/-- Inverse map of `collarCoords` on `{q : ℝ × Circle | 0 ≤ q.1 ∧ q.1 ≤ 1 / 4}`. -/ +noncomputable def collarCoordsInv (q : ℝ × Circle) : MobiusBand := + if 0 ≤ (q.2 : ℂ).im then + Quotient.mk Surface.mobiusSetoid (mobBdTopU q.2, projIcc 0 1 zero_le_one q.1) + else + Quotient.mk Surface.mobiusSetoid (mobBdBotU q.2, projIcc 0 1 zero_le_one (1 - q.1)) + +theorem circleBot_im_eq_zero_iff (u : unitInterval) : + (circleBot u : ℂ).im = 0 ↔ u = 0 ∨ u = 1 := by + constructor + · intro h + change - Real.sqrt (1 - (1 - 2 * (u : ℝ)) ^ 2) = 0 at h + have hnonneg : 0 ≤ 1 - (1 - 2 * (u : ℝ)) ^ 2 := by + have : 1 - (1 - 2 * (u : ℝ)) ^ 2 = 4 * (u : ℝ) * (1 - (u : ℝ)) := by ring + rw [this] + nlinarith [u.2.1, u.2.2] + have h0 : 1 - (1 - 2 * (u : ℝ)) ^ 2 = 0 := + (Real.sqrt_eq_zero hnonneg).mp (by linarith) + have hsq : (1 - 2 * (u : ℝ)) ^ 2 = 1 := by linarith + rcases sq_eq_one_iff.mp hsq with h1 | h2 + · left; exact Subtype.ext (by change (u : ℝ) = 0; linarith) + · right; exact Subtype.ext (by change (u : ℝ) = 1; linarith) + · rintro (rfl | rfl) <;> simp + +theorem collarCoordsInv_collarCoords {δ : Circle → ℝ} + (hδ_bd : ∀ z, 0 ≤ δ z ∧ δ z ≤ 1 / 4) + {y : MobiusBand} (hy : y ∈ Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ) : + collarCoordsInv (collarCoords y) = y := by + obtain ⟨⟨u, v⟩, hp, rfl⟩ := hy + rcases hp with hp1 | hp2 + · have hlt : (v : ℝ) < 1 / 2 := by + linarith [show (v : ℝ) ≤ δ (circleTop u) from hp1, (hδ_bd (circleTop u)).2] + have hc : collarCoords (Quotient.mk Surface.mobiusSetoid (u, v)) = ((v : ℝ), circleTop u) := by + change collarCoordsAux (u, v) = ((v : ℝ), circleTop u) + dsimp [collarCoordsAux] + simp only [hlt, ↓reduceIte] + rw [hc] + dsimp [collarCoordsInv] + simp only [circleTop_im_nonneg u, ↓reduceIte, mobBdTopU_circleTop, + projIcc_of_mem zero_le_one v.2] + · have hgt : 1 / 2 < (v : ℝ) := by + linarith [show 1 - δ (circleBot u) ≤ (v : ℝ) from hp2, (hδ_bd (circleBot u)).2] + have hnot : ¬ ((v : ℝ) < 1 / 2) := by linarith + have hc : collarCoords (Quotient.mk Surface.mobiusSetoid (u, v)) = + (1 - (v : ℝ), circleBot u) := by + change collarCoordsAux (u, v) = (1 - (v : ℝ), circleBot u) + dsimp [collarCoordsAux] + simp only [hnot, hgt, ↓reduceIte] + rw [hc] + dsimp [collarCoordsInv] + split_ifs with him + · have him0 : (circleBot u : ℂ).im = 0 := le_antisymm (circleBot_im_nonpos u) him + rcases (circleBot_im_eq_zero_iff u).mp him0 with rfl | rfl + · simp only [circleBot_zero] + have ht : mobBdTopU (-1 : Circle) = 1 := by + apply Subtype.ext; rw [mobBdTopU_coe]; norm_num + have hv' : projIcc 0 1 zero_le_one (1 - (v : ℝ)) = unitInterval.symm v := + projIcc_of_mem zero_le_one (unitInterval.symm v).2 + rw [ht, hv'] + apply Quotient.sound + exact Relation.EqvGen.symm _ _ (Relation.EqvGen.rel _ _ ⟨rfl, rfl, rfl⟩) + · simp only [circleBot_one] + have ht : mobBdTopU (1 : Circle) = 0 := by + apply Subtype.ext; rw [mobBdTopU_coe]; norm_num + have hv' : projIcc 0 1 zero_le_one (1 - (v : ℝ)) = unitInterval.symm v := + projIcc_of_mem zero_le_one (unitInterval.symm v).2 + rw [ht, hv'] + apply Quotient.sound + exact Relation.EqvGen.rel _ _ ⟨rfl, rfl, by simp⟩ + · simp only [mobBdBotU_circleBot, sub_sub_cancel, projIcc_of_mem zero_le_one v.2] + +theorem injOn_collarCoords {δ : Circle → ℝ} (hδ_bd : ∀ z, 0 ≤ δ z ∧ δ z ≤ 1 / 4) : + InjOn collarCoords (Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ) := by + intro x hx y hy h + rw [← collarCoordsInv_collarCoords hδ_bd hx, ← collarCoordsInv_collarCoords hδ_bd hy, h] + +theorem collarCoords_collarCoordsInv {δ : Circle → ℝ} + (hδ_bd : ∀ z, 0 ≤ δ z ∧ δ z ≤ 1 / 4) + {q : ℝ × Circle} (hq : 0 ≤ q.1 ∧ q.1 ≤ δ q.2) : + collarCoordsInv q ∈ Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ ∧ + collarCoords (collarCoordsInv q) = q := by + have hδ := hδ_bd q.2 + have hq_mem : q.1 ∈ Icc (0 : ℝ) 1 := ⟨hq.1, by linarith [hq.2, hδ.2]⟩ + have h1q_mem : 1 - q.1 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [hq.2, hδ.2], by linarith [hq.1]⟩ + by_cases him : 0 ≤ (q.2 : ℂ).im + · have hinv : collarCoordsInv q = + Quotient.mk Surface.mobiusSetoid (mobBdTopU q.2, ⟨q.1, hq_mem⟩) := by + dsimp [collarCoordsInv] + simp only [him, ↓reduceIte, projIcc_of_mem zero_le_one hq_mem] + rw [hinv] + refine ⟨⟨(mobBdTopU q.2, ⟨q.1, hq_mem⟩), .inl ?_, rfl⟩, ?_⟩ + · change q.1 ≤ δ (circleTop (mobBdTopU q.2)) + rw [circleTop_mobBdTopU him] + exact hq.2 + · change collarCoordsAux (mobBdTopU q.2, ⟨q.1, hq_mem⟩) = q + dsimp [collarCoordsAux] + have hlt : q.1 < 1 / 2 := by linarith [hq.2, hδ.2] + simp only [hlt, ↓reduceIte, circleTop_mobBdTopU him] + · have him' : (q.2 : ℂ).im ≤ 0 := (lt_of_not_ge him).le + have hinv : collarCoordsInv q = + Quotient.mk Surface.mobiusSetoid (mobBdBotU q.2, ⟨1 - q.1, h1q_mem⟩) := by + dsimp [collarCoordsInv] + simp only [him, ↓reduceIte, projIcc_of_mem zero_le_one h1q_mem] + rw [hinv] + refine ⟨⟨(mobBdBotU q.2, ⟨1 - q.1, h1q_mem⟩), .inr ?_, rfl⟩, ?_⟩ + · change 1 - δ (circleBot (mobBdBotU q.2)) ≤ 1 - q.1 + rw [circleBot_mobBdBotU him'] + linarith [hq.2] + · change collarCoordsAux (mobBdBotU q.2, ⟨1 - q.1, h1q_mem⟩) = q + dsimp [collarCoordsAux] + have hnot : ¬ (1 - q.1 < 1 / 2) := by linarith [hq.2, hδ.2] + have hgt : 1 / 2 < 1 - q.1 := by linarith [hq.2, hδ.2] + simp only [hnot, hgt, ↓reduceIte, sub_sub_cancel, circleBot_mobBdBotU him'] + +theorem image_collarCoords_collar {δ : Circle → ℝ} + (hδ_bd : ∀ z, 0 ≤ δ z ∧ δ z ≤ 1 / 4) : + collarCoords '' (Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ) = + {q : ℝ × Circle | 0 ≤ q.1 ∧ q.1 ≤ δ q.2} := by + ext q + constructor + · rintro ⟨_, ⟨⟨u, v⟩, hp, rfl⟩, rfl⟩ + rcases hp with hp1 | hp2 + · have hlt : (v : ℝ) < 1 / 2 := by + linarith [show (v : ℝ) ≤ δ (circleTop u) from hp1, (hδ_bd (circleTop u)).2] + change collarCoordsAux (u, v) ∈ {q : ℝ × Circle | 0 ≤ q.1 ∧ q.1 ≤ δ q.2} + dsimp [collarCoordsAux] + simp only [hlt, ↓reduceIte] + exact ⟨v.2.1, hp1⟩ + · have hgt : 1 / 2 < (v : ℝ) := by + linarith [show 1 - δ (circleBot u) ≤ (v : ℝ) from hp2, (hδ_bd (circleBot u)).2] + have hnot : ¬ ((v : ℝ) < 1 / 2) := by linarith + change collarCoordsAux (u, v) ∈ {q : ℝ × Circle | 0 ≤ q.1 ∧ q.1 ≤ δ q.2} + dsimp [collarCoordsAux] + simp only [hnot, hgt, ↓reduceIte] + exact ⟨by linarith [v.2.2], by linarith [show 1 - δ (circleBot u) ≤ (v : ℝ) from hp2]⟩ + · intro hq + obtain ⟨hmem, heq⟩ := collarCoords_collarCoordsInv hδ_bd hq + exact ⟨collarCoordsInv q, hmem, heq⟩ + +theorem image_collarCoords_cuff {δ : Circle → ℝ} + (hδ_bd : ∀ z, 0 ≤ δ z ∧ δ z ≤ 1 / 4) : + collarCoords '' (Quotient.mk Surface.mobiusSetoid '' mobCuffPairSet δ) = + {q : ℝ × Circle | q.1 = δ q.2} := by + ext q + constructor + · rintro ⟨_, ⟨⟨u, v⟩, hp, rfl⟩, rfl⟩ + rcases hp with hp1 | hp2 + · have hlt : (v : ℝ) < 1 / 2 := by + linarith [show (v : ℝ) = δ (circleTop u) from hp1, (hδ_bd (circleTop u)).2] + change (collarCoordsAux (u, v)).1 = δ (collarCoordsAux (u, v)).2 + dsimp [collarCoordsAux] + simp only [hlt, ↓reduceIte] + exact hp1 + · have hgt : 1 / 2 < (v : ℝ) := by + linarith [show (v : ℝ) = 1 - δ (circleBot u) from hp2, (hδ_bd (circleBot u)).2] + have hnot : ¬ ((v : ℝ) < 1 / 2) := by linarith + change (collarCoordsAux (u, v)).1 = δ (collarCoordsAux (u, v)).2 + dsimp [collarCoordsAux] + simp only [hnot, hgt, ↓reduceIte] + linarith [show (v : ℝ) = 1 - δ (circleBot u) from hp2] + · intro hq + have hq_eq : q.1 = δ q.2 := hq + have hδ := hδ_bd q.2 + have hq_mem : q.1 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [hδ.1], by linarith [hδ.2]⟩ + have h1q_mem : 1 - q.1 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [hδ.2], by linarith [hδ.1]⟩ + by_cases him : 0 ≤ (q.2 : ℂ).im + · refine ⟨Quotient.mk Surface.mobiusSetoid (mobBdTopU q.2, ⟨q.1, hq_mem⟩), + ⟨(mobBdTopU q.2, ⟨q.1, hq_mem⟩), .inl ?_, rfl⟩, ?_⟩ + · change q.1 = δ (circleTop (mobBdTopU q.2)) + rwa [circleTop_mobBdTopU him] + · change collarCoordsAux (mobBdTopU q.2, ⟨q.1, hq_mem⟩) = q + dsimp [collarCoordsAux] + have hlt : q.1 < 1 / 2 := by linarith [hδ.2] + simp only [hlt, ↓reduceIte, circleTop_mobBdTopU him] + · have him' : (q.2 : ℂ).im ≤ 0 := (lt_of_not_ge him).le + refine ⟨Quotient.mk Surface.mobiusSetoid (mobBdBotU q.2, ⟨1 - q.1, h1q_mem⟩), + ⟨(mobBdBotU q.2, ⟨1 - q.1, h1q_mem⟩), .inr ?_, rfl⟩, ?_⟩ + · change 1 - q.1 = 1 - δ (circleBot (mobBdBotU q.2)) + rw [circleBot_mobBdBotU him', hq_eq] + · change collarCoordsAux (mobBdBotU q.2, ⟨1 - q.1, h1q_mem⟩) = q + dsimp [collarCoordsAux] + have hnot : ¬ (1 - q.1 < 1 / 2) := by linarith [hδ.2] + have hgt : 1 / 2 < 1 - q.1 := by linarith [hδ.2] + simp only [hnot, hgt, ↓reduceIte, sub_sub_cancel, circleBot_mobBdBotU him'] + +/-- Pinched boundary circle embedding `Circle → MobiusBand`. -/ +noncomputable def pinchMobBd {δ : Circle → ℝ} + (hδ_cont : Continuous δ) (hδ_bd : ∀ z, 0 ≤ δ z ∧ δ z ≤ 1 / 4) (z : Circle) : MobiusBand := + (pinchMobHomeo hδ_cont hδ_bd (mobBd z)).1 + +theorem isEmbedding_pinchMobBd {δ : Circle → ℝ} + (hδ_cont : Continuous δ) (hδ_bd : ∀ z, 0 ≤ δ z ∧ δ z ≤ 1 / 4) : + IsEmbedding (pinchMobBd hδ_cont hδ_bd) := + IsEmbedding.subtypeVal.comp ((pinchMobHomeo hδ_cont hδ_bd).isEmbedding.comp isEmbedding_mobBd) + +theorem pinchMobBd_eq_mobBd_of_eq_zero {δ : Circle → ℝ} + (hδ_cont : Continuous δ) (hδ_bd : ∀ z, 0 ≤ δ z ∧ δ z ≤ 1 / 4) + {z : Circle} (hz0 : δ z = 0) : + pinchMobBd hδ_cont hδ_bd z = mobBd z := by + by_cases him : 0 ≤ (z : ℂ).im + · dsimp [pinchMobBd] + rw [mobBd_of_im_nonneg him] + change Quotient.mk Surface.mobiusSetoid (pinchMobPair δ (mobBdTopU z, 0)) = + Quotient.mk Surface.mobiusSetoid (mobBdTopU z, 0) + congr 1 + refine Prod.ext rfl (Subtype.ext ?_) + rw [pinchMobPair_snd_coe hδ_bd, circleTop_mobBdTopU him, hz0] + simp + · have him' : (z : ℂ).im ≤ 0 := (lt_of_not_ge him).le + dsimp [pinchMobBd] + rw [mobBd_of_im_nonpos him'] + change Quotient.mk Surface.mobiusSetoid (pinchMobPair δ (mobBdBotU z, 1)) = + Quotient.mk Surface.mobiusSetoid (mobBdBotU z, 1) + congr 1 + refine Prod.ext rfl (Subtype.ext ?_) + rw [pinchMobPair_snd_coe hδ_bd, circleBot_mobBdBotU him', hz0] + simp + +theorem range_pinchMobBd {δ : Circle → ℝ} + (hδ_cont : Continuous δ) (hδ_bd : ∀ z, 0 ≤ δ z ∧ δ z ≤ 1 / 4) : + range (pinchMobBd hδ_cont hδ_bd) = + Quotient.mk Surface.mobiusSetoid '' mobCuffPairSet δ := by + ext y + constructor + · rintro ⟨z, rfl⟩ + by_cases him : 0 ≤ (z : ℂ).im + · dsimp [pinchMobBd] + rw [mobBd_of_im_nonneg him] + refine ⟨pinchMobPair δ (mobBdTopU z, 0), .inl ?_, rfl⟩ + change ((pinchMobPair δ (mobBdTopU z, 0)).2 : ℝ) = δ (circleTop (mobBdTopU z)) + rw [pinchMobPair_snd_coe hδ_bd] + simp + · have him' : (z : ℂ).im ≤ 0 := (lt_of_not_ge him).le + dsimp [pinchMobBd] + rw [mobBd_of_im_nonpos him'] + refine ⟨pinchMobPair δ (mobBdBotU z, 1), .inr ?_, rfl⟩ + change ((pinchMobPair δ (mobBdBotU z, 1)).2 : ℝ) = 1 - δ (circleBot (mobBdBotU z)) + rw [pinchMobPair_snd_coe hδ_bd] + simp [Icc.coe_one] + ring + · rintro ⟨⟨u, v⟩, hp, rfl⟩ + rcases hp with hp1 | hp2 + · refine ⟨circleTop u, ?_⟩ + dsimp [pinchMobBd] + rw [mobBd_circleTop] + change Quotient.mk Surface.mobiusSetoid (pinchMobPair δ (u, 0)) = + Quotient.mk Surface.mobiusSetoid (u, v) + congr 1 + refine Prod.ext rfl (Subtype.ext ?_) + rw [pinchMobPair_snd_coe hδ_bd] + simp only [Icc.coe_zero, zero_mul, add_zero] + exact (show (v : ℝ) = δ (circleTop u) from hp1).symm + · refine ⟨circleBot u, ?_⟩ + dsimp [pinchMobBd] + rw [mobBd_circleBot] + change Quotient.mk Surface.mobiusSetoid (pinchMobPair δ (u, 1)) = + Quotient.mk Surface.mobiusSetoid (u, v) + congr 1 + refine Prod.ext rfl (Subtype.ext ?_) + rw [pinchMobPair_snd_coe hδ_bd] + simp only [Icc.coe_one, one_mul] + linarith [show (v : ℝ) = 1 - δ (circleBot u) from hp2] + +theorem collarCoordsInv_zero (z : Circle) : + collarCoordsInv (0, z) = mobBd z := by + dsimp [collarCoordsInv] + split_ifs with him + · rw [mobBd_of_im_nonneg him] + have h0 : projIcc 0 1 zero_le_one (0 : ℝ) = 0 := + projIcc_of_mem zero_le_one unitInterval.zero_mem + rw [h0] + · have him' : (z : ℂ).im ≤ 0 := (lt_of_not_ge him).le + rw [mobBd_of_im_nonpos him', sub_zero] + have h1 : projIcc 0 1 zero_le_one (1 : ℝ) = 1 := + projIcc_of_mem zero_le_one unitInterval.one_mem + rw [h1] + +theorem mem_bd_iff_collarCoords_fst_eq_zero {δ : Circle → ℝ} + (hδ_bd : ∀ z, 0 ≤ δ z ∧ δ z ≤ 1 / 4) + {y : MobiusBand} (hy : y ∈ Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ) : + y ∈ bd MobiusBand ↔ (collarCoords y).1 = 0 := by + constructor + · intro hbd + rw [bd_mobiusBand] at hbd + obtain ⟨z, rfl⟩ := hbd + rw [collarCoords_mobBd] + · intro h0 + have hpair : collarCoords y = (0, (collarCoords y).2) := Prod.ext h0 rfl + have hy_eq : y = mobBd (collarCoords y).2 := by + rw [← collarCoordsInv_zero, ← hpair, collarCoordsInv_collarCoords hδ_bd hy] + rw [hy_eq, bd_mobiusBand] + exact ⟨(collarCoords y).2, rfl⟩ + +/-- Map from `GluedSpace hb_inj` to `S` that equals the inclusion on `S₁` and maps `MobiusBand` +via `cMap ∘ collarCoords`. -/ +noncomputable def crosscapPinchRetract {S : Type w} [TopologicalSpace S] {Λ : Set S} + (hΛ_open : IsOpen Λ) (g : Circle ≃ₜ ↥(subBd Λ)) + (hb_inj : Function.Injective (crosscapGlueMap hΛ_open g)) + (cMap : ℝ × Circle → S) + (hcMap_zero : ∀ z : Circle, cMap (0, z) = (g z).1) : + GluedSpace hb_inj → S := + Quotient.lift + (fun a => match a with + | .inl x => x.1 + | .inr y => cMap (collarCoords y.down)) + (by + have hagree : ∀ z : ↥(bd MobiusBand), + (crosscapGlueMap hΛ_open g z).1 = cMap (collarCoords z.1) := by + intro z + let w := mobBdHomeo.symm z + have hz : z.1 = mobBd w := congrArg Subtype.val (mobBdHomeo.apply_symm_apply z).symm + have h1 : (crosscapGlueMap hΛ_open g z).1 = (g w).1 := rfl + rw [h1, hz, collarCoords_mobBd, hcMap_zero] + rintro a a' (rfl | ⟨z, rfl, rfl⟩ | ⟨z, rfl, rfl⟩) + · rfl + · exact hagree z + · exact (hagree z).symm) + +@[simp] +theorem crosscapPinchRetract_inl {S : Type w} [TopologicalSpace S] {Λ : Set S} + (hΛ_open : IsOpen Λ) (g : Circle ≃ₜ ↥(subBd Λ)) + (hb_inj : Function.Injective (crosscapGlueMap hΛ_open g)) + (cMap : ℝ × Circle → S) + (hcMap_zero : ∀ z : Circle, cMap (0, z) = (g z).1) + (x : ↥(univ \ Λ : Set S)) : + crosscapPinchRetract hΛ_open g hb_inj cMap hcMap_zero (GluedSpace.inl hb_inj x) = x.1 := rfl + +@[simp] +theorem crosscapPinchRetract_inr {S : Type w} [TopologicalSpace S] {Λ : Set S} + (hΛ_open : IsOpen Λ) (g : Circle ≃ₜ ↥(subBd Λ)) + (hb_inj : Function.Injective (crosscapGlueMap hΛ_open g)) + (cMap : ℝ × Circle → S) + (hcMap_zero : ∀ z : Circle, cMap (0, z) = (g z).1) + (y : MobiusBand) : + crosscapPinchRetract hΛ_open g hb_inj cMap hcMap_zero (GluedSpace.inr hb_inj y) = + cMap (collarCoords y) := rfl + +private theorem crosscap_retract_continuous_on_collar + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) + (δ : Circle → ℝ) + (cMap : ℝ × Circle → S) + (hδ_cont : Continuous δ) + (hδ_bd : ∀ (z : Circle), 0 ≤ δ z ∧ δ z ≤ 1 / 4) + (hcMap_cont : Continuous cMap) : + let S' : Type w := GluedSpace hb_inj + let S₂ : Set S' := range (GluedSpace.inr hb_inj) + ∀ (e₂ : MobiusBand ≃ₜ ↑S₂), + (∀ y, (e₂ y).1 = GluedSpace.inr hb_inj y) → + let A_col : Set MobiusBand := Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ + let C_col : Set S' := GluedSpace.inr hb_inj '' A_col + ∀ (f_XII : S' → S), + (∀ (y : MobiusBand), f_XII (GluedSpace.inr hb_inj y) = cMap (collarCoords y)) → + ContinuousOn f_XII C_col := by + intro S' S₂ e₂ he₂ A_col C_col f_XII hf_inr + have hsub : C_col ⊆ S₂ := image_subset_range _ _ + rw [continuousOn_iff_continuous_domRestrict] + have hcongr : C_col.domRestrict f_XII = + fun x : ↥C_col => cMap (collarCoords (e₂.symm ⟨x.1, hsub x.2⟩)) := by + ext ⟨_, ⟨y, hy, rfl⟩⟩ + have hmem2 : GluedSpace.inr hb_inj y ∈ S₂ := ⟨y, rfl⟩ + have he₂_y : e₂.symm ⟨GluedSpace.inr hb_inj y, hmem2⟩ = y := + (congrArg e₂.symm (Subtype.ext (he₂ y).symm)).trans (e₂.symm_apply_apply y) + change f_XII (GluedSpace.inr hb_inj y) = + cMap (collarCoords (e₂.symm ⟨GluedSpace.inr hb_inj y, hmem2⟩)) + rw [he₂_y, hf_inr] + rw [hcongr] + refine hcMap_cont.comp ?_ + have hcc := continuousOn_iff_continuous_domRestrict.mp (continuousOn_collarCoords hδ_cont hδ_bd) + let g_col : ↥C_col → ↥A_col := fun x => + ⟨e₂.symm ⟨x.1, hsub x.2⟩, by + obtain ⟨y, hy, heq⟩ := x.2 + have hmem2 : GluedSpace.inr hb_inj y ∈ S₂ := ⟨y, rfl⟩ + have hx_eq : (⟨x.1, hsub x.2⟩ : ↥S₂) = ⟨GluedSpace.inr hb_inj y, hmem2⟩ := + Subtype.ext heq.symm + have he₂_y : e₂.symm ⟨GluedSpace.inr hb_inj y, hmem2⟩ = y := + (congrArg e₂.symm (Subtype.ext (he₂ y).symm)).trans (e₂.symm_apply_apply y) + rw [hx_eq, he₂_y] + exact hy⟩ + have hg_col_cont : Continuous g_col := + Continuous.subtype_mk (e₂.symm.continuous.comp (Continuous.subtype_mk continuous_subtype_val + _)) _ + exact hcc.comp hg_col_cont + +private theorem crosscap_collar_interior_maps_inside_disc + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) + (δ : Circle → ℝ) + (D₀ : Set S) + (cMap : ℝ × Circle → S) + (hδ_bd : ∀ (z : Circle), 0 ≤ δ z ∧ δ z ≤ 1 / 4) + (hcMap_inj : InjOn cMap {p | 0 ≤ p.1 ∧ p.1 ≤ δ p.2}) + (hcMap_zero : ∀ (z : Circle), cMap (0, z) = ↑(g z)) : + let S' : Type w := GluedSpace hb_inj + let A_col : Set MobiusBand := Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ + let C_col : Set S' := GluedSpace.inr hb_inj '' A_col + ∀ (f_XII : S' → S), + (∀ (y : MobiusBand), f_XII (GluedSpace.inr hb_inj y) = cMap (collarCoords y)) → + (f_XII '' C_col = closure Λ \ D₀) → + ∀ y ∈ A_col, y ∉ bd MobiusBand → f_XII (GluedSpace.inr hb_inj y) ∈ Λ := by + intro S' A_col C_col f_XII hf_inr hf_img_col y hy hy_not_bd + have hmem_col : f_XII (GluedSpace.inr hb_inj y) ∈ closure Λ \ D₀ := by + rw [← hf_img_col] + exact ⟨GluedSpace.inr hb_inj y, ⟨y, hy, rfl⟩, rfl⟩ + by_contra hnot_Λ + have hbd : f_XII (GluedSpace.inr hb_inj y) ∈ subBd Λ := by + rw [subBd_eq_frontier, hΛ_open.frontier_eq] + exact ⟨hmem_col.1, hnot_Λ⟩ + let z := g.symm ⟨f_XII (GluedSpace.inr hb_inj y), hbd⟩ + have hcz : cMap (0, z) = cMap (collarCoords y) := by + rw [hcMap_zero z, ← hf_inr y] + exact congrArg Subtype.val (g.apply_symm_apply ⟨f_XII (GluedSpace.inr hb_inj y), hbd⟩) + have hcy_mem : collarCoords y ∈ {q : ℝ × Circle | 0 ≤ q.1 ∧ q.1 ≤ δ q.2} := by + rw [← image_collarCoords_collar hδ_bd] + exact mem_image_of_mem collarCoords hy + have hinj := hcMap_inj ⟨le_rfl, (hδ_bd z).1⟩ hcy_mem hcz + have h0 : (collarCoords y).1 = 0 := (congrArg Prod.fst hinj).symm + exact hy_not_bd ((mem_bd_iff_collarCoords_fst_eq_zero hδ_bd hy).mpr h0) + +private theorem crosscap_retract_injective_on_pinched_complement + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) + (δ : Circle → ℝ) + (cMap : ℝ × Circle → S) + (hδ_bd : ∀ (z : Circle), 0 ≤ δ z ∧ δ z ≤ 1 / 4) + (hcMap_inj : InjOn cMap {p | 0 ≤ p.1 ∧ p.1 ≤ δ p.2}) : + let S' : Type w := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let A_col : Set MobiusBand := Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ + let C_col : Set S' := GluedSpace.inr hb_inj '' A_col + let P₁_XII : Set S' := S₁ ∪ C_col + ∀ (f_XII : S' → S), + (∀ y, f_XII (GluedSpace.inl hb_inj y) = y.1) → + (∀ (y : MobiusBand), f_XII (GluedSpace.inr hb_inj y) = cMap (collarCoords y)) → + let ι_XII : ↑P₁_XII → S := fun x => f_XII ↑x + (∀ x ∈ P₁_XII, f_XII x ∈ univ \ Λ → x ∈ S₁) → + Injective ι_XII := by + intro S' S₁ A_col C_col P₁_XII f_XII hf_inl hf_inr ι_XII hf_mem_S₁_of_compl ⟨x₁, hx₁⟩ ⟨x₂, hx₂⟩ + hfx + apply Subtype.ext + dsimp [ι_XII] at hfx + have hcol_inj : Set.InjOn f_XII C_col := by + rintro _ ⟨y₁, hy₁, rfl⟩ _ ⟨y₂, hy₂, rfl⟩ heq + rw [hf_inr y₁, hf_inr y₂] at heq + have hcy₁ : collarCoords y₁ ∈ {q : ℝ × Circle | 0 ≤ q.1 ∧ q.1 ≤ δ q.2} := by + rw [← image_collarCoords_collar hδ_bd]; exact mem_image_of_mem collarCoords hy₁ + have hcy₂ : collarCoords y₂ ∈ {q : ℝ × Circle | 0 ≤ q.1 ∧ q.1 ≤ δ q.2} := by + rw [← image_collarCoords_collar hδ_bd]; exact mem_image_of_mem collarCoords hy₂ + have hp := hcMap_inj hcy₁ hcy₂ heq + have hy_eq : y₁ = y₂ := injOn_collarCoords hδ_bd hy₁ hy₂ hp + rw [hy_eq] + by_cases hfx_compl : f_XII x₁ ∈ univ \ Λ + · obtain ⟨y₁, rfl⟩ := hf_mem_S₁_of_compl x₁ hx₁ hfx_compl + obtain ⟨y₂, rfl⟩ := hf_mem_S₁_of_compl x₂ hx₂ (hfx ▸ hfx_compl) + rw [hf_inl, hf_inl] at hfx + exact congrArg (GluedSpace.inl hb_inj) (Subtype.ext hfx) + · have h_in_Λ : f_XII x₁ ∈ Λ := by + by_contra hnot + exact hfx_compl ⟨mem_univ _, hnot⟩ + have hx₁_col : x₁ ∈ C_col := by + rcases hx₁ with ⟨y, rfl⟩ | hx₁_col + · exact (y.2.2 (hf_inl y ▸ h_in_Λ)).elim + · exact hx₁_col + have hx₂_col : x₂ ∈ C_col := by + have h_in_Λ' : f_XII x₂ ∈ Λ := hfx ▸ h_in_Λ + rcases hx₂ with ⟨y, rfl⟩ | hx₂_col + · exact (y.2.2 (hf_inl y ▸ h_in_Λ')).elim + · exact hx₂_col + exact hcol_inj hx₁_col hx₂_col hfx + +private theorem crosscap_pieces_meet_at_pinched_cuff + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) + (δ : Circle → ℝ) + (hδ_bd : ∀ (z : Circle), 0 ≤ δ z ∧ δ z ≤ 1 / 4) : + let S' : Type w := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let A_col : Set MobiusBand := Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ + let A_mid : Set MobiusBand := Quotient.mk Surface.mobiusSetoid '' mobPinchPairSet δ + let A_cuff : Set MobiusBand := Quotient.mk Surface.mobiusSetoid '' mobCuffPairSet δ + let C_col : Set S' := GluedSpace.inr hb_inj '' A_col + let P₁_XII : Set S' := S₁ ∪ C_col + let P₂_XII : Set S' := GluedSpace.inr hb_inj '' A_mid + let C_XII : Fin 1 → Set S' := ![GluedSpace.inr hb_inj '' A_cuff] + (∀ {α : Type w} (F : Fin 1 → Set α), ⋃ i, F i = F 0) → + (C_XII 0 ⊆ P₁_XII) → + P₁_XII ∩ P₂_XII = ⋃ i, C_XII i := by + intro S' S₁ A_col A_mid A_cuff C_col P₁_XII P₂_XII C_XII hiUnion1 hC0_sub_P₁ + rw [hiUnion1 C_XII] + ext x + constructor + · rintro ⟨hx1, ⟨y, ⟨p, hp_mid, rfl⟩, rfl⟩⟩ + rcases hx1 with ⟨w, hw_eq⟩ | ⟨y₁, hy₁, he₁⟩ + · obtain ⟨hy_bd, _⟩ := (GluedSpace.inl_eq_inr hb_inj).mp hw_eq + have hp_bd : (p.2 : ℝ) = 0 ∨ (p.2 : ℝ) = 1 := by + rcases eq_or_lt_of_le p.2.2.1 with h0 | h0 + · exact .inl h0.symm + · rcases eq_or_lt_of_le p.2.2.2 with h1 | h1 + · exact .inr h1 + · exact (hy_bd (mobius_interior h0 h1)).elim + refine ⟨Quotient.mk Surface.mobiusSetoid p, ⟨p, ?_, rfl⟩, rfl⟩ + rcases hp_bd with hp0' | hp1' + · left + linarith [hp0', hp_mid.1, (hδ_bd (circleTop p.1)).1] + · right + linarith [hp1', hp_mid.2, (hδ_bd (circleBot p.1)).1] + · obtain rfl := GluedSpace.inr_injective hb_inj he₁ + obtain ⟨q, hq_col, hqp⟩ := hy₁ + have hp_col : p ∈ mobCollarPairSet δ := + mobCollarPairSet_saturated δ (Quotient.exact hqp) hq_col + refine ⟨Quotient.mk Surface.mobiusSetoid p, ⟨p, ?_, rfl⟩, rfl⟩ + rcases hp_col with hp1 | hp2 + · exact .inl (le_antisymm hp1 hp_mid.1) + · exact .inr (le_antisymm hp_mid.2 hp2) + · rintro ⟨y, ⟨p, hp_cuff, rfl⟩, rfl⟩ + refine ⟨hC0_sub_P₁ ⟨_, ⟨p, hp_cuff, rfl⟩, rfl⟩, ⟨_, ⟨p, ?_, rfl⟩, rfl⟩⟩ + rcases hp_cuff with hp1 | hp2 + · exact ⟨le_of_eq hp1.symm, + by linarith [show (p.2 : ℝ) = δ (circleTop p.1) from hp1, + (hδ_bd (circleTop p.1)).2, (hδ_bd (circleBot p.1)).2]⟩ + · exact ⟨by linarith [show (p.2 : ℝ) = 1 - δ (circleBot p.1) from hp2, + (hδ_bd (circleTop p.1)).2, (hδ_bd (circleBot p.1)).2], + le_of_eq hp2⟩ + +private theorem crosscap_complement_boundary_is_pinched_cuff + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) + (D₀ : Set S) + (hD₀_open : IsOpen D₀) : + let S' : Type w := GluedSpace hb_inj + ∀ (P₁_XII : Set S'), + ∀ (C_XII : Fin 1 → Set S'), + ∀ (f_XII : S' → S), + (f_XII '' C_XII 0 = subBd D₀) → + ∀ (e_P₁ : ↑P₁_XII ≃ₜ ↑(univ \ D₀)), + (∀ x, f_XII x.1 = (e_P₁ x).1) → + (bd ↑(univ \ D₀) = Subtype.val ⁻¹' subBd D₀) → + (∀ {α : Type w} (F : Fin 1 → Set α), ⋃ i, F i = F 0) → + (C_XII 0 ⊆ P₁_XII) → + (InjOn f_XII P₁_XII) → + Subtype.val '' bd ↑P₁_XII = ⋃ i, C_XII i := by + intro S' P₁_XII C_XII f_XII hf_img_C0 e_P₁ he_P₁ hXD_bd hiUnion1 hC0_sub_P₁ hf_injOn_P₁ + rw [hiUnion1 C_XII] + have hsub1 : Subtype.val '' bd ↥P₁_XII ⊆ P₁_XII := by + rintro _ ⟨x, _, rfl⟩; exact x.2 + refine (hf_injOn_P₁.image_eq_image_iff hsub1 hC0_sub_P₁).mp ?_ + rw [hf_img_C0] + have hbd_e : e_P₁ '' bd ↥P₁_XII = bd ↥(univ \ D₀ : Set S) := image_bd_homeomorph e_P₁ + calc f_XII '' (Subtype.val '' bd ↥P₁_XII) + _ = Subtype.val '' (e_P₁ '' bd ↥P₁_XII) := by + rw [← image_comp, ← image_comp] + exact congrArg (fun f => f '' bd ↥P₁_XII) (funext he_P₁) + _ = Subtype.val '' bd ↥(univ \ D₀ : Set S) := by rw [hbd_e] + _ = subBd D₀ := by + rw [hXD_bd, Subtype.image_preimage_coe] + refine inter_eq_right.mpr ?_ + rw [subBd_eq_frontier, hD₀_open.frontier_eq] + exact fun x hx => ⟨mem_univ _, hx.2⟩ + +private theorem crosscap_retract_continuous_on_base + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) : + let S' : Type w := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + ∀ (e₁ : ↑(univ \ Λ) ≃ₜ ↑S₁), + (∀ x, (e₁ x).1 = GluedSpace.inl hb_inj x) → + ∀ (f_XII : S' → S), + (∀ (y : ↑(univ \ Λ)), f_XII (GluedSpace.inl hb_inj y) = ↑y) → + ContinuousOn f_XII S₁ := by + intro S' S₁ e₁ he₁ f_XII hf_inl + rw [continuousOn_iff_continuous_domRestrict] + have hcongr : S₁.domRestrict f_XII = fun x : ↥S₁ => (e₁.symm x).1 := by + ext x + have hx : x.1 = GluedSpace.inl hb_inj (e₁.symm x) := by + rw [← he₁, e₁.apply_symm_apply] + change f_XII x.1 = (e₁.symm x).1 + rw [hx, hf_inl] + rw [hcongr] + exact continuous_subtype_val.comp e₁.symm.continuous + +private theorem crosscap_retract_image_is_disc_complement + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (D₀ : Set S) + (hD₀_sub : D₀ ⊆ Λ) + (S' : Type w) + (P₁_XII : Set S') + (f_XII : S' → S) + (hf_img_P₁ : f_XII '' P₁_XII = univ \ Λ ∪ closure Λ \ D₀) : + f_XII '' P₁_XII = univ \ D₀ := by + rw [hf_img_P₁] + ext y + constructor + · rintro (hy | hy) + · exact ⟨mem_univ _, fun h => hy.2 (hD₀_sub h)⟩ + · exact ⟨mem_univ _, hy.2⟩ + · rintro ⟨_, hy⟩ + by_cases hyΛ : y ∈ Λ + · exact .inr ⟨subset_closure hyΛ, hy⟩ + · exact .inl ⟨mem_univ _, hyΛ⟩ + +private theorem pinched_crosscap_pieces_cover_surface + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) + (hU_eq : range (GluedSpace.inl hb_inj) ∪ range (GluedSpace.inr hb_inj) = univ) + (δ : Circle → ℝ) : + let S' : Type w := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let A_col : Set MobiusBand := Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ + let A_mid : Set MobiusBand := Quotient.mk Surface.mobiusSetoid '' mobPinchPairSet δ + let C_col : Set S' := GluedSpace.inr hb_inj '' A_col + let P₁_XII : Set S' := S₁ ∪ C_col + let P₂_XII : Set S' := GluedSpace.inr hb_inj '' A_mid + P₁_XII ∪ P₂_XII = univ := by + intro S' S₁ A_col A_mid C_col P₁_XII P₂_XII + let S₂ : Set S' := range (GluedSpace.inr hb_inj) + ext x + refine ⟨fun _ => mem_univ _, fun _ => ?_⟩ + obtain hx1 | ⟨y, rfl⟩ : x ∈ S₁ ∪ S₂ := hU_eq.symm ▸ mem_univ x + · exact .inl (.inl hx1) + · obtain ⟨⟨u, v⟩, rfl⟩ := Quotient.exists_rep y + by_cases h1 : (v : ℝ) ≤ δ (circleTop u) + · exact .inl (.inr ⟨_, ⟨(u, v), .inl h1, rfl⟩, rfl⟩) + · by_cases h2 : 1 - δ (circleBot u) ≤ (v : ℝ) + · exact .inl (.inr ⟨_, ⟨(u, v), .inr h2, rfl⟩, rfl⟩) + · exact .inr ⟨_, ⟨(u, v), ⟨le_of_not_ge h1, le_of_not_ge h2⟩, rfl⟩, rfl⟩ + +private theorem pinched_crosscap_complement_off_base_is_unmarked + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) + {W_pts : Set Circle} : + ∀ (δ : Circle → ℝ), + (∀ (z : Circle), 0 ≤ δ z ∧ δ z ≤ 1 / 4) → + (∀ (z : Circle), δ z = 0 ↔ z ∈ W_pts) → + let S' : Type w := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let A_col : Set MobiusBand := Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ + let C_col : Set S' := GluedSpace.inr hb_inj '' A_col + let P₁_XII : Set S' := S₁ ∪ C_col + P₁_XII \ range (GluedSpace.inl hb_inj) ⊆ GluedSpace.inr hb_inj '' {y | y ∉ bd MobiusBand ∧ + (collarCoords y).1 ≤ 1 / 4 ∧ (collarCoords y).2 ∉ W_pts} := by + intro δ hδ_bd hδ_zero S' S₁ A_col C_col P₁_XII + let b : ↑(bd MobiusBand) → ↑(univ \ Λ) := crosscapGlueMap hΛ_open g + rintro x ⟨hx1 | ⟨y, hy, rfl⟩, hx_not_S₁⟩ + · exact (hx_not_S₁ hx1).elim + · have hy_not_bd : y ∉ bd MobiusBand := fun hbd => + hx_not_S₁ ⟨b ⟨y, hbd⟩, (GluedSpace.inl_eq_inr hb_inj).mpr ⟨hbd, rfl⟩⟩ + have hcy : collarCoords y ∈ {q : ℝ × Circle | 0 ≤ q.1 ∧ q.1 ≤ δ q.2} := by + rw [← image_collarCoords_collar hδ_bd]; exact mem_image_of_mem collarCoords hy + have hy_le : (collarCoords y).1 ≤ 1 / 4 := hcy.2.trans (hδ_bd (collarCoords y).2).2 + have hyW : (collarCoords y).2 ∉ W_pts := fun hw => by + have h0 := (hδ_zero (collarCoords y).2).mpr hw + have hfst0 : (collarCoords y).1 = 0 := le_antisymm (h0 ▸ hcy.2) hcy.1 + exact hy_not_bd ((mem_bd_iff_collarCoords_fst_eq_zero hδ_bd hy).mpr hfst0) + exact ⟨y, ⟨hy_not_bd, hy_le, hyW⟩, rfl⟩ + +private theorem unmarked_pinched_crosscap_cuff_lies_in_collar + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) + {W_pts : Set Circle} + (δ : Circle → ℝ) + (hδ_bd : ∀ (z : Circle), 0 ≤ δ z ∧ δ z ≤ 1 / 4) + (hδ_zero : ∀ (z : Circle), δ z = 0 ↔ z ∈ W_pts) : + let S' : Type w := GluedSpace hb_inj + let A_cuff : Set MobiusBand := Quotient.mk Surface.mobiusSetoid '' mobCuffPairSet δ + let C_XII : Fin 1 → Set S' := ![GluedSpace.inr hb_inj '' A_cuff] + C_XII 0 \ GluedSpace.inr hb_inj '' mobBd '' W_pts ⊆ GluedSpace.inr hb_inj '' {y | y ∉ bd + MobiusBand ∧ (collarCoords y).1 ≤ 1 / 4 ∧ (collarCoords y).2 ∉ W_pts} := by + intro S' A_cuff C_XII + let A_col : Set MobiusBand := Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ + rintro _ ⟨⟨y, hy_cuff, rfl⟩, hnot_W⟩ + have hy_col : y ∈ A_col := by + obtain ⟨p, hp, rfl⟩ := hy_cuff + refine ⟨p, ?_, rfl⟩ + rcases hp with hp1 | hp2 + · exact .inl (le_of_eq hp1) + · exact .inr (le_of_eq hp2.symm) + have hcy_eq : (collarCoords y).1 = δ (collarCoords y).2 := by + have h : collarCoords y ∈ {q : ℝ × Circle | q.1 = δ q.2} := by + rw [← image_collarCoords_cuff hδ_bd]; exact mem_image_of_mem collarCoords hy_cuff + exact h + have hy_le : (collarCoords y).1 ≤ 1 / 4 := hcy_eq ▸ (hδ_bd (collarCoords y).2).2 + have hy_not_bd : y ∉ bd MobiusBand := fun hbd => by + have h0 : (collarCoords y).1 = 0 := + (mem_bd_iff_collarCoords_fst_eq_zero hδ_bd hy_col).mp hbd + have hw : (collarCoords y).2 ∈ W_pts := (hδ_zero (collarCoords y).2).mp (hcy_eq.symm.trans h0) + have hpair : collarCoords y = (0, (collarCoords y).2) := Prod.ext h0 rfl + have hy_mob : y = mobBd (collarCoords y).2 := by + rw [← collarCoordsInv_zero, ← hpair, collarCoordsInv_collarCoords hδ_bd hy_col] + exact hnot_W ⟨mobBd (collarCoords y).2, ⟨(collarCoords y).2, hw, rfl⟩, + congrArg (GluedSpace.inr hb_inj) hy_mob.symm⟩ + have hyW : (collarCoords y).2 ∉ W_pts := fun hw => by + have h0 : (collarCoords y).1 = 0 := hcy_eq.trans ((hδ_zero (collarCoords y).2).mpr hw) + exact hy_not_bd ((mem_bd_iff_collarCoords_fst_eq_zero hδ_bd hy_col).mpr h0) + exact ⟨y, ⟨hy_not_bd, hy_le, hyW⟩, rfl⟩ + +private theorem marked_crosscap_line_lies_in_middle_piece + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) + {W_pts : Set Circle} + (δ : Circle → ℝ) + (hδ_zero : ∀ (z : Circle), δ z = 0 ↔ z ∈ W_pts) : + let S' : Type w := GluedSpace hb_inj + let A_mid : Set MobiusBand := Quotient.mk Surface.mobiusSetoid '' mobPinchPairSet δ + let P₂_XII : Set S' := GluedSpace.inr hb_inj '' A_mid + ∀ (u : unitInterval), circleTop u ∈ W_pts → circleBot u ∈ W_pts → GluedSpace.inr hb_inj '' + Quotient.mk Surface.mobiusSetoid '' {u} ×ˢ univ ⊆ P₂_XII := by + intro S' A_mid P₂_XII + rintro u hu_top hu_bot _ ⟨_, ⟨⟨u', v⟩, ⟨hu', _⟩, rfl⟩, rfl⟩ + have hu_eq : u = u' := hu'.symm + subst hu_eq + refine ⟨Quotient.mk Surface.mobiusSetoid (u, v), ⟨(u, v), ⟨?_, ?_⟩, rfl⟩, rfl⟩ + · linarith [v.2.1, (hδ_zero (circleTop u)).mpr hu_top] + · linarith [v.2.2, (hδ_zero (circleBot u)).mpr hu_bot] + +private theorem mobCuffPairSet_subset_collar (δ : Circle → ℝ) : + mobCuffPairSet δ ⊆ mobCollarPairSet δ := by + rintro p (hleft | hright) + · exact Or.inl hleft.le + · exact Or.inr hright.ge + +/-- The pinched crosscap split on `GluedSpace hb_inj` touching `subBd Λ` only at `g '' W_pts`. -/ +theorem exists_pinched_crosscapSplit {S : Type w} [TopologicalSpace S] [T2Space S] + [ConnectedSpace S] (hS : IsClosedSurface S) {Λ : Set S} + (hΛ_open : IsOpen Λ) (hΛ : IsOpenDisc Λ) + (hCD : IsClosedDisc (closure Λ)) + (hdiscBd : discBd (closure Λ) = subBd Λ) + (hOArc : IsOArc (subBd Λ)) + (hout : ∀ x ∈ closure Λ \ Λ, x ∈ closure (closure Λ)ᶜ) + (g : Circle ≃ₜ ↥(subBd Λ)) + (hb_inj : Function.Injective (crosscapGlueMap hΛ_open g)) + {W_pts : Set Circle} (hW_cl : IsClosed W_pts) (hW_ne : W_pts.Nonempty) : + let S' := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let CollarInt : Set S' := + GluedSpace.inr hb_inj '' + {y : MobiusBand | y ∉ bd MobiusBand ∧ (collarCoords y).1 ≤ 1 / 4 ∧ + (collarCoords y).2 ∉ W_pts} + ∃ (C_XII : Fin 1 → Set S') (P₁_XII P₂_XII : Set S') (ι_XII : ↥P₁_XII → S) + (D : Fin 1 → Set S) (f_XII : S' → S) (f_C0 : Circle ≃ₜ ↥(C_XII 0)), + GM12.IsCrosscapSplit C_XII P₁_XII P₂_XII ι_XII D ∧ + S₁ ⊆ P₁_XII ∧ + (∀ y : ↥(univ \ Λ : Set S), f_XII (GluedSpace.inl hb_inj y) = y.1) ∧ + (∀ x : ↥P₁_XII, ι_XII x = f_XII x.1) ∧ + IsClosedEmbedding ι_XII ∧ + D 0 ⊆ Λ ∧ + closure (D 0) ⊆ closure Λ ∧ + P₁_XII \ S₁ ⊆ CollarInt ∧ + GluedSpace.inr hb_inj '' (mobBd '' W_pts) ⊆ C_XII 0 ∧ + C_XII 0 \ (GluedSpace.inr hb_inj '' (mobBd '' W_pts)) ⊆ CollarInt ∧ + (∀ u : unitInterval, circleTop u ∈ W_pts → circleBot u ∈ W_pts → + GluedSpace.inr hb_inj '' (Quotient.mk Surface.mobiusSetoid '' ({u} ×ˢ univ)) ⊆ P₂_XII) ∧ + (∀ z ∈ W_pts, (f_C0 z).1 = GluedSpace.inr hb_inj (mobBd z)) := by + have : CompactSpace S := hS.1 + have hX_closed : IsClosed (univ \ Λ : Set S) := isClosed_univ.sdiff hΛ_open + have : CompactSpace ↥(univ \ Λ : Set S) := isCompact_iff_compactSpace.mp hX_closed.isCompact + obtain ⟨m_mob⟩ := nonempty_mob_homeo + have hMob_surf : IsSurface MobiusBand := isSurface_of_homeo m_mob (isSurface_model 0 1 1).1 + have : CompactSpace MobiusBand := hMob_surf.1 + have : T2Space MobiusBand := hMob_surf.2.1 + let b := crosscapGlueMap hΛ_open g + have hb_cont := continuous_crosscapGlueMap hΛ_open g + have hb_range := range_crosscapGlueMap hS hΛ_open hOArc hout g + have : T2Space (GluedSpace hb_inj) := GluedSpace.t2Space (isClosed_bd MobiusBand) hb_cont hb_inj + obtain ⟨hS', hConn', _, _, hS₂_surf, hU_eq, _, _⟩ := + isClosedSurface_of_crosscap_glue hS hΛ hOArc hout hb_cont hb_inj hb_range + obtain ⟨δ, D₀, cMap, hδ_cont, hδ_bd, hδ_zero, hD₀_open, hD₀_sub, hCD_D₀, hsubBd_D₀_eq, + hOArc_D₀, hout_D₀, _, _, _, hcMap_cont, hcMap_inj, hcMap_zero, hcMap_collar, hcMap_bd, _⟩ := + exists_pinched_subdisc_of_region hS hΛ_open hCD hdiscBd hout g hW_cl hW_ne + have hcl_D₀_sub : closure D₀ ⊆ closure Λ := closure_mono hD₀_sub + have hD₀_disc : IsOpenDisc D₀ := + isOpenDisc_of_isClosedDisc_closure hS hD₀_open hCD_D₀ hout_D₀ + let S' := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let S₂ : Set S' := range (GluedSpace.inr hb_inj) + let CollarInt : Set S' := + GluedSpace.inr hb_inj '' + {y : MobiusBand | y ∉ bd MobiusBand ∧ (collarCoords y).1 ≤ 1 / 4 ∧ (collarCoords y).2 ∉ W_pts} + have hinl_emb : IsClosedEmbedding (GluedSpace.inl hb_inj) := + (GluedSpace.continuous_inl hb_inj).isClosedEmbedding (GluedSpace.inl_injective hb_inj) + have hinr_emb : IsClosedEmbedding (GluedSpace.inr hb_inj) := + (GluedSpace.continuous_inr hb_inj).isClosedEmbedding (GluedSpace.inr_injective hb_inj) + let e₁ : ↥(univ \ Λ : Set S) ≃ₜ ↥S₁ := hinl_emb.isEmbedding.toHomeomorph + let e₂ : MobiusBand ≃ₜ ↥S₂ := hinr_emb.isEmbedding.toHomeomorph + let A_col : Set MobiusBand := Quotient.mk Surface.mobiusSetoid '' mobCollarPairSet δ + let A_mid : Set MobiusBand := Quotient.mk Surface.mobiusSetoid '' mobPinchPairSet δ + let A_cuff : Set MobiusBand := Quotient.mk Surface.mobiusSetoid '' mobCuffPairSet δ + have hQ_col_cl : IsClosed (mobCollarPairSet δ) := by + rw [mobCollarPairSet, Set.ofPred_or] + refine IsClosed.union (isClosed_le ?_ ?_) (isClosed_le ?_ ?_) + all_goals + have := continuous_circleTop + have := continuous_circleBot + fun_prop + have hQ_mid_cl : IsClosed (mobPinchPairSet δ) := by + rw [mobPinchPairSet, Set.ofPred_and] + refine IsClosed.inter (isClosed_le ?_ ?_) (isClosed_le ?_ ?_) + all_goals + have := continuous_circleTop + have := continuous_circleBot + fun_prop + have hA_col_cl : IsClosed A_col := + (hQ_col_cl.isCompact.image continuous_quotient_mk').isClosed + have hA_mid_cl : IsClosed A_mid := + (hQ_mid_cl.isCompact.image continuous_quotient_mk').isClosed + let C_col : Set S' := GluedSpace.inr hb_inj '' A_col + let P₁_XII : Set S' := S₁ ∪ C_col + let P₂_XII : Set S' := GluedSpace.inr hb_inj '' A_mid + let C_XII : Fin 1 → Set S' := ![GluedSpace.inr hb_inj '' A_cuff] + let f_XII : S' → S := crosscapPinchRetract hΛ_open g hb_inj cMap hcMap_zero + have hf_inl : ∀ y, f_XII (GluedSpace.inl hb_inj y) = y.1 := fun _ => rfl + have hf_inr : ∀ y, f_XII (GluedSpace.inr hb_inj y) = cMap (collarCoords y) := fun _ => rfl + let ι_XII : ↥P₁_XII → S := fun x => f_XII x.1 + have hS₁_cl : IsClosed S₁ := hinl_emb.isClosed_range + have hC_col_cl : IsClosed C_col := hinr_emb.isClosedMap _ hA_col_cl + have : CompactSpace ↥P₁_XII := isCompact_iff_compactSpace.mp (hS₁_cl.union hC_col_cl).isCompact + have hf_S₁_cont : ContinuousOn f_XII S₁ := by + exact crosscap_retract_continuous_on_base (S := S) (Λ := Λ) hΛ_open g hb_inj e₁ (fun _ + => rfl) f_XII + hf_inl + have hf_col_cont : ContinuousOn f_XII C_col := by + exact crosscap_retract_continuous_on_collar (S := S) (Λ := Λ) hΛ_open g hb_inj δ cMap hδ_cont + hδ_bd hcMap_cont e₂ (fun _ => rfl) f_XII hf_inr + have hf_P₁_cont : ContinuousOn f_XII P₁_XII := + hf_S₁_cont.union_of_isClosed hf_col_cont hS₁_cl hC_col_cl + have hf_img_S₁ : f_XII '' S₁ = univ \ Λ := by + ext y + exact ⟨by rintro ⟨_, ⟨x, rfl⟩, rfl⟩; exact x.2, + fun hy => ⟨GluedSpace.inl hb_inj ⟨y, hy⟩, ⟨⟨y, hy⟩, rfl⟩, rfl⟩⟩ + have hf_img_col : f_XII '' C_col = closure Λ \ D₀ := by + change f_XII '' (GluedSpace.inr hb_inj '' A_col) = closure Λ \ D₀ + rw [← image_comp] + have hcomp : f_XII ∘ GluedSpace.inr hb_inj = cMap ∘ collarCoords := rfl + rw [hcomp, image_comp, image_collarCoords_collar hδ_bd, hcMap_collar] + have hf_img_C0 : f_XII '' (C_XII 0) = subBd D₀ := by + change f_XII '' (GluedSpace.inr hb_inj '' A_cuff) = subBd D₀ + rw [← image_comp] + have hcomp : f_XII ∘ GluedSpace.inr hb_inj = cMap ∘ collarCoords := rfl + rw [hcomp, image_comp, image_collarCoords_cuff hδ_bd, hcMap_bd] + have hf_img_P₁ : f_XII '' P₁_XII = (univ \ Λ) ∪ (closure Λ \ D₀) := by + change f_XII '' (S₁ ∪ C_col) = _ + rw [image_union, hf_img_S₁, hf_img_col] + have hf_img_P₁_compl : f_XII '' P₁_XII = univ \ D₀ := by + exact crosscap_retract_image_is_disc_complement (S := S) (Λ := Λ) D₀ hD₀_sub S' P₁_XII f_XII + hf_img_P₁ + have hcol_interior : ∀ y ∈ A_col, y ∉ bd MobiusBand → f_XII (GluedSpace.inr hb_inj y) ∈ Λ := by + exact crosscap_collar_interior_maps_inside_disc (S := S) (Λ := Λ) hΛ_open g hb_inj δ D₀ cMap + hδ_bd hcMap_inj hcMap_zero f_XII hf_inr hf_img_col + have hf_mem_S₁_of_compl : ∀ x ∈ P₁_XII, f_XII x ∈ univ \ Λ → x ∈ S₁ := by + rintro x (hx | ⟨y, hy, rfl⟩) hfx + · exact hx + · by_cases hy_bd : y ∈ bd MobiusBand + · exact ⟨b ⟨y, hy_bd⟩, (GluedSpace.inl_eq_inr hb_inj).mpr ⟨hy_bd, rfl⟩⟩ + · exact (hfx.2 (hcol_interior y hy hy_bd)).elim + have hι_XII_inj : Function.Injective ι_XII := by + exact crosscap_retract_injective_on_pinched_complement (S := S) (Λ := Λ) hΛ_open g hb_inj δ + cMap hδ_bd hcMap_inj f_XII hf_inl hf_inr hf_mem_S₁_of_compl + have hι_XII_emb : IsClosedEmbedding ι_XII := + (continuousOn_iff_continuous_domRestrict.mp hf_P₁_cont).isClosedEmbedding hι_XII_inj + have hι_XII_range := (image_eq_range f_XII P₁_XII).symm.trans hf_img_P₁_compl + let e_P₁ : ↥P₁_XII ≃ₜ ↥(univ \ D₀ : Set S) := + hι_XII_emb.isEmbedding.toHomeomorph.trans (Homeomorph.setCongr hι_XII_range) + obtain ⟨hXD_surf, _, hXD_bd, _⟩ := compl_open_isSurface hS hD₀_open hOArc_D₀ hout_D₀ + have hP₁_surf : IsSurface ↥P₁_XII := isSurface_of_homeo e_P₁.symm hXD_surf + let e_pinch := pinchMobHomeo hδ_cont hδ_bd + let j_P₂ : MobiusBand → S' := fun p => GluedSpace.inr hb_inj (e_pinch p).1 + have hj_P₂_emb : IsClosedEmbedding j_P₂ := + hinr_emb.comp (hA_mid_cl.isClosedEmbedding_subtypeVal.comp e_pinch.isClosedEmbedding) + have hj_P₂_range : range j_P₂ = P₂_XII := by + ext x + constructor + · rintro ⟨p, rfl⟩ + exact ⟨(e_pinch p).1, (e_pinch p).2, rfl⟩ + · rintro ⟨q, hq, rfl⟩ + exact ⟨e_pinch.symm ⟨q, hq⟩, by dsimp [j_P₂]; rw [e_pinch.apply_symm_apply]⟩ + let e_P₂ : MobiusBand ≃ₜ ↥P₂_XII := + hj_P₂_emb.isEmbedding.toHomeomorph.trans (Homeomorph.setCongr hj_P₂_range) + have hP₂_surf : IsSurface ↥P₂_XII := isSurface_of_homeo e_P₂ hMob_surf + let c0_map : Circle → S' := fun z => GluedSpace.inr hb_inj (pinchMobBd hδ_cont hδ_bd z) + have hc0_emb : IsEmbedding c0_map := + hinr_emb.isEmbedding.comp (isEmbedding_pinchMobBd hδ_cont hδ_bd) + have hc0_range : range c0_map = C_XII 0 := by + change range (GluedSpace.inr hb_inj ∘ pinchMobBd hδ_cont hδ_bd) = + GluedSpace.inr hb_inj '' A_cuff + rw [range_comp, range_pinchMobBd hδ_cont hδ_bd] + let f_C0 : Circle ≃ₜ ↥(C_XII 0) := + hc0_emb.toHomeomorph.trans (Homeomorph.setCongr hc0_range) + have hj_P₂_cuff : j_P₂ '' bd MobiusBand = C_XII 0 := by + rw [bd_mobiusBand, ← range_comp] + exact hc0_range + have hiUnion1 : ∀ {α : Type w} (F : Fin 1 → Set α), (⋃ i : Fin 1, F i) = F 0 := by + intro α F; ext x; simp + have hbd_P₂ : Subtype.val '' bd ↥P₂_XII = ⋃ i : Fin 1, C_XII i := by + rw [hiUnion1 C_XII, ← hj_P₂_cuff, ← image_bd_homeomorph e_P₂, image_image] + rfl + have hC0_sub_P₁ : C_XII 0 ⊆ P₁_XII := + (image_mono (image_mono (mobCuffPairSet_subset_collar δ))).trans subset_union_right + have hP12_union : P₁_XII ∪ P₂_XII = univ := + pinched_crosscap_pieces_cover_surface (S := S) (Λ := Λ) hΛ_open g hb_inj hU_eq δ + have hP12_inter : P₁_XII ∩ P₂_XII = ⋃ i : Fin 1, C_XII i := by + exact crosscap_pieces_meet_at_pinched_cuff (S := S) (Λ := Λ) hΛ_open g hb_inj δ hδ_bd + hiUnion1 hC0_sub_P₁ + have hf_injOn_P₁ : Set.InjOn f_XII P₁_XII := + fun x₁ hx₁ x₂ hx₂ h => congrArg Subtype.val (@hι_XII_inj ⟨x₁, hx₁⟩ ⟨x₂, hx₂⟩ h) + have hbd_P₁ : Subtype.val '' bd ↥P₁_XII = ⋃ i : Fin 1, C_XII i := by + exact crosscap_complement_boundary_is_pinched_cuff (S := S) (Λ := Λ) hΛ_open g hb_inj D₀ + hD₀_open P₁_XII C_XII f_XII hf_img_C0 e_P₁ (fun _ => rfl) hXD_bd hiUnion1 hC0_sub_P₁ + hf_injOn_P₁ + refine ⟨C_XII, P₁_XII, P₂_XII, ι_XII, ![D₀], f_XII, f_C0, + ⟨?_, inferInstance, ⟨e_P₂.symm⟩⟩, + subset_union_left, fun _ => rfl, fun _ => rfl, hι_XII_emb, hD₀_sub, hcl_D₀_sub, + ?_, ?_, ?_, ?_, ?_⟩ + · refine + { surface := ⟨hS', hConn'⟩ + isOArc := fun i => by + fin_cases i + exact ⟨f_C0⟩ + disjoint := fun i j hij => (hij (Subsingleton.elim i j)).elim + manifold₁ := hP₁_surf + manifold₂ := hP₂_surf + union := hP12_union + inter := hP12_inter + bd₁ := hbd_P₁ + bd₂ := hbd_P₂ + surface_hat := hS + isEmbedding := hι_XII_emb.isEmbedding + isOpenDisc := fun i => by fin_cases i; exact hD₀_disc + bounds := fun i => by + fin_cases i + change subBd D₀ = ι_XII '' (Subtype.val ⁻¹' (C_XII 0)) + rw [← hf_img_C0] + ext y + exact ⟨by rintro ⟨x, hx, rfl⟩; exact ⟨⟨x, hC0_sub_P₁ hx⟩, hx, rfl⟩, + by rintro ⟨⟨x, _⟩, hx, rfl⟩; exact ⟨x, hx, rfl⟩⟩ + disjoint_D := fun i j hij => (hij (Subsingleton.elim i j)).elim + compl := by + rw [hiUnion1 ![D₀], hι_XII_range] + ext x + simp only [mem_compl_iff, mem_sdiff, mem_univ, true_and, Matrix.cons_val_zero] + tauto } + · exact pinched_crosscap_complement_off_base_is_unmarked (S := S) (Λ := Λ) hΛ_open g hb_inj + (W_pts := W_pts) δ hδ_bd hδ_zero + · rintro _ ⟨_, ⟨z, hz, rfl⟩, rfl⟩ + rw [← pinchMobBd_eq_mobBd_of_eq_zero hδ_cont hδ_bd ((hδ_zero z).mpr hz), ← hc0_range] + exact ⟨z, rfl⟩ + · exact unmarked_pinched_crosscap_cuff_lies_in_collar (S := S) (Λ := Λ) hΛ_open g hb_inj (W_pts + := W_pts) δ hδ_bd hδ_zero + · exact marked_crosscap_line_lies_in_middle_piece (S := S) (Λ := Λ) hΛ_open g hb_inj (W_pts := + W_pts) δ hδ_zero + · intro z hz + change GluedSpace.inr hb_inj (pinchMobBd hδ_cont hδ_bd z) = GluedSpace.inr hb_inj (mobBd z) + rw [pinchMobBd_eq_mobBd_of_eq_zero hδ_cont hδ_bd ((hδ_zero z).mpr hz)] + +theorem circle_cross_eq_zero_iff (z z₀ : Circle) : + (z : ℂ).im * (z₀ : ℂ).re - (z : ℂ).re * (z₀ : ℂ).im = 0 ↔ z = z₀ ∨ z = -z₀ := by + have hz := circle_re_sq_add_im_sq z + have hz₀ := circle_re_sq_add_im_sq z₀ + constructor + · intro him + have hre_sq : ((z : ℂ).re * (z₀ : ℂ).re + (z : ℂ).im * (z₀ : ℂ).im) ^ 2 = 1 := by + have hid : ((z : ℂ).re * (z₀ : ℂ).re + (z : ℂ).im * (z₀ : ℂ).im) ^ 2 + + ((z : ℂ).im * (z₀ : ℂ).re - (z : ℂ).re * (z₀ : ℂ).im) ^ 2 = + ((z : ℂ).re ^ 2 + (z : ℂ).im ^ 2) * ((z₀ : ℂ).re ^ 2 + (z₀ : ℂ).im ^ 2) := by ring + nlinarith + have hid_re : ((z : ℂ).re * (z₀ : ℂ).re + (z : ℂ).im * (z₀ : ℂ).im) * (z₀ : ℂ).re - + ((z : ℂ).im * (z₀ : ℂ).re - (z : ℂ).re * (z₀ : ℂ).im) * (z₀ : ℂ).im = + (z : ℂ).re * ((z₀ : ℂ).re ^ 2 + (z₀ : ℂ).im ^ 2) := by ring + have hid_im : ((z : ℂ).re * (z₀ : ℂ).re + (z : ℂ).im * (z₀ : ℂ).im) * (z₀ : ℂ).im + + ((z : ℂ).im * (z₀ : ℂ).re - (z : ℂ).re * (z₀ : ℂ).im) * (z₀ : ℂ).re = + (z : ℂ).im * ((z₀ : ℂ).re ^ 2 + (z₀ : ℂ).im ^ 2) := by ring + rcases sq_eq_one_iff.mp hre_sq with hre | hre + · left + apply Subtype.ext + apply Complex.ext + · rw [hre, him, hz₀] at hid_re; linarith + · rw [hre, him, hz₀] at hid_im; linarith + · right + apply Subtype.ext + apply Complex.ext + · change (z : ℂ).re = - (z₀ : ℂ).re + rw [hre, him, hz₀] at hid_re; linarith + · change (z : ℂ).im = - (z₀ : ℂ).im + rw [hre, him, hz₀] at hid_im; linarith + · rintro (rfl | rfl) + · ring + · change (- (z₀ : ℂ).im) * (z₀ : ℂ).re - (- (z₀ : ℂ).re) * (z₀ : ℂ).im = 0 + ring + +theorem not_mem_and_neg_mem_of_isPreconnected_circle {A : Set Circle} + (hA : IsPreconnected A) {z₀ : Circle} (hz₀ : z₀ ∉ A) (hneg_z₀ : -z₀ ∉ A) + (z : Circle) : ¬ (z ∈ A ∧ -z ∈ A) := by + rintro ⟨hz, hneg_z⟩ + let f : Circle → ℝ := fun w => (w : ℂ).im * (z₀ : ℂ).re - (w : ℂ).re * (z₀ : ℂ).im + have hf_cont : Continuous f := by + dsimp [f] + fun_prop + let U₁ : Set Circle := {w | f w < 0} + let U₂ : Set Circle := {w | 0 < f w} + have hU₁ : IsOpen U₁ := isOpen_lt hf_cont continuous_const + have hU₂ : IsOpen U₂ := isOpen_lt continuous_const hf_cont + have hcov : A ⊆ U₁ ∪ U₂ := by + intro w hw + have hne0 : f w ≠ 0 := by + intro h0 + rcases (circle_cross_eq_zero_iff w z₀).mp h0 with rfl | rfl + · exact hz₀ hw + · exact hneg_z₀ hw + exact lt_or_gt_of_ne hne0 + have hf_neg : f (-z) = - f z := by + change (- (z : ℂ).im) * (z₀ : ℂ).re - (- (z : ℂ).re) * (z₀ : ℂ).im = + - ((z : ℂ).im * (z₀ : ℂ).re - (z : ℂ).re * (z₀ : ℂ).im) + ring + have h1 : (A ∩ U₁).Nonempty := by + rcases hcov hz with hz1 | hz2 + · exact ⟨z, hz, hz1⟩ + · refine ⟨-z, hneg_z, ?_⟩ + change f (-z) < 0 + linarith [show 0 < f z from hz2] + have h2 : (A ∩ U₂).Nonempty := by + rcases hcov hz with hz1 | hz2 + · refine ⟨-z, hneg_z, ?_⟩ + change 0 < f (-z) + linarith [show f z < 0 from hz1] + · exact ⟨z, hz, hz2⟩ + obtain ⟨w, _, hw1, hw2⟩ := hA U₁ U₂ hU₁ hU₂ hcov h1 h2 + linarith [show f w < 0 from hw1, show 0 < f w from hw2] + +theorem disjoint_mobVertical_of_ne {u₁ u₂ : unitInterval} + (hu₁0 : 0 < (u₁ : ℝ)) (hu₁1 : (u₁ : ℝ) < 1) (hne : u₁ ≠ u₂) : + Disjoint (Quotient.mk Surface.mobiusSetoid '' ({u₁} ×ˢ univ)) + (Quotient.mk Surface.mobiusSetoid '' ({u₂} ×ˢ univ)) := by + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨⟨u₁', v₁⟩, ⟨hu₁', _⟩, rfl⟩ ⟨⟨u₂', v₂⟩, ⟨hu₂', _⟩, heq⟩ + have h1 : u₁ = u₁' := hu₁'.symm + have h2 : u₂ = u₂' := hu₂'.symm + subst h1 h2 + rcases mobius_rel (Quotient.exact heq.symm) with h | ⟨h1, _, _⟩ | ⟨_, h2, _⟩ + · exact hne (congrArg Prod.fst h) + · exact hu₁0.ne (congrArg Subtype.val h1).symm + · exact hu₁1.ne (congrArg Subtype.val h2) + +/-- Lifting `exists_striped_disc_in_mobiusBand` to `S₂ = range (GluedSpace.inr hb_inj)` when a +closed subset `K_sub ⊆ S₂` avoids at least one vertical line `L i₀`. -/ +theorem exists_striped_disc_in_S₂_crosscap {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Λ : Set S} + (hΛ_open : IsOpen Λ) (g : Circle ≃ₜ ↥(subBd Λ)) + (hb_inj : Function.Injective (crosscapGlueMap hΛ_open g)) + {φ : ℕ} {u_pt : Fin φ → unitInterval} + (hu_inj : Function.Injective u_pt) + (hu_int : ∀ i, 0 < (u_pt i : ℝ) ∧ (u_pt i : ℝ) < 1) + {a' b' : Fin φ → GluedSpace hb_inj} + (ha' : ∀ i, a' i = GluedSpace.inr hb_inj (Quotient.mk Surface.mobiusSetoid (u_pt i, 0))) + (hb' : ∀ i, b' i = GluedSpace.inr hb_inj (Quotient.mk Surface.mobiusSetoid (u_pt i, 1))) + {L : Fin φ → Set (GluedSpace hb_inj)} + (hL : ∀ i, L i = + GluedSpace.inr hb_inj '' (Quotient.mk Surface.mobiusSetoid '' ({u_pt i} ×ˢ univ))) + {H_path : Fin φ → Drawing (GluedSpace hb_inj)} + (hH_path_U : ∀ i, (H_path i).U = L i) + {H' : Drawing (GluedSpace hb_inj)} + (hS₂_U : range (GluedSpace.inr hb_inj) ∩ H'.U ⊆ + (range (GluedSpace.inl hb_inj) ∩ range (GluedSpace.inr hb_inj)) ∪ ⋃ i : Fin φ, L i) + {K_sub : Set (GluedSpace hb_inj)} (hK_sub_cl : IsClosed K_sub) + (hK_sub_S₂ : K_sub ⊆ range (GluedSpace.inr hb_inj)) + (i₀ : Fin φ) (hK_sub_disj : Disjoint K_sub (L i₀)) : + let S₁ : Set (GluedSpace hb_inj) := range (GluedSpace.inl hb_inj) + let S₂ : Set (GluedSpace hb_inj) := range (GluedSpace.inr hb_inj) + ∃ D : Set (GluedSpace hb_inj), + D ⊆ S₂ ∧ + IsClosedDisc D ∧ + K_sub ⊆ D ∧ + D ∩ (S₁ ∩ S₂) ⊆ discBd D ∧ + D ∩ H'.U ⊆ (D ∩ (S₁ ∩ S₂)) ∪ ⋃ j : {i : Fin φ // i ≠ i₀}, (H_path j.1).U ∧ + ∀ j : {i : Fin φ // i ≠ i₀}, + (H_path j.1).U ⊆ D ∧ + (H_path j.1).U ∩ discBd D = {a' j.1, b' j.1} := by + have : CompactSpace S := hS.1 + have hX_closed : IsClosed (univ \ Λ : Set S) := isClosed_univ.sdiff hΛ_open + have : CompactSpace ↥(univ \ Λ : Set S) := isCompact_iff_compactSpace.mp hX_closed.isCompact + obtain ⟨m_mob⟩ := nonempty_mob_homeo + have hMob_surf : IsSurface MobiusBand := isSurface_of_homeo m_mob (isSurface_model 0 1 1).1 + have : CompactSpace MobiusBand := hMob_surf.1 + have : T2Space MobiusBand := hMob_surf.2.1 + have hb_cont := continuous_crosscapGlueMap hΛ_open g + have : T2Space (GluedSpace hb_inj) := + GluedSpace.t2Space (isClosed_bd MobiusBand) hb_cont hb_inj + have hinr_emb : IsClosedEmbedding (GluedSpace.inr hb_inj) := + (GluedSpace.continuous_inr hb_inj).isClosedEmbedding (GluedSpace.inr_injective hb_inj) + let K_all : Set MobiusBand := + (GluedSpace.inr hb_inj ⁻¹' K_sub) ∪ + ⋃ j : {i : Fin φ // i ≠ i₀}, Quotient.mk Surface.mobiusSetoid '' ({u_pt j.1} ×ˢ univ) + have hK_all_cl : IsClosed K_all := by + refine (hK_sub_cl.preimage (GluedSpace.continuous_inr hb_inj)).union ?_ + exact isClosed_iUnion_of_finite fun j => + ((isCompact_singleton.prod isCompact_univ).image continuous_quotient_mk').isClosed + have hK_all_disj : + Disjoint K_all (Quotient.mk Surface.mobiusSetoid '' ({u_pt i₀} ×ˢ univ)) := by + refine Set.disjoint_left.mpr ?_ + rintro y (hy_sub | hy_vert) hy_i₀ + · have hy_L : GluedSpace.inr hb_inj y ∈ L i₀ := by + rw [hL i₀] + exact ⟨y, hy_i₀, rfl⟩ + exact Set.disjoint_left.mp hK_sub_disj hy_sub hy_L + · obtain ⟨j, hj⟩ := mem_iUnion.mp hy_vert + exact Set.disjoint_left.mp + (disjoint_mobVertical_of_ne (hu_int j.1).1 (hu_int j.1).2 (fun h => j.2 (hu_inj h))) + hj hy_i₀ + obtain ⟨D_mob, ⟨ψ_mob⟩, hK_sub_D_mob, hD_mob_disj, hbd_sub_D_mob, hvert_D_mob⟩ := + exists_striped_disc_in_mobiusBand (u_pt i₀) (hu_int i₀).1 (hu_int i₀).2 hK_all_cl hK_all_disj + let D : Set (GluedSpace hb_inj) := GluedSpace.inr hb_inj '' D_mob + have hD_S₂ : D ⊆ range (GluedSpace.inr hb_inj) := image_subset_range _ _ + let f_D : ↥D_mob → GluedSpace hb_inj := fun p => GluedSpace.inr hb_inj p.1 + have hf_D_emb : IsEmbedding f_D := hinr_emb.isEmbedding.comp IsEmbedding.subtypeVal + have hf_D_range : range f_D = D := by + ext x + exact ⟨by rintro ⟨p, rfl⟩; exact ⟨p.1, p.2, rfl⟩, + by rintro ⟨p, hp, rfl⟩; exact ⟨⟨p, hp⟩, rfl⟩⟩ + let e_D : ↥D_mob ≃ₜ ↥D := hf_D_emb.toHomeomorph.trans (Homeomorph.setCongr hf_D_range) + have hD_disc : IsClosedDisc D := ⟨ψ_mob.trans e_D⟩ + have hdiscBd_D : discBd D = GluedSpace.inr hb_inj '' discBd D_mob := by + change Subtype.val '' bd ↥D = GluedSpace.inr hb_inj '' (Subtype.val '' bd ↥D_mob) + rw [← image_bd_homeomorph e_D, image_image, image_image] + rfl + refine ⟨D, hD_S₂, hD_disc, ?_, ?_, ?_, ?_⟩ + · intro x hx + obtain ⟨p, rfl⟩ := hK_sub_S₂ hx + exact ⟨p, hK_sub_D_mob (.inl hx), rfl⟩ + · rintro _ ⟨⟨p, hpD, rfl⟩, ⟨y, hy_eq⟩, _⟩ + obtain ⟨hp_bd, _⟩ := (GluedSpace.inl_eq_inr hb_inj).mp hy_eq + rw [hdiscBd_D] + exact ⟨p, hbd_sub_D_mob ⟨hpD, hp_bd⟩, rfl⟩ + · rintro x ⟨hxD, hxU⟩ + rcases hS₂_U ⟨hD_S₂ hxD, hxU⟩ with hx12 | hxL + · exact .inl ⟨hxD, hx12⟩ + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxL + by_cases hi : i = i₀ + · subst hi + obtain ⟨p, hpD, rfl⟩ := hxD + rw [hL i] at hxi + obtain ⟨q, hq_u, hq_eq⟩ := hxi + have hpq := GluedSpace.inr_injective hb_inj hq_eq + subst hpq + exact (Set.disjoint_left.mp hD_mob_disj hpD hq_u).elim + · right + refine mem_iUnion.mpr ⟨⟨i, hi⟩, ?_⟩ + rwa [hH_path_U i] + · intro j + have hsub_j : Quotient.mk Surface.mobiusSetoid '' ({u_pt j.1} ×ˢ univ) ⊆ K_all := + fun p hp => .inr (mem_iUnion.mpr ⟨j, hp⟩) + obtain ⟨hj_sub, hj_bd⟩ := hvert_D_mob (u_pt j.1) (hu_int j.1).1 (hu_int j.1).2 hsub_j + rw [hH_path_U j.1, hL j.1, hdiscBd_D, ha' j.1, hb' j.1] + refine ⟨image_mono hj_sub, ?_⟩ + rw [← Set.image_inter (GluedSpace.inr_injective hb_inj), hj_bd, image_pair] + +/-! ## 3. Proof of Graph Minors XV, (3.3) -/ + +/-- Model angles on `Circle` for `a_0, ..., a_{φ-1}, b_0, ..., b_{φ-1}` so that `b_i` is antipodal +to `a_i`. -/ +noncomputable def crosscapModelAngle (φ k : ℕ) : ℝ := + if k < φ then + (k + 1 : ℝ) / (φ + 1 : ℝ) * Real.pi + else + ((k - φ : ℕ) + 1 : ℝ) / (φ + 1 : ℝ) * Real.pi + Real.pi + +theorem strictMono_crosscapModelAngle {φ : ℕ} (hφ : 3 ≤ φ) : + StrictMono (crosscapModelAngle φ) := by + intro i j hij + have hpi : 0 < Real.pi := Real.pi_pos + have hden : (0 : ℝ) < (φ + 1 : ℝ) := by positivity + dsimp [crosscapModelAngle] + split_ifs with hi hj hj + · refine mul_lt_mul_of_pos_right ?_ hpi + exact div_lt_div_of_pos_right (by exact_mod_cast Nat.add_lt_add_right hij 1) hden + · have h1 : (i + 1 : ℝ) / (φ + 1 : ℝ) < 1 := + (div_lt_one hden).mpr (by exact_mod_cast Nat.add_lt_add_right hi 1) + have h2 : 0 < ((j - φ : ℕ) + 1 : ℝ) / (φ + 1 : ℝ) := by positivity + nlinarith + · omega + · have hlt : ((i - φ : ℕ) + 1 : ℝ) / (φ + 1 : ℝ) < ((j - φ : ℕ) + 1 : ℝ) / (φ + 1 : ℝ) := by + refine div_lt_div_of_pos_right ?_ hden + have hsub : i - φ < j - φ := by omega + exact_mod_cast Nat.add_lt_add_right hsub 1 + nlinarith + +theorem crosscapModelAngle_lt_add_two_pi {φ : ℕ} (hφ : 3 ≤ φ) : + ∀ k < 2 * φ, crosscapModelAngle φ k < crosscapModelAngle φ 0 + 2 * Real.pi := by + intro k hk + have hpi : 0 < Real.pi := Real.pi_pos + have hden : (0 : ℝ) < (φ + 1 : ℝ) := by positivity + have h0_pos : 0 < crosscapModelAngle φ 0 := by + dsimp [crosscapModelAngle] + have h0 : 0 < φ := by omega + simp only [h0, ↓reduceIte, Nat.cast_zero, zero_add] + positivity + have hlt : crosscapModelAngle φ k < 2 * Real.pi := by + dsimp [crosscapModelAngle] + split_ifs with hkφ + · have h1 : (k + 1 : ℝ) / (φ + 1 : ℝ) < 1 := + (div_lt_one hden).mpr (by exact_mod_cast Nat.add_lt_add_right hkφ 1) + nlinarith + · have hsub : k - φ < φ := by omega + have h1 : ((k - φ : ℕ) + 1 : ℝ) / (φ + 1 : ℝ) < 1 := + (div_lt_one hden).mpr (by exact_mod_cast Nat.add_lt_add_right hsub 1) + nlinarith + linarith + +theorem crosscapModelAngle_add_phi {φ i : ℕ} (hi : i < φ) : + crosscapModelAngle φ (φ + i) = crosscapModelAngle φ i + Real.pi := by + have hnot : ¬ (φ + i < φ) := by omega + have hsub : φ + i - φ = i := by omega + dsimp [crosscapModelAngle] + simp only [hi, hnot, ↓reduceIte, hsub] + +theorem crosscapModelAngle_mem_Ioo_pi {φ i : ℕ} (hi : i < φ) : + 0 < crosscapModelAngle φ i ∧ crosscapModelAngle φ i < Real.pi := by + have hpi : 0 < Real.pi := Real.pi_pos + have hden : (0 : ℝ) < (φ + 1 : ℝ) := by positivity + dsimp [crosscapModelAngle] + simp only [hi, ↓reduceIte] + refine ⟨by positivity, ?_⟩ + have h1 : (i + 1 : ℝ) / (φ + 1 : ℝ) < 1 := + (div_lt_one hden).mpr (by exact_mod_cast Nat.add_lt_add_right hi 1) + nlinarith + +theorem circle_exp_add_pi (θ : ℝ) : Circle.exp (θ + Real.pi) = - Circle.exp θ := by + apply Subtype.ext + change (Circle.exp (θ + Real.pi) : ℂ) = - (Circle.exp θ : ℂ) + rw [Circle.coe_exp, Complex.ofReal_add, add_mul, Complex.exp_add, Complex.exp_pi_mul_I, + ← Circle.coe_exp] + ring + +theorem circle_exp_im_pos_of_mem_Ioo {θ : ℝ} (h0 : 0 < θ) (hpi : θ < Real.pi) : + 0 < (Circle.exp θ : ℂ).im := by + rw [Circle.coe_exp, Complex.exp_ofReal_mul_I_im] + exact Real.sin_pos_of_pos_of_lt_pi h0 hpi + +theorem circle_exp_re_mem_Ioo_of_mem_Ioo {θ : ℝ} (h0 : 0 < θ) (hpi : θ < Real.pi) : + -1 < (Circle.exp θ : ℂ).re ∧ (Circle.exp θ : ℂ).re < 1 := by + rw [Circle.coe_exp, Complex.exp_ofReal_mul_I_re] + have h1 : Real.cos Real.pi < Real.cos θ := + Real.strictAntiOn_cos ⟨le_of_lt h0, le_of_lt hpi⟩ ⟨le_of_lt (h0.trans hpi), le_rfl⟩ hpi + have h2 : Real.cos θ < Real.cos 0 := + Real.strictAntiOn_cos ⟨le_rfl, le_of_lt (h0.trans hpi)⟩ ⟨le_of_lt h0, le_of_lt hpi⟩ h0 + rw [Real.cos_pi] at h1 + rw [Real.cos_zero] at h2 + exact ⟨h1, h2⟩ + +theorem mobBdBotU_neg (z : Circle) : mobBdBotU (-z) = mobBdTopU z := by + apply Subtype.ext + rw [mobBdBotU_coe, mobBdTopU_coe] + change (1 + (- (z : ℂ)).re) / 2 = (1 - (z : ℂ).re) / 2 + dsimp + ring + +private noncomputable abbrev crosscap_vertical_lines + {S' : Type*} {φ : ℕ} (inr : MobiusBand → S') (u : Fin φ → unitInterval) (i : Fin φ) : Set S' := + inr '' (Quotient.mk Surface.mobiusSetoid '' ({u i} ×ˢ univ)) + +private theorem drawing_on_added_crosscap_is_rigid + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (H : Drawing S) + (θ : ℕ) + (φ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (Λ : Set S) + (a : Fin φ → S) + (b : Fin φ → S) + (hφ : 3 ≤ φ) + (hFree_ab : IsFreeSet H.toHypergraph T θ (range a ∪ range b)) + (hS : IsClosedSurface S) + [ConnectedSpace S] + (hRigid_H : IsRigid H) + (hT : IsTangle H.toHypergraph θ T) + (hθ : 3 ≤ θ) + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (w_a : Fin φ → Circle) + (w_b : Fin φ → Circle) + (hwb_eq_neg : ∀ (i : Fin φ), w_b i = -w_a i) + (u_pt : Fin φ → unitInterval) + (hu_int : ∀ (i : Fin φ), 0 < ↑(u_pt i) ∧ ↑(u_pt i) < 1) + (hu_inj : Injective u_pt) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) [T2Space (GluedSpace hb_inj)] + (hS' : IsClosedSurface (GluedSpace hb_inj)) + (hinr_emb : IsClosedEmbedding (GluedSpace.inr hb_inj)) + (hS₁_cl : IsClosed (range (GluedSpace.inl hb_inj))) + (hS₂_cl : IsClosed (range (GluedSpace.inr hb_inj))) + (C_unp : Fin 1 → Set (GluedSpace hb_inj)) + (ι_unp : ↑(range (GluedSpace.inl hb_inj)) → S) + (hSplit_unp : IsCappedSplit C_unp (range (GluedSpace.inl hb_inj)) (range (GluedSpace.inr + hb_inj)) ι_unp ![Λ]) + (hC_unp_0 : C_unp 0 = GluedSpace.inr hb_inj '' bd MobiusBand) + (hS12_inter : (range (GluedSpace.inl hb_inj)) ∩ (range (GluedSpace.inr hb_inj)) = C_unp 0) + (H₁ : Drawing (GluedSpace hb_inj)) + (a' : Fin φ → (GluedSpace hb_inj)) + (b' : Fin φ → (GluedSpace hb_inj)) + (ha'_V : ∀ (i : Fin φ), a' i ∈ H₁.V) + (hb'_V : ∀ (i : Fin φ), b' i ∈ H₁.V) + (ha'_mobBd : ∀ (i : Fin φ), a' i = GluedSpace.inr hb_inj (mobBd (w_a i))) + (hb'_mobBd : ∀ (i : Fin φ), b' i = GluedSpace.inr hb_inj (mobBd (w_b i))) + (ha'_inr : ∀ (i : Fin φ), a' i = GluedSpace.inr hb_inj ⟦(u_pt i, 0)⟧) + (hb'_inr : ∀ (i : Fin φ), b' i = GluedSpace.inr hb_inj ⟦(u_pt i, 1)⟧) + (hL_line : ∀ (i : Fin φ), IsLineWithEnds (crosscap_vertical_lines + (GluedSpace.inr hb_inj) u_pt i) (a' i) (b' i)) + (hL_disj : Pairwise fun i j => Disjoint (crosscap_vertical_lines (GluedSpace.inr hb_inj) u_pt + i) ((fun i : Fin φ => + GluedSpace.inr hb_inj '' (Quotient.mk Surface.mobiusSetoid '' ({u_pt i} ×ˢ univ))) j)) + (hL_S₁ : ∀ (i : Fin φ), crosscap_vertical_lines (GluedSpace.inr hb_inj) u_pt i ∩ (range + (GluedSpace.inl hb_inj)) = {a' i, b' i}) + (H_path : Fin φ → Drawing (GluedSpace hb_inj)) + (H' : Drawing (GluedSpace hb_inj)) + (hH'_U : H'.U = H₁.U ∪ ⋃ i, crosscap_vertical_lines (GluedSpace.inr hb_inj) u_pt i) + (hSub_H₁ : H₁.IsSubdrawing H') + (hH_path : ∀ (i : Fin φ), (H_path i).U = crosscap_vertical_lines (GluedSpace.inr hb_inj) u_pt i + ∧ (H_path i).IsPathBetween (a' i) (b' i) ∧ (H_path i).IsSubdrawing H' ∧ a' i ∈ (H_path i).V + ∧ b' i ∈ (H_path i).V) + (hCap_unp : IsCappedDrawing ι_unp H' H) + (hS12_sub_U : (range (GluedSpace.inl hb_inj)) ∩ (range (GluedSpace.inr hb_inj)) ⊆ H'.U) + (hX_unp_sub : (range a' ∪ range b') ⊆ H'.V ∩ ((range (GluedSpace.inl hb_inj)) ∩ (range + (GluedSpace.inr + hb_inj)))) + (hι_unp_X : ι_unp '' Subtype.val ⁻¹' (range a' ∪ range b') = range a ∪ range b) + (hS₂_U : (range (GluedSpace.inr hb_inj)) ∩ H'.U ⊆ (range (GluedSpace.inl hb_inj)) ∩ (range + (GluedSpace.inr hb_inj)) ∪ ⋃ i, crosscap_vertical_lines (GluedSpace.inr hb_inj) u_pt i) : + IsRigid H' := by + let S' : Type w := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let S₂ : Set S' := range (GluedSpace.inr hb_inj) + let L := crosscap_vertical_lines (GluedSpace.inr hb_inj) u_pt + let X_unp : Set S' := range a' ∪ range b' + refine theorem_3_2_proof C_unp S₁ S₂ ι_unp ![Λ] H' H X_unp + hSplit_unp hCap_unp hS12_sub_U hX_unp_sub ?_ ?_ ?_ ?_ + · -- Condition (i): trivial since `i, j : Fin 1`. + intro _ _ _ i j _ _ + exact Subsingleton.elim i j + · -- Condition (ii): dials in `S` via `theorem_3_3_claim_3`. + intro F hF hFU hFV + rw [hι_unp_X] + exact theorem_3_3_claim_3 hS hRigid_H hT hθ hFree_ab hF hFU hFV + · -- Condition (iii): dials in `S₂` via `exists_striped_disc_in_S₂_crosscap` and + -- `dial_of_oArc_in_striped_disc`. + intro F hF_S₂ hF hFU hFV + have hL_sub_U : ∀ i, L i ⊆ H'.U := fun i => by + rw [hH'_U]; exact (subset_iUnion L i).trans subset_union_right + obtain ⟨i₀, hF_disj_i₀⟩ := exists_stripe_avoiding_normal_curve hφ hFU hFV hL_sub_U hL_disj + have hF_cl : IsClosed F := hF.isCompact.isClosed + obtain ⟨D, hD_S₂, hD_disc, hF_D, hD_bd, hD_U, hD_paths⟩ := + exists_striped_disc_in_S₂_crosscap hS hΛ_open g hb_inj hu_inj hu_int + ha'_inr hb'_inr (fun _ => rfl) (fun i => (hH_path i).1) hS₂_U hF_cl hF_S₂ i₀ hF_disj_i₀ + obtain ⟨Δ, hΔ_D, hDial⟩ := + dial_of_oArc_in_remaining_stripes hS' hD_disc hD_bd hD_U + (fun i => ⟨(hH_path i).1, (hH_path i).2.2.1⟩) hL_line (fun j => (hD_paths j).2) + hL_disj hF_D hF hFU hFV + exact ⟨Δ, hΔ_D.trans hD_S₂, hDial⟩ + · -- Condition (iv): open disc in `S₂` via `exists_striped_disc_in_S₂_crosscap` and + -- `openDisc_of_chord_in_striped_disc`. + intro F u v P hF_S₂ hu hv hF_line hF_U hP_sub_inter hP_path hPX_card + obtain ⟨hP_sub_H', hPU_inter, hP_line, hK_sub_cl, i₀, havoid⟩ := + exists_stripe_avoiding_path_and_chord hφ hS₁_cl hS₂_cl hL_S₁ hL_disj + (fun i => ⟨hSub_H₁.1 (ha'_V i), hSub_H₁.1 (hb'_V i)⟩) + (fun i x hx => by rw [hH'_U]; exact Or.inr (mem_iUnion.mpr ⟨i, hx⟩)) + hF_line hF_U hP_sub_inter hP_path hPX_card + obtain ⟨ψ_P, -, -⟩ := hP_line + have hPU_S₂ : P.U ⊆ S₂ := hPU_inter.trans inter_subset_right + obtain ⟨D, hD_S₂, hD_disc, hPF_D, hD_bd, hD_U, hD_paths⟩ := + exists_striped_disc_in_S₂_crosscap hS hΛ_open g hb_inj hu_inj hu_int + ha'_inr hb'_inr (fun _ => rfl) (fun i => (hH_path i).1) hS₂_U hK_sub_cl + (union_subset hPU_S₂ hF_S₂) i₀ havoid + let e_sub := (Fintype.equivFin {i : Fin φ // i ≠ i₀}).symm + obtain ⟨hPU_D, hF_D, hPU_bd, hD_U_fin⟩ := + reindex_striped_disc H_path e_sub hPU_inter hPF_D hD_bd hD_U + have hNo_both : ∀ k, ¬ (a' (e_sub k).1 ∈ P.V ∧ b' (e_sub k).1 ∈ P.V) := by + rintro k ⟨ha_j, hb_j⟩ + let j := e_sub k + let bd_emb : Circle → S' := fun z => GluedSpace.inr hb_inj (mobBd z) + have hbd_emb : IsEmbedding bd_emb := hinr_emb.isEmbedding.comp isEmbedding_mobBd + have hbd_range : range bd_emb = C_unp 0 := by + rw [hC_unp_0] + ext x + constructor + · rintro ⟨z, rfl⟩ + exact ⟨mobBd z, by rw [bd_mobiusBand]; exact ⟨z, rfl⟩, rfl⟩ + · rintro ⟨y, hy_bd, rfl⟩ + rw [bd_mobiusBand] at hy_bd + obtain ⟨z, rfl⟩ := hy_bd + exact ⟨z, rfl⟩ + let e_C0 : Circle ≃ₜ ↥(C_unp 0) := + hbd_emb.toHomeomorph.trans (Homeomorph.setCongr hbd_range) + have he_C0_coe : ∀ z : Circle, (e_C0 z).1 = GluedSpace.inr hb_inj (mobBd z) := + fun _ => rfl + have hPU_C0 : P.U ⊆ C_unp 0 := hS12_inter ▸ hPU_inter + let A_circ : Set Circle := bd_emb ⁻¹' P.U + have hA_eq : A_circ = range (fun s : unitInterval => e_C0.symm ⟨(ψ_P s).1, hPU_C0 (ψ_P s).2⟩) + := by + ext z + constructor + · intro hz + have hz_PU : (e_C0 z).1 ∈ P.U := hz + refine ⟨ψ_P.symm ⟨(e_C0 z).1, hz_PU⟩, ?_⟩ + apply e_C0.injective + rw [e_C0.apply_symm_apply] + apply Subtype.ext + change (ψ_P (ψ_P.symm ⟨(e_C0 z).1, hz_PU⟩)).1 = (e_C0 z).1 + exact congrArg Subtype.val (ψ_P.apply_symm_apply ⟨(e_C0 z).1, hz_PU⟩) + · rintro ⟨s, rfl⟩ + change (e_C0 (e_C0.symm ⟨(ψ_P s).1, hPU_C0 (ψ_P s).2⟩)).1 ∈ P.U + rw [e_C0.apply_symm_apply] + exact (ψ_P s).2 + have hA_conn : IsPreconnected A_circ := by + rw [hA_eq] + refine isPreconnected_range (e_C0.symm.continuous.comp ?_) + exact Continuous.subtype_mk (continuous_subtype_val.comp ψ_P.continuous) _ + have hwa_i₀_not : w_a i₀ ∉ A_circ := by + intro h + have ha_PU : a' i₀ ∈ P.U := ha'_mobBd i₀ ▸ h + exact disjoint_left.mp havoid (Or.inl ha_PU) (hL_line i₀).left_mem + have hneg_wa_i₀_not : - w_a i₀ ∉ A_circ := by + rw [← hwb_eq_neg i₀] + intro h + have hb_PU : b' i₀ ∈ P.U := hb'_mobBd i₀ ▸ h + exact disjoint_left.mp havoid (Or.inl hb_PU) (hL_line i₀).right_mem + have hwa_j_mem : w_a j.1 ∈ A_circ := by + change GluedSpace.inr hb_inj (mobBd (w_a j.1)) ∈ P.U + rw [← ha'_mobBd j.1] + exact P.V_subset_U ha_j + have hneg_wa_j_mem : - w_a j.1 ∈ A_circ := by + rw [← hwb_eq_neg j.1] + change GluedSpace.inr hb_inj (mobBd (w_b j.1)) ∈ P.U + rw [← hb'_mobBd j.1] + exact P.V_subset_U hb_j + exact not_mem_and_neg_mem_of_isPreconnected_circle hA_conn hwa_i₀_not hneg_wa_i₀_not + (w_a j.1) ⟨hwa_j_mem, hneg_wa_j_mem⟩ + obtain ⟨U₀, hU₀_open, hU₀_cl, hU₀_D, hU₀_bd, hU₀_disj⟩ := + openDisc_of_chord_in_striped_disc hS' hD_disc (Subset.refl _) hD_U_fin + (fun k => (hH_path (e_sub k).1).1 ▸ hL_line (e_sub k).1) + (fun k => (hH_path (e_sub k).1).2.2.1) + (fun k => ⟨(hH_path (e_sub k).1).2.2.2.1, (hH_path (e_sub k).1).2.2.2.2⟩) + (fun k => (hD_paths (e_sub k)).2) + hPU_D hF_D hPU_bd hF_line hF_U hP_sub_H' hP_path hNo_both + exact ⟨U₀, hU₀_open, hU₀_cl, hU₀_D.trans hD_S₂, hU₀_bd, hU₀_disj⟩ + +private theorem crosscap_lines_meet_base_at_ends + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ : Set S) + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (u_pt : Fin φ → unitInterval) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) : + let S' : Type w := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + ∀ (H₁ : Drawing S'), + (H₁.U ⊆ S₁) → + ∀ (a' : Fin φ → S'), + ∀ (b' : Fin φ → S'), + let L : Fin φ → Set S' := fun i => GluedSpace.inr hb_inj '' Quotient.mk Surface.mobiusSetoid + '' {u_pt i} ×ˢ univ + (∀ (i : Fin φ), a' i ∈ H₁.V) → + (∀ (i : Fin φ), b' i ∈ H₁.V) → + (∀ (i : Fin φ), a' i = GluedSpace.inr hb_inj ⟦(u_pt i, 0)⟧) → + (∀ (i : Fin φ), b' i = GluedSpace.inr hb_inj ⟦(u_pt i, 1)⟧) → + ∀ (i : Fin φ), L i ∩ S₁ = {a' i, b' i} := by + intro S' S₁ H₁ hH₁_sub_S₁ a' b' L ha'_V hb'_V ha'_inr hb'_inr i + ext x + constructor + · rintro ⟨⟨_, ⟨⟨u', v⟩, ⟨hu', _⟩, rfl⟩, rfl⟩, ⟨y, hy_eq⟩⟩ + have hu_eq : u_pt i = u' := hu'.symm + subst hu_eq + obtain ⟨hy_bd, _⟩ := (GluedSpace.inl_eq_inr hb_inj).mp hy_eq + rcases eq_or_lt_of_le v.2.1 with hv0 | hv0 + · left + have hv0' : v = 0 := Subtype.ext hv0.symm + subst hv0' + exact (ha'_inr i).symm + · rcases eq_or_lt_of_le v.2.2 with hv1 | hv1 + · right + have hv1' : v = 1 := Subtype.ext hv1 + subst hv1' + exact (hb'_inr i).symm + · exact (hy_bd (mobius_interior hv0 hv1)).elim + · rintro (rfl | rfl) + · exact ⟨by rw [ha'_inr i]; exact ⟨_, ⟨(u_pt i, 0), ⟨rfl, mem_univ _⟩, rfl⟩, rfl⟩, + hH₁_sub_S₁ (H₁.V_subset_U (ha'_V i))⟩ + · exact ⟨by rw [hb'_inr i]; exact ⟨_, ⟨(u_pt i, 1), ⟨rfl, mem_univ _⟩, rfl⟩, rfl⟩, + hH₁_sub_S₁ (H₁.V_subset_U (hb'_V i))⟩ + +private theorem crosscap_lines_meet_lifted_drawing_at_ends + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ : Set S) + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) : + let S' : Type w := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + ∀ (H₁ : Drawing S'), + (H₁.U ⊆ S₁) → + ∀ (a' : Fin φ → S'), + ∀ (b' : Fin φ → S'), + ∀ (L : Fin φ → Set S'), + (∀ (i : Fin φ), a' i ∈ H₁.V) → + (∀ (i : Fin φ), b' i ∈ H₁.V) → + (∀ (i : Fin φ), L i ∩ S₁ = {a' i, b' i}) → + ∀ (i : Fin φ), L i ∩ H₁.U = {a' i, b' i} := by + intro S' S₁ H₁ hH₁_sub_S₁ a' b' L ha'_V hb'_V hL_S₁ i + refine Subset.antisymm ?_ ?_ + · exact (inter_subset_inter_right _ hH₁_sub_S₁).trans (hL_S₁ i).subset + · rintro x (rfl | rfl) + · have hmem : a' i ∈ L i ∩ S₁ := by rw [hL_S₁ i]; exact Or.inl rfl + exact ⟨hmem.1, H₁.V_subset_U (ha'_V i)⟩ + · have hmem : b' i ∈ L i ∩ S₁ := by rw [hL_S₁ i]; exact Or.inr rfl + exact ⟨hmem.1, H₁.V_subset_U (hb'_V i)⟩ + +private theorem crosscap_inclusion_maps_marked_nodes + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ : Set S) + (a : Fin φ → S) + (b : Fin φ → S) + (hΛ_open : IsOpen Λ) : + let K : Set S := univ \ Λ + ∀ (g : Circle ≃ₜ ↑(subBd Λ)), + ∀ (hb_inj : Injective (crosscapGlueMap hΛ_open g)), + let S' : Type w := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let S₂ : Set S' := range (GluedSpace.inr hb_inj) + ∀ (ι_unp : ↑(range (GluedSpace.inl hb_inj)) → S), + ∀ (g_unp : S → S'), + let a' : Fin φ → S' := fun i => g_unp (a i) + let b' : Fin φ → S' := fun i => g_unp (b i) + (∀ (i : Fin φ), a i ∈ K) → + (∀ (i : Fin φ), b i ∈ K) → + ∀ (H' : Drawing S'), + (∀ y ∈ K, ∀ (hy : g_unp y ∈ S₁), ι_unp ⟨g_unp y, hy⟩ = y) → + let X_unp : Set S' := range a' ∪ range b' + (X_unp ⊆ H'.V ∩ (S₁ ∩ S₂)) → + ι_unp '' Subtype.val ⁻¹' X_unp = range a ∪ range b := by + intro K g hb_inj S' S₁ S₂ ι_unp g_unp a' b' ha_K hb_K H' hι_unp_g X_unp hX_unp_sub + ext y + constructor + · rintro ⟨⟨x, hxS₁⟩, ⟨i, rfl⟩ | ⟨i, rfl⟩, rfl⟩ + · rw [hι_unp_g (a i) (ha_K i) hxS₁]; exact .inl ⟨i, rfl⟩ + · rw [hι_unp_g (b i) (hb_K i) hxS₁]; exact .inr ⟨i, rfl⟩ + · rintro (⟨i, rfl⟩ | ⟨i, rfl⟩) + · have hxS₁ : a' i ∈ S₁ := (hX_unp_sub (.inl ⟨i, rfl⟩)).2.1 + exact ⟨⟨a' i, hxS₁⟩, .inl ⟨i, rfl⟩, hι_unp_g (a i) (ha_K i) hxS₁⟩ + · have hxS₁ : b' i ∈ S₁ := (hX_unp_sub (.inr ⟨i, rfl⟩)).2.1 + exact ⟨⟨b' i, hxS₁⟩, .inr ⟨i, rfl⟩, hι_unp_g (b i) (hb_K i) hxS₁⟩ + +private theorem crosscap_unmarked_collar_avoids_drawing + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ : Set S) + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (w_a : Fin φ → Circle) + (w_b : Fin φ → Circle) + (u_pt : Fin φ → unitInterval) + (htop_upt : ∀ (i : Fin φ), circleTop (u_pt i) = w_a i) + (hbot_upt : ∀ (i : Fin φ), circleBot (u_pt i) = w_b i) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) : + let S' : Type w := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + ∀ (H₁ : Drawing S'), + (H₁.U ⊆ S₁) → + let L : Fin φ → Set S' := fun i => GluedSpace.inr hb_inj '' Quotient.mk Surface.mobiusSetoid + '' {u_pt i} ×ˢ univ + ∀ (H' : Drawing S'), + (H'.U = H₁.U ∪ ⋃ i, L i) → + let W_pts : Set Circle := range w_a ∪ range w_b + let CollarInt : Set S' := GluedSpace.inr hb_inj '' {y | y ∉ bd MobiusBand ∧ (collarCoords y).1 + ≤ 1 / 4 ∧ (collarCoords y).2 ∉ W_pts} + Disjoint CollarInt H'.U := by + intro S' S₁ H₁ hH₁_sub_S₁ L H' hH'_U W_pts CollarInt + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨y, ⟨hy_not_bd, hy_le, hyW⟩, rfl⟩ hxU + rw [hH'_U] at hxU + rcases hxU with hx1 | hxL + · obtain ⟨w, hw_eq⟩ := hH₁_sub_S₁ hx1 + obtain ⟨hy_bd, _⟩ := (GluedSpace.inl_eq_inr hb_inj).mp hw_eq + exact hy_not_bd hy_bd + · obtain ⟨i, ⟨_, ⟨⟨u', v⟩, ⟨hu', _⟩, rfl⟩, heq⟩⟩ := mem_iUnion.mp hxL + have hu_eq : u_pt i = u' := hu'.symm + subst hu_eq + have hy_eq := GluedSpace.inr_injective hb_inj heq + subst hy_eq + change (collarCoordsAux (u_pt i, v)).1 ≤ 1 / 4 at hy_le + change (collarCoordsAux (u_pt i, v)).2 ∉ W_pts at hyW + dsimp [collarCoordsAux] at hy_le hyW + split_ifs at hy_le hyW with h1 h2 + · exact hyW (htop_upt i ▸ Or.inl ⟨i, rfl⟩) + · exact hyW (hbot_upt i ▸ Or.inr ⟨i, rfl⟩) + · linarith + +private theorem pinched_crosscap_cuff_is_normal + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ : Set S) + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) : + let S' : Type w := GluedSpace hb_inj + ∀ (H₁ : Drawing S'), + ∀ (a' : Fin φ → S'), + ∀ (b' : Fin φ → S'), + ∀ (L : Fin φ → Set S'), + (∀ (i : Fin φ), a' i ∈ H₁.V) → + (∀ (i : Fin φ), b' i ∈ H₁.V) → + ∀ (H_path : Fin φ → Drawing S'), + ∀ (H' : Drawing S'), + (H'.U = H₁.U ∪ ⋃ i, L i) → + (H'.V = H₁.V ∪ ⋃ i, (H_path i).V) → + ∀ (W_pts : Set Circle), + let CollarInt : Set S' := GluedSpace.inr hb_inj '' + {y | y ∉ bd MobiusBand ∧ (collarCoords y).1 ≤ 1 / 4 ∧ (collarCoords y).2 ∉ W_pts} + ∀ (C_XII : Fin 1 → Set (GluedSpace hb_inj)), + (GluedSpace.inr hb_inj '' mobBd '' W_pts ⊆ C_XII 0) → + (C_XII 0 \ GluedSpace.inr hb_inj '' mobBd '' W_pts ⊆ GluedSpace.inr hb_inj '' + {y | y ∉ bd MobiusBand ∧ (collarCoords y).1 ≤ 1 / 4 ∧ (collarCoords y).2 ∉ W_pts}) → + (Disjoint CollarInt H'.U) → + (GluedSpace.inr hb_inj '' mobBd '' W_pts = range a' ∪ range b') → + H'.IsNormal (C_XII 0) ∧ H'.V ∩ C_XII 0 = range a' ∪ range b' := by + intro S' H₁ a' b' L ha'_V hb'_V H_path H' hH'_U hH'_V W_pts CollarInt C_XII hW_sub_C0 hC0_diff_W + hCollar_disj hW_eq_ab' + refine glued_isNormal_and_V_inter ?_ ?_ ?_ hH'_U hH'_V + · rintro _ (⟨i, rfl⟩ | ⟨i, rfl⟩) + · exact ha'_V i + · exact hb'_V i + · refine Subset.antisymm ?_ ?_ + · intro x ⟨hx1, hxC0⟩ + by_contra hnot + exact Set.disjoint_left.mp hCollar_disj + (hC0_diff_W ⟨hxC0, hW_eq_ab'.symm ▸ hnot⟩) (by rw [hH'_U]; exact .inl hx1) + · rintro _ (⟨i, rfl⟩ | ⟨i, rfl⟩) + · exact ⟨H₁.V_subset_U (ha'_V i), hW_sub_C0 (hW_eq_ab'.symm ▸ .inl ⟨i, rfl⟩)⟩ + · exact ⟨H₁.V_subset_U (hb'_V i), hW_sub_C0 (hW_eq_ab'.symm ▸ .inr ⟨i, rfl⟩)⟩ + · intro x ⟨hxL, hxC0⟩ + by_contra hnot + exact Set.disjoint_left.mp hCollar_disj + (hC0_diff_W ⟨hxC0, hW_eq_ab'.symm ▸ hnot⟩) (by rw [hH'_U]; exact .inr hxL) + +private theorem pinched_crosscap_preserves_boundary_order + {S : Type w} [TopologicalSpace S] {φ : ℕ} (hφ : 3 ≤ φ) {Λ : Set S} + (hΛ_open : IsOpen Λ) (g : Circle ≃ₜ ↑(subBd Λ)) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) : + let t_model := crosscapModelAngle φ + let w_a : Fin φ → Circle := fun i => Circle.exp (t_model i.1) + let w_b : Fin φ → Circle := fun i => Circle.exp (t_model (φ + i.1)) + ∀ (a' b' : Fin φ → GluedSpace hb_inj), + (∀ i, a' i = GluedSpace.inr hb_inj (mobBd (w_a i))) → + (∀ i, b' i = GluedSpace.inr hb_inj (mobBd (w_b i))) → + ∀ (C_XII : Fin 1 → Set (GluedSpace hb_inj)) (f_C0 : Circle ≃ₜ ↑(C_XII 0)), + (∀ z ∈ range w_a ∪ range w_b, ↑(f_C0 z) = GluedSpace.inr hb_inj (mobBd z)) → + IsListedInOrderOn (C_XII 0) (List.ofFn a' ++ List.ofFn b') := by + intro t_model w_a w_b a' b' ha'_mobBd hb'_mobBd C_XII f_C0 hf_C0_W + have ht_model_mono := strictMono_crosscapModelAngle hφ + have ht_model_bd := crosscapModelAngle_lt_add_two_pi hφ + refine ⟨f_C0, t_model, ht_model_mono, + fun k hk => ht_model_bd k (by simp at hk; omega), fun k hk => ?_⟩ + by_cases hkφ : k < φ + · rw [List.getElem_append_left (by simp [hkφ])] + simp only [List.getElem_ofFn] + rw [ha'_mobBd ⟨k, hkφ⟩] + exact hf_C0_W (w_a ⟨k, hkφ⟩) (.inl ⟨⟨k, hkφ⟩, rfl⟩) + · rw [List.getElem_append_right (by simp; omega)] + simp only [List.length_ofFn, List.getElem_ofFn] + let j : Fin φ := ⟨k - φ, by simp at hk; omega⟩ + have hk_eq : k = φ + j.1 := by dsimp [j]; omega + change (f_C0 (Circle.exp (t_model k))).1 = b' j + rw [hk_eq, hb'_mobBd j] + exact hf_C0_W (w_b j) (.inr ⟨j, rfl⟩) + +private theorem base_drawing_meets_pinched_crosscap_at_ends + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ : Set S) + (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↑(subBd Λ)) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) : + let S' : Type w := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + ∀ (H₁ : Drawing S'), + (H₁.U ⊆ S₁) → + ∀ (a' : Fin φ → S'), + ∀ (b' : Fin φ → S'), + ∀ (L : Fin φ → Set S'), + ∀ (H' : Drawing S'), + (H'.U = H₁.U ∪ ⋃ i, L i) → + ∀ (C_XII : Fin 1 → Set (GluedSpace hb_inj)), + ∀ (P₁_XII : Set (GluedSpace hb_inj)), + ∀ (P₂_XII : Set (GluedSpace hb_inj)), + ∀ (ι_XII : ↑P₁_XII → S), + ∀ (D_XII : Fin 1 → Set S), + (IsCrosscapSplit C_XII P₁_XII P₂_XII ι_XII D_XII) → + (range (GluedSpace.inl hb_inj) ⊆ P₁_XII) → + (H'.IsNormal (C_XII 0) ∧ H'.V ∩ C_XII 0 = range a' ∪ range b') → + H₁.U ∩ P₂_XII ⊆ ⋃ i, {a' i, b' i} := by + intro S' S₁ H₁ hH₁_sub_S₁ a' b' L H' hH'_U C_XII P₁_XII P₂_XII ι_XII D_XII hSplit_XII hS₁_sub_P₁ + hNorm_C0_and_V + x ⟨hx1, hx2⟩ + have hx_inter : x ∈ P₁_XII ∩ P₂_XII := ⟨hS₁_sub_P₁ (hH₁_sub_S₁ hx1), hx2⟩ + rw [hSplit_XII.1.inter] at hx_inter + obtain ⟨j, hxj⟩ := mem_iUnion.mp hx_inter + fin_cases j + have hx_ab' : x ∈ range a' ∪ range b' := by + have h : x ∈ H'.V ∩ C_XII 0 := ⟨hNorm_C0_and_V.1 ⟨hxj, by rw [hH'_U]; exact .inl hx1⟩, hxj⟩ + rwa [hNorm_C0_and_V.2] at h + rcases hx_ab' with ⟨i, rfl⟩ | ⟨i, rfl⟩ + · exact mem_iUnion.mpr ⟨i, .inl rfl⟩ + · exact mem_iUnion.mpr ⟨i, .inr rfl⟩ + +private theorem pinched_crosscap_cuff_vertices_map_to_original_ends + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ : Set S) + (a : Fin φ → S) + (b : Fin φ → S) + (hΛ_open : IsOpen Λ) : + let K : Set S := univ \ Λ + ∀ (g : Circle ≃ₜ ↑(subBd Λ)), + ∀ (hb_inj : Injective (crosscapGlueMap hΛ_open g)), + let S' : Type w := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + ∀ (g_unp : S → S'), + ∀ (H₁ : Drawing S'), + (H₁.U ⊆ S₁) → + let a' : Fin φ → S' := fun i => g_unp (a i) + let b' : Fin φ → S' := fun i => g_unp (b i) + (∀ (i : Fin φ), a i ∈ K) → + (∀ (i : Fin φ), b i ∈ K) → + (∀ (i : Fin φ), a' i ∈ H₁.V) → + (∀ (i : Fin φ), b' i ∈ H₁.V) → + ∀ (H' : Drawing S'), + ∀ (C_XII : Fin 1 → Set (GluedSpace hb_inj)), + ∀ (P₁_XII : Set (GluedSpace hb_inj)), + ∀ (ι_XII : ↑P₁_XII → S), + (range (GluedSpace.inl hb_inj) ⊆ P₁_XII) → + (∀ y ∈ K, ∀ (hy : g_unp y ∈ P₁_XII), ι_XII ⟨g_unp y, hy⟩ = y) → + (H'.IsNormal (C_XII 0) ∧ H'.V ∩ C_XII 0 = range a' ∪ range b') → + ι_XII '' Subtype.val ⁻¹' (H'.V ∩ C_XII 0) = range a ∪ range b := by + intro K g hb_inj S' S₁ g_unp H₁ hH₁_sub_S₁ a' b' ha_K hb_K ha'_V hb'_V H' C_XII P₁_XII ι_XII + hS₁_sub_P₁ hι_XII_g hNorm_C0_and_V + rw [hNorm_C0_and_V.2] + ext y + constructor + · rintro ⟨⟨x, hxP₁⟩, ⟨i, rfl⟩ | ⟨i, rfl⟩, rfl⟩ + · rw [hι_XII_g (a i) (ha_K i) hxP₁]; exact .inl ⟨i, rfl⟩ + · rw [hι_XII_g (b i) (hb_K i) hxP₁]; exact .inr ⟨i, rfl⟩ + · rintro (⟨i, rfl⟩ | ⟨i, rfl⟩) + · have hxP₁ : a' i ∈ P₁_XII := hS₁_sub_P₁ (hH₁_sub_S₁ (H₁.V_subset_U (ha'_V i))) + exact ⟨⟨a' i, hxP₁⟩, .inl ⟨i, rfl⟩, hι_XII_g (a i) (ha_K i) hxP₁⟩ + · have hxP₁ : b' i ∈ P₁_XII := hS₁_sub_P₁ (hH₁_sub_S₁ (H₁.V_subset_U (hb'_V i))) + exact ⟨⟨b' i, hxP₁⟩, .inr ⟨i, rfl⟩, hι_XII_g (b i) (hb_K i) hxP₁⟩ + +private theorem crosscap_embedding_agrees_on_original_edges + {S : Type w} + [TopologicalSpace S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (Λ : Set S) + (hΛ_open : IsOpen Λ) : + let K : Set S := univ \ Λ + ∀ (hK_comp : IsCompact K), + ∀ (hHU : H.U ⊆ K), + ∀ (g : Circle ≃ₜ ↑(subBd Λ)), + ∀ (hb_inj : Injective (crosscapGlueMap hΛ_open g)), + let S' : Type w := GluedSpace hb_inj + ∀ [T2Space S'], + ∀ (g_unp : S → S'), + ∀ (f_unp : S' → S), + ∀ (hg_unp_cont : ContinuousOn g_unp K), + ∀ (hfg_unp_inv : LeftInvOn f_unp g_unp K), + ∀ (hf_unp_cont' : ContinuousOn f_unp (g_unp '' K)), + let H₁ : Drawing S' := liftDrawingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU + let η₁ : SpanEmbedding H₁ G := liftSpanEmbeddingOn hK_comp hg_unp_cont hf_unp_cont' + hfg_unp_inv hHU η + ∀ (H' : Drawing S'), + ∀ (η' : SpanEmbedding H' G), + (∀ e ∈ H₁.E, η'.eMap e = η₁.eMap e) → + ∀ e ∈ H.E, η'.eMap (g_unp '' e) = η.eMap e := by + intro K hK_comp hHU g hb_inj S' _ g_unp f_unp hg_unp_cont hfg_unp_inv hf_unp_cont' H₁ η₁ H' η' + hem_H₁ + e he + have he₁ : g_unp '' e ∈ H₁.E := by + rw [liftDrawingOn_E hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU] + exact ⟨e, he, rfl⟩ + rw [hem_H₁ (g_unp '' e) he₁] + change η.eMap (f_unp '' (g_unp '' e)) = η.eMap e + have he_sub : e ⊆ K := fun x hx => hHU (he.2.1 hx).1 + rw [hfg_unp_inv.image_image' he_sub] + +private theorem realize_marked_crosscap_boundary + {S : Type w} [TopologicalSpace S] {Λ : Set S} + {φ : ℕ} (hφ : 3 ≤ φ) (a b : Fin φ → S) + (hOrder : GM12.IsListedInOrderOn (subBd Λ) (List.ofFn a ++ List.ofFn b)) : + ∃ g : Circle ≃ₜ ↥(subBd Λ), + (∀ i : Fin φ, (g (Circle.exp (crosscapModelAngle φ i.1))).1 = a i) ∧ + (∀ i : Fin φ, (g (Circle.exp (crosscapModelAngle φ (φ + i.1)))).1 = b i) := by + obtain ⟨f₀, t₀, ht₀_mono, ht₀_bd, ht₀_val⟩ := hOrder + have hlen_ab : (List.ofFn a ++ List.ofFn b).length = 2 * φ := by simp [two_mul] + have ht₀_bd' : ∀ k < 2 * φ, t₀ k < t₀ 0 + 2 * Real.pi := + fun k hk => ht₀_bd k (hlen_ab ▸ hk) + let t_model := crosscapModelAngle φ + have ht_model_mono := strictMono_crosscapModelAngle hφ + have ht_model_bd := crosscapModelAngle_lt_add_two_pi hφ + obtain ⟨h_circ, hh_circ⟩ := + exists_circle_homeo_matching_angles (2 * φ) (by omega) t₀ t_model + ht₀_mono ht_model_mono ht₀_bd' ht_model_bd + let g : Circle ≃ₜ ↥(subBd Λ) := h_circ.symm.trans f₀ + let w_a : Fin φ → Circle := fun i => Circle.exp (t_model i.1) + let w_b : Fin φ → Circle := fun i => Circle.exp (t_model (φ + i.1)) + have hg_wa : ∀ i : Fin φ, (g (w_a i)).1 = a i := by + intro i + have h1 : h_circ.symm (w_a i) = Circle.exp (t₀ i.1) := + h_circ.symm_apply_eq.mpr (hh_circ i.1 (by omega)).symm + change (f₀ (h_circ.symm (w_a i))).1 = a i + rw [h1, ht₀_val i.1 (by simp; omega)] + rw [List.getElem_append_left (by simp)] + simp only [List.getElem_ofFn] + have hg_wb : ∀ i : Fin φ, (g (w_b i)).1 = b i := by + intro i + have h1 : h_circ.symm (w_b i) = Circle.exp (t₀ (φ + i.1)) := + h_circ.symm_apply_eq.mpr (hh_circ (φ + i.1) (by omega)).symm + change (f₀ (h_circ.symm (w_b i))).1 = b i + rw [h1, ht₀_val (φ + i.1) (by simp)] + rw [List.getElem_append_right (by simp)] + simp only [List.length_ofFn, Nat.add_sub_cancel_left, List.getElem_ofFn] + exact ⟨g, hg_wa, hg_wb⟩ + +private theorem crosscap_base_inclusion_and_retraction + {S : Type w} [TopologicalSpace S] {Λ : Set S} (hΛ_open : IsOpen Λ) + (g : Circle ≃ₜ ↥(subBd Λ)) (hb_inj : Injective (crosscapGlueMap hΛ_open g)) + (anchor : S) (hanchor : anchor ∈ univ \ Λ) + (ι_unp : ↥(range (GluedSpace.inl hb_inj)) → S) (hι_cont : Continuous ι_unp) + (hι_unp_inl : ∀ y : ↥(univ \ Λ : Set S), + ι_unp ⟨GluedSpace.inl hb_inj y, ⟨y, rfl⟩⟩ = y.1) : + let K : Set S := univ \ Λ + let S' := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + ∃ (g_unp : S → S') (f_unp : S' → S), + (∀ y (hy : y ∈ K), g_unp y = GluedSpace.inl hb_inj ⟨y, hy⟩) ∧ + (∀ y : ↥K, f_unp (GluedSpace.inl hb_inj y) = y.1) ∧ + ContinuousOn g_unp K ∧ Set.LeftInvOn f_unp g_unp K ∧ + g_unp '' K = S₁ ∧ ContinuousOn f_unp (g_unp '' K) := by + intro K S' S₁ + let g_unp : S → S' := by + classical + exact fun y => if hy : y ∈ K then GluedSpace.inl hb_inj ⟨y, hy⟩ else + GluedSpace.inl hb_inj ⟨anchor, hanchor⟩ + let f_unp : S' → S := by + classical + exact fun x => if hx : x ∈ S₁ then ι_unp ⟨x, hx⟩ else anchor + have hg_unp_mem : ∀ y (hy : y ∈ K), g_unp y = GluedSpace.inl hb_inj ⟨y, hy⟩ := by + intro y hy + simp only [g_unp, hy, ↓reduceDIte] + have hf_unp_inl : ∀ y : ↥K, f_unp (GluedSpace.inl hb_inj y) = y.1 := by + intro y + have hx : GluedSpace.inl hb_inj y ∈ S₁ := ⟨y, rfl⟩ + simp only [f_unp, hx, ↓reduceDIte] + exact hι_unp_inl y + have hg_unp_cont : ContinuousOn g_unp K := by + rw [continuousOn_iff_continuous_domRestrict] + have hEq : K.domRestrict g_unp = GluedSpace.inl hb_inj := by + ext ⟨y, hy⟩; exact hg_unp_mem y hy + rw [hEq] + exact GluedSpace.continuous_inl hb_inj + have hf_unp_cont : ContinuousOn f_unp S₁ := by + rw [continuousOn_iff_continuous_domRestrict] + have hEq : S₁.domRestrict f_unp = ι_unp := by + ext ⟨x, hx⟩ + change f_unp x = ι_unp ⟨x, hx⟩ + simp only [f_unp, hx, ↓reduceDIte] + rw [hEq] + exact hι_cont + have hfg_unp_inv : Set.LeftInvOn f_unp g_unp K := by + intro y hy + rw [hg_unp_mem y hy, hf_unp_inl ⟨y, hy⟩] + have hg_unp_K : g_unp '' K = S₁ := by + ext x + exact ⟨by rintro ⟨y, hy, rfl⟩; rw [hg_unp_mem y hy]; exact ⟨⟨y, hy⟩, rfl⟩, + by rintro ⟨⟨y, hy⟩, rfl⟩; exact ⟨y, hy, hg_unp_mem y hy⟩⟩ + have hf_unp_cont' : ContinuousOn f_unp (g_unp '' K) := hg_unp_K.symm ▸ hf_unp_cont + exact ⟨g_unp, f_unp, hg_unp_mem, hf_unp_inl, hg_unp_cont, hfg_unp_inv, hg_unp_K, hf_unp_cont'⟩ + +private theorem assemble_rigid_span_on_added_crosscap + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (θ_star : ℕ) + (θ : ℕ) + (φ : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (Λ : Set S) + (P : Fin φ → Graph α β) + (a : Fin φ → S) + (b : Fin φ → S) + (hSpan : IsSigmaSpan G H η θ_star θ T_star T) + (hOArc : IsOArc (subBd Λ)) + (hφ : 3 ≤ φ) + (hφ_le : φ ≤ θ) + (hP_disj : Pairwise fun i j => Disjoint V(P i) V(P j)) + (hFree_ab : IsFreeSet H.toHypergraph T θ (range a ∪ range b)) + (hS : IsClosedSurface S) + [ConnectedSpace S] + (hRigid_H : IsRigid H) + (hResp_H : IsRespectfulDrawingTangle H θ T) + (hT : IsTangle H.toHypergraph θ T) + (hθ : 3 ≤ θ) + (hΛ_open : IsOpen Λ) + (hΛ_disc : IsOpenDisc Λ) + (hout : ∀ x ∈ closure Λ \ Λ, x ∈ closure (closure Λ)ᶜ) + (hCD : IsClosedDisc (closure Λ)) + (hdiscBd : discBd (closure Λ) = subBd Λ) + (hSubBd_sub_U : subBd Λ ⊆ H.U) + (hK_comp : IsCompact (univ \ Λ)) + (hHU : H.U ⊆ (univ \ Λ)) + (g : Circle ≃ₜ ↑(subBd Λ)) + (hwb_eq_neg : ∀ (i : Fin φ), (fun i : Fin φ => Circle.exp (crosscapModelAngle φ (φ + i.1))) i + = -(fun i : Fin φ => Circle.exp (crosscapModelAngle φ i.1)) i) + (ha_inj : Injective a) + (hb_inj_fn : Injective b) + (hab_ne : ∀ (i j : Fin φ), a i ≠ b j) + (u_pt : Fin φ → unitInterval) + (hu_int : ∀ (i : Fin φ), 0 < ↑(u_pt i) ∧ ↑(u_pt i) < 1) + (htop_upt : ∀ (i : Fin φ), circleTop (u_pt i) = (fun i : Fin φ => Circle.exp + (crosscapModelAngle φ i.1)) i) + (hbot_upt : ∀ (i : Fin φ), circleBot (u_pt i) = (fun i : Fin φ => Circle.exp + (crosscapModelAngle φ (φ + i.1))) i) + (hu_inj : Injective u_pt) + (hb_inj : Injective (crosscapGlueMap hΛ_open g)) + [this : T2Space (GluedSpace hb_inj)] + (hS' : IsClosedSurface (GluedSpace hb_inj)) + [hConn' : ConnectedSpace (GluedSpace hb_inj)] + (hCrosscap : IsObtainedByAddingCrosscap S (GluedSpace hb_inj)) + (hinr_emb : IsClosedEmbedding (GluedSpace.inr hb_inj)) + (hS₁_cl : IsClosed (range (GluedSpace.inl hb_inj))) + (hS₂_cl : IsClosed (range (GluedSpace.inr hb_inj))) + (C_unp : Fin 1 → Set (GluedSpace hb_inj)) + (ι_unp : ↑(range (GluedSpace.inl hb_inj)) → S) + (hSplit_unp : IsCappedSplit C_unp (range (GluedSpace.inl hb_inj)) (range (GluedSpace.inr + hb_inj)) ι_unp ![Λ]) + (hC_unp_0 : C_unp 0 = GluedSpace.inr hb_inj '' bd MobiusBand) + (hι_unp_inl : ∀ (y : ↑(univ \ Λ)), ι_unp ⟨GluedSpace.inl hb_inj y, ⟨y, rfl⟩⟩ = ↑y) + (hS12_inter : (range (GluedSpace.inl hb_inj)) ∩ (range (GluedSpace.inr hb_inj)) = C_unp 0) + (g_unp : S → (GluedSpace hb_inj)) + (f_unp : (GluedSpace hb_inj) → S) + (hg_unp_mem : ∀ (y : S) (hy : y ∈ (univ \ Λ)), g_unp y = GluedSpace.inl hb_inj ⟨y, hy⟩) + (hg_unp_cont : ContinuousOn g_unp (univ \ Λ)) + (hfg_unp_inv : LeftInvOn f_unp g_unp (univ \ Λ)) + (hf_unp_cont' : ContinuousOn f_unp (g_unp '' (univ \ Λ))) + (hH₁_U : (liftDrawingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU).U = g_unp '' H.U) + (hH₁_V : (liftDrawingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU).V = g_unp '' H.V) + (hH₁_sub_S₁ : (liftDrawingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU).U ⊆ (range + (GluedSpace.inl hb_inj))) + (ha_K : ∀ (i : Fin φ), a i ∈ (univ \ Λ)) + (hb_K : ∀ (i : Fin φ), b i ∈ (univ \ Λ)) + (ha'_V : ∀ i : Fin φ, g_unp (a i) ∈ (liftDrawingOn hK_comp hg_unp_cont hf_unp_cont' + hfg_unp_inv H hHU).V) + (hb'_V : ∀ i : Fin φ, g_unp (b i) ∈ (liftDrawingOn hK_comp hg_unp_cont hf_unp_cont' + hfg_unp_inv H hHU).V) + (hinr_mobBd : ∀ z : Circle, GluedSpace.inr hb_inj (mobBd z) = g_unp (g z).1) + (ha'_mobBd : ∀ i : Fin φ, g_unp (a i) = + GluedSpace.inr hb_inj (mobBd (Circle.exp (crosscapModelAngle φ i.1)))) + (hb'_mobBd : ∀ i : Fin φ, g_unp (b i) = + GluedSpace.inr hb_inj (mobBd (Circle.exp (crosscapModelAngle φ (φ + i.1))))) + (ha'_inr : ∀ i : Fin φ, g_unp (a i) = GluedSpace.inr hb_inj ⟦(u_pt i, 0)⟧) + (hb'_inr : ∀ i : Fin φ, g_unp (b i) = GluedSpace.inr hb_inj ⟦(u_pt i, 1)⟧) + (hL_line : ∀ i : Fin φ, IsLineWithEnds + (crosscap_vertical_lines (GluedSpace.inr hb_inj) u_pt i) (g_unp (a i)) (g_unp (b i))) + (hL_disj : Pairwise fun i j => Disjoint + (crosscap_vertical_lines (GluedSpace.inr hb_inj) u_pt i) + (crosscap_vertical_lines (GluedSpace.inr hb_inj) u_pt j)) + (hL_S₁ : ∀ i : Fin φ, crosscap_vertical_lines (GluedSpace.inr hb_inj) u_pt i ∩ + range (GluedSpace.inl hb_inj) = {g_unp (a i), g_unp (b i)}) + (hL_H₁U : ∀ i : Fin φ, crosscap_vertical_lines (GluedSpace.inr hb_inj) u_pt i ∩ + (liftDrawingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU).U = + {g_unp (a i), g_unp (b i)}) + (hP_paths' : ∀ i : Fin φ, IsHPathWithEnds G (liftSpanEmbeddingOn hK_comp hg_unp_cont + hf_unp_cont' hfg_unp_inv hHU η).imageGraph (P i) + ((liftSpanEmbeddingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv hHU η).vMap (g_unp (a i))) + ((liftSpanEmbeddingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv hHU η).vMap (g_unp + (b i)))) : + ∃ (Tnew : Type w) (_ : TopologicalSpace Tnew) (_ : T2Space Tnew), IsObtainedByAddingCrosscap S + Tnew ∧ ∃ (H' : Drawing Tnew) (η' : SpanEmbedding H' G) (T' : Set (Hypergraph Tnew (Set Tnew) + × Hypergraph Tnew (Set Tnew))), IsSigmaSpan G H' η' θ_star φ T_star T' := by + let K := univ \ Λ + let w_a := fun i : Fin φ => Circle.exp (crosscapModelAngle φ i.1) + let w_b := fun i : Fin φ => Circle.exp (crosscapModelAngle φ (φ + i.1)) + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let S₂ := range (GluedSpace.inr hb_inj) + let H₁ := liftDrawingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU + let η₁ := liftSpanEmbeddingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv hHU η + let a' := fun i => g_unp (a i) + let b' := fun i => g_unp (b i) + let L := fun i => GluedSpace.inr hb_inj '' Quotient.mk Surface.mobiusSetoid '' {u_pt i} ×ˢ univ + obtain ⟨H_path, H', η', hH'_U, hH'_V, hH'_E, hSub_H₁, hH_path, hH_path_disj, + _, hvm_H₁, hem_H₁, _, _⟩ := + exists_glued_span_of_lines H₁ η₁ a' b' P L ha'_V hb'_V hP_paths' hP_disj + hL_line hL_disj hL_H₁U + obtain ⟨hU_S₁, hV_S₁, _⟩ := + glued_interSet_base_eq hS₁_cl ha'_V hb'_V hH₁_sub_S₁ hL_S₁ hH'_U hH'_V hH'_E hH_path + have hι_unp_g : ∀ y ∈ K, ∀ hy : g_unp y ∈ S₁, ι_unp ⟨g_unp y, hy⟩ = y := by + intro y hy hgy + have hsub : (⟨g_unp y, hgy⟩ : ↥S₁) = ⟨GluedSpace.inl hb_inj ⟨y, hy⟩, ⟨⟨y, hy⟩, rfl⟩⟩ := + Subtype.ext (hg_unp_mem y hy) + rw [hsub, hι_unp_inl ⟨y, hy⟩] + have hCap_unp : GM12.IsCappedDrawing ι_unp H' H := + isCappedDrawing_of_glued hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv hHU hU_S₁ hV_S₁ hι_unp_g + -- Verify `IsRigid H'` using `theorem_3_2_proof` on the unpinched split. + have hC_unp_0_sub_H₁ : C_unp 0 ⊆ H₁.U := by + rw [hC_unp_0] + rintro _ ⟨y, hy_bd, rfl⟩ + rw [bd_mobiusBand] at hy_bd + obtain ⟨z, rfl⟩ := hy_bd + rw [hinr_mobBd z, hH₁_U] + exact mem_image_of_mem g_unp (hSubBd_sub_U (g z).2) + have hS12_sub_U : S₁ ∩ S₂ ⊆ H'.U := by + rw [hS12_inter, hH'_U] + exact hC_unp_0_sub_H₁.trans subset_union_left + let X_unp : Set S' := range a' ∪ range b' + have ha'_C0 : ∀ i, a' i ∈ C_unp 0 := by + intro i + change g_unp (a i) ∈ C_unp 0 + rw [ha'_mobBd i, hC_unp_0] + exact ⟨mobBd (w_a i), by rw [bd_mobiusBand]; exact ⟨w_a i, rfl⟩, rfl⟩ + have hb'_C0 : ∀ i, b' i ∈ C_unp 0 := by + intro i + change g_unp (b i) ∈ C_unp 0 + rw [hb'_mobBd i, hC_unp_0] + exact ⟨mobBd (w_b i), by rw [bd_mobiusBand]; exact ⟨w_b i, rfl⟩, rfl⟩ + have hX_unp_sub : X_unp ⊆ H'.V ∩ (S₁ ∩ S₂) := by + rintro x (⟨i, rfl⟩ | ⟨i, rfl⟩) + · exact ⟨hSub_H₁.1 (ha'_V i), hS12_inter.symm ▸ ha'_C0 i⟩ + · exact ⟨hSub_H₁.1 (hb'_V i), hS12_inter.symm ▸ hb'_C0 i⟩ + have hι_unp_X : ι_unp '' ((↑) ⁻¹' X_unp) = range a ∪ range b := by + exact crosscap_inclusion_maps_marked_nodes (S := S) φ Λ a b hΛ_open g hb_inj ι_unp + g_unp ha_K hb_K H' hι_unp_g hX_unp_sub + have hS₂_U : S₂ ∩ H'.U ⊆ (S₁ ∩ S₂) ∪ ⋃ i : Fin φ, L i := by + rintro x ⟨hx2, hxU⟩ + rw [hH'_U] at hxU + rcases hxU with hx1 | hxL + · exact .inl ⟨hH₁_sub_S₁ hx1, hx2⟩ + · exact .inr hxL + have hRigid_H' : IsRigid H' := by + exact drawing_on_added_crosscap_is_rigid (S := S) H θ φ T Λ a b hφ hFree_ab hS hRigid_H hT hθ + hΛ_open g w_a w_b hwb_eq_neg u_pt hu_int hu_inj hb_inj hS' hinr_emb hS₁_cl hS₂_cl + C_unp ι_unp hSplit_unp hC_unp_0 hS12_inter H₁ a' b' ha'_V hb'_V ha'_mobBd hb'_mobBd + ha'_inr hb'_inr hL_line hL_disj hL_S₁ H_path H' hH'_U hSub_H₁ hH_path hCap_unp hS12_sub_U + hX_unp_sub hι_unp_X hS₂_U + have hH'_U_ne : H'.U.Nonempty := ⟨a' ⟨0, by omega⟩, H'.V_subset_U (hSub_H₁.1 + (ha'_V ⟨0, by omega⟩))⟩ + have h2Cell_H' : (PaintingOrDrawing.drawing H').IsTwoCell := + isTwoCell_of_isRigid hS' hRigid_H' hH'_U_ne + -- Pinched crosscap split and `GM12Theorem52Statement`. + let W_pts : Set Circle := range w_a ∪ range w_b + have hW_cl : IsClosed W_pts := + (Set.finite_range w_a).isClosed.union (Set.finite_range w_b).isClosed + have hW_ne : W_pts.Nonempty := ⟨w_a ⟨0, by omega⟩, .inl ⟨⟨0, by omega⟩, rfl⟩⟩ + let CollarInt : Set S' := + GluedSpace.inr hb_inj '' + {y : MobiusBand | y ∉ bd MobiusBand ∧ (collarCoords y).1 ≤ 1 / 4 ∧ (collarCoords y).2 ∉ W_pts} + obtain ⟨C_XII, P₁_XII, P₂_XII, ι_XII, D_XII, f_XII, f_C0, hSplit_XII, hS₁_sub_P₁, + hf_XII_inl, hι_XII_eq, _, _, _, hP₁_diff_S₁, hW_sub_C0, hC0_diff_W, hL_sub_P₂, hf_C0_W⟩ := + exists_pinched_crosscapSplit hS hΛ_open hΛ_disc hCD hdiscBd hOArc hout g hb_inj hW_cl hW_ne + have hCollar_disj : Disjoint CollarInt H'.U := by + exact crosscap_unmarked_collar_avoids_drawing (S := S) φ Λ hΛ_open g w_a w_b u_pt htop_upt + hbot_upt hb_inj H₁ hH₁_sub_S₁ H' hH'_U + have hU_P₁_XII : H'.U ∩ P₁_XII = H₁.U := by + refine Subset.antisymm ?_ (subset_inter (by rw [hH'_U]; exact subset_union_left) + (hH₁_sub_S₁.trans hS₁_sub_P₁)) + intro x ⟨hxU, hxP₁⟩ + by_cases hxS₁ : x ∈ S₁ + · exact hU_S₁ ▸ ⟨hxU, hxS₁⟩ + · exact (Set.disjoint_left.mp hCollar_disj (hP₁_diff_S₁ ⟨hxP₁, hxS₁⟩) hxU).elim + have hV_P₁_XII : H'.V ∩ P₁_XII = H₁.V := by + refine Subset.antisymm ?_ (subset_inter hSub_H₁.1 + ((H₁.V_subset_U.trans hH₁_sub_S₁).trans hS₁_sub_P₁)) + intro x ⟨hxV, hxP₁⟩ + by_cases hxS₁ : x ∈ S₁ + · exact hV_S₁ ▸ ⟨hxV, hxS₁⟩ + · exact (Set.disjoint_left.mp hCollar_disj + (hP₁_diff_S₁ ⟨hxP₁, hxS₁⟩) (H'.V_subset_U hxV)).elim + have hι_XII_g : ∀ y ∈ K, ∀ hy : g_unp y ∈ P₁_XII, ι_XII ⟨g_unp y, hy⟩ = y := by + intro y hy hgy + rw [hι_XII_eq ⟨g_unp y, hgy⟩] + change f_XII (g_unp y) = y + rw [hg_unp_mem y hy, hf_XII_inl ⟨y, hy⟩] + have hCap_XII : GM12.IsCappedDrawing ι_XII H' H := + isCappedDrawing_of_glued hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv hHU + hU_P₁_XII hV_P₁_XII hι_XII_g + have hW_eq_ab' : GluedSpace.inr hb_inj '' (mobBd '' W_pts) = range a' ∪ range b' := by + ext x + constructor + · rintro ⟨_, ⟨_, ⟨i, rfl⟩ | ⟨i, rfl⟩, rfl⟩, rfl⟩ + · exact .inl ⟨i, ha'_mobBd i⟩ + · exact .inr ⟨i, hb'_mobBd i⟩ + · rintro (⟨i, rfl⟩ | ⟨i, rfl⟩) + · change g_unp (a i) ∈ GluedSpace.inr hb_inj '' (mobBd '' W_pts) + rw [ha'_mobBd i] + exact ⟨mobBd (w_a i), ⟨w_a i, .inl ⟨i, rfl⟩, rfl⟩, rfl⟩ + · change g_unp (b i) ∈ GluedSpace.inr hb_inj '' (mobBd '' W_pts) + rw [hb'_mobBd i] + exact ⟨mobBd (w_b i), ⟨w_b i, .inr ⟨i, rfl⟩, rfl⟩, rfl⟩ + have hNorm_C0_and_V : H'.IsNormal (C_XII 0) ∧ H'.V ∩ C_XII 0 = range a' ∪ range b' := by + exact pinched_crosscap_cuff_is_normal (S := S) φ Λ hΛ_open g hb_inj H₁ a' b' L ha'_V hb'_V + H_path H' hH'_U hH'_V W_pts C_XII hW_sub_C0 hC0_diff_W hCollar_disj hW_eq_ab' + have ha'_inj : Function.Injective a' := + fun i j hij => ha_inj (hfg_unp_inv.injOn (ha_K i) (ha_K j) hij) + have hb'_inj : Function.Injective b' := + fun i j hij => hb_inj_fn (hfg_unp_inv.injOn (hb_K i) (hb_K j) hij) + have hab'_ne : ∀ i j : Fin φ, a' i ≠ b' j := + fun i j hij => hab_ne i j (by + have h := congrArg f_unp hij + rwa [hfg_unp_inv (ha_K i), hfg_unp_inv (hb_K j)] at h) + have hab'_disj : Disjoint (range a') (range b') := by + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨i, rfl⟩ ⟨j, hj⟩ + exact hab'_ne i j hj.symm + have hNodup_ab' : (List.ofFn a' ++ List.ofFn b').Nodup := by + refine List.nodup_append'.mpr ⟨List.nodup_ofFn.mpr ha'_inj, List.nodup_ofFn.mpr hb'_inj, ?_⟩ + intro x hx₁ hx₂ + obtain ⟨i, rfl⟩ := List.mem_ofFn.mp hx₁ + obtain ⟨j, hj⟩ := List.mem_ofFn.mp hx₂ + exact hab'_ne i j hj.symm + have hCard_C0 : (H'.V ∩ C_XII 0).ncard = 2 * φ := by + rw [hNorm_C0_and_V.2, + Set.ncard_union_eq hab'_disj (Set.finite_range a') (Set.finite_range b'), + Set.ncard_range_of_injective ha'_inj, Set.ncard_range_of_injective hb'_inj, + Nat.card_fin, two_mul] + have hOrder_C0 : GM12.IsListedInOrderOn (C_XII 0) (List.ofFn a' ++ List.ofFn b') := by + exact pinched_crosscap_preserves_boundary_order hφ hΛ_open g hb_inj a' b' + ha'_mobBd hb'_mobBd C_XII f_C0 hf_C0_W + have hP₂_XII_cl : IsClosed P₂_XII := by + have : CompactSpace ↥P₂_XII := hSplit_XII.1.manifold₂.1 + exact (isCompact_iff_compactSpace.mpr this).isClosed + have hH₁_P₂_XII : H₁.U ∩ P₂_XII ⊆ ⋃ i : Fin φ, ({a' i, b' i} : Set S') := by + exact base_drawing_meets_pinched_crosscap_at_ends (S := S) φ Λ hΛ_open g hb_inj H₁ + hH₁_sub_S₁ a' b' L H' hH'_U C_XII P₁_XII P₂_XII ι_XII D_XII hSplit_XII hS₁_sub_P₁ + hNorm_C0_and_V + obtain ⟨hH_path_sub_P₂, hInter_P₂_U⟩ := + glued_interSet_paths_eq hP₂_XII_cl + (fun i => hL_sub_P₂ (u_pt i) (htop_upt i ▸ .inl ⟨i, rfl⟩) (hbot_upt i ▸ .inr ⟨i, rfl⟩)) + hH₁_P₂_XII hH'_V hH'_E hH_path + -- Truncated tangle `T₁` and induced tangle `T'`. + let T₁ := GM10.truncation T φ + have hResp_T₁ : IsRespectfulDrawingTangle H φ T₁ := + isRespectfulDrawingTangle_truncation hResp_H (by omega) hφ_le + have hCtrl_T₁ : IsControllingTangle G H η θ_star φ T_star T₁ := + isControllingTangle_truncation hSpan.isControlling (by omega) hφ_le + have hι_XII_C0 : ι_XII '' ((↑) ⁻¹' (H'.V ∩ C_XII 0)) = range a ∪ range b := by + exact pinched_crosscap_cuff_vertices_map_to_original_ends (S := S) φ Λ a b hΛ_open g hb_inj + g_unp H₁ hH₁_sub_S₁ ha_K hb_K ha'_V hb'_V H' C_XII P₁_XII ι_XII hS₁_sub_P₁ + hι_XII_g hNorm_C0_and_V + have hFree_T₁ : ∀ X ⊆ ι_XII '' ((↑) ⁻¹' (H'.V ∩ C_XII 0)), + X.ncard ≤ φ → IsFreeSet H.toHypergraph T₁ φ X := by + intro X hX_sub hX_card + rw [hι_XII_C0] at hX_sub + exact theorem_3_3_claim_2 hT hFree_ab hX_sub hX_card + have hResp_T' : (PaintingOrDrawing.drawing H').IsRespectful φ + (GM12.inducedAcross ι_XII H' H φ T₁) := + GraphMinor.GM12.theorem_5_2_proof.{w} C_XII P₁_XII P₂_XII ι_XII D_XII H' H φ T₁ H_path a' b' + (le_trans (by norm_num) hφ) hS' hConn' hSplit_XII hCap_XII hNorm_C0_and_V.1 hCard_C0 + hNodup_ab' hOrder_C0 + hNorm_C0_and_V.2.symm + (fun i => ⟨(hH_path i).2.1, hH_path_sub_P₂ i⟩) + hH_path_disj hInter_P₂_U hResp_T₁.2.1 hResp_T₁.2.2 hFree_T₁ + have hη'_v : ∀ v ∈ H.V, η'.vMap (g_unp v) = η.vMap v := by + intro v hv + rw [hvm_H₁ (g_unp v) (by rw [hH₁_V]; exact ⟨v, hv, rfl⟩)] + change η.vMap (f_unp (g_unp v)) = η.vMap v + rw [hfg_unp_inv (hHU (H.V_subset_U hv))] + have hη'_e : ∀ e ∈ H.E, η'.eMap (g_unp '' e) = η.eMap e := by + exact crosscap_embedding_agrees_on_original_edges (S := S) (α := α) (β := β) G H η Λ hΛ_open + hK_comp hHU g hb_inj g_unp f_unp hg_unp_cont hfg_unp_inv hf_unp_cont' H' η' hem_H₁ + obtain ⟨hT', hCtrl_T'⟩ := + isTangle_and_isControlling_inducedAcross hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv + hHU η η' hSub_H₁ hU_P₁_XII hV_P₁_XII hι_XII_g hη'_v hη'_e hCtrl_T₁ + refine ⟨S', inferInstance, inferInstance, hCrosscap, H', η', + GM12.inducedAcross ι_XII H' H φ T₁, ?_⟩ + exact + { isSurface := IsClosedSurface.isSurface hS' + isConnected := hConn' + bd_empty := eq_empty_iff_forall_notMem.mpr fun x hx => hx (hS'.2.2 x) + isRigid := hRigid_H' + isRespectful := ⟨h2Cell_H', hT', hResp_T'⟩ + isControlling := hCtrl_T' } + +/-- **Graph Minors XV, (3.3)** (pages 120–121): +Adding a crosscap to a region `Λ` along `φ` disjoint `η(H)`-paths `P_i` with ends `a_i, b_i` in +circular order `a_1, ..., a_φ, b_1, ..., b_φ` on `subBd Λ` yields a `Σ'`-span `(H', η', T')` of +order `φ`. -/ +theorem theorem_3_3_proof : GM15Theorem33Statement.{u, v, w} := by + intro S _ _ α β G H η θ_star θ φ T_star T Λ P a b + hSpan hΛ hOArc _hCirc hφ hφ_le hNodup_ab hOrder_ab hab_mem hP_paths hP_disj hFree_ab + have hS : IsClosedSurface S := + ⟨hSpan.isSurface.1, hSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hSpan.isConnected + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have : CompactSpace S := hS.1 + have hRigid_H : IsRigid H := hSpan.isRigid + have hResp_H : IsRespectfulDrawingTangle H θ T := hSpan.isRespectful + have hT : IsTangle H.toHypergraph θ T := hResp_H.2.1 + have hθ : 3 ≤ θ := le_trans hφ hφ_le + have hΛ_open : IsOpen Λ := GM11.region_isOpen hΛ + have hΛ_disc : IsOpenDisc Λ := hResp_H.1.2 Λ hΛ + obtain ⟨hout, hCD, hdiscBd, _, _⟩ := + isClosedDisc_closure_of_region_tangle hS hResp_H hθ hΛ hOArc + obtain ⟨_, hSubBd_U, _⟩ := interSet_subBd_isCircuit_and_U_eq hS hΛ hOArc + have hSubBd_sub_U : subBd Λ ⊆ H.U := by + have hcl : IsClosed (subBd Λ) := isClosed_closure.inter isClosed_closure + rw [← hSubBd_U, (H.interSet (subBd Λ)).U_eq, + interSet_V_of_isClosed H hcl, interSet_E] + exact union_subset (inter_subset_left.trans H.V_subset_U) + (iUnion₂_subset fun e he => H.closure_subset_U he.1) + let K : Set S := univ \ Λ + have hK_cl : IsClosed K := isClosed_univ.sdiff hΛ_open + have hK_comp : IsCompact K := hK_cl.isCompact + have : CompactSpace ↥K := isCompact_iff_compactSpace.mp hK_comp + obtain ⟨m_mob⟩ := nonempty_mob_homeo + have hMob_surf : IsSurface MobiusBand := isSurface_of_homeo m_mob (isSurface_model 0 1 1).1 + have : CompactSpace MobiusBand := hMob_surf.1 + have hHU : H.U ⊆ K := fun y hy => ⟨mem_univ y, fun h => GM11.region_subset hΛ h hy⟩ + obtain ⟨g, hg_wa_model, hg_wb_model⟩ := realize_marked_crosscap_boundary (Λ := Λ) hφ a b hOrder_ab + let t_model := crosscapModelAngle φ + let w_a : Fin φ → Circle := fun i => Circle.exp (t_model i.1) + let w_b : Fin φ → Circle := fun i => Circle.exp (t_model (φ + i.1)) + have hg_wa : ∀ i, (g (w_a i)).1 = a i := hg_wa_model + have hg_wb : ∀ i, (g (w_b i)).1 = b i := hg_wb_model + have hwb_eq_neg : ∀ i : Fin φ, w_b i = - w_a i := by + intro i + change Circle.exp (crosscapModelAngle φ (φ + i.1)) = + - Circle.exp (crosscapModelAngle φ i.1) + rw [crosscapModelAngle_add_phi i.2, circle_exp_add_pi] + have hNodup_ab_iff := List.nodup_append'.mp hNodup_ab + have ha_inj : Function.Injective a := List.nodup_ofFn.mp hNodup_ab_iff.1 + have hb_inj_fn : Function.Injective b := List.nodup_ofFn.mp hNodup_ab_iff.2.1 + have hab_ne : ∀ i j : Fin φ, a i ≠ b j := + fun i j h => + hNodup_ab_iff.2.2 (List.mem_ofFn.mpr ⟨i, rfl⟩) (h ▸ List.mem_ofFn.mpr ⟨j, rfl⟩) + let u_pt : Fin φ → unitInterval := fun i => mobBdTopU (w_a i) + have hwa_im_pos : ∀ i : Fin φ, 0 < (w_a i : ℂ).im := fun i => by + obtain ⟨h0, hpi⟩ := crosscapModelAngle_mem_Ioo_pi i.2 + exact circle_exp_im_pos_of_mem_Ioo h0 hpi + have hwb_im_nonpos : ∀ i : Fin φ, (w_b i : ℂ).im ≤ 0 := fun i => by + rw [hwb_eq_neg i] + change - (w_a i : ℂ).im ≤ 0 + linarith [hwa_im_pos i] + have hu_int : ∀ i : Fin φ, 0 < (u_pt i : ℝ) ∧ (u_pt i : ℝ) < 1 := by + intro i + obtain ⟨h0, hpi⟩ := crosscapModelAngle_mem_Ioo_pi i.2 + obtain ⟨hre1, hre2⟩ := circle_exp_re_mem_Ioo_of_mem_Ioo h0 hpi + change 0 < (mobBdTopU (w_a i) : ℝ) ∧ (mobBdTopU (w_a i) : ℝ) < 1 + rw [mobBdTopU_coe] + exact ⟨by linarith, by linarith⟩ + have htop_upt : ∀ i : Fin φ, circleTop (u_pt i) = w_a i := + fun i => circleTop_mobBdTopU (le_of_lt (hwa_im_pos i)) + have hbotU_wb : ∀ i : Fin φ, mobBdBotU (w_b i) = u_pt i := by + intro i + rw [hwb_eq_neg i, mobBdBotU_neg] + have hbot_upt : ∀ i : Fin φ, circleBot (u_pt i) = w_b i := by + intro i + rw [← hbotU_wb i] + exact circleBot_mobBdBotU (hwb_im_nonpos i) + have hmobBd_wa : ∀ i : Fin φ, + mobBd (w_a i) = Quotient.mk Surface.mobiusSetoid (u_pt i, 0) := + fun i => mobBd_of_im_nonneg (le_of_lt (hwa_im_pos i)) + have hmobBd_wb : ∀ i : Fin φ, + mobBd (w_b i) = Quotient.mk Surface.mobiusSetoid (u_pt i, 1) := by + intro i + rw [mobBd_of_im_nonpos (hwb_im_nonpos i), hbotU_wb i] + have hu_inj : Function.Injective u_pt := by + intro i j hij + have hwa : w_a i = w_a j := by rw [← htop_upt i, ← htop_upt j, hij] + exact ha_inj (by rw [← hg_wa i, ← hg_wa j, hwa]) + -- Construct the glued surface `S'`. + let b_glue := crosscapGlueMap hΛ_open g + have hb_inj := injective_crosscapGlueMap hΛ_open g + have hb_cont := continuous_crosscapGlueMap hΛ_open g + have hb_range := range_crosscapGlueMap hS hΛ_open hOArc hout g + let S' := GluedSpace hb_inj + have : T2Space S' := GluedSpace.t2Space (isClosed_bd MobiusBand) hb_cont hb_inj + obtain ⟨hS', hConn', hCrosscap, _, _, hU_S12_eq, _, _⟩ := + isClosedSurface_of_crosscap_glue hS hΛ_disc hOArc hout hb_cont hb_inj hb_range + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let S₂ : Set S' := range (GluedSpace.inr hb_inj) + have hinl_emb : IsClosedEmbedding (GluedSpace.inl hb_inj) := + (GluedSpace.continuous_inl hb_inj).isClosedEmbedding (GluedSpace.inl_injective hb_inj) + have hinr_emb : IsClosedEmbedding (GluedSpace.inr hb_inj) := + (GluedSpace.continuous_inr hb_inj).isClosedEmbedding (GluedSpace.inr_injective hb_inj) + have hS₁_cl : IsClosed S₁ := hinl_emb.isClosed_range + have hS₂_cl : IsClosed S₂ := hinr_emb.isClosed_range + -- Unpinched split on `S'`. + obtain ⟨C_unp, ι_unp, hSplit_unp, hC_unp_0, _, hι_unp_inl⟩ := + isCappedSplit_crosscap_unpinched hS hΛ_open hΛ_disc hOArc hout g hb_inj + have hS12_inter : S₁ ∩ S₂ = C_unp 0 := by + rw [hSplit_unp.inter] + ext x + simp + have ha0_K : a ⟨0, by omega⟩ ∈ K := hHU (H.V_subset_U (hab_mem ⟨0, by omega⟩).1.1) + obtain ⟨g_unp, f_unp, hg_unp_mem, hf_unp_inl, hg_unp_cont, hfg_unp_inv, hg_unp_K, hf_unp_cont'⟩ := + crosscap_base_inclusion_and_retraction hΛ_open g hb_inj _ ha0_K ι_unp + hSplit_unp.isEmbedding.continuous hι_unp_inl + let H₁ : Drawing S' := liftDrawingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU + let η₁ : SpanEmbedding H₁ G := + liftSpanEmbeddingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv hHU η + have hH₁_U : H₁.U = g_unp '' H.U := + liftDrawingOn_U hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU + have hH₁_V : H₁.V = g_unp '' H.V := + liftDrawingOn_V hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU + have hH₁_sub_S₁ : H₁.U ⊆ S₁ := by + rw [hH₁_U] + exact (image_mono hHU).trans (le_of_eq hg_unp_K) + -- Vertical lines `L i` and endpoints `a' i, b' i`. + let a' : Fin φ → S' := fun i => g_unp (a i) + let b' : Fin φ → S' := fun i => g_unp (b i) + let L : Fin φ → Set S' := + fun i => GluedSpace.inr hb_inj '' (Quotient.mk Surface.mobiusSetoid '' ({u_pt i} ×ˢ univ)) + have ha_K : ∀ i, a i ∈ K := fun i => hHU (H.V_subset_U (hab_mem i).1.1) + have hb_K : ∀ i, b i ∈ K := fun i => hHU (H.V_subset_U (hab_mem i).2.1) + have ha'_V : ∀ i, a' i ∈ H₁.V := fun i => by rw [hH₁_V]; exact ⟨a i, (hab_mem i).1.1, rfl⟩ + have hb'_V : ∀ i, b' i ∈ H₁.V := fun i => by rw [hH₁_V]; exact ⟨b i, (hab_mem i).2.1, rfl⟩ + have hinr_mobBd : ∀ z : Circle, + GluedSpace.inr hb_inj (mobBd z) = g_unp (g z).1 := by + intro z + have hbd : mobBd z ∈ bd MobiusBand := by rw [bd_mobiusBand]; exact ⟨z, rfl⟩ + have hzK : (g z).1 ∈ K := hHU (hSubBd_sub_U (g z).2) + have hb_z : b_glue ⟨mobBd z, hbd⟩ = ⟨(g z).1, hzK⟩ := + Subtype.ext (crosscapGlueMap_mobBd hΛ_open g z) + rw [hg_unp_mem (g z).1 hzK, ← hb_z] + exact ((GluedSpace.inl_eq_inr hb_inj).mpr ⟨hbd, rfl⟩).symm + have ha'_mobBd : ∀ i, a' i = GluedSpace.inr hb_inj (mobBd (w_a i)) := by + intro i + dsimp [a'] + rw [← hg_wa i, hinr_mobBd] + have hb'_mobBd : ∀ i, b' i = GluedSpace.inr hb_inj (mobBd (w_b i)) := by + intro i + dsimp [b'] + rw [← hg_wb i, hinr_mobBd] + have ha'_inr : ∀ i, + a' i = GluedSpace.inr hb_inj (Quotient.mk Surface.mobiusSetoid (u_pt i, 0)) := by + intro i; rw [ha'_mobBd i, hmobBd_wa i] + have hb'_inr : ∀ i, + b' i = GluedSpace.inr hb_inj (Quotient.mk Surface.mobiusSetoid (u_pt i, 1)) := by + intro i; rw [hb'_mobBd i, hmobBd_wb i] + have hL_line : ∀ i, IsLineWithEnds (L i) (a' i) (b' i) := by + intro i + rw [ha'_inr i, hb'_inr i] + obtain ⟨f, h0, h1⟩ := isLineWithEnds_mobVertical (u_pt i) (hu_int i).1 (hu_int i).2 + exact ⟨f.trans + (hinr_emb.isEmbedding.homeomorphImage + (Quotient.mk Surface.mobiusSetoid '' ({u_pt i} ×ˢ univ))), + congrArg (GluedSpace.inr hb_inj) h0, congrArg (GluedSpace.inr hb_inj) h1⟩ + have hL_disj : Pairwise (fun i j => Disjoint (L i) (L j)) := by + intro i j hij + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨p, hp, rfl⟩ ⟨q, hq, heq⟩ + have hpq := GluedSpace.inr_injective hb_inj heq + subst hpq + exact Set.disjoint_left.mp + (disjoint_mobVertical_of_ne (hu_int i).1 (hu_int i).2 (fun h => hij (hu_inj h))) + hp hq + have hL_S₁ : ∀ i, L i ∩ S₁ = {a' i, b' i} := by + exact crosscap_lines_meet_base_at_ends (S := S) φ Λ hΛ_open g u_pt hb_inj H₁ hH₁_sub_S₁ + a' b' ha'_V hb'_V ha'_inr hb'_inr + have hL_H₁U : ∀ i, L i ∩ H₁.U = {a' i, b' i} := by + exact crosscap_lines_meet_lifted_drawing_at_ends (S := S) φ Λ hΛ_open g hb_inj H₁ + hH₁_sub_S₁ a' b' L ha'_V hb'_V hL_S₁ + have hP_paths' : ∀ i : Fin φ, + IsHPathWithEnds G η₁.imageGraph (P i) (η₁.vMap (a' i)) (η₁.vMap (b' i)) := by + intro i + change IsHPathWithEnds G η.imageGraph (P i) (η.vMap (f_unp (g_unp (a i)))) + (η.vMap (f_unp (g_unp (b i)))) + rw [hfg_unp_inv (ha_K i), hfg_unp_inv (hb_K i)] + exact hP_paths i + have crosscapFinish : ∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S'), + IsObtainedByAddingCrosscap S S' ∧ + ∃ (H' : Drawing S') (η' : SpanEmbedding H' G) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsSigmaSpan G H' η' θ_star φ T_star T' := by + exact assemble_rigid_span_on_added_crosscap (S := S) (α := α) (β := β) G H η θ_star θ φ T_star + T Λ P a b hSpan hOArc hφ hφ_le hP_disj hFree_ab hS hRigid_H hResp_H hT hθ hΛ_open hΛ_disc + hout hCD hdiscBd hSubBd_sub_U hK_comp hHU g hwb_eq_neg ha_inj hb_inj_fn hab_ne u_pt hu_int + htop_upt hbot_upt hu_inj hb_inj hS' hCrosscap hinr_emb hS₁_cl hS₂_cl C_unp ι_unp hSplit_unp + hC_unp_0 hι_unp_inl hS12_inter g_unp f_unp hg_unp_mem hg_unp_cont hfg_unp_inv hf_unp_cont' + hH₁_U hH₁_V hH₁_sub_S₁ ha_K hb_K ha'_V hb'_V hinr_mobBd ha'_mobBd hb'_mobBd ha'_inr hb'_inr + hL_line hL_disj hL_S₁ hL_H₁U hP_paths' + exact crosscapFinish + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/Section3Disc.lean b/LeanPool/GraphMinor/GM15/Section3Disc.lean new file mode 100644 index 0000000000..b727e7c7d6 --- /dev/null +++ b/LeanPool/GraphMinor/GM15/Section3Disc.lean @@ -0,0 +1,2380 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Section3SpanGlue +public import LeanPool.GraphMinor.GM15.Section4 +public import LeanPool.GraphMinor.Surface.HandleModel +public import LeanPool.GraphMinor.Surface.AddHandle +public import LeanPool.GraphMinor.Surface.AddCrosscap +public import LeanPool.GraphMinor.Surface.DiscRemove +public import LeanPool.GraphMinor.Surface.CircleMove +public import LeanPool.GraphMinor.GM11.Theorem65 +import LeanPool.GraphMinor.GM14.DiscBoundaryHomeomorphism + +/-! +# Closed Discs from Regions in Graph Minors XV, Section 3 + +This file proves that for a 2-cell drawing `H` in a closed connected surface `S` with a respectful +tangle `T` of order `θ ≥ 3`, the closure `closure Λ` of any region `Λ ∈ H.R` whose boundary +`subBd Λ` is an `O`-arc is a closed disc with boundary `subBd Λ`, and the complement of one or two +such regions with disjoint closures is a connected surface whose boundary consists of the +corresponding `O`-arcs. +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 + +universe w + +variable {S : Type w} [TopologicalSpace S] + +/-- Removing one point from `Circle` leaves a preconnected set. -/ +theorem isPreconnected_circle_compl_singleton (w₀ : Circle) : + IsPreconnected ((univ : Set Circle) \ {w₀}) := by + obtain ⟨t₀, rfl⟩ := ee_surjective w₀ + have hEq : (univ : Set Circle) \ {ee t₀} = ee '' Ioo t₀ (t₀ + 1) := by + ext w + constructor + · rintro ⟨-, hw⟩ + obtain ⟨t, rfl⟩ := ee_surjective w + let u := t₀ + Int.fract (t - t₀) + have hu_def : u = t₀ + Int.fract (t - t₀) := rfl + have hu_eq : ee u = ee t := by + apply ee_eq_iff.mpr + refine ⟨-⌊t - t₀⌋, ?_⟩ + rw [hu_def, Int.fract] + push_cast + ring + have h0 : 0 < Int.fract (t - t₀) := by + refine lt_of_le_of_ne (Int.fract_nonneg (t - t₀)) fun h => hw ?_ + apply mem_singleton_iff.mpr + rw [← hu_eq, hu_def, ← h, add_zero] + have h1 : Int.fract (t - t₀) < 1 := Int.fract_lt_one (t - t₀) + exact ⟨u, ⟨by linarith, by linarith⟩, hu_eq⟩ + · rintro ⟨t, ⟨ht1, ht2⟩, rfl⟩ + refine ⟨mem_univ _, fun h => ?_⟩ + obtain ⟨m, hm⟩ := ee_eq_iff.mp (mem_singleton_iff.mp h) + have hlt1 : (0 : ℝ) < m := by linarith + have hlt2 : (m : ℝ) < 1 := by linarith + have hm1 : (0 : ℤ) < m := by exact_mod_cast hlt1 + have hm2 : m < (1 : ℤ) := by exact_mod_cast hlt2 + omega + rw [hEq] + exact isPreconnected_Ioo.image ee continuous_ee.continuousOn + +/-- Removing a finite set of at most one point from an `O`-arc leaves a preconnected set. -/ +theorem IsOArc.isPreconnected_sdiff_of_ncard_le_one {F A : Set S} (hF : IsOArc F) + (hfin : (A ∩ F).Finite) (hcard : (A ∩ F).ncard ≤ 1) : IsPreconnected (F \ A) := by + have hEq : F \ A = F \ (A ∩ F) := by + ext x + exact ⟨fun ⟨hxF, hxA⟩ => ⟨hxF, fun h => hxA h.1⟩, + fun ⟨hxF, h⟩ => ⟨hxF, fun hxA => h ⟨hxA, hxF⟩⟩⟩ + rw [hEq] + rcases Nat.le_one_iff_eq_zero_or_eq_one.mp hcard with h0 | h1 + · have hemp : A ∩ F = ∅ := (ncard_eq_zero hfin).mp h0 + rw [hemp, sdiff_empty] + exact hF.isPreconnected + · obtain ⟨x₀, hx₀⟩ := ncard_eq_one.mp h1 + have hx₀F : x₀ ∈ F := by + have : x₀ ∈ A ∩ F := hx₀ ▸ mem_singleton x₀ + exact this.2 + rw [hx₀] + obtain ⟨φ⟩ := id hF + let w₀ : Circle := φ.symm ⟨x₀, hx₀F⟩ + have himg : F \ {x₀} = (fun w : Circle => (φ w).1) '' ((univ : Set Circle) \ {w₀}) := by + ext x + constructor + · rintro ⟨hxF, hne⟩ + refine ⟨φ.symm ⟨x, hxF⟩, ⟨mem_univ _, fun h => hne ?_⟩, ?_⟩ + · have h' := congrArg (fun z : Circle => (φ z).1) (mem_singleton_iff.mp h) + simp only [w₀, Homeomorph.apply_symm_apply] at h' + exact mem_singleton_iff.mpr h' + · change (φ (φ.symm ⟨x, hxF⟩)).1 = x + rw [Homeomorph.apply_symm_apply] + · rintro ⟨w, ⟨-, hw⟩, rfl⟩ + refine ⟨(φ w).2, fun h => hw ?_⟩ + have hw_eq : (φ w).1 = x₀ := mem_singleton_iff.mp h + apply mem_singleton_iff.mpr + apply φ.injective + change φ w = φ (φ.symm ⟨x₀, hx₀F⟩) + rw [Homeomorph.apply_symm_apply] + exact Subtype.ext hw_eq + rw [himg] + exact (isPreconnected_circle_compl_singleton w₀).image _ + (continuous_subtype_val.comp φ.continuous).continuousOn + +/-- If `Λ` is an open disc in a connected surface `S` with `Disjoint (closure Λ) (bd S)`, +`IsOArc (closure Λ \ Λ)`, and `(closure Λ)ᶜ.Nonempty`, then every point of `closure Λ \ Λ` lies in +`closure (closure Λ)ᶜ`, and `closure Λ` is a closed disc with boundary `closure Λ \ Λ`. -/ +theorem closure_disc_of_compl_nonempty [ConnectedSpace S] (hS : IsSurface S) + {Λ : Set S} (hΛ : IsOpenDisc Λ) (hbd : Disjoint (closure Λ) (bd S)) + (hF : IsOArc (closure Λ \ Λ)) (hcompl : (closure Λ)ᶜ.Nonempty) : + (∀ x ∈ closure Λ \ Λ, x ∈ closure (closure Λ)ᶜ) ∧ + IsClosedDisc (closure Λ) ∧ discBd (closure Λ) = closure Λ \ Λ := by + classical + have ht2 : T2Space S := hS.2.1 + have hΛo : IsOpen Λ := hΛ.1 + obtain ⟨φ₀⟩ := id hF + have hneΛ : (closure Λ).Nonempty := ⟨(φ₀ 1).1, (φ₀ 1).2.1⟩ + have hfr_ne : (frontier (closure Λ)).Nonempty := by + by_contra hfr_emp + have hclop : IsClopen (closure Λ) := + isClopen_iff_frontier_eq_empty.mpr (not_nonempty_iff_eq_empty.mp hfr_emp) + have huniv : closure Λ = univ := hclop.eq_univ hneΛ + obtain ⟨z, hz⟩ := hcompl + exact hz (huniv ▸ mem_univ z) + obtain ⟨x₀, hx₀_cl, hx₀_nint⟩ := hfr_ne + rw [closure_closure] at hx₀_cl + have hx₀_out : x₀ ∈ closure (closure Λ)ᶜ := by + rw [closure_compl] + exact hx₀_nint + have hx₀_nΛ : x₀ ∉ Λ := fun hxΛ => hx₀_nint (interior_maximal subset_closure hΛo hxΛ) + have hx₀_C : x₀ ∈ closure Λ \ Λ := ⟨hx₀_cl, hx₀_nΛ⟩ + set C : Set S := closure Λ \ Λ with hC_def + have hbC : Disjoint C (bd S) := hbd.mono_left sdiff_subset + obtain ⟨Y, tY, t2Y, ψ, hY, hψ, hsplit, -⟩ := exists_cut_loop hS hF hbC + have hcY : CompactSpace Y := hY.1 + have hcl : IsClosedMap ψ := hψ.1.isClosedMap + have hsurj := hψ.2.1 + have hc := hψ.1 + have hbdC : ψ ⁻¹' C ⊆ bd Y := hψ.2.2.2.2 + set O₁ : Set Y := ψ ⁻¹' Λ with hO₁ + set O₂ : Set Y := ψ ⁻¹' (closure Λ)ᶜ with hO₂ + have hO₁o : IsOpen O₁ := hΛo.preimage hc + have hO₂o : IsOpen O₂ := isClosed_closure.isOpen_compl.preimage hc + have hcover : ∀ y : Y, y ∈ O₁ ∨ y ∈ O₂ ∨ y ∈ ψ ⁻¹' C := fun y => by + by_cases h1 : ψ y ∈ Λ + · exact Or.inl h1 + · by_cases h2 : ψ y ∈ closure Λ + · exact Or.inr (Or.inr ⟨h2, h1⟩) + · exact Or.inr (Or.inl h2) + have hdis12 : Disjoint O₁ O₂ := + disjoint_left.mpr fun y hy1 hy2 => hy2 (subset_closure hy1) + have key : ∀ y ∈ ψ ⁻¹' C, y ∉ closure O₁ ∨ y ∉ closure O₂ := by + intro y hy + obtain ⟨V, P, hV, hyV, -, hPV, hPc, hPi, hVc⟩ := + (hY.2.2 y).exists_half isOpen_univ (mem_univ y) + have hsub : P ⊆ O₁ ∪ O₂ := fun z hz => by + rcases hcover z with h | h | h + · exact Or.inl h + · exact Or.inr h + · exact absurd (hPi z hz) (hbdC h) + rcases hPc.subset_or_subset hO₁o hO₂o hdis12 hsub with h | h + · right + intro hcl2 + obtain ⟨z, ⟨hz1, hz2⟩⟩ := + mem_closure_iff_nhds.mp hcl2 _ (hV.mem_nhds hyV) |>.imp fun _ h => h + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp (hVc hz1) _ hO₂o hz2 + exact disjoint_left.mp hdis12 (h hw2) hw1 + · left + intro hcl1 + obtain ⟨z, ⟨hz1, hz2⟩⟩ := + mem_closure_iff_nhds.mp hcl1 _ (hV.mem_nhds hyV) |>.imp fun _ h => h + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp (hVc hz1) _ hO₁o hz2 + exact disjoint_left.mp hdis12 hw1 (h hw2) + set N₁ : Set Y := (closure O₂)ᶜ with hN₁ + set N₂ : Set Y := (closure O₁)ᶜ with hN₂ + have hN₁o : IsOpen N₁ := isClosed_closure.isOpen_compl + have hN₂o : IsOpen N₂ := isClosed_closure.isOpen_compl + have hN₁s : ∀ y ∈ N₁, y ∈ O₁ ∨ y ∈ ψ ⁻¹' C := fun y hy => by + rcases hcover y with h | h | h + · exact Or.inl h + · exact absurd (subset_closure h) hy + · exact Or.inr h + have hNd : Disjoint N₁ N₂ := by + refine disjoint_left.mpr fun y h3 h4 => ?_ + have hN : IsOpen (N₁ ∩ N₂) := hN₁o.inter hN₂o + obtain ⟨z, hz, hz'⟩ := mem_closure_iff.mp (mem_closure_compl_bd (hY.2.2 y)) _ hN ⟨h3, h4⟩ + rcases hN₁s z hz.1 with h | h + · exact hz.2 (subset_closure h) + · exact hz' (hbdC h) + have hkey2 : ψ ⁻¹' C ⊆ N₁ ∪ N₂ := fun y hy => by + rcases key y hy with h | h + · exact Or.inr h + · exact Or.inl h + have hN₂_cl : N₂ ⊆ closure O₂ := fun y hy => by + have hbd_compl : (bd Y)ᶜ ⊆ O₁ ∪ O₂ := fun z hz => by + rcases hcover z with h | h | h + · exact Or.inl h + · exact Or.inr h + · exact absurd (hbdC h) hz + have hcl_u : y ∈ closure O₁ ∪ closure O₂ := by + rw [← closure_union] + exact closure_mono hbd_compl (mem_closure_compl_bd (hY.2.2 y)) + exact hcl_u.resolve_left hy + have hy₀_ex : ∃ y₀ ∈ ψ ⁻¹' C, y₀ ∈ N₂ := by + have h3 : (closure Λ)ᶜ ⊆ ψ '' closure O₂ := fun z hz => by + obtain ⟨y, rfl⟩ := hsurj z + exact ⟨y, subset_closure hz, rfl⟩ + have h4 : x₀ ∈ ψ '' closure O₂ := (hcl _ isClosed_closure).closure_subset_iff.mpr h3 hx₀_out + obtain ⟨y₀, hy₀_cl, rfl⟩ := h4 + rcases hkey2 hx₀_C with h | h + · exact absurd hy₀_cl h + · exact ⟨y₀, hx₀_C, h⟩ + obtain ⟨y₀, hy₀C, hy₀N₂⟩ := hy₀_ex + have hout : ∀ x ∈ C, x ∈ closure (closure Λ)ᶜ := by + have himg_cl : ψ '' closure O₂ ⊆ closure (closure Λ)ᶜ := by + rintro _ ⟨y, hy, rfl⟩ + have hsub : ψ '' O₂ ⊆ (closure Λ)ᶜ := by + rintro _ ⟨z, hz, rfl⟩ + exact hz + exact closure_mono hsub (image_closure_subset_closure_image hc ⟨y, hy, rfl⟩) + intro x hx + rcases hsplit with ⟨X, X', -, hXX', hXO, hX'O, hbijX, hbijX'⟩ | hO_pre + · have hy₀XX' : y₀ ∈ X ∪ X' := hXX'.symm ▸ hy₀C + rcases hy₀XX' with hy₀X | hy₀X' + · have hX_sub : X ⊆ N₂ := + hXO.isPreconnected.subset_right_of_subset_union hN₁o hN₂o hNd + (subset_union_left.trans (hXX' ▸ hkey2)) ⟨y₀, hy₀X, hy₀N₂⟩ + obtain ⟨y, hyX, rfl⟩ := hbijX.surjOn hx + exact himg_cl ⟨y, hN₂_cl (hX_sub hyX), rfl⟩ + · have hX'_sub : X' ⊆ N₂ := + hX'O.isPreconnected.subset_right_of_subset_union hN₁o hN₂o hNd + (subset_union_right.trans (hXX' ▸ hkey2)) ⟨y₀, hy₀X', hy₀N₂⟩ + obtain ⟨y, hyX', rfl⟩ := hbijX'.surjOn hx + exact himg_cl ⟨y, hN₂_cl (hX'_sub hyX'), rfl⟩ + · have hpre_sub : ψ ⁻¹' C ⊆ N₂ := + hO_pre.isPreconnected.subset_right_of_subset_union hN₁o hN₂o hNd hkey2 ⟨y₀, hy₀C, hy₀N₂⟩ + obtain ⟨y, rfl⟩ := hsurj x + exact himg_cl ⟨y, hN₂_cl (hpre_sub hx), rfl⟩ + exact ⟨hout, closure_disc hS hΛ hbd hF hout⟩ + +/-- In a 2-cell drawing `H` in a closed connected surface `S` with a respectful tangle `T` of +order `θ ≥ 3`, every region `Λ ∈ H.R` whose boundary `subBd Λ` is an `O`-arc has +`(closure Λ)ᶜ.Nonempty`. -/ +theorem compl_closure_nonempty_of_region_tangle [ConnectedSpace S] (hS : IsClosedSurface S) + {H : Drawing S} {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsRespectfulDrawingTangle H θ T) (hθ : 3 ≤ θ) + {Λ : Set S} (hΛ : Λ ∈ H.R) (hOArc : IsOArc (subBd Λ)) : + (closure Λ)ᶜ.Nonempty := by + classical + have : T2Space S := hS.2.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + by_contra hcompl + have hcl_univ : closure Λ = univ := compl_empty_iff.mp (not_nonempty_iff_eq_empty.mp hcompl) + have hΛo : IsOpen Λ := GM11.region_isOpen hΛ + have hsubBd_eq : subBd Λ = closure Λ \ Λ := by + rw [subBd_eq_frontier, hΛo.frontier_eq] + have hHU_eq : H.U = subBd Λ := by + apply subset_antisymm + · intro x hx + rw [hsubBd_eq, hcl_univ] + exact ⟨mem_univ x, fun hxΛ => GM11.region_subset hΛ hxΛ hx⟩ + · intro x hx + rw [hsubBd_eq] at hx + by_contra hxU + obtain ⟨r, hr, hxr⟩ := GM11.exists_region_of_notMem hxU + obtain ⟨y, hyr, hyΛ⟩ := mem_closure_iff.mp hx.1 r (GM11.region_isOpen hr) hxr + have hrΛ := GM11.region_eq_of_mem hr hΛ hyr hyΛ + exact hx.2 (hrΛ ▸ hxr) + have hall_R : ∀ r ∈ H.R, r = Λ := fun r hr => by + obtain ⟨x, hxr⟩ := GM11.region_nonempty hr + have hxcl : x ∈ closure Λ := hcl_univ ▸ mem_univ x + obtain ⟨y, hyr, hyΛ⟩ := mem_closure_iff.mp hxcl r (GM11.region_isOpen hr) hxr + exact GM11.region_eq_of_mem hr hΛ hyr hyΛ + obtain ⟨K, hK⟩ := GM11.exists_radialDrawing hS hT.1 + have hpre : GM11.PreRad (PaintingOrDrawing.drawing H) K := ⟨hK.1, hK.2.1⟩ + have hmax : GM11.RadMax (PaintingOrDrawing.drawing H) K := hK.2.2 + obtain ⟨ins, hins⟩ := exists_derivedSlope hT hK.2.1 + have hE : H.E.Nonempty := edges_nonempty_of_tangle hS hT (by omega) + have hpretangle : GM11.IsPretangle H.toHypergraph θ T := + ⟨hT.2.1.one_le, hT.2.1.isSeparation, hT.2.1.order_lt, hT.2.1.axiom1, hT.2.1.axiom2⟩ + have heven : IsEvenSlope K (2 * θ) ins := + (GM11.theorem_6_5_proof hS hE hpretangle hT.2.2 hK hins).1 hT.2.1 + obtain ⟨c₀, ⟨hc₀Λ, hc₀V⟩, -⟩ := hK.2.1.2.2.1 Λ hΛ + have hKV_diff : K.V \ H.V ⊆ {c₀} := by + rintro w ⟨hwV, hwn⟩ + obtain ⟨r, hr, hwr⟩ := hK.2.1.2.2.2.1 w ⟨hwV, hwn⟩ + rw [hall_R r hr] at hwr + exact mem_singleton_iff.mpr (GM11.hub_unique hpre hΛ hc₀Λ hc₀V hwr hwV) + obtain ⟨e₀, he₀⟩ := id hE + obtain ⟨p₀, hp₀⟩ := he₀.1 + have hp₀K : p₀ ∉ K.U := + disjoint_left.mp (GM11.edge_disjoint hpre he₀) hp₀ + obtain ⟨s, hs, hp₀s⟩ := exists_region_of_notMem hp₀K + have he₀s : e₀ ⊆ s := + subset_region hs he₀.2.2.1.isConnected.isPreconnected (GM11.edge_disjoint hpre he₀) hp₀ hp₀s + have hperim : GM11.perimeterLength K s < 2 * θ := + (GM11.perimeterLength_le_four hpre hS hmax hE hs).trans_lt (by omega) + obtain ⟨C_s, hCs_circ, hCs_sub, hCs_len, hs_sub⟩ := heven s hs hperim + obtain ⟨hΔ_disc, hΔ_bd, hΔ_mem⟩ := hins C_s hCs_circ hCs_sub hCs_len + have hbip := GM11.bipartite_of_preRadial hK.2.1 + have hbC : ∀ e x y, C_s.toGraph.IsLink e x y → (x ∈ K.V \ H.V ↔ y ∉ K.V \ H.V) := by + intro e x y hl + have hlinkK : K.toGraph.IsLink e x y := by + refine ⟨hCs_sub.2 hl.1, hCs_sub.1 hl.2.1, hCs_sub.1 hl.2.2.1, ?_⟩ + rw [← hCs_sub.closure_inter_V hl.1] + exact hl.2.2.2 + have hxy := hbip e x y hlinkK + have hxK : x ∈ K.V := hCs_sub.1 hl.2.1 + have hyK : y ∈ K.V := hCs_sub.1 hl.2.2.1 + simp only [mem_sdiff, hxK, hyK, true_and] + tauto + obtain ⟨u₀, W, ⟨hnd, hed⟩, hpos, hCV, hCE⟩ := id hCs_circ + have hlenW : C_s.length = W.length := by + rw [Drawing.length, hCE] + have h : {e | e ∈ W.edges} = (W.edges.toFinset : Set (Set S)) := by ext; simp + rw [h, ncard_coe_finset, List.toFinset_card_of_nodup hed] + rfl + have hcW := GM11.two_mul_count_le (K.V \ H.V) hbC W + have htail_sub : ((W.support.tail.filter (· ∈ K.V \ H.V)).toFinset : Set S) ⊆ {c₀} := by + intro x hx + have hx' : x ∈ W.support.tail ∧ x ∈ K.V \ H.V := by simpa using hx + exact hKV_diff hx'.2 + have hcount_le : W.support.tail.countP (· ∈ K.V \ H.V) ≤ 1 := by + have hf : (W.support.tail.filter (· ∈ K.V \ H.V)).Nodup := hnd.filter _ + have hle := ncard_le_ncard htail_sub (finite_singleton c₀) + rw [ncard_coe_finset, List.toFinset_card_of_nodup hf, ← List.countP_eq_length_filter, + ncard_singleton] at hle + exact hle + obtain ⟨_, _, hcard2⟩ := circuit_props_of_preRadial hK.2.1 hCs_circ hCs_sub + have hcard_HV : (C_s.U ∩ H.V).ncard ≤ 1 := by omega + have hinter_eq : C_s.U ∩ subBd Λ = C_s.U ∩ H.V := by + rw [← hHU_eq] + ext x + constructor + · rintro ⟨hxC, hxH⟩ + have : x ∈ (PaintingOrDrawing.drawing H).U ∩ K.U := ⟨hxH, hCs_sub.U_subset hxC⟩ + rw [hK.2.1.1] at this + exact ⟨hxC, this⟩ + · rintro ⟨hxC, hxV⟩ + exact ⟨hxC, H.V_subset_U hxV⟩ + have hcard_bd : (C_s.U ∩ subBd Λ).ncard ≤ 1 := by + rw [hinter_eq] + exact hcard_HV + have hfin_bd : (C_s.U ∩ subBd Λ).Finite := by + rw [hinter_eq] + exact H.finite_V.subset inter_subset_right + have hconn_sdiff : IsPreconnected (subBd Λ \ C_s.U) := + IsOArc.isPreconnected_sdiff_of_ncard_le_one hOArc hfin_bd hcard_bd + have hfr_ins : frontier (ins C_s) = C_s.U := by + rw [← subBd_eq_frontier, hΔ_bd] + have hdis_fr : Disjoint (subBd Λ \ C_s.U) (frontier (ins C_s)) := by + rw [hfr_ins] + exact disjoint_sdiff_left + have hp₀_sdiff : p₀ ∈ subBd Λ \ C_s.U := + ⟨hHU_eq ▸ (he₀.2.1 hp₀).1, fun h => hp₀K (hCs_sub.U_subset h)⟩ + have hp₀_ins : p₀ ∈ ins C_s := hs_sub (he₀s hp₀) + have hsub_ins : subBd Λ \ C_s.U ⊆ ins C_s := + (GM11.subset_or_disjoint_of_frontier hΔ_disc.isCompact.isClosed hconn_sdiff + hdis_fr).resolve_right + fun hd => disjoint_left.mp hd hp₀_sdiff hp₀_ins + have hHU_sub_ins : H.U ⊆ ins C_s := by + rw [hHU_eq] + intro x hx + by_cases hxC : x ∈ C_s.U + · rw [← hfr_ins] at hxC + exact hΔ_disc.isCompact.isClosed.frontier_subset hxC + · exact hsub_ins ⟨hx, hxC⟩ + refine hT.2.1.axiom2 hΔ_mem hΔ_mem hΔ_mem (Hypergraph.ext ?_ ?_ ?_) |>.elim + · ext v + exact ⟨by rintro ((h | h) | h) <;> exact h.1, + fun hv => Or.inl (Or.inl ⟨hv, hHU_sub_ins (H.V_subset_U hv)⟩)⟩ + · ext e + exact ⟨by rintro ((h | h) | h) <;> exact h.1, + fun he => Or.inl (Or.inl ⟨he, fun x hx => hHU_sub_ins ((he.2.1 hx).1)⟩)⟩ + · funext e v + apply propext + exact ⟨by rintro ((h | h) | h) <;> exact h.1, + fun hi => Or.inl (Or.inl ⟨hi, + fun x hx => hHU_sub_ins ((hi.1.2.1 hx).1), + hHU_sub_ins (H.V_subset_U hi.2.1)⟩)⟩ + +/-- In a 2-cell drawing `H` in a closed connected surface `S` with a respectful tangle `T` of +order `θ ≥ 3`, the closure `closure Λ` of any region `Λ ∈ H.R` whose boundary `subBd Λ` is an +`O`-arc is a closed disc with boundary `subBd Λ` and interior `Λ`. -/ +theorem isClosedDisc_closure_of_region_tangle [ConnectedSpace S] (hS : IsClosedSurface S) + {H : Drawing S} {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsRespectfulDrawingTangle H θ T) (hθ : 3 ≤ θ) + {Λ : Set S} (hΛ : Λ ∈ H.R) (hOArc : IsOArc (subBd Λ)) : + (∀ x ∈ closure Λ \ Λ, x ∈ closure (closure Λ)ᶜ) ∧ + IsClosedDisc (closure Λ) ∧ discBd (closure Λ) = subBd Λ ∧ + subBd (closure Λ) = subBd Λ ∧ discInt (closure Λ) = Λ := by + have : T2Space S := hS.2.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hS_surf : IsSurface S := IsClosedSurface.isSurface hS + have hbd_empty : bd S = ∅ := eq_empty_iff_forall_notMem.mpr fun x hx => hx (hS.2.2 x) + have hΛ_open : IsOpen Λ := GM11.region_isOpen hΛ + have hΛ_disc : IsOpenDisc Λ := hT.1.2 Λ hΛ + have hsubBd_eq : closure Λ \ Λ = subBd Λ := by + rw [subBd_eq_frontier, hΛ_open.frontier_eq] + have hbd_disj : Disjoint (closure Λ) (bd S) := by + rw [hbd_empty] + exact disjoint_empty _ + have hcompl := compl_closure_nonempty_of_region_tangle hS hT hθ hΛ hOArc + obtain ⟨hout, hCD, hdiscBd⟩ := + closure_disc_of_compl_nonempty hS_surf hΛ_disc hbd_disj (hsubBd_eq ▸ hOArc) hcompl + rw [hsubBd_eq] at hdiscBd + have hsubBd_cl : subBd (closure Λ) = subBd Λ := by + rw [subBd_eq_frontier, GM11.IsClosedDisc.frontier_eq_discBd hS hCD, hdiscBd] + have hdiscInt : discInt (closure Λ) = Λ := by + rw [discInt, hdiscBd, ← hsubBd_eq] + ext x + simp only [mem_sdiff, not_and, not_not] + exact ⟨fun ⟨hx, h⟩ => h hx, fun hx => ⟨subset_closure hx, fun _ => hx⟩⟩ + exact ⟨hout, hCD, hdiscBd, hsubBd_cl, hdiscInt⟩ + +private lemma isManifoldPoint_of_open_nhd {A B U : Set S} (hU : IsOpen U) + (hUA : A ∩ U = B ∩ U) {x : ↥A} (hxU : x.1 ∈ U) (hxB : x.1 ∈ B) + (hm : IsManifoldPoint (⟨x.1, hxB⟩ : ↥B)) : IsManifoldPoint x := by + have hUA' : IsOpen (Subtype.val ⁻¹' U : Set ↥A) := hU.preimage continuous_subtype_val + have hUB' : IsOpen (Subtype.val ⁻¹' U : Set ↥B) := hU.preimage continuous_subtype_val + let e : ↥(Subtype.val ⁻¹' U : Set ↥A) ≃ₜ ↥(Subtype.val ⁻¹' U : Set ↥B) := + { toFun := fun z => ⟨⟨z.1.1, ((Set.ext_iff.mp hUA z.1.1).mp ⟨z.1.2, z.2⟩).1⟩, z.2⟩ + invFun := fun z => ⟨⟨z.1.1, ((Set.ext_iff.mp hUA z.1.1).mpr ⟨z.1.2, z.2⟩).1⟩, z.2⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl + continuous_toFun := Continuous.subtype_mk + (Continuous.subtype_mk (continuous_subtype_val.comp continuous_subtype_val) _) _ + continuous_invFun := Continuous.subtype_mk + (Continuous.subtype_mk (continuous_subtype_val.comp continuous_subtype_val) _) _ } + have h1 : IsManifoldPoint (⟨⟨x.1, hxB⟩, hxU⟩ : ↥(Subtype.val ⁻¹' U : Set ↥B)) := + isManifoldPoint_sub hUB' hm + have h2 : IsManifoldPoint (⟨x, hxU⟩ : ↥(Subtype.val ⁻¹' U : Set ↥A)) := + (isManifoldPoint_iff_of_isOpenEmbedding e.isOpenEmbedding).mp h1 + exact isManifoldPoint_of_isOpenEmbedding hUA'.isOpenEmbedding_subtypeVal h2 + +/-- Removing an open set `Λ` with `IsOArc (subBd Λ)` and `∀ x ∈ closure Λ \ Λ, x ∈ closure (closure +Λ)ᶜ` +from a closed connected surface `S` gives a connected surface `↥(univ \ Λ)` with boundary +`Subtype.val ⁻¹' subBd Λ`, which is an `O`-arc. -/ +theorem compl_open_isSurface [ConnectedSpace S] (hS : IsClosedSurface S) + {Λ : Set S} (hΛ_open : IsOpen Λ) (hOArc : IsOArc (subBd Λ)) + (hout : ∀ x ∈ closure Λ \ Λ, x ∈ closure (closure Λ)ᶜ) : + IsSurface ↥(univ \ Λ : Set S) ∧ ConnectedSpace ↥(univ \ Λ : Set S) ∧ + bd ↥(univ \ Λ : Set S) = Subtype.val ⁻¹' subBd Λ ∧ + IsOArc (bd ↥(univ \ Λ : Set S)) := by + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hS_surf : IsSurface S := IsClosedSurface.isSurface hS + have hbd_empty : bd S = ∅ := eq_empty_iff_forall_notMem.mpr fun x hx => hx (hS.2.2 x) + have hsubBd_eq : closure Λ \ Λ = subBd Λ := by + rw [subBd_eq_frontier, hΛ_open.frontier_eq] + have hsurf_compl : IsSurface ↥(Λᶜ : Set S) := + compl_surface hS_surf hbd_empty hΛ_open (hsubBd_eq.symm ▸ hOArc) hout + have hset_eq : (Λᶜ : Set S) = univ \ Λ := compl_eq_univ_sdiff Λ + let e : ↥(Λᶜ : Set S) ≃ₜ ↥(univ \ Λ : Set S) := Homeomorph.setCongr hset_eq + have hsurf : IsSurface ↥(univ \ Λ : Set S) := isSurface_of_homeo e hsurf_compl + have hbd : bd ↥(univ \ Λ : Set S) = Subtype.val ⁻¹' subBd Λ := by + ext x + have hx := bd_subset_iff hS.2.2 x + have hcompl_eq : (univ \ Λ : Set S)ᶜ = Λ := by + ext z; simp + rw [hx, hcompl_eq, mem_preimage, ← hsubBd_eq] + exact ⟨fun h => ⟨h, x.2.2⟩, fun h => h.1⟩ + have hval : IsEmbedding (Subtype.val : ↥(univ \ Λ : Set S) → S) := IsEmbedding.subtypeVal + have himg_bd : Subtype.val '' bd ↥(univ \ Λ : Set S) = subBd Λ := by + rw [hbd, Subtype.image_preimage_coe] + refine inter_eq_right.mpr fun x hx => ⟨mem_univ x, ?_⟩ + have hx' : x ∈ closure Λ \ Λ := hsubBd_eq.symm ▸ hx + exact hx'.2 + have hOArc_bd : IsOArc (bd ↥(univ \ Λ : Set S)) := + isOArc_of_image hval (himg_bd ▸ hOArc) + obtain ⟨φ⟩ := id hOArc + have hmeet : closure Λ ∩ (univ \ Λ) = subBd Λ := by + rw [← hsubBd_eq] + ext z + exact ⟨fun ⟨h1, _, h2⟩ => ⟨h1, h2⟩, fun ⟨h1, h2⟩ => ⟨h1, mem_univ z, h2⟩⟩ + have hφ_not_Λ : (φ 1).1 ∉ Λ := by + have hmem : (φ 1).1 ∈ closure Λ \ Λ := hsubBd_eq.symm ▸ (φ 1).2 + exact hmem.2 + have hconn : ConnectedSpace ↥(univ \ Λ : Set S) := by + refine connected_compl (isClosed_univ.sdiff hΛ_open) ⟨(φ 1).1, mem_univ _, hφ_not_Λ⟩ + (𝓖 := {closure Λ}) (by simp) ?_ ?_ ?_ ?_ ?_ + · rintro G rfl + exact isClosed_closure + · rintro G rfl + rw [hmeet] + exact hOArc.isPreconnected + · rintro G rfl + rw [hmeet] + exact ⟨(φ 1).1, (φ 1).2⟩ + · rintro G rfl G' rfl hne + exact absurd rfl hne + · rw [eq_univ_iff_forall] + intro z + by_cases hz : z ∈ Λ + · exact Or.inr ⟨closure Λ, mem_singleton _, subset_closure hz⟩ + · exact Or.inl ⟨mem_univ z, hz⟩ + exact ⟨hsurf, hconn, hbd, hOArc_bd⟩ + +/-- Removing one region `Λ ∈ H.R` with `IsOArc (subBd Λ)` from `S` gives a connected surface +`↥(univ \ Λ)` with boundary `Subtype.val ⁻¹' subBd Λ`, which is an `O`-arc. -/ +theorem compl_region_isSurface [ConnectedSpace S] (hS : IsClosedSurface S) + {H : Drawing S} {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsRespectfulDrawingTangle H θ T) (hθ : 3 ≤ θ) + {Λ : Set S} (hΛ : Λ ∈ H.R) (hOArc : IsOArc (subBd Λ)) : + IsSurface ↥(univ \ Λ : Set S) ∧ ConnectedSpace ↥(univ \ Λ : Set S) ∧ + bd ↥(univ \ Λ : Set S) = Subtype.val ⁻¹' subBd Λ ∧ + IsOArc (bd ↥(univ \ Λ : Set S)) := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hout, _, _, _, _⟩ := + isClosedDisc_closure_of_region_tangle hS hT hθ hΛ hOArc + exact compl_open_isSurface hS (GM11.region_isOpen hΛ) hOArc hout + +/-- Removing two open sets `Λ₁, Λ₂` with disjoint closures and `O`-arc boundaries from `S` +gives a connected surface `↥(univ \ (Λ₁ ∪ Λ₂))` with boundary +`Subtype.val ⁻¹' (subBd Λ₁ ∪ subBd Λ₂)`. -/ +theorem compl_two_open_isSurface [ConnectedSpace S] (hS : IsClosedSurface S) + {Λ₁ Λ₂ : Set S} (hΛ₁_open : IsOpen Λ₁) (hΛ₂_open : IsOpen Λ₂) + (hOArc₁ : IsOArc (subBd Λ₁)) (hOArc₂ : IsOArc (subBd Λ₂)) + (hout₁ : ∀ x ∈ closure Λ₁ \ Λ₁, x ∈ closure (closure Λ₁)ᶜ) + (hout₂ : ∀ x ∈ closure Λ₂ \ Λ₂, x ∈ closure (closure Λ₂)ᶜ) + (hdisj_cl : Disjoint (closure Λ₁) (closure Λ₂)) : + IsSurface ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) ∧ + ConnectedSpace ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) ∧ + bd ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) = Subtype.val ⁻¹' (subBd Λ₁ ∪ subBd Λ₂) := by + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hsurf₁, _, _, _⟩ := compl_open_isSurface hS hΛ₁_open hOArc₁ hout₁ + obtain ⟨hsurf₂, _, _, _⟩ := compl_open_isSurface hS hΛ₂_open hOArc₂ hout₂ + have hsubBd₁_eq : closure Λ₁ \ Λ₁ = subBd Λ₁ := by + rw [subBd_eq_frontier, hΛ₁_open.frontier_eq] + have hsubBd₂_eq : closure Λ₂ \ Λ₂ = subBd Λ₂ := by + rw [subBd_eq_frontier, hΛ₂_open.frontier_eq] + have hcl₁₂ : IsClosed (univ \ (Λ₁ ∪ Λ₂) : Set S) := + isClosed_univ.sdiff (hΛ₁_open.union hΛ₂_open) + have hsurf : IsSurface ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) := by + refine ⟨isCompact_iff_compactSpace.mp hcl₁₂.isCompact, inferInstance, fun x => ?_⟩ + by_cases hx₂ : x.1 ∈ closure Λ₂ + · have hx₁ : x.1 ∈ (closure Λ₁)ᶜ := + fun h1 => disjoint_left.mp hdisj_cl h1 hx₂ + have hxB₂ : x.1 ∈ (univ \ Λ₂ : Set S) := ⟨mem_univ _, fun h => x.2.2 (Or.inr h)⟩ + refine isManifoldPoint_of_open_nhd isClosed_closure.isOpen_compl ?_ hx₁ hxB₂ (hsurf₂.2.2 _) + ext z + exact ⟨fun ⟨⟨_, hz⟩, hzc⟩ => ⟨⟨mem_univ z, fun h => hz (Or.inr h)⟩, hzc⟩, + fun ⟨⟨_, hz⟩, hzc⟩ => ⟨⟨mem_univ z, fun h => h.elim (fun h1 => hzc + (subset_closure h1)) hz⟩, hzc⟩⟩ + · have hxB₁ : x.1 ∈ (univ \ Λ₁ : Set S) := ⟨mem_univ _, fun h => x.2.2 (Or.inl h)⟩ + refine isManifoldPoint_of_open_nhd isClosed_closure.isOpen_compl ?_ hx₂ hxB₁ (hsurf₁.2.2 _) + ext z + exact ⟨fun ⟨⟨_, hz⟩, hzc⟩ => ⟨⟨mem_univ z, fun h => hz (Or.inl h)⟩, hzc⟩, + fun ⟨⟨_, hz⟩, hzc⟩ => ⟨⟨mem_univ z, fun h => h.elim hz (fun h2 => hzc + (subset_closure h2))⟩, hzc⟩⟩ + have hbd : bd ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) = Subtype.val ⁻¹' (subBd Λ₁ ∪ subBd Λ₂) := by + ext x + have hx := bd_subset_iff hS.2.2 x + have hcompl_eq : (univ \ (Λ₁ ∪ Λ₂) : Set S)ᶜ = Λ₁ ∪ Λ₂ := by + rw [← compl_eq_univ_sdiff, compl_compl] + rw [hx, hcompl_eq, closure_union, mem_preimage, mem_union, ← hsubBd₁_eq, ← hsubBd₂_eq] + exact ⟨fun h => h.imp (fun h1 => ⟨h1, fun h' => x.2.2 (Or.inl h')⟩) + (fun h2 => ⟨h2, fun h' => x.2.2 (Or.inr h')⟩), + fun h => h.imp And.left And.left⟩ + obtain ⟨φ₁⟩ := id hOArc₁ + obtain ⟨φ₂⟩ := id hOArc₂ + have hmeet₁ : closure Λ₁ ∩ (univ \ (Λ₁ ∪ Λ₂)) = subBd Λ₁ := by + rw [← hsubBd₁_eq] + ext z + exact ⟨fun ⟨h1, _, h2⟩ => ⟨h1, fun h => h2 (Or.inl h)⟩, + fun ⟨h1, h2⟩ => ⟨h1, mem_univ z, fun h => + h.elim h2 fun h' => disjoint_left.mp hdisj_cl h1 (subset_closure h')⟩⟩ + have hmeet₂ : closure Λ₂ ∩ (univ \ (Λ₁ ∪ Λ₂)) = subBd Λ₂ := by + rw [← hsubBd₂_eq] + ext z + exact ⟨fun ⟨h1, _, h2⟩ => ⟨h1, fun h => h2 (Or.inr h)⟩, + fun ⟨h1, h2⟩ => ⟨h1, mem_univ z, fun h => + h.elim (fun h' => disjoint_left.mp hdisj_cl (subset_closure h') h1) h2⟩⟩ + have hconn : ConnectedSpace ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) := by + have hmem₁ : (φ₁ 1).1 ∈ closure Λ₁ ∩ (univ \ (Λ₁ ∪ Λ₂)) := by + rw [hmeet₁] + exact (φ₁ 1).2 + refine connected_compl (isClosed_univ.sdiff (hΛ₁_open.union hΛ₂_open)) + ⟨(φ₁ 1).1, hmem₁.2⟩ (𝓖 := {closure Λ₁, closure Λ₂}) (by simp) ?_ ?_ ?_ ?_ ?_ + · rintro G (rfl | rfl) <;> exact isClosed_closure + · rintro G (rfl | rfl) + · rw [hmeet₁]; exact hOArc₁.isPreconnected + · rw [hmeet₂]; exact hOArc₂.isPreconnected + · rintro G (rfl | rfl) + · rw [hmeet₁]; exact ⟨(φ₁ 1).1, (φ₁ 1).2⟩ + · rw [hmeet₂]; exact ⟨(φ₂ 1).1, (φ₂ 1).2⟩ + · rintro G (rfl | rfl) G' (rfl | rfl) hne + · exact absurd rfl hne + · exact hdisj_cl + · exact hdisj_cl.symm + · exact absurd rfl hne + · rw [eq_univ_iff_forall] + intro z + by_cases h1 : z ∈ Λ₁ + · exact Or.inr ⟨closure Λ₁, Or.inl rfl, subset_closure h1⟩ + · by_cases h2 : z ∈ Λ₂ + · exact Or.inr ⟨closure Λ₂, Or.inr rfl, subset_closure h2⟩ + · exact Or.inl ⟨mem_univ z, fun h => h.elim h1 h2⟩ + exact ⟨hsurf, hconn, hbd⟩ + +/-- Removing two regions `Λ₁, Λ₂ ∈ H.R` with disjoint closures and `O`-arc boundaries from `S` +gives a connected surface `↥(univ \ (Λ₁ ∪ Λ₂))` with boundary +`Subtype.val ⁻¹' (subBd Λ₁ ∪ subBd Λ₂)`. -/ +theorem compl_two_regions_isSurface [ConnectedSpace S] (hS : IsClosedSurface S) + {H : Drawing S} {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsRespectfulDrawingTangle H θ T) (hθ : 3 ≤ θ) + {Λ₁ Λ₂ : Set S} (hΛ₁ : Λ₁ ∈ H.R) (hΛ₂ : Λ₂ ∈ H.R) + (hOArc₁ : IsOArc (subBd Λ₁)) (hOArc₂ : IsOArc (subBd Λ₂)) + (hdisj_cl : Disjoint (closure Λ₁) (closure Λ₂)) : + IsSurface ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) ∧ + ConnectedSpace ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) ∧ + bd ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) = Subtype.val ⁻¹' (subBd Λ₁ ∪ subBd Λ₂) := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hout₁, _, _, _, _⟩ := + isClosedDisc_closure_of_region_tangle hS hT hθ hΛ₁ hOArc₁ + obtain ⟨hout₂, _, _, _, _⟩ := + isClosedDisc_closure_of_region_tangle hS hT hθ hΛ₂ hOArc₂ + exact compl_two_open_isSurface hS (GM11.region_isOpen hΛ₁) (GM11.region_isOpen hΛ₂) + hOArc₁ hOArc₂ hout₁ hout₂ hdisj_cl + +/-- For any region `Λ ∈ H.R` whose boundary `subBd Λ` is an `O`-arc, `H.interSet (subBd Λ)` is a +circuit of `H` with `(H.interSet (subBd Λ)).U = subBd Λ` and +`(H.interSet (subBd Λ)).V = H.V ∩ subBd Λ`. -/ +theorem interSet_subBd_isCircuit_and_U_eq [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {H : Drawing S} {Λ : Set S} + (hΛ : Λ ∈ H.R) (hOArc : IsOArc (subBd Λ)) : + (H.interSet (subBd Λ)).IsCircuit ∧ + (H.interSet (subBd Λ)).U = subBd Λ ∧ + (H.interSet (subBd Λ)).V = H.V ∩ subBd Λ := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hSubBd_U : subBd Λ ⊆ H.U := by + intro z hz + by_contra hz_not_U + obtain ⟨r, hr, hzr⟩ := GM11.exists_region_of_notMem hz_not_U + obtain ⟨w, hwr, hwΛ⟩ := mem_closure_iff.mp hz.1 r (GM11.region_isOpen hr) hzr + have hrΛ : r = Λ := GM11.region_eq_of_mem hr hΛ hwr hwΛ + have hzΛ : z ∈ Λ := hrΛ ▸ hzr + have hz_fr : z ∈ frontier Λ := subBd_eq_frontier Λ ▸ hz + exact ((GM11.region_isOpen hΛ).interior_eq ▸ hz_fr.2) hzΛ + have hcl_bd : IsClosed (subBd Λ) := isClosed_closure.inter isClosed_closure + obtain ⟨hC, hU⟩ := interSet_isCircuit_and_U_of_isOArc hOArc hcl_bd hSubBd_U + exact ⟨hC, hU, H.interSet_V_of_isClosed hcl_bd⟩ + +/-- In Graph Minors XV, (3.5), if `Λ₁, Λ₂ ∈ H.R` are distinct regions with `O`-arc boundaries, +`H.V ∩ subBd Λ₁` is nonempty, and no region of `H` has closure meeting both `H.V ∩ subBd Λ₁` and +`H.V ∩ subBd Λ₂`, then `Disjoint (closure Λ₁) (closure Λ₂)`. -/ +theorem disjoint_closure_of_no_common_region [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {H : Drawing S} {Λ₁ Λ₂ : Set S} + (hΛ₁ : Λ₁ ∈ H.R) (hΛ₂ : Λ₂ ∈ H.R) (hne : Λ₁ ≠ Λ₂) + (hOArc₁ : IsOArc (subBd Λ₁)) (hOArc₂ : IsOArc (subBd Λ₂)) + (hne_V₁ : (H.V ∩ subBd Λ₁).Nonempty) + (hNo_common_region : ∀ r ∈ H.R, (closure r ∩ (H.V ∩ subBd Λ₁)).Nonempty → + Disjoint (closure r) (H.V ∩ subBd Λ₂)) : + Disjoint (closure Λ₁) (closure Λ₂) := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hΛ₁_open : IsOpen Λ₁ := GM11.region_isOpen hΛ₁ + have hΛ₂_open : IsOpen Λ₂ := GM11.region_isOpen hΛ₂ + have hdisj_reg : Disjoint Λ₁ Λ₂ := by + rw [disjoint_iff_inter_eq_empty] + by_contra h + obtain ⟨w, hw₁, hw₂⟩ := nonempty_iff_ne_empty.mpr h + exact hne (GM11.region_eq_of_mem hΛ₁ hΛ₂ hw₁ hw₂) + obtain ⟨v₁, hv₁V, hv₁_bd⟩ := hne_V₁ + have hdisj_cl₁_V₂ : Disjoint (closure Λ₁) (H.V ∩ subBd Λ₂) := + hNo_common_region Λ₁ hΛ₁ ⟨v₁, hv₁_bd.1, hv₁V, hv₁_bd⟩ + obtain ⟨_, hU₁, hV₁⟩ := interSet_subBd_isCircuit_and_U_eq hS hΛ₁ hOArc₁ + obtain ⟨hC₂, hU₂, hV₂⟩ := interSet_subBd_isCircuit_and_U_eq hS hΛ₂ hOArc₂ + rw [disjoint_left] + intro z hz₁ hz₂ + have hz_not_Λ₁ : z ∉ Λ₁ := + fun h => disjoint_left.mp (hdisj_reg.closure_right hΛ₁_open) h hz₂ + have hz_not_Λ₂ : z ∉ Λ₂ := + fun h => disjoint_right.mp (hdisj_reg.closure_left hΛ₂_open) h hz₁ + have hz_bd₁ : z ∈ subBd Λ₁ := by + rw [subBd_eq_frontier, hΛ₁_open.frontier_eq] + exact ⟨hz₁, hz_not_Λ₁⟩ + have hz_bd₂ : z ∈ subBd Λ₂ := by + rw [subBd_eq_frontier, hΛ₂_open.frontier_eq] + exact ⟨hz₂, hz_not_Λ₂⟩ + by_cases hzV : z ∈ H.V + · exact disjoint_left.mp hdisj_cl₁_V₂ hz₁ ⟨hzV, hz_bd₂⟩ + · have hz_not_V₁ : z ∉ (H.interSet (subBd Λ₁)).V := fun h => hzV (hV₁ ▸ h).1 + have hz_not_V₂ : z ∉ (H.interSet (subBd Λ₂)).V := fun h => hzV (hV₂ ▸ h).1 + obtain ⟨e₁, he₁, hze₁⟩ := (H.interSet (subBd Λ₁)).exists_edge_of_mem + (hU₁.symm ▸ hz_bd₁) hz_not_V₁ + obtain ⟨e₂, he₂, hze₂⟩ := (H.interSet (subBd Λ₂)).exists_edge_of_mem + (hU₂.symm ▸ hz_bd₂) hz_not_V₂ + rw [interSet_E H] at he₁ he₂ + have he_eq : e₁ = e₂ := + atom_eq_of_mem (Or.inl (Or.inr he₁.1)) (Or.inl (Or.inr he₂.1)) hze₁ hze₂ + obtain ⟨u, W, _, _, hCV, hCE⟩ := hC₂ + have he₂_W : e₂ ∈ W.edges := by + have h : e₂ ∈ (H.interSet (subBd Λ₂)).E := (interSet_E H (subBd Λ₂)).symm ▸ he₂ + rwa [hCE] at h + have hex_end : ∀ {a b : S} (W' : GraphWalk (H.interSet (subBd Λ₂)).toGraph a b), + e₂ ∈ W'.edges → ∃ w ∈ W'.support, w ∈ closure e₂ := by + intro a b W' hmem + induction W' with + | nil _ => simp [GraphWalk.edges] at hmem + | @cons a y b e hl r ih => + rcases List.mem_cons.mp hmem with rfl | hmem + · refine ⟨a, (GraphWalk.cons hl r).start_mem_support, ?_⟩ + have ha_mem : a ∈ closure e₂ ∩ (H.interSet (subBd Λ₂)).V := by + rw [hl.2.2.2] + exact mem_insert a {y} + exact ha_mem.1 + · obtain ⟨w, hw1, hw2⟩ := ih hmem + exact ⟨w, List.mem_cons_of_mem _ hw1, hw2⟩ + obtain ⟨w, hw_supp, hw_cl₂⟩ := hex_end W he₂_W + have hw_cl : w ∈ closure e₁ := he_eq ▸ hw_cl₂ + have hw_V₂ : w ∈ H.V ∩ subBd Λ₂ := by + rw [← hV₂, hCV] + exact hw_supp + have hw_cl₁ : w ∈ closure Λ₁ := + isClosed_closure.closure_subset_iff.mpr (he₁.2.trans inter_subset_left) hw_cl + exact disjoint_left.mp hdisj_cl₁_V₂ hw_cl₁ hw_V₂ + +/-- Map a cylinder point to the annulus with radius the square root of its first coordinate. -/ +noncomputable def cylToAnnulus (p : ClosedCylinder) : EuclideanPlane := + Real.sqrt p.1.1 • complexPlane (p.1.2 : ℂ) + +theorem continuous_cylToAnnulus : Continuous cylToAnnulus := by + unfold cylToAnnulus + fun_prop + +theorem norm_cylToAnnulus (p : ClosedCylinder) : + ‖cylToAnnulus p‖ = Real.sqrt p.1.1 := by + have hr : 0 ≤ Real.sqrt p.1.1 := Real.sqrt_nonneg _ + simp [cylToAnnulus, norm_smul, abs_of_nonneg hr] + +theorem injective_cylToAnnulus : Function.Injective cylToAnnulus := by + intro p q hpq + have hnorm : ‖cylToAnnulus p‖ = ‖cylToAnnulus q‖ := congrArg norm hpq + rw [norm_cylToAnnulus, norm_cylToAnnulus] at hnorm + have hp1 : 0 ≤ p.1.1 := by linarith [p.2.1.1] + have hq1 : 0 ≤ q.1.1 := by linarith [q.2.1.1] + have hr_eq : p.1.1 = q.1.1 := (Real.sqrt_inj hp1 hq1).mp hnorm + have hpos : Real.sqrt p.1.1 ≠ 0 := by + have : 0 < p.1.1 := by linarith [p.2.1.1] + exact Real.sqrt_ne_zero'.mpr this + have hsmul : Real.sqrt p.1.1 • complexPlane (p.1.2 : ℂ) = + Real.sqrt p.1.1 • complexPlane (q.1.2 : ℂ) := by + simpa [cylToAnnulus, hr_eq] using hpq + have hcp := smul_right_injective EuclideanPlane hpos hsmul + have hcircle : p.1.2 = q.1.2 := Subtype.ext (complexPlane.injective hcp) + exact Subtype.ext (Prod.ext hr_eq hcircle) + +theorem norm_sq_euclideanPlane (v : EuclideanPlane) : + ‖v‖ ^ 2 = v 0 ^ 2 + v 1 ^ 2 := by + rw [EuclideanSpace.norm_eq, Real.sq_sqrt (by positivity)] + simp [Fin.sum_univ_two] + +theorem range_cylToAnnulus : + range cylToAnnulus = GM12.ClosedAnnulus := by + ext v + simp only [mem_range, GM12.ClosedAnnulus, mem_ofPred_eq, ← norm_sq_euclideanPlane] + constructor + · rintro ⟨p, rfl⟩ + rw [norm_cylToAnnulus, Real.sq_sqrt (by linarith [p.2.1.1])] + exact ⟨p.2.1.1, p.2.1.2⟩ + · rintro ⟨h1, h2⟩ + have hv_pos : 0 < ‖v‖ := by nlinarith [norm_nonneg v] + have hv_ne : ‖v‖ ≠ 0 := ne_of_gt hv_pos + let r : ℝ := ‖v‖ ^ 2 + have hr : r ∈ Icc (1 : ℝ) 2 := ⟨h1, h2⟩ + let z : ℂ := complexPlane.symm v / (‖v‖ : ℂ) + have hz_norm : ‖z‖ = 1 := by simp [z, div_self hv_ne] + let u : Circle := ⟨z, mem_sphere_zero_iff_norm.mpr hz_norm⟩ + refine ⟨⟨(r, u), hr, trivial⟩, ?_⟩ + dsimp [cylToAnnulus, r, u, z] + rw [Real.sqrt_sq hv_pos.le] + apply complexPlane.symm.injective + rw [map_smul, LinearIsometryEquiv.symm_apply_apply, Complex.real_smul] + exact mul_div_cancel₀ _ (Complex.ofReal_ne_zero.mpr hv_ne) + +/-- `ClosedCylinder` is homeomorphic to `GM12.ClosedAnnulus`. -/ +noncomputable def closedCylinderHomeoAnnulus : ClosedCylinder ≃ₜ GM12.ClosedAnnulus := + haveI : CompactSpace ClosedCylinder := + isCompact_iff_compactSpace.mp (isCompact_Icc.prod isCompact_univ) + (continuous_cylToAnnulus.isClosedEmbedding + injective_cylToAnnulus).toIsEmbedding.toHomeomorph.trans + (Homeomorph.setCongr range_cylToAnnulus) + +/-- The radial pinch factor `1 - (1 / 4) * min 1 (Metric.infDist u S_pts)` on `EuclideanPlane`. -/ +noncomputable def pinchScale (S_pts : Set EuclideanPlane) (u : EuclideanPlane) : ℝ := + 1 - (1 / 4 : ℝ) * min 1 (Metric.infDist u S_pts) + +/-- The unit direction vector `‖x‖⁻¹ • x` (equal to `0` at `x = 0`). -/ +noncomputable def unitDir (x : EuclideanPlane) : EuclideanPlane := + ‖x‖⁻¹ • x + +theorem pinchScale_bounds (S_pts : Set EuclideanPlane) (u : EuclideanPlane) : + 3 / 4 ≤ pinchScale S_pts u ∧ pinchScale S_pts u ≤ 1 := by + have hmin_nonneg : 0 ≤ min 1 (Metric.infDist u S_pts) := + le_min zero_le_one Metric.infDist_nonneg + have hmin_le : min 1 (Metric.infDist u S_pts) ≤ 1 := min_le_left 1 _ + unfold pinchScale + constructor <;> linarith + +theorem pinchScale_pos (S_pts : Set EuclideanPlane) (u : EuclideanPlane) : + 0 < pinchScale S_pts u := by + linarith [(pinchScale_bounds S_pts u).1] + +theorem continuous_pinchScale (S_pts : Set EuclideanPlane) : + Continuous (pinchScale S_pts) := by + unfold pinchScale + exact continuous_const.sub (continuous_const.mul (continuous_const.min + (Metric.continuous_infDist_pt S_pts))) + +theorem unitDir_smul {c : ℝ} (hc : 0 < c) (x : EuclideanPlane) : + unitDir (c • x) = unitDir x := by + simp only [unitDir, norm_smul, Real.norm_of_nonneg hc.le, mul_inv_rev, ← mul_smul] + rw [mul_assoc, inv_mul_cancel₀ hc.ne', mul_one] + +theorem unitDir_of_mem_unitCircle {u : EuclideanPlane} (hu : u ∈ UnitCircle) : + unitDir u = u := by + have hnorm : ‖u‖ = 1 := by simpa [UnitCircle] using hu + simp [unitDir, hnorm] + +theorem norm_unitDir {x : EuclideanPlane} (hx : x ≠ 0) : + ‖unitDir x‖ = 1 := by + have hpos : 0 < ‖x‖ := norm_pos_iff.mpr hx + simp [unitDir, norm_smul, inv_mul_cancel₀ hpos.ne'] + +theorem unitDir_mem_unitCircle {x : EuclideanPlane} (hx : ‖x‖ ≠ 0) : + unitDir x ∈ UnitCircle := by + simpa [UnitCircle] using norm_unitDir (norm_ne_zero_iff.mp hx) + +theorem norm_smul_unitDir (x : EuclideanPlane) : + ‖x‖ • unitDir x = x := by + by_cases hx : ‖x‖ = 0 + · simp [norm_eq_zero.mp hx] + · simp [unitDir, smul_smul, mul_inv_cancel₀ hx] + +theorem continuousAt_unitDir {x : EuclideanPlane} (hx : x ≠ 0) : + ContinuousAt unitDir x := + (continuous_norm.continuousAt.inv₀ (norm_ne_zero_iff.mpr hx)).smul continuousAt_id + +/-- The radial pinch map `x ↦ pinchScale S_pts (unitDir x) • x`. -/ +noncomputable def pinchMap (S_pts : Set EuclideanPlane) (x : EuclideanPlane) : EuclideanPlane := + pinchScale S_pts (unitDir x) • x + +/-- The inverse radial unpinch map `y ↦ (pinchScale S_pts (unitDir y))⁻¹ • y`. -/ +noncomputable def unpinchMap (S_pts : Set EuclideanPlane) (y : EuclideanPlane) : EuclideanPlane := + (pinchScale S_pts (unitDir y))⁻¹ • y + +theorem unpinchMap_pinchMap (S_pts : Set EuclideanPlane) (x : EuclideanPlane) : + unpinchMap S_pts (pinchMap S_pts x) = x := by + have hc : 0 < pinchScale S_pts (unitDir x) := pinchScale_pos S_pts (unitDir x) + simp only [pinchMap, unpinchMap, unitDir_smul hc] + exact inv_smul_smul₀ hc.ne' x + +theorem pinchMap_unpinchMap (S_pts : Set EuclideanPlane) (y : EuclideanPlane) : + pinchMap S_pts (unpinchMap S_pts y) = y := by + have hc : 0 < pinchScale S_pts (unitDir y) := pinchScale_pos S_pts (unitDir y) + have hcinv : 0 < (pinchScale S_pts (unitDir y))⁻¹ := inv_pos.mpr hc + simp only [pinchMap, unpinchMap, unitDir_smul hcinv] + exact smul_inv_smul₀ hc.ne' y + +theorem norm_pinchMap (S_pts : Set EuclideanPlane) (x : EuclideanPlane) : + ‖pinchMap S_pts x‖ = pinchScale S_pts (unitDir x) * ‖x‖ := by + have hc : 0 < pinchScale S_pts (unitDir x) := pinchScale_pos S_pts (unitDir x) + simp [pinchMap, norm_smul, abs_of_pos hc] + +theorem norm_unpinchMap (S_pts : Set EuclideanPlane) (y : EuclideanPlane) : + ‖unpinchMap S_pts y‖ = (pinchScale S_pts (unitDir y))⁻¹ * ‖y‖ := by + have hc : 0 < pinchScale S_pts (unitDir y) := pinchScale_pos S_pts (unitDir y) + simp [unpinchMap, norm_smul, abs_of_pos hc] + +theorem continuous_pinchMap (S_pts : Set EuclideanPlane) : + Continuous (pinchMap S_pts) := by + rw [continuous_iff_continuousAt] + intro x + by_cases hx : x = 0 + · subst hx + have h0 : pinchMap S_pts 0 = 0 := by simp [pinchMap] + unfold ContinuousAt + rw [h0] + refine squeeze_zero_norm (a := fun z : EuclideanPlane => ‖z‖) (fun z => ?_) + (by simpa using (continuous_norm (E := EuclideanPlane)).tendsto 0) + rw [norm_pinchMap] + exact mul_le_of_le_one_left (norm_nonneg z) (pinchScale_bounds S_pts (unitDir z)).2 + · exact ((continuous_pinchScale S_pts).continuousAt.comp (continuousAt_unitDir hx)).smul + continuousAt_id + +theorem continuous_unpinchMap (S_pts : Set EuclideanPlane) : + Continuous (unpinchMap S_pts) := by + rw [continuous_iff_continuousAt] + intro x + by_cases hx : x = 0 + · subst hx + have h0 : unpinchMap S_pts 0 = 0 := by simp [unpinchMap] + unfold ContinuousAt + rw [h0] + have hcont : Continuous (fun z : EuclideanPlane => (4 / 3 : ℝ) * ‖z‖) := + continuous_const.mul continuous_norm + refine squeeze_zero_norm (a := fun z : EuclideanPlane => (4 / 3 : ℝ) * ‖z‖) (fun z => ?_) + (by simpa using hcont.tendsto 0) + rw [norm_unpinchMap] + have hle : (pinchScale S_pts (unitDir z))⁻¹ ≤ 4 / 3 := by + have h1 := (pinchScale_bounds S_pts (unitDir z)).1 + rw [inv_le_comm₀ (pinchScale_pos S_pts (unitDir z)) (by norm_num)] + linarith + exact mul_le_mul_of_nonneg_right hle (norm_nonneg z) + · exact (((continuous_pinchScale S_pts).continuousAt.comp (continuousAt_unitDir hx)).inv₀ + (pinchScale_pos S_pts (unitDir x)).ne').smul continuousAt_id + +/-- The global homeomorphism of `EuclideanPlane` pinching `ClosedUnitDisc` inward away from +`UnitCircle \ S_pts` while fixing `S_pts ⊆ UnitCircle` pointwise. -/ +noncomputable def pinchHomeo (S_pts : Set EuclideanPlane) : EuclideanPlane ≃ₜ EuclideanPlane where + toFun := pinchMap S_pts + invFun := unpinchMap S_pts + left_inv := unpinchMap_pinchMap S_pts + right_inv := pinchMap_unpinchMap S_pts + continuous_toFun := continuous_pinchMap S_pts + continuous_invFun := continuous_unpinchMap S_pts + +theorem mem_image_pinchHomeo_iff (S_pts : Set EuclideanPlane) (A : Set EuclideanPlane) + (y : EuclideanPlane) : + y ∈ pinchHomeo S_pts '' A ↔ unpinchMap S_pts y ∈ A := by + constructor + · rintro ⟨x, hx, rfl⟩ + change unpinchMap S_pts (pinchMap S_pts x) ∈ A + rwa [unpinchMap_pinchMap] + · intro hy + exact ⟨unpinchMap S_pts y, hy, pinchMap_unpinchMap S_pts y⟩ + +theorem mem_image_closedUnitDisc_pinchHomeo (S_pts : Set EuclideanPlane) (y : EuclideanPlane) : + y ∈ pinchHomeo S_pts '' ClosedUnitDisc ↔ ‖y‖ ≤ pinchScale S_pts (unitDir y) := by + rw [mem_image_pinchHomeo_iff] + simp only [ClosedUnitDisc, Metric.mem_closedBall, dist_zero_right, norm_unpinchMap] + rw [inv_mul_le_iff₀ (pinchScale_pos S_pts (unitDir y)), mul_one] + +theorem mem_image_openUnitDisc_pinchHomeo (S_pts : Set EuclideanPlane) (y : EuclideanPlane) : + y ∈ pinchHomeo S_pts '' OpenUnitDisc ↔ ‖y‖ < pinchScale S_pts (unitDir y) := by + rw [mem_image_pinchHomeo_iff] + simp only [OpenUnitDisc, Metric.mem_ball, dist_zero_right, norm_unpinchMap] + rw [inv_mul_lt_iff₀ (pinchScale_pos S_pts (unitDir y)), mul_one] + +theorem mem_image_unitCircle_pinchHomeo (S_pts : Set EuclideanPlane) (y : EuclideanPlane) : + y ∈ pinchHomeo S_pts '' UnitCircle ↔ ‖y‖ = pinchScale S_pts (unitDir y) := by + rw [mem_image_pinchHomeo_iff] + simp only [UnitCircle, Metric.mem_sphere, dist_zero_right, norm_unpinchMap] + rw [inv_mul_eq_iff_eq_mul₀ (pinchScale_pos S_pts (unitDir y)).ne', mul_one] + +theorem pinchScale_eq_one_iff {S_pts : Set EuclideanPlane} + (hS_cl : IsClosed S_pts) (hS_ne : S_pts.Nonempty) (u : EuclideanPlane) : + pinchScale S_pts u = 1 ↔ u ∈ S_pts := by + unfold pinchScale + have h1 : 1 - (1 / 4 : ℝ) * min 1 (Metric.infDist u S_pts) = 1 ↔ + min 1 (Metric.infDist u S_pts) = 0 := by + constructor <;> intro h <;> linarith + rw [h1] + have h2 : min 1 (Metric.infDist u S_pts) = 0 ↔ Metric.infDist u S_pts = 0 := by + constructor + · intro h + rcases min_choice 1 (Metric.infDist u S_pts) with hmin | hmin <;> linarith + · intro h + rw [h, min_eq_right zero_le_one] + rw [h2, ← Metric.mem_closure_iff_infDist_zero hS_ne, hS_cl.closure_eq] + +theorem pinchHomeo_apply_of_mem {S_pts : Set EuclideanPlane} + (hS_cl : IsClosed S_pts) (hS_ne : S_pts.Nonempty) (hS_sub : S_pts ⊆ UnitCircle) + {u : EuclideanPlane} (hu : u ∈ S_pts) : + pinchHomeo S_pts u = u := by + change pinchMap S_pts u = u + unfold pinchMap + rw [unitDir_of_mem_unitCircle (hS_sub hu), (pinchScale_eq_one_iff hS_cl hS_ne u).mpr hu, one_smul] + +theorem image_closedUnitDisc_pinchHomeo_subset (S_pts : Set EuclideanPlane) : + pinchHomeo S_pts '' ClosedUnitDisc ⊆ ClosedUnitDisc := by + intro y hy + rw [mem_image_closedUnitDisc_pinchHomeo] at hy + simp only [ClosedUnitDisc, Metric.mem_closedBall, dist_zero_right] + exact hy.trans (pinchScale_bounds S_pts (unitDir y)).2 + +theorem image_openUnitDisc_pinchHomeo_subset (S_pts : Set EuclideanPlane) : + pinchHomeo S_pts '' OpenUnitDisc ⊆ OpenUnitDisc := by + intro y hy + rw [mem_image_openUnitDisc_pinchHomeo] at hy + simp only [OpenUnitDisc, Metric.mem_ball, dist_zero_right] + exact hy.trans_le (pinchScale_bounds S_pts (unitDir y)).2 + +theorem image_closedUnitDisc_pinchHomeo_inter_unitCircle {S_pts : Set EuclideanPlane} + (hS_cl : IsClosed S_pts) (hS_ne : S_pts.Nonempty) (hS_sub : S_pts ⊆ UnitCircle) : + (pinchHomeo S_pts '' ClosedUnitDisc) ∩ UnitCircle = S_pts := by + ext y + simp only [mem_inter_iff, mem_image_closedUnitDisc_pinchHomeo] + constructor + · rintro ⟨hy_le, hy_circ⟩ + have hy_norm : ‖y‖ = 1 := by simpa [UnitCircle] using hy_circ + have hscale : pinchScale S_pts (unitDir y) = 1 := + le_antisymm (pinchScale_bounds S_pts (unitDir y)).2 (hy_norm ▸ hy_le) + rw [unitDir_of_mem_unitCircle hy_circ] at hscale + exact (pinchScale_eq_one_iff hS_cl hS_ne y).mp hscale + · intro hy + have hy_circ : y ∈ UnitCircle := hS_sub hy + have hy_norm : ‖y‖ = 1 := by simpa [UnitCircle] using hy_circ + rw [hy_norm, unitDir_of_mem_unitCircle hy_circ, (pinchScale_eq_one_iff hS_cl hS_ne y).mpr hy] + exact ⟨le_rfl, hy_circ⟩ + +theorem image_unitCircle_pinchHomeo_inter_unitCircle {S_pts : Set EuclideanPlane} + (hS_cl : IsClosed S_pts) (hS_ne : S_pts.Nonempty) (hS_sub : S_pts ⊆ UnitCircle) : + (pinchHomeo S_pts '' UnitCircle) ∩ UnitCircle = S_pts := by + ext y + simp only [mem_inter_iff, mem_image_unitCircle_pinchHomeo] + constructor + · rintro ⟨hy_eq, hy_circ⟩ + have hy_norm : ‖y‖ = 1 := by simpa [UnitCircle] using hy_circ + have hscale : pinchScale S_pts (unitDir y) = 1 := hy_eq.symm.trans hy_norm + rw [unitDir_of_mem_unitCircle hy_circ] at hscale + exact (pinchScale_eq_one_iff hS_cl hS_ne y).mp hscale + · intro hy + have hy_circ : y ∈ UnitCircle := hS_sub hy + have hy_norm : ‖y‖ = 1 := by simpa [UnitCircle] using hy_circ + rw [hy_norm, unitDir_of_mem_unitCircle hy_circ, (pinchScale_eq_one_iff hS_cl hS_ne y).mpr hy] + exact ⟨rfl, hy_circ⟩ + +theorem closure_image_openUnitDisc_pinchHomeo (S_pts : Set EuclideanPlane) : + closure (pinchHomeo S_pts '' OpenUnitDisc) = pinchHomeo S_pts '' ClosedUnitDisc := by + rw [← (pinchHomeo S_pts).image_closure] + congr 1 + exact closure_ball (0 : EuclideanPlane) one_ne_zero + +theorem image_closedUnitDisc_sdiff_openUnitDisc_pinchHomeo (S_pts : Set EuclideanPlane) : + (pinchHomeo S_pts '' ClosedUnitDisc) \ (pinchHomeo S_pts '' OpenUnitDisc) = + pinchHomeo S_pts '' UnitCircle := by + rw [← image_sdiff (pinchHomeo S_pts).injective] + congr 1 + exact Metric.closedBall_sdiff_ball + +theorem mem_closure_openUnitDisc_sdiff_pinchHomeo {S_pts : Set EuclideanPlane} + (hS_cl : IsClosed S_pts) (hS_ne : S_pts.Nonempty) (hS_sub : S_pts ⊆ UnitCircle) + {y : EuclideanPlane} (hy : y ∈ (pinchHomeo S_pts '' UnitCircle) \ S_pts) : + y ∈ closure (OpenUnitDisc \ (pinchHomeo S_pts '' ClosedUnitDisc)) := by + obtain ⟨hy_C, hy_not_S⟩ := hy + have hy_norm_eq : ‖y‖ = pinchScale S_pts (unitDir y) := + (mem_image_unitCircle_pinchHomeo S_pts y).mp hy_C + have hy_pos : 0 < ‖y‖ := hy_norm_eq.symm ▸ pinchScale_pos S_pts (unitDir y) + have hy_lt_one : ‖y‖ < 1 := by + refine lt_of_le_of_ne (hy_norm_eq.symm ▸ (pinchScale_bounds S_pts (unitDir y)).2) ?_ + intro h1 + have hy_unit : y ∈ UnitCircle := by simpa [UnitCircle] using h1 + have hy_in_S : y ∈ S_pts := + image_unitCircle_pinchHomeo_inter_unitCircle hS_cl hS_ne hS_sub ▸ ⟨hy_C, hy_unit⟩ + exact hy_not_S hy_in_S + have hinv_gt_one : 1 < ‖y‖⁻¹ := one_lt_inv₀ hy_pos |>.mpr hy_lt_one + rw [mem_closure_iff_nhds] + intro V hV + have hcont_smul : Continuous (fun t : ℝ => t • y) := continuous_id.smul continuous_const + have hpre : {t : ℝ | t • y ∈ V} ∈ 𝓝 (1 : ℝ) := by + apply hcont_smul.continuousAt.preimage_mem_nhds + simpa using hV + obtain ⟨ε, hε_pos, hε_sub⟩ := Metric.mem_nhds_iff.mp hpre + let t : ℝ := 1 + min (ε / 2) ((‖y‖⁻¹ - 1) / 2) + have ht_gt_one : 1 < t := by + dsimp [t] + have : 0 < min (ε / 2) ((‖y‖⁻¹ - 1) / 2) := lt_min (by linarith) (by linarith) + linarith + have ht_lt_inv : t < ‖y‖⁻¹ := by + dsimp [t] + have : min (ε / 2) ((‖y‖⁻¹ - 1) / 2) ≤ (‖y‖⁻¹ - 1) / 2 := min_le_right _ _ + linarith + have ht_ball : t ∈ Metric.ball (1 : ℝ) ε := by + rw [Metric.mem_ball, Real.dist_eq] + have hle : min (ε / 2) ((‖y‖⁻¹ - 1) / 2) ≤ ε / 2 := min_le_left _ _ + have hpos : 0 < min (ε / 2) ((‖y‖⁻¹ - 1) / 2) := lt_min (by linarith) (by linarith) + rw [abs_of_pos (by dsimp [t]; linarith)] + dsimp [t] + linarith + have ht_pos : 0 < t := by linarith + refine ⟨t • y, hε_sub ht_ball, ?_, ?_⟩ + · simp only [OpenUnitDisc, Metric.mem_ball, dist_zero_right, norm_smul, + Real.norm_of_nonneg ht_pos.le] + calc t * ‖y‖ < ‖y‖⁻¹ * ‖y‖ := mul_lt_mul_of_pos_right ht_lt_inv hy_pos + _ = 1 := inv_mul_cancel₀ hy_pos.ne' + · rw [mem_image_closedUnitDisc_pinchHomeo, unitDir_smul ht_pos, + norm_smul, Real.norm_of_nonneg ht_pos.le, ← hy_norm_eq] + exact not_le.mpr (lt_mul_of_one_lt_left hy_pos ht_gt_one) + +/-- Given strictly increasing sequences `a, b : ℕ → ℝ` and `n : ℕ`, there is a continuous +strictly increasing function `τ : ℝ → ℝ` on `[a 0, a (n + 1)]` with `τ (a i) = b i` for all +`i ≤ n + 1`. -/ +theorem exists_strictMonoOn_interp (n : ℕ) (a b : ℕ → ℝ) + (ha : StrictMono a) (hb : StrictMono b) : + ∃ τ : ℝ → ℝ, ContinuousOn τ (Icc (a 0) (a (n + 1))) ∧ + StrictMonoOn τ (Icc (a 0) (a (n + 1))) ∧ + ∀ i ≤ n + 1, τ (a i) = b i := + GM14.exists_strictMonoOn_interp n a b ha hb + +/-- Given `m ≥ 1` and strictly increasing sequences `t₁, t₂ : ℕ → ℝ` with +`t₁ i < t₁ 0 + 2π` and `t₂ i < t₂ 0 + 2π` for `i < m`, there is a homeomorphism +`h_circ : Circle ≃ₜ Circle` mapping `Circle.exp (t₁ i)` to `Circle.exp (t₂ i)` for all `i < m`. -/ +theorem exists_circle_homeo_matching_angles (m : ℕ) (hm : 1 ≤ m) + (t₁ t₂ : ℕ → ℝ) (ht₁ : StrictMono t₁) (ht₂ : StrictMono t₂) + (hbd₁ : ∀ i < m, t₁ i < t₁ 0 + 2 * Real.pi) + (hbd₂ : ∀ i < m, t₂ i < t₂ 0 + 2 * Real.pi) : + ∃ h_circ : Circle ≃ₜ Circle, + ∀ i < m, h_circ (Circle.exp (t₁ i)) = Circle.exp (t₂ i) := + GM14.exists_circle_homeo_matching_angles m hm t₁ t₂ ht₁ ht₂ hbd₁ hbd₂ + +theorem exists_subline_of_closed_cover_Ordered [T2Space S] + {K₀ S₁ K₁ : Set S} (hK₀ : IsClosed K₀) (hS₁ : IsClosed S₁) (hK₁ : IsClosed K₁) + (hdisj : Disjoint K₀ K₁) + {a : unitInterval → S} (ha : IsArcMap a) + (hsub : range a ⊆ K₀ ∪ S₁ ∪ K₁) + {t₀ t₁ : unitInterval} (hle : (t₀ : ℝ) ≤ (t₁ : ℝ)) + (ha₀ : a t₀ ∈ K₀) (ha₁ : a t₁ ∈ K₁) : + ∃ F_sub ⊆ range a, IsLine F_sub ∧ F_sub ⊆ S₁ ∧ + (F_sub ∩ (K₀ ∩ S₁)).Nonempty ∧ (F_sub ∩ (K₁ ∩ S₁)).Nonempty := by + have ha_cont : Continuous (extI a) := continuous_extI ha.1 + have hmem_range : ∀ r : ℝ, r ∈ Icc (0 : ℝ) 1 → extI a r ∈ range a := by + intro r hr + exact ⟨⟨r, hr⟩, (extI_of_mem a hr).symm⟩ + let A₀ : Set ℝ := Icc (t₀ : ℝ) (t₁ : ℝ) ∩ (extI a) ⁻¹' K₀ + have hA₀_cl : IsClosed A₀ := isClosed_Icc.inter (hK₀.preimage ha_cont) + have hA₀_ne : A₀.Nonempty := ⟨t₀, ⟨le_rfl, hle⟩, by simpa [extI_coe] using ha₀⟩ + have hA₀_bdd : BddAbove A₀ := ⟨t₁, fun x hx => hx.1.2⟩ + let s₀ : ℝ := sSup A₀ + have hs₀_mem : s₀ ∈ A₀ := hA₀_cl.csSup_mem hA₀_ne hA₀_bdd + have hs₀_Icc : s₀ ∈ Icc (t₀ : ℝ) (t₁ : ℝ) := hs₀_mem.1 + have has₀_K₀ : extI a s₀ ∈ K₀ := hs₀_mem.2 + have hs₀_lt_t₁ : s₀ < (t₁ : ℝ) := by + refine lt_of_le_of_ne hs₀_Icc.2 ?_ + intro heq + have ht₁_K₀ : a t₁ ∈ K₀ := by simpa [heq, extI_coe] using has₀_K₀ + exact disjoint_left.mp hdisj ht₁_K₀ ha₁ + let B₁ : Set ℝ := Icc s₀ (t₁ : ℝ) ∩ (extI a) ⁻¹' K₁ + have hB₁_cl : IsClosed B₁ := isClosed_Icc.inter (hK₁.preimage ha_cont) + have hB₁_ne : B₁.Nonempty := ⟨t₁, ⟨hs₀_Icc.2, le_rfl⟩, by simpa [extI_coe] using ha₁⟩ + have hB₁_bdd : BddBelow B₁ := ⟨s₀, fun x hx => hx.1.1⟩ + let s₁ : ℝ := sInf B₁ + have hs₁_mem : s₁ ∈ B₁ := hB₁_cl.csInf_mem hB₁_ne hB₁_bdd + have hs₁_Icc : s₁ ∈ Icc s₀ (t₁ : ℝ) := hs₁_mem.1 + have has₁_K₁ : extI a s₁ ∈ K₁ := hs₁_mem.2 + have hs₀_lt_s₁ : s₀ < s₁ := by + refine lt_of_le_of_ne hs₁_Icc.1 ?_ + intro heq + exact disjoint_left.mp hdisj has₀_K₀ (heq ▸ has₁_K₁) + have hIoo_S₁ : ∀ t ∈ Ioo s₀ s₁, extI a t ∈ S₁ := by + intro t ht + have ht_not_A₀ : t ∉ A₀ := fun h => not_le.mpr ht.1 (le_csSup hA₀_bdd h) + have ht_not_B₁ : t ∉ B₁ := fun h => not_le.mpr ht.2 (csInf_le hB₁_bdd h) + have ht_Icc₀ : t ∈ Icc (t₀ : ℝ) (t₁ : ℝ) := ⟨hs₀_Icc.1.trans ht.1.le, ht.2.le.trans hs₁_Icc.2⟩ + have ht_Icc₁ : t ∈ Icc s₀ (t₁ : ℝ) := ⟨ht.1.le, ht.2.le.trans hs₁_Icc.2⟩ + have ht_01 : t ∈ Icc (0 : ℝ) 1 := ⟨t₀.2.1.trans ht_Icc₀.1, ht_Icc₀.2.trans t₁.2.2⟩ + have hat_not_K₀ : extI a t ∉ K₀ := fun h => ht_not_A₀ ⟨ht_Icc₀, h⟩ + have hat_not_K₁ : extI a t ∉ K₁ := fun h => ht_not_B₁ ⟨ht_Icc₁, h⟩ + rcases hsub (hmem_range t ht_01) with (h | h) | h + · exact (hat_not_K₀ h).elim + · exact h + · exact (hat_not_K₁ h).elim + have hIcc_S₁ : extI a '' Icc s₀ s₁ ⊆ S₁ := by + rw [← closure_Ioo hs₀_lt_s₁.ne] + exact (image_closure_subset_closure_image ha_cont).trans + (hS₁.closure_subset_iff.mpr (image_subset_iff.mpr hIoo_S₁)) + let F_sub : Set S := range (pieceA a s₀ s₁) + have hF_sub_eq : F_sub = extI a '' Icc s₀ s₁ := + range_pieceA a (t₀.2.1.trans hs₀_Icc.1) hs₀_lt_s₁.le (hs₁_Icc.2.trans t₁.2.2) + have hF_sub_line : IsLine F_sub := by + obtain ⟨f_sub, _, _⟩ := + (isArcMap_pieceA ha (t₀.2.1.trans hs₀_Icc.1) hs₀_lt_s₁ (hs₁_Icc.2.trans + t₁.2.2)).isLineWithEnds + exact ⟨f_sub⟩ + refine ⟨F_sub, ?_, hF_sub_line, hF_sub_eq ▸ hIcc_S₁, ?_, ?_⟩ + · rw [hF_sub_eq] + rintro x ⟨r, hr, rfl⟩ + exact hmem_range r ⟨(t₀.2.1.trans hs₀_Icc.1).trans hr.1, hr.2.trans (hs₁_Icc.2.trans t₁.2.2)⟩ + · refine ⟨extI a s₀, ?_, has₀_K₀, hIcc_S₁ ⟨s₀, ⟨le_rfl, hs₀_lt_s₁.le⟩, rfl⟩⟩ + rw [hF_sub_eq] + exact ⟨s₀, ⟨le_rfl, hs₀_lt_s₁.le⟩, rfl⟩ + · refine ⟨extI a s₁, ?_, has₁_K₁, hIcc_S₁ ⟨s₁, ⟨hs₀_lt_s₁.le, le_rfl⟩, rfl⟩⟩ + rw [hF_sub_eq] + exact ⟨s₁, ⟨hs₀_lt_s₁.le, le_rfl⟩, rfl⟩ + +/-- If `F ⊆ K₀ ∪ S₁ ∪ K₁` is a line meeting the disjoint closed sets `K₀` and `K₁` (with `S₁` +closed), +then `F` contains a subline `F_sub ⊆ S₁` meeting both `K₀ ∩ S₁` and `K₁ ∩ S₁`. -/ +theorem exists_subline_of_closed_cover [T2Space S] + {K₀ S₁ K₁ F : Set S} (hK₀ : IsClosed K₀) (hS₁ : IsClosed S₁) (hK₁ : IsClosed K₁) + (hdisj : Disjoint K₀ K₁) (hF : IsLine F) + (hsub : F ⊆ K₀ ∪ S₁ ∪ K₁) + (hF₀ : (F ∩ K₀).Nonempty) (hF₁ : (F ∩ K₁).Nonempty) : + ∃ F_sub ⊆ F, IsLine F_sub ∧ F_sub ⊆ S₁ ∧ + (F_sub ∩ (K₀ ∩ S₁)).Nonempty ∧ (F_sub ∩ (K₁ ∩ S₁)).Nonempty := by + obtain ⟨f⟩ := hF + have hLuv : IsLineWithEnds F (f 0).1 (f 1).1 := ⟨f, rfl, rfl⟩ + obtain ⟨a, ha, rfl, -, -⟩ := hLuv.exists_arc + obtain ⟨_, ⟨t₀, rfl⟩, ha₀⟩ := hF₀ + obtain ⟨_, ⟨t₁, rfl⟩, ha₁⟩ := hF₁ + rcases le_total (t₀ : ℝ) (t₁ : ℝ) with hle | hle + · exact exists_subline_of_closed_cover_Ordered hK₀ hS₁ hK₁ hdisj ha hsub hle ha₀ ha₁ + · have hsub' : range a ⊆ K₁ ∪ S₁ ∪ K₀ := by + intro x hx + rcases hsub hx with (h | h) | h + · exact Or.inr h + · exact Or.inl (Or.inr h) + · exact Or.inl (Or.inl h) + obtain ⟨F_sub, h1, h2, h3, h4, h5⟩ := + exists_subline_of_closed_cover_Ordered hK₁ hS₁ hK₀ hdisj.symm ha hsub' hle ha₁ ha₀ + exact ⟨F_sub, h1, h2, h3, h5, h4⟩ + +private theorem closed_disc_coordinates_map_interior + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (hsubBd_eq : closure Λ \ Λ = subBd Λ) + (φ₀ : ↑ClosedUnitDisc ≃ₜ ↑(closure Λ)) + (f₀ : ↑ClosedUnitDisc → S) + (hf₀_def : f₀ = fun x => (φ₀ x).1) + (hf₀_inj : Function.Injective f₀) + (hf₀_range : range f₀ = closure Λ) + (hf₀_bd : f₀ '' {x | ↑x ∈ UnitCircle} = subBd Λ) + (hCD_split : ∀ (x : ↑ClosedUnitDisc), ↑x ∈ OpenUnitDisc ↔ ↑x ∉ UnitCircle) : + f₀ '' {x | ↑x ∈ OpenUnitDisc} = Λ := by + subst f₀ + let f₀ : ClosedUnitDisc → S := fun x => (φ₀ x).1 + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + have hx_cl : f₀ x ∈ closure Λ := (φ₀ x).2 + have hx_not_bd : f₀ x ∉ subBd Λ := by + rw [← hf₀_bd] + rintro ⟨x', hx', h_eq⟩ + have hxx' : x = x' := hf₀_inj h_eq.symm + exact (hCD_split x).mp hx (hxx' ▸ hx') + by_contra hyΛ + exact hx_not_bd (hsubBd_eq ▸ ⟨hx_cl, hyΛ⟩) + · intro hy + obtain ⟨x, rfl⟩ : y ∈ range f₀ := hf₀_range ▸ subset_closure hy + refine ⟨x, (hCD_split x).mpr fun hx_unit => ?_, rfl⟩ + have h_in_bd : f₀ x ∈ closure Λ \ Λ := by + rw [hsubBd_eq, ← hf₀_bd] + exact ⟨x, hx_unit, rfl⟩ + exact h_in_bd.2 hy + +private theorem boundary_coordinates_are_surjective + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (g : Circle ≃ₜ ↑(subBd Λ)) + (f₀ : ↑ClosedUnitDisc → S) + (hf₀_inj : Function.Injective f₀) + (hf₀_bd : f₀ '' {x | ↑x ∈ UnitCircle} = subBd Λ) + (α₀ : Circle → ↑ClosedUnitDisc) + (α : Circle → EuclideanPlane) + (hα_def : α = fun z => (α₀ z).1) + (hf₀_α₀ : ∀ (z : Circle), f₀ (α₀ z) = ↑(g z)) + (hα_unit : ∀ (z : Circle), α z ∈ UnitCircle) : + range α = UnitCircle := by + subst α + let α : Circle → EuclideanPlane := fun z => (α₀ z).1 + refine subset_antisymm (range_subset_iff.mpr hα_unit) ?_ + intro u hu + have hu_cl : u ∈ ClosedUnitDisc := Metric.sphere_subset_closedBall hu + have hfu_bd : f₀ ⟨u, hu_cl⟩ ∈ subBd Λ := hf₀_bd ▸ ⟨⟨u, hu_cl⟩, hu, rfl⟩ + let z : Circle := g.symm ⟨f₀ ⟨u, hu_cl⟩, hfu_bd⟩ + refine ⟨z, ?_⟩ + have hfz : f₀ (α₀ z) = f₀ ⟨u, hu_cl⟩ := by + rw [hf₀_α₀] + exact congrArg Subtype.val (g.apply_symm_apply ⟨f₀ ⟨u, hu_cl⟩, hfu_bd⟩) + exact congrArg Subtype.val (hf₀_inj hfz) + +private theorem pinched_disc_image_is_open + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (hΛ_open : IsOpen Λ) + (φ₀ : ↑ClosedUnitDisc ≃ₜ ↑(closure Λ)) + (f₀ : ↑ClosedUnitDisc → S) + (hf₀_def : f₀ = fun x => (φ₀ x).1) + (U_sub : Set ↑ClosedUnitDisc) + (D : Set S) + (hD_def : D = f₀ '' U_sub) + (hU_sub_open : IsOpen U_sub) + (hD_sub_Λ : D ⊆ Λ) : + IsOpen D := by + subst f₀ D + let f₀ : ClosedUnitDisc → S := fun x => (φ₀ x).1 + let D : Set S := f₀ '' U_sub + have hopen_cl : IsOpen (φ₀ '' U_sub) := φ₀.isOpenMap _ hU_sub_open + obtain ⟨V, hV_open, hV_eq⟩ := isOpen_induced_iff.mp hopen_cl + have hD_eq : D = V ∩ Λ := by + ext y + constructor + · intro hy + have hy_Λ : y ∈ Λ := hD_sub_Λ hy + rcases hy with ⟨x, hx, rfl⟩ + have hx_V : (φ₀ x).1 ∈ V := by + change φ₀ x ∈ Subtype.val ⁻¹' V + rw [hV_eq] + exact ⟨x, hx, rfl⟩ + exact ⟨hx_V, hy_Λ⟩ + · rintro ⟨hy_V, hy_Λ⟩ + have hy_cl : y ∈ closure Λ := subset_closure hy_Λ + have h_in : (⟨y, hy_cl⟩ : ↥(closure Λ)) ∈ φ₀ '' U_sub := by + rw [← hV_eq] + exact hy_V + rcases h_in with ⟨x, hx, h_eq⟩ + exact ⟨x, hx, congrArg Subtype.val h_eq⟩ + change IsOpen D + rw [hD_eq] + exact hV_open.inter hΛ_open + +private theorem closure_of_pinched_open_unit_disc + (S_pts : Set EuclideanPlane) + (U_E : Set EuclideanPlane) + (hU_E_def : U_E = pinchHomeo S_pts '' OpenUnitDisc) + (U_sub : Set ↑ClosedUnitDisc) + (hU_sub_def : U_sub = Subtype.val ⁻¹' U_E) + (K_sub : Set ↑ClosedUnitDisc) + (hK_sub_def : K_sub = Subtype.val ⁻¹' (pinchHomeo S_pts '' ClosedUnitDisc)) + (hU_E_sub_open : U_E ⊆ OpenUnitDisc) : + closure U_sub = K_sub := by + subst U_E U_sub K_sub + let U_E : Set EuclideanPlane := pinchHomeo S_pts '' OpenUnitDisc + let U_sub : Set ClosedUnitDisc := Subtype.val ⁻¹' U_E + let K_sub : Set ClosedUnitDisc := Subtype.val ⁻¹' (pinchHomeo S_pts '' ClosedUnitDisc) + apply subset_antisymm + · have hK_sub_cl : IsClosed K_sub := + ((pinchHomeo S_pts).isClosedMap _ Metric.isClosed_closedBall).preimage continuous_subtype_val + exact hK_sub_cl.closure_subset_iff.mpr fun x hx => + image_mono Metric.ball_subset_closedBall hx + · intro x hx + rw [mem_closure_iff] + intro V hV hxV + obtain ⟨V', hV'_open, rfl⟩ := isOpen_induced_iff.mp hV + have hx_clE : x.1 ∈ closure U_E := by + rw [closure_image_openUnitDisc_pinchHomeo] + exact hx + obtain ⟨y, hyV', hyU⟩ := mem_closure_iff.mp hx_clE V' hV'_open hxV + exact ⟨⟨y, Metric.ball_subset_closedBall (hU_E_sub_open hyU)⟩, hyV', hyU⟩ + +private theorem pinched_closed_disc_image + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (f₀ : ↑ClosedUnitDisc → S) + (hf₀_cont : Continuous f₀) + (hf₀_inj : Function.Injective f₀) + (S_pts : Set EuclideanPlane) + (K_E : Set EuclideanPlane) + (hK_E_def : K_E = pinchHomeo S_pts '' ClosedUnitDisc) + (K_sub : Set ↑ClosedUnitDisc) + (hK_sub_def : K_sub = Subtype.val ⁻¹' K_E) + (D : Set S) + (hK_E_sub_cl : K_E ⊆ ClosedUnitDisc) + (hcl_D : closure D = f₀ '' K_sub) : + IsClosedDisc (closure D) := by + subst K_E K_sub + let K_E : Set EuclideanPlane := pinchHomeo S_pts '' ClosedUnitDisc + let K_sub : Set ClosedUnitDisc := Subtype.val ⁻¹' K_E + let ψ_D : ClosedUnitDisc → S := fun x => + f₀ ⟨pinchHomeo S_pts x.1, hK_E_sub_cl ⟨x.1, x.2, rfl⟩⟩ + have hψ_cont : Continuous ψ_D := + hf₀_cont.comp (Continuous.subtype_mk ((pinchHomeo S_pts).continuous.comp + continuous_subtype_val) _) + have hψ_inj : Function.Injective ψ_D := by + intro x₁ x₂ h + have h1 := Subtype.ext_iff.mp (hf₀_inj h) + exact Subtype.ext ((pinchHomeo S_pts).injective h1) + have hψ_emb : IsEmbedding ψ_D := + ( hψ_cont.isClosedEmbedding hψ_inj ).isEmbedding + have hψ_range : range ψ_D = closure D := by + rw [hcl_D] + ext y + constructor + · rintro ⟨x, rfl⟩ + exact ⟨⟨pinchHomeo S_pts x.1, hK_E_sub_cl ⟨x.1, x.2, rfl⟩⟩, ⟨x.1, x.2, rfl⟩, rfl⟩ + · rintro ⟨z, ⟨x, hx, hzx⟩, rfl⟩ + refine ⟨⟨x, hx⟩, ?_⟩ + dsimp [ψ_D] + congr 1 + exact Subtype.ext hzx + exact ⟨hψ_emb.toHomeomorph.trans (Homeomorph.setCongr hψ_range)⟩ + +private theorem pinched_disc_boundary_is_closed_curve + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (f₀ : ↑ClosedUnitDisc → S) + (hf₀_cont : Continuous f₀) + (hf₀_inj : Function.Injective f₀) + (α : Circle → EuclideanPlane) + (hα_cont : Continuous α) + (hα_inj : Function.Injective α) + (hα_unit : ∀ (z : Circle), α z ∈ UnitCircle) + (hα_range : range α = UnitCircle) + (S_pts : Set EuclideanPlane) + (K_E : Set EuclideanPlane) + (hK_E_def : K_E = pinchHomeo S_pts '' ClosedUnitDisc) + (C_sub : Set ↑ClosedUnitDisc) + (hC_sub_def : C_sub = Subtype.val ⁻¹' (pinchHomeo S_pts '' UnitCircle)) + (D : Set S) + (hK_E_sub_cl : K_E ⊆ ClosedUnitDisc) + (hsubBd_D_f₀ : subBd D = f₀ '' C_sub) : + IsOArc (subBd D) := by + subst K_E C_sub + let K_E : Set EuclideanPlane := pinchHomeo S_pts '' ClosedUnitDisc + let C_sub : Set ClosedUnitDisc := Subtype.val ⁻¹' (pinchHomeo S_pts '' UnitCircle) + let g_D : Circle → S := fun z => + f₀ ⟨pinchHomeo S_pts (α z), hK_E_sub_cl ⟨α z, Metric.sphere_subset_closedBall (hα_unit z), rfl⟩⟩ + have hg_D_cont : Continuous g_D := + hf₀_cont.comp (Continuous.subtype_mk ((pinchHomeo S_pts).continuous.comp hα_cont) _) + have hg_D_inj : Function.Injective g_D := by + intro z₁ z₂ h + have h1 := Subtype.ext_iff.mp (hf₀_inj h) + exact hα_inj ((pinchHomeo S_pts).injective h1) + have hg_D_emb : IsEmbedding g_D := + (hg_D_cont.isClosedEmbedding hg_D_inj).isEmbedding + have hg_D_range : range g_D = subBd D := by + rw [hsubBd_D_f₀] + ext y + constructor + · rintro ⟨z, rfl⟩ + exact ⟨⟨pinchHomeo S_pts (α z), hK_E_sub_cl ⟨α z, Metric.sphere_subset_closedBall + (hα_unit z), rfl⟩⟩, + ⟨α z, hα_unit z, rfl⟩, rfl⟩ + · rintro ⟨x, ⟨u, hu, hxu⟩, rfl⟩ + obtain ⟨z, rfl⟩ : u ∈ range α := hα_range ▸ hu + refine ⟨z, ?_⟩ + dsimp [g_D] + congr 1 + exact Subtype.ext hxu + exact ⟨hg_D_emb.toHomeomorph.trans (Homeomorph.setCongr hg_D_range)⟩ + +private theorem pinched_boundary_meets_original_at_marks + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (g : Circle ≃ₜ ↑(subBd Λ)) + {W_pts : Set Circle} + (f₀ : ↑ClosedUnitDisc → S) + (hf₀_inj : Function.Injective f₀) + (hf₀_bd : f₀ '' {x | ↑x ∈ UnitCircle} = subBd Λ) + (α₀ : Circle → ↑ClosedUnitDisc) + (α : Circle → EuclideanPlane) + (hα_def : α = fun z => (α₀ z).1) + (hf₀_α₀ : ∀ (z : Circle), f₀ (α₀ z) = ↑(g z)) + (S_pts : Set EuclideanPlane) + (hS_pts_def : S_pts = α '' W_pts) + (hS_cl : IsClosed S_pts) + (hS_ne : S_pts.Nonempty) + (hS_sub : S_pts ⊆ UnitCircle) + (C_sub : Set ↑ClosedUnitDisc) + (hC_sub_def : C_sub = Subtype.val ⁻¹' (pinchHomeo S_pts '' UnitCircle)) + (D : Set S) + (hsubBd_D_f₀ : subBd D = f₀ '' C_sub) : + subBd D ∩ subBd Λ = (fun z => ↑(g z)) '' W_pts := by + subst α S_pts C_sub + let α : Circle → EuclideanPlane := fun z => (α₀ z).1 + let S_pts : Set EuclideanPlane := α '' W_pts + let C_sub : Set ClosedUnitDisc := Subtype.val ⁻¹' (pinchHomeo S_pts '' UnitCircle) + have hinter_sub : C_sub ∩ {x : ClosedUnitDisc | x.1 ∈ UnitCircle} = α₀ '' W_pts := by + ext x + change x.1 ∈ (pinchHomeo S_pts '' UnitCircle) ∩ UnitCircle ↔ x ∈ α₀ '' W_pts + rw [image_unitCircle_pinchHomeo_inter_unitCircle hS_cl hS_ne hS_sub] + constructor + · rintro ⟨z, hz, hzx⟩ + refine ⟨z, hz, Subtype.ext hzx⟩ + · rintro ⟨z, hz, rfl⟩ + exact ⟨z, hz, rfl⟩ + calc subBd D ∩ subBd Λ + _ = f₀ '' C_sub ∩ f₀ '' {x : ClosedUnitDisc | x.1 ∈ UnitCircle} := by + rw [hsubBd_D_f₀, hf₀_bd] + _ = f₀ '' (C_sub ∩ {x : ClosedUnitDisc | x.1 ∈ UnitCircle}) := + (image_inter hf₀_inj).symm + _ = (f₀ ∘ α₀) '' W_pts := by rw [hinter_sub, ← image_comp] + _ = (fun z => (g z).1) '' W_pts := image_congr fun z _ => hf₀_α₀ z + +private theorem pinched_boundary_off_marks_in_outer_closure + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (g : Circle ≃ₜ ↑(subBd Λ)) + {W_pts : Set Circle} + (f₀ : ↑ClosedUnitDisc → S) + (hf₀_cont : Continuous f₀) + (hf₀_inj : Function.Injective f₀) + (hf₀_int : f₀ '' {x | ↑x ∈ OpenUnitDisc} = Λ) + (α₀ : Circle → ↑ClosedUnitDisc) + (α : Circle → EuclideanPlane) (hα_def : α = fun z => (α₀ z).1) + (hf₀_α₀ : ∀ (z : Circle), f₀ (α₀ z) = ↑(g z)) + (S_pts : Set EuclideanPlane) + (hS_pts_def : S_pts = α '' W_pts) + (hS_cl : IsClosed S_pts) + (hS_ne : S_pts.Nonempty) + (hS_sub : S_pts ⊆ UnitCircle) + (K_E : Set EuclideanPlane) + (hK_E_def : K_E = pinchHomeo S_pts '' ClosedUnitDisc) + (K_sub : Set ↑ClosedUnitDisc) + (hK_sub_def : K_sub = Subtype.val ⁻¹' K_E) + (C_sub : Set ↑ClosedUnitDisc) + (hC_sub_def : C_sub = Subtype.val ⁻¹' (pinchHomeo S_pts '' UnitCircle)) + (D : Set S) + (hcl_D : closure D = f₀ '' K_sub) + (hsubBd_D_f₀ : subBd D = f₀ '' C_sub) : + subBd D \ (fun z => ↑(g z)) '' W_pts ⊆ closure (Λ \ closure D) := by + subst α S_pts K_E K_sub C_sub + let α : Circle → EuclideanPlane := fun z => (α₀ z).1 + let S_pts : Set EuclideanPlane := α '' W_pts + let K_E : Set EuclideanPlane := pinchHomeo S_pts '' ClosedUnitDisc + let K_sub : Set ClosedUnitDisc := Subtype.val ⁻¹' K_E + let C_sub : Set ClosedUnitDisc := Subtype.val ⁻¹' (pinchHomeo S_pts '' UnitCircle) + intro y hy + rcases (hsubBd_D_f₀ ▸ hy.1) with ⟨x, hxC, rfl⟩ + have hx_not_S : x.1 ∉ S_pts := by + rintro ⟨z, hz, hzx⟩ + apply hy.2 + refine ⟨z, hz, ?_⟩ + dsimp only + rw [← hf₀_α₀] + congr 1 + exact Subtype.ext (show (α₀ z).1 = x.1 from hzx) + have hx_clE : x.1 ∈ closure (OpenUnitDisc \ K_E) := + mem_closure_openUnitDisc_sdiff_pinchHomeo hS_cl hS_ne hS_sub ⟨hxC, hx_not_S⟩ + let W_sub : Set ClosedUnitDisc := {w : ClosedUnitDisc | w.1 ∈ OpenUnitDisc \ K_E} + have hx_clW : x ∈ closure W_sub := by + rw [mem_closure_iff] + intro V hV hxV + obtain ⟨V', hV'_open, rfl⟩ := isOpen_induced_iff.mp hV + obtain ⟨w, hwV', hwW⟩ := mem_closure_iff.mp hx_clE V' hV'_open hxV + exact ⟨⟨w, Metric.ball_subset_closedBall hwW.1⟩, hwV', hwW⟩ + have hfx_cl : f₀ x ∈ closure (f₀ '' W_sub) := + image_closure_subset_closure_image hf₀_cont ⟨x, hx_clW, rfl⟩ + refine closure_mono ?_ hfx_cl + rintro _ ⟨w, hw, rfl⟩ + refine ⟨?_, ?_⟩ + · rw [← hf₀_int] + exact ⟨w, hw.1, rfl⟩ + · rw [hcl_D] + rintro ⟨w', hw', h_eq⟩ + have hww' : w = w' := hf₀_inj h_eq.symm + exact hw.2 (hww' ▸ hw') + +private theorem radial_collar_map_injective + {S : Type w} + (f₀ : ↑ClosedUnitDisc → S) + (hf₀_inj : Function.Injective f₀) + (α : Circle → EuclideanPlane) + (hα_inj : Function.Injective α) + (hα_norm : ∀ (z : Circle), ‖α z‖ = 1) + (δ : Circle → ℝ) + (hδ_bounds : ∀ (z : Circle), 0 ≤ δ z ∧ δ z ≤ 1 / 4) + (hcMap_mem : ∀ (p : ℝ × Circle), max 0 (min 1 (1 - p.1)) • α p.2 ∈ ClosedUnitDisc) + (cMap : ℝ × Circle → S) + (hcMap_def : cMap = fun p : ℝ × Circle => + f₀ (⟨max (0 : ℝ) (min 1 (1 - p.1)) • α p.2, hcMap_mem p⟩ : ClosedUnitDisc)) + (hcMap_clamp : ∀ (p : ℝ × Circle), 0 ≤ p.1 → p.1 ≤ δ p.2 → max 0 (min 1 (1 - p.1)) = 1 - p.1) : + InjOn cMap {p | 0 ≤ p.1 ∧ p.1 ≤ δ p.2} := by + subst cMap + let cMap : ℝ × Circle → S := fun p => f₀ ⟨max 0 (min 1 (1 - p.1)) • α p.2, hcMap_mem p⟩ + intro p₁ hp₁ p₂ hp₂ heq + have hsub := Subtype.ext_iff.mp (hf₀_inj heq) + dsimp only at hsub + rw [hcMap_clamp p₁ hp₁.1 hp₁.2, hcMap_clamp p₂ hp₂.1 hp₂.2] at hsub + have hr₁_pos : 0 < 1 - p₁.1 := by linarith [(hδ_bounds p₁.2).2, hp₁.2] + have hr₂_pos : 0 < 1 - p₂.1 := by linarith [(hδ_bounds p₂.2).2, hp₂.2] + have hnorm := congrArg norm hsub + rw [norm_smul, norm_smul, Real.norm_of_nonneg hr₁_pos.le, Real.norm_of_nonneg hr₂_pos.le, + hα_norm p₁.2, hα_norm p₂.2, mul_one, mul_one] at hnorm + have hp_fst : p₁.1 = p₂.1 := by linarith + have hα_eq : α p₁.2 = α p₂.2 := by + rw [← hnorm] at hsub + exact smul_right_injective _ hr₁_pos.ne' hsub + exact Prod.ext hp_fst (hα_inj hα_eq) + +private theorem radial_collar_covers_disc_complement + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (φ₀ : ↑ClosedUnitDisc ≃ₜ ↑(closure Λ)) + (f₀ : ↑ClosedUnitDisc → S) + (hf₀_def : f₀ = fun x => (φ₀ x).1) + (hf₀_inj : Function.Injective f₀) + (hf₀_range : range f₀ = closure Λ) + (α : Circle → EuclideanPlane) + (hα_unit : ∀ (z : Circle), α z ∈ UnitCircle) + (hα_norm : ∀ (z : Circle), ‖α z‖ = 1) + (hα_range : range α = UnitCircle) + (S_pts : Set EuclideanPlane) + (δ : Circle → ℝ) + (hδ_def : δ = fun z => 1 - pinchScale S_pts (α z)) + (hδ_bounds : ∀ (z : Circle), 0 ≤ δ z ∧ δ z ≤ 1 / 4) + (U_E : Set EuclideanPlane) + (hU_E_def : U_E = pinchHomeo S_pts '' OpenUnitDisc) + (U_sub : Set ↑ClosedUnitDisc) + (hU_sub_def : U_sub = Subtype.val ⁻¹' U_E) + (D : Set S) + (hD_def : D = f₀ '' U_sub) + (hcMap_mem : ∀ (p : ℝ × Circle), max 0 (min 1 (1 - p.1)) • α p.2 ∈ ClosedUnitDisc) + (cMap : ℝ × Circle → S) + (hcMap_def : cMap = fun p : ℝ × Circle => + f₀ (⟨max (0 : ℝ) (min 1 (1 - p.1)) • α p.2, hcMap_mem p⟩ : ClosedUnitDisc)) + (hcMap_clamp : ∀ (p : ℝ × Circle), 0 ≤ p.1 → p.1 ≤ δ p.2 → max 0 (min 1 (1 - p.1)) = 1 - p.1) : + cMap '' {p | 0 ≤ p.1 ∧ p.1 ≤ δ p.2} = closure Λ \ D := by + subst f₀ δ U_E U_sub D cMap + let f₀ : ClosedUnitDisc → S := fun x => (φ₀ x).1 + let δ : Circle → ℝ := fun z => 1 - pinchScale S_pts (α z) + let U_E : Set EuclideanPlane := pinchHomeo S_pts '' OpenUnitDisc + let U_sub : Set ClosedUnitDisc := Subtype.val ⁻¹' U_E + let D : Set S := f₀ '' U_sub + let cMap : ℝ × Circle → S := fun p => f₀ ⟨max 0 (min 1 (1 - p.1)) • α p.2, hcMap_mem p⟩ + ext y + constructor + · rintro ⟨p, ⟨hp0, hpδ⟩, rfl⟩ + let x : ClosedUnitDisc := ⟨max 0 (min 1 (1 - p.1)) • α p.2, hcMap_mem p⟩ + have hx_eq : x.1 = (1 - p.1) • α p.2 := by + dsimp [x] + rw [hcMap_clamp p hp0 hpδ] + have hr_pos : 0 < 1 - p.1 := by linarith [(hδ_bounds p.2).2, hpδ] + have hx_norm : ‖x.1‖ = 1 - p.1 := by + rw [hx_eq, norm_smul, Real.norm_of_nonneg hr_pos.le, hα_norm p.2, mul_one] + have hx_dir : unitDir x.1 = α p.2 := by + rw [hx_eq, unitDir_smul hr_pos, unitDir_of_mem_unitCircle (hα_unit p.2)] + refine ⟨(φ₀ x).2, ?_⟩ + rintro ⟨x', hx', h_eq⟩ + have hxx' : x = x' := hf₀_inj h_eq.symm + have hx_in_UE : x.1 ∈ U_E := hxx' ▸ hx' + have hlt : ‖x.1‖ < pinchScale S_pts (unitDir x.1) := + (mem_image_openUnitDisc_pinchHomeo S_pts x.1).mp hx_in_UE + rw [hx_norm, hx_dir] at hlt + dsimp only at hpδ + linarith + · rintro ⟨hy_cl, hy_not_D⟩ + obtain ⟨x, rfl⟩ : y ∈ range f₀ := hf₀_range ▸ hy_cl + have hx_not_UE : x.1 ∉ U_E := fun hx => hy_not_D ⟨x, hx, rfl⟩ + have hge : pinchScale S_pts (unitDir x.1) ≤ ‖x.1‖ := + not_lt.mp (mt (mem_image_openUnitDisc_pinchHomeo S_pts x.1).mpr hx_not_UE) + have hx_pos : 0 < ‖x.1‖ := (pinchScale_pos S_pts (unitDir x.1)).trans_le hge + have hx_le_one : ‖x.1‖ ≤ 1 := by simpa [ClosedUnitDisc] using x.2 + obtain ⟨z, hz⟩ : unitDir x.1 ∈ range α := hα_range ▸ unitDir_mem_unitCircle hx_pos.ne' + let t : ℝ := 1 - ‖x.1‖ + have ht0 : 0 ≤ t := by dsimp [t]; linarith + have htδ : t ≤ δ z := by + dsimp [t, δ] + rw [hz] + linarith + refine ⟨(t, z), ⟨ht0, htδ⟩, ?_⟩ + apply congrArg f₀ + apply Subtype.ext + change max (0 : ℝ) (min 1 (1 - t)) • α z = x.1 + rw [hcMap_clamp (t, z) ht0 htδ] + have h1 : 1 - t = ‖x.1‖ := by dsimp [t]; ring + rw [h1, hz, norm_smul_unitDir] + +private theorem radial_collar_inner_edge_is_disc_boundary + {S : Type w} + [TopologicalSpace S] + (f₀ : ↑ClosedUnitDisc → S) + (α : Circle → EuclideanPlane) + (hα_unit : ∀ (z : Circle), α z ∈ UnitCircle) + (hα_norm : ∀ (z : Circle), ‖α z‖ = 1) + (hα_range : range α = UnitCircle) + (S_pts : Set EuclideanPlane) + (δ : Circle → ℝ) + (hδ_def : δ = fun z => 1 - pinchScale S_pts (α z)) + (hδ_bounds : ∀ (z : Circle), 0 ≤ δ z ∧ δ z ≤ 1 / 4) + (C_sub : Set ↑ClosedUnitDisc) + (hC_sub_def : C_sub = Subtype.val ⁻¹' (pinchHomeo S_pts '' UnitCircle)) + (D : Set S) + (hsubBd_D_f₀ : subBd D = f₀ '' C_sub) + (hcMap_mem : ∀ (p : ℝ × Circle), max 0 (min 1 (1 - p.1)) • α p.2 ∈ ClosedUnitDisc) + (cMap : ℝ × Circle → S) + (hcMap_def : cMap = fun p : ℝ × Circle => + f₀ (⟨max (0 : ℝ) (min 1 (1 - p.1)) • α p.2, hcMap_mem p⟩ : ClosedUnitDisc)) + (hcMap_clamp : ∀ (p : ℝ × Circle), 0 ≤ p.1 → p.1 ≤ δ p.2 → max 0 (min 1 (1 - p.1)) = 1 - p.1) : + cMap '' {p | p.1 = δ p.2} = subBd D := by + subst δ C_sub cMap + let δ : Circle → ℝ := fun z => 1 - pinchScale S_pts (α z) + let C_sub : Set ClosedUnitDisc := Subtype.val ⁻¹' (pinchHomeo S_pts '' UnitCircle) + let cMap : ℝ × Circle → S := fun p => f₀ ⟨max 0 (min 1 (1 - p.1)) • α p.2, hcMap_mem p⟩ + rw [hsubBd_D_f₀] + ext y + constructor + · rintro ⟨p, hp_eq, rfl⟩ + have hp0 : 0 ≤ p.1 := hp_eq.symm ▸ (hδ_bounds p.2).1 + have hpδ : p.1 ≤ δ p.2 := hp_eq.le + let x : ClosedUnitDisc := ⟨max 0 (min 1 (1 - p.1)) • α p.2, hcMap_mem p⟩ + refine ⟨x, ?_, rfl⟩ + change x.1 ∈ pinchHomeo S_pts '' UnitCircle + rw [mem_image_unitCircle_pinchHomeo] + have hx_eq : x.1 = (1 - δ p.2) • α p.2 := by + dsimp [x] + rw [hcMap_clamp p hp0 hpδ, hp_eq] + have hr_pos : 0 < 1 - δ p.2 := by linarith [(hδ_bounds p.2).2] + rw [hx_eq, norm_smul, Real.norm_of_nonneg hr_pos.le, hα_norm p.2, mul_one, + unitDir_smul hr_pos, unitDir_of_mem_unitCircle (hα_unit p.2)] + dsimp [δ] + ring + · rintro ⟨x, hxC, rfl⟩ + have hnorm_eq : ‖x.1‖ = pinchScale S_pts (unitDir x.1) := + (mem_image_unitCircle_pinchHomeo S_pts x.1).mp hxC + have hx_pos : 0 < ‖x.1‖ := hnorm_eq.symm ▸ pinchScale_pos S_pts (unitDir x.1) + obtain ⟨z, hz⟩ : unitDir x.1 ∈ range α := hα_range ▸ unitDir_mem_unitCircle hx_pos.ne' + refine ⟨(δ z, z), rfl, ?_⟩ + apply congrArg f₀ + apply Subtype.ext + change max (0 : ℝ) (min 1 (1 - δ z)) • α z = x.1 + rw [hcMap_clamp (δ z, z) (hδ_bounds z).1 le_rfl] + have h1 : 1 - δ z = ‖x.1‖ := by + dsimp [δ] + rw [hz, hnorm_eq] + ring + rw [h1, hz, norm_smul_unitDir] + +private theorem open_radial_collar_covers_closed_disc_complement + {S : Type w} + [TopologicalSpace S] + {Λ : Set S} + (φ₀ : ↑ClosedUnitDisc ≃ₜ ↑(closure Λ)) + (f₀ : ↑ClosedUnitDisc → S) + (hf₀_def : f₀ = fun x => (φ₀ x).1) + (hf₀_inj : Function.Injective f₀) + (hf₀_range : range f₀ = closure Λ) + (α : Circle → EuclideanPlane) + (hα_unit : ∀ (z : Circle), α z ∈ UnitCircle) + (hα_norm : ∀ (z : Circle), ‖α z‖ = 1) + (hα_range : range α = UnitCircle) + (S_pts : Set EuclideanPlane) + (δ : Circle → ℝ) + (hδ_def : δ = fun z => 1 - pinchScale S_pts (α z)) + (hδ_bounds : ∀ (z : Circle), 0 ≤ δ z ∧ δ z ≤ 1 / 4) + (K_E : Set EuclideanPlane) + (hK_E_def : K_E = pinchHomeo S_pts '' ClosedUnitDisc) + (K_sub : Set ↑ClosedUnitDisc) + (hK_sub_def : K_sub = Subtype.val ⁻¹' K_E) + (D : Set S) + (hcl_D : closure D = f₀ '' K_sub) + (hcMap_mem : ∀ (p : ℝ × Circle), max 0 (min 1 (1 - p.1)) • α p.2 ∈ ClosedUnitDisc) + (cMap : ℝ × Circle → S) + (hcMap_def : cMap = fun p : ℝ × Circle => + f₀ (⟨max (0 : ℝ) (min 1 (1 - p.1)) • α p.2, hcMap_mem p⟩ : ClosedUnitDisc)) + (hcMap_clamp : ∀ (p : ℝ × Circle), 0 ≤ p.1 → p.1 ≤ δ p.2 → max 0 (min 1 (1 - p.1)) = 1 - p.1) : + cMap '' {p | 0 ≤ p.1 ∧ p.1 < δ p.2} = closure Λ \ closure D := by + subst f₀ δ K_E K_sub cMap + let f₀ : ClosedUnitDisc → S := fun x => (φ₀ x).1 + let δ : Circle → ℝ := fun z => 1 - pinchScale S_pts (α z) + let K_E : Set EuclideanPlane := pinchHomeo S_pts '' ClosedUnitDisc + let K_sub : Set ClosedUnitDisc := Subtype.val ⁻¹' K_E + let cMap : ℝ × Circle → S := fun p => f₀ ⟨max 0 (min 1 (1 - p.1)) • α p.2, hcMap_mem p⟩ + ext y + constructor + · rintro ⟨p, ⟨hp0, hpδ⟩, rfl⟩ + let x : ClosedUnitDisc := ⟨max 0 (min 1 (1 - p.1)) • α p.2, hcMap_mem p⟩ + have hx_eq : x.1 = (1 - p.1) • α p.2 := by + dsimp [x] + rw [hcMap_clamp p hp0 hpδ.le] + have hr_pos : 0 < 1 - p.1 := by linarith [(hδ_bounds p.2).2, hpδ] + have hx_norm : ‖x.1‖ = 1 - p.1 := by + rw [hx_eq, norm_smul, Real.norm_of_nonneg hr_pos.le, hα_norm p.2, mul_one] + have hx_dir : unitDir x.1 = α p.2 := by + rw [hx_eq, unitDir_smul hr_pos, unitDir_of_mem_unitCircle (hα_unit p.2)] + refine ⟨(φ₀ x).2, ?_⟩ + rw [hcl_D] + rintro ⟨x', hx', h_eq⟩ + have hxx' : x = x' := hf₀_inj h_eq.symm + have hx_in_KE : x.1 ∈ K_E := hxx' ▸ hx' + have hle : ‖x.1‖ ≤ pinchScale S_pts (unitDir x.1) := + (mem_image_closedUnitDisc_pinchHomeo S_pts x.1).mp hx_in_KE + rw [hx_norm, hx_dir] at hle + dsimp only at hpδ + linarith + · rintro ⟨hy_cl, hy_not_clD⟩ + obtain ⟨x, rfl⟩ : y ∈ range f₀ := hf₀_range ▸ hy_cl + have hx_not_KE : x.1 ∉ K_E := fun hx => hy_not_clD (hcl_D ▸ ⟨x, hx, rfl⟩) + have hgt : pinchScale S_pts (unitDir x.1) < ‖x.1‖ := + not_le.mp (mt (mem_image_closedUnitDisc_pinchHomeo S_pts x.1).mpr hx_not_KE) + have hx_pos : 0 < ‖x.1‖ := (pinchScale_pos S_pts (unitDir x.1)).trans hgt + have hx_le_one : ‖x.1‖ ≤ 1 := by simpa [ClosedUnitDisc] using x.2 + obtain ⟨z, hz⟩ : unitDir x.1 ∈ range α := hα_range ▸ unitDir_mem_unitCircle hx_pos.ne' + let t : ℝ := 1 - ‖x.1‖ + have ht0 : 0 ≤ t := by dsimp [t]; linarith + have htδ : t < δ z := by + dsimp [t, δ] + rw [hz] + linarith + refine ⟨(t, z), ⟨ht0, htδ⟩, ?_⟩ + apply congrArg f₀ + apply Subtype.ext + change max (0 : ℝ) (min 1 (1 - t)) • α z = x.1 + rw [hcMap_clamp (t, z) ht0 htδ.le] + have h1 : 1 - t = ‖x.1‖ := by dsimp [t]; ring + rw [h1, hz, norm_smul_unitDir] + +/-- Given a region `Λ` of `S` whose closure is a closed disc with boundary `subBd Λ`, a boundary +parametrization `g : Circle ≃ₜ subBd Λ`, and a nonempty closed subset `W_pts ⊆ Circle`, there exist +a continuous radial collar depth `δ : Circle → ℝ`, an open subdisc `D ⊆ Λ`, and a continuous map +`cMap : ℝ × Circle → S` parametrizing the pinched collar `closure Λ \ D`. -/ +theorem exists_pinched_subdisc_of_region (hS : IsClosedSurface S) + {Λ : Set S} (hΛ_open : IsOpen Λ) (hCD : IsClosedDisc (closure Λ)) + (hdiscBd : discBd (closure Λ) = subBd Λ) + (hout : ∀ x ∈ closure Λ \ Λ, x ∈ closure (closure Λ)ᶜ) + (g : Circle ≃ₜ subBd Λ) + {W_pts : Set Circle} (hW_cl : IsClosed W_pts) (hW_ne : W_pts.Nonempty) : + ∃ (δ : Circle → ℝ) (D : Set S) (cMap : ℝ × Circle → S), + Continuous δ ∧ + (∀ z, 0 ≤ δ z ∧ δ z ≤ 1 / 4) ∧ + (∀ z, δ z = 0 ↔ z ∈ W_pts) ∧ + IsOpen D ∧ D ⊆ Λ ∧ + IsClosedDisc (closure D) ∧ + subBd D = closure D \ D ∧ + IsOArc (subBd D) ∧ + (∀ x ∈ closure D \ D, x ∈ closure (closure D)ᶜ) ∧ + subBd D ∩ subBd Λ = (fun z => (g z).1) '' W_pts ∧ + subBd D \ ((fun z => (g z).1) '' W_pts) ⊆ Λ ∧ + subBd D \ ((fun z => (g z).1) '' W_pts) ⊆ closure (Λ \ closure D) ∧ + Continuous cMap ∧ + Set.InjOn cMap {p : ℝ × Circle | 0 ≤ p.1 ∧ p.1 ≤ δ p.2} ∧ + (∀ z : Circle, cMap (0, z) = (g z).1) ∧ + cMap '' {p : ℝ × Circle | 0 ≤ p.1 ∧ p.1 ≤ δ p.2} = closure Λ \ D ∧ + cMap '' {p : ℝ × Circle | p.1 = δ p.2} = subBd D ∧ + cMap '' {p : ℝ × Circle | 0 ≤ p.1 ∧ p.1 < δ p.2} = closure Λ \ closure D := by + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have hsubBd_eq : closure Λ \ Λ = subBd Λ := by + rw [subBd_eq_frontier, hΛ_open.frontier_eq] + obtain ⟨φ₀⟩ := hCD + let f₀ : ClosedUnitDisc → S := fun x => (φ₀ x).1 + have hf₀_cont : Continuous f₀ := continuous_subtype_val.comp φ₀.continuous + have hf₀_inj : Function.Injective f₀ := Subtype.val_injective.comp φ₀.injective + have hf₀_emb : IsClosedEmbedding f₀ := hf₀_cont.isClosedEmbedding hf₀_inj + have hf₀_range : range f₀ = closure Λ := by + ext y + exact ⟨by rintro ⟨x, rfl⟩; exact (φ₀ x).2, fun hy => ⟨φ₀.symm ⟨y, hy⟩, by simp [f₀]⟩⟩ + have hf₀_bd : f₀ '' {x : ClosedUnitDisc | x.1 ∈ UnitCircle} = subBd Λ := by + rw [← hdiscBd, disc_boundary (closure Λ) φ₀] + have hCD_split : ∀ x : ClosedUnitDisc, x.1 ∈ OpenUnitDisc ↔ x.1 ∉ UnitCircle := by + intro x + have hx_le : ‖x.1‖ ≤ 1 := by simpa [ClosedUnitDisc] using x.2 + simp only [OpenUnitDisc, UnitCircle, Metric.mem_ball, Metric.mem_sphere, dist_zero_right] + exact ⟨fun h => ne_of_lt h, fun h => lt_of_le_of_ne hx_le h⟩ + have hf₀_int : f₀ '' {x : ClosedUnitDisc | x.1 ∈ OpenUnitDisc} = Λ := by + exact closed_disc_coordinates_map_interior (S := S) (Λ := Λ) hsubBd_eq φ₀ f₀ rfl hf₀_inj + hf₀_range hf₀_bd hCD_split + have hgz_cl : ∀ z : Circle, (g z).1 ∈ closure Λ := fun z => by + have hmem : (g z).1 ∈ closure Λ \ Λ := by + rw [hsubBd_eq] + exact (g z).2 + exact hmem.1 + let α₀ : Circle → ClosedUnitDisc := fun z => + φ₀.symm ⟨(g z).1, hgz_cl z⟩ + let α : Circle → EuclideanPlane := fun z => (α₀ z).1 + have hf₀_α₀ : ∀ z : Circle, f₀ (α₀ z) = (g z).1 := fun z => by + simp [f₀, α₀] + have hα_cont : Continuous α := + continuous_subtype_val.comp (φ₀.symm.continuous.comp + (Continuous.subtype_mk (continuous_subtype_val.comp g.continuous) _)) + have hα_inj : Function.Injective α := by + intro z₁ z₂ h + have h₀ : α₀ z₁ = α₀ z₂ := Subtype.ext h + have hg : (g z₁).1 = (g z₂).1 := by rw [← hf₀_α₀, h₀, hf₀_α₀] + exact g.injective (Subtype.ext hg) + have hα_unit : ∀ z : Circle, α z ∈ UnitCircle := by + intro z + have hmem : f₀ (α₀ z) ∈ f₀ '' {x : ClosedUnitDisc | x.1 ∈ UnitCircle} := by + rw [hf₀_bd, hf₀_α₀] + exact (g z).2 + rcases hmem with ⟨x, hx, h_eq⟩ + have hxx : α z = x.1 := congrArg Subtype.val (hf₀_inj h_eq.symm) + exact hxx.symm ▸ hx + have hα_norm : ∀ z : Circle, ‖α z‖ = 1 := fun z => by + simpa [UnitCircle] using hα_unit z + have hα_range : range α = UnitCircle := by + exact boundary_coordinates_are_surjective (S := S) (Λ := Λ) g f₀ hf₀_inj hf₀_bd α₀ α rfl hf₀_α₀ + hα_unit + let S_pts : Set EuclideanPlane := α '' W_pts + have hS_cl : IsClosed S_pts := (hW_cl.isCompact.image hα_cont).isClosed + have hS_ne : S_pts.Nonempty := hW_ne.image α + have hS_sub : S_pts ⊆ UnitCircle := image_subset_iff.mpr fun z _ => hα_unit z + have hS_mem : ∀ z : Circle, α z ∈ S_pts ↔ z ∈ W_pts := fun z => hα_inj.mem_set_image + let δ : Circle → ℝ := fun z => 1 - pinchScale S_pts (α z) + have hδ_cont : Continuous δ := + continuous_const.sub ((continuous_pinchScale S_pts).comp hα_cont) + have hδ_bounds : ∀ z : Circle, 0 ≤ δ z ∧ δ z ≤ 1 / 4 := by + intro z + have hb := pinchScale_bounds S_pts (α z) + dsimp [δ] + constructor <;> linarith + have hδ_zero : ∀ z : Circle, δ z = 0 ↔ z ∈ W_pts := by + intro z + dsimp [δ] + rw [sub_eq_zero, eq_comm, pinchScale_eq_one_iff hS_cl hS_ne (α z), hS_mem z] + let U_E : Set EuclideanPlane := pinchHomeo S_pts '' OpenUnitDisc + let K_E : Set EuclideanPlane := pinchHomeo S_pts '' ClosedUnitDisc + let C_E : Set EuclideanPlane := pinchHomeo S_pts '' UnitCircle + let U_sub : Set ClosedUnitDisc := Subtype.val ⁻¹' U_E + let K_sub : Set ClosedUnitDisc := Subtype.val ⁻¹' K_E + let C_sub : Set ClosedUnitDisc := Subtype.val ⁻¹' C_E + let D : Set S := f₀ '' U_sub + have hU_E_sub_open : U_E ⊆ OpenUnitDisc := image_openUnitDisc_pinchHomeo_subset S_pts + have hK_E_sub_cl : K_E ⊆ ClosedUnitDisc := image_closedUnitDisc_pinchHomeo_subset S_pts + have hC_E_eq : K_E \ U_E = C_E := image_closedUnitDisc_sdiff_openUnitDisc_pinchHomeo S_pts + have hC_sub_eq : K_sub \ U_sub = C_sub := by + ext x + change x.1 ∈ K_E \ U_E ↔ x.1 ∈ C_E + rw [hC_E_eq] + have hU_sub_open : IsOpen U_sub := + ((pinchHomeo S_pts).isOpenMap _ Metric.isOpen_ball).preimage continuous_subtype_val + have hD_sub_Λ : D ⊆ Λ := by + rw [← hf₀_int] + refine image_mono ?_ + intro x hx + exact hU_E_sub_open hx + have hD_open : IsOpen D := by + exact pinched_disc_image_is_open (S := S) (Λ := Λ) hΛ_open φ₀ f₀ rfl U_sub D rfl hU_sub_open + hD_sub_Λ + have hcl_U_sub : closure U_sub = K_sub := by + exact closure_of_pinched_open_unit_disc S_pts U_E rfl U_sub rfl K_sub rfl hU_E_sub_open + have hcl_D : closure D = f₀ '' K_sub := by + rw [← hcl_U_sub] + apply subset_antisymm + · exact (hf₀_emb.isClosedMap _ isClosed_closure).closure_subset_iff.mpr + (image_mono subset_closure) + · exact image_closure_subset_closure_image hf₀_cont + have hsubBd_D_eq : subBd D = closure D \ D := by + rw [subBd_eq_frontier, hD_open.frontier_eq] + have hsubBd_D_f₀ : subBd D = f₀ '' C_sub := by + rw [hsubBd_D_eq, hcl_D, ← image_sdiff hf₀_inj, hC_sub_eq] + have hCD_D : IsClosedDisc (closure D) := by + exact pinched_closed_disc_image (S := S) f₀ hf₀_cont hf₀_inj S_pts K_E rfl K_sub rfl D + hK_E_sub_cl hcl_D + have hOArc_D : IsOArc (subBd D) := by + exact pinched_disc_boundary_is_closed_curve (S := S) f₀ hf₀_cont hf₀_inj α hα_cont hα_inj + hα_unit hα_range S_pts K_E rfl C_sub rfl D hK_E_sub_cl hsubBd_D_f₀ + have hsubBd_inter : subBd D ∩ subBd Λ = (fun z => (g z).1) '' W_pts := by + exact pinched_boundary_meets_original_at_marks (S := S) (Λ := Λ) g (W_pts := W_pts) f₀ hf₀_inj + hf₀_bd α₀ α rfl hf₀_α₀ S_pts rfl hS_cl hS_ne hS_sub C_sub rfl D hsubBd_D_f₀ + have hsubBd_sdiff_Λ : subBd D \ ((fun z => (g z).1) '' W_pts) ⊆ Λ := by + intro y hy + have hy_cl : y ∈ closure Λ := by + have hy_clD : y ∈ closure D := (hsubBd_D_eq ▸ hy.1).1 + rw [hcl_D] at hy_clD + rcases hy_clD with ⟨x, _, rfl⟩ + exact (φ₀ x).2 + have hy_not_bd : y ∉ subBd Λ := fun hy_bd => hy.2 (hsubBd_inter ▸ ⟨hy.1, hy_bd⟩) + by_contra hy_not_Λ + exact hy_not_bd (hsubBd_eq ▸ ⟨hy_cl, hy_not_Λ⟩) + have hsubBd_sdiff_cl : subBd D \ ((fun z => (g z).1) '' W_pts) ⊆ closure (Λ \ closure D) := by + exact pinched_boundary_off_marks_in_outer_closure (S := S) (Λ := Λ) g (W_pts := W_pts) f₀ + hf₀_cont hf₀_inj hf₀_int α₀ α rfl hf₀_α₀ S_pts rfl hS_cl hS_ne hS_sub K_E rfl K_sub rfl C_sub + rfl + D hcl_D hsubBd_D_f₀ + have hout_D : ∀ x ∈ closure D \ D, x ∈ closure (closure D)ᶜ := by + intro x hx + rw [← hsubBd_D_eq] at hx + by_cases hxW : x ∈ (fun z => (g z).1) '' W_pts + · have hx_bdΛ : x ∈ closure Λ \ Λ := by + rw [hsubBd_eq] + exact (hsubBd_inter ▸ hxW).2 + have hx_outΛ := hout x hx_bdΛ + refine closure_mono (compl_subset_compl.mpr ?_) hx_outΛ + exact closure_mono hD_sub_Λ + · refine closure_mono ?_ (hsubBd_sdiff_cl ⟨hx, hxW⟩) + intro y hy + exact hy.2 + have hcMap_mem : ∀ p : ℝ × Circle, max 0 (min 1 (1 - p.1)) • α p.2 ∈ ClosedUnitDisc := by + intro p + have hr0 : 0 ≤ max 0 (min 1 (1 - p.1)) := le_max_left 0 _ + have hr1 : max 0 (min 1 (1 - p.1)) ≤ 1 := max_le zero_le_one (min_le_left 1 _) + simp only [ClosedUnitDisc, Metric.mem_closedBall, dist_zero_right, norm_smul, + Real.norm_of_nonneg hr0, hα_norm p.2, mul_one] + exact hr1 + let cMap : ℝ × Circle → S := fun p => f₀ ⟨max 0 (min 1 (1 - p.1)) • α p.2, hcMap_mem p⟩ + have hcMap_cont : Continuous cMap := by + refine hf₀_cont.comp (Continuous.subtype_mk ?_ _) + have hcont_r : Continuous (fun p : ℝ × Circle => max (0 : ℝ) (min 1 (1 - p.1))) := + continuous_const.max (continuous_const.min (continuous_const.sub continuous_fst)) + exact hcont_r.smul (hα_cont.comp continuous_snd) + have hcMap_clamp : ∀ p : ℝ × Circle, 0 ≤ p.1 → p.1 ≤ δ p.2 → + max 0 (min 1 (1 - p.1)) = 1 - p.1 := by + intro p hp0 hpδ + have hδ_le : δ p.2 ≤ 1 / 4 := (hδ_bounds p.2).2 + have h1 : 1 - p.1 ≤ 1 := by linarith + have h0 : 0 ≤ 1 - p.1 := by linarith + rw [min_eq_right h1, max_eq_right h0] + have hcMap_inj : Set.InjOn cMap {p : ℝ × Circle | 0 ≤ p.1 ∧ p.1 ≤ δ p.2} := by + exact radial_collar_map_injective (S := S) f₀ hf₀_inj α hα_inj hα_norm δ hδ_bounds + hcMap_mem cMap rfl hcMap_clamp + have hcMap_zero : ∀ z : Circle, cMap (0, z) = (g z).1 := by + intro z + dsimp [cMap] + have hsub : (⟨max (0 : ℝ) (min 1 (1 - 0)) • α z, hcMap_mem (0, z)⟩ : ClosedUnitDisc) = α₀ z + := by + apply Subtype.ext + simp [α] + rw [hsub, hf₀_α₀] + have hcMap_collar : cMap '' {p : ℝ × Circle | 0 ≤ p.1 ∧ p.1 ≤ δ p.2} = closure Λ \ D := by + exact radial_collar_covers_disc_complement (S := S) (Λ := Λ) φ₀ f₀ rfl hf₀_inj hf₀_range α + hα_unit hα_norm hα_range S_pts δ rfl hδ_bounds U_E rfl U_sub rfl D rfl hcMap_mem cMap rfl + hcMap_clamp + have hcMap_bd : cMap '' {p : ℝ × Circle | p.1 = δ p.2} = subBd D := by + exact radial_collar_inner_edge_is_disc_boundary (S := S) f₀ α hα_unit hα_norm hα_range S_pts δ + rfl hδ_bounds C_sub rfl D hsubBd_D_f₀ hcMap_mem cMap rfl hcMap_clamp + have hcMap_open_collar : cMap '' {p : ℝ × Circle | 0 ≤ p.1 ∧ p.1 < δ p.2} = closure Λ \ closure D + := by + exact open_radial_collar_covers_closed_disc_complement (S := S) (Λ := Λ) φ₀ f₀ rfl hf₀_inj + hf₀_range α hα_unit hα_norm hα_range S_pts δ rfl hδ_bounds K_E rfl K_sub rfl D hcl_D + hcMap_mem cMap rfl hcMap_clamp + exact ⟨δ, D, cMap, hδ_cont, hδ_bounds, hδ_zero, hD_open, hD_sub_Λ, hCD_D, hsubBd_D_eq, + hOArc_D, hout_D, hsubBd_inter, hsubBd_sdiff_Λ, hsubBd_sdiff_cl, hcMap_cont, hcMap_inj, + hcMap_zero, hcMap_collar, hcMap_bd, hcMap_open_collar⟩ + +/-! ## Gluing a Compact Space along its Boundary -/ + +/-- The gluing relation on `X ⊕ ULift.{w} Y` identifying `b z ∈ X` with `z.1 ∈ B ⊆ Y`. -/ +def glueRel {X : Type w} {Y : Type} {B : Set Y} (b : ↥B → X) + (a a' : X ⊕ ULift.{w} Y) : Prop := + a = a' ∨ + (∃ z : ↥B, a = .inl (b z) ∧ a' = .inr (ULift.up z.1)) ∨ + (∃ z : ↥B, a = .inr (ULift.up z.1) ∧ a' = .inl (b z)) + +/-- The equivalence relation `glueRel b` when `b` is injective. -/ +def glueSetoid {X : Type w} {Y : Type} {B : Set Y} {b : ↥B → X} + (hb : Function.Injective b) : Setoid (X ⊕ ULift.{w} Y) where + r := glueRel b + iseqv := + { refl := fun _ => .inl rfl + symm := by + rintro a a' (rfl | ⟨z, rfl, rfl⟩ | ⟨z, rfl, rfl⟩) + · exact .inl rfl + · exact .inr (.inr ⟨z, rfl, rfl⟩) + · exact .inr (.inl ⟨z, rfl, rfl⟩) + trans := by + rintro a a' a'' (rfl | ⟨z, rfl, rfl⟩ | ⟨z, rfl, rfl⟩) h' + · exact h' + · obtain rfl | ⟨w, h1, rfl⟩ | ⟨w, h1, rfl⟩ := h' + · exact .inr (.inl ⟨z, rfl, rfl⟩) + · exact absurd h1 (by simp) + · have hzw : z = w := Subtype.ext (ULift.up.inj (Sum.inr.inj h1)) + subst hzw + exact .inl rfl + · obtain rfl | ⟨w, h1, rfl⟩ | ⟨w, h1, rfl⟩ := h' + · exact .inr (.inr ⟨z, rfl, rfl⟩) + · have hzw : z = w := hb (Sum.inl.inj h1) + subst hzw + exact .inl rfl + · exact absurd h1 (by simp) } + +/-- The quotient space obtained by gluing `X` and `Y` along `b : ↥B → X`. -/ +def GluedSpace {X : Type w} {Y : Type} + {B : Set Y} {b : ↥B → X} (hb : Function.Injective b) : Type w := + Quotient (glueSetoid hb) + +instance {X : Type w} [TopologicalSpace X] {Y : Type} [TopologicalSpace Y] + {B : Set Y} {b : ↥B → X} (hb : Function.Injective b) : + TopologicalSpace (GluedSpace hb) := + inferInstanceAs (TopologicalSpace (Quotient (glueSetoid hb))) + +/-- Left inclusion `X → GluedSpace hb`. -/ +def GluedSpace.inl {X : Type w} {Y : Type} + {B : Set Y} {b : ↥B → X} (hb : Function.Injective b) (x : X) : GluedSpace hb := + Quotient.mk (glueSetoid hb) (.inl x) + +/-- Right inclusion `Y → GluedSpace hb`. -/ +def GluedSpace.inr {X : Type w} {Y : Type} + {B : Set Y} {b : ↥B → X} (hb : Function.Injective b) (y : Y) : GluedSpace hb := + Quotient.mk (glueSetoid hb) (.inr (ULift.up y)) + +theorem GluedSpace.inl_injective {X : Type w} {Y : Type} + {B : Set Y} {b : ↥B → X} (hb : Function.Injective b) : + Function.Injective (GluedSpace.inl hb) := by + intro x x' h + obtain h1 | ⟨z, -, h1⟩ | ⟨z, h1, -⟩ := Quotient.exact h + · exact Sum.inl.inj h1 + · exact absurd h1 (by simp) + · exact absurd h1 (by simp) + +theorem GluedSpace.inr_injective {X : Type w} {Y : Type} + {B : Set Y} {b : ↥B → X} (hb : Function.Injective b) : + Function.Injective (GluedSpace.inr hb) := by + intro y y' h + obtain h1 | ⟨z, h1, -⟩ | ⟨z, -, h1⟩ := Quotient.exact h + · exact ULift.up.inj (Sum.inr.inj h1) + · exact absurd h1 (by simp) + · exact absurd h1 (by simp) + +theorem GluedSpace.inl_eq_inr {X : Type w} {Y : Type} + {B : Set Y} {b : ↥B → X} (hb : Function.Injective b) {x : X} {y : Y} : + GluedSpace.inl hb x = GluedSpace.inr hb y ↔ ∃ hy : y ∈ B, x = b ⟨y, hy⟩ := by + constructor + · intro h + obtain h1 | ⟨z, h1, h2⟩ | ⟨z, h1, -⟩ := Quotient.exact h + · exact absurd h1 (by simp) + · have hyz : y = z.1 := ULift.up.inj (Sum.inr.inj h2) + subst hyz + exact ⟨z.2, Sum.inl.inj h1⟩ + · exact absurd h1 (by simp) + · rintro ⟨hy, rfl⟩ + exact Quotient.sound (.inr (.inl ⟨⟨y, hy⟩, rfl, rfl⟩)) + +theorem GluedSpace.continuous_inl {X : Type w} [TopologicalSpace X] {Y : Type} [TopologicalSpace Y] + {B : Set Y} {b : ↥B → X} (hb : Function.Injective b) : + Continuous (GluedSpace.inl hb) := + continuous_quotient_mk'.comp _root_.continuous_inl + +theorem GluedSpace.continuous_inr {X : Type w} [TopologicalSpace X] {Y : Type} [TopologicalSpace Y] + {B : Set Y} {b : ↥B → X} (hb : Function.Injective b) : + Continuous (GluedSpace.inr hb) := + continuous_quotient_mk'.comp (_root_.continuous_inr.comp continuous_uliftUp) + +theorem GluedSpace.range_inl_union_range_inr {X : Type w} + {Y : Type} {B : Set Y} {b : ↥B → X} (hb : Function.Injective b) : + range (GluedSpace.inl hb) ∪ range (GluedSpace.inr hb) = univ := by + rw [eq_univ_iff_forall] + intro p + obtain ⟨x | y, rfl⟩ := Quotient.exists_rep p + · exact .inl ⟨x, rfl⟩ + · exact .inr ⟨y.down, rfl⟩ + +theorem GluedSpace.range_inl_inter_range_inr {X : Type w} + {Y : Type} {B : Set Y} {b : ↥B → X} (hb : Function.Injective b) : + range (GluedSpace.inl hb) ∩ range (GluedSpace.inr hb) = GluedSpace.inl hb '' range b := by + ext p + constructor + · rintro ⟨⟨x, rfl⟩, ⟨y, he⟩⟩ + obtain ⟨hy, rfl⟩ := (GluedSpace.inl_eq_inr hb).mp he.symm + exact ⟨b ⟨y, hy⟩, ⟨⟨y, hy⟩, rfl⟩, rfl⟩ + · rintro ⟨_, ⟨z, rfl⟩, rfl⟩ + exact ⟨⟨b z, rfl⟩, ⟨z.1, ((GluedSpace.inl_eq_inr hb).mpr ⟨z.2, rfl⟩).symm⟩⟩ + +theorem GluedSpace.range_inl_inter_range_inr_eq_inr {X : Type w} + {Y : Type} {B : Set Y} {b : ↥B → X} (hb : Function.Injective b) : + range (GluedSpace.inl hb) ∩ range (GluedSpace.inr hb) = GluedSpace.inr hb '' B := by + ext p + constructor + · rintro ⟨⟨x, rfl⟩, ⟨y, he⟩⟩ + obtain ⟨hy, rfl⟩ := (GluedSpace.inl_eq_inr hb).mp he.symm + exact ⟨y, hy, he⟩ + · rintro ⟨y, hy, rfl⟩ + exact ⟨⟨b ⟨y, hy⟩, (GluedSpace.inl_eq_inr hb).mpr ⟨hy, rfl⟩⟩, ⟨y, rfl⟩⟩ + +instance {X : Type w} [TopologicalSpace X] [CompactSpace X] + {Y : Type} [TopologicalSpace Y] [CompactSpace Y] + {B : Set Y} {b : ↥B → X} (hb : Function.Injective b) : + CompactSpace (GluedSpace hb) := + inferInstanceAs (CompactSpace (Quotient (glueSetoid hb))) + +theorem GluedSpace.t2Space {X : Type w} [TopologicalSpace X] [CompactSpace X] [T2Space X] + {Y : Type} [TopologicalSpace Y] [CompactSpace Y] [T2Space Y] + {B : Set Y} (hB : IsClosed B) {b : ↥B → X} + (hb_cont : Continuous b) (hb : Function.Injective b) : + T2Space (GluedSpace hb) := by + have : CompactSpace ↥B := isCompact_iff_compactSpace.mp hB.isCompact + refine t2Space_quotient_of_isClosed (glueSetoid hb) ?_ + let f : ↥B → (X ⊕ ULift.{w} Y) × (X ⊕ ULift.{w} Y) := + fun z => (.inl (b z), .inr (ULift.up z.1)) + have hf_cont : Continuous f := + (_root_.continuous_inl.comp hb_cont).prodMk + (_root_.continuous_inr.comp (continuous_uliftUp.comp continuous_subtype_val)) + have hG : IsCompact (range f) := isCompact_range hf_cont + have hG' : IsCompact (Prod.swap '' range f) := hG.image continuous_swap + have hrel : {p : (X ⊕ ULift.{w} Y) × (X ⊕ ULift.{w} Y) | (glueSetoid hb) p.1 p.2} = + diagonal _ ∪ (range f ∪ Prod.swap '' range f) := by + ext ⟨a, a'⟩ + constructor + · rintro (h | ⟨z, h1, h2⟩ | ⟨z, h1, h2⟩) + · exact .inl h + · exact .inr (.inl ⟨z, Prod.ext h1.symm h2.symm⟩) + · exact .inr (.inr ⟨f z, ⟨z, rfl⟩, Prod.ext h1.symm h2.symm⟩) + · rintro (h | ⟨z, he⟩ | ⟨_, ⟨z, rfl⟩, he⟩) + · exact .inl h + · simp only [f, Prod.mk.injEq] at he + exact .inr (.inl ⟨z, he.1.symm, he.2.symm⟩) + · simp only [f, Prod.swap_prod_mk, Prod.mk.injEq] at he + exact .inr (.inr ⟨z, he.1.symm, he.2.symm⟩) + rw [hrel] + exact isClosed_diagonal.union (hG.isClosed.union hG'.isClosed) + +theorem GluedSpace.connectedSpace {X : Type w} [TopologicalSpace X] [ConnectedSpace X] + {Y : Type} [TopologicalSpace Y] [ConnectedSpace Y] + {B : Set Y} (hB_ne : B.Nonempty) {b : ↥B → X} (hb : Function.Injective b) : + ConnectedSpace (GluedSpace hb) := by + rw [connectedSpace_iff_univ, ← GluedSpace.range_inl_union_range_inr hb] + refine (isConnected_range (GluedSpace.continuous_inl hb)).union ?_ + (isConnected_range (GluedSpace.continuous_inr hb)) + rw [GluedSpace.range_inl_inter_range_inr_eq_inr hb] + exact hB_ne.image (GluedSpace.inr hb) + +/-- Gluing `ClosedCylinder` onto `↥(univ \ (Λ₁ ∪ Λ₂))` along a homeomorphism `b` between their +boundaries yields a closed connected surface `GluedSpace hb` obtained by adding a handle to `S`. -/ +theorem isClosedSurface_of_handle_glue [ConnectedSpace S] (hS : IsClosedSurface S) + {Λ₁ Λ₂ : Set S} (hΛ₁ : IsOpenDisc Λ₁) (hΛ₂ : IsOpenDisc Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (hOArc₁ : IsOArc (subBd Λ₁)) (hOArc₂ : IsOArc (subBd Λ₂)) + (hout₁ : ∀ x ∈ closure Λ₁ \ Λ₁, x ∈ closure (closure Λ₁)ᶜ) + (hout₂ : ∀ x ∈ closure Λ₂ \ Λ₂, x ∈ closure (closure Λ₂)ᶜ) + {b : ↥(bd ↥ClosedCylinder) → ↥(univ \ (Λ₁ ∪ Λ₂) : Set S)} + (hb_cont : Continuous b) (hb_inj : Function.Injective b) + (hb_range : range b = bd ↥(univ \ (Λ₁ ∪ Λ₂) : Set S)) : + IsClosedSurface (GluedSpace hb_inj) ∧ + ConnectedSpace (GluedSpace hb_inj) ∧ + IsObtainedByAddingHandle S (GluedSpace hb_inj) ∧ + IsSurface ↥(range (GluedSpace.inl hb_inj)) ∧ + IsSurface ↥(range (GluedSpace.inr hb_inj)) ∧ + range (GluedSpace.inl hb_inj) ∪ range (GluedSpace.inr hb_inj) = univ ∧ + range (GluedSpace.inl hb_inj) ∩ range (GluedSpace.inr hb_inj) = + Subtype.val '' bd ↥(range (GluedSpace.inl hb_inj)) ∧ + range (GluedSpace.inl hb_inj) ∩ range (GluedSpace.inr hb_inj) = + Subtype.val '' bd ↥(range (GluedSpace.inr hb_inj)) := by + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have hS_surf : IsSurface S := IsClosedSurface.isSurface hS + have hbS : bd S = ∅ := eq_empty_iff_forall_notMem.mpr fun x hx => hx (hS.2.2 x) + obtain ⟨hX_surf, hX_conn, hX_bd⟩ := + compl_two_open_isSurface hS hΛ₁.1 hΛ₂.1 hOArc₁ hOArc₂ hout₁ hout₂ hd + have : CompactSpace ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) := hX_surf.1 + obtain ⟨m_cyl⟩ := nonempty_cyl_homeo + have hCyl_surf : IsSurface ↥ClosedCylinder := + isSurface_of_homeo m_cyl (isSurface_model 0 0 2).1 + have : CompactSpace ↥ClosedCylinder := hCyl_surf.1 + have : ConnectedSpace (SurfaceModel 0 0 2) := (isSurface_model 0 0 2).2 + have hCyl_conn : ConnectedSpace ↥ClosedCylinder := + m_cyl.surjective.connectedSpace m_cyl.continuous + have : T2Space (GluedSpace hb_inj) := GluedSpace.t2Space (isClosed_bd ↥ClosedCylinder) hb_cont + hb_inj + have hbd_cyl_ne : (bd ↥ClosedCylinder).Nonempty := by + rw [bd_cylinder] + exact .inl ⟨cylEnd 1 (by norm_num) 1, 1, rfl⟩ + have hconn' : ConnectedSpace (GluedSpace hb_inj) := + @GluedSpace.connectedSpace _ _ hX_conn _ _ hCyl_conn _ hbd_cyl_ne _ hb_inj + let S' := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let S₂ : Set S' := range (GluedSpace.inr hb_inj) + have hinl_emb : IsClosedEmbedding (GluedSpace.inl hb_inj) := + (GluedSpace.continuous_inl hb_inj).isClosedEmbedding (GluedSpace.inl_injective hb_inj) + have hinr_emb : IsClosedEmbedding (GluedSpace.inr hb_inj) := + (GluedSpace.continuous_inr hb_inj).isClosedEmbedding (GluedSpace.inr_injective hb_inj) + let e₁ : ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) ≃ₜ ↥S₁ := hinl_emb.isEmbedding.toHomeomorph + let e₂ : ↥ClosedCylinder ≃ₜ ↥S₂ := hinr_emb.isEmbedding.toHomeomorph + have hS₁ : IsSurface ↥S₁ := isSurface_of_homeo e₁ hX_surf + have hS₂ : IsSurface ↥S₂ := isSurface_of_homeo e₂ hCyl_surf + have hu : S₁ ∪ S₂ = univ := GluedSpace.range_inl_union_range_inr hb_inj + have h1 : S₁ ∩ S₂ = Subtype.val '' bd ↥S₁ := by + rw [← image_bd_homeomorph e₁, image_image] + change S₁ ∩ S₂ = GluedSpace.inl hb_inj '' bd ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) + rw [← hb_range, GluedSpace.range_inl_inter_range_inr hb_inj] + have h2 : S₁ ∩ S₂ = Subtype.val '' bd ↥S₂ := by + rw [← image_bd_homeomorph e₂, image_image] + exact GluedSpace.range_inl_inter_range_inr_eq_inr hb_inj + obtain ⟨a₀, b₀, c₀, ⟨e_S₀⟩⟩ := classification.{w} S hS_surf inferInstance + obtain ⟨_, f₀, hf₀⟩ := presents_ew a₀ b₀ c₀ + have hc₀ : c₀ = 0 := by + have h_cuffs : cuffs S = ∅ := by + unfold cuffs + rw [hbS] + ext C + simp [componentsIn] + rw [← ncard_cuffs hf₀, ← ncard_cuffs_congr e_S₀, h_cuffs, ncard_empty] + subst hc₀ + obtain ⟨a', b', ⟨e'⟩, _⟩ := + handle_model_of_surface_pieces hS_surf hbS hΛ₁ hΛ₂ hd hS₁ hS₂ hu h1 h2 e₁ e₂ e_S₀ + have hS'_surf : IsSurface S' := isSurface_of_homeo e'.symm (isSurface_model a' b' 0).1 + obtain ⟨_, f_m, hf_m⟩ := presents_ew a' b' 0 + have hcuffs_zero : (cuffs S').ncard = 0 := (ncard_cuffs_congr e').trans (ncard_cuffs hf_m) + have hcuffs_empty : cuffs S' = ∅ := (Set.ncard_eq_zero (cuff_statement.{w} S' hS'_surf).2.1).mp + hcuffs_zero + have hb' : bd S' = ∅ := eq_empty_iff_forall_notMem.mpr fun x hx => by + have hmem : connectedComponentIn (bd S') x ∈ cuffs S' := ⟨x, hx, rfl⟩ + rw [hcuffs_empty] at hmem + exact hmem + have hS'_closed : IsClosedSurface S' := + ⟨hS'_surf.1, hS'_surf.2.1, fun x => by by_contra hx; exact (hb' ▸ hx : x ∈ (∅ : Set S'))⟩ + refine ⟨hS'_closed, hconn', ?_, hS₁, hS₂, hu, h1, h2⟩ + exact ⟨hS_surf, hS'_surf, hb', Λ₁, Λ₂, S₁, S₂, hΛ₁, hΛ₂, hd, + by rw [hbS]; exact disjoint_empty _, by rw [hbS]; exact disjoint_empty _, + hu, h1, h2, ⟨e₁⟩, ⟨e₂⟩⟩ + +/-- Gluing `MobiusBand` onto `↥(univ \ Λ)` along a homeomorphism `b` between their boundaries +yields a closed connected surface `GluedSpace hb` obtained by adding a crosscap to `S`. -/ +theorem isClosedSurface_of_crosscap_glue [ConnectedSpace S] (hS : IsClosedSurface S) + {Λ : Set S} (hΛ : IsOpenDisc Λ) (hOArc : IsOArc (subBd Λ)) + (hout : ∀ x ∈ closure Λ \ Λ, x ∈ closure (closure Λ)ᶜ) + {b : ↥(bd MobiusBand) → ↥(univ \ Λ : Set S)} + (hb_cont : Continuous b) (hb_inj : Function.Injective b) + (hb_range : range b = bd ↥(univ \ Λ : Set S)) : + IsClosedSurface (GluedSpace hb_inj) ∧ + ConnectedSpace (GluedSpace hb_inj) ∧ + IsObtainedByAddingCrosscap S (GluedSpace hb_inj) ∧ + IsSurface ↥(range (GluedSpace.inl hb_inj)) ∧ + IsSurface ↥(range (GluedSpace.inr hb_inj)) ∧ + range (GluedSpace.inl hb_inj) ∪ range (GluedSpace.inr hb_inj) = univ ∧ + range (GluedSpace.inl hb_inj) ∩ range (GluedSpace.inr hb_inj) = + Subtype.val '' bd ↥(range (GluedSpace.inl hb_inj)) ∧ + range (GluedSpace.inl hb_inj) ∩ range (GluedSpace.inr hb_inj) = + Subtype.val '' bd ↥(range (GluedSpace.inr hb_inj)) := by + have : T2Space S := hS.2.1 + have : CompactSpace S := hS.1 + have hS_surf : IsSurface S := IsClosedSurface.isSurface hS + have hbS : bd S = ∅ := eq_empty_iff_forall_notMem.mpr fun x hx => hx (hS.2.2 x) + obtain ⟨hX_surf, hX_conn, hX_bd, hOArc_bd⟩ := + compl_open_isSurface hS hΛ.1 hOArc hout + have : CompactSpace ↥(univ \ Λ : Set S) := hX_surf.1 + obtain ⟨m_mob⟩ := nonempty_mob_homeo + have hMob_surf : IsSurface MobiusBand := + isSurface_of_homeo m_mob (isSurface_model 0 1 1).1 + have : CompactSpace MobiusBand := hMob_surf.1 + have : ConnectedSpace (SurfaceModel 0 1 1) := (isSurface_model 0 1 1).2 + have hMob_conn : ConnectedSpace MobiusBand := + m_mob.surjective.connectedSpace m_mob.continuous + have : T2Space (GluedSpace hb_inj) := GluedSpace.t2Space (isClosed_bd MobiusBand) hb_cont hb_inj + have hbd_mob_oarc : IsOArc (bd MobiusBand) := isOArc_bd_one m_mob + have hconn' : ConnectedSpace (GluedSpace hb_inj) := + @GluedSpace.connectedSpace _ _ hX_conn _ _ hMob_conn _ hbd_mob_oarc.isConnected'.1 _ hb_inj + let S' := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let S₂ : Set S' := range (GluedSpace.inr hb_inj) + have hinl_emb : IsClosedEmbedding (GluedSpace.inl hb_inj) := + (GluedSpace.continuous_inl hb_inj).isClosedEmbedding (GluedSpace.inl_injective hb_inj) + have hinr_emb : IsClosedEmbedding (GluedSpace.inr hb_inj) := + (GluedSpace.continuous_inr hb_inj).isClosedEmbedding (GluedSpace.inr_injective hb_inj) + let e₁ : ↥(univ \ Λ : Set S) ≃ₜ ↥S₁ := hinl_emb.isEmbedding.toHomeomorph + let e₂ : MobiusBand ≃ₜ ↥S₂ := hinr_emb.isEmbedding.toHomeomorph + have hS₁ : IsSurface ↥S₁ := isSurface_of_homeo e₁ hX_surf + have hS₂ : IsSurface ↥S₂ := isSurface_of_homeo e₂ hMob_surf + have hu : S₁ ∪ S₂ = univ := GluedSpace.range_inl_union_range_inr hb_inj + have h1 : S₁ ∩ S₂ = Subtype.val '' bd ↥S₁ := by + rw [← image_bd_homeomorph e₁, image_image] + change S₁ ∩ S₂ = GluedSpace.inl hb_inj '' bd ↥(univ \ Λ : Set S) + rw [← hb_range, GluedSpace.range_inl_inter_range_inr hb_inj] + have h2 : S₁ ∩ S₂ = Subtype.val '' bd ↥S₂ := by + rw [← image_bd_homeomorph e₂, image_image] + exact GluedSpace.range_inl_inter_range_inr_eq_inr hb_inj + have hOb₁ : IsOArc (bd ↥S₁) := by + rw [← image_bd_homeomorph e₁] + exact isOArc_image e₁.isEmbedding hOArc_bd + have hval₁ : IsClosedEmbedding (Subtype.val : ↥S₁ → S') := + (isCompact_iff_compactSpace.mpr hS₁.1).isClosed.isClosedEmbedding_subtypeVal + have hOF : IsOArc (Subtype.val '' bd ↥S₁) := isOArc_image hval₁.isEmbedding hOb₁ + obtain ⟨a₁, b₁, c₁, ⟨e₃⟩⟩ := classification.{w} ↥(univ \ Λ : Set S) hX_surf hX_conn + obtain ⟨_, f₁, hf₁⟩ := presents_ew a₁ b₁ c₁ + have hc₁ : c₁ = 1 := by + rw [← ncard_cuffs hf₁, ← ncard_cuffs_congr e₃, cuffs_eq_of_isConnected hOArc_bd.isConnected', + ncard_singleton] + subst hc₁ + have hran₁ : range (Subtype.val : ↥S₁ → S') ∪ S₂ = univ := by + rw [Subtype.range_coe] + exact hu + have hm₁ : range (Subtype.val : ↥S₁ → S') ∩ S₂ = Subtype.val '' bd ↥S₁ := by + rw [Subtype.range_coe] + exact h1 + have hBb : Subtype.val ⁻¹' (Subtype.val '' bd ↥S₁) ⊆ bd ↥S₂ := fun z hz => by + have h3 : z.1 ∈ Subtype.val '' bd ↥S₂ := by + rw [← h2, h1] + exact hz + obtain ⟨k, hk, he⟩ := h3 + exact Subtype.ext he ▸ hk + obtain ⟨-, -, ⟨e₅⟩⟩ := glue_model hS₁ (isCuff_of_oArc hOb₁) hS₂ inferInstance hval₁ + hran₁ hm₁ hOF hBb (e₁.symm.trans e₃) (m_mob.trans e₂).symm + have hS'_surf : IsSurface S' := isSurface_of_homeo e₅.symm (isSurface_model (0 + a₁) (1 + b₁) 0).1 + obtain ⟨_, f_m, hf_m⟩ := presents_ew (0 + a₁) (1 + b₁) 0 + have hcuffs_zero : (cuffs S').ncard = 0 := (ncard_cuffs_congr e₅).trans (ncard_cuffs hf_m) + have hcuffs_empty : cuffs S' = ∅ := (Set.ncard_eq_zero (cuff_statement.{w} S' hS'_surf).2.1).mp + hcuffs_zero + have hb' : bd S' = ∅ := eq_empty_iff_forall_notMem.mpr fun x hx => by + have hmem : connectedComponentIn (bd S') x ∈ cuffs S' := ⟨x, hx, rfl⟩ + rw [hcuffs_empty] at hmem + exact hmem + have hS'_closed : IsClosedSurface S' := + ⟨hS'_surf.1, hS'_surf.2.1, fun x => by by_contra hx; exact (hb' ▸ hx : x ∈ (∅ : Set S'))⟩ + refine ⟨hS'_closed, hconn', ?_, hS₁, hS₂, hu, h1, h2⟩ + exact ⟨hS_surf, hS'_surf, hb', Λ, S₁, S₂, hΛ, by rw [hbS]; exact disjoint_empty _, + hu, h1, h2, ⟨e₁⟩, ⟨e₂⟩⟩ + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/Section3Given.lean b/LeanPool/GraphMinor/GM15/Section3Given.lean new file mode 100644 index 0000000000..fa97ac7729 --- /dev/null +++ b/LeanPool/GraphMinor/GM15/Section3Given.lean @@ -0,0 +1,363 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.ChordMove +import LeanPool.GraphMinor.GM15.Section3SpanGlue + +/-! +# Graph Minors XV, (3.4), for a given drawing $H'$ + +(3.4), page 122, takes any drawing $H' = H \cup P_1 \cup \dots \cup P_{k-1}$ in $\Sigma$ with +$H' \cap (\Sigma - \Lambda) = H$. The proof on pages 122–123 is formalized in +`theorem_3_4_of_chart` (`GraphMinor/GM15/Section3Parallel.lean`), in a chart of $\bar\Lambda$ in +which the paths are vertical chords. Here we first show that the paths are lines across +$\bar\Lambda$, then move them onto the chords by a homeomorphism of the unit disc that fixes the +circle (`exists_ballHomeo_moving_chords`), and so get such a chart (`theorem_3_4_proof`). + +Section 7 applies (3.4) to paths of $G$, which must first be drawn in $\Lambda$. +`theorem_3_4_drawn` draws them along chords of a chart (`exists_glued_span_of_lines`) and applies +`theorem_3_4_proof`. +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +open Set Function Topology Metric +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM12 GM14 + +universe u v w + +/-- A chart of $\bar\Lambda$ that puts $v_1, \dots, v_{2k}$ at the angles `parallelModelAngle k`. -/ +theorem exists_chart_3_4 {S : Type w} [TopologicalSpace S] {Λ : Set S} {k : ℕ} + (hk1 : 1 ≤ k) {v : Fin (2 * k) → S} (hCD : IsClosedDisc (closure Λ)) + (hdiscBd : discBd (closure Λ) = subBd Λ) + (hOrder_v : GM12.IsListedInOrderOn (subBd Λ) (List.ofFn v)) : + ∃ p_circ : Circle ≃ₜ ↥(subBd Λ), + (∀ i : Fin (2 * k), (p_circ (Circle.exp (parallelModelAngle k i.1))).1 = v i) ∧ + ∃ (h : S → ℂ) (g : ℂ → S), IsChart (closure Λ) h g ∧ ∀ w : Circle, g w = (p_circ w).1 := by + obtain ⟨f_v, t_v, ht_v_mono, ht_v_bd, ht_v_val⟩ := hOrder_v + obtain ⟨h_circ, hh_circ⟩ := + exists_circle_homeo_matching_angles (2 * k) (by omega) + (parallelModelAngle k) t_v + (strictMono_parallelModelAngle hk1) ht_v_mono + (parallelModelAngle_lt_add_two_pi hk1) + (fun i hi => ht_v_bd i (by simp [hi])) + let p_circ : Circle ≃ₜ ↥(subBd Λ) := h_circ.trans f_v + have hp_circ_v : ∀ i : Fin (2 * k), + (p_circ (Circle.exp (parallelModelAngle k i.1))).1 = v i := by + intro i + change (f_v (h_circ (Circle.exp (parallelModelAngle k i.1)))).1 = v i + rw [hh_circ i.1 i.2] + exact (ht_v_val i.1 (by simp [i.2])).trans (by simp) + let p_discBd : Circle ≃ₜ ↥(discBd (closure Λ)) := + p_circ.trans (Homeomorph.setCongr hdiscBd.symm) + obtain ⟨h, g, c, hg_discBd⟩ := exists_isChart_with_bd hCD p_discBd + exact ⟨p_circ, hp_circ_v, h, g, c, hg_discBd⟩ + +/-- The image of a line under a continuous map that is injective on it is a line. -/ +theorem isLineWithEnds_image {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] [T2Space T] + {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) {φ : S → T} (hc : ContinuousOn φ L) + (hi : InjOn φ L) : IsLineWithEnds (φ '' L) (φ a) (φ b) := + hL.image_under_injOn hc hi + +/-- Replacing the chart `g` by `g ∘ Φ` for a homeomorphism `Φ` of the unit disc that fixes the +circle gives a chart that agrees with `g` on the circle. -/ +theorem isChart_comp_ballHomeo {S : Type w} [TopologicalSpace S] {D : Set S} {h : S → ℂ} + {g : ℂ → S} (c : IsChart D h g) {Φ Φ' : ℂ → ℂ} (hΦ : IsBallHomeo Φ Φ') : + IsChart D (Φ' ∘ h) (g ∘ Φ) where + hc := hΦ.cont'.comp c.hc c.hm + gc := c.gc.comp hΦ.cont hΦ.maps + hm := hΦ.maps'.comp c.hm + gm := c.gm.comp hΦ.maps + gh := fun x hx => by + simp only [Function.comp_apply] + rw [hΦ.right (c.hm hx), c.gh hx] + hg := fun z hz => by + simp only [Function.comp_apply] + rw [c.hg (hΦ.maps hz), hΦ.left hz] + bd := by + rw [image_comp, c.bd] + conv_rhs => rw [← image_id (sphere (0 : ℂ) 1)] + exact image_congr fun z hz => hΦ.fix' hz + +/-- **Graph Minors XV, (3.4)** (pages 122–123), for a given drawing $H'$, with the distance +monotonicity and boundary-order conclusions of `GM15Theorem34Statement`. -/ +theorem theorem_3_4_proof : GM15Theorem34Statement.{u, v, w} := by + classical + intro S _ _ α β G H η θ_star θ k T_star T d Λ v H' η' P i_k i_last + hSpan hd hΛ hOArc _hCirc_Λ hk hNodup_v hOrder_v hv_mem hFree_v hvm_H hem_H hInter hH'_V + hH'_E hP_path hP_HU hP_disj hik hilast + have hS : IsClosedSurface S := + ⟨hSpan.isSurface.1, hSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hSpan.isConnected + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hResp_H : IsRespectfulDrawingTangle H θ T := hSpan.isRespectful + have hinj : Injective v := List.nodup_ofFn.mp hNodup_v + have h2k_le : 2 * k ≤ θ := by + have hcard := hFree_v.2.1 + rwa [Set.ncard_range_of_injective hinj, Nat.card_eq_fintype_card, Fintype.card_fin] at hcard + have hθ : 3 ≤ θ := by omega + have hk1 : 1 ≤ k := by omega + have hΛ_open : IsOpen Λ := GM11.region_isOpen hΛ + obtain ⟨-, hCD, hdiscBd, _, _⟩ := + isClosedDisc_closure_of_region_tangle hS hResp_H hθ hΛ hOArc + have hsubBd_eq_sdiff : subBd Λ = closure Λ \ Λ := by + rw [subBd_eq_frontier, hΛ_open.frontier_eq] + obtain ⟨_, hU_bdΛ, _⟩ := interSet_subBd_isCircuit_and_U_eq hS hΛ hOArc + have hsubBd_sub_HU : subBd Λ ⊆ H.U := by + have hcl : IsClosed (subBd Λ) := isClosed_closure.inter isClosed_closure + rw [← hU_bdΛ, (H.interSet (subBd Λ)).U_eq, + interSet_V_of_isClosed H hcl, interSet_E] + exact union_subset (inter_subset_left.trans H.V_subset_U) + (iUnion₂_subset fun e he => H.closure_subset_U he.1) + obtain ⟨p_circ, hp_circ_v, h, g, c, hg_circ⟩ := exists_chart_3_4 hk1 hCD hdiscBd hOrder_v + let a : Fin (k - 1) → S := fun j => v ⟨j.1, by omega⟩ + let b : Fin (k - 1) → S := fun j => v ⟨2 * k - 2 - j.1, by omega⟩ + have hK : IsClosed (univ \ Λ) := isClosed_univ.sdiff hΛ_open + -- `H` and each `P j` are subdrawings of `H'`. + have hP_sub : ∀ j, (P j).IsSubdrawing H' := fun j => by + refine ⟨?_, ?_⟩ + · rw [hH'_V] + exact (subset_iUnion (fun j => (P j).V) j).trans subset_union_right + · rw [hH'_E] + exact (subset_iUnion (fun j => (P j).E) j).trans subset_union_right + have hSub_H : H.IsSubdrawing H' := ⟨hH'_V ▸ subset_union_left, hH'_E ▸ subset_union_left⟩ + -- Each `P j` is a line from `a j` to `b j`. + have hab : ∀ j : Fin (k - 1), a j ≠ b j := fun j hj => by + have := congrArg Fin.val (hinj hj) + simp only at this + omega + have hL_line : ∀ j, IsLineWithEnds (P j).U (a j) (b j) := fun j => + GM11.isLine_of_isPathBetween (hP_path j) (hab j) + have hab_V : ∀ j, a j ∈ (P j).V ∧ b j ∈ (P j).V := fun j => by + obtain ⟨W, -, hV, -⟩ := hP_path j + rw [hV] + exact ⟨W.start_mem_support, W.end_mem_support⟩ + -- Each `P j` meets `Σ - Λ` only in its ends: an edge of `P j` misses `H`, so it misses + -- `bd(Λ)`; it is not in `Σ - Λ`, since `H' ∩ (Σ - Λ) = H`; so it lies in `Λ`. + have hL_compl : ∀ j, (P j).U ∩ (univ \ Λ) = {a j, b j} := fun j => by + have hends : ({a j, b j} : Set S) ⊆ (P j).V := by + rintro _ (rfl | rfl) + · exact (hab_V j).1 + · exact (hab_V j).2 + refine Subset.antisymm (fun x ⟨hxU, hxK⟩ => ?_) ?_ + · by_cases hxV : x ∈ (P j).V + · have hxH : x ∈ H.V := by + rw [← hInter, interSet_V_of_isClosed H' hK] + exact ⟨(hP_sub j).1 hxV, hxK⟩ + rw [← hP_HU j] + exact ⟨hxU, H.V_subset_U hxH⟩ + · exfalso + obtain ⟨e, he, hxe⟩ := (P j).exists_edge_of_mem hxU hxV + have heU : e ⊆ (P j).U := fun y hy => (he.2.1 hy).1 + have heV : ∀ y ∈ e, y ∉ (P j).V := fun y hy => (he.2.1 hy).2 + have heH : ∀ y ∈ e, y ∉ H.U := fun y hy hyH => by + have : y ∈ (P j).U ∩ H.U := ⟨heU hy, hyH⟩ + rw [hP_HU j] at this + exact heV y hy (hends this) + have hsplit : e ⊆ Λ ∪ (closure Λ)ᶜ := fun y hy => by + by_cases hyΛ : y ∈ Λ + · exact Or.inl hyΛ + · refine Or.inr fun hycl => heH y hy (hsubBd_sub_HU ?_) + rw [hsubBd_eq_sdiff] + exact ⟨hycl, hyΛ⟩ + rcases he.2.2.1.isConnected.isPreconnected.subset_or_subset hΛ_open + isClosed_closure.isOpen_compl + (disjoint_compl_right.mono_right (compl_subset_compl.mpr subset_closure)) hsplit with + hΛe | hce + · exact hxK.2 (hΛe hxe) + · have heK : e ⊆ univ \ Λ := fun y hy => + ⟨mem_univ y, fun hyΛ => hce hy (subset_closure hyΛ)⟩ + have heHE : e ∈ H.E := by + rw [← hInter, interSet_E] + exact ⟨(hP_sub j).2 he, heK⟩ + exact heH x hxe (H.closure_subset_U heHE (subset_closure hxe)) + · rintro _ (rfl | rfl) + · refine ⟨(P j).V_subset_U (hab_V j).1, mem_univ _, fun hΛa => ?_⟩ + have := (hv_mem ⟨j.1, by omega⟩).2 + rw [hsubBd_eq_sdiff] at this + exact this.2 hΛa + · refine ⟨(P j).V_subset_U (hab_V j).2, mem_univ _, fun hΛb => ?_⟩ + have := (hv_mem ⟨2 * k - 2 - j.1, by omega⟩).2 + rw [hsubBd_eq_sdiff] at this + exact this.2 hΛb + have hab_subBd : ∀ j, a j ∈ subBd Λ ∧ b j ∈ subBd Λ := fun j => + ⟨(hv_mem ⟨j.1, by omega⟩).2, (hv_mem ⟨2 * k - 2 - j.1, by omega⟩).2⟩ + have hL_cl : ∀ j, (P j).U ⊆ closure Λ := fun j x hx => by + by_cases hxΛ : x ∈ Λ + · exact subset_closure hxΛ + · have : x ∈ (P j).U ∩ (univ \ Λ) := ⟨hx, mem_univ x, hxΛ⟩ + rw [hL_compl j] at this + rcases this with rfl | rfl + · exact (hab_subBd j).1.1 + · exact (hab_subBd j).2.1 + have hL_bd : ∀ j, (P j).U ∩ discBd (closure Λ) = {a j, b j} := fun j => by + rw [← hL_compl j, hdiscBd, hsubBd_eq_sdiff] + ext x + exact ⟨fun ⟨hx, _, hxΛ⟩ => ⟨hx, mem_univ x, hxΛ⟩, + fun ⟨hx, _, hxΛ⟩ => ⟨hx, hL_cl j hx, hxΛ⟩⟩ + -- The lines in the chart. + have hg_a : ∀ j : Fin (k - 1), g ⟨parallelX k j, parallelY k j⟩ = a j := fun j => by + rw [← circle_exp_parallelModelAngle_top j, hg_circ, hp_circ_v ⟨j.1, by omega⟩] + have hg_b : ∀ j : Fin (k - 1), g ⟨parallelX k j, -parallelY k j⟩ = b j := fun j => by + rw [← circle_exp_parallelModelAngle_bot j, hg_circ, hp_circ_v ⟨2 * k - 2 - j.1, by omega⟩] + have hsph : ∀ j : Fin (k - 1), (⟨parallelX k j, parallelY k j⟩ : ℂ) ∈ closedBall (0 : ℂ) 1 ∧ + (⟨parallelX k j, -parallelY k j⟩ : ℂ) ∈ closedBall (0 : ℂ) 1 := fun j => by + have := parallelX_sq_add_parallelY_sq j + constructor <;> rw [mem_closedBall_unit_iff] <;> simp only <;> nlinarith + have hh_a : ∀ j, h (a j) = ⟨parallelX k j, parallelY k j⟩ := fun j => by + rw [← hg_a j, c.hg (hsph j).1] + have hh_b : ∀ j, h (b j) = ⟨parallelX k j, -parallelY k j⟩ := fun j => by + rw [← hg_b j, c.hg (hsph j).2] + let M : Fin (k - 1) → Set ℂ := fun j => h '' (P j).U + have hinjh : InjOn h (closure Λ) := c.gh.injOn + have hMB : ∀ j, M j ⊆ closedBall (0 : ℂ) 1 := fun j => c.image_subset (hL_cl j) + have hM : ∀ j, IsLineWithEnds (M j) ⟨parallelX k j, parallelY k j⟩ + ⟨parallelX k j, -parallelY k j⟩ := fun j => by + rw [← hh_a j, ← hh_b j] + exact isLineWithEnds_image (hL_line j) (c.hc.mono (hL_cl j)) (hinjh.mono (hL_cl j)) + have hMs : ∀ j, M j ∩ sphere (0 : ℂ) 1 = + {⟨parallelX k j, parallelY k j⟩, ⟨parallelX k j, -parallelY k j⟩} := fun j => by + rw [← c.bd, ← hinjh.image_inter (hL_cl j) (Surface.discBd_subset _), hL_bd j, image_pair, + hh_a j, + hh_b j] + have hMdisj : Pairwise fun i j => Disjoint (M i) (M j) := fun i j hij => + disjoint_left.mpr fun _ ⟨x, hx, hxz⟩ ⟨y, hy, hyz⟩ => + disjoint_left.mp (hP_disj hij) hx + (hinjh (hL_cl j hy) (hL_cl i hx) (hyz.trans hxz.symm) ▸ hy) + obtain ⟨Φ, Φ', hΦ, hΦM⟩ := exists_ballHomeo_moving_chords (strictAnti_parallelX hk1) + parallelX_sq_add_parallelY_sq parallelY_pos hMB hM hMs hMdisj + -- The new chart `g ∘ Φ`, in which `P j` is the chord at `parallelX k j`. + have c' := isChart_comp_ballHomeo c hΦ + have hg'_circ : ∀ w : Circle, (g ∘ Φ) w = (p_circ w).1 := fun w => by + simp only [Function.comp_apply] + rw [hΦ.fix w (by simp), hg_circ] + have hchord : ∀ j : Fin (k - 1), (g ∘ Φ) '' vertChord (parallelX k j) = (P j).U := fun j => by + rw [image_comp, hΦM j, image_image] + conv_rhs => rw [← image_id (P j).U] + exact image_congr fun x hx => c.gh (hL_cl j hx) + have hH'_U : H'.U = H.U ∪ ⋃ j : Fin (k - 1), (g ∘ Φ) '' vertChord (parallelX k j) := by + simp_rw [hchord] + apply Subset.antisymm + · intro x hx + by_cases hxV : x ∈ H'.V + · rw [hH'_V] at hxV + rcases hxV with hx | hx + · exact Or.inl (H.V_subset_U hx) + · obtain ⟨j, hj⟩ := mem_iUnion.mp hx + exact Or.inr (mem_iUnion.mpr ⟨j, (P j).V_subset_U hj⟩) + · obtain ⟨e, he, hxe⟩ := H'.exists_edge_of_mem hx hxV + rw [hH'_E] at he + rcases he with he | he + · exact Or.inl (H.closure_subset_U he (subset_closure hxe)) + · obtain ⟨j, hj⟩ := mem_iUnion.mp he + exact Or.inr (mem_iUnion.mpr ⟨j, (P j).closure_subset_U hj (subset_closure hxe)⟩) + · exact union_subset (isSubdrawing_U_subset hSub_H) + (iUnion_subset fun j => isSubdrawing_U_subset (hP_sub j)) + have hP' : ∀ j : Fin (k - 1), (P j).U = (g ∘ Φ) '' vertChord (parallelX k j) ∧ + (P j).IsPathBetween (v ⟨j.1, by omega⟩) (v ⟨2 * k - 2 - j.1, by omega⟩) ∧ + (P j).IsSubdrawing H' ∧ v ⟨j.1, by omega⟩ ∈ (P j).V ∧ + v ⟨2 * k - 2 - j.1, by omega⟩ ∈ (P j).V := fun j => + ⟨(hchord j).symm, hP_path j, hP_sub j, (hab_V j).1, (hab_V j).2⟩ + obtain ⟨T', d', r₁, r₂, h₁, h₂, h₃, h₄, h₅, h₆, -, h₈, h₉, h₁₀, h₁₁, h₁₂, h₁₃, h₁₄, h₁₅, h₁₆, + h₁₇, h₁₈, h₁₉, h₂₀⟩ := + theorem_3_4_of_chart G H η θ_star θ k T_star T d Λ v i_k i_last hSpan hd hΛ hOArc hk + hNodup_v hv_mem hFree_v hik hilast p_circ hp_circ_v c' hg'_circ H' η' P hH'_U hH'_V hH'_E + hSub_H hP' hP_disj hvm_H hem_H + exact ⟨T', d', r₁, r₂, h₁, h₂, h₃, h₄, h₅, h₆, h₈, h₉, h₁₀, h₁₁, h₁₂, h₁₃, h₁₄, h₁₅, h₁₆, h₁₇, + h₁₈, h₁₉, h₂₀⟩ + +/-- Graph Minors XV, (3.4), with auxiliary conclusions, applied to paths of `G`. The paths are +drawn along chords of a chart of $\bar\Lambda$, and `theorem_3_4_proof` applies to the drawing. -/ +theorem theorem_3_4_drawn : GM15Theorem34DrawnStatement.{u, v, w} := by + classical + intro S _ _ α β G H η θ_star θ k T_star T d Λ v P i_k i_last + hSpan hd hΛ hOArc hCirc_Λ hk hNodup_v hOrder_v hv_mem hFree_v + hP_ex hP_disj hik hilast + have hS : IsClosedSurface S := + ⟨hSpan.isSurface.1, hSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hSpan.isConnected + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hResp_H : IsRespectfulDrawingTangle H θ T := hSpan.isRespectful + have h2k_le : 2 * k ≤ θ := by + have hinj : Injective v := List.nodup_ofFn.mp hNodup_v + have hcard := hFree_v.2.1 + rwa [Set.ncard_range_of_injective hinj, Nat.card_eq_fintype_card, Fintype.card_fin] at hcard + have hθ : 3 ≤ θ := by omega + have hk1 : 1 ≤ k := by omega + have hΛ_open : IsOpen Λ := GM11.region_isOpen hΛ + obtain ⟨-, hCD, hdiscBd, _, _⟩ := + isClosedDisc_closure_of_region_tangle hS hResp_H hθ hΛ hOArc + obtain ⟨_, hU_bdΛ, _⟩ := interSet_subBd_isCircuit_and_U_eq hS hΛ hOArc + have hsubBd_sub_HU : subBd Λ ⊆ H.U := by + have hcl : IsClosed (subBd Λ) := isClosed_closure.inter isClosed_closure + rw [← hU_bdΛ, (H.interSet (subBd Λ)).U_eq, + interSet_V_of_isClosed H hcl, interSet_E] + exact union_subset (inter_subset_left.trans H.V_subset_U) + (iUnion₂_subset fun e he => H.closure_subset_U he.1) + have hHU_compl : H.U ⊆ univ \ Λ := + fun x hxU => ⟨mem_univ x, fun hxΛ => GM11.region_subset hΛ hxΛ hxU⟩ + obtain ⟨p_circ, hp_circ_v, h, g, c, hg_circ⟩ := exists_chart_3_4 hk1 hCD hdiscBd hOrder_v + let a : Fin (k - 1) → S := fun j => v ⟨j.1, by omega⟩ + let b : Fin (k - 1) → S := fun j => v ⟨2 * k - 2 - j.1, by omega⟩ + have hg_a : ∀ j : Fin (k - 1), g ⟨parallelX k j, parallelY k j⟩ = a j := + fun j => (parallelChart_endpoints hg_circ hp_circ_v j).1 + have hg_b : ∀ j : Fin (k - 1), g ⟨parallelX k j, -parallelY k j⟩ = b j := + fun j => (parallelChart_endpoints hg_circ hp_circ_v j).2 + -- The paths are drawn along the vertical chords `L j` of the chart. + let L : Fin (k - 1) → Set S := fun j => g '' vertChord (parallelX k j) + have hcl_inter_compl : closure Λ ∩ (univ \ Λ) = subBd Λ := by + rw [subBd_eq_frontier, hΛ_open.frontier_eq] + ext x + simp only [mem_inter_iff, mem_sdiff, mem_univ, true_and] + have hL_props := fun j : Fin (k - 1) => + parallelChart_chord_data c hdiscBd hcl_inter_compl hHU_compl hsubBd_sub_HU j (hg_a j) (hg_b j) + have hL_line : ∀ j : Fin (k - 1), IsLineWithEnds (L j) (a j) (b j) := + fun j => (hL_props j).1 + have hL_inter_compl : ∀ j : Fin (k - 1), L j ∩ (univ \ Λ) = {a j, b j} := + fun j => (hL_props j).2.2.2.1 + have hL_inter_HU : ∀ j : Fin (k - 1), L j ∩ H.U = {a j, b j} := + fun j => (hL_props j).2.2.2.2 + have hL_disj : Pairwise (fun j₁ j₂ => Disjoint (L j₁) (L j₂)) := by + intro j₁ j₂ hj + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨z₁, hz₁, rfl⟩ ⟨z₂, hz₂, h_eq⟩ + exact Set.disjoint_left.mp + (vertChord_disjoint ((strictAnti_parallelX hk1).injective.ne hj)) + hz₁ (c.injOn hz₁.1 hz₂.1 h_eq.symm ▸ hz₂) + have ha_mem : ∀ j : Fin (k - 1), a j ∈ H.V ∩ subBd Λ := fun j => hv_mem ⟨j.1, by omega⟩ + have hb_mem : ∀ j : Fin (k - 1), b j ∈ H.V ∩ subBd Λ := fun j => hv_mem ⟨2 * k - 2 - j.1, by + omega⟩ + have ha_V : ∀ j : Fin (k - 1), a j ∈ H.V := fun j => (ha_mem j).1 + have hb_V : ∀ j : Fin (k - 1), b j ∈ H.V := fun j => (hb_mem j).1 + have hP_ab : ∀ j : Fin (k - 1), + IsHPathWithEnds G η.imageGraph (P j) (η.vMap (a j)) (η.vMap (b j)) := by + intro j + obtain ⟨i₁, i₂, hi₁, hi₂, hPj⟩ := hP_ex j + have hi₁_eq : i₁ = ⟨j.1, by omega⟩ := Fin.ext hi₁ + have hi₂_eq : i₂ = ⟨2 * k - 2 - j.1, by omega⟩ := Fin.ext hi₂ + rwa [hi₁_eq, hi₂_eq] at hPj + obtain ⟨P', H', η', hH'_U, hH'_V, hH'_E, hSub_H, hP', hP'_disj, hImG, hvm_H, hem_H, _, _⟩ := + exists_glued_span_of_lines H η a b P L ha_V hb_V hP_ab hP_disj hL_line hL_disj hL_inter_HU + obtain ⟨-, -, hInter_compl⟩ := + glued_interSet_base_eq (isClosed_univ.sdiff hΛ_open) ha_V hb_V hHU_compl + hL_inter_compl hH'_U hH'_V hH'_E hP' + obtain ⟨T', d', r₁, r₂, h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈, h₉, h₁₀, h₁₁, h₁₂, h₁₃, h₁₄, h₁₅, h₁₆, + h₁₇, h₁₈, h₁₉⟩ := + theorem_3_4_proof G H η θ_star θ k T_star T d Λ v H' η' P' i_k i_last hSpan hd hΛ hOArc + hCirc_Λ hk hNodup_v hOrder_v hv_mem hFree_v hvm_H hem_H hInter_compl hH'_V hH'_E + (fun j => (hP' j).2.1) (fun j => (hP' j).1 ▸ hL_inter_HU j) hP'_disj hik hilast + exact ⟨H', η', T', d', r₁, r₂, h₁, h₂, h₃, h₄, h₅, h₆, hInter_compl, h₇, hSub_H, hvm_H, hem_H, + hImG, h₈, h₉, h₁₀, h₁₁, h₁₂, h₁₃, h₁₄, h₁₅, h₁₆, h₁₇, h₁₈, h₁₉⟩ + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/Section3Handle.lean b/LeanPool/GraphMinor/GM15/Section3Handle.lean new file mode 100644 index 0000000000..53291104b9 --- /dev/null +++ b/LeanPool/GraphMinor/GM15/Section3Handle.lean @@ -0,0 +1,4739 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.ControllingTangle + +import LeanPool.GraphMinor.GM12.Section79 + +public import LeanPool.GraphMinor.GM15.Section3Disc +public import LeanPool.GraphMinor.GM15.Section3SpanGlue +public import LeanPool.GraphMinor.Surface.Cap +public import LeanPool.GraphMinor.Surface.EdgeLens +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.GM11.ForestRegions + +import LeanPool.GraphMinor.GM12.Section5Final + +/-! +# Proof of Graph Minors XV, (3.5): Adding a Handle + +This file proves `(3.5)` (`theorem_3_5` : `GM15Theorem35Statement`) of N. Robertson and P. D. +Seymour, +*Graph Minors. XV. Giant steps*, J. Combin. Theory Ser. B 68 (1996) 112–148 (pages 123–124): +- Section 1 constructs striped closed discs inside `ClosedCylinder` obtained by removing a narrow + open sector around one missed radial segment `Icc 1 2 ×ˢ {w i₀}`. +- Section 2 constructs the unpinched and pinched handle splits on the glued closed surface + `S' = GluedSpace hb_inj` obtained by gluing `ClosedCylinder` onto `univ \ (Λ₁ ∪ Λ₂)`. +- Section 3 combines `exists_glued_span_of_lines`, Graph Minors XII (5.1) + (`GM12Theorem51Statement`), + and Graph Minors XV (3.2) (`theorem_3_2`) with Claim (1) (`theorem_3_5_claim_1`) to prove + `theorem_3_5`. +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +open Set Function Topology +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM14 + +universe u v w + +/-! ## 1. Striped Closed Discs in `ClosedCylinder` -/ + +/-- Clamp a real number into `Icc 1 2`. -/ +def cylClamp (r : ℝ) : ℝ := max 1 (min 2 r) + +theorem continuous_cylClamp : Continuous cylClamp := + continuous_const.max (continuous_const.min continuous_id) + +theorem cylClamp_mem (r : ℝ) : cylClamp r ∈ Icc (1 : ℝ) 2 := + ⟨le_max_left 1 (min 2 r), max_le (by norm_num) (min_le_left 2 r)⟩ + +theorem cylClamp_of_mem {r : ℝ} (hr : r ∈ Icc (1 : ℝ) 2) : cylClamp r = r := by + dsimp [cylClamp] + rw [min_eq_right hr.2, max_eq_right hr.1] + +/-- Map from `ℂ` into `ClosedCylinder` sending `x + iy` to `(cylClamp x, Circle.exp y)`. -/ +noncomputable def cylRectMap (z : ℂ) : ClosedCylinder := + ⟨(cylClamp z.re, Circle.exp z.im), cylClamp_mem z.re, mem_univ _⟩ + +theorem continuous_cylRectMap : Continuous cylRectMap := by + unfold cylRectMap + refine Continuous.subtype_mk ?_ _ + exact (continuous_cylClamp.comp Complex.continuous_re).prodMk + (Circle.exp.continuous.comp Complex.continuous_im) + +/-- `Circle.exp` is injective on any open interval of length `2π`. -/ +theorem circle_exp_injOn_Ioo (θ₀ : ℝ) : + InjOn Circle.exp (Ioo θ₀ (θ₀ + 2 * Real.pi)) := by + intro x hx y hy hxy + let c : ℝ := θ₀ + Real.pi + have hx' : x - c ∈ Ioo (-Real.pi) Real.pi := by + dsimp [c] + exact ⟨by linarith [hx.1], by linarith [hx.2]⟩ + have hy' : y - c ∈ Ioo (-Real.pi) Real.pi := by + dsimp [c] + exact ⟨by linarith [hy.1], by linarith [hy.2]⟩ + have hshift : Circle.exp (x - c) = Circle.exp (y - c) := by + rw [sub_eq_add_neg, sub_eq_add_neg, Circle.exp_add, Circle.exp_add, hxy] + have hcis : cis' (x - c) = cis' (y - c) := congrArg Subtype.val hshift + have hsub := cis'_injOn hx' hy' hcis + linarith + +/-- `Circle.exp` maps `[θ₀, θ₀ + 2π]` onto `Circle`. -/ +theorem circle_exp_surjOn_Icc (θ₀ : ℝ) : + Circle.exp '' Icc θ₀ (θ₀ + 2 * Real.pi) = univ := by + rw [eq_univ_iff_forall] + intro w + obtain ⟨t, rfl⟩ := ee_surjective w + have hpi : (0 : ℝ) < 2 * Real.pi := by positivity + let u₀ : ℝ := θ₀ / (2 * Real.pi) + let u : ℝ := u₀ + Int.fract (t - u₀) + have hu_eq : ee u = ee t := by + apply ee_eq_iff.mpr + refine ⟨-⌊t - u₀⌋, ?_⟩ + dsimp [u] + have h := Int.self_sub_floor (t - u₀) + push_cast + linarith + refine ⟨2 * Real.pi * u, ⟨?_, ?_⟩, ?_⟩ + · have h1 : 0 ≤ Int.fract (t - u₀) := Int.fract_nonneg (t - u₀) + have h2 : 2 * Real.pi * u₀ = θ₀ := mul_div_cancel₀ θ₀ hpi.ne' + nlinarith + · have h1 : Int.fract (t - u₀) ≤ 1 := (Int.fract_lt_one (t - u₀)).le + have h2 : 2 * Real.pi * u₀ = θ₀ := mul_div_cancel₀ θ₀ hpi.ne' + nlinarith + · exact hu_eq + +theorem injOn_cylRectMap (θ₀ ε : ℝ) (hε : 0 < ε) : + InjOn cylRectMap (Icc 1 2 ×ℂ Icc (θ₀ + ε) (θ₀ + 2 * Real.pi - ε)) := by + intro z₁ hz₁ z₂ hz₂ h + obtain ⟨hz₁_re, hz₁_im⟩ := Complex.mem_reProdIm.mp hz₁ + obtain ⟨hz₂_re, hz₂_im⟩ := Complex.mem_reProdIm.mp hz₂ + have h1 := Prod.ext_iff.mp (congrArg Subtype.val h) + have hre : z₁.re = z₂.re := by + have hclamp : cylClamp z₁.re = cylClamp z₂.re := h1.1 + rwa [cylClamp_of_mem hz₁_re, cylClamp_of_mem hz₂_re] at hclamp + have him : z₁.im = z₂.im := by + refine circle_exp_injOn_Ioo θ₀ ⟨by linarith [hz₁_im.1], by linarith [hz₁_im.2]⟩ + ⟨by linarith [hz₂_im.1], by linarith [hz₂_im.2]⟩ h1.2 + exact Complex.ext hre him + +theorem isClosedDisc_image_cylRectMap (θ₀ ε : ℝ) (hε0 : 0 < ε) (hεpi : ε < Real.pi) : + IsClosedDisc (cylRectMap '' (Icc 1 2 ×ℂ Icc (θ₀ + ε) (θ₀ + 2 * Real.pi - ε))) ∧ + discBd (cylRectMap '' (Icc 1 2 ×ℂ Icc (θ₀ + ε) (θ₀ + 2 * Real.pi - ε))) = + cylRectMap '' frontier (Icc 1 2 ×ℂ Icc (θ₀ + ε) (θ₀ + 2 * Real.pi - ε)) := by + have h12 : (1 : ℝ) < 2 := by norm_num + have hcd : θ₀ + ε < θ₀ + 2 * Real.pi - ε := by linarith + obtain ⟨hD_rect, hbd_rect⟩ := isClosedDisc_rect h12 hcd + obtain ⟨hD_img, hbd_img⟩ := hD_rect.image_injOn + continuous_cylRectMap.continuousOn (injOn_cylRectMap θ₀ ε hε0) + exact ⟨hD_img, hbd_img.trans (congrArg (cylRectMap '' ·) hbd_rect)⟩ + +theorem reProdIm_mem_frontier_of_re_eq {a b c d : ℝ} {z : ℂ} + (hz : z ∈ Icc a b ×ℂ Icc c d) (hre : z.re = a ∨ z.re = b) : + z ∈ frontier (Icc a b ×ℂ Icc c d) := by + have hcl : IsClosed (Icc a b ×ℂ Icc c d) := + (isCompact_Icc.reProdIm isCompact_Icc).isClosed + rw [hcl.frontier_eq] + refine ⟨hz, fun hint => ?_⟩ + obtain ⟨r, hr_pos, hball⟩ := Metric.mem_nhds_iff.mp (mem_interior_iff_mem_nhds.mp hint) + rcases hre with hre_a | hre_b + · let z' : ℂ := z - (r / 2 : ℝ) + have hz'_ball : z' ∈ Metric.ball z r := by + rw [Metric.mem_ball, dist_eq_norm] + have hsub : z' - z = -(r / 2 : ℝ) := by dsimp [z']; ring + rw [hsub, norm_neg, Complex.norm_real, Real.norm_of_nonneg (by positivity)] + linarith + have hz'_re : a ≤ z'.re := (Complex.mem_reProdIm.mp (hball hz'_ball)).1.1 + have hcalc : z'.re = a - r / 2 := by + simp [z', hre_a] + linarith + · let z' : ℂ := z + (r / 2 : ℝ) + have hz'_ball : z' ∈ Metric.ball z r := by + rw [Metric.mem_ball, dist_eq_norm] + have hsub : z' - z = (r / 2 : ℝ) := by dsimp [z']; ring + rw [hsub, Complex.norm_real, Real.norm_of_nonneg (by positivity)] + linarith + have hz'_re : z'.re ≤ b := (Complex.mem_reProdIm.mp (hball hz'_ball)).1.2 + have hcalc : z'.re = b + r / 2 := by + simp [z', hre_b] + linarith + +theorem re_eq_of_mem_frontier_reProdIm {a b c d : ℝ} {z : ℂ} + (hz : z ∈ frontier (Icc a b ×ℂ Icc c d)) (him : z.im ∈ Ioo c d) : + z.re = a ∨ z.re = b := by + have hcl : IsClosed (Icc a b ×ℂ Icc c d) := + (isCompact_Icc.reProdIm isCompact_Icc).isClosed + rw [hcl.frontier_eq] at hz + obtain ⟨hz_mem, hz_not_int⟩ := hz + obtain ⟨hz_re, _⟩ := Complex.mem_reProdIm.mp hz_mem + have hopen : IsOpen (Ioo a b ×ℂ Ioo c d) := + (isOpen_Ioo.preimage Complex.continuous_re).inter (isOpen_Ioo.preimage Complex.continuous_im) + have hsub : Ioo a b ×ℂ Ioo c d ⊆ interior (Icc a b ×ℂ Icc c d) := + interior_maximal + (fun w hw => Complex.mem_reProdIm.mpr + ⟨Ioo_subset_Icc_self (Complex.mem_reProdIm.mp hw).1, + Ioo_subset_Icc_self (Complex.mem_reProdIm.mp hw).2⟩) + hopen + have hnot_re : z.re ∉ Ioo a b := fun hre_in => + hz_not_int (hsub (Complex.mem_reProdIm.mpr ⟨hre_in, him⟩)) + rcases eq_or_lt_of_le hz_re.1 with h1 | h1 + · exact Or.inl h1.symm + · rcases eq_or_lt_of_le hz_re.2 with h2 | h2 + · exact Or.inr h2 + · exact (hnot_re ⟨h1, h2⟩).elim + +/-- Given `θ₀ : ℝ` and a closed set `K_all ⊆ ClosedCylinder` disjoint from the radial segment +`{p : ClosedCylinder | p.1.2 = Circle.exp θ₀}`, there is a closed disc `D_cyl ⊆ ClosedCylinder` +containing `K_all` such that `D_cyl ∩ bd ↥ClosedCylinder ⊆ discBd D_cyl` and every radial segment +`{p : ClosedCylinder | p.1.2 = w_j} ⊆ K_all` meets `discBd D_cyl` only at its two endpoints. -/ +theorem exists_striped_disc_in_closedCylinder (θ₀ : ℝ) {K_all : Set ClosedCylinder} + (hK_cl : IsClosed K_all) + (hK_disj : Disjoint K_all {p : ClosedCylinder | p.1.2 = Circle.exp θ₀}) : + ∃ D_cyl : Set ClosedCylinder, + IsClosedDisc D_cyl ∧ + K_all ⊆ D_cyl ∧ + Disjoint D_cyl {p : ClosedCylinder | p.1.2 = Circle.exp θ₀} ∧ + D_cyl ∩ bd ↥ClosedCylinder ⊆ discBd D_cyl ∧ + ∀ w_j : Circle, {p : ClosedCylinder | p.1.2 = w_j} ⊆ K_all → + {p : ClosedCylinder | p.1.2 = w_j} ⊆ D_cyl ∧ + {p : ClosedCylinder | p.1.2 = w_j} ∩ discBd D_cyl = + {cylEnd 1 (by norm_num) w_j, cylEnd 2 (by norm_num) w_j} := by + let Q : Set ℂ := Icc 1 2 ×ℂ Icc θ₀ (θ₀ + 2 * Real.pi) + have hQ_comp : IsCompact Q := isCompact_Icc.reProdIm isCompact_Icc + let K' : Set ℂ := Q ∩ cylRectMap ⁻¹' K_all + have hK'_comp : IsCompact K' := + hQ_comp.of_isClosed_subset (hQ_comp.isClosed.inter (hK_cl.preimage continuous_cylRectMap)) + inter_subset_left + let d : ℂ → ℝ := fun z => min (z.im - θ₀) (θ₀ + 2 * Real.pi - z.im) + have hd_cont : Continuous d := + (Complex.continuous_im.sub continuous_const).min (continuous_const.sub Complex.continuous_im) + have hd_pos : ∀ z ∈ K', 0 < d z := by + intro z ⟨hzQ, hzK⟩ + obtain ⟨_, hz_im⟩ := Complex.mem_reProdIm.mp hzQ + have hnot_exp : Circle.exp z.im ≠ Circle.exp θ₀ := fun heq => + Set.disjoint_left.mp hK_disj hzK heq + have hne1 : z.im ≠ θ₀ := fun h => hnot_exp (congrArg Circle.exp h) + have hne2 : z.im ≠ θ₀ + 2 * Real.pi := fun h => by + apply hnot_exp + rw [h, Circle.exp_add, Circle.exp_two_pi, mul_one] + have hlt1 : θ₀ < z.im := lt_of_le_of_ne hz_im.1 hne1.symm + have hlt2 : z.im < θ₀ + 2 * Real.pi := lt_of_le_of_ne hz_im.2 hne2 + exact lt_min (by linarith) (by linarith) + have hex_ε : ∃ ε : ℝ, 0 < ε ∧ ε < Real.pi / 2 ∧ ∀ z ∈ K', ε < d z := by + by_cases hne : K'.Nonempty + · obtain ⟨z₀, hz₀, hmin⟩ := hK'_comp.exists_isMinOn hne hd_cont.continuousOn + have hd₀ : 0 < d z₀ := hd_pos z₀ hz₀ + refine ⟨min (d z₀ / 2) (Real.pi / 4), lt_min (by linarith) (by positivity), + lt_of_le_of_lt (min_le_right _ _) (by linarith [Real.pi_pos]), fun z hz => ?_⟩ + have hle : d z₀ ≤ d z := hmin hz + have hlt : min (d z₀ / 2) (Real.pi / 4) ≤ d z₀ / 2 := min_le_left _ _ + linarith + · rw [not_nonempty_iff_eq_empty] at hne + refine ⟨Real.pi / 4, by positivity, by linarith [Real.pi_pos], ?_⟩ + intro z hz + rw [hne] at hz + exact hz.elim + obtain ⟨ε, hε0, hε_pi2, hε_lt⟩ := hex_ε + have hε_pi : ε < Real.pi := by linarith [Real.pi_pos] + let R_ε : Set ℂ := Icc 1 2 ×ℂ Icc (θ₀ + ε) (θ₀ + 2 * Real.pi - ε) + let U_ε : Set ℂ := Icc 1 2 ×ℂ Ioo (θ₀ + ε) (θ₀ + 2 * Real.pi - ε) + let D_cyl : Set ClosedCylinder := cylRectMap '' R_ε + obtain ⟨hD_disc, hD_bd⟩ := isClosedDisc_image_cylRectMap θ₀ ε hε0 hε_pi + have hK_sub_U : K_all ⊆ cylRectMap '' U_ε := by + intro p hp + have hsurj := circle_exp_surjOn_Icc θ₀ + obtain ⟨t, ht, h_exp⟩ : p.1.2 ∈ Circle.exp '' Icc θ₀ (θ₀ + 2 * Real.pi) := + hsurj ▸ mem_univ p.1.2 + let z : ℂ := ⟨p.1.1, t⟩ + have hzQ : z ∈ Q := Complex.mem_reProdIm.mpr ⟨p.2.1, ht⟩ + have hmap : cylRectMap z = p := by + apply Subtype.ext + apply Prod.ext + · dsimp [cylRectMap, z] + exact cylClamp_of_mem p.2.1 + · exact h_exp + have hzK' : z ∈ K' := ⟨hzQ, by change cylRectMap z ∈ K_all; rwa [hmap]⟩ + have hd_z : ε < d z := hε_lt z hzK' + have ht_Ioo : t ∈ Ioo (θ₀ + ε) (θ₀ + 2 * Real.pi - ε) := by + obtain ⟨h1, h2⟩ := lt_min_iff.mp hd_z + exact ⟨by dsimp [z] at h1; linarith, by dsimp [z] at h2; linarith⟩ + exact ⟨z, Complex.mem_reProdIm.mpr ⟨p.2.1, ht_Ioo⟩, hmap⟩ + have hU_sub_R : U_ε ⊆ R_ε := fun z hz => + Complex.mem_reProdIm.mpr + ⟨(Complex.mem_reProdIm.mp hz).1, Ioo_subset_Icc_self (Complex.mem_reProdIm.mp hz).2⟩ + have hK_sub_D : K_all ⊆ D_cyl := hK_sub_U.trans (image_mono hU_sub_R) + have hbd_sub : D_cyl ∩ bd ↥ClosedCylinder ⊆ discBd D_cyl := by + rw [hD_bd, bd_cylinder] + rintro _ ⟨⟨z, hzR, rfl⟩, hbd⟩ + obtain ⟨hz_re, _⟩ := Complex.mem_reProdIm.mp hzR + have hre_12 : z.re = 1 ∨ z.re = 2 := by + rcases hbd with ⟨w, hw⟩ | ⟨w, hw⟩ + · left + have h1 : (cylEnd 1 (by norm_num) w).1.1 = (cylRectMap z).1.1 := + congrArg (fun q : ClosedCylinder => q.1.1) hw + dsimp [cylEnd, cylRectMap] at h1 + rw [cylClamp_of_mem hz_re] at h1 + exact h1.symm + · right + have h2 : (cylEnd 2 (by norm_num) w).1.1 = (cylRectMap z).1.1 := + congrArg (fun q : ClosedCylinder => q.1.1) hw + dsimp [cylEnd, cylRectMap] at h2 + rw [cylClamp_of_mem hz_re] at h2 + exact h2.symm + exact ⟨z, reProdIm_mem_frontier_of_re_eq hzR hre_12, rfl⟩ + have hD_disj : Disjoint D_cyl {p : ClosedCylinder | p.1.2 = Circle.exp θ₀} := by + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨z, hzR, rfl⟩ heq + obtain ⟨_, hz_im⟩ := Complex.mem_reProdIm.mp hzR + have h_exp : Circle.exp z.im = Circle.exp θ₀ := heq + by_cases h_le : z.im ≤ θ₀ + Real.pi + · have h1 : z.im ∈ Ioo (θ₀ - Real.pi / 2) (θ₀ - Real.pi / 2 + 2 * Real.pi) := + ⟨by linarith [hz_im.1, hε0, Real.pi_pos], by linarith [h_le, Real.pi_pos]⟩ + have h2 : θ₀ ∈ Ioo (θ₀ - Real.pi / 2) (θ₀ - Real.pi / 2 + 2 * Real.pi) := + ⟨by linarith [Real.pi_pos], by linarith [Real.pi_pos]⟩ + have heq_im := circle_exp_injOn_Ioo (θ₀ - Real.pi / 2) h1 h2 h_exp + linarith [hz_im.1, hε0] + · have h1 : z.im ∈ Ioo (θ₀ + Real.pi / 2) (θ₀ + Real.pi / 2 + 2 * Real.pi) := + ⟨by linarith [h_le, Real.pi_pos], by linarith [hz_im.2, hε0, Real.pi_pos]⟩ + have h2 : θ₀ + 2 * Real.pi ∈ Ioo (θ₀ + Real.pi / 2) (θ₀ + Real.pi / 2 + 2 * Real.pi) := + ⟨by linarith [Real.pi_pos], by linarith [Real.pi_pos]⟩ + have h_exp2 : Circle.exp z.im = Circle.exp (θ₀ + 2 * Real.pi) := by + rw [Circle.exp_add, Circle.exp_two_pi, mul_one, h_exp] + have heq_im := circle_exp_injOn_Ioo (θ₀ + Real.pi / 2) h1 h2 h_exp2 + linarith [hz_im.2, hε0] + refine ⟨D_cyl, hD_disc, hK_sub_D, hD_disj, hbd_sub, fun w_j hw_j => ?_⟩ + have hw_sub_D : {p : ClosedCylinder | p.1.2 = w_j} ⊆ D_cyl := hw_j.trans hK_sub_D + refine ⟨hw_sub_D, Subset.antisymm ?_ ?_⟩ + · rintro p ⟨hp_w, hp_bd⟩ + obtain ⟨z₁, hz₁U, h₁⟩ := hK_sub_U (hw_j hp_w) + rw [hD_bd] at hp_bd + obtain ⟨z₂, hz₂_fr, h₂⟩ := hp_bd + have hz₂R : z₂ ∈ R_ε := + ((isCompact_Icc.reProdIm isCompact_Icc).isClosed.frontier_eq ▸ hz₂_fr).1 + have hz_eq : z₁ = z₂ := + injOn_cylRectMap θ₀ ε hε0 (hU_sub_R hz₁U) hz₂R (h₁.trans h₂.symm) + subst hz_eq + obtain ⟨hz₁_re, hz₁_im⟩ := Complex.mem_reProdIm.mp hz₁U + have hre : z₁.re = 1 ∨ z₁.re = 2 := re_eq_of_mem_frontier_reProdIm hz₂_fr hz₁_im + have hp_re : p.1.1 = z₁.re := by + have h := congrArg (fun q : ClosedCylinder => q.1.1) h₁.symm + dsimp [cylRectMap] at h + rwa [cylClamp_of_mem hz₁_re] at h + rcases hre with hre1 | hre2 + · left + exact Subtype.ext (Prod.ext (hp_re.trans hre1) hp_w) + · right + exact Subtype.ext (Prod.ext (hp_re.trans hre2) hp_w) + · rintro p (rfl | rfl) + · refine ⟨rfl, hbd_sub ⟨hw_sub_D rfl, ?_⟩⟩ + rw [bd_cylinder] + exact Or.inl ⟨w_j, rfl⟩ + · refine ⟨rfl, hbd_sub ⟨hw_sub_D rfl, ?_⟩⟩ + rw [bd_cylinder] + exact Or.inr ⟨w_j, rfl⟩ + +/-! ## 2. Unpinched and Pinched Handle Splits -/ + +theorem isOpenDisc_of_isClosedDisc_closure {S : Type w} [TopologicalSpace S] + (hS : IsClosedSurface S) + {D : Set S} (hD_open : IsOpen D) (hCD : IsClosedDisc (closure D)) + (hout : ∀ x ∈ closure D \ D, x ∈ closure (closure D)ᶜ) : + IsOpenDisc D := by + have hDiff : closure D \ subBd (closure D) = D := by + ext x + constructor + · rintro ⟨hx_cl, hx_not_bd⟩ + by_contra hxD + exact hx_not_bd ⟨subset_closure hx_cl, compl_eq_univ_sdiff (closure D) ▸ hout x ⟨hx_cl, hxD⟩⟩ + · intro hxD + refine ⟨subset_closure hxD, fun ⟨_, hx_out⟩ => ?_⟩ + obtain ⟨w, hwD, hwc⟩ := mem_closure_iff.mp hx_out D hD_open hxD + exact hwc.2 (subset_closure hwD) + exact hDiff ▸ (GM14.IsClosedDisc.isOpenDisc_diff_subBd hS hCD).1 + +/-- Forward map of `pinchCylHomeo`. -/ +def pinchCylMap (δ₁ δ₂ : Circle → ℝ) + (hδ₁_bd : ∀ z, 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (hδ₂_bd : ∀ z, 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) + (p : ClosedCylinder) : + ↥{q : ClosedCylinder | 1 + δ₁ q.1.2 ≤ q.1.1 ∧ q.1.1 ≤ 2 - δ₂ q.1.2} := + have hr := p.2.1 + have h1 := hδ₁_bd p.1.2 + have h2 := hδ₂_bd p.1.2 + ⟨⟨((1 + δ₁ p.1.2) + (p.1.1 - 1) * (1 - δ₁ p.1.2 - δ₂ p.1.2), p.1.2), + ⟨⟨by nlinarith [hr.1, hr.2, h1.1, h1.2, h2.1, h2.2], + by nlinarith [hr.1, hr.2, h1.1, h1.2, h2.1, h2.2]⟩, mem_univ _⟩⟩, + ⟨by dsimp; nlinarith [hr.1, hr.2, h1.1, h1.2, h2.1, h2.2], + by dsimp; nlinarith [hr.1, hr.2, h1.1, h1.2, h2.1, h2.2]⟩⟩ + +/-- Homeomorphism between `ClosedCylinder` and the pinched cylinder +`{p : ClosedCylinder | 1 + δ₁ p.1.2 ≤ p.1.1 ∧ p.1.1 ≤ 2 - δ₂ p.1.2}`. -/ +noncomputable def pinchCylHomeo {δ₁ δ₂ : Circle → ℝ} + (hδ₁_cont : Continuous δ₁) (hδ₂_cont : Continuous δ₂) + (hδ₁_bd : ∀ z, 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (hδ₂_bd : ∀ z, 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) : + ClosedCylinder ≃ₜ ↥{p : ClosedCylinder | 1 + δ₁ p.1.2 ≤ p.1.1 ∧ p.1.1 ≤ 2 - δ₂ p.1.2} := by + have : CompactSpace ClosedCylinder := + isCompact_iff_compactSpace.mp (isCompact_Icc.prod isCompact_univ) + let f := pinchCylMap δ₁ δ₂ hδ₁_bd hδ₂_bd + have hf_cont : Continuous f := by + unfold f pinchCylMap + refine Continuous.subtype_mk (Continuous.subtype_mk ?_ _) _ + fun_prop + have hf_bij : Function.Bijective f := by + refine ⟨?_, ?_⟩ + · intro p q hpq + have h1 := Prod.ext_iff.mp (congrArg Subtype.val (congrArg Subtype.val hpq)) + have hz : p.1.2 = q.1.2 := h1.2 + have hpos : 0 < 1 - δ₁ p.1.2 - δ₂ p.1.2 := by + linarith [(hδ₁_bd p.1.2).2, (hδ₂_bd p.1.2).2] + have hr_eq : (1 + δ₁ p.1.2) + (p.1.1 - 1) * (1 - δ₁ p.1.2 - δ₂ p.1.2) = + (1 + δ₁ p.1.2) + (q.1.1 - 1) * (1 - δ₁ p.1.2 - δ₂ p.1.2) := by + have h1_fst := h1.1 + dsimp [f, pinchCylMap] at h1_fst + rw [← hz] at h1_fst + exact h1_fst + have hr : p.1.1 = q.1.1 := by nlinarith + exact Subtype.ext (Prod.ext hr hz) + · rintro ⟨q, hq1, hq2⟩ + obtain ⟨h10, h14⟩ := hδ₁_bd q.1.2 + obtain ⟨h20, h24⟩ := hδ₂_bd q.1.2 + have hpos : 0 < 1 - δ₁ q.1.2 - δ₂ q.1.2 := by linarith + let r : ℝ := 1 + (q.1.1 - (1 + δ₁ q.1.2)) / (1 - δ₁ q.1.2 - δ₂ q.1.2) + have hr_mem : r ∈ Icc (1 : ℝ) 2 := by + dsimp [r] + constructor + · have : 0 ≤ (q.1.1 - (1 + δ₁ q.1.2)) / (1 - δ₁ q.1.2 - δ₂ q.1.2) := + div_nonneg (by linarith) hpos.le + linarith + · have : (q.1.1 - (1 + δ₁ q.1.2)) / (1 - δ₁ q.1.2 - δ₂ q.1.2) ≤ 1 := + (div_le_one hpos).mpr (by linarith) + linarith + refine ⟨⟨(r, q.1.2), hr_mem, mem_univ _⟩, ?_⟩ + apply Subtype.ext + apply Subtype.ext + apply Prod.ext + · dsimp [f, pinchCylMap, r] + rw [add_sub_cancel_left, div_mul_cancel₀ _ hpos.ne'] + ring + · rfl + exact Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective f hf_bij) hf_cont + +@[simp] +theorem pinchCylHomeo_apply {δ₁ δ₂ : Circle → ℝ} + (hδ₁_cont : Continuous δ₁) (hδ₂_cont : Continuous δ₂) + (hδ₁_bd : ∀ z, 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (hδ₂_bd : ∀ z, 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) (p : ClosedCylinder) : + pinchCylHomeo hδ₁_cont hδ₂_cont hδ₁_bd hδ₂_bd p = + pinchCylMap δ₁ δ₂ hδ₁_bd hδ₂_bd p := rfl + +theorem pinchCylHomeo_cylEnd_one {δ₁ δ₂ : Circle → ℝ} + (hδ₁_cont : Continuous δ₁) (hδ₂_cont : Continuous δ₂) + (hδ₁_bd : ∀ z, 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (hδ₂_bd : ∀ z, 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) (z : Circle) : + ((pinchCylHomeo hδ₁_cont hδ₂_cont hδ₁_bd hδ₂_bd (cylEnd 1 (by norm_num) z)).1 : + ClosedCylinder).1 = + (1 + δ₁ z, z) := by + rw [pinchCylHomeo_apply] + ext <;> simp [pinchCylMap, cylEnd] + +theorem pinchCylHomeo_cylEnd_two {δ₁ δ₂ : Circle → ℝ} + (hδ₁_cont : Continuous δ₁) (hδ₂_cont : Continuous δ₂) + (hδ₁_bd : ∀ z, 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (hδ₂_bd : ∀ z, 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) (z : Circle) : + ((pinchCylHomeo hδ₁_cont hδ₂_cont hδ₁_bd hδ₂_bd (cylEnd 2 (by norm_num) z)).1 : + ClosedCylinder).1 = + (2 - δ₂ z, z) := by + rw [pinchCylHomeo_apply] + ext + · dsimp [pinchCylMap, cylEnd] + ring + · rfl + +/-- If the closure of a region `r ∈ H.R` meets `subBd Λ` (where `Λ ∈ H.R` has `IsOArc (subBd Λ)`), +then `closure r` meets `H.V ∩ subBd Λ`. -/ +theorem closure_region_inter_V_subBd_nonempty_of_inter_subBd_nonempty + {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {H : Drawing S} {r Λ : Set S} + (hr : r ∈ H.R) (hΛ : Λ ∈ H.R) (hOArc : IsOArc (subBd Λ)) + (hne : (closure r ∩ subBd Λ).Nonempty) : + (closure r ∩ (H.V ∩ subBd Λ)).Nonempty := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hC, hU, hV⟩ := interSet_subBd_isCircuit_and_U_eq hS hΛ hOArc + obtain ⟨z, hzr, hz_bd⟩ := hne + by_cases hzV : z ∈ H.V + · exact ⟨z, hzr, hzV, hz_bd⟩ + · have hz_not_V : z ∉ (H.interSet (subBd Λ)).V := fun h => hzV (hV ▸ h).1 + obtain ⟨e, he, hze⟩ := (H.interSet (subBd Λ)).exists_edge_of_mem (hU.symm ▸ hz_bd) hz_not_V + have he_pair : e ∈ H.E ∧ e ⊆ subBd Λ := by + have h := he + rwa [interSet_E H (subBd Λ)] at h + have he_cl_r : e ⊆ closure r := + GM11.edge_subset_closure_of_incident hS he_pair.1 hr ⟨z, hze, hzr⟩ + have hcl_e_sub : closure e ⊆ closure r := isClosed_closure.closure_subset_iff.mpr he_cl_r + obtain ⟨u, W, _, _, hCV, hCE⟩ := hC + have he_W : e ∈ W.edges := by + have h := he + rwa [hCE] at h + have hex_end : ∀ {a b : S} (W' : GraphWalk (H.interSet (subBd Λ)).toGraph a b), + e ∈ W'.edges → ∃ w ∈ W'.support, w ∈ closure e := by + intro a b W' hmem + induction W' with + | nil _ => simp [GraphWalk.edges] at hmem + | @cons a y b e' hl rest ih => + rcases List.mem_cons.mp hmem with rfl | hmem + · refine ⟨a, (GraphWalk.cons hl rest).start_mem_support, ?_⟩ + have ha_mem : a ∈ closure e ∩ (H.interSet (subBd Λ)).V := by + rw [hl.2.2.2] + exact mem_insert a {y} + exact ha_mem.1 + · obtain ⟨w, hw1, hw2⟩ := ih hmem + exact ⟨w, List.mem_cons_of_mem _ hw1, hw2⟩ + obtain ⟨w, hw_supp, hw_cl_e⟩ := hex_end W he_W + have hw_V : w ∈ H.V ∩ subBd Λ := by + rw [← hV, hCV] + exact hw_supp + exact ⟨w, hcl_e_sub hw_cl_e, hw_V⟩ + +/-- Pigeonhole principle for `3 ≤ φ` pairwise disjoint sets `L i` whose intersections with `K` +lie in a finite set `Z` of cardinality `≤ 2`. -/ +theorem exists_disjoint_of_three_le {X : Type*} {φ : ℕ} (hφ : 3 ≤ φ) + {K Z : Set X} (hZ_fin : Z.Finite) (hZ_card : Z.ncard ≤ 2) + {L : Fin φ → Set X} + (hL_disj : Pairwise (fun i j => Disjoint (L i) (L j))) + (hKL_sub : ∀ i, K ∩ L i ⊆ Z) : + ∃ i₀ : Fin φ, Disjoint K (L i₀) := by + by_contra h + have hne : ∀ i : Fin φ, (K ∩ L i).Nonempty := fun i => + Set.not_disjoint_iff_nonempty_inter.mp fun hd => h ⟨i, hd⟩ + let i0 : Fin φ := ⟨0, by omega⟩ + let i1 : Fin φ := ⟨1, by omega⟩ + let i2 : Fin φ := ⟨2, by omega⟩ + obtain ⟨x0, hx0⟩ := hne i0 + obtain ⟨x1, hx1⟩ := hne i1 + obtain ⟨x2, hx2⟩ := hne i2 + have h01 : x0 ≠ x1 := fun heq => + Set.disjoint_left.mp (hL_disj (fun h_eq => by + have : (0 : ℕ) = 1 := congrArg Fin.val h_eq + omega)) hx0.2 (heq ▸ hx1.2) + have h02 : x0 ≠ x2 := fun heq => + Set.disjoint_left.mp (hL_disj (fun h_eq => by + have : (0 : ℕ) = 2 := congrArg Fin.val h_eq + omega)) hx0.2 (heq ▸ hx2.2) + have h12 : x1 ≠ x2 := fun heq => + Set.disjoint_left.mp (hL_disj (fun h_eq => by + have : (1 : ℕ) = 2 := congrArg Fin.val h_eq + omega)) hx1.2 (heq ▸ hx2.2) + have hsub : ({x0, x1, x2} : Set X) ⊆ Z := by + rintro x (rfl | rfl | rfl) + · exact hKL_sub i0 hx0 + · exact hKL_sub i1 hx1 + · exact hKL_sub i2 hx2 + have hcard3 : ({x0, x1, x2} : Set X).ncard = 3 := by + rw [Set.ncard_insert_of_notMem (by simp [h01, h02]), + Set.ncard_pair h12] + have hle := Set.ncard_le_ncard hsub hZ_fin + omega + +/-- A curve that meets a drawing only at at most two vertices misses one of three disjoint lines +in the drawing. -/ +theorem exists_stripe_avoiding_normal_curve {T : Type*} [TopologicalSpace T] {φ : ℕ} + (hφ : 3 ≤ φ) {H : Drawing T} {F : Set T} {L : Fin φ → Set T} + (hFU : F ∩ H.U ⊆ H.V) (hFV : (F ∩ H.V).ncard ≤ 2) + (hL_sub_U : ∀ i, L i ⊆ H.U) + (hL_disj : Pairwise fun i j => Disjoint (L i) (L j)) : + ∃ i : Fin φ, Disjoint F (L i) := + exists_disjoint_of_three_le hφ (H.finite_V.subset inter_subset_right) hFV hL_disj + (fun i _ hx => ⟨hx.1, hFU ⟨hx.1, hL_sub_U i hx.2⟩⟩) + +/-- Gluing map from `bd ↥ClosedCylinder` to `univ \ (Λ₁ ∪ Λ₂)` sending the `r = 1` boundary circle +to `subBd Λ₁` via `g₁` and the `r = 2` boundary circle to `subBd Λ₂` via `g₂`. -/ +noncomputable def handleGlueMap {S : Type w} [TopologicalSpace S] {Λ₁ Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↥(subBd Λ₁)) (g₂ : Circle ≃ₜ ↥(subBd Λ₂)) + (p : ↥(bd ↥ClosedCylinder)) : ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) := + ⟨if p.1.1.1 ≤ 3 / 2 then (g₁ p.1.1.2).1 else (g₂ p.1.1.2).1, by + split_ifs with hp + · have hmem : (g₁ p.1.1.2).1 ∈ closure Λ₁ \ Λ₁ := by + rw [← hΛ₁_open.frontier_eq, ← subBd_eq_frontier] + exact (g₁ p.1.1.2).2 + refine ⟨mem_univ _, fun h => ?_⟩ + rcases h with h1 | h2 + · exact hmem.2 h1 + · exact Set.disjoint_left.mp hd hmem.1 (subset_closure h2) + · have hmem : (g₂ p.1.1.2).1 ∈ closure Λ₂ \ Λ₂ := by + rw [← hΛ₂_open.frontier_eq, ← subBd_eq_frontier] + exact (g₂ p.1.1.2).2 + refine ⟨mem_univ _, fun h => ?_⟩ + rcases h with h1 | h2 + · exact Set.disjoint_left.mp hd (subset_closure h1) hmem.1 + · exact hmem.2 h2⟩ + +theorem handleGlueMap_fst_eq_one_or_two (p : ↥(bd ↥ClosedCylinder)) : + p.1.1.1 = 1 ∨ p.1.1.1 = 2 := by + obtain ⟨q, hq⟩ := p + rw [bd_cylinder] at hq + rcases hq with ⟨z, hz⟩ | ⟨z, hz⟩ + · left + exact (congrArg (fun x : ClosedCylinder => x.1.1) hz).symm + · right + exact (congrArg (fun x : ClosedCylinder => x.1.1) hz).symm + +@[simp] +theorem handleGlueMap_cylEnd_one {S : Type w} [TopologicalSpace S] {Λ₁ Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↥(subBd Λ₁)) (g₂ : Circle ≃ₜ ↥(subBd Λ₂)) (z : Circle) : + (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ + ⟨cylEnd 1 (by norm_num) z, by rw [bd_cylinder]; exact .inl ⟨z, rfl⟩⟩).1 = (g₁ z).1 := by + dsimp [handleGlueMap, cylEnd] + have hle : (1 : ℝ) ≤ 3 / 2 := by norm_num + simp only [hle, ↓reduceIte] + +@[simp] +theorem handleGlueMap_cylEnd_two {S : Type w} [TopologicalSpace S] {Λ₁ Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↥(subBd Λ₁)) (g₂ : Circle ≃ₜ ↥(subBd Λ₂)) (z : Circle) : + (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ + ⟨cylEnd 2 (by norm_num) z, by rw [bd_cylinder]; exact .inr ⟨z, rfl⟩⟩).1 = (g₂ z).1 := by + dsimp [handleGlueMap, cylEnd] + have hnot : ¬ ((2 : ℝ) ≤ 3 / 2) := by norm_num + simp only [hnot, ↓reduceIte] + +theorem continuous_handleGlueMap {S : Type w} [TopologicalSpace S] {Λ₁ Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↥(subBd Λ₁)) (g₂ : Circle ≃ₜ ↥(subBd Λ₂)) : + Continuous (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂) := by + refine Continuous.subtype_mk ?_ _ + rw [← continuousOn_univ] + let A₁ : Set ↥(bd ↥ClosedCylinder) := {p | p.1.1.1 ≤ 3 / 2} + let A₂ : Set ↥(bd ↥ClosedCylinder) := {p | 3 / 2 ≤ p.1.1.1} + have hA₁_cl : IsClosed A₁ := + isClosed_le (continuous_fst.comp (continuous_subtype_val.comp continuous_subtype_val)) + continuous_const + have hA₂_cl : IsClosed A₂ := + isClosed_le continuous_const (continuous_fst.comp (continuous_subtype_val.comp + continuous_subtype_val)) + have hunion : A₁ ∪ A₂ = univ := by + ext p + exact ⟨fun _ => mem_univ _, fun _ => le_total p.1.1.1 (3 / 2)⟩ + rw [← hunion] + refine ContinuousOn.union_of_isClosed ?_ ?_ hA₁_cl hA₂_cl + · refine (continuous_subtype_val.comp (g₁.continuous.comp + (continuous_snd.comp (continuous_subtype_val.comp + continuous_subtype_val)))).continuousOn.congr ?_ + intro p hp + have hp' : p.1.1.1 ≤ 3 / 2 := hp + simp only [hp', ↓reduceIte] + rfl + · refine (continuous_subtype_val.comp (g₂.continuous.comp + (continuous_snd.comp (continuous_subtype_val.comp + continuous_subtype_val)))).continuousOn.congr ?_ + intro p hp + have hp_not : ¬ p.1.1.1 ≤ 3 / 2 := by + rcases handleGlueMap_fst_eq_one_or_two p with h1 | h2 <;> linarith [ show (3 / 2 : ℝ) + ≤ p.1.1.1 from hp ] + simp only [hp_not, ↓reduceIte] + rfl + +theorem injective_handleGlueMap {S : Type w} [TopologicalSpace S] {Λ₁ Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↥(subBd Λ₁)) (g₂ : Circle ≃ₜ ↥(subBd Λ₂)) : + Function.Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂) := by + have hsub₁ : subBd Λ₁ ⊆ closure Λ₁ := by + rw [subBd_eq_frontier, hΛ₁_open.frontier_eq] + exact sdiff_subset + have hsub₂ : subBd Λ₂ ⊆ closure Λ₂ := by + rw [subBd_eq_frontier, hΛ₂_open.frontier_eq] + exact sdiff_subset + intro p q hpq + have hval := congrArg Subtype.val hpq + dsimp [handleGlueMap] at hval + by_cases hp1 : p.1.1.1 ≤ 3 / 2 <;> by_cases hq1 : q.1.1.1 ≤ 3 / 2 + · simp only [hp1, hq1, ↓reduceIte] at hval + have hz : p.1.1.2 = q.1.1.2 := g₁.injective (Subtype.ext hval) + have hr_p : p.1.1.1 = 1 := by + rcases handleGlueMap_fst_eq_one_or_two p with h | h <;> linarith + have hr_q : q.1.1.1 = 1 := by + rcases handleGlueMap_fst_eq_one_or_two q with h | h <;> linarith + exact Subtype.ext (Subtype.ext (Prod.ext (hr_p.trans hr_q.symm) hz)) + · simp only [hp1, hq1, ↓reduceIte] at hval + exfalso + exact Set.disjoint_left.mp hd (hsub₁ (g₁ p.1.1.2).2) (hval.symm ▸ hsub₂ (g₂ q.1.1.2).2) + · simp only [hp1, hq1, ↓reduceIte] at hval + exfalso + exact Set.disjoint_left.mp hd (hval ▸ hsub₁ (g₁ q.1.1.2).2) (hsub₂ (g₂ p.1.1.2).2) + · simp only [hp1, hq1, ↓reduceIte] at hval + have hz : p.1.1.2 = q.1.1.2 := g₂.injective (Subtype.ext hval) + have hr_p : p.1.1.1 = 2 := by + rcases handleGlueMap_fst_eq_one_or_two p with h | h <;> linarith + have hr_q : q.1.1.1 = 2 := by + rcases handleGlueMap_fst_eq_one_or_two q with h | h <;> linarith + exact Subtype.ext (Subtype.ext (Prod.ext (hr_p.trans hr_q.symm) hz)) + +theorem range_handleGlueMap {S : Type w} [TopologicalSpace S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Λ₁ Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) (hΛ₂_open : IsOpen Λ₂) + (hOArc₁ : IsOArc (subBd Λ₁)) (hOArc₂ : IsOArc (subBd Λ₂)) + (hout₁ : ∀ x ∈ closure Λ₁ \ Λ₁, x ∈ closure (closure Λ₁)ᶜ) + (hout₂ : ∀ x ∈ closure Λ₂ \ Λ₂, x ∈ closure (closure Λ₂)ᶜ) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↥(subBd Λ₁)) (g₂ : Circle ≃ₜ ↥(subBd Λ₂)) : + range (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂) = + bd ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) := by + obtain ⟨_, _, hbd_eq⟩ := + compl_two_open_isSurface hS hΛ₁_open hΛ₂_open hOArc₁ hOArc₂ hout₁ hout₂ hd + rw [hbd_eq] + ext x + constructor + · rintro ⟨p, rfl⟩ + change (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ p).1 ∈ subBd Λ₁ ∪ subBd Λ₂ + dsimp [handleGlueMap] + split_ifs + · exact .inl (g₁ p.1.1.2).2 + · exact .inr (g₂ p.1.1.2).2 + · intro hx + rcases hx with hx1 | hx2 + · let z := g₁.symm ⟨x.1, hx1⟩ + refine ⟨⟨cylEnd 1 (by norm_num) z, by rw [bd_cylinder]; exact .inl ⟨z, rfl⟩⟩, ?_⟩ + apply Subtype.ext + rw [handleGlueMap_cylEnd_one] + exact congrArg Subtype.val (g₁.apply_symm_apply ⟨x.1, hx1⟩) + · let z := g₂.symm ⟨x.1, hx2⟩ + refine ⟨⟨cylEnd 2 (by norm_num) z, by rw [bd_cylinder]; exact .inr ⟨z, rfl⟩⟩, ?_⟩ + apply Subtype.ext + rw [handleGlueMap_cylEnd_two] + exact congrArg Subtype.val (g₂.apply_symm_apply ⟨x.1, hx2⟩) + +/-- Radial line `{p : ClosedCylinder | p.1.2 = z}` in `ClosedCylinder` from `cylEnd 1 m1 z` to +`cylEnd 2 m2 z`. -/ +theorem isLineWithEnds_cylRadial (z : Circle) : + IsLineWithEnds {p : ClosedCylinder | p.1.2 = z} + (cylEnd 1 (by norm_num) z) (cylEnd 2 (by norm_num) z) := by + let f : unitInterval → ↥{p : ClosedCylinder | p.1.2 = z} := fun t => + ⟨⟨(1 + (t : ℝ), z), ⟨⟨by linarith [t.2.1], by linarith [t.2.2]⟩, mem_univ _⟩⟩, rfl⟩ + have hf_cont : Continuous f := by + refine Continuous.subtype_mk (Continuous.subtype_mk ?_ _) _ + fun_prop + have hf_bij : Function.Bijective f := by + refine ⟨fun t₁ t₂ h => ?_, fun ⟨p, hp⟩ => ?_⟩ + · have h1 := Prod.ext_iff.mp (congrArg Subtype.val (congrArg Subtype.val h)) + exact Subtype.ext (by dsimp [f] at h1; linarith [h1.1]) + · refine ⟨⟨p.1.1 - 1, ⟨by linarith [p.2.1.1], by linarith [p.2.1.2]⟩⟩, ?_⟩ + apply Subtype.ext + apply Subtype.ext + apply Prod.ext + · dsimp [f]; ring + · exact hp.symm + let e : unitInterval ≃ₜ ↥{p : ClosedCylinder | p.1.2 = z} := + Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective f hf_bij) hf_cont + refine ⟨e, ?_, ?_⟩ + · change (f 0).1 = cylEnd 1 (by norm_num) z + ext <;> simp [f, cylEnd] + · change (f 1).1 = cylEnd 2 (by norm_num) z + ext + · dsimp [f, cylEnd]; norm_num + · rfl + +/-- The unpinched handle split on `GluedSpace hb_inj`, where `S₁ = range (GluedSpace.inl hb_inj)` +and `S₂ = range (GluedSpace.inr hb_inj)`. -/ +theorem isCappedSplit_handle_unpinched {S : Type w} [TopologicalSpace S] [T2Space S] + [ConnectedSpace S] (hS : IsClosedSurface S) {Λ₁ Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) (hΛ₂_open : IsOpen Λ₂) + (hΛ₁ : IsOpenDisc Λ₁) (hΛ₂ : IsOpenDisc Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (hOArc₁ : IsOArc (subBd Λ₁)) (hOArc₂ : IsOArc (subBd Λ₂)) + (hout₁ : ∀ x ∈ closure Λ₁ \ Λ₁, x ∈ closure (closure Λ₁)ᶜ) + (hout₂ : ∀ x ∈ closure Λ₂ \ Λ₂, x ∈ closure (closure Λ₂)ᶜ) + (g₁ : Circle ≃ₜ ↥(subBd Λ₁)) (g₂ : Circle ≃ₜ ↥(subBd Λ₂)) + (hb_inj : Function.Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) : + let S' := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let S₂ : Set S' := range (GluedSpace.inr hb_inj) + ∃ (C_unp : Fin 2 → Set S') (ι_unp : ↥S₁ → S), + IsClosedSurface S' ∧ ConnectedSpace S' ∧ IsObtainedByAddingHandle S S' ∧ + GM12.IsCappedSplit C_unp S₁ S₂ ι_unp ![Λ₁, Λ₂] ∧ + C_unp 0 = GluedSpace.inr hb_inj '' range (cylEnd 1 (by norm_num)) ∧ + C_unp 1 = GluedSpace.inr hb_inj '' range (cylEnd 2 (by norm_num)) ∧ + S₁ ∩ S₂ = GluedSpace.inl hb_inj '' (Subtype.val ⁻¹' (subBd Λ₁ ∪ subBd Λ₂)) ∧ + (∀ y : ↥(univ \ (Λ₁ ∪ Λ₂) : Set S), ι_unp ⟨GluedSpace.inl hb_inj y, ⟨y, rfl⟩⟩ = y.1) := by + have : CompactSpace S := hS.1 + have hX_closed : IsClosed (univ \ (Λ₁ ∪ Λ₂) : Set S) := + isClosed_univ.sdiff (hΛ₁_open.union hΛ₂_open) + have : CompactSpace ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) := + isCompact_iff_compactSpace.mp hX_closed.isCompact + have : CompactSpace ClosedCylinder := + isCompact_iff_compactSpace.mp (isCompact_Icc.prod isCompact_univ) + let b := handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ + have hb_cont := continuous_handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ + have hb_range := range_handleGlueMap hS hΛ₁_open hΛ₂_open hOArc₁ hOArc₂ hout₁ hout₂ hd g₁ g₂ + have : T2Space (GluedSpace hb_inj) := + GluedSpace.t2Space (isClosed_bd ↥ClosedCylinder) hb_cont hb_inj + obtain ⟨hS', hConn', hHandle, hS₁_surf, hS₂_surf, hU_eq, h1_bd, h2_bd⟩ := + isClosedSurface_of_handle_glue hS hΛ₁ hΛ₂ hd hOArc₁ hOArc₂ hout₁ hout₂ hb_cont hb_inj hb_range + obtain ⟨_, _, hX_bd⟩ := + compl_two_open_isSurface hS hΛ₁_open hΛ₂_open hOArc₁ hOArc₂ hout₁ hout₂ hd + let S' := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let S₂ : Set S' := range (GluedSpace.inr hb_inj) + have m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2 := by norm_num + have m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2 := by norm_num + let C_unp : Fin 2 → Set S' := + ![GluedSpace.inr hb_inj '' range (cylEnd 1 m1), + GluedSpace.inr hb_inj '' range (cylEnd 2 m2)] + have hinl_emb : IsClosedEmbedding (GluedSpace.inl hb_inj) := + (GluedSpace.continuous_inl hb_inj).isClosedEmbedding (GluedSpace.inl_injective hb_inj) + have hinr_emb : IsClosedEmbedding (GluedSpace.inr hb_inj) := + (GluedSpace.continuous_inr hb_inj).isClosedEmbedding (GluedSpace.inr_injective hb_inj) + let e₁ : ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) ≃ₜ ↥S₁ := hinl_emb.isEmbedding.toHomeomorph + let ι_unp : ↥S₁ → S := Subtype.val ∘ e₁.symm + have hι_emb : IsEmbedding ι_unp := + hX_closed.isClosedEmbedding_subtypeVal.isEmbedding.comp e₁.symm.isEmbedding + have hι_inl : ∀ y : ↥(univ \ (Λ₁ ∪ Λ₂) : Set S), + ι_unp ⟨GluedSpace.inl hb_inj y, ⟨y, rfl⟩⟩ = y.1 := by + intro y + change (e₁.symm (e₁ y)).1 = y.1 + rw [e₁.symm_apply_apply] + have hι_range : range ι_unp = univ \ (Λ₁ ∪ Λ₂) := by + ext x + constructor + · rintro ⟨z, rfl⟩ + exact (e₁.symm z).2 + · intro hx + exact ⟨⟨GluedSpace.inl hb_inj ⟨x, hx⟩, ⟨⟨x, hx⟩, rfl⟩⟩, hι_inl ⟨x, hx⟩⟩ + have hC0_inl : C_unp 0 = GluedSpace.inl hb_inj '' (Subtype.val ⁻¹' subBd Λ₁) := by + change GluedSpace.inr hb_inj '' range (cylEnd 1 m1) = _ + ext p + constructor + · rintro ⟨_, ⟨z, rfl⟩, rfl⟩ + have hmem : cylEnd 1 m1 z ∈ bd ↥ClosedCylinder := by + rw [bd_cylinder] + exact .inl ⟨z, rfl⟩ + refine ⟨b ⟨cylEnd 1 m1 z, hmem⟩, ?_, (GluedSpace.inl_eq_inr hb_inj).mpr ⟨hmem, rfl⟩⟩ + change (b ⟨cylEnd 1 m1 z, hmem⟩).1 ∈ subBd Λ₁ + rw [handleGlueMap_cylEnd_one] + exact (g₁ z).2 + · rintro ⟨y, hy, rfl⟩ + let z := g₁.symm ⟨y.1, hy⟩ + have hmem : cylEnd 1 m1 z ∈ bd ↥ClosedCylinder := by + rw [bd_cylinder] + exact .inl ⟨z, rfl⟩ + have hby : y = b ⟨cylEnd 1 m1 z, hmem⟩ := by + apply Subtype.ext + rw [handleGlueMap_cylEnd_one] + exact (congrArg Subtype.val (g₁.apply_symm_apply ⟨y.1, hy⟩)).symm + exact ⟨cylEnd 1 m1 z, ⟨z, rfl⟩, ((GluedSpace.inl_eq_inr hb_inj).mpr ⟨hmem, hby⟩).symm⟩ + have hC1_inl : C_unp 1 = GluedSpace.inl hb_inj '' (Subtype.val ⁻¹' subBd Λ₂) := by + change GluedSpace.inr hb_inj '' range (cylEnd 2 m2) = _ + ext p + constructor + · rintro ⟨_, ⟨z, rfl⟩, rfl⟩ + have hmem : cylEnd 2 m2 z ∈ bd ↥ClosedCylinder := by + rw [bd_cylinder] + exact .inr ⟨z, rfl⟩ + refine ⟨b ⟨cylEnd 2 m2 z, hmem⟩, ?_, (GluedSpace.inl_eq_inr hb_inj).mpr ⟨hmem, rfl⟩⟩ + change (b ⟨cylEnd 2 m2 z, hmem⟩).1 ∈ subBd Λ₂ + rw [handleGlueMap_cylEnd_two] + exact (g₂ z).2 + · rintro ⟨y, hy, rfl⟩ + let z := g₂.symm ⟨y.1, hy⟩ + have hmem : cylEnd 2 m2 z ∈ bd ↥ClosedCylinder := by + rw [bd_cylinder] + exact .inr ⟨z, rfl⟩ + have hby : y = b ⟨cylEnd 2 m2 z, hmem⟩ := by + apply Subtype.ext + rw [handleGlueMap_cylEnd_two] + exact (congrArg Subtype.val (g₂.apply_symm_apply ⟨y.1, hy⟩)).symm + exact ⟨cylEnd 2 m2 z, ⟨z, rfl⟩, ((GluedSpace.inl_eq_inr hb_inj).mpr ⟨hmem, hby⟩).symm⟩ + have hiUnion2 : ∀ {α : Type w} (f : Fin 2 → Set α), (⋃ i : Fin 2, f i) = f 0 ∪ f 1 := by + intro α f + ext x + simp [Fin.exists_fin_two] + have hCu_eq : (⋃ i : Fin 2, C_unp i) = S₁ ∩ S₂ := by + rw [hiUnion2 C_unp, GluedSpace.range_inl_inter_range_inr_eq_inr hb_inj, + congrArg (GluedSpace.inr hb_inj '' ·) bd_cylinder, image_union] + rfl + have hS12_inl : S₁ ∩ S₂ = GluedSpace.inl hb_inj '' (Subtype.val ⁻¹' (subBd Λ₁ ∪ subBd Λ₂)) := by + rw [GluedSpace.range_inl_inter_range_inr hb_inj, hb_range, hX_bd] + refine ⟨C_unp, ι_unp, hS', hConn', hHandle, ?_, rfl, rfl, hS12_inl, hι_inl⟩ + refine + { surface := ⟨hS', hConn'⟩ + isOArc := ?_ + disjoint := ?_ + manifold₁ := hS₁_surf + manifold₂ := hS₂_surf + union := hU_eq + inter := hCu_eq.symm + bd₁ := h1_bd.symm.trans hCu_eq.symm + bd₂ := h2_bd.symm.trans hCu_eq.symm + surface_hat := hS + isEmbedding := hι_emb + isOpenDisc := fun i => by fin_cases i <;> [exact hΛ₁; exact hΛ₂] + bounds := ?_ + disjoint_D := fun i j hij => by + fin_cases i <;> fin_cases j + · exact (hij rfl).elim + · exact hd.mono subset_closure subset_closure + · exact hd.symm.mono subset_closure subset_closure + · exact (hij rfl).elim + compl := ?_ } + · intro i + fin_cases i + · exact isOArc_image hinr_emb.isEmbedding ⟨(isEmbedding_cylEnd 1 m1).toHomeomorph⟩ + · exact isOArc_image hinr_emb.isEmbedding ⟨(isEmbedding_cylEnd 2 m2).toHomeomorph⟩ + · intro i j hij + fin_cases i <;> fin_cases j + · exact (hij rfl).elim + · rw [Set.disjoint_left] + rintro _ ⟨_, ⟨z₁, rfl⟩, rfl⟩ ⟨_, ⟨z₂, rfl⟩, he⟩ + have h1 := GluedSpace.inr_injective hb_inj he + have h2 : (2 : ℝ) = 1 := congrArg (fun p : ClosedCylinder => p.1.1) h1 + norm_num at h2 + · rw [Set.disjoint_left] + rintro _ ⟨_, ⟨z₁, rfl⟩, rfl⟩ ⟨_, ⟨z₂, rfl⟩, he⟩ + have h1 := GluedSpace.inr_injective hb_inj he + have h2 : (1 : ℝ) = 2 := congrArg (fun p : ClosedCylinder => p.1.1) h1 + norm_num at h2 + · exact (hij rfl).elim + · intro i + fin_cases i + · change subBd Λ₁ = ι_unp '' (Subtype.val ⁻¹' (C_unp 0)) + rw [hC0_inl] + ext x + constructor + · intro hx + have hx_mem : x ∈ univ \ (Λ₁ ∪ Λ₂) := by + have hmem : x ∈ closure Λ₁ \ Λ₁ := by + rw [← hΛ₁_open.frontier_eq, ← subBd_eq_frontier] + exact hx + refine ⟨mem_univ _, fun h => ?_⟩ + rcases h with h1 | h2 + · exact hmem.2 h1 + · exact Set.disjoint_left.mp hd hmem.1 (subset_closure h2) + refine ⟨⟨GluedSpace.inl hb_inj ⟨x, hx_mem⟩, ⟨⟨x, hx_mem⟩, rfl⟩⟩, ?_, hι_inl ⟨x, hx_mem⟩⟩ + exact ⟨⟨x, hx_mem⟩, hx, rfl⟩ + · rintro ⟨⟨_, ⟨y, rfl⟩⟩, ⟨y', hy', he⟩, rfl⟩ + have hyy' : y = y' := GluedSpace.inl_injective hb_inj he.symm + subst hyy' + rw [hι_inl y] + exact hy' + · change subBd Λ₂ = ι_unp '' (Subtype.val ⁻¹' (C_unp 1)) + rw [hC1_inl] + ext x + constructor + · intro hx + have hx_mem : x ∈ univ \ (Λ₁ ∪ Λ₂) := by + have hmem : x ∈ closure Λ₂ \ Λ₂ := by + rw [← hΛ₂_open.frontier_eq, ← subBd_eq_frontier] + exact hx + refine ⟨mem_univ _, fun h => ?_⟩ + rcases h with h1 | h2 + · exact Set.disjoint_left.mp hd (subset_closure h1) hmem.1 + · exact hmem.2 h2 + refine ⟨⟨GluedSpace.inl hb_inj ⟨x, hx_mem⟩, ⟨⟨x, hx_mem⟩, rfl⟩⟩, ?_, hι_inl ⟨x, hx_mem⟩⟩ + exact ⟨⟨x, hx_mem⟩, hx, rfl⟩ + · rintro ⟨⟨_, ⟨y, rfl⟩⟩, ⟨y', hy', he⟩, rfl⟩ + have hyy' : y = y' := GluedSpace.inl_injective hb_inj he.symm + subst hyy' + rw [hι_inl y] + exact hy' + · rw [hiUnion2 ![Λ₁, Λ₂], hι_range] + ext x + simp only [mem_compl_iff, mem_sdiff, mem_univ, mem_union, true_and, Matrix.cons_val_zero, + Matrix.cons_val_one] + tauto + +/-- Map from `GluedSpace hb_inj` to `S` that equals the inclusion on `S₁` and maps the two halves +of `ClosedCylinder` via `cMap₁` and `cMap₂`. -/ +noncomputable def handlePinchRetract {S : Type w} [TopologicalSpace S] {Λ₁ Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↥(subBd Λ₁)) (g₂ : Circle ≃ₜ ↥(subBd Λ₂)) + (hb_inj : Function.Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (cMap₁ cMap₂ : ℝ × Circle → S) + (hcMap₁_zero : ∀ z : Circle, cMap₁ (0, z) = (g₁ z).1) + (hcMap₂_zero : ∀ z : Circle, cMap₂ (0, z) = (g₂ z).1) : + GluedSpace hb_inj → S := + Quotient.lift + (fun a => match a with + | .inl x => x.1 + | .inr q => + if q.down.1.1 ≤ 3 / 2 then cMap₁ (q.down.1.1 - 1, q.down.1.2) + else cMap₂ (2 - q.down.1.1, q.down.1.2)) + (by + have hagree : ∀ z : ↥(bd ↥ClosedCylinder), + (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ z).1 = + if z.1.1.1 ≤ 3 / 2 then cMap₁ (z.1.1.1 - 1, z.1.1.2) + else cMap₂ (2 - z.1.1.1, z.1.1.2) := by + intro z + rcases handleGlueMap_fst_eq_one_or_two z with h1 | h2 + · have hle : (1 : ℝ) ≤ 3 / 2 := by norm_num + change (if z.1.1.1 ≤ 3 / 2 then (g₁ z.1.1.2).1 else (g₂ z.1.1.2).1) = _ + simp only [h1, hle, ↓reduceIte, sub_self, hcMap₁_zero] + · have hnot : ¬ ((2 : ℝ) ≤ 3 / 2) := by norm_num + change (if z.1.1.1 ≤ 3 / 2 then (g₁ z.1.1.2).1 else (g₂ z.1.1.2).1) = _ + simp only [h2, hnot, ↓reduceIte, sub_self, hcMap₂_zero] + rintro a a' (rfl | ⟨z, rfl, rfl⟩ | ⟨z, rfl, rfl⟩) + · rfl + · exact hagree z + · exact (hagree z).symm) + +@[simp] +theorem handlePinchRetract_inl {S : Type w} [TopologicalSpace S] {Λ₁ Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↥(subBd Λ₁)) (g₂ : Circle ≃ₜ ↥(subBd Λ₂)) + (hb_inj : Function.Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (cMap₁ cMap₂ : ℝ × Circle → S) + (hcMap₁_zero : ∀ z : Circle, cMap₁ (0, z) = (g₁ z).1) + (hcMap₂_zero : ∀ z : Circle, cMap₂ (0, z) = (g₂ z).1) + (x : ↥(univ \ (Λ₁ ∪ Λ₂) : Set S)) : + handlePinchRetract hΛ₁_open hΛ₂_open hd g₁ g₂ hb_inj cMap₁ cMap₂ + hcMap₁_zero hcMap₂_zero (GluedSpace.inl hb_inj x) = x.1 := rfl + +theorem handlePinchRetract_inr_one {S : Type w} [TopologicalSpace S] {Λ₁ Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↥(subBd Λ₁)) (g₂ : Circle ≃ₜ ↥(subBd Λ₂)) + (hb_inj : Function.Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (cMap₁ cMap₂ : ℝ × Circle → S) + (hcMap₁_zero : ∀ z : Circle, cMap₁ (0, z) = (g₁ z).1) + (hcMap₂_zero : ∀ z : Circle, cMap₂ (0, z) = (g₂ z).1) + (q : ClosedCylinder) (hq : q.1.1 ≤ 3 / 2) : + handlePinchRetract hΛ₁_open hΛ₂_open hd g₁ g₂ hb_inj cMap₁ cMap₂ + hcMap₁_zero hcMap₂_zero (GluedSpace.inr hb_inj q) = cMap₁ (q.1.1 - 1, q.1.2) := by + change (if q.1.1 ≤ 3 / 2 then cMap₁ (q.1.1 - 1, q.1.2) else cMap₂ (2 - q.1.1, q.1.2)) = _ + simp only [hq, ↓reduceIte] + +theorem handlePinchRetract_inr_two {S : Type w} [TopologicalSpace S] {Λ₁ Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↥(subBd Λ₁)) (g₂ : Circle ≃ₜ ↥(subBd Λ₂)) + (hb_inj : Function.Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (cMap₁ cMap₂ : ℝ × Circle → S) + (hcMap₁_zero : ∀ z : Circle, cMap₁ (0, z) = (g₁ z).1) + (hcMap₂_zero : ∀ z : Circle, cMap₂ (0, z) = (g₂ z).1) + (q : ClosedCylinder) (hq : ¬ q.1.1 ≤ 3 / 2) : + handlePinchRetract hΛ₁_open hΛ₂_open hd g₁ g₂ hb_inj cMap₁ cMap₂ + hcMap₁_zero hcMap₂_zero (GluedSpace.inr hb_inj q) = cMap₂ (2 - q.1.1, q.1.2) := by + change (if q.1.1 ≤ 3 / 2 then cMap₁ (q.1.1 - 1, q.1.2) else cMap₂ (2 - q.1.1, q.1.2)) = _ + simp only [hq, ↓reduceIte] + +private theorem lower_cylinder_collar_closed + (δ₁ : Circle → ℝ) + (hδ₁_cont : Continuous δ₁) : + IsClosed ({q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2}) := by + let A_col₁ := {q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2} + refine isClosed_le (continuous_fst.comp continuous_subtype_val) ?_ + fun_prop + +private theorem upper_cylinder_collar_closed + (δ₂ : Circle → ℝ) + (hδ₂_cont : Continuous δ₂) : + IsClosed ({q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1}) := by + let A_col₂ := {q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1} + refine isClosed_le ?_ (continuous_fst.comp continuous_subtype_val) + fun_prop + +private theorem middle_cylinder_strip_closed + (δ₁ : Circle → ℝ) + (hδ₁_cont : Continuous δ₁) + (δ₂ : Circle → ℝ) + (hδ₂_cont : Continuous δ₂) : + IsClosed ({q : ClosedCylinder | 1 + δ₁ q.1.2 ≤ q.1.1 ∧ q.1.1 ≤ 2 - δ₂ q.1.2}) := by + let A_mid := {q : ClosedCylinder | 1 + δ₁ q.1.2 ≤ q.1.1 ∧ q.1.1 ≤ 2 - δ₂ q.1.2} + have hlo : IsClosed {q : ClosedCylinder | 1 + δ₁ q.1.2 ≤ q.1.1} := by + refine isClosed_le ?_ (continuous_fst.comp continuous_subtype_val) + fun_prop + have hhi : IsClosed {q : ClosedCylinder | q.1.1 ≤ 2 - δ₂ q.1.2} := by + refine isClosed_le (continuous_fst.comp continuous_subtype_val) ?_ + fun_prop + exact hlo.inter hhi + +private theorem handle_map_continuous_on_original_surface + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (e₁ : ↑(univ \ (Λ₁ ∪ Λ₂)) ≃ₜ ↑(range (GluedSpace.inl hb_inj))) + (he₁ : ∀ y, (e₁ y).1 = GluedSpace.inl hb_inj y) + (f_XII : (GluedSpace hb_inj) → S) + (hf_inl : ∀ (y : ↑(univ \ (Λ₁ ∪ Λ₂))), f_XII (GluedSpace.inl hb_inj y) = ↑y) : + ContinuousOn f_XII (range (GluedSpace.inl hb_inj)) := by + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + rw [continuousOn_iff_continuous_domRestrict] + have hcongr : S₁.domRestrict f_XII = fun x : ↥S₁ => (e₁.symm x).1 := by + ext x + have hx : x.1 = GluedSpace.inl hb_inj (e₁.symm x) := by + rw [← he₁, e₁.apply_symm_apply] + change f_XII x.1 = (e₁.symm x).1 + rw [hx, hf_inl] + rw [hcongr] + exact continuous_subtype_val.comp e₁.symm.continuous + +private theorem handle_map_continuous_on_lower_collar + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (δ₁ : Circle → ℝ) + (cMap₁ : ℝ × Circle → S) + (hδ₁_bd : ∀ (z : Circle), 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (hcMap₁_cont : Continuous cMap₁) + (e₂ : ↑ClosedCylinder ≃ₜ ↑(range (GluedSpace.inr hb_inj))) + (he₂ : ∀ q, (e₂ q).1 = GluedSpace.inr hb_inj q) + (f_XII : (GluedSpace hb_inj) → S) + (hf_inr_one : ∀ (q : ↑ClosedCylinder), q.1.1 ≤ 3 / 2 → f_XII (GluedSpace.inr hb_inj q) = + cMap₁ (q.1.1 - 1, q.1.2)) : + ContinuousOn f_XII (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2})) + := by + let S' := GluedSpace hb_inj + let S₂ := range (GluedSpace.inr hb_inj) + let A_col₁ := {q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2} + let C_col₁ := GluedSpace.inr hb_inj '' A_col₁ + have hsub : C_col₁ ⊆ S₂ := image_subset_range _ _ + rw [continuousOn_iff_continuous_domRestrict] + have hcongr : C_col₁.domRestrict f_XII = + fun x : ↥C_col₁ => + cMap₁ ((e₂.symm ⟨x.1, hsub x.2⟩).1.1 - 1, (e₂.symm ⟨x.1, hsub x.2⟩).1.2) := by + ext ⟨_, ⟨q, hq, rfl⟩⟩ + have hq_le : q.1.1 ≤ 3 / 2 := by linarith [(hδ₁_bd q.1.2).2, show q.1.1 ≤ 1 + δ₁ q.1.2 from hq] + have hmem2 : GluedSpace.inr hb_inj q ∈ S₂ := ⟨q, rfl⟩ + have he₂_q : e₂.symm ⟨GluedSpace.inr hb_inj q, hmem2⟩ = q := by + have hEq : (⟨GluedSpace.inr hb_inj q, hmem2⟩ : S₂) = e₂ q := + Subtype.ext (he₂ q).symm + rw [hEq, e₂.symm_apply_apply] + change f_XII (GluedSpace.inr hb_inj q) = + cMap₁ ((e₂.symm ⟨GluedSpace.inr hb_inj q, hmem2⟩).1.1 - 1, + (e₂.symm ⟨GluedSpace.inr hb_inj q, hmem2⟩).1.2) + rw [he₂_q, hf_inr_one q hq_le] + rw [hcongr] + refine hcMap₁_cont.comp ?_ + fun_prop + +private theorem handle_map_continuous_on_upper_collar + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (δ₂ : Circle → ℝ) + (cMap₂ : ℝ × Circle → S) + (hδ₂_bd : ∀ (z : Circle), 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) + (hcMap₂_cont : Continuous cMap₂) + (e₂ : ↑ClosedCylinder ≃ₜ ↑(range (GluedSpace.inr hb_inj))) + (he₂ : ∀ q, (e₂ q).1 = GluedSpace.inr hb_inj q) + (f_XII : (GluedSpace hb_inj) → S) + (hf_inr_two : ∀ (q : ↑ClosedCylinder), ¬q.1.1 ≤ 3 / 2 → f_XII (GluedSpace.inr hb_inj q) = + cMap₂ (2 - q.1.1, q.1.2)) : + ContinuousOn f_XII (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1})) + := by + let S' := GluedSpace hb_inj + let S₂ := range (GluedSpace.inr hb_inj) + let A_col₂ := {q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1} + let C_col₂ := GluedSpace.inr hb_inj '' A_col₂ + have hsub : C_col₂ ⊆ S₂ := image_subset_range _ _ + rw [continuousOn_iff_continuous_domRestrict] + have hcongr : C_col₂.domRestrict f_XII = + fun x : ↥C_col₂ => + cMap₂ (2 - (e₂.symm ⟨x.1, hsub x.2⟩).1.1, (e₂.symm ⟨x.1, hsub x.2⟩).1.2) := by + ext ⟨_, ⟨q, hq, rfl⟩⟩ + have hq_not : ¬ q.1.1 ≤ 3 / 2 := by + linarith [(hδ₂_bd q.1.2).2, show 2 - δ₂ q.1.2 ≤ q.1.1 from hq] + have hmem2 : GluedSpace.inr hb_inj q ∈ S₂ := ⟨q, rfl⟩ + have he₂_q : e₂.symm ⟨GluedSpace.inr hb_inj q, hmem2⟩ = q := by + have hEq : (⟨GluedSpace.inr hb_inj q, hmem2⟩ : S₂) = e₂ q := + Subtype.ext (he₂ q).symm + rw [hEq, e₂.symm_apply_apply] + change f_XII (GluedSpace.inr hb_inj q) = + cMap₂ (2 - (e₂.symm ⟨GluedSpace.inr hb_inj q, hmem2⟩).1.1, + (e₂.symm ⟨GluedSpace.inr hb_inj q, hmem2⟩).1.2) + rw [he₂_q, hf_inr_two q hq_not] + rw [hcongr] + refine hcMap₂_cont.comp ?_ + fun_prop + +private theorem handle_map_image_of_original_surface + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (f_XII : (GluedSpace hb_inj) → S) + (hf_inl : ∀ y, f_XII (GluedSpace.inl hb_inj y) = y.1) : + f_XII '' (range (GluedSpace.inl hb_inj)) = univ \ (Λ₁ ∪ Λ₂) := by + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + ext y + constructor + · rintro ⟨_, ⟨x, rfl⟩, rfl⟩ + rw [hf_inl] + exact x.2 + · intro hy + exact ⟨GluedSpace.inl hb_inj ⟨y, hy⟩, ⟨⟨y, hy⟩, rfl⟩, hf_inl _⟩ + +private theorem handle_map_image_of_lower_collar + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (δ₁ : Circle → ℝ) + (D₁ : Set S) + (cMap₁ : ℝ × Circle → S) + (hδ₁_bd : ∀ (z : Circle), 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (hcMap₁_collar : cMap₁ '' {p | 0 ≤ p.1 ∧ p.1 ≤ δ₁ p.2} = closure Λ₁ \ D₁) + (f_XII : (GluedSpace hb_inj) → S) + (hf_inr_one : ∀ (q : ↑ClosedCylinder), q.1.1 ≤ 3 / 2 → f_XII (GluedSpace.inr hb_inj q) = + cMap₁ (q.1.1 - 1, q.1.2)) : + f_XII '' (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2})) = closure + Λ₁ \ D₁ := by + let S' := GluedSpace hb_inj + let A_col₁ := {q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2} + let C_col₁ := GluedSpace.inr hb_inj '' A_col₁ + rw [← hcMap₁_collar] + ext y + constructor + · rintro ⟨_, ⟨q, hq, rfl⟩, rfl⟩ + have hq_le : q.1.1 ≤ 3 / 2 := by linarith [(hδ₁_bd q.1.2).2, show q.1.1 ≤ 1 + δ₁ q.1.2 from hq] + rw [hf_inr_one q hq_le] + have hq₁ : q.1.1 ≤ 1 + δ₁ q.1.2 := hq + exact ⟨(q.1.1 - 1, q.1.2), ⟨by linarith [q.2.1.1], by linarith⟩, rfl⟩ + · rintro ⟨p, ⟨hp0, hpδ⟩, rfl⟩ + have hr : 1 + p.1 ∈ Icc (1 : ℝ) 2 := ⟨by linarith, by linarith [(hδ₁_bd p.2).2]⟩ + let q : ClosedCylinder := ⟨(1 + p.1, p.2), hr, mem_univ _⟩ + have hq_col : q ∈ A_col₁ := by dsimp [A_col₁, q]; linarith + have hq_le : q.1.1 ≤ 3 / 2 := by dsimp [q]; linarith [(hδ₁_bd p.2).2] + refine ⟨GluedSpace.inr hb_inj q, ⟨q, hq_col, rfl⟩, ?_⟩ + rw [hf_inr_one q hq_le] + dsimp [q] + rw [add_sub_cancel_left] + +private theorem handle_map_image_of_upper_collar + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (δ₂ : Circle → ℝ) + (D₂ : Set S) + (cMap₂ : ℝ × Circle → S) + (hδ₂_bd : ∀ (z : Circle), 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) + (hcMap₂_collar : cMap₂ '' {p | 0 ≤ p.1 ∧ p.1 ≤ δ₂ p.2} = closure Λ₂ \ D₂) + (f_XII : (GluedSpace hb_inj) → S) + (hf_inr_two : ∀ (q : ↑ClosedCylinder), ¬q.1.1 ≤ 3 / 2 → f_XII (GluedSpace.inr hb_inj q) = + cMap₂ (2 - q.1.1, q.1.2)) : + f_XII '' (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1})) = closure + Λ₂ \ D₂ := by + let S' := GluedSpace hb_inj + let A_col₂ := {q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1} + let C_col₂ := GluedSpace.inr hb_inj '' A_col₂ + rw [← hcMap₂_collar] + ext y + constructor + · rintro ⟨_, ⟨q, hq, rfl⟩, rfl⟩ + have hq_not : ¬ q.1.1 ≤ 3 / 2 := by + linarith [(hδ₂_bd q.1.2).2, show 2 - δ₂ q.1.2 ≤ q.1.1 from hq] + rw [hf_inr_two q hq_not] + exact ⟨(2 - q.1.1, q.1.2), ⟨by linarith [q.2.1.2], by linarith [show 2 - δ₂ q.1.2 + ≤ q.1.1 from hq]⟩, rfl⟩ + · rintro ⟨p, ⟨hp0, hpδ⟩, rfl⟩ + have hr : 2 - p.1 ∈ Icc (1 : ℝ) 2 := ⟨by linarith [(hδ₂_bd p.2).2], by linarith⟩ + let q : ClosedCylinder := ⟨(2 - p.1, p.2), hr, mem_univ _⟩ + have hq_col : q ∈ A_col₂ := by dsimp [A_col₂, q]; linarith + have hq_not : ¬ q.1.1 ≤ 3 / 2 := by dsimp [q]; linarith [(hδ₂_bd p.2).2] + refine ⟨GluedSpace.inr hb_inj q, ⟨q, hq_col, rfl⟩, ?_⟩ + rw [hf_inr_two q hq_not] + dsimp [q] + rw [sub_sub_cancel] + +private theorem lower_collar_interior_maps_inside_disc + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (δ₁ : Circle → ℝ) + (D₁ : Set S) + (cMap₁ : ℝ × Circle → S) + (hδ₁_bd : ∀ (z : Circle), 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (hcMap₁_inj : InjOn cMap₁ {p | 0 ≤ p.1 ∧ p.1 ≤ δ₁ p.2}) + (hcMap₁_zero : ∀ (z : Circle), cMap₁ (0, z) = ↑(g₁ z)) + (f_XII : (GluedSpace hb_inj) → S) + (hf_inr_one : ∀ (q : ↑ClosedCylinder), q.1.1 ≤ 3 / 2 → f_XII (GluedSpace.inr hb_inj q) = + cMap₁ (q.1.1 - 1, q.1.2)) + (hf_img_col₁ : f_XII '' (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ + q.1.2})) = closure Λ₁ \ D₁) : + ∀ q ∈ ({q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2}), 1 < q.1.1 → f_XII (GluedSpace.inr + hb_inj q) ∈ Λ₁ := by + let S' := GluedSpace hb_inj + let A_col₁ := {q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2} + let C_col₁ := GluedSpace.inr hb_inj '' A_col₁ + intro q hq hq1 + have hq_le : q.1.1 ≤ 3 / 2 := by linarith [(hδ₁_bd q.1.2).2, show q.1.1 ≤ 1 + δ₁ q.1.2 from hq] + have hmem_col : f_XII (GluedSpace.inr hb_inj q) ∈ closure Λ₁ \ D₁ := by + rw [← hf_img_col₁] + exact ⟨GluedSpace.inr hb_inj q, ⟨q, hq, rfl⟩, rfl⟩ + by_contra hnot_Λ₁ + have hbd : f_XII (GluedSpace.inr hb_inj q) ∈ subBd Λ₁ := by + rw [subBd_eq_frontier, hΛ₁_open.frontier_eq] + exact ⟨hmem_col.1, hnot_Λ₁⟩ + let z := g₁.symm ⟨f_XII (GluedSpace.inr hb_inj q), hbd⟩ + have hcz : cMap₁ (0, z) = cMap₁ (q.1.1 - 1, q.1.2) := by + rw [hcMap₁_zero z, ← hf_inr_one q hq_le] + exact congrArg Subtype.val (g₁.apply_symm_apply ⟨f_XII (GluedSpace.inr hb_inj q), hbd⟩) + have hinj := hcMap₁_inj ⟨le_rfl, (hδ₁_bd z).1⟩ + ⟨by linarith [q.2.1.1], by linarith [show q.1.1 ≤ 1 + δ₁ q.1.2 from hq]⟩ hcz + have : (0 : ℝ) = q.1.1 - 1 := congrArg Prod.fst hinj + linarith + +private theorem upper_collar_interior_maps_inside_disc + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (δ₂ : Circle → ℝ) + (D₂ : Set S) + (cMap₂ : ℝ × Circle → S) + (hδ₂_bd : ∀ (z : Circle), 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) + (hcMap₂_inj : InjOn cMap₂ {p | 0 ≤ p.1 ∧ p.1 ≤ δ₂ p.2}) + (hcMap₂_zero : ∀ (z : Circle), cMap₂ (0, z) = ↑(g₂ z)) + (f_XII : (GluedSpace hb_inj) → S) + (hf_inr_two : ∀ (q : ↑ClosedCylinder), ¬q.1.1 ≤ 3 / 2 → f_XII (GluedSpace.inr hb_inj q) = + cMap₂ (2 - q.1.1, q.1.2)) + (hf_img_col₂ : f_XII '' (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ + q.1.1})) = closure Λ₂ \ D₂) : + ∀ q ∈ ({q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1}), q.1.1 < 2 → f_XII (GluedSpace.inr + hb_inj q) ∈ Λ₂ := by + let S' := GluedSpace hb_inj + let A_col₂ := {q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1} + let C_col₂ := GluedSpace.inr hb_inj '' A_col₂ + intro q hq hq2 + have hq_not : ¬ q.1.1 ≤ 3 / 2 := by linarith [(hδ₂_bd q.1.2).2, show 2 - δ₂ q.1.2 ≤ q.1.1 from hq] + have hmem_col : f_XII (GluedSpace.inr hb_inj q) ∈ closure Λ₂ \ D₂ := by + rw [← hf_img_col₂] + exact ⟨GluedSpace.inr hb_inj q, ⟨q, hq, rfl⟩, rfl⟩ + by_contra hnot_Λ₂ + have hbd : f_XII (GluedSpace.inr hb_inj q) ∈ subBd Λ₂ := by + rw [subBd_eq_frontier, hΛ₂_open.frontier_eq] + exact ⟨hmem_col.1, hnot_Λ₂⟩ + let z := g₂.symm ⟨f_XII (GluedSpace.inr hb_inj q), hbd⟩ + have hcz : cMap₂ (0, z) = cMap₂ (2 - q.1.1, q.1.2) := by + rw [hcMap₂_zero z, ← hf_inr_two q hq_not] + exact congrArg Subtype.val (g₂.apply_symm_apply ⟨f_XII (GluedSpace.inr hb_inj q), hbd⟩) + have hinj := hcMap₂_inj ⟨le_rfl, (hδ₂_bd z).1⟩ + ⟨by linarith [q.2.1.2], by linarith [show 2 - δ₂ q.1.2 ≤ q.1.1 from hq]⟩ hcz + have : (0 : ℝ) = 2 - q.1.1 := congrArg Prod.fst hinj + linarith + +private theorem handle_map_complement_has_original_preimage + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (δ₁ δ₂ : Circle → ℝ) + (f_XII : (GluedSpace hb_inj) → S) + (hcol₁_interior : ∀ q ∈ ({q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2}), 1 < q.1.1 → f_XII + (GluedSpace.inr hb_inj q) ∈ Λ₁) + (hcol₂_interior : ∀ q ∈ ({q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1}), q.1.1 < 2 → f_XII + (GluedSpace.inr hb_inj q) ∈ Λ₂) : + ∀ x ∈ ((range (GluedSpace.inl hb_inj)) ∪ (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | + q.1.1 ≤ 1 + δ₁ q.1.2})) ∪ (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ + q.1.1}))), f_XII x ∈ univ \ (Λ₁ ∪ Λ₂) → x ∈ (range (GluedSpace.inl hb_inj)) := by + let b := handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let A_col₁ := {q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2} + let A_col₂ := {q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1} + let C_col₁ := GluedSpace.inr hb_inj '' A_col₁ + let C_col₂ := GluedSpace.inr hb_inj '' A_col₂ + let P₁_XII := S₁ ∪ C_col₁ ∪ C_col₂ + rintro x ((hx | ⟨q, hq, rfl⟩) | ⟨q, hq, rfl⟩) hfx + · exact hx + · rcases eq_or_lt_of_le q.2.1.1 with hr1 | hr1 + · have hq_bd : q ∈ bd ↥ClosedCylinder := by + rw [bd_cylinder] + left + refine ⟨q.1.2, ?_⟩ + ext + · exact hr1 + · rfl + exact ⟨b ⟨q, hq_bd⟩, (GluedSpace.inl_eq_inr hb_inj).mpr ⟨hq_bd, rfl⟩⟩ + · exact (hfx.2 (.inl (hcol₁_interior q hq hr1))).elim + · rcases eq_or_lt_of_le q.2.1.2 with hr2 | hr2 + · have hq_bd : q ∈ bd ↥ClosedCylinder := by + rw [bd_cylinder] + right + refine ⟨q.1.2, ?_⟩ + ext + · exact hr2.symm + · rfl + exact ⟨b ⟨q, hq_bd⟩, (GluedSpace.inl_eq_inr hb_inj).mpr ⟨hq_bd, rfl⟩⟩ + · exact (hfx.2 (.inr (hcol₂_interior q hq hr2))).elim + +private theorem handle_map_injective_on_complement + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (δ₁ : Circle → ℝ) + (D₁ : Set S) + (cMap₁ : ℝ × Circle → S) + (hδ₁_bd : ∀ (z : Circle), 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (hcMap₁_inj : InjOn cMap₁ {p | 0 ≤ p.1 ∧ p.1 ≤ δ₁ p.2}) + (δ₂ : Circle → ℝ) + (D₂ : Set S) + (cMap₂ : ℝ × Circle → S) + (hδ₂_bd : ∀ (z : Circle), 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) + (hcMap₂_inj : InjOn cMap₂ {p | 0 ≤ p.1 ∧ p.1 ≤ δ₂ p.2}) + (f_XII : (GluedSpace hb_inj) → S) + (hf_inl : ∀ y, f_XII (GluedSpace.inl hb_inj y) = y.1) + (hf_inr_one : ∀ (q : ↑ClosedCylinder), q.1.1 ≤ 3 / 2 → f_XII (GluedSpace.inr hb_inj q) = + cMap₁ (q.1.1 - 1, q.1.2)) + (hf_inr_two : ∀ (q : ↑ClosedCylinder), ¬q.1.1 ≤ 3 / 2 → f_XII (GluedSpace.inr hb_inj q) = + cMap₂ (2 - q.1.1, q.1.2)) + (hf_img_col₁ : f_XII '' (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ + q.1.2})) = closure Λ₁ \ D₁) + (hf_img_col₂ : f_XII '' (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ + q.1.1})) = closure Λ₂ \ D₂) + (hf_mem_S₁_of_compl : ∀ x ∈ ((range (GluedSpace.inl hb_inj)) ∪ (GluedSpace.inr hb_inj '' ({q : + ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2})) ∪ (GluedSpace.inr hb_inj '' ({q : ClosedCylinder + | 2 - δ₂ q.1.2 ≤ q.1.1}))), f_XII x ∈ univ \ (Λ₁ ∪ Λ₂) → x ∈ (range (GluedSpace.inl + hb_inj))) : + let E := ((range (GluedSpace.inl hb_inj)) ∪ (GluedSpace.inr hb_inj '' + ({q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2})) ∪ (GluedSpace.inr hb_inj '' + ({q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1}))) + Injective (fun x : ↥E => f_XII x.1) := by + dsimp only + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let A_col₁ := {q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2} + let A_col₂ := {q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1} + let C_col₁ := GluedSpace.inr hb_inj '' A_col₁ + let C_col₂ := GluedSpace.inr hb_inj '' A_col₂ + let P₁_XII := S₁ ∪ C_col₁ ∪ C_col₂ + let ι_XII : ↥P₁_XII → S := fun x => f_XII x.1 + intro ⟨x₁, hx₁⟩ ⟨x₂, hx₂⟩ hfx + apply Subtype.ext + change f_XII x₁ = f_XII x₂ at hfx + have hcol₁_inj : Set.InjOn f_XII C_col₁ := by + rintro _ ⟨q₁, hq₁, rfl⟩ _ ⟨q₂, hq₂, rfl⟩ heq + have hq₁_le : q₁.1.1 ≤ 3 / 2 := by + linarith [(hδ₁_bd q₁.1.2).2, show q₁.1.1 ≤ 1 + δ₁ q₁.1.2 from hq₁] + have hq₂_le : q₂.1.1 ≤ 3 / 2 := by + linarith [(hδ₁_bd q₂.1.2).2, show q₂.1.1 ≤ 1 + δ₁ q₂.1.2 from hq₂] + rw [hf_inr_one q₁ hq₁_le, hf_inr_one q₂ hq₂_le] at heq + have hq₁_bound : q₁.1.1 ≤ 1 + δ₁ q₁.1.2 := hq₁ + have hq₂_bound : q₂.1.1 ≤ 1 + δ₁ q₂.1.2 := hq₂ + have hp := hcMap₁_inj ⟨by linarith [q₁.2.1.1], by linarith⟩ + ⟨by linarith [q₂.2.1.1], by linarith⟩ heq + have h1 := Prod.ext_iff.mp hp + have hq_eq : q₁ = q₂ := Subtype.ext (Prod.ext (by dsimp at h1; linarith [h1.1]) h1.2) + rw [hq_eq] + have hcol₂_inj : Set.InjOn f_XII C_col₂ := by + rintro _ ⟨q₁, hq₁, rfl⟩ _ ⟨q₂, hq₂, rfl⟩ heq + have hq₁_not : ¬ q₁.1.1 ≤ 3 / 2 := by + linarith [(hδ₂_bd q₁.1.2).2, show 2 - δ₂ q₁.1.2 ≤ q₁.1.1 from hq₁] + have hq₂_not : ¬ q₂.1.1 ≤ 3 / 2 := by + linarith [(hδ₂_bd q₂.1.2).2, show 2 - δ₂ q₂.1.2 ≤ q₂.1.1 from hq₂] + rw [hf_inr_two q₁ hq₁_not, hf_inr_two q₂ hq₂_not] at heq + have hp := hcMap₂_inj ⟨by linarith [q₁.2.1.2], by linarith [show 2 - δ₂ q₁.1.2 + ≤ q₁.1.1 from hq₁]⟩ + ⟨by linarith [q₂.2.1.2], by linarith [show 2 - δ₂ q₂.1.2 ≤ q₂.1.1 from hq₂]⟩ heq + have h1 := Prod.ext_iff.mp hp + have hq_eq : q₁ = q₂ := Subtype.ext (Prod.ext (by dsimp at h1; linarith [h1.1]) h1.2) + rw [hq_eq] + by_cases hfx_compl : f_XII x₁ ∈ univ \ (Λ₁ ∪ Λ₂) + · obtain ⟨y₁, rfl⟩ := hf_mem_S₁_of_compl x₁ hx₁ hfx_compl + obtain ⟨y₂, rfl⟩ := hf_mem_S₁_of_compl x₂ hx₂ (hfx ▸ hfx_compl) + rw [hf_inl, hf_inl] at hfx + exact congrArg (GluedSpace.inl hb_inj) (Subtype.ext hfx) + · have h_in_12 : f_XII x₁ ∈ Λ₁ ∪ Λ₂ := by + by_contra hnot + exact hfx_compl ⟨mem_univ _, hnot⟩ + rcases h_in_12 with h_in_1 | h_in_2 + · have hx₁_col₁ : x₁ ∈ C_col₁ := by + rcases hx₁ with (⟨y, rfl⟩ | hx₁_col₁) | hx₁_col₂ + · rw [hf_inl] at h_in_1 + exact (y.2.2 (.inl h_in_1)).elim + · exact hx₁_col₁ + · have h_cl2 : f_XII x₁ ∈ closure Λ₂ \ D₂ := + hf_img_col₂ ▸ mem_image_of_mem f_XII hx₁_col₂ + exact (Set.disjoint_left.mp hd (subset_closure h_in_1) h_cl2.1).elim + have hx₂_col₁ : x₂ ∈ C_col₁ := by + have h_in_1' : f_XII x₂ ∈ Λ₁ := hfx ▸ h_in_1 + rcases hx₂ with (⟨y, rfl⟩ | hx₂_col₁) | hx₂_col₂ + · rw [hf_inl] at h_in_1' + exact (y.2.2 (.inl h_in_1')).elim + · exact hx₂_col₁ + · have h_cl2 : f_XII x₂ ∈ closure Λ₂ \ D₂ := + hf_img_col₂ ▸ mem_image_of_mem f_XII hx₂_col₂ + exact (Set.disjoint_left.mp hd (subset_closure h_in_1') h_cl2.1).elim + exact hcol₁_inj hx₁_col₁ hx₂_col₁ hfx + · have hx₁_col₂ : x₁ ∈ C_col₂ := by + rcases hx₁ with (⟨y, rfl⟩ | hx₁_col₁) | hx₁_col₂ + · rw [hf_inl] at h_in_2 + exact (y.2.2 (.inr h_in_2)).elim + · have h_cl1 : f_XII x₁ ∈ closure Λ₁ \ D₁ := + hf_img_col₁ ▸ mem_image_of_mem f_XII hx₁_col₁ + exact (Set.disjoint_left.mp hd h_cl1.1 (subset_closure h_in_2)).elim + · exact hx₁_col₂ + have hx₂_col₂ : x₂ ∈ C_col₂ := by + have h_in_2' : f_XII x₂ ∈ Λ₂ := hfx ▸ h_in_2 + rcases hx₂ with (⟨y, rfl⟩ | hx₂_col₁) | hx₂_col₂ + · rw [hf_inl] at h_in_2' + exact (y.2.2 (.inr h_in_2')).elim + · have h_cl1 : f_XII x₂ ∈ closure Λ₁ \ D₁ := + hf_img_col₁ ▸ mem_image_of_mem f_XII hx₂_col₁ + exact (Set.disjoint_left.mp hd h_cl1.1 (subset_closure h_in_2')).elim + · exact hx₂_col₂ + exact hcol₂_inj hx₁_col₂ hx₂_col₂ hfx + +private theorem pinched_cylinder_maps_onto_middle_strip + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (δ₁ : Circle → ℝ) + (δ₂ : Circle → ℝ) + (e_pinch : ↑ClosedCylinder ≃ₜ ↑{p : ClosedCylinder | 1 + δ₁ p.1.2 ≤ p.1.1 ∧ p.1.1 + ≤ 2 - δ₂ p.1.2}) : + range (fun p : ClosedCylinder => GluedSpace.inr hb_inj ↑(e_pinch p)) = + (GluedSpace.inr hb_inj '' ({q : + ClosedCylinder | 1 + δ₁ q.1.2 ≤ q.1.1 ∧ q.1.1 ≤ 2 - δ₂ q.1.2})) := by + let S' := GluedSpace hb_inj + let A_mid := {q : ClosedCylinder | 1 + δ₁ q.1.2 ≤ q.1.1 ∧ q.1.1 ≤ 2 - δ₂ q.1.2} + let P₂_XII := GluedSpace.inr hb_inj '' A_mid + let j_P₂ := fun p : ClosedCylinder => GluedSpace.inr hb_inj ↑(e_pinch p) + ext x + constructor + · rintro ⟨p, rfl⟩ + exact ⟨(e_pinch p).1, (e_pinch p).2, rfl⟩ + · rintro ⟨q, hq, rfl⟩ + exact ⟨e_pinch.symm ⟨q, hq⟩, by dsimp [j_P₂]; rw [e_pinch.apply_symm_apply]⟩ + +private theorem handle_pieces_cover_glued_surface + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (hU_eq : range (GluedSpace.inl hb_inj) ∪ range (GluedSpace.inr hb_inj) = univ) + (δ₁ : Circle → ℝ) + (δ₂ : Circle → ℝ) : + ((range (GluedSpace.inl hb_inj)) ∪ (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 ≤ 1 + + δ₁ q.1.2})) ∪ (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1}))) + ∪ (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | 1 + δ₁ q.1.2 ≤ q.1.1 ∧ q.1.1 ≤ 2 - δ₂ + q.1.2})) = univ := by + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let S₂ := range (GluedSpace.inr hb_inj) + let A_col₁ := {q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2} + let A_col₂ := {q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1} + let A_mid := {q : ClosedCylinder | 1 + δ₁ q.1.2 ≤ q.1.1 ∧ q.1.1 ≤ 2 - δ₂ q.1.2} + let C_col₁ := GluedSpace.inr hb_inj '' A_col₁ + let C_col₂ := GluedSpace.inr hb_inj '' A_col₂ + let P₁_XII := S₁ ∪ C_col₁ ∪ C_col₂ + let P₂_XII := GluedSpace.inr hb_inj '' A_mid + ext x + refine ⟨fun _ => mem_univ _, fun _ => ?_⟩ + obtain hx1 | ⟨q, rfl⟩ : x ∈ S₁ ∪ S₂ := hU_eq.symm ▸ mem_univ x + · exact .inl (.inl (.inl hx1)) + · by_cases h1 : q.1.1 ≤ 1 + δ₁ q.1.2 + · exact .inl (.inl (.inr ⟨q, h1, rfl⟩)) + · by_cases h2 : 2 - δ₂ q.1.2 ≤ q.1.1 + · exact .inl (.inr ⟨q, h2, rfl⟩) + · exact .inr ⟨q, ⟨le_of_not_ge h1, le_of_not_ge h2⟩, rfl⟩ + +private theorem handle_pieces_meet_at_pinched_cuffs + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (δ₁ : Circle → ℝ) + (hδ₁_bd : ∀ (z : Circle), 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (δ₂ : Circle → ℝ) + (hδ₂_bd : ∀ (z : Circle), 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) + (hiUnion2 : ∀ {α : Type w} (f : Fin 2 → Set α), ⋃ i, f i = f 0 ∪ f 1) + (hC0_sub_P₁ : (![GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2}), + GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2})]) 0 ⊆ ((range + (GluedSpace.inl hb_inj)) ∪ (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ + q.1.2})) ∪ (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1})))) + (hC1_sub_P₁ : (![GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2}), + GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2})]) 1 ⊆ ((range + (GluedSpace.inl hb_inj)) ∪ (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ + q.1.2})) ∪ (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1})))) : + ((range (GluedSpace.inl hb_inj)) ∪ (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 ≤ 1 + + δ₁ q.1.2})) ∪ (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1}))) + ∩ (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | 1 + δ₁ q.1.2 ≤ q.1.1 ∧ q.1.1 ≤ 2 - δ₂ + q.1.2})) = ⋃ i, (![GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 1 + δ₁ + q.1.2}), GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2})]) i := by + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let A_col₁ := {q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2} + let A_col₂ := {q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1} + let A_mid := {q : ClosedCylinder | 1 + δ₁ q.1.2 ≤ q.1.1 ∧ q.1.1 ≤ 2 - δ₂ q.1.2} + let A_cuff₁ := {q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2} + let A_cuff₂ := {q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2} + let C_col₁ := GluedSpace.inr hb_inj '' A_col₁ + let C_col₂ := GluedSpace.inr hb_inj '' A_col₂ + let P₁_XII := S₁ ∪ C_col₁ ∪ C_col₂ + let P₂_XII := GluedSpace.inr hb_inj '' A_mid + let C_XII := ![GluedSpace.inr hb_inj '' A_cuff₁, GluedSpace.inr hb_inj '' A_cuff₂] + rw [hiUnion2 C_XII] + ext x + constructor + · rintro ⟨hx1, ⟨q, hq_mid, rfl⟩⟩ + rcases hx1 with (⟨y, hy_eq⟩ | ⟨q₁, hq₁, he₁⟩) | ⟨q₂, hq₂, he₂⟩ + · obtain ⟨hq_bd, _⟩ := (GluedSpace.inl_eq_inr hb_inj).mp hy_eq + rcases handleGlueMap_fst_eq_one_or_two ⟨q, hq_bd⟩ with hr1 | hr2 + · left + refine ⟨q, ?_, rfl⟩ + change q.1.1 = 1 + δ₁ q.1.2 + linarith [hr1, hq_mid.1, (hδ₁_bd q.1.2).1] + · right + refine ⟨q, ?_, rfl⟩ + change q.1.1 = 2 - δ₂ q.1.2 + linarith [hr2, hq_mid.2, (hδ₂_bd q.1.2).1] + · obtain rfl := GluedSpace.inr_injective hb_inj he₁ + left + exact ⟨q₁, le_antisymm hq₁ hq_mid.1, rfl⟩ + · obtain rfl := GluedSpace.inr_injective hb_inj he₂ + right + exact ⟨q₂, le_antisymm hq_mid.2 hq₂, rfl⟩ + · rintro (⟨q, hq, rfl⟩ | ⟨q, hq, rfl⟩) + · refine ⟨hC0_sub_P₁ ⟨q, hq, rfl⟩, ⟨q, ⟨le_of_eq hq.symm, ?_⟩, rfl⟩⟩ + linarith [show q.1.1 = 1 + δ₁ q.1.2 from hq, (hδ₁_bd q.1.2).2, (hδ₂_bd q.1.2).2] + · refine ⟨hC1_sub_P₁ ⟨q, hq, rfl⟩, ⟨q, ⟨?_, le_of_eq hq⟩, rfl⟩⟩ + linarith [show q.1.1 = 2 - δ₂ q.1.2 from hq, (hδ₁_bd q.1.2).2, (hδ₂_bd q.1.2).2] + +private theorem handle_map_image_of_lower_pinched_cuff + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (δ₁ : Circle → ℝ) + (D₁ : Set S) + (cMap₁ : ℝ × Circle → S) + (hδ₁_bd : ∀ (z : Circle), 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (hcMap₁_bd : cMap₁ '' {p | p.1 = δ₁ p.2} = subBd D₁) + (C_XII : Fin 2 → Set (GluedSpace hb_inj)) + (hC : C_XII 0 = GluedSpace.inr hb_inj '' {q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2}) + (f_XII : (GluedSpace hb_inj) → S) + (hf_inr_one : ∀ (q : ↑ClosedCylinder), q.1.1 ≤ 3 / 2 → f_XII (GluedSpace.inr hb_inj q) = + cMap₁ (q.1.1 - 1, q.1.2)) : + f_XII '' C_XII 0 = subBd D₁ := by + rw [hC] + let S' := GluedSpace hb_inj + let A_cuff₁ := {q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2} + change f_XII '' (GluedSpace.inr hb_inj '' A_cuff₁) = subBd D₁ + rw [← hcMap₁_bd] + ext y + constructor + · rintro ⟨_, ⟨q, hq, rfl⟩, rfl⟩ + have hq_le : q.1.1 ≤ 3 / 2 := by linarith [(hδ₁_bd q.1.2).2, show q.1.1 = 1 + δ₁ q.1.2 from hq] + rw [hf_inr_one q hq_le] + exact ⟨(q.1.1 - 1, q.1.2), by dsimp; linarith [show q.1.1 = 1 + δ₁ q.1.2 from hq], rfl⟩ + · rintro ⟨p, hp_eq, rfl⟩ + have hp_eq' : p.1 = δ₁ p.2 := hp_eq + have hr : 1 + p.1 ∈ Icc (1 : ℝ) 2 := + ⟨by linarith [hp_eq', (hδ₁_bd p.2).1], by linarith [hp_eq', (hδ₁_bd p.2).2]⟩ + let q : ClosedCylinder := ⟨(1 + p.1, p.2), hr, mem_univ _⟩ + have hq_cuff : q ∈ A_cuff₁ := by dsimp [A_cuff₁, q]; linarith + have hq_le : q.1.1 ≤ 3 / 2 := by dsimp [q]; linarith [hp_eq', (hδ₁_bd p.2).2] + refine ⟨GluedSpace.inr hb_inj q, ⟨q, hq_cuff, rfl⟩, ?_⟩ + rw [hf_inr_one q hq_le] + dsimp [q] + rw [add_sub_cancel_left] + +private theorem handle_map_image_of_upper_pinched_cuff + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (δ₂ : Circle → ℝ) + (D₂ : Set S) + (cMap₂ : ℝ × Circle → S) + (hδ₂_bd : ∀ (z : Circle), 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) + (hcMap₂_bd : cMap₂ '' {p | p.1 = δ₂ p.2} = subBd D₂) + (C_XII : Fin 2 → Set (GluedSpace hb_inj)) + (hC : C_XII 1 = GluedSpace.inr hb_inj '' {q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2}) + (f_XII : (GluedSpace hb_inj) → S) + (hf_inr_two : ∀ (q : ↑ClosedCylinder), ¬q.1.1 ≤ 3 / 2 → f_XII (GluedSpace.inr hb_inj q) = + cMap₂ (2 - q.1.1, q.1.2)) : + f_XII '' C_XII 1 = subBd D₂ := by + rw [hC] + let S' := GluedSpace hb_inj + let A_cuff₂ := {q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2} + change f_XII '' (GluedSpace.inr hb_inj '' A_cuff₂) = subBd D₂ + rw [← hcMap₂_bd] + ext y + constructor + · rintro ⟨_, ⟨q, hq, rfl⟩, rfl⟩ + have hq_not : ¬ q.1.1 ≤ 3 / 2 := by + linarith [(hδ₂_bd q.1.2).2, show q.1.1 = 2 - δ₂ q.1.2 from hq] + rw [hf_inr_two q hq_not] + exact ⟨(2 - q.1.1, q.1.2), by dsimp; linarith [show q.1.1 = 2 - δ₂ q.1.2 from hq], rfl⟩ + · rintro ⟨p, hp_eq, rfl⟩ + have hp_eq' : p.1 = δ₂ p.2 := hp_eq + have hr : 2 - p.1 ∈ Icc (1 : ℝ) 2 := + ⟨by linarith [hp_eq', (hδ₂_bd p.2).2], by linarith [hp_eq', (hδ₂_bd p.2).1]⟩ + let q : ClosedCylinder := ⟨(2 - p.1, p.2), hr, mem_univ _⟩ + have hq_cuff : q ∈ A_cuff₂ := by dsimp [A_cuff₂, q]; linarith + have hq_not : ¬ q.1.1 ≤ 3 / 2 := by dsimp [q]; linarith [hp_eq', (hδ₂_bd p.2).2] + refine ⟨GluedSpace.inr hb_inj q, ⟨q, hq_cuff, rfl⟩, ?_⟩ + rw [hf_inr_two q hq_not] + dsimp [q] + rw [sub_sub_cancel] + +private theorem pinched_cylinder_maps_lower_cuff + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (δ₁ : Circle → ℝ) + (hδ₁_cont : Continuous δ₁) + (hδ₁_bd : ∀ (z : Circle), 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (δ₂ : Circle → ℝ) + (hδ₂_cont : Continuous δ₂) + (hδ₂_bd : ∀ (z : Circle), 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) + (C_XII : Fin 2 → Set (GluedSpace hb_inj)) + (hC : C_XII 0 = GluedSpace.inr hb_inj '' {q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2}) + (e_pinch : ↑ClosedCylinder ≃ₜ ↑{p : ClosedCylinder | 1 + δ₁ p.1.2 ≤ p.1.1 ∧ p.1.1 + ≤ 2 - δ₂ p.1.2}) + (he_pinch : e_pinch = pinchCylHomeo hδ₁_cont hδ₂_cont hδ₁_bd hδ₂_bd) + (m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2) : + (fun p => GluedSpace.inr hb_inj ↑(e_pinch p)) '' range (cylEnd 1 m1) = C_XII 0 := by + rw [hC] + subst e_pinch + let e_pinch := pinchCylHomeo hδ₁_cont hδ₂_cont hδ₁_bd hδ₂_bd + let S' := GluedSpace hb_inj + let A_cuff₁ := {q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2} + let j_P₂ := fun p : ClosedCylinder => GluedSpace.inr hb_inj ↑(e_pinch p) + change j_P₂ '' range (cylEnd 1 m1) = GluedSpace.inr hb_inj '' A_cuff₁ + ext x + constructor + · rintro ⟨_, ⟨z, rfl⟩, rfl⟩ + refine ⟨(e_pinch (cylEnd 1 m1 z)).1, ?_, rfl⟩ + change ((e_pinch (cylEnd 1 m1 z)).1 : ClosedCylinder).1.1 = + 1 + δ₁ ((e_pinch (cylEnd 1 m1 z)).1 : ClosedCylinder).1.2 + rw [pinchCylHomeo_cylEnd_one] + · rintro ⟨q, hq, rfl⟩ + refine ⟨cylEnd 1 m1 q.1.2, ⟨q.1.2, rfl⟩, ?_⟩ + dsimp [j_P₂] + congr 1 + apply Subtype.ext + rw [pinchCylHomeo_cylEnd_one] + exact Prod.ext (show 1 + δ₁ q.1.2 = q.1.1 from hq.symm) rfl + +private theorem pinched_cylinder_maps_upper_cuff + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (δ₁ : Circle → ℝ) + (hδ₁_cont : Continuous δ₁) + (hδ₁_bd : ∀ (z : Circle), 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (δ₂ : Circle → ℝ) + (hδ₂_cont : Continuous δ₂) + (hδ₂_bd : ∀ (z : Circle), 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) + (C_XII : Fin 2 → Set (GluedSpace hb_inj)) + (hC : C_XII 1 = GluedSpace.inr hb_inj '' {q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2}) + (e_pinch : ↑ClosedCylinder ≃ₜ ↑{p : ClosedCylinder | 1 + δ₁ p.1.2 ≤ p.1.1 ∧ p.1.1 + ≤ 2 - δ₂ p.1.2}) + (he_pinch : e_pinch = pinchCylHomeo hδ₁_cont hδ₂_cont hδ₁_bd hδ₂_bd) + (m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2) : + (fun p => GluedSpace.inr hb_inj ↑(e_pinch p)) '' range (cylEnd 2 m2) = C_XII 1 := by + rw [hC] + subst e_pinch + let e_pinch := pinchCylHomeo hδ₁_cont hδ₂_cont hδ₁_bd hδ₂_bd + let S' := GluedSpace hb_inj + let A_cuff₂ := {q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2} + let j_P₂ := fun p : ClosedCylinder => GluedSpace.inr hb_inj ↑(e_pinch p) + change j_P₂ '' range (cylEnd 2 m2) = GluedSpace.inr hb_inj '' A_cuff₂ + ext x + constructor + · rintro ⟨_, ⟨z, rfl⟩, rfl⟩ + refine ⟨(e_pinch (cylEnd 2 m2 z)).1, ?_, rfl⟩ + change ((e_pinch (cylEnd 2 m2 z)).1 : ClosedCylinder).1.1 = + 2 - δ₂ ((e_pinch (cylEnd 2 m2 z)).1 : ClosedCylinder).1.2 + rw [pinchCylHomeo_cylEnd_two] + · rintro ⟨q, hq, rfl⟩ + refine ⟨cylEnd 2 m2 q.1.2, ⟨q.1.2, rfl⟩, ?_⟩ + dsimp [j_P₂] + congr 1 + apply Subtype.ext + rw [pinchCylHomeo_cylEnd_two] + exact Prod.ext (show 2 - δ₂ q.1.2 = q.1.1 from hq.symm) rfl + +private theorem handle_complement_boundary_is_cuff_union + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (D₁ : Set S) + (hD₁_open : IsOpen D₁) + (hD₁_sub : D₁ ⊆ Λ₁) + (D₂ : Set S) + (hD₂_open : IsOpen D₂) + (hD₂_sub : D₂ ⊆ Λ₂) + (hcl_D₁_sub : closure D₁ ⊆ closure Λ₁) + (hcl_D₂_sub : closure D₂ ⊆ closure Λ₂) + (P₁_XII : Set (GluedSpace hb_inj)) + (C_XII : Fin 2 → Set (GluedSpace hb_inj)) + (f_XII : (GluedSpace hb_inj) → S) + (hf_img_C0 : f_XII '' C_XII 0 = subBd D₁) + (hf_img_C1 : f_XII '' C_XII 1 = subBd D₂) + (e_P₁ : ↑P₁_XII ≃ₜ ↑(univ \ (D₁ ∪ D₂))) + (he_P₁ : ∀ x, (e_P₁ x).1 = f_XII x.1) + (hXD_bd : bd ↑(univ \ (D₁ ∪ D₂)) = Subtype.val ⁻¹' (subBd D₁ ∪ subBd D₂)) + (hiUnion2 : ∀ {α : Type w} (f : Fin 2 → Set α), ⋃ i, f i = f 0 ∪ f 1) + (hC0_sub_P₁ : C_XII 0 ⊆ P₁_XII) + (hC1_sub_P₁ : C_XII 1 ⊆ P₁_XII) + (hf_injOn_P₁ : InjOn f_XII P₁_XII) : + Subtype.val '' bd ↑P₁_XII = ⋃ i, C_XII i := by + let S' := GluedSpace hb_inj + rw [hiUnion2 C_XII] + have hsub1 : Subtype.val '' bd ↥P₁_XII ⊆ P₁_XII := by + rintro _ ⟨x, _, rfl⟩ + exact x.2 + have hsub2 : C_XII 0 ∪ C_XII 1 ⊆ P₁_XII := union_subset hC0_sub_P₁ hC1_sub_P₁ + refine (hf_injOn_P₁.image_eq_image_iff hsub1 hsub2).mp ?_ + rw [image_union, hf_img_C0, hf_img_C1] + have hbd_e : e_P₁ '' bd ↥P₁_XII = bd ↥(univ \ (D₁ ∪ D₂) : Set S) := + image_bd_homeomorph e_P₁ + calc f_XII '' (Subtype.val '' bd ↥P₁_XII) + _ = Subtype.val '' (e_P₁ '' bd ↥P₁_XII) := by + rw [← image_comp, ← image_comp] + exact congrArg (fun f => f '' bd ↥P₁_XII) (funext fun x => (he_P₁ x).symm) + _ = Subtype.val '' bd ↥(univ \ (D₁ ∪ D₂) : Set S) := by rw [hbd_e] + _ = subBd D₁ ∪ subBd D₂ := by + rw [hXD_bd, Subtype.image_preimage_coe] + refine inter_eq_right.mpr (union_subset ?_ ?_) + · rw [subBd_eq_frontier, hD₁_open.frontier_eq] + exact fun x hx => ⟨mem_univ _, fun h => h.elim hx.2 fun h2 => + Set.disjoint_left.mp hd (hcl_D₁_sub hx.1) (subset_closure (hD₂_sub h2))⟩ + · rw [subBd_eq_frontier, hD₂_open.frontier_eq] + exact fun x hx => ⟨mem_univ _, fun h => h.elim (fun h1 => + Set.disjoint_left.mp hd (subset_closure (hD₁_sub h1)) (hcl_D₂_sub hx.1)) hx.2⟩ + +private theorem handle_map_image_of_complement + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (D₁ : Set S) + (hD₁_sub : D₁ ⊆ Λ₁) + (D₂ : Set S) + (hD₂_sub : D₂ ⊆ Λ₂) + (S' : Type w) + (P₁_XII : Set S') + (f_XII : S' → S) + (hf_img_P₁ : f_XII '' P₁_XII = closure Λ₁ \ D₁ ∪ univ \ (Λ₁ ∪ Λ₂) ∪ closure Λ₂ \ D₂) : + f_XII '' P₁_XII = univ \ (D₁ ∪ D₂) := by + rw [hf_img_P₁] + ext y + constructor + · rintro ((hy | hy) | hy) + · exact ⟨mem_univ _, fun h => h.elim hy.2 fun h2 => + Set.disjoint_left.mp hd hy.1 (subset_closure (hD₂_sub h2))⟩ + · exact ⟨mem_univ _, fun h => hy.2 (h.imp (fun h1 => hD₁_sub h1) (fun h2 => hD₂_sub h2))⟩ + · exact ⟨mem_univ _, fun h => h.elim (fun h1 => + Set.disjoint_left.mp hd (subset_closure (hD₁_sub h1)) hy.1) hy.2⟩ + · rintro ⟨_, hy⟩ + by_cases hy1 : y ∈ Λ₁ + · exact .inl (.inl ⟨subset_closure hy1, fun h1 => hy (.inl h1)⟩) + · by_cases hy2 : y ∈ Λ₂ + · exact .inr ⟨subset_closure hy2, fun h2 => hy (.inr h2)⟩ + · exact .inl (.inr ⟨mem_univ _, fun h => h.elim hy1 hy2⟩) + +private theorem union_two_indexed_sets : ∀ {α : Type w} (f : Fin 2 → Set α), (⋃ i : Fin 2, f i) + = f 0 ∪ f 1 := by + intro α f + ext x + simp [Fin.exists_fin_two] + +private theorem pinched_handle_forms_capped_split + {S : Type w} + [TopologicalSpace S] + (hS : IsClosedSurface S) + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (hS' : IsClosedSurface (GluedSpace hb_inj)) + [hConn' : ConnectedSpace (GluedSpace hb_inj)] + (δ₁ : Circle → ℝ) + (D₁ : Set S) + (hδ₁_bd : ∀ (z : Circle), 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (δ₂ : Circle → ℝ) + (D₂ : Set S) + (hδ₂_bd : ∀ (z : Circle), 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) + (hd_D : Disjoint (closure D₁) (closure D₂)) + (hD₁_disc : IsOpenDisc D₁) + (hD₂_disc : IsOpenDisc D₂) + (P₁_XII : Set (GluedSpace hb_inj)) + (P₂_XII : Set (GluedSpace hb_inj)) + (f_XII : (GluedSpace hb_inj) → S) + (hf_img_C0 : f_XII '' (![GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 1 + δ₁ + q.1.2}), GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2})]) 0 = subBd + D₁) + (hf_img_C1 : f_XII '' (![GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 1 + δ₁ + q.1.2}), GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2})]) 1 = subBd + D₂) + (hι_XII_emb : IsClosedEmbedding (fun x : ↥P₁_XII => f_XII x.1)) + (hι_XII_range : range (fun x : ↥P₁_XII => f_XII x.1) = univ \ (D₁ ∪ D₂)) + (hP₁_surf : IsSurface ↑P₁_XII) + (j_P₂ : ↑ClosedCylinder → (GluedSpace hb_inj)) + (hj_P₂_emb : IsClosedEmbedding j_P₂) + (hP₂_surf : IsSurface ↑P₂_XII) + (m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2) + (m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2) + (hj_P₂_cuff₁ : j_P₂ '' range (cylEnd 1 m1) = (![GluedSpace.inr hb_inj '' ({q : ClosedCylinder + | q.1.1 = 1 + δ₁ q.1.2}), GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 2 - δ₂ + q.1.2})]) 0) + (hj_P₂_cuff₂ : j_P₂ '' range (cylEnd 2 m2) = (![GluedSpace.inr hb_inj '' ({q : ClosedCylinder + | q.1.1 = 1 + δ₁ q.1.2}), GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 2 - δ₂ + q.1.2})]) 1) + (hiUnion2 : ∀ {α : Type w} (f : Fin 2 → Set α), ⋃ i, f i = f 0 ∪ f 1) + (hbd_P₂ : Subtype.val '' bd ↑P₂_XII = ⋃ i, (![GluedSpace.inr hb_inj '' ({q : ClosedCylinder | + q.1.1 = 1 + δ₁ q.1.2}), GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 2 - δ₂ + q.1.2})]) i) + (hC0_sub_P₁ : (![GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2}), + GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2})]) 0 ⊆ P₁_XII) + (hC1_sub_P₁ : (![GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2}), + GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2})]) 1 ⊆ P₁_XII) + (hP12_union : P₁_XII ∪ P₂_XII = univ) + (hP12_inter : P₁_XII ∩ P₂_XII = ⋃ i, (![GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 + = 1 + δ₁ q.1.2}), GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2})]) + i) + (hbd_P₁ : Subtype.val '' bd ↑P₁_XII = ⋃ i, (![GluedSpace.inr hb_inj '' ({q : ClosedCylinder | + q.1.1 = 1 + δ₁ q.1.2}), GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 2 - δ₂ + q.1.2})]) i) : + GM12.IsCappedSplit (![GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2}), + GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2})]) P₁_XII P₂_XII (fun + x : ↥P₁_XII => f_XII x.1) ![D₁, D₂] := by + let S' := GluedSpace hb_inj + let A_cuff₁ := {q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2} + let A_cuff₂ := {q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2} + let C_XII := ![GluedSpace.inr hb_inj '' A_cuff₁, GluedSpace.inr hb_inj '' A_cuff₂] + let ι_XII := fun x : ↥P₁_XII => f_XII x.1 + refine + { surface := ⟨hS', hConn'⟩ + isOArc := ?_ + disjoint := ?_ + manifold₁ := hP₁_surf + manifold₂ := hP₂_surf + union := hP12_union + inter := hP12_inter + bd₁ := hbd_P₁ + bd₂ := hbd_P₂ + surface_hat := hS + isEmbedding := hι_XII_emb.isEmbedding + isOpenDisc := fun i => by fin_cases i <;> [exact hD₁_disc; exact hD₂_disc] + bounds := ?_ + disjoint_D := fun i j hij => by + fin_cases i <;> fin_cases j + · exact (hij rfl).elim + · exact hd_D.mono subset_closure subset_closure + · exact hd_D.symm.mono subset_closure subset_closure + · exact (hij rfl).elim + compl := ?_ } + · intro i + fin_cases i + · change IsOArc (C_XII 0) + apply (congrArg IsOArc hj_P₂_cuff₁).mp + exact isOArc_image hj_P₂_emb.isEmbedding ⟨(isEmbedding_cylEnd 1 m1).toHomeomorph⟩ + · change IsOArc (C_XII 1) + apply (congrArg IsOArc hj_P₂_cuff₂).mp + exact isOArc_image hj_P₂_emb.isEmbedding ⟨(isEmbedding_cylEnd 2 m2).toHomeomorph⟩ + · intro i j hij + fin_cases i <;> fin_cases j + · exact (hij rfl).elim + · rw [Set.disjoint_left] + rintro _ ⟨q₁, hq₁, rfl⟩ ⟨q₂, hq₂, he⟩ + have hq_eq : q₂ = q₁ := GluedSpace.inr_injective hb_inj he + rw [hq_eq] at hq₂ + linarith [show q₁.1.1 = 1 + δ₁ q₁.1.2 from hq₁, show q₁.1.1 = 2 - δ₂ q₁.1.2 from hq₂, + (hδ₁_bd q₁.1.2).2, (hδ₂_bd q₁.1.2).2] + · rw [Set.disjoint_left] + rintro _ ⟨q₁, hq₁, rfl⟩ ⟨q₂, hq₂, he⟩ + have hq_eq : q₂ = q₁ := GluedSpace.inr_injective hb_inj he + rw [hq_eq] at hq₂ + linarith [show q₁.1.1 = 2 - δ₂ q₁.1.2 from hq₁, show q₁.1.1 = 1 + δ₁ q₁.1.2 from hq₂, + (hδ₁_bd q₁.1.2).2, (hδ₂_bd q₁.1.2).2] + · exact (hij rfl).elim + · intro i + fin_cases i + · change subBd D₁ = ι_XII '' (Subtype.val ⁻¹' (C_XII 0)) + rw [← hf_img_C0] + ext y + exact ⟨by rintro ⟨x, hx, rfl⟩; exact ⟨⟨x, hC0_sub_P₁ hx⟩, hx, rfl⟩, + by rintro ⟨⟨x, _⟩, hx, rfl⟩; exact ⟨x, hx, rfl⟩⟩ + · change subBd D₂ = ι_XII '' (Subtype.val ⁻¹' (C_XII 1)) + rw [← hf_img_C1] + ext y + exact ⟨by rintro ⟨x, hx, rfl⟩; exact ⟨⟨x, hC1_sub_P₁ hx⟩, hx, rfl⟩, + by rintro ⟨⟨x, _⟩, hx, rfl⟩; exact ⟨x, hx, rfl⟩⟩ + · rw [hiUnion2 ![D₁, D₂], hι_XII_range] + ext x + simp only [mem_compl_iff, mem_sdiff, mem_univ, mem_union, true_and, Matrix.cons_val_zero, + Matrix.cons_val_one] + tauto + +private theorem handle_complement_off_original_surface_is_unmarked + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + {W_pts : Set Circle} + (δ₁ : Circle → ℝ) + (hδ₁_bd : ∀ (z : Circle), 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (hδ₁_zero : ∀ (z : Circle), δ₁ z = 0 ↔ z ∈ W_pts) + (δ₂ : Circle → ℝ) + (hδ₂_bd : ∀ (z : Circle), 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) + (hδ₂_zero : ∀ (z : Circle), δ₂ z = 0 ↔ z ∈ W_pts) : + ((range (GluedSpace.inl hb_inj)) ∪ (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | q.1.1 ≤ 1 + + δ₁ q.1.2})) ∪ (GluedSpace.inr hb_inj '' ({q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1}))) \ + (range (GluedSpace.inl hb_inj)) ⊆ (GluedSpace.inr hb_inj '' {q : ClosedCylinder | 1 < q.1.1 + ∧ q.1.1 < 2 ∧ q.1.2 ∉ W_pts}) := by + let b := handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let CollarInt := GluedSpace.inr hb_inj '' {q : ClosedCylinder | 1 < q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ + W_pts} + let A_col₁ := {q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2} + let A_col₂ := {q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1} + let C_col₁ := GluedSpace.inr hb_inj '' A_col₁ + let C_col₂ := GluedSpace.inr hb_inj '' A_col₂ + let P₁_XII := S₁ ∪ C_col₁ ∪ C_col₂ + rintro x ⟨(hx1 | ⟨q, hq, rfl⟩) | ⟨q, hq, rfl⟩, hx_not_S₁⟩ + · exact (hx_not_S₁ hx1).elim + · have hq_not_bd : q ∉ bd ↥ClosedCylinder := fun hbd => + hx_not_S₁ ⟨b ⟨q, hbd⟩, (GluedSpace.inl_eq_inr hb_inj).mpr ⟨hbd, rfl⟩⟩ + have hq1 : 1 < q.1.1 := lt_of_le_of_ne q.2.1.1 fun hr1 => + hq_not_bd (by rw [bd_cylinder]; exact .inl ⟨q.1.2, Subtype.ext (Prod.ext hr1 rfl)⟩) + have hq2 : q.1.1 < 2 := by linarith [show q.1.1 ≤ 1 + δ₁ q.1.2 from hq, (hδ₁_bd q.1.2).2] + have hqW : q.1.2 ∉ W_pts := fun hw => by + have h0 := (hδ₁_zero q.1.2).mpr hw + linarith [show q.1.1 ≤ 1 + δ₁ q.1.2 from hq] + exact ⟨q, ⟨hq1, hq2, hqW⟩, rfl⟩ + · have hq_not_bd : q ∉ bd ↥ClosedCylinder := fun hbd => + hx_not_S₁ ⟨b ⟨q, hbd⟩, (GluedSpace.inl_eq_inr hb_inj).mpr ⟨hbd, rfl⟩⟩ + have hq1 : 1 < q.1.1 := by linarith [show 2 - δ₂ q.1.2 ≤ q.1.1 from hq, (hδ₂_bd q.1.2).2] + have hq2 : q.1.1 < 2 := lt_of_le_of_ne q.2.1.2 fun hr2 => + hq_not_bd (by rw [bd_cylinder]; exact .inr ⟨q.1.2, Subtype.ext (Prod.ext hr2.symm rfl)⟩) + have hqW : q.1.2 ∉ W_pts := fun hw => by + have h0 := (hδ₂_zero q.1.2).mpr hw + linarith [show 2 - δ₂ q.1.2 ≤ q.1.1 from hq] + exact ⟨q, ⟨hq1, hq2, hqW⟩, rfl⟩ + +private theorem marked_lower_cylinder_end_on_pinched_cuff + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + {W_pts : Set Circle} + (δ₁ : Circle → ℝ) + (hδ₁_zero : ∀ (z : Circle), δ₁ z = 0 ↔ z ∈ W_pts) + (C_XII : Fin 2 → Set (GluedSpace hb_inj)) + (hC : C_XII 0 = GluedSpace.inr hb_inj '' {q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2}) + (m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2) : + GluedSpace.inr hb_inj '' cylEnd 1 m1 '' W_pts ⊆ C_XII 0 := by + rw [hC] + let S' := GluedSpace hb_inj + let A_cuff₁ := {q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2} + rintro _ ⟨_, ⟨z, hz, rfl⟩, rfl⟩ + refine ⟨cylEnd 1 m1 z, ?_, rfl⟩ + change (1 : ℝ) = 1 + δ₁ z + linarith [(hδ₁_zero z).mpr hz] + +private theorem unmarked_lower_pinched_cuff_inside_collar + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + {W_pts : Set Circle} + (δ₁ : Circle → ℝ) + (hδ₁_bd : ∀ (z : Circle), 0 ≤ δ₁ z ∧ δ₁ z ≤ 1 / 4) + (hδ₁_zero : ∀ (z : Circle), δ₁ z = 0 ↔ z ∈ W_pts) + (C_XII : Fin 2 → Set (GluedSpace hb_inj)) + (hC : C_XII 0 = GluedSpace.inr hb_inj '' {q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2}) + (m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2) : + C_XII 0 \ GluedSpace.inr hb_inj '' cylEnd 1 m1 '' W_pts ⊆ (GluedSpace.inr hb_inj '' {q : + ClosedCylinder | 1 < q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ W_pts}) := by + rw [hC] + let S' := GluedSpace hb_inj + let CollarInt := GluedSpace.inr hb_inj '' {q : ClosedCylinder | 1 < q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ + W_pts} + let A_cuff₁ := {q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2} + rintro _ ⟨⟨q, hq, rfl⟩, hnot_W⟩ + have hqW : q.1.2 ∉ W_pts := fun hw => hnot_W ⟨cylEnd 1 m1 q.1.2, ⟨q.1.2, hw, rfl⟩, by + congr 1 + apply Subtype.ext + apply Prod.ext + · change (1 : ℝ) = q.1.1 + linarith [show q.1.1 = 1 + δ₁ q.1.2 from hq, (hδ₁_zero q.1.2).mpr hw] + · rfl⟩ + have hpos : 0 < δ₁ q.1.2 := lt_of_le_of_ne (hδ₁_bd q.1.2).1 fun h0 => + hqW ((hδ₁_zero q.1.2).mp h0.symm) + exact ⟨q, ⟨by linarith [show q.1.1 = 1 + δ₁ q.1.2 from hq], + by linarith [show q.1.1 = 1 + δ₁ q.1.2 from hq, (hδ₁_bd q.1.2).2], hqW⟩, rfl⟩ + +private theorem marked_upper_cylinder_end_on_pinched_cuff + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + {W_pts : Set Circle} + (δ₂ : Circle → ℝ) + (hδ₂_zero : ∀ (z : Circle), δ₂ z = 0 ↔ z ∈ W_pts) + (C_XII : Fin 2 → Set (GluedSpace hb_inj)) + (hC : C_XII 1 = GluedSpace.inr hb_inj '' {q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2}) + (m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2) : + GluedSpace.inr hb_inj '' cylEnd 2 m2 '' W_pts ⊆ C_XII 1 := by + rw [hC] + let S' := GluedSpace hb_inj + let A_cuff₂ := {q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2} + rintro _ ⟨_, ⟨z, hz, rfl⟩, rfl⟩ + refine ⟨cylEnd 2 m2 z, ?_, rfl⟩ + change (2 : ℝ) = 2 - δ₂ z + linarith [(hδ₂_zero z).mpr hz] + +private theorem unmarked_upper_pinched_cuff_inside_collar + {S : Type w} + [TopologicalSpace S] + {Λ₁ : Set S} + {Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + {W_pts : Set Circle} + (δ₂ : Circle → ℝ) + (hδ₂_bd : ∀ (z : Circle), 0 ≤ δ₂ z ∧ δ₂ z ≤ 1 / 4) + (hδ₂_zero : ∀ (z : Circle), δ₂ z = 0 ↔ z ∈ W_pts) + (C_XII : Fin 2 → Set (GluedSpace hb_inj)) + (hC : C_XII 1 = GluedSpace.inr hb_inj '' {q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2}) + (m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2) : + C_XII 1 \ GluedSpace.inr hb_inj '' cylEnd 2 m2 '' W_pts ⊆ (GluedSpace.inr hb_inj '' {q : + ClosedCylinder | 1 < q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ W_pts}) := by + rw [hC] + let S' := GluedSpace hb_inj + let CollarInt := GluedSpace.inr hb_inj '' {q : ClosedCylinder | 1 < q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ + W_pts} + let A_cuff₂ := {q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2} + rintro _ ⟨⟨q, hq, rfl⟩, hnot_W⟩ + have hqW : q.1.2 ∉ W_pts := fun hw => hnot_W ⟨cylEnd 2 m2 q.1.2, ⟨q.1.2, hw, rfl⟩, by + congr 1 + apply Subtype.ext + apply Prod.ext + · change (2 : ℝ) = q.1.1 + linarith [show q.1.1 = 2 - δ₂ q.1.2 from hq, (hδ₂_zero q.1.2).mpr hw] + · rfl⟩ + have hpos : 0 < δ₂ q.1.2 := lt_of_le_of_ne (hδ₂_bd q.1.2).1 fun h0 => + hqW ((hδ₂_zero q.1.2).mp h0.symm) + exact ⟨q, ⟨by linarith [show q.1.1 = 2 - δ₂ q.1.2 from hq, (hδ₂_bd q.1.2).2], + by linarith [show q.1.1 = 2 - δ₂ q.1.2 from hq], hqW⟩, rfl⟩ + +private theorem marked_radial_line_in_pinched_strip + {S' : Type*} (inr : ClosedCylinder → S') {W : Set Circle} {δ₁ δ₂ : Circle → ℝ} + (hδ₁_zero : ∀ z, δ₁ z = 0 ↔ z ∈ W) (hδ₂_zero : ∀ z, δ₂ z = 0 ↔ z ∈ W) + {z : Circle} (hz : z ∈ W) : + inr '' {q : ClosedCylinder | q.1.2 = z} ⊆ + inr '' {q : ClosedCylinder | 1 + δ₁ q.1.2 ≤ q.1.1 ∧ q.1.1 ≤ 2 - δ₂ q.1.2} := by + rintro _ ⟨p, rfl, rfl⟩ + refine ⟨p, ⟨?_, ?_⟩, rfl⟩ + · linarith [p.2.1.1, (hδ₁_zero p.1.2).mpr hz] + · linarith [p.2.1.2, (hδ₂_zero p.1.2).mpr hz] + +/-- The pinched handle split on `GluedSpace hb_inj` touching `subBd Λ₁` and `subBd Λ₂` only at +`g₁ '' W_pts` and `g₂ '' W_pts`. -/ +theorem exists_pinched_handleSplit {S : Type w} [TopologicalSpace S] [T2Space S] + [ConnectedSpace S] (hS : IsClosedSurface S) {Λ₁ Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) (hΛ₂_open : IsOpen Λ₂) + (hΛ₁ : IsOpenDisc Λ₁) (hΛ₂ : IsOpenDisc Λ₂) + (hCD₁ : IsClosedDisc (closure Λ₁)) (hCD₂ : IsClosedDisc (closure Λ₂)) + (hdiscBd₁ : discBd (closure Λ₁) = subBd Λ₁) + (hdiscBd₂ : discBd (closure Λ₂) = subBd Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (hOArc₁ : IsOArc (subBd Λ₁)) (hOArc₂ : IsOArc (subBd Λ₂)) + (hout₁ : ∀ x ∈ closure Λ₁ \ Λ₁, x ∈ closure (closure Λ₁)ᶜ) + (hout₂ : ∀ x ∈ closure Λ₂ \ Λ₂, x ∈ closure (closure Λ₂)ᶜ) + (g₁ : Circle ≃ₜ ↥(subBd Λ₁)) (g₂ : Circle ≃ₜ ↥(subBd Λ₂)) + (hb_inj : Function.Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + {W_pts : Set Circle} (hW_cl : IsClosed W_pts) (hW_ne : W_pts.Nonempty) : + let S' := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let CollarInt : Set S' := + GluedSpace.inr hb_inj '' {q : ClosedCylinder | 1 < q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ W_pts} + ∃ (C_XII : Fin 2 → Set S') (P₁_XII P₂_XII : Set S') (ι_XII : ↥P₁_XII → S) + (D : Fin 2 → Set S) (f_XII : S' → S), + GM12.IsHandleSplit C_XII P₁_XII P₂_XII ι_XII D ∧ + S₁ ⊆ P₁_XII ∧ + (∀ y : ↥(univ \ (Λ₁ ∪ Λ₂) : Set S), f_XII (GluedSpace.inl hb_inj y) = y.1) ∧ + (∀ x : ↥P₁_XII, ι_XII x = f_XII x.1) ∧ + IsClosedEmbedding ι_XII ∧ + D 0 ⊆ Λ₁ ∧ D 1 ⊆ Λ₂ ∧ + closure (D 0) ⊆ closure Λ₁ ∧ closure (D 1) ⊆ closure Λ₂ ∧ + P₁_XII \ S₁ ⊆ CollarInt ∧ + GluedSpace.inr hb_inj '' (cylEnd 1 (by norm_num) '' W_pts) ⊆ C_XII 0 ∧ + C_XII 0 \ (GluedSpace.inr hb_inj '' (cylEnd 1 (by norm_num) '' W_pts)) ⊆ CollarInt ∧ + GluedSpace.inr hb_inj '' (cylEnd 2 (by norm_num) '' W_pts) ⊆ C_XII 1 ∧ + C_XII 1 \ (GluedSpace.inr hb_inj '' (cylEnd 2 (by norm_num) '' W_pts)) ⊆ CollarInt ∧ + (∀ z ∈ W_pts, GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = z} ⊆ P₂_XII) ∧ + f_XII '' (C_XII 0) = subBd (D 0) ∧ + f_XII '' (C_XII 1) = subBd (D 1) ∧ + f_XII '' P₁_XII = (closure Λ₁ \ D 0) ∪ (univ \ (Λ₁ ∪ Λ₂)) ∪ (closure Λ₂ \ D 1) ∧ + (∀ x ∈ P₁_XII, f_XII x ∈ univ \ (Λ₁ ∪ Λ₂) → x ∈ S₁) := by + have : CompactSpace S := hS.1 + have hX_closed : IsClosed (univ \ (Λ₁ ∪ Λ₂) : Set S) := + isClosed_univ.sdiff (hΛ₁_open.union hΛ₂_open) + have : CompactSpace ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) := + isCompact_iff_compactSpace.mp hX_closed.isCompact + have : CompactSpace ClosedCylinder := + isCompact_iff_compactSpace.mp (isCompact_Icc.prod isCompact_univ) + have hb_cont := continuous_handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ + have hb_range := range_handleGlueMap hS hΛ₁_open hΛ₂_open hOArc₁ hOArc₂ hout₁ hout₂ hd g₁ g₂ + have : T2Space (GluedSpace hb_inj) := + GluedSpace.t2Space (isClosed_bd ↥ClosedCylinder) hb_cont hb_inj + obtain ⟨hS', hConn', _, _, hS₂_surf, hU_eq, _, _⟩ := + isClosedSurface_of_handle_glue hS hΛ₁ hΛ₂ hd hOArc₁ hOArc₂ hout₁ hout₂ hb_cont hb_inj hb_range + obtain ⟨δ₁, D₁, cMap₁, hδ₁_cont, hδ₁_bd, hδ₁_zero, hD₁_open, hD₁_sub, hCD_D₁, hsubBd_D₁_eq, + hOArc_D₁, hout_D₁, _, _, _, hcMap₁_cont, hcMap₁_inj, hcMap₁_zero, hcMap₁_collar, hcMap₁_bd, _⟩ + := + exists_pinched_subdisc_of_region hS hΛ₁_open hCD₁ hdiscBd₁ hout₁ g₁ hW_cl hW_ne + obtain ⟨δ₂, D₂, cMap₂, hδ₂_cont, hδ₂_bd, hδ₂_zero, hD₂_open, hD₂_sub, hCD_D₂, hsubBd_D₂_eq, + hOArc_D₂, hout_D₂, _, _, _, hcMap₂_cont, hcMap₂_inj, hcMap₂_zero, hcMap₂_collar, hcMap₂_bd, _⟩ + := + exists_pinched_subdisc_of_region hS hΛ₂_open hCD₂ hdiscBd₂ hout₂ g₂ hW_cl hW_ne + have hcl_D₁_sub : closure D₁ ⊆ closure Λ₁ := closure_mono hD₁_sub + have hcl_D₂_sub : closure D₂ ⊆ closure Λ₂ := closure_mono hD₂_sub + have hd_D : Disjoint (closure D₁) (closure D₂) := hd.mono hcl_D₁_sub hcl_D₂_sub + have hD₁_disc := isOpenDisc_of_isClosedDisc_closure hS hD₁_open hCD_D₁ hout_D₁ + have hD₂_disc := isOpenDisc_of_isClosedDisc_closure hS hD₂_open hCD_D₂ hout_D₂ + let S' := GluedSpace hb_inj + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let S₂ : Set S' := range (GluedSpace.inr hb_inj) + let CollarInt : Set S' := + GluedSpace.inr hb_inj '' {q : ClosedCylinder | 1 < q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ W_pts} + have hinl_emb : IsClosedEmbedding (GluedSpace.inl hb_inj) := + (GluedSpace.continuous_inl hb_inj).isClosedEmbedding (GluedSpace.inl_injective hb_inj) + have hinr_emb : IsClosedEmbedding (GluedSpace.inr hb_inj) := + (GluedSpace.continuous_inr hb_inj).isClosedEmbedding (GluedSpace.inr_injective hb_inj) + let e₁ : ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) ≃ₜ ↥S₁ := hinl_emb.isEmbedding.toHomeomorph + let e₂ : ClosedCylinder ≃ₜ ↥S₂ := hinr_emb.isEmbedding.toHomeomorph + have hCyl_surf : IsSurface ClosedCylinder := isSurface_of_homeo e₂.symm hS₂_surf + let A_col₁ : Set ClosedCylinder := {q : ClosedCylinder | q.1.1 ≤ 1 + δ₁ q.1.2} + let A_col₂ : Set ClosedCylinder := {q : ClosedCylinder | 2 - δ₂ q.1.2 ≤ q.1.1} + let A_mid : Set ClosedCylinder := + {q : ClosedCylinder | 1 + δ₁ q.1.2 ≤ q.1.1 ∧ q.1.1 ≤ 2 - δ₂ q.1.2} + let A_cuff₁ : Set ClosedCylinder := {q : ClosedCylinder | q.1.1 = 1 + δ₁ q.1.2} + let A_cuff₂ : Set ClosedCylinder := {q : ClosedCylinder | q.1.1 = 2 - δ₂ q.1.2} + have hA_col₁_cl : IsClosed A_col₁ := lower_cylinder_collar_closed δ₁ hδ₁_cont + have hA_col₂_cl : IsClosed A_col₂ := upper_cylinder_collar_closed δ₂ hδ₂_cont + have hA_mid_cl : IsClosed A_mid := middle_cylinder_strip_closed δ₁ hδ₁_cont δ₂ hδ₂_cont + let C_col₁ : Set S' := GluedSpace.inr hb_inj '' A_col₁ + let C_col₂ : Set S' := GluedSpace.inr hb_inj '' A_col₂ + let P₁_XII : Set S' := S₁ ∪ C_col₁ ∪ C_col₂ + let P₂_XII : Set S' := GluedSpace.inr hb_inj '' A_mid + let C_XII : Fin 2 → Set S' := + ![GluedSpace.inr hb_inj '' A_cuff₁, GluedSpace.inr hb_inj '' A_cuff₂] + let f_XII : S' → S := + handlePinchRetract hΛ₁_open hΛ₂_open hd g₁ g₂ hb_inj cMap₁ cMap₂ hcMap₁_zero hcMap₂_zero + have hf_inl : ∀ y, f_XII (GluedSpace.inl hb_inj y) = y.1 := fun _ => rfl + have hf_inr_one : ∀ q : ClosedCylinder, q.1.1 ≤ 3 / 2 → + f_XII (GluedSpace.inr hb_inj q) = cMap₁ (q.1.1 - 1, q.1.2) := + handlePinchRetract_inr_one hΛ₁_open hΛ₂_open hd g₁ g₂ hb_inj cMap₁ cMap₂ hcMap₁_zero hcMap₂_zero + have hf_inr_two : ∀ q : ClosedCylinder, ¬ q.1.1 ≤ 3 / 2 → + f_XII (GluedSpace.inr hb_inj q) = cMap₂ (2 - q.1.1, q.1.2) := + handlePinchRetract_inr_two hΛ₁_open hΛ₂_open hd g₁ g₂ hb_inj cMap₁ cMap₂ hcMap₁_zero hcMap₂_zero + let ι_XII : ↥P₁_XII → S := fun x => f_XII x.1 + have hS₁_cl : IsClosed S₁ := hinl_emb.isClosed_range + have hC_col₁_cl : IsClosed C_col₁ := hinr_emb.isClosedMap _ hA_col₁_cl + have hC_col₂_cl : IsClosed C_col₂ := hinr_emb.isClosedMap _ hA_col₂_cl + have hP₁_cl : IsClosed P₁_XII := (hS₁_cl.union hC_col₁_cl).union hC_col₂_cl + have : CompactSpace ↥P₁_XII := isCompact_iff_compactSpace.mp hP₁_cl.isCompact + have hf_S₁_cont : ContinuousOn f_XII S₁ := + handle_map_continuous_on_original_surface (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open + hΛ₂_open hd g₁ g₂ hb_inj e₁ (fun _ => rfl) f_XII hf_inl + have hf_col₁_cont : ContinuousOn f_XII C_col₁ := + handle_map_continuous_on_lower_collar (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open + hd g₁ g₂ hb_inj δ₁ cMap₁ hδ₁_bd hcMap₁_cont e₂ (fun _ => rfl) f_XII hf_inr_one + have hf_col₂_cont : ContinuousOn f_XII C_col₂ := + handle_map_continuous_on_upper_collar (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open + hd g₁ g₂ hb_inj δ₂ cMap₂ hδ₂_bd hcMap₂_cont e₂ (fun _ => rfl) f_XII hf_inr_two + have hf_P₁_cont : ContinuousOn f_XII P₁_XII := + (hf_S₁_cont.union_of_isClosed hf_col₁_cont hS₁_cl hC_col₁_cl).union_of_isClosed + hf_col₂_cont (hS₁_cl.union hC_col₁_cl) hC_col₂_cl + have hι_XII_cont : Continuous ι_XII := continuousOn_iff_continuous_domRestrict.mp hf_P₁_cont + have hf_img_S₁ : f_XII '' S₁ = univ \ (Λ₁ ∪ Λ₂) := + handle_map_image_of_original_surface (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open hd + g₁ g₂ hb_inj f_XII hf_inl + have hf_img_col₁ : f_XII '' C_col₁ = closure Λ₁ \ D₁ := + handle_map_image_of_lower_collar (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open hd g₁ + g₂ hb_inj δ₁ D₁ cMap₁ hδ₁_bd hcMap₁_collar f_XII hf_inr_one + have hf_img_col₂ : f_XII '' C_col₂ = closure Λ₂ \ D₂ := + handle_map_image_of_upper_collar (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open hd g₁ + g₂ hb_inj δ₂ D₂ cMap₂ hδ₂_bd hcMap₂_collar f_XII hf_inr_two + have hf_img_C0 : f_XII '' (C_XII 0) = subBd D₁ := by + exact handle_map_image_of_lower_pinched_cuff (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open + hd g₁ g₂ hb_inj δ₁ D₁ cMap₁ hδ₁_bd hcMap₁_bd C_XII rfl f_XII hf_inr_one + have hf_img_C1 : f_XII '' (C_XII 1) = subBd D₂ := by + exact handle_map_image_of_upper_pinched_cuff (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open + hd g₁ g₂ hb_inj δ₂ D₂ cMap₂ hδ₂_bd hcMap₂_bd C_XII rfl f_XII hf_inr_two + have hf_img_P₁ : f_XII '' P₁_XII = (closure Λ₁ \ D₁) ∪ (univ \ (Λ₁ ∪ Λ₂)) ∪ (closure Λ₂ \ D₂) + := by + change f_XII '' (S₁ ∪ C_col₁ ∪ C_col₂) = _ + rw [image_union, image_union, hf_img_S₁, hf_img_col₁, hf_img_col₂, + union_comm (univ \ (Λ₁ ∪ Λ₂))] + have hf_img_P₁_compl : f_XII '' P₁_XII = univ \ (D₁ ∪ D₂) := by + exact handle_map_image_of_complement (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hd D₁ hD₁_sub D₂ hD₂_sub + S' P₁_XII f_XII hf_img_P₁ + have hcol₁_interior : ∀ q ∈ A_col₁, 1 < q.1.1 → f_XII (GluedSpace.inr hb_inj q) ∈ Λ₁ := by + exact lower_collar_interior_maps_inside_disc (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open + hd g₁ g₂ hb_inj δ₁ D₁ cMap₁ hδ₁_bd hcMap₁_inj hcMap₁_zero f_XII hf_inr_one hf_img_col₁ + have hcol₂_interior : ∀ q ∈ A_col₂, q.1.1 < 2 → f_XII (GluedSpace.inr hb_inj q) ∈ Λ₂ := by + exact upper_collar_interior_maps_inside_disc (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open + hd g₁ g₂ hb_inj δ₂ D₂ cMap₂ hδ₂_bd hcMap₂_inj hcMap₂_zero f_XII hf_inr_two hf_img_col₂ + have hf_mem_S₁_of_compl : ∀ x ∈ P₁_XII, f_XII x ∈ univ \ (Λ₁ ∪ Λ₂) → x ∈ S₁ := by + exact handle_map_complement_has_original_preimage (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open + hΛ₂_open hd g₁ g₂ hb_inj δ₁ δ₂ f_XII hcol₁_interior hcol₂_interior + have hι_XII_inj : Function.Injective ι_XII := by + exact handle_map_injective_on_complement (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open hd + g₁ g₂ hb_inj δ₁ D₁ cMap₁ hδ₁_bd hcMap₁_inj δ₂ D₂ cMap₂ hδ₂_bd hcMap₂_inj f_XII hf_inl + hf_inr_one + hf_inr_two hf_img_col₁ hf_img_col₂ hf_mem_S₁_of_compl + have hι_XII_emb : IsClosedEmbedding ι_XII := hι_XII_cont.isClosedEmbedding hι_XII_inj + have hι_XII_range : range ι_XII = univ \ (D₁ ∪ D₂) := + (image_eq_range f_XII P₁_XII).symm.trans hf_img_P₁_compl + let e_P₁ : ↥P₁_XII ≃ₜ ↥(univ \ (D₁ ∪ D₂) : Set S) := + hι_XII_emb.isEmbedding.toHomeomorph.trans (Homeomorph.setCongr hι_XII_range) + obtain ⟨hXD_surf, _, hXD_bd⟩ := + compl_two_open_isSurface hS hD₁_open hD₂_open hOArc_D₁ hOArc_D₂ hout_D₁ hout_D₂ hd_D + have hP₁_surf : IsSurface ↥P₁_XII := isSurface_of_homeo e_P₁.symm hXD_surf + let e_pinch := pinchCylHomeo hδ₁_cont hδ₂_cont hδ₁_bd hδ₂_bd + let j_P₂ : ClosedCylinder → S' := fun p => GluedSpace.inr hb_inj (e_pinch p).1 + have hj_P₂_emb : IsClosedEmbedding j_P₂ := + hinr_emb.comp (hA_mid_cl.isClosedEmbedding_subtypeVal.comp e_pinch.isClosedEmbedding) + have hj_P₂_range : range j_P₂ = P₂_XII := by + exact pinched_cylinder_maps_onto_middle_strip (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open + hd g₁ g₂ hb_inj δ₁ δ₂ e_pinch + let e_P₂ : ClosedCylinder ≃ₜ ↥P₂_XII := + hj_P₂_emb.isEmbedding.toHomeomorph.trans (Homeomorph.setCongr hj_P₂_range) + have hP₂_surf : IsSurface ↥P₂_XII := isSurface_of_homeo e_P₂ hCyl_surf + have m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2 := by norm_num + have m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2 := by norm_num + have hj_P₂_cuff₁ : j_P₂ '' range (cylEnd 1 m1) = C_XII 0 := by + exact pinched_cylinder_maps_lower_cuff (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open hd g₁ + g₂ hb_inj δ₁ hδ₁_cont hδ₁_bd δ₂ hδ₂_cont hδ₂_bd C_XII rfl e_pinch rfl m1 + have hj_P₂_cuff₂ : j_P₂ '' range (cylEnd 2 m2) = C_XII 1 := by + exact pinched_cylinder_maps_upper_cuff (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open hd g₁ + g₂ hb_inj δ₁ hδ₁_cont hδ₁_bd δ₂ hδ₂_cont hδ₂_bd C_XII rfl e_pinch rfl m2 + have hiUnion2 := @union_two_indexed_sets + have hbd_P₂ : Subtype.val '' bd ↥P₂_XII = ⋃ i : Fin 2, C_XII i := by + rw [hiUnion2 C_XII, ← hj_P₂_cuff₁, ← hj_P₂_cuff₂, ← image_union, ← bd_cylinder, + ← image_bd_homeomorph e_P₂, image_image] + rfl + have hC0_sub_P₁ : C_XII 0 ⊆ P₁_XII := by + rintro _ ⟨q, hq, rfl⟩ + exact .inl (.inr ⟨q, le_of_eq hq, rfl⟩) + have hC1_sub_P₁ : C_XII 1 ⊆ P₁_XII := by + rintro _ ⟨q, hq, rfl⟩ + exact .inr ⟨q, le_of_eq hq.symm, rfl⟩ + have hP12_union : P₁_XII ∪ P₂_XII = univ := by + exact handle_pieces_cover_glued_surface (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open hd g₁ + g₂ hb_inj hU_eq δ₁ δ₂ + have hP12_inter : P₁_XII ∩ P₂_XII = ⋃ i : Fin 2, C_XII i := by + exact handle_pieces_meet_at_pinched_cuffs (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open hd + g₁ g₂ hb_inj δ₁ hδ₁_bd δ₂ hδ₂_bd hiUnion2 hC0_sub_P₁ hC1_sub_P₁ + have hf_injOn_P₁ : Set.InjOn f_XII P₁_XII := + fun x₁ hx₁ x₂ hx₂ h => congrArg Subtype.val (@hι_XII_inj ⟨x₁, hx₁⟩ ⟨x₂, hx₂⟩ h) + have hbd_P₁ : Subtype.val '' bd ↥P₁_XII = ⋃ i : Fin 2, C_XII i := by + exact handle_complement_boundary_is_cuff_union (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open + hΛ₂_open hd g₁ g₂ hb_inj D₁ hD₁_open hD₁_sub D₂ hD₂_open hD₂_sub hcl_D₁_sub hcl_D₂_sub + P₁_XII C_XII f_XII hf_img_C0 hf_img_C1 e_P₁ (fun _ => rfl) hXD_bd hiUnion2 hC0_sub_P₁ + hC1_sub_P₁ + hf_injOn_P₁ + have hhandle_split : GM12.IsCappedSplit C_XII P₁_XII P₂_XII ι_XII ![D₁, D₂] := by + exact pinched_handle_forms_capped_split (S := S) hS (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open hΛ₂_open hd + g₁ g₂ hb_inj hS' δ₁ D₁ hδ₁_bd δ₂ D₂ hδ₂_bd hd_D hD₁_disc hD₂_disc P₁_XII P₂_XII f_XII + hf_img_C0 hf_img_C1 hι_XII_emb hι_XII_range hP₁_surf j_P₂ hj_P₂_emb hP₂_surf m1 m2 + hj_P₂_cuff₁ hj_P₂_cuff₂ hiUnion2 hbd_P₂ hC0_sub_P₁ hC1_sub_P₁ hP12_union hP12_inter hbd_P₁ + have hcomplement_collar : P₁_XII \ S₁ ⊆ CollarInt := by + exact handle_complement_off_original_surface_is_unmarked (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) + hΛ₁_open hΛ₂_open hd g₁ g₂ hb_inj (W_pts := W_pts) δ₁ hδ₁_bd hδ₁_zero δ₂ hδ₂_bd hδ₂_zero + have hmarks_lower : GluedSpace.inr hb_inj '' (cylEnd 1 m1 '' W_pts) ⊆ C_XII 0 := by + exact marked_lower_cylinder_end_on_pinched_cuff (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open + hΛ₂_open hd g₁ g₂ hb_inj (W_pts := W_pts) δ₁ hδ₁_zero C_XII rfl m1 + have hunmarked_lower : C_XII 0 \ (GluedSpace.inr hb_inj '' (cylEnd 1 m1 '' W_pts)) ⊆ CollarInt + := by + exact unmarked_lower_pinched_cuff_inside_collar (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open + hΛ₂_open hd g₁ g₂ hb_inj (W_pts := W_pts) δ₁ hδ₁_bd hδ₁_zero C_XII rfl m1 + have hmarks_upper : GluedSpace.inr hb_inj '' (cylEnd 2 m2 '' W_pts) ⊆ C_XII 1 := by + exact marked_upper_cylinder_end_on_pinched_cuff (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open + hΛ₂_open hd g₁ g₂ hb_inj (W_pts := W_pts) δ₂ hδ₂_zero C_XII rfl m2 + have hunmarked_upper : C_XII 1 \ (GluedSpace.inr hb_inj '' (cylEnd 2 m2 '' W_pts)) ⊆ CollarInt + := by + exact unmarked_upper_pinched_cuff_inside_collar (S := S) (Λ₁ := Λ₁) (Λ₂ := Λ₂) hΛ₁_open + hΛ₂_open hd g₁ g₂ hb_inj (W_pts := W_pts) δ₂ hδ₂_bd hδ₂_zero C_XII rfl m2 + exact ⟨C_XII, P₁_XII, P₂_XII, ι_XII, ![D₁, D₂], f_XII, + ⟨hhandle_split, inferInstance, ⟨e_P₂.symm.trans closedCylinderHomeoAnnulus⟩⟩, + fun x hx => .inl (.inl hx), + fun y => rfl, fun _ => rfl, hι_XII_emb, hD₁_sub, hD₂_sub, hcl_D₁_sub, hcl_D₂_sub, + hcomplement_collar, hmarks_lower, hunmarked_lower, hmarks_upper, hunmarked_upper, + fun z hz => marked_radial_line_in_pinched_strip (GluedSpace.inr hb_inj) hδ₁_zero hδ₂_zero hz, + hf_img_C0, hf_img_C1, hf_img_P₁, hf_mem_S₁_of_compl⟩ + + +/-! ## 3. Proof of Graph Minors XV, (3.5) -/ + +/-- Any rigid drawing `H'` with `H'.U.Nonempty` on a connected closed surface `S'` is 2-cell. -/ +theorem isTwoCell_of_isRigid {S' : Type w} [TopologicalSpace S'] [T2Space S'] + (hS' : IsClosedSurface S') [hConn' : ConnectedSpace S'] + {H' : Drawing S'} (hRigid : IsRigid H') (hU_ne : H'.U.Nonempty) : + (PaintingOrDrawing.drawing H').IsTwoCell := by + have : LocallyConnectedSpace S' := IsClosedSurface.locallyConnectedSpace hS' + refine ⟨hConn', fun r hr => ?_⟩ + have h_od := open_disc S' r hS' hConn' + ⟨GM11.region_nonempty hr, GM11.region_isPreconnected hr⟩ (GM11.region_isOpen hr) + (fun F hFr hF => by + have hFU_emp : F ∩ H'.U = ∅ := + eq_empty_iff_forall_notMem.mpr fun x ⟨hxF, hxU⟩ => GM11.region_subset hr (hFr hxF) hxU + have hFU : F ∩ H'.U ⊆ H'.V := by rw [hFU_emp]; exact empty_subset _ + have hFV_emp : F ∩ H'.V = ∅ := + eq_empty_of_subset (inter_subset_inter_right F H'.V_subset_U) hFU_emp + have hFV_card : (F ∩ H'.V).ncard ≤ 2 := by rw [hFV_emp, Set.ncard_empty]; omega + obtain ⟨Δ, hΔ, hbd_Δ, hDial_cases⟩ := hRigid F hF hFU hFV_card + have hΔ_disj : Disjoint Δ H'.U := by + rcases hDial_cases with h1 | ⟨u₁, u₂, hu12, hJV_eq, _⟩ + · exact disjoint_left.mpr fun x hxΔ hxU => + (eq_empty_iff_forall_notMem.mp hFU_emp x) ⟨h1 ⟨hxΔ, hxU⟩, hxU⟩ + · exfalso + have h1 : (F ∩ H'.V).ncard = 0 := by rw [hFV_emp, Set.ncard_empty] + have h2 : (F ∩ H'.V).ncard = 2 := by rw [hJV_eq, Set.ncard_pair hu12] + omega + obtain ⟨φ⟩ := hF + have hpF : (φ 1).1 ∈ F := (φ 1).2 + have hpΔ : (φ 1).1 ∈ Δ := by + have hp_bd : (φ 1).1 ∈ subBd Δ := hbd_Δ ▸ hpF + exact hΔ.isClosed.closure_subset hp_bd.1 + have hΔ_r : Δ ⊆ r := + GM11.subset_region hr hΔ.isPathConnected.isConnected.isPreconnected hΔ_disj hpΔ (hFr hpF) + exact ⟨Δ, hΔ_r, hΔ, (GM14.IsClosedDisc.subBd_eq_discBd hS' hΔ).symm.trans hbd_Δ⟩) + rcases h_od with ⟨_, hr_univ⟩ | hr_disc + · exfalso + obtain ⟨x, hx⟩ := hU_ne + exact GM11.region_subset hr (hr_univ ▸ mem_univ x) hx + · exact hr_disc + +/-- Lifting `exists_striped_disc_in_closedCylinder` to `S₂ = range (GluedSpace.inr hb_inj)` when a +closed subset `K_sub ⊆ S₂` avoids at least one radial line `L i₀`. -/ +theorem exists_striped_disc_in_S₂ {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {Λ₁ Λ₂ : Set S} + (hΛ₁_open : IsOpen Λ₁) (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↥(subBd Λ₁)) (g₂ : Circle ≃ₜ ↥(subBd Λ₂)) + (hb_inj : Function.Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + {φ : ℕ} {w : Fin φ → Circle} (hw_inj : Function.Injective w) + {a' b' : Fin φ → GluedSpace hb_inj} + (ha' : ∀ i, a' i = GluedSpace.inr hb_inj (cylEnd 1 (by norm_num) (w i))) + (hb' : ∀ i, b' i = GluedSpace.inr hb_inj (cylEnd 2 (by norm_num) (w i))) + {L : Fin φ → Set (GluedSpace hb_inj)} + (hL : ∀ i, L i = GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i}) + {H_path : Fin φ → Drawing (GluedSpace hb_inj)} + (hH_path_U : ∀ i, (H_path i).U = L i) + {H' : Drawing (GluedSpace hb_inj)} + (hS₂_U : range (GluedSpace.inr hb_inj) ∩ H'.U ⊆ + (range (GluedSpace.inl hb_inj) ∩ range (GluedSpace.inr hb_inj)) ∪ ⋃ i : Fin φ, L i) + {K_sub : Set (GluedSpace hb_inj)} (hK_sub_cl : IsClosed K_sub) + (hK_sub_S₂ : K_sub ⊆ range (GluedSpace.inr hb_inj)) + (i₀ : Fin φ) (hK_sub_disj : Disjoint K_sub (L i₀)) : + let S₁ : Set (GluedSpace hb_inj) := range (GluedSpace.inl hb_inj) + let S₂ : Set (GluedSpace hb_inj) := range (GluedSpace.inr hb_inj) + ∃ D : Set (GluedSpace hb_inj), + D ⊆ S₂ ∧ + IsClosedDisc D ∧ + K_sub ⊆ D ∧ + D ∩ (S₁ ∩ S₂) ⊆ discBd D ∧ + D ∩ H'.U ⊆ (D ∩ (S₁ ∩ S₂)) ∪ ⋃ j : {i : Fin φ // i ≠ i₀}, (H_path j.1).U ∧ + ∀ j : {i : Fin φ // i ≠ i₀}, + (H_path j.1).U ⊆ D ∧ + (H_path j.1).U ∩ discBd D = {a' j.1, b' j.1} := by + have : CompactSpace S := hS.1 + have hX_closed : IsClosed (univ \ (Λ₁ ∪ Λ₂) : Set S) := + isClosed_univ.sdiff (hΛ₁_open.union hΛ₂_open) + have : CompactSpace ↥(univ \ (Λ₁ ∪ Λ₂) : Set S) := + isCompact_iff_compactSpace.mp hX_closed.isCompact + have : CompactSpace ClosedCylinder := + isCompact_iff_compactSpace.mp (isCompact_Icc.prod isCompact_univ) + have hb_cont := continuous_handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ + have : T2Space (GluedSpace hb_inj) := + GluedSpace.t2Space (isClosed_bd ↥ClosedCylinder) hb_cont hb_inj + have hinr_emb : IsClosedEmbedding (GluedSpace.inr hb_inj) := + (GluedSpace.continuous_inr hb_inj).isClosedEmbedding (GluedSpace.inr_injective hb_inj) + obtain ⟨θ₀, _, hθ₀⟩ : w i₀ ∈ Circle.exp '' Icc 0 (0 + 2 * Real.pi) := + circle_exp_surjOn_Icc 0 ▸ mem_univ (w i₀) + let K_all : Set ClosedCylinder := + (GluedSpace.inr hb_inj ⁻¹' K_sub) ∪ + ⋃ j : {i : Fin φ // i ≠ i₀}, {p : ClosedCylinder | p.1.2 = w j.1} + have hK_all_cl : IsClosed K_all := by + refine (hK_sub_cl.preimage (GluedSpace.continuous_inr hb_inj)).union ?_ + exact isClosed_iUnion_of_finite fun j => + isClosed_eq (continuous_snd.comp continuous_subtype_val) continuous_const + have hK_all_disj : Disjoint K_all {p : ClosedCylinder | p.1.2 = Circle.exp θ₀} := by + rw [hθ₀] + refine Set.disjoint_left.mpr ?_ + rintro p (hp_sub | hp_rad) hp_i₀ + · have hp_L : GluedSpace.inr hb_inj p ∈ L i₀ := by + rw [hL i₀] + exact ⟨p, hp_i₀, rfl⟩ + exact Set.disjoint_left.mp hK_sub_disj hp_sub hp_L + · obtain ⟨j, hj⟩ := mem_iUnion.mp hp_rad + exact j.2 (hw_inj (hj.symm.trans hp_i₀)) + obtain ⟨D_cyl, ⟨ψ_cyl⟩, hK_sub_D_cyl, hD_cyl_disj, hbd_sub_D_cyl, hrad_D_cyl⟩ := + exists_striped_disc_in_closedCylinder θ₀ hK_all_cl hK_all_disj + let D : Set (GluedSpace hb_inj) := GluedSpace.inr hb_inj '' D_cyl + have hD_S₂ : D ⊆ range (GluedSpace.inr hb_inj) := image_subset_range _ _ + let f_D : ↥D_cyl → GluedSpace hb_inj := fun p => GluedSpace.inr hb_inj p.1 + have hf_D_emb : IsEmbedding f_D := hinr_emb.isEmbedding.comp IsEmbedding.subtypeVal + have hf_D_range : range f_D = D := by + ext x + exact ⟨by rintro ⟨p, rfl⟩; exact ⟨p.1, p.2, rfl⟩, + by rintro ⟨p, hp, rfl⟩; exact ⟨⟨p, hp⟩, rfl⟩⟩ + let e_D : ↥D_cyl ≃ₜ ↥D := hf_D_emb.toHomeomorph.trans (Homeomorph.setCongr hf_D_range) + have hD_disc : IsClosedDisc D := ⟨ψ_cyl.trans e_D⟩ + have hdiscBd_D : discBd D = GluedSpace.inr hb_inj '' discBd D_cyl := by + change Subtype.val '' bd ↥D = GluedSpace.inr hb_inj '' (Subtype.val '' bd ↥D_cyl) + rw [← image_bd_homeomorph e_D, image_image, image_image] + rfl + refine ⟨D, hD_S₂, hD_disc, ?_, ?_, ?_, ?_⟩ + · intro x hx + obtain ⟨p, rfl⟩ := hK_sub_S₂ hx + exact ⟨p, hK_sub_D_cyl (.inl hx), rfl⟩ + · rintro _ ⟨⟨p, hpD, rfl⟩, ⟨y, hy_eq⟩, _⟩ + obtain ⟨hp_bd, _⟩ := (GluedSpace.inl_eq_inr hb_inj).mp hy_eq + rw [hdiscBd_D] + exact ⟨p, hbd_sub_D_cyl ⟨hpD, hp_bd⟩, rfl⟩ + · rintro x ⟨hxD, hxU⟩ + rcases hS₂_U ⟨hD_S₂ hxD, hxU⟩ with hx12 | hxL + · exact .inl ⟨hxD, hx12⟩ + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxL + by_cases hi : i = i₀ + · subst hi + obtain ⟨p, hpD, rfl⟩ := hxD + rw [hL i] at hxi + obtain ⟨q, hq_w, hq_eq⟩ := hxi + have hpq := GluedSpace.inr_injective hb_inj hq_eq + subst hpq + exact (Set.disjoint_left.mp hD_cyl_disj hpD (hθ₀.symm ▸ hq_w)).elim + · right + refine mem_iUnion.mpr ⟨⟨i, hi⟩, ?_⟩ + rwa [hH_path_U i] + · intro j + have hsub_j : {p : ClosedCylinder | p.1.2 = w j.1} ⊆ K_all := + fun p hp => .inr (mem_iUnion.mpr ⟨j, hp⟩) + obtain ⟨hj_sub, hj_bd⟩ := hrad_D_cyl (w j.1) hsub_j + rw [hH_path_U j.1, hL j.1, hdiscBd_D, ha' j.1, hb' j.1] + refine ⟨image_mono hj_sub, ?_⟩ + rw [← Set.image_inter (GluedSpace.inr_injective hb_inj), hj_bd, image_pair] + +/-- Truncation of a respectful tangle in a drawing (Graph Minors XV, Section 3, page 120). -/ +theorem isRespectfulDrawingTangle_truncation {S : Type w} [TopologicalSpace S] + {H : Drawing S} {θ θ₁ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hResp : IsRespectfulDrawingTangle H θ T) (h1 : 1 ≤ θ₁) (hle : θ₁ ≤ θ) : + IsRespectfulDrawingTangle H θ₁ (GM10.truncation T θ₁) := by + exact GM12.IsRespectfulDrawingTangle.truncation hResp h1 hle + +/-- A path on the interface and a chord meeting the drawing only at the ends of the path +avoid one of three or more disjoint stripes if the path meets at most two stripe ends. -/ +theorem exists_stripe_avoiding_path_and_chord {X : Type*} [TopologicalSpace X] [T2Space X] + {φ : ℕ} (hφ : 3 ≤ φ) {H P : Drawing X} {S₁ S₂ F : Set X} {u v : X} + {a b : Fin φ → X} {L : Fin φ → Set X} (hS₁ : IsClosed S₁) (hS₂ : IsClosed S₂) + (hL_ends : ∀ i, L i ∩ S₁ = {a i, b i}) + (hL_disj : Pairwise fun i j => Disjoint (L i) (L j)) + (hL_verts : ∀ i, a i ∈ H.V ∧ b i ∈ H.V) (hL_sub : ∀ i, L i ⊆ H.U) + (hF_line : IsLineWithEnds F u v) (hF_U : F ∩ H.U ⊆ {u, v}) + (hP_sub : P.IsSubdrawing (H.interSet (S₁ ∩ S₂))) (hP_path : P.IsPathBetween u v) + (hP_ends : (P.V ∩ (range a ∪ range b)).ncard ≤ 2) : + P.IsSubdrawing H ∧ P.U ⊆ S₁ ∩ S₂ ∧ IsLineWithEnds P.U u v ∧ IsClosed (P.U ∪ F) ∧ + ∃ i₀ : Fin φ, Disjoint (P.U ∪ F) (L i₀) := by + have hP' : P.IsSubdrawing H := by + refine ⟨hP_sub.1.trans ?_, hP_sub.2.trans ?_⟩ + · rw [interSet_V_of_isClosed H (hS₁.inter hS₂)] + exact inter_subset_left + · rw [interSet_E H (S₁ ∩ S₂)] + exact fun _ he => he.1 + have hPU : P.U ⊆ S₁ ∩ S₂ := by + refine (isSubdrawing_U_subset hP_sub).trans ?_ + rw [(H.interSet (S₁ ∩ S₂)).U_eq, interSet_V_of_isClosed H (hS₁.inter hS₂), interSet_E] + exact union_subset inter_subset_right + (iUnion₂_subset fun e he => (hS₁.inter hS₂).closure_subset_iff.mpr he.2) + have huv : u ≠ v := by + obtain ⟨ψ, hψ₀, hψ₁⟩ := hF_line + exact fun heq => zero_ne_one (ψ.injective (Subtype.ext (hψ₀.trans (heq.trans hψ₁.symm)))) + have hP_line := GM14.isLine_of_isPathBetween hP_path huv + refine ⟨hP', hPU, hP_line, P.isClosed_U.union hF_line.isCompact.isClosed, ?_⟩ + have hpair_disj : Pairwise (fun i j => Disjoint ({a i, b i} : Set X) {a j, b j}) := by + intro i j hij + refine (hL_disj hij).mono ?_ ?_ + · rw [← hL_ends i] + exact inter_subset_left + · rw [← hL_ends j] + exact inter_subset_left + obtain ⟨i, hi⟩ := exists_disjoint_of_three_le hφ + (P.finite_V.subset inter_subset_left) hP_ends hpair_disj (fun i => + inter_subset_inter_right _ (by + rintro _ (rfl | rfl) + · exact Or.inl ⟨i, rfl⟩ + · exact Or.inr ⟨i, rfl⟩)) + have hPV : P.U ∩ H.V = P.V := isSubdrawing_U_inter_V hP' + have hpath : Disjoint P.U (L i) := disjoint_left.mpr fun x hxP hxL => by + have hx : x ∈ ({a i, b i} : Set X) := hL_ends i ▸ ⟨hxL, (hPU hxP).1⟩ + rcases hx with rfl | rfl + · exact disjoint_left.mp hi (hPV ▸ ⟨hxP, (hL_verts i).1⟩) (Or.inl rfl) + · exact disjoint_left.mp hi (hPV ▸ ⟨hxP, (hL_verts i).2⟩) (Or.inr rfl) + obtain ⟨hu, hv⟩ := hP_line.ends_mem + have hchord : Disjoint F (L i) := disjoint_left.mpr fun x hxF hxL => by + rcases hF_U ⟨hxF, hL_sub i hxL⟩ with rfl | rfl + · exact disjoint_left.mp hpath hu hxL + · exact disjoint_left.mp hpath hv hxL + exact ⟨i, hpath.union_left hchord⟩ + +/-- The path and chord lie in the striped disc, the path on its boundary. Reindexing the retained +stripes preserves the covering of the drawing inside the disc. -/ +theorem reindex_striped_disc {X : Type*} [TopologicalSpace X] {φ n : ℕ} {i₀ : Fin φ} + {P H : Drawing X} {F D S₁ S₂ : Set X} (paths : Fin φ → Drawing X) + (e : Fin n ≃ {i : Fin φ // i ≠ i₀}) + (hPU : P.U ⊆ S₁ ∩ S₂) (hPF : P.U ∪ F ⊆ D) (hbd : D ∩ (S₁ ∩ S₂) ⊆ discBd D) + (hcover : D ∩ H.U ⊆ (D ∩ (S₁ ∩ S₂)) ∪ ⋃ j : {i : Fin φ // i ≠ i₀}, (paths j.1).U) : + P.U ⊆ D ∧ F ⊆ D ∧ P.U ⊆ discBd D ∧ + D ∩ H.U ⊆ discBd D ∪ ⋃ k, (paths (e k).1).U := by + have hPD : P.U ⊆ D := subset_union_left.trans hPF + refine ⟨hPD, subset_union_right.trans hPF, (subset_inter hPD hPU).trans hbd, ?_⟩ + refine hcover.trans (union_subset (hbd.trans subset_union_left) ?_) + intro x hx + obtain ⟨j, hxj⟩ := mem_iUnion.mp hx + exact Or.inr (mem_iUnion.mpr ⟨e.symm j, by simpa using hxj⟩) + +/-- Truncation of a controlling tangle (Graph Minors XV, Section 3, page 120). -/ +theorem isControllingTangle_truncation {α : Type u} {β : Type v} + {S : Type w} [TopologicalSpace S] + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ θ₁ : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (h : IsControllingTangle G H η θ_star θ T_star T) (h1 : 1 ≤ θ₁) (hle : θ₁ ≤ θ) : + IsControllingTangle G H η θ_star θ₁ T_star (GM10.truncation T θ₁) := + IsControllingTangle.truncation h h1 hle + +private theorem original_region_cannot_meet_both_handle_cuffs + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (H : Drawing S) + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁ : Λ₁ ∈ H.R) + (hΛ₂ : Λ₂ ∈ H.R) + (hOArc₁ : IsOArc (subBd Λ₁)) + (hOArc₂ : IsOArc (subBd Λ₂)) + (hNo_common_region : ∀ r ∈ H.R, (closure r ∩ (H.V ∩ subBd Λ₁)).Nonempty → Disjoint (closure r) + (H.V ∩ subBd Λ₂)) + (hS : IsClosedSurface S) + [ConnectedSpace S] + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (hSubBd₁_sub_U : subBd Λ₁ ⊆ H.U) + (hSubBd₂_sub_U : subBd Λ₂ ⊆ H.U) + (hHU : H.U ⊆ (univ \ (Λ₁ ∪ Λ₂))) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (hS₁_cl : IsClosed (range (GluedSpace.inl hb_inj))) + (C_unp : Fin 2 → Set (GluedSpace hb_inj)) + (hC_unp_0 : C_unp 0 = GluedSpace.inr hb_inj '' range (cylEnd 1 + (by norm_num))) + (hC_unp_1 : C_unp 1 = GluedSpace.inr hb_inj '' range (cylEnd 2 + (by norm_num))) + (g_unp : S → (GluedSpace hb_inj)) + (f_unp : (GluedSpace hb_inj) → S) + (hf_unp_cont : ContinuousOn f_unp (range (GluedSpace.inl hb_inj))) + (hfg_unp_inv : LeftInvOn f_unp g_unp (univ \ (Λ₁ ∪ Λ₂))) + (hgf_unp_inv : LeftInvOn g_unp f_unp (range (GluedSpace.inl hb_inj))) + (H₁ : Drawing (GluedSpace hb_inj)) + (hH₁_U : H₁.U = g_unp '' H.U) + (m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2) + (m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2) + (H' : Drawing (GluedSpace hb_inj)) + (hH'_U : H'.U = H₁.U ∪ ⋃ i, (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 + = w i}) i) + (hinr_cylEnd_one : ∀ (z : Circle), GluedSpace.inr hb_inj (cylEnd 1 m1 z) = g_unp ↑(g₁ z)) + (hinr_cylEnd_two : ∀ (z : Circle), GluedSpace.inr hb_inj (cylEnd 2 m2 z) = g_unp ↑(g₂ z)) : + ∀ r ∈ H'.R, r ⊆ (range (GluedSpace.inl hb_inj)) → ∀ (i j : Fin 2), (closure r ∩ C_unp + i).Nonempty → (closure r ∩ C_unp j).Nonempty → i = j := by + let K := univ \ (Λ₁ ∪ Λ₂) + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let L := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + intro r hr hr_S₁ i j hi hj + by_contra hij + have hne_r := GM11.region_nonempty hr + obtain ⟨x₀, hx₀⟩ := hne_r + have hfr_disj : Disjoint (f_unp '' r) H.U := by + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨x, hxr, rfl⟩ hyU + have hx_S₁ : x ∈ S₁ := hr_S₁ hxr + have hx_H₁U : x ∈ H₁.U := by + rw [← hgf_unp_inv hx_S₁, hH₁_U] + exact mem_image_of_mem g_unp hyU + exact GM11.region_subset hr hxr (by rw [hH'_U]; exact .inl hx_H₁U) + have hx₀_not_U : f_unp x₀ ∉ H.U := + Set.disjoint_left.mp hfr_disj (mem_image_of_mem f_unp hx₀) + obtain ⟨r₀, hr₀, hx₀_r₀⟩ := GM11.exists_region_of_notMem hx₀_not_U + have hfr_conn : IsPreconnected (f_unp '' r) := + (GM11.region_isPreconnected hr).image f_unp (hf_unp_cont.mono hr_S₁) + have hfr_sub : f_unp '' r ⊆ r₀ := + GM11.subset_region hr₀ hfr_conn hfr_disj (mem_image_of_mem f_unp hx₀) hx₀_r₀ + have hcl_r_S₁ : closure r ⊆ S₁ := hS₁_cl.closure_subset_iff.mpr hr_S₁ + have hcl_sub : f_unp '' closure r ⊆ closure r₀ := + ((hf_unp_cont.mono hcl_r_S₁).image_closure).trans (closure_mono hfr_sub) + have hC0_bd : ∀ w ∈ closure r ∩ C_unp 0, f_unp w ∈ closure r₀ ∩ subBd Λ₁ := by + rintro w ⟨hw_cl, hw_C0⟩ + rw [hC_unp_0] at hw_C0 + obtain ⟨_, ⟨z, rfl⟩, rfl⟩ := hw_C0 + have hfg : f_unp (GluedSpace.inr hb_inj (cylEnd 1 m1 z)) = (g₁ z).1 := by + rw [hinr_cylEnd_one z, hfg_unp_inv (hHU (hSubBd₁_sub_U (g₁ z).2))] + exact ⟨hcl_sub (mem_image_of_mem f_unp hw_cl), hfg ▸ (g₁ z).2⟩ + have hC1_bd : ∀ w ∈ closure r ∩ C_unp 1, f_unp w ∈ closure r₀ ∩ subBd Λ₂ := by + rintro w ⟨hw_cl, hw_C1⟩ + rw [hC_unp_1] at hw_C1 + obtain ⟨_, ⟨z, rfl⟩, rfl⟩ := hw_C1 + have hfg : f_unp (GluedSpace.inr hb_inj (cylEnd 2 m2 z)) = (g₂ z).1 := by + rw [hinr_cylEnd_two z, hfg_unp_inv (hHU (hSubBd₂_sub_U (g₂ z).2))] + exact ⟨hcl_sub (mem_image_of_mem f_unp hw_cl), hfg ▸ (g₂ z).2⟩ + have h01 : (closure r ∩ C_unp 0).Nonempty ∧ (closure r ∩ C_unp 1).Nonempty := by + fin_cases i <;> fin_cases j + · exact (hij rfl).elim + · exact ⟨hi, hj⟩ + · exact ⟨hj, hi⟩ + · exact (hij rfl).elim + obtain ⟨w₀, hw₀⟩ := h01.1 + obtain ⟨w₁, hw₁⟩ := h01.2 + have hne1 : (closure r₀ ∩ (H.V ∩ subBd Λ₁)).Nonempty := + closure_region_inter_V_subBd_nonempty_of_inter_subBd_nonempty hS hr₀ hΛ₁ hOArc₁ + ⟨f_unp w₀, hC0_bd w₀ hw₀⟩ + have hne2 : (closure r₀ ∩ (H.V ∩ subBd Λ₂)).Nonempty := + closure_region_inter_V_subBd_nonempty_of_inter_subBd_nonempty hS hr₀ hΛ₂ hOArc₂ + ⟨f_unp w₁, hC1_bd w₁ hw₁⟩ + obtain ⟨z₂, hz₂_cl, hz₂_V⟩ := hne2 + exact Set.disjoint_left.mp (hNo_common_region r₀ hr₀ hne1) hz₂_cl hz₂_V + +private theorem original_surface_dial + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (H : Drawing S) + (θ : ℕ) + (φ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (Λ₁ : Set S) + (Λ₂ : Set S) + (a : Fin φ → S) + (b : Fin φ → S) + (hΛ₁ : Λ₁ ∈ H.R) + (hΛ₂ : Λ₂ ∈ H.R) + (hOArc₁ : IsOArc (subBd Λ₁)) + (hOArc₂ : IsOArc (subBd Λ₂)) + (hNo_common_region : ∀ r ∈ H.R, (closure r ∩ (H.V ∩ subBd Λ₁)).Nonempty → Disjoint (closure r) + (H.V ∩ subBd Λ₂)) + (hφ : 3 ≤ φ) + (hab_mem : ∀ (i : Fin φ), a i ∈ H.V ∩ subBd Λ₁ ∧ b i ∈ H.V ∩ subBd Λ₂) + (hFree_a : IsFreeSet H.toHypergraph T θ (range a)) + (hFree_b : IsFreeSet H.toHypergraph T θ (range b)) + (hS : IsClosedSurface S) + [ConnectedSpace S] + (hRigid_H : IsRigid H) + (hT : IsTangle H.toHypergraph θ T) + (hθ : 3 ≤ θ) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (ha_inj : Injective a) + (hb_inj_fn : Injective b) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (ι_unp : ↑(range (GluedSpace.inl hb_inj)) → S) + (a' b' : Fin φ → GluedSpace hb_inj) + (hι_unp_X : ι_unp '' Subtype.val ⁻¹' (range a' ∪ range b') = range a ∪ range b) : + ∀ (F : Set S), IsOArc F → F ∩ H.U ⊆ H.V → (F ∩ H.V).ncard ≤ 2 → ∃ Δ, IsDial H F Δ ∧ (ι_unp '' + Subtype.val ⁻¹' (range a' ∪ range b') ∩ Δ).ncard ≤ (F ∩ H.V).ncard := by + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let X_unp := range a' ∪ range b' + intro F hF hFU hFV + rw [hι_unp_X] + have ha_sub : range a ⊆ H.V ∩ subBd Λ₁ := by rintro _ ⟨i, rfl⟩; exact (hab_mem i).1 + have hb_sub : range b ⊆ H.V ∩ subBd Λ₂ := by rintro _ ⟨i, rfl⟩; exact (hab_mem i).2 + have ha_card : 2 < (range a).ncard := by + rw [Set.ncard_range_of_injective ha_inj, Nat.card_fin]; omega + have hb_card : 2 < (range b).ncard := by + rw [Set.ncard_range_of_injective hb_inj_fn, Nat.card_fin]; omega + exact theorem_3_5_claim_1 hS hRigid_H hT hθ hΛ₁ hΛ₂ hOArc₁ hOArc₂ hNo_common_region + ha_sub hb_sub ha_card hb_card hFree_a hFree_b hF hFU hFV + +private theorem cylinder_dial_of_normal_closed_curve + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hφ : 3 ≤ φ) + (hS : IsClosedSurface S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hw_inj : Injective w) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + [T2Space (GluedSpace hb_inj)] + (hS' : IsClosedSurface (GluedSpace hb_inj)) + (H₁ : Drawing (GluedSpace hb_inj)) + (m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2) + (m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2) + (a' : Fin φ → (GluedSpace hb_inj)) + (b' : Fin φ → (GluedSpace hb_inj)) + (ha'_inr : ∀ (i : Fin φ), a' i = GluedSpace.inr hb_inj (cylEnd 1 m1 (w i))) + (hb'_inr : ∀ (i : Fin φ), b' i = GluedSpace.inr hb_inj (cylEnd 2 m2 (w i))) + (hL_line : ∀ (i : Fin φ), IsLineWithEnds ((fun i => GluedSpace.inr hb_inj '' {p : + ClosedCylinder | p.1.2 = w + i}) i) (a' i) (b' i)) + (hL_disj : Pairwise fun i j => Disjoint ((fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder + | p.1.2 = w + i}) i) ((fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i}) j)) + (H_path : Fin φ → Drawing (GluedSpace hb_inj)) + (H' : Drawing (GluedSpace hb_inj)) + (hH'_U : H'.U = H₁.U ∪ ⋃ i, (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 + = w i}) i) + (hH_path : ∀ (i : Fin φ), (H_path i).U = (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder + | p.1.2 = w + i}) i ∧ (H_path i).IsPathBetween (a' i) (b' i) ∧ (H_path i).IsSubdrawing H' ∧ a' i ∈ (H_path + i).V ∧ b' i ∈ (H_path i).V) + (hS₂_U : (range (GluedSpace.inr hb_inj)) ∩ H'.U ⊆ (range (GluedSpace.inl hb_inj)) ∩ (range + (GluedSpace.inr hb_inj)) ∪ ⋃ i, (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | + p.1.2 = w i}) i) : + ∀ F ⊆ (range (GluedSpace.inr hb_inj)), IsOArc F → F ∩ H'.U ⊆ H'.V → (F ∩ H'.V).ncard ≤ 2 → ∃ Δ + ⊆ (range (GluedSpace.inr hb_inj)), IsDial H' F Δ := by + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let S₂ := range (GluedSpace.inr hb_inj) + let L := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + intro F hF_S₂ hF hFU hFV + have hL_sub_U : ∀ i, L i ⊆ H'.U := fun i => by + rw [hH'_U]; exact (subset_iUnion L i).trans subset_union_right + obtain ⟨i₀, hF_disj_i₀⟩ := exists_stripe_avoiding_normal_curve hφ hFU hFV hL_sub_U hL_disj + have hF_cl : IsClosed F := hF.isCompact.isClosed + obtain ⟨D, hD_S₂, hD_disc, hF_D, hD_bd, hD_U, hD_paths⟩ := + exists_striped_disc_in_S₂ hS hΛ₁_open hΛ₂_open hd g₁ g₂ hb_inj hw_inj + ha'_inr hb'_inr (fun _ => rfl) (fun i => (hH_path i).1) hS₂_U hF_cl hF_S₂ i₀ hF_disj_i₀ + obtain ⟨Δ, hΔ_D, hDial⟩ := + dial_of_oArc_in_remaining_stripes hS' hD_disc hD_bd hD_U + (fun i => ⟨(hH_path i).1, (hH_path i).2.2.1⟩) hL_line (fun j => (hD_paths j).2) + hL_disj hF_D hF hFU hFV + exact ⟨Δ, hΔ_D.trans hD_S₂, hDial⟩ + +private theorem cylinder_disc_of_normal_chord + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hφ : 3 ≤ φ) + (hS : IsClosedSurface S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hw_inj : Injective w) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + [T2Space (GluedSpace hb_inj)] + (hS' : IsClosedSurface (GluedSpace hb_inj)) + (hS₁_cl : IsClosed (range (GluedSpace.inl hb_inj))) + (hS₂_cl : IsClosed (range (GluedSpace.inr hb_inj))) + (C_unp : Fin 2 → Set (GluedSpace hb_inj)) + (ι_unp : ↑(range (GluedSpace.inl hb_inj)) → S) + (hSplit_unp : GM12.IsCappedSplit C_unp (range (GluedSpace.inl hb_inj)) (range (GluedSpace.inr + hb_inj)) ι_unp ![Λ₁, Λ₂]) + (hS12_inter : (range (GluedSpace.inl hb_inj)) ∩ (range (GluedSpace.inr hb_inj)) = C_unp 0 ∪ + C_unp 1) + (H₁ : Drawing (GluedSpace hb_inj)) + (m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2) + (m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2) + (a' : Fin φ → (GluedSpace hb_inj)) + (b' : Fin φ → (GluedSpace hb_inj)) + (ha'_V : ∀ (i : Fin φ), a' i ∈ H₁.V) + (hb'_V : ∀ (i : Fin φ), b' i ∈ H₁.V) + (ha'_inr : ∀ (i : Fin φ), a' i = GluedSpace.inr hb_inj (cylEnd 1 m1 (w i))) + (hb'_inr : ∀ (i : Fin φ), b' i = GluedSpace.inr hb_inj (cylEnd 2 m2 (w i))) + (hL_line : ∀ (i : Fin φ), IsLineWithEnds ((fun i => GluedSpace.inr hb_inj '' {p : + ClosedCylinder | p.1.2 = w + i}) i) (a' i) (b' i)) + (hL_disj : Pairwise fun i j => Disjoint ((fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder + | p.1.2 = w + i}) i) ((fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i}) j)) + (hL_S₁ : ∀ (i : Fin φ), (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 + = w i}) i ∩ (range + (GluedSpace.inl hb_inj)) = {a' i, b' i}) + (H_path : Fin φ → Drawing (GluedSpace hb_inj)) + (H' : Drawing (GluedSpace hb_inj)) + (hH'_U : H'.U = H₁.U ∪ ⋃ i, (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 + = w i}) i) + (hSub_H₁ : H₁.IsSubdrawing H') + (hH_path : ∀ (i : Fin φ), (H_path i).U = (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder + | p.1.2 = w + i}) i ∧ (H_path i).IsPathBetween (a' i) (b' i) ∧ (H_path i).IsSubdrawing H' ∧ a' i ∈ (H_path + i).V ∧ b' i ∈ (H_path i).V) + (ha'_C0 : ∀ (i : Fin φ), a' i ∈ C_unp 0) + (hb'_C1 : ∀ (i : Fin φ), b' i ∈ C_unp 1) + (hS₂_U : (range (GluedSpace.inr hb_inj)) ∩ H'.U ⊆ (range (GluedSpace.inl hb_inj)) ∩ (range + (GluedSpace.inr hb_inj)) ∪ ⋃ i, (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | + p.1.2 = w i}) i) : + ∀ (F : Set (GluedSpace hb_inj)) (u v : GluedSpace hb_inj) (P : Drawing (GluedSpace hb_inj)), F + ⊆ (range (GluedSpace.inr hb_inj)) → u ∈ (range (GluedSpace.inl hb_inj)) ∩ (range + (GluedSpace.inr hb_inj)) ∩ H'.V → v ∈ (range (GluedSpace.inl hb_inj)) ∩ (range + (GluedSpace.inr hb_inj)) ∩ H'.V → IsLineWithEnds F u v → F ∩ H'.U ⊆ {u, v} → P.IsSubdrawing + (H'.interSet ((range (GluedSpace.inl hb_inj)) ∩ (range (GluedSpace.inr hb_inj)))) → + P.IsPathBetween u v → (P.V ∩ (range a' ∪ range b')).ncard ≤ 2 → ∃ U₀, IsOpenDisc U₀ ∧ + IsClosedDisc (closure U₀) ∧ U₀ ⊆ (range (GluedSpace.inr hb_inj)) ∧ subBd U₀ = P.U ∪ F ∧ + Disjoint U₀ H'.U := by + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let S₂ := range (GluedSpace.inr hb_inj) + let L := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + let X_unp := range a' ∪ range b' + intro F u v P hF_S₂ hu hv hF_line hF_U hP_sub_inter hP_path hPX_card + obtain ⟨hP_sub_H', hPU_inter, hP_line, hK_sub_cl, i₀, havoid⟩ := + exists_stripe_avoiding_path_and_chord hφ hS₁_cl hS₂_cl hL_S₁ hL_disj + (fun i => ⟨hSub_H₁.1 (ha'_V i), hSub_H₁.1 (hb'_V i)⟩) + (fun i x hx => by rw [hH'_U]; exact Or.inr (mem_iUnion.mpr ⟨i, hx⟩)) + hF_line hF_U hP_sub_inter hP_path hPX_card + obtain ⟨ψ_P, -, -⟩ := hP_line + have hPU_S₂ : P.U ⊆ S₂ := hPU_inter.trans inter_subset_right + obtain ⟨D, hD_S₂, hD_disc, hPF_D, hD_bd, hD_U, hD_paths⟩ := + exists_striped_disc_in_S₂ hS hΛ₁_open hΛ₂_open hd g₁ g₂ hb_inj hw_inj + ha'_inr hb'_inr (fun _ => rfl) (fun i => (hH_path i).1) hS₂_U hK_sub_cl + (union_subset hPU_S₂ hF_S₂) i₀ havoid + let e_sub := (Fintype.equivFin {i : Fin φ // i ≠ i₀}).symm + obtain ⟨hPU_D, hF_D, hPU_bd, hD_U_fin⟩ := + reindex_striped_disc H_path e_sub hPU_inter hPF_D hD_bd hD_U + have hNo_both : ∀ k, ¬ (a' (e_sub k).1 ∈ P.V ∧ b' (e_sub k).1 ∈ P.V) := by + rintro k ⟨ha_j, hb_j⟩ + let j := e_sub k + have hC0_cl : IsClosed (C_unp 0) := by + obtain ⟨γ⟩ := hSplit_unp.isOArc 0 + have hEq : C_unp 0 = range (fun z : Circle => (γ z).1) := by + ext x + exact ⟨fun hx => ⟨γ.symm ⟨x, hx⟩, by simp⟩, fun ⟨z, hz⟩ => hz ▸ (γ z).2⟩ + rw [hEq] + exact (isCompact_range (continuous_subtype_val.comp γ.continuous)).isClosed + have hC1_cl : IsClosed (C_unp 1) := by + obtain ⟨γ⟩ := hSplit_unp.isOArc 1 + have hEq : C_unp 1 = range (fun z : Circle => (γ z).1) := by + ext x + exact ⟨fun hx => ⟨γ.symm ⟨x, hx⟩, by simp⟩, fun ⟨z, hz⟩ => hz ▸ (γ z).2⟩ + rw [hEq] + exact (isCompact_range (continuous_subtype_val.comp γ.continuous)).isClosed + have hC01_disj : Disjoint (C_unp 0) (C_unp 1) := + hSplit_unp.disjoint 0 1 (by decide) + have hPU_conn : IsPreconnected P.U := by + have hEq : P.U = range (fun s : unitInterval => (ψ_P s).1) := by + ext x + exact ⟨fun hx => ⟨ψ_P.symm ⟨x, hx⟩, by simp⟩, fun ⟨s, hs⟩ => hs ▸ (ψ_P s).2⟩ + rw [hEq] + exact isPreconnected_range (continuous_subtype_val.comp ψ_P.continuous) + have hPU_sub_01 : P.U ⊆ C_unp 0 ∪ C_unp 1 := hS12_inter ▸ hPU_inter + obtain ⟨z, hzPU, hz0, hz1⟩ := + hPU_conn (C_unp 0)ᶜ (C_unp 1)ᶜ hC0_cl.isOpen_compl hC1_cl.isOpen_compl + (fun x hx => by + rcases hPU_sub_01 hx with hx0 | hx1 + · exact .inr (Set.disjoint_left.mp hC01_disj hx0) + · exact .inl (Set.disjoint_right.mp hC01_disj hx1)) + ⟨b' j.1, P.V_subset_U hb_j, Set.disjoint_right.mp hC01_disj (hb'_C1 j.1)⟩ + ⟨a' j.1, P.V_subset_U ha_j, Set.disjoint_left.mp hC01_disj (ha'_C0 j.1)⟩ + rcases hPU_sub_01 hzPU with hz_in0 | hz_in1 + · exact hz0 hz_in0 + · exact hz1 hz_in1 + obtain ⟨U₀, hU₀_open, hU₀_cl, hU₀_D, hU₀_bd, hU₀_disj⟩ := + openDisc_of_chord_in_striped_disc hS' hD_disc (Subset.refl _) hD_U_fin + (fun k => (hH_path (e_sub k).1).1 ▸ hL_line (e_sub k).1) + (fun k => (hH_path (e_sub k).1).2.2.1) + (fun k => ⟨(hH_path (e_sub k).1).2.2.2.1, (hH_path (e_sub k).1).2.2.2.2⟩) + (fun k => (hD_paths (e_sub k)).2) + hPU_D hF_D hPU_bd hF_line hF_U hP_sub_H' hP_path hNo_both + exact ⟨U₀, hU₀_open, hU₀_cl, hU₀_D.trans hD_S₂, hU₀_bd, hU₀_disj⟩ + +private theorem normal_line_between_pinched_cuffs_meets_many_vertices + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (H : Drawing S) + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (h_lines : ∀ (F : Set S), IsLine F → H.IsNormal F → F ⊆ univ \ (Λ₁ ∪ Λ₂) → (F ∩ subBd + Λ₁).Nonempty → (F ∩ subBd Λ₂).Nonempty → φ ≤ (F ∩ H.V).ncard) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (hK_cl : IsClosed (univ \ (Λ₁ ∪ Λ₂))) + (hHU : H.U ⊆ (univ \ (Λ₁ ∪ Λ₂))) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (g_unp : S → (GluedSpace hb_inj)) + (f_unp : (GluedSpace hb_inj) → S) + (hg_unp_mem : ∀ (y : S) (hy : y ∈ (univ \ (Λ₁ ∪ Λ₂))), g_unp y = GluedSpace.inl hb_inj ⟨y, + hy⟩) + (hf_unp_inl : ∀ (y : ↑(univ \ (Λ₁ ∪ Λ₂))), f_unp (GluedSpace.inl hb_inj y) = ↑y) + (hfg_unp_inv : LeftInvOn f_unp g_unp (univ \ (Λ₁ ∪ Λ₂))) + (H₁ : Drawing (GluedSpace hb_inj)) + (hH₁_U : H₁.U = g_unp '' H.U) + (hH₁_V : H₁.V = g_unp '' H.V) + (H' : Drawing (GluedSpace hb_inj)) + (hH'_U : H'.U = H₁.U ∪ ⋃ i, (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 + = w i}) i) + (hSub_H₁ : H₁.IsSubdrawing H') + (C_XII : Fin 2 → Set (GluedSpace hb_inj)) + (P₁_XII : Set (GluedSpace hb_inj)) + (P₂_XII : Set (GluedSpace hb_inj)) + (ι_XII : ↑P₁_XII → S) + (D_XII : Fin 2 → Set S) + (f_XII : GluedSpace hb_inj → S) + (hSplit_XII : GM12.IsHandleSplit C_XII P₁_XII P₂_XII ι_XII D_XII) + (hf_XII_inl : ∀ (y : ↑(univ \ (Λ₁ ∪ Λ₂))), f_XII (GluedSpace.inl hb_inj y) = ↑y) + (hι_XII_eq : ∀ (x : ↑P₁_XII), ι_XII x = f_XII ↑x) + (hι_XII_emb : IsClosedEmbedding ι_XII) + (hcl_D0_sub : closure (D_XII 0) ⊆ closure Λ₁) + (hcl_D1_sub : closure (D_XII 1) ⊆ closure Λ₂) + (hf_XII_C0 : f_XII '' C_XII 0 = subBd (D_XII 0)) + (hf_XII_C1 : f_XII '' C_XII 1 = subBd (D_XII 1)) + (hf_XII_P₁ : f_XII '' P₁_XII = closure Λ₁ \ D_XII 0 ∪ univ \ (Λ₁ ∪ Λ₂) ∪ closure Λ₂ \ D_XII 1) + (hf_XII_mem_S₁ : ∀ x ∈ P₁_XII, f_XII x ∈ univ \ (Λ₁ ∪ Λ₂) → x ∈ range (GluedSpace.inl hb_inj)) + (hV_P₁_XII : H'.V ∩ P₁_XII = H₁.V) : + ∀ (F : Set (GluedSpace hb_inj)), IsLine F → H'.IsNormal F → F ⊆ P₁_XII → (F ∩ C_XII + 0).Nonempty → (F ∩ C_XII 1).Nonempty → φ ≤ (F ∩ H'.V).ncard := by + let K := univ \ (Λ₁ ∪ Λ₂) + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let L := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + intro F hF_line hF_norm hF_P₁ hF_C0 hF_C1 + have hf_injOn : InjOn f_XII P₁_XII := by + intro x₁ hx₁ x₂ hx₂ h + have hι : ι_XII ⟨x₁, hx₁⟩ = ι_XII ⟨x₂, hx₂⟩ := by + rw [hι_XII_eq ⟨x₁, hx₁⟩, hι_XII_eq ⟨x₂, hx₂⟩] + exact h + exact congrArg Subtype.val (hι_XII_emb.injective hι) + let F_S : Set S := f_XII '' F + have hF_S_eq : F_S = ι_XII '' (Subtype.val ⁻¹' F) := by + ext y + exact ⟨by rintro ⟨x, hxF, rfl⟩; exact ⟨⟨x, hF_P₁ hxF⟩, hxF, hι_XII_eq ⟨x, hF_P₁ hxF⟩⟩, + by rintro ⟨⟨x, hxP₁⟩, hxF, rfl⟩; exact ⟨x, hxF, (hι_XII_eq ⟨x, hxP₁⟩).symm⟩⟩ + have hF_S_line : IsLine F_S := by + obtain ⟨ψ⟩ := hF_line + let g_F : unitInterval → S := fun s => ι_XII ⟨(ψ s).1, hF_P₁ (ψ s).2⟩ + have hg_F_emb : IsEmbedding g_F := + hι_XII_emb.isEmbedding.comp + ((IsEmbedding.subtypeVal.comp ψ.isEmbedding).codRestrict P₁_XII (fun s => hF_P₁ (ψ s).2)) + have hg_F_range : range g_F = F_S := by + rw [hF_S_eq] + ext y + constructor + · rintro ⟨s, rfl⟩ + exact ⟨⟨(ψ s).1, hF_P₁ (ψ s).2⟩, (ψ s).2, rfl⟩ + · rintro ⟨⟨x, hxP₁⟩, hxF, rfl⟩ + exact ⟨ψ.symm ⟨x, hxF⟩, by dsimp [g_F]; rw [ψ.apply_symm_apply]⟩ + exact ⟨hg_F_emb.toHomeomorph.trans (Homeomorph.setCongr hg_F_range)⟩ + have hF_S_sub : F_S ⊆ (closure Λ₁ \ D_XII 0) ∪ K ∪ (closure Λ₂ \ D_XII 1) := by + rw [← hf_XII_P₁] + exact image_mono hF_P₁ + have hK₁_cl : IsClosed (closure Λ₁ \ D_XII 0) := + isClosed_closure.sdiff (hSplit_XII.1.isOpenDisc 0).1 + have hK₂_cl : IsClosed (closure Λ₂ \ D_XII 1) := + isClosed_closure.sdiff (hSplit_XII.1.isOpenDisc 1).1 + have hK₁₂_disj : Disjoint (closure Λ₁ \ D_XII 0) (closure Λ₂ \ D_XII 1) := + hd.mono sdiff_subset sdiff_subset + have hF_S_K₁ : (F_S ∩ (closure Λ₁ \ D_XII 0)).Nonempty := by + obtain ⟨x, hxF, hxC0⟩ := hF_C0 + refine ⟨f_XII x, mem_image_of_mem f_XII hxF, ?_⟩ + have hbd : f_XII x ∈ subBd (D_XII 0) := hf_XII_C0 ▸ mem_image_of_mem f_XII hxC0 + rw [subBd_eq_frontier, (hSplit_XII.1.isOpenDisc 0).1.frontier_eq] at hbd + exact ⟨hcl_D0_sub hbd.1, hbd.2⟩ + have hF_S_K₂ : (F_S ∩ (closure Λ₂ \ D_XII 1)).Nonempty := by + obtain ⟨x, hxF, hxC1⟩ := hF_C1 + refine ⟨f_XII x, mem_image_of_mem f_XII hxF, ?_⟩ + have hbd : f_XII x ∈ subBd (D_XII 1) := hf_XII_C1 ▸ mem_image_of_mem f_XII hxC1 + rw [subBd_eq_frontier, (hSplit_XII.1.isOpenDisc 1).1.frontier_eq] at hbd + exact ⟨hcl_D1_sub hbd.1, hbd.2⟩ + obtain ⟨F₀, hF₀_sub_FS, hF₀_line, hF₀_K, hF₀_1, hF₀_2⟩ := + exists_subline_of_closed_cover hK₁_cl hK_cl hK₂_cl hK₁₂_disj hF_S_line + hF_S_sub hF_S_K₁ hF_S_K₂ + have hK₁_inter : (closure Λ₁ \ D_XII 0) ∩ K ⊆ subBd Λ₁ := by + rintro y ⟨⟨hy_cl, _⟩, _, hy_not⟩ + rw [subBd_eq_frontier, hΛ₁_open.frontier_eq] + exact ⟨hy_cl, fun h => hy_not (.inl h)⟩ + have hK₂_inter : (closure Λ₂ \ D_XII 1) ∩ K ⊆ subBd Λ₂ := by + rintro y ⟨⟨hy_cl, _⟩, _, hy_not⟩ + rw [subBd_eq_frontier, hΛ₂_open.frontier_eq] + exact ⟨hy_cl, fun h => hy_not (.inr h)⟩ + have hF₀_bd₁ : (F₀ ∩ subBd Λ₁).Nonempty := + hF₀_1.mono (inter_subset_inter_right _ hK₁_inter) + have hF₀_bd₂ : (F₀ ∩ subBd Λ₂).Nonempty := + hF₀_2.mono (inter_subset_inter_right _ hK₂_inter) + have hF₀_norm : H.IsNormal F₀ := by + intro y ⟨hyF₀, hyU⟩ + obtain ⟨x, hxF, rfl⟩ := hF₀_sub_FS hyF₀ + have hx_S₁ : x ∈ S₁ := hf_XII_mem_S₁ x (hF_P₁ hxF) (hF₀_K hyF₀) + obtain ⟨⟨z, hzK⟩, rfl⟩ := hx_S₁ + rw [hf_XII_inl ⟨z, hzK⟩] at hyU ⊢ + have hg_z : g_unp z = GluedSpace.inl hb_inj ⟨z, hzK⟩ := hg_unp_mem z hzK + have hx_H'U : GluedSpace.inl hb_inj ⟨z, hzK⟩ ∈ H'.U := by + rw [hH'_U, hH₁_U, ← hg_z] + exact .inl (mem_image_of_mem g_unp hyU) + have hx_H'V : GluedSpace.inl hb_inj ⟨z, hzK⟩ ∈ H'.V := hF_norm ⟨hxF, hx_H'U⟩ + have hx_H₁V : GluedSpace.inl hb_inj ⟨z, hzK⟩ ∈ H₁.V := + hV_P₁_XII ▸ ⟨hx_H'V, hF_P₁ hxF⟩ + rw [hH₁_V] at hx_H₁V + obtain ⟨w_v, hw_v, hw_eq⟩ := hx_H₁V + have hzw : w_v = z := by + have h := congrArg f_unp hw_eq + rwa [hfg_unp_inv (hHU (H.V_subset_U hw_v)), hf_unp_inl ⟨z, hzK⟩] at h + exact hzw ▸ hw_v + have hφ_le_F₀ : φ ≤ (F₀ ∩ H.V).ncard := + h_lines F₀ hF₀_line hF₀_norm hF₀_K hF₀_bd₁ hF₀_bd₂ + have hF₀_sub_img : F₀ ∩ H.V ⊆ f_XII '' (F ∩ H'.V) := by + intro y ⟨hyF₀, hyV⟩ + obtain ⟨x, hxF, rfl⟩ := hF₀_sub_FS hyF₀ + have hx_S₁ : x ∈ S₁ := hf_XII_mem_S₁ x (hF_P₁ hxF) (hF₀_K hyF₀) + obtain ⟨⟨z, hzK⟩, rfl⟩ := hx_S₁ + rw [hf_XII_inl ⟨z, hzK⟩] at hyV ⊢ + have hg_z : g_unp z = GluedSpace.inl hb_inj ⟨z, hzK⟩ := hg_unp_mem z hzK + have hx_H₁V : GluedSpace.inl hb_inj ⟨z, hzK⟩ ∈ H₁.V := by + rw [hH₁_V, ← hg_z] + exact mem_image_of_mem g_unp hyV + exact ⟨GluedSpace.inl hb_inj ⟨z, hzK⟩, ⟨hxF, hSub_H₁.1 hx_H₁V⟩, hf_XII_inl ⟨z, hzK⟩⟩ + have h_img_card : (f_XII '' (F ∩ H'.V)).ncard = (F ∩ H'.V).ncard := + (hf_injOn.mono (inter_subset_left.trans hF_P₁)).ncard_image + calc φ ≤ (F₀ ∩ H.V).ncard := hφ_le_F₀ + _ ≤ (f_XII '' (F ∩ H'.V)).ncard := + Set.ncard_le_ncard hF₀_sub_img ((H'.finite_V.subset inter_subset_right).image f_XII) + _ = (F ∩ H'.V).ncard := h_img_card + +private theorem handle_line_intersects_original_surface_only_at_ends + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (H₁ : Drawing (GluedSpace hb_inj)) + (hH₁_sub_S₁ : H₁.U ⊆ (range (GluedSpace.inl hb_inj))) + (m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2) + (m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2) + (a' : Fin φ → (GluedSpace hb_inj)) + (b' : Fin φ → (GluedSpace hb_inj)) + (ha'_V : ∀ (i : Fin φ), a' i ∈ H₁.V) + (hb'_V : ∀ (i : Fin φ), b' i ∈ H₁.V) + (ha'_inr : ∀ (i : Fin φ), a' i = GluedSpace.inr hb_inj (cylEnd 1 m1 (w i))) + (hb'_inr : ∀ (i : Fin φ), b' i = GluedSpace.inr hb_inj (cylEnd 2 m2 (w i))) : + ∀ (i : Fin φ), (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i}) i ∩ (range + (GluedSpace.inl hb_inj)) = {a' i, b' i} := by + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let L := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + intro i + ext x + constructor + · rintro ⟨⟨p, hp, rfl⟩, ⟨y, hy_eq⟩⟩ + obtain ⟨hp_bd, _⟩ := (GluedSpace.inl_eq_inr hb_inj).mp hy_eq + rcases handleGlueMap_fst_eq_one_or_two ⟨p, hp_bd⟩ with hr1 | hr2 + · left + rw [ha'_inr i] + exact congrArg (GluedSpace.inr hb_inj) (Subtype.ext (Prod.ext hr1 hp)) + · right + rw [hb'_inr i] + exact congrArg (GluedSpace.inr hb_inj) (Subtype.ext (Prod.ext hr2 hp)) + · rintro (rfl | rfl) + · exact ⟨by rw [ha'_inr i]; exact ⟨cylEnd 1 m1 (w i), rfl, rfl⟩, + hH₁_sub_S₁ (H₁.V_subset_U (ha'_V i))⟩ + · exact ⟨by rw [hb'_inr i]; exact ⟨cylEnd 2 m2 (w i), rfl, rfl⟩, + hH₁_sub_S₁ (H₁.V_subset_U (hb'_V i))⟩ + +private theorem original_drawing_meets_pinched_handle_at_marked_ends + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (H₁ : Drawing (GluedSpace hb_inj)) + (hH₁_sub_S₁ : H₁.U ⊆ (range (GluedSpace.inl hb_inj))) + (a' : Fin φ → (GluedSpace hb_inj)) + (b' : Fin φ → (GluedSpace hb_inj)) + (H' : Drawing (GluedSpace hb_inj)) + (hH'_U : H'.U = H₁.U ∪ ⋃ i, (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 + = w i}) i) + (C_XII : Fin 2 → Set (GluedSpace hb_inj)) + (P₁_XII : Set (GluedSpace hb_inj)) + (P₂_XII : Set (GluedSpace hb_inj)) + (ι_XII : ↑P₁_XII → S) + (D_XII : Fin 2 → Set S) + (hSplit_XII : GM12.IsHandleSplit C_XII P₁_XII P₂_XII ι_XII D_XII) + (hS₁_sub_P₁ : range (GluedSpace.inl hb_inj) ⊆ P₁_XII) + (hNorm_C0_and_V : H'.IsNormal (C_XII 0) ∧ H'.V ∩ C_XII 0 = range a') + (hNorm_C1_and_V : H'.IsNormal (C_XII 1) ∧ H'.V ∩ C_XII 1 = range b') : + H₁.U ∩ P₂_XII ⊆ ⋃ i, {a' i, b' i} := by + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let L := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + intro x ⟨hx1, hx2⟩ + have hx_inter : x ∈ P₁_XII ∩ P₂_XII := ⟨hS₁_sub_P₁ (hH₁_sub_S₁ hx1), hx2⟩ + rw [hSplit_XII.1.inter] at hx_inter + obtain ⟨j, hxj⟩ := mem_iUnion.mp hx_inter + fin_cases j + · have hx_a' : x ∈ range a' := by + have h : x ∈ H'.V ∩ C_XII 0 := ⟨hNorm_C0_and_V.1 ⟨hxj, by rw [hH'_U]; exact .inl hx1⟩, hxj⟩ + rwa [hNorm_C0_and_V.2] at h + obtain ⟨i, rfl⟩ := hx_a' + exact mem_iUnion.mpr ⟨i, .inl rfl⟩ + · have hx_b' : x ∈ range b' := by + have h : x ∈ H'.V ∩ C_XII 1 := ⟨hNorm_C1_and_V.1 ⟨hxj, by rw [hH'_U]; exact .inl hx1⟩, hxj⟩ + rwa [hNorm_C1_and_V.2] at h + obtain ⟨i, rfl⟩ := hx_b' + exact mem_iUnion.mpr ⟨i, .inr rfl⟩ + +private theorem lower_pinched_cuff_is_normal + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (H₁ : Drawing (GluedSpace hb_inj)) + (m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2) + (a' : Fin φ → (GluedSpace hb_inj)) + (ha'_V : ∀ (i : Fin φ), a' i ∈ H₁.V) + (H_path : Fin φ → Drawing (GluedSpace hb_inj)) + (H' : Drawing (GluedSpace hb_inj)) + (hH'_U : H'.U = H₁.U ∪ ⋃ i, (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 + = w i}) i) + (hH'_V : H'.V = H₁.V ∪ ⋃ i, (H_path i).V) + (W_pts : Set Circle) + (CollarInt : Set (GluedSpace hb_inj)) + (hCollar : CollarInt = GluedSpace.inr hb_inj '' + {q : ClosedCylinder | 1 < q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ W_pts}) + (C_XII : Fin 2 → Set (GluedSpace hb_inj)) + (hW1_sub_C0 : GluedSpace.inr hb_inj '' cylEnd 1 (by norm_num) + '' W_pts ⊆ C_XII 0) + (hC0_diff_W1 : C_XII 0 \ GluedSpace.inr hb_inj '' cylEnd 1 + (by norm_num) '' W_pts ⊆ GluedSpace.inr hb_inj '' {q | 1 < + q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ W_pts}) + (hCollar_disj : Disjoint CollarInt H'.U) + (hW1_eq_a' : GluedSpace.inr hb_inj '' cylEnd 1 m1 '' W_pts = range a') : + H'.IsNormal (C_XII 0) ∧ H'.V ∩ C_XII 0 = range a' := by + subst CollarInt + let S' := GluedSpace hb_inj + let L := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + refine glued_isNormal_and_V_inter ?_ ?_ ?_ hH'_U hH'_V + · rintro _ ⟨i, rfl⟩; exact ha'_V i + · refine Subset.antisymm ?_ ?_ + · intro x ⟨hx1, hxC0⟩ + by_contra hnot + exact Set.disjoint_left.mp hCollar_disj + (hC0_diff_W1 ⟨hxC0, hW1_eq_a'.symm ▸ hnot⟩) (by rw [hH'_U]; exact .inl hx1) + · rintro _ ⟨i, rfl⟩ + exact ⟨H₁.V_subset_U (ha'_V i), hW1_sub_C0 (hW1_eq_a'.symm ▸ ⟨i, rfl⟩)⟩ + · intro x ⟨hxL, hxC0⟩ + by_contra hnot + exact Set.disjoint_left.mp hCollar_disj + (hC0_diff_W1 ⟨hxC0, hW1_eq_a'.symm ▸ hnot⟩) (by rw [hH'_U]; exact .inr hxL) + +private theorem upper_pinched_cuff_is_normal + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (H₁ : Drawing (GluedSpace hb_inj)) + (m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2) + (b' : Fin φ → (GluedSpace hb_inj)) + (hb'_V : ∀ (i : Fin φ), b' i ∈ H₁.V) + (H_path : Fin φ → Drawing (GluedSpace hb_inj)) + (H' : Drawing (GluedSpace hb_inj)) + (hH'_U : H'.U = H₁.U ∪ ⋃ i, (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 + = w i}) i) + (hH'_V : H'.V = H₁.V ∪ ⋃ i, (H_path i).V) + (W_pts : Set Circle) + (CollarInt : Set (GluedSpace hb_inj)) + (hCollar : CollarInt = GluedSpace.inr hb_inj '' + {q : ClosedCylinder | 1 < q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ W_pts}) + (C_XII : Fin 2 → Set (GluedSpace hb_inj)) + (hW2_sub_C1 : GluedSpace.inr hb_inj '' cylEnd 2 (by norm_num) + '' W_pts ⊆ C_XII 1) + (hC1_diff_W2 : C_XII 1 \ GluedSpace.inr hb_inj '' cylEnd 2 + (by norm_num) '' W_pts ⊆ GluedSpace.inr hb_inj '' {q | 1 < + q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ W_pts}) + (hCollar_disj : Disjoint CollarInt H'.U) + (hW2_eq_b' : GluedSpace.inr hb_inj '' cylEnd 2 m2 '' W_pts = range b') : + H'.IsNormal (C_XII 1) ∧ H'.V ∩ C_XII 1 = range b' := by + subst CollarInt + let S' := GluedSpace hb_inj + let L := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + refine glued_isNormal_and_V_inter ?_ ?_ ?_ hH'_U hH'_V + · rintro _ ⟨i, rfl⟩; exact hb'_V i + · refine Subset.antisymm ?_ ?_ + · intro x ⟨hx1, hxC1⟩ + by_contra hnot + exact Set.disjoint_left.mp hCollar_disj + (hC1_diff_W2 ⟨hxC1, hW2_eq_b'.symm ▸ hnot⟩) (by rw [hH'_U]; exact .inl hx1) + · rintro _ ⟨i, rfl⟩ + exact ⟨H₁.V_subset_U (hb'_V i), hW2_sub_C1 (hW2_eq_b'.symm ▸ ⟨i, rfl⟩)⟩ + · intro x ⟨hxL, hxC1⟩ + by_contra hnot + exact Set.disjoint_left.mp hCollar_disj + (hC1_diff_W2 ⟨hxC1, hW2_eq_b'.symm ▸ hnot⟩) (by rw [hH'_U]; exact .inr hxL) + +private theorem unpinched_embedding_maps_marked_nodes + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (a : Fin φ → S) + (b : Fin φ → S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (ι_unp : ↑(range (GluedSpace.inl hb_inj)) → S) + (g_unp : S → (GluedSpace hb_inj)) + (a' : Fin φ → (GluedSpace hb_inj)) + (hEnd : a' = fun i => g_unp (a i)) + (b' : Fin φ → (GluedSpace hb_inj)) + (hEnd : b' = fun i => g_unp (b i)) + (ha_K : ∀ (i : Fin φ), a i ∈ (univ \ (Λ₁ ∪ Λ₂))) + (hb_K : ∀ (i : Fin φ), b i ∈ (univ \ (Λ₁ ∪ Λ₂))) + (H' : Drawing (GluedSpace hb_inj)) + (hι_unp_g : ∀ y ∈ (univ \ (Λ₁ ∪ Λ₂)), ∀ (hy : g_unp y ∈ (range (GluedSpace.inl hb_inj))), + ι_unp ⟨g_unp y, hy⟩ = y) + (hX_unp_sub : (range a' ∪ range b') ⊆ H'.V ∩ ((range (GluedSpace.inl hb_inj)) ∩ (range + (GluedSpace.inr hb_inj)))) : + ι_unp '' Subtype.val ⁻¹' (range a' ∪ range b') = range a ∪ range b := by + subst b' + let b' : Fin φ → GluedSpace hb_inj := fun i => g_unp (b i) + subst a' + let a' : Fin φ → GluedSpace hb_inj := fun i => g_unp (a i) + let K := univ \ (Λ₁ ∪ Λ₂) + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let S₂ := range (GluedSpace.inr hb_inj) + let X_unp := range a' ∪ range b' + ext y + constructor + · rintro ⟨⟨x, hxS₁⟩, ⟨i, rfl⟩ | ⟨i, rfl⟩, rfl⟩ + · rw [hι_unp_g (a i) (ha_K i) hxS₁] + exact .inl ⟨i, rfl⟩ + · rw [hι_unp_g (b i) (hb_K i) hxS₁] + exact .inr ⟨i, rfl⟩ + · rintro (⟨i, rfl⟩ | ⟨i, rfl⟩) + · have hxS₁ : a' i ∈ S₁ := (hX_unp_sub (.inl ⟨i, rfl⟩)).2.1 + exact ⟨⟨a' i, hxS₁⟩, .inl ⟨i, rfl⟩, hι_unp_g (a i) (ha_K i) hxS₁⟩ + · have hxS₁ : b' i ∈ S₁ := (hX_unp_sub (.inr ⟨i, rfl⟩)).2.1 + exact ⟨⟨b' i, hxS₁⟩, .inr ⟨i, rfl⟩, hι_unp_g (b i) (hb_K i) hxS₁⟩ + +private theorem upper_handle_end_maps_to_cylinder + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (b : Fin φ → S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hg₂_w : ∀ (i : Fin φ), ↑(g₂ (w i)) = b i) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (g_unp : S → (GluedSpace hb_inj)) + (hg_unp_mem : ∀ (y : S) (hy : y ∈ (univ \ (Λ₁ ∪ Λ₂))), g_unp y = GluedSpace.inl hb_inj ⟨y, + hy⟩) + (m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2) + (b' : Fin φ → (GluedSpace hb_inj)) + (hEnd : b' = fun i => g_unp (b i)) + (hb_K : ∀ (i : Fin φ), b i ∈ (univ \ (Λ₁ ∪ Λ₂))) : + ∀ (i : Fin φ), b' i = GluedSpace.inr hb_inj (cylEnd 2 m2 (w i)) := by + subst b' + let b' : Fin φ → GluedSpace hb_inj := fun i => g_unp (b i) + let b_glue := handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ + let K := univ \ (Λ₁ ∪ Λ₂) + let S' := GluedSpace hb_inj + intro i + have hbd2 : cylEnd 2 m2 (w i) ∈ bd ↥ClosedCylinder := by + rw [bd_cylinder]; exact .inr ⟨w i, rfl⟩ + have hb2 : b_glue ⟨cylEnd 2 m2 (w i), hbd2⟩ = ⟨b i, hb_K i⟩ := by + apply Subtype.ext + change (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ ⟨cylEnd 2 m2 (w i), hbd2⟩).1 = b i + rw [handleGlueMap_cylEnd_two] + exact hg₂_w i + dsimp [b'] + rw [hg_unp_mem (b i) (hb_K i), ← hb2] + exact (GluedSpace.inl_eq_inr hb_inj).mpr ⟨hbd2, rfl⟩ + +private theorem lower_handle_end_maps_to_cylinder + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (a : Fin φ → S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hg₁_w : ∀ (i : Fin φ), ↑(g₁ (w i)) = a i) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (g_unp : S → (GluedSpace hb_inj)) + (hg_unp_mem : ∀ (y : S) (hy : y ∈ (univ \ (Λ₁ ∪ Λ₂))), g_unp y = GluedSpace.inl hb_inj ⟨y, + hy⟩) + (m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2) + (a' : Fin φ → (GluedSpace hb_inj)) + (hEnd : a' = fun i => g_unp (a i)) + (ha_K : ∀ (i : Fin φ), a i ∈ (univ \ (Λ₁ ∪ Λ₂))) : + ∀ (i : Fin φ), a' i = GluedSpace.inr hb_inj (cylEnd 1 m1 (w i)) := by + subst a' + let a' : Fin φ → GluedSpace hb_inj := fun i => g_unp (a i) + let b_glue := handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ + let K := univ \ (Λ₁ ∪ Λ₂) + let S' := GluedSpace hb_inj + intro i + have hbd1 : cylEnd 1 m1 (w i) ∈ bd ↥ClosedCylinder := by + rw [bd_cylinder]; exact .inl ⟨w i, rfl⟩ + have hb1 : b_glue ⟨cylEnd 1 m1 (w i), hbd1⟩ = ⟨a i, ha_K i⟩ := by + apply Subtype.ext + change (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ ⟨cylEnd 1 m1 (w i), hbd1⟩).1 = a i + rw [handleGlueMap_cylEnd_one] + exact hg₁_w i + dsimp [a'] + rw [hg_unp_mem (a i) (ha_K i), ← hb1] + exact (GluedSpace.inl_eq_inr hb_inj).mpr ⟨hbd1, rfl⟩ + +private theorem unmarked_handle_collars_avoid_drawing + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (H₁ : Drawing (GluedSpace hb_inj)) + (hH₁_sub_S₁ : H₁.U ⊆ (range (GluedSpace.inl hb_inj))) + (H' : Drawing (GluedSpace hb_inj)) + (hH'_U : H'.U = H₁.U ∪ ⋃ i, (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 + = w i}) i) + (W_pts : Set Circle) (hW : W_pts = range w) + (CollarInt : Set (GluedSpace hb_inj)) + (hCollar : CollarInt = GluedSpace.inr hb_inj '' + {q : ClosedCylinder | 1 < q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ W_pts}) : + Disjoint CollarInt H'.U := by + subst W_pts CollarInt + let W_pts := range w + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let L := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨q, ⟨hq1, hq2, hqW⟩, rfl⟩ hxU + rw [hH'_U] at hxU + rcases hxU with hx1 | hxL + · obtain ⟨y, hy_eq⟩ := hH₁_sub_S₁ hx1 + obtain ⟨hq_bd, _⟩ := (GluedSpace.inl_eq_inr hb_inj).mp hy_eq + rcases handleGlueMap_fst_eq_one_or_two ⟨q, hq_bd⟩ with hr1 | hr2 <;> linarith + · obtain ⟨i, ⟨p, hp, heq⟩⟩ := mem_iUnion.mp hxL + have hpq := GluedSpace.inr_injective hb_inj heq + subst hpq + exact hqW ⟨i, hp.symm⟩ + +private theorem upper_pinch_cuff_vertices_map_to_original_ends + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (b : Fin φ → S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (g_unp : S → (GluedSpace hb_inj)) + (H₁ : Drawing (GluedSpace hb_inj)) + (hH₁_sub_S₁ : H₁.U ⊆ (range (GluedSpace.inl hb_inj))) + (b' : Fin φ → (GluedSpace hb_inj)) + (hEnd : b' = fun i => g_unp (b i)) + (hb_K : ∀ (i : Fin φ), b i ∈ (univ \ (Λ₁ ∪ Λ₂))) + (hb'_V : ∀ (i : Fin φ), b' i ∈ H₁.V) + (H' : Drawing (GluedSpace hb_inj)) + (C_XII : Fin 2 → Set (GluedSpace hb_inj)) + (P₁_XII : Set (GluedSpace hb_inj)) + (ι_XII : ↑P₁_XII → S) + (hS₁_sub_P₁ : range (GluedSpace.inl hb_inj) ⊆ P₁_XII) + (hι_XII_g : ∀ y ∈ (univ \ (Λ₁ ∪ Λ₂)), ∀ (hy : g_unp y ∈ P₁_XII), ι_XII ⟨g_unp y, hy⟩ = y) + (hNorm_C1_and_V : H'.IsNormal (C_XII 1) ∧ H'.V ∩ C_XII 1 = range b') : + ι_XII '' Subtype.val ⁻¹' (H'.V ∩ C_XII 1) = range b := by + subst b' + let b' : Fin φ → GluedSpace hb_inj := fun i => g_unp (b i) + let K := univ \ (Λ₁ ∪ Λ₂) + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + rw [hNorm_C1_and_V.2] + ext y + constructor + · rintro ⟨⟨x, hxP₁⟩, ⟨i, rfl⟩, rfl⟩ + rw [hι_XII_g (b i) (hb_K i) hxP₁] + exact ⟨i, rfl⟩ + · rintro ⟨i, rfl⟩ + have hxP₁ : b' i ∈ P₁_XII := hS₁_sub_P₁ (hH₁_sub_S₁ (H₁.V_subset_U (hb'_V i))) + exact ⟨⟨b' i, hxP₁⟩, ⟨i, rfl⟩, hι_XII_g (b i) (hb_K i) hxP₁⟩ + +private theorem lower_pinch_cuff_vertices_map_to_original_ends + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (a : Fin φ → S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (g_unp : S → (GluedSpace hb_inj)) + (H₁ : Drawing (GluedSpace hb_inj)) + (hH₁_sub_S₁ : H₁.U ⊆ (range (GluedSpace.inl hb_inj))) + (a' : Fin φ → (GluedSpace hb_inj)) + (hEnd : a' = fun i => g_unp (a i)) + (ha_K : ∀ (i : Fin φ), a i ∈ (univ \ (Λ₁ ∪ Λ₂))) + (ha'_V : ∀ (i : Fin φ), a' i ∈ H₁.V) + (H' : Drawing (GluedSpace hb_inj)) + (C_XII : Fin 2 → Set (GluedSpace hb_inj)) + (P₁_XII : Set (GluedSpace hb_inj)) + (ι_XII : ↑P₁_XII → S) + (hS₁_sub_P₁ : range (GluedSpace.inl hb_inj) ⊆ P₁_XII) + (hι_XII_g : ∀ y ∈ (univ \ (Λ₁ ∪ Λ₂)), ∀ (hy : g_unp y ∈ P₁_XII), ι_XII ⟨g_unp y, hy⟩ = y) + (hNorm_C0_and_V : H'.IsNormal (C_XII 0) ∧ H'.V ∩ C_XII 0 = range a') : + ι_XII '' Subtype.val ⁻¹' (H'.V ∩ C_XII 0) = range a := by + subst a' + let a' : Fin φ → GluedSpace hb_inj := fun i => g_unp (a i) + let K := univ \ (Λ₁ ∪ Λ₂) + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + rw [hNorm_C0_and_V.2] + ext y + constructor + · rintro ⟨⟨x, hxP₁⟩, ⟨i, rfl⟩, rfl⟩ + rw [hι_XII_g (a i) (ha_K i) hxP₁] + exact ⟨i, rfl⟩ + · rintro ⟨i, rfl⟩ + have hxP₁ : a' i ∈ P₁_XII := hS₁_sub_P₁ (hH₁_sub_S₁ (H₁.V_subset_U (ha'_V i))) + exact ⟨⟨a' i, hxP₁⟩, ⟨i, rfl⟩, hι_XII_g (a i) (ha_K i) hxP₁⟩ + +private theorem upper_cylinder_end_equals_original_boundary_point + {S : Type w} + [TopologicalSpace S] + (H : Drawing S) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (hSubBd₂_sub_U : subBd Λ₂ ⊆ H.U) + (hHU : H.U ⊆ (univ \ (Λ₁ ∪ Λ₂))) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (g_unp : S → (GluedSpace hb_inj)) + (hg_unp_mem : ∀ (y : S) (hy : y ∈ (univ \ (Λ₁ ∪ Λ₂))), g_unp y = GluedSpace.inl hb_inj ⟨y, + hy⟩) + (m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2) : + ∀ (z : Circle), GluedSpace.inr hb_inj (cylEnd 2 m2 z) = g_unp ↑(g₂ z) := by + let b_glue := handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ + let K := univ \ (Λ₁ ∪ Λ₂) + let S' := GluedSpace hb_inj + intro z + have hbd2 : cylEnd 2 m2 z ∈ bd ↥ClosedCylinder := by + rw [bd_cylinder]; exact .inr ⟨z, rfl⟩ + have hzK : (g₂ z).1 ∈ K := hHU (hSubBd₂_sub_U (g₂ z).2) + have hb2 : b_glue ⟨cylEnd 2 m2 z, hbd2⟩ = ⟨(g₂ z).1, hzK⟩ := + Subtype.ext (handleGlueMap_cylEnd_two hΛ₁_open hΛ₂_open hd g₁ g₂ z) + rw [hg_unp_mem (g₂ z).1 hzK, ← hb2] + exact ((GluedSpace.inl_eq_inr hb_inj).mpr ⟨hbd2, rfl⟩).symm + +private theorem lower_cylinder_end_equals_original_boundary_point + {S : Type w} + [TopologicalSpace S] + (H : Drawing S) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (hSubBd₁_sub_U : subBd Λ₁ ⊆ H.U) + (hHU : H.U ⊆ (univ \ (Λ₁ ∪ Λ₂))) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (g_unp : S → (GluedSpace hb_inj)) + (hg_unp_mem : ∀ (y : S) (hy : y ∈ (univ \ (Λ₁ ∪ Λ₂))), g_unp y = GluedSpace.inl hb_inj ⟨y, + hy⟩) + (m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2) : + ∀ (z : Circle), GluedSpace.inr hb_inj (cylEnd 1 m1 z) = g_unp ↑(g₁ z) := by + let b_glue := handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ + let K := univ \ (Λ₁ ∪ Λ₂) + let S' := GluedSpace hb_inj + intro z + have hbd1 : cylEnd 1 m1 z ∈ bd ↥ClosedCylinder := by + rw [bd_cylinder]; exact .inl ⟨z, rfl⟩ + have hzK : (g₁ z).1 ∈ K := hHU (hSubBd₁_sub_U (g₁ z).2) + have hb1 : b_glue ⟨cylEnd 1 m1 z, hbd1⟩ = ⟨(g₁ z).1, hzK⟩ := + Subtype.ext (handleGlueMap_cylEnd_one hΛ₁_open hΛ₂_open hd g₁ g₂ z) + rw [hg_unp_mem (g₁ z).1 hzK, ← hb1] + exact ((GluedSpace.inl_eq_inr hb_inj).mpr ⟨hbd1, rfl⟩).symm + +private theorem handle_embedding_agrees_on_original_edges + {S : Type w} + [TopologicalSpace S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (hHU : H.U ⊆ (univ \ (Λ₁ ∪ Λ₂))) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (g_unp : S → (GluedSpace hb_inj)) + (f_unp : (GluedSpace hb_inj) → S) + (hfg_unp_inv : LeftInvOn f_unp g_unp (univ \ (Λ₁ ∪ Λ₂))) + (H₁ : Drawing (GluedSpace hb_inj)) + (η₁ : SpanEmbedding H₁ G) + (hE : H₁.E = (fun e => g_unp '' e) '' H.E) + (hMap : ∀ e, η₁.eMap e = η.eMap (f_unp '' e)) + (H' : Drawing (GluedSpace hb_inj)) + (η' : SpanEmbedding H' G) + (hem_H₁ : ∀ e ∈ H₁.E, η'.eMap e = η₁.eMap e) : + ∀ e ∈ H.E, η'.eMap (g_unp '' e) = η.eMap e := by + let K := univ \ (Λ₁ ∪ Λ₂) + let S' := GluedSpace hb_inj + intro e he + have he₁ : g_unp '' e ∈ H₁.E := by + rw [hE] + exact ⟨e, he, rfl⟩ + rw [hem_H₁ (g_unp '' e) he₁] + rw [hMap] + have he_sub : e ⊆ K := fun x hx => hHU (he.2.1 hx).1 + rw [hfg_unp_inv.image_image' he_sub] + +private theorem handle_line_meets_original_drawing_only_at_ends + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (H₁ : Drawing (GluedSpace hb_inj)) + (hH₁_sub_S₁ : H₁.U ⊆ (range (GluedSpace.inl hb_inj))) + (a' : Fin φ → (GluedSpace hb_inj)) + (b' : Fin φ → (GluedSpace hb_inj)) + (ha'_V : ∀ (i : Fin φ), a' i ∈ H₁.V) + (hb'_V : ∀ (i : Fin φ), b' i ∈ H₁.V) + (hL_S₁ : ∀ (i : Fin φ), (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 + = w i}) i ∩ (range + (GluedSpace.inl hb_inj)) = {a' i, b' i}) : + ∀ (i : Fin φ), (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i}) i ∩ H₁.U + = {a' i, b' i} := by + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let L := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + intro i + refine Subset.antisymm ?_ ?_ + · exact (inter_subset_inter_right _ hH₁_sub_S₁).trans (hL_S₁ i).subset + · rintro x (rfl | rfl) + · have hmem : a' i ∈ L i ∩ S₁ := by rw [hL_S₁ i]; exact Or.inl rfl + exact ⟨hmem.1, H₁.V_subset_U (ha'_V i)⟩ + · have hmem : b' i ∈ L i ∩ S₁ := by rw [hL_S₁ i]; exact Or.inr rfl + exact ⟨hmem.1, H₁.V_subset_U (hb'_V i)⟩ + +private theorem original_complement_embeds_onto_first_piece + {S : Type w} + [TopologicalSpace S] + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (g_unp : S → (GluedSpace hb_inj)) + (hg_unp_mem : ∀ (y : S) (hy : y ∈ (univ \ (Λ₁ ∪ Λ₂))), g_unp y = GluedSpace.inl hb_inj ⟨y, + hy⟩) : + g_unp '' (univ \ (Λ₁ ∪ Λ₂)) = (range (GluedSpace.inl hb_inj)) := by + let K := univ \ (Λ₁ ∪ Λ₂) + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + rw [hg_unp_mem y hy] + exact ⟨⟨y, hy⟩, rfl⟩ + · rintro ⟨⟨y, hy⟩, rfl⟩ + exact ⟨y, hy, hg_unp_mem y hy⟩ + +private theorem unpinched_map_continuous_on_first_piece + {S : Type w} + [TopologicalSpace S] + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (C_unp : Fin 2 → Set (GluedSpace hb_inj)) + (ι_unp : ↑(range (GluedSpace.inl hb_inj)) → S) + (hSplit_unp : GM12.IsCappedSplit C_unp (range (GluedSpace.inl hb_inj)) (range (GluedSpace.inr + hb_inj)) ι_unp ![Λ₁, Λ₂]) + (f_unp : (GluedSpace hb_inj) → S) + (hf : ∀ x (hx : x ∈ range (GluedSpace.inl hb_inj)), f_unp x = ι_unp ⟨x, hx⟩) : + ContinuousOn f_unp (range (GluedSpace.inl hb_inj)) := by + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + rw [continuousOn_iff_continuous_domRestrict] + have hEq : S₁.domRestrict f_unp = ι_unp := by + ext ⟨x, hx⟩ + change f_unp x = ι_unp ⟨x, hx⟩ + exact hf x hx + rw [hEq] + exact hSplit_unp.isEmbedding.continuous + +private theorem upper_pinched_marks_equal_path_ends + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2) + (b' : Fin φ → (GluedSpace hb_inj)) + (hb'_inr : ∀ (i : Fin φ), b' i = GluedSpace.inr hb_inj (cylEnd 2 m2 (w i))) + (W_pts : Set Circle) (hW : W_pts = range w) : + GluedSpace.inr hb_inj '' cylEnd 2 m2 '' W_pts = range b' := by + rw [hW] + let S' := GluedSpace hb_inj + ext x + constructor + · rintro ⟨_, ⟨_, ⟨i, rfl⟩, rfl⟩, rfl⟩ + exact ⟨i, hb'_inr i⟩ + · rintro ⟨i, rfl⟩ + rw [hb'_inr i] + exact ⟨cylEnd 2 m2 (w i), ⟨w i, ⟨i, rfl⟩, rfl⟩, rfl⟩ + +private theorem lower_pinched_marks_equal_path_ends + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2) + (a' : Fin φ → (GluedSpace hb_inj)) + (ha'_inr : ∀ (i : Fin φ), a' i = GluedSpace.inr hb_inj (cylEnd 1 m1 (w i))) + (W_pts : Set Circle) (hW : W_pts = range w) : + GluedSpace.inr hb_inj '' cylEnd 1 m1 '' W_pts = range a' := by + rw [hW] + let S' := GluedSpace hb_inj + ext x + constructor + · rintro ⟨_, ⟨_, ⟨i, rfl⟩, rfl⟩, rfl⟩ + exact ⟨i, ha'_inr i⟩ + · rintro ⟨i, rfl⟩ + rw [ha'_inr i] + exact ⟨cylEnd 1 m1 (w i), ⟨w i, ⟨i, rfl⟩, rfl⟩, rfl⟩ + +private theorem pinched_complement_retains_original_vertices + {S : Type w} + [TopologicalSpace S] + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (H₁ : Drawing (GluedSpace hb_inj)) + (hH₁_sub_S₁ : H₁.U ⊆ (range (GluedSpace.inl hb_inj))) + (H' : Drawing (GluedSpace hb_inj)) + (hSub_H₁ : H₁.IsSubdrawing H') + (hV_S₁ : H'.V ∩ (range (GluedSpace.inl hb_inj)) = H₁.V) + (W_pts : Set Circle) + (CollarInt : Set (GluedSpace hb_inj)) + (hCollar : CollarInt = GluedSpace.inr hb_inj '' + {q : ClosedCylinder | 1 < q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ W_pts}) + (P₁_XII : Set (GluedSpace hb_inj)) + (hS₁_sub_P₁ : range (GluedSpace.inl hb_inj) ⊆ P₁_XII) + (hP₁_diff_S₁ : P₁_XII \ range (GluedSpace.inl hb_inj) ⊆ GluedSpace.inr hb_inj '' {q | 1 < + q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ W_pts}) + (hCollar_disj : Disjoint CollarInt H'.U) : + H'.V ∩ P₁_XII = H₁.V := by + subst CollarInt + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + refine Subset.antisymm ?_ (subset_inter hSub_H₁.1 + ((H₁.V_subset_U.trans hH₁_sub_S₁).trans hS₁_sub_P₁)) + intro x ⟨hxV, hxP₁⟩ + by_cases hxS₁ : x ∈ S₁ + · exact hV_S₁ ▸ ⟨hxV, hxS₁⟩ + · exact (Set.disjoint_left.mp hCollar_disj + (hP₁_diff_S₁ ⟨hxP₁, hxS₁⟩) (H'.V_subset_U hxV)).elim + +private theorem upper_handle_parametrization_matches_path_ends + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₂ : Set S) + (b : Fin φ → S) + (t₁ : ℕ → ℝ) + (f₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (t₂ : ℕ → ℝ) + (ht₂_val : ∀ (i : ℕ) (h : i < (List.ofFn b).length), ↑(f₂ (Circle.exp (t₂ i))) = (List.ofFn + b)[i]) + (h_circ : Circle ≃ₜ Circle) + (hh_circ : ∀ i < φ, h_circ (Circle.exp (t₂ i)) = Circle.exp (t₁ i)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hg₂ : g₂ = h_circ.symm.trans f₂) + (w : Fin φ → Circle) (hw : ∀ i : Fin φ, w i = Circle.exp (t₁ i.1)) : + ∀ (i : Fin φ), ↑(g₂ (w i)) = b i := by + intro i + have h1 : h_circ.symm (w i) = Circle.exp (t₂ i.1) := + h_circ.symm_apply_eq.mpr ((hw i).trans (hh_circ i.1 i.2).symm) + rw [hg₂] + change (f₂ (h_circ.symm (w i))).1 = b i + rw [h1] + simpa using ht₂_val i.1 (by simp) + +private theorem pinched_complement_retains_original_drawing + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (H₁ : Drawing (GluedSpace hb_inj)) + (hH₁_sub_S₁ : H₁.U ⊆ (range (GluedSpace.inl hb_inj))) + (H' : Drawing (GluedSpace hb_inj)) + (hH'_U : H'.U = H₁.U ∪ ⋃ i, (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 + = w i}) i) + (hU_S₁ : H'.U ∩ (range (GluedSpace.inl hb_inj)) = H₁.U) + (W_pts : Set Circle) + (CollarInt : Set (GluedSpace hb_inj)) + (hCollar : CollarInt = GluedSpace.inr hb_inj '' + {q : ClosedCylinder | 1 < q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ W_pts}) + (P₁_XII : Set (GluedSpace hb_inj)) + (hS₁_sub_P₁ : range (GluedSpace.inl hb_inj) ⊆ P₁_XII) + (hP₁_diff_S₁ : P₁_XII \ range (GluedSpace.inl hb_inj) ⊆ GluedSpace.inr hb_inj '' {q | 1 < + q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ W_pts}) + (hCollar_disj : Disjoint CollarInt H'.U) : + H'.U ∩ P₁_XII = H₁.U := by + subst CollarInt + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let L := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + refine Subset.antisymm ?_ (subset_inter (by rw [hH'_U]; exact subset_union_left) + (hH₁_sub_S₁.trans hS₁_sub_P₁)) + intro x ⟨hxU, hxP₁⟩ + by_cases hxS₁ : x ∈ S₁ + · exact hU_S₁ ▸ ⟨hxU, hxS₁⟩ + · exact (Set.disjoint_left.mp hCollar_disj (hP₁_diff_S₁ ⟨hxP₁, hxS₁⟩) hxU).elim + +private theorem drawing_contains_region_boundary_of_boundary_subdrawing + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (H : Drawing S) : + ∀ {Λ : Set S}, (H.interSet (subBd Λ)).U = subBd Λ → subBd Λ ⊆ H.U := by + intro Λ hU_eq + have hcl : IsClosed (subBd Λ) := isClosed_closure.inter isClosed_closure + rw [← hU_eq, (H.interSet (subBd Λ)).U_eq, + interSet_V_of_isClosed H hcl, interSet_E] + exact union_subset (inter_subset_left.trans H.V_subset_U) + (iUnion₂_subset fun e he => H.closure_subset_U he.1) + +private theorem original_paths_lift_to_glued_drawing + {S : Type w} + [TopologicalSpace S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (P : Fin φ → Graph α β) + (a : Fin φ → S) + (b : Fin φ → S) + (hP_paths : ∀ (i : Fin φ), IsHPathWithEnds G η.imageGraph (P i) (η.vMap (a i)) (η.vMap (b i))) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (H₁ : Drawing (GluedSpace hb_inj)) + (η₁ : SpanEmbedding H₁ G) + (a' : Fin φ → (GluedSpace hb_inj)) + (b' : Fin φ → (GluedSpace hb_inj)) + (hG : η₁.imageGraph = η.imageGraph) + (hA : ∀ i, η₁.vMap (a' i) = η.vMap (a i)) + (hB : ∀ i, η₁.vMap (b' i) = η.vMap (b i)) : + ∀ (i : Fin φ), IsHPathWithEnds G η₁.imageGraph (P i) (η₁.vMap (a' i)) (η₁.vMap (b' i)) := by + let K := univ \ (Λ₁ ∪ Λ₂) + let S' := GluedSpace hb_inj + intro i + rw [hG, hA i, hB i] + exact hP_paths i + +private theorem distinct_handle_lines_are_disjoint + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hw_inj : Injective w) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) : + Pairwise fun i j => Disjoint ((fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 + = w i}) i) ((fun + i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i}) j) := by + let S' := GluedSpace hb_inj + let L := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + intro i j hij + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨p, hp, rfl⟩ ⟨q, hq, heq⟩ + have hpq := GluedSpace.inr_injective hb_inj heq + subst hpq + exact hij (hw_inj (hp.symm.trans hq)) + +private theorem cylinder_drawing_is_in_cuffs_or_handle_lines + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (H₁ : Drawing (GluedSpace hb_inj)) + (hH₁_sub_S₁ : H₁.U ⊆ (range (GluedSpace.inl hb_inj))) + (H' : Drawing (GluedSpace hb_inj)) + (hH'_U : H'.U = H₁.U ∪ ⋃ i, (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 + = w i}) i) : + (range (GluedSpace.inr hb_inj)) ∩ H'.U ⊆ (range (GluedSpace.inl hb_inj)) ∩ (range + (GluedSpace.inr hb_inj)) ∪ ⋃ i, (fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | + p.1.2 = w i}) i := by + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let S₂ := range (GluedSpace.inr hb_inj) + let L := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + rintro x ⟨hx2, hxU⟩ + rw [hH'_U] at hxU + rcases hxU with hx1 | hxL + · exact .inl ⟨hH₁_sub_S₁ hx1, hx2⟩ + · exact .inr hxL + +private theorem handle_fibers_are_lines + {S : Type w} + [TopologicalSpace S] + (φ : ℕ) + (Λ₁ : Set S) + (Λ₂ : Set S) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + (hinr_emb : IsClosedEmbedding (GluedSpace.inr hb_inj)) + (m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2) + (m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2) + (a' : Fin φ → (GluedSpace hb_inj)) + (b' : Fin φ → (GluedSpace hb_inj)) + (ha'_inr : ∀ (i : Fin φ), a' i = GluedSpace.inr hb_inj (cylEnd 1 m1 (w i))) + (hb'_inr : ∀ (i : Fin φ), b' i = GluedSpace.inr hb_inj (cylEnd 2 m2 (w i))) : + ∀ (i : Fin φ), IsLineWithEnds ((fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 + = w i}) i) (a' + i) (b' i) := by + let S' := GluedSpace hb_inj + let L := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + intro i + rw [ha'_inr i, hb'_inr i] + obtain ⟨f, h0, h1⟩ := isLineWithEnds_cylRadial (w i) + exact ⟨f.trans (hinr_emb.isEmbedding.homeomorphImage {p : ClosedCylinder | p.1.2 = w i}), + congrArg (GluedSpace.inr hb_inj) h0, congrArg (GluedSpace.inr hb_inj) h1⟩ + +private theorem assemble_rigid_span_on_added_handle + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (θ_star : ℕ) + (θ : ℕ) + (φ : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (Λ₁ : Set S) + (Λ₂ : Set S) + (P : Fin φ → Graph α β) + (a : Fin φ → S) + (b : Fin φ → S) + (hSpan : IsSigmaSpan G H η θ_star θ T_star T) + (hΛ₁ : Λ₁ ∈ H.R) + (hΛ₂ : Λ₂ ∈ H.R) + (hOArc₁ : IsOArc (subBd Λ₁)) + (hOArc₂ : IsOArc (subBd Λ₂)) + (hNo_common_region : ∀ r ∈ H.R, (closure r ∩ (H.V ∩ subBd Λ₁)).Nonempty → Disjoint (closure r) + (H.V ∩ subBd Λ₂)) + (h_lines : ∀ (F : Set S), IsLine F → H.IsNormal F → F ⊆ univ \ (Λ₁ ∪ Λ₂) → (F ∩ subBd + Λ₁).Nonempty → (F ∩ subBd Λ₂).Nonempty → φ ≤ (F ∩ H.V).ncard) + (hφ : 3 ≤ φ) + (hφ_le : φ ≤ θ) + (hab_mem : ∀ (i : Fin φ), a i ∈ H.V ∩ subBd Λ₁ ∧ b i ∈ H.V ∩ subBd Λ₂) + (hP_disj : Pairwise fun i j => Disjoint V(P i) V(P j)) + (hFree_a : IsFreeSet H.toHypergraph T θ (range a)) + (hFree_b : IsFreeSet H.toHypergraph T θ (range b)) + (hS : IsClosedSurface S) + [ConnectedSpace S] + (hRigid_H : IsRigid H) + (hResp_H : IsRespectfulDrawingTangle H θ T) + (hT : IsTangle H.toHypergraph θ T) + (hθ : 3 ≤ θ) + (hΛ₁_open : IsOpen Λ₁) + (hΛ₂_open : IsOpen Λ₂) + (hΛ₁_disc : IsOpenDisc Λ₁) + (hΛ₂_disc : IsOpenDisc Λ₂) + (hout₁ : ∀ x ∈ closure Λ₁ \ Λ₁, x ∈ closure (closure Λ₁)ᶜ) + (hCD₁ : IsClosedDisc (closure Λ₁)) + (hdiscBd₁ : discBd (closure Λ₁) = subBd Λ₁) + (hout₂ : ∀ x ∈ closure Λ₂ \ Λ₂, x ∈ closure (closure Λ₂)ᶜ) + (hCD₂ : IsClosedDisc (closure Λ₂)) + (hdiscBd₂ : discBd (closure Λ₂) = subBd Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (hSubBd₁_sub_U : subBd Λ₁ ⊆ H.U) + (hSubBd₂_sub_U : subBd Λ₂ ⊆ H.U) + (hK_cl : IsClosed (univ \ (Λ₁ ∪ Λ₂))) + (hK_comp : IsCompact (univ \ (Λ₁ ∪ Λ₂))) + (hHU : H.U ⊆ (univ \ (Λ₁ ∪ Λ₂))) + (g₁ : Circle ≃ₜ ↑(subBd Λ₁)) + (g₂ : Circle ≃ₜ ↑(subBd Λ₂)) + (w : Fin φ → Circle) + (ha_inj : Injective a) + (hb_inj_fn : Injective b) + (hw_inj : Injective w) + (hb_inj : Injective (handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂)) + [this : T2Space (GluedSpace hb_inj)] + (hS' : IsClosedSurface (GluedSpace hb_inj)) + [hConn' : ConnectedSpace (GluedSpace hb_inj)] + (hHandle : IsObtainedByAddingHandle S (GluedSpace hb_inj)) + (hS₁_cl : IsClosed (range (GluedSpace.inl hb_inj))) + (hS₂_cl : IsClosed (range (GluedSpace.inr hb_inj))) + (C_unp : Fin 2 → Set (GluedSpace hb_inj)) + (ι_unp : ↑(range (GluedSpace.inl hb_inj)) → S) + (hSplit_unp : GM12.IsCappedSplit C_unp (range (GluedSpace.inl hb_inj)) (range (GluedSpace.inr + hb_inj)) ι_unp ![Λ₁, Λ₂]) + (hC_unp_0 : C_unp 0 = GluedSpace.inr hb_inj '' range (cylEnd 1 (by norm_num : (1 : ℝ) ∈ Icc 1 + 2))) + (hC_unp_1 : C_unp 1 = GluedSpace.inr hb_inj '' range (cylEnd 2 (by norm_num : (2 : ℝ) ∈ Icc 1 + 2))) + (hι_unp_inl : ∀ (y : ↑(univ \ (Λ₁ ∪ Λ₂))), ι_unp ⟨GluedSpace.inl hb_inj y, ⟨y, rfl⟩⟩ = ↑y) + (hS12_inter : (range (GluedSpace.inl hb_inj)) ∩ (range (GluedSpace.inr hb_inj)) = C_unp 0 ∪ + C_unp 1) + (g_unp : S → (GluedSpace hb_inj)) + (f_unp : (GluedSpace hb_inj) → S) + (hg_unp_mem : ∀ (y : S) (hy : y ∈ (univ \ (Λ₁ ∪ Λ₂))), g_unp y = GluedSpace.inl hb_inj ⟨y, + hy⟩) + (hf_unp_inl : ∀ (y : ↑(univ \ (Λ₁ ∪ Λ₂))), f_unp (GluedSpace.inl hb_inj y) = ↑y) + (hg_unp_cont : ContinuousOn g_unp (univ \ (Λ₁ ∪ Λ₂))) + (hf_unp_cont : ContinuousOn f_unp (range (GluedSpace.inl hb_inj))) + (hfg_unp_inv : LeftInvOn f_unp g_unp (univ \ (Λ₁ ∪ Λ₂))) + (hgf_unp_inv : LeftInvOn g_unp f_unp (range (GluedSpace.inl hb_inj))) + (hf_unp_cont' : ContinuousOn f_unp (g_unp '' (univ \ (Λ₁ ∪ Λ₂)))) + (hH₁_U : (liftDrawingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU).U = g_unp '' H.U) + (hH₁_V : (liftDrawingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU).V = g_unp '' H.V) + (hH₁_sub_S₁ : (liftDrawingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU).U ⊆ (range + (GluedSpace.inl hb_inj))) + (m1 : (1 : ℝ) ∈ Icc 1 2) + (m2 : (2 : ℝ) ∈ Icc 1 2) + (ha_K : ∀ (i : Fin φ), a i ∈ (univ \ (Λ₁ ∪ Λ₂))) + (hb_K : ∀ (i : Fin φ), b i ∈ (univ \ (Λ₁ ∪ Λ₂))) + (ha'_V : ∀ i : Fin φ, g_unp (a i) ∈ (liftDrawingOn hK_comp hg_unp_cont + hf_unp_cont' hfg_unp_inv H hHU).V) + (hb'_V : ∀ i : Fin φ, g_unp (b i) ∈ (liftDrawingOn hK_comp hg_unp_cont + hf_unp_cont' hfg_unp_inv H hHU).V) + (ha'_inr : ∀ i : Fin φ, g_unp (a i) = GluedSpace.inr hb_inj (cylEnd 1 m1 (w i))) + (hb'_inr : ∀ i : Fin φ, g_unp (b i) = GluedSpace.inr hb_inj (cylEnd 2 m2 (w i))) + (hL_line : ∀ i : Fin φ, IsLineWithEnds + (GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i}) (g_unp (a i)) (g_unp (b i))) + (hL_disj : Pairwise fun i j => Disjoint + (GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i}) + (GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w j})) + (hL_S₁ : ∀ i : Fin φ, (GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i}) ∩ + range (GluedSpace.inl hb_inj) = {g_unp (a i), g_unp (b i)}) + (hL_H₁U : ∀ i : Fin φ, (GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i}) ∩ + (liftDrawingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU).U = + {g_unp (a i), g_unp (b i)}) + (hP_paths' : ∀ i : Fin φ, IsHPathWithEnds G (liftSpanEmbeddingOn hK_comp hg_unp_cont + hf_unp_cont' hfg_unp_inv hHU η).imageGraph (P i) + ((liftSpanEmbeddingOn hK_comp hg_unp_cont + hf_unp_cont' hfg_unp_inv hHU η).vMap (g_unp (a i))) + ((liftSpanEmbeddingOn hK_comp hg_unp_cont + hf_unp_cont' hfg_unp_inv hHU η).vMap (g_unp (b i)))) : + ∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S'), + IsObtainedByAddingHandle S S' ∧ + ∃ (H' : Drawing S') (η' : SpanEmbedding H' G) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsSigmaSpan G H' η' θ_star φ T_star T' := by + let K := univ \ (Λ₁ ∪ Λ₂) + let S' := GluedSpace hb_inj + let S₁ := range (GluedSpace.inl hb_inj) + let S₂ := range (GluedSpace.inr hb_inj) + let H₁ := liftDrawingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU + let η₁ := liftSpanEmbeddingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv hHU η + let a' := fun i => g_unp (a i) + let b' := fun i => g_unp (b i) + let L := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + obtain ⟨H_path, H', η', hH'_U, hH'_V, hH'_E, hSub_H₁, hH_path, hH_path_disj, + _, hvm_H₁, hem_H₁, _, _⟩ := + exists_glued_span_of_lines H₁ η₁ a' b' P L ha'_V hb'_V hP_paths' hP_disj + hL_line hL_disj hL_H₁U + obtain ⟨hU_S₁, hV_S₁, _⟩ := + glued_interSet_base_eq hS₁_cl ha'_V hb'_V hH₁_sub_S₁ hL_S₁ hH'_U hH'_V hH'_E hH_path + have hι_unp_g : ∀ y ∈ K, ∀ hy : g_unp y ∈ S₁, ι_unp ⟨g_unp y, hy⟩ = y := by + intro y hy hgy + have hsub : (⟨g_unp y, hgy⟩ : ↥S₁) = ⟨GluedSpace.inl hb_inj ⟨y, hy⟩, ⟨⟨y, hy⟩, rfl⟩⟩ := + Subtype.ext (hg_unp_mem y hy) + rw [hsub, hι_unp_inl ⟨y, hy⟩] + have hCap_unp : GM12.IsCappedDrawing ι_unp H' H := + isCappedDrawing_of_glued hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv hHU hU_S₁ hV_S₁ hι_unp_g + -- Verify `IsRigid H'` using `theorem_3_2_proof` on the unpinched split. + have hinr_cylEnd_one : ∀ z : Circle, + GluedSpace.inr hb_inj (cylEnd 1 m1 z) = g_unp (g₁ z).1 := by + exact lower_cylinder_end_equals_original_boundary_point (S := S) H Λ₁ Λ₂ hΛ₁_open hΛ₂_open hd + hSubBd₁_sub_U hHU g₁ g₂ hb_inj g_unp hg_unp_mem m1 + have hinr_cylEnd_two : ∀ z : Circle, + GluedSpace.inr hb_inj (cylEnd 2 m2 z) = g_unp (g₂ z).1 := by + exact upper_cylinder_end_equals_original_boundary_point (S := S) H Λ₁ Λ₂ hΛ₁_open hΛ₂_open hd + hSubBd₂_sub_U hHU g₁ g₂ hb_inj g_unp hg_unp_mem m2 + have hC_unp_0_sub_H₁ : C_unp 0 ⊆ H₁.U := by + rw [hC_unp_0] + rintro _ ⟨_, ⟨z, rfl⟩, rfl⟩ + rw [hinr_cylEnd_one z, hH₁_U] + exact mem_image_of_mem g_unp (hSubBd₁_sub_U (g₁ z).2) + have hC_unp_1_sub_H₁ : C_unp 1 ⊆ H₁.U := by + rw [hC_unp_1] + rintro _ ⟨_, ⟨z, rfl⟩, rfl⟩ + rw [hinr_cylEnd_two z, hH₁_U] + exact mem_image_of_mem g_unp (hSubBd₂_sub_U (g₂ z).2) + have hS12_sub_U : S₁ ∩ S₂ ⊆ H'.U := by + rw [hS12_inter, hH'_U] + exact (union_subset hC_unp_0_sub_H₁ hC_unp_1_sub_H₁).trans subset_union_left + let X_unp : Set S' := range a' ∪ range b' + have ha'_C0 : ∀ i, a' i ∈ C_unp 0 := by + intro i + change g_unp (a i) ∈ C_unp 0 + rw [ha'_inr i, hC_unp_0] + exact ⟨cylEnd 1 m1 (w i), ⟨w i, rfl⟩, rfl⟩ + have hb'_C1 : ∀ i, b' i ∈ C_unp 1 := by + intro i + change g_unp (b i) ∈ C_unp 1 + rw [hb'_inr i, hC_unp_1] + exact ⟨cylEnd 2 m2 (w i), ⟨w i, rfl⟩, rfl⟩ + have hX_unp_sub : X_unp ⊆ H'.V ∩ (S₁ ∩ S₂) := by + rintro x (⟨i, rfl⟩ | ⟨i, rfl⟩) + · exact ⟨hSub_H₁.1 (ha'_V i), hS12_inter.symm ▸ Or.inl (ha'_C0 i)⟩ + · exact ⟨hSub_H₁.1 (hb'_V i), hS12_inter.symm ▸ Or.inr (hb'_C1 i)⟩ + have hι_unp_X : ι_unp '' ((↑) ⁻¹' X_unp) = range a ∪ range b := by + exact unpinched_embedding_maps_marked_nodes (S := S) φ Λ₁ Λ₂ a b hΛ₁_open hΛ₂_open hd g₁ g₂ + hb_inj ι_unp g_unp a' rfl b' rfl ha_K hb_K H' hι_unp_g hX_unp_sub + have hS₂_U : S₂ ∩ H'.U ⊆ (S₁ ∩ S₂) ∪ ⋃ i : Fin φ, L i := by + exact cylinder_drawing_is_in_cuffs_or_handle_lines (S := S) φ Λ₁ Λ₂ hΛ₁_open hΛ₂_open hd g₁ g₂ + w hb_inj H₁ hH₁_sub_S₁ H' hH'_U + have hRigid_H' : IsRigid H' := by + refine theorem_3_2_proof C_unp S₁ S₂ ι_unp ![Λ₁, Λ₂] H' H X_unp + hSplit_unp hCap_unp hS12_sub_U hX_unp_sub ?_ ?_ ?_ ?_ + -- Condition (i): no region `r ⊆ S₁` of `H'` meets both `C_unp 0` and `C_unp 1`. + · exact original_region_cannot_meet_both_handle_cuffs (S := S) H φ Λ₁ Λ₂ hΛ₁ hΛ₂ hOArc₁ hOArc₂ + hNo_common_region hS hΛ₁_open hΛ₂_open hd hSubBd₁_sub_U hSubBd₂_sub_U hHU g₁ g₂ w hb_inj + hS₁_cl C_unp hC_unp_0 hC_unp_1 g_unp f_unp hf_unp_cont hfg_unp_inv hgf_unp_inv H₁ hH₁_U m1 + m2 H' hH'_U hinr_cylEnd_one hinr_cylEnd_two + -- Condition (ii): dials in `S` via `theorem_3_5_claim_1`. + · exact original_surface_dial (S := S) H θ φ T Λ₁ Λ₂ a b hΛ₁ hΛ₂ hOArc₁ hOArc₂ + hNo_common_region hφ hab_mem hFree_a hFree_b hS hRigid_H hT hθ hΛ₁_open hΛ₂_open hd g₁ g₂ + ha_inj hb_inj_fn hb_inj ι_unp a' b' hι_unp_X + -- Condition (iii): dials in the cylinder. + · exact cylinder_dial_of_normal_closed_curve (S := S) φ Λ₁ Λ₂ hφ hS hΛ₁_open hΛ₂_open hd g₁ g₂ + w hw_inj hb_inj hS' H₁ m1 m2 a' b' ha'_inr hb'_inr hL_line hL_disj H_path H' hH'_U hH_path + hS₂_U + -- Condition (iv): open discs cut out by normal chords in the cylinder. + · exact cylinder_disc_of_normal_chord (S := S) φ Λ₁ Λ₂ hφ hS hΛ₁_open hΛ₂_open hd g₁ g₂ w + hw_inj hb_inj hS' hS₁_cl hS₂_cl C_unp ι_unp hSplit_unp hS12_inter H₁ m1 m2 a' b' ha'_V + hb'_V ha'_inr hb'_inr hL_line hL_disj hL_S₁ H_path H' hH'_U hSub_H₁ hH_path ha'_C0 hb'_C1 + hS₂_U + have h2Cell_H' : (PaintingOrDrawing.drawing H').IsTwoCell := + isTwoCell_of_isRigid hS' hRigid_H' + ⟨a' ⟨0, by omega⟩, H'.V_subset_U (hSub_H₁.1 (ha'_V ⟨0, by omega⟩))⟩ + -- Pinched handle split and `GM12Theorem51Statement`. + let W_pts : Set Circle := range w + have hW_cl : IsClosed W_pts := (Set.finite_range w).isClosed + have hW_ne : W_pts.Nonempty := ⟨w ⟨0, by omega⟩, ⟨0, by omega⟩, rfl⟩ + let CollarInt : Set S' := + GluedSpace.inr hb_inj '' {q : ClosedCylinder | 1 < q.1.1 ∧ q.1.1 < 2 ∧ q.1.2 ∉ W_pts} + obtain ⟨C_XII, P₁_XII, P₂_XII, ι_XII, D_XII, f_XII, hSplit_XII, hS₁_sub_P₁, + hf_XII_inl, hι_XII_eq, hι_XII_emb, hD0_sub, hD1_sub, hcl_D0_sub, hcl_D1_sub, + hP₁_diff_S₁, hW1_sub_C0, hC0_diff_W1, hW2_sub_C1, hC1_diff_W2, hW_sub_P₂, + hf_XII_C0, hf_XII_C1, hf_XII_P₁, hf_XII_mem_S₁⟩ := + exists_pinched_handleSplit hS hΛ₁_open hΛ₂_open hΛ₁_disc hΛ₂_disc hCD₁ hCD₂ + hdiscBd₁ hdiscBd₂ hd hOArc₁ hOArc₂ hout₁ hout₂ g₁ g₂ hb_inj hW_cl hW_ne + have hCollar_disj : Disjoint CollarInt H'.U := by + exact unmarked_handle_collars_avoid_drawing (S := S) φ Λ₁ Λ₂ hΛ₁_open hΛ₂_open hd g₁ g₂ w + hb_inj H₁ hH₁_sub_S₁ H' hH'_U W_pts rfl CollarInt rfl + have hU_P₁_XII : H'.U ∩ P₁_XII = H₁.U := by + exact pinched_complement_retains_original_drawing (S := S) φ Λ₁ Λ₂ hΛ₁_open hΛ₂_open hd g₁ g₂ + w hb_inj H₁ hH₁_sub_S₁ H' hH'_U hU_S₁ W_pts CollarInt rfl P₁_XII hS₁_sub_P₁ hP₁_diff_S₁ + hCollar_disj + have hV_P₁_XII : H'.V ∩ P₁_XII = H₁.V := by + exact pinched_complement_retains_original_vertices (S := S) Λ₁ Λ₂ hΛ₁_open hΛ₂_open hd g₁ g₂ + hb_inj H₁ hH₁_sub_S₁ H' hSub_H₁ hV_S₁ W_pts CollarInt rfl P₁_XII hS₁_sub_P₁ hP₁_diff_S₁ + hCollar_disj + have hι_XII_g : ∀ y ∈ K, ∀ hy : g_unp y ∈ P₁_XII, ι_XII ⟨g_unp y, hy⟩ = y := by + intro y hy hgy + rw [hι_XII_eq ⟨g_unp y, hgy⟩] + change f_XII (g_unp y) = y + rw [hg_unp_mem y hy, hf_XII_inl ⟨y, hy⟩] + have hCap_XII : GM12.IsCappedDrawing ι_XII H' H := + isCappedDrawing_of_glued hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv hHU + hU_P₁_XII hV_P₁_XII hι_XII_g + have hW1_eq_a' : GluedSpace.inr hb_inj '' (cylEnd 1 m1 '' W_pts) = range a' := by + exact lower_pinched_marks_equal_path_ends (S := S) φ Λ₁ Λ₂ hΛ₁_open hΛ₂_open hd g₁ g₂ w hb_inj + m1 a' ha'_inr W_pts rfl + have hW2_eq_b' : GluedSpace.inr hb_inj '' (cylEnd 2 m2 '' W_pts) = range b' := by + exact upper_pinched_marks_equal_path_ends (S := S) φ Λ₁ Λ₂ hΛ₁_open hΛ₂_open hd g₁ g₂ w hb_inj + m2 b' hb'_inr W_pts rfl + have hNorm_C0_and_V : H'.IsNormal (C_XII 0) ∧ H'.V ∩ C_XII 0 = range a' := by + exact lower_pinched_cuff_is_normal (S := S) φ Λ₁ Λ₂ hΛ₁_open hΛ₂_open hd g₁ g₂ w hb_inj H₁ m1 + a' ha'_V H_path H' hH'_U hH'_V W_pts CollarInt rfl C_XII hW1_sub_C0 hC0_diff_W1 hCollar_disj + hW1_eq_a' + have hNorm_C1_and_V : H'.IsNormal (C_XII 1) ∧ H'.V ∩ C_XII 1 = range b' := by + exact upper_pinched_cuff_is_normal (S := S) φ Λ₁ Λ₂ hΛ₁_open hΛ₂_open hd g₁ g₂ w hb_inj H₁ m2 + b' hb'_V H_path H' hH'_U hH'_V W_pts CollarInt rfl C_XII hW2_sub_C1 hC1_diff_W2 hCollar_disj + hW2_eq_b' + have ha'_inj : Function.Injective a' := + fun i j hij => ha_inj (hfg_unp_inv.injOn (ha_K i) (ha_K j) hij) + have hb'_inj : Function.Injective b' := + fun i j hij => hb_inj_fn (hfg_unp_inv.injOn (hb_K i) (hb_K j) hij) + have hCard_C0 : (H'.V ∩ C_XII 0).ncard = φ := by + rw [hNorm_C0_and_V.2, Set.ncard_range_of_injective ha'_inj, Nat.card_fin] + have hCard_C1 : (H'.V ∩ C_XII 1).ncard = φ := by + rw [hNorm_C1_and_V.2, Set.ncard_range_of_injective hb'_inj, Nat.card_fin] + have hP₂_XII_cl : IsClosed P₂_XII := + (isCompact_iff_compactSpace.mpr hSplit_XII.1.manifold₂.1).isClosed + have hH₁_P₂_XII : H₁.U ∩ P₂_XII ⊆ ⋃ i : Fin φ, ({a' i, b' i} : Set S') := by + exact original_drawing_meets_pinched_handle_at_marked_ends (S := S) φ Λ₁ Λ₂ hΛ₁_open hΛ₂_open + hd g₁ g₂ w hb_inj H₁ hH₁_sub_S₁ a' b' H' hH'_U C_XII P₁_XII P₂_XII ι_XII D_XII hSplit_XII + hS₁_sub_P₁ hNorm_C0_and_V hNorm_C1_and_V + obtain ⟨hH_path_sub_P₂, hInter_P₂_U⟩ := + glued_interSet_paths_eq hP₂_XII_cl (fun i => hW_sub_P₂ (w i) ⟨i, rfl⟩) + hH₁_P₂_XII hH'_V hH'_E hH_path + -- Line condition for `GM12Theorem51Statement`. + have hLines_XII : ∀ F : Set S', IsLine F → H'.IsNormal F → F ⊆ P₁_XII → + (F ∩ C_XII 0).Nonempty → (F ∩ C_XII 1).Nonempty → φ ≤ (F ∩ H'.V).ncard := by + exact normal_line_between_pinched_cuffs_meets_many_vertices (S := S) H φ Λ₁ Λ₂ h_lines + hΛ₁_open hΛ₂_open hd hK_cl hHU g₁ g₂ w hb_inj g_unp f_unp hg_unp_mem hf_unp_inl hfg_unp_inv + H₁ hH₁_U hH₁_V H' hH'_U hSub_H₁ C_XII P₁_XII P₂_XII ι_XII D_XII f_XII hSplit_XII hf_XII_inl + hι_XII_eq hι_XII_emb hcl_D0_sub hcl_D1_sub hf_XII_C0 hf_XII_C1 hf_XII_P₁ hf_XII_mem_S₁ + hV_P₁_XII + -- Truncated tangle `T₁` and induced tangle `T'`. + let T₁ := GM10.truncation T φ + have hResp_T₁ : IsRespectfulDrawingTangle H φ T₁ := + isRespectfulDrawingTangle_truncation hResp_H (by omega) hφ_le + have hCtrl_T₁ : IsControllingTangle G H η θ_star φ T_star T₁ := + isControllingTangle_truncation hSpan.isControlling (by omega) hφ_le + have hι_XII_C0 : ι_XII '' ((↑) ⁻¹' (H'.V ∩ C_XII 0)) = range a := by + exact lower_pinch_cuff_vertices_map_to_original_ends (S := S) φ Λ₁ Λ₂ a hΛ₁_open hΛ₂_open hd + g₁ g₂ hb_inj g_unp H₁ hH₁_sub_S₁ a' rfl ha_K ha'_V H' C_XII P₁_XII ι_XII hS₁_sub_P₁ hι_XII_g + hNorm_C0_and_V + have hι_XII_C1 : ι_XII '' ((↑) ⁻¹' (H'.V ∩ C_XII 1)) = range b := by + exact upper_pinch_cuff_vertices_map_to_original_ends (S := S) φ Λ₁ Λ₂ b hΛ₁_open hΛ₂_open hd + g₁ g₂ hb_inj g_unp H₁ hH₁_sub_S₁ b' rfl hb_K hb'_V H' C_XII P₁_XII ι_XII hS₁_sub_P₁ hι_XII_g + hNorm_C1_and_V + have hFree_T₁_a : IsFreeSet H.toHypergraph T₁ φ (ι_XII '' ((↑) ⁻¹' (H'.V ∩ C_XII 0))) := + hι_XII_C0.symm ▸ theorem_3_3_claim_2 hT hFree_a Subset.rfl + (by rw [Set.ncard_range_of_injective ha_inj, Nat.card_fin]) + have hFree_T₁_b : IsFreeSet H.toHypergraph T₁ φ (ι_XII '' ((↑) ⁻¹' (H'.V ∩ C_XII 1))) := + hι_XII_C1.symm ▸ theorem_3_3_claim_2 hT hFree_b Subset.rfl + (by rw [Set.ncard_range_of_injective hb_inj_fn, Nat.card_fin]) + have hResp_T' : (PaintingOrDrawing.drawing H').IsRespectful φ + (GM12.inducedAcross ι_XII H' H φ T₁) := + GraphMinor.GM12.theorem_5_1_proof.{w} C_XII P₁_XII P₂_XII ι_XII D_XII H' H φ T₁ H_path a' b' + hS' hConn' hSplit_XII hCap_XII hNorm_C0_and_V.1 hNorm_C1_and_V.1 hCard_C0 hCard_C1 + (fun i => ⟨hNorm_C0_and_V.2.symm ▸ ⟨i, rfl⟩, hNorm_C1_and_V.2.symm ▸ ⟨i, rfl⟩, + (hH_path i).2.1, hH_path_sub_P₂ i⟩) + hH_path_disj hInter_P₂_U hLines_XII hResp_T₁.2.1 hResp_T₁.2.2 hFree_T₁_a hFree_T₁_b + have hη'_v : ∀ v ∈ H.V, η'.vMap (g_unp v) = η.vMap v := by + intro v hv + rw [hvm_H₁ (g_unp v) (by rw [hH₁_V]; exact ⟨v, hv, rfl⟩)] + change η.vMap (f_unp (g_unp v)) = η.vMap v + rw [hfg_unp_inv (hHU (H.V_subset_U hv))] + have hη'_e : ∀ e ∈ H.E, η'.eMap (g_unp '' e) = η.eMap e := by + exact handle_embedding_agrees_on_original_edges (S := S) (α := α) (β := β) G H η Λ₁ Λ₂ + hΛ₁_open hΛ₂_open hd hHU g₁ g₂ hb_inj g_unp f_unp hfg_unp_inv H₁ η₁ + (liftDrawingOn_E hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU) + (fun _ => rfl) H' η' hem_H₁ + obtain ⟨hT', hCtrl_T'⟩ := + isTangle_and_isControlling_inducedAcross hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv + hHU η η' hSub_H₁ hU_P₁_XII hV_P₁_XII hι_XII_g hη'_v hη'_e hCtrl_T₁ + exact ⟨S', inferInstance, inferInstance, hHandle, H', η', GM12.inducedAcross ι_XII H' H φ T₁, + { isSurface := IsClosedSurface.isSurface hS' + isConnected := hConn' + bd_empty := eq_empty_iff_forall_notMem.mpr fun x hx => hx (hS'.2.2 x) + isRigid := hRigid_H' + isRespectful := ⟨h2Cell_H', hT', hResp_T'⟩ + isControlling := hCtrl_T' }⟩ + +/-- **Graph Minors XV, (3.5)** (pages 123–124): +Adding a handle between two distinct regions `Λ₁, Λ₂` along `φ` disjoint `η(H)`-paths `P_i` yields +a `Σ'`-span `(H', η', T')` of order `φ`. -/ +theorem theorem_3_5_proof : + GM15Theorem35Statement.{u, v, w} := by + intro S _ _ α β G H η θ_star θ φ T_star T Λ₁ Λ₂ P a b + hSpan hΛ₁ hΛ₂ hne hOArc₁ hOArc₂ hCirc₁ _hCirc₂ hNo_common_region h_lines + hφ hφ_le hNodup_a hNodup_b hOrder_a hOrder_b hab_mem hP_paths hP_disj hFree_a hFree_b + have hS : IsClosedSurface S := + ⟨hSpan.isSurface.1, hSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hSpan.isConnected + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have : CompactSpace S := hS.1 + have hRigid_H : IsRigid H := hSpan.isRigid + have hResp_H : IsRespectfulDrawingTangle H θ T := hSpan.isRespectful + have hT : IsTangle H.toHypergraph θ T := hResp_H.2.1 + have hθ : 3 ≤ θ := le_trans hφ hφ_le + have hΛ₁_open : IsOpen Λ₁ := GM11.region_isOpen hΛ₁ + have hΛ₂_open : IsOpen Λ₂ := GM11.region_isOpen hΛ₂ + have hΛ₁_disc : IsOpenDisc Λ₁ := hResp_H.1.2 Λ₁ hΛ₁ + have hΛ₂_disc : IsOpenDisc Λ₂ := hResp_H.1.2 Λ₂ hΛ₂ + obtain ⟨hout₁, hCD₁, hdiscBd₁, _, _⟩ := + isClosedDisc_closure_of_region_tangle hS hResp_H hθ hΛ₁ hOArc₁ + obtain ⟨hout₂, hCD₂, hdiscBd₂, _, _⟩ := + isClosedDisc_closure_of_region_tangle hS hResp_H hθ hΛ₂ hOArc₂ + have hd : Disjoint (closure Λ₁) (closure Λ₂) := + disjoint_closure_of_no_common_region hS hΛ₁ hΛ₂ hne hOArc₁ hOArc₂ + ⟨a ⟨0, by omega⟩, (hab_mem ⟨0, by omega⟩).1⟩ hNo_common_region + obtain ⟨_, hSubBd₁_U, _⟩ := interSet_subBd_isCircuit_and_U_eq hS hΛ₁ hOArc₁ + obtain ⟨_, hSubBd₂_U, _⟩ := interSet_subBd_isCircuit_and_U_eq hS hΛ₂ hOArc₂ + have hSubBd_sub_U : ∀ {Λ : Set S}, (H.interSet (subBd Λ)).U = subBd Λ → subBd Λ ⊆ H.U := by + exact drawing_contains_region_boundary_of_boundary_subdrawing (S := S) H + have hSubBd₁_sub_U : subBd Λ₁ ⊆ H.U := hSubBd_sub_U hSubBd₁_U + have hSubBd₂_sub_U : subBd Λ₂ ⊆ H.U := hSubBd_sub_U hSubBd₂_U + let K : Set S := univ \ (Λ₁ ∪ Λ₂) + have hK_cl : IsClosed K := isClosed_univ.sdiff (hΛ₁_open.union hΛ₂_open) + have hK_comp : IsCompact K := hK_cl.isCompact + have : CompactSpace ↥K := isCompact_iff_compactSpace.mp hK_comp + have : CompactSpace ClosedCylinder := + isCompact_iff_compactSpace.mp (isCompact_Icc.prod isCompact_univ) + have hHU : H.U ⊆ K := fun y hy => + ⟨mem_univ y, fun h => h.elim (fun h1 => GM11.region_subset hΛ₁ h1 hy) + (fun h2 => GM11.region_subset hΛ₂ h2 hy)⟩ + -- Align the circle parametrizations of `subBd Λ₁` and `subBd Λ₂`. + obtain ⟨f₁, t₁, ht₁_mono, ht₁_bd, ht₁_val⟩ := hOrder_a + obtain ⟨f₂, t₂, ht₂_mono, ht₂_bd, ht₂_val⟩ := hOrder_b + have ht₁_bd' : ∀ i < φ, t₁ i < t₁ 0 + 2 * Real.pi := fun i hi => ht₁_bd i (by simp [hi]) + have ht₂_bd' : ∀ i < φ, t₂ i < t₂ 0 + 2 * Real.pi := fun i hi => ht₂_bd i (by simp [hi]) + obtain ⟨h_circ, hh_circ⟩ := + exists_circle_homeo_matching_angles φ (by omega) t₂ t₁ ht₂_mono ht₁_mono ht₂_bd' ht₁_bd' + let g₁ : Circle ≃ₜ ↥(subBd Λ₁) := f₁ + let g₂ : Circle ≃ₜ ↥(subBd Λ₂) := h_circ.symm.trans f₂ + let w : Fin φ → Circle := fun i => Circle.exp (t₁ i.1) + have hg₁_w : ∀ i : Fin φ, (g₁ (w i)).1 = a i := + fun i => by simpa using ht₁_val i.1 (by simp) + have hg₂_w : ∀ i : Fin φ, (g₂ (w i)).1 = b i := by + exact upper_handle_parametrization_matches_path_ends (S := S) φ Λ₂ b t₁ f₂ t₂ ht₂_val h_circ + hh_circ g₂ rfl w (fun _ => rfl) + have ha_inj : Function.Injective a := List.nodup_ofFn.mp hNodup_a + have hb_inj_fn : Function.Injective b := List.nodup_ofFn.mp hNodup_b + have hw_inj : Function.Injective w := + fun i j hij => ha_inj (by rw [← hg₁_w i, ← hg₁_w j, hij]) + -- Construct the glued surface `S'`. + let b_glue := handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ + have hb_inj := injective_handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ + have hb_cont := continuous_handleGlueMap hΛ₁_open hΛ₂_open hd g₁ g₂ + have hb_range := range_handleGlueMap hS hΛ₁_open hΛ₂_open hOArc₁ hOArc₂ hout₁ hout₂ hd g₁ g₂ + let S' := GluedSpace hb_inj + have : T2Space S' := GluedSpace.t2Space (isClosed_bd ↥ClosedCylinder) hb_cont hb_inj + obtain ⟨hS', hConn', hHandle, _, _, hU_S12_eq, _, _⟩ := + isClosedSurface_of_handle_glue hS hΛ₁_disc hΛ₂_disc hd hOArc₁ hOArc₂ hout₁ hout₂ + hb_cont hb_inj hb_range + let S₁ : Set S' := range (GluedSpace.inl hb_inj) + let S₂ : Set S' := range (GluedSpace.inr hb_inj) + have hinl_emb : IsClosedEmbedding (GluedSpace.inl hb_inj) := + (GluedSpace.continuous_inl hb_inj).isClosedEmbedding (GluedSpace.inl_injective hb_inj) + have hinr_emb : IsClosedEmbedding (GluedSpace.inr hb_inj) := + (GluedSpace.continuous_inr hb_inj).isClosedEmbedding (GluedSpace.inr_injective hb_inj) + have hS₁_cl : IsClosed S₁ := hinl_emb.isClosed_range + have hS₂_cl : IsClosed S₂ := hinr_emb.isClosed_range + -- Unpinched split on `S'`. + obtain ⟨C_unp, ι_unp, _, _, _, hSplit_unp, hC_unp_0, hC_unp_1, _, hι_unp_inl⟩ := + isCappedSplit_handle_unpinched hS hΛ₁_open hΛ₂_open hΛ₁_disc hΛ₂_disc hd + hOArc₁ hOArc₂ hout₁ hout₂ g₁ g₂ hb_inj + have hS12_inter : S₁ ∩ S₂ = C_unp 0 ∪ C_unp 1 := by + rw [hSplit_unp.inter] + ext x + simp [Fin.exists_fin_two] + have ha0_K : a ⟨0, by omega⟩ ∈ K := hHU (H.V_subset_U (hab_mem ⟨0, by omega⟩).1.1) + let g_unp : S → S' := by + classical + exact fun y => if hy : y ∈ K then GluedSpace.inl hb_inj ⟨y, hy⟩ else + GluedSpace.inl hb_inj ⟨a ⟨0, by omega⟩, ha0_K⟩ + let f_unp : S' → S := by + classical + exact fun x => if hx : x ∈ S₁ then ι_unp ⟨x, hx⟩ else a ⟨0, by omega⟩ + have hg_unp_mem : ∀ y (hy : y ∈ K), g_unp y = GluedSpace.inl hb_inj ⟨y, hy⟩ := by + intro y hy + simp only [g_unp, hy, ↓reduceDIte] + have hf_unp_inl : ∀ y : ↥K, f_unp (GluedSpace.inl hb_inj y) = y.1 := by + intro y + have hx : GluedSpace.inl hb_inj y ∈ S₁ := ⟨y, rfl⟩ + simp only [f_unp, hx, ↓reduceDIte] + exact hι_unp_inl y + have hg_unp_cont : ContinuousOn g_unp K := by + rw [continuousOn_iff_continuous_domRestrict] + have hEq : K.domRestrict g_unp = GluedSpace.inl hb_inj := by + ext ⟨y, hy⟩ + exact hg_unp_mem y hy + rw [hEq] + exact GluedSpace.continuous_inl hb_inj + have hf_unp_cont : ContinuousOn f_unp S₁ := by + exact unpinched_map_continuous_on_first_piece (S := S) Λ₁ Λ₂ hΛ₁_open hΛ₂_open hd g₁ g₂ hb_inj + C_unp ι_unp hSplit_unp f_unp (fun _ hx => dite_eq_left hx) + have hfg_unp_inv : Set.LeftInvOn f_unp g_unp K := by + intro y hy + rw [hg_unp_mem y hy, hf_unp_inl ⟨y, hy⟩] + have hgf_unp_inv : Set.LeftInvOn g_unp f_unp S₁ := by + rintro _ ⟨y, rfl⟩ + rw [hf_unp_inl y, hg_unp_mem y.1 y.2] + have hg_unp_K : g_unp '' K = S₁ := by + exact original_complement_embeds_onto_first_piece (S := S) Λ₁ Λ₂ hΛ₁_open hΛ₂_open hd g₁ g₂ + hb_inj g_unp hg_unp_mem + have hf_unp_cont' : ContinuousOn f_unp (g_unp '' K) := hg_unp_K.symm ▸ hf_unp_cont + let H₁ : Drawing S' := liftDrawingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU + let η₁ : SpanEmbedding H₁ G := + liftSpanEmbeddingOn hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv hHU η + have hH₁_U : H₁.U = g_unp '' H.U := + liftDrawingOn_U hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU + have hH₁_V : H₁.V = g_unp '' H.V := + liftDrawingOn_V hK_comp hg_unp_cont hf_unp_cont' hfg_unp_inv H hHU + have hH₁_sub_S₁ : H₁.U ⊆ S₁ := by + rw [hH₁_U, ← hg_unp_K] + exact image_mono hHU + -- Radial lines `L i` and endpoints `a' i, b' i`. + have m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2 := by norm_num + have m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2 := by norm_num + let a' : Fin φ → S' := fun i => g_unp (a i) + let b' : Fin φ → S' := fun i => g_unp (b i) + let L : Fin φ → Set S' := fun i => GluedSpace.inr hb_inj '' {p : ClosedCylinder | p.1.2 = w i} + have ha_K : ∀ i, a i ∈ K := fun i => hHU (H.V_subset_U (hab_mem i).1.1) + have hb_K : ∀ i, b i ∈ K := fun i => hHU (H.V_subset_U (hab_mem i).2.1) + have ha'_V : ∀ i, a' i ∈ H₁.V := fun i => by rw [hH₁_V]; exact ⟨a i, (hab_mem i).1.1, rfl⟩ + have hb'_V : ∀ i, b' i ∈ H₁.V := fun i => by rw [hH₁_V]; exact ⟨b i, (hab_mem i).2.1, rfl⟩ + have ha'_inr : ∀ i, a' i = GluedSpace.inr hb_inj (cylEnd 1 m1 (w i)) := by + exact lower_handle_end_maps_to_cylinder (S := S) φ Λ₁ Λ₂ a hΛ₁_open hΛ₂_open hd g₁ g₂ w hg₁_w + hb_inj g_unp hg_unp_mem m1 a' rfl ha_K + have hb'_inr : ∀ i, b' i = GluedSpace.inr hb_inj (cylEnd 2 m2 (w i)) := by + exact upper_handle_end_maps_to_cylinder (S := S) φ Λ₁ Λ₂ b hΛ₁_open hΛ₂_open hd g₁ g₂ w hg₂_w + hb_inj g_unp hg_unp_mem m2 b' rfl hb_K + have hL_line : ∀ i, IsLineWithEnds (L i) (a' i) (b' i) := by + exact handle_fibers_are_lines (S := S) φ Λ₁ Λ₂ hΛ₁_open hΛ₂_open hd g₁ g₂ w hb_inj hinr_emb m1 + m2 a' b' ha'_inr hb'_inr + have hL_disj : Pairwise (fun i j => Disjoint (L i) (L j)) := by + exact distinct_handle_lines_are_disjoint (S := S) φ Λ₁ Λ₂ hΛ₁_open hΛ₂_open hd g₁ g₂ w hw_inj + hb_inj + have hL_S₁ : ∀ i, L i ∩ S₁ = {a' i, b' i} := by + exact handle_line_intersects_original_surface_only_at_ends (S := S) φ Λ₁ Λ₂ hΛ₁_open hΛ₂_open + hd g₁ g₂ w hb_inj H₁ hH₁_sub_S₁ m1 m2 a' b' ha'_V hb'_V ha'_inr hb'_inr + have hL_H₁U : ∀ i, L i ∩ H₁.U = {a' i, b' i} := by + exact handle_line_meets_original_drawing_only_at_ends (S := S) φ Λ₁ Λ₂ hΛ₁_open hΛ₂_open hd g₁ + g₂ w hb_inj H₁ hH₁_sub_S₁ a' b' ha'_V hb'_V hL_S₁ + have hP_paths' : ∀ i : Fin φ, + IsHPathWithEnds G η₁.imageGraph (P i) (η₁.vMap (a' i)) (η₁.vMap (b' i)) := by + exact original_paths_lift_to_glued_drawing (S := S) (α := α) (β := β) G H η φ Λ₁ Λ₂ P a b + hP_paths hΛ₁_open hΛ₂_open hd g₁ g₂ hb_inj H₁ η₁ a' b' rfl (fun i => congrArg η.vMap + (hfg_unp_inv (ha_K i))) (fun i => congrArg η.vMap (hfg_unp_inv (hb_K i))) + exact assemble_rigid_span_on_added_handle (S := S) (α := α) (β := β) G H η θ_star θ φ T_star T + Λ₁ Λ₂ P a b hSpan hΛ₁ hΛ₂ hOArc₁ hOArc₂ hNo_common_region h_lines hφ hφ_le hab_mem hP_disj + hFree_a hFree_b hS hRigid_H hResp_H hT hθ hΛ₁_open hΛ₂_open hΛ₁_disc hΛ₂_disc hout₁ hCD₁ + hdiscBd₁ hout₂ hCD₂ hdiscBd₂ hd hSubBd₁_sub_U hSubBd₂_sub_U hK_cl hK_comp hHU + g₁ g₂ w ha_inj hb_inj_fn hw_inj hb_inj hS' hHandle hS₁_cl hS₂_cl C_unp ι_unp hSplit_unp + hC_unp_0 hC_unp_1 hι_unp_inl hS12_inter g_unp f_unp hg_unp_mem hf_unp_inl hg_unp_cont + hf_unp_cont hfg_unp_inv hgf_unp_inv hf_unp_cont' hH₁_U hH₁_V hH₁_sub_S₁ m1 m2 ha_K hb_K + ha'_V hb'_V ha'_inr hb'_inr hL_line hL_disj hL_S₁ hL_H₁U hP_paths' + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/Section3Parallel.lean b/LeanPool/GraphMinor/GM15/Section3Parallel.lean new file mode 100644 index 0000000000..da0d86ab14 --- /dev/null +++ b/LeanPool/GraphMinor/GM15/Section3Parallel.lean @@ -0,0 +1,3313 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +import LeanPool.GraphMinor.GM12.Section79 + +public import LeanPool.GraphMinor.GM15.Section3Crosscap +public import LeanPool.GraphMinor.GM14.Section9a +import LeanPool.GraphMinor.Surface.Collar + +import LeanPool.GraphMinor.GM12.Section6 + +import LeanPool.GraphMinor.GM12.Section77 + +/-! +# Graph Minors XV, (3.4): Parallel Paths Across a Region + +This file gives the proof of **Graph Minors XV, (3.4)**, pages 122–123, in a chart of the closed +disc $\bar\Lambda$ in which the paths $P_1, \dots, P_{k-1}$ are vertical chords +(`theorem_3_4_of_chart`). Given a `Σ`-span `(H, η, T)` of order `θ`, a region `Λ` of `H` bounded by +a circuit containing distinct vertices `v₁, …, v_{2k}` in order such that `{v₁, …, v_{2k}}` is free +with respect to `T`, and the drawing `H' = H ∪ P₁ ∪ … ∪ P_{k-1}`, it shows that `H'` with the +induced tangle is a `Σ`-span of order `θ`, and that the regions `r₁, r₂ ⊆ Λ` of `H'` incident with +`v_k, v_{2k}` satisfy `d'(r₁, r₂) ≥ 2k - 6` and `d'(v_k, v_{2k}) ≥ 2k - 8`. +`GraphMinor/GM15/Section3Given.lean` gets such a chart for any such `H'`. + +The proof follows Robertson and Seymour, *Graph Minors. XV. Giant Steps*, pages 122–123. +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +open Set Function Topology Metric +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM12 GM14 +open scoped unitInterval + +universe u v w + +/-! ## 1. Tangle Metric Bounds Between Incident Regions, Vertices, and Edges -/ + +section MetricBounds + +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- If `d` is the metric of a respectful tangle `(H, θ, T)`, `r ∈ H.R`, `e ∈ H.E`, and +`e ⊆ closure r`, then `d r e ≤ 2` and `d e r ≤ 2`. -/ +theorem hasTangleMetric_region_edge_le (hS : IsClosedSurface S) + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hd : HasTangleMetric H θ T d) + {r e : Set S} (hr : r ∈ H.R) (he : e ∈ H.E) (her : e ⊆ closure r) : + d r e ≤ 2 ∧ d e r ≤ 2 := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hhd := hd + obtain ⟨hResp, K, ins, hK, hds, hdeq⟩ := hd + have hP := hK.2.1 + obtain ⟨y, hy⟩ := he.1 + have hdisj : Disjoint e K.U := disjoint_left.mpr fun z hz hzK => by + have hzV : z ∈ H.V := by + have hV_eq : H.V = H.U ∩ K.U := hP.1.symm + rw [hV_eq] + exact ⟨(he.2.1 hz).1, hzK⟩ + exact (he.2.1 hz).2 hzV + obtain ⟨r', hr', hyr'⟩ := exists_region_of_notMem (disjoint_left.mp hdisj hy) + have her' : e ⊆ r' := subset_region hr' he.2.2.1.isConnected.isPreconnected hdisj hy hyr' + obtain ⟨z, hzr', hzr⟩ := mem_closure_iff.mp (her hy) r' (region_isOpen hr') hyr' + have hle : tangleMetric H K ins θ r e ≤ 2 := + GM14.tangleMetric_region_edge_le hS hResp hK hds hr he hr' her' ⟨z, hzr, hzr'⟩ + have hre : d r e ≤ 2 := by + rw [hdeq r (Or.inr hr) e (Or.inl (Or.inr he))] + exact hle + have her_le : d e r ≤ 2 := by + have hsymm := (gm15_theorem_9_1 H θ T d hS inferInstance hhd).2.2.2.1 e (Or.inl (Or.inr he)) r + (Or.inr hr) + omega + exact ⟨hre, her_le⟩ + +/-- In the setup of XV (3.4), if `2 * (k - 1) ≤ d' e₁ e₂` where `e₁ ⊆ closure r₂`, +`e₂ ⊆ closure r₁`, `v_k ∈ closure r₁`, and `v_{2k} ∈ closure r₂`, then +`2 * k - 6 ≤ d' r₁ r₂` and `2 * k - 8 ≤ d' {v_k} {v_{2k}}` (Graph Minors XV, page 123). -/ +theorem tangleMetric_bounds_of_parallel_paths (hS : IsClosedSurface S) + {H' : Drawing S} {θ k : ℕ} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d' : Set S → Set S → ℕ} + (hd' : HasTangleMetric H' θ T' d') + {r₁ r₂ e₁ e₂ : Set S} {v₁ v₂ : S} + (hr₁ : r₁ ∈ H'.R) (hr₂ : r₂ ∈ H'.R) + (he₁ : e₁ ∈ H'.E) (he₂ : e₂ ∈ H'.E) + (he₁_r₂ : e₁ ⊆ closure r₂) (he₂_r₁ : e₂ ⊆ closure r₁) + (hv₁ : v₁ ∈ H'.V) (hv₂ : v₂ ∈ H'.V) + (hv₁_r₁ : v₁ ∈ closure r₁) (hv₂_r₂ : v₂ ∈ closure r₂) + (hdist : 2 * (k - 1) ≤ d' e₁ e₂) : + 2 * k - 6 ≤ d' r₁ r₂ ∧ 2 * k - 8 ≤ d' {v₁} {v₂} := by + obtain ⟨_, _, _, hsymm, htri, hvr, _⟩ := gm15_theorem_9_1 H' θ T' d' hS inferInstance hd' + have hr₁A : r₁ ∈ H'.A := Or.inr hr₁ + have hr₂A : r₂ ∈ H'.A := Or.inr hr₂ + have he₁A : e₁ ∈ H'.A := Or.inl (Or.inr he₁) + have he₂A : e₂ ∈ H'.A := Or.inl (Or.inr he₂) + have hv₁A : ({v₁} : Set S) ∈ H'.A := Or.inl (Or.inl ⟨v₁, hv₁, rfl⟩) + have hv₂A : ({v₂} : Set S) ∈ H'.A := Or.inl (Or.inl ⟨v₂, hv₂, rfl⟩) + have h_e₁_r₂ : d' e₁ r₂ ≤ 2 := (hasTangleMetric_region_edge_le hS hd' hr₂ he₁ he₁_r₂).2 + have h_r₁_e₂ : d' r₁ e₂ ≤ 2 := (hasTangleMetric_region_edge_le hS hd' hr₁ he₂ he₂_r₁).1 + have h_r₂_r₁ : d' r₂ r₁ = d' r₁ r₂ := hsymm r₂ hr₂A r₁ hr₁A + have h_tri1 : d' e₁ e₂ ≤ d' e₁ r₂ + d' r₂ e₂ := htri e₁ he₁A r₂ hr₂A e₂ he₂A + have h_tri2 : d' r₂ e₂ ≤ d' r₂ r₁ + d' r₁ e₂ := htri r₂ hr₂A r₁ hr₁A e₂ he₂A + have h_r₁_r₂ : 2 * k - 6 ≤ d' r₁ r₂ := by omega + have hE_ne : H'.E.Nonempty := ⟨e₁, he₁⟩ + have h_v₁_r₁ : d' {v₁} r₁ ≤ 1 := hvr hE_ne v₁ hv₁ r₁ hr₁ hv₁_r₁ + have h_r₁_v₁ : d' r₁ {v₁} = d' {v₁} r₁ := hsymm r₁ hr₁A {v₁} hv₁A + have h_v₂_r₂ : d' {v₂} r₂ ≤ 1 := hvr hE_ne v₂ hv₂ r₂ hr₂ hv₂_r₂ + have h_tri3 : d' r₁ r₂ ≤ d' r₁ {v₁} + d' {v₁} r₂ := htri r₁ hr₁A {v₁} hv₁A r₂ hr₂A + have h_tri4 : d' {v₁} r₂ ≤ d' {v₁} {v₂} + d' {v₂} r₂ := htri {v₁} hv₁A {v₂} hv₂A r₂ hr₂A + refine ⟨h_r₁_r₂, by omega⟩ + +end MetricBounds + +/-! ## 2. Disc Charts Matching a Prescribed Boundary Circle Homeomorphism -/ + +section DiscChartWithBd + +variable {S : Type w} [TopologicalSpace S] + +/-- Given a closed disc `Δ ⊆ S` and a boundary homeomorphism `p : Circle ≃ₜ discBd Δ`, there exists +a chart `IsChart Δ h g` such that `g w = (p w).1` for every `w : Circle`. -/ +theorem exists_isChart_with_bd {Δ : Set S} (hΔ : IsClosedDisc Δ) + (p : Circle ≃ₜ discBd Δ) : + ∃ h g, IsChart Δ h g ∧ ∀ w : Circle, g w = (p w).1 := by + obtain ⟨h', g', cD⟩ := hΔ.exists_isChart + have hbdΔ : discBd Δ ⊆ Δ := Surface.discBd_subset Δ + obtain ⟨r, hr⟩ := exists_homeomorph_image (cD.hc.mono hbdΔ) + (cD.gc.mono (cD.image_subset hbdΔ)) (cD.gh.mono hbdΔ) + obtain ⟨o, ho⟩ := exists_circle_sphere + obtain ⟨h₀, k₀, m₀, hv₀⟩ := exists_bdMatch ((o.symm.trans p).trans r) + rw [cD.bd] at m₀ + have hoS : Nonempty (Circle ≃ₜ sphere (0 : ℂ) 1) := ⟨o⟩ + obtain ⟨Ψ, hΨ, hΨi⟩ := exists_plane_homeomorph hoS hoS m₀ + rw [closedInner_sphere] at hΨi + have hΨ_maps : MapsTo Ψ (closedBall (0 : ℂ) 1) (closedBall (0 : ℂ) 1) := + fun z hz => hΨi ▸ mem_image_of_mem Ψ hz + have hΨsymm_maps : MapsTo Ψ.symm (closedBall (0 : ℂ) 1) (closedBall (0 : ℂ) 1) := by + intro w hw + rw [← hΨi] at hw + obtain ⟨z, hz, rfl⟩ := hw + simpa using hz + have hh₀ : ∀ w : Circle, h₀ w = h' (p w).1 := fun w => by + have h1 := hv₀ (o w) + rw [ho w] at h1 + rw [h1] + simp [hr] + let h : S → ℂ := fun x => Ψ.symm (h' x) + let g : ℂ → S := fun z => g' (Ψ z) + have hg_w : ∀ w : Circle, g w = (p w).1 := fun w => by + have hw : (w : ℂ) ∈ sphere (0 : ℂ) 1 := mem_sphere_zero_iff_norm.mpr (Circle.norm_coe w) + change g' (Ψ w) = (p w).1 + rw [hΨ hw, hh₀ w, cD.gh (hbdΔ (p w).2)] + have h_left : LeftInvOn h g (closedBall (0 : ℂ) 1) := fun z hz => by + change Ψ.symm (h' (g' (Ψ z))) = z + rw [cD.hg (hΨ_maps hz), Ψ.symm_apply_apply] + have hg_sph : g '' sphere (0 : ℂ) 1 = discBd Δ := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + let w : Circle := ⟨z, by simpa [Submonoid.unitSphere] using hz⟩ + exact hg_w w ▸ (p w).2 + · intro hx + obtain ⟨w, hw⟩ := p.surjective ⟨x, hx⟩ + exact ⟨w, mem_sphere_zero_iff_norm.mpr (Circle.norm_coe w), + (hg_w w).trans (congrArg Subtype.val hw)⟩ + refine ⟨h, g, ⟨Ψ.symm.continuous.comp_continuousOn cD.hc, + cD.gc.comp Ψ.continuous.continuousOn hΨ_maps, + hΨsymm_maps.comp cD.hm, cD.gm.comp hΨ_maps, + fun x hx => by change g' (Ψ (Ψ.symm (h' x))) = x; rw [Ψ.apply_symm_apply, cD.gh hx], + h_left, ?_⟩, hg_w⟩ + rw [← hg_sph, (h_left.mono sphere_subset_closedBall).image_image] + +/-- For any chart `c : IsChart Δ h g`, `g '' ball (0 : ℂ) 1 = Δ \ discBd Δ`. -/ +theorem IsChart.g_ball {Δ : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart Δ h g) : + g '' ball (0 : ℂ) 1 = Δ \ discBd Δ := by + have hball_eq : ball (0 : ℂ) 1 = closedBall (0 : ℂ) 1 \ sphere (0 : ℂ) 1 := by + ext z + simp only [mem_ball_zero_iff, mem_sdiff, mem_closedBall_zero_iff, mem_sphere_zero_iff_norm, + lt_iff_le_and_ne] + rw [hball_eq, c.g_sdiff Subset.rfl sphere_subset_closedBall, c.g_closedBall, c.g_sphere] + +end DiscChartWithBd + +/-! ## 3. Lifting `IsListedInOrderOn` Along a Fixed Circle Homeomorphism -/ + +section LiftOrder + +variable {S : Type w} [TopologicalSpace S] + +/-- If `Circle.exp x = Circle.exp y`, then `x - y = k * (2 * Real.pi)` for some `k : ℤ`. -/ +theorem circle_exp_eq_iff_sub_eq_int_mul {x y : ℝ} : + Circle.exp x = Circle.exp y ↔ ∃ k : ℤ, x - y = k * (2 * Real.pi) := by + have hpi : 2 * Real.pi ≠ 0 := by positivity + have hx : Circle.exp x = ee (x / (2 * Real.pi)) := by + unfold ee + rw [mul_div_cancel₀ _ hpi] + have hy : Circle.exp y = ee (y / (2 * Real.pi)) := by + unfold ee + rw [mul_div_cancel₀ _ hpi] + rw [hx, hy, ee_eq_iff] + constructor + · rintro ⟨k, hk⟩ + refine ⟨k, ?_⟩ + have := congrArg (· * (2 * Real.pi)) hk + change (x / (2 * Real.pi)) * (2 * Real.pi) = (y / (2 * Real.pi) + k) * (2 * Real.pi) at this + rw [div_mul_cancel₀ _ hpi, add_mul, div_mul_cancel₀ _ hpi] at this + linarith + · rintro ⟨k, hk⟩ + refine ⟨k, ?_⟩ + have hx_eq : x = y + k * (2 * Real.pi) := by linarith + rw [hx_eq, add_div, mul_div_cancel_right₀ _ hpi] + +/-- Two angles in `[θ₀, θ₀ + 2π)` with the same `Circle.exp` are equal. -/ +theorem eq_of_circle_exp_eq_of_mem_Ico {θ₀ x y : ℝ} + (hx : x ∈ Ico θ₀ (θ₀ + 2 * Real.pi)) (hy : y ∈ Ico θ₀ (θ₀ + 2 * Real.pi)) + (h : Circle.exp x = Circle.exp y) : x = y := + Circle.exp_injOn_Ico (a := θ₀) (b := θ₀ + 2 * Real.pi) (by simp) hx hy h + +private theorem angle_lt_full_turn_of_injective_lift + {θ₀ : ℝ} + {θ₁ : ℝ} + {θ₂ : ℝ} + (hθ₀₁ : θ₀ < θ₁) + (hθ₁₂ : θ₁ < θ₂) + (hθ₂_bd : θ₂ < θ₀ + 2 * Real.pi) + (Γ_R : ℝ → ℝ) + (hΓ_R_cont : ContinuousOn Γ_R (Icc 0 1)) + (hΓ_R_0 : Γ_R 0 = θ₀) + (hΓ_R_inj_exp : InjOn (fun u => Circle.exp (Γ_R u)) (Ico 0 1)) : + ∀ u ∈ Ico 0 1, Γ_R u < θ₀ + 2 * Real.pi := by + intro u hu + by_contra hge + push Not at hge + have hu_pos : 0 < u := by + rcases eq_or_lt_of_le hu.1 with rfl | hpos + · rw [hΓ_R_0] at hge + linarith + · exact hpos + obtain ⟨v, hv_Icc, hv_eq⟩ := intermediate_value_Icc hu.1 + (hΓ_R_cont.mono (Icc_subset_Icc_right hu.2.le)) + ⟨by rw [hΓ_R_0]; linarith, hge⟩ + have hv_Ico : v ∈ Ico (0 : ℝ) 1 := ⟨hv_Icc.1, hv_Icc.2.trans_lt hu.2⟩ + have hv_exp : Circle.exp (Γ_R v) = Circle.exp (Γ_R 0) := by + rw [hv_eq, hΓ_R_0, Circle.exp_add, Circle.exp_two_pi, mul_one] + have hv0 : v = 0 := hΓ_R_inj_exp hv_Ico ⟨le_rfl, zero_lt_one⟩ hv_exp + subst hv0 + rw [hΓ_R_0] at hv_eq + linarith + +/-- Given a fixed circle homeomorphism `g_circ : Circle ≃ₜ C` and a list `l : List S` with +`GM12.IsListedInOrderOn C l` whose elements at indices `0`, `1`, and `idx₂` (`1 < idx₂ < l.length`) +match `g_circ (Circle.exp θ₀)`, `g_circ (Circle.exp θ₁)`, `g_circ (Circle.exp θ₂)` with +`θ₀ < θ₁ < θ₂ < θ₀ + 2π`, there exists a strictly increasing sequence `Θ : ℕ → ℝ` with +`Θ 0 = θ₀`, `Θ i < θ₀ + 2π` for `i < l.length`, and `(g_circ (Circle.exp (Θ i))).1 = l[i]`. -/ +theorem exists_increasing_angles_of_isListedInOrderOn + {C : Set S} (g_circ : Circle ≃ₜ C) {l : List S} + (hl_ord : GM12.IsListedInOrderOn C l) + {θ₀ θ₁ θ₂ : ℝ} {idx₂ : ℕ} + (hidx₁ : 1 < idx₂) (hidx₂ : idx₂ < l.length) + (hθ₀₁ : θ₀ < θ₁) (hθ₁₂ : θ₁ < θ₂) (hθ₂_bd : θ₂ < θ₀ + 2 * Real.pi) + (hl0 : (g_circ (Circle.exp θ₀)).1 = l[0]'(by omega)) + (hl1 : (g_circ (Circle.exp θ₁)).1 = l[1]'(by omega)) + (hl2 : (g_circ (Circle.exp θ₂)).1 = l[idx₂]'hidx₂) : + ∃ Θ : ℕ → ℝ, + StrictMono Θ ∧ + Θ 0 = θ₀ ∧ + (∀ i < l.length, Θ i < θ₀ + 2 * Real.pi) ∧ + (∀ (i : ℕ) (hi : i < l.length), (g_circ (Circle.exp (Θ i))).1 = l[i]'hi) ∧ + (∀ (i : ℕ) (hi : i < l.length) (θ : ℝ), + θ ∈ Ico θ₀ (θ₀ + 2 * Real.pi) → (g_circ (Circle.exp θ)).1 = l[i]'hi → Θ i = θ) := by + have hpi : 0 < 2 * Real.pi := by positivity + obtain ⟨f_l, t_l, ht_l_mono, ht_l_bd, ht_l_val⟩ := hl_ord + let h_rel : Circle ≃ₜ Circle := f_l.trans g_circ.symm + have hh_rel_val : ∀ (i : ℕ) (hi : i < l.length), + (g_circ (h_rel (Circle.exp (t_l i)))).1 = l[i]'hi := by + intro i hi + change (g_circ (g_circ.symm (f_l (Circle.exp (t_l i))))).1 = l[i]'hi + rw [Homeomorph.apply_symm_apply] + exact ht_l_val i hi + have hh_rel_eq : ∀ (i : ℕ) (hi : i < l.length) (θ : ℝ), + (g_circ (Circle.exp θ)).1 = l[i]'hi → h_rel (Circle.exp (t_l i)) = Circle.exp θ := by + intro i hi θ hθ + apply g_circ.injective + apply Subtype.ext + rw [hh_rel_val i hi, hθ] + let γ : C(unitInterval, Circle) := + ⟨fun u => h_rel (Circle.exp (t_l 0 + 2 * Real.pi * (u : ℝ))), + h_rel.continuous.comp (Circle.exp.continuous.comp (by fun_prop))⟩ + have hγ0 : γ 0 = Circle.exp θ₀ := by + change h_rel (Circle.exp (t_l 0 + 2 * Real.pi * 0)) = Circle.exp θ₀ + rw [mul_zero, add_zero] + exact hh_rel_eq 0 (by omega) θ₀ hl0 + obtain ⟨Γ, hΓ_exp, hΓ0⟩ := + Circle.isCoveringMap_exp.exists_path_lifts γ θ₀ hγ0 + let P : ℝ → unitInterval := projIcc 0 1 zero_le_one + let m : ℝ → ℝ := fun u => Γ (P u) / (2 * Real.pi) + have hm_cont : ContinuousOn m (Icc 0 1) := + ((Γ.continuous.comp continuous_projIcc).div_const _).continuousOn + have hm_ee : ∀ u ∈ Icc (0 : ℝ) 1, ee (m u) = h_rel (Circle.exp (t_l 0 + 2 * Real.pi * u)) := by + intro u hu + unfold ee m + rw [mul_div_cancel₀ _ (ne_of_gt hpi)] + have h1 := congrFun hΓ_exp (P u) + change Circle.exp (Γ (P u)) = h_rel (Circle.exp (t_l 0 + 2 * Real.pi * + (projIcc 0 1 zero_le_one u : ℝ))) at h1 + rw [projIcc_of_mem zero_le_one hu] at h1 + exact h1 + have hm_inj : InjOn (fun u => ee (m u)) (Ico 0 1) := by + intro u₁ hu₁ u₂ hu₂ heq + dsimp at heq + rw [hm_ee u₁ ⟨hu₁.1, hu₁.2.le⟩, hm_ee u₂ ⟨hu₂.1, hu₂.2.le⟩] at heq + have h_exp_eq := h_rel.injective heq + have h_eq := eq_of_circle_exp_eq_of_mem_Ico (θ₀ := t_l 0) + ⟨by nlinarith [hu₁.1], by nlinarith [hu₁.2]⟩ + ⟨by nlinarith [hu₂.1], by nlinarith [hu₂.2]⟩ h_exp_eq + nlinarith + let Γ_R : ℝ → ℝ := fun u => Γ (P u) + have hΓ_R_cont : ContinuousOn Γ_R (Icc 0 1) := + (Γ.continuous.comp continuous_projIcc).continuousOn + have hΓ_R_0 : Γ_R 0 = θ₀ := by + have hP0 : P 0 = 0 := Subtype.ext (by simp [P]) + change Γ (P 0) = θ₀ + rw [hP0, hΓ0] + have hΓ_R_exp : ∀ u ∈ Icc (0 : ℝ) 1, + Circle.exp (Γ_R u) = h_rel (Circle.exp (t_l 0 + 2 * Real.pi * u)) := by + intro u hu + have h := hm_ee u hu + unfold ee m at h + rwa [mul_div_cancel₀ _ (ne_of_gt hpi)] at h + have hΓ_R_inj_exp : InjOn (fun u => Circle.exp (Γ_R u)) (Ico 0 1) := by + intro u₁ hu₁ u₂ hu₂ heq + apply hm_inj hu₁ hu₂ + change Circle.exp (2 * Real.pi * (Γ_R u₁ / (2 * Real.pi))) = + Circle.exp (2 * Real.pi * (Γ_R u₂ / (2 * Real.pi))) + rw [mul_div_cancel₀ _ (ne_of_gt hpi), mul_div_cancel₀ _ (ne_of_gt hpi)] + exact heq + let u_idx : ℕ → ℝ := fun i => (t_l i - t_l 0) / (2 * Real.pi) + have hu_idx_mono : StrictMono u_idx := by + intro i j hij + dsimp [u_idx] + exact div_lt_div_of_pos_right (by linarith [ht_l_mono hij]) hpi + have hu_idx_0 : u_idx 0 = 0 := by simp [u_idx] + have hu_idx_mem : ∀ i < l.length, u_idx i ∈ Ico (0 : ℝ) 1 := by + intro i hi + refine ⟨?_, ?_⟩ + · rw [← hu_idx_0] + exact hu_idx_mono.monotone (Nat.zero_le i) + · dsimp [u_idx] + rw [div_lt_one hpi] + linarith [ht_l_bd i hi] + have hΓ_R_u_idx : ∀ (i : ℕ) (hi : i < l.length), + Circle.exp (Γ_R (u_idx i)) = h_rel (Circle.exp (t_l i)) := by + intro i hi + have hu := hu_idx_mem i hi + rw [hΓ_R_exp (u_idx i) ⟨hu.1, hu.2.le⟩] + congr 2 + dsimp [u_idx] + rw [mul_div_cancel₀ _ (ne_of_gt hpi), add_sub_cancel] + rcases lift_mono_loop hm_cont hm_inj with hm_mono | hm_anti + · have hΓ_mono : StrictMonoOn Γ_R (Icc 0 1) := by + intro x hx y hy hxy + have := hm_mono hx hy hxy + dsimp [m] at this + exact (div_lt_div_iff_of_pos_right hpi).mp this + have hΓ_lt_two_pi : ∀ u ∈ Ico (0 : ℝ) 1, Γ_R u < θ₀ + 2 * Real.pi := by + exact angle_lt_full_turn_of_injective_lift (θ₀ := θ₀) (θ₁ := θ₁) (θ₂ := θ₂) hθ₀₁ hθ₁₂ hθ₂_bd + Γ_R hΓ_R_cont hΓ_R_0 hΓ_R_inj_exp + have hΓ_mem_Ico : ∀ u ∈ Ico (0 : ℝ) 1, Γ_R u ∈ Ico θ₀ (θ₀ + 2 * Real.pi) := by + intro u hu + refine ⟨?_, hΓ_lt_two_pi u hu⟩ + rw [← hΓ_R_0] + exact hΓ_mono.monotoneOn ⟨le_rfl, zero_le_one⟩ ⟨hu.1, hu.2.le⟩ hu.1 + let Θ : ℕ → ℝ := fun i => + if i < l.length then Γ_R (u_idx i) else θ₀ + 2 * Real.pi + (i - l.length : ℕ) + have hΘ_mono : StrictMono Θ := by + intro i j hij + dsimp [Θ] + by_cases hj : j < l.length + · have hi : i < l.length := hij.trans hj + simp only [hi, hj, ↓reduceIte] + have hui := hu_idx_mem i hi + have huj := hu_idx_mem j hj + exact hΓ_mono ⟨hui.1, hui.2.le⟩ ⟨huj.1, huj.2.le⟩ (hu_idx_mono hij) + · by_cases hi : i < l.length + · simp only [hi, hj, ↓reduceIte] + have hlt := (hΓ_mem_Ico (u_idx i) (hu_idx_mem i hi)).2 + have hge : (0 : ℝ) ≤ (j - l.length : ℕ) := Nat.cast_nonneg _ + linarith + · simp only [hi, hj, ↓reduceIte] + have hsub : i - l.length < j - l.length := by omega + have hcast : ((i - l.length : ℕ) : ℝ) < ((j - l.length : ℕ) : ℝ) := + Nat.cast_lt.mpr hsub + linarith + have hΘ_0 : Θ 0 = θ₀ := by + dsimp [Θ] + have h0 : 0 < l.length := by omega + simp only [h0, ↓reduceIte, hu_idx_0, hΓ_R_0] + have hΘ_bd : ∀ i < l.length, Θ i < θ₀ + 2 * Real.pi := by + intro i hi + dsimp [Θ] + simp only [hi, ↓reduceIte] + exact (hΓ_mem_Ico (u_idx i) (hu_idx_mem i hi)).2 + have hΘ_val : ∀ (i : ℕ) (hi : i < l.length), (g_circ (Circle.exp (Θ i))).1 = l[i]'hi := by + intro i hi + dsimp [Θ] + simp only [hi, ↓reduceIte] + rw [hΓ_R_u_idx i hi] + exact hh_rel_val i hi + refine ⟨Θ, hΘ_mono, hΘ_0, hΘ_bd, hΘ_val, ?_⟩ + intro i hi θ hθ hval + have hΘ_mem : Θ i ∈ Ico θ₀ (θ₀ + 2 * Real.pi) := by + dsimp [Θ] + simp only [hi, ↓reduceIte] + exact hΓ_mem_Ico (u_idx i) (hu_idx_mem i hi) + have h_exp : Circle.exp (Θ i) = Circle.exp θ := by + apply g_circ.injective + apply Subtype.ext + rw [hΘ_val i hi, hval] + exact eq_of_circle_exp_eq_of_mem_Ico hΘ_mem hθ h_exp + · exfalso + have hΓ_anti : StrictAntiOn Γ_R (Icc 0 1) := by + intro x hx y hy hxy + have := hm_anti hx hy hxy + dsimp [m] at this + exact (div_lt_div_iff_of_pos_right hpi).mp this + have hΓ_gt_sub : ∀ u ∈ Ico (0 : ℝ) 1, θ₀ - 2 * Real.pi < Γ_R u := by + intro u hu + by_contra hle + push Not at hle + obtain ⟨v, hv_Icc, hv_eq⟩ := intermediate_value_Icc' hu.1 + (hΓ_R_cont.mono (Icc_subset_Icc_right hu.2.le)) + ⟨hle, by rw [hΓ_R_0]; linarith⟩ + have hv_Ico : v ∈ Ico (0 : ℝ) 1 := ⟨hv_Icc.1, hv_Icc.2.trans_lt hu.2⟩ + have hv_exp : Circle.exp (Γ_R v) = Circle.exp (Γ_R 0) := by + rw [hv_eq, hΓ_R_0, sub_eq_add_neg, Circle.exp_add, Circle.exp_neg, + Circle.exp_two_pi, inv_one, mul_one] + have hv0 : v = 0 := hΓ_R_inj_exp hv_Ico ⟨le_rfl, zero_lt_one⟩ hv_exp + subst hv0 + rw [hΓ_R_0] at hv_eq + linarith + have hΓ_mem_Ico : ∀ u ∈ Ioo (0 : ℝ) 1, + Γ_R u ∈ Ico (θ₀ - 2 * Real.pi) (θ₀ - 2 * Real.pi + 2 * Real.pi) := by + intro u hu + refine ⟨(hΓ_gt_sub u ⟨hu.1.le, hu.2⟩).le, ?_⟩ + rw [sub_add_cancel, ← hΓ_R_0] + exact hΓ_anti ⟨le_rfl, zero_le_one⟩ ⟨hu.1.le, hu.2.le⟩ hu.1 + have hu1_Ioo : u_idx 1 ∈ Ioo (0 : ℝ) 1 := + ⟨hu_idx_0 ▸ hu_idx_mono Nat.zero_lt_one, (hu_idx_mem 1 (by omega)).2⟩ + have hu2_Ioo : u_idx idx₂ ∈ Ioo (0 : ℝ) 1 := + ⟨hu_idx_0 ▸ hu_idx_mono (by omega), (hu_idx_mem idx₂ hidx₂).2⟩ + have hΓ_u1 : Γ_R (u_idx 1) = θ₁ - 2 * Real.pi := by + apply eq_of_circle_exp_eq_of_mem_Ico (hΓ_mem_Ico (u_idx 1) hu1_Ioo) + ⟨by linarith, by linarith⟩ + rw [hΓ_R_u_idx 1 (by omega), hh_rel_eq 1 (by omega) θ₁ hl1, + sub_eq_add_neg, Circle.exp_add, Circle.exp_neg, Circle.exp_two_pi, inv_one, mul_one] + have hΓ_u2 : Γ_R (u_idx idx₂) = θ₂ - 2 * Real.pi := by + apply eq_of_circle_exp_eq_of_mem_Ico (hΓ_mem_Ico (u_idx idx₂) hu2_Ioo) + ⟨by linarith, by linarith⟩ + rw [hΓ_R_u_idx idx₂ hidx₂, hh_rel_eq idx₂ hidx₂ θ₂ hl2, + sub_eq_add_neg, Circle.exp_add, Circle.exp_neg, Circle.exp_two_pi, inv_one, mul_one] + have hlt_anti : Γ_R (u_idx idx₂) < Γ_R (u_idx 1) := + hΓ_anti ⟨hu1_Ioo.1.le, hu1_Ioo.2.le⟩ ⟨hu2_Ioo.1.le, hu2_Ioo.2.le⟩ (hu_idx_mono hidx₁) + linarith + +end LiftOrder + +/-! ## 4. Angles, Vertical Chords, and Open Caps in `closedBall (0 : ℂ) 1` -/ + +section PlaneChordsAndCaps + +/-- Model angle `π * ((m + 1) / k)` for the `2k` vertices on `subBd Λ` in XV (3.4). -/ +noncomputable def parallelModelAngle (k m : ℕ) : ℝ := + Real.pi * ((m + 1 : ℝ) / (k : ℝ)) + +theorem strictMono_parallelModelAngle {k : ℕ} (hk : 1 ≤ k) : + StrictMono (parallelModelAngle k) := by + intro m₁ m₂ hm + unfold parallelModelAngle + have hk_pos : (0 : ℝ) < k := Nat.cast_pos.mpr hk + have hm_lt : (m₁ + 1 : ℝ) < (m₂ + 1 : ℝ) := by exact_mod_cast Nat.add_lt_add_right hm 1 + exact mul_lt_mul_of_pos_left (div_lt_div_of_pos_right hm_lt hk_pos) Real.pi_pos + +theorem parallelModelAngle_lt_add_two_pi {k : ℕ} (hk : 1 ≤ k) : + ∀ m < 2 * k, parallelModelAngle k m < parallelModelAngle k 0 + 2 * Real.pi := by + intro m hm + unfold parallelModelAngle + have hk_pos : (0 : ℝ) < k := Nat.cast_pos.mpr hk + have hm_le : (m + 1 : ℝ) ≤ 2 * (k : ℝ) := by exact_mod_cast hm + have hdiv : (m + 1 : ℝ) / (k : ℝ) ≤ 2 := (div_le_iff₀ hk_pos).mpr hm_le + have h0 : (0 : ℝ) < Real.pi * ((0 + 1 : ℝ) / (k : ℝ)) := by positivity + nlinarith [Real.pi_pos] + +theorem parallelModelAngle_mem_Ioo_pi {k : ℕ} {j : ℕ} (hj : j < k - 1) : + 0 < parallelModelAngle k j ∧ parallelModelAngle k j < Real.pi := by + have hk : 1 ≤ k := by omega + have hk_pos : (0 : ℝ) < k := Nat.cast_pos.mpr hk + unfold parallelModelAngle + refine ⟨by positivity, ?_⟩ + have hj_lt : (j + 1 : ℝ) < (k : ℝ) := by exact_mod_cast (by omega : j + 1 < k) + have hdiv : (j + 1 : ℝ) / (k : ℝ) < 1 := (div_lt_one hk_pos).mpr hj_lt + nlinarith [Real.pi_pos] + +theorem parallelModelAngle_partner {k : ℕ} {j : ℕ} (hj : j < k - 1) : + parallelModelAngle k (2 * k - 2 - j) = 2 * Real.pi - parallelModelAngle k j := by + have hk_ne : (k : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (by omega) + unfold parallelModelAngle + have hcast : ((2 * k - 2 - j : ℕ) : ℝ) + 1 = 2 * (k : ℝ) - ((j : ℝ) + 1) := by + have h1 : (2 * k - 2 - j) + 1 = 2 * k - (j + 1) := by omega + have h1' : ((2 * k - 2 - j : ℕ) : ℝ) + 1 = ((2 * k - (j + 1) : ℕ) : ℝ) := by + exact_mod_cast h1 + have h2 : j + 1 ≤ 2 * k := by omega + rw [h1', Nat.cast_sub h2] + push_cast + ring + rw [hcast, sub_div, mul_div_cancel_right₀ 2 hk_ne, mul_sub] + ring + +theorem parallelModelAngle_k_sub_one {k : ℕ} (hk : 1 ≤ k) : + parallelModelAngle k (k - 1) = Real.pi := by + have hk_ne : (k : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (by omega) + unfold parallelModelAngle + have hcast : ((k - 1 : ℕ) : ℝ) + 1 = (k : ℝ) := by exact_mod_cast Nat.sub_add_cancel hk + rw [hcast, div_self hk_ne, mul_one] + +theorem parallelModelAngle_two_k_sub_one {k : ℕ} (hk : 1 ≤ k) : + parallelModelAngle k (2 * k - 1) = 2 * Real.pi := by + have hk_ne : (k : ℝ) ≠ 0 := Nat.cast_ne_zero.mpr (by omega) + unfold parallelModelAngle + have hcast : ((2 * k - 1 : ℕ) : ℝ) + 1 = 2 * (k : ℝ) := by + exact_mod_cast Nat.sub_add_cancel (by omega : 1 ≤ 2 * k) + rw [hcast, mul_div_cancel_right₀ 2 hk_ne] + ring + +/-- Horizontal coordinate `x_j = cos(π(j+1)/k)` of the `j`-th vertical chord. -/ +noncomputable def parallelX (k : ℕ) (j : Fin (k - 1)) : ℝ := + Real.cos (parallelModelAngle k j.1) + +/-- Vertical half-height `y_j = sin(π(j+1)/k)` of the `j`-th vertical chord. -/ +noncomputable def parallelY (k : ℕ) (j : Fin (k - 1)) : ℝ := + Real.sin (parallelModelAngle k j.1) + +theorem parallelY_pos {k : ℕ} (j : Fin (k - 1)) : 0 < parallelY k j := by + obtain ⟨h0, hpi⟩ := parallelModelAngle_mem_Ioo_pi j.2 + exact Real.sin_pos_of_pos_of_lt_pi h0 hpi + +theorem parallelX_sq_add_parallelY_sq {k : ℕ} (j : Fin (k - 1)) : + parallelX k j ^ 2 + parallelY k j ^ 2 = 1 := + Real.cos_sq_add_sin_sq (parallelModelAngle k j.1) + +theorem parallelX_mem_Ioo {k : ℕ} (j : Fin (k - 1)) : + -1 < parallelX k j ∧ parallelX k j < 1 := by + have hy : 0 < parallelY k j := parallelY_pos j + have hsq : parallelX k j ^ 2 < 1 := by + nlinarith [parallelX_sq_add_parallelY_sq j] + exact ⟨by nlinarith, by nlinarith⟩ + +theorem strictAnti_parallelX {k : ℕ} (hk : 1 ≤ k) : + StrictAnti (parallelX k) := by + intro j₁ j₂ hj + obtain ⟨h0₁, hpi₁⟩ := parallelModelAngle_mem_Ioo_pi j₁.2 + obtain ⟨h0₂, hpi₂⟩ := parallelModelAngle_mem_Ioo_pi j₂.2 + exact Real.strictAntiOn_cos ⟨h0₁.le, hpi₁.le⟩ ⟨h0₂.le, hpi₂.le⟩ + (strictMono_parallelModelAngle hk hj) + +theorem circle_exp_coe_eq_mk (θ : ℝ) : + (Circle.exp θ : ℂ) = ⟨Real.cos θ, Real.sin θ⟩ := by + apply Complex.ext + · simp [Circle.coe_exp, Complex.exp_ofReal_mul_I_re] + · simp [Circle.coe_exp, Complex.exp_ofReal_mul_I_im] + +theorem circle_exp_parallelModelAngle_top {k : ℕ} (j : Fin (k - 1)) : + (Circle.exp (parallelModelAngle k j.1) : ℂ) = ⟨parallelX k j, parallelY k j⟩ := + circle_exp_coe_eq_mk (parallelModelAngle k j.1) + +theorem circle_exp_parallelModelAngle_bot {k : ℕ} (j : Fin (k - 1)) : + (Circle.exp (parallelModelAngle k (2 * k - 2 - j.1)) : ℂ) = + ⟨parallelX k j, -parallelY k j⟩ := by + rw [parallelModelAngle_partner j.2, circle_exp_coe_eq_mk] + unfold parallelX parallelY + have hsub : 2 * Real.pi - parallelModelAngle k j.1 = + -(parallelModelAngle k j.1 - 2 * Real.pi) := by ring + congr 1 + · rw [hsub, Real.cos_neg, Real.cos_sub_two_pi] + · rw [hsub, Real.sin_neg, Real.sin_sub_two_pi] + +theorem circle_exp_parallelModelAngle_k_sub_one {k : ℕ} (hk : 1 ≤ k) : + (Circle.exp (parallelModelAngle k (k - 1)) : ℂ) = ⟨-1, 0⟩ := by + rw [parallelModelAngle_k_sub_one hk, circle_exp_coe_eq_mk, Real.cos_pi, Real.sin_pi] + +theorem circle_exp_parallelModelAngle_two_k_sub_one {k : ℕ} (hk : 1 ≤ k) : + (Circle.exp (parallelModelAngle k (2 * k - 1)) : ℂ) = ⟨1, 0⟩ := by + rw [parallelModelAngle_two_k_sub_one hk, circle_exp_coe_eq_mk, Real.cos_two_pi, Real.sin_two_pi] + +theorem mem_closedBall_unit_iff (z : ℂ) : + z ∈ closedBall (0 : ℂ) 1 ↔ z.re ^ 2 + z.im ^ 2 ≤ 1 := by + rw [mem_closedBall_zero_iff] + have h1 : ‖z‖ ≤ 1 ↔ ‖z‖ ^ 2 ≤ 1 := by + constructor + · intro h; nlinarith [norm_nonneg z] + · intro h; nlinarith [norm_nonneg z] + rw [h1, Complex.sq_norm, Complex.normSq_apply] + ring_nf + +theorem mem_ball_unit_iff (z : ℂ) : + z ∈ ball (0 : ℂ) 1 ↔ z.re ^ 2 + z.im ^ 2 < 1 := by + rw [mem_ball_zero_iff] + have h1 : ‖z‖ < 1 ↔ ‖z‖ ^ 2 < 1 := by + constructor + · intro h; nlinarith [norm_nonneg z] + · intro h; nlinarith [norm_nonneg z] + rw [h1, Complex.sq_norm, Complex.normSq_apply] + ring_nf + +theorem mem_sphere_unit_iff (z : ℂ) : + z ∈ sphere (0 : ℂ) 1 ↔ z.re ^ 2 + z.im ^ 2 = 1 := by + rw [mem_sphere_zero_iff_norm] + have h1 : ‖z‖ = 1 ↔ ‖z‖ ^ 2 = 1 := by + constructor + · intro h; rw [h]; ring + · intro h; nlinarith [norm_nonneg z] + rw [h1, Complex.sq_norm, Complex.normSq_apply] + ring_nf + +/-- Vertical chord `{z ∈ closedBall 0 1 | z.re = r}` in the closed unit disc of `ℂ`. -/ +def vertChord (r : ℝ) : Set ℂ := + {z ∈ closedBall (0 : ℂ) 1 | z.re = r} + +/-- Linear parametrization `t ↦ ⟨r, (1 - 2t)y⟩` of `vertChord r` from `⟨r, y⟩` to `⟨r, -y⟩`. -/ +def vertChordMap (r y : ℝ) (t : unitInterval) : ℂ := + ⟨r, (1 - 2 * (t : ℝ)) * y⟩ + +theorem continuous_vertChordMap (r y : ℝ) : Continuous (vertChordMap r y) := by + have h_eq : vertChordMap r y = fun t : unitInterval => (r : ℂ) + (((1 - 2 * + (t : ℝ)) * y : ℝ) : ℂ) * Complex.I := by + ext t + apply Complex.ext <;> simp [vertChordMap] + rw [h_eq] + fun_prop + +theorem injective_vertChordMap {r y : ℝ} (hy : 0 < y) : + Function.Injective (vertChordMap r y) := by + intro t₁ t₂ h + have him : (vertChordMap r y t₁).im = (vertChordMap r y t₂).im := congrArg Complex.im h + dsimp [vertChordMap] at him + apply Subtype.ext + nlinarith + +theorem range_vertChordMap {r y : ℝ} (hry : r ^ 2 + y ^ 2 = 1) (hy : 0 < y) : + range (vertChordMap r y) = vertChord r := by + ext z + simp only [mem_range, vertChord, mem_ofPred_eq, mem_closedBall_unit_iff] + constructor + · rintro ⟨t, rfl⟩ + dsimp [vertChordMap] + refine ⟨?_, rfl⟩ + have ht0 : 0 ≤ (t : ℝ) := t.2.1 + have ht1 : (t : ℝ) ≤ 1 := t.2.2 + have h_abs : (1 - 2 * (t : ℝ)) ^ 2 ≤ 1 := by nlinarith + nlinarith + · rintro ⟨h_le, rfl⟩ + have him_sq : z.im ^ 2 ≤ y ^ 2 := by linarith + have him_bounds : -y ≤ z.im ∧ z.im ≤ y := by + constructor <;> nlinarith + let s : ℝ := (1 - z.im / y) / 2 + have hs_mem : s ∈ Icc (0 : ℝ) 1 := by + dsimp [s] + have h1 : -1 ≤ z.im / y := (le_div_iff₀ hy).mpr (by linarith) + have h2 : z.im / y ≤ 1 := (div_le_iff₀ hy).mpr (by linarith) + exact ⟨by linarith, by linarith⟩ + refine ⟨⟨s, hs_mem⟩, ?_⟩ + apply Complex.ext + · rfl + · dsimp [vertChordMap, s] + have hy_ne : y ≠ 0 := ne_of_gt hy + field_simp + ring + +theorem vertChord_inter_sphere {r y : ℝ} (hry : r ^ 2 + y ^ 2 = 1) : + vertChord r ∩ sphere (0 : ℂ) 1 = {⟨r, y⟩, ⟨r, -y⟩} := by + ext z + simp only [mem_inter_iff, vertChord, mem_ofPred_eq, mem_closedBall_unit_iff, + mem_sphere_unit_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨⟨_, rfl⟩, h_eq⟩ + have him_sq : z.im ^ 2 = y ^ 2 := by linarith + rcases sq_eq_sq_iff_eq_or_eq_neg.mp him_sq with him | him + · left; exact Complex.ext rfl him + · right; exact Complex.ext rfl him + · rintro (rfl | rfl) + · exact ⟨⟨by linarith, rfl⟩, by linarith⟩ + · exact ⟨⟨by linarith, rfl⟩, by linarith⟩ + +theorem vertChord_disjoint {r₁ r₂ : ℝ} (hne : r₁ ≠ r₂) : + Disjoint (vertChord r₁) (vertChord r₂) := + Set.disjoint_left.mpr fun _ hz₁ hz₂ => hne (hz₁.2.symm.trans hz₂.2) + +/-- Image of `vertChord r` under a disc chart `c : IsChart Δ h g` is a line with ends +`g ⟨r, y⟩` and `g ⟨r, -y⟩` meeting `discBd Δ` only at its ends. -/ +theorem isLineWithEnds_image_vertChord {S : Type w} [TopologicalSpace S] [T2Space S] + {Δ : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart Δ h g) + {r y : ℝ} (hry : r ^ 2 + y ^ 2 = 1) (hy : 0 < y) : + IsLineWithEnds (g '' vertChord r) (g ⟨r, y⟩) (g ⟨r, -y⟩) ∧ + g '' vertChord r ⊆ Δ ∧ + (g '' vertChord r) ∩ discBd Δ = {g ⟨r, y⟩, g ⟨r, -y⟩} := by + have hsub_cb : vertChord r ⊆ closedBall (0 : ℂ) 1 := fun _ hz => hz.1 + have hmap_cb : ∀ t : unitInterval, vertChordMap r y t ∈ closedBall (0 : ℂ) 1 := by + intro t + apply hsub_cb + rw [← range_vertChordMap hry hy] + exact ⟨t, rfl⟩ + let γ : unitInterval → S := fun t => g (vertChordMap r y t) + have hγ_cont : Continuous γ := + c.gc.comp_continuous (continuous_vertChordMap r y) hmap_cb + have hγ_inj : Function.Injective γ := by + intro t₁ t₂ heq + exact injective_vertChordMap hy (c.injOn (hmap_cb t₁) (hmap_cb t₂) heq) + have hγ_range : range γ = g '' vertChord r := by + rw [← range_vertChordMap hry hy, ← range_comp] + rfl + have hγ0 : γ 0 = g ⟨r, y⟩ := by + change g (vertChordMap r y 0) = g ⟨r, y⟩ + congr 1 + apply Complex.ext <;> simp [vertChordMap] + have hγ1 : γ 1 = g ⟨r, -y⟩ := by + change g (vertChordMap r y 1) = g ⟨r, -y⟩ + congr 1 + apply Complex.ext <;> simp [vertChordMap] + ring + have hLine : IsLineWithEnds (g '' vertChord r) (g ⟨r, y⟩) (g ⟨r, -y⟩) := by + rw [← hγ_range, ← hγ0, ← hγ1] + exact GM11.isLine_range hγ_cont hγ_inj + have hinter : (g '' vertChord r) ∩ discBd Δ = {g ⟨r, y⟩, g ⟨r, -y⟩} := by + rw [← c.g_sphere, ← c.g_inter hsub_cb sphere_subset_closedBall, + vertChord_inter_sphere hry, image_pair] + exact ⟨hLine, c.g_subset hsub_cb, hinter⟩ + +/-! ## 5. Open and Closed Caps, Boundary O-Arcs, and Pinched Vertical Homeomorphism -/ + +/-- If `C : Drawing S` has `C.U = range a ∪ range b` for two arcs `a, b : unitInterval → S` with +common +endpoints meeting only at `{0, 1}`, then `IsOArc C.U`, and for any `s₁ < s₂ < s₃ < s₄` in +`unitInterval`, `OccurInCircuitOrder C (a s₁) (a s₂) (a s₃) (a s₄)`. -/ +theorem oArc_and_occurInCircuitOrder_of_two_arcs {S : Type w} [TopologicalSpace S] [T2Space S] + {a b : unitInterval → S} (ha : IsArcMap a) (hb : IsArcMap b) + (h0 : a 0 = b 0) (h1 : a 1 = b 1) + (h01 : ∀ s t, a s = b t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) : + IsOArc (range a ∪ range b) ∧ + ∀ {C : Drawing S}, C.U = range a ∪ range b → + ∀ {s₁ s₂ s₃ s₄ : unitInterval}, + s₁ < s₂ → s₂ < s₃ → s₃ < s₄ → + OccurInCircuitOrder C (a s₁) (a s₂) (a s₃) (a s₄) := by + classical + have hbd : ∀ w : Circle, |(w : ℂ).re| ≤ 1 := fun w => by + have := Complex.abs_re_le_norm (w : ℂ) + rwa [Circle.norm_coe] at this + let τ : Circle → unitInterval := fun w => ⟨(1 - (w : ℂ).re) / 2, by + have := abs_le.mp (hbd w) + constructor <;> linarith [this.1, this.2]⟩ + have hτ : Continuous τ := by + refine Continuous.subtype_mk ?_ _ + have : Continuous fun w : Circle => (w : ℂ) := continuous_subtype_val + exact ((continuous_const.sub (Complex.continuous_re.comp this)).div_const 2) + let g_loop : Circle → S := fun w => if 0 ≤ (w : ℂ).im then a (τ w) else b (τ w) + have him : Continuous fun w : Circle => (w : ℂ).im := + Complex.continuous_im.comp continuous_subtype_val + have hsq : ∀ w : Circle, (w : ℂ).re * (w : ℂ).re + (w : ℂ).im * (w : ℂ).im = 1 := fun w => by + have h := Complex.sq_norm (w : ℂ) + rw [Circle.norm_coe, Complex.normSq_apply] at h + linarith + have hτ0 : ∀ w : Circle, (w : ℂ).im = 0 → τ w = 0 ∨ τ w = 1 := by + intro w hw + have h := hsq w + rw [hw] at h + have hfac : ((w : ℂ).re - 1) * ((w : ℂ).re + 1) = 0 := by linarith + rcases mul_eq_zero.mp hfac with h_eq | h_eq + · left + refine Subtype.ext ?_ + change (1 - (w : ℂ).re) / 2 = 0 + rw [sub_eq_zero.mp h_eq] + norm_num + · right + refine Subtype.ext ?_ + change (1 - (w : ℂ).re) / 2 = 1 + rw [eq_neg_of_add_eq_zero_left h_eq] + norm_num + have hg_cont : Continuous g_loop := by + refine Continuous.if_le (ha.1.comp hτ) (hb.1.comp hτ) continuous_const him ?_ + intro w hw + rcases hτ0 w hw.symm with h_eq | h_eq + · simp only [h_eq, h0] + · simp only [h_eq, h1] + have hre : ∀ {w w' : Circle}, τ w = τ w' → (w : ℂ).re = (w' : ℂ).re := fun {w w'} h => by + have : (1 - (w : ℂ).re) / 2 = (1 - (w' : ℂ).re) / 2 := congrArg Subtype.val h + linarith + have hsame : ∀ {w w' : Circle}, τ w = τ w' → 0 ≤ (w : ℂ).im → 0 ≤ (w' : ℂ).im → w = w' := by + intro w w' h h_im1 h_im2 + have h3 := hre h + have h4 := hsq w + have h5 := hsq w' + rw [h3] at h4 + have h6 : (w : ℂ).im = (w' : ℂ).im := by nlinarith [mul_self_nonneg ((w : ℂ).im - (w' : ℂ).im)] + exact Circle.ext (Complex.ext h3 h6) + have hsameneg : ∀ {w w' : Circle}, τ w = τ w' → (w : ℂ).im < 0 → (w' : ℂ).im < 0 → w = w' := by + intro w w' h h_im1 h_im2 + have h3 := hre h + have h4 := hsq w + have h5 := hsq w' + rw [h3] at h4 + have h6 : (w : ℂ).im = (w' : ℂ).im := by nlinarith [mul_self_nonneg ((w : ℂ).im - (w' : ℂ).im)] + exact Circle.ext (Complex.ext h3 h6) + have him0 : ∀ {w : Circle}, τ w = 0 ∨ τ w = 1 → (w : ℂ).im = 0 := by + intro w h + have h4 := hsq w + have hre1 : (w : ℂ).re = 1 ∨ (w : ℂ).re = -1 := by + rcases h with h | h + · left; have : (1 - (w : ℂ).re) / 2 = 0 := congrArg Subtype.val h; linarith + · right; have : (1 - (w : ℂ).re) / 2 = 1 := congrArg Subtype.val h; linarith + rcases hre1 with h_eq | h_eq <;> rw [h_eq] at h4 <;> nlinarith [mul_self_nonneg (w : ℂ).im] + have hmixed : ∀ {w w' : Circle}, 0 ≤ (w : ℂ).im → (w' : ℂ).im < 0 → a (τ w) = b (τ w') → False + := by + intro w w' h_im1 h_im2 h + rcases h01 _ _ h with ⟨_, h3⟩ | ⟨_, h3⟩ + · exact absurd (him0 (Or.inl h3)) h_im2.ne + · exact absurd (him0 (Or.inr h3)) h_im2.ne + have hg_inj : Function.Injective g_loop := by + intro w w' h + simp only [g_loop] at h + split_ifs at h with h_im1 h_im2 h_im2 + · exact hsame (ha.2 h) h_im1 h_im2 + · exact (hmixed h_im1 (not_le.mp h_im2) h).elim + · exact (hmixed h_im2 (not_le.mp h_im1) h.symm).elim + · exact hsameneg (hb.2 h) (not_le.mp h_im1) (not_le.mp h_im2) + have hg_range : range g_loop = range a ∪ range b := by + ext x + constructor + · rintro ⟨w, rfl⟩ + simp only [g_loop] + split_ifs + · exact Or.inl ⟨τ w, rfl⟩ + · exact Or.inr ⟨τ w, rfl⟩ + · rintro (⟨t, rfl⟩ | ⟨t, rfl⟩) + · have ht : |(1 - 2 * (t : ℝ))| ≤ 1 := abs_le.mpr ⟨by linarith [t.2.2], by linarith [t.2.1]⟩ + let y := Real.sqrt (1 - (1 - 2 * (t : ℝ)) ^ 2) + have hy : 0 ≤ y := Real.sqrt_nonneg _ + have hsq' : (1 - 2 * (t : ℝ)) ^ 2 + y ^ 2 = 1 := by + have : 0 ≤ 1 - (1 - 2 * (t : ℝ)) ^ 2 := by nlinarith [t.2.1, t.2.2] + rw [Real.sq_sqrt this]; ring + let w : Circle := ⟨⟨1 - 2 * (t : ℝ), y⟩, by + change (⟨1 - 2 * (t : ℝ), y⟩ : ℂ) ∈ sphere (0 : ℂ) 1 + rw [mem_sphere_unit_iff] + exact hsq'⟩ + have hτw : τ w = t := by apply Subtype.ext; change (1 - (1 - 2 * (t : ℝ))) / 2 = t; ring + refine ⟨w, ?_⟩ + change (if 0 ≤ y then a (τ w) else b (τ w)) = a t + split_ifs + rw [hτw] + · by_cases ht01 : t = 0 ∨ t = 1 + · rcases ht01 with rfl | rfl + · refine ⟨1, ?_⟩ + have hτ1 : τ 1 = 0 := by apply Subtype.ext; simp [τ] + have him1 : (0 : ℝ) ≤ ((1 : Circle) : ℂ).im := by simp + change (if 0 ≤ ((1 : Circle) : ℂ).im then a (τ 1) else b (τ 1)) = b 0 + split_ifs + rw [hτ1, h0] + · refine ⟨-1, ?_⟩ + have hτ1 : τ (-1) = 1 := by apply Subtype.ext; simp [τ] + have him1 : (0 : ℝ) ≤ ((-1 : Circle) : ℂ).im := by simp + change (if 0 ≤ ((-1 : Circle) : ℂ).im then a (τ (-1)) else b (τ (-1))) = b 1 + split_ifs + rw [hτ1, h1] + · push Not at ht01 + have ht0 : 0 < (t : ℝ) := lt_of_le_of_ne t.2.1 (fun h => ht01.1 (Subtype.ext h.symm)) + have ht1 : (t : ℝ) < 1 := lt_of_le_of_ne t.2.2 (fun h => ht01.2 (Subtype.ext h)) + have hpos : 0 < 1 - (1 - 2 * (t : ℝ)) ^ 2 := by nlinarith + let y := -Real.sqrt (1 - (1 - 2 * (t : ℝ)) ^ 2) + have hy : y < 0 := neg_lt_zero.mpr (Real.sqrt_pos.mpr hpos) + have hsq' : (1 - 2 * (t : ℝ)) ^ 2 + y ^ 2 = 1 := by + dsimp [y]; rw [neg_sq, Real.sq_sqrt hpos.le]; ring + let w : Circle := ⟨⟨1 - 2 * (t : ℝ), y⟩, by + change (⟨1 - 2 * (t : ℝ), y⟩ : ℂ) ∈ sphere (0 : ℂ) 1 + rw [mem_sphere_unit_iff] + exact hsq'⟩ + have hτw : τ w = t := by apply Subtype.ext; change (1 - (1 - 2 * (t : ℝ))) / 2 = t; ring + refine ⟨w, ?_⟩ + change (if 0 ≤ y then a (τ w) else b (τ w)) = b t + split_ifs with h_if + · exact (not_le.mpr hy h_if).elim + · rw [hτw] + have hEmb : IsEmbedding g_loop := hg_cont.isClosedEmbedding hg_inj |>.isEmbedding + have hOArc : IsOArc (range a ∪ range b) := + ⟨hEmb.toHomeomorph.trans (Homeomorph.setCongr hg_range)⟩ + refine ⟨hOArc, fun {C} hCU {s₁ s₂ s₃ s₄} hs12 hs23 hs34 => ?_⟩ + let φ : Circle ≃ₜ C.U := + hEmb.toHomeomorph.trans (Homeomorph.setCongr (hg_range.trans hCU.symm)) + have hφ_coe : ∀ w : Circle, (φ w).1 = g_loop w := fun _ => rfl + let ang : unitInterval → ℝ := fun s => Real.arccos (1 - 2 * (s : ℝ)) + have hang_mem_Icc : ∀ s : unitInterval, 1 - 2 * (s : ℝ) ∈ Icc (-1 : ℝ) 1 := fun s => + ⟨by linarith [s.2.2], by linarith [s.2.1]⟩ + have hang_bounds : ∀ s : unitInterval, 0 ≤ ang s ∧ ang s ≤ Real.pi := fun s => + ⟨Real.arccos_nonneg _, Real.arccos_le_pi _⟩ + have hang_mono : StrictMono ang := by + intro u₁ u₂ hu + have hlt : 1 - 2 * (u₂ : ℝ) < 1 - 2 * (u₁ : ℝ) := by + have : (u₁ : ℝ) < (u₂ : ℝ) := hu + linarith + exact Real.strictAntiOn_arccos (hang_mem_Icc u₂) (hang_mem_Icc u₁) hlt + have hφ_ang : ∀ s : unitInterval, (φ (Circle.exp (ang s))).1 = a s := by + intro s + rw [hφ_coe] + change (if 0 ≤ (Circle.exp (ang s) : ℂ).im then a (τ (Circle.exp (ang s))) + else b (τ (Circle.exp (ang s)))) = a s + have him_nonneg : 0 ≤ (Circle.exp (ang s) : ℂ).im := by + rw [circle_exp_coe_eq_mk] + exact Real.sin_nonneg_of_mem_Icc (hang_bounds s) + split_ifs + congr 1 + apply Subtype.ext + change (1 - (Circle.exp (ang s) : ℂ).re) / 2 = (s : ℝ) + rw [circle_exp_coe_eq_mk] + dsimp [ang] + rw [Real.cos_arccos (hang_mem_Icc s).1 (hang_mem_Icc s).2] + ring + refine ⟨φ, ang s₁, ang s₂, ang s₃, ang s₄, (hang_bounds s₁).1, + hang_mono hs12, hang_mono hs23, hang_mono hs34, ?_, + hφ_ang s₁, hφ_ang s₂, hφ_ang s₃, hφ_ang s₄⟩ + linarith [(hang_bounds s₄).2, Real.pi_pos] + +/-- Left open cap `{z ∈ ball 0 1 | z.re < r}` in the unit disc. -/ +def leftOpenCap (r : ℝ) : Set ℂ := + {z ∈ ball (0 : ℂ) 1 | z.re < r} + +/-- Right open cap `{z ∈ ball 0 1 | r < z.re}` in the unit disc. -/ +def rightOpenCap (r : ℝ) : Set ℂ := + {z ∈ ball (0 : ℂ) 1 | r < z.re} + +/-- Left closed cap `{z ∈ closedBall 0 1 | z.re ≤ r}` in the unit disc. -/ +def leftClosedCap (r : ℝ) : Set ℂ := + {z ∈ closedBall (0 : ℂ) 1 | z.re ≤ r} + +/-- Right closed cap `{z ∈ closedBall 0 1 | r ≤ z.re}` in the unit disc. -/ +def rightClosedCap (r : ℝ) : Set ℂ := + {z ∈ closedBall (0 : ℂ) 1 | r ≤ z.re} + +/-- Left circular boundary arc `{z ∈ sphere 0 1 | z.re ≤ r}`. -/ +def leftSphereArc (r : ℝ) : Set ℂ := + {z ∈ sphere (0 : ℂ) 1 | z.re ≤ r} + +/-- Right circular boundary arc `{z ∈ sphere 0 1 | r ≤ z.re}`. -/ +def rightSphereArc (r : ℝ) : Set ℂ := + {z ∈ sphere (0 : ℂ) 1 | r ≤ z.re} + +private noncomputable def capNeg : ℂ ≃ₜ ℂ := (ContinuousLinearEquiv.neg ℝ : ℂ ≃L[ℝ] ℂ).toHomeomorph + +private theorem preimage_neg_leftOpenCap (r : ℝ) : + capNeg ⁻¹' leftOpenCap (-r) = rightOpenCap r := by + ext z + change -z ∈ leftOpenCap (-r) ↔ z ∈ rightOpenCap r + simp [leftOpenCap, rightOpenCap] + +private theorem preimage_neg_leftClosedCap (r : ℝ) : + capNeg ⁻¹' leftClosedCap (-r) = rightClosedCap r := by + ext z + change -z ∈ leftClosedCap (-r) ↔ z ∈ rightClosedCap r + simp [leftClosedCap, rightClosedCap] + +private theorem preimage_neg_leftSphereArc (r : ℝ) : + capNeg ⁻¹' leftSphereArc (-r) = rightSphereArc r := by + ext z + change -z ∈ leftSphereArc (-r) ↔ z ∈ rightSphereArc r + simp [leftSphereArc, rightSphereArc] + +private theorem preimage_neg_vertChord (r : ℝ) : + capNeg ⁻¹' vertChord (-r) = vertChord r := by + ext z + change -z ∈ vertChord (-r) ↔ z ∈ vertChord r + simp [vertChord] + +theorem isOpen_leftOpenCap (r : ℝ) : IsOpen (leftOpenCap r) := + isOpen_ball.inter (isOpen_lt Complex.continuous_re continuous_const) + +theorem isOpen_rightOpenCap (r : ℝ) : IsOpen (rightOpenCap r) := + isOpen_ball.inter (isOpen_lt continuous_const Complex.continuous_re) + +theorem isClosed_leftClosedCap (r : ℝ) : IsClosed (leftClosedCap r) := + isClosed_closedBall.inter (isClosed_le Complex.continuous_re continuous_const) + +theorem isClosed_rightClosedCap (r : ℝ) : IsClosed (rightClosedCap r) := + isClosed_closedBall.inter (isClosed_le continuous_const Complex.continuous_re) + +theorem convex_leftOpenCap (r : ℝ) : Convex ℝ (leftOpenCap r) := + (convex_ball (0 : ℂ) 1).inter (convex_halfSpace_re_lt r) + +theorem convex_rightOpenCap (r : ℝ) : Convex ℝ (rightOpenCap r) := + (convex_ball (0 : ℂ) 1).inter (convex_halfSpace_re_gt r) + +theorem convex_leftClosedCap (r : ℝ) : Convex ℝ (leftClosedCap r) := + (convex_closedBall (0 : ℂ) 1).inter (convex_halfSpace_re_le r) + +theorem convex_rightClosedCap (r : ℝ) : Convex ℝ (rightClosedCap r) := + (convex_closedBall (0 : ℂ) 1).inter (convex_halfSpace_re_ge r) + +theorem leftOpenCap_nonempty {r : ℝ} (hr : -1 < r) (hr1 : r < 1) : + (leftOpenCap r).Nonempty := by + refine ⟨⟨(r - 1) / 2, 0⟩, ?_, by dsimp; linarith⟩ + rw [mem_ball_unit_iff] + dsimp + nlinarith + +theorem rightOpenCap_nonempty {r : ℝ} (hr : -1 < r) (hr1 : r < 1) : + (rightOpenCap r).Nonempty := by + obtain ⟨z, hz⟩ := leftOpenCap_nonempty (r := -r) (by linarith) (by linarith) + refine ⟨-z, ?_⟩ + rw [← preimage_neg_leftOpenCap] + change -(-z) ∈ leftOpenCap (-r) + simpa only [neg_neg] using hz + +theorem closure_leftOpenCap {r : ℝ} (hr : -1 < r) (hr1 : r < 1) : + closure (leftOpenCap r) = leftClosedCap r := by + refine Subset.antisymm (closure_minimal ?_ (isClosed_leftClosedCap r)) ?_ + · intro z hz + exact ⟨ball_subset_closedBall hz.1, hz.2.le⟩ + · intro z hz + let z₀ : ℂ := ⟨(r - 1) / 2, 0⟩ + have hz₀ : z₀ ∈ leftOpenCap r := by + refine ⟨?_, by dsimp [z₀]; linarith⟩ + rw [mem_ball_unit_iff]; dsimp [z₀]; nlinarith + rw [_root_.mem_closure_iff] + intro U hU hzU + have hcont : Continuous (fun t : ℝ => (1 - t) • z + t • z₀) := by fun_prop + have h0 : (1 - (0 : ℝ)) • z + (0 : ℝ) • z₀ ∈ U := by simpa using hzU + obtain ⟨δ, hδ_pos, hδU⟩ := Metric.isOpen_iff.mp (hU.preimage hcont) 0 h0 + let t : ℝ := min (δ / 2) (1 / 2) + have ht_pos : 0 < t := lt_min (by linarith) (by norm_num) + have ht_lt1 : t < 1 := lt_of_le_of_lt (min_le_right _ _) (by norm_num) + have ht_ball : t ∈ ball (0 : ℝ) δ := by + rw [mem_ball_zero_iff, Real.norm_of_nonneg ht_pos.le] + exact lt_of_le_of_lt (min_le_left _ _) (by linarith) + refine ⟨(1 - t) • z + t • z₀, hδU ht_ball, ?_⟩ + refine ⟨?_, ?_⟩ + · rw [mem_ball_zero_iff] + have hz_norm : ‖z‖ ≤ 1 := mem_closedBall_zero_iff.mp hz.1 + have hz₀_norm : ‖z₀‖ < 1 := mem_ball_zero_iff.mp hz₀.1 + calc ‖(1 - t) • z + t • z₀‖ + ≤ ‖(1 - t) • z‖ + ‖t • z₀‖ := norm_add_le _ _ + _ = (1 - t) * ‖z‖ + t * ‖z₀‖ := by + rw [norm_smul, norm_smul, Real.norm_of_nonneg (by linarith), + Real.norm_of_nonneg ht_pos.le] + _ < (1 - t) * 1 + t * 1 := by nlinarith + _ = 1 := by ring + · show ((1 - t) • z + t • z₀).re < r + simp only [Complex.add_re, Complex.real_smul, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero] + have hz_re : z.re ≤ r := hz.2 + have hz₀_re : z₀.re < r := hz₀.2 + nlinarith + +theorem closure_rightOpenCap {r : ℝ} (hr : -1 < r) (hr1 : r < 1) : + closure (rightOpenCap r) = rightClosedCap r := by + rw [← preimage_neg_leftOpenCap, ← capNeg.preimage_closure, + closure_leftOpenCap (r := -r) (by linarith) (by linarith), preimage_neg_leftClosedCap] + +theorem leftClosedCap_sdiff_leftOpenCap (r : ℝ) : + leftClosedCap r \ leftOpenCap r = leftSphereArc r ∪ vertChord r := by + ext z + simp only [leftClosedCap, leftOpenCap, leftSphereArc, vertChord, mem_sdiff, mem_union, + mem_ofPred_eq, mem_closedBall_zero_iff, mem_ball_zero_iff, mem_sphere_zero_iff_norm] + constructor + · rintro ⟨⟨h1, h2⟩, hnot⟩ + by_cases h_eq1 : ‖z‖ = 1 + · exact Or.inl ⟨h_eq1, h2⟩ + · have hlt1 : ‖z‖ < 1 := lt_of_le_of_ne h1 h_eq1 + have h_ge : r ≤ z.re := not_lt.mp (fun hlt => hnot ⟨hlt1, hlt⟩) + exact Or.inr ⟨h1, le_antisymm h2 h_ge⟩ + · rintro (⟨h1, h2⟩ | ⟨h1, rfl⟩) + · exact ⟨⟨h1.le, h2⟩, fun ⟨hlt, _⟩ => hlt.ne h1⟩ + · exact ⟨⟨h1, le_rfl⟩, fun ⟨_, hlt⟩ => hlt.ne rfl⟩ + +theorem rightClosedCap_sdiff_rightOpenCap (r : ℝ) : + rightClosedCap r \ rightOpenCap r = rightSphereArc r ∪ vertChord r := by + rw [← preimage_neg_leftClosedCap, ← preimage_neg_leftOpenCap, ← preimage_sdiff, + leftClosedCap_sdiff_leftOpenCap, preimage_union, preimage_neg_leftSphereArc, + preimage_neg_vertChord] + +/-- Angular parametrization of the left circular arc `leftSphereArc (cos θ₀)` for `θ₀ ∈ (0, π)`. -/ +noncomputable def leftSphereArcMap (θ₀ : ℝ) (s : unitInterval) : ℂ := + (Circle.exp (θ₀ + (2 * Real.pi - 2 * θ₀) * (s : ℝ)) : ℂ) + +/-- Angular parametrization of the right circular arc `rightSphereArc (cos θ₀)` for `θ₀ ∈ (0, π)`. +-/ +noncomputable def rightSphereArcMap (θ₀ : ℝ) (s : unitInterval) : ℂ := + (Circle.exp ((2 * Real.pi - θ₀) + 2 * θ₀ * (s : ℝ)) : ℂ) + +theorem isArcMap_leftSphereArcMap {θ₀ : ℝ} (h0 : 0 < θ₀) (hpi : θ₀ < Real.pi) : + IsArcMap (leftSphereArcMap θ₀) := by + refine ⟨?_, ?_⟩ + · unfold leftSphereArcMap + exact continuous_subtype_val.comp (Circle.exp.continuous.comp (by fun_prop)) + · intro s₁ s₂ h + have h_exp : Circle.exp (θ₀ + (2 * Real.pi - 2 * θ₀) * (s₁ : ℝ)) = + Circle.exp (θ₀ + (2 * Real.pi - 2 * θ₀) * (s₂ : ℝ)) := + Subtype.ext h + have hs1 : θ₀ + (2 * Real.pi - 2 * θ₀) * (s₁ : ℝ) ∈ Ico θ₀ (θ₀ + 2 * Real.pi) := + ⟨by nlinarith [s₁.2.1], by nlinarith [s₁.2.2]⟩ + have hs2 : θ₀ + (2 * Real.pi - 2 * θ₀) * (s₂ : ℝ) ∈ Ico θ₀ (θ₀ + 2 * Real.pi) := + ⟨by nlinarith [s₂.2.1], by nlinarith [s₂.2.2]⟩ + have heq := eq_of_circle_exp_eq_of_mem_Ico hs1 hs2 h_exp + apply Subtype.ext + nlinarith + +theorem isArcMap_rightSphereArcMap {θ₀ : ℝ} (h0 : 0 < θ₀) (hpi : θ₀ < Real.pi) : + IsArcMap (rightSphereArcMap θ₀) := by + refine ⟨?_, ?_⟩ + · unfold rightSphereArcMap + exact continuous_subtype_val.comp (Circle.exp.continuous.comp (by fun_prop)) + · intro s₁ s₂ h + have h_exp : Circle.exp ((2 * Real.pi - θ₀) + 2 * θ₀ * (s₁ : ℝ)) = + Circle.exp ((2 * Real.pi - θ₀) + 2 * θ₀ * (s₂ : ℝ)) := + Subtype.ext h + have hs1 : (2 * Real.pi - θ₀) + 2 * θ₀ * (s₁ : ℝ) ∈ + Ico (2 * Real.pi - θ₀) ((2 * Real.pi - θ₀) + 2 * Real.pi) := + ⟨by nlinarith [s₁.2.1], by nlinarith [s₁.2.2]⟩ + have hs2 : (2 * Real.pi - θ₀) + 2 * θ₀ * (s₂ : ℝ) ∈ + Ico (2 * Real.pi - θ₀) ((2 * Real.pi - θ₀) + 2 * Real.pi) := + ⟨by nlinarith [s₂.2.1], by nlinarith [s₂.2.2]⟩ + have heq := eq_of_circle_exp_eq_of_mem_Ico hs1 hs2 h_exp + apply Subtype.ext + nlinarith + +theorem range_leftSphereArcMap {θ₀ : ℝ} (h0 : 0 < θ₀) (hpi : θ₀ < Real.pi) : + range (leftSphereArcMap θ₀) = leftSphereArc (Real.cos θ₀) := by + ext z + simp only [mem_range, leftSphereArc, mem_ofPred_eq] + constructor + · rintro ⟨s, rfl⟩ + unfold leftSphereArcMap + refine ⟨mem_sphere_zero_iff_norm.mpr (Circle.norm_coe _), ?_⟩ + rw [circle_exp_coe_eq_mk] + dsimp + let θ := θ₀ + (2 * Real.pi - 2 * θ₀) * (s : ℝ) + have hθ_lo : θ₀ ≤ θ := by dsimp [θ]; nlinarith [s.2.1] + have hθ_hi : θ ≤ 2 * Real.pi - θ₀ := by dsimp [θ]; nlinarith [s.2.2] + rcases le_total θ Real.pi with hle | hge + · exact Real.strictAntiOn_cos.antitoneOn ⟨h0.le, hpi.le⟩ ⟨h0.le.trans hθ_lo, hle⟩ hθ_lo + · have hsub : 2 * Real.pi - θ = -(θ - 2 * Real.pi) := by ring + have hcos : Real.cos θ = Real.cos (2 * Real.pi - θ) := by + rw [hsub, Real.cos_neg, Real.cos_sub_two_pi] + rw [hcos] + exact Real.strictAntiOn_cos.antitoneOn ⟨h0.le, hpi.le⟩ + ⟨by linarith, by linarith⟩ (by linarith) + · rintro ⟨hz_sph, hz_re⟩ + have hsq : z.re ^ 2 + z.im ^ 2 = 1 := (mem_sphere_unit_iff z).mp hz_sph + have hre_Icc : z.re ∈ Icc (-1 : ℝ) 1 := ⟨by nlinarith, by nlinarith⟩ + let α := Real.arccos z.re + have hα_lo : θ₀ ≤ α := by + have h1 : Real.arccos (Real.cos θ₀) ≤ Real.arccos z.re := + Real.strictAntiOn_arccos.antitoneOn hre_Icc ⟨(Real.neg_one_le_cos θ₀), + (Real.cos_le_one θ₀)⟩ hz_re + rwa [Real.arccos_cos h0.le hpi.le] at h1 + have hα_hi : α ≤ Real.pi := Real.arccos_le_pi z.re + have hcos_α : Real.cos α = z.re := Real.cos_arccos hre_Icc.1 hre_Icc.2 + have hsin_α : Real.sin α = Real.sqrt (1 - z.re ^ 2) := Real.sin_arccos z.re + have h_im_abs : z.im ^ 2 = Real.sin α ^ 2 := by + rw [hsin_α, Real.sq_sqrt (by nlinarith)]; linarith + let θ := if 0 ≤ z.im then α else 2 * Real.pi - α + have hθ_bounds : θ₀ ≤ θ ∧ θ ≤ 2 * Real.pi - θ₀ := by + dsimp [θ]; split_ifs <;> constructor <;> linarith + have hexp_θ : (Circle.exp θ : ℂ) = z := by + rw [circle_exp_coe_eq_mk] + apply Complex.ext + · dsimp [θ] + split_ifs + · exact hcos_α + · have hsub : 2 * Real.pi - α = -(α - 2 * Real.pi) := by ring + rw [hsub, Real.cos_neg, Real.cos_sub_two_pi, hcos_α] + · dsimp [θ] + split_ifs with him + · have hsin_nonneg : 0 ≤ Real.sin α := by rw [hsin_α]; exact Real.sqrt_nonneg _ + nlinarith [sq_nonneg (z.im - Real.sin α)] + · push Not at him + have hsub : 2 * Real.pi - α = -(α - 2 * Real.pi) := by ring + rw [hsub, Real.sin_neg, Real.sin_sub_two_pi] + have hsin_nonneg : 0 ≤ Real.sin α := by rw [hsin_α]; exact Real.sqrt_nonneg _ + nlinarith [sq_nonneg (z.im + Real.sin α)] + let s : ℝ := (θ - θ₀) / (2 * Real.pi - 2 * θ₀) + have hden_pos : 0 < 2 * Real.pi - 2 * θ₀ := by linarith + have hs_mem : s ∈ Icc (0 : ℝ) 1 := by + dsimp [s] + exact ⟨div_nonneg (by linarith) hden_pos.le, (div_le_one hden_pos).mpr (by linarith)⟩ + refine ⟨⟨s, hs_mem⟩, ?_⟩ + change (Circle.exp (θ₀ + (2 * Real.pi - 2 * θ₀) * s) : ℂ) = z + have h_eq : θ₀ + (2 * Real.pi - 2 * θ₀) * s = θ := by + dsimp [s] + rw [mul_div_cancel₀ _ (ne_of_gt hden_pos)] + ring + rw [h_eq, hexp_θ] + +theorem range_rightSphereArcMap {θ₀ : ℝ} (h0 : 0 < θ₀) (hpi : θ₀ < Real.pi) : + range (rightSphereArcMap θ₀) = rightSphereArc (Real.cos θ₀) := by + ext z + simp only [mem_range, rightSphereArc, mem_ofPred_eq] + constructor + · rintro ⟨s, rfl⟩ + unfold rightSphereArcMap + refine ⟨mem_sphere_zero_iff_norm.mpr (Circle.norm_coe _), ?_⟩ + rw [circle_exp_coe_eq_mk] + dsimp + let θ := (2 * Real.pi - θ₀) + 2 * θ₀ * (s : ℝ) + have hθ_lo : 2 * Real.pi - θ₀ ≤ θ := by dsimp [θ]; nlinarith [s.2.1] + have hθ_hi : θ ≤ 2 * Real.pi + θ₀ := by dsimp [θ]; nlinarith [s.2.2] + rcases le_total θ (2 * Real.pi) with hle | hge + · have hsub : 2 * Real.pi - θ = -(θ - 2 * Real.pi) := by ring + have hcos : Real.cos θ = Real.cos (2 * Real.pi - θ) := by + rw [hsub, Real.cos_neg, Real.cos_sub_two_pi] + rw [hcos] + exact Real.strictAntiOn_cos.antitoneOn ⟨by linarith, by linarith⟩ + ⟨h0.le, hpi.le⟩ (by linarith) + · have hcos : Real.cos θ = Real.cos (θ - 2 * Real.pi) := Real.cos_sub_two_pi θ |>.symm + rw [hcos] + exact Real.strictAntiOn_cos.antitoneOn ⟨by linarith, by linarith⟩ + ⟨h0.le, hpi.le⟩ (by linarith) + · rintro ⟨hz_sph, hz_re⟩ + have hsq : z.re ^ 2 + z.im ^ 2 = 1 := (mem_sphere_unit_iff z).mp hz_sph + have hre_Icc : z.re ∈ Icc (-1 : ℝ) 1 := ⟨by nlinarith, by nlinarith⟩ + let α := Real.arccos z.re + have hα_lo : 0 ≤ α := Real.arccos_nonneg z.re + have hα_hi : α ≤ θ₀ := by + have h1 : Real.arccos z.re ≤ Real.arccos (Real.cos θ₀) := + Real.strictAntiOn_arccos.antitoneOn ⟨Real.neg_one_le_cos θ₀, Real.cos_le_one θ₀⟩ hre_Icc + hz_re + rwa [Real.arccos_cos h0.le hpi.le] at h1 + have hcos_α : Real.cos α = z.re := Real.cos_arccos hre_Icc.1 hre_Icc.2 + have hsin_α : Real.sin α = Real.sqrt (1 - z.re ^ 2) := Real.sin_arccos z.re + have h_im_abs : z.im ^ 2 = Real.sin α ^ 2 := by + rw [hsin_α, Real.sq_sqrt (by nlinarith)]; linarith + let θ := if 0 ≤ z.im then 2 * Real.pi + α else 2 * Real.pi - α + have hθ_bounds : 2 * Real.pi - θ₀ ≤ θ ∧ θ ≤ 2 * Real.pi + θ₀ := by + dsimp [θ]; split_ifs <;> constructor <;> linarith + have hexp_θ : (Circle.exp θ : ℂ) = z := by + rw [circle_exp_coe_eq_mk] + apply Complex.ext + · dsimp [θ] + split_ifs + · have hsub : 2 * Real.pi + α - 2 * Real.pi = α := by ring + rw [← Real.cos_sub_two_pi (2 * Real.pi + α), hsub, hcos_α] + · have hsub : 2 * Real.pi - α = -(α - 2 * Real.pi) := by ring + rw [hsub, Real.cos_neg, Real.cos_sub_two_pi, hcos_α] + · dsimp [θ] + split_ifs with him + · have hsub : 2 * Real.pi + α - 2 * Real.pi = α := by ring + rw [← Real.sin_sub_two_pi (2 * Real.pi + α), hsub] + have hsin_nonneg : 0 ≤ Real.sin α := by rw [hsin_α]; exact Real.sqrt_nonneg _ + nlinarith [sq_nonneg (z.im - Real.sin α)] + · push Not at him + have hsub : 2 * Real.pi - α = -(α - 2 * Real.pi) := by ring + rw [hsub, Real.sin_neg, Real.sin_sub_two_pi] + have hsin_nonneg : 0 ≤ Real.sin α := by rw [hsin_α]; exact Real.sqrt_nonneg _ + nlinarith [sq_nonneg (z.im + Real.sin α)] + let s : ℝ := (θ - (2 * Real.pi - θ₀)) / (2 * θ₀) + have hden_pos : 0 < 2 * θ₀ := by linarith + have hs_mem : s ∈ Icc (0 : ℝ) 1 := by + dsimp [s] + exact ⟨div_nonneg (by linarith) hden_pos.le, (div_le_one hden_pos).mpr (by linarith)⟩ + refine ⟨⟨s, hs_mem⟩, ?_⟩ + change (Circle.exp ((2 * Real.pi - θ₀) + 2 * θ₀ * s) : ℂ) = z + have h_eq : (2 * Real.pi - θ₀) + 2 * θ₀ * s = θ := by + dsimp [s] + rw [mul_div_cancel₀ _ (ne_of_gt hden_pos)] + ring + rw [h_eq, hexp_θ] + +/-- Vertical pinching scale `s_k(r) = 1 - min (1/2) (∏ j : Fin (k - 1), (r - parallelX k j)^2)`. -/ +noncomputable def vertPinchScale (k : ℕ) (r : ℝ) : ℝ := + 1 - min (1 / 2 : ℝ) (∏ j : Fin (k - 1), (r - parallelX k j) ^ 2) + +theorem continuous_vertPinchScale (k : ℕ) : Continuous (vertPinchScale k) := by + unfold vertPinchScale + fun_prop + +theorem vertPinchScale_bounds (k : ℕ) (r : ℝ) : + 1 / 2 ≤ vertPinchScale k r ∧ vertPinchScale k r ≤ 1 := by + unfold vertPinchScale + have hprod : 0 ≤ ∏ j : Fin (k - 1), (r - parallelX k j) ^ 2 := + Finset.prod_nonneg fun _ _ => sq_nonneg _ + have hmin_ge : 0 ≤ min (1 / 2 : ℝ) (∏ j : Fin (k - 1), (r - parallelX k j) ^ 2) := + le_min (by norm_num) hprod + have hmin_le : min (1 / 2 : ℝ) (∏ j : Fin (k - 1), (r - parallelX k j) ^ 2) ≤ 1 / 2 := + min_le_left _ _ + exact ⟨by linarith, by linarith⟩ + +theorem vertPinchScale_pos (k : ℕ) (r : ℝ) : 0 < vertPinchScale k r := by + linarith [(vertPinchScale_bounds k r).1] + +theorem vertPinchScale_eq_one_iff (k : ℕ) (r : ℝ) : + vertPinchScale k r = 1 ↔ ∃ j : Fin (k - 1), r = parallelX k j := by + unfold vertPinchScale + have hsub : 1 - min (1 / 2 : ℝ) (∏ j : Fin (k - 1), (r - parallelX k j) ^ 2) = 1 ↔ + min (1 / 2 : ℝ) (∏ j : Fin (k - 1), (r - parallelX k j) ^ 2) = 0 := by + constructor <;> intro h <;> linarith + rw [hsub] + have hmin0 : min (1 / 2 : ℝ) (∏ j : Fin (k - 1), (r - parallelX k j) ^ 2) = 0 ↔ + ∏ j : Fin (k - 1), (r - parallelX k j) ^ 2 = 0 := by + constructor + · intro h + rcases min_choice (1 / 2 : ℝ) (∏ j : Fin (k - 1), (r - parallelX k j) ^ 2) with h1 | h2 + · linarith + · linarith + · intro h + rw [h, min_eq_right (by norm_num)] + rw [hmin0, Finset.prod_eq_zero_iff] + simp [sub_eq_zero] + +/-- Horizontal clamp-averaging map `(r + max a (min b r)) / 2` for `a ≤ b`. -/ +noncomputable def pinchRe (a b r : ℝ) : ℝ := + (r + max a (min b r)) / 2 + +/-- Inverse of `pinchRe a b`: `2 * y - max a (min b y)`. -/ +noncomputable def pinchReInv (a b y : ℝ) : ℝ := + 2 * y - max a (min b y) + +theorem continuous_pinchRe (a b : ℝ) : Continuous (pinchRe a b) := by + unfold pinchRe; fun_prop + +theorem continuous_pinchReInv (a b : ℝ) : Continuous (pinchReInv a b) := by + unfold pinchReInv; fun_prop + +theorem pinchReInv_pinchRe {a b : ℝ} (hab : a ≤ b) (r : ℝ) : + pinchReInv a b (pinchRe a b r) = r := by + unfold pinchRe pinchReInv + rcases le_total r b with hrb | hbr + · rw [min_eq_right hrb] + rcases le_total a r with har | hra + · rw [max_eq_right har, min_eq_right (by linarith), max_eq_right (by linarith)] + ring + · rw [max_eq_left hra, min_eq_right (by linarith), max_eq_left (by linarith)] + ring + · rw [min_eq_left hbr, max_eq_right hab, min_eq_left (by linarith), max_eq_right hab] + ring + +theorem pinchRe_pinchReInv {a b : ℝ} (hab : a ≤ b) (y : ℝ) : + pinchRe a b (pinchReInv a b y) = y := by + unfold pinchRe pinchReInv + rcases le_total y b with hyb | hby + · rw [min_eq_right hyb] + rcases le_total a y with hay | hya + · rw [max_eq_right hay, min_eq_right (by linarith), max_eq_right (by linarith)] + ring + · rw [max_eq_left hya, min_eq_right (by linarith), max_eq_left (by linarith)] + ring + · rw [min_eq_left hby, max_eq_right hab, min_eq_left (by linarith), max_eq_right hab] + ring + +theorem pinchRe_of_mem_Icc {a b r : ℝ} (hr : r ∈ Icc a b) : + pinchRe a b r = r := by + unfold pinchRe + rw [min_eq_right hr.2, max_eq_right hr.1] + ring + +theorem pinchRe_sq_le {a b : ℝ} (ha : a ≤ 0) (hb : 0 ≤ b) (r : ℝ) : + (pinchRe a b r) ^ 2 ≤ r ^ 2 := by + unfold pinchRe + have hab : a ≤ b := ha.trans hb + rcases le_total r b with hrb | hbr + · rw [min_eq_right hrb] + rcases le_total a r with har | hra + · rw [max_eq_right har]; nlinarith + · rw [max_eq_left hra]; nlinarith + · rw [min_eq_left hbr, max_eq_right hab]; nlinarith + +theorem pinchRe_mem_Ioo_of_mem_Icc {a b r : ℝ} (ha : -1 < a) (hab : a ≤ b) (hb : b < 1) + (hr : r ∈ Icc (-1 : ℝ) 1) : + pinchRe a b r ∈ Ioo (-1 : ℝ) 1 := by + unfold pinchRe + have hcl_lo : a ≤ max a (min b r) := le_max_left _ _ + have hcl_hi : max a (min b r) ≤ b := max_le hab (min_le_left _ _) + exact ⟨by linarith [hr.1], by linarith [hr.2]⟩ + +/-- Vertical pinching homeomorphism `Ψ : ℂ ≃ₜ ℂ` fixing `vertChord (parallelX k j)` for every +`j : Fin (k - 1)` and mapping `closedBall 0 1 \ ⋃ j, {top j, bot j}` into `ball 0 1`. -/ +noncomputable def pinchVertHomeo (k : ℕ) (hk : 3 ≤ k) : ℂ ≃ₜ ℂ := by + let a : ℝ := min 0 (parallelX k ⟨k - 2, by omega⟩) + let b : ℝ := max 0 (parallelX k ⟨0, by omega⟩) + have hab : a ≤ b := (min_le_left _ _).trans (le_max_left _ _) + exact + { toFun := fun z => ⟨pinchRe a b z.re, vertPinchScale k z.re * z.im⟩ + invFun := fun w => + ⟨pinchReInv a b w.re, (vertPinchScale k (pinchReInv a b w.re))⁻¹ * w.im⟩ + left_inv := fun z => by + apply Complex.ext + · exact pinchReInv_pinchRe hab z.re + · dsimp + rw [pinchReInv_pinchRe hab z.re, + inv_mul_cancel_left₀ (ne_of_gt (vertPinchScale_pos k z.re))] + right_inv := fun w => by + apply Complex.ext + · exact pinchRe_pinchReInv hab w.re + · dsimp + rw [mul_inv_cancel_left₀ (ne_of_gt (vertPinchScale_pos k (pinchReInv a b w.re)))] + continuous_toFun := by + have h_eq : (fun z : ℂ => (⟨pinchRe a b z.re, vertPinchScale k z.re * z.im⟩ : ℂ)) = + fun z : ℂ => (pinchRe a b z.re : ℂ) + + ((vertPinchScale k z.re * z.im : ℝ) : ℂ) * Complex.I := by + ext z; apply Complex.ext <;> simp + rw [h_eq] + have := continuous_pinchRe a b + have := continuous_vertPinchScale k + fun_prop + continuous_invFun := by + have h_eq : (fun w : ℂ => (⟨pinchReInv a b w.re, + (vertPinchScale k (pinchReInv a b w.re))⁻¹ * w.im⟩ : ℂ)) = + fun w : ℂ => (pinchReInv a b w.re : ℂ) + + (((vertPinchScale k (pinchReInv a b w.re))⁻¹ * w.im : ℝ) : ℂ) * Complex.I := by + ext w; apply Complex.ext <;> simp + rw [h_eq] + have := continuous_pinchReInv a b + have := continuous_vertPinchScale k + have h_ne : ∀ w : ℂ, vertPinchScale k (pinchReInv a b w.re) ≠ 0 := + fun w => ne_of_gt (vertPinchScale_pos k _) + fun_prop (disch := assumption) } + +theorem pinchVertHomeo_apply (k : ℕ) (hk : 3 ≤ k) (z : ℂ) : + pinchVertHomeo k hk z = + ⟨pinchRe (min 0 (parallelX k ⟨k - 2, by omega⟩)) + (max 0 (parallelX k ⟨0, by omega⟩)) z.re, + vertPinchScale k z.re * z.im⟩ := rfl + +theorem pinchVertHomeo_apply_of_re_eq {k : ℕ} (hk : 3 ≤ k) {z : ℂ} (j : Fin (k - 1)) + (hz : z.re = parallelX k j) : + pinchVertHomeo k hk z = z := by + rw [pinchVertHomeo_apply] + have hanti := (strictAnti_parallelX (by omega : 1 ≤ k)).antitone + have hj_le : j ≤ (⟨k - 2, by omega⟩ : Fin (k - 1)) := by + rw [Fin.le_def] + dsimp + have := j.2 + omega + have hj_lo : parallelX k ⟨k - 2, by omega⟩ ≤ parallelX k j := hanti hj_le + have hj_hi : parallelX k j ≤ parallelX k ⟨0, by omega⟩ := + hanti (show (⟨0, by omega⟩ : Fin (k - 1)) ≤ j from Fin.le_def.mpr (Nat.zero_le _)) + have hmem : z.re ∈ Icc (min 0 (parallelX k ⟨k - 2, by omega⟩)) + (max 0 (parallelX k ⟨0, by omega⟩)) := by + rw [hz] + exact ⟨(min_le_right _ _).trans hj_lo, hj_hi.trans (le_max_right _ _)⟩ + have hscale : vertPinchScale k z.re = 1 := + (vertPinchScale_eq_one_iff k z.re).mpr ⟨j, hz⟩ + apply Complex.ext + · exact pinchRe_of_mem_Icc hmem + · dsimp; rw [hscale, one_mul] + +theorem pinchVertHomeo_norm_sq_le (k : ℕ) (hk : 3 ≤ k) (z : ℂ) : + (pinchVertHomeo k hk z).re ^ 2 + (pinchVertHomeo k hk z).im ^ 2 ≤ + z.re ^ 2 + z.im ^ 2 := by + rw [pinchVertHomeo_apply] + dsimp + have hre : (pinchRe (min 0 (parallelX k ⟨k - 2, by omega⟩)) + (max 0 (parallelX k ⟨0, by omega⟩)) z.re) ^ 2 ≤ z.re ^ 2 := + pinchRe_sq_le (min_le_left _ _) (le_max_left _ _) z.re + have hs := vertPinchScale_bounds k z.re + have him : (vertPinchScale k z.re * z.im) ^ 2 ≤ z.im ^ 2 := by + have : (vertPinchScale k z.re) ^ 2 ≤ 1 := by nlinarith + nlinarith [sq_nonneg z.im] + linarith + +theorem image_closedBall_pinchVertHomeo_subset (k : ℕ) (hk : 3 ≤ k) : + (pinchVertHomeo k hk) '' closedBall (0 : ℂ) 1 ⊆ closedBall (0 : ℂ) 1 := by + rintro _ ⟨z, hz, rfl⟩ + rw [mem_closedBall_unit_iff] at hz ⊢ + exact (pinchVertHomeo_norm_sq_le k hk z).trans hz + +theorem image_ball_pinchVertHomeo_subset (k : ℕ) (hk : 3 ≤ k) : + (pinchVertHomeo k hk) '' ball (0 : ℂ) 1 ⊆ ball (0 : ℂ) 1 := by + rintro _ ⟨z, hz, rfl⟩ + rw [mem_ball_unit_iff] at hz ⊢ + exact (pinchVertHomeo_norm_sq_le k hk z).trans_lt hz + +theorem image_closedBall_pinchVertHomeo_inter_sphere (k : ℕ) (hk : 3 ≤ k) : + ((pinchVertHomeo k hk) '' closedBall (0 : ℂ) 1) ∩ sphere (0 : ℂ) 1 = + ⋃ j : Fin (k - 1), {⟨parallelX k j, parallelY k j⟩, ⟨parallelX k j, -parallelY k j⟩} := by + ext w + simp only [mem_inter_iff, mem_image, mem_iUnion, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨⟨z, hz_cb, rfl⟩, hz_sph⟩ + rw [mem_closedBall_unit_iff] at hz_cb + rw [mem_sphere_unit_iff] at hz_sph + let a : ℝ := min 0 (parallelX k ⟨k - 2, by omega⟩) + let b : ℝ := max 0 (parallelX k ⟨0, by omega⟩) + have ha_gt : -1 < a := lt_min (by norm_num) (parallelX_mem_Ioo _).1 + have hb_lt : b < 1 := max_lt (by norm_num) (parallelX_mem_Ioo _).2 + have hab : a ≤ b := (min_le_left _ _).trans (le_max_left _ _) + have hz_re_Icc : z.re ∈ Icc (-1 : ℝ) 1 := ⟨by nlinarith, by nlinarith⟩ + have hre_Ioo : (pinchVertHomeo k hk z).re ∈ Ioo (-1 : ℝ) 1 := + pinchRe_mem_Ioo_of_mem_Icc ha_gt hab hb_lt hz_re_Icc + have hre_sq_lt : (pinchVertHomeo k hk z).re ^ 2 < 1 := by + nlinarith [hre_Ioo.1, hre_Ioo.2] + have hre_sq_le : (pinchVertHomeo k hk z).re ^ 2 ≤ z.re ^ 2 := + pinchRe_sq_le (min_le_left _ _) (le_max_left _ _) z.re + have hs := vertPinchScale_bounds k z.re + have him_sq_le : (pinchVertHomeo k hk z).im ^ 2 ≤ z.im ^ 2 := by + change (vertPinchScale k z.re * z.im) ^ 2 ≤ z.im ^ 2 + have : (vertPinchScale k z.re) ^ 2 ≤ 1 := by nlinarith + nlinarith [sq_nonneg z.im] + have him_sq_pos : 0 < (pinchVertHomeo k hk z).im ^ 2 := by linarith + have hzim_sq_pos : 0 < z.im ^ 2 := lt_of_lt_of_le him_sq_pos him_sq_le + have him_sq_eq : (vertPinchScale k z.re * z.im) ^ 2 = z.im ^ 2 := by + change (pinchVertHomeo k hk z).im ^ 2 = z.im ^ 2 + linarith + have hscale_sq : (vertPinchScale k z.re) ^ 2 = 1 := by nlinarith + have hscale_eq : vertPinchScale k z.re = 1 := by nlinarith [hs.1] + obtain ⟨j, hj⟩ := (vertPinchScale_eq_one_iff k z.re).mp hscale_eq + refine ⟨j, ?_⟩ + rw [pinchVertHomeo_apply_of_re_eq hk j hj] at hz_sph ⊢ + have hz_im_sq : z.im ^ 2 = parallelY k j ^ 2 := by + have := parallelX_sq_add_parallelY_sq j + rw [← hj] at this + linarith + rcases sq_eq_sq_iff_eq_or_eq_neg.mp hz_im_sq with him | him + · left; exact Complex.ext hj him + · right; exact Complex.ext hj him + · rintro ⟨j, rfl | rfl⟩ + · have h1 : (⟨parallelX k j, parallelY k j⟩ : ℂ) ∈ sphere (0 : ℂ) 1 := by + rw [mem_sphere_unit_iff]; exact parallelX_sq_add_parallelY_sq j + exact ⟨⟨⟨parallelX k j, parallelY k j⟩, sphere_subset_closedBall h1, + pinchVertHomeo_apply_of_re_eq hk j rfl⟩, h1⟩ + · have h1 : (⟨parallelX k j, -parallelY k j⟩ : ℂ) ∈ sphere (0 : ℂ) 1 := by + rw [mem_sphere_unit_iff]; dsimp; rw [neg_sq]; exact parallelX_sq_add_parallelY_sq j + exact ⟨⟨⟨parallelX k j, -parallelY k j⟩, sphere_subset_closedBall h1, + pinchVertHomeo_apply_of_re_eq hk j rfl⟩, h1⟩ + +/-! ## 6. Chart Image Properties, Single-Region `IsCappedSplit`, and Pinched Subdisc `Δ` -/ + +theorem isChart_g_ball_eq_region {S : Type w} [TopologicalSpace S] + {Λ : Set S} {h : S → ℂ} {g : ℂ → S} + (c : IsChart (closure Λ) h g) (hΛ_open : IsOpen Λ) + (hdiscBd : discBd (closure Λ) = subBd Λ) : + g '' ball (0 : ℂ) 1 = Λ := by + rw [IsChart.g_ball c, hdiscBd, subBd_eq_frontier, hΛ_open.frontier_eq] + ext x + simp only [mem_sdiff] + exact ⟨fun ⟨hx_cl, hx_not⟩ => by_contra fun hx => hx_not ⟨hx_cl, hx⟩, + fun hx => ⟨subset_closure hx, fun ⟨_, hx_not⟩ => hx_not hx⟩⟩ + +theorem isChart_isOpen_image_of_subset_ball {S : Type w} [TopologicalSpace S] + {Λ : Set S} {h : S → ℂ} {g : ℂ → S} + (c : IsChart (closure Λ) h g) (hΛ_open : IsOpen Λ) + (hdiscBd : discBd (closure Λ) = subBd Λ) + {U : Set ℂ} (hU_open : IsOpen U) (hU_sub : U ⊆ ball (0 : ℂ) 1) : + IsOpen (g '' U) := by + have hg_ball : g '' ball (0 : ℂ) 1 = Λ := isChart_g_ball_eq_region c hΛ_open hdiscBd + have h_eq : g '' U = Λ ∩ h ⁻¹' U := by + ext x + simp only [mem_image, mem_inter_iff, mem_preimage] + constructor + · rintro ⟨z, hzU, rfl⟩ + refine ⟨hg_ball ▸ ⟨z, hU_sub hzU, rfl⟩, ?_⟩ + rw [c.hg (ball_subset_closedBall (hU_sub hzU))] + exact hzU + · rintro ⟨hxΛ, hxhU⟩ + exact ⟨h x, hxhU, c.gh (subset_closure hxΛ)⟩ + rw [h_eq] + exact (c.hc.mono subset_closure).isOpen_inter_preimage hΛ_open hU_open + +theorem isChart_closure_image_of_subset_closedBall {S : Type w} [TopologicalSpace S] [T2Space S] + {Δ : Set S} {h : S → ℂ} {g : ℂ → S} + (c : IsChart Δ h g) {U : Set ℂ} (hU_sub : U ⊆ closedBall (0 : ℂ) 1) : + closure (g '' U) = g '' closure U := by + have hcl_sub : closure U ⊆ closedBall (0 : ℂ) 1 := + closure_minimal hU_sub isClosed_closedBall + have hcomp : IsCompact (g '' closure U) := + ((isCompact_closedBall (0 : ℂ) 1).of_isClosed_subset isClosed_closure + hcl_sub).image_of_continuousOn + (c.gc.mono hcl_sub) + refine Subset.antisymm (closure_minimal (image_mono subset_closure) hcomp.isClosed) ?_ + rintro _ ⟨z, hz_cl, rfl⟩ + rw [_root_.mem_closure_iff] + intro V hV hgzV + have hcont_at : ContinuousWithinAt g (closedBall (0 : ℂ) 1) z := c.gc z (hcl_sub hz_cl) + obtain ⟨W, hW_open, hzW, hW_sub⟩ := + mem_nhdsWithin.mp (hcont_at.preimage_mem_nhdsWithin (hV.mem_nhds hgzV)) + obtain ⟨w, hwW, hwU⟩ := _root_.mem_closure_iff.mp hz_cl W hW_open hzW + exact ⟨g w, hW_sub ⟨hwW, hU_sub hwU⟩, w, hwU, rfl⟩ + +theorem isChart_subBd_image_of_isOpen_subset_ball {S : Type w} [TopologicalSpace S] [T2Space S] + {Λ : Set S} {h : S → ℂ} {g : ℂ → S} + (c : IsChart (closure Λ) h g) (hΛ_open : IsOpen Λ) + (hdiscBd : discBd (closure Λ) = subBd Λ) + {U : Set ℂ} (hU_open : IsOpen U) (hU_sub : U ⊆ ball (0 : ℂ) 1) : + subBd (g '' U) = g '' (closure U \ U) := by + have hU_cb : U ⊆ closedBall (0 : ℂ) 1 := hU_sub.trans ball_subset_closedBall + have hcl_cb : closure U ⊆ closedBall (0 : ℂ) 1 := closure_minimal hU_cb isClosed_closedBall + rw [subBd_eq_frontier, (isChart_isOpen_image_of_subset_ball c hΛ_open hdiscBd hU_open + hU_sub).frontier_eq, + isChart_closure_image_of_subset_closedBall c hU_cb, ← c.g_sdiff hcl_cb hU_cb] + +/-- Any nonempty open preconnected set `U ⊆ S` disjoint from `H'.U` with `subBd U ⊆ H'.U` is a +region `U ∈ H'.R`. -/ +theorem mem_R_of_isOpen_isPreconnected {S : Type w} [TopologicalSpace S] + (hS : IsClosedSurface S) {H' : Drawing S} {U : Set S} + (hU_open : IsOpen U) (hU_ne : U.Nonempty) (hU_conn : IsPreconnected U) + (hDisj : Disjoint U H'.U) (hBdU : subBd U ⊆ H'.U) : + U ∈ H'.R := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨x₀, hx₀⟩ := hU_ne + obtain ⟨r, hr, hx₀r⟩ := GM11.exists_region_of_notMem (Γ := H') (disjoint_left.mp hDisj hx₀) + have hUr : U ⊆ r := GM11.subset_region hr hU_conn hDisj hx₀ hx₀r + obtain ⟨_, hclU⟩ := isOpen_disjoint_subBd_and_closure_eq hU_open + have hrU : r ⊆ U := by + have hdis_fr : Disjoint r (frontier (closure U)) := by + refine disjoint_left.mpr fun y hyr hyfr => ?_ + exact GM11.region_subset hr hyr (hBdU (subBd_eq_frontier U ▸ frontier_closure_subset hyfr)) + have hr_cl : r ⊆ closure U := + GM14.subset_of_disjoint_frontier (GM11.region_isPreconnected hr) isClosed_closure + hdis_fr hx₀r (subset_closure hx₀) + intro y hyr + rcases hclU ▸ hr_cl hyr with hyU | hyBd + · exact hyU + · exact (GM11.region_subset hr hyr (hBdU hyBd)).elim + exact Subset.antisymm hUr hrU ▸ hr + +/-- Decomposition of a closed surface `S` into `P₁ = univ \ Λ` and `P₂ = closure Λ` along a single +2-cell region `Λ ∈ H.R` bounded by an `O`-arc `subBd Λ`. -/ +theorem isCappedSplit_single_region {S : Type w} [TopologicalSpace S] [ConnectedSpace S] + (hS : IsClosedSurface S) {H : Drawing S} {Λ : Set S} + (hΛ : Λ ∈ H.R) (hOpenDisc : IsOpenDisc Λ) (hOArc : IsOArc (subBd Λ)) + (hCD : IsClosedDisc (closure Λ)) (hdiscBd : discBd (closure Λ) = subBd Λ) + (hout : ∀ x ∈ closure Λ \ Λ, x ∈ closure (closure Λ)ᶜ) : + GM12.IsCappedSplit (fun _ : Fin 1 => subBd Λ) (univ \ Λ) (closure Λ) + (Subtype.val : ↥(univ \ Λ) → S) (fun _ : Fin 1 => Λ) := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hΛ_open : IsOpen Λ := GM11.region_isOpen hΛ + have hsubBd_eq : subBd Λ = closure Λ \ Λ := by + rw [subBd_eq_frontier, hΛ_open.frontier_eq] + obtain ⟨hSurf₁, _, hbd₁, _⟩ := compl_open_isSurface hS hΛ_open hOArc hout + obtain ⟨φD⟩ := id hCD + obtain ⟨eD₀⟩ := nonempty_disc_homeo + have hSurf₂ : IsSurface ↥(closure Λ) := + isSurface_of_homeo (eD₀.trans φD) (isSurface_model 0 0 1).1 + refine + { surface := ⟨hS, inferInstance⟩ + isOArc := fun _ => hOArc + disjoint := fun i j hij => (hij (Subsingleton.elim i j)).elim + manifold₁ := hSurf₁ + manifold₂ := hSurf₂ + union := by + ext x + simp only [mem_union, mem_sdiff, mem_univ, true_and, iff_true] + exact (em (x ∈ Λ)).symm.imp_right fun hx => subset_closure hx + inter := by + rw [iUnion_const, hsubBd_eq] + ext x + simp only [mem_inter_iff, mem_sdiff, mem_univ, true_and] + exact and_comm + bd₁ := by + rw [iUnion_const, hbd₁, Subtype.image_preimage_coe] + refine inter_eq_right.mpr ?_ + rw [hsubBd_eq] + exact fun x hx => ⟨mem_univ x, hx.2⟩ + bd₂ := by rw [iUnion_const, ← hdiscBd]; rfl + surface_hat := hS + isEmbedding := IsEmbedding.subtypeVal + isOpenDisc := fun _ => hOpenDisc + bounds := fun _ => by + rw [Subtype.image_preimage_coe] + refine (inter_eq_right.mpr ?_).symm + rw [hsubBd_eq] + exact fun x hx => ⟨mem_univ x, hx.2⟩ + disjoint_D := fun i j hij => (hij (Subsingleton.elim i j)).elim + compl := by + rw [Subtype.range_coe, iUnion_const] + ext x + simp only [mem_compl_iff, mem_sdiff, mem_univ, true_and, not_not] } + +/-- Image of `pinchVertHomeo k hk '' closedBall 0 1` under `c : IsChart (closure Λ) h g` is a +closed disc `Δ ⊆ closure Λ` containing all vertical chords `g '' vertChord (parallelX k j)` and +meeting `subBd Λ` only at the chord endpoints. -/ +theorem exists_pinched_vert_disc {S : Type w} [TopologicalSpace S] + (hS : IsClosedSurface S) {Λ : Set S} {h : S → ℂ} {g : ℂ → S} + (c : IsChart (closure Λ) h g) (hCD : IsClosedDisc (closure Λ)) + (hOArc : IsOArc (subBd Λ)) (hΛ_open : IsOpen Λ) + (hdiscBd : discBd (closure Λ) = subBd Λ) + (hout : ∀ x ∈ closure Λ \ Λ, x ∈ closure (closure Λ)ᶜ) + {k : ℕ} (hk : 3 ≤ k) : + let Ψ := pinchVertHomeo k hk + let Δ := g '' (Ψ '' closedBall (0 : ℂ) 1) + IsClosedDisc Δ ∧ + Δ ⊆ closure Λ ∧ + subBd Δ = g '' (Ψ '' sphere (0 : ℂ) 1) ∧ + IsOArc (subBd Δ) ∧ + (∀ j : Fin (k - 1), g '' vertChord (parallelX k j) ⊆ Δ) ∧ + Δ ∩ subBd Λ = + ⋃ j : Fin (k - 1), {g ⟨parallelX k j, parallelY k j⟩, g ⟨parallelX k j, -parallelY k j⟩} ∧ + Δ ∩ (univ \ Λ) = + ⋃ j : Fin (k - 1), {g ⟨parallelX k j, parallelY k j⟩, g ⟨parallelX k j, -parallelY k j⟩} ∧ + univ \ Λ ⊆ closure (univ \ Δ) ∧ + (∀ j : Fin (k - 1), + (g '' vertChord (parallelX k j)) ∩ closure (univ \ Δ) = + {g ⟨parallelX k j, parallelY k j⟩, g ⟨parallelX k j, -parallelY k j⟩}) := by + intro Ψ Δ + have hΨ_cb : MapsTo Ψ (closedBall (0 : ℂ) 1) (closedBall (0 : ℂ) 1) := + fun z hz => image_closedBall_pinchVertHomeo_subset k hk ⟨z, hz, rfl⟩ + have hΔ_sub_cl : Δ ⊆ closure Λ := + c.g_subset (image_closedBall_pinchVertHomeo_subset k hk) + let f : S → S := fun x => g (Ψ (h x)) + let f' : S → S := fun y => g (Ψ.symm (h y)) + have hf_cont : ContinuousOn f (closure Λ) := + c.gc.comp (Ψ.continuous.continuousOn.comp c.hc c.hm) (hΨ_cb.comp c.hm) + have hf_image_cl : f '' closure Λ = Δ := by + rw [← c.g_closedBall] + ext y + simp only [f, Δ, mem_image] + constructor + · rintro ⟨_, ⟨z, hz, rfl⟩, rfl⟩ + exact ⟨Ψ (h (g z)), ⟨h (g z), by rwa [c.hg hz], rfl⟩, rfl⟩ + · rintro ⟨_, ⟨z, hz, rfl⟩, rfl⟩ + exact ⟨g z, ⟨z, hz, rfl⟩, by rw [c.hg hz]⟩ + have hf_image_bd : f '' discBd (closure Λ) = g '' (Ψ '' sphere (0 : ℂ) 1) := by + have : f '' discBd (closure Λ) = g '' (Ψ '' (h '' discBd (closure Λ))) := by + ext y; simp [f, mem_image] + rw [this, c.bd] + have hΨsymm_maps : MapsTo (fun y => Ψ.symm (h y)) Δ (closedBall (0 : ℂ) 1) := by + rintro _ ⟨_, ⟨z, hz, rfl⟩, rfl⟩ + change Ψ.symm (h (g (Ψ z))) ∈ closedBall (0 : ℂ) 1 + rw [c.hg (hΨ_cb hz), Ψ.symm_apply_apply] + exact hz + have hf'_cont : ContinuousOn f' (f '' closure Λ) := by + rw [hf_image_cl] + exact c.gc.comp (Ψ.symm.continuous.continuousOn.comp (c.hc.mono hΔ_sub_cl) (mapsTo_univ _ _)) + hΨsymm_maps + have h_left : LeftInvOn f' f (closure Λ) := fun x hx => by + change g (Ψ.symm (h (g (Ψ (h x))))) = x + rw [c.hg (hΨ_cb (c.hm hx)), Ψ.symm_apply_apply, c.gh hx] + obtain ⟨hΔ_disc, hΔ_discBd⟩ := hCD.image hf_cont hf'_cont h_left + rw [hf_image_cl] at hΔ_disc + rw [hf_image_cl, hf_image_bd] at hΔ_discBd + have hΔ_subBd : subBd Δ = g '' (Ψ '' sphere (0 : ℂ) 1) := + (IsClosedDisc.subBd_eq_discBd hS hΔ_disc).trans hΔ_discBd + have hbd_sub_cl : subBd Λ ⊆ closure Λ := hdiscBd ▸ Surface.discBd_subset (closure Λ) + have hf_image_subBd : f '' subBd Λ = subBd Δ := by + rw [← hdiscBd, hf_image_bd, hΔ_subBd] + have hΔ_oArc : IsOArc (subBd Δ) := by + rw [← hf_image_subBd] + exact hOArc.image (hf_cont.mono hbd_sub_cl) + (hf'_cont.mono (image_mono hbd_sub_cl)) (h_left.mono hbd_sub_cl) + have hchord_sub_Ψ : ∀ j : Fin (k - 1), vertChord (parallelX k j) ⊆ Ψ '' closedBall (0 : ℂ) 1 := by + intro j z hz + exact ⟨z, hz.1, pinchVertHomeo_apply_of_re_eq hk j hz.2⟩ + have hchord_sub_Δ : ∀ j : Fin (k - 1), g '' vertChord (parallelX k j) ⊆ Δ := + fun j => image_mono (hchord_sub_Ψ j) + have hΔ_inter_subBd : Δ ∩ subBd Λ = + ⋃ j : Fin (k - 1), {g ⟨parallelX k j, parallelY k j⟩, g ⟨parallelX k j, -parallelY k j⟩} := by + rw [← hdiscBd, ← c.g_sphere, + ← c.g_inter (image_closedBall_pinchVertHomeo_subset k hk) sphere_subset_closedBall, + image_closedBall_pinchVertHomeo_inter_sphere k hk, image_iUnion] + simp only [image_pair] + have hsubBd_eq_sdiff : subBd Λ = closure Λ \ Λ := by + rw [subBd_eq_frontier, hΛ_open.frontier_eq] + have hΔ_inter_compl : Δ ∩ (univ \ Λ) = Δ ∩ subBd Λ := by + rw [hsubBd_eq_sdiff] + ext x + simp only [mem_inter_iff, mem_sdiff, mem_univ, true_and] + exact ⟨fun ⟨hxΔ, hx_not_Λ⟩ => ⟨hxΔ, hΔ_sub_cl hxΔ, hx_not_Λ⟩, + fun ⟨hxΔ, _, hx_not_Λ⟩ => ⟨hxΔ, hx_not_Λ⟩⟩ + have hcompl_sub_cl_compl : univ \ Λ ⊆ closure (univ \ Δ) := by + intro x hx + by_cases hx_cl : x ∈ closure Λ + · have hx_out : x ∈ closure (closure Λ)ᶜ := hout x ⟨hx_cl, hx.2⟩ + have hsub_compl : (closure Λ)ᶜ ⊆ univ \ Δ := + fun y hy => ⟨mem_univ y, fun hyΔ => hy (hΔ_sub_cl hyΔ)⟩ + exact closure_mono hsub_compl hx_out + · exact subset_closure ⟨mem_univ x, fun hxΔ => hx_cl (hΔ_sub_cl hxΔ)⟩ + have hchord_inter_compl : ∀ j : Fin (k - 1), + (g '' vertChord (parallelX k j)) ∩ closure (univ \ Δ) = + {g ⟨parallelX k j, parallelY k j⟩, g ⟨parallelX k j, -parallelY k j⟩} := by + intro j + refine Subset.antisymm ?_ ?_ + · rintro _ ⟨⟨z, hz, rfl⟩, hgz_cl⟩ + have hz_Ψ : Ψ z = z := pinchVertHomeo_apply_of_re_eq hk j hz.2 + have hgz_Δ : g z ∈ Δ := hchord_sub_Δ j ⟨z, hz, rfl⟩ + have hgz_bdΔ : g z ∈ subBd Δ := ⟨subset_closure hgz_Δ, hgz_cl⟩ + rw [hΔ_subBd] at hgz_bdΔ + obtain ⟨w, ⟨u, hu_sph, rfl⟩, hgw_eq⟩ := hgz_bdΔ + have hwu : Ψ u = z := c.injOn (hΨ_cb (sphere_subset_closedBall hu_sph)) hz.1 hgw_eq + have hzu : z = u := Ψ.injective (hz_Ψ.trans hwu.symm) + have hz_inter : z ∈ vertChord (parallelX k j) ∩ sphere (0 : ℂ) 1 := + ⟨hz, hzu ▸ hu_sph⟩ + rw [vertChord_inter_sphere (parallelX_sq_add_parallelY_sq j)] at hz_inter + rcases hz_inter with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + · rintro x (rfl | rfl) + · have htop_sph : (⟨parallelX k j, parallelY k j⟩ : ℂ) ∈ sphere (0 : ℂ) 1 := + (mem_sphere_unit_iff _).mpr (parallelX_sq_add_parallelY_sq j) + have htop_bd : g ⟨parallelX k j, parallelY k j⟩ ∈ subBd Λ := by + rw [← hdiscBd, ← c.g_sphere] + exact ⟨_, htop_sph, rfl⟩ + exact ⟨⟨_, ⟨sphere_subset_closedBall htop_sph, rfl⟩, rfl⟩, + hcompl_sub_cl_compl ⟨mem_univ _, (hsubBd_eq_sdiff ▸ htop_bd).2⟩⟩ + · have hbot_sph : (⟨parallelX k j, -parallelY k j⟩ : ℂ) ∈ sphere (0 : ℂ) 1 := by + rw [mem_sphere_unit_iff]; dsimp; rw [neg_sq]; exact parallelX_sq_add_parallelY_sq j + have hbot_bd : g ⟨parallelX k j, -parallelY k j⟩ ∈ subBd Λ := by + rw [← hdiscBd, ← c.g_sphere] + exact ⟨_, hbot_sph, rfl⟩ + exact ⟨⟨_, ⟨sphere_subset_closedBall hbot_sph, rfl⟩, rfl⟩, + hcompl_sub_cl_compl ⟨mem_univ _, (hsubBd_eq_sdiff ▸ hbot_bd).2⟩⟩ + exact ⟨hΔ_disc, hΔ_sub_cl, hΔ_subBd, hΔ_oArc, hchord_sub_Δ, + hΔ_inter_subBd, hΔ_inter_compl.trans hΔ_inter_subBd, + hcompl_sub_cl_compl, hchord_inter_compl⟩ + +/-- A path `P_bd` in `H'.interSet (subBd Λ)` with `(P_bd.V ∩ range v).ncard ≤ 2` cannot contain +both endpoints `a j = g ⟨parallelX k j, parallelY k j⟩` and +`b j = g ⟨parallelX k j, -parallelY k j⟩` of a vertical chord, because any preconnected subset of +`subBd Λ` containing both `a j` (positive imaginary part) and `b j` (negative imaginary part) must +contain `g ⟨-1, 0⟩ = v i_k` or `g ⟨1, 0⟩ = v i_last` (zero imaginary part), giving 3 distinct +vertices in `P_bd.V ∩ range v`. -/ +theorem no_both_ends_in_bd_path {S : Type w} [TopologicalSpace S] [T2Space S] + {H' : Drawing S} {Λ : Set S} {h : S → ℂ} {g : ℂ → S} + (c : IsChart (closure Λ) h g) + {k : ℕ} (hk : 3 ≤ k) {v : Fin (2 * k) → S} + (hv_H'V : ∀ i : Fin (2 * k), v i ∈ H'.V) + {i_k i_last : Fin (2 * k)} + (hg_ik : g ⟨-1, 0⟩ = v i_k) (hg_ilast : g ⟨1, 0⟩ = v i_last) + (hg_a : ∀ j : Fin (k - 1), g ⟨parallelX k j, parallelY k j⟩ = v ⟨j.1, by omega⟩) + (hg_b : ∀ j : Fin (k - 1), g ⟨parallelX k j, -parallelY k j⟩ = v ⟨2 * k - 2 - j.1, by omega⟩) + {u₀ v₀ : S} {P_bd : Drawing S} + (hP_sub : P_bd.IsSubdrawing H') + (hPU_bd : P_bd.U ⊆ discBd (closure Λ)) + (hP_path : P_bd.IsPathBetween u₀ v₀) + (huv₀ : u₀ ≠ v₀) + (hPV_X : (P_bd.V ∩ range v).ncard ≤ 2) : + ∀ j : Fin (k - 1), + ¬ (g ⟨parallelX k j, parallelY k j⟩ ∈ P_bd.V ∧ + g ⟨parallelX k j, -parallelY k j⟩ ∈ P_bd.V) := by + intro j ⟨ha_PV, hb_PV⟩ + set a_j := g ⟨parallelX k j, parallelY k j⟩ + set b_j := g ⟨parallelX k j, -parallelY k j⟩ + have hPU_D : P_bd.U ⊆ closure Λ := hPU_bd.trans (Surface.discBd_subset (closure Λ)) + have hP_line : IsLineWithEnds P_bd.U u₀ v₀ := GM14.isLine_of_isPathBetween hP_path huv₀ + have hPU_conn : IsPreconnected P_bd.U := by + obtain ⟨γ, hγ_arc, hγ_range, _, _⟩ := hP_line.exists_arc + exact hγ_range ▸ isPreconnected_range hγ_arc.1 + let im_h : S → ℝ := fun x => (h x).im + have him_cont : ContinuousOn im_h P_bd.U := + (Complex.continuous_im.comp_continuousOn c.hc).mono hPU_D + have him_conn : IsPreconnected (im_h '' P_bd.U) := hPU_conn.image im_h him_cont + have htop_cb : (⟨parallelX k j, parallelY k j⟩ : ℂ) ∈ closedBall (0 : ℂ) 1 := + sphere_subset_closedBall ((mem_sphere_unit_iff _).mpr (parallelX_sq_add_parallelY_sq j)) + have hbot_cb : (⟨parallelX k j, -parallelY k j⟩ : ℂ) ∈ closedBall (0 : ℂ) 1 := by + refine sphere_subset_closedBall ((mem_sphere_unit_iff _).mpr ?_) + dsimp; rw [neg_sq]; exact parallelX_sq_add_parallelY_sq j + have him_a : im_h a_j = parallelY k j := by + change (h (g ⟨parallelX k j, parallelY k j⟩)).im = parallelY k j + rw [c.hg htop_cb] + have him_b : im_h b_j = -parallelY k j := by + change (h (g ⟨parallelX k j, -parallelY k j⟩)).im = -parallelY k j + rw [c.hg hbot_cb] + have hy_pos : 0 < parallelY k j := parallelY_pos j + have h0_mem : (0 : ℝ) ∈ im_h '' P_bd.U := + him_conn.ordConnected.out ⟨b_j, P_bd.V_subset_U hb_PV, him_b⟩ + ⟨a_j, P_bd.V_subset_U ha_PV, him_a⟩ ⟨by linarith, by linarith⟩ + obtain ⟨z, hz_PU, hz_im⟩ := h0_mem + have hhz_sph : h z ∈ sphere (0 : ℂ) 1 := c.bd ▸ ⟨z, hPU_bd hz_PU, rfl⟩ + have hhz_re_sq : (h z).re ^ 2 = 1 := by + have h1 := (mem_sphere_unit_iff (h z)).mp hhz_sph + change (h z).im = 0 at hz_im + nlinarith + have hhz_eq : h z = ⟨-1, 0⟩ ∨ h z = ⟨1, 0⟩ := by + have hre : (h z).re = -1 ∨ (h z).re = 1 := by + have : ((h z).re + 1) * ((h z).re - 1) = 0 := by nlinarith + rcases mul_eq_zero.mp this with h1 | h2 + · exact Or.inl (by linarith) + · exact Or.inr (by linarith) + rcases hre with h1 | h2 + · exact Or.inl (Complex.ext h1 hz_im) + · exact Or.inr (Complex.ext h2 hz_im) + have hz_eq : z = v i_k ∨ z = v i_last := by + have hgh : g (h z) = z := c.gh (hPU_D hz_PU) + rcases hhz_eq with h1 | h2 + · exact Or.inl (by rw [← hgh, h1, hg_ik]) + · exact Or.inr (by rw [← hgh, h2, hg_ilast]) + have hz_X_H'V : z ∈ range v ∧ z ∈ H'.V := by + rcases hz_eq with rfl | rfl + · exact ⟨⟨i_k, rfl⟩, hv_H'V i_k⟩ + · exact ⟨⟨i_last, rfl⟩, hv_H'V i_last⟩ + have hz_PV : z ∈ P_bd.V := + (isSubdrawing_U_inter_V hP_sub) ▸ ⟨hz_PU, hz_X_H'V.2⟩ + have ha_mem : a_j ∈ P_bd.V ∩ range v := + ⟨ha_PV, ⟨⟨j.1, by omega⟩, (hg_a j).symm⟩⟩ + have hb_mem : b_j ∈ P_bd.V ∩ range v := + ⟨hb_PV, ⟨⟨2 * k - 2 - j.1, by omega⟩, (hg_b j).symm⟩⟩ + have hz_mem : z ∈ P_bd.V ∩ range v := ⟨hz_PV, hz_X_H'V.1⟩ + have hab_ne : a_j ≠ b_j := fun heq => by + have := congrArg im_h heq + linarith [him_a, him_b, hy_pos] + have haz_ne : a_j ≠ z := fun heq => by + have := congrArg im_h heq + linarith [him_a, hz_im, hy_pos] + have hbz_ne : b_j ≠ z := fun heq => by + have := congrArg im_h heq + linarith [him_b, hz_im, hy_pos] + have hsub3 : ({a_j, b_j, z} : Set S) ⊆ P_bd.V ∩ range v := by + rintro w (rfl | rfl | rfl) + · exact ha_mem + · exact hb_mem + · exact hz_mem + have hfin : (P_bd.V ∩ range v).Finite := P_bd.finite_V.subset inter_subset_left + have hcard3 : ({a_j, b_j, z} : Set S).ncard = 3 := by + rw [ncard_insert_of_notMem (by simp [hab_ne, haz_ne]), + ncard_pair hbz_ne] + have hle := ncard_le_ncard hsub3 hfin + omega + +/-- On the pinched closed disc boundary `subBd Δ = g '' (pinchVertHomeo k hk '' sphere 0 1)`, +the chord endpoints `List.ofFn a ++ (List.ofFn b).reverse` are listed in circular order. -/ +theorem isListedInOrderOn_pinched_bd {S : Type w} [TopologicalSpace S] [T2Space S] + {Λ : Set S} {h : S → ℂ} {g : ℂ → S} + (c : IsChart (closure Λ) h g) + {k : ℕ} (hk : 3 ≤ k) {v : Fin (2 * k) → S} + (p_circ : Circle ≃ₜ ↥(subBd Λ)) + (hp_circ_v : ∀ i : Fin (2 * k), (p_circ (Circle.exp (parallelModelAngle k i.1))).1 = v i) + (hg_circ : ∀ w : Circle, g w = (p_circ w).1) + {Δ : Set S} (hΔ_subBd : subBd Δ = g '' (pinchVertHomeo k hk '' sphere (0 : ℂ) 1)) : + let a : Fin (k - 1) → S := fun j => v ⟨j.1, by omega⟩ + let b : Fin (k - 1) → S := fun j => v ⟨2 * k - 2 - j.1, by omega⟩ + (List.ofFn a ++ (List.ofFn b).reverse).Nodup ∧ + GM12.IsListedInOrderOn (subBd Δ) (List.ofFn a ++ (List.ofFn b).reverse) := by + intro a b + let Ψ := pinchVertHomeo k hk + let idx : ℕ → Fin (2 * k) := fun m => + if hm : m < k - 1 then ⟨m, by omega⟩ + else if hm2 : m < 2 * (k - 1) then ⟨m + 1, by omega⟩ + else ⟨0, by omega⟩ + have hlist_get : ∀ (m : ℕ) (hm : m < (List.ofFn a ++ (List.ofFn b).reverse).length), + (List.ofFn a ++ (List.ofFn b).reverse)[m]'hm = v (idx m) := by + intro m hm + have hlen : (List.ofFn a ++ (List.ofFn b).reverse).length = 2 * (k - 1) := by + simp [two_mul] + have hm_lt : m < 2 * (k - 1) := hlen ▸ hm + by_cases hm1 : m < k - 1 + · rw [List.getElem_append_left (by simp [hm1])] + simp [a, idx, hm1] + · rw [List.getElem_append_right (by simp; omega)] + simp only [List.length_ofFn, List.getElem_reverse, List.getElem_ofFn, b, idx, hm1, hm_lt, + ↓reduceDIte] + congr 1 + ext + dsimp + omega + -- Construct `Circle ≃ₜ ↥(subBd Δ)` via `w ↦ g (Ψ w)`. + have hΨ_cb : MapsTo Ψ (closedBall (0 : ℂ) 1) (closedBall (0 : ℂ) 1) := + fun z hz => image_closedBall_pinchVertHomeo_subset k hk ⟨z, hz, rfl⟩ + let φ_map : Circle → ↥(subBd Δ) := fun w => + ⟨g (Ψ w), by + rw [hΔ_subBd] + exact ⟨Ψ w, ⟨w, mem_sphere_zero_iff_norm.mpr (Circle.norm_coe w), rfl⟩, rfl⟩⟩ + have hφ_cont : Continuous φ_map := by + refine Continuous.subtype_mk ?_ _ + have h1 : Continuous (fun w : Circle => Ψ w) := Ψ.continuous.comp continuous_subtype_val + have h2 : ∀ w : Circle, Ψ w ∈ closedBall (0 : ℂ) 1 := + fun w => hΨ_cb (sphere_subset_closedBall (mem_sphere_zero_iff_norm.mpr (Circle.norm_coe w))) + exact c.gc.comp_continuous h1 h2 + have hφ_bij : Function.Bijective φ_map := by + refine ⟨fun w₁ w₂ heq => ?_, fun ⟨y, hy⟩ => ?_⟩ + · have h1 := congrArg Subtype.val heq + have hw₁_cb : Ψ w₁ ∈ closedBall (0 : ℂ) 1 := + hΨ_cb (sphere_subset_closedBall (mem_sphere_zero_iff_norm.mpr (Circle.norm_coe w₁))) + have hw₂_cb : Ψ w₂ ∈ closedBall (0 : ℂ) 1 := + hΨ_cb (sphere_subset_closedBall (mem_sphere_zero_iff_norm.mpr (Circle.norm_coe w₂))) + exact Subtype.ext (Ψ.injective (c.injOn hw₁_cb hw₂_cb h1)) + · rw [hΔ_subBd] at hy + obtain ⟨_, ⟨z, hz_sph, rfl⟩, rfl⟩ := hy + exact ⟨⟨z, hz_sph⟩, Subtype.ext rfl⟩ + let f_Δ : Circle ≃ₜ ↥(subBd Δ) := + hφ_cont.homeoOfEquivCompactToT2 (f := Equiv.ofBijective φ_map hφ_bij) + have hf_Δ_val : ∀ w : Circle, (f_Δ w).1 = g (Ψ w) := fun _ => rfl + have hk1 : 1 ≤ k := by omega + let t_ab : ℕ → ℝ := fun m => + if m < k - 1 then parallelModelAngle k m + else if m < 2 * (k - 1) then parallelModelAngle k (m + 1) + else parallelModelAngle k 0 + 2 * Real.pi + (m : ℝ) + have ht_mono : StrictMono t_ab := by + have hmono₀ := strictMono_parallelModelAngle hk1 + have hbd₀ := parallelModelAngle_lt_add_two_pi hk1 + intro m₁ m₂ hm + dsimp [t_ab] + split_ifs with h1 h2 h3 h4 h5 <;> try omega + · exact hmono₀ hm + · exact hmono₀ (by omega) + · have := hbd₀ m₁ (by omega) + linarith + · exact hmono₀ (by omega) + · have := hbd₀ (m₁ + 1) (by omega) + linarith + · have : (m₁ : ℝ) < (m₂ : ℝ) := Nat.cast_lt.mpr hm + linarith + have ht_bd : ∀ m < (List.ofFn a ++ (List.ofFn b).reverse).length, + t_ab m < t_ab 0 + 2 * Real.pi := by + intro m hm + have hlen : (List.ofFn a ++ (List.ofFn b).reverse).length = 2 * (k - 1) := by + simp [two_mul] + have hm_lt : m < 2 * (k - 1) := hlen ▸ hm + have ht0 : t_ab 0 = parallelModelAngle k 0 := by + dsimp [t_ab]; rw [ite_eq_left (by omega)] + rw [ht0] + dsimp [t_ab] + split_ifs with h1 + · exact parallelModelAngle_lt_add_two_pi hk1 m (by omega) + · exact parallelModelAngle_lt_add_two_pi hk1 (m + 1) (by omega) + have ht_val : ∀ (m : ℕ) (hm : m < (List.ofFn a ++ (List.ofFn b).reverse).length), + (f_Δ (Circle.exp (t_ab m))).1 = (List.ofFn a ++ (List.ofFn b).reverse)[m]'hm := by + intro m hm + rw [hlist_get m hm, hf_Δ_val] + have hlen : (List.ofFn a ++ (List.ofFn b).reverse).length = 2 * (k - 1) := by + simp [two_mul] + have hm_lt : m < 2 * (k - 1) := hlen ▸ hm + by_cases hm1 : m < k - 1 + · have ht_m : t_ab m = parallelModelAngle k m := by + dsimp [t_ab]; rw [ite_eq_left hm1] + have hidx_m : idx m = ⟨m, by omega⟩ := by + dsimp [idx]; rw [dite_eq_left hm1] + rw [ht_m, hidx_m] + let j : Fin (k - 1) := ⟨m, hm1⟩ + have hexp : (Circle.exp (parallelModelAngle k j.1) : ℂ) = ⟨parallelX k j, parallelY k j⟩ := + circle_exp_parallelModelAngle_top j + have hΨ_fix : Ψ (Circle.exp (parallelModelAngle k j.1)) = + Circle.exp (parallelModelAngle k j.1) := by + rw [hexp] + exact pinchVertHomeo_apply_of_re_eq hk j rfl + change g (Ψ (Circle.exp (parallelModelAngle k j.1))) = v ⟨j.1, by omega⟩ + rw [hΨ_fix, hg_circ] + exact hp_circ_v ⟨j.1, by omega⟩ + · have ht_m : t_ab m = parallelModelAngle k (m + 1) := by + dsimp [t_ab]; rw [ite_eq_right hm1, ite_eq_left hm_lt] + have hidx_m : idx m = ⟨m + 1, by omega⟩ := by + dsimp [idx]; rw [dite_eq_right hm1, dite_eq_left hm_lt] + rw [ht_m, hidx_m] + let j : Fin (k - 1) := ⟨2 * k - 3 - m, by omega⟩ + have hj_sub : 2 * k - 2 - j.1 = m + 1 := by dsimp [j]; omega + have hexp : (Circle.exp (parallelModelAngle k (m + 1)) : ℂ) = + ⟨parallelX k j, -parallelY k j⟩ := by + rw [← hj_sub] + exact circle_exp_parallelModelAngle_bot j + have hΨ_fix : Ψ (Circle.exp (parallelModelAngle k (m + 1))) = + Circle.exp (parallelModelAngle k (m + 1)) := by + rw [hexp] + exact pinchVertHomeo_apply_of_re_eq hk j rfl + change g (Ψ (Circle.exp (parallelModelAngle k (m + 1)))) = v ⟨m + 1, by omega⟩ + rw [hΨ_fix, hg_circ] + exact hp_circ_v ⟨m + 1, by omega⟩ + have hOrd : GM12.IsListedInOrderOn (subBd Δ) (List.ofFn a ++ (List.ofFn b).reverse) := + ⟨f_Δ, t_ab, ht_mono, ht_bd, ht_val⟩ + -- Deduce `Nodup` from `ht_val` and injectivity on `[t_ab 0, t_ab 0 + 2π)`. + have hNodup : (List.ofFn a ++ (List.ofFn b).reverse).Nodup := by + rw [List.nodup_iff_injective_getElem] + intro ⟨m₁, hm₁⟩ ⟨m₂, hm₂⟩ heq + apply Fin.ext + dsimp at heq + rw [← ht_val m₁ hm₁, ← ht_val m₂ hm₂] at heq + have h_exp : Circle.exp (t_ab m₁) = Circle.exp (t_ab m₂) := + f_Δ.injective (Subtype.ext heq) + have h_t_eq : t_ab m₁ = t_ab m₂ := + eq_of_circle_exp_eq_of_mem_Ico + ⟨ht_mono.monotone (Nat.zero_le m₁), ht_bd m₁ hm₁⟩ + ⟨ht_mono.monotone (Nat.zero_le m₂), ht_bd m₂ hm₂⟩ h_exp + exact ht_mono.injective h_t_eq + exact ⟨hNodup, hOrd⟩ + +theorem leftSphereArc_subset_sphere (r : ℝ) : leftSphereArc r ⊆ sphere (0 : ℂ) 1 := + fun _ hz => hz.1 + +theorem rightSphereArc_subset_sphere (r : ℝ) : rightSphereArc r ⊆ sphere (0 : ℂ) 1 := + fun _ hz => hz.1 + +theorem vertChord_subset_closedBall (r : ℝ) : vertChord r ⊆ closedBall (0 : ℂ) 1 := + fun _ hz => hz.1 + +theorem leftSphereArc_inter_vertChord {r y : ℝ} (hry : r ^ 2 + y ^ 2 = 1) : + leftSphereArc r ∩ vertChord r = {⟨r, y⟩, ⟨r, -y⟩} := by + ext z + simp only [mem_inter_iff, leftSphereArc, vertChord, mem_ofPred_eq, + mem_sphere_unit_iff, mem_closedBall_unit_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨⟨hsph, _⟩, ⟨_, rfl⟩⟩ + have him : z.im ^ 2 = y ^ 2 := by linarith + rcases sq_eq_sq_iff_eq_or_eq_neg.mp him with h | h + · left; exact Complex.ext rfl h + · right; exact Complex.ext rfl h + · rintro (rfl | rfl) + · exact ⟨⟨by linarith, le_rfl⟩, ⟨by linarith, rfl⟩⟩ + · exact ⟨⟨by dsimp; linarith, le_rfl⟩, ⟨by dsimp; linarith, rfl⟩⟩ + +theorem rightSphereArc_inter_vertChord {r y : ℝ} (hry : r ^ 2 + y ^ 2 = 1) : + rightSphereArc r ∩ vertChord r = {⟨r, y⟩, ⟨r, -y⟩} := by + ext z + simp only [mem_inter_iff, rightSphereArc, vertChord, mem_ofPred_eq, + mem_sphere_unit_iff, mem_closedBall_unit_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨⟨hsph, _⟩, ⟨_, rfl⟩⟩ + have him : z.im ^ 2 = y ^ 2 := by linarith + rcases sq_eq_sq_iff_eq_or_eq_neg.mp him with h | h + · left; exact Complex.ext rfl h + · right; exact Complex.ext rfl h + · rintro (rfl | rfl) + · exact ⟨⟨by linarith, le_rfl⟩, ⟨by linarith, rfl⟩⟩ + · exact ⟨⟨by dsimp; linarith, le_rfl⟩, ⟨by dsimp; linarith, rfl⟩⟩ + +theorem leftSphereArcMap_zero (θ₀ : ℝ) : + leftSphereArcMap θ₀ 0 = (Circle.exp θ₀ : ℂ) := by + unfold leftSphereArcMap + simp + +theorem leftSphereArcMap_one (θ₀ : ℝ) : + leftSphereArcMap θ₀ 1 = (Circle.exp (2 * Real.pi - θ₀) : ℂ) := by + unfold leftSphereArcMap + congr 2 + push_cast + ring + +theorem rightSphereArcMap_zero (θ₀ : ℝ) : + rightSphereArcMap θ₀ 0 = (Circle.exp (2 * Real.pi - θ₀) : ℂ) := by + unfold rightSphereArcMap + simp + +theorem rightSphereArcMap_one (θ₀ : ℝ) : + rightSphereArcMap θ₀ 1 = (Circle.exp θ₀ : ℂ) := by + unfold rightSphereArcMap + have h : (2 * Real.pi - θ₀) + 2 * θ₀ * ((1 : unitInterval) : ℝ) = θ₀ + 2 * Real.pi := by + push_cast; ring + rw [h, Circle.exp_add, Circle.exp_two_pi, mul_one] + +/-- `subBd r₁ = g '' leftSphereArc x_last ∪ L j_last` is an `O`-arc, and any four vertices +`w₁, w₂, w₃, w₄ ∈ H.V ∩ subBd Λ` appearing in circular order between `v ⟨k - 2, _⟩` and +`v ⟨k, _⟩` on `subBd Λ` occur in circuit order on `H'.interSet (subBd r₁)`. -/ +theorem occurInCircuitOrder_leftCap {S : Type w} [TopologicalSpace S] [T2Space S] + {H H' : Drawing S} {Λ r₁ : Set S} {h : S → ℂ} {g : ℂ → S} + (c : IsChart (closure Λ) h g) + {k : ℕ} (hk : 3 ≤ k) {v : Fin (2 * k) → S} + (p_circ : Circle ≃ₜ ↥(subBd Λ)) + (hp_circ_v : ∀ i : Fin (2 * k), (p_circ (Circle.exp (parallelModelAngle k i.1))).1 = v i) + (hg_circ : ∀ w : Circle, g w = (p_circ w).1) + (hSub_H : H.IsSubdrawing H') + (hr₁_bd : subBd r₁ = + g '' leftSphereArc (parallelX k ⟨k - 2, by omega⟩) ∪ + g '' vertChord (parallelX k ⟨k - 2, by omega⟩)) : + IsOArc (subBd r₁) ∧ + ((H'.interSet (subBd r₁)).U = subBd r₁ → + ∀ w₁ w₂ w₃ w₄ : S, + w₁ ∈ H.V ∩ subBd Λ → w₂ ∈ H.V ∩ subBd Λ → + w₃ ∈ H.V ∩ subBd Λ → w₄ ∈ H.V ∩ subBd Λ → + GM12.IsListedInOrderOn (subBd Λ) + (List.ofFn (fun j : Fin (k - 1) => v ⟨j.1, by omega⟩) ++ [w₁, w₂, w₃, w₄] ++ + List.ofFn (fun j : Fin k => v ⟨k + j.1, by omega⟩)) → + w₁ ∈ (H'.interSet (subBd r₁)).V ∧ w₂ ∈ (H'.interSet (subBd r₁)).V ∧ + w₃ ∈ (H'.interSet (subBd r₁)).V ∧ w₄ ∈ (H'.interSet (subBd r₁)).V ∧ + OccurInCircuitOrder (H'.interSet (subBd r₁)) w₁ w₂ w₃ w₄) := by + have hk1 : 1 ≤ k := by omega + let j_last : Fin (k - 1) := ⟨k - 2, by omega⟩ + let θ_last : ℝ := parallelModelAngle k j_last.1 + obtain ⟨hθ_last_pos, hθ_last_pi⟩ := parallelModelAngle_mem_Ioo_pi j_last.2 + let x_last : ℝ := parallelX k j_last + let y_last : ℝ := parallelY k j_last + let a_last : S := g ⟨x_last, y_last⟩ + let b_last : S := g ⟨x_last, -y_last⟩ + let a₁ : unitInterval → S := g ∘ leftSphereArcMap θ_last + have hArc_left : IsArcMap (leftSphereArcMap θ_last) := + isArcMap_leftSphereArcMap hθ_last_pos hθ_last_pi + have hRange_left : range (leftSphereArcMap θ_last) = leftSphereArc x_last := + range_leftSphereArcMap hθ_last_pos hθ_last_pi + have hLeft_cb : leftSphereArc x_last ⊆ closedBall (0 : ℂ) 1 := + (leftSphereArc_subset_sphere x_last).trans sphere_subset_closedBall + have hmaps_left : ∀ t : unitInterval, + leftSphereArcMap θ_last t ∈ closedBall (0 : ℂ) 1 := + fun t => hLeft_cb (hRange_left ▸ ⟨t, rfl⟩) + have ha₁_arc : IsArcMap a₁ := by + refine ⟨c.gc.comp_continuous hArc_left.1 hmaps_left, fun t₁ t₂ heq => ?_⟩ + exact hArc_left.2 (c.injOn (hmaps_left t₁) (hmaps_left t₂) heq) + have ha₁_range : range a₁ = g '' leftSphereArc x_last := by + rw [range_comp, hRange_left] + have ha₁_0 : a₁ 0 = a_last := by + change g (leftSphereArcMap θ_last 0) = a_last + rw [leftSphereArcMap_zero] + exact congrArg g (circle_exp_parallelModelAngle_top j_last) + have ha₁_1 : a₁ 1 = b_last := by + change g (leftSphereArcMap θ_last 1) = b_last + rw [leftSphereArcMap_one, ← parallelModelAngle_partner j_last.2] + exact congrArg g (circle_exp_parallelModelAngle_bot j_last) + have hL_line : IsLineWithEnds (g '' vertChord x_last) a_last b_last := + (isLineWithEnds_image_vertChord c (parallelX_sq_add_parallelY_sq j_last) + (parallelY_pos j_last)).1 + obtain ⟨a₂, ha₂_arc, ha₂_range, ha₂_0, ha₂_1⟩ := hL_line.exists_arc + have hinter_arcs : range a₁ ∩ range a₂ = {a_last, b_last} := by + rw [ha₁_range, ha₂_range, ← c.g_inter hLeft_cb (vertChord_subset_closedBall x_last), + leftSphereArc_inter_vertChord (parallelX_sq_add_parallelY_sq j_last), image_pair] + have h01 : ∀ s t, a₁ s = a₂ t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + intro s t hst + have hmem : a₁ s ∈ range a₁ ∩ range a₂ := ⟨⟨s, rfl⟩, ⟨t, hst.symm⟩⟩ + rw [hinter_arcs] at hmem + rcases hmem with h_eq | h_eq + · left + have hs : s = 0 := ha₁_arc.2 (h_eq.trans ha₁_0.symm) + have ht : t = 0 := ha₂_arc.2 (hst.symm.trans (h_eq.trans ha₂_0.symm)) + exact ⟨hs, ht⟩ + · right + have hs : s = 1 := ha₁_arc.2 (h_eq.trans ha₁_1.symm) + have ht : t = 1 := ha₂_arc.2 (hst.symm.trans (h_eq.trans ha₂_1.symm)) + exact ⟨hs, ht⟩ + have hsubBd_union : subBd r₁ = range a₁ ∪ range a₂ := by + rw [hr₁_bd, ha₁_range, ha₂_range] + have htwo := oArc_and_occurInCircuitOrder_of_two_arcs ha₁_arc ha₂_arc + (ha₁_0.trans ha₂_0.symm) (ha₁_1.trans ha₂_1.symm) h01 + refine ⟨hsubBd_union ▸ htwo.1, fun hU_r₁ w₁ w₂ w₃ w₄ hw₁ hw₂ hw₃ hw₄ hl₁_ord => ?_⟩ + let A_list := List.ofFn (fun j : Fin (k - 1) => v ⟨j.1, by omega⟩) + let B_list := List.ofFn (fun j : Fin k => v ⟨k + j.1, by omega⟩) + set l₁ := A_list ++ [w₁, w₂, w₃, w₄] ++ B_list + have hlen_A : A_list.length = k - 1 := List.length_ofFn + have hlen_B : B_list.length = k := List.length_ofFn + have hlen_l₁ : l₁.length = 2 * k + 3 := by + simp [l₁, A_list, B_list]; omega + have hl₁_0 : (p_circ (Circle.exp (parallelModelAngle k 0))).1 = l₁[0]'(by omega) := by + have hget0 : l₁[0]'(by omega) = v ⟨0, by omega⟩ := by + dsimp [l₁] + rw [List.getElem_append_left (by simp [A_list]), + List.getElem_append_left (by simp [A_list]; omega)] + simp [A_list] + rw [hget0] + exact hp_circ_v ⟨0, by omega⟩ + have hl₁_1 : (p_circ (Circle.exp (parallelModelAngle k 1))).1 = l₁[1]'(by omega) := by + have hget1 : l₁[1]'(by omega) = v ⟨1, by omega⟩ := by + dsimp [l₁] + rw [List.getElem_append_left (by simp [A_list]), + List.getElem_append_left (by simp [A_list]; omega)] + simp [A_list] + rw [hget1] + exact hp_circ_v ⟨1, by omega⟩ + have hl₁_kp3 : (p_circ (Circle.exp (parallelModelAngle k k))).1 = l₁[k + 3]'(by omega) := by + have hget : l₁[k + 3]'(by omega) = v ⟨k, by omega⟩ := by + dsimp [l₁] + rw [List.getElem_append_right (by simp [A_list]; omega)] + have hlen_AW : (A_list ++ [w₁, w₂, w₃, w₄]).length = k + 3 := by simp [A_list]; omega + simp only [hlen_AW, Nat.sub_self, B_list, List.getElem_ofFn, add_zero] + rw [hget] + exact hp_circ_v ⟨k, by omega⟩ + obtain ⟨θ, hθ_mono, hθ_0, hθ_bd, hθ_val, hθ_uniq⟩ := + exists_increasing_angles_of_isListedInOrderOn p_circ (l := l₁) hl₁_ord + (idx₂ := k + 3) (by omega) (by omega) + (strictMono_parallelModelAngle hk1 Nat.zero_lt_one) + (strictMono_parallelModelAngle hk1 (by omega : 1 < k)) + (parallelModelAngle_lt_add_two_pi hk1 k (by omega)) + hl₁_0 hl₁_1 hl₁_kp3 + have hmodel_Ico : ∀ m < 2 * k, + parallelModelAngle k m ∈ Ico (parallelModelAngle k 0) (parallelModelAngle k 0 + 2 * Real.pi) + := + fun m hm => ⟨(strictMono_parallelModelAngle hk1).monotone (Nat.zero_le m), + parallelModelAngle_lt_add_two_pi hk1 m hm⟩ + have hθ_km2 : θ (k - 2) = parallelModelAngle k (k - 2) := by + have hget : l₁[k - 2]'(by omega) = v ⟨k - 2, by omega⟩ := by + dsimp [l₁] + rw [List.getElem_append_left (by simp [A_list]; omega), + List.getElem_append_left (by simp [A_list]; omega)] + simp [A_list] + exact hθ_uniq (k - 2) (by omega) (parallelModelAngle k (k - 2)) (hmodel_Ico (k - 2) (by omega)) + ((hp_circ_v ⟨k - 2, by omega⟩).trans hget.symm) + have hθ_kp3 : θ (k + 3) = parallelModelAngle k k := + hθ_uniq (k + 3) (by omega) (parallelModelAngle k k) (hmodel_Ico k (by omega)) hl₁_kp3 + have hget_w : l₁[k - 1]'(by omega) = w₁ ∧ l₁[k]'(by omega) = w₂ ∧ + l₁[k + 1]'(by omega) = w₃ ∧ l₁[k + 2]'(by omega) = w₄ := by + have h_elem : ∀ (i m : ℕ) (hi : i < l₁.length) (hm : m < 4), + i = k - 1 + m → l₁[i]'hi = [w₁, w₂, w₃, w₄][m]'hm := by + rintro _ m hi hm rfl + dsimp [l₁] + rw [List.getElem_append_left (by simp [A_list]; omega), + List.getElem_append_right (by simp [A_list])] + simp only [hlen_A, Nat.add_sub_cancel_left] + exact ⟨h_elem (k - 1) 0 (by omega) (by omega) (by omega), + h_elem k 1 (by omega) (by omega) (by omega), + h_elem (k + 1) 2 (by omega) (by omega) (by omega), + h_elem (k + 2) 3 (by omega) (by omega) (by omega)⟩ + have hlt1 : parallelModelAngle k (k - 2) < θ (k - 1) := + hθ_km2 ▸ hθ_mono (by omega : k - 2 < k - 1) + have hlt2 : θ (k - 1) < θ k := hθ_mono (by omega) + have hlt3 : θ k < θ (k + 1) := hθ_mono (by omega) + have hlt4 : θ (k + 1) < θ (k + 2) := hθ_mono (by omega) + have hlt5 : θ (k + 2) < parallelModelAngle k k := + hθ_kp3 ▸ hθ_mono (by omega : k + 2 < k + 3) + have h_partner_k : parallelModelAngle k k = 2 * Real.pi - θ_last := by + have h := parallelModelAngle_partner j_last.2 + have hsub : 2 * k - 2 - j_last.1 = k := by dsimp [j_last]; omega + rwa [hsub] at h + let Δθ : ℝ := 2 * Real.pi - 2 * θ_last + have hΔθ_eq : Δθ = parallelModelAngle k k - parallelModelAngle k (k - 2) := by + dsimp [Δθ, θ_last, j_last] + linarith [h_partner_k] + have hΔθ_pos : 0 < Δθ := by + rw [hΔθ_eq]; linarith + let s₁_r : ℝ := (θ (k - 1) - θ_last) / Δθ + let s₂_r : ℝ := (θ k - θ_last) / Δθ + let s₃_r : ℝ := (θ (k + 1) - θ_last) / Δθ + let s₄_r : ℝ := (θ (k + 2) - θ_last) / Δθ + have hs_ord : 0 < s₁_r ∧ s₁_r < s₂_r ∧ s₂_r < s₃_r ∧ s₃_r < s₄_r ∧ s₄_r < 1 := + ⟨div_pos (by dsimp [θ_last, j_last]; linarith) hΔθ_pos, + div_lt_div_of_pos_right (by linarith) hΔθ_pos, + div_lt_div_of_pos_right (by linarith) hΔθ_pos, + div_lt_div_of_pos_right (by linarith) hΔθ_pos, + (div_lt_one hΔθ_pos).mpr (by rw [hΔθ_eq]; dsimp [θ_last, j_last]; linarith)⟩ + let s₁ : unitInterval := ⟨s₁_r, ⟨hs_ord.1.le, by linarith [hs_ord.2.1, hs_ord.2.2.1, + hs_ord.2.2.2.1, hs_ord.2.2.2.2]⟩⟩ + let s₂ : unitInterval := ⟨s₂_r, ⟨by linarith [hs_ord.1, hs_ord.2.1], by linarith [hs_ord.2.2.1, + hs_ord.2.2.2.1, hs_ord.2.2.2.2]⟩⟩ + let s₃ : unitInterval := ⟨s₃_r, ⟨by linarith [hs_ord.1, hs_ord.2.1, hs_ord.2.2.1], by linarith + [hs_ord.2.2.2.1, hs_ord.2.2.2.2]⟩⟩ + let s₄ : unitInterval := ⟨s₄_r, ⟨by linarith [hs_ord.1, hs_ord.2.1, hs_ord.2.2.1, + hs_ord.2.2.2.1], hs_ord.2.2.2.2.le⟩⟩ + have ha₁_apply : ∀ (m : ℕ) (hm : m < l₁.length) (s : unitInterval), + (s : ℝ) = (θ m - θ_last) / Δθ → a₁ s = l₁[m]'hm := by + intro m hm s hs + change g (Circle.exp (θ_last + Δθ * (s : ℝ))) = l₁[m]'hm + rw [hs] + have h_angle : θ_last + Δθ * ((θ m - θ_last) / Δθ) = θ m := by + rw [mul_div_cancel₀ _ (ne_of_gt hΔθ_pos)] + ring + rw [h_angle, hg_circ, hθ_val m hm] + have hs₁_val : a₁ s₁ = w₁ := (ha₁_apply (k - 1) (by omega) s₁ rfl).trans hget_w.1 + have hs₂_val : a₁ s₂ = w₂ := (ha₁_apply k (by omega) s₂ rfl).trans hget_w.2.1 + have hs₃_val : a₁ s₃ = w₃ := (ha₁_apply (k + 1) (by omega) s₃ rfl).trans hget_w.2.2.1 + have hs₄_val : a₁ s₄ = w₄ := (ha₁_apply (k + 2) (by omega) s₄ rfl).trans hget_w.2.2.2 + have hcl_r₁ : IsClosed (subBd r₁) := isClosed_closure.inter isClosed_closure + have hw_V : ∀ {w : S} {s : unitInterval}, w ∈ H.V ∩ subBd Λ → a₁ s = w → + w ∈ (H'.interSet (subBd r₁)).V := by + intro w s hw has + rw [interSet_V_of_isClosed H' hcl_r₁] + refine ⟨hSub_H.1 hw.1, ?_⟩ + rw [hsubBd_union] + exact Or.inl ⟨s, has⟩ + refine ⟨hw_V hw₁ hs₁_val, hw_V hw₂ hs₂_val, hw_V hw₃ hs₃_val, hw_V hw₄ hs₄_val, ?_⟩ + rw [← hs₁_val, ← hs₂_val, ← hs₃_val, ← hs₄_val] + exact htwo.2 (hU_r₁.trans hsubBd_union) + (show s₁ < s₂ from hs_ord.2.1) + (show s₂ < s₃ from hs_ord.2.2.1) + (show s₃ < s₄ from hs_ord.2.2.2.1) + +/-- `subBd r₂ = g '' rightSphereArc x_first ∪ L 0` is an `O`-arc, and any four vertices +`u₁, u₂, u₃, u₄ ∈ H.V ∩ subBd Λ` appearing in circular order after `v ⟨2 * k - 2, _⟩` on `subBd Λ` +occur in circuit order on `H'.interSet (subBd r₂)`. -/ +theorem occurInCircuitOrder_rightCap {S : Type w} [TopologicalSpace S] [T2Space S] + {H H' : Drawing S} {Λ r₂ : Set S} {h : S → ℂ} {g : ℂ → S} + (c : IsChart (closure Λ) h g) + {k : ℕ} (hk : 3 ≤ k) {v : Fin (2 * k) → S} + (p_circ : Circle ≃ₜ ↥(subBd Λ)) + (hp_circ_v : ∀ i : Fin (2 * k), (p_circ (Circle.exp (parallelModelAngle k i.1))).1 = v i) + (hg_circ : ∀ w : Circle, g w = (p_circ w).1) + (hSub_H : H.IsSubdrawing H') + (hr₂_bd : subBd r₂ = + g '' rightSphereArc (parallelX k ⟨0, by omega⟩) ∪ + g '' vertChord (parallelX k ⟨0, by omega⟩)) : + IsOArc (subBd r₂) ∧ + ((H'.interSet (subBd r₂)).U = subBd r₂ → + ∀ u₁ u₂ u₃ u₄ : S, + u₁ ∈ H.V ∩ subBd Λ → u₂ ∈ H.V ∩ subBd Λ → + u₃ ∈ H.V ∩ subBd Λ → u₄ ∈ H.V ∩ subBd Λ → + GM12.IsListedInOrderOn (subBd Λ) + (List.ofFn (fun j : Fin (2 * k - 1) => v ⟨j.1, by omega⟩) ++ [u₁, u₂, u₃, u₄]) → + u₁ ∈ (H'.interSet (subBd r₂)).V ∧ u₂ ∈ (H'.interSet (subBd r₂)).V ∧ + u₃ ∈ (H'.interSet (subBd r₂)).V ∧ u₄ ∈ (H'.interSet (subBd r₂)).V ∧ + OccurInCircuitOrder (H'.interSet (subBd r₂)) u₁ u₂ u₃ u₄) := by + have hk1 : 1 ≤ k := by omega + let j_first : Fin (k - 1) := ⟨0, by omega⟩ + let θ_first : ℝ := parallelModelAngle k j_first.1 + obtain ⟨hθ_first_pos, hθ_first_pi⟩ := parallelModelAngle_mem_Ioo_pi j_first.2 + let x_first : ℝ := parallelX k j_first + let y_first : ℝ := parallelY k j_first + let a_first : S := g ⟨x_first, y_first⟩ + let b_first : S := g ⟨x_first, -y_first⟩ + let a₁ : unitInterval → S := g ∘ rightSphereArcMap θ_first + have hArc_right : IsArcMap (rightSphereArcMap θ_first) := + isArcMap_rightSphereArcMap hθ_first_pos hθ_first_pi + have hRange_right : range (rightSphereArcMap θ_first) = rightSphereArc x_first := + range_rightSphereArcMap hθ_first_pos hθ_first_pi + have hRight_cb : rightSphereArc x_first ⊆ closedBall (0 : ℂ) 1 := + (rightSphereArc_subset_sphere x_first).trans sphere_subset_closedBall + have hmaps_right : ∀ t : unitInterval, + rightSphereArcMap θ_first t ∈ closedBall (0 : ℂ) 1 := + fun t => hRight_cb (hRange_right ▸ ⟨t, rfl⟩) + have ha₁_arc : IsArcMap a₁ := by + refine ⟨c.gc.comp_continuous hArc_right.1 hmaps_right, fun t₁ t₂ heq => ?_⟩ + exact hArc_right.2 (c.injOn (hmaps_right t₁) (hmaps_right t₂) heq) + have ha₁_range : range a₁ = g '' rightSphereArc x_first := by + rw [range_comp, hRange_right] + have ha₁_0 : a₁ 0 = b_first := by + change g (rightSphereArcMap θ_first 0) = b_first + rw [rightSphereArcMap_zero, ← parallelModelAngle_partner j_first.2] + exact congrArg g (circle_exp_parallelModelAngle_bot j_first) + have ha₁_1 : a₁ 1 = a_first := by + change g (rightSphereArcMap θ_first 1) = a_first + rw [rightSphereArcMap_one] + exact congrArg g (circle_exp_parallelModelAngle_top j_first) + have hL_line : IsLineWithEnds (g '' vertChord x_first) b_first a_first := + ((isLineWithEnds_image_vertChord c (parallelX_sq_add_parallelY_sq j_first) + (parallelY_pos j_first)).1).symm + obtain ⟨a₂, ha₂_arc, ha₂_range, ha₂_0, ha₂_1⟩ := hL_line.exists_arc + have hinter_arcs : range a₁ ∩ range a₂ = {b_first, a_first} := by + rw [ha₁_range, ha₂_range, ← c.g_inter hRight_cb (vertChord_subset_closedBall x_first), + rightSphereArc_inter_vertChord (parallelX_sq_add_parallelY_sq j_first), image_pair, + pair_comm] + have h01 : ∀ s t, a₁ s = a₂ t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + intro s t hst + have hmem : a₁ s ∈ range a₁ ∩ range a₂ := ⟨⟨s, rfl⟩, ⟨t, hst.symm⟩⟩ + rw [hinter_arcs] at hmem + rcases hmem with h_eq | h_eq + · left + have hs : s = 0 := ha₁_arc.2 (h_eq.trans ha₁_0.symm) + have ht : t = 0 := ha₂_arc.2 (hst.symm.trans (h_eq.trans ha₂_0.symm)) + exact ⟨hs, ht⟩ + · right + have hs : s = 1 := ha₁_arc.2 (h_eq.trans ha₁_1.symm) + have ht : t = 1 := ha₂_arc.2 (hst.symm.trans (h_eq.trans ha₂_1.symm)) + exact ⟨hs, ht⟩ + have hsubBd_union : subBd r₂ = range a₁ ∪ range a₂ := by + rw [hr₂_bd, ha₁_range, ha₂_range] + have htwo := oArc_and_occurInCircuitOrder_of_two_arcs ha₁_arc ha₂_arc + (ha₁_0.trans ha₂_0.symm) (ha₁_1.trans ha₂_1.symm) h01 + refine ⟨hsubBd_union ▸ htwo.1, fun hU_r₂ u₁ u₂ u₃ u₄ hu₁ hu₂ hu₃ hu₄ hl₂_ord => ?_⟩ + let A_list := List.ofFn (fun j : Fin (2 * k - 1) => v ⟨j.1, by omega⟩) + set l₂ := A_list ++ [u₁, u₂, u₃, u₄] + have hlen_A : A_list.length = 2 * k - 1 := List.length_ofFn + have hlen_l₂ : l₂.length = 2 * k + 3 := by + simp [l₂, A_list]; omega + have hl₂_0 : (p_circ (Circle.exp (parallelModelAngle k 0))).1 = l₂[0]'(by omega) := by + have hget0 : l₂[0]'(by omega) = v ⟨0, by omega⟩ := by + dsimp [l₂] + rw [List.getElem_append_left (by simp [A_list]; omega)] + simp [A_list] + rw [hget0] + exact hp_circ_v ⟨0, by omega⟩ + have hl₂_1 : (p_circ (Circle.exp (parallelModelAngle k 1))).1 = l₂[1]'(by omega) := by + have hget1 : l₂[1]'(by omega) = v ⟨1, by omega⟩ := by + dsimp [l₂] + rw [List.getElem_append_left (by simp [A_list]; omega)] + simp [A_list] + rw [hget1] + exact hp_circ_v ⟨1, by omega⟩ + have hl₂_2 : (p_circ (Circle.exp (parallelModelAngle k 2))).1 = l₂[2]'(by omega) := by + have hget2 : l₂[2]'(by omega) = v ⟨2, by omega⟩ := by + dsimp [l₂] + rw [List.getElem_append_left (by simp [A_list]; omega)] + simp [A_list] + rw [hget2] + exact hp_circ_v ⟨2, by omega⟩ + obtain ⟨θ, hθ_mono, hθ_0, hθ_bd, hθ_val, hθ_uniq⟩ := + exists_increasing_angles_of_isListedInOrderOn p_circ (l := l₂) hl₂_ord + (idx₂ := 2) (by omega) (by omega) + (strictMono_parallelModelAngle hk1 Nat.zero_lt_one) + (strictMono_parallelModelAngle hk1 (by omega : 1 < 2)) + (parallelModelAngle_lt_add_two_pi hk1 2 (by omega)) + hl₂_0 hl₂_1 hl₂_2 + have hmodel_Ico : ∀ m < 2 * k, + parallelModelAngle k m ∈ Ico (parallelModelAngle k 0) (parallelModelAngle k 0 + 2 * Real.pi) + := + fun m hm => ⟨(strictMono_parallelModelAngle hk1).monotone (Nat.zero_le m), + parallelModelAngle_lt_add_two_pi hk1 m hm⟩ + have hθ_2km2 : θ (2 * k - 2) = parallelModelAngle k (2 * k - 2) := by + have hget : l₂[2 * k - 2]'(by omega) = v ⟨2 * k - 2, by omega⟩ := by + dsimp [l₂] + rw [List.getElem_append_left (by simp [A_list]; omega)] + simp [A_list] + exact hθ_uniq (2 * k - 2) (by omega) (parallelModelAngle k (2 * k - 2)) + (hmodel_Ico (2 * k - 2) (by omega)) ((hp_circ_v ⟨2 * k - 2, by omega⟩).trans hget.symm) + have hget_u : l₂[2 * k - 1]'(by omega) = u₁ ∧ l₂[2 * k]'(by omega) = u₂ ∧ + l₂[2 * k + 1]'(by omega) = u₃ ∧ l₂[2 * k + 2]'(by omega) = u₄ := by + have h_elem : ∀ (i m : ℕ) (hi : i < l₂.length) (hm : m < 4), + i = 2 * k - 1 + m → l₂[i]'hi = [u₁, u₂, u₃, u₄][m]'hm := by + rintro _ m hi hm rfl + dsimp [l₂] + rw [List.getElem_append_right (by simp [A_list])] + simp only [hlen_A, Nat.add_sub_cancel_left] + exact ⟨h_elem (2 * k - 1) 0 (by omega) (by omega) (by omega), + h_elem (2 * k) 1 (by omega) (by omega) (by omega), + h_elem (2 * k + 1) 2 (by omega) (by omega) (by omega), + h_elem (2 * k + 2) 3 (by omega) (by omega) (by omega)⟩ + have hlt1 : parallelModelAngle k (2 * k - 2) < θ (2 * k - 1) := + hθ_2km2 ▸ hθ_mono (by omega : 2 * k - 2 < 2 * k - 1) + have hlt2 : θ (2 * k - 1) < θ (2 * k) := hθ_mono (by omega) + have hlt3 : θ (2 * k) < θ (2 * k + 1) := hθ_mono (by omega) + have hlt4 : θ (2 * k + 1) < θ (2 * k + 2) := hθ_mono (by omega) + have hlt5 : θ (2 * k + 2) < parallelModelAngle k 0 + 2 * Real.pi := + hθ_bd (2 * k + 2) (by omega) + have h_partner_0 : parallelModelAngle k (2 * k - 2) = 2 * Real.pi - θ_first := by + have h := parallelModelAngle_partner j_first.2 + have hsub : 2 * k - 2 - j_first.1 = 2 * k - 2 := rfl + rwa [hsub] at h + let Δθ : ℝ := 2 * θ_first + have hΔθ_eq : Δθ = parallelModelAngle k 0 + 2 * Real.pi - parallelModelAngle k (2 * k - 2) := by + dsimp [Δθ, θ_first, j_first] + linarith [h_partner_0] + have hΔθ_pos : 0 < Δθ := by + rw [hΔθ_eq]; linarith + let s₁_r : ℝ := (θ (2 * k - 1) - (2 * Real.pi - θ_first)) / Δθ + let s₂_r : ℝ := (θ (2 * k) - (2 * Real.pi - θ_first)) / Δθ + let s₃_r : ℝ := (θ (2 * k + 1) - (2 * Real.pi - θ_first)) / Δθ + let s₄_r : ℝ := (θ (2 * k + 2) - (2 * Real.pi - θ_first)) / Δθ + have hs_ord : 0 < s₁_r ∧ s₁_r < s₂_r ∧ s₂_r < s₃_r ∧ s₃_r < s₄_r ∧ s₄_r < 1 := + ⟨div_pos (by linarith [h_partner_0]) hΔθ_pos, + div_lt_div_of_pos_right (by linarith) hΔθ_pos, + div_lt_div_of_pos_right (by linarith) hΔθ_pos, + div_lt_div_of_pos_right (by linarith) hΔθ_pos, + (div_lt_one hΔθ_pos).mpr (by rw [hΔθ_eq]; linarith [h_partner_0])⟩ + let s₁ : unitInterval := ⟨s₁_r, ⟨hs_ord.1.le, by linarith [hs_ord.2.1, hs_ord.2.2.1, + hs_ord.2.2.2.1, hs_ord.2.2.2.2]⟩⟩ + let s₂ : unitInterval := ⟨s₂_r, ⟨by linarith [hs_ord.1, hs_ord.2.1], by linarith [hs_ord.2.2.1, + hs_ord.2.2.2.1, hs_ord.2.2.2.2]⟩⟩ + let s₃ : unitInterval := ⟨s₃_r, ⟨by linarith [hs_ord.1, hs_ord.2.1, hs_ord.2.2.1], by linarith + [hs_ord.2.2.2.1, hs_ord.2.2.2.2]⟩⟩ + let s₄ : unitInterval := ⟨s₄_r, ⟨by linarith [hs_ord.1, hs_ord.2.1, hs_ord.2.2.1, + hs_ord.2.2.2.1], hs_ord.2.2.2.2.le⟩⟩ + have ha₁_apply : ∀ (m : ℕ) (hm : m < l₂.length) (s : unitInterval), + (s : ℝ) = (θ m - (2 * Real.pi - θ_first)) / Δθ → a₁ s = l₂[m]'hm := by + intro m hm s hs + change g (Circle.exp ((2 * Real.pi - θ_first) + Δθ * (s : ℝ))) = l₂[m]'hm + rw [hs] + have h_angle : (2 * Real.pi - θ_first) + Δθ * ((θ m - (2 * Real.pi - θ_first)) / Δθ) = θ m := by + rw [mul_div_cancel₀ _ (ne_of_gt hΔθ_pos)] + ring + rw [h_angle, hg_circ, hθ_val m hm] + have hs₁_val : a₁ s₁ = u₁ := (ha₁_apply (2 * k - 1) (by omega) s₁ rfl).trans hget_u.1 + have hs₂_val : a₁ s₂ = u₂ := (ha₁_apply (2 * k) (by omega) s₂ rfl).trans hget_u.2.1 + have hs₃_val : a₁ s₃ = u₃ := (ha₁_apply (2 * k + 1) (by omega) s₃ rfl).trans hget_u.2.2.1 + have hs₄_val : a₁ s₄ = u₄ := (ha₁_apply (2 * k + 2) (by omega) s₄ rfl).trans hget_u.2.2.2 + have hcl_r₂ : IsClosed (subBd r₂) := isClosed_closure.inter isClosed_closure + have hu_V : ∀ {u : S} {s : unitInterval}, u ∈ H.V ∩ subBd Λ → a₁ s = u → + u ∈ (H'.interSet (subBd r₂)).V := by + intro u s hu has + rw [interSet_V_of_isClosed H' hcl_r₂] + refine ⟨hSub_H.1 hu.1, ?_⟩ + rw [hsubBd_union] + exact Or.inl ⟨s, has⟩ + refine ⟨hu_V hu₁ hs₁_val, hu_V hu₂ hs₂_val, hu_V hu₃ hs₃_val, hu_V hu₄ hs₄_val, ?_⟩ + rw [← hs₁_val, ← hs₂_val, ← hs₃_val, ← hs₄_val] + exact htwo.2 (hU_r₂.trans hsubBd_union) + (show s₁ < s₂ from hs_ord.2.1) + (show s₂ < s₃ from hs_ord.2.2.1) + (show s₃ < s₄ from hs_ord.2.2.2.1) + +end PlaneChordsAndCaps + +/-! ## 8. Proof of Graph Minors XV, (3.4) -/ + +section Theorem34 + +private theorem isRespectful_inducedBySubgraph' {S : Type w} [TopologicalSpace S] [T2Space S] + {H₀ H' : Drawing S} {θ' : ℕ} + {T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hSub : H₀.IsSubdrawing H') + (hResp₀ : (PaintingOrDrawing.drawing H₀).IsRespectful θ' T₀) : + (PaintingOrDrawing.drawing H').IsRespectful θ' + (GM12.inducedBySubgraph H'.toHypergraph H₀.toHypergraph θ' T₀) := by + exact GM12.isRespectful_inducedBySubgraph hSub hResp₀ + +private theorem rigid_gluing_of_parallel_chords + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (H : Drawing S) + (θ : ℕ) + (k : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (Λ : Set S) + (v : Fin (2 * k) → S) + (i_k : Fin (2 * k)) + (i_last : Fin (2 * k)) + (hk : 3 ≤ k) + (hv_mem : ∀ (i : Fin (2 * k)), v i ∈ H.V ∩ subBd Λ) + (hFree_v : IsFreeSet H.toHypergraph T θ (range v)) + {h : S → ℂ} + {g : ℂ → S} + (c : IsChart (closure Λ) h g) + (H' : Drawing S) + (P' : Fin (k - 1) → Drawing S) + (hSub_H : H.IsSubdrawing H') + (hP'_disj : Pairwise fun i j => Disjoint (P' i).U (P' j).U) + (hS : IsClosedSurface S) + [ConnectedSpace S] + (hRigid_H : IsRigid H) + (hT : IsTangle H.toHypergraph θ T) + (hθ : 3 ≤ θ) + (hΛ_open : IsOpen Λ) + (hCD : IsClosedDisc (closure Λ)) + (hdiscBd : discBd (closure Λ) = subBd Λ) + (hHU_compl : H.U ⊆ univ \ Λ) : + let a : Fin (k - 1) → S := fun j => v ⟨j.1, by omega⟩ + let b : Fin (k - 1) → S := fun j => v ⟨2 * k - 2 - j.1, by omega⟩ + (∀ (j : Fin (k - 1)), g { re := parallelX k j, im := parallelY k j } = a j) → + (∀ (j : Fin (k - 1)), g { re := parallelX k j, im := -parallelY k j } = b j) → + (g { re := -1, im := 0 } = v i_k) → + (g { re := 1, im := 0 } = v i_last) → + ∀ (L : Fin (k - 1) → Set S), + (∀ (j : Fin (k - 1)), (P' j).U = L j ∧ (P' j).IsPathBetween (a j) (b j) ∧ (P' + j).IsSubdrawing H' ∧ a j ∈ (P' j).V ∧ b j ∈ (P' j).V) → + (∀ (j : Fin (k - 1)), IsLineWithEnds (L j) (a j) (b j)) → + (∀ (j : Fin (k - 1)), L j ⊆ closure Λ) → + (∀ (j : Fin (k - 1)), L j ∩ discBd (closure Λ) = {a j, b j}) → + (IsCappedSplit (fun _ : Fin 1 => subBd Λ) (univ \ Λ) (closure Λ) (Subtype.val : + ↥(univ \ Λ) → S) (fun _ : Fin 1 => Λ)) → + (IsCappedDrawing (Subtype.val : ↥(univ \ Λ) → S) H' H) → + (univ \ Λ ∩ closure Λ = subBd Λ) → + (univ \ Λ ∩ closure Λ ⊆ H'.U) → + (range v ⊆ H'.V ∩ (univ \ Λ ∩ closure Λ)) → + (closure Λ ∩ H'.U ⊆ discBd (closure Λ) ∪ ⋃ j, (P' j).U) → + IsRigid H' := by + intro a b hg_a hg_b hg_ik hg_ilast L hP' hL_line hL_sub_cl hL_inter_discBd hSplit_Λ hCap_Λ + hSplit_inter_eq hInterU_Λ hX_sub_Λ hP₂_U + refine theorem_3_2_proof (fun _ : Fin 1 => subBd Λ) (univ \ Λ) (closure Λ) + (Subtype.val : ↥(univ \ Λ) → S) (fun _ : Fin 1 => Λ) H' H (range v) + hSplit_Λ hCap_Λ hInterU_Λ hX_sub_Λ + (fun _ _ _ i j _ _ => Subsingleton.elim i j) ?_ ?_ ?_ + · intro F hF hFU hFV + have hX_coe : Subtype.val '' (Subtype.val ⁻¹' range v : Set ↥(univ \ Λ)) = range v := by + rw [Subtype.image_preimage_coe] + refine inter_eq_right.mpr ?_ + rintro _ ⟨i, rfl⟩ + exact hHU_compl (H.V_subset_U (hv_mem i).1) + rw [hX_coe] + exact theorem_3_3_claim_3 hS hRigid_H hT hθ hFree_v hF hFU hFV + · intro F hF_P₂ hF hFU hFV + exact dial_of_oArc_in_striped_disc hS hCD Subset.rfl hP₂_U + (fun j => (hP' j).1 ▸ hL_sub_cl j) + (fun j => (hP' j).1 ▸ hL_line j) + (fun j => (hP' j).2.2.1) + (fun j => (hP' j).1 ▸ hL_inter_discBd j) + hP'_disj hF_P₂ hF hFU hFV + · intro F u₀ v₀ P_bd hF_P₂ _ _ hF_line hF_U hP_sub_inter hP_path hPX_card + have hcl_inter : IsClosed ((univ \ Λ) ∩ closure Λ) := + (isClosed_univ.sdiff hΛ_open).inter isClosed_closure + have hP_sub_H' : P_bd.IsSubdrawing H' := by + refine ⟨hP_sub_inter.1.trans ?_, hP_sub_inter.2.trans ?_⟩ + · rw [interSet_V_of_isClosed H' hcl_inter] + exact inter_subset_left + · rw [interSet_E H'] + exact fun _ he => he.1 + have hPU_inter : P_bd.U ⊆ (univ \ Λ) ∩ closure Λ := by + refine (isSubdrawing_U_subset hP_sub_inter).trans ?_ + rw [(H'.interSet ((univ \ Λ) ∩ closure Λ)).U_eq, + interSet_V_of_isClosed H' hcl_inter, interSet_E] + exact union_subset inter_subset_right + (iUnion₂_subset fun e he => hcl_inter.closure_subset_iff.mpr he.2) + have hPU_bd : P_bd.U ⊆ discBd (closure Λ) := by + rw [hdiscBd, ← hSplit_inter_eq] + exact hPU_inter + have hPU_D : P_bd.U ⊆ closure Λ := hPU_bd.trans (Surface.discBd_subset (closure Λ)) + obtain ⟨ψ_F, hψ_F0, hψ_F1⟩ := id hF_line + have huv₀ : u₀ ≠ v₀ := fun heq => zero_ne_one + (ψ_F.injective (Subtype.ext (hψ_F0.trans (heq.trans hψ_F1.symm)))) + have hNo_both₀ := no_both_ends_in_bd_path c hk + (fun i => hSub_H.1 (hv_mem i).1) hg_ik hg_ilast hg_a hg_b + hP_sub_H' hPU_bd hP_path huv₀ hPX_card + have hNo_both : ∀ j : Fin (k - 1), ¬ (a j ∈ P_bd.V ∧ b j ∈ P_bd.V) := by + intro j + rw [← hg_a j, ← hg_b j] + exact hNo_both₀ j + exact openDisc_of_chord_in_striped_disc hS hCD Subset.rfl hP₂_U + (fun j => (hP' j).1 ▸ hL_line j) + (fun j => (hP' j).2.2.1) + (fun j => ⟨(hP' j).2.2.2.1, (hP' j).2.2.2.2⟩) + (fun j => (hP' j).1 ▸ hL_inter_discBd j) + hPU_D hF_P₂ hPU_bd hF_line hF_U hP_sub_H' hP_path hNo_both + +private theorem image_disjoint_of_avoids_parallel_chords {S : Type w} [TopologicalSpace S] + {H H' : Drawing S} {k : ℕ} {Λ : Set S} {h : S → ℂ} {g : ℂ → S} + (c : IsChart (closure Λ) h g) + (hHU_compl : H.U ⊆ univ \ Λ) + (hH'_U : H'.U = H.U ∪ ⋃ j : Fin (k - 1), g '' vertChord (parallelX k j)) + {B : Set ℂ} (hB : B ⊆ ball 0 1) (hB_image : g '' B ⊆ Λ) + (hAvoid : ∀ z ∈ B, ∀ j : Fin (k - 1), z.re ≠ parallelX k j) : + Disjoint (g '' B) H'.U := by + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨z, hz, rfl⟩ hxU + rw [hH'_U] at hxU + rcases hxU with hxH | hxL + · exact (hHU_compl hxH).2 (hB_image ⟨z, hz, rfl⟩) + · obtain ⟨j, w, hw, hgw⟩ := mem_iUnion.mp hxL + have hzw := c.injOn (ball_subset_closedBall (hB hz)) hw.1 hgw.symm + exact hAvoid z hz j (congrArg Complex.re hzw |>.trans hw.2) + +private theorem normal_boundary_of_glued_chords + {S : Type w} + [TopologicalSpace S] + (H : Drawing S) + (k : ℕ) + (H' : Drawing S) + (P' : Fin (k - 1) → Drawing S) + (hH'_V : H'.V = H.V ∪ ⋃ j, (P' j).V) + (a : Fin (k - 1) → S) + (b : Fin (k - 1) → S) + (L : Fin (k - 1) → Set S) + (hH'_U : H'.U = H.U ∪ ⋃ j, L j) + (ha_V : ∀ (j : Fin (k - 1)), a j ∈ H.V) + (hb_V : ∀ (j : Fin (k - 1)), b j ∈ H.V) + (Δ : Set S) + (F_Δ : Set S) + (hchord_inter_compl : ∀ (j : Fin (k - 1)), L j ∩ closure (univ \ Δ) = {a j, b j}) + (hHU_inter_Δ : H.U ∩ Δ ⊆ ⋃ j, {a j, b j}) + (hab_sub_FΔ : range a ∪ range b ⊆ F_Δ) + (hFΔ_sub_Δ : F_Δ ⊆ Δ) + (hFΔ_sub_cl_compl : F_Δ ⊆ closure (univ \ Δ)) : + H'.IsNormal F_Δ ∧ H'.V ∩ F_Δ = range a ∪ range b := by + refine glued_isNormal_and_V_inter (X_C := range a ∪ range b) ?_ ?_ ?_ hH'_U hH'_V + · rintro _ (⟨j, rfl⟩ | ⟨j, rfl⟩) + · exact ha_V j + · exact hb_V j + · refine Subset.antisymm ?_ ?_ + · intro x ⟨hxU, hxF⟩ + have hx_u : x ∈ ⋃ j : Fin (k - 1), {a j, b j} := hHU_inter_Δ ⟨hxU, hFΔ_sub_Δ hxF⟩ + obtain ⟨j, rfl | rfl⟩ := mem_iUnion.mp hx_u + · exact Or.inl ⟨j, rfl⟩ + · exact Or.inr ⟨j, rfl⟩ + · rintro x (⟨j, rfl⟩ | ⟨j, rfl⟩) + · exact ⟨H.V_subset_U (ha_V j), hab_sub_FΔ (Or.inl ⟨j, rfl⟩)⟩ + · exact ⟨H.V_subset_U (hb_V j), hab_sub_FΔ (Or.inr ⟨j, rfl⟩)⟩ + · rintro x ⟨hxL, hxF⟩ + obtain ⟨j, hxj⟩ := mem_iUnion.mp hxL + have hx_pair : x ∈ ({a j, b j} : Set S) := + hchord_inter_compl j ▸ ⟨hxj, hFΔ_sub_cl_compl hxF⟩ + rcases hx_pair with rfl | rfl + · exact Or.inl ⟨j, rfl⟩ + · exact Or.inr ⟨j, rfl⟩ + +private theorem parallel_chord_cap_regions + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (θ_star : ℕ) + (θ : ℕ) + (k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (Λ : Set S) + (v : Fin (2 * k) → S) + (i_k : Fin (2 * k)) + (i_last : Fin (2 * k)) + (hOArc : IsOArc (subBd Λ)) + (hk : 3 ≤ k) + (hv_mem : ∀ (i : Fin (2 * k)), v i ∈ H.V ∩ subBd Λ) + (hFree_v : IsFreeSet H.toHypergraph T θ (range v)) + (hik : ↑i_k = k - 1) + (hilast : ↑i_last = 2 * k - 1) + (p_circ : Circle ≃ₜ ↑(subBd Λ)) + (hp_circ_v : ∀ (i : Fin (2 * k)), ↑(p_circ (Circle.exp (parallelModelAngle k ↑i))) = v i) + {h : S → ℂ} + {g : ℂ → S} + (c : IsChart (closure Λ) h g) + (hg_circ : ∀ (w : Circle), g ↑w = ↑(p_circ w)) + (H' : Drawing S) + (η' : SpanEmbedding H' G) + (P' : Fin (k - 1) → Drawing S) + (hH'_V : H'.V = H.V ∪ ⋃ j, (P' j).V) + (hH'_E : H'.E = H.E ∪ ⋃ j, (P' j).E) + (hSub_H : H.IsSubdrawing H') + (hP'_disj : Pairwise fun i j => Disjoint (P' i).U (P' j).U) + (hS : IsClosedSurface S) + [hConn : ConnectedSpace S] + (hResp_H : IsRespectfulDrawingTangle H θ T) + (hT : IsTangle H.toHypergraph θ T) + (h2k_le : 2 * k ≤ θ) + (hk1 : 1 ≤ k) + (hΛ_open : IsOpen Λ) + (hout : ∀ x ∈ closure Λ \ Λ, x ∈ closure (closure Λ)ᶜ) + (hCD : IsClosedDisc (closure Λ)) + (hdiscBd : discBd (closure Λ) = subBd Λ) + (hsubBd_sub_HU : subBd Λ ⊆ H.U) + (hHU_compl : H.U ⊆ univ \ Λ) : + let a : Fin (k - 1) → S := fun j => v ⟨j.1, by omega⟩ + let b : Fin (k - 1) → S := fun j => v ⟨2 * k - 2 - j.1, by omega⟩ + (∀ (j : Fin (k - 1)), g { re := parallelX k j, im := parallelY k j } = a j) → + (∀ (j : Fin (k - 1)), g { re := parallelX k j, im := -parallelY k j } = b j) → + ∀ (hik_eq : i_k = ⟨k - 1, by omega⟩), + (g { re := -1, im := 0 } = v i_k) → + (g { re := 1, im := 0 } = v i_last) → + let L : Fin (k - 1) → Set S := fun j => g '' vertChord (parallelX k j) + (∀ (j : Fin (k - 1)), (P' j).U = L j ∧ (P' j).IsPathBetween (a j) (b j) ∧ (P' + j).IsSubdrawing H' ∧ a j ∈ (P' j).V ∧ b j ∈ (P' j).V) → + (H'.U = H.U ∪ ⋃ j, L j) → + (∀ (j : Fin (k - 1)), IsLineWithEnds (L j) (a j) (b j)) → + (∀ (j : Fin (k - 1)), a j ∈ H.V) → + (∀ (j : Fin (k - 1)), b j ∈ H.V) → + (H'.interSet (univ \ Λ) = H) → + (H'.U \ Λ = H.U) → + ((PaintingOrDrawing.drawing H').IsTwoCell) → + (inducedTangle H'.toHypergraph H.toHypergraph T θ = inducedBySubgraph + H'.toHypergraph H.toHypergraph θ T) → + (IsSigmaSpan G H' η' θ_star θ T_star (GM10.inducedTangle H'.toHypergraph + H.toHypergraph T θ)) → + ∀ (d' : Set S → Set S → ℕ), + (HasTangleMetric H' θ (GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ) d') → + (∀ x ∈ H.A, ∀ y ∈ H.A, d x y ≤ d' x y) → + ∃ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (d' : Set S → Set S → ℕ) (r₁ r₂ : + Set S), IsSigmaSpan G H' η' θ_star θ T_star T' ∧ HasTangleMetric H' θ T' d' ∧ r₁ ∈ H'.R ∧ r₂ + ∈ H'.R ∧ r₁ ⊆ Λ ∧ r₂ ⊆ Λ ∧ H'.interSet (univ \ Λ) = H ∧ H'.U \ Λ = H.U ∧ T' = + GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ ∧ (∀ x ∈ H.A, ∀ y ∈ H.A, d x y ≤ d' x + y) ∧ IsOArc (subBd r₁) ∧ IsOArc (subBd r₂) ∧ (H'.interSet (subBd r₁)).IsCircuit ∧ + (H'.interSet (subBd r₂)).IsCircuit ∧ v i_k ∈ subBd r₁ ∧ v i_last ∈ subBd r₂ ∧ (∀ w₁ w₂ w₃ w₄ + : S, w₁ ∈ H.V ∩ subBd Λ → w₂ ∈ H.V ∩ subBd Λ → w₃ ∈ H.V ∩ subBd Λ → w₄ ∈ H.V ∩ subBd Λ → + (List.ofFn (fun j : Fin (k - 1) => v ⟨j.1, by omega⟩) ++ [w₁, w₂, w₃, w₄] ++ List.ofFn (fun + j : Fin k => v ⟨k + j.1, by omega⟩)).Nodup → GM12.IsListedInOrderOn (subBd Λ) (List.ofFn + (fun j : Fin (k - 1) => v ⟨j.1, by omega⟩) ++ [w₁, w₂, w₃, w₄] ++ List.ofFn (fun j : Fin k + => v ⟨k + j.1, by omega⟩)) → w₁ ∈ (H'.interSet (subBd r₁)).V ∧ w₂ ∈ (H'.interSet (subBd + r₁)).V ∧ w₃ ∈ (H'.interSet (subBd r₁)).V ∧ w₄ ∈ (H'.interSet (subBd r₁)).V ∧ + OccurInCircuitOrder (H'.interSet (subBd r₁)) w₁ w₂ w₃ w₄) ∧ (∀ u₁ u₂ u₃ u₄ : S, u₁ ∈ H.V ∩ + subBd Λ → u₂ ∈ H.V ∩ subBd Λ → u₃ ∈ H.V ∩ subBd Λ → u₄ ∈ H.V ∩ subBd Λ → (List.ofFn (fun j : + Fin (2 * k - 1) => v ⟨j.1, by omega⟩) ++ [u₁, u₂, u₃, u₄]).Nodup → GM12.IsListedInOrderOn + (subBd Λ) (List.ofFn (fun j : Fin (2 * k - 1) => v ⟨j.1, by omega⟩) ++ [u₁, u₂, u₃, u₄]) → + u₁ ∈ (H'.interSet (subBd r₂)).V ∧ u₂ ∈ (H'.interSet (subBd r₂)).V ∧ u₃ ∈ (H'.interSet (subBd + r₂)).V ∧ u₄ ∈ (H'.interSet (subBd r₂)).V ∧ OccurInCircuitOrder (H'.interSet (subBd r₂)) u₁ + u₂ u₃ u₄) ∧ 2 * k - 6 ≤ d' r₁ r₂ ∧ 2 * k - 8 ≤ d' {v i_k} {v i_last} := by + intro a b hg_a hg_b hik_eq hg_ik hg_ilast L hP' hH'_U hL_line ha_V hb_V hInter_compl + hH'U_sdiff_Λ h2Cell_H' hT'_eq hSpan' d' hd' hd_le_d' + let T' := GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ + let j_last : Fin (k - 1) := ⟨k - 2, by omega⟩ + let j_first : Fin (k - 1) := ⟨0, by omega⟩ + let x_last : ℝ := parallelX k j_last + let x_first : ℝ := parallelX k j_first + obtain ⟨hx_last_lo, hx_last_hi⟩ := parallelX_mem_Ioo j_last + obtain ⟨hx_first_lo, hx_first_hi⟩ := parallelX_mem_Ioo j_first + let r₁ : Set S := g '' leftOpenCap x_last + let r₂ : Set S := g '' rightOpenCap x_first + have hg_ball : g '' ball (0 : ℂ) 1 = Λ := isChart_g_ball_eq_region c hΛ_open hdiscBd + have hleft_sub_ball : leftOpenCap x_last ⊆ ball (0 : ℂ) 1 := fun _ hz => hz.1 + have hright_sub_ball : rightOpenCap x_first ⊆ ball (0 : ℂ) 1 := fun _ hz => hz.1 + have hr₁_sub_Λ : r₁ ⊆ Λ := hg_ball ▸ image_mono hleft_sub_ball + have hr₂_sub_Λ : r₂ ⊆ Λ := hg_ball ▸ image_mono hright_sub_ball + have hr₁_open : IsOpen r₁ := + isChart_isOpen_image_of_subset_ball c hΛ_open hdiscBd (isOpen_leftOpenCap x_last) + hleft_sub_ball + have hr₂_open : IsOpen r₂ := + isChart_isOpen_image_of_subset_ball c hΛ_open hdiscBd (isOpen_rightOpenCap x_first) + hright_sub_ball + have hr₁_ne : r₁.Nonempty := (leftOpenCap_nonempty hx_last_lo hx_last_hi).image g + have hr₂_ne : r₂.Nonempty := (rightOpenCap_nonempty hx_first_lo hx_first_hi).image g + have hr₁_conn : IsPreconnected r₁ := + (convex_leftOpenCap x_last).isPreconnected.image g + (c.gc.mono (hleft_sub_ball.trans ball_subset_closedBall)) + have hr₂_conn : IsPreconnected r₂ := + (convex_rightOpenCap x_first).isPreconnected.image g + (c.gc.mono (hright_sub_ball.trans ball_subset_closedBall)) + have hr₁_bd : subBd r₁ = g '' leftSphereArc x_last ∪ L j_last := by + rw [isChart_subBd_image_of_isOpen_subset_ball c hΛ_open hdiscBd + (isOpen_leftOpenCap x_last) hleft_sub_ball, + closure_leftOpenCap hx_last_lo hx_last_hi, + leftClosedCap_sdiff_leftOpenCap, image_union] + have hr₂_bd : subBd r₂ = g '' rightSphereArc x_first ∪ L j_first := by + rw [isChart_subBd_image_of_isOpen_subset_ball c hΛ_open hdiscBd + (isOpen_rightOpenCap x_first) hright_sub_ball, + closure_rightOpenCap hx_first_lo hx_first_hi, + rightClosedCap_sdiff_rightOpenCap, image_union] + have hLj_sub_H'U : ∀ j : Fin (k - 1), L j ⊆ H'.U := fun j => by + rw [hH'_U] + exact (subset_iUnion L j).trans subset_union_right + have hr₁_bd_U : subBd r₁ ⊆ H'.U := by + rw [hr₁_bd] + refine union_subset ?_ (hLj_sub_H'U j_last) + calc g '' leftSphereArc x_last + ⊆ g '' sphere (0 : ℂ) 1 := image_mono (leftSphereArc_subset_sphere x_last) + _ = discBd (closure Λ) := c.g_sphere + _ = subBd Λ := hdiscBd + _ ⊆ H.U := hsubBd_sub_HU + _ ⊆ H'.U := isSubdrawing_U_subset hSub_H + have hr₂_bd_U : subBd r₂ ⊆ H'.U := by + rw [hr₂_bd] + refine union_subset ?_ (hLj_sub_H'U j_first) + calc g '' rightSphereArc x_first + ⊆ g '' sphere (0 : ℂ) 1 := image_mono (rightSphereArc_subset_sphere x_first) + _ = discBd (closure Λ) := c.g_sphere + _ = subBd Λ := hdiscBd + _ ⊆ H.U := hsubBd_sub_HU + _ ⊆ H'.U := isSubdrawing_U_subset hSub_H + have hr₁_disj : Disjoint r₁ H'.U := by + refine image_disjoint_of_avoids_parallel_chords c hHU_compl hH'_U + (fun _ hz => hz.1) hr₁_sub_Λ ?_ + intro z hz j + have hj_le : j ≤ j_last := Fin.le_def.mpr (by dsimp [j_last]; omega) + exact (hz.2.trans_le ((strictAnti_parallelX hk1).antitone hj_le)).ne + have hr₂_disj : Disjoint r₂ H'.U := by + refine image_disjoint_of_avoids_parallel_chords c hHU_compl hH'_U + (fun _ hz => hz.1) hr₂_sub_Λ ?_ + intro z hz j + have hj_ge : j_first ≤ j := Fin.le_def.mpr (Nat.zero_le _) + exact (((strictAnti_parallelX hk1).antitone hj_ge).trans_lt hz.2).ne.symm + have hr₁_R : r₁ ∈ H'.R := + mem_R_of_isOpen_isPreconnected hS hr₁_open hr₁_ne hr₁_conn hr₁_disj hr₁_bd_U + have hr₂_R : r₂ ∈ H'.R := + mem_R_of_isOpen_isPreconnected hS hr₂_open hr₂_ne hr₂_conn hr₂_disj hr₂_bd_U + obtain ⟨hOArc_r₁, hOrd_r₁⟩ := + occurInCircuitOrder_leftCap c hk p_circ hp_circ_v hg_circ hSub_H hr₁_bd + obtain ⟨hOArc_r₂, hOrd_r₂⟩ := + occurInCircuitOrder_rightCap c hk p_circ hp_circ_v hg_circ hSub_H hr₂_bd + obtain ⟨hCirc_r₁, hU_r₁, _⟩ := interSet_subBd_isCircuit_and_U_eq hS hr₁_R hOArc_r₁ + obtain ⟨hCirc_r₂, hU_r₂, _⟩ := interSet_subBd_isCircuit_and_U_eq hS hr₂_R hOArc_r₂ + have hv_ik_r₁ : v i_k ∈ subBd r₁ := by + rw [hr₁_bd, ← hg_ik] + refine Or.inl ⟨⟨-1, 0⟩, ⟨?_, hx_last_lo.le⟩, rfl⟩ + rw [mem_sphere_unit_iff]; norm_num + have hv_ilast_r₂ : v i_last ∈ subBd r₂ := by + rw [hr₂_bd, ← hg_ilast] + refine Or.inl ⟨⟨1, 0⟩, ⟨?_, hx_first_hi.le⟩, rfl⟩ + rw [mem_sphere_unit_iff]; norm_num + -- Step 7: Pinched subdisc `Δ`, `GM12Theorem61Statement`, and metric bounds. + obtain ⟨hΔ_disc, _, hΔ_subBd, hΔ_oArc, hchord_sub_Δ, + _, hΔ_inter_compl₀, hcompl_sub_cl_compl, hchord_inter_compl₀⟩ := + exists_pinched_vert_disc hS c hCD hOArc hΛ_open hdiscBd hout hk + let Ψ := pinchVertHomeo k hk + let Δ : Set S := g '' (Ψ '' closedBall (0 : ℂ) 1) + let F_Δ : Set S := subBd Δ + have hΔ_inter_compl : Δ ∩ (univ \ Λ) = ⋃ j : Fin (k - 1), {a j, b j} := by + refine hΔ_inter_compl₀.trans (iUnion_congr fun j => ?_) + rw [hg_a j, hg_b j] + have hchord_inter_compl : ∀ j : Fin (k - 1), + L j ∩ closure (univ \ Δ) = {a j, b j} := by + intro j + exact (hchord_inter_compl₀ j).trans (by rw [hg_a j, hg_b j]) + obtain ⟨_, _, hInter_cl_compl⟩ := + glued_interSet_base_eq isClosed_closure ha_V hb_V + (hHU_compl.trans hcompl_sub_cl_compl) hchord_inter_compl + hH'_U hH'_V hH'_E hP' + have hHU_inter_Δ : H.U ∩ Δ ⊆ ⋃ j : Fin (k - 1), {a j, b j} := by + rw [Set.inter_comm, ← hΔ_inter_compl] + exact inter_subset_inter_right _ hHU_compl + obtain ⟨hP'_sub_Δ, hInter_Δ_U⟩ := + glued_interSet_paths_eq hΔ_disc.isClosed hchord_sub_Δ hHU_inter_Δ hH'_V hH'_E hP' + have hab_sub_FΔ : range a ∪ range b ⊆ F_Δ := by + rintro _ (⟨j, rfl⟩ | ⟨j, rfl⟩) + · have hmem : a j ∈ L j ∩ closure (univ \ Δ) := + hchord_inter_compl j ▸ Or.inl rfl + exact ⟨subset_closure (hchord_sub_Δ j hmem.1), hmem.2⟩ + · have hmem : b j ∈ L j ∩ closure (univ \ Δ) := + hchord_inter_compl j ▸ Or.inr rfl + exact ⟨subset_closure (hchord_sub_Δ j hmem.1), hmem.2⟩ + have hFΔ_sub_Δ : F_Δ ⊆ Δ := fun _ hx => hΔ_disc.isClosed.closure_subset hx.1 + have hFΔ_sub_cl_compl : F_Δ ⊆ closure (univ \ Δ) := fun _ hx => hx.2 + have hNorm_and_V_FΔ : H'.IsNormal F_Δ ∧ H'.V ∩ F_Δ = range a ∪ range b := by + exact normal_boundary_of_glued_chords (S := S) H k H' P' hH'_V a b L hH'_U ha_V hb_V Δ F_Δ + hchord_inter_compl hHU_inter_Δ hab_sub_FΔ hFΔ_sub_Δ hFΔ_sub_cl_compl + obtain ⟨hNodup_ab, hOrder_ab⟩ := + isListedInOrderOn_pinched_bd c hk p_circ hp_circ_v hg_circ hΔ_subBd + have hex_e_path : ∀ j : Fin (k - 1), ∃ e, e ∈ (P' j).E := by + intro j + obtain ⟨ψ_j, hψ_j0, hψ_j1⟩ := hL_line j + have hab_ne : a j ≠ b j := fun heq => zero_ne_one + (ψ_j.injective (Subtype.ext (hψ_j0.trans (heq.trans hψ_j1.symm)))) + have h_walk_edge : ∀ {u w : S} (W : GraphWalk (P' j).toGraph u w), u ≠ w → ∃ e, e ∈ W.edges + := by + intro u w W hne + cases W with + | nil => exact (hne rfl).elim + | cons _ _ => exact ⟨_, List.mem_cons_self⟩ + obtain ⟨W, _, _, hWE⟩ := (hP' j).2.1 + obtain ⟨e, heW⟩ := h_walk_edge W hab_ne + exact ⟨e, hWE ▸ heW⟩ + choose e_path he_path using hex_e_path + have hFree_FΔ : IsFreeSet (H'.interSet (closure (univ \ Δ))).toHypergraph T θ + (F_Δ ∩ (H'.interSet (closure (univ \ Δ))).V) := by + rw [hInter_cl_compl] + have hsub_v : F_Δ ∩ H.V ⊆ range v := by + intro x ⟨hxF, hxHV⟩ + have hx_ab : x ∈ range a ∪ range b := + hNorm_and_V_FΔ.2 ▸ ⟨hSub_H.1 hxHV, hxF⟩ + rcases hx_ab with ⟨j, rfl⟩ | ⟨j, rfl⟩ + · exact ⟨⟨j.1, by omega⟩, rfl⟩ + · exact ⟨⟨2 * k - 2 - j.1, by omega⟩, rfl⟩ + have hcard_le : (F_Δ ∩ H.V).ncard ≤ θ := + le_trans (Set.ncard_le_ncard hsub_v (Set.finite_range v)) hFree_v.2.1 + have hFree_trunc := theorem_3_3_claim_2 hT hFree_v hsub_v hcard_le + exact ⟨hFree_trunc.1, hFree_trunc.2.1, + fun A B hAB hXA => hFree_trunc.2.2 ⟨hAB, hT.order_lt hAB⟩ hXA⟩ + have hdist_61 : 2 * (k - 1) ≤ d' (e_path j_first) (e_path j_last) := + GraphMinor.GM12.theorem_6_1_proof.{w} H' F_Δ Δ (k - 1) θ T d' a b P' e_path j_first j_last + hS hConn (by omega) (by omega) + h2Cell_H' hΔ_oArc hNorm_and_V_FΔ.1 hΔ_disc rfl + hNodup_ab hOrder_ab (by rw [Set.inter_comm]; exact hNorm_and_V_FΔ.2.symm) + (fun j => ⟨(hP' j).2.1, hP'_sub_Δ j⟩) + hP'_disj hInter_Δ_U he_path + (hInter_cl_compl.symm ▸ hResp_H.1) + (hInter_cl_compl.symm ▸ hResp_H) + (by rw [hInter_cl_compl, ← hT'_eq]; exact hd') + hFree_FΔ rfl rfl + have he₁_sub_r₂ : e_path j_first ⊆ closure r₂ := by + intro x hx + have hxL : x ∈ L j_first := (hP' j_first).1 ▸ ((he_path j_first).2.1 hx).1 + have hx_bd : x ∈ subBd r₂ := hr₂_bd ▸ Or.inr hxL + exact hx_bd.1 + have he₂_sub_r₁ : e_path j_last ⊆ closure r₁ := by + intro x hx + have hxL : x ∈ L j_last := (hP' j_last).1 ▸ ((he_path j_last).2.1 hx).1 + have hx_bd : x ∈ subBd r₁ := hr₁_bd ▸ Or.inr hxL + exact hx_bd.1 + obtain ⟨hd'_r₁_r₂, hd'_vk_vlast⟩ := + tangleMetric_bounds_of_parallel_paths hS hd' hr₁_R hr₂_R + ((hP' j_first).2.2.1.2 (he_path j_first)) + ((hP' j_last).2.2.1.2 (he_path j_last)) + he₁_sub_r₂ he₂_sub_r₁ + (hSub_H.1 (hv_mem i_k).1) (hSub_H.1 (hv_mem i_last).1) + hv_ik_r₁.1 hv_ilast_r₂.1 hdist_61 + refine ⟨T', d', r₁, r₂, + hSpan', hd', hr₁_R, hr₂_R, hr₁_sub_Λ, hr₂_sub_Λ, + hInter_compl, hH'U_sdiff_Λ, rfl, hd_le_d', + hOArc_r₁, hOArc_r₂, hCirc_r₁, hCirc_r₂, hv_ik_r₁, hv_ilast_r₂, + fun w₁ w₂ w₃ w₄ hw₁ hw₂ hw₃ hw₄ _ hOrd_w => hOrd_r₁ hU_r₁ w₁ w₂ w₃ w₄ hw₁ hw₂ hw₃ hw₄ hOrd_w, + fun u₁ u₂ u₃ u₄ hu₁ hu₂ hu₃ hu₄ _ hOrd_u => hOrd_r₂ hU_r₂ u₁ u₂ u₃ u₄ hu₁ hu₂ hu₃ hu₄ hOrd_u, + hd'_r₁_r₂, hd'_vk_vlast⟩ + +/-- The circle parametrization identifies both ends of each indexed vertical chord. -/ +theorem parallelChart_endpoints {S : Type w} {Λ : Set S} [TopologicalSpace S] + {k : ℕ} {v : Fin (2 * k) → S} {p : Circle ≃ₜ ↥(subBd Λ)} {g : ℂ → S} + (hg : ∀ z : Circle, g z = (p z).1) + (hp : ∀ i : Fin (2 * k), (p (Circle.exp (parallelModelAngle k i.1))).1 = v i) + (j : Fin (k - 1)) : + g ⟨parallelX k j, parallelY k j⟩ = v ⟨j.1, by omega⟩ ∧ + g ⟨parallelX k j, -parallelY k j⟩ = v ⟨2 * k - 2 - j.1, by omega⟩ := by + constructor + · rw [← circle_exp_parallelModelAngle_top j, hg, hp ⟨j.1, by omega⟩] + · rw [← circle_exp_parallelModelAngle_bot j, hg, hp ⟨2 * k - 2 - j.1, by omega⟩] + +/-- A chart chord meets the region boundary and the original drawing at its two endpoints. -/ +theorem parallelChart_chord_data {S : Type w} [TopologicalSpace S] [T2Space S] + {Λ U : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart (closure Λ) h g) + (hdiscBd : discBd (closure Λ) = subBd Λ) + (hregion : closure Λ ∩ (univ \ Λ) = subBd Λ) + (houtside : U ⊆ univ \ Λ) (hboundary : subBd Λ ⊆ U) + {k : ℕ} (j : Fin (k - 1)) {a b : S} + (ha : g ⟨parallelX k j, parallelY k j⟩ = a) + (hb : g ⟨parallelX k j, -parallelY k j⟩ = b) : + let L := g '' vertChord (parallelX k j) + IsLineWithEnds L a b ∧ L ⊆ closure Λ ∧ L ∩ discBd (closure Λ) = {a, b} ∧ + L ∩ (univ \ Λ) = {a, b} ∧ L ∩ U = {a, b} := by + obtain ⟨hline, hclosed, hdisc⟩ := + isLineWithEnds_image_vertChord c (parallelX_sq_add_parallelY_sq j) (parallelY_pos j) + rw [ha, hb] at hline hdisc + have hbd : (g '' vertChord (parallelX k j)) ∩ subBd Λ = {a, b} := hdiscBd ▸ hdisc + refine ⟨hline, hclosed, hdisc, ?_, ?_⟩ + · calc + _ = (g '' vertChord (parallelX k j)) ∩ (closure Λ ∩ (univ \ Λ)) := by + rw [← Set.inter_assoc, inter_eq_self_of_subset_left hclosed] + _ = {a, b} := by rw [hregion, hbd] + · refine Subset.antisymm ?_ ?_ + · intro x hx + have hxbd : x ∈ subBd Λ := hregion ▸ ⟨hclosed hx.1, houtside hx.2⟩ + exact hbd ▸ ⟨hx.1, hxbd⟩ + · rw [← hbd] + exact inter_subset_inter_right _ hboundary + +/-- The proof of Graph Minors XV, (3.4), pages 122–123, and the auxiliary conclusions of +`GM15Theorem34Statement` in a chart of $\bar\Lambda$ in which the paths $P_1, \dots, P_{k-1}$ +are the vertical chords at `parallelX k j`. The chart `g` maps the unit +circle onto $bd(\Lambda)$ by `p_circ`, with $v_i$ at the angle `parallelModelAngle k i`. +`theorem_3_4_proof` (`GraphMinor/GM15/Section3Given.lean`) moves any paths across $\Lambda$ onto +these chords and then applies this. -/ +theorem theorem_3_4_of_chart {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} + {β : Type v} (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ k : ℕ) (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (Λ : Set S) (v : Fin (2 * k) → S) (i_k i_last : Fin (2 * k)) + (hSpan : IsSigmaSpan G H η θ_star θ T_star T) (hd : HasTangleMetric H θ T d) + (hΛ : Λ ∈ H.R) (hOArc : IsOArc (subBd Λ)) (hk : 3 ≤ k) + (hNodup_v : (List.ofFn v).Nodup) (hv_mem : ∀ i : Fin (2 * k), v i ∈ H.V ∩ subBd Λ) + (hFree_v : IsFreeSet H.toHypergraph T θ (range v)) + (hik : i_k.1 = k - 1) (hilast : i_last.1 = 2 * k - 1) + (p_circ : Circle ≃ₜ ↥(subBd Λ)) + (hp_circ_v : ∀ i : Fin (2 * k), (p_circ (Circle.exp (parallelModelAngle k i.1))).1 = v i) + {h : S → ℂ} {g : ℂ → S} (c : IsChart (closure Λ) h g) + (hg_circ : ∀ w : Circle, g w = (p_circ w).1) + (H' : Drawing S) (η' : SpanEmbedding H' G) (P' : Fin (k - 1) → Drawing S) + (hH'_U : H'.U = H.U ∪ ⋃ j : Fin (k - 1), g '' vertChord (parallelX k j)) + (hH'_V : H'.V = H.V ∪ ⋃ j : Fin (k - 1), (P' j).V) + (hH'_E : H'.E = H.E ∪ ⋃ j : Fin (k - 1), (P' j).E) + (hSub_H : H.IsSubdrawing H') + (hP' : ∀ j : Fin (k - 1), (P' j).U = g '' vertChord (parallelX k j) ∧ + (P' j).IsPathBetween (v ⟨j.1, by omega⟩) (v ⟨2 * k - 2 - j.1, by omega⟩) ∧ + (P' j).IsSubdrawing H' ∧ v ⟨j.1, by omega⟩ ∈ (P' j).V ∧ + v ⟨2 * k - 2 - j.1, by omega⟩ ∈ (P' j).V) + (hP'_disj : Pairwise (fun i j => Disjoint (P' i).U (P' j).U)) + (hvm_H : ∀ x ∈ H.V, η'.vMap x = η.vMap x) (hem_H : ∀ e ∈ H.E, η'.eMap e = η.eMap e) : + ∃ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r₁ r₂ : Set S), + IsSigmaSpan G H' η' θ_star θ T_star T' ∧ + HasTangleMetric H' θ T' d' ∧ + r₁ ∈ H'.R ∧ r₂ ∈ H'.R ∧ r₁ ⊆ Λ ∧ r₂ ⊆ Λ ∧ + H'.interSet (univ \ Λ) = H ∧ + H'.U \ Λ = H.U ∧ + T' = GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ ∧ + (∀ x ∈ H.A, ∀ y ∈ H.A, d x y ≤ d' x y) ∧ + IsOArc (subBd r₁) ∧ IsOArc (subBd r₂) ∧ + (H'.interSet (subBd r₁)).IsCircuit ∧ (H'.interSet (subBd r₂)).IsCircuit ∧ + v i_k ∈ subBd r₁ ∧ v i_last ∈ subBd r₂ ∧ + (∀ w₁ w₂ w₃ w₄ : S, + w₁ ∈ H.V ∩ subBd Λ → w₂ ∈ H.V ∩ subBd Λ → + w₃ ∈ H.V ∩ subBd Λ → w₄ ∈ H.V ∩ subBd Λ → + (List.ofFn (fun j : Fin (k - 1) => v ⟨j.1, by omega⟩) ++ [w₁, w₂, w₃, w₄] ++ + List.ofFn (fun j : Fin k => v ⟨k + j.1, by omega⟩)).Nodup → + GM12.IsListedInOrderOn (subBd Λ) + (List.ofFn (fun j : Fin (k - 1) => v ⟨j.1, by omega⟩) ++ [w₁, w₂, w₃, w₄] ++ + List.ofFn (fun j : Fin k => v ⟨k + j.1, by omega⟩)) → + w₁ ∈ (H'.interSet (subBd r₁)).V ∧ w₂ ∈ (H'.interSet (subBd r₁)).V ∧ + w₃ ∈ (H'.interSet (subBd r₁)).V ∧ w₄ ∈ (H'.interSet (subBd r₁)).V ∧ + OccurInCircuitOrder (H'.interSet (subBd r₁)) w₁ w₂ w₃ w₄) ∧ + (∀ u₁ u₂ u₃ u₄ : S, + u₁ ∈ H.V ∩ subBd Λ → u₂ ∈ H.V ∩ subBd Λ → + u₃ ∈ H.V ∩ subBd Λ → u₄ ∈ H.V ∩ subBd Λ → + (List.ofFn (fun j : Fin (2 * k - 1) => v ⟨j.1, by omega⟩) ++ [u₁, u₂, u₃, u₄]).Nodup → + GM12.IsListedInOrderOn (subBd Λ) + (List.ofFn (fun j : Fin (2 * k - 1) => v ⟨j.1, by omega⟩) ++ [u₁, u₂, u₃, u₄]) → + u₁ ∈ (H'.interSet (subBd r₂)).V ∧ u₂ ∈ (H'.interSet (subBd r₂)).V ∧ + u₃ ∈ (H'.interSet (subBd r₂)).V ∧ u₄ ∈ (H'.interSet (subBd r₂)).V ∧ + OccurInCircuitOrder (H'.interSet (subBd r₂)) u₁ u₂ u₃ u₄) ∧ + 2 * k - 6 ≤ d' r₁ r₂ ∧ 2 * k - 8 ≤ d' {v i_k} {v i_last} := by + classical + have hS : IsClosedSurface S := + ⟨hSpan.isSurface.1, hSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hSpan.isConnected + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hRigid_H : IsRigid H := hSpan.isRigid + have hResp_H : IsRespectfulDrawingTangle H θ T := hSpan.isRespectful + have hT : IsTangle H.toHypergraph θ T := hResp_H.2.1 + -- The `2k` vertices are distinct and free, so `2k ≤ θ`. + have h2k_le : 2 * k ≤ θ := by + have hinj : Function.Injective v := List.nodup_ofFn.mp hNodup_v + have hcard := hFree_v.2.1 + rwa [Set.ncard_range_of_injective hinj, Nat.card_eq_fintype_card, Fintype.card_fin] at hcard + have hθ : 3 ≤ θ := by omega + have hk1 : 1 ≤ k := by omega + have hΛ_open : IsOpen Λ := GM11.region_isOpen hΛ + have hΛ_disc : IsOpenDisc Λ := hResp_H.1.2 Λ hΛ + obtain ⟨hout, hCD, hdiscBd, _, _⟩ := + isClosedDisc_closure_of_region_tangle hS hResp_H hθ hΛ hOArc + obtain ⟨_, hU_bdΛ, _⟩ := interSet_subBd_isCircuit_and_U_eq hS hΛ hOArc + have hsubBd_sub_HU : subBd Λ ⊆ H.U := by + have hcl : IsClosed (subBd Λ) := isClosed_closure.inter isClosed_closure + rw [← hU_bdΛ, (H.interSet (subBd Λ)).U_eq, + interSet_V_of_isClosed H hcl, interSet_E] + exact union_subset (inter_subset_left.trans H.V_subset_U) + (iUnion₂_subset fun e he => H.closure_subset_U he.1) + have hHU_compl : H.U ⊆ univ \ Λ := + fun x hxU => ⟨mem_univ x, fun hxΛ => GM11.region_subset hΛ hxΛ hxU⟩ + let a : Fin (k - 1) → S := fun j => v ⟨j.1, by omega⟩ + let b : Fin (k - 1) → S := fun j => v ⟨2 * k - 2 - j.1, by omega⟩ + have hg_a : ∀ j : Fin (k - 1), g ⟨parallelX k j, parallelY k j⟩ = a j := + fun j => (parallelChart_endpoints hg_circ hp_circ_v j).1 + have hg_b : ∀ j : Fin (k - 1), g ⟨parallelX k j, -parallelY k j⟩ = b j := + fun j => (parallelChart_endpoints hg_circ hp_circ_v j).2 + have hik_eq : i_k = ⟨k - 1, by omega⟩ := Fin.ext hik + have hilast_eq : i_last = ⟨2 * k - 1, by omega⟩ := Fin.ext hilast + have hg_ik : g ⟨-1, 0⟩ = v i_k := by + rw [← circle_exp_parallelModelAngle_k_sub_one hk1, hg_circ, hik_eq, + hp_circ_v ⟨k - 1, by omega⟩] + have hg_ilast : g ⟨1, 0⟩ = v i_last := by + rw [← circle_exp_parallelModelAngle_two_k_sub_one hk1, hg_circ, hilast_eq, + hp_circ_v ⟨2 * k - 1, by omega⟩] + -- Step 2: Vertical chord lines `L j` and glued span `(H', η')`. + let L : Fin (k - 1) → Set S := fun j => g '' vertChord (parallelX k j) + replace hP' : ∀ j : Fin (k - 1), (P' j).U = L j ∧ (P' j).IsPathBetween (a j) (b j) ∧ + (P' j).IsSubdrawing H' ∧ a j ∈ (P' j).V ∧ b j ∈ (P' j).V := hP' + replace hH'_U : H'.U = H.U ∪ ⋃ j : Fin (k - 1), L j := hH'_U + have hcl_inter_compl : closure Λ ∩ (univ \ Λ) = subBd Λ := by + rw [subBd_eq_frontier, hΛ_open.frontier_eq] + ext x + simp only [mem_inter_iff, mem_sdiff, mem_univ, true_and] + have hL_props := fun j : Fin (k - 1) => + parallelChart_chord_data c hdiscBd hcl_inter_compl hHU_compl hsubBd_sub_HU j (hg_a j) (hg_b j) + have hL_line : ∀ j : Fin (k - 1), IsLineWithEnds (L j) (a j) (b j) := + fun j => (hL_props j).1 + have hL_sub_cl : ∀ j : Fin (k - 1), L j ⊆ closure Λ := + fun j => (hL_props j).2.1 + have hL_inter_discBd : ∀ j : Fin (k - 1), L j ∩ discBd (closure Λ) = {a j, b j} := + fun j => (hL_props j).2.2.1 + have hL_inter_compl : ∀ j : Fin (k - 1), L j ∩ (univ \ Λ) = {a j, b j} := + fun j => (hL_props j).2.2.2.1 + have hL_inter_HU : ∀ j : Fin (k - 1), L j ∩ H.U = {a j, b j} := + fun j => (hL_props j).2.2.2.2 + have ha_mem : ∀ j : Fin (k - 1), a j ∈ H.V ∩ subBd Λ := fun j => hv_mem ⟨j.1, by omega⟩ + have hb_mem : ∀ j : Fin (k - 1), b j ∈ H.V ∩ subBd Λ := fun j => hv_mem ⟨2 * k - 2 - j.1, by + omega⟩ + have ha_V : ∀ j : Fin (k - 1), a j ∈ H.V := fun j => (ha_mem j).1 + have hb_V : ∀ j : Fin (k - 1), b j ∈ H.V := fun j => (hb_mem j).1 + -- Step 3: Base drawing restriction `H'.interSet (univ \ Λ) = H` and `H'.U \ Λ = H.U`. + obtain ⟨hU_compl, hV_compl, hInter_compl⟩ := + glued_interSet_base_eq (isClosed_univ.sdiff hΛ_open) ha_V hb_V hHU_compl + hL_inter_compl hH'_U hH'_V hH'_E hP' + have hH'U_sdiff_Λ : H'.U \ Λ = H.U := by + rw [← hU_compl, sdiff_eq, compl_eq_univ_sdiff] + -- Step 4: Prove `IsRigid H'` via `theorem_3_2_proof` on the single-region split `(univ \ Λ, + -- closure Λ)`. + have hSplit_Λ : GM12.IsCappedSplit (fun _ : Fin 1 => subBd Λ) (univ \ Λ) (closure Λ) + (Subtype.val : ↥(univ \ Λ) → S) (fun _ : Fin 1 => Λ) := + isCappedSplit_single_region hS hΛ hΛ_disc hOArc hCD hdiscBd hout + have hCap_Λ : GM12.IsCappedDrawing (Subtype.val : ↥(univ \ Λ) → S) H' H := by + refine ⟨?_, ?_⟩ + · rw [Subtype.image_preimage_coe, Set.inter_comm, hU_compl] + · rw [Subtype.image_preimage_coe, Set.inter_comm, hV_compl] + have hSplit_inter_eq : (univ \ Λ) ∩ closure Λ = subBd Λ := by + rw [hSplit_Λ.inter, iUnion_const] + have hInterU_Λ : (univ \ Λ) ∩ closure Λ ⊆ H'.U := by + rw [hSplit_inter_eq] + exact hsubBd_sub_HU.trans (isSubdrawing_U_subset hSub_H) + have hX_sub_Λ : range v ⊆ H'.V ∩ ((univ \ Λ) ∩ closure Λ) := by + rw [hSplit_inter_eq] + rintro _ ⟨i, rfl⟩ + exact ⟨hSub_H.1 (hv_mem i).1, (hv_mem i).2⟩ + have hP₂_U : closure Λ ∩ H'.U ⊆ discBd (closure Λ) ∪ ⋃ j : Fin (k - 1), (P' j).U := by + rw [hH'_U, inter_union_distrib_left] + refine union_subset ?_ ?_ + · have h1 : closure Λ ∩ H.U ⊆ discBd (closure Λ) := by + rw [hdiscBd, ← hcl_inter_compl] + exact inter_subset_inter_right _ hHU_compl + exact h1.trans subset_union_left + · refine (inter_subset_right.trans ?_).trans subset_union_right + refine iUnion_mono fun j => ?_ + rw [(hP' j).1] + have hRigid_H' : IsRigid H' := by + exact rigid_gluing_of_parallel_chords (S := S) H θ k T Λ v i_k i_last hk hv_mem hFree_v (h := + h) (g := g) c H' P' hSub_H hP'_disj hS hRigid_H hT hθ hΛ_open hCD hdiscBd hHU_compl hg_a + hg_b hg_ik hg_ilast L hP' hL_line hL_sub_cl hL_inter_discBd hSplit_Λ hCap_Λ hSplit_inter_eq + hInterU_Λ hX_sub_Λ hP₂_U + -- Step 5: `IsSigmaSpan G H' η' θ_star θ T_star T'` and metric `d'`. + have hH'_U_ne : H'.U.Nonempty := + ⟨v ⟨0, by omega⟩, H'.V_subset_U (hSub_H.1 (hv_mem ⟨0, by omega⟩).1)⟩ + have h2Cell_H' : (PaintingOrDrawing.drawing H').IsTwoCell := + isTwoCell_of_isRigid hS hRigid_H' hH'_U_ne + let T' := GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ + obtain ⟨hT'_eq, hT'_tangle, hCtrl_T'⟩ := + inducedTangle_eq_and_isControlling_of_isSubdrawing hSub_H hvm_H hem_H (by omega) + hSpan.isControlling + have hResp_T' : (PaintingOrDrawing.drawing H').IsRespectful θ T' := by + dsimp [T'] + rw [hT'_eq] + exact isRespectful_inducedBySubgraph' hSub_H hResp_H.2.2 + have hRDT' : IsRespectfulDrawingTangle H' θ T' := ⟨h2Cell_H', hT'_tangle, hResp_T'⟩ + have hSpan' : IsSigmaSpan G H' η' θ_star θ T_star T' := + { isSurface := hSpan.isSurface + isConnected := hSpan.isConnected + bd_empty := hSpan.bd_empty + isRigid := hRigid_H' + isRespectful := hRDT' + isControlling := hCtrl_T' } + obtain ⟨K', hK'⟩ := GM11.exists_radialDrawing hS hRDT'.1 + obtain ⟨ins', hins'⟩ := exists_derivedSlope hRDT' hK'.2.1 + let d' : Set S → Set S → ℕ := fun x y => + if x ∈ H'.A ∧ y ∈ H'.A then tangleMetric H' K' ins' θ x y else d x y + have hd' : HasTangleMetric H' θ T' d' := + ⟨hRDT', K', ins', hK', hins', fun x hx y hy => by + dsimp [d'] + rw [ite_eq_left ⟨hx, hy⟩]⟩ + have hd_le_d' : ∀ x ∈ H.A, ∀ y ∈ H.A, d x y ≤ d' x y := by + intro x hx y hy + by_cases hxy : x ∈ H'.A ∧ y ∈ H'.A + · exact (GraphMinor.GM12.gm15_theorem_7_7.{w} H' H θ θ T' T d' d hS hConn hd' hSub_H hResp_H.1 + le_rfl hd).2 + rfl hT'_eq x hxy.1 y hxy.2 x hx y hy Subset.rfl Subset.rfl + · dsimp [d'] + rw [ite_eq_right hxy] + -- Step 6: Cap regions `r₁, r₂ ⊆ Λ` and their boundary circuits. + have extreme_regions : + ∃ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r₁ r₂ : Set S), + IsSigmaSpan G H' η' θ_star θ T_star T' ∧ + HasTangleMetric H' θ T' d' ∧ + r₁ ∈ H'.R ∧ r₂ ∈ H'.R ∧ r₁ ⊆ Λ ∧ r₂ ⊆ Λ ∧ + H'.interSet (univ \ Λ) = H ∧ + H'.U \ Λ = H.U ∧ + T' = GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ ∧ + (∀ x ∈ H.A, ∀ y ∈ H.A, d x y ≤ d' x y) ∧ + IsOArc (subBd r₁) ∧ IsOArc (subBd r₂) ∧ + (H'.interSet (subBd r₁)).IsCircuit ∧ (H'.interSet (subBd r₂)).IsCircuit ∧ + v i_k ∈ subBd r₁ ∧ v i_last ∈ subBd r₂ ∧ + (∀ w₁ w₂ w₃ w₄ : S, + w₁ ∈ H.V ∩ subBd Λ → w₂ ∈ H.V ∩ subBd Λ → + w₃ ∈ H.V ∩ subBd Λ → w₄ ∈ H.V ∩ subBd Λ → + (List.ofFn (fun j : Fin (k - 1) => v ⟨j.1, by omega⟩) ++ [w₁, w₂, w₃, w₄] ++ + List.ofFn (fun j : Fin k => v ⟨k + j.1, by omega⟩)).Nodup → + GM12.IsListedInOrderOn (subBd Λ) + (List.ofFn (fun j : Fin (k - 1) => v ⟨j.1, by omega⟩) ++ [w₁, w₂, w₃, w₄] ++ + List.ofFn (fun j : Fin k => v ⟨k + j.1, by omega⟩)) → + w₁ ∈ (H'.interSet (subBd r₁)).V ∧ w₂ ∈ (H'.interSet (subBd r₁)).V ∧ + w₃ ∈ (H'.interSet (subBd r₁)).V ∧ w₄ ∈ (H'.interSet (subBd r₁)).V ∧ + OccurInCircuitOrder (H'.interSet (subBd r₁)) w₁ w₂ w₃ w₄) ∧ + (∀ u₁ u₂ u₃ u₄ : S, + u₁ ∈ H.V ∩ subBd Λ → u₂ ∈ H.V ∩ subBd Λ → + u₃ ∈ H.V ∩ subBd Λ → u₄ ∈ H.V ∩ subBd Λ → + (List.ofFn (fun j : Fin (2 * k - 1) => v ⟨j.1, by omega⟩) ++ [u₁, u₂, u₃, u₄]).Nodup → + GM12.IsListedInOrderOn (subBd Λ) + (List.ofFn (fun j : Fin (2 * k - 1) => v ⟨j.1, by omega⟩) ++ [u₁, u₂, u₃, u₄]) → + u₁ ∈ (H'.interSet (subBd r₂)).V ∧ u₂ ∈ (H'.interSet (subBd r₂)).V ∧ + u₃ ∈ (H'.interSet (subBd r₂)).V ∧ u₄ ∈ (H'.interSet (subBd r₂)).V ∧ + OccurInCircuitOrder (H'.interSet (subBd r₂)) u₁ u₂ u₃ u₄) ∧ + 2 * k - 6 ≤ d' r₁ r₂ ∧ 2 * k - 8 ≤ d' {v i_k} {v i_last} := by + exact parallel_chord_cap_regions (S := S) (α := α) (β := β) G H θ_star θ k T_star T d Λ v i_k + i_last hOArc hk hv_mem hFree_v hik hilast p_circ hp_circ_v (h := h) (g := g) c hg_circ H' η' + P' hH'_V hH'_E hSub_H hP'_disj hS hResp_H hT h2k_le hk1 hΛ_open hout hCD hdiscBd + hsubBd_sub_HU hHU_compl hg_a hg_b hik_eq hg_ik hg_ilast hP' hH'_U hL_line ha_V hb_V + hInter_compl hH'U_sdiff_Λ h2Cell_H' hT'_eq hSpan' d' hd' hd_le_d' + exact extreme_regions + +end Theorem34 + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/Section3SpanGlue.lean b/LeanPool/GraphMinor/GM15/Section3SpanGlue.lean new file mode 100644 index 0000000000..ea108f9e33 --- /dev/null +++ b/LeanPool/GraphMinor/GM15/Section3SpanGlue.lean @@ -0,0 +1,2306 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM15.Cited +public import LeanPool.GraphMinor.GM15.Section3 +public import LeanPool.GraphMinor.GM15.Section4 +import LeanPool.GraphMinor.GM11.DrawingOps +import LeanPool.GraphMinor.GM11.ArcDrawings +import LeanPool.GraphMinor.GM11.PaintingCells +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.GM14.Section6c +import LeanPool.GraphMinor.GM16.PathIsoCard +import LeanPool.GraphMinor.GM16.LineDrawingPath +import LeanPool.GraphMinor.GM16.PathDrawingOnLine +import LeanPool.GraphMinor.GM16.FiniteDrawingUnion +import LeanPool.GraphMinor.GM16.GraphDrawingSpanEmbedding +import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.Surface.CutLift +import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# Shared Drawing and Span-Embedding Gluing for Graph Minors XV, Section 3 + +This file provides the common infrastructure used in the proofs of (3.3), (3.4), and (3.5) of +*Graph Minors XV. Giant steps*: +- Lifting a drawing `H : Drawing S_hat`, its `SpanEmbedding H G`, and its tangle across a + continuous embedding `g : S_hat → S'` on a compact set `K ⊆ S_hat` containing `H.U`. +- Drawing a finite family of pairwise vertex-disjoint `η₁(H₁)`-paths `P : Fin m → Graph α β` + along pairwise disjoint lines `L : Fin m → Set S'` meeting `H₁.U` only at their endpoints, + and gluing them with `(H₁, η₁)` to obtain `(H', η')`. +- Proving the normality, vertex-intersection, and subdrawing decomposition formulas for + pinched splits `(P₁^XII, P₂^XII)` used when applying Graph Minors XII, (5.1), (5.2), and (6.1). +- Proving `IsTangle` and `IsControllingTangle` for `GM12.inducedAcross` and + `GM12.inducedBySubgraph`. +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +open Set Function Topology +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM14 GM16 + +universe u v w + +/-! ## 1. Lifting a Drawing and SpanEmbedding Along a Compact Embedding -/ + +section LiftDrawing + +variable {S' S_hat : Type w} [TopologicalSpace S'] [T2Space S'] + [TopologicalSpace S_hat] [T2Space S_hat] + +/-- Lift a drawing `H : Drawing S_hat` with `H.U ⊆ K` along a continuous injection `g : S_hat → S'` +with continuous left inverse `f : S' → S_hat` on the compact set `K`. -/ +noncomputable def liftDrawingOn {K : Set S_hat} (hK : IsCompact K) + {g : S_hat → S'} {f : S' → S_hat} + (hg : ContinuousOn g K) (hf : ContinuousOn f (g '' K)) (hl : LeftInvOn f g K) + (H : Drawing S_hat) (hHU : H.U ⊆ K) : Drawing S' where + U := g '' H.U + V := g '' H.V + V_subset_U := image_mono H.V_subset_U + isClosed_U := (hK.of_isClosed_subset H.isClosed_U hHU).image_of_continuousOn + (hg.mono hHU) |>.isClosed + finite_V := H.finite_V.image g + finite_edges := by + have hinj : InjOn g K := hl.injOn + have hUV : g '' H.U \ g '' H.V = g '' (H.U \ H.V) := by + ext x + constructor + · rintro ⟨⟨y, hyU, rfl⟩, hyV⟩ + exact ⟨y, ⟨hyU, fun h => hyV ⟨y, h, rfl⟩⟩, rfl⟩ + · rintro ⟨y, ⟨hyU, hyV⟩, rfl⟩ + refine ⟨⟨y, hyU, rfl⟩, ?_⟩ + rintro ⟨z, hzV, hzy⟩ + exact hyV (hinj (H.V_subset_U.trans hHU hzV) (hHU hyU) hzy ▸ hzV) + have hUV_sub : H.U \ H.V ⊆ K := sdiff_subset.trans hHU + rw [hUV, GM11.arcComponentsIn_image (hg.mono hUV_sub) + (hf.mono (image_mono hUV_sub)) (hl.mono hUV_sub)] + exact H.finite_edges.image (image g) + edge_cond := by + have hinj : InjOn g K := hl.injOn + have hUV : g '' H.U \ g '' H.V = g '' (H.U \ H.V) := by + ext x + constructor + · rintro ⟨⟨y, hyU, rfl⟩, hyV⟩ + exact ⟨y, ⟨hyU, fun h => hyV ⟨y, h, rfl⟩⟩, rfl⟩ + · rintro ⟨y, ⟨hyU, hyV⟩, rfl⟩ + refine ⟨⟨y, hyU, rfl⟩, ?_⟩ + rintro ⟨z, hzV, hzy⟩ + exact hyV (hinj (H.V_subset_U.trans hHU hzV) (hHU hyU) hzy ▸ hzV) + have hUV_sub : H.U \ H.V ⊆ K := sdiff_subset.trans hHU + intro e' he' + rw [hUV, GM11.arcComponentsIn_image (hg.mono hUV_sub) + (hf.mono (image_mono hUV_sub)) (hl.mono hUV_sub)] at he' + rcases he' with ⟨e, he, rfl⟩ + have he_U : e ⊆ H.U := fun x hx => (he.2.1 hx).1 + have hcl_sub : closure e ⊆ K := (H.isClosed_U.closure_subset_iff.mpr he_U).trans hHU + have hcl_comp : IsCompact (closure e) := hK.of_isClosed_subset isClosed_closure hcl_sub + have hcl_img : g '' closure e = closure (g '' e) := + image_closure_of_isCompact hcl_comp (hg.mono hcl_sub) + have hcap : closure (g '' e) ∩ g '' H.V = g '' (closure e ∩ H.V) := by + rw [← hcl_img, ← hinj.image_inter hcl_sub (H.V_subset_U.trans hHU)] + obtain ⟨e_homeo, he_homeo⟩ := exists_homeomorph_image + (hg.mono hcl_sub) (hf.mono (image_mono hcl_sub)) (hl.mono hcl_sub) + rcases H.edge_cond e he with ⟨u, v, huv, hcap_e, ⟨φ, hφ0, hφ1⟩⟩ | ⟨u, hcap_e, ⟨φ⟩⟩ + · left + have huK : u ∈ K := hcl_sub (by + have : u ∈ closure e ∩ H.V := hcap_e ▸ mem_insert u {v} + exact this.1) + have hvK : v ∈ K := hcl_sub (by + have : v ∈ closure e ∩ H.V := hcap_e ▸ mem_insert_of_mem u rfl + exact this.1) + refine ⟨g u, g v, fun h => huv (hinj huK hvK h), ?_, ?_⟩ + · rw [hcap, hcap_e, image_pair] + · rw [← hcl_img] + exact ⟨φ.trans e_homeo, + (he_homeo (φ 0)).trans (congrArg g hφ0), + (he_homeo (φ 1)).trans (congrArg g hφ1)⟩ + · right + refine ⟨g u, ?_, ?_⟩ + · rw [hcap, hcap_e, image_singleton] + · rw [← hcl_img] + exact ⟨φ.trans e_homeo⟩ + +omit [T2Space S_hat] in +@[simp] +theorem liftDrawingOn_U {K : Set S_hat} (hK : IsCompact K) + {g : S_hat → S'} {f : S' → S_hat} + (hg : ContinuousOn g K) (hf : ContinuousOn f (g '' K)) (hl : LeftInvOn f g K) + (H : Drawing S_hat) (hHU : H.U ⊆ K) : + (liftDrawingOn hK hg hf hl H hHU).U = g '' H.U := rfl + +omit [T2Space S_hat] in +@[simp] +theorem liftDrawingOn_V {K : Set S_hat} (hK : IsCompact K) + {g : S_hat → S'} {f : S' → S_hat} + (hg : ContinuousOn g K) (hf : ContinuousOn f (g '' K)) (hl : LeftInvOn f g K) + (H : Drawing S_hat) (hHU : H.U ⊆ K) : + (liftDrawingOn hK hg hf hl H hHU).V = g '' H.V := rfl + +omit [T2Space S_hat] in +theorem liftDrawingOn_E {K : Set S_hat} (hK : IsCompact K) + {g : S_hat → S'} {f : S' → S_hat} + (hg : ContinuousOn g K) (hf : ContinuousOn f (g '' K)) (hl : LeftInvOn f g K) + (H : Drawing S_hat) (hHU : H.U ⊆ K) : + (liftDrawingOn hK hg hf hl H hHU).E = image g '' H.E := by + have hinj : InjOn g K := hl.injOn + have hUV : g '' H.U \ g '' H.V = g '' (H.U \ H.V) := by + ext x + constructor + · rintro ⟨⟨y, hyU, rfl⟩, hyV⟩ + exact ⟨y, ⟨hyU, fun h => hyV ⟨y, h, rfl⟩⟩, rfl⟩ + · rintro ⟨y, ⟨hyU, hyV⟩, rfl⟩ + refine ⟨⟨y, hyU, rfl⟩, ?_⟩ + rintro ⟨z, hzV, hzy⟩ + exact hyV (hinj (H.V_subset_U.trans hHU hzV) (hHU hyU) hzy ▸ hzV) + have hUV_sub : H.U \ H.V ⊆ K := sdiff_subset.trans hHU + change arcComponentsIn (g '' H.U \ g '' H.V) = image g '' H.E + rw [hUV] + exact GM11.arcComponentsIn_image (hg.mono hUV_sub) + (hf.mono (image_mono hUV_sub)) (hl.mono hUV_sub) + +omit [T2Space S_hat] in +theorem liftDrawingOn_closure_edge {K : Set S_hat} (hK : IsCompact K) + {g : S_hat → S'} {f : S' → S_hat} + (hg : ContinuousOn g K) (_hf : ContinuousOn f (g '' K)) (_hl : LeftInvOn f g K) + {H : Drawing S_hat} (hHU : H.U ⊆ K) {e : Set S_hat} (he : e ∈ H.E) : + closure (g '' e) = g '' closure e := by + have he_U : e ⊆ H.U := fun x hx => (he.2.1 hx).1 + have hcl_sub : closure e ⊆ K := (H.isClosed_U.closure_subset_iff.mpr he_U).trans hHU + have hcl_comp : IsCompact (closure e) := hK.of_isClosed_subset isClosed_closure hcl_sub + exact (image_closure_of_isCompact hcl_comp (hg.mono hcl_sub)).symm + +/-- Lift a `SpanEmbedding H G` along `(g, f)` to a `SpanEmbedding (liftDrawingOn ...) G`. -/ +noncomputable def liftSpanEmbeddingOn {α : Type u} {β : Type v} {G : Graph α β} + {K : Set S_hat} (hK : IsCompact K) + {g : S_hat → S'} {f : S' → S_hat} + (hg : ContinuousOn g K) (hf : ContinuousOn f (g '' K)) (hl : LeftInvOn f g K) + {H : Drawing S_hat} (hHU : H.U ⊆ K) (η : SpanEmbedding H G) : + SpanEmbedding (liftDrawingOn hK hg hf hl H hHU) G where + imageGraph := η.imageGraph + vMap x := η.vMap (f x) + eMap e' := η.eMap (f '' e') + imageGraph_le := η.imageGraph_le + bijOn_v := by + have hV_sub : H.V ⊆ K := H.V_subset_U.trans hHU + refine ⟨?_, ?_, ?_⟩ + · rintro _ ⟨v, hv, rfl⟩ + dsimp only + rw [hl (hV_sub hv)] + exact η.bijOn_v.mapsTo hv + · rintro _ ⟨v₁, hv₁, rfl⟩ _ ⟨v₂, hv₂, rfl⟩ heq + dsimp only at heq + rw [hl (hV_sub hv₁), hl (hV_sub hv₂)] at heq + exact congrArg g (η.bijOn_v.injOn hv₁ hv₂ heq) + · intro a ha + obtain ⟨v, hv, rfl⟩ := η.bijOn_v.surjOn ha + refine ⟨g v, ⟨v, hv, rfl⟩, ?_⟩ + dsimp only + rw [hl (hV_sub hv)] + bijOn_e := by + rw [liftDrawingOn_E hK hg hf hl H hHU] + have hfg : ∀ {e : Set S_hat}, e ∈ H.E → f '' (g '' e) = e := by + intro e he + have he_sub : e ⊆ K := fun x hx => hHU (he.2.1 hx).1 + exact hl.image_image' he_sub + refine ⟨?_, ?_, ?_⟩ + · rintro _ ⟨e, he, rfl⟩ + dsimp only + rw [hfg he] + exact η.bijOn_e.mapsTo he + · rintro _ ⟨e₁, he₁, rfl⟩ _ ⟨e₂, he₂, rfl⟩ heq + dsimp only at heq + rw [hfg he₁, hfg he₂] at heq + exact congrArg (image g) (η.bijOn_e.injOn he₁ he₂ heq) + · intro b hb + obtain ⟨e, he, rfl⟩ := η.bijOn_e.surjOn hb + refine ⟨g '' e, ⟨e, he, rfl⟩, ?_⟩ + dsimp only + rw [hfg he] + inc_iff := by + rw [liftDrawingOn_E hK hg hf hl H hHU] + rintro _ ⟨e, he, rfl⟩ _ ⟨v, hv, rfl⟩ + have he_U : e ⊆ H.U := fun x hx => (he.2.1 hx).1 + have he_sub : e ⊆ K := he_U.trans hHU + have hcl_sub : closure e ⊆ K := (H.isClosed_U.closure_subset_iff.mpr he_U).trans hHU + have hv_sub : v ∈ K := H.V_subset_U.trans hHU hv + change η.imageGraph.Inc (η.eMap (f '' (g '' e))) (η.vMap (f (g v))) ↔ g v ∈ closure (g '' e) + rw [hl.image_image' he_sub, hl hv_sub, η.inc_iff e he v hv, + liftDrawingOn_closure_edge hK hg hf hl hHU he] + exact ⟨fun h => ⟨v, h, rfl⟩, fun ⟨w, hw, hgw⟩ => hl.injOn (hcl_sub hw) hv_sub hgw ▸ hw⟩ + +end LiftDrawing + +/-! ## 2. Gluing a Base Drawing and SpanEmbedding with Path Drawings on Disjoint Lines -/ + +section GluePaths + +variable {α : Type u} {β : Type v} {S' : Type w} [TopologicalSpace S'] [T2Space S'] + +omit [T2Space S'] in +private lemma isCompact_of_isLineWithEnds' {L : Set S'} {u v : S'} + (hL : IsLineWithEnds L u v) : IsCompact L := by + obtain ⟨ψ, _, _⟩ := hL + have hEq : L = range (fun s : unitInterval => (ψ s).1) := by + ext x + exact ⟨fun hx => ⟨ψ.symm ⟨x, hx⟩, by simp⟩, fun ⟨s, hs⟩ => hs ▸ (ψ s).2⟩ + rw [hEq] + exact isCompact_range (continuous_subtype_val.comp ψ.continuous) + +private theorem paths_on_gluing_arcs_have_drawings + {α : Type u} + {β : Type v} + {S' : Type w} + [TopologicalSpace S'] + [T2Space S'] + {G : Graph α β} + (H₁ : Drawing S') + (η₁ : SpanEmbedding H₁ G) + {m : ℕ} + (u' : Fin m → S') + (v' : Fin m → S') + (P : Fin m → Graph α β) + (L : Fin m → Set S') + (hP : ∀ (i : Fin m), IsHPathWithEnds G η₁.imageGraph (P i) (η₁.vMap (u' i)) (η₁.vMap (v' i))) + (hL : ∀ (i : Fin m), IsLineWithEnds (L i) (u' i) (v' i)) + (huv_ne : ∀ (i : Fin m), u' i ≠ v' i) : + ∀ (i : Fin m), ∃ (D_i : Drawing S') (η_i : SpanEmbedding D_i G), + D_i.U = L i ∧ D_i.IsPathBetween (u' i) (v' i) ∧ u' i ∈ D_i.V ∧ v' i + ∈ D_i.V ∧ η_i.imageGraph = P i ∧ η_i.vMap (u' i) = η₁.vMap (u' i) ∧ η_i.vMap (v' i) = + η₁.vMap (v' i) := by + intro i + have hα : Nonempty α := ⟨η₁.vMap (u' i)⟩ + have hβ : Nonempty β := ⟨η₁.eMap ∅⟩ + obtain ⟨Γ_i, hU_i, hLeft_i, hRight_i⟩ := + GM16.exists_path_drawing_on_line (hP i).2.1 (hP i).2.2.1 (hL i) (huv_ne i) + obtain ⟨η_i, hIm_i, hv_i, _⟩ := + GM16.exists_spanEmbedding_of_graphDrawing (hP i).2.1.1 Γ_i + have hu_mem_P : η₁.vMap (u' i) ∈ V(P i) := IsGraphPathWithEnds.left_mem (hP i).2.1 + have hv_mem_P : η₁.vMap (v' i) ∈ V(P i) := IsGraphPathWithEnds.right_mem (hP i).2.1 + let u_P : V(P i) := ⟨η₁.vMap (u' i), hu_mem_P⟩ + let v_P : V(P i) := ⟨η₁.vMap (v' i), hv_mem_P⟩ + have h_u_eq : (Γ_i.iso.vertexEquiv u_P).val = u' i := hLeft_i u_P rfl + have h_v_eq : (Γ_i.iso.vertexEquiv v_P).val = v' i := hRight_i v_P rfl + have hu'_V : u' i ∈ Γ_i.drawing.V := h_u_eq ▸ (Γ_i.iso.vertexEquiv u_P).property + have hv'_V : v' i ∈ Γ_i.drawing.V := h_v_eq ▸ (Γ_i.iso.vertexEquiv v_P).property + have h_symm_u : Γ_i.iso.vertexEquiv.symm ⟨u' i, hu'_V⟩ = u_P := by + apply Γ_i.iso.vertexEquiv.injective + rw [Equiv.apply_symm_apply] + exact Subtype.ext h_u_eq.symm + have h_symm_v : Γ_i.iso.vertexEquiv.symm ⟨v' i, hv'_V⟩ = v_P := by + apply Γ_i.iso.vertexEquiv.injective + rw [Equiv.apply_symm_apply] + exact Subtype.ext h_v_eq.symm + have hvMap_u : η_i.vMap (u' i) = η₁.vMap (u' i) := + (hv_i ⟨u' i, hu'_V⟩).trans (congrArg Subtype.val h_symm_u) + have hvMap_v : η_i.vMap (v' i) = η₁.vMap (v' i) := + (hv_i ⟨v' i, hv'_V⟩).trans (congrArg Subtype.val h_symm_v) + have hPath_i : Γ_i.drawing.IsPathBetween (u' i) (v' i) := + GM16.drawing_isPathBetween_of_isLine_U (hU_i.symm ▸ hL i) (huv_ne i) hu'_V hv'_V + exact ⟨Γ_i.drawing, η_i, hU_i, hPath_i, hu'_V, hv'_V, hIm_i, hvMap_u, hvMap_v⟩ + +private theorem initial_drawing_and_gluing_paths_only_meet_at_vertices + {S' : Type w} + [TopologicalSpace S'] + (H₁ : Drawing S') + {m : ℕ} + (u' : Fin m → S') + (v' : Fin m → S') + (L : Fin m → Set S') + (hu' : ∀ (i : Fin m), u' i ∈ H₁.V) + (hv' : ∀ (i : Fin m), v' i ∈ H₁.V) + (hL_disj : Pairwise fun i j => Disjoint (L i) (L j)) + (hL_inter : ∀ (i : Fin m), L i ∩ H₁.U = {u' i, v' i}) + (P' : Fin m → Drawing S') + (hP'_U : ∀ (i : Fin m), (P' i).U = L i) : + ∀ o₁ ∈ univ, ∀ o₂ ∈ univ, o₁ ≠ o₂ → ((Option.elim' H₁ P') o₁).U ∩ ((Option.elim' H₁ P') o₂).U + ⊆ H₁.V := by + let D_fam := Option.elim' H₁ P' + rintro (_ | i) _ (_ | j) _ hne x ⟨hx₁, hx₂⟩ + · exact (hne rfl).elim + · change x ∈ H₁.U at hx₁ + change x ∈ (P' j).U at hx₂ + rw [hP'_U j] at hx₂ + have hx_pair : x ∈ ({u' j, v' j} : Set S') := hL_inter j ▸ ⟨hx₂, hx₁⟩ + rcases hx_pair with rfl | rfl + · exact hu' j + · exact hv' j + · change x ∈ (P' i).U at hx₁ + change x ∈ H₁.U at hx₂ + rw [hP'_U i] at hx₁ + have hx_pair : x ∈ ({u' i, v' i} : Set S') := hL_inter i ▸ ⟨hx₁, hx₂⟩ + rcases hx_pair with rfl | rfl + · exact hu' i + · exact hv' i + · have hij : i ≠ j := fun h => hne (congrArg some h) + change x ∈ (P' i).U at hx₁ + change x ∈ (P' j).U at hx₂ + rw [hP'_U i] at hx₁ + rw [hP'_U j] at hx₂ + exact (Set.disjoint_left.mp (hL_disj hij) hx₁ hx₂).elim + +private theorem glued_drawing_vertex_map_bijective + {α : Type u} + {β : Type v} + {S' : Type w} + [TopologicalSpace S'] + {G : Graph α β} + (H₁ : Drawing S') + (η₁ : SpanEmbedding H₁ G) + {m : ℕ} + (u' : Fin m → S') + (v' : Fin m → S') + (P : Fin m → Graph α β) + (hu' : ∀ (i : Fin m), u' i ∈ H₁.V) + (hv' : ∀ (i : Fin m), v' i ∈ H₁.V) + (hP : ∀ (i : Fin m), IsHPathWithEnds G η₁.imageGraph (P i) (η₁.vMap (u' i)) (η₁.vMap (v' i))) + (hP_disj : Pairwise fun i j => Disjoint V(P i) V(P j)) + (P' : Fin m → Drawing S') + (η_P : (i : Fin m) → SpanEmbedding (P' i) G) + (hu'_P'V : ∀ (i : Fin m), u' i ∈ (P' i).V) + (hv'_P'V : ∀ (i : Fin m), v' i ∈ (P' i).V) + (hη_P_im : ∀ (i : Fin m), (η_P i).imageGraph = P i) + (hη_P_u : ∀ (i : Fin m), (η_P i).vMap (u' i) = η₁.vMap (u' i)) + (hη_P_v : ∀ (i : Fin m), (η_P i).vMap (v' i) = η₁.vMap (v' i)) + (H' : Drawing S') + (hH'_V : H'.V = H₁.V ∪ ⋃ i, (P' i).V) + (hSub_H₁ : H₁.IsSubdrawing H') + (hSub_P' : ∀ (i : Fin m), (P' i).IsSubdrawing H') + (vm : S' → α) + (hvm_H₁ : ∀ x ∈ H₁.V, vm x = η₁.vMap x) + (hvm_P' : ∀ (i : Fin m), ∀ x ∈ (P' i).V, vm x = (η_P i).vMap x) + (hV_ImG : V((subgraphUnion G η₁.imageGraph (subgraphSUnion G (range P)))) = V(η₁.imageGraph) ∪ + ⋃ i, V(P i)) : + BijOn vm H'.V V((subgraphUnion G η₁.imageGraph (subgraphSUnion G (range P)))) := by + let ImG := subgraphUnion G η₁.imageGraph (subgraphSUnion G (range P)) + refine ⟨?_, ?_, ?_⟩ + · intro x hx + rw [hH'_V] at hx + rw [hV_ImG] + rcases hx with hx₁ | hxP + · rw [hvm_H₁ x hx₁] + exact Or.inl (η₁.bijOn_v.mapsTo hx₁) + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxP + rw [hvm_P' i x hxi] + exact Or.inr (mem_iUnion.mpr ⟨i, hη_P_im i ▸ (η_P i).bijOn_v.mapsTo hxi⟩) + · intro x hx y hy hxy + rw [hH'_V] at hx hy + rcases hx with hx₁ | hxP <;> rcases hy with hy₁ | hyP + · rw [hvm_H₁ x hx₁, hvm_H₁ y hy₁] at hxy + exact η₁.bijOn_v.injOn hx₁ hy₁ hxy + · obtain ⟨j, hyj⟩ := mem_iUnion.mp hyP + have hvy_im : vm y ∈ V(P j) ∩ V(η₁.imageGraph) := by + refine ⟨?_, ?_⟩ + · rw [hvm_P' j y hyj, ← hη_P_im j] + exact (η_P j).bijOn_v.mapsTo hyj + · rw [← hxy, hvm_H₁ x hx₁] + exact η₁.bijOn_v.mapsTo hx₁ + rw [(hP j).2.2.2.2.2.1] at hvy_im + rcases hvy_im with h_u | h_v + · have hy_u : y = u' j := + (η_P j).bijOn_v.injOn hyj (hu'_P'V j) (by rw [← hvm_P' j y hyj, h_u, hη_P_u j]) + subst hy_u + rw [hvm_H₁ x hx₁, hvm_H₁ (u' j) (hu' j)] at hxy + exact η₁.bijOn_v.injOn hx₁ (hu' j) hxy + · rw [mem_singleton_iff] at h_v + have hy_v : y = v' j := + (η_P j).bijOn_v.injOn hyj (hv'_P'V j) (by rw [← hvm_P' j y hyj, h_v, hη_P_v j]) + subst hy_v + rw [hvm_H₁ x hx₁, hvm_H₁ (v' j) (hv' j)] at hxy + exact η₁.bijOn_v.injOn hx₁ (hv' j) hxy + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxP + have hvx_im : vm x ∈ V(P i) ∩ V(η₁.imageGraph) := by + refine ⟨?_, ?_⟩ + · rw [hvm_P' i x hxi, ← hη_P_im i] + exact (η_P i).bijOn_v.mapsTo hxi + · rw [hxy, hvm_H₁ y hy₁] + exact η₁.bijOn_v.mapsTo hy₁ + rw [(hP i).2.2.2.2.2.1] at hvx_im + rcases hvx_im with h_u | h_v + · have hx_u : x = u' i := + (η_P i).bijOn_v.injOn hxi (hu'_P'V i) (by rw [← hvm_P' i x hxi, h_u, hη_P_u i]) + subst hx_u + rw [hvm_H₁ (u' i) (hu' i), hvm_H₁ y hy₁] at hxy + exact η₁.bijOn_v.injOn (hu' i) hy₁ hxy + · rw [mem_singleton_iff] at h_v + have hx_v : x = v' i := + (η_P i).bijOn_v.injOn hxi (hv'_P'V i) (by rw [← hvm_P' i x hxi, h_v, hη_P_v i]) + subst hx_v + rw [hvm_H₁ (v' i) (hv' i), hvm_H₁ y hy₁] at hxy + exact η₁.bijOn_v.injOn (hv' i) hy₁ hxy + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxP + obtain ⟨j, hyj⟩ := mem_iUnion.mp hyP + by_cases hij : i = j + · subst hij + rw [hvm_P' i x hxi, hvm_P' i y hyj] at hxy + exact (η_P i).bijOn_v.injOn hxi hyj hxy + · exfalso + have hx_Pi : vm x ∈ V(P i) := by + rw [hvm_P' i x hxi, ← hη_P_im i] + exact (η_P i).bijOn_v.mapsTo hxi + have hy_Pj : vm y ∈ V(P j) := by + rw [hvm_P' j y hyj, ← hη_P_im j] + exact (η_P j).bijOn_v.mapsTo hyj + exact Set.disjoint_left.mp (hP_disj hij) hx_Pi (hxy ▸ hy_Pj) + · intro a ha + rw [hV_ImG] at ha + rcases ha with ha₁ | haP + · obtain ⟨x, hx₁, rfl⟩ := η₁.bijOn_v.surjOn ha₁ + exact ⟨x, hSub_H₁.1 hx₁, hvm_H₁ x hx₁⟩ + · obtain ⟨i, hai⟩ := mem_iUnion.mp haP + obtain ⟨x, hxi, rfl⟩ := (η_P i).bijOn_v.surjOn (hη_P_im i ▸ hai) + exact ⟨x, (hSub_P' i).1 hxi, hvm_P' i x hxi⟩ + +private theorem glued_drawing_edge_map_bijective + {α : Type u} + {β : Type v} + {S' : Type w} + [TopologicalSpace S'] + {G : Graph α β} + (H₁ : Drawing S') + (η₁ : SpanEmbedding H₁ G) + {m : ℕ} + (u' : Fin m → S') + (v' : Fin m → S') + (P : Fin m → Graph α β) + (hP : ∀ (i : Fin m), IsHPathWithEnds G η₁.imageGraph (P i) (η₁.vMap (u' i)) (η₁.vMap (v' i))) + (P' : Fin m → Drawing S') + (η_P : (i : Fin m) → SpanEmbedding (P' i) G) + (hη_P_im : ∀ (i : Fin m), (η_P i).imageGraph = P i) + (H' : Drawing S') + (hH'_E : H'.E = H₁.E ∪ ⋃ i, (P' i).E) + (hSub_H₁ : H₁.IsSubdrawing H') + (hSub_P' : ∀ (i : Fin m), (P' i).IsSubdrawing H') + (em : Set S' → β) + (hem_H₁ : ∀ e ∈ H₁.E, em e = η₁.eMap e) + (hem_P' : ∀ (i : Fin m), ∀ e ∈ (P' i).E, em e = (η_P i).eMap e) + (hE_ImG : E((subgraphUnion G η₁.imageGraph (subgraphSUnion G (range P)))) = E(η₁.imageGraph) ∪ + ⋃ i, E(P i)) + (hPE_disj : Pairwise fun i j => Disjoint E(P i) E(P j)) : + BijOn em H'.E E((subgraphUnion G η₁.imageGraph (subgraphSUnion G (range P)))) := by + let ImG := subgraphUnion G η₁.imageGraph (subgraphSUnion G (range P)) + refine ⟨?_, ?_, ?_⟩ + · intro e he + rw [hH'_E] at he + rw [hE_ImG] + rcases he with he₁ | heP + · rw [hem_H₁ e he₁] + exact Or.inl (η₁.bijOn_e.mapsTo he₁) + · obtain ⟨i, hei⟩ := mem_iUnion.mp heP + rw [hem_P' i e hei] + exact Or.inr (mem_iUnion.mpr ⟨i, hη_P_im i ▸ (η_P i).bijOn_e.mapsTo hei⟩) + · intro e₁ he₁ e₂ he₂ heq + rw [hH'_E] at he₁ he₂ + rcases he₁ with he₁ | he₁P <;> rcases he₂ with he₂ | he₂P + · rw [hem_H₁ e₁ he₁, hem_H₁ e₂ he₂] at heq + exact η₁.bijOn_e.injOn he₁ he₂ heq + · obtain ⟨j, he₂j⟩ := mem_iUnion.mp he₂P + exfalso + have h₁ : em e₁ ∈ E(η₁.imageGraph) := hem_H₁ e₁ he₁ ▸ η₁.bijOn_e.mapsTo he₁ + have h₂ : em e₂ ∈ E(P j) := hem_P' j e₂ he₂j ▸ hη_P_im j ▸ (η_P j).bijOn_e.mapsTo he₂j + exact Set.disjoint_left.mp (hP j).2.2.2.2.2.2 (heq ▸ h₂) h₁ + · obtain ⟨i, he₁i⟩ := mem_iUnion.mp he₁P + exfalso + have h₁ : em e₁ ∈ E(P i) := hem_P' i e₁ he₁i ▸ hη_P_im i ▸ (η_P i).bijOn_e.mapsTo he₁i + have h₂ : em e₂ ∈ E(η₁.imageGraph) := hem_H₁ e₂ he₂ ▸ η₁.bijOn_e.mapsTo he₂ + exact Set.disjoint_left.mp (hP i).2.2.2.2.2.2 h₁ (heq ▸ h₂) + · obtain ⟨i, he₁i⟩ := mem_iUnion.mp he₁P + obtain ⟨j, he₂j⟩ := mem_iUnion.mp he₂P + by_cases hij : i = j + · subst hij + rw [hem_P' i e₁ he₁i, hem_P' i e₂ he₂j] at heq + exact (η_P i).bijOn_e.injOn he₁i he₂j heq + · exfalso + have h₁ : em e₁ ∈ E(P i) := hem_P' i e₁ he₁i ▸ hη_P_im i ▸ (η_P i).bijOn_e.mapsTo he₁i + have h₂ : em e₂ ∈ E(P j) := hem_P' j e₂ he₂j ▸ hη_P_im j ▸ (η_P j).bijOn_e.mapsTo he₂j + exact Set.disjoint_left.mp (hPE_disj hij) h₁ (heq ▸ h₂) + · intro b hb + rw [hE_ImG] at hb + rcases hb with hb₁ | hbP + · obtain ⟨e, he₁, rfl⟩ := η₁.bijOn_e.surjOn hb₁ + exact ⟨e, hSub_H₁.2 he₁, hem_H₁ e he₁⟩ + · obtain ⟨i, hbi⟩ := mem_iUnion.mp hbP + obtain ⟨e, hei, rfl⟩ := (η_P i).bijOn_e.surjOn (hη_P_im i ▸ hbi) + exact ⟨e, (hSub_P' i).2 hei, hem_P' i e hei⟩ + +private theorem glued_drawing_incidence_iff_closure + {α : Type u} + {β : Type v} + {S' : Type w} + [TopologicalSpace S'] + [T2Space S'] + {G : Graph α β} + (H₁ : Drawing S') + (η₁ : SpanEmbedding H₁ G) + {m : ℕ} + (u' : Fin m → S') + (v' : Fin m → S') + (P : Fin m → Graph α β) + (L : Fin m → Set S') + (hu' : ∀ (i : Fin m), u' i ∈ H₁.V) + (hv' : ∀ (i : Fin m), v' i ∈ H₁.V) + (hP : ∀ (i : Fin m), IsHPathWithEnds G η₁.imageGraph (P i) (η₁.vMap (u' i)) (η₁.vMap (v' i))) + (hP_disj : Pairwise fun i j => Disjoint V(P i) V(P j)) + (hL : ∀ (i : Fin m), IsLineWithEnds (L i) (u' i) (v' i)) + (hL_disj : Pairwise fun i j => Disjoint (L i) (L j)) + (hL_inter : ∀ (i : Fin m), L i ∩ H₁.U = {u' i, v' i}) + (P' : Fin m → Drawing S') + (η_P : (i : Fin m) → SpanEmbedding (P' i) G) + (hP'_U : ∀ (i : Fin m), (P' i).U = L i) + (hu'_P'V : ∀ (i : Fin m), u' i ∈ (P' i).V) + (hv'_P'V : ∀ (i : Fin m), v' i ∈ (P' i).V) + (hη_P_im : ∀ (i : Fin m), (η_P i).imageGraph = P i) + (hη_P_u : ∀ (i : Fin m), (η_P i).vMap (u' i) = η₁.vMap (u' i)) + (hη_P_v : ∀ (i : Fin m), (η_P i).vMap (v' i) = η₁.vMap (v' i)) + (H' : Drawing S') + (hH'_V : H'.V = H₁.V ∪ ⋃ i, (P' i).V) + (hH'_E : H'.E = H₁.E ∪ ⋃ i, (P' i).E) + (hP'V_inter_H₁U : ∀ (i : Fin m), (P' i).V ∩ H₁.U = {u' i, v' i}) + (vm : S' → α) + (em : Set S' → β) + (hvm_H₁ : ∀ x ∈ H₁.V, vm x = η₁.vMap x) + (hvm_P' : ∀ (i : Fin m), ∀ x ∈ (P' i).V, vm x = (η_P i).vMap x) + (hem_H₁ : ∀ e ∈ H₁.E, em e = η₁.eMap e) + (hem_P' : ∀ (i : Fin m), ∀ e ∈ (P' i).E, em e = (η_P i).eMap e) + (hP_le : ∀ M ∈ range P, M ≤ G) + (hSUnion_le : subgraphSUnion G (range P) ≤ G) : + ∀ e ∈ H'.E, ∀ v ∈ H'.V, (subgraphUnion G η₁.imageGraph (subgraphSUnion G (range P))).Inc (em + e) (vm v) ↔ v ∈ closure e := by + let ImG := subgraphUnion G η₁.imageGraph (subgraphSUnion G (range P)) + intro e he v hv + rw [hH'_E] at he + rcases he with he₁ | heP + · have hem_in : em e ∈ E(η₁.imageGraph) := hem_H₁ e he₁ ▸ η₁.bijOn_e.mapsTo he₁ + have hem_not_SUnion : em e ∉ E(subgraphSUnion G (range P)) := by + rw [edgeSet_subgraphSUnion hP_le] + intro hmem_u + obtain ⟨M, ⟨i, rfl⟩, hmem⟩ := mem_iUnion₂.mp hmem_u + exact Set.disjoint_left.mp (hP i).2.2.2.2.2.2 hmem hem_in + have hInc_eq : ImG.Inc (em e) (vm v) ↔ η₁.imageGraph.Inc (η₁.eMap e) (vm v) := by + rw [hem_H₁ e he₁] + constructor + · rintro ⟨w, hlink⟩ + rw [subgraphUnion_isLink η₁.imageGraph_le hSUnion_le] at hlink + rcases hlink with hlink₁ | hlink₂ + · exact ⟨w, hlink₁⟩ + · exact (hem_not_SUnion (hem_H₁ e he₁ ▸ hlink₂.edge_mem)).elim + · rintro ⟨w, hlink₁⟩ + exact ⟨w, (subgraphUnion_isLink η₁.imageGraph_le hSUnion_le).mpr (Or.inl hlink₁)⟩ + rw [hInc_eq] + by_cases hv₁ : v ∈ H₁.V + · rw [hvm_H₁ v hv₁, η₁.inc_iff e he₁ v hv₁] + · have hv_P : ∃ i : Fin m, v ∈ (P' i).V := by + rw [hH'_V] at hv + exact mem_iUnion.mp (hv.resolve_left hv₁) + obtain ⟨i, hvi⟩ := hv_P + have hv_not_H₁U : v ∉ H₁.U := by + intro hvU + have hv_pair : v ∈ ({u' i, v' i} : Set S') := hP'V_inter_H₁U i ▸ ⟨hvi, hvU⟩ + rcases hv_pair with rfl | rfl + · exact hv₁ (hu' i) + · exact hv₁ (hv' i) + have hv_not_cl : v ∉ closure e := by + intro hv_cl + have he_sub : e ⊆ H₁.U := fun x hx => (he₁.2.1 hx).1 + exact hv_not_H₁U (H₁.isClosed_U.closure_subset_iff.mpr he_sub hv_cl) + have hvm_not_V₁ : vm v ∉ V(η₁.imageGraph) := by + intro hvm_in + have hvm_Pi : vm v ∈ V(P i) := + hvm_P' i v hvi ▸ hη_P_im i ▸ (η_P i).bijOn_v.mapsTo hvi + have hvm_inter : vm v ∈ V(P i) ∩ V(η₁.imageGraph) := ⟨hvm_Pi, hvm_in⟩ + rw [(hP i).2.2.2.2.2.1] at hvm_inter + rcases hvm_inter with h_u | h_v + · have hv_u : v = u' i := + (η_P i).bijOn_v.injOn hvi (hu'_P'V i) (by rw [← hvm_P' i v hvi, h_u, hη_P_u i]) + exact hv₁ (hv_u ▸ hu' i) + · rw [mem_singleton_iff] at h_v + have hv_v : v = v' i := + (η_P i).bijOn_v.injOn hvi (hv'_P'V i) (by rw [← hvm_P' i v hvi, h_v, hη_P_v i]) + exact hv₁ (hv_v ▸ hv' i) + exact ⟨fun ⟨w, hlink⟩ => (hvm_not_V₁ hlink.left_mem).elim, fun h => (hv_not_cl h).elim⟩ + · obtain ⟨i, hei⟩ := mem_iUnion.mp heP + have hem_in : em e ∈ E(P i) := hem_P' i e hei ▸ hη_P_im i ▸ (η_P i).bijOn_e.mapsTo hei + have hem_not_H₁ : em e ∉ E(η₁.imageGraph) := + Set.disjoint_left.mp (hP i).2.2.2.2.2.2 hem_in + have hInc_eq : ImG.Inc (em e) (vm v) ↔ (P i).Inc ((η_P i).eMap e) (vm v) := by + rw [hem_P' i e hei] + constructor + · rintro ⟨w, hlink⟩ + rw [subgraphUnion_isLink η₁.imageGraph_le hSUnion_le] at hlink + rcases hlink with hlink₁ | hlink₂ + · exact (hem_not_H₁ (hem_P' i e hei ▸ hlink₁.edge_mem)).elim + · have hlink_G : G.IsLink ((η_P i).eMap e) (vm v) w := + (hSUnion_le.isLink_iff hlink₂.edge_mem).mp hlink₂ + have he_Pi : (η_P i).eMap e ∈ E(P i) := hem_P' i e hei ▸ hem_in + exact ⟨w, ((hP i).2.1.1.isLink_iff he_Pi).mpr hlink_G⟩ + · rintro ⟨w, hlink_i⟩ + have hlink_Su : (subgraphSUnion G (range P)).IsLink ((η_P i).eMap e) (vm v) w := + (le_subgraphSUnion hP_le ⟨i, rfl⟩).isLink_mono hlink_i + exact ⟨w, (subgraphUnion_isLink η₁.imageGraph_le hSUnion_le).mpr (Or.inr hlink_Su)⟩ + rw [hInc_eq] + by_cases hvi : v ∈ (P' i).V + · rw [hvm_P' i v hvi, ← hη_P_im i, (η_P i).inc_iff e hei v hvi] + · have hv_not_Li : v ∉ L i := by + intro hvL + rw [hH'_V] at hv + rcases hv with hv₁ | hvP + · have hv_pair : v ∈ ({u' i, v' i} : Set S') := + hL_inter i ▸ ⟨hvL, H₁.V_subset_U hv₁⟩ + rcases hv_pair with rfl | rfl + · exact hvi (hu'_P'V i) + · exact hvi (hv'_P'V i) + · obtain ⟨j, hvj⟩ := mem_iUnion.mp hvP + by_cases hij : i = j + · exact hvi (hij ▸ hvj) + · exact Set.disjoint_left.mp (hL_disj hij) hvL (hP'_U j ▸ (P' j).V_subset_U hvj) + have hv_not_cl : v ∉ closure e := by + intro hv_cl + have he_sub : e ⊆ L i := hP'_U i ▸ fun x hx => (hei.2.1 hx).1 + have hLi_closed : IsClosed (L i) := (isCompact_of_isLineWithEnds' (hL i)).isClosed + exact hv_not_Li (hLi_closed.closure_subset_iff.mpr he_sub hv_cl) + have hvm_not_Pi : vm v ∉ V(P i) := by + intro hvm_in + rw [hH'_V] at hv + rcases hv with hv₁ | hvP + · have hvm_inter : vm v ∈ V(P i) ∩ V(η₁.imageGraph) := + ⟨hvm_in, hvm_H₁ v hv₁ ▸ η₁.bijOn_v.mapsTo hv₁⟩ + rw [(hP i).2.2.2.2.2.1] at hvm_inter + rcases hvm_inter with h_u | h_v + · have hv_u : v = u' i := + η₁.bijOn_v.injOn hv₁ (hu' i) (by rw [← hvm_H₁ v hv₁, h_u]) + exact hvi (hv_u ▸ hu'_P'V i) + · rw [mem_singleton_iff] at h_v + have hv_v : v = v' i := + η₁.bijOn_v.injOn hv₁ (hv' i) (by rw [← hvm_H₁ v hv₁, h_v]) + exact hvi (hv_v ▸ hv'_P'V i) + · obtain ⟨j, hvj⟩ := mem_iUnion.mp hvP + by_cases hij : i = j + · exact hvi (hij ▸ hvj) + · have hvm_Pj : vm v ∈ V(P j) := + hvm_P' j v hvj ▸ hη_P_im j ▸ (η_P j).bijOn_v.mapsTo hvj + exact Set.disjoint_left.mp (hP_disj hij) hvm_in hvm_Pj + exact ⟨fun ⟨w, hlink⟩ => (hvm_not_Pi hlink.left_mem).elim, fun h => (hv_not_cl h).elim⟩ + +/-- Given a base drawing `H₁ : Drawing S'` with `η₁ : SpanEmbedding H₁ G`, and `m` pairwise +vertex-disjoint `η₁(H₁)`-paths `P : Fin m → Graph α β` with ends `η₁.vMap (u' i), η₁.vMap (v' i)` +along `m` pairwise disjoint lines `L : Fin m → Set S'` with `L i ∩ H₁.U = {u' i, v' i}`, +there exist path drawings `P' : Fin m → Drawing S'`, a glued drawing `H' : Drawing S'`, and a +glued `SpanEmbedding H' G` (`η'`). -/ +theorem exists_glued_span_of_lines {G : Graph α β} + (H₁ : Drawing S') (η₁ : SpanEmbedding H₁ G) + {m : ℕ} (u' v' : Fin m → S') (P : Fin m → Graph α β) (L : Fin m → Set S') + (hu' : ∀ i, u' i ∈ H₁.V) (hv' : ∀ i, v' i ∈ H₁.V) + (hP : ∀ i, IsHPathWithEnds G η₁.imageGraph (P i) (η₁.vMap (u' i)) (η₁.vMap (v' i))) + (hP_disj : Pairwise (fun i j => Disjoint V(P i) V(P j))) + (hL : ∀ i, IsLineWithEnds (L i) (u' i) (v' i)) + (hL_disj : Pairwise (fun i j => Disjoint (L i) (L j))) + (hL_inter : ∀ i, L i ∩ H₁.U = {u' i, v' i}) : + ∃ (P' : Fin m → Drawing S') (H' : Drawing S') (η' : SpanEmbedding H' G), + H'.U = H₁.U ∪ ⋃ i : Fin m, L i ∧ + H'.V = H₁.V ∪ ⋃ i : Fin m, (P' i).V ∧ + H'.E = H₁.E ∪ ⋃ i : Fin m, (P' i).E ∧ + H₁.IsSubdrawing H' ∧ + (∀ i, (P' i).U = L i ∧ (P' i).IsPathBetween (u' i) (v' i) ∧ (P' i).IsSubdrawing H' ∧ + u' i ∈ (P' i).V ∧ v' i ∈ (P' i).V) ∧ + Pairwise (fun i j => Disjoint (P' i).U (P' j).U) ∧ + η'.imageGraph = subgraphUnion G η₁.imageGraph (subgraphSUnion G (range P)) ∧ + (∀ x ∈ H₁.V, η'.vMap x = η₁.vMap x) ∧ + (∀ e ∈ H₁.E, η'.eMap e = η₁.eMap e) ∧ + (∀ i, ∀ e ∈ (P' i).E, η'.eMap e ∈ E(P i)) ∧ + (∀ i, ∀ b ∈ E(P i), ∃ e ∈ (P' i).E, η'.eMap e = b) := by + classical + have huv_ne : ∀ i, u' i ≠ v' i := fun i h => (hP i).2.2.1 (congrArg η₁.vMap h) + have hex_P : ∀ i : Fin m, ∃ (D_i : Drawing S') (η_i : SpanEmbedding D_i G), + D_i.U = L i ∧ + D_i.IsPathBetween (u' i) (v' i) ∧ + u' i ∈ D_i.V ∧ v' i ∈ D_i.V ∧ + η_i.imageGraph = P i ∧ + η_i.vMap (u' i) = η₁.vMap (u' i) ∧ + η_i.vMap (v' i) = η₁.vMap (v' i) := by + exact paths_on_gluing_arcs_have_drawings (α := α) (β := β) (S' := S') (G := G) H₁ η₁ (m := m) + u' v' P L hP hL huv_ne + choose P' η_P hP'_U hP'_path hu'_P'V hv'_P'V hη_P_im hη_P_u hη_P_v using hex_P + let D_fam : Option (Fin m) → Drawing S' := Option.elim' H₁ P' + have hZMeet : ∀ o ∈ (univ : Set (Option (Fin m))), (D_fam o).U ∩ H₁.V ⊆ (D_fam o).V := by + rintro (_ | i) _ x ⟨hxU, hxV⟩ + · exact hxV + · change x ∈ (P' i).U at hxU + rw [hP'_U i] at hxU + have hx_pair : x ∈ ({u' i, v' i} : Set S') := hL_inter i ▸ ⟨hxU, H₁.V_subset_U hxV⟩ + rcases hx_pair with rfl | rfl + · exact hu'_P'V i + · exact hv'_P'V i + have hMeet : ∀ o₁ ∈ (univ : Set (Option (Fin m))), ∀ o₂ ∈ (univ : Set (Option (Fin m))), + o₁ ≠ o₂ → (D_fam o₁).U ∩ (D_fam o₂).U ⊆ H₁.V := by + exact initial_drawing_and_gluing_paths_only_meet_at_vertices (S' := S') H₁ (m := m) u' v' L + hu' hv' hL_disj hL_inter P' hP'_U + obtain ⟨H', hH'_U₀, hH'_V₀, hH'_E₀⟩ := + GM16.exists_drawing_of_finite_drawings (Set.toFinite univ) H₁.finite_V D_fam hZMeet hMeet + have hH'_U : H'.U = H₁.U ∪ ⋃ i : Fin m, L i := by + rw [hH'_U₀] + ext x + constructor + · rintro (hxV | hxU) + · exact Or.inl (H₁.V_subset_U hxV) + · obtain ⟨o, -, hxo⟩ := mem_iUnion₂.mp hxU + rcases o with _ | i + · exact Or.inl hxo + · exact Or.inr (mem_iUnion.mpr ⟨i, hP'_U i ▸ hxo⟩) + · rintro (hxU | hxL) + · exact Or.inr (mem_iUnion₂.mpr ⟨none, mem_univ _, hxU⟩) + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxL + exact Or.inr (mem_iUnion₂.mpr ⟨some i, mem_univ _, (hP'_U i).symm ▸ hxi⟩) + have hH'_V : H'.V = H₁.V ∪ ⋃ i : Fin m, (P' i).V := by + rw [hH'_V₀] + ext x + constructor + · rintro (hxV | hxU) + · exact Or.inl hxV + · obtain ⟨o, -, hxo⟩ := mem_iUnion₂.mp hxU + rcases o with _ | i + · exact Or.inl hxo + · exact Or.inr (mem_iUnion.mpr ⟨i, hxo⟩) + · rintro (hxV | hxP) + · exact Or.inl hxV + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxP + exact Or.inr (mem_iUnion₂.mpr ⟨some i, mem_univ _, hxi⟩) + have hH'_E : H'.E = H₁.E ∪ ⋃ i : Fin m, (P' i).E := by + rw [hH'_E₀] + ext e + constructor + · intro heU + obtain ⟨o, -, heo⟩ := mem_iUnion₂.mp heU + rcases o with _ | i + · exact Or.inl heo + · exact Or.inr (mem_iUnion.mpr ⟨i, heo⟩) + · rintro (he₁ | heP) + · exact mem_iUnion₂.mpr ⟨none, mem_univ _, he₁⟩ + · obtain ⟨i, hei⟩ := mem_iUnion.mp heP + exact mem_iUnion₂.mpr ⟨some i, mem_univ _, hei⟩ + have hSub_H₁ : H₁.IsSubdrawing H' := + ⟨by rw [hH'_V]; exact subset_union_left, by rw [hH'_E]; exact subset_union_left⟩ + have hSub_P' : ∀ i, (P' i).IsSubdrawing H' := fun i => + ⟨by rw [hH'_V]; exact (subset_iUnion (fun j => (P' j).V) i).trans subset_union_right, + by rw [hH'_E]; exact (subset_iUnion (fun j => (P' j).E) i).trans subset_union_right⟩ + have hP'_disj : Pairwise (fun i j => Disjoint (P' i).U (P' j).U) := by + intro i j hij + rw [hP'_U i, hP'_U j] + exact hL_disj hij + have hP'V_inter_H₁U : ∀ i, (P' i).V ∩ H₁.U = {u' i, v' i} := by + intro i + refine Subset.antisymm ?_ ?_ + · intro x ⟨hxV, hxU⟩ + have hxL : x ∈ L i := hP'_U i ▸ (P' i).V_subset_U hxV + exact hL_inter i ▸ ⟨hxL, hxU⟩ + · rintro x (rfl | rfl) + · exact ⟨hu'_P'V i, H₁.V_subset_U (hu' i)⟩ + · exact ⟨hv'_P'V i, H₁.V_subset_U (hv' i)⟩ + have hP'E_disj_H₁U : ∀ i, ∀ e ∈ (P' i).E, Disjoint e H₁.U := by + intro i e he + refine Set.disjoint_left.mpr fun x hxe hxU => ?_ + have hx_diff : x ∈ (P' i).U \ (P' i).V := he.2.1 hxe + have hx_pair : x ∈ ({u' i, v' i} : Set S') := hL_inter i ▸ ⟨hP'_U i ▸ hx_diff.1, hxU⟩ + rcases hx_pair with rfl | rfl + · exact hx_diff.2 (hu'_P'V i) + · exact hx_diff.2 (hv'_P'V i) + have hP'E_disj_H₁E : ∀ i, Disjoint (P' i).E H₁.E := by + intro i + refine Set.disjoint_left.mpr fun e heP he₁ => ?_ + obtain ⟨x, hxe⟩ := heP.1 + exact Set.disjoint_left.mp (hP'E_disj_H₁U i e heP) hxe (he₁.2.1 hxe).1 + have hP'E_disj : Pairwise (fun i j => Disjoint (P' i).E (P' j).E) := by + intro i j hij + refine Set.disjoint_left.mpr fun e hei hej => ?_ + obtain ⟨x, hxe⟩ := hei.1 + exact Set.disjoint_left.mp (hP'_disj hij) (hei.2.1 hxe).1 (hej.2.1 hxe).1 + let vm : S' → α := fun x => + if x ∈ H₁.V then η₁.vMap x + else if h : ∃ i : Fin m, x ∈ (P' i).V then (η_P (Classical.choose h)).vMap x + else η₁.vMap x + let em : Set S' → β := fun e => + if e ∈ H₁.E then η₁.eMap e + else if h : ∃ i : Fin m, e ∈ (P' i).E then (η_P (Classical.choose h)).eMap e + else η₁.eMap e + have hvm_H₁ : ∀ x ∈ H₁.V, vm x = η₁.vMap x := fun x hx => ite_eq_left hx + have hvm_P' : ∀ i, ∀ x ∈ (P' i).V, vm x = (η_P i).vMap x := by + intro i x hx + by_cases hx₁ : x ∈ H₁.V + · rw [hvm_H₁ x hx₁] + have hx_pair : x ∈ ({u' i, v' i} : Set S') := + hP'V_inter_H₁U i ▸ ⟨hx, H₁.V_subset_U hx₁⟩ + rcases hx_pair with rfl | rfl + · exact (hη_P_u i).symm + · exact (hη_P_v i).symm + · have hex : ∃ j : Fin m, x ∈ (P' j).V := ⟨i, hx⟩ + have h_eq : vm x = (η_P (Classical.choose hex)).vMap x := by + dsimp [vm] + rw [ite_eq_right hx₁, dite_eq_left hex] + rw [h_eq] + have h_choose : Classical.choose hex = i := by + by_contra hne + exact Set.disjoint_left.mp (hP'_disj hne) + ((P' (Classical.choose hex)).V_subset_U (Classical.choose_spec hex)) + ((P' i).V_subset_U hx) + rw [h_choose] + have hem_H₁ : ∀ e ∈ H₁.E, em e = η₁.eMap e := fun e he => ite_eq_left he + have hem_P' : ∀ i, ∀ e ∈ (P' i).E, em e = (η_P i).eMap e := by + intro i e he + have he₁ : e ∉ H₁.E := Set.disjoint_left.mp (hP'E_disj_H₁E i) he + have hex : ∃ j : Fin m, e ∈ (P' j).E := ⟨i, he⟩ + have h_eq : em e = (η_P (Classical.choose hex)).eMap e := by + dsimp [em] + rw [ite_eq_right he₁, dite_eq_left hex] + rw [h_eq] + have h_choose : Classical.choose hex = i := by + by_contra hne + exact Set.disjoint_left.mp (hP'E_disj hne) (Classical.choose_spec hex) he + rw [h_choose] + let ImG := subgraphUnion G η₁.imageGraph (subgraphSUnion G (range P)) + have hP_le : ∀ M ∈ range P, M ≤ G := by + rintro _ ⟨i, rfl⟩ + exact (hP i).2.1.1 + have hSUnion_le : subgraphSUnion G (range P) ≤ G := subgraphSUnion_le hP_le + have hImG_le : ImG ≤ G := subgraphUnion_le η₁.imageGraph_le hSUnion_le + have hV_ImG : V(ImG) = V(η₁.imageGraph) ∪ ⋃ i : Fin m, V(P i) := by + change V(η₁.imageGraph) ∪ V(subgraphSUnion G (range P)) = _ + rw [vertexSet_subgraphSUnion] + ext a + simp + have hE_ImG : E(ImG) = E(η₁.imageGraph) ∪ ⋃ i : Fin m, E(P i) := by + change E(subgraphUnion G η₁.imageGraph (subgraphSUnion G (range P))) = _ + rw [edgeSet_subgraphUnion η₁.imageGraph_le hSUnion_le, edgeSet_subgraphSUnion hP_le] + ext b + simp + have hBij_v : BijOn vm H'.V V(ImG) := by + exact glued_drawing_vertex_map_bijective (α := α) (β := β) (S' := S') (G := G) H₁ η₁ (m := m) + u' v' P hu' hv' hP hP_disj P' η_P hu'_P'V hv'_P'V hη_P_im hη_P_u hη_P_v H' hH'_V hSub_H₁ + hSub_P' vm hvm_H₁ hvm_P' hV_ImG + have hPE_disj : Pairwise (fun i j => Disjoint E(P i) E(P j)) := by + intro i j hij + refine Set.disjoint_left.mpr fun b hbi hbj => ?_ + obtain ⟨x, y, hlink⟩ := (P i).exists_isLink_of_mem_edgeSet hbi + have hx_i : x ∈ V(P i) := hlink.left_mem + have hlink_G : G.IsLink b x y := ((hP i).2.1.1.isLink_iff hbi).mp hlink + have hlink_j : (P j).IsLink b x y := ((hP j).2.1.1.isLink_iff hbj).mpr hlink_G + exact Set.disjoint_left.mp (hP_disj hij) hx_i hlink_j.left_mem + have hBij_e : BijOn em H'.E E(ImG) := by + exact glued_drawing_edge_map_bijective (α := α) (β := β) (S' := S') (G := G) H₁ η₁ (m := m) u' + v' P hP P' η_P hη_P_im H' hH'_E hSub_H₁ hSub_P' em hem_H₁ hem_P' hE_ImG hPE_disj + have hInc_iff : ∀ e ∈ H'.E, ∀ v ∈ H'.V, ImG.Inc (em e) (vm v) ↔ v ∈ closure e := by + exact glued_drawing_incidence_iff_closure (α := α) (β := β) (S' := S') (G := G) H₁ η₁ (m := m) + u' v' P L hu' hv' hP hP_disj hL hL_disj hL_inter P' η_P hP'_U hu'_P'V hv'_P'V hη_P_im hη_P_u + hη_P_v H' hH'_V hH'_E hP'V_inter_H₁U vm em hvm_H₁ hvm_P' hem_H₁ hem_P' hP_le hSUnion_le + let η' : SpanEmbedding H' G := ⟨ImG, vm, em, hImG_le, hBij_v, hBij_e, hInc_iff⟩ + refine ⟨P', H', η', hH'_U, hH'_V, hH'_E, hSub_H₁, + fun i => ⟨hP'_U i, hP'_path i, hSub_P' i, hu'_P'V i, hv'_P'V i⟩, + hP'_disj, rfl, hvm_H₁, hem_H₁, ?_, ?_⟩ + · intro i e he + change em e ∈ E(P i) + rw [hem_P' i e he, ← hη_P_im i] + exact (η_P i).bijOn_e.mapsTo he + · intro i b hb + obtain ⟨e, he, rfl⟩ := (η_P i).bijOn_e.surjOn (hη_P_im i ▸ hb) + exact ⟨e, he, hem_P' i e he⟩ + +/-- If `K ⊆ S'` is closed, `H₁.U ⊆ K`, and `L i ∩ K = {u' i, v' i}` for all `i`, then for the +glued drawing `H'`, `H'.U ∩ K = H₁.U`, `H'.V ∩ K = H₁.V`, and `H'.interSet K = H₁`. -/ +theorem glued_interSet_base_eq + {H₁ H' : Drawing S'} {m : ℕ} {u' v' : Fin m → S'} {L : Fin m → Set S'} + {P' : Fin m → Drawing S'} {K : Set S'} + (hK : IsClosed K) + (hu' : ∀ i, u' i ∈ H₁.V) (hv' : ∀ i, v' i ∈ H₁.V) + (hH₁_sub : H₁.U ⊆ K) + (hL_K : ∀ i, L i ∩ K = {u' i, v' i}) + (hH'_U : H'.U = H₁.U ∪ ⋃ i : Fin m, L i) + (hH'_V : H'.V = H₁.V ∪ ⋃ i : Fin m, (P' i).V) + (hH'_E : H'.E = H₁.E ∪ ⋃ i : Fin m, (P' i).E) + (hP' : ∀ i, (P' i).U = L i ∧ (P' i).IsPathBetween (u' i) (v' i) ∧ (P' i).IsSubdrawing H' ∧ + u' i ∈ (P' i).V ∧ v' i ∈ (P' i).V) : + H'.U ∩ K = H₁.U ∧ H'.V ∩ K = H₁.V ∧ H'.interSet K = H₁ := by + have hUK : H'.U ∩ K = H₁.U := by + rw [hH'_U, union_inter_distrib_right, inter_eq_left.mpr hH₁_sub] + refine union_eq_self_of_subset_right ?_ + rintro x ⟨hxL, hxK⟩ + obtain ⟨i, hxi⟩ := mem_iUnion.mp hxL + have hx_pair : x ∈ ({u' i, v' i} : Set S') := hL_K i ▸ ⟨hxi, hxK⟩ + rcases hx_pair with rfl | rfl + · exact H₁.V_subset_U (hu' i) + · exact H₁.V_subset_U (hv' i) + have hVK : H'.V ∩ K = H₁.V := by + rw [hH'_V, union_inter_distrib_right, inter_eq_left.mpr (H₁.V_subset_U.trans hH₁_sub)] + refine union_eq_self_of_subset_right ?_ + rintro x ⟨hxP, hxK⟩ + obtain ⟨i, hxi⟩ := mem_iUnion.mp hxP + have hxL : x ∈ L i := (hP' i).1 ▸ (P' i).V_subset_U hxi + have hx_pair : x ∈ ({u' i, v' i} : Set S') := hL_K i ▸ ⟨hxL, hxK⟩ + rcases hx_pair with rfl | rfl + · exact hu' i + · exact hv' i + refine ⟨hUK, hVK, ?_⟩ + apply Drawing.ext_of_V_E + · rw [interSet_V_of_isClosed H' hK, hVK] + · rw [interSet_E H' K, hH'_E] + ext e + constructor + · rintro ⟨he₁ | heP, heK⟩ + · exact he₁ + · obtain ⟨i, hei⟩ := mem_iUnion.mp heP + obtain ⟨x, hxe⟩ := hei.1 + have hx_diff : x ∈ (P' i).U \ (P' i).V := hei.2.1 hxe + have hx_pair : x ∈ ({u' i, v' i} : Set S') := + hL_K i ▸ ⟨(hP' i).1 ▸ hx_diff.1, heK hxe⟩ + rcases hx_pair with rfl | rfl + · exact (hx_diff.2 (hP' i).2.2.2.1).elim + · exact (hx_diff.2 (hP' i).2.2.2.2).elim + · intro he₁ + exact ⟨Or.inl he₁, fun x hx => hH₁_sub (he₁.2.1 hx).1⟩ + +/-- If `P₂ ⊆ S'` is closed, `L i ⊆ P₂` for all `i`, and `H₁.U ∩ P₂ ⊆ ⋃ i, {u' i, v' i}`, then +each `P' i` is a subdrawing of `H'.interSet P₂` and `(H'.interSet P₂).U = ⋃ i, (P' i).U`. -/ +theorem glued_interSet_paths_eq + {H₁ H' : Drawing S'} {m : ℕ} {u' v' : Fin m → S'} {L : Fin m → Set S'} + {P' : Fin m → Drawing S'} {P₂ : Set S'} + (hP₂ : IsClosed P₂) + (hL_P₂ : ∀ i, L i ⊆ P₂) + (hH₁_P₂ : H₁.U ∩ P₂ ⊆ ⋃ i : Fin m, ({u' i, v' i} : Set S')) + (hH'_V : H'.V = H₁.V ∪ ⋃ i : Fin m, (P' i).V) + (hH'_E : H'.E = H₁.E ∪ ⋃ i : Fin m, (P' i).E) + (hP' : ∀ i, (P' i).U = L i ∧ (P' i).IsPathBetween (u' i) (v' i) ∧ (P' i).IsSubdrawing H' ∧ + u' i ∈ (P' i).V ∧ v' i ∈ (P' i).V) : + (∀ i, (P' i).IsSubdrawing (H'.interSet P₂)) ∧ + (H'.interSet P₂).U = ⋃ i : Fin m, (P' i).U := by + have hSub_i : ∀ i, (P' i).IsSubdrawing (H'.interSet P₂) := by + intro i + refine ⟨?_, ?_⟩ + · rw [interSet_V_of_isClosed H' hP₂] + intro x hx + exact ⟨(hP' i).2.2.1.1 hx, hL_P₂ i ((hP' i).1 ▸ (P' i).V_subset_U hx)⟩ + · rw [interSet_E H' P₂] + intro e he + exact ⟨(hP' i).2.2.1.2 he, fun x hx => hL_P₂ i ((hP' i).1 ▸ (he.2.1 hx).1)⟩ + refine ⟨hSub_i, ?_⟩ + have hV_eq : (H'.interSet P₂).V = ⋃ i : Fin m, (P' i).V := by + rw [interSet_V_of_isClosed H' hP₂, hH'_V, union_inter_distrib_right] + refine Subset.antisymm (union_subset ?_ ?_) ?_ + · intro x ⟨hx₁, hxP₂⟩ + obtain ⟨i, hxi⟩ := mem_iUnion.mp (hH₁_P₂ ⟨H₁.V_subset_U hx₁, hxP₂⟩) + rcases hxi with rfl | rfl + · exact mem_iUnion.mpr ⟨i, (hP' i).2.2.2.1⟩ + · exact mem_iUnion.mpr ⟨i, (hP' i).2.2.2.2⟩ + · rintro x ⟨hxP, _⟩ + exact hxP + · intro x hx + obtain ⟨i, hxi⟩ := mem_iUnion.mp hx + exact Or.inr ⟨hx, hL_P₂ i ((hP' i).1 ▸ (P' i).V_subset_U hxi)⟩ + have hE_eq : (H'.interSet P₂).E = ⋃ i : Fin m, (P' i).E := by + rw [interSet_E H' P₂, hH'_E] + ext e + constructor + · rintro ⟨he₁ | heP, heP₂⟩ + · obtain ⟨x, hxe⟩ := he₁.1 + have hx_diff : x ∈ H₁.U \ H₁.V := he₁.2.1 hxe + obtain ⟨i, hxi⟩ := mem_iUnion.mp (hH₁_P₂ ⟨hx_diff.1, heP₂ hxe⟩) + exfalso + have hx_P'V : x ∈ (P' i).V := by + rcases hxi with rfl | rfl + · exact (hP' i).2.2.2.1 + · exact (hP' i).2.2.2.2 + have hx_H'V : x ∈ H'.V := (hP' i).2.2.1.1 hx_P'V + have he_H'E : e ∈ H'.E := by rw [hH'_E]; exact Or.inl he₁ + exact (he_H'E.2.1 hxe).2 hx_H'V + · exact heP + · intro heP + obtain ⟨i, hei⟩ := mem_iUnion.mp heP + exact ⟨Or.inr heP, fun x hx => hL_P₂ i ((hP' i).1 ▸ (hei.2.1 hx).1)⟩ + rw [(H'.interSet P₂).U_eq, hV_eq, hE_eq] + ext x + constructor + · rintro (hxV | hxE) + · obtain ⟨i, hxi⟩ := mem_iUnion.mp hxV + exact mem_iUnion.mpr ⟨i, (P' i).V_subset_U hxi⟩ + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hxE + obtain ⟨i, hei⟩ := mem_iUnion.mp he + have hcl_sub : closure e ⊆ (P' i).U := + (P' i).isClosed_U.closure_subset_iff.mpr fun y hy => (hei.2.1 hy).1 + exact mem_iUnion.mpr ⟨i, hcl_sub hxe⟩ + · intro hx + obtain ⟨i, hxi⟩ := mem_iUnion.mp hx + rw [(P' i).U_eq] at hxi + rcases hxi with hxV | hxE + · exact Or.inl (mem_iUnion.mpr ⟨i, hxV⟩) + · obtain ⟨e, hei, hxe⟩ := mem_iUnion₂.mp hxE + exact Or.inr (mem_iUnion₂.mpr ⟨e, mem_iUnion.mpr ⟨i, hei⟩, hxe⟩) + +omit [T2Space S'] in +/-- If a curve `C_j ⊆ S'` meets `H₁.U` in `X_C ⊆ H₁.V` and meets `⋃ i, L i` in `X_C`, then +`H'.IsNormal C_j` and `H'.V ∩ C_j = X_C`. -/ +theorem glued_isNormal_and_V_inter + {H₁ H' : Drawing S'} {m : ℕ} {L : Fin m → Set S'} {P' : Fin m → Drawing S'} + {C_j X_C : Set S'} + (hX_sub : X_C ⊆ H₁.V) + (hH₁_C : H₁.U ∩ C_j = X_C) + (hL_C : (⋃ i : Fin m, L i) ∩ C_j ⊆ X_C) + (hH'_U : H'.U = H₁.U ∪ ⋃ i : Fin m, L i) + (hH'_V : H'.V = H₁.V ∪ ⋃ i : Fin m, (P' i).V) : + H'.IsNormal C_j ∧ H'.V ∩ C_j = X_C := by + have hUC : H'.U ∩ C_j = X_C := by + rw [hH'_U, union_inter_distrib_right, hH₁_C] + exact union_eq_self_of_subset_right hL_C + have hX_H'V : X_C ⊆ H'.V := by + rw [hH'_V] + exact hX_sub.trans subset_union_left + refine ⟨?_, ?_⟩ + · intro x ⟨hxC, hxU⟩ + have hxX : x ∈ X_C := hUC ▸ ⟨hxU, hxC⟩ + exact hX_H'V hxX + · refine Subset.antisymm ?_ ?_ + · intro x ⟨hxV, hxC⟩ + exact hUC ▸ ⟨H'.V_subset_U hxV, hxC⟩ + · intro x hxX + have hxC : x ∈ C_j := (hUC ▸ hxX).2 + exact ⟨hX_H'V hxX, hxC⟩ + +end GluePaths + +/-! ## 3. `IsCappedDrawing`, `IsTangle`, and `IsControllingTangle` Across a Cut -/ + +section InducedAcrossControl + +variable {α : Type u} {β : Type v} + {S' S_hat : Type w} [TopologicalSpace S'] [T2Space S'] + [TopologicalSpace S_hat] [T2Space S_hat] + +omit [T2Space S_hat] in +/-- When `H₁ = liftDrawingOn hK hg hf hl H hHU` and `H'.U ∩ P₁ = H₁.U`, `H'.V ∩ P₁ = H₁.V`, +and `ι ⟨g y, hy⟩ = y` for all `y ∈ K` with `g y ∈ P₁`, `GM12.IsCappedDrawing ι H' H` holds. -/ +theorem isCappedDrawing_of_glued + {P₁ : Set S'} {ι : P₁ → S_hat} + {K : Set S_hat} (hK : IsCompact K) + {g : S_hat → S'} {f : S' → S_hat} + (hg : ContinuousOn g K) (hf : ContinuousOn f (g '' K)) (hl : LeftInvOn f g K) + {H : Drawing S_hat} (hHU : H.U ⊆ K) + {H' : Drawing S'} + (hU_P₁ : H'.U ∩ P₁ = (liftDrawingOn hK hg hf hl H hHU).U) + (hV_P₁ : H'.V ∩ P₁ = (liftDrawingOn hK hg hf hl H hHU).V) + (hι_g : ∀ y ∈ K, ∀ hy : g y ∈ P₁, ι ⟨g y, hy⟩ = y) : + GM12.IsCappedDrawing ι H' H := by + constructor + · ext y + constructor + · intro hyU + have hy_gP₁ : g y ∈ H'.U ∩ P₁ := by + rw [hU_P₁] + exact ⟨y, hyU, rfl⟩ + exact ⟨⟨g y, hy_gP₁.2⟩, hy_gP₁.1, hι_g y (hHU hyU) hy_gP₁.2⟩ + · rintro ⟨⟨x, hxP₁⟩, hxU, rfl⟩ + have hx_g : x ∈ g '' H.U := by + have : x ∈ H'.U ∩ P₁ := ⟨hxU, hxP₁⟩ + rwa [hU_P₁] at this + obtain ⟨y, hyU, rfl⟩ := hx_g + rw [hι_g y (hHU hyU) hxP₁] + exact hyU + · ext y + constructor + · intro hyV + have hy_gP₁ : g y ∈ H'.V ∩ P₁ := by + rw [hV_P₁] + exact ⟨y, hyV, rfl⟩ + exact ⟨⟨g y, hy_gP₁.2⟩, hy_gP₁.1, hι_g y (H.V_subset_U.trans hHU hyV) hy_gP₁.2⟩ + · rintro ⟨⟨x, hxP₁⟩, hxV, rfl⟩ + have hx_g : x ∈ g '' H.V := by + have : x ∈ H'.V ∩ P₁ := ⟨hxV, hxP₁⟩ + rwa [hV_P₁] at this + obtain ⟨y, hyV, rfl⟩ := hx_g + rw [hι_g y (H.V_subset_U.trans hHU hyV) hxP₁] + exact hyV + +/-- Pushforward of a subhypergraph `A' ≤ H'.toHypergraph` to `H.toHypergraph` along `g : S_hat → +S'`. -/ +def pushHypergraphOn {K : Set S_hat} (hK : IsCompact K) + {g : S_hat → S'} {f : S' → S_hat} + (hg : ContinuousOn g K) (hf : ContinuousOn f (g '' K)) (hl : LeftInvOn f g K) + {H : Drawing S_hat} (hHU : H.U ⊆ K) + {H' : Drawing S'} + (hSub : (liftDrawingOn hK hg hf hl H hHU).IsSubdrawing H') + (A' : Hypergraph S' (Set S')) (hA' : A' ≤ H'.toHypergraph) : + Hypergraph S_hat (Set S_hat) where + vertexSet := {v ∈ H.V | g v ∈ A'.vertexSet} + edgeSet := {e ∈ H.E | g '' e ∈ A'.edgeSet} + Inc e v := H.toHypergraph.Inc e v ∧ e ∈ H.E ∧ g '' e ∈ A'.edgeSet + vertex_mem_of_inc e v h := by + refine ⟨h.1.2.1, ?_⟩ + have he'_H₁ : g '' e ∈ (liftDrawingOn hK hg hf hl H hHU).E := by + rw [liftDrawingOn_E hK hg hf hl H hHU] + exact ⟨e, h.2.1, rfl⟩ + have he'_H' : g '' e ∈ H'.E := hSub.2 he'_H₁ + have hv'_H' : g v ∈ H'.V := hSub.1 ⟨v, h.1.2.1, rfl⟩ + have hv'_cl : g v ∈ closure (g '' e) := by + rw [liftDrawingOn_closure_edge hK hg hf hl hHU h.2.1] + exact ⟨v, h.1.2.2, rfl⟩ + have hinc' : H'.toHypergraph.Inc (g '' e) (g v) := ⟨he'_H', hv'_H', hv'_cl⟩ + have hv'_ends : g v ∈ A'.ends (g '' e) := by + rw [← hA'.ends_eq (g '' e) h.2.2] + exact hinc' + exact A'.vertex_mem_of_inc hv'_ends + edge_mem_of_inc _ _ h := h.2 + vertexSet_finite := H.finite_V.subset fun _ h => h.1 + edgeSet_finite := H.finite_edges.subset fun _ h => h.1 + +omit [T2Space S_hat] in +theorem pushHypergraphOn_le {K : Set S_hat} (hK : IsCompact K) + {g : S_hat → S'} {f : S' → S_hat} + (hg : ContinuousOn g K) (hf : ContinuousOn f (g '' K)) (hl : LeftInvOn f g K) + {H : Drawing S_hat} (hHU : H.U ⊆ K) + {H' : Drawing S'} + (hSub : (liftDrawingOn hK hg hf hl H hHU).IsSubdrawing H') + (A' : Hypergraph S' (Set S')) (hA' : A' ≤ H'.toHypergraph) : + pushHypergraphOn hK hg hf hl hHU hSub A' hA' ≤ H.toHypergraph := by + refine ⟨fun _ h => h.1, fun _ h => h.1, fun e he => ?_⟩ + ext v + change H.toHypergraph.Inc e v ↔ H.toHypergraph.Inc e v ∧ e ∈ H.E ∧ g '' e ∈ A'.edgeSet + exact ⟨fun h => ⟨h, he.1, he.2⟩, fun h => h.1⟩ + +omit [T2Space S_hat] in +theorem isSeparation_pushHypergraphOn {K : Set S_hat} (hK : IsCompact K) + {g : S_hat → S'} {f : S' → S_hat} + (hg : ContinuousOn g K) (hf : ContinuousOn f (g '' K)) (hl : LeftInvOn f g K) + {H : Drawing S_hat} (hHU : H.U ⊆ K) + {H' : Drawing S'} + (hSub : (liftDrawingOn hK hg hf hl H hHU).IsSubdrawing H') + {A' B' : Hypergraph S' (Set S')} (hsep : H'.toHypergraph.IsSeparation A' B') : + H.toHypergraph.IsSeparation + (pushHypergraphOn hK hg hf hl hHU hSub A' hsep.left_le) + (pushHypergraphOn hK hg hf hl hHU hSub B' hsep.right_le) ∧ + separationOrder + (pushHypergraphOn hK hg hf hl hHU hSub A' hsep.left_le) + (pushHypergraphOn hK hg hf hl hHU hSub B' hsep.right_le) ≤ separationOrder A' B' := by + have hAl := pushHypergraphOn_le hK hg hf hl hHU hSub A' hsep.left_le + have hBl := pushHypergraphOn_le hK hg hf hl hHU hSub B' hsep.right_le + refine ⟨(isSeparation_iff_of_le hAl hBl).mpr ⟨?_, ?_, ?_⟩, ?_⟩ + · ext v + change (v ∈ H.V ∧ g v ∈ A'.vertexSet ∨ v ∈ H.V ∧ g v ∈ B'.vertexSet) ↔ v ∈ H.V + constructor + · rintro (⟨hv, _⟩ | ⟨hv, _⟩) <;> exact hv + · intro hv + have hgv : g v ∈ A'.vertexSet ∪ B'.vertexSet := by + rw [hsep.vertexSet_union] + exact hSub.1 ⟨v, hv, rfl⟩ + rcases hgv with hvA | hvB + · exact Or.inl ⟨hv, hvA⟩ + · exact Or.inr ⟨hv, hvB⟩ + · ext e + change (e ∈ H.E ∧ g '' e ∈ A'.edgeSet ∨ e ∈ H.E ∧ g '' e ∈ B'.edgeSet) ↔ e ∈ H.E + constructor + · rintro (⟨he, _⟩ | ⟨he, _⟩) <;> exact he + · intro he + have hge : g '' e ∈ A'.edgeSet ∪ B'.edgeSet := by + rw [hsep.edgeSet_union] + refine hSub.2 ?_ + rw [liftDrawingOn_E hK hg hf hl H hHU] + exact ⟨e, he, rfl⟩ + rcases hge with heA | heB + · exact Or.inl ⟨he, heA⟩ + · exact Or.inr ⟨he, heB⟩ + · ext e + change ((e ∈ H.E ∧ g '' e ∈ A'.edgeSet) ∧ (e ∈ H.E ∧ g '' e ∈ B'.edgeSet)) ↔ + e ∈ (∅ : Set (Set S_hat)) + simp only [mem_empty_iff_false, iff_false] + rintro ⟨⟨_, heA⟩, ⟨_, heB⟩⟩ + exact hsep.notMem_edgeSet_right heA heB + · have hinj : InjOn g (pushHypergraphOn hK hg hf hl hHU hSub A' hsep.left_le ∩ + pushHypergraphOn hK hg hf hl hHU hSub B' hsep.right_le).vertexSet := + hl.injOn.mono fun v ⟨⟨hv, _⟩, _⟩ => H.V_subset_U.trans hHU hv + have hsub_img : g '' (pushHypergraphOn hK hg hf hl hHU hSub A' hsep.left_le ∩ + pushHypergraphOn hK hg hf hl hHU hSub B' hsep.right_le).vertexSet ⊆ + (A' ∩ B').vertexSet := by + rintro _ ⟨v, ⟨⟨_, hvA⟩, ⟨_, hvB⟩⟩, rfl⟩ + exact ⟨hvA, hvB⟩ + calc separationOrder (pushHypergraphOn hK hg hf hl hHU hSub A' hsep.left_le) + (pushHypergraphOn hK hg hf hl hHU hSub B' hsep.right_le) + _ = (g '' (pushHypergraphOn hK hg hf hl hHU hSub A' hsep.left_le ∩ + pushHypergraphOn hK hg hf hl hHU hSub B' hsep.right_le).vertexSet).ncard := + (hinj.ncard_image).symm + _ ≤ separationOrder A' B' := Set.ncard_le_ncard hsub_img (A' ∩ B').vertexSet_finite + +omit [T2Space S_hat] in +/-- Characterization of `GM12.inducedAcross ι H' H φ T₁` in terms of `pushHypergraphOn`. -/ +theorem mem_inducedAcross_iff_pushHypergraphOn + {P₁ : Set S'} {ι : P₁ → S_hat} + {K : Set S_hat} (hK : IsCompact K) + {g : S_hat → S'} {f : S' → S_hat} + (hg : ContinuousOn g K) (hf : ContinuousOn f (g '' K)) (hl : LeftInvOn f g K) + {H : Drawing S_hat} (hHU : H.U ⊆ K) + {H' : Drawing S'} + (hSub : (liftDrawingOn hK hg hf hl H hHU).IsSubdrawing H') + (hU_P₁ : H'.U ∩ P₁ = (liftDrawingOn hK hg hf hl H hHU).U) + (hV_P₁ : H'.V ∩ P₁ = (liftDrawingOn hK hg hf hl H hHU).V) + (hι_g : ∀ y ∈ K, ∀ hy : g y ∈ P₁, ι ⟨g y, hy⟩ = y) + {φ : ℕ} {T₁ : Set (Hypergraph S_hat (Set S_hat) × Hypergraph S_hat (Set S_hat))} + (hT₁ : IsTangle H.toHypergraph φ T₁) + {A' B' : Hypergraph S' (Set S')} : + (A', B') ∈ GM12.inducedAcross ι H' H φ T₁ ↔ + ∃ hsep : H'.toHypergraph.IsSeparation A' B', + separationOrder A' B' < φ ∧ + (pushHypergraphOn hK hg hf hl hHU hSub A' hsep.left_le, + pushHypergraphOn hK hg hf hl hHU hSub B' hsep.right_le) ∈ T₁ := by + have hVertex_eq : ∀ {C' : Hypergraph S' (Set S')} (hC' : C' ≤ H'.toHypergraph), + ι '' ((↑) ⁻¹' C'.vertexSet) = + (pushHypergraphOn hK hg hf hl hHU hSub C' hC').vertexSet := by + intro C' hC' + ext y + constructor + · rintro ⟨⟨x, hxP₁⟩, hxC', rfl⟩ + have hx_g : x ∈ g '' H.V := by + have : x ∈ H'.V ∩ P₁ := ⟨hC'.vertexSet_subset hxC', hxP₁⟩ + rwa [hV_P₁] at this + obtain ⟨v, hvV, rfl⟩ := hx_g + rw [hι_g v (H.V_subset_U.trans hHU hvV) hxP₁] + exact ⟨hvV, hxC'⟩ + · rintro ⟨hyV, hgyC'⟩ + have hgyP₁ : g y ∈ P₁ := by + have : g y ∈ H'.V ∩ P₁ := by + rw [hV_P₁] + exact ⟨y, hyV, rfl⟩ + exact this.2 + exact ⟨⟨g y, hgyP₁⟩, hgyC', hι_g y (H.V_subset_U.trans hHU hyV) hgyP₁⟩ + have hEdge_iff : ∀ {C' : Hypergraph S' (Set S')} (hC' : C' ≤ H'.toHypergraph), + ∀ e ∈ H.E, (∃ f' ∈ C'.edgeSet, e = ι '' ((↑) ⁻¹' f')) ↔ + e ∈ (pushHypergraphOn hK hg hf hl hHU hSub C' hC').edgeSet := by + intro C' hC' e he + constructor + · rintro ⟨f', hf'C', he_eq⟩ + refine ⟨he, ?_⟩ + have hf'H' : f' ∈ H'.E := hC'.edgeSet_subset hf'C' + obtain ⟨y, hye⟩ := he.1 + have hy_img : y ∈ ι '' ((↑) ⁻¹' f') := he_eq ▸ hye + obtain ⟨⟨x, hxP₁⟩, hxf', rfl⟩ := hy_img + have hx_diff : x ∈ H'.U \ H'.V := hf'H'.2.1 hxf' + have hx_H₁_diff : x ∈ (liftDrawingOn hK hg hf hl H hHU).U \ + (liftDrawingOn hK hg hf hl H hHU).V := by + refine ⟨?_, fun hxV₁ => hx_diff.2 (hSub.1 hxV₁)⟩ + rw [← hU_P₁] + exact ⟨hx_diff.1, hxP₁⟩ + obtain ⟨e₁', he₁'_H₁, hxe₁'⟩ := GM11.exists_mem_arcComponent hx_H₁_diff + have he₁'_H' : e₁' ∈ H'.E := hSub.2 he₁'_H₁ + have hf'_eq : f' = e₁' := + GM11.arcComponent_eq hf'H' he₁'_H' hxf' hxe₁' + subst hf'_eq + change f' ∈ (liftDrawingOn hK hg hf hl H hHU).E at he₁'_H₁ + rw [liftDrawingOn_E hK hg hf hl H hHU] at he₁'_H₁ + obtain ⟨e₀, he₀, rfl⟩ := he₁'_H₁ + have h_img_e₀ : ι '' ((↑) ⁻¹' (g '' e₀)) = e₀ := by + ext z + constructor + · rintro ⟨⟨w, hwP₁⟩, ⟨z₀, hz₀, rfl⟩, rfl⟩ + rw [hι_g z₀ (hHU (he₀.2.1 hz₀).1) hwP₁] + exact hz₀ + · intro hz₀ + have hgz_P₁ : g z ∈ P₁ := by + have : g z ∈ H'.U ∩ P₁ := by + rw [hU_P₁] + exact ⟨z, (he₀.2.1 hz₀).1, rfl⟩ + exact this.2 + exact ⟨⟨g z, hgz_P₁⟩, ⟨z, hz₀, rfl⟩, hι_g z (hHU (he₀.2.1 hz₀).1) hgz_P₁⟩ + have he_e₀ : e = e₀ := he_eq.trans h_img_e₀ + subst he_e₀ + exact hf'C' + · rintro ⟨_, hge_C'⟩ + refine ⟨g '' e, hge_C', ?_⟩ + ext z + constructor + · intro hz + have hgz_P₁ : g z ∈ P₁ := by + have : g z ∈ H'.U ∩ P₁ := by + rw [hU_P₁] + exact ⟨z, (he.2.1 hz).1, rfl⟩ + exact this.2 + exact ⟨⟨g z, hgz_P₁⟩, ⟨z, hz, rfl⟩, hι_g z (hHU (he.2.1 hz).1) hgz_P₁⟩ + · rintro ⟨⟨w, hwP₁⟩, ⟨z₀, hz₀, rfl⟩, rfl⟩ + rw [hι_g z₀ (hHU (he.2.1 hz₀).1) hwP₁] + exact hz₀ + constructor + · rintro ⟨hsep, hord, ⟨q₁, q₂⟩, hq_mem, hq₁V, hq₂V, hq₁E, hq₂E⟩ + refine ⟨hsep, hord, ?_⟩ + have hq_sep := hT₁.isSeparation hq_mem + have hq₁_eq : q₁ = pushHypergraphOn hK hg hf hl hHU hSub A' hsep.left_le := by + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hq_sep.left_le + (pushHypergraphOn_le hK hg hf hl hHU hSub A' hsep.left_le) + (hq₁V.trans (hVertex_eq hsep.left_le)) ?_ + ext e + constructor + · intro heq₁ + have heH : e ∈ H.E := hq_sep.left_le.edgeSet_subset heq₁ + exact (hEdge_iff hsep.left_le e heH).mp ((hq₁E e heH).mp heq₁) + · intro hePush + have heH : e ∈ H.E := hePush.1 + exact (hq₁E e heH).mpr ((hEdge_iff hsep.left_le e heH).mpr hePush) + have hq₂_eq : q₂ = pushHypergraphOn hK hg hf hl hHU hSub B' hsep.right_le := by + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hq_sep.right_le + (pushHypergraphOn_le hK hg hf hl hHU hSub B' hsep.right_le) + (hq₂V.trans (hVertex_eq hsep.right_le)) ?_ + ext e + constructor + · intro heq₂ + have heH : e ∈ H.E := hq_sep.right_le.edgeSet_subset heq₂ + exact (hEdge_iff hsep.right_le e heH).mp ((hq₂E e heH).mp heq₂) + · intro hePush + have heH : e ∈ H.E := hePush.1 + exact (hq₂E e heH).mpr ((hEdge_iff hsep.right_le e heH).mpr hePush) + rwa [← hq₁_eq, ← hq₂_eq] + · rintro ⟨hsep, hord, hmem⟩ + refine ⟨hsep, hord, + (pushHypergraphOn hK hg hf hl hHU hSub A' hsep.left_le, + pushHypergraphOn hK hg hf hl hHU hSub B' hsep.right_le), + hmem, (hVertex_eq hsep.left_le).symm, (hVertex_eq hsep.right_le).symm, + fun e he => (hEdge_iff hsep.left_le e he).symm, + fun e he => (hEdge_iff hsep.right_le e he).symm⟩ + +private theorem controlled_gluing_respects_tangle_on_small_sides + {α : Type u} + {β : Type v} + {S' : Type w} + {S_hat : Type w} + [TopologicalSpace S'] + [T2Space S'] + [TopologicalSpace S_hat] + {G : Graph α β} + {P₁ : Set S'} + {ι : ↑P₁ → S_hat} + {K : Set S_hat} + (hK : IsCompact K) + {g : S_hat → S'} + {f : S' → S_hat} + (hg : ContinuousOn g K) + (hf : ContinuousOn f (g '' K)) + (hl : LeftInvOn f g K) + {H : Drawing S_hat} + (hHU : H.U ⊆ K) + (η : SpanEmbedding H G) + {H' : Drawing S'} + (η' : SpanEmbedding H' G) + (hSub : (liftDrawingOn hK hg hf hl H hHU).IsSubdrawing H') + (hU_P₁ : H'.U ∩ P₁ = (liftDrawingOn hK hg hf hl H hHU).U) + (hV_P₁ : H'.V ∩ P₁ = (liftDrawingOn hK hg hf hl H hHU).V) + (hι_g : ∀ y ∈ K, ∀ (hy : g y ∈ P₁), ι ⟨g y, hy⟩ = y) + (hη'_v : ∀ v ∈ H.V, η'.vMap (g v) = η.vMap v) + (hη'_e : ∀ e ∈ H.E, η'.eMap (g '' e) = η.eMap e) + {θ_star : ℕ} + {φ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T₁ : Set (Hypergraph S_hat (Set S_hat) × Hypergraph S_hat (Set S_hat))} + (hCtrl₁ : IsControllingTangle G H η θ_star φ T_star T₁) + (hT₁ : IsTangle H.toHypergraph φ T₁) + (hV_star : V(G).Finite) + (hE_star : E(G).Finite) : + ∀ ⦃A B : Hypergraph α β⦄, (ofGraph G hV_star hE_star).IsSeparation A B → A.separationOrder B < + φ → ∀ ⦃A_H' B_H' : Hypergraph S' (Set S')⦄, IsRestrictedSeparation H' G η' A B A_H' B_H' → + (A, B) ∈ T_star → (A_H', B_H') ∈ GM12.inducedAcross ι H' H φ T₁ := by + intro A B hsepAB hordAB A_H' B_H' hRestr' hAB_star + have hRestr'_v : ∀ {C : Hypergraph α β} {C_H' : Hypergraph S' (Set S')}, + C_H' ≤ H'.toHypergraph → + η'.vMap '' C_H'.vertexSet = C.vertexSet ∩ V(η'.imageGraph) → + ∀ x ∈ H'.V, x ∈ C_H'.vertexSet ↔ η'.vMap x ∈ C.vertexSet := by + intro C C_H' hC_le hImg x hxV + constructor + · intro hxC + have : η'.vMap x ∈ η'.vMap '' C_H'.vertexSet := ⟨x, hxC, rfl⟩ + rw [hImg] at this + exact this.1 + · intro hxC + have : η'.vMap x ∈ C.vertexSet ∩ V(η'.imageGraph) := ⟨hxC, η'.bijOn_v.mapsTo hxV⟩ + rw [← hImg] at this + obtain ⟨x', hx'C, heq⟩ := this + have hx'V : x' ∈ H'.V := hC_le.vertexSet_subset hx'C + exact η'.bijOn_v.injOn hx'V hxV heq ▸ hx'C + have hRestr'_e : ∀ {C : Hypergraph α β} {C_H' : Hypergraph S' (Set S')}, + C_H' ≤ H'.toHypergraph → + η'.eMap '' C_H'.edgeSet = C.edgeSet ∩ E(η'.imageGraph) → + ∀ e' ∈ H'.E, e' ∈ C_H'.edgeSet ↔ η'.eMap e' ∈ C.edgeSet := by + intro C C_H' hC_le hImg e' he'E + constructor + · intro he'C + have : η'.eMap e' ∈ η'.eMap '' C_H'.edgeSet := ⟨e', he'C, rfl⟩ + rw [hImg] at this + exact this.1 + · intro he'C + have : η'.eMap e' ∈ C.edgeSet ∩ E(η'.imageGraph) := ⟨he'C, η'.bijOn_e.mapsTo he'E⟩ + rw [← hImg] at this + obtain ⟨e'', he''C, heq⟩ := this + have he''E : e'' ∈ H'.E := hC_le.edgeSet_subset he''C + exact η'.bijOn_e.injOn he''E he'E heq ▸ he''C + have hord_le : separationOrder A_H' B_H' ≤ separationOrder A B := by + have hsub_img : η'.vMap '' (A_H' ∩ B_H').vertexSet ⊆ (A ∩ B).vertexSet := by + rintro a ⟨x, ⟨hxA, hxB⟩, rfl⟩ + have hxV : x ∈ H'.V := hRestr'.1.left_le.vertexSet_subset hxA + exact ⟨(hRestr'_v hRestr'.1.left_le hRestr'.2.1 x hxV).mp hxA, + (hRestr'_v hRestr'.1.right_le hRestr'.2.2.2.1 x hxV).mp hxB⟩ + have hinj : InjOn η'.vMap (A_H' ∩ B_H').vertexSet := + η'.bijOn_v.injOn.mono fun x ⟨hxA, _⟩ => hRestr'.1.left_le.vertexSet_subset hxA + calc separationOrder A_H' B_H' + _ = (η'.vMap '' (A_H' ∩ B_H').vertexSet).ncard := (hinj.ncard_image).symm + _ ≤ separationOrder A B := Set.ncard_le_ncard hsub_img (A ∩ B).vertexSet_finite + let A_push := pushHypergraphOn hK hg hf hl hHU hSub A_H' hRestr'.1.left_le + let B_push := pushHypergraphOn hK hg hf hl hHU hSub B_H' hRestr'.1.right_le + have hRestr_push : IsRestrictedSeparation H G η A B A_push B_push := by + refine ⟨(isSeparation_pushHypergraphOn hK hg hf hl hHU hSub hRestr'.1).1, ?_, ?_, ?_, ?_⟩ + · ext a + constructor + · rintro ⟨v, ⟨hvH, hgvA⟩, rfl⟩ + have hgvH' : g v ∈ H'.V := hSub.1 ⟨v, hvH, rfl⟩ + have hvA : η.vMap v ∈ A.vertexSet := by + rw [← hη'_v v hvH] + exact (hRestr'_v hRestr'.1.left_le hRestr'.2.1 (g v) hgvH').mp hgvA + exact ⟨hvA, η.bijOn_v.mapsTo hvH⟩ + · rintro ⟨haA, haIm⟩ + obtain ⟨v, hvH, rfl⟩ := η.bijOn_v.surjOn haIm + have hgvH' : g v ∈ H'.V := hSub.1 ⟨v, hvH, rfl⟩ + refine ⟨v, ⟨hvH, ?_⟩, rfl⟩ + refine (hRestr'_v hRestr'.1.left_le hRestr'.2.1 (g v) hgvH').mpr ?_ + rwa [hη'_v v hvH] + · ext b + constructor + · rintro ⟨e, ⟨heH, hgeA⟩, rfl⟩ + have hgeH' : g '' e ∈ H'.E := by + refine hSub.2 ?_ + rw [liftDrawingOn_E hK hg hf hl H hHU] + exact ⟨e, heH, rfl⟩ + have heA : η.eMap e ∈ A.edgeSet := by + rw [← hη'_e e heH] + exact (hRestr'_e hRestr'.1.left_le hRestr'.2.2.1 (g '' e) hgeH').mp hgeA + exact ⟨heA, η.bijOn_e.mapsTo heH⟩ + · rintro ⟨hbA, hbIm⟩ + obtain ⟨e, heH, rfl⟩ := η.bijOn_e.surjOn hbIm + have hgeH' : g '' e ∈ H'.E := by + refine hSub.2 ?_ + rw [liftDrawingOn_E hK hg hf hl H hHU] + exact ⟨e, heH, rfl⟩ + refine ⟨e, ⟨heH, ?_⟩, rfl⟩ + refine (hRestr'_e hRestr'.1.left_le hRestr'.2.2.1 (g '' e) hgeH').mpr ?_ + rwa [hη'_e e heH] + · ext a + constructor + · rintro ⟨v, ⟨hvH, hgvB⟩, rfl⟩ + have hgvH' : g v ∈ H'.V := hSub.1 ⟨v, hvH, rfl⟩ + have hvB : η.vMap v ∈ B.vertexSet := by + rw [← hη'_v v hvH] + exact (hRestr'_v hRestr'.1.right_le hRestr'.2.2.2.1 (g v) hgvH').mp hgvB + exact ⟨hvB, η.bijOn_v.mapsTo hvH⟩ + · rintro ⟨haB, haIm⟩ + obtain ⟨v, hvH, rfl⟩ := η.bijOn_v.surjOn haIm + have hgvH' : g v ∈ H'.V := hSub.1 ⟨v, hvH, rfl⟩ + refine ⟨v, ⟨hvH, ?_⟩, rfl⟩ + refine (hRestr'_v hRestr'.1.right_le hRestr'.2.2.2.1 (g v) hgvH').mpr ?_ + rwa [hη'_v v hvH] + · ext b + constructor + · rintro ⟨e, ⟨heH, hgeB⟩, rfl⟩ + have hgeH' : g '' e ∈ H'.E := by + refine hSub.2 ?_ + rw [liftDrawingOn_E hK hg hf hl H hHU] + exact ⟨e, heH, rfl⟩ + have heB : η.eMap e ∈ B.edgeSet := by + rw [← hη'_e e heH] + exact (hRestr'_e hRestr'.1.right_le hRestr'.2.2.2.2 (g '' e) hgeH').mp hgeB + exact ⟨heB, η.bijOn_e.mapsTo heH⟩ + · rintro ⟨hbB, hbIm⟩ + obtain ⟨e, heH, rfl⟩ := η.bijOn_e.surjOn hbIm + have hgeH' : g '' e ∈ H'.E := by + refine hSub.2 ?_ + rw [liftDrawingOn_E hK hg hf hl H hHU] + exact ⟨e, heH, rfl⟩ + refine ⟨e, ⟨heH, ?_⟩, rfl⟩ + refine (hRestr'_e hRestr'.1.right_le hRestr'.2.2.2.2 (g '' e) hgeH').mpr ?_ + rwa [hη'_e e heH] + have hPush_in_T₁ : (A_push, B_push) ∈ T₁ := + (hCtrl₁.controls hsepAB hordAB hRestr_push).mp hAB_star + exact (mem_inducedAcross_iff_pushHypergraphOn hK hg hf hl hHU hSub + hU_P₁ hV_P₁ hι_g hT₁).mpr ⟨hRestr'.1, lt_of_le_of_lt hord_le hordAB, hPush_in_T₁⟩ + +omit [T2Space S_hat] in +/-- `GM12.inducedAcross ι H' H φ T₁` is a tangle of order `φ` in `H'.toHypergraph`, and if `T₁` is +controlled by `T_star` via `η`, then `GM12.inducedAcross ι H' H φ T₁` is controlled by `T_star` +via `η'`. -/ +theorem isTangle_and_isControlling_inducedAcross + {G : Graph α β} + {P₁ : Set S'} {ι : P₁ → S_hat} + {K : Set S_hat} (hK : IsCompact K) + {g : S_hat → S'} {f : S' → S_hat} + (hg : ContinuousOn g K) (hf : ContinuousOn f (g '' K)) (hl : LeftInvOn f g K) + {H : Drawing S_hat} (hHU : H.U ⊆ K) (η : SpanEmbedding H G) + {H' : Drawing S'} (η' : SpanEmbedding H' G) + (hSub : (liftDrawingOn hK hg hf hl H hHU).IsSubdrawing H') + (hU_P₁ : H'.U ∩ P₁ = (liftDrawingOn hK hg hf hl H hHU).U) + (hV_P₁ : H'.V ∩ P₁ = (liftDrawingOn hK hg hf hl H hHU).V) + (hι_g : ∀ y ∈ K, ∀ hy : g y ∈ P₁, ι ⟨g y, hy⟩ = y) + (hη'_v : ∀ v ∈ H.V, η'.vMap (g v) = η.vMap v) + (hη'_e : ∀ e ∈ H.E, η'.eMap (g '' e) = η.eMap e) + {θ_star φ : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T₁ : Set (Hypergraph S_hat (Set S_hat) × Hypergraph S_hat (Set S_hat))} + (hCtrl₁ : IsControllingTangle G H η θ_star φ T_star T₁) : + IsTangle H'.toHypergraph φ (GM12.inducedAcross ι H' H φ T₁) ∧ + IsControllingTangle G H' η' θ_star φ T_star (GM12.inducedAcross ι H' H φ T₁) := by + have hT₁ := hCtrl₁.isTangle_H + have hT' : IsTangle H'.toHypergraph φ (GM12.inducedAcross ι H' H φ T₁) := by + refine ⟨hT₁.one_le, fun _ _ h => h.1, fun _ _ h => h.2.1, ?_, ?_, ?_⟩ + · intro A' B' hsep hord + obtain ⟨hsep₁, hle₁⟩ := isSeparation_pushHypergraphOn hK hg hf hl hHU hSub hsep + have hord₁ := lt_of_le_of_lt hle₁ hord + rcases hT₁.axiom1 hsep₁ hord₁ with h1 | h2 + · exact Or.inl ((mem_inducedAcross_iff_pushHypergraphOn hK hg hf hl hHU hSub + hU_P₁ hV_P₁ hι_g hT₁).mpr ⟨hsep, hord, h1⟩) + · exact Or.inr ((mem_inducedAcross_iff_pushHypergraphOn hK hg hf hl hHU hSub + hU_P₁ hV_P₁ hι_g hT₁).mpr ⟨hsep.symm, by rwa [separationOrder_comm], h2⟩) + · intro A₁ B₁ A₂ B₂ A₃ B₃ h1 h2 h3 hcov + obtain ⟨hsep1, _, hm1⟩ := (mem_inducedAcross_iff_pushHypergraphOn hK hg hf hl hHU hSub + hU_P₁ hV_P₁ hι_g hT₁).mp h1 + obtain ⟨hsep2, _, hm2⟩ := (mem_inducedAcross_iff_pushHypergraphOn hK hg hf hl hHU hSub + hU_P₁ hV_P₁ hι_g hT₁).mp h2 + obtain ⟨hsep3, _, hm3⟩ := (mem_inducedAcross_iff_pushHypergraphOn hK hg hf hl hHU hSub + hU_P₁ hV_P₁ hι_g hT₁).mp h3 + apply hT₁.axiom2 hm1 hm2 hm3 + have hle1 := pushHypergraphOn_le hK hg hf hl hHU hSub A₁ hsep1.left_le + have hle2 := pushHypergraphOn_le hK hg hf hl hHU hSub A₂ hsep2.left_le + have hle3 := pushHypergraphOn_le hK hg hf hl hHU hSub A₃ hsep3.left_le + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (union_le (union_le hle1 hle2) hle3) le_rfl ?_ ?_ + · ext v + change (v ∈ H.V ∧ g v ∈ A₁.vertexSet ∨ v ∈ H.V ∧ g v ∈ A₂.vertexSet) ∨ + (v ∈ H.V ∧ g v ∈ A₃.vertexSet) ↔ v ∈ H.V + have hV : A₁.vertexSet ∪ A₂.vertexSet ∪ A₃.vertexSet = H'.V := + congrArg Hypergraph.vertexSet hcov + constructor + · rintro ((⟨hv, _⟩ | ⟨hv, _⟩) | ⟨hv, _⟩) <;> exact hv + · intro hv + have hgv : g v ∈ A₁.vertexSet ∪ A₂.vertexSet ∪ A₃.vertexSet := + hV.symm ▸ hSub.1 ⟨v, hv, rfl⟩ + rcases hgv with (h1' | h2') | h3' + · exact Or.inl (Or.inl ⟨hv, h1'⟩) + · exact Or.inl (Or.inr ⟨hv, h2'⟩) + · exact Or.inr ⟨hv, h3'⟩ + · ext e + change (e ∈ H.E ∧ g '' e ∈ A₁.edgeSet ∨ e ∈ H.E ∧ g '' e ∈ A₂.edgeSet) ∨ + (e ∈ H.E ∧ g '' e ∈ A₃.edgeSet) ↔ e ∈ H.E + have hE : A₁.edgeSet ∪ A₂.edgeSet ∪ A₃.edgeSet = H'.E := + congrArg Hypergraph.edgeSet hcov + constructor + · rintro ((⟨he, _⟩ | ⟨he, _⟩) | ⟨he, _⟩) <;> exact he + · intro he + have hge : g '' e ∈ A₁.edgeSet ∪ A₂.edgeSet ∪ A₃.edgeSet := by + rw [hE] + refine hSub.2 ?_ + rw [liftDrawingOn_E hK hg hf hl H hHU] + exact ⟨e, he, rfl⟩ + rcases hge with (h1' | h2') | h3' + · exact Or.inl (Or.inl ⟨he, h1'⟩) + · exact Or.inl (Or.inr ⟨he, h2'⟩) + · exact Or.inr ⟨he, h3'⟩ + · intro A' B' hAB' hV + obtain ⟨hsep, _, hm⟩ := (mem_inducedAcross_iff_pushHypergraphOn hK hg hf hl hHU hSub + hU_P₁ hV_P₁ hι_g hT₁).mp hAB' + apply hT₁.axiom3 hm + ext v + change v ∈ H.V ∧ g v ∈ A'.vertexSet ↔ v ∈ H.V + rw [hV] + exact ⟨fun h => h.1, fun hv => ⟨hv, hSub.1 ⟨v, hv, rfl⟩⟩⟩ + refine ⟨hT', ⟨hCtrl₁.theta_le, hCtrl₁.isTangle_star, hT', ?_⟩⟩ + have hV_star := hCtrl₁.isTangle_star.finite_V + have hE_star := hCtrl₁.isTangle_star.finite_E + have hForward : ∀ ⦃A B : Hypergraph α β⦄, + (Hypergraph.ofGraph G hV_star hE_star).IsSeparation A B → + separationOrder A B < φ → + ∀ ⦃A_H' B_H' : Hypergraph S' (Set S')⦄, + IsRestrictedSeparation H' G η' A B A_H' B_H' → + (A, B) ∈ T_star → (A_H', B_H') ∈ GM12.inducedAcross ι H' H φ T₁ := by + exact controlled_gluing_respects_tangle_on_small_sides (α := α) (β := β) (S' := S') (S_hat := + S_hat) (G := G) (P₁ := P₁) (ι := ι) (K := K) hK (g := g) (f := f) hg hf hl (H := H) hHU η + (H' := H') η' hSub hU_P₁ hV_P₁ hι_g hη'_v hη'_e (θ_star := θ_star) (φ := φ) (T_star := + T_star) (T₁ := T₁) hCtrl₁ hT₁ hV_star hE_star + intro A B hsepAB hordAB A_H' B_H' hRestr' + refine ⟨hForward hsepAB hordAB hRestr', fun hAB' => ?_⟩ + by_contra hnot + have hord_star : separationOrder A B < θ_star := lt_of_lt_of_le hordAB hCtrl₁.theta_le + have hBA_star : (B, A) ∈ T_star := + (hCtrl₁.isTangle_star.isTangle.axiom1 hsepAB hord_star).resolve_left hnot + have hRestr'_symm : IsRestrictedSeparation H' G η' B A B_H' A_H' := + ⟨hRestr'.1.symm, hRestr'.2.2.2.1, hRestr'.2.2.2.2, hRestr'.2.1, hRestr'.2.2.1⟩ + have hBA' : (B_H', A_H') ∈ GM12.inducedAcross ι H' H φ T₁ := + hForward hsepAB.symm (by rwa [separationOrder_comm]) hRestr'_symm hBA_star + exact GM10.theorem_2_1_proof hT' hAB' hBA' + +omit [T2Space S'] in +/-- When `H` is a subdrawing of `H'` on the same surface `S'` and `2 ≤ θ`, +`GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ` equals +`GM12.inducedBySubgraph H'.toHypergraph H.toHypergraph θ T`, and if `T` is controlled by `T_star` +via `η` and `η'` agrees with `η` on `H.V` and `H.E`, then `GM10.inducedTangle` is controlled by +`T_star` via `η'`. -/ +theorem inducedTangle_eq_and_isControlling_of_isSubdrawing + {G : Graph α β} {H H' : Drawing S'} {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} + (hSub : H.IsSubdrawing H') + (hη'_v : ∀ v ∈ H.V, η'.vMap v = η.vMap v) + (hη'_e : ∀ e ∈ H.E, η'.eMap e = η.eMap e) + {θ_star θ : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))} + (hθ : 2 ≤ θ) + (hCtrl : IsControllingTangle G H η θ_star θ T_star T) : + GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ = + GM12.inducedBySubgraph H'.toHypergraph H.toHypergraph θ T ∧ + IsTangle H'.toHypergraph θ (GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ) ∧ + IsControllingTangle G H' η' θ_star θ T_star + (GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ) := by + have hSubHyp : H.toHypergraph ≤ H'.toHypergraph := toHypergraph_le_of_isSubdrawing hSub + have hT := hCtrl.isTangle_H + have hEq : GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ = + GM12.inducedBySubgraph H'.toHypergraph H.toHypergraph θ T := by + ext ⟨A, B⟩ + constructor + · rintro ⟨hsep, hord, ⟨C, D⟩, hCD, hCE⟩ + refine ⟨hsep, hord, ?_⟩ + obtain ⟨hsep₀, hle₀⟩ := isSeparation_inter_subhypergraph hSubHyp hsep + have hord₀ : separationOrder (A ∩ H.toHypergraph) (B ∩ H.toHypergraph) < θ := + lt_of_le_of_lt hle₀ hord + exact GM10.theorem_2_9_proof hT hCD hsep₀ hord₀ + (Or.inr (Or.inr ⟨hθ, subset_of_eq hCE.symm⟩)) + · rintro ⟨hsep, hord, hmem₀⟩ + exact ⟨hsep, hord, (A ∩ H.toHypergraph, B ∩ H.toHypergraph), hmem₀, rfl⟩ + have hT' : IsTangle H'.toHypergraph θ + (GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ) := by + rw [hEq] + exact isTangle_inducedBySubgraph hSubHyp hT + refine ⟨hEq, hT', ⟨hCtrl.theta_le, hCtrl.isTangle_star, hT', ?_⟩⟩ + have hV_star := hCtrl.isTangle_star.finite_V + have hE_star := hCtrl.isTangle_star.finite_E + have hForward : ∀ ⦃A B : Hypergraph α β⦄, + (Hypergraph.ofGraph G hV_star hE_star).IsSeparation A B → + separationOrder A B < θ → + ∀ ⦃A_H' B_H' : Hypergraph S' (Set S')⦄, + IsRestrictedSeparation H' G η' A B A_H' B_H' → + (A, B) ∈ T_star → + (A_H', B_H') ∈ GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ := by + intro A B hsepAB hordAB A_H' B_H' hRestr' hAB_star + have hRestr'_e : ∀ e' ∈ H'.E, e' ∈ A_H'.edgeSet ↔ η'.eMap e' ∈ A.edgeSet := by + intro e' he'E + constructor + · intro he'A + have : η'.eMap e' ∈ η'.eMap '' A_H'.edgeSet := ⟨e', he'A, rfl⟩ + rw [hRestr'.2.2.1] at this + exact this.1 + · intro he'A + have : η'.eMap e' ∈ A.edgeSet ∩ E(η'.imageGraph) := ⟨he'A, η'.bijOn_e.mapsTo he'E⟩ + rw [← hRestr'.2.2.1] at this + obtain ⟨e'', he''A, heq⟩ := this + have he''E : e'' ∈ H'.E := hRestr'.1.left_le.edgeSet_subset he''A + exact η'.bijOn_e.injOn he''E he'E heq ▸ he''A + have hord_le : separationOrder A_H' B_H' ≤ separationOrder A B := by + have hsub_img : η'.vMap '' (A_H' ∩ B_H').vertexSet ⊆ (A ∩ B).vertexSet := by + rintro a ⟨x, ⟨hxA, hxB⟩, rfl⟩ + have h1 : η'.vMap x ∈ η'.vMap '' A_H'.vertexSet := ⟨x, hxA, rfl⟩ + have h2 : η'.vMap x ∈ η'.vMap '' B_H'.vertexSet := ⟨x, hxB, rfl⟩ + rw [hRestr'.2.1] at h1 + rw [hRestr'.2.2.2.1] at h2 + exact ⟨h1.1, h2.1⟩ + have hinj : InjOn η'.vMap (A_H' ∩ B_H').vertexSet := + η'.bijOn_v.injOn.mono fun x ⟨hxA, _⟩ => hRestr'.1.left_le.vertexSet_subset hxA + calc separationOrder A_H' B_H' + _ = (η'.vMap '' (A_H' ∩ B_H').vertexSet).ncard := (hinj.ncard_image).symm + _ ≤ separationOrder A B := Set.ncard_le_ncard hsub_img (A ∩ B).vertexSet_finite + have hRestr_inter : IsRestrictedSeparation H G η A B + (A_H' ∩ H.toHypergraph) (B_H' ∩ H.toHypergraph) := by + refine ⟨(isSeparation_inter_subhypergraph hSubHyp hRestr'.1).1, ?_, ?_, ?_, ?_⟩ + · ext a + constructor + · rintro ⟨v, ⟨hvA', hvH⟩, rfl⟩ + rw [← hη'_v v hvH] + have : η'.vMap v ∈ η'.vMap '' A_H'.vertexSet := ⟨v, hvA', rfl⟩ + rw [hRestr'.2.1] at this + exact ⟨this.1, hη'_v v hvH ▸ η.bijOn_v.mapsTo hvH⟩ + · rintro ⟨haA, haIm⟩ + obtain ⟨v, hvH, rfl⟩ := η.bijOn_v.surjOn haIm + have hvA' : v ∈ A_H'.vertexSet := by + have : η'.vMap v ∈ A.vertexSet ∩ V(η'.imageGraph) := + ⟨hη'_v v hvH ▸ haA, η'.bijOn_v.mapsTo (hSub.1 hvH)⟩ + rw [← hRestr'.2.1] at this + obtain ⟨v', hv'A, heq⟩ := this + exact η'.bijOn_v.injOn (hRestr'.1.left_le.vertexSet_subset hv'A) (hSub.1 hvH) heq ▸ hv'A + exact ⟨v, ⟨hvA', hvH⟩, rfl⟩ + · ext b + constructor + · rintro ⟨e, ⟨heA', heH⟩, rfl⟩ + rw [← hη'_e e heH] + exact ⟨(hRestr'_e e (hSub.2 heH)).mp heA', hη'_e e heH ▸ η.bijOn_e.mapsTo heH⟩ + · rintro ⟨hbA, hbIm⟩ + obtain ⟨e, heH, rfl⟩ := η.bijOn_e.surjOn hbIm + refine ⟨e, ⟨(hRestr'_e e (hSub.2 heH)).mpr (hη'_e e heH ▸ hbA), heH⟩, rfl⟩ + · ext a + constructor + · rintro ⟨v, ⟨hvB', hvH⟩, rfl⟩ + rw [← hη'_v v hvH] + have : η'.vMap v ∈ η'.vMap '' B_H'.vertexSet := ⟨v, hvB', rfl⟩ + rw [hRestr'.2.2.2.1] at this + exact ⟨this.1, hη'_v v hvH ▸ η.bijOn_v.mapsTo hvH⟩ + · rintro ⟨haB, haIm⟩ + obtain ⟨v, hvH, rfl⟩ := η.bijOn_v.surjOn haIm + have hvB' : v ∈ B_H'.vertexSet := by + have : η'.vMap v ∈ B.vertexSet ∩ V(η'.imageGraph) := + ⟨hη'_v v hvH ▸ haB, η'.bijOn_v.mapsTo (hSub.1 + hvH)⟩ + rw [← hRestr'.2.2.2.1] at this + obtain ⟨v', hv'B, heq⟩ + := + this + exact η'.bijOn_v.injOn (hRestr'.1.right_le.vertexSet_subset hv'B) + (hSub.1 hvH) heq ▸ hv'B + exact ⟨v, ⟨hvB', hvH⟩, rfl⟩ + · ext b + constructor + · rintro ⟨e, ⟨heB', heH⟩, rfl⟩ + rw [← hη'_e e heH] + have : η'.eMap e ∈ η'.eMap '' B_H'.edgeSet := ⟨e, heB', rfl⟩ + rw [hRestr'.2.2.2.2] at this + exact ⟨this.1, hη'_e e heH ▸ η.bijOn_e.mapsTo heH⟩ + · rintro ⟨hbB, hbIm⟩ + obtain ⟨e, heH, rfl⟩ := η.bijOn_e.surjOn hbIm + have heB' : e ∈ B_H'.edgeSet := by + have : η'.eMap e ∈ B.edgeSet ∩ E(η'.imageGraph) := + ⟨hη'_e e heH ▸ hbB, η'.bijOn_e.mapsTo (hSub.2 heH)⟩ + rw [← hRestr'.2.2.2.2] at this + obtain ⟨e', he'B, heq⟩ := this + exact η'.bijOn_e.injOn (hRestr'.1.right_le.edgeSet_subset he'B) (hSub.2 heH) heq ▸ he'B + exact ⟨e, ⟨heB', heH⟩, rfl⟩ + have hMem_T : (A_H' ∩ H.toHypergraph, B_H' ∩ H.toHypergraph) ∈ T := + (hCtrl.controls hsepAB hordAB hRestr_inter).mp hAB_star + exact ⟨hRestr'.1, lt_of_le_of_lt hord_le hordAB, + (A_H' ∩ H.toHypergraph, B_H' ∩ H.toHypergraph), hMem_T, rfl⟩ + intro A B hsepAB hordAB A_H' B_H' hRestr' + refine ⟨hForward hsepAB hordAB hRestr', fun hAB' => ?_⟩ + by_contra hnot + have hord_star : separationOrder A B < θ_star := lt_of_lt_of_le hordAB hCtrl.theta_le + have hBA_star : (B, A) ∈ T_star := + (hCtrl.isTangle_star.isTangle.axiom1 hsepAB hord_star).resolve_left hnot + have hRestr'_symm : IsRestrictedSeparation H' G η' B A B_H' A_H' := + ⟨hRestr'.1.symm, hRestr'.2.2.2.1, hRestr'.2.2.2.2, hRestr'.2.1, hRestr'.2.2.1⟩ + have hBA' : (B_H', A_H') ∈ GM10.inducedTangle H'.toHypergraph H.toHypergraph T θ := + hForward hsepAB.symm (by rwa [separationOrder_comm]) hRestr'_symm hBA_star + exact GM10.theorem_2_1_proof hT' hAB' hBA' + +end InducedAcrossControl + +/-! ## 4. Dials and Chords in a Striped Closed Disc (for (3.2)(iii) and (3.2)(iv)) -/ + +section StripedDisc + +variable {S' : Type w} [TopologicalSpace S'] [T2Space S'] + +omit [T2Space S'] in +/-- For any subdrawing `P` of `H'`, `P.U ⊆ H'.U`. -/ +theorem isSubdrawing_U_subset {P H' : Drawing S'} (hSub : P.IsSubdrawing H') : + P.U ⊆ H'.U := by + rw [P.U_eq, H'.U_eq] + refine union_subset (hSub.1.trans subset_union_left) ?_ + refine iUnion₂_subset fun e he => ?_ + exact (subset_iUnion₂ (s := fun e (_ : e ∈ H'.E) => closure e) e (hSub.2 he)).trans + subset_union_right + +omit [T2Space S'] in +/-- For any subdrawing `P` of `H'`, `P.U ∩ H'.V = P.V`. -/ +theorem isSubdrawing_U_inter_V {P H' : Drawing S'} (hSub : P.IsSubdrawing H') : + P.U ∩ H'.V = P.V := by + refine Subset.antisymm ?_ (subset_inter P.V_subset_U hSub.1) + rintro x ⟨hxU, hxV⟩ + rw [P.U_eq] at hxU + rcases hxU with hxPV | hxPE + · exact hxPV + · obtain ⟨e, heP, hxe⟩ := mem_iUnion₂.mp hxPE + by_cases hxe_in : x ∈ e + · exact ((hSub.2 heP).2.1 hxe_in).2 hxV |>.elim + · have hx_cl_V : x ∈ closure e ∩ H'.V := ⟨hxe, hxV⟩ + rw [← hSub.closure_inter_V heP] at hx_cl_V + exact hx_cl_V.2 + +/-- Verification of condition (iv) of (3.2) inside a closed disc `D ⊆ S'` where `D ∩ H'.U` is +contained in `B_bd ∪ ⋃ j, (Q' j).U` with `B_bd ⊆ discBd D` and no path `P` containing both ends +`u' j, v' j` of any `Q' j`. -/ +theorem openDisc_of_chord_in_striped_disc + (hS' : IsClosedSurface S') + {H' : Drawing S'} {D B_bd : Set S'} {m' : ℕ} + {u' v' : Fin m' → S'} {Q' : Fin m' → Drawing S'} + (hD : IsClosedDisc D) + (hB_bd : B_bd ⊆ discBd D) + (hD_U : D ∩ H'.U ⊆ B_bd ∪ ⋃ j : Fin m', (Q' j).U) + (hQ'_line : ∀ j, IsLineWithEnds (Q' j).U (u' j) (v' j)) + (hQ'_sub : ∀ j, (Q' j).IsSubdrawing H') + (hQ'_V : ∀ j, u' j ∈ (Q' j).V ∧ v' j ∈ (Q' j).V) + (hQ'_bd : ∀ j, (Q' j).U ∩ discBd D = {u' j, v' j}) + {F : Set S'} {u v : S'} {P : Drawing S'} + (hPU_D : P.U ⊆ D) (hF_D : F ⊆ D) + (hPU_bd : P.U ⊆ discBd D) + (hF_line : IsLineWithEnds F u v) + (hF_U : F ∩ H'.U ⊆ {u, v}) + (hP_sub : P.IsSubdrawing H') + (hP_path : P.IsPathBetween u v) + (hNo_both : ∀ j : Fin m', ¬ (u' j ∈ P.V ∧ v' j ∈ P.V)) : + ∃ U₀ : Set S', IsOpenDisc U₀ ∧ IsClosedDisc (closure U₀) ∧ U₀ ⊆ D ∧ + subBd U₀ = P.U ∪ F ∧ Disjoint U₀ H'.U := by + have : LocallyConnectedSpace S' := IsClosedSurface.locallyConnectedSpace hS' + obtain ⟨ψ_F, hψ_F0, hψ_F1⟩ := hF_line + have huv : u ≠ v := fun heq => zero_ne_one + (ψ_F.injective (Subtype.ext (hψ_F0.trans (heq.trans hψ_F1.symm)))) + have huF : u ∈ F := hψ_F0 ▸ (ψ_F 0).2 + have hvF : v ∈ F := hψ_F1 ▸ (ψ_F 1).2 + have hP_line : IsLineWithEnds P.U u v := GM14.isLine_of_isPathBetween hP_path huv + obtain ⟨ψ_P, hψ_P0, hψ_P1⟩ := hP_line + have huPU : u ∈ P.U := hψ_P0 ▸ (ψ_P 0).2 + have hvPU : v ∈ P.U := hψ_P1 ▸ (ψ_P 1).2 + have hPU_H'U : P.U ⊆ H'.U := isSubdrawing_U_subset hP_sub + have hPF_inter : P.U ∩ F = {u, v} := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨hxP, hxF⟩ + exact hF_U ⟨hxF, hPU_H'U hxP⟩ + · rintro x (rfl | rfl) + · exact ⟨huPU, huF⟩ + · exact ⟨hvPU, hvF⟩ + let K : Set S' := P.U ∪ F + have hK_oArc : IsOArc K := Surface.oArc_of_lines ⟨ψ_P, hψ_P0, hψ_P1⟩ ⟨ψ_F, hψ_F0, hψ_F1⟩ hPF_inter + have hK_D : K ⊆ D := union_subset hPU_D hF_D + obtain ⟨Δ, ⟨hΔ_sub_D, hΔ_disc, hΔ_discBd, -, hΔ_disj_bd, -⟩, -⟩ := + disc_oArc D K hD hK_D hK_oArc + have hΔ_subBd : subBd Δ = K := (IsClosedDisc.subBd_eq_discBd hS' hΔ_disc).trans hΔ_discBd + have hΔ_fr : frontier Δ = K := (subBd_eq_frontier Δ).symm.trans hΔ_subBd + obtain ⟨hOD_U₀, hcl_U₀, hbd_U₀⟩ := IsClosedDisc.isOpenDisc_diff_subBd hS' hΔ_disc + let U₀ : Set S' := Δ \ subBd Δ + have hU₀_eq : U₀ = Δ \ K := by dsimp [U₀]; rw [hΔ_subBd] + refine ⟨U₀, hOD_U₀, hcl_U₀.symm ▸ hΔ_disc, sdiff_subset.trans hΔ_sub_D, + hbd_U₀.trans hΔ_subBd, ?_⟩ + rw [hU₀_eq] + refine Set.disjoint_left.mpr fun z ⟨hzΔ, hz_not_K⟩ hzU => ?_ + have hz_not_bdD : z ∉ discBd D := Set.disjoint_left.mp hΔ_disj_bd ⟨hzΔ, hz_not_K⟩ + have hz_DU : z ∈ D ∩ H'.U := ⟨hΔ_sub_D hzΔ, hzU⟩ + rcases hD_U hz_DU with hzB | hzQ + · exact hz_not_bdD (hB_bd hzB) + · obtain ⟨j, hzj⟩ := mem_iUnion.mp hzQ + have huj_bd : u' j ∈ discBd D := by + have hmem : u' j ∈ (Q' j).U ∩ discBd D := (hQ'_bd j).symm ▸ Or.inl rfl + exact hmem.2 + have hvj_bd : v' j ∈ discBd D := by + have hmem : v' j ∈ (Q' j).U ∩ discBd D := (hQ'_bd j).symm ▸ Or.inr rfl + exact hmem.2 + have hz_not_uvj : z ∉ ({u' j, v' j} : Set S') := by + rintro (rfl | rfl) + · exact hz_not_bdD huj_bd + · exact hz_not_bdD hvj_bd + have hQj_H'U : (Q' j).U ⊆ H'.U := isSubdrawing_U_subset (hQ'_sub j) + have hdisj_fr : Disjoint ((Q' j).U \ {u' j, v' j}) (frontier Δ) := by + rw [hΔ_fr] + refine Set.disjoint_left.mpr fun w hw hwK => hw.2 ?_ + have hw_bd : w ∈ discBd D := by + rcases hwK with hwP | hwF + · exact hPU_bd hwP + · rcases hF_U ⟨hwF, hQj_H'U hw.1⟩ with rfl | rfl + · exact hPU_bd huPU + · exact hPU_bd hvPU + exact hQ'_bd j ▸ ⟨hw.1, hw_bd⟩ + have hdiff_sub : (Q' j).U \ {u' j, v' j} ⊆ Δ := + GM14.subset_of_disjoint_frontier + (GM11.isPathConnected_sdiff_pair (hQ'_line j)).isConnected.isPreconnected + hΔ_disc.isClosed hdisj_fr ⟨hzj, hz_not_uvj⟩ hzΔ + have hQj_sub_Δ : (Q' j).U ⊆ Δ := + (GM11.closure_sdiff_pair (hQ'_line j)).symm.subset.trans + (hΔ_disc.isClosed.closure_subset_iff.mpr hdiff_sub) + have huj_U : u' j ∈ (Q' j).U := (Q' j).V_subset_U (hQ'_V j).1 + have hvj_U : v' j ∈ (Q' j).U := (Q' j).V_subset_U (hQ'_V j).2 + have huj_K : u' j ∈ K := by + by_contra hnot + exact Set.disjoint_left.mp hΔ_disj_bd ⟨hQj_sub_Δ huj_U, hnot⟩ huj_bd + have hvj_K : v' j ∈ K := by + by_contra hnot + exact Set.disjoint_left.mp hΔ_disj_bd ⟨hQj_sub_Δ hvj_U, hnot⟩ hvj_bd + have hKU_sub_PU : K ∩ H'.U ⊆ P.U := by + rintro w ⟨hwP | hwF, hwU⟩ + · exact hwP + · rcases hF_U ⟨hwF, hwU⟩ with rfl | rfl + · exact huPU + · exact hvPU + have huj_PU : u' j ∈ P.U := hKU_sub_PU ⟨huj_K, hQj_H'U huj_U⟩ + have hvj_PU : v' j ∈ P.U := hKU_sub_PU ⟨hvj_K, hQj_H'U hvj_U⟩ + have huj_PV : u' j ∈ P.V := + (isSubdrawing_U_inter_V hP_sub) ▸ ⟨huj_PU, (hQ'_sub j).1 (hQ'_V j).1⟩ + have hvj_PV : v' j ∈ P.V := + (isSubdrawing_U_inter_V hP_sub) ▸ ⟨hvj_PU, (hQ'_sub j).1 (hQ'_V j).2⟩ + exact hNo_both j ⟨huj_PV, hvj_PV⟩ + +private theorem gluing_arc_meets_subdisc_in_closed_interval + {S' : Type w} + [TopologicalSpace S'] + [T2Space S'] + {D : Set S'} + {ι : Type*} + {u' : ι → S'} + {v' : ι → S'} + {F : Set S'} + (Δ : Set S') + (hΔ_disc : IsClosedDisc Δ) + (hΔ_disj_bd : Disjoint (Δ \ F) (discBd D)) + (hΔ_fr : frontier Δ = F) + (j : ι) + (huj_bd : ∀ (k : ι), u' k ∈ discBd D) + (hvj_bd : ∀ (k : ι), v' k ∈ discBd D) + (aR : ℝ → S') + (haR_cont : Continuous aR) + (haR_0 : aR 0 = u' j) + (haR_1 : aR 1 = v' j) + (t₁ : ℝ) + (t₂ : ℝ) + (ht₁₂ : t₁ < t₂) + (ha_F_iff : ∀ t ∈ Icc 0 1, aR t ∈ F ↔ t = t₁ ∨ t = t₂) + (hIcc_sub_Δ : aR '' Icc t₁ t₂ ⊆ Δ) : + ∀ t ∈ Icc 0 1, aR t ∈ Δ ↔ t ∈ Icc t₁ t₂ := by + intro t ht + refine ⟨fun hat_Δ => ?_, fun ht12 => hIcc_sub_Δ ⟨t, ht12, rfl⟩⟩ + constructor + · by_contra hlt + have hlt' : t < t₁ := lt_of_not_ge hlt + have hI_sub : Icc 0 t ⊆ Icc 0 1 := Icc_subset_Icc_right ht.2 + have hconn : IsPreconnected (aR '' Icc 0 t) := + (isConnected_Icc ht.1).isPreconnected.image aR haR_cont.continuousOn + have hdis : Disjoint (aR '' Icc 0 t) (frontier Δ) := by + rw [hΔ_fr] + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨s, hs, rfl⟩ hsF + rcases (ha_F_iff s (hI_sub hs)).mp hsF with rfl | rfl + · linarith [hs.2] + · linarith [hs.2, ht₁₂] + have hsub0 : aR '' Icc 0 t ⊆ Δ := + GM14.subset_of_disjoint_frontier hconn hΔ_disc.isClosed hdis + ⟨t, ⟨ht.1, le_rfl⟩, rfl⟩ hat_Δ + have ha0_Δ : aR 0 ∈ Δ := hsub0 ⟨0, ⟨le_rfl, ht.1⟩, rfl⟩ + have ha0_F : aR 0 ∈ F := by + by_contra hnot + exact Set.disjoint_left.mp hΔ_disj_bd ⟨ha0_Δ, hnot⟩ (haR_0 ▸ huj_bd j) + rcases (ha_F_iff 0 ⟨le_rfl, zero_le_one⟩).mp ha0_F with h1 | h2 + · linarith [ht.1] + · linarith [ht.1, ht₁₂] + · by_contra hgt + have hgt' : t₂ < t := lt_of_not_ge hgt + have hI_sub : Icc t 1 ⊆ Icc 0 1 := Icc_subset_Icc_left ht.1 + have hconn : IsPreconnected (aR '' Icc t 1) := + (isConnected_Icc ht.2).isPreconnected.image aR haR_cont.continuousOn + have hdis : Disjoint (aR '' Icc t 1) (frontier Δ) := by + rw [hΔ_fr] + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨s, hs, rfl⟩ hsF + rcases (ha_F_iff s (hI_sub hs)).mp hsF with rfl | rfl + · linarith [hs.1, ht₁₂] + · linarith [hs.1] + have hsub1 : aR '' Icc t 1 ⊆ Δ := + GM14.subset_of_disjoint_frontier hconn hΔ_disc.isClosed hdis + ⟨t, ⟨le_rfl, ht.2⟩, rfl⟩ hat_Δ + have ha1_Δ : aR 1 ∈ Δ := hsub1 ⟨1, ⟨ht.2, le_rfl⟩, rfl⟩ + have ha1_F : aR 1 ∈ F := by + by_contra hnot + exact Set.disjoint_left.mp hΔ_disj_bd ⟨ha1_Δ, hnot⟩ (haR_1 ▸ hvj_bd j) + rcases (ha_F_iff 1 ⟨zero_le_one, le_rfl⟩).mp ha1_F with h1 | h2 + · linarith [ht.2, ht₁₂] + · linarith [ht.2] + +private theorem other_gluing_arcs_avoid_subdisc + {S' : Type w} + [TopologicalSpace S'] + [T2Space S'] + {H' : Drawing S'} + {D : Set S'} + {ι : Type*} + {u' : ι → S'} + {v' : ι → S'} + {Q' : ι → Drawing S'} + (hQ'_line : ∀ (j : ι), IsLineWithEnds (Q' j).U (u' j) (v' j)) + (hQ'_bd : ∀ (j : ι), (Q' j).U ∩ discBd D = {u' j, v' j}) + (hQ'_disj : Pairwise fun i j => Disjoint (Q' i).U (Q' j).U) + {F : Set S'} + (Δ : Set S') + (hΔ_disc : IsClosedDisc Δ) + (hΔ_disj_bd : Disjoint (Δ \ F) (discBd D)) + (hΔ_fr : frontier Δ = F) + (j : ι) + (hQj_H'U : ∀ (k : ι), (Q' k).U ⊆ H'.U) + (huj_bd : ∀ (k : ι), u' k ∈ discBd D) + (u : S') + (v : S') + (hu_Qj : u ∈ (Q' j).U) + (hv_Qj : v ∈ (Q' j).U) + (hFU_eq : F ∩ H'.U = {u, v}) : + ∀ (k : ι), k ≠ j → Disjoint (Q' k).U Δ := by + intro k hkj + have hdis_fr : Disjoint (Q' k).U (frontier Δ) := by + rw [hΔ_fr] + refine Set.disjoint_left.mpr fun w hwk hwF => ?_ + have hw_uv : w ∈ ({u, v} : Set S') := hFU_eq ▸ ⟨hwF, hQj_H'U k hwk⟩ + rcases hw_uv with rfl | rfl + · exact Set.disjoint_left.mp (hQ'_disj hkj) hwk hu_Qj + · exact Set.disjoint_left.mp (hQ'_disj hkj) hwk hv_Qj + refine Set.disjoint_left.mpr fun w hwk hwΔ => ?_ + obtain ⟨ψ_k, _, _⟩ := hQ'_line k + have hconn_k : IsPreconnected (Q' k).U := by + have hEq : (Q' k).U = range (fun s : unitInterval => (ψ_k s).1) := by + ext x + exact ⟨fun hx => ⟨ψ_k.symm ⟨x, hx⟩, by simp⟩, fun ⟨s, hs⟩ => hs ▸ (ψ_k s).2⟩ + rw [hEq] + exact isPreconnected_range (continuous_subtype_val.comp ψ_k.continuous) + have hsub_k : (Q' k).U ⊆ Δ := + GM14.subset_of_disjoint_frontier hconn_k hΔ_disc.isClosed hdis_fr hwk hwΔ + have huk_U : u' k ∈ (Q' k).U := by + have hmem : u' k ∈ (Q' k).U ∩ discBd D := (hQ'_bd k).symm ▸ Or.inl rfl + exact hmem.1 + have huk_F : u' k ∈ F := by + by_contra hnot + exact Set.disjoint_left.mp hΔ_disj_bd ⟨hsub_k huk_U, hnot⟩ (huj_bd k) + exact Set.disjoint_left.mp hdis_fr huk_U (hΔ_fr.symm ▸ huk_F) + +/-- Verification of condition (iii) of (3.2) inside a closed disc `D ⊆ S'` where `D ∩ H'.U` is +contained in `B_bd ∪ ⋃ j, (Q' j).U` with `B_bd ⊆ discBd D`. -/ +theorem dial_of_oArc_in_striped_disc_family + (hS' : IsClosedSurface S') + {H' : Drawing S'} {D B_bd : Set S'} {ι : Type*} + {u' v' : ι → S'} {Q' : ι → Drawing S'} + (hD : IsClosedDisc D) + (hB_bd : B_bd ⊆ discBd D) + (hD_U : D ∩ H'.U ⊆ B_bd ∪ ⋃ j : ι, (Q' j).U) + (hQ'_line : ∀ j, IsLineWithEnds (Q' j).U (u' j) (v' j)) + (hQ'_sub : ∀ j, (Q' j).IsSubdrawing H') + (hQ'_bd : ∀ j, (Q' j).U ∩ discBd D = {u' j, v' j}) + (hQ'_disj : Pairwise (fun i j => Disjoint (Q' i).U (Q' j).U)) + {F : Set S'} + (hFD : F ⊆ D) (hF : IsOArc F) (hFU : F ∩ H'.U ⊆ H'.V) (hFV : (F ∩ H'.V).ncard ≤ 2) : + ∃ Δ : Set S', Δ ⊆ D ∧ IsDial H' F Δ := by + have : LocallyConnectedSpace S' := IsClosedSurface.locallyConnectedSpace hS' + obtain ⟨Δ, ⟨hΔ_sub_D, hΔ_disc, hΔ_discBd, -, hΔ_disj_bd, -⟩, -⟩ := + disc_oArc D F hD hFD hF + have hΔ_subBd : subBd Δ = F := (IsClosedDisc.subBd_eq_discBd hS' hΔ_disc).trans hΔ_discBd + have hΔ_fr : frontier Δ = F := (subBd_eq_frontier Δ).symm.trans hΔ_subBd + have hΔ_inter_U : (H'.interSet Δ).U = H'.U ∩ Δ := + (GM14.interSet_V_and_U hΔ_disc.isClosed (hΔ_subBd ▸ hFU)).2 + have hF_sub_Δ : F ⊆ Δ := hΔ_discBd ▸ Surface.discBd_subset Δ + refine ⟨Δ, hΔ_sub_D, hΔ_disc, hΔ_subBd, ?_⟩ + by_cases hne : ((Δ \ F) ∩ H'.U).Nonempty + · right + obtain ⟨z₀, ⟨hz₀_Δ, hz₀_not_F⟩, hz₀_U⟩ := hne + have hz₀_not_bdD : z₀ ∉ discBd D := Set.disjoint_left.mp hΔ_disj_bd ⟨hz₀_Δ, hz₀_not_F⟩ + have hz₀_DU : z₀ ∈ D ∩ H'.U := ⟨hΔ_sub_D hz₀_Δ, hz₀_U⟩ + have hz₀_Q : z₀ ∈ ⋃ j : ι, (Q' j).U := by + rcases hD_U hz₀_DU with hzB | hzQ + · exact (hz₀_not_bdD (hB_bd hzB)).elim + · exact hzQ + obtain ⟨j, hz₀_j⟩ := mem_iUnion.mp hz₀_Q + have hQj_H'U : ∀ k, (Q' k).U ⊆ H'.U := fun k => isSubdrawing_U_subset (hQ'_sub k) + have huj_bd : ∀ k, u' k ∈ discBd D := fun k => by + have hmem : u' k ∈ (Q' k).U ∩ discBd D := (hQ'_bd k).symm ▸ Or.inl rfl + exact hmem.2 + have hvj_bd : ∀ k, v' k ∈ discBd D := fun k => by + have hmem : v' k ∈ (Q' k).U ∩ discBd D := (hQ'_bd k).symm ▸ Or.inr rfl + exact hmem.2 + obtain ⟨a, ha, ha_range, ha0, ha1⟩ := (hQ'_line j).exists_arc + obtain ⟨t₀, ht₀_eq⟩ : z₀ ∈ range a := ha_range ▸ hz₀_j + let aR : ℝ → S' := extI a + have haR_cont : Continuous aR := continuous_extI ha.1 + have haR_inj : InjOn aR (Icc (0 : ℝ) 1) := extI_injOn ha.2 + have haR_t₀ : aR t₀.1 = z₀ := (extI_coe a t₀).trans ht₀_eq + have haR_0 : aR 0 = u' j := (extI_coe a 0).trans ha0 + have haR_1 : aR 1 = v' j := (extI_coe a 1).trans ha1 + have haR_mem : ∀ t ∈ Icc (0 : ℝ) 1, aR t ∈ (Q' j).U := fun t ht => by + rw [← ha_range] + exact ⟨⟨t, ht⟩, (extI_of_mem a ht).symm⟩ + have hex_t₁ : ∃ t₁ ∈ Icc (0 : ℝ) t₀.1, aR t₁ ∈ F := by + by_contra hnot + have hnot' : ∀ t ∈ Icc (0 : ℝ) t₀.1, aR t ∉ F := fun t ht htF => hnot ⟨t, ht, htF⟩ + have hconn : IsPreconnected (aR '' Icc (0 : ℝ) t₀.1) := + (isConnected_Icc t₀.2.1).isPreconnected.image aR haR_cont.continuousOn + have hdis : Disjoint (aR '' Icc (0 : ℝ) t₀.1) (frontier Δ) := by + rw [hΔ_fr] + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨t, ht, rfl⟩ htF + exact hnot' t ht htF + have hsub_Δ : aR '' Icc (0 : ℝ) t₀.1 ⊆ Δ := + GM14.subset_of_disjoint_frontier hconn hΔ_disc.isClosed hdis + ⟨t₀.1, ⟨t₀.2.1, le_rfl⟩, rfl⟩ (haR_t₀.symm ▸ hz₀_Δ) + have ha0_Δ : aR 0 ∈ Δ := hsub_Δ ⟨0, ⟨le_rfl, t₀.2.1⟩, rfl⟩ + have ha0_not_F : aR 0 ∉ F := hnot' 0 ⟨le_rfl, t₀.2.1⟩ + exact Set.disjoint_left.mp hΔ_disj_bd ⟨ha0_Δ, ha0_not_F⟩ (haR_0 ▸ huj_bd j) + have hex_t₂ : ∃ t₂ ∈ Icc t₀.1 1, aR t₂ ∈ F := by + by_contra hnot + have hnot' : ∀ t ∈ Icc t₀.1 1, aR t ∉ F := fun t ht htF => hnot ⟨t, ht, htF⟩ + have hconn : IsPreconnected (aR '' Icc t₀.1 1) := + (isConnected_Icc t₀.2.2).isPreconnected.image aR haR_cont.continuousOn + have hdis : Disjoint (aR '' Icc t₀.1 1) (frontier Δ) := by + rw [hΔ_fr] + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨t, ht, rfl⟩ htF + exact hnot' t ht htF + have hsub_Δ : aR '' Icc t₀.1 1 ⊆ Δ := + GM14.subset_of_disjoint_frontier hconn hΔ_disc.isClosed hdis + ⟨t₀.1, ⟨le_rfl, t₀.2.2⟩, rfl⟩ (haR_t₀.symm ▸ hz₀_Δ) + have ha1_Δ : aR 1 ∈ Δ := hsub_Δ ⟨1, ⟨t₀.2.2, le_rfl⟩, rfl⟩ + have ha1_not_F : aR 1 ∉ F := hnot' 1 ⟨t₀.2.2, le_rfl⟩ + exact Set.disjoint_left.mp hΔ_disj_bd ⟨ha1_Δ, ha1_not_F⟩ (haR_1 ▸ hvj_bd j) + obtain ⟨t₁, ht₁, ha_t₁_F⟩ := hex_t₁ + obtain ⟨t₂, ht₂, ha_t₂_F⟩ := hex_t₂ + have ht₁_mem : t₁ ∈ Icc (0 : ℝ) 1 := ⟨ht₁.1, ht₁.2.trans t₀.2.2⟩ + have ht₂_mem : t₂ ∈ Icc (0 : ℝ) 1 := ⟨t₀.2.1.trans ht₂.1, ht₂.2⟩ + have ht₁_lt : t₁ < t₀.1 := lt_of_le_of_ne ht₁.2 fun h => hz₀_not_F (haR_t₀ ▸ h ▸ ha_t₁_F) + have ht₂_gt : t₀.1 < t₂ := lt_of_le_of_ne ht₂.1 fun h => hz₀_not_F (haR_t₀ ▸ h.symm ▸ ha_t₂_F) + have ht₁₂ : t₁ < t₂ := ht₁_lt.trans ht₂_gt + let u := aR t₁ + let v := aR t₂ + have huv : u ≠ v := fun h => ht₁₂.ne (haR_inj ht₁_mem ht₂_mem h) + have hu_Qj : u ∈ (Q' j).U := haR_mem t₁ ht₁_mem + have hv_Qj : v ∈ (Q' j).U := haR_mem t₂ ht₂_mem + have hu_FV : u ∈ F ∩ H'.V := ⟨ha_t₁_F, hFU ⟨ha_t₁_F, hQj_H'U j hu_Qj⟩⟩ + have hv_FV : v ∈ F ∩ H'.V := ⟨ha_t₂_F, hFU ⟨ha_t₂_F, hQj_H'U j hv_Qj⟩⟩ + have hpair_sub : ({u, v} : Set S') ⊆ F ∩ H'.V := by + rintro w (rfl | rfl) + · exact hu_FV + · exact hv_FV + have hFV_eq : F ∩ H'.V = {u, v} := by + refine (Set.eq_of_subset_of_ncard_le hpair_sub ?_ + (H'.finite_V.subset inter_subset_right)).symm + rw [Set.ncard_pair huv] + exact hFV + have hFU_sub_FV : F ∩ H'.U ⊆ F ∩ H'.V := fun x hx => ⟨hx.1, hFU hx⟩ + have hFU_eq : F ∩ H'.U = {u, v} := + Subset.antisymm (hFU_sub_FV.trans hFV_eq.subset) + (hFV_eq ▸ inter_subset_inter_right _ H'.V_subset_U) + have ha_F_iff : ∀ t ∈ Icc (0 : ℝ) 1, aR t ∈ F ↔ t = t₁ ∨ t = t₂ := by + intro t ht + constructor + · intro hatF + have hat_Qj : aR t ∈ (Q' j).U := haR_mem t ht + have hat_uv : aR t ∈ ({u, v} : Set S') := hFU_eq ▸ ⟨hatF, hQj_H'U j hat_Qj⟩ + rcases hat_uv with h1 | h2 + · exact Or.inl (haR_inj ht ht₁_mem h1) + · exact Or.inr (haR_inj ht ht₂_mem h2) + · rintro (rfl | rfl) + · exact ha_t₁_F + · exact ha_t₂_F + have hIoo_sub_Δ : aR '' Ioo t₁ t₂ ⊆ Δ := by + have hIoo_sub : Ioo t₁ t₂ ⊆ Icc 0 1 := + Ioo_subset_Icc_self.trans (Icc_subset_Icc ht₁_mem.1 ht₂_mem.2) + have hconn : IsPreconnected (aR '' Ioo t₁ t₂) := + isPreconnected_Ioo.image aR haR_cont.continuousOn + have hdis : Disjoint (aR '' Ioo t₁ t₂) (frontier Δ) := by + rw [hΔ_fr] + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨t, ht, rfl⟩ htF + rcases (ha_F_iff t (hIoo_sub ht)).mp htF with rfl | rfl + · exact ht.1.ne rfl + · exact ht.2.ne rfl + exact GM14.subset_of_disjoint_frontier hconn hΔ_disc.isClosed hdis + ⟨t₀.1, ⟨ht₁_lt, ht₂_gt⟩, rfl⟩ (haR_t₀.symm ▸ hz₀_Δ) + have hIcc_sub_Δ : aR '' Icc t₁ t₂ ⊆ Δ := by + rintro _ ⟨t, ht, rfl⟩ + rcases eq_or_lt_of_le ht.1 with rfl | hgt1 + · exact hF_sub_Δ ha_t₁_F + · rcases eq_or_lt_of_le ht.2 with rfl | hlt2 + · exact hF_sub_Δ ha_t₂_F + · exact hIoo_sub_Δ ⟨t, ⟨hgt1, hlt2⟩, rfl⟩ + have ha_Δ_iff : ∀ t ∈ Icc (0 : ℝ) 1, aR t ∈ Δ ↔ t ∈ Icc t₁ t₂ := by + exact gluing_arc_meets_subdisc_in_closed_interval (S' := S') (D := D) (ι := ι) (u' := u') + (v' := v') (F := F) Δ hΔ_disc hΔ_disj_bd hΔ_fr j huj_bd hvj_bd aR haR_cont haR_0 haR_1 t₁ + t₂ ht₁₂ ha_F_iff hIcc_sub_Δ + have hdisj_other : ∀ k : ι, k ≠ j → Disjoint (Q' k).U Δ := by + exact other_gluing_arcs_avoid_subdisc (S' := S') (H' := H') (D := D) (ι := ι) (u' := u') + (v' := v') (Q' := Q') hQ'_line hQ'_bd hQ'_disj (F := F) Δ hΔ_disc hΔ_disj_bd hΔ_fr j + hQj_H'U huj_bd u v hu_Qj hv_Qj hFU_eq + have hU_eq_pieceA : (H'.interSet Δ).U = range (pieceA a t₁ t₂) := by + rw [hΔ_inter_U, range_pieceA a ht₁_mem.1 ht₁₂.le ht₂_mem.2] + ext x + constructor + · rintro ⟨hxU, hxΔ⟩ + rcases hD_U ⟨hΔ_sub_D hxΔ, hxU⟩ with hxB | hxQ + · have hxF : x ∈ F := by + by_contra hnot + exact Set.disjoint_left.mp hΔ_disj_bd ⟨hxΔ, hnot⟩ (hB_bd hxB) + have hx_uv : x ∈ ({u, v} : Set S') := hFU_eq ▸ ⟨hxF, hxU⟩ + rcases hx_uv with rfl | rfl + · exact ⟨t₁, ⟨le_rfl, ht₁₂.le⟩, rfl⟩ + · exact ⟨t₂, ⟨ht₁₂.le, le_rfl⟩, rfl⟩ + · obtain ⟨k, hxk⟩ := mem_iUnion.mp hxQ + by_cases hkj : k = j + · subst hkj + obtain ⟨t, rfl⟩ : x ∈ range a := ha_range ▸ hxk + have ht_Icc : t.1 ∈ Icc (0 : ℝ) 1 := t.2 + have haR_t : aR t.1 = a t := extI_coe a t + exact ⟨t.1, (ha_Δ_iff t.1 ht_Icc).mp (haR_t.symm ▸ hxΔ), haR_t⟩ + · exact (Set.disjoint_left.mp (hdisj_other k hkj) hxk hxΔ).elim + · rintro ⟨t, ht, rfl⟩ + have ht_mem : t ∈ Icc (0 : ℝ) 1 := ⟨ht₁_mem.1.trans ht.1, ht.2.trans ht₂_mem.2⟩ + exact ⟨hQj_H'U j (haR_mem t ht_mem), hIcc_sub_Δ ⟨t, ht, rfl⟩⟩ + have hLine_U : IsLineWithEnds (H'.interSet Δ).U u v := by + rw [hU_eq_pieceA] + have h := (isArcMap_pieceA ha ht₁_mem.1 ht₁₂ ht₂_mem.2).isLineWithEnds + rwa [pieceA_zero, pieceA_one] at h + have hu_interV : u ∈ (H'.interSet Δ).V := by + rw [interSet_V_of_isClosed H' hΔ_disc.isClosed] + exact ⟨hu_FV.2, hF_sub_Δ hu_FV.1⟩ + have hv_interV : v ∈ (H'.interSet Δ).V := by + rw [interSet_V_of_isClosed H' hΔ_disc.isClosed] + exact ⟨hv_FV.2, hF_sub_Δ hv_FV.1⟩ + exact ⟨u, v, huv, hFV_eq, + GM16.drawing_isPathBetween_of_isLine_U hLine_U huv hu_interV hv_interV⟩ + · left + rw [not_nonempty_iff_eq_empty] at hne + intro x ⟨hxΔ, hxU⟩ + by_contra hx_not_F + exact Set.eq_empty_iff_forall_notMem.mp hne x ⟨⟨hxΔ, hx_not_F⟩, hxU⟩ + +/-- Verification of condition (iii) of (3.2) inside a closed disc `D ⊆ S'` where `D ∩ H'.U` is +contained in `B_bd ∪ ⋃ j, (Q' j).U` with `B_bd ⊆ discBd D`. -/ +theorem dial_of_oArc_in_striped_disc + (hS' : IsClosedSurface S') + {H' : Drawing S'} {D B_bd : Set S'} {m' : ℕ} + {u' v' : Fin m' → S'} {Q' : Fin m' → Drawing S'} + (hD : IsClosedDisc D) + (hB_bd : B_bd ⊆ discBd D) + (hD_U : D ∩ H'.U ⊆ B_bd ∪ ⋃ j : Fin m', (Q' j).U) + (_hQ'_D : ∀ j, (Q' j).U ⊆ D) + (hQ'_line : ∀ j, IsLineWithEnds (Q' j).U (u' j) (v' j)) + (hQ'_sub : ∀ j, (Q' j).IsSubdrawing H') + (hQ'_bd : ∀ j, (Q' j).U ∩ discBd D = {u' j, v' j}) + (hQ'_disj : Pairwise (fun i j => Disjoint (Q' i).U (Q' j).U)) + {F : Set S'} + (hFD : F ⊆ D) (hF : IsOArc F) (hFU : F ∩ H'.U ⊆ H'.V) (hFV : (F ∩ H'.V).ncard ≤ 2) : + ∃ Δ : Set S', Δ ⊆ D ∧ IsDial H' F Δ := + dial_of_oArc_in_striped_disc_family hS' hD hB_bd hD_U hQ'_line hQ'_sub hQ'_bd hQ'_disj + hFD hF hFU hFV + +/-- A striped disc built by omitting one line retains the dial conclusion for the +remaining paths. -/ +theorem dial_of_oArc_in_remaining_stripes + (hS' : IsClosedSurface S') + {H' : Drawing S'} {D B_bd : Set S'} {m : ℕ} {omitted : Fin m} + {u v : Fin m → S'} {Q : Fin m → Drawing S'} {L : Fin m → Set S'} + (hD : IsClosedDisc D) (hB : B_bd ⊆ discBd D) + (hcover : D ∩ H'.U ⊆ B_bd ∪ ⋃ j : {i : Fin m // i ≠ omitted}, (Q j.1).U) + (hpaths : ∀ i, (Q i).U = L i ∧ (Q i).IsSubdrawing H') + (hline : ∀ i, IsLineWithEnds (L i) (u i) (v i)) + (hends : ∀ j : {i : Fin m // i ≠ omitted}, (Q j.1).U ∩ discBd D = {u j.1, v j.1}) + (hdisjoint : Pairwise fun i j => Disjoint (L i) (L j)) + {F : Set S'} (hFD : F ⊆ D) (hF : IsOArc F) + (hFU : F ∩ H'.U ⊆ H'.V) (hFV : (F ∩ H'.V).ncard ≤ 2) : + ∃ Δ : Set S', Δ ⊆ D ∧ IsDial H' F Δ := by + refine dial_of_oArc_in_striped_disc_family hS' hD hB hcover + (fun j => (hpaths j.1).1 ▸ hline j.1) (fun j => (hpaths j.1).2) hends ?_ hFD hF hFU hFV + intro j k hjk + rw [(hpaths j.1).1, (hpaths k.1).1] + exact hdisjoint (fun heq => hjk (Subtype.ext heq)) + +end StripedDisc + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/Section4.lean b/LeanPool/GraphMinor/GM15/Section4.lean new file mode 100644 index 0000000000..a95f632ded --- /dev/null +++ b/LeanPool/GraphMinor/GM15/Section4.lean @@ -0,0 +1,2453 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +import LeanPool.GraphMinor.GM12.Section79 + +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM15.Cited +import LeanPool.GraphMinor.GM10.Section6 +import LeanPool.GraphMinor.GM10.Section12 +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM11.RadialExists +import LeanPool.GraphMinor.GM11.RadialFacts +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM12.Section1b +import LeanPool.GraphMinor.GM12.Section4 +import LeanPool.GraphMinor.GM12.Section711Cited +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.Surface.Epstein + +import LeanPool.GraphMinor.GM12.Section710 + +import LeanPool.GraphMinor.GM12.Section77 +import LeanPool.GraphMinor.GM12.Section4SpanSeparation + +/-! +# Graph Minors XV, Section 4: Rearrangement + +This file formalizes Section 4 ("Rearrangement", pages 124–128) of N. Robertson and P. D. Seymour, +*Graph Minors. XV. Giant steps*, J. Combin. Theory Ser. B 68 (1996) 112–148: +- **Graph Minors XV, (4.1)** (`GM15Theorem41Statement`, page 124): slope agreement for compressions + `T₁, T₂` of `T`, and `T₁ ⊆ T₂` when `H₁ = H₂` and `λ₁ ≥ λ₂`. +- **Graph Minors XV, (4.2)** (`GM15Theorem42Statement`, page 125): distance bound `d'(x, y) ≤ d(x, + y)` + away from `Z`. +- **Graph Minors XV, (4.3)** (`GM15Theorem43Statement`, `theorem_4_3`, page 125): `H - z^λ` is + 2-cell, + proved from Graph Minors XII, (7.11) (`GM12Theorem711Statement`). +- **Graph Minors XV, (4.4)** (`GM15Theorem44Statement`, page 126): unique `(4λ + 2)`-compression in + a + 2-cell subdrawing `H' ⊆ H` containing all atoms at distance `> λ` from `z`. +- **Graph Minors XV, (4.5)** (`GM15Theorem45Statement`, page 126): unique `(4λ + 2)`-compression in + a + 2-cell drawing `H'` containing all atoms of `H` at distance `> λ` from `z`. +- **Graph Minors XV, (4.6)** (`GM15Theorem46Statement`, page 126): rearranging a `Σ`-span within `λ` + of `z`. +- **Graph Minors XV, (4.7)** (`GM15Theorem47Statement`, page 127): preservation of free sets at + distance `> 2|X| + 5λ + 2` from `z` under `(4λ + 2)`-compression. +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +open Set Function Topology +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM14 + +universe u v w + +/-! ## Helper Lemmas on Atoms, Radial Drawings, and Tangle Metrics -/ + +/-- Every atom `a ∈ Γ.A` of a drawing `Γ` is nonempty. -/ +theorem atom_nonempty {S : Type w} [TopologicalSpace S] {Γ : Drawing S} {a : Set S} + (ha : a ∈ Γ.A) : a.Nonempty := by + rcases ha with (⟨v, _, rfl⟩ | he) | hr + · exact singleton_nonempty v + · exact he.1 + · exact region_nonempty hr + +/-- Distinct atoms of a drawing `Γ` are disjoint: if `σ ∈ a₁` and `σ ∈ a₂` for `a₁, a₂ ∈ Γ.A`, +then `a₁ = a₂`. -/ +theorem atom_eq_of_mem {S : Type w} [TopologicalSpace S] {Γ : Drawing S} {a₁ a₂ : Set S} + (ha₁ : a₁ ∈ Γ.A) (ha₂ : a₂ ∈ Γ.A) {σ : S} (h₁ : σ ∈ a₁) (h₂ : σ ∈ a₂) : + a₁ = a₂ := by + rcases ha₁ with (⟨v₁, hv₁, hEq₁⟩ | he₁) | hr₁ <;> + rcases ha₂ with (⟨v₂, hv₂, hEq₂⟩ | he₂) | hr₂ + · subst hEq₁; subst hEq₂ + rw [← mem_singleton_iff.mp h₁, ← mem_singleton_iff.mp h₂] + · subst hEq₁ + rw [mem_singleton_iff.mp h₁] at h₂ + exact ((he₂.2.1 h₂).2 hv₁).elim + · subst hEq₁ + rw [mem_singleton_iff.mp h₁] at h₂ + exact (region_subset hr₂ h₂ (Γ.V_subset_U hv₁)).elim + · subst hEq₂ + rw [mem_singleton_iff.mp h₂] at h₁ + exact ((he₁.2.1 h₁).2 hv₂).elim + · exact Γ.edge_eq_of_mem he₁ he₂ h₁ h₂ + · exact (region_subset hr₂ h₂ (he₁.2.1 h₁).1).elim + · subst hEq₂ + rw [mem_singleton_iff.mp h₂] at h₁ + exact (region_subset hr₁ h₁ (Γ.V_subset_U hv₂)).elim + · exact (region_subset hr₁ h₁ (he₂.2.1 h₂).1).elim + · exact region_eq_of_mem hr₁ hr₂ h₁ h₂ + +/-- Every point `σ : S` lies in some atom `a ∈ Γ.A`. -/ +theorem exists_atom_of_point {S : Type w} [TopologicalSpace S] (Γ : Drawing S) (σ : S) : + ∃ a ∈ Γ.A, σ ∈ a := by + by_cases hV : σ ∈ Γ.V + · exact ⟨{σ}, Or.inl (Or.inl ⟨σ, hV, rfl⟩), mem_singleton σ⟩ + · by_cases hU : σ ∈ Γ.U + · obtain ⟨e, he, hσe⟩ := Γ.exists_edge_of_mem hU hV + exact ⟨e, Or.inl (Or.inr he), hσe⟩ + · obtain ⟨r, hr, hσr⟩ := exists_region_of_notMem hU + exact ⟨r, Or.inr hr, hσr⟩ + +/-- If `σ₁ ∈ a₁ ∈ Γ.A` and `σ₂ ∈ a₂ ∈ Γ.A`, then `pointDist Γ d σ₁ σ₂ = d a₁ a₂`. -/ +theorem pointDist_eq_of_mem_atom {S : Type w} [TopologicalSpace S] + {Γ : Drawing S} {d : Set S → Set S → ℕ} {σ₁ σ₂ : S} {a₁ a₂ : Set S} + (ha₁ : a₁ ∈ Γ.A) (ha₂ : a₂ ∈ Γ.A) (h₁ : σ₁ ∈ a₁) (h₂ : σ₂ ∈ a₂) : + pointDist Γ d σ₁ σ₂ = d a₁ a₂ := by + have hEq : {k : ℕ | ∃ b₁ ∈ Γ.A, ∃ b₂ ∈ Γ.A, σ₁ ∈ b₁ ∧ σ₂ ∈ b₂ ∧ d b₁ b₂ = k} = {d a₁ a₂} := by + ext k + simp only [mem_ofPred_eq, mem_singleton_iff] + refine ⟨?_, fun hk => ⟨a₁, ha₁, a₂, ha₂, h₁, h₂, hk.symm⟩⟩ + rintro ⟨b₁, hb₁, b₂, hb₂, hσ₁, hσ₂, rfl⟩ + rw [atom_eq_of_mem hb₁ ha₁ hσ₁ h₁, atom_eq_of_mem hb₂ ha₂ hσ₂ h₂] + rw [pointDist, hEq, csInf_singleton] + +/-- If `σ ∈ a ∈ Γ.A`, then `pointAtomDist Γ d σ b = d a b`. -/ +theorem pointAtomDist_eq_of_mem_atom {S : Type w} [TopologicalSpace S] + {Γ : Drawing S} {d : Set S → Set S → ℕ} {σ : S} {a b : Set S} + (ha : a ∈ Γ.A) (hσ : σ ∈ a) : + pointAtomDist Γ d σ b = d a b := by + have hEq : {k : ℕ | ∃ a' ∈ Γ.A, σ ∈ a' ∧ d a' b = k} = {d a b} := by + ext k + simp only [mem_ofPred_eq, mem_singleton_iff] + refine ⟨?_, fun hk => ⟨a, ha, hσ, hk.symm⟩⟩ + rintro ⟨a', ha', hσ', rfl⟩ + rw [atom_eq_of_mem ha' ha hσ' hσ] + rw [pointAtomDist, hEq, csInf_singleton] + +/-- If `H'` is a subdrawing of `H` and an atom `a ∈ H.A` meets an atom `a' ∈ H'.A`, then `a ⊆ a'`. +-/ +theorem atom_subset_of_isSubdrawing {S : Type w} [TopologicalSpace S] + {H H' : Drawing S} (hSub : H'.IsSubdrawing H) {a a' : Set S} + (ha : a ∈ H.A) (ha' : a' ∈ H'.A) {σ : S} (hσ : σ ∈ a) (hσ' : σ ∈ a') : + a ⊆ a' := by + rcases ha with (⟨v, hv, hEq⟩ | he) | hr + · subst hEq + rw [← mem_singleton_iff.mp hσ] + exact singleton_subset_iff.mpr hσ' + · rcases ha' with (⟨v', hv', hEq'⟩ | he') | hr' + · subst hEq' + rw [mem_singleton_iff.mp hσ'] at hσ + exact ((he.2.1 hσ).2 (hSub.1 hv')).elim + · rw [H.edge_eq_of_mem he (hSub.2 he') hσ hσ'] + · have hdisj : Disjoint a H'.U := by + rw [Set.disjoint_left] + intro x hxe hxU' + by_cases hxV' : x ∈ H'.V + · exact (he.2.1 hxe).2 (hSub.1 hxV') + · obtain ⟨f, hf, hxf⟩ := H'.exists_edge_of_mem hxU' hxV' + have hef : a = f := H.edge_eq_of_mem he (hSub.2 hf) hxe hxf + exact region_subset hr' hσ' (hf.2.1 (hef ▸ hσ)).1 + exact subset_region hr' he.2.2.1.isConnected.isPreconnected hdisj hσ hσ' + · rcases ha' with (⟨v', hv', hEq'⟩ | he') | hr' + · subst hEq' + rw [mem_singleton_iff.mp hσ'] at hσ + exact (region_subset hr hσ (H.V_subset_U (hSub.1 hv'))).elim + · exact (region_subset hr hσ (hSub.U_subset (he'.2.1 hσ').1)).elim + · have hdisj : Disjoint a H'.U := by + rw [Set.disjoint_left] + intro x hxr hxU' + exact region_subset hr hxr (hSub.U_subset hxU') + exact subset_region hr' (region_isPreconnected hr) hdisj hσ hσ' + +/-- In a closed surface `S`, if an edge `e ∈ H.E` is also an atom of another drawing `H'`, then +`e ∈ H'.E`. -/ +theorem edge_mem_E_of_mem_A {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H H' : Drawing S} {e : Set S} + (he : e ∈ H.E) (he' : e ∈ H'.A) : e ∈ H'.E := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + rcases he' with (⟨w, _, rfl⟩ | he'E) | hr' + · exfalso + obtain ⟨u, v, hlink⟩ := (H.toGraph.edge_mem_iff_exists_isLink {w}).mp he + have hu : u ∈ closure ({w} : Set S) ∩ H.V := by + rw [hlink.2.2.2] + exact mem_insert u {v} + rw [isClosed_singleton.closure_eq] at hu + exact (he.2.1 hu.1).2 hu.2 + · exact he'E + · exfalso + obtain ⟨y, hye, hyU⟩ := + exists_notMem_U (Γ := H) hS (region_isOpen hr') (region_nonempty hr') + exact hyU (he.2.1 hye).1 + +/-- In a closed surface `S`, if a vertex singleton `{v}` (`v ∈ H.V`) is an atom of another drawing +`H'`, then `v ∈ H'.V`. -/ +theorem vertex_mem_V_of_mem_A {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H H' : Drawing S} {v : S} + (hv : v ∈ H.V) (hv' : ({v} : Set S) ∈ H'.A) : v ∈ H'.V := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + rcases hv' with (⟨w, hw, hwv⟩ | he') | hr' + · rwa [singleton_eq_singleton_iff.mp hwv] at hw + · exfalso + obtain ⟨u, w, hlink⟩ := (H'.toGraph.edge_mem_iff_exists_isLink {v}).mp he' + have hu : u ∈ closure ({v} : Set S) ∩ H'.V := by + rw [hlink.2.2.2] + exact mem_insert u {w} + rw [isClosed_singleton.closure_eq] at hu + exact (he'.2.1 hu.1).2 hu.2 + · exfalso + obtain ⟨y, hyv, hyU⟩ := + exists_notMem_U (Γ := H) hS (region_isOpen hr') (region_nonempty hr') + rw [mem_singleton_iff.mp hyv] at hyU + exact hyU (H.V_subset_U hv) + +/-- In a closed surface `S`, if a region `r ∈ H.R` is also an atom of another drawing `H'`, then +`r ∈ H'.R`. -/ +theorem region_mem_R_of_mem_A {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H H' : Drawing S} {r : Set S} + (hr : r ∈ H.R) (hr' : r ∈ H'.A) : r ∈ H'.R := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + rcases hr' with (⟨w, hw', rfl⟩ | he') | hr'R + · exfalso + obtain ⟨y, hyr, hyU⟩ := + exists_notMem_U (Γ := H') hS (region_isOpen hr) (region_nonempty hr) + rw [mem_singleton_iff.mp hyr] at hyU + exact hyU (H'.V_subset_U hw') + · exfalso + obtain ⟨y, hyr, hyU⟩ := + exists_notMem_U (Γ := H') hS (region_isOpen hr) (region_nonempty hr) + exact hyU (he'.2.1 hyr).1 + · exact hr'R + +/-- In a bipartite graph with bipartition `(X, Xᶜ)`, a walk from `u` to `v` has even length if and +only if `u` and `v` lie on the same side of the bipartition. -/ +theorem even_length_of_bipartite {α' β' : Type*} {G : Graph α' β'} {X : Set α'} + (hbip : ∀ e x y, G.IsLink e x y → (x ∈ X ↔ y ∉ X)) {u v : α'} + (W : GraphWalk G u v) : + (u ∈ X ↔ v ∈ X) ↔ Even W.length := by + induction W with + | nil _ => simp + | @cons a y b e hl r ih => + have h₁ := hbip e a y hl + rw [GraphWalk.length_cons, Nat.even_add_one, ← ih] + tauto + +/-- Every closed walk `W` of a radial drawing `K` of `H` has even length. -/ +theorem even_length_of_preRadial {S : Type w} [TopologicalSpace S] {H K : Drawing S} + (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) {u : S} + (W : GraphWalk K.toGraph u u) : + Even W.length := + (even_length_of_bipartite (GM11.bipartite_of_preRadial hrad) W).mp Iff.rfl + +/-- Every atom `x ∈ H.A` has a corresponding atom `x' ∈ K.A` in a radial drawing `K` of `H`. -/ +theorem exists_correspondingAtom {S : Type w} [TopologicalSpace S] {H K : Drawing S} + (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) {x : Set S} (hx : x ∈ H.A) : + ∃ x' : Set S, IsCorrespondingAtom H K x x' := by + have hUU : H.U ∩ K.U = H.V := hrad.1 + rcases hx with (⟨v, hv, rfl⟩ | he) | hr + · exact ⟨{v}, Or.inl (Or.inl ⟨v, hv, rfl⟩), Or.inl (Or.inl ⟨v, hrad.2.1 hv, rfl⟩), + Or.inl ⟨v, hv, rfl, rfl⟩⟩ + · obtain ⟨y, hy⟩ := he.1 + have hyK : y ∉ K.U := fun h => by + have : y ∈ H.U ∩ K.U := ⟨(he.2.1 hy).1, h⟩ + rw [hUU] at this + exact (he.2.1 hy).2 this + obtain ⟨r', hr', hyr'⟩ := exists_region_of_notMem hyK + have hdisj : Disjoint x K.U := by + rw [Set.disjoint_left] + intro z hz hzK + have : z ∈ H.U ∩ K.U := ⟨(he.2.1 hz).1, hzK⟩ + rw [hUU] at this + exact (he.2.1 hz).2 this + have hsub : x ⊆ r' := subset_region hr' he.2.2.1.isConnected.isPreconnected hdisj hy hyr' + exact ⟨r', Or.inl (Or.inr he), Or.inr hr', Or.inr (Or.inl ⟨he, hr', hsub⟩)⟩ + · obtain ⟨w, ⟨hwr, hwK⟩, _⟩ := hrad.2.2.1 x hr + exact ⟨{w}, Or.inr hr, Or.inl (Or.inl ⟨w, hwK, rfl⟩), Or.inr (Or.inr ⟨hr, w, ⟨hwK, hwr⟩, rfl⟩)⟩ + +/-- The atom `x' ∈ K.A` corresponding to `x ∈ H.A` is unique. -/ +theorem correspondingAtom_unique {S : Type w} [TopologicalSpace S] {H K : Drawing S} + (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) {x x₁' x₂' : Set S} + (h₁ : IsCorrespondingAtom H K x x₁') (h₂ : IsCorrespondingAtom H K x x₂') : + x₁' = x₂' := by + rcases h₁.2.2 with ⟨v₁, hv₁, hEq₁, hEq₁'⟩ | ⟨he₁, hr₁', hsub₁⟩ | ⟨hr₁, w₁, hw₁, hEq₁'⟩ <;> + rcases h₂.2.2 with ⟨v₂, hv₂, hEq₂, hEq₂'⟩ | ⟨he₂, hr₂', hsub₂⟩ | ⟨hr₂, w₂, hw₂, hEq₂'⟩ + · rw [hEq₁', hEq₂', ← singleton_eq_singleton_iff, ← hEq₁, ← hEq₂] + · subst hEq₁ + exact ((he₂.2.1 (mem_singleton v₁)).2 hv₁).elim + · subst hEq₁ + exact (region_subset hr₂ (mem_singleton v₁) (H.V_subset_U hv₁)).elim + · subst hEq₂ + exact ((he₁.2.1 (mem_singleton v₂)).2 hv₂).elim + · obtain ⟨y, hy⟩ := he₁.1 + exact region_eq_of_mem hr₁' hr₂' (hsub₁ hy) (hsub₂ hy) + · obtain ⟨y, hy⟩ := he₁.1 + exact (region_subset hr₂ hy (he₁.2.1 hy).1).elim + · subst hEq₂ + exact (region_subset hr₁ (mem_singleton v₂) (H.V_subset_U hv₂)).elim + · obtain ⟨y, hy⟩ := he₂.1 + exact (region_subset hr₁ hy (he₂.2.1 hy).1).elim + · have hw_eq : w₁ = w₂ := (hrad.2.2.1 x hr₁).unique ⟨hw₁.2, hw₁.1⟩ ⟨hw₂.2, hw₂.1⟩ + rw [hEq₁', hEq₂', hw_eq] + +/-- For any `x, y : Set S`, `tangleMetric H K ins θ x y ≤ θ`. -/ +theorem tangleMetric_le_ord {S : Type w} [TopologicalSpace S] [T1Space S] + (H K : Drawing S) (ins : Drawing S → Set S) (θ : ℕ) (x y : Set S) : + tangleMetric H K ins θ x y ≤ θ := by + classical + unfold tangleMetric + split_ifs with hxy hex + · exact Nat.zero_le θ + · by_cases hne : {k : ℕ | ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H K x x' ∧ IsCorrespondingAtom H K y y' ∧ + W.length < 2 * θ ∧ W.length = 2 * k ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W}.Nonempty + · obtain ⟨k, hk⟩ := hne + obtain ⟨_, W', _, _, _, _, hlen', hk', _, _⟩ := id hk + exact (Nat.sInf_le hk).trans (by omega) + · rw [Set.not_nonempty_iff_eq_empty.mp hne, Nat.sInf_empty] + exact Nat.zero_le θ + · exact le_rfl + +/-- If `W` is a closed walk of `K` with `W.length < 2 * θ` such that the corresponding atoms +`x', y'` of `x, y ∈ H.A` satisfy `x' ⊆ insWalk ins K W` and `y' ⊆ insWalk ins K W`, then +`2 * tangleMetric H K ins θ x y ≤ W.length`. -/ +theorem two_mul_tangleMetric_le_of_walk {S : Type w} [TopologicalSpace S] [T1Space S] + {H K : Drawing S} (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) + (ins : Drawing S → Set S) (θ : ℕ) {x y x' y' : Set S} + (hx' : IsCorrespondingAtom H K x x') (hy' : IsCorrespondingAtom H K y y') + {u : S} (W : GraphWalk K.toGraph u u) (hlen : W.length < 2 * θ) + (hxW : x' ⊆ insWalk ins K W) (hyW : y' ⊆ insWalk ins K W) : + 2 * tangleMetric H K ins θ x y ≤ W.length := by + classical + unfold tangleMetric + split_ifs with hxy hex + · exact Nat.zero_le _ + · obtain ⟨k, hk⟩ := even_length_of_preRadial hrad W + have hmem : k ∈ {k : ℕ | ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H K x x' ∧ IsCorrespondingAtom H K y y' ∧ + W.length < 2 * θ ∧ W.length = 2 * k ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W} := + ⟨u, W, x', y', hx', hy', hlen, by omega, hxW, hyW⟩ + have hle := Nat.sInf_le hmem + omega + · exact (hex ⟨u, W, x', y', hx', hy', hlen, hxW, hyW⟩).elim + +/-- If `x ≠ y` and `tangleMetric H K ins θ x y < θ`, then there is a closed walk `W` of `K` of +length `2 * tangleMetric H K ins θ x y` whose `insWalk` contains the corresponding atoms of `x` and +`y`. -/ +theorem exists_walk_of_tangleMetric_lt {S : Type w} [TopologicalSpace S] [T1Space S] + {H K : Drawing S} (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) + (ins : Drawing S → Set S) {θ : ℕ} {x y : Set S} (hne : x ≠ y) + (hlt : tangleMetric H K ins θ x y < θ) : + ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H K x x' ∧ IsCorrespondingAtom H K y y' ∧ + W.length < 2 * θ ∧ W.length = 2 * tangleMetric H K ins θ x y ∧ + x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W := by + classical + have hlt' := hlt + unfold tangleMetric at hlt' + split_ifs at hlt' with hxy hex + · exact (hne hxy).elim + · rcases hex with ⟨u₀, W₀, x₀', y₀', hx₀', hy₀', hlen₀, hxW₀, hyW₀⟩ + obtain ⟨k₀, hk₀⟩ := even_length_of_preRadial hrad W₀ + have hSne : {k : ℕ | ∃ (u : S) (W : GraphWalk K.toGraph u u) (x' y' : Set S), + IsCorrespondingAtom H K x x' ∧ IsCorrespondingAtom H K y y' ∧ + W.length < 2 * θ ∧ W.length = 2 * k ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W}.Nonempty + := + ⟨k₀, u₀, W₀, x₀', y₀', hx₀', hy₀', hlen₀, by omega, hxW₀, hyW₀⟩ + obtain ⟨u, W, x', y', hx', hy', hlen, hk, hxW, hyW⟩ := Nat.sInf_mem hSne + have heq : tangleMetric H K ins θ x y = sInf {k : ℕ | ∃ (u : S) (W : GraphWalk K.toGraph u u) + (x' y' : Set S), IsCorrespondingAtom H K x x' ∧ IsCorrespondingAtom H K y y' ∧ + W.length < 2 * θ ∧ W.length = 2 * k ∧ x' ⊆ insWalk ins K W ∧ y' ⊆ insWalk ins K W} := by + unfold tangleMetric + split_ifs with hex' + · rfl + · exact (hex' ⟨u₀, W₀, x₀', y₀', hx₀', hy₀', hlen₀, hxW₀, hyW₀⟩).elim + exact ⟨u, W, x', y', hx', hy', hlen, heq ▸ hk, hxW, hyW⟩ + · exact (lt_irrefl θ hlt').elim + +/-- Dual of `GM11.two_mul_count_le`: in a bipartite walk, at most half the steps visit `X`. -/ +theorem two_mul_countP_le_of_bipartite {S : Type w} [TopologicalSpace S] + {G : Drawing S} (X : Set S) [DecidablePred (· ∈ X)] + (hb : ∀ e x y, G.toGraph.IsLink e x y → (x ∈ X ↔ y ∉ X)) {u v : S} + (W : GraphWalk G.toGraph u v) : + 2 * (W.support.tail.countP (· ∈ X)) + (if u ∈ X then 1 else 0) ≤ + W.length + (if v ∈ X then 1 else 0) := by + induction W with + | nil _ => simp [GraphWalk.length, GraphWalk.support] + | @cons a y b e hl r ih => + have h₁ := hb e a y hl + have hsup : (GraphWalk.cons hl r).support.tail = r.support := rfl + have hsup₂ : r.support = y :: r.support.tail := r.support_eq_cons + have hlen : (GraphWalk.cons hl r).length = r.length + 1 := rfl + rw [hsup, hlen, hsup₂, List.countP_cons] + by_cases hy : y ∈ X + · have ha : a ∉ X := fun h => (h₁.mp h) hy + simp only [hy, ha, ite_true, ite_false, decide_true] at ih ⊢ + omega + · have ha : a ∈ X := h₁.mpr hy + simp only [hy, ha, ite_true, ite_false, decide_false, Bool.false_eq_true] at ih ⊢ + omega + +/-- Every circuit `C` of a radial drawing `K` of `H` has `IsOArc C.U`, `2 ≤ C.length`, and +`2 * (C.U ∩ H.V).ncard ≤ C.length`. -/ +theorem circuit_props_of_preRadial {S : Type w} [TopologicalSpace S] [T2Space S] + {H K C : Drawing S} (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) + (hC : C.IsCircuit) (hCs : C.IsSubdrawing K) : + IsOArc C.U ∧ 2 ≤ C.length ∧ 2 * (C.U ∩ H.V).ncard ≤ C.length := + let ⟨hoarc, hlen, hmin⟩ := GM12.circuit_props_of_preRadial hrad hC hCs + ⟨hoarc, hmin, hlen.ge⟩ + +/-- Every respectful tangle `T` of order `θ` in a 2-cell drawing `H` has a derived slope `ins` in +any radial drawing `K` of `H`. -/ +theorem exists_derivedSlope {S : Type w} [TopologicalSpace S] [T2Space S] + {H K : Drawing S} {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hResp : IsRespectfulDrawingTangle H θ T) + (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) : + ∃ ins : Drawing S → Set S, IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins := + GM12.exists_derivedSlope_of_respectful hResp hrad + +/-- Every respectful tangle `T` of order `θ` in a 2-cell drawing `H` in a closed surface `S` has a +tangle metric `d` (`HasTangleMetric H θ T d`). -/ +theorem exists_hasTangleMetric {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hResp : IsRespectfulDrawingTangle H θ T) : + ∃ d : Set S → Set S → ℕ, HasTangleMetric H θ T d := + GM12.exists_hasTangleMetric hS hResp + +/-- If `H₁` is a 2-cell drawing in a closed surface `S` with `H₁.E = ∅`, then `H₁.V.ncard ≤ 1`. -/ +theorem ncard_V_le_one_of_E_empty {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {H₁ : Drawing S} (h2cell : (PaintingOrDrawing.drawing H₁).IsTwoCell) + (hE : H₁.E = ∅) : H₁.V.ncard ≤ 1 := + GM12.ncard_V_le_one_of_E_empty hS h2cell hE + +/-- Every edge of a drawing has at least one endpoint in `V`. -/ +theorem edge_closure_inter_V_nonempty {S : Type w} [TopologicalSpace S] + {H : Drawing S} {e : Set S} (he : e ∈ H.E) : (closure e ∩ H.V).Nonempty := by + rcases H.edge_cond e he with ⟨u, v, _, hcl, _⟩ | ⟨u, hcl, _⟩ + · exact ⟨u, by rw [hcl]; simp⟩ + · exact ⟨u, by rw [hcl]; simp⟩ + +/-- Metric facts for a respectful tangle, including the triangle inequality from Graph Minors XI, +(9.1), supplied by `GM11.gm15_theorem_9_1`. -/ +theorem gm11_theorem_9_1 : GM11Theorem91Statement.{w} := + GM11.gm15_theorem_9_1 + +/-- Graph Minors XIV, (7.3), proved from `GM14.theorem_7_3_proof`, `GM11.gm14_theorem_8_12`, +`GM11.gm19_theorem_8_5`, `gm11_theorem_9_1`, and `Surface.epstein`. -/ +theorem gm14_theorem_7_3 : GM14Theorem73Statement.{w} := + GM14.theorem_7_3_proof + +/-- Graph Minors XII, (1.2), from the established `GM12.theorem_1_2_proof`. -/ +theorem gm12_theorem_1_2 : GM12Theorem12Statement.{w} := + fun _ _ _ _ _ hS _ _ hMetric hE hc => + GM12.theorem_1_2_proof hS hMetric hE hc + +/-- A 2-cell drawing in a closed surface with a respectful tangle of order `θ ≥ 2` has at least one +edge. -/ +theorem edges_nonempty_of_tangle {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsRespectfulDrawingTangle H θ T) (hθ : 2 ≤ θ) : H.E.Nonempty := by + have : ConnectedSpace S := hT.1.1 + by_contra hE + have hV := ncard_V_le_one_of_E_empty hS hT.1 (Set.not_nonempty_iff_eq_empty.mp hE) + have hord : θ ≤ H.V.ncard := hT.2.1.order_le_ncard_vertexSet + omega + +/-- A 2-cell drawing in a closed surface with a respectful tangle of order `θ ≥ 3` has at least two +edges. -/ +theorem two_le_ncard_edges_of_tangle {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsRespectfulDrawingTangle H θ T) (hθ : 3 ≤ θ) : 2 ≤ H.E.ncard := by + have : ConnectedSpace S := hT.1.1 + have hE : H.E.Nonempty := edges_nonempty_of_tangle hS hT (by omega) + obtain ⟨e₀, he₀⟩ := id hE + by_contra hlt + have heq : ∀ e ∈ H.E, e = e₀ := fun e he => by + by_contra hne + exact hlt ((Set.one_lt_ncard_iff H.finite_edges).mpr ⟨e, e₀, he, he₀, hne⟩) + obtain ⟨K, hK⟩ := GM11.exists_radialDrawing hS hT.1 + have hrf : GM11.RegionFacts (PaintingOrDrawing.drawing H) K := + GM11.regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hE + have hV_sub : H.V ⊆ closure e₀ ∩ H.V := fun v hv => by + obtain ⟨e, he, hve⟩ := GM11.exists_edge_of_regionFacts hS hrf hv + exact ⟨heq e he ▸ hve, hv⟩ + have hcl_le : (closure e₀ ∩ H.V).ncard ≤ 2 := by + rcases H.edge_cond e₀ he₀ with ⟨u, v, _, hcl, _⟩ | ⟨u, hcl, _⟩ + · rw [hcl] + exact (Set.ncard_insert_le u {v}).trans (by simp) + · rw [hcl] + simp + have hV_le : H.V.ncard ≤ 2 := + (Set.ncard_le_ncard hV_sub (H.finite_V.subset inter_subset_right)).trans hcl_le + have hord : θ ≤ H.V.ncard := hT.2.1.order_le_ncard_vertexSet + omega + +/-- For any 2-cell drawing `H` in a closed surface `S` with a respectful tangle `T` of order `θ ≥ 2` +with metric `d`, and any atom `z ∈ H.A`, there exists an atom `b ∈ H.A` with `d z b = θ` +(Graph Minors XV, proof of (4.1), page 125, applying Graph Minors XI, (8.12)). -/ +theorem exists_atom_dist_eq_theta {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hMetric : HasTangleMetric H θ T d) (hθ : 2 ≤ θ) + {z : Set S} (hz : z ∈ H.A) : + ∃ b ∈ H.A, d z b = θ := by + have : ConnectedSpace S := hMetric.1.1.1 + exact GM12.exists_atom_dist_eq_theta hS hMetric hθ hz + +/-- Every vertex `x ∈ H.V` in the closure of an atom `a ∈ H.A` has `d {x} a ≤ 2`. -/ +theorem vertex_atom_dist_le_two + {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric H θ T d) : + ∀ x ∈ H.V, ∀ a ∈ H.A, x ∈ closure a → d {x} a ≤ 2 := by + obtain ⟨_, hs, hb, _, _, hr, he⟩ := gm11_theorem_9_1 H θ T d hS hm.1.1.1 hm + intro x hx a ha hxa + have hxA : ({x} : Set S) ∈ H.A := Or.inl (Or.inl ⟨x, hx, rfl⟩) + by_cases hθ : θ ≤ 2 + · exact (hb _ hxA _ ha).trans hθ + rcases ha with (⟨y, hy, rfl⟩ | ha) | ha + · have hxy : x = y := by simpa only [closure_singleton, mem_singleton_iff] using hxa + subst y + exact (hs _ hxA).le.trans (Nat.zero_le _) + · exact he x hx a ha hxa + · exact (hr (edges_nonempty_of_tangle hS hm.1 (by omega)) x hx a ha hxa).trans (by omega) + +/-- Any two atoms `a, b ∈ H.A` with `(a ∩ closure b).Nonempty` have `d a b ≤ 3`. -/ +theorem atom_closure_dist_le_three + {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric H θ T d) : + ∀ a ∈ H.A, ∀ b ∈ H.A, (a ∩ closure b).Nonempty → d a b ≤ 3 := by + have : ConnectedSpace S := hm.1.1.1 + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨_, hs, _, hsym, htri, hr, he⟩ := gm11_theorem_9_1 H θ T d hS hm.1.1.1 hm + have hv2 := vertex_atom_dist_le_two hS hm + intro a ha b hb ⟨y, hya, hyb⟩ + by_cases hab : a = b + · subst hab + exact (hs a ha).le.trans (Nat.zero_le _) + rcases ha with (⟨v, hv, rfl⟩ | haE) | haR + · rw [mem_singleton_iff] at hya + subst hya + exact (hv2 y hv b hb hyb).trans (by omega) + · rcases hb with (⟨w, hw, rfl⟩ | hbE) | hbR + · rw [closure_singleton, mem_singleton_iff] at hyb + subst hyb + exact ((haE.2.1 hya).2 hw).elim + · have hyb' : y ∈ b := H.closure_diff_V hbE ▸ ⟨hyb, (haE.2.1 hya).2⟩ + exact (hab (H.edge_eq_of_mem haE hbE hya hyb')).elim + · have he_sub : a ⊆ closure b := + GM11.edge_subset_closure_of_incident hS haE hbR ⟨y, hya, hyb⟩ + obtain ⟨v, hve, hvV⟩ := edge_closure_inter_V_nonempty haE + have hvb : v ∈ closure b := closure_minimal he_sub isClosed_closure hve + have hvA : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hvV, rfl⟩) + have h1 : d {v} a ≤ 2 := he v hvV a haE hve + have h2 : d {v} b ≤ 1 := hr ⟨a, haE⟩ v hvV b hbR hvb + have h3 := htri a (Or.inl (Or.inr haE)) {v} hvA b (Or.inr hbR) + have h4 := hsym {v} hvA a (Or.inl (Or.inr haE)) + omega + · obtain ⟨z, hzr, hzb⟩ := mem_closure_iff.mp hyb a (region_isOpen haR) hya + exact (hab (atom_eq_of_mem (Or.inr haR) hb hzr hzb)).elim + +/-! ## Section 4 Statements and Proofs -/ + +/-- Statement of Graph Minors XV, (4.1) (pages 124–125): +"Let $\mathcal{T}$ be a respectful tangle of order $\theta$ in a 2-cell drawing $H$ in a surface +$\Sigma$. Let $H_1, H_2$ be 2-cell drawings in $\Sigma$, and for $i = 1, 2$ let $\mathcal{T}_i$ be a +$\lambda_i$-compression of $\mathcal{T}$ in $H_i$. Let $H_1, H_2$ have radial drawings $K_1, K_2$. +Then ... for every $W$ which is a closed walk of a common subdrawing of $K_1$ and $K_2$, if +$ins_1(W)$, +$ins_2(W)$ are both defined then they are equal. In particular, if $H_1 = H_2$ and +$\lambda_1 \ge \lambda_2$, then $\mathcal{T}_1 \subseteq \mathcal{T}_2$." -/ +def GM15Theorem41Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + (H H₁ H₂ K₁ K₂ : Drawing S) (θ lam₁ lam₂ : ℕ) + (T T₁ T₂ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d d₁ d₂ : Set S → Set S → ℕ) (ins₁ ins₂ : Drawing S → Set S), + IsClosedSurface S → + IsLambdaCompression H H₁ θ lam₁ T T₁ d d₁ → + IsLambdaCompression H H₂ θ lam₂ T T₂ d d₂ → + (PaintingOrDrawing.drawing H₁).IsRadialDrawing K₁ → + IsDerivedSlope (PaintingOrDrawing.drawing H₁) K₁ (θ - lam₁) T₁ ins₁ → + (∀ x ∈ H₁.A, ∀ y ∈ H₁.A, d₁ x y = tangleMetric H₁ K₁ ins₁ (θ - lam₁) x y) → + (PaintingOrDrawing.drawing H₂).IsRadialDrawing K₂ → + IsDerivedSlope (PaintingOrDrawing.drawing H₂) K₂ (θ - lam₂) T₂ ins₂ → + (∀ x ∈ H₂.A, ∀ y ∈ H₂.A, d₂ x y = tangleMetric H₂ K₂ ins₂ (θ - lam₂) x y) → + (∀ (u₁ u₂ : S) (W₁ : GraphWalk K₁.toGraph u₁ u₁) (W₂ : GraphWalk K₂.toGraph u₂ u₂), + walkDrawing K₁ W₁ = walkDrawing K₂ W₂ → + W₁.length < 2 * (θ - lam₁) → W₂.length < 2 * (θ - lam₂) → + insWalk ins₁ K₁ W₁ = insWalk ins₂ K₂ W₂) ∧ + (H₁ = H₂ → K₁ = K₂ → lam₂ ≤ lam₁ → T₁ ⊆ T₂) + +/-- **Graph Minors XV, (4.1)** (pages 124–125): +Slope agreement for compressions `T₁, T₂` of `T`, and `T₁ ⊆ T₂` when `H₁ = H₂` and `λ₁ ≥ λ₂`. +Proved from Graph Minors XI, (8.12) (`exists_atom_dist_eq_theta`). -/ +theorem theorem_4_1_proof : + GM15Theorem41Statement.{w} := by + intro S _ _ H H₁ H₂ K₁ K₂ θ lam₁ lam₂ T T₁ T₂ d d₁ d₂ ins₁ ins₂ + hS hComp₁ hComp₂ hK₁ hins₁ hd₁ hK₂ hins₂ hd₂ + have hConn : ConnectedSpace S := hComp₁.hasMetric.1.1.1 + have hCircEq : ∀ C : Drawing S, C.IsCircuit → C.IsSubdrawing K₁ → C.IsSubdrawing K₂ → + C.length < 2 * (θ - lam₁) → C.length < 2 * (θ - lam₂) → ins₁ C = ins₂ C := by + intro C hC hCs₁ hCs₂ hlen₁ hlen₂ + obtain ⟨_, h2le, _⟩ := circuit_props_of_preRadial hK₁.2.1 hC hCs₁ + have hθ2 : 2 ≤ θ := by omega + obtain ⟨v, W_C, ⟨hnd, hed⟩, hpos, hCV, hCE⟩ := id hC + have hvC : v ∈ C.V := by rw [hCV]; exact W_C.start_mem_support + have hvU : v ∈ C.U := C.V_subset_U hvC + obtain ⟨a_v, ha_v, hv_av⟩ := exists_atom_of_point H v + obtain ⟨b_v, hb_v, hd_eq⟩ := exists_atom_dist_eq_theta hS hComp₁.hasMetric hθ2 ha_v + obtain ⟨σ, hσb⟩ := atom_nonempty hb_v + have hpt : pointDist H d v σ = θ := by + rw [pointDist_eq_of_mem_atom ha_v hb_v hv_av hσb, hd_eq] + have hlen_WC : W_C.length = C.length := by + rw [Drawing.length, hCE] + have h : {f | f ∈ W_C.edges} = (W_C.edges.toFinset : Set (Set S)) := by ext; simp + rw [h, ncard_coe_finset, List.toFinset_card_of_nodup hed] + rfl + have hnot_mem : ∀ (Hᵢ Kᵢ : Drawing S) (lamᵢ : ℕ) + (Tᵢ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (dᵢ : Set S → Set S → ℕ) (insᵢ : Drawing S → Set S), + IsLambdaCompression H Hᵢ θ lamᵢ T Tᵢ d dᵢ → + (PaintingOrDrawing.drawing Hᵢ).IsRadialDrawing Kᵢ → + IsDerivedSlope (PaintingOrDrawing.drawing Hᵢ) Kᵢ (θ - lamᵢ) Tᵢ insᵢ → + (∀ x ∈ Hᵢ.A, ∀ y ∈ Hᵢ.A, dᵢ x y = tangleMetric Hᵢ Kᵢ insᵢ (θ - lamᵢ) x y) → + C.IsSubdrawing Kᵢ → C.length < 2 * (θ - lamᵢ) → σ ∉ insᵢ C := by + intro Hᵢ Kᵢ lamᵢ Tᵢ dᵢ insᵢ hCompᵢ hKᵢ hinsᵢ hdᵢ hCsᵢ hlenᵢ hσ_in + obtain ⟨Wᵢ, hsupᵢ, hedᵢ⟩ := hCsᵢ.exists_walk_up W_C + have hlenᵢ' : Wᵢ.length < 2 * (θ - lamᵢ) := by + have : Wᵢ.length = W_C.length := by simp [GraphWalk.length, hedᵢ] + omega + have hWD : walkDrawing Kᵢ Wᵢ = C := by + apply Drawing.ext_of_V_E + · rw [GM11.walkDrawing_V, hsupᵢ, hCV] + · rw [GM11.walkDrawing_E, hedᵢ, hCE] + have hv_insW : v ∈ insWalk insᵢ Kᵢ Wᵢ := by + change v ∈ insOf insᵢ (walkDrawing Kᵢ Wᵢ) + rw [hWD] + exact Or.inl hvU + have hσ_insW : σ ∈ insWalk insᵢ Kᵢ Wᵢ := by + change σ ∈ insOf insᵢ (walkDrawing Kᵢ Wᵢ) + rw [hWD] + exact Or.inr (mem_iUnion₂.mpr ⟨C, ⟨hC, Drawing.IsSubdrawing.refl C⟩, hσ_in⟩) + obtain ⟨aᵢ, haᵢ, hv_aᵢ⟩ := exists_atom_of_point Hᵢ v + obtain ⟨bᵢ, hbᵢ, hσ_bᵢ⟩ := exists_atom_of_point Hᵢ σ + obtain ⟨aᵢ', haᵢ'⟩ := exists_correspondingAtom hKᵢ.2.1 haᵢ + obtain ⟨bᵢ', hbᵢ'⟩ := exists_correspondingAtom hKᵢ.2.1 hbᵢ + have haᵢ_sub : aᵢ' ⊆ insWalk insᵢ Kᵢ Wᵢ := + (GM14.theorem_3_1_proof hS hKᵢ hinsᵢ haᵢ' Wᵢ hlenᵢ').mpr ⟨v, hv_aᵢ, hv_insW⟩ + have hbᵢ_sub : bᵢ' ⊆ insWalk insᵢ Kᵢ Wᵢ := + (GM14.theorem_3_1_proof hS hKᵢ hinsᵢ hbᵢ' Wᵢ hlenᵢ').mpr ⟨σ, hσ_bᵢ, hσ_insW⟩ + have hle2 := two_mul_tangleMetric_le_of_walk hKᵢ.2.1 insᵢ (θ - lamᵢ) haᵢ' hbᵢ' Wᵢ hlenᵢ' + haᵢ_sub hbᵢ_sub + rw [← hdᵢ aᵢ haᵢ bᵢ hbᵢ, ← pointDist_eq_of_mem_atom (d := dᵢ) haᵢ hbᵢ hv_aᵢ hσ_bᵢ] at hle2 + have hge := hCompᵢ.dist_le v σ + rw [hpt] at hge + omega + have hσ₁ := hnot_mem H₁ K₁ lam₁ T₁ d₁ ins₁ hComp₁ hK₁ hins₁ hd₁ hCs₁ hlen₁ + have hσ₂ := hnot_mem H₂ K₂ lam₂ T₂ d₂ ins₂ hComp₂ hK₂ hins₂ hd₂ hCs₂ hlen₂ + obtain ⟨hD₁, hbd₁, _⟩ := hins₁ C hC hCs₁ hlen₁ + obtain ⟨hD₂, hbd₂, _⟩ := hins₂ C hC hCs₂ hlen₂ + by_contra hne + have hdb : discBd (ins₁ C) = discBd (ins₂ C) := by + rw [← GM11.IsClosedDisc.frontier_eq_discBd hS hD₁, + ← GM11.IsClosedDisc.frontier_eq_discBd hS hD₂, + GM11.subBd_eq_frontier', GM11.subBd_eq_frontier', hbd₁, hbd₂] + have hcov := GM11.cover_of_discBd_eq hS hD₁ hD₂ hdb hne + rcases (hcov ▸ mem_univ σ : σ ∈ ins₁ C ∪ ins₂ C) with h | h + · exact hσ₁ h + · exact hσ₂ h + refine ⟨fun u₁ u₂ W₁ W₂ hWD hlen₁ hlen₂ => ?_, fun hH hK hlam => ?_⟩ + · unfold insWalk + rw [hWD] + ext x + simp only [insOf, mem_union, mem_iUnion, exists_prop] + refine or_congr Iff.rfl (exists_congr fun C => and_congr_right fun ⟨hC, hCs₂⟩ => ?_) + have hCs₁ : C.IsSubdrawing (walkDrawing K₁ W₁) := hWD.symm ▸ hCs₂ + have hSub₁ : C.IsSubdrawing K₁ := hCs₁.trans (GM11.walkDrawing_isSubdrawing K₁ W₁) + have hSub₂ : C.IsSubdrawing K₂ := hCs₂.trans (GM11.walkDrawing_isSubdrawing K₂ W₂) + have hClen : ∀ {K : Drawing S} {u : S} (W : GraphWalk K.toGraph u u), + C.IsSubdrawing (walkDrawing K W) → C.length ≤ W.length := by + intro K u W hCs + have hsub : C.E ⊆ {e | e ∈ W.edges} := by + have := hCs.2 + rwa [GM11.walkDrawing_E] at this + calc C.E.ncard ≤ ({e | e ∈ W.edges} : Set (Set S)).ncard := + Set.ncard_le_ncard hsub (List.finite_toSet _) + _ ≤ W.edges.length := by + rw [show ({e | e ∈ W.edges} : Set (Set S)) = ↑W.edges.toFinset by ext; simp, + Set.ncard_coe_finset] + exact List.toFinset_card_le _ + _ = W.length := rfl + have hC₁ : C.length < 2 * (θ - lam₁) := lt_of_le_of_lt (hClen W₁ hCs₁) hlen₁ + have hC₂ : C.length < 2 * (θ - lam₂) := lt_of_le_of_lt (hClen W₂ hCs₂) hlen₂ + rw [hCircEq C hC hSub₁ hSub₂ hC₁ hC₂] + · subst hH; subst hK + have hT₁ : IsTangle H₁.toHypergraph (θ - lam₁) T₁ := hComp₁.hasMetric'.1.2.1 + have hT₂ : IsTangle H₁.toHypergraph (θ - lam₂) T₂ := hComp₂.hasMetric'.1.2.1 + have hPre₁ : IsPretangle (PaintingOrDrawing.drawing H₁).toHypergraph (θ - lam₁) T₁ := + ⟨hT₁.one_le, hT₁.isSeparation, hT₁.order_lt, hT₁.axiom1, hT₁.axiom2⟩ + have hPre₂ : IsPretangle (PaintingOrDrawing.drawing H₁).toHypergraph (θ - lam₂) T₂ := + ⟨hT₂.one_le, hT₂.isSeparation, hT₂.order_lt, hT₂.axiom1, hT₂.axiom2⟩ + by_cases hE : H₁.E.Nonempty + · have hf : GM11.RegionFacts (PaintingOrDrawing.drawing H₁) K₁ := + GM11.regionFacts_of_radial ⟨hK₁.1, hK₁.2.1⟩ hS hK₁.2.2 hE + have h63_1 := (GM11.theorem_6_3_of_regionFacts hS hPre₁ hK₁.2.1 hins₁ hf).1 + have h63_2 := (GM11.theorem_6_3_of_regionFacts hS hPre₂ hK₁.2.1 hins₂ hf).1 + rintro ⟨A, B⟩ hAB + have hsep := hT₁.isSeparation hAB + have hord₁ := hT₁.order_lt hAB + have hord₂ : separationOrder A B < θ - lam₂ := by omega + obtain ⟨k, C, hC, hin⟩ := (h63_1 A B hsep hord₁).mp hAB + refine (h63_2 A B hsep hord₂).mpr ⟨k, C, fun i => ?_, fun e he => ?_⟩ + · obtain ⟨hc, hs, hl, hv⟩ := hC i + exact ⟨hc, hs, by omega, hv⟩ + · obtain ⟨i, hi⟩ := hin e he + obtain ⟨hc, hs, hl, _⟩ := hC i + rw [hCircEq (C i) hc hs hs hl (by omega)] at hi + exact ⟨i, hi⟩ + · have hE_empty : H₁.E = ∅ := Set.not_nonempty_iff_eq_empty.mp hE + have hV_le : H₁.V.ncard ≤ 1 := ncard_V_le_one_of_E_empty hS hK₁.1 hE_empty + have hord_le : θ - lam₁ ≤ 1 := hT₁.order_le_ncard_vertexSet.trans hV_le + rintro ⟨A, B⟩ hAB + have hsep := hT₁.isSeparation hAB + have hord0 : separationOrder A B = 0 := by + have := hT₁.order_lt hAB + omega + have hVA_empty : A.vertexSet = ∅ := by + by_contra hne + obtain ⟨x, hxA⟩ := Set.nonempty_iff_ne_empty.mpr hne + have hxV : x ∈ H₁.V := hsep.left_le.vertexSet_subset hxA + have hV_eq : H₁.V = {x} := by + apply Set.Subset.antisymm _ (Set.singleton_subset_iff.mpr hxV) + intro y hy + by_contra hyx + have hxy_ne : x ≠ y := fun h => hyx (h.symm ▸ Set.mem_singleton x) + have h2 : ({x, y} : Set S).ncard = 2 := Set.ncard_pair hxy_ne + have hsub : ({x, y} : Set S) ⊆ H₁.V := by + rintro w (rfl | rfl) + · exact hxV + · exact hy + have := Set.ncard_le_ncard hsub H₁.finite_V + omega + have hVA : A.vertexSet = H₁.V := + Set.Subset.antisymm hsep.left_le.vertexSet_subset (hV_eq ▸ Set.singleton_subset_iff.mpr + hxA) + exact hT₁.axiom3 hAB hVA + have hEA_empty : A.edgeSet = ∅ := + Set.subset_empty_iff.mp (hE_empty ▸ hsep.left_le.edgeSet_subset) + have hVB_eq : B.vertexSet = H₁.V := by + have := hsep.vertexSet_union + rwa [hVA_empty, Set.empty_union] at this + have hord₂ : separationOrder A B < θ - lam₂ := by + have := hT₂.one_le + omega + exact (hT₂.axiom1 hsep hord₂).resolve_right fun hBA => hT₂.axiom3 hBA hVB_eq + +/-- For any tangle `T` of order `θ` in `G`, `GM12.inducedBySubgraph G G θ T = T`. -/ +private theorem inducedBySubgraph_self {α β : Type*} {G : Hypergraph α β} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} (hT : IsTangle G θ T) : + GM12.inducedBySubgraph G G θ T = T := by + ext ⟨A, B⟩ + have h_inter_eq : ∀ {C : Hypergraph α β}, C ≤ G → C ∩ G = C := fun hC => + GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq (inter_le_left hC le_rfl) le_rfl + (Set.inter_eq_left.mpr hC.vertexSet_subset) (Set.inter_eq_left.mpr hC.edgeSet_subset) + constructor + · rintro ⟨hsep, _, hAB⟩ + rwa [h_inter_eq hsep.left_le, h_inter_eq hsep.right_le] at hAB + · intro hAB + have hsep := hT.isSeparation hAB + refine ⟨hsep, hT.order_lt hAB, ?_⟩ + rwa [h_inter_eq hsep.left_le, h_inter_eq hsep.right_le] + +/-- Any two tangle metrics `d₁, d₂` of the same respectful tangle `(H, θ, T)` coincide on `H.A`, +`pointDist`, and `pointAtomDist`. -/ +theorem tangleMetric_eq_of_hasTangleMetric + {S : Type w} [TopologicalSpace S] [T2Space S] + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d₁ d₂ : Set S → Set S → ℕ} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + (hM₁ : HasTangleMetric H θ T d₁) (hM₂ : HasTangleMetric H θ T d₂) : + (∀ a ∈ H.A, ∀ b ∈ H.A, d₁ a b = d₂ a b) ∧ + (∀ σ₁ σ₂ : S, pointDist H d₁ σ₁ σ₂ = pointDist H d₂ σ₁ σ₂) ∧ + (∀ σ : S, ∀ b ∈ H.A, pointAtomDist H d₁ σ b = pointAtomDist H d₂ σ b) := by + have hInd : T = GM12.inducedBySubgraph H.toHypergraph H.toHypergraph θ T := + (inducedBySubgraph_self hM₁.1.2.1).symm + have hle₁₂ := (GraphMinor.GM12.gm15_theorem_7_7.{w} H H θ θ T T d₂ d₁ hS hConn hM₂ + (Drawing.IsSubdrawing.refl H) + hM₁.1.1 le_rfl hM₁).2 rfl hInd + have hle₂₁ := (GraphMinor.GM12.gm15_theorem_7_7.{w} H H θ θ T T d₁ d₂ hS hConn hM₁ + (Drawing.IsSubdrawing.refl H) + hM₂.1.1 le_rfl hM₂).2 rfl hInd + have hA : ∀ a ∈ H.A, ∀ b ∈ H.A, d₁ a b = d₂ a b := fun a ha b hb => + le_antisymm (hle₁₂ a ha b hb a ha b hb Subset.rfl Subset.rfl) + (hle₂₁ a ha b hb a ha b hb Subset.rfl Subset.rfl) + refine ⟨hA, fun σ₁ σ₂ => ?_, fun σ b hb => ?_⟩ + · obtain ⟨a₁, ha₁, hσ₁⟩ := exists_atom_of_point H σ₁ + obtain ⟨a₂, ha₂, hσ₂⟩ := exists_atom_of_point H σ₂ + rw [pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁ hσ₂, + pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁ hσ₂, hA a₁ ha₁ a₂ ha₂] + · obtain ⟨a, ha, hσ⟩ := exists_atom_of_point H σ + rw [pointAtomDist_eq_of_mem_atom ha hσ, pointAtomDist_eq_of_mem_atom ha hσ, hA a ha b hb] + +/-- Given a radial drawing `K` of `H`, a closed walk `W` of `K`, and a 2-cell drawing `H'` such +that every atom of `H` intersecting `U(walkDrawing K W)` is an atom of `H'`, there is a radial +drawing `K'` of `H'` in which `W` is a closed walk (Graph Minors XV, proof of (4.2), page 125: +"Consequently every atom of $H$ which intersects $ins(W)$ is an atom of $H'$, and we may +therefore choose a radial drawing $K'$ of $H'$ such that $W$ is a walk of $K'$"). -/ +theorem exists_radialDrawing_with_walk {S : Type w} [TopologicalSpace S] [T2Space S] + {H H' K : Drawing S} {u : S} (hS : IsClosedSurface S) + (h2cell' : (PaintingOrDrawing.drawing H').IsTwoCell) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (W : GraphWalk K.toGraph u u) + (hAtomsW : ∀ a ∈ H.A, (a ∩ (walkDrawing K W).U).Nonempty → a ∈ H'.A) : + ∃ (K' : Drawing S) (W' : GraphWalk K'.toGraph u u), + (PaintingOrDrawing.drawing H').IsRadialDrawing K' ∧ + walkDrawing K W = walkDrawing K' W' ∧ W'.length = W.length := by + classical + have : ConnectedSpace S := h2cell'.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let L := walkDrawing K W + have hLK : L.IsSubdrawing K := GM11.walkDrawing_isSubdrawing K W + have hrad : GM11.PreRad (PaintingOrDrawing.drawing H) K := ⟨hK.1, hK.2.1⟩ + have hLV_V : ∀ v ∈ L.V, v ∈ H.V → v ∈ H'.V := by + intro v hvL hvH + exact vertex_mem_V_of_mem_A hS hvH + (hAtomsW {v} (Or.inl (Or.inl ⟨v, hvH, rfl⟩)) ⟨v, rfl, L.V_subset_U hvL⟩) + have hLV_R : ∀ w ∈ L.V, w ∉ H.V → ∃ r ∈ H.R, r ∈ H'.R ∧ w ∈ r := by + intro w hwL hwnH + obtain ⟨r, hr, hwr⟩ := hK.2.1.2.2.2.1 w ⟨hLK.1 hwL, hwnH⟩ + have hr' : r ∈ H'.R := + region_mem_R_of_mem_A hS hr (hAtomsW r (Or.inr hr) ⟨w, hwr, L.V_subset_U hwL⟩) + exact ⟨r, hr, hr', hwr⟩ + have hLV_iff : ∀ x ∈ L.V, x ∈ H.V ↔ x ∈ H'.V := by + intro x hxL + refine ⟨hLV_V x hxL, fun hxH' => ?_⟩ + by_contra hxnH + obtain ⟨r, _, hr', hxr⟩ := hLV_R x hxL hxnH + exact region_subset hr' hxr (H'.V_subset_U hxH') + have hLE_props : ∀ e ∈ L.E, + ∃ v ∈ H.V ∩ L.V, ∃ r ∈ H.R ∩ H'.R, ∃ w ∈ r ∩ L.V, + closure e ∩ L.V = {v, w} ∧ closure e ∩ K.V = {v, w} ∧ e ⊆ r := by + intro e heL + obtain ⟨v, hvH, r, hrH, w, hwr, hwK, hcapK, he_sub⟩ := + GM11.spoke_ends hrad hS (hLK.2 heL) + have hcapL : closure e ∩ L.V = {v, w} := by + rw [hLK.closure_inter_V heL, hcapK] + have hvL : v ∈ L.V := by + have : v ∈ closure e ∩ L.V := by rw [hcapL]; simp + exact this.2 + have hwL : w ∈ L.V := by + have : w ∈ closure e ∩ L.V := by rw [hcapL]; simp + exact this.2 + have hrH' : r ∈ H'.R := + region_mem_R_of_mem_A hS hrH (hAtomsW r (Or.inr hrH) ⟨w, hwr, L.V_subset_U hwL⟩) + exact ⟨v, ⟨hvH, hvL⟩, r, ⟨hrH, hrH'⟩, w, ⟨hwr, hwL⟩, hcapL, hcapK, he_sub⟩ + have hRf' : H'.R.Finite := finite_R hS H' + have hne' : ∀ r ∈ H'.R, r.Nonempty := fun _ hr => region_nonempty hr + choose! hub hhub using hne' + let R_rem := {r ∈ H'.R | Disjoint r L.V} + have hR_rem_fin : R_rem.Finite := hRf'.subset fun _ hr => hr.1 + let A : Set S := H'.V ∪ hub '' R_rem + have hA_fin : A.Finite := H'.finite_V.union (hR_rem_fin.image hub) + let P_pts := GM11.pointsDrawing hA_fin + have hP_V : P_pts.V = A := rfl + have hP_U : P_pts.U = A := rfl + have hP_E : P_pts.E = ∅ := GM11.pointsDrawing_E hA_fin + have h_glue : L.U ∩ P_pts.U ⊆ L.V ∩ P_pts.V := by + rintro x ⟨hxLU, hxA⟩ + refine ⟨?_, hxA⟩ + by_contra hxLV + obtain ⟨e, heL, hxe⟩ := L.exists_edge_of_mem hxLU hxLV + obtain ⟨v, _, r₀, ⟨_, hr₀'⟩, w₀, ⟨hw₀r, hw₀L⟩, _, _, he_sub⟩ := hLE_props e heL + have hxr₀ : x ∈ r₀ := he_sub hxe + rcases hxA with hxH' | ⟨r, ⟨hr', hdisj⟩, rfl⟩ + · exact region_subset hr₀' hxr₀ (H'.V_subset_U hxH') + · have hreq : r = r₀ := region_eq_of_mem hr' hr₀' (hhub r hr') hxr₀ + exact disjoint_left.mp (hreq ▸ hdisj) hw₀r hw₀L + let K₀' := L.glue P_pts h_glue + have hK₀'_U : K₀'.U = L.U ∪ A := rfl + have hK₀'_V : K₀'.V = L.V ∪ A := rfl + have hK₀'_E : K₀'.E = L.E := by rw [Drawing.glue_E h_glue, hP_E, union_empty] + have hLK₀' : L.IsSubdrawing K₀' := ⟨subset_union_left, by rw [hK₀'_E]⟩ + have hpre₀ : (PaintingOrDrawing.drawing H').IsPreRadialDrawing K₀' := by + refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ + · apply Subset.antisymm + · rintro x ⟨hxH'U, hxLU | hxA⟩ + · by_cases hxLV : x ∈ L.V + · by_contra hxnH' + have hxnH : x ∉ H.V := fun h => hxnH' ((hLV_iff x hxLV).mp h) + obtain ⟨r, _, hr', hxr⟩ := hLV_R x hxLV hxnH + exact region_subset hr' hxr hxH'U + · obtain ⟨e, heL, hxe⟩ := L.exists_edge_of_mem hxLU hxLV + obtain ⟨_, _, r₀, ⟨_, hr₀'⟩, _, _, _, _, he_sub⟩ := hLE_props e heL + exact (region_subset hr₀' (he_sub hxe) hxH'U).elim + · rcases hxA with hxH'V | ⟨r, ⟨hr', _⟩, rfl⟩ + · exact hxH'V + · exact (region_subset hr' (hhub r hr') hxH'U).elim + · intro x hxH'V + exact ⟨H'.V_subset_U hxH'V, Or.inr (Or.inl hxH'V)⟩ + · intro x hxH'V + exact Or.inr (Or.inl hxH'V) + · intro r hr' + by_cases hdisj : Disjoint r L.V + · refine ⟨hub r, ⟨hhub r hr', Or.inr (Or.inr ⟨r, ⟨hr', hdisj⟩, rfl⟩)⟩, ?_⟩ + rintro w ⟨hwr, hwL | hwH' | ⟨r₁, ⟨hr₁', _⟩, rfl⟩⟩ + · exact (disjoint_left.mp hdisj hwr hwL).elim + · exact (region_subset hr' hwr (H'.V_subset_U hwH')).elim + · rw [region_eq_of_mem hr₁' hr' (hhub r₁ hr₁') hwr] + · obtain ⟨w₀, hw₀r, hw₀L⟩ := not_disjoint_iff.mp hdisj + refine ⟨w₀, ⟨hw₀r, Or.inl hw₀L⟩, ?_⟩ + have hw₀nH' : w₀ ∉ H'.V := fun h => region_subset hr' hw₀r (H'.V_subset_U h) + have hw₀nH : w₀ ∉ H.V := fun h => hw₀nH' ((hLV_iff w₀ hw₀L).mp h) + obtain ⟨r₀, hr₀H, hr₀H', hw₀r₀⟩ := hLV_R w₀ hw₀L hw₀nH + have hr_eq : r = r₀ := region_eq_of_mem hr' hr₀H' hw₀r hw₀r₀ + rintro w ⟨hwr, hwL | hwH' | ⟨r₁, ⟨hr₁', hdisj₁⟩, rfl⟩⟩ + · exact GM11.hub_unique hrad (hr_eq ▸ hr₀H) hw₀r (hLK.1 hw₀L) hwr (hLK.1 hwL) + · exact (region_subset hr' hwr (H'.V_subset_U hwH')).elim + · have hr₁_eq : r₁ = r := region_eq_of_mem hr₁' hr' (hhub r₁ hr₁') hwr + exact (disjoint_left.mp (hr₁_eq ▸ hdisj₁) hw₀r hw₀L).elim + · rintro w ⟨hwL | hwH' | ⟨r, ⟨hr', _⟩, rfl⟩, hwnH'⟩ + · have hwnH : w ∉ H.V := fun h => hwnH' ((hLV_iff w hwL).mp h) + obtain ⟨r, _, hr', hwr⟩ := hLV_R w hwL hwnH + exact ⟨r, hr', hwr⟩ + · exact (hwnH' hwH').elim + · exact ⟨r, hr', hhub r hr'⟩ + · intro e heK₀' + rw [hK₀'_E] at heK₀' + obtain ⟨v, ⟨hvH, hvL⟩, r, ⟨_, hrH'⟩, w, ⟨hwr, hwL⟩, hcapL, _, he_sub⟩ := hLE_props e heK₀' + have hvH' : v ∈ H'.V := hLV_V v hvL hvH + have hwnH' : w ∉ H'.V := fun h => region_subset hrH' hwr (H'.V_subset_U h) + refine ⟨v, hvH', w, ⟨Or.inl hwL, hwnH'⟩, ?_⟩ + rw [← hLK₀'.closure_inter_V heK₀', hcapL] + · intro e heK₀' f hfK₀' hef v hvH' r hrH' w ⟨hwr, hwK₀'⟩ hcape hcapf + rw [hK₀'_E] at heK₀' hfK₀' + rw [← hLK₀'.closure_inter_V heK₀'] at hcape + rw [← hLK₀'.closure_inter_V hfK₀'] at hcapf + have hvL : v ∈ L.V := by + have : v ∈ closure e ∩ L.V := by rw [hcape]; simp + exact this.2 + have hwL : w ∈ L.V := by + have : w ∈ closure e ∩ L.V := by rw [hcape]; simp + exact this.2 + have hvH : v ∈ H.V := (hLV_iff v hvL).mpr hvH' + have hwnH' : w ∉ H'.V := fun h => region_subset hrH' hwr (H'.V_subset_U h) + have hwnH : w ∉ H.V := fun h => hwnH' ((hLV_iff w hwL).mp h) + obtain ⟨r₀, hr₀H, hr₀H', hw_r₀⟩ := hLV_R w hwL hwnH + have hr_eq : r = r₀ := region_eq_of_mem hrH' hr₀H' hwr hw_r₀ + have hcapeK : closure e ∩ K.V = {v, w} := by + rw [← hLK.closure_inter_V heK₀', hcape] + have hcapfK : closure f ∩ K.V = {v, w} := by + rw [← hLK.closure_inter_V hfK₀', hcapf] + exact hK.2.1.2.2.2.2.2 e (hLK.2 heK₀') f (hLK.2 hfK₀') hef v hvH r (hr_eq ▸ hr₀H) + w ⟨hwr, hLK.1 hwL⟩ hcapeK hcapfK + obtain ⟨N, hN⟩ := GM11.exists_spoke_bound_drawing h2cell' hS + let S_nat : Set ℕ := + {n | ∃ K' : Drawing S, (PaintingOrDrawing.drawing H').IsPreRadialDrawing K' ∧ + K₀'.IsSubdrawing K' ∧ K'.E.ncard = n} + have hS_ne : S_nat.Nonempty := ⟨K₀'.E.ncard, K₀', hpre₀, Drawing.IsSubdrawing.refl K₀', rfl⟩ + have hS_bdd : BddAbove S_nat := ⟨N, by rintro _ ⟨K', hpre, _, rfl⟩; exact hN K' hpre⟩ + obtain ⟨K', hpre', hsub₀, hcard⟩ := Nat.sSup_mem hS_ne hS_bdd + have hRad' : (PaintingOrDrawing.drawing H').IsRadialDrawing K' := by + refine ⟨h2cell', hpre', ?_⟩ + rintro K'' hpre'' ⟨hV, hE⟩ + refine ⟨?_, ?_⟩ + · intro w hw + by_cases hwV : w ∈ H'.V + · exact hpre'.2.1 hwV + obtain ⟨r, hr, hwr⟩ := hpre''.2.2.2.1 w ⟨hw, hwV⟩ + obtain ⟨w', ⟨hw'r, hw'⟩, -⟩ := hpre'.2.2.1 r hr + rw [(hpre''.2.2.1 r hr).unique ⟨hwr, hw⟩ ⟨hw'r, hV hw'⟩] + exact hw' + · have hsub₀'' : K₀'.IsSubdrawing K'' := hsub₀.trans ⟨hV, hE⟩ + have hle : K''.E.ncard ≤ K'.E.ncard := by + rw [hcard] + exact le_csSup hS_bdd ⟨K'', hpre'', hsub₀'', rfl⟩ + exact (eq_of_subset_of_ncard_le hE hle K''.finite_edges).ge + have hLK' : L.IsSubdrawing K' := hLK₀'.trans hsub₀ + have hWL_V : ∀ x ∈ W.support, x ∈ L.V := fun x hx => by + rw [GM11.walkDrawing_V]; exact hx + have hWL_E : ∀ e ∈ W.edges, e ∈ L.E := fun e he => by + rw [GM11.walkDrawing_E]; exact he + obtain ⟨W_L, hWL_sup, hWL_ed⟩ := hLK.exists_walk_down W hWL_V hWL_E + obtain ⟨W', hW'_sup, hW'_ed⟩ := hLK'.exists_walk_up W_L + have hWD : walkDrawing K W = walkDrawing K' W' := by + apply Drawing.ext_of_V_E + · rw [GM11.walkDrawing_V, GM11.walkDrawing_V, hW'_sup, hWL_sup] + · rw [GM11.walkDrawing_E, GM11.walkDrawing_E, hW'_ed, hWL_ed] + have hW'_len : W'.length = W.length := by + change W'.edges.length = W.edges.length + rw [hW'_ed, hWL_ed] + exact ⟨K', W', hRad', hWD, hW'_len⟩ + +/-- Statement of Graph Minors XV, (4.2) (page 125): +"Let $H, H'$ be 2-cell drawings in a surface $\Sigma$, and let $Z \subseteq \Sigma$ include every +atom of $H$ which is not in $A(H')$. (Hence $Z$ includes every atom of $H'$ not in $A(H)$.) Let +$\mathcal{T}, \mathcal{T}'$ be respectful tangles in $H, H'$ respectively, such that, for some +$\lambda \ge 0$, one of $\mathcal{T}, \mathcal{T}'$ is a $\lambda$-compression of the other. Then +for +all $x, y \in \Sigma$, if $d(x, y) < d(x, \sigma)$ for all $\sigma \in Z$, and +$d(x, y) < ord(\mathcal{T})$, then $d'(x, y) \le d(x, y)$." -/ +def GM15Theorem42Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + (H H' : Drawing S) (Z : Set S) (θ θ' lam : ℕ) + (T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d d' : Set S → Set S → ℕ) (x y : S), + IsClosedSurface S → ConnectedSpace S → + HasTangleMetric H θ T d → HasTangleMetric H' θ' T' d' → + (∀ a ∈ H.A, a ∉ H'.A → a ⊆ Z) → + (IsLambdaCompression H H' θ lam T T' d d' ∨ IsLambdaCompression H' H θ' lam T' T d' d) → + (∀ σ ∈ Z, pointDist H d x y < pointDist H d x σ) → + pointDist H d x y < θ → + pointDist H' d' x y ≤ pointDist H d x y + +/-- **Graph Minors XV, (4.2)** (page 125): +Distance bound `d'(x, y) ≤ d(x, y)` away from `Z`. +Proved from `(4.1)` (`theorem_4_1_proof`), Graph Minors XII, `(7.7)` (`GM12Theorem77Statement`), and +Graph Minors XIV, `(3.1)` (`GM14.theorem_3_1_proof`). -/ +theorem theorem_4_2_proof + : + GM15Theorem42Statement.{w} := by + intro S _ _ H H' Z θ θ' lam T T' d d' x y + hS hConn hMetric hMetric' hZ hComp hltZ hltθ + obtain ⟨_, K, ins, hK, hins, hd⟩ := id hMetric + obtain ⟨ax, hax, hx_ax⟩ := exists_atom_of_point H x + obtain ⟨ay, hay, hy_ay⟩ := exists_atom_of_point H y + obtain ⟨ax', hax', hx_ax'⟩ := exists_atom_of_point H' x + obtain ⟨ay', hay', hy_ay'⟩ := exists_atom_of_point H' y + have hpt : pointDist H d x y = d ax ay := pointDist_eq_of_mem_atom hax hay hx_ax hy_ay + have hpt' : pointDist H' d' x y = d' ax' ay' := pointDist_eq_of_mem_atom hax' hay' hx_ax' hy_ay' + by_cases hxy : ax = ay + · subst hxy + have h0 : d ax ax = 0 := by rw [hd ax hax ax hax]; simp [tangleMetric] + have hax_mem' : ax ∈ H'.A := by + by_contra hnot + have hsubZ : ax ⊆ Z := hZ ax hax hnot + have hlt_xx := hltZ x (hsubZ hx_ax) + rw [pointDist_eq_of_mem_atom hax hax hx_ax hx_ax] at hlt_xx + omega + have hax_eq : ax' = ax := atom_eq_of_mem hax' hax_mem' hx_ax' hx_ax + have hay_eq : ay' = ax := atom_eq_of_mem hay' hax_mem' hy_ay' hy_ay + obtain ⟨_, K₀', ins₀', _, _, hd₀'⟩ := hMetric' + rw [hpt', hax_eq, hay_eq, hd₀' ax hax_mem' ax hax_mem'] + simp [tangleMetric] + · by_cases hltθ' : pointDist H d x y < θ' + · have htm_lt : tangleMetric H K ins θ ax ay < θ := by + rwa [← hd ax hax ay hay, ← hpt] + obtain ⟨u, W, ax_K, ay_K, hax_K, hay_K, hW_lt, hW_len, hax_sub, hay_sub⟩ := + exists_walk_of_tangleMetric_lt hK.2.1 ins hxy htm_lt + rw [← hd ax hax ay hay, ← hpt] at hW_len + have hAtomsInW : ∀ a ∈ H.A, (a ∩ insWalk ins K W).Nonempty → a ∈ H'.A := by + intro a ha ⟨σ, hσa, hσW⟩ + by_contra hnot + have hσZ : σ ∈ Z := hZ a ha hnot hσa + obtain ⟨a_K, ha_K⟩ := exists_correspondingAtom hK.2.1 ha + have ha_sub : a_K ⊆ insWalk ins K W := + (GM14.theorem_3_1_proof hS hK hins ha_K W hW_lt).mpr ⟨σ, hσa, hσW⟩ + have hle2 := two_mul_tangleMetric_le_of_walk hK.2.1 ins θ hax_K ha_K W hW_lt hax_sub ha_sub + rw [← hd ax hax a ha, ← pointDist_eq_of_mem_atom (d := d) hax ha hx_ax hσa] at hle2 + have hlt_σ := hltZ σ hσZ + omega + have hAtomsW : ∀ a ∈ H.A, (a ∩ (walkDrawing K W).U).Nonempty → a ∈ H'.A := by + intro a ha ⟨σ, hσa, hσU⟩ + exact hAtomsInW a ha ⟨σ, hσa, Or.inl hσU⟩ + obtain ⟨K', W', hK', hWD, hW'_len⟩ := + exists_radialDrawing_with_walk hS hMetric'.1.1 hK W hAtomsW + obtain ⟨ins', hins'⟩ := exists_derivedSlope hMetric'.1 hK'.2.1 + let d'_K' := tangleMetric H' K' ins' θ' + have hM'_K' : HasTangleMetric H' θ' T' d'_K' := + ⟨hMetric'.1, K', ins', hK', hins', fun _ _ _ _ => rfl⟩ + obtain ⟨hd'_eq_A, hd'_eq_pt, _⟩ := + tangleMetric_eq_of_hasTangleMetric hS hConn hMetric' hM'_K' + have hd' : ∀ a ∈ H'.A, ∀ b ∈ H'.A, d' a b = tangleMetric H' K' ins' θ' a b := hd'_eq_A + have hins_eq : insWalk ins K W = insWalk ins' K' W' := by + have hComp0 : IsLambdaCompression H H θ 0 T T d d := + ⟨hMetric.1.2.1.one_le, hMetric, by simpa using hMetric, fun _ _ => by simp⟩ + have hComp0' : IsLambdaCompression H' H' θ' 0 T' T' d' d' := + ⟨hMetric'.1.2.1.one_le, hMetric', by simpa using hMetric', fun _ _ => by simp⟩ + rcases hComp with hC | hC + · have hθ'_eq : θ - lam = θ' := + le_antisymm + ((GM10.subset_iff_truncation hMetric'.1.2.1 hC.hasMetric'.1.2.1).mp subset_rfl).1 + ((GM10.subset_iff_truncation hC.hasMetric'.1.2.1 hMetric'.1.2.1).mp subset_rfl).1 + subst hθ'_eq + exact (theorem_4_1_proof H H H' K K' θ 0 lam T T T' d d d' ins ins' + hS hComp0 hC hK (by simpa using hins) (by simpa using hd) + hK' hins' hd').1 u u W W' hWD (by omega) (by omega) + · have hθ_eq : θ' - lam = θ := + le_antisymm + ((GM10.subset_iff_truncation hMetric.1.2.1 hC.hasMetric'.1.2.1).mp subset_rfl).1 + ((GM10.subset_iff_truncation hC.hasMetric'.1.2.1 hMetric.1.2.1).mp subset_rfl).1 + subst hθ_eq + exact (theorem_4_1_proof H' H H' K K' θ' lam 0 T' T T' d' d d' ins ins' + hS hC hComp0' hK hins hd + hK' (by simpa using hins') (by simpa using hd')).1 u u W W' hWD (by omega) (by omega) + have hx_inW : (ax ∩ insWalk ins K W).Nonempty := + (GM14.theorem_3_1_proof hS hK hins hax_K W hW_lt).mp hax_sub + have hy_inW : (ay ∩ insWalk ins K W).Nonempty := + (GM14.theorem_3_1_proof hS hK hins hay_K W hW_lt).mp hay_sub + have hax_eq : ax' = ax := + atom_eq_of_mem hax' (hAtomsInW ax hax hx_inW) hx_ax' hx_ax + have hay_eq : ay' = ay := + atom_eq_of_mem hay' (hAtomsInW ay hay hy_inW) hy_ay' hy_ay + obtain ⟨ax'_K', hax'_K'⟩ := exists_correspondingAtom hK'.2.1 hax' + obtain ⟨ay'_K', hay'_K'⟩ := exists_correspondingAtom hK'.2.1 hay' + have hW'_lt : W'.length < 2 * θ' := by omega + have hax'_sub : ax'_K' ⊆ insWalk ins' K' W' := + (GM14.theorem_3_1_proof hS hK' hins' hax'_K' W' hW'_lt).mpr (by rwa [hax_eq, ← hins_eq]) + have hay'_sub : ay'_K' ⊆ insWalk ins' K' W' := + (GM14.theorem_3_1_proof hS hK' hins' hay'_K' W' hW'_lt).mpr (by rwa [hay_eq, ← hins_eq]) + have hle2' := two_mul_tangleMetric_le_of_walk hK'.2.1 ins' θ' hax'_K' hay'_K' W' hW'_lt + hax'_sub hay'_sub + rw [← hd' ax' hax' ay' hay', ← hpt'] at hle2' + omega + · obtain ⟨_, K₀', ins₀', _, _, hd₀'⟩ := hMetric' + have hle_θ' : pointDist H' d' x y ≤ θ' := by + rw [hpt', hd₀' ax' hax' ay' hay'] + exact tangleMetric_le_ord H' K₀' ins₀' θ' ax' ay' + omega + +/-- Statement of Graph Minors XV, (4.3) (page 125), with the hypotheses `E(H) ≠ ∅` and "if `z ∈ +E(H)` +then `λ ≥ 2`" that XII (7.11) needs (`GM12Theorem711Statement`). The printed form of XII (7.11) is +false: see the correction to (7.11) in `corrections/GM12.md`. (4.3) is only used in (4.5), (4.6), +(4.7) of XV, where `λ ≥ 2`: "If $H, \Sigma, \mathcal{T}, \theta, d, \lambda, z$ are as above then +$H - z^\lambda$ is 2-cell." -/ +def GM15Theorem43Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + (H : Drawing S) (θ lam : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (z : Set S), + IsClosedSurface S → ConnectedSpace S → + HasTangleMetric H θ T d → H.E.Nonempty → z ∈ H.A → lam < θ → (z ∈ H.E → 2 ≤ lam) → + (PaintingOrDrawing.drawing (deleteAtomNeighborhood H d z lam)).IsTwoCell + +/-- **Graph Minors XII, (4.1)** (`GM12Theorem41Statement`, page 248): +Proved from `GM12.theorem_4_1_proof`. -/ +theorem gm12_theorem_4_1 : GM12Theorem41Statement.{w} := + GM12.theorem_4_1_proof + +/-- **Graph Minors XV, (4.3)** (page 125): +For a 2-cell drawing `H` with `E(H) ≠ ∅` in a connected surface `Σ` with a respectful tangle `T` +of order `θ` with metric `d`, `z ∈ A(H)`, `λ < θ`, and `λ ≥ 2` if `z ∈ E(H)`, the subdrawing +`H - z^λ` is 2-cell. +Proved from Graph Minors XII, (7.11) (`GM12.gm12_theorem_7_11`). -/ +theorem theorem_4_3_proof : GM15Theorem43Statement.{w} := + GM12.gm12_theorem_7_11 + +/-- Statement of Graph Minors XV, (4.4) (page 126): +"Let $\mathcal{T}$ be a respectful tangle of order $\theta$ in a 2-cell drawing $H$ in a surface +$\Sigma$. Let $z \in A(H)$, let $\lambda \ge 2$ be an integer with $\theta > 4\lambda + 2$, and let +$H' \subseteq H$ be a 2-cell subdrawing such that $a \in A(H')$ for every $a \in A(H)$ with +$d(z, a) > \lambda$. Then there is a unique respectful tangle $\mathcal{T}'$ in $H'$ which is a +$(4\lambda + 2)$-compression of $\mathcal{T}$, and it includes $(A \cap H', B \cap H')$ for every +$(A, B) \in \mathcal{T}$ of order $< \theta - 4\lambda - 2$." -/ +def GM15Theorem44Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + (H H' : Drawing S) (θ lam : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (z : Set S), + IsClosedSurface S → ConnectedSpace S → + HasTangleMetric H θ T d → z ∈ H.A → + 2 ≤ lam → 4 * lam + 2 < θ → + H'.IsSubdrawing H → (PaintingOrDrawing.drawing H').IsTwoCell → + (∀ a ∈ H.A, lam < d z a → a ∈ H'.A) → + ∃ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ), + IsLambdaCompression H H' θ (4 * lam + 2) T T' d d' ∧ + (∀ A B : Hypergraph S (Set S), + (A, B) ∈ T → separationOrder A B < θ - (4 * lam + 2) → + (A ∩ H'.toHypergraph, B ∩ H'.toHypergraph) ∈ T') ∧ + (∀ (T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d'' : Set S → Set S → ℕ), + IsLambdaCompression H H' θ (4 * lam + 2) T T'' d d'' → T'' = T') + +/-- **Graph Minors XV, (4.4)** (page 126): +Unique `(4λ + 2)`-compression of `T` in a 2-cell subdrawing `H' ⊆ H` containing all atoms `a ∈ A(H)` +with `d(z, a) > λ`. +Proved from Graph Minors XII, (7.10) (`GM12Theorem710Statement`). -/ +theorem theorem_4_4_proof : + GM15Theorem44Statement.{w} := by + intro S _ _ H H' θ lam T d z hS hConn hMetric hz hlam hθ hSub h2cell hAtoms + have hθ' : 4 * lam + 3 ≤ θ := by omega + have hEdist : ∀ e ∈ H.E \ H'.E, d z e ≤ lam := by + rintro e ⟨heH, henot⟩ + by_contra hnot + have hlt : lam < d z e := Nat.lt_of_not_le hnot + have heA' : e ∈ H'.A := hAtoms e (Or.inl (Or.inr heH)) hlt + exact henot (edge_mem_E_of_mem_A hS heH heA') + obtain ⟨T', d', ⟨hM', hMem', hDist'⟩, hUniq⟩ := + GraphMinor.GM12.gm14_theorem_7_10.{w} S hS hConn H H' θ lam T d z hθ' hMetric hz hSub h2cell + hEdist (fun _ => hlam) + have hSubEq : θ - 4 * lam - 2 = θ - (4 * lam + 2) := by omega + rw [hSubEq] at hM' hMem' hUniq + refine ⟨T', d', ⟨hθ, hMetric, hM', fun σ₁ σ₂ => ?_⟩, hMem', fun T'' d'' hComp'' => ?_⟩ + · obtain ⟨a₁, ha₁, hσ₁⟩ := exists_atom_of_point H σ₁ + obtain ⟨a₂, ha₂, hσ₂⟩ := exists_atom_of_point H σ₂ + obtain ⟨a₁', ha₁', hσ₁'⟩ := exists_atom_of_point H' σ₁ + obtain ⟨a₂', ha₂', hσ₂'⟩ := exists_atom_of_point H' σ₂ + rw [pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁ hσ₂, pointDist_eq_of_mem_atom ha₁' ha₂' hσ₁' hσ₂'] + have hsub₁ := atom_subset_of_isSubdrawing hSub ha₁ ha₁' hσ₁ hσ₁' + have hsub₂ := atom_subset_of_isSubdrawing hSub ha₂ ha₂' hσ₂ hσ₂' + have hle := (hDist' a₁ ha₁ a₂ ha₂ a₁' ha₁' a₂' ha₂' hsub₁ hsub₂).1 + omega + · refine hUniq T'' d'' hComp''.hasMetric' (fun a ha b hb a' ha' b' hb' hsub₁ hsub₂ => ?_) + obtain ⟨σ₁, hσ₁⟩ := atom_nonempty ha + obtain ⟨σ₂, hσ₂⟩ := atom_nonempty hb + have hσ₁' : σ₁ ∈ a' := hsub₁ hσ₁ + have hσ₂' : σ₂ ∈ b' := hsub₂ hσ₂ + have hle := hComp''.dist_le σ₁ σ₂ + rw [pointDist_eq_of_mem_atom ha hb hσ₁ hσ₂, pointDist_eq_of_mem_atom ha' hb' hσ₁' hσ₂'] at hle + omega + +/-- If `G' ≤ G` and `(A, B)` is a separation of `G`, then `(A ∩ G', B ∩ G')` is a separation of `G'` +of order at most `separationOrder A B`. -/ +theorem isSeparation_inter_subhypergraph {α β : Type*} {G G' A B : Hypergraph α β} + (hSub : G' ≤ G) (hsep : G.IsSeparation A B) : + G'.IsSeparation (A ∩ G') (B ∩ G') ∧ + separationOrder (A ∩ G') (B ∩ G') ≤ separationOrder A B := by + have hAl : A ∩ G' ≤ G' := inter_le_right hsep.left_le hSub + have hBl : B ∩ G' ≤ G' := inter_le_right hsep.right_le hSub + refine ⟨(isSeparation_iff_of_le hAl hBl).mpr ⟨?_, ?_, ?_⟩, ?_⟩ + · change (A.vertexSet ∩ G'.vertexSet) ∪ (B.vertexSet ∩ G'.vertexSet) = G'.vertexSet + rw [← Set.union_inter_distrib_right, hsep.vertexSet_union, + Set.inter_eq_right.mpr hSub.vertexSet_subset] + · change (A.edgeSet ∩ G'.edgeSet) ∪ (B.edgeSet ∩ G'.edgeSet) = G'.edgeSet + rw [← Set.union_inter_distrib_right, hsep.edgeSet_union, + Set.inter_eq_right.mpr hSub.edgeSet_subset] + · ext e + change e ∈ (A.edgeSet ∩ G'.edgeSet) ∩ (B.edgeSet ∩ G'.edgeSet) ↔ e ∈ (∅ : Set β) + simp only [Set.mem_inter_iff, Set.mem_empty_iff_false, iff_false] + rintro ⟨⟨heA, _⟩, ⟨heB, _⟩⟩ + exact hsep.notMem_edgeSet_right heA heB + · refine Set.ncard_le_ncard (fun x hx => ⟨hx.1.1, hx.2.1⟩) ?_ + exact (G.vertexSet_finite.subset hsep.left_le.vertexSet_subset).subset Set.inter_subset_left + +/-- If `G' ≤ G` and `T'` is a tangle of order `θ` in `G'`, then `inducedBySubgraph G G' θ T'` is a +tangle of order `θ` in `G` (Graph Minors XII, Section 4, page 248). -/ +theorem isTangle_inducedBySubgraph {α β : Type*} {G G' : Hypergraph α β} {θ : ℕ} + {T' : Set (Hypergraph α β × Hypergraph α β)} + (hSub : G' ≤ G) (hT' : IsTangle G' θ T') : + IsTangle G θ (GM12.inducedBySubgraph G G' θ T') where + one_le := hT'.one_le + isSeparation _ _ h := h.1 + order_lt _ _ h := h.2.1 + axiom1 {A B} hsep hord := by + obtain ⟨hsep', hle⟩ := isSeparation_inter_subhypergraph hSub hsep + have hord' : separationOrder (A ∩ G') (B ∩ G') < θ := lt_of_le_of_lt hle hord + rcases hT'.axiom1 hsep' hord' with h1 | h2 + · exact Or.inl ⟨hsep, hord, h1⟩ + · exact Or.inr ⟨hsep.symm, by rwa [separationOrder_comm], h2⟩ + axiom2 {A₁ B₁ A₂ B₂ A₃ B₃} h1 h2 h3 hcov := by + apply hT'.axiom2 h1.2.2 h2.2.2 h3.2.2 + have hle1 : A₁ ∩ G' ≤ G' := inter_le_right h1.1.left_le hSub + have hle2 : A₂ ∩ G' ≤ G' := inter_le_right h2.1.left_le hSub + have hle3 : A₃ ∩ G' ≤ G' := inter_le_right h3.1.left_le hSub + have hleU : (A₁ ∩ G') ∪ (A₂ ∩ G') ∪ (A₃ ∩ G') ≤ G' := + union_le (union_le hle1 hle2) hle3 + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hleU le_rfl ?_ ?_ + · ext x + change (x ∈ (A₁.vertexSet ∩ G'.vertexSet) ∪ (A₂.vertexSet ∩ G'.vertexSet) ∪ + (A₃.vertexSet ∩ G'.vertexSet)) ↔ x ∈ G'.vertexSet + have hV : A₁.vertexSet ∪ A₂.vertexSet ∪ A₃.vertexSet = G.vertexSet := + congrArg Hypergraph.vertexSet hcov + constructor + · rintro ((⟨_, hx⟩ | ⟨_, hx⟩) | ⟨_, hx⟩) <;> exact hx + · intro hx + have hxG : x ∈ A₁.vertexSet ∪ A₂.vertexSet ∪ A₃.vertexSet := + hV.symm ▸ hSub.vertexSet_subset hx + rcases hxG with (hx1 | hx2) | hx3 + · exact Or.inl (Or.inl ⟨hx1, hx⟩) + · exact Or.inl (Or.inr ⟨hx2, hx⟩) + · exact Or.inr ⟨hx3, hx⟩ + · ext e + change (e ∈ (A₁.edgeSet ∩ G'.edgeSet) ∪ (A₂.edgeSet ∩ G'.edgeSet) ∪ + (A₃.edgeSet ∩ G'.edgeSet)) ↔ e ∈ G'.edgeSet + have hE : A₁.edgeSet ∪ A₂.edgeSet ∪ A₃.edgeSet = G.edgeSet := + congrArg Hypergraph.edgeSet hcov + constructor + · rintro ((⟨_, he⟩ | ⟨_, he⟩) | ⟨_, he⟩) <;> exact he + · intro he + have heG : e ∈ A₁.edgeSet ∪ A₂.edgeSet ∪ A₃.edgeSet := + hE.symm ▸ hSub.edgeSet_subset he + rcases heG with (he1 | he2) | he3 + · exact Or.inl (Or.inl ⟨he1, he⟩) + · exact Or.inl (Or.inr ⟨he2, he⟩) + · exact Or.inr ⟨he3, he⟩ + axiom3 {A B} hAB hV := by + apply hT'.axiom3 hAB.2.2 + change A.vertexSet ∩ G'.vertexSet = G'.vertexSet + rw [hV, Set.inter_eq_right.mpr hSub.vertexSet_subset] + +/-- If `H₀` is a subdrawing of `H'` and `T₀` is a respectful tangle of order `θ'` in `H₀`, then +`inducedBySubgraph H'.toHypergraph H₀.toHypergraph θ' T₀` is respectful in `H'`. -/ +private theorem isRespectful_inducedBySubgraph {S : Type w} [TopologicalSpace S] [T2Space S] + {H₀ H' : Drawing S} {θ' : ℕ} + {T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hSub : H₀.IsSubdrawing H') + (hResp₀ : (PaintingOrDrawing.drawing H₀).IsRespectful θ' T₀) : + (PaintingOrDrawing.drawing H').IsRespectful θ' + (GM12.inducedBySubgraph H'.toHypergraph H₀.toHypergraph θ' T₀) := by + exact GM12.isRespectful_inducedBySubgraph hSub hResp₀ + +/-- For `H₀ = H.span ∅ E'` with `H₀.IsSubdrawing H'` and `IsTangle H₀.toHypergraph θ' T₀`, the +edge-based `GM10.inducedTangle` coincides with `GM12.inducedBySubgraph`. -/ +theorem inducedTangle_eq_inducedBySubgraph_of_span_empty + {S : Type w} [TopologicalSpace S] [T2Space S] + {H H₀ H' : Drawing S} {E' : Set (Set S)} {θ' : ℕ} + {T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hH₀ : H₀ = H.span ∅ E') (hSub : H₀.IsSubdrawing H') + (hT₀ : IsTangle H₀.toHypergraph θ' T₀) : + GM10.inducedTangle H'.toHypergraph H₀.toHypergraph T₀ θ' = + GM12.inducedBySubgraph H'.toHypergraph H₀.toHypergraph θ' T₀ := by + have hSubHyp : H₀.toHypergraph ≤ H'.toHypergraph := by + refine ⟨hSub.1, hSub.2, fun e he₀ => ?_⟩ + ext v + change (e ∈ H'.E ∧ v ∈ H'.V ∧ v ∈ closure e) ↔ (e ∈ H₀.E ∧ v ∈ H₀.V ∧ v ∈ closure e) + constructor + · rintro ⟨_, hv', hve⟩ + refine ⟨he₀, ?_, hve⟩ + have hv_in : v ∈ closure e ∩ H'.V := ⟨hve, hv'⟩ + rw [← hSub.closure_inter_V he₀] at hv_in + exact hv_in.2 + · rintro ⟨_, hv₀, hve⟩ + exact ⟨hSub.2 he₀, hSub.1 hv₀, hve⟩ + ext ⟨A, B⟩ + constructor + · rintro ⟨hsep, hord, ⟨C, D⟩, hCD, hCE⟩ + change H'.toHypergraph.IsSeparation A B at hsep + change separationOrder A B < θ' at hord + change C.edgeSet = A.edgeSet ∩ H₀.E at hCE + refine ⟨hsep, hord, ?_⟩ + obtain ⟨hsep₀, hle₀⟩ := isSeparation_inter_subhypergraph hSubHyp hsep + have hord₀ : separationOrder (A ∩ H₀.toHypergraph) (B ∩ H₀.toHypergraph) < θ' := + lt_of_le_of_lt hle₀ hord + by_cases hθ2 : 2 ≤ θ' + · exact GM10.theorem_2_9_proof hT₀ hCD hsep₀ hord₀ + (Or.inr (Or.inr ⟨hθ2, subset_of_eq hCE.symm⟩)) + · refine GM10.theorem_2_9_proof hT₀ hCD hsep₀ hord₀ (Or.inr (Or.inl ?_)) + rintro v ⟨hvA, hv₀⟩ + have hv_span : v ∈ (H.span ∅ E').V := hH₀ ▸ hv₀ + rcases hv_span with ⟨h, _⟩ | hv_edges + · exact False.elim h + · obtain ⟨e, he_mem, hve_cl, hvH⟩ := mem_iUnion₂.mp hv_edges + have he₀ : e ∈ H₀.E := by rw [hH₀, H.span_E]; exact he_mem + have he' : e ∈ H'.E := hSub.2 he₀ + have hinc' : H'.toHypergraph.Inc e v := ⟨he', hSub.1 hv₀, hve_cl⟩ + have he_not_B : e ∉ B.edgeSet := by + intro heB + have hvB_ends : v ∈ B.ends e := by + rw [← hsep.right_le.ends_eq e heB] + exact hinc' + have hvB : v ∈ B.vertexSet := B.vertex_mem_of_inc hvB_ends + have hmem_inter : v ∈ (A ∩ B).vertexSet := ⟨hvA, hvB⟩ + have hpos : 0 < separationOrder A B := + (Set.ncard_pos ((H'.finite_V.subset hsep.left_le.vertexSet_subset).subset + Set.inter_subset_left)).mpr ⟨v, hmem_inter⟩ + have := hT₀.one_le + omega + have heA : e ∈ A.edgeSet := by + have he_union : e ∈ A.edgeSet ∪ B.edgeSet := hsep.edgeSet_union.symm ▸ he' + exact he_union.resolve_right he_not_B + have heC : e ∈ C.edgeSet := by + rw [hCE] + exact ⟨heA, he₀⟩ + have hinc₀ : H₀.toHypergraph.Inc e v := ⟨he₀, hv₀, hve_cl⟩ + have hvC_ends : v ∈ C.ends e := by + rw [← (hT₀.isSeparation hCD).left_le.ends_eq e heC] + exact hinc₀ + exact C.vertex_mem_of_inc hvC_ends + · rintro ⟨hsep, hord, hmem₀⟩ + exact ⟨hsep, hord, (A ∩ H₀.toHypergraph, B ∩ H₀.toHypergraph), hmem₀, rfl⟩ + +/-- Statement of Graph Minors XV, (4.5) (page 126): +"Let $\mathcal{T}$ be a respectful tangle of order $\theta$ in a 2-cell drawing $H$ in a surface +$\Sigma$. Let $z \in A(H)$, let $\lambda \ge 2$ be an integer with $\theta > 4\lambda + 2$, and let +$H'$ be a 2-cell drawing in $\Sigma$ such that $a \in A(H')$ for every $a \in A(H)$ with +$d(z, a) > \lambda$. Then +(i) there is a unique $(4\lambda + 2)$-compression $\mathcal{T}'$ of $\mathcal{T}$ in $H'$ +(ii) $H - z^\lambda \subseteq H'$, and $\mathcal{T}'$ is the tangle induced in $H'$ from the unique +$(4\lambda + 2)$-compression of $\mathcal{T}$ in $H - z^\lambda$ +(iii) if $H' \subseteq H$ then $(A \cap H', B \cap H') \in \mathcal{T}'$ for every +$(A, B) \in \mathcal{T}$ of order $< \theta - 4\lambda - 2$." -/ +def GM15Theorem45Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + (H H' : Drawing S) (θ lam : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (z : Set S), + IsClosedSurface S → ConnectedSpace S → + HasTangleMetric H θ T d → z ∈ H.A → + 2 ≤ lam → 4 * lam + 2 < θ → + (PaintingOrDrawing.drawing H').IsTwoCell → + (∀ a ∈ H.A, lam < d z a → a ∈ H'.A) → + (deleteAtomNeighborhood H d z lam).IsSubdrawing H' ∧ + ∃ (T₀ T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ d' : Set S → Set S → ℕ), + IsLambdaCompression H (deleteAtomNeighborhood H d z lam) θ (4 * lam + 2) T T₀ d d₀ ∧ + IsLambdaCompression H H' θ (4 * lam + 2) T T' d d' ∧ + T' = GM10.inducedTangle H'.toHypergraph (deleteAtomNeighborhood H d z lam).toHypergraph + T₀ (θ - (4 * lam + 2)) ∧ + (∀ (T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d'' : Set S → Set S → ℕ), + IsLambdaCompression H H' θ (4 * lam + 2) T T'' d d'' → T'' = T') + +/-- **Graph Minors XV, (4.5)** (page 126): +Existence and uniqueness of the `(4λ + 2)`-compression `T'` of `T` in `H'`, with `H - z^λ ⊆ H'` and +`T'` induced in `H'` from the `(4λ + 2)`-compression `T₀` of `T` in `H - z^λ`. +Proved from `(4.1)`, `(4.3)`, Graph Minors XII, `(7.7)`, `(7.10)`, and `(7.11)`. -/ +theorem theorem_4_5_proof + : + GM15Theorem45Statement.{w} := by + intro S _ _ H H' θ lam T d z hS hConn hMetric hz hlam hθ h2cell' hAtoms + let H₀ := deleteAtomNeighborhood H d z lam + have hE_ne : H.E.Nonempty := by + by_contra hE + have hV_le := ncard_V_le_one_of_E_empty hS hMetric.1.1 (Set.not_nonempty_iff_eq_empty.mp hE) + have hord_le : θ ≤ H.V.ncard := hMetric.1.2.1.order_le_ncard_vertexSet + omega + have hH₀_eq : H₀ = H.span ∅ {e ∈ H.E | lam < d z e} := by + change deleteAtomNeighborhood H d z lam = _ + rw [deleteAtomNeighborhood, ite_eq_right_iff.mpr fun h => False.elim (hE_ne.ne_empty h)] + have hSubH₀H : H₀.IsSubdrawing H := by + rw [hH₀_eq] + exact H.span_isSubdrawing _ _ + have h2cell₀ : (PaintingOrDrawing.drawing H₀).IsTwoCell := + theorem_4_3_proof H θ lam T d z hS hConn hMetric + hE_ne hz (by omega) (fun _ => hlam) + have hSubH₀H' : H₀.IsSubdrawing H' := by + refine ⟨?_, ?_⟩ + · intro v hv₀ + rw [hH₀_eq] at hv₀ + rcases hv₀ with ⟨h, _⟩ | hv_edges + · exact False.elim h + · obtain ⟨e, ⟨⟨heH, hlt⟩, _⟩, hve_cl, hvH⟩ := mem_iUnion₂.mp hv_edges + have he' : e ∈ H'.E := + edge_mem_E_of_mem_A hS heH (hAtoms e (Or.inl (Or.inr heH)) hlt) + have hv_not_e : v ∉ e := fun hve => (heH.2.1 hve).2 hvH + have hcl' : closure e \ H'.V = e := H'.closure_diff_V he' + by_contra hv' + exact hv_not_e (hcl' ▸ ⟨hve_cl, hv'⟩) + · intro e he₀ + rw [hH₀_eq, H.span_E] at he₀ + exact edge_mem_E_of_mem_A hS he₀.1.1 (hAtoms e (Or.inl (Or.inr he₀.1.1)) he₀.1.2) + have hEdist₀ : ∀ e ∈ H.E \ H₀.E, d z e ≤ lam := by + rintro e ⟨heH, henot⟩ + rw [hH₀_eq, H.span_E] at henot + have : ¬ lam < d z e := fun hlt => henot ⟨⟨heH, hlt⟩, heH⟩ + omega + obtain ⟨T₀, d₀, ⟨hM₀, hMem₀, hDist₀⟩, _⟩ := + GraphMinor.GM12.gm14_theorem_7_10.{w} S hS hConn H H₀ θ lam T d z + (by omega) hMetric hz hSubH₀H h2cell₀ hEdist₀ (fun _ => hlam) + have hSubEq : θ - 4 * lam - 2 = θ - (4 * lam + 2) := by omega + rw [hSubEq] at hM₀ hMem₀ + have hComp₀ : IsLambdaCompression H H₀ θ (4 * lam + 2) T T₀ d d₀ := by + refine ⟨hθ, hMetric, hM₀, fun σ₁ σ₂ => ?_⟩ + obtain ⟨a₁, ha₁, hσ₁⟩ := exists_atom_of_point H σ₁ + obtain ⟨a₂, ha₂, hσ₂⟩ := exists_atom_of_point H σ₂ + obtain ⟨a₁', ha₁', hσ₁'⟩ := exists_atom_of_point H₀ σ₁ + obtain ⟨a₂', ha₂', hσ₂'⟩ := exists_atom_of_point H₀ σ₂ + rw [pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁ hσ₂, pointDist_eq_of_mem_atom ha₁' ha₂' hσ₁' hσ₂'] + have hsub₁ := atom_subset_of_isSubdrawing hSubH₀H ha₁ ha₁' hσ₁ hσ₁' + have hsub₂ := atom_subset_of_isSubdrawing hSubH₀H ha₂ ha₂' hσ₂ hσ₂' + have hle := (hDist₀ a₁ ha₁ a₂ ha₂ a₁' ha₁' a₂' ha₂' hsub₁ hsub₂).1 + omega + let θ' := θ - (4 * lam + 2) + let T' := GM12.inducedBySubgraph H'.toHypergraph H₀.toHypergraph θ' T₀ + have hSubHyp : H₀.toHypergraph ≤ H'.toHypergraph := by + refine ⟨hSubH₀H'.1, hSubH₀H'.2, fun e he₀ => ?_⟩ + ext v + change (e ∈ H'.E ∧ v ∈ H'.V ∧ v ∈ closure e) ↔ (e ∈ H₀.E ∧ v ∈ H₀.V ∧ v ∈ closure e) + constructor + · rintro ⟨_, hv', hve⟩ + refine ⟨he₀, ?_, hve⟩ + have hv_in : v ∈ closure e ∩ H'.V := ⟨hve, hv'⟩ + rw [← hSubH₀H'.closure_inter_V he₀] at hv_in + exact hv_in.2 + · rintro ⟨_, hv₀, hve⟩ + exact ⟨hSubH₀H'.2 he₀, hSubH₀H'.1 hv₀, hve⟩ + have hT' : IsTangle H'.toHypergraph θ' T' := + isTangle_inducedBySubgraph hSubHyp hM₀.1.2.1 + have hResp' : (PaintingOrDrawing.drawing H').IsRespectful θ' T' := + isRespectful_inducedBySubgraph hSubH₀H' hM₀.1.2.2 + have hRDT' : IsRespectfulDrawingTangle H' θ' T' := + ⟨h2cell', hT', hResp'⟩ + obtain ⟨d', hM'⟩ := exists_hasTangleMetric hS hRDT' + have hComp_of_metric : ∀ d'_any : Set S → Set S → ℕ, + HasTangleMetric H' θ' T' d'_any → + IsLambdaCompression H H' θ (4 * lam + 2) T T' d d'_any := by + intro d'_any hM'_any + have h77_ii := (GraphMinor.GM12.gm15_theorem_7_7.{w} H' H₀ θ' θ' T' T₀ d'_any d₀ hS hConn + hM'_any hSubH₀H' h2cell₀ le_rfl hM₀).2 + rfl rfl + refine ⟨hθ, hMetric, hM'_any, fun σ₁ σ₂ => ?_⟩ + obtain ⟨a₁', ha₁', hσ₁'⟩ := exists_atom_of_point H' σ₁ + obtain ⟨a₂', ha₂', hσ₂'⟩ := exists_atom_of_point H' σ₂ + obtain ⟨a₁₀, ha₁₀, hσ₁₀⟩ := exists_atom_of_point H₀ σ₁ + obtain ⟨a₂₀, ha₂₀, hσ₂₀⟩ := exists_atom_of_point H₀ σ₂ + have hsub₁ := atom_subset_of_isSubdrawing hSubH₀H' ha₁' ha₁₀ hσ₁' hσ₁₀ + have hsub₂ := atom_subset_of_isSubdrawing hSubH₀H' ha₂' ha₂₀ hσ₂' hσ₂₀ + have hle_0_any := h77_ii a₁' ha₁' a₂' ha₂' a₁₀ ha₁₀ a₂₀ ha₂₀ hsub₁ hsub₂ + have hle_H_0 := hComp₀.dist_le σ₁ σ₂ + rw [pointDist_eq_of_mem_atom (d := d₀) ha₁₀ ha₂₀ hσ₁₀ hσ₂₀] at hle_H_0 + rw [pointDist_eq_of_mem_atom (d := d'_any) ha₁' ha₂' hσ₁' hσ₂'] + omega + have hComp' : IsLambdaCompression H H' θ (4 * lam + 2) T T' d d' := hComp_of_metric d' hM' + have hIndEq : T' = GM10.inducedTangle H'.toHypergraph H₀.toHypergraph T₀ θ' := + (inducedTangle_eq_inducedBySubgraph_of_span_empty hH₀_eq hSubH₀H' hM₀.1.2.1).symm + refine ⟨hSubH₀H', T₀, T', d₀, d', hComp₀, hComp', hIndEq, fun T'' d'' hComp'' => ?_⟩ + obtain ⟨K'', ins'', hK'', hins'', hd''⟩ := hComp''.hasMetric'.2 + obtain ⟨ins'_K'', hins'_K''⟩ := exists_derivedSlope hRDT' hK''.2.1 + let d'_K'' := tangleMetric H' K'' ins'_K'' θ' + have hM'_K'' : HasTangleMetric H' θ' T' d'_K'' := + ⟨hRDT', K'', ins'_K'', hK'', hins'_K'', fun _ _ _ _ => rfl⟩ + have hComp'_K'' := hComp_of_metric d'_K'' hM'_K'' + have hsub1 : T'' ⊆ T' := + (theorem_4_1_proof H H' H' K'' K'' θ (4 * lam + 2) (4 * lam + 2) T T'' T' d d'' d'_K'' + ins'' ins'_K'' hS hComp'' hComp'_K'' hK'' hins'' hd'' hK'' hins'_K'' (fun _ _ _ _ => rfl)).2 + rfl rfl le_rfl + have hsub2 : T' ⊆ T'' := + (theorem_4_1_proof H H' H' K'' K'' θ (4 * lam + 2) (4 * lam + 2) T T' T'' d d'_K'' d'' + ins'_K'' ins'' hS hComp'_K'' hComp'' hK'' hins'_K'' (fun _ _ _ _ => rfl) hK'' hins'' hd'').2 + rfl rfl le_rfl + exact Set.Subset.antisymm hsub1 hsub2 + +private theorem restrictedSeparation_props {S : Type w} [TopologicalSpace S] {α : Type u} {β : Type + v} + {G : Graph α β} + {H : Drawing S} {η : SpanEmbedding H G} + {A B : Hypergraph α β} {A_H B_H : Hypergraph S (Set S)} + (hRestr : IsRestrictedSeparation H G η A B A_H B_H) : + (∀ e ∈ H.E, e ∈ A_H.edgeSet ↔ η.eMap e ∈ A.edgeSet) ∧ + separationOrder A_H B_H ≤ separationOrder A B ∧ + IsRestrictedSeparation H G η B A B_H A_H := by + refine ⟨fun e heH => ⟨fun heA => ?_, fun heA => ?_⟩, ?_, + ⟨hRestr.1.symm, hRestr.2.2.2.1, hRestr.2.2.2.2, hRestr.2.1, hRestr.2.2.1⟩⟩ + · have hmem : η.eMap e ∈ η.eMap '' A_H.edgeSet := ⟨e, heA, rfl⟩ + rw [hRestr.2.2.1] at hmem + exact hmem.1 + · have hmem : η.eMap e ∈ A.edgeSet ∩ E(η.imageGraph) := ⟨heA, η.bijOn_e.mapsTo heH⟩ + rw [← hRestr.2.2.1] at hmem + obtain ⟨e', he'A, heq⟩ := hmem + have he'H : e' ∈ H.E := hRestr.1.left_le.edgeSet_subset he'A + have : e' = e := η.bijOn_e.injOn he'H heH heq + exact this ▸ he'A + · have hsub_img : η.vMap '' (A_H ∩ B_H).vertexSet ⊆ (A ∩ B).vertexSet := by + rintro x ⟨v, ⟨hvA, hvB⟩, rfl⟩ + have h1 : η.vMap v ∈ η.vMap '' A_H.vertexSet := ⟨v, hvA, rfl⟩ + have h2 : η.vMap v ∈ η.vMap '' B_H.vertexSet := ⟨v, hvB, rfl⟩ + rw [hRestr.2.1] at h1 + rw [hRestr.2.2.2.1] at h2 + exact ⟨h1.1, h2.1⟩ + have hinj : InjOn η.vMap (A_H ∩ B_H).vertexSet := + η.bijOn_v.injOn.mono fun v ⟨hvA, _⟩ => hRestr.1.left_le.vertexSet_subset hvA + calc separationOrder A_H B_H + _ = (η.vMap '' (A_H ∩ B_H).vertexSet).ncard := (hinj.ncard_image).symm + _ ≤ separationOrder A B := Set.ncard_le_ncard hsub_img (A ∩ B).vertexSet_finite + +/-- Statement of Graph Minors XV, (4.6) (page 126): +"Let $\mathcal{T}, \theta, H, \Sigma, z, \lambda, H', \mathcal{T}'$ be as in (4.5). Let +$\mathcal{T}^*$ be a tangle in a graph $G$, and let $H, \eta, \mathcal{T}$ be a $\Sigma$-span in $G$ +with respect to $\mathcal{T}^*$. Let $H'$ be rigid, and let $\eta'$ be an isomorphism from $H'$ to a +subgraph of $G$, such that $\eta'(x) = \eta(x)$ for every vertex or edge $x$ of $H$ with +$d(z, x) > \lambda$. Then $H', \eta', \mathcal{T}'$ is a $\Sigma$-span of order +$\theta - 4\lambda - 2$, obtained from $H, \eta, \mathcal{T}$ by rearranging within $\lambda$ of +$z$." -/ +def GM15Theorem46Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H H' : Drawing S) (η : SpanEmbedding H G) (η' : SpanEmbedding H' G) + (θ_star θ lam : ℕ) (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d d' : Set S → Set S → ℕ) (z : Set S), + IsSigmaSpan G H η θ_star θ T_star T → + HasTangleMetric H θ T d → + z ∈ H.A → 2 ≤ lam → 4 * lam + 2 < θ → + IsRigid H' → (PaintingOrDrawing.drawing H').IsTwoCell → + (∀ a ∈ H.A, lam < d z a → a ∈ H'.A) → + (∀ v ∈ H.V, lam < d z {v} → v ∈ H'.V ∧ η'.vMap v = η.vMap v) → + (∀ e ∈ H.E, lam < d z e → e ∈ H'.E ∧ η'.eMap e = η.eMap e) → + IsLambdaCompression H H' θ (4 * lam + 2) T T' d d' → + IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z + +/-- **Graph Minors XV, (4.6)** (page 126): +If `H, η, T` is a `Σ`-span in `G` with respect to `T*`, `H'` is a rigid 2-cell drawing containing +all atoms `a ∈ A(H)` with `d(z, a) > λ`, `η'` agrees with `η` on vertices and edges with distance +`> λ` from `z`, and `T'` is a `(4λ + 2)`-compression of `T` in `H'`, then `H', η', T'` is a `Σ`-span +obtained from `H, η, T` by rearranging within `λ` of `z`. +Proved from `(4.5)` and Graph Minors XII, `(7.7)`, `(7.10)`, and `(7.11)`. -/ +theorem theorem_4_6_proof + : + GM15Theorem46Statement.{u, v, w} := by + intro S _ _ α β G H H' η η' θ_star θ lam T_star T T' d d' z + hSpan hMetric hz hlam hθ hRigid' h2cell' hAtoms hV hE hComp + have hS : IsClosedSurface S := + ⟨hSpan.isSurface.1, hSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hSpan.isConnected + let H₀ := deleteAtomNeighborhood H d z lam + have hE_ne : H.E.Nonempty := by + by_contra hE_emp + have hV_le := ncard_V_le_one_of_E_empty hS hMetric.1.1 (Set.not_nonempty_iff_eq_empty.mp hE_emp) + have hord_le : θ ≤ H.V.ncard := hMetric.1.2.1.order_le_ncard_vertexSet + omega + have hH₀_eq : H₀ = H.span ∅ {e ∈ H.E | lam < d z e} := by + change deleteAtomNeighborhood H d z lam = _ + rw [deleteAtomNeighborhood, ite_eq_right_iff.mpr fun h => False.elim (hE_ne.ne_empty h)] + have hSubH₀H : H₀.IsSubdrawing H := hH₀_eq ▸ H.span_isSubdrawing _ _ + have h2cell₀ : (PaintingOrDrawing.drawing H₀).IsTwoCell := + theorem_4_3_proof H θ lam T d z hS hConn hMetric + hE_ne hz (by omega) (fun _ => hlam) + have hEdist₀ : ∀ e ∈ H.E \ H₀.E, d z e ≤ lam := by + rintro e ⟨heH, henot⟩ + rw [hH₀_eq, H.span_E] at henot + have : ¬ lam < d z e := fun hlt => henot ⟨⟨heH, hlt⟩, heH⟩ + omega + obtain ⟨T₀_710, d₀_710, ⟨hM₀_710, hMem₀_710, hDist₀_710⟩, hUniq₀_710⟩ := + GraphMinor.GM12.gm14_theorem_7_10.{w} S hS hConn H H₀ θ lam T d z + (by omega) hMetric hz hSubH₀H h2cell₀ hEdist₀ (fun _ => hlam) + have hSubEq : θ - 4 * lam - 2 = θ - (4 * lam + 2) := by omega + rw [hSubEq] at hM₀_710 hMem₀_710 hUniq₀_710 + obtain ⟨hSubH₀H', T₀, T'_45, d₀, d'_45, hComp₀, hComp'_45, hIndEq, hUniq'⟩ := + theorem_4_5_proof H H' θ lam T d z hS hConn hMetric hz hlam hθ h2cell' hAtoms + have hT₀_eq : T₀ = T₀_710 := by + refine hUniq₀_710 T₀ d₀ hComp₀.hasMetric' (fun a ha b hb a' ha' b' hb' hsub₁ hsub₂ => ?_) + obtain ⟨σ₁, hσ₁⟩ := atom_nonempty ha + obtain ⟨σ₂, hσ₂⟩ := atom_nonempty hb + have hle := hComp₀.dist_le σ₁ σ₂ + rw [pointDist_eq_of_mem_atom ha hb hσ₁ hσ₂, + pointDist_eq_of_mem_atom ha' hb' (hsub₁ hσ₁) (hsub₂ hσ₂)] at hle + omega + subst hT₀_eq + have hT'_eq : T' = T'_45 := hUniq' T' d' hComp + subst hT'_eq + let θ' := θ - (4 * lam + 2) + have hV_star := hSpan.isControlling.isTangle_star.finite_V + have hE_star := hSpan.isControlling.isTangle_star.finite_E + have hForward : ∀ ⦃A B : Hypergraph α β⦄, + (Hypergraph.ofGraph G hV_star hE_star).IsSeparation A B → + separationOrder A B < θ' → + ∀ ⦃A_H' B_H' : Hypergraph S (Set S)⦄, + IsRestrictedSeparation H' G η' A B A_H' B_H' → + (A, B) ∈ T_star → (A_H', B_H') ∈ T' := by + intro A B hsepAB hordAB A_H' B_H' hRestr' hAB_star + obtain ⟨A_H, B_H, hRestrH, _, _, _, _, hord_H⟩ := + GM12.exists_span_restricted_separation hV_star hE_star H η hsepAB + have he_iff_H := (restrictedSeparation_props hRestrH).1 + obtain ⟨he_iff_H', hord_H', _⟩ := restrictedSeparation_props hRestr' + have hAH_in_T : (A_H, B_H) ∈ T := + (hSpan.isControlling.controls hsepAB (by omega) hRestrH).mp hAB_star + have hAH₀_in_T₀ : (A_H ∩ H₀.toHypergraph, B_H ∩ H₀.toHypergraph) ∈ T₀ := + hMem₀_710 A_H B_H hAH_in_T (lt_of_le_of_lt hord_H hordAB) + rw [hIndEq] + refine ⟨hRestr'.1, lt_of_le_of_lt hord_H' hordAB, + (A_H ∩ H₀.toHypergraph, B_H ∩ H₀.toHypergraph), hAH₀_in_T₀, ?_⟩ + ext e + change e ∈ A_H.edgeSet ∩ H₀.E ↔ e ∈ A_H'.edgeSet ∩ H₀.E + refine and_congr_left fun he₀ => ?_ + have he₀' : e ∈ (H.span ∅ {e ∈ H.E | lam < d z e}).E := hH₀_eq ▸ he₀ + rw [H.span_E] at he₀' + have heH : e ∈ H.E := he₀'.1.1 + have hlt : lam < d z e := he₀'.1.2 + obtain ⟨heH', heMap_eq⟩ := hE e heH hlt + rw [he_iff_H e heH, he_iff_H' e heH', heMap_eq] + refine ⟨hz, hSpan, ⟨hSpan.isSurface, hSpan.isConnected, hSpan.bd_empty, hRigid', + hComp.hasMetric'.1, ⟨by have := hSpan.isControlling.theta_le; omega, + hSpan.isControlling.isTangle_star, hComp.hasMetric'.1.2.1, ?_⟩⟩, + hAtoms, hV, hE, hComp⟩ + intro A B hsepAB hordAB A_H' B_H' hRestr' + refine ⟨hForward hsepAB hordAB hRestr', fun hAB' => ?_⟩ + by_contra hnot + have hord_star : separationOrder A B < θ_star := by + have := hSpan.isControlling.theta_le + omega + have hBA_star : (B, A) ∈ T_star := + (hSpan.isControlling.isTangle_star.isTangle.axiom1 hsepAB hord_star).resolve_left hnot + have hRestr'_symm := (restrictedSeparation_props hRestr').2.2 + have hBA' : (B_H', A_H') ∈ T' := + hForward hsepAB.symm (by rwa [separationOrder_comm]) hRestr'_symm hBA_star + exact GM10.theorem_2_1_proof hComp.hasMetric'.1.2.1 hAB' hBA' + +/-- Every walk in a graph contains a simple walk with the same ends and a subset of vertices. -/ +private theorem exists_simple_subwalk {α β : Type*} {G : Graph α β} {u v : α} + (W : GraphWalk G u v) : + ∃ W' : GraphWalk G u v, W'.IsSimple ∧ ∀ w ∈ W'.support, w ∈ W.support := by + induction W with + | nil h => + exact ⟨.nil h, List.nodup_singleton _, fun _ hw => hw⟩ + | @cons u' w' v' e' h r ih => + obtain ⟨r', hr'_sim, hr'_sub⟩ := ih + by_cases hu : u' ∈ r'.support + · obtain ⟨W₁, W₂, h_eq⟩ := r'.exists_append_of_mem hu + have hnodup : (W₁.support ++ W₂.support.tail).Nodup := by + rw [← W₁.support_append W₂, ← h_eq] + exact hr'_sim + obtain ⟨_, htail, hdisj⟩ := List.nodup_append.mp hnodup + have hu_not_tail : u' ∉ W₂.support.tail := + fun hmem => hdisj u' W₁.end_mem_support u' hmem rfl + have hW₂_sim : W₂.IsSimple := by + unfold GraphWalk.IsSimple + rw [W₂.support_eq_cons] + exact List.nodup_cons.mpr ⟨hu_not_tail, htail⟩ + refine ⟨W₂, hW₂_sim, fun w hw => List.mem_cons_of_mem _ (hr'_sub w ?_)⟩ + rw [h_eq, W₁.mem_support_append W₂] + exact Or.inr hw + · refine ⟨.cons h r', List.nodup_cons.mpr ⟨hu, hr'_sim⟩, fun w hw => ?_⟩ + rcases List.mem_cons.mp hw with rfl | hw + · exact List.mem_cons_self + · exact List.mem_cons_of_mem _ (hr'_sub w hw) + +private theorem split_separation_left {S : Type w} {J A B A₁ A₂ : Hypergraph S (Set S)} + (hsep : J.IsSeparation A B) (h₁ : A₁ ≤ J) (h₂ : A₂ ≤ J) + (hV : A₁.vertexSet ∪ A₂.vertexSet = A.vertexSet) + (hE : A₁.edgeSet ∪ A₂.edgeSet = A.edgeSet) + (hDisj : Disjoint A₁.edgeSet A₂.edgeSet) : + J.IsSeparation A₁ (A₂ ∪ B) := by + apply (isSeparation_iff_of_le h₁ (union_le h₂ hsep.right_le)).mpr + refine ⟨?_, ?_, ?_⟩ + · change A₁.vertexSet ∪ (A₂.vertexSet ∪ B.vertexSet) = J.vertexSet + rw [← Set.union_assoc, hV, hsep.vertexSet_union] + · change A₁.edgeSet ∪ (A₂.edgeSet ∪ B.edgeSet) = J.edgeSet + rw [← Set.union_assoc, hE, hsep.edgeSet_union] + · change A₁.edgeSet ∩ (A₂.edgeSet ∪ B.edgeSet) = ∅ + refine (disjoint_union_right.mpr ⟨hDisj, ?_⟩).inter_eq + exact (disjoint_iff_inter_eq_empty.mpr hsep.edgeSet_inter_eq).mono_left (hE ▸ subset_union_left) + +/-- Statement of Graph Minors XV, (4.7) (page 127): +"Let $\mathcal{T}$ be a respectful tangle of order $\theta$ in a 2-cell drawing $H$ in a surface +$\Sigma$. Let $z \in A(H)$, let $\lambda \ge 2$ be an integer, and let $X \subseteq V(H)$ be free +with respect to $\mathcal{T}$. Suppose that $d(z, v) > 2|X| + 5\lambda + 2$ for all $v \in X$. Now +let $H'$ be a 2-cell drawing in $\Sigma$ such that $a \in A(H')$ for every $a \in A(H)$ with +$d(z, a) > \lambda$; and let $\mathcal{T}'$ be a $(4\lambda + 2)$-compression of $\mathcal{T}$ in +$H'$. Then $X$ is free with respect to $\mathcal{T}'$." -/ +def GM15Theorem47Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + (H H' : Drawing S) (θ lam : ℕ) + (T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d d' : Set S → Set S → ℕ) (z : Set S) (X : Set S), + IsClosedSurface S → ConnectedSpace S → + HasTangleMetric H θ T d → z ∈ H.A → 2 ≤ lam → + IsFreeSet H.toHypergraph T θ X → + (∀ v ∈ X, 2 * X.ncard + 5 * lam + 2 < d z {v}) → + (PaintingOrDrawing.drawing H').IsTwoCell → + (∀ a ∈ H.A, lam < d z a → a ∈ H'.A) → + IsLambdaCompression H H' θ (4 * lam + 2) T T' d d' → + IsFreeSet H'.toHypergraph T' (θ - (4 * lam + 2)) X + +private theorem small_separation_side_is_walk_connected + {S : Type w} + [TopologicalSpace S] + (H' : Drawing S) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (X : Set S) + (θ' : ℕ) + (hT' : IsTangle H'.toHypergraph θ' T') + (n : ℕ) + (ih : ∀ m < n, ∀ (A B : Hypergraph S (Set S)), A.vertexSet.ncard = m → (A, B) ∈ T' → (X ∩ + A.vertexSet).ncard ≤ A.separationOrder B) + (A : Hypergraph S (Set S)) + (B : Hypergraph S (Set S)) + (hn : A.vertexSet.ncard = n) + (hAB : (A, B) ∈ T') + (hsepAB : H'.toHypergraph.IsSeparation A B) + (hordAB : A.separationOrder B < θ') + (hfinA_V : A.vertexSet.Finite) + (hgt : ¬(X ∩ A.vertexSet).ncard ≤ A.separationOrder B) + (v : S) + (V₁ : Set S) + (hV₁_sub : V₁ ⊆ A.vertexSet) + (hvV₁ : v ∈ V₁) + (hEndsE₁ : ∀ e ∈ ({e | e ∈ A.edgeSet ∧ ∃ w ∈ V₁, H'.toHypergraph.Inc e w}), ∀ (u : S), + H'.toHypergraph.Inc e u → u ∈ V₁) : + A.vertexSet = V₁ := by + let E₁ := {e | e ∈ A.edgeSet ∧ ∃ w ∈ V₁, H'.toHypergraph.Inc e w} + let V₂ := A.vertexSet \ V₁ + let E₂ := A.edgeSet \ E₁ + apply Set.Subset.antisymm _ hV₁_sub + intro u₀ hu₀A + by_contra hu₀_not + have hu₀V₂ : u₀ ∈ V₂ := ⟨hu₀A, hu₀_not⟩ + let A₁ : Hypergraph S (Set S) := + { vertexSet := V₁ + edgeSet := E₁ + Inc e u := H'.toHypergraph.Inc e u ∧ e ∈ E₁ + vertex_mem_of_inc e u h := hEndsE₁ e h.2 u h.1 + edge_mem_of_inc _ _ h := h.2 + vertexSet_finite := hfinA_V.subset hV₁_sub + edgeSet_finite := (H'.finite_edges.subset hsepAB.left_le.edgeSet_subset).subset + fun _ h => h.1 } + let A₂ : Hypergraph S (Set S) := + { vertexSet := V₂ + edgeSet := E₂ + Inc e u := H'.toHypergraph.Inc e u ∧ e ∈ E₂ + vertex_mem_of_inc e u h := by + have huA : u ∈ A.vertexSet := by + have : u ∈ A.ends e := by rw [← hsepAB.left_le.ends_eq e h.2.1]; exact h.1 + exact A.vertex_mem_of_inc this + exact ⟨huA, fun huV₁ => h.2.2 ⟨h.2.1, u, huV₁, h.1⟩⟩ + edge_mem_of_inc _ _ h := h.2 + vertexSet_finite := hfinA_V.subset sdiff_subset + edgeSet_finite := (H'.finite_edges.subset hsepAB.left_le.edgeSet_subset).subset + sdiff_subset } + have hA₁_le : A₁ ≤ H'.toHypergraph := by + refine ⟨fun u h => hsepAB.left_le.vertexSet_subset (hV₁_sub h), + fun e h => hsepAB.left_le.edgeSet_subset h.1, fun e he => ?_⟩ + ext u + exact ⟨fun h => ⟨h, he⟩, fun h => h.1⟩ + have hA₂_le : A₂ ≤ H'.toHypergraph := by + refine ⟨fun u h => hsepAB.left_le.vertexSet_subset h.1, + fun e h => hsepAB.left_le.edgeSet_subset h.1, fun e he => ?_⟩ + ext u + exact ⟨fun h => ⟨h, he⟩, fun h => h.1⟩ + have hVpartition : A₁.vertexSet ∪ A₂.vertexSet = A.vertexSet := by + change V₁ ∪ (A.vertexSet \ V₁) = A.vertexSet + ext x + constructor + · exact fun h => h.elim (fun hx => hV₁_sub hx) And.left + · exact fun hx => (em (x ∈ V₁)).imp_right fun hn => ⟨hx, hn⟩ + have hEpartition : A₁.edgeSet ∪ A₂.edgeSet = A.edgeSet := by + change E₁ ∪ (A.edgeSet \ E₁) = A.edgeSet + ext e + constructor + · exact fun h => h.elim And.left And.left + · exact fun he => (em (e ∈ E₁)).imp_right fun hn => ⟨he, hn⟩ + have hDisj : Disjoint A₁.edgeSet A₂.edgeSet := + disjoint_left.mpr fun e he₁ he₂ => he₂.2 he₁ + have hsep₁ : H'.toHypergraph.IsSeparation A₁ (A₂ ∪ B) := + split_separation_left hsepAB hA₁_le hA₂_le hVpartition hEpartition hDisj + have hsep₂ : H'.toHypergraph.IsSeparation A₂ (A₁ ∪ B) := + split_separation_left hsepAB hA₂_le hA₁_le ((Set.union_comm _ _).trans hVpartition) + ((Set.union_comm _ _).trans hEpartition) hDisj.symm + have hinter₁ : (A₁ ∩ (A₂ ∪ B)).vertexSet = V₁ ∩ B.vertexSet := by + ext x + change (x ∈ V₁ ∧ (x ∈ V₂ ∨ x ∈ B.vertexSet)) ↔ x ∈ V₁ ∩ B.vertexSet + exact ⟨fun ⟨hx₁, hx₂⟩ => ⟨hx₁, hx₂.resolve_left fun h => h.2 hx₁⟩, + fun ⟨hx₁, hxB⟩ => ⟨hx₁, Or.inr hxB⟩⟩ + have hinter₂ : (A₂ ∩ (A₁ ∪ B)).vertexSet = V₂ ∩ B.vertexSet := by + ext x + change (x ∈ V₂ ∧ (x ∈ V₁ ∨ x ∈ B.vertexSet)) ↔ x ∈ V₂ ∩ B.vertexSet + exact ⟨fun ⟨hx₂, hx₁⟩ => ⟨hx₂, hx₁.resolve_left fun h => hx₂.2 h⟩, + fun ⟨hx₂, hxB⟩ => ⟨hx₂, Or.inr hxB⟩⟩ + have hord_sum : separationOrder A₁ (A₂ ∪ B) + separationOrder A₂ (A₁ ∪ B) = + separationOrder A B := by + change (A₁ ∩ (A₂ ∪ B)).vertexSet.ncard + (A₂ ∩ (A₁ ∪ B)).vertexSet.ncard = + (A ∩ B).vertexSet.ncard + have hdisj : Disjoint (V₁ ∩ B.vertexSet) (V₂ ∩ B.vertexSet) := + Set.disjoint_left.mpr fun x ⟨hx₁, _⟩ ⟨hx₂, _⟩ => hx₂.2 hx₁ + have hfin₁ : (V₁ ∩ B.vertexSet).Finite := + (hfinA_V.subset hV₁_sub).subset inter_subset_left + have hfin₂ : (V₂ ∩ B.vertexSet).Finite := + (hfinA_V.subset sdiff_subset).subset inter_subset_left + rw [hinter₁, hinter₂, ← Set.ncard_union_eq hdisj hfin₁ hfin₂] + congr 1 + ext x + exact ⟨by + rintro (⟨hx, hxB⟩ | ⟨hx, hxB⟩) + · exact ⟨hV₁_sub hx, hxB⟩ + · exact ⟨hx.1, hxB⟩, + fun ⟨hxA, hxB⟩ => by + by_cases hx₁ : x ∈ V₁ + · exact Or.inl ⟨hx₁, hxB⟩ + · exact Or.inr ⟨⟨hxA, hx₁⟩, hxB⟩⟩ + have hmem₁ : (A₁, A₂ ∪ B) ∈ T' := + GM10.theorem_2_9_proof hT' hAB hsep₁ (by omega) (Or.inr (Or.inl hV₁_sub)) + have hmem₂ : (A₂, A₁ ∪ B) ∈ T' := + GM10.theorem_2_9_proof hT' hAB hsep₂ (by omega) (Or.inr (Or.inl sdiff_subset)) + have hV_sum : V₁.ncard + V₂.ncard = n := by + have hdisj : Disjoint V₁ V₂ := + Set.disjoint_left.mpr fun x hx₁ hx₂ => hx₂.2 hx₁ + rw [← hn, ← Set.ncard_union_eq hdisj + (hfinA_V.subset hV₁_sub) (hfinA_V.subset sdiff_subset)] + exact congrArg Set.ncard hVpartition + have hV₁_pos : 0 < V₁.ncard := + (Set.ncard_pos (hfinA_V.subset hV₁_sub)).mpr ⟨v, hvV₁⟩ + have hV₂_pos : 0 < V₂.ncard := + (Set.ncard_pos (hfinA_V.subset sdiff_subset)).mpr ⟨u₀, hu₀V₂⟩ + have hle₁ := ih V₁.ncard (by omega) A₁ (A₂ ∪ B) rfl hmem₁ + have hle₂ := ih V₂.ncard (by omega) A₂ (A₁ ∪ B) rfl hmem₂ + have hX_sum : (X ∩ A₁.vertexSet).ncard + (X ∩ A₂.vertexSet).ncard = + (X ∩ A.vertexSet).ncard := by + change (X ∩ V₁).ncard + (X ∩ V₂).ncard = (X ∩ A.vertexSet).ncard + have hdisj : Disjoint (X ∩ V₁) (X ∩ V₂) := + Set.disjoint_left.mpr fun x ⟨_, hx₁⟩ ⟨_, hx₂⟩ => hx₂.2 hx₁ + have hfin₁ : (X ∩ V₁).Finite := + (hfinA_V.subset hV₁_sub).subset inter_subset_right + have hfin₂ : (X ∩ V₂).Finite := + (hfinA_V.subset sdiff_subset).subset inter_subset_right + rw [← Set.ncard_union_eq hdisj hfin₁ hfin₂] + congr 1 + ext x + exact ⟨by + rintro (⟨hxX, hx⟩ | ⟨hxX, hx⟩) + · exact ⟨hxX, hV₁_sub hx⟩ + · exact ⟨hxX, hx.1⟩, + fun ⟨hxX, hxA⟩ => by + by_cases hx₁ : x ∈ V₁ + · exact Or.inl ⟨hxX, hx₁⟩ + · exact Or.inr ⟨hxX, ⟨hxA, hx₁⟩⟩⟩ + omega + +private theorem walk_component_contains_both_edge_ends + {S : Type w} + [TopologicalSpace S] + (H' : Drawing S) + (A : Hypergraph S (Set S)) + (B : Hypergraph S (Set S)) + (hsepAB : H'.toHypergraph.IsSeparation A B) + (v : S) + (V₁ : Set S) + (hV₁ : V₁ = {u ∈ A.vertexSet | ∃ W : GraphWalk H'.toGraph u v, + (∀ w ∈ W.support, w ∈ A.vertexSet) ∧ (∀ e ∈ W.edges, e ∈ A.edgeSet)}) : + ∀ e ∈ {e | e ∈ A.edgeSet ∧ ∃ w ∈ V₁, H'.toHypergraph.Inc e w}, ∀ u : S, + H'.toHypergraph.Inc e u → u ∈ V₁ := by + subst V₁ + rintro e ⟨heA, w, ⟨hwA, Ww, hWw_V, hWw_E⟩, he_w⟩ u he_u + have huA : u ∈ A.vertexSet := by + have : u ∈ A.ends e := by rw [← hsepAB.left_le.ends_eq e heA]; exact he_u + exact A.vertex_mem_of_inc this + by_cases huw : u = w + · exact huw ▸ ⟨hwA, Ww, hWw_V, hWw_E⟩ + · have he' : e ∈ H'.E := he_u.1 + have hpair_eq : closure e ∩ H'.V = {u, w} := by + rcases H'.edge_cond e he' with ⟨a, b, _, hcl, _⟩ | ⟨a, hcl, _⟩ + · have hu_ab : u = a ∨ u = b := by + have : u ∈ ({a, b} : Set S) := hcl ▸ ⟨he_u.2.2, he_u.2.1⟩ + simpa using this + have hw_ab : w = a ∨ w = b := by + have : w ∈ ({a, b} : Set S) := hcl ▸ ⟨he_w.2.2, he_w.2.1⟩ + simpa using this + rw [hcl] + rcases hu_ab with rfl | rfl <;> rcases hw_ab with rfl | rfl + · exact False.elim (huw rfl) + · rfl + · exact Set.pair_comm _ _ + · exact False.elim (huw rfl) + · have hu_a : u = a := by + have : u ∈ ({a} : Set S) := hcl ▸ ⟨he_u.2.2, he_u.2.1⟩ + simpa using this + have hw_a : w = a := by + have : w ∈ ({a} : Set S) := hcl ▸ ⟨he_w.2.2, he_w.2.1⟩ + simpa using this + exact False.elim (huw (hu_a.trans hw_a.symm)) + have hlink : H'.toGraph.IsLink e u w := ⟨he', he_u.2.1, he_w.2.1, hpair_eq⟩ + refine ⟨huA, .cons hlink Ww, fun x hx => ?_, fun f hf => ?_⟩ + · rcases List.mem_cons.mp hx with rfl | hx + · exact huA + · exact hWw_V x hx + · rcases List.mem_cons.mp hf with rfl | hf + · exact heA + · exact hWw_E f hf + +private theorem small_side_vertices_are_far_from_deleted_atom + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (H : Drawing S) + (H' : Drawing S) + (θ : ℕ) + (lam : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (d' : Set S → Set S → ℕ) + (z : Set S) + (X : Set S) + (hS : IsClosedSurface S) + (hz : z ∈ H.A) + (hFree : IsFreeSet H.toHypergraph T θ X) + (hDistX : ∀ v ∈ X, 2 * X.ncard + 5 * lam + 2 < d z {v}) + (hAtoms : ∀ a ∈ H.A, lam < d z a → a ∈ H'.A) + (hComp : IsLambdaCompression H H' θ (4 * lam + 2) T T' d d') + (hd_tri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) + (A : Hypergraph S (Set S)) + (B : Hypergraph S (Set S)) + (hsepAB : H'.toHypergraph.IsSeparation A B) + (v : S) + (hvX : v ∈ X) + (hvH' : v ∈ H'.V) + (hClaim2 : ∀ u ∈ A.vertexSet, d' {u} {v} ≤ 2 * A.separationOrder B) + (hord_lt_X : A.separationOrder B < X.ncard) : + ∀ u ∈ A.vertexSet, u ∈ H.V ∧ lam + 2 < d z {u} := by + intro u huA + have huH' : u ∈ H'.V := hsepAB.left_le.vertexSet_subset huA + have hvH : v ∈ H.V := hFree.1 hvX + have hd'_uv := hClaim2 u huA + obtain ⟨au, hau, hu_au⟩ := exists_atom_of_point H u + have hcomp_uv := hComp.dist_le u v + rw [pointDist_eq_of_mem_atom (d := d) hau (Or.inl (Or.inl ⟨v, hvH, rfl⟩)) hu_au + (Set.mem_singleton v), + pointDist_eq_of_mem_atom (d := d') (Or.inl (Or.inl ⟨u, huH', rfl⟩)) + (Or.inl (Or.inl ⟨v, hvH', rfl⟩)) + (Set.mem_singleton u) (Set.mem_singleton v)] at hcomp_uv + dsimp at hcomp_uv + have htri_z := hd_tri z hz au hau {v} (Or.inl (Or.inl ⟨v, hvH, rfl⟩)) + have hzv := hDistX v hvX + have hlt_au : lam + 2 < d z au := by omega + have hau_H' : au ∈ H'.A := hAtoms au hau (by omega) + have hau_eq : au = {u} := + atom_eq_of_mem hau_H' (Or.inl (Or.inl ⟨u, huH', rfl⟩)) hu_au (Set.mem_singleton u) + rw [hau_eq] at hau hlt_au + exact ⟨vertex_mem_V_of_mem_A hS huH' hau, hlt_au⟩ + +private theorem small_side_edges_survive_deletion + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (H : Drawing S) + (H' : Drawing S) + (θ : ℕ) + (lam : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (d' : Set S → Set S → ℕ) + (z : Set S) + (X : Set S) + (hS : IsClosedSurface S) + (hz : z ∈ H.A) + (hFree : IsFreeSet H.toHypergraph T θ X) + (hDistX : ∀ v ∈ X, 2 * X.ncard + 5 * lam + 2 < d z {v}) + (hAtoms : ∀ a ∈ H.A, lam < d z a → a ∈ H'.A) + (hComp : IsLambdaCompression H H' θ (4 * lam + 2) T T' d d') + (hd_tri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) + (hd'_symm : ∀ a ∈ H'.A, ∀ b ∈ H'.A, d' a b = d' b a) + (hd'_tri : ∀ a ∈ H'.A, ∀ b ∈ H'.A, ∀ c ∈ H'.A, d' a c ≤ d' a b + d' b c) + (hd'_inc : (H'.E.Nonempty → ∀ v ∈ H'.V, ∀ r ∈ H'.R, v ∈ closure r → d' {v} r ≤ 1) ∧ ∀ v ∈ + H'.V, ∀ e ∈ H'.E, v ∈ closure e → d' {v} e ≤ 2) + (hH₀_eq : (deleteAtomNeighborhood H d z lam) = H.span ∅ {e | e ∈ H.E ∧ lam < d z e}) + (A : Hypergraph S (Set S)) + (B : Hypergraph S (Set S)) + (hsepAB : H'.toHypergraph.IsSeparation A B) + (v : S) + (hvX : v ∈ X) + (hvH' : v ∈ H'.V) + (hClaim2 : ∀ u ∈ A.vertexSet, d' {u} {v} ≤ 2 * A.separationOrder B) + (hord_lt_X : A.separationOrder B < X.ncard) : + ∀ u ∈ A.vertexSet, ∀ e ∈ H'.E, u ∈ closure e → e ∈ (deleteAtomNeighborhood H d z lam).E := by + let H₀ := deleteAtomNeighborhood H d z lam + intro u huA e he' hue + have huH' : u ∈ H'.V := hsepAB.left_le.vertexSet_subset huA + have hvH : v ∈ H.V := hFree.1 hvX + have hd'_uv := hClaim2 u huA + have hd'_ue : d' {u} e ≤ 2 := hd'_inc.2 u huH' e he' hue + have hd'_ev : d' e {v} ≤ 2 * X.ncard := by + have h1 := hd'_tri e (Or.inl (Or.inr he')) {u} (Or.inl (Or.inl ⟨u, huH', rfl⟩)) + {v} (Or.inl (Or.inl ⟨v, hvH', rfl⟩)) + have h2 := hd'_symm {u} (Or.inl (Or.inl ⟨u, huH', rfl⟩)) e (Or.inl (Or.inr he')) + omega + obtain ⟨σ, hσe⟩ := atom_nonempty (Or.inl (Or.inr he') : e ∈ H'.A) + obtain ⟨aσ, haσ, hσ_aσ⟩ := exists_atom_of_point H σ + have hcomp_σv := hComp.dist_le σ v + rw [pointDist_eq_of_mem_atom (d := d) haσ (Or.inl (Or.inl ⟨v, hvH, rfl⟩)) hσ_aσ + (Set.mem_singleton v), + pointDist_eq_of_mem_atom (d := d') (Or.inl (Or.inr he')) + (Or.inl (Or.inl ⟨v, hvH', rfl⟩)) + hσe (Set.mem_singleton v)] at hcomp_σv + dsimp at hcomp_σv + have htri_z := hd_tri z hz aσ haσ {v} (Or.inl (Or.inl ⟨v, hvH, rfl⟩)) + have hzv := hDistX v hvX + have hlt_aσ : lam < d z aσ := by omega + have haσ_H' : aσ ∈ H'.A := hAtoms aσ haσ hlt_aσ + have haσ_eq : aσ = e := + atom_eq_of_mem haσ_H' (Or.inl (Or.inr he')) hσ_aσ hσe + rw [haσ_eq] at haσ hlt_aσ + have heH : e ∈ H.E := edge_mem_E_of_mem_A hS he' haσ + rw [hH₀_eq, H.span_E] + exact ⟨⟨heH, hlt_aσ⟩, heH⟩ + +private theorem lifted_small_side_belongs_to_original_tangle + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (H : Drawing S) + (H' : Drawing S) + (θ : ℕ) + (lam : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (z : Set S) + (X : Set S) + (hMetric : HasTangleMetric H θ T d) + (hlam : 2 ≤ lam) + (hθ : 4 * lam + 2 < θ) + (v₀ : S) + (hv₀_le_θ : d z {v₀} ≤ θ) + (hv₀_gt : 2 * X.ncard + 5 * lam + 2 < d z {v₀}) + (hSubH₀H : (deleteAtomNeighborhood H d z lam).IsSubdrawing H) + (hSubH₀H' : (deleteAtomNeighborhood H d z lam).IsSubdrawing H') + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (hMem₀_710 : ∀ (A B : Hypergraph S (Set S)), (A, B) ∈ T → A.separationOrder B < θ - (4 * lam + + 2) → (A ∩ (deleteAtomNeighborhood H d z lam).toHypergraph, B ∩ (deleteAtomNeighborhood H d z + lam).toHypergraph) ∈ T₀) + (hIndEq : T' = inducedTangle H'.toHypergraph (deleteAtomNeighborhood H d z lam).toHypergraph + T₀ (θ - (4 * lam + 2))) + (hT' : IsTangle H'.toHypergraph (θ - (4 * lam + 2)) T') + (A : Hypergraph S (Set S)) + (B : Hypergraph S (Set S)) + (hAB : (A, B) ∈ T') + (hsepAB : H'.toHypergraph.IsSeparation A B) + (hordAB : A.separationOrder B < (θ - (4 * lam + 2))) + (hord_lt_X : A.separationOrder B < X.ncard) + (C : Hypergraph S (Set S)) + (hCE : C.edgeSet = H.E \ A.edgeSet) + (hsepAC : H.toHypergraph.IsSeparation A C) + (hordAC_eq : A.separationOrder C = A.separationOrder B) + (hordAC_lt : A.separationOrder C < (θ - (4 * lam + 2))) : + (A, C) ∈ T := by + let θ' := θ - (4 * lam + 2) + let H₀ := deleteAtomNeighborhood H d z lam + rcases hMetric.1.2.1.axiom1 hsepAC (by omega) with hAC | hCA + · exact hAC + · have hCA₀ : (C ∩ H₀.toHypergraph, A ∩ H₀.toHypergraph) ∈ T₀ := + hMem₀_710 C A hCA (by rwa [separationOrder_comm]) + have hBA_in_T' : (B, A) ∈ T' := by + rw [hIndEq] + refine ⟨hsepAB.symm, by rwa [separationOrder_comm], + (C ∩ H₀.toHypergraph, A ∩ H₀.toHypergraph), hCA₀, ?_⟩ + ext e + change e ∈ C.edgeSet ∩ H₀.E ↔ e ∈ B.edgeSet ∩ H₀.E + rw [hCE] + refine and_congr_left fun he₀ => ?_ + have heH : e ∈ H.E := hSubH₀H.2 he₀ + have he' : e ∈ H'.E := hSubH₀H'.2 he₀ + have he_u : e ∈ A.edgeSet ∪ B.edgeSet := hsepAB.edgeSet_union.symm ▸ he' + constructor + · rintro ⟨_, henotA⟩ + exact he_u.resolve_left henotA + · intro heB + exact ⟨heH, fun heA => hsepAB.notMem_edgeSet_right heA heB⟩ + exact False.elim (GM10.theorem_2_1_proof hT' hAB hBA_in_T') + +private theorem compressed_tangle_small_sides_respect_free_set + {S : Type w} + [TopologicalSpace S] + [T2Space S] + (H : Drawing S) + (H' : Drawing S) + (θ : ℕ) + (lam : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (d' : Set S → Set S → ℕ) + (z : Set S) + (X : Set S) + (hS : IsClosedSurface S) + [hConn : ConnectedSpace S] + (hMetric : HasTangleMetric H θ T d) + (hz : z ∈ H.A) + (hlam : 2 ≤ lam) + (hFree : IsFreeSet H.toHypergraph T θ X) + (hDistX : ∀ v ∈ X, 2 * X.ncard + 5 * lam + 2 < d z {v}) + (hAtoms : ∀ a ∈ H.A, lam < d z a → a ∈ H'.A) + (hComp : IsLambdaCompression H H' θ (4 * lam + 2) T T' d d') + (hθ : 4 * lam + 2 < θ) + (hd_symm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (hd_tri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) + (hd_inc : (H.E.Nonempty → ∀ v ∈ H.V, ∀ r ∈ H.R, v ∈ closure r → d {v} r ≤ 1) ∧ ∀ v ∈ H.V, ∀ e + ∈ H.E, v ∈ closure e → d {v} e ≤ 2) + (hd'_refl : ∀ a ∈ H'.A, d' a a = 0) + (hd'_symm : ∀ a ∈ H'.A, ∀ b ∈ H'.A, d' a b = d' b a) + (hd'_tri : ∀ a ∈ H'.A, ∀ b ∈ H'.A, ∀ c ∈ H'.A, d' a c ≤ d' a b + d' b c) + (hd'_inc : (H'.E.Nonempty → ∀ v ∈ H'.V, ∀ r ∈ H'.R, v ∈ closure r → d' {v} r ≤ 1) ∧ ∀ v ∈ + H'.V, ∀ e ∈ H'.E, v ∈ closure e → d' {v} e ≤ 2) + (v₀ : S) + (hv₀_le_θ : d z {v₀} ≤ θ) + (hv₀_gt : 2 * X.ncard + 5 * lam + 2 < d z {v₀}) + (hH₀_eq : (deleteAtomNeighborhood H d z lam) = H.span ∅ {e | e ∈ H.E ∧ lam < d z e}) + (hSubH₀H : (deleteAtomNeighborhood H d z lam).IsSubdrawing H) + (hSubH₀H' : (deleteAtomNeighborhood H d z lam).IsSubdrawing H') + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (hMem₀_710 : ∀ (A B : Hypergraph S (Set S)), (A, B) ∈ T → A.separationOrder B < θ - (4 * lam + + 2) → (A ∩ (deleteAtomNeighborhood H d z lam).toHypergraph, B ∩ (deleteAtomNeighborhood H d z + lam).toHypergraph) ∈ T₀) + (hIndEq : T' = inducedTangle H'.toHypergraph (deleteAtomNeighborhood H d z lam).toHypergraph + T₀ (θ - (4 * lam + 2))) + (hT' : IsTangle H'.toHypergraph (θ - (4 * lam + 2)) T') : + ∀ (n : ℕ) (A B : Hypergraph S (Set S)), A.vertexSet.ncard = n → (A, B) ∈ T' → (X ∩ + A.vertexSet).ncard ≤ A.separationOrder B := by + let θ' := θ - (4 * lam + 2) + let H₀ := deleteAtomNeighborhood H d z lam + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro A B hn hAB + have hsepAB : H'.toHypergraph.IsSeparation A B := hT'.isSeparation hAB + have hordAB : separationOrder A B < θ' := hT'.order_lt hAB + have hfinA_V : A.vertexSet.Finite := H'.finite_V.subset hsepAB.left_le.vertexSet_subset + by_contra hgt + have hlt_ord : separationOrder A B < (X ∩ A.vertexSet).ncard := Nat.lt_of_not_le hgt + have hXA_ne : (X ∩ A.vertexSet).Nonempty := + (Set.ncard_pos (hfinA_V.subset inter_subset_right)).mp (by omega) + obtain ⟨v, hvX, hvA⟩ := hXA_ne + have hvH' : v ∈ H'.V := hsepAB.left_le.vertexSet_subset hvA + let V₁ : Set S := + {u ∈ A.vertexSet | ∃ W : GraphWalk H'.toGraph u v, + (∀ w ∈ W.support, w ∈ A.vertexSet) ∧ (∀ e ∈ W.edges, e ∈ A.edgeSet)} + have hV₁_sub : V₁ ⊆ A.vertexSet := fun _ h => h.1 + let E₁ : Set (Set S) := {e ∈ A.edgeSet | ∃ w ∈ V₁, H'.toHypergraph.Inc e w} + let V₂ : Set S := A.vertexSet \ V₁ + let E₂ : Set (Set S) := A.edgeSet \ E₁ + have hvV₁ : v ∈ V₁ := + ⟨hvA, .nil hvH', + fun w hw => (List.mem_singleton.mp hw) ▸ hvA, + fun _ he => False.elim (List.not_mem_nil he)⟩ + have hEndsE₁ : ∀ e ∈ E₁, ∀ u, H'.toHypergraph.Inc e u → u ∈ V₁ := by + exact walk_component_contains_both_edge_ends (S := S) H' A B hsepAB v V₁ rfl + -- Claim (1): every vertex of `A` belongs to `V₁` (`A` is connected). + have hV₁_eq : A.vertexSet = V₁ := by + exact small_separation_side_is_walk_connected (S := S) H' T' X θ' hT' n ih + A B hn hAB hsepAB hordAB hfinA_V hgt v V₁ hV₁_sub hvV₁ hEndsE₁ + -- Claim (2): for every `u ∈ V(A)`, `d' {u} {v} ≤ 2 * separationOrder A B`. + have hClaim2 : ∀ u ∈ A.vertexSet, d' {u} {v} ≤ 2 * separationOrder A B := by + intro u huA + have huH' : u ∈ H'.V := hsepAB.left_le.vertexSet_subset huA + by_cases huv : u = v + · subst huv + rw [hd'_refl {u} (Or.inl (Or.inl ⟨u, huH', rfl⟩))] + omega + · obtain ⟨_, ⟨W, hW_V, _⟩⟩ : u ∈ V₁ := hV₁_eq ▸ huA + obtain ⟨W', hW'_sim, hW'_sub⟩ := exists_simple_subwalk W + let P := walkDrawing H' W' + have hP_path : P.IsPathBetween u v := GM11.walkDrawing_isPathBetween H' hW'_sim + have hP_sub : P.IsSubdrawing H' := GM11.walkDrawing_isSubdrawing H' W' + have hP_V : P.V ⊆ A.vertexSet := by + rw [GM11.walkDrawing_V] + exact fun x hx => hW_V x (hW'_sub x hx) + exact GM12.theorem_4_1_proof H' P θ' T' d' A B u v hS hConn hComp.hasMetric' huH' hvH' + hP_path hP_sub hAB hP_V + have hord_lt_X : separationOrder A B < X.ncard := + lt_of_lt_of_le hlt_ord + (Set.ncard_le_ncard inter_subset_left (H.finite_V.subset hFree.1)) + -- Claim (3): every `u ∈ V(A)` is in `V(H)` with `d z {u} > lam + 2`, and every edge of `H'` + -- incident with `u` is in `H₀.E`. + have hClaim3_V : ∀ u ∈ A.vertexSet, u ∈ H.V ∧ lam + 2 < d z {u} := by + exact small_side_vertices_are_far_from_deleted_atom (S := S) H H' θ lam T T' d d' z X hS + hz hFree hDistX hAtoms hComp hd_tri A B hsepAB v hvX hvH' hClaim2 hord_lt_X + have hClaim3_E : ∀ u ∈ A.vertexSet, ∀ e ∈ H'.E, u ∈ closure e → e ∈ H₀.E := by + exact small_side_edges_survive_deletion (S := S) H H' θ lam T T' d d' z X hS hz hFree + hDistX hAtoms hComp hd_tri hd'_symm hd'_tri hd'_inc hH₀_eq A B hsepAB v hvX hvH' + hClaim2 hord_lt_X + -- Claim (4): for all `u ∈ V(A)`, every edge of `H` incident with `u` is in `H₀.E`. + have hClaim4 : ∀ u ∈ A.vertexSet, ∀ e ∈ H.E, u ∈ closure e → e ∈ H₀.E := by + intro u huA e heH hue + obtain ⟨huH, hlt_u⟩ := hClaim3_V u huA + have hd_ue : d {u} e ≤ 2 := hd_inc.2 u huH e heH hue + have htri := hd_tri z hz e (Or.inl (Or.inr heH)) {u} (Or.inl (Or.inl ⟨u, huH, rfl⟩)) + have hsym := hd_symm {u} (Or.inl (Or.inl ⟨u, huH, rfl⟩)) e (Or.inl (Or.inr heH)) + change e ∈ (deleteAtomNeighborhood H d z lam).E + rw [hH₀_eq, H.span_E] + exact ⟨⟨heH, by omega⟩, heH⟩ + -- Construct `(A, C)` in `H` such that `A ∩ C = A ∩ B` and `C ∩ H₀ = B ∩ H₀`. + have hA_le_H : A ≤ H.toHypergraph := by + refine ⟨fun u huA => (hClaim3_V u huA).1, + fun e heA => ?_, fun e heA => ?_⟩ + · obtain ⟨u, hu_inc⟩ : (A.ends e).Nonempty := by + have he' : e ∈ H'.E := hsepAB.left_le.edgeSet_subset heA + obtain ⟨u, hue, huV'⟩ := edge_closure_inter_V_nonempty he' + refine ⟨u, ?_⟩ + rw [← hsepAB.left_le.ends_eq e heA] + exact ⟨he', huV', hue⟩ + have huA : u ∈ A.vertexSet := A.vertex_mem_of_inc hu_inc + have hinc' : H'.toHypergraph.Inc e u := by + change u ∈ H'.toHypergraph.ends e + rw [hsepAB.left_le.ends_eq e heA] + exact hu_inc + exact hSubH₀H.2 (hClaim3_E u huA e hinc'.1 hinc'.2.2) + · ext u + change (e ∈ H.E ∧ u ∈ H.V ∧ u ∈ closure e) ↔ u ∈ A.ends e + rw [← hsepAB.left_le.ends_eq e heA] + change (e ∈ H.E ∧ u ∈ H.V ∧ u ∈ closure e) ↔ (e ∈ H'.E ∧ u ∈ H'.V ∧ u ∈ closure e) + constructor + · rintro ⟨heH, huH, hue⟩ + have he' : e ∈ H'.E := hsepAB.left_le.edgeSet_subset heA + have hu_in : u ∈ closure e ∩ H.V := ⟨hue, huH⟩ + obtain ⟨w, hw_inc⟩ : (A.ends e).Nonempty := by + obtain ⟨w, hwe, hwV'⟩ := edge_closure_inter_V_nonempty he' + refine ⟨w, ?_⟩ + rw [← hsepAB.left_le.ends_eq e heA] + exact ⟨he', hwV', hwe⟩ + have hwA : w ∈ A.vertexSet := A.vertex_mem_of_inc hw_inc + have hinc' : H'.toHypergraph.Inc e w := by + change w ∈ H'.toHypergraph.ends e + rw [hsepAB.left_le.ends_eq e heA] + exact hw_inc + have he₀ : e ∈ H₀.E := hClaim3_E w hwA e hinc'.1 hinc'.2.2 + rw [← hSubH₀H.closure_inter_V he₀, hSubH₀H'.closure_inter_V he₀] at hu_in + exact ⟨he', hu_in.2, hue⟩ + · rintro ⟨he', hu', hue⟩ + have huA : u ∈ A.vertexSet := by + have : u ∈ A.ends e := by + rw [← hsepAB.left_le.ends_eq e heA] + exact ⟨he', hu', hue⟩ + exact A.vertex_mem_of_inc this + exact ⟨hSubH₀H.2 (hClaim3_E u huA e he' hue), (hClaim3_V u huA).1, hue⟩ + let C : Hypergraph S (Set S) := + { vertexSet := (H.V \ A.vertexSet) ∪ (A.vertexSet ∩ B.vertexSet) + edgeSet := H.E \ A.edgeSet + Inc e u := H.toHypergraph.Inc e u ∧ e ∈ H.E \ A.edgeSet + vertex_mem_of_inc e u h := by + by_cases huA : u ∈ A.vertexSet + · refine Or.inr ⟨huA, ?_⟩ + have he₀ : e ∈ H₀.E := hClaim4 u huA e h.1.1 h.1.2.2 + have he' : e ∈ H'.E := hSubH₀H'.2 he₀ + have he_u : e ∈ A.edgeSet ∪ B.edgeSet := hsepAB.edgeSet_union.symm ▸ he' + have heB : e ∈ B.edgeSet := he_u.resolve_left h.2.2 + have hinc' : H'.toHypergraph.Inc e u := + ⟨he', hsepAB.left_le.vertexSet_subset huA, h.1.2.2⟩ + have huB_ends : u ∈ B.ends e := by + rw [← hsepAB.right_le.ends_eq e heB] + exact hinc' + exact B.vertex_mem_of_inc huB_ends + · exact Or.inl ⟨h.1.2.1, huA⟩ + edge_mem_of_inc _ _ h := h.2 + vertexSet_finite := H.finite_V.subset + (union_subset sdiff_subset (inter_subset_left.trans hA_le_H.vertexSet_subset)) + edgeSet_finite := H.finite_edges.subset sdiff_subset } + have hC_le_H : C ≤ H.toHypergraph := by + refine ⟨union_subset sdiff_subset (inter_subset_left.trans hA_le_H.vertexSet_subset), + sdiff_subset, fun e heC => ?_⟩ + ext u + exact ⟨fun h => ⟨h, heC⟩, fun h => h.1⟩ + have hsepAC : H.toHypergraph.IsSeparation A C := by + refine (isSeparation_iff_of_le hA_le_H hC_le_H).mpr ⟨?_, ?_, ?_⟩ + · ext x + change (x ∈ A.vertexSet ∨ x ∈ (H.V \ A.vertexSet) ∪ (A.vertexSet ∩ B.vertexSet)) ↔ + x ∈ H.V + constructor + · rintro (hxA | ⟨hxH, _⟩ | ⟨hxA, _⟩) + · exact hA_le_H.vertexSet_subset hxA + · exact hxH + · exact hA_le_H.vertexSet_subset hxA + · intro hxH + by_cases hxA : x ∈ A.vertexSet + · exact Or.inl hxA + · exact Or.inr (Or.inl ⟨hxH, hxA⟩) + · ext e + change (e ∈ A.edgeSet ∨ e ∈ H.E \ A.edgeSet) ↔ e ∈ H.E + constructor + · rintro (heA | ⟨heH, _⟩) + · exact hA_le_H.edgeSet_subset heA + · exact heH + · intro heH + by_cases heA : e ∈ A.edgeSet + · exact Or.inl heA + · exact Or.inr ⟨heH, heA⟩ + · ext e + change (e ∈ A.edgeSet ∧ e ∈ H.E \ A.edgeSet) ↔ e ∈ (∅ : Set (Set S)) + simp only [mem_sdiff, mem_empty_iff_false, iff_false] + exact fun ⟨heA, _, henot⟩ => henot heA + have hinterAC : (A ∩ C).vertexSet = (A ∩ B).vertexSet := by + ext x + change (x ∈ A.vertexSet ∧ (x ∈ H.V \ A.vertexSet ∨ x ∈ A.vertexSet ∧ x ∈ B.vertexSet)) ↔ + x ∈ A.vertexSet ∧ x ∈ B.vertexSet + exact ⟨fun ⟨hxA, h⟩ => ⟨hxA, (h.resolve_left fun h' => h'.2 hxA).2⟩, + fun ⟨hxA, hxB⟩ => ⟨hxA, Or.inr ⟨hxA, hxB⟩⟩⟩ + have hordAC_eq : separationOrder A C = separationOrder A B := + congrArg Set.ncard hinterAC + have hordAC_lt : separationOrder A C < θ' := hordAC_eq.symm ▸ hordAB + have hAC_in_T : (A, C) ∈ T := by + exact lifted_small_side_belongs_to_original_tangle (S := S) H H' θ lam T T' d z X + hMetric hlam hθ v₀ hv₀_le_θ hv₀_gt hSubH₀H hSubH₀H' T₀ hMem₀_710 hIndEq hT' A B hAB + hsepAB hordAB hord_lt_X C rfl hsepAC hordAC_eq hordAC_lt + have hFreeXA : IsFreeSet H.toHypergraph T θ (X ∩ A.vertexSet) := + GM14.freeSet_subset hMetric.1.2.1 hFree inter_subset_left + have hle_ord := hFreeXA.2.2 hAC_in_T inter_subset_right + omega + +/-- **Graph Minors XV, (4.7)** (pages 127–128): +Preservation of a free set `X ⊆ V(H)` with `d(z, v) > 2|X| + 5λ + 2` for all `v ∈ X` under a +`(4λ + 2)`-compression `T'` of `T` in `H'`. +Proved from `(4.4)`, `(4.5)`, Graph Minors XI, `(9.1)`, and Graph Minors XII, `(4.1)`, +`(7.7)`, `(7.10)`, and `(7.11)`. -/ +theorem theorem_4_7_proof + : + GM15Theorem47Statement.{w} := by + intro S _ _ H H' θ lam T T' d d' z X + hS hConn hMetric hz hlam hFree hDistX h2cell' hAtoms hComp + let θ' := θ - (4 * lam + 2) + have hθ : 4 * lam + 2 < θ := hComp.lam_lt + obtain ⟨_, hd_refl, hd_le_θ, hd_symm, hd_tri, hd_inc⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + obtain ⟨_, hd'_refl, hd'_le_θ', hd'_symm, hd'_tri, hd'_inc⟩ := + gm11_theorem_9_1 H' θ' T' d' hS hConn hComp.hasMetric' + by_cases hXne : X.Nonempty + · obtain ⟨v₀, hv₀X⟩ := hXne + have hv₀H : v₀ ∈ H.V := hFree.1 hv₀X + have hv₀_le_θ : d z {v₀} ≤ θ := hd_le_θ z hz {v₀} (Or.inl (Or.inl ⟨v₀, hv₀H, rfl⟩)) + have hv₀_gt := hDistX v₀ hv₀X + have hX_pos : 0 < X.ncard := (Set.ncard_pos (H.finite_V.subset hFree.1)).mpr ⟨v₀, hv₀X⟩ + have hX_le_θ' : X.ncard ≤ θ' := by omega + have hX_sub_H' : X ⊆ H'.V := by + intro v hvX + have hvH : v ∈ H.V := hFree.1 hvX + have hlt : lam < d z {v} := by have := hDistX v hvX; omega + exact vertex_mem_V_of_mem_A hS hvH (hAtoms {v} (Or.inl (Or.inl ⟨v, hvH, rfl⟩)) hlt) + let H₀ := deleteAtomNeighborhood H d z lam + have hE_ne : H.E.Nonempty := by + by_contra hE_emp + have hV_le := ncard_V_le_one_of_E_empty hS hMetric.1.1 (Set.not_nonempty_iff_eq_empty.mp + hE_emp) + have hord_le : θ ≤ H.V.ncard := hMetric.1.2.1.order_le_ncard_vertexSet + omega + have hH₀_eq : H₀ = H.span ∅ {e ∈ H.E | lam < d z e} := by + change deleteAtomNeighborhood H d z lam = _ + rw [deleteAtomNeighborhood, ite_eq_right_iff.mpr fun h => False.elim (hE_ne.ne_empty h)] + have hSubH₀H : H₀.IsSubdrawing H := hH₀_eq ▸ H.span_isSubdrawing _ _ + have h2cell₀ : (PaintingOrDrawing.drawing H₀).IsTwoCell := + theorem_4_3_proof H θ lam T d z hS hConn hMetric + hE_ne hz (by omega) (fun _ => hlam) + have hEdist₀ : ∀ e ∈ H.E \ H₀.E, d z e ≤ lam := by + rintro e ⟨heH, henot⟩ + rw [hH₀_eq, H.span_E] at henot + have : ¬ lam < d z e := fun hlt => henot ⟨⟨heH, hlt⟩, heH⟩ + omega + obtain ⟨T₀_710, d₀_710, ⟨hM₀_710, hMem₀_710, _⟩, hUniq₀_710⟩ := + GraphMinor.GM12.gm14_theorem_7_10.{w} S hS hConn H H₀ θ lam T d z + (by omega) hMetric hz hSubH₀H h2cell₀ hEdist₀ (fun _ => hlam) + have hSubEq : θ - 4 * lam - 2 = θ - (4 * lam + 2) := by omega + rw [hSubEq] at hM₀_710 hMem₀_710 hUniq₀_710 + obtain ⟨hSubH₀H', T₀, T'_45, d₀, d'_45, hComp₀, _, hIndEq, hUniq'⟩ := + theorem_4_5_proof H H' θ lam T d z hS hConn hMetric hz hlam hθ h2cell' hAtoms + have hT₀_eq : T₀ = T₀_710 := by + refine hUniq₀_710 T₀ d₀ hComp₀.hasMetric' (fun a ha b hb a' ha' b' hb' hsub₁ hsub₂ => ?_) + obtain ⟨σ₁, hσ₁⟩ := atom_nonempty ha + obtain ⟨σ₂, hσ₂⟩ := atom_nonempty hb + have hle := hComp₀.dist_le σ₁ σ₂ + rw [pointDist_eq_of_mem_atom ha hb hσ₁ hσ₂, + pointDist_eq_of_mem_atom ha' hb' (hsub₁ hσ₁) (hsub₂ hσ₂)] at hle + omega + subst hT₀_eq + have hT'_eq : T' = T'_45 := hUniq' T' d' hComp + subst hT'_eq + have hT' : IsTangle H'.toHypergraph θ' T' := hComp.hasMetric'.1.2.1 + have hMain : ∀ n : ℕ, ∀ A B : Hypergraph S (Set S), + A.vertexSet.ncard = n → (A, B) ∈ T' → + (X ∩ A.vertexSet).ncard ≤ separationOrder A B := by + exact compressed_tangle_small_sides_respect_free_set (S := S) H H' θ lam T T' d d' z X hS + hMetric hz hlam hFree hDistX hAtoms hComp hθ hd_symm hd_tri hd_inc hd'_refl hd'_symm + hd'_tri hd'_inc v₀ hv₀_le_θ hv₀_gt hH₀_eq hSubH₀H hSubH₀H' T₀ hMem₀_710 hIndEq hT' + refine ⟨hX_sub_H', hX_le_θ', fun A B hAB hXsub => ?_⟩ + have hXA : X ∩ A.vertexSet = X := Set.inter_eq_left.mpr hXsub + have hle := hMain A.vertexSet.ncard A B rfl hAB + rwa [hXA] at hle + · have hX_emp : X = ∅ := Set.not_nonempty_iff_eq_empty.mp hXne + subst hX_emp + exact ⟨empty_subset _, by simp, fun _ _ _ _ => by simp⟩ + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/Section5.lean b/LeanPool/GraphMinor/GM15/Section5.lean new file mode 100644 index 0000000000..6c05f20ecf --- /dev/null +++ b/LeanPool/GraphMinor/GM15/Section5.lean @@ -0,0 +1,5072 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.ControllingTangle + +import LeanPool.GraphMinor.GM12.Section79 + +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM15.Cited +public import LeanPool.GraphMinor.GM15.Section4 +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM10.Section6 +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM11.RadialExists +import LeanPool.GraphMinor.GM11.RadialFacts +import LeanPool.GraphMinor.GM11.ForestRegions +import LeanPool.GraphMinor.GM11.Section4c +import LeanPool.GraphMinor.GM11.Section5b +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.Surface.Epstein + +import LeanPool.GraphMinor.GM12.Section710 + +import LeanPool.GraphMinor.GM12.Section77 + +/-! +# Graph Minors XV, Section 5: Flatness + +This file formalizes Section 5 ("Flatness", pages 128–133) of N. Robertson and P. D. Seymour, +*Graph Minors. XV. Giant steps*, J. Combin. Theory Ser. B 68 (1996) 112–148: +- **Truncation of `Σ`-spans** (`IsRespectfulDrawingTangle.truncation`, + `IsControllingTangle.truncation`, `IsSigmaSpan.truncation`, page 129): if `H, η, T` is a `Σ`-span + of order `θ` and `1 ≤ θ₁ ≤ θ`, then `(H, η, GM10.truncation T θ₁)` is a `Σ`-span of order `θ₁`. +- **Monotonicity of `μ`-steppedness and `(λ, μ)`-flatness in `μ`** (`IsMuStepped.mono`, + `IsMuSteppedSpan.mono`, `IsFlatSpan.mono_mu`, page 129). +- **Graph Minors XV, (5.1)** (`GM15Theorem51Statement`, page 129): truncation and monotonicity of + `(λ, μ)`-flat `Σ`-spans. +- **Graph Minors XV, (5.2)** (`GM15Theorem52Statement`, page 129): rearranging a `(λ, μ)`-flat + `Σ`-span within `λ₁` of `z₁ ∈ A(H)` produces a `(λ₂, μ)`-flat `Σ`-span whenever `λ₁, λ₂ ≥ 4` and + `λ ≥ 6λ₁ + 5λ₂ + 3μ + 4`. +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +open Set Function Topology +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM14 + +universe u v w + +variable {α : Type u} {β : Type v} + +/-! ## Truncation of `Σ`-Spans -/ + +/-- If `T` is a respectful tangle in `H` of order `θ` and `1 ≤ θ₁ ≤ θ`, then the `θ₁`-truncation +`GM10.truncation T θ₁` is a respectful tangle in `H` of order `θ₁` +(Graph Minors XV, Section 3, page 120; Section 5, page 129). -/ +theorem IsRespectfulDrawingTangle.truncation {S : Type w} [TopologicalSpace S] + {H : Drawing S} {θ θ₁ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hResp : IsRespectfulDrawingTangle H θ T) (h1 : 1 ≤ θ₁) (hle : θ₁ ≤ θ) : + IsRespectfulDrawingTangle H θ₁ (GM10.truncation T θ₁) := by + exact GM12.IsRespectfulDrawingTangle.truncation hResp h1 hle + +/-- If `H, η, T` is a `Σ`-span of order `θ` in `G` with respect to `T*` and `1 ≤ θ₁ ≤ θ`, then +`(H, η, GM10.truncation T θ₁)` is a `Σ`-span of order `θ₁` in `G` with respect to `T*` +(Graph Minors XV, Section 5, proof of (5.1), page 129: +"Certainly $(H, \eta, \mathscr{T}_1)$ is a $\Sigma$-span of order $\theta_1$"). -/ +theorem IsSigmaSpan.truncation {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ θ₁ : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (h : IsSigmaSpan G H η θ_star θ T_star T) (h1 : 1 ≤ θ₁) (hle : θ₁ ≤ θ) : + IsSigmaSpan G H η θ_star θ₁ T_star (GM10.truncation T θ₁) where + isSurface := h.isSurface + isConnected := h.isConnected + bd_empty := h.bd_empty + isRigid := h.isRigid + isRespectful := IsRespectfulDrawingTangle.truncation h.isRespectful h1 hle + isControlling := h.isControlling.truncation h1 hle + +/-! ## Monotonicity of `μ`-Steppedness and `(λ, μ)`-Flatness -/ + +/-- If `P` is `μ₁`-stepped and `μ ≤ μ₁`, then `P` is `μ`-stepped. -/ +theorem IsMuStepped.mono {S : Type w} [TopologicalSpace S] + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {d : Set S → Set S → ℕ} {μ μ₁ : ℕ} {P : Graph α β} {u v : S} + (h : IsMuStepped G H η d μ₁ P u v) (hμ : μ ≤ μ₁) : + IsMuStepped G H η d μ P u v := + ⟨h.1, h.2.1, h.2.2.1, hμ.trans h.2.2.2⟩ + +/-- If `H, η, T` is `μ₁`-stepped and `μ ≤ μ₁`, then `H, η, T` is `μ`-stepped. -/ +theorem IsMuSteppedSpan.mono {S : Type w} [TopologicalSpace S] + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {d : Set S → Set S → ℕ} {μ μ₁ : ℕ} + (h : IsMuSteppedSpan G H η d μ₁) (hμ : μ ≤ μ₁) : + IsMuSteppedSpan G H η d μ := by + rcases h with ⟨P, u, v, hP⟩ + exact ⟨P, u, v, hP.mono hμ⟩ + +/-- If `H, η, T` is `(λ, μ)`-flat of order `θ`, `μ ≤ μ₁`, and `4λ + μ₁ + 2 ≤ θ`, then `H, η, T` is +`(λ, μ₁)`-flat (special case `λ₁ = λ, θ₁ = θ` of Graph Minors XV, (5.1), page 129). -/ +theorem IsFlatSpan.mono_mu {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ lam μ μ₁ : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hμ : μ ≤ μ₁) (hord : 4 * lam + μ₁ + 2 ≤ θ) : + IsFlatSpan G H η θ_star θ lam μ₁ T_star T where + isSpan := hFlat.isSpan + order_ge := hord + no_stepped_rearrangement _ _ _ _ _ _ hRearr hStep := + hFlat.no_stepped_rearrangement hRearr (hStep.mono hμ) + +/-! ## Metrics of Truncated Tangles -/ + +/-- A derived slope for `T` of order `θ` is also a derived slope for `GM10.truncation T θ₁` when +`θ₁ ≤ θ`. -/ +theorem isDerivedSlope_truncation {S : Type w} [TopologicalSpace S] [T2Space S] + {H K : Drawing S} {θ θ₁ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} + (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) + (hins : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hle : θ₁ ≤ θ) : + IsDerivedSlope (PaintingOrDrawing.drawing H) K θ₁ (GM10.truncation T θ₁) ins := by + intro C hC hCs hlen₁ + obtain ⟨hD, hbd, hmem⟩ := hins C hC hCs (by omega) + refine ⟨hD, hbd, hmem, ?_⟩ + obtain ⟨_, _, hcard2⟩ := circuit_props_of_preRadial hrad hC hCs + let Γ := PaintingOrDrawing.drawing H + have hsub : ((Γ.inter (ins C)) ∩ (Γ.interOutside (ins C))).vertexSet ⊆ C.U ∩ H.V := by + rintro v ⟨⟨hvV, hvΔ⟩, ⟨_, hvOut⟩⟩ + have hv_bd : v ∈ subBd (ins C) := ⟨subset_closure hvΔ, hvOut⟩ + rw [hbd] at hv_bd + exact ⟨hv_bd, hvV⟩ + have hfin : (C.U ∩ H.V).Finite := H.finite_V.subset inter_subset_right + have hle_card : separationOrder (Γ.inter (ins C)) (Γ.interOutside (ins C)) ≤ + (C.U ∩ H.V).ncard := ncard_le_ncard hsub hfin + change separationOrder (Γ.inter (ins C)) (Γ.interOutside (ins C)) < θ₁ + omega + +/-- If `ins₁` and `ins` have the same `insWalk` on closed walks of length `< 2 * θ₁` and `θ₁ ≤ θ`, +then `tangleMetric H K ins₁ θ₁ x y = min θ₁ (tangleMetric H K ins θ x y)`. -/ +theorem tangleMetric_eq_min_of_insWalk_eq {S : Type w} [TopologicalSpace S] [T1Space S] + {H K : Drawing S} (hrad : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) + {θ₁ θ : ℕ} (hle : θ₁ ≤ θ) {ins₁ ins : Drawing S → Set S} + (hins_eq : ∀ {u : S} (W : GraphWalk K.toGraph u u), + W.length < 2 * θ₁ → insWalk ins₁ K W = insWalk ins K W) + (x y : Set S) : + tangleMetric H K ins₁ θ₁ x y = min θ₁ (tangleMetric H K ins θ x y) := by + by_cases hxy : x = y + · subst hxy + simp [tangleMetric] + · apply le_antisymm + · refine le_min (tangleMetric_le_ord H K ins₁ θ₁ x y) ?_ + by_cases hlt : tangleMetric H K ins θ x y < θ₁ + · obtain ⟨u, W, x', y', hx', hy', _, hW_eq, hxW, hyW⟩ := + exists_walk_of_tangleMetric_lt hrad ins hxy (lt_of_lt_of_le hlt hle) + have hlen₁ : W.length < 2 * θ₁ := by omega + rw [← hins_eq W hlen₁] at hxW hyW + have hle2 := two_mul_tangleMetric_le_of_walk hrad ins₁ θ₁ hx' hy' W hlen₁ hxW hyW + omega + · have := tangleMetric_le_ord H K ins₁ θ₁ x y + omega + · by_cases hlt₁ : tangleMetric H K ins₁ θ₁ x y < θ₁ + · obtain ⟨u, W, x', y', hx', hy', hlen₁, hW_eq, hxW, hyW⟩ := + exists_walk_of_tangleMetric_lt hrad ins₁ hxy hlt₁ + rw [hins_eq W hlen₁] at hxW hyW + have hle2 := two_mul_tangleMetric_le_of_walk hrad ins θ hx' hy' W (by omega) hxW hyW + omega + · omega + +/-- From a metric `d` of `T` (order `θ`) and `1 ≤ θ₁ ≤ θ`, there is a metric `d₁` of +`GM10.truncation T θ₁` satisfying `d₁ x y = min θ₁ (d x y)` on atoms and on points. -/ +theorem hasTangleMetric_truncation_of_hasTangleMetric + {S : Type w} [TopologicalSpace S] [T2Space S] + {H : Drawing S} {θ θ₁ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hM : HasTangleMetric H θ T d) (h1 : 1 ≤ θ₁) (hle : θ₁ ≤ θ) : + ∃ d₁ : Set S → Set S → ℕ, + HasTangleMetric H θ₁ (GM10.truncation T θ₁) d₁ ∧ + (∀ x ∈ H.A, ∀ y ∈ H.A, d₁ x y = min θ₁ (d x y)) ∧ + (∀ σ₁ σ₂ : S, pointDist H d₁ σ₁ σ₂ = min θ₁ (pointDist H d σ₁ σ₂)) := by + obtain ⟨hRDT, K, ins, hK, hins, hd⟩ := hM + let d₁ := tangleMetric H K ins θ₁ + have hM₁ : HasTangleMetric H θ₁ (GM10.truncation T θ₁) d₁ := + ⟨IsRespectfulDrawingTangle.truncation hRDT h1 hle, K, ins, hK, + isDerivedSlope_truncation hK.2.1 hins hle, fun _ _ _ _ => rfl⟩ + have hd₁_eq : ∀ x ∈ H.A, ∀ y ∈ H.A, d₁ x y = min θ₁ (d x y) := by + intro x hx y hy + rw [hd x hx y hy] + exact tangleMetric_eq_min_of_insWalk_eq hK.2.1 hle (fun _ _ => rfl) x y + refine ⟨d₁, hM₁, hd₁_eq, fun σ₁ σ₂ => ?_⟩ + obtain ⟨a₁, ha₁, hσ₁⟩ := exists_atom_of_point H σ₁ + obtain ⟨a₂, ha₂, hσ₂⟩ := exists_atom_of_point H σ₂ + rw [pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁ hσ₂, + pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁ hσ₂, + hd₁_eq a₁ ha₁ a₂ ha₂] + +/-- Any `(λ, μ)`-flat `Σ`-span `H, η, T` of order `θ` with metric `d` and `4λ + 2 < θ` is not +`μ`-stepped (`¬ IsMuSteppedSpan G H η d μ`) (Graph Minors XV, Section 5, page 132). -/ +theorem not_isMuSteppedSpan_of_isFlatSpan {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ lam μ : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hMetric : HasTangleMetric H θ T d) + (hθ : 4 * lam + 2 < θ) : + ¬ IsMuSteppedSpan G H η d μ := by + intro ⟨P, u, v, hu, hv, hP, hdist⟩ + have : ConnectedSpace S := hFlat.isSpan.isConnected + obtain ⟨σ⟩ := (inferInstance : Nonempty S) + obtain ⟨z, hz, _⟩ := exists_atom_of_point H σ + let θ' := θ - (4 * lam + 2) + let T' := GM10.truncation T θ' + obtain ⟨d', hM', hd'_eq, hpt'_eq⟩ := + hasTangleMetric_truncation_of_hasTangleMetric (θ₁ := θ') hMetric (by omega) (Nat.sub_le _ _) + have hComp : IsLambdaCompression H H θ (4 * lam + 2) T T' d d' := by + refine ⟨hθ, hMetric, hM', fun σ₁ σ₂ => ?_⟩ + obtain ⟨a₁, ha₁, hσ₁⟩ := exists_atom_of_point H σ₁ + obtain ⟨a₂, ha₂, hσ₂⟩ := exists_atom_of_point H σ₂ + obtain ⟨_, K, ins, _, _, hd⟩ := hMetric + have hle_θ : pointDist H d σ₁ σ₂ ≤ θ := by + rw [pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁ hσ₂, hd a₁ ha₁ a₂ ha₂] + exact tangleMetric_le_ord H K ins θ a₁ a₂ + rw [hpt'_eq σ₁ σ₂] + omega + have hRearr : IsRearrangedWithin G H H η η θ_star θ lam T_star T T' d d' z := + ⟨hz, hFlat.isSpan, hFlat.isSpan.truncation (by omega) (Nat.sub_le _ _), + fun a ha _ => ha, fun w hw _ => ⟨hw, rfl⟩, fun e he _ => ⟨he, rfl⟩, hComp⟩ + have hdist' : μ ≤ d' {u} {v} := by + rw [hd'_eq {u} (Or.inl (Or.inl ⟨u, hu, rfl⟩)) {v} (Or.inl (Or.inl ⟨v, hv, rfl⟩))] + have := hFlat.order_ge + omega + exact hFlat.no_stepped_rearrangement hRearr ⟨P, u, v, hu, hv, hP, hdist'⟩ + +/-- From `IsRespectfulDrawingTangle H θ T`, `1 ≤ θ₁ ≤ θ`, and a metric `d₁` of +`GM10.truncation T θ₁`, there is a metric `d` of `T` satisfying `d₁ x y = min θ₁ (d x y)` on atoms +and on points. -/ +theorem exists_hasTangleMetric_of_truncation + {S : Type w} [TopologicalSpace S] [T2Space S] + {H : Drawing S} {θ θ₁ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d₁ : Set S → Set S → ℕ} + (hRDT : IsRespectfulDrawingTangle H θ T) (_h1 : 1 ≤ θ₁) (hle : θ₁ ≤ θ) + (hM₁ : HasTangleMetric H θ₁ (GM10.truncation T θ₁) d₁) : + ∃ d : Set S → Set S → ℕ, + HasTangleMetric H θ T d ∧ + (∀ x ∈ H.A, ∀ y ∈ H.A, d₁ x y = min θ₁ (d x y)) ∧ + (∀ σ₁ σ₂ : S, pointDist H d₁ σ₁ σ₂ = min θ₁ (pointDist H d σ₁ σ₂)) := by + obtain ⟨_, K, ins₁, hK, hins₁, hd₁⟩ := hM₁ + obtain ⟨ins₀, hins₀⟩ := exists_derivedSlope hRDT hK.2.1 + let ins : Drawing S → Set S := fun C => + open Classical in if C.length < 2 * θ₁ then ins₁ C else ins₀ C + have hins : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins := by + intro C hC hCs hlen + dsimp [ins] + split_ifs with hlt + · obtain ⟨hD, hbd, hmem, _⟩ := hins₁ C hC hCs hlt + exact ⟨hD, hbd, hmem⟩ + · exact hins₀ C hC hCs hlen + have hins_eq : ∀ {u : S} (W : GraphWalk K.toGraph u u), + W.length < 2 * θ₁ → insWalk ins₁ K W = insWalk ins K W := by + intro u W hlen₁ + unfold insWalk + ext x + simp only [insOf, mem_union, mem_iUnion, exists_prop] + refine or_congr Iff.rfl (exists_congr fun C => and_congr_right fun ⟨hC, hCs⟩ => ?_) + have hClen : C.length ≤ W.length := by + have hsub : C.E ⊆ {e | e ∈ W.edges} := by + have := hCs.2 + rwa [GM11.walkDrawing_E] at this + calc C.E.ncard ≤ ({e | e ∈ W.edges} : Set (Set S)).ncard := + Set.ncard_le_ncard hsub (List.finite_toSet _) + _ ≤ W.edges.length := by + rw [show ({e | e ∈ W.edges} : Set (Set S)) = ↑W.edges.toFinset by ext; simp, + Set.ncard_coe_finset] + exact List.toFinset_card_le _ + _ = W.length := rfl + have hlt : C.length < 2 * θ₁ := lt_of_le_of_lt hClen hlen₁ + dsimp [ins] + rw [ite_eq_left_iff.mpr fun h => (h hlt).elim] + let d := tangleMetric H K ins θ + have hM : HasTangleMetric H θ T d := + ⟨hRDT, K, ins, hK, hins, fun _ _ _ _ => rfl⟩ + have hd₁_eq : ∀ x ∈ H.A, ∀ y ∈ H.A, d₁ x y = min θ₁ (d x y) := by + intro x hx y hy + rw [hd₁ x hx y hy] + exact tangleMetric_eq_min_of_insWalk_eq hK.2.1 hle hins_eq x y + refine ⟨d, hM, hd₁_eq, fun σ₁ σ₂ => ?_⟩ + obtain ⟨a₁, ha₁, hσ₁⟩ := exists_atom_of_point H σ₁ + obtain ⟨a₂, ha₂, hσ₂⟩ := exists_atom_of_point H σ₂ + rw [pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁ hσ₂, + pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁ hσ₂, + hd₁_eq a₁ ha₁ a₂ ha₂] + +/-- If `T'` is a `(4λ + 2)`-compression of `T` in `H'` under the hypotheses of `(4.5)`, then `T'` is +a `(4λ + 2)`-compression of `T` with respect to any tangle metric `d'` of `T'`. -/ +theorem isLambdaCompression_of_hasTangleMetric + {S : Type w} [TopologicalSpace S] [T2Space S] + {H H' : Drawing S} {θ lam : ℕ} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d'_0 d' : Set S → Set S → ℕ} {z : Set S} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + (hMetric : HasTangleMetric H θ T d) (hz : z ∈ H.A) + (hlam : 2 ≤ lam) (hθ : 4 * lam + 2 < θ) + (h2cell' : (PaintingOrDrawing.drawing H').IsTwoCell) + (hAtoms : ∀ a ∈ H.A, lam < d z a → a ∈ H'.A) + (hComp₀ : IsLambdaCompression H H' θ (4 * lam + 2) T T' d d'_0) + (hM' : HasTangleMetric H' (θ - (4 * lam + 2)) T' d') : + IsLambdaCompression H H' θ (4 * lam + 2) T T' d d' := by + let H₀ := deleteAtomNeighborhood H d z lam + have hE_ne : H.E.Nonempty := by + by_contra hE + have hV_le := ncard_V_le_one_of_E_empty hS hMetric.1.1 (Set.not_nonempty_iff_eq_empty.mp hE) + have hord_le : θ ≤ H.V.ncard := hMetric.1.2.1.order_le_ncard_vertexSet + omega + have hH₀_eq : H₀ = H.span ∅ {e ∈ H.E | lam < d z e} := by + change deleteAtomNeighborhood H d z lam = _ + rw [deleteAtomNeighborhood, ite_eq_right_iff.mpr fun h => False.elim (hE_ne.ne_empty h)] + have h2cell₀ : (PaintingOrDrawing.drawing H₀).IsTwoCell := + theorem_4_3_proof H θ lam T d z hS hConn hMetric + hE_ne hz (by omega) (fun _ => hlam) + obtain ⟨hSubH₀H', T₀, T'_45, d₀, _, hComp₀_45, _, hIndEq, hUniq'⟩ := + theorem_4_5_proof H H' θ lam T d z hS hConn hMetric hz hlam hθ h2cell' hAtoms + have hT'_eq : T' = T'_45 := hUniq' T' d'_0 hComp₀ + subst hT'_eq + let θ' := θ - (4 * lam + 2) + have hIndBySub : T' = GM12.inducedBySubgraph H'.toHypergraph H₀.toHypergraph θ' T₀ := by + rw [hIndEq] + exact inducedTangle_eq_inducedBySubgraph_of_span_empty hH₀_eq hSubH₀H' + hComp₀_45.hasMetric'.1.2.1 + have h77_ii := (GraphMinor.GM12.gm15_theorem_7_7.{w} H' H₀ θ' θ' T' T₀ d' d₀ hS hConn hM' + hSubH₀H' h2cell₀ le_rfl + hComp₀_45.hasMetric').2 rfl hIndBySub + refine ⟨hθ, hMetric, hM', fun σ₁ σ₂ => ?_⟩ + obtain ⟨a₁', ha₁', hσ₁'⟩ := exists_atom_of_point H' σ₁ + obtain ⟨a₂', ha₂', hσ₂'⟩ := exists_atom_of_point H' σ₂ + obtain ⟨a₁₀, ha₁₀, hσ₁₀⟩ := exists_atom_of_point H₀ σ₁ + obtain ⟨a₂₀, ha₂₀, hσ₂₀⟩ := exists_atom_of_point H₀ σ₂ + have hsub₁ := atom_subset_of_isSubdrawing hSubH₀H' ha₁' ha₁₀ hσ₁' hσ₁₀ + have hsub₂ := atom_subset_of_isSubdrawing hSubH₀H' ha₂' ha₂₀ hσ₂' hσ₂₀ + have hle_0_d' := h77_ii a₁' ha₁' a₂' ha₂' a₁₀ ha₁₀ a₂₀ ha₂₀ hsub₁ hsub₂ + have hle_H_0 := hComp₀_45.dist_le σ₁ σ₂ + rw [pointDist_eq_of_mem_atom (d := d₀) ha₁₀ ha₂₀ hσ₁₀ hσ₂₀] at hle_H_0 + rw [pointDist_eq_of_mem_atom (d := d') ha₁' ha₂' hσ₁' hσ₂'] + omega + +/-! ## Statements and Proofs of (5.1) and (5.2) -/ + +/-- Statement of Graph Minors XV, (5.1) (page 129): +"Let $\mathscr{T}^*$ be a tangle in $G$, and let $H, \eta, \mathscr{T}$ be a $(\lambda, \mu)$-flat +$\Sigma$-span of order $\theta$. Let $0 \le \lambda_1 \le \lambda$, let $\mu_1 \ge \mu$ and let +$1 \le \theta_1 \le \theta$, such that $\theta_1 \ge 4\lambda_1 + \mu_1 + 2$; and let +$\mathscr{T}_1$ +be the $\theta_1$-truncation of $\mathscr{T}$. Then $(H, \eta, \mathscr{T}_1)$ is +$(\lambda_1, \mu_1)$-flat." +(Formalized with the side conditions `lam₁ < lam → 4 * lam + 2 < θ` and +`θ₁ - (4 * lam₁ + 2) < θ - (4 * lam + 2) → 2 ≤ lam` needed when invoking `(4.5)` on `λ`.) -/ +def GM15Theorem51Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ θ₁ lam lam₁ μ μ₁ : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))), + IsFlatSpan G H η θ_star θ lam μ T_star T → + lam₁ ≤ lam → μ ≤ μ₁ → 1 ≤ θ₁ → θ₁ ≤ θ → + 4 * lam₁ + μ₁ + 2 ≤ θ₁ → + (lam₁ < lam → 4 * lam + 2 < θ) → + (θ₁ - (4 * lam₁ + 2) < θ - (4 * lam + 2) → 2 ≤ lam) → + IsFlatSpan G H η θ_star θ₁ lam₁ μ₁ T_star (GM10.truncation T θ₁) + +/-- **Graph Minors XV, (5.1)** (page 129): +Truncation and monotonicity of `(λ, μ)`-flat `Σ`-spans. +Proved from `(4.1)`, `(4.5)`, `(4.6)`, and Graph Minors XII, `(7.7)`, `(7.10)`, `(7.11)`. -/ +theorem theorem_5_1_proof + : + GM15Theorem51Statement.{u, v, w} := by + intro S _ _ α β G H η θ_star θ θ₁ lam lam₁ μ μ₁ T_star T + hFlat hlam hμ h1 hle hord₁ hθ_gt hlam2 + refine ⟨hFlat.isSpan.truncation h1 hle, hord₁, ?_⟩ + intro H' η' T₁' d₁ d₁' z hRearr₁ hStep₁ + have hS : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + have hθ₁_lt : 4 * lam₁ + 2 < θ₁ := hRearr₁.isCompression.lam_lt + have hθ_lt : 4 * lam + 2 < θ := by + by_cases hlt : lam₁ < lam + · exact hθ_gt hlt + · omega + obtain ⟨d, hM, hd₁_eq, hpt₁_eq⟩ := + exists_hasTangleMetric_of_truncation hFlat.isSpan.isRespectful h1 hle + hRearr₁.isCompression.hasMetric + have hAtoms : ∀ a ∈ H.A, lam < d z a → a ∈ H'.A := by + intro a ha hlt + apply hRearr₁.atom_mem a ha + rw [hd₁_eq z hRearr₁.z_mem a ha] + omega + have hV : ∀ v ∈ H.V, lam < d z {v} → v ∈ H'.V ∧ η'.vMap v = η.vMap v := by + intro v hv hlt + apply hRearr₁.vMap_eq v hv + rw [hd₁_eq z hRearr₁.z_mem {v} (Or.inl (Or.inl ⟨v, hv, rfl⟩))] + omega + have hE : ∀ e ∈ H.E, lam < d z e → e ∈ H'.E ∧ η'.eMap e = η.eMap e := by + intro e he hlt + apply hRearr₁.eMap_eq e he + rw [hd₁_eq z hRearr₁.z_mem e (Or.inl (Or.inr he))] + omega + let θ' := θ - (4 * lam + 2) + let θ₁' := θ₁ - (4 * lam₁ + 2) + by_cases hOrd : θ' ≤ θ₁' + · let T' := GM10.truncation T₁' θ' + obtain ⟨d', hM', hd'_eq, hpt'_eq⟩ := + hasTangleMetric_truncation_of_hasTangleMetric hRearr₁.isCompression.hasMetric' + (by omega) hOrd + have hComp : IsLambdaCompression H H' θ (4 * lam + 2) T T' d d' := by + refine ⟨hθ_lt, hM, hM', fun σ₁ σ₂ => ?_⟩ + obtain ⟨a₁, ha₁, hσ₁⟩ := exists_atom_of_point H σ₁ + obtain ⟨a₂, ha₂, hσ₂⟩ := exists_atom_of_point H σ₂ + obtain ⟨_, K, ins, _, _, hd⟩ := hM + have hle_θ : pointDist H d σ₁ σ₂ ≤ θ := by + rw [pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁ hσ₂, hd a₁ ha₁ a₂ ha₂] + exact tangleMetric_le_ord H K ins θ a₁ a₂ + have hle_1 := hRearr₁.isCompression.dist_le σ₁ σ₂ + rw [hpt₁_eq σ₁ σ₂] at hle_1 + rw [hpt'_eq σ₁ σ₂] + omega + have hSpan' : IsSigmaSpan G H' η' θ_star θ' T_star T' := + hRearr₁.isSpan'.truncation (by omega) hOrd + have hRearr : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z := + ⟨hRearr₁.z_mem, hFlat.isSpan, hSpan', hAtoms, hV, hE, hComp⟩ + obtain ⟨P, u, v, hu, hv, hP, hdist₁⟩ := hStep₁ + have hdist' : μ ≤ d' {u} {v} := by + rw [hd'_eq {u} (Or.inl (Or.inl ⟨u, hu, rfl⟩)) {v} (Or.inl (Or.inl ⟨v, hv, rfl⟩))] + have := hFlat.order_ge + omega + exact hFlat.no_stepped_rearrangement hRearr ⟨P, u, v, hu, hv, hP, hdist'⟩ + · have hlt_ord : θ₁' < θ' := by omega + have h2lam : 2 ≤ lam := hlam2 hlt_ord + obtain ⟨_, _, T', _, d'_0, _, hComp₀, _, _⟩ := + theorem_4_5_proof H H' θ lam T d z hS hConn hM hRearr₁.z_mem h2lam hθ_lt + hRearr₁.isSpan'.isRespectful.1 hAtoms + let lam₁_tot := θ - θ₁ + (4 * lam₁ + 2) + have hθ₁'_eq : θ - lam₁_tot = θ₁' := by omega + have hComp₁_tot : IsLambdaCompression H H' θ lam₁_tot T T₁' d d₁' := by + refine ⟨by omega, hM, hθ₁'_eq ▸ hRearr₁.isCompression.hasMetric', fun σ₁ σ₂ => ?_⟩ + obtain ⟨a₁, ha₁, hσ₁⟩ := exists_atom_of_point H σ₁ + obtain ⟨a₂, ha₂, hσ₂⟩ := exists_atom_of_point H σ₂ + obtain ⟨_, K, ins, _, _, hd⟩ := hM + have hle_θ : pointDist H d σ₁ σ₂ ≤ θ := by + rw [pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁ hσ₂, hd a₁ ha₁ a₂ ha₂] + exact tangleMetric_le_ord H K ins θ a₁ a₂ + have hle_1 := hRearr₁.isCompression.dist_le σ₁ σ₂ + rw [hpt₁_eq σ₁ σ₂] at hle_1 + omega + obtain ⟨hRDT₁', K₁', ins₁', hK₁', hins₁', hd₁'_tm⟩ := hRearr₁.isCompression.hasMetric' + obtain ⟨ins'_0, hins'_0⟩ := exists_derivedSlope hComp₀.hasMetric'.1 hK₁'.2.1 + let d'_K₁' := tangleMetric H' K₁' ins'_0 θ' + have hM'_K₁' : HasTangleMetric H' θ' T' d'_K₁' := + ⟨hComp₀.hasMetric'.1, K₁', ins'_0, hK₁', hins'_0, fun _ _ _ _ => rfl⟩ + have hComp_K₁' : IsLambdaCompression H H' θ (4 * lam + 2) T T' d d'_K₁' := + isLambdaCompression_of_hasTangleMetric hS hConn hM hRearr₁.z_mem + h2lam hθ_lt hRearr₁.isSpan'.isRespectful.1 hAtoms hComp₀ hM'_K₁' + have hSub_T : T₁' ⊆ T' := + (theorem_4_1_proof H H' H' K₁' K₁' θ lam₁_tot (4 * lam + 2) T T₁' T' d d₁' d'_K₁' + ins₁' ins'_0 hS hComp₁_tot hComp_K₁' hK₁' (hθ₁'_eq ▸ hins₁') + (by intro x hx y hy; rw [hd₁'_tm x hx y hy, hθ₁'_eq]) + hK₁' hins'_0 (fun _ _ _ _ => rfl)).2 rfl rfl (by omega) + have hTrunc_eq : T₁' = GM10.truncation T' θ₁' := + ((GM10.subset_iff_truncation hComp₀.hasMetric'.1.2.1 hRDT₁'.2.1).mp hSub_T).2 + have hM₁'_trunc : HasTangleMetric H' θ₁' (GM10.truncation T' θ₁') d₁' := + hTrunc_eq ▸ hRearr₁.isCompression.hasMetric' + obtain ⟨d', hM', hd₁'_eq, _⟩ := + exists_hasTangleMetric_of_truncation hComp₀.hasMetric'.1 hRDT₁'.2.1.one_le + (by omega) hM₁'_trunc + have hComp' : IsLambdaCompression H H' θ (4 * lam + 2) T T' d d' := + isLambdaCompression_of_hasTangleMetric hS hConn hM hRearr₁.z_mem + h2lam hθ_lt hRearr₁.isSpan'.isRespectful.1 hAtoms hComp₀ hM' + have hRearr : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z := + theorem_4_6_proof G H H' η η' θ_star θ lam T_star T T' d d' z + hFlat.isSpan hM hRearr₁.z_mem h2lam hθ_lt hRearr₁.isSpan'.isRigid + hRearr₁.isSpan'.isRespectful.1 hAtoms hV hE hComp' + obtain ⟨P, u, v, hu, hv, hP, hdist₁⟩ := hStep₁ + have hdist' : μ ≤ d' {u} {v} := by + have heq := hd₁'_eq {u} (Or.inl (Or.inl ⟨u, hu, rfl⟩)) {v} (Or.inl (Or.inl ⟨v, hv, rfl⟩)) + omega + exact hFlat.no_stepped_rearrangement hRearr ⟨P, u, v, hu, hv, hP, hdist'⟩ + +/-! ## Helper Lemmas on Truncating Rearrangements, Paths, and 2-Cell Connectivity -/ + +/-- If `H', η', T'` is obtained from `H, η, T` by rearranging within `λ₁` of `z₁ ∈ A(H)`, and +`z₃ ∈ A(H)` satisfies `d(z₁, z₃) ≤ λ₂ - λ₁` with `λ₁ ≤ λ₂` and `4λ₂ + 2 < θ`, then the +`(θ - (4λ₂ + 2))`-truncation `T''` of `T'` makes `H', η', T''` a `Σ`-span obtained from `H, η, T` +by rearranging within `λ₂` of `z₃`. -/ +theorem IsRearrangedWithin.truncation_of_dist_le + {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H H' : Drawing S} {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} + {θ_star θ lam₁ lam₂ : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z₁ z₃ : Set S} + (hRearr : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hz₃ : z₃ ∈ H.A) (hlam : lam₁ ≤ lam₂) (hdist_z : d z₁ z₃ ≤ lam₂ - lam₁) + (hθ_lt : 4 * lam₂ + 2 < θ) : + ∃ d'' : Set S → Set S → ℕ, + IsRearrangedWithin G H H' η η' θ_star θ lam₂ T_star T + (GM10.truncation T' (θ - (4 * lam₂ + 2))) d d'' z₃ ∧ + (∀ a ∈ H'.A, ∀ b ∈ H'.A, d'' a b = min (θ - (4 * lam₂ + 2)) (d' a b)) ∧ + (∀ σ₁ σ₂ : S, + pointDist H' d'' σ₁ σ₂ = min (θ - (4 * lam₂ + 2)) (pointDist H' d' σ₁ σ₂)) := by + have hS : IsClosedSurface S := + ⟨hRearr.isSpan.isSurface.1, hRearr.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hRearr.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hRearr.isSpan.isConnected + obtain ⟨_, _, _, hd_symm, hd_tri, _⟩ := + gm11_theorem_9_1 H θ T d hS hConn hRearr.isCompression.hasMetric + have hsymm_z : d z₃ z₁ = d z₁ z₃ := hd_symm z₃ hz₃ z₁ hRearr.z_mem + let θ₂' := θ - (4 * lam₂ + 2) + have h1 : 1 ≤ θ₂' := by omega + have hle : θ₂' ≤ θ - (4 * lam₁ + 2) := by omega + obtain ⟨d'', hM'', hd''_eq, hpt''_eq⟩ := + hasTangleMetric_truncation_of_hasTangleMetric hRearr.isCompression.hasMetric' h1 hle + refine ⟨d'', ⟨hz₃, hRearr.isSpan, hRearr.isSpan'.truncation h1 hle, ?_, ?_, ?_, ?_⟩, + hd''_eq, hpt''_eq⟩ + · intro a ha hlt + have htri := hd_tri z₃ hz₃ z₁ hRearr.z_mem a ha + have hlt₁ : lam₁ < d z₁ a := by omega + exact hRearr.atom_mem a ha hlt₁ + · intro v hv hlt + have htri := hd_tri z₃ hz₃ z₁ hRearr.z_mem {v} (Or.inl (Or.inl ⟨v, hv, rfl⟩)) + have hlt₁ : lam₁ < d z₁ {v} := by omega + exact hRearr.vMap_eq v hv hlt₁ + · intro e he hlt + have htri := hd_tri z₃ hz₃ z₁ hRearr.z_mem e (Or.inl (Or.inr he)) + have hlt₁ : lam₁ < d z₁ e := by omega + exact hRearr.eMap_eq e he hlt₁ + · refine ⟨hθ_lt, hRearr.isCompression.hasMetric, hM'', fun σ₁ σ₂ => ?_⟩ + obtain ⟨a₁, ha₁, hσ₁⟩ := exists_atom_of_point H σ₁ + obtain ⟨a₂, ha₂, hσ₂⟩ := exists_atom_of_point H σ₂ + obtain ⟨_, K, ins, _, _, hd⟩ := hRearr.isCompression.hasMetric + have hle_θ : pointDist H d σ₁ σ₂ ≤ θ := by + rw [pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁ hσ₂, hd a₁ ha₁ a₂ ha₂] + exact tangleMetric_le_ord H K ins θ a₁ a₂ + have hle_1 := hRearr.isCompression.dist_le σ₁ σ₂ + rw [hpt''_eq σ₁ σ₂] + omega + +/-- Any walk `W` from `u` to `v` that meets a set `X` can be split at the first vertex `x ∈ X` +along `W`. -/ +theorem exists_first_append_of_mem_set {G : Graph α β} {u v : α} (W : GraphWalk G u v) + {X : Set α} (hne : ∃ z ∈ W.support, z ∈ X) : + ∃ (x : α) (W₁ : GraphWalk G u x) (W₂ : GraphWalk G x v), + x ∈ X ∧ W = W₁.append W₂ ∧ ∀ y ∈ W₁.support, y ∈ X → y = x := by + induction W with + | @nil u₀ h => + obtain ⟨z, hz, hzX⟩ := hne + simp only [GraphWalk.support_nil, List.mem_singleton] at hz + subst hz + refine ⟨z, .nil h, .nil h, hzX, rfl, fun y hy _ => ?_⟩ + simpa [GraphWalk.support_nil] using hy + | cons h r ih => + rename_i u₁ v₁ w₁ e + by_cases huX : u₁ ∈ X + · refine ⟨u₁, .nil h.left_mem, .cons h r, huX, rfl, fun y hy _ => ?_⟩ + simpa [GraphWalk.support_nil] using hy + · have hne' : ∃ z ∈ r.support, z ∈ X := by + obtain ⟨z, hz, hzX⟩ := hne + rcases List.mem_cons.mp hz with rfl | hz + · exact absurd hzX huX + · exact ⟨z, hz, hzX⟩ + obtain ⟨x, W₁, W₂, hxX, rfl, hfirst⟩ := ih hne' + refine ⟨x, .cons h W₁, W₂, hxX, rfl, fun y hy hyX => ?_⟩ + rcases List.mem_cons.mp hy with rfl | hy + · exact absurd hyX huX + · exact hfirst y hy hyX + +/-- If `P` is a path in `G` from `a` to `b` and `(V(P) ∩ X).Nonempty`, then `P` splits at the first +vertex `x ∈ V(P) ∩ X` into `P₁` (from `a` to `x`) and `P₂` (from `x` to `b`) with +`V(P₁) ∩ X = {x}`. -/ +theorem _root_.GraphMinor.GM09.IsGraphPathWithEnds.exists_first_split_of_nonempty + {G P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) {X : Set α} (hne : (V(P) ∩ X).Nonempty) : + ∃ (x : α) (P₁ P₂ : Graph α β), + x ∈ V(P) ∧ x ∈ X ∧ + P₁ ≤ P ∧ P₂ ≤ P ∧ + IsGraphPathWithEnds P P₁ a x ∧ IsGraphPathWithEnds P P₂ x b ∧ + subgraphUnion P P₁ P₂ = P ∧ + V(P₁) ∩ V(P₂) = {x} ∧ Disjoint E(P₁) E(P₂) ∧ + V(P₁) ∩ X = {x} := by + obtain ⟨_, W, hW, hVP, hEP⟩ := id hP + obtain ⟨z, hzP, hzX⟩ := hne + have hzW : z ∈ W.support := by rwa [hVP] at hzP + obtain ⟨x, W₁, W₂, hxX, rfl, hfirst⟩ := exists_first_append_of_mem_set W ⟨z, hzW, hzX⟩ + have hxP : x ∈ V(P) := by + rw [hVP, mem_ofPred_eq, GraphWalk.mem_support_append] + exact Or.inl W₁.end_mem_support + have hsp := isSimple_of_append hW + let P₁ := walkSubgraph W₁ + let P₂ := walkSubgraph W₂ + have hP₁P : P₁ ≤ P := walkSubgraph_le W₁ + have hP₂P : P₂ ≤ P := walkSubgraph_le W₂ + have hP₁ : IsGraphPathWithEnds P P₁ a x := isGraphPathWithEnds_walkSubgraph hsp.1 + have hP₂ : IsGraphPathWithEnds P P₂ x b := isGraphPathWithEnds_walkSubgraph hsp.2 + have hnd_V : (W₁.support ++ W₂.support.tail).Nodup := by + have h' : (W₁.append W₂).support.Nodup := hW + rwa [GraphWalk.support_append] at h' + have hd_V := List.nodup_append.mp hnd_V + have hnd_E : (W₁.edges ++ W₂.edges).Nodup := by + have h' : (W₁.append W₂).edges.Nodup := hW.edges_nodup + rwa [GraphWalk.edges_append] at h' + have hd_E := List.nodup_append.mp hnd_E + refine ⟨x, P₁, P₂, hxP, hxX, hP₁P, hP₂P, hP₁, hP₂, ?_, ?_, ?_, ?_⟩ + · refine (Compatible.of_le_le (subgraphUnion_le hP₁P hP₂P) le_rfl).ext ?_ ?_ + · rw [vertexSet_subgraphUnion, vertexSet_walkSubgraph, vertexSet_walkSubgraph, hVP] + ext y + simp [GraphWalk.mem_support_append] + · rw [edgeSet_subgraphUnion hP₁P hP₂P, edgeSet_walkSubgraph, edgeSet_walkSubgraph, hEP] + ext e + simp [GraphWalk.edges_append] + · rw [vertexSet_walkSubgraph, vertexSet_walkSubgraph] + ext y + simp only [mem_inter_iff, mem_ofPred_eq, mem_singleton_iff] + constructor + · rintro ⟨hy₁, hy₂⟩ + rw [W₂.support_eq_cons] at hy₂ + rcases List.mem_cons.mp hy₂ with rfl | hy₂ + · rfl + · exact False.elim (hd_V.2.2 y hy₁ y hy₂ rfl) + · rintro rfl + exact ⟨W₁.end_mem_support, W₂.start_mem_support⟩ + · rw [edgeSet_walkSubgraph, edgeSet_walkSubgraph] + exact disjoint_left.mpr fun e he₁ he₂ => hd_E.2.2 e he₁ e he₂ rfl + · rw [vertexSet_walkSubgraph] + ext y + simp only [mem_inter_iff, mem_ofPred_eq, mem_singleton_iff] + refine ⟨fun ⟨hy₁, hyX⟩ => hfirst y hy₁ hyX, ?_⟩ + rintro rfl + exact ⟨W₁.end_mem_support, hxX⟩ + +/-- A path in a graph contains no loop edge. -/ +theorem _root_.GraphMinor.GM09.IsGraphPathWithEnds.not_isLink_self + {G P : Graph α β} {a b x : α} {e : β} + (hP : IsGraphPathWithEnds G P a b) : ¬ P.IsLink e x x := by + obtain ⟨_, W, hW, hVP, hEP⟩ := hP + intro hlink + have he : e ∈ W.edges := by + have : e ∈ E(P) := hlink.edge_mem + rwa [hEP] at this + have hnd : W.support.Nodup := hW + clear hW hVP hEP + induction W with + | nil _ => simp at he + | cons h r ih => + rcases List.mem_cons.mp he with rfl | he + · rcases h.eq_and_eq_or_eq_and_eq hlink with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact (List.nodup_cons.mp hnd).1 r.start_mem_support + · exact (List.nodup_cons.mp hnd).1 r.start_mem_support + · exact ih he (List.nodup_cons.mp hnd).2 + +/-- If `R₁` is an `H_sub`-path with ends `a₁, b₁` and `R₂` is an `H_sub`-path with ends `a₂, b₂`, +`{a₁, b₁}` and `{a₂, b₂}` are disjoint, and `(V(R₁) ∩ V(R₂)).Nonempty`, then there is an +`H_sub`-path `P` in `G` with ends `a₁` and `b₂` such that `V(P) ⊆ V(R₁) ∪ V(R₂)` and +`E(P) ⊆ E(R₁) ∪ E(R₂)`. -/ +theorem exists_isHPathWithEnds_of_inter_nonempty {G H_sub R₁ R₂ : Graph α β} {a₁ b₁ a₂ b₂ : α} + (hR₁ : IsHPathWithEnds G H_sub R₁ a₁ b₁) (hR₂ : IsHPathWithEnds G H_sub R₂ a₂ b₂) + (hdisj_ends : Disjoint ({a₁, b₁} : Set α) {a₂, b₂}) + (hne : (V(R₁) ∩ V(R₂)).Nonempty) : + ∃ P : Graph α β, + IsHPathWithEnds G H_sub P a₁ b₂ ∧ + V(P) ⊆ V(R₁) ∪ V(R₂) ∧ E(P) ⊆ E(R₁) ∪ E(R₂) := by + obtain ⟨x, P₁, P₂, hxR₁, hxR₂, hP₁_le, hP₂_le, hP₁, hP₂, hunion₁, hinter₁, _, hP₁_R₂⟩ := + hR₁.2.1.exists_first_split_of_nonempty hne + obtain ⟨Q₁, Q₂, hQ₁_le, hQ₂_le, hQ₁, hQ₂, hunion₂, hinter₂, _⟩ := + hR₂.2.1.exists_split_at hxR₂ + have hx_notH : x ∉ V(H_sub) := by + intro hxH + have hx₁ : x ∈ ({a₁, b₁} : Set α) := hR₁.2.2.2.2.2.1 ▸ ⟨hxR₁, hxH⟩ + have hx₂ : x ∈ ({a₂, b₂} : Set α) := hR₂.2.2.2.2.2.1 ▸ ⟨hxR₂, hxH⟩ + exact Set.disjoint_left.mp hdisj_ends hx₁ hx₂ + have hP₁G : P₁ ≤ G := hP₁_le.trans hR₁.2.1.le + have hQ₂G : Q₂ ≤ G := hQ₂_le.trans hR₂.2.1.le + have hVQ : V(P₁) ∩ V(Q₂) = {x} := by + apply Set.Subset.antisymm + · rw [← hP₁_R₂] + exact inter_subset_inter_right _ hQ₂_le.vertexSet_mono + · rw [singleton_subset_iff] + exact ⟨hP₁.right_mem, hQ₂.left_mem⟩ + let P := subgraphUnion G P₁ Q₂ + have hP_path : IsGraphPathWithEnds G P a₁ b₂ := + (hP₁.mono hR₁.2.1.le).subgraphUnion (hQ₂.mono hR₂.2.1.le) hVQ + have hb₁_not : b₁ ∉ V(P₁) := by + intro hb₁P₁ + have hb₁_x : b₁ = x := by + have : b₁ ∈ V(P₁) ∩ V(P₂) := ⟨hb₁P₁, hP₂.right_mem⟩ + rwa [hinter₁, mem_singleton_iff] at this + exact hx_notH (hb₁_x ▸ hR₁.2.2.2.2.1) + have ha₂_not : a₂ ∉ V(Q₂) := by + intro ha₂Q₂ + have ha₂_x : a₂ = x := by + have : a₂ ∈ V(Q₁) ∩ V(Q₂) := ⟨hQ₁.left_mem, ha₂Q₂⟩ + rwa [hinter₂, mem_singleton_iff] at this + exact hx_notH (ha₂_x ▸ hR₂.2.2.2.1) + have hVP : V(P) ∩ V(H_sub) = {a₁, b₂} := by + rw [vertexSet_subgraphUnion] + apply Set.Subset.antisymm + · rintro y ⟨hy₁ | hy₂, hyH⟩ + · have hy_ab : y ∈ ({a₁, b₁} : Set α) := + hR₁.2.2.2.2.2.1 ▸ ⟨hP₁_le.vertexSet_mono hy₁, hyH⟩ + rcases hy_ab with rfl | rfl + · exact Or.inl rfl + · exact (hb₁_not hy₁).elim + · have hy_ab : y ∈ ({a₂, b₂} : Set α) := + hR₂.2.2.2.2.2.1 ▸ ⟨hQ₂_le.vertexSet_mono hy₂, hyH⟩ + rcases hy_ab with rfl | rfl + · exact (ha₂_not hy₂).elim + · exact Or.inr rfl + · rintro y (rfl | rfl) + · exact ⟨Or.inl hP₁.left_mem, hR₁.2.2.2.1⟩ + · exact ⟨Or.inr hQ₂.right_mem, hR₂.2.2.2.2.1⟩ + have hEP_sub : E(P) ⊆ E(R₁) ∪ E(R₂) := by + rw [edgeSet_subgraphUnion hP₁G hQ₂G] + exact union_subset_union hP₁_le.edgeSet_mono hQ₂_le.edgeSet_mono + have hEP_disj : Disjoint E(P) E(H_sub) := by + rw [edgeSet_subgraphUnion hP₁G hQ₂G, disjoint_union_left] + exact ⟨hR₁.2.2.2.2.2.2.mono_left hP₁_le.edgeSet_mono, + hR₂.2.2.2.2.2.2.mono_left hQ₂_le.edgeSet_mono⟩ + have ha₁_ne_b₂ : a₁ ≠ b₂ := fun h => + Set.disjoint_left.mp hdisj_ends (Or.inl rfl) (h ▸ Or.inr rfl) + refine ⟨P, ⟨hR₁.1, hP_path, ha₁_ne_b₂, hR₁.2.2.2.1, hR₂.2.2.2.2.1, hVP, hEP_disj⟩, ?_, hEP_sub⟩ + rw [vertexSet_subgraphUnion] + exact union_subset_union hP₁_le.vertexSet_mono hQ₂_le.vertexSet_mono + +/-- In a drawing `H` on a connected closed surface `S`, every point of `S` lies in the closure of +some region of `H`. -/ +theorem exists_region_closure_mem_of_closedSurface {S : Type w} [TopologicalSpace S] [T2Space S] + [ConnectedSpace S] (hS : IsClosedSurface S) (H : Drawing S) (x : S) : + ∃ r ∈ H.R, x ∈ closure r := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hfin : H.R.Finite := GM11.finite_R hS H + by_contra hnot + push Not at hnot + have hcl : IsClosed (⋃ r ∈ H.R, closure r) := + hfin.isClosed_biUnion fun r _ => isClosed_closure + have hx : x ∈ (⋃ r ∈ H.R, closure r)ᶜ := by + simp only [mem_compl_iff, mem_iUnion, not_exists] + exact hnot + obtain ⟨y, hyO, hyU⟩ := + GM11.exists_notMem_U (Γ := H) hS hcl.isOpen_compl ⟨x, hx⟩ + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem hyU + exact hyO (mem_iUnion₂.mpr ⟨r, hr, subset_closure hyr⟩) + +/-- If `Γ` is a 2-cell drawing in a connected closed surface `S` with `Γ.E.Nonempty`, then +`Γ.toGraph` is connected: between any two vertices `a, b ∈ Γ.V`, there is a walk in `Γ.toGraph`. -/ +theorem twoCell_toGraph_connected {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) {Γ : Drawing S} (h2cell : (PaintingOrDrawing.drawing Γ).IsTwoCell) + (hE : Γ.E.Nonempty) {a b : S} (ha : a ∈ Γ.V) (hb : b ∈ Γ.V) : + Nonempty (GraphWalk Γ.toGraph a b) := by + classical + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + by_contra hno + let V₁ : Set S := {u ∈ Γ.V | Nonempty (GraphWalk Γ.toGraph a u)} + let V₂ : Set S := Γ.V \ V₁ + have haV₁ : a ∈ V₁ := ⟨ha, ⟨.nil ha⟩⟩ + have hbV₂ : b ∈ V₂ := ⟨hb, fun ⟨_, hW⟩ => hno hW⟩ + have hEnds : ∀ e ∈ Γ.E, ∀ u ∈ Γ.V, ∀ v ∈ Γ.V, + u ∈ closure e → v ∈ closure e → u ∈ V₁ → v ∈ V₁ := by + intro e he u hu v hv hue hve ⟨_, ⟨W⟩⟩ + by_cases huv : u = v + · exact huv ▸ ⟨hu, ⟨W⟩⟩ + · have hpair : closure e ∩ Γ.V = {u, v} := by + rcases Γ.edge_cond e he with ⟨x, y, _, hcl, _⟩ | ⟨x, hcl, _⟩ + · have hu_xy : u ∈ ({x, y} : Set S) := hcl ▸ ⟨hue, hu⟩ + have hv_xy : v ∈ ({x, y} : Set S) := hcl ▸ ⟨hve, hv⟩ + rw [hcl] + rcases hu_xy with rfl | rfl <;> rcases hv_xy with rfl | rfl + · exact False.elim (huv rfl) + · rfl + · exact Set.pair_comm _ _ + · exact False.elim (huv rfl) + · have hu_x : u = x := by + have : u ∈ ({x} : Set S) := hcl ▸ ⟨hue, hu⟩ + simpa using this + have hv_x : v = x := by + have : v ∈ ({x} : Set S) := hcl ▸ ⟨hve, hv⟩ + simpa using this + exact False.elim (huv (hu_x.trans hv_x.symm)) + have hlink : Γ.toGraph.IsLink e u v := ⟨he, hu, hv, hpair⟩ + exact ⟨hv, ⟨W.append (.cons hlink (.nil hv))⟩⟩ + let E₁ : Set (Set S) := {e ∈ Γ.E | ∃ u ∈ V₁, u ∈ closure e} + let E₂ : Set (Set S) := Γ.E \ E₁ + obtain ⟨K, hK⟩ := GM11.exists_radialDrawing hS h2cell + have hrad : GM11.PreRad (PaintingOrDrawing.drawing Γ) K := ⟨hK.1, hK.2.1⟩ + have hmax : GM11.RadMax (PaintingOrDrawing.drawing Γ) K := hK.2.2 + let H_rad := GM11.radialUnion hrad + have hfinR : H_rad.R.Finite := GM11.finite_R hS H_rad + let P₁ : Set (Set S) := {p ∈ H_rad.R | ∃ e ∈ E₁, e ⊆ closure p} + let P₂ : Set (Set S) := {p ∈ H_rad.R | ∃ e ∈ E₂, e ⊆ closure p} + have hP_union : ∀ p ∈ H_rad.R, p ∈ P₁ ∨ p ∈ P₂ := by + intro p hp + obtain ⟨e, he, hep, _, _⟩ := GM11.face_edge hrad hS hmax hE hp + by_cases he₁ : e ∈ E₁ + · exact Or.inl ⟨hp, e, he₁, hep⟩ + · exact Or.inr ⟨hp, e, ⟨he, he₁⟩, hep⟩ + let W₁ : Set S := ⋃ p ∈ P₁, closure p + let W₂ : Set S := ⋃ p ∈ P₂, closure p + have hP₁fin : P₁.Finite := hfinR.subset fun _ h => h.1 + have hP₂fin : P₂.Finite := hfinR.subset fun _ h => h.1 + have hW₁_cl : IsClosed W₁ := hP₁fin.isClosed_biUnion fun _ _ => isClosed_closure + have hW₂_cl : IsClosed W₂ := hP₂fin.isClosed_biUnion fun _ _ => isClosed_closure + let Hubs : Set S := K.V \ Γ.V + have hHubs_fin : Hubs.Finite := K.finite_V.subset sdiff_subset + have hConn_compl : IsPreconnected Hubsᶜ := GM11.isPreconnected_compl_finite hS hHubs_fin + have hcov : Hubsᶜ ⊆ W₁ ∪ W₂ := by + intro x _ + obtain ⟨p, hp, hxp⟩ := exists_region_closure_mem_of_closedSurface hS H_rad x + rcases hP_union p hp with hp₁ | hp₂ + · exact Or.inl (mem_iUnion₂.mpr ⟨p, hp₁, hxp⟩) + · exact Or.inr (mem_iUnion₂.mpr ⟨p, hp₂, hxp⟩) + have hdisj : Disjoint (Hubsᶜ ∩ W₁) (Hubsᶜ ∩ W₂) := by + refine Set.disjoint_left.mpr ?_ + rintro x ⟨hxH, hx₁⟩ ⟨_, hx₂⟩ + obtain ⟨p₁, ⟨hp₁, e₁, he₁, he₁p₁⟩, hxp₁⟩ := mem_iUnion₂.mp hx₁ + obtain ⟨p₂, ⟨hp₂, e₂, he₂, he₂p₂⟩, hxp₂⟩ := mem_iUnion₂.mp hx₂ + obtain ⟨f₁, hf₁, hf₁p₁, huniq₁, hv₁⟩ := GM11.face_edge hrad hS hmax hE hp₁ + obtain ⟨f₂, hf₂, hf₂p₂, huniq₂, hv₂⟩ := GM11.face_edge hrad hS hmax hE hp₂ + have he₁_eq : e₁ = f₁ := huniq₁ e₁ he₁.1 he₁p₁ + have he₂_eq : e₂ = f₂ := huniq₂ e₂ he₂.1 he₂p₂ + have hp_ne : p₁ ≠ p₂ := by + rintro rfl + have hf_eq : f₁ = f₂ := (huniq₁ f₂ hf₂ hf₂p₂).symm + have he_eq : e₂ = e₁ := he₂_eq.trans (hf_eq.symm.trans he₁_eq.symm) + exact he₂.2 (he_eq ▸ he₁) + have hxU : x ∈ H_rad.U := by + by_contra hnotU + obtain ⟨q, hq, hxq⟩ := exists_region_of_notMem hnotU + obtain ⟨y₁, hy₁q, hy₁p₁⟩ := mem_closure_iff.mp hxp₁ q (region_isOpen hq) hxq + obtain ⟨y₂, hy₂q, hy₂p₂⟩ := mem_closure_iff.mp hxp₂ q (region_isOpen hq) hxq + have hqp₁ : q = p₁ := region_eq_of_mem hq hp₁ hy₁q hy₁p₁ + have hqp₂ : q = p₂ := region_eq_of_mem hq hp₂ hy₂q hy₂p₂ + exact hp_ne (hqp₁.symm.trans hqp₂) + have hnot_V : ∀ v ∈ Γ.V, ¬ (v ∈ closure p₁ ∧ v ∈ closure p₂) := by + rintro v hv ⟨hvp₁, hvp₂⟩ + have hve₁ : v ∈ closure e₁ := he₁_eq ▸ hv₁ v hv hvp₁ + have hve₂ : v ∈ closure e₂ := he₂_eq ▸ hv₂ v hv hvp₂ + obtain ⟨u₁, hu₁V₁, hu₁e₁⟩ := he₁.2 + have hvV₁ : v ∈ V₁ := hEnds e₁ he₁.1 u₁ hu₁V₁.1 v hv hu₁e₁ hve₁ hu₁V₁ + exact he₂.2 ⟨he₂.1, v, hvV₁, hve₂⟩ + by_cases hxKV : x ∈ K.V + · have hxΓV : x ∈ Γ.V := by + by_contra hxnot + exact hxH ⟨hxKV, hxnot⟩ + exact hnot_V x hxΓV ⟨hxp₁, hxp₂⟩ + · have hxH_radV : x ∉ H_rad.V := by + rw [GM11.radialUnion_V] + exact hxKV + rw [H_rad.U_eq, GM11.radialUnion_V] at hxU + rcases hxU with hxKV' | hxE + · exact hxKV hxKV' + · obtain ⟨g, hg, hxg_cl⟩ := mem_iUnion₂.mp hxE + have hxg : x ∈ g := (H_rad.closure_diff_V hg).subset ⟨hxg_cl, hxH_radV⟩ + have hgp₁ : g ⊆ closure p₁ := + GM11.edge_subset_closure_of_incident hS hg hp₁ ⟨x, hxg, hxp₁⟩ + have hgp₂ : g ⊆ closure p₂ := + GM11.edge_subset_closure_of_incident hS hg hp₂ ⟨x, hxg, hxp₂⟩ + rw [GM11.radialUnion_E] at hg + rcases hg with hgΓ | hgK + · have hg_f₁ : g = f₁ := huniq₁ g hgΓ hgp₁ + have hg_f₂ : g = f₂ := huniq₂ g hgΓ hgp₂ + exact he₂.2 (he₂_eq.trans (hg_f₂.symm.trans (hg_f₁.trans he₁_eq.symm)) ▸ he₁) + · obtain ⟨v, hv, _, _, _, _, _, hcap, _⟩ := GM11.spoke_ends hrad hS hgK + have hvg : v ∈ closure g := by + have : v ∈ closure g ∩ K.V := by rw [hcap]; simp + exact this.1 + exact hnot_V v hv ⟨closure_minimal hgp₁ isClosed_closure hvg, + closure_minimal hgp₂ isClosed_closure hvg⟩ + have ha_mem : a ∈ Hubsᶜ ∩ W₁ := by + refine ⟨fun h => h.2 ha, ?_⟩ + obtain ⟨p, hp, hap⟩ := exists_region_closure_mem_of_closedSurface hS H_rad a + obtain ⟨f, hf, hfp, _, hvf⟩ := GM11.face_edge hrad hS hmax hE hp + exact mem_iUnion₂.mpr ⟨p, ⟨hp, f, ⟨hf, a, haV₁, hvf a ha hap⟩, hfp⟩, hap⟩ + have hb_mem : b ∈ Hubsᶜ ∩ W₂ := by + refine ⟨fun h => h.2 hb, ?_⟩ + obtain ⟨p, hp, hbp⟩ := exists_region_closure_mem_of_closedSurface hS H_rad b + obtain ⟨f, hf, hfp, _, hvf⟩ := GM11.face_edge hrad hS hmax hE hp + have hfE₂ : f ∈ E₂ := by + refine ⟨hf, ?_⟩ + rintro ⟨_, u, huV₁, huf⟩ + exact hbV₂.2 (hEnds f hf u huV₁.1 b hb huf (hvf b hb hbp) huV₁) + exact mem_iUnion₂.mpr ⟨p, ⟨hp, f, hfE₂, hfp⟩, hbp⟩ + have hcov' : Hubsᶜ ⊆ W₂ᶜ ∪ W₁ᶜ := by + intro x hx + rcases hcov hx with hx₁ | hx₂ + · exact Or.inl fun hx₂ => Set.disjoint_left.mp hdisj ⟨hx, hx₁⟩ ⟨hx, hx₂⟩ + · exact Or.inr fun hx₁ => Set.disjoint_left.mp hdisj ⟨hx, hx₁⟩ ⟨hx, hx₂⟩ + have hdisj' : Disjoint (Hubsᶜ ∩ W₂ᶜ) (Hubsᶜ ∩ W₁ᶜ) := by + refine Set.disjoint_left.mpr ?_ + rintro x ⟨hx, hxnot₂⟩ ⟨_, hxnot₁⟩ + rcases hcov hx with hx₁ | hx₂ + · exact hxnot₁ hx₁ + · exact hxnot₂ hx₂ + have ha_open : a ∈ Hubsᶜ ∩ W₂ᶜ := + ⟨ha_mem.1, fun ha₂ => Set.disjoint_left.mp hdisj ha_mem ⟨ha_mem.1, ha₂⟩⟩ + have hb_open : b ∈ Hubsᶜ ∩ W₁ᶜ := + ⟨hb_mem.1, fun hb₁ => Set.disjoint_left.mp hdisj ⟨hb_mem.1, hb₁⟩ hb_mem⟩ + obtain ⟨x, hxH, hxnot₂, hxnot₁⟩ := + hConn_compl W₂ᶜ W₁ᶜ hW₂_cl.isOpen_compl hW₁_cl.isOpen_compl hcov' ⟨a, ha_open⟩ ⟨b, hb_open⟩ + rcases hcov hxH with hx₁ | hx₂ + · exact hxnot₁ hx₁ + · exact hxnot₂ hx₂ + +/-- For `η : SpanEmbedding Γ G`, `e ∈ Γ.E`, and distinct `u, v ∈ Γ.V`, `η.eMap e` links +`η.vMap u` and `η.vMap v` in `η.imageGraph` if and only if `e` links `u` and `v` in `Γ.toGraph`. -/ +theorem _root_.GraphMinor.GM14.SpanEmbedding.isLink_iff_of_ne {S : Type w} [TopologicalSpace S] + {G : Graph α β} {Γ : Drawing S} (η : SpanEmbedding Γ G) + {e : Set S} (he : e ∈ Γ.E) {u v : S} (hu : u ∈ Γ.V) (hv : v ∈ Γ.V) (huv : u ≠ v) : + η.imageGraph.IsLink (η.eMap e) (η.vMap u) (η.vMap v) ↔ Γ.toGraph.IsLink e u v := by + constructor + · intro hlink + have hue : u ∈ closure e := (η.inc_iff e he u hu).mp hlink.inc_left + have hve : v ∈ closure e := (η.inc_iff e he v hv).mp hlink.inc_right + have hpair : closure e ∩ Γ.V = {u, v} := by + rcases Γ.edge_cond e he with ⟨x, y, _, hcl, _⟩ | ⟨x, hcl, _⟩ + · have hu_xy : u ∈ ({x, y} : Set S) := hcl ▸ ⟨hue, hu⟩ + have hv_xy : v ∈ ({x, y} : Set S) := hcl ▸ ⟨hve, hv⟩ + rw [hcl] + rcases hu_xy with rfl | rfl <;> rcases hv_xy with rfl | rfl + · exact False.elim (huv rfl) + · rfl + · exact Set.pair_comm _ _ + · exact False.elim (huv rfl) + · have hu_x : u = x := by + have : u ∈ ({x} : Set S) := hcl ▸ ⟨hue, hu⟩ + simpa using this + have hv_x : v = x := by + have : v ∈ ({x} : Set S) := hcl ▸ ⟨hve, hv⟩ + simpa using this + exact False.elim (huv (hu_x.trans hv_x.symm)) + exact ⟨he, hu, hv, hpair⟩ + · rintro ⟨_, _, _, hpair⟩ + have hue : u ∈ closure e := by + have : u ∈ closure e ∩ Γ.V := by rw [hpair]; simp + exact this.1 + have hve : v ∈ closure e := by + have : v ∈ closure e ∩ Γ.V := by rw [hpair]; simp + exact this.1 + have hinc₁ : η.imageGraph.Inc (η.eMap e) (η.vMap u) := (η.inc_iff e he u hu).mpr hue + have hinc₂ : η.imageGraph.Inc (η.eMap e) (η.vMap v) := (η.inc_iff e he v hv).mpr hve + obtain ⟨w₁, hw₁⟩ := hinc₁ + obtain ⟨w₂, hw₂⟩ := hinc₂ + have huv' : η.vMap u ≠ η.vMap v := fun h => huv (η.bijOn_v.injOn hu hv h) + have h_eq := hw₁.eq_and_eq_or_eq_and_eq hw₂ + rcases h_eq with ⟨hEq, _⟩ | ⟨_, rfl⟩ + · exact False.elim (huv' hEq) + · exact hw₁ + +/-- A simple walk `W` of `Γ.toGraph` maps under `η : SpanEmbedding Γ G` to a simple walk `W'` of +`η.imageGraph` with `W'.support = W.support.map η.vMap` and `W'.edges = W.edges.map η.eMap`. -/ +theorem _root_.GraphMinor.GM14.SpanEmbedding.exists_walk_imageGraph + {S : Type w} [TopologicalSpace S] + {G : Graph α β} {Γ : Drawing S} (η : SpanEmbedding Γ G) + {a b : S} (W : GraphWalk Γ.toGraph a b) (hW : W.IsSimple) : + ∃ W' : GraphWalk η.imageGraph (η.vMap a) (η.vMap b), + W'.IsSimple ∧ W'.support = W.support.map η.vMap ∧ W'.edges = W.edges.map η.eMap := by + have hnd : W.support.Nodup := hW + clear hW + induction W with + | @nil u h => + have huV : u ∈ Γ.V := h + exact ⟨.nil (η.bijOn_v.mapsTo huV), by simp [GraphWalk.IsSimple], rfl, rfl⟩ + | cons h r ih => + rename_i u v w e + have hu_not : u ∉ r.support := (List.nodup_cons.mp hnd).1 + have hnd_r : r.support.Nodup := (List.nodup_cons.mp hnd).2 + have huv : u ≠ v := fun hEq => hu_not (hEq ▸ r.start_mem_support) + have hlink' : η.imageGraph.IsLink (η.eMap e) (η.vMap u) (η.vMap v) := + (η.isLink_iff_of_ne h.1 h.2.1 h.2.2.1 huv).mpr h + obtain ⟨W', hW'_sim, hsup, hed⟩ := ih hnd_r + refine ⟨.cons hlink' W', ?_, by simp [hsup], by simp [hed]⟩ + unfold GraphWalk.IsSimple at hW'_sim ⊢ + rw [GraphWalk.support_cons, List.nodup_cons] + refine ⟨?_, hW'_sim⟩ + rw [hsup, List.mem_map] + rintro ⟨z, hz, hzu⟩ + have hzV : z ∈ Γ.V := r.mem_vertexSet_of_mem_support hz + have hzu' : z = u := η.bijOn_v.injOn hzV h.2.1 hzu + exact hu_not (hzu' ▸ hz) + +/-- In a 2-cell drawing `Γ` on a connected closed surface `S` with `Γ.E.Nonempty`, for any +`η : SpanEmbedding Γ G` and `a, b ∈ Γ.V`, there is a path in `η.imageGraph` from `η.vMap a` to +`η.vMap b`. -/ +theorem _root_.GraphMinor.GM14.SpanEmbedding.exists_path_imageGraph + {S : Type w} [TopologicalSpace S] [T2Space S] + [ConnectedSpace S] (hS : IsClosedSurface S) {G : Graph α β} {Γ : Drawing S} + (h2cell : (PaintingOrDrawing.drawing Γ).IsTwoCell) (hE : Γ.E.Nonempty) + (η : SpanEmbedding Γ G) {a b : S} (ha : a ∈ Γ.V) (hb : b ∈ Γ.V) : + ∃ P : Graph α β, IsGraphPathWithEnds η.imageGraph P (η.vMap a) (η.vMap b) := by + obtain ⟨W₀⟩ := twoCell_toGraph_connected hS h2cell hE ha hb + obtain ⟨W, hW_sim, _, _⟩ := exists_isSimple_subwalk W₀ + obtain ⟨W', hW'_sim, _, _⟩ := η.exists_walk_imageGraph W hW_sim + exact ⟨walkSubgraph W', isGraphPathWithEnds_walkSubgraph hW'_sim⟩ + +/-! ## Helper Lemmas for (5.2): Zones, Common Compressions, and Dials -/ + +/-- Generalization of `(4.2)` (`theorem_4_2_proof`) to two drawings `H₁, H₂` whose tangles `T₁, T₂` +are +both compressions of a common tangle `(H₀, θ₀, T₀, d₀)` (Graph Minors XV, proof of `(5.2)` Claim +`(14)`, page 133). -/ +theorem pointDist_le_of_common_compression + {S : Type w} [TopologicalSpace S] [T2Space S] + {H₀ H₁ H₂ : Drawing S} {Z : Set S} {θ₀ lam₁ lam₂ : ℕ} + {T₀ T₁ T₂ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d₀ d₁ d₂ : Set S → Set S → ℕ} {x y : S} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + (hComp₁ : IsLambdaCompression H₀ H₁ θ₀ lam₁ T₀ T₁ d₀ d₁) + (hComp₂ : IsLambdaCompression H₀ H₂ θ₀ lam₂ T₀ T₂ d₀ d₂) + (hZ : ∀ a ∈ H₁.A, a ∉ H₂.A → a ⊆ Z) + (hltZ : ∀ σ ∈ Z, pointDist H₁ d₁ x y < pointDist H₁ d₁ x σ) + (hlt₁ : pointDist H₁ d₁ x y < θ₀ - lam₁) : + pointDist H₂ d₂ x y ≤ pointDist H₁ d₁ x y := by + let θ₁ := θ₀ - lam₁ + let θ₂ := θ₀ - lam₂ + have hMetric₁ : HasTangleMetric H₁ θ₁ T₁ d₁ := hComp₁.hasMetric' + have hMetric₂ : HasTangleMetric H₂ θ₂ T₂ d₂ := hComp₂.hasMetric' + obtain ⟨_, K₁, ins₁, hK₁, hins₁, hd₁⟩ := id hMetric₁ + obtain ⟨ax, hax, hx_ax⟩ := exists_atom_of_point H₁ x + obtain ⟨ay, hay, hy_ay⟩ := exists_atom_of_point H₁ y + obtain ⟨ax', hax', hx_ax'⟩ := exists_atom_of_point H₂ x + obtain ⟨ay', hay', hy_ay'⟩ := exists_atom_of_point H₂ y + have hpt₁ : pointDist H₁ d₁ x y = d₁ ax ay := pointDist_eq_of_mem_atom hax hay hx_ax hy_ay + have hpt₂ : pointDist H₂ d₂ x y = d₂ ax' ay' := pointDist_eq_of_mem_atom hax' hay' hx_ax' hy_ay' + by_cases hxy : ax = ay + · subst hxy + have h0 : d₁ ax ax = 0 := by rw [hd₁ ax hax ax hax]; simp [tangleMetric] + have hax_mem' : ax ∈ H₂.A := by + by_contra hnot + have hsubZ : ax ⊆ Z := hZ ax hax hnot + have hlt_xx := hltZ x (hsubZ hx_ax) + rw [pointDist_eq_of_mem_atom hax hax hx_ax hx_ax] at hlt_xx + omega + have hax_eq : ax' = ax := atom_eq_of_mem hax' hax_mem' hx_ax' hx_ax + have hay_eq : ay' = ax := atom_eq_of_mem hay' hax_mem' hy_ay' hy_ay + obtain ⟨_, K₀', ins₀', _, _, hd₀'⟩ := hMetric₂ + rw [hpt₂, hax_eq, hay_eq, hd₀' ax hax_mem' ax hax_mem'] + simp [tangleMetric] + · by_cases hlt₂ : pointDist H₁ d₁ x y < θ₂ + · have htm_lt : tangleMetric H₁ K₁ ins₁ θ₁ ax ay < θ₁ := by + rwa [← hd₁ ax hax ay hay, ← hpt₁] + obtain ⟨u, W, ax_K, ay_K, hax_K, hay_K, hW_lt, hW_len, hax_sub, hay_sub⟩ := + exists_walk_of_tangleMetric_lt hK₁.2.1 ins₁ hxy htm_lt + rw [← hd₁ ax hax ay hay, ← hpt₁] at hW_len + have hAtomsInW : ∀ a ∈ H₁.A, (a ∩ insWalk ins₁ K₁ W).Nonempty → a ∈ H₂.A := by + intro a ha ⟨σ, hσa, hσW⟩ + by_contra hnot + have hσZ : σ ∈ Z := hZ a ha hnot hσa + obtain ⟨a_K, ha_K⟩ := exists_correspondingAtom hK₁.2.1 ha + have ha_sub : a_K ⊆ insWalk ins₁ K₁ W := + (GM14.theorem_3_1_proof hS hK₁ hins₁ ha_K W hW_lt).mpr ⟨σ, hσa, hσW⟩ + have hle2 := two_mul_tangleMetric_le_of_walk hK₁.2.1 ins₁ θ₁ hax_K ha_K W hW_lt + hax_sub ha_sub + rw [← hd₁ ax hax a ha, ← pointDist_eq_of_mem_atom (d := d₁) hax ha hx_ax hσa] at hle2 + have hlt_σ := hltZ σ hσZ + omega + have hAtomsW : ∀ a ∈ H₁.A, (a ∩ (walkDrawing K₁ W).U).Nonempty → a ∈ H₂.A := by + intro a ha ⟨σ, hσa, hσU⟩ + exact hAtomsInW a ha ⟨σ, hσa, Or.inl hσU⟩ + obtain ⟨K₂, W', hK₂, hWD, hW'_len⟩ := + exists_radialDrawing_with_walk hS hMetric₂.1.1 hK₁ W hAtomsW + obtain ⟨ins₂, hins₂⟩ := exists_derivedSlope hMetric₂.1 hK₂.2.1 + let d₂_K₂ := tangleMetric H₂ K₂ ins₂ θ₂ + have hM₂_K₂ : HasTangleMetric H₂ θ₂ T₂ d₂_K₂ := + ⟨hMetric₂.1, K₂, ins₂, hK₂, hins₂, fun _ _ _ _ => rfl⟩ + obtain ⟨hd₂_eq_A, _, _⟩ := + tangleMetric_eq_of_hasTangleMetric hS hConn hMetric₂ hM₂_K₂ + have hins_eq : insWalk ins₁ K₁ W = insWalk ins₂ K₂ W' := + (theorem_4_1_proof H₀ H₁ H₂ K₁ K₂ θ₀ lam₁ lam₂ T₀ T₁ T₂ d₀ d₁ d₂ ins₁ ins₂ + hS hComp₁ hComp₂ hK₁ hins₁ hd₁ hK₂ hins₂ hd₂_eq_A).1 u u W W' hWD hW_lt (by omega) + have hx_inW : (ax ∩ insWalk ins₁ K₁ W).Nonempty := + (GM14.theorem_3_1_proof hS hK₁ hins₁ hax_K W hW_lt).mp hax_sub + have hy_inW : (ay ∩ insWalk ins₁ K₁ W).Nonempty := + (GM14.theorem_3_1_proof hS hK₁ hins₁ hay_K W hW_lt).mp hay_sub + have hax_eq : ax' = ax := + atom_eq_of_mem hax' (hAtomsInW ax hax hx_inW) hx_ax' hx_ax + have hay_eq : ay' = ay := + atom_eq_of_mem hay' (hAtomsInW ay hay hy_inW) hy_ay' hy_ay + obtain ⟨ax'_K, hax'_K⟩ := exists_correspondingAtom hK₂.2.1 hax' + obtain ⟨ay'_K, hay'_K⟩ := exists_correspondingAtom hK₂.2.1 hay' + have hW'_lt : W'.length < 2 * θ₂ := by omega + have hax'_sub : ax'_K ⊆ insWalk ins₂ K₂ W' := + (GM14.theorem_3_1_proof hS hK₂ hins₂ hax'_K W' hW'_lt).mpr (by rwa [hax_eq, ← hins_eq]) + have hay'_sub : ay'_K ⊆ insWalk ins₂ K₂ W' := + (GM14.theorem_3_1_proof hS hK₂ hins₂ hay'_K W' hW'_lt).mpr (by rwa [hay_eq, ← hins_eq]) + have hle2' := two_mul_tangleMetric_le_of_walk hK₂.2.1 ins₂ θ₂ hax'_K hay'_K W' hW'_lt + hax'_sub hay'_sub + change 2 * d₂_K₂ ax' ay' ≤ W'.length at hle2' + rw [← hd₂_eq_A ax' hax' ay' hay', ← hpt₂] at hle2' + omega + · obtain ⟨_, K₀', ins₀', _, _, hd₀'⟩ := hMetric₂ + have hle_θ₂ : pointDist H₂ d₂ x y ≤ θ₂ := by + rw [hpt₂, hd₀' ax' hax' ay' hay'] + exact tangleMetric_le_ord H₂ K₀' ins₀' θ₂ ax' ay' + omega + +private theorem isPreconnected_biUnion_of_mem {S : Type w} [TopologicalSpace S] + {ι : Type*} {p : ι → Prop} {f : ι → Set S} {x₀ : S} + (hx₀ : ∀ i, p i → x₀ ∈ f i) (hpre : ∀ i, p i → IsPreconnected (f i)) : + IsPreconnected (⋃ i, ⋃ (_ : p i), f i) := by + intro U V hU hV hcov ⟨x, hx, hxU⟩ ⟨y, hy, hyV⟩ + obtain ⟨i, hi, hxi⟩ := mem_iUnion₂.mp hx + obtain ⟨j, hj, hyj⟩ := mem_iUnion₂.mp hy + have hx₀_mem : x₀ ∈ ⋃ k, ⋃ (_ : p k), f k := mem_iUnion₂.mpr ⟨i, hi, hx₀ i hi⟩ + rcases hcov hx₀_mem with hx₀U | hx₀V + · obtain ⟨z, hz, hzUV⟩ := hpre j hj U V hU hV + (fun w hw => hcov (mem_iUnion₂.mpr ⟨j, hj, hw⟩)) ⟨x₀, hx₀ j hj, hx₀U⟩ ⟨y, hyj, hyV⟩ + exact ⟨z, mem_iUnion₂.mpr ⟨j, hj, hz⟩, hzUV⟩ + · obtain ⟨z, hz, hzUV⟩ := hpre i hi U V hU hV + (fun w hw => hcov (mem_iUnion₂.mpr ⟨i, hi, hw⟩)) ⟨x, hxi, hxU⟩ ⟨x₀, hx₀ i hi, hx₀V⟩ + exact ⟨z, mem_iUnion₂.mpr ⟨i, hi, hz⟩, hzUV⟩ + +/-- Every atom `a ∈ Γ.A` of a drawing `Γ` is preconnected. -/ +theorem atom_isPreconnected {S : Type w} [TopologicalSpace S] {Γ : Drawing S} {a : Set S} + (ha : a ∈ Γ.A) : IsPreconnected a := by + rcases ha with (⟨v, _, rfl⟩ | he) | hr + · exact isPreconnected_singleton + · exact he.2.2.1.isConnected.isPreconnected + · exact region_isPreconnected hr + +/-- For any walk `W` of `Γ.toGraph`, `(walkDrawing Γ W).U` is preconnected. -/ +theorem isPreconnected_walkDrawing_U {S : Type w} [TopologicalSpace S] [T1Space S] + (Γ : Drawing S) {u v : S} (W : GraphWalk Γ.toGraph u v) : + IsPreconnected (walkDrawing Γ W).U := + GraphWalk.drawing_U_isPreconnected Γ W + +/-- For a derived slope `ins` of `(H, K, θ, T)` and a closed walk `W` of `K` with +`W.length < 2 * θ`, `insWalk ins K W` is closed and preconnected. -/ +theorem isClosed_and_isPreconnected_insWalk {S : Type w} [TopologicalSpace S] [T2Space S] + {H K : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} + (hins : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + {u : S} (W : GraphWalk K.toGraph u u) (hW_lt : W.length < 2 * θ) : + IsClosed (insWalk ins K W) ∧ IsPreconnected (insWalk ins K W) := by + let D := walkDrawing K W + have hDK : D.IsSubdrawing K := GM11.walkDrawing_isSubdrawing K W + have hfinC : {C : Drawing S | C.IsCircuit ∧ C.IsSubdrawing D}.Finite := by + refine Set.Finite.of_finite_image (f := fun C : Drawing S => (C.V, C.E)) ?_ ?_ + · refine (D.finite_V.finite_subsets.prod D.finite_edges.finite_subsets).subset ?_ + rintro _ ⟨C, ⟨-, hs'⟩, rfl⟩ + exact ⟨hs'.1, hs'.2⟩ + · intro C _ C' _ h + exact Drawing.ext_of_V_E (congrArg Prod.fst h) (congrArg Prod.snd h) + have hClen : ∀ C : Drawing S, C.IsSubdrawing D → C.length < 2 * θ := by + intro C hCs + have hsub : C.E ⊆ {e | e ∈ W.edges} := by + have := hCs.2 + rwa [GM11.walkDrawing_E] at this + have hle : C.length ≤ W.length := + calc C.E.ncard ≤ ({e | e ∈ W.edges} : Set (Set S)).ncard := + Set.ncard_le_ncard hsub (List.finite_toSet _) + _ ≤ W.edges.length := by + rw [show ({e | e ∈ W.edges} : Set (Set S)) = ↑W.edges.toFinset by ext; simp, + Set.ncard_coe_finset] + exact List.toFinset_card_le _ + _ = W.length := rfl + exact lt_of_le_of_lt hle hW_lt + have hcl : IsClosed (insWalk ins K W) := by + refine D.isClosed_U.union (hfinC.isClosed_biUnion fun C ⟨hC, hCs⟩ => ?_) + exact (hins C hC (hCs.trans hDK) (hClen C hCs)).1.isClosed + refine ⟨hcl, ?_⟩ + have hDU_pre : IsPreconnected D.U := isPreconnected_walkDrawing_U K W + have huD : u ∈ D.U := D.V_subset_U (by rw [walkDrawing_V]; exact W.start_mem_support) + have hEq : insWalk ins K W = + D.U ∪ ⋃ C ∈ {C : Drawing S | C.IsCircuit ∧ C.IsSubdrawing D}, (D.U ∪ ins C) := by + ext x + simp only [insWalk, insOf, mem_union, mem_iUnion, exists_prop, mem_ofPred_eq] + constructor + · rintro (hx | ⟨C, hC, hxC⟩) + · exact Or.inl hx + · exact Or.inr ⟨C, hC, Or.inr hxC⟩ + · rintro (hx | ⟨C, hC, hx | hxC⟩) + · exact Or.inl hx + · exact Or.inl hx + · exact Or.inr ⟨C, hC, hxC⟩ + rw [hEq] + by_cases hC_ne : {C : Drawing S | C.IsCircuit ∧ C.IsSubdrawing D}.Nonempty + · obtain ⟨C₀, hC₀⟩ := hC_ne + refine hDU_pre.union' ⟨u, huD, mem_iUnion₂.mpr ⟨C₀, hC₀, Or.inl huD⟩⟩ ?_ + refine isPreconnected_biUnion_of_mem (x₀ := u) ?_ ?_ + · intro C _ + exact Or.inl huD + · intro C ⟨hC, hCs⟩ + obtain ⟨hDisc, hbd, _⟩ := hins C hC (hCs.trans hDK) (hClen C hCs) + obtain ⟨e, heC⟩ := GM11.IsCircuit.E_nonempty hC + obtain ⟨y, hye⟩ := (hCs.trans hDK).2 heC |>.1 + have hyCU : y ∈ C.U := (heC.2.1 hye).1 + have hyDU : y ∈ D.U := hCs.U_subset hyCU + have hy_ins : y ∈ ins C := by + have : y ∈ subBd (ins C) := hbd ▸ hyCU + exact hDisc.isClosed.closure_subset_iff.mpr Subset.rfl this.1 + exact hDU_pre.union' ⟨y, hyDU, hy_ins⟩ + (IsClosedDisc.isPathConnected hDisc).isConnected.isPreconnected + · have hEmp : (⋃ C ∈ {C : Drawing S | C.IsCircuit ∧ C.IsSubdrawing D}, (D.U ∪ ins C)) = ∅ := by + simp [Set.not_nonempty_iff_eq_empty.mp hC_ne] + rw [hEmp, union_empty] + exact hDU_pre + +/-- If `e ∈ H.E`, `v ∈ H.V ∩ closure e`, `z ∈ H.A`, and `z ≠ e`, then `d z {v} ≤ d z e`. -/ +theorem dist_vertex_le_dist_edge_of_ne {S : Type w} [TopologicalSpace S] [T2Space S] + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (_hS : IsClosedSurface S) (hMetric : HasTangleMetric H θ T d) + {z e : Set S} {v : S} (hz : z ∈ H.A) (he : e ∈ H.E) (hv : v ∈ H.V) (hve : v ∈ closure e) + (hne : z ≠ e) : + d z {v} ≤ d z e := by + obtain ⟨_, K, ins, hK, hins, hd⟩ := hMetric + have heA : e ∈ H.A := Or.inl (Or.inr he) + have hvA : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hv, rfl⟩) + rw [hd z hz {v} hvA, hd z hz e heA] + by_cases hlt : tangleMetric H K ins θ z e < θ + · obtain ⟨u, W, z', e', hz', he', hW_lt, hW_len, hz_sub, he_sub⟩ := + exists_walk_of_tangleMetric_lt hK.2.1 ins hne hlt + obtain ⟨hcl, _⟩ := isClosed_and_isPreconnected_insWalk hins W hW_lt + have hv_cor : IsCorrespondingAtom H K {v} {v} := + ⟨hvA, Or.inl (Or.inl ⟨v, hK.2.1.2.1 hv, rfl⟩), Or.inl ⟨v, hv, rfl, rfl⟩⟩ + have he_sub_W : e ⊆ insWalk ins K W := by + rcases he'.2.2 with ⟨w, _, hEq, _⟩ | ⟨_, _, hsub⟩ | ⟨hr, _, _, _⟩ + · exfalso + have hve_mem : v ∈ e := by + rw [hEq] at hve ⊢ + rwa [isClosed_singleton.closure_eq] at hve + exact (he.2.1 hve_mem).2 hv + · exact hsub.trans he_sub + · exfalso + obtain ⟨y, hye⟩ := he.1 + exact region_subset hr hye (he.2.1 hye).1 + have hv_sub : ({v} : Set S) ⊆ insWalk ins K W := + singleton_subset_iff.mpr (hcl.closure_subset_iff.mpr he_sub_W hve) + have hle2 := two_mul_tangleMetric_le_of_walk hK.2.1 ins θ hz' hv_cor W hW_lt hz_sub hv_sub + omega + · have := tangleMetric_le_ord H K ins θ z {v} + omega + +/-- If `e ∈ H.E`, `v ∈ H.V ∩ closure e`, `z ∈ H.A`, `2 ≤ lam`, and `d z e ≤ lam`, then +`d z {v} ≤ lam`. -/ +theorem dist_vertex_le_of_dist_edge_le + {S : Type w} [TopologicalSpace S] [T2Space S] + {H : Drawing S} {θ lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) (hMetric : HasTangleMetric H θ T d) + {z e : Set S} {v : S} (hz : z ∈ H.A) (he : e ∈ H.E) (hv : v ∈ H.V) (hve : v ∈ closure e) + (hlam : 2 ≤ lam) (hle : d z e ≤ lam) : + d z {v} ≤ lam := by + by_cases hze : z = e + · subst hze + obtain ⟨_, _, _, hd_symm, _, _, hd_inc_e⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + have h1 : d {v} z ≤ 2 := hd_inc_e v hv z he hve + rw [hd_symm z (Or.inl (Or.inr he)) {v} (Or.inl (Or.inl ⟨v, hv, rfl⟩))] + omega + · exact (dist_vertex_le_dist_edge_of_ne hS hMetric hz he hv hve hze).trans hle + +/-- The union of all atoms `a ∈ H.A` with `d z a ≤ lam` (Graph Minors XV, proof of `(5.2)`, +page 130: `Z₁` and `Z₂`). -/ +def atomZone {S : Type w} [TopologicalSpace S] + (H : Drawing S) (d : Set S → Set S → ℕ) (z : Set S) (lam : ℕ) : Set S := + {σ : S | ∃ a ∈ H.A, d z a ≤ lam ∧ σ ∈ a} + +theorem mem_atomZone_iff_of_mem_atom {S : Type w} [TopologicalSpace S] + {H : Drawing S} {d : Set S → Set S → ℕ} {z a : Set S} {lam : ℕ} {σ : S} + (ha : a ∈ H.A) (hσ : σ ∈ a) : + σ ∈ atomZone H d z lam ↔ d z a ≤ lam := by + refine ⟨fun ⟨b, hb, hle, hσb⟩ => ?_, fun hle => ⟨a, ha, hle, hσ⟩⟩ + rwa [← atom_eq_of_mem ha hb hσ hσb] at hle + +theorem atom_subset_or_disjoint_atomZone {S : Type w} [TopologicalSpace S] + {H H' : Drawing S} {d : Set S → Set S → ℕ} {z : Set S} {lam : ℕ} + (hAtoms : ∀ a ∈ H.A, lam < d z a → a ∈ H'.A) : + (∀ a ∈ H.A, (d z a ≤ lam ∧ a ⊆ atomZone H d z lam) ∨ + (lam < d z a ∧ Disjoint a (atomZone H d z lam) ∧ a ∈ H'.A)) ∧ + (∀ a' ∈ H'.A, a' ⊆ atomZone H d z lam ∨ + (Disjoint a' (atomZone H d z lam) ∧ a' ∈ H.A ∧ lam < d z a')) := by + refine ⟨fun a ha => ?_, fun a' ha' => ?_⟩ + · by_cases hle : d z a ≤ lam + · exact Or.inl ⟨hle, fun σ hσ => ⟨a, ha, hle, hσ⟩⟩ + · have hlt : lam < d z a := Nat.lt_of_not_le hle + refine Or.inr ⟨hlt, Set.disjoint_left.mpr fun σ hσ hZ => ?_, hAtoms a ha hlt⟩ + exact hle ((mem_atomZone_iff_of_mem_atom ha hσ).mp hZ) + · by_cases hsub : a' ⊆ atomZone H d z lam + · exact Or.inl hsub + · obtain ⟨σ, hσa', hσnot⟩ := Set.not_subset.mp hsub + obtain ⟨a, ha, hσa⟩ := exists_atom_of_point H σ + have hlt : lam < d z a := by + by_contra hnot + exact hσnot ⟨a, ha, Nat.le_of_not_lt hnot, hσa⟩ + have haH' : a ∈ H'.A := hAtoms a ha hlt + have heq : a' = a := atom_eq_of_mem ha' haH' hσa' hσa + subst heq + refine Or.inr ⟨Set.disjoint_left.mpr fun x hx hZ => ?_, ha, hlt⟩ + exact Nat.not_le.mpr hlt ((mem_atomZone_iff_of_mem_atom ha hx).mp hZ) + +/-- The set `H.A` of atoms of a drawing `H` on a connected closed surface `S` is finite. -/ +theorem finite_A {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (H : Drawing S) : H.A.Finite := + ((H.finite_V.image _).union H.finite_edges).union (GM11.finite_R hS H) + +/-- Every point `y ∈ closure (atomZone H d z lam)` lies in an atom `a_y ∈ H.A` with +`d z a_y ≤ lam + 3` and within distance `≤ 3` of some point `σ ∈ atomZone H d z lam`. -/ +theorem closure_atomZone_props + {S : Type w} [TopologicalSpace S] [T2Space S] + {H : Drawing S} {θ lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z : Set S} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + (hMetric : HasTangleMetric H θ T d) (hz : z ∈ H.A) : + ∀ y ∈ closure (atomZone H d z lam), + (∃ σ ∈ atomZone H d z lam, pointDist H d σ y ≤ 3) ∧ + ∀ a_y ∈ H.A, y ∈ a_y → d z a_y ≤ lam + 3 := by + obtain ⟨_, _, _, hd_symm, hd_tri, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + have hd_inc := atom_closure_dist_le_three hS hMetric + have hfin : {a ∈ H.A | d z a ≤ lam}.Finite := (finite_A hS H).subset fun _ h => h.1 + have hEq : atomZone H d z lam = ⋃ a ∈ {a ∈ H.A | d z a ≤ lam}, a := by + ext x + simp [atomZone, and_assoc] + intro y hy + rw [hEq, hfin.closure_biUnion] at hy + obtain ⟨a, ⟨ha, hle⟩, hya⟩ := mem_iUnion₂.mp hy + obtain ⟨σ, hσa⟩ := atom_nonempty ha + obtain ⟨a_y, ha_y, hy_ay⟩ := exists_atom_of_point H y + have hinc : d a_y a ≤ 3 := hd_inc a_y ha_y a ha ⟨y, hy_ay, hya⟩ + have hsym : d a a_y = d a_y a := hd_symm a ha a_y ha_y + refine ⟨⟨σ, ⟨a, ha, hle, hσa⟩, ?_⟩, fun b hb hyb => ?_⟩ + · rw [pointDist_eq_of_mem_atom ha ha_y hσa hy_ay] + omega + · rw [atom_eq_of_mem hb ha_y hyb hy_ay] + have htri := hd_tri z hz a ha a_y ha_y + omega + +/-- For any `k : ℕ`, `frontier (atomZone H d z k)` is contained in `H.U` and every point `y` on it +lies in an atom `a_y ∈ H.A` with `k ≤ d z a_y + 2` and `d z a_y ≤ k + 3`. -/ +theorem frontier_atomZone_subset_U + {S : Type w} [TopologicalSpace S] [T2Space S] + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z : Set S} (k : ℕ) + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + (hMetric : HasTangleMetric H θ T d) (hz : z ∈ H.A) : + ∀ y ∈ frontier (atomZone H d z k), + y ∈ H.U ∧ ∀ a_y ∈ H.A, y ∈ a_y → k ≤ d z a_y + 2 ∧ d z a_y ≤ k + 3 := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨_, _, _, _, hd_tri, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + have hd_inc := atom_closure_dist_le_three hS hMetric + have hfin_gt : {b ∈ H.A | k < d z b}.Finite := (finite_A hS H).subset fun _ h => h.1 + have hCompl : (atomZone H d z k)ᶜ = ⋃ b ∈ {b ∈ H.A | k < d z b}, b := by + ext x + simp only [mem_compl_iff, mem_iUnion, exists_prop, mem_ofPred_eq] + obtain ⟨b, hb, hxb⟩ := exists_atom_of_point H x + rw [mem_atomZone_iff_of_mem_atom hb hxb, not_le] + exact ⟨fun hlt => ⟨b, ⟨hb, hlt⟩, hxb⟩, + fun ⟨b', ⟨hb', hlt⟩, hxb'⟩ => atom_eq_of_mem hb hb' hxb hxb' ▸ hlt⟩ + intro y ⟨hy_cl, hy_not_int⟩ + have hy_cl_compl : y ∈ closure (atomZone H d z k)ᶜ := by rwa [closure_compl] + rw [hCompl, hfin_gt.closure_biUnion] at hy_cl_compl + obtain ⟨b, ⟨hb, hgt⟩, hyb⟩ := mem_iUnion₂.mp hy_cl_compl + have hle1 := (closure_atomZone_props hS hConn hMetric hz y hy_cl).2 + refine ⟨?_, fun a_y ha_y hy_ay => ⟨?_, hle1 a_y ha_y hy_ay⟩⟩ + · by_contra hyU + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem hyU + have hrA : r ∈ H.A := Or.inr hr + by_cases hle : d z r ≤ k + · have hr_sub : r ⊆ atomZone H d z k := fun x hx => ⟨r, hrA, hle, hx⟩ + exact hy_not_int (mem_interior.mpr ⟨r, hr_sub, region_isOpen hr, hyr⟩) + · have hr_disj : Disjoint r (atomZone H d z k) := + Set.disjoint_left.mpr fun x hx hZ => hle ((mem_atomZone_iff_of_mem_atom hrA hx).mp hZ) + exact Set.disjoint_left.mp hr_disj + (mem_closure_iff.mp hy_cl r (region_isOpen hr) hyr).choose_spec.1 + (mem_closure_iff.mp hy_cl r (region_isOpen hr) hyr).choose_spec.2 + · have hinc : d a_y b ≤ 3 := hd_inc a_y ha_y b hb ⟨y, hy_ay, hyb⟩ + have htri := hd_tri z hz a_y ha_y b hb + omega + +/-- When `lam < θ`, `atomZone H d z lam` is preconnected. -/ +theorem isPreconnected_atomZone + {S : Type w} [TopologicalSpace S] [T2Space S] + {H : Drawing S} {θ lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z : Set S} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + (hMetric : HasTangleMetric H θ T d) (hz : z ∈ H.A) (hlam : lam < θ) : + IsPreconnected (atomZone H d z lam) := by + obtain ⟨_, hd_refl, _, _, _, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + obtain ⟨_, K, ins, hK, hins, hd⟩ := hMetric + obtain ⟨τ, hτz⟩ := atom_nonempty hz + have hpiece : ∀ a ∈ H.A, d z a ≤ lam → + ∃ C : Set S, IsPreconnected C ∧ τ ∈ C ∧ a ⊆ C ∧ C ⊆ atomZone H d z lam := by + intro a ha hle + by_cases hza : z = a + · subst hza + exact ⟨z, atom_isPreconnected hz, hτz, Subset.rfl, fun x hx => ⟨z, hz, hle, hx⟩⟩ + · have htm_lt : tangleMetric H K ins θ z a < θ := by + rw [← hd z hz a ha] + omega + obtain ⟨u, W, z', a', hz', ha', hW_lt, hW_len, hz_sub, ha_sub⟩ := + exists_walk_of_tangleMetric_lt hK.2.1 ins hza htm_lt + rw [← hd z hz a ha] at hW_len + obtain ⟨_, hW_pre⟩ := isClosed_and_isPreconnected_insWalk hins W hW_lt + obtain ⟨σz, hσz, hσzW⟩ := (GM14.theorem_3_1_proof hS hK hins hz' W hW_lt).mp hz_sub + obtain ⟨σa, hσa, hσaW⟩ := (GM14.theorem_3_1_proof hS hK hins ha' W hW_lt).mp ha_sub + have hW_sub_Z : insWalk ins K W ⊆ atomZone H d z lam := by + intro x hxW + obtain ⟨b, hb, hxb⟩ := exists_atom_of_point H x + obtain ⟨b', hb'⟩ := exists_correspondingAtom hK.2.1 hb + have hb'_sub : b' ⊆ insWalk ins K W := + (GM14.theorem_3_1_proof hS hK hins hb' W hW_lt).mpr ⟨x, hxb, hxW⟩ + have hle2 := two_mul_tangleMetric_le_of_walk hK.2.1 ins θ hz' hb' W hW_lt hz_sub hb'_sub + rw [← hd z hz b hb] at hle2 + exact ⟨b, hb, by omega, hxb⟩ + have hzw_pre : IsPreconnected (z ∪ insWalk ins K W) := + (atom_isPreconnected hz).union' ⟨σz, hσz, hσzW⟩ hW_pre + have hzaw_pre : IsPreconnected (z ∪ insWalk ins K W ∪ a) := + hzw_pre.union' ⟨σa, Or.inr hσaW, hσa⟩ (atom_isPreconnected ha) + refine ⟨z ∪ insWalk ins K W ∪ a, hzaw_pre, Or.inl (Or.inl hτz), subset_union_right, ?_⟩ + refine union_subset (union_subset ?_ hW_sub_Z) (fun x hx => ⟨a, ha, hle, hx⟩) + exact fun x hx => ⟨z, hz, by rw [hd_refl z hz]; exact Nat.zero_le _, hx⟩ + choose! C hC_pre hτC haC hCZ using hpiece + have hEq : atomZone H d z lam = ⋃ a ∈ {a ∈ H.A | d z a ≤ lam}, C a := by + apply Subset.antisymm + · rintro x ⟨a, ha, hle, hxa⟩ + exact mem_iUnion₂.mpr ⟨a, ⟨ha, hle⟩, haC a ha hle hxa⟩ + · exact iUnion₂_subset fun a ⟨ha, hle⟩ => hCZ a ha hle + rw [hEq] + exact isPreconnected_biUnion_of_mem (x₀ := τ) (fun a ⟨ha, hle⟩ => hτC a ha hle) + (fun a ⟨ha, hle⟩ => hC_pre a ha hle) + +/-- When `6 ≤ lam`, there is a region `r ∈ H.R` with `closure r ⊆ atomZone H d z lam`. -/ +theorem exists_region_closure_subset_atomZone + {S : Type w} [TopologicalSpace S] [T2Space S] + {H : Drawing S} {θ lam : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {z : Set S} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + (hMetric : HasTangleMetric H θ T d) (hz : z ∈ H.A) (hlam : 6 ≤ lam) : + ∃ r ∈ H.R, closure r ⊆ atomZone H d z lam := by + obtain ⟨_, _, _, hd_symm, hd_tri, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + have hd_inc := atom_closure_dist_le_three hS hMetric + obtain ⟨σ, hσz⟩ := atom_nonempty hz + obtain ⟨r, hr, hσr⟩ := exists_region_closure_mem_of_closedSurface hS H σ + have hrA : r ∈ H.A := Or.inr hr + have hdr : d z r ≤ 3 := hd_inc z hz r hrA ⟨σ, hσz, hσr⟩ + refine ⟨r, hr, fun y hy => ?_⟩ + obtain ⟨a_y, ha_y, hy_ay⟩ := exists_atom_of_point H y + have h1 : d a_y r ≤ 3 := hd_inc a_y ha_y r hrA ⟨y, hy_ay, hy⟩ + have h2 : d r a_y = d a_y r := hd_symm r hrA a_y ha_y + have htri := hd_tri z hz r hrA a_y ha_y + exact ⟨a_y, ha_y, by omega, hy_ay⟩ + +/-- If `r ∈ Γ.R` is a region of `Γ` and `Γ'` is a drawing with `Disjoint r Γ'.U` and +`closure r \ r ⊆ Γ'.U`, then `r ∈ Γ'.R`. -/ +theorem mem_R_of_disjoint_U_of_frontier_subset {S : Type w} [TopologicalSpace S] + [LocallyConnectedSpace S] {Γ Γ' : Drawing S} {r : Set S} + (hr : r ∈ Γ.R) (hdisj : Disjoint r Γ'.U) (hbd : closure r \ r ⊆ Γ'.U) : + r ∈ Γ'.R := by + obtain ⟨x, hxr⟩ := region_nonempty hr + have hxU' : x ∉ Γ'.U := disjoint_left.mp hdisj hxr + refine (GM11.mem_R_iff _).mpr ⟨x, hxU', subset_antisymm ?_ ?_⟩ + · exact (region_isPreconnected hr).subset_connectedComponentIn hxr + fun y hy => ⟨mem_univ _, disjoint_left.mp hdisj hy⟩ + · have hcov : connectedComponentIn (univ \ Γ'.U) x ⊆ r ∪ (closure r)ᶜ := by + intro y hy + by_cases hyc : y ∈ closure r + · refine Or.inl ?_ + by_contra hyr + exact (connectedComponentIn_subset _ _ hy).2 (hbd ⟨hyc, hyr⟩) + · exact Or.inr hyc + refine isPreconnected_connectedComponentIn.subset_left_of_subset_union (region_isOpen hr) + isClosed_closure.isOpen_compl ?_ hcov ⟨x, mem_connectedComponentIn ⟨mem_univ _, hxU'⟩, hxr⟩ + exact disjoint_left.mpr fun y hy h => h (subset_closure hy) + +/-- A simple walk drawing `walkDrawing P W` (`W.IsSimple`) contains no circuit subdrawing. -/ +theorem not_isCircuit_subdrawing_walkDrawing {S : Type w} [TopologicalSpace S] [T2Space S] + (P : Drawing S) {u v : S} {W : GraphWalk P.toGraph u v} (hW : W.IsSimple) + {C : Drawing S} (hC : C.IsCircuit) (hCs : C.IsSubdrawing (walkDrawing P W)) : False := by + induction W with + | @nil a ha => + obtain ⟨e, heC⟩ := GM11.IsCircuit.E_nonempty hC + have heW : e ∈ (walkDrawing P (.nil ha)).E := hCs.2 heC + rw [GM11.walkDrawing_E] at heW + simp at heW + | @cons a w b e hlink r ih => + have hnd := List.nodup_cons.mp hW + have ha_not : a ∉ r.support := hnd.1 + have hr_sim : r.IsSimple := hnd.2 + have haw : a ≠ w := fun hEq => ha_not (hEq ▸ r.start_mem_support) + have hends_r : ∀ f ∈ r.edges, a ∉ closure f ∩ P.V := by + intro f hf ha_f + have hfP : f ∈ P.E := + (GM11.walkDrawing_isSubdrawing P r).2 (by rw [GM11.walkDrawing_E]; exact hf) + obtain ⟨x, y, hxy⟩ := (P.toGraph.edge_mem_iff_exists_isLink f).mp hfP + rw [hxy.2.2.2] at ha_f + rcases ha_f with rfl | hEq + · exact ha_not (r.left_mem_support_of_mem_edges hf hxy) + · rw [mem_singleton_iff.mp hEq] at ha_not + exact ha_not (r.left_mem_support_of_mem_edges hf hxy.symm) + by_cases heC : e ∈ C.E + · have hCP : C.IsSubdrawing P := hCs.trans (GM11.walkDrawing_isSubdrawing P (.cons hlink r)) + have haCV : a ∈ C.V := by + have : a ∈ closure e ∩ C.V := by + rw [hCP.closure_inter_V heC, hlink.2.2.2]; simp + exact this.2 + obtain ⟨W_C, hWC_circ, hWC_pos, hCV, hCE⟩ := GM11.exists_walk_at hC haCV + cases W_C with + | nil _ => simp at hWC_pos + | @cons _ u₁ _ f₁ hl₁ r₁ => + have hf₁C : f₁ ∈ C.E := hl₁.1 + have hf₁W : f₁ = e ∨ f₁ ∈ r.edges := by + have := hCs.2 hf₁C + rwa [GM11.walkDrawing_E, mem_ofPred_eq, GraphWalk.edges_cons, List.mem_cons] at this + have ha_f₁ : a ∈ closure f₁ ∩ P.V := by + rw [← hCP.closure_inter_V hf₁C, hl₁.2.2.2]; simp + have hf₁_eq : f₁ = e := hf₁W.resolve_right fun hfr => hends_r f₁ hfr ha_f₁ + have hu₁_eq : u₁ = w := by + have hpair : ({a, u₁} : Set S) = {a, w} := by + rw [← hl₁.2.2.2, hCP.closure_inter_V hf₁C, hf₁_eq, hlink.2.2.2] + have : u₁ ∈ ({a, w} : Set S) := hpair ▸ Or.inr rfl + rcases this with rfl | hEq + · exfalso + have hw_mem : w ∈ ({u₁, u₁} : Set S) := hpair.symm ▸ Or.inr rfl + simp only [pair_eq_singleton, mem_singleton_iff] at hw_mem + exact haw hw_mem.symm + · exact mem_singleton_iff.mp hEq + have hr₁_rev_pos : 0 < r₁.reverse.length := by + rw [GraphWalk.length_reverse] + cases r₁ with + | nil _ => exact (haw hu₁_eq).elim + | cons _ _ => simp + generalize hrev : r₁.reverse = R₁ + cases R₁ with + | nil _ => rw [hrev] at hr₁_rev_pos; simp at hr₁_rev_pos + | @cons _ u₂ _ f₂ hl₂ r₂ => + have hf₂_r₁ : f₂ ∈ r₁.edges := by + have : f₂ ∈ r₁.reverse.edges := by rw [hrev]; exact List.mem_cons_self + rwa [GraphWalk.edges_reverse, List.mem_reverse] at this + have hf₂C : f₂ ∈ C.E := hl₂.1 + have hf₂W : f₂ = e ∨ f₂ ∈ r.edges := by + have := hCs.2 hf₂C + rwa [GM11.walkDrawing_E, mem_ofPred_eq, GraphWalk.edges_cons, List.mem_cons] at this + have ha_f₂ : a ∈ closure f₂ ∩ P.V := by + rw [← hCP.closure_inter_V hf₂C, hl₂.2.2.2]; simp + have hf₂_eq : f₂ = e := hf₂W.resolve_right fun hfr => hends_r f₂ hfr ha_f₂ + have hnd_ed := (List.nodup_cons.mp hWC_circ.2).1 + exact hnd_ed (hf₁_eq.trans hf₂_eq.symm ▸ hf₂_r₁) + · refine ih hr_sim ⟨fun x hxC => ?_, fun f hfC => ?_⟩ + · obtain ⟨W_x, _, hWx_pos, _, _⟩ := GM11.exists_walk_at hC hxC + cases W_x with + | nil _ => simp at hWx_pos + | @cons _ _ _ f hl _ => + have hfC : f ∈ C.E := hl.1 + have hfW : f = e ∨ f ∈ r.edges := by + have := hCs.2 hfC + rwa [GM11.walkDrawing_E, mem_ofPred_eq, GraphWalk.edges_cons, List.mem_cons] at this + have hfr : f ∈ r.edges := hfW.resolve_left fun hEq => heC (hEq ▸ hfC) + have hCP : C.IsSubdrawing P := hCs.trans (GM11.walkDrawing_isSubdrawing P (.cons hlink r)) + have hx_f : x ∈ closure f ∩ P.V := by + rw [← hCP.closure_inter_V hfC, hl.2.2.2]; simp + have hx_ne_a : x ≠ a := fun hEq => hends_r f hfr (hEq ▸ hx_f) + have hxW : x = a ∨ x ∈ r.support := by + have := hCs.1 hxC + rwa [GM11.walkDrawing_V, mem_ofPred_eq, GraphWalk.support_cons, List.mem_cons] at this + rw [GM11.walkDrawing_V] + exact hxW.resolve_left hx_ne_a + · have hfW : f = e ∨ f ∈ r.edges := by + have := hCs.2 hfC + rwa [GM11.walkDrawing_E, mem_ofPred_eq, GraphWalk.edges_cons, List.mem_cons] at this + rw [GM11.walkDrawing_E] + exact hfW.resolve_left fun hEq => heC (hEq ▸ hfC) + +/-- For any dial `Δ` of `F, Γ` with `F ∩ Γ.U ⊆ Γ.V`, `Γ.interSet Δ` contains no circuit +subdrawing. -/ +theorem not_isCircuit_subdrawing_of_isDial {S : Type w} [TopologicalSpace S] [T2Space S] + {Γ : Drawing S} {F Δ : Set S} (hU : F ∩ Γ.U ⊆ Γ.V) (hDial : IsDial Γ F Δ) + {C : Drawing S} (hC : C.IsCircuit) (hCs : C.IsSubdrawing (Γ.interSet Δ)) : False := by + rcases hDial.2.2 with hsub | ⟨u, v, _, _, hPath⟩ + · obtain ⟨e, heC⟩ := GM11.IsCircuit.E_nonempty hC + have heΔ : e ∈ (Γ.interSet Δ).E := hCs.2 heC + rw [Drawing.interSet, Drawing.span_E] at heΔ + have he_pair : e ∈ Γ.E ∧ e ⊆ Δ := heΔ.1 + obtain ⟨_, hdV, heU, ⟨x, hxe⟩⟩ := GM11.PaintingOrDrawing.edge_props (Γ := .drawing Γ) he_pair.1 + exact Set.disjoint_left.mp hdV hxe (hU ⟨hsub ⟨he_pair.2 hxe, heU hxe⟩, heU hxe⟩) + · let P := Γ.interSet Δ + obtain ⟨W, hW, hPV, hPE⟩ := hPath + have hEq : P = walkDrawing P W := + Drawing.ext_of_V_E (hPV.trans (GM11.walkDrawing_V P W).symm) + (hPE.trans (GM11.walkDrawing_E P W).symm) + exact not_isCircuit_subdrawing_walkDrawing P hW hC (hEq ▸ hCs) + +/-- In a drawing `Γ` on a connected closed surface `S`, no dial `Δ` for an `O`-arc `F` (with +`F ∩ Γ.U ⊆ Γ.V`) can contain `closure r` for any region `r ∈ Γ.R`. -/ +theorem not_closure_region_subset_of_isDial {S : Type w} [TopologicalSpace S] [T2Space S] + [ConnectedSpace S] (hS : IsClosedSurface S) {Γ : Drawing S} {F Δ : Set S} + (hF : IsOArc F) (hU : F ∩ Γ.U ⊆ Γ.V) (hDial : IsDial Γ F Δ) + {r : Set S} (hr : r ∈ Γ.R) : ¬ (closure r ⊆ Δ) := by + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + intro hsub_r + have hr_mem : r ∈ (Γ.interSet Δ).R := by + have hSub : (Γ.interSet Δ).IsSubdrawing Γ := Drawing.span_isSubdrawing Γ _ _ + refine mem_R_of_disjoint_U_of_frontier_subset hr + (Set.disjoint_left.mpr fun x hxr hxU => region_subset hr hxr (hSub.U_subset hxU)) ?_ + rintro x ⟨hxr_cl, hxr⟩ + have hxU : x ∈ Γ.U := by + rcases GM11.closure_region_subset hr hxr_cl with h | h + · exact (hxr h).elim + · exact h + by_cases hxV : x ∈ Γ.V + · refine (Γ.interSet Δ).V_subset_U ?_ + rw [Drawing.interSet, Drawing.span_V, Drawing.spanV] + exact Or.inl ⟨⟨hxV, hsub_r hxr_cl⟩, hxV⟩ + · obtain ⟨e, he, hxe⟩ := Γ.exists_edge_of_mem hxU hxV + have he_r : e ⊆ closure r := + GM11.edge_subset_closure_of_incident hS he hr ⟨x, hxe, hxr_cl⟩ + have heΔ : e ∈ (Γ.interSet Δ).E := by + rw [Drawing.interSet, Drawing.span_E] + exact ⟨⟨he, he_r.trans hsub_r⟩, he⟩ + exact (heΔ.2.1 hxe).1 + have hCompl_ne : Δᶜ.Nonempty := by + by_contra hEmp + have hΔ_univ : Δ = univ := eq_univ_iff_forall.mpr fun x => + by_contra fun hx => hEmp ⟨x, hx⟩ + obtain ⟨φ⟩ := hF + have hxF : (φ 1).1 ∈ F := (φ 1).2 + have hx_bd : (φ 1).1 ∈ subBd Δ := hDial.2.1.symm ▸ hxF + rw [hΔ_univ, subBd, Set.sdiff_self, closure_empty, inter_empty] at hx_bd + exact hx_bd + obtain ⟨y, hy_out, hy_notU⟩ := + GM11.exists_notMem_U (Γ := Γ.interSet Δ) hS + hDial.1.isClosed.isOpen_compl hCompl_ne + obtain ⟨r_out, hr_out, hy_rout⟩ := exists_region_of_notMem hy_notU + have hr_ne : r ≠ r_out := by + rintro rfl + exact hy_out (hsub_r (subset_closure hy_rout)) + exact hr_ne (GM11.region_eq_of_noCircuit hS (Γ := Γ.interSet Δ) + (fun C hC hCs => not_isCircuit_subdrawing_of_isDial hU hDial hC hCs) hr_mem hr_out) + +/-- In any drawing `Γ` on a `T1Space`, for every edge `e ∈ Γ.E`, `closure e ∩ Γ.V = closure e \ e`. +-/ +theorem closure_inter_V_eq_diff {S : Type w} [TopologicalSpace S] + (Γ : Drawing S) {e : Set S} (he : e ∈ Γ.E) : + closure e ∩ Γ.V = closure e \ e := by + ext x + have h := Set.ext_iff.mp (Γ.closure_diff_V he) x + simp only [mem_inter_iff, mem_sdiff] at h ⊢ + exact ⟨fun ⟨hx, hv⟩ => ⟨hx, fun hxe => (h.mpr hxe).2 hv⟩, + fun ⟨hx, hnot⟩ => ⟨hx, by_contra fun hv => hnot (h.mp ⟨hx, hv⟩)⟩⟩ + +/-- In a 2-cell drawing `Γ` on a connected closed surface `S` with `Γ.E.Nonempty`, every vertex +`v ∈ Γ.V` lies in the closure of some edge `e ∈ Γ.E` (`Γ` has no isolated vertices). -/ +theorem exists_edge_closure_mem_of_twoCell {S : Type w} [TopologicalSpace S] [T2Space S] + [ConnectedSpace S] (hS : IsClosedSurface S) {Γ : Drawing S} + (h2cell : (PaintingOrDrawing.drawing Γ).IsTwoCell) (hE : Γ.E.Nonempty) + {v : S} (hv : v ∈ Γ.V) : + ∃ e ∈ Γ.E, v ∈ closure e := by + obtain ⟨e₀, he₀⟩ := hE + have hu₀_ex : (closure e₀ ∩ Γ.V).Nonempty := by + rcases Γ.edge_cond e₀ he₀ with ⟨x, y, _, hcl, _⟩ | ⟨x, hcl, _⟩ + · rw [hcl]; exact ⟨x, Or.inl rfl⟩ + · rw [hcl]; exact ⟨x, rfl⟩ + obtain ⟨u₀, hu₀_cl, hu₀_V⟩ := hu₀_ex + by_cases hvu : v = u₀ + · subst hvu; exact ⟨e₀, he₀, hu₀_cl⟩ + · obtain ⟨W⟩ := twoCell_toGraph_connected hS h2cell ⟨e₀, he₀⟩ hv hu₀_V + cases W with + | nil _ => exact (hvu rfl).elim + | @cons _ w _ e hlink _ => + refine ⟨e, hlink.1, ?_⟩ + have : v ∈ closure e ∩ Γ.V := by rw [hlink.2.2.2]; exact Or.inl rfl + exact this.1 + +/-- Helper lemma for `unionDrawing`: the arc components of `(Γ₁.U ∪ Γ₂.U) \ (Γ₁.V ∪ Γ₂.V)` are +`Γ₁.E ∪ Γ₂.E` when `Γ₁` and `Γ₂` only meet at `Γ₁.V ∩ Γ₂.V`. -/ +theorem arcComponentsIn_union {S : Type w} [TopologicalSpace S] + (Γ₁ Γ₂ : Drawing S) + (h1 : ∀ e₁ ∈ Γ₁.E, closure e₁ ∩ Γ₂.V ⊆ Γ₁.V) + (h2 : ∀ e₂ ∈ Γ₂.E, closure e₂ ∩ Γ₁.V ⊆ Γ₂.V) + (h3 : ∀ e₁ ∈ Γ₁.E, ∀ e₂ ∈ Γ₂.E, closure e₁ ∩ closure e₂ ⊆ Γ₁.V ∩ Γ₂.V) : + arcComponentsIn ((Γ₁.U ∪ Γ₂.U) \ (Γ₁.V ∪ Γ₂.V)) = Γ₁.E ∪ Γ₂.E := by + have hdiff : (Γ₁.U ∪ Γ₂.U) \ (Γ₁.V ∪ Γ₂.V) = ⋃₀ (Γ₁.E ∪ Γ₂.E) := by + ext x + simp only [mem_sdiff, mem_union, not_or, mem_sUnion] + constructor + · rintro ⟨hx₁ | hx₂, hnot₁, hnot₂⟩ + · obtain ⟨e, he, hxe⟩ := Γ₁.exists_edge_of_mem hx₁ hnot₁ + exact ⟨e, Or.inl he, hxe⟩ + · obtain ⟨e, he, hxe⟩ := Γ₂.exists_edge_of_mem hx₂ hnot₂ + exact ⟨e, Or.inr he, hxe⟩ + · rintro ⟨e, he₁ | he₂, hxe⟩ + · have hxU : x ∈ Γ₁.U \ Γ₁.V := he₁.2.1 hxe + refine ⟨Or.inl hxU.1, hxU.2, fun hxV₂ => hxU.2 (h1 e he₁ ⟨subset_closure hxe, hxV₂⟩)⟩ + · have hxU : x ∈ Γ₂.U \ Γ₂.V := he₂.2.1 hxe + refine ⟨Or.inr hxU.1, fun hxV₁ => hxU.2 (h2 e he₂ ⟨subset_closure hxe, hxV₁⟩), hxU.2⟩ + have hpre : ∀ {D : Set S}, IsPreconnected D → D ⊆ ⋃₀ (Γ₁.E ∪ Γ₂.E) → + ∀ {e : Set S}, e ∈ Γ₁.E ∪ Γ₂.E → ∀ {x : S}, x ∈ D → x ∈ e → D ⊆ e := by + intro D hD hDsub e he x hxD hxe + have hfin : (Γ₁.E ∪ Γ₂.E).Finite := Γ₁.finite_edges.union Γ₂.finite_edges + set B : Set S := ⋃ f ∈ (Γ₁.E ∪ Γ₂.E) \ {e}, closure f + have hBcl : IsClosed B := + (hfin.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure + have hcover : D ⊆ closure e ∪ B := by + intro y hy + obtain ⟨f, hf, hyf⟩ := hDsub hy + by_cases hfe : f = e + · exact Or.inl (subset_closure (hfe ▸ hyf)) + · exact Or.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfe⟩, subset_closure hyf⟩) + have hnotV : ∀ y ∈ D, y ∉ Γ₁.V ∪ Γ₂.V := by + intro y hy + have hy_diff : y ∈ (Γ₁.U ∪ Γ₂.U) \ (Γ₁.V ∪ Γ₂.V) := hdiff.symm ▸ hDsub hy + exact hy_diff.2 + have hdisj : ∀ y ∈ D, y ∈ closure e → y ∉ B := by + intro y hy hye hyB + obtain ⟨f, ⟨hf, hfe⟩, hyf⟩ := mem_iUnion₂.mp hyB + have hy_notV := hnotV y hy + rcases he with he₁ | he₂ <;> rcases hf with hf₁ | hf₂ + · have h1' : y ∈ e := by + rw [← Γ₁.closure_diff_V he₁]; exact ⟨hye, fun h => hy_notV (Or.inl h)⟩ + have h2' : y ∈ f := by + rw [← Γ₁.closure_diff_V hf₁]; exact ⟨hyf, fun h => hy_notV (Or.inl h)⟩ + exact hfe (Γ₁.edge_eq_of_mem hf₁ he₁ h2' h1') + · exact hy_notV (Or.inl (h3 e he₁ f hf₂ ⟨hye, hyf⟩).1) + · exact hy_notV (Or.inl (h3 f hf₁ e he₂ ⟨hyf, hye⟩).1) + · have h1' : y ∈ e := by + rw [← Γ₂.closure_diff_V he₂]; exact ⟨hye, fun h => hy_notV (Or.inr h)⟩ + have h2' : y ∈ f := by + rw [← Γ₂.closure_diff_V hf₂]; exact ⟨hyf, fun h => hy_notV (Or.inr h)⟩ + exact hfe (Γ₂.edge_eq_of_mem hf₂ he₂ h2' h1') + have hnone : ¬ (D ∩ B).Nonempty := by + intro hne + obtain ⟨y, hy, hyA, hyB⟩ := isPreconnected_closed_iff.mp hD _ _ isClosed_closure hBcl + hcover ⟨x, hxD, subset_closure hxe⟩ hne + exact hdisj y hy hyA hyB + intro y hy + have hyA : y ∈ closure e := (hcover hy).resolve_right fun hyB => hnone ⟨y, hy, hyB⟩ + have hy_notV := hnotV y hy + rcases he with he₁ | he₂ + · rw [← Γ₁.closure_diff_V he₁]; exact ⟨hyA, fun h => hy_notV (Or.inl h)⟩ + · rw [← Γ₂.closure_diff_V he₂]; exact ⟨hyA, fun h => hy_notV (Or.inr h)⟩ + rw [hdiff] + ext C + constructor + · rintro ⟨⟨x, hx⟩, hsub, hconn, hmax⟩ + obtain ⟨e, he, hxe⟩ := hsub hx + have hCe : C ⊆ e := hpre hconn.isConnected.isPreconnected hsub he hx hxe + have he_path : IsPathConnected e := by + rcases he with he₁ | he₂ + · exact he₁.2.2.1 + · exact he₂.2.2.1 + have : e = C := hmax e (subset_sUnion_of_mem he) he_path hCe + exact this ▸ he + · intro he + rcases he with he₁ | he₂ + · refine ⟨he₁.1, subset_sUnion_of_mem (Or.inl he₁), he₁.2.2.1, + fun D hD hconn heD => ?_⟩ + obtain ⟨x, hx⟩ := he₁.1 + exact (hpre hconn.isConnected.isPreconnected hD (Or.inl he₁) (heD hx) hx).antisymm heD + · refine ⟨he₂.1, subset_sUnion_of_mem (Or.inr he₂), he₂.2.2.1, + fun D hD hconn heD => ?_⟩ + obtain ⟨x, hx⟩ := he₂.1 + exact (hpre hconn.isConnected.isPreconnected hD (Or.inr he₂) (heD hx) hx).antisymm heD + +/-- Union of two drawings `Γ₁` and `Γ₂` on a `T1Space` whose edges only meet each other's vertices +in `Γ₁.V ∩ Γ₂.V` and whose edge closures only meet in `Γ₁.V ∩ Γ₂.V`. -/ +def unionDrawing {S : Type w} [TopologicalSpace S] + (Γ₁ Γ₂ : Drawing S) + (h1 : ∀ e₁ ∈ Γ₁.E, closure e₁ ∩ Γ₂.V ⊆ Γ₁.V) + (h2 : ∀ e₂ ∈ Γ₂.E, closure e₂ ∩ Γ₁.V ⊆ Γ₂.V) + (h3 : ∀ e₁ ∈ Γ₁.E, ∀ e₂ ∈ Γ₂.E, closure e₁ ∩ closure e₂ ⊆ Γ₁.V ∩ Γ₂.V) : + Drawing S where + U := Γ₁.U ∪ Γ₂.U + V := Γ₁.V ∪ Γ₂.V + V_subset_U := union_subset_union Γ₁.V_subset_U Γ₂.V_subset_U + isClosed_U := Γ₁.isClosed_U.union Γ₂.isClosed_U + finite_V := Γ₁.finite_V.union Γ₂.finite_V + finite_edges := by + rw [arcComponentsIn_union Γ₁ Γ₂ h1 h2 h3] + exact Γ₁.finite_edges.union Γ₂.finite_edges + edge_cond := by + intro e he + rw [arcComponentsIn_union Γ₁ Γ₂ h1 h2 h3] at he + have hcl_inter : closure e ∩ (Γ₁.V ∪ Γ₂.V) = closure e \ e := by + rcases he with he₁ | he₂ + · rw [← closure_inter_V_eq_diff Γ₁ he₁] + ext x + simp only [mem_inter_iff, mem_union] + exact ⟨fun ⟨hx, h⟩ => ⟨hx, h.elim id fun hV₂ => h1 e he₁ ⟨hx, hV₂⟩⟩, + fun ⟨hx, h⟩ => ⟨hx, Or.inl h⟩⟩ + · rw [← closure_inter_V_eq_diff Γ₂ he₂] + ext x + simp only [mem_inter_iff, mem_union] + exact ⟨fun ⟨hx, h⟩ => ⟨hx, h.elim (fun hV₁ => h2 e he₂ ⟨hx, hV₁⟩) id⟩, + fun ⟨hx, h⟩ => ⟨hx, Or.inr h⟩⟩ + rw [hcl_inter] + rcases he with he₁ | he₂ + · rw [← closure_inter_V_eq_diff Γ₁ he₁] + exact Γ₁.edge_cond e he₁ + · rw [← closure_inter_V_eq_diff Γ₂ he₂] + exact Γ₂.edge_cond e he₂ + +@[simp] +theorem unionDrawing_U {S : Type w} [TopologicalSpace S] + (Γ₁ Γ₂ : Drawing S) + (h1 : ∀ e₁ ∈ Γ₁.E, closure e₁ ∩ Γ₂.V ⊆ Γ₁.V) + (h2 : ∀ e₂ ∈ Γ₂.E, closure e₂ ∩ Γ₁.V ⊆ Γ₂.V) + (h3 : ∀ e₁ ∈ Γ₁.E, ∀ e₂ ∈ Γ₂.E, closure e₁ ∩ closure e₂ ⊆ Γ₁.V ∩ Γ₂.V) : + (unionDrawing Γ₁ Γ₂ h1 h2 h3).U = Γ₁.U ∪ Γ₂.U := rfl + +@[simp] +theorem unionDrawing_V {S : Type w} [TopologicalSpace S] + (Γ₁ Γ₂ : Drawing S) + (h1 : ∀ e₁ ∈ Γ₁.E, closure e₁ ∩ Γ₂.V ⊆ Γ₁.V) + (h2 : ∀ e₂ ∈ Γ₂.E, closure e₂ ∩ Γ₁.V ⊆ Γ₂.V) + (h3 : ∀ e₁ ∈ Γ₁.E, ∀ e₂ ∈ Γ₂.E, closure e₁ ∩ closure e₂ ⊆ Γ₁.V ∩ Γ₂.V) : + (unionDrawing Γ₁ Γ₂ h1 h2 h3).V = Γ₁.V ∪ Γ₂.V := rfl + +@[simp] +theorem unionDrawing_E {S : Type w} [TopologicalSpace S] + (Γ₁ Γ₂ : Drawing S) + (h1 : ∀ e₁ ∈ Γ₁.E, closure e₁ ∩ Γ₂.V ⊆ Γ₁.V) + (h2 : ∀ e₂ ∈ Γ₂.E, closure e₂ ∩ Γ₁.V ⊆ Γ₂.V) + (h3 : ∀ e₁ ∈ Γ₁.E, ∀ e₂ ∈ Γ₂.E, closure e₁ ∩ closure e₂ ⊆ Γ₁.V ∩ Γ₂.V) : + (unionDrawing Γ₁ Γ₂ h1 h2 h3).E = Γ₁.E ∪ Γ₂.E := + arcComponentsIn_union Γ₁ Γ₂ h1 h2 h3 + +theorem isSubdrawing_left_unionDrawing {S : Type w} [TopologicalSpace S] + (Γ₁ Γ₂ : Drawing S) + (h1 : ∀ e₁ ∈ Γ₁.E, closure e₁ ∩ Γ₂.V ⊆ Γ₁.V) + (h2 : ∀ e₂ ∈ Γ₂.E, closure e₂ ∩ Γ₁.V ⊆ Γ₂.V) + (h3 : ∀ e₁ ∈ Γ₁.E, ∀ e₂ ∈ Γ₂.E, closure e₁ ∩ closure e₂ ⊆ Γ₁.V ∩ Γ₂.V) : + Γ₁.IsSubdrawing (unionDrawing Γ₁ Γ₂ h1 h2 h3) := + ⟨subset_union_left, by rw [unionDrawing_E]; exact subset_union_left⟩ + +theorem isSubdrawing_right_unionDrawing {S : Type w} [TopologicalSpace S] + (Γ₁ Γ₂ : Drawing S) + (h1 : ∀ e₁ ∈ Γ₁.E, closure e₁ ∩ Γ₂.V ⊆ Γ₁.V) + (h2 : ∀ e₂ ∈ Γ₂.E, closure e₂ ∩ Γ₁.V ⊆ Γ₂.V) + (h3 : ∀ e₁ ∈ Γ₁.E, ∀ e₂ ∈ Γ₂.E, closure e₁ ∩ closure e₂ ⊆ Γ₁.V ∩ Γ₂.V) : + Γ₂.IsSubdrawing (unionDrawing Γ₁ Γ₂ h1 h2 h3) := + ⟨subset_union_right, by rw [unionDrawing_E]; exact subset_union_right⟩ + +/-- If every atom in `Γ₁.A \ Γ₂.A` is contained in `Z`, then every atom in `Γ₂.A \ Γ₁.A` is also +contained in `Z`. -/ +theorem atom_subset_of_compl_subset {S : Type w} [TopologicalSpace S] + {Γ₁ Γ₂ : Drawing S} {Z : Set S} + (hZ : ∀ a ∈ Γ₁.A, a ∉ Γ₂.A → a ⊆ Z) : + ∀ a' ∈ Γ₂.A, a' ∉ Γ₁.A → a' ⊆ Z := by + intro a' ha' hnot σ hσ + obtain ⟨a, ha, hσa⟩ := exists_atom_of_point Γ₁ σ + by_cases ha₂ : a ∈ Γ₂.A + · exact (hnot (atom_eq_of_mem ha' ha₂ hσ hσa ▸ ha)).elim + · exact hZ a ha ha₂ hσa + +/-- Dichotomy for atoms, vertices, and edges of `H` and `H'` relative to `atomZone H d z lam` under +`IsRearrangedWithin`. -/ +theorem IsRearrangedWithin.atomZone_dichotomy {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H H' : Drawing S} {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} + {θ_star θ lam : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z : Set S} + (hRearr : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) : + let Z := atomZone H d z lam + (∀ a ∈ H.A, (d z a ≤ lam ∧ a ⊆ Z) ∨ (lam < d z a ∧ Disjoint a Z ∧ a ∈ H'.A)) ∧ + (∀ a' ∈ H'.A, a' ⊆ Z ∨ (Disjoint a' Z ∧ a' ∈ H.A ∧ lam < d z a')) ∧ + (∀ v ∈ H.V, (d z {v} ≤ lam ∧ v ∈ Z) ∨ + (lam < d z {v} ∧ v ∉ Z ∧ v ∈ H'.V ∧ η'.vMap v = η.vMap v)) ∧ + (∀ v' ∈ H'.V, v' ∈ Z ∨ (v' ∉ Z ∧ v' ∈ H.V ∧ lam < d z {v'} ∧ η'.vMap v' = η.vMap v')) ∧ + (∀ e ∈ H.E, (d z e ≤ lam ∧ e ⊆ Z) ∨ + (lam < d z e ∧ Disjoint e Z ∧ e ∈ H'.E ∧ η'.eMap e = η.eMap e)) ∧ + (∀ e' ∈ H'.E, e' ⊆ Z ∨ (Disjoint e' Z ∧ e' ∈ H.E ∧ lam < d z e' ∧ η'.eMap e' = η.eMap e')) := by + have hS : IsClosedSurface S := + ⟨hRearr.isSpan.isSurface.1, hRearr.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hRearr.isSpan.bd_empty x hx⟩ + have : ConnectedSpace S := hRearr.isSpan.isConnected + obtain ⟨hA₁, hA₂⟩ := atom_subset_or_disjoint_atomZone (d := d) (z := z) (lam + := lam) hRearr.atom_mem + refine ⟨hA₁, hA₂, fun v hv => ?_, fun v' hv' => ?_, fun e he => ?_, fun e' he' => ?_⟩ + · rcases hA₁ {v} (Or.inl (Or.inl ⟨v, hv, rfl⟩)) with ⟨hle, hsub⟩ | ⟨hlt, hdisj, _⟩ + · exact Or.inl ⟨hle, hsub rfl⟩ + · obtain ⟨hv', heq⟩ := hRearr.vMap_eq v hv hlt + exact Or.inr ⟨hlt, fun hvZ => Set.disjoint_left.mp hdisj rfl hvZ, hv', heq⟩ + · rcases hA₂ {v'} (Or.inl (Or.inl ⟨v', hv', rfl⟩)) with hsub | ⟨hdisj, ha, hlt⟩ + · exact Or.inl (hsub rfl) + · have hvH : v' ∈ H.V := vertex_mem_V_of_mem_A hS hv' ha + obtain ⟨_, heq⟩ := hRearr.vMap_eq v' hvH hlt + exact Or.inr ⟨fun hvZ => Set.disjoint_left.mp hdisj rfl hvZ, hvH, hlt, heq⟩ + · rcases hA₁ e (Or.inl (Or.inr he)) with ⟨hle, hsub⟩ | ⟨hlt, hdisj, _⟩ + · exact Or.inl ⟨hle, hsub⟩ + · obtain ⟨he', heq⟩ := hRearr.eMap_eq e he hlt + exact Or.inr ⟨hlt, hdisj, he', heq⟩ + · rcases hA₂ e' (Or.inl (Or.inr he')) with hsub | ⟨hdisj, ha, hlt⟩ + · exact Or.inl hsub + · have heH : e' ∈ H.E := edge_mem_E_of_mem_A hS he' ha + obtain ⟨_, heq⟩ := hRearr.eMap_eq e' heH hlt + exact Or.inr ⟨hdisj, heH, hlt, heq⟩ + +/-- Claims (3), (4), (5), (6) of Graph Minors XV, (5.2) (pages 130–131), together with distance +bounds on `closure Z₁` and `closure Z₂`. -/ +theorem lemma_5_2_claims_3_to_6 + {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H H' H'' : Drawing S} + {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} {η'' : SpanEmbedding H'' G} + {θ_star θ lam lam₁ lam₂ μ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' d'' : Set S → Set S → ℕ} {z₁ z₂ z₃ : Set S} {τ : S} + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hθ_lt : 4 * lam + 2 < θ) + (hlam₁ : 4 ≤ lam₁) (hlam₂ : 4 ≤ lam₂) + (hlam : 6 * lam₁ + 5 * lam₂ + 3 * μ + 4 ≤ lam) + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' d' + d'' z₂) + (hStep₂ : IsMuSteppedSpan G H'' η'' d'' μ) + (hτz₂ : τ ∈ z₂) (hz₃ : z₃ ∈ H.A) (hτz₃ : τ ∈ z₃) : + let Z₁ := atomZone H d z₁ lam₁ + let Z₂ := atomZone H' d' z₂ lam₂ + lam - lam₁ < d z₁ z₃ ∧ + (∀ σ₁ ∈ Z₁, lam - 2 * lam₁ < pointDist H d τ σ₁ ∧ + lam - 6 * lam₁ - 2 < pointDist H' d' τ σ₁) ∧ + (∀ σ₂ ∈ Z₂, pointDist H d τ σ₂ ≤ pointDist H' d' τ σ₂ ∧ + pointDist H' d' τ σ₂ ≤ lam₂) ∧ + (∀ σ₁ ∈ Z₁, ∀ σ₂ ∈ Z₂, lam - 2 * lam₁ - lam₂ < pointDist H d σ₁ σ₂) ∧ + (∀ x₁ ∈ closure Z₁, ∀ x₂ ∈ closure Z₂, + lam - 2 * lam₁ - lam₂ - 6 < pointDist H d x₁ x₂) ∧ + Disjoint (closure Z₁) (closure Z₂) ∧ + z₂ = z₃ := by + intro Z₁ Z₂ + have hS : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + have hMetric : HasTangleMetric H θ T d := hRearr₁.isCompression.hasMetric + have hMetric' : HasTangleMetric H' (θ - (4 * lam₁ + 2)) T' d' := hRearr₁.isCompression.hasMetric' + have hMetric'' : HasTangleMetric H'' (θ - (4 * lam₁ + 2) - (4 * lam₂ + 2)) T'' d'' := + hRearr₂.isCompression.hasMetric' + obtain ⟨_, hd_refl, hd_le_θ, hd_symm, hd_tri, hd_inc⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + obtain ⟨_, hd'_refl, hd'_le_θ', hd'_symm, hd'_tri, _⟩ := + gm11_theorem_9_1 H' (θ - (4 * lam₁ + 2)) T' d' hS hConn hMetric' + have hord := hFlat.order_ge + -- Claim (3): `lam - lam₁ < d z₁ z₃` + have hClaim3 : lam - lam₁ < d z₁ z₃ := by + by_contra hle_not + have hle_z : d z₁ z₃ ≤ lam - lam₁ := Nat.le_of_not_lt hle_not + let θ₀ := θ - (4 * lam + 2) + let T₀ := GM10.truncation T'' θ₀ + have h1_θ₀ : 1 ≤ θ₀ := by dsimp [θ₀]; omega + have hle_θ₀ : θ₀ ≤ θ - (4 * lam₁ + 2) - (4 * lam₂ + 2) := by dsimp [θ₀]; omega + obtain ⟨d₀, hM₀, hd₀_eq, hpt₀_eq⟩ := + hasTangleMetric_truncation_of_hasTangleMetric hMetric'' h1_θ₀ hle_θ₀ + have hRearr₀ : IsRearrangedWithin G H H'' η η'' θ_star θ lam T_star T T₀ d d₀ z₃ := by + refine ⟨hz₃, hFlat.isSpan, hRearr₂.isSpan'.truncation h1_θ₀ hle_θ₀, ?_, ?_, ?_, ?_⟩ + · intro a ha hlt + have htri := hd_tri z₃ hz₃ z₁ hRearr₁.z_mem a ha + have hsym := hd_symm z₃ hz₃ z₁ hRearr₁.z_mem + have hlt₁ : lam₁ < d z₁ a := by omega + have ha' : a ∈ H'.A := hRearr₁.atom_mem a ha hlt₁ + obtain ⟨σ, hσa⟩ := atom_nonempty ha + have hpt_H : pointDist H d τ σ = d z₃ a := pointDist_eq_of_mem_atom hz₃ ha hτz₃ hσa + have hpt_H' : pointDist H' d' τ σ = d' z₂ a := + pointDist_eq_of_mem_atom hRearr₂.z_mem ha' hτz₂ hσa + have hcomp₁ := hRearr₁.isCompression.dist_le τ σ + have hlt₂ : lam₂ < d' z₂ a := by omega + exact hRearr₂.atom_mem a ha' hlt₂ + · intro v hv hlt + have ha : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hv, rfl⟩) + have htri := hd_tri z₃ hz₃ z₁ hRearr₁.z_mem {v} ha + have hsym := hd_symm z₃ hz₃ z₁ hRearr₁.z_mem + have hlt₁ : lam₁ < d z₁ {v} := by omega + obtain ⟨hv', hv_eq₁⟩ := hRearr₁.vMap_eq v hv hlt₁ + have ha' : ({v} : Set S) ∈ H'.A := Or.inl (Or.inl ⟨v, hv', rfl⟩) + have hpt_H : pointDist H d τ v = d z₃ {v} := pointDist_eq_of_mem_atom hz₃ ha hτz₃ rfl + have hpt_H' : pointDist H' d' τ v = d' z₂ {v} := + pointDist_eq_of_mem_atom hRearr₂.z_mem ha' hτz₂ rfl + have hcomp₁ := hRearr₁.isCompression.dist_le τ v + have hlt₂ : lam₂ < d' z₂ {v} := by omega + obtain ⟨hv'', hv_eq₂⟩ := hRearr₂.vMap_eq v hv' hlt₂ + exact ⟨hv'', hv_eq₂.trans hv_eq₁⟩ + · intro e he hlt + have ha : e ∈ H.A := Or.inl (Or.inr he) + have htri := hd_tri z₃ hz₃ z₁ hRearr₁.z_mem e ha + have hsym := hd_symm z₃ hz₃ z₁ hRearr₁.z_mem + have hlt₁ : lam₁ < d z₁ e := by omega + obtain ⟨he', he_eq₁⟩ := hRearr₁.eMap_eq e he hlt₁ + have ha' : e ∈ H'.A := Or.inl (Or.inr he') + obtain ⟨σ, hσe⟩ := he.1 + have hpt_H : pointDist H d τ σ = d z₃ e := pointDist_eq_of_mem_atom hz₃ ha hτz₃ hσe + have hpt_H' : pointDist H' d' τ σ = d' z₂ e := + pointDist_eq_of_mem_atom hRearr₂.z_mem ha' hτz₂ hσe + have hcomp₁ := hRearr₁.isCompression.dist_le τ σ + have hlt₂ : lam₂ < d' z₂ e := by omega + obtain ⟨he'', he_eq₂⟩ := hRearr₂.eMap_eq e he' hlt₂ + exact ⟨he'', he_eq₂.trans he_eq₁⟩ + · refine ⟨by omega, hMetric, hM₀, fun σ₁ σ₂ => ?_⟩ + obtain ⟨a₁, ha₁, hσ₁⟩ := exists_atom_of_point H σ₁ + obtain ⟨a₂, ha₂, hσ₂⟩ := exists_atom_of_point H σ₂ + have hle_θ : pointDist H d σ₁ σ₂ ≤ θ := by + rw [pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁ hσ₂] + exact hd_le_θ a₁ ha₁ a₂ ha₂ + have h1 := hRearr₁.isCompression.dist_le σ₁ σ₂ + have h2 := hRearr₂.isCompression.dist_le σ₁ σ₂ + rw [hpt₀_eq σ₁ σ₂] + omega + obtain ⟨P, u, v, hu, hv, hP, hdist⟩ := hStep₂ + have hdist₀ : μ ≤ d₀ {u} {v} := by + rw [hd₀_eq {u} (Or.inl (Or.inl ⟨u, hu, rfl⟩)) {v} (Or.inl (Or.inl ⟨v, hv, rfl⟩))] + omega + exact hFlat.no_stepped_rearrangement hRearr₀ ⟨P, u, v, hu, hv, hP, hdist₀⟩ + -- Claim (4): for all `σ₁ ∈ Z₁`, `lam - 2 * lam₁ < pointDist H d τ σ₁` and `lam - 6 * lam₁ - 2 < + -- pointDist H' d' τ σ₁` + have hClaim4 : ∀ σ₁ ∈ Z₁, lam - 2 * lam₁ < pointDist H d τ σ₁ ∧ + lam - 6 * lam₁ - 2 < pointDist H' d' τ σ₁ := by + rintro σ₁ ⟨a₁, ha₁, hle₁, hσ₁⟩ + have hpt : pointDist H d τ σ₁ = d z₃ a₁ := pointDist_eq_of_mem_atom hz₃ ha₁ hτz₃ hσ₁ + have htri := hd_tri z₁ hRearr₁.z_mem a₁ ha₁ z₃ hz₃ + have hsym := hd_symm a₁ ha₁ z₃ hz₃ + have hcomp₁ := hRearr₁.isCompression.dist_le τ σ₁ + exact ⟨by omega, by omega⟩ + -- Claim (5): for all `σ₂ ∈ Z₂`, `pointDist H d τ σ₂ ≤ pointDist H' d' τ σ₂ ≤ lam₂` + have hClaim5 : ∀ σ₂ ∈ Z₂, pointDist H d τ σ₂ ≤ pointDist H' d' τ σ₂ ∧ + pointDist H' d' τ σ₂ ≤ lam₂ := by + rintro σ₂ ⟨a₂', ha₂', hle₂, hσ₂⟩ + have hpt' : pointDist H' d' τ σ₂ = d' z₂ a₂' := + pointDist_eq_of_mem_atom hRearr₂.z_mem ha₂' hτz₂ hσ₂ + have hle_lam₂ : pointDist H' d' τ σ₂ ≤ lam₂ := by omega + have hZ₁_sub : ∀ a' ∈ H'.A, a' ∉ H.A → a' ⊆ Z₁ := by + intro a' ha' hnot + rcases hRearr₁.atomZone_dichotomy.2.1 a' ha' with hsub | ⟨_, haH, _⟩ + · exact hsub + · exact (hnot haH).elim + have hltZ₁ : ∀ σ₁ ∈ Z₁, pointDist H' d' τ σ₂ < pointDist H' d' τ σ₁ := by + intro σ₁ hσ₁ + have := (hClaim4 σ₁ hσ₁).2 + omega + have hle_H := theorem_4_2_proof H' H Z₁ (θ - (4 * lam₁ + 2)) θ (4 * lam₁ + 2) T' T d' d τ σ₂ + hS hConn hMetric' hMetric hZ₁_sub (Or.inr hRearr₁.isCompression) hltZ₁ (by omega) + exact ⟨hle_H, hle_lam₂⟩ + -- Claim (6): for all `σ₁ ∈ Z₁, σ₂ ∈ Z₂`, `lam - 2 * lam₁ - lam₂ < pointDist H d σ₁ σ₂` + have hClaim6 : ∀ σ₁ ∈ Z₁, ∀ σ₂ ∈ Z₂, lam - 2 * lam₁ - lam₂ < pointDist H d σ₁ σ₂ := by + intro σ₁ hσ₁ σ₂ hσ₂ + obtain ⟨a₁, ha₁, hle₁, hσ₁_a⟩ := hσ₁ + obtain ⟨a₂, ha₂, hσ₂_a⟩ := exists_atom_of_point H σ₂ + have hpt_12 : pointDist H d σ₁ σ₂ = d a₁ a₂ := pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁_a hσ₂_a + have hpt_τ2 : pointDist H d τ σ₂ = d z₃ a₂ := pointDist_eq_of_mem_atom hz₃ ha₂ hτz₃ hσ₂_a + have h5 := hClaim5 σ₂ hσ₂ + have htri₁ := hd_tri z₁ hRearr₁.z_mem a₁ ha₁ a₂ ha₂ + have htri₂ := hd_tri z₁ hRearr₁.z_mem a₂ ha₂ z₃ hz₃ + have hsym₂ := hd_symm z₃ hz₃ a₂ ha₂ + omega + -- Closure distance bound + have hClosureDist : ∀ x₁ ∈ closure Z₁, ∀ x₂ ∈ closure Z₂, + lam - 2 * lam₁ - lam₂ - 6 < pointDist H d x₁ x₂ := by + intro x₁ hx₁ x₂ hx₂ + obtain ⟨σ₁, hσ₁Z₁, hle_x₁⟩ := + (closure_atomZone_props hS hConn hMetric hRearr₁.z_mem x₁ hx₁).1 + have hfin₂ : {a' ∈ H'.A | d' z₂ a' ≤ lam₂}.Finite := (finite_A hS H').subset fun _ h => h.1 + have hEq₂ : Z₂ = ⋃ a' ∈ {a' ∈ H'.A | d' z₂ a' ≤ lam₂}, a' := by + ext x; simp [Z₂, atomZone, and_assoc] + have hx₂' : x₂ ∈ ⋃ a' ∈ {a' ∈ H'.A | d' z₂ a' ≤ lam₂}, closure a' := by + rwa [← hfin₂.closure_biUnion, ← hEq₂] + obtain ⟨b', ⟨hb', hle_b'⟩, hx₂_b'⟩ := mem_iUnion₂.mp hx₂' + obtain ⟨σ₂, hσ₂_b'⟩ := atom_nonempty hb' + have hσ₂Z₂ : σ₂ ∈ Z₂ := ⟨b', hb', hle_b', hσ₂_b'⟩ + obtain ⟨a_x₁, ha_x₁, hx₁_a⟩ := exists_atom_of_point H x₁ + obtain ⟨a_σ₁, ha_σ₁, hσ₁_a⟩ := exists_atom_of_point H σ₁ + obtain ⟨a_x₂, ha_x₂, hx₂_a⟩ := exists_atom_of_point H x₂ + obtain ⟨a_σ₂, ha_σ₂, hσ₂_a⟩ := exists_atom_of_point H σ₂ + -- Since `σ₂ ∈ b' ∈ H'.A` and `σ₂ ∈ Z₂`, `b'` cannot be in `Z₁` (by `hClaim6`), so `b' ∈ H.A`! + have hb'_H : b' ∈ H.A := by + rcases hRearr₁.atomZone_dichotomy.2.1 b' hb' with hsub | ⟨_, haH, _⟩ + · exfalso + have hσ₂Z₁ : σ₂ ∈ Z₁ := hsub hσ₂_b' + have h6 := hClaim6 σ₂ hσ₂Z₁ σ₂ hσ₂Z₂ + rw [pointDist_eq_of_mem_atom ha_σ₂ ha_σ₂ hσ₂_a hσ₂_a, hd_refl a_σ₂ ha_σ₂] at h6 + omega + · exact haH + have hb'_eq : a_σ₂ = b' := atom_eq_of_mem ha_σ₂ hb'_H hσ₂_a hσ₂_b' + have hinc₂ : d a_x₂ a_σ₂ ≤ 3 := + atom_closure_dist_le_three hS hMetric a_x₂ ha_x₂ a_σ₂ ha_σ₂ ⟨x₂, hx₂_a, hb'_eq ▸ hx₂_b'⟩ + have h6 := hClaim6 σ₁ hσ₁Z₁ σ₂ hσ₂Z₂ + rw [pointDist_eq_of_mem_atom ha_σ₁ ha_σ₂ hσ₁_a hσ₂_a] at h6 + rw [pointDist_eq_of_mem_atom ha_σ₁ ha_x₁ hσ₁_a hx₁_a] at hle_x₁ + rw [pointDist_eq_of_mem_atom ha_x₁ ha_x₂ hx₁_a hx₂_a] + have htri₁ := hd_tri a_σ₁ ha_σ₁ a_x₁ ha_x₁ a_x₂ ha_x₂ + have htri₂ := hd_tri a_σ₁ ha_σ₁ a_x₂ ha_x₂ a_σ₂ ha_σ₂ + omega + have hDisj : Disjoint (closure Z₁) (closure Z₂) := by + refine Set.disjoint_left.mpr fun x hx₁ hx₂ => ?_ + obtain ⟨a, ha, hxa⟩ := exists_atom_of_point H x + have hlt := hClosureDist x hx₁ x hx₂ + rw [pointDist_eq_of_mem_atom ha ha hxa hxa, hd_refl a ha] at hlt + omega + have hz₂_eq : z₂ = z₃ := by + have hz₂_Z₂ : z₂ ⊆ Z₂ := by + intro x hx + refine ⟨z₂, hRearr₂.z_mem, ?_, hx⟩ + rw [hd'_refl z₂ hRearr₂.z_mem] + omega + rcases hRearr₁.atomZone_dichotomy.2.1 z₂ hRearr₂.z_mem with hsub | ⟨_, haH, _⟩ + · exfalso + exact Set.disjoint_left.mp hDisj (subset_closure (hsub hτz₂)) (subset_closure (hz₂_Z₂ hτz₂)) + · exact atom_eq_of_mem haH hz₃ hτz₂ hτz₃ + exact ⟨hClaim3, hClaim4, hClaim5, hClaim6, hClosureDist, hDisj, hz₂_eq⟩ + +/-- Claim (10) of Graph Minors XV, (5.2) (page 132): +With `S₁ = {s ∈ H.V | ∃ σ₁ ∈ Z₁, pointDist H d σ₁ s ≤ μ + 4}` and +`S₂ = {s ∈ H.V | ∃ σ₂ ∈ Z₂, pointDist H d σ₂ s ≤ μ + 4}`, there is no walk in `G` from +`η.vMap '' S₁` to `η.vMap '' S₂` whose vertices in `V(η.imageGraph)` all belong to +`η.vMap '' S₁ ∪ η.vMap '' S₂`. -/ +theorem no_walk_between_S₁_S₂ + {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ lam lam₁ lam₂ μ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {Z₁ Z₂ : Set S} + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hMetric : HasTangleMetric H θ T d) + (hθ_lt : 4 * lam + 2 < θ) + (hlam₁ : 4 ≤ lam₁) (hlam₂ : 4 ≤ lam₂) + (hlam : 6 * lam₁ + 5 * lam₂ + 3 * μ + 4 ≤ lam) + (hClaim6 : ∀ σ₁ ∈ Z₁, ∀ σ₂ ∈ Z₂, lam - 2 * lam₁ - lam₂ < pointDist H d σ₁ σ₂) + {a b : α} (W : GraphWalk G a b) + (ha : a ∈ η.vMap '' {s ∈ H.V | ∃ σ₁ ∈ Z₁, pointDist H d σ₁ s ≤ μ + 4}) + (hb : b ∈ η.vMap '' {s ∈ H.V | ∃ σ₂ ∈ Z₂, pointDist H d σ₂ s ≤ μ + 4}) + (hW_V : ∀ w ∈ W.support, w ∈ V(η.imageGraph) → + w ∈ η.vMap '' {s ∈ H.V | ∃ σ₁ ∈ Z₁, pointDist H d σ₁ s ≤ μ + 4} ∪ + η.vMap '' {s ∈ H.V | ∃ σ₂ ∈ Z₂, pointDist H d σ₂ s ≤ μ + 4}) : + False := by + let S₁ : Set S := {s ∈ H.V | ∃ σ₁ ∈ Z₁, pointDist H d σ₁ s ≤ μ + 4} + let S₂ : Set S := {s ∈ H.V | ∃ σ₂ ∈ Z₂, pointDist H d σ₂ s ≤ μ + 4} + have hS : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + obtain ⟨_, _, _, hd_symm, hd_tri, _, hd_inc_e⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + have hdist_S : ∀ s₁ ∈ S₁, ∀ s₂ ∈ S₂, max μ 4 < d {s₁} {s₂} := by + rintro s₁ ⟨hs₁V, σ₁, hσ₁Z₁, hle₁⟩ s₂ ⟨hs₂V, σ₂, hσ₂Z₂, hle₂⟩ + obtain ⟨a₁, ha₁, hσ₁a₁⟩ := exists_atom_of_point H σ₁ + obtain ⟨a₂, ha₂, hσ₂a₂⟩ := exists_atom_of_point H σ₂ + have hs₁A : ({s₁} : Set S) ∈ H.A := Or.inl (Or.inl ⟨s₁, hs₁V, rfl⟩) + have hs₂A : ({s₂} : Set S) ∈ H.A := Or.inl (Or.inl ⟨s₂, hs₂V, rfl⟩) + have h6 := hClaim6 σ₁ hσ₁Z₁ σ₂ hσ₂Z₂ + rw [pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁a₁ hσ₂a₂] at h6 + rw [pointDist_eq_of_mem_atom ha₁ hs₁A hσ₁a₁ rfl] at hle₁ + rw [pointDist_eq_of_mem_atom ha₂ hs₂A hσ₂a₂ rfl] at hle₂ + have htri₁ := hd_tri a₁ ha₁ {s₁} hs₁A a₂ ha₂ + have htri₂ := hd_tri {s₁} hs₁A {s₂} hs₂A a₂ ha₂ + have hsym₂ := hd_symm {s₂} hs₂A a₂ ha₂ + omega + obtain ⟨W_sim, hW_sim, hW_sub, _⟩ := exists_isSimple_subwalk W + obtain ⟨y₂, W₁, _, hy₂S₂, rfl, hfirst₂⟩ := + exists_first_append_of_mem_set W_sim (X := η.vMap '' S₂) ⟨b, W_sim.end_mem_support, hb⟩ + have hW₁_sim : W₁.IsSimple := (isSimple_of_append hW_sim).1 + have hW₁_rev_sim : W₁.reverse.IsSimple := by + unfold GraphWalk.IsSimple at hW₁_sim ⊢ + rwa [GraphWalk.support_reverse, List.nodup_reverse] + obtain ⟨y₁, W₂_rev, _, hy₁S₁, hrev_eq, hfirst₁⟩ := + exists_first_append_of_mem_set W₁.reverse (X := η.vMap '' S₁) + ⟨a, by rw [GraphWalk.support_reverse, List.mem_reverse]; exact W₁.start_mem_support, ha⟩ + have hW₂_rev_sim : W₂_rev.IsSimple := (GM09.isSimple_of_append (hrev_eq ▸ hW₁_rev_sim)).1 + let W₀ : GraphWalk G y₁ y₂ := W₂_rev.reverse + have hW₀_sim : W₀.IsSimple := by + unfold GraphWalk.IsSimple at hW₂_rev_sim ⊢ + rwa [GraphWalk.support_reverse, List.nodup_reverse] + have hW₀_sub_W₁ : ∀ w ∈ W₀.support, w ∈ W₁.support := by + intro w hw + have hw_rev : w ∈ W₂_rev.support := by rwa [GraphWalk.support_reverse, List.mem_reverse] at hw + have hw_W₁rev : w ∈ W₁.reverse.support := by + rw [hrev_eq, GraphWalk.mem_support_append] + exact Or.inl hw_rev + rwa [GraphWalk.support_reverse, List.mem_reverse] at hw_W₁rev + have hW₀_sub_W : ∀ w ∈ W₀.support, w ∈ W.support := fun w hw => + hW_sub w (by rw [GraphWalk.mem_support_append]; exact Or.inl (hW₀_sub_W₁ w hw)) + obtain ⟨s₁, hs₁, hs₁_eq⟩ := hy₁S₁ + obtain ⟨s₂, hs₂, hs₂_eq⟩ := hy₂S₂ + have hgt := hdist_S s₁ hs₁ s₂ hs₂ + have hs₁_ne_s₂ : s₁ ≠ s₂ := by + rintro rfl + obtain ⟨_, hd_refl, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + rw [hd_refl {s₁} (Or.inl (Or.inl ⟨s₁, hs₁.1, rfl⟩))] at hgt + omega + have hy₁_ne_y₂ : y₁ ≠ y₂ := by + rw [← hs₁_eq, ← hs₂_eq] + exact fun h => hs₁_ne_s₂ (η.bijOn_v.injOn hs₁.1 hs₂.1 h) + let P₀ := walkSubgraph W₀ + have hP₀_path : IsGraphPathWithEnds G P₀ y₁ y₂ := isGraphPathWithEnds_walkSubgraph hW₀_sim + have hVP₀ : V(P₀) ∩ V(η.imageGraph) = {y₁, y₂} := by + rw [vertexSet_walkSubgraph] + ext w + simp only [mem_inter_iff, mem_ofPred_eq, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨hw₀, hwIm⟩ + rcases hW_V w (hW₀_sub_W w hw₀) hwIm with hwS₁ | hwS₂ + · left + have hw_rev : w ∈ W₂_rev.support := by + rwa [GraphWalk.support_reverse, List.mem_reverse] at hw₀ + exact hfirst₁ w hw_rev hwS₁ + · right + exact hfirst₂ w (hW₀_sub_W₁ w hw₀) hwS₂ + · rintro (rfl | rfl) + · exact ⟨W₀.start_mem_support, hs₁_eq ▸ η.bijOn_v.mapsTo hs₁.1⟩ + · exact ⟨W₀.end_mem_support, hs₂_eq ▸ η.bijOn_v.mapsTo hs₂.1⟩ + have hEP₀ : Disjoint E(P₀) E(η.imageGraph) := by + refine Set.disjoint_left.mpr fun e_G heP₀ heIm => ?_ + obtain ⟨u, v, hlinkP₀⟩ := (P₀.edge_mem_iff_exists_isLink e_G).mp heP₀ + have huv_ne : u ≠ v := fun h => hP₀_path.not_isLink_self (h ▸ hlinkP₀) + have hlinkG : G.IsLink e_G u v := ((walkSubgraph_le W₀).isLink_iff hlinkP₀.edge_mem).mp hlinkP₀ + have hlinkIm : η.imageGraph.IsLink e_G u v := (η.imageGraph_le.isLink_iff heIm).mpr hlinkG + have hu_mem : u ∈ ({y₁, y₂} : Set α) := hVP₀ ▸ ⟨hlinkP₀.left_mem, hlinkIm.left_mem⟩ + have hv_mem : v ∈ ({y₁, y₂} : Set α) := hVP₀ ▸ ⟨hlinkP₀.right_mem, hlinkIm.right_mem⟩ + obtain ⟨f, hfH, rfl⟩ := η.bijOn_e.surjOn heIm + have hlink_y : η.imageGraph.IsLink (η.eMap f) (η.vMap s₁) (η.vMap s₂) := by + rw [hs₁_eq, hs₂_eq] + rcases hu_mem with rfl | rfl <;> rcases hv_mem with rfl | rfl + · exact (huv_ne rfl).elim + · exact hlinkIm + · exact hlinkIm.symm + · exact (huv_ne rfl).elim + have hlinkH : H.toGraph.IsLink f s₁ s₂ := + (η.isLink_iff_of_ne hfH hs₁.1 hs₂.1 hs₁_ne_s₂).mp hlink_y + have hs₁_f : s₁ ∈ closure f := by + have : s₁ ∈ closure f ∩ H.V := by rw [hlinkH.2.2.2]; exact Or.inl rfl + exact this.1 + have hs₂_f : s₂ ∈ closure f := by + have : s₂ ∈ closure f ∩ H.V := by rw [hlinkH.2.2.2]; exact Or.inr rfl + exact this.1 + have hd1 : d {s₁} f ≤ 2 := hd_inc_e s₁ hs₁.1 f hfH hs₁_f + have hd2 : d {s₂} f ≤ 2 := hd_inc_e s₂ hs₂.1 f hfH hs₂_f + have hsym2 : d f {s₂} = d {s₂} f := + hd_symm f (Or.inl (Or.inr hfH)) {s₂} (Or.inl (Or.inl ⟨s₂, hs₂.1, rfl⟩)) + have htri := hd_tri {s₁} (Or.inl (Or.inl ⟨s₁, hs₁.1, rfl⟩)) f (Or.inl (Or.inr hfH)) + {s₂} (Or.inl (Or.inl ⟨s₂, hs₂.1, rfl⟩)) + omega + have hHPath : IsHPathWithEnds G η.imageGraph P₀ (η.vMap s₁) (η.vMap s₂) := by + rw [hs₁_eq, hs₂_eq] + exact ⟨η.imageGraph_le, hP₀_path, hy₁_ne_y₂, + hs₁_eq ▸ η.bijOn_v.mapsTo hs₁.1, hs₂_eq ▸ η.bijOn_v.mapsTo hs₂.1, hVP₀, hEP₀⟩ + exact not_isMuSteppedSpan_of_isFlatSpan hFlat hMetric hθ_lt + ⟨P₀, s₁, s₂, hs₁.1, hs₂.1, hHPath, by omega⟩ + +/-- Claim (9) of Graph Minors XV, (5.2) (page 132): +For any rearrangement `H', η', T'` of `H, η, T` within `lam` of `z` (with `2 ≤ lam` and +`2 ≤ θ - (4 * lam + 2)`), from every vertex `y ∈ H'.V ∩ closure (atomZone H d z lam)` there is a +walk `W` in `G` from `η'.vMap y` to `η.vMap s` for some `s ∈ H.V \ atomZone H d z lam` with +`∃ σ ∈ atomZone H d z lam, pointDist H d σ s ≤ 4` such that every vertex of `W` is either `η.vMap s` +or `η'.vMap v` for some `v ∈ H'.V ∩ atomZone H d z lam`. -/ +theorem IsRearrangedWithin.exists_walk_to_outside + {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H H' : Drawing S} {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} + {θ_star θ lam : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z : Set S} + (hRearr : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) + (hlam : 2 ≤ lam) (hθ' : 2 ≤ θ - (4 * lam + 2)) + {y : S} (hyV : y ∈ H'.V) (hyZ : y ∈ closure (atomZone H d z lam)) : + let Z := atomZone H d z lam + ∃ (s : S) (W : GraphWalk G (η'.vMap y) (η.vMap s)), + s ∈ H.V ∧ s ∉ Z ∧ + (∃ σ ∈ Z, pointDist H d σ s ≤ 4) ∧ + ∀ w ∈ W.support, w = η.vMap s ∨ ∃ v ∈ H'.V, v ∈ Z ∧ w = η'.vMap v := by + intro Z + have hS : IsClosedSurface S := + ⟨hRearr.isSpan.isSurface.1, hRearr.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hRearr.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hRearr.isSpan.isConnected + have hMetric : HasTangleMetric H θ T d := hRearr.isCompression.hasMetric + obtain ⟨_, _, _, hd_symm, hd_tri, _, hd_inc_e⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + have h2E : 2 ≤ H.E.ncard := two_le_ncard_edges_of_tangle hS hMetric.1 (by omega) + obtain ⟨e_far, he_far, hd_far⟩ := + gm12_theorem_1_2 H θ T d z hS hConn (by omega) hMetric h2E hRearr.z_mem + have hv_far_ex : (closure e_far ∩ H.V).Nonempty := by + rcases H.edge_cond e_far he_far with ⟨x, u, _, hcl, _⟩ | ⟨x, hcl, _⟩ + · rw [hcl]; exact ⟨x, Or.inl rfl⟩ + · rw [hcl]; exact ⟨x, rfl⟩ + obtain ⟨v_out, hv_out_cl, hv_out_H⟩ := hv_far_ex + have hd_v_out : lam < d z {v_out} := by + have hinc : d {v_out} e_far ≤ 2 := hd_inc_e v_out hv_out_H e_far he_far hv_out_cl + have htri := hd_tri z hRearr.z_mem {v_out} (Or.inl (Or.inl ⟨v_out, hv_out_H, rfl⟩)) + e_far (Or.inl (Or.inr he_far)) + omega + have hv_out_notZ : v_out ∉ Z := fun h => + Nat.not_le.mpr hd_v_out ((mem_atomZone_iff_of_mem_atom (Or.inl (Or.inl ⟨v_out, hv_out_H, rfl⟩)) + rfl).mp h) + have hv_out_H' : v_out ∈ H'.V := (hRearr.vMap_eq v_out hv_out_H hd_v_out).1 + have hE'_ne : H'.E.Nonempty := edges_nonempty_of_tangle hS hRearr.isSpan'.isRespectful hθ' + obtain ⟨W_raw⟩ := twoCell_toGraph_connected hS hRearr.isSpan'.isRespectful.1 hE'_ne hyV hv_out_H' + obtain ⟨W₀, hW₀_sim, _, _⟩ := exists_isSimple_subwalk W_raw + obtain ⟨s, W₁, _, ⟨hs_H', hs_notZ⟩, hW₀_eq, hfirst⟩ := + exists_first_append_of_mem_set W₀ (X := {v ∈ H'.V | v ∉ Z}) + ⟨v_out, W₀.end_mem_support, hv_out_H', hv_out_notZ⟩ + have hW₁_sim : W₁.IsSimple := (GM09.isSimple_of_append (hW₀_eq ▸ hW₀_sim)).1 + rcases hRearr.atomZone_dichotomy.2.2.2.1 s hs_H' with hsZ | ⟨_, hs_H, hs_gt, hs_map⟩ + · exact (hs_notZ hsZ).elim + have hs_dist : ∃ σ ∈ Z, pointDist H d σ s ≤ 4 := by + by_cases hys : y = s + · subst hys + obtain ⟨σ, hσZ, hle3⟩ := (closure_atomZone_props hS hConn hMetric hRearr.z_mem y hyZ).1 + exact ⟨σ, hσZ, by omega⟩ + · have hW₁_rev_sim : W₁.reverse.IsSimple := by + unfold GraphWalk.IsSimple at hW₁_sim ⊢ + rwa [GraphWalk.support_reverse, List.nodup_reverse] + generalize hrev : W₁.reverse = R + cases R with + | nil _ => + exact (hys rfl).elim + | @cons _ v_prev _ e' hlink r => + have hv_prev_W₁ : v_prev ∈ W₁.support := by + have : v_prev ∈ W₁.reverse.support := by + rw [hrev, GraphWalk.support_cons] + exact List.mem_cons_of_mem _ r.start_mem_support + rwa [GraphWalk.support_reverse, List.mem_reverse] at this + have hv_prev_ne_s : v_prev ≠ s := by + intro hEq + rw [hrev] at hW₁_rev_sim + exact (List.nodup_cons.mp hW₁_rev_sim).1 (hEq ▸ r.start_mem_support) + have hv_prev_H' : v_prev ∈ H'.V := hlink.2.2.1 + have hv_prev_Z : v_prev ∈ Z := by + by_contra hnotZ + exact hv_prev_ne_s (hfirst v_prev hv_prev_W₁ ⟨hv_prev_H', hnotZ⟩) + have he'_H' : e' ∈ H'.E := hlink.1 + have hs_cl : s ∈ closure e' := by + have : s ∈ closure e' ∩ H'.V := by rw [hlink.2.2.2]; exact Or.inl rfl + exact this.1 + have hv_prev_cl : v_prev ∈ closure e' := by + have : v_prev ∈ closure e' ∩ H'.V := by rw [hlink.2.2.2]; exact Or.inr rfl + exact this.1 + rcases hRearr.atomZone_dichotomy.2.2.2.2.2 e' he'_H' with he'Z | ⟨_, he'H, _, _⟩ + · have hs_clZ : s ∈ closure Z := closure_mono he'Z hs_cl + obtain ⟨σ, hσZ, hle3⟩ := (closure_atomZone_props hS hConn hMetric hRearr.z_mem s hs_clZ).1 + exact ⟨σ, hσZ, by omega⟩ + · have hv_prev_H : v_prev ∈ H.V := by + have : v_prev ∈ closure e' ∩ H.V := by + rw [closure_inter_V_eq_diff H he'H, ← closure_inter_V_eq_diff H' he'_H'] + exact ⟨hv_prev_cl, hv_prev_H'⟩ + exact this.2 + refine ⟨v_prev, hv_prev_Z, ?_⟩ + have hd1 : d {v_prev} e' ≤ 2 := hd_inc_e v_prev hv_prev_H e' he'H hv_prev_cl + have hd2 : d {s} e' ≤ 2 := hd_inc_e s hs_H e' he'H hs_cl + have hsym2 : d e' {s} = d {s} e' := + hd_symm e' (Or.inl (Or.inr he'H)) {s} (Or.inl (Or.inl ⟨s, hs_H, rfl⟩)) + have htri := hd_tri {v_prev} (Or.inl (Or.inl ⟨v_prev, hv_prev_H, rfl⟩)) + e' (Or.inl (Or.inr he'H)) {s} (Or.inl (Or.inl ⟨s, hs_H, rfl⟩)) + have hpd : pointDist H d v_prev s = d {v_prev} {s} := + pointDist_eq_of_mem_atom (a₁ := {v_prev}) (a₂ := {s}) + (Or.inl (Or.inl ⟨v_prev, hv_prev_H, rfl⟩)) + (Or.inl (Or.inl ⟨s, hs_H, rfl⟩)) rfl rfl + omega + obtain ⟨W_im, hW_im_sim, hW_im_sup, _⟩ := η'.exists_walk_imageGraph W₁ hW₁_sim + have ⟨W_G, hWG_sup⟩ : ∃ W_G : GraphWalk G (η'.vMap y) (η.vMap s), W_G.support = W_im.support := by + rw [← hs_map] + obtain ⟨W_G0, hWG0_sup, _⟩ := GM09.exists_walk_up_of_le η'.imageGraph_le W_im + exact ⟨W_G0, hWG0_sup⟩ + refine ⟨s, W_G, hs_H, hs_notZ, hs_dist, fun w hw => ?_⟩ + have hw_im : w ∈ W_im.support := hWG_sup ▸ hw + rw [hW_im_sup, List.mem_map] at hw_im + obtain ⟨v, hv_W₁, rfl⟩ := hw_im + have hv_H' : v ∈ H'.V := W₁.mem_vertexSet_of_mem_support hv_W₁ + by_cases hvZ : v ∈ Z + · exact Or.inr ⟨v, hv_H', hvZ, rfl⟩ + · have hvs : v = s := hfirst v hv_W₁ ⟨hv_H', hvZ⟩ + subst hvs + exact Or.inl hs_map + +/-- From any vertex `a ∈ W.support` of a walk `W : GraphWalk G x y`, there is a walk `W' : GraphWalk +G a y` +whose support is contained in `W.support`. -/ +theorem exists_walk_from_of_mem_support {G : Graph α β} {x y a : α} + (W : GraphWalk G x y) (ha : a ∈ W.support) : + ∃ W' : GraphWalk G a y, ∀ w ∈ W'.support, w ∈ W.support := by + induction W with + | @nil u hu => + rw [GraphWalk.support_nil, List.mem_singleton] at ha + subst ha + exact ⟨.nil hu, fun w hw => hw⟩ + | @cons u v z e hlink r ih => + rw [GraphWalk.support_cons, List.mem_cons] at ha + rcases ha with rfl | har + · exact ⟨.cons hlink r, fun w hw => hw⟩ + · obtain ⟨W', hW'⟩ := ih har + refine ⟨W', fun w hw => ?_⟩ + rw [GraphWalk.support_cons] + exact List.mem_cons_of_mem u (hW' w hw) + +/-- Between any two vertices `a₁, a₂ ∈ W.support` of a walk `W : GraphWalk G x y`, there is a walk +`W' : GraphWalk G a₁ a₂` whose support is contained in `W.support`. -/ +theorem exists_walk_between_of_mem_support {G : Graph α β} {x y a₁ a₂ : α} + (W : GraphWalk G x y) (ha₁ : a₁ ∈ W.support) (ha₂ : a₂ ∈ W.support) : + ∃ W' : GraphWalk G a₁ a₂, ∀ w ∈ W'.support, w ∈ W.support := by + obtain ⟨W₁, hW₁⟩ := exists_walk_from_of_mem_support W ha₁ + obtain ⟨W₂, hW₂⟩ := exists_walk_from_of_mem_support W ha₂ + refine ⟨W₁.append W₂.reverse, fun w hw => ?_⟩ + rcases (GraphWalk.mem_support_append _ _).mp hw with hw₁ | hw₂ + · exact hW₁ w hw₁ + · rw [GraphWalk.support_reverse, List.mem_reverse] at hw₂ + exact hW₂ w hw₂ + +/-- Claim (10) of `(5.2)` (page 132) in full: no walk `W` in `G` from `X₁` to `X₂` has all its +vertices in `V(η(H))` contained in `X₁ ∪ X₂`. -/ +theorem no_walk_between_X₁_X₂ + {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H H' H'' : Drawing S} + {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} {η'' : SpanEmbedding H'' G} + {θ_star θ lam lam₁ lam₂ μ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' d'' : Set S → Set S → ℕ} {z₁ z₂ : Set S} + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hθ_lt : 4 * lam + 2 < θ) + (hlam₁ : 4 ≤ lam₁) (hlam₂ : 4 ≤ lam₂) + (hlam : 6 * lam₁ + 5 * lam₂ + 3 * μ + 4 ≤ lam) + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' d' + d'' z₂) + (hStep : IsMuSteppedSpan G H'' η'' d'' μ) + {a₁ a₂ : α} (W : GraphWalk G a₁ a₂) + (ha₁ : a₁ ∈ (η.vMap '' {s ∈ H.V | ∃ σ₁ ∈ atomZone H d z₁ lam₁, pointDist H d σ₁ s ≤ μ + 4}) ∪ + (η'.vMap '' (H'.V ∩ atomZone H d z₁ lam₁))) + (ha₂ : a₂ ∈ (η.vMap '' {s ∈ H.V | ∃ σ₂ ∈ atomZone H' d' z₂ lam₂, pointDist H d σ₂ s ≤ μ + 4}) ∪ + (η''.vMap '' (H''.V ∩ atomZone H' d' z₂ lam₂))) + (hW_V : ∀ w ∈ W.support, w ∈ V(η.imageGraph) → + w ∈ ((η.vMap '' {s ∈ H.V | ∃ σ₁ ∈ atomZone H d z₁ lam₁, pointDist H d σ₁ s ≤ μ + 4}) ∪ + (η'.vMap '' (H'.V ∩ atomZone H d z₁ lam₁))) ∪ + ((η.vMap '' {s ∈ H.V | ∃ σ₂ ∈ atomZone H' d' z₂ lam₂, pointDist H d σ₂ s ≤ μ + 4}) ∪ + (η''.vMap '' (H''.V ∩ atomZone H' d' z₂ lam₂)))) : + False := by + let Z₁ := atomZone H d z₁ lam₁ + let Z₂ := atomZone H' d' z₂ lam₂ + let S₁ := {s ∈ H.V | ∃ σ₁ ∈ Z₁, pointDist H d σ₁ s ≤ μ + 4} + let S₂ := {s ∈ H.V | ∃ σ₂ ∈ Z₂, pointDist H d σ₂ s ≤ μ + 4} + let X₁ := (η.vMap '' S₁) ∪ (η'.vMap '' (H'.V ∩ Z₁)) + let X₂ := (η.vMap '' S₂) ∪ (η''.vMap '' (H''.V ∩ Z₂)) + have hS : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + have hMetric : HasTangleMetric H θ T d := hRearr₁.isCompression.hasMetric + have hMetric' : HasTangleMetric H' (θ - (4 * lam₁ + 2)) T' d' := hRearr₁.isCompression.hasMetric' + obtain ⟨_, _, _, hd_symm, hd_tri, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + obtain ⟨_, _, _, hd'_symm, hd'_tri, _⟩ := gm11_theorem_9_1 H' (θ - (4 * lam₁ + 2)) T' d' hS hConn + hMetric' + obtain ⟨τ, hτ_z₂⟩ := atom_nonempty hRearr₂.z_mem + obtain ⟨z₃, hz₃, hτ_z₃⟩ := exists_atom_of_point H τ + obtain ⟨_, hClaim4, _, hClaim6, _, _, _⟩ := + lemma_5_2_claims_3_to_6 hFlat hθ_lt hlam₁ hlam₂ hlam hRearr₁ hRearr₂ hStep hτ_z₂ hz₃ hτ_z₃ + have hX₁_V : ∀ w ∈ X₁, w ∈ V(η.imageGraph) → w ∈ η.vMap '' S₁ := by + rintro w (hw | ⟨v, ⟨hvH', hvZ₁⟩, rfl⟩) hw_im + · exact hw + · obtain ⟨x, hxH, hmap⟩ := η.bijOn_v.surjOn hw_im + by_cases hxZ₁ : x ∈ Z₁ + · refine ⟨x, ⟨hxH, x, hxZ₁, ?_⟩, hmap⟩ + obtain ⟨_, hd_refl, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + have hxA : ({x} : Set S) ∈ H.A := Or.inl (Or.inl ⟨x, hxH, rfl⟩) + rw [pointDist_eq_of_mem_atom (a₁ := {x}) (a₂ := {x}) hxA hxA rfl rfl, hd_refl {x} hxA] + omega + · rcases hRearr₁.atomZone_dichotomy.2.2.1 x hxH with ⟨_, hxZ₁'⟩ | ⟨_, _, hxH', hx_map⟩ + · exact (hxZ₁ hxZ₁').elim + · have hxv : x = v := η'.bijOn_v.injOn hxH' hvH' (hx_map.trans hmap) + exact (hxZ₁ (hxv ▸ hvZ₁)).elim + have hX₂_V : ∀ w ∈ X₂, w ∈ V(η.imageGraph) → w ∈ η.vMap '' S₁ ∪ η.vMap '' S₂ := by + rintro w (hw | ⟨v, ⟨hvH'', hvZ₂⟩, rfl⟩) hw_im + · exact Or.inr hw + · obtain ⟨x, hxH, hmap⟩ := η.bijOn_v.surjOn hw_im + obtain ⟨_, hd_refl, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + have hxA : ({x} : Set S) ∈ H.A := Or.inl (Or.inl ⟨x, hxH, rfl⟩) + have h0 : pointDist H d x x = 0 := by + rw [pointDist_eq_of_mem_atom (a₁ := {x}) (a₂ := {x}) hxA hxA rfl rfl, hd_refl {x} hxA] + by_cases hxZ₁ : x ∈ Z₁ + · exact Or.inl ⟨x, ⟨hxH, x, hxZ₁, by omega⟩, hmap⟩ + · by_cases hxZ₂ : x ∈ Z₂ + · exact Or.inr ⟨x, ⟨hxH, x, hxZ₂, by omega⟩, hmap⟩ + · rcases hRearr₁.atomZone_dichotomy.2.2.1 x hxH with ⟨_, hxZ₁'⟩ | ⟨_, _, hxH', hx_map₁⟩ + · exact (hxZ₁ hxZ₁').elim + · rcases hRearr₂.atomZone_dichotomy.2.2.1 x hxH' with ⟨_, hxZ₂'⟩ | ⟨_, _, hxH'', hx_map₂⟩ + · exact (hxZ₂ hxZ₂').elim + · have hxv : x = v := η''.bijOn_v.injOn hxH'' hvH'' ((hx_map₂.trans hx_map₁).trans hmap) + exact (hxZ₂ (hxv ▸ hvZ₂)).elim + have ⟨s₁, hs₁, W_left, hW_left⟩ : + ∃ s₁ ∈ S₁, ∃ W_left : GraphWalk G (η.vMap s₁) a₁, ∀ w ∈ W_left.support, w ∈ X₁ := by + rcases ha₁ with ⟨s₁, hs₁, rfl⟩ | ⟨y₁, ⟨hy₁H', hy₁Z₁⟩, rfl⟩ + · exact ⟨s₁, hs₁, .nil (η.imageGraph_le.1 (η.bijOn_v.mapsTo hs₁.1)), fun w hw => by + rw [GraphWalk.support_nil, List.mem_singleton] at hw + subst hw; exact Or.inl ⟨s₁, hs₁, rfl⟩⟩ + · obtain ⟨s₁, W₀, hs₁H, _, ⟨σ₁, hσ₁Z₁, hle4⟩, hW₀_sup⟩ := + hRearr₁.exists_walk_to_outside (by omega) (by omega) hy₁H' (subset_closure hy₁Z₁) + have hs₁S₁ : s₁ ∈ S₁ := ⟨hs₁H, σ₁, hσ₁Z₁, by omega⟩ + refine ⟨s₁, hs₁S₁, W₀.reverse, fun w hw => ?_⟩ + rw [GraphWalk.support_reverse, List.mem_reverse] at hw + rcases hW₀_sup w hw with rfl | ⟨v, hvH', hvZ₁, rfl⟩ + · exact Or.inl ⟨s₁, hs₁S₁, rfl⟩ + · exact Or.inr ⟨v, ⟨hvH', hvZ₁⟩, rfl⟩ + have ⟨s₂, hs₂, W_right, hW_right⟩ : + ∃ s₂ ∈ S₂, ∃ W_right : GraphWalk G a₂ (η.vMap s₂), ∀ w ∈ W_right.support, w ∈ X₂ := by + rcases ha₂ with ⟨s₂, hs₂, rfl⟩ | ⟨y₂, ⟨hy₂H'', hy₂Z₂⟩, rfl⟩ + · exact ⟨s₂, hs₂, .nil (η.imageGraph_le.1 (η.bijOn_v.mapsTo hs₂.1)), fun w hw => by + rw [GraphWalk.support_nil, List.mem_singleton] at hw + subst hw; exact Or.inl ⟨s₂, hs₂, rfl⟩⟩ + · obtain ⟨s₂, W₀, hs₂H', _, ⟨σ₂, hσ₂Z₂, hle4⟩, hW₀_sup⟩ := + hRearr₂.exists_walk_to_outside (by omega) (by omega) hy₂H'' (subset_closure hy₂Z₂) + have hlt_Z₁ : ∀ σ₁ ∈ Z₁, pointDist H' d' σ₂ s₂ < pointDist H' d' σ₂ σ₁ := by + intro σ₁ hσ₁Z₁ + have h4 := (hClaim4 σ₁ hσ₁Z₁).2 + obtain ⟨a_σ₁, ha_σ₁, hσ₁_a⟩ := exists_atom_of_point H' σ₁ + obtain ⟨a_σ₂, ha_σ₂, hσ₂_a⟩ := exists_atom_of_point H' σ₂ + have hd'_σ₂ : d' z₂ a_σ₂ ≤ lam₂ := (mem_atomZone_iff_of_mem_atom ha_σ₂ hσ₂_a).mp hσ₂Z₂ + rw [pointDist_eq_of_mem_atom hRearr₂.z_mem ha_σ₁ hτ_z₂ hσ₁_a] at h4 + rw [pointDist_eq_of_mem_atom ha_σ₂ ha_σ₁ hσ₂_a hσ₁_a] + have hsym := hd'_symm z₂ hRearr₂.z_mem a_σ₁ ha_σ₁ + have htri := hd'_tri a_σ₁ ha_σ₁ a_σ₂ ha_σ₂ z₂ hRearr₂.z_mem + have hsym2 := hd'_symm a_σ₂ ha_σ₂ z₂ hRearr₂.z_mem + have hsym3 := hd'_symm a_σ₁ ha_σ₁ a_σ₂ ha_σ₂ + omega + have hs₂_notZ₁ : s₂ ∉ Z₁ := by + intro hs₂Z₁ + have hlt := hlt_Z₁ s₂ hs₂Z₁ + omega + rcases hRearr₁.atomZone_dichotomy.2.2.2.1 s₂ hs₂H' with hs₂Z₁ | ⟨_, hs₂H, _, hs₂_map⟩ + · exact (hs₂_notZ₁ hs₂Z₁).elim + have hZ₁_sub : ∀ a' ∈ H'.A, a' ∉ H.A → a' ⊆ Z₁ := by + intro a' ha' hnot + rcases hRearr₁.atomZone_dichotomy.2.1 a' ha' with hsub | ⟨_, haH, _⟩ + · exact hsub + · exact (hnot haH).elim + have hd_le_d' : pointDist H d σ₂ s₂ ≤ pointDist H' d' σ₂ s₂ := + theorem_4_2_proof H' H Z₁ (θ - (4 * lam₁ + 2)) θ (4 * lam₁ + 2) T' T d' d σ₂ s₂ + hS hConn hMetric' hMetric hZ₁_sub (Or.inr hRearr₁.isCompression) hlt_Z₁ (by omega) + have hs₂S₂ : s₂ ∈ S₂ := ⟨hs₂H, σ₂, hσ₂Z₂, by omega⟩ + have ⟨W₁, hW₁_sup⟩ : ∃ W₁ : GraphWalk G (η''.vMap y₂) (η.vMap s₂), W₁.support = W₀.support + := by + rw [← hs₂_map] + exact ⟨W₀, rfl⟩ + refine ⟨s₂, hs₂S₂, W₁, fun w hw => ?_⟩ + rw [hW₁_sup] at hw + rcases hW₀_sup w hw with rfl | ⟨v, hvH'', hvZ₂, rfl⟩ + · rw [hs₂_map] + exact Or.inl ⟨s₂, hs₂S₂, rfl⟩ + · exact Or.inr ⟨v, ⟨hvH'', hvZ₂⟩, rfl⟩ + let W_full := W_left.append (W.append W_right) + refine no_walk_between_S₁_S₂ hFlat hMetric hθ_lt hlam₁ hlam₂ hlam hClaim6 W_full + ⟨s₁, hs₁, rfl⟩ ⟨s₂, hs₂, rfl⟩ (fun w hw hw_im => ?_) + rcases (GraphWalk.mem_support_append _ _).mp hw with hw_l | hw_r + · exact Or.inl (hX₁_V w (hW_left w hw_l) hw_im) + · rcases (GraphWalk.mem_support_append _ _).mp hw_r with hw_m | hw_r2 + · rcases hW_V w hw_m hw_im with hwX₁ | hwX₂ + · exact Or.inl (hX₁_V w hwX₁ hw_im) + · exact hX₂_V w hwX₂ hw_im + · exact hX₂_V w (hW_right w hw_r2) hw_im + +/-- A point `x` lies in `Γ.U` if and only if `x ∈ Γ.V` or `x ∈ e` for some `e ∈ Γ.E`. -/ +theorem mem_U_iff_mem_V_or_mem_E {S : Type w} [TopologicalSpace S] + (Γ : Drawing S) (x : S) : + x ∈ Γ.U ↔ x ∈ Γ.V ∨ ∃ e ∈ Γ.E, x ∈ e := by + rw [Γ.U_eq, mem_union, mem_iUnion₂] + constructor + · rintro (hxV | ⟨e, he, hxcl⟩) + · exact Or.inl hxV + · by_cases hxe : x ∈ e + · exact Or.inr ⟨e, he, hxe⟩ + · have hxV : x ∈ closure e ∩ Γ.V := by + rw [closure_inter_V_eq_diff Γ he] + exact ⟨hxcl, hxe⟩ + exact Or.inl hxV.2 + · rintro (hxV | ⟨e, he, hxe⟩) + · exact Or.inl hxV + · exact Or.inr ⟨e, he, subset_closure hxe⟩ + +/-- For every atom `a ∈ Γ.A` of a drawing `Γ`, `closure a \ a ⊆ Γ.U`. -/ +theorem closure_atom_diff_subset_U {S : Type w} [TopologicalSpace S] [T1Space S] + [LocallyConnectedSpace S] (Γ : Drawing S) {a : Set S} (ha : a ∈ Γ.A) : + closure a \ a ⊆ Γ.U := by + rcases ha with (⟨v, _, rfl⟩ | he) | hr + · rw [closure_singleton, Set.sdiff_self] + exact empty_subset _ + · rw [← closure_inter_V_eq_diff Γ he] + exact inter_subset_right.trans Γ.V_subset_U + · intro x ⟨hx_cl, hx_not⟩ + exact (closure_region_subset hr hx_cl).resolve_left hx_not + +/-- If a region `r ∈ Γ₁.R` is disjoint from `Γ₂.U` and satisfies `closure r \ r ⊆ Γ₂.U`, then +`r ∈ Γ₂.R`. -/ +theorem region_mem_of_disjoint_U {S : Type w} [TopologicalSpace S] [LocallyConnectedSpace S] + {Γ₁ Γ₂ : Drawing S} {r : Set S} (hr : r ∈ Γ₁.R) + (hdisj : Disjoint r Γ₂.U) (hbd : closure r \ r ⊆ Γ₂.U) : + r ∈ Γ₂.R := by + obtain ⟨x, hxr⟩ := region_nonempty hr + have hxU₂ : x ∉ Γ₂.U := Set.disjoint_left.mp hdisj hxr + obtain ⟨r', hr', hxr'⟩ := exists_region_of_notMem (Γ := Γ₂) hxU₂ + have hsub₁ : r ⊆ r' := subset_region hr' (region_isPreconnected hr) hdisj hxr hxr' + have hsub₂ : r' ⊆ r := by + intro y hy + by_contra hyr + have hy_not_cl : y ∈ (closure r)ᶜ := fun hycl => region_subset hr' hy (hbd ⟨hycl, hyr⟩) + obtain ⟨z, _, hzr, hz_compl⟩ := + region_isPreconnected hr' r (closure r)ᶜ (region_isOpen hr) isClosed_closure.isOpen_compl + (fun w hw => by_cases Or.inl fun hwr => + Or.inr fun hwcl => region_subset hr' hw (hbd ⟨hwcl, hwr⟩)) + ⟨x, hxr', hxr⟩ ⟨y, hy, hy_not_cl⟩ + exact hz_compl (subset_closure hzr) + exact Subset.antisymm hsub₁ hsub₂ ▸ hr' + +private theorem outer_vertices_follow_second_rearrangement + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {G : Graph α β} + {H : Drawing S} + {H' : Drawing S} + {H'' : Drawing S} + {η : SpanEmbedding H G} + {η' : SpanEmbedding H' G} + {η'' : SpanEmbedding H'' G} + {θ_star : ℕ} + {θ : ℕ} + {lam₁ : ℕ} + {lam₂ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {d' : Set S → Set S → ℕ} + {d'' : Set S → Set S → ℕ} + {z₁ : Set S} + {z₂ : Set S} + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' + d' d'' z₂) + (Z₁ : Set S) + (hZoneEqZ₁ : Z₁ = atomZone H d z₁ lam₁) + (Z₂ : Set S) + (hZoneEqZ₂ : Z₂ = atomZone H' d' z₂ lam₂) + (H''' : Drawing S) + (hH'''_V : ∀ (v : S), v ∈ H'''.V ↔ v ∈ H.V ∧ v ∉ Z₂ ∨ v ∈ H''.V ∧ v ∈ Z₂) + (vMap''' : S → α) + (hvMap'''_Z₂ : ∀ v ∈ Z₂, vMap''' v = η''.vMap v) + (hvMap'''_notZ₂ : ∀ v ∉ Z₂, vMap''' v = η.vMap v) : + ∀ v ∉ Z₁, (v ∈ H'''.V ↔ v ∈ H''.V) ∧ (v ∈ H'''.V → vMap''' v = η''.vMap v) := by + subst Z₂ + let Z₂ := atomZone H' d' z₂ lam₂ + subst Z₁ + let Z₁ := atomZone H d z₁ lam₁ + intro v hv_notZ₁ + by_cases hvZ₂ : v ∈ Z₂ + · rw [hH'''_V, hvMap'''_Z₂ v hvZ₂] + exact ⟨⟨fun h => (h.resolve_left fun h1 => h1.2 hvZ₂).1, fun h => Or.inr ⟨h, hvZ₂⟩⟩, + fun _ => rfl⟩ + · rw [hH'''_V, hvMap'''_notZ₂ v hvZ₂] + have hH_iff_H' : (v ∈ H.V ↔ v ∈ H'.V) ∧ (v ∈ H.V → η.vMap v = η'.vMap v) := by + constructor + · refine ⟨fun hvH => ?_, fun hvH' => ?_⟩ + · rcases hRearr₁.atomZone_dichotomy.2.2.1 v hvH with ⟨_, hZ₁⟩ | ⟨_, _, hvH', _⟩ + · exact (hv_notZ₁ hZ₁).elim + · exact hvH' + · rcases hRearr₁.atomZone_dichotomy.2.2.2.1 v hvH' with hZ₁ | ⟨_, hvH, _⟩ + · exact (hv_notZ₁ hZ₁).elim + · exact hvH + · intro hvH + rcases hRearr₁.atomZone_dichotomy.2.2.1 v hvH with ⟨_, hZ₁⟩ | ⟨_, _, _, hmap⟩ + · exact (hv_notZ₁ hZ₁).elim + · exact hmap.symm + have hH'_iff_H'' : (v ∈ H'.V ↔ v ∈ H''.V) ∧ (v ∈ H'.V → η'.vMap v = η''.vMap v) := by + constructor + · refine ⟨fun hvH' => ?_, fun hvH'' => ?_⟩ + · rcases hRearr₂.atomZone_dichotomy.2.2.1 v hvH' with ⟨_, hZ₂⟩ | ⟨_, _, hvH'', _⟩ + · exact (hvZ₂ hZ₂).elim + · exact hvH'' + · rcases hRearr₂.atomZone_dichotomy.2.2.2.1 v hvH'' with hZ₂ | ⟨_, hvH', _⟩ + · exact (hvZ₂ hZ₂).elim + · exact hvH' + · intro hvH' + rcases hRearr₂.atomZone_dichotomy.2.2.1 v hvH' with ⟨_, hZ₂⟩ | ⟨_, _, _, hmap⟩ + · exact (hvZ₂ hZ₂).elim + · exact hmap.symm + refine ⟨?_, fun hv''' => ?_⟩ + · rw [hH_iff_H'.1, hH'_iff_H''.1] + exact ⟨fun h => h.elim And.left And.left, fun h => Or.inl ⟨h, hvZ₂⟩⟩ + · have hvH : v ∈ H.V := (hv'''.resolve_right fun h => hvZ₂ h.2).1 + exact (hH_iff_H'.2 hvH).trans (hH'_iff_H''.2 (hH_iff_H'.1.mp hvH)) + +private theorem outer_edges_follow_second_rearrangement + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {G : Graph α β} + {H : Drawing S} + {H' : Drawing S} + {H'' : Drawing S} + {η : SpanEmbedding H G} + {η' : SpanEmbedding H' G} + {η'' : SpanEmbedding H'' G} + {θ_star : ℕ} + {θ : ℕ} + {lam₁ : ℕ} + {lam₂ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {d' : Set S → Set S → ℕ} + {d'' : Set S → Set S → ℕ} + {z₁ : Set S} + {z₂ : Set S} + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' + d' d'' z₂) + (Z₁ : Set S) + (hZoneEqZ₁ : Z₁ = atomZone H d z₁ lam₁) + (Z₂ : Set S) + (hZoneEqZ₂ : Z₂ = atomZone H' d' z₂ lam₂) + (H''' : Drawing S) + (hH'''_E : ∀ (e : Set S), e ∈ H'''.E ↔ e ∈ H.E ∧ ¬e ⊆ Z₂ ∨ e ∈ H''.E ∧ e ⊆ Z₂) + (eMap''' : Set S → β) + (heMap'''_Z₂ : ∀ e ⊆ Z₂, eMap''' e = η''.eMap e) + (heMap'''_notZ₂ : ∀ (e : Set S), ¬e ⊆ Z₂ → eMap''' e = η.eMap e) : + ∀ (e : Set S), ¬e ⊆ Z₁ → (e ∈ H'''.E ↔ e ∈ H''.E) ∧ (e ∈ H'''.E → eMap''' e = η''.eMap e) := by + subst Z₂ + let Z₂ := atomZone H' d' z₂ lam₂ + subst Z₁ + let Z₁ := atomZone H d z₁ lam₁ + intro e he_notZ₁ + by_cases heZ₂ : e ⊆ Z₂ + · rw [hH'''_E, heMap'''_Z₂ e heZ₂] + exact ⟨⟨fun h => (h.resolve_left fun h1 => h1.2 heZ₂).1, fun h => Or.inr ⟨h, heZ₂⟩⟩, + fun _ => rfl⟩ + · rw [hH'''_E, heMap'''_notZ₂ e heZ₂] + have hH_iff_H' : (e ∈ H.E ↔ e ∈ H'.E) ∧ (e ∈ H.E → η.eMap e = η'.eMap e) := by + constructor + · refine ⟨fun heH => ?_, fun heH' => ?_⟩ + · rcases hRearr₁.atomZone_dichotomy.2.2.2.2.1 e heH with ⟨_, hZ₁⟩ | ⟨_, _, heH', _⟩ + · exact (he_notZ₁ hZ₁).elim + · exact heH' + · rcases hRearr₁.atomZone_dichotomy.2.2.2.2.2 e heH' with hZ₁ | ⟨_, heH, _⟩ + · exact (he_notZ₁ hZ₁).elim + · exact heH + · intro heH + rcases hRearr₁.atomZone_dichotomy.2.2.2.2.1 e heH with ⟨_, hZ₁⟩ | ⟨_, _, _, hmap⟩ + · exact (he_notZ₁ hZ₁).elim + · exact hmap.symm + have hH'_iff_H'' : (e ∈ H'.E ↔ e ∈ H''.E) ∧ (e ∈ H'.E → η'.eMap e = η''.eMap e) := by + constructor + · refine ⟨fun heH' => ?_, fun heH'' => ?_⟩ + · rcases hRearr₂.atomZone_dichotomy.2.2.2.2.1 e heH' with ⟨_, hZ₂⟩ | ⟨_, _, heH'', _⟩ + · exact (heZ₂ hZ₂).elim + · exact heH'' + · rcases hRearr₂.atomZone_dichotomy.2.2.2.2.2 e heH'' with hZ₂ | ⟨_, heH', _⟩ + · exact (heZ₂ hZ₂).elim + · exact heH' + · intro heH' + rcases hRearr₂.atomZone_dichotomy.2.2.2.2.1 e heH' with ⟨_, hZ₂⟩ | ⟨_, _, _, hmap⟩ + · exact (heZ₂ hZ₂).elim + · exact hmap.symm + refine ⟨?_, fun he''' => ?_⟩ + · rw [hH_iff_H'.1, hH'_iff_H''.1] + exact ⟨fun h => h.elim And.left And.left, fun h => Or.inl ⟨h, heZ₂⟩⟩ + · have heH : e ∈ H.E := (he'''.resolve_right fun h => heZ₂ h.2).1 + exact (hH_iff_H'.2 heH).trans (hH'_iff_H''.2 (hH_iff_H'.1.mp heH)) + +private theorem combined_drawing_vertex_map_is_injective + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {G : Graph α β} + {H : Drawing S} + {H' : Drawing S} + {H'' : Drawing S} + {η : SpanEmbedding H G} + {η' : SpanEmbedding H' G} + {η'' : SpanEmbedding H'' G} + {θ_star : ℕ} + {θ : ℕ} + {lam : ℕ} + {lam₁ : ℕ} + {lam₂ : ℕ} + {μ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {d' : Set S → Set S → ℕ} + {d'' : Set S → Set S → ℕ} + {z₁ : Set S} + {z₂ : Set S} + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hθ_lt : 4 * lam + 2 < θ) + (hlam₁ : 4 ≤ lam₁) + (hlam₂ : 4 ≤ lam₂) + (hlam : 6 * lam₁ + 5 * lam₂ + 3 * μ + 4 ≤ lam) + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' + d' d'' z₂) + (hStep : IsMuSteppedSpan G H'' η'' d'' μ) + (Z₁ : Set S) + (hZoneEqZ₁ : Z₁ = atomZone H d z₁ lam₁) + (Z₂ : Set S) + (hZoneEqZ₂ : Z₂ = atomZone H' d' z₂ lam₂) + (hd_refl : ∀ a ∈ H.A, d a a = 0) + (H''' : Drawing S) + (hH'''_V : ∀ (v : S), v ∈ H'''.V ↔ v ∈ H.V ∧ v ∉ Z₂ ∨ v ∈ H''.V ∧ v ∈ Z₂) + (vMap''' : S → α) + (hvMap'''_Z₂ : ∀ v ∈ Z₂, vMap''' v = η''.vMap v) + (hvMap'''_notZ₂ : ∀ v ∉ Z₂, vMap''' v = η.vMap v) + (hV_notZ₁ : ∀ v ∉ Z₁, (v ∈ H'''.V ↔ v ∈ H''.V) ∧ (v ∈ H'''.V → vMap''' v = η''.vMap v)) : + InjOn vMap''' H'''.V := by + subst Z₂ + let Z₂ := atomZone H' d' z₂ lam₂ + subst Z₁ + let Z₁ := atomZone H d z₁ lam₁ + intro v₁ hv₁ v₂ hv₂ hEq + rcases (hH'''_V v₁).mp hv₁ with ⟨hv₁H, hv₁_notZ₂⟩ | ⟨hv₁H'', hv₁Z₂⟩ <;> + rcases (hH'''_V v₂).mp hv₂ with ⟨hv₂H, hv₂_notZ₂⟩ | ⟨hv₂H'', hv₂Z₂⟩ + · rw [hvMap'''_notZ₂ v₁ hv₁_notZ₂, hvMap'''_notZ₂ v₂ hv₂_notZ₂] at hEq + exact η.bijOn_v.injOn hv₁H hv₂H hEq + · by_cases hv₁Z₁ : v₁ ∈ Z₁ + · exfalso + rw [hvMap'''_notZ₂ v₁ hv₁_notZ₂, hvMap'''_Z₂ v₂ hv₂Z₂] at hEq + have hv₁_A : ({v₁} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v₁, hv₁H, rfl⟩) + have h0 : pointDist H d v₁ v₁ = 0 := by + rw [pointDist_eq_of_mem_atom (a₁ := {v₁}) (a₂ := {v₁}) hv₁_A hv₁_A rfl rfl, + hd_refl {v₁} hv₁_A] + have ha₁ : η.vMap v₁ ∈ (η.vMap '' {s ∈ H.V | ∃ σ₁ ∈ Z₁, pointDist H d σ₁ s ≤ μ + 4}) ∪ + (η'.vMap '' (H'.V ∩ Z₁)) := + Or.inl ⟨v₁, ⟨hv₁H, v₁, hv₁Z₁, by omega⟩, rfl⟩ + have ha₂ : η.vMap v₁ ∈ (η.vMap '' {s ∈ H.V | ∃ σ₂ ∈ Z₂, pointDist H d σ₂ s ≤ μ + 4}) ∪ + (η''.vMap '' (H''.V ∩ Z₂)) := by + rw [hEq] + exact Or.inr ⟨v₂, ⟨hv₂H'', hv₂Z₂⟩, rfl⟩ + exact no_walk_between_X₁_X₂ hFlat hθ_lt hlam₁ hlam₂ hlam hRearr₁ hRearr₂ hStep + (.nil (η.imageGraph_le.1 (η.bijOn_v.mapsTo hv₁H))) ha₁ ha₂ + (fun w hw _ => by + rw [GraphWalk.support_nil, List.mem_singleton] at hw + subst hw; exact Or.inl ha₁) + · have hv₁H'' : v₁ ∈ H''.V := (hV_notZ₁ v₁ hv₁Z₁).1.mp hv₁ + have hmap₁ : vMap''' v₁ = η''.vMap v₁ := (hV_notZ₁ v₁ hv₁Z₁).2 hv₁ + rw [hmap₁, hvMap'''_Z₂ v₂ hv₂Z₂] at hEq + exact η''.bijOn_v.injOn hv₁H'' hv₂H'' hEq + · by_cases hv₂Z₁ : v₂ ∈ Z₁ + · exfalso + rw [hvMap'''_Z₂ v₁ hv₁Z₂, hvMap'''_notZ₂ v₂ hv₂_notZ₂] at hEq + have hv₂_A : ({v₂} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v₂, hv₂H, rfl⟩) + have h0 : pointDist H d v₂ v₂ = 0 := by + rw [pointDist_eq_of_mem_atom (a₁ := {v₂}) (a₂ := {v₂}) hv₂_A hv₂_A rfl rfl, + hd_refl {v₂} hv₂_A] + have ha₁ : η.vMap v₂ ∈ (η.vMap '' {s ∈ H.V | ∃ σ₁ ∈ Z₁, pointDist H d σ₁ s ≤ μ + 4}) ∪ + (η'.vMap '' (H'.V ∩ Z₁)) := + Or.inl ⟨v₂, ⟨hv₂H, v₂, hv₂Z₁, by omega⟩, rfl⟩ + have ha₂ : η.vMap v₂ ∈ (η.vMap '' {s ∈ H.V | ∃ σ₂ ∈ Z₂, pointDist H d σ₂ s ≤ μ + 4}) ∪ + (η''.vMap '' (H''.V ∩ Z₂)) := by + rw [← hEq] + exact Or.inr ⟨v₁, ⟨hv₁H'', hv₁Z₂⟩, rfl⟩ + exact no_walk_between_X₁_X₂ hFlat hθ_lt hlam₁ hlam₂ hlam hRearr₁ hRearr₂ hStep + (.nil (η.imageGraph_le.1 (η.bijOn_v.mapsTo hv₂H))) ha₁ ha₂ + (fun w hw _ => by + rw [GraphWalk.support_nil, List.mem_singleton] at hw + subst hw; exact Or.inl ha₁) + · have hv₂H'' : v₂ ∈ H''.V := (hV_notZ₁ v₂ hv₂Z₁).1.mp hv₂ + have hmap₂ : vMap''' v₂ = η''.vMap v₂ := (hV_notZ₁ v₂ hv₂Z₁).2 hv₂ + rw [hvMap'''_Z₂ v₁ hv₁Z₂, hmap₂] at hEq + exact η''.bijOn_v.injOn hv₁H'' hv₂H'' hEq + · rw [hvMap'''_Z₂ v₁ hv₁Z₂, hvMap'''_Z₂ v₂ hv₂Z₂] at hEq + exact η''.bijOn_v.injOn hv₁H'' hv₂H'' hEq + +private theorem combined_drawing_incidence_matches_graph + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + {G : Graph α β} + {H : Drawing S} + {H'' : Drawing S} + {η : SpanEmbedding H G} + {η'' : SpanEmbedding H'' G} + (Z₁ : Set S) + (Z₂ : Set S) + (H''' : Drawing S) + (hH'''_V : ∀ (v : S), v ∈ H'''.V ↔ v ∈ H.V ∧ v ∉ Z₂ ∨ v ∈ H''.V ∧ v ∈ Z₂) + (vMap''' : S → α) + (hvMap'''_notZ₂ : ∀ v ∉ Z₂, vMap''' v = η.vMap v) + (eMap''' : Set S → β) + (heMap'''_notZ₂ : ∀ (e : Set S), ¬e ⊆ Z₂ → eMap''' e = η.eMap e) + (hV_notZ₁ : ∀ v ∉ Z₁, (v ∈ H'''.V ↔ v ∈ H''.V) ∧ (v ∈ H'''.V → vMap''' v = η''.vMap v)) + (hinj_v : InjOn vMap''' H'''.V) + (hE'''_cases : ∀ e ∈ H'''.E, e ∈ H.E ∧ ¬e ⊆ Z₂ ∧ Disjoint (closure e) Z₂ ∨ e ∈ H''.E ∧ + Disjoint (closure e) Z₁ ∧ eMap''' e = η''.eMap e) : + ∀ e ∈ H'''.E, eMap''' e ∈ E(G) ∧ (∀ (x y : α), G.IsLink (eMap''' e) x y → x ∈ vMap''' '' + H'''.V ∧ y ∈ vMap''' '' H'''.V) ∧ ∀ v ∈ H'''.V, G.Inc (eMap''' e) (vMap''' v) ↔ v ∈ closure + e := by + intro e he + rcases hE'''_cases e he with ⟨heH, hnotZ₂, hdisj₂⟩ | ⟨heH'', hdisj₁, he_map''⟩ + · rw [heMap'''_notZ₂ e hnotZ₂] + have he_im : η.eMap e ∈ E(η.imageGraph) := η.bijOn_e.mapsTo heH + have hends_sub : ∀ u ∈ closure e ∩ H.V, u ∈ H'''.V ∧ vMap''' u = η.vMap u := by + rintro u ⟨hu_cl, huH⟩ + have hu_notZ₂ : u ∉ Z₂ := Set.disjoint_left.mp hdisj₂ hu_cl + exact ⟨(hH'''_V u).mpr (Or.inl ⟨huH, hu_notZ₂⟩), hvMap'''_notZ₂ u hu_notZ₂⟩ + refine ⟨η.imageGraph_le.edgeSet_mono he_im, ?_, ?_⟩ + · intro x y hlinkG + have hlink_im : η.imageGraph.IsLink (η.eMap e) x y := + (η.imageGraph_le.isLink_iff he_im).mpr hlinkG + obtain ⟨u, huH, rfl⟩ := η.bijOn_v.surjOn (η.imageGraph.left_mem_of_isLink hlink_im) + obtain ⟨w, hwH, rfl⟩ := η.bijOn_v.surjOn (η.imageGraph.left_mem_of_isLink hlink_im.symm) + have hu_cl : u ∈ closure e := (η.inc_iff e heH u huH).mp ⟨η.vMap w, hlink_im⟩ + have hw_cl : w ∈ closure e := (η.inc_iff e heH w hwH).mp ⟨η.vMap u, hlink_im.symm⟩ + obtain ⟨hu''', humap⟩ := hends_sub u ⟨hu_cl, huH⟩ + obtain ⟨hw''', hwmap⟩ := hends_sub w ⟨hw_cl, hwH⟩ + exact ⟨⟨u, hu''', humap⟩, ⟨w, hw''', hwmap⟩⟩ + · intro v hv''' + constructor + · rintro ⟨w, hlinkG⟩ + have hlink_im : η.imageGraph.IsLink (η.eMap e) (vMap''' v) w := + (η.imageGraph_le.isLink_iff he_im).mpr hlinkG + obtain ⟨u, huH, humap⟩ := η.bijOn_v.surjOn (η.imageGraph.left_mem_of_isLink hlink_im) + have hu_cl : u ∈ closure e := (η.inc_iff e heH u huH).mp ⟨w, humap ▸ hlink_im⟩ + obtain ⟨hu''', humap'''⟩ := hends_sub u ⟨hu_cl, huH⟩ + have huv : u = v := hinj_v hu''' hv''' (humap'''.trans humap) + exact huv ▸ hu_cl + · intro hv_cl + have hv_notZ₂ : v ∉ Z₂ := Set.disjoint_left.mp hdisj₂ hv_cl + have hvH : v ∈ H.V := ((hH'''_V v).mp hv''').resolve_right (fun h => hv_notZ₂ h.2) |>.1 + rw [hvMap'''_notZ₂ v hv_notZ₂] + obtain ⟨w, hlink_im⟩ := (η.inc_iff e heH v hvH).mpr hv_cl + exact ⟨w, (η.imageGraph_le.isLink_iff he_im).mp hlink_im⟩ + · rw [he_map''] + have he_im : η''.eMap e ∈ E(η''.imageGraph) := η''.bijOn_e.mapsTo heH'' + have hends_sub : ∀ u ∈ closure e ∩ H''.V, u ∈ H'''.V ∧ vMap''' u = η''.vMap u := by + rintro u ⟨hu_cl, huH''⟩ + have hu_notZ₁ : u ∉ Z₁ := Set.disjoint_left.mp hdisj₁ hu_cl + have hu''' : u ∈ H'''.V := (hV_notZ₁ u hu_notZ₁).1.mpr huH'' + exact ⟨hu''', (hV_notZ₁ u hu_notZ₁).2 hu'''⟩ + refine ⟨η''.imageGraph_le.edgeSet_mono he_im, ?_, ?_⟩ + · intro x y hlinkG + have hlink_im : η''.imageGraph.IsLink (η''.eMap e) x y := + (η''.imageGraph_le.isLink_iff he_im).mpr hlinkG + obtain ⟨u, huH'', rfl⟩ := η''.bijOn_v.surjOn (η''.imageGraph.left_mem_of_isLink hlink_im) + obtain ⟨w, hwH'', rfl⟩ := η''.bijOn_v.surjOn (η''.imageGraph.left_mem_of_isLink hlink_im.symm) + have hu_cl : u ∈ closure e := (η''.inc_iff e heH'' u huH'').mp ⟨η''.vMap w, hlink_im⟩ + have hw_cl : w ∈ closure e := (η''.inc_iff e heH'' w hwH'').mp ⟨η''.vMap u, hlink_im.symm⟩ + obtain ⟨hu''', humap⟩ := hends_sub u ⟨hu_cl, huH''⟩ + obtain ⟨hw''', hwmap⟩ := hends_sub w ⟨hw_cl, hwH''⟩ + exact ⟨⟨u, hu''', humap⟩, ⟨w, hw''', hwmap⟩⟩ + · intro v hv''' + constructor + · rintro ⟨w, hlinkG⟩ + have hlink_im : η''.imageGraph.IsLink (η''.eMap e) (vMap''' v) w := + (η''.imageGraph_le.isLink_iff he_im).mpr hlinkG + obtain ⟨u, huH'', humap⟩ := η''.bijOn_v.surjOn (η''.imageGraph.left_mem_of_isLink hlink_im) + have hu_cl : u ∈ closure e := (η''.inc_iff e heH'' u huH'').mp ⟨w, humap ▸ hlink_im⟩ + obtain ⟨hu''', humap'''⟩ := hends_sub u ⟨hu_cl, huH''⟩ + have huv : u = v := hinj_v hu''' hv''' (humap'''.trans humap) + exact huv ▸ hu_cl + · intro hv_cl + have hv_notZ₁ : v ∉ Z₁ := Set.disjoint_left.mp hdisj₁ hv_cl + have hvH'' : v ∈ H''.V := (hV_notZ₁ v hv_notZ₁).1.mp hv''' + rw [(hV_notZ₁ v hv_notZ₁).2 hv'''] + obtain ⟨w, hlink_im⟩ := (η''.inc_iff e heH'' v hvH'').mpr hv_cl + exact ⟨w, (η''.imageGraph_le.isLink_iff he_im).mp hlink_im⟩ + +private theorem combined_drawing_edge_map_is_injective + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {G : Graph α β} + {H : Drawing S} + {H' : Drawing S} + {H'' : Drawing S} + {η : SpanEmbedding H G} + {η' : SpanEmbedding H' G} + {η'' : SpanEmbedding H'' G} + {θ_star : ℕ} + {θ : ℕ} + {lam₁ : ℕ} + {lam₂ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {d' : Set S → Set S → ℕ} + {z₁ : Set S} + {z₂ : Set S} + (hlam₁ : 4 ≤ lam₁) + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (Z₁ : Set S) + (hZoneEqZ₁ : Z₁ = atomZone H d z₁ lam₁) + (Z₂ : Set S) + (hZoneEqZ₂ : Z₂ = atomZone H' d' z₂ lam₂) + (hS : IsClosedSurface S) + [hConn : ConnectedSpace S] + (hMetric : HasTangleMetric H θ T d) + (hDisj_cl : Disjoint (closure (atomZone H d z₁ lam₁)) (closure (atomZone H' d' z₂ lam₂))) + (H''' : Drawing S) + (hH'''_V : ∀ (v : S), v ∈ H'''.V ↔ v ∈ H.V ∧ v ∉ Z₂ ∨ v ∈ H''.V ∧ v ∈ Z₂) + (vMap''' : S → α) + (eMap''' : Set S → β) + (heMap'''_notZ₂ : ∀ (e : Set S), ¬e ⊆ Z₂ → eMap''' e = η.eMap e) + (hE_notZ₁ : ∀ (e : Set S), ¬e ⊆ Z₁ → (e ∈ H'''.E ↔ e ∈ H''.E) ∧ (e ∈ H'''.E → eMap''' e = + η''.eMap e)) + (hE'''_cases : ∀ e ∈ H'''.E, e ∈ H.E ∧ ¬e ⊆ Z₂ ∧ Disjoint (closure e) Z₂ ∨ e ∈ H''.E ∧ + Disjoint (closure e) Z₁ ∧ eMap''' e = η''.eMap e) + (hE_inc_G : ∀ e ∈ H'''.E, eMap''' e ∈ E(G) ∧ (∀ (x y : α), G.IsLink (eMap''' e) x y → x ∈ + vMap''' '' H'''.V ∧ y ∈ vMap''' '' H'''.V) ∧ ∀ v ∈ H'''.V, G.Inc (eMap''' e) (vMap''' v) ↔ v + ∈ closure e) : + InjOn eMap''' H'''.E := by + subst Z₂ + let Z₂ := atomZone H' d' z₂ lam₂ + subst Z₁ + let Z₁ := atomZone H d z₁ lam₁ + intro e₁ he₁ e₂ he₂ hEq + rcases hE'''_cases e₁ he₁ with ⟨he₁H, hnot₁, hdisj₂_1⟩ | ⟨he₁H'', hdisj₁_1, hmap₁''⟩ <;> + rcases hE'''_cases e₂ he₂ with ⟨he₂H, hnot₂, hdisj₂_2⟩ | ⟨he₂H'', hdisj₁_2, hmap₂''⟩ + · rw [heMap'''_notZ₂ e₁ hnot₁, heMap'''_notZ₂ e₂ hnot₂] at hEq + exact η.bijOn_e.injOn he₁H he₂H hEq + · have hv_ex : (closure e₁ ∩ H'''.V).Nonempty := by + rcases H'''.edge_cond e₁ he₁ with ⟨x, _, _, hcl, _⟩ | ⟨x, hcl, _⟩ + · rw [hcl]; exact ⟨x, Or.inl rfl⟩ + · rw [hcl]; exact ⟨x, rfl⟩ + obtain ⟨v, hv_cl₁, hv'''⟩ := hv_ex + have hv_cl₂ : v ∈ closure e₂ := by + rw [← (hE_inc_G e₂ he₂).2.2 v hv''', ← hEq] + exact ((hE_inc_G e₁ he₁).2.2 v hv''').mpr hv_cl₁ + have he₁_notZ₁ : ¬ e₁ ⊆ Z₁ := by + intro hsub₁ + obtain ⟨x, hxe₁⟩ := he₁H.1 + have hxZ₁ : x ∈ Z₁ := hsub₁ hxe₁ + rcases hRearr₁.atomZone_dichotomy.2.2.2.2.1 e₁ he₁H with ⟨hd_le₁, _⟩ | ⟨_, hdisj, _, _⟩ + · have hv_H : v ∈ H.V := by + rcases (hH'''_V v).mp hv''' with ⟨hvH, _⟩ | ⟨_, hvZ₂⟩ + · exact hvH + · exact (Set.disjoint_left.mp hDisj_cl (closure_mono hsub₁ hv_cl₁) + (subset_closure hvZ₂)).elim + have hvZ₁ : v ∈ Z₁ := by + have hv_le := dist_vertex_le_of_dist_edge_le hS hConn hMetric hRearr₁.z_mem he₁H hv_H + hv_cl₁ + (by omega) hd_le₁ + exact (mem_atomZone_iff_of_mem_atom (Or.inl (Or.inl ⟨v, hv_H, rfl⟩)) rfl).mpr hv_le + exact Set.disjoint_left.mp hdisj₁_2 hv_cl₂ hvZ₁ + · exact Set.disjoint_left.mp hdisj hxe₁ hxZ₁ + have he₁H'' : e₁ ∈ H''.E := (hE_notZ₁ e₁ he₁_notZ₁).1.mp he₁ + rw [(hE_notZ₁ e₁ he₁_notZ₁).2 he₁, hmap₂''] at hEq + exact η''.bijOn_e.injOn he₁H'' he₂H'' hEq + · have hv_ex : (closure e₂ ∩ H'''.V).Nonempty := by + rcases H'''.edge_cond e₂ he₂ with ⟨x, _, _, hcl, _⟩ | ⟨x, hcl, _⟩ + · rw [hcl]; exact ⟨x, Or.inl rfl⟩ + · rw [hcl]; exact ⟨x, rfl⟩ + obtain ⟨v, hv_cl₂, hv'''⟩ := hv_ex + have hv_cl₁ : v ∈ closure e₁ := by + rw [← (hE_inc_G e₁ he₁).2.2 v hv''', hEq] + exact ((hE_inc_G e₂ he₂).2.2 v hv''').mpr hv_cl₂ + have he₂_notZ₁ : ¬ e₂ ⊆ Z₁ := by + intro hsub₂ + obtain ⟨x, hxe₂⟩ := he₂H.1 + have hxZ₁ : x ∈ Z₁ := hsub₂ hxe₂ + rcases hRearr₁.atomZone_dichotomy.2.2.2.2.1 e₂ he₂H with ⟨hd_le₂, _⟩ | ⟨_, hdisj, _, _⟩ + · have hv_H : v ∈ H.V := by + rcases (hH'''_V v).mp hv''' with ⟨hvH, _⟩ | ⟨_, hvZ₂⟩ + · exact hvH + · exact (Set.disjoint_left.mp hDisj_cl (closure_mono hsub₂ hv_cl₂) + (subset_closure hvZ₂)).elim + have hvZ₁ : v ∈ Z₁ := by + have hv_le := dist_vertex_le_of_dist_edge_le hS hConn hMetric hRearr₁.z_mem he₂H hv_H + hv_cl₂ + (by omega) hd_le₂ + exact (mem_atomZone_iff_of_mem_atom (Or.inl (Or.inl ⟨v, hv_H, rfl⟩)) rfl).mpr hv_le + exact Set.disjoint_left.mp hdisj₁_1 hv_cl₁ hvZ₁ + · exact Set.disjoint_left.mp hdisj hxe₂ hxZ₁ + have he₂H'' : e₂ ∈ H''.E := (hE_notZ₁ e₂ he₂_notZ₁).1.mp he₂ + rw [hmap₁'', (hE_notZ₁ e₂ he₂_notZ₁).2 he₂] at hEq + exact η''.bijOn_e.injOn he₁H'' he₂H'' hEq + · rw [hmap₁'', hmap₂''] at hEq + exact η''.bijOn_e.injOn he₁H'' he₂H'' hEq + +private theorem first_drawing_atoms_off_second_zone_survive + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {G : Graph α β} + {H : Drawing S} + {H' : Drawing S} + {H'' : Drawing S} + {η : SpanEmbedding H G} + {η' : SpanEmbedding H' G} + {η'' : SpanEmbedding H'' G} + {θ_star : ℕ} + {θ : ℕ} + {lam₁ : ℕ} + {lam₂ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {d' : Set S → Set S → ℕ} + {d'' : Set S → Set S → ℕ} + {z₁ : Set S} + {z₂ : Set S} + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' + d' d'' z₂) + (Z₂ : Set S) + (hZoneEqZ₂ : Z₂ = atomZone H' d' z₂ lam₂) + (hDisj_cl : Disjoint (closure (atomZone H d z₁ lam₁)) (closure (atomZone H' d' z₂ lam₂))) + (H''' : Drawing S) + (hH'''_V : ∀ (v : S), v ∈ H'''.V ↔ v ∈ H.V ∧ v ∉ Z₂ ∨ v ∈ H''.V ∧ v ∈ Z₂) + (hH'''_E : ∀ (e : Set S), e ∈ H'''.E ↔ e ∈ H.E ∧ ¬e ⊆ Z₂ ∨ e ∈ H''.E ∧ e ⊆ Z₂) + (this : LocallyConnectedSpace S) + (hU'''_iff_notZ₂ : ∀ x ∉ Z₂, x ∈ H'''.U ↔ x ∈ H.U) + (hU'''_iff_Z₂ : ∀ x ∈ Z₂, x ∈ H'''.U ↔ x ∈ H''.U) : + ∀ a ∈ H.A, Disjoint a Z₂ → a ∈ H'''.A := by + subst Z₂ + let Z₂ := atomZone H' d' z₂ lam₂ + intro a ha hdisj + rcases ha with (⟨v, hvH, rfl⟩ | heH) | hrH + · have hvnot : v ∉ Z₂ := Set.disjoint_left.mp hdisj rfl + exact Or.inl (Or.inl ⟨v, (hH'''_V v).mpr (Or.inl ⟨hvH, hvnot⟩), rfl⟩) + · obtain ⟨x, hxe⟩ := heH.1 + have henot : ¬ a ⊆ Z₂ := fun hsub => Set.disjoint_left.mp hdisj hxe (hsub hxe) + exact Or.inl (Or.inr ((hH'''_E a).mpr (Or.inl ⟨heH, henot⟩))) + · refine Or.inr (region_mem_of_disjoint_U hrH ?_ ?_) + · refine Set.disjoint_left.mpr fun x hxr hxU''' => ?_ + have hx_notZ₂ : x ∉ Z₂ := Set.disjoint_left.mp hdisj hxr + exact region_subset hrH hxr ((hU'''_iff_notZ₂ x hx_notZ₂).mp hxU''') + · intro x hx_diff + have hx_U : x ∈ H.U := closure_atom_diff_subset_U H (Or.inr hrH) hx_diff + by_cases hxZ₂ : x ∈ Z₂ + · rcases hRearr₁.atomZone_dichotomy.1 a (Or.inr hrH) with ⟨_, hsub₁⟩ | ⟨_, _, haH'⟩ + · exact (Set.disjoint_left.mp hDisj_cl (closure_mono hsub₁ hx_diff.1) + (subset_closure hxZ₂)).elim + · rcases hRearr₂.atomZone_dichotomy.1 a haH' with ⟨_, hsub₂⟩ | ⟨_, _, haH''⟩ + · obtain ⟨y, hyr⟩ := region_nonempty hrH + exact (Set.disjoint_left.mp hdisj hyr (hsub₂ hyr)).elim + · exact (hU'''_iff_Z₂ x hxZ₂).mpr (closure_atom_diff_subset_U H'' haH'' hx_diff) + · exact (hU'''_iff_notZ₂ x hxZ₂).mpr hx_U + +private theorem second_drawing_atoms_off_first_zone_survive + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {G : Graph α β} + {H : Drawing S} + {H' : Drawing S} + {H'' : Drawing S} + {η : SpanEmbedding H G} + {η' : SpanEmbedding H' G} + {η'' : SpanEmbedding H'' G} + {θ_star : ℕ} + {θ : ℕ} + {lam₁ : ℕ} + {lam₂ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {d' : Set S → Set S → ℕ} + {d'' : Set S → Set S → ℕ} + {z₁ : Set S} + {z₂ : Set S} + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' + d' d'' z₂) + (Z₁ : Set S) + (hZoneEqZ₁ : Z₁ = atomZone H d z₁ lam₁) + (Z₂ : Set S) + (hZoneEqZ₂ : Z₂ = atomZone H' d' z₂ lam₂) + (hDisj_cl : Disjoint (closure (atomZone H d z₁ lam₁)) (closure (atomZone H' d' z₂ lam₂))) + (hDisj_Z : Disjoint Z₁ Z₂) + (H''' : Drawing S) + (vMap''' : S → α) + (eMap''' : Set S → β) + (hV_notZ₁ : ∀ v ∉ Z₁, (v ∈ H'''.V ↔ v ∈ H''.V) ∧ (v ∈ H'''.V → vMap''' v = η''.vMap v)) + (hE_notZ₁ : ∀ (e : Set S), ¬e ⊆ Z₁ → (e ∈ H'''.E ↔ e ∈ H''.E) ∧ (e ∈ H'''.E → eMap''' e = + η''.eMap e)) + (this : LocallyConnectedSpace S) + (hU'''_iff_notZ₂ : ∀ x ∉ Z₂, x ∈ H'''.U ↔ x ∈ H.U) + (hU'''_iff_notZ₁ : ∀ x ∉ Z₁, x ∈ H'''.U ↔ x ∈ H''.U) : + ∀ a ∈ H''.A, Disjoint a Z₁ → a ∈ H'''.A := by + subst Z₂ + let Z₂ := atomZone H' d' z₂ lam₂ + subst Z₁ + let Z₁ := atomZone H d z₁ lam₁ + intro a ha hdisj + rcases ha with (⟨v, hvH'', rfl⟩ | heH'') | hrH'' + · have hvnot : v ∉ Z₁ := Set.disjoint_left.mp hdisj rfl + exact Or.inl (Or.inl ⟨v, (hV_notZ₁ v hvnot).1.mpr hvH'', rfl⟩) + · obtain ⟨x, hxe⟩ := heH''.1 + have henot : ¬ a ⊆ Z₁ := fun hsub => Set.disjoint_left.mp hdisj hxe (hsub hxe) + exact Or.inl (Or.inr ((hE_notZ₁ a henot).1.mpr heH'')) + · refine Or.inr (region_mem_of_disjoint_U hrH'' ?_ ?_) + · refine Set.disjoint_left.mpr fun x hxr hxU''' => ?_ + have hx_notZ₁ : x ∉ Z₁ := Set.disjoint_left.mp hdisj hxr + exact region_subset hrH'' hxr ((hU'''_iff_notZ₁ x hx_notZ₁).mp hxU''') + · intro x hx_diff + have hx_U'' : x ∈ H''.U := closure_atom_diff_subset_U H'' (Or.inr hrH'') hx_diff + by_cases hxZ₁ : x ∈ Z₁ + · rcases hRearr₂.atomZone_dichotomy.2.1 a (Or.inr hrH'') with hsub₂ | ⟨_, haH', _⟩ + · exact (Set.disjoint_left.mp hDisj_cl (subset_closure hxZ₁) (closure_mono hsub₂ + hx_diff.1)).elim + · rcases hRearr₁.atomZone_dichotomy.2.1 a haH' with hsub₁ | ⟨_, haH, _⟩ + · obtain ⟨y, hyr⟩ := region_nonempty hrH'' + exact (Set.disjoint_left.mp hdisj hyr (hsub₁ hyr)).elim + · have hx_notZ₂ : x ∉ Z₂ := Set.disjoint_left.mp hDisj_Z hxZ₁ + exact (hU'''_iff_notZ₂ x hx_notZ₂).mpr (closure_atom_diff_subset_U H haH hx_diff) + · exact (hU'''_iff_notZ₁ x hxZ₁).mpr hx_U'' + +private theorem retained_edges_preserve_outer_endpoints + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {G : Graph α β} + {H : Drawing S} + {H' : Drawing S} + {H'' : Drawing S} + {η : SpanEmbedding H G} + {η' : SpanEmbedding H' G} + {η'' : SpanEmbedding H'' G} + {θ_star : ℕ} + {θ : ℕ} + {lam₁ : ℕ} + {lam₂ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {d' : Set S → Set S → ℕ} + {d'' : Set S → Set S → ℕ} + {z₁ : Set S} + {z₂ : Set S} + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' + d' d'' z₂) + (Z₁ : Set S) (hZoneEqZ₁ : Z₁ = atomZone H d z₁ lam₁) + (Z₂ : Set S) (hZoneEqZ₂ : Z₂ = atomZone H' d' z₂ lam₂) + (hH_edge_cl_disj_Z₁ : ∀ e ∈ H.E, ¬Disjoint (closure e) Z₂ → Disjoint (closure e) Z₁) + (V''' : Set S) (hV : V''' = {v ∈ H.V | v ∉ Z₂} ∪ {v ∈ H''.V | v ∈ Z₂}) : + ∀ e ∈ H.E, ¬e ⊆ Z₂ → closure e ∩ H.V ⊆ H.V ∩ V''' := by + subst V''' + subst Z₁ Z₂ + let Z₁ := atomZone H d z₁ lam₁ + let Z₂ := atomZone H' d' z₂ lam₂ + rintro e heH hnot v ⟨hv_cl, hvH⟩ + refine ⟨hvH, ?_⟩ + by_cases hvZ₂ : v ∈ Z₂ + · right + have hdisj₁ : Disjoint (closure e) Z₁ := + hH_edge_cl_disj_Z₁ e heH (Set.not_disjoint_iff.mpr ⟨v, hv_cl, hvZ₂⟩) + have he_notZ₁ : ¬ e ⊆ Z₁ := by + obtain ⟨x, hxe⟩ := heH.1 + exact fun hsub => Set.disjoint_left.mp hdisj₁ (subset_closure hxe) (hsub hxe) + rcases hRearr₁.atomZone_dichotomy.2.2.2.2.1 e heH with ⟨_, hZ₁⟩ | ⟨_, _, heH', _⟩ + · exact (he_notZ₁ hZ₁).elim + · rcases hRearr₂.atomZone_dichotomy.2.2.2.2.1 e heH' with ⟨_, hZ₂⟩ | ⟨_, _, heH'', _⟩ + · exact (hnot hZ₂).elim + · have hvH'' : v ∈ (closure e ∩ H''.V) := by + rw [closure_inter_V_eq_diff H'' heH'', ← closure_inter_V_eq_diff H heH] + exact ⟨hv_cl, hvH⟩ + exact ⟨hvH''.2, hvZ₂⟩ + · exact Or.inl ⟨hvH, hvZ₂⟩ + +private theorem inserted_edges_preserve_inner_endpoints + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {G : Graph α β} + {H : Drawing S} + {H' : Drawing S} + {H'' : Drawing S} + {η : SpanEmbedding H G} + {η' : SpanEmbedding H' G} + {η'' : SpanEmbedding H'' G} + {θ_star : ℕ} + {θ : ℕ} + {lam₁ : ℕ} + {lam₂ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {d' : Set S → Set S → ℕ} + {d'' : Set S → Set S → ℕ} + {z₁ : Set S} + {z₂ : Set S} + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' + d' d'' z₂) + (Z₂ : Set S) (hZoneEqZ₂ : Z₂ = atomZone H' d' z₂ lam₂) + (hDisj_cl : Disjoint (closure (atomZone H d z₁ lam₁)) (closure (atomZone H' d' z₂ lam₂))) + (V''' : Set S) (hV : V''' = {v ∈ H.V | v ∉ Z₂} ∪ {v ∈ H''.V | v ∈ Z₂}) : + ∀ e ∈ H''.E, e ⊆ Z₂ → closure e ∩ H''.V ⊆ H''.V ∩ V''' := by + subst V''' + subst Z₂ + let Z₁ := atomZone H d z₁ lam₁ + let Z₂ := atomZone H' d' z₂ lam₂ + rintro e heH'' hsub v ⟨hv_cl, hvH''⟩ + refine ⟨hvH'', ?_⟩ + by_cases hvZ₂ : v ∈ Z₂ + · exact Or.inr ⟨hvH'', hvZ₂⟩ + · left + rcases hRearr₂.atomZone_dichotomy.2.2.2.1 v hvH'' with hZ₂ | ⟨_, hvH', _⟩ + · exact (hvZ₂ hZ₂).elim + · have hv_clZ₂ : v ∈ closure Z₂ := closure_mono hsub hv_cl + have hv_notZ₁ : v ∉ Z₁ := + Set.disjoint_right.mp (hDisj_cl.mono subset_closure Subset.rfl) hv_clZ₂ + rcases hRearr₁.atomZone_dichotomy.2.2.2.1 v hvH' with hZ₁ | ⟨_, hvH, _⟩ + · exact (hv_notZ₁ hZ₁).elim + · exact ⟨hvH, hvZ₂⟩ + +private theorem retained_edges_meet_new_vertices_at_old_ends + {S : Type w} + [TopologicalSpace S] + {H : Drawing S} + {H'' : Drawing S} + (Z₂ : Set S) + (hH_edge_disj_Z₂ : ∀ e ∈ H.E, ¬e ⊆ Z₂ → Disjoint e Z₂) + (V''' : Set S) (hV : V''' = {v ∈ H.V | v ∉ Z₂} ∪ {v ∈ H''.V | v ∈ Z₂}) + (A₁ : Drawing S) + (M₂ : Drawing S) + (hA₁_V : A₁.V = H.V ∩ V''') + (hA₁_E : A₁.E = {e | e ∈ H.E ∧ ¬e ⊆ Z₂}) + (hM₂_V : M₂.V = H''.V ∩ V''') : + ∀ e₁ ∈ A₁.E, closure e₁ ∩ M₂.V ⊆ A₁.V := by + subst V''' + rw [hA₁_E, hM₂_V, hA₁_V] + rintro e₁ ⟨he₁, hnot₁⟩ x ⟨hx_cl, hxH'', hxV⟩ + have hx_not_e₁ : x ∉ e₁ := by + intro hxe₁ + have hx_notZ₂ : x ∉ Z₂ := Set.disjoint_left.mp (hH_edge_disj_Z₂ e₁ he₁ hnot₁) hxe₁ + have hxH : x ∈ H.V := (hxV.resolve_right fun h => hx_notZ₂ h.2).1 + exact (he₁.2.1 hxe₁).2 hxH + have hx_diff : x ∈ closure e₁ ∩ H.V := by + rw [closure_inter_V_eq_diff H he₁] + exact ⟨hx_cl, hx_not_e₁⟩ + exact ⟨hx_diff.2, hxV⟩ + +private theorem inserted_edges_meet_old_vertices_at_new_ends + {S : Type w} + [TopologicalSpace S] + {H : Drawing S} + {H'' : Drawing S} + (Z₂ : Set S) + (V''' : Set S) (hV : V''' = {v ∈ H.V | v ∉ Z₂} ∪ {v ∈ H''.V | v ∈ Z₂}) + (A₁ : Drawing S) + (M₂ : Drawing S) + (hA₁_V : A₁.V = H.V ∩ V''') + (hM₂_V : M₂.V = H''.V ∩ V''') + (hM₂_E : M₂.E = {e | e ∈ H''.E ∧ e ⊆ Z₂}) : + ∀ e₂ ∈ M₂.E, closure e₂ ∩ A₁.V ⊆ M₂.V := by + subst V''' + rw [hM₂_E, hA₁_V, hM₂_V] + rintro e₂ ⟨he₂, hsub₂⟩ x ⟨hx_cl, hxH, hxV⟩ + have hx_not_e₂ : x ∉ e₂ := by + intro hxe₂ + have hxZ₂ : x ∈ Z₂ := hsub₂ hxe₂ + have hxH'' : x ∈ H''.V := (hxV.resolve_left fun h => h.2 hxZ₂).1 + exact (he₂.2.1 hxe₂).2 hxH'' + have hx_diff : x ∈ closure e₂ ∩ H''.V := by + rw [closure_inter_V_eq_diff H'' he₂] + exact ⟨hx_cl, hx_not_e₂⟩ + exact ⟨hx_diff.2, hxV⟩ + +private theorem retained_and_inserted_edge_intersections + {S : Type w} + [TopologicalSpace S] + {H : Drawing S} + {H'' : Drawing S} + (Z₂ : Set S) + (hH_edge_disj_Z₂ : ∀ e ∈ H.E, ¬e ⊆ Z₂ → Disjoint e Z₂) + (V''' : Set S) + (A₁ : Drawing S) + (M₂ : Drawing S) + (hA₁_ends : ∀ e ∈ H.E, ¬e ⊆ Z₂ → closure e ∩ H.V ⊆ H.V ∩ V''') + (hM₂_ends : ∀ e ∈ H''.E, e ⊆ Z₂ → closure e ∩ H''.V ⊆ H''.V ∩ V''') + (hA₁_V : A₁.V = H.V ∩ V''') + (hA₁_E : A₁.E = {e | e ∈ H.E ∧ ¬e ⊆ Z₂}) + (hM₂_V : M₂.V = H''.V ∩ V''') + (hM₂_E : M₂.E = {e | e ∈ H''.E ∧ e ⊆ Z₂}) + (h1_union : ∀ e₁ ∈ A₁.E, closure e₁ ∩ M₂.V ⊆ A₁.V) + (h2_union : ∀ e₂ ∈ M₂.E, closure e₂ ∩ A₁.V ⊆ M₂.V) : + ∀ e₁ ∈ A₁.E, ∀ e₂ ∈ M₂.E, closure e₁ ∩ closure e₂ ⊆ A₁.V ∩ M₂.V := by + intro e₁ he₁ e₂ he₂ x ⟨hx_cl₁, hx_cl₂⟩ + have ⟨he₁H, hnot₁⟩ : e₁ ∈ H.E ∧ ¬ e₁ ⊆ Z₂ := by rwa [hA₁_E] at he₁ + have ⟨he₂H'', hsub₂⟩ : e₂ ∈ H''.E ∧ e₂ ⊆ Z₂ := by rwa [hM₂_E] at he₂ + have hx_not_e₂ : x ∉ e₂ := by + intro hxe₂ + have hxZ₂ : x ∈ Z₂ := hsub₂ hxe₂ + have hx_not_e₁ : x ∉ e₁ := + fun hxe₁ => Set.disjoint_left.mp (hH_edge_disj_Z₂ e₁ he₁H hnot₁) hxe₁ hxZ₂ + have hx_H : x ∈ closure e₁ ∩ H.V := by + rw [closure_inter_V_eq_diff H he₁H] + exact ⟨hx_cl₁, hx_not_e₁⟩ + have hxA₁ : x ∈ A₁.V := hA₁_V ▸ hA₁_ends e₁ he₁H hnot₁ hx_H + have hxM₂ : x ∈ M₂.V := h2_union e₂ he₂ ⟨hx_cl₂, hxA₁⟩ + exact (he₂H''.2.1 hxe₂).2 (hM₂_V ▸ hxM₂).1 + have hx_H'' : x ∈ closure e₂ ∩ H''.V := by + rw [closure_inter_V_eq_diff H'' he₂H''] + exact ⟨hx_cl₂, hx_not_e₂⟩ + have hxM₂ : x ∈ M₂.V := hM₂_V ▸ hM₂_ends e₂ he₂H'' hsub₂ hx_H'' + exact ⟨h1_union e₁ he₁ ⟨hx_cl₁, hxM₂⟩, hxM₂⟩ + +private theorem outside_inner_zone_union_agrees_with_original + {S : Type w} + [TopologicalSpace S] + {H : Drawing S} + {H'' : Drawing S} + (Z₂ : Set S) + (H''' : Drawing S) + (hH'''_V : ∀ (v : S), v ∈ H'''.V ↔ v ∈ H.V ∧ v ∉ Z₂ ∨ v ∈ H''.V ∧ v ∈ Z₂) + (hH'''_E : ∀ (e : Set S), e ∈ H'''.E ↔ e ∈ H.E ∧ ¬e ⊆ Z₂ ∨ e ∈ H''.E ∧ e ⊆ Z₂) : + ∀ x ∉ Z₂, x ∈ H'''.U ↔ x ∈ H.U := by + intro x hx_notZ₂ + rw [mem_U_iff_mem_V_or_mem_E H''' x, mem_U_iff_mem_V_or_mem_E H x] + constructor + · rintro (hxV''' | ⟨e, he''', hxe⟩) + · exact Or.inl (((hH'''_V x).mp hxV''').resolve_right (fun h => hx_notZ₂ h.2) |>.1) + · exact Or.inr ⟨e, ((hH'''_E e).mp he''').resolve_right (fun h => hx_notZ₂ (h.2 hxe)) |>.1, + hxe⟩ + · rintro (hxVH | ⟨e, heH, hxe⟩) + · exact Or.inl ((hH'''_V x).mpr (Or.inl ⟨hxVH, hx_notZ₂⟩)) + · have henot : ¬ e ⊆ Z₂ := fun hsub => hx_notZ₂ (hsub hxe) + exact Or.inr ⟨e, (hH'''_E e).mpr (Or.inl ⟨heH, henot⟩), hxe⟩ + +private theorem inside_inner_zone_union_agrees_with_replacement + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {G : Graph α β} + {H : Drawing S} + {H' : Drawing S} + {H'' : Drawing S} + {η' : SpanEmbedding H' G} + {η'' : SpanEmbedding H'' G} + {θ_star : ℕ} + {θ : ℕ} + {lam₁ : ℕ} + {lam₂ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d' : Set S → Set S → ℕ} + {d'' : Set S → Set S → ℕ} + {z₂ : Set S} + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' + d' d'' z₂) + (Z₂ : Set S) (hZoneEqZ₂ : Z₂ = atomZone H' d' z₂ lam₂) + (hH_edge_disj_Z₂ : ∀ e ∈ H.E, ¬e ⊆ Z₂ → Disjoint e Z₂) + (H''' : Drawing S) + (hH'''_V : ∀ (v : S), v ∈ H'''.V ↔ v ∈ H.V ∧ v ∉ Z₂ ∨ v ∈ H''.V ∧ v ∈ Z₂) + (hH'''_E : ∀ (e : Set S), e ∈ H'''.E ↔ e ∈ H.E ∧ ¬e ⊆ Z₂ ∨ e ∈ H''.E ∧ e ⊆ Z₂) : + ∀ x ∈ Z₂, x ∈ H'''.U ↔ x ∈ H''.U := by + subst Z₂ + intro x hxZ₂ + rw [mem_U_iff_mem_V_or_mem_E H''' x, mem_U_iff_mem_V_or_mem_E H'' x] + constructor + · rintro (hxV''' | ⟨e, he''', hxe⟩) + · exact Or.inl (((hH'''_V x).mp hxV''').resolve_left (fun h => h.2 hxZ₂) |>.1) + · rcases (hH'''_E e).mp he''' with ⟨heH, hnotZ₂⟩ | ⟨heH'', _⟩ + · exact (Set.disjoint_left.mp (hH_edge_disj_Z₂ e heH hnotZ₂) hxe hxZ₂).elim + · exact Or.inr ⟨e, heH'', hxe⟩ + · rintro (hxVH'' | ⟨e, heH'', hxe⟩) + · exact Or.inl ((hH'''_V x).mpr (Or.inr ⟨hxVH'', hxZ₂⟩)) + · rcases hRearr₂.atomZone_dichotomy.2.2.2.2.2 e heH'' with hsub₂ | ⟨hdisj₂, _⟩ + · exact Or.inr ⟨e, (hH'''_E e).mpr (Or.inr ⟨heH'', hsub₂⟩), hxe⟩ + · exact (Set.disjoint_left.mp hdisj₂ hxe hxZ₂).elim + +private theorem outside_outer_zone_union_agrees_with_replacement + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + {G : Graph α β} + {H : Drawing S} + {H'' : Drawing S} + {η'' : SpanEmbedding H'' G} + (Z₁ : Set S) + (Z₂ : Set S) + (H''' : Drawing S) + (hH'''_V : ∀ (v : S), v ∈ H'''.V ↔ v ∈ H.V ∧ v ∉ Z₂ ∨ v ∈ H''.V ∧ v ∈ Z₂) + (hH'''_E : ∀ (e : Set S), e ∈ H'''.E ↔ e ∈ H.E ∧ ¬e ⊆ Z₂ ∨ e ∈ H''.E ∧ e ⊆ Z₂) + (vMap''' : S → α) + (eMap''' : Set S → β) + (hV_notZ₁ : ∀ v ∉ Z₁, (v ∈ H'''.V ↔ v ∈ H''.V) ∧ (v ∈ H'''.V → vMap''' v = η''.vMap v)) + (hE_notZ₁ : ∀ (e : Set S), ¬e ⊆ Z₁ → (e ∈ H'''.E ↔ e ∈ H''.E) ∧ (e ∈ H'''.E → eMap''' e = + η''.eMap e)) + (hU'''_iff_notZ₂ : ∀ x ∉ Z₂, x ∈ H'''.U ↔ x ∈ H.U) + (hU'''_iff_Z₂ : ∀ x ∈ Z₂, x ∈ H'''.U ↔ x ∈ H''.U) : + ∀ x ∉ Z₁, x ∈ H'''.U ↔ x ∈ H''.U := by + intro x hx_notZ₁ + by_cases hxZ₂ : x ∈ Z₂ + · exact hU'''_iff_Z₂ x hxZ₂ + · rw [hU'''_iff_notZ₂ x hxZ₂, mem_U_iff_mem_V_or_mem_E H x, mem_U_iff_mem_V_or_mem_E H'' x] + constructor + · rintro (hxVH | ⟨e, heH, hxe⟩) + · have hxVH'' : x ∈ H''.V := (hV_notZ₁ x hx_notZ₁).1.mp ((hH'''_V x).mpr + (Or.inl ⟨hxVH, hxZ₂⟩)) + exact Or.inl hxVH'' + · have henot₁ : ¬ e ⊆ Z₁ := fun hsub => hx_notZ₁ (hsub hxe) + have henot₂ : ¬ e ⊆ Z₂ := fun hsub => hxZ₂ (hsub hxe) + have heH'' : e ∈ H''.E := (hE_notZ₁ e henot₁).1.mp ((hH'''_E e).mpr (Or.inl ⟨heH, henot₂⟩)) + exact Or.inr ⟨e, heH'', hxe⟩ + · rintro (hxVH'' | ⟨e, heH'', hxe⟩) + · have hxV''' : x ∈ H'''.V := (hV_notZ₁ x hx_notZ₁).1.mpr hxVH'' + exact Or.inl (((hH'''_V x).mp hxV''').resolve_right (fun h => hxZ₂ h.2) |>.1) + · have henot₁ : ¬ e ⊆ Z₁ := fun hsub => hx_notZ₁ (hsub hxe) + have he''' : e ∈ H'''.E := (hE_notZ₁ e henot₁).1.mpr heH'' + exact Or.inr ⟨e, ((hH'''_E e).mp he''').resolve_right (fun h => hxZ₂ (h.2 hxe)) |>.1, hxe⟩ + +private theorem combined_drawing_edge_cases + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + {G : Graph α β} + {H : Drawing S} + {H'' : Drawing S} + {η'' : SpanEmbedding H'' G} + (Z₁ : Set S) + (Z₂ : Set S) + (hDisj_cl : Disjoint (closure Z₁) (closure Z₂)) + (hH_edge_cl_disj_Z₁ : ∀ e ∈ H.E, ¬Disjoint (closure e) Z₂ → Disjoint (closure e) Z₁) + (H''' : Drawing S) + (hH'''_E : ∀ (e : Set S), e ∈ H'''.E ↔ e ∈ H.E ∧ ¬e ⊆ Z₂ ∨ e ∈ H''.E ∧ e ⊆ Z₂) + (eMap''' : Set S → β) + (heMap'''_Z₂ : ∀ e ⊆ Z₂, eMap''' e = η''.eMap e) + (hE_notZ₁ : ∀ (e : Set S), ¬e ⊆ Z₁ → (e ∈ H'''.E ↔ e ∈ H''.E) ∧ (e ∈ H'''.E → eMap''' e = + η''.eMap e)) : + ∀ e ∈ H'''.E, e ∈ H.E ∧ ¬e ⊆ Z₂ ∧ Disjoint (closure e) Z₂ ∨ e ∈ H''.E ∧ Disjoint (closure e) + Z₁ ∧ eMap''' e = η''.eMap e := by + intro e he + rcases (hH'''_E e).mp he with ⟨heH, hnotZ₂⟩ | ⟨heH'', heZ₂⟩ + · by_cases hdisj : Disjoint (closure e) Z₂ + · exact Or.inl ⟨heH, hnotZ₂, hdisj⟩ + · right + have hdisj₁ : Disjoint (closure e) Z₁ := hH_edge_cl_disj_Z₁ e heH hdisj + have he_notZ₁ : ¬ e ⊆ Z₁ := by + obtain ⟨x, hxe⟩ := heH.1 + exact fun hsub => Set.disjoint_left.mp hdisj₁ (subset_closure hxe) (hsub hxe) + exact ⟨(hE_notZ₁ e he_notZ₁).1.mp he, hdisj₁, (hE_notZ₁ e he_notZ₁).2 he⟩ + · right + exact ⟨heH'', hDisj_cl.symm.mono (closure_mono heZ₂) subset_closure, heMap'''_Z₂ e heZ₂⟩ + +private theorem combined_image_graph_edges + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + {G : Graph α β} + (H''' : Drawing S) + (vMap''' : S → α) + (eMap''' : Set S → β) + (hE_inc_G : ∀ e ∈ H'''.E, eMap''' e ∈ E(G) ∧ (∀ (x y : α), G.IsLink (eMap''' e) x y → x ∈ + vMap''' '' H'''.V ∧ y ∈ vMap''' '' H'''.V) ∧ ∀ v ∈ H'''.V, G.Inc (eMap''' e) (vMap''' v) ↔ v + ∈ closure e) : + E((G.induce (vMap''' '' H'''.V)).restrict (eMap''' '' H'''.E)) = eMap''' '' H'''.E := by + apply Subset.antisymm + · intro b hb + rw [edge_mem_iff_exists_isLink] at hb + obtain ⟨x, y, hb, _⟩ := hb + exact hb + · rintro b ⟨e, he''', rfl⟩ + obtain ⟨heG, hends, _⟩ := hE_inc_G e he''' + obtain ⟨x, y, hlinkG⟩ := (G.edge_mem_iff_exists_isLink _).mp heG + obtain ⟨hx_im, hy_im⟩ := hends x y hlinkG + rw [edge_mem_iff_exists_isLink] + exact ⟨x, y, ⟨e, he''', rfl⟩, hlinkG, hx_im, hy_im⟩ + +private theorem glue_drawings_along_zone + {S : Type w} [TopologicalSpace S] [T2Space S] (H H'' : Drawing S) (Z₂ : Set S) + (hH_edge_disj_Z₂ : ∀ e ∈ H.E, ¬ e ⊆ Z₂ → Disjoint e Z₂) + (V''' : Set S) (hV : V''' = {v ∈ H.V | v ∉ Z₂} ∪ {v ∈ H''.V | v ∈ Z₂}) + (hA₁_ends : ∀ e ∈ H.E, ¬ e ⊆ Z₂ → closure e ∩ H.V ⊆ H.V ∩ V''') + (hM₂_ends : ∀ e ∈ H''.E, e ⊆ Z₂ → closure e ∩ H''.V ⊆ H''.V ∩ V''') : + ∃ H''' : Drawing S, + (∀ v, v ∈ H'''.V ↔ (v ∈ H.V ∧ v ∉ Z₂) ∨ (v ∈ H''.V ∧ v ∈ Z₂)) ∧ + (∀ e, e ∈ H'''.E ↔ (e ∈ H.E ∧ ¬ e ⊆ Z₂) ∨ (e ∈ H''.E ∧ e ⊆ Z₂)) := by + subst V''' + let V''' : Set S := {v ∈ H.V | v ∉ Z₂} ∪ {v ∈ H''.V | v ∈ Z₂} + let A₁ := H.span (H.V ∩ V''') {e ∈ H.E | ¬ e ⊆ Z₂} + let M₂ := H''.span (H''.V ∩ V''') {e ∈ H''.E | e ⊆ Z₂} + have hA₁_V : A₁.V = H.V ∩ V''' := by + rw [Drawing.span_V, Drawing.spanV] + ext v + simp only [mem_union, mem_inter_iff, mem_ofPred_eq, mem_iUnion, exists_prop] + refine ⟨?_, fun ⟨hvH, hvV⟩ => Or.inl ⟨⟨hvH, hvV⟩, hvH⟩⟩ + rintro (⟨⟨hvH, hvV⟩, _⟩ | ⟨e, ⟨⟨heH, hnot⟩, _⟩, hv_cl, hvH⟩) + · exact ⟨hvH, hvV⟩ + · exact hA₁_ends e heH hnot ⟨hv_cl, hvH⟩ + have hA₁_E : A₁.E = {e ∈ H.E | ¬ e ⊆ Z₂} := by + rw [Drawing.span_E] + ext e + simp only [mem_inter_iff, mem_ofPred_eq, and_iff_left_iff_imp] + exact And.left + have hM₂_V : M₂.V = H''.V ∩ V''' := by + rw [Drawing.span_V, Drawing.spanV] + ext v + simp only [mem_union, mem_inter_iff, mem_ofPred_eq, mem_iUnion, exists_prop] + refine ⟨?_, fun ⟨hvH'', hvV⟩ => Or.inl ⟨⟨hvH'', hvV⟩, hvH''⟩⟩ + rintro (⟨⟨hvH'', hvV⟩, _⟩ | ⟨e, ⟨⟨heH'', hsub⟩, _⟩, hv_cl, hvH''⟩) + · exact ⟨hvH'', hvV⟩ + · exact hM₂_ends e heH'' hsub ⟨hv_cl, hvH''⟩ + have hM₂_E : M₂.E = {e ∈ H''.E | e ⊆ Z₂} := by + rw [Drawing.span_E] + ext e + simp only [mem_inter_iff, mem_ofPred_eq, and_iff_left_iff_imp] + exact And.left + have h1_union : ∀ e₁ ∈ A₁.E, closure e₁ ∩ M₂.V ⊆ A₁.V := by + exact retained_edges_meet_new_vertices_at_old_ends (S := S) (H := H) (H'' := H'') Z₂ + hH_edge_disj_Z₂ V''' rfl A₁ M₂ hA₁_V hA₁_E hM₂_V + have h2_union : ∀ e₂ ∈ M₂.E, closure e₂ ∩ A₁.V ⊆ M₂.V := by + exact inserted_edges_meet_old_vertices_at_new_ends (S := S) (H := H) (H'' := H'') Z₂ V''' rfl + A₁ M₂ hA₁_V hM₂_V hM₂_E + have h3_union : ∀ e₁ ∈ A₁.E, ∀ e₂ ∈ M₂.E, closure e₁ ∩ closure e₂ ⊆ A₁.V ∩ M₂.V := by + exact retained_and_inserted_edge_intersections (S := S) (H := H) (H'' := H'') Z₂ + hH_edge_disj_Z₂ V''' A₁ M₂ hA₁_ends hM₂_ends hA₁_V hA₁_E hM₂_V hM₂_E h1_union h2_union + refine ⟨unionDrawing A₁ M₂ h1_union h2_union h3_union, fun v => ?_, fun e => ?_⟩ + · change v ∈ A₁.V ∪ M₂.V ↔ v ∈ V''' + rw [hA₁_V, hM₂_V] + refine ⟨fun h => h.elim And.right And.right, fun hv => ?_⟩ + rcases hv with ⟨hvH, hvnot⟩ | ⟨hvH'', hvZ₂⟩ + · exact Or.inl ⟨hvH, Or.inl ⟨hvH, hvnot⟩⟩ + · exact Or.inr ⟨hvH'', Or.inr ⟨hvH'', hvZ₂⟩⟩ + · have hEq := unionDrawing_E A₁ M₂ h1_union h2_union h3_union + rw [hEq, hA₁_E, hM₂_E, mem_union] + rfl + +/-- Construction of the combined drawing `H''' = A₁ ∪ M₂` and its embedding `η''' : SpanEmbedding +H''' G` +in the proof of `(5.2)` (pages 131–132), together with its agreement properties outside `Z₂` (with +`H, η`) and outside `Z₁` (with `H'', η''`). -/ +theorem exists_rearranged_H'''_η''' + {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H H' H'' : Drawing S} + {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} {η'' : SpanEmbedding H'' G} + {θ_star θ lam lam₁ lam₂ μ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' d'' : Set S → Set S → ℕ} {z₁ z₂ : Set S} + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hθ_lt : 4 * lam + 2 < θ) + (hlam₁ : 4 ≤ lam₁) (hlam₂ : 4 ≤ lam₂) + (hlam : 6 * lam₁ + 5 * lam₂ + 3 * μ + 4 ≤ lam) + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' d' + d'' z₂) + (hStep : IsMuSteppedSpan G H'' η'' d'' μ) : + let Z₁ := atomZone H d z₁ lam₁ + let Z₂ := atomZone H' d' z₂ lam₂ + ∃ (H''' : Drawing S) (η''' : SpanEmbedding H''' G), + (∀ v, v ∈ H'''.V ↔ (v ∈ H.V ∧ v ∉ Z₂) ∨ (v ∈ H''.V ∧ v ∈ Z₂)) ∧ + (∀ e, e ∈ H'''.E ↔ (e ∈ H.E ∧ ¬ e ⊆ Z₂) ∨ (e ∈ H''.E ∧ e ⊆ Z₂)) ∧ + (∀ v, v ∉ Z₂ → (v ∈ H'''.V ↔ v ∈ H.V) ∧ η'''.vMap v = η.vMap v) ∧ + (∀ e, ¬ e ⊆ Z₂ → (e ∈ H'''.E ↔ e ∈ H.E) ∧ η'''.eMap e = η.eMap e) ∧ + (∀ x, x ∉ Z₂ → (x ∈ H'''.U ↔ x ∈ H.U)) ∧ + (∀ v, v ∉ Z₁ → (v ∈ H'''.V ↔ v ∈ H''.V) ∧ (v ∈ H'''.V → η'''.vMap v = η''.vMap v)) ∧ + (∀ e, ¬ e ⊆ Z₁ → (e ∈ H'''.E ↔ e ∈ H''.E) ∧ (e ∈ H'''.E → η'''.eMap e = η''.eMap e)) ∧ + (∀ x, x ∉ Z₁ → (x ∈ H'''.U ↔ x ∈ H''.U)) ∧ + (∀ a ∈ H.A, Disjoint a Z₂ → a ∈ H'''.A) ∧ + (∀ a ∈ H.A, a ∉ H'''.A → a ⊆ Z₂) ∧ + (∀ a ∈ H'''.A, a ∉ H.A → a ⊆ Z₂) ∧ + (∀ a ∈ H'''.A, a ∉ H''.A → a ⊆ Z₁) := by + intro Z₁ Z₂ + have hS : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + have hMetric : HasTangleMetric H θ T d := hRearr₁.isCompression.hasMetric + obtain ⟨_, hd_refl, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + obtain ⟨τ, hτ_z₂⟩ := atom_nonempty hRearr₂.z_mem + obtain ⟨z₃, hz₃, hτ_z₃⟩ := exists_atom_of_point H τ + obtain ⟨_, _, _, hClaim6, hClosureDist, hDisj_cl, _⟩ := + lemma_5_2_claims_3_to_6 hFlat hθ_lt hlam₁ hlam₂ hlam hRearr₁ hRearr₂ hStep hτ_z₂ hz₃ hτ_z₃ + have hDisj_Z : Disjoint Z₁ Z₂ := + hDisj_cl.mono subset_closure subset_closure + -- Any edge `e ∈ H.E` with `¬ e ⊆ Z₂` has `Disjoint e Z₂`, and if `¬ Disjoint (closure e) Z₂` + -- then `Disjoint (closure e) Z₁` + have hH_edge_disj_Z₂ : ∀ e ∈ H.E, ¬ e ⊆ Z₂ → Disjoint e Z₂ := by + intro e he hnot + rcases hRearr₁.atomZone_dichotomy.2.2.2.2.1 e he with ⟨_, hsub₁⟩ | ⟨_, _, heH', _⟩ + · exact hDisj_Z.mono hsub₁ Subset.rfl + · rcases hRearr₂.atomZone_dichotomy.2.2.2.2.1 e heH' with ⟨_, hsub₂⟩ | ⟨_, hdisj₂, _, _⟩ + · exact (hnot hsub₂).elim + · exact hdisj₂ + have hH_edge_cl_disj_Z₁ : ∀ e ∈ H.E, ¬ Disjoint (closure e) Z₂ → Disjoint (closure e) Z₁ := by + intro e he hnot_disj + obtain ⟨p, hp_cl, hpZ₂⟩ := Set.not_disjoint_iff.mp hnot_disj + refine Set.disjoint_left.mpr fun q hq_cl hqZ₁ => ?_ + obtain ⟨a_p, ha_p, hp_a⟩ := exists_atom_of_point H p + obtain ⟨a_q, ha_q, hq_a⟩ := exists_atom_of_point H q + have heA : e ∈ H.A := Or.inl (Or.inr he) + have hd_pe : d a_p e ≤ 3 := atom_closure_dist_le_three hS hMetric a_p ha_p e heA ⟨p, hp_a, + hp_cl⟩ + have hd_qe : d a_q e ≤ 3 := atom_closure_dist_le_three hS hMetric a_q ha_q e heA ⟨q, hq_a, + hq_cl⟩ + obtain ⟨_, _, _, hd_symm, hd_tri, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + have hsym := hd_symm e heA a_p ha_p + have htri := hd_tri a_q ha_q e heA a_p ha_p + have h6 := hClaim6 q hqZ₁ p hpZ₂ + rw [pointDist_eq_of_mem_atom ha_q ha_p hq_a hp_a] at h6 + omega + let V''' : Set S := {v ∈ H.V | v ∉ Z₂} ∪ {v ∈ H''.V | v ∈ Z₂} + have hA₁_ends : ∀ e ∈ H.E, ¬ e ⊆ Z₂ → closure e ∩ H.V ⊆ H.V ∩ V''' := by + exact retained_edges_preserve_outer_endpoints (α := α) (β := β) (S := S) (G := G) (H := H) (H' + := H') (H'' := H'') (η := η) (η' := η') (η'' := η'') (θ_star := θ_star) (θ := θ) (lam₁ := + lam₁) (lam₂ := lam₂) (T_star := T_star) (T := T) (T' := T') (T'' := T'') (d := d) (d' := d') + (d'' := d'') (z₁ := z₁) (z₂ := z₂) hRearr₁ hRearr₂ Z₁ rfl Z₂ rfl hH_edge_cl_disj_Z₁ V''' rfl + have hM₂_ends : ∀ e ∈ H''.E, e ⊆ Z₂ → closure e ∩ H''.V ⊆ H''.V ∩ V''' := by + exact inserted_edges_preserve_inner_endpoints (α := α) (β := β) (S := S) (G := G) (H := H) (H' + := H') (H'' := H'') (η := η) (η' := η') (η'' := η'') (θ_star := θ_star) (θ := θ) (lam₁ := + lam₁) (lam₂ := lam₂) (T_star := T_star) (T := T) (T' := T') (T'' := T'') (d := d) (d' := d') + (d'' := d'') (z₁ := z₁) (z₂ := z₂) hRearr₁ hRearr₂ Z₂ rfl hDisj_cl V''' rfl + obtain ⟨H''', hH'''_V, hH'''_E⟩ := + glue_drawings_along_zone H H'' Z₂ hH_edge_disj_Z₂ V''' rfl hA₁_ends hM₂_ends + -- Define `vMap'''` and `eMap'''` as opaque witnesses + obtain ⟨vMap''', hvMap'''_Z₂, hvMap'''_notZ₂⟩ : + ∃ vMap''' : S → α, + (∀ v, v ∈ Z₂ → vMap''' v = η''.vMap v) ∧ + (∀ v, v ∉ Z₂ → vMap''' v = η.vMap v) := by + classical + exact ⟨fun v => if v ∈ Z₂ then η''.vMap v else η.vMap v, + fun _ hv => ite_eq_left_iff.mpr fun h => (h hv).elim, + fun _ hv => ite_eq_right_iff.mpr fun h => (hv h).elim⟩ + obtain ⟨eMap''', heMap'''_Z₂, heMap'''_notZ₂⟩ : + ∃ eMap''' : Set S → β, + (∀ e, e ⊆ Z₂ → eMap''' e = η''.eMap e) ∧ + (∀ e, ¬ e ⊆ Z₂ → eMap''' e = η.eMap e) := by + classical + exact ⟨fun e => if e ⊆ Z₂ then η''.eMap e else η.eMap e, + fun _ he => ite_eq_left_iff.mpr fun h => (h he).elim, + fun _ he => ite_eq_right_iff.mpr fun h => (he h).elim⟩ + -- Agreement with `H'', η''` outside `Z₁` + have hV_notZ₁ : ∀ v, v ∉ Z₁ → (v ∈ H'''.V ↔ v ∈ H''.V) ∧ (v ∈ H'''.V → vMap''' v = η''.vMap v) + := by + exact outer_vertices_follow_second_rearrangement (α := α) (β := β) (S := S) (G := G) (H := H) + (H' := H') (H'' := H'') (η := η) (η' := η') (η'' := η'') (θ_star := θ_star) (θ := θ) (lam₁ + := lam₁) (lam₂ := lam₂) (T_star := T_star) (T := T) (T' := T') (T'' := T'') (d := d) (d' := + d') (d'' := d'') (z₁ := z₁) (z₂ := z₂) hRearr₁ hRearr₂ Z₁ rfl Z₂ rfl H''' hH'''_V vMap''' + hvMap'''_Z₂ hvMap'''_notZ₂ + have hE_notZ₁ : ∀ e, ¬ e ⊆ Z₁ → (e ∈ H'''.E ↔ e ∈ H''.E) ∧ (e ∈ H'''.E → eMap''' e = η''.eMap e) + := by + exact outer_edges_follow_second_rearrangement (α := α) (β := β) (S := S) (G := G) (H := H) (H' + := H') (H'' := H'') (η := η) (η' := η') (η'' := η'') (θ_star := θ_star) (θ := θ) (lam₁ := + lam₁) (lam₂ := lam₂) (T_star := T_star) (T := T) (T' := T') (T'' := T'') (d := d) (d' := d') + (d'' := d'') (z₁ := z₁) (z₂ := z₂) hRearr₁ hRearr₂ Z₁ rfl Z₂ rfl H''' hH'''_E eMap''' + heMap'''_Z₂ heMap'''_notZ₂ + -- Injectivity of `vMap'''` on `H'''.V` + have hinj_v : InjOn vMap''' H'''.V := by + exact combined_drawing_vertex_map_is_injective (α := α) (β := β) (S := S) (G := G) (H := H) + (H' := H') (H'' := H'') (η := η) (η' := η') (η'' := η'') (θ_star := θ_star) (θ := θ) (lam := + lam) (lam₁ := lam₁) (lam₂ := lam₂) (μ := μ) (T_star := T_star) (T := T) (T' := T') (T'' := + T'') (d := d) (d' := d') (d'' := d'') (z₁ := z₁) (z₂ := z₂) hFlat hθ_lt hlam₁ hlam₂ hlam + hRearr₁ hRearr₂ hStep Z₁ rfl Z₂ rfl hd_refl H''' hH'''_V vMap''' hvMap'''_Z₂ + hvMap'''_notZ₂ hV_notZ₁ + -- Every `e ∈ H'''.E` either has `e ∈ H.E ∧ ¬ e ⊆ Z₂ ∧ Disjoint (closure e) Z₂` or `e ∈ H''.E ∧ + -- Disjoint (closure e) Z₁` + have hE'''_cases : ∀ e ∈ H'''.E, + (e ∈ H.E ∧ ¬ e ⊆ Z₂ ∧ Disjoint (closure e) Z₂) ∨ + (e ∈ H''.E ∧ Disjoint (closure e) Z₁ ∧ eMap''' e = η''.eMap e) := by + exact combined_drawing_edge_cases Z₁ Z₂ hDisj_cl hH_edge_cl_disj_Z₁ H''' hH'''_E eMap''' + heMap'''_Z₂ hE_notZ₁ + -- Incidence characterization in `G` for `e ∈ H'''.E` + have hE_inc_G : ∀ e ∈ H'''.E, eMap''' e ∈ E(G) ∧ + (∀ x y, G.IsLink (eMap''' e) x y → x ∈ vMap''' '' H'''.V ∧ y ∈ vMap''' '' H'''.V) ∧ + (∀ v ∈ H'''.V, G.Inc (eMap''' e) (vMap''' v) ↔ v ∈ closure e) := by + exact combined_drawing_incidence_matches_graph (α := α) (β := β) (S := S) (G := G) (H := H) + (H'' := H'') (η := η) (η'' := η'') Z₁ Z₂ H''' hH'''_V vMap''' hvMap'''_notZ₂ eMap''' + heMap'''_notZ₂ hV_notZ₁ hinj_v hE'''_cases + -- Injectivity of `eMap'''` on `H'''.E` + have hinj_e : InjOn eMap''' H'''.E := by + exact combined_drawing_edge_map_is_injective (α := α) (β := β) (S := S) (G := G) (H := H) (H' + := H') (H'' := H'') (η := η) (η' := η') (η'' := η'') (θ_star := θ_star) (θ := θ) (lam₁ + := lam₁) (lam₂ := lam₂) (T_star := T_star) (T := T) (T' := T') (d := d) + (d' := d') (z₁ := z₁) (z₂ := z₂) hlam₁ hRearr₁ Z₁ rfl Z₂ rfl hS hMetric hDisj_cl H''' + hH'''_V vMap''' eMap''' heMap'''_notZ₂ hE_notZ₁ hE'''_cases hE_inc_G + -- Construct `η''' : SpanEmbedding H''' G` + let imageGraph''' := (G.induce (vMap''' '' H'''.V)).restrict (eMap''' '' H'''.E) + have hV_sub_G : vMap''' '' H'''.V ⊆ V(G) := by + rintro _ ⟨v, hv''', rfl⟩ + rcases (hH'''_V v).mp hv''' with ⟨hvH, hvnot⟩ | ⟨hvH'', hvZ₂⟩ + · rw [hvMap'''_notZ₂ v hvnot] + exact η.imageGraph_le.1 (η.bijOn_v.mapsTo hvH) + · rw [hvMap'''_Z₂ v hvZ₂] + exact η''.imageGraph_le.1 (η''.bijOn_v.mapsTo hvH'') + have hE_im_eq : E(imageGraph''') = eMap''' '' H'''.E := by + exact combined_image_graph_edges (α := α) (β := β) (S := S) (G := G) H''' vMap''' eMap''' + hE_inc_G + let η''' : SpanEmbedding H''' G := { + imageGraph := imageGraph''' + vMap := vMap''' + eMap := eMap''' + imageGraph_le := Graph.restrict_le.trans (Graph.induce_le hV_sub_G) + bijOn_v := by + have hV_eq : V(imageGraph''') = vMap''' '' H'''.V := by simp [imageGraph'''] + rw [hV_eq] + exact hinj_v.bijOn_image + bijOn_e := by + rw [hE_im_eq] + exact hinj_e.bijOn_image + inc_iff := fun e he''' v hv''' => by + rw [← (hE_inc_G e he''').2.2 v hv'''] + constructor + · rintro ⟨w, _, hlinkG, _, _⟩ + exact ⟨w, hlinkG⟩ + · rintro ⟨w, hlinkG⟩ + obtain ⟨_, hw_im⟩ := (hE_inc_G e he''').2.1 (vMap''' v) w hlinkG + exact ⟨w, ⟨e, he''', rfl⟩, hlinkG, ⟨v, hv''', rfl⟩, hw_im⟩ + } + -- Atom agreement properties + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hU'''_iff_notZ₂ : ∀ x, x ∉ Z₂ → (x ∈ H'''.U ↔ x ∈ H.U) := by + exact outside_inner_zone_union_agrees_with_original (S := S) (H := H) (H'' := H'') Z₂ H''' + hH'''_V hH'''_E + have hU'''_iff_Z₂ : ∀ x, x ∈ Z₂ → (x ∈ H'''.U ↔ x ∈ H''.U) := by + exact inside_inner_zone_union_agrees_with_replacement (α := α) (β := β) (S := S) (G := G) (H + := H) (H' := H') (H'' := H'') (η' := η') (η'' := η'') (θ_star := θ_star) (θ := θ) (lam₁ := + lam₁) (lam₂ := lam₂) (T_star := T_star) (T' := T') (T'' := T'') (d' := d') (d'' := d'') (z₂ + := z₂) hRearr₂ Z₂ rfl hH_edge_disj_Z₂ H''' hH'''_V hH'''_E + have hU'''_iff_notZ₁ : ∀ x, x ∉ Z₁ → (x ∈ H'''.U ↔ x ∈ H''.U) := by + exact outside_outer_zone_union_agrees_with_replacement (α := α) (β := β) (S := S) (G := G) (H + := H) (H'' := H'') (η'' := η'') Z₁ Z₂ H''' hH'''_V hH'''_E vMap''' eMap''' hV_notZ₁ hE_notZ₁ + hU'''_iff_notZ₂ hU'''_iff_Z₂ + have hH_atom_disj_Z₂ : ∀ a ∈ H.A, Disjoint a Z₂ → a ∈ H'''.A := by + exact first_drawing_atoms_off_second_zone_survive (α := α) (β := β) (S := S) (G := G) (H := H) + (H' := H') (H'' := H'') (η := η) (η' := η') (η'' := η'') (θ_star := θ_star) (θ := θ) (lam₁ + := lam₁) (lam₂ := lam₂) (T_star := T_star) (T := T) (T' := T') (T'' := T'') (d := d) (d' := + d') (d'' := d'') (z₁ := z₁) (z₂ := z₂) hRearr₁ hRearr₂ Z₂ rfl hDisj_cl H''' hH'''_V hH'''_E + this hU'''_iff_notZ₂ hU'''_iff_Z₂ + have hH_atom_compl : ∀ a ∈ H.A, a ∉ H'''.A → a ⊆ Z₂ := by + intro a ha hnot + rcases hRearr₁.atomZone_dichotomy.1 a ha with ⟨_, hsub₁⟩ | ⟨_, _, haH'⟩ + · exact (hnot (hH_atom_disj_Z₂ a ha (hDisj_Z.mono hsub₁ Subset.rfl))).elim + · rcases hRearr₂.atomZone_dichotomy.1 a haH' with ⟨_, hsub₂⟩ | ⟨_, hdisj₂, _⟩ + · exact hsub₂ + · exact (hnot (hH_atom_disj_Z₂ a ha hdisj₂)).elim + have hH''_atom_disj_Z₁ : ∀ a ∈ H''.A, Disjoint a Z₁ → a ∈ H'''.A := by + exact second_drawing_atoms_off_first_zone_survive (α := α) (β := β) (S := S) (G := G) (H := H) + (H' := H') (H'' := H'') (η := η) (η' := η') (η'' := η'') (θ_star := θ_star) (θ := θ) (lam₁ + := lam₁) (lam₂ := lam₂) (T_star := T_star) (T := T) (T' := T') (T'' := T'') (d := d) (d' := + d') (d'' := d'') (z₁ := z₁) (z₂ := z₂) hRearr₁ hRearr₂ Z₁ rfl Z₂ rfl hDisj_cl hDisj_Z H''' + vMap''' eMap''' hV_notZ₁ hE_notZ₁ this hU'''_iff_notZ₂ hU'''_iff_notZ₁ + have hH''_atom_compl : ∀ a ∈ H''.A, a ∉ H'''.A → a ⊆ Z₁ := by + intro a ha hnot + rcases hRearr₂.atomZone_dichotomy.2.1 a ha with hsub₂ | ⟨_, haH', _⟩ + · exact (hnot (hH''_atom_disj_Z₁ a ha (hDisj_Z.symm.mono hsub₂ Subset.rfl))).elim + · rcases hRearr₁.atomZone_dichotomy.2.1 a haH' with hsub₁ | ⟨hdisj₁, _⟩ + · exact hsub₁ + · exact (hnot (hH''_atom_disj_Z₁ a ha hdisj₁)).elim + exact ⟨H''', η''', hH'''_V, hH'''_E, + fun v hvnot => ⟨⟨fun h => ((hH'''_V v).mp h).resolve_right (fun h2 => hvnot h2.2) |>.1, + fun h => (hH'''_V v).mpr (Or.inl ⟨h, hvnot⟩)⟩, hvMap'''_notZ₂ v hvnot⟩, + fun e henot => ⟨⟨fun h => ((hH'''_E e).mp h).resolve_right (fun h2 => henot h2.2) |>.1, + fun h => (hH'''_E e).mpr (Or.inl ⟨h, henot⟩)⟩, heMap'''_notZ₂ e henot⟩, + hU'''_iff_notZ₂, + hV_notZ₁, hE_notZ₁, hU'''_iff_notZ₁, + hH_atom_disj_Z₂, + hH_atom_compl, + atom_subset_of_compl_subset hH_atom_compl, + atom_subset_of_compl_subset hH''_atom_compl⟩ + +/-- If `Δ` is a dial for `F, Γ₁` and `Γ₁, Γ₂` have the same vertices, edges, and `U` inside `Δ`, +then `Δ` is a dial for `F, Γ₂`. -/ +theorem isDial_congr_of_subset {S : Type w} [TopologicalSpace S] [T2Space S] + {Γ₁ Γ₂ : Drawing S} {F Δ : Set S} (hDial : IsDial Γ₁ F Δ) + (hV : ∀ v ∈ Δ, v ∈ Γ₁.V ↔ v ∈ Γ₂.V) + (hE₁ : ∀ e ∈ Γ₁.E, e ⊆ Δ → e ∈ Γ₂.E) + (hE₂ : ∀ e ∈ Γ₂.E, e ⊆ Δ → e ∈ Γ₁.E) + (hU : ∀ x ∈ Δ, x ∈ Γ₁.U ↔ x ∈ Γ₂.U) : + IsDial Γ₂ F Δ := by + have hF_sub : F ⊆ Δ := by + rw [← hDial.2.1] + exact inter_subset_left.trans hDial.1.isClosed.closure_subset + have hFV_eq : F ∩ Γ₁.V = F ∩ Γ₂.V := by + ext x + exact ⟨fun ⟨hxF, hxV⟩ => ⟨hxF, (hV x (hF_sub hxF)).mp hxV⟩, + fun ⟨hxF, hxV⟩ => ⟨hxF, (hV x (hF_sub hxF)).mpr hxV⟩⟩ + have hΔU_eq : Δ ∩ Γ₁.U = Δ ∩ Γ₂.U := by + ext x + exact ⟨fun ⟨hxΔ, hxU⟩ => ⟨hxΔ, (hU x hxΔ).mp hxU⟩, + fun ⟨hxΔ, hxU⟩ => ⟨hxΔ, (hU x hxΔ).mpr hxU⟩⟩ + have hinter_eq : Γ₁.interSet Δ = Γ₂.interSet Δ := by + apply Drawing.ext_of_V_E + · rw [Drawing.interSet, Drawing.interSet, Drawing.span_V, Drawing.span_V, + Drawing.spanV, Drawing.spanV] + ext x + simp only [mem_union, mem_inter_iff, mem_iUnion₂, mem_ofPred_eq] + constructor + · rintro (⟨⟨hxV, hxΔ⟩, _⟩ | ⟨e, ⟨⟨heE, heΔ⟩, _⟩, hxcl, hxV⟩) + · exact Or.inl ⟨⟨(hV x hxΔ).mp hxV, hxΔ⟩, (hV x hxΔ).mp hxV⟩ + · have hxΔ : x ∈ Δ := hDial.1.isClosed.closure_subset_iff.mpr heΔ hxcl + exact Or.inl ⟨⟨(hV x hxΔ).mp hxV, hxΔ⟩, (hV x hxΔ).mp hxV⟩ + · rintro (⟨⟨hxV, hxΔ⟩, _⟩ | ⟨e, ⟨⟨heE, heΔ⟩, _⟩, hxcl, hxV⟩) + · exact Or.inl ⟨⟨(hV x hxΔ).mpr hxV, hxΔ⟩, (hV x hxΔ).mpr hxV⟩ + · have hxΔ : x ∈ Δ := hDial.1.isClosed.closure_subset_iff.mpr heΔ hxcl + exact Or.inl ⟨⟨(hV x hxΔ).mpr hxV, hxΔ⟩, (hV x hxΔ).mpr hxV⟩ + · rw [Drawing.interSet, Drawing.interSet, Drawing.span_E, Drawing.span_E] + ext e + simp only [mem_inter_iff, mem_ofPred_eq] + exact ⟨fun ⟨⟨heE, heΔ⟩, _⟩ => ⟨⟨hE₁ e heE heΔ, heΔ⟩, hE₁ e heE heΔ⟩, + fun ⟨⟨heE, heΔ⟩, _⟩ => ⟨⟨hE₂ e heE heΔ, heΔ⟩, hE₂ e heE heΔ⟩⟩ + refine ⟨hDial.1, hDial.2.1, ?_⟩ + rw [← hΔU_eq, ← hFV_eq, ← hinter_eq] + exact hDial.2.2 + +/-- If `Δ` is a dial for `F, Γ`, `W` is preconnected, and `Disjoint F W`, then `W ⊆ Δ` or +`Disjoint W Δ`. -/ +theorem subset_or_disjoint_of_isDial {S : Type w} [TopologicalSpace S] [T2Space S] + {Γ : Drawing S} {F Δ W : Set S} (hDial : IsDial Γ F Δ) + (hW : IsPreconnected W) (hdisj : Disjoint F W) : + W ⊆ Δ ∨ Disjoint W Δ := by + by_cases hsub : W ⊆ Δ + · exact Or.inl hsub + · right + refine Set.disjoint_left.mpr fun x hxW hxΔ => ?_ + obtain ⟨y, hyW, hy_notΔ⟩ := Set.not_subset.mp hsub + have hcov : W ⊆ (closure (univ \ Δ))ᶜ ∪ Δᶜ := by + intro z hzW + by_cases hzΔ : z ∈ Δ + · left + intro hz_cl + have hz_bd : z ∈ subBd Δ := ⟨subset_closure hzΔ, hz_cl⟩ + exact Set.disjoint_left.mp hdisj (hDial.2.1 ▸ hz_bd) hzW + · exact Or.inr hzΔ + have hx_U₁ : x ∈ (closure (univ \ Δ))ᶜ := + (hcov hxW).resolve_right (not_not.mpr hxΔ) + obtain ⟨z, _, hz₁, hz₂⟩ := + hW (closure (univ \ Δ))ᶜ Δᶜ isClosed_closure.isOpen_compl hDial.1.isClosed.isOpen_compl + hcov ⟨x, hxW, hx_U₁⟩ ⟨y, hyW, hy_notΔ⟩ + exact hz₁ (subset_closure ⟨mem_univ z, hz₂⟩) + +/-- If `F` is preconnected, `x₁ ∈ F ∩ W`, and `x₂ ∈ F \ closure W`, then `(F ∩ frontier +W).Nonempty`. -/ +theorem nonempty_inter_frontier_of_isPreconnected {S : Type w} [TopologicalSpace S] + {F W : Set S} (hF : IsPreconnected F) {x₁ x₂ : S} + (hx₁ : x₁ ∈ F ∩ W) (hx₂ : x₂ ∈ F \ closure W) : + (F ∩ frontier W).Nonempty := by + by_contra hEmp + have hdisj : Disjoint F (frontier W) := + disjoint_iff_inter_eq_empty.mpr (Set.not_nonempty_iff_eq_empty.mp hEmp) + have hcov : F ⊆ interior W ∪ (closure W)ᶜ := by + intro z hzF + by_cases hz_cl : z ∈ closure W + · exact Or.inl (by_contra fun hz_int => Set.disjoint_left.mp hdisj hzF ⟨hz_cl, hz_int⟩) + · exact Or.inr hz_cl + have hx₁_int : x₁ ∈ interior W := + (hcov hx₁.1).resolve_right (not_not.mpr (subset_closure hx₁.2)) + obtain ⟨z, _, hz_int, hz_compl⟩ := + hF (interior W) (closure W)ᶜ isOpen_interior isClosed_closure.isOpen_compl + hcov ⟨x₁, hx₁.1, hx₁_int⟩ ⟨x₂, hx₂.1, hx₂.2⟩ + exact hz_compl (subset_closure (interior_subset hz_int)) + +private theorem combined_rearrangement_is_rigid + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {G : Graph α β} + {H : Drawing S} + {H' : Drawing S} + {H'' : Drawing S} + {H''' : Drawing S} + {η : SpanEmbedding H G} + {η' : SpanEmbedding H' G} + {η'' : SpanEmbedding H'' G} + {θ_star : ℕ} + {θ : ℕ} + {lam : ℕ} + {lam₁ : ℕ} + {lam₂ : ℕ} + {μ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {d' : Set S → Set S → ℕ} + {d'' : Set S → Set S → ℕ} + {z₁ : Set S} + {z₂ : Set S} + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hθ_lt : 4 * lam + 2 < θ) + (hlam₁ : 4 ≤ lam₁) + (hlam₂ : 4 ≤ lam₂) + (hlam : 6 * lam₁ + 5 * lam₂ + 3 * μ + 4 ≤ lam) + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' + d' d'' z₂) + (hV_notZ₂ : ∀ v ∉ atomZone H' d' z₂ lam₂, v ∈ H'''.V ↔ v ∈ H.V) + (hE_notZ₂ : ∀ (e : Set S), ¬e ⊆ atomZone H' d' z₂ lam₂ → (e ∈ H'''.E ↔ e ∈ H.E)) + (hU_notZ₂ : ∀ x ∉ atomZone H' d' z₂ lam₂, x ∈ H'''.U ↔ x ∈ H.U) + (hV_notZ₁ : ∀ v ∉ atomZone H d z₁ lam₁, v ∈ H'''.V ↔ v ∈ H''.V) + (hE_notZ₁ : ∀ (e : Set S), ¬e ⊆ atomZone H d z₁ lam₁ → (e ∈ H'''.E ↔ e ∈ H''.E)) + (hU_notZ₁ : ∀ x ∉ atomZone H d z₁ lam₁, x ∈ H'''.U ↔ x ∈ H''.U) + (hS : IsClosedSurface S) + [hConn : ConnectedSpace S] + (hMetric : HasTangleMetric H θ T d) + (hMetric' : HasTangleMetric H' (θ - (4 * lam₁ + 2)) T' d') + (hd_refl : ∀ a ∈ H.A, d a a = 0) + (τ : S) + (hτ_z₂ : τ ∈ z₂) + (z₃ : Set S) + (hz₃ : z₃ ∈ H.A) + (hτ_z₃ : τ ∈ z₃) + (hCentersFar : lam - lam₁ < d z₁ z₃) + (σ₁ : S) + (hσ₁_z₁ : σ₁ ∈ z₁) + (hσ₁_Z₁ : σ₁ ∈ (atomZone H d z₁ lam₁)) + (hZ₁_sub_plus : (atomZone H d z₁ lam₁) ⊆ (atomZone H d z₁ (lam₁ + 4))) + (hZone_disj_Z₂ : ∀ (k : ℕ), k + 3 ≤ lam - 2 * lam₁ - lam₂ - 6 → Disjoint (closure (atomZone H + d z₁ k)) (closure (atomZone H' d' z₂ lam₂))) : + IsRigid H''' := by + let Z₁ := atomZone H d z₁ lam₁ + let Z₂ := atomZone H' d' z₂ lam₂ + let Z₁_plus := atomZone H d z₁ (lam₁ + 4) + intro F hF hFU hFV + have hF_pre : IsPreconnected F := by + obtain ⟨φ⟩ := hF + have h : F = range (fun z : Circle => (φ z).1) := by + ext x + exact ⟨fun hx => ⟨φ.symm ⟨x, hx⟩, by simp⟩, fun ⟨z, hz⟩ => hz ▸ (φ z).2⟩ + rw [h] + exact isPreconnected_range (continuous_subtype_val.comp φ.continuous) + -- Show `Disjoint F Z₂` or `Disjoint F Z₁_plus` + have hDisj_or : Disjoint F Z₂ ∨ Disjoint F Z₁_plus := by + by_contra hnot + have hF_Z₂ : ¬ Disjoint F Z₂ := fun h => hnot (Or.inl h) + have hF_Z₁p : ¬ Disjoint F Z₁_plus := fun h => hnot (Or.inr h) + obtain ⟨x₂, hx₂F, hx₂Z₂⟩ := Set.not_disjoint_iff.mp hF_Z₂ + obtain ⟨x₁, hx₁F, hx₁Z₁p⟩ := Set.not_disjoint_iff.mp hF_Z₁p + have hband : ∀ i : Fin 3, + ∃ p ∈ F ∩ H'''.V, ∃ a_p ∈ H.A, p ∈ a_p ∧ + lam₁ + 4 + 6 * i.1 ≤ d z₁ a_p + 2 ∧ d z₁ a_p ≤ lam₁ + 4 + 6 * i.1 + 3 := by + intro i + let k := lam₁ + 4 + 6 * i.1 + let W := atomZone H d z₁ k + have hsub_W : Z₁_plus ⊆ W := fun x ⟨a, ha, hle, hxa⟩ => ⟨a, ha, by omega, hxa⟩ + have hx₁W : x₁ ∈ F ∩ W := ⟨hx₁F, hsub_W hx₁Z₁p⟩ + have hdisj_W : Disjoint (closure W) (closure Z₂) := by + have : i.1 < 3 := i.2 + exact hZone_disj_Z₂ k (by omega) + have hx₂_notW : x₂ ∈ F \ closure W := + ⟨hx₂F, fun hx₂cl => Set.disjoint_left.mp hdisj_W hx₂cl (subset_closure hx₂Z₂)⟩ + obtain ⟨p, hpF, hp_fr⟩ := nonempty_inter_frontier_of_isPreconnected hF_pre hx₁W hx₂_notW + obtain ⟨a_p, ha_p, hp_a⟩ := exists_atom_of_point H p + obtain ⟨hp_HU, hbounds⟩ := + frontier_atomZone_subset_U k hS hConn hMetric hRearr₁.z_mem p hp_fr + have hp_notZ₂ : p ∉ Z₂ := fun hpZ₂ => + Set.disjoint_left.mp hdisj_W hp_fr.1 (subset_closure hpZ₂) + have hp_U''' : p ∈ H'''.U := (hU_notZ₂ p hp_notZ₂).mpr hp_HU + exact ⟨p, ⟨hpF, hFU ⟨hpF, hp_U'''⟩⟩, a_p, ha_p, hp_a, hbounds a_p ha_p hp_a⟩ + obtain ⟨p₀, hp₀, a₀, ha₀, hp₀_a₀, _, hd₀_le⟩ := hband 0 + obtain ⟨p₁, hp₁, a₁, ha₁, hp₁_a₁, hd₁_ge, hd₁_le⟩ := hband 1 + obtain ⟨p₂, hp₂, a₂, ha₂, hp₂_a₂, hd₂_ge, _⟩ := hband 2 + have hp₀₁ : p₀ ≠ p₁ := by + rintro rfl + have hEq := atom_eq_of_mem ha₀ ha₁ hp₀_a₀ hp₁_a₁ + subst hEq; omega + have hp₀₂ : p₀ ≠ p₂ := by + rintro rfl + have hEq := atom_eq_of_mem ha₀ ha₂ hp₀_a₀ hp₂_a₂ + subst hEq; omega + have hp₁₂ : p₁ ≠ p₂ := by + rintro rfl + have hEq := atom_eq_of_mem ha₁ ha₂ hp₁_a₁ hp₂_a₂ + subst hEq; omega + have hsub_three : ({p₀, p₁, p₂} : Set S) ⊆ F ∩ H'''.V := by + rintro x (rfl | rfl | rfl) + · exact hp₀ + · exact hp₁ + · exact hp₂ + have hfin_FV : (F ∩ H'''.V).Finite := H'''.finite_V.subset inter_subset_right + have hcard_le := Set.ncard_le_ncard hsub_three hfin_FV + rw [Set.ncard_insert_of_notMem (by simp [hp₀₁, hp₀₂]), + Set.ncard_insert_of_notMem (by simp [hp₁₂]), Set.ncard_singleton] at hcard_le + omega + rcases hDisj_or with hDisj_FZ₂ | hDisj_FZ₁p + · -- Case 1: `Disjoint F Z₂` + have hFU_H : F ∩ H.U ⊆ H.V := by + rintro x ⟨hxF, hxHU⟩ + have hx_notZ₂ : x ∉ Z₂ := Set.disjoint_left.mp hDisj_FZ₂ hxF + exact (hV_notZ₂ x hx_notZ₂).mp (hFU ⟨hxF, (hU_notZ₂ x hx_notZ₂).mpr hxHU⟩) + have hFV_eq : F ∩ H.V = F ∩ H'''.V := by + ext x + exact ⟨fun ⟨hxF, hxV⟩ => ⟨hxF, (hV_notZ₂ x (Set.disjoint_left.mp hDisj_FZ₂ hxF)).mpr hxV⟩, + fun ⟨hxF, hxV⟩ => ⟨hxF, (hV_notZ₂ x (Set.disjoint_left.mp hDisj_FZ₂ hxF)).mp hxV⟩⟩ + obtain ⟨Δ, hDial⟩ := hFlat.isSpan.isRigid F hF hFU_H (hFV_eq ▸ hFV) + have hZ₂_pre : IsPreconnected Z₂ := + isPreconnected_atomZone hS hConn hMetric' hRearr₂.z_mem (by omega) + have hDisj_Z₂_Δ : Disjoint Z₂ Δ := by + rcases subset_or_disjoint_of_isDial hDial hZ₂_pre hDisj_FZ₂ with hsub_Z₂ | hdisj + · exfalso + obtain ⟨_, _, _, hd_symm, hd_tri, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + have hd_inc := atom_closure_dist_le_three hS hMetric + have hd'_inc := atom_closure_dist_le_three hS hMetric' + obtain ⟨r, hrH, hτ_r⟩ := exists_region_closure_mem_of_closedSurface hS H τ + have hrA : r ∈ H.A := Or.inr hrH + have hdr₃ : d z₃ r ≤ 3 := hd_inc z₃ hz₃ r hrA ⟨τ, hτ_z₃, hτ_r⟩ + have htri := hd_tri z₁ hRearr₁.z_mem r hrA z₃ hz₃ + have hsymm : d r z₃ = d z₃ r := hd_symm r hrA z₃ hz₃ + have hrH' : r ∈ H'.A := hRearr₁.atom_mem r hrA (by omega) + have hdr' : d' z₂ r ≤ 3 := hd'_inc z₂ hRearr₂.z_mem r hrH' ⟨τ, hτ_z₂, hτ_r⟩ + have hr_sub_Z₂ : r ⊆ Z₂ := fun y hy => ⟨r, hrH', by omega, hy⟩ + have hcl_r_sub_Δ : closure r ⊆ Δ := + hDial.1.isClosed.closure_subset_iff.mpr (hr_sub_Z₂.trans hsub_Z₂) + exact not_closure_region_subset_of_isDial hS hF hFU_H hDial hrH hcl_r_sub_Δ + · exact hdisj + refine ⟨Δ, isDial_congr_of_subset hDial + (fun v hvΔ => (hV_notZ₂ v (Set.disjoint_right.mp hDisj_Z₂_Δ hvΔ)).symm) + (fun e heH heΔ => (hE_notZ₂ e fun heZ₂ => ?_).mpr heH) + (fun e he''' heΔ => (hE_notZ₂ e fun heZ₂ => ?_).mp he''') + (fun x hxΔ => (hU_notZ₂ x (Set.disjoint_right.mp hDisj_Z₂_Δ hxΔ)).symm)⟩ + · obtain ⟨x, hxe⟩ := heH.1 + exact Set.disjoint_left.mp hDisj_Z₂_Δ (heZ₂ hxe) (heΔ hxe) + · obtain ⟨x, hxe⟩ := he'''.1 + exact Set.disjoint_left.mp hDisj_Z₂_Δ (heZ₂ hxe) (heΔ hxe) + · -- Case 2: `Disjoint F Z₁_plus` + have hDisj_FZ₁ : Disjoint F Z₁ := hDisj_FZ₁p.mono Subset.rfl hZ₁_sub_plus + have hFU_H'' : F ∩ H''.U ⊆ H''.V := by + rintro x ⟨hxF, hxH''U⟩ + have hx_notZ₁ : x ∉ Z₁ := Set.disjoint_left.mp hDisj_FZ₁ hxF + exact (hV_notZ₁ x hx_notZ₁).mp (hFU ⟨hxF, (hU_notZ₁ x hx_notZ₁).mpr hxH''U⟩) + have hFV_eq : F ∩ H''.V = F ∩ H'''.V := by + ext x + exact ⟨fun ⟨hxF, hxV⟩ => ⟨hxF, (hV_notZ₁ x (Set.disjoint_left.mp hDisj_FZ₁ hxF)).mpr hxV⟩, + fun ⟨hxF, hxV⟩ => ⟨hxF, (hV_notZ₁ x (Set.disjoint_left.mp hDisj_FZ₁ hxF)).mp hxV⟩⟩ + obtain ⟨Δ, hDial⟩ := hRearr₂.isSpan'.isRigid F hF hFU_H'' (hFV_eq ▸ hFV) + have hZ₁p_pre : IsPreconnected Z₁_plus := + isPreconnected_atomZone hS hConn hMetric hRearr₁.z_mem (by omega) + have hDisj_Z₁p_Δ : Disjoint Z₁_plus Δ := by + rcases subset_or_disjoint_of_isDial hDial hZ₁p_pre hDisj_FZ₁p with hsub_Z₁p | hdisj + · exfalso + obtain ⟨r'', hr'', hσ₁_r''⟩ := exists_region_closure_mem_of_closedSurface hS H'' σ₁ + have hdisj_Z₁p_Z₂ : Disjoint (closure Z₁_plus) (closure Z₂) := hZone_disj_Z₂ (lam₁ + 4) + (by omega) + have hfr_sub : frontier Z₁_plus ⊆ H''.U := by + intro y hy_fr + obtain ⟨a_y, ha_y, hy_a⟩ := exists_atom_of_point H y + obtain ⟨hy_HU, hbounds⟩ := + frontier_atomZone_subset_U (lam₁ + 4) hS hConn hMetric hRearr₁.z_mem y hy_fr + have := hbounds a_y ha_y hy_a + have hy_notZ₁ : y ∉ Z₁ := by + rw [mem_atomZone_iff_of_mem_atom ha_y hy_a]; omega + have hy_notZ₂ : y ∉ Z₂ := fun hyZ₂ => + Set.disjoint_left.mp hdisj_Z₁p_Z₂ hy_fr.1 (subset_closure hyZ₂) + exact (hU_notZ₁ y hy_notZ₁).mp ((hU_notZ₂ y hy_notZ₂).mpr hy_HU) + have hσ₁_int : σ₁ ∈ interior Z₁_plus := by + have hσ₁_cl : σ₁ ∈ closure Z₁_plus := subset_closure (hZ₁_sub_plus hσ₁_Z₁) + by_contra hnot_int + have hσ₁_fr : σ₁ ∈ frontier Z₁_plus := ⟨hσ₁_cl, hnot_int⟩ + obtain ⟨_, hbounds⟩ := + frontier_atomZone_subset_U (lam₁ + 4) hS hConn hMetric hRearr₁.z_mem σ₁ hσ₁_fr + have := hbounds z₁ hRearr₁.z_mem hσ₁_z₁ + rw [hd_refl z₁ hRearr₁.z_mem] at this + omega + obtain ⟨p, hp_int, hp_r''⟩ := + mem_closure_iff.mp hσ₁_r'' (interior Z₁_plus) isOpen_interior hσ₁_int + have hr''_sub_cl : r'' ⊆ closure Z₁_plus := by + intro q hq_r'' + by_contra hq_not_cl + have hp_mem : p ∈ r'' ∩ Z₁_plus := ⟨hp_r'', interior_subset hp_int⟩ + have hq_mem : q ∈ r'' \ closure Z₁_plus := ⟨hq_r'', hq_not_cl⟩ + obtain ⟨y, hy_r'', hy_fr⟩ := + nonempty_inter_frontier_of_isPreconnected (region_isPreconnected hr'') hp_mem hq_mem + exact region_subset hr'' hy_r'' (hfr_sub hy_fr) + have hcl_r''_sub_Δ : closure r'' ⊆ Δ := + hDial.1.isClosed.closure_subset_iff.mpr + (hr''_sub_cl.trans (hDial.1.isClosed.closure_subset_iff.mpr hsub_Z₁p)) + exact not_closure_region_subset_of_isDial hS hF hFU_H'' hDial hr'' hcl_r''_sub_Δ + · exact hdisj + have hDisj_Z₁_Δ : Disjoint Z₁ Δ := hDisj_Z₁p_Δ.mono hZ₁_sub_plus Subset.rfl + refine ⟨Δ, isDial_congr_of_subset hDial + (fun v hvΔ => (hV_notZ₁ v (Set.disjoint_right.mp hDisj_Z₁_Δ hvΔ)).symm) + (fun e heH'' heΔ => (hE_notZ₁ e fun heZ₁ => ?_).mpr heH'') + (fun e he''' heΔ => (hE_notZ₁ e fun heZ₁ => ?_).mp he''') + (fun x hxΔ => (hU_notZ₁ x (Set.disjoint_right.mp hDisj_Z₁_Δ hxΔ)).symm)⟩ + · obtain ⟨x, hxe⟩ := heH''.1 + exact Set.disjoint_left.mp hDisj_Z₁_Δ (heZ₁ hxe) (heΔ hxe) + · obtain ⟨x, hxe⟩ := he'''.1 + exact Set.disjoint_left.mp hDisj_Z₁_Δ (heZ₁ hxe) (heΔ hxe) + +/-- Claim (8) of the proof of `(5.2)` (page 131): `H'''` is rigid and 2-cell. -/ +theorem isRigid_and_isTwoCell_H''' + {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H H' H'' H''' : Drawing S} + {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} {η'' : SpanEmbedding H'' G} + {θ_star θ lam lam₁ lam₂ μ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' d'' : Set S → Set S → ℕ} {z₁ z₂ : Set S} + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hθ_lt : 4 * lam + 2 < θ) + (hlam₁ : 4 ≤ lam₁) (hlam₂ : 4 ≤ lam₂) + (hlam : 6 * lam₁ + 5 * lam₂ + 3 * μ + 4 ≤ lam) + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' d' + d'' z₂) + (hStep : IsMuSteppedSpan G H'' η'' d'' μ) + (hV_notZ₂ : ∀ v, v ∉ atomZone H' d' z₂ lam₂ → (v ∈ H'''.V ↔ v ∈ H.V)) + (hE_notZ₂ : ∀ e, ¬ e ⊆ atomZone H' d' z₂ lam₂ → (e ∈ H'''.E ↔ e ∈ H.E)) + (hU_notZ₂ : ∀ x, x ∉ atomZone H' d' z₂ lam₂ → (x ∈ H'''.U ↔ x ∈ H.U)) + (hV_notZ₁ : ∀ v, v ∉ atomZone H d z₁ lam₁ → (v ∈ H'''.V ↔ v ∈ H''.V)) + (hE_notZ₁ : ∀ e, ¬ e ⊆ atomZone H d z₁ lam₁ → (e ∈ H'''.E ↔ e ∈ H''.E)) + (hU_notZ₁ : ∀ x, x ∉ atomZone H d z₁ lam₁ → (x ∈ H'''.U ↔ x ∈ H''.U)) : + IsRigid H''' ∧ (PaintingOrDrawing.drawing H''').IsTwoCell := by + let Z₁ := atomZone H d z₁ lam₁ + let Z₂ := atomZone H' d' z₂ lam₂ + let Z₁_plus := atomZone H d z₁ (lam₁ + 4) + have hS : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hMetric : HasTangleMetric H θ T d := hRearr₁.isCompression.hasMetric + have hMetric' : HasTangleMetric H' (θ - (4 * lam₁ + 2)) T' d' := hRearr₁.isCompression.hasMetric' + obtain ⟨_, hd_refl, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + obtain ⟨τ, hτ_z₂⟩ := atom_nonempty hRearr₂.z_mem + obtain ⟨z₃, hz₃, hτ_z₃⟩ := exists_atom_of_point H τ + obtain ⟨hCentersFar, _, _, hClaim6, hClosureDist, hDisj_cl, hz₂_eq_z₃⟩ := + lemma_5_2_claims_3_to_6 hFlat hθ_lt hlam₁ hlam₂ hlam hRearr₁ hRearr₂ hStep hτ_z₂ hz₃ hτ_z₃ + have hDisj_Z : Disjoint Z₁ Z₂ := hDisj_cl.mono subset_closure subset_closure + obtain ⟨σ₁, hσ₁_z₁⟩ := atom_nonempty hRearr₁.z_mem + have hσ₁_Z₁ : σ₁ ∈ Z₁ := by + apply (mem_atomZone_iff_of_mem_atom hRearr₁.z_mem hσ₁_z₁).mpr + rw [hd_refl z₁ hRearr₁.z_mem] + omega + have hZ₁_sub_plus : Z₁ ⊆ Z₁_plus := fun x ⟨a, ha, hle, hxa⟩ => ⟨a, ha, by omega, hxa⟩ + -- Any `atomZone H d z₁ k` with `k + 3 ≤ lam - 2 * lam₁ - lam₂ - 6` has closure disjoint from + -- `closure Z₂` + have hZone_disj_Z₂ : ∀ k : ℕ, k + 3 ≤ lam - 2 * lam₁ - lam₂ - 6 → + Disjoint (closure (atomZone H d z₁ k)) (closure Z₂) := by + intro k hk + refine Set.disjoint_left.mpr fun x hx₁ hx₂ => ?_ + obtain ⟨a_x, ha_x, hx_a⟩ := exists_atom_of_point H x + have hd_le : d z₁ a_x ≤ k + 3 := + (closure_atomZone_props hS hConn hMetric hRearr₁.z_mem x hx₁).2 a_x ha_x hx_a + have hpt_le : pointDist H d σ₁ x ≤ k + 3 := by + rwa [pointDist_eq_of_mem_atom hRearr₁.z_mem ha_x hσ₁_z₁ hx_a] + have hpt_gt := hClosureDist σ₁ (subset_closure hσ₁_Z₁) x hx₂ + omega + have hRigid : IsRigid H''' := by + exact combined_rearrangement_is_rigid (α := α) (β := β) (S := S) (G := G) (H := H) (H' := H') + (H'' := H'') (H''' := H''') (η := η) (η' := η') (η'' := η'') (θ_star := θ_star) (θ := θ) + (lam := lam) (lam₁ := lam₁) (lam₂ := lam₂) (μ := μ) (T_star := T_star) (T := T) (T' := T') + (T'' := T'') (d := d) (d' := d') (d'' := d'') (z₁ := z₁) (z₂ := z₂) hFlat hθ_lt hlam₁ hlam₂ + hlam hRearr₁ hRearr₂ hV_notZ₂ hE_notZ₂ hU_notZ₂ hV_notZ₁ hE_notZ₁ hU_notZ₁ hS hMetric + hMetric' hd_refl τ hτ_z₂ z₃ hz₃ hτ_z₃ hCentersFar σ₁ hσ₁_z₁ hσ₁_Z₁ hZ₁_sub_plus + hZone_disj_Z₂ + have hU'''_ne : H'''.U.Nonempty := by + have hdisj_Z₁p_Z₂ : Disjoint (closure Z₁_plus) (closure Z₂) := hZone_disj_Z₂ (lam₁ + 4) + (by omega) + have hτ_Z₂ : τ ∈ Z₂ := by + obtain ⟨_, hd'_refl, _⟩ := gm11_theorem_9_1 H' (θ - (4 * lam₁ + 2)) T' d' hS hConn hMetric' + exact (mem_atomZone_iff_of_mem_atom hRearr₂.z_mem hτ_z₂).mpr + (by rw [hd'_refl z₂ hRearr₂.z_mem]; omega) + have hσ₁_mem : σ₁ ∈ univ ∩ Z₁_plus := ⟨mem_univ _, hZ₁_sub_plus hσ₁_Z₁⟩ + have hτ_mem : τ ∈ univ \ closure Z₁_plus := + ⟨mem_univ _, fun hcl => Set.disjoint_left.mp hdisj_Z₁p_Z₂ hcl (subset_closure hτ_Z₂)⟩ + obtain ⟨y, _, hy_fr⟩ := + nonempty_inter_frontier_of_isPreconnected isPreconnected_univ hσ₁_mem hτ_mem + obtain ⟨hy_HU, _⟩ := + frontier_atomZone_subset_U (lam₁ + 4) hS hConn hMetric hRearr₁.z_mem y hy_fr + have hy_notZ₂ : y ∉ Z₂ := fun hyZ₂ => + Set.disjoint_left.mp hdisj_Z₁p_Z₂ hy_fr.1 (subset_closure hyZ₂) + exact ⟨y, (hU_notZ₂ y hy_notZ₂).mpr hy_HU⟩ + refine ⟨hRigid, hConn, fun r hr => ?_⟩ + have h_od := open_disc S r hS hConn + ⟨region_nonempty hr, region_isPreconnected hr⟩ (region_isOpen hr) + (fun F hFr hF => by + have hFU_emp : F ∩ H'''.U = ∅ := + eq_empty_iff_forall_notMem.mpr fun x ⟨hxF, hxU⟩ => region_subset hr (hFr hxF) hxU + have hFU : F ∩ H'''.U ⊆ H'''.V := by rw [hFU_emp]; exact empty_subset _ + have hFV_emp : F ∩ H'''.V = ∅ := + eq_empty_of_subset (inter_subset_inter_right F H'''.V_subset_U) hFU_emp + have hFV_card : (F ∩ H'''.V).ncard ≤ 2 := by rw [hFV_emp, Set.ncard_empty]; omega + obtain ⟨Δ, hΔ, hbd_Δ, hDial_cases⟩ := hRigid F hF hFU hFV_card + have hΔ_disj : Disjoint Δ H'''.U := by + rcases hDial_cases with h1 | ⟨u₁, u₂, hu12, hJV_eq, _⟩ + · exact disjoint_left.mpr fun x hxΔ hxU => + (eq_empty_iff_forall_notMem.mp hFU_emp x) ⟨h1 ⟨hxΔ, hxU⟩, hxU⟩ + · exfalso + have h1 : (F ∩ H'''.V).ncard = 0 := by rw [hFV_emp, Set.ncard_empty] + have h2 : (F ∩ H'''.V).ncard = 2 := by rw [hJV_eq, Set.ncard_pair hu12] + omega + obtain ⟨φ⟩ := hF + have hpF : (φ 1).1 ∈ F := (φ 1).2 + have hpΔ : (φ 1).1 ∈ Δ := by + have hp_bd : (φ 1).1 ∈ subBd Δ := hbd_Δ ▸ hpF + exact hΔ.isClosed.closure_subset hp_bd.1 + have hΔ_r : Δ ⊆ r := + subset_region hr hΔ.isPathConnected.isConnected.isPreconnected hΔ_disj hpΔ (hFr hpF) + exact ⟨Δ, hΔ_r, hΔ, (IsClosedDisc.subBd_eq_discBd hS hΔ).symm.trans hbd_Δ⟩) + rcases h_od with ⟨_, hr_univ⟩ | hr_disc + · exfalso + obtain ⟨x, hx⟩ := hU'''_ne + exact region_subset hr (hr_univ ▸ mem_univ x) hx + · exact hr_disc + +/-- For any walk `W : GraphWalk G x y` and any vertex `b ∈ W.support`, `W` splits as `W₁.append W₂` +at `b`. -/ +theorem exists_append_eq_of_mem_support {G : Graph α β} {x y b : α} + (W : GraphWalk G x y) (hb : b ∈ W.support) : + ∃ (W₁ : GraphWalk G x b) (W₂ : GraphWalk G b y), W = W₁.append W₂ := by + induction W with + | @nil u hu => + rw [GraphWalk.support_nil, List.mem_singleton] at hb + subst hb + exact ⟨.nil hu, .nil hu, rfl⟩ + | @cons u v z e hlink r ih => + rw [GraphWalk.support_cons, List.mem_cons] at hb + rcases hb with rfl | hbr + · exact ⟨.nil hlink.left_mem, .cons hlink r, rfl⟩ + · obtain ⟨W₁, W₂, rfl⟩ := ih hbr + exact ⟨.cons hlink W₁, W₂, rfl⟩ + +theorem eq_of_start_mem_right_of_append_isSimple {G : Graph α β} {x c y : α} + (A : GraphWalk G x c) (R : GraphWalk G c y) + (hSim : (A.append R).IsSimple) (hx : x ∈ R.support) : x = c := by + cases A with + | nil _ => rfl + | cons hlink A' => + exfalso + exact (List.nodup_cons.mp hSim).1 ((GraphWalk.mem_support_append A' R).mpr (Or.inr hx)) + +theorem eq_of_end_mem_left_of_append_isSimple {G : Graph α β} {x d y : α} + (L : GraphWalk G x d) (B : GraphWalk G d y) + (hSim : (L.append B).IsSimple) (hy : y ∈ L.support) : y = d := by + induction L with + | nil _ => + rw [GraphWalk.support_nil, List.mem_singleton] at hy + exact hy + | cons _ L' ih => + rw [GraphWalk.support_cons, List.mem_cons] at hy + rcases hy with rfl | hyL' + · exfalso + exact (List.nodup_cons.mp hSim).1 (L'.append B).end_mem_support + · exact ih B (List.nodup_cons.mp hSim).2 hyL' + +theorem append_assoc_walk {G : Graph α β} {x y z w : α} + (A : GraphWalk G x y) (B : GraphWalk G y z) (C : GraphWalk G z w) : + (A.append B).append C = A.append (B.append C) := by + induction A with + | nil _ => rfl + | cons _ _ ih => simp [GraphWalk.append, ih] + +/-- In a simple walk `W : GraphWalk G x y`, for any two vertices `a, b ∈ W.support`, there is a +walk `W' : GraphWalk G a b` in `W` such that neither `x` nor `y` lies in `W'.support` unless it is +`a` or `b`. -/ +theorem exists_subwalk_between_of_isSimple {G : Graph α β} {x y a b : α} + (W : GraphWalk G x y) (hSim : W.IsSimple) (ha : a ∈ W.support) (hb : b ∈ W.support) : + ∃ W' : GraphWalk G a b, + (∀ w ∈ W'.support, w ∈ W.support) ∧ + (x ∈ W'.support → x = a ∨ x = b) ∧ + (y ∈ W'.support → y = a ∨ y = b) := by + obtain ⟨W₁, W₂, rfl⟩ := exists_append_eq_of_mem_support W hb + rcases (GraphWalk.mem_support_append W₁ W₂).mp ha with ha₁ | ha₂ + · obtain ⟨A, W', rfl⟩ := exists_append_eq_of_mem_support W₁ ha₁ + have hEq := append_assoc_walk A W' W₂ + refine ⟨W', fun w hw => (GraphWalk.mem_support_append _ _).mpr + (Or.inl ((GraphWalk.mem_support_append _ _).mpr (Or.inr hw))), + fun hx => Or.inl (eq_of_start_mem_right_of_append_isSimple A (W'.append W₂) (hEq ▸ hSim) + ((GraphWalk.mem_support_append W' W₂).mpr (Or.inl hx))), + fun hy => Or.inr (eq_of_end_mem_left_of_append_isSimple (A.append W') W₂ hSim + ((GraphWalk.mem_support_append A W').mpr (Or.inr hy)))⟩ + · obtain ⟨W', B, rfl⟩ := exists_append_eq_of_mem_support W₂ ha₂ + have hEq := (append_assoc_walk W₁ W' B).symm + refine ⟨W'.reverse, fun w hw => ?_, fun hx => Or.inr ?_, fun hy => Or.inl ?_⟩ + · rw [GraphWalk.support_reverse, List.mem_reverse] at hw + exact (GraphWalk.mem_support_append _ _).mpr + (Or.inr ((GraphWalk.mem_support_append _ _).mpr (Or.inl hw))) + · rw [GraphWalk.support_reverse, List.mem_reverse] at hx + exact eq_of_start_mem_right_of_append_isSimple W₁ (W'.append B) hSim + ((GraphWalk.mem_support_append W' B).mpr (Or.inl hx)) + · rw [GraphWalk.support_reverse, List.mem_reverse] at hy + exact eq_of_end_mem_left_of_append_isSimple (W₁.append W') B (hEq ▸ hSim) + ((GraphWalk.mem_support_append W₁ W').mpr (Or.inr hy)) + +theorem walk_map_le {G H : Graph α β} (hle : H ≤ G) {x y : α} (W : GraphWalk H x y) : + ∃ W' : GraphWalk G x y, W'.support = W.support := by + induction W with + | nil hu => exact ⟨.nil (hle.vertexSet_mono hu), rfl⟩ + | cons hlink r ih => + obtain ⟨r', hr'⟩ := ih + exact ⟨.cons ((hle.isLink_iff hlink.edge_mem).mp hlink) r', by simp [hr']⟩ + +theorem IsLambdaCompression.trans {S : Type w} [TopologicalSpace S] [T2Space S] + {H₀ H₁ H₂ : Drawing S} {θ₀ lam₁ lam₂ : ℕ} + {T₀ T₁ T₂ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d₀ d₁ d₂ : Set S → Set S → ℕ} + (h₁ : IsLambdaCompression H₀ H₁ θ₀ lam₁ T₀ T₁ d₀ d₁) + (h₂ : IsLambdaCompression H₁ H₂ (θ₀ - lam₁) lam₂ T₁ T₂ d₁ d₂) : + IsLambdaCompression H₀ H₂ θ₀ (lam₁ + lam₂) T₀ T₂ d₀ d₂ := by + have hlt := h₂.lam_lt + have hsub : θ₀ - lam₁ - lam₂ = θ₀ - (lam₁ + lam₂) := by omega + refine ⟨by omega, h₁.hasMetric, hsub ▸ h₂.hasMetric', fun σ₁ σ₂ => ?_⟩ + have hle₁ := h₁.dist_le σ₁ σ₂ + have hle₂ := h₂.dist_le σ₁ σ₂ + omega + +theorem pointDist_symm {S : Type w} [TopologicalSpace S] [T2Space S] + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) (hMetric : HasTangleMetric H θ T d) + (x y : S) : + pointDist H d x y = pointDist H d y x := by + obtain ⟨_, _, _, hd_symm, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + obtain ⟨ax, hax, hx⟩ := exists_atom_of_point H x + obtain ⟨ay, hay, hy⟩ := exists_atom_of_point H y + rw [pointDist_eq_of_mem_atom hax hay hx hy, pointDist_eq_of_mem_atom hay hax hy hx, + hd_symm ax hax ay hay] + +theorem IsFlatSpan.not_isMuSteppedSpan_of_le + {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H H' : Drawing S} {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} + {θ_star θ lam lam₁ μ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z : Set S} + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hθ_lt : 4 * lam + 2 < θ) (hle : lam₁ ≤ lam) + (hRearr : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z) : + ¬ IsMuSteppedSpan G H' η' d' μ := by + intro ⟨P, u, v, hu, hv, hP, hdist⟩ + have hS : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + obtain ⟨_, hd_refl, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hRearr.isCompression.hasMetric + obtain ⟨d'', hRearr'', hd''_eq, _⟩ := + hRearr.truncation_of_dist_le hRearr.z_mem hle (by rw [hd_refl z hRearr.z_mem]; omega) hθ_lt + have hdist'' : μ ≤ d'' {u} {v} := by + rw [hd''_eq {u} (Or.inl (Or.inl ⟨u, hu, rfl⟩)) {v} (Or.inl (Or.inl ⟨v, hv, rfl⟩))] + have := hFlat.order_ge + omega + exact hFlat.no_stepped_rearrangement hRearr'' ⟨P, u, v, hu, hv, hP, hdist''⟩ + +theorem isHPathWithEnds_congr_of_disjoint_Z + {S : Type w} [TopologicalSpace S] + {G P : Graph α β} {Γ₁ Γ₂ : Drawing S} + {η₁ : SpanEmbedding Γ₁ G} {η₂ : SpanEmbedding Γ₂ G} + {u v : S} {Z : Set S} + (hu : u ∈ Γ₁.V) (hv : v ∈ Γ₁.V) + (hP : IsHPathWithEnds G η₁.imageGraph P (η₁.vMap u) (η₁.vMap v)) + (hV_notZ : ∀ w, w ∉ Z → (w ∈ Γ₂.V ↔ w ∈ Γ₁.V) ∧ (w ∈ Γ₂.V → η₂.vMap w = η₁.vMap w)) + (hE_notZ : ∀ e, ¬ e ⊆ Z → (e ∈ Γ₂.E ↔ e ∈ Γ₁.E) ∧ (e ∈ Γ₂.E → η₂.eMap e = η₁.eMap e)) + (hE_ends_Z : ∀ e ∈ Γ₂.E, e ⊆ Z → ∃ w ∈ Γ₂.V ∩ closure e, w ∈ Z) + (hDisj₁ : Disjoint V(P) (η₁.vMap '' (Γ₁.V ∩ Z))) + (hDisj₂ : Disjoint V(P) (η₂.vMap '' (Γ₂.V ∩ Z))) : + u ∉ Z ∧ v ∉ Z ∧ u ∈ Γ₂.V ∧ v ∈ Γ₂.V ∧ + IsHPathWithEnds G η₂.imageGraph P (η₂.vMap u) (η₂.vMap v) := by + have hu_notZ : u ∉ Z := fun huZ => + Set.disjoint_left.mp hDisj₁ hP.2.1.left_mem ⟨u, ⟨hu, huZ⟩, rfl⟩ + have hv_notZ : v ∉ Z := fun hvZ => + Set.disjoint_left.mp hDisj₁ hP.2.1.right_mem ⟨v, ⟨hv, hvZ⟩, rfl⟩ + have hu₂ : u ∈ Γ₂.V := (hV_notZ u hu_notZ).1.mpr hu + have hv₂ : v ∈ Γ₂.V := (hV_notZ v hv_notZ).1.mpr hv + have hu_map : η₂.vMap u = η₁.vMap u := (hV_notZ u hu_notZ).2 hu₂ + have hv_map : η₂.vMap v = η₁.vMap v := (hV_notZ v hv_notZ).2 hv₂ + refine ⟨hu_notZ, hv_notZ, hu₂, hv₂, η₂.imageGraph_le, ?_⟩ + rw [hu_map, hv_map] + refine ⟨hP.2.1, hP.2.2.1, hu_map ▸ η₂.bijOn_v.mapsTo hu₂, hv_map ▸ η₂.bijOn_v.mapsTo hv₂, ?_, ?_⟩ + · rw [← hP.2.2.2.2.2.1] + ext x + simp only [mem_inter_iff] + refine ⟨fun ⟨hxP, hx₂⟩ => ⟨hxP, ?_⟩, fun ⟨hxP, hx₁⟩ => ⟨hxP, ?_⟩⟩ + · obtain ⟨w, hw₂, rfl⟩ := η₂.bijOn_v.surjOn hx₂ + have hw_notZ : w ∉ Z := fun hwZ => + Set.disjoint_left.mp hDisj₂ hxP ⟨w, ⟨hw₂, hwZ⟩, rfl⟩ + rw [(hV_notZ w hw_notZ).2 hw₂] + exact η₁.bijOn_v.mapsTo ((hV_notZ w hw_notZ).1.mp hw₂) + · obtain ⟨w, hw₁, rfl⟩ := η₁.bijOn_v.surjOn hx₁ + have hw_notZ : w ∉ Z := fun hwZ => + Set.disjoint_left.mp hDisj₁ hxP ⟨w, ⟨hw₁, hwZ⟩, rfl⟩ + have hw₂ : w ∈ Γ₂.V := (hV_notZ w hw_notZ).1.mpr hw₁ + rw [← (hV_notZ w hw_notZ).2 hw₂] + exact η₂.bijOn_v.mapsTo hw₂ + · refine Set.disjoint_left.mpr fun b hbP hb₂ => ?_ + obtain ⟨e, he₂, rfl⟩ := η₂.bijOn_e.surjOn hb₂ + by_cases heZ : e ⊆ Z + · obtain ⟨w, ⟨hw₂, hwe⟩, hwZ⟩ := hE_ends_Z e he₂ heZ + obtain ⟨z, hlink_im⟩ := (η₂.inc_iff e he₂ w hw₂).mpr hwe + have hlinkG : G.IsLink (η₂.eMap e) (η₂.vMap w) z := + (η₂.imageGraph_le.isLink_iff hlink_im.edge_mem).mp hlink_im + obtain ⟨x, y, hlinkP⟩ := (P.edge_mem_iff_exists_isLink _).mp hbP + have hlinkP_G : G.IsLink (η₂.eMap e) x y := (hP.2.1.le.isLink_iff hbP).mp hlinkP + have hw_VP : η₂.vMap w ∈ V(P) := by + rcases hlinkG.eq_and_eq_or_eq_and_eq hlinkP_G with ⟨hEq, _⟩ | ⟨hEq, _⟩ + · exact hEq ▸ hlinkP.left_mem + · exact hEq ▸ hlinkP.right_mem + exact Set.disjoint_left.mp hDisj₂ hw_VP ⟨w, ⟨hw₂, hwZ⟩, rfl⟩ + · have he₁ : e ∈ Γ₁.E := (hE_notZ e heZ).1.mp he₂ + have he_map : η₂.eMap e = η₁.eMap e := (hE_notZ e heZ).2 he₂ + exact Set.disjoint_left.mp hP.2.2.2.2.2.2 hbP (he_map ▸ η₁.bijOn_e.mapsTo he₁) + +private theorem short_path_meets_first_extended_zone + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {G : Graph α β} + {H : Drawing S} + {H' : Drawing S} + {H'' : Drawing S} + {η : SpanEmbedding H G} + {η' : SpanEmbedding H' G} + {η'' : SpanEmbedding H'' G} + {θ_star : ℕ} + {θ : ℕ} + {lam : ℕ} + {lam₁ : ℕ} + {lam₂ : ℕ} + {μ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {d' : Set S → Set S → ℕ} + {d'' : Set S → Set S → ℕ} + {z₁ : Set S} + {z₂ : Set S} + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hθ_lt : 4 * lam + 2 < θ) + (hlam₁ : 4 ≤ lam₁) + (hlam₂ : 4 ≤ lam₂) + (hlam : 6 * lam₁ + 5 * lam₂ + 3 * μ + 4 ≤ lam) + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' + d' d'' z₂) + (hS : IsClosedSurface S) + [hConn : ConnectedSpace S] + (hMetric : HasTangleMetric H θ T d) + (z₃ : Set S) + (hClaim6 : ∀ σ₁ ∈ atomZone H d z₁ lam₁, ∀ σ₂ ∈ atomZone H' d' z₂ lam₂, lam - 2 * lam₁ - lam₂ < + pointDist H d σ₁ σ₂) + (hDisj_Z : Disjoint (atomZone H d z₁ lam₁) (atomZone H' d' z₂ lam₂)) + (H''' : Drawing S) + (η''' : SpanEmbedding H''' G) + (hnotZ₂_V : ∀ v ∉ atomZone H' d' z₂ lam₂, (v ∈ H'''.V ↔ v ∈ H.V) ∧ η'''.vMap v = η.vMap v) + (hnotZ₂_E : ∀ (e : Set S), ¬e ⊆ atomZone H' d' z₂ lam₂ → (e ∈ H'''.E ↔ e ∈ H.E) ∧ η'''.eMap e + = η.eMap e) + (hnotZ₁_V : ∀ v ∉ atomZone H d z₁ lam₁, (v ∈ H'''.V ↔ v ∈ H''.V) ∧ (v ∈ H'''.V → η'''.vMap v = + η''.vMap v)) + (hnotZ₁_E : ∀ (e : Set S), ¬e ⊆ atomZone H d z₁ lam₁ → (e ∈ H'''.E ↔ e ∈ H''.E) ∧ (e ∈ H'''.E + → η'''.eMap e = η''.eMap e)) + (hH'''_atom_compl_H : ∀ a ∈ H'''.A, a ∉ H.A → a ⊆ atomZone H' d' z₂ lam₂) + (hH'''_atom_compl_H'' : ∀ a ∈ H'''.A, a ∉ H''.A → a ⊆ atomZone H d z₁ lam₁) + (hθ₃_lt : 4 * (lam₂ + 2) + 2 < θ) + (T''' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d''' : Set S → Set S → ℕ) + (hComp''' : IsLambdaCompression H H''' θ (4 * (lam₂ + 2) + 2) T T''' d d''') + (hRearr''' : IsRearrangedWithin G H H''' η η''' θ_star θ (lam₂ + 2) T_star T T''' d d''' z₃) + (hMetric''' : HasTangleMetric H''' (θ - (4 * (lam₂ + 2) + 2)) T''' d''') + (P : Graph α β) + (u : S) + (v : S) + (hu : u ∈ H''.V) + (hv : v ∈ H''.V) + (hP : IsHPathWithEnds G η''.imageGraph P (η''.vMap u) (η''.vMap v)) + (hdist : μ ≤ d'' {u} {v}) + (hS₁_sub_X₁ : (η.vMap '' (H.V ∩ (atomZone H d z₁ lam₁)) ∪ η'.vMap '' (H'.V ∩ (atomZone H d z₁ + lam₁))) ⊆ (η.vMap '' ({s | s ∈ H.V ∧ ∃ σ₁ ∈ (atomZone H d z₁ lam₁), pointDist H d σ₁ s ≤ μ + + 4}) ∪ η'.vMap '' (H'.V ∩ (atomZone H d z₁ lam₁)))) + (hord_ge : 4 * lam + μ + 2 ≤ θ) : + (V(P) ∩ (η.vMap '' ({s | s ∈ H.V ∧ ∃ σ₁ ∈ (atomZone H d z₁ lam₁), pointDist H d σ₁ s ≤ μ + 4}) + ∪ η'.vMap '' (H'.V ∩ (atomZone H d z₁ lam₁)))).Nonempty := by + let Z₁ := atomZone H d z₁ lam₁ + let Z₂ := atomZone H' d' z₂ lam₂ + let lam₃ := lam₂ + 2 + let S₁_v := {s | s ∈ H.V ∧ ∃ σ₁ ∈ Z₁, pointDist H d σ₁ s ≤ μ + 4} + let S₁ := η.vMap '' (H.V ∩ Z₁) ∪ η'.vMap '' (H'.V ∩ Z₁) + let X₁ := η.vMap '' S₁_v ∪ η'.vMap '' (H'.V ∩ Z₁) + by_cases hDisj_S₁ : Disjoint V(P) S₁ + · have hE_ends_Z₁''' : ∀ e ∈ H'''.E, e ⊆ Z₁ → ∃ w ∈ H'''.V ∩ closure e, w ∈ Z₁ := by + intro e he''' heZ₁ + obtain ⟨σ, hσe⟩ := he'''.1 + have he_notZ₂ : ¬ e ⊆ Z₂ := fun heZ₂ => + Set.disjoint_left.mp hDisj_Z (heZ₁ hσe) (heZ₂ hσe) + have heH : e ∈ H.E := (hnotZ₂_E e he_notZ₂).1.mp he''' + obtain ⟨w, hwe, hwVH⟩ := edge_closure_inter_V_nonempty heH + have hle_e : d z₁ e ≤ lam₁ := + (mem_atomZone_iff_of_mem_atom (Or.inl (Or.inr heH)) hσe).mp (heZ₁ hσe) + have hle_w : d z₁ {w} ≤ lam₁ := + dist_vertex_le_of_dist_edge_le hS hConn hMetric hRearr₁.z_mem heH hwVH hwe (by omega) hle_e + have hwZ₁ : w ∈ Z₁ := ⟨{w}, Or.inl (Or.inl ⟨w, hwVH, rfl⟩), hle_w, rfl⟩ + have hw_notZ₂ : w ∉ Z₂ := Set.disjoint_left.mp hDisj_Z hwZ₁ + exact ⟨w, ⟨(hnotZ₂_V w hw_notZ₂).1.mpr hwVH, hwe⟩, hwZ₁⟩ + have hDisj₁'' : Disjoint V(P) (η''.vMap '' (H''.V ∩ Z₁)) := by + refine hDisj_S₁.mono_right (Subset.trans ?_ subset_union_right) + rintro x ⟨w, ⟨hwV'', hwZ₁⟩, rfl⟩ + have hw_notZ₂ : w ∉ Z₂ := Set.disjoint_left.mp hDisj_Z hwZ₁ + rcases hRearr₂.atomZone_dichotomy.2.2.2.1 w hwV'' with hwZ₂ | ⟨_, hwV', _, hmap⟩ + · exact (hw_notZ₂ hwZ₂).elim + · exact ⟨w, ⟨hwV', hwZ₁⟩, hmap.symm⟩ + have hDisj₂''' : Disjoint V(P) (η'''.vMap '' (H'''.V ∩ Z₁)) := by + refine hDisj_S₁.mono_right (Subset.trans ?_ subset_union_left) + rintro x ⟨w, ⟨hwV''', hwZ₁⟩, rfl⟩ + have hw_notZ₂ : w ∉ Z₂ := Set.disjoint_left.mp hDisj_Z hwZ₁ + exact ⟨w, ⟨(hnotZ₂_V w hw_notZ₂).1.mp hwV''', hwZ₁⟩, (hnotZ₂_V w hw_notZ₂).2.symm⟩ + obtain ⟨hu_notZ₁, hv_notZ₁, hu''', hv''', hP'''⟩ := + isHPathWithEnds_congr_of_disjoint_Z hu hv hP hnotZ₁_V hnotZ₁_E hE_ends_Z₁''' hDisj₁'' + hDisj₂''' + have hd'''_lt_μ : pointDist H''' d''' u v < μ := by + rw [pointDist_eq_of_mem_atom (Or.inl (Or.inl ⟨u, hu''', rfl⟩)) (Or.inl (Or.inl ⟨v, hv''', + rfl⟩)) rfl rfl] + by_contra hnot + exact hFlat.not_isMuSteppedSpan_of_le hθ_lt (by omega) hRearr''' + ⟨P, u, v, hu''', hv''', hP''', Nat.le_of_not_lt hnot⟩ + have hd''_ge_μ : μ ≤ pointDist H'' d'' u v := by + rwa [pointDist_eq_of_mem_atom (Or.inl (Or.inl ⟨u, hu, rfl⟩)) (Or.inl (Or.inl ⟨v, hv, + rfl⟩)) rfl rfl] + have hExists_σ₁ : ∃ σ₁ ∈ Z₁, pointDist H''' d''' u σ₁ < μ := by + by_contra hnot + push Not at hnot + have hle'' := pointDist_le_of_common_compression hS hConn + hComp''' (hRearr₁.isCompression.trans hRearr₂.isCompression) + hH'''_atom_compl_H'' + (fun σ₁ hσ₁ => lt_of_lt_of_le hd'''_lt_μ (hnot σ₁ hσ₁)) + (by omega) + omega + obtain ⟨σ₁, hσ₁, hpt'''_uσ₁⟩ := hExists_σ₁ + have hpt'''_σ₁u : pointDist H''' d''' σ₁ u < μ := by + rwa [pointDist_symm hS hConn hMetric''' σ₁ u] + have hle_H : pointDist H d σ₁ u ≤ pointDist H''' d''' σ₁ u := by + refine theorem_4_2_proof H''' H Z₂ (θ - (4 * lam₃ + 2)) θ (4 * lam₃ + 2) T''' T d''' d σ₁ u + hS hConn hMetric''' hMetric + hH'''_atom_compl_H (Or.inr hComp''') + (fun σ₂ hσ₂ => ?_) (by omega) + have hgt := hClaim6 σ₁ hσ₁ σ₂ hσ₂ + have hcomp_le := hComp'''.dist_le σ₁ σ₂ + omega + have hpt_σ₁u : pointDist H d σ₁ u ≤ μ + 4 := by omega + have hu_notZ₂ : u ∉ Z₂ := by + intro huZ₂ + have := hClaim6 σ₁ hσ₁ u huZ₂ + omega + have huH : u ∈ H.V := (hnotZ₂_V u hu_notZ₂).1.mp hu''' + have hu_map : η.vMap u = η''.vMap u := by + rw [← (hnotZ₂_V u hu_notZ₂).2, (hnotZ₁_V u hu_notZ₁).2 hu'''] + exact ⟨η''.vMap u, hP.2.1.left_mem, Or.inl ⟨u, ⟨huH, σ₁, hσ₁, hpt_σ₁u⟩, hu_map⟩⟩ + · obtain ⟨x, hxP, hxS₁⟩ := Set.not_disjoint_iff.mp hDisj_S₁ + exact ⟨x, hxP, hS₁_sub_X₁ hxS₁⟩ + +private theorem short_path_meets_second_extended_zone + {α : Type u} + {β : Type v} + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {G : Graph α β} + {H : Drawing S} + {H' : Drawing S} + {H'' : Drawing S} + {η : SpanEmbedding H G} + {η' : SpanEmbedding H' G} + {η'' : SpanEmbedding H'' G} + {θ_star : ℕ} + {θ : ℕ} + {lam : ℕ} + {lam₁ : ℕ} + {lam₂ : ℕ} + {μ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {d' : Set S → Set S → ℕ} + {d'' : Set S → Set S → ℕ} + {z₁ : Set S} + {z₂ : Set S} + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hθ_lt : 4 * lam + 2 < θ) + (hlam₁ : 4 ≤ lam₁) + (hlam₂ : 4 ≤ lam₂) + (hlam : 6 * lam₁ + 5 * lam₂ + 3 * μ + 4 ≤ lam) + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' + d' d'' z₂) + (hS : IsClosedSurface S) + [hConn : ConnectedSpace S] + (hMetric : HasTangleMetric H θ T d) + (hMetric' : HasTangleMetric H' (θ - (4 * lam₁ + 2)) T' d') + (hMetric'' : HasTangleMetric H'' (θ - (4 * lam₁ + 2) - (4 * lam₂ + 2)) T'' d'') + (τ : S) + (hτ_z₂ : τ ∈ z₂) + (hClaim4 : ∀ σ₁ ∈ atomZone H d z₁ lam₁, lam - 2 * lam₁ < pointDist H d τ σ₁ ∧ lam - 6 * lam₁ - + 2 < pointDist H' d' τ σ₁) + (hClaim6 : ∀ σ₁ ∈ atomZone H d z₁ lam₁, ∀ σ₂ ∈ atomZone H' d' z₂ lam₂, lam - 2 * lam₁ - lam₂ < + pointDist H d σ₁ σ₂) + (hDisj_Z : Disjoint (atomZone H d z₁ lam₁) (atomZone H' d' z₂ lam₂)) + (H''' : Drawing S) + (η''' : SpanEmbedding H''' G) + (hnotZ₂_V : ∀ v ∉ atomZone H' d' z₂ lam₂, (v ∈ H'''.V ↔ v ∈ H.V) ∧ η'''.vMap v = η.vMap v) + (hnotZ₁_V : ∀ v ∉ atomZone H d z₁ lam₁, (v ∈ H'''.V ↔ v ∈ H''.V) ∧ (v ∈ H'''.V → η'''.vMap v = + η''.vMap v)) + (hd'_symm : ∀ a ∈ H'.A, ∀ b ∈ H'.A, d' a b = d' b a) + (hd'_tri : ∀ a ∈ H'.A, ∀ b ∈ H'.A, ∀ c ∈ H'.A, d' a c ≤ d' a b + d' b c) + (P : Graph α β) + (u : S) + (v : S) + (hu : u ∈ H''.V) + (hv : v ∈ H''.V) + (hP : IsHPathWithEnds G η''.imageGraph P (η''.vMap u) (η''.vMap v)) + (hdist : μ ≤ d'' {u} {v}) + (hS₂_sub_X₂ : (η.vMap '' (H.V ∩ (atomZone H' d' z₂ lam₂)) ∪ η''.vMap '' (H''.V ∩ (atomZone H' + d' z₂ lam₂))) ⊆ (η.vMap '' ({s | s ∈ H.V ∧ ∃ σ₂ ∈ (atomZone H' d' z₂ lam₂), pointDist H d σ₂ + s ≤ μ + 4}) ∪ η''.vMap '' (H''.V ∩ (atomZone H' d' z₂ lam₂)))) + (hord_ge : 4 * lam + μ + 2 ≤ θ) : + (V(P) ∩ (η.vMap '' ({s | s ∈ H.V ∧ ∃ σ₂ ∈ (atomZone H' d' z₂ lam₂), pointDist H d σ₂ s ≤ μ + + 4}) ∪ η''.vMap '' (H''.V ∩ (atomZone H' d' z₂ lam₂)))).Nonempty := by + let Z₁ := atomZone H d z₁ lam₁ + let Z₂ := atomZone H' d' z₂ lam₂ + let S₂_v := {s | s ∈ H.V ∧ ∃ σ₂ ∈ Z₂, pointDist H d σ₂ s ≤ μ + 4} + let S₂ := η.vMap '' (H.V ∩ Z₂) ∪ η''.vMap '' (H''.V ∩ Z₂) + let X₂ := η.vMap '' S₂_v ∪ η''.vMap '' (H''.V ∩ Z₂) + by_cases hDisj_S₂ : Disjoint V(P) S₂ + · have hV_notZ₂' : ∀ w, w ∉ Z₂ → (w ∈ H'.V ↔ w ∈ H''.V) ∧ (w ∈ H'.V → η'.vMap w = η''.vMap w) + := by + intro w hw_notZ₂ + constructor + · refine ⟨fun hwH' => ?_, fun hwH'' => ?_⟩ + · rcases hRearr₂.atomZone_dichotomy.2.2.1 w hwH' with ⟨_, hwZ₂⟩ | ⟨_, _, hwH'', _⟩ + · exact (hw_notZ₂ hwZ₂).elim + · exact hwH'' + · rcases hRearr₂.atomZone_dichotomy.2.2.2.1 w hwH'' with hwZ₂ | ⟨_, hwH', _⟩ + · exact (hw_notZ₂ hwZ₂).elim + · exact hwH' + · intro hwH' + rcases hRearr₂.atomZone_dichotomy.2.2.1 w hwH' with ⟨_, hwZ₂⟩ | ⟨_, _, _, hmap⟩ + · exact (hw_notZ₂ hwZ₂).elim + · exact hmap.symm + have hE_notZ₂' : ∀ e, ¬ e ⊆ Z₂ → (e ∈ H'.E ↔ e ∈ H''.E) ∧ (e ∈ H'.E → η'.eMap e = η''.eMap e) + := by + intro e he_notZ₂ + constructor + · refine ⟨fun heH' => ?_, fun heH'' => ?_⟩ + · rcases hRearr₂.atomZone_dichotomy.2.2.2.2.1 e heH' with ⟨_, heZ₂⟩ | ⟨_, _, heH'', _⟩ + · exact (he_notZ₂ heZ₂).elim + · exact heH'' + · rcases hRearr₂.atomZone_dichotomy.2.2.2.2.2 e heH'' with heZ₂ | ⟨_, heH', _⟩ + · exact (he_notZ₂ heZ₂).elim + · exact heH' + · intro heH' + rcases hRearr₂.atomZone_dichotomy.2.2.2.2.1 e heH' with ⟨_, heZ₂⟩ | ⟨_, _, _, hmap⟩ + · exact (he_notZ₂ heZ₂).elim + · exact hmap.symm + have hE_ends_Z₂' : ∀ e ∈ H'.E, e ⊆ Z₂ → ∃ w ∈ H'.V ∩ closure e, w ∈ Z₂ := by + intro e he' heZ₂ + obtain ⟨w, hwe, hwV'⟩ := edge_closure_inter_V_nonempty he' + obtain ⟨σ, hσe⟩ := he'.1 + have hle_e : d' z₂ e ≤ lam₂ := + (mem_atomZone_iff_of_mem_atom (Or.inl (Or.inr he')) hσe).mp (heZ₂ hσe) + have hle_w : d' z₂ {w} ≤ lam₂ := + dist_vertex_le_of_dist_edge_le hS hConn hMetric' hRearr₂.z_mem he' hwV' hwe (by omega) hle_e + exact ⟨w, ⟨hwV', hwe⟩, ⟨{w}, Or.inl (Or.inl ⟨w, hwV', rfl⟩), hle_w, rfl⟩⟩ + have hDisj₁ : Disjoint V(P) (η''.vMap '' (H''.V ∩ Z₂)) := + hDisj_S₂.mono_right subset_union_right + have hDisj₂ : Disjoint V(P) (η'.vMap '' (H'.V ∩ Z₂)) := by + refine hDisj_S₂.mono_right (Subset.trans ?_ subset_union_left) + rintro x ⟨w, ⟨hwV', hwZ₂⟩, rfl⟩ + have hw_notZ₁ : w ∉ Z₁ := Set.disjoint_right.mp hDisj_Z hwZ₂ + rcases hRearr₁.atomZone_dichotomy.2.2.2.1 w hwV' with hwZ₁ | ⟨_, hwVH, _, hmap⟩ + · exact (hw_notZ₁ hwZ₁).elim + · exact ⟨w, ⟨hwVH, hwZ₂⟩, hmap.symm⟩ + obtain ⟨hu_notZ₂, hv_notZ₂, hu', hv', hP'⟩ := + isHPathWithEnds_congr_of_disjoint_Z hu hv hP hV_notZ₂' hE_notZ₂' hE_ends_Z₂' hDisj₁ hDisj₂ + have hd'_lt_μ : pointDist H' d' u v < μ := by + rw [pointDist_eq_of_mem_atom (Or.inl (Or.inl ⟨u, hu', rfl⟩)) (Or.inl (Or.inl ⟨v, hv', + rfl⟩)) rfl rfl] + by_contra hnot + exact hFlat.not_isMuSteppedSpan_of_le hθ_lt (by omega) hRearr₁ + ⟨P, u, v, hu', hv', hP', Nat.le_of_not_lt hnot⟩ + have hd''_ge_μ : μ ≤ pointDist H'' d'' u v := by + rwa [pointDist_eq_of_mem_atom (Or.inl (Or.inl ⟨u, hu, rfl⟩)) (Or.inl (Or.inl ⟨v, hv, + rfl⟩)) rfl rfl] + have hExists_σ₂ : ∃ σ₂ ∈ Z₂, pointDist H' d' u σ₂ < μ := by + by_contra hnot + push Not at hnot + have hle'' := theorem_4_2_proof H' H'' Z₂ (θ - (4 * lam₁ + 2)) + (θ - (4 * lam₁ + 2) - (4 * lam₂ + 2)) (4 * lam₂ + 2) T' T'' d' d'' u v + hS hConn hMetric' hMetric'' + (fun a ha hnotA => (hRearr₂.atomZone_dichotomy.1 a ha).resolve_right (fun h + => hnotA h.2.2) |>.2) + (Or.inl hRearr₂.isCompression) + (fun σ₂ hσ₂ => lt_of_lt_of_le hd'_lt_μ (hnot σ₂ hσ₂)) + (by omega) + omega + obtain ⟨σ₂, hσ₂, hpt'_uσ₂⟩ := hExists_σ₂ + have hpt'_σ₂u : pointDist H' d' σ₂ u < μ := by + rwa [pointDist_symm hS hConn hMetric' σ₂ u] + have hle_H : pointDist H d σ₂ u ≤ pointDist H' d' σ₂ u := by + refine theorem_4_2_proof H' H Z₁ (θ - (4 * lam₁ + 2)) θ (4 * lam₁ + 2) T' T d' d σ₂ u + hS hConn hMetric' hMetric + (fun a' ha' hnotA => (hRearr₁.atomZone_dichotomy.2.1 a' ha').resolve_right fun h + => hnotA h.2.1) + (Or.inr hRearr₁.isCompression) + (fun σ₁ hσ₁ => ?_) (by omega) + have h4 := (hClaim4 σ₁ hσ₁).2 + obtain ⟨a_σ₁, ha_σ₁, hσ₁_a⟩ := exists_atom_of_point H' σ₁ + obtain ⟨a_σ₂, ha_σ₂, hσ₂_a⟩ := exists_atom_of_point H' σ₂ + have hd'_σ₂ : d' z₂ a_σ₂ ≤ lam₂ := (mem_atomZone_iff_of_mem_atom ha_σ₂ hσ₂_a).mp hσ₂ + rw [pointDist_eq_of_mem_atom hRearr₂.z_mem ha_σ₁ hτ_z₂ hσ₁_a] at h4 + rw [pointDist_eq_of_mem_atom ha_σ₂ ha_σ₁ hσ₂_a hσ₁_a] + have hsym := hd'_symm z₂ hRearr₂.z_mem a_σ₁ ha_σ₁ + have htri := hd'_tri a_σ₁ ha_σ₁ a_σ₂ ha_σ₂ z₂ hRearr₂.z_mem + have hsym2 := hd'_symm a_σ₂ ha_σ₂ z₂ hRearr₂.z_mem + have hsym3 := hd'_symm a_σ₁ ha_σ₁ a_σ₂ ha_σ₂ + omega + have hpt_σ₂u : pointDist H d σ₂ u ≤ μ + 4 := by omega + have hu_notZ₁ : u ∉ Z₁ := by + intro huZ₁ + have := hClaim6 u huZ₁ σ₂ hσ₂ + rw [pointDist_symm hS hConn hMetric u σ₂] at this + omega + have huH : u ∈ H.V := (hnotZ₂_V u hu_notZ₂).1.mp ((hnotZ₁_V u hu_notZ₁).1.mpr hu) + have hu_map : η.vMap u = η''.vMap u := by + rw [← (hnotZ₂_V u hu_notZ₂).2, (hnotZ₁_V u hu_notZ₁).2 ((hnotZ₁_V u hu_notZ₁).1.mpr hu)] + exact ⟨η''.vMap u, hP.2.1.left_mem, Or.inl ⟨u, ⟨huH, σ₂, hσ₂, hpt_σ₂u⟩, hu_map⟩⟩ + · obtain ⟨x, hxP, hxS₂⟩ := Set.not_disjoint_iff.mp hDisj_S₂ + exact ⟨x, hxP, hS₂_sub_X₂ hxS₂⟩ + +/-- Core contradiction of `(5.2)` (pages 130–133): if `H', η', T'` is obtained from `H, η, T` by +rearranging within `λ₁` of `z₁`, and `H'', η'', T''` is obtained from `H', η', T'` by rearranging +within `λ₂` of `z₂`, then `H'', η'', T''` is not `μ`-stepped. -/ +theorem not_isMuSteppedSpan_of_rearranged_twice + {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H H' H'' : Drawing S} + {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} {η'' : SpanEmbedding H'' G} + {θ_star θ lam lam₁ lam₂ μ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' d'' : Set S → Set S → ℕ} {z₁ z₂ : Set S} + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hθ_lt : 4 * lam + 2 < θ) + (hlam₁ : 4 ≤ lam₁) (hlam₂ : 4 ≤ lam₂) + (hlam : 6 * lam₁ + 5 * lam₂ + 3 * μ + 4 ≤ lam) + (hRearr₁ : IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁) + (hRearr₂ : IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' d' + d'' z₂) : + ¬ IsMuSteppedSpan G H'' η'' d'' μ := by + intro hStep + let Z₁ := atomZone H d z₁ lam₁ + let Z₂ := atomZone H' d' z₂ lam₂ + have hS : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + have hMetric : HasTangleMetric H θ T d := hRearr₁.isCompression.hasMetric + have hMetric' : HasTangleMetric H' (θ - (4 * lam₁ + 2)) T' d' := hRearr₁.isCompression.hasMetric' + have hMetric'' : HasTangleMetric H'' (θ - (4 * lam₁ + 2) - (4 * lam₂ + 2)) T'' d'' := + hRearr₂.isCompression.hasMetric' + obtain ⟨τ, hτ_z₂⟩ := atom_nonempty hRearr₂.z_mem + obtain ⟨z₃, hz₃, hτ_z₃⟩ := exists_atom_of_point H τ + obtain ⟨hClaim3, hClaim4, hClaim5, hClaim6, hClosureDist, hDisj_cl, hz₂_eq_z₃⟩ := + lemma_5_2_claims_3_to_6 hFlat hθ_lt hlam₁ hlam₂ hlam hRearr₁ hRearr₂ hStep hτ_z₂ hz₃ hτ_z₃ + have hDisj_Z : Disjoint Z₁ Z₂ := hDisj_cl.mono subset_closure subset_closure + obtain ⟨H''', η''', hH'''_V, hH'''_E, hnotZ₂_V, hnotZ₂_E, hnotZ₂_U, + hnotZ₁_V, hnotZ₁_E, hnotZ₁_U, hH_atom_disj_Z₂, hH_atom_compl_Z₂, + hH'''_atom_compl_H, hH'''_atom_compl_H''⟩ := + exists_rearranged_H'''_η''' hFlat hθ_lt hlam₁ hlam₂ hlam hRearr₁ hRearr₂ hStep + obtain ⟨hRigid''', h2Cell'''⟩ := + isRigid_and_isTwoCell_H''' hFlat hθ_lt hlam₁ hlam₂ hlam hRearr₁ hRearr₂ hStep + (fun v hv => (hnotZ₂_V v hv).1) (fun e he => (hnotZ₂_E e he).1) hnotZ₂_U + (fun v hv => (hnotZ₁_V v hv).1) (fun e he => (hnotZ₁_E e he).1) hnotZ₁_U + -- Claims (11) and (12): `H''', η''', T'''` is rearranged from `H, η, T` within `lam₃ = lam₂ + 2` + -- of `z₃` + let lam₃ := lam₂ + 2 + have hnotZ₂_of_gt : ∀ a ∈ H.A, lam₃ < d z₃ a → Disjoint a Z₂ := by + intro a ha hlt + refine Set.disjoint_left.mpr fun σ hσa hσZ₂ => ?_ + have hle := hClaim5 σ hσZ₂ + rw [pointDist_eq_of_mem_atom hz₃ ha hτ_z₃ hσa] at hle + omega + have hAtoms₃ : ∀ a ∈ H.A, lam₃ < d z₃ a → a ∈ H'''.A := + fun a ha hlt => hH_atom_disj_Z₂ a ha (hnotZ₂_of_gt a ha hlt) + have hV₃ : ∀ v ∈ H.V, lam₃ < d z₃ {v} → v ∈ H'''.V ∧ η'''.vMap v = η.vMap v := by + intro v hv hlt + have hv_notZ₂ : v ∉ Z₂ := + Set.disjoint_left.mp (hnotZ₂_of_gt {v} (Or.inl (Or.inl ⟨v, hv, rfl⟩)) hlt) rfl + exact ⟨(hnotZ₂_V v hv_notZ₂).1.mpr hv, (hnotZ₂_V v hv_notZ₂).2⟩ + have hE₃ : ∀ e ∈ H.E, lam₃ < d z₃ e → e ∈ H'''.E ∧ η'''.eMap e = η.eMap e := by + intro e he hlt + obtain ⟨σ, hσe⟩ := he.1 + have he_notZ₂ : ¬ e ⊆ Z₂ := fun hsub => + Set.disjoint_left.mp (hnotZ₂_of_gt e (Or.inl (Or.inr he)) hlt) hσe (hsub hσe) + exact ⟨(hnotZ₂_E e he_notZ₂).1.mpr he, (hnotZ₂_E e he_notZ₂).2⟩ + have hθ₃_lt : 4 * lam₃ + 2 < θ := by omega + obtain ⟨_, _, T''', _, d''', _, hComp''', _, _⟩ := + theorem_4_5_proof H H''' θ lam₃ T d z₃ hS hConn hMetric hz₃ (by omega) hθ₃_lt + h2Cell''' hAtoms₃ + have hRearr''' : IsRearrangedWithin G H H''' η η''' θ_star θ lam₃ T_star T T''' d d''' z₃ := + theorem_4_6_proof G H H''' η η''' θ_star θ lam₃ T_star T T''' d d''' z₃ + hFlat.isSpan hMetric hz₃ (by omega) hθ₃_lt hRigid''' h2Cell''' hAtoms₃ hV₃ hE₃ hComp''' + have hMetric''' : HasTangleMetric H''' (θ - (4 * lam₃ + 2)) T''' d''' := hComp'''.hasMetric' + -- Unpack the `μ`-stepped path `P` of `H'', η''` + obtain ⟨_, hd_refl, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + obtain ⟨_, _, _, hd'_symm, hd'_tri, _⟩ := + gm11_theorem_9_1 H' (θ - (4 * lam₁ + 2)) T' d' hS hConn hMetric' + obtain ⟨P, u, v, hu, hv, hP, hdist⟩ := hStep + let S₁_v : Set S := {s ∈ H.V | ∃ σ₁ ∈ Z₁, pointDist H d σ₁ s ≤ μ + 4} + let S₂_v : Set S := {s ∈ H.V | ∃ σ₂ ∈ Z₂, pointDist H d σ₂ s ≤ μ + 4} + let S₁ : Set α := (η.vMap '' (H.V ∩ Z₁)) ∪ (η'.vMap '' (H'.V ∩ Z₁)) + let S₂ : Set α := (η.vMap '' (H.V ∩ Z₂)) ∪ (η''.vMap '' (H''.V ∩ Z₂)) + let X₁ : Set α := (η.vMap '' S₁_v) ∪ (η'.vMap '' (H'.V ∩ Z₁)) + let X₂ : Set α := (η.vMap '' S₂_v) ∪ (η''.vMap '' (H''.V ∩ Z₂)) + have hS₁_sub_X₁ : S₁ ⊆ X₁ := by + rintro x (⟨w, ⟨hwH, hwZ₁⟩, rfl⟩ | hx) + · refine Or.inl ⟨w, ⟨hwH, w, hwZ₁, ?_⟩, rfl⟩ + rw [pointDist_eq_of_mem_atom (Or.inl (Or.inl ⟨w, hwH, rfl⟩)) (Or.inl (Or.inl ⟨w, hwH, + rfl⟩)) rfl rfl, + hd_refl {w} (Or.inl (Or.inl ⟨w, hwH, rfl⟩))] + exact Nat.zero_le _ + · exact Or.inr hx + have hS₂_sub_X₂ : S₂ ⊆ X₂ := by + rintro x (⟨w, ⟨hwH, hwZ₂⟩, rfl⟩ | hx) + · refine Or.inl ⟨w, ⟨hwH, w, hwZ₂, ?_⟩, rfl⟩ + rw [pointDist_eq_of_mem_atom (Or.inl (Or.inl ⟨w, hwH, rfl⟩)) (Or.inl (Or.inl ⟨w, hwH, + rfl⟩)) rfl rfl, + hd_refl {w} (Or.inl (Or.inl ⟨w, hwH, rfl⟩))] + exact Nat.zero_le _ + · exact Or.inr hx + have hord_ge := hFlat.order_ge + -- Claim (13): `(V(P) ∩ X₂).Nonempty` + have hMeet_X₂ : (V(P) ∩ X₂).Nonempty := by + exact short_path_meets_second_extended_zone (α := α) (β := β) (S := S) (G := G) (H := H) (H' + := H') (H'' := H'') (η := η) (η' := η') (η'' := η'') (θ_star := θ_star) (θ := θ) (lam := + lam) (lam₁ := lam₁) (lam₂ := lam₂) (μ := μ) (T_star := T_star) (T := T) (T' := T') (T'' := + T'') (d := d) (d' := d') (d'' := d'') (z₁ := z₁) (z₂ := z₂) hFlat hθ_lt hlam₁ hlam₂ hlam + hRearr₁ hRearr₂ hS hMetric hMetric' hMetric'' τ hτ_z₂ hClaim4 hClaim6 hDisj_Z H''' η''' + hnotZ₂_V hnotZ₁_V hd'_symm hd'_tri P u v hu hv hP hdist hS₂_sub_X₂ hord_ge + -- Claim (14): `(V(P) ∩ X₁).Nonempty` + have hMeet_X₁ : (V(P) ∩ X₁).Nonempty := by + exact short_path_meets_first_extended_zone (α := α) (β := β) (S := S) (G := G) (H := H) (H' := + H') (H'' := H'') (η := η) (η' := η') (η'' := η'') (θ_star := θ_star) (θ := θ) (lam := lam) + (lam₁ := lam₁) (lam₂ := lam₂) (μ := μ) (T_star := T_star) (T := T) (T' := T') (T'' := T'') + (d := d) (d' := d') (d'' := d'') (z₁ := z₁) (z₂ := z₂) hFlat hθ_lt hlam₁ hlam₂ hlam hRearr₁ + hRearr₂ hS hMetric z₃ hClaim6 hDisj_Z H''' η''' hnotZ₂_V hnotZ₂_E hnotZ₁_V hnotZ₁_E + hH'''_atom_compl_H hH'''_atom_compl_H'' hθ₃_lt T''' d''' hComp''' hRearr''' hMetric''' P u v + hu hv hP hdist hS₁_sub_X₁ hord_ge + -- Contradiction with Claim (10) (`no_walk_between_X₁_X₂`) + obtain ⟨a₁, ha₁P, ha₁X₁⟩ := hMeet_X₁ + obtain ⟨a₂, ha₂P, ha₂X₂⟩ := hMeet_X₂ + obtain ⟨hPG, W₀, hW₀_sim, hVP, _⟩ := id hP.2.1 + have ha₁W₀ : a₁ ∈ W₀.support := by rwa [hVP] at ha₁P + have ha₂W₀ : a₂ ∈ W₀.support := by rwa [hVP] at ha₂P + obtain ⟨W_P, hWP_sub, hu_WP, hv_WP⟩ := + exists_subwalk_between_of_isSimple W₀ hW₀_sim ha₁W₀ ha₂W₀ + obtain ⟨W_G, hWG_sup⟩ := walk_map_le hPG W_P + refine no_walk_between_X₁_X₂ hFlat hθ_lt hlam₁ hlam₂ hlam hRearr₁ hRearr₂ + ⟨P, u, v, hu, hv, hP, hdist⟩ W_G ha₁X₁ ha₂X₂ fun w hw hw_im => ?_ + rw [hWG_sup] at hw + obtain ⟨s, hsH, rfl⟩ := η.bijOn_v.surjOn hw_im + by_cases hsZ₁ : s ∈ Z₁ + · exact Or.inl (hS₁_sub_X₁ (Or.inl ⟨s, ⟨hsH, hsZ₁⟩, rfl⟩)) + · by_cases hsZ₂ : s ∈ Z₂ + · exact Or.inr (hS₂_sub_X₂ (Or.inl ⟨s, ⟨hsH, hsZ₂⟩, rfl⟩)) + · have hs''' : s ∈ H'''.V := (hnotZ₂_V s hsZ₂).1.mpr hsH + have hs'' : s ∈ H''.V := (hnotZ₁_V s hsZ₁).1.mp hs''' + have hmap_eq : η.vMap s = η''.vMap s := by + rw [← (hnotZ₂_V s hsZ₂).2, (hnotZ₁_V s hsZ₁).2 hs'''] + have hwP : η.vMap s ∈ V(P) := by + rw [hVP] + exact hWP_sub (η.vMap s) hw + have hw_ends : η.vMap s ∈ ({η''.vMap u, η''.vMap v} : Set α) := + hP.2.2.2.2.2.1 ▸ ⟨hwP, hmap_eq ▸ η''.bijOn_v.mapsTo hs''⟩ + rcases hw_ends with hEq | hEq + · rcases hu_WP (hEq ▸ hw) with h1 | h2 + · exact Or.inl (hEq.trans h1 ▸ ha₁X₁) + · exact Or.inr (hEq.trans h2 ▸ ha₂X₂) + · rcases hv_WP (hEq ▸ hw) with h1 | h2 + · exact Or.inl (hEq.trans h1 ▸ ha₁X₁) + · exact Or.inr (hEq.trans h2 ▸ ha₂X₂) + +/-- Statement of Graph Minors XV, (5.2) (page 129): +"Let $\mathscr{T}^*$ be a tangle in a graph $G$, let $\Sigma$ be a surface, and let $H, \eta, +\mathscr{T}$ be a $(\lambda, \mu)$-flat $\Sigma$-span of order $\theta$. Let $\lambda_1, +\lambda_2 \ge 4$ and $\mu \ge 0$ be integers such that $\lambda \ge 6\lambda_1 + 5\lambda_2 ++ 3\mu + 4$. Let $z_1 \in A(H)$, and let $H', \eta', \mathscr{T}'$ be a $\Sigma$-span +obtained from $H, \eta, \mathscr{T}$ by rearranging within $\lambda_1$ of $z_1$. Then $H', +\eta', \mathscr{T}'$ is $(\lambda_2, \mu)$-flat." +The Lean form requires `4 * lam + 2 < θ` when `μ = 0`, excluding the degenerate equality +`θ = 4 * lam + 2`. For `μ ≥ 1` the strict inequality follows from flatness. See the correction to +(5.2) in `corrections/GM15.md`. -/ +def GM15Theorem52Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H H' : Drawing S) (η : SpanEmbedding H G) (η' : SpanEmbedding H' G) + (θ_star θ lam lam₁ lam₂ μ : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d d' : Set S → Set S → ℕ) (z₁ : Set S), + IsFlatSpan G H η θ_star θ lam μ T_star T → + (μ = 0 → 4 * lam + 2 < θ) → + 4 ≤ lam₁ → 4 ≤ lam₂ → 6 * lam₁ + 5 * lam₂ + 3 * μ + 4 ≤ lam → + IsRearrangedWithin G H H' η η' θ_star θ lam₁ T_star T T' d d' z₁ → + IsFlatSpan G H' η' θ_star (θ - (4 * lam₁ + 2)) lam₂ μ T_star T' + +/-- Corrected Graph Minors XV (5.2) (page 129). For `μ = 0` it requires `θ > 4 * lam + 2`. +If `H, η, T` is a `(λ, μ)`-flat `Σ`-span of order `θ`, `λ₁, λ₂ ≥ 4`, +`λ ≥ 6λ₁ + 5λ₂ + 3μ + 4`, and `H', η', T'` is obtained from `H, η, T` by rearranging within `λ₁` +of `z₁ ∈ A(H)`, then `H', η', T'` is `(λ₂, μ)`-flat. +Proved from `(4.1)`, `(4.2)`, `(4.5)`, `(4.6)`, and Graph Minors XII, `(7.7)`, `(7.10)`, `(7.11)`. +-/ +theorem theorem_5_2_proof + : + GM15Theorem52Statement.{u, v, w} := by + intro S _ _ α β G H H' η η' θ_star θ lam lam₁ lam₂ μ T_star T T' d d' z₁ + hFlat hθ_gt hlam₁ hlam₂ hlam hRearr₁ + have hord := hFlat.order_ge + have hθ_lt : 4 * lam + 2 < θ := by + by_cases hμ0 : μ = 0 + · exact hθ_gt hμ0 + · omega + refine ⟨hRearr₁.isSpan', by omega, ?_⟩ + intro H'' η'' T'' d'_any d'' z₂ hRearr₂ + have hS : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + obtain ⟨hd'_eq_A, hd'_eq_pt, _⟩ := + tangleMetric_eq_of_hasTangleMetric hS hConn + hRearr₁.isCompression.hasMetric' hRearr₂.isCompression.hasMetric + have hRearr₂' : + IsRearrangedWithin G H' H'' η' η'' θ_star (θ - (4 * lam₁ + 2)) lam₂ T_star T' T'' d' d'' z₂ + := by + refine ⟨hRearr₂.z_mem, hRearr₂.isSpan, hRearr₂.isSpan', + fun a ha hlt => hRearr₂.atom_mem a ha (hd'_eq_A z₂ hRearr₂.z_mem a ha ▸ hlt), + fun v hv hlt => hRearr₂.vMap_eq v hv + (hd'_eq_A z₂ hRearr₂.z_mem {v} (Or.inl (Or.inl ⟨v, hv, rfl⟩)) ▸ hlt), + fun e he hlt => hRearr₂.eMap_eq e he + (hd'_eq_A z₂ hRearr₂.z_mem e (Or.inl (Or.inr he)) ▸ hlt), + ⟨hRearr₂.isCompression.lam_lt, hRearr₁.isCompression.hasMetric', + hRearr₂.isCompression.hasMetric', fun σ₁ σ₂ => ?_⟩⟩ + rw [hd'_eq_pt σ₁ σ₂] + exact hRearr₂.isCompression.dist_le σ₁ σ₂ + exact not_isMuSteppedSpan_of_rearranged_twice hFlat hθ_lt hlam₁ hlam₂ hlam + hRearr₁ hRearr₂' + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/Section6.lean b/LeanPool/GraphMinor/GM15/Section6.lean new file mode 100644 index 0000000000..9ea3b8a149 --- /dev/null +++ b/LeanPool/GraphMinor/GM15/Section6.lean @@ -0,0 +1,167 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM15.Cited + +import LeanPool.GraphMinor.GM09.Bridge + +/-! +# Graph Minors XV, Section 6: Crooked Transactions + +This file formalizes Section 6 ("Crooked transactions", pages 133–134) of N. Robertson and P. D. +Seymour, *Graph Minors. XV. Giant steps*, J. Combin. Theory Ser. B 68 (1996) 112–148: +- **Graph Minors XV, (6.1)** (`GM15Theorem61Statement`, `theorem_6_1`, page 134): if `(G, Ω)` has no + crooked transaction of cardinality `π` (`π ≥ 2`, `π ≠ 3`), there is a segregation `S_seg` of `G` + of type `(3π + 9, 1)` with `ΩBar ⊆ V(S_seg)` and a disc arrangement of it in a closed disc `Δ` + with + `Ω = α⁻¹(bd(Δ))`. Proved from Graph Minors IX, (11.11) (`GM09Theorem1111Statement`). +- **Corrected Graph Minors XV, (6.2)** (page 134, `GM15Theorem62Statement`). The first threshold + term is `2 * τ₁`, correcting the printed subscript `i`. Every crooked transaction of + cardinality `≥ (φ - 1)(2τ₁ + τ₂ - 7)` contains a crosscap transaction of size `φ`, + a leap transaction of size `τ₁`, or a doublecross transaction of size `τ₂`. Proved from Graph + Minors IX, (7.1) (`GM09Theorem71Statement`). +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +open Set Function Topology +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM14 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- Statement of Graph Minors XV, (6.1) (page 134): +"Let $\pi \ge 2$ be an integer, with $\pi \ne 3$, and let $(G, \Omega)$ be a society with no +crooked transaction of cardinality $\pi$. Then there is a segregation $\mathcal{S}$ of $G$ +of type $(3\pi + 9, 1)$ with $\bar{\Omega} \subseteq V(\mathcal{S})$, and an arrangement +$\alpha$ of $\mathcal{S}$ in a closed disc $\Delta$, such that $\Omega = +\alpha^{-1}(bd(\Delta))$." -/ +def GM15Theorem61Statement : Prop := + ∀ {α : Type u} {β : Type v} (S : Society α β) (π : ℕ), + 2 ≤ π → π ≠ 3 → + (∀ P_set : Set (Graph α β), S.IsCrookedTransaction P_set → P_set.ncard ≠ π) → + ∃ (S_seg : Set (Society α β)) (k : ℕ) (A₀ : Society α β) (A : Fin k → Society α β) + (Δ α₀ : Set EuclideanPlane) (α_disc : Fin k → Set EuclideanPlane) + (α_pt : α → EuclideanPlane), + S_seg = insert A₀ (range A) ∧ + IsSegregationOfType S.G (3 * π + 9) 1 S_seg ∧ + S.Ω.bar ⊆ segregationVertices S_seg ∧ + IsDiscArrangement S A₀ A Δ α₀ α_disc α_pt + +/-- **Graph Minors XV, (6.1)** (page 134): +Every society `(G, Ω)` with no crooked transaction of cardinality `π` (`π ≥ 2`, `π ≠ 3`) admits a +segregation `S_seg` of `G` of type `(3π + 9, 1)` with `ΩBar ⊆ V(S_seg)` and an arrangement in a +closed +disc `Δ` with `Ω = α⁻¹(bd(Δ))`. +Proved from Graph Minors IX, (11.11) (`GM09Theorem1111Statement`). -/ +theorem theorem_6_1_proof : + GM15Theorem61Statement.{u, v} := by + intro α β S π hπ2 hπ3 hno_crooked + obtain ⟨k, A₀, A, ⟨hSocSeg, Δ, α₀, α_disc, α_pt, hDiscArr⟩, hA_le3, hA0_vortex⟩ := + GraphMinor.GM09.gm15_theorem_11_11.{u, v} S π hπ2 hπ3 hno_crooked + let S_seg : Set (Society α β) := insert A₀ (range A) + have hGraphSeg : IsGraphSegregation S.G S_seg := by + refine ⟨(finite_range A).insert A₀, ?_, ?_, ?_, ?_⟩ + · rintro S₀ (rfl | ⟨i, rfl⟩) + · exact hSocSeg.le_zero + · exact hSocSeg.le_succ i + · have hV_eq : ⋃ H ∈ (fun S₀ : Society α β => S₀.G) '' S_seg, V(H) = V(S.G) := by + rw [← hSocSeg.vertexSet_union] + ext v + simp only [S_seg, mem_iUnion, mem_image, mem_insert_iff, mem_range, mem_union] + constructor + · rintro ⟨H, ⟨S₀, rfl | ⟨i, rfl⟩, rfl⟩, hv⟩ + · exact Or.inl hv + · exact Or.inr ⟨i, hv⟩ + · rintro (hv | ⟨i, hv⟩) + · exact ⟨A₀.G, ⟨A₀, Or.inl rfl, rfl⟩, hv⟩ + · exact ⟨(A i).G, ⟨A i, Or.inr ⟨i, rfl⟩, rfl⟩, hv⟩ + have hE_eq : ⋃ H ∈ (fun S₀ : Society α β => S₀.G) '' S_seg, E(H) = E(S.G) := by + rw [← hSocSeg.edgeSet_union] + ext e + simp only [S_seg, mem_iUnion, mem_image, mem_insert_iff, mem_range, mem_union] + constructor + · rintro ⟨H, ⟨S₀, rfl | ⟨i, rfl⟩, rfl⟩, he⟩ + · exact Or.inl he + · exact Or.inr ⟨i, he⟩ + · rintro (he | ⟨i, he⟩) + · exact ⟨A₀.G, ⟨A₀, Or.inl rfl, rfl⟩, he⟩ + · exact ⟨(A i).G, ⟨A i, Or.inr ⟨i, rfl⟩, rfl⟩, he⟩ + have hU_le : subgraphSUnion S.G ((fun S₀ : Society α β => S₀.G) '' S_seg) ≤ S.G := + restrict_le.trans (S.G.induce_le (by rw [hV_eq])) + refine (Compatible.of_le_le hU_le le_rfl).ext ?_ ?_ + · simpa [subgraphSUnion] using hV_eq + · ext e + simp only [subgraphSUnion, edgeSet_restrict, mem_inter_iff, Graph.edgeSet_induce, hV_eq, + hE_eq] + refine ⟨fun h => h.2, fun he => ⟨?_, he⟩⟩ + obtain ⟨x, y, hlink⟩ := exists_isLink_of_mem_edgeSet he + exact ⟨x, y, hlink, hlink.left_mem, hlink.right_mem⟩ + · rintro S₁ (rfl | ⟨i, rfl⟩) S₂ (rfl | ⟨j, rfl⟩) hne + · exact (hne rfl).elim + · exact hSocSeg.inter_zero_subset j + · intro v ⟨hv1, hv2⟩ + have h := hSocSeg.inter_zero_subset i ⟨hv2, hv1⟩ + exact ⟨h.2, h.1⟩ + · have hij : i ≠ j := fun h => hne (congrArg A h) + exact hSocSeg.inter_succ_subset i j hij + · rintro S₁ (rfl | ⟨i, rfl⟩) S₂ (rfl | ⟨j, rfl⟩) hne + · exact (hne rfl).elim + · exact hSocSeg.disjoint_zero j + · exact (hSocSeg.disjoint_zero i).symm + · have hij : i ≠ j := fun h => hne (congrArg A h) + exact hSocSeg.disjoint_succ hij + have hType : IsSegregationOfType S.G (3 * π + 9) 1 S_seg := by + refine ⟨hGraphSeg, ?_, ?_⟩ + · have hsub : {S₀ ∈ S_seg | 3 < S₀.Ω.bar.ncard} ⊆ {A₀} := by + rintro S₀ ⟨rfl | ⟨i, rfl⟩, hgt⟩ + · exact mem_singleton S₀ + · exact (not_lt_of_ge (hA_le3 i) hgt).elim + calc + {S₀ ∈ S_seg | 3 < S₀.Ω.bar.ncard}.ncard ≤ ({A₀} : Set (Society α β)).ncard := + ncard_le_ncard hsub (finite_singleton A₀) + _ = 1 := ncard_singleton A₀ + · rintro S₀ (rfl | ⟨i, rfl⟩) hgt + · intro P_set hP + exact hA0_vortex P_set hP + · exact (not_lt_of_ge (hA_le3 i) hgt).elim + have hBar : S.Ω.bar ⊆ segregationVertices S_seg := by + intro v hv + rcases hSocSeg.bar_subset_union hv with hv0 | hvi + · exact mem_biUnion (mem_insert A₀ _) hv0 + · rcases mem_iUnion.mp hvi with ⟨i, hvi⟩ + exact mem_biUnion (mem_insert_of_mem A₀ ⟨i, rfl⟩) hvi + exact ⟨S_seg, k, A₀, A, Δ, α₀, α_disc, α_pt, rfl, hType, hBar, hDiscArr⟩ + +/-- Corrected Graph Minors XV, (6.2) (page 134). The threshold uses $2\tau_1$ from IX (7.1) in +place of the printed $2\tau_i$. The corrected statement is: +"Let $\phi \ge 2$, $\tau_1 \ge 3$, $\tau_2 \ge 4$ be integers. Let $\mathcal{P}$ be a crooked +transaction in a society $(G, \Omega)$ such that $|\mathcal{P}| \ge (\phi - 1)(2\tau_1 + +\tau_2 - 7)$. Then there exists $\mathcal{P}' \subseteq \mathcal{P}$ such that either* (i) +*$|\mathcal{P}'| = \phi$ and $\mathcal{P}'$ is a crosscap transaction, or* (ii) +*$|\mathcal{P}'| = \tau_1$ and $\mathcal{P}'$ is a leap transaction, or* (iii) +*$|\mathcal{P}'| = \tau_2$ and $\mathcal{P}'$ is a doublecross transaction." -/ +def GM15Theorem62Statement : Prop := + GM09Theorem71Statement.{u, v} + +/-- Corrected Graph Minors XV, (6.2) (page 134), with $2\tau_1$ in the threshold. +Every crooked transaction of cardinality `≥ (φ - 1)(2τ₁ + τ₂ - 7)` contains a crosscap transaction +of cardinality `φ`, a leap transaction of cardinality `τ₁`, or a doublecross transaction of +cardinality `τ₂`. +Proved from Graph Minors IX, (7.1) (`GM09Theorem71Statement`). -/ +theorem theorem_6_2_proof : + GM15Theorem62Statement.{u, v} := + GraphMinor.GM09.gm15_theorem_7_1.{u, v} + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/Section7.lean b/LeanPool/GraphMinor/GM15/Section7.lean new file mode 100644 index 0000000000..c20369c889 --- /dev/null +++ b/LeanPool/GraphMinor/GM15/Section7.lean @@ -0,0 +1,4902 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.EyeInductionParameters +public import LeanPool.GraphMinor.GM16.ProperArrangementFacts + +public import LeanPool.GraphMinor.GM15.Section2 +public import LeanPool.GraphMinor.GM15.Section3 +public import LeanPool.GraphMinor.GM15.Section4 +public import LeanPool.GraphMinor.GM15.Section5 +public import LeanPool.GraphMinor.GM15.Section6 +import LeanPool.GraphMinor.GM15.Section3Parallel +import LeanPool.GraphMinor.GM15.Section3Given +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section4b +import LeanPool.GraphMinor.GM10.Section12 +import LeanPool.GraphMinor.GM11.OArcCircuit +import LeanPool.GraphMinor.GM11.Section81 +public import LeanPool.GraphMinor.GM14.BridgeFacts +import LeanPool.GraphMinor.GM14.Section7b +import LeanPool.GraphMinor.GM14.DiscBoundaryHomeomorphism +import LeanPool.GraphMinor.Surface.CircleMove + +import LeanPool.GraphMinor.GM09.Bridge + +import LeanPool.GraphMinor.GM12.Section4SpanSeparation +import LeanPool.GraphMinor.GM12.Section5Final + +import LeanPool.GraphMinor.GM12.Section6 + +import LeanPool.GraphMinor.GM12.Section710 + +import LeanPool.GraphMinor.GM12.Section77 + +import LeanPool.GraphMinor.GM14.Bridge + +import LeanPool.GraphMinor.GM15.Section3Crosscap +import LeanPool.GraphMinor.GM14.DiscArrangement + +/-! +# Graph Minors XV, Section 7: The Main Proof + +This file formalizes Section 7 ("The main proof", pages 134–145) of N. Robertson and P. D. Seymour, +*Graph Minors. XV. Giant steps*, J. Combin. Theory Ser. B 68 (1996) 112–148, and proves the main +inductive step **Graph Minors XV, (1.2)** (`GM15Theorem12Statement`, `theorem_1_2`, page 115): +- **Outcomes `(S1)`, `(S2)`, `(S3)`** (`Section7S1`, `Section7S2`, `Section7S3`, page 135). +- **Graph Minors XV, (7.1)** (`GM15Theorem71Statement`, page 135): truncating a `(λ, μ)`-flat + `Σ`-span of order `≥ θ` with `k` eyes at distance `≥ θ` to order `θ`. +- **Graph Minors XV, (7.2)** (`GM15Theorem72Statement`, page 135): disjointness of the atom + zones `Z_i` and bridge unions `J_i`. +- **Graph Minors XV, (7.3)** (`GM15Theorem73Statement`, page 136): if clearing a `(3μ + 3)`-zone + `Λ` yields a rigid drawing for which `Λ` is an eye in `G₀`, then `(S1)` holds. +- **Graph Minors XV, (7.4)** (`GM15Theorem74Statement`, `theorem_7_4`, page 137): if `(S1)` does not + hold, `G₀` has a `T`-local 3-segregation `S₀` with an arrangement in `Σ` compatible with `H` + (proved from `(7.3)` and Graph Minors XIV, `(10.1)`). +- **Graph Minors XV, (7.5)** (`GM15Theorem75Statement`, page 138): existence of `(3β + 3)`-zones + `Λ_i` and `α₀`-normal closed discs `Δ_i` around the `k` eyes. +- **Graph Minors XV, (7.6)** (`GM15Theorem76Statement`, page 139): mutual disjointness of + `G_1*, ..., G_k*`. +- **Graph Minors XV, (7.7)** (`GM15Theorem77Statement`, page 139): if no `(G_i*, Ω_i*)` has a + crooked transaction of cardinality `π`, then `(S3)` holds. +- **Graph Minors XV, (7.8)** (`GM15Theorem78Statement`, `theorem_7_8`, page 142): if some + `(G_i*, Ω_i*)` has a crooked transaction of cardinality `π`, then `(G₀ ∪ J_i, Ω_i)` has a + transaction `P` with free ends in `T₁` that is a crosscap transaction of size `φ`, a leap + transaction of size `τ₁`, or a doublecross transaction of size `τ₂` (proved from `(7.5)`, `(6.2)`, + and Graph Minors X, `(12.2)`). +- **Graph Minors XV, (7.9)** (`GM15Theorem79Statement`, page 143): if `P` is a crosscap transaction + of cardinality `φ`, then `(S2)` holds. +- **Graph Minors XV, (7.10)** (`GM15Theorem710Statement`, page 143): `P` is not a leap transaction + of cardinality `τ₁`. +- **Graph Minors XV, (7.11)** (`GM15Theorem711Statement`, page 143): if `P` is a doublecross + transaction of cardinality `τ₂`, then `(S1)` holds. +- **Graph Minors XV, (1.2)** (`GM15Theorem12Statement`, `theorem_1_2`, page 115): main inductive + step of Graph Minors XV. +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +open Set Function Topology +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM14 + +export _root_.GraphMinor.GM14 + (exists_isHPathWithEnds_of_component_attachments exists_isHPathWithEnds_of_isBridge) + +universe u v w + +variable {α : Type u} {β : Type v} + +/-! ## Section 7 Constructions and Outcomes `(S1)`, `(S2)`, `(S3)` -/ + +/-- Outcome `(S1)` of Graph Minors XV, Section 7 (page 135): +"There is a $(\lambda', \mu)$-flat $\Sigma$-span of order $\theta'$ with $k + 1$ eyes, +mutually at distance $\theta'$." -/ +def Section7S1 (S : Type w) [TopologicalSpace S] [T2Space S] + (G : Graph α β) (θ_star : ℕ) (T_star : Set (Hypergraph α β × Hypergraph α β)) + (k μ lam' θ' : ℕ) : Prop := + ∃ (H' : Drawing S) (η' : SpanEmbedding H' G) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (r : Fin (k + 1) → Set S), + IsFlatSpan G H' η' θ_star θ' lam' μ T_star T' ∧ + HasTangleMetric H' θ' T' d' ∧ + Injective r ∧ + (∀ i : Fin (k + 1), IsDrawingEye G H' η' θ' T' (r i)) ∧ + (∀ i j : Fin (k + 1), i ≠ j → d' (r i) (r j) = θ') + +/-- Outcome `(S2)` of Graph Minors XV, Section 7 (page 135): +"There is a $\Sigma'$-span of order $\phi$, where $\Sigma'$ is a surface obtained by adding a +crosscap to $\Sigma$." -/ +def Section7S2 (S : Type w) [TopologicalSpace S] + (G : Graph α β) (θ_star : ℕ) (T_star : Set (Hypergraph α β × Hypergraph α β)) + (φ : ℕ) : Prop := + ∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S'), + IsObtainedByAddingCrosscap S S' ∧ + ∃ (H' : Drawing S') (η' : SpanEmbedding H' G) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsSigmaSpan G H' η' θ_star φ T_star T' + +/-- Outcome `(S3)` of Graph Minors XV, Section 7 (page 135): +"There is a $\mathcal{T}^*$-central segregation of $G$ of type $(\rho, k)$ with an arrangement +in $\Sigma$." -/ +def Section7S3 (S : Type w) [TopologicalSpace S] + (G : Graph α β) (T_star : Set (Hypergraph α β × Hypergraph α β)) + (p k : ℕ) : Prop := + ∃ (S_seg : Set (Society α β)) (α_disc : Society α β → Set S) (α_pt : α → S), + IsCentralSegregation G T_star S_seg ∧ + IsSegregationOfType G p k S_seg ∧ + IsSurfaceArrangement S_seg α_disc α_pt + +/-- Outcome (S3) retaining the properness of the arrangement constructed in XV (7.7). -/ +abbrev Section7ProperS3 (S : Type w) [TopologicalSpace S] + (G : Graph α β) (T_star : Set (Hypergraph α β × Hypergraph α β)) (p k : ℕ) : Prop := + ∃ (𝒮 : Set (Society α β)) (disc : Society α β → Set S) (pt : α → S), + IsCentralSegregation G T_star 𝒮 ∧ + IsSegregationOfType G p k 𝒮 ∧ GM16.IsProperArrangement 𝒮 disc pt + +theorem Section7ProperS3.toSection7S3 {S : Type w} [TopologicalSpace S] + {G : Graph α β} {T_star : Set (Hypergraph α β × Hypergraph α β)} {p k : ℕ} + (h : Section7ProperS3 S G T_star p k) : Section7S3 S G T_star p k := by + obtain ⟨𝒮, disc, pt, hCentral, hType, hProper⟩ := h + exact ⟨𝒮, disc, pt, hCentral, hType, hProper.1⟩ + +/-- For `1 ≤ i ≤ k`, `Z_i` is the union of all atoms `a` of `H` with `d(r_i, a) ≤ θ' + 12μ + 14` +(Graph Minors XV, Section 7, page 135). -/ +def eyeAtomZone {S : Type w} [TopologicalSpace S] + (H : Drawing S) (d : Set S → Set S → ℕ) (θ' μ : ℕ) (r_i : Set S) : Set S := + ⋃ a ∈ {a ∈ H.A | d r_i a ≤ θ' + 12 * μ + 14}, a + +/-- For `1 ≤ i ≤ k`, `J_i` is the union of all bridges `B` of `η(H)` in `G` with +`V(B) ∩ η(V(H) ∩ Z_i) ≠ ∅` (Graph Minors XV, Section 7, page 135). -/ +def eyeBridgeUnion {S : Type w} [TopologicalSpace S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (d : Set S → Set S → ℕ) (θ' μ : ℕ) (r_i : Set S) : Graph α β := + subgraphSUnion G + {B : Graph α β | IsBridge G η.imageGraph B ∧ + (V(B) ∩ (η.vMap '' (H.V ∩ eyeAtomZone H d θ' μ r_i))).Nonempty} + +/-- `J₀` is the union of all bridges `B` of `η(H)` in `G` such that +`V(B) ∩ (Z₁ ∪ ... ∪ Z_k) = ∅` (Graph Minors XV, Section 7, page 135). -/ +def remainingBridgeUnion {S : Type w} [TopologicalSpace S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (d : Set S → Set S → ℕ) {k : ℕ} (θ' μ : ℕ) (r : Fin k → Set S) : Graph α β := + subgraphSUnion G + {B : Graph α β | IsBridge G η.imageGraph B ∧ + Disjoint V(B) (⋃ i : Fin k, η.vMap '' (H.V ∩ eyeAtomZone H d θ' μ (r i)))} + +/-- Edges of the union of the bridges incident with an eye zone. -/ +theorem eyeBridgeUnion_edgeSet {S : Type w} [TopologicalSpace S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (d : Set S → Set S → ℕ) (θ' μ : ℕ) (r_i : Set S) : + E(eyeBridgeUnion G H η d θ' μ r_i) = + ⋃ B ∈ {B : Graph α β | IsBridge G η.imageGraph B ∧ + (V(B) ∩ (η.vMap '' (H.V ∩ eyeAtomZone H d θ' μ r_i))).Nonempty}, E(B) := by + unfold eyeBridgeUnion + exact edgeSet_subgraphSUnion fun _ hB => hB.1.2.1 + +/-- Edges of the union of the bridges disjoint from all eye zones. -/ +theorem remainingBridgeUnion_edgeSet {S : Type w} [TopologicalSpace S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (d : Set S → Set S → ℕ) {k : ℕ} (θ' μ : ℕ) (r : Fin k → Set S) : + E(remainingBridgeUnion G H η d θ' μ r) = + ⋃ B ∈ {B : Graph α β | IsBridge G η.imageGraph B ∧ + Disjoint V(B) (⋃ i : Fin k, η.vMap '' (H.V ∩ eyeAtomZone H d θ' μ (r i)))}, E(B) := by + unfold remainingBridgeUnion + exact edgeSet_subgraphSUnion fun _ hB => hB.1.2.1 + +/-- `G₀ = η(H) ∪ J₀` (Graph Minors XV, Section 7, page 136). -/ +def section7G0 {S : Type w} [TopologicalSpace S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (d : Set S → Set S → ℕ) {k : ℕ} (θ' μ : ℕ) (r : Fin k → Set S) : Graph α β := + subgraphSUnion G {η.imageGraph, remainingBridgeUnion G H η d θ' μ r} + +/-- Both members of the union defining `section7G0` lie in the ambient graph. -/ +private theorem section7G0_members_le {S : Type w} [TopologicalSpace S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (d : Set S → Set S → ℕ) {k : ℕ} (θ' μ : ℕ) (r : Fin k → Set S) : + ∀ Q ∈ ({η.imageGraph, remainingBridgeUnion G H η d θ' μ r} : Set (Graph α β)), Q ≤ G := by + rintro Q (rfl | rfl) + · exact η.imageGraph_le + · exact subgraphSUnion_le fun _ hB => hB.1.2.1 + +/-- The union defining `section7G0` is a subgraph of the ambient graph. -/ +theorem section7G0_le {S : Type w} [TopologicalSpace S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (d : Set S → Set S → ℕ) {k : ℕ} (θ' μ : ℕ) (r : Fin k → Set S) : + section7G0 G H η d θ' μ r ≤ G := + subgraphSUnion_le (section7G0_members_le G H η d θ' μ r) + +/-! ## Statements and Proofs of `(7.1)`–`(7.11)` -/ + +/-- Statement of Graph Minors XV, (7.1) (page 135): +"There is a $(\lambda, \mu)$-flat $\Sigma$-span of order $\theta$, with $k$ eyes mutually at +distance $\theta$." -/ +def GM15Theorem71Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H₀ : Drawing S) (η₀ : SpanEmbedding H₀ G) + (θ_star θ₀ θ lam μ k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ), + IsFlatSpan G H₀ η₀ θ_star θ₀ lam μ T_star T₀ → + HasTangleMetric H₀ θ₀ T₀ d₀ → + 2 ≤ lam → 4 * lam + μ + 2 ≤ θ → 4 ≤ θ → θ ≤ θ₀ → + HasEyesAtDistance G H₀ η₀ θ₀ T₀ d₀ k θ → + ∃ (H : Drawing S) (η : SpanEmbedding H G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin k → Set S), + IsFlatSpan G H η θ_star θ lam μ T_star T ∧ + HasTangleMetric H θ T d ∧ + Injective r ∧ + (∀ i : Fin k, IsDrawingEye G H η θ T (r i)) ∧ + (∀ i j : Fin k, i ≠ j → d (r i) (r j) = θ) + +/-- **Graph Minors XV, (7.1)** (page 135): +Truncating a `(λ, μ)`-flat `Σ`-span `H₀, η₀, T₀` of order `θ₀ ≥ θ` with `k` eyes at distance `≥ θ` +to order `θ` yields a `(λ, μ)`-flat `Σ`-span of order `θ` with `k` eyes mutually at distance `θ`. +Proved from `(5.1)` (`theorem_5_1_proof`). -/ +theorem theorem_7_1_proof + : + GM15Theorem71Statement.{u, v, w} := by + intro S _ _ α β G H₀ η₀ θ_star θ₀ θ lam μ k T_star T₀ d₀ + hFlat₀ hMetric₀ hlam2 hθ_ord h4 hθ_le hEyes₀ + let T := GM10.truncation T₀ θ + have hFlat : IsFlatSpan G H₀ η₀ θ_star θ lam μ T_star T := + theorem_5_1_proof G H₀ η₀ θ_star θ₀ θ lam lam μ μ T_star T₀ + hFlat₀ le_rfl le_rfl (by omega) hθ_le hθ_ord (by omega) (fun _ => hlam2) + obtain ⟨d, hMetric, hd_eq, _⟩ := + hasTangleMetric_truncation_of_hasTangleMetric (θ₁ := θ) hMetric₀ (by omega) hθ_le + rcases hEyes₀ with ⟨r, hr_inj, hr_eye, hr_dist⟩ + refine ⟨H₀, η₀, T, d, r, hFlat, hMetric, hr_inj, ?_, ?_⟩ + · intro i + rcases hr_eye i with + ⟨hr_R, C, a, b, c, d_v, P₁, P₂, hC_circ, hC_sub, hC_U, ha, hb, hc, hd_v, + hnodup, hord, hFree, hdisj, hP₁, hP₂⟩ + have hcard4 : ({a, b, c, d_v} : Set S).ncard ≤ θ := by + have h1 := ncard_insert_le a ({b, c, d_v} : Set S) + have h2 := ncard_insert_le b ({c, d_v} : Set S) + have h3 := ncard_insert_le c ({d_v} : Set S) + have h4' : ({d_v} : Set S).ncard = 1 := ncard_singleton d_v + omega + have hFree' : IsFreeSet H₀.toHypergraph T θ {a, b, c, d_v} := + theorem_3_3_claim_2 hFlat₀.isSpan.isControlling.isTangle_H hFree Subset.rfl hcard4 + exact ⟨hr_R, C, a, b, c, d_v, P₁, P₂, hC_circ, hC_sub, hC_U, ha, hb, hc, hd_v, + hnodup, hord, hFree', hdisj, hP₁, hP₂⟩ + · intro i j hij + have hri : r i ∈ H₀.A := Or.inr (hr_eye i).1 + have hrj : r j ∈ H₀.A := Or.inr (hr_eye j).1 + rw [hd_eq (r i) hri (r j) hrj] + exact min_eq_left (hr_dist i j hij) + +/-- Statement of Graph Minors XV, (7.2) (page 135): +"For $1 \le i < j \le k$, if $\sigma_1 \in Z_i$ and $\sigma_2 \in Z_j$ then $d(\sigma_1, +\sigma_2) \ge \theta - 2(\theta' + 12\mu + 14)$, and so $Z_i \cap Z_j = \emptyset$ and $J_i +\cap J_j \subseteq H$." -/ +def GM15Theorem72Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ θ' lam μ k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin k → Set S), + IsFlatSpan G H η θ_star θ lam μ T_star T → + HasTangleMetric H θ T d → + 1 ≤ μ → 2 * (θ' + 12 * μ + 14) + μ ≤ θ → + Injective r → + (∀ i : Fin k, IsDrawingEye G H η θ T (r i)) → + (∀ i j : Fin k, i ≠ j → d (r i) (r j) = θ) → + ∀ i j : Fin k, i ≠ j → + (∀ σ₁ ∈ eyeAtomZone H d θ' μ (r i), ∀ σ₂ ∈ eyeAtomZone H d θ' μ (r j), + θ - 2 * (θ' + 12 * μ + 14) ≤ pointDist H d σ₁ σ₂) ∧ + Disjoint (eyeAtomZone H d θ' μ (r i)) (eyeAtomZone H d θ' μ (r j)) ∧ + V(eyeBridgeUnion G H η d θ' μ (r i)) ∩ V(eyeBridgeUnion G H η d θ' μ (r j)) ⊆ + V(η.imageGraph) + +/-- **Graph Minors XV, (7.2)** (pages 135–136): +For `i ≠ j`, points in `Z_i` and `Z_j` are at distance `≥ θ - 2(θ' + 12μ + 14)`, `Z_i ∩ Z_j = ∅`, +and `V(J_i) ∩ V(J_j) ⊆ V(η(H))`. -/ +theorem theorem_7_2_proof : + GM15Theorem72Statement.{u, v, w} := by + intro S _ _ α β G H η θ_star θ θ' lam μ k T_star T d r + hFlat hMetric hμ1 hθ hr_inj hr_eye hr_dist i j hij + have hS : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + obtain ⟨_, hd_refl, _, hd_symm, hd_tri, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + have hriA : r i ∈ H.A := Or.inr (hr_eye i).1 + have hrjA : r j ∈ H.A := Or.inr (hr_eye j).1 + have hd_ij : d (r i) (r j) = θ := hr_dist i j hij + have hPart1 : ∀ σ₁ ∈ eyeAtomZone H d θ' μ (r i), ∀ σ₂ ∈ eyeAtomZone H d θ' μ (r j), + θ - 2 * (θ' + 12 * μ + 14) ≤ pointDist H d σ₁ σ₂ := by + intro σ₁ hσ₁ σ₂ hσ₂ + obtain ⟨a₁, ⟨ha₁A, hd₁⟩, hσa₁⟩ := mem_iUnion₂.mp hσ₁ + obtain ⟨a₂, ⟨ha₂A, hd₂⟩, hσa₂⟩ := mem_iUnion₂.mp hσ₂ + rw [pointDist_eq_of_mem_atom ha₁A ha₂A hσa₁ hσa₂] + have htri₁ := hd_tri (r i) hriA a₁ ha₁A (r j) hrjA + have htri₂ := hd_tri a₁ ha₁A a₂ ha₂A (r j) hrjA + have hsym₂ := hd_symm a₂ ha₂A (r j) hrjA + omega + have hPart2 : Disjoint (eyeAtomZone H d θ' μ (r i)) (eyeAtomZone H d θ' μ (r j)) := by + refine Set.disjoint_left.mpr fun σ hσ₁ hσ₂ => ?_ + have hge := hPart1 σ hσ₁ σ hσ₂ + obtain ⟨a, haA, hσa⟩ := exists_atom_of_point H σ + rw [pointDist_eq_of_mem_atom haA haA hσa hσa, hd_refl a haA] at hge + omega + refine ⟨hPart1, hPart2, fun x ⟨hx₁, hx₂⟩ => ?_⟩ + by_contra hx_not + simp only [eyeBridgeUnion, vertexSet_subgraphSUnion, mem_iUnion] at hx₁ hx₂ + obtain ⟨B₁, ⟨hB₁, z₁, hz₁B₁, u, ⟨huH, huZ₁⟩, rfl⟩, hxB₁⟩ := hx₁ + obtain ⟨B₂, ⟨hB₂, z₂, hz₂B₂, v, ⟨hvH, hvZ₂⟩, rfl⟩, hxB₂⟩ := hx₂ + have hB_comp : ∀ {B : Graph α β} {u_v : S}, + IsBridge G η.imageGraph B → x ∈ V(B) → u_v ∈ H.V → η.vMap u_v ∈ V(B) → + ∃ C ∈ graphComponents (deleteVertices G V(η.imageGraph)), + x ∈ V(C) ∧ ∃ e ∈ E(G), ∃ w ∈ V(C), G.IsLink e w (η.vMap u_v) := by + intro B u_v hB hxB hu_vH hu_vB + rcases hB.2.2 with ⟨e, _, w₁, hw₁, w₂, hw₂, _, hVB, _⟩ | ⟨C, hC, hVB, _⟩ + · rw [hVB] at hxB + rcases hxB with rfl | rfl + · exact False.elim (hx_not hw₁) + · exact False.elim (hx_not hw₂) + · rw [hVB] at hxB hu_vB + have hxC : x ∈ V(C) := by + rcases hxB with hxC | ⟨hxH, _⟩ + · exact hxC + · exact False.elim (hx_not hxH) + rcases hu_vB with hu_vC | ⟨_, e, heG, w, hwC, hlink⟩ + · exact False.elim ((hC.1.vertexSet_mono hu_vC).2 (η.bijOn_v.mapsTo hu_vH)) + · exact ⟨C, hC, hxC, e, heG, w, hwC, hlink⟩ + obtain ⟨C₁, hC₁, hxC₁, e₁, he₁G, x₁, hx₁C₁, hlink₁⟩ := hB_comp hB₁ hxB₁ huH hz₁B₁ + obtain ⟨C₂, hC₂, hxC₂, e₂, he₂G, x₂, hx₂C₂, hlink₂⟩ := hB_comp hB₂ hxB₂ hvH hz₂B₂ + have hC_eq : C₁ = C₂ := isGraphComponent_eq_of_mem_inter hC₁ hC₂ ⟨x, hxC₁, hxC₂⟩ + rw [← hC_eq] at hx₂C₂ + have huv_ne : u ≠ v := fun hEq => + Set.disjoint_left.mp hPart2 huZ₁ (hEq ▸ hvZ₂) + have hvu_ne : η.vMap u ≠ η.vMap v := + fun hEq => huv_ne (η.bijOn_v.injOn huH hvH hEq) + obtain ⟨P, hP⟩ := + exists_isHPathWithEnds_of_component_attachments η.imageGraph_le hC₁ + (η.bijOn_v.mapsTo huH) (η.bijOn_v.mapsTo hvH) hvu_ne hx₁C₁ hx₂C₂ hlink₁.symm hlink₂ + have hdist_uv : μ ≤ d {u} {v} := by + have hge := hPart1 u huZ₁ v hvZ₂ + rw [pointDist_eq_of_mem_atom (Or.inl (Or.inl ⟨u, huH, rfl⟩)) + (Or.inl (Or.inl ⟨v, hvH, rfl⟩)) (mem_singleton u) (mem_singleton v)] at hge + dsimp at hge + omega + have hord := hFlat.order_ge + exact not_isMuSteppedSpan_of_isFlatSpan hFlat hMetric (by omega) + ⟨P, u, v, huH, hvH, hP, hdist_uv⟩ + +/-- Four distinct vertices `a, b, c, d_v` occurring in cyclic order along a circuit `C` cross on +`C.U`: `PairsCrossOn C.U a c b d_v`. -/ +private theorem pairsCrossOn_of_occurInCircuitOrder {S : Type w} [TopologicalSpace S] + {C : Drawing S} {a b c d_v : S} + (hnodup : ([a, b, c, d_v]).Nodup) (hord : OccurInCircuitOrder C a b c d_v) : + PairsCrossOn C.U a c b d_v := by + obtain ⟨φ, t₁, t₂, t₃, t₄, ht₀, h₁₂, h₂₃, h₃₄, h₄, ha, hb, hc, hd⟩ := hord + simp only [List.nodup_cons, List.mem_cons, not_or, List.not_mem_nil, or_false] at hnodup + rcases hnodup with ⟨⟨hab, hac, had⟩, ⟨hbc, hbd⟩, hcd, -⟩ + have haU : a ∈ C.U := ha ▸ (φ (Circle.exp t₁)).2 + have hbU : b ∈ C.U := hb ▸ (φ (Circle.exp t₂)).2 + have hcU : c ∈ C.U := hc ▸ (φ (Circle.exp t₃)).2 + have hdU : d_v ∈ C.U := hd ▸ (φ (Circle.exp t₄)).2 + refine ⟨haU, hbU, hcU, hdU, hac, hbd, hab, had, Ne.symm hbc, hcd, fun he => ?_⟩ + have hpi : (0 : ℝ) < 2 * Real.pi := Real.two_pi_pos + let s₁ := t₁ / (2 * Real.pi) + let s₂ := t₂ / (2 * Real.pi) + let s₃ := t₃ / (2 * Real.pi) + let s₄ := t₄ / (2 * Real.pi) + have hs₁ : 0 ≤ s₁ := div_nonneg ht₀ hpi.le + have hs₁₂ : s₁ < s₂ := div_lt_div_of_pos_right h₁₂ hpi + have hs₂₃ : s₂ < s₃ := div_lt_div_of_pos_right h₂₃ hpi + have hs₃₄ : s₃ < s₄ := div_lt_div_of_pos_right h₃₄ hpi + have hs₄ : s₄ < s₁ + 1 := by + have : s₄ < 1 := (div_lt_one hpi).mpr h₄ + linarith + have hpt : ∀ t : ℝ, circlePt (t / (2 * Real.pi)) = Circle.exp t := fun t => by + unfold circlePt + rw [mul_div_cancel₀ t hpi.ne'] + let k : Circle → S := fun z => (φ z).1 + have hkemb : IsEmbedding k := IsEmbedding.subtypeVal.comp φ.isEmbedding + set C₀ := C.U \ {a, c} + have hb₀ : b ∈ C₀ := by + refine ⟨hbU, ?_⟩ + rintro (rfl | rfl) + · exact hab rfl + · exact hbc rfl + have hd₀ : d_v ∈ C₀ := by + refine ⟨hdU, ?_⟩ + rintro (rfl | rfl) + · exact had rfl + · exact hcd rfl + have hsub₀ : connectedComponentIn C₀ b ⊆ C₀ := connectedComponentIn_subset _ _ + have hpre : IsPreconnected (k ⁻¹' connectedComponentIn C₀ b) := by + rw [← hkemb.isInducing.isPreconnected_image, image_preimage_eq_of_subset] + · exact isPreconnected_connectedComponentIn + · intro y hy + have hyU : y ∈ C.U := (hsub₀ hy).1 + exact ⟨φ.symm ⟨y, hyU⟩, by simp [k]⟩ + refine circle_no_cross hs₁₂ hs₂₃ hs₃₄ hs₄ hpre ?_ ?_ ?_ ?_ + · intro hm + have hka : k (circlePt s₁) = a := by dsimp [k, s₁]; rw [hpt]; exact ha + exact (hsub₀ hm).2 (Or.inl hka) + · intro hm + have hkc : k (circlePt s₃) = c := by dsimp [k, s₃]; rw [hpt]; exact hc + exact (hsub₀ hm).2 (Or.inr hkc) + · have hkb : k (circlePt s₂) = b := by dsimp [k, s₂]; rw [hpt]; exact hb + change k (circlePt s₂) ∈ connectedComponentIn C₀ b + rw [hkb] + exact mem_connectedComponentIn hb₀ + · have hkd : k (circlePt s₄) = d_v := by dsimp [k, s₄]; rw [hpt]; exact hd + change k (circlePt s₄) ∈ connectedComponentIn C₀ b + rw [hkd, he] + exact mem_connectedComponentIn hd₀ + +/-- Pulling back a simple walk `W'` in `G` whose edges lie in `E(η.imageGraph)` to a simple walk +`W` in `Γ.toGraph`. -/ +private theorem exists_walk_toGraph_of_edges_subset {S : Type w} [TopologicalSpace S] + {G : Graph α β} {Γ : Drawing S} (η : SpanEmbedding Γ G) + {u' v' : α} (W' : GraphWalk G u' v') (hW' : W'.IsSimple) + {a b : S} (ha : a ∈ Γ.V) (hb : b ∈ Γ.V) (hu' : η.vMap a = u') (hv' : η.vMap b = v') + (hed : ∀ e ∈ W'.edges, e ∈ E(η.imageGraph)) : + ∃ W : GraphWalk Γ.toGraph a b, + W.IsSimple ∧ W'.support = W.support.map η.vMap ∧ W'.edges = W.edges.map η.eMap := by + induction W' generalizing a with + | @nil u h => + have hab : a = b := η.bijOn_v.injOn ha hb (hu'.trans hv'.symm) + subst hab + exact ⟨.nil ha, List.nodup_singleton a, congrArg (· :: []) hu'.symm, rfl⟩ + | @cons u w v e' hlink r ih => + have hu_not : u ∉ r.support := (List.nodup_cons.mp hW').1 + have hnd_r : r.IsSimple := (List.nodup_cons.mp hW').2 + have he' : e' ∈ E(η.imageGraph) := hed e' List.mem_cons_self + obtain ⟨e, he, hee'⟩ := η.bijOn_e.surjOn he' + have hlink_im : η.imageGraph.IsLink (η.eMap e) (η.vMap a) w := by + rw [hee', hu'] + exact (η.imageGraph_le.isLink_iff he').mpr hlink + obtain ⟨c, hc, hcw⟩ := η.bijOn_v.surjOn hlink_im.right_mem + have huw : u ≠ w := fun hEq => hu_not (hEq ▸ r.start_mem_support) + have hac : a ≠ c := fun hEq => huw (hu'.symm.trans ((congrArg η.vMap hEq).trans hcw)) + have hlink_Γ : Γ.toGraph.IsLink e a c := by + refine (η.isLink_iff_of_ne he ha hc hac).mp ?_ + rwa [hcw] + obtain ⟨W_r, hWr_sim, hsup, hed_r⟩ := + ih hnd_r hc hcw hv' (fun f hf => hed f (List.mem_cons_of_mem e' hf)) + refine ⟨.cons hlink_Γ W_r, ?_, by simp [hu', hsup], by simp [hee', hed_r]⟩ + unfold GraphWalk.IsSimple at hWr_sim ⊢ + rw [GraphWalk.support_cons, List.nodup_cons] + refine ⟨?_, hWr_sim⟩ + intro ha_mem + apply hu_not + rw [← hu', hsup] + exact List.mem_map_of_mem ha_mem + +/-- Along a walk `W'` in `G₀` starting at `η₀.vMap a` (`a ∈ H.V ∩ closure Λ`) whose edges are +disjoint from `E(η'.imageGraph)` and not all in `E(η₀.imageGraph)`, the first edge outside +`E(η₀.imageGraph)` has its start vertex in `η₀.vMap '' (H.V ∩ closure Λ)`. -/ +private theorem exists_first_non_imageGraph_edge {S : Type w} [TopologicalSpace S] [T2Space S] + {G₀ : Graph α β} {H : Drawing S} {d : Set S → Set S → ℕ} {lam : ℕ} {z Λ : Set S} + (hZone : IsLambdaZoneAround H d lam z Λ) + (η₀ : SpanEmbedding H G₀) (η' : SpanEmbedding (clearedSubdrawing H Λ) G₀) + (hη'_e : ∀ e ∈ (clearedSubdrawing H Λ).E, η'.eMap e = η₀.eMap e) + {u' v' : α} (W' : GraphWalk G₀ u' v') + {a : S} (haV : a ∈ H.V) (ha_cl : a ∈ closure Λ) (hu' : η₀.vMap a = u') + (hnot_H' : ∀ f ∈ W'.edges, f ∉ E(η'.imageGraph)) + (hex : ∃ f ∈ W'.edges, f ∉ E(η₀.imageGraph)) : + ∃ v ∈ H.V, v ∈ closure Λ ∧ ∃ e x, e ∉ E(η₀.imageGraph) ∧ G₀.IsLink e (η₀.vMap v) x := by + induction W' generalizing a with + | nil _ => + rcases hex with ⟨_, hf, _⟩ + exact False.elim (List.not_mem_nil hf) + | @cons u w v e₀ hlink r ih => + by_cases he₀ : e₀ ∈ E(η₀.imageGraph) + · rcases hex with ⟨f, hf, hf_not⟩ + have hex_r : ∃ f ∈ r.edges, f ∉ E(η₀.imageGraph) := by + rcases List.mem_cons.mp hf with rfl | hfr + · exact False.elim (hf_not he₀) + · exact ⟨f, hfr, hf_not⟩ + obtain ⟨f₀, hf₀, hf₀_eq⟩ := η₀.bijOn_e.surjOn he₀ + have hlink_im : η₀.imageGraph.IsLink (η₀.eMap f₀) u w := by + rw [hf₀_eq] + exact (η₀.imageGraph_le.isLink_iff he₀).mpr hlink + obtain ⟨c, hcV, hcw⟩ := η₀.bijOn_v.surjOn hlink_im.right_mem + have hinc_c : η₀.imageGraph.Inc (η₀.eMap f₀) (η₀.vMap c) := by + rw [hcw] + exact ⟨u, hlink_im.symm⟩ + have hc_f₀ : c ∈ closure f₀ := (η₀.inc_iff f₀ hf₀ c hcV).mp hinc_c + have hf₀_not_H' : f₀ ∉ (clearedSubdrawing H Λ).E := fun hf₀' => by + apply hnot_H' e₀ List.mem_cons_self + rw [← hf₀_eq, ← hη'_e f₀ hf₀'] + exact η'.bijOn_e.mapsTo hf₀' + have hf₀_Λ : f₀ ⊆ Λ := by + rcases edge_subset_or_subset_compl_of_zone hZone hf₀ with hsub | hcompl + · exact hsub + · exfalso + apply hf₀_not_H' + rw [(clearedSubdrawing_V_and_E hZone).2] + exact ⟨hf₀, hcompl⟩ + have hc_cl : c ∈ closure Λ := closure_mono hf₀_Λ hc_f₀ + exact ih hcV hc_cl hcw (fun f hf => hnot_H' f (List.mem_cons_of_mem e₀ hf)) hex_r + · exact ⟨a, haV, ha_cl, e₀, w, he₀, hu' ▸ hlink⟩ + +/-- Statement of Graph Minors XV, (7.3) (page 136): +"If there is a* $(3\mu + 3)$*-zone* $\Lambda \subseteq \Sigma$ *for* $H$ *such that* $H \cap +(\Sigma - \Lambda)$ *is rigid and such that* $\Lambda$ *is an eye of* $H \cap (\Sigma - +\Lambda)$ *in* $G_0$ *with respect to the tangle of order* $\theta - 12\mu - 14$ *obtained +from* $\mathcal{T}$ *by clearing* $\Lambda$, *then (S1) holds." -/ +def GM15Theorem73Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ θ' lam lam' μ k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin k → Set S) + (η₀ : SpanEmbedding H (section7G0 G H η d θ' μ r)) + (z Λ : Set S) + (T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₁ : Set S → Set S → ℕ) + (η' : SpanEmbedding (clearedSubdrawing H Λ) (section7G0 G H η d θ' μ r)), + IsFlatSpan G H η θ_star θ lam μ T_star T → + HasTangleMetric H θ T d → + 12 ≤ μ → 4 ≤ lam' → 4 * lam' + μ + 2 ≤ θ' → 6 * μ + 14 < θ' → + 6 * (3 * μ + 3) + 5 * lam' + 3 * μ + 4 ≤ lam → + θ' + 12 * μ + 14 ≤ θ → + Injective r → + (∀ i : Fin k, IsDrawingEye G H η θ T (r i)) → + (∀ i j : Fin k, i ≠ j → d (r i) (r j) = θ) → + (∀ v ∈ H.V, η₀.vMap v = η.vMap v) → + (∀ e ∈ H.E, η₀.eMap e = η.eMap e) → + IsLambdaZoneAround H d (3 * μ + 3) z Λ → + IsClearedTangle H T d θ (3 * μ + 3) Λ T₁ d₁ → + IsRigid (clearedSubdrawing H Λ) → + (∀ v ∈ (clearedSubdrawing H Λ).V, η'.vMap v = η₀.vMap v) → + (∀ e ∈ (clearedSubdrawing H Λ).E, η'.eMap e = η₀.eMap e) → + IsDrawingEye (section7G0 G H η d θ' μ r) (clearedSubdrawing H Λ) η' + (θ - 4 * (3 * μ + 3) - 2) T₁ Λ → + Section7S1 S G θ_star T_star k μ lam' θ' + +private theorem exists_cleared_vertex_outside_eye_zones + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (θ : ℕ) + (θ' : ℕ) + (μ : ℕ) + (k : ℕ) + (d : Set S → Set S → ℕ) + (r : Fin k → Set S) + (η₀ : SpanEmbedding H (section7G0 G H η d θ' μ r)) + (z : Set S) + (Λ : Set S) + (T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (η' : SpanEmbedding (clearedSubdrawing H Λ) (section7G0 G H η d θ' μ r)) + (hη₀_v : ∀ v ∈ H.V, η₀.vMap v = η.vMap v) + (hη₀_e : ∀ e ∈ H.E, η₀.eMap e = η.eMap e) + (hZone : IsLambdaZoneAround H d (3 * μ + 3) z Λ) + (hη'_v : ∀ v ∈ (clearedSubdrawing H Λ).V, η'.vMap v = η₀.vMap v) + (hη'_e : ∀ e ∈ (clearedSubdrawing H Λ).E, η'.eMap e = η₀.eMap e) + (hEyeΛ : IsDrawingEye (section7G0 G H η d θ' μ r) (clearedSubdrawing H Λ) η' (θ - 4 * (3 * μ + + 3) - 2) T₁ Λ) + (hS : IsClosedSurface S) : + let H' : Drawing S := clearedSubdrawing H Λ + (H'.IsSubdrawing H) → + ((clearedSubdrawing H Λ).E = {e | e ∈ H.E ∧ e ⊆ univ \ Λ}) → + ∃ v ∈ H.V, v ∈ closure Λ ∧ ∀ (i : Fin k), v ∉ eyeAtomZone H d θ' μ (r i) := by + intro H' hSubH' hE_H' + let G₀ := section7G0 G H η d θ' μ r + rcases hEyeΛ with + ⟨_, C, a, b, c, d_v, P₁, P₂, hC_circ, hC_sub, hC_U, haC, hbC, hcC, hdC, + hnodup, hord, _, hdisj_P, hP₁, hP₂⟩ + have haH' : a ∈ H'.V := hC_sub.1 haC + have hbH' : b ∈ H'.V := hC_sub.1 hbC + have hcH' : c ∈ H'.V := hC_sub.1 hcC + have hdH' : d_v ∈ H'.V := hC_sub.1 hdC + have haH : a ∈ H.V := hSubH'.1 haH' + have hbH : b ∈ H.V := hSubH'.1 hbH' + have hcH : c ∈ H.V := hSubH'.1 hcH' + have hdH : d_v ∈ H.V := hSubH'.1 hdH' + have ha_cl : a ∈ closure Λ := (hC_U ▸ C.V_subset_U haC).1 + have hb_cl : b ∈ closure Λ := (hC_U ▸ C.V_subset_U hbC).1 + obtain ⟨W₁₀, hW₁₀_sim, hVP₁, hEP₁⟩ := hP₁.2.1.2 + obtain ⟨W₁', hW₁'_sup, hW₁'_ed⟩ := exists_walk_up_of_le hP₁.2.1.1 W₁₀ + have hW₁'_sim : W₁'.IsSimple := by + unfold GraphWalk.IsSimple; rw [hW₁'_sup]; exact hW₁₀_sim + obtain ⟨W₂₀, hW₂₀_sim, hVP₂, hEP₂⟩ := hP₂.2.1.2 + obtain ⟨W₂', hW₂'_sup, hW₂'_ed⟩ := exists_walk_up_of_le hP₂.2.1.1 W₂₀ + have hW₂'_sim : W₂'.IsSimple := by + unfold GraphWalk.IsSimple; rw [hW₂'_sup]; exact hW₂₀_sim + have hNotBoth : ¬ ((∀ e ∈ W₁'.edges, e ∈ E(η₀.imageGraph)) ∧ + (∀ e ∈ W₂'.edges, e ∈ E(η₀.imageGraph))) := by + rintro ⟨hE₁, hE₂⟩ + obtain ⟨W₁, hW₁_sim, hsup₁, hed₁⟩ := + exists_walk_toGraph_of_edges_subset η₀ W₁' hW₁'_sim haH hcH + (hη'_v a haH').symm (hη'_v c hcH').symm hE₁ + obtain ⟨W₂, hW₂_sim, hsup₂, hed₂⟩ := + exists_walk_toGraph_of_edges_subset η₀ W₂' hW₂'_sim hbH hdH + (hη'_v b hbH').symm (hη'_v d_v hdH').symm hE₂ + let Q₁ := walkDrawing H W₁ + let Q₂ := walkDrawing H W₂ + have hQ₁_sub : Q₁.IsSubdrawing H := walkDrawing_isSubdrawing H W₁ + have hQ₂_sub : Q₂.IsSubdrawing H := walkDrawing_isSubdrawing H W₂ + have hQ₁_path : Q₁.IsPathBetween a c := GM11.walkDrawing_isPathBetween H hW₁_sim + have hQ₂_path : Q₂.IsPathBetween b d_v := GM11.walkDrawing_isPathBetween H hW₂_sim + have hdisV : Disjoint Q₁.V Q₂.V := by + rw [walkDrawing_V, walkDrawing_V] + refine Set.disjoint_left.mpr fun v hv₁ hv₂ => ?_ + have hv₁' : η₀.vMap v ∈ V(P₁) := by + rw [hVP₁, mem_ofPred_eq, ← hW₁'_sup, hsup₁] + exact List.mem_map_of_mem hv₁ + have hv₂' : η₀.vMap v ∈ V(P₂) := by + rw [hVP₂, mem_ofPred_eq, ← hW₂'_sup, hsup₂] + exact List.mem_map_of_mem hv₂ + exact Set.disjoint_left.mp hdisj_P hv₁' hv₂' + have hdisU : Disjoint Q₁.U Q₂.U := disjoint_U_of_disjoint_V hQ₁_sub hQ₂_sub hdisV + have hQ_sub_cl : ∀ {u v : S} {W' : GraphWalk G₀ (η'.vMap u) (η'.vMap v)} + {W : GraphWalk H.toGraph u v}, + W'.edges = W.edges.map η₀.eMap → + (∀ f ∈ W'.edges, f ∉ E(η'.imageGraph)) → + u ∈ C.V → (walkDrawing H W).U ⊆ closure Λ := by + intro u v W' W hed hdisE huC + rw [(walkDrawing H W).U_eq, walkDrawing_V, walkDrawing_E] + have he_sub : ∀ e ∈ W.edges, closure e ⊆ closure Λ := by + intro e heW + have heH : e ∈ H.E := walk_edges_subset_edgeSet W e heW + have he_not_H' : e ∉ H'.E := fun heH' => by + have he' : η₀.eMap e ∈ W'.edges := hed ▸ List.mem_map_of_mem heW + have he_im' : η₀.eMap e ∈ E(η'.imageGraph) := by + rw [← hη'_e e heH'] + exact η'.bijOn_e.mapsTo heH' + exact hdisE (η₀.eMap e) he' he_im' + rcases edge_subset_or_subset_compl_of_zone hZone heH with hsub | hcompl + · exact closure_mono hsub + · exfalso + apply he_not_H' + rw [hE_H'] + exact ⟨heH, hcompl⟩ + refine union_subset ?_ (iUnion₂_subset fun e heW => he_sub e heW) + have hsup_cl : ∀ {u₀ v₀ : S} (W₀ : GraphWalk H.toGraph u₀ v₀), + u₀ ∈ closure Λ → (∀ e ∈ W₀.edges, closure e ⊆ closure Λ) → + ∀ x ∈ W₀.support, x ∈ closure Λ := by + intro u₀ v₀ W₀ + induction W₀ with + | nil _ => + intro hu₀ _ x hx + rw [GraphWalk.support_nil, List.mem_singleton] at hx + exact hx ▸ hu₀ + | @cons u₁ w₁ v₁ e₀ hlink₀ r₀ ih => + intro hu₁ he₀ x hx + rcases List.mem_cons.mp hx with rfl | hxr + · exact hu₁ + · have hw₁ : w₁ ∈ closure e₀ ∩ H.V := by + rw [hlink₀.2.2.2] + exact mem_insert_of_mem _ (mem_singleton w₁) + exact ih (he₀ e₀ List.mem_cons_self hw₁.1) + (fun e he => he₀ e (List.mem_cons_of_mem e₀ he)) x hxr + exact fun x hxW => hsup_cl W (hC_U ▸ C.V_subset_U huC).1 he_sub x hxW + have hNotH'₁ : ∀ f ∈ W₁'.edges, f ∉ E(η'.imageGraph) := fun f hf hf' => + Set.disjoint_left.mp hP₁.2.2.2.2.2.2 (hEP₁ ▸ (hW₁'_ed ▸ hf)) hf' + have hNotH'₂ : ∀ f ∈ W₂'.edges, f ∉ E(η'.imageGraph) := fun f hf hf' => + Set.disjoint_left.mp hP₂.2.2.2.2.2.2 (hEP₂ ▸ (hW₂'_ed ▸ hf)) hf' + have hQ₁_cl : Q₁.U ⊆ closure Λ := hQ_sub_cl hed₁ hNotH'₁ haC + have hQ₂_cl : Q₂.U ⊆ closure Λ := hQ_sub_cl hed₂ hNotH'₂ hbC + have hcross_CU : PairsCrossOn C.U a c b d_v := + pairsCrossOn_of_occurInCircuitOrder hnodup hord + have hbd_cl : discBd (closure Λ) = C.U := by + rw [discBd_closure_eq_subBd hS hZone.isOpenDisc hZone.isOArc_bd hZone.isClosedDisc_closure, + hC_U] + obtain ⟨φ₁, -⟩ := GM14.isLine_of_isPathBetween hQ₁_path hcross_CU.2.2.2.2.1 + obtain ⟨φ₂, -⟩ := GM14.isLine_of_isPathBetween hQ₂_path hcross_CU.2.2.2.2.2.1 + have hQ₁_range : Q₁.U = range (fun z : unitInterval => (φ₁ z).1) := by + ext x + exact ⟨fun hx => ⟨φ₁.symm ⟨x, hx⟩, by simp⟩, fun ⟨z, hz⟩ => hz ▸ (φ₁ z).2⟩ + have hQ₂_range : Q₂.U = range (fun z : unitInterval => (φ₂ z).1) := by + ext x + exact ⟨fun hx => ⟨φ₂.symm ⟨x, hx⟩, by simp⟩, fun ⟨z, hz⟩ => hz ▸ (φ₂ z).2⟩ + have hQ₁_comp : IsCompact Q₁.U := by + rw [hQ₁_range]; exact isCompact_range (continuous_subtype_val.comp φ₁.continuous) + have hQ₂_comp : IsCompact Q₂.U := by + rw [hQ₂_range]; exact isCompact_range (continuous_subtype_val.comp φ₂.continuous) + have hQ₁_conn : IsConnected Q₁.U := by + rw [hQ₁_range]; exact isConnected_range (continuous_subtype_val.comp φ₁.continuous) + have hQ₂_conn : IsConnected Q₂.U := by + rw [hQ₂_range]; exact isConnected_range (continuous_subtype_val.comp φ₂.continuous) + have haQ₁ : a ∈ Q₁.U := Q₁.V_subset_U ((walkDrawing_V H W₁).symm ▸ W₁.start_mem_support) + have hcQ₁ : c ∈ Q₁.U := Q₁.V_subset_U ((walkDrawing_V H W₁).symm ▸ W₁.end_mem_support) + have hbQ₂ : b ∈ Q₂.U := Q₂.V_subset_U ((walkDrawing_V H W₂).symm ▸ W₂.start_mem_support) + have hdQ₂ : d_v ∈ Q₂.U := Q₂.V_subset_U ((walkDrawing_V H W₂).symm ▸ W₂.end_mem_support) + obtain ⟨x, hx₁, hx₂⟩ := disc_crossing (closure Λ) Q₁.U Q₂.U a c b d_v + hZone.isClosedDisc_closure hQ₁_cl hQ₂_cl hQ₁_comp hQ₂_comp hQ₁_conn hQ₂_conn + haQ₁ hcQ₁ hbQ₂ hdQ₂ (hbd_cl.symm ▸ hcross_CU) + exact Set.disjoint_left.mp hdisU hx₁ hx₂ + have hNotH'₁ : ∀ f ∈ W₁'.edges, f ∉ E(η'.imageGraph) := fun f hf hf' => + Set.disjoint_left.mp hP₁.2.2.2.2.2.2 (hEP₁ ▸ (hW₁'_ed ▸ hf)) hf' + have hNotH'₂ : ∀ f ∈ W₂'.edges, f ∉ E(η'.imageGraph) := fun f hf hf' => + Set.disjoint_left.mp hP₂.2.2.2.2.2.2 (hEP₂ ▸ (hW₂'_ed ▸ hf)) hf' + have hex_v : ∃ v ∈ H.V, v ∈ closure Λ ∧ + ∃ e x, e ∉ E(η₀.imageGraph) ∧ G₀.IsLink e (η₀.vMap v) x := by + by_cases hE₁ : ∀ e ∈ W₁'.edges, e ∈ E(η₀.imageGraph) + · have hex₂ : ∃ e ∈ W₂'.edges, e ∉ E(η₀.imageGraph) := by + by_contra hno + push Not at hno + exact hNotBoth ⟨hE₁, hno⟩ + exact exists_first_non_imageGraph_edge hZone η₀ η' hη'_e W₂' hbH hb_cl + (hη'_v b hbH').symm hNotH'₂ hex₂ + · push Not at hE₁ + exact exists_first_non_imageGraph_edge hZone η₀ η' hη'_e W₁' haH ha_cl + (hη'_v a haH').symm hNotH'₁ hE₁ + obtain ⟨v, hvH, hv_cl, e, x, he_not_im₀, hlink_e⟩ := hex_v + have hE_im_eq : E(η₀.imageGraph) = E(η.imageGraph) := by + rw [← η₀.bijOn_e.image_eq, ← η.bijOn_e.image_eq] + exact image_congr hη₀_e + have hPair_le := section7G0_members_le G H η d θ' μ r + have he_G₀ : e ∈ E(G₀) := hlink_e.edge_mem + have he_J₀ : e ∈ E(remainingBridgeUnion G H η d θ' μ r) := by + change e ∈ E(subgraphSUnion G {η.imageGraph, remainingBridgeUnion G H η d θ' μ r}) at he_G₀ + rw [edgeSet_subgraphSUnion hPair_le] at he_G₀ + obtain ⟨Q, hQ, heQ⟩ := mem_iUnion₂.mp he_G₀ + rcases hQ with rfl | rfl + · exact False.elim (he_not_im₀ (hE_im_eq.symm ▸ heQ)) + · exact heQ + have hG₀_le_G : G₀ ≤ G := section7G0_le G H η d θ' μ r + have hJ₀_le_G₀ : remainingBridgeUnion G H η d θ' μ r ≤ G₀ := + le_subgraphSUnion hPair_le (Or.inr rfl) + have hlink_J₀ : (remainingBridgeUnion G H η d θ' μ r).IsLink e (η₀.vMap v) x := + (hJ₀_le_G₀.isLink_iff he_J₀).mpr hlink_e + have hv_J₀ : η.vMap v ∈ V(remainingBridgeUnion G H η d θ' μ r) := by + rw [← hη₀_v v hvH] + exact hlink_J₀.left_mem + rw [remainingBridgeUnion, vertexSet_subgraphSUnion] at hv_J₀ + obtain ⟨B, ⟨_, hB_disj⟩, hvB⟩ := mem_iUnion₂.mp hv_J₀ + refine ⟨v, hvH, hv_cl, fun i hvi => ?_⟩ + exact Set.disjoint_left.mp hB_disj hvB + (mem_iUnion.mpr ⟨i, v, ⟨hvH, hvi⟩, rfl⟩) + +private theorem distance_from_cleared_region + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (θ : ℕ) + (θ' : ℕ) + (μ : ℕ) + (k : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (r : Fin k → Set S) + (z : Set S) + (Λ : Set S) + (T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₁ : Set S → Set S → ℕ) + (hr_eye : ∀ (i : Fin k), IsDrawingEye G H η θ T (r i)) + (hZone : IsLambdaZoneAround H d (3 * μ + 3) z Λ) + (hClear : IsClearedTangle H T d θ (3 * μ + 3) Λ T₁ d₁) + (hS : IsClosedSurface S) + [ConnectedSpace S] : + let H' : Drawing S := clearedSubdrawing H Λ + (∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) → + (∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) → + ((H.E.Nonempty → ∀ v ∈ H.V, ∀ r ∈ H.R, v ∈ closure r → d {v} r ≤ 1) ∧ ∀ v ∈ H.V, ∀ + e ∈ H.E, v ∈ closure e → d {v} e ≤ 2) → + (Λ ∈ H'.A) → + (H'.IsSubdrawing H) → + ∀ (v₀ : S), + (v₀ ∈ H.V) → + (v₀ ∈ closure Λ) → + ({v₀} ∈ H.A) → + (∀ (i : Fin k), θ' + 12 * μ + 14 < d (r i) {v₀}) → + (∀ (i : Fin k), r i ∈ H'.R) → + (H.E.Nonempty) → + ∀ (i : Fin k), θ' ≤ d₁ Λ (r i) := by + intro H' hd_symm hd_tri hd_inc hΛA hSubH' v₀ hv₀H hv₀_cl hv₀A hrv₀ hri_H' hE_ne i + have hriA : r i ∈ H.A := Or.inr (hr_eye i).1 + have hriA' : r i ∈ H'.A := Or.inr (hri_H' i) + let S_R : Set (Set S) := {r₀ ∈ H.R | r₀ ⊆ Λ} + have hS_R_fin : S_R.Finite := + (GM11.finite_R hS H).subset fun _ h => h.1 + have hv₀_u : v₀ ∈ closure (⋃ r₀ ∈ S_R, r₀) := by + refine mem_closure_iff.mpr fun O hO hv₀O => ?_ + obtain ⟨x, hxO, hxΛ⟩ := mem_closure_iff.mp hv₀_cl O hO hv₀O + obtain ⟨y, ⟨hyO, hyΛ⟩, hy_notU⟩ := + GM11.exists_notMem_U (Γ := H) hS + (hO.inter hZone.isOpenDisc.1) ⟨x, hxO, hxΛ⟩ + obtain ⟨r₀, hr₀, hy_r₀⟩ := exists_region_of_notMem hy_notU + have hr₀_Λ : r₀ ⊆ Λ := + atom_subset_of_isSubdrawing hSubH' (Or.inr hr₀) hΛA hy_r₀ hyΛ + exact ⟨y, hyO, mem_iUnion₂.mpr ⟨r₀, ⟨hr₀, hr₀_Λ⟩, hy_r₀⟩⟩ + rw [hS_R_fin.closure_biUnion] at hv₀_u + obtain ⟨aσ, ⟨haσR, haσ_sub⟩, hv₀_aσ⟩ := mem_iUnion₂.mp hv₀_u + have haσA : aσ ∈ H.A := Or.inr haσR + have hd_v₀_aσ : d {v₀} aσ ≤ 1 := hd_inc.1 hE_ne v₀ hv₀H aσ haσR hv₀_aσ + have htri := hd_tri (r i) hriA aσ haσA {v₀} hv₀A + have hsym₁ := hd_symm {v₀} hv₀A aσ haσA + have hsym₂ := hd_symm (r i) hriA aσ haσA + have hgt := hrv₀ i + have hbd := (hClear.dist_bounds aσ haσA (r i) hriA Λ hΛA (r i) hriA' haσ_sub Subset.rfl).1 + omega + +private theorem eye_survives_clearing + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (θ : ℕ) + (θ' : ℕ) + (lam' : ℕ) + (μ : ℕ) + (k : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (r : Fin k → Set S) + (z : Set S) + (Λ : Set S) + (T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₁ : Set S → Set S → ℕ) + (hMetric : HasTangleMetric H θ T d) + (hμ12 : 12 ≤ μ) + (hlam'4 : 4 ≤ lam') + (hθ' : 4 * lam' + μ + 2 ≤ θ') + (hθ'_gt : 6 * μ + 14 < θ') + (hr_eye : ∀ (i : Fin k), IsDrawingEye G H η θ T (r i)) + (hZone : IsLambdaZoneAround H d (3 * μ + 3) z Λ) + (hS : IsClosedSurface S) + [hConn : ConnectedSpace S] : + let H' : Drawing S := clearedSubdrawing H Λ + let lam₁ : ℕ := 3 * μ + 3 + let θ₁ : ℕ := θ - (4 * lam₁ + 2) + (∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) → + ((H.E.Nonempty → ∀ v ∈ H.V, ∀ r ∈ H.R, v ∈ closure r → d {v} r ≤ 1) ∧ ∀ v ∈ H.V, ∀ + e ∈ H.E, v ∈ closure e → d {v} e ≤ 2) → + (Λ ∈ H'.A) → + ((PaintingOrDrawing.drawing H').IsTwoCell) → + (∀ a ∈ H'.A, d₁ a a = 0) → + (IsLambdaCompression H H' θ (4 * lam₁ + 2) T T₁ d d₁) → + (∀ a ∈ H.A, lam₁ < d z a → a ∈ H'.A) → + ∀ (v₀ : S), + (d z {v₀} ≤ lam₁) → + (∀ (i : Fin k), θ' + 9 * μ + 11 < d z (r i)) → + (∀ (i : Fin k), r i ∈ H'.R) → + (H.E.Nonempty) → + (∀ (i : Fin k), θ' ≤ d₁ Λ (r i)) → + ∀ (η'_G : SpanEmbedding H' G), + (∀ v ∈ H'.V, η'_G.vMap v = η.vMap v) → + (V(η'_G.imageGraph) ⊆ V(η.imageGraph)) → + (E(η'_G.imageGraph) ⊆ E(η.imageGraph)) → + ∀ (i : Fin k), IsDrawingEye G H' η'_G θ₁ T₁ (r i) := by + intro H' lam₁ θ₁ hd_tri hd_inc hΛA h2cell' hd₁_refl hComp₁ hAtoms v₀ hzv₀ hClaim3 hri_H' hE_ne + hClaim4 η'_G hη'_G_v hV_sub_im hE_sub_im i + rcases hr_eye i with + ⟨hri_R, C, a, b, c, d_v, P₁, P₂, hC_circ, hC_sub, hC_U, ha, hb, hc, hd_v, + hnodup, hord, hFree, hdisj, hP₁, hP₂⟩ + have hri_ne_Λ : r i ≠ Λ := by + intro hEq + have hge := hClaim4 i + rw [← hEq, hd₁_refl (r i) (Or.inr (hri_H' i))] at hge + omega + have hdis_ri_Λ : Disjoint (r i) Λ := + GM14.disjoint_of_mem_A_ne (Or.inr (hri_H' i)) hΛA hri_ne_Λ + have hdis_CU_Λ : Disjoint C.U Λ := by + rw [hC_U] + refine Set.disjoint_left.mpr fun x hxbd hxΛ => ?_ + obtain ⟨y, hyΛ, hy_ri⟩ := mem_closure_iff.mp hxbd.1 Λ hZone.isOpenDisc.1 hxΛ + exact Set.disjoint_left.mp hdis_ri_Λ hy_ri hyΛ + have hC_sub' : C.IsSubdrawing H' := isSubdrawing_clearedSubdrawing hZone hC_sub hdis_CU_Λ + let X : Set S := {a, b, c, d_v} + have hX_card : X.ncard ≤ 4 := by + have h1 := ncard_insert_le a ({b, c, d_v} : Set S) + have h2 := ncard_insert_le b ({c, d_v} : Set S) + have h3 := ncard_insert_le c ({d_v} : Set S) + have h4 : ({d_v} : Set S).ncard = 1 := ncard_singleton d_v + dsimp [X] + omega + have hDistX : ∀ v ∈ X, 2 * X.ncard + 5 * lam₁ + 2 < d z {v} := by + intro v hvX + have hvC : v ∈ C.V := by + rcases hvX with rfl | rfl | rfl | rfl <;> assumption + have hv_bd : v ∈ subBd (r i) := hC_U ▸ C.V_subset_U hvC + have hvH : v ∈ H.V := hC_sub.1 hvC + have hvA : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hvH, rfl⟩) + have hriA : r i ∈ H.A := Or.inr hri_R + have hd_rv : d {v} (r i) ≤ 1 := hd_inc.1 hE_ne v hvH (r i) hri_R hv_bd.1 + have htri := hd_tri z hZone.z_mem {v} hvA (r i) hriA + have hgt := hClaim3 i + omega + have hFree' : IsFreeSet H'.toHypergraph T₁ θ₁ X := + theorem_4_7_proof H H' θ lam₁ T T₁ d d₁ z X + hS hConn hMetric hZone.z_mem (by omega) hFree hDistX h2cell' hAtoms hComp₁ + have hPathH' : ∀ {P : Graph α β} {u w : S}, + u ∈ C.V → w ∈ C.V → + IsHPathWithEnds G η.imageGraph P (η.vMap u) (η.vMap w) → + IsHPathWithEnds G η'_G.imageGraph P (η'_G.vMap u) (η'_G.vMap w) := by + intro P u w huC hwC hP + have huH' : u ∈ H'.V := hC_sub'.1 huC + have hwH' : w ∈ H'.V := hC_sub'.1 hwC + have hu_eq : η'_G.vMap u = η.vMap u := hη'_G_v u huH' + have hw_eq : η'_G.vMap w = η.vMap w := hη'_G_v w hwH' + rw [hu_eq, hw_eq] + refine ⟨η'_G.imageGraph_le, hP.2.1, hP.2.2.1, + hu_eq ▸ η'_G.bijOn_v.mapsTo huH', hw_eq ▸ η'_G.bijOn_v.mapsTo hwH', ?_, + hP.2.2.2.2.2.2.mono_right hE_sub_im⟩ + refine Subset.antisymm ?_ ?_ + · exact (inter_subset_inter_right _ hV_sub_im).trans (le_of_eq hP.2.2.2.2.2.1) + · rintro x (rfl | rfl) + · have hx_in : η.vMap u ∈ V(P) ∩ V(η.imageGraph) := + hP.2.2.2.2.2.1.symm ▸ Or.inl rfl + exact ⟨hx_in.1, hu_eq ▸ η'_G.bijOn_v.mapsTo huH'⟩ + · have hx_in : η.vMap w ∈ V(P) ∩ V(η.imageGraph) := + hP.2.2.2.2.2.1.symm ▸ Or.inr rfl + exact ⟨hx_in.1, hw_eq ▸ η'_G.bijOn_v.mapsTo hwH'⟩ + exact ⟨hri_H' i, C, a, b, c, d_v, P₁, P₂, hC_circ, hC_sub', hC_U, ha, hb, hc, hd_v, + hnodup, hord, hFree', hdisj, hPathH' ha hc hP₁, hPathH' hb hd_v hP₂⟩ + +/-- **Graph Minors XV, (7.3)** (pages 136–137): +If there is a `(3μ + 3)`-zone `Λ ⊆ Σ` for `H` such that `H ∩ (Σ - Λ)` is rigid and `Λ` is an eye +of `H ∩ (Σ - Λ)` in `G₀` with respect to the tangle `T₁` obtained from `T` by clearing `Λ`, then +`(S1)` holds. +Proved from `(4.6)`, `(4.7)`, `(5.1)`, `(5.2)`, `(7.1)`, and Graph Minors XI, `(9.1)` and XII, +`(7.7)`, `(7.10)`, `(7.11)`. -/ +theorem theorem_7_3_proof + : + GM15Theorem73Statement.{u, v, w} := by + intro S _ _ α β G H η θ_star θ θ' lam lam' μ k T_star T d r η₀ z Λ T₁ d₁ η' + hFlat hMetric hμ12 hlam'4 hθ' hθ'_gt hlam hθ hr_inj hr_eye hr_dist + hη₀_v hη₀_e hZone hClear hRigid' hη'_v hη'_e hEyeΛ + have hS : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let H' := clearedSubdrawing H Λ + let G₀ := section7G0 G H η d θ' μ r + let lam₁ := 3 * μ + 3 + let θ₁ := θ - (4 * lam₁ + 2) + have hθ₁_eq : θ - 4 * lam₁ - 2 = θ₁ := by omega + obtain ⟨_, hd_refl, _, hd_symm, hd_tri, hd_inc⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + obtain ⟨hΛR, hatom'⟩ := clearedSubdrawing_mem_R_and_atom hZone + have hΛA : Λ ∈ H'.A := Or.inr hΛR + have hSubH' : H'.IsSubdrawing H := clearedSubdrawing_isSubdrawing H Λ + have h2cell' : (PaintingOrDrawing.drawing H').IsTwoCell := + clearedSubdrawing_isTwoCell hMetric.1.1 hZone + obtain ⟨hV_H', hE_H'⟩ := clearedSubdrawing_V_and_E hZone + -- Claim (1): `T₁` is a `(4 * lam₁ + 2)`-compression of `T` in `H'`. + have hM₁ : HasTangleMetric H' θ₁ T₁ d₁ := hθ₁_eq ▸ hClear.hasMetric + obtain ⟨_, hd₁_refl, _, hd₁_symm, hd₁_tri, _⟩ := gm11_theorem_9_1 H' θ₁ T₁ d₁ hS hConn hM₁ + have hComp₁ : IsLambdaCompression H H' θ (4 * lam₁ + 2) T T₁ d d₁ := by + refine ⟨by omega, hMetric, hM₁, fun σ₁ σ₂ => ?_⟩ + obtain ⟨a₁, ha₁, hσ₁⟩ := exists_atom_of_point H σ₁ + obtain ⟨a₂, ha₂, hσ₂⟩ := exists_atom_of_point H σ₂ + obtain ⟨a₁', ha₁', hσ₁'⟩ := exists_atom_of_point H' σ₁ + obtain ⟨a₂', ha₂', hσ₂'⟩ := exists_atom_of_point H' σ₂ + rw [pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁ hσ₂, pointDist_eq_of_mem_atom ha₁' ha₂' hσ₁' hσ₂'] + have hsub₁ := atom_subset_of_isSubdrawing hSubH' ha₁ ha₁' hσ₁ hσ₁' + have hsub₂ := atom_subset_of_isSubdrawing hSubH' ha₂ ha₂' hσ₂ hσ₂' + have hle := (hClear.dist_bounds a₁ ha₁ a₂ ha₂ a₁' ha₁' a₂' ha₂' hsub₁ hsub₂).1 + omega + -- Every atom `a ∈ H.A` with `lam₁ < d z a` belongs to `H'.A`. + have hAtoms : ∀ a ∈ H.A, lam₁ < d z a → a ∈ H'.A := by + intro a ha hlt + have hnot_sub : ¬ a ⊆ closure Λ := fun hsub => by + have := hZone.dist_le a ha hsub + omega + obtain ⟨σ, hσa, hσ_not_cl⟩ := Set.not_subset.mp hnot_sub + have hσ_not_Λ : σ ∉ Λ := fun h => hσ_not_cl (subset_closure h) + obtain ⟨a', ha', hσa'⟩ := exists_atom_of_point H' σ + have ha'_ne : a' ≠ Λ := fun hEq => hσ_not_Λ (hEq ▸ hσa') + have ha'H : a' ∈ H.A := hatom' a' ha' ha'_ne + exact atom_eq_of_mem ha ha'H hσa hσa' ▸ ha' + -- Claim (2): There exists `v ∈ H.V ∩ closure Λ` with `η.vMap v ∈ V(J₀)`, hence `v ∉ Z_i` for all + -- `i`. + have hClaim2 : ∃ v ∈ H.V, v ∈ closure Λ ∧ ∀ i : Fin k, v ∉ eyeAtomZone H d θ' μ (r i) := by + exact exists_cleared_vertex_outside_eye_zones (S := S) (α := α) (β := β) G H η θ θ' μ k d r η₀ + z Λ T₁ η' hη₀_v hη₀_e hZone hη'_v hη'_e hEyeΛ hS hSubH' hE_H' + obtain ⟨v₀, hv₀H, hv₀_cl, hv₀_not_Z⟩ := hClaim2 + have hv₀A : ({v₀} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v₀, hv₀H, rfl⟩) + have hzv₀ : d z {v₀} ≤ lam₁ := hZone.dist_le {v₀} hv₀A (singleton_subset_iff.mpr hv₀_cl) + have hrv₀ : ∀ i : Fin k, θ' + 12 * μ + 14 < d (r i) {v₀} := by + intro i + by_contra hle + exact hv₀_not_Z i (mem_iUnion₂.mpr ⟨{v₀}, ⟨hv₀A, Nat.not_lt.mp hle⟩, mem_singleton v₀⟩) + -- Claim (3): For `i : Fin k`, `θ' + 9 * μ + 11 < d z (r i)`. + have hClaim3 : ∀ i : Fin k, θ' + 9 * μ + 11 < d z (r i) := by + intro i + have hriA : r i ∈ H.A := Or.inr (hr_eye i).1 + have hgt := hrv₀ i + have htri := hd_tri (r i) hriA z hZone.z_mem {v₀} hv₀A + have hsym := hd_symm (r i) hriA z hZone.z_mem + omega + have hri_H' : ∀ i : Fin k, r i ∈ H'.R := by + intro i + have hriA : r i ∈ H.A := Or.inr (hr_eye i).1 + have hgt := hClaim3 i + exact region_mem_R_of_mem_A hS (hr_eye i).1 (hAtoms (r i) hriA (by omega)) + have hE_ne : H.E.Nonempty := edges_nonempty_of_tangle hS hMetric.1 (by omega) + -- Claim (4): For `i : Fin k`, `θ' ≤ d₁ Λ (r i)`. + have hClaim4 : ∀ i : Fin k, θ' ≤ d₁ Λ (r i) := by + exact distance_from_cleared_region (S := S) (α := α) (β := β) G H η θ θ' μ k T d r z + Λ T₁ d₁ hr_eye hZone hClear hS hd_symm hd_tri hd_inc hΛA hSubH' v₀ hv₀H hv₀_cl hv₀A hrv₀ + hri_H' hE_ne + -- Construct the lifted embedding `η'_G : SpanEmbedding H' G`. + have hG₀_le_G : G₀ ≤ G := section7G0_le G H η d θ' μ r + let η'_G : SpanEmbedding H' G := + { imageGraph := η'.imageGraph + vMap := η'.vMap + eMap := η'.eMap + imageGraph_le := η'.imageGraph_le.trans hG₀_le_G + bijOn_v := η'.bijOn_v + bijOn_e := η'.bijOn_e + inc_iff := η'.inc_iff } + have hη'_G_v : ∀ v ∈ H'.V, η'_G.vMap v = η.vMap v := + fun v hv => (hη'_v v hv).trans (hη₀_v v (hSubH'.1 hv)) + have hη'_G_e : ∀ e ∈ H'.E, η'_G.eMap e = η.eMap e := + fun e he => (hη'_e e he).trans (hη₀_e e (hSubH'.2 he)) + have hV_sub_im : V(η'_G.imageGraph) ⊆ V(η.imageGraph) := by + rw [← η'.bijOn_v.image_eq, ← η.bijOn_v.image_eq] + rintro _ ⟨v, hv, rfl⟩ + exact ⟨v, hSubH'.1 hv, (hη'_G_v v hv).symm⟩ + have hE_sub_im : E(η'_G.imageGraph) ⊆ E(η.imageGraph) := by + rw [← η'.bijOn_e.image_eq, ← η.bijOn_e.image_eq] + rintro _ ⟨e, he, rfl⟩ + exact ⟨e, hSubH'.2 he, (hη'_G_e e he).symm⟩ + -- Claim (5): For `i : Fin k`, `r i` is an eye of `H', T₁` in `G`. + have hClaim5 : ∀ i : Fin k, IsDrawingEye G H' η'_G θ₁ T₁ (r i) := by + exact eye_survives_clearing (S := S) (α := α) (β := β) G H η θ θ' lam' μ k T d r z Λ T₁ d₁ + hMetric hμ12 hlam'4 hθ' hθ'_gt hr_eye hZone hS hd_tri hd_inc hΛA h2cell' hd₁_refl + hComp₁ hAtoms v₀ hzv₀ hClaim3 hri_H' hE_ne hClaim4 η'_G hη'_G_v hV_sub_im hE_sub_im + -- Also `Λ` is an eye of `H', T₁` in `G`. + have hEyeΛ_G : IsDrawingEye G H' η'_G θ₁ T₁ Λ := by + rcases hEyeΛ with + ⟨hΛ_R, C, a, b, c, d_v, P₁, P₂, hC_circ, hC_sub, hC_U, ha, hb, hc, hd_v, + hnodup, hord, hFree, hdisj, hP₁, hP₂⟩ + have hFree' : IsFreeSet H'.toHypergraph T₁ θ₁ {a, b, c, d_v} := hθ₁_eq ▸ hFree + have hP₁' : IsHPathWithEnds G η'_G.imageGraph P₁ (η'_G.vMap a) (η'_G.vMap c) := + ⟨η'_G.imageGraph_le, ⟨hP₁.2.1.1.trans hG₀_le_G, hP₁.2.1.2⟩, hP₁.2.2⟩ + have hP₂' : IsHPathWithEnds G η'_G.imageGraph P₂ (η'_G.vMap b) (η'_G.vMap d_v) := + ⟨η'_G.imageGraph_le, ⟨hP₂.2.1.1.trans hG₀_le_G, hP₂.2.1.2⟩, hP₂.2.2⟩ + exact ⟨hΛ_R, C, a, b, c, d_v, P₁, P₂, hC_circ, hC_sub, hC_U, ha, hb, hc, hd_v, + hnodup, hord, hFree', hdisj, hP₁', hP₂'⟩ + -- Claim (6): By (4.6) and (5.2), `H', η'_G, T₁` is `(lam', μ)`-flat. + have hV_rearr : ∀ v ∈ H.V, lam₁ < d z {v} → v ∈ H'.V ∧ η'_G.vMap v = η.vMap v := by + intro v hv hlt + have hv' : v ∈ H'.V := + vertex_mem_V_of_mem_A hS hv (hAtoms {v} (Or.inl (Or.inl ⟨v, hv, rfl⟩)) hlt) + exact ⟨hv', hη'_G_v v hv'⟩ + have hE_rearr : ∀ e ∈ H.E, lam₁ < d z e → e ∈ H'.E ∧ η'_G.eMap e = η.eMap e := by + intro e he hlt + have he' : e ∈ H'.E := + edge_mem_E_of_mem_A hS he (hAtoms e (Or.inl (Or.inr he)) hlt) + exact ⟨he', hη'_G_e e he'⟩ + have hRearr : IsRearrangedWithin G H H' η η'_G θ_star θ lam₁ T_star T T₁ d d₁ z := + theorem_4_6_proof G H H' η η'_G θ_star θ lam₁ T_star T T₁ d d₁ z + hFlat.isSpan hMetric hZone.z_mem (by omega) (by omega) hRigid' h2cell' + hAtoms hV_rearr hE_rearr hComp₁ + have hFlat₁ : IsFlatSpan G H' η'_G θ_star θ₁ lam' μ T_star T₁ := + theorem_5_2_proof G H H' η η'_G θ_star θ lam lam₁ lam' μ T_star T T₁ d d₁ z + hFlat (by omega) (by omega) hlam'4 hlam hRearr + -- Claim (7): Apply (7.1) to `H', η'_G, T₁, d₁` with `k + 1` eyes `Fin.snoc r Λ`. + let r' : Fin (k + 1) → Set S := Fin.snoc r Λ + have hr'_inj : Injective r' := by + intro i j hij + induction i using Fin.lastCases with + | last => + induction j using Fin.lastCases with + | last => rfl + | cast j₀ => + exfalso + simp only [r', Fin.snoc_last, Fin.snoc_castSucc] at hij + have hge := hClaim4 j₀ + rw [← hij, hd₁_refl Λ hΛA] at hge + omega + | cast i₀ => + induction j using Fin.lastCases with + | last => + exfalso + simp only [r', Fin.snoc_last, Fin.snoc_castSucc] at hij + have hge := hClaim4 i₀ + rw [hij, hd₁_refl Λ hΛA] at hge + omega + | cast j₀ => + simp only [r', Fin.snoc_castSucc] at hij + exact congrArg Fin.castSucc (hr_inj hij) + have hr'_eye : ∀ i : Fin (k + 1), IsDrawingEye G H' η'_G θ₁ T₁ (r' i) := by + intro i + induction i using Fin.lastCases with + | last => + simp only [r', Fin.snoc_last] + exact hEyeΛ_G + | cast i₀ => + simp only [r', Fin.snoc_castSucc] + exact hClaim5 i₀ + have hr'_dist : ∀ i j : Fin (k + 1), i ≠ j → θ' ≤ d₁ (r' i) (r' j) := by + intro i j hij + induction i using Fin.lastCases with + | last => + induction j using Fin.lastCases with + | last => exact False.elim (hij rfl) + | cast j₀ => + simp only [r', Fin.snoc_last, Fin.snoc_castSucc] + exact hClaim4 j₀ + | cast i₀ => + induction j using Fin.lastCases with + | last => + simp only [r', Fin.snoc_last, Fin.snoc_castSucc] + rw [hd₁_symm (r i₀) (Or.inr (hri_H' i₀)) Λ hΛA] + exact hClaim4 i₀ + | cast j₀ => + simp only [r', Fin.snoc_castSucc] + have hij₀ : i₀ ≠ j₀ := fun h => hij (congrArg Fin.castSucc h) + have hd_ij := hr_dist i₀ j₀ hij₀ + have hbd := (hClear.dist_bounds (r i₀) (Or.inr (hr_eye i₀).1) (r j₀) (Or.inr (hr_eye j₀).1) + (r i₀) (Or.inr (hri_H' i₀)) (r j₀) (Or.inr (hri_H' j₀)) Subset.rfl Subset.rfl).1 + omega + exact theorem_7_1_proof G H' η'_G θ_star θ₁ θ' lam' μ (k + 1) T_star T₁ d₁ + hFlat₁ hM₁ (by omega) hθ' (by omega) (by omega) ⟨r', hr'_inj, hr'_eye, hr'_dist⟩ + +/-- Statement of Graph Minors XV, (7.4) (page 137): +"If (S1) does not hold, there is a* $\mathcal{T}$*-local 3-segregation* $\mathcal{S}_0$ *of* +$G_0$ *and an arrangement* $\alpha_0$ *of it in* $\Sigma$ *compatible with* $H$." -/ +def GM15Theorem74Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ θ' lam lam' μ k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin k → Set S) + (η₀ : SpanEmbedding H (section7G0 G H η d θ' μ r)), + IsFlatSpan G H η θ_star θ lam μ T_star T → + HasTangleMetric H θ T d → + 12 ≤ μ → Even μ → 4 ≤ lam' → 4 * lam' + μ + 2 ≤ θ' → 6 * μ + 14 < θ' → + 6 * (3 * μ + 3) + 5 * lam' + 3 * μ + 4 ≤ lam → + θ' + 16 * μ + 17 ≤ θ → + Injective r → + (∀ i : Fin k, IsDrawingEye G H η θ T (r i)) → + (∀ i j : Fin k, i ≠ j → d (r i) (r j) = θ) → + (∀ v ∈ H.V, η₀.vMap v = η.vMap v) → + (∀ e ∈ H.E, η₀.eMap e = η.eMap e) → + ¬ IsMuSteppedSpan (section7G0 G H η d θ' μ r) H η₀ d μ → + ¬ Section7S1 S G θ_star T_star k μ lam' θ' → + ∃ (S₀ : Set (Society α β)) (α₀_disc : Society α β → Set S) (α₀_pt : α → S), + IsThreeSegregation (section7G0 G H η d θ' μ r) S₀ ∧ + IsTangleLocal (section7G0 G H η d θ' μ r) H η₀ T S₀ ∧ + IsSurfaceArrangement S₀ α₀_disc α₀_pt ∧ + IsCompatibleWith (section7G0 G H η d θ' μ r) H η₀ S₀ α₀_disc α₀_pt + +/-- **Graph Minors XV, (7.4)** (page 137): +If `(S1)` does not hold, there is a `T`-local 3-segregation `S₀` of `G₀` and an arrangement `α₀` +of it in `Σ` compatible with `H`. +Proved from `(7.3)` (`theorem_7_3_proof`) and Graph Minors XIV, `(10.1)` +(`GM14Theorem101Statement`). -/ +theorem theorem_7_4_proof + : + GM15Theorem74Statement.{u, v, w} := by + intro S _ _ α β G H η θ_star θ θ' lam lam' μ k T_star T d r η₀ + hFlat hMetric hμ12 hμ_even hlam'4 hθ' hθ'_gt hlam hθ hr_inj hr_eye hr_dist + hη₀_v hη₀_e hnot_step hnot_S1 + have hClosed : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => by + by_contra hx + exact Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + have h16μ : 16 * μ + 17 ≤ θ := le_trans (Nat.le_add_left _ _) hθ + have h12μ : θ' + 12 * μ + 14 ≤ θ := by + have : θ' + 12 * μ + 14 ≤ θ' + 16 * μ + 17 := by omega + exact this.trans hθ + have hG₀_le : section7G0 G H η d θ' μ r ≤ G := section7G0_le G H η d θ' μ r + have hfinV₀ : V(section7G0 G H η d θ' μ r).Finite := + hFlat.isSpan.isControlling.isTangle_star.finite_V.subset hG₀_le.vertexSet_mono + have hfinE₀ : E(section7G0 G H η d θ' μ r).Finite := + hFlat.isSpan.isControlling.isTangle_star.finite_E.subset hG₀_le.edgeSet_mono + apply GraphMinor.GM14.gm14_theorem_10_1.{u, v, w} (section7G0 G H η d θ' μ r) H η₀ θ μ T d + hClosed hConn hfinV₀ hfinE₀ + hFlat.isSpan.isRigid hMetric hμ12 hμ_even h16μ hnot_step + intro z Λ T' d' η' hZone hClear hRigid' hη'_v hη'_e hEye + exact hnot_S1 (theorem_7_3_proof G H η θ_star θ θ' lam lam' μ k + T_star T d r η₀ z Λ T' d' η' + hFlat hMetric hμ12 hlam'4 hθ' hθ'_gt hlam h12μ hr_inj hr_eye hr_dist + hη₀_v hη₀_e hZone hClear hRigid' hη'_v hη'_e hEye) + +/-- Data and properties produced by Graph Minors XV, (7.5) (page 138) for an eye `r_i` (`i : Fin +k`). -/ +structure Section75EyeData {S : Type w} [TopologicalSpace S] [T2Space S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ θ' π beta μ : ℕ) {k : ℕ} + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin k → Set S) + (S₀ : Set (Society α β)) (α₀_disc : Society α β → Set S) (α₀_pt : α → S) + (i : Fin k) where + /-- The `(3β + 3)`-zone `Λ_i` around `r_i`. -/ + Λ : Set S + /-- The closed disc `Δ_i ⊆ Σ`. -/ + Δ : Set S + /-- The cleared `(12β + 14)`-compression `T₁` of `T` in `H ∩ (Σ - Λ_i)`. -/ + T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S)) + /-- The metric `d₁` of `T₁`. -/ + d₁ : Set S → Set S → ℕ + /-- The restricted span embedding of `H ∩ (Σ - Λ_i)` into `G`. -/ + clearedEmbedding : SpanEmbedding (clearedSubdrawing H Λ) G + /-- The society `(G₀ ∪ J_i, Ω_i)` where `Ω_i` is a natural order of `V(H) ∩ bd(Λ_i)` from + `bd(Λ_i)`. -/ + clearedSociety : Society α β + /-- The society `(G_i*, Ω_i*) = (J_i ∪ α₀⁻¹(Δ_i), α₀⁻¹(bd(Δ_i)))`. -/ + localSociety : Society α β + /-- `Λ_i` is a `(3β + 3)`-zone around `r_i`. -/ + isZone : IsLambdaZoneAround H d (3 * beta + 3) (r i) Λ + /-- `T₁` is the tangle of order `θ - 4(3β + 3) - 2` obtained by clearing `Λ_i`. -/ + isCleared : IsClearedTangle H T d θ (3 * beta + 3) Λ T₁ d₁ + /-- `H ∩ (Σ - Λ_i), clearedEmbedding, T₁` is a `Σ`-span of order `θ - 4(3β + 3) - 2` obtained from + `H, η, T` + by rearranging within `3β + 3` of `r_i`. -/ + isRearranged : IsRearrangedWithin G H (clearedSubdrawing H Λ) η clearedEmbedding + θ_star θ (3 * beta + 3) T_star T T₁ d d₁ (r i) + /-- `(H ∩ (Σ - Λ_i)) ∩ bd(Λ_i)` is a circuit and `bd(Λ_i)` is an `O`-arc. -/ + isCircuit_bd : ((clearedSubdrawing H Λ).interSet (subBd Λ)).IsCircuit + /-- `Λ_i` is a region of `H ∩ (Σ - Λ_i)`. -/ + mem_R_cleared : Λ ∈ (clearedSubdrawing H Λ).R + /-- `Δ_i` is a closed disc with `bd(Δ_i)` `α₀`-normal. -/ + isClosedDisc_Δ : IsClosedDisc Δ + /-- `bd(Δ_i)` is `α₀`-normal. -/ + isNormal_bd : IsArrangementNormal S₀ α₀_disc α₀_pt (subBd Δ) + /-- `clearedSociety.G ≤ G`. -/ + soc_Λ_le : clearedSociety.G ≤ G + /-- `clearedSociety.G = G₀ ∪ J_i`. -/ + soc_Λ_G : clearedSociety.G = subgraphUnion G (section7G0 G H η d θ' μ r) + (eyeBridgeUnion G H η d θ' μ + (r i)) + /-- `clearedEmbedding` agrees with `η` on vertices of `H ∩ (Σ - Λ_i)`. -/ + vMap_eq : ∀ v ∈ (clearedSubdrawing H Λ).V, clearedEmbedding.vMap v = η.vMap v + /-- `clearedEmbedding` agrees with `η` on edges of `H ∩ (Σ - Λ_i)`. -/ + eMap_eq : ∀ e ∈ (clearedSubdrawing H Λ).E, clearedEmbedding.eMap e = η.eMap e + /-- `clearedSociety.Ω.bar = clearedEmbedding.vMap '' ((clearedSubdrawing H Λ).V ∩ subBd Λ)`. -/ + soc_Λ_bar : clearedSociety.Ω.bar = clearedEmbedding.vMap '' ((clearedSubdrawing H Λ).V ∩ subBd Λ) + /-- `Ω_i` is a natural order of `V(H) ∩ bd(Λ_i)` from `bd(Λ_i)`. -/ + soc_Λ_natural : ∃ inv_v : α → S, + (∀ x ∈ clearedSociety.Ω.bar, inv_v x ∈ (clearedSubdrawing H Λ).V ∩ subBd Λ + ∧ clearedEmbedding.vMap (inv_v x) = x) ∧ + IsNaturalOrderFrom inv_v clearedSociety.Ω (subBd Λ) + /-- `G_i* = J_i ∪ α₀⁻¹(Δ_i)`. -/ + soc_star_G : localSociety.G = subgraphUnion G (eyeBridgeUnion G H η d θ' μ (r i)) + (arrangementPullbackGraph (section7G0 G H η d θ' μ r) S₀ α₀_disc α₀_pt Δ) + /-- `Ω_i* = α₀⁻¹(bd(Δ_i))`. -/ + soc_star_Ω : IsPullbackPerm S₀ α₀_pt (subBd Δ) localSociety.Ω + /-- `Λ_i ⊆ Δ_i`. -/ + Λ_subset_Δ : Λ ⊆ Δ + /-- `(i)` `V(J_i ∩ H) ⊆ Δ_i`. -/ + bridge_V_subset_Δ : ∀ v ∈ H.V, η.vMap v ∈ V(eyeBridgeUnion G H η d θ' μ (r i)) → v ∈ Δ + /-- `(ii)` `d(r_i, x) ≤ 3β + 6` for all `x ∈ A(H)` with `x ∩ Δ_i ≠ ∅`. -/ + dist_le_of_inter_Δ : ∀ x ∈ H.A, (x ∩ Δ).Nonempty → d (r i) x ≤ 3 * beta + 6 + /-- `(iii)` `x ⊆ Δ_i - bd(Δ_i)` for every `x ∈ A(H)` with `d(r_i, x) < β`. -/ + subset_interior_Δ_of_dist_lt : ∀ x ∈ H.A, d (r i) x < beta → x ⊆ Δ \ subBd Δ + /-- `(iv)` `H ∩ closure(Σ - Δ_i)` has a circuit. -/ + hasCircuit_compl_Δ : ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing (H.interSet (closure + (univ \ Δ))) + /-- `(iv)` `H ∩ closure(Σ - Λ_i)` is rigid (Graph Minors XIV, (9.6)(iii)). The zone `Λ_i` is + open, so `Σ - Λ_i` is closed and this is `H ∩ (Σ - Λ_i)`. -/ + isRigid_cleared : IsRigid (clearedSubdrawing H Λ) + /-- Either (a) there is a crooked transaction `P_set` of cardinality `≥ π` in `clearedSociety` + whose ends + are + free with respect to `T₁` and whose paths are `η(H ∩ (Σ - Λ_i))`-paths, or (b) `localSociety` has + no + crooked transaction of cardinality `π`. -/ + dichotomy : + (∃ (P_set : Set (Graph α β)) (X : Set S), + clearedSociety.IsCrookedTransaction P_set ∧ + π ≤ P_set.ncard ∧ + (∀ P ∈ P_set, ∀ a b : α, + clearedSociety.IsOmegaPathWithEnds P a b → + IsHPathWithEnds G clearedEmbedding.imageGraph P a b) ∧ + X ⊆ (clearedSubdrawing H Λ).V ∩ subBd Λ ∧ + clearedSociety.transactionEnds P_set = clearedEmbedding.vMap '' X ∧ + IsFreeSet (clearedSubdrawing H Λ).toHypergraph T₁ (θ - 4 * (3 * beta + 3) - 2) X) ∨ + (∀ P_set : Set (Graph α β), localSociety.IsCrookedTransaction P_set → P_set.ncard ≠ π) + +/-- Statement of Graph Minors XV, (7.5) (page 138): +"For $1 \le i \le k$ there is a $(3\beta + 3)$-zone $\Lambda_i$ around $r_i$ and a closed disc +$\Delta_i \subseteq \Sigma$ with $\text{bd}(\Delta_i)$ $\alpha_0$-normal, with the following +properties: +(i) $\Delta_1, \dots, \Delta_k$ are mutually disjoint, and for $1 \le i \le k$, $V(J_i \cap H) +\subseteq \Delta_i$ +(ii) $d(r_i, x) \le 3\beta + 6$ for all $x \in A(H)$ with $x \cap \Delta_i \ne \emptyset$ +(iii) $x \subseteq \Delta_i - \text{bd}(\Delta_i)$ for every $x \in A(H)$ with $d(r_i, x) < \beta$ +(iv) $H \cap \overline{\Sigma - \Delta_i}$ has a circuit, and $H \cap \overline{\Sigma - \Lambda_i}$ +is rigid +(v) for $1 \le i \le k$, one of the following holds: +(a) there is a crooked transaction $\mathcal{P}$ of cardinality $\pi$ in $(G_0 \cup J_i, \Omega_i)$ +(where $\Omega_i$ is a natural order of $V(H) \cap \text{bd}(\Lambda_i)$ from +$\text{bd}(\Lambda_i)$) +such that $V(\mathcal{P})$ is free with respect to the $(12\beta + 14)$-compression of +$\mathcal{T}$ in $H \cap (\Sigma - \Lambda_i)$, and each $P \in \mathcal{P}$ meets $H \cap (\Sigma +- \Lambda_i)$ precisely in the ends of $P$ +(b) there is no crooked transaction of cardinality $\pi$ in $(J_i \cup \alpha_0^{-1}(\Delta_i), +\alpha_0^{-1}(\text{bd}(\Delta_i)))$." -/ +def GM15Theorem75Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ θ' lam π beta μ k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin k → Set S) + (η₀ : SpanEmbedding H (section7G0 G H η d θ' μ r)) + (S₀ : Set (Society α β)) (α₀_disc : Society α β → Set S) (α₀_pt : α → S), + IsFlatSpan G H η θ_star θ lam μ T_star T → + HasTangleMetric H θ T d → + 1 ≤ μ → 2 ≤ π → π ≠ 3 → beta = 2 * π + 8 → + θ' + 13 * μ + 14 ≤ beta → 16 * beta + 17 ≤ θ → 6 * beta + 12 < θ → + Injective r → + (∀ i : Fin k, IsDrawingEye G H η θ T (r i)) → + (∀ i j : Fin k, i ≠ j → d (r i) (r j) = θ) → + (∀ v ∈ H.V, η₀.vMap v = η.vMap v) → + (∀ e ∈ H.E, η₀.eMap e = η.eMap e) → + IsThreeSegregation (section7G0 G H η d θ' μ r) S₀ → + IsTangleLocal (section7G0 G H η d θ' μ r) H η₀ T S₀ → + IsSurfaceArrangement S₀ α₀_disc α₀_pt → + IsCompatibleWith (section7G0 G H η d θ' μ r) H η₀ S₀ α₀_disc α₀_pt → + ∃ D : ∀ i : Fin k, Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i, + Pairwise (fun i j : Fin k => Disjoint (D i).Δ (D j).Δ) + +/-- **Graph Minors XV, (7.5), Claim (1)** (page 138): +"For* $1 \le i \le k$, *every* $v \in V(J_i \cap H)$ *satisfies* $d(r_i, v) \le \theta' + +13\mu + 13$." -/ +theorem theorem_7_5_claim_1 {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ θ' lam μ k : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {r : Fin k → Set S} + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hMetric : HasTangleMetric H θ T d) + (hμ1 : 1 ≤ μ) + (hr_eye : ∀ i : Fin k, IsDrawingEye G H η θ T (r i)) + (i : Fin k) {v : S} (hvH : v ∈ H.V) + (hvJ : η.vMap v ∈ V(eyeBridgeUnion G H η d θ' μ (r i))) : + d (r i) {v} ≤ θ' + 13 * μ + 13 := by + have hS : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + obtain ⟨_, _, _, _, hd_tri, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + simp only [eyeBridgeUnion, vertexSet_subgraphSUnion, mem_iUnion] at hvJ + obtain ⟨B, ⟨hB, _, ⟨hzB, u, ⟨huH, huZ⟩, rfl⟩⟩, hvB⟩ := hvJ + obtain ⟨a, ⟨haA, hd_ra⟩, hua⟩ := mem_iUnion₂.mp huZ + have huA : ({u} : Set S) ∈ H.A := Or.inl (Or.inl ⟨u, huH, rfl⟩) + have hua_eq : {u} = a := atom_eq_of_mem huA haA (mem_singleton u) hua + have hd_ru : d (r i) {u} ≤ θ' + 12 * μ + 14 := hua_eq ▸ hd_ra + by_cases huv : u = v + · subst huv + omega + · have huv_map : η.vMap u ≠ η.vMap v := fun hEq => huv (η.bijOn_v.injOn huH hvH hEq) + obtain ⟨P, hP⟩ := exists_isHPathWithEnds_of_isBridge hB hzB hvB + (η.bijOn_v.mapsTo huH) (η.bijOn_v.mapsTo hvH) huv_map + have hd_uv : d {u} {v} < μ := by + by_contra hge + have hord := hFlat.order_ge + exact not_isMuSteppedSpan_of_isFlatSpan hFlat hMetric (by omega) + ⟨P, u, v, huH, hvH, hP, Nat.not_lt.mp hge⟩ + have hriA : r i ∈ H.A := Or.inr (hr_eye i).1 + have hvA : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hvH, rfl⟩) + have htri := hd_tri (r i) hriA {u} huA {v} hvA + omega + +/-- **Graph Minors XV, (7.5)** (pages 138–139): +For `1 ≤ i ≤ k`, there is a `(3β + 3)`-zone `Λ_i` around `r_i` and a closed disc `Δ_i ⊆ Σ` with +`bd(Δ_i)` `α₀`-normal satisfying `(i)`–`(v)` of `(7.5)`. +Proved from Claim `(1)` (`theorem_7_5_claim_1`), `(4.6)` (`theorem_4_6_proof`), and Graph Minors +XIV, +`(9.6)` (`GM14Theorem96Statement`). -/ +theorem theorem_7_5_proof + : + GM15Theorem75Statement.{u, v, w} := by + intro S _ _ α β G H η θ_star θ θ' lam π beta μ k T_star T d r η₀ S₀ α₀_disc α₀_pt + hFlat hMetric hμ1 hπ2 hπ3 hbeta_eq hθ'_beta h16beta h6beta + hr_inj hr_eye hr_dist hη₀_v hη₀_e hThree hLocal hArr₀ hCompat₀ + have hS : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + obtain ⟨_, _, _, hd_symm, hd_tri, _⟩ := gm11_theorem_9_1 H θ T d hS hConn hMetric + have hπ1 : π ≠ 1 := by omega + have hbeta_ge : 2 * π + 8 ≤ beta := by omega + have hbeta_even : Even beta := ⟨π + 4, by omega⟩ + have hex : ∀ i : Fin k, + Nonempty (Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i) := by + intro i + let B_J : Set (Graph α β) := + {B : Graph α β | IsBridge G η.imageGraph B ∧ + (V(B) ∩ (η.vMap '' (H.V ∩ eyeAtomZone H d θ' μ (r i)))).Nonempty} + let B_rem : Set (Graph α β) := + {B : Graph α β | IsBridge G η.imageGraph B ∧ + Disjoint V(B) (⋃ j : Fin k, η.vMap '' (H.V ∩ eyeAtomZone H d θ' μ (r j)))} + let J := eyeBridgeUnion G H η d θ' μ (r i) + let G₀ := section7G0 G H η d θ' μ r + let G_i := subgraphUnion G G₀ J + have hDisj_B : Disjoint B_J B_rem := by + refine Set.disjoint_left.mpr fun B hBJ hBrem => ?_ + obtain ⟨x, hxB, hxZ⟩ := hBJ.2 + exact Set.disjoint_left.mp hBrem.2 hxB (mem_iUnion.mpr ⟨i, hxZ⟩) + have hDist_J : ∀ v ∈ H.V, η.vMap v ∈ V(J) → d (r i) {v} < beta := by + intro v hvH hvJ + have hle := theorem_7_5_claim_1 hFlat hMetric hμ1 hr_eye i hvH hvJ + omega + have hriA : r i ∈ H.A := Or.inr (hr_eye i).1 + obtain ⟨Λ, Δ, T₁, d₁, clearedEmbedding, clearedSociety, localSociety, + hZone, hClear, hDisc_Δ, hNorm_bd, hΛ_sub_Δ, + hDist_Δ, hSub_int, hCirc_compl, hRigid_Λ, + hη_Λ_v, hη_Λ_e, hsoc_Λ_G, hsoc_Λ_bar, hsoc_Λ_nat, + hsoc_star_G, hsoc_star_Ω, hDich⟩ := + GraphMinor.GM14.gm14_theorem_9_6.{u, v, w} G G_i G₀ J B_J B_rem H η η₀ θ π beta T d + (r i) S₀ α₀_disc α₀_pt + hS hConn hFlat.isSpan.isControlling.isTangle_star.finite_V + hFlat.isSpan.isControlling.isTangle_star.finite_E + hFlat.isSpan.isRigid hMetric hriA + hπ1 hπ3 hbeta_ge hbeta_even h16beta + (fun _ hB => hB.1) (fun _ hB => hB.1) hDisj_B + rfl rfl rfl hη₀_v hη₀_e hDist_J hThree hLocal hArr₀ hCompat₀ + have hG₀_le : G₀ ≤ G := section7G0_le G H η d θ' μ r + have hJ_le : J ≤ G := subgraphSUnion_le (fun _ hB => hB.1.2.1) + have hsoc_Λ_le : clearedSociety.G ≤ G := by + rw [hsoc_Λ_G] + exact subgraphUnion_le hG₀_le hJ_le + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + let H' := clearedSubdrawing H Λ + let lam₁ := 3 * beta + 3 + let θ₁ := θ - (4 * lam₁ + 2) + have hθ₁_eq : θ - 4 * lam₁ - 2 = θ₁ := by omega + obtain ⟨hΛR, hatom'⟩ := clearedSubdrawing_mem_R_and_atom hZone + have hSubH' : H'.IsSubdrawing H := clearedSubdrawing_isSubdrawing H Λ + have h2cell' : (PaintingOrDrawing.drawing H').IsTwoCell := + clearedSubdrawing_isTwoCell hMetric.1.1 hZone + obtain ⟨hV_H', hE_H'⟩ := clearedSubdrawing_V_and_E hZone + have hM₁ : HasTangleMetric H' θ₁ T₁ d₁ := hθ₁_eq ▸ hClear.hasMetric + have hComp₁ : IsLambdaCompression H H' θ (4 * lam₁ + 2) T T₁ d d₁ := by + refine ⟨by omega, hMetric, hM₁, fun σ₁ σ₂ => ?_⟩ + obtain ⟨a₁, ha₁, hσ₁⟩ := exists_atom_of_point H σ₁ + obtain ⟨a₂, ha₂, hσ₂⟩ := exists_atom_of_point H σ₂ + obtain ⟨a₁', ha₁', hσ₁'⟩ := exists_atom_of_point H' σ₁ + obtain ⟨a₂', ha₂', hσ₂'⟩ := exists_atom_of_point H' σ₂ + rw [pointDist_eq_of_mem_atom ha₁ ha₂ hσ₁ hσ₂, pointDist_eq_of_mem_atom ha₁' ha₂' hσ₁' hσ₂'] + have hsub₁ := atom_subset_of_isSubdrawing hSubH' ha₁ ha₁' hσ₁ hσ₁' + have hsub₂ := atom_subset_of_isSubdrawing hSubH' ha₂ ha₂' hσ₂ hσ₂' + have hle := (hClear.dist_bounds a₁ ha₁ a₂ ha₂ a₁' ha₁' a₂' ha₂' hsub₁ hsub₂).1 + omega + have hAtoms : ∀ a ∈ H.A, lam₁ < d (r i) a → a ∈ H'.A := by + intro a ha hlt + have hnot_sub : ¬ a ⊆ closure Λ := fun hsub => by + have := hZone.dist_le a ha hsub + omega + obtain ⟨σ, hσa, hσ_not_cl⟩ := Set.not_subset.mp hnot_sub + have hσ_not_Λ : σ ∉ Λ := fun h => hσ_not_cl (subset_closure h) + obtain ⟨a', ha', hσa'⟩ := exists_atom_of_point H' σ + have ha'_ne : a' ≠ Λ := fun hEq => hσ_not_Λ (hEq ▸ hσa') + have ha'H : a' ∈ H.A := hatom' a' ha' ha'_ne + exact atom_eq_of_mem ha ha'H hσa hσa' ▸ ha' + have hV_rearr : ∀ v ∈ H.V, lam₁ < d (r i) {v} → + v ∈ H'.V ∧ clearedEmbedding.vMap v = η.vMap v := by + intro v hv hlt + have hv' : v ∈ H'.V := + vertex_mem_V_of_mem_A hS hv (hAtoms {v} (Or.inl (Or.inl ⟨v, hv, rfl⟩)) hlt) + exact ⟨hv', hη_Λ_v v hv'⟩ + have hE_rearr : ∀ e ∈ H.E, lam₁ < d (r i) e → + e ∈ H'.E ∧ clearedEmbedding.eMap e = η.eMap e := by + intro e he hlt + have he' : e ∈ H'.E := + edge_mem_E_of_mem_A hS he (hAtoms e (Or.inl (Or.inr he)) hlt) + exact ⟨he', hη_Λ_e e he'⟩ + have hRearr : IsRearrangedWithin G H H' η clearedEmbedding + θ_star θ lam₁ T_star T T₁ d d₁ (r i) := + theorem_4_6_proof G H H' η clearedEmbedding + θ_star θ lam₁ T_star T T₁ d d₁ (r i) + hFlat.isSpan hMetric hriA (by omega) (by omega) hRigid_Λ h2cell' + hAtoms hV_rearr hE_rearr hComp₁ + obtain ⟨_, hCirc_bd, _⟩ := clearedSubdrawing_boundary hZone + have hBridge_V : ∀ v ∈ H.V, η.vMap v ∈ V(J) → v ∈ Δ := fun v hvH hvJ => + (hSub_int {v} (.inl (.inl ⟨v, hvH, rfl⟩)) (hDist_J v hvH hvJ) (mem_singleton v)).1 + exact ⟨{ + Λ := Λ + Δ := Δ + T₁ := T₁ + d₁ := d₁ + clearedEmbedding := clearedEmbedding + clearedSociety := clearedSociety + localSociety := localSociety + isZone := hZone + isCleared := hClear + isRearranged := hRearr + isCircuit_bd := hCirc_bd + mem_R_cleared := hΛR + isClosedDisc_Δ := hDisc_Δ + isNormal_bd := hNorm_bd + soc_Λ_le := hsoc_Λ_le + soc_Λ_G := hsoc_Λ_G + vMap_eq := hη_Λ_v + eMap_eq := hη_Λ_e + soc_Λ_bar := hsoc_Λ_bar + soc_Λ_natural := hsoc_Λ_nat + soc_star_G := hsoc_star_G + soc_star_Ω := hsoc_star_Ω + Λ_subset_Δ := hΛ_sub_Δ + bridge_V_subset_Δ := hBridge_V + dist_le_of_inter_Δ := hDist_Δ + subset_interior_Δ_of_dist_lt := hSub_int + hasCircuit_compl_Δ := hCirc_compl + isRigid_cleared := hRigid_Λ + dichotomy := hDich.imp_right (fun hno P_set hCrook hEq => hno P_set hCrook + (le_of_eq hEq.symm)) + }⟩ + let D : ∀ i : Fin k, Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i + := + fun i => Classical.choice (hex i) + refine ⟨D, fun i j hij => Set.disjoint_left.mpr fun σ hσi hσj => ?_⟩ + obtain ⟨x, hxA, hσx⟩ := exists_atom_of_point H σ + have hdi : d (r i) x ≤ 3 * beta + 6 := (D i).dist_le_of_inter_Δ x hxA ⟨σ, hσx, hσi⟩ + have hdj : d (r j) x ≤ 3 * beta + 6 := (D j).dist_le_of_inter_Δ x hxA ⟨σ, hσx, hσj⟩ + have hriA : r i ∈ H.A := Or.inr (hr_eye i).1 + have hrjA : r j ∈ H.A := Or.inr (hr_eye j).1 + have htri := hd_tri (r i) hriA x hxA (r j) hrjA + have hsym := hd_symm x hxA (r j) hrjA + have hd_ij := hr_dist i j hij + omega + +/-- Statement of Graph Minors XV, (7.6) (page 139): +"$G^*_1, \dots, G^*_k$ *are mutually disjoint." -/ +def GM15Theorem76Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ θ' lam π beta μ k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin k → Set S) + (η₀ : SpanEmbedding H (section7G0 G H η d θ' μ r)) + (S₀ : Set (Society α β)) (α₀_disc : Society α β → Set S) (α₀_pt : α → S) + (D : ∀ i : Fin k, Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i), + IsFlatSpan G H η θ_star θ lam μ T_star T → + HasTangleMetric H θ T d → + 1 ≤ μ → 2 * (θ' + 12 * μ + 14) + μ ≤ θ → + Injective r → + (∀ i : Fin k, IsDrawingEye G H η θ T (r i)) → + (∀ i j : Fin k, i ≠ j → d (r i) (r j) = θ) → + (∀ v ∈ H.V, η₀.vMap v = η.vMap v) → + IsThreeSegregation (section7G0 G H η d θ' μ r) S₀ → + IsSurfaceArrangement S₀ α₀_disc α₀_pt → + IsCompatibleWith (section7G0 G H η d θ' μ r) H η₀ S₀ α₀_disc α₀_pt → + Pairwise (fun i j : Fin k => Disjoint (D i).Δ (D j).Δ) → + Pairwise (fun i j : Fin k => Disjoint V((D i).localSociety.G) V((D j).localSociety.G)) + +/-- **Graph Minors XV, (7.6)** (page 139): +`G_1*, ..., G_k*` are mutually disjoint. +Proved from `(7.2)` (`theorem_7_2_proof`) and `(7.5)` (`Section75EyeData`). -/ +theorem theorem_7_6_proof : GM15Theorem76Statement.{u, v, w} := by + intro S _ _ α β G H η θ_star θ θ' lam π beta μ k T_star T d r η₀ S₀ α₀_disc α₀_pt D + hFlat hMetric hμ1 hθ_bound hr_inj hr_eye hr_dist hη₀_v hThree hArr₀ hCompat₀ hDisj_Δ + i j hij + refine Set.disjoint_left.mpr fun v' hv'i hv'j => ?_ + let G₀ := section7G0 G H η d θ' μ r + have hmem_star : ∀ m : Fin k, v' ∈ V((D m).localSociety.G) → + v' ∈ V(eyeBridgeUnion G H η d θ' μ (r m)) ∨ + v' ∈ V(arrangementPullbackGraph G₀ S₀ α₀_disc α₀_pt (D m).Δ) := by + intro m hvm + rw [(D m).soc_star_G, vertexSet_subgraphUnion] at hvm + exact hvm + have hmem_pullback_Δ : ∀ m : Fin k, + v' ∈ V(arrangementPullbackGraph G₀ S₀ α₀_disc α₀_pt (D m).Δ) → + (∃ A ∈ S₀, α₀_disc A ⊆ (D m).Δ ∧ v' ∈ V(A.G)) ∨ + (v' ∈ segregationVertices S₀ ∧ α₀_pt v' ∈ (D m).Δ) := by + intro m hvm + rw [arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce] at hvm + rcases hvm.1 with hA | hseg + · obtain ⟨A, ⟨hA_mem, hA_sub⟩, hv'A⟩ := mem_iUnion₂.mp hA + exact Or.inl ⟨A, hA_mem, hA_sub, hv'A⟩ + · exact Or.inr hseg + -- Case 1: `v' ∈ V(η.imageGraph)`. + by_cases hv'_im : v' ∈ V(η.imageGraph) + · obtain ⟨u, huH, rfl⟩ := η.bijOn_v.surjOn hv'_im + have hu_in_Δ : ∀ m : Fin k, η.vMap u ∈ V((D m).localSociety.G) → u ∈ (D m).Δ := by + intro m hvm + rcases hmem_star m hvm with hvJ | hvP + · exact (D m).bridge_V_subset_Δ u huH hvJ + · rcases hmem_pullback_Δ m hvP with ⟨A, hA_mem, hA_sub, hvA⟩ | ⟨hv_seg, hpt⟩ + · rw [← hη₀_v u huH] at hvA + exact hA_sub ((hCompat₀.inter_V_iff A hA_mem u huH).mpr hvA) + · rw [← hη₀_v u huH] at hv_seg hpt + rwa [hCompat₀.pt_eq u huH hv_seg] at hpt + exact Set.disjoint_left.mp (hDisj_Δ hij) (hu_in_Δ i hv'i) (hu_in_Δ j hv'j) + -- Case 2: `v' ∉ V(η.imageGraph)`. + · have hnot_J : ∀ m₁ m₂ : Fin k, m₁ ≠ m₂ → + v' ∈ V((D m₂).localSociety.G) → v' ∉ V(eyeBridgeUnion G H η d θ' μ (r m₁)) := by + intro m₁ m₂ hm₁₂ hvm₂ hvm₁ + rcases hmem_star m₂ hvm₂ with hvJ₂ | hvP₂ + · exact hv'_im ((theorem_7_2_proof G H η θ_star θ θ' lam μ k T_star T d r + hFlat hMetric hμ1 hθ_bound hr_inj hr_eye hr_dist m₁ m₂ hm₁₂).2.2 ⟨hvm₁, hvJ₂⟩) + · have hv'G₀ : v' ∈ V(G₀) := by + rw [arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce] at hvP₂ + exact hvP₂.2 + have hv'J₀ : v' ∈ V(remainingBridgeUnion G H η d θ' μ r) := by + change v' ∈ V(section7G0 G H η d θ' μ r) at hv'G₀ + rw [section7G0, vertexSet_subgraphSUnion] at hv'G₀ + obtain ⟨Q, hQ, hv'Q⟩ := mem_iUnion₂.mp hv'G₀ + rcases hQ with rfl | rfl + · exact False.elim (hv'_im hv'Q) + · exact hv'Q + simp only [eyeBridgeUnion, remainingBridgeUnion, vertexSet_subgraphSUnion, mem_iUnion] + at hvm₁ hv'J₀ + obtain ⟨B₁, ⟨hB₁, z₁, hz₁B₁, u₁, ⟨hu₁H, hu₁Z₁⟩, rfl⟩, hv'B₁⟩ := hvm₁ + obtain ⟨B₀, ⟨hB₀, hB₀_disj⟩, hv'B₀⟩ := hv'J₀ + have hB_comp : ∀ {B : Graph α β}, + IsBridge G η.imageGraph B → v' ∈ V(B) → + ∃ C ∈ graphComponents (deleteVertices G V(η.imageGraph)), + v' ∈ V(C) ∧ + V(B) = V(C) ∪ {w ∈ V(η.imageGraph) | ∃ e ∈ E(G), ∃ x ∈ V(C), G.IsLink e x w} := by + intro B hB hv'B + rcases hB.2.2 with ⟨e, _, w₁, hw₁, w₂, hw₂, _, hVB, _⟩ | ⟨C, hC, hVB, _⟩ + · rw [hVB] at hv'B + rcases hv'B with rfl | rfl + · exact False.elim (hv'_im hw₁) + · exact False.elim (hv'_im hw₂) + · have hv'C : v' ∈ V(C) := by + rw [hVB] at hv'B + rcases hv'B with hv'C | ⟨hv'H, _⟩ + · exact hv'C + · exact False.elim (hv'_im hv'H) + exact ⟨C, hC, hv'C, hVB⟩ + obtain ⟨C₁, hC₁, hv'C₁, hVB₁⟩ := hB_comp hB₁ hv'B₁ + obtain ⟨C₀, hC₀, hv'C₀, hVB₀⟩ := hB_comp hB₀ hv'B₀ + have hC_eq : C₁ = C₀ := isGraphComponent_eq_of_mem_inter hC₁ hC₀ ⟨v', hv'C₁, hv'C₀⟩ + have hVB_eq : V(B₁) = V(B₀) := by rw [hVB₁, hVB₀, hC_eq] + have hz₁B₀ : η.vMap u₁ ∈ V(B₀) := hVB_eq ▸ hz₁B₁ + exact Set.disjoint_left.mp hB₀_disj hz₁B₀ + (mem_iUnion.mpr ⟨m₁, u₁, ⟨hu₁H, hu₁Z₁⟩, rfl⟩) + have hv'Pi : v' ∈ V(arrangementPullbackGraph G₀ S₀ α₀_disc α₀_pt (D i).Δ) := + (hmem_star i hv'i).resolve_left (hnot_J i j hij hv'j) + have hv'Pj : v' ∈ V(arrangementPullbackGraph G₀ S₀ α₀_disc α₀_pt (D j).Δ) := + (hmem_star j hv'j).resolve_left (hnot_J j i hij.symm hv'i) + have hseg_in_bar : ∀ {A : Society α β}, A ∈ S₀ → v' ∈ V(A.G) → + v' ∈ segregationVertices S₀ → v' ∈ A.Ω.bar := by + intro A hA hv'A hv'seg + obtain ⟨A', hA', hv'A'_bar⟩ := mem_iUnion₂.mp hv'seg + by_cases hAA' : A = A' + · subst hAA'; exact hv'A'_bar + · exact (hThree.1.vertex_inter_subset A hA A' hA' hAA' ⟨hv'A, A'.bar_subset hv'A'_bar⟩).1 + by_cases hv'_seg : v' ∈ segregationVertices S₀ + · have hpt_in_Δ : ∀ m : Fin k, + v' ∈ V(arrangementPullbackGraph G₀ S₀ α₀_disc α₀_pt (D m).Δ) → + α₀_pt v' ∈ (D m).Δ := by + intro m hvm + rcases hmem_pullback_Δ m hvm with ⟨A, hA_mem, hA_sub, hv'A⟩ | ⟨_, hpt⟩ + · have hv'_bar : v' ∈ A.Ω.bar := hseg_in_bar hA_mem hv'A hv'_seg + have hpt_bd : α₀_pt v' ∈ subBd (α₀_disc A) := (hArr₀.isClosedDisc A hA_mem).2 v' hv'_bar + have hpt_A : α₀_pt v' ∈ α₀_disc A := + (hArr₀.isClosedDisc A hA_mem).1.isClosed.closure_subset_iff.mpr Subset.rfl hpt_bd.1 + exact hA_sub hpt_A + · exact hpt + exact Set.disjoint_left.mp (hDisj_Δ hij) (hpt_in_Δ i hv'Pi) (hpt_in_Δ j hv'Pj) + · rcases hmem_pullback_Δ i hv'Pi with ⟨A, hA_mem, hA_sub, hv'A⟩ | ⟨hseg, _⟩ + · rcases hmem_pullback_Δ j hv'Pj with ⟨A', hA'_mem, hA'_sub, hv'A'⟩ | ⟨hseg, _⟩ + · have hAA'_ne : A ≠ A' := by + intro hEq + subst hEq + obtain ⟨φ_A⟩ := (hArr₀.isClosedDisc A hA_mem).1 + have hx₀ : (φ_A ⟨0, by simp [ClosedUnitDisc]⟩).1 ∈ α₀_disc A := + (φ_A ⟨0, by simp [ClosedUnitDisc]⟩).2 + exact Set.disjoint_left.mp (hDisj_Δ hij) (hA_sub hx₀) (hA'_sub hx₀) + have hv'_bar : v' ∈ A.Ω.bar := + (hThree.1.vertex_inter_subset A hA_mem A' hA'_mem hAA'_ne ⟨hv'A, hv'A'⟩).1 + exact hv'_seg (mem_iUnion₂.mpr ⟨A, hA_mem, hv'_bar⟩) + · exact hv'_seg hseg + · exact hv'_seg hseg + +/-- Claim (1) in the proof of Graph Minors XV, (7.7) (pages 139–140): +"For* $1 \le i \le k$, *if* $(A, \Omega) \in \mathcal{S}'$ *then* $E(G_i^* \cap A) = +\emptyset$ *and* $V(G_i^* \cap A) \subseteq \bar{\Omega}_i^*$." -/ +theorem theorem_7_7_claim_1 + {S : Type w} [TopologicalSpace S] [T2Space S] (hS : IsClosedSurface S) {α : Type u} {β : Type v} + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ θ' π beta μ k : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {r : Fin k → Set S} + {η₀ : SpanEmbedding H (section7G0 G H η d θ' μ r)} + {S₀ : Set (Society α β)} {α₀_disc : Society α β → Set S} {α₀_pt : α → S} + {i : Fin k} + (D_i : Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i) + (hη₀_v : ∀ v ∈ H.V, η₀.vMap v = η.vMap v) + (hThree : IsThreeSegregation (section7G0 G H η d θ' μ r) S₀) + (hArr₀ : IsSurfaceArrangement S₀ α₀_disc α₀_pt) + (hCompat₀ : IsCompatibleWith (section7G0 G H η d θ' μ r) H η₀ S₀ α₀_disc α₀_pt) + {A : Society α β} (hA : A ∈ S₀) (hA_not : ¬ α₀_disc A ⊆ D_i.Δ) : + Disjoint E(D_i.localSociety.G) E(A.G) ∧ + V(D_i.localSociety.G) ∩ V(A.G) ⊆ D_i.localSociety.Ω.bar := by + let G₀ := section7G0 G H η d θ' μ r + let J_i := eyeBridgeUnion G H η d θ' μ (r i) + let P_i := arrangementPullbackGraph G₀ S₀ α₀_disc α₀_pt D_i.Δ + have hA_le : A.G ≤ G₀ := hThree.1.le A hA + have hJ_le : J_i ≤ G := subgraphSUnion_le (fun _ hB => hB.1.2.1) + have hPair_le := section7G0_members_le G H η d θ' μ r + have hG₀_le : G₀ ≤ G := section7G0_le G H η d θ' μ r + have hP_le : P_i ≤ G₀ := restrict_le.trans (G₀.induce_le inter_subset_right) + have hseg_in_bar : ∀ {v' : α}, v' ∈ V(A.G) → v' ∈ segregationVertices S₀ → v' ∈ A.Ω.bar := by + intro v' hv'A hv'seg + obtain ⟨A', hA', hv'A'_bar⟩ := mem_iUnion₂.mp hv'seg + by_cases hAA' : A = A' + · subst hAA'; exact hv'A'_bar + · exact (hThree.1.vertex_inter_subset A hA A' hA' hAA' ⟨hv'A, A'.bar_subset hv'A'_bar⟩).1 + obtain ⟨hinter_subBd, _⟩ := + inter_disc_subset_subBd_of_not_subset hS hArr₀ D_i.isClosedDisc_Δ D_i.isNormal_bd hA hA_not + refine ⟨?_, ?_⟩ + · rw [D_i.soc_star_G, edgeSet_subgraphUnion hJ_le (hP_le.trans hG₀_le)] + refine Set.disjoint_left.mpr ?_ + rintro e (heJ | heP) heA + · have he_G₀ : e ∈ E(G₀) := hA_le.edgeSet_mono heA + change e ∈ E(subgraphSUnion G {η.imageGraph, remainingBridgeUnion G H η d θ' μ r}) at he_G₀ + rw [edgeSet_subgraphSUnion hPair_le] at he_G₀ + change e ∈ E(eyeBridgeUnion G H η d θ' μ (r i)) at heJ + rw [eyeBridgeUnion_edgeSet] at heJ + obtain ⟨B₁, ⟨hB₁, z₁, hz₁B₁, u₁, ⟨hu₁H, hu₁Z₁⟩, rfl⟩, heB₁⟩ := mem_iUnion₂.mp heJ + obtain ⟨Q, hQ, heQ⟩ := mem_iUnion₂.mp he_G₀ + rcases hQ with rfl | rfl + · exact Set.disjoint_left.mp (isBridge_disjoint_edgeSet hB₁) heB₁ heQ + · rw [remainingBridgeUnion_edgeSet] at heQ + obtain ⟨B₀, ⟨hB₀, hB₀_disj⟩, heB₀⟩ := mem_iUnion₂.mp heQ + have hVB_eq : V(B₁) = V(B₀) := + (isBridge_vertexSet_eq_of_inter hB₁ hB₀).2 e ⟨heB₁, heB₀⟩ + exact Set.disjoint_left.mp hB₀_disj (hVB_eq ▸ hz₁B₁) + (mem_iUnion.mpr ⟨i, u₁, ⟨hu₁H, hu₁Z₁⟩, rfl⟩) + · change e ∈ E(arrangementPullbackGraph G₀ S₀ α₀_disc α₀_pt D_i.Δ) at heP + rw [arrangementPullbackGraph, edgeSet_restrict] at heP + obtain ⟨A', ⟨hA'_S₀, hA'_sub⟩, heA'⟩ := mem_iUnion₂.mp heP.2 + have hAA'_ne : A ≠ A' := fun hEq => hA_not (hEq ▸ hA'_sub) + exact Set.disjoint_left.mp (hThree.1.edge_disjoint A hA A' hA'_S₀ hAA'_ne) heA heA' + · rintro x ⟨hx_star, hxA⟩ + rw [D_i.soc_star_G, vertexSet_subgraphUnion] at hx_star + have hx_seg_and_Δ : x ∈ segregationVertices S₀ ∧ α₀_pt x ∈ D_i.Δ := by + rcases hx_star with hxJ | hxP + · have hx_G₀ : x ∈ V(G₀) := hA_le.vertexSet_mono hxA + have hx_im : x ∈ V(η.imageGraph) := by + by_contra hx_not_im + change x ∈ V(subgraphSUnion G {η.imageGraph, remainingBridgeUnion G H η d θ' μ r}) + at hx_G₀ + rw [vertexSet_subgraphSUnion] at hx_G₀ + obtain ⟨Q, hQ, hxQ⟩ := mem_iUnion₂.mp hx_G₀ + have hxJ₀ : x ∈ V(remainingBridgeUnion G H η d θ' μ r) := by + rcases hQ with rfl | rfl + · exact (hx_not_im hxQ).elim + · exact hxQ + change x ∈ V(eyeBridgeUnion G H η d θ' μ (r i)) at hxJ + rw [eyeBridgeUnion, vertexSet_subgraphSUnion] at hxJ + rw [remainingBridgeUnion, vertexSet_subgraphSUnion] at hxJ₀ + obtain ⟨B₁, ⟨hB₁, z₁, hz₁B₁, u₁, ⟨hu₁H, hu₁Z₁⟩, rfl⟩, hxB₁⟩ := mem_iUnion₂.mp hxJ + obtain ⟨B₀, ⟨hB₀, hB₀_disj⟩, hxB₀⟩ := mem_iUnion₂.mp hxJ₀ + have hVB_eq : V(B₁) = V(B₀) := + (isBridge_vertexSet_eq_of_inter hB₁ hB₀).1 x ⟨hxB₁, hxB₀⟩ hx_not_im + exact Set.disjoint_left.mp hB₀_disj (hVB_eq ▸ hz₁B₁) + (mem_iUnion.mpr ⟨i, u₁, ⟨hu₁H, hu₁Z₁⟩, rfl⟩) + obtain ⟨u, huH, rfl⟩ := η.bijOn_v.surjOn hx_im + have hu_Δ : u ∈ D_i.Δ := D_i.bridge_V_subset_Δ u huH hxJ + have hu_A : u ∈ α₀_disc A := by + rw [hCompat₀.inter_V_iff A hA u huH, hη₀_v u huH] + exact hxA + obtain ⟨w, hw_bar, hwu⟩ := + (inter_disc_subset_subBd_of_not_subset hS hArr₀ D_i.isClosedDisc_Δ + D_i.isNormal_bd hA hA_not).2 ⟨hu_A, hu_Δ⟩ + have hu_bdA : u ∈ subBd (α₀_disc A) := hwu ▸ (hArr₀.isClosedDisc A hA).2 w hw_bar + have hu_mem : u ∈ {v ∈ H.V | η₀.vMap v ∈ A.Ω.bar} := by + rw [← hCompat₀.bd_inter_eq A hA] + exact ⟨H.V_subset_U huH, hu_bdA⟩ + have hx_bar : η.vMap u ∈ A.Ω.bar := hη₀_v u huH ▸ hu_mem.2 + have hx_seg : η.vMap u ∈ segregationVertices S₀ := mem_biUnion hA hx_bar + have hpt_eq : α₀_pt (η.vMap u) = u := by + rw [← hη₀_v u huH] + exact hCompat₀.pt_eq u huH (hη₀_v u huH ▸ hx_seg) + exact ⟨hx_seg, hpt_eq.symm ▸ hu_Δ⟩ + · change x ∈ V(arrangementPullbackGraph G₀ S₀ α₀_disc α₀_pt D_i.Δ) at hxP + rw [arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce] at hxP + rcases hxP.1 with hx_union | hx_seg_Δ + · obtain ⟨A', ⟨hA'_S₀, hA'_sub⟩, hxA'⟩ := mem_iUnion₂.mp hx_union + have hAA'_ne : A ≠ A' := fun hEq => hA_not (hEq ▸ hA'_sub) + have hx_bars := hThree.1.vertex_inter_subset A hA A' hA'_S₀ hAA'_ne ⟨hxA, hxA'⟩ + have hx_bdA' : α₀_pt x ∈ subBd (α₀_disc A') := (hArr₀.isClosedDisc A' hA'_S₀).2 x + hx_bars.2 + have hx_discA' : α₀_pt x ∈ α₀_disc A' := + (hArr₀.isClosedDisc A' hA'_S₀).1.isClosed.closure_subset_iff.mpr Subset.rfl hx_bdA'.1 + exact ⟨mem_biUnion hA hx_bars.1, hA'_sub hx_discA'⟩ + · exact hx_seg_Δ + have hx_bar : x ∈ A.Ω.bar := hseg_in_bar hxA hx_seg_and_Δ.1 + have hx_bdA : α₀_pt x ∈ subBd (α₀_disc A) := (hArr₀.isClosedDisc A hA).2 x hx_bar + have hx_discA : α₀_pt x ∈ α₀_disc A := + (hArr₀.isClosedDisc A hA).1.isClosed.closure_subset_iff.mpr Subset.rfl hx_bdA.1 + have hx_bdΔ : α₀_pt x ∈ subBd D_i.Δ := hinter_subBd ⟨hx_discA, hx_seg_and_Δ.2⟩ + rw [D_i.soc_star_Ω.1] + exact ⟨hx_seg_and_Δ.1, hx_bdΔ⟩ + +/-- If each `F i` (`i : Fin k`) has `ncard ≤ 1`, then `(⋃ i : Fin k, F i).ncard ≤ k`. -/ +theorem ncard_iUnion_le_of_ncard_le_one {γ : Type*} : + ∀ (k : ℕ) (F : Fin k → Set γ), (∀ i, (F i).ncard ≤ 1) → (⋃ i : Fin k, F i).ncard ≤ k + | 0, F, _ => by simp + | k + 1, F, hle => by + have hunion : (⋃ i : Fin (k + 1), F i) = F 0 ∪ ⋃ i : Fin k, F i.succ := by + ext x + simp only [mem_iUnion, mem_union] + constructor + · rintro ⟨i, hx⟩ + exact Fin.cases (fun h0 => Or.inl h0) (fun j hj => Or.inr ⟨j, hj⟩) i hx + · rintro (hx | ⟨j, hx⟩) + · exact ⟨0, hx⟩ + · exact ⟨j.succ, hx⟩ + rw [hunion] + have h1 : (F 0 ∪ ⋃ i : Fin k, F i.succ).ncard ≤ (F 0).ncard + (⋃ i : Fin k, F i.succ).ncard := + ncard_union_le _ _ + have h2 : (F 0).ncard ≤ 1 := hle 0 + have h3 : (⋃ i : Fin k, F i.succ).ncard ≤ k := + ncard_iUnion_le_of_ncard_le_one k (fun i => F i.succ) (fun i => hle i.succ) + omega + +/-- For any member `A ∈ S_seg` of a graph segregation `S_seg` of `G₀`, there is a complementary +subgraph `B ≤ G₀` such that `(A.G, B)` is a separation of `G₀` with `V(A.G) ∩ V(B) = A.Ω.bar`. -/ +private theorem exists_graphSeparation_of_mem_segregation {α : Type u} {β : Type v} + {G₀ : Graph α β} {S_seg : Set (Society α β)} (hSeg : IsGraphSegregation G₀ S_seg) + {A : Society α β} (hA : A ∈ S_seg) : + ∃ B : Graph α β, IsGraphSeparation G₀ A.G B ∧ V(A.G) ∩ V(B) = A.Ω.bar := by + have hA_le : A.G ≤ G₀ := hSeg.le A hA + let V_B := (V(G₀) \ V(A.G)) ∪ A.Ω.bar + let E_B := E(G₀) \ E(A.G) + let B := (G₀.induce V_B).restrict E_B + have hVB_sub : V_B ⊆ V(G₀) := by + rintro v (⟨hvG₀, _⟩ | hv_bar) + · exact hvG₀ + · exact hA_le.vertexSet_mono (A.bar_subset hv_bar) + have hB_le : B ≤ G₀ := restrict_le.trans (G₀.induce_le hVB_sub) + have hVB_eq : V(B) = V_B := by simp [B] + have hEB_eq : E(B) = E_B := by + ext e + simp only [B, edgeSet_restrict, mem_inter_iff, Graph.edgeSet_induce] + refine ⟨fun h => h.2, fun ⟨heG₀, he_not_A⟩ => ⟨?_, ⟨heG₀, he_not_A⟩⟩⟩ + have he_union : e ∈ E(subgraphSUnion G₀ ((fun S' : Society α β => S'.G) '' S_seg)) := by + rw [hSeg.union_eq] + exact heG₀ + rw [edgeSet_subgraphSUnion (by rintro _ ⟨S', hS', rfl⟩; exact hSeg.le S' hS')] at he_union + obtain ⟨_, ⟨A', hA', rfl⟩, heA'⟩ := mem_iUnion₂.mp he_union + have hAA'_ne : A ≠ A' := fun hEq => he_not_A (hEq ▸ heA') + obtain ⟨x, y, hxy_A'⟩ := A'.G.exists_isLink_of_mem_edgeSet heA' + have hxy_G₀ : G₀.IsLink e x y := hxy_A'.mono (hSeg.le A' hA') + have hmem_VB : ∀ z ∈ V(A'.G), z ∈ V_B := by + intro z hzA' + by_cases hzA : z ∈ V(A.G) + · exact Or.inr (hSeg.vertex_inter_subset A hA A' hA' hAA'_ne ⟨hzA, hzA'⟩).1 + · exact Or.inl ⟨(hSeg.le A' hA').vertexSet_mono hzA', hzA⟩ + exact ⟨x, y, hxy_G₀, hmem_VB x hxy_A'.left_mem, hmem_VB y hxy_A'.right_mem⟩ + refine ⟨B, ⟨hA_le, hB_le, ?_, ?_, ?_⟩, ?_⟩ + · ext v + rw [mem_union, hVB_eq] + refine ⟨?_, fun hvG₀ => ?_⟩ + · rintro (hvA | hvB) + · exact hA_le.vertexSet_mono hvA + · exact hVB_sub hvB + · by_cases hvA : v ∈ V(A.G) + · exact Or.inl hvA + · exact Or.inr (Or.inl ⟨hvG₀, hvA⟩) + · ext e + rw [mem_union, hEB_eq] + refine ⟨?_, fun heG₀ => ?_⟩ + · rintro (heA | ⟨heG₀, _⟩) + · exact hA_le.edgeSet_mono heA + · exact heG₀ + · by_cases heA : e ∈ E(A.G) + · exact Or.inl heA + · exact Or.inr ⟨heG₀, heA⟩ + · rw [hEB_eq] + exact disjoint_sdiff_self_right + · ext v + rw [mem_inter_iff, hVB_eq] + constructor + · rintro ⟨hvA, ⟨_, hv_not_A⟩ | hv_bar⟩ + · exact (hv_not_A hvA).elim + · exact hv_bar + · intro hv_bar + exact ⟨A.bar_subset hv_bar, Or.inr hv_bar⟩ + + +/-- Statement of Graph Minors XV, (7.7) (page 139): +"If there is no crooked transaction of cardinality* $\pi$ *in* $(G_i^*, \Omega_i^*)$ *for* $1 +\le i \le k$, *then (S3) holds." -/ +def GM15Theorem77Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ θ' lam π beta μ k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin k → Set S) + (η₀ : SpanEmbedding H (section7G0 G H η d θ' μ r)) + (S₀ : Set (Society α β)) (α₀_disc : Society α β → Set S) (α₀_pt : α → S) + (D : ∀ i : Fin k, Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i), + IsFlatSpan G H η θ_star θ lam μ T_star T → + HasTangleMetric H θ T d → + 1 ≤ μ → 2 ≤ π → π ≠ 3 → beta = 2 * π + 8 → + θ' + 13 * μ + 14 ≤ beta → 100 * beta ≤ θ → + Injective r → + (∀ i : Fin k, IsDrawingEye G H η θ T (r i)) → + (∀ i j : Fin k, i ≠ j → d (r i) (r j) = θ) → + (∀ v ∈ H.V, η₀.vMap v = η.vMap v) → + (∀ e ∈ H.E, η₀.eMap e = η.eMap e) → + IsThreeSegregation (section7G0 G H η d θ' μ r) S₀ → + IsTangleLocal (section7G0 G H η d θ' μ r) H η₀ T S₀ → + IsSurfaceArrangement S₀ α₀_disc α₀_pt → + IsCompatibleWith (section7G0 G H η d θ' μ r) H η₀ S₀ α₀_disc α₀_pt → + Pairwise (fun i j : Fin k => Disjoint (D i).Δ (D j).Δ) → + (∀ i : Fin k, ∀ P_set : Set (Graph α β), + (D i).localSociety.IsCrookedTransaction P_set → P_set.ncard ≠ π) → + Section7S3 S G T_star (3 * π + 9) k + +/-- The retained societies and the local eye segregations together segregate the original graph. -/ +theorem assemble_eye_segregation + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (θ_star : ℕ) + (θ : ℕ) + (θ' : ℕ) + (π : ℕ) + (beta : ℕ) + (μ : ℕ) + (k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (r : Fin k → Set S) + (η₀ : SpanEmbedding H (section7G0 G H η d θ' μ r)) + (S₀ : Set (Society α β)) + (α₀_disc : Society α β → Set S) + (α₀_pt : α → S) + (D : (i : Fin k) → Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt + i) + (hη₀_v : ∀ v ∈ H.V, η₀.vMap v = η.vMap v) + (hThree : IsThreeSegregation (section7G0 G H η d θ' μ r) S₀) + (hArr₀ : IsSurfaceArrangement S₀ α₀_disc α₀_pt) + (hCompat₀ : IsCompatibleWith (section7G0 G H η d θ' μ r) H η₀ S₀ α₀_disc α₀_pt) + (hS : IsClosedSurface S) + (hDisj_star : Pairwise fun i j => Disjoint V((D i).localSociety.G) V((D j).localSociety.G)) : + let G₀ : Graph α β := section7G0 G H η d θ' μ r + (∀ Q ∈ ({η.imageGraph, remainingBridgeUnion G H η d θ' μ r} : Set (Graph α β)), Q ≤ G) → + (∀ (i : Fin k), eyeBridgeUnion G H η d θ' μ (r i) ≤ G) → + (∀ (i : Fin k), arrangementPullbackGraph G₀ S₀ α₀_disc α₀_pt (D i).Δ ≤ G) → + (∀ (i : Fin k), (D i).localSociety.G ≤ G) → + ∀ (S_seg : Fin k → Set (Society α β)), + (∀ (i : Fin k), IsSegregationOfType (D i).localSociety.G (3 * π + 9) 1 (S_seg i)) → + (∀ (i : Fin k), (D i).localSociety.Ω.bar ⊆ segregationVertices (S_seg i)) → + let S' : Set (Society α β) := {A | A ∈ S₀ ∧ ∀ (i : Fin k), ¬α₀_disc A ⊆ (D i).Δ} + let S_seg' : Fin k → Set (Society α β) := fun i => {B | B ∈ S_seg i ∧ V(B.G).Nonempty ∧ B ∉ + S'} + let S_final : Set (Society α β) := S' ∪ ⋃ i, S_seg' i + (S_final.Finite) → + (∀ B ∈ S_final, B.G ≤ G) → + (∀ (i : Fin k) {v : α}, v ∈ V((D i).localSociety.G) → ∃ B ∈ S_final, v ∈ + V(B.G)) → + (∀ (i : Fin k) {e : β}, e ∈ E((D i).localSociety.G) → ∃ B ∈ S_final, e ∈ + E(B.G)) → + IsGraphSegregation G S_final := by + intro G₀ hPair_le hJi_le hPi_le hstar_le S_seg hType_i hBar_i S' S_seg' S_final hFin_final + hLe_final hCover_star_V hCover_star_E + refine ⟨hFin_final, hLe_final, ?_, ?_, ?_⟩ + · have hU_le : subgraphSUnion G ((fun B : Society α β => B.G) '' S_final) ≤ G := + subgraphSUnion_le (by rintro _ ⟨B, hB, rfl⟩; exact hLe_final B hB) + refine (Compatible.of_le_le hU_le le_rfl).ext ?_ ?_ + · ext v + rw [vertexSet_subgraphSUnion] + refine ⟨fun h => hU_le.vertexSet_mono (vertexSet_subgraphSUnion _ _ ▸ h), fun hvG => ?_⟩ + by_cases hex_i_v : ∃ i : Fin k, v ∈ V((D i).localSociety.G) + · obtain ⟨i, hvi⟩ := hex_i_v + obtain ⟨B, hB_fin, hvB⟩ := hCover_star_V i hvi + exact mem_iUnion₂.mpr ⟨B.G, ⟨B, hB_fin, rfl⟩, hvB⟩ + · push Not at hex_i_v + have hvG₀ : v ∈ V(G₀) := by + by_cases hv_im : v ∈ V(η.imageGraph) + · exact (le_subgraphSUnion hPair_le (Or.inl rfl)).vertexSet_mono hv_im + · obtain ⟨B, hB, hvB⟩ := exists_bridge_of_mem_vertexSet η.imageGraph_le hvG hv_im + have hB_disj : Disjoint V(B) (⋃ i : Fin k, η.vMap '' (H.V ∩ eyeAtomZone H d θ' μ + (r i))) := by + refine Set.disjoint_left.mpr fun z hzB hz_u => ?_ + obtain ⟨i, hz_i⟩ := mem_iUnion.mp hz_u + have hv_Ji : v ∈ V(eyeBridgeUnion G H η d θ' μ (r i)) := by + rw [eyeBridgeUnion, vertexSet_subgraphSUnion] + exact mem_iUnion₂.mpr ⟨B, ⟨hB, z, hzB, hz_i⟩, hvB⟩ + have hv_star : v ∈ V((D i).localSociety.G) := by + rw [(D i).soc_star_G, vertexSet_subgraphUnion] + exact Or.inl hv_Ji + exact hex_i_v i hv_star + have hv_J₀ : v ∈ V(remainingBridgeUnion G H η d θ' μ r) := by + rw [remainingBridgeUnion, vertexSet_subgraphSUnion] + exact mem_iUnion₂.mpr ⟨B, ⟨hB, hB_disj⟩, hvB⟩ + exact (le_subgraphSUnion hPair_le (Or.inr rfl)).vertexSet_mono hv_J₀ + have hv_u : v ∈ V(subgraphSUnion G₀ ((fun A : Society α β => A.G) '' S₀)) := by + rw [hThree.1.union_eq]; exact hvG₀ + rw [vertexSet_subgraphSUnion] at hv_u + obtain ⟨_, ⟨A, hA_S₀, rfl⟩, hvA⟩ := mem_iUnion₂.mp hv_u + have hA_S' : A ∈ S' := by + refine ⟨hA_S₀, fun i hsub => hex_i_v i ?_⟩ + rw [(D i).soc_star_G, vertexSet_subgraphUnion] + refine Or.inr ?_ + rw [arrangementPullbackGraph, vertexSet_restrict, vertexSet_induce] + exact ⟨Or.inl (mem_iUnion₂.mpr ⟨A, ⟨hA_S₀, hsub⟩, hvA⟩), hvG₀⟩ + exact mem_iUnion₂.mpr ⟨A.G, ⟨A, Or.inl hA_S', rfl⟩, hvA⟩ + · ext e + rw [edgeSet_subgraphSUnion (by rintro _ ⟨B, hB, rfl⟩; exact hLe_final B hB)] + refine ⟨fun h => ?_, fun heG => ?_⟩ + · obtain ⟨_, ⟨B, hB, rfl⟩, heB⟩ := mem_iUnion₂.mp h + exact (hLe_final B hB).edgeSet_mono heB + · by_cases hex_i_e : ∃ i : Fin k, e ∈ E((D i).localSociety.G) + · obtain ⟨i, hei⟩ := hex_i_e + obtain ⟨B, hB_fin, heB⟩ := hCover_star_E i hei + exact mem_iUnion₂.mpr ⟨B.G, ⟨B, hB_fin, rfl⟩, heB⟩ + · push Not at hex_i_e + have heG₀ : e ∈ E(G₀) := by + by_cases he_im : e ∈ E(η.imageGraph) + · exact (le_subgraphSUnion hPair_le (Or.inl rfl)).edgeSet_mono he_im + · obtain ⟨B, hB, heB⟩ := exists_bridge_of_mem_edgeSet η.imageGraph_le heG he_im + have hB_disj : Disjoint V(B) (⋃ i : Fin k, η.vMap '' (H.V ∩ eyeAtomZone H d θ' μ + (r i))) := by + refine Set.disjoint_left.mpr fun z hzB hz_u => ?_ + obtain ⟨i, hz_i⟩ := mem_iUnion.mp hz_u + have he_Ji : e ∈ E(eyeBridgeUnion G H η d θ' μ (r i)) := by + rw [eyeBridgeUnion_edgeSet] + exact mem_iUnion₂.mpr ⟨B, ⟨hB, z, hzB, hz_i⟩, heB⟩ + have he_star : e ∈ E((D i).localSociety.G) := by + rw [(D i).soc_star_G, edgeSet_subgraphUnion (hJi_le i) (hPi_le i)] + exact Or.inl he_Ji + exact hex_i_e i he_star + have he_J₀ : e ∈ E(remainingBridgeUnion G H η d θ' μ r) := by + rw [remainingBridgeUnion_edgeSet] + exact mem_iUnion₂.mpr ⟨B, ⟨hB, hB_disj⟩, heB⟩ + exact (le_subgraphSUnion hPair_le (Or.inr rfl)).edgeSet_mono he_J₀ + have he_u : e ∈ E(subgraphSUnion G₀ ((fun A : Society α β => A.G) '' S₀)) := by + rw [hThree.1.union_eq]; exact heG₀ + rw [edgeSet_subgraphSUnion (by rintro _ ⟨A, hA, rfl⟩; exact hThree.1.le A hA)] at he_u + obtain ⟨_, ⟨A, hA_S₀, rfl⟩, heA⟩ := mem_iUnion₂.mp he_u + have hA_S' : A ∈ S' := by + refine ⟨hA_S₀, fun i hsub => hex_i_e i ?_⟩ + rw [(D i).soc_star_G, edgeSet_subgraphUnion (hJi_le i) (hPi_le i)] + refine Or.inr ?_ + rw [arrangementPullbackGraph, edgeSet_restrict] + obtain ⟨x, y, hxy_A⟩ := A.G.exists_isLink_of_mem_edgeSet heA + have hxy_G₀ : G₀.IsLink e x y := hxy_A.mono (hThree.1.le A hA_S₀) + refine ⟨⟨x, y, hxy_G₀, ?_, ?_⟩, mem_iUnion₂.mpr ⟨A, ⟨hA_S₀, hsub⟩, heA⟩⟩ + · exact ⟨Or.inl (mem_iUnion₂.mpr ⟨A, ⟨hA_S₀, hsub⟩, hxy_A.left_mem⟩), hxy_G₀.left_mem⟩ + · exact ⟨Or.inl (mem_iUnion₂.mpr ⟨A, ⟨hA_S₀, hsub⟩, hxy_A.right_mem⟩), + hxy_G₀.right_mem⟩ + exact mem_iUnion₂.mpr ⟨A.G, ⟨A, Or.inl hA_S', rfl⟩, heA⟩ + · have hV_inter_S'_seg : ∀ (i : Fin k) {A B : Society α β}, + A ∈ S' → B ∈ S_seg i → V(A.G) ∩ V(B.G) ⊆ A.Ω.bar ∩ B.Ω.bar := by + intro i A B hA_S' hB_i v ⟨hvA, hvB⟩ + have hv_star : v ∈ V((D i).localSociety.G) := ((hType_i i).1.le B hB_i).vertexSet_mono hvB + have hv_bar_star : v ∈ (D i).localSociety.Ω.bar := + (theorem_7_7_claim_1 hS (D i) hη₀_v hThree hArr₀ hCompat₀ hA_S'.1 (hA_S'.2 i)).2 + ⟨hv_star, hvA⟩ + have hv_seg₀ : v ∈ segregationVertices S₀ := ((D i).soc_star_Ω.1 ▸ hv_bar_star).1 + have hv_seg_i : v ∈ segregationVertices (S_seg i) := hBar_i i hv_bar_star + have hv_barA : v ∈ A.Ω.bar := by + obtain ⟨A', hA', hvA'⟩ := mem_iUnion₂.mp hv_seg₀ + by_cases hAA' : A = A' + · subst hAA'; exact hvA' + · exact (hThree.1.vertex_inter_subset A hA_S'.1 A' hA' hAA' ⟨hvA, A'.bar_subset hvA'⟩).1 + have hv_barB : v ∈ B.Ω.bar := by + obtain ⟨B', hB', hvB'⟩ := mem_iUnion₂.mp hv_seg_i + by_cases hBB' : B = B' + · subst hBB'; exact hvB' + · exact ((hType_i i).1.vertex_inter_subset B hB_i B' hB' hBB' ⟨hvB, B'.bar_subset hvB'⟩).1 + exact ⟨hv_barA, hv_barB⟩ + rintro B₁ (hB₁_S' | hB₁_i) B₂ (hB₂_S' | hB₂_j) hne + · exact hThree.1.vertex_inter_subset B₁ hB₁_S'.1 B₂ hB₂_S'.1 hne + · obtain ⟨j, hB₂_j⟩ := mem_iUnion.mp hB₂_j + exact hV_inter_S'_seg j hB₁_S' hB₂_j.1 + · obtain ⟨i, hB₁_i⟩ := mem_iUnion.mp hB₁_i + intro v ⟨hv1, hv2⟩ + have h := hV_inter_S'_seg i hB₂_S' hB₁_i.1 ⟨hv2, hv1⟩ + exact ⟨h.2, h.1⟩ + · obtain ⟨i, hB₁_i⟩ := mem_iUnion.mp hB₁_i + obtain ⟨j, hB₂_j⟩ := mem_iUnion.mp hB₂_j + by_cases hij : i = j + · subst hij + exact (hType_i i).1.vertex_inter_subset B₁ hB₁_i.1 B₂ hB₂_j.1 hne + · intro v ⟨hv1, hv2⟩ + exact False.elim (Set.disjoint_left.mp (hDisj_star hij) + (((hType_i i).1.le B₁ hB₁_i.1).vertexSet_mono hv1) + (((hType_i j).1.le B₂ hB₂_j.1).vertexSet_mono hv2)) + · rintro B₁ (hB₁_S' | hB₁_i) B₂ (hB₂_S' | hB₂_j) hne + · exact hThree.1.edge_disjoint B₁ hB₁_S'.1 B₂ hB₂_S'.1 hne + · obtain ⟨j, hB₂_j⟩ := mem_iUnion.mp hB₂_j + have hdisj := + (theorem_7_7_claim_1 hS (D j) hη₀_v hThree hArr₀ hCompat₀ hB₁_S'.1 (hB₁_S'.2 j)).1 + exact hdisj.symm.mono_right ((hType_i j).1.le B₂ hB₂_j.1).edgeSet_mono + · obtain ⟨i, hB₁_i⟩ := mem_iUnion.mp hB₁_i + have hdisj := + (theorem_7_7_claim_1 hS (D i) hη₀_v hThree hArr₀ hCompat₀ hB₂_S'.1 (hB₂_S'.2 i)).1 + exact hdisj.mono_left ((hType_i i).1.le B₁ hB₁_i.1).edgeSet_mono + · obtain ⟨i, hB₁_i⟩ := mem_iUnion.mp hB₁_i + obtain ⟨j, hB₂_j⟩ := mem_iUnion.mp hB₂_j + by_cases hij : i = j + · subst hij + exact (hType_i i).1.edge_disjoint B₁ hB₁_i.1 B₂ hB₂_j.1 hne + · refine Set.disjoint_left.mpr fun e he1 he2 => ?_ + obtain ⟨x, _, hxy₁⟩ := B₁.G.exists_isLink_of_mem_edgeSet he1 + have hxy₂ : B₂.G.IsLink e x _ := + (((hType_i j).1.le B₂ hB₂_j.1).trans (hstar_le j)).isLink_iff he2 |>.mpr + (hxy₁.mono (((hType_i i).1.le B₁ hB₁_i.1).trans (hstar_le i))) + exact Set.disjoint_left.mp (hDisj_star hij) + (((hType_i i).1.le B₁ hB₁_i.1).vertexSet_mono hxy₁.left_mem) + (((hType_i j).1.le B₂ hB₂_j.1).vertexSet_mono hxy₂.left_mem) + +/-- Centrality of the assembled segregation follows from the original and local tangle separations. +-/ +theorem assembled_eye_segregation_is_central + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (θ_star : ℕ) + (θ : ℕ) + (θ' : ℕ) + (lam : ℕ) + (π : ℕ) + (beta : ℕ) + (μ : ℕ) + (k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (r : Fin k → Set S) + (η₀ : SpanEmbedding H (section7G0 G H η d θ' μ r)) + (S₀ : Set (Society α β)) + (α₀_disc : Society α β → Set S) + (α₀_pt : α → S) + (D : (i : Fin k) → Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt + i) + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hMetric : HasTangleMetric H θ T d) + (hμ1 : 1 ≤ μ) + (hπ2 : 2 ≤ π) + (hbeta_eq : beta = 2 * π + 8) + (hθ_ge : 100 * beta ≤ θ) + (hr_eye : ∀ (i : Fin k), IsDrawingEye G H η θ T (r i)) + (hη₀_v : ∀ v ∈ H.V, η₀.vMap v = η.vMap v) + (hη₀_e : ∀ e ∈ H.E, η₀.eMap e = η.eMap e) + (hThree : IsThreeSegregation (section7G0 G H η d θ' μ r) S₀) + (hLocal : IsTangleLocal (section7G0 G H η d θ' μ r) H η₀ T S₀) + (hCompat₀ : IsCompatibleWith (section7G0 G H η d θ' μ r) H η₀ S₀ α₀_disc α₀_pt) + (hS : IsClosedSurface S) + [hConn : ConnectedSpace S] + (hθ_bound : 2 * (θ' + 12 * μ + 14) + μ ≤ θ) : + let G₀ : Graph α β := section7G0 G H η d θ' μ r + (∀ (i : Fin k), eyeBridgeUnion G H η d θ' μ (r i) ≤ G) → + (∀ (i : Fin k), arrangementPullbackGraph G₀ S₀ α₀_disc α₀_pt (D i).Δ ≤ G) → + ∀ (S_seg : Fin k → Set (Society α β)), + (∀ (i : Fin k), IsSegregationOfType (D i).localSociety.G (3 * π + 9) 1 (S_seg i)) → + let S' : Set (Society α β) := {A | A ∈ S₀ ∧ ∀ (i : Fin k), ¬α₀_disc A ⊆ (D i).Δ} + let S_seg' : Fin k → Set (Society α β) := fun i => {B | B ∈ S_seg i ∧ V(B.G).Nonempty ∧ B ∉ + S'} + let S_final : Set (Society α β) := S' ∪ ⋃ i, S_seg' i + (IsSegregationOfType G (3 * π + 9) k S_final) → + IsCentralSegregation G T_star S_final := by + intro G₀ hJi_le hPi_le S_seg hType_i S' S_seg' S_final hClaim3 + have hT_star := hFlat.isSpan.isControlling.isTangle_star + have hθ_le_star := hFlat.isSpan.isControlling.theta_le + refine theorem_2_1_proof G θ_star (3 * π + 9) k T_star S_final hT_star + (by omega) (by omega) hClaim3 ?_ + rintro A_soc hA_soc A_star B_star hAB_star hord_le ⟨hB_sub_V, hB_sub_E⟩ + have hsep_star := hT_star.isTangle.isSeparation hAB_star + obtain ⟨A_star_H, B_star_H, hRestr, hA_star_V, hA_star_E, hB_star_V, hB_star_E, hord_H_le⟩ := + GM12.exists_span_restricted_separation hT_star.finite_V hT_star.finite_E H η hsep_star + have hAB_star_T : (A_star_H, B_star_H) ∈ T := + (hFlat.isSpan.isControlling.controls hsep_star (by omega) hRestr).mp hAB_star + rcases hA_soc with hA_S' | hA_i + · obtain ⟨B_G₀, hsep_G₀, hbar_G₀⟩ := + exists_graphSeparation_of_mem_segregation hThree.1 hA_S'.1 + obtain ⟨A_H, B_H, hsep_H, hAH_V, hBH_V, hAH_E, hBH_E, hAH_T⟩ := + hLocal A_soc hA_S'.1 B_G₀ hsep_G₀ hbar_G₀ + have hB_sub_AH_V : B_star_H.vertexSet ⊆ A_H.vertexSet := by + intro v hv + rw [hB_star_V] at hv + rw [hAH_V] + exact ⟨hv.1, hη₀_v v hv.1 ▸ hB_sub_V hv.2⟩ + have hB_sub_AH_E : B_star_H.edgeSet ⊆ A_H.edgeSet := by + intro e he + rw [hB_star_E] at he + rw [hAH_E] + exact ⟨he.1, hη₀_e e he.1 ▸ hB_sub_E he.2⟩ + have hcov : A_star_H ∪ A_H ∪ A_H = H.toHypergraph := by + rw [GM10.union_assoc, GM10.union_self] + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (union_le hRestr.1.left_le hsep_H.left_le) le_rfl + · ext v + refine ⟨fun h => (union_le hRestr.1.left_le hsep_H.left_le).vertexSet_subset h, + fun hv => ?_⟩ + rw [← hRestr.1.vertexSet_union] at hv + exact hv.imp_right fun h => hB_sub_AH_V h + · ext e + refine ⟨fun h => (union_le hRestr.1.left_le hsep_H.left_le).edgeSet_subset h, + fun he => ?_⟩ + rw [← hRestr.1.edgeSet_union] at he + exact he.imp_right fun h => hB_sub_AH_E h + exact hFlat.isSpan.isControlling.isTangle_H.axiom2 hAB_star_T hAH_T hAH_T hcov + · obtain ⟨i, hAi⟩ := mem_iUnion.mp hA_i + have hAi_le_star : A_soc.G ≤ (D i).localSociety.G := (hType_i i).1.le A_soc hAi.1 + have hB_sub_star_E : B_star.edgeSet ⊆ E((D i).localSociety.G) := + hB_sub_E.trans hAi_le_star.edgeSet_mono + have hE_ne : H.E.Nonempty := + edges_nonempty_of_tangle hS hFlat.isSpan.isRespectful (by omega) + have hri_A : r i ∈ H.A := Or.inr (hr_eye i).1 + have hB_ne_ri : B_star_H.edgeSet ≠ {r i} := by + intro hEq + have hri_E : r i ∈ H.E := by + have : r i ∈ B_star_H.edgeSet := hEq ▸ mem_singleton (r i) + rw [hB_star_E] at this + exact this.1 + obtain ⟨x, hx_ri⟩ := hri_E.1 + obtain ⟨y, hy_compl, hy_eq⟩ := (hr_eye i).1 + have hx_compl : x ∈ Set.univ \ H.U := + connectedComponentIn_subset (Set.univ \ H.U) y (hy_eq.symm ▸ hx_ri) + exact hx_compl.2 (hri_E.2.1 hx_ri).1 + obtain ⟨e₀, he₀_B, hd_ge⟩ := + gm14_theorem_7_3 H θ T d A_star_H B_star_H (r i) hS hConn hE_ne hMetric hri_A + hAB_star_T hB_ne_ri + rw [hB_star_E] at he₀_B + obtain ⟨he₀_H, he₀_Bstar⟩ := he₀_B + have he₀_star : η.eMap e₀ ∈ E((D i).localSociety.G) := hB_sub_star_E he₀_Bstar + rw [(D i).soc_star_G, edgeSet_subgraphUnion (hJi_le i) (hPi_le i)] at he₀_star + have he₀_P : η.eMap e₀ ∈ E(arrangementPullbackGraph G₀ S₀ α₀_disc α₀_pt (D i).Δ) := by + rcases he₀_star with he₀_J | he₀_P + · rw [eyeBridgeUnion_edgeSet] at he₀_J + obtain ⟨B, ⟨hB, _⟩, he₀_B⟩ := mem_iUnion₂.mp he₀_J + exact False.elim (Set.disjoint_left.mp (isBridge_disjoint_edgeSet hB) + he₀_B (η.bijOn_e.mapsTo he₀_H)) + · exact he₀_P + rw [arrangementPullbackGraph, edgeSet_restrict] at he₀_P + obtain ⟨A', ⟨hA'_S₀, hA'_sub⟩, he₀_A'⟩ := mem_iUnion₂.mp he₀_P.2 + rw [← hη₀_e e₀ he₀_H] at he₀_A' + have he₀_sub_Δ : e₀ ⊆ (D i).Δ := + ((hCompat₀.inter_E_iff A' hA'_S₀ e₀ he₀_H).mpr he₀_A').trans hA'_sub + obtain ⟨u, hu_cl, _⟩ := edge_closure_inter_V_nonempty he₀_H + obtain ⟨σ, hσ_e₀⟩ := closure_nonempty_iff.mp ⟨u, hu_cl⟩ + have hd_le : d (r i) e₀ ≤ 3 * beta + 6 := + (D i).dist_le_of_inter_Δ e₀ (Or.inl (Or.inr he₀_H)) ⟨σ, hσ_e₀, he₀_sub_Δ hσ_e₀⟩ + omega + +/-- The local discs and points, together with the retained arrangement, give an arrangement of + the assembled segregation. -/ +theorem arrange_replacement_societies + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (θ_star : ℕ) + (θ : ℕ) + (θ' : ℕ) + (lam : ℕ) + (π : ℕ) + (beta : ℕ) + (μ : ℕ) + (k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (r : Fin k → Set S) + (S₀ : Set (Society α β)) + (α₀_disc : Society α β → Set S) + (α₀_pt : α → S) + (D : (i : Fin k) → Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt + i) + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hArr₀ : IsSurfaceArrangement S₀ α₀_disc α₀_pt) + (hDisj_Δ : Pairwise fun i j => Disjoint (D i).Δ (D j).Δ) + (hS : IsClosedSurface S) + (S_seg : Fin k → Set (Society α β)) + (α_disc_i : Fin k → Society α β → Set S) + (α_pt_i : Fin k → α → S) + (hBar_i : ∀ (i : Fin k), (D i).localSociety.Ω.bar ⊆ segregationVertices (S_seg i)) + (hpt_i_eq_0 : ∀ (i : Fin k), ∀ v ∈ (D i).localSociety.Ω.bar, α_pt_i i v = α₀_pt v) + (hpt_i_mem_Δ : ∀ (i : Fin k), ∀ v ∈ segregationVertices (S_seg i), α_pt_i i v ∈ (D i).Δ) + (hinj_i : ∀ (i : Fin k), InjOn (α_pt_i i) (segregationVertices (S_seg i))) + (hdisc_i_closed : ∀ (i : Fin k), ∀ B ∈ S_seg i, IsClosedDisc (α_disc_i i B) ∧ α_disc_i i B ⊆ + (D i).Δ ∧ ∀ x ∈ B.Ω.bar, α_pt_i i x ∈ subBd (α_disc_i i B)) + (hnat_i : ∀ (i : Fin k), ∀ B ∈ S_seg i, IsNaturalOrderFrom (α_pt_i i) B.Ω (subBd (α_disc_i i + B))) + (hinter_bd_i : ∀ (i : Fin k), ∀ B ∈ S_seg i, α_disc_i i B ∩ subBd (D i).Δ ⊆ α_pt_i i '' + (B.Ω.bar ∩ (D i).localSociety.Ω.bar)) + (hinter_discs_i : ∀ (i : Fin k), ∀ B₁ ∈ S_seg i, ∀ B₂ ∈ S_seg i, B₁ ≠ B₂ → α_disc_i i B₁ ∩ + α_disc_i i B₂ ⊆ α_pt_i i '' (B₁.Ω.bar ∩ B₂.Ω.bar)) : + let S' : Set (Society α β) := {A | A ∈ S₀ ∧ ∀ (i : Fin k), ¬α₀_disc A ⊆ (D i).Δ} + let S_seg' : Fin k → Set (Society α β) := fun i => {B | B ∈ S_seg i ∧ V(B.G).Nonempty ∧ B ∉ + S'} + let S_final : Set (Society α β) := S' ∪ ⋃ i, S_seg' i + ∀ (α_disc : Society α β → Set S), + ∀ (α_pt : α → S), + (∀ {B : Society α β}, B ∈ S' → α_disc B = α₀_disc B) → + (∀ (i : Fin k) {B : Society α β}, B ∈ S_seg' i → α_disc B = α_disc_i i B) → + (∀ (i : Fin k) {v : α}, v ∈ segregationVertices (S_seg i) → α_pt v = α_pt_i i v) → + (∀ {v : α}, v ∈ segregationVertices S' → α_pt v = α₀_pt v) → + IsSurfaceArrangement S_final α_disc α_pt := by + intro S' S_seg' S_final α_disc α_pt hα_disc_S' hα_disc_seg' hClaim5 hα_pt_S' + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · -- Claim (6): `IsClosedDisc (α_disc B)` and `∀ x ∈ B.Ω.bar, α_pt x ∈ subBd (α_disc B)`. + rintro B (hB_S' | hB_i) + · rw [hα_disc_S' hB_S'] + refine ⟨(hArr₀.isClosedDisc B hB_S'.1).1, fun x hx => ?_⟩ + rw [hα_pt_S' (mem_biUnion hB_S' hx)] + exact (hArr₀.isClosedDisc B hB_S'.1).2 x hx + · obtain ⟨i, hBi⟩ := mem_iUnion.mp hB_i + rw [hα_disc_seg' i hBi] + refine ⟨(hdisc_i_closed i B hBi.1).1, fun x hx => ?_⟩ + rw [hClaim5 i (mem_biUnion hBi.1 hx)] + exact (hdisc_i_closed i B hBi.1).2.2 x hx + · -- Claim (7): Intersection of two discs `α_disc B₁ ∩ α_disc B₂` for `B₁ ≠ B₂`. + have hinter_seg_S' : ∀ (i : Fin k) {B A : Society α β}, + B ∈ S_seg' i → A ∈ S' → + α_disc B ∩ α_disc A ⊆ α_pt '' (B.Ω.bar ∩ A.Ω.bar) := by + intro i B A hBi hA_S' x ⟨hxB, hxA⟩ + rw [hα_disc_seg' i hBi] at hxB + rw [hα_disc_S' hA_S'] at hxA + have hx_Δ : x ∈ (D i).Δ := (hdisc_i_closed i B hBi.1).2.1 hxB + have hx_bdΔ : x ∈ subBd (D i).Δ := + (inter_disc_subset_subBd_of_not_subset hS hArr₀ (D i).isClosedDisc_Δ + (D i).isNormal_bd hA_S'.1 (hA_S'.2 i)).1 ⟨hxA, hx_Δ⟩ + obtain ⟨v, hvA_bar, rfl⟩ := (D i).isNormal_bd A hA_S'.1 ⟨hx_bdΔ, hxA⟩ + obtain ⟨w, ⟨hwB_bar, hw_star_bar⟩, hw_eq⟩ := hinter_bd_i i B hBi.1 ⟨hxB, hx_bdΔ⟩ + have hw_eq_0 : α₀_pt w = α₀_pt v := by + rw [← hpt_i_eq_0 i w hw_star_bar, hw_eq] + have hv_seg₀ : v ∈ segregationVertices S₀ := mem_biUnion hA_S'.1 hvA_bar + have hw_seg₀ : w ∈ segregationVertices S₀ := ((D i).soc_star_Ω.1 ▸ hw_star_bar).1 + have hvw : w = v := hArr₀.injOn_pts hw_seg₀ hv_seg₀ hw_eq_0 + subst hvw + refine ⟨w, ⟨hwB_bar, hvA_bar⟩, ?_⟩ + exact hα_pt_S' (mem_biUnion hA_S' hvA_bar) + rintro B₁ (hB₁_S' | hB₁_i) B₂ (hB₂_S' | hB₂_j) hne + · rw [hα_disc_S' hB₁_S', hα_disc_S' hB₂_S'] + intro x hx + obtain ⟨v, hv, rfl⟩ := hArr₀.inter_discs B₁ hB₁_S'.1 B₂ hB₂_S'.1 hne hx + exact ⟨v, hv, hα_pt_S' (mem_biUnion hB₁_S' hv.1)⟩ + · obtain ⟨j, hB₂_j⟩ := mem_iUnion.mp hB₂_j + rw [Set.inter_comm, Set.inter_comm B₁.Ω.bar] + exact hinter_seg_S' j hB₂_j hB₁_S' + · obtain ⟨i, hB₁_i⟩ := mem_iUnion.mp hB₁_i + exact hinter_seg_S' i hB₁_i hB₂_S' + · obtain ⟨i, hB₁_i⟩ := mem_iUnion.mp hB₁_i + obtain ⟨j, hB₂_j⟩ := mem_iUnion.mp hB₂_j + rw [hα_disc_seg' i hB₁_i, hα_disc_seg' j hB₂_j] + by_cases hij : i = j + · subst hij + intro x hx + obtain ⟨v, hv, rfl⟩ := hinter_discs_i i B₁ hB₁_i.1 B₂ hB₂_j.1 hne hx + exact ⟨v, hv, hClaim5 i (mem_biUnion hB₁_i.1 hv.1)⟩ + · rintro x ⟨hx1, hx2⟩ + exact False.elim (Set.disjoint_left.mp (hDisj_Δ hij) + ((hdisc_i_closed i B₁ hB₁_i.1).2.1 hx1) + ((hdisc_i_closed j B₂ hB₂_j.1).2.1 hx2)) + · -- Intersection with `bd S = ∅`. + intro B _ + rw [hFlat.isSpan.bd_empty, inter_empty] + exact empty_subset _ + · -- Claim (8): `InjOn α_pt (segregationVertices S_final)`. + have hseg_final_cases : ∀ {v : α}, v ∈ segregationVertices S_final → + v ∈ segregationVertices S' ∨ ∃ i : Fin k, v ∈ segregationVertices (S_seg i) := by + intro v hv + rcases mem_iUnion₂.mp hv with ⟨B, hB_S' | hB_i, hvB⟩ + · exact Or.inl (mem_biUnion hB_S' hvB) + · obtain ⟨i, hBi⟩ := mem_iUnion.mp hB_i + exact Or.inr ⟨i, mem_biUnion hBi.1 hvB⟩ + have hinj_seg_S' : ∀ (i : Fin k) {u v : α}, + u ∈ segregationVertices (S_seg i) → v ∈ segregationVertices S' → + α_pt u = α_pt v → u = v := by + intro i u v hu_i hv_S' huv + by_cases hv_i : v ∈ segregationVertices (S_seg i) + · rw [hClaim5 i hu_i, hClaim5 i hv_i] at huv + exact hinj_i i hu_i hv_i huv + · exfalso + have hv_not_bar_star : v ∉ (D i).localSociety.Ω.bar := + fun hbar => hv_i (hBar_i i hbar) + obtain ⟨A, hA_S', hvA_bar⟩ := mem_iUnion₂.mp hv_S' + have hv_seg₀ : v ∈ segregationVertices S₀ := mem_biUnion hA_S'.1 hvA_bar + have hv_not_bdΔ : α₀_pt v ∉ subBd (D i).Δ := by + intro hbd + apply hv_not_bar_star + rw [(D i).soc_star_Ω.1] + exact ⟨hv_seg₀, hbd⟩ + have hv_bdA : α₀_pt v ∈ subBd (α₀_disc A) := (hArr₀.isClosedDisc A hA_S'.1).2 v hvA_bar + have hv_discA : α₀_pt v ∈ α₀_disc A := + (hArr₀.isClosedDisc A hA_S'.1).1.isClosed.closure_subset_iff.mpr Subset.rfl hv_bdA.1 + have hv_not_Δ : α₀_pt v ∉ (D i).Δ := fun hΔ => + hv_not_bdΔ ((inter_disc_subset_subBd_of_not_subset hS hArr₀ (D i).isClosedDisc_Δ + (D i).isNormal_bd hA_S'.1 (hA_S'.2 i)).1 ⟨hv_discA, hΔ⟩) + rw [hClaim5 i hu_i, hα_pt_S' hv_S'] at huv + exact hv_not_Δ (huv ▸ hpt_i_mem_Δ i u hu_i) + intro u hu v hv huv + rcases hseg_final_cases hu with hu_S' | ⟨i, hu_i⟩ <;> + rcases hseg_final_cases hv with hv_S' | ⟨j, hv_j⟩ + · rw [hα_pt_S' hu_S', hα_pt_S' hv_S'] at huv + have hsub : segregationVertices S' ⊆ segregationVertices S₀ := + biUnion_mono (fun _ h => h.1) (fun _ _ => Subset.rfl) + exact hArr₀.injOn_pts (hsub hu_S') (hsub hv_S') huv + · exact (hinj_seg_S' j hv_j hu_S' huv.symm).symm + · exact hinj_seg_S' i hu_i hv_S' huv + · rw [hClaim5 i hu_i, hClaim5 j hv_j] at huv + by_cases hij : i = j + · subst hij + exact hinj_i i hu_i hv_j huv + · exfalso + exact Set.disjoint_left.mp (hDisj_Δ hij) + (hpt_i_mem_Δ i u hu_i) (huv ▸ hpt_i_mem_Δ j v hv_j) + · -- Claim (9): `IsNaturalOrderFrom α_pt B.Ω (subBd (α_disc B))` for all `B ∈ S_final`. + have hnat_congr : ∀ {ν₁ ν₂ : α → S} {Ω : CyclicPerm α} {F : Set S}, + (∀ v ∈ Ω.bar, ν₁ v = ν₂ v) → IsNaturalOrderFrom ν₁ Ω F → IsNaturalOrderFrom ν₂ Ω F := by + intro ν₁ ν₂ Ω F heq ⟨hOArc, φ, hmem, hcw3⟩ + refine ⟨hOArc, φ, fun v hv => heq v hv ▸ hmem v hv, fun v₁ v₂ v₃ hcw => ?_⟩ + obtain ⟨t₁, t₂, t₃, h12, h23, h31, h1, h2, h3⟩ := hcw3 v₁ v₂ v₃ hcw + have hv1 : v₁ ∈ Ω.bar := hcw.2.1 v₁ (by simp) + have hv2 : v₂ ∈ Ω.bar := hcw.2.1 v₂ (by simp) + have hv3 : v₃ ∈ Ω.bar := hcw.2.1 v₃ (by simp) + exact ⟨t₁, t₂, t₃, h12, h23, h31, h1.trans (heq v₁ hv1), + h2.trans (heq v₂ hv2), h3.trans (heq v₃ hv3)⟩ + rintro B (hB_S' | hB_i) + · rw [hα_disc_S' hB_S'] + exact hnat_congr (fun v hv => (hα_pt_S' (mem_biUnion hB_S' hv)).symm) + (hArr₀.natural_order B hB_S'.1) + · obtain ⟨i, hBi⟩ := mem_iUnion.mp hB_i + rw [hα_disc_seg' i hBi] + exact hnat_congr (fun v hv => (hClaim5 i (mem_biUnion hBi.1 hv)).symm) + (hnat_i i B hBi.1) + +/-- Distinct large societies in the assembled segregation come from different local pieces. -/ +private theorem large_boundaries_disjoint_of_eye_segregation + {G₀ : Graph α β} {S₀ S' : Set (Society α β)} (hThree : IsThreeSegregation G₀ S₀) + (hRetained : S' ⊆ S₀) {k p : ℕ} {pieces : Fin k → Graph α β} + {S_seg S_seg' : Fin k → Set (Society α β)} (hLocal : ∀ i, S_seg' i ⊆ S_seg i) + (hType_i : ∀ i, IsSegregationOfType (pieces i) p 1 (S_seg i)) + (hDisj_star : Pairwise (fun i j : Fin k => Disjoint V(pieces i) V(pieces j))) : + ∀ A ∈ S' ∪ ⋃ i, S_seg' i, ∀ B ∈ S' ∪ ⋃ i, S_seg' i, + A ≠ B → 3 < A.Ω.bar.ncard → 3 < B.Ω.bar.ncard → Disjoint A.Ω.bar B.Ω.bar := by + intro A hA B hB hne hlargeA hlargeB + have hLargeLocal : ∀ C ∈ S' ∪ ⋃ i, S_seg' i, 3 < C.Ω.bar.ncard → ∃ i, C ∈ S_seg' i := by + intro C hC hlarge + rcases hC with hC | hC + · exact (not_lt_of_ge (hThree.2 C (hRetained hC)) hlarge).elim + · exact mem_iUnion.mp hC + obtain ⟨i, hAi⟩ := hLargeLocal A hA hlargeA + obtain ⟨j, hBj⟩ := hLargeLocal B hB hlargeB + have hij : i ≠ j := by + intro hij + subst j + have hfin : {C ∈ S_seg i | 3 < C.Ω.bar.ncard}.Finite := + (hType_i i).1.finite.subset fun _ h => h.1 + exact hne ((Set.ncard_le_one hfin).mp (hType_i i).vortex_count_le A + ⟨hLocal i hAi, hlargeA⟩ B ⟨hLocal i hBj, hlargeB⟩) + exact (hDisj_star hij).mono + (fun _ hv => ((hType_i i).1.le A (hLocal i hAi)).vertexSet_mono (A.bar_subset hv)) + (fun _ hv => ((hType_i j).1.le B (hLocal j hBj)).vertexSet_mono (B.bar_subset hv)) + +/-- The construction of XV (7.7), including disjoint boundaries of large societies. -/ +theorem assemble_eye_arrangement : + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ θ' lam π beta μ k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin k → Set S) + (η₀ : SpanEmbedding H (section7G0 G H η d θ' μ r)) + (S₀ : Set (Society α β)) (α₀_disc : Society α β → Set S) (α₀_pt : α → S) + (D : ∀ i : Fin k, Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i), + IsFlatSpan G H η θ_star θ lam μ T_star T → + HasTangleMetric H θ T d → + 1 ≤ μ → 2 ≤ π → π ≠ 3 → beta = 2 * π + 8 → + θ' + 13 * μ + 14 ≤ beta → 100 * beta ≤ θ → + Injective r → + (∀ i : Fin k, IsDrawingEye G H η θ T (r i)) → + (∀ i j : Fin k, i ≠ j → d (r i) (r j) = θ) → + (∀ v ∈ H.V, η₀.vMap v = η.vMap v) → + (∀ e ∈ H.E, η₀.eMap e = η.eMap e) → + IsThreeSegregation (section7G0 G H η d θ' μ r) S₀ → + IsTangleLocal (section7G0 G H η d θ' μ r) H η₀ T S₀ → + IsSurfaceArrangement S₀ α₀_disc α₀_pt → + IsCompatibleWith (section7G0 G H η d θ' μ r) H η₀ S₀ α₀_disc α₀_pt → + Pairwise (fun i j : Fin k => Disjoint (D i).Δ (D j).Δ) → + (∀ i : Fin k, ∀ P_set : Set (Graph α β), + (D i).localSociety.IsCrookedTransaction P_set → P_set.ncard ≠ π) → + ∃ (𝒮 : Set (Society α β)) (disc : Society α β → Set S) (pt : α → S), + IsCentralSegregation G T_star 𝒮 ∧ IsSegregationOfType G (3 * π + 9) k 𝒮 ∧ + IsSurfaceArrangement 𝒮 disc pt ∧ + (∀ A ∈ 𝒮, ∀ B ∈ 𝒮, A ≠ B → 3 < A.Ω.bar.ncard → 3 < B.Ω.bar.ncard → + Disjoint A.Ω.bar B.Ω.bar) := by + classical + intro S _ _ α β G H η θ_star θ θ' lam π beta μ k T_star T d r η₀ S₀ α₀_disc α₀_pt D + hFlat hMetric hμ1 hπ2 hπ3 hbeta_eq hbeta_ge hθ_ge hr_inj hr_eye hr_dist hη₀_v hη₀_e + hThree hLocal hArr₀ hCompat₀ hDisj_Δ hno_crooked + have hS : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + have hθ_bound : 2 * (θ' + 12 * μ + 14) + μ ≤ θ := by omega + have hDisj_star : Pairwise (fun i j : Fin k => Disjoint V((D i).localSociety.G) V((D + j).localSociety.G)) + := + theorem_7_6_proof G H η θ_star θ θ' lam π beta μ k T_star T d r η₀ S₀ α₀_disc α₀_pt D + hFlat hMetric hμ1 hθ_bound hr_inj hr_eye hr_dist hη₀_v hThree hArr₀ hCompat₀ hDisj_Δ + let G₀ := section7G0 G H η d θ' μ r + have hPair_le := section7G0_members_le G H η d θ' μ r + have hG₀_le : G₀ ≤ G := section7G0_le G H η d θ' μ r + have hJi_le : ∀ i : Fin k, eyeBridgeUnion G H η d θ' μ (r i) ≤ G := + fun _ => subgraphSUnion_le (fun _ hB => hB.1.2.1) + have hPi_le : ∀ i : Fin k, arrangementPullbackGraph G₀ S₀ α₀_disc α₀_pt (D i).Δ ≤ G := + fun _ => (restrict_le.trans (G₀.induce_le inter_subset_right)).trans hG₀_le + have hstar_le : ∀ i : Fin k, (D i).localSociety.G ≤ G := by + intro i + rw [(D i).soc_star_G] + exact subgraphUnion_le (hJi_le i) (hPi_le i) + -- For each `i : Fin k`, apply (6.1) (`theorem_6_1_proof`) and transport to `(D i).Δ`. + have hex_i : ∀ i : Fin k, + ∃ (S_seg_i : Set (Society α β)) (α_disc_i : Society α β → Set S) (α_pt_i : α → S), + IsSegregationOfType (D i).localSociety.G (3 * π + 9) 1 S_seg_i ∧ + (D i).localSociety.Ω.bar ⊆ segregationVertices S_seg_i ∧ + (∀ v ∈ (D i).localSociety.Ω.bar, α_pt_i v = α₀_pt v) ∧ + (∀ v ∈ segregationVertices S_seg_i, α_pt_i v ∈ (D i).Δ) ∧ + (∀ v ∈ segregationVertices S_seg_i, v ∉ (D i).localSociety.Ω.bar → + α_pt_i v ∈ (D i).Δ \ subBd (D i).Δ) ∧ + InjOn α_pt_i (segregationVertices S_seg_i) ∧ + (∀ B ∈ S_seg_i, IsClosedDisc (α_disc_i B) ∧ α_disc_i B ⊆ (D i).Δ ∧ + ∀ x ∈ B.Ω.bar, α_pt_i x ∈ subBd (α_disc_i B)) ∧ + (∀ B ∈ S_seg_i, IsNaturalOrderFrom α_pt_i B.Ω (subBd (α_disc_i B))) ∧ + (∀ B ∈ S_seg_i, α_disc_i B ∩ subBd (D i).Δ ⊆ α_pt_i '' (B.Ω.bar ∩ + (D i).localSociety.Ω.bar)) ∧ + (∀ B₁ ∈ S_seg_i, ∀ B₂ ∈ S_seg_i, B₁ ≠ B₂ → + α_disc_i B₁ ∩ α_disc_i B₂ ⊆ α_pt_i '' (B₁.Ω.bar ∩ B₂.Ω.bar)) := by + intro i + obtain ⟨S_seg_i, m, A₀_i, A_i, Δ_E, α₀_E, α_disc_E, α_pt_E, + hS_eq, hType_i, hBar_i, hDiscArr_i⟩ := + theorem_6_1_proof (D i).localSociety π hπ2 hπ3 (hno_crooked i) + subst hS_eq + have hinj_bar_i : InjOn α₀_pt (D i).localSociety.Ω.bar := + hArr₀.injOn_pts.mono (fun v hv => ((D i).soc_star_Ω.1 ▸ hv).1) + obtain ⟨α_disc_S, α_pt_S, h1, h2, h3, h4, h5, h6, h7, h8⟩ := + exists_surface_disc_arrangement_of_isDiscArrangement hS (D i).localSociety A₀_i A_i + Δ_E α₀_E α_disc_E α_pt_E hBar_i hDiscArr_i (D i).Δ (D i).isClosedDisc_Δ + α₀_pt hinj_bar_i (D i).soc_star_Ω.2 + exact ⟨insert A₀_i (range A_i), α_disc_S, α_pt_S, hType_i, hBar_i, + h1, h2, h3, h4, h5, h6, h7, h8⟩ + choose S_seg α_disc_i α_pt_i hType_i hBar_i hpt_i_eq_0 hpt_i_mem_Δ hpt_i_mem_int + hinj_i hdisc_i_closed hnat_i hinter_bd_i hinter_discs_i using hex_i + have hseg_i_sub_V : ∀ i : Fin k, segregationVertices (S_seg i) ⊆ V((D i).localSociety.G) := by + intro i v hv + rcases mem_iUnion₂.mp hv with ⟨B, hB, hvB⟩ + exact ((hType_i i).1.le B hB).vertexSet_mono (B.bar_subset hvB) + -- Define `S'`, `S_seg' i`, and `S_final`. + let S' : Set (Society α β) := {A ∈ S₀ | ∀ i : Fin k, ¬ α₀_disc A ⊆ (D i).Δ} + let S_seg' : Fin k → Set (Society α β) := fun i => + {B ∈ S_seg i | V(B.G).Nonempty ∧ B ∉ S'} + let S_final : Set (Society α β) := S' ∪ ⋃ i : Fin k, S_seg' i + have hDisj_S'_seg' : ∀ i : Fin k, Disjoint S' (S_seg' i) := + fun i => Set.disjoint_left.mpr fun _ hS' hseg' => hseg'.2.2 hS' + have hDisj_seg' : Pairwise (fun i j : Fin k => Disjoint (S_seg' i) (S_seg' j)) := by + intro i j hij + refine Set.disjoint_left.mpr fun B hBi hBj => ?_ + obtain ⟨v, hv⟩ := hBi.2.1 + exact Set.disjoint_left.mp (hDisj_star hij) + (((hType_i i).1.le B hBi.1).vertexSet_mono hv) + (((hType_i j).1.le B hBj.1).vertexSet_mono hv) + -- Claim (2): `S_final` is a graph segregation of `G`. + have hFin₀ : S'.Finite := hThree.1.finite.subset fun _ h => h.1 + have hFin_eye (i : Fin k) : (S_seg' i).Finite := (hType_i i).1.finite.subset fun _ h => h.1 + have hFin_final : S_final.Finite := hFin₀.union (finite_iUnion hFin_eye) + have hLe_final : ∀ B ∈ S_final, B.G ≤ G := by + rintro B (hB_S' | hB_i) + · exact (hThree.1.le B hB_S'.1).trans hG₀_le + · obtain ⟨i, hBi⟩ := mem_iUnion.mp hB_i + exact ((hType_i i).1.le B hBi.1).trans (hstar_le i) + have hCover_star_V : ∀ (i : Fin k) {v : α}, v ∈ V((D i).localSociety.G) → + ∃ B ∈ S_final, v ∈ V(B.G) := by + intro i v hv + have hv_u : v ∈ V(subgraphSUnion (D i).localSociety.G ((fun B : Society α β => B.G) '' S_seg i)) + := by + rw [(hType_i i).1.union_eq]; exact hv + rw [vertexSet_subgraphSUnion] at hv_u + obtain ⟨_, ⟨B, hB, rfl⟩, hvB⟩ := mem_iUnion₂.mp hv_u + by_cases hB_S' : B ∈ S' + · exact ⟨B, Or.inl hB_S', hvB⟩ + · exact ⟨B, Or.inr (mem_iUnion.mpr ⟨i, hB, ⟨v, hvB⟩, hB_S'⟩), hvB⟩ + have hCover_star_E : ∀ (i : Fin k) {e : β}, e ∈ E((D i).localSociety.G) → + ∃ B ∈ S_final, e ∈ E(B.G) := by + intro i e he + have he_u : e ∈ E(subgraphSUnion (D i).localSociety.G ((fun B : Society α β => B.G) '' S_seg i)) + := by + rw [(hType_i i).1.union_eq]; exact he + rw [edgeSet_subgraphSUnion (by rintro _ ⟨B, hB, rfl⟩; exact (hType_i i).1.le B hB)] at he_u + obtain ⟨_, ⟨B, hB, rfl⟩, heB⟩ := mem_iUnion₂.mp he_u + obtain ⟨x, _, hxy⟩ := B.G.exists_isLink_of_mem_edgeSet heB + by_cases hB_S' : B ∈ S' + · exact ⟨B, Or.inl hB_S', heB⟩ + · exact ⟨B, Or.inr (mem_iUnion.mpr ⟨i, hB, ⟨x, hxy.left_mem⟩, hB_S'⟩), heB⟩ + have hSegregation : IsGraphSegregation G S_final := by + exact assemble_eye_segregation (S := S) (α := α) (β := β) G H η θ_star θ θ' π beta μ k T_star + T d r η₀ S₀ α₀_disc α₀_pt D hη₀_v hThree hArr₀ hCompat₀ hS hDisj_star hPair_le hJi_le + hPi_le hstar_le S_seg hType_i hBar_i hFin_final hLe_final hCover_star_V + hCover_star_E + -- Claim (3): `S_final` is of type `(3 * π + 9, k)`. + have hClaim3 : IsSegregationOfType G (3 * π + 9) k S_final := by + refine ⟨hSegregation, ?_, ?_⟩ + · let F : Fin k → Set (Society α β) := fun i => {B ∈ S_seg i | 3 < B.Ω.bar.ncard} + have hsub : {B ∈ S_final | 3 < B.Ω.bar.ncard} ⊆ ⋃ i : Fin k, F i := by + rintro B ⟨hB_S' | hB_i, hgt⟩ + · exact False.elim (not_lt_of_ge (hThree.2 B hB_S'.1) hgt) + · obtain ⟨i, hBi⟩ := mem_iUnion.mp hB_i + exact mem_iUnion.mpr ⟨i, hBi.1, hgt⟩ + have hfin_u : (⋃ i : Fin k, F i).Finite := + finite_iUnion fun i => (hType_i i).1.finite.subset fun _ h => h.1 + exact (ncard_le_ncard hsub hfin_u).trans + (ncard_iUnion_le_of_ncard_le_one k F (fun i => (hType_i i).vortex_count_le)) + · rintro B (hB_S' | hB_i) hgt + · exact False.elim (not_lt_of_ge (hThree.2 B hB_S'.1) hgt) + · obtain ⟨i, hBi⟩ := mem_iUnion.mp hB_i + exact (hType_i i).is_p_vortex hBi.1 hgt + -- Claim (4): `S_final` is `T_star`-central. + have hCentral : IsCentralSegregation G T_star S_final := by + exact assembled_eye_segregation_is_central (S := S) (α := α) (β := β) G H η θ_star θ θ' lam π + beta μ k T_star T d r η₀ S₀ α₀_disc α₀_pt D hFlat hMetric hμ1 hπ2 hbeta_eq hθ_ge hr_eye + hη₀_v hη₀_e hThree hLocal hCompat₀ hS hθ_bound hJi_le hPi_le S_seg hType_i + hClaim3 + -- Define `α_disc` and `α_pt` and prove Claims (5)–(9). + let α_disc : Society α β → Set S := fun B => + if h : ∃ i : Fin k, B ∈ S_seg' i then α_disc_i (Classical.choose h) B else α₀_disc B + let α_pt : α → S := fun v => + if h : ∃ i : Fin k, v ∈ segregationVertices (S_seg i) then α_pt_i (Classical.choose h) v + else α₀_pt v + have hα_disc_S' : ∀ {B : Society α β}, B ∈ S' → α_disc B = α₀_disc B := by + intro B hB + have hnot : ¬ ∃ i : Fin k, B ∈ S_seg' i := by + rintro ⟨i, hBi⟩ + exact Set.disjoint_left.mp (hDisj_S'_seg' i) hB hBi + simp [α_disc, hnot] + have hα_disc_seg' : ∀ (i : Fin k) {B : Society α β}, B ∈ S_seg' i → α_disc B = α_disc_i i B := by + intro i B hBi + have hex : ∃ j : Fin k, B ∈ S_seg' j := ⟨i, hBi⟩ + have hij : Classical.choose hex = i := by + by_contra hne + exact Set.disjoint_left.mp (hDisj_seg' hne) (Classical.choose_spec hex) hBi + simp [α_disc, hex, hij] + -- Claim (5): For `i : Fin k`, if `v ∈ segregationVertices (S_seg i)` then `α_pt v = α_pt_i i v`. + have hClaim5 : ∀ (i : Fin k) {v : α}, v ∈ segregationVertices (S_seg i) → + α_pt v = α_pt_i i v := by + intro i v hvi + have hex : ∃ j : Fin k, v ∈ segregationVertices (S_seg j) := ⟨i, hvi⟩ + have hij : Classical.choose hex = i := by + by_contra hne + exact Set.disjoint_left.mp (hDisj_star hne) + (hseg_i_sub_V _ (Classical.choose_spec hex)) (hseg_i_sub_V i hvi) + simp [α_pt, hex, hij] + have hα_pt_S' : ∀ {v : α}, v ∈ segregationVertices S' → α_pt v = α₀_pt v := by + intro v hv_S' + by_cases hex : ∃ i : Fin k, v ∈ segregationVertices (S_seg i) + · obtain ⟨i, hvi⟩ := hex + rw [hClaim5 i hvi] + obtain ⟨A, hA_S', hvA⟩ := mem_iUnion₂.mp hv_S' + have hv_bar_star : v ∈ (D i).localSociety.Ω.bar := + (theorem_7_7_claim_1 hS (D i) hη₀_v hThree hArr₀ hCompat₀ hA_S'.1 (hA_S'.2 i)).2 + ⟨hseg_i_sub_V i hvi, A.bar_subset hvA⟩ + exact hpt_i_eq_0 i v hv_bar_star + · simp [α_pt, hex] + -- Claims (6)–(9): `(S_final, α_disc, α_pt)` is a surface arrangement in `S`. + have hArr_final : IsSurfaceArrangement S_final α_disc α_pt := by + exact arrange_replacement_societies (S := S) (α := α) (β := β) G H η θ_star θ θ' lam π beta μ + k T_star T d r S₀ α₀_disc α₀_pt D hFlat hArr₀ hDisj_Δ hS S_seg α_disc_i α_pt_i hBar_i + hpt_i_eq_0 hpt_i_mem_Δ hinj_i hdisc_i_closed hnat_i hinter_bd_i hinter_discs_i + α_disc α_pt hα_disc_S' hα_disc_seg' hClaim5 hα_pt_S' + refine ⟨S_final, α_disc, α_pt, hCentral, hClaim3, hArr_final, ?_⟩ + exact large_boundaries_disjoint_of_eye_segregation (S' := S') (S_seg' := S_seg') + hThree (fun _ h ↦ h.1) (fun _ _ h ↦ h.1) hType_i hDisj_star + +/-- **Graph Minors XV, (7.7)** (pages 139–142): +If there is no crooked transaction of cardinality `π` in `(G_i*, Ω_i*)` for `1 ≤ i ≤ k`, then +`(S3)` holds. +Proved from `(2.1)` (`theorem_2_1_proof`), `(6.1)` (`theorem_6_1_proof`), `(7.6)` +(`theorem_7_6_proof`), and Graph +Minors XIV, `(7.3)` (`gm14_theorem_7_3`). -/ +theorem theorem_7_7_proof : GM15Theorem77Statement.{u, v, w} := by + intro S _ _ α β G H η θ_star θ θ' lam π beta μ k T_star T d r η₀ S₀ α₀_disc α₀_pt D + hFlat hMetric hμ1 hπ2 hπ3 hbeta_eq hbeta_ge hθ_ge hr_inj hr_eye hr_dist hη₀_v hη₀_e + hThree hLocal hArr₀ hCompat₀ hDisj_Δ hno_crooked + obtain ⟨𝒮, disc, pt, hCentral, hType, hArr, _⟩ := + assemble_eye_arrangement G H η θ_star θ θ' lam π beta μ k T_star T d r η₀ S₀ α₀_disc α₀_pt + D hFlat hMetric hμ1 hπ2 hπ3 hbeta_eq hbeta_ge hθ_ge hr_inj hr_eye hr_dist hη₀_v hη₀_e + hThree hLocal hArr₀ hCompat₀ hDisj_Δ hno_crooked + exact ⟨𝒮, disc, pt, hCentral, hType, hArr⟩ + +/-- Statement of Graph Minors XV, (7.8) (page 142): +"There is a transaction $\mathscr{P}$ in $(G_0 \cup J_1, \Omega_1)$ such that $V(\mathscr{P})$ is +free with respect to the $(12\beta + 14)$-compression of $\mathscr{T}$ in $H \cap (\Sigma - +\Lambda_1)$, each $P \in \mathscr{P}$ meets $H \cap (\Sigma - \Lambda_1)$ precisely in the ends of +$P$, and one of the following holds: +(i) $|\mathscr{P}| = \phi$ and $\mathscr{P}$ is a crosscap transaction +(ii) $|\mathscr{P}| = \tau_1$ and $\mathscr{P}$ is a leap transaction +(iii) $|\mathscr{P}| = \tau_2$ and $\mathscr{P}$ is a doublecross transaction." -/ +def GM15Theorem78Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ θ' π beta μ φ τ₁ τ₂ k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin k → Set S) + (S₀ : Set (Society α β)) (α₀_disc : Society α β → Set S) (α₀_pt : α → S) + (i : Fin k) + (D_i : Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i) + (P_star : Set (Graph α β)), + 2 ≤ φ → 3 ≤ τ₁ → 4 ≤ τ₂ → + (φ - 1) * (2 * τ₁ + τ₂ - 7) ≤ π → + D_i.localSociety.IsCrookedTransaction P_star → P_star.ncard = π → + ∃ (P : Set (Graph α β)) (X : Set S), + D_i.clearedSociety.IsTransaction P ∧ + (∀ P₀ ∈ P, ∀ a b : α, + D_i.clearedSociety.IsOmegaPathWithEnds P₀ a b → + IsHPathWithEnds G D_i.clearedEmbedding.imageGraph P₀ a b) ∧ + X ⊆ (clearedSubdrawing H D_i.Λ).V ∩ subBd D_i.Λ ∧ + D_i.clearedSociety.transactionEnds P = D_i.clearedEmbedding.vMap '' X ∧ + IsFreeSet (clearedSubdrawing H D_i.Λ).toHypergraph D_i.T₁ (θ - 4 * (3 * beta + 3) - 2) X ∧ + ((P.ncard = φ ∧ D_i.clearedSociety.IsCrosscapTransaction P) ∨ + (P.ncard = τ₁ ∧ D_i.clearedSociety.IsLeapTransaction P) ∨ + (P.ncard = τ₂ ∧ D_i.clearedSociety.IsDoublecrossTransaction P)) + +/-- **Graph Minors XV, (7.8)** (page 142): +If `(G_i*, Ω_i*)` has a crooked transaction of cardinality `π`, then `(G₀ ∪ J_i, Ω_i)` has a +transaction `P` whose ends are free with respect to `T₁` in `H ∩ (Σ - Λ_i)`, each member of `P` +meets `H ∩ (Σ - Λ_i)` precisely in its ends, and `P` is either a crosscap transaction of size `φ`, a +leap transaction of size `τ₁`, or a doublecross transaction of size `τ₂`. +Proved from `(7.5)` (`Section75EyeData.dichotomy`), `(6.2)` (`theorem_6_2_proof`), and Graph Minors +X, +`(12.2)` (`GM10.IsFreeSet.subset`). -/ +theorem theorem_7_8_proof : + GM15Theorem78Statement.{u, v, w} := by + intro S _ _ α β G H η θ_star θ θ' π beta μ φ τ₁ τ₂ k T_star T d r S₀ α₀_disc α₀_pt + i D_i P_star hφ2 hτ₁3 hτ₂4 hπ_ge hCrook_star hCard_star + have hDich := D_i.dichotomy.resolve_right (fun hno => hno P_star hCrook_star hCard_star) + rcases hDich with ⟨P', X', hCrook', hCard', hPaths', hX'_sub, hEnds', hFree'⟩ + have h62 := theorem_6_2_proof D_i.clearedSociety φ τ₁ τ₂ P' hφ2 hτ₁3 hτ₂4 hCrook' + (hπ_ge.trans hCard') + rcases h62 with ⟨P, hPP', hCases⟩ + let X : Set S := {x ∈ X' | D_i.clearedEmbedding.vMap x ∈ D_i.clearedSociety.transactionEnds P} + have hXX' : X ⊆ X' := sep_subset _ _ + have hT₁ : IsTangle (clearedSubdrawing H D_i.Λ).toHypergraph + (θ - 4 * (3 * beta + 3) - 2) D_i.T₁ := + D_i.isCleared.hasMetric.1.2.1 + have hFreeX : IsFreeSet (clearedSubdrawing H D_i.Λ).toHypergraph D_i.T₁ + (θ - 4 * (3 * beta + 3) - 2) X := + hFree'.subset hT₁ hXX' + have hTransP : D_i.clearedSociety.IsTransaction P := by + rcases hCrook'.1 with ⟨A, B, hDisj, hFence, hAB⟩ + refine ⟨A, B, ⟨?_, ?_⟩, hFence, fun P₀ hP₀ => hAB P₀ (hPP' hP₀)⟩ + · intro P₀ hP₀ + exact hDisj.1 P₀ (hPP' hP₀) + · intro P₁ hP₁ P₂ hP₂ hne + exact hDisj.2 (hPP' hP₁) (hPP' hP₂) hne + have hEndsP : D_i.clearedSociety.transactionEnds P = D_i.clearedEmbedding.vMap '' X := by + ext v + constructor + · intro hv + have hv' : v ∈ D_i.clearedSociety.transactionEnds P' := by + rcases hv with ⟨P₀, hP₀, b, hPath⟩ + exact ⟨P₀, hPP' hP₀, b, hPath⟩ + rw [hEnds'] at hv' + rcases hv' with ⟨x, hxX', rfl⟩ + exact ⟨x, ⟨hxX', hv⟩, rfl⟩ + · rintro ⟨x, ⟨_, hv⟩, rfl⟩ + exact hv + exact ⟨P, X, hTransP, fun P₀ hP₀ => hPaths' P₀ (hPP' hP₀), + hXX'.trans hX'_sub, hEndsP, hFreeX, hCases⟩ + +/-- If `Ω` is a natural order from `F` via `ν : α → S` (`IsNaturalOrderFrom ν Ω F`) and `L` is an +`Ω`-clockwise sequence of length `≥ 3`, then `L.map ν` is listed in order on `F` +(`GM12.IsListedInOrderOn F (L.map ν)`). -/ +theorem isListedInOrderOn_of_isClockwiseSeq + {S : Type w} [TopologicalSpace S] {α : Type u} + {ν : α → S} {Ω : CyclicPerm α} {F : Set S} {L : List α} + (hNat : IsNaturalOrderFrom ν Ω F) + (hcw : Ω.IsClockwiseSeq L) (hlen : 3 ≤ L.length) : + GM12.IsListedInOrderOn F (L.map ν) := by + obtain ⟨_, φ, _, hAgree3⟩ := hNat + obtain ⟨t, hmono, hturn, hpoint⟩ := GM14.exists_angles_of_clockwise_triples hAgree3 hcw hlen + refine ⟨φ, t, hmono, ?_, ?_⟩ + · intro i hi + exact hturn i (by simpa using hi) + · intro i hi + have hi' : i < L.length := by simpa using hi + simpa using hpoint i hi' + +/-- Statement of Graph Minors XV, (7.9) (page 143): +"If $\mathscr{P}$ is a crosscap transaction of cardinality $\phi$ then (S2) is true." -/ +def GM15Theorem79Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ θ' π beta μ φ k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin k → Set S) + (S₀ : Set (Society α β)) (α₀_disc : Society α β → Set S) (α₀_pt : α → S) + (i : Fin k) + (D_i : Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i) + (P : Set (Graph α β)) (X : Set S), + 3 ≤ φ → φ ≤ θ - 4 * (3 * beta + 3) - 2 → + D_i.clearedSociety.IsTransaction P → + (∀ P₀ ∈ P, ∀ a b : α, + D_i.clearedSociety.IsOmegaPathWithEnds P₀ a b → + IsHPathWithEnds G D_i.clearedEmbedding.imageGraph P₀ a b) → + X ⊆ (clearedSubdrawing H D_i.Λ).V ∩ subBd D_i.Λ → + D_i.clearedSociety.transactionEnds P = D_i.clearedEmbedding.vMap '' X → + IsFreeSet (clearedSubdrawing H D_i.Λ).toHypergraph D_i.T₁ (θ - 4 * (3 * beta + 3) - 2) X → + P.ncard = φ → D_i.clearedSociety.IsCrosscapTransaction P → + Section7S2 S G θ_star T_star φ + +/-- Graph Minors XV, (7.9), page 143: use the established (3.3) in the transaction argument. -/ +theorem theorem_7_9_proof : GM15Theorem79Statement.{u, v, w} := by + intro S _ _ α β G H η θ_star θ θ' π beta μ φ k T_star T d r S₀ α₀_disc α₀_pt i D_i P X + hφ3 hφ_le hTransP hPathsP hX_sub hEndsP hFreeX hCardφ hCross + rcases hCross with ⟨A_f, B_f, _, p, _, P_idx, a_idx, b_idx, hP_inj, hP_range, hEnds_idx, hcw⟩ + have hp_eq : p = φ := by + rw [← hCardφ, ← hP_range, Set.ncard_range_of_injective hP_inj, Nat.card_fin] + subst p + let a' : Fin φ → α := a_idx ∘ Fin.rev + let b' : Fin φ → α := b_idx ∘ Fin.rev + let P' : Fin φ → Graph α β := P_idx ∘ Fin.rev + have hrev_ofFn : ∀ (f : Fin φ → α), (List.ofFn f).reverse = List.ofFn (f ∘ Fin.rev) := by + intro f + apply List.ext_getElem (by simp) + intro j hj1 hj2 + simp only [List.length_ofFn] at hj2 + simp only [List.getElem_reverse, List.length_ofFn, List.getElem_ofFn, Function.comp_apply] + congr 1 + ext + simp [Fin.rev] + omega + have hcw' : D_i.clearedSociety.Ω.IsClockwiseSeq (List.ofFn a' ++ List.ofFn b') := by + rwa [← hrev_ofFn a_idx, ← hrev_ofFn b_idx] + obtain ⟨inv_v, hinv_v, hNat⟩ := D_i.soc_Λ_natural + have hinv_mem_X : ∀ x ∈ D_i.clearedSociety.transactionEnds P, + inv_v x ∈ X ∧ D_i.clearedEmbedding.vMap (inv_v x) = x := by + intro x hx + have hx_img : x ∈ D_i.clearedEmbedding.vMap '' X := hEndsP ▸ hx + obtain ⟨y, hyX, hyx⟩ := hx_img + rcases hx with ⟨P₀, hP₀, z, hPath⟩ + obtain ⟨hinv_mem, hinv_eq⟩ := hinv_v x hPath.2.2.1 + have hy_eq : inv_v x = y := + D_i.clearedEmbedding.bijOn_v.injOn hinv_mem.1 (hX_sub hyX).1 (hinv_eq.trans hyx.symm) + exact ⟨hy_eq ▸ hyX, hinv_eq⟩ + let a_S : Fin φ → S := inv_v ∘ a' + let b_S : Fin φ → S := inv_v ∘ b' + have ha'_ends : ∀ j : Fin φ, a' j ∈ D_i.clearedSociety.transactionEnds P := by + intro j + exact ⟨P' j, hP_range ▸ mem_range_self (Fin.rev j), b' j, (hEnds_idx (Fin.rev j)).2.2⟩ + have hb'_ends : ∀ j : Fin φ, b' j ∈ D_i.clearedSociety.transactionEnds P := by + intro j + have hP_j := (hEnds_idx (Fin.rev j)).2.2 + exact ⟨P' j, hP_range ▸ mem_range_self (Fin.rev j), a' j, + ⟨hP_j.1.symm, hP_j.2.1.symm, hP_j.2.2.2, hP_j.2.2.1⟩⟩ + have hmap_eq : (List.ofFn a' ++ List.ofFn b').map inv_v = List.ofFn a_S ++ List.ofFn b_S := by + simp [List.map_ofFn, a_S, b_S, Function.comp_def] + have hNodup_S : (List.ofFn a_S ++ List.ofFn b_S).Nodup := by + rw [← hmap_eq] + refine hcw'.1.map_on ?_ + intro x hx y hy hxy + have hx_bar := hcw'.2.1 x hx + have hy_bar := hcw'.2.1 y hy + rw [← (hinv_v x hx_bar).2, ← (hinv_v y hy_bar).2, hxy] + have hOrder_S : GM12.IsListedInOrderOn (subBd D_i.Λ) (List.ofFn a_S ++ List.ofFn b_S) := by + rw [← hmap_eq] + exact isListedInOrderOn_of_isClockwiseSeq hNat hcw' (by simp; omega) + have h_ab_mem : ∀ j : Fin φ, + a_S j ∈ (clearedSubdrawing H D_i.Λ).V ∩ subBd D_i.Λ ∧ + b_S j ∈ (clearedSubdrawing H D_i.Λ).V ∩ subBd D_i.Λ := + fun j => ⟨hX_sub (hinv_mem_X (a' j) (ha'_ends j)).1, hX_sub (hinv_mem_X (b' j) (hb'_ends j)).1⟩ + have h_paths : ∀ j : Fin φ, + IsHPathWithEnds G D_i.clearedEmbedding.imageGraph (P' j) (D_i.clearedEmbedding.vMap (a_S j)) + (D_i.clearedEmbedding.vMap (b_S j)) + := by + intro j + dsimp only [a_S, b_S, Function.comp_apply] + rw [(hinv_mem_X (a' j) (ha'_ends j)).2, (hinv_mem_X (b' j) (hb'_ends j)).2] + exact hPathsP (P' j) (hP_range ▸ mem_range_self (Fin.rev j)) (a' j) (b' j) + (hEnds_idx (Fin.rev j)).2.2 + have h_disj : Pairwise (fun j₁ j₂ => Disjoint V(P' j₁) V(P' j₂)) := by + intro j₁ j₂ hj + rcases hTransP with ⟨_, _, ⟨_, hDisjP⟩, _, _⟩ + exact hDisjP (hP_range ▸ mem_range_self _) (hP_range ▸ mem_range_self _) + (fun hEq => hj (Fin.rev_injective (hP_inj hEq))) + have h_free : IsFreeSet (clearedSubdrawing H D_i.Λ).toHypergraph D_i.T₁ + (θ - 4 * (3 * beta + 3) - 2) (range a_S ∪ range b_S) := by + refine hFreeX.subset D_i.isCleared.hasMetric.1.2.1 ?_ + rintro _ (⟨j, rfl⟩ | ⟨j, rfl⟩) + · exact (hinv_mem_X (a' j) (ha'_ends j)).1 + · exact (hinv_mem_X (b' j) (hb'_ends j)).1 + have hSpan_Λ : IsSigmaSpan G (clearedSubdrawing H D_i.Λ) D_i.clearedEmbedding θ_star + (θ - 4 * (3 * beta + 3) - 2) T_star D_i.T₁ := by + have hEq : θ - 4 * (3 * beta + 3) - 2 = θ - (4 * (3 * beta + 3) + 2) := by omega + exact hEq ▸ D_i.isRearranged.isSpan' + exact GraphMinor.GM15.theorem_3_3_proof.{u, v, w} G (clearedSubdrawing H D_i.Λ) + D_i.clearedEmbedding θ_star + (θ - 4 * (3 * beta + 3) - 2) φ + T_star D_i.T₁ D_i.Λ P' a_S b_S hSpan_Λ D_i.mem_R_cleared D_i.isZone.isOArc_bd + D_i.isCircuit_bd hφ3 hφ_le hNodup_S hOrder_S h_ab_mem h_paths h_disj h_free + +/-- **Graph Minors XV, (7.9)** (page 143): +"If $\mathscr{P}$ is a crosscap transaction of cardinality $\phi$ then (S2) is true.* +*Proof.* This is immediate from (3.3)." -/ +theorem Section7.theorem_7_9_proof + : + GM15Theorem79Statement.{u, v, w} := by + have h33 : GM15Theorem33Statement.{u, v, w} := theorem_3_3_proof + intro S _ _ α β G H η θ_star θ θ' π beta μ φ k T_star T d r S₀ α₀_disc α₀_pt i D_i P X + exact _root_.GraphMinor.GM15.theorem_7_9_proof + G H η θ_star θ θ' π beta μ φ k T_star T d r S₀ α₀_disc α₀_pt i D_i P X + +/-- Extending `clearedSubdrawing H D_i.Λ` inside `D_i.Λ` as in `(3.4)` preserves the rearrangement +within `3 * beta + 3` of `r i` (`IsRearrangedWithin`). -/ +theorem isRearrangedWithin_of_cleared_extension + {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H H' : Drawing S} {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} + {θ_star θ θ' π beta μ k : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {r : Fin k → Set S} + {S₀ : Set (Society α β)} {α₀_disc : Society α β → Set S} {α₀_pt : α → S} + {i : Fin k} + (D_i : Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i) + (hSpan' : IsSigmaSpan G H' η' θ_star (θ - (4 * (3 * beta + 3) + 2)) T_star T') + (hM' : HasTangleMetric H' (θ - (4 * (3 * beta + 3) + 2)) T' d') + (hU_diff : H'.U \ D_i.Λ = (clearedSubdrawing H D_i.Λ).U) + (hSub : (clearedSubdrawing H D_i.Λ).IsSubdrawing H') + (hvMap : ∀ x ∈ (clearedSubdrawing H D_i.Λ).V, η'.vMap x = D_i.clearedEmbedding.vMap x) + (heMap : ∀ e ∈ (clearedSubdrawing H D_i.Λ).E, η'.eMap e = D_i.clearedEmbedding.eMap e) + (hInd : T' = GM10.inducedTangle H'.toHypergraph (clearedSubdrawing H D_i.Λ).toHypergraph + D_i.T₁ (θ - (4 * (3 * beta + 3) + 2))) + (hθ₁_ge : 2 ≤ θ - (4 * (3 * beta + 3) + 2)) : + IsRearrangedWithin G H H' η η' θ_star θ (3 * beta + 3) T_star T T' d d' (r i) := by + let H₁ := clearedSubdrawing H D_i.Λ + let lam₁ := 3 * beta + 3 + let θ₁ := θ - (4 * lam₁ + 2) + have hS : IsClosedSurface S := + ⟨D_i.isRearranged.isSpan.isSurface.1, D_i.isRearranged.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp D_i.isRearranged.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := D_i.isRearranged.isSpan.isConnected + have hM₁ : HasTangleMetric H₁ θ₁ D_i.T₁ D_i.d₁ := D_i.isRearranged.isCompression.hasMetric' + have hSubHyp : H₁.toHypergraph ≤ H'.toHypergraph := by + refine ⟨hSub.1, hSub.2, fun e he₁ => ?_⟩ + ext v + change (e ∈ H'.E ∧ v ∈ H'.V ∧ v ∈ closure e) ↔ (e ∈ H₁.E ∧ v ∈ H₁.V ∧ v ∈ closure e) + constructor + · rintro ⟨_, hv', hve⟩ + have hv_in : v ∈ closure e ∩ H'.V := ⟨hve, hv'⟩ + rw [← hSub.closure_inter_V he₁] at hv_in + exact ⟨he₁, hv_in.2, hve⟩ + · rintro ⟨_, hv₁, hve⟩ + exact ⟨hSub.2 he₁, hSub.1 hv₁, hve⟩ + have hIndBySub : T' = GM12.inducedBySubgraph H'.toHypergraph H₁.toHypergraph θ₁ D_i.T₁ := by + rw [hInd] + ext ⟨A, B⟩ + constructor + · rintro ⟨hsep, hord, ⟨C, D⟩, hCD, hCE⟩ + obtain ⟨hsep₁, hle₁⟩ := isSeparation_inter_subhypergraph hSubHyp hsep + exact ⟨hsep, hord, GM10.theorem_2_9_proof hM₁.1.2.1 hCD hsep₁ (lt_of_le_of_lt hle₁ hord) + (Or.inr (Or.inr ⟨hθ₁_ge, subset_of_eq hCE.symm⟩))⟩ + · rintro ⟨hsep, hord, hmem₁⟩ + exact ⟨hsep, hord, (A ∩ H₁.toHypergraph, B ∩ H₁.toHypergraph), hmem₁, rfl⟩ + have h77_ii := (GraphMinor.GM12.gm15_theorem_7_7.{w} H' H₁ θ₁ θ₁ T' D_i.T₁ d' D_i.d₁ hS hConn hM' + hSub hM₁.1.1 le_rfl hM₁).2 + rfl hIndBySub + refine ⟨D_i.isRearranged.z_mem, D_i.isRearranged.isSpan, hSpan', ?_, ?_, ?_, ?_⟩ + · intro a ha hlt + have ha₁ : a ∈ H₁.A := D_i.isRearranged.atom_mem a ha hlt + have ha_ne_Λ : a ≠ D_i.Λ := by + intro hEq + have hle := D_i.isZone.dist_le a ha (hEq ▸ subset_closure) + omega + rcases ha₁ with (⟨v, hv₁, rfl⟩ | he₁) | hr₁ + · exact Or.inl (Or.inl ⟨v, hSub.1 hv₁, rfl⟩) + · exact Or.inl (Or.inr (hSub.2 he₁)) + · refine Or.inr ?_ + obtain ⟨x, hx⟩ := (hM₁.1.1.2 a hr₁).isPathConnected.nonempty + have hx_not_Λ : x ∉ D_i.Λ := fun hxΛ => + ha_ne_Λ (region_eq_of_mem hr₁ D_i.mem_R_cleared hx hxΛ) + have hx_not_U₁ : x ∉ H₁.U := region_subset hr₁ hx + have hx_not_U' : x ∉ H'.U := fun hxU' => hx_not_U₁ (hU_diff ▸ ⟨hxU', hx_not_Λ⟩) + refine (mem_R_iff H').mpr ⟨x, hx_not_U', subset_antisymm ?_ ?_⟩ + · refine (region_isPreconnected hr₁).subset_connectedComponentIn hx ?_ + intro y hy + have hy_not_Λ : y ∉ D_i.Λ := fun hyΛ => + ha_ne_Λ (region_eq_of_mem hr₁ D_i.mem_R_cleared hy hyΛ) + have hy_not_U₁ : y ∉ H₁.U := region_subset hr₁ hy + exact ⟨mem_univ y, fun hyU' => hy_not_U₁ (hU_diff ▸ ⟨hyU', hy_not_Λ⟩)⟩ + · have hr_eq : connectedComponentIn (univ \ H₁.U) x = a := by + obtain ⟨z₀, _, hz₀_eq⟩ := (mem_R_iff H₁).mp hr₁ + have hx_z₀ : x ∈ connectedComponentIn (univ \ H₁.U) z₀ := hz₀_eq ▸ hx + exact (connectedComponentIn_eq hx_z₀).symm.trans hz₀_eq.symm + rw [← hr_eq] + refine isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn ⟨mem_univ x, hx_not_U'⟩) ?_ + exact (connectedComponentIn_subset _ _).trans fun y hy => + ⟨mem_univ y, fun hyU₁ => hy.2 (hSub.U_subset hyU₁)⟩ + · intro v hv hlt + obtain ⟨hv₁, hv_eq⟩ := D_i.isRearranged.vMap_eq v hv hlt + exact ⟨hSub.1 hv₁, (hvMap v hv₁).trans hv_eq⟩ + · intro e he hlt + obtain ⟨he₁, he_eq⟩ := D_i.isRearranged.eMap_eq e he hlt + exact ⟨hSub.2 he₁, (heMap e he₁).trans he_eq⟩ + · refine ⟨D_i.isRearranged.isCompression.lam_lt, D_i.isRearranged.isCompression.hasMetric, hM', + fun σ₁ σ₂ => ?_⟩ + obtain ⟨a₁', ha₁', hσ₁'⟩ := exists_atom_of_point H' σ₁ + obtain ⟨a₂', ha₂', hσ₂'⟩ := exists_atom_of_point H' σ₂ + obtain ⟨a₁₁, ha₁₁, hσ₁₁⟩ := exists_atom_of_point H₁ σ₁ + obtain ⟨a₂₁, ha₂₁, hσ₂₁⟩ := exists_atom_of_point H₁ σ₂ + have hsub₁ := atom_subset_of_isSubdrawing hSub ha₁' ha₁₁ hσ₁' hσ₁₁ + have hsub₂ := atom_subset_of_isSubdrawing hSub ha₂' ha₂₁ hσ₂' hσ₂₁ + have hle_1_prime := h77_ii a₁' ha₁' a₂' ha₂' a₁₁ ha₁₁ a₂₁ ha₂₁ hsub₁ hsub₂ + have hle_H_1 := D_i.isRearranged.isCompression.dist_le σ₁ σ₂ + rw [pointDist_eq_of_mem_atom (d := D_i.d₁) ha₁₁ ha₂₁ hσ₁₁ hσ₂₁] at hle_H_1 + rw [pointDist_eq_of_mem_atom (d := d') ha₁' ha₂' hσ₁' hσ₂'] + omega + +/-- Statement of Graph Minors XV, (7.10) (page 143): +"{P}$ is not a leap transaction of cardinality $\tau_1$." -/ +def GM15Theorem710Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ θ' lam π beta μ τ₁ k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin k → Set S) + (S₀ : Set (Society α β)) (α₀_disc : Society α β → Set S) (α₀_pt : α → S) + (i : Fin k) + (D_i : Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i) + (P : Set (Graph α β)) (X : Set S), + IsFlatSpan G H η θ_star θ lam μ T_star T → + 12 ≤ μ → Even μ → τ₁ = 4 + μ / 2 → 3 * beta + 3 ≤ lam → + 2 * τ₁ < θ - 4 * (3 * beta + 3) - 2 → + D_i.clearedSociety.IsTransaction P → + (∀ P₀ ∈ P, ∀ a b : α, + D_i.clearedSociety.IsOmegaPathWithEnds P₀ a b → + IsHPathWithEnds G D_i.clearedEmbedding.imageGraph P₀ a b) → + X ⊆ (clearedSubdrawing H D_i.Λ).V ∩ subBd D_i.Λ → + D_i.clearedSociety.transactionEnds P = D_i.clearedEmbedding.vMap '' X → + IsFreeSet (clearedSubdrawing H D_i.Λ).toHypergraph D_i.T₁ (θ - 4 * (3 * beta + 3) - 2) X → + P.ncard = τ₁ → ¬ D_i.clearedSociety.IsLeapTransaction P + +/-- Graph Minors XV, (7.10), page 143: use the established (3.4) in the transaction argument. -/ +theorem theorem_7_10_proof : GM15Theorem710Statement.{u, v, w} := by + intro S _ _ α β G H η θ_star θ θ' lam π beta μ τ₁ k T_star T d r + S₀ α₀_disc α₀_pt i D_i P X + hFlat hμ12 hμ_even hτ₁_eq hlam_ge h2τ₁_lt hTransP hPathsP hX_sub hEndsP hFreeX hCardτ₁ hLeap + rcases hLeap with ⟨A_f, B_f, _, p, hp3, P_idx, a_idx, b_idx, hP_inj, hP_range, hEnds_idx, hcw⟩ + have hp_eq : p = τ₁ := by + rw [← hCardτ₁, ← hP_range, Set.ncard_range_of_injective hP_inj, Nat.card_fin] + subst p + let v_α : Fin (2 * τ₁) → α := fun m => + if hm1 : m.1 < τ₁ then a_idx ⟨τ₁ - 1 - m.1, by omega⟩ + else if hm2 : m.1 < 2 * τ₁ - 1 then b_idx ⟨m.1 - τ₁ + 1, by omega⟩ + else b_idx ⟨0, by omega⟩ + have hofFn_v_α : List.ofFn v_α = + (List.ofFn a_idx).reverse ++ + List.ofFn (fun j : Fin (τ₁ - 1) => b_idx ⟨j.1 + 1, by omega⟩) ++ + [b_idx ⟨0, by omega⟩] := by + apply List.ext_getElem (by simp; omega) + intro m hm1 hm2 + simp only [List.length_ofFn] at hm1 + simp only [List.getElem_ofFn, v_α] + split_ifs with h1 h2 + · rw [List.getElem_append_left (by simp; omega), List.getElem_append_left (by simp; omega)] + simp only [List.getElem_reverse, List.length_ofFn, List.getElem_ofFn] + · rw [List.getElem_append_left (by simp; omega), List.getElem_append_right (by simp; omega)] + simp only [List.length_reverse, List.length_ofFn, List.getElem_ofFn] + · rw [List.getElem_append_right (by simp; omega)] + simp + have hcw' : D_i.clearedSociety.Ω.IsClockwiseSeq (List.ofFn v_α) := by rwa [hofFn_v_α] + obtain ⟨inv_v, hinv_v, hNat⟩ := D_i.soc_Λ_natural + have hinv_mem_X : ∀ x ∈ D_i.clearedSociety.transactionEnds P, + inv_v x ∈ X ∧ D_i.clearedEmbedding.vMap (inv_v x) = x := by + intro x hx + have hx_img : x ∈ D_i.clearedEmbedding.vMap '' X := hEndsP ▸ hx + obtain ⟨y, hyX, hyx⟩ := hx_img + rcases hx with ⟨P₀, hP₀, z, hPath⟩ + obtain ⟨hinv_mem, hinv_eq⟩ := hinv_v x hPath.2.2.1 + have hy_eq : inv_v x = y := + D_i.clearedEmbedding.bijOn_v.injOn hinv_mem.1 (hX_sub hyX).1 (hinv_eq.trans hyx.symm) + exact ⟨hy_eq ▸ hyX, hinv_eq⟩ + have hv_α_ends : ∀ m : Fin (2 * τ₁), v_α m ∈ D_i.clearedSociety.transactionEnds P := by + intro m + dsimp only [v_α] + split_ifs with h1 h2 + · let idx : Fin τ₁ := ⟨τ₁ - 1 - m.1, by omega⟩ + exact ⟨P_idx idx, hP_range ▸ mem_range_self idx, b_idx idx, (hEnds_idx idx).2.2⟩ + · let idx : Fin τ₁ := ⟨m.1 - τ₁ + 1, by omega⟩ + have hP_idx := (hEnds_idx idx).2.2 + exact ⟨P_idx idx, hP_range ▸ mem_range_self idx, a_idx idx, + ⟨hP_idx.1.symm, hP_idx.2.1.symm, hP_idx.2.2.2, hP_idx.2.2.1⟩⟩ + · let idx : Fin τ₁ := ⟨0, by omega⟩ + have hP_idx := (hEnds_idx idx).2.2 + exact ⟨P_idx idx, hP_range ▸ mem_range_self idx, a_idx idx, + ⟨hP_idx.1.symm, hP_idx.2.1.symm, hP_idx.2.2.2, hP_idx.2.2.1⟩⟩ + let v_S : Fin (2 * τ₁) → S := inv_v ∘ v_α + have hmap_eq : (List.ofFn v_α).map inv_v = List.ofFn v_S := by + simp [List.map_ofFn, v_S, Function.comp_def] + have hNodup_v : (List.ofFn v_S).Nodup := by + rw [← hmap_eq] + refine hcw'.1.map_on ?_ + intro x hx y hy hxy + rw [← (hinv_v x (hcw'.2.1 x hx)).2, ← (hinv_v y (hcw'.2.1 y hy)).2, hxy] + have hOrder_v : GM12.IsListedInOrderOn (subBd D_i.Λ) (List.ofFn v_S) := by + rw [← hmap_eq] + exact isListedInOrderOn_of_isClockwiseSeq hNat hcw' (by simp; omega) + have hv_mem : ∀ m : Fin (2 * τ₁), v_S m ∈ (clearedSubdrawing H D_i.Λ).V ∩ subBd D_i.Λ := + fun m => hX_sub (hinv_mem_X (v_α m) (hv_α_ends m)).1 + have hv_free : IsFreeSet (clearedSubdrawing H D_i.Λ).toHypergraph D_i.T₁ + (θ - 4 * (3 * beta + 3) - 2) (range v_S) := by + refine hFreeX.subset D_i.isCleared.hasMetric.1.2.1 ?_ + rintro _ ⟨m, rfl⟩ + exact (hinv_mem_X (v_α m) (hv_α_ends m)).1 + let P_sub : Fin (τ₁ - 1) → Graph α β := fun j => P_idx ⟨τ₁ - 1 - j.1, by omega⟩ + have hP_sub_paths : ∀ j : Fin (τ₁ - 1), ∃ i₁ i₂ : Fin (2 * τ₁), + i₁.1 = j.1 ∧ i₂.1 = 2 * τ₁ - 2 - j.1 ∧ + IsHPathWithEnds G D_i.clearedEmbedding.imageGraph (P_sub j) + (D_i.clearedEmbedding.vMap (v_S i₁)) (D_i.clearedEmbedding.vMap (v_S i₂)) := by + intro j + let i₁ : Fin (2 * τ₁) := ⟨j.1, by omega⟩ + let i₂ : Fin (2 * τ₁) := ⟨2 * τ₁ - 2 - j.1, by omega⟩ + refine ⟨i₁, i₂, rfl, rfl, ?_⟩ + rw [show D_i.clearedEmbedding.vMap (v_S i₁) = v_α i₁ from (hinv_mem_X (v_α i₁) + (hv_α_ends i₁)).2, + show D_i.clearedEmbedding.vMap (v_S i₂) = v_α i₂ from (hinv_mem_X (v_α i₂) (hv_α_ends i₂)).2] + have hi₁_eq : v_α i₁ = a_idx ⟨τ₁ - 1 - j.1, by omega⟩ := by + dsimp only [v_α, i₁] + split_ifs with h1 h2 <;> try omega + rfl + have hi₂_eq : v_α i₂ = b_idx ⟨τ₁ - 1 - j.1, by omega⟩ := by + dsimp only [v_α, i₂] + split_ifs with h1 h2 <;> try omega + congr 1; ext; dsimp; omega + rw [hi₁_eq, hi₂_eq] + exact hPathsP (P_sub j) (hP_range ▸ mem_range_self _) _ _ (hEnds_idx _).2.2 + have hP_sub_disj : Pairwise (fun j₁ j₂ => Disjoint V(P_sub j₁) V(P_sub j₂)) := by + intro j₁ j₂ hj + rcases hTransP with ⟨_, _, ⟨_, hDisjP⟩, _, _⟩ + refine hDisjP (hP_range ▸ mem_range_self _) (hP_range ▸ mem_range_self _) (fun hEq => hj ?_) + have hidx := congrArg Fin.val (hP_inj hEq) + dsimp only at hidx + ext + omega + let i_k : Fin (2 * τ₁) := ⟨τ₁ - 1, by omega⟩ + let i_last : Fin (2 * τ₁) := ⟨2 * τ₁ - 1, by omega⟩ + have hEq_θ₁ : θ - 4 * (3 * beta + 3) - 2 = θ - (4 * (3 * beta + 3) + 2) := by omega + have hSpan_Λ : IsSigmaSpan G (clearedSubdrawing H D_i.Λ) D_i.clearedEmbedding θ_star + (θ - 4 * (3 * beta + 3) - 2) T_star D_i.T₁ := hEq_θ₁ ▸ D_i.isRearranged.isSpan' + have hM_Λ : HasTangleMetric (clearedSubdrawing H D_i.Λ) + (θ - 4 * (3 * beta + 3) - 2) D_i.T₁ D_i.d₁ := + hEq_θ₁ ▸ D_i.isRearranged.isCompression.hasMetric' + obtain ⟨H', η', T', d', r₁, r₂, hSpan', hM', _, _, _, _, _, hU_diff, hSub, hvMap, heMap, + hImg, hInd, _, _, _, _, _, _, _, _, _, _, hdist_v⟩ := + GraphMinor.GM15.theorem_3_4_drawn.{u, v, w} G (clearedSubdrawing H D_i.Λ) D_i.clearedEmbedding + θ_star + (θ - 4 * (3 * beta + 3) - 2) τ₁ + T_star D_i.T₁ D_i.d₁ D_i.Λ v_S P_sub i_k i_last + hSpan_Λ hM_Λ D_i.mem_R_cleared D_i.isZone.isOArc_bd D_i.isCircuit_bd + hp3 hNodup_v hOrder_v hv_mem hv_free hP_sub_paths hP_sub_disj rfl rfl + rw [hEq_θ₁] at hSpan' hM' hInd + have hRearr' : IsRearrangedWithin G H H' η η' θ_star θ (3 * beta + 3) T_star T T' d d' (r i) := + isRearrangedWithin_of_cleared_extension D_i hSpan' hM' hU_diff hSub hvMap heMap hInd + (by omega) + -- `P_last = P_idx ⟨0, _⟩` is an `η'(H')`-path in `G` with ends `η'(v_S i_k)` and `η'(v_S + -- i_last)`. + let P_last := P_idx ⟨0, by omega⟩ + have hP_last_H₁ : IsHPathWithEnds G D_i.clearedEmbedding.imageGraph P_last + (D_i.clearedEmbedding.vMap (v_S i_k)) (D_i.clearedEmbedding.vMap (v_S i_last)) := by + rw [show D_i.clearedEmbedding.vMap (v_S i_k) = v_α i_k from (hinv_mem_X (v_α i_k) + (hv_α_ends i_k)).2, + show D_i.clearedEmbedding.vMap (v_S i_last) = v_α i_last from (hinv_mem_X (v_α i_last) + (hv_α_ends i_last)).2] + have hik_eq : v_α i_k = a_idx ⟨0, by omega⟩ := by + dsimp only [v_α, i_k] + split_ifs with h1 h2 <;> try omega + congr 1; ext; dsimp; omega + have hil_eq : v_α i_last = b_idx ⟨0, by omega⟩ := by + dsimp only [v_α, i_last] + split_ifs with h1 h2 <;> try omega + rfl + rw [hik_eq, hil_eq] + exact hPathsP P_last (hP_range ▸ mem_range_self _) _ _ (hEnds_idx ⟨0, by omega⟩).2.2 + have hDisj_last_sub : ∀ j : Fin (τ₁ - 1), Disjoint V(P_last) V(P_sub j) := by + intro j + rcases hTransP with ⟨_, _, ⟨_, hDisjP⟩, _, _⟩ + refine hDisjP (hP_range ▸ mem_range_self _) (hP_range ▸ mem_range_self _) (fun hEq => ?_) + have hidx := congrArg Fin.val (hP_inj hEq) + dsimp only at hidx + omega + have hv_k_eq : η'.vMap (v_S i_k) = D_i.clearedEmbedding.vMap (v_S i_k) := hvMap _ (hv_mem i_k).1 + have hv_last_eq : η'.vMap (v_S i_last) = D_i.clearedEmbedding.vMap (v_S i_last) := hvMap _ + (hv_mem i_last).1 + have hP_last_H' : IsHPathWithEnds G η'.imageGraph P_last + (η'.vMap (v_S i_k)) (η'.vMap (v_S i_last)) := by + rw [hv_k_eq, hv_last_eq] + refine ⟨η'.imageGraph_le, hP_last_H₁.2.1, hP_last_H₁.2.2.1, ?_, ?_, ?_, ?_⟩ + · rw [hImg, vertexSet_subgraphUnion] + exact Or.inl hP_last_H₁.2.2.2.1 + · rw [hImg, vertexSet_subgraphUnion] + exact Or.inl hP_last_H₁.2.2.2.2.1 + · rw [hImg, vertexSet_subgraphUnion, inter_union_distrib_left, hP_last_H₁.2.2.2.2.2.1] + have hEmp : V(P_last) ∩ V(subgraphSUnion G (range P_sub)) = ∅ := by + rw [vertexSet_subgraphSUnion] + ext x + simp only [mem_inter_iff, mem_iUnion, mem_empty_iff_false, iff_false, + not_and, not_exists] + rintro hx Q ⟨j, rfl⟩ hxj + exact Set.disjoint_left.mp (hDisj_last_sub j) hx hxj + rw [hEmp, union_empty] + · have hSub_le_mem : ∀ Q ∈ range P_sub, Q ≤ G := by + rintro _ ⟨j, rfl⟩ + exact (hP_sub_paths j).choose_spec.choose_spec.2.2.2.1.le + have hSub_le : subgraphSUnion G (range P_sub) ≤ G := subgraphSUnion_le hSub_le_mem + rw [hImg, edgeSet_subgraphUnion D_i.clearedEmbedding.imageGraph_le hSub_le, + disjoint_union_right] + refine ⟨hP_last_H₁.2.2.2.2.2.2, ?_⟩ + rw [edgeSet_subgraphSUnion hSub_le_mem] + refine Set.disjoint_left.mpr fun e heL heSub => ?_ + simp only [mem_iUnion] at heSub + obtain ⟨_, ⟨j, rfl⟩, hej⟩ := heSub + obtain ⟨u, w, hlinkL⟩ := exists_isLink_of_mem_edgeSet heL + obtain ⟨u', w', hlinkj⟩ := exists_isLink_of_mem_edgeSet hej + have hlinkG_L : G.IsLink e u w := hlinkL.mono hP_last_H₁.2.1.le + have hlinkG_j : G.IsLink e u' w' := + hlinkj.mono (hP_sub_paths j).choose_spec.choose_spec.2.2.2.1.le + have hu_eq : u = u' ∨ u = w' := G.eq_or_eq_of_isLink_of_isLink hlinkG_L hlinkG_j + rcases hu_eq with rfl | rfl + · exact Set.disjoint_left.mp (hDisj_last_sub j) hlinkL.left_mem hlinkj.left_mem + · exact Set.disjoint_left.mp (hDisj_last_sub j) hlinkL.left_mem hlinkj.right_mem + have hStep' : IsMuSteppedSpan G H' η' d' μ := by + have hμ_eq : 2 * τ₁ - 8 = μ := by + rcases hμ_even with ⟨m, rfl⟩ + omega + exact ⟨P_last, v_S i_k, v_S i_last, hSub.1 (hv_mem i_k).1, hSub.1 (hv_mem i_last).1, + hP_last_H', hμ_eq ▸ hdist_v⟩ + have hord := hFlat.order_ge + have hFlat_beta : IsFlatSpan G H η θ_star θ (3 * beta + 3) μ T_star (GM10.truncation T θ) := + theorem_5_1_proof G H η θ_star θ θ lam (3 * beta + 3) μ μ T_star T + hFlat hlam_ge le_rfl (by omega) le_rfl (by omega) (fun _ => by omega) (by omega) + have hTrunc_eq : GM10.truncation T θ = T := by + ext ⟨A, B⟩ + exact ⟨fun h => h.1, fun h => ⟨h, hFlat.isSpan.isControlling.isTangle_H.order_lt h⟩⟩ + rw [hTrunc_eq] at hFlat_beta + exact hFlat_beta.no_stepped_rearrangement hRearr' hStep' + +/-- **Graph Minors XV, (7.10)** (page 143): +"{P}$ is not a leap transaction of cardinality $\tau_1$." +Proved from `(3.4)` (`theorem_3_4_proof`) and `(5.1)` (`theorem_5_1_proof`). -/ +theorem Section7.theorem_7_10_proof + : + GM15Theorem710Statement.{u, v, w} := by + have h34 : GM15Theorem34Statement.{u, v, w} := theorem_3_4_proof + intro S _ _ α β G H η θ_star θ θ' lam π beta μ τ₁ k T_star T d r S₀ α₀_disc α₀_pt i D_i P X + exact _root_.GraphMinor.GM15.theorem_7_10_proof + G H η θ_star θ θ' lam π beta μ τ₁ k T_star T d r S₀ α₀_disc α₀_pt i D_i P X + +/-- Statement of Graph Minors XV, (7.11) (page 143): +"If $\mathscr{P}$ is a doublecross transaction of cardinality $\tau_2$ then (S1) holds." +(In Claim `(1)` on page 143, `(3.4)` is applied with `k - 1 = τ₂ - 4` paths, that is, `k = τ₂ - 3`, +which yields `d'(s₁, s₂) ≥ 2k - 6 = 2(τ₂ - 3) - 6 = 2τ₂ - 12` rather than `2τ₂ - 6`; accordingly we +take `τ₂ = 6 + θ' / 2` rather than `3 + θ' / 2`. See the correction to the proof of (7.11) in +`corrections/GM15.md`.) -/ +def GM15Theorem711Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ θ' lam lam' π beta μ τ₂ k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin k → Set S) + (S₀ : Set (Society α β)) (α₀_disc : Society α β → Set S) (α₀_pt : α → S) + (i : Fin k) + (D_i : Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i) + (P : Set (Graph α β)) (X : Set S), + IsFlatSpan G H η θ_star θ lam μ T_star T → + HasTangleMetric H θ T d → + 2 ≤ μ → 4 ≤ lam' → 4 * lam' + μ + 2 ≤ θ' → Even θ' → τ₂ = 6 + θ' / 2 → + 6 * (3 * beta + 3) + 5 * lam' + 3 * μ + 4 ≤ lam → + θ' + 13 * μ + 14 ≤ beta → + 100 * beta ≤ θ → + Injective r → + (∀ j : Fin k, IsDrawingEye G H η θ T (r j)) → + (∀ j₁ j₂ : Fin k, j₁ ≠ j₂ → d (r j₁) (r j₂) = θ) → + D_i.clearedSociety.IsTransaction P → + (∀ P₀ ∈ P, ∀ a b : α, + D_i.clearedSociety.IsOmegaPathWithEnds P₀ a b → + IsHPathWithEnds G D_i.clearedEmbedding.imageGraph P₀ a b) → + X ⊆ (clearedSubdrawing H D_i.Λ).V ∩ subBd D_i.Λ → + D_i.clearedSociety.transactionEnds P = D_i.clearedEmbedding.vMap '' X → + IsFreeSet (clearedSubdrawing H D_i.Λ).toHypergraph D_i.T₁ (θ - 4 * (3 * beta + 3) - 2) X → + P.ncard = τ₂ → D_i.clearedSociety.IsDoublecrossTransaction P → + Section7S1 S G θ_star T_star k μ lam' θ' + +/-- Any order-preserving sublist of a list in order on `F` is also in order on `F`. -/ +theorem isListedInOrderOn_of_strictMono + {S : Type w} [TopologicalSpace S] {F : Set S} {n m : ℕ} + {w : Fin n → S} {f : Fin m → Fin n} + (hm : 0 < m) (hf : StrictMono f) + (hOrder : GM12.IsListedInOrderOn F (List.ofFn w)) : + GM12.IsListedInOrderOn F (List.ofFn (w ∘ f)) := by + rcases hOrder with ⟨φ, t, ht_mono, ht_lt, ht_eq⟩ + have hpi : 0 < 2 * Real.pi := by positivity + let t' : ℕ → ℝ := fun i => + if hi : i < m then t (f ⟨i, hi⟩).1 else t 0 + 2 * Real.pi + i + have ht'0 : t' 0 = t (f ⟨0, hm⟩).1 := by dsimp only [t']; split_ifs; rfl + have ht0_le : t 0 ≤ t (f ⟨0, hm⟩).1 := ht_mono.monotone (Nat.zero_le _) + refine ⟨φ, t', ?_, ?_, ?_⟩ + · intro i j hij + by_cases hj : j < m + · have hi : i < m := hij.trans hj + have hi_eq : t' i = t (f ⟨i, hi⟩).1 := by dsimp only [t']; split_ifs; rfl + have hj_eq : t' j = t (f ⟨j, hj⟩).1 := by dsimp only [t']; split_ifs; rfl + rw [hi_eq, hj_eq] + exact ht_mono (hf hij) + · by_cases hi : i < m + · have hi_eq : t' i = t (f ⟨i, hi⟩).1 := by dsimp only [t']; split_ifs; rfl + have hj_eq : t' j = t 0 + 2 * Real.pi + j := by dsimp only [t']; split_ifs; rfl + have hlt := ht_lt (f ⟨i, hi⟩).1 (by simp) + have hj_nn : (0 : ℝ) ≤ j := Nat.cast_nonneg j + linarith + · have hi_eq : t' i = t 0 + 2 * Real.pi + i := by dsimp only [t']; split_ifs; rfl + have hj_eq : t' j = t 0 + 2 * Real.pi + j := by dsimp only [t']; split_ifs; rfl + have hij_cast : (i : ℝ) < (j : ℝ) := Nat.cast_lt.mpr hij + linarith + · intro i hi + rw [List.length_ofFn] at hi + have hi_eq : t' i = t (f ⟨i, hi⟩).1 := by dsimp only [t']; split_ifs; rfl + have hlt := ht_lt (f ⟨i, hi⟩).1 (by simp) + linarith + · intro i hi + have hi' : i < m := by simpa using hi + have hi_eq : t' i = t (f ⟨i, hi'⟩).1 := by dsimp only [t']; split_ifs; rfl + rw [hi_eq] + have h := ht_eq (f ⟨i, hi'⟩).1 (by simp) + simpa using h + +/-- Cyclic rotation of a list in order on `F` preserves `GM12.IsListedInOrderOn`. -/ +theorem isListedInOrderOn_rotate + {S : Type w} [TopologicalSpace S] {F : Set S} {L₁ L₂ : List S} + (h₁ : 0 < L₁.length) (h₂ : 0 < L₂.length) + (hOrder : GM12.IsListedInOrderOn F (L₁ ++ L₂)) : + GM12.IsListedInOrderOn F (L₂ ++ L₁) := by + rcases hOrder with ⟨φ, t, ht_mono, ht_lt, ht_eq⟩ + have hpi : 0 < 2 * Real.pi := by positivity + let t' : ℕ → ℝ := fun i => + if i < L₂.length then t (i + L₁.length) + else if i < L₂.length + L₁.length then t (i - L₂.length) + 2 * Real.pi + else t L₁.length + 2 * Real.pi + i + have ht'0 : t' 0 = t L₁.length := by + simp only [t', h₂, ↓reduceIte, Nat.zero_add] + have ht0_lt_n₁ : t 0 < t L₁.length := ht_mono h₁ + refine ⟨φ, t', ?_, ?_, ?_⟩ + · intro i j hij + by_cases hi1 : i < L₂.length + · by_cases hj1 : j < L₂.length + · simp only [t', hi1, hj1, ↓reduceIte] + exact ht_mono (by omega) + · by_cases hj2 : j < L₂.length + L₁.length + · simp only [t', hi1, hj1, hj2, ↓reduceIte] + have hlt := ht_lt (i + L₁.length) (by simp; omega) + have hle : t 0 ≤ t (j - L₂.length) := ht_mono.monotone (Nat.zero_le _) + linarith + · simp only [t', hi1, hj1, hj2, ↓reduceIte] + have hlt := ht_lt (i + L₁.length) (by simp; omega) + have hj_nn : (0 : ℝ) ≤ j := Nat.cast_nonneg j + linarith + · by_cases hi2 : i < L₂.length + L₁.length + · have hj1 : ¬ j < L₂.length := by omega + by_cases hj2 : j < L₂.length + L₁.length + · simp only [t', hi1, hi2, hj1, hj2, ↓reduceIte] + have hlt : t (i - L₂.length) < t (j - L₂.length) := ht_mono (by omega) + linarith + · simp only [t', hi1, hi2, hj1, hj2, ↓reduceIte] + have hlt : t (i - L₂.length) < t L₁.length := ht_mono (by omega) + have hj_nn : (0 : ℝ) ≤ j := Nat.cast_nonneg j + linarith + · have hj1 : ¬ j < L₂.length := by omega + have hj2 : ¬ j < L₂.length + L₁.length := by omega + simp only [t', hi1, hi2, hj1, hj2, ↓reduceIte] + have hij_cast : (i : ℝ) < (j : ℝ) := Nat.cast_lt.mpr hij + linarith + · intro i hi + rw [List.length_append] at hi + rw [ht'0] + by_cases hi1 : i < L₂.length + · simp only [t', hi1, ↓reduceIte] + have hlt := ht_lt (i + L₁.length) (by simp; omega) + linarith + · simp only [t', hi1, hi, ↓reduceIte] + have hlt : t (i - L₂.length) < t L₁.length := ht_mono (by omega) + linarith + · intro i hi + have hi_len : i < L₂.length + L₁.length := by simpa using hi + by_cases hi1 : i < L₂.length + · simp only [t', hi1, ↓reduceIte] + have h := ht_eq (i + L₁.length) (by simp; omega) + rw [List.getElem_append_right (by omega)] at h + rw [List.getElem_append_left hi1] + simpa using h + · simp only [t', hi1, hi_len, ↓reduceIte] + have h := ht_eq (i - L₂.length) (by simp; omega) + rw [List.getElem_append_left (by omega)] at h + rw [List.getElem_append_right (by omega)] + have hexp : Circle.exp (t (i - L₂.length) + 2 * Real.pi) = Circle.exp (t (i - L₂.length)) + := by + rw [Circle.exp_add, Circle.exp_two_pi, mul_one] + simpa [hexp] using h + +/-- If `H₁ ≤ H'` and `T'` is the tangle in `H'` induced by a tangle `T₁` of order `θ₁ ≥ 2` in `H₁`, +then any `T₁`-free subset `Y ⊆ V(H₁)` is also `T'`-free in `H'`. -/ +theorem isFreeSet_inducedTangle_of_isFreeSet + {S : Type w} [TopologicalSpace S] + {H₁ H' : Drawing S} {θ₁ : ℕ} + {T₁ T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {Y : Set S} + (hSub : H₁.IsSubdrawing H') + (hT₁ : IsTangle H₁.toHypergraph θ₁ T₁) + (hInd : T' = GM10.inducedTangle H'.toHypergraph H₁.toHypergraph T₁ θ₁) + (hθ₁ : 2 ≤ θ₁) + (hFree : IsFreeSet H₁.toHypergraph T₁ θ₁ Y) : + IsFreeSet H'.toHypergraph T' θ₁ Y := by + have hSubHyp : H₁.toHypergraph ≤ H'.toHypergraph := by + refine ⟨hSub.1, hSub.2, fun e he₁ => ?_⟩ + ext v + change (e ∈ H'.E ∧ v ∈ H'.V ∧ v ∈ closure e) ↔ (e ∈ H₁.E ∧ v ∈ H₁.V ∧ v ∈ closure e) + constructor + · rintro ⟨_, hv', hve⟩ + have hv_in : v ∈ closure e ∩ H'.V := ⟨hve, hv'⟩ + rw [← hSub.closure_inter_V he₁] at hv_in + exact ⟨he₁, hv_in.2, hve⟩ + · rintro ⟨_, hv₁, hve⟩ + exact ⟨hSub.2 he₁, hSub.1 hv₁, hve⟩ + refine ⟨hFree.1.trans hSub.1, hFree.2.1, fun A B hAB hY_sub => ?_⟩ + rw [hInd] at hAB + rcases hAB with ⟨hsep, hord, ⟨C, D⟩, hCD, hCE⟩ + obtain ⟨hsep₁, hle₁⟩ := isSeparation_inter_subhypergraph hSubHyp hsep + have hmem₁ : (A ∩ H₁.toHypergraph, B ∩ H₁.toHypergraph) ∈ T₁ := + GM10.theorem_2_9_proof hT₁ hCD hsep₁ (lt_of_le_of_lt hle₁ hord) + (Or.inr (Or.inr ⟨hθ₁, subset_of_eq hCE.symm⟩)) + have hY_sub₁ : Y ⊆ (A ∩ H₁.toHypergraph).vertexSet := fun y hy => ⟨hY_sub hy, hFree.1 hy⟩ + exact (hFree.2.2 hmem₁ hY_sub₁).trans hle₁ + +/-- An `H₁_G`-path `P₀` in `G` that is vertex-disjoint from each `P_sub j` is also a path with the +same ends over `H₁_G ∪ ⋃ j, P_sub j`. -/ +theorem isHPathWithEnds_subgraphUnion_of_disjoint + {G H₁_G P₀ : Graph α β} {u v : α} {ι : Type*} {P_sub : ι → Graph α β} + (hH₁_le : H₁_G ≤ G) + (hSub_le_mem : ∀ Q ∈ range P_sub, Q ≤ G) + (hP₀ : IsHPathWithEnds G H₁_G P₀ u v) + (hDisj : ∀ j : ι, Disjoint V(P₀) V(P_sub j)) : + IsHPathWithEnds G (subgraphUnion G H₁_G (subgraphSUnion G (range P_sub))) P₀ u v := by + have hSub_le : subgraphSUnion G (range P_sub) ≤ G := subgraphSUnion_le hSub_le_mem + refine ⟨subgraphUnion_le hH₁_le hSub_le, hP₀.2.1, hP₀.2.2.1, ?_, ?_, ?_, ?_⟩ + · rw [vertexSet_subgraphUnion] + exact Or.inl hP₀.2.2.2.1 + · rw [vertexSet_subgraphUnion] + exact Or.inl hP₀.2.2.2.2.1 + · rw [vertexSet_subgraphUnion, inter_union_distrib_left, hP₀.2.2.2.2.2.1] + have hEmp : V(P₀) ∩ V(subgraphSUnion G (range P_sub)) = ∅ := by + rw [vertexSet_subgraphSUnion] + ext x + simp only [mem_inter_iff, mem_iUnion, mem_empty_iff_false, iff_false, not_and, not_exists] + rintro hx _ ⟨j, rfl⟩ hxj + exact Set.disjoint_left.mp (hDisj j) hx hxj + rw [hEmp, union_empty] + · rw [edgeSet_subgraphUnion hH₁_le hSub_le, disjoint_union_right] + refine ⟨hP₀.2.2.2.2.2.2, ?_⟩ + rw [edgeSet_subgraphSUnion hSub_le_mem] + refine Set.disjoint_left.mpr fun e he₀ heSub => ?_ + simp only [mem_iUnion] at heSub + obtain ⟨_, ⟨j, rfl⟩, hej⟩ := heSub + obtain ⟨u₁, w₁, hlink₀⟩ := exists_isLink_of_mem_edgeSet he₀ + obtain ⟨u₂, w₂, hlinkj⟩ := exists_isLink_of_mem_edgeSet hej + have hlinkG₀ : G.IsLink e u₁ w₁ := hlink₀.mono hP₀.2.1.le + have hlinkGj : G.IsLink e u₂ w₂ := hlinkj.mono (hSub_le_mem _ (mem_range_self j)) + rcases G.eq_or_eq_of_isLink_of_isLink hlinkG₀ hlinkGj with rfl | rfl + · exact Set.disjoint_left.mp (hDisj j) hlink₀.left_mem hlinkj.left_mem + · exact Set.disjoint_left.mp (hDisj j) hlink₀.left_mem hlinkj.right_mem + +/-- Rotate the clockwise sequence of a doublecross transaction of cardinality `τ₂ ≥ 12` by 2 so +that the vertices `w_α : Fin (2 * τ₂) → α` start at `a_{τ₂ - 3}` as in the proof of `(7.11)`. -/ +theorem exists_doublecross_rotated_seq + {S : Type w} [TopologicalSpace S] {V₀ : Set S} {vMap : S → α} {Λ : Set S} + {Ω : CyclicPerm α} {inv_v : α → S} {τ₂ : ℕ} (hτ₂ : 12 ≤ τ₂) + (a_idx b_idx : Fin τ₂ → α) + (hinv_v : ∀ x ∈ Ω.bar, inv_v x ∈ V₀ ∧ vMap (inv_v x) = x) + (hNat : IsNaturalOrderFrom inv_v Ω (subBd Λ)) + (hcw : Ω.IsClockwiseSeq + ((List.ofFn a_idx).reverse ++ + [b_idx ⟨1, by omega⟩, b_idx ⟨0, by omega⟩] ++ + List.ofFn (fun j : Fin (τ₂ - 4) => b_idx ⟨j.1 + 2, by omega⟩) ++ + [b_idx ⟨τ₂ - 1, by omega⟩, b_idx ⟨τ₂ - 2, by omega⟩])) : + ∃ w_α : Fin (2 * τ₂) → α, + (List.ofFn (inv_v ∘ w_α)).Nodup ∧ + GM12.IsListedInOrderOn (subBd Λ) (List.ofFn (inv_v ∘ w_α)) ∧ + (∀ m : Fin (2 * τ₂), (∃ idx, w_α m = a_idx idx) ∨ (∃ idx, w_α m = b_idx idx)) ∧ + (∀ (m : Fin (2 * τ₂)) (_ : m.1 < τ₂ - 2), w_α m = a_idx ⟨τ₂ - 3 - m.1, by omega⟩) ∧ + w_α ⟨τ₂ - 2, by omega⟩ = b_idx ⟨1, by omega⟩ ∧ + w_α ⟨τ₂ - 1, by omega⟩ = b_idx ⟨0, by omega⟩ ∧ + (∀ (m : Fin (2 * τ₂)) (_ : τ₂ ≤ m.1) (_ : m.1 < 2 * τ₂ - 4), + w_α m = b_idx ⟨m.1 - τ₂ + 2, by omega⟩) ∧ + w_α ⟨2 * τ₂ - 4, by omega⟩ = b_idx ⟨τ₂ - 1, by omega⟩ ∧ + w_α ⟨2 * τ₂ - 3, by omega⟩ = b_idx ⟨τ₂ - 2, by omega⟩ ∧ + w_α ⟨2 * τ₂ - 2, by omega⟩ = a_idx ⟨τ₂ - 1, by omega⟩ ∧ + w_α ⟨2 * τ₂ - 1, by omega⟩ = a_idx ⟨τ₂ - 2, by omega⟩ := by + let w_α : Fin (2 * τ₂) → α := fun m => + if hm1 : m.1 < τ₂ - 2 then a_idx ⟨τ₂ - 3 - m.1, by omega⟩ + else if hm2 : m.1 = τ₂ - 2 then b_idx ⟨1, by omega⟩ + else if hm3 : m.1 = τ₂ - 1 then b_idx ⟨0, by omega⟩ + else if hm4 : m.1 < 2 * τ₂ - 4 then b_idx ⟨m.1 - τ₂ + 2, by omega⟩ + else if hm5 : m.1 = 2 * τ₂ - 4 then b_idx ⟨τ₂ - 1, by omega⟩ + else if hm6 : m.1 = 2 * τ₂ - 3 then b_idx ⟨τ₂ - 2, by omega⟩ + else if hm7 : m.1 = 2 * τ₂ - 2 then a_idx ⟨τ₂ - 1, by omega⟩ + else a_idx ⟨τ₂ - 2, by omega⟩ + let L₁ : List α := [a_idx ⟨τ₂ - 1, by omega⟩, a_idx ⟨τ₂ - 2, by omega⟩] + let L₂ : List α := + List.ofFn (fun j : Fin (τ₂ - 2) => a_idx ⟨τ₂ - 3 - j.1, by omega⟩) ++ + [b_idx ⟨1, by omega⟩, b_idx ⟨0, by omega⟩] ++ + List.ofFn (fun j : Fin (τ₂ - 4) => b_idx ⟨j.1 + 2, by omega⟩) ++ + [b_idx ⟨τ₂ - 1, by omega⟩, b_idx ⟨τ₂ - 2, by omega⟩] + have hrev_split : (List.ofFn a_idx).reverse = + L₁ ++ List.ofFn (fun j : Fin (τ₂ - 2) => a_idx ⟨τ₂ - 3 - j.1, by omega⟩) := by + apply List.ext_getElem (by simp [L₁]; omega) + intro m hm1 hm2 + simp only [List.length_reverse, List.length_ofFn] at hm1 + simp only [List.getElem_reverse, List.length_ofFn, List.getElem_ofFn] + by_cases hm : m < 2 + · rw [List.getElem_append_left (by simp [L₁]; omega)] + rcases (by omega : m = 0 ∨ m = 1) with rfl | rfl + · simp [L₁] + · simp only [L₁, List.getElem_cons_succ, List.getElem_cons_zero] + exact congrArg a_idx (Fin.ext (by dsimp; omega)) + · rw [List.getElem_append_right (by simp [L₁]; omega)] + simp only [L₁, List.length_cons, List.length_nil, List.getElem_ofFn] + exact congrArg a_idx (Fin.ext (by dsimp; omega)) + have hcw_L₁₂ : Ω.IsClockwiseSeq (L₁ ++ L₂) := by + have hEq : (List.ofFn a_idx).reverse ++ + [b_idx ⟨1, by omega⟩, b_idx ⟨0, by omega⟩] ++ + List.ofFn (fun j : Fin (τ₂ - 4) => b_idx ⟨j.1 + 2, by omega⟩) ++ + [b_idx ⟨τ₂ - 1, by omega⟩, b_idx ⟨τ₂ - 2, by omega⟩] = L₁ ++ L₂ := by + rw [hrev_split] + simp only [L₂, List.append_assoc] + rwa [← hEq] + have hofFn_w_α : List.ofFn w_α = L₂ ++ L₁ := by + apply List.ext_getElem (by simp [L₁, L₂]; omega) + intro m hm1 hm2 + simp only [List.length_ofFn] at hm1 + simp only [List.getElem_ofFn, w_α] + split_ifs with h1 h2 h3 h4 h5 h6 h7 + · rw [List.getElem_append_left (by simp [L₂]; omega)] + simp only [L₂] + rw [List.getElem_append_left (by simp; omega), List.getElem_append_left (by simp; omega), + List.getElem_append_left (by simp; omega)] + simp only [List.getElem_ofFn] + · subst h2 + rw [List.getElem_append_left (by simp [L₂])] + simp only [L₂] + rw [List.getElem_append_left (by simp), List.getElem_append_left (by simp), + List.getElem_append_right (by simp)] + simp only [List.length_ofFn, Nat.sub_self, List.getElem_cons_zero] + · subst h3 + rw [List.getElem_append_left (by simp [L₂]; omega)] + simp only [L₂] + rw [List.getElem_append_left (by simp; omega), List.getElem_append_left (by simp; omega), + List.getElem_append_right (by simp; omega)] + simp only [List.length_ofFn] + have h_idx : τ₂ - 1 - (τ₂ - 2) = 1 := by omega + simp [h_idx] + · rw [List.getElem_append_left (by simp [L₂]; omega)] + simp only [L₂] + rw [List.getElem_append_left (by simp; omega), List.getElem_append_right (by simp; omega)] + simp only [List.length_append, List.length_ofFn, List.length_cons, List.length_nil, + List.getElem_ofFn] + congr 1; ext; dsimp; omega + · subst h5 + rw [List.getElem_append_left (by simp [L₂]; omega)] + simp only [L₂] + rw [List.getElem_append_right (by simp; omega)] + simp only [List.length_append, List.length_ofFn, List.length_cons, List.length_nil] + have h_idx : 2 * τ₂ - 4 - (τ₂ - 2 + (1 + 1) + (τ₂ - 4)) = 0 := by omega + simp [h_idx] + · subst h6 + rw [List.getElem_append_left (by simp [L₂]; omega)] + simp only [L₂] + rw [List.getElem_append_right (by simp; omega)] + simp only [List.length_append, List.length_ofFn, List.length_cons, List.length_nil] + have h_idx : 2 * τ₂ - 3 - (τ₂ - 2 + (1 + 1) + (τ₂ - 4)) = 1 := by omega + simp [h_idx] + · subst h7 + rw [List.getElem_append_right (by simp [L₂]; omega)] + simp only [L₁, L₂, List.length_append, List.length_ofFn, List.length_cons, List.length_nil] + have h_idx : 2 * τ₂ - 2 - (τ₂ - 2 + (1 + 1) + (τ₂ - 4) + (1 + 1)) = 0 := by omega + simp [h_idx] + · have hm_eq : m = 2 * τ₂ - 1 := by omega + subst hm_eq + rw [List.getElem_append_right (by simp [L₂]; omega)] + simp only [L₁, L₂, List.length_append, List.length_ofFn, List.length_cons, List.length_nil] + have h_idx : 2 * τ₂ - 1 - (τ₂ - 2 + (1 + 1) + (τ₂ - 4) + (1 + 1)) = 1 := by omega + simp [h_idx] + have hmap_w : List.ofFn (inv_v ∘ w_α) = (L₂ ++ L₁).map inv_v := by + rw [← List.map_ofFn, hofFn_w_α] + have hNodup_L₁₂ : ((L₁ ++ L₂).map inv_v).Nodup := by + refine hcw_L₁₂.1.map_on ?_ + intro x hx y hy hxy + rw [← (hinv_v x (hcw_L₁₂.2.1 x hx)).2, ← (hinv_v y (hcw_L₁₂.2.1 y hy)).2, hxy] + have hOrder_L₁₂ : GM12.IsListedInOrderOn (subBd Λ) ((L₁ ++ L₂).map inv_v) := + isListedInOrderOn_of_isClockwiseSeq hNat hcw_L₁₂ (by simp [L₁, L₂]; omega) + refine ⟨w_α, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [hmap_w, List.map_append] + rw [List.map_append] at hNodup_L₁₂ + exact hNodup_L₁₂.perm List.perm_append_comm + · rw [hmap_w, List.map_append] + rw [List.map_append] at hOrder_L₁₂ + exact isListedInOrderOn_rotate (by simp [L₁]) (by simp [L₂]) hOrder_L₁₂ + · intro m + dsimp only [w_α] + by_cases h1 : m.1 < τ₂ - 2 + · rw [dite_eq_left h1]; exact Or.inl ⟨_, rfl⟩ + · rw [dite_eq_right h1] + by_cases h2 : m.1 = τ₂ - 2 + · rw [dite_eq_left h2]; exact Or.inr ⟨_, rfl⟩ + · rw [dite_eq_right h2] + by_cases h3 : m.1 = τ₂ - 1 + · rw [dite_eq_left h3]; exact Or.inr ⟨_, rfl⟩ + · rw [dite_eq_right h3] + by_cases h4 : m.1 < 2 * τ₂ - 4 + · rw [dite_eq_left h4]; exact Or.inr ⟨_, rfl⟩ + · rw [dite_eq_right h4] + by_cases h5 : m.1 = 2 * τ₂ - 4 + · rw [dite_eq_left h5]; exact Or.inr ⟨_, rfl⟩ + · rw [dite_eq_right h5] + by_cases h6 : m.1 = 2 * τ₂ - 3 + · rw [dite_eq_left h6]; exact Or.inr ⟨_, rfl⟩ + · rw [dite_eq_right h6] + by_cases h7 : m.1 = 2 * τ₂ - 2 + · rw [dite_eq_left h7]; exact Or.inl ⟨_, rfl⟩ + · rw [dite_eq_right h7]; exact Or.inl ⟨_, rfl⟩ + · intro m hm + dsimp only [w_α] + rw [dite_eq_left hm] + · dsimp only [w_α] + rw [dite_eq_right (by omega), dite_eq_left rfl] + · dsimp only [w_α] + rw [dite_eq_right (by omega), dite_eq_right (by omega), dite_eq_left rfl] + · intro m hm_ge hm_lt + dsimp only [w_α] + rw [dite_eq_right (by omega), dite_eq_right (by omega), dite_eq_right (by omega), + dite_eq_left hm_lt] + · dsimp only [w_α] + rw [dite_eq_right (by omega), dite_eq_right (by omega), dite_eq_right (by omega), + dite_eq_right (by omega), dite_eq_left rfl] + · dsimp only [w_α] + rw [dite_eq_right (by omega), dite_eq_right (by omega), dite_eq_right (by omega), + dite_eq_right (by omega), dite_eq_right (by omega), dite_eq_left rfl] + · dsimp only [w_α] + rw [dite_eq_right (by omega), dite_eq_right (by omega), dite_eq_right (by omega), + dite_eq_right (by omega), dite_eq_right (by omega), dite_eq_right (by omega), + dite_eq_left rfl] + · dsimp only [w_α] + rw [dite_eq_right (by omega), dite_eq_right (by omega), dite_eq_right (by omega), + dite_eq_right (by omega), dite_eq_right (by omega), dite_eq_right (by omega), + dite_eq_right (by omega)] + +private theorem interSet_U_subset_of_isClosed {S : Type w} [TopologicalSpace S] [T1Space S] + (H : Drawing S) {F : Set S} (hcl : IsClosed F) : + (H.interSet F).U ⊆ F := by + change (H.interSet F).V ∪ _ ⊆ F + rw [interSet_V_of_isClosed H hcl] + refine union_subset inter_subset_right ?_ + exact iUnion₂_subset fun e he => hcl.closure_subset_iff.mpr he.1.2 + +private def doublecross_boundary_index (τ : ℕ) (hτ : 12 ≤ τ) + (j : Fin (2 * (τ - 3))) : Fin (2 * τ) := + if hj₁ : j.1 < τ - 3 then ⟨j.1, by omega⟩ + else if hj₂ : j.1 < 2 * (τ - 3) - 1 then ⟨j.1 + 3, by omega⟩ + else ⟨2 * τ - 4, by omega⟩ + +private def doublecross_middle_paths {α : Type u} {β : Type v} {τ : ℕ} + (P : Fin τ → Graph α β) (hτ : 12 ≤ τ) (j : Fin (τ - 3 - 1)) : Graph α β := + P ⟨τ - 3 - j.1, by omega⟩ + +private def initial_split_vertices {S : Type w} {k : ℕ} (v : Fin (2 * k) → S) : List S := + List.ofFn (fun j : Fin (k - 1) => v ⟨j.1, by omega⟩) + +private def final_split_vertices {S : Type w} {k : ℕ} (v : Fin (2 * k) → S) : List S := + List.ofFn (fun j : Fin k => v ⟨k + j.1, by omega⟩) + +private def split_vertices_without_last {S : Type w} {k : ℕ} + (v : Fin (2 * k) → S) : List S := + List.ofFn (fun j : Fin (2 * k - 1) => v ⟨j.1, by omega⟩) + +private abbrev SplitRegionOrder {S : Type w} [TopologicalSpace S] [T2Space S] + (H H' : Drawing S) + (Λ r : Set S) (order : S → S → S → S → List S) : Prop := + ∀ a b c d : S, + a ∈ H.V ∩ subBd Λ → b ∈ H.V ∩ subBd Λ → + c ∈ H.V ∩ subBd Λ → d ∈ H.V ∩ subBd Λ → + (order a b c d).Nodup → GM12.IsListedInOrderOn (subBd Λ) (order a b c d) → + a ∈ (H'.interSet (subBd r)).V ∧ b ∈ (H'.interSet (subBd r)).V ∧ + c ∈ (H'.interSet (subBd r)).V ∧ d ∈ (H'.interSet (subBd r)).V ∧ + OccurInCircuitOrder (H'.interSet (subBd r)) a b c d + +/-- Distinct indices of an enumerated transaction give disjoint paths. -/ +private theorem transaction_paths_disjoint {α : Type u} {β : Type v} {society : Society α β} + {P : Set (Graph α β)} {τ : ℕ} {paths : Fin τ → Graph α β} + (hTrans : society.IsTransaction P) (hRange : range paths = P) (hInj : Injective paths) + {i j : Fin τ} (hne : i ≠ j) : Disjoint V(paths i) V(paths j) := by + rcases hTrans with ⟨_, _, ⟨_, hDisj⟩, _, _⟩ + exact hDisj (hRange ▸ mem_range_self _) (hRange ▸ mem_range_self _) (fun he => hne (hInj he)) + +/-- A selected end path remains an outside path after adding the middle paths to the base. -/ +private theorem isHPathWithEnds_of_outside_middle {α : Type u} {β : Type v} + {G H : Graph α β} (hH : H ≤ G) {society : Society α β} + {P : Set (Graph α β)} {τ : ℕ} {paths : Fin τ → Graph α β} + (hTrans : society.IsTransaction P) (hRange : range paths = P) (hInj : Injective paths) + (hτ : 12 ≤ τ) (hSub : ∀ Q ∈ range (doublecross_middle_paths paths hτ), Q ≤ G) + {index : Fin τ} (hout : index.1 < 2 ∨ τ - 2 ≤ index.1) {a b : α} + (hPath : IsHPathWithEnds G H (paths index) a b) : + IsHPathWithEnds G (subgraphUnion G H (subgraphSUnion G + (range (doublecross_middle_paths paths hτ)))) (paths index) a b := by + refine isHPathWithEnds_subgraphUnion_of_disjoint hH hSub hPath fun j => ?_ + unfold doublecross_middle_paths + apply transaction_paths_disjoint hTrans hRange hInj + intro he + have hval := congrArg Fin.val he + dsimp only at hval + omega + +private theorem first_split_region_is_eye + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (θ_star : ℕ) + (θ : ℕ) + (θ' : ℕ) + (π : ℕ) + (beta : ℕ) + (μ : ℕ) + (τ₂ : ℕ) + (k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (r : Fin k → Set S) + (S₀ : Set (Society α β)) + (α₀_disc : Society α β → Set S) + (α₀_pt : α → S) + (i : Fin k) + (D_i : Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i) + (P : Set (Graph α β)) + (X : Set S) + (hτ₂_eq : τ₂ = 6 + θ' / 2) + (hTransP : D_i.clearedSociety.IsTransaction P) + (hPathsP : ∀ P₀ ∈ P, ∀ (a b : α), D_i.clearedSociety.IsOmegaPathWithEnds P₀ a b + → IsHPathWithEnds G + D_i.clearedEmbedding.imageGraph P₀ a b) + (hCardτ₂ : P.ncard = τ₂) + (A_f : Set α) + (B_f : Set α) + (P_idx : Fin τ₂ → Graph α β) + (a_idx : Fin τ₂ → α) + (b_idx : Fin τ₂ → α) + (hP_inj : Injective P_idx) + (hP_range : range P_idx = P) + (hEnds_idx : ∀ (i_1 : Fin τ₂), a_idx i_1 ∈ A_f ∧ b_idx i_1 ∈ B_f ∧ + D_i.clearedSociety.IsOmegaPathWithEnds (P_idx i_1) (a_idx i_1) (b_idx i_1)) + (hτ₂_ge12 : 12 ≤ τ₂) + (inv_v : α → S) + (hinv_mem_X : ∀ x ∈ D_i.clearedSociety.transactionEnds P, inv_v x ∈ X + ∧ D_i.clearedEmbedding.vMap (inv_v x) = x) + (w_α : Fin (2 * τ₂) → α) + (hNodup_w : (List.ofFn (inv_v ∘ w_α)).Nodup) + (hOrder_w : GM12.IsListedInOrderOn (subBd D_i.Λ) (List.ofFn (inv_v ∘ w_α))) + (hw_α_lt : ∀ (m : Fin (2 * τ₂)) (_ : m.1 < τ₂ - 2), + w_α m = a_idx ⟨τ₂ - 3 - m.1, by omega⟩) + (hw_α_m2 : w_α ⟨τ₂ - 2, by omega⟩ = b_idx ⟨1, by omega⟩) + (hw_α_m1 : w_α ⟨τ₂ - 1, by omega⟩ = b_idx ⟨0, by omega⟩) : + let w : Fin (2 * τ₂) → S := inv_v ∘ w_α + ∀ (hw_α_ends : ∀ (m : Fin (2 * τ₂)), w_α m ∈ D_i.clearedSociety.transactionEnds P), + ∀ (hw_mem : ∀ (m : Fin (2 * τ₂)), w m ∈ (clearedSubdrawing H D_i.Λ).V ∩ subBd D_i.Λ), + ∀ (hw_vMap : ∀ (m : Fin (2 * τ₂)), D_i.clearedEmbedding.vMap (w m) = w_α m), + let k_34 : ℕ := τ₂ - 3 + ∀ (hk_34_ge : 3 ≤ k_34), + let f_34 := doublecross_boundary_index τ₂ hτ₂_ge12 + let v_34 : Fin (2 * k_34) → S := w ∘ f_34 + let P_sub := doublecross_middle_paths P_idx hτ₂_ge12 + ∀ (H' : Drawing S), + ∀ (η' : SpanEmbedding H' G), + ∀ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))), + ∀ (d' : Set S → Set S → ℕ), + ∀ (r₁ : Set S), + ∀ (hM' : HasTangleMetric H' (θ - (4 * (3 * beta + 3) + 2)) T' d'), + ∀ (hr₁_R : r₁ ∈ H'.R), + ∀ (hvMap : ∀ x ∈ (clearedSubdrawing H D_i.Λ).V, η'.vMap x = D_i.clearedEmbedding.vMap x), + ∀ (hImg : η'.imageGraph = subgraphUnion G D_i.clearedEmbedding.imageGraph (subgraphSUnion G + (range + P_sub))), + ∀ (hOArc_r₁ : IsOArc (subBd r₁)), + ∀ (hCirc_r₁ : (H'.interSet (subBd r₁)).IsCircuit), + SplitRegionOrder (clearedSubdrawing H D_i.Λ) H' D_i.Λ r₁ + (fun a b c d => initial_split_vertices v_34 ++ [a, b, c, d] ++ final_split_vertices v_34) → + ∀ (hSub_le_mem : ∀ Q ∈ range P_sub, Q ≤ G), + let θ₁ : ℕ := θ - (4 * (3 * beta + 3) + 2) + (IsFreeSet H'.toHypergraph T' θ₁ X) → + (IsClosed (subBd r₁)) → + IsDrawingEye G H' η' θ₁ T' r₁ := by + intro w hw_α_ends hw_mem hw_vMap k_34 hk_34_ge f_34 v_34 P_sub H' η' T' d' r₁ hM' hr₁_R hvMap + hImg + hOArc_r₁ hCirc_r₁ hOrd_r₁ hSub_le_mem θ₁ hFreeX_T' hcl_bd_r₁ + let w₁ := w ⟨τ₂ - 4, by omega⟩ + let w₂ := w ⟨τ₂ - 3, by omega⟩ + let w₃ := w ⟨τ₂ - 2, by omega⟩ + let w₄ := w ⟨τ₂ - 1, by omega⟩ + let f_r₁ : Fin (2 * τ₂ - 3) → Fin (2 * τ₂) := fun j => ⟨j.1, by omega⟩ + have hf_r₁_mono : StrictMono f_r₁ := fun _ _ h => h + have hList_r₁_eq : + (List.ofFn fun j : Fin (k_34 - 1) => v_34 ⟨j.1, by omega⟩) ++ + [w₁, w₂, w₃, w₄] ++ + (List.ofFn fun j : Fin k_34 => v_34 ⟨k_34 + j.1, by omega⟩) = + List.ofFn (w ∘ f_r₁) := by + apply List.ext_getElem (by simp [k_34]; omega) + intro m hm1 hm2 + simp only [List.length_ofFn] at hm2 + simp only [List.getElem_ofFn, Function.comp_apply, f_r₁] + by_cases hm_left : m < k_34 - 1 + · rw [List.getElem_append_left (by simp; omega), List.getElem_append_left (by simp; omega)] + simp only [List.getElem_ofFn, v_34, Function.comp_apply, f_34, doublecross_boundary_index] + split_ifs <;> try omega + rfl + · by_cases hm_mid : m < k_34 - 1 + 4 + · rw [List.getElem_append_left (by simp; omega), List.getElem_append_right (by simp; omega)] + simp only [List.length_ofFn] + rcases (by omega : m - (k_34 - 1) = 0 ∨ m - (k_34 - 1) = 1 ∨ + m - (k_34 - 1) = 2 ∨ m - (k_34 - 1) = 3) with h0 | h1 | h2 | h3 + · simp only [h0, List.getElem_cons_zero, w₁] + exact congrArg w (Fin.ext (by dsimp; omega)) + · simp only [h1, List.getElem_cons_succ, List.getElem_cons_zero, w₂] + exact congrArg w (Fin.ext (by dsimp; omega)) + · simp only [h2, List.getElem_cons_succ, List.getElem_cons_zero, w₃] + exact congrArg w (Fin.ext (by dsimp; omega)) + · simp only [h3, List.getElem_cons_succ, List.getElem_cons_zero, w₄] + exact congrArg w (Fin.ext (by dsimp; omega)) + · rw [List.getElem_append_right (by simp; omega)] + simp only [List.length_append, List.length_ofFn, List.length_cons, List.length_nil, + List.getElem_ofFn, v_34, Function.comp_apply, f_34, doublecross_boundary_index] + split_ifs <;> try omega + · congr 1; ext; dsimp; omega + · congr 1; ext; dsimp; omega + have hNodup_r₁ : ((List.ofFn fun j : Fin (k_34 - 1) => v_34 ⟨j.1, by omega⟩) ++ + [w₁, w₂, w₃, w₄] ++ + (List.ofFn fun j : Fin k_34 => v_34 ⟨k_34 + j.1, by omega⟩)).Nodup := by + rw [hList_r₁_eq, List.nodup_ofFn] + exact (List.nodup_ofFn.mp hNodup_w).comp hf_r₁_mono.injective + have hOrder_r₁ : GM12.IsListedInOrderOn (subBd D_i.Λ) + ((List.ofFn fun j : Fin (k_34 - 1) => v_34 ⟨j.1, by omega⟩) ++ + [w₁, w₂, w₃, w₄] ++ + (List.ofFn fun j : Fin k_34 => v_34 ⟨k_34 + j.1, by omega⟩)) := by + rw [hList_r₁_eq] + exact isListedInOrderOn_of_strictMono (by omega) hf_r₁_mono hOrder_w + obtain ⟨hw₁_V, hw₂_V, hw₃_V, hw₄_V, hOcc_r₁⟩ := + hOrd_r₁ w₁ w₂ w₃ w₄ (hw_mem _) (hw_mem _) (hw_mem _) (hw_mem _) hNodup_r₁ hOrder_r₁ + have hNodup4_r₁ : [w₁, w₂, w₃, w₄].Nodup := + (List.nodup_append.mp (List.nodup_append.mp hNodup_r₁).1).2.1 + have hFree4_r₁ : IsFreeSet H'.toHypergraph T' θ₁ {w₁, w₂, w₃, w₄} := by + refine hFreeX_T'.subset hM'.1.2.1 ?_ + rintro x (rfl | rfl | rfl | rfl) <;> exact (hinv_mem_X _ (hw_α_ends _)).1 + let P₁_r₁ := P_idx ⟨1, by omega⟩ + let P₂_r₁ := P_idx ⟨0, by omega⟩ + have hDisj_P₁₂_r₁ : Disjoint V(P₁_r₁) V(P₂_r₁) := + transaction_paths_disjoint hTransP hP_range hP_inj (by + intro he + have hval := congrArg Fin.val he + dsimp only at hval + omega) + have hP₁_r₁_H' : IsHPathWithEnds G η'.imageGraph P₁_r₁ (η'.vMap w₁) (η'.vMap w₃) := by + rw [hImg, hvMap w₁ (hw_mem _).1, hvMap w₃ (hw_mem _).1, hw_vMap, hw_vMap] + refine isHPathWithEnds_of_outside_middle D_i.clearedEmbedding.imageGraph_le hTransP + hP_range hP_inj hτ₂_ge12 hSub_le_mem (index := ⟨1, by omega⟩) + (Or.inl (by dsimp; omega)) ?_ + · have hw₁_eq : w_α ⟨τ₂ - 4, by omega⟩ = a_idx ⟨1, by omega⟩ := by + rw [hw_α_lt ⟨τ₂ - 4, by omega⟩ (by dsimp; omega)] + congr 1; ext; dsimp; omega + rw [hw₁_eq, hw_α_m2] + exact hPathsP P₁_r₁ (hP_range ▸ mem_range_self _) _ _ (hEnds_idx ⟨1, by omega⟩).2.2 + have hP₂_r₁_H' : IsHPathWithEnds G η'.imageGraph P₂_r₁ (η'.vMap w₂) (η'.vMap w₄) := by + rw [hImg, hvMap w₂ (hw_mem _).1, hvMap w₄ (hw_mem _).1, hw_vMap, hw_vMap] + refine isHPathWithEnds_of_outside_middle D_i.clearedEmbedding.imageGraph_le hTransP + hP_range hP_inj hτ₂_ge12 hSub_le_mem (index := ⟨0, by omega⟩) + (Or.inl (by dsimp; omega)) ?_ + · have hw₂_eq : w_α ⟨τ₂ - 3, by omega⟩ = a_idx ⟨0, by omega⟩ := by + rw [hw_α_lt ⟨τ₂ - 3, by omega⟩ (by dsimp; omega)] + congr 1; ext; dsimp; omega + rw [hw₂_eq, hw_α_m1] + exact hPathsP P₂_r₁ (hP_range ▸ mem_range_self _) _ _ (hEnds_idx ⟨0, by omega⟩).2.2 + exact ⟨hr₁_R, H'.interSet (subBd r₁), w₁, w₂, w₃, w₄, P₁_r₁, P₂_r₁, + hCirc_r₁, H'.span_isSubdrawing _ _, + GM11.eq_of_oArc_subset (GM11.IsCircuit.isOArc_U hCirc_r₁) hOArc_r₁ + (interSet_U_subset_of_isClosed H' hcl_bd_r₁), + hw₁_V, hw₂_V, hw₃_V, hw₄_V, hNodup4_r₁, hOcc_r₁, hFree4_r₁, + hDisj_P₁₂_r₁, hP₁_r₁_H', hP₂_r₁_H'⟩ + +private theorem last_split_region_is_eye + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (θ_star : ℕ) + (θ : ℕ) + (θ' : ℕ) + (π : ℕ) + (beta : ℕ) + (μ : ℕ) + (τ₂ : ℕ) + (k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (r : Fin k → Set S) + (S₀ : Set (Society α β)) + (α₀_disc : Society α β → Set S) + (α₀_pt : α → S) + (i : Fin k) + (D_i : Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i) + (P : Set (Graph α β)) + (X : Set S) + (hτ₂_eq : τ₂ = 6 + θ' / 2) + (hTransP : D_i.clearedSociety.IsTransaction P) + (hPathsP : ∀ P₀ ∈ P, ∀ (a b : α), D_i.clearedSociety.IsOmegaPathWithEnds P₀ a b + → IsHPathWithEnds G + D_i.clearedEmbedding.imageGraph P₀ a b) + (hCardτ₂ : P.ncard = τ₂) + (A_f : Set α) + (B_f : Set α) + (P_idx : Fin τ₂ → Graph α β) + (a_idx : Fin τ₂ → α) + (b_idx : Fin τ₂ → α) + (hP_inj : Injective P_idx) + (hP_range : range P_idx = P) + (hEnds_idx : ∀ (i_1 : Fin τ₂), a_idx i_1 ∈ A_f ∧ b_idx i_1 ∈ B_f ∧ + D_i.clearedSociety.IsOmegaPathWithEnds (P_idx i_1) (a_idx i_1) (b_idx i_1)) + (hτ₂_ge12 : 12 ≤ τ₂) + (inv_v : α → S) + (hinv_mem_X : ∀ x ∈ D_i.clearedSociety.transactionEnds P, inv_v x ∈ X + ∧ D_i.clearedEmbedding.vMap (inv_v x) = x) + (w_α : Fin (2 * τ₂) → α) + (hNodup_w : (List.ofFn (inv_v ∘ w_α)).Nodup) + (hOrder_w : GM12.IsListedInOrderOn (subBd D_i.Λ) (List.ofFn (inv_v ∘ w_α))) + (hw_α_last4 : w_α ⟨2 * τ₂ - 4, by omega⟩ = b_idx ⟨τ₂ - 1, by omega⟩) + (hw_α_last3 : w_α ⟨2 * τ₂ - 3, by omega⟩ = b_idx ⟨τ₂ - 2, by omega⟩) + (hw_α_last2 : w_α ⟨2 * τ₂ - 2, by omega⟩ = a_idx ⟨τ₂ - 1, by omega⟩) + (hw_α_last1 : w_α ⟨2 * τ₂ - 1, by omega⟩ = a_idx ⟨τ₂ - 2, by omega⟩) : + let w : Fin (2 * τ₂) → S := inv_v ∘ w_α + ∀ (hw_α_ends : ∀ (m : Fin (2 * τ₂)), w_α m ∈ D_i.clearedSociety.transactionEnds P), + ∀ (hw_mem : ∀ (m : Fin (2 * τ₂)), w m ∈ (clearedSubdrawing H D_i.Λ).V ∩ subBd D_i.Λ), + ∀ (hw_vMap : ∀ (m : Fin (2 * τ₂)), D_i.clearedEmbedding.vMap (w m) = w_α m), + let k_34 : ℕ := τ₂ - 3 + ∀ (hk_34_ge : 3 ≤ k_34), + let f_34 := doublecross_boundary_index τ₂ hτ₂_ge12 + let v_34 : Fin (2 * k_34) → S := w ∘ f_34 + let P_sub := doublecross_middle_paths P_idx hτ₂_ge12 + ∀ (H' : Drawing S), + ∀ (η' : SpanEmbedding H' G), + ∀ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))), + ∀ (d' : Set S → Set S → ℕ), + ∀ (r₂ : Set S), + ∀ (hM' : HasTangleMetric H' (θ - (4 * (3 * beta + 3) + 2)) T' d'), + ∀ (hr₂_R : r₂ ∈ H'.R), + ∀ (hvMap : ∀ x ∈ (clearedSubdrawing H D_i.Λ).V, η'.vMap x = D_i.clearedEmbedding.vMap x), + ∀ (hImg : η'.imageGraph = subgraphUnion G D_i.clearedEmbedding.imageGraph (subgraphSUnion G + (range + P_sub))), + ∀ (hOArc_r₂ : IsOArc (subBd r₂)), + ∀ (hCirc_r₂ : (H'.interSet (subBd r₂)).IsCircuit), + SplitRegionOrder (clearedSubdrawing H D_i.Λ) H' D_i.Λ r₂ + (fun a b c d => split_vertices_without_last v_34 ++ [a, b, c, d]) → + ∀ (hSub_le_mem : ∀ Q ∈ range P_sub, Q ≤ G), + let θ₁ : ℕ := θ - (4 * (3 * beta + 3) + 2) + (IsFreeSet H'.toHypergraph T' θ₁ X) → + (IsClosed (subBd r₂)) → + IsDrawingEye G H' η' θ₁ T' r₂ := by + intro w hw_α_ends hw_mem hw_vMap k_34 hk_34_ge f_34 v_34 P_sub H' η' T' d' r₂ hM' hr₂_R hvMap + hImg + hOArc_r₂ hCirc_r₂ hOrd_r₂ hSub_le_mem θ₁ hFreeX_T' hcl_bd_r₂ + let u₁ := w ⟨2 * τ₂ - 4, by omega⟩ + let u₂ := w ⟨2 * τ₂ - 3, by omega⟩ + let u₃ := w ⟨2 * τ₂ - 2, by omega⟩ + let u₄ := w ⟨2 * τ₂ - 1, by omega⟩ + let f_r₂ : Fin (2 * k_34 + 3) → Fin (2 * τ₂) := fun j => + if hj1 : j.1 < k_34 then ⟨j.1, by omega⟩ + else ⟨j.1 + 3, by omega⟩ + have hf_r₂_mono : StrictMono f_r₂ := by + intro j₁ j₂ hj + change (f_r₂ j₁).1 < (f_r₂ j₂).1 + dsimp only [f_r₂] + split_ifs <;> dsimp <;> omega + have hList_r₂_eq : + (List.ofFn fun j : Fin (2 * k_34 - 1) => v_34 ⟨j.1, by omega⟩) ++ + [u₁, u₂, u₃, u₄] = + List.ofFn (w ∘ f_r₂) := by + apply List.ext_getElem (by simp [k_34]; omega) + intro m hm1 hm2 + simp only [List.length_ofFn] at hm2 + simp only [List.getElem_ofFn, Function.comp_apply, f_r₂] + by_cases hm_left : m < 2 * k_34 - 1 + · rw [List.getElem_append_left (by simp; omega)] + simp only [List.getElem_ofFn, v_34, Function.comp_apply, f_34, doublecross_boundary_index] + split_ifs <;> try omega + all_goals rfl + · rw [List.getElem_append_right (by simp; omega)] + simp only [List.length_ofFn] + rcases (by omega : m - (2 * k_34 - 1) = 0 ∨ m - (2 * k_34 - 1) = 1 ∨ + m - (2 * k_34 - 1) = 2 ∨ m - (2 * k_34 - 1) = 3) with h0 | h1 | h2 | h3 + · simp only [h0, List.getElem_cons_zero, u₁] + rw [dite_eq_right (by omega)] + exact congrArg w (Fin.ext (by dsimp; omega)) + · simp only [h1, List.getElem_cons_succ, List.getElem_cons_zero, u₂] + rw [dite_eq_right (by omega)] + exact congrArg w (Fin.ext (by dsimp; omega)) + · simp only [h2, List.getElem_cons_succ, List.getElem_cons_zero, u₃] + rw [dite_eq_right (by omega)] + exact congrArg w (Fin.ext (by dsimp; omega)) + · simp only [h3, List.getElem_cons_succ, List.getElem_cons_zero, u₄] + rw [dite_eq_right (by omega)] + exact congrArg w (Fin.ext (by dsimp; omega)) + have hNodup_r₂ : ((List.ofFn fun j : Fin (2 * k_34 - 1) => v_34 ⟨j.1, by omega⟩) ++ + [u₁, u₂, u₃, u₄]).Nodup := by + rw [hList_r₂_eq, List.nodup_ofFn] + exact (List.nodup_ofFn.mp hNodup_w).comp hf_r₂_mono.injective + have hOrder_r₂ : GM12.IsListedInOrderOn (subBd D_i.Λ) + ((List.ofFn fun j : Fin (2 * k_34 - 1) => v_34 ⟨j.1, by omega⟩) ++ + [u₁, u₂, u₃, u₄]) := by + rw [hList_r₂_eq] + exact isListedInOrderOn_of_strictMono (by omega) hf_r₂_mono hOrder_w + obtain ⟨hu₁_V, hu₂_V, hu₃_V, hu₄_V, hOcc_r₂⟩ := + hOrd_r₂ u₁ u₂ u₃ u₄ (hw_mem _) (hw_mem _) (hw_mem _) (hw_mem _) hNodup_r₂ hOrder_r₂ + have hNodup4_r₂ : [u₁, u₂, u₃, u₄].Nodup := (List.nodup_append.mp hNodup_r₂).2.1 + have hFree4_r₂ : IsFreeSet H'.toHypergraph T' θ₁ {u₁, u₂, u₃, u₄} := by + refine hFreeX_T'.subset hM'.1.2.1 ?_ + rintro x (rfl | rfl | rfl | rfl) <;> exact (hinv_mem_X _ (hw_α_ends _)).1 + let P₁_r₂ := P_idx ⟨τ₂ - 1, by omega⟩ + let P₂_r₂ := P_idx ⟨τ₂ - 2, by omega⟩ + have hDisj_P₁₂_r₂ : Disjoint V(P₁_r₂) V(P₂_r₂) := + transaction_paths_disjoint hTransP hP_range hP_inj (by + intro he + have hval := congrArg Fin.val he + dsimp only at hval + omega) + have hP₁_r₂_H' : IsHPathWithEnds G η'.imageGraph P₁_r₂ (η'.vMap u₁) (η'.vMap u₃) := by + rw [hImg, hvMap u₁ (hw_mem _).1, hvMap u₃ (hw_mem _).1, hw_vMap, hw_vMap] + refine isHPathWithEnds_of_outside_middle D_i.clearedEmbedding.imageGraph_le hTransP + hP_range hP_inj hτ₂_ge12 hSub_le_mem (index := ⟨τ₂ - 1, by omega⟩) + (Or.inr (by dsimp; omega)) ?_ + · rw [hw_α_last4, hw_α_last2] + have hP_end := (hEnds_idx ⟨τ₂ - 1, by omega⟩).2.2 + exact hPathsP P₁_r₂ (hP_range ▸ mem_range_self _) _ _ + ⟨hP_end.1.symm, hP_end.2.1.symm, hP_end.2.2.2, hP_end.2.2.1⟩ + have hP₂_r₂_H' : IsHPathWithEnds G η'.imageGraph P₂_r₂ (η'.vMap u₂) (η'.vMap u₄) := by + rw [hImg, hvMap u₂ (hw_mem _).1, hvMap u₄ (hw_mem _).1, hw_vMap, hw_vMap] + refine isHPathWithEnds_of_outside_middle D_i.clearedEmbedding.imageGraph_le hTransP + hP_range hP_inj hτ₂_ge12 hSub_le_mem (index := ⟨τ₂ - 2, by omega⟩) + (Or.inr (by dsimp; omega)) ?_ + · rw [hw_α_last3, hw_α_last1] + have hP_end := (hEnds_idx ⟨τ₂ - 2, by omega⟩).2.2 + exact hPathsP P₂_r₂ (hP_range ▸ mem_range_self _) _ _ + ⟨hP_end.1.symm, hP_end.2.1.symm, hP_end.2.2.2, hP_end.2.2.1⟩ + exact ⟨hr₂_R, H'.interSet (subBd r₂), u₁, u₂, u₃, u₄, P₁_r₂, P₂_r₂, + hCirc_r₂, H'.span_isSubdrawing _ _, + GM11.eq_of_oArc_subset (GM11.IsCircuit.isOArc_U hCirc_r₂) hOArc_r₂ + (interSet_U_subset_of_isClosed H' hcl_bd_r₂), + hu₁_V, hu₂_V, hu₃_V, hu₄_V, hNodup4_r₂, hOcc_r₂, hFree4_r₂, + hDisj_P₁₂_r₂, hP₁_r₂_H', hP₂_r₂_H'⟩ + +private theorem other_eye_survives_split + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (θ_star : ℕ) + (θ : ℕ) + (θ' : ℕ) + (lam' : ℕ) + (π : ℕ) + (beta : ℕ) + (μ : ℕ) + (τ₂ : ℕ) + (k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (r : Fin k → Set S) + (S₀ : Set (Society α β)) + (α₀_disc : Society α β → Set S) + (α₀_pt : α → S) + (i : Fin k) + (D_i : Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i) + (P : Set (Graph α β)) + (hMetric : HasTangleMetric H θ T d) + (hμ2 : 2 ≤ μ) + (hlam'4 : 4 ≤ lam') + (hθ'_ge : 4 * lam' + μ + 2 ≤ θ') + (_ : τ₂ = 6 + θ' / 2) + (hbeta_ge : θ' + 13 * μ + 14 ≤ beta) + (hθ_ge : 100 * beta ≤ θ) + (hr_eye : ∀ (j : Fin k), IsDrawingEye G H η θ T (r j)) + (hr_dist : ∀ (j₁ j₂ : Fin k), j₁ ≠ j₂ → d (r j₁) (r j₂) = θ) + (_ : P.ncard = τ₂) + (hS : IsClosedSurface S) + [hConn : ConnectedSpace S] + (hd_symm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (hd_tri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) + (hd_inc : (H.E.Nonempty → ∀ v ∈ H.V, ∀ r ∈ H.R, v ∈ closure r → d {v} r ≤ 1) ∧ ∀ v ∈ H.V, ∀ e + ∈ H.E, v ∈ closure e → d {v} e ≤ 2) + (_ : 12 ≤ τ₂) + : + let k_34 : ℕ := τ₂ - 3 + (3 ≤ k_34) → + ∀ (v_34 : Fin (2 * k_34) → S), + (∀ (j : Fin (2 * k_34)), v_34 j ∈ (clearedSubdrawing H D_i.Λ).V ∩ subBd D_i.Λ) → + ∀ (P_sub : Fin (k_34 - 1) → Graph α β), + (∀ (j : Fin (k_34 - 1)), ∃ i₁ i₂ : Fin (2 * k_34), i₁.1 = j.1 ∧ i₂.1 = 2 * k_34 - 2 - j.1 ∧ + IsHPathWithEnds G D_i.clearedEmbedding.imageGraph (P_sub j) (D_i.clearedEmbedding.vMap + (v_34 i₁)) (D_i.clearedEmbedding.vMap (v_34 + i₂))) → + ∀ (H' : Drawing S), + ∀ (η' : SpanEmbedding H' G), + ∀ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))), + ∀ (d' : Set S → Set S → ℕ), + ((clearedSubdrawing H D_i.Λ).IsSubdrawing H') → + (∀ x ∈ (clearedSubdrawing H D_i.Λ).V, η'.vMap x = D_i.clearedEmbedding.vMap x) → + (η'.imageGraph = subgraphUnion G D_i.clearedEmbedding.imageGraph (subgraphSUnion G (range + P_sub))) → + (T' = inducedTangle H'.toHypergraph (clearedSubdrawing H D_i.Λ).toHypergraph D_i.T₁ + (θ - (4 * (3 * beta + 3) + 2))) → + (IsRearrangedWithin G H H' η η' θ_star θ (3 * beta + 3) T_star T T' d d' (r i)) → + (∀ Q ∈ range P_sub, Q ≤ G) → + let θ₁ : ℕ := θ - (4 * (3 * beta + 3) + 2) + (IsTangle (clearedSubdrawing H D_i.Λ).toHypergraph θ₁ D_i.T₁) → + (IsFlatSpan G H η θ_star θ (3 * beta + 3) μ T_star T) → + ((clearedSubdrawing H D_i.Λ).IsSubdrawing H) → + (V(D_i.clearedEmbedding.imageGraph) ⊆ V(η.imageGraph)) → + (E(D_i.clearedEmbedding.imageGraph) ⊆ E(η.imageGraph)) → + (H.E.Nonempty) → + ∀ (j : Fin k), j ≠ i → IsDrawingEye G H' η' θ₁ T' (r j) := by + intro k_34 hk_34_ge v_34 hv34_mem P_sub hP_sub_paths H' η' T' d' hSub hvMap hImg hInd + hRearr' hSub_le_mem θ₁ hT₁_tangle hFlat_beta hSub_cleared hImg_sub_V hImg_sub_E hE_ne j hj_ne + have hd_ij : d (r i) (r j) = θ := hr_dist i j hj_ne.symm + rcases hr_eye j with ⟨hrj_R, C, a, b, c, d_v, P₁, P₂, hC_circ, hC_sub, hC_U, + haC, hbC, hcC, hdvC, hnodup4, hord4, hFree4, hdisj_P₁₂, hP₁, hP₂⟩ + have hrj_A : r j ∈ H.A := Or.inr hrj_R + have hri_A : r i ∈ H.A := Or.inr (hr_eye i).1 + have hC_vert_dist : ∀ v ∈ C.V, θ - 1 ≤ d (r i) {v} := by + intro v hvC + have hv_bd : v ∈ subBd (r j) := hC_U ▸ C.V_subset_U hvC + have hvA : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hC_sub.1 hvC, rfl⟩) + have hd_v_rj : d {v} (r j) ≤ 1 := hd_inc.1 hE_ne v (hC_sub.1 hvC) (r j) hrj_R hv_bd.1 + have htri := hd_tri (r i) hri_A {v} hvA (r j) hrj_A + omega + have hrj_R' : r j ∈ H'.R := + region_mem_R_of_mem_A hS hrj_R (hRearr'.atom_mem (r j) hrj_A (by omega)) + have hCV_H₁ : ∀ v ∈ C.V, v ∈ (clearedSubdrawing H D_i.Λ).V ∧ D_i.clearedEmbedding.vMap v + = η.vMap v := by + intro v hvC + have hd_v := hC_vert_dist v hvC + exact D_i.isRearranged.vMap_eq v (hC_sub.1 hvC) (by omega) + have hCE_H₁ : ∀ e ∈ C.E, e ∈ (clearedSubdrawing H D_i.Λ).E ∧ D_i.clearedEmbedding.eMap e + = η.eMap e := by + intro e heC + have ⟨v, hve, hvC⟩ : ∃ v, v ∈ closure e ∧ v ∈ C.V := by + rcases C.edge_cond e heC with ⟨u, w, _, hcap, _⟩ | ⟨u, hcap, _⟩ <;> + exact ⟨u, by rw [← mem_inter_iff, hcap]; simp⟩ + have hvA : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hC_sub.1 hvC, rfl⟩) + have heA : e ∈ H.A := Or.inl (Or.inr (hC_sub.2 heC)) + have hd_v := hC_vert_dist v hvC + have hd_v_e : d {v} e ≤ 2 := hd_inc.2 v (hC_sub.1 hvC) e (hC_sub.2 heC) hve + have htri := hd_tri (r i) hri_A e heA {v} hvA + have hsym := hd_symm {v} hvA e heA + exact D_i.isRearranged.eMap_eq e (hC_sub.2 heC) (by omega) + have hC_sub_H' : C.IsSubdrawing H' := + ⟨fun v hv => hSub.1 (hCV_H₁ v hv).1, fun e he => hSub.2 (hCE_H₁ e he).1⟩ + have hcard4 : ({a, b, c, d_v} : Set S).ncard ≤ 4 := by + have h1 := ncard_insert_le a ({b, c, d_v} : Set S) + have h2 := ncard_insert_le b ({c, d_v} : Set S) + have h3 := ncard_insert_le c ({d_v} : Set S) + have h4' : ({d_v} : Set S).ncard = 1 := ncard_singleton d_v + omega + have hFree4_H₁ : IsFreeSet (clearedSubdrawing H D_i.Λ).toHypergraph D_i.T₁ θ₁ {a, b, c, d_v} := by + refine theorem_4_7_proof H (clearedSubdrawing H D_i.Λ) + θ (3 * beta + 3) T D_i.T₁ d D_i.d₁ (r i) {a, b, c, d_v} + hS hConn hMetric hri_A (by omega) hFree4 ?_ + D_i.isCleared.hasMetric.1.1 D_i.isRearranged.atom_mem D_i.isRearranged.isCompression + intro v hv + have hvC : v ∈ C.V := by rcases hv with rfl | rfl | rfl | rfl <;> assumption + have hd_v := hC_vert_dist v hvC + omega + have hFree4_H' : IsFreeSet H'.toHypergraph T' θ₁ {a, b, c, d_v} := + isFreeSet_inducedTangle_of_isFreeSet hSub hT₁_tangle hInd (by omega) hFree4_H₁ + have h_ne_v34 : ∀ u ∈ C.V, ∀ idx : Fin (2 * k_34), + D_i.clearedEmbedding.vMap u ≠ D_i.clearedEmbedding.vMap (v_34 idx) := by + intro u huC idx hEq + have huv : u = v_34 idx := + D_i.clearedEmbedding.bijOn_v.injOn (hCV_H₁ u huC).1 (hv34_mem idx).1 hEq + have hd1 := hC_vert_dist u huC + have hd2 := D_i.isZone.dist_le {v_34 idx} + (Or.inl (Or.inl ⟨v_34 idx, hSub_cleared.1 (hv34_mem idx).1, rfl⟩)) + (by rw [singleton_subset_iff]; exact (hv34_mem idx).2.1) + rw [huv] at hd1 + omega + have hPath_to_H' : ∀ {P₀ : Graph α β} {u₀ w₀ : S}, + u₀ ∈ C.V → w₀ ∈ C.V → + IsHPathWithEnds G η.imageGraph P₀ (η.vMap u₀) (η.vMap w₀) → + IsHPathWithEnds G η'.imageGraph P₀ (η'.vMap u₀) (η'.vMap w₀) := by + intro P₀ u₀ w₀ hu₀C hw₀C hP₀ + have hu₀_eq : η'.vMap u₀ = D_i.clearedEmbedding.vMap u₀ := hvMap u₀ (hCV_H₁ u₀ hu₀C).1 + have hw₀_eq : η'.vMap w₀ = D_i.clearedEmbedding.vMap w₀ := hvMap w₀ (hCV_H₁ w₀ hw₀C).1 + have hu₀_Λ : D_i.clearedEmbedding.vMap u₀ = η.vMap u₀ := (hCV_H₁ u₀ hu₀C).2 + have hw₀_Λ : D_i.clearedEmbedding.vMap w₀ = η.vMap w₀ := (hCV_H₁ w₀ hw₀C).2 + have hP₀_H₁ : IsHPathWithEnds G D_i.clearedEmbedding.imageGraph P₀ + (D_i.clearedEmbedding.vMap u₀) (D_i.clearedEmbedding.vMap w₀) := by + refine ⟨D_i.clearedEmbedding.imageGraph_le, hu₀_Λ.symm ▸ hw₀_Λ.symm ▸ hP₀.2.1, + by rw [hu₀_Λ, hw₀_Λ]; exact hP₀.2.2.1, + D_i.clearedEmbedding.bijOn_v.mapsTo (hCV_H₁ u₀ hu₀C).1, + D_i.clearedEmbedding.bijOn_v.mapsTo (hCV_H₁ w₀ hw₀C).1, ?_, ?_⟩ + · apply subset_antisymm + · intro x ⟨hxP, hx₁⟩ + have hx_pair : x ∈ ({η.vMap u₀, η.vMap w₀} : Set α) := + hP₀.2.2.2.2.2.1 ▸ ⟨hxP, hImg_sub_V hx₁⟩ + rwa [← hu₀_Λ, ← hw₀_Λ] at hx_pair + · rintro x (rfl | rfl) + · exact ⟨hu₀_Λ ▸ hP₀.2.1.left_mem, D_i.clearedEmbedding.bijOn_v.mapsTo (hCV_H₁ u₀ hu₀C).1⟩ + · exact ⟨hw₀_Λ ▸ hP₀.2.1.right_mem, D_i.clearedEmbedding.bijOn_v.mapsTo + (hCV_H₁ w₀ hw₀C).1⟩ + · exact hP₀.2.2.2.2.2.2.mono_right hImg_sub_E + rw [hImg, hu₀_eq, hw₀_eq] + refine isHPathWithEnds_subgraphUnion_of_disjoint D_i.clearedEmbedding.imageGraph_le hSub_le_mem + hP₀_H₁ ?_ + intro m + by_contra hnot_disj + have hne_inter : (V(P₀) ∩ V(P_sub m)).Nonempty := + Set.not_disjoint_iff_nonempty_inter.mp hnot_disj + obtain ⟨i₁, i₂, _, _, hPm_path⟩ := hP_sub_paths m + have hdisj_ends : Disjoint ({D_i.clearedEmbedding.vMap u₀, D_i.clearedEmbedding.vMap w₀} : Set + α) + {D_i.clearedEmbedding.vMap (v_34 i₁), D_i.clearedEmbedding.vMap (v_34 i₂)} := by + refine Set.disjoint_left.mpr ?_ + intro x hx₁ hx₂ + simp only [mem_insert_iff, mem_singleton_iff] at hx₁ hx₂ + rcases hx₁ with rfl | rfl <;> rcases hx₂ with hEq | hEq + · exact h_ne_v34 u₀ hu₀C i₁ hEq + · exact h_ne_v34 u₀ hu₀C i₂ hEq + · exact h_ne_v34 w₀ hw₀C i₁ hEq + · exact h_ne_v34 w₀ hw₀C i₂ hEq + obtain ⟨P_join, hP_join, _, _⟩ := + exists_isHPathWithEnds_of_inter_nonempty hP₀_H₁ hPm_path hdisj_ends hne_inter + have hu₀_A : ({u₀} : Set S) ∈ H.A := Or.inl (Or.inl ⟨u₀, hC_sub.1 hu₀C, rfl⟩) + have hv₂_A : ({v_34 i₂} : Set S) ∈ H.A := + Or.inl (Or.inl ⟨v_34 i₂, hSub_cleared.1 (hv34_mem i₂).1, rfl⟩) + have hd_ri_u₀ : θ - 1 ≤ d (r i) {u₀} := hC_vert_dist u₀ hu₀C + have hd_ri_v₂ : d (r i) {v_34 i₂} ≤ 3 * beta + 3 := + D_i.isZone.dist_le {v_34 i₂} hv₂_A + (by rw [singleton_subset_iff]; exact (hv34_mem i₂).2.1) + have htri_u₀_v₂ := hd_tri (r i) hri_A {v_34 i₂} hv₂_A {u₀} hu₀_A + have hsymm_u₀_v₂ := hd_symm {v_34 i₂} hv₂_A {u₀} hu₀_A + have hcomp_val : d {u₀} {v_34 i₂} ≤ D_i.d₁ {u₀} {v_34 i₂} + (4 * (3 * beta + 3) + 2) := by + have hcomp := D_i.isRearranged.isCompression.dist_le u₀ (v_34 i₂) + rwa [pointDist_eq_of_mem_atom (d := d) hu₀_A hv₂_A (mem_singleton _) (mem_singleton _), + pointDist_eq_of_mem_atom (d := D_i.d₁) + (Or.inl (Or.inl ⟨u₀, (hCV_H₁ u₀ hu₀C).1, rfl⟩)) + (Or.inl (Or.inl ⟨v_34 i₂, (hv34_mem i₂).1, rfl⟩)) + (mem_singleton _) (mem_singleton _)] at hcomp + have hStep_Λ : IsMuSteppedSpan G (clearedSubdrawing H D_i.Λ) D_i.clearedEmbedding D_i.d₁ μ := + ⟨P_join, u₀, v_34 i₂, (hCV_H₁ u₀ hu₀C).1, (hv34_mem i₂).1, hP_join, by omega⟩ + exact hFlat_beta.no_stepped_rearrangement D_i.isRearranged hStep_Λ + exact ⟨hrj_R', C, a, b, c, d_v, P₁, P₂, hC_circ, hC_sub_H', hC_U, + haC, hbC, hcC, hdvC, hnodup4, hord4, hFree4_H', hdisj_P₁₂, + hPath_to_H' haC hcC hP₁, hPath_to_H' hbC hdvC hP₂⟩ + +private theorem section7S1_of_split_eyes + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (θ_star : ℕ) + (θ : ℕ) + (θ' : ℕ) + (lam : ℕ) + (lam' : ℕ) + (π : ℕ) + (beta : ℕ) + (μ : ℕ) + (τ₂ : ℕ) + (k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (r : Fin k → Set S) + (S₀ : Set (Society α β)) + (α₀_disc : Society α β → Set S) + (α₀_pt : α → S) + (i : Fin k) + (D_i : Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i) + (P : Set (Graph α β)) + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hMetric : HasTangleMetric H θ T d) + (hμ2 : 2 ≤ μ) + (hlam'4 : 4 ≤ lam') + (hθ'_ge : 4 * lam' + μ + 2 ≤ θ') + (hτ₂_eq : τ₂ = 6 + θ' / 2) + (hlam_ge : 6 * (3 * beta + 3) + 5 * lam' + 3 * μ + 4 ≤ lam) + (hbeta_ge : θ' + 13 * μ + 14 ≤ beta) + (hθ_ge : 100 * beta ≤ θ) + (hr_eye : ∀ (j : Fin k), IsDrawingEye G H η θ T (r j)) + (hr_dist : ∀ (j₁ j₂ : Fin k), j₁ ≠ j₂ → d (r j₁) (r j₂) = θ) + (hCardτ₂ : P.ncard = τ₂) + (hS : IsClosedSurface S) + [hConn : ConnectedSpace S] + (hd_tri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) + (hτ₂_ge12 : 12 ≤ τ₂) + : + let k_34 : ℕ := τ₂ - 3 + (3 ≤ k_34) → + ∀ (H' : Drawing S), + ∀ (η' : SpanEmbedding H' G), + ∀ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))), + ∀ (d' : Set S → Set S → ℕ), + ∀ (r₁ : Set S), + ∀ (r₂ : Set S), + (HasTangleMetric H' (θ - (4 * (3 * beta + 3) + 2)) T' d') → + (r₁ ∈ H'.R) → + (r₂ ∈ H'.R) → + (r₁ ⊆ D_i.Λ) → + (r₂ ⊆ D_i.Λ) → + (IsRearrangedWithin G H H' η η' θ_star θ (3 * beta + 3) T_star T T' d d' (r i)) → + (θ' ≤ d' r₁ r₂) → + let θ₁ : ℕ := θ - (4 * (3 * beta + 3) + 2) + (IsDrawingEye G H' η' θ₁ T' r₁) → + (IsDrawingEye G H' η' θ₁ T' r₂) → + ((clearedSubdrawing H D_i.Λ).IsSubdrawing H) → + (∀ (j : Fin k), j ≠ i → IsDrawingEye G H' η' θ₁ T' (r j)) → + Section7S1 S G θ_star T_star k μ lam' θ' := by + intro k_34 hk_34_ge H' η' T' d' r₁ r₂ hM' hr₁_R hr₂_R hr₁_sub hr₂_sub hRearr' hdist_r₁r₂_θ' θ₁ + hr₁_eye hr₂_eye hSub_cleared hr_other_eye + obtain ⟨_, hd'_refl, _, hd'_symm, _, _⟩ := gm11_theorem_9_1 H' θ₁ T' d' hS hConn hM' + have hdist_new_other : ∀ {r_new : Set S}, r_new ∈ H'.R → r_new ⊆ D_i.Λ → + ∀ j : Fin k, j ≠ i → θ' ≤ d' r_new (r j) := by + intro r_new hr_new hsub_Λ j hj_ne + obtain ⟨σ₁, hσ₁⟩ := (hM'.1.1.2 r_new hr_new).isPathConnected.nonempty + obtain ⟨σ₂, hσ₂⟩ := (hMetric.1.1.2 (r j) (hr_eye j).1).isPathConnected.nonempty + obtain ⟨a₁, ha₁, hσ₁_a₁⟩ := exists_atom_of_point H σ₁ + have ha₁_sub_Λ : a₁ ⊆ D_i.Λ := + atom_subset_of_isSubdrawing hSub_cleared ha₁ (Or.inr D_i.mem_R_cleared) hσ₁_a₁ (hsub_Λ hσ₁) + have hd_ri_a₁ : d (r i) a₁ ≤ 3 * beta + 3 := + D_i.isZone.dist_le a₁ ha₁ (ha₁_sub_Λ.trans subset_closure) + have hd_ri_rj : d (r i) (r j) = θ := hr_dist i j hj_ne.symm + have htri := hd_tri (r i) (Or.inr (hr_eye i).1) a₁ ha₁ (r j) (Or.inr (hr_eye j).1) + have hrj_R' : r j ∈ H'.R := (hr_other_eye j hj_ne).1 + have hcomp_val : d a₁ (r j) ≤ d' r_new (r j) + (4 * (3 * beta + 3) + 2) := by + have hcomp := hRearr'.isCompression.dist_le σ₁ σ₂ + rwa [pointDist_eq_of_mem_atom (d := d) ha₁ (Or.inr (hr_eye j).1) hσ₁_a₁ hσ₂, + pointDist_eq_of_mem_atom (d := d') (Or.inr hr_new) (Or.inr hrj_R') hσ₁ hσ₂] at hcomp + omega + have hdist_other_other : ∀ j₁ j₂ : Fin k, j₁ ≠ i → j₂ ≠ i → j₁ ≠ j₂ → + θ' ≤ d' (r j₁) (r j₂) := by + intro j₁ j₂ hj₁ hj₂ hj₁₂ + obtain ⟨σ₁, hσ₁⟩ := (hMetric.1.1.2 (r j₁) (hr_eye j₁).1).isPathConnected.nonempty + obtain ⟨σ₂, hσ₂⟩ := (hMetric.1.1.2 (r j₂) (hr_eye j₂).1).isPathConnected.nonempty + have hd_j₁j₂ : d (r j₁) (r j₂) = θ := hr_dist j₁ j₂ hj₁₂ + have hrj₁_R' : r j₁ ∈ H'.R := (hr_other_eye j₁ hj₁).1 + have hrj₂_R' : r j₂ ∈ H'.R := (hr_other_eye j₂ hj₂).1 + have hcomp_val : d (r j₁) (r j₂) ≤ d' (r j₁) (r j₂) + (4 * (3 * beta + 3) + 2) := by + have hcomp := hRearr'.isCompression.dist_le σ₁ σ₂ + rwa [pointDist_eq_of_mem_atom (d := d) (Or.inr (hr_eye j₁).1) (Or.inr (hr_eye j₂).1) hσ₁ hσ₂, + pointDist_eq_of_mem_atom (d := d') (Or.inr hrj₁_R') (Or.inr hrj₂_R') hσ₁ hσ₂] at hcomp + omega + -- Claim (7): `H', η', T'` is `(lam', μ)`-flat. + have hFlat' : IsFlatSpan G H' η' θ_star θ₁ lam' μ T_star T' := + theorem_5_2_proof G H H' η η' θ_star θ lam (3 * beta + 3) lam' μ + T_star T T' d d' (r i) hFlat (by omega) (by omega) hlam'4 hlam_ge hRearr' + -- Assemble the `k + 1` eyes `r'` of `H', η', T'` at distance `≥ θ'` and apply (7.1). + let r' : Fin (k + 1) → Set S := fun m => + if hm : m.1 < k then + if m.1 = i.1 then r₁ else r ⟨m.1, hm⟩ + else r₂ + have hr'_eye : ∀ m : Fin (k + 1), IsDrawingEye G H' η' θ₁ T' (r' m) := by + intro m + dsimp only [r'] + split_ifs with hm hmi + · exact hr₁_eye + · exact hr_other_eye ⟨m.1, hm⟩ (fun h => hmi (congrArg Fin.val h)) + · exact hr₂_eye + have hr'_dist : ∀ m₁ m₂ : Fin (k + 1), m₁ ≠ m₂ → θ' ≤ d' (r' m₁) (r' m₂) := by + intro m₁ m₂ hm_ne + have hm_val_ne : m₁.1 ≠ m₂.1 := fun h => hm_ne (Fin.ext h) + by_cases hm₁ : m₁.1 < k + · by_cases hmi₁ : m₁.1 = i.1 + · by_cases hm₂ : m₂.1 < k + · have hmi₂ : m₂.1 ≠ i.1 := by omega + simp only [r', hmi₁, hm₂, hmi₂, i.isLt, ↓reduceDIte, ↓reduceIte] + exact hdist_new_other hr₁_R hr₁_sub ⟨m₂.1, hm₂⟩ (fun h => hmi₂ (congrArg Fin.val h)) + · simp only [r', hmi₁, hm₂, i.isLt, ↓reduceDIte, ↓reduceIte] + exact hdist_r₁r₂_θ' + · by_cases hm₂ : m₂.1 < k + · by_cases hmi₂ : m₂.1 = i.1 + · simp only [r', hm₁, hmi₁, hmi₂, i.isLt, ↓reduceDIte, ↓reduceIte] + rw [hd'_symm (r ⟨m₁.1, hm₁⟩) (Or.inr (hr_other_eye ⟨m₁.1, hm₁⟩ + (fun h => hmi₁ (congrArg Fin.val h))).1) r₁ (Or.inr hr₁_R)] + exact hdist_new_other hr₁_R hr₁_sub ⟨m₁.1, hm₁⟩ (fun h => hmi₁ (congrArg Fin.val h)) + · simp only [r', hm₁, hmi₁, hm₂, hmi₂, ↓reduceDIte, ↓reduceIte] + exact hdist_other_other ⟨m₁.1, hm₁⟩ ⟨m₂.1, hm₂⟩ + (fun h => hmi₁ (congrArg Fin.val h)) (fun h => hmi₂ (congrArg Fin.val h)) + (fun h => hm_val_ne (Fin.mk.inj h)) + · simp only [r', hm₁, hmi₁, hm₂, ↓reduceDIte, ↓reduceIte] + rw [hd'_symm (r ⟨m₁.1, hm₁⟩) (Or.inr (hr_other_eye ⟨m₁.1, hm₁⟩ + (fun h => hmi₁ (congrArg Fin.val h))).1) r₂ (Or.inr hr₂_R)] + exact hdist_new_other hr₂_R hr₂_sub ⟨m₁.1, hm₁⟩ (fun h => hmi₁ (congrArg Fin.val h)) + · have hm₂ : m₂.1 < k := by omega + by_cases hmi₂ : m₂.1 = i.1 + · simp only [r', hm₁, hmi₂, i.isLt, ↓reduceDIte, ↓reduceIte] + rw [hd'_symm r₂ (Or.inr hr₂_R) r₁ (Or.inr hr₁_R)] + exact hdist_r₁r₂_θ' + · simp only [r', hm₁, hm₂, hmi₂, ↓reduceDIte, ↓reduceIte] + exact hdist_new_other hr₂_R hr₂_sub ⟨m₂.1, hm₂⟩ (fun h => hmi₂ (congrArg Fin.val h)) + have hr'_inj : Injective r' := by + intro m₁ m₂ hEq + by_contra hm_ne + have hge := hr'_dist m₁ m₂ hm_ne + rw [hEq, hd'_refl (r' m₂) (Or.inr (hr'_eye m₂).1)] at hge + omega + exact theorem_7_1_proof G H' η' θ_star θ₁ θ' lam' μ (k + 1) T_star T' d' + hFlat' hM' (by omega) hθ'_ge (by omega) (by omega) ⟨r', hr'_inj, hr'_eye, hr'_dist⟩ + +/-- Graph Minors XV, (7.11), page 143: use the established (3.4) in the transaction argument. -/ +theorem theorem_7_11_proof : GM15Theorem711Statement.{u, v, w} := by + intro S _ _ α β G H η θ_star θ θ' lam lam' π beta μ τ₂ k T_star T d r + S₀ α₀_disc α₀_pt i D_i P X + hFlat hMetric hμ2 hlam'4 hθ'_ge hθ'_even hτ₂_eq hlam_ge hbeta_ge hθ_ge + hr_inj hr_eye hr_dist hTransP hPathsP hX_sub hEndsP hFreeX hCardτ₂ hDouble + have hS : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + obtain ⟨_, hd_refl, hd_le_θ, hd_symm, hd_tri, hd_inc⟩ := + gm11_theorem_9_1 H θ T d hS hConn hMetric + rcases hDouble with ⟨A_f, B_f, _, p, _, P_idx, a_idx, b_idx, hP_inj, hP_range, hEnds_idx, hcw⟩ + have hp_eq : p = τ₂ := by + rw [← hCardτ₂, ← hP_range, Set.ncard_range_of_injective hP_inj, Nat.card_fin] + subst p + have hτ₂_ge12 : 12 ≤ τ₂ := by omega + obtain ⟨inv_v, hinv_v, hNat⟩ := D_i.soc_Λ_natural + have hinv_mem_X : ∀ x ∈ D_i.clearedSociety.transactionEnds P, + inv_v x ∈ X ∧ D_i.clearedEmbedding.vMap (inv_v x) = x := by + intro x hx + have hx_img : x ∈ D_i.clearedEmbedding.vMap '' X := hEndsP ▸ hx + obtain ⟨y, hyX, hyx⟩ := hx_img + rcases hx with ⟨P₀, hP₀, z, hPath⟩ + obtain ⟨hinv_mem, hinv_eq⟩ := hinv_v x hPath.2.2.1 + have hy_eq : inv_v x = y := + D_i.clearedEmbedding.bijOn_v.injOn hinv_mem.1 (hX_sub hyX).1 (hinv_eq.trans hyx.symm) + exact ⟨hy_eq ▸ hyX, hinv_eq⟩ + obtain ⟨w_α, hNodup_w, hOrder_w, hw_α_ab, hw_α_lt, hw_α_m2, hw_α_m1, + hw_α_mid, hw_α_last4, hw_α_last3, hw_α_last2, hw_α_last1⟩ := + exists_doublecross_rotated_seq hτ₂_ge12 a_idx b_idx hinv_v hNat hcw + let w : Fin (2 * τ₂) → S := inv_v ∘ w_α + have hw_α_ends : ∀ m : Fin (2 * τ₂), w_α m ∈ D_i.clearedSociety.transactionEnds P := by + intro m + rcases hw_α_ab m with ⟨idx, hEq⟩ | ⟨idx, hEq⟩ + · rw [hEq] + exact ⟨P_idx idx, hP_range ▸ mem_range_self idx, b_idx idx, (hEnds_idx idx).2.2⟩ + · rw [hEq] + have hP_idx := (hEnds_idx idx).2.2 + exact ⟨P_idx idx, hP_range ▸ mem_range_self idx, a_idx idx, + ⟨hP_idx.1.symm, hP_idx.2.1.symm, hP_idx.2.2.2, hP_idx.2.2.1⟩⟩ + have hw_mem : ∀ m : Fin (2 * τ₂), w m ∈ (clearedSubdrawing H D_i.Λ).V ∩ subBd D_i.Λ := + fun m => hX_sub (hinv_mem_X (w_α m) (hw_α_ends m)).1 + have hw_vMap : ∀ m : Fin (2 * τ₂), D_i.clearedEmbedding.vMap (w m) = w_α m := + fun m => (hinv_mem_X (w_α m) (hw_α_ends m)).2 + -- Now set up the `2 * k_34` vertices `v_34` and `k_34 - 1` paths `P_sub` for (3.4) with `k_34 = + -- τ₂ - 3`. + let k_34 : ℕ := τ₂ - 3 + have hk_34_ge : 3 ≤ k_34 := by omega + let f_34 : Fin (2 * k_34) → Fin (2 * τ₂) := fun j => + if hj1 : j.1 < k_34 then ⟨j.1, by omega⟩ + else if hj2 : j.1 < 2 * k_34 - 1 then ⟨j.1 + 3, by omega⟩ + else ⟨2 * τ₂ - 4, by omega⟩ + have hf_34_mono : StrictMono f_34 := by + intro j₁ j₂ hj + change (f_34 j₁).1 < (f_34 j₂).1 + dsimp only [f_34] + split_ifs <;> dsimp <;> omega + let v_34 : Fin (2 * k_34) → S := w ∘ f_34 + have hNodup_v34 : (List.ofFn v_34).Nodup := by + rw [List.nodup_ofFn] + exact (List.nodup_ofFn.mp hNodup_w).comp hf_34_mono.injective + have hOrder_v34 : GM12.IsListedInOrderOn (subBd D_i.Λ) (List.ofFn v_34) := + isListedInOrderOn_of_strictMono (by omega) hf_34_mono hOrder_w + have hv34_mem : ∀ j : Fin (2 * k_34), v_34 j ∈ (clearedSubdrawing H D_i.Λ).V ∩ subBd D_i.Λ := + fun j => hw_mem (f_34 j) + have hv34_free : IsFreeSet (clearedSubdrawing H D_i.Λ).toHypergraph D_i.T₁ + (θ - 4 * (3 * beta + 3) - 2) (range v_34) := by + refine hFreeX.subset D_i.isCleared.hasMetric.1.2.1 ?_ + rintro _ ⟨j, rfl⟩ + exact (hinv_mem_X (w_α (f_34 j)) (hw_α_ends (f_34 j))).1 + let P_sub : Fin (k_34 - 1) → Graph α β := fun j => P_idx ⟨τ₂ - 3 - j.1, by omega⟩ + have hP_sub_paths : ∀ j : Fin (k_34 - 1), ∃ i₁ i₂ : Fin (2 * k_34), + i₁.1 = j.1 ∧ i₂.1 = 2 * k_34 - 2 - j.1 ∧ + IsHPathWithEnds G D_i.clearedEmbedding.imageGraph (P_sub j) + (D_i.clearedEmbedding.vMap (v_34 i₁)) (D_i.clearedEmbedding.vMap (v_34 i₂)) := by + intro j + let i₁ : Fin (2 * k_34) := ⟨j.1, by omega⟩ + let i₂ : Fin (2 * k_34) := ⟨2 * k_34 - 2 - j.1, by omega⟩ + refine ⟨i₁, i₂, rfl, rfl, ?_⟩ + change IsHPathWithEnds G D_i.clearedEmbedding.imageGraph (P_sub j) + (D_i.clearedEmbedding.vMap (w (f_34 i₁))) (D_i.clearedEmbedding.vMap (w (f_34 i₂))) + rw [hw_vMap (f_34 i₁), hw_vMap (f_34 i₂)] + have hf_i₁ : f_34 i₁ = ⟨j.1, by omega⟩ := by + dsimp only [f_34, i₁]; rw [dite_eq_left (by omega)] + have hf_i₂ : f_34 i₂ = ⟨2 * k_34 - 2 - j.1 + 3, by omega⟩ := by + dsimp only [f_34, i₂]; rw [dite_eq_right (by omega), dite_eq_left (by omega)] + have hi₁_eq : w_α (f_34 i₁) = a_idx ⟨τ₂ - 3 - j.1, by omega⟩ := by + rw [hf_i₁, hw_α_lt ⟨j.1, by omega⟩ (by dsimp; omega)] + have hi₂_eq : w_α (f_34 i₂) = b_idx ⟨τ₂ - 3 - j.1, by omega⟩ := by + rw [hf_i₂, hw_α_mid ⟨2 * k_34 - 2 - j.1 + 3, by omega⟩ (by dsimp; omega) (by dsimp; omega)] + congr 1; ext; dsimp; omega + rw [hi₁_eq, hi₂_eq] + exact hPathsP (P_sub j) (hP_range ▸ mem_range_self _) _ _ (hEnds_idx _).2.2 + have hP_sub_disj : Pairwise (fun j₁ j₂ => Disjoint V(P_sub j₁) V(P_sub j₂)) := by + intro j₁ j₂ hj + rcases hTransP with ⟨_, _, ⟨_, hDisjP⟩, _, _⟩ + refine hDisjP (hP_range ▸ mem_range_self _) (hP_range ▸ mem_range_self _) (fun hEq => hj ?_) + have hidx := congrArg Fin.val (hP_inj hEq) + dsimp only at hidx + ext; omega + let i_k : Fin (2 * k_34) := ⟨k_34 - 1, by omega⟩ + let i_last : Fin (2 * k_34) := ⟨2 * k_34 - 1, by omega⟩ + have hEq_θ₁ : θ - 4 * (3 * beta + 3) - 2 = θ - (4 * (3 * beta + 3) + 2) := by omega + have hSpan_Λ : IsSigmaSpan G (clearedSubdrawing H D_i.Λ) D_i.clearedEmbedding θ_star + (θ - 4 * (3 * beta + 3) - 2) T_star D_i.T₁ := hEq_θ₁ ▸ D_i.isRearranged.isSpan' + have hM_Λ : HasTangleMetric (clearedSubdrawing H D_i.Λ) + (θ - 4 * (3 * beta + 3) - 2) D_i.T₁ D_i.d₁ := + hEq_θ₁ ▸ D_i.isRearranged.isCompression.hasMetric' + obtain ⟨H', η', T', d', r₁, r₂, hSpan', hM', hr₁_R, hr₂_R, hr₁_sub, hr₂_sub, _, + hU_diff, hSub, hvMap, heMap, hImg, hInd, _, hOArc_r₁, hOArc_r₂, hCirc_r₁, hCirc_r₂, + _, _, hOrd_r₁, hOrd_r₂, hdist_r₁r₂, _⟩ := + GraphMinor.GM15.theorem_3_4_drawn.{u, v, w} G (clearedSubdrawing H D_i.Λ) D_i.clearedEmbedding + θ_star + (θ - 4 * (3 * beta + 3) - 2) k_34 + T_star D_i.T₁ D_i.d₁ D_i.Λ v_34 P_sub i_k i_last + hSpan_Λ hM_Λ D_i.mem_R_cleared D_i.isZone.isOArc_bd D_i.isCircuit_bd + hk_34_ge hNodup_v34 hOrder_v34 hv34_mem hv34_free hP_sub_paths hP_sub_disj rfl rfl + rw [hEq_θ₁] at hSpan' hM' hInd + -- Claim (1): `H', η', T'` is obtained from `H, η, T` by rearranging within `3 * beta + 3` of `r + -- i`, + -- and `d' r₁ r₂ ≥ θ'`. + have hRearr' : IsRearrangedWithin G H H' η η' θ_star θ (3 * beta + 3) T_star T T' d d' (r i) := + isRearrangedWithin_of_cleared_extension D_i hSpan' hM' hU_diff hSub hvMap heMap hInd + (by omega) + have hdist_r₁r₂_θ' : θ' ≤ d' r₁ r₂ := by + change 2 * (τ₂ - 3) - 6 ≤ d' r₁ r₂ at hdist_r₁r₂ + have h2 : 2 * (θ' / 2) = θ' := Nat.mul_div_cancel' (even_iff_two_dvd.mp hθ'_even) + omega + have hSub_le_mem : ∀ Q ∈ range P_sub, Q ≤ G := by + rintro _ ⟨j, rfl⟩ + exact (hP_sub_paths j).choose_spec.choose_spec.2.2.2.1.le + -- Claim (2): `r₁` and `r₂` are eyes of `G, H', η', θ₁, T'`. + let θ₁ := θ - (4 * (3 * beta + 3) + 2) + have hT₁_tangle : IsTangle (clearedSubdrawing H D_i.Λ).toHypergraph θ₁ D_i.T₁ := by + change IsTangle _ (θ - (4 * (3 * beta + 3) + 2)) _ + rw [← hEq_θ₁] + exact D_i.isCleared.hasMetric.1.2.1 + have hFreeX_θ₁ : IsFreeSet (clearedSubdrawing H D_i.Λ).toHypergraph D_i.T₁ θ₁ X := by + change IsFreeSet _ _ (θ - (4 * (3 * beta + 3) + 2)) _ + rw [← hEq_θ₁] + exact hFreeX + have hFreeX_T' : IsFreeSet H'.toHypergraph T' θ₁ X := + isFreeSet_inducedTangle_of_isFreeSet hSub hT₁_tangle hInd (by omega) hFreeX_θ₁ + have hcl_bd_r₁ : IsClosed (subBd r₁) := isClosed_closure.inter isClosed_closure + have hcl_bd_r₂ : IsClosed (subBd r₂) := isClosed_closure.inter isClosed_closure + have hr₁_eye : IsDrawingEye G H' η' θ₁ T' r₁ := by + exact first_split_region_is_eye (S := S) (α := α) (β := β) G H η θ_star θ θ' π beta μ + τ₂ k T_star T d r S₀ α₀_disc α₀_pt i D_i P X hτ₂_eq hTransP + hPathsP hCardτ₂ A_f B_f P_idx a_idx b_idx hP_inj hP_range hEnds_idx hτ₂_ge12 inv_v + hinv_mem_X w_α hNodup_w hOrder_w hw_α_lt hw_α_m2 hw_α_m1 hw_α_ends hw_mem hw_vMap + hk_34_ge H' η' T' d' r₁ hM' hr₁_R hvMap hImg hOArc_r₁ hCirc_r₁ hOrd_r₁ + hSub_le_mem hFreeX_T' hcl_bd_r₁ + have hr₂_eye : IsDrawingEye G H' η' θ₁ T' r₂ := by + exact last_split_region_is_eye (S := S) (α := α) (β := β) G H η θ_star θ θ' π beta μ + τ₂ k T_star T d r S₀ α₀_disc α₀_pt i D_i P X hτ₂_eq hTransP + hPathsP hCardτ₂ A_f B_f P_idx a_idx b_idx hP_inj hP_range hEnds_idx hτ₂_ge12 inv_v + hinv_mem_X w_α hNodup_w hOrder_w hw_α_last4 hw_α_last3 hw_α_last2 hw_α_last1 hw_α_ends + hw_mem hw_vMap hk_34_ge H' η' T' d' r₂ hM' hr₂_R hvMap hImg hOArc_r₂ + hCirc_r₂ hOrd_r₂ hSub_le_mem hFreeX_T' hcl_bd_r₂ + -- Claims (3) and (4): for `j ≠ i`, `r j` is an eye of `G, H', η', θ₁, T'`. + have hFlat_beta : IsFlatSpan G H η θ_star θ (3 * beta + 3) μ T_star T := by + have hTrunc_eq : GM10.truncation T θ = T := by + ext ⟨A, B⟩ + exact ⟨fun h => h.1, fun h => ⟨h, hFlat.isSpan.isControlling.isTangle_H.order_lt h⟩⟩ + have hord := hFlat.order_ge + have h := theorem_5_1_proof G H η θ_star θ θ lam (3 * beta + 3) μ μ T_star T + hFlat (by omega) le_rfl (by omega) le_rfl (by omega) (fun _ => by omega) (by omega) + rwa [hTrunc_eq] at h + have hSub_cleared : (clearedSubdrawing H D_i.Λ).IsSubdrawing H := + clearedSubdrawing_isSubdrawing H D_i.Λ + have hImg_sub_V : V(D_i.clearedEmbedding.imageGraph) ⊆ V(η.imageGraph) := by + rw [← D_i.clearedEmbedding.bijOn_v.image_eq, ← η.bijOn_v.image_eq] + rintro _ ⟨x, hx₁, rfl⟩ + exact ⟨x, hSub_cleared.1 hx₁, (D_i.vMap_eq x hx₁).symm⟩ + have hImg_sub_E : E(D_i.clearedEmbedding.imageGraph) ⊆ E(η.imageGraph) := by + rw [← D_i.clearedEmbedding.bijOn_e.image_eq, ← η.bijOn_e.image_eq] + rintro _ ⟨e, he₁, rfl⟩ + exact ⟨e, hSub_cleared.2 he₁, (D_i.eMap_eq e he₁).symm⟩ + have hE_ne : H.E.Nonempty := edges_nonempty_of_tangle hS hMetric.1 (by omega) + have hr_other_eye : ∀ j : Fin k, j ≠ i → IsDrawingEye G H' η' θ₁ T' (r j) := by + exact other_eye_survives_split (S := S) (α := α) (β := β) G H η θ_star θ θ' lam' π beta μ + τ₂ k T_star T d r S₀ α₀_disc α₀_pt i D_i P hMetric hμ2 hlam'4 hθ'_ge hτ₂_eq hbeta_ge hθ_ge + hr_eye hr_dist hCardτ₂ hS hd_symm hd_tri hd_inc hτ₂_ge12 hk_34_ge v_34 + hv34_mem P_sub hP_sub_paths H' η' T' d' hSub hvMap hImg hInd hRearr' hSub_le_mem + hT₁_tangle hFlat_beta hSub_cleared hImg_sub_V hImg_sub_E hE_ne + -- Claims (5) and (6): distances in `d'` between `r₁, r₂` and `r j` (`j ≠ i`), and between + -- `r j₁, r j₂` (`j₁ ≠ j₂`, `j₁, j₂ ≠ i`), are all `≥ θ'`. + have finished_eyes : Section7S1 S G θ_star T_star k μ lam' θ' := by + exact section7S1_of_split_eyes (S := S) (α := α) (β := β) G H η θ_star θ θ' lam lam' π beta μ + τ₂ k T_star T d r S₀ α₀_disc α₀_pt i D_i P hFlat hMetric hμ2 hlam'4 hθ'_ge hτ₂_eq hlam_ge + hbeta_ge hθ_ge hr_eye hr_dist hCardτ₂ hS hd_tri hτ₂_ge12 hk_34_ge H' η' T' d' + r₁ r₂ hM' hr₁_R hr₂_R hr₁_sub hr₂_sub hRearr' hdist_r₁r₂_θ' hr₁_eye hr₂_eye hSub_cleared + hr_other_eye + exact finished_eyes + +/-- **Graph Minors XV, (7.11)** (pages 143–145): +"If $\mathscr{P}$ is a doublecross transaction of cardinality $\tau_2$ then (S1) holds." +Proved from `(3.4)`, `(4.7)`, `(5.1)`, `(5.2)`, and `(7.1)`. -/ +theorem Section7.theorem_7_11_proof + : + GM15Theorem711Statement.{u, v, w} := by + have h34 : GM15Theorem34Statement.{u, v, w} := theorem_3_4_proof + intro S _ _ α β G H η θ_star θ θ' lam lam' π beta μ τ₂ k T_star T d r S₀ α₀_disc α₀_pt i D_i P X + exact _root_.GraphMinor.GM15.theorem_7_11_proof + G H η θ_star θ θ' lam lam' π beta μ τ₂ k T_star T d r S₀ α₀_disc α₀_pt i D_i P X + +/-! ## Proof of Graph Minors XV, (1.2) -/ + +/-- Helper lemma: the canonical embedding of `H` into `G₀ = η(H) ∪ J₀` agrees with `η` and is not +`μ`-stepped when `(H, η, T)` is `(λ, μ)`-flat and `1 ≤ μ` +(Graph Minors XV, Section 7, proof of (7.4), page 137). -/ +theorem exists_section7G0_embedding + {S : Type w} [TopologicalSpace S] [T2Space S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ θ' lam μ k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin k → Set S) + (hFlat : IsFlatSpan G H η θ_star θ lam μ T_star T) + (hMetric : HasTangleMetric H θ T d) + (hμ1 : 1 ≤ μ) : + ∃ η₀ : SpanEmbedding H (section7G0 G H η d θ' μ r), + (∀ v ∈ H.V, η₀.vMap v = η.vMap v) ∧ + (∀ e ∈ H.E, η₀.eMap e = η.eMap e) ∧ + ¬ IsMuSteppedSpan (section7G0 G H η d θ' μ r) H η₀ d μ := by + have hPair_le := section7G0_members_le G H η d θ' μ r + have hG0_le : section7G0 G H η d θ' μ r ≤ G := section7G0_le G H η d θ' μ r + have hImg_le : η.imageGraph ≤ section7G0 G H η d θ' μ r := + le_subgraphSUnion hPair_le (mem_insert _ _) + let η₀ : SpanEmbedding H (section7G0 G H η d θ' μ r) := + { imageGraph := η.imageGraph + vMap := η.vMap + eMap := η.eMap + imageGraph_le := hImg_le + bijOn_v := η.bijOn_v + bijOn_e := η.bijOn_e + inc_iff := η.inc_iff } + refine ⟨η₀, fun _ _ => rfl, fun _ _ => rfl, ?_⟩ + rintro ⟨P, u, v, hu, hv, ⟨_, hP_path, hne, ha, hb, hVP, hEP⟩, hdist⟩ + have hP_G : IsGraphPathWithEnds G P (η.vMap u) (η.vMap v) := + ⟨hP_path.1.trans hG0_le, hP_path.2⟩ + have hStepG : IsMuSteppedSpan G H η d μ := + ⟨P, u, v, hu, hv, ⟨η.imageGraph_le, hP_G, hne, ha, hb, hVP, hEP⟩, hdist⟩ + exact not_isMuSteppedSpan_of_isFlatSpan hFlat hMetric (by have := hFlat.order_ge; omega) hStepG + +/-- Statement of Graph Minors XV, (1.2) (pages 115–116): +"For any surface $\Sigma$ with $bd(\Sigma) = \emptyset$, and any integers $k \ge 0$, $\phi \ge 8$, +$\mu \ge 12$ and even, $\lambda_{k+1} \ge 4$, and $\theta_{k+1} \ge 4\lambda_{k+1} + \mu + 2$, +there are integers $\rho_k, \lambda_k \ge 0$ and $\theta_k \ge 4\lambda_k + \mu + 2$ such that the +following holds. Let $\mathscr{T}^*$ be a tangle in a graph $G$, and suppose that there is a +$(\lambda_k, \mu)$-flat $\Sigma$-span of order $\ge \theta_k$ with $k$ eyes mutually at distance +$\ge \theta_k$. Then either +(i) there is a $(\lambda_{k+1}, \mu)$-flat $\Sigma$-span of order $\theta_{k+1}$ with $k+1$ eyes, +mutually at distance $\theta_{k+1}$, or ... +(ii) there is a $\Sigma'$-span of order $\phi$, where $\Sigma'$ is a surface obtained by adding a +crosscap to $\Sigma$, or +(iii) there is a $\mathscr{T}^*$-central segregation of $G$ of type $(\rho_k, k)$ with an +arrangement in $\Sigma$." -/ +def GM15Theorem12Statement : Prop := + ∀ (S : Type w) [TopologicalSpace S] [T2Space S], + IsSurface S → ConnectedSpace S → bd S = ∅ → + ∀ (k φ μ lam_next θ_next : ℕ), + 8 ≤ φ → 12 ≤ μ → Even μ → 4 ≤ lam_next → + 4 * lam_next + μ + 2 ≤ θ_next → + ∃ (p_k lam_k θ_k : ℕ), + 4 * lam_k + μ + 2 ≤ θ_k ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H₀ : Drawing S) (η₀ : SpanEmbedding H₀ G) (θ₀ : ℕ) + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ), + IsFlatSpan G H₀ η₀ θ_star θ₀ lam_k μ T_star T₀ → + HasTangleMetric H₀ θ₀ T₀ d₀ → + θ_k ≤ θ₀ → + HasEyesAtDistance G H₀ η₀ θ₀ T₀ d₀ k θ_k → + Section7S1 S G θ_star T_star k μ lam_next θ_next ∨ + Section7S2 S G θ_star T_star φ ∨ + Section7S3 S G T_star p_k k + +/-- The eye induction step of XV (1.2) retains the proper arrangement from XV (7.7), +as required in XVI (7.2), page 62. -/ +theorem theorem_1_2_proper : + ∀ (S : Type w) [TopologicalSpace S] [T2Space S], + IsSurface S → ConnectedSpace S → bd S = ∅ → + ∀ (k φ μ lam_next θ_next : ℕ), + 8 ≤ φ → 12 ≤ μ → Even μ → 4 ≤ lam_next → + 4 * lam_next + μ + 2 ≤ θ_next → + ∃ (p_k lam_k θ_k : ℕ), + 4 * lam_k + μ + 2 ≤ θ_k ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H₀ : Drawing S) (η₀ : SpanEmbedding H₀ G) (θ₀ : ℕ) + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ), + IsFlatSpan G H₀ η₀ θ_star θ₀ lam_k μ T_star T₀ → + HasTangleMetric H₀ θ₀ T₀ d₀ → + θ_k ≤ θ₀ → + HasEyesAtDistance G H₀ η₀ θ₀ T₀ d₀ k θ_k → + Section7S1 S G θ_star T_star k μ lam_next θ_next ∨ + Section7S2 S G θ_star T_star φ ∨ + Section7ProperS3 S G T_star p_k k := by + have h71 : GM15Theorem71Statement.{u, v, w} := + theorem_7_1_proof + have h75 : GM15Theorem75Statement.{u, v, w} := + theorem_7_5_proof + have h79 : GM15Theorem79Statement.{u, v, w} := Section7.theorem_7_9_proof + have h710 : GM15Theorem710Statement.{u, v, w} := + Section7.theorem_7_10_proof + have h711 : GM15Theorem711Statement.{u, v, w} := + Section7.theorem_7_11_proof + intro S _ _ _ _ _ k φ μ lam' θ' hφ8 hμ12 hμ_even hlam'4 hθ'_ge + let θ'' := (eyeInductionParameters φ μ θ').enlargedOrder + let τ₁ := (eyeInductionParameters φ μ θ').firstThreshold + let τ₂ := (eyeInductionParameters φ μ θ').secondThreshold + let π := (eyeInductionParameters φ μ θ').transactionSize + let beta := (eyeInductionParameters φ μ θ').battlefieldSize + let θ_k := (eyeInductionParameters φ μ θ').order + let lam_k := (eyeInductionParameters φ μ θ').flatness + let p_k := (eyeInductionParameters φ μ θ').segregationWidth + rcases eye_induction_parameter_bounds hφ8 hμ12 hlam'4 hθ'_ge with + ⟨hθ''_even, hθ'_le_θ'', h4_θ', h4_θ_k, hθ''_ge, hθ''_gt, hφ2, hφ3, hτ₁_ge, hτ₂_ge, + hπ2, hπ3, hθ_k_ge, hlam_bound_μ, hθ_bound_μ, hθ''_beta, h16beta, h6beta, + hφ_le, hbeta_lam, h2τ₁_lt, hlam_bound_beta⟩ + refine ⟨p_k, lam_k, θ_k, hθ_k_ge, ?_⟩ + intro α β G θ_star T_star H₀ η₀ θ₀ T₀ d₀ hFlat₀ hMetric₀ hθ₀_ge hEyes₀ + -- Step 1: Apply (7.1) to obtain a `(lam_k, μ)`-flat `Σ`-span `H, η, T` of order `θ_k` with `k` + -- eyes `r` mutually at distance `θ_k`. + obtain ⟨H, η, T, d, r, hFlat, hMetric, hr_inj, hr_eye, hr_dist⟩ := + h71 G H₀ η₀ θ_star θ₀ θ_k lam_k μ k T_star T₀ d₀ hFlat₀ hMetric₀ + (by omega) hθ_k_ge h4_θ_k hθ₀_ge hEyes₀ + -- Step 2: Check whether `(S1)` holds for `θ''` (which implies `(S1)` for `θ'` by (7.1)). + by_cases hS1_θ'' : Section7S1 S G θ_star T_star k μ lam' θ'' + · left + rcases hS1_θ'' with ⟨H₁, η₁, T₁, d₁, r₁, hFlat₁, hMetric₁, hr₁_inj, hr₁_eye, hr₁_dist⟩ + have hEyes_θ' : HasEyesAtDistance G H₁ η₁ θ'' T₁ d₁ (k + 1) θ' := + ⟨r₁, hr₁_inj, hr₁_eye, fun i j hij => + hθ'_le_θ''.trans (le_of_eq (hr₁_dist i j hij).symm)⟩ + exact h71 G H₁ η₁ θ_star θ'' θ' lam' μ (k + 1) T_star T₁ d₁ hFlat₁ hMetric₁ + (by omega) hθ'_ge h4_θ' hθ'_le_θ'' hEyes_θ' + · -- Step 3: Since `(S1)` does not hold for `θ''`, apply (7.4) to obtain `S₀, α₀`. + obtain ⟨η_G0, hη_G0_v, hη_G0_e, hnot_step_G0⟩ := + exists_section7G0_embedding G H η θ_star θ_k θ'' lam_k μ k T_star T d r hFlat hMetric + (by omega) + obtain ⟨S₀, α₀_disc, α₀_pt, hThree, hLocal, hArr₀, hCompat₀⟩ := + theorem_7_4_proof G H η + θ_star θ_k θ'' lam_k lam' μ k T_star T d r η_G0 + hFlat hMetric hμ12 hμ_even hlam'4 hθ''_ge hθ''_gt hlam_bound_μ hθ_bound_μ + hr_inj hr_eye hr_dist hη_G0_v hη_G0_e hnot_step_G0 hS1_θ'' + -- Step 4: Apply (7.5) to obtain the eye data `D i` for `i : Fin k`. + obtain ⟨D, hDisj_Δ⟩ := + h75 G H η θ_star θ_k θ'' lam_k π beta μ k T_star T d r η_G0 S₀ α₀_disc α₀_pt + hFlat hMetric (by omega) hπ2 hπ3 rfl hθ''_beta h16beta h6beta + hr_inj hr_eye hr_dist hη_G0_v hη_G0_e hThree hLocal hArr₀ hCompat₀ + -- Step 5: Either no `(G_i*, Ω_i*)` has a crooked transaction of size `π`, or some `i` does. + by_cases hAllNoCrook : + ∀ i : Fin k, ∀ P_set : Set (Graph α β), + (D i).localSociety.IsCrookedTransaction P_set → P_set.ncard ≠ π + · -- By (7.7), `(S3)` holds. + right; right + obtain ⟨𝒮, disc, pt, hCentral, hType, hArr, hDisjoint⟩ := + assemble_eye_arrangement G H η θ_star θ_k θ'' lam_k π beta μ k T_star T d r + η_G0 S₀ α₀_disc α₀_pt D hFlat hMetric (by omega) hπ2 hπ3 rfl hθ''_beta le_rfl + hr_inj hr_eye hr_dist hη_G0_v hη_G0_e hThree hLocal hArr₀ hCompat₀ hDisj_Δ hAllNoCrook + exact ⟨𝒮, disc, pt, hCentral, hType, + GM16.IsSurfaceArrangement.isProper_of_disjoint_boundaries hArr hDisjoint⟩ + · -- Some `i : Fin k` has a crooked transaction `P_star` of cardinality `π`. + push Not at hAllNoCrook + rcases hAllNoCrook with ⟨i, P_star, hCrook_star, hCard_star⟩ + -- By (7.8), obtain `P, X` in `(G₀ ∪ J_i, Ω_i)`. + obtain ⟨P, X, hTransP, hPathsP, hX_sub, hEndsP, hFreeX, hCases⟩ := + theorem_7_8_proof G H η θ_star θ_k θ'' π beta μ φ τ₁ τ₂ k T_star T d r + S₀ α₀_disc α₀_pt i (D i) P_star hφ2 hτ₁_ge hτ₂_ge le_rfl hCrook_star hCard_star + rcases hCases with ⟨hCardφ, hCross⟩ | ⟨hCardτ₁, hLeap⟩ | ⟨hCardτ₂, hDouble⟩ + · -- Case (i): `P` is a crosscap transaction of size `φ`; by (7.9), `(S2)` holds. + right; left + exact h79 G H η θ_star θ_k θ'' π beta μ φ k T_star T d r S₀ α₀_disc α₀_pt i (D i) P X + hφ3 hφ_le hTransP hPathsP hX_sub hEndsP hFreeX hCardφ hCross + · -- Case (ii): `P` is a leap transaction of size `τ₁`; impossible by (7.10). + exfalso + exact h710 G H η θ_star θ_k θ'' lam_k π beta μ τ₁ k T_star T d r + S₀ α₀_disc α₀_pt i (D i) P X hFlat hμ12 hμ_even rfl hbeta_lam h2τ₁_lt + hTransP hPathsP hX_sub hEndsP hFreeX hCardτ₁ hLeap + · -- Case (iii): `P` is a doublecross transaction of size `τ₂`; by (7.11), `(S1)` holds for + -- `θ''`. + exfalso + exact hS1_θ'' (h711 G H η θ_star θ_k θ'' lam_k lam' π beta μ τ₂ k T_star T d r + S₀ α₀_disc α₀_pt i (D i) P X hFlat hMetric (by omega) hlam'4 hθ''_ge hθ''_even rfl + hlam_bound_beta hθ''_beta le_rfl hr_inj hr_eye hr_dist + hTransP hPathsP hX_sub hEndsP hFreeX hCardτ₂ hDouble) + +/-- **Graph Minors XV, (1.2)** (pages 115–116, proved in Section 7, pages 134–145): +For any connected surface `Σ` with `bd(Σ) = ∅` and any `k ≥ 0`, `φ ≥ 8`, `μ ≥ 12` even, +`λ_{k+1} ≥ 4`, and `θ_{k+1} ≥ 4λ_{k+1} + μ + 2`, there exist `p_k, λ_k, θ_k` with +`θ_k ≥ 4λ_k + μ + 2` such that every `(λ_k, μ)`-flat `Σ`-span of order `≥ θ_k` with `k` eyes at +distance `≥ θ_k` yields one of `(S1)`, `(S2)`, or `(S3)`. -/ +theorem theorem_1_2_proof + : + GM15Theorem12Statement.{u, v, w} := by + intro S _ _ hSurface hConnected hBoundary k φ μ lam θ hφ hμ hEven hlam hθ + obtain ⟨width, flatness, order, horder, hstep⟩ := + theorem_1_2_proper.{u,v,w} S hSurface hConnected hBoundary k φ μ lam θ hφ hμ hEven hlam hθ + refine ⟨width, flatness, order, horder, ?_⟩ + intro α β G θ_star T_star H η θ₀ T d hFlat hMetric hle hEyes + exact (hstep G θ_star T_star H η θ₀ T d hFlat hMetric hle hEyes).imp id + (Or.imp id Section7ProperS3.toSection7S3) + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM15/Section8.lean b/LeanPool/GraphMinor/GM15/Section8.lean new file mode 100644 index 0000000000..a2eb57c0c3 --- /dev/null +++ b/LeanPool/GraphMinor/GM15/Section8.lean @@ -0,0 +1,1114 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Section7 +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM10.GraphSubhypergraph +import LeanPool.GraphMinor.GM11.RadialExists +import LeanPool.GraphMinor.GM11.Section5b + +import LeanPool.GraphMinor.GM09.Bridge + +import LeanPool.GraphMinor.GM12.Bridge + +import LeanPool.GraphMinor.GM12.Section5Final + +import LeanPool.GraphMinor.GM12.Section6 + +import LeanPool.GraphMinor.GM12.Section710 + +import LeanPool.GraphMinor.GM12.Section77 + +import LeanPool.GraphMinor.GM14.Bridge + +import LeanPool.GraphMinor.GM15.Section5 + +/-! +# Graph Minors XV, Section 8: Some Mild Improvements and Main Theorem (1.1) + +This file formalizes the deduction of **Graph Minors XV, (1.1)** from **(1.2)** (Section 1, +pages 115–116) and Section 8 ("Some mild improvements", pages 145–148) of N. Robertson and P. D. +Seymour, *Graph Minors. XV. Giant steps*, J. Combin. Theory Ser. B 68 (1996) 112–148: +- **Monotonicity of segregations of type `(p, κ)` and controlled clique minors** + (`IsSegregationOfType.mono`, `ControlsCliqueMinor.mono`, `controlsCliqueMinor_of_gm12`). +- **Graph Minors XV, (1.1)** (`GM15Theorem11Statement`, `theorem_1_1`, pages 115–116): main theorem + of Graph Minors XV, proved by induction on `k` from `(1.2)` (`theorem_1_2`) and `(5.1)` + (`GM15Theorem51Statement`). +- **Graph Minors XV, (8.1)** (`GM15Theorem81Statement`, `theorem_8_1`, page 145): a `Σ`-span of + order `≥ φ` with `≥ κ` independent eyes implies `T*` controls a `K_p` minor of `G`, proved from + Graph Minors XII, `(4.5)` (`GM12Theorem45Statement`). +- **Graph Minors XV, (8.2)** (`GM15Theorem82Statement`, `theorem_8_2`, pages 145–146): clique-minor + form of `(1.1)`, proved from `(1.1)` (`theorem_1_1`) and `(8.1)` (`theorem_8_1`). +- **Graph Minors XV, (8.3)** (`GM15Theorem83Statement`, page 146) and Claim (1) of its proof + (`theorem_8_3_claim_1`, page 147): every `(λ + μ + 2, μ)`-level `Σ`-span is `(λ, μ)`-flat. +- **Graph Minors XV, (8.4)** (`GM15Theorem84Statement`, `theorem_8_4`, page 148): level-span form of + `(8.2)`, proved from `(8.2)` (`theorem_8_2`) and `(8.3)` (`GM15Theorem83Statement`). +-/ + +@[expose] public section + +namespace GraphMinor.GM15 + +open Set Function Topology +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM14 + +universe u v w + +variable {α : Type u} {β : Type v} + +/-! ## Helper Lemmas on Truncation, Segregations, and Controlled Clique Minors -/ + +/-- Truncating a tangle `T` of order `θ` to order `θ` leaves `T` unchanged. -/ +theorem truncation_self_of_isTangle {G_H : Hypergraph α β} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} (hT : GM10.IsTangle G_H θ T) : + GM10.truncation T θ = T := by + ext ⟨A, B⟩ + exact ⟨fun h => h.1, fun h => ⟨h, hT.order_lt h⟩⟩ + +/-- By `(5.1)` (`GM15Theorem51Statement`), if `H, η, T` is `(λ₁, μ₁)`-flat of order `θ`, +`λ₂ ≤ λ₁`, `μ₁ ≤ μ₂`, and `4λ₂ + μ₂ + 2 ≤ θ`, then `H, η, T` is `(λ₂, μ₂)`-flat of order `θ`. -/ +theorem IsFlatSpan.mono_lam_mu + {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ lam₁ lam₂ μ₁ μ₂ : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hFlat : IsFlatSpan G H η θ_star θ lam₁ μ₁ T_star T) + (hlam : lam₂ ≤ lam₁) (hμ : μ₁ ≤ μ₂) (hord : 4 * lam₂ + μ₂ + 2 ≤ θ) + (hθ_gt : lam₂ < lam₁ → 4 * lam₁ + 2 < θ) : + IsFlatSpan G H η θ_star θ lam₂ μ₂ T_star T := by + have h1 : 1 ≤ θ := by omega + have htr := GraphMinor.GM15.theorem_5_1_proof.{u, v, w} G H η θ_star θ θ lam₁ lam₂ μ₁ μ₂ T_star T + hFlat hlam hμ h1 le_rfl hord + hθ_gt (by omega) + rwa [truncation_self_of_isTangle hFlat.isSpan.isControlling.isTangle_H] at htr + +/-- Monotonicity of `IsSegregationOfType`: if `S_seg` is of type `(p₁, κ₁)` and `p₁ ≤ p₂`, +`κ₁ ≤ κ₂`, then `S_seg` is of type `(p₂, κ₂)` (Graph Minors XV, Section 1, page 116). -/ +theorem IsSegregationOfType.mono {G : Graph α β} {p₁ p₂ κ₁ κ₂ : ℕ} + {S_seg : Set (Society α β)} + (h : IsSegregationOfType G p₁ κ₁ S_seg) (hp : p₁ ≤ p₂) (hκ : κ₁ ≤ κ₂) : + IsSegregationOfType G p₂ κ₂ S_seg where + isSegregation := h.isSegregation + vortex_count_le := h.vortex_count_le.trans hκ + is_p_vortex _ hS₀ hgt _ hP := (h.is_p_vortex hS₀ hgt hP).trans hp + +/-- Monotonicity of `ControlsCliqueMinor`: if `T*` controls a `K_{p₂}` minor of `G` and `p₁ ≤ p₂`, +then `T*` controls a `K_{p₁}` minor of `G` (Graph Minors XV, Section 8, page 146). -/ +theorem ControlsCliqueMinor.mono {G : Graph α β} {p₁ p₂ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + (h : ControlsCliqueMinor G p₂ T_star) (hp : p₁ ≤ p₂) : + ControlsCliqueMinor G p₁ T_star := by + rcases h with ⟨X_sub, hconn, hdisj, hlink, hno_small⟩ + refine ⟨fun i => X_sub (Fin.castLE hp i), + fun i => hconn (Fin.castLE hp i), + fun i j hij => hdisj (Fin.castLE hp i) (Fin.castLE hp j) + (fun heq => hij ((Fin.castLE_injective hp) heq)), + fun i j hij => hlink (Fin.castLE hp i) (Fin.castLE hp j) hij, + fun A B hAB hord i => hno_small hAB (lt_of_lt_of_le hord hp) (Fin.castLE hp i)⟩ + +/-- `GM12.ControlsMinor` for `completeGraph p` implies `GM15.ControlsCliqueMinor`. -/ +theorem controlsCliqueMinor_of_gm12 {G : Graph α β} + {hV : V(G).Finite} {hE : E(G).Finite} {θ_star p : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + (h : GM12.ControlsMinor (Hypergraph.ofGraph G hV hE) θ_star T_star (completeGraph p)) : + ControlsCliqueMinor G p T_star := by + rcases h with ⟨a, b, ha_conn, ha_disj, hb_link, _, _, _, hno_small⟩ + let X_sub : Fin p → Graph α β := fun i => subgraphOfSubhypergraph G (a i) + have hcard : V(completeGraph p).ncard = p := by + change (Set.univ : Set (Fin p)).ncard = p + simp + refine ⟨X_sub, ?_, ?_, ?_, ?_⟩ + · intro i + obtain ⟨hle, hne, hconn⟩ := ha_conn i (mem_univ i) + refine ⟨subgraphOfSubhypergraph_le hle, hne, ⟨hne, fun u hu v hv => ?_⟩⟩ + have hVH : V(X_sub i).Finite := (a i).vertexSet_finite + have hEH : E(X_sub i).Finite := + (a i).edgeSet_finite.subset (by rw [edgeSet_subgraphOfSubhypergraph hle]) + have hof : Hypergraph.ofGraph (X_sub i) hVH hEH = a i := ofGraph_subgraphOfSubhypergraph hle + rw [← hof] at hconn + obtain ⟨w⟩ := hconn u hu v hv + exact reflTransGen_adj_of_skeleton_walk w + · intro i j hij + exact ha_disj i (mem_univ i) j (mem_univ j) hij + · intro i j hij + have hne : i ≠ j := ne_of_lt hij + obtain ⟨hbe, ⟨x, hx, hinc_x⟩, ⟨y, hy, hinc_y⟩⟩ := + hb_link s(i, j) i j ⟨hne, rfl⟩ hne + have hxy : x ≠ y := (ha_disj i (mem_univ i) j (mem_univ j) hne).ne_of_mem hx hy + exact ⟨b s(i, j), hbe, x, hx, y, hy, isLink_of_inc_of_inc_of_ne hinc_x hinc_y hxy⟩ + · intro A B hAB hord i + rw [← hcard] at hord + exact hno_small A B hAB hord i (mem_univ i) + +/-! ## Proof of Graph Minors XV, (1.1) from (1.2) -/ + +/-- If `u ∈ V(H) ∩ closure(r_i)` and `v ∈ V(H) ∩ closure(r_j)` for regions `r_i, r_j ∈ H.R` with +`d(r_i, r_j) = θ` and `μ + 2 ≤ θ`, then `μ ≤ d({u}, {v})` +(Graph Minors XV, Section 1, proof of (1.1), page 116: +"$$\mu+2 \le \theta_{\kappa+1} = d(r_i, r_j) \le d(u, r_i) + d(u, v) + d(v, r_j) \le d(u, v) + 2"). +-/ +theorem dist_ge_of_eye_bd_vertices + {S : Type w} [TopologicalSpace S] [T2Space S] + {H : Drawing S} {θ μ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {r_i r_j : Set S} {u v : S} + (hClosed : IsClosedSurface S) (hConn : ConnectedSpace S) + (hMetric : HasTangleMetric H θ T d) (hE : H.E.Nonempty) + (hri : r_i ∈ H.R) (hrj : r_j ∈ H.R) + (hu : u ∈ H.V ∧ u ∈ closure r_i) (hv : v ∈ H.V ∧ v ∈ closure r_j) + (hd : d r_i r_j = θ) (hθ : μ + 2 ≤ θ) : + μ ≤ d {u} {v} := by + obtain ⟨_, _, _, hsymm, htri, hadj, -⟩ := gm11_theorem_9_1 H θ T d hClosed hConn hMetric + have huA : {u} ∈ H.A := Or.inl (Or.inl ⟨u, hu.1, rfl⟩) + have hvA : {v} ∈ H.A := Or.inl (Or.inl ⟨v, hv.1, rfl⟩) + have hriA : r_i ∈ H.A := Or.inr hri + have hrjA : r_j ∈ H.A := Or.inr hrj + have h1 : d r_i {u} ≤ 1 := by + rw [hsymm r_i hriA {u} huA] + exact hadj hE u hu.1 r_i hri hu.2 + have h2 : d {v} r_j ≤ 1 := hadj hE v hv.1 r_j hrj hv.2 + have h3 : d r_i r_j ≤ d r_i {u} + d {u} r_j := htri r_i hriA {u} huA r_j hrjA + have h4 : d {u} r_j ≤ d {u} {v} + d {v} r_j := htri {u} huA {v} hvA r_j hrjA + omega + +/-- `IsHPathWithEnds` is symmetric in the two ends `a` and `b`. -/ +theorem _root_.GraphMinor.GM14.IsHPathWithEnds.symm {G H P : Graph α β} {a b : α} + (h : IsHPathWithEnds G H P a b) : IsHPathWithEnds G H P b a := + ⟨h.1, h.2.1.symm, h.2.2.1.symm, h.2.2.2.2.1, h.2.2.2.1, + by rw [h.2.2.2.2.2.1, Set.pair_comm], h.2.2.2.2.2.2⟩ + +/-- In a path `P` from `a` to `b` with `a ≠ b`, `a` is incident with some edge of `P`. -/ +theorem _root_.GraphMinor.GM09.IsGraphPathWithEnds.exists_inc_left {G P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) (hab : a ≠ b) : + ∃ e ∈ E(P), P.Inc e a := by + obtain ⟨_, W, _, _, _⟩ := hP + cases W with + | nil _ => exact False.elim (hab rfl) + | cons h _ => exact ⟨_, h.edge_mem, h.inc_left⟩ + +/-- In a path `P` from `a` to `b` with `a ≠ b`, `b` is incident with some edge of `P`. -/ +theorem _root_.GraphMinor.GM09.IsGraphPathWithEnds.exists_inc_right {G P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) (hab : a ≠ b) : + ∃ e ∈ E(P), P.Inc e b := + hP.symm.exists_inc_left hab.symm + +/-- In a `(4, μ)`-flat `Σ`-span `H, η, T` of order `θ ≥ μ + 18` with `μ ≥ 12`, any two `η(H)`-paths +`R₁` (with ends in `V(H) ∩ closure r₁`) and `R₂` (with ends in `V(H) ∩ closure r₂`) for regions +`r₁, r₂ ∈ H.R` with `d r₁ r₂ = θ` are vertex-disjoint +(Graph Minors XV, Section 1, proof of (1.1), page 116). -/ +private theorem disjoint_eye_paths_of_flatSpan + {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ μ : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {r₁ r₂ : Set S} {u₁ v₁ u₂ v₂ : S} {R₁ R₂ : Graph α β} + (hFlat : IsFlatSpan G H η θ_star θ 4 μ T_star T) + (hMetric : HasTangleMetric H θ T d) + (hμ : 12 ≤ μ) (hθ : μ + 18 ≤ θ) + (hr₁ : r₁ ∈ H.R) (hr₂ : r₂ ∈ H.R) (hd : d r₁ r₂ = θ) + (hu₁ : u₁ ∈ H.V ∧ u₁ ∈ closure r₁) (hv₁ : v₁ ∈ H.V ∧ v₁ ∈ closure r₁) + (hu₂ : u₂ ∈ H.V ∧ u₂ ∈ closure r₂) (hv₂ : v₂ ∈ H.V ∧ v₂ ∈ closure r₂) + (hR₁ : IsHPathWithEnds G η.imageGraph R₁ (η.vMap u₁) (η.vMap v₁)) + (hR₂ : IsHPathWithEnds G η.imageGraph R₂ (η.vMap u₂) (η.vMap v₂)) : + Disjoint V(R₁) V(R₂) := by + by_contra hnot + have hne : (V(R₁) ∩ V(R₂)).Nonempty := Set.not_disjoint_iff_nonempty_inter.mp hnot + have hClosed : IsClosedSurface S := + ⟨hFlat.isSpan.isSurface.1, hFlat.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hFlat.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hFlat.isSpan.isConnected + have hE : H.E.Nonempty := edges_nonempty_of_tangle hClosed hMetric.1 (by omega) + obtain ⟨_, hd_refl, _, _, _, _⟩ := gm11_theorem_9_1 H θ T d hClosed hConn hMetric + have hdist_ge : ∀ x ∈ ({u₁, v₁} : Set S), ∀ y ∈ ({u₂, v₂} : Set S), μ ≤ d {x} {y} := by + rintro x (rfl | rfl) y (rfl | rfl) + · exact dist_ge_of_eye_bd_vertices hClosed hConn hMetric hE hr₁ hr₂ hu₁ hu₂ hd (by omega) + · exact dist_ge_of_eye_bd_vertices hClosed hConn hMetric hE hr₁ hr₂ hu₁ hv₂ hd (by omega) + · exact dist_ge_of_eye_bd_vertices hClosed hConn hMetric hE hr₁ hr₂ hv₁ hu₂ hd (by omega) + · exact dist_ge_of_eye_bd_vertices hClosed hConn hMetric hE hr₁ hr₂ hv₁ hv₂ hd (by omega) + have hdisj_ends : Disjoint ({η.vMap u₁, η.vMap v₁} : Set α) {η.vMap u₂, η.vMap v₂} := by + refine Set.disjoint_left.mpr ?_ + rintro _ (rfl | rfl) (hEq | hEq) + · have hEq' : u₁ = u₂ := η.bijOn_v.injOn hu₁.1 hu₂.1 hEq + have hge := hdist_ge u₁ (Or.inl rfl) u₂ (Or.inl rfl) + rw [← hEq', hd_refl {u₁} (Or.inl (Or.inl ⟨u₁, hu₁.1, rfl⟩))] at hge + omega + · have hEq' : u₁ = v₂ := η.bijOn_v.injOn hu₁.1 hv₂.1 hEq + have hge := hdist_ge u₁ (Or.inl rfl) v₂ (Or.inr rfl) + rw [← hEq', hd_refl {u₁} (Or.inl (Or.inl ⟨u₁, hu₁.1, rfl⟩))] at hge + omega + · have hEq' : v₁ = u₂ := η.bijOn_v.injOn hv₁.1 hu₂.1 hEq + have hge := hdist_ge v₁ (Or.inr rfl) u₂ (Or.inl rfl) + rw [← hEq', hd_refl {v₁} (Or.inl (Or.inl ⟨v₁, hv₁.1, rfl⟩))] at hge + omega + · have hEq' : v₁ = v₂ := η.bijOn_v.injOn hv₁.1 hv₂.1 hEq + have hge := hdist_ge v₁ (Or.inr rfl) v₂ (Or.inr rfl) + rw [← hEq', hd_refl {v₁} (Or.inl (Or.inl ⟨v₁, hv₁.1, rfl⟩))] at hge + omega + obtain ⟨P, hP, _, _⟩ := exists_isHPathWithEnds_of_inter_nonempty hR₁ hR₂ hdisj_ends hne + exact not_isMuSteppedSpan_of_isFlatSpan hFlat hMetric (by omega) + ⟨P, u₁, v₂, hu₁.1, hv₂.1, hP, hdist_ge u₁ (Or.inl rfl) v₂ (Or.inr rfl)⟩ + +/-- Last step in the proof of (1.1) (Graph Minors XV, Section 1, page 116): +in a `(4, μ)`-flat `Σ`-span `H, η, T` of order `θ ≥ μ + 18` with `κ + 1` eyes `r_1, ..., r_{κ+1}` +mutually at distance `θ`, the eyes `r_1, ..., r_{κ+1}` are independent eyes. -/ +theorem independentEyes_of_flatSpan + {S : Type w} [TopologicalSpace S] [T2Space S] + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ μ κ : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin (κ + 1) → Set S) + (hFlat : IsFlatSpan G H η θ_star θ 4 μ T_star T) + (hMetric : HasTangleMetric H θ T d) + (hμ : 12 ≤ μ) (hθ : μ + 18 ≤ θ) + (hr_inj : Injective r) + (hr_eye : ∀ i : Fin (κ + 1), IsDrawingEye G H η θ T (r i)) + (hr_dist : ∀ i j : Fin (κ + 1), i ≠ j → d (r i) (r j) = θ) : + HasIndependentEyes G H η θ T d (κ + 1) := by + classical + have hex : ∀ i : Fin (κ + 1), ∃ P₁ P₂ : Graph α β, + IsEyeWithPaths G H η θ T (r i) P₁ P₂ ∧ + ∃ a b c d_v : S, + a ∈ H.V ∧ a ∈ closure (r i) ∧ + b ∈ H.V ∧ b ∈ closure (r i) ∧ + c ∈ H.V ∧ c ∈ closure (r i) ∧ + d_v ∈ H.V ∧ d_v ∈ closure (r i) ∧ + IsHPathWithEnds G η.imageGraph P₁ (η.vMap a) (η.vMap c) ∧ + IsHPathWithEnds G η.imageGraph P₂ (η.vMap b) (η.vMap d_v) := by + intro i + obtain ⟨hri, C, a, b, c, d_v, P₁, P₂, hC, hCH, hCU, haC, hbC, hcC, hdC, + hnd, hord, hfree, hdisj, hP₁, hP₂⟩ := hr_eye i + have hsub_cl : C.V ⊆ closure (r i) := by + intro x hx + have hxU : x ∈ C.U := C.V_subset_U hx + rw [hCU] at hxU + exact hxU.1 + refine ⟨P₁, P₂, + ⟨hri, C, a, b, c, d_v, hC, hCH, hCU, haC, hbC, hcC, hdC, hnd, hord, hfree, hdisj, hP₁, hP₂⟩, + a, b, c, d_v, + hCH.1 haC, hsub_cl haC, hCH.1 hbC, hsub_cl hbC, + hCH.1 hcC, hsub_cl hcC, hCH.1 hdC, hsub_cl hdC, hP₁, hP₂⟩ + choose P Q hEye hEnds using hex + refine ⟨r, P, Q, hr_inj, hEye, hr_dist, fun i j hij => ?_⟩ + obtain ⟨a₁, b₁, c₁, d₁_v, ha₁V, ha₁cl, hb₁V, hb₁cl, hc₁V, hc₁cl, hd₁V, hd₁cl, hP₁, hQ₁⟩ := hEnds i + obtain ⟨a₂, b₂, c₂, d₂_v, ha₂V, ha₂cl, hb₂V, hb₂cl, hc₂V, hc₂cl, hd₂V, hd₂cl, hP₂, hQ₂⟩ := hEnds j + have hri : r i ∈ H.R := (hEye i).1 + have hrj : r j ∈ H.R := (hEye j).1 + have hd_ij : d (r i) (r j) = θ := hr_dist i j hij + rw [disjoint_union_left, disjoint_union_right, disjoint_union_right] + refine ⟨⟨?_, ?_⟩, ⟨?_, ?_⟩⟩ + · exact disjoint_eye_paths_of_flatSpan hFlat hMetric hμ hθ hri hrj hd_ij + ⟨ha₁V, ha₁cl⟩ ⟨hc₁V, hc₁cl⟩ ⟨ha₂V, ha₂cl⟩ ⟨hc₂V, hc₂cl⟩ hP₁ hP₂ + · exact disjoint_eye_paths_of_flatSpan hFlat hMetric hμ hθ hri hrj hd_ij + ⟨ha₁V, ha₁cl⟩ ⟨hc₁V, hc₁cl⟩ ⟨hb₂V, hb₂cl⟩ ⟨hd₂V, hd₂cl⟩ hP₁ hQ₂ + · exact disjoint_eye_paths_of_flatSpan hFlat hMetric hμ hθ hri hrj hd_ij + ⟨hb₁V, hb₁cl⟩ ⟨hd₁V, hd₁cl⟩ ⟨ha₂V, ha₂cl⟩ ⟨hc₂V, hc₂cl⟩ hQ₁ hP₂ + · exact disjoint_eye_paths_of_flatSpan hFlat hMetric hμ hθ hri hrj hd_ij + ⟨hb₁V, hb₁cl⟩ ⟨hd₁V, hd₁cl⟩ ⟨hb₂V, hb₂cl⟩ ⟨hd₂V, hd₂cl⟩ hQ₁ hQ₂ + +/-- Downward induction on `k = κ + 1 - n` using (1.2) (`GM15Theorem12Statement`) and (5.1) +(`GM15Theorem51Statement`) in the proof of (1.1) (Graph Minors XV, Section 1, page 116). -/ +private theorem inductive_step_1_1 + {S : Type w} [TopologicalSpace S] [T2Space S] + (hSurf : IsSurface S) (hConn : ConnectedSpace S) (hBd : bd S = ∅) + {κ φ' μ' lam_target θ_target : ℕ} + (hφ'8 : 8 ≤ φ') (hμ'12 : 12 ≤ μ') (hμ'_even : Even μ') + (hlam_t : 4 ≤ lam_target) (hθ_t : 4 * lam_target + μ' + 2 ≤ θ_target) : + ∀ n ≤ κ + 1, + ∃ (p_n lam_n θ_n : ℕ), + 4 ≤ lam_n ∧ 4 * lam_n + μ' + 2 ≤ θ_n ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H₀ : Drawing S) (η₀ : SpanEmbedding H₀ G) (θ₀ : ℕ) + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ), + IsFlatSpan G H₀ η₀ θ_star θ₀ lam_n μ' T_star T₀ → + HasTangleMetric H₀ θ₀ T₀ d₀ → + θ_n ≤ θ₀ → + HasEyesAtDistance G H₀ η₀ θ₀ T₀ d₀ (κ + 1 - n) θ_n → + Section7S1 S G θ_star T_star κ μ' lam_target θ_target ∨ + Section7S2 S G θ_star T_star φ' ∨ + Section7ProperS3 S G T_star p_n κ := by + intro n + induction n with + | zero => + intro _ + refine ⟨0, lam_target, θ_target, hlam_t, hθ_t, ?_⟩ + intro α β G θ_star T_star H₀ η₀ θ₀ T₀ d₀ hFlat₀ hMetric₀ hθ₀_ge hEyes₀ + left + have h4 : 4 ≤ θ_target := by omega + exact GraphMinor.GM15.theorem_7_1_proof.{u, v, w} G H₀ η₀ θ_star θ₀ θ_target lam_target μ' + (κ + 1) T_star T₀ d₀ + hFlat₀ hMetric₀ (by omega) hθ_t h4 hθ₀_ge hEyes₀ + | succ n ih => + intro hn1 + have hn : n ≤ κ + 1 := Nat.le_of_succ_le hn1 + obtain ⟨p_n, lam_n, θ_n, hlam_n4, hθ_n_ge, hIH⟩ := ih hn + let k := κ + 1 - (n + 1) + have hk_le : k ≤ κ := by omega + have hk_succ : k + 1 = κ + 1 - n := by omega + obtain ⟨p_k, lam_k, θ_k, hθ_k_ge, hStep⟩ := + GraphMinor.GM15.theorem_1_2_proper.{u, v, w} S hSurf hConn hBd k φ' μ' lam_n θ_n hφ'8 hμ'12 + hμ'_even hlam_n4 hθ_n_ge + let p_next := max p_k p_n + let lam_next := max lam_k 4 + let θ_next := max θ_k (4 * lam_next + μ' + 2) + have hlam_next4 : 4 ≤ lam_next := le_max_right _ _ + have hθ_next_ge : 4 * lam_next + μ' + 2 ≤ θ_next := le_max_right _ _ + refine ⟨p_next, lam_next, θ_next, hlam_next4, hθ_next_ge, ?_⟩ + intro α β G θ_star T_star H₀ η₀ θ₀ T₀ d₀ hFlat₀ hMetric₀ hθ₀_ge hEyes₀ + have hθ_k_le_θ_next : θ_k ≤ θ_next := le_max_left _ _ + have hθ_k_le_θ₀ : θ_k ≤ θ₀ := hθ_k_le_θ_next.trans hθ₀_ge + have hFlat_k : IsFlatSpan G H₀ η₀ θ_star θ₀ lam_k μ' T_star T₀ := + hFlat₀.mono_lam_mu (le_max_left _ _) le_rfl (hθ_k_ge.trans hθ_k_le_θ₀) + (fun _ => by have := hFlat₀.order_ge; omega) + have hEyes_k : HasEyesAtDistance G H₀ η₀ θ₀ T₀ d₀ k θ_k := by + rcases hEyes₀ with ⟨r, hr_inj, hr_eye, hr_dist⟩ + exact ⟨r, hr_inj, hr_eye, fun i j hij => hθ_k_le_θ_next.trans (hr_dist i j hij)⟩ + rcases hStep G θ_star T_star H₀ η₀ θ₀ T₀ d₀ hFlat_k hMetric₀ hθ_k_le_θ₀ hEyes_k with + hS1 | hS2 | hS3 + · rcases hS1 with ⟨H₁, η₁, T₁, d₁, r₁, hFlat₁, hMetric₁, hr₁_inj, hr₁_eye, hr₁_dist⟩ + have hEyes₁ : HasEyesAtDistance G H₁ η₁ θ_n T₁ d₁ (k + 1) θ_n := + ⟨r₁, hr₁_inj, hr₁_eye, fun i j hij => le_of_eq (hr₁_dist i j hij).symm⟩ + rw [hk_succ] at hEyes₁ + rcases hIH G θ_star T_star H₁ η₁ θ_n T₁ d₁ hFlat₁ hMetric₁ le_rfl hEyes₁ with + hOut1 | hOut2 | ⟨S_seg, α_disc, α_pt, hCent, hType, hArr⟩ + · exact Or.inl hOut1 + · exact Or.inr (Or.inl hOut2) + · exact Or.inr (Or.inr ⟨S_seg, α_disc, α_pt, hCent, + hType.mono (le_max_right _ _) le_rfl, hArr⟩) + · exact Or.inr (Or.inl hS2) + · rcases hS3 with ⟨S_seg, α_disc, α_pt, hCent, hType, hArr⟩ + exact Or.inr (Or.inr ⟨S_seg, α_disc, α_pt, hCent, + hType.mono (le_max_left _ _) hk_le, hArr⟩) + +/-- Statement of Graph Minors XV, (1.1) (page 115): +"For any surface $\Sigma$ with $bd(\Sigma) = \emptyset$, and any integers $\kappa, \phi, \mu +\ge 0$, there are integers $\theta, \lambda, \rho \ge 0$ such that the following holds. Let +$\mathscr{T}^*$ be a tangle in a graph $G$, such that some $\Sigma$-span of order $\ge +\theta$ is $(\lambda, \mu)$-flat. Then either* (i) *there is a $\Sigma$-span of order $\ge +\phi$ with $> \kappa$ independent eyes, or* (ii) *there is a $\Sigma'$-span of order $\ge +\phi$, where $\Sigma'$ is a surface obtained by adding a crosscap to $\Sigma$, or* (iii) +*there is a $\mathscr{T}^*$-central segregation of $G$ of type $(\rho, \kappa)$ with an +arrangement in $\Sigma$." -/ +def GM15Theorem11Statement : Prop := + ∀ (S : Type w) [TopologicalSpace S] [T2Space S], + IsSurface S → ConnectedSpace S → bd S = ∅ → + ∀ (κ φ μ : ℕ), + ∃ (θ lam p : ℕ), + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H₀ : Drawing S) (η₀ : SpanEmbedding H₀ G) (θ₀ : ℕ) + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ), + IsFlatSpan G H₀ η₀ θ_star θ₀ lam μ T_star T₀ → + HasTangleMetric H₀ θ₀ T₀ d₀ → + θ ≤ θ₀ → + (∃ (H' : Drawing S) (η' : SpanEmbedding H' G) (θ' : ℕ) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ), + IsSigmaSpan G H' η' θ_star θ' T_star T' ∧ + HasTangleMetric H' θ' T' d' ∧ + φ ≤ θ' ∧ + HasIndependentEyes G H' η' θ' T' d' (κ + 1)) ∨ + (∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S'), + IsObtainedByAddingCrosscap S S' ∧ + ∃ (H' : Drawing S') (η' : SpanEmbedding H' G) (θ' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + φ ≤ θ' ∧ IsSigmaSpan G H' η' θ_star θ' T_star T') ∨ + Section7S3 S G T_star p κ + +/-- Downward eye induction for XV (1.1) retaining the proper arrangement used in XVI (7.2). -/ +theorem theorem_1_1_proper : + ∀ (S : Type w) [TopologicalSpace S] [T2Space S], + IsSurface S → ConnectedSpace S → bd S = ∅ → + ∀ (κ φ μ : ℕ), + ∃ (θ lam p : ℕ), + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H₀ : Drawing S) (η₀ : SpanEmbedding H₀ G) (θ₀ : ℕ) + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ), + IsFlatSpan G H₀ η₀ θ_star θ₀ lam μ T_star T₀ → + HasTangleMetric H₀ θ₀ T₀ d₀ → + θ ≤ θ₀ → + (∃ (H' : Drawing S) (η' : SpanEmbedding H' G) (θ' : ℕ) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ), + IsSigmaSpan G H' η' θ_star θ' T_star T' ∧ + HasTangleMetric H' θ' T' d' ∧ + φ ≤ θ' ∧ + HasIndependentEyes G H' η' θ' T' d' (κ + 1)) ∨ + (∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S'), + IsObtainedByAddingCrosscap S S' ∧ + ∃ (H' : Drawing S') (η' : SpanEmbedding H' G) (θ' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + φ ≤ θ' ∧ IsSigmaSpan G H' η' θ_star θ' T_star T') ∨ + Section7ProperS3 S G T_star p κ := by + intro S _ _ hSurf hConn hBd κ φ μ + let μ' : ℕ := 2 * (μ + 6) + let φ' : ℕ := max φ 8 + let lam_top : ℕ := 4 + let θ_top : ℕ := max φ' (4 * lam_top + μ' + 2) + have hφ'8 : 8 ≤ φ' := le_max_right _ _ + have hφ_le_φ' : φ ≤ φ' := le_max_left _ _ + have hμ'12 : 12 ≤ μ' := by omega + have hμ_le_μ' : μ ≤ μ' := by omega + have hμ'_even : Even μ' := ⟨μ + 6, by ring⟩ + have hθ_top_ge : 4 * lam_top + μ' + 2 ≤ θ_top := le_max_right _ _ + have hφ_le_θ_top : φ ≤ θ_top := hφ_le_φ'.trans (le_max_left _ _) + obtain ⟨p, lam₀, θ₀_base, hlam₀4, hθ₀_base_ge, hInd⟩ := + inductive_step_1_1 hSurf hConn hBd hφ'8 hμ'12 hμ'_even + (le_refl 4) hθ_top_ge (κ + 1) le_rfl + let θ : ℕ := max θ₀_base (4 * lam₀ + μ' + 2) + refine ⟨θ, lam₀, p, ?_⟩ + intro α β G θ_star T_star H₀ η₀ θ₀ T₀ d₀ hFlat₀ hMetric₀ hθ_le + have hθ₀_base_le : θ₀_base ≤ θ₀ := (le_max_left _ _).trans hθ_le + have hord_μ' : 4 * lam₀ + μ' + 2 ≤ θ₀ := (le_max_right _ _).trans hθ_le + have hFlat_μ' : IsFlatSpan G H₀ η₀ θ_star θ₀ lam₀ μ' T_star T₀ := + hFlat₀.mono_mu hμ_le_μ' hord_μ' + have hEyes0 : HasEyesAtDistance G H₀ η₀ θ₀ T₀ d₀ (κ + 1 - (κ + 1)) θ₀_base := by + rw [Nat.sub_self] + exact ⟨Fin.elim0, fun i => Fin.elim0 i, fun i => Fin.elim0 i, fun i => Fin.elim0 i⟩ + rcases hInd G θ_star T_star H₀ η₀ θ₀ T₀ d₀ hFlat_μ' hMetric₀ hθ₀_base_le hEyes0 with + ⟨H₁, η₁, T₁, d₁, r₁, hFlat₁, hMetric₁, hr₁_inj, hr₁_eye, hr₁_dist⟩ | + ⟨S', hTS', hT2S', hCross, H', η', T', hSpan'⟩ | hS3 + · left + have hθ_top_18 : μ' + 18 ≤ θ_top := by omega + have hIndEyes : HasIndependentEyes G H₁ η₁ θ_top T₁ d₁ (κ + 1) := + independentEyes_of_flatSpan G H₁ η₁ θ_star θ_top μ' κ T_star T₁ d₁ r₁ hFlat₁ hMetric₁ + hμ'12 hθ_top_18 hr₁_inj hr₁_eye hr₁_dist + exact ⟨H₁, η₁, θ_top, T₁, d₁, hFlat₁.isSpan, hMetric₁, hφ_le_θ_top, hIndEyes⟩ + · right; left + exact ⟨S', hTS', hT2S', hCross, H', η', φ', T', hφ_le_φ', hSpan'⟩ + · right; right + exact hS3 + +/-- **Graph Minors XV, (1.1)** (pages 115–116): +Main theorem of Graph Minors XV, proved from `(1.2)` (`GM15Theorem12Statement`), `(5.1)` +(`theorem_5_1_proof`), and `(7.1)` (`theorem_7_1_proof`). -/ +theorem theorem_1_1_proof + : + GM15Theorem11Statement.{u, v, w} := by + intro S _ _ hSurface hConnected hBoundary κ φ μ + obtain ⟨order, flatness, width, hresult⟩ := + theorem_1_1_proper.{u,v,w} S hSurface hConnected hBoundary κ φ μ + refine ⟨order, flatness, width, ?_⟩ + intro α β G θ_star T_star H η θ₀ T d hFlat hMetric hle + exact (hresult G θ_star T_star H η θ₀ T d hFlat hMetric hle).imp id + (Or.imp id Section7ProperS3.toSection7S3) + +/-! ## Section 8: Statements and Proofs of `(8.1)`, `(8.2)`, `(8.3)`, and `(8.4)` -/ + +/-- Statement of Graph Minors XV, (8.1) (page 145): +"For any surface $\Sigma$ with $\text{bd}(\Sigma) = \emptyset$, and any integer $p \ge 0$ +there exists $\kappa, \phi \ge 0$ such that the following is true. Let $\mathcal{T}^*$ be a +tangle in a graph $G$ of order $\ge p$, and let $H, \eta, \mathcal{T}$ be a $\Sigma$-span of +order $\ge \phi$, with $\ge \kappa$ independent eyes. Then $\mathcal{T}^*$ controls a $K_p$ +minor of $G$." -/ +def GM15Theorem81Statement : Prop := + ∀ (S : Type w) [TopologicalSpace S] [T2Space S], + IsSurface S → ConnectedSpace S → bd S = ∅ → + ∀ p : ℕ, ∃ κ φ : ℕ, + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) (θ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ), + IsSigmaSpan G H η θ_star θ T_star T → + HasTangleMetric H θ T d → + p ≤ θ_star → φ ≤ θ → + HasIndependentEyes G H η θ T d κ → + ControlsCliqueMinor G p T_star + +/-- **Graph Minors XV, (8.1)** (page 145): +For any connected surface `Σ` with `bd(Σ) = ∅` and any `p ≥ 0`, there exist `κ, φ ≥ 0` such that if +`T*` is a tangle in `G` of order `≥ p` and `H, η, T` is a `Σ`-span of order `≥ φ` with `≥ κ` +independent eyes, then `T*` controls a `K_p` minor of `G`. +Proved from Graph Minors XII, `(4.5)` (`GM12Theorem45Statement`). -/ +theorem theorem_8_1_proof : + GM15Theorem81Statement.{u, v, w} := by + intro S _ _ hSurf hConn hBd p + have hClosed : IsClosedSurface S := + ⟨hSurf.1, hSurf.2.1, fun x => by + by_contra hx + exact Set.eq_empty_iff_forall_notMem.mp hBd x hx⟩ + obtain ⟨κ, φ, h⟩ := GraphMinor.GM12.gm15_theorem45.{u, v, w} S hClosed hConn p + refine ⟨κ, φ, ?_⟩ + intro α β G θ_star T_star H η θ T d hSpan hMetric hp hφ hEyes + exact controlsCliqueMinor_of_gm12 (h G θ_star T_star H η θ T d hSpan hMetric hp hφ hEyes) + +/-- If a `Σ`-span has `κ₂` independent eyes and `κ₁ ≤ κ₂`, then it has `κ₁` independent eyes. -/ +theorem HasIndependentEyes.mono {S : Type w} [TopologicalSpace S] + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {κ₁ κ₂ : ℕ} + (h : HasIndependentEyes G H η θ T d κ₂) (hκ : κ₁ ≤ κ₂) : + HasIndependentEyes G H η θ T d κ₁ := by + rcases h with ⟨r, P, Q, hr_inj, hEye, hDist, hDisj⟩ + refine ⟨fun i => r (Fin.castLE hκ i), fun i => P (Fin.castLE hκ i), + fun i => Q (Fin.castLE hκ i), + hr_inj.comp (Fin.castLE_injective hκ), + fun i => hEye (Fin.castLE hκ i), + fun i j hij => hDist (Fin.castLE hκ i) (Fin.castLE hκ j) + (fun heq => hij ((Fin.castLE_injective hκ) heq)), + fun i j hij => hDisj (Fin.castLE hκ i) (Fin.castLE hκ j) + (fun heq => hij ((Fin.castLE_injective hκ) heq))⟩ + +/-- Statement of Graph Minors XV, (8.2) (pages 145–146): +"For any surface $\Sigma$ with $\text{bd}(\Sigma) = \emptyset$, and any integers $p, \phi, +\mu \ge 0$, there are integers $\kappa, \theta, \lambda, \rho \ge 0$ such that the following +holds. Let $\mathcal{T}^*$ be a tangle in a graph $G$ such that there is no +$\mathcal{T}^*$-central segregation of $G$ of type $(\rho, \kappa)$ with an arrangement in +$\Sigma$. Then either* ... (i) *$\mathcal{T}^*$ controls a $K_p$ minor of $G$, or* (ii) *there +is a $\Sigma'$-span of order $\ge \phi$, where $\Sigma'$ is a surface obtained by adding a +crosscap to $\Sigma$, or* (iii) *no $\Sigma$-span of order $\ge \theta$ is $(\lambda, +\mu)$-flat." -/ +def GM15Theorem82Statement : Prop := + ∀ (S : Type w) [TopologicalSpace S] [T2Space S], + IsSurface S → ConnectedSpace S → bd S = ∅ → + ∀ (p φ μ : ℕ), + ∃ (κ θ lam ρ : ℕ), + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)), + ¬ Section7S3 S G T_star ρ κ → + ControlsCliqueMinor G p T_star ∨ + (∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S'), + IsObtainedByAddingCrosscap S S' ∧ + ∃ (H' : Drawing S') (η' : SpanEmbedding H' G) (θ' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + φ ≤ θ' ∧ IsSigmaSpan G H' η' θ_star θ' T_star T') ∨ + (∀ (H₀ : Drawing S) (η₀ : SpanEmbedding H₀ G) (θ₀ : ℕ) + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ), + θ ≤ θ₀ → HasTangleMetric H₀ θ₀ T₀ d₀ → + ¬ IsFlatSpan G H₀ η₀ θ_star θ₀ lam μ T_star T₀) + +/-- **Graph Minors XV, (8.2)** (pages 145–146): +Proved from `(1.1)` (`theorem_1_1_proof`) and `(8.1)` (`theorem_8_1_proof`). -/ +theorem theorem_8_2_proof + : + GM15Theorem82Statement.{u, v, w} := by + have h11 : GM15Theorem11Statement.{u, v, w} := + theorem_1_1_proof + have h81 : GM15Theorem81Statement.{u, v, w} := theorem_8_1_proof + intro S _ _ hSurf hConn hBd p φ μ + let p4 := max p 4 + obtain ⟨κ, φ₁, hClique⟩ := h81 S hSurf hConn hBd p4 + let φ₂ := max φ φ₁ + obtain ⟨θ₁, lam, ρ, hMain⟩ := h11 S hSurf hConn hBd κ φ₂ μ + let θ := max θ₁ p4 + refine ⟨κ, θ, lam, ρ, ?_⟩ + intro α β G θ_star T_star hNoS3 + by_cases hAllNotFlat : + ∀ (H₀ : Drawing S) (η₀ : SpanEmbedding H₀ G) (θ₀ : ℕ) + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ), + θ ≤ θ₀ → HasTangleMetric H₀ θ₀ T₀ d₀ → + ¬ IsFlatSpan G H₀ η₀ θ_star θ₀ lam μ T_star T₀ + · exact Or.inr (Or.inr hAllNotFlat) + · push Not at hAllNotFlat + rcases hAllNotFlat with ⟨H₀, η₀, θ₀, T₀, d₀, hθ_le, hMetric₀, hFlat₀⟩ + have hp4_le_θ_star : p4 ≤ θ_star := + (le_max_right θ₁ p4).trans (hθ_le.trans hFlat₀.isSpan.isControlling.theta_le) + have hθ₁_le_θ₀ : θ₁ ≤ θ₀ := (le_max_left θ₁ p4).trans hθ_le + rcases hMain G θ_star T_star H₀ η₀ θ₀ T₀ d₀ hFlat₀ hMetric₀ hθ₁_le_θ₀ with + ⟨H', η', θ', T', d', hSpan', hMetric', hφ₂_le, hIndEyes⟩ | + ⟨S', hTS', hT2S', hCross, H', η', θ', T', hφ₂_le, hSpan'⟩ | hS3 + · left + have hφ₁_le : φ₁ ≤ θ' := (le_max_right φ φ₁).trans hφ₂_le + have hEyes_κ : HasIndependentEyes G H' η' θ' T' d' κ := + hIndEyes.mono (Nat.le_succ κ) + have hMinor_p4 : ControlsCliqueMinor G p4 T_star := + hClique G θ_star T_star H' η' θ' T' d' hSpan' hMetric' hp4_le_θ_star hφ₁_le hEyes_κ + exact hMinor_p4.mono (le_max_left p 4) + · right; left + exact ⟨S', hTS', hT2S', hCross, H', η', θ', T', + (le_max_left φ φ₁).trans hφ₂_le, hSpan'⟩ + · exact (hNoS3 hS3).elim + +/-- Statement of Graph Minors XV, (8.3) (page 146): +"Let $\lambda, \mu \ge 0$ be integers, let $\mathcal{T}^*$ be a tangle in a graph $G$, and +let $\Sigma$ be a surface with $\text{bd}(\Sigma) = \emptyset$. Then every $\Sigma$-span +which is $(\lambda + \mu + 2, \mu)$-level is $(\lambda, \mu)$-flat." -/ +def GM15Theorem83Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ lam μ : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ), + 4 * (lam + μ + 2) + 2 < θ → + IsLevelSpan G H η θ_star θ (lam + μ + 2) μ T_star T d → + IsFlatSpan G H η θ_star θ lam μ T_star T + +/-- **Graph Minors XV, (8.3), Claim (1)** (page 147): +"If $d(z, a), d(z, b) \le \lambda + \mu + 2$, then $H, \eta, \mathcal{T}$ is not $(\lambda + \mu + +2)$-level." (The paper omits `, μ` in `(λ + μ + 2, μ)-level`.) -/ +theorem theorem_8_3_claim_1 {S : Type w} [TopologicalSpace S] [T2Space S] + {G : Graph α β} {H H' : Drawing S} {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} + {θ_star θ lam μ : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d'' : Set S → Set S → ℕ} {z : Set S} {P : Graph α β} {a b : S} + (hRearr : IsRearrangedWithin G H H' η η' θ_star θ (lam + μ + 2) T_star T T'' d d'' z) + (hStep : IsMuStepped G H' η' d'' μ P a b) + (ha : pointAtomDist H d a z ≤ lam + μ + 2) + (hb : pointAtomDist H d b z ≤ lam + μ + 2) : + ¬ IsLevelSpan G H η θ_star θ (lam + μ + 2) μ T_star T d := + fun hLevel => hLevel.no_local_stepped_rearrangement hRearr hStep ⟨ha, hb⟩ + +private theorem path_meets_original_vertices_only_at_start + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (θ_star : ℕ) + (θ : ℕ) + (lam : ℕ) + (μ : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (hLevel : IsLevelSpan G H η θ_star θ (lam + μ + 2) μ T_star T d) + (hord_level : 4 * (lam + μ + 2) + μ + 2 ≤ θ) + (H' : Drawing S) + (η' : SpanEmbedding H' G) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) + (z : Set S) + (hS : IsClosedSurface S) + [hConn : ConnectedSpace S] + (hRearr : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) + (hd_symm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (hd_tri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) + (P : Graph α β) + (a : S) + (b : S) + (haH' : a ∈ H'.V) + (hbH' : b ∈ H'.V) + (hP : IsHPathWithEnds G η'.imageGraph P (η'.vMap a) (η'.vMap b)) + (hdist' : μ ≤ d' {a} {b}) + (ha_far : lam + μ + 3 ≤ d z {a}) + (hx_a : {a} ∈ H.A) + (haH : a ∈ H.V) + (hva_eq : η'.vMap a = η.vMap a) + (hClaim3 : ∀ e ∈ E(P), P.Inc e (η.vMap a) → e ∉ E(η.imageGraph)) : + ∀ v ∈ H.V, η.vMap v ∈ V(P) → v = a := by + intro v₀ hv₀H hv₀P + by_contra hv₀_ne + let X : Set α := V(η.imageGraph) \ {η.vMap a} + have hv₀X : η.vMap v₀ ∈ V(P) ∩ X := + ⟨hv₀P, η.bijOn_v.mapsTo hv₀H, fun hEq => hv₀_ne (η.bijOn_v.injOn hv₀H haH hEq)⟩ + have hP_path_a : IsGraphPathWithEnds G P (η.vMap a) (η'.vMap b) := hva_eq ▸ hP.2.1 + obtain ⟨x, Q, _, hxP, hxX, hQP, _, hQ_P, _, _, _, _, hQX⟩ := + hP_path_a.exists_first_split_of_nonempty ⟨η.vMap v₀, hv₀X⟩ + obtain ⟨v, hvH, rfl⟩ := η.bijOn_v.surjOn hxX.1 + have hva_ne : η.vMap a ≠ η.vMap v := Ne.symm hxX.2 + have hv_ne_a : v ≠ a := fun hEq => hva_ne (hEq ▸ rfl) + have hQ_path : IsGraphPathWithEnds G Q (η.vMap a) (η.vMap v) := hQ_P.mono hP.2.1.le + have hVQ_H : V(Q) ∩ V(η.imageGraph) = {η.vMap a, η.vMap v} := by + ext y + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨hyQ, hyH⟩ + by_cases hya : y = η.vMap a + · exact Or.inl hya + · have hyX : y ∈ V(Q) ∩ X := ⟨hyQ, hyH, hya⟩ + rw [hQX, mem_singleton_iff] at hyX + exact Or.inr hyX + · rintro (rfl | rfl) + · exact ⟨hQ_P.left_mem, η.bijOn_v.mapsTo haH⟩ + · exact ⟨hQ_P.right_mem, hxX.1⟩ + have hEQ_H : Disjoint E(Q) E(η.imageGraph) := by + refine Set.disjoint_left.mpr fun e heQ heH => ?_ + have heG : e ∈ E(G) := hQ_path.le.edgeSet_mono heQ + obtain ⟨u₁, u₂, hlinkQ⟩ := exists_isLink_of_mem_edgeSet heQ + have hlinkG : G.IsLink e u₁ u₂ := hlinkQ.mono hQ_path.le + have hlinkH : η.imageGraph.IsLink e u₁ u₂ := (η.imageGraph_le.isLink_iff heH).mpr hlinkG + have hu₁ : u₁ ∈ ({η.vMap a, η.vMap v} : Set α) := + hVQ_H ▸ ⟨hlinkQ.left_mem, hlinkH.left_mem⟩ + have hu₂ : u₂ ∈ ({η.vMap a, η.vMap v} : Set α) := + hVQ_H ▸ ⟨hlinkQ.right_mem, hlinkH.right_mem⟩ + have hu_ne : u₁ ≠ u₂ := fun hEq => hQ_path.not_isLink_self (hEq ▸ hlinkQ) + have hinc_a : Q.Inc e (η.vMap a) := by + rcases hu₁ with rfl | rfl <;> rcases hu₂ with rfl | rfl + · exact False.elim (hu_ne rfl) + · exact ⟨_, hlinkQ⟩ + · exact ⟨_, hlinkQ.symm⟩ + · exact False.elim (hu_ne rfl) + obtain ⟨w, hlink_a⟩ := hinc_a + exact hClaim3 e (hQP.edgeSet_mono heQ) ⟨w, hlink_a.mono hQP⟩ heH + have hQ_HPath : IsHPathWithEnds G η.imageGraph Q (η.vMap a) (η.vMap v) := + ⟨η.imageGraph_le, hQ_path, hva_ne, η.bijOn_v.mapsTo haH, η.bijOn_v.mapsTo hvH, + hVQ_H, hEQ_H⟩ + have hd_av_lt : d {a} {v} < μ := by + by_contra hge + exact hLevel.not_stepped ⟨Q, a, v, haH, hvH, hQ_HPath, Nat.not_lt.mp hge⟩ + have hv_A : {v} ∈ H.A := Or.inl (Or.inl ⟨v, hvH, rfl⟩) + have htri_zv := hd_tri z hRearr.z_mem {v} hv_A {a} hx_a + have hsym_av := hd_symm {a} hx_a {v} hv_A + obtain ⟨hvH', hvv_eq⟩ := hRearr.vMap_eq v hvH (by omega) + have hv_in_P' : η'.vMap v ∈ V(P) ∩ V(η'.imageGraph) := + ⟨hQP.vertexSet_mono (hvv_eq ▸ hQ_P.right_mem), η'.bijOn_v.mapsTo hvH'⟩ + rw [hP.2.2.2.2.2.1] at hv_in_P' + rcases hv_in_P' with hv_eq_a | hv_eq_b + · exact hv_ne_a (η'.bijOn_v.injOn hvH' haH' hv_eq_a) + · have hvb : v = b := η'.bijOn_v.injOn hvH' hbH' hv_eq_b + subst hvb + let Λ : Set S := ⋃ z' ∈ {z' ∈ H.A | d z z' ≤ lam}, z' + have hZ_sub : ∀ z' ∈ H.A, z' ∉ H'.A → z' ⊆ Λ := by + intro z' hz' hnot + have hle : d z z' ≤ lam := by + by_contra hgt + exact hnot (hRearr.atom_mem z' hz' (Nat.not_le.mp hgt)) + exact subset_biUnion_of_mem (u := id) ⟨hz', hle⟩ + have hpt_ab : pointDist H d a v = d {a} {v} := + pointDist_eq_of_mem_atom hx_a hv_A (mem_singleton a) (mem_singleton v) + have hpt'_ab : pointDist H' d' a v = d' {a} {v} := + pointDist_eq_of_mem_atom (Or.inl (Or.inl ⟨a, haH', rfl⟩)) + (Or.inl (Or.inl ⟨v, hvH', rfl⟩)) (mem_singleton a) (mem_singleton v) + have hltZ : ∀ σ ∈ Λ, pointDist H d a v < pointDist H d a σ := by + intro σ hσ + obtain ⟨z', ⟨hz'A, hz'_le⟩, hσz'⟩ := mem_iUnion₂.mp hσ + rw [hpt_ab, pointDist_eq_of_mem_atom hx_a hz'A (mem_singleton a) hσz'] + have htri := hd_tri z hRearr.z_mem z' hz'A {a} hx_a + have hsym := hd_symm {a} hx_a z' hz'A + omega + have hle_42 := + theorem_4_2_proof H H' Λ θ (θ - (4 * lam + 2)) (4 * lam + 2) + T T' d d' a v hS hConn hLevel.hasMetric hRearr.isCompression.hasMetric' + hZ_sub (Or.inl hRearr.isCompression) hltZ (by rw [hpt_ab]; omega) + rw [hpt_ab, hpt'_ab] at hle_42 + omega + +private theorem return_vertex_has_small_atom_distance + {S : Type w} + [TopologicalSpace S] + [T2Space S] + {α : Type u} + {β : Type v} + (G : Graph α β) + (H : Drawing S) + (η : SpanEmbedding H G) + (θ_star : ℕ) + (θ : ℕ) + (lam : ℕ) + (μ : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (hLevel : IsLevelSpan G H η θ_star θ (lam + μ + 2) μ T_star T d) + (H' : Drawing S) + (η' : SpanEmbedding H' G) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) + (z : Set S) + (hS : IsClosedSurface S) + [ConnectedSpace S] + (hRearr : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) + (hd_symm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (hd_tri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) + (b : S) + (Q : Graph α β) + (c : S) + (hcH : c ∈ H.V) + (hQ_H' : IsGraphPathWithEnds η'.imageGraph Q (η'.vMap b) (η.vMap c)) + (hbc_ne : η'.vMap b ≠ η.vMap c) + (hEQ_H : Disjoint E(Q) E(η.imageGraph)) + (hc_A : {c} ∈ H.A) : + d z {c} ≤ lam + 2 := by + by_contra hgt + obtain ⟨hcH', hvc_eq⟩ := hRearr.vMap_eq c hcH (by omega) + obtain ⟨e', he'Q, hinc_c⟩ := hQ_H'.exists_inc_right hbc_ne + have he'H' : e' ∈ E(η'.imageGraph) := hQ_H'.le.edgeSet_mono he'Q + obtain ⟨f, hf, hfe'⟩ := η'.bijOn_e.surjOn he'H' + obtain ⟨w, hlinkQ⟩ := hinc_c + have hlinkH' : η'.imageGraph.IsLink (η'.eMap f) (η'.vMap c) w := by + rw [hfe', hvc_eq] + exact hlinkQ.mono hQ_H'.le + have hcf : c ∈ closure f := (η'.inc_iff f hf c hcH').mp ⟨w, hlinkH'⟩ + let S_A : Set (Set S) := {z' ∈ H.A | d z z' ≤ lam} + have hHA_fin : H.A.Finite := + ((H.finite_V.image fun v => ({v} : Set S)).union H.finite_edges).union + (GM11.finite_R hS H) + have hS_A_fin : S_A.Finite := hHA_fin.subset fun _ h => h.1 + have hf_sub : f ⊆ ⋃ z' ∈ S_A, z' := by + intro σ hσf + obtain ⟨aσ, haσ, hσ_aσ⟩ := exists_atom_of_point H σ + have haσ_le : d z aσ ≤ lam := by + by_contra hgt_σ + have haσ_H' : aσ ∈ H'.A := hRearr.atom_mem aσ haσ (Nat.not_le.mp hgt_σ) + have haσ_eq : aσ = f := + atom_eq_of_mem haσ_H' (Or.inl (Or.inr hf)) hσ_aσ hσf + rw [haσ_eq] at haσ hgt_σ + have hfH : f ∈ H.E := edge_mem_E_of_mem_A hS hf haσ + obtain ⟨_, hf_eq⟩ := hRearr.eMap_eq f hfH (Nat.not_le.mp hgt_σ) + have he'H : e' ∈ E(η.imageGraph) := by + rw [← hfe', hf_eq] + exact η.bijOn_e.mapsTo hfH + exact Set.disjoint_left.mp hEQ_H he'Q he'H + exact mem_iUnion₂.mpr ⟨aσ, ⟨haσ, haσ_le⟩, hσ_aσ⟩ + have hc_cl : c ∈ closure (⋃ z' ∈ S_A, z') := closure_mono hf_sub hcf + rw [hS_A_fin.closure_biUnion] at hc_cl + obtain ⟨z', ⟨hz'A, hz'_le⟩, hcz'⟩ := mem_iUnion₂.mp hc_cl + have hdc_z' : d {c} z' ≤ 2 := + vertex_atom_dist_le_two hS hLevel.hasMetric c hcH z' hz'A hcz' + have htri := hd_tri z hRearr.z_mem z' hz'A {c} hc_A + have hsym := hd_symm {c} hc_A z' hz'A + omega + +/-- **Graph Minors XV, (8.3)** (pages 146–148): +Every `(λ + μ + 2, μ)`-level `Σ`-span is `(λ, μ)`-flat. -/ +theorem theorem_8_3_proof + : + GM15Theorem83Statement.{u, v, w} := by + intro S _ _ α β G H η θ_star θ lam μ T_star T d hθ_lt hLevel + have hord_level : 4 * (lam + μ + 2) + μ + 2 ≤ θ := hLevel.order_ge + have hord_lam : 4 * lam + μ + 2 ≤ θ := by omega + refine ⟨hLevel.isSpan, hord_lam, fun H' η' T' d₁ d' z hRearr₀ hStep₀ => ?_⟩ + have hS : IsClosedSurface S := + ⟨hLevel.isSpan.isSurface.1, hLevel.isSpan.isSurface.2.1, fun x => + by_contra fun hx => Set.eq_empty_iff_forall_notMem.mp hLevel.isSpan.bd_empty x hx⟩ + have hConn : ConnectedSpace S := hLevel.isSpan.isConnected + have : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨hd₁_A, hd₁_pt, _⟩ := + tangleMetric_eq_of_hasTangleMetric hS hConn hRearr₀.isCompression.hasMetric + hLevel.hasMetric + have hRearr : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z := by + refine ⟨hRearr₀.z_mem, hRearr₀.isSpan, hRearr₀.isSpan', + fun a ha hlt => hRearr₀.atom_mem a ha ?_, + fun v hv hlt => hRearr₀.vMap_eq v hv ?_, + fun e he hlt => hRearr₀.eMap_eq e he ?_, + ⟨hRearr₀.isCompression.lam_lt, hLevel.hasMetric, hRearr₀.isCompression.hasMetric', + fun σ₁ σ₂ => ?_⟩⟩ + · rwa [hd₁_A z hRearr₀.z_mem a ha] + · rwa [hd₁_A z hRearr₀.z_mem {v} (Or.inl (Or.inl ⟨v, hv, rfl⟩))] + · rwa [hd₁_A z hRearr₀.z_mem e (Or.inl (Or.inr he))] + · rw [← hd₁_pt σ₁ σ₂] + exact hRearr₀.isCompression.dist_le σ₁ σ₂ + obtain ⟨_, hd_refl, _, hd_symm, hd_tri, hd_inc⟩ := gm11_theorem_9_1 H θ T d hS hConn + hLevel.hasMetric + obtain ⟨_, hd'_refl, _, hd'_symm, hd'_tri, hd'_inc⟩ := + gm11_theorem_9_1 H' (θ - (4 * lam + 2)) T' d' hS hConn hRearr.isCompression.hasMetric' + obtain ⟨P, a₀, b₀, ha₀H', hb₀H', hP₀, hdist₀⟩ := hStep₀ + -- Step 1: By Claim (1), we cannot have both `d(z, a₀), d(z, b₀) ≤ lam + μ + 2`. + have hNotBoth : ¬ (pointAtomDist H d a₀ z ≤ lam + μ + 2 ∧ + pointAtomDist H d b₀ z ≤ lam + μ + 2) := by + rintro ⟨ha₀, hb₀⟩ + obtain ⟨d'', hRearr'', hd''_eq, _⟩ := + hRearr.truncation_of_dist_le hRearr.z_mem (lam₂ := lam + μ + 2) (by omega) + (by rw [hd_refl z hRearr.z_mem]; omega) hθ_lt + have hStep'' : IsMuStepped G H' η' d'' μ P a₀ b₀ := by + refine ⟨ha₀H', hb₀H', hP₀, ?_⟩ + rw [hd''_eq {a₀} (Or.inl (Or.inl ⟨a₀, ha₀H', rfl⟩)) + {b₀} (Or.inl (Or.inl ⟨b₀, hb₀H', rfl⟩))] + omega + exact theorem_8_3_claim_1 hRearr'' hStep'' ha₀ hb₀ hLevel + -- We may assume `lam + μ + 3 ≤ pointAtomDist H d a z`. + have hex_ab : ∃ a b : S, + a ∈ H'.V ∧ b ∈ H'.V ∧ + IsHPathWithEnds G η'.imageGraph P (η'.vMap a) (η'.vMap b) ∧ + μ ≤ d' {a} {b} ∧ + lam + μ + 3 ≤ pointAtomDist H d a z := by + by_cases ha₀_le : pointAtomDist H d a₀ z ≤ lam + μ + 2 + · have hb₀_gt : ¬ pointAtomDist H d b₀ z ≤ lam + μ + 2 := + fun hb₀_le => hNotBoth ⟨ha₀_le, hb₀_le⟩ + refine ⟨b₀, a₀, hb₀H', ha₀H', hP₀.symm, ?_, by omega⟩ + rwa [hd'_symm {b₀} (Or.inl (Or.inl ⟨b₀, hb₀H', rfl⟩)) + {a₀} (Or.inl (Or.inl ⟨a₀, ha₀H', rfl⟩))] + · exact ⟨a₀, b₀, ha₀H', hb₀H', hP₀, hdist₀, by omega⟩ + obtain ⟨a, b, haH', hbH', hP, hdist', ha_far⟩ := hex_ab + -- Claim (2): `lam + μ + 3 ≤ d z {a}`, `a ∈ H.V`, and `η'.vMap a = η.vMap a`. + obtain ⟨x_a, hx_a, ha_xa⟩ := exists_atom_of_point H a + have hpt_a : pointAtomDist H d a z = d z x_a := by + rw [pointAtomDist_eq_of_mem_atom hx_a ha_xa, hd_symm x_a hx_a z hRearr.z_mem] + rw [hpt_a] at ha_far + have hx_a_H' : x_a ∈ H'.A := hRearr.atom_mem x_a hx_a (by omega) + have hx_a_eq : x_a = {a} := + atom_eq_of_mem hx_a_H' (Or.inl (Or.inl ⟨a, haH', rfl⟩)) ha_xa (mem_singleton a) + rw [hx_a_eq] at hx_a ha_far + have haH : a ∈ H.V := vertex_mem_V_of_mem_A hS haH' hx_a + have hva_eq : η'.vMap a = η.vMap a := (hRearr.vMap_eq a haH (by omega)).2 + -- Claim (3): No edge of `P` incident with `η.vMap a` is in `E(η.imageGraph)`. + have hClaim3 : ∀ e ∈ E(P), P.Inc e (η.vMap a) → e ∉ E(η.imageGraph) := by + intro e heP hinc_a heH + obtain ⟨f, hf, hfe⟩ := η.bijOn_e.surjOn heH + obtain ⟨w, hlinkP⟩ := hinc_a + have hlinkG : G.IsLink e (η.vMap a) w := hlinkP.mono hP.2.1.le + have hlinkH : η.imageGraph.IsLink (η.eMap f) (η.vMap a) w := + hfe ▸ (η.imageGraph_le.isLink_iff heH).mpr hlinkG + have haf : a ∈ closure f := (η.inc_iff f hf a haH).mp ⟨w, hlinkH⟩ + have hdf : d {a} f ≤ 2 := hd_inc.2 a haH f hf haf + have htri := hd_tri z hRearr.z_mem f (Or.inl (Or.inr hf)) {a} hx_a + have hsym := hd_symm {a} hx_a f (Or.inl (Or.inr hf)) + obtain ⟨hf', hf_eq⟩ := hRearr.eMap_eq f hf (by omega) + have heH' : e ∈ E(η'.imageGraph) := by + rw [← hfe, ← hf_eq] + exact η'.bijOn_e.mapsTo hf' + exact Set.disjoint_left.mp hP.2.2.2.2.2.2 heP heH' + -- Claim (4): There is no `v ∈ H.V` with `v ≠ a` and `η.vMap v ∈ V(P)`. + have hClaim4 : ∀ v ∈ H.V, η.vMap v ∈ V(P) → v = a := by + exact path_meets_original_vertices_only_at_start (S := S) (α := α) (β := β) G H η θ_star θ lam + μ T_star T d hLevel hord_level H' η' T' d' z hS hRearr hd_symm hd_tri P a b haH' hbH' + hP hdist' ha_far hx_a haH hva_eq hClaim3 + have hVP_H : V(P) ∩ V(η.imageGraph) = {η.vMap a} := by + ext y + simp only [mem_inter_iff, mem_singleton_iff] + refine ⟨fun ⟨hyP, hyH⟩ => ?_, ?_⟩ + · obtain ⟨v, hvH, rfl⟩ := η.bijOn_v.surjOn hyH + rw [hClaim4 v hvH hyP] + · rintro rfl + exact ⟨hva_eq ▸ hP.2.1.left_mem, η.bijOn_v.mapsTo haH⟩ + -- Claim (5) & (6): Choose a minimal path `Q` of `η'(H')` from `η'(b)` to `V(η(H))`. + have hH'E : H'.E.Nonempty := + edges_nonempty_of_tangle hS hRearr.isCompression.hasMetric'.1 (by omega) + obtain ⟨R₀, hR₀⟩ := + η'.exists_path_imageGraph hS hRearr.isSpan'.isRespectful.1 hH'E hbH' haH' + have hR₀_inter : (V(R₀) ∩ V(η.imageGraph)).Nonempty := + ⟨η.vMap a, hva_eq ▸ hR₀.right_mem, η.bijOn_v.mapsTo haH⟩ + obtain ⟨x_c, Q, _, hxR₀, hxH, hQR₀, _, hQ_R₀, _, _, _, _, hQV_H⟩ := + hR₀.exists_first_split_of_nonempty hR₀_inter + obtain ⟨c, hcH, rfl⟩ := η.bijOn_v.surjOn hxH + have hQ_H' : IsGraphPathWithEnds η'.imageGraph Q (η'.vMap b) (η.vMap c) := + hQ_R₀.mono hR₀.le + have hQ_G : IsGraphPathWithEnds G Q (η'.vMap b) (η.vMap c) := + hQ_H'.mono η'.imageGraph_le + -- Claim (5): `η'.vMap b ≠ η.vMap c`. + have hbc_ne : η'.vMap b ≠ η.vMap c := by + intro hEq + have hb_in : η'.vMap b ∈ V(P) ∩ V(η.imageGraph) := + ⟨hP.2.1.right_mem, hEq ▸ hxH⟩ + rw [hVP_H, mem_singleton_iff, ← hva_eq] at hb_in + exact hP.2.2.1 hb_in.symm + have hEQ_H : Disjoint E(Q) E(η.imageGraph) := by + refine Set.disjoint_left.mpr fun e heQ heH => ?_ + obtain ⟨u₁, u₂, hlinkQ⟩ := exists_isLink_of_mem_edgeSet heQ + have hlinkG : G.IsLink e u₁ u₂ := hlinkQ.mono hQ_G.le + have hlinkH : η.imageGraph.IsLink e u₁ u₂ := (η.imageGraph_le.isLink_iff heH).mpr hlinkG + have hu₁ : u₁ = η.vMap c := by + have : u₁ ∈ V(Q) ∩ V(η.imageGraph) := ⟨hlinkQ.left_mem, hlinkH.left_mem⟩ + rwa [hQV_H, mem_singleton_iff] at this + have hu₂ : u₂ = η.vMap c := by + have : u₂ ∈ V(Q) ∩ V(η.imageGraph) := ⟨hlinkQ.right_mem, hlinkH.right_mem⟩ + rwa [hQV_H, mem_singleton_iff] at this + exact hQ_G.not_isLink_self (hu₁ ▸ hu₂ ▸ hlinkQ) + -- Claim (6): `d z {c} ≤ lam + 2`. + have hc_A : {c} ∈ H.A := Or.inl (Or.inl ⟨c, hcH, rfl⟩) + have hClaim6 : d z {c} ≤ lam + 2 := by + exact return_vertex_has_small_atom_distance (S := S) (α := α) (β := β) G H η θ_star θ lam μ + T_star T d hLevel H' η' T' d' z hS hRearr hd_symm hd_tri b Q c hcH hQ_H' hbc_ne + hEQ_H hc_A + -- Combine `P` and `Q` into an `η(H)`-path from `η(a)` to `η(c)` with `d({a}, {c}) ≥ μ`. + have hac_ne : a ≠ c := fun hEq => by + rw [hEq] at ha_far + omega + have hvac_ne : η.vMap a ≠ η.vMap c := + fun hEq => hac_ne (η.bijOn_v.injOn haH hcH hEq) + have hVP_Q : V(P) ∩ V(Q) = {η'.vMap b} := by + ext y + simp only [mem_inter_iff, mem_singleton_iff] + constructor + · rintro ⟨hyP, hyQ⟩ + have hy_ab : y ∈ ({η'.vMap a, η'.vMap b} : Set α) := + hP.2.2.2.2.2.1 ▸ ⟨hyP, hQ_H'.le.vertexSet_mono hyQ⟩ + rcases hy_ab with rfl | rfl + · exfalso + have ha_in_Q : η.vMap a ∈ V(Q) ∩ V(η.imageGraph) := + ⟨hva_eq ▸ hyQ, η.bijOn_v.mapsTo haH⟩ + rw [hQV_H, mem_singleton_iff] at ha_in_Q + exact hvac_ne ha_in_Q + · rfl + · rintro rfl + exact ⟨hP.2.1.right_mem, hQ_H'.left_mem⟩ + let P_union := subgraphUnion G P Q + have hPu_path : IsGraphPathWithEnds G P_union (η.vMap a) (η.vMap c) := + (hva_eq ▸ hP.2.1).subgraphUnion hQ_G hVP_Q + have hVPu_H : V(P_union) ∩ V(η.imageGraph) = {η.vMap a, η.vMap c} := by + rw [vertexSet_subgraphUnion, union_inter_distrib_right, hVP_H, hQV_H] + rfl + have hEPu_H : Disjoint E(P_union) E(η.imageGraph) := by + rw [edgeSet_subgraphUnion hP.2.1.le hQ_G.le, disjoint_union_left] + refine ⟨?_, hEQ_H⟩ + refine Set.disjoint_left.mpr fun e heP heH => ?_ + obtain ⟨u₁, u₂, hlinkP⟩ := exists_isLink_of_mem_edgeSet heP + have hlinkG : G.IsLink e u₁ u₂ := hlinkP.mono hP.2.1.le + have hlinkH : η.imageGraph.IsLink e u₁ u₂ := (η.imageGraph_le.isLink_iff heH).mpr hlinkG + have hu₁ : u₁ = η.vMap a := by + have : u₁ ∈ V(P) ∩ V(η.imageGraph) := ⟨hlinkP.left_mem, hlinkH.left_mem⟩ + rwa [hVP_H, mem_singleton_iff] at this + have hu₂ : u₂ = η.vMap a := by + have : u₂ ∈ V(P) ∩ V(η.imageGraph) := ⟨hlinkP.right_mem, hlinkH.right_mem⟩ + rwa [hVP_H, mem_singleton_iff] at this + exact hP.2.1.not_isLink_self (hu₁ ▸ hu₂ ▸ hlinkP) + have hPu_HPath : IsHPathWithEnds G η.imageGraph P_union (η.vMap a) (η.vMap c) := + ⟨η.imageGraph_le, hPu_path, hvac_ne, η.bijOn_v.mapsTo haH, η.bijOn_v.mapsTo hcH, + hVPu_H, hEPu_H⟩ + have htri_ac := hd_tri z hRearr.z_mem {c} hc_A {a} hx_a + have hsym_ac := hd_symm {a} hx_a {c} hc_A + exact hLevel.not_stepped ⟨P_union, a, c, haH, hcH, hPu_HPath, by omega⟩ + +/-- Statement of Graph Minors XV, (8.4) (page 148): +"For any surface $\Sigma$ with $bd(\Sigma) = \emptyset$, and any integers $p, \phi, \mu \ge 0$, +there are integers $\kappa, \theta, \lambda, \rho \ge 0$ such that the following holds. Let +$\mathscr{T}^*$ be a tangle in a graph $G$ such that there is no $\mathscr{T}^*$-central +segregation of $G$ of type $(\rho, \kappa)$ with an arrangement in $\Sigma$. Then either +(i) $\mathscr{T}^*$ controls a $K_p$ minor of $G$, or +(ii) there is a $\Sigma'$-span of order $\ge \phi$, where $\Sigma'$ is a surface obtained by adding +a crosscap to $\Sigma$, or +(iii) no $\Sigma$-span of order $\ge \theta$ is $(\lambda, \mu)$-level." -/ +def GM15Theorem84Statement : Prop := + ∀ (S : Type w) [TopologicalSpace S] [T2Space S], + IsSurface S → ConnectedSpace S → bd S = ∅ → + ∀ (p φ μ : ℕ), + ∃ (κ θ lam ρ : ℕ), + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)), + ¬ Section7S3 S G T_star ρ κ → + ControlsCliqueMinor G p T_star ∨ + (∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S'), + IsObtainedByAddingCrosscap S S' ∧ + ∃ (H' : Drawing S') (η' : SpanEmbedding H' G) (θ' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + φ ≤ θ' ∧ IsSigmaSpan G H' η' θ_star θ' T_star T') ∨ + (∀ (H₀ : Drawing S) (η₀ : SpanEmbedding H₀ G) (θ₀ : ℕ) + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ), + θ ≤ θ₀ → ¬ IsLevelSpan G H₀ η₀ θ_star θ₀ lam μ T_star T₀ d₀) + +/-- **Graph Minors XV, (8.4)** (page 148): +"Choose $\kappa, \theta, \lambda', \rho$ to satisfy (8.2). Let $\lambda = \lambda' + \mu + +2$; and we claim that (8.4) holds. For let $\mathscr{T}^*, G$ be as (8.4). By (8.2), we may +assume that no $\Sigma$-span of order $\ge \theta$ is $(\lambda', \mu)$-flat. By (8.3), no +$\Sigma$-span of order $\ge \theta$ is $(\lambda, \mu)$-level, as required." -/ +theorem theorem_8_4_proof + : + GM15Theorem84Statement.{u, v, w} := by + have h82 : GM15Theorem82Statement.{u, v, w} := + theorem_8_2_proof + have h83 : GM15Theorem83Statement.{u, v, w} := theorem_8_3_proof + intro S _ _ hSurf hConn hBd p φ μ + obtain ⟨κ, θ₁, lam', ρ, h⟩ := h82 S hSurf hConn hBd p φ μ + refine ⟨κ, max θ₁ (4 * (lam' + μ + 2) + 3), lam' + μ + 2, ρ, ?_⟩ + intro α β G θ_star T_star hNoS3 + rcases h G θ_star T_star hNoS3 with hClique | hCross | hNotFlat + · exact Or.inl hClique + · exact Or.inr (Or.inl hCross) + · right; right + intro H₀ η₀ θ₀ T₀ d₀ hθ_le hLevel + exact hNotFlat H₀ η₀ θ₀ T₀ d₀ ((le_max_left _ _).trans hθ_le) hLevel.hasMetric + (h83 G H₀ η₀ θ_star θ₀ lam' μ T_star T₀ d₀ + (by have := (le_max_right θ₁ (4 * (lam' + μ + 2) + 3)).trans hθ_le; omega) hLevel) + +end GraphMinor.GM15 diff --git a/LeanPool/GraphMinor/GM16/AnnularComposition.lean b/LeanPool/GraphMinor/GM16/AnnularComposition.lean new file mode 100644 index 0000000000..9c6b7d208a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/AnnularComposition.lean @@ -0,0 +1,131 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.Surface.Defs +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM16.DrawingGraphPaths +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.Section88 + +/-! +# Composition along the inner circle of an annulus + +Split the drawing in the outer disc into its inner-disc part and +its annular part. Assign the edges on the inner circle to the +annular part. The two parts then form a separation, whose common +vertices are exactly the inner boundary vertices. This is the +society composition required in XVI (8.1), Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM06 GraphMinor.GM11 + GraphMinor.GM14 +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +omit [ConnectedSpace S] in +/-- A drawn annulus composes with the graph inside its inner circle. +All common boundary edges are assigned to the annular graph. -/ +theorem exists_annular_composition (H : Drawing S) {D E : Set S} + (hD : IsClosed D) (hE : IsClosed E) (hED : E ⊆ D) + (hCircle : IsOArc (frontier E)) (hBd : frontier E ⊆ H.U) + (N : Neighborhood S (Set S)) + (hNG : N.G = (H.interSet (D \ interior E)).toGraph) + (hInner : N.Ω₀.bar = (H.interSet (D \ interior E)).V ∩ frontier E) : + ∃ S_comp S₀ : Society S (Set S), + S_comp.G = (H.interSet D).toGraph ∧ S_comp.Ω = N.Ω ∧ + S₀.G = (H.interSet E).toGraph.deleteEdges E(N.G) ∧ + S_comp.IsComposition S₀ N := by + classical + let A := D \ interior E + have hA : IsClosed A := hD.sdiff isOpen_interior + let J := H.interSet D + let Q := H.interSet A + let K := H.interSet E + have hQH : Q.IsSubdrawing H := interSet_isSub + have hKH : K.IsSubdrawing H := interSet_isSub + have hQJ : Q.IsSubdrawing J := subdrawing_interSet_of_U_subset hQH + ((interSet_U_subset hA).trans sdiff_subset) + have hKJ : K.IsSubdrawing J := subdrawing_interSet_of_U_subset hKH + ((interSet_U_subset hE).trans hED) + have hQle : Q.toGraph ≤ J.toGraph := toGraph_le_of_isSubdrawing hQJ + have hKle : K.toGraph ≤ J.toGraph := toGraph_le_of_isSubdrawing hKJ + have hNG' : N.G = Q.toGraph := hNG + let R := K.toGraph.deleteEdges E(N.G) + have hRle : R ≤ J.toGraph := deleteEdges_le.trans hKle + have hV : V(R) ∪ V(N.G) = V(J.toGraph) := by + rw [hNG'] + change K.V ∪ Q.V = J.V + ext x + simp only [K, Q, J, mem_union, mem_interSet_V_iff hE, mem_interSet_V_iff hA, + mem_interSet_V_iff hD] + change (x ∈ H.V ∧ x ∈ E) ∨ (x ∈ H.V ∧ x ∈ D ∧ x ∉ interior E) ↔ + x ∈ H.V ∧ x ∈ D + constructor + · rintro (⟨hx, hxe⟩ | ⟨hx, hxd, _⟩) + · exact ⟨hx, hED hxe⟩ + · exact ⟨hx, hxd⟩ + · rintro ⟨hx, hxd⟩ + by_cases hxe : x ∈ E + · exact Or.inl ⟨hx, hxe⟩ + · exact Or.inr ⟨hx, hxd, fun hxi => hxe (interior_subset hxi)⟩ + have hEdgeCover : K.E ∪ Q.E = J.E := by + ext e + simp only [K, Q, J, mem_union, mem_interSet_E_iff] + constructor + · rintro (⟨he, heE⟩ | ⟨he, heA⟩) + · exact ⟨he, heE.trans hED⟩ + · exact ⟨he, heA.trans sdiff_subset⟩ + · rintro ⟨he, heD⟩ + rcases edge_subset_or_disjoint_of_isOArc hCircle hBd he with heb | hed + · exact Or.inl ⟨he, heb.trans hE.frontier_subset⟩ + · rcases GM14.subset_or_disjoint_of_frontier hE he.2.2.1.isConnected.isPreconnected hed with + hs | hd + · exact Or.inl ⟨he, hs⟩ + · exact Or.inr ⟨he, fun x hx => ⟨heD hx, fun hxi => + hd.notMem_of_mem_left hx (interior_subset hxi)⟩⟩ + have hEdges : E(R) ∪ E(N.G) = E(J.toGraph) := by + change (K.E \ E(N.G)) ∪ E(N.G) = J.E + rw [hNG'] + change (K.E \ Q.E) ∪ Q.E = J.E + rw [← hEdgeCover] + ext e + simp only [mem_union, mem_sdiff] + tauto + have hInter : V(R) ∩ V(N.G) = N.Ω₀.bar := by + rw [hInner, hNG'] + change K.V ∩ Q.V = Q.V ∩ frontier E + ext x + simp only [K, mem_inter_iff, mem_interSet_V_iff hE] + constructor + · rintro ⟨⟨hxH, hxE⟩, hxQ⟩ + have hxOut : x ∉ interior E := ((mem_interSet_V_iff hA).mp hxQ).2.2 + exact ⟨hxQ, subset_closure hxE, hxOut⟩ + · rintro ⟨hxQ, hxf⟩ + exact ⟨⟨((mem_interSet_V_iff hA).mp hxQ).1, hE.frontier_subset hxf⟩, hxQ⟩ + let S_comp : Society S (Set S) := + ⟨J.toGraph, N.Ω, J.finite_V, J.finite_edges, + fun x hx => hQle.vertexSet_mono (hNG' ▸ N.bar_subset hx)⟩ + let S₀ : Society S (Set S) := + ⟨R, N.Ω₀, K.finite_V, K.finite_edges.subset sdiff_subset, + fun x hx => (hInter.symm ▸ hx).1⟩ + refine ⟨S_comp, S₀, rfl, rfl, rfl, ?_, rfl, rfl, hInter.symm⟩ + refine ⟨⟨hRle, hNG'.symm ▸ hQle, hV, hEdges, ?_⟩, N.bar_subset⟩ + change Disjoint (K.E \ E(N.G)) E(N.G) + exact disjoint_sdiff_left + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/AnnularPathTrim.lean b/LeanPool/GraphMinor/GM16/AnnularPathTrim.lean new file mode 100644 index 0000000000..bd8bc50e82 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/AnnularPathTrim.lean @@ -0,0 +1,85 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM16.DrawingGraphPaths +import LeanPool.GraphMinor.GM16.LineBoundarySide +import LeanPool.GraphMinor.GM16.Section9Attachments +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.Section7 +import LeanPool.GraphMinor.Surface.ArcTools + +/-! +# Trimming a path at an inner circle + +Keep the subpath from its outside end to its first vertex on the +inner circle. It has no other vertex on that circuit and no edge of +the circuit, so its point set also meets the circle only at that end. +Connectedness then keeps it outside the inner disc. This is the +trimming used for linkedness in XVI (8.1), Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- A path from an inner circle to a point outside its closed disc +has a terminal subpath lying outside the disc interior. -/ +theorem exists_annular_terminal_path {H C P : Drawing S} {D E : Set S} {a b : S} + (hC : C.IsSubdrawing H) (hP : P.IsSubdrawing H) + (hPath : P.IsPathBetween a b) (ha : a ∈ C.V) + (hD : IsClosed D) (hBd : frontier D = C.U) (hb : b ∉ D) + (hPE : P.U ⊆ E) : + ∃ c ∈ C.V, ∃ J : Drawing S, + J.IsPathBetween b c ∧ J.IsSubdrawing P ∧ + J.U ⊆ E \ interior D ∧ J.V ∩ C.V = {c} ∧ J.U ∩ C.U = {c} := by + have hPG := graphPath_of_drawingPath hP hPath + obtain ⟨b', hb', c, hc, R, hRP, hR⟩ := + hPG.symm.exists_isFromToPathWithEnds (mem_singleton b) ha + have hbb : b' = b := mem_singleton_iff.mp hb' + subst b' + obtain ⟨J, hJPath, hJH, hJR⟩ := exists_drawing_of_graphPath hR.1 + have hJP : J.IsSubdrawing P := by + constructor + · intro x hx + have hxR : x ∈ V(R) := hJR ▸ hx + exact hRP.vertexSet_mono hxR + · intro e he + have heR : e ∈ E(R) := hJR ▸ he + exact hRP.edgeSet_mono heR + have hJV : J.V ∩ C.V = {c} := by + change V(J.toGraph) ∩ V(C.toGraph) = {c} + rw [hJR] + exact hR.2.2 + have hEdges : Disjoint J.E C.E := by + change Disjoint E(J.toGraph) E(C.toGraph) + rw [hJR] + exact path_edges_disjoint_of_singleton_inter + (toGraph_le_of_isSubdrawing hC) hR.1 hR.2.2.subset + have hInter : J.U ∩ frontier D = {c} := by + rw [hBd, U_inter_of_disjoint hJH hC hEdges, hJV] + have hbc : b ≠ c := by + intro heq + have hcD : c ∈ D := hD.frontier_subset (hBd.symm ▸ C.V_subset_U hc) + exact hb (heq.symm ▸ hcD) + have hLine := isLine_of_isPathBetween hJPath hbc + have hAvoid : Disjoint J.U (interior D) := + line_avoids_interior_of_boundary_start hD (Surface.IsLineWithEnds.symm hLine) + (hBd.symm ▸ C.V_subset_U hc) hb hInter.subset + refine ⟨c, hc, J, hJPath, hJP, ?_, hJV, ?_⟩ + · intro x hx + exact ⟨hPE (hJP.U_subset hx), fun hxi => hAvoid.notMem_of_mem_left hx hxi⟩ + · rwa [hBd] at hInter + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/AnnulusBreadth.lean b/LeanPool/GraphMinor/GM16/AnnulusBreadth.lean new file mode 100644 index 0000000000..737a0c32c0 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/AnnulusBreadth.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.Surface.Defs +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Drawing a nest in a rural presentation + +Disjoint circuits bounding nested closed discs give a nest in the +plane presentation obtained by transporting the enclosing disc. +This identifies the geometric nest in XVI (8.1), Claim (11), with +the breadth required by IX (10.5). +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 +universe u +variable {S : Type u} [TopologicalSpace S] + +/-- Nested discs bounded by disjoint subdrawing circuits witness +breadth in the transported presentation. -/ +theorem hasBreadthGe_of_drawing_nest {N : Neighborhood S (Set S)} + (P : Presentation N) (Q : Drawing S) (hG : N.G = Q.toGraph) + {D D₀ : Set S} {f : S → EuclideanPlane} + (hΔ : P.Δ = f '' D) (hΔ₀ : P.Δ₀ = f '' D₀) + (hdisc : ∀ E ⊆ D, IsClosedDisc E → + IsClosedDisc (f '' E) ∧ subBd (f '' E) = f '' discBd E) + (hpoints : ∀ J : Drawing S, J.IsSubdrawing Q → + graphDrawingSubgraphU P.Γ J.toGraph = f '' J.U) + {s : ℕ} (K : Fin s → Drawing S) (E : Fin s → Set S) + (hK : ∀ i, (K i).IsSubdrawing Q ∧ (K i).IsCircuit) + (hDis : Pairwise (fun i j => Disjoint (K i).U (K j).U)) + (hE : ∀ i, IsClosedDisc (E i) ∧ discBd (E i) = (K i).U ∧ D₀ ⊆ E i ∧ E i ⊆ D) + (hNest : ∀ i j, i ≤ j → E i ⊆ E j) : N.HasBreadthGe s := by + refine ⟨P, fun i => (K i).toGraph, ?_, ?_, fun i => f '' E i, ?_, ?_, ?_⟩ + · intro i + rw [hG] + refine ⟨⟨(hK i).1.1, ?_⟩, (hK i).2⟩ + intro e x y hl + exact ((hK i).1.isLink_iff hl.1).mp hl + · intro i j hij + exact (hDis hij).mono (K i).V_subset_U (K j).V_subset_U + · intro i + obtain ⟨hEi, hBd, _, hED⟩ := hE i + obtain ⟨hFi, hFb⟩ := hdisc (E i) hED hEi + refine ⟨hFi, ?_⟩ + change subBd (f '' E i) = graphDrawingSubgraphU P.Γ (K i).toGraph + rw [hFb, hBd, hpoints (K i) (hK i).1] + · intro i + rw [hΔ₀, hΔ] + exact ⟨image_mono (hE i).2.2.1, image_mono (hE i).2.2.2⟩ + · intro i j hij + exact image_mono (hNest i j hij) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/AnnulusConnected.lean b/LeanPool/GraphMinor/GM16/AnnulusConnected.lean new file mode 100644 index 0000000000..2425a25f67 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/AnnulusConnected.lean @@ -0,0 +1,102 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM06.Defs +import LeanPool.GraphMinor.GM16.ConnectedTwoBoundaries +import LeanPool.GraphMinor.GM16.AnnulusCrossing +import LeanPool.GraphMinor.GM16.AnnulusIncidentEdges +import LeanPool.GraphMinor.GM16.DrawingGraphPaths +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.Section88 + +/-! +# Connectivity of the annular subdrawing + +The two zone boundaries are circuits in the annular subdrawing. +A crossing path joins them. Every edge at a vertex on neither +boundary is retained, so connectedness of the original drawing +implies connectedness of the annular subdrawing. This supplies the +connectivity assertion in XVI (8.1), Claim (14). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM11 GraphMinor.GM14 +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- An annulus between nested drawn zone boundaries is connected +when a path inside it joins the two boundary circles. -/ +theorem annular_subdrawing_isGraphConnected {H J : Drawing S} + {d : Set S → Set S → ℕ} {γ δ : ℕ} {z w I O : Set S} {a b : S} + (hI : IsLambdaZoneAround H d γ z I) (hO : IsLambdaZoneAround H d δ w O) + (hNest : closure I ⊆ O) (hH : IsGraphConnected H.toGraph) + (hJ : J.IsSubdrawing (H.interSet (closure O \ I))) + (hPath : J.IsPathBetween a b) (ha : a ∈ H.V ∩ subBd I) (hb : b ∈ H.V ∩ subBd O) : + IsGraphConnected (H.interSet (closure O \ I)).toGraph := by + let Q := H.interSet (closure O \ I) + let C := H.interSet (subBd I) + let D := H.interSet (subBd O) + have hCU : C.U = subBd I := by + apply subset_antisymm + · exact interSet_U_subset (by rw [subBd_eq_frontier]; exact isClosed_frontier) + · exact oArc_subset_interSet_U hI.isOArc_bd hI.bd_subset_U Subset.rfl + have hDU : D.U = subBd O := by + apply subset_antisymm + · exact interSet_U_subset (by rw [subBd_eq_frontier]; exact isClosed_frontier) + · exact oArc_subset_interSet_U hO.isOArc_bd hO.bd_subset_U Subset.rfl + have hCV : C.V = H.V ∩ subBd I := by + ext x + exact mem_interSet_V_iff (by rw [subBd_eq_frontier]; exact isClosed_frontier) + have hDV : D.V = H.V ∩ subBd O := by + ext x + exact mem_interSet_V_iff (by rw [subBd_eq_frontier]; exact isClosed_frontier) + have hDisI := (isOpen_disjoint_subBd_and_closure_eq hI.isOpenDisc.1).1 + have hDisO := (isOpen_disjoint_subBd_and_closure_eq hO.isOpenDisc.1).1 + have hCQ : C.IsSubdrawing Q := by + apply subdrawing_interSet_of_U_subset interSet_isSub + rw [hCU] + intro x hx + exact ⟨subset_closure (hNest hx.1), fun hxi => hDisI.notMem_of_mem_left hxi hx⟩ + have hDQ : D.IsSubdrawing Q := by + apply subdrawing_interSet_of_U_subset interSet_isSub + rw [hDU] + intro x hx + exact ⟨hx.1, fun hxi => hDisO.notMem_of_mem_left (hNest (subset_closure hxi)) hx⟩ + obtain ⟨W, _, _, _⟩ := hPath + obtain ⟨W', _, _⟩ := hJ.exists_walk_up W + apply isGraphConnected_of_two_boundaries + (toGraph_le_of_isSubdrawing (interSet_isSub (Γ := H))) hH + (toGraph_le_of_isSubdrawing hCQ) (toGraph_le_of_isSubdrawing hDQ) + (circuit_drawing_isGraphConnected (interSet_isCircuit_of_oArc hI.isOArc_bd hI.bd_subset_U)) + (circuit_drawing_isGraphConnected (interSet_isCircuit_of_oArc hO.isOArc_bd hO.bd_subset_U)) + (show a ∈ C.V from hCV.symm ▸ ha) (show b ∈ D.V from hDV.symm ▸ hb) W' + intro e x y hl hx hnot + apply annular_subdrawing_keeps_edges hI hO hl hx + simpa only [show V(C.toGraph) = H.V ∩ subBd I from hCV, + show V(D.toGraph) = H.V ∩ subBd O from hDV] using hnot + +/-- The full connectivity assertion used in XVI (8.1), Claim (14), +page 74: a connected drawing restricted between two nested zone +boundaries is connected. The crossing path is derived from ambient +connectedness rather than assumed. -/ +theorem annular_subdrawing_connected (hS : IsClosedSurface S) {H : Drawing S} + {d : Set S → Set S → ℕ} {γ δ : ℕ} {z w I O : Set S} + (hI : IsLambdaZoneAround H d γ z I) (hO : IsLambdaZoneAround H d δ w O) + (hNest : closure I ⊆ O) (hH : IsGraphConnected H.toGraph) : + IsGraphConnected (H.interSet (closure O \ I)).toGraph := by + obtain ⟨a, ha, b, hb, J, hPath, hJ⟩ := exists_annular_crossing_path hS hI hO hNest hH + exact annular_subdrawing_isGraphConnected hI hO hNest hH hJ hPath ha hb + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/AnnulusCrossing.lean b/LeanPool/GraphMinor/GM16/AnnulusCrossing.lean new file mode 100644 index 0000000000..e25377aa66 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/AnnulusCrossing.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM06.Defs +import LeanPool.GraphMinor.GM16.AnnularPathTrim +import LeanPool.GraphMinor.GM16.ZoneBoundaryLinkage +import LeanPool.GraphMinor.GM16.DrawingGraphPaths +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM14.Section6a +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.Section88 + +/-! +# A crossing path between two nested zone boundaries + +Connectedness gives a path between the two boundary circuits. +First trim it into the outer closed zone, then at its last visit to +the inner circuit. The remaining path lies in the annulus and joins +its boundary circles. This completes the setup for the connectivity +argument of XVI (8.1), Claim (14). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM11 + GraphMinor.GM14 +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- A connected drawing has a crossing path in the annulus between +two nested drawn zone boundaries. -/ +theorem exists_annular_crossing_path (hS : IsClosedSurface S) {H : Drawing S} + {d : Set S → Set S → ℕ} {γ δ : ℕ} {z w I O : Set S} + (hI : IsLambdaZoneAround H d γ z I) (hO : IsLambdaZoneAround H d δ w O) + (hNest : closure I ⊆ O) (hH : IsGraphConnected H.toGraph) : + ∃ a ∈ H.V ∩ subBd I, ∃ b ∈ H.V ∩ subBd O, ∃ J : Drawing S, + J.IsPathBetween a b ∧ J.IsSubdrawing (H.interSet (closure O \ I)) := by + classical + let C := H.interSet (subBd I) + let D := H.interSet (subBd O) + have hC := interSet_isCircuit_of_oArc hI.isOArc_bd hI.bd_subset_U + have hD := interSet_isCircuit_of_oArc hO.isOArc_bd hO.bd_subset_U + have hCV : C.V = H.V ∩ subBd I := by + ext x + exact mem_interSet_V_iff (by rw [subBd_eq_frontier]; exact isClosed_frontier) + have hDV : D.V = H.V ∩ subBd O := by + ext x + exact mem_interSet_V_iff (by rw [subBd_eq_frontier]; exact isClosed_frontier) + obtain ⟨a, W₁, _, _, haV, _⟩ := hC + obtain ⟨b, W₂, _, _, hbV, _⟩ := hD + have ha : a ∈ H.V ∩ subBd I := hCV ▸ (haV.symm ▸ W₁.start_mem_support) + have hb : b ∈ H.V ∩ subBd O := hDV ▸ (hbV.symm ▸ W₂.start_mem_support) + obtain ⟨W⟩ := hH.2 a ha.1 b hb.1 + obtain ⟨P, hP, _, _⟩ := exists_isGraphPathWithEnds_of_walk W + obtain ⟨L, hLPath, hLH, _⟩ := exists_drawing_of_graphPath hP + have hA : H.V ∩ subBd I ⊆ O := fun _ hx => hNest hx.2.1 + obtain ⟨Q, hQ, _⟩ := linkage_inside_closed_zone hO hA (fun _ : Fin 1 => L) + (fun _ => ⟨a, ha, b, hb, hLPath, hLH⟩) + (fun i j hij => False.elim (hij (Subsingleton.elim i j))) + obtain ⟨b', a', hR⟩ := hQ 0 + have hb' : b' ∈ H.V ∩ subBd O := by + have hmem := hR.1.left_mem + exact (hR.2.1 ▸ (show b' ∈ ({b'} : Set S) from rfl)).2 + have ha' : a' ∈ H.V ∩ subBd I := + (hR.2.2 ▸ (show a' ∈ ({a'} : Set S) from rfl)).2 + obtain ⟨R, hRPath, hRSub, _⟩ := exists_drawing_of_graphPath hR.1.symm + have hCU : C.U = subBd I := by + apply subset_antisymm + · exact interSet_U_subset (by rw [subBd_eq_frontier]; exact isClosed_frontier) + · exact oArc_subset_interSet_U hI.isOArc_bd hI.bd_subset_U Subset.rfl + have hfr : frontier (closure I) = subBd I := by + rw [← subBd_eq_frontier] + exact subBd_closure_eq_subBd_of_isOpenDisc hS hI.isOpenDisc hI.isOArc_bd hI.isClosedDisc_closure + have hInt : interior (closure I) = I := by + rw [← self_sdiff_frontier, hfr, subBd_eq_frontier, closure_sdiff_frontier, + hI.isOpenDisc.1.interior_eq] + have hbOut : b' ∉ closure I := fun h => + ((isOpen_disjoint_subBd_and_closure_eq hO.isOpenDisc.1).1).notMem_of_mem_left (hNest h) hb'.2 + have hRInside : R.U ⊆ closure O := fun _ hx => interSet_U_subset isClosed_closure + (hRSub.U_subset hx) + obtain ⟨c, hc, J, hJPath, hJR, hJU, _, _⟩ := exists_annular_terminal_path + (interSet_isSub (Γ := H)) (hRSub.trans interSet_isSub) hRPath (hCV.symm ▸ ha') + isClosed_closure (hfr.trans hCU.symm) hbOut hRInside + refine ⟨c, hCV ▸ hc, b', hb', J, drawingPath_symm hJPath, ?_⟩ + apply subdrawing_interSet_of_U_subset (hJR.trans (hRSub.trans interSet_isSub)) + rwa [hInt] at hJU + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/AnnulusIncidentEdges.lean b/LeanPool/GraphMinor/GM16/AnnulusIncidentEdges.lean new file mode 100644 index 0000000000..0249721d36 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/AnnulusIncidentEdges.lean @@ -0,0 +1,68 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.Section88 + +/-! +# Edges at interior vertices of an annulus + +An edge cannot cross either drawn zone boundary. At a vertex of the +closed annulus on neither boundary, every incident edge is therefore +retained in the annular subdrawing. This is the local condition used +to prove the connectedness assertion in XVI (8.1), Claim (14). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- The annular subdrawing retains every incident edge at a vertex +away from its two boundary circles. -/ +theorem annular_subdrawing_keeps_edges {H : Drawing S} + {d : Set S → Set S → ℕ} {γ δ : ℕ} {z w I O : Set S} + (hI : IsLambdaZoneAround H d γ z I) (hO : IsLambdaZoneAround H d δ w O) + {e : Set S} {x y : S} (hl : H.toGraph.IsLink e x y) + (hx : x ∈ (H.interSet (closure O \ I)).V) + (hNot : x ∉ (H.V ∩ subBd I) ∪ (H.V ∩ subBd O)) : + (H.interSet (closure O \ I)).toGraph.IsLink e x y := by + have hClosed : IsClosed (closure O \ I) := isClosed_closure.sdiff hI.isOpenDisc.1 + obtain ⟨hxH, hxO, hxI⟩ := (mem_interSet_V_iff hClosed).mp hx + have hxNotI : x ∉ subBd I := fun h => hNot (Or.inl ⟨hxH, h⟩) + have hxNotO : x ∉ subBd O := fun h => hNot (Or.inr ⟨hxH, h⟩) + have hclI := (isOpen_disjoint_subBd_and_closure_eq hI.isOpenDisc.1).2 + have hclO := (isOpen_disjoint_subBd_and_closure_eq hO.isOpenDisc.1).2 + have hxOpenO : x ∈ O := by + rw [hclO] at hxO + exact hxO.resolve_right hxNotO + have hxNotClI : x ∉ closure I := by + rw [hclI] + exact fun h => h.elim hxI hxNotI + have heO : e ⊆ O := by + rcases edge_subset_or_subset_compl_of_zone hO hl.1 with h | h + · exact h + · have hc := closure_minimal h (isClosed_univ.sdiff hO.isOpenDisc.1) + exact False.elim ((hc (hl.2.2.2.symm ▸ (show x ∈ ({x, y} : Set S) from Or.inl rfl)).1).2 + hxOpenO) + have heI : e ⊆ univ \ I := by + rcases edge_subset_or_subset_compl_of_zone hI hl.1 with h | h + · have hc := closure_mono h + have hxcl : x ∈ closure e := (hl.2.2.2.symm ▸ (show x ∈ ({x, y} : Set S) from Or.inl rfl)).1 + exact False.elim (hxNotClI (hc hxcl)) + · exact h + have heNew : e ∈ (H.interSet (closure O \ I)).E := + mem_interSet_E_iff.mpr ⟨hl.1, fun t ht => ⟨subset_closure (heO ht), (heI ht).2⟩⟩ + exact ((interSet_isSub (Γ := H)).isLink_iff heNew).mpr hl + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/AnnulusPathIntersection.lean b/LeanPool/GraphMinor/GM16/AnnulusPathIntersection.lean new file mode 100644 index 0000000000..fae880174e --- /dev/null +++ b/LeanPool/GraphMinor/GM16/AnnulusPathIntersection.lean @@ -0,0 +1,47 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.PathCrossesZone +import LeanPool.GraphMinor.GM16.DrawingGraphPaths +import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.GM11.Section810 + +/-! +# The clean path meets the annular subdrawing + +A path from inside the outer zone to outside it contains a vertex +on that zone boundary. Since the inner closed zone lies strictly +inside the outer zone, this vertex belongs to the annular subdrawing. +This is the intersection assertion in XVI (8.1), Claim (14). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- Crossing the outer boundary of an annulus gives a common vertex +with its annular subdrawing. -/ +theorem drawingPath_meets_annular_subdrawing {H P : Drawing S} + {d : Set S → Set S → ℕ} {γ δ : ℕ} {z w I O : Set S} {a b : S} + (hI : IsLambdaZoneAround H d γ z I) (hO : IsLambdaZoneAround H d δ w O) + (hNest : closure I ⊆ O) (hP : P.IsSubdrawing H) (hPath : P.IsPathBetween a b) + (ha : a ∈ O) (hb : b ∉ O) : + (P.V ∩ (H.interSet (closure O \ I)).V).Nonempty := by + obtain ⟨v, hvP, hvH, hvBd⟩ := drawingPath_meets_zone_boundary hO hP hPath ha hb + have hvNot : v ∉ I := fun hvi => + ((isOpen_disjoint_subBd_and_closure_eq hO.isOpenDisc.1).1).notMem_of_mem_left + (hNest (subset_closure hvi)) hvBd + refine ⟨v, hvP, (mem_interSet_V_iff (isClosed_closure.sdiff hI.isOpenDisc.1)).mpr ?_⟩ + exact ⟨hvH, hvBd.1, hvNot⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/AnnulusPresentation.lean b/LeanPool/GraphMinor/GM16/AnnulusPresentation.lean new file mode 100644 index 0000000000..4d3cb435d1 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/AnnulusPresentation.lean @@ -0,0 +1,135 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.Surface.PlaneDisc +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import LeanPool.GraphMinor.GM16.DiscPlaneCoordinates +import LeanPool.GraphMinor.GM16.DrawingTransportIso +import LeanPool.GraphMinor.GM16.DrawingTransportPoints +import LeanPool.GraphMinor.GM16.DrawingBoundaryOrders +import LeanPool.GraphMinor.GM11.Section7 + +/-! +# A rural presentation of a drawn annulus + +Carry the outer closed disc to the plane. The inner disc and all its +boundary points retain their images, so a drawing between these two +discs gives a rural neighborhood. Keep the point-set formula for +subdrawings, so that nested circuits also give a nest in this same +presentation. This is the topological setup of XVI (8.1), Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 +universe u v + +/-- A parametrization transports point by point under a map with a +continuous inverse on the containing set. -/ +theorem transport_circle_parametrization {S : Type u} {T : Type v} + [TopologicalSpace S] [TopologicalSpace T] + {D F : Set S} {F' : Set T} {f : S → T} {g : T → S} + (hf : ContinuousOn f D) (hg : ContinuousOn g (f '' D)) + (hgf : LeftInvOn g f D) (hFD : F ⊆ D) (hF' : F' = f '' F) + (φ : Circle ≃ₜ F) : + ∃ φ' : Circle ≃ₜ F', ∀ z, (φ' z).val = f (φ z).val := by + obtain ⟨e, he⟩ := exists_homeomorph_image (hf.mono hFD) + (hg.mono (image_mono hFD)) (fun _ hx => hgf (hFD hx)) + exact ⟨φ.trans (e.trans (Homeomorph.setCongr hF'.symm)), fun z => he (φ z)⟩ + +theorem transport_clockwise_circle_parametrization {S : Type u} [TopologicalSpace S] + {D F : Set S} {E : Set EuclideanPlane} (hE : IsClosedDisc E) {f : S → EuclideanPlane} + {g : EuclideanPlane → S} (hf : ContinuousOn f D) (hg : ContinuousOn g (f '' D)) + (hgf : LeftInvOn g f D) (hFD : F ⊆ D) (hbd : subBd E = f '' F) (φ : Circle ≃ₜ F) : + ∃ (ψ : Circle ≃ₜ F) (ψ' : Circle ≃ₜ subBd E), + IsClockwiseDiscHomeo E ψ' ∧ ∀ z, (ψ' z).val = f (ψ z).val := by + obtain ⟨φ', hφ'⟩ := transport_circle_parametrization hf hg hgf hFD hbd φ + rcases isClockwiseDiscHomeo_or_inv hE rfl φ' with hcw | hcw + · exact ⟨φ, φ', hcw, hφ'⟩ + · exact ⟨(Homeomorph.inv Circle).trans φ, (Homeomorph.inv Circle).trans φ', + hcw, fun z => hφ' z⁻¹⟩ + +variable {S : Type u} [TopologicalSpace S] [T2Space S] [CompactSpace S] [Nonempty S] + +/-- A drawing between two closed discs has a rural presentation. +The orders are the orders of its vertices on the two circles. -/ +theorem exists_annular_presentation (Q : Drawing S) {D D₀ : Set S} + (hD : IsClosedDisc D) (hD₀ : IsClosedDisc D₀) (hD₀D : D₀ ⊆ D) + (hQ : Q.U ⊆ D \ discInt D₀) + (hne : (Q.V ∩ discBd D).Nonempty) (hne₀ : (Q.V ∩ discBd D₀).Nonempty) : + ∃ (N : Neighborhood S (Set S)) (P : Presentation N) (f : S → EuclideanPlane), + N.G = Q.toGraph ∧ N.Ω.bar = Q.V ∩ discBd D ∧ + N.Ω₀.bar = Q.V ∩ discBd D₀ ∧ Continuous f ∧ InjOn f D ∧ + P.Δ = f '' D ∧ P.Δ₀ = f '' D₀ ∧ + (∀ E ⊆ D, IsClosedDisc E → + IsClosedDisc (f '' E) ∧ subBd (f '' E) = f '' discBd E) ∧ + ∀ J : Drawing S, J.IsSubdrawing Q → + graphDrawingSubgraphU P.Γ J.toGraph = f '' J.U := by + classical + obtain ⟨f, g, hf, hi, hg, hgf, hdisc⟩ := exists_plane_disc_coordinates hD + obtain ⟨Γ, hU, hV, hv, he⟩ := exists_graphDrawing_transport Q hf + (hi.mono (fun _ hx => (hQ hx).1)) + obtain ⟨hΔ, hbd⟩ := hdisc D Subset.rfl hD + obtain ⟨hΔ₀, hbd₀⟩ := hdisc D₀ hD₀D hD₀ + obtain ⟨φ_orig⟩ := hD.isOArc_discBd + obtain ⟨φ₀_orig⟩ := hD₀.isOArc_discBd + obtain ⟨φ, φ', hφ'_cw, hφ'⟩ := transport_clockwise_circle_parametrization hΔ hf.continuousOn hg + hgf + (discBd_subset D) hbd φ_orig + obtain ⟨φ₀, φ₀', hφ₀'_cw, hφ₀'⟩ := transport_clockwise_circle_parametrization hΔ₀ hf.continuousOn + hg hgf + ((discBd_subset D₀).trans hD₀D) hbd₀ φ₀_orig + obtain ⟨Ω, hbar, ha⟩ := exists_drawing_boundary_order Γ hv φ φ' hφ' hne + obtain ⟨Ω₀, hbar₀, ha₀⟩ := exists_drawing_boundary_order Γ hv φ₀ φ₀' hφ₀' hne₀ + let N : Neighborhood S (Set S) := + ⟨Q.toGraph, Ω, Ω₀, Q.finite_V, Q.finite_edges, + fun _ hx => (hbar ▸ hx).1, fun _ hx => (hbar₀ ▸ hx).1⟩ + have hbetween : Γ.drawing.U ⊆ f '' D \ interior (f '' D₀) := by + rw [hU] + rintro _ ⟨x, hxQ, rfl⟩ + have hxD := (hQ hxQ).1 + refine ⟨mem_image_of_mem f hxD, ?_⟩ + intro hxint + obtain ⟨y, hy, hyx⟩ := interior_subset hxint + have hyx' : y = x := hi (hD₀D hy) hxD hyx + have hxD₀ : x ∈ D₀ := hyx' ▸ hy + have hxnotbd : x ∉ discBd D₀ := by + intro hxb + have hfb : f x ∈ subBd (f '' D₀) := hbd₀.symm ▸ mem_image_of_mem f hxb + rw [subBd_eq_frontier] at hfb + exact hfb.2 hxint + exact (hQ hxQ).2 ⟨hxD₀, hxnotbd⟩ + have hiff (E : Set S) (hED : E ⊆ D) (hbdE : subBd (f '' E) = f '' discBd E) + (x : S) (hx : x ∈ Q.V) : + graphDrawingVertexSet Γ x ⊆ subBd (f '' E) ↔ x ∈ discBd E := by + rw [graphDrawingVertexSet_transport Γ hv hx, singleton_subset_iff, hbdE] + constructor + · rintro ⟨y, hy, heq⟩ + exact hi (hED (discBd_subset E hy)) (hQ (Q.V_subset_U hx)).1 heq ▸ hy + · exact mem_image_of_mem f + let P : Presentation N := + ⟨Γ, f '' D, f '' D₀, hΔ, image_mono hD₀D, hbetween, + fun x hx => (hiff D Subset.rfl hbd x hx).trans + (by change x ∈ discBd D ↔ x ∈ Ω.bar; rw [hbar]; exact ⟨fun h => ⟨hx, h⟩, And.right⟩), + fun x hx => (hiff D₀ hD₀D hbd₀ x hx).trans + (by change x ∈ discBd D₀ ↔ x ∈ Ω₀.bar; rw [hbar₀]; exact ⟨fun h => ⟨hx, h⟩, And.right⟩), + ⟨φ', hφ'_cw, ha⟩, Or.inr ⟨hΔ₀, φ₀', hφ₀'_cw, ha₀⟩⟩ + refine ⟨N, P, f, rfl, hbar, hbar₀, hf, hi, rfl, rfl, hdisc, ?_⟩ + intro J hJ + apply graphDrawingSubgraphU_transport Γ hv he _ hJ + intro e heQ + apply subset_antisymm + · exact closure_minimal (image_mono subset_closure) + ((isClosed_closure.isCompact).image hf).isClosed + · exact image_closure_subset_closure_image hf + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Battlefields.lean b/LeanPool/GraphMinor/GM16/Battlefields.lean new file mode 100644 index 0000000000..30eec6b8bb --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Battlefields.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM10.Section12 + +/-! +# Battlefields and their selected boundary vertices + +XIV defines a battlefield without requiring that its boundary set have +exactly the size parameter many vertices. In the proof of XVI (8.1), select +the ends of the specified disjoint paths to obtain a boundary set of that +size. The normalization is proved here rather than included in the cited +existence result. +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Function GraphMinor.GM10 GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T1Space S] + +/-- A battlefield as defined in Graph Minors XIV, Section 9, page 45. +In particular condition (ii) says `X ⊆ V(H) ∩ bd(Λ)` and that `X` is free, +not that `|X| = β`. XVI chooses a set of that cardinality on page 71. -/ +structure IsBattlefieldData (H : Drawing S) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (θ beta : ℕ) (z Λ : Set S) (C : Drawing S) (X : Set S) : Prop where + params_valid : 4 ≤ beta ∧ Even beta ∧ 12 * beta + 15 ≤ θ ∧ z ∈ H.A + isZone : IsLambdaZoneAround H d (3 * beta + 3) z Λ + isRigid_cleared : IsRigid (clearedSubdrawing H Λ) + isFree_X : X ⊆ H.V ∩ subBd Λ ∧ + ∃ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (d' : Set S → Set S → ℕ), + IsClearedTangle H T d θ (3 * beta + 3) Λ T' d' ∧ + IsFreeSet (clearedSubdrawing H Λ).toHypergraph T' (θ - 4 * (3 * beta + 3) - 2) X + circuit_and_paths : + C.IsCircuit ∧ C.IsSubdrawing H ∧ C.U ⊆ Λ ∧ + ∃ P : Fin beta → Drawing S, + (∀ k, ∃ u ∈ C.V, ∃ v ∈ X, + (P k).IsPathBetween u v ∧ (P k).IsSubdrawing H ∧ + (P k).U ∩ (H.U ∩ subBd Λ) = {v}) ∧ + Pairwise (fun i j => Disjoint (P i).V (P j).V) + regionalDistance_ge : 1 + beta / 2 ≤ regionalDistance H C.U (subBd Λ) + openDisc_includes : ∃ Δ₀ : Set S, + IsOpenDisc Δ₀ ∧ Δ₀ ⊆ Λ ∧ subBd Δ₀ = C.U ∧ + ∀ x ∈ H.A, d z x < beta → x ⊆ Δ₀ + +/-- The normalization in Graph Minors XVI, proof of (8.1), page 71: +"We may assume that $|X_i| = \beta$ for each $i$." +Choose the ends in `X` of the `β` disjoint paths. Their ends are distinct, +and their set remains free because it is a subset of `X`. -/ +theorem IsBattlefieldData.normalize {H : Drawing S} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {θ beta : ℕ} {z Λ : Set S} {C : Drawing S} {X : Set S} + (h : IsBattlefieldData H T d θ beta z Λ C X) : + ∃ X' ⊆ X, GM14.IsBattlefield H T d θ beta z Λ C X' := by + classical + obtain ⟨P, hP, hdisj⟩ := h.circuit_and_paths.2.2.2 + choose u hu v hv hpath hsub hboundary using hP + have hvmem : ∀ i, v i ∈ (P i).V := by + intro i + obtain ⟨W, _, hV, _⟩ := hpath i + rw [hV] + exact W.end_mem_support + have hinj : Injective v := by + intro i j hij + by_contra hne + exact (hdisj hne).notMem_of_mem_left (hvmem i) (hij ▸ hvmem j) + have hXsub : range v ⊆ X := by rintro _ ⟨i, rfl⟩; exact hv i + obtain ⟨T', d', hclear, hfree⟩ := h.isFree_X.2 + refine ⟨range v, hXsub, h.params_valid, h.isZone, h.isRigid_cleared, + ⟨hXsub.trans h.isFree_X.1, ?_, T', d', hclear, ?_⟩, + ⟨h.circuit_and_paths.1, h.circuit_and_paths.2.1, h.circuit_and_paths.2.2.1, + P, ?_, hdisj⟩, h.regionalDistance_ge, h.openDisc_includes⟩ + · rw [Set.ncard_range_of_injective hinj] + simp + · exact hfree.subset hclear.hasMetric.1.2.1 hXsub + · intro i + exact ⟨u i, hu i, v i, mem_range_self i, hpath i, hsub i, hboundary i⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/BoundaryNaturalOrder.lean b/LeanPool/GraphMinor/GM16/BoundaryNaturalOrder.lean new file mode 100644 index 0000000000..9368a0021c --- /dev/null +++ b/LeanPool/GraphMinor/GM16/BoundaryNaturalOrder.lean @@ -0,0 +1,52 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM16.CircleListing +import LeanPool.GraphMinor.GM16.FiniteCircleCycle +import LeanPool.GraphMinor.GM16.CyclicOrderTransport +import LeanPool.GraphMinor.GM09.Basic +import Mathlib.Data.Fintype.Card +import Mathlib.Tactic.Linarith + +/-! +# Natural orders of finite boundary sets + +Sort the finite boundary vertices by angles in a fixed circle +parametrization. Rotation of that listing gives the required cyclic +permutation. The construction proves its agreement with the circle, +including triples whose angles cross the cut of the parametrization. +This supplies the boundary orders of the rural neighborhood in +XVI (8.1), Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] + +/-- A nonempty finite set of points on a circle has a cyclic order +agreeing with any chosen parametrization of that circle. -/ +theorem exists_cyclicPerm_agrees {F Y : Set S} (φ : Circle ≃ₜ F) + (hY : Y.Finite) (hNe : Y.Nonempty) (hYF : Y ⊆ F) : + ∃ Ω : CyclicPerm S, Ω.bar = Y ∧ AgreesWithOArcHomeo id Ω F φ := + exists_cyclicPerm_from_circle φ id hY hNe (Function.injective_id.injOn) (fun _ hx => hYF hx) + +/-- The natural order of a nonempty finite set on an `O`-arc, in the +sense used for battlefield boundaries in XVI (8.1). -/ +theorem exists_natural_order {F Y : Set S} (hF : IsOArc F) + (hY : Y.Finite) (hNe : Y.Nonempty) (hYF : Y ⊆ F) : + ∃ Ω : CyclicPerm S, Ω.bar = Y ∧ IsNaturalOrderFrom id Ω F := by + obtain ⟨φ⟩ := hF + obtain ⟨Ω, hbar, hAgree⟩ := exists_cyclicPerm_agrees φ hY hNe hYF + exact ⟨Ω, hbar, ⟨φ⟩, φ, hAgree⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/BranchArmsInPathSystem.lean b/LeanPool/GraphMinor/GM16/BranchArmsInPathSystem.lean new file mode 100644 index 0000000000..02b99f3cfb --- /dev/null +++ b/LeanPool/GraphMinor/GM16/BranchArmsInPathSystem.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.GraphPathSystemUnion +public import LeanPool.GraphMinor.GM01.Defs + +/-! +# The chosen arms and edges occur in the path union + +For an arm toward a neighbor, take that source edge's replacing +path. Its chosen orientation is either the given order or its +reverse. In either case the exact vertex and edge union formulas +put the arm inside the path. The same formulas retain every +chosen model edge. These are the subgraph checks for the minor +inside the subdivision in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph +universe u v w + +private theorem arm_eq_of_ends_eq {α : Type u} {β : Type v} {ν : Type w} + {H : SimpleGraph ν} (arm : ∀ v, H.neighborSet v → Graph α β) + {a b v w : ν} (hab : H.Adj a b) (hvw : H.Adj v w) (ha : a = v) (hb : b = w) : + arm a ⟨b,hab⟩ = arm v ⟨w,hvw⟩ := by + subst v w + rfl + +/-- The union of the replacing paths contains all arms and all +chosen source-edge images. -/ +theorem branch_arms_le_pathSystemGraph + {α : Type u} {β : Type v} {ν : Type w} {H : SimpleGraph ν} {G : Graph α β} + (C : Set α) (arm : ∀ v, H.neighborSet v → Graph α β) + (P : H.edgeSet → Graph α β) (a b : H.edgeSet → ν) (ηe : Sym2 ν → β) + (hEq : ∀ e, e.val = s(a e, b e)) (hAdj : ∀ e, H.Adj (a e) (b e)) + (hArmG : ∀ v i, arm v i ≤ G) (hPG : ∀ e, P e ≤ G) + (hV : ∀ e, V(P e) = V(arm (a e) ⟨b e, hAdj e⟩) ∪ V(arm (b e) ⟨a e, (hAdj e).symm⟩)) + (hE : ∀ e, E(P e) = (E(arm (a e) ⟨b e, hAdj e⟩) ∪ {ηe e.val}) ∪ + E(arm (b e) ⟨a e, (hAdj e).symm⟩)) : + (∀ v i, arm v i ≤ pathSystemGraph G C P) ∧ + (∀ e ∈ H.edgeSet, ηe e ∈ E(pathSystemGraph G C P)) := by + constructor + · intro v i + let e : H.edgeSet := ⟨s(v,i.val),i.property⟩ + have hPair : s(a e,b e)=s(v,i.val) := (hEq e).symm + have hSets : V(arm v i) ⊆ V(P e) ∧ E(arm v i) ⊆ E(P e) := by + rcases Sym2.eq_iff.mp hPair with ⟨ha,hb⟩ | ⟨ha,hb⟩ + · have hArmEq := arm_eq_of_ends_eq arm (hAdj e) i.property ha hb + refine ⟨?_,?_⟩ + · rw [hV e] + exact fun _ hx => Or.inl (hArmEq.symm ▸ hx) + · rw [hE e] + exact fun _ hx => Or.inl (Or.inl (hArmEq.symm ▸ hx)) + · have hArmEq := arm_eq_of_ends_eq arm (hAdj e).symm i.property hb ha + refine ⟨?_,?_⟩ + · rw [hV e] + exact fun _ hx => Or.inr (hArmEq.symm ▸ hx) + · rw [hE e] + exact fun _ hx => Or.inr (hArmEq.symm ▸ hx) + have hArmP : arm v i ≤ P e := + (Compatible.of_le_le (hArmG v i) (hPG e)).le_iff.mpr hSets + exact hArmP.trans (le_pathSystemGraph hPG e) + · intro e he + let e₀ : H.edgeSet := ⟨e,he⟩ + apply (le_pathSystemGraph hPG e₀).edgeSet_mono + rw [hE e₀] + exact Or.inl (Or.inr (mem_singleton _)) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/CircleListing.lean b/LeanPool/GraphMinor/GM16/CircleListing.lean new file mode 100644 index 0000000000..3f10efdbca --- /dev/null +++ b/LeanPool/GraphMinor/GM16/CircleListing.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import Mathlib.Data.Finset.Sort +import Mathlib.Data.Fintype.Card +import Mathlib.Analysis.SpecialFunctions.Complex.Circle +import Mathlib.Tactic.Linarith + +/-! +# Listing finite sets of points on a circle + +The boundary points in XVI (8.1), Claim (4), are sorted by their +angles in one orientation. Increasing angles covering less than one +turn give the paper's notion of being listed in order. Extending a +finite list of angles supplies the sequence in XII's definition. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface +universe w +variable {S : Type w} [TopologicalSpace S] + +/-- Increasing angles in a single turn list points in order on a circle. +This supplies the finite-to-infinite sequence conversion in XII's +`IsListedInOrderOn` definition, used in XVI (8.1), Claim (4). -/ +theorem listedInOrderOn_of_angles {F : Set S} (φ : Circle ≃ₜ F) + {n : ℕ} (hn : 0 < n) (ν : Fin n → S) (τ : Fin n → ℝ) + (hMono : StrictMono τ) + (hTurn : ∀ i, τ i < τ ⟨0, hn⟩ + 2 * Real.pi) + (hν : ∀ i, (φ (Circle.exp (τ i))).val = ν i) : + GM12.IsListedInOrderOn F (List.ofFn ν) := by + let base := τ ⟨0, hn⟩ + 2 * Real.pi + let t : ℕ → ℝ := fun k => if hk : k < n then τ ⟨k, hk⟩ else base + (k : ℝ) + have ht : StrictMono t := by + intro i j hij + by_cases hi : i < n + · by_cases hj : j < n + · simpa only [t, dite_eq_left hi, dite_eq_left hj] using hMono (show + (⟨i, hi⟩ : Fin n) < ⟨j, hj⟩ from hij) + · change (if h : i < n then τ ⟨i, h⟩ else base + (i : ℝ)) < + (if h : j < n then τ ⟨j, h⟩ else base + (j : ℝ)) + rw [dite_eq_left hi, dite_eq_right hj] + exact lt_of_lt_of_le (hTurn ⟨i, hi⟩) (le_add_of_nonneg_right (Nat.cast_nonneg j)) + · have hj : ¬ j < n := by omega + dsimp only [t] + rw [dite_eq_right hi, dite_eq_right hj] + simpa only [add_comm] using add_lt_add_left (Nat.cast_lt.mpr hij) base + refine ⟨φ, t, ht, ?_, ?_⟩ + · intro i hi + rw [List.length_ofFn] at hi + simpa only [t, dite_eq_left hi, dite_eq_left hn] using hTurn ⟨i, hi⟩ + · intro i hi + have hin : i < n := by simpa only [List.length_ofFn] using hi + simpa only [t, dite_eq_left hin, List.getElem_ofFn] using hν ⟨i, hin⟩ + +/-- An injective family of points on a circle can be put in increasing +angle order by permuting its indices. The angles lie in `(-π,π]`. -/ +theorem exists_increasing_circle_angles {F : Set S} (φ : Circle ≃ₜ F) + {n : ℕ} (ν : Fin n → S) (hν : Function.Injective ν) (hF : ∀ i, ν i ∈ F) : + ∃ (e : Fin n → Fin n) (τ : Fin n → ℝ), Function.Bijective e ∧ StrictMono τ ∧ + (∀ i, -Real.pi < τ i ∧ τ i ≤ Real.pi) ∧ + ∀ i, (φ (Circle.exp (τ i))).val = ν (e i) := by + classical + let pt : Fin n → Circle := fun i => φ.symm ⟨ν i, hF i⟩ + let angle : Fin n → ℝ := fun i => Complex.arg (pt i).val + have hEq : ∀ i, (φ (Circle.exp (angle i))).val = ν i := by + intro i + rw [show Circle.exp (angle i) = pt i from Circle.exp_arg (pt i)] + exact congrArg Subtype.val (φ.apply_symm_apply ⟨ν i, hF i⟩) + have hAngle : Function.Injective angle := by + intro i j hij + exact hν ((hEq i).symm.trans ((congrArg (fun t => (φ (Circle.exp t)).val) hij).trans (hEq j))) + let vals : Finset ℝ := Finset.univ.image angle + have hcard : vals.card = n := by + rw [Finset.card_image_of_injective _ hAngle, Finset.card_univ, Fintype.card_fin] + let τ : Fin n → ℝ := vals.orderEmbOfFin hcard + have hex : ∀ i : Fin n, ∃ j : Fin n, angle j = τ i := by + intro i + obtain ⟨j, _, hj⟩ := Finset.mem_image.mp (vals.orderEmbOfFin_mem hcard i) + exact ⟨j, hj⟩ + choose e he using hex + have heInj : Function.Injective e := by + intro i j hij + exact (vals.orderEmbOfFin hcard).injective ((he i).symm.trans ((congrArg angle hij).trans + (he j))) + refine ⟨e, τ, ⟨heInj, Finite.surjective_of_injective heInj⟩, + (vals.orderEmbOfFin hcard).strictMono, ?_, ?_⟩ + · intro i + rw [← he i] + exact ⟨Complex.neg_pi_lt_arg _, Complex.arg_le_pi _⟩ + · intro i + rw [← he i] + exact hEq (e i) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Cited.lean b/LeanPool/GraphMinor/GM16/Cited.lean new file mode 100644 index 0000000000..efc18e38e3 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Cited.lean @@ -0,0 +1,309 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM16.Battlefields +public import LeanPool.GraphMinor.GM15.Cited + +/-! +# Results cited in Graph Minors XVI + +This file states as `Prop`s the results from earlier papers of the Graph Minors series (and from +external papers cited in Graph Minors XVI) that are used in the proofs of N. Robertson and +P. D. Seymour, *Graph Minors. XVI. Excluding a non-planar graph*, J. Combin. Theory Ser. B 89 +(2003) 43–76, over the shared definitions from `GraphMinor.GM09.Defs`, `GraphMinor.GM10.Defs`, +`GraphMinor.GM10.Defs2`, `GraphMinor.GM11.Defs`, `GraphMinor.GM12.Defs`, `GraphMinor.GM14.Defs`, +`GraphMinor.GM15.Defs`, and `GraphMinor.GM16.Defs`: + +* **Graph Minors IX** (*Disjoint crossed paths*, JCTB 49 (1990) 40–77): + - `GM15.GM09Theorem81Statement` (re-exported from `GraphMinor.GM15.Cited`), (8.1) (page 60), + nonempty-boundary case, + used in the proof of (3.2) of XVI (page 50); + - `GM09Theorem105Statement`, (10.5) (page 66), used in Step (11) of the proof of (8.1) in + Section 9 of XVI (page 74). +* **Graph Minors XII** (*Distance on a surface*, JCTB 64 (1995) 240–272): + - `GM12Theorem42Statement`, complete-graph corollary of (4.2) (page 249), used in the + proof of (3.1) of XVI (page 54); + - `GM12Theorem43Statement`, (4.3) (page 249), stated as (4.3) of XVI (page 54); + - `GM12Theorem44Statement`, (4.4) (page 251), stated as (5.2) of XVI (page 55); + - `GM14.GM12Theorem710Statement` (re-exported from `GraphMinor.GM15.Cited`), (7.10) (page 270), + clearing a $\lambda$-zone, used in (6.2), (6.3), and Section 9 of XVI. +* **Graph Minors XIV** (*Extending an embedding*, JCTB 65 (1995) 23–50): + - `GM14Theorem75Statement`, (7.5) (page 36), inside of a short radial circuit in a zone, used in + Step (10) of the proof of (8.1) in Section 9 of XVI (page 73); + - `GM14Theorem92Statement`, (9.2) (page 43), existence of a $(\kappa + 2)$-zone around $z$, used + in (6.3) and Section 9 of XVI; + - `GM14Theorem93Statement`, (9.3) (page 44), existence of a $(\kappa + 5)$-zone around $z$ whose + complement is rigid, used in (6.3) of XVI (page 60); + - `GM14Theorem95Statement`, (9.5) (page 45), existence of a battlefield of size $\beta$ around + $z$, used in Section 9 of XVI (page 71). +* **External results cited in Graph Minors XVI:** + - `RST94Theorem23Statement`, Robertson, Seymour, and Thomas, (2.3) on grid minors + controlled by a tangle, used in Step (2) of the proof of (4.2) of XVI (page 53). +-/ + +@[expose] public section + +namespace GraphMinor.GM16 + +open Set Function Topology +open Graph SimpleGraph Hypergraph +open GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 GraphMinor.GM15 + +export GM15 (GM09Theorem81Statement GM12Theorem710Statement) + +universe u v w + +/-! ## Graph Minors IX: Disjoint crossed paths (JCTB 49 (1990) 40–77) -/ + +/-- Statement of Graph Minors IX, (10.5) (page 66), used in Step (11) of the proof of (8.1) in +Section 9 of Graph Minors XVI (page 74): +"Let $p \ge 0$ and let $(G, \Omega, \Omega_0)$ be a rural neighborhood of breadth $\ge +\frac{1}{2} p + 1$. Let $X \subseteq \bar{\Omega}$ be linked, with $|X| \ge p$. Let $(G \cup +G_0, \Omega)$ be the composition of some society $(G_0, \Omega_0)$ with $(G, \Omega, +\Omega_0)$, and let $Y \subseteq V(G_0)$. Then either there are $p$ mutually disjoint paths +of $G \cup G_0$ from $X$ to $Y$, each with only its initial vertex in $\bar{\Omega}$, or +there exists $W \subseteq V(G \cup G_0)$ with $|W| < p$ and $W \cap \bar{\Omega} = +\emptyset$ such that every path of $G \cup G_0$ from $\bar{\Omega}$ to $Y$ has a vertex in +$W$." -/ +def GM09Theorem105Statement : Prop := + ∀ {α : Type u} {β : Type v} (S_comp S₀ : Society α β) (N : Neighborhood α β) + (p : ℕ) (X Y : Set α), + N.IsRural → N.HasBreadthGe ((p + 1) / 2 + 1) → + N.IsLinked X → p ≤ X.ncard → + S_comp.IsComposition S₀ N → Y ⊆ V(S₀.G) → + (∃ P : Fin p → Graph α β, + (∀ i, ∃ x ∈ X, ∃ y ∈ Y, IsFromToPathWithEnds S_comp.G (P i) S_comp.Ω.bar Y x y) ∧ + Pairwise (fun i j => Disjoint V(P i) V(P j))) ∨ + (∃ W ⊆ V(S_comp.G), W.ncard < p ∧ Disjoint W S_comp.Ω.bar ∧ + ∀ P : Graph α β, IsFromToPath S_comp.G P S_comp.Ω.bar Y → (V(P) ∩ W).Nonempty) + +/-! ## Graph Minors XII: Distance on a surface (JCTB 64 (1995) 240–272) -/ + +/-- Complete-graph corollary of Graph Minors XII, (4.2) (page 249), used in the proof of +(3.1) of Graph Minors XVI (page 54): +For any finite graph $L$ there exists $p \ge 0$ such that any tangle $\mathcal{T}^*$ in a graph $G$ +controlling a $K_p$-minor (`GM12.ControlsMinor ... (completeGraph p)`) also controls an $L$-minor +(`GM12.ControlsMinor ... L`). -/ +def GM12Theorem42Statement : Prop := + ∀ {α' : Type*} {β' : Type*} (L : Graph α' β'), V(L).Finite → E(L).Finite → + ∃ p : ℕ, ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (hT : IsGraphTangle G θ_star T_star), + GM12.ControlsMinor (Hypergraph.ofGraph G hT.finite_V hT.finite_E) θ_star T_star + (completeGraph p) → + GM12.ControlsMinor (Hypergraph.ofGraph G hT.finite_V hT.finite_E) θ_star T_star L + +/-- Statement of Graph Minors XII, (4.3) (page 249), stated as (4.3) in Graph Minors XVI (page 54): +"If $L$ is a graph and $\Sigma$ is a surface such that $L$ can be drawn in $\Sigma$, there is an +integer $\theta \ge 1$ with the following property. If $\mathscr{T}^*$ is a tangle in a graph $G$ +controlling no $L$ minor, then there is no $\Sigma$-span of order $\ge \theta$." -/ +def GM12Theorem43Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + {α' : Type*} {β' : Type*} (L : Graph α' β'), + IsClosedSurface S → ConnectedSpace S → V(L).Finite → E(L).Finite → + CanBeDrawnIn S L → + ∃ θ : ℕ, 1 ≤ θ ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) (θ_span : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (hT : IsGraphTangle G θ_star T_star), + ¬ GM12.ControlsMinor (Hypergraph.ofGraph G hT.finite_V hT.finite_E) θ_star T_star L → + θ ≤ θ_span → ¬ IsSigmaSpan G H η θ_star θ_span T_star T + +/-- Statement of Graph Minors XII, (4.4) (page 251), stated as (5.2) in Graph Minors XVI (page 55): +"Let $\Sigma$ be a surface and let $p \ge 0$. Then there exists $\theta \ge 1$ such that if +$\mathscr{T}^*$ is a tangle in a graph $G$, and $H, \eta, \mathscr{T}$ is a $\Sigma$-span of order +$\ge \theta$ with metric $d$, and +* $s_1, t_1, \dots, s_\mu, t_\mu$ are distinct vertices of $H$, where $\mu = \frac{1}{2}p(p - 1)$, + such that $d(u, v) \ge \theta$ for all distinct $u, v \in \{s_1, t_1, \dots, s_\mu, t_\mu\}$, and +* $Q_1, \dots, Q_\mu$ are mutually disjoint $\eta(H)$-paths, such that $Q_i$ has ends + $\eta(s_i), \eta(t_i) (1 \le i \le \mu)$, +then $\mathscr{T}^*$ controls a $K_p$-minor of $G$." -/ +def GM12Theorem44Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ p : ℕ, ∃ θ : ℕ, 1 ≤ θ ∧ + let μ := p * (p - 1) / 2 + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star θ_span : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (s t : Fin μ → S) (Q : Fin μ → Graph α β) + (hSpan : IsSigmaSpan G H η θ_star θ_span T_star T), + HasTangleMetric H θ_span T d → + θ ≤ θ_span → + (∀ i : Fin μ, s i ∈ H.V ∧ t i ∈ H.V ∧ s i ≠ t i) → + Injective s → Injective t → Disjoint (range s) (range t) → + (∀ u ∈ range s ∪ range t, ∀ v ∈ range s ∪ range t, u ≠ v → θ ≤ d {u} {v}) → + (∀ i : Fin μ, IsHPathWithEnds G η.imageGraph (Q i) (η.vMap (s i)) (η.vMap (t i))) → + Pairwise (fun i j => Disjoint V(Q i) V(Q j)) → + GM12.ControlsMinor + (Hypergraph.ofGraph G hSpan.isControlling.isTangle_star.finite_V + hSpan.isControlling.isTangle_star.finite_E) + θ_star T_star (completeGraph p) + +/-! ## Graph Minors XIV: Extending an embedding (JCTB 65 (1995) 23–50) -/ + +/-- Statement of Graph Minors XIV, (7.5) (page 36), used in Step (10) of the proof of (8.1) in +Section 9 of Graph Minors XVI (page 73): +Let $H$ be a 2-cell drawing in $\Sigma$, and let $\mathcal{T}$ be a respectful tangle in $H$ of +order $\theta$, with metric $d$. Let $\lambda \ge 0$ be an integer, and let $\Lambda \subseteq +\Sigma$ +be a $\lambda$-zone. Let $K$ be a radial drawing of $H$, with derived slope `ins`, and let $D$ be a +circuit of $K$ with $U(D) \subseteq \bar{\Lambda}$ and $|E(D)| < 2(\theta - \lambda)$. Then +$\operatorname{ins}(D) \subseteq \bar{\Lambda}$. -/ +def GM14Theorem75Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + (H K D : Drawing S) (θ lam : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (ins : Drawing S → Set S) (z Λ : Set S), + IsClosedSurface S → ConnectedSpace S → + HasTangleMetric H θ T d → + (PaintingOrDrawing.drawing H).IsRadialDrawing K → + IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins → + IsLambdaZoneAround H d lam z Λ → + D.IsCircuit → D.IsSubdrawing K → + D.U ⊆ closure Λ → + D.length < 2 * (θ - lam) → + ins D ⊆ closure Λ + +/-- Statement of Graph Minors XIV, (9.2) (page 43), used in the proof of (6.3) (page 60) and in +Section 9 (page 73) of Graph Minors XVI: +Let $H$ be a 2-cell drawing in $\Sigma$, and let $\mathcal{T}$ be a respectful tangle in $H$ of +order $\theta$, with metric $d$. Let $z \in A(H)$ and let $\kappa$ be an integer with +$2 \le \kappa \le \theta - 3$. Then there is a $(\kappa + 2)$-zone $\Lambda$ around $z$ such that +$x \subseteq \Lambda$ for every $x \in A(H)$ with $d(z, x) < \kappa$. -/ +def GM14Theorem92Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + (H : Drawing S) (θ κ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (z : Set S), + IsClosedSurface S → ConnectedSpace S → + HasTangleMetric H θ T d → z ∈ H.A → + 2 ≤ κ → κ + 3 ≤ θ → + ∃ Λ : Set S, IsLambdaZoneAround H d (κ + 2) z Λ ∧ + ∀ x ∈ H.A, d z x < κ → x ⊆ Λ + +/-- Statement of Graph Minors XIV, (9.3) (page 44), used in the proof of (6.3) of Graph Minors XVI +(page 60): +Let $H$ be a 2-cell rigid drawing in $\Sigma$, and let $\mathcal{T}$ be a respectful tangle in $H$ +of order $\theta$, with metric $d$. Let $z \in A(H)$, and let $\kappa$ be an integer with +$2 \le \kappa \le \theta - 6$. Then there is a $(\kappa + 5)$-zone $\Lambda$ around $z$ such that +$H \cap (\Sigma - \Lambda)$ is rigid and $x \subseteq \Lambda$ for every $x \in A(H)$ with +$d(z, x) < \kappa$. -/ +def GM14Theorem93Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + (H : Drawing S) (θ κ : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (z : Set S), + IsClosedSurface S → ConnectedSpace S → + IsRigid H → HasTangleMetric H θ T d → z ∈ H.A → + 2 ≤ κ → κ + 6 ≤ θ → + ∃ Λ : Set S, IsLambdaZoneAround H d (κ + 5) z Λ ∧ + IsRigid (clearedSubdrawing H Λ) ∧ + ∀ x ∈ H.A, d z x < κ → x ⊆ Λ + +/-- Graph Minors XIV, (9.5), page 45, used in XVI, Section 9, page 71: +"Let $H$ be a 2-cell, rigid drawing in $\Sigma$, let $z \in A(H)$, and let $\mathscr{T}$ be a +respectful tangle in $H$ of order $\theta$. Let $\beta \ge 4$ be an even integer with +$\theta \ge 16\beta + 17$. Then there is a battlefield around $z$ of size $\beta$." +The boundary-set normalization is proved by `IsBattlefieldData.normalize`. -/ +def GM14Theorem95Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + (H : Drawing S) (θ β : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (z : Set S), + IsClosedSurface S → ConnectedSpace S → + IsRigid H → HasTangleMetric H θ T d → z ∈ H.A → + 4 ≤ β → Even β → 16 * β + 17 ≤ θ → + ∃ (Λ : Set S) (C : Drawing S) (X : Set S), + IsBattlefieldData H T d θ β z Λ C X + +/-! ## Graph Minors XV: Giant steps (JCTB 68 (1996) 112–148) -/ + +/-- Statement of Graph Minors XV, (3.5), page 123, used in XVI (8.1), +Claim (4), page 72. The boundary order and the prohibition on a region +incident with both boundary circuits are explicit here. +The statement also includes the line condition of XII (5.1), missing +from XV (3.5) as printed. Without it the printed statement is false +for large `φ`. +"Let $\Sigma$ be a surface and let $\phi \ge 3$ be an integer. Let $\mathscr{T}^*$ be a +tangle in a graph $G$, and let $H, \eta, \mathscr{T}$ be a $\Sigma$-span. Let $\Lambda_1, +\Lambda_2 \subseteq \Sigma$ be distinct regions of $H$ so that $H \cap bd(\Lambda_i)$ is a +circuit $C_i$ ($i = 1, 2$), and no region of $H$ is incident with a vertex in $C_1$ and with +a vertex in $C_2$. Let $a_1, \dots, a_\phi$ be distinct vertices of $C_1$ in order, and let +$b_1, \dots, b_\phi$ be distinct vertices of $C_2$ in order (under some orientations of +$C_1$ and $C_2$), such that $\{a_1, \dots, a_\phi\}$ and $\{b_1, \dots, b_\phi\}$ are free +with respect to $\mathscr{T}$. For $1 \le i \le \phi$ let $P_i$ be an $\eta(H)$-path with +ends $\eta(a_i), \eta(b_i)$, such that $P_1, \dots, P_\phi$ are mutually disjoint. Then +there is a $\Sigma'$-span of order $\phi$, where $\Sigma'$ is the surface obtained by adding +a handle to $\Sigma$." -/ +def GM15Theorem35Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ φ : ℕ) (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (Λ₁ Λ₂ : Set S) (P : Fin φ → Graph α β) (a b : Fin φ → S), + IsSigmaSpan G H η θ_star θ T_star T → HasTangleMetric H θ T d → + Λ₁ ∈ H.R → Λ₂ ∈ H.R → Λ₁ ≠ Λ₂ → + (H.interSet (subBd Λ₁)).IsCircuit → (H.interSet (subBd Λ₂)).IsCircuit → + (∀ r ∈ H.R, ¬ ((∃ x ∈ (H.interSet (subBd Λ₁)).V, x ∈ closure r) ∧ + ∃ y ∈ (H.interSet (subBd Λ₂)).V, y ∈ closure r)) → + (∀ F : Set S, IsLine F → H.IsNormal F → F ⊆ univ \ (Λ₁ ∪ Λ₂) → + (F ∩ subBd Λ₁).Nonempty → (F ∩ subBd Λ₂).Nonempty → φ ≤ (F ∩ H.V).ncard) → + 3 ≤ φ → Injective a → Injective b → + GM12.IsListedInOrderOn (subBd Λ₁) (List.ofFn a) → + GM12.IsListedInOrderOn (subBd Λ₂) (List.ofFn b) → + (∀ i, a i ∈ (H.interSet (subBd Λ₁)).V ∧ b i ∈ (H.interSet (subBd Λ₂)).V) → + (∀ i, IsHPathWithEnds G η.imageGraph (P i) (η.vMap (a i)) (η.vMap (b i))) → + Pairwise (fun i j => Disjoint V(P i) V(P j)) → + IsFreeSet H.toHypergraph T θ (range a) → IsFreeSet H.toHypergraph T θ (range b) → + ∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S'), + IsObtainedByAddingHandle S S' ∧ + ∃ (H' : Drawing S') (η' : SpanEmbedding H' G) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsSigmaSpan G H' η' θ_star φ T_star T' + +/-! ## External theorems cited in Graph Minors XVI -/ + +/-- The form of Robertson, Seymour, and Thomas, *Quickly excluding a planar graph*, J. Combin. +Theory +Ser. B 62 (1994) 323–348, (2.3) (page 327), used in the proof of (4.2) of Graph Minors XVI (page +53). +XVI writes "theorem 6.1 of [10]", but (6.1) of the published paper bounds the tree-width of planar +graphs. +(2.3) says: "Let $g \ge 2$, and let $\mathscr{T}$ be a tangle in $G$ of order $\ge 20^{g^4(2g-1)}$. +Then $\mathscr{T}$ dominates a $g \times g$ grid minor." This gives the statement below with `g = 2θ ++ 1`. If `(A, B) ∈ 𝒯` has order `≤ 2θ` and `E(A)` includes a +row of the grid, then `(B, A)` is in `𝒯_H ⊆ 𝒯`, against the second axiom. XVI, Step (2): +"For every graph $G$ and tangle $\mathscr{T}^*$ in $G$ of order $\ge \theta^*$, there is a +$(2\theta + 1) \times (2\theta + 1)$ grid minor of $G$ such that for all $(A, B) \in \mathscr{T}^*$ +of order $\le 2\theta$, $E(A)$ includes no row of the grid." -/ +def RST94Theorem23Statement : Prop := + ∀ θ : ℕ, 1 ≤ θ → + ∃ θ_star : ℕ, 1 ≤ θ_star ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_G : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)), + IsGraphTangle G θ_G T_star → θ_star ≤ θ_G → + ∃ (ηv : Fin (2 * θ + 1) × Fin (2 * θ + 1) → Set α) + (ηe : Sym2 (Fin (2 * θ + 1) × Fin (2 * θ + 1)) → β), + IsMinorModel (GM01.gridGraph (2 * θ + 1)) G ηv ηe ∧ + ∀ A B : Hypergraph α β, (A, B) ∈ T_star → separationOrder A B ≤ 2 * θ → + ∀ i : Fin (2 * θ + 1), + ¬ (ηe '' (GM10.gridRowPath (2 * θ + 1) i).edgeSet ⊆ A.edgeSet) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ClearedPathVertices.lean b/LeanPool/GraphMinor/GM16/ClearedPathVertices.lean new file mode 100644 index 0000000000..2c4061e56a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ClearedPathVertices.lean @@ -0,0 +1,60 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Old vertices on a path relative to the cleared drawing + +An old drawing vertex outside all cleared discs survives clearing. +On a path with no other vertex in the cleared drawing, every old +vertex distinct from its first end is consequently either its last +end or lies in a cleared disc. This supplies the location of `t_i` +in Claim (8) and of `v` after Claim (15) of XVI (8.1). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T1Space S] +variable {α : Type u} {β : Type v} + +/-- An old drawing vertex outside the cleared discs remains a vertex +of the drawing after the whole family is cleared. -/ +theorem mem_clearFamily_of_notMem_union {H : Drawing S} {Y : Set S} {Λ : S → Set S} + {x : S} (hx : x ∈ H.V) (hOut : x ∉ ⋃ y ∈ Y, Λ y) : + x ∈ (clearEnvelopeDrawing H Y Λ).V := + Or.inl ⟨⟨hx, mem_univ _, hOut⟩, hx⟩ + +/-- Every old vertex of the new path, except its two ends, lies in +one of the discs that were cleared. -/ +theorem old_vertex_place_on_cleared_path {H : Drawing S} {G P : Graph α β} + (η : SpanEmbedding H G) {Y : Set S} {Λ : S → Set S} + (η' : SpanEmbedding (clearEnvelopeDrawing H Y Λ) G) (hMap : η'.vMap = η.vMap) + {s t x : S} (hs : s ∈ H.V) (ht : t ∈ H.V) (hx : x ∈ H.V) + (hP : IsHPathWithEnds G η'.imageGraph P (η.vMap s) (η.vMap t)) + (hxP : η.vMap x ∈ V(P)) (hxs : x ≠ s) : + x = t ∨ x ∈ ⋃ y ∈ Y, Λ y := by + by_cases hIn : x ∈ ⋃ y ∈ Y, Λ y + · exact Or.inr hIn + · have hxClear := mem_clearFamily_of_notMem_union hx hIn + have hxIm : η.vMap x ∈ V(η'.imageGraph) := by + rw [← hMap] + exact η'.bijOn_v.mapsTo hxClear + have hEnds : η.vMap x ∈ ({η.vMap s, η.vMap t} : Set α) := + hP.2.2.2.2.2.1 ▸ ⟨hxP, hxIm⟩ + rcases hEnds with hxs' | hxt + · exact False.elim (hxs (η.bijOn_v.injOn hx hs hxs')) + · exact Or.inl (η.bijOn_v.injOn hx ht (mem_singleton_iff.mp hxt)) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ConnectedAttachment.lean b/LeanPool/GraphMinor/GM16/ConnectedAttachment.lean new file mode 100644 index 0000000000..1f0af73a71 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ConnectedAttachment.lean @@ -0,0 +1,62 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM06.Defs +import LeanPool.GraphMinor.GM16.Section6HairUnion +import LeanPool.GraphMinor.GM09.Basic + +/-! +# A clean connected extension gives an attachment + +Join a clean path to a connected subgraph that avoids the cleared +drawing. If the subgraph meets the bad path, their connected union +contains a clean attachment to it. This is the last graph argument +in XVI (8.1), Claim (14). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 +universe u v + +/-- Extending a path by a connected subgraph that avoids the cleared +graph preserves a clean attachment to any graph it meets. -/ +theorem connected_extension_gives_attachment {α : Type u} {β : Type v} + {G H P₀ Q J : Graph α β} {X Z : Set α} {a b : α} + (hQ : IsGraphPathWithEnds G Q a b) (hJ : J ≤ G) (hConn : IsGraphConnected J) + (hQJ : (V(Q) ∩ V(J)).Nonempty) (hP₀J : (V(P₀) ∩ V(J)).Nonempty) + (hQH : V(Q) ∩ V(H) ⊆ X) (hJH : Disjoint V(J) V(H)) + (hQZ : Disjoint V(Q) Z) (hJZ : Disjoint V(J) Z) : + ∃ c ∈ V(P₀), ∃ R : Graph α β, + IsGraphPathWithEnds G R a c ∧ V(R) ∩ V(H) ⊆ X ∧ Disjoint V(R) Z := by + let U := subgraphUnion G Q J + have hUG : U ≤ G := subgraphUnion_le hQ.1 hJ + have hQU : Q ≤ U := le_subgraphUnion_left hQ.1 hJ + have hJU : J ≤ U := le_subgraphUnion_right hQ.1 hJ + have hU : IsGraphConnected U := isGraphConnected_subgraphUnion hQ.1 hJ + (graphPath_isGraphConnected hQ) hConn hQJ + obtain ⟨c, hcP₀, hcJ⟩ := hP₀J + obtain ⟨W⟩ := hU.2 a (hQU.vertexSet_mono hQ.left_mem) c (hJU.vertexSet_mono hcJ) + obtain ⟨R, hR, _, _⟩ := exists_isGraphPathWithEnds_of_walk W + have hUV : V(U) = V(Q) ∪ V(J) := vertexSet_subgraphUnion G Q J + refine ⟨c, hcP₀, R, hR.mono hUG, ?_, ?_⟩ + · rintro x ⟨hxR, hxH⟩ + have hxU := hR.1.vertexSet_mono hxR + rw [hUV] at hxU + rcases hxU with hxQ | hxJ + · exact hQH ⟨hxQ, hxH⟩ + · exact False.elim (hJH.notMem_of_mem_left hxJ hxH) + · have hUZ : Disjoint V(U) Z := by + rw [hUV] + exact hQZ.union_left hJZ + exact hUZ.mono hR.1.vertexSet_mono Subset.rfl + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ConnectedBoundary.lean b/LeanPool/GraphMinor/GM16/ConnectedBoundary.lean new file mode 100644 index 0000000000..a3fa082c54 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ConnectedBoundary.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM06.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Connectivity through a connected boundary + +In a connected graph, suppose a subgraph retains every edge incident +with one of its vertices away from a chosen boundary. Following any +ambient walk to the boundary gives a walk inside the subgraph up to +its first boundary vertex. If the boundary vertices are connected +inside the subgraph, the whole subgraph is connected. This is the +graph argument behind the connected annulus in XVI (8.1), Claim (14). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM06 +universe u v +variable {α : Type u} {β : Type v} + +/-- A subgraph of a connected graph is connected when its boundary +is connected and all edges at its other vertices are retained. -/ +theorem isGraphConnected_of_connected_boundary {G Q : Graph α β} {B : Set α} + (hQG : Q ≤ G) (hG : IsGraphConnected G) (hB : B.Nonempty) (hBQ : B ⊆ V(Q)) + (hConn : ∀ x ∈ B, ∀ y ∈ B, Nonempty (GraphWalk Q x y)) + (hKeep : ∀ e x y, G.IsLink e x y → x ∈ V(Q) → x ∉ B → Q.IsLink e x y) : + IsGraphConnected Q := by + obtain ⟨b₀, hb₀⟩ := hB + have hWalk : ∀ {x t}, (W : GraphWalk G x t) → t ∈ B → x ∈ V(Q) → + ∃ b ∈ B, Nonempty (GraphWalk Q x b) := by + intro x t W + induction W with + | nil _ => exact fun ht hx => ⟨_, ht, ⟨.nil hx⟩⟩ + | @cons x y z e hl W ih => + intro ht hx + by_cases hxb : x ∈ B + · exact ⟨x, hxb, ⟨.nil hx⟩⟩ + · have hlQ := hKeep e x y hl hx hxb + obtain ⟨b, hb, ⟨R⟩⟩ := ih ht hlQ.right_mem + exact ⟨b, hb, ⟨.cons hlQ R⟩⟩ + have hReach : ∀ {x}, x ∈ V(Q) → ∃ b ∈ B, Nonempty (GraphWalk Q x b) := by + intro x hx + obtain ⟨W⟩ := hG.2 x (hQG.vertexSet_mono hx) b₀ (hQG.vertexSet_mono (hBQ hb₀)) + exact hWalk W hb₀ hx + refine ⟨⟨b₀, hBQ hb₀⟩, ?_⟩ + intro x hx y hy + obtain ⟨b, hb, ⟨R⟩⟩ := hReach hx + obtain ⟨c, hc, ⟨T⟩⟩ := hReach hy + obtain ⟨U⟩ := hConn b hb c hc + exact ⟨(R.append U).append T.reverse⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ConnectedBranchArms.lean b/LeanPool/GraphMinor/GM16/ConnectedBranchArms.lean new file mode 100644 index 0000000000..2266bf59a7 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ConnectedBranchArms.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.ConnectedTripod +import Mathlib.Data.Fintype.EquivFin +import Mathlib.Data.Fin.Tuple.Basic +import Mathlib.Tactic.FinCases + +/-! +# Branch arms for at most three attachments + +The subdivision step in XVI (4.2), page 54, uses a connected branch +set with at most three attachment vertices. Pad the list of attachments +to three entries, apply the three-arm construction, and keep just the +arms for the actual attachments. Empty attachment sets are allowed. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 +universe u v + +private theorem tripod_family {α : Type u} {β : Type v} {G : Graph α β} + (hG : GraphConnected G) (a : Fin 3 → α) (ha : ∀ i, a i ∈ V(G)) : + ∃ (m : α) (P : Fin 3 → Graph α β), m ∈ V(G) ∧ + (∀ i, IsGraphPathWithEnds G (P i) m (a i)) ∧ + ∀ i j, i ≠ j → V(P i) ∩ V(P j) = {m} := by + obtain ⟨m, P₁, P₂, P₃, hm, hP₁, hP₂, hP₃, h12, h13, h23⟩ := + exists_connected_tripod hG (ha 0) (ha 1) (ha 2) + let P : Fin 3 → Graph α β := ![P₁, P₂, P₃] + refine ⟨m, P, hm, ?_, ?_⟩ + · intro i + fin_cases i + · exact hP₁ + · exact hP₂ + · exact hP₃ + · intro i j hij + fin_cases i <;> fin_cases j + all_goals try exact (hij rfl).elim + · exact h12 + · exact h13 + · exact (Set.inter_comm _ _).trans h12 + · exact h23 + · exact (Set.inter_comm _ _).trans h13 + · exact (Set.inter_comm _ _).trans h23 + +/-- A family of at most three attachment occurrences has disjoint arms +from a common centre. Repeated attachment vertices are allowed. -/ +theorem exists_connected_indexed_arms {α : Type u} {β : Type v} {G : Graph α β} + (hG : GraphConnected G) {ι : Type*} [Finite ι] (hCard : Nat.card ι ≤ 3) + (attach : ι → α) (hAttach : ∀ i, attach i ∈ V(G)) : + ∃ (m : α) (P : ι → Graph α β), m ∈ V(G) ∧ + (∀ i, IsGraphPathWithEnds G (P i) m (attach i)) ∧ + ∀ i j, i ≠ j → V(P i) ∩ V(P j) = {m} := by + classical + let : Fintype ι := Fintype.ofFinite ι + obtain ⟨emb⟩ : Nonempty (ι ↪ Fin 3) := Function.Embedding.nonempty_of_card_le + (by simpa only [Nat.card_eq_fintype_card, Fintype.card_fin] using hCard) + obtain ⟨v, hv⟩ := hG.1 + let a : Fin 3 → α := fun i => if h : ∃ x : ι, emb x = i then attach h.choose else v + have ha : ∀ i, a i ∈ V(G) := by + intro i + dsimp only [a] + split_ifs with h + · exact hAttach h.choose + · exact hv + have hax (x : ι) : a (emb x) = attach x := by + dsimp only [a] + rw [dite_eq_left (show ∃ y : ι, emb y = emb x from ⟨x, rfl⟩)] + exact congrArg attach (emb.injective + (Exists.choose_spec (show ∃ y : ι, emb y = emb x from ⟨x, rfl⟩))) + obtain ⟨m, P, hm, hPath, hInter⟩ := tripod_family hG a ha + refine ⟨m, fun x => P (emb x), hm, ?_, ?_⟩ + · intro x + exact hax x ▸ hPath (emb x) + · intro x y hne + exact hInter (emb x) (emb y) (fun h => hne (emb.injective h)) + +/-- A connected branch set with at most three attachment vertices has +arms from one centre to those vertices, meeting pairwise only at the +centre. This is the local construction in XVI (4.2), page 54. -/ +theorem exists_connected_branch_arms {α : Type u} {β : Type v} {G : Graph α β} + (hG : GraphConnected G) {X : Set α} (hFin : X.Finite) + (hSub : X ⊆ V(G)) (hCard : X.ncard ≤ 3) : + ∃ (m : α) (P : X → Graph α β), m ∈ V(G) ∧ + (∀ x : X, IsGraphPathWithEnds G (P x) m x.val) ∧ + ∀ x y : X, x ≠ y → V(P x) ∩ V(P y) = {m} := by + let : Finite X := hFin.to_subtype + exact exists_connected_indexed_arms hG hCard Subtype.val (fun x => hSub x.property) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ConnectedPathStar.lean b/LeanPool/GraphMinor/GM16/ConnectedPathStar.lean new file mode 100644 index 0000000000..086984c425 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ConnectedPathStar.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.GraphPathSystemUnion +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Walks + +/-! +# A union of paths from one centre is connected + +Every vertex on an arm can reach the centre along a subpath of +that arm. These walks lie in the union graph. Joining two such +walks at the centre proves graph connectivity. Keeping the centre +as a separate vertex also covers the case of no arms. This is +the branch graph used for the subdivision minor in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Surface GM09 +universe u v w + +private theorem walk_reflTransGen_adj {α : Type u} {β : Type v} {G : Graph α β} + {a b : α} (W : GraphWalk G a b) : Relation.ReflTransGen G.Adj a b := by + induction W with + | nil _ => exact .refl + | @cons a c b e h W ih => exact (Relation.ReflTransGen.single ⟨e,h⟩).trans ih + +/-- The union of paths with a common initial vertex is connected, +including when the index type is empty. -/ +theorem graphConnected_pathSystemGraph_star + {α : Type u} {β : Type v} {ι : Type w} {G : Graph α β} + {a : α} {P : ι → Graph α β} {b : ι → α} + (hP : ∀ i, IsGraphPathWithEnds G (P i) a (b i)) : + GraphConnected (pathSystemGraph G {a} P) := by + let K := pathSystemGraph G {a} P + have hPK : ∀ i, P i ≤ K := le_pathSystemGraph (fun i => (hP i).le) + have haK : a ∈ V(K) := Or.inl (mem_singleton a) + have hToA (x : α) (hx : x ∈ V(K)) : Nonempty (GraphWalk K x a) := by + change x ∈ ({a} : Set α) ∪ ⋃ i, V(P i) at hx + rcases hx with hx | hx + · rw [mem_singleton_iff] at hx + subst x + exact ⟨.nil haK⟩ + · obtain ⟨i,hxi⟩ := mem_iUnion.mp hx + obtain ⟨Q,hQP,hQ,_⟩ := (hP i).exists_subpath hxi (hP i).left_mem + obtain ⟨W,_,_,_⟩ := hQ.2 + obtain ⟨W',_,_⟩ := exists_walk_up_of_le (hQP.trans (hPK i)) W + exact ⟨W'⟩ + refine ⟨⟨a,haK⟩,?_⟩ + intro x hx y hy + obtain ⟨W⟩ := hToA x hx + obtain ⟨W'⟩ := hToA y hy + exact walk_reflTransGen_adj (W.append W'.reverse) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ConnectedSeparationSide.lean b/LeanPool/GraphMinor/GM16/ConnectedSeparationSide.lean new file mode 100644 index 0000000000..2962e2c39d --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ConnectedSeparationSide.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Minor.Model +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# A connected subgraph avoiding a separator + +If a connected subgraph misses the separator, all its vertices and +edges lie on one side. Walk along the subgraph from a fixed vertex. +A first edge on the other side would put its starting vertex in the +separator. This supplies the uncut-row step in XVI (4.2), Claim (1). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Hypergraph GM10 +universe u v + +/-- A connected subgraph disjoint from the separator lies on one side +of the separation. -/ +theorem connected_subgraph_in_one_side {α : Type u} {β : Type v} + {G K : Graph α β} (hV : V(G).Finite) (hE : E(G).Finite) + {A B : Hypergraph α β} (hSep : (Hypergraph.ofGraph G hV hE).IsSeparation A B) + (hK : K ≤ G) (hConn : GraphConnected K) + (hAvoid : Disjoint V(K) (A.vertexSet ∩ B.vertexSet)) : + (V(K) ⊆ A.vertexSet ∧ E(K) ⊆ A.edgeSet) ∨ + (V(K) ⊆ B.vertexSet ∧ E(K) ⊆ B.edgeSet) := by + have propagate (A B : Hypergraph α β) + (hSep : (Hypergraph.ofGraph G hV hE).IsSeparation A B) + (hAvoid : Disjoint V(K) (A.vertexSet ∩ B.vertexSet)) + (x : α) (hxK : x ∈ V(K)) (hxA : x ∈ A.vertexSet) : + V(K) ⊆ A.vertexSet ∧ E(K) ⊆ A.edgeSet := by + have hVertices : V(K) ⊆ A.vertexSet := by + intro y hy + have hwalk := hConn.2 x hxK y hy + have hresult : y ∈ V(K) ∧ y ∈ A.vertexSet := by + induction hwalk with + | refl => exact ⟨hxK, hxA⟩ + | @tail z w _ hzw ih => + obtain ⟨e, hlink⟩ := hzw + have ih₀ := ih hlink.left_mem + have hG := hK.isLink_mono hlink + have heAB : e ∈ A.edgeSet ∪ B.edgeSet := hSep.edgeSet_union.symm ▸ hG.edge_mem + refine ⟨hlink.right_mem, ?_⟩ + rcases heAB with heA | heB + · exact A.vertex_mem_of_inc ((inc_iff_of_le hSep.left_le heA).mpr hG.inc_right) + · have hzB := B.vertex_mem_of_inc ((inc_iff_of_le hSep.right_le heB).mpr hG.inc_left) + exact ((disjoint_left.mp hAvoid) ih₀.1 ⟨ih₀.2, hzB⟩).elim + exact hresult.2 + refine ⟨hVertices, ?_⟩ + intro e heK + obtain ⟨z, w, hlink⟩ := exists_isLink_of_mem_edgeSet heK + have hG := hK.isLink_mono hlink + have heAB : e ∈ A.edgeSet ∪ B.edgeSet := hSep.edgeSet_union.symm ▸ hG.edge_mem + rcases heAB with heA | heB + · exact heA + · have hzB := B.vertex_mem_of_inc ((inc_iff_of_le hSep.right_le heB).mpr hG.inc_left) + exact ((disjoint_left.mp hAvoid) hlink.left_mem ⟨hVertices hlink.left_mem, hzB⟩).elim + obtain ⟨x, hxK⟩ := hConn.1 + have hxAB : x ∈ A.vertexSet ∪ B.vertexSet := + hSep.vertexSet_union.symm ▸ hK.vertexSet_mono hxK + rcases hxAB with hxA | hxB + · exact Or.inl (propagate A B hSep hAvoid x hxK hxA) + · exact Or.inr (propagate B A hSep.symm (by simpa only [Set.inter_comm] using hAvoid) x hxK hxB) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ConnectedTripod.lean b/LeanPool/GraphMinor/GM16/ConnectedTripod.lean new file mode 100644 index 0000000000..8b3cfcc033 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ConnectedTripod.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Minor.Model +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Three paths from one branch vertex + +For the subcubic-minor step of XVI (4.2), page 54, a branch set has +at most three attachment vertices. Join two by a path. Join the third +to that path, stopping at its first meeting, and split the first path +there. The three resulting arms meet only at that vertex. Attachment +vertices may coincide, in which case some arms have one vertex. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 +universe u v + +/-- A connected graph has a path between each pair of its vertices. -/ +theorem GraphConnected.exists_path {α : Type u} {β : Type v} {G : Graph α β} + (hG : GraphConnected G) {a b : α} (ha : a ∈ V(G)) (hb : b ∈ V(G)) : + ∃ P : Graph α β, IsGraphPathWithEnds G P a b := by + have hwalk : ∀ {x y : α}, Relation.ReflTransGen G.Adj x y → x ∈ V(G) → + Nonempty (GraphWalk G x y) := by + intro x y h + induction h with + | refl => intro hx; exact ⟨.nil hx⟩ + | @tail z w _ hzw ih => + intro hx + obtain ⟨W⟩ := ih hx + obtain ⟨e, hlink⟩ := hzw + exact ⟨W.append (.cons hlink (.nil hlink.right_mem))⟩ + obtain ⟨W⟩ := hwalk (hG.2 a ha b hb) ha + obtain ⟨P, hP, _, _⟩ := exists_isGraphPathWithEnds_of_walk W + exact ⟨P, hP⟩ + +/-- The branch-set construction in the subcubic-minor step of XVI +(4.2), page 54: three attachment vertices can be joined to one vertex +by arms that meet pairwise only at that vertex. -/ +theorem exists_connected_tripod {α : Type u} {β : Type v} {G : Graph α β} + (hG : GraphConnected G) {a b c : α} + (ha : a ∈ V(G)) (hb : b ∈ V(G)) (hc : c ∈ V(G)) : + ∃ (m : α) (P₁ P₂ P₃ : Graph α β), m ∈ V(G) ∧ + IsGraphPathWithEnds G P₁ m a ∧ IsGraphPathWithEnds G P₂ m b ∧ + IsGraphPathWithEnds G P₃ m c ∧ + V(P₁) ∩ V(P₂) = {m} ∧ V(P₁) ∩ V(P₃) = {m} ∧ V(P₂) ∩ V(P₃) = {m} := by + obtain ⟨P, hP⟩ := GraphConnected.exists_path hG ha hb + obtain ⟨Q, hQ⟩ := GraphConnected.exists_path hG hc ha + obtain ⟨x, hx, m, hm, R, _, hR⟩ := hQ.exists_isFromToPathWithEnds + (show c ∈ ({c} : Set α) from mem_singleton _) hP.left_mem + have hxc : x = c := hx + subst x + obtain ⟨P₁, P₂, hP₁, hP₂, hPath₁, hPath₂, _, hInter, _⟩ := hP.exists_split_at hm + have hRpath : IsGraphPathWithEnds G R c m := hR.1 + have hMeet : V(R) ∩ V(P) = {m} := hR.2.2 + have hIntersect (L : Graph α β) (hL : L ≤ P) (hmL : m ∈ V(L)) : + V(L) ∩ V(R) = {m} := by + apply Subset.antisymm + · rintro z ⟨hzL, hzR⟩ + exact hMeet ▸ ⟨hzR, hL.vertexSet_mono hzL⟩ + · rintro z rfl + exact ⟨hmL, hRpath.right_mem⟩ + refine ⟨m, P₁, P₂, R, hP.le.vertexSet_mono hm, + (hPath₁.mono hP.le).symm, hPath₂.mono hP.le, hRpath.symm, hInter, ?_, ?_⟩ + · exact hIntersect P₁ hP₁ hPath₁.right_mem + · exact hIntersect P₂ hP₂ hPath₂.left_mem + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ConnectedTwoBoundaries.lean b/LeanPool/GraphMinor/GM16/ConnectedTwoBoundaries.lean new file mode 100644 index 0000000000..9e5f4fdae4 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ConnectedTwoBoundaries.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +public import LeanPool.GraphMinor.GM06.Defs +import LeanPool.GraphMinor.GM16.ConnectedBoundary +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Two boundary circuits joined by a path + +Each circuit is connected. A path between the two circuits therefore +connects all boundary vertices inside the annular subgraph. The +connected-boundary lemma then connects every other vertex. This is +the combinatorial part of XVI (8.1), Claim (14). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM06 +universe u v + +/-- The graph of a circuit drawing is connected, since prefixes of +its defining closed walk join every vertex to the initial vertex. -/ +theorem circuit_drawing_isGraphConnected {S : Type u} [TopologicalSpace S] + {C : Drawing S} (hC : C.IsCircuit) : IsGraphConnected C.toGraph := by + change C.V.Nonempty ∧ ∀ x ∈ C.V, ∀ y ∈ C.V, Nonempty (GraphWalk C.toGraph x y) + obtain ⟨a, W, _, _, hV, _⟩ := hC + refine ⟨⟨a, hV.symm ▸ W.start_mem_support⟩, ?_⟩ + intro x hx y hy + rw [hV] at hx hy + obtain ⟨W₁, _, _⟩ := W.exists_append_of_mem hx + obtain ⟨W₂, _, _⟩ := W.exists_append_of_mem hy + exact ⟨W₁.reverse.append W₂⟩ + +/-- Two connected boundary subgraphs joined inside a subgraph form +a connected boundary. Retaining all edges away from this boundary +then makes the entire subgraph connected. -/ +theorem isGraphConnected_of_two_boundaries {α : Type u} {β : Type v} + {G Q I O : Graph α β} {a b : α} + (hQG : Q ≤ G) (hG : IsGraphConnected G) + (hIQ : I ≤ Q) (hOQ : O ≤ Q) (hI : IsGraphConnected I) (hO : IsGraphConnected O) + (ha : a ∈ V(I)) (hb : b ∈ V(O)) (W : GraphWalk Q a b) + (hKeep : ∀ e x y, G.IsLink e x y → x ∈ V(Q) → + x ∉ V(I) ∪ V(O) → Q.IsLink e x y) : IsGraphConnected Q := by + have hToA : ∀ x ∈ V(I) ∪ V(O), Nonempty (GraphWalk Q x a) := by + intro x hx + rcases hx with hxI | hxO + · obtain ⟨R⟩ := hI.2 x hxI a ha + obtain ⟨R', _, _⟩ := GraphMinor.GM09.exists_walk_up_of_le hIQ R + exact ⟨R'⟩ + · obtain ⟨R⟩ := hO.2 x hxO b hb + obtain ⟨R', _, _⟩ := GraphMinor.GM09.exists_walk_up_of_le hOQ R + exact ⟨R'.append W.reverse⟩ + apply isGraphConnected_of_connected_boundary hQG hG ⟨a, Or.inl ha⟩ + (union_subset hIQ.vertexSet_mono hOQ.vertexSet_mono) _ hKeep + intro x hx y hy + obtain ⟨R⟩ := hToA x hx + obtain ⟨T⟩ := hToA y hy + exact ⟨R.append T.reverse⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ControlFromInducedTangle.lean b/LeanPool/GraphMinor/GM16/ControlFromInducedTangle.lean new file mode 100644 index 0000000000..e5b8a68f40 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ControlFromInducedTangle.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM16.HypergraphImageTangle +public import LeanPool.GraphMinor.GM10.Defs2 +import LeanPool.GraphMinor.GM16.Section8Truncation +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Control from a conformal induced tangle + +Relabel a tangle in a subgraph to its drawing. A restricted small +side in that drawing has the same edge set in the subgraph after +applying the inverse edge map. It therefore belongs to the +induced ambient tangle, which is contained in the original one. +The tangle orientation axiom gives the converse. This establishes +the control condition for the sphere span in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Hypergraph Surface GM10 GM14 GM15 +universe u v w + +/-- A drawing relabelling of a subgraph tangle is controlled by the +ambient tangle when its induced ambient tangle is a subset of it. -/ +theorem controllingTangle_of_induced_subset + {α : Type u} {β : Type v} {S : Type w} [TopologicalSpace S] + {G N : Graph α β} {D : Drawing S} (η : SpanEmbedding D G) (hImage : η.imageGraph = N) + {θstar θ : ℕ} {Tstar : Set (Hypergraph α β × Hypergraph α β)} + (hTstar : IsGraphTangle G θstar Tstar) (hθ : θ ≤ θstar) + (hVN : V(N).Finite) (hEN : E(N).Finite) (TN : Set (Hypergraph α β × Hypergraph α β)) + (hTN : IsTangle (Hypergraph.ofGraph N hVN hEN) θ TN) + (f : α → S) (g : β → Set S) (hInv : LeftInvOn η.eMap g E(N)) + (hTD : IsTangle D.toHypergraph θ (imageHypergraphTangle f g TN)) + (hConformal : inducedTangle (Hypergraph.ofGraph G hTstar.finite_V hTstar.finite_E) + (Hypergraph.ofGraph N hVN hEN) TN θ ⊆ Tstar) : + IsControllingTangle G D η θstar θ Tstar (imageHypergraphTangle f g TN) := by + have hForces {A B : Hypergraph α β} + (hSep : (Hypergraph.ofGraph G hTstar.finite_V hTstar.finite_E).IsSeparation A B) + (hOrd : separationOrder A B < θ) {AH BH : Hypergraph S (Set S)} + (hRest : IsRestrictedSeparation D G η A B AH BH) + (hMem : (AH,BH) ∈ imageHypergraphTangle f g TN) : (A,B) ∈ Tstar := by + obtain ⟨⟨AN,BN⟩,hAN,hPair⟩ := hMem + have hEdges : g '' AN.edgeSet=AH.edgeSet := congrArg (fun p => p.1.edgeSet) hPair + have hSub : AN.edgeSet ⊆ E(N) := (hTN.isSeparation hAN).left_le.edgeSet_subset + have hInvAN : η.eMap '' (g '' AN.edgeSet)=AN.edgeSet := hInv.image_image' hSub + have hPattern : AN.edgeSet=A.edgeSet ∩ E(N) := by + calc + AN.edgeSet = η.eMap '' (g '' AN.edgeSet) := hInvAN.symm + _ = η.eMap '' AH.edgeSet := congrArg (fun X => η.eMap '' X) hEdges + _ = A.edgeSet ∩ E(N) := by simpa only [hImage] using hRest.2.2.1 + exact hConformal ⟨hSep,hOrd,(AN,BN),hAN,hPattern⟩ + refine ⟨hθ,hTstar,hTD,?_⟩ + intro A B hSep hOrd AH BH hRest + constructor + · intro hAB + have hRestOrd : separationOrder AH BH < θ := (restrictedSeparation_order_le hRest).trans_lt hOrd + rcases hTD.axiom1 hRest.1 hRestOrd with hMem | hMem + · exact hMem + · have hRestBA : IsRestrictedSeparation D G η B A BH AH := + ⟨hRest.1.symm,hRest.2.2.2.1,hRest.2.2.2.2,hRest.2.1,hRest.2.2.1⟩ + have hOrdBA : separationOrder B A < θ := by rw [separationOrder_comm]; exact hOrd + have hBA := hForces hSep.symm hOrdBA hRestBA hMem + exact (GM10.theorem_2_1_proof hTstar.isTangle hAB hBA).elim + · intro hMem + exact hForces hSep hOrd hRest hMem + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ConvexFaceLines.lean b/LeanPool/GraphMinor/GM16/ConvexFaceLines.lean new file mode 100644 index 0000000000..0a6a6253c7 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ConvexFaceLines.lean @@ -0,0 +1,60 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM16.LineImageEmbedding +import LeanPool.GraphMinor.GM11.ArcDrawings +import Mathlib.Analysis.Convex.Basic +import Mathlib.Topology.Algebra.Affine + +/-! +# Lines in intersections of rectangular faces + +The intersection of two coordinate rectangles is convex. Any two +distinct points in it are joined by their straight line segment. +An embedding carries this segment to the line required by the +face criterion for rigidity in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface GM11 + +/-- Distinct points of a convex subset of the coordinate plane are +joined by a line contained in that subset. -/ +theorem exists_line_in_convex {C : Set (ℝ × ℝ)} (hC : Convex ℝ C) + {a b : ℝ × ℝ} (ha : a ∈ C) (hb : b ∈ C) (hab : a ≠ b) : + ∃ L, IsLineWithEnds L a b ∧ L ⊆ C := by + refine ⟨segment ℝ a b,?_,hC.segment_subset ha hb⟩ + have h := isLine_of_injOn (AffineMap.lineMap_continuous (p := a) (q := b)) + (show (0 : ℝ) < 1 by norm_num) (AffineMap.lineMap_injective ℝ hab).injOn + simpa only [← segment_eq_image_lineMap,AffineMap.lineMap_apply_zero, + AffineMap.lineMap_apply_one] using h + +/-- Common points of two embedded closed rectangles can be joined +inside their intersection by a line. -/ +theorem exists_line_in_embedded_rectangles_intersection {S : Type*} + [TopologicalSpace S] [T2Space S] {f : (ℝ × ℝ) → S} (hf : IsEmbedding f) + (a₁ b₁ c₁ d₁ a₂ b₂ c₂ d₂ : ℝ) {x y : S} (hxy : x ≠ y) + (hx : x ∈ (f '' (Icc a₁ b₁ ×ˢ Icc c₁ d₁)) ∩ (f '' (Icc a₂ b₂ ×ˢ Icc c₂ d₂))) + (hy : y ∈ (f '' (Icc a₁ b₁ ×ˢ Icc c₁ d₁)) ∩ (f '' (Icc a₂ b₂ ×ˢ Icc c₂ d₂))) : + ∃ K, IsLineWithEnds K x y ∧ + K ⊆ (f '' (Icc a₁ b₁ ×ˢ Icc c₁ d₁)) ∩ (f '' (Icc a₂ b₂ ×ˢ Icc c₂ d₂)) := by + rw [← image_inter hf.injective] at hx hy ⊢ + obtain ⟨p,hp,rfl⟩ := hx + obtain ⟨q,hq,rfl⟩ := hy + have hpq : p ≠ q := fun he => hxy (congrArg f he) + have hConvex : Convex ℝ ((Icc a₁ b₁ ×ˢ Icc c₁ d₁) ∩ (Icc a₂ b₂ ×ˢ Icc c₂ d₂)) := + ((convex_Icc a₁ b₁).prod (convex_Icc c₁ d₁)).inter + ((convex_Icc a₂ b₂).prod (convex_Icc c₂ d₂)) + obtain ⟨L,hL,hLC⟩ := exists_line_in_convex hConvex hp hq hpq + exact ⟨f '' L,isLineWithEnds_image_embedding hf hL,image_mono hLC⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/CyclicOrderTransport.lean b/LeanPool/GraphMinor/GM16/CyclicOrderTransport.lean new file mode 100644 index 0000000000..bcc28b3967 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/CyclicOrderTransport.lean @@ -0,0 +1,157 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +public import LeanPool.GraphMinor.GM16.FiniteCircleCycle +import Mathlib.Logic.Equiv.Fin.Rotate +import LeanPool.GraphMinor.GM16.CircleListing + +/-! +# Transporting the finite rotation to boundary vertices + +A finite listing of boundary vertices identifies its index set with +the boundary set. Transport rotation through this identification, +fixing all points outside the boundary. First visits to a subset, +and hence clockwise triples, are preserved by this transport. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.GM09 +universe u + +/-- The cyclic order on a finite set induced by an indexed listing. -/ +@[expose] noncomputable def cyclicPermOnSet {α : Type u} {Y : Set α} (hY : Y.Finite) + {n : ℕ} (e : Fin n ≃ Y) : CyclicPerm α := by + classical + let f : α → α := fun x => if hx : x ∈ Y then (e (finRotate n (e.symm ⟨x, hx⟩))).val else x + have hStep : ∀ i : Fin n, f (e i).val = (e (finRotate n i)).val := by + intro i + dsimp only [f] + rw [dite_eq_left (e i).property] + simp only [e.symm_apply_apply] + have hIter : ∀ k : ℕ, ∀ i : Fin n, (f^[k]) (e i).val = (e ((finRotate n)^[k] i)).val := by + intro k + induction k with + | zero => exact fun _ => rfl + | succ k ih => + intro i + rw [Function.iterate_succ_apply', ih, hStep, Function.iterate_succ_apply'] + refine ⟨Y, f, hY, ?_, ?_⟩ + · refine ⟨?_, ?_, ?_⟩ + · intro x hx + dsimp only [f] + rw [dite_eq_left hx] + exact (e _).property + · intro x hx y hy hxy + have hx' : (e (e.symm ⟨x, hx⟩)).val = x := congrArg Subtype.val (e.apply_symm_apply ⟨x, hx⟩) + have hy' : (e (e.symm ⟨y, hy⟩)).val = y := congrArg Subtype.val (e.apply_symm_apply ⟨y, hy⟩) + rw [← hx', ← hy', hStep, hStep] at hxy + have hIdx := (finRotate n).injective (e.injective (Subtype.ext hxy)) + exact hx'.symm.trans ((congrArg (fun i => (e i).val) hIdx).trans hy') + · intro y hy + let i := (finRotate n).symm (e.symm ⟨y, hy⟩) + refine ⟨(e i).val, (e i).property, ?_⟩ + rw [hStep] + simp only [i, Equiv.apply_symm_apply, e.apply_symm_apply] + · intro x hx y hy + let i := e.symm ⟨x, hx⟩ + let j := e.symm ⟨y, hy⟩ + obtain ⟨k, hk⟩ := (finCyclicPerm n).single_orbit i (mem_univ i) j (mem_univ j) + have hx' : (e i).val = x := congrArg Subtype.val (e.apply_symm_apply ⟨x, hx⟩) + have hy' : (e j).val = y := congrArg Subtype.val (e.apply_symm_apply ⟨y, hy⟩) + refine ⟨k, ?_⟩ + rw [← hx', hIter, show (finRotate n)^[k] i = j from hk, hy'] + +/-- Iterating the transported cyclic order agrees with iterating the +rotation of its index set. -/ +theorem cyclicPermOnSet_iterate {α : Type u} {Y : Set α} (hY : Y.Finite) + {n : ℕ} (e : Fin n ≃ Y) (k : ℕ) (i : Fin n) : + ((cyclicPermOnSet hY e).toFun^[k]) (e i).val = (e ((finCyclicPerm n).toFun^[k] i)).val := by + classical + induction k with + | zero => rfl + | succ k ih => + rw [Function.iterate_succ_apply', ih, Function.iterate_succ_apply'] + change (if hx : (e ((finCyclicPerm n).toFun^[k] i)).val ∈ Y then + (e (finRotate n (e.symm ⟨(e ((finCyclicPerm n).toFun^[k] i)).val, hx⟩))).val + else (e ((finCyclicPerm n).toFun^[k] i)).val) = _ + rw [dite_eq_left (e _).property] + simp only [e.symm_apply_apply] + rfl + +/-- First visits to a subset are unchanged under the boundary listing. -/ +theorem cyclicPermOnSet_firstHit_iff {α : Type u} {Y : Set α} (hY : Y.Finite) + {n : ℕ} (e : Fin n ≃ Y) (X : Set (Fin n)) (i j : Fin n) : + (cyclicPermOnSet hY e).FirstHitIn ((fun q => (e q).val) '' X) (e i).val (e j).val ↔ + (finCyclicPerm n).FirstHitIn X i j := by + have hInj : Function.Injective (fun q => (e q).val) := Subtype.val_injective.comp e.injective + unfold CyclicPerm.FirstHitIn + simp only [cyclicPermOnSet_iterate, hInj.eq_iff, mem_image] + simp only [exists_eq_right] + +/-- Clockwise triples are preserved by the transported order. -/ +theorem cyclicPermOnSet_clockwise3_iff {α : Type u} {Y : Set α} (hY : Y.Finite) + {n : ℕ} (e : Fin n ≃ Y) (i j k : Fin n) : + (cyclicPermOnSet hY e).IsClockwise3 (e i).val (e j).val (e k).val ↔ + (finCyclicPerm n).IsClockwise3 i j k := by + have hInj : Function.Injective (fun q => (e q).val) := Subtype.val_injective.comp e.injective + have hSet : ({(e i).val, (e j).val, (e k).val} : Set α) = + (fun q => (e q).val) '' ({i, j, k} : Set (Fin n)) := by + rw [image_insert_eq, image_insert_eq, image_singleton] + rw [CyclicPerm.isClockwise3_iff, CyclicPerm.isClockwise3_iff, hSet] + rw [cyclicPermOnSet_firstHit_iff, cyclicPermOnSet_firstHit_iff, cyclicPermOnSet_firstHit_iff] + simp only [ne_eq, Subtype.val_inj, e.injective.eq_iff, show (cyclicPermOnSet hY e).bar + = Y from rfl, + show (finCyclicPerm n).bar = univ from rfl, (e i).property, (e j).property, (e k).property, + mem_univ, true_and] + +/-- A nonempty finite set injected into a circle inherits the chosen clockwise order. -/ +theorem exists_cyclicPerm_from_circle {α S : Type*} [TopologicalSpace S] {F : Set S} + (φ : Circle ≃ₜ F) (ν : α → S) {Y : Set α} (hY : Y.Finite) (hNe : Y.Nonempty) + (hinj : InjOn ν Y) (hYF : ∀ v ∈ Y, ν v ∈ F) : + ∃ Ω : CyclicPerm α, Ω.bar = Y ∧ AgreesWithOArcHomeo ν Ω F φ := by + classical + let : Fintype Y := hY.fintype + have hCard : Fintype.card Y = Y.ncard := by + rw [← Nat.card_eq_fintype_card, Nat.card_coe_set_eq] + let e₀ : Fin Y.ncard ≃ Y := (finCongr hCard.symm).trans (Fintype.equivFin Y).symm + let ν₀ : Fin Y.ncard → S := fun i => ν (e₀ i).val + have hν₀ : Function.Injective ν₀ := fun i j h => + e₀.injective (Subtype.ext (hinj (e₀ i).2 (e₀ j).2 h)) + obtain ⟨perm, τ, hPerm, hτ, hBounds, hEq⟩ := exists_increasing_circle_angles φ ν₀ hν₀ + (fun i => hYF _ (e₀ i).property) + let e : Fin Y.ncard ≃ Y := (Equiv.ofBijective perm hPerm).trans e₀ + let Ω := cyclicPermOnSet hY e + have hNeCard : 0 < Y.ncard := (Set.ncard_pos hY).mpr hNe + have hEq' : ∀ i, (φ (Circle.exp (τ i))).val = ν (e i).val := hEq + have hTurn : ∀ i, τ i < τ ⟨0, hNeCard⟩ + 2 * Real.pi := by + intro i + have hi := hBounds i + have hzero := hBounds ⟨0, hNeCard⟩ + linarith + have hAgreeFin := finCyclicPerm_agrees_of_angles φ hNeCard (fun i => ν (e i).val) τ hτ hTurn hEq' + refine ⟨Ω, rfl, fun x hx => hYF x hx, ?_⟩ + intro x y z hCW + have hMem := CyclicPerm.isClockwise3_iff.mp hCW + let i := e.symm ⟨x, hMem.2.2.2.1⟩ + let j := e.symm ⟨y, hMem.2.2.2.2.1⟩ + let k := e.symm ⟨z, hMem.2.2.2.2.2.1⟩ + have hi : (e i).val = x := congrArg Subtype.val (e.apply_symm_apply ⟨x, hMem.2.2.2.1⟩) + have hj : (e j).val = y := congrArg Subtype.val (e.apply_symm_apply ⟨y, hMem.2.2.2.2.1⟩) + have hk : (e k).val = z := congrArg Subtype.val (e.apply_symm_apply ⟨z, hMem.2.2.2.2.2.1⟩) + have hCW' : (cyclicPermOnSet hY e).IsClockwise3 (e i).val (e j).val (e k).val := by + rw [hi, hj, hk] + exact hCW + have hFin := (cyclicPermOnSet_clockwise3_iff hY e i j k).mp hCW' + simpa only [hi, hj, hk] using hAgreeFin.2 i j k hFin + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Defs.lean b/LeanPool/GraphMinor/GM16/Defs.lean new file mode 100644 index 0000000000..3e9f73a136 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Defs.lean @@ -0,0 +1,659 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Minor.CompleteGraph + +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM16.ProperArrangementDefs + +/-! +# Definitions for Graph Minors XVI: Excluding a non-planar graph + +This file formalizes the definitions of N. Robertson and P. D. Seymour, +*Graph Minors. XVI. Excluding a non-planar graph*, J. Combin. Theory Ser. B 89 (2003) 43–76, +over the shared definitions from `GraphMinor.GM09.Defs`, `GraphMinor.GM10.Defs`, +`GraphMinor.GM10.Defs2`, `GraphMinor.GM11.Defs`, `GraphMinor.GM14.Defs`, and +`GraphMinor.GM15.Defs`: + +- **Section 1 (pages 43–46):** clique-sums (`IsCliqueSum`), tree-structures over a class of graphs + (`HasTreeStructureOver`), tree-width via tree-structures (`HasTreeWidthLE`), the complete graph + $K_n$ (`completeGraph`), the Wagner graph $V_8$ (`wagnerGraphV8`), drawings of a graph in a + surface (`CanBeDrawnIn`), $(\le n)$-vertex extensions (`IsVertexExtension`), $r$-rings with + perimeter $t_1, \dots, t_n$ (`IsRRing`). +- **Section 2 (pages 47–48):** designs, locations, tree-decompositions, and $n$-enlargements over + graphs (`GraphDesign`, `IsGraphDesign`, `IsGraphLocation`, `graphLocationCore`, + `graphLocationDesign`, `IsGraphPervasive`, `IsGraphTreeDecomposition`, `graphVertexDesign`, + `IsGraphTreeDecompositionOver`, `IsGraphEnlargementVia`, `IsGraphEnlargement`, + `graphEnlargementClass`, `smallGraphDesignClass`), and torsos of a design (`IsTorsoOfDesign`, + `torsosOfClass`). +- **Section 3 (pages 48–52):** proper arrangements (`IsProperArrangement`), $\rho$-vortices in the + sense of Graph Minors XVI (`IsRhoVortex`), segregations of type $(\rho, \kappa)$ in the sense of + Graph Minors XVI (`IsSegregationOfType`), tangles controlling an $L$-minor (`ControlsMinor`), + and the statements of (3.1) and (3.2) (`GM16Theorem31Statement`, `GM16Theorem32Statement`). +- **Section 5 & Section 6 (pages 54–61):** horns at $v \in V(G) \setminus V(\eta(H))$ of breadth + $\ge \theta$ (`IsHorn`), animals $(H, \eta, \mathcal{T}, X, Y)$ with $\chi$ horns and $\delta$ + hairs of strength $\ge (\theta, \sigma)$ (`IsAnimal`, `HasAnimal`), and hairless animals + (`IsHairlessAnimal`, `HasHairlessAnimal`). +- **Section 8 (pages 64–70):** $\gamma$-envelopes $(\Lambda_y : y \in Y)$ around $Y \subseteq V(H)$ + (`IsEnvelope`, `clearEnvelopeDrawing`). +-/ + +@[expose] public section + +namespace GraphMinor.GM16 + +open Set Function Topology +open Graph SimpleGraph Hypergraph +open GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 GraphMinor.GM15 + +export GM14 (IsRegionChain regionalDistance IsBattlefield) +export GM15 (IsCentralSegregation) + +universe u v w + +/-! ## Section 1: Tree-Structure, Clique-Sums, Vertex Extensions, and Rings (pages 43–46) -/ + +section Section1 + +variable {α : Type u} {β : Type v} + +/-- Embed a graph `G : Graph α β` into the edge type `β ⊕ ℕ` via `Sum.inl`, providing an +infinite supply of fresh edge labels `Sum.inr n` for clique-sums. -/ +def liftEdgeInl (G : Graph α β) : Graph α (β ⊕ ℕ) where + vertexSet := V(G) + edgeSet := Sum.inl '' E(G) + IsLink e x y := ∃ e₀, e = Sum.inl e₀ ∧ G.IsLink e₀ x y + isLink_symm _ _ := ⟨fun _ _ ⟨e₀, he, hlink⟩ => ⟨e₀, he, hlink.symm⟩⟩ + eq_or_eq_of_isLink_of_isLink _ _ _ _ _ h1 h2 := by + rcases h1 with ⟨_, he₁, h₁⟩ + rcases h2 with ⟨_, he₂, h₂⟩ + cases he₁.symm.trans he₂ + exact G.eq_or_eq_of_isLink_of_isLink h₁ h₂ + edge_mem_iff_exists_isLink e := by + rcases e with e₀ | n + · simp only [mem_image, Sum.inl.injEq, exists_eq_right, exists_eq_left'] + exact G.edge_mem_iff_exists_isLink e₀ + · simp + left_mem_of_isLink _ _ _ h := by + rcases h with ⟨_, _, hlink⟩ + exact hlink.left_mem + +@[simp] +theorem vertexSet_liftEdgeInl (G : Graph α β) : V(liftEdgeInl G) = V(G) := rfl + +@[simp] +theorem edgeSet_liftEdgeInl (G : Graph α β) : E(liftEdgeInl G) = Sum.inl '' E(G) := rfl + +@[simp] +theorem liftEdgeInl_isLink_inl {G : Graph α β} {e : β} {x y : α} : + (liftEdgeInl G).IsLink (Sum.inl e) x y ↔ G.IsLink e x y := + ⟨fun ⟨_, he, hlink⟩ => Sum.inl.inj he ▸ hlink, fun hlink => ⟨e, rfl, hlink⟩⟩ + +@[simp] +theorem not_liftEdgeInl_isLink_inr {G : Graph α β} {n : ℕ} {x y : α} : + ¬ (liftEdgeInl G).IsLink (Sum.inr n) x y := by + rintro ⟨_, he, _⟩ + cases he + +/-- Every graph `G` is canonically isomorphic to `liftEdgeInl G`. -/ +noncomputable def isoLiftEdgeInl (G : Graph α β) : Iso G (liftEdgeInl G) where + vertexEquiv := Equiv.refl V(G) + edgeEquiv := Equiv.Set.image Sum.inl E(G) Sum.inl_injective + isLink_iff _ _ _ := liftEdgeInl_isLink_inl.symm + +/-- `K` is a complete graph with vertex set `W` (no loops, and a unique edge joining each pair of +distinct vertices of `W`). -/ +def IsCompleteGraphOn (K : Graph α β) (W : Set α) : Prop := + V(K) = W ∧ (∀ e x, ¬ K.IsLoopAt e x) ∧ + ∀ x ∈ W, ∀ y ∈ W, x ≠ y → ∃! e, K.IsLink e x y + +/-- Clique-sum of graphs (Graph Minors XVI, Section 1, page 44): +"Let $G$ be a graph with a separation $(H_1, H_2)$ (that is, $H_1$ and $H_2$ are subgraphs of $G$ +with no common edges and $H_1 \cup H_2 = G$). Let $K$ be a complete graph with +$V(K) = V(H_1) \cap V(H_2)$ and with no edges in common with $H_1$ and $H_2$. Let +$G_i = H_i \cup K$ ($i = 1, 2$). Then we say that $G$ is the *clique-sum* of $G_1$ and $G_2$." -/ +def IsCliqueSum (G G₁ G₂ : Graph α β) : Prop := + ∃ H₁ H₂ K : Graph α β, + IsGraphSeparation G H₁ H₂ ∧ + IsCompleteGraphOn K (V(H₁) ∩ V(H₂)) ∧ + IsGraphSeparation G₁ H₁ K ∧ + IsGraphSeparation G₂ H₂ K + +/-- Tree-structure over a class of graphs (Graph Minors XVI, Section 1, page 44): +"If $G$ can be constructed from members of a class $\mathcal{C}$ of graphs by (repeated) clique-sums +we say that $G$ is a *tree-structure over* $\mathcal{C}$." -/ +inductive HasTreeStructureOver (𝒞 : Set (Graph α β)) : Graph α β → Prop + | base {G : Graph α β} (hG : G ∈ 𝒞) : HasTreeStructureOver 𝒞 G + | cliqueSum {G G₁ G₂ : Graph α β} + (hsum : IsCliqueSum G G₁ G₂) + (h₁ : HasTreeStructureOver 𝒞 G₁) + (h₂ : HasTreeStructureOver 𝒞 G₂) : HasTreeStructureOver 𝒞 G + +/-- Tree-width $\le N$ via tree-structures (Graph Minors XVI, Section 1, page 44): +"Let us say that $G$ has *tree-width* $\le N$ if $G$ is a tree-structure over the class of all +graphs with $\le N + 1$ vertices (and the smallest such $N$ is of course the *tree-width* of $G$)." +-/ +def HasTreeWidthLE (G : Graph α β) (N : ℕ) : Prop := + HasTreeStructureOver {H : Graph α (β ⊕ ℕ) | V(H).encard ≤ (N + 1 : ℕ)} (liftEdgeInl G) + +/-- A tree structure over finite graphs has a finite vertex set. -/ +theorem HasTreeStructureOver.finite_vertexSet {C : Set (Graph α β)} {G : Graph α β} + (hG : HasTreeStructureOver C G) (hC : ∀ H ∈ C, V(H).Finite) : V(G).Finite := by + induction hG with + | base h => exact hC _ h + | cliqueSum hsum _ _ h₁ h₂ => + obtain ⟨H₁, H₂, K, hsep, _, hsep₁, hsep₂⟩ := hsum + rw [← hsep.2.2.1] + exact (h₁.subset hsep₁.1.vertexSet_mono).union (h₂.subset hsep₂.1.vertexSet_mono) + +/-- A graph with a finite tree-width bound has a finite vertex set. -/ +theorem HasTreeWidthLE.finite_vertexSet {G : Graph α β} {N : ℕ} (hG : HasTreeWidthLE G N) : + V(G).Finite := by + rw [← vertexSet_liftEdgeInl G] + exact HasTreeStructureOver.finite_vertexSet hG fun _ hbound => Set.finite_of_encard_le_coe hbound + +/-- The surface `S` has a drawing of the graph `H`: `H` can be drawn in `S` +(Graph Minors XVI, Section 1, page 44). -/ +def CanBeDrawnIn {α' : Type*} {β' : Type*} (S : Type w) [TopologicalSpace S] + (H : Graph α' β') : Prop := + ∃ (ν : α' → S) (edgeOf : β' → Set S), InjOn ν V(H) ∧ + (∀ e ∈ E(H), ∀ u v : α', H.IsLink e u v → u ≠ v → + IsLineWithEnds (edgeOf e) (ν u) (ν v)) ∧ + (∀ e ∈ E(H), ∀ v : α', H.IsLoopAt e v → IsOArc (edgeOf e) ∧ ν v ∈ edgeOf e) ∧ + (∀ e ∈ E(H), ∀ f ∈ E(H), e ≠ f → edgeOf e ∩ edgeOf f ⊆ ν '' V(H)) ∧ + (∀ e ∈ E(H), ∀ v ∈ V(H), ν v ∈ edgeOf e → H.Inc e v) + +/-- The complete graph $K_n$ on `Fin n` with edge type `Sym2 (Fin n)` +(Graph Minors XVI, Section 1, page 44). -/ +abbrev completeGraph (n : ℕ) : Graph (Fin n) (Sym2 (Fin n)) := GraphMinor.completeGraph n + +/-- The Wagner graph $V_8$ (Graph Minors XVI, Section 1, page 44): +"($V_8$ is obtained from an eight-vertex circuit by adding edges joining the four opposite pairs of +vertices.)" -/ +def wagnerGraphV8 : Graph (Fin 8) (Fin 12) where + vertexSet := Set.univ + edgeSet := Set.univ + IsLink e x y := + if h : e.1 < 8 then + (x.1 = e.1 ∧ y.1 = (e.1 + 1) % 8) ∨ (y.1 = e.1 ∧ x.1 = (e.1 + 1) % 8) + else + (x.1 = e.1 - 8 ∧ y.1 = (e.1 - 8 + 4) % 8) ∨ (y.1 = e.1 - 8 ∧ x.1 = (e.1 - 8 + 4) % 8) + isLink_symm e _ := ⟨fun x y h => by + by_cases he : e.1 < 8 <;> simp only [he, ↓reduceDIte] at h ⊢ <;> exact h.symm⟩ + eq_or_eq_of_isLink_of_isLink e x y z w h1 h2 := by + by_cases he : e.1 < 8 <;> simp only [he, ↓reduceDIte] at h1 h2 + · rcases h1 with ⟨hx, hy⟩ | ⟨hy, hx⟩ <;> rcases h2 with ⟨hz, hw⟩ | ⟨hw, hz⟩ + · left; exact Fin.ext (hx.trans hz.symm) + · right; exact Fin.ext (hx.trans hw.symm) + · right; exact Fin.ext (hx.trans hw.symm) + · left; exact Fin.ext (hx.trans hz.symm) + · rcases h1 with ⟨hx, hy⟩ | ⟨hy, hx⟩ <;> rcases h2 with ⟨hz, hw⟩ | ⟨hw, hz⟩ + · left; exact Fin.ext (hx.trans hz.symm) + · right; exact Fin.ext (hx.trans hw.symm) + · right; exact Fin.ext (hx.trans hw.symm) + · left; exact Fin.ext (hx.trans hz.symm) + edge_mem_iff_exists_isLink e := by + simp only [mem_univ, true_iff] + by_cases he : e.1 < 8 + · refine ⟨⟨e.1, he⟩, ⟨(e.1 + 1) % 8, Nat.mod_lt _ (by decide)⟩, ?_⟩ + simp [he] + · refine ⟨⟨e.1 - 8, by omega⟩, ⟨(e.1 - 8 + 4) % 8, Nat.mod_lt _ (by decide)⟩, ?_⟩ + simp [he] + left_mem_of_isLink _ _ _ _ := Set.mem_univ _ + +/-- $(\le n)$-vertex extension (Graph Minors XVI, Section 1, page 45): +"If a subgraph $G'$ of $G$ can be obtained from $G$ by deleting $\le n$ vertices of $G$, let us call +$G$ a *($\le n$)-vertex extension* of $G'$." -/ +def IsVertexExtension (n : ℕ) (G G' : Graph α β) : Prop := + ∃ Z ⊆ V(G), Z.encard ≤ n ∧ deleteVertices G Z = G' + +/-- A vertex extension is witnessed by a finite deletion set of size at most its bound. -/ +theorem isVertexExtension_iff {n : ℕ} {G G' : Graph α β} : + IsVertexExtension n G G' ↔ + ∃ Z ⊆ V(G), Z.Finite ∧ Z.ncard ≤ n ∧ deleteVertices G Z = G' := by + simp only [IsVertexExtension, Set.encard_le_coe_iff_finite_ncard_le, and_assoc] + +/-- Loose $(\le n)$-vertex extension: `G'` is a subgraph of `G` and there exists $Z \subseteq V(G)$ +with $|Z| \le n$ such that $G \setminus Z = G' \setminus Z$. +This notion is not in the paper. It is here for the sentence on page 48 claiming that every torso of +a member of $\mathscr{D}^n$ is a $(\le n)$-vertex extension of a torso of a member of $\mathscr{D}$, +and for (2.3) (`theorem_2_3_proof`): because the definition of $\mathscr{D}^n$ on page 47 allows +$Z \subseteq V(H')$ to meet $V(H)$ and allows $Z \in M'$ without $Z \cap V(H) \in M$, a torso $G$ +of $(H', M') \in \mathscr{D}^n$ can have torso edges with both ends in $Z \cap V(H)$, so the torso +$G' = H \cup (G \setminus Z)$ of $(H, M)$ keeps the vertices of $Z \cap V(H)$ and satisfies +$G \setminus Z = G' \setminus Z$ rather than $G \setminus Z = G'$. -/ +def IsLooseVertexExtension (n : ℕ) (G G' : Graph α β) : Prop := + ∃ Z ⊆ V(G), Z.encard ≤ n ∧ G' ≤ G ∧ deleteVertices G Z = deleteVertices G' Z + +/-- $r$-ring with perimeter $t_1, \dots, t_n$ (Graph Minors XVI, Section 1, page 45): +"More precisely, we say $G$ is an *$r$-ring with perimeter $t_1, \dots, t_n$* if +$t_1, \dots, t_n \in V(G)$ are distinct and there is a sequence $X_1, \dots, X_n$ of subsets of +$V(G)$, such that +* $X_1 \cup \dots \cup X_n = V(G)$, and every edge of $G$ has both ends in some $X_i$, +* $t_i \in X_1$ for $1 \le i \le n$, +* $X_i \cap X_k \subseteq X_j$ for $1 \le i \le j \le k \le n$, +* $|X_i| \le r$ for $1 \le i \le n$." +The print has "$t_i \in X_1$", a misprint for $t_i \in X_i$, which the Lean uses. See the +correction on page 45 in `corrections/GM16.md`. -/ +def IsRRing (G : Graph α β) (r : ℕ) (t : List α) : Prop := + t.Nodup ∧ (∀ x ∈ t, x ∈ V(G)) ∧ + ∃ X : Fin t.length → Set α, + (∀ i, X i ⊆ V(G)) ∧ + (⋃ i, X i) = V(G) ∧ + (∀ e ∈ E(G), ∃ i, ∀ v : α, G.Inc e v → v ∈ X i) ∧ + (∀ i : Fin t.length, t[i.1] ∈ X i) ∧ + (∀ i j k : Fin t.length, i ≤ j → j ≤ k → X i ∩ X k ⊆ X j) ∧ + (∀ i : Fin t.length, (X i).encard ≤ r) + +end Section1 + +/-! ## Section 2: Designs, Locations, Tree-Decompositions, and Torsos (pages 47–48) -/ + +section Section2 + +variable {α : Type u} {β : Type v} {ι : Type*} + +/-- A design `(H, M)` where `H` is a graph and `M` is a set of subsets of `V(H)` +(Graph Minors XVI, Section 2, page 47): +"A *design* is a pair $(H, M)$ where $H$ in a graph and $M$ is a set of subsets of $V(H)$." +("$H$ in a graph" is a misprint for "$H$ is a graph". See the correction on page 47 in +`corrections/GM16.md`.) -/ +abbrev GraphDesign (α : Type u) (β : Type v) := Graph α β × Set (Set α) + +/-- `d = (H, M)` is a valid graph design if `H` is finite and every `X ∈ M` is a subset of `V(H)` +(Graph Minors XVI, Section 2, page 47). -/ +def IsGraphDesign (d : GraphDesign α β) : Prop := + V(d.1).Finite ∧ E(d.1).Finite ∧ ∀ ⦃X : Set α⦄, X ∈ d.2 → X ⊆ V(d.1) + +/-- A location in a graph `G` (Graph Minors XVI, Section 2, page 47): +"A *location* in $G$ is a set $\{(A_1, B_1), \ldots, (A_k, B_k)\}$ of separations of $G$ such that +$A_i \subseteq B_j$ for all distinct $i, j$ with $1 \le i, j \le k$." -/ +structure IsGraphLocation (G : Graph α β) + (ℒ : Set (Graph α β × Graph α β)) : Prop where + /-- `ℒ` is finite. -/ + finite : ℒ.Finite + /-- Every member of `ℒ` is a separation of `G`. -/ + isSeparation : ∀ ⦃p⦄, p ∈ ℒ → IsGraphSeparation G p.1 p.2 + /-- For distinct `p₁, p₂ ∈ ℒ`, `A₁ ≤ B₂`. -/ + left_le_right : ∀ ⦃p₁⦄, p₁ ∈ ℒ → ∀ ⦃p₂⦄, p₂ ∈ ℒ → p₁ ≠ p₂ → p₁.1 ≤ p₂.2 + +/-- The core subgraph `G ∩ B₁ ∩ ⋯ ∩ B_k` of a location `ℒ` in `G` +(Graph Minors XVI, Section 2, page 47). -/ +def graphLocationCore (G : Graph α β) (ℒ : Set (Graph α β × Graph α β)) : Graph α β := + (G.induce {v ∈ V(G) | ∀ p ∈ ℒ, v ∈ V(p.2)}).restrict {e ∈ E(G) | ∀ p ∈ ℒ, e ∈ E(p.2)} + +/-- The design of a location `ℒ` in `G` (Graph Minors XVI, Section 2, page 47): +"If $\{(A_1, B_1), \ldots, (A_k, B_k)\}$ is a location then +$$(G \cap B_1 \cap \cdots \cap B_k, \{V(A_i \cap B_i) \colon 1 \le i \le k\})$$ +is a design, which we call the *design of the location*." -/ +def graphLocationDesign (G : Graph α β) (ℒ : Set (Graph α β × Graph α β)) : GraphDesign α β := + (graphLocationCore G ℒ, (fun p => V(p.1) ∩ V(p.2)) '' ℒ) + +/-- A separation `(A_H, B_H)` of `Hypergraph.ofGraph G` corresponds to a graph separation `(A, B)` +of `G`. -/ +def SeparationOfGraphSep (G A B : Graph α β) (A_H B_H : Hypergraph α β) : Prop := + IsGraphSeparation G A B ∧ + A_H.vertexSet = V(A) ∧ A_H.edgeSet = E(A) ∧ + B_H.vertexSet = V(B) ∧ B_H.edgeSet = E(B) + +/-- A class of designs `𝒟` is `θ`-pervasive in a graph `G` +(Graph Minors XVI, Section 2, page 47): +"Let $\theta \ge 1$ be an integer, and let $\mathscr{D}$ be a class of designs. We say that +$\mathscr{D}$ is *$\theta$-pervasive in a graph $G$* if for every subgraph $G'$ of $G$ and every +tangle $\mathscr{T}$ in $G'$ of order $\ge \theta$ there is a location $\mathscr{L} \subseteq +\mathscr{T}$ +with its design in $\mathscr{D}$." -/ +def IsGraphPervasive (G : Graph α β) (θ : ℕ) (𝒟 : Set (GraphDesign α β)) : Prop := + ∀ ⦃G' : Graph α β⦄, G' ≤ G → + ∀ ⦃θ' : ℕ⦄ ⦃𝒯 : Set (Hypergraph α β × Hypergraph α β)⦄, + θ ≤ θ' → IsGraphTangle G' θ' 𝒯 → + ∃ ℒ : Set (Graph α β × Graph α β), + IsGraphLocation G' ℒ ∧ + (∀ p ∈ ℒ, ∃ p_H ∈ 𝒯, SeparationOfGraphSep G' p.1 p.2 p_H.1 p_H.2) ∧ + graphLocationDesign G' ℒ ∈ 𝒟 + +/-- A tree-decomposition `(T, τ)` of a graph `G` (Graph Minors XVI, Section 2, page 47): +"A *tree-decomposition* of a graph $G$ is a pair $(T, \tau)$, where $T$ is a tree and for each +$t \in V(T)$, $\tau(t)$ is a subgraph of $G$, such that +* $\cup(\tau(t) \colon t \in V(T)) = G$, and $E(\tau(t) \cap \tau(t')) = \emptyset$ for all + distinct $t, t' \in V(T)$, +* if $t, t', t'' \in V(T)$ and $t'$ lies on the path of $T$ between $t$ and $t''$ then + $\tau(t) \cap \tau(t'') \subseteq \tau(t')$." -/ +structure IsGraphTreeDecomposition [Fintype ι] (G : Graph α β) + (T : SimpleGraph ι) (τ : ι → Graph α β) : Prop where + /-- `T` is a tree. -/ + isTree : T.IsTree + /-- Each `τ t` is a subgraph of `G`. -/ + le_G : ∀ t : ι, τ t ≤ G + /-- `⋃_t τ(t) = G` on vertices. -/ + vertexSet_union : (⋃ t : ι, V(τ t)) = V(G) + /-- `⋃_t τ(t) = G` on edges. -/ + edgeSet_union : (⋃ t : ι, E(τ t)) = E(G) + /-- `E(τ(t) ∩ τ(t')) = ∅` for distinct `t, t'`. -/ + edge_disjoint : ∀ ⦃t₁ t₂ : ι⦄, t₁ ≠ t₂ → Disjoint E(τ t₁) E(τ t₂) + /-- Interpolation along paths in `T`: `V(τ(t₁)) ∩ V(τ(t₃)) ⊆ V(τ(t₂))` when `t₂` lies on a path of + `T` between `t₁` and `t₃`. -/ + inter_subset_of_mem_path : ∀ ⦃t₁ t₂ t₃ : ι⦄ (p : T.Walk t₁ t₃), + p.IsPath → t₂ ∈ p.support → V(τ t₁) ∩ V(τ t₃) ⊆ V(τ t₂) + +/-- The design of a vertex `t₀ ∈ V(T)` in a tree-decomposition `(T, τ)` of a graph `G` +(Graph Minors XVI, Section 2, page 47): +"If $(T, \tau)$ is a tree-decomposition of $G$ and $t_0 \in V(T)$, and $t_0$ has neighbours +$t_1, \ldots, t_k \in V(T)$, then +$$(\tau(t_0), \{V(\tau(t_0) \cap \tau(t_i)) \colon 1 \le i \le k\})$$ +is a design, called the *design of $t_0$ in $(T, \tau)$*." -/ +def graphVertexDesign (T : SimpleGraph ι) (τ : ι → Graph α β) (t₀ : ι) : GraphDesign α β := + (τ t₀, {X : Set α | ∃ t : ι, T.Adj t₀ t ∧ X = V(τ t₀) ∩ V(τ t)}) + +/-- `(T, τ)` is a tree-decomposition of `G` whose vertex designs all belong to `𝒟` +(Graph Minors XVI, Section 2, page 48). -/ +def IsGraphTreeDecompositionOver [Fintype ι] (G : Graph α β) (𝒟 : Set (GraphDesign α β)) + (T : SimpleGraph ι) (τ : ι → Graph α β) : Prop := + IsGraphTreeDecomposition G T τ ∧ ∀ t₀ : ι, graphVertexDesign T τ t₀ ∈ 𝒟 + +/-- `(H', M')` is an `n`-enlargement of `(H, M)` via `Z ⊆ V(H')` +(Graph Minors XVI, Section 2, page 47): +"Let $(H, M)$, $(H', M')$ be designs. We say that $(H', M')$ is an *$n$-enlargement of $(H, M)$* if +there exists $Z \subseteq V(H')$ such that +* $H$ is a subgraph of $H'$ and $V(H') \setminus V(H) \subseteq Z$, +* every edge of $H'$ is an edge of $H$, +* for every $X \in M'$ with $X \ne Z$, $X \cap V(H) \in M$, +* $n$ is an integer and $|Z| \le n$." -/ +structure IsGraphEnlargementVia (d d' : GraphDesign α β) (Z : Set α) : Prop where + /-- `d` is a design. -/ + isDesign : IsGraphDesign d + /-- `d'` is a design. -/ + isDesign' : IsGraphDesign d' + /-- `Z ⊆ V(H')`. -/ + subset_vertexSet : Z ⊆ V(d'.1) + /-- `H ≤ H'`. -/ + le : d.1 ≤ d'.1 + /-- `V(H') \ V(H) ⊆ Z`. -/ + sdiff_subset : V(d'.1) \ V(d.1) ⊆ Z + /-- `E(H') ⊆ E(H)`. -/ + edgeSet_subset : E(d'.1) ⊆ E(d.1) + /-- For every `X ∈ M'` with `X ≠ Z`, `X ∩ V(H) ∈ M`. -/ + inter_mem : ∀ ⦃X : Set α⦄, X ∈ d'.2 → X ≠ Z → X ∩ V(d.1) ∈ d.2 + +/-- `(H', M')` is an `n`-enlargement of `(H, M)` (Graph Minors XVI, Section 2, page 47). -/ +def IsGraphEnlargement (n : ℕ) (d d' : GraphDesign α β) : Prop := + ∃ Z : Set α, Z.ncard ≤ n ∧ IsGraphEnlargementVia d d' Z + +/-- The class `𝒟^n` of all `n`-enlargements of members of `𝒟` +(Graph Minors XVI, Section 2, page 47): +"If $\mathscr{D}$ is a class of designs and $n \ge 0$ is an integer, the class of all +$n$-enlargements of members of $\mathscr{D}$ is denoted by $\mathscr{D}^n$." -/ +def graphEnlargementClass (𝒟 : Set (GraphDesign α β)) (n : ℕ) : Set (GraphDesign α β) := + {d' | ∃ d ∈ 𝒟, IsGraphEnlargement n d d'} + +/-- The class `ℛ_n` of all designs `(H, M)` with `|V(H)| ≤ n` +(Graph Minors XVI, Section 2, page 47): +"The class of all designs $(H, M)$ with $|V(H)| \le n$ is denoted by $\mathscr{R}_n$." -/ +def smallGraphDesignClass (n : ℕ) : Set (GraphDesign α β) := + {d | IsGraphDesign d ∧ V(d.1).ncard ≤ n} + +/-- Torso of a design `(H, M)` (Graph Minors XVI, Section 2, page 48): +"Let $(H, M)$ be a design. A graph $H'$ is a *torso* of $(H, M)$ if $V(H) = V(H')$, $H$ is a +subgraph of $H'$, and for every $e \in E(H') \setminus E(H)$ there exists $X \in M$ including the +ends of $e$." -/ +def IsTorsoOfDesign (d : GraphDesign α β) (H' : Graph α β) : Prop := + V(d.1) = V(H') ∧ + d.1 ≤ H' ∧ + ∀ e ∈ E(H') \ E(d.1), ∃ X ∈ d.2, ∀ v : α, H'.Inc e v → v ∈ X + +/-- The class `𝒟'` of torsos of members of `𝒟` (Graph Minors XVI, Section 2, (2.2), page 48). -/ +def torsosOfClass (𝒟 : Set (GraphDesign α β)) : Set (Graph α β) := + {H' : Graph α β | ∃ d ∈ 𝒟, IsTorsoOfDesign d H'} + +end Section2 + +/-! ## Section 3: Proper Arrangements, $\rho$-Vortices, Segregations of Type $(\rho, \kappa)$, and +Controlling Minors (pages 48–52) -/ + +section Section3 + +variable {α : Type u} {β : Type v} + +/-- A society `(G, Ω)` is a `ρ`-vortex in the sense of Graph Minors XVI +(Graph Minors XVI, Section 3, page 49): +"A society $(G, \Omega)$ is a *$\rho$-vortex*, where $\rho \ge 0$ is an integer, if for all distinct +$u, v \in \bar{\Omega}$ there do not exist $\rho + 1$ mutually vertex-disjoint paths of $G$ between +$I \cup \{u\}$ and $J \cup \{v\}$, where $I$ denotes the set of vertices in $\bar{\Omega}$ after $u$ +and before $v$ and $J$ is the set after $v$ and before $u$, in the natural sense (so +$(I \cup \{u\}, J \cup \{v\})$ is a partition of $\bar{\Omega}$)." -/ +def IsRhoVortex (S : Society α β) (ρ : ℕ) : Prop := + ∀ u ∈ S.Ω.bar, ∀ v ∈ S.Ω.bar, u ≠ v → + ¬ ∃ P : Fin (ρ + 1) → Graph α β, + Pairwise (fun i j => Disjoint V(P i) V(P j)) ∧ + ∀ i : Fin (ρ + 1), + ∃ a ∈ S.Ω.interval u v ∪ {u}, ∃ b ∈ S.Ω.interval v u ∪ {v}, + IsGraphPathWithEnds S.G (P i) a b + +/-- A segregation `S_seg` of `G` is of type `(ρ, κ)` in the sense of Graph Minors XVI +(Graph Minors XVI, Section 3, page 49): +"A segregation $\mathscr{S}$ is of *type $(\rho, \kappa)$*, where $\rho, \kappa \ge 0$ are integers, +if $|\bar{\Omega}| > 3$ for at most $\kappa$ members $(A, \Omega)$ of $\mathscr{S}$, and each such +member is a $\rho$-vortex." -/ +structure IsSegregationOfType (G : Graph α β) (ρ κ : ℕ) (S_seg : Set (Society α β)) : Prop where + /-- `S_seg` is a segregation of `G`. -/ + isSegregation : IsGraphSegregation G S_seg + /-- At most `κ` members `(A, Ω) ∈ S_seg` satisfy `|ΩBar| > 3`. -/ + vortex_count_le : {S ∈ S_seg | 3 < S.Ω.bar.ncard}.ncard ≤ κ + /-- Every member `(A, Ω) ∈ S_seg` with `|ΩBar| > 3` is a `ρ`-vortex (`IsRhoVortex S ρ`). -/ + is_rho_vortex : ∀ ⦃S : Society α β⦄, S ∈ S_seg → 3 < S.Ω.bar.ncard → IsRhoVortex S ρ + +/-- A tangle `T_star` in a graph `G` controls an `L`-minor of `G` +(Graph Minors XVI, Section 3, page 49): +"Let $L$ be a graph, and let $\mathscr{T}^*$ be a tangle in a graph $G$. We say that $\mathscr{T}^*$ +*controls an $L$-minor of $G$* if there is a function $\alpha$, with domain $V(L) \cup E(L)$, such +that +* for each $v \in V(L)$, $\alpha(v)$ is a non-null connected subgraph of $G$, and for all distinct + $u, v \in V(L)$, $\alpha(u)$ and $\alpha(v)$ are vertex-disjoint, +* for each $e \in E(L)$ with distinct ends $u, v$, $\alpha(e) \in E(G)$ with one end in + $V(\alpha(u))$ and the other in $V(\alpha(v))$, +* for every loop $e \in E(L)$ with end $v$, $\alpha(e) \in E(G) \setminus E(\alpha(v))$ with both + ends in $V(\alpha(v))$, +* for all distinct $e, f \in E(L)$, $\alpha(e) \ne \alpha(f)$, +* there is no $(A, B) \in \mathscr{T}^*$ of order $< |V(L)|$ and $v \in V(L)$ such that + $V(\alpha(v)) \subseteq V(A)$." -/ +def ControlsMinor {α' : Type*} {β' : Type*} (G : Graph α β) (L : Graph α' β') + (T_star : Set (Hypergraph α β × Hypergraph α β)) : Prop := + ∃ (α_v : α' → Graph α β) (α_e : β' → β), + (∀ v ∈ V(L), α_v v ≤ G ∧ V(α_v v).Nonempty ∧ GraphConnected (α_v v)) ∧ + (∀ u ∈ V(L), ∀ v ∈ V(L), u ≠ v → Disjoint V(α_v u) V(α_v v)) ∧ + (∀ e ∈ E(L), ∀ u ∈ V(L), ∀ v ∈ V(L), u ≠ v → L.IsLink e u v → + α_e e ∈ E(G) ∧ ∃ x ∈ V(α_v u), ∃ y ∈ V(α_v v), G.IsLink (α_e e) x y) ∧ + (∀ e ∈ E(L), ∀ v ∈ V(L), L.IsLoopAt e v → + α_e e ∈ E(G) \ E(α_v v) ∧ ∃ x ∈ V(α_v v), ∃ y ∈ V(α_v v), G.IsLink (α_e e) x y) ∧ + InjOn α_e E(L) ∧ + ∀ ⦃A B : Hypergraph α β⦄, (A, B) ∈ T_star → separationOrder A B < V(L).ncard → + ∀ v ∈ V(L), ¬ V(α_v v) ⊆ A.vertexSet + +/-- The deleted-vertices tangle `T \ Z` in `G \ Z` (Graph Minors XVI, Section 3, page 49): +"If $\mathscr{T}$ is a tangle in $G$ of order $\theta$ and $Z \subseteq V(G)$ with $|Z| < \theta$, +we +denote by $\mathscr{T} \setminus Z$ the set of all separations $(A', B')$ of $G \setminus Z$ of +order +$<\theta - |Z|$ such that there exists $(A, B) \in \mathscr{T}$ with $Z \subseteq V(A \cap B)$, +$A \setminus Z = A'$ and $B \setminus Z = B'$." -/ +def deleteGraphVerticesTangle (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) + (Z : Set α) (T : Set (Hypergraph α β × Hypergraph α β)) (θ : ℕ) : + Set (Hypergraph α β × Hypergraph α β) := + GM10.deleteVerticesTangle (Hypergraph.ofGraph G hV hE) Z T θ + +/-- Statement of Graph Minors XVI, (3.1) (page 49): +"For any graph $L$, there are integers $\kappa, \rho, \zeta \ge 0$ and $\theta \ge 1$ with the +following property. Let $\mathscr{T}$ be a tangle of order $\ge \theta$ in a graph $G$, controlling +no $L$-minor of $G$. Then there exists $Z \subseteq V(G)$ with $|Z| \le \zeta$, and a +$\mathscr{T} \setminus Z$-central segregation of $G \setminus Z$ of type $(\rho, \kappa)$ which has +a +proper arrangement in some surface in which $L$ cannot be drawn." -/ +def GM16Theorem31Statement : Prop := + ∀ {α' : Type*} {β' : Type*} (L : Graph α' β'), V(L).Finite → E(L).Finite → + ∃ κ ρ ζ θ : ℕ, 1 ≤ θ ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_G : ℕ) + (T : Set (Hypergraph α β × Hypergraph α β)) + (hT : IsGraphTangle G θ_G T), + θ ≤ θ_G → ¬ ControlsMinor G L T → + ∃ (Z : Set α) (S_seg : Set (Society α β)) + (S : Type w) (_ : TopologicalSpace S) (_ : T2Space S) + (α_disc : Society α β → Set S) (α_pt : α → S), + Z ⊆ V(G) ∧ Z.ncard ≤ ζ ∧ Z.ncard < θ_G ∧ + IsClosedSurface S ∧ ConnectedSpace S ∧ ¬ CanBeDrawnIn S L ∧ + IsCentralSegregation (deleteVertices G Z) + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T θ_G) S_seg ∧ + IsSegregationOfType (deleteVertices G Z) ρ κ S_seg ∧ + IsProperArrangement S_seg α_disc α_pt + +/-- Statement of Graph Minors XVI, (3.2) (page 50): +"Let $(G, \Omega)$ be a $\rho$-vortex, and let the vertices in $\bar{\Omega}$ be $t_1, \ldots, t_n$ +in order, where $n \ge 1$. Then there are separations $(A_1, B_1), \ldots, (A_n, B_n)$ of $G$, such +that: +1. $t_1, \ldots, t_n \in V(B_i)$ for $1 \le i \le n$, +2. $t_i \in V(A_i)$ for $1 \le i \le n$, +3. $\mathscr{L} = \{(A_1, B_1), \ldots, (A_n, B_n)\}$ is a location in $G$, +4. $(A_i, B_i)$ has order $\le 2\rho + 1$ for $1 \le i \le n$, and +5. every torso of the design of $\mathscr{L}$ is a $(2\rho + 1)$-ring with perimeter +$t_1, \ldots, t_n$." -/ +def GM16Theorem32Statement : Prop := + ∀ {α : Type u} {β : Type v} (S : Society α β) (ρ n : ℕ) (t : Fin n → α), + 1 ≤ n → IsRhoVortex S ρ → + Injective t → range t = S.Ω.bar → S.Ω.IsClockwiseSeq (List.ofFn t) → + ∃ A B : Fin n → Graph α β, + (∀ i : Fin n, IsGraphSeparation S.G (A i) (B i)) ∧ + (∀ i j : Fin n, t j ∈ V(B i)) ∧ + (∀ i : Fin n, t i ∈ V(A i)) ∧ + IsGraphLocation S.G (range fun i : Fin n => (A i, B i)) ∧ + (∀ i : Fin n, (V(A i) ∩ V(B i)).ncard ≤ 2 * ρ + 1) ∧ + (∀ H' : Graph α β, + IsTorsoOfDesign (graphLocationDesign S.G (range fun i : Fin n => (A i, B i))) H' → + IsRRing H' (2 * ρ + 1) (List.ofFn t)) + +end Section3 + +/-! ## Section 5 & Section 6: Horns and Animals (pages 54–61) -/ + +section Section5And6 + +variable {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + +/-- Horn at $v \in V(G) \setminus V(\eta(H))$ of breadth $\ge \theta$ over $H, \eta, \mathcal{T}$ +(Graph Minors XVI, Section 5, page 55): +"A horn at $v$ of breadth $\ge \theta$ (over $H, \eta, \mathscr{T}$) is a set +$\{P_1, \dots, P_\sigma\}$ of paths of $G$, such that +* $P_1, \dots, P_\sigma$ each have one end $v$ and are otherwise mutually disjoint, +* for $1 \le i \le \sigma$, $P_i$ has precisely one vertex in $V(\eta(H))$, its end different from + $v$; let this end be $\eta(u_i)$, where $u_i \in V(H)$, +* for $1 \le i < j \le \sigma$, $d(u_i, u_j) \ge \theta$ where $d$ is the metric of $\mathscr{T}$ + (see [8, section 3])." -/ +def IsHorn (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (d : Set S → Set S → ℕ) (v : α) (θ σ : ℕ) + (P : Fin σ → Graph α β) (u : Fin σ → S) : Prop := + v ∈ V(G) \ V(η.imageGraph) ∧ + (∀ i : Fin σ, u i ∈ H.V) ∧ + (∀ i : Fin σ, IsGraphPathWithEnds G (P i) v (η.vMap (u i))) ∧ + (∀ i : Fin σ, V(P i) ∩ V(η.imageGraph) = {η.vMap (u i)}) ∧ + (∀ i j : Fin σ, i ≠ j → V(P i) ∩ V(P j) = {v} ∧ Disjoint E(P i) E(P j)) ∧ + (∀ i j : Fin σ, i ≠ j → θ ≤ d {u i} {u j}) + +/-- Animal $(H, \eta, \mathcal{T}, X, Y)$ with $\chi$ horns and $\delta$ hairs, of strength +$\ge (\theta, \sigma)$ (Graph Minors XVI, Section 5, page 55): +"Let $\Sigma$ be a surface. An animal (in $G$, with respect to $\mathscr{T}^*$) is a quintuple +$(H, \eta, \mathscr{T}, X, Y)$, such that $H, \eta, \mathscr{T}$ is a $\Sigma$-span, +$X \subseteq V(G) \setminus V(\eta(H))$ and $Y \subseteq V(H)$. If $|X| = \chi$ and $|Y| = \delta$, +we call this an animal with $\chi$ horns and $\delta$ hairs. The animal has strength +$\ge (\theta, \sigma)$, where $\theta \ge 1$ and $\sigma \ge 0$ are integers, if +* $\mathscr{T}$ has order $\ge \theta$, +* for each $v \in X$ there is a horn at $v$ of cardinality $\ge \sigma$ and breadth $\ge \theta$, +* for each $u \in Y$ there is an $\eta(H)$-path (see [8, section 3]) $P$ with ends + $\eta(u), \eta(v)$ say, such that $X \cap V(P) = \emptyset$ and $d(u, v) \ge \theta$, where $d$ is + the metric of $\mathscr{T}$, +* $d(u_1, u_2) \ge \theta$ for all distinct $u_1, u_2 \in Y$." -/ +def IsAnimal (G : Graph α β) + (T_star : Set (Hypergraph α β × Hypergraph α β)) (θ_star : ℕ) + (H : Drawing S) (η : SpanEmbedding H G) (θ_span : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (X : Set α) (Y : Set S) (χ δ θ σ : ℕ) : Prop := + 1 ≤ θ ∧ θ ≤ θ_span ∧ + IsSigmaSpan G H η θ_star θ_span T_star T ∧ + HasTangleMetric H θ_span T d ∧ + X ⊆ V(G) \ V(η.imageGraph) ∧ X.ncard = χ ∧ + Y ⊆ H.V ∧ Y.ncard = δ ∧ + (∀ v ∈ X, ∃ (P : Fin σ → Graph α β) (u : Fin σ → S), + IsHorn G H η d v θ σ P u) ∧ + (∀ u ∈ Y, ∃ (v : S) (P : Graph α β), + v ∈ H.V ∧ u ≠ v ∧ IsHPathWithEnds G η.imageGraph P (η.vMap u) (η.vMap v) ∧ + Disjoint X V(P) ∧ θ ≤ d {u} {v}) ∧ + (∀ u₁ ∈ Y, ∀ u₂ ∈ Y, u₁ ≠ u₂ → θ ≤ d {u₁} {u₂}) + +/-- Existence of an animal in `G` with respect to `T_star` on surface `S` with `χ` horns and `δ` +hairs, of strength `≥ (θ, σ)` (Graph Minors XVI, Section 5, page 55). -/ +def HasAnimal (S : Type w) [TopologicalSpace S] [T2Space S] + (G : Graph α β) (T_star : Set (Hypergraph α β × Hypergraph α β)) (θ_star : ℕ) + (χ δ θ σ : ℕ) : Prop := + ∃ (H : Drawing S) (η : SpanEmbedding H G) (θ_span : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (X : Set α) (Y : Set S), + IsAnimal G T_star θ_star H η θ_span T d X Y χ δ θ σ + +/-- Hairless animal (Graph Minors XVI, Section 5, page 55): +"The animal $(H, \eta, \mathscr{T}, X, Y)$ is hairless if $Y = \emptyset$, and in that case we shall +speak of $(H, \eta, \mathscr{T}, X)$ or $(H, \mathscr{T}, X)$." -/ +def IsHairlessAnimal (G : Graph α β) + (T_star : Set (Hypergraph α β × Hypergraph α β)) (θ_star : ℕ) + (H : Drawing S) (η : SpanEmbedding H G) (θ_span : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (X : Set α) (χ θ σ : ℕ) : Prop := + IsAnimal G T_star θ_star H η θ_span T d X ∅ χ 0 θ σ + +/-- Existence of a hairless animal in `G` with respect to `T_star` on surface `S` with `χ` horns, +of strength `≥ (θ, σ)` (Graph Minors XVI, Section 5, page 55). -/ +def HasHairlessAnimal (S : Type w) [TopologicalSpace S] [T2Space S] + (G : Graph α β) (T_star : Set (Hypergraph α β × Hypergraph α β)) (θ_star : ℕ) + (χ θ σ : ℕ) : Prop := + HasAnimal S G T_star θ_star χ 0 θ σ + +end Section5And6 + +/-! ## Section 8: $\gamma$-Envelopes around $Y \subseteq V(H)$ (pages 64–70) -/ + +section Section8 + +variable {S : Type w} [TopologicalSpace S] [T1Space S] + +/-- $\gamma$-envelope around $Y \subseteq V(H)$ (Graph Minors XVI, Section 8, page 64): +"Let $\mathcal{T}$ be a respectful tangle (see [8, section 3]) of order $\theta$ in a rigid drawing +$H$ in a surface $\Sigma$, and let $Y \subseteq V(H)$. If $\gamma \ge 0$, a *$\gamma$-envelope +around +$Y$* is a family $(\Lambda_y\colon y \in Y)$ such that: +- for each $y \in Y$, $\Lambda_y$ is a $\gamma$-zone around $y$, +- for all distinct $y, y' \in Y$, $\bar{\Lambda}_y \cap \bar{\Lambda}_{y'} = \emptyset$, +- for every subset $Y' \subseteq Y$, the drawing $H \cap (\Sigma \setminus \cup (\Lambda_y\colon y + \in Y'))$ + is rigid." -/ +def IsEnvelope (H : Drawing S) (d : Set S → Set S → ℕ) + (Y : Set S) (γ : ℕ) (Λ : S → Set S) : Prop := + Y ⊆ H.V ∧ + (∀ y ∈ Y, IsLambdaZoneAround H d γ {y} (Λ y)) ∧ + (∀ y₁ ∈ Y, ∀ y₂ ∈ Y, y₁ ≠ y₂ → Disjoint (closure (Λ y₁)) (closure (Λ y₂))) ∧ + (∀ Y' ⊆ Y, IsRigid (H.interSet (univ \ ⋃ y ∈ Y', Λ y))) + +/-- The subdrawing $H' = H \cap (\Sigma \setminus \bigcup_{y \in Y} \Lambda_y)$ obtained by clearing +a $\gamma$-envelope $(\Lambda_y : y \in Y)$ around $Y$ +(Graph Minors XVI, Section 8, page 64). -/ +def clearEnvelopeDrawing (H : Drawing S) (Y : Set S) (Λ : S → Set S) : Drawing S := + H.interSet (univ \ ⋃ y ∈ Y, Λ y) + +end Section8 + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/DiscChartExtension.lean b/LeanPool/GraphMinor/GM16/DiscChartExtension.lean new file mode 100644 index 0000000000..b07febee46 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/DiscChartExtension.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.DiscGrow +import Mathlib.Topology.TietzeExtension + +/-! +# Extending disc coordinates + +Extend the two real coordinates of a disc chart separately by Tietze's +theorem. On the disc the resulting map still has the chart inverse. +This provides a continuous map on the whole surface when transporting +the rural neighborhood of XVI (8.1), Claim (11), to the plane. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Metric GraphMinor.Surface +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] [CompactSpace S] + +/-- A continuous complex-valued map on a closed subset extends to the +whole compact Hausdorff space, by extending its real coordinates. -/ +theorem exists_complex_extension {D : Set S} (hD : IsClosed D) + {h : S → ℂ} (hc : ContinuousOn h D) : + ∃ f : S → ℂ, Continuous f ∧ EqOn f h D := by + let hr : C(D, ℝ) := ⟨fun x => (h x.val).re, + Complex.continuous_re.comp (continuousOn_iff_continuous_domRestrict.mp hc)⟩ + let hi : C(D, ℝ) := ⟨fun x => (h x.val).im, + Complex.continuous_im.comp (continuousOn_iff_continuous_domRestrict.mp hc)⟩ + obtain ⟨fr, hfr⟩ := hr.exists_restrict_eq hD + obtain ⟨fi, hfi⟩ := hi.exists_restrict_eq hD + refine ⟨fun x => ⟨fr x, fi x⟩, ?_, ?_⟩ + · have hc := (Complex.continuous_ofReal.comp fr.continuous).add + ((Complex.continuous_ofReal.comp fi.continuous).mul (continuous_const (y := Complex.I))) + apply hc.congr + intro x + exact (Complex.mk_eq_add_mul_I (fr x) (fi x)).symm + · intro x hx + apply Complex.ext + · exact congrArg (fun q : C(D, ℝ) => q ⟨x, hx⟩) hfr + · exact congrArg (fun q : C(D, ℝ) => q ⟨x, hx⟩) hfi + +/-- A closed disc has coordinates that extend continuously to the +whole surface and remain injective on the disc. -/ +theorem exists_extended_disc_chart {D : Set S} (hD : IsClosedDisc D) : + ∃ f : S → ℂ, ∃ g : ℂ → S, + Continuous f ∧ IsChart D f g ∧ InjOn f D := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + obtain ⟨f, hf, heq⟩ := exists_complex_extension hD.isClosed c.hc + have hinv : LeftInvOn g f D := by + intro x hx + rw [heq hx] + exact c.gh hx + refine ⟨f, g, hf, ⟨hf.continuousOn, c.gc, ?_, c.gm, hinv, ?_, ?_⟩, ?_⟩ + · intro x hx + rw [heq hx] + exact c.hm hx + · intro x hx + rw [heq (c.gm hx)] + exact c.hg hx + · rw [(heq.mono (discBd_subset D)).image_eq, c.bd] + · intro x hx y hy hxy + exact (hinv hx).symm.trans ((congrArg g hxy).trans (hinv hy)) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/DiscCoordinateBoundary.lean b/LeanPool/GraphMinor/GM16/DiscCoordinateBoundary.lean new file mode 100644 index 0000000000..4bee879763 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/DiscCoordinateBoundary.lean @@ -0,0 +1,68 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# Boundary points at extreme coordinates + +When a disc is contained below a horizontal line in the coordinate +plane, its points on that line are boundary points. Pull an interior +neighborhood back to the plane and project it to the vertical axis. +Its image is open, so it cannot have a greatest coordinate. The same +argument at a minimum gives the bottom side. These facts identify +the common boundary sides when the wall's rows are joined. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- A point of a disc with the largest allowed vertical coordinate +belongs to its intrinsic boundary. -/ +theorem mem_discBd_of_vertical_max {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {D : Set S} (hD : IsClosedDisc D) + {f : (ℝ × ℝ) → S} (hf : Continuous f) {p : ℝ × ℝ} {c : ℝ} + (hBound : ∀ q, f q ∈ D → q.2 ≤ c) (hp : f p ∈ D) (hpc : p.2 = c) : + f p ∈ discBd D := by + rw [← GM11.IsClosedDisc.frontier_eq_discBd hS hD] + refine ⟨subset_closure hp,?_⟩ + intro hpInt + have hpPre : p ∈ interior (f ⁻¹' D) := + preimage_interior_subset_interior_preimage hf hpInt + have hImage : Prod.snd '' (f ⁻¹' D) ⊆ Iic c := by + rintro y ⟨q,hq,rfl⟩ + exact hBound q hq + have hlt : p.2 ∈ interior (Iic c) := interior_mono hImage + (isOpenMap_snd.image_interior_subset _ ⟨p,hpPre,rfl⟩) + rw [interior_Iic] at hlt + exact (lt_irrefl c) (hpc ▸ hlt) + +/-- The corresponding assertion for the smallest vertical coordinate. -/ +theorem mem_discBd_of_vertical_min {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {D : Set S} (hD : IsClosedDisc D) + {f : (ℝ × ℝ) → S} (hf : Continuous f) {p : ℝ × ℝ} {c : ℝ} + (hBound : ∀ q, f q ∈ D → c ≤ q.2) (hp : f p ∈ D) (hpc : p.2 = c) : + f p ∈ discBd D := by + rw [← GM11.IsClosedDisc.frontier_eq_discBd hS hD] + refine ⟨subset_closure hp,?_⟩ + intro hpInt + have hpPre : p ∈ interior (f ⁻¹' D) := + preimage_interior_subset_interior_preimage hf hpInt + have hImage : Prod.snd '' (f ⁻¹' D) ⊆ Ici c := by + rintro y ⟨q,hq,rfl⟩ + exact hBound q hq + have hlt : p.2 ∈ interior (Ici c) := interior_mono hImage + (isOpenMap_snd.image_interior_subset _ ⟨p,hpPre,rfl⟩) + rw [interior_Ici] at hlt + exact (lt_irrefl c) (hpc ▸ hlt) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/DiscPlaneBoundary.lean b/LeanPool/GraphMinor/GM16/DiscPlaneBoundary.lean new file mode 100644 index 0000000000..e609f39a89 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/DiscPlaneBoundary.lean @@ -0,0 +1,28 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! +# Boundaries of plane discs + +The closed domain of a Jordan curve is the complement of its outer +side. Its frontier is therefore that curve. This identifies the +intrinsic disc boundary with the frontier in the plane presentations +used in XVI (8.1), Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface + +export Surface (complex_disc_frontier plane_disc_frontier) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/DiscPlaneCoordinates.lean b/LeanPool/GraphMinor/GM16/DiscPlaneCoordinates.lean new file mode 100644 index 0000000000..03087ea718 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/DiscPlaneCoordinates.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM16.DiscChartExtension +import LeanPool.GraphMinor.GM16.DiscPlaneBoundary +import LeanPool.GraphMinor.GM11.Section7 + +/-! +# Plane coordinates on a surface disc + +Compose the extended complex chart with the standard identification +of the complex plane and the Euclidean plane. The chart inverse +preserves every closed disc inside the chart, including its boundary. +These are the discs of the rural presentation in XVI (8.1), Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] [CompactSpace S] + +/-- A disc chart gives a continuous map to the Euclidean plane, +with a continuous inverse on the disc image. Every smaller closed disc +retains its boundary under this map. -/ +theorem exists_plane_disc_coordinates {D : Set S} (hD : IsClosedDisc D) : + ∃ (f : S → EuclideanPlane) (g : EuclideanPlane → S), + Continuous f ∧ InjOn f D ∧ ContinuousOn g (f '' D) ∧ LeftInvOn g f D ∧ + ∀ E ⊆ D, IsClosedDisc E → + IsClosedDisc (f '' E) ∧ subBd (f '' E) = f '' discBd E := by + obtain ⟨h, k, hh, c, hi⟩ := exists_extended_disc_chart hD + let e : ℂ ≃ₜ EuclideanPlane := complexPlane.toHomeomorph + let f : S → EuclideanPlane := e ∘ h + let g : EuclideanPlane → S := k ∘ e.symm + have hf : Continuous f := e.continuous.comp hh + have hinj : InjOn f D := fun x hx y hy heq => hi hx hy (e.injective heq) + have hg : ContinuousOn g (f '' D) := by + apply c.gc.comp e.symm.continuous.continuousOn + rintro _ ⟨x, hx, rfl⟩ + simpa only [f, Function.comp_apply, Homeomorph.symm_apply_apply] using c.hm hx + have hgf : LeftInvOn g f D := by + intro x hx + simpa only [f, g, Function.comp_apply, Homeomorph.symm_apply_apply] using c.gh hx + refine ⟨f, g, hf, hinj, hg, hgf, ?_⟩ + intro E hED hE + obtain ⟨hFE, hb⟩ := hE.image hf.continuousOn (hg.mono (image_mono hED)) + (fun _ hx => hgf (hED hx)) + exact ⟨hFE, by rw [GraphMinor.GM11.subBd_eq_frontier, plane_disc_frontier hFE, hb]⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/DrawingAtoms.lean b/LeanPool/GraphMinor/GM16/DrawingAtoms.lean new file mode 100644 index 0000000000..973dcaf78e --- /dev/null +++ b/LeanPool/GraphMinor/GM16/DrawingAtoms.lean @@ -0,0 +1,199 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM15.Cited +import LeanPool.GraphMinor.GM16.MetricPoints +import LeanPool.GraphMinor.GM16.DrawingConnected +import LeanPool.GraphMinor.Surface.Skeleton +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.Section5b +import LeanPool.GraphMinor.GM11.NiceStatements + +import LeanPool.GraphMinor.GM11.CitedResults + +/-! +# Atoms near an edge end + +The path arguments for XVI (8.3) use an original atom that meets a new edge +and has the edge end in its closure. A region cannot become an edge: a region +is open in the surface, whereas a line or circle contains no embedded open +ball. This makes the atom-preservation condition of a rearrangement useful +for incident edges as well as for points. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- Near a point in the closure of a set, some drawing atom meets the set +and has that point in its closure. Finiteness of the atoms is essential. -/ +theorem exists_atom_meeting_of_mem_closure (hS : IsClosedSurface S) [ConnectedSpace S] + (H : Drawing S) {F : Set S} {x : S} (hx : x ∈ closure F) : + ∃ a ∈ H.A, x ∈ closure a ∧ (a ∩ F).Nonempty := by + have hfin : H.A.Finite := ((H.finite_V.image _).union H.finite_edges).union + (finite_R hS H) + have hcover : F ⊆ ⋃ a ∈ H.A, a ∩ F := by + intro y hy + obtain ⟨a, ha, hya⟩ := exists_atom H y + exact mem_iUnion₂.mpr ⟨a, ha, hya, hy⟩ + have hx' := closure_mono hcover hx + rw [hfin.closure_biUnion] at hx' + obtain ⟨a, ha, hxa⟩ := mem_iUnion₂.mp hx' + exact ⟨a, ha, closure_mono inter_subset_left hxa, Set.Nonempty.of_closure ⟨x, hxa⟩⟩ + +/-- No nonempty open subset of a closed surface is contained in the closure +of an edge of a drawing. -/ +theorem not_open_subset_edge_closure (hS : IsClosedSurface S) {H : Drawing S} + {e O : Set S} (he : e ∈ H.E) (hO : IsOpen O) (hne : O.Nonempty) : ¬ O ⊆ closure e := by + intro hsub + obtain ⟨x, hx⟩ := hne + obtain ⟨U, j, g, c, hU, _⟩ := (hS.2.2 x).exists_ballChart hO hx (R := 1) (by norm_num) + have himg : g '' ball (0 : ℂ) 1 ⊆ closure e := by + rintro _ ⟨z, hz, rfl⟩ + exact hsub (hU (c.gm hz)) + rcases H.edge_cond e he with ⟨a, b, _, _, f, _, _⟩ | ⟨a, _, hcircle⟩ + · let γ : unitInterval → S := fun t => (f t).val + have hγ : IsArcMap γ := ⟨continuous_subtype_val.comp f.continuous, + Subtype.val_injective.comp f.injective⟩ + have hrange : range γ = closure e := by + ext y + constructor + · rintro ⟨t, rfl⟩ + exact (f t).property + · intro hy + obtain ⟨t, ht⟩ := f.surjective ⟨y, hy⟩ + exact ⟨t, congrArg Subtype.val ht⟩ + exact not_image_ball_subset_arc hγ (by norm_num) c.gc c.hg.injOn (hrange ▸ himg) + · exact not_image_ball_subset_oArc hcircle (by norm_num) c.gc c.hg.injOn himg + +/-- An original region cannot equal an edge of another drawing in the same +closed surface. -/ +theorem region_ne_edge (hS : IsClosedSurface S) {H H' : Drawing S} {a e : Set S} + (ha : a ∈ H.R) (he : e ∈ H'.E) : a ≠ e := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + intro heq + exact not_open_subset_edge_closure hS he (region_isOpen ha) (region_nonempty ha) + (heq ▸ subset_closure) + +omit [T2Space S] in +/-- A singleton is not open in a closed surface. -/ +theorem not_isOpen_singleton (hS : IsClosedSurface S) (x : S) : + ¬ IsOpen ({x} : Set S) := by + intro hopen + obtain ⟨U, j, g, c, hU, _⟩ := (hS.2.2 x).exists_ballChart hopen + (mem_singleton x) (R := 1) (by norm_num) + have hzero : (0 : ℂ) ∈ ball 0 1 := by simp + have hhalf : (1 / 2 : ℂ) ∈ ball 0 1 := by norm_num [mem_ball, dist_eq_norm] + have h0 : g 0 = x := mem_singleton_iff.mp (hU (c.gm hzero)) + have h1 : g (1 / 2) = x := mem_singleton_iff.mp (hU (c.gm hhalf)) + have heq := c.hg.injOn hzero hhalf (h0.trans h1.symm) + norm_num at heq + +/-- If a singleton is an atom of a drawing in a closed surface, its point +is a vertex. Edges have vertex ends, and regions are open. -/ +theorem vertex_of_singleton_mem_atoms (hS : IsClosedSurface S) {H : Drawing S} + {x : S} (hx : ({x} : Set S) ∈ H.A) : x ∈ H.V := by + rcases hx with (⟨y, hy, heq⟩ | he) | hr + · have hxy : y = x := by simpa using Set.ext_iff.mp heq y + exact hxy ▸ hy + · obtain ⟨a, b, hab⟩ := H.toGraph.exists_isLink_of_mem_edgeSet he + have ha : a ∈ closure ({x} : Set S) := (hab.2.2.2 ▸ mem_insert a {b}).1 + rw [closure_singleton, mem_singleton_iff] at ha + exact ha ▸ hab.2.1 + · let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + exact (not_isOpen_singleton hS x (region_isOpen hr)).elim + +/-- If an atom far from the rearrangement centre equals a new edge, it was +already an edge. This is used in the proof of XVI (8.3), Claims (5) and (12). -/ +theorem rearranged_edge_of_atom (hS : IsClosedSurface S) + {α : Type u} {β : Type v} {G : Graph α β} {H H' : Drawing S} + {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} {θ_star θ lam : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z a : Set S} + (h : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) + (ha : a ∈ H.A) (hfar : lam < d z a) (ha' : a ∈ H'.E) : a ∈ H.E := by + rcases ha with (⟨x, hx, rfl⟩ | ha) | ha + · have hx' := (h.vMap_eq x hx hfar).1 + have hxedge : x ∈ ({x} : Set S) := mem_singleton x + exact ((ha'.2.1 hxedge).2 hx').elim + · exact ha + · exact (region_ne_edge hS ha ha' rfl).elim + +/-- The corrected XI proximity bounds give distance at most two from a vertex + to any atom whose closure contains it. Small tangle orders use the order bound. -/ +theorem vertex_atom_dist_le_two + (hS : IsClosedSurface S) {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric H θ T d) : + ∀ x ∈ H.V, ∀ a ∈ H.A, x ∈ closure a → d {x} a ≤ 2 := by + obtain ⟨_, hs, hb, _, _, hr, he⟩ := GraphMinor.GM11.gm15_theorem_9_1.{w} H θ T d hS hm.1.1.1 hm + intro x hx a ha hxa + have hxA : ({x} : Set S) ∈ H.A := Or.inl (Or.inl ⟨x, hx, rfl⟩) + by_cases hθ : θ ≤ 2 + · exact (hb _ hxA _ ha).trans hθ + rcases ha with (⟨y, hy, rfl⟩ | ha) | ha + · have hxy : x = y := by simpa only [closure_singleton, mem_singleton_iff] using hxa + subst y + exact (hs _ hxA).le.trans (Nat.zero_le _) + · exact he x hx a ha hxa + · exact (hr (edges_nonempty_of_tangle hS hm.1 (by omega)) x hx a ha hxa).trans (by omega) + +/-- Far from the rearrangement centre, a new edge incident with an original +vertex is an unchanged original edge. This is the last-edge argument in +Graph Minors XVI, proof of (8.3), Claims (5) and (12), pages 66 and 68. -/ +theorem rearranged_incident_edge_eq (hS : IsClosedSurface S) + {α : Type u} {β : Type v} {G : Graph α β} {H H' : Drawing S} + {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} {θ_star θ lam : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z : Set S} + (h : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) + (hsymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, + d a c ≤ d a b + d b c) + (hprox : ∀ x ∈ H.V, ∀ a ∈ H.A, x ∈ closure a → d {x} a ≤ 2) + {x : S} {f : Set S} (hx : x ∈ H.V) (hf : f ∈ H'.E) + (hxf : x ∈ closure f) (hfar : lam + 3 ≤ d z {x}) : + f ∈ H.E ∧ η'.eMap f = η.eMap f := by + let : ConnectedSpace S := h.isSpan.isConnected + obtain ⟨a, ha, hxa, w, hwa, hwf⟩ := exists_atom_meeting_of_mem_closure hS H hxf + have hxA : ({x} : Set S) ∈ H.A := Or.inl (Or.inl ⟨x, hx, rfl⟩) + have hclose := hprox x hx a ha hxa + have hbound := htri z h.z_mem a ha {x} hxA + rw [hsymm a ha {x} hxA] at hbound + have hfar_a : lam < d z a := by omega + have ha' := h.atom_mem a ha hfar_a + have heq : a = f := atom_eq_of_mem ha' (Or.inl (Or.inr hf)) hwa hwf + subst a + have hfH := rearranged_edge_of_atom hS h ha hfar_a hf + exact ⟨hfH, (h.eMap_eq f hfH hfar_a).2⟩ + +/-- A new vertex lying in a preserved original atom is an original vertex, +and its two embeddings agree. -/ +theorem old_vertex_of_far_atom (hS : IsClosedSurface S) + {α : Type u} {β : Type v} {G : Graph α β} {H H' : Drawing S} + {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} {θ_star θ lam : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z a : Set S} {x : S} + (h : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) + (ha : a ∈ H.A) (hx : x ∈ a) (hx' : x ∈ H'.V) (hfar : lam < d z a) : + a = {x} ∧ x ∈ H.V ∧ η'.vMap x = η.vMap x := by + have heq := atom_eq_of_mem (h.atom_mem a ha hfar) + (Or.inl (Or.inl ⟨x, hx', rfl⟩)) hx (mem_singleton x) + have hxold := vertex_of_singleton_mem_atoms hS (heq ▸ ha) + have hfar' : lam < d z {x} := by simpa only [heq] using hfar + exact ⟨heq, hxold, (h.vMap_eq x hxold hfar').2⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/DrawingBoundaryOrders.lean b/LeanPool/GraphMinor/GM16/DrawingBoundaryOrders.lean new file mode 100644 index 0000000000..10aec23acc --- /dev/null +++ b/LeanPool/GraphMinor/GM16/DrawingBoundaryOrders.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM16.BoundaryNaturalOrder +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Boundary orders after transport + +A drawing transported by an injective map draws each vertex at its +image. Transporting a circle parametrization therefore also transports +the cyclic order of its boundary vertices. These facts identify the +boundary orders in the rural presentation of XVI (8.1), Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 +universe u v +variable {S : Type u} {T : Type v} [TopologicalSpace S] [TopologicalSpace T] + +/-- In a transported drawing each vertex is represented by its image. -/ +theorem graphDrawingVertexSet_transport {D : Drawing S} + (Γ : GraphDrawing D.toGraph T) {f : S → T} + (hv : ∀ x : D.toGraph.vertexSet, (Γ.iso.vertexEquiv x).val = f x.val) + {x : S} (hx : x ∈ D.V) : graphDrawingVertexSet Γ x = {f x} := by + ext z + change (∃ h : x ∈ D.V, (Γ.iso.vertexEquiv ⟨x, h⟩).val = z) ↔ z = f x + constructor + · rintro ⟨h, heq⟩ + exact heq.symm.trans (hv ⟨x, h⟩) + · intro heq + exact ⟨hx, (hv ⟨x, hx⟩).trans heq.symm⟩ + +/-- Order a nonempty finite boundary set, and carry that order through +the transported parametrization of its circle. -/ +theorem exists_drawing_boundary_order {D : Drawing S} + (Γ : GraphDrawing D.toGraph T) {f : S → T} + (hv : ∀ x : D.toGraph.vertexSet, (Γ.iso.vertexEquiv x).val = f x.val) + {F : Set S} {F' : Set T} (φ : Circle ≃ₜ F) (φ' : Circle ≃ₜ F') + (hφ : ∀ z, (φ' z).val = f (φ z).val) + (hne : (D.V ∩ F).Nonempty) : + ∃ Ω : CyclicPerm S, Ω.bar = D.V ∩ F ∧ + DrawingAgreesWithOArcHomeo Γ Ω F' φ' := by + obtain ⟨Ω, hbar, ha⟩ := exists_cyclicPerm_agrees φ + (D.finite_V.inter_of_left F) hne inter_subset_right + refine ⟨Ω, hbar, ?_, ?_⟩ + · intro x hx + have hx' : x ∈ D.V ∩ F := hbar ▸ hx + rw [graphDrawingVertexSet_transport Γ hv hx'.1] + intro z hz + have hφx := hφ (φ.symm ⟨x, hx'.2⟩) + have heq : f x ∈ F' := by + rw [← show (φ (φ.symm ⟨x, hx'.2⟩)).val = x from + congrArg Subtype.val (φ.apply_symm_apply ⟨x, hx'.2⟩), ← hφx] + exact (φ' _).prop + exact (mem_singleton_iff.mp hz) ▸ heq + · intro x y z hxyz + obtain ⟨a, b, c, hab, hbc, hca, hax, hby, hcz⟩ := ha.2 x y z hxyz + have hx : x ∈ D.V := (hbar ▸ hxyz.2.1 x (by simp)).1 + have hy : y ∈ D.V := (hbar ▸ hxyz.2.1 y (by simp)).1 + have hz : z ∈ D.V := (hbar ▸ hxyz.2.1 z (by simp)).1 + refine ⟨a, b, c, hab, hbc, hca, ?_, ?_, ?_⟩ + · rw [graphDrawingVertexSet_transport Γ hv hx] + exact (hφ _).trans (congrArg f hax) + · rw [graphDrawingVertexSet_transport Γ hv hy] + exact (hφ _).trans (congrArg f hby) + · rw [graphDrawingVertexSet_transport Γ hv hz] + exact (hφ _).trans (congrArg f hcz) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/DrawingConnected.lean b/LeanPool/GraphMinor/GM16/DrawingConnected.lean new file mode 100644 index 0000000000..9f99766b1e --- /dev/null +++ b/LeanPool/GraphMinor/GM16/DrawingConnected.lean @@ -0,0 +1,52 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.DrawingPointConnectivity +import LeanPool.GraphMinor.GM12.Section4PathExists +import LeanPool.GraphMinor.GM11.PaintingRegions +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Paths in a two-cell drawing + +The point set of a two-cell drawing in a connected closed surface does not +split into two disjoint nonempty closed sets. Partitioning it according to +which vertices can be reached by graph walks therefore shows that any two +vertices are joined by a walk. This supplies the paths chosen in XVI (8.3). +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- Two vertices of a two-cell drawing in a connected closed surface are joined +by a graph walk, as used in Graph Minors XVI, proof of (8.3), Claims (5) and (12). -/ +theorem drawing_walk_of_twoCell (hS : IsClosedSurface S) {D : Drawing S} + (hD : (PaintingOrDrawing.drawing D).IsTwoCell) + {a b : S} (ha : a ∈ D.V) (hb : b ∈ D.V) : Nonempty (GraphWalk D.toGraph a b) := by + let : ConnectedSpace S := hD.1 + exact GM12.exists_walk_of_open_disc_regions hS hD.2 ha hb + +/-- A two-cell drawing with a tangle of order at least two has an edge. -/ +theorem edges_nonempty_of_tangle (hS : IsClosedSurface S) {H : Drawing S} + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : GraphMinor.GM14.IsRespectfulDrawingTangle H θ T) (hθ : 2 ≤ θ) : H.E.Nonempty := by + have hc : 2 ≤ H.V.ncard := hθ.trans hT.2.1.order_le_ncard_vertexSet + obtain ⟨x, hx, y, hy, hxy⟩ := (Set.one_lt_ncard H.finite_V).mp (by omega : 1 < H.V.ncard) + obtain ⟨W⟩ := drawing_walk_of_twoCell hS hT.1 hx hy + cases W with + | nil _ => exact (hxy rfl).elim + | cons hl _ => exact ⟨_, hl.1⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/DrawingFamilyCompatibility.lean b/LeanPool/GraphMinor/GM16/DrawingFamilyCompatibility.lean new file mode 100644 index 0000000000..58ad6fec84 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/DrawingFamilyCompatibility.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.Rotation + +/-! +# Compatibility of path drawing maps + +Shared source vertices are centres, whose maps agree by the fixed +centre coordinates. Shared target vertices are also centre points. +The inverse map sends each such point to its source centre, so +the inverse maps agree as well. Drawing edges in different pieces +are disjoint because their supports meet only at common vertices. +These facts verify the gluing conditions for XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology Surface GM11 +universe u v w t z + +/-- Centre compatibility gives compatibility of both the forward +and inverse vertex maps of a family of path drawings. -/ +theorem drawing_family_vertex_maps_compatible + {α : Type u} {β : Type v} {ν : Type w} {S : Type t} {ι : Type z} + [TopologicalSpace S] (P : ι → Graph α β) (D : ∀ i, GraphDrawing (P i) S) + (c : ν → α) (p : ν → S) + (hSource : ∀ i j, i ≠ j → V(P i) ∩ V(P j) ⊆ range c) + (hTarget : ∀ i j, i ≠ j → (D i).drawing.U ∩ (D j).drawing.U ⊆ range p) + (hPointSource : ∀ i v, p v ∈ (D i).drawing.U → c v ∈ V(P i)) + (hCentre : ∀ i v (x : V(P i)), x.val = c v → ((D i).iso.vertexEquiv x).val = p v) : + (∀ i j x (hi : x ∈ V(P i)) (hj : x ∈ V(P j)), + ((D i).iso.vertexEquiv ⟨x,hi⟩).val = ((D j).iso.vertexEquiv ⟨x,hj⟩).val) ∧ + (∀ i j y (hi : y ∈ (D i).drawing.V) (hj : y ∈ (D j).drawing.V), + ((D i).iso.vertexEquiv.symm ⟨y,hi⟩).val = ((D j).iso.vertexEquiv.symm ⟨y,hj⟩).val) := by + have hInv (i : ι) (v : ν) (hy : p v ∈ (D i).drawing.V) : + ((D i).iso.vertexEquiv.symm ⟨p v,hy⟩).val = c v := by + have hv := hPointSource i v ((D i).drawing.V_subset_U hy) + have he : (D i).iso.vertexEquiv ⟨c v,hv⟩ = ⟨p v,hy⟩ := + Subtype.ext (hCentre i v ⟨c v,hv⟩ rfl) + have h := congrArg (D i).iso.vertexEquiv.symm he + rw [Equiv.symm_apply_apply] at h + exact (congrArg Subtype.val h).symm + constructor + · intro i j x hi hj + by_cases hij : i=j + · subst j + rfl + obtain ⟨v,hv⟩ := hSource i j hij ⟨hi,hj⟩ + exact (hCentre i v ⟨x,hi⟩ hv.symm).trans (hCentre j v ⟨x,hj⟩ hv.symm).symm + · intro i j y hi hj + by_cases hij : i=j + · subst j + rfl + obtain ⟨v,rfl⟩ := hTarget i j hij ⟨(D i).drawing.V_subset_U hi,(D j).drawing.V_subset_U hj⟩ + exact (hInv i v hi).trans (hInv j v hj).symm + +/-- Distinct drawings in a family meeting only at prescribed common +vertices have disjoint edge sets. -/ +theorem drawing_family_edges_disjoint {S : Type u} [TopologicalSpace S] + {ι : Type v} (D : ι → Drawing S) (Z : Set S) + (hZ : ∀ i, (D i).U ∩ Z ⊆ (D i).V) + (hMeet : ∀ i j, i ≠ j → (D i).U ∩ (D j).U ⊆ Z) + {i j : ι} (hij : i ≠ j) : Disjoint (D i).E (D j).E := by + apply disjoint_left.mpr + intro e he hf + obtain ⟨x,hx⟩ := he.1 + have hxi := he.2.1 hx + have hxj := hf.2.1 hx + exact hxi.2 (hZ i ⟨hxi.1,hMeet i j hij ⟨hxi.1,hxj.1⟩⟩) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/DrawingGraphPaths.lean b/LeanPool/GraphMinor/GM16/DrawingGraphPaths.lean new file mode 100644 index 0000000000..137c6eb962 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/DrawingGraphPaths.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# Passing between graph paths and drawing paths + +A path subgraph of the graph of a drawing traces a path subdrawing, +with the same graph. This lets us trim battlefield paths as graph +paths and then use their point sets in XVI (8.1), Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 +universe u +variable {S : Type u} [TopologicalSpace S] + +/-- Reversing a drawing path exchanges its two ends. -/ +theorem drawingPath_symm {J : Drawing S} {a b : S} (hP : J.IsPathBetween a b) : + J.IsPathBetween b a := by + obtain ⟨W, hW, hV, hE⟩ := hP + refine ⟨W.reverse, hW.reverse, ?_, ?_⟩ + · simpa only [GraphWalk.support_reverse, List.mem_reverse] using hV + · simpa only [GraphWalk.edges_reverse, List.mem_reverse] using hE + +/-- A subdrawing gives a subgraph with the same vertices and edges. -/ +theorem toGraph_le_of_isSubdrawing {H J : Drawing S} (hJ : J.IsSubdrawing H) : + J.toGraph ≤ H.toGraph := + hJ.toGraph_le + +/-- A drawing path is a graph path in every drawing containing it. -/ +theorem graphPath_of_drawingPath {H J : Drawing S} {a b : S} + (hJ : J.IsSubdrawing H) (hP : J.IsPathBetween a b) : + IsGraphPathWithEnds H.toGraph J.toGraph a b := + ⟨toGraph_le_of_isSubdrawing hJ, hP⟩ + +/-- A graph path in a drawing traces a path subdrawing with exactly +that graph. -/ +theorem exists_drawing_of_graphPath [T1Space S] {H : Drawing S} + {P : Graph S (Set S)} {a b : S} (hP : IsGraphPathWithEnds H.toGraph P a b) : + ∃ J : Drawing S, J.IsPathBetween a b ∧ J.IsSubdrawing H ∧ J.toGraph = P := by + obtain ⟨hPH, W, hW, hV, hE⟩ := hP + obtain ⟨W', hs, he⟩ := W.exists_transfer + (fun _ _ _ _ hl => hPH.isLink_mono hl) + (fun _ hx => hPH.vertexSet_mono (W.mem_vertexSet_of_mem_support hx)) + have hSimple : W'.IsSimple := by + change W'.support.Nodup + rw [hs] + exact hW + let J := walkDrawing H W' + have hJH : J.IsSubdrawing H := walkDrawing_isSubdrawing H W' + refine ⟨J, walkDrawing_isPathBetween H hSimple, hJH, ?_⟩ + apply Compatible.ext _ _ (Compatible.of_le_le (toGraph_le_of_isSubdrawing hJH) hPH) + · change J.V = V(P) + rw [show J.V = {x | x ∈ W'.support} from walkDrawing_V H W', hs, hV] + · change J.E = E(P) + rw [show J.E = {e | e ∈ W'.edges} from walkDrawing_E H W', he, hE] + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/DrawingPointConnectivity.lean b/LeanPool/GraphMinor/GM16/DrawingPointConnectivity.lean new file mode 100644 index 0000000000..d84345d57d --- /dev/null +++ b/LeanPool/GraphMinor/GM16/DrawingPointConnectivity.lean @@ -0,0 +1,25 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.DrawingConnectivity + +/-! +# Walk connectivity of drawings + +The graph-walk connectivity fact used in Graph Minors XVI. +-/ + +public section + +namespace GraphMinor.GM16 + +export GM11 (drawing_walk_of_isPreconnected_U) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/DrawingSkeletonPaths.lean b/LeanPool/GraphMinor/GM16/DrawingSkeletonPaths.lean new file mode 100644 index 0000000000..bf21e4294a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/DrawingSkeletonPaths.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.Section3 +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# Paths of a drawing and its hypergraph skeleton + +Menger's theorem is stated for the skeleton of a hypergraph. A drawing +has the same finite hypergraph whether it is first viewed as a graph +or directly as a hypergraph. A skeleton path therefore traces a path +subdrawing with exactly the same vertices. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM11 +universe w +variable {S : Type w} [TopologicalSpace S] + +/-- The graph and hypergraph associated to a drawing have the same +incidence relation. -/ +theorem drawing_ofGraph_toGraph (H : Drawing S) : + Hypergraph.ofGraph H.toGraph H.finite_V H.finite_edges = H.toHypergraph := by + refine Hypergraph.ext (x := Hypergraph.ofGraph H.toGraph H.finite_V H.finite_edges) + (y := H.toHypergraph) rfl rfl ?_ + funext e x + apply propext + change (∃ y, e ∈ H.E ∧ x ∈ H.V ∧ y ∈ H.V ∧ closure e ∩ H.V = {x, y}) ↔ + e ∈ H.E ∧ x ∈ H.V ∧ x ∈ closure e + constructor + · rintro ⟨y, he, hx, _, hcap⟩ + exact ⟨he, hx, (hcap.symm ▸ (show x ∈ ({x, y} : Set S) from Or.inl rfl)).1⟩ + · rintro ⟨he, hx, hxc⟩ + obtain ⟨u, v, hl⟩ := H.toGraph.exists_isLink_of_mem_edgeSet he + have hxEnds : x ∈ ({u, v} : Set S) := hl.2.2.2 ▸ ⟨hxc, hx⟩ + rcases hxEnds with rfl | hxv + · exact ⟨v, hl⟩ + · rw [mem_singleton_iff] at hxv + subst x + exact ⟨u, hl.symm⟩ + +/-- A skeleton path of a drawing lifts to a path subdrawing with +exactly the same vertices. This is used for Menger in XVI (8.1). -/ +theorem drawing_path_of_skeleton_path [T1Space S] {H : Drawing S} {a b : S} + (ha : a ∈ H.V) (w : H.toHypergraph.skeleton.Walk a b) (hw : w.IsPath) : + ∃ P : Drawing S, P.IsPathBetween a b ∧ P.IsSubdrawing H ∧ P.V = {x | x ∈ w.support} := by + have hEq := drawing_ofGraph_toGraph H + have hLift : ∀ (J : Hypergraph S (Set S)), + J = Hypergraph.ofGraph H.toGraph H.finite_V H.finite_edges → + ∀ w : J.skeleton.Walk a b, ∃ W : GraphWalk H.toGraph a b, W.support = w.support := by + intro J hJ w + subst J + exact exists_graphWalk_of_skeleton_walk H.finite_V H.finite_edges ha w + obtain ⟨W, hSupport⟩ := hLift H.toHypergraph hEq.symm w + have hSupport' : W.support = w.support := hSupport + have hSimple : W.IsSimple := by + change W.support.Nodup + rw [hSupport'] + exact hw.support_nodup + refine ⟨walkDrawing H W, walkDrawing_isPathBetween H hSimple, walkDrawing_isSubdrawing H W, ?_⟩ + rw [walkDrawing_V, hSupport'] + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/DrawingTransportIso.lean b/LeanPool/GraphMinor/GM16/DrawingTransportIso.lean new file mode 100644 index 0000000000..2f10057f66 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/DrawingTransportIso.lean @@ -0,0 +1,83 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.DrawingOps +import Mathlib.Logic.Equiv.Set + +/-! +# Transporting a drawing as a graph drawing + +An injective continuous map on the point set of a drawing preserves +vertices, edges, and their ends. This lets us use a disc chart to view +the annulus in XVI (8.1), Claim (11), as a drawing in the plane. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 +universe u v +variable {S : Type u} {T : Type v} +variable [TopologicalSpace S] [T2Space S] [CompactSpace S] [Nonempty S] +variable [TopologicalSpace T] [T2Space T] + +omit [T2Space S] in +/-- Transport preserves the abstract graph as well as its point set. -/ +theorem exists_graphDrawing_transport (D : Drawing S) {f : S → T} + (hf : Continuous f) (hi : InjOn f D.U) : + ∃ Γ : GraphDrawing D.toGraph T, + Γ.drawing.U = f '' D.U ∧ Γ.drawing.V = f '' D.V ∧ + (∀ x : D.toGraph.vertexSet, (Γ.iso.vertexEquiv x).val = f x.val) ∧ + (∀ e : D.toGraph.edgeSet, (Γ.iso.edgeEquiv e).val = f '' e.val) := by + classical + obtain ⟨D', hU, hV, hE, hcl⟩ := exists_transport D hf hi + have hiE : InjOn (image f) D.E := by + intro e he e' he' heq + have heU : e ⊆ D.U := subset_trans subset_closure (D.closure_subset_U he) + have he'U : e' ⊆ D.U := subset_trans subset_closure (D.closure_subset_U he') + apply subset_antisymm + · intro x hx + obtain ⟨y, hy, hxy⟩ := heq ▸ (mem_image_of_mem f hx) + exact hi (he'U hy) (heU hx) hxy ▸ hy + · intro x hx + obtain ⟨y, hy, hxy⟩ := heq.symm ▸ (mem_image_of_mem f hx) + exact hi (heU hy) (he'U hx) hxy ▸ hy + let ev : D.V ≃ D'.V := + (Equiv.Set.imageOfInjOn f D.V (hi.mono D.V_subset_U)).trans + (Set.equivOfEq hV.symm) + let ee : D.E ≃ D'.E := + (Equiv.Set.imageOfInjOn (image f) D.E hiE).trans (Set.equivOfEq hE.symm) + have hv (x : D.V) : (ev x).val = f x.val := rfl + have he (e : D.E) : (ee e).val = f '' e.val := rfl + have hlink (e : D.toGraph.edgeSet) (x y : D.toGraph.vertexSet) : + D.toGraph.IsLink e x y ↔ D'.toGraph.IsLink (ee e) (ev x) (ev y) := by + change (e.val ∈ D.E ∧ x.val ∈ D.V ∧ y.val ∈ D.V ∧ + closure e.val ∩ D.V = {x.val, y.val}) ↔ + ((f '' e.val) ∈ D'.E ∧ f x.val ∈ D'.V ∧ f y.val ∈ D'.V ∧ + closure (f '' e.val) ∩ D'.V = {f x.val, f y.val}) + have heD : e.val ∈ D.E := e.prop + have hxD : x.val ∈ D.V := x.prop + have hyD : y.val ∈ D.V := y.prop + have heD' : f '' e.val ∈ D'.E := (ee e).prop + have hxD' : f x.val ∈ D'.V := (ev x).prop + have hyD' : f y.val ∈ D'.V := (ev y).prop + simp only [heD, hxD, hyD, heD', hxD', hyD', true_and] + rw [hV, hcl e.val heD] + rw [← hi.image_inter (D.closure_subset_U e.prop) D.V_subset_U, + ← image_pair f x.val y.val] + exact (hi.image_eq_image_iff (s₁ := closure e.val ∩ D.V) + (s₂ := {x.val, y.val}) + (inter_subset_right.trans D.V_subset_U) + (by intro z hz; rcases hz with hz | hz + · exact hz ▸ D.V_subset_U x.prop + · exact hz ▸ D.V_subset_U y.prop)).symm + exact ⟨⟨D', ⟨ev, ee, hlink⟩⟩, hU, hV, hv, he⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/DrawingTransportPoints.lean b/LeanPool/GraphMinor/GM16/DrawingTransportPoints.lean new file mode 100644 index 0000000000..c5c23c107c --- /dev/null +++ b/LeanPool/GraphMinor/GM16/DrawingTransportPoints.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM16.DrawingBoundaryOrders +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Point sets of transported subdrawings + +The point set of a subgraph in a transported drawing is the image of +its original point set. In particular the nested circuits supplied by +XIV (5.5) give the same nested boundary curves in the plane presentation +used in XVI (8.1), Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 +universe u v +variable {S : Type u} {T : Type v} [TopologicalSpace S] [TopologicalSpace T] + +/-- The arc representing an edge is its image under transport. -/ +theorem graphDrawingEdgeSet_transport {D : Drawing S} + (Γ : GraphDrawing D.toGraph T) {f : S → T} + (he : ∀ e : D.toGraph.edgeSet, (Γ.iso.edgeEquiv e).val = f '' e.val) + {e : Set S} (heD : e ∈ D.E) : graphDrawingEdgeSet Γ e = f '' e := by + ext z + simp only [graphDrawingEdgeSet, mem_iUnion] + constructor + · rintro ⟨h, hz⟩ + exact he ⟨e, h⟩ ▸ hz + · intro hz + exact ⟨heD, (he ⟨e, heD⟩).symm ▸ hz⟩ + +/-- Transport preserves the full point set of every subdrawing. -/ +theorem graphDrawingSubgraphU_transport {D J : Drawing S} + (Γ : GraphDrawing D.toGraph T) {f : S → T} + (hv : ∀ x : D.toGraph.vertexSet, (Γ.iso.vertexEquiv x).val = f x.val) + (he : ∀ e : D.toGraph.edgeSet, (Γ.iso.edgeEquiv e).val = f '' e.val) + (hcl : ∀ e ∈ D.E, closure (f '' e) = f '' closure e) + (hJ : J.IsSubdrawing D) : graphDrawingSubgraphU Γ J.toGraph = f '' J.U := by + ext z + change z ∈ (⋃ x ∈ J.V, graphDrawingVertexSet Γ x) ∪ + (⋃ e ∈ J.E, closure (graphDrawingEdgeSet Γ e)) ↔ z ∈ f '' J.U + simp only [mem_union, mem_iUnion] + constructor + · rintro (⟨x, hx, hz⟩ | ⟨e, heJ, hz⟩) + · rw [graphDrawingVertexSet_transport Γ hv (hJ.1 hx)] at hz + exact ⟨x, J.V_subset_U hx, (mem_singleton_iff.mp hz).symm⟩ + · rw [graphDrawingEdgeSet_transport Γ he (hJ.2 heJ), hcl e (hJ.2 heJ)] at hz + obtain ⟨x, hx, rfl⟩ := hz + exact ⟨x, J.closure_subset_U heJ hx, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + rw [J.U_eq] at hx + rcases hx with hx | hx + · left + refine ⟨x, hx, ?_⟩ + rw [graphDrawingVertexSet_transport Γ hv (hJ.1 hx)] + exact mem_singleton _ + · obtain ⟨e, hxe⟩ := mem_iUnion.mp hx + obtain ⟨heJ, hxe⟩ := mem_iUnion.mp hxe + right + refine ⟨e, heJ, ?_⟩ + rw [graphDrawingEdgeSet_transport Γ he (hJ.2 heJ), hcl e (hJ.2 heJ)] + exact mem_image_of_mem f hxe + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/EmbeddedBrickOuterLines.lean b/LeanPool/GraphMinor/GM16/EmbeddedBrickOuterLines.lean new file mode 100644 index 0000000000..6bca9e6e4b --- /dev/null +++ b/LeanPool/GraphMinor/GM16/EmbeddedBrickOuterLines.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +public import LeanPool.GraphMinor.Surface.TopologyStatements +import LeanPool.GraphMinor.GM16.WallBrickOuterLines +import LeanPool.GraphMinor.GM16.WallBrickCover +import LeanPool.GraphMinor.GM16.SphereComplementDisc +import LeanPool.GraphMinor.GM16.LineImageEmbedding +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# Common brick and outside boundary lines after embedding + +A common point lies on the boundary of the enclosed disc. The +open coordinate embedding pulls that boundary back to the +frontier of the enclosed row stack. Use the coordinate common-line +construction there, and carry the resulting line back to the +sphere. This verifies the brick/outside case of the rigidity +criterion for XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- Common points of an embedded brick and the outside disc are +joined by a line contained in both. -/ +theorem exists_line_in_embedded_brick_outer_intersection {S : Type*} + [TopologicalSpace S] [T2Space S] (hS : IsClosedSurface S) (hSphere : IsSphere S) + {f : (ℝ × ℝ) → S} (hf : IsOpenEmbedding f) {θ i j : ℕ} + (hθ : 4 ≤ θ) (hEven : Even θ) (hi : i + 2 < 2 * θ + 1) (hj : j + 1 < θ) (hParity : Even (i + j)) + {a b : S} (hab : a ≠ b) + (ha : a ∈ (f '' (Icc (i : ℝ) ((i : ℝ) + 2) ×ˢ Icc (j : ℝ) ((j : ℝ) + 1))) ∩ + closure (f '' wallEnclosedSet θ)ᶜ) + (hb : b ∈ (f '' (Icc (i : ℝ) ((i : ℝ) + 2) ×ˢ Icc (j : ℝ) ((j : ℝ) + 1))) ∩ + closure (f '' wallEnclosedSet θ)ᶜ) : + ∃ K, IsLineWithEnds K a b ∧ K ⊆ + (f '' (Icc (i : ℝ) ((i : ℝ) + 2) ×ˢ Icc (j : ℝ) ((j : ℝ) + 1))) ∩ + closure (f '' wallEnclosedSet θ)ᶜ := by + have hC := isClosedDisc_image_wallEnclosedSet hS hf.isEmbedding (by omega : 2≤θ) + obtain ⟨_,_,_,hMeet⟩ := isClosedDisc_closure_compl_of_isSphere hSphere hC + have hPre : f ⁻¹' frontier (f '' wallEnclosedSet θ) = frontier (wallEnclosedSet θ) := by + rw [hf.isOpenMap.preimage_frontier_eq_frontier_preimage hf.continuous, + preimage_image_eq _ hf.injective] + obtain ⟨p,hp,hpa⟩ := ha.1 + obtain ⟨q,hq,hqb⟩ := hb.1 + have hSource (z : ℝ × ℝ) + (hz : z ∈ Icc (i : ℝ) ((i : ℝ) + 2) ×ˢ Icc (j : ℝ) ((j : ℝ) + 1)) + (hzOut : f z ∈ closure (f '' wallEnclosedSet θ)ᶜ) : z ∈ frontier (wallEnclosedSet θ) := by + have hzC : f z ∈ f '' wallEnclosedSet θ := + mem_image_of_mem f (wall_brick_subset_enclosedSet hi hj hParity hz) + have hzBd := hMeet ▸ (show f z ∈ (f '' wallEnclosedSet θ) ∩ + closure (f '' wallEnclosedSet θ)ᶜ from ⟨hzC,hzOut⟩) + have hzFr : f z ∈ frontier (f '' wallEnclosedSet θ) := + (GM11.IsClosedDisc.frontier_eq_discBd hS hC).symm ▸ hzBd + exact (congrArg (fun A : Set (ℝ × ℝ) => z ∈ A) hPre).mp hzFr + have hpFr := hSource p hp (hpa.symm ▸ ha.2) + have hqFr := hSource q hq (hqb.symm ▸ hb.2) + have hpq : p ≠ q := fun he => hab (hpa.symm.trans ((congrArg f he).trans hqb)) + obtain ⟨L,hL,hSub⟩ := exists_line_in_brick_outer_intersection hθ hEven hi hj hParity hpq + ⟨hp,hpFr⟩ ⟨hq,hqFr⟩ + refine ⟨f '' L,?_,?_⟩ + · have h := isLineWithEnds_image_embedding hf.isEmbedding hL + rwa [hpa,hqb] at h + · rintro x ⟨z,hz,rfl⟩ + have hzSub := hSub hz + have hzFr : f z ∈ frontier (f '' wallEnclosedSet θ) := + (congrArg (fun A : Set (ℝ × ℝ) => z ∈ A) hPre).mpr hzSub.2 + have hzBd := GM11.IsClosedDisc.frontier_eq_discBd hS hC ▸ hzFr + exact ⟨mem_image_of_mem f hzSub.1,(hMeet.symm ▸ hzBd).2⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/EmbeddedLineGraphDrawing.lean b/LeanPool/GraphMinor/GM16/EmbeddedLineGraphDrawing.lean new file mode 100644 index 0000000000..a46f4785eb --- /dev/null +++ b/LeanPool/GraphMinor/GM16/EmbeddedLineGraphDrawing.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.FiniteLineGraphDrawing +import LeanPool.GraphMinor.GM16.LineImageEmbedding + +/-! +# Finite line drawings after an embedding + +Compose the vertex map with the embedding and replace every line by +its image. Injectivity preserves all incidence and intersection +conditions. The finite-line graph-drawing theorem then constructs the +drawing in the new space with the same prescribed maps. This moves +the wall's coordinate drawing into the sphere in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology GraphMinor.Surface +universe u v w w' + +/-- Carry prescribed lines into another space before constructing the +graph drawing. The source and target spaces may have different universes. -/ +theorem exists_graphDrawing_of_embedded_lines + {α : Type u} {β : Type v} {S : Type w} {T : Type w'} + [TopologicalSpace S] [TopologicalSpace T] [T2Space T] + (G : Graph α β) (hVG : V(G).Finite) (hEG : E(G).Finite) + (f : α → S) (hf : InjOn f V(G)) (L : β → Set S) + (hNoLoop : ∀ e v, ¬ G.IsLoopAt e v) + (hLine : ∀ e ∈ E(G), ∀ a b, G.IsLink e a b → IsLineWithEnds (L e) (f a) (f b)) + (hVertex : ∀ e ∈ E(G), ∀ v ∈ V(G), f v ∈ L e → G.Inc e v) + (hMeet : ∀ e ∈ E(G), ∀ d ∈ E(G), e ≠ d → L e ∩ L d ⊆ f '' V(G)) + (j : S → T) (hj : IsEmbedding j) : + ∃ Γ : GraphDrawing G T, + Γ.drawing.V = (j ∘ f) '' V(G) ∧ + (∀ v : V(G), (Γ.iso.vertexEquiv v).val = j (f v.val)) ∧ + (∀ e : E(G), closure (Γ.iso.edgeEquiv e).val = j '' L e.val) := by + apply exists_graphDrawing_of_finite_lines G hVG hEG (j ∘ f) + (fun x hx y hy heq => hf hx hy (hj.injective heq)) (fun e => j '' L e) hNoLoop + · intro e he a b hLink + exact isLineWithEnds_image_embedding hj (hLine e he a b hLink) + · intro e he v hv hPoint + obtain ⟨x,hx,heq⟩ := hPoint + have hxf : x = f v := hj.injective heq + exact hVertex e he v hv (hxf ▸ hx) + · intro e he d hd hne x hx + obtain ⟨y,hy,hyx⟩ := hx.1 + obtain ⟨z,hz,hzx⟩ := hx.2 + have hyz : y = z := hj.injective (hyx.trans hzx.symm) + have hOld := hMeet e he d hd hne ⟨hy,hyz.symm ▸ hz⟩ + obtain ⟨v,hv,hfy⟩ := hOld + exact ⟨v,hv,(congrArg j hfy).trans hyx⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/EmptyDiscRegion.lean b/LeanPool/GraphMinor/GM16/EmptyDiscRegion.lean new file mode 100644 index 0000000000..bc757a467b --- /dev/null +++ b/LeanPool/GraphMinor/GM16/EmptyDiscRegion.lean @@ -0,0 +1,72 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.Section6 +public import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# An empty disc with drawing boundary is a face + +The open part of such a disc lies in one region by connectedness. +That region cannot cross the disc boundary, because the boundary +belongs to the drawing. It is therefore exactly the disc interior, +and its closure is the whole disc. This identifies the brick faces +in the wall rigidity proof of XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface GM11 + +/-- Intrinsic and ambient interiors of a disc agree in a closed surface. -/ +theorem discInt_eq_interior_of_closedSurface {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {D : Set S} (hD : IsClosedDisc D) : discInt D = interior D := by + change D \ discBd D = interior D + rw [← GM11.IsClosedDisc.frontier_eq_discBd hS hD] + ext x + constructor + · rintro ⟨hx,hn⟩ + by_contra hInt + exact hn ⟨subset_closure hx,hInt⟩ + · intro hx + exact ⟨interior_subset hx,fun h => h.2 hx⟩ + +/-- A disc interior avoiding the drawing, with its boundary in the +drawing, is a region and has the given disc as closure. -/ +theorem empty_disc_is_region {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H : Drawing S} {D : Set S} (hD : IsClosedDisc D) + (hBd : discBd D ⊆ H.U) (hEmpty : Disjoint (interior D) H.U) : + interior D ∈ H.R ∧ closure (interior D) = D := by + have hInt := discInt_eq_interior_of_closedSurface hS hD + have hp : IsPreconnected (interior D) := hInt ▸ hD.isPreconnected_discInt + obtain ⟨x,hx⟩ := hInt ▸ hD.nonempty_discInt + obtain ⟨r,hr,hxr⟩ := exists_region_of_notMem ((disjoint_left.mp hEmpty) hx) + have hSub := subset_region hr hp hEmpty hx hxr + have hAvoid : Disjoint r (frontier D) := by + apply disjoint_left.mpr + intro y hyr hyD + have hyBd : y ∈ discBd D := GM11.IsClosedDisc.frontier_eq_discBd hS hD ▸ hyD + exact region_subset hr hyr (hBd hyBd) + have hRD : r ⊆ D := by + rcases subset_or_disjoint_of_frontier hD.isCompact.isClosed (region_isPreconnected hr) hAvoid + with h | h + · exact h + · exact ((disjoint_left.mp h) hxr (interior_subset hx)).elim + have hRInt : r ⊆ interior D := by + intro y hyr + rw [← hInt] + exact ⟨hRD hyr,fun hyBd => region_subset hr hyr (hBd hyBd)⟩ + have hEq : interior D = r := subset_antisymm hSub hRInt + refine ⟨hEq.symm ▸ hr,subset_antisymm (closure_minimal interior_subset hD.isCompact.isClosed) ?_⟩ + exact hInt ▸ hD.subset_closure_discInt + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/EnvelopeAfterClearing.lean b/LeanPool/GraphMinor/GM16/EnvelopeAfterClearing.lean new file mode 100644 index 0000000000..da6f67f55b --- /dev/null +++ b/LeanPool/GraphMinor/GM16/EnvelopeAfterClearing.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.Section9ZonePreservation +import LeanPool.GraphMinor.GM16.Section9Dials +import LeanPool.GraphMinor.GM11.Section810 + +/-! +# The remaining envelope after one clearing + +Other centres and zones survive clearing a disjoint member of the +envelope. Clearing any further subfamily gives the same drawing as +clearing its union with the first member, so rigidity also survives. +This is the envelope induction used for the horns in XVI (7.1), +Claim (4), page 69. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- Clearing one member leaves an envelope on all the other centres. -/ +theorem envelope_after_clearing {H : Drawing S} + {T T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d₁ : Set S → Set S → ℕ} {θ γ : ℕ} {Y : Set S} {Λ : S → Set S} {j : S} + (hj : j ∉ Y) (hEnv : IsEnvelope H d (insert j Y) γ Λ) + (hClear : IsClearedTangle H T d θ γ (Λ j) T₁ d₁) : + IsEnvelope (clearedSubdrawing H (Λ j)) d₁ Y γ Λ := by + have hZone := hEnv.2.1 + have hDis := hEnv.2.2.1 + have hY : Y ⊆ (clearedSubdrawing H (Λ j)).V := by + intro y hy + have hyj : y ≠ j := fun h => hj (h ▸ hy) + exact (mem_interSet_V_iff (isClosed_univ.sdiff (hZone j (mem_insert j Y)).isOpenDisc.1)).mpr + ⟨hEnv.1 (mem_insert_of_mem _ hy), mem_univ _, fun hyΛ => + (hDis y (mem_insert_of_mem _ hy) j (mem_insert _ _) hyj).notMem_of_mem_left + (subset_closure ((hZone y (mem_insert_of_mem _ hy)).z_subset (mem_singleton y))) + (subset_closure hyΛ)⟩ + refine ⟨hY, ?_, ?_, ?_⟩ + · intro y hy + exact zone_after_disjoint_clearing (hEnv.1 (mem_insert_of_mem _ hy)) + (hZone y (mem_insert_of_mem _ hy)) (hZone j (mem_insert _ _)) + (hDis y (mem_insert_of_mem _ hy) j (mem_insert _ _) (fun h => hj (h ▸ hy))) hClear + · exact fun y hy z hz => hDis y (mem_insert_of_mem _ hy) z (mem_insert_of_mem _ hz) + · intro Y' hY' + change IsRigid (clearEnvelopeDrawing (clearedSubdrawing H (Λ j)) Y' Λ) + rw [clearFamily_after_single H Y' Λ j (fun y hy => + (hZone y ((insert_subset_insert hY') hy)).isOpenDisc.1)] + exact hEnv.2.2.2 (insert j Y') (insert_subset_insert hY') + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/EnvelopeAnimal.lean b/LeanPool/GraphMinor/GM16/EnvelopeAnimal.lean new file mode 100644 index 0000000000..23657c3097 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/EnvelopeAnimal.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6 +public import LeanPool.GraphMinor.GM15.Section4 +import LeanPool.GraphMinor.GM16.EnvelopeHorns +import LeanPool.GraphMinor.GM16.EnvelopeHairEnds +import LeanPool.GraphMinor.GM16.EnvelopeHair +import LeanPool.GraphMinor.GM16.Section9SpanClearing +import LeanPool.GraphMinor.GM16.Section5 + +import LeanPool.GraphMinor.GM11.CitedResults + +import LeanPool.GraphMinor.GM12.Section710 + +import LeanPool.GraphMinor.GM12.Section77 + +/-! +# The animal after clearing its envelope + +Apply the repeated-clearing lemma to every horn. Move each near hair +end to its envelope boundary and extend the far end to the cleared +drawing. The new ends are distinct and separated, and each new hair +still avoids the horn centres. This assembles Claims (4)–(6) in the +proof of XVI (7.1), pages 69–70. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] +variable {α : Type u} {β : Type v} + +/-- Clearing the envelope produces the animal used for the second +application of (8.3) in XVI (7.1), with all horns and hairs proved. -/ +theorem animal_after_clearFamily + (hS : IsClosedSurface S) + (ys : Finset S) (Λ : S → Set S) {γ σ θ θ₂ χ θ_star : ℕ} (hγ : 2 ≤ γ) + {G : Graph α β} {H : Drawing S} (η : SpanEmbedding H G) + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {X : Set α} + (hAnim : IsAnimal G T_star θ_star H η θ T d X (ys : Set S) + χ ys.card θ (σ + ys.card)) + (hEnv : IsEnvelope H d (ys : Set S) γ Λ) + (hComp : IsLambdaCompression H (clearEnvelopeDrawing H (ys : Set S) Λ) + θ ((4 * γ + 2) * ys.card) T T' d d') + (hθ₂ : 1 ≤ θ₂) (hBudget : θ₂ + 3 * γ + (4 * γ + 2) * ys.card ≤ θ) : + ∃ Y' : Set S, IsAnimal G T_star θ_star + (clearEnvelopeDrawing H (ys : Set S) Λ) + (restrictCleared η (⋃ y ∈ (ys : Set S), Λ y)) + (θ - (4 * γ + 2) * ys.card) T' d' X Y' χ ys.card θ₂ σ := by + classical + obtain ⟨_, _, hSpan, hMet, hX, hXcard, hY, _, hHorns, hHairs, hSep⟩ := hAnim + have hSpan' := span_after_clearFamily hS ys Λ γ η hSpan hEnv hComp + obtain ⟨p, P, hNear, hInj, hDist⟩ := exists_envelope_hair_ends (θ₂ := θ₂) hS hEnv hComp hSep + (by omega) + let Y' := range p + have hY' : Y' ⊆ (clearEnvelopeDrawing H (ys : Set S) Λ).V := by + rintro x ⟨y, rfl⟩ + exact (hNear y).1 + have hCard : Y'.ncard = ys.card := by + rw [show Y' = range p from rfl, ncard_range_of_injective hInj, Nat.card_coe_set_eq, + ncard_coe_finset] + have hOrder : θ₂ ≤ θ - (4 * γ + 2) * ys.card := by omega + refine ⟨Y', hθ₂, hOrder, hSpan', hComp.hasMetric', ?_, hXcard, hY', hCard, ?_, ?_, ?_⟩ + · intro x hx + exact ⟨(hX hx).1, fun hxNew => (hX hx).2 + ((restrictCleared_imageGraph_le η (⋃ y ∈ (ys : Set S), Λ y)).vertexSet_mono hxNew)⟩ + · intro x hx + obtain ⟨Q, q, hHorn⟩ := hHorns x hx + obtain ⟨Q', q', hHorn'⟩ := horn_after_clearFamily hS ys Λ γ σ hγ η + hSpan hEnv hComp hHorn + exact ⟨_, _, hHorn'.mono hOrder le_rfl⟩ + · rintro x ⟨y, rfl⟩ + obtain ⟨hp, _, hPath, hPH, _, hInter, hNearDist⟩ := hNear y + obtain ⟨r, Q, hr, _, hQ, hQX, hFar⟩ := hHairs y.val y.prop + obtain ⟨q, hq, R, hpq, hR, hRX, hFar'⟩ := exists_hair_after_envelope hS η hEnv hComp + hX hθ₂ hBudget y.prop hr hp hPH hPath hInter hNearDist hQ hQX hFar + exact ⟨q, R, hq, hpq, hR, hRX, hFar'⟩ + · rintro x ⟨y, rfl⟩ z ⟨w, rfl⟩ hyw + exact hDist (fun h => hyw (congrArg p h)) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/EnvelopeExitPaths.lean b/LeanPool/GraphMinor/GM16/EnvelopeExitPaths.lean new file mode 100644 index 0000000000..6b726971fa --- /dev/null +++ b/LeanPool/GraphMinor/GM16/EnvelopeExitPaths.lean @@ -0,0 +1,157 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.DrawingConnected +import LeanPool.GraphMinor.GM16.ClearedPathVertices +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM16.DrawingGraphPaths +import LeanPool.GraphMinor.GM16.ZoneBoundaryLinkage +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM16.Section9BoundaryVertices +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.Section88 + +/-! +# Exit paths from the cleared discs + +Take a path from an interior vertex to the drawn zone boundary and +stop at its first boundary vertex. It stays in the closed zone and +has no other boundary vertex. For a disjoint envelope this is also +its only vertex in the final cleared drawing. These are the paths +`P_y` and the terminal exit paths in XVI (7.1), Claims (5) and (6), +pages 69–70. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- A vertex in a zone has a path to its boundary with just its last +vertex there, and with its entire point set in the closed zone. -/ +theorem exists_zone_exit_path (hS : IsClosedSurface S) {H : Drawing S} + (hH : (PaintingOrDrawing.drawing H).IsTwoCell) + {d : Set S → Set S → ℕ} {γ : ℕ} {z Λ : Set S} + (hZone : IsLambdaZoneAround H d γ z Λ) {s : S} (hs : s ∈ H.V) (hsΛ : s ∈ Λ) : + ∃ p ∈ H.V ∩ subBd Λ, ∃ P : Drawing S, + P.IsPathBetween s p ∧ P.IsSubdrawing H ∧ P.U ⊆ closure Λ ∧ + P.V ∩ (H.V ∩ subBd Λ) = {p} := by + have hC := interSet_isCircuit_of_oArc hZone.isOArc_bd hZone.bd_subset_U + obtain ⟨b, W, _, _, hV, _⟩ := hC + have hb : b ∈ H.V ∩ subBd Λ := by + have hbV : b ∈ (H.interSet (subBd Λ)).V := hV.symm ▸ W.start_mem_support + exact (GraphMinor.GM11.mem_interSet_V_iff + (by rw [subBd_eq_frontier]; exact isClosed_frontier)).mp hbV + obtain ⟨W₀⟩ := drawing_walk_of_twoCell hS hH hs hb.1 + obtain ⟨P₀, hP₀, _, _⟩ := exists_isGraphPathWithEnds_of_walk W₀ + obtain ⟨L, hL, hLH, _⟩ := exists_drawing_of_graphPath hP₀ + have hA : ({s} : Set S) ⊆ Λ := singleton_subset_iff.mpr hsΛ + obtain ⟨Q, hQ, _⟩ := linkage_inside_closed_zone hZone hA (fun _ : Fin 1 => L) + (fun _ => ⟨s, rfl, b, hb, hL, hLH⟩) + (fun i j hij => False.elim (hij (Subsingleton.elim i j))) + obtain ⟨p, s', hR⟩ := hQ 0 + have hp : p ∈ H.V ∩ subBd Λ := (hR.2.1 ▸ (show p ∈ ({p} : Set S) from rfl)).2 + have hs's : s' = s := (hR.2.2 ▸ (show s' ∈ ({s'} : Set S) from rfl)).2 + subst s' + obtain ⟨P, hP, hPH, hPQ⟩ := exists_drawing_of_graphPath hR.1.symm + refine ⟨p, hp, P, hP, hPH.trans interSet_isSub, + fun _ hx => interSet_U_subset isClosed_closure (hPH.U_subset hx), ?_⟩ + change V(P.toGraph) ∩ (H.V ∩ subBd Λ) = {p} + rw [hPQ] + exact hR.2.1 + +/-- The exit path from an envelope centre meets the final cleared +drawing just in its boundary end. This is `P_y` in XVI (7.1). -/ +theorem exists_envelope_centre_exit (hS : IsClosedSurface S) {H : Drawing S} + (hH : (PaintingOrDrawing.drawing H).IsTwoCell) + {d : Set S → Set S → ℕ} {γ : ℕ} {Y : Set S} {Λ : S → Set S} + (hEnv : IsEnvelope H d Y γ Λ) {y : S} (hy : y ∈ Y) : + ∃ p ∈ (clearEnvelopeDrawing H Y Λ).V, p ∈ subBd (Λ y) ∧ ∃ P : Drawing S, + P.IsPathBetween y p ∧ P.IsSubdrawing H ∧ P.U ⊆ closure (Λ y) ∧ + P.V ∩ (clearEnvelopeDrawing H Y Λ).V = {p} ∧ d {y} {p} ≤ γ := by + have hZone := hEnv.2.1 y hy + obtain ⟨p, hp, P, hP, hPH, hPU, hOuter⟩ := exists_zone_exit_path hS hH hZone + (hEnv.1 hy) (hZone.z_subset (mem_singleton y)) + have hpClear := boundary_vertex_mem_clearFamily hEnv.2.1 hEnv.2.2.1 hy hp + refine ⟨p, hpClear, hp.2, P, hP, hPH, hPU, ?_, ?_⟩ + · apply subset_antisymm + · rintro x ⟨hxP, hxClear⟩ + have hxOut := (clearFamily_U hEnv.2.1 ▸ (clearEnvelopeDrawing H Y Λ).V_subset_U hxClear).2 + have hxNot : x ∉ Λ y := fun h => hxOut (mem_iUnion₂.mpr ⟨y, hy, h⟩) + have hxBd : x ∈ subBd (Λ y) := ⟨hPU (P.V_subset_U hxP), subset_closure ⟨mem_univ _, hxNot⟩⟩ + exact hOuter ▸ ⟨hxP, hPH.1 hxP, hxBd⟩ + · rintro x rfl + exact ⟨(graphPath_of_drawingPath hPH hP).right_mem, hpClear⟩ + · exact hZone.dist_le {p} (Or.inl (Or.inl ⟨p, hp.1, rfl⟩)) + (singleton_subset_iff.mpr hp.2.1) + +/-- Every old vertex has a terminal exit path to the cleared drawing. +If it was cleared, the exit stays in one envelope disc. Its endpoint +is at distance at most twice the envelope radius. This is `R_y` in +XVI (7.1), Claim (6), page 70. -/ +theorem exists_envelope_vertex_exit (hS : IsClosedSurface S) {H : Drawing S} + {θ γ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {Y : Set S} {Λ : S → Set S} + (hMet : HasTangleMetric H θ T d) (hEnv : IsEnvelope H d Y γ Λ) + {x : S} (hx : x ∈ H.V) : + ∃ p ∈ (clearEnvelopeDrawing H Y Λ).V, ∃ P : Drawing S, + P.IsPathBetween x p ∧ P.IsSubdrawing H ∧ + P.V ∩ (clearEnvelopeDrawing H Y Λ).V = {p} ∧ d {x} {p} ≤ 2 * γ := by + classical + obtain ⟨_, hSelf, _, hSymm, hTri, _⟩ := GM11.gm15_theorem_9_1 H θ T d hS inferInstance hMet + by_cases hxClear : x ∈ (clearEnvelopeDrawing H Y Λ).V + · let W : GraphWalk H.toGraph x x := .nil hx + let P := walkDrawing H W + have hsW : W.support = [x] := Surface.GraphWalk.support_nil hx + have hW : W.IsSimple := by + change W.support.Nodup + rw [hsW] + exact List.nodup_singleton x + have hPV : P.V = {x} := by + rw [show P.V = {z | z ∈ W.support} from walkDrawing_V H W, hsW] + ext z + simp only [mem_ofPred_eq, List.mem_singleton, mem_singleton_iff] + refine ⟨x, hxClear, P, walkDrawing_isPathBetween H hW, walkDrawing_isSubdrawing H W, ?_, ?_⟩ + · rw [hPV] + exact inter_eq_left.mpr (singleton_subset_iff.mpr hxClear) + · rw [hSelf {x} (Or.inl (Or.inl ⟨x, hx, rfl⟩))] + exact Nat.zero_le _ + · have hxIn : x ∈ ⋃ y ∈ Y, Λ y := by + by_contra hOut + exact hxClear (mem_clearFamily_of_notMem_union hx hOut) + obtain ⟨y, hy, hxy⟩ := mem_iUnion₂.mp hxIn + have hZone := hEnv.2.1 y hy + obtain ⟨p, hp, P, hP, hPH, hPU, hOuter⟩ := + exists_zone_exit_path hS hMet.1.1 hZone hx hxy + have hpClear := boundary_vertex_mem_clearFamily hEnv.2.1 hEnv.2.2.1 hy hp + refine ⟨p, hpClear, P, hP, hPH, ?_, ?_⟩ + · apply subset_antisymm + · rintro z ⟨hzP, hzClear⟩ + have hzOut := (clearFamily_U hEnv.2.1 ▸ (clearEnvelopeDrawing H Y Λ).V_subset_U hzClear).2 + have hzNot : z ∉ Λ y := fun h => hzOut (mem_iUnion₂.mpr ⟨y, hy, h⟩) + have hzBd : z ∈ subBd (Λ y) := ⟨hPU (P.V_subset_U hzP), subset_closure ⟨mem_univ _, hzNot⟩⟩ + exact hOuter ▸ ⟨hzP, hPH.1 hzP, hzBd⟩ + · rintro z rfl + exact ⟨(graphPath_of_drawingPath hPH hP).right_mem, hpClear⟩ + · have hxA : ({x} : Set S) ∈ H.A := Or.inl (Or.inl ⟨x, hx, rfl⟩) + have hpA : ({p} : Set S) ∈ H.A := Or.inl (Or.inl ⟨p, hp.1, rfl⟩) + have hyA := hZone.z_mem + have hdx := hZone.dist_le {x} hxA (singleton_subset_iff.mpr (subset_closure hxy)) + have hdp := hZone.dist_le {p} hpA (singleton_subset_iff.mpr hp.2.1) + have htri := hTri {x} hxA {y} hyA {p} hpA + rw [hSymm {x} hxA {y} hyA] at htri + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/EnvelopeHair.lean b/LeanPool/GraphMinor/GM16/EnvelopeHair.lean new file mode 100644 index 0000000000..bfe142bc70 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/EnvelopeHair.lean @@ -0,0 +1,111 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section8 +import LeanPool.GraphMinor.GM16.EnvelopeExitPaths +import LeanPool.GraphMinor.GM16.EnvelopeHairMetric +import LeanPool.GraphMinor.GM16.HairBetweenExits +import LeanPool.GraphMinor.GM16.SpanSubdrawing +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM16.Section9Attachments +import LeanPool.GraphMinor.GM16.ClearedPathVertices +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM11.Section88 +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Extending one hair to the cleared drawing + +Use the chosen exit path at the near end and a first exit path at +the far end. Their union with the old hair contains a path relative +to the cleared drawing. Work in the graph with the horn centres +deleted so the new hair still avoids them. The compression estimate +makes the two new ends far apart. This is XVI (7.1), Claim (6), page 70. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 + GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] +variable {α : Type u} {β : Type v} + +/-- An old hair and the exit path chosen at its near end yield a +hair of the cleared drawing with the required new breadth. -/ +theorem exists_hair_after_envelope (hS : IsClosedSurface S) + {H P : Drawing S} {G Q : Graph α β} (η : SpanEmbedding H G) + {θ γ loss θ₂ : ℕ} {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {Y : Set S} {Λ : S → Set S} {X : Set α} + (hEnv : IsEnvelope H d Y γ Λ) + (hComp : IsLambdaCompression H (clearEnvelopeDrawing H Y Λ) θ loss T T' d d') + (hX : X ⊆ V(G) \ V(η.imageGraph)) (hθ₂ : 1 ≤ θ₂) + (hBudget : θ₂ + 3 * γ + loss ≤ θ) + {y r p : S} (hy : y ∈ Y) (hr : r ∈ H.V) + (hp : p ∈ (clearEnvelopeDrawing H Y Λ).V) + (hP : P.IsSubdrawing H) (hPath : P.IsPathBetween y p) + (hPClear : P.V ∩ (clearEnvelopeDrawing H Y Λ).V = {p}) + (hyp : d {y} {p} ≤ γ) + (hQ : IsHPathWithEnds G η.imageGraph Q (η.vMap y) (η.vMap r)) + (hQX : Disjoint X V(Q)) (hFar : θ ≤ d {y} {r}) : + ∃ q ∈ (clearEnvelopeDrawing H Y Λ).V, ∃ R : Graph α β, + p ≠ q ∧ IsHPathWithEnds G (restrictCleared η (⋃ y ∈ Y, Λ y)).imageGraph R + (η.vMap p) (η.vMap q) ∧ Disjoint X V(R) ∧ θ₂ ≤ d' {p} {q} := by + classical + let K := clearEnvelopeDrawing H Y Λ + let ηK := restrictCleared η (⋃ y ∈ Y, Λ y) + have hKH : K.IsSubdrawing H := interSet_isSub + have hyH := hEnv.1 hy + obtain ⟨q, hq, B, hBPath, hBH, hBClear, hrq⟩ := + exists_envelope_vertex_exit hS hComp.hasMetric hEnv hr + have hDist : θ₂ ≤ d' {p} {q} := envelope_hair_end_distance hS hKH hComp + hyH hr hp hq hFar hyp hrq hBudget + obtain ⟨_, hSelf, _, _, _, _⟩ := GM11.gm15_theorem_9_1 K (θ - loss) T' d' hS inferInstance + hComp.hasMetric' + have hpq : p ≠ q := by + intro heq + rw [heq, hSelf {q} (Or.inl (Or.inl ⟨q, hq, rfl⟩))] at hDist + omega + have hOldDis : Disjoint V(η.imageGraph) X := by + apply disjoint_left.mpr + exact fun x hx hxX => (hX hxX).2 hx + have hOldDel : η.imageGraph ≤ deleteVertices G X := le_deleteVertices_of_disjoint η.imageGraph_le + hOldDis + obtain ⟨A, hA, hAV, hAOld⟩ := exists_span_image_path η hP hPath + obtain ⟨B', hB', hBV, hBOld⟩ := exists_span_image_path η hBH hBPath + have hAKV : V(ηK.imageGraph) = η.vMap '' K.V := by rw [← ηK.bijOn_v.image_eq]; rfl + have hAClear : V(A) ∩ V(ηK.imageGraph) = {η.vMap p} := by + rw [hAV, hAKV, ← η.bijOn_v.injOn.image_inter hP.1 hKH.1, hPClear, image_singleton] + have hBClear' : V(B') ∩ V(ηK.imageGraph) = {η.vMap q} := by + rw [hBV, hAKV, ← η.bijOn_v.injOn.image_inter hBH.1 hKH.1, hBClear, image_singleton] + have hyNot : η.vMap y ∉ V(ηK.imageGraph) := by + rw [hAKV] + rintro ⟨z, hz, hzy⟩ + have hzy' := η.bijOn_v.injOn (hKH.1 hz) hyH hzy + have hyK : y ∈ K.V := hzy' ▸ hz + have hOut := (clearFamily_U hEnv.2.1 ▸ K.V_subset_U hyK).2 + exact hOut (mem_iUnion₂.mpr ⟨y, hy, (hEnv.2.1 y hy).z_subset (mem_singleton y)⟩) + have hpK : η.vMap p ∈ V(ηK.imageGraph) := hAKV.symm ▸ mem_image_of_mem η.vMap hp + have hqK : η.vMap q ∈ V(ηK.imageGraph) := hAKV.symm ▸ mem_image_of_mem η.vMap hq + have hpqIm : η.vMap p ≠ η.vMap q := fun h => hpq (η.bijOn_v.injOn (hKH.1 hp) (hKH.1 hq) h) + have hQDel : IsHPathWithEnds (deleteVertices G X) η.imageGraph Q (η.vMap y) (η.vMap r) := + ⟨hOldDel, hQ.2.1.in_deleteVertices hQX, hQ.2.2⟩ + obtain ⟨R, hR⟩ := exists_hPath_between_exits (restrictCleared_imageGraph_le η (⋃ y ∈ Y, Λ y)) + hQDel (hA.of_le (hAOld.trans hOldDel)) (hB'.of_le (hBOld.trans hOldDel)) + hAClear hBClear' hyNot hpK hqK hpqIm + have hRX : Disjoint X V(R) := by + apply disjoint_left.mpr + intro x hxX hxR + exact (hR.2.1.1.vertexSet_mono hxR).2 hxX + have hRG : IsHPathWithEnds G ηK.imageGraph R (η.vMap p) (η.vMap q) := + ⟨ηK.imageGraph_le, hR.2.1.mono (deleteVertices_le G X), hR.2.2⟩ + exact ⟨q, hq, R, hpq, hRG, hRX, hDist⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/EnvelopeHairEnds.lean b/LeanPool/GraphMinor/GM16/EnvelopeHairEnds.lean new file mode 100644 index 0000000000..707e33c44a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/EnvelopeHairEnds.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM15.Defs +import LeanPool.GraphMinor.GM16.EnvelopeExitPaths +import LeanPool.GraphMinor.GM16.EnvelopeHairMetric +import LeanPool.GraphMinor.GM11.Section88 + +/-! +# Moving the hair centres to the envelope boundaries + +Choose the first exit path for every centre. Its new end survives +clearing. Distinct ends lie on disjoint zone boundaries, so they +are distinct. The compression and the two radius bounds preserve +the required separation. This proves the family version of XVI +(7.1), Claim (5), pages 69–70. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The exit ends of the centres are distinct, remain separated, +and have paths meeting the cleared drawing just in their new ends. -/ +theorem exists_envelope_hair_ends (hS : IsClosedSurface S) {H : Drawing S} + {θ γ θ₂ : ℕ} {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {Y : Set S} {Λ : S → Set S} {loss : ℕ} + (hEnv : IsEnvelope H d Y γ Λ) + (hComp : IsLambdaCompression H (clearEnvelopeDrawing H Y Λ) θ loss T T' d d') + (hSep : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → θ ≤ d {y} {z}) + (hBudget : θ₂ + 2 * γ + loss ≤ θ) : + ∃ (p : Y → S) (P : Y → Drawing S), + (∀ y, p y ∈ (clearEnvelopeDrawing H Y Λ).V ∧ p y ∈ subBd (Λ y.val) ∧ + (P y).IsPathBetween y.val (p y) ∧ (P y).IsSubdrawing H ∧ + (P y).U ⊆ closure (Λ y.val) ∧ + (P y).V ∩ (clearEnvelopeDrawing H Y Λ).V = {p y} ∧ d {y.val} {p y} ≤ γ) ∧ + Function.Injective p ∧ Pairwise (fun y z => θ₂ ≤ d' {p y} {p z}) := by + classical + have hExit := fun y : Y => exists_envelope_centre_exit hS hComp.hasMetric.1.1 hEnv y.prop + choose p hp hBd P hPath hPH hPU hInter hDist using hExit + have hInj : Function.Injective p := by + intro y z heq + apply Subtype.ext + by_contra hyz + exact (hEnv.2.2.1 y.val y.prop z.val z.prop hyz).notMem_of_mem_left + (hBd y).1 (heq.symm ▸ (hBd z).1) + refine ⟨p, P, fun y => ⟨hp y, hBd y, hPath y, hPH y, hPU y, hInter y, hDist y⟩, hInj, ?_⟩ + intro y z hyz + have hyz' : y.val ≠ z.val := fun h => hyz (Subtype.ext h) + exact envelope_boundary_distance hS interSet_isSub hComp (hEnv.1 y.prop) (hEnv.1 z.prop) + (hp y) (hp z) (hSep y.val y.prop z.val z.prop hyz') (hDist y) (hDist z) hBudget + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/EnvelopeHairMetric.lean b/LeanPool/GraphMinor/GM16/EnvelopeHairMetric.lean new file mode 100644 index 0000000000..4a904fd4f6 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/EnvelopeHairMetric.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM15.Defs +import LeanPool.GraphMinor.GM16.MetricPoints +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM11.Section88 + +/-! +# Metric bounds at the new hair ends + +Moving two centres to their boundary ends costs at most `2γ` in +the old metric. Moving the two ends of a hair costs at most `3γ`. +The final compression costs its total loss once more. These are +exactly the calculations of XVI (7.1), Claims (5) and (6), page 70. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +private theorem envelope_distance_of_endpoint_budgets (hS : IsClosedSurface S) {H K : Drawing S} + {θ loss leftBudget rightBudget sep θ₂ : ℕ} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} (hK : K.IsSubdrawing H) + (hComp : IsLambdaCompression H K θ loss T T' d d') + {y z p q : S} (hy : y ∈ H.V) (hz : z ∈ H.V) (hp : p ∈ K.V) (hq : q ∈ K.V) + (hSep : sep ≤ d {y} {z}) (hyp : d {y} {p} ≤ leftBudget) + (hzq : d {z} {q} ≤ rightBudget) + (hBudget : θ₂ + leftBudget + rightBudget + loss ≤ sep) : θ₂ ≤ d' {p} {q} := by + obtain ⟨_, _, _, hSymm, hTri, _⟩ := GM11.gm15_theorem_9_1 H θ T d hS inferInstance hComp.hasMetric + have hyA : ({y} : Set S) ∈ H.A := Or.inl (Or.inl ⟨y, hy, rfl⟩) + have hzA : ({z} : Set S) ∈ H.A := Or.inl (Or.inl ⟨z, hz, rfl⟩) + have hpA : ({p} : Set S) ∈ H.A := Or.inl (Or.inl ⟨p, hK.1 hp, rfl⟩) + have hqA : ({q} : Set S) ∈ H.A := Or.inl (Or.inl ⟨q, hK.1 hq, rfl⟩) + have h₁ := hTri {y} hyA {p} hpA {z} hzA + have h₂ := hTri {p} hpA {q} hqA {z} hzA + rw [hSymm {q} hqA {z} hzA] at h₂ + have hc := hComp.dist_le p q + rw [pointDist_of_mem_vertices d (hK.1 hp) (hK.1 hq), pointDist_of_mem_vertices d' hp hq] at hc + omega + +/-- The new boundary ends of two hairs remain separated after +clearing, as in XVI (7.1), Claim (5), page 70. -/ +theorem envelope_boundary_distance (hS : IsClosedSurface S) {H K : Drawing S} + {θ loss γ sep θ₂ : ℕ} {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} (hK : K.IsSubdrawing H) + (hComp : IsLambdaCompression H K θ loss T T' d d') + {y z p q : S} (hy : y ∈ H.V) (hz : z ∈ H.V) (hp : p ∈ K.V) (hq : q ∈ K.V) + (hSep : sep ≤ d {y} {z}) (hyp : d {y} {p} ≤ γ) (hzq : d {z} {q} ≤ γ) + (hBudget : θ₂ + 2 * γ + loss ≤ sep) : θ₂ ≤ d' {p} {q} := by + exact envelope_distance_of_endpoint_budgets hS hK hComp hy hz hp hq hSep hyp hzq (by omega) + +/-- The path formed by the old hair and its two exit paths has far +new ends, as in XVI (7.1), Claim (6), page 70. -/ +theorem envelope_hair_end_distance (hS : IsClosedSurface S) {H K : Drawing S} + {θ loss γ sep θ₂ : ℕ} {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} (hK : K.IsSubdrawing H) + (hComp : IsLambdaCompression H K θ loss T T' d d') + {y r p q : S} (hy : y ∈ H.V) (hr : r ∈ H.V) (hp : p ∈ K.V) (hq : q ∈ K.V) + (hFar : sep ≤ d {y} {r}) (hyp : d {y} {p} ≤ γ) (hrq : d {r} {q} ≤ 2 * γ) + (hBudget : θ₂ + 3 * γ + loss ≤ sep) : θ₂ ≤ d' {p} {q} := by + exact envelope_distance_of_endpoint_budgets hS hK hComp hy hr hp hq hFar hyp hrq (by omega) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/EnvelopeHorns.lean b/LeanPool/GraphMinor/GM16/EnvelopeHorns.lean new file mode 100644 index 0000000000..ab1d000286 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/EnvelopeHorns.lean @@ -0,0 +1,129 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6 +public import LeanPool.GraphMinor.GM15.Section4 +import LeanPool.GraphMinor.GM16.EnvelopeAfterClearing +import LeanPool.GraphMinor.GM16.HornCongr +import LeanPool.GraphMinor.GM16.Section9ClearFamily +import LeanPool.GraphMinor.GM16.Section9Compressions +import LeanPool.GraphMinor.GM16.Section9Dials +import LeanPool.GraphMinor.GM16.Section6Clearing +import LeanPool.GraphMinor.GM16.SpanCongr +import LeanPool.GraphMinor.GM14.Section3b + + +import LeanPool.GraphMinor.GM11.CitedResults + +import LeanPool.GraphMinor.GM12.Section710 + +import LeanPool.GraphMinor.GM12.Section77 + +/-! +# Horns after clearing an envelope + +Apply XVI (6.2) once for each envelope disc. Each clearing loses one +horn path and `4γ + 2` units of breadth. The remaining discs are +still an envelope. Uniqueness of compression and of its metric +identifies the result with the given final compression. This proves +the repeated-clearing argument in XVI (7.1), Claim (4), page 69. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] +variable {α : Type u} {β : Type v} + +/-- Clearing a finite envelope loses one path per disc from a horn, +with exactly the total breadth loss used in XVI (7.1), Claim (4). -/ +theorem horn_after_clearFamily + (hS : IsClosedSurface S) + (ys : Finset S) (Λ : S → Set S) (γ σ : ℕ) (hγ : 2 ≤ γ) + {G : Graph α β} {H : Drawing S} (η : SpanEmbedding H G) {θ_star θ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} + (hSpan : IsSigmaSpan G H η θ_star θ T_star T) + (hEnv : IsEnvelope H d (ys : Set S) γ Λ) + (hComp : IsLambdaCompression H (clearEnvelopeDrawing H (ys : Set S) Λ) + θ ((4 * γ + 2) * ys.card) T T' d d') + {v : α} {P : Fin (σ + ys.card) → Graph α β} {u : Fin (σ + ys.card) → S} + (hHorn : IsHorn G H η d v θ (σ + ys.card) P u) : + ∃ (P' : Fin σ → Graph α β) (u' : Fin σ → S), + IsHorn G (clearEnvelopeDrawing H (ys : Set S) Λ) + (restrictCleared η (⋃ y ∈ (ys : Set S), Λ y)) d' v + (θ - (4 * γ + 2) * ys.card) σ P' u' := by + classical + induction ys using Finset.induction_on generalizing H θ T d T' d' with + | empty => + have hDraw := clearEnvelopeDrawing_empty H Λ + have hc : IsLambdaCompression H H θ 0 T T' d d' := by + simpa only [Finset.card_empty, Nat.mul_zero, hDraw] using hComp + have hSelf : IsLambdaCompression H H θ 0 T T d d := + ⟨hc.lam_lt, hc.hasMetric, by simpa only [Nat.sub_zero] using hc.hasMetric, + fun _ _ => Nat.le_add_right _ _⟩ + have hT := compression_unique hS inferInstance hSelf hc + have hM' : HasTangleMetric H θ T d' := by + simpa only [Nat.sub_zero, ← hT] using hc.hasMetric' + have hEq := (tangleMetric_eq_of_hasTangleMetric hS inferInstance hc.hasMetric hM').1 + have hHorn' : IsHorn G H η d v θ σ P u := by + simpa only [Finset.card_empty, Nat.add_zero] using hHorn + refine ⟨P, u, ?_⟩ + have hTrans := horn_congr_drawing_embedding hDraw.symm η + (restrictCleared η (⋃ y ∈ (↑(∅ : Finset S) : Set S), Λ y)) rfl rfl + (fun x hx y hy => hEq {x} (Or.inl (Or.inl ⟨x, hx, rfl⟩)) + {y} (Or.inl (Or.inl ⟨y, hy, rfl⟩))) hHorn' + simpa only [Finset.card_empty, Nat.mul_zero, Nat.sub_zero] using hTrans + | @insert j ys hj ih => + let c := 4 * γ + 2 + obtain ⟨T₁, T₂, d₁, d₂, hClear, hRig₁, hEnv₁, hComp₂, hTot⟩ := + exists_compression_clearEnvelope_insert hS hj hComp.hasMetric hEnv hComp.lam_lt + let H₁ := clearedSubdrawing H (Λ j) + have hjmem : j ∈ insert j ys := Finset.mem_insert_self _ _ + have hZone := hEnv.2.1 j hjmem + have hθj : c < θ := by + have hleft := hComp₂.lam_lt + omega + have hSpan₁ : IsSigmaSpan G H₁ (restrictCleared η (Λ j)) θ_star (θ - c) T_star T₁ := by + simpa only [c, Nat.sub_sub] using IsSigmaSpan.clear hSpan hClear hRig₁ + let e : Fin ((σ + ys.card) + 1) ≃ Fin (σ + (insert j ys).card) := + finCongr (by rw [Finset.card_insert_of_notMem hj]; omega) + have hHorn₀ := horn_reindex e hHorn + obtain ⟨P₁, u₁, hHorn₁⟩ := theorem_6_2_proof hS inferInstance G θ_star θ γ (σ + ys.card) + T_star H η T T₁ d d₁ (Λ j) v (fun i => P (e i)) (fun i => u (e i)) + hSpan hComp.hasMetric hγ (by dsimp only [c] at hθj; omega) + ⟨{j}, hZone.z_mem, hZone⟩ hRig₁ hClear hHorn₀ + have hHorn₁' : IsHorn G H₁ (restrictCleared η (Λ j)) d₁ v (θ - c) (σ + ys.card) P₁ u₁ := by + simpa only [c, Nat.sub_sub] using hHorn₁ + obtain ⟨P₂, u₂, hHorn₂⟩ := ih (restrictCleared η (Λ j)) hSpan₁ hEnv₁ hComp₂ hHorn₁' + have hDraw := clearEnvelopeDrawing_insert H ys j Λ + (fun y hy => (hEnv.2.1 y hy).isOpenDisc.1) + have hLoss : c + c * ys.card = c * (insert j ys).card := by + rw [Finset.card_insert_of_notMem hj, Nat.mul_add, Nat.mul_one, Nat.add_comm] + have hT : T₂ = T' := compression_unique hS inferInstance hTot hComp + have hM₂ : HasTangleMetric (clearEnvelopeDrawing H (↑(insert j ys)) Λ) + (θ - c * (insert j ys).card) T' d₂ := by simpa only [hT] using hTot.hasMetric' + have hEq := (tangleMetric_eq_of_hasTangleMetric hS inferInstance hM₂ hComp.hasMetric').1 + have hEqOld : ∀ x ∈ (clearEnvelopeDrawing H₁ (ys : Set S) Λ).V, + ∀ y ∈ (clearEnvelopeDrawing H₁ (ys : Set S) Λ).V, d₂ {x} {y} = d' {x} {y} := by + rw [hDraw] + intro x hx y hy + exact hEq {x} (Or.inl (Or.inl ⟨x, hx, rfl⟩)) {y} (Or.inl (Or.inl ⟨y, hy, rfl⟩)) + have hTransport := horn_congr_drawing_embedding hDraw + (restrictCleared (restrictCleared η (Λ j)) (⋃ y ∈ (ys : Set S), Λ y)) + (restrictCleared η (⋃ y ∈ (↑(insert j ys) : Set S), Λ y)) rfl rfl hEqOld hHorn₂ + have hOrder : θ - c - c * ys.card = θ - c * (insert j ys).card := by + rw [Nat.sub_sub, hLoss] + rw [hOrder] at hTransport + exact ⟨P₂, u₂, hTransport⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/EquivUnion.lean b/LeanPool/GraphMinor/GM16/EquivUnion.lean new file mode 100644 index 0000000000..2bf4c55262 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/EquivUnion.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Data.Set.UnionLift + +/-! +# Gluing compatible equivalences on unions + +Local equivalences glue when their forward maps agree on source +intersections and their inverses agree on target intersections. +Glue both maps and check they are inverse on a piece containing +the point. This is used for the vertex and edge isomorphisms of +the union of the subdivision paths in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set +universe u v w + +/-- Compatible local equivalences and their compatible inverses give +an equivalence of the unions, with the stated restriction on every piece. -/ +theorem exists_equiv_iUnion {α : Type u} {β : Type v} {ι : Type w} + (S : ι → Set α) (T : ι → Set β) (φ : ∀ i, S i ≃ T i) + (hForward : ∀ i j x (hxi : x ∈ S i) (hxj : x ∈ S j), + (φ i ⟨x, hxi⟩).val = (φ j ⟨x, hxj⟩).val) + (hBackward : ∀ i j y (hyi : y ∈ T i) (hyj : y ∈ T j), + ((φ i).symm ⟨y, hyi⟩).val = ((φ j).symm ⟨y, hyj⟩).val) : + ∃ Φ : (⋃ i, S i) ≃ (⋃ i, T i), ∀ i (x : S i), + (Φ ⟨x.val,mem_iUnion_of_mem i x.property⟩).val = (φ i x).val := by + let f (i : ι) (x : S i) : β := (φ i x).val + let g (i : ι) (y : T i) : α := ((φ i).symm y).val + let F := iUnionLift S f hForward (⋃ i, S i) subset_rfl + let G := iUnionLift T g hBackward (⋃ i, T i) subset_rfl + have hFSpec (x : ⋃ i, S i) (i : ι) (hx : x.val ∈ S i) : + F x = (φ i ⟨x.val,hx⟩).val := + iUnionLift_of_mem (f := f) (hf := hForward) (hT := subset_rfl) x hx + have hGSpec (y : ⋃ i, T i) (i : ι) (hy : y.val ∈ T i) : + G y = ((φ i).symm ⟨y.val,hy⟩).val := + iUnionLift_of_mem (f := g) (hf := hBackward) (hT := subset_rfl) y hy + have hFR (x : ⋃ i, S i) : F x ∈ ⋃ i, T i := by + obtain ⟨i,hxi⟩ := mem_iUnion.mp x.property + rw [hFSpec x i hxi] + exact mem_iUnion_of_mem i (φ i ⟨x.val,hxi⟩).property + have hGR (y : ⋃ i, T i) : G y ∈ ⋃ i, S i := by + obtain ⟨i,hyi⟩ := mem_iUnion.mp y.property + rw [hGSpec y i hyi] + exact mem_iUnion_of_mem i ((φ i).symm ⟨y.val,hyi⟩).property + let fv (x : ⋃ i, S i) : (⋃ i, T i) := ⟨F x,hFR x⟩ + let gv (y : ⋃ i, T i) : (⋃ i, S i) := ⟨G y,hGR y⟩ + have hLeft : Function.LeftInverse gv fv := by + intro x + obtain ⟨i,hxi⟩ := mem_iUnion.mp x.property + have hF : (fv x).val = (φ i ⟨x.val,hxi⟩).val := hFSpec x i hxi + have hyi : (fv x).val ∈ T i := hF.symm ▸ (φ i ⟨x.val,hxi⟩).property + have he : (⟨(fv x).val,hyi⟩ : T i) = φ i ⟨x.val,hxi⟩ := Subtype.ext hF + apply Subtype.ext + change G (fv x) = x.val + rw [hGSpec (fv x) i hyi] + rw [he,Equiv.symm_apply_apply] + have hRight : Function.RightInverse gv fv := by + intro y + obtain ⟨i,hyi⟩ := mem_iUnion.mp y.property + have hG : (gv y).val = ((φ i).symm ⟨y.val,hyi⟩).val := hGSpec y i hyi + have hxi : (gv y).val ∈ S i := hG.symm ▸ ((φ i).symm ⟨y.val,hyi⟩).property + have he : (⟨(gv y).val,hxi⟩ : S i) = (φ i).symm ⟨y.val,hyi⟩ := Subtype.ext hG + apply Subtype.ext + change F (gv y) = y.val + rw [hFSpec (gv y) i hxi] + rw [he,Equiv.apply_symm_apply] + refine ⟨⟨fv,gv,hLeft,hRight⟩,?_⟩ + intro i x + exact hFSpec ⟨x.val,mem_iUnion_of_mem i x.property⟩ i x.property + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ErdosSzekeres.lean b/LeanPool/GraphMinor/GM16/ErdosSzekeres.lean new file mode 100644 index 0000000000..c3285c679c --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ErdosSzekeres.lean @@ -0,0 +1,168 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Data.Finset.Powerset +public import Mathlib.Order.Monotone.Basic +public import Mathlib.Data.Fin.Basic +public import Mathlib.Order.Fin.Basic +import Mathlib.Data.Fintype.Prod +import Mathlib.Data.Finset.Sort +import Mathlib.Data.Finset.Lattice.Fold +import Mathlib.Data.Fintype.Card +import Mathlib.Tactic.Linarith + +/-! +# The finite Erdős–Szekeres theorem + +XVI (8.1), Claim (4), page 72, selects paths whose ends have the same +order on two circles, after possibly reversing one orientation. The +finite sequence theorem needed there follows by labeling each term +with the lengths of the longest increasing and decreasing subsequences +ending at that term. These pairs of lengths are all distinct. +-/ + +public section +namespace GraphMinor.GM16 +open Set Finset + +private noncomputable def endingChains {ι α : Type*} [Fintype ι] [LinearOrder ι] [LinearOrder α] + (f : ι → α) (i : ι) : Finset (Finset ι) := by + classical + exact univ.powerset.filter (fun s => i ∈ s ∧ (∀ j ∈ s, j ≤ i) ∧ StrictMonoOn f (s : Set ι)) + +private theorem singleton_mem_endingChains {ι α : Type*} [Fintype ι] [LinearOrder ι] [LinearOrder α] + (f : ι → α) (i : ι) : {i} ∈ endingChains f i := by + classical + refine Finset.mem_filter.mpr ⟨Finset.mem_powerset.mpr (Finset.subset_univ _), + Finset.mem_singleton_self i, fun j hj => (Finset.mem_singleton.mp hj).le, ?_⟩ + intro a ha b hb hab + exact False.elim ((ne_of_lt hab) ((Finset.mem_singleton.mp ha).trans + (Finset.mem_singleton.mp hb).symm)) + +private noncomputable def endingLength {ι α : Type*} [Fintype ι] [LinearOrder ι] [LinearOrder α] + (f : ι → α) (i : ι) : ℕ := (endingChains f i).sup Finset.card + +private theorem endingLength_witness {ι α : Type*} [Fintype ι] [LinearOrder ι] [LinearOrder α] + (f : ι → α) (i : ι) : ∃ s : Finset ι, + i ∈ s ∧ (∀ j ∈ s, j ≤ i) ∧ StrictMonoOn f (s : Set ι) ∧ s.card = endingLength f i := by + classical + obtain ⟨s, hs, hcard⟩ := exists_mem_eq_sup (endingChains f i) + ⟨{i}, singleton_mem_endingChains f i⟩ Finset.card + have hs' := (mem_filter.mp hs).2 + exact ⟨s, hs'.1, hs'.2.1, hs'.2.2, hcard.symm⟩ + +private theorem endingLength_pos {ι α : Type*} [Fintype ι] [LinearOrder ι] [LinearOrder α] + (f : ι → α) (i : ι) : 1 ≤ endingLength f i := by + classical + have h := le_sup (f := Finset.card) (singleton_mem_endingChains f i) + change 1 ≤ (endingChains f i).sup Finset.card + simpa only [card_singleton] using h + +private theorem endingLength_lt_of_lt {ι α : Type*} [Fintype ι] [LinearOrder ι] [LinearOrder α] + (f : ι → α) {i j : ι} (hij : i < j) (hfij : f i < f j) : + endingLength f i < endingLength f j := by + classical + obtain ⟨s, his, hle, hmono, hcard⟩ := endingLength_witness f i + have hjs : j ∉ s := fun hj => (not_le_of_gt hij) (hle j hj) + have hmem : insert j s ∈ endingChains f j := by + refine mem_filter.mpr ⟨Finset.mem_powerset.mpr (Finset.subset_univ _), mem_insert_self _ _, ?_, + ?_⟩ + · intro k hk + rcases mem_insert.mp hk with rfl | hk + · exact le_rfl + · exact (hle k hk).trans (le_of_lt hij) + · intro a ha b hb hab + rcases Finset.mem_insert.mp ha with haJ | haS + · have hbLe : b ≤ j := (Finset.mem_insert.mp hb).elim (fun h => h.le) + (fun h => (hle b h).trans (le_of_lt hij)) + exact False.elim ((not_lt_of_ge hbLe) (haJ ▸ hab)) + · rcases Finset.mem_insert.mp hb with hbJ | hbS + · have hfai : f a ≤ f i := by + by_cases hai : a = i + · exact le_of_eq (congrArg f hai) + · exact le_of_lt (hmono haS his (lt_of_le_of_ne (hle a haS) hai)) + rw [hbJ] + exact lt_of_le_of_lt hfai hfij + · exact hmono haS hbS hab + have hb := le_sup (f := Finset.card) hmem + rw [card_insert_of_notMem hjs, hcard] at hb + exact Nat.lt_of_succ_le hb + +/-- The finite Erdős–Szekeres theorem used in Graph Minors XVI (8.1), +Claim (4), page 72. An injective sequence of `m²` terms in a linear order +has an increasing or decreasing subsequence with at least `m` terms. -/ +theorem erdos_szekeres {α : Type*} [LinearOrder α] (m : ℕ) (hm : 1 ≤ m) + (f : Fin (m ^ 2) → α) (hf : Function.Injective f) : + ∃ s : Finset (Fin (m ^ 2)), m ≤ s.card ∧ + (StrictMonoOn f (s : Set (Fin (m ^ 2))) ∨ StrictAntiOn f (s : Set (Fin (m ^ 2)))) := by + classical + by_contra hn + have hInc : ∀ i, endingLength f i < m := by + intro i + obtain ⟨s, _, _, hMono, hcard⟩ := endingLength_witness f i + by_contra hlarge + exact hn ⟨s, hcard ▸ (Nat.le_of_not_gt hlarge), Or.inl hMono⟩ + let fRev : Fin (m ^ 2) → OrderDual α := f + have hDec : ∀ i, endingLength fRev i < m := by + intro i + obtain ⟨s, _, _, hMono, hcard⟩ := endingLength_witness fRev i + by_contra hlarge + exact hn ⟨s, hcard ▸ (Nat.le_of_not_gt hlarge), Or.inr hMono⟩ + let label : Fin (m ^ 2) → Fin (m - 1) × Fin (m - 1) := fun i => + (⟨endingLength f i - 1, by have := endingLength_pos f i; have := hInc i; omega⟩, + ⟨endingLength fRev i - 1, by have := endingLength_pos fRev i; have := hDec i; omega⟩) + have hLabel : Function.Injective label := by + intro i j heq + by_contra hij + have hneq : f i ≠ f j := fun he => hij (hf he) + have hLabels : endingLength f i = endingLength f j ∧ + endingLength fRev i = endingLength fRev j := by + have h₁ := congrArg (fun p => p.1.val) heq + have h₂ := congrArg (fun p => p.2.val) heq + have hi := endingLength_pos f i + have hj := endingLength_pos f j + have hi' := endingLength_pos fRev i + have hj' := endingLength_pos fRev j + dsimp only [label] at h₁ h₂ + omega + rcases lt_or_gt_of_ne hij with hij | hji + · rcases lt_or_gt_of_ne hneq with hlt | hgt + · exact (ne_of_lt (endingLength_lt_of_lt f hij hlt)) hLabels.1 + · exact (ne_of_lt (endingLength_lt_of_lt fRev hij hgt)) hLabels.2 + · rcases lt_or_gt_of_ne hneq with hlt | hgt + · exact (ne_of_lt (endingLength_lt_of_lt fRev hji hlt)) hLabels.2.symm + · exact (ne_of_lt (endingLength_lt_of_lt f hji hgt)) hLabels.1.symm + have hc := Fintype.card_le_of_injective label hLabel + simp only [Fintype.card_fin, Fintype.card_prod] at hc + have hmEq : m - 1 + 1 = m := by omega + nlinarith + +/-- The sequence form of the selection in XVI (8.1), Claim (4): +retain exactly `m` indices, in their original order. -/ +theorem erdos_szekeres_subsequence {α : Type*} [LinearOrder α] (m : ℕ) (hm : 1 ≤ m) + (f : Fin (m ^ 2) → α) (hf : Function.Injective f) : + ∃ g : Fin m → Fin (m ^ 2), StrictMono g ∧ + (StrictMono (f ∘ g) ∨ StrictAnti (f ∘ g)) := by + classical + obtain ⟨s, hsize, hOrder⟩ := erdos_szekeres m hm f hf + let g : Fin m → Fin (m ^ 2) := fun i => + s.orderEmbOfFin rfl ⟨i.val, lt_of_lt_of_le i.isLt hsize⟩ + have hg : StrictMono g := by + intro i j hij + exact (s.orderEmbOfFin rfl).strictMono (show (⟨i.val, lt_of_lt_of_le i.isLt hsize⟩ : Fin + s.card) < + ⟨j.val, lt_of_lt_of_le j.isLt hsize⟩ from hij) + have hgs : ∀ i, g i ∈ (s : Set (Fin (m ^ 2))) := fun i => s.orderEmbOfFin_mem rfl _ + refine ⟨g, hg, ?_⟩ + rcases hOrder with hMono | hAnti + · exact Or.inl (fun i j hij => hMono (hgs i) (hgs j) (hg hij)) + · exact Or.inr (fun i j hij => hAnti (hgs i) (hgs j) (hg hij)) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/FaceSubdisc.lean b/LeanPool/GraphMinor/GM16/FaceSubdisc.lean new file mode 100644 index 0000000000..8de5893133 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/FaceSubdisc.lean @@ -0,0 +1,73 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.DiscsInSurface +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Cutting off a subdisc in an empty face + +A line in a face and a boundary subline with the same ends form a +circle. The disc it bounds inside the face meets the drawing exactly +in the boundary subline. This supplies each half of the two-face +dial in the rigidity check of XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface GM11 + +/-- If a closed subset lies in another closed set, points of the first +on the frontier of the second are on its own frontier. -/ +theorem inter_frontier_subset_frontier_of_subset {S : Type*} [TopologicalSpace S] + {A B : Set S} (hAB : A ⊆ B) : A ∩ frontier B ⊆ frontier A := by + rintro x ⟨hx,hxB⟩ + exact ⟨subset_closure hx, fun hxInt => hxB.2 (interior_mono hAB hxInt)⟩ + +/-- The part cut off inside an empty face by a line meets the drawing +exactly in the corresponding boundary line. -/ +theorem exists_face_subdisc {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {C P K U : Set S} {a b : S} + (hC : IsClosedDisc C) (hP : IsLineWithEnds P a b) (hK : IsLineWithEnds K a b) + (hPC : P ⊆ C) (hKC : K ⊆ discBd C) (hKU : K ⊆ U) + (hPU : P ∩ discBd C ⊆ {a,b}) (hEmpty : C ∩ U ⊆ discBd C) : + ∃ Δ, Δ ⊆ C ∧ IsClosedDisc Δ ∧ discBd Δ = P ∪ K ∧ + Δ ∩ discBd C = K ∧ Δ ∩ U = K := by + have hPK : P ∩ K ⊆ {a,b} := fun _ hx => hPU ⟨hx.1,hKC hx.2⟩ + have hCircle := isOArc_union hP hK hPK + obtain ⟨Δ,⟨hΔC,hΔ,hbd,_⟩,_⟩ := disc_oArc C (P ∪ K) hC + (union_subset hPC (hKC.trans (Surface.discBd_subset C))) hCircle + have hKΔ : K ⊆ Δ := fun _ hx => Surface.discBd_subset Δ (hbd.symm ▸ Or.inr hx) + have hEnds : ({a,b} : Set S) ⊆ K := by + intro x hx + rcases hx with rfl | hx + · exact hK.left_mem + · rw [mem_singleton_iff] at hx + exact hx.symm ▸ hK.right_mem + have hBoundary : Δ ∩ discBd C = K := by + apply subset_antisymm + · rintro x ⟨hxΔ,hxC⟩ + have hxFr : x ∈ frontier Δ := inter_frontier_subset_frontier_of_subset hΔC + ⟨hxΔ,(GM11.IsClosedDisc.frontier_eq_discBd hS hC).symm ▸ hxC⟩ + have hx : x ∈ P ∪ K := hbd ▸ (GM11.IsClosedDisc.frontier_eq_discBd hS hΔ ▸ hxFr) + exact hx.elim (fun hxP => hEnds (hPU ⟨hxP,hxC⟩)) id + · intro x hx + exact ⟨hKΔ hx,hKC hx⟩ + refine ⟨Δ,hΔC,hΔ,hbd,hBoundary,subset_antisymm ?_ ?_⟩ + · rintro x ⟨hxΔ,hxU⟩ + exact hBoundary ▸ (show x ∈ Δ ∩ discBd C from ⟨hxΔ,hEmpty ⟨hΔC hxΔ,hxU⟩⟩) + · intro x hx + exact ⟨hKΔ hx,hKU hx⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/FiniteCircleCycle.lean b/LeanPool/GraphMinor/GM16/FiniteCircleCycle.lean new file mode 100644 index 0000000000..1bf737093c --- /dev/null +++ b/LeanPool/GraphMinor/GM16/FiniteCircleCycle.lean @@ -0,0 +1,184 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import Mathlib.Logic.Equiv.Fin.Rotate +import Mathlib.Algebra.Group.Fin.Basic +import Mathlib.Tactic.Linarith + +/-! +# The cyclic order on a finite indexed list + +The presentations used in XVI (8.1), Claim (11), need cyclic orders +of the finitely many boundary vertices. Rotation of `Fin n` gives +the basic cyclic permutation. Increasing triples of indices occur +clockwise, including the return from the last index to the first. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.GM09 + +/-- The cyclic permutation that takes each index to the next one. -/ +@[expose] noncomputable def finCyclicPerm (n : ℕ) : CyclicPerm (Fin n) where + bar := univ + toFun := finRotate n + finite_bar := finite_univ + bijOn := (finRotate n).bijective.bijOn_univ + single_orbit := by + intro i _ j _ + let : NeZero n := i.neZero + let k : Fin n := j - i + refine ⟨k.val, ?_⟩ + rw [← finCycle_eq_finRotate_iterate (k := k)] + change i + (j - i) = j + simpa only [add_sub_assoc] using add_sub_cancel_left i j + +private theorem finRotate_iterate_val {n : ℕ} (hn : 2 ≤ n) (i : Fin n) (k : ℕ) : + ((finRotate n)^[k] i).val = (i.val + k) % n := by + let : NeZero n := i.neZero + induction k with + | zero => simp only [Function.iterate_zero, id_eq, Nat.add_zero, Nat.mod_eq_of_lt i.isLt] + | succ k ih => + rw [Function.iterate_succ_apply', finRotate_apply, Fin.val_add, Fin.val_one', + Nat.mod_eq_of_lt (show 1 < n by omega), ih, Nat.mod_add_mod] + congr 1 + +/-- Before wrapping around, rotation has visited no index beyond its +current increasing interval. -/ +private theorem finCyclicPerm_firstHit_forward {n : ℕ} {i j k : Fin n} + (hij : i < j) (hk : k < i ∨ j < k) : + (finCyclicPerm n).FirstHitIn {i, j, k} i j := by + have hn : 2 ≤ n := by have := j.isLt; omega + refine ⟨j.val - i.val, by omega, ?_, Or.inr (Or.inl rfl), ?_⟩ + · apply Fin.ext + rw [show (finCyclicPerm n).toFun = finRotate n from rfl, finRotate_iterate_val hn] + have heq : i.val + (j.val - i.val) = j.val := by omega + rw [heq, Nat.mod_eq_of_lt j.isLt] + · intro r hr hrlt hmem + have hval := finRotate_iterate_val hn i r + have hsmall : i.val + r < n := by have := j.isLt; omega + rw [Nat.mod_eq_of_lt hsmall] at hval + change ((finRotate n)^[r] i) ∈ ({i, j, k} : Set (Fin n)) at hmem + rcases hmem with heq | heq | heq + · have he := congrArg Fin.val heq + omega + · have he := congrArg Fin.val heq + omega + · have he := congrArg Fin.val heq + rcases hk with hk | hk <;> omega + +private theorem finCyclicPerm_firstHit_wrap {n : ℕ} {i j k : Fin n} + (hij : i < j) (hjk : j < k) : + (finCyclicPerm n).FirstHitIn {i, j, k} k i := by + have hn : 2 ≤ n := by have := k.isLt; omega + refine ⟨n - k.val + i.val, by omega, ?_, Or.inl rfl, ?_⟩ + · apply Fin.ext + rw [show (finCyclicPerm n).toFun = finRotate n from rfl, finRotate_iterate_val hn] + have heq : k.val + (n - k.val + i.val) = n + i.val := by have := k.isLt; omega + rw [heq, Nat.add_mod, Nat.mod_self, Nat.zero_add, Nat.mod_eq_of_lt i.isLt] + exact Nat.mod_eq_of_lt i.isLt + · intro r hr hrlt hmem + have hval := finRotate_iterate_val hn k r + change ((finRotate n)^[r] k) ∈ ({i, j, k} : Set (Fin n)) at hmem + by_cases hsmall : k.val + r < n + · rw [Nat.mod_eq_of_lt hsmall] at hval + rcases hmem with heq | heq | heq <;> have he := congrArg Fin.val heq <;> omega + · have hge : n ≤ k.val + r := by omega + have hrem : k.val + r - n < n := by have := i.isLt; have := k.isLt; omega + rw [Nat.mod_eq_sub_mod hge, Nat.mod_eq_of_lt hrem] at hval + rcases hmem with heq | heq | heq <;> have he := congrArg Fin.val heq <;> omega + +private theorem finCyclicPerm_clockwise3_of_increasing {n : ℕ} {i j k : Fin n} + (hij : i < j) (hjk : j < k) : (finCyclicPerm n).IsClockwise3 i j k := by + rw [CyclicPerm.isClockwise3_iff] + have hSet : ({j, k, i} : Set (Fin n)) = {i, j, k} := by + ext x + simp only [mem_insert_iff, mem_singleton_iff] + tauto + refine ⟨ne_of_lt hij, ne_of_lt (hij.trans hjk), ne_of_lt hjk, + mem_univ _, mem_univ _, mem_univ _, finCyclicPerm_firstHit_forward hij (Or.inr hjk), ?_, + finCyclicPerm_firstHit_wrap hij hjk⟩ + simpa only [hSet] using finCyclicPerm_firstHit_forward hjk (Or.inl hij) + +/-- Clockwise triples for the finite rotation are precisely the three +cyclic rotations of an increasing triple. -/ +theorem finCyclicPerm_clockwise3_iff {n : ℕ} {i j k : Fin n} : + (finCyclicPerm n).IsClockwise3 i j k ↔ + (i < j ∧ j < k) ∨ (j < k ∧ k < i) ∨ (k < i ∧ i < j) := by + constructor + · intro hCW + have hNe := (CyclicPerm.isClockwise3_iff.mp hCW) + have hNoRev : ¬ (finCyclicPerm n).IsClockwise3 i k j := by + intro hRev + rcases (finCyclicPerm n).isClockwise3_trichotomy (mem_univ i) (mem_univ j) (mem_univ k) + hNe.1 hNe.2.1 hNe.2.2.1 with h | h + · exact h.2 hRev + · exact h.2 hCW + by_cases h₁ : i < j ∧ j < k + · exact Or.inl h₁ + by_cases h₂ : j < k ∧ k < i + · exact Or.inr (Or.inl h₂) + by_cases h₃ : k < i ∧ i < j + · exact Or.inr (Or.inr h₃) + have hRevOrder : (i < k ∧ k < j) ∨ (k < j ∧ j < i) ∨ (j < i ∧ i < k) := by + have hi := hNe.1 + have hj := hNe.2.1 + have hk := hNe.2.2.1 + omega + apply False.elim + apply hNoRev + rcases hRevOrder with h | h | h + · exact finCyclicPerm_clockwise3_of_increasing h.1 h.2 + · exact (finCyclicPerm n).isClockwise3_rotate + ((finCyclicPerm n).isClockwise3_rotate (finCyclicPerm_clockwise3_of_increasing h.1 h.2)) + · exact (finCyclicPerm n).isClockwise3_rotate (finCyclicPerm_clockwise3_of_increasing h.1 h.2) + · rintro (h | h | h) + · exact finCyclicPerm_clockwise3_of_increasing h.1 h.2 + · exact (finCyclicPerm n).isClockwise3_rotate + ((finCyclicPerm n).isClockwise3_rotate (finCyclicPerm_clockwise3_of_increasing h.1 h.2)) + · exact (finCyclicPerm n).isClockwise3_rotate (finCyclicPerm_clockwise3_of_increasing h.1 h.2) + +/-- Increasing angles spanning less than one turn realize the finite +rotation as the natural cyclic order of the boundary points. -/ +theorem finCyclicPerm_agrees_of_angles {S : Type*} [TopologicalSpace S] + {F : Set S} (φ : Circle ≃ₜ F) {n : ℕ} (hn : 0 < n) + (ν : Fin n → S) (τ : Fin n → ℝ) (hτ : StrictMono τ) + (hTurn : ∀ i, τ i < τ ⟨0, hn⟩ + 2 * Real.pi) + (hν : ∀ i, (φ (Circle.exp (τ i))).val = ν i) : + AgreesWithOArcHomeo ν (finCyclicPerm n) F φ := by + have hBase : ∀ i, τ ⟨0, hn⟩ ≤ τ i := fun i => + hτ.monotone (show (⟨0, hn⟩ : Fin n) ≤ i from Nat.zero_le i.val) + have hWrap : ∀ i j, τ i < τ j + 2 * Real.pi := by + intro i j + have hi := hTurn i + have hj := hBase j + linarith + have hPeriod : ∀ t : ℝ, Circle.exp (t + 2 * Real.pi) = Circle.exp t := by + intro t + rw [Circle.exp_add, Circle.exp_two_pi, mul_one] + have hνWrap : ∀ i, (φ (Circle.exp (τ i + 2 * Real.pi))).val = ν i := by + intro i + rw [hPeriod] + exact hν i + refine ⟨fun i _ => (hν i) ▸ (φ (Circle.exp (τ i))).property, ?_⟩ + intro i j k hCW + rcases finCyclicPerm_clockwise3_iff.mp hCW with h | h | h + · exact ⟨τ i, τ j, τ k, hτ h.1, hτ h.2, hWrap k i, hν i, hν j, hν k⟩ + · refine ⟨τ i, τ j + 2 * Real.pi, τ k + 2 * Real.pi, + hWrap i j, ?_, ?_, hν i, hνWrap j, hνWrap k⟩ + · linarith [hτ h.1] + · linarith [hτ h.2] + · refine ⟨τ i, τ j, τ k + 2 * Real.pi, hτ h.2, + hWrap j k, ?_, hν i, hν j, hνWrap k⟩ + linarith [hτ h.1] + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/FiniteDrawingUnion.lean b/LeanPool/GraphMinor/GM16/FiniteDrawingUnion.lean new file mode 100644 index 0000000000..38df852d05 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/FiniteDrawingUnion.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.PaintingCells +import LeanPool.GraphMinor.GM11.RadialBasics + +/-! +# Gluing a finite family of drawings + +The drawings meet only in a fixed finite vertex set, and every +point of that set on a drawing is one of its vertices. Start with +the drawing of the fixed vertices and glue the drawings one at a +time. The resulting support, vertices, and edges are exactly the +respective unions. This glues the replacing paths of the wall +subdivision in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface GM11 +universe u v + +/-- A finite family of drawings meeting only at common prescribed +vertices has a drawing with exactly the union support and edges. -/ +theorem exists_drawing_of_finite_drawings {S : Type u} + [TopologicalSpace S] [T2Space S] {ι : Type v} {I : Set ι} (hI : I.Finite) + {Z : Set S} (hZ : Z.Finite) (D : ι → Drawing S) + (hZMeet : ∀ i ∈ I, (D i).U ∩ Z ⊆ (D i).V) + (hMeet : ∀ i ∈ I, ∀ j ∈ I, i ≠ j → (D i).U ∩ (D j).U ⊆ Z) : + ∃ H : Drawing S, H.U = Z ∪ ⋃ i ∈ I, (D i).U ∧ + H.V = Z ∪ ⋃ i ∈ I, (D i).V ∧ H.E = ⋃ i ∈ I, (D i).E := by + classical + have key : ∀ T : Finset ι, (∀ i ∈ T, i ∈ I) → + ∃ H : Drawing S, H.U = Z ∪ ⋃ i ∈ T, (D i).U ∧ + H.V = Z ∪ ⋃ i ∈ T, (D i).V ∧ H.E = ⋃ i ∈ T, (D i).E := by + intro T + induction T using Finset.induction_on with + | empty => + intro _ + refine ⟨pointsDrawing hZ,by simp [pointsDrawing],by simp [pointsDrawing],?_⟩ + simp only [Finset.notMem_empty,iUnion_of_empty,iUnion_empty] + apply eq_empty_of_forall_notMem + rintro C ⟨⟨x,hx⟩,hSub,-⟩ + simpa [pointsDrawing] using hSub hx + | insert i T hiT ih => + intro hT + have hi := hT i (Finset.mem_insert_self _ _) + obtain ⟨H,hHU,hHV,hHE⟩ := ih (fun j hj => hT j (Finset.mem_insert_of_mem hj)) + have hGlue : H.U ∩ (D i).U ⊆ H.V ∩ (D i).V := by + rintro x ⟨hxH,hxi⟩ + have hxZ : x ∈ Z := by + rw [hHU] at hxH + rcases hxH with hxZ | hxOld + · exact hxZ + · obtain ⟨j,hj,hxj⟩ := mem_iUnion₂.mp hxOld + exact hMeet i hi j (hT j (Finset.mem_insert_of_mem hj)) + (fun he => hiT (he.symm ▸ hj)) ⟨hxi,hxj⟩ + exact ⟨hHV.symm ▸ Or.inl hxZ,hZMeet i hi ⟨hxi,hxZ⟩⟩ + refine ⟨H.glue (D i) hGlue,?_,?_,?_⟩ + · change H.U ∪ (D i).U = _ + rw [hHU,Finset.set_biUnion_insert,union_assoc, + union_comm (⋃ j ∈ T, (D j).U) ((D i).U)] + · change H.V ∪ (D i).V = _ + rw [hHV,Finset.set_biUnion_insert,union_assoc, + union_comm (⋃ j ∈ T, (D j).V) ((D i).V)] + · rw [Drawing.glue_E,hHE,Finset.set_biUnion_insert,union_comm] + obtain ⟨H,hU,hV,hE⟩ := key hI.toFinset (fun i hi => hI.mem_toFinset.mp hi) + exact ⟨H,by simpa only [hI.mem_toFinset] using hU, + by simpa only [hI.mem_toFinset] using hV,by simpa only [hI.mem_toFinset] using hE⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/FiniteLineDrawing.lean b/LeanPool/GraphMinor/GM16/FiniteLineDrawing.lean new file mode 100644 index 0000000000..d75ec6472e --- /dev/null +++ b/LeanPool/GraphMinor/GM16/FiniteLineDrawing.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM11.RadialBasics +import LeanPool.GraphMinor.GM11.PaintingCells + +/-! +# Drawings from finite families of lines + +To draw the wall and its subdivision in XVI (4.2), start with the +finite vertex set and add one line at a time. Distinct lines meet +only at prescribed vertices. Each addition is therefore a gluing of +drawings along vertices, and its open line is one new edge. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface GraphMinor.GM11 +universe u v + +/-- A finite family of lines meeting only at their prescribed endpoint +vertices gives a drawing with exactly those vertices and open edges. -/ +theorem exists_drawing_of_finite_lines + {S : Type u} [TopologicalSpace S] [T2Space S] {ι : Type v} + {I : Set ι} (hI : I.Finite) {Z : Set S} (hZ : Z.Finite) + (a b : ι → S) (L : ι → Set S) + (hLine : ∀ i ∈ I, IsLineWithEnds (L i) (a i) (b i)) + (hNe : ∀ i ∈ I, a i ≠ b i) + (hEnds : ∀ i ∈ I, L i ∩ Z = {a i,b i}) + (hMeet : ∀ i ∈ I, ∀ j ∈ I, i ≠ j → L i ∩ L j ⊆ Z) : + ∃ D : Drawing S, D.U = Z ∪ ⋃ i ∈ I, L i ∧ D.V = Z ∧ + D.E = (fun i => L i \ {a i,b i}) '' I := by + classical + have key : ∀ T : Finset ι, (∀ i ∈ T, i ∈ I) → + ∃ D : Drawing S, D.U = Z ∪ ⋃ i ∈ T, L i ∧ D.V = Z ∧ + D.E = (fun i => L i \ {a i,b i}) '' (T : Set ι) := by + intro T + induction T using Finset.induction_on with + | empty => + intro _ + refine ⟨pointsDrawing hZ, by simp [pointsDrawing], rfl, ?_⟩ + simp only [Finset.coe_empty, image_empty] + apply eq_empty_of_forall_notMem + rintro C ⟨⟨x,hx⟩,hSub,-⟩ + simpa [pointsDrawing] using hSub hx + | insert i T hiT ih => + intro hT + have hi := hT i (Finset.mem_insert_self _ _) + obtain ⟨D, hDU, hDV, hDE⟩ := ih fun j hj => hT j (Finset.mem_insert_of_mem hj) + have hPair : ({a i,b i} : Set S) ⊆ Z := by + intro x hx + have hx' : x ∈ L i ∩ Z := (hEnds i hi).symm ▸ hx + exact hx'.2 + have hGlue : D.U ∩ (lineDrawing (hLine i hi) (hNe i hi)).U ⊆ + D.V ∩ (lineDrawing (hLine i hi) (hNe i hi)).V := by + rintro x ⟨hxD, hxL⟩ + have hxZ : x ∈ Z := by + rw [hDU] at hxD + rcases hxD with hxZ | hxOld + · exact hxZ + · obtain ⟨j,hj,hxJ⟩ := mem_iUnion₂.mp hxOld + have hij : i ≠ j := fun heq => hiT (heq.symm ▸ hj) + exact hMeet i hi j (hT j (Finset.mem_insert_of_mem hj)) hij ⟨hxL,hxJ⟩ + refine ⟨hDV.symm ▸ hxZ, ?_⟩ + change x ∈ ({a i,b i} : Set S) + exact (hEnds i hi) ▸ (show x ∈ L i ∩ Z from ⟨hxL,hxZ⟩) + refine ⟨D.glue (lineDrawing (hLine i hi) (hNe i hi)) hGlue, ?_, ?_, ?_⟩ + · change D.U ∪ L i = _ + rw [hDU, Finset.set_biUnion_insert, union_assoc, + union_comm (⋃ j ∈ T, L j) (L i)] + · change D.V ∪ {a i,b i} = Z + rw [hDV] + exact union_eq_self_of_subset_right hPair + · rw [Drawing.glue_E, lineDrawing_E, hDE, Finset.coe_insert, image_insert_eq, + union_comm, singleton_union] + obtain ⟨D, hU, hV, hE⟩ := key hI.toFinset (fun i hi => hI.mem_toFinset.mp hi) + exact ⟨D, by simpa only [hI.mem_toFinset] using hU, hV, + by simpa only [hI.coe_toFinset] using hE⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/FiniteLineGraphDrawing.lean b/LeanPool/GraphMinor/GM16/FiniteLineGraphDrawing.lean new file mode 100644 index 0000000000..a4f7ee2910 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/FiniteLineGraphDrawing.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.FiniteLineDrawing +public import LeanPool.GraphMinor.Minor.Model +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# The graph carried by a finite family of lines + +The finite-line construction produces a topological drawing. Its +vertices are in bijection with the original graph vertices, and each +open line gives one edge. The endpoint conditions identify the ends +of these edges. This supplies an explicit graph isomorphism for the +wall and subdivision drawings in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology GraphMinor.Surface GraphMinor.GM11 +universe u v w + +/-- Draw a finite loopless graph from prescribed lines. The returned +isomorphism has the prescribed vertex map and edge closures. -/ +theorem exists_graphDrawing_of_finite_lines + {α : Type u} {β : Type v} {S : Type w} [TopologicalSpace S] [T2Space S] + (G : Graph α β) (hVG : V(G).Finite) (hEG : E(G).Finite) + (f : α → S) (hf : InjOn f V(G)) (L : β → Set S) + (hNoLoop : ∀ e v, ¬ G.IsLoopAt e v) + (hLine : ∀ e ∈ E(G), ∀ a b, G.IsLink e a b → IsLineWithEnds (L e) (f a) (f b)) + (hVertex : ∀ e ∈ E(G), ∀ v ∈ V(G), f v ∈ L e → G.Inc e v) + (hMeet : ∀ e ∈ E(G), ∀ d ∈ E(G), e ≠ d → L e ∩ L d ⊆ f '' V(G)) : + ∃ Γ : GraphDrawing G S, + Γ.drawing.V = f '' V(G) ∧ + (∀ v : V(G), (Γ.iso.vertexEquiv v).val = f v.val) ∧ + (∀ e : E(G), closure (Γ.iso.edgeEquiv e).val = L e.val) := by + classical + let : Finite E(G) := hEG.to_subtype + have hEndsExists (e : E(G)) : ∃ a b, G.IsLink e.val a b := + G.exists_isLink_of_mem_edgeSet e.property + choose a b hlink using hEndsExists + have hLe (e : E(G)) : IsLineWithEnds (L e.val) (f (a e)) (f (b e)) := + hLine e.val e.property (a e) (b e) (hlink e) + have hNe (e : E(G)) : f (a e) ≠ f (b e) := by + intro heq + have hab := hf (hlink e).left_mem (hlink e).right_mem heq + exact hNoLoop e.val (b e) (hab ▸ hlink e) + have hEnds (e : E(G)) : L e.val ∩ (f '' V(G)) = {f (a e),f (b e)} := by + apply Subset.antisymm + · rintro x ⟨hxL,v,hv,rfl⟩ + rcases (hVertex e.val e.property v hv hxL).eq_or_eq_of_isLink (hlink e) with heq | heq + · exact Or.inl (congrArg f heq) + · exact Or.inr (congrArg f heq) + · intro x hx + rcases hx with rfl | hx + · exact ⟨(hLe e).left_mem, mem_image_of_mem f (hlink e).left_mem⟩ + · rw [mem_singleton_iff] at hx + subst x + exact ⟨(hLe e).right_mem, mem_image_of_mem f (hlink e).right_mem⟩ + obtain ⟨D,hDU,hDV,hDE⟩ := exists_drawing_of_finite_lines + (Set.finite_univ : (Set.univ : Set E(G)).Finite) (hVG.image f) + (fun e : E(G) => f (a e)) (fun e : E(G) => f (b e)) (fun e : E(G) => L e.val) + (fun e _ => hLe e) (fun e _ => hNe e) (fun e _ => hEnds e) + (fun e _ d _ hne => hMeet e.val e.property d.val d.property (fun heq => hne (Subtype.ext heq))) + let openEdge : E(G) → Set S := fun e => L e.val \ {f (a e),f (b e)} + have hOpenInj : Function.Injective openEdge := by + intro e d heq + by_contra hne + obtain ⟨x,hx⟩ := (isPathConnected_sdiff_pair (hLe e)).nonempty + have hxd : x ∈ openEdge d := heq ▸ hx + have hxZ := hMeet e.val e.property d.val d.property + (fun heq => hne (Subtype.ext heq)) ⟨hx.1,hxd.1⟩ + exact hx.2 ((hEnds e) ▸ (show x ∈ L e.val ∩ f '' V(G) from ⟨hx.1,hxZ⟩)) + have hRange : D.E = range openEdge := by simpa only [image_univ] using hDE + let ev : V(G) ≃ D.V := (Equiv.Set.imageOfInjOn f V(G) hf).trans (Set.equivOfEq hDV.symm) + let ee : E(G) ≃ D.E := (Equiv.ofInjective openEdge hOpenInj).trans (Set.equivOfEq hRange.symm) + have hEV (v : V(G)) : (ev v).val = f v.val := rfl + have hEE (e : E(G)) : (ee e).val = openEdge e := rfl + have hCl (e : E(G)) : closure (openEdge e) = L e.val := closure_sdiff_pair (hLe e) + have hIso (e : E(G)) (u v : V(G)) : + G.IsLink e.val u.val v.val ↔ D.toGraph.IsLink (ee e).val (ev u).val (ev v).val := by + change G.IsLink e.val u.val v.val ↔ + (openEdge e ∈ D.E ∧ f u.val ∈ D.V ∧ f v.val ∈ D.V ∧ + closure (openEdge e) ∩ D.V = {f u.val,f v.val}) + have heD : openEdge e ∈ D.E := (ee e).property + have huD : f u.val ∈ D.V := (ev u).property + have hvD : f v.val ∈ D.V := (ev v).property + simp only [heD,huD,hvD,true_and] + rw [hCl,hDV,hEnds] + rw [(hlink e).isLink_iff, Set.pair_eq_pair_iff] + constructor + · rintro (⟨hu,hv⟩ | ⟨hv,hu⟩) + · exact Or.inl ⟨congrArg f hu,congrArg f hv⟩ + · exact Or.inr ⟨congrArg f hv,congrArg f hu⟩ + · rintro (⟨hu,hv⟩ | ⟨hv,hu⟩) + · exact Or.inl ⟨hf (hlink e).left_mem u.property hu,hf (hlink e).right_mem v.property hv⟩ + · exact Or.inr ⟨hf (hlink e).left_mem v.property hv,hf (hlink e).right_mem u.property hu⟩ + exact ⟨⟨D,⟨ev,ee,hIso⟩⟩,hDV,hEV,fun e => hCl e⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ForestMarked.lean b/LeanPool/GraphMinor/GM16/ForestMarked.lean new file mode 100644 index 0000000000..c1f4b9c3d9 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ForestMarked.lean @@ -0,0 +1,168 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.ForestPacking +import Mathlib.Combinatorics.SimpleGraph.Connectivity.Subgraph +import Mathlib.Order.Minimal + +/-! +# Marked paths and vertex covers in a forest + +For XVI (5.3), page 56, we apply the subtree packing theorem to paths +whose distinct ends are marked and whose internal vertices are unmarked. +Shortest paths to a specified set stop at their first meeting with it. +-/ + +@[expose] public section +namespace GraphMinor.GM16 + +open Set SimpleGraph +universe u + +/-- A path with distinct marked ends and no marked internal vertex, +as in the family of paths in the proof of XVI (5.3), page 56. -/ +structure MarkedPath {V : Type u} (G : SimpleGraph V) (Y : Set V) where + /-- The initial marked vertex. -/ + start : V + /-- The terminal marked vertex. -/ + finish : V + start_mem : start ∈ Y + finish_mem : finish ∈ Y + ne : start ≠ finish + /-- The graph path between the marked ends. -/ + path : G.Path start finish + marked : ∀ z ∈ path.val.support, z ∈ Y → z = start ∨ z = finish + +/-- A path from `a` to a set `X`, staying within a given set `U`, can +be chosen to meet `X` only at its last vertex. Choose one of minimum +length and shorten it at any earlier meeting. -/ +theorem exists_path_first_hit {V : Type u} {G : SimpleGraph V} {a b : V} + {X U : Set V} (p : G.Walk a b) (hb : b ∈ X) + (hU : ∀ z ∈ p.support, z ∈ U) : + ∃ x ∈ X, ∃ q : G.Path a x, + (∀ z ∈ q.val.support, z ∈ U) ∧ + ∀ z ∈ q.val.support, z ∈ X → z = x := by + classical + let P : (Σ x, G.Path a x) → Prop := fun q => + q.1 ∈ X ∧ ∀ z ∈ q.2.val.support, z ∈ U + obtain ⟨q, hq⟩ := exists_minimalFor_of_wellFoundedLT P + (fun q => q.2.val.length) + ⟨⟨b, p.toPath⟩, hb, fun z hz => hU z (p.support_toPath_subset_support hz)⟩ + refine ⟨q.1, hq.1.1, q.2, hq.1.2, ?_⟩ + intro z hz hzX + by_contra hne + let r : G.Path a z := ⟨q.2.val.takeUntil z hz, q.2.isPath.takeUntil hz⟩ + have hr : P ⟨z, r⟩ := + ⟨hzX, fun w hw => hq.1.2 w (q.2.val.support_takeUntil_subset_support hz hw)⟩ + have hlt : r.val.length < q.2.val.length := Walk.length_takeUntil_lt_length hz hne + have hle := hq.2 hr hlt.le + change q.2.val.length ≤ r.val.length at hle + omega + +/-- A walk between two different marked vertices contains a marked path. +This is also why a cover of marked paths meets every walk between +different marked vertices. -/ +theorem exists_markedPath_in_walk {V : Type u} {G : SimpleGraph V} {Y : Set V} + {a b : V} (p : G.Walk a b) (ha : a ∈ Y) (hb : b ∈ Y) (hne : a ≠ b) : + ∃ q : MarkedPath G Y, ∀ z ∈ q.path.val.support, z ∈ p.support := by + obtain ⟨z, ⟨hzY, hza⟩, q, hsub, hhit⟩ := + exists_path_first_hit (X := Y \ {a}) (U := {z | z ∈ p.support}) p + ⟨hb, by simpa using hne.symm⟩ (fun _ h => h) + refine ⟨⟨a, z, ha, hzY, ?_, q, ?_⟩, hsub⟩ + · exact fun h => hza (mem_singleton_iff.mpr h.symm) + · intro w hw hwY + by_cases hwa : w = a + · exact Or.inl hwa + · exact Or.inr (hhit w hw ⟨hwY, by simpa using hwa⟩) + +/-- The vertices of a walk form a nonempty connected set. -/ +theorem walk_isSubtreeSet {V : Type u} {G : SimpleGraph V} {a b : V} + (p : G.Walk a b) : IsSubtreeSet G {z | z ∈ p.support} := by + classical + refine ⟨⟨a, p.start_mem_support⟩, ?_⟩ + intro x hx y hy + let q := (p.takeUntil x hx).reverse.append (p.takeUntil y hy) + refine ⟨q.toPath.val, q.toPath.isPath, ?_⟩ + intro z hz + have hzq := q.support_toPath_subset_support hz + change z ∈ ((p.takeUntil x hx).reverse.append (p.takeUntil y hy)).support at hzq + rw [Walk.mem_support_append_iff, Walk.support_reverse, List.mem_reverse] at hzq + rcases hzq with hzq | hzq + · exact p.support_takeUntil_subset_support hx hzq + · exact p.support_takeUntil_subset_support hy hzq + +/-- A cover of the marked paths meets every walk with distinct marked +ends. Apply the cover to a marked subpath of the walk. -/ +theorem marked_cover_meets_walk {V : Type u} {G : SimpleGraph V} {Y X : Set V} + (hX : ∀ q : MarkedPath G Y, ∃ x ∈ X, x ∈ q.path.val.support) + {a b : V} (p : G.Walk a b) (ha : a ∈ Y) (hb : b ∈ Y) (hne : a ≠ b) : + ∃ x ∈ X, x ∈ p.support := by + obtain ⟨q, hsub⟩ := exists_markedPath_in_walk p ha hb hne + obtain ⟨x, hxX, hxq⟩ := hX q + exact ⟨x, hxX, hsub x hxq⟩ + +/-- A strict initial segment of a path that first meets `X` at its +last vertex avoids `X`. -/ +theorem first_hit_prefix_avoids {V : Type u} [DecidableEq V] {G : SimpleGraph V} {X : Set V} + {a x z : V} (p : G.Path a x) + (hfirst : ∀ w ∈ p.val.support, w ∈ X → w = x) + (hz : z ∈ p.val.support) (hzx : z ≠ x) : + ∀ w ∈ (p.val.takeUntil z hz).support, w ∉ X := by + intro w hw hwX + have hwx := hfirst w (p.val.support_takeUntil_subset_support hz hw) hwX + subst w + exact Walk.endpoint_notMem_support_takeUntil p.isPath hz hzx.symm hw + +/-- In the proof of XVI (5.3), a first-hit path from a marked vertex +to the cover has no marked internal vertex. An earlier marked vertex +would give a marked-to-marked walk avoiding the cover. -/ +theorem first_hit_path_marked_only_at_ends + {V : Type u} {G : SimpleGraph V} {Y X : Set V} + (hX : ∀ q : MarkedPath G Y, ∃ x ∈ X, x ∈ q.path.val.support) + {a x : V} (ha : a ∈ Y) (p : G.Path a x) + (hfirst : ∀ w ∈ p.val.support, w ∈ X → w = x) : + ∀ z ∈ p.val.support, z ∈ Y → z = a ∨ z = x := by + classical + intro z hz hzY + by_cases hza : z = a + · exact Or.inl hza + · by_cases hzx : z = x + · exact Or.inr hzx + · obtain ⟨w, hwX, hw⟩ := marked_cover_meets_walk hX + (p.val.takeUntil z hz) ha hzY (Ne.symm hza) + exact False.elim (first_hit_prefix_avoids p hfirst hz hzx w hw hwX) + +/-- The first-hit paths assigned to the same cover vertex meet only at +that vertex, as in XVI (5.3), page 56. A different meeting would join +their marked starts by a walk avoiding the cover. -/ +theorem first_hit_paths_inter_eq + {V : Type u} {G : SimpleGraph V} {Y X : Set V} + (hX : ∀ q : MarkedPath G Y, ∃ x ∈ X, x ∈ q.path.val.support) + {a b x : V} (ha : a ∈ Y) (hb : b ∈ Y) (hab : a ≠ b) + (p : G.Path a x) (q : G.Path b x) + (hp : ∀ w ∈ p.val.support, w ∈ X → w = x) + (hq : ∀ w ∈ q.val.support, w ∈ X → w = x) : + {z | z ∈ p.val.support} ∩ {z | z ∈ q.val.support} = {x} := by + classical + apply Set.Subset.antisymm + · rintro z ⟨hzp, hzq⟩ + apply mem_singleton_iff.mpr + by_contra hzx + let r := (p.val.takeUntil z hzp).append (q.val.takeUntil z hzq).reverse + obtain ⟨w, hwX, hw⟩ := marked_cover_meets_walk hX r ha hb hab + change w ∈ ((p.val.takeUntil z hzp).append (q.val.takeUntil z hzq).reverse).support at hw + rw [Walk.mem_support_append_iff, Walk.support_reverse, List.mem_reverse] at hw + rcases hw with hw | hw + · exact first_hit_prefix_avoids p hp hzp hzx w hw hwX + · exact first_hit_prefix_avoids q hq hzq hzx w hw hwX + · rintro z rfl + exact ⟨p.val.end_mem_support, q.val.end_mem_support⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ForestPacking.lean b/LeanPool/GraphMinor/GM16/ForestPacking.lean new file mode 100644 index 0000000000..61193322d5 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ForestPacking.lean @@ -0,0 +1,238 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Combinatorics.SimpleGraph.Acyclic +import Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected +import Mathlib.Combinatorics.SimpleGraph.Walk.Maps +import Mathlib.Data.Finset.Card + +/-! +# Packing subtrees of a forest + +The proof of XVI (5.3), page 56, uses the packing and covering theorem for +subtrees of a forest. We prove it by removing a leaf. If the family contains +the singleton leaf, choose it and cover it by that leaf. Otherwise remove +the leaf from every member. Two members containing the leaf also contain +its only neighbor, so removing it preserves disjointness. +-/ + +public section +namespace GraphMinor.GM16 + +open Set SimpleGraph + +universe u v + +/-- A nonempty connected vertex set, representing a subtree in the forest +argument of Graph Minors XVI, (5.3), page 56. Connectivity is expressed by +paths whose vertices stay in the set. -/ +@[expose] def IsSubtreeSet {V : Type u} (G : SimpleGraph V) (A : Set V) : Prop := + A.Nonempty ∧ ∀ a ∈ A, ∀ b ∈ A, + ∃ p : G.Walk a b, p.IsPath ∧ ∀ x ∈ p.support, x ∈ A + +/-- A finite nonempty forest has a vertex with at most one neighbor. +An end of a longest path has this property: a further neighbor either +extends the path or contradicts uniqueness of paths in a forest. -/ +theorem exists_leaf_of_finite_forest {V : Type u} [Finite V] [Nonempty V] + {G : SimpleGraph V} (hG : G.IsAcyclic) : + ∃ x, (G.neighborSet x).Subsingleton := by + classical + obtain ⟨a, b, p, hp, hmax⟩ := Walk.exists_isPath_forall_isPath_length_le_length G + refine ⟨a, ?_⟩ + have hneighbor : ∀ x, G.Adj a x → x = p.snd := by + intro x hx + by_cases hxp : x ∈ p.support + · exact hG.eq_snd_of_adj_start hp hx hxp + · have hlong := hmax x b (p.cons hx.symm) (hp.cons hxp) + simp only [Walk.length_cons] at hlong + omega + intro x hx y hy + exact (hneighbor x hx).trans (hneighbor y hy).symm + +/-- Removing a leaf preserves a nonempty connected set unless that set +is the singleton leaf. Paths between the remaining vertices cannot visit +the deleted leaf. -/ +theorem IsSubtreeSet.remove_leaf {V : Type u} {G : SimpleGraph V} {A : Set V} + (hA : IsSubtreeSet G A) {x : V} (hx : (G.neighborSet x).Subsingleton) + (hne : A ≠ {x}) : + IsSubtreeSet (G.induce {x}ᶜ) {a | a.val ∈ A} := by + classical + constructor + · obtain ⟨a, ha⟩ := hA.1 + by_cases hax : a = x + · subst a + have hex : ∃ b ∈ A, b ≠ x := by + by_contra h + apply hne + apply Set.Subset.antisymm + · intro b hb + by_contra hbx + exact h ⟨b, hb, fun he => hbx (mem_singleton_iff.mpr he)⟩ + · exact singleton_subset_iff.mpr ha + obtain ⟨b, hb, hbx⟩ := hex + exact ⟨⟨b, hbx⟩, hb⟩ + · exact ⟨⟨a, hax⟩, ha⟩ + · intro a ha b hb + obtain ⟨p, hp, hsupport⟩ := hA.2 a.val ha b.val hb + have havoid : ∀ z ∈ p.support, z ∈ ({x}ᶜ : Set V) := by + intro z hz hzx + have hzx' : z = x := mem_singleton_iff.mp hzx + subst z + exact hp.isTrail.notMem_support_of_subsingleton_neighborSet + (fun h => a.property (mem_singleton_iff.mpr h.symm)) + (fun h => b.property (mem_singleton_iff.mpr h.symm)) hx hz + refine ⟨p.induce {x}ᶜ havoid, ?_, ?_⟩ + · apply Walk.IsPath.of_map (f := (Embedding.induce {x}ᶜ).toHom) + simpa using hp + · intro z hz + rw [Walk.support_induce] at hz + obtain ⟨w, hw, hzw⟩ := List.mem_pmap.mp hz + have hval := congrArg Subtype.val hzw + change z.val ∈ A + exact hval ▸ hsupport w hw + +/-- A connected set containing a leaf and another vertex contains a +neighbor of the leaf. -/ +theorem IsSubtreeSet.exists_neighbor {V : Type u} {G : SimpleGraph V} {A : Set V} + (hA : IsSubtreeSet G A) {x : V} (hx : x ∈ A) (hne : A ≠ {x}) : + ∃ y ∈ A, G.Adj x y := by + classical + have hex : ∃ b ∈ A, b ≠ x := by + by_contra h + apply hne + apply Set.Subset.antisymm + · intro b hb + by_contra hbx + exact h ⟨b, hb, fun he => hbx (mem_singleton_iff.mpr he)⟩ + · exact singleton_subset_iff.mpr hx + obtain ⟨b, hb, hbx⟩ := hex + obtain ⟨p, _, hsupport⟩ := hA.2 x hx b hb + have hn : ¬p.Nil := Walk.not_nil_of_ne hbx.symm + exact ⟨p.snd, hsupport _ (p.getVert_mem_support 1), p.adj_snd hn⟩ + +/-- For two nonsingleton subtrees, deleting a leaf preserves +vertex-disjointness. If they both contain the leaf, they both contain its +unique neighbor. -/ +theorem disjoint_of_disjoint_remove_leaf + {V : Type u} {G : SimpleGraph V} {A B : Set V} {x : V} + (hA : IsSubtreeSet G A) (hB : IsSubtreeSet G B) + (hx : (G.neighborSet x).Subsingleton) (hAx : A ≠ {x}) (hBx : B ≠ {x}) + (hd : Disjoint {a : ({x}ᶜ : Set V) | a.val ∈ A} + {a : ({x}ᶜ : Set V) | a.val ∈ B}) : Disjoint A B := by + apply Set.disjoint_left.mpr + intro z hzA hzB + by_cases hzx : z = x + · subst z + obtain ⟨a, ha, hxa⟩ := hA.exists_neighbor hzA hAx + obtain ⟨b, hb, hxb⟩ := hB.exists_neighbor hzB hBx + have hab : a = b := hx hxa hxb + have hbA : b ∈ A := hab ▸ ha + exact (Set.disjoint_left.mp hd) + (show (⟨b, by simpa using hxb.ne.symm⟩ : ({x}ᶜ : Set V)).val ∈ A from hbA) hb + · exact (Set.disjoint_left.mp hd) + (show (⟨z, by simpa using hzx⟩ : ({x}ᶜ : Set V)).val ∈ A from hzA) hzB + +private theorem forest_packing_cover_aux (n : ℕ) : + ∀ {V : Type u} [Fintype V], Fintype.card V = n → + ∀ {ι : Type v} (G : SimpleGraph V) (A : ι → Set V), + G.IsAcyclic → (∀ i, IsSubtreeSet G (A i)) → + ∃ (I : Finset ι) (X : Finset V), X.card = I.card ∧ + (∀ i ∈ I, ∀ j ∈ I, i ≠ j → Disjoint (A i) (A j)) ∧ + ∀ i, ∃ x ∈ X, x ∈ A i := by + classical + induction n using Nat.strong_induction_on with + | ind n ih => + intro V _ hn ι G A hG hA + by_cases hnon : Nonempty V + · let := hnon + obtain ⟨x, hx⟩ := exists_leaf_of_finite_forest hG + let W := ({x}ᶜ : Set V) + let : Fintype W := Fintype.ofFinite W + have hcard : Fintype.card W < n := by + rw [← hn] + exact Fintype.card_subtype_lt (x := x) (by simp [W]) + let eV : W ↪ V := ⟨Subtype.val, Subtype.val_injective⟩ + have hnotX : ∀ X : Finset W, x ∉ X.map eV := by + intro X hmem + obtain ⟨y, _, hy⟩ := Finset.mem_map.mp hmem + exact y.property (mem_singleton_iff.mpr hy) + by_cases hsing : ∃ i, A i = {x} + · obtain ⟨i₀, hi₀⟩ := hsing + let J := {i : ι // x ∉ A i} + let eI : J ↪ ι := ⟨Subtype.val, Subtype.val_injective⟩ + have hJ : ∀ j : J, A j.val ≠ {x} := by + intro j h + exact j.property (h ▸ mem_singleton x) + obtain ⟨I, X, hsize, hdisj, hcover⟩ := + ih (Fintype.card W) hcard rfl (G.induce W) + (fun j : J => {w | w.val ∈ A j.val}) + (hG.induce W) (fun j => (hA j.val).remove_leaf hx (hJ j)) + have hnotI : i₀ ∉ I.map eI := by + intro hmem + obtain ⟨j, _, hj⟩ := Finset.mem_map.mp hmem + have hj₀ : j.val = i₀ := hj + exact j.property (hj₀.symm ▸ (hi₀ ▸ mem_singleton x)) + refine ⟨insert i₀ (I.map eI), insert x (X.map eV), ?_, ?_, ?_⟩ + · rw [Finset.card_insert_of_notMem (hnotX X), + Finset.card_insert_of_notMem hnotI, Finset.card_map, Finset.card_map, hsize] + · intro i hi j hj hij + rcases Finset.mem_insert.mp hi with rfl | hi + · obtain ⟨j, hj, rfl⟩ := Finset.mem_map.mp + ((Finset.mem_insert.mp hj).resolve_left (Ne.symm hij)) + rw [hi₀, disjoint_singleton_left] + exact j.property + · obtain ⟨i, hiI, rfl⟩ := Finset.mem_map.mp hi + rcases Finset.mem_insert.mp hj with rfl | hj + · rw [hi₀, disjoint_singleton_right] + exact i.property + · obtain ⟨j, hjI, rfl⟩ := Finset.mem_map.mp hj + apply disjoint_of_disjoint_remove_leaf (hA i.val) (hA j.val) hx (hJ i) (hJ j) + exact hdisj i hiI j hjI (fun h => hij (congrArg Subtype.val h)) + · intro i + by_cases hxi : x ∈ A i + · exact ⟨x, Finset.mem_insert_self _ _, hxi⟩ + · obtain ⟨w, hw, hwA⟩ := hcover ⟨i, hxi⟩ + exact ⟨w.val, Finset.mem_insert_of_mem (Finset.mem_map.mpr ⟨w, hw, rfl⟩), hwA⟩ + · have hne : ∀ i, A i ≠ {x} := by + intro i hi + exact hsing ⟨i, hi⟩ + obtain ⟨I, X, hsize, hdisj, hcover⟩ := + ih (Fintype.card W) hcard rfl (G.induce W) + (fun i : ι => {w | w.val ∈ A i}) + (hG.induce W) (fun i => (hA i).remove_leaf hx (hne i)) + refine ⟨I, X.map eV, ?_, ?_, ?_⟩ + · rw [Finset.card_map, hsize] + · intro i hi j hj hij + exact disjoint_of_disjoint_remove_leaf (hA i) (hA j) hx (hne i) (hne j) + (hdisj i hi j hj hij) + · intro i + obtain ⟨w, hw, hwA⟩ := hcover i + exact ⟨w.val, Finset.mem_map.mpr ⟨w, hw, rfl⟩, hwA⟩ + · refine ⟨∅, ∅, rfl, ?_, ?_⟩ + · intro i hi + exact False.elim (Finset.notMem_empty i hi) + · intro i + obtain ⟨x, _⟩ := (hA i).1 + exact False.elim (hnon ⟨x⟩) + +/-- The elementary subtree packing theorem used in Graph Minors XVI, +proof of (5.3), page 56. A family of nonempty subtrees of a finite forest +has a disjoint subfamily and a vertex cover of the same size. -/ +theorem forest_packing_cover {V : Type u} [Finite V] {ι : Type v} + (G : SimpleGraph V) (A : ι → Set V) + (hG : G.IsAcyclic) (hA : ∀ i, IsSubtreeSet G (A i)) : + ∃ (I : Finset ι) (X : Finset V), X.card = I.card ∧ + (∀ i ∈ I, ∀ j ∈ I, i ≠ j → Disjoint (A i) (A j)) ∧ + ∀ i, ∃ x ∈ X, x ∈ A i := by + classical + let := Fintype.ofFinite V + exact forest_packing_cover_aux (Fintype.card V) rfl G A hG hA + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/GraphDrawingControlledTangle.lean b/LeanPool/GraphMinor/GM16/GraphDrawingControlledTangle.lean new file mode 100644 index 0000000000..1e5725735f --- /dev/null +++ b/LeanPool/GraphMinor/GM16/GraphDrawingControlledTangle.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM10.Defs2 +import LeanPool.GraphMinor.GM16.GraphDrawingSpanEmbedding +import LeanPool.GraphMinor.GM16.GraphDrawingForwardMaps +import LeanPool.GraphMinor.GM16.ControlFromInducedTangle +import LeanPool.GraphMinor.GM16.GraphIsoImage +import LeanPool.GraphMinor.GM16.HypergraphSupportedTangle +import LeanPool.GraphMinor.GM16.DrawingSkeletonPaths + +/-! +# A controlled tangle on a drawn subgraph + +Transport the subgraph tangle through the graph drawing's +isomorphism, using maps injective only on actual names. Invert +the same isomorphism to obtain the span embedding. The forward +and inverse edge maps cancel on the subgraph edges, so conformity +of the induced tangle gives the control condition. This supplies +the controlled drawing tangle for the sphere span in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Hypergraph Surface GM10 GM14 GM15 +universe u v w + +/-- A conformal subgraph tangle transfers to a controlled tangle +in any graph drawing of that subgraph. -/ +theorem exists_controlled_drawing_tangle + {α : Type u} {β : Type v} [Nonempty α] [Nonempty β] + {S : Type w} [TopologicalSpace S] [Nonempty S] + {G N : Graph α β} {θstar θ : ℕ} {Tstar : Set (Hypergraph α β × Hypergraph α β)} + (hTstar : IsGraphTangle G θstar Tstar) (hθ : θ ≤ θstar) (hNG : N ≤ G) + (hVN : V(N).Finite) (hEN : E(N).Finite) + (Γ : GraphDrawing N S) (TN : Set (Hypergraph α β × Hypergraph α β)) + (hTN : IsTangle (Hypergraph.ofGraph N hVN hEN) θ TN) + (hConformal : inducedTangle (Hypergraph.ofGraph G hTstar.finite_V hTstar.finite_E) + (Hypergraph.ofGraph N hVN hEN) TN θ ⊆ Tstar) : + ∃ (η : SpanEmbedding Γ.drawing G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))), + η.imageGraph=N ∧ IsControllingTangle G Γ.drawing η θstar θ Tstar T := by + obtain ⟨η,hImage,hηV,hηE⟩ := exists_spanEmbedding_of_graphDrawing hNG Γ + obtain ⟨f,g,hf,hg,hfInj,hgInj⟩ := exists_graphDrawing_forward_maps Γ + have hHyp : imageHypergraph f g (Hypergraph.ofGraph N hVN hEN)=Γ.drawing.toHypergraph := + (imageHypergraph_of_iso hVN hEN Γ.drawing.finite_V Γ.drawing.finite_edges Γ.iso f g + (fun x => (hf x).symm) (fun e => (hg e).symm)).trans (drawing_ofGraph_toGraph Γ.drawing) + have hTD : IsTangle Γ.drawing.toHypergraph θ (imageHypergraphTangle f g TN) := by + rw [← hHyp] + exact isTangle_imageHypergraphTangle_on f g hfInj hgInj hTN + have hInv : LeftInvOn η.eMap g E(N) := by + intro e he + rw [hg ⟨e,he⟩,hηE (Γ.iso.edgeEquiv ⟨e,he⟩)] + exact congrArg Subtype.val (Γ.iso.edgeEquiv.symm_apply_apply ⟨e,he⟩) + exact ⟨η,imageHypergraphTangle f g TN,hImage, + controllingTangle_of_induced_subset η hImage hTstar hθ hVN hEN TN hTN f g hInv hTD hConformal⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/GraphDrawingForwardMaps.lean b/LeanPool/GraphMinor/GM16/GraphDrawingForwardMaps.lean new file mode 100644 index 0000000000..2242720f4e --- /dev/null +++ b/LeanPool/GraphMinor/GM16/GraphDrawingForwardMaps.lean @@ -0,0 +1,51 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs + +/-! +# Extending the forward maps of a graph drawing + +A graph drawing gives bijections only on actual vertices and +edges. Extend the maps off those sets with harmless default +values. On their supports they retain the isomorphism values +and are injective. This permits the tangle relabelling at the +end of XVI (4.2), without assuming injectivity on unused names. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Surface +universe u v w + +/-- The forward vertex and edge maps of a graph drawing extend to +all names and are injective on the actual graph support. -/ +theorem exists_graphDrawing_forward_maps {α : Type u} {β : Type v} + {S : Type w} [TopologicalSpace S] [Nonempty S] {N : Graph α β} + (Γ : GraphDrawing N S) : + ∃ (f : α → S) (g : β → Set S), + (∀ x : V(N), f x.val=(Γ.iso.vertexEquiv x).val) ∧ + (∀ e : E(N), g e.val=(Γ.iso.edgeEquiv e).val) ∧ InjOn f V(N) ∧ InjOn g E(N) := by + classical + let f : α → S := fun x => if hx : x ∈ V(N) then + (Γ.iso.vertexEquiv ⟨x,hx⟩).val else Classical.choice ‹Nonempty S› + let g : β → Set S := fun e => if he : e ∈ E(N) then + (Γ.iso.edgeEquiv ⟨e,he⟩).val else ∅ + have hf (x : V(N)) : f x.val=(Γ.iso.vertexEquiv x).val := dite_eq_left x.property + have hg (e : E(N)) : g e.val=(Γ.iso.edgeEquiv e).val := dite_eq_left e.property + refine ⟨f,g,hf,hg,?_,?_⟩ + · intro x hx y hy he + rw [hf ⟨x,hx⟩,hf ⟨y,hy⟩] at he + exact congrArg Subtype.val (Γ.iso.vertexEquiv.injective (Subtype.ext he)) + · intro e he f hf hef + rw [hg ⟨e,he⟩,hg ⟨f,hf⟩] at hef + exact congrArg Subtype.val (Γ.iso.edgeEquiv.injective (Subtype.ext hef)) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/GraphDrawingSpanEmbedding.lean b/LeanPool/GraphMinor/GM16/GraphDrawingSpanEmbedding.lean new file mode 100644 index 0000000000..452e6d50d2 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/GraphDrawingSpanEmbedding.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM16.GraphIsoEdgeEnds + +/-! +# A drawing isomorphism gives a span embedding + +Invert the vertex and edge equivalences of a drawing of a +subgraph. Extend these maps arbitrarily off the actual vertices +and edges. Their bijections and incidence preservation give the +span embedding, whose image is exactly the original subgraph. +This identifies the drawn subdivision as a subgraph of the +original graph at the end of XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology Surface GM14 +universe u v w + +private theorem drawing_inc_iff_of_mem {S : Type w} [TopologicalSpace S] + {D : Drawing S} {e : Set S} (he : e ∈ D.E) {x : S} (hx : x ∈ D.V) : + D.toGraph.Inc e x ↔ x ∈ closure e := by + obtain ⟨a,b,hLink⟩ := D.toGraph.exists_isLink_of_mem_edgeSet he + constructor + · rintro ⟨y,hy⟩ + have hxPair : x ∈ closure e ∩ D.V := hy.2.2.2.symm ▸ mem_insert x {y} + exact hxPair.1 + · intro hxCl + have hxPair : x ∈ ({a,b} : Set S) := hLink.2.2.2 ▸ ⟨hxCl,hx⟩ + rcases hxPair with h | h + · exact ⟨b,h.symm ▸ hLink⟩ + · rw [mem_singleton_iff] at h + exact ⟨a,h.symm ▸ hLink.symm⟩ + +/-- A graph drawing of a subgraph gives a span embedding with exactly +that image graph and the inverse isomorphism maps on its support. -/ +theorem exists_spanEmbedding_of_graphDrawing + {α : Type u} {β : Type v} [Nonempty α] [Nonempty β] + {S : Type w} [TopologicalSpace S] {N G : Graph α β} (hNG : N ≤ G) + (Γ : GraphDrawing N S) : + ∃ η : SpanEmbedding Γ.drawing G, η.imageGraph=N ∧ + (∀ x : Γ.drawing.V, η.vMap x.val=(Γ.iso.vertexEquiv.symm x).val) ∧ + (∀ e : Γ.drawing.E, η.eMap e.val=(Γ.iso.edgeEquiv.symm e).val) := by + classical + let vm : S → α := fun x => if hx : x ∈ Γ.drawing.V then + (Γ.iso.vertexEquiv.symm ⟨x,hx⟩).val else Classical.choice ‹Nonempty α› + let em : Set S → β := fun e => if he : e ∈ Γ.drawing.E then + (Γ.iso.edgeEquiv.symm ⟨e,he⟩).val else Classical.choice ‹Nonempty β› + have hv (x : Γ.drawing.V) : vm x.val=(Γ.iso.vertexEquiv.symm x).val := dite_eq_left x.property + have he (e : Γ.drawing.E) : em e.val=(Γ.iso.edgeEquiv.symm e).val := dite_eq_left e.property + have hVBij : BijOn vm Γ.drawing.V V(N) := by + refine ⟨?_,?_,?_⟩ + · intro x hx + rw [hv ⟨x,hx⟩] + exact (Γ.iso.vertexEquiv.symm ⟨x,hx⟩).property + · intro x hx y hy hxy + rw [hv ⟨x,hx⟩,hv ⟨y,hy⟩] at hxy + exact congrArg Subtype.val (Γ.iso.vertexEquiv.symm.injective (Subtype.ext hxy)) + · intro x hx + let y := Γ.iso.vertexEquiv ⟨x,hx⟩ + refine ⟨y.val,y.property,?_⟩ + rw [hv y] + exact congrArg Subtype.val (Γ.iso.vertexEquiv.symm_apply_apply ⟨x,hx⟩) + have hEBij : BijOn em Γ.drawing.E E(N) := by + refine ⟨?_,?_,?_⟩ + · intro e he₀ + rw [he ⟨e,he₀⟩] + exact (Γ.iso.edgeEquiv.symm ⟨e,he₀⟩).property + · intro e he₀ f hf hef + rw [he ⟨e,he₀⟩,he ⟨f,hf⟩] at hef + exact congrArg Subtype.val (Γ.iso.edgeEquiv.symm.injective (Subtype.ext hef)) + · intro e he₀ + let f := Γ.iso.edgeEquiv ⟨e,he₀⟩ + refine ⟨f.val,f.property,?_⟩ + rw [he f] + exact congrArg Subtype.val (Γ.iso.edgeEquiv.symm_apply_apply ⟨e,he₀⟩) + have hInc (e : Set S) (he₀ : e ∈ Γ.drawing.E) (x : S) (hx : x ∈ Γ.drawing.V) : + N.Inc (em e) (vm x) ↔ x ∈ closure e := by + rw [he ⟨e,he₀⟩,hv ⟨x,hx⟩] + have h := graphIso_inc_iff Γ.iso (Γ.iso.edgeEquiv.symm ⟨e,he₀⟩) + (Γ.iso.vertexEquiv.symm ⟨x,hx⟩) + simp only [Equiv.apply_symm_apply] at h + exact h.trans (drawing_inc_iff_of_mem he₀ hx) + exact ⟨⟨N,vm,em,hNG,hVBij,hEBij,hInc⟩,rfl,hv,he⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/GraphIsoEdgeEnds.lean b/LeanPool/GraphMinor/GM16/GraphIsoEdgeEnds.lean new file mode 100644 index 0000000000..d56fccf171 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/GraphIsoEdgeEnds.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Statement + +/-! +# Isomorphisms specified by one pair of ends per edge + +Bijections on vertices and edges form a graph isomorphism when +one pair of ends for each edge is preserved. Any other pair is +that pair or its reverse. This supplies the isomorphism check +when paths are matched by their ordered vertex and edge lists. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph +universe u v u' v' + +/-- Preserving one pair of ends per edge under bijections preserves +all links in both directions. -/ +theorem isLink_iff_of_edge_ends {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + {P : Graph α β} {Q : Graph α' β'} (fv : V(P) ≃ V(Q)) (fe : E(P) ≃ E(Q)) + (hEnds : ∀ e : E(P), ∃ x y : V(P), P.IsLink e.val x.val y.val ∧ + Q.IsLink (fe e).val (fv x).val (fv y).val) + (e : E(P)) (x y : V(P)) : + P.IsLink e.val x.val y.val ↔ Q.IsLink (fe e).val (fv x).val (fv y).val := by + obtain ⟨a,b,hP,hQ⟩ := hEnds e + constructor + · intro h + rcases h.eq_and_eq_or_eq_and_eq hP with ⟨hx,hy⟩ | ⟨hx,hy⟩ + · have hx' : x=a := Subtype.ext hx + have hy' : y=b := Subtype.ext hy + subst x y + exact hQ + · have hx' : x=b := Subtype.ext hx + have hy' : y=a := Subtype.ext hy + subst x y + exact hQ.symm + · intro h + rcases h.eq_and_eq_or_eq_and_eq hQ with ⟨hx,hy⟩ | ⟨hx,hy⟩ + · have hx' : x=a := fv.injective (Subtype.ext hx) + have hy' : y=b := fv.injective (Subtype.ext hy) + subst x y + exact hP + · have hx' : x=b := fv.injective (Subtype.ext hx) + have hy' : y=a := fv.injective (Subtype.ext hy) + subst x y + exact hP.symm + +/-- A graph isomorphism preserves incidence on its actual edges and vertices. -/ +theorem graphIso_inc_iff {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + {P : Graph α β} {Q : Graph α' β'} (φ : Iso P Q) (e : E(P)) (x : V(P)) : + P.Inc e.val x.val ↔ Q.Inc (φ.edgeEquiv e).val (φ.vertexEquiv x).val := by + constructor + · rintro ⟨y,hLink⟩ + exact ⟨(φ.vertexEquiv ⟨y,hLink.right_mem⟩).val, + (φ.isLink_iff e x ⟨y,hLink.right_mem⟩).mp hLink⟩ + · rintro ⟨y,hLink⟩ + let y₀ := φ.vertexEquiv.symm ⟨y,hLink.right_mem⟩ + refine ⟨y₀.val,(φ.isLink_iff e x y₀).mpr ?_⟩ + simpa only [y₀,Equiv.apply_symm_apply] using hLink + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/GraphIsoImage.lean b/LeanPool/GraphMinor/GM16/GraphIsoImage.lean new file mode 100644 index 0000000000..f8346e08da --- /dev/null +++ b/LeanPool/GraphMinor/GM16/GraphIsoImage.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.HypergraphImage +public import LeanPool.GraphMinor.Minor.Model + +/-! +# Graph isomorphisms with specified maps + +When an isomorphism agrees with given vertex and edge maps, the +hypergraph of its target is the image of the hypergraph of its source. +This identifies the hypergraph of the contracted wall with the +relabelled square grid in XVI (4.2), Claim (1). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Hypergraph +universe u v u' v' +variable {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + +/-- The image hypergraph associated with the maps of a graph isomorphism. -/ +theorem imageHypergraph_of_iso {H : Graph α β} {K : Graph α' β'} + (hVH : V(H).Finite) (hEH : E(H).Finite) (hVK : V(K).Finite) (hEK : E(K).Finite) + (φ : Iso H K) (f : α → α') (g : β → β') + (hf : ∀ v : V(H), (φ.vertexEquiv v).val = f v.val) + (hg : ∀ e : E(H), (φ.edgeEquiv e).val = g e.val) : + imageHypergraph f g (Hypergraph.ofGraph H hVH hEH) = Hypergraph.ofGraph K hVK hEK := by + apply Hypergraph.ext + · ext y + constructor + · rintro ⟨x, hx, rfl⟩ + exact hf ⟨x, hx⟩ ▸ (φ.vertexEquiv ⟨x, hx⟩).property + · intro hy + let x := φ.vertexEquiv.symm ⟨y, hy⟩ + refine ⟨x.val, x.property, ?_⟩ + exact (hf x).symm.trans (congrArg Subtype.val (φ.vertexEquiv.apply_symm_apply ⟨y, hy⟩)) + · ext e + constructor + · rintro ⟨e₀, he₀, rfl⟩ + exact hg ⟨e₀, he₀⟩ ▸ (φ.edgeEquiv ⟨e₀, he₀⟩).property + · intro he + let e₀ := φ.edgeEquiv.symm ⟨e, he⟩ + refine ⟨e₀.val, e₀.property, ?_⟩ + exact (hg e₀).symm.trans (congrArg Subtype.val (φ.edgeEquiv.apply_symm_apply ⟨e, he⟩)) + · funext e v + apply propext + constructor + · rintro ⟨e₀, v₀, hi, rfl, rfl⟩ + obtain ⟨w₀, hlink⟩ := hi + have hmap := (φ.isLink_iff ⟨e₀, hlink.edge_mem⟩ ⟨v₀, hlink.left_mem⟩ + ⟨w₀, hlink.right_mem⟩).mp hlink + rw [hf ⟨v₀, hlink.left_mem⟩, hf ⟨w₀, hlink.right_mem⟩, + hg ⟨e₀, hlink.edge_mem⟩] at hmap + exact ⟨f w₀, hmap⟩ + · rintro ⟨w, hlink⟩ + let e₀ := φ.edgeEquiv.symm ⟨e, hlink.edge_mem⟩ + let v₀ := φ.vertexEquiv.symm ⟨v, hlink.left_mem⟩ + let w₀ := φ.vertexEquiv.symm ⟨w, hlink.right_mem⟩ + have hmap : K.IsLink (φ.edgeEquiv e₀).val (φ.vertexEquiv v₀).val + (φ.vertexEquiv w₀).val := by + simpa only [e₀, v₀, w₀, Equiv.apply_symm_apply] using hlink + have horig := (φ.isLink_iff e₀ v₀ w₀).mpr hmap + refine ⟨e₀.val, v₀.val, ⟨w₀.val, horig⟩, ?_, ?_⟩ + · exact (hg e₀).symm.trans + (congrArg Subtype.val (φ.edgeEquiv.apply_symm_apply ⟨e, hlink.edge_mem⟩)) + · exact (hf v₀).symm.trans + (congrArg Subtype.val (φ.vertexEquiv.apply_symm_apply ⟨v, hlink.left_mem⟩)) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/GraphIsoUnion.lean b/LeanPool/GraphMinor/GM16/GraphIsoUnion.lean new file mode 100644 index 0000000000..32caf9bd3a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/GraphIsoUnion.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Statement +import LeanPool.GraphMinor.GM16.EquivUnion +import LeanPool.GraphMinor.GM16.GraphIsoEdgeEnds + +/-! +# Gluing graph isomorphisms on unions + +Glue the vertex and edge equivalences, using compatibility of +both their forward and inverse maps. Every edge belongs to a +piece, where its ends are preserved. The resulting equivalences +therefore form an isomorphism of the whole graphs. This joins +the individual path drawings of the subdivision in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph +universe u v u' v' w + +/-- Compatible isomorphisms on covering subgraphs glue to a graph +isomorphism whose vertex and edge maps restrict to the given maps. -/ +theorem exists_iso_of_subgraph_unions + {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} {ι : Type w} + {G : Graph α β} {H : Graph α' β'} (P : ι → Graph α β) (Q : ι → Graph α' β') + (hP : ∀ i, P i ≤ G) (hQ : ∀ i, Q i ≤ H) (φ : ∀ i, Iso (P i) (Q i)) + (hVG : V(G) = ⋃ i, V(P i)) (hEG : E(G) = ⋃ i, E(P i)) + (hVH : V(H) = ⋃ i, V(Q i)) (hEH : E(H) = ⋃ i, E(Q i)) + (hvF : ∀ i j x (hi : x ∈ V(P i)) (hj : x ∈ V(P j)), + ((φ i).vertexEquiv ⟨x, hi⟩).val = ((φ j).vertexEquiv ⟨x, hj⟩).val) + (hvB : ∀ i j y (hi : y ∈ V(Q i)) (hj : y ∈ V(Q j)), + ((φ i).vertexEquiv.symm ⟨y, hi⟩).val = ((φ j).vertexEquiv.symm ⟨y, hj⟩).val) + (heF : ∀ i j e (hi : e ∈ E(P i)) (hj : e ∈ E(P j)), + ((φ i).edgeEquiv ⟨e, hi⟩).val = ((φ j).edgeEquiv ⟨e, hj⟩).val) + (heB : ∀ i j e (hi : e ∈ E(Q i)) (hj : e ∈ E(Q j)), + ((φ i).edgeEquiv.symm ⟨e, hi⟩).val = ((φ j).edgeEquiv.symm ⟨e, hj⟩).val) : + ∃ Φ : Iso G H, + (∀ i (x : V(P i)), (Φ.vertexEquiv ⟨x.val,(hP i).vertexSet_mono x.property⟩).val = + ((φ i).vertexEquiv x).val) ∧ + (∀ i (e : E(P i)), (Φ.edgeEquiv ⟨e.val,(hP i).edgeSet_mono e.property⟩).val = + ((φ i).edgeEquiv e).val) := by + obtain ⟨vUnion,hvUnion⟩ := exists_equiv_iUnion (fun i => V(P i)) (fun i => V(Q i)) + (fun i => (φ i).vertexEquiv) hvF hvB + obtain ⟨eUnion,heUnion⟩ := exists_equiv_iUnion (fun i => E(P i)) (fun i => E(Q i)) + (fun i => (φ i).edgeEquiv) heF heB + let fv : V(G) ≃ V(H) := (Set.equivOfEq hVG).trans (vUnion.trans (Set.equivOfEq hVH.symm)) + let fe : E(G) ≃ E(H) := (Set.equivOfEq hEG).trans (eUnion.trans (Set.equivOfEq hEH.symm)) + have hVR (i : ι) (x : V(P i)) : + (fv ⟨x.val,(hP i).vertexSet_mono x.property⟩).val = ((φ i).vertexEquiv x).val := by + change (vUnion ⟨x.val,mem_iUnion_of_mem i x.property⟩).val = _ + exact hvUnion i x + have hER (i : ι) (e : E(P i)) : + (fe ⟨e.val,(hP i).edgeSet_mono e.property⟩).val = ((φ i).edgeEquiv e).val := by + change (eUnion ⟨e.val,mem_iUnion_of_mem i e.property⟩).val = _ + exact heUnion i e + have hEnds (e : E(G)) : ∃ x y : V(G), G.IsLink e.val x.val y.val ∧ + H.IsLink (fe e).val (fv x).val (fv y).val := by + have heU : e.val ∈ ⋃ i, E(P i) := (congrArg (fun A : Set β => e.val ∈ A) hEG).mp e.property + obtain ⟨i,hei⟩ := mem_iUnion.mp heU + obtain ⟨x,y,hLink⟩ := (P i).exists_isLink_of_mem_edgeSet hei + let xi : V(P i) := ⟨x,hLink.left_mem⟩ + let yi : V(P i) := ⟨y,hLink.right_mem⟩ + let ei : E(P i) := ⟨e.val,hei⟩ + refine ⟨⟨x,(hP i).vertexSet_mono hLink.left_mem⟩, + ⟨y,(hP i).vertexSet_mono hLink.right_mem⟩,(hP i).isLink_mono hLink,?_⟩ + rw [hER i ei,hVR i xi,hVR i yi] + exact (hQ i).isLink_mono (((φ i).isLink_iff ei xi yi).mp hLink) + exact ⟨⟨fv,fe,isLink_iff_of_edge_ends fv fe hEnds⟩,hVR,hER⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/GraphPathSystemUnion.lean b/LeanPool/GraphMinor/GM16/GraphPathSystemUnion.lean new file mode 100644 index 0000000000..4e38ad7e22 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/GraphPathSystemUnion.lean @@ -0,0 +1,62 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Minor.Model + +/-! +# The union graph of a path system + +The subdivision subgraph in XVI (4.2), page 54, consists of the +replacement paths and all branch centres. The separate centre set +keeps isolated source vertices. Restrict to precisely the path edges +so that the union has no additional edges from the ambient graph. +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Graph +universe u v w +variable {α : Type u} {β : Type v} {ι : Type w} + +/-- The union of the given graphs, together with a set of additional +vertices, using exactly the edges of those graphs. -/ +def pathSystemGraph (G : Graph α β) (C : Set α) (P : ι → Graph α β) : Graph α β := + (G.induce (C ∪ ⋃ i, V(P i))).restrict (⋃ i, E(P i)) + +/-- The vertices of the union graph. -/ +theorem pathSystemGraph_vertexSet (G : Graph α β) (C : Set α) (P : ι → Graph α β) : + V(pathSystemGraph G C P) = C ∪ ⋃ i, V(P i) := by rfl + +/-- The union graph is contained in the ambient graph. -/ +theorem pathSystemGraph_le {G : Graph α β} {C : Set α} {P : ι → Graph α β} + (hC : C ⊆ V(G)) (hP : ∀ i, P i ≤ G) : pathSystemGraph G C P ≤ G := + Graph.restrict_le.trans (G.induce_le (union_subset hC (iUnion_subset fun i => + (hP i).vertexSet_mono))) + +/-- Every member of the system is a subgraph of the union graph. -/ +theorem le_pathSystemGraph {G : Graph α β} {C : Set α} {P : ι → Graph α β} + (hP : ∀ i, P i ≤ G) (i : ι) : P i ≤ pathSystemGraph G C P := by + refine ⟨fun x hx => Or.inr (mem_iUnion.mpr ⟨i,hx⟩), ?_⟩ + intro e x y hlink + exact ⟨mem_iUnion.mpr ⟨i,hlink.edge_mem⟩, (hP i).isLink_mono hlink, + Or.inr (mem_iUnion.mpr ⟨i,hlink.left_mem⟩), + Or.inr (mem_iUnion.mpr ⟨i,hlink.right_mem⟩)⟩ + +/-- The edge set of the union graph is exactly the union of the edge +sets in the path system. -/ +theorem pathSystemGraph_edgeSet {G : Graph α β} {C : Set α} {P : ι → Graph α β} + (hP : ∀ i, P i ≤ G) : E(pathSystemGraph G C P) = ⋃ i, E(P i) := by + apply Subset.antisymm + · exact inter_subset_right + · intro e he + obtain ⟨i, hi⟩ := mem_iUnion.mp he + exact (le_pathSystemGraph hP i).edgeSet_mono hi + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/HairBetweenExits.lean b/LeanPool/GraphMinor/GM16/HairBetweenExits.lean new file mode 100644 index 0000000000..2267a24650 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/HairBetweenExits.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM16.Section6HairUnion +import LeanPool.GraphMinor.GM16.Section9Attachments +import LeanPool.GraphMinor.GM09.Basic + +/-! +# An old hair and two exit paths contain a new hair + +Join the old hair to the paths taking its two old ends to the +cleared drawing. The connected union meets that drawing only at +the two new ends and has no edge there. A path in the union is +therefore a hair of the cleared drawing. This supplies the graph +step in XVI (7.1), Claim (6), page 70. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM14 +universe u v + +/-- The connected union of an old hair and its two exit paths +contains a path relative to the new drawing with the new ends. -/ +theorem exists_hPath_between_exits {α : Type u} {β : Type v} + {G H K A Q B : Graph α β} {y r p q : α} + (hKH : K ≤ H) (hQ : IsHPathWithEnds G H Q y r) + (hA : IsGraphPathWithEnds G A y p) (hB : IsGraphPathWithEnds G B r q) + (hAK : V(A) ∩ V(K) = {p}) (hBK : V(B) ∩ V(K) = {q}) + (hyK : y ∉ V(K)) (hpK : p ∈ V(K)) (hqK : q ∈ V(K)) (hpq : p ≠ q) : + ∃ R : Graph α β, IsHPathWithEnds G K R p q := by + have hKG := hKH.trans hQ.1 + have hQE : Disjoint E(Q) E(K) := hQ.2.2.2.2.2.2.mono Subset.rfl hKH.edgeSet_mono + have hAE := path_edges_disjoint_of_singleton_inter hKG hA hAK.subset + have hBE := path_edges_disjoint_of_singleton_inter hKG hB hBK.subset + have hQK : V(Q) ∩ V(K) ⊆ {q} := by + rintro x ⟨hxQ, hxK⟩ + have hxEnds : x ∈ ({y, r} : Set α) := hQ.2.2.2.2.2.1 ▸ ⟨hxQ, hKH.vertexSet_mono hxK⟩ + rcases hxEnds with hxy | hxr + · exact False.elim (hyK (hxy ▸ hxK)) + · rw [mem_singleton_iff] at hxr + subst x + exact hBK ▸ ⟨hB.left_mem, hxK⟩ + let J₁ := subgraphUnion G A Q + have hJ₁G : J₁ ≤ G := subgraphUnion_le hA.1 hQ.2.1.1 + have hAJ₁ : A ≤ J₁ := le_subgraphUnion_left hA.1 hQ.2.1.1 + have hQJ₁ : Q ≤ J₁ := le_subgraphUnion_right hA.1 hQ.2.1.1 + have hConn₁ : IsGraphConnected J₁ := isGraphConnected_subgraphUnion hA.1 hQ.2.1.1 + (graphPath_isGraphConnected hA) (graphPath_isGraphConnected hQ.2.1) + ⟨y, hA.left_mem, hQ.2.1.left_mem⟩ + let J := subgraphUnion G J₁ B + have hJG : J ≤ G := subgraphUnion_le hJ₁G hB.1 + have hJ₁J : J₁ ≤ J := le_subgraphUnion_left hJ₁G hB.1 + have hBJ : B ≤ J := le_subgraphUnion_right hJ₁G hB.1 + have hConn : IsGraphConnected J := isGraphConnected_subgraphUnion hJ₁G hB.1 hConn₁ + (graphPath_isGraphConnected hB) ⟨r, hQJ₁.vertexSet_mono hQ.2.1.right_mem, hB.left_mem⟩ + have hJV : V(J) = (V(A) ∪ V(Q)) ∪ V(B) := by + rw [show J = subgraphUnion G J₁ B from rfl, vertexSet_subgraphUnion, + show J₁ = subgraphUnion G A Q from rfl, vertexSet_subgraphUnion] + have hJE : E(J) = (E(A) ∪ E(Q)) ∪ E(B) := by + rw [show J = subgraphUnion G J₁ B from rfl, edgeSet_subgraphUnion hJ₁G hB.1, + show J₁ = subgraphUnion G A Q from rfl, edgeSet_subgraphUnion hA.1 hQ.2.1.1] + have hJK : V(J) ∩ V(K) ⊆ {p, q} := by + rintro x ⟨hxJ, hxK⟩ + rw [hJV] at hxJ + rcases hxJ with (hxA | hxQ) | hxB + · exact Or.inl (mem_singleton_iff.mp (hAK ▸ ⟨hxA, hxK⟩)) + · exact Or.inr (hQK ⟨hxQ, hxK⟩) + · exact Or.inr (hBK ▸ ⟨hxB, hxK⟩) + have hJEdges : Disjoint E(J) E(K) := by rw [hJE]; exact (hAE.union_left hQE).union_left hBE + obtain ⟨W⟩ := hConn.2 p (hJ₁J.vertexSet_mono (hAJ₁.vertexSet_mono hA.right_mem)) + q (hBJ.vertexSet_mono hB.right_mem) + obtain ⟨R, hR, _, _⟩ := exists_isGraphPathWithEnds_of_walk W + refine ⟨R, hKG, hR.mono hJG, hpq, hpK, hqK, ?_, hJEdges.mono hR.1.edgeSet_mono Subset.rfl⟩ + apply subset_antisymm + · exact fun x hx => hJK ⟨hR.1.vertexSet_mono hx.1, hx.2⟩ + · rintro x (rfl | hxq) + · exact ⟨hR.left_mem, hpK⟩ + · rw [mem_singleton_iff] at hxq + subst x + exact ⟨hR.right_mem, hqK⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/HornCongr.lean b/LeanPool/GraphMinor/GM16/HornCongr.lean new file mode 100644 index 0000000000..30dd5ea2ad --- /dev/null +++ b/LeanPool/GraphMinor/GM16/HornCongr.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.SpanCongr + +/-! +# Transporting a horn along equal drawings and metrics + +The paths and the vertex map of a horn do not change when the drawing +and its embedding are identified. Only the endpoint distances need +comparison. This transports the horns after the successive clearings +in XVI (7.1), Claim (4), page 69. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM14 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] +variable {α : Type u} {β : Type v} + +omit [T2Space S] in +/-- Reindex the paths of a horn by an equivalence of their finite +index sets. -/ +theorem horn_reindex {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {d : Set S → Set S → ℕ} {a : α} {θ σ σ' : ℕ} + {P : Fin σ → Graph α β} {u : Fin σ → S} + (e : Fin σ' ≃ Fin σ) (h : IsHorn G H η d a θ σ P u) : + IsHorn G H η d a θ σ' (fun i => P (e i)) (fun i => u (e i)) := by + obtain ⟨ha, hu, hP, hInter, hDis, hDist⟩ := h + refine ⟨ha, fun i => hu (e i), fun i => hP (e i), fun i => hInter (e i), ?_, ?_⟩ + · intro i j hij + exact hDis (e i) (e j) (fun h => hij (e.injective h)) + · intro i j hij + exact hDist (e i) (e j) (fun h => hij (e.injective h)) + +omit [T2Space S] in +/-- Identify the drawing and embedding of a horn and replace its +metric by one agreeing on the drawing vertices. -/ +theorem horn_congr_drawing_embedding {G : Graph α β} {H K : Drawing S} + (hHK : H = K) (η : SpanEmbedding H G) (η' : SpanEmbedding K G) + (hv : η.vMap = η'.vMap) (he : η.eMap = η'.eMap) + {d d' : Set S → Set S → ℕ} {a : α} {θ σ : ℕ} + {P : Fin σ → Graph α β} {u : Fin σ → S} + (hEq : ∀ x ∈ H.V, ∀ y ∈ H.V, d {x} {y} = d' {x} {y}) + (hHorn : IsHorn G H η d a θ σ P u) : IsHorn G K η' d' a θ σ P u := by + subst K + have hη := spanEmbedding_eq_of_maps η η' hv he + subst η' + obtain ⟨ha, hu, hP, hInter, hDis, hDist⟩ := hHorn + refine ⟨ha, hu, hP, hInter, hDis, ?_⟩ + intro i j hij + rw [← hEq (u i) (hu i) (u j) (hu j)] + exact hDist i j hij + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/HypergraphImage.lean b/LeanPool/GraphMinor/GM16/HypergraphImage.lean new file mode 100644 index 0000000000..a58150b82a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/HypergraphImage.lean @@ -0,0 +1,138 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Defs + +/-! +# Relabelling hypergraphs by injections + +The grid contraction in XVI (4.2) changes the names of vertices and +edges. These lemmas carry hypergraphs and their separations through +injective maps. Keeping the maps explicit lets the grid tangle be +compared with the tangle in the contracted wall. +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Function Hypergraph +universe u v u' v' +variable {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + +/-- Relabel the vertices and edges, with the incidence relation given by +its image under the two maps. -/ +def imageHypergraph (f : α → α') (g : β → β') (A : Hypergraph α β) : Hypergraph α' β' where + vertexSet := f '' A.vertexSet + edgeSet := g '' A.edgeSet + Inc e v := ∃ e₀ v₀, A.Inc e₀ v₀ ∧ g e₀ = e ∧ f v₀ = v + vertex_mem_of_inc _ _ h := by + obtain ⟨e, v, hinc, _, rfl⟩ := h + exact mem_image_of_mem f (A.vertex_mem_of_inc hinc) + edge_mem_of_inc _ _ h := by + obtain ⟨e, v, hinc, rfl, _⟩ := h + exact mem_image_of_mem g (A.edge_mem_of_inc hinc) + vertexSet_finite := A.vertexSet_finite.image f + edgeSet_finite := A.edgeSet_finite.image g + +/-- Incidence at an image vertex and image edge can be read in the +original hypergraph. -/ +theorem imageHypergraph_inc (f : α → α') (g : β → β') + (hf : Injective f) (hg : Injective g) (A : Hypergraph α β) (e : β) (v : α) : + (imageHypergraph f g A).Inc (g e) (f v) ↔ A.Inc e v := by + constructor + · rintro ⟨e₀, v₀, hi, he, hv⟩ + exact hg he ▸ hf hv ▸ hi + · intro hi + exact ⟨e, v, hi, rfl, rfl⟩ + +/-- Relabelling preserves unions. -/ +theorem imageHypergraph_union (f : α → α') (g : β → β') (A B : Hypergraph α β) : + imageHypergraph f g (A ∪ B) = imageHypergraph f g A ∪ imageHypergraph f g B := by + apply Hypergraph.ext + · exact image_union _ _ _ + · exact image_union _ _ _ + · funext e v + apply propext + constructor + · rintro ⟨e₀, v₀, hi, he, hv⟩ + rcases hi with hi | hi + · exact Or.inl ⟨e₀, v₀, hi, he, hv⟩ + · exact Or.inr ⟨e₀, v₀, hi, he, hv⟩ + · rintro (⟨e₀, v₀, hi, he, hv⟩ | ⟨e₀, v₀, hi, he, hv⟩) + · exact ⟨e₀, v₀, Or.inl hi, he, hv⟩ + · exact ⟨e₀, v₀, Or.inr hi, he, hv⟩ + +/-- Injective relabelling preserves intersections. -/ +theorem imageHypergraph_inter (f : α → α') (g : β → β') + (hf : Injective f) (hg : Injective g) (A B : Hypergraph α β) : + imageHypergraph f g (A ∩ B) = imageHypergraph f g A ∩ imageHypergraph f g B := by + apply Hypergraph.ext + · exact image_inter hf + · exact image_inter hg + · funext e v + apply propext + constructor + · rintro ⟨e₀, v₀, hi, he, hv⟩ + exact ⟨⟨e₀, v₀, hi.1, he, hv⟩, ⟨e₀, v₀, hi.2, he, hv⟩⟩ + · rintro ⟨⟨e₀, v₀, hi, he, hv⟩, ⟨e₁, v₁, hj, he', hv'⟩⟩ + have heq := hg (he.trans he'.symm) + have hvq := hf (hv.trans hv'.symm) + subst e₁ + subst v₁ + exact ⟨e₀, v₀, ⟨hi, hj⟩, he, hv⟩ + +/-- Edge injectivity is enough to preserve the subhypergraph relation. -/ +theorem imageHypergraph_mono (f : α → α') (g : β → β') (hg : Injective g) + {A B : Hypergraph α β} (h : A ≤ B) : imageHypergraph f g A ≤ imageHypergraph f g B := by + refine ⟨image_mono h.vertexSet_subset, image_mono h.edgeSet_subset, ?_⟩ + rintro _ ⟨e₀, he₀, rfl⟩ + ext v + constructor + · rintro ⟨e₁, v₁, hi, he, hv⟩ + have heq := hg he + subst e₁ + have hia : A.Inc e₀ v₁ := Set.ext_iff.mp (h.ends_eq e₀ he₀) v₁ |>.mp hi + exact ⟨e₀, v₁, hia, rfl, hv⟩ + · rintro ⟨e₁, v₁, hi, he, hv⟩ + have heq := hg he + subst e₁ + have hib : B.Inc e₀ v₁ := Set.ext_iff.mp (h.ends_eq e₀ he₀) v₁ |>.mpr hi + exact ⟨e₀, v₁, hib, rfl, hv⟩ + +/-- Injective relabelling preserves separations. -/ +theorem imageHypergraph_isSeparation (f : α → α') (g : β → β') + (hf : Injective f) (hg : Injective g) {G A B : Hypergraph α β} + (h : G.IsSeparation A B) : + (imageHypergraph f g G).IsSeparation (imageHypergraph f g A) (imageHypergraph f g B) := by + refine ⟨imageHypergraph_mono f g hg h.left_le, imageHypergraph_mono f g hg h.right_le, ?_, ?_⟩ + · rw [← imageHypergraph_union, h.union_eq] + · rw [← imageHypergraph_inter f g hf hg] + change g '' (A ∩ B).edgeSet = ∅ + rw [h.edgeSet_inter_eq, image_empty] + +/-- The order of a separation is unchanged by injective relabelling. -/ +theorem imageHypergraph_separationOrder (f : α → α') (g : β → β') (hf : Injective f) + (A B : Hypergraph α β) : + separationOrder (imageHypergraph f g A) (imageHypergraph f g B) = separationOrder A B := by + change (f '' A.vertexSet ∩ f '' B.vertexSet).ncard = (A.vertexSet ∩ B.vertexSet).ncard + rw [← image_inter hf] + exact ncard_image_of_injective _ hf + +/-- Injective relabelling distinguishes hypergraphs. -/ +theorem imageHypergraph_injective (f : α → α') (g : β → β') + (hf : Injective f) (hg : Injective g) : Injective (imageHypergraph f g) := by + intro A B h + apply Hypergraph.ext + · exact hf.image_injective (congrArg Hypergraph.vertexSet h) + · exact hg.image_injective (congrArg Hypergraph.edgeSet h) + · funext e v + apply propext + rw [← imageHypergraph_inc f g hf hg A e v, h, imageHypergraph_inc f g hf hg B e v] + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/HypergraphImageComposition.lean b/LeanPool/GraphMinor/GM16/HypergraphImageComposition.lean new file mode 100644 index 0000000000..47dd1f212a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/HypergraphImageComposition.lean @@ -0,0 +1,91 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.HypergraphImage + +/-! +# Composing and restricting relabellings + +Images depend only on the maps on actual vertices and edges. +Relabellings also compose. A map that is injective only on those +actual elements can be made globally injective by sending unused +names to a separate summand. This avoids imposing conditions on +unused edge names in XVI (4.2). +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Function Hypergraph +universe u v u' v' u'' v'' +variable {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + +/-- Equal maps on the vertices and edges give the same image. -/ +theorem imageHypergraph_congr_on (f f' : α → α') (g g' : β → β') (A : Hypergraph α β) + (hf : ∀ x ∈ A.vertexSet, f x = f' x) (hg : ∀ e ∈ A.edgeSet, g e = g' e) : + imageHypergraph f g A = imageHypergraph f' g' A := by + apply Hypergraph.ext + · exact Set.image_congr hf + · exact Set.image_congr hg + · funext e v + apply propext + constructor + · rintro ⟨e₀, v₀, hi, he, hv⟩ + exact ⟨e₀, v₀, hi, (hg e₀ (A.edge_mem_of_inc hi)).symm.trans he, + (hf v₀ (A.vertex_mem_of_inc hi)).symm.trans hv⟩ + · rintro ⟨e₀, v₀, hi, he, hv⟩ + exact ⟨e₀, v₀, hi, (hg e₀ (A.edge_mem_of_inc hi)).trans he, + (hf v₀ (A.vertex_mem_of_inc hi)).trans hv⟩ + +/-- Relabelling a relabelled hypergraph composes the maps. -/ +theorem imageHypergraph_comp {α'' : Type u''} {β'' : Type v''} + (f : α → α') (g : β → β') (f' : α' → α'') (g' : β' → β'') (A : Hypergraph α β) : + imageHypergraph f' g' (imageHypergraph f g A) = imageHypergraph (f' ∘ f) (g' ∘ g) A := by + apply Hypergraph.ext + · exact Set.image_image _ _ _ + · exact Set.image_image _ _ _ + · funext e v + apply propext + constructor + · rintro ⟨e₁, v₁, ⟨e₀, v₀, hi, he₀, hv₀⟩, he₁, hv₁⟩ + exact ⟨e₀, v₀, hi, congrArg g' he₀ |>.trans he₁, congrArg f' hv₀ |>.trans hv₁⟩ + · rintro ⟨e₀, v₀, hi, he, hv⟩ + exact ⟨g e₀, f v₀, ⟨e₀, v₀, hi, rfl, rfl⟩, he, hv⟩ + +/-- Keep the given map on a set and send unused names to a separate +summand, so they cannot collide with images of actual elements. -/ +noncomputable def supportedInjection (S : Set α) (f : α → α') : α → Sum α' α := by + classical + exact fun x => if x ∈ S then Sum.inl (f x) else Sum.inr x + +/-- On the specified set the augmented map is the given map followed +by the left inclusion. -/ +theorem supportedInjection_apply {S : Set α} (f : α → α') {x : α} (hx : x ∈ S) : + supportedInjection S f x = Sum.inl (f x) := by + classical + simp only [supportedInjection, ite_eq_left hx] + +/-- Injectivity on the specified set makes the augmented map globally +injective. -/ +theorem supportedInjection_injective {S : Set α} (f : α → α') (hf : InjOn f S) : + Injective (supportedInjection S f) := by + classical + intro x y hEq + unfold supportedInjection at hEq + by_cases hx : x ∈ S <;> by_cases hy : y ∈ S + · rw [ite_eq_left hx, ite_eq_left hy] at hEq + exact hf hx hy (Sum.inl.inj hEq) + · rw [ite_eq_left hx, ite_eq_right hy] at hEq + cases hEq + · rw [ite_eq_right hx, ite_eq_left hy] at hEq + cases hEq + · rw [ite_eq_right hx, ite_eq_right hy] at hEq + exact Sum.inr.inj hEq + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/HypergraphImageReflection.lean b/LeanPool/GraphMinor/GM16/HypergraphImageReflection.lean new file mode 100644 index 0000000000..615cffaab9 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/HypergraphImageReflection.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.HypergraphImageTangle + +/-! +# Reflecting separations and tangles through injections + +Injective relabelling neither creates subhypergraphs nor creates +separations. It also reflects the three tangle axioms. These facts +allow the proof of XVI (4.2) to discard extra names introduced while +relabelling a minor. +-/ + +public section +namespace GraphMinor.GM16 +open Set Function Hypergraph GM10 +universe u v u' v' +variable {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + +/-- An injective image reflects the subhypergraph relation. -/ +theorem le_of_imageHypergraph_le (f : α → α') (g : β → β') + (hf : Injective f) (hg : Injective g) {A G : Hypergraph α β} + (h : imageHypergraph f g A ≤ imageHypergraph f g G) : A ≤ G := by + refine ⟨?_, ?_, ?_⟩ + · intro x hx + obtain ⟨y, hy, heq⟩ := h.vertexSet_subset (mem_image_of_mem f hx) + exact hf heq ▸ hy + · intro e he + obtain ⟨d, hd, heq⟩ := h.edgeSet_subset (mem_image_of_mem g he) + exact hg heq ▸ hd + · intro e he + ext x + change G.Inc e x ↔ A.Inc e x + rw [← imageHypergraph_inc f g hf hg G e x, ← imageHypergraph_inc f g hf hg A e x] + exact Set.ext_iff.mp (h.ends_eq (g e) (mem_image_of_mem g he)) (f x) + +/-- An injective image reflects separations. -/ +theorem isSeparation_of_imageHypergraph (f : α → α') (g : β → β') + (hf : Injective f) (hg : Injective g) {G A B : Hypergraph α β} + (h : (imageHypergraph f g G).IsSeparation (imageHypergraph f g A) (imageHypergraph f g B)) : + G.IsSeparation A B := by + refine ⟨le_of_imageHypergraph_le f g hf hg h.left_le, + le_of_imageHypergraph_le f g hf hg h.right_le, ?_, ?_⟩ + · apply imageHypergraph_injective f g hf hg + rw [imageHypergraph_union] + exact h.union_eq + · have hImg : g '' (A ∩ B).edgeSet = ∅ := by + change (imageHypergraph f g (A ∩ B)).edgeSet = ∅ + rw [imageHypergraph_inter f g hf hg] + exact h.edgeSet_inter_eq + exact image_eq_empty.mp hImg + +/-- If an injective image of a set of separations is a tangle, the +original set is a tangle of the same order. -/ +theorem isTangle_of_imageHypergraphTangle (f : α → α') (g : β → β') + (hf : Injective f) (hg : Injective g) {G : Hypergraph α β} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} + (hT : IsTangle (imageHypergraph f g G) θ (imageHypergraphTangle f g T)) : IsTangle G θ T := by + have hMem {A B : Hypergraph α β} (hp : (A,B) ∈ T) : + (imageHypergraph f g A, imageHypergraph f g B) ∈ imageHypergraphTangle f g T + := ⟨(A,B), hp, rfl⟩ + refine ⟨hT.one_le, ?_, ?_, ?_, ?_, ?_⟩ + · intro A B hp + exact isSeparation_of_imageHypergraph f g hf hg (hT.isSeparation (hMem hp)) + · intro A B hp + have hOrd := hT.order_lt (hMem hp) + rwa [imageHypergraph_separationOrder f g hf] at hOrd + · intro A B hSep hOrd + have hSep' := imageHypergraph_isSeparation f g hf hg hSep + have hOrd' : separationOrder (imageHypergraph f g A) (imageHypergraph f g B) < θ := by + rwa [imageHypergraph_separationOrder f g hf] + rcases hT.axiom1 hSep' hOrd' with hm | hm + · exact Or.inl ((mem_imageHypergraphTangle f g hf hg A B).mp hm) + · exact Or.inr ((mem_imageHypergraphTangle f g hf hg B A).mp hm) + · intro A₁ B₁ A₂ B₂ A₃ B₃ h₁ h₂ h₃ hUnion + apply hT.axiom2 (hMem h₁) (hMem h₂) (hMem h₃) + rw [← imageHypergraph_union, ← imageHypergraph_union, hUnion] + · intro A B hp hV + exact hT.axiom3 (hMem hp) (congrArg (fun X : Set α => f '' X) hV) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/HypergraphImageTangle.lean b/LeanPool/GraphMinor/GM16/HypergraphImageTangle.lean new file mode 100644 index 0000000000..df18e4a2d1 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/HypergraphImageTangle.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.HypergraphPreimage + +/-! +# Tangles under injective relabelling + +Relabel both sides of every separation. The first tangle axiom follows +by taking the preimage of a separation. The other two axioms follow +from preservation of unions and injectivity on vertex sets. This lets +the proof of XVI (4.2) use the grid tangle with the edge names of the +contracted wall. +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Function Hypergraph GM10 +universe u v u' v' +variable {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + +/-- Relabel every separation in a set of separations. -/ +def imageHypergraphTangle (f : α → α') (g : β → β') + (T : Set (Hypergraph α β × Hypergraph α β)) : + Set (Hypergraph α' β' × Hypergraph α' β') := + (fun p => (imageHypergraph f g p.1, imageHypergraph f g p.2)) '' T + +/-- The image of a tangle under injective vertex and edge maps is a +tangle of the same order. -/ +theorem isTangle_imageHypergraphTangle (f : α → α') (g : β → β') + (hf : Injective f) (hg : Injective g) {G : Hypergraph α β} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} (hT : IsTangle G θ T) : + IsTangle (imageHypergraph f g G) θ (imageHypergraphTangle f g T) := by + refine ⟨hT.one_le, ?_, ?_, ?_, ?_, ?_⟩ + · rintro _ _ ⟨⟨A, B⟩, hp, heq⟩ + obtain ⟨rfl, rfl⟩ := Prod.ext_iff.mp heq + exact imageHypergraph_isSeparation f g hf hg (hT.isSeparation hp) + · rintro _ _ ⟨⟨A, B⟩, hp, heq⟩ + obtain ⟨rfl, rfl⟩ := Prod.ext_iff.mp heq + change separationOrder (imageHypergraph f g A) (imageHypergraph f g B) < θ + rw [imageHypergraph_separationOrder f g hf] + exact hT.order_lt hp + · intro A B hSep hOrd + let A₀ := preimageHypergraph f g G A + let B₀ := preimageHypergraph f g G B + have hSep₀ : G.IsSeparation A₀ B₀ := preimageHypergraph_isSeparation f g hf hg hSep + have hOrd₀ : separationOrder A₀ B₀ < θ := by + rw [preimageHypergraph_separationOrder f g hf hSep.left_le hSep.right_le] + exact hOrd + have hA : imageHypergraph f g A₀ = A := imageHypergraph_preimage f g hSep.left_le + have hB : imageHypergraph f g B₀ = B := imageHypergraph_preimage f g hSep.right_le + rcases hT.axiom1 hSep₀ hOrd₀ with hm | hm + · exact Or.inl ⟨(A₀, B₀), hm, Prod.ext hA hB⟩ + · exact Or.inr ⟨(B₀, A₀), hm, Prod.ext hB hA⟩ + · rintro _ _ _ _ _ _ ⟨⟨A₁, B₁⟩, hp₁, heq₁⟩ + ⟨⟨A₂, B₂⟩, hp₂, heq₂⟩ ⟨⟨A₃, B₃⟩, hp₃, heq₃⟩ hUnion + obtain ⟨rfl, rfl⟩ := Prod.ext_iff.mp heq₁ + obtain ⟨rfl, rfl⟩ := Prod.ext_iff.mp heq₂ + obtain ⟨rfl, rfl⟩ := Prod.ext_iff.mp heq₃ + apply hT.axiom2 hp₁ hp₂ hp₃ + apply imageHypergraph_injective f g hf hg + rw [imageHypergraph_union, imageHypergraph_union] + exact hUnion + · rintro _ _ ⟨⟨A, B⟩, hp, heq⟩ hV + obtain ⟨rfl, rfl⟩ := Prod.ext_iff.mp heq + exact hT.axiom3 hp (hf.image_injective hV) + +/-- Injective relabelling also reflects membership of the tangle. -/ +theorem mem_imageHypergraphTangle (f : α → α') (g : β → β') + (hf : Injective f) (hg : Injective g) + {T : Set (Hypergraph α β × Hypergraph α β)} (A B : Hypergraph α β) : + (imageHypergraph f g A, imageHypergraph f g B) ∈ imageHypergraphTangle f g T ↔ + (A, B) ∈ T := by + constructor + · rintro ⟨⟨A₀, B₀⟩, hp, heq⟩ + obtain ⟨hA, hB⟩ := Prod.ext_iff.mp heq + have hA₀ := imageHypergraph_injective f g hf hg hA + have hB₀ := imageHypergraph_injective f g hf hg hB + exact hA₀ ▸ hB₀ ▸ hp + · intro hp + exact ⟨(A, B), hp, rfl⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/HypergraphPreimage.lean b/LeanPool/GraphMinor/GM16/HypergraphPreimage.lean new file mode 100644 index 0000000000..3f8364419c --- /dev/null +++ b/LeanPool/GraphMinor/GM16/HypergraphPreimage.lean @@ -0,0 +1,114 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.HypergraphImage + +/-! +# Recovering subhypergraphs after relabelling + +A subhypergraph of an injective image has a unique preimage in the +original hypergraph. This applies to both sides of a separation and +preserves its order. These facts supply the inverse operation needed +to transport the grid tangle in XVI (4.2). +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Function Hypergraph +universe u v u' v' +variable {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + +/-- The preimage of a hypergraph, restricted to the vertices and edges +of a fixed finite hypergraph. -/ +def preimageHypergraph (f : α → α') (g : β → β') (G : Hypergraph α β) + (B : Hypergraph α' β') : Hypergraph α β where + vertexSet := {v ∈ G.vertexSet | f v ∈ B.vertexSet} + edgeSet := {e ∈ G.edgeSet | g e ∈ B.edgeSet} + Inc e v := B.Inc (g e) (f v) ∧ v ∈ G.vertexSet ∧ e ∈ G.edgeSet + vertex_mem_of_inc _ _ h := ⟨h.2.1, B.vertex_mem_of_inc h.1⟩ + edge_mem_of_inc _ _ h := ⟨h.2.2, B.edge_mem_of_inc h.1⟩ + vertexSet_finite := G.vertexSet_finite.subset fun _ h => h.1 + edgeSet_finite := G.edgeSet_finite.subset fun _ h => h.1 + +/-- A subhypergraph of the image pulls back to a subhypergraph of the +original hypergraph. -/ +theorem preimageHypergraph_le (f : α → α') (g : β → β') + (hf : Injective f) (hg : Injective g) {G : Hypergraph α β} {B : Hypergraph α' β'} + (hB : B ≤ imageHypergraph f g G) : preimageHypergraph f g G B ≤ G := by + refine ⟨fun _ h => h.1, fun _ h => h.1, ?_⟩ + intro e he + ext v + constructor + · intro hi + have him : (imageHypergraph f g G).Inc (g e) (f v) := ⟨e, v, hi, rfl, rfl⟩ + have hib : B.Inc (g e) (f v) := Set.ext_iff.mp (hB.ends_eq (g e) he.2) (f v) |>.mp him + exact ⟨hib, G.vertex_mem_of_inc hi, he.1⟩ + · rintro ⟨hib, _, _⟩ + have him : (imageHypergraph f g G).Inc (g e) (f v) := + Set.ext_iff.mp (hB.ends_eq (g e) he.2) (f v) |>.mpr hib + exact (imageHypergraph_inc f g hf hg G e v).mp him + +/-- Every subhypergraph of the image is the image of its preimage. -/ +theorem imageHypergraph_preimage (f : α → α') (g : β → β') + {G : Hypergraph α β} {B : Hypergraph α' β'} (hB : B ≤ imageHypergraph f g G) : + imageHypergraph f g (preimageHypergraph f g G B) = B := by + apply Hypergraph.ext + · ext v + constructor + · rintro ⟨v₀, ⟨_, hv⟩, rfl⟩ + exact hv + · intro hv + obtain ⟨v₀, hv₀, rfl⟩ := hB.vertexSet_subset hv + exact ⟨v₀, ⟨hv₀, hv⟩, rfl⟩ + · ext e + constructor + · rintro ⟨e₀, ⟨_, he⟩, rfl⟩ + exact he + · intro he + obtain ⟨e₀, he₀, rfl⟩ := hB.edgeSet_subset he + exact ⟨e₀, ⟨he₀, he⟩, rfl⟩ + · funext e v + apply propext + constructor + · rintro ⟨e₀, v₀, ⟨hi, _, _⟩, rfl, rfl⟩ + exact hi + · intro hi + obtain ⟨e₀, he₀, rfl⟩ := hB.edgeSet_subset (B.edge_mem_of_inc hi) + obtain ⟨v₀, hv₀, rfl⟩ := hB.vertexSet_subset (B.vertex_mem_of_inc hi) + exact ⟨e₀, v₀, ⟨hi, hv₀, he₀⟩, rfl, rfl⟩ + +/-- The preimage of a separation of the image is a separation. -/ +theorem preimageHypergraph_isSeparation (f : α → α') (g : β → β') + (hf : Injective f) (hg : Injective g) {G : Hypergraph α β} {A B : Hypergraph α' β'} + (h : (imageHypergraph f g G).IsSeparation A B) : + G.IsSeparation (preimageHypergraph f g G A) (preimageHypergraph f g G B) := by + refine ⟨preimageHypergraph_le f g hf hg h.left_le, + preimageHypergraph_le f g hf hg h.right_le, ?_, ?_⟩ + · apply imageHypergraph_injective f g hf hg + rw [imageHypergraph_union, imageHypergraph_preimage f g h.left_le, + imageHypergraph_preimage f g h.right_le, h.union_eq] + · apply eq_empty_iff_forall_notMem.mpr + intro e he + have hge : g e ∈ (A ∩ B).edgeSet := ⟨he.1.2, he.2.2⟩ + rw [h.edgeSet_inter_eq] at hge + exact hge + +/-- Separation order is unchanged on passing to the preimage. -/ +theorem preimageHypergraph_separationOrder (f : α → α') (g : β → β') + (hf : Injective f) {G : Hypergraph α β} {A B : Hypergraph α' β'} + (hA : A ≤ imageHypergraph f g G) (hB : B ≤ imageHypergraph f g G) : + separationOrder (preimageHypergraph f g G A) (preimageHypergraph f g G B) = + separationOrder A B := by + have h := imageHypergraph_separationOrder f g hf + (preimageHypergraph f g G A) (preimageHypergraph f g G B) + rw [imageHypergraph_preimage f g hA, imageHypergraph_preimage f g hB] at h + exact h.symm + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/HypergraphSupportedTangle.lean b/LeanPool/GraphMinor/GM16/HypergraphSupportedTangle.lean new file mode 100644 index 0000000000..1347abd742 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/HypergraphSupportedTangle.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.HypergraphImageTangle +import LeanPool.GraphMinor.GM16.HypergraphImageReflection +import LeanPool.GraphMinor.GM16.HypergraphImageComposition + +/-! +# Relabelling a tangle on its actual vertices and edges + +Unused names must impose no restriction on a minor's edge map. +Augment the vertex and edge maps by sending unused names to separate +summands. The augmented maps are injective everywhere and transport +the tangle. The image uses only the left summands, so reflection +removes the augmentation. This supplies the relabelling step for the +wall minor of an arbitrary graph in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Function Hypergraph GM10 +universe u v u' v' +variable {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + +/-- Relabel a tangle using maps injective on the actual vertex and +edge sets. Values on unused names are immaterial. -/ +theorem isTangle_imageHypergraphTangle_on (f : α → α') (g : β → β') + {G : Hypergraph α β} (hf : InjOn f G.vertexSet) (hg : InjOn g G.edgeSet) + {θ : ℕ} {T : Set (Hypergraph α β × Hypergraph α β)} (hT : IsTangle G θ T) : + IsTangle (imageHypergraph f g G) θ (imageHypergraphTangle f g T) := by + let F := supportedInjection G.vertexSet f + let E := supportedInjection G.edgeSet g + let inV : α' → Sum α' α := Sum.inl + let inE : β' → Sum β' β := Sum.inl + have hEq {A : Hypergraph α β} (hA : A ≤ G) : + imageHypergraph inV inE (imageHypergraph f g A) = imageHypergraph F E A := by + rw [imageHypergraph_comp] + apply imageHypergraph_congr_on + · intro x hx + exact (supportedInjection_apply f (hA.vertexSet_subset hx)).symm + · intro e he + exact (supportedInjection_apply g (hA.edgeSet_subset he)).symm + have hG : imageHypergraph inV inE (imageHypergraph f g G) = imageHypergraph F E G := hEq le_rfl + have hTImage : imageHypergraphTangle inV inE (imageHypergraphTangle f g T) = + imageHypergraphTangle F E T := by + unfold imageHypergraphTangle + rw [image_image] + apply Set.image_congr + intro p hp + exact Prod.ext (hEq (hT.isSeparation hp).left_le) (hEq (hT.isSeparation hp).right_le) + have hAug := isTangle_imageHypergraphTangle F E + (supportedInjection_injective f hf) (supportedInjection_injective g hg) hT + rw [← hG, ← hTImage] at hAug + exact isTangle_of_imageHypergraphTangle inV inE Sum.inl_injective Sum.inl_injective hAug + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/InducedTangleEdgePatterns.lean b/LeanPool/GraphMinor/GM16/InducedTangleEdgePatterns.lean new file mode 100644 index 0000000000..ac85bcd914 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/InducedTangleEdgePatterns.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.HypergraphImageTangle +public import LeanPool.GraphMinor.GM10.Defs2 + +/-! +# Comparing induced tangles with the same chosen edge map + +The original wall minor and the wall minor in the subdivision +have different branch sets but the same chosen edges. A small +side in the subdivision tangle therefore has exactly the same +chosen-edge pattern as a small side of the original wall tangle. +Intersecting its restricted edge set with the chosen edges removes +the intermediate subgraph. This compares the induced tangles in +the last paragraph of XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Hypergraph GM10 +universe u v w u₁ u₂ u₃ v₁ + +/-- A separation matching a side induced through the smaller branch +sets also matches the side induced through the original branch sets, +provided that their chosen edge maps are the same. -/ +theorem mem_inducedTangle_of_same_edge_pattern + {α : Type u} {α' : Type u₁} {ν : Type w} {ε : Type v₁} {β : Type v} + {κ : Type u₂} {κ' : Type u₃} (W : Hypergraph ν ε) + (G : Hypergraph α β) (N : Hypergraph α' β) + (f : ν → κ) (f' : ν → κ') (g : ε → β) + {T : Set (Hypergraph ν ε × Hypergraph ν ε)} {θ : ℕ} + (hChosen : g '' W.edgeSet ⊆ N.edgeSet) + {A B : Hypergraph α β} (hSep : G.IsSeparation A B) (hOrd : separationOrder A B < θ) + {A' B' : Hypergraph α' β} + (hMem : (A', B') ∈ inducedTangle N (imageHypergraph f' g W) (imageHypergraphTangle f' g T) θ) + (hEdges : A'.edgeSet = A.edgeSet ∩ N.edgeSet) : + (A,B) ∈ inducedTangle G (imageHypergraph f g W) (imageHypergraphTangle f g T) θ := by + obtain ⟨p,hp,hPattern⟩ := hMem.2.2 + obtain ⟨⟨A₀,B₀⟩,h₀,hPair⟩ := hp + have hAE : g '' A₀.edgeSet = A'.edgeSet ∩ g '' W.edgeSet := + (congrArg (fun q => q.1.edgeSet) hPair).trans hPattern + refine ⟨hSep,hOrd,(imageHypergraph f g A₀,imageHypergraph f g B₀),?_,?_⟩ + · exact ⟨(A₀,B₀),h₀,rfl⟩ + · change g '' A₀.edgeSet = A.edgeSet ∩ g '' W.edgeSet + rw [hAE,hEdges,inter_assoc,inter_eq_right.mpr hChosen] + +/-- Inducing through an intermediate subgraph and the same chosen +edge map gives a subset of the tangle induced directly. -/ +theorem inducedTangle_subset_of_same_edge_pattern + {α : Type u} {α' : Type u₁} {ν : Type w} {ε : Type v₁} {β : Type v} + {κ : Type u₂} {κ' : Type u₃} (W : Hypergraph ν ε) + (G : Hypergraph α β) (N : Hypergraph α' β) + (f : ν → κ) (f' : ν → κ') (g : ε → β) + (T : Set (Hypergraph ν ε × Hypergraph ν ε)) (θ : ℕ) + (hChosen : g '' W.edgeSet ⊆ N.edgeSet) : + inducedTangle G N (inducedTangle N (imageHypergraph f' g W) + (imageHypergraphTangle f' g T) θ) θ ⊆ + inducedTangle G (imageHypergraph f g W) (imageHypergraphTangle f g T) θ := by + rintro ⟨A,B⟩ h + obtain ⟨⟨A',B'⟩,hMem,hEdges⟩ := h.2.2 + exact mem_inducedTangle_of_same_edge_pattern W G N f f' g hChosen h.1 h.2.1 hMem hEdges + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/InductionsProved.lean b/LeanPool/GraphMinor/GM16/InductionsProved.lean new file mode 100644 index 0000000000..1cdc075142 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/InductionsProved.lean @@ -0,0 +1,483 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section7ProperProof +import LeanPool.GraphMinor.GM16.Metric +import LeanPool.GraphMinor.GM16.Tower +import LeanPool.GraphMinor.GM16.Section8Main +import LeanPool.GraphMinor.GM16.Section6Proof +import LeanPool.GraphMinor.GM16.Section5Five +import LeanPool.GraphMinor.GM16.Section4Proof + +import LeanPool.GraphMinor.GM12.Bridge + +/-! +# The backward and surface-tower inductions of Graph Minors XVI + +Use the proved animal step and proper arrangement to obtain (6.1), then +remove hairs to get (5.1) and horns to get (4.1). The finite surface tower +combines (4.1) with the sphere span to obtain (3.1). Each induction uses +the earlier proofs directly. +-/ + +public section + +namespace GraphMinor.GM16 + +attribute [local instance] SurfaceTowerFor.topSpace SurfaceTowerFor.t2Space + +open Set Function Topology +open Graph SimpleGraph Hypergraph +open GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 GraphMinor.GM15 + +universe u v w u' v' + +/-- **Graph Minors XVI, (6.1)** (page 58, proved on page 63 from (7.1), (7.2), and (7.4)): +"Let $\Sigma$ be a surface, and let $p, \tau, \chi, \delta \ge 0$ and $\phi, \psi \ge 1$. Then there +exist $\sigma, \kappa, \rho, \zeta \ge 0$ and $\theta \ge 1$ such that if $\mathscr{T}^*$ is a +tangle +in a graph $G$, and there is an animal with $\chi$ horns and $\delta$ hairs, of strength +$\ge (\theta, \sigma)$, then either +1. there is a $\Sigma'$-span of order $\ge \phi$, for some surface $\Sigma'$ obtained from $\Sigma$ + by adding a handle or a crosscap, or +2. there is an animal with $\chi$ horns and $\delta + 1$ hairs, of strength $\ge (\psi, \tau)$, or +3. there exists $Z \subseteq V(G)$ with $|Z| \le \zeta$, and a $\mathscr{T}^* \setminus Z$-central + segregation of $G \setminus Z$ of type $(\rho, \kappa)$ with a proper arrangement in $\Sigma$, or +4. $\mathscr{T}^*$ controls a $K_p$-minor of $G$." -/ +theorem theorem_6_1_of_7_1_and_7_2 + : + GM16Theorem61Statement.{u, v, w} := by + intro S _ _ hS hconn p τ χ δ φ ψ hφ hψ + let φ' := max φ 3 + let ψ' := max ψ 3 + have hφ'3 : 3 ≤ φ' := le_max_right _ _ + have hψ'3 : 3 ≤ ψ' := le_max_right _ _ + obtain ⟨κ, lam, ρ, θ₂, hθ₂_pos, h72_prop⟩ := GraphMinor.GM16.theorem_7_2_proof.{u, v, w} hS hconn + p φ' (2 * ψ') + let θ' := max θ₂ p + have hθ'_pos : 1 ≤ θ' := le_trans hθ₂_pos (le_max_left _ _) + obtain ⟨θ, σ, hθ_pos, h71_prop⟩ := GraphMinor.GM16.theorem_7_1_proof.{u, v, w} hS hconn τ χ δ lam + θ' φ' ψ' hθ'_pos hφ'3 hψ'3 + let ζ := χ + δ ^ 2 * φ' ^ 2 / 2 + refine ⟨σ, κ, ρ, ζ, θ, hθ_pos, ?_⟩ + intro α β G θ_star T_star hT hAnim + rcases h71_prop G θ_star T_star hT hAnim with + ⟨S', htopS', ht2S', H', η', θ_span', T', hCS', hconnS', hHandle, hφ'_le, hSpan'⟩ | + hAnim_next | + ⟨Z, H_l, η_l, θ_l, T_l, d_l, hZ_sub, hZ_le, hZ_lt, hθ'_le, hLevel⟩ + · exact Or.inl ⟨S', htopS', ht2S', H', η', θ_span', T', hCS', hconnS', + Or.inl hHandle, (le_max_left _ _).trans hφ'_le, hSpan'⟩ + · exact Or.inr (Or.inl (hAnim_next.mono hψ (le_max_left _ _) le_rfl)) + · have hT_del : IsGraphTangle (GM09.deleteVertices G Z) (θ_star - Z.ncard) + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star) := + isGraphTangle_deleteGraphVerticesTangle hT hZ_sub hZ_lt + have hθ₂_le : θ₂ ≤ θ_l := (le_max_left _ _).trans hθ'_le + rcases h72_prop (GM09.deleteVertices G Z) (θ_star - Z.ncard) θ_l + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star) + H_l η_l T_l d_l hT_del hθ₂_le hLevel with + ⟨S', htopS', ht2S', H', η', θ_span', T', hCS', hconnS', hCross, hφ'_le, hSpan_del⟩ | + ⟨S_seg, α_disc, α_pt, hCent, hType, hProp⟩ | + hCtrl_del + · have hSpan_G : @IsSigmaSpan α β S' htopS' ht2S' G H' + (@liftSpanEmbedding S' htopS' α β H' (GM09.deleteVertices G Z) G η' + (G.induce_le sdiff_subset)) θ_star θ_span' T_star T' := + @theorem_7_4_proof S' htopS' ht2S' α β G θ_star θ_span' T_star hT Z H' η' T' hZ_sub hZ_lt + hSpan_del + exact Or.inl ⟨S', htopS', ht2S', H', + @liftSpanEmbedding S' htopS' α β H' (GM09.deleteVertices G Z) G η' + (G.induce_le sdiff_subset), + θ_span', T', hCS', hconnS', Or.inr hCross, (le_max_left _ _).trans hφ'_le, hSpan_G⟩ + · exact Or.inr (Or.inr (Or.inl ⟨Z, S_seg, α_disc, α_pt, + hZ_sub, hZ_le, hZ_lt, hCent, hType, hProp⟩)) + · have hp_le_del : V(completeGraph p).ncard ≤ θ_star - Z.ncard := by + rw [vertexSet_completeGraph_ncard] + have hp_le_θ' : p ≤ θ_l := (le_max_right _ _).trans hθ'_le + exact hp_le_θ'.trans hLevel.isSpan.isControlling.theta_le + exact Or.inr (Or.inr (Or.inr + (controlsMinor_of_deleteGraphVerticesTangle hT hZ_sub hZ_lt hp_le_del hCtrl_del))) + + +/-- Graph Minors XVI, (6.1), pages 58 and 63, from the proved animal +step (7.1), the proper arrangement theorem (7.2), and tangle deletion. -/ +theorem theorem_6_1_proof : GM16Theorem61Statement.{u, v, w} := + theorem_6_1_of_7_1_and_7_2 + +/-- **Graph Minors XVI, (5.1)** (page 55, proved on page 61 from (6.1) and (6.3)): +"Let $\Sigma$ be a surface and let $p, \tau, \chi \ge 0$ and $\phi, \psi \ge 1$. Then there exist +$\sigma, \kappa, \rho, \zeta \ge 0$ and $\theta \ge 1$ such that if $\mathscr{T}^*$ is a tangle in a +graph $G$, and there is a hairless animal with $\chi$ horns, of strength $\ge (\theta, \sigma)$, +then either: +1. there is a $\Sigma'$-span of order $\ge \phi$, for some surface $\Sigma'$ obtained from $\Sigma$ + by adding a handle or a crosscap, or +2. there is a hairless animal with $\chi + 1$ horns, of strength $\ge (\psi, \tau)$, or +3. there exists $Z \subseteq V(G)$ with $|Z| \le \zeta$, and a $\mathscr{T}^* \setminus Z$-central + segregation of $G \setminus Z$ of type $(\rho, \kappa)$ with a proper arrangement in $\Sigma$, or +4. $\mathscr{T}^*$ controls a $K_p$-minor of $G$." -/ +theorem theorem_5_1_of_6_1_and_6_3 + : + GM16Theorem51Statement.{u, v, w} := by + intro S _ _ hS hconn p τ χ φ ψ hφ hψ + obtain ⟨δ, θ_δ, hθ_δ_pos, h63_prop⟩ := GraphMinor.GM16.theorem_6_3_proof.{u, v, w} hS hconn p τ χ + ψ hψ + let σ_δ := τ + 1 + -- By backward induction from m = 0 (corresponding to i = δ hairs) to m = δ (corresponding to i = + -- 0 hairs): + have hind : ∀ m : ℕ, m ≤ δ → + ∃ σ_m κ_m ρ_m ζ_m θ_m : ℕ, 1 ≤ θ_m ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (hT : IsGraphTangle G θ_star T_star), + HasAnimal S G T_star θ_star χ (δ - m) θ_m σ_m → + (∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S') + (H' : Drawing S') (η' : SpanEmbedding H' G) (θ_span' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsClosedSurface S' ∧ ConnectedSpace S' ∧ + IsObtainedByAddingHandleOrCrosscap S S' ∧ + φ ≤ θ_span' ∧ IsSigmaSpan G H' η' θ_star θ_span' T_star T') ∨ + HasHairlessAnimal S G T_star θ_star (χ + 1) ψ τ ∨ + (∃ (Z : Set α) (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) (α_pt : α → S), + Z ⊆ V(G) ∧ Z.ncard ≤ ζ_m ∧ Z.ncard < θ_star ∧ + IsCentralSegregation (deleteVertices G Z) + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star) S_seg ∧ + IsSegregationOfType (deleteVertices G Z) ρ_m κ_m S_seg ∧ + IsProperArrangement S_seg α_disc α_pt) ∨ + ControlsMinor G (completeGraph p) T_star := by + intro m + induction m with + | zero => + intro _ + refine ⟨σ_δ, 0, 0, 0, θ_δ, hθ_δ_pos, ?_⟩ + intro α β G θ_star T_star hT hAnim + rw [Nat.sub_zero] at hAnim + rcases h63_prop G θ_star T_star hT hAnim with hOut2 | hOut4 + · exact Or.inr (Or.inl hOut2) + · exact Or.inr (Or.inr (Or.inr hOut4)) + | succ m ih => + intro hm_le + obtain ⟨σ_next, κ_next, ρ_next, ζ_next, θ_next, hθ_next_pos, hnext⟩ := ih (by omega) + let i := δ - (m + 1) + obtain ⟨σ_i, κ_i, ρ_i, ζ_i, θ_i, hθ_i_pos, h61_prop⟩ := + GraphMinor.GM16.theorem_6_1_proof.{u, v, w} hS hconn p σ_next χ i φ θ_next hφ hθ_next_pos + let κ_new := max κ_next κ_i + let ρ_new := max ρ_next ρ_i + let ζ_new := max ζ_next ζ_i + refine ⟨σ_i, κ_new, ρ_new, ζ_new, θ_i, hθ_i_pos, ?_⟩ + intro α β G θ_star T_star hT hAnim + rcases h61_prop G θ_star T_star hT hAnim with + hOut1 | hOut2 | ⟨Z, S_seg, α_disc, α_pt, hZ_sub, hZ_le, hZ_lt, hCent, hType, hProp⟩ | hOut4 + · exact Or.inl hOut1 + · have hi_succ : i + 1 = δ - m := by omega + rw [hi_succ] at hOut2 + rcases hnext G θ_star T_star hT hOut2 with + hOut1' | hOut2' | ⟨Z, S_seg, α_disc, α_pt, hZ_sub, hZ_le, hZ_lt, hCent, hType, hProp⟩ | + hOut4' + · exact Or.inl hOut1' + · exact Or.inr (Or.inl hOut2') + · exact Or.inr (Or.inr (Or.inl ⟨Z, S_seg, α_disc, α_pt, + hZ_sub, hZ_le.trans (le_max_left _ _), hZ_lt, hCent, + hType.mono (le_max_left _ _) (le_max_left _ _), hProp⟩)) + · exact Or.inr (Or.inr (Or.inr hOut4')) + · exact Or.inr (Or.inr (Or.inl ⟨Z, S_seg, α_disc, α_pt, + hZ_sub, hZ_le.trans (le_max_right _ _), hZ_lt, hCent, + hType.mono (le_max_right _ _) (le_max_right _ _), hProp⟩)) + · exact Or.inr (Or.inr (Or.inr hOut4)) + obtain ⟨σ₀, κ, ρ, ζ, θ₀, hθ₀_pos, hfull⟩ := hind δ le_rfl + refine ⟨σ₀, κ, ρ, ζ, θ₀, hθ₀_pos, ?_⟩ + intro α β G θ_star T_star hT hAnim + have hAnim₀ : HasAnimal S G T_star θ_star χ (δ - δ) θ₀ σ₀ := by + rw [Nat.sub_self] + exact hAnim + exact hfull G θ_star T_star hT hAnim₀ + + +/-- Graph Minors XVI, (5.1), pages 55 and 61, by the backward induction +on the number of hairs, using the proved (6.1) and (6.3). -/ +theorem theorem_5_1_proof : GM16Theorem51Statement.{u, v, w} := + theorem_5_1_of_6_1_and_6_3 + +/-- **Graph Minors XVI, (4.1)** (page 52, proved on page 58 from (5.1) and (5.5)): +"Let $\Sigma$ be a surface and let $p \ge 0$, $\phi \ge 1$. Then there exist $\kappa, \rho, \zeta +\ge 0$ +and $\theta \ge 1$ such that if $\mathscr{T}^*$ is a tangle in a graph $G$, and there is a +$\Sigma$-span of order $\ge \theta$, then either +• there is a $\Sigma'$-span of order $\ge \phi$, for some surface $\Sigma'$ obtained from $\Sigma$ + by adding a handle or crosscap, or +• there exists $Z \subseteq V(G)$ with $|Z| \le \zeta$, and a $\mathscr{T}^* \setminus Z$-central + segregation of $G \setminus Z$ of type $(\rho, \kappa)$ with a proper arrangement in $\Sigma$, or +• $\mathscr{T}^*$ controls a $K_p$ minor of $G$." -/ +theorem theorem_4_1_of_5_1_and_5_5 + : + GM16Theorem41Statement.{u, v, w} := by + intro S _ _ hS hconn p φ hφ + let μ := p * (p - 1) / 2 + obtain ⟨θ_μ, hθ_μ_pos, h55_prop⟩ := GraphMinor.GM16.theorem_5_5_proof.{u, v, w} hS hconn p + let σ_μ := 4 * p * (p - 1) + -- By backward induction from m = 0 (corresponding to i = μ) to m = μ (corresponding to i = 0): + -- For any m ≤ μ, there exist σ_m, κ_m, ρ_m, ζ_m ≥ 0 and θ_m ≥ 1 such that any hairless animal + -- with (μ - m) horns and strength ≥ (θ_m, σ_m) satisfies one of the three outcomes of (4.1). + have hind : ∀ m : ℕ, m ≤ μ → + ∃ σ_m κ_m ρ_m ζ_m θ_m : ℕ, 1 ≤ θ_m ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (hT : IsGraphTangle G θ_star T_star), + HasHairlessAnimal S G T_star θ_star (μ - m) θ_m σ_m → + (∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S') + (H' : Drawing S') (η' : SpanEmbedding H' G) (θ_span' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsClosedSurface S' ∧ ConnectedSpace S' ∧ + IsObtainedByAddingHandleOrCrosscap S S' ∧ + φ ≤ θ_span' ∧ IsSigmaSpan G H' η' θ_star θ_span' T_star T') ∨ + (∃ (Z : Set α) (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) (α_pt : α → S), + Z ⊆ V(G) ∧ Z.ncard ≤ ζ_m ∧ Z.ncard < θ_star ∧ + IsCentralSegregation (deleteVertices G Z) + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star) S_seg ∧ + IsSegregationOfType (deleteVertices G Z) ρ_m κ_m S_seg ∧ + IsProperArrangement S_seg α_disc α_pt) ∨ + ControlsMinor G (completeGraph p) T_star := by + intro m + induction m with + | zero => + intro _ + refine ⟨σ_μ, 0, 0, 0, θ_μ, hθ_μ_pos, ?_⟩ + intro α β G θ_star T_star hT hAnim + rw [Nat.sub_zero] at hAnim + exact Or.inr (Or.inr (h55_prop G θ_star T_star hT hAnim)) + | succ m ih => + intro hm_le + obtain ⟨σ_next, κ_next, ρ_next, ζ_next, θ_next, hθ_next_pos, hnext⟩ := ih (by omega) + let i := μ - (m + 1) + obtain ⟨σ_i, κ_i, ρ_i, ζ_i, θ_i, hθ_i_pos, h51_prop⟩ := + GraphMinor.GM16.theorem_5_1_proof.{u, v, w} hS hconn p σ_next i φ θ_next hφ hθ_next_pos + let κ_new := max κ_next κ_i + let ρ_new := max ρ_next ρ_i + let ζ_new := max ζ_next ζ_i + refine ⟨σ_i, κ_new, ρ_new, ζ_new, θ_i, hθ_i_pos, ?_⟩ + intro α β G θ_star T_star hT hAnim + rcases h51_prop G θ_star T_star hT hAnim with + hOut1 | hOut2 | ⟨Z, S_seg, α_disc, α_pt, hZ_sub, hZ_le, hZ_lt, hCent, hType, hProp⟩ | hOut4 + · exact Or.inl hOut1 + · have hi_succ : i + 1 = μ - m := by omega + rw [hi_succ] at hOut2 + rcases hnext G θ_star T_star hT hOut2 with + hOut1' | ⟨Z, S_seg, α_disc, α_pt, hZ_sub, hZ_le, hZ_lt, hCent, hType, hProp⟩ | hOut4' + · exact Or.inl hOut1' + · exact Or.inr (Or.inl ⟨Z, S_seg, α_disc, α_pt, + hZ_sub, hZ_le.trans (le_max_left _ _), hZ_lt, hCent, + hType.mono (le_max_left _ _) (le_max_left _ _), hProp⟩) + · exact Or.inr (Or.inr hOut4') + · exact Or.inr (Or.inl ⟨Z, S_seg, α_disc, α_pt, + hZ_sub, hZ_le.trans (le_max_right _ _), hZ_lt, hCent, + hType.mono (le_max_right _ _) (le_max_right _ _), hProp⟩) + · exact Or.inr (Or.inr hOut4) + obtain ⟨σ₀, κ, ρ, ζ, θ₀, hθ₀_pos, hfull⟩ := hind μ le_rfl + refine ⟨κ, ρ, ζ, θ₀, hθ₀_pos, ?_⟩ + intro α β G θ_star θ_span T_star H η T hT hθ₀_le hSpan + obtain ⟨d, hMet⟩ := exists_tangleMetric hS hSpan.isRespectful + have hAnim₀ : HasHairlessAnimal S G T_star θ_star (μ - μ) θ₀ σ₀ := by + rw [Nat.sub_self] + exact hasHairlessAnimal_zero_of_isSigmaSpan hθ₀_pos hθ₀_le hSpan hMet + exact hfull G θ_star T_star hT hAnim₀ + + +/-- Graph Minors XVI, (4.1), pages 52 and 58, by the backward induction +on the number of horns, using the proved (5.1) and (5.5). -/ +theorem theorem_4_1_proof : GM16Theorem41Statement.{u, v, w} := + theorem_4_1_of_5_1_and_5_5 + +/-- **Graph Minors XVI, (3.1)** (page 54, proved from (4.1), (4.2), (4.3), and Graph Minors XII, +(4.2)): +For any finite graph `L` with a surface tower `tower : SurfaceTowerFor L`, there exist +`κ, ρ, ζ ≥ 0` and `θ ≥ 1` such that any tangle `T` of order `≥ θ` in a graph `G` controlling no +`L`-minor admits `Z ⊆ V(G)` with `|Z| ≤ ζ` and a `T \ Z`-central segregation of `G \ Z` of type +`(ρ, κ)` with a proper arrangement in some surface in which `L` cannot be drawn. -/ +theorem theorem_3_1_of_tower + {α' : Type u'} {β' : Type v'} (L : Graph α' β') (hVL : V(L).Finite) (hEL : E(L).Finite) + (tower : SurfaceTowerFor.{u, v, w, u', v'} L) : + ∃ κ ρ ζ θ : ℕ, 1 ≤ θ ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_G : ℕ) + (T : Set (Hypergraph α β × Hypergraph α β)) + (hT : IsGraphTangle G θ_G T), + θ ≤ θ_G → ¬ ControlsMinor G L T → + ∃ (Z : Set α) (S_seg : Set (Society α β)) + (S : Type w) (_ : TopologicalSpace S) (_ : T2Space S) + (α_disc : Society α β → Set S) (α_pt : α → S), + Z ⊆ V(G) ∧ Z.ncard ≤ ζ ∧ Z.ncard < θ_G ∧ + IsClosedSurface S ∧ ConnectedSpace S ∧ ¬ CanBeDrawnIn S L ∧ + IsCentralSegregation (deleteVertices G Z) + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T θ_G) S_seg ∧ + IsSegregationOfType (deleteVertices G Z) ρ κ S_seg ∧ + IsProperArrangement S_seg α_disc α_pt := by + classical + have h43 : GM16Theorem43Statement.{u, v, w, u', v'} := theorem_4_3_proof + obtain ⟨p, hp_ctrl⟩ := GraphMinor.GM12.gm16_theorem42.{u, v, u', v'} L hVL hEL + -- Inductive step from k = 0 to tower.n: + -- For any m ≤ tower.n, there exist κ_m, ρ_m, ζ_m ≥ 0 and θ_fn : Fin tower.n → ℕ (with 1 ≤ θ_fn i) + -- such that if G has a (tower.Surf i)-span of order ≥ θ_fn i for some i with tower.n - m ≤ i.1, + -- and T controls no L-minor and has order ≥ max p V(L).ncard, then the desired segregation + -- exists. + have hind : ∀ m : ℕ, m ≤ tower.n → + ∃ (κ_m ρ_m ζ_m : ℕ) (θ_fn : Fin tower.n → ℕ), + (∀ i : Fin tower.n, 1 ≤ θ_fn i) ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_G : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (hT : IsGraphTangle G θ_G T_star), + p ≤ θ_G → ¬ ControlsMinor G L T_star → + ∀ (i : Fin tower.n), tower.n - m ≤ i.1 → + ∀ (H : Drawing (tower.Surf i)) (η : SpanEmbedding H G) (θ_span : ℕ) + (T : Set (Hypergraph (tower.Surf i) (Set (tower.Surf i)) × + Hypergraph (tower.Surf i) (Set (tower.Surf i)))), + θ_fn i ≤ θ_span → IsSigmaSpan G H η θ_G θ_span T_star T → + ∃ (Z : Set α) (S_seg : Set (Society α β)) + (S : Type w) (_ : TopologicalSpace S) (_ : T2Space S) + (α_disc : Society α β → Set S) (α_pt : α → S), + Z ⊆ V(G) ∧ Z.ncard ≤ κ_m + ρ_m + ζ_m ∧ Z.ncard ≤ ζ_m ∧ Z.ncard < θ_G ∧ + IsClosedSurface S ∧ ConnectedSpace S ∧ ¬ CanBeDrawnIn S L ∧ + IsCentralSegregation (deleteVertices G Z) + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_G) S_seg ∧ + IsSegregationOfType (deleteVertices G Z) ρ_m κ_m S_seg ∧ + IsProperArrangement S_seg α_disc α_pt := by + intro m + induction m with + | zero => + intro _ + refine ⟨0, 0, 0, fun _ => 1, fun _ => le_rfl, ?_⟩ + intro α β G θ_G T_star hT _ _ i hi + exact absurd i.2 (not_lt_of_ge (by omega)) + | succ m ih => + intro hm_le + obtain ⟨κ_prev, ρ_prev, ζ_prev, θ_prev, hθ_prev_pos, hprev⟩ := ih (by omega) + let idx_m : Fin tower.n := ⟨tower.n - (m + 1), by omega⟩ + let φ_m : ℕ := Finset.sup Finset.univ θ_prev + 1 + have hφ_pos : 1 ≤ φ_m := Nat.le_add_left 1 _ + have hφ_ge : ∀ j : Fin tower.n, θ_prev j ≤ φ_m := fun j => + (Finset.le_sup (f := θ_prev) (Finset.mem_univ j)).trans (Nat.le_succ _) + by_cases hdraw : CanBeDrawnIn (tower.Surf idx_m) L + · obtain ⟨θ_draw, hθ_draw_pos, hno_span⟩ := + h43 L (tower.isClosedSurface idx_m) (tower.isConnected idx_m) hVL hEL hdraw + let θ_new : Fin tower.n → ℕ := fun i => if i = idx_m then θ_draw else θ_prev i + refine ⟨κ_prev, ρ_prev, ζ_prev, θ_new, fun i => ?_, ?_⟩ + · dsimp [θ_new] + split_ifs + · exact hθ_draw_pos + · exact hθ_prev_pos i + · intro α β G θ_G T_star hT hp_le hnot_L i hi H η θ_span T hθ_le hSpan + by_cases hi_eq : i = idx_m + · subst hi_eq + have hθ_draw_le : θ_draw ≤ θ_span := by simpa [θ_new] using hθ_le + exact (hno_span G θ_G T_star H η θ_span T hT hnot_L hθ_draw_le hSpan).elim + · have hi_gt : tower.n - m ≤ i.1 := by + have : i.1 ≠ tower.n - (m + 1) := fun h => hi_eq (Fin.ext h) + omega + have hθ_prev_le : θ_prev i ≤ θ_span := by simpa [θ_new, hi_eq] using hθ_le + exact hprev G θ_G T_star hT hp_le hnot_L i hi_gt H η θ_span T hθ_prev_le hSpan + · obtain ⟨κ_cur, ρ_cur, ζ_cur, θ_cur, hθ_cur_pos, h41_prop⟩ := + GraphMinor.GM16.theorem_4_1_proof.{u, v, w} (tower.isClosedSurface idx_m) + (tower.isConnected idx_m) p φ_m hφ_pos + let κ_new := max κ_prev κ_cur + let ρ_new := max ρ_prev ρ_cur + let ζ_new := max ζ_prev ζ_cur + let θ_new : Fin tower.n → ℕ := fun i => if i = idx_m then θ_cur else θ_prev i + refine ⟨κ_new, ρ_new, ζ_new, θ_new, fun i => ?_, ?_⟩ + · dsimp [θ_new] + split_ifs + · exact hθ_cur_pos + · exact hθ_prev_pos i + · intro α β G θ_G T_star hT hp_le hnot_L i hi H η θ_span T hθ_le hSpan + by_cases hi_eq : i = idx_m + · subst hi_eq + have hθ_cur_le : θ_cur ≤ θ_span := by simpa [θ_new] using hθ_le + rcases h41_prop G θ_G θ_span T_star H η T hT hθ_cur_le hSpan with + ⟨S', htopS', ht2S', H', η', θ_span', T', hCS', hconnS', hAdd, hφ_le', hSpan'⟩ | + ⟨Z, S_seg, α_disc, α_pt, hZ_sub, hZ_le, hZ_lt, hCent, hType, hProp⟩ | + hCtrlKp + · obtain ⟨j, hij, H_j, η_j, θ_span_j, T_j, hφ_j, hSpan_j⟩ := + tower.step_index idx_m hdraw G θ_G φ_m T_star S' H' η' θ_span' T' + hCS' hconnS' hAdd hφ_le' hSpan' + have hj_ge : tower.n - m ≤ j.1 := by + have : idx_m.1 < j.1 := hij + dsimp [idx_m] at this + omega + have hθ_prev_j : θ_prev j ≤ θ_span_j := (hφ_ge j).trans hφ_j + obtain ⟨Z, S_seg, S_out, htop_out, ht2_out, α_disc, α_pt, + hZ_sub, _, hZ_le, hZ_lt, hCS_out, hconn_out, hnot_draw_out, + hCent, hType, hProp⟩ := + hprev G θ_G T_star hT hp_le hnot_L j hj_ge H_j η_j θ_span_j T_j hθ_prev_j hSpan_j + have hζ_le : Z.ncard ≤ ζ_new := hZ_le.trans (le_max_left _ _) + exact ⟨Z, S_seg, S_out, htop_out, ht2_out, α_disc, α_pt, + hZ_sub, by omega, hζ_le, hZ_lt, hCS_out, hconn_out, hnot_draw_out, + hCent, hType.mono (le_max_left _ _) (le_max_left _ _), hProp⟩ + · have hζ_le : Z.ncard ≤ ζ_new := hZ_le.trans (le_max_right _ _) + exact ⟨Z, S_seg, tower.Surf idx_m, tower.topSpace idx_m, tower.t2Space idx_m, + α_disc, α_pt, hZ_sub, by omega, hζ_le, hZ_lt, + tower.isClosedSurface idx_m, tower.isConnected idx_m, hdraw, + hCent, hType.mono (le_max_right _ _) (le_max_right _ _), hProp⟩ + · have hgm12_Kp : + GM12.ControlsMinor (Hypergraph.ofGraph G hT.finite_V hT.finite_E) θ_G T_star + (completeGraph p) := + gm12_controlsMinor_of_controlsMinor hT.finite_V hT.finite_E hCtrlKp + (by simpa using hp_le) + have hgm12_L := hp_ctrl G θ_G T_star hT hgm12_Kp + exact (hnot_L (controlsMinor_of_gm12 hgm12_L)).elim + · have hi_gt : tower.n - m ≤ i.1 := by + have : i.1 ≠ tower.n - (m + 1) := fun h => hi_eq (Fin.ext h) + omega + have hθ_prev_le : θ_prev i ≤ θ_span := by simpa [θ_new, hi_eq] using hθ_le + obtain ⟨Z, S_seg, S_out, htop_out, ht2_out, α_disc, α_pt, + hZ_sub, _, hZ_le, hZ_lt, hCS_out, hconn_out, hnot_draw_out, + hCent, hType, hProp⟩ := + hprev G θ_G T_star hT hp_le hnot_L i hi_gt H η θ_span T hθ_prev_le hSpan + have hζ_le : Z.ncard ≤ ζ_new := hZ_le.trans (le_max_left _ _) + exact ⟨Z, S_seg, S_out, htop_out, ht2_out, α_disc, α_pt, + hZ_sub, by omega, hζ_le, hZ_lt, hCS_out, hconn_out, hnot_draw_out, + hCent, hType.mono (le_max_left _ _) (le_max_left _ _), hProp⟩ + obtain ⟨κ, ρ, ζ, θ_fn, hθ_fn_pos, hfull⟩ := hind tower.n le_rfl + let i₀ : Fin tower.n := ⟨0, tower.one_le_n⟩ + obtain ⟨θ_star₀, hθ_star₀_pos, h42_prop⟩ := GraphMinor.GM16.theorem_4_2_proof.{u, v, w} (θ_fn i₀) + (hθ_fn_pos i₀) + let θ := max θ_star₀ p + refine ⟨κ, ρ, ζ, θ, le_trans hθ_star₀_pos (le_max_left _ _), ?_⟩ + intro α β G θ_G T hT hθ_le hnot_L + have hθ_star₀_le : θ_star₀ ≤ θ_G := (le_max_left _ _).trans hθ_le + have hp_le : p ≤ θ_G := (le_max_right _ _).trans hθ_le + obtain ⟨H₀, η₀, θ_span₀, T₀, hθ₀_le, hSpan₀⟩ := + h42_prop G θ_G T hT hθ_star₀_le (tower.Surf i₀) + (tower.isClosedSurface i₀) (tower.isConnected i₀) tower.isSphere_zero + obtain ⟨Z, S_seg, S_out, htop_out, ht2_out, α_disc, α_pt, + hZ_sub, _, hZ_le, hZ_lt, hCS_out, hconn_out, hnot_draw_out, hCent, hType, hProp⟩ := + hfull G θ_G T hT hp_le hnot_L i₀ (by omega) H₀ η₀ θ_span₀ T₀ hθ₀_le hSpan₀ + exact ⟨Z, S_seg, S_out, htop_out, ht2_out, α_disc, α_pt, + hZ_sub, hZ_le, hZ_lt, hCS_out, hconn_out, hnot_draw_out, hCent, hType, hProp⟩ + +/-- **Graph Minors XVI, (3.1)** (page 49, proved on page 54 from (4.1), (4.2), (4.3), and +Graph Minors XII, (4.2)): +"For any graph $L$, there are integers $\kappa, \rho, \zeta \ge 0$ and $\theta \ge 1$ with the +following property. Let $\mathscr{T}$ be a tangle of order $\ge \theta$ in a graph $G$, controlling +no $L$-minor of $G$. Then there exists $Z \subseteq V(G)$ with $|Z| \le \zeta$, and a +$\mathscr{T} \setminus Z$-central segregation of $G \setminus Z$ of type $(\rho, \kappa)$ which has +a +proper arrangement in some surface in which $L$ cannot be drawn." -/ +theorem theorem_3_1_of_statements + : + GM16Theorem31Statement.{u, v, w, u', v'} := by + intro α' β' L hVL hEL + obtain ⟨tower⟩ := GraphMinor.GM16.surfaceTower.{u, v, w, u', v'} L hVL hEL + exact theorem_3_1_of_tower L hVL hEL tower + + +/-- Graph Minors XVI, (3.1), pages 49 and 54, by induction over the +surface tower, starting with the proved sphere span (4.2) and using +the proved animal reduction (4.1). No result of XVI is assumed. -/ +theorem theorem_3_1_proof : GM16Theorem31Statement.{u, v, w, u', v'} := + theorem_3_1_of_statements + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/InnerOpenDisc.lean b/LeanPool/GraphMinor/GM16/InnerOpenDisc.lean new file mode 100644 index 0000000000..37d496053b --- /dev/null +++ b/LeanPool/GraphMinor/GM16/InnerOpenDisc.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.GM11.Section7 + +/-! +# Identifying the open inside of a circle in a disc + +An open connected set in a closed disc, with the same boundary as +an inner closed disc and missing the outer boundary, is the interior +of that inner disc. It is a component of the outer disc minus the +circle, and uniqueness of the inside determines that component. +This identifies the capturing open disc in XVI (8.1), Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface GraphMinor.GM11 +universe u +variable {S : Type u} [TopologicalSpace S] + +/-- The open inside is fixed by its circle and the containing disc. -/ +theorem open_set_eq_discInt_of_boundary {D E Ω : Set S} + (hD : IsClosedDisc D) (hE : IsClosedDisc E) (hED : E ⊆ D) + (hΩ : IsOpen Ω) (hConn : IsConnected Ω) (hΩD : Ω ⊆ D) + (hBd : frontier Ω = discBd E) (hDis : Disjoint Ω (discBd D)) : + Ω = discInt E := by + obtain ⟨E', hInside, hUnique⟩ := disc_oArc D (discBd E) hD + ((Surface.discBd_subset E).trans hED) hE.isOArc_discBd + have hEE' : E = E' := hUnique E hED hE rfl + subst E' + obtain ⟨x, hx⟩ := hConn.nonempty + have hΩF : Ω ⊆ D \ discBd E := by + intro z hz + refine ⟨hΩD hz, ?_⟩ + intro hzb + have hzf : z ∈ frontier Ω := hBd.symm ▸ hzb + exact hzf.2 (hΩ.interior_eq.symm ▸ hz) + have hxF := hΩF hx + let A := connectedComponentIn (D \ discBd E) x + have hAF : A ⊆ D \ discBd E := connectedComponentIn_subset _ _ + have hxA : x ∈ A := mem_connectedComponentIn hxF + have hCover : A ⊆ Ω ∪ (closure Ω)ᶜ := by + intro z hz + by_cases hzΩ : z ∈ Ω + · exact Or.inl hzΩ + · right + intro hzc + rw [closure_eq_self_union_frontier, hBd] at hzc + exact hzc.elim hzΩ (hAF hz).2 + have hAΩ : A ⊆ Ω := + isPreconnected_connectedComponentIn.subset_left_of_subset_union hΩ + isClosed_closure.isOpen_compl + (disjoint_left.mpr fun z hz hn => hn (subset_closure hz)) hCover ⟨x, hxA, hx⟩ + have hΩA : Ω ⊆ A := hConn.isPreconnected.subset_connectedComponentIn hx hΩF + have hAeq : A = Ω := hAΩ.antisymm hΩA + have hComp : Ω ∈ componentsIn (D \ discBd E) := by + exact ⟨x, hxF, hAeq⟩ + exact hInside.2.2.2.2.2 Ω hComp hDis + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/IntervalTiling.lean b/LeanPool/GraphMinor/GM16/IntervalTiling.lean new file mode 100644 index 0000000000..d8623600f2 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/IntervalTiling.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Data.Set.Lattice.Bounded +public import Mathlib.Data.Set.Lattice.Indexed +public import Mathlib.Data.Set.Lattice.Image +public import Mathlib.Basic.Real.Basic +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Ring +import Mathlib.Order.Interval.Set.Nat +import Mathlib.Order.Lattice.Nat + +/-! +# Tiling a horizontal interval by width-two intervals + +The bricks in one row cover that row's closed rectangle. The +one-dimensional calculation joins consecutive width-two intervals, +then takes their product with the common vertical interval. This +is used to cover the enclosed wall disc by its closed bricks in +XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set + +/-- Consecutive nonnegative-width intervals cover their full interval. -/ +theorem interval_eq_union_step (a d : ℝ) (hd : 0 ≤ d) {n : ℕ} (hn : 1 ≤ n) : + Icc a (a+d*(n : ℝ)) = ⋃ k < n, Icc (a+d*(k : ℝ)) (a+d*(k : ℝ)+d) := by + induction n with + | zero => omega + | succ n ih => + by_cases hn0 : n = 0 + · subst n + simp + have hn1 : 1 ≤ n := by omega + rw [biUnion_lt_succ,← ih hn1] + have hNonneg : 0 ≤ d*(n : ℝ) := mul_nonneg hd (Nat.cast_nonneg _) + have hEq : a+d*((n+1 : ℕ) : ℝ) = a+d*(n : ℝ)+d := by + simp only [Nat.cast_add,Nat.cast_one] + ring + rw [hEq] + exact (Icc_union_Icc_eq_Icc (by linarith) (by linarith)).symm + +/-- Consecutive closed intervals of width two cover their full interval. -/ +theorem interval_eq_union_width_two (a : ℝ) {n : ℕ} (hn : 1 ≤ n) : + Icc a (a+2*(n : ℝ)) = ⋃ k < n, Icc (a+2*(k : ℝ)) (a+2*(k : ℝ)+2) := + interval_eq_union_step a 2 (by norm_num) hn + +/-- The unit intervals from zero to a positive integer cover that interval. -/ +theorem interval_eq_union_unit {n : ℕ} (hn : 1 ≤ n) : + Icc (0 : ℝ) (n : ℝ) = ⋃ k < n, Icc (k : ℝ) ((k : ℝ)+1) := by + simpa only [zero_add,one_mul] using interval_eq_union_step 0 1 (by norm_num) hn + +/-- Taking a common vertical interval gives the closed rectangles in a row. -/ +theorem rectangle_eq_union_width_two (a c d : ℝ) {n : ℕ} (hn : 1 ≤ n) : + Icc a (a+2*(n : ℝ)) ×ˢ Icc c d = + ⋃ k < n, Icc (a+2*(k : ℝ)) (a+2*(k : ℝ)+2) ×ˢ Icc c d := by + rw [interval_eq_union_width_two a hn] + ext p + constructor + · rintro ⟨hx,hy⟩ + obtain ⟨k,hk,hx⟩ := mem_iUnion₂.mp hx + exact mem_iUnion₂.mpr ⟨k,hk,hx,hy⟩ + · intro hp + obtain ⟨k,hk,hx,hy⟩ := mem_iUnion₂.mp hp + exact ⟨mem_iUnion₂.mpr ⟨k,hk,hx⟩,hy⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/LatticeLineIntersections.lean b/LeanPool/GraphMinor/GM16/LatticeLineIntersections.lean new file mode 100644 index 0000000000..2b9d021963 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/LatticeLineIntersections.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.LatticeLines +import Mathlib.Tactic.Linarith + +/-! +# Intersections of unit lattice lines + +Distinct parallel unit lines can meet only at their ends. A horizontal +and a vertical line can meet only at the lattice point formed by their +fixed coordinates. These checks ensure that the planar wall edges in +XVI (4.2), page 53, meet only at the prescribed grid vertices. +-/ + +public section +namespace GraphMinor.GM16 +open Set + +/-- Two different horizontal unit lines meet only at an end of the +first one. -/ +theorem horizontalLatticeLine_inter {i j k l : ℕ} (hne : (i, j) ≠ (k, l)) + {x : ℝ × ℝ} (hx : x ∈ horizontalLatticeLine i j ∩ horizontalLatticeLine k l) : + x = latticePoint (i,j) ∨ x = latticePoint (i+1,j) := by + have hj : j = l := Nat.cast_injective ((show x.2 = (j : ℝ) from hx.1.2).symm.trans hx.2.2) + have hiLo : (i : ℝ) ≤ x.1 := hx.1.1.1 + have hiHi : x.1 ≤ (i : ℝ) + 1 := hx.1.1.2 + have hkLo : (k : ℝ) ≤ x.1 := hx.2.1.1 + have hkHi : x.1 ≤ (k : ℝ) + 1 := hx.2.1.2 + rcases lt_trichotomy i k with hik | hik | hki + · have hNat : i + 1 ≤ k := by omega + have hReal : (i : ℝ) + 1 ≤ (k : ℝ) := by exact_mod_cast hNat + right + apply Prod.ext + · have hEq : x.1 = (i : ℝ) + 1 := by linarith + simpa only [latticePoint,Nat.cast_add,Nat.cast_one] using hEq + · exact hx.1.2 + · exact (hne (Prod.ext hik hj)).elim + · have hNat : k + 1 ≤ i := by omega + have hReal : (k : ℝ) + 1 ≤ (i : ℝ) := by exact_mod_cast hNat + left + exact Prod.ext (by change x.1 = (i : ℝ); linarith) hx.1.2 + +/-- Two different vertical unit lines meet only at an end of the +first one. -/ +theorem verticalLatticeLine_inter {i j k l : ℕ} (hne : (i, j) ≠ (k, l)) + {x : ℝ × ℝ} (hx : x ∈ verticalLatticeLine i j ∩ verticalLatticeLine k l) : + x = latticePoint (i,j) ∨ x = latticePoint (i,j+1) := by + have hne' : (j,i) ≠ (l,k) := fun heq => hne + (Prod.ext (congrArg Prod.snd heq) (congrArg Prod.fst heq)) + have hSwap : Prod.swap x ∈ horizontalLatticeLine j i ∩ horizontalLatticeLine l k := + ⟨⟨hx.1.2,hx.1.1⟩,⟨hx.2.2,hx.2.1⟩⟩ + rcases horizontalLatticeLine_inter hne' hSwap with h | h + · left + exact Prod.ext (congrArg Prod.snd h) (congrArg Prod.fst h) + · right + exact Prod.ext (congrArg Prod.snd h) (congrArg Prod.fst h) + +/-- A horizontal and a vertical unit line meet at a lattice point. -/ +theorem horizontal_vertical_LatticeLine_inter {i j k l : ℕ} {x : ℝ × ℝ} + (hx : x ∈ horizontalLatticeLine i j ∩ verticalLatticeLine k l) : + x = latticePoint (k,j) := Prod.ext hx.2.1 hx.1.2 + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/LatticeLines.lean b/LeanPool/GraphMinor/GM16/LatticeLines.lean new file mode 100644 index 0000000000..ed76d0e47f --- /dev/null +++ b/LeanPool/GraphMinor/GM16/LatticeLines.lean @@ -0,0 +1,112 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.ArcDrawings +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.NormNum + +/-! +# Unit lattice lines for the wall drawing + +The planar wall in XVI (4.2), page 53, uses horizontal and vertical +unit segments between lattice points. Parametrising each interval +proves that it is a line with the intended ends. The coordinate +lemmas below describe which lattice points lie on such a line. +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +/-- A lattice point in the real coordinate plane. -/ +def latticePoint (p : ℕ × ℕ) : ℝ × ℝ := (p.1,p.2) + +/-- The horizontal unit line starting at `(i,j)`. -/ +def horizontalLatticeLine (i j : ℕ) : Set (ℝ × ℝ) := + Icc (i : ℝ) ((i : ℝ) + 1) ×ˢ {(j : ℝ)} + +/-- The vertical unit line starting at `(i,j)`. -/ +def verticalLatticeLine (i j : ℕ) : Set (ℝ × ℝ) := + {(i : ℝ)} ×ˢ Icc (j : ℝ) ((j : ℝ) + 1) + +/-- A horizontal lattice segment is a line with its indicated ends. -/ +theorem horizontalLatticeLine_isLine (i j : ℕ) : + IsLineWithEnds (horizontalLatticeLine i j) (latticePoint (i,j)) (latticePoint (i+1,j)) := by + let p : ℝ → ℝ × ℝ := fun t => ((i : ℝ) + t, j) + have hp : Continuous p := by fun_prop + have hi : InjOn p (Icc (0 : ℝ) 1) := by + intro s _ t _ heq + have h := congrArg Prod.fst heq + dsimp only [p] at h + linarith + have hImage : p '' Icc (0 : ℝ) 1 = horizontalLatticeLine i j := by + ext x + constructor + · rintro ⟨t,ht,rfl⟩ + exact ⟨⟨by dsimp only [p]; linarith [ht.1], by dsimp only [p]; linarith [ht.2]⟩, rfl⟩ + · rintro ⟨hx,hj⟩ + refine ⟨x.1 - i,⟨by linarith [hx.1],by linarith [hx.2]⟩,?_⟩ + apply Prod.ext + · dsimp only [p] + linarith + · exact hj.symm + have h := isLine_of_injOn hp (by norm_num : (0 : ℝ) < 1) hi + simpa only [hImage,p,latticePoint,Nat.cast_add,Nat.cast_one,add_zero] using h + +/-- A vertical lattice segment is a line with its indicated ends. -/ +theorem verticalLatticeLine_isLine (i j : ℕ) : + IsLineWithEnds (verticalLatticeLine i j) (latticePoint (i,j)) (latticePoint (i,j+1)) := by + let p : ℝ → ℝ × ℝ := fun t => (i, (j : ℝ) + t) + have hp : Continuous p := by fun_prop + have hi : InjOn p (Icc (0 : ℝ) 1) := by + intro s _ t _ heq + have h := congrArg Prod.snd heq + dsimp only [p] at h + linarith + have hImage : p '' Icc (0 : ℝ) 1 = verticalLatticeLine i j := by + ext x + constructor + · rintro ⟨t,ht,rfl⟩ + exact ⟨rfl,⟨by dsimp only [p]; linarith [ht.1],by dsimp only [p]; linarith [ht.2]⟩⟩ + · rintro ⟨hi,hx⟩ + refine ⟨x.2 - j,⟨by linarith [hx.1],by linarith [hx.2]⟩,?_⟩ + apply Prod.ext + · exact hi.symm + · dsimp only [p] + linarith + have h := isLine_of_injOn hp (by norm_num : (0 : ℝ) < 1) hi + simpa only [hImage,p,latticePoint,Nat.cast_add,Nat.cast_one,add_zero] using h + +/-- The only lattice points on a horizontal unit line are its ends. -/ +theorem latticePoint_mem_horizontal {i j k l : ℕ} + (h : latticePoint (k, l) ∈ horizontalLatticeLine i j) : + (k,l) = (i,j) ∨ (k,l) = (i+1,j) := by + have hj : l = j := Nat.cast_injective h.2 + have hloR : (i : ℝ) ≤ (k : ℝ) := h.1.1 + have hhiR : (k : ℝ) ≤ (i : ℝ) + 1 := h.1.2 + have hlo : i ≤ k := by exact_mod_cast hloR + have hhi : k ≤ i + 1 := by exact_mod_cast hhiR + have hk : k = i ∨ k = i + 1 := by omega + exact hk.elim (fun heq => Or.inl (Prod.ext heq hj)) (fun heq => Or.inr (Prod.ext heq hj)) + +/-- The only lattice points on a vertical unit line are its ends. -/ +theorem latticePoint_mem_vertical {i j k l : ℕ} + (h : latticePoint (k, l) ∈ verticalLatticeLine i j) : + (k,l) = (i,j) ∨ (k,l) = (i,j+1) := by + have hi : k = i := Nat.cast_injective h.1 + have hloR : (j : ℝ) ≤ (l : ℝ) := h.2.1 + have hhiR : (l : ℝ) ≤ (j : ℝ) + 1 := h.2.2 + have hlo : j ≤ l := by exact_mod_cast hloR + have hhi : l ≤ j + 1 := by exact_mod_cast hhiR + have hl : l = j ∨ l = j + 1 := by omega + exact hl.elim (fun heq => Or.inl (Prod.ext hi heq)) (fun heq => Or.inr (Prod.ext hi heq)) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/LeftBrickArcContainment.lean b/LeanPool/GraphMinor/GM16/LeftBrickArcContainment.lean new file mode 100644 index 0000000000..9a13ef85ba --- /dev/null +++ b/LeanPool/GraphMinor/GM16/LeftBrickArcContainment.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.LeftRectangleArc +import Mathlib.Tactic.Linarith + +/-! +# The part of a left brick boundary outside the central rectangle + +A left brick has width two. A boundary point outside the common +central open rectangle either lies at horizontal coordinate at +most one, or on the global top or bottom. The first points lie +on the three short sides. At a top or bottom corner the corresponding +horizontal side extends to width two. This is the boundary arc +shared with the outside face in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- The boundary points of a left brick outside the central rectangle +lie on its three-sided outer arc. -/ +theorem left_brick_boundary_outside_central_subset_arc {M H y : ℝ} + (hM : 3 < M) (hy : 0 ≤ y) (hyH : y + 1 ≤ H) {p : ℝ × ℝ} + (hpFr : p ∈ frontier (Icc (0 : ℝ) 2 ×ˢ Icc y (y + 1))) + (hpOut : p ∉ Ioo (1 : ℝ) (M - 1) ×ˢ Ioo (0 : ℝ) H) : + p ∈ leftRectangleBoundaryArc 0 (if y=0 then 2 else 1) + (if y+1=H then 2 else 1) y (y+1) := by + have hpB := (isClosed_Icc.prod isClosed_Icc).frontier_subset hpFr + have hEdges : p.2=y ∨ p.2=y+1 ∨ p.1=0 ∨ p.1=2 := by + rw [frontier_prod_eq,isClosed_Icc.closure_eq,isClosed_Icc.closure_eq, + frontier_Icc (by norm_num : (0 : ℝ)≤2),frontier_Icc (by linarith : y≤y+1)] at hpFr + rcases hpFr with ⟨_,hpY⟩ | ⟨hpX,_⟩ + · rcases hpY with h | h + · exact Or.inl h + · exact Or.inr (Or.inl h) + · rcases hpX with h | h + · exact Or.inr (Or.inr (Or.inl h)) + · exact Or.inr (Or.inr (Or.inr h)) + have hb₁ : (1 : ℝ) ≤ (if y=0 then 2 else 1) := by split_ifs <;> norm_num + have ht₁ : (1 : ℝ) ≤ (if y+1=H then 2 else 1) := by split_ifs <;> norm_num + change p ∈ ((Icc 0 (if y=0 then 2 else 1) ×ˢ {y}) ∪ ({0} ×ˢ Icc y (y+1))) ∪ + (Icc 0 (if y+1=H then 2 else 1) ×ˢ {y+1}) + by_cases hLow : p.1 ≤ 1 + · rcases hEdges with h | h | h | h + · exact Or.inl (Or.inl ⟨⟨hpB.1.1,hLow.trans hb₁⟩,h⟩) + · exact Or.inr ⟨⟨hpB.1.1,hLow.trans ht₁⟩,h⟩ + · exact Or.inl (Or.inr ⟨h,hpB.2⟩) + · exact (by linarith : False).elim + · have hHigh : 1 < p.1 := lt_of_not_ge hLow + have hOutsideY : p.2 ≤ 0 ∨ H ≤ p.2 := by + by_cases hY : 0 < p.2 + · right + by_contra hn + exact hpOut ⟨⟨hHigh,by linarith [hpB.1.2]⟩,hY,lt_of_not_ge hn⟩ + · exact Or.inl (le_of_not_gt hY) + rcases hOutsideY with hBot | hTop + · have hy0 : y=0 := by linarith [hpB.2.1] + have hpY : p.2=y := by linarith [hpB.2.1] + rw [ite_eq_left hy0] + exact Or.inl (Or.inl ⟨hpB.1,hpY⟩) + · have hyTop : y+1=H := by linarith [hpB.2.2] + have hpY : p.2=y+1 := by linarith [hpB.2.2] + rw [ite_eq_left hyTop] + exact Or.inr ⟨hpB.1,hpY⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/LeftRectangleArc.lean b/LeanPool/GraphMinor/GM16/LeftRectangleArc.lean new file mode 100644 index 0000000000..c6afdfc565 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/LeftRectangleArc.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM16.RectangularLines +import LeanPool.GraphMinor.Surface.ArcTools + +/-! +# A line around the left side of a rectangle + +Join a bottom horizontal side, the left vertical side, and a top +horizontal side. Consecutive sides meet only in their common end, +so their union is a line. Different horizontal lengths allow the +corner bricks at the top or bottom of the wall as well as its +intermediate bricks in XVI (4.2). +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Surface + +/-- The three sides of a left boundary arc, with independently chosen +bottom and top horizontal lengths. -/ +def leftRectangleBoundaryArc (x bottom top y z : ℝ) : Set (ℝ × ℝ) := + ((Icc x bottom ×ˢ {y}) ∪ ({x} ×ˢ Icc y z)) ∪ (Icc x top ×ˢ {z}) + +/-- The three sides form a line from the bottom right end to the top right end. -/ +theorem leftRectangleBoundaryArc_isLine {x bottom top y z : ℝ} + (hBottom : x < bottom) (hTop : x < top) (hyz : y < z) : + IsLineWithEnds (leftRectangleBoundaryArc x bottom top y z) (bottom,y) (top,z) := by + have hB := (horizontal_interval_isLine hBottom y).symm + have hV := vertical_interval_isLine x hyz + have hT := horizontal_interval_isLine hTop z + have hMeet₁ : (Icc x bottom ×ˢ {y}) ∩ ({x} ×ˢ Icc y z) = {(x,y)} := by + ext p + constructor + · rintro ⟨hpB,hpV⟩ + exact mem_singleton_iff.mpr (Prod.ext hpV.1 hpB.2) + · intro hp + rw [mem_singleton_iff] at hp + subst p + exact ⟨⟨⟨le_rfl,hBottom.le⟩,rfl⟩,⟨rfl,le_rfl,hyz.le⟩⟩ + have hMeet₂ : ((Icc x bottom ×ˢ {y}) ∪ ({x} ×ˢ Icc y z)) ∩ + (Icc x top ×ˢ {z}) = {(x,z)} := by + ext p + constructor + · rintro ⟨hp,hpT⟩ + rcases hp with hpB | hpV + · exact (hyz.ne (hpB.2.symm.trans hpT.2)).elim + · exact mem_singleton_iff.mpr (Prod.ext hpV.1 hpT.2) + · intro hp + rw [mem_singleton_iff] at hp + subst p + exact ⟨Or.inr ⟨rfl,hyz.le,le_rfl⟩,⟨le_rfl,hTop.le⟩,rfl⟩ + exact (hB.union hV hMeet₁).union hT hMeet₂ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/LineBoundarySide.lean b/LeanPool/GraphMinor/GM16/LineBoundarySide.lean new file mode 100644 index 0000000000..1df1b1abe3 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/LineBoundarySide.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.Fan +import LeanPool.GraphMinor.GM11.Section7 +import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.GM14.DiscSlope + +/-! +# Which side of a boundary contains a path + +A line with only one point on a boundary stays on the side containing +its other end. Remove the boundary end, use connectedness, and add +that end back. This justifies trimming the battlefield paths into the +annulus in XVI (8.1), Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface GraphMinor.GM11 +universe u +variable {S : Type u} [TopologicalSpace S] + +/-- A line starting inside a closed set and meeting its frontier only +at its last end stays in the closed set. -/ +theorem line_subset_closed_of_boundary_end {L D : Set S} {a b : S} + (hD : IsClosed D) (hL : IsLineWithEnds L a b) + (ha : a ∈ D) (hab : a ≠ b) (hb : b ∈ D) + (hbd : L ∩ frontier D ⊆ {b}) : L ⊆ D := by + have hconn : IsPreconnected (L \ {b}) := GraphMinor.GM11.IsLineWithEnds.isPreconnected_sdiff + (Surface.IsLineWithEnds.symm hL) + have hdis : Disjoint (L \ {b}) (frontier D) := by + apply disjoint_left.mpr + intro x hx hxf + exact hx.2 (hbd ⟨hx.1, hxf⟩) + have hsub : L \ {b} ⊆ D := + (GraphMinor.GM14.subset_or_disjoint_of_frontier hD hconn hdis).resolve_right + (fun hd => hd.notMem_of_mem_left ⟨hL.left_mem, hab⟩ ha) + intro x hx + by_cases hxb : x = b + · exact hxb ▸ hb + · exact hsub ⟨hx, hxb⟩ + +/-- A line ending outside a closed set and meeting its frontier only +at its first end avoids the interior of the closed set. -/ +theorem line_avoids_interior_of_boundary_start {L D : Set S} {a b : S} + (hD : IsClosed D) (hL : IsLineWithEnds L a b) + (ha : a ∈ frontier D) (hb : b ∉ D) + (hbd : L ∩ frontier D ⊆ {a}) : Disjoint L (interior D) := by + have hconn : IsPreconnected (L \ {a}) := GraphMinor.GM11.IsLineWithEnds.isPreconnected_sdiff hL + have hdis : Disjoint (L \ {a}) (frontier D) := by + apply disjoint_left.mpr + intro x hx hxf + exact hx.2 (hbd ⟨hx.1, hxf⟩) + have hba : b ≠ a := fun heq => hb (heq.symm ▸ hD.frontier_subset ha) + have hout : Disjoint (L \ {a}) D := + (GraphMinor.GM14.subset_or_disjoint_of_frontier hD hconn hdis).resolve_left + (fun hs => hb (hs ⟨hL.right_mem, hba⟩)) + apply disjoint_left.mpr + intro x hx hxi + by_cases hxa : x = a + · exact ha.2 (hxa ▸ hxi) + · exact hout.notMem_of_mem_left ⟨hx, hxa⟩ (interior_subset hxi) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/LineClosedExtension.lean b/LeanPool/GraphMinor/GM16/LineClosedExtension.lean new file mode 100644 index 0000000000..16417c709a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/LineClosedExtension.lean @@ -0,0 +1,34 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.RadialChord + +/-! +# Extending line containment to its ends + +The closure of a line without its two ends is the whole line. +Thus containment of its open part in a closed set includes the +ends as well. This lets the coordinate checks for the outside +wall sides work first away from their corners. +-/ + +public section +namespace GraphMinor.GM16 +open Set Surface GM11 + +/-- A closed set containing the open part of a line contains the whole line. -/ +theorem line_subset_closed_of_open_part_subset {S : Type*} + [TopologicalSpace S] [T2Space S] {L C : Set S} {a b : S} + (hL : IsLineWithEnds L a b) (hC : IsClosed C) (hSub : L \ {a,b} ⊆ C) : L ⊆ C := by + rw [← closure_sdiff_pair hL] + exact closure_minimal hSub hC + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/LineConnectedSubset.lean b/LeanPool/GraphMinor/GM16/LineConnectedSubset.lean new file mode 100644 index 0000000000..ecebc32a3d --- /dev/null +++ b/LeanPool/GraphMinor/GM16/LineConnectedSubset.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Connected subsets containing both ends of a line + +A preconnected subset of a line that contains both ends contains the +whole line. Pulling the subset back to the unit interval proves this +by the interval property of preconnected sets. This supplies the +point set comparison for paths in the proof of XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- The point set of a line is preconnected. -/ +theorem isPreconnected_of_isLineWithEnds {S : Type*} [TopologicalSpace S] + {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) : IsPreconnected L := + GraphMinor.Surface.IsLineWithEnds.isPreconnected hL + +/-- A preconnected subset containing both ends of a line is the whole line. -/ +theorem eq_line_of_preconnected_subset {S : Type*} [TopologicalSpace S] + {L T : Set S} {a b : S} (hL : IsLineWithEnds L a b) + (hTL : T ⊆ L) (hT : IsPreconnected T) (ha : a ∈ T) (hb : b ∈ T) : T = L := by + obtain ⟨e, he₀, he₁⟩ := hL + let p : unitInterval → S := fun t => (e t).val + have hp : IsEmbedding p := IsEmbedding.subtypeVal.comp e.isEmbedding + let K := p ⁻¹' T + have himage : p '' K = T := by + ext z + constructor + · rintro ⟨t, ht, rfl⟩ + exact ht + · intro hz + refine ⟨e.symm ⟨z, hTL hz⟩, ?_, ?_⟩ + · change (e (e.symm ⟨z, hTL hz⟩)).val ∈ T + simpa only [e.apply_symm_apply] using hz + · exact congrArg Subtype.val (e.apply_symm_apply _) + have hK : IsPreconnected K := hp.isInducing.isPreconnected_image.mp (himage.symm ▸ hT) + have h₀ : (0 : unitInterval) ∈ K := by + change (e 0).val ∈ T + simpa only [he₀] using ha + have h₁ : (1 : unitInterval) ∈ K := by + change (e 1).val ∈ T + simpa only [he₁] using hb + apply subset_antisymm hTL + intro z hz + let t := e.symm ⟨z, hz⟩ + have ht : t ∈ K := hK.Icc_subset h₀ h₁ ⟨bot_le, le_top⟩ + have hpz : p t = z := congrArg Subtype.val (e.apply_symm_apply _) + exact hpz ▸ ht + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/LineDial.lean b/LeanPool/GraphMinor/GM16/LineDial.lean new file mode 100644 index 0000000000..6520baad87 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/LineDial.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM16.LineDrawingPath +import LeanPool.GraphMinor.Surface.SurfaceGraph +import LeanPool.GraphMinor.GM14.Section6a +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.Surface.DiscsInSurface + +/-! +# Dials whose intersection with a drawing is a line + +In the sphere-wall proof of XVI (4.2), a disc bounded by a normal +circle either misses the drawing in its interior, or meets it in +a line between the two boundary vertices. In the latter case the +restricted drawing is a path, by the line-to-path lemma. This file +supplies that last conversion without a graph connectivity assumption. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface GM11 GM14 + +/-- A disc meeting the drawing in a line joining its two boundary +vertices satisfies the second alternative in the definition of a dial. -/ +theorem isDial_of_line_intersection {S : Type*} [TopologicalSpace S] [T2Space S] + {H : Drawing S} {F Δ : Set S} {a b : S} + (hΔ : IsClosedDisc Δ) (hbd : subBd Δ = F) + (hNormal : F ∩ H.U ⊆ H.V) (hab : a ≠ b) + (hEnds : F ∩ H.V = {a,b}) (hLine : IsLineWithEnds (H.U ∩ Δ) a b) : + IsDial H F Δ := by + obtain ⟨hV,hU⟩ := interSet_V_and_U hΔ.isClosed (hbd.symm ▸ hNormal) + have ha : a ∈ (H.interSet Δ).V := by + rw [hV] + exact ⟨(hEnds.symm ▸ (show a ∈ ({a,b} : Set S) from mem_insert _ _)).2, + hLine.left_mem.2⟩ + have hb : b ∈ (H.interSet Δ).V := by + rw [hV] + exact ⟨(hEnds.symm ▸ (show b ∈ ({a,b} : Set S) from mem_insert_of_mem _ rfl)).2, + hLine.right_mem.2⟩ + refine ⟨hΔ,hbd,Or.inr ⟨a,b,hab,hEnds,?_⟩⟩ + exact drawing_isPathBetween_of_isLine_U (hU.symm ▸ hLine) hab ha hb + +/-- A circle contained in a closed disc whose interior misses the drawing +bounds a dial with no drawing in its interior. This is the one-face case +of the rigidity check in XVI (4.2). -/ +theorem exists_isDial_of_circle_in_empty_disc {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H : Drawing S} {F C : Set S} + (hC : IsClosedDisc C) (hF : IsOArc F) (hFC : F ⊆ C) + (hEmpty : Disjoint (interior C) H.U) : ∃ Δ, IsDial H F Δ := by + obtain ⟨Δ, ⟨hΔC, hΔ, hbd, _⟩, _⟩ := disc_oArc C F hC hFC hF + have hfront : frontier Δ = F := (GM11.IsClosedDisc.frontier_eq_discBd hS hΔ).trans hbd + refine ⟨Δ, hΔ, (subBd_eq_frontier Δ).trans hfront, Or.inl ?_⟩ + rintro x ⟨hxΔ, hxH⟩ + by_contra hxF + have hxInt : x ∈ interior Δ := by + by_contra hn + have hxFr : x ∈ frontier Δ := ⟨subset_closure hxΔ, hn⟩ + exact hxF (hfront ▸ hxFr) + exact (disjoint_left.mp hEmpty) (interior_mono hΔC hxInt) hxH + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/LineDrawingPath.lean b/LeanPool/GraphMinor/GM16/LineDrawingPath.lean new file mode 100644 index 0000000000..7850359f7e --- /dev/null +++ b/LeanPool/GraphMinor/GM16/LineDrawingPath.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM16.DrawingPointConnectivity +import LeanPool.GraphMinor.GM16.LineConnectedSubset +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.Rotation +import LeanPool.GraphMinor.GM09.Basic + +/-! +# A drawing supported on a line is a path + +Join the two ends by a simple graph walk. Its drawing is a subdrawing +supported on a subline with the same ends. The interval property forces +that subline to be the whole line. A subdrawing with the same support +has all vertices and hence is the original drawing. This justifies the +path condition in the rigidity argument of XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface GM11 + +/-- A subdrawing with the same point set is the whole drawing. -/ +theorem drawing_eq_of_subdrawing_of_U_eq {S : Type*} [TopologicalSpace S] + {P D : Drawing S} (hPD : P.IsSubdrawing D) (hU : P.U = D.U) : P = D := by + have hV : P.V = D.V := by + apply subset_antisymm hPD.1 + intro x hx + by_contra hn + obtain ⟨e, he, hxe⟩ := P.exists_edge_of_mem (hU.symm ▸ D.V_subset_U hx) hn + exact edge_notMem_V (hPD.2 he) hxe hx + cases P + cases D + simp only at hU hV + subst hU hV + rfl + +/-- A drawing whose point set is a line between two of its vertices is a path. -/ +theorem drawing_isPathBetween_of_isLine_U {S : Type*} [TopologicalSpace S] [T2Space S] + {D : Drawing S} {a b : S} (hL : IsLineWithEnds D.U a b) + (hab : a ≠ b) (ha : a ∈ D.V) (hb : b ∈ D.V) : D.IsPathBetween a b := by + have hU := isPreconnected_of_isLineWithEnds hL + obtain ⟨W⟩ := drawing_walk_of_isPreconnected_U hU ha hb + obtain ⟨W, hW, _, _⟩ := GraphMinor.GM09.exists_isSimple_subwalk W + let P := walkDrawing D W + have hP : P.IsPathBetween a b := walkDrawing_isPathBetween D hW + have hPD : P.IsSubdrawing D := walkDrawing_isSubdrawing D W + have hPL := isLine_of_isPathBetween hP hab + have hPU := isPreconnected_of_isLineWithEnds hPL + have heq := eq_line_of_preconnected_subset hL hPD.U_subset hPU + hPL.left_mem hPL.right_mem + exact drawing_eq_of_subdrawing_of_U_eq hPD heq ▸ hP + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/LineImageEmbedding.lean b/LeanPool/GraphMinor/GM16/LineImageEmbedding.lean new file mode 100644 index 0000000000..99ac4a5319 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/LineImageEmbedding.lean @@ -0,0 +1,40 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.ArcTools + +/-! +# Lines under embeddings between different spaces + +Parametrise a line by a closed interval and compose its parametrisation +with the embedding. The resulting arc has the image line as its range +and the images of the original ends as its ends. This is used to move +the wall's coordinate lines into a sphere in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface +universe u v + +/-- An embedding carries a line to a line with the corresponding ends. +The two spaces may belong to different universes. -/ +theorem isLineWithEnds_image_embedding + {S : Type u} {T : Type v} [TopologicalSpace S] [TopologicalSpace T] + [T2Space T] {j : S → T} (hj : IsEmbedding j) + {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) : + IsLineWithEnds (j '' L) (j a) (j b) := by + obtain ⟨p,hp,rfl,rfl,rfl⟩ := hL.exists_arc + have hArc : IsArcMap (j ∘ p) := ⟨hj.continuous.comp hp.1,hj.injective.comp hp.2⟩ + have h := hArc.isLineWithEnds + rwa [range_comp] at h + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/LineInFace.lean b/LeanPool/GraphMinor/GM16/LineInFace.lean new file mode 100644 index 0000000000..e517760ac3 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/LineInFace.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.RadialChord +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Locating a normal circle's lines in faces + +After splitting a normal circle at its at most two drawing vertices, +each open line avoids the drawing and is connected. It lies in one +region. Taking its closure puts the whole line in the region closure, +and only its ends can meet that face's boundary. These are the local +face data used in the rigidity check of XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface GM11 + +/-- A line whose open part avoids a drawing lies in one face closure. -/ +theorem exists_face_containing_line {S : Type*} [TopologicalSpace S] [T2Space S] + {H : Drawing S} {P : Set S} {a b : S} (hP : IsLineWithEnds P a b) + (hAvoid : Disjoint (P \ {a,b}) H.U) : + ∃ r ∈ H.R, P \ {a,b} ⊆ r ∧ P ⊆ closure r := by + have hp := isPathConnected_sdiff_pair hP + obtain ⟨x,hx⟩ := hp.nonempty + obtain ⟨r,hr,hxr⟩ := exists_region_of_notMem ((disjoint_left.mp hAvoid) hx) + have hSub := subset_region hr hp.isConnected.isPreconnected hAvoid hx hxr + exact ⟨r,hr,hSub,closure_sdiff_pair hP ▸ closure_mono hSub⟩ + +/-- A line with open part in a region meets the boundary of a disc +closure of that region only at its ends. -/ +theorem line_inter_face_boundary_subset {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {H : Drawing S} {r P : Set S} {a b : S} + (hr : r ∈ H.R) (hDisc : IsClosedDisc (closure r)) + (hSub : P \ {a,b} ⊆ r) : P ∩ discBd (closure r) ⊆ {a,b} := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hrInt : r ⊆ interior (closure r) := interior_maximal subset_closure (region_isOpen hr) + rintro x ⟨hxP,hxBd⟩ + by_contra hn + have hxInt := hrInt (hSub ⟨hxP,hn⟩) + have hxFr : x ∈ frontier (closure r) := + (GM11.IsClosedDisc.frontier_eq_discBd hS hDisc).symm ▸ hxBd + exact hxFr.2 hxInt + +/-- The boundary of a disc face closure belongs to the drawing. -/ +theorem face_disc_boundary_subset_U {S : Type*} [TopologicalSpace S] + (hS : IsClosedSurface S) {H : Drawing S} {r : Set S} + (hr : r ∈ H.R) (hDisc : IsClosedDisc (closure r)) : discBd (closure r) ⊆ H.U := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hrInt : r ⊆ interior (closure r) := interior_maximal subset_closure (region_isOpen hr) + intro x hx + have hxCl : x ∈ closure r := Surface.discBd_subset _ hx + rcases closure_region_subset hr hxCl with hxR | hxU + · have hxFr : x ∈ frontier (closure r) := + (GM11.IsClosedDisc.frontier_eq_discBd hS hDisc).symm ▸ hx + exact (hxFr.2 (hrInt hxR)).elim + · exact hxU + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/LocalCoordinateBoundary.lean b/LeanPool/GraphMinor/GM16/LocalCoordinateBoundary.lean new file mode 100644 index 0000000000..0a950a5c22 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/LocalCoordinateBoundary.lean @@ -0,0 +1,57 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs + +/-! +# Local coordinate extrema prevent interior membership + +An open coordinate projection sends a neighborhood to an open +set of the real line. It cannot have a greatest or least point. +Thus a local coordinate bound places its extreme points outside +the interior. Applied inside open horizontal strips, this checks +the straight outer wall sides in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology + +/-- A local maximum of an open real coordinate cannot be an interior point. -/ +theorem not_mem_interior_of_local_coordinate_max {X : Type*} [TopologicalSpace X] + {A O : Set X} (hO : IsOpen O) {g : X → ℝ} (hg : IsOpenMap g) + {p : X} {c : ℝ} (hpO : p ∈ O) (hpc : g p = c) + (hBound : ∀ q ∈ A ∩ O, g q ≤ c) : p ∉ interior A := by + intro hpInt + have hOpen : IsOpen (g '' (interior A ∩ O)) := hg _ (isOpen_interior.inter hO) + have hpImage : g p ∈ g '' (interior A ∩ O) := ⟨p,⟨hpInt,hpO⟩,rfl⟩ + have hSub : g '' (interior A ∩ O) ⊆ Iic c := by + rintro y ⟨q,hq,rfl⟩ + exact hBound q ⟨interior_subset hq.1,hq.2⟩ + have hpRange : g p ∈ interior (Iic c) := interior_mono hSub (hOpen.interior_eq.symm ▸ hpImage) + rw [interior_Iic,hpc] at hpRange + exact (lt_irrefl c) hpRange + +/-- The corresponding assertion for a local minimum. -/ +theorem not_mem_interior_of_local_coordinate_min {X : Type*} [TopologicalSpace X] + {A O : Set X} (hO : IsOpen O) {g : X → ℝ} (hg : IsOpenMap g) + {p : X} {c : ℝ} (hpO : p ∈ O) (hpc : g p = c) + (hBound : ∀ q ∈ A ∩ O, c ≤ g q) : p ∉ interior A := by + intro hpInt + have hOpen : IsOpen (g '' (interior A ∩ O)) := hg _ (isOpen_interior.inter hO) + have hpImage : g p ∈ g '' (interior A ∩ O) := ⟨p,⟨hpInt,hpO⟩,rfl⟩ + have hSub : g '' (interior A ∩ O) ⊆ Ici c := by + rintro y ⟨q,hq,rfl⟩ + exact hBound q ⟨interior_subset hq.1,hq.2⟩ + have hpRange : g p ∈ interior (Ici c) := interior_mono hSub (hOpen.interior_eq.symm ▸ hpImage) + rw [interior_Ici,hpc] at hpRange + exact (lt_irrefl c) hpRange + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/MainProof.lean b/LeanPool/GraphMinor/GM16/MainProof.lean new file mode 100644 index 0000000000..0e5df4df72 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/MainProof.lean @@ -0,0 +1,18 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.InductionsProved + +/-! +# The main induction theorems of Graph Minors XVI + +This module exports the backward hair and horn inductions and the +surface-tower induction, including the unconditional proof of (3.1). +-/ diff --git a/LeanPool/GraphMinor/GM16/MarkedPathSegments.lean b/LeanPool/GraphMinor/GM16/MarkedPathSegments.lean new file mode 100644 index 0000000000..123742dc4a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/MarkedPathSegments.lean @@ -0,0 +1,85 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Consecutive marked vertices of a path + +Trim an initial segment at the first new marked vertex. For the +final choice in XVI (8.1), first stop at the first marked vertex +outside the chosen shell, then trim backwards to the preceding +marked vertex. The segment between them has no other marked vertex. +This follows the choices of `t_i`, `u`, and `v` on pages 72–75. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 +universe u v +variable {α : Type u} {β : Type v} + +/-- An initial path segment ends at the first marked vertex after +its marked start and has no other marked vertices. -/ +theorem exists_initial_marked_segment {G P : Graph α β} {A : Set α} {a b : α} + (hP : IsGraphPathWithEnds G P a b) (ha : a ∈ A) (hb : b ∈ A) (hab : a ≠ b) : + ∃ t ∈ A, t ≠ a ∧ ∃ R : Graph α β, + R ≤ P ∧ IsGraphPathWithEnds G R a t ∧ V(R) ∩ A = {a, t} := by + obtain ⟨a', ha', t, ht, R, hRP, hR⟩ := + hP.exists_isFromToPathWithEnds (X := {a}) (Y := A \ {a}) + (mem_singleton a) ⟨hb, hab.symm⟩ + have haa : a' = a := mem_singleton_iff.mp ha' + subst a' + refine ⟨t, ht.1, ht.2, R, hRP, hR.1, ?_⟩ + apply subset_antisymm + · rintro x ⟨hxR, hxA⟩ + by_cases hxa : x = a + · exact Or.inl hxa + · exact Or.inr (mem_singleton_iff.mp (hR.2.2 ▸ ⟨hxR, hxA, hxa⟩)) + · rintro x (rfl | hxt) + · exact ⟨hR.1.left_mem, ha⟩ + · rw [mem_singleton_iff] at hxt + subst x + exact ⟨hR.1.right_mem, ht.1⟩ + +/-- The first marked exit from a shell and the preceding marked +vertex are consecutive in the old marked set. This is the selection +of `u,v` in XVI (8.1), pages 74–75. -/ +theorem exists_consecutive_marked_exit {G P : Graph α β} {A B : Set α} {a b : α} + (hP : IsGraphPathWithEnds G P a b) (ha : a ∈ A) (hb : b ∈ A) + (hab : a ≠ b) (hbB : b ∉ B) : + ∃ u ∈ A, ∃ v ∈ A, + u ≠ v ∧ v ≠ a ∧ v ∉ B ∧ (u = a ∨ u ∈ B) ∧ + ∃ R : Graph α β, R ≤ P ∧ IsGraphPathWithEnds G R u v ∧ + V(R) ∩ A = {u, v} := by + let E := A \ ({a} ∪ B) + have hbE : b ∈ E := ⟨hb, fun h => h.elim hab.symm hbB⟩ + obtain ⟨a', ha', v, hv, Q, hQP, hQ⟩ := + hP.exists_isFromToPathWithEnds (mem_singleton a) hbE + have haa : a' = a := mem_singleton_iff.mp ha' + subst a' + have hva : v ≠ a := fun h => hv.2 (Or.inl h) + have hvB : v ∉ B := fun h => hv.2 (Or.inr h) + obtain ⟨u, hu, huv, R, hRQ, hR, hRA⟩ := + exists_initial_marked_segment hQ.1.symm hv.1 ha hva + have hCase : u = a ∨ u ∈ B := by + by_cases hua : u = a + · exact Or.inl hua + · right + by_contra huB + have huE : u ∈ E := ⟨hu, fun h => h.elim hua huB⟩ + have huv' : u = v := mem_singleton_iff.mp + (hQ.2.2 ▸ ⟨hRQ.vertexSet_mono hR.right_mem, huE⟩) + exact huv huv' + refine ⟨u, hu, v, hv.1, huv, hva, hvB, hCase, R, hRQ.trans hQP, hR.symm, ?_⟩ + simpa only [Set.pair_comm] using hRA + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Metric.lean b/LeanPool/GraphMinor/GM16/Metric.lean new file mode 100644 index 0000000000..bac5075e3e --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Metric.lean @@ -0,0 +1,41 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM12.Section4MetricExistence + +/-! +# Metrics for the spans in Graph Minors XVI + +A respectful tangle has a metric. Choose a radial drawing. Each short circuit of +that drawing is a normal circle meeting the original drawing in fewer than the +tangle order many vertices. Respectfulness chooses its inside disc. These choices +give the derived slope used in the definition of the tangle metric. +-/ + +public section + +namespace GraphMinor.GM16 + +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 + +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- The metric used in Graph Minors XVI, Section 4, page 52, exists for every +respectful tangle in a closed surface. It is obtained from a radial drawing and +the inside discs supplied by respectfulness, as in XI, Section 6, page 87. -/ +theorem exists_tangleMetric (hS : IsClosedSurface S) {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsRespectfulDrawingTangle H θ T) : + ∃ d, HasTangleMetric H θ T d := + GM12.exists_metric_of_respectful_drawing_tangle hS hT + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/MetricBounds.lean b/LeanPool/GraphMinor/GM16/MetricBounds.lean new file mode 100644 index 0000000000..6b50ea40df --- /dev/null +++ b/LeanPool/GraphMinor/GM16/MetricBounds.lean @@ -0,0 +1,37 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Metric +import LeanPool.GraphMinor.GM12.Section79 + +/-! +# Changing the order in the tangle metric + +Truncating a tangle cuts off its metric at the new order. A shortest radial walk +continues to witness its distance precisely when its half length is below that +order. This is the metric comparison used in XVI, proofs of (7.1) and (8.3). +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- Changing the order from `θ` to `θ' ≤ θ` truncates the radial metric at `θ'`. +This is the equality used in Graph Minors XVI, proof of (7.1), page 69, and +proof of (8.3), Claim (1), page 65. -/ +theorem tangleMetric_truncation {H K : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (ins : Drawing S → Set S) {θ θ' : ℕ} (hle : θ' ≤ θ) (x y : Set S) : + tangleMetric H K ins θ' x y = min (tangleMetric H K ins θ x y) θ' := + GM12.tangleMetric_truncation hK ins hle x y + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/MetricPoints.lean b/LeanPool/GraphMinor/GM16/MetricPoints.lean new file mode 100644 index 0000000000..63f54b87fd --- /dev/null +++ b/LeanPool/GraphMinor/GM16/MetricPoints.lean @@ -0,0 +1,169 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Metric +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.NiceStatements +import LeanPool.GraphMinor.GM12.Section4WalkMetric + +/-! +# Distances at vertices + +A vertex belongs to just its singleton atom. Thus the point distances used for +compressions agree with the singleton distances used for horns and hairs. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe w +variable {S : Type w} [TopologicalSpace S] + +/-- The only atom containing a drawing vertex is its singleton. -/ +theorem atom_eq_singleton_of_mem_vertex {H : Drawing S} {a : Set S} {x : S} + (ha : a ∈ H.A) (hx : x ∈ H.V) (hxa : x ∈ a) : a = {x} := by + rcases ha with (⟨v, hv, rfl⟩ | ha) | ha + · rw [mem_singleton_iff] at hxa + exact congrArg singleton hxa.symm + · exact ((ha.2.1 hxa).2 hx).elim + · exact (region_subset ha hxa (H.V_subset_U hx)).elim + +/-- At a vertex, point-to-atom distance is singleton-to-atom distance. -/ +theorem pointAtomDist_of_mem_vertex {H : Drawing S} (d : Set S → Set S → ℕ) + {x : S} (hx : x ∈ H.V) (b : Set S) : pointAtomDist H d x b = d {x} b := by + have hset : {k : ℕ | ∃ a ∈ H.A, x ∈ a ∧ d a b = k} = {d {x} b} := by + ext k + constructor + · rintro ⟨a, ha, hxa, rfl⟩ + rw [atom_eq_singleton_of_mem_vertex ha hx hxa] + exact mem_singleton _ + · rintro rfl + exact ⟨{x}, Or.inl (Or.inl ⟨x, hx, rfl⟩), mem_singleton x, rfl⟩ + unfold pointAtomDist + rw [hset, csInf_singleton] + +/-- At two vertices, point distance is the distance of their singleton atoms. -/ +theorem pointDist_of_mem_vertices {H : Drawing S} (d : Set S → Set S → ℕ) + {x y : S} (hx : x ∈ H.V) (hy : y ∈ H.V) : pointDist H d x y = d {x} {y} := by + have hset : {k : ℕ | ∃ a ∈ H.A, ∃ b ∈ H.A, x ∈ a ∧ y ∈ b ∧ d a b = k} = + {d {x} {y}} := by + ext k + constructor + · rintro ⟨a, ha, b, hb, hxa, hyb, rfl⟩ + rw [atom_eq_singleton_of_mem_vertex ha hx hxa, + atom_eq_singleton_of_mem_vertex hb hy hyb] + exact mem_singleton _ + · rintro rfl + exact ⟨{x}, Or.inl (Or.inl ⟨x, hx, rfl⟩), + {y}, Or.inl (Or.inl ⟨y, hy, rfl⟩), mem_singleton x, mem_singleton y, rfl⟩ + unfold pointDist + rw [hset, csInf_singleton] + +/-- Two atoms containing the same point are equal. -/ +theorem atom_eq_of_mem {H : Drawing S} {a b : Set S} {x : S} + (ha : a ∈ H.A) (hb : b ∈ H.A) (hxa : x ∈ a) (hxb : x ∈ b) : a = b := by + by_cases hx : x ∈ H.V + · exact (atom_eq_singleton_of_mem_vertex ha hx hxa).trans + (atom_eq_singleton_of_mem_vertex hb hx hxb).symm + rcases ha with (⟨v, hv, rfl⟩ | ha) | ha + · exact (hx (mem_singleton_iff.mp hxa ▸ hv)).elim + · rcases hb with (⟨v, hv, rfl⟩ | hb) | hb + · exact (hx (mem_singleton_iff.mp hxb ▸ hv)).elim + · exact H.edge_eq_of_mem ha hb hxa hxb + · exact (region_subset hb hxb (ha.2.1 hxa).1).elim + · rcases hb with (⟨v, hv, rfl⟩ | hb) | hb + · exact (hx (mem_singleton_iff.mp hxb ▸ hv)).elim + · exact (region_subset ha hxa (hb.2.1 hxb).1).elim + · exact region_eq_of_mem ha hb hxa hxb + +/-- Point-to-atom distance can be evaluated at the atom containing the point. -/ +theorem pointAtomDist_of_mem_atom {H : Drawing S} (d : Set S → Set S → ℕ) + {x : S} {a : Set S} (ha : a ∈ H.A) (hx : x ∈ a) (b : Set S) : + pointAtomDist H d x b = d a b := by + have hset : {k : ℕ | ∃ c ∈ H.A, x ∈ c ∧ d c b = k} = {d a b} := by + ext k + constructor + · rintro ⟨c, hc, hxc, rfl⟩ + rw [atom_eq_of_mem hc ha hxc hx] + exact mem_singleton _ + · rintro rfl + exact ⟨a, ha, hx, rfl⟩ + unfold pointAtomDist + rw [hset, csInf_singleton] + +/-- Point distance can be evaluated at the atoms containing the two points. -/ +theorem pointDist_of_mem_atoms {H : Drawing S} (d : Set S → Set S → ℕ) + {x y : S} {a b : Set S} (ha : a ∈ H.A) (hb : b ∈ H.A) + (hx : x ∈ a) (hy : y ∈ b) : pointDist H d x y = d a b := by + have hset : {k : ℕ | ∃ c ∈ H.A, ∃ e ∈ H.A, x ∈ c ∧ y ∈ e ∧ d c e = k} = + {d a b} := by + ext k + constructor + · rintro ⟨c, hc, e, he, hxc, hye, rfl⟩ + rw [atom_eq_of_mem hc ha hxc hx, atom_eq_of_mem he hb hye hy] + exact mem_singleton _ + · rintro rfl + exact ⟨a, ha, b, hb, hx, hy, rfl⟩ + unfold pointDist + rw [hset, csInf_singleton] + +variable [T2Space S] + +omit [T2Space S] in +/-- The atom triangle inequality also holds for point-to-atom distances. -/ +theorem pointAtomDist_triangle {H : Drawing S} {d : Set S → Set S → ℕ} + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) + (x y : S) {z : Set S} (hz : z ∈ H.A) : + pointAtomDist H d x z ≤ pointDist H d x y + pointAtomDist H d y z := by + obtain ⟨a, ha, hxa⟩ := exists_atom H x + obtain ⟨b, hb, hyb⟩ := exists_atom H y + rw [pointAtomDist_of_mem_atom d ha hxa z, pointDist_of_mem_atoms d ha hb hxa hyb, + pointAtomDist_of_mem_atom d hb hyb z] + exact htri a ha b hb z hz + +omit [T2Space S] in +/-- Cutting off atom distances also cuts off point-to-atom distances. -/ +theorem pointAtomDist_min (H : Drawing S) (d : Set S → Set S → ℕ) (k : ℕ) + (x : S) (z : Set S) : + pointAtomDist H (fun a b => min (d a b) k) x z = min (pointAtomDist H d x z) k := by + obtain ⟨a, ha, hxa⟩ := exists_atom H x + rw [pointAtomDist_of_mem_atom _ ha hxa z, pointAtomDist_of_mem_atom d ha hxa z] + +omit [T2Space S] in +/-- Cutting off all atom distances cuts off all point distances at the same value. -/ +theorem pointDist_min (H : Drawing S) (d : Set S → Set S → ℕ) (k : ℕ) (x y : S) : + pointDist H (fun a b => min (d a b) k) x y = min (pointDist H d x y) k := by + obtain ⟨a, ha, hxa⟩ := exists_atom H x + obtain ⟨b, hb, hyb⟩ := exists_atom H y + rw [pointDist_of_mem_atoms _ ha hb hxa hyb, pointDist_of_mem_atoms d ha hb hxa hyb] + +/-- Point distances of a tangle are at most its order. -/ +theorem pointDist_le_order {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (h : HasTangleMetric H θ T d) (x y : S) : + pointDist H d x y ≤ θ := by + obtain ⟨a, ha, hxa⟩ := exists_atom H x + obtain ⟨b, hb, hyb⟩ := exists_atom H y + obtain ⟨_, K, ins, hK, _, hd⟩ := h + rw [pointDist_of_mem_atoms d ha hb hxa hyb, hd a ha b hb] + exact GM12.tangleMetric_le_order hK ins θ a b + +/-- Compression loses at most its parameter in the distance between vertices +that remain vertices of the new drawing. -/ +theorem compression_vertex_dist_le {H H' : Drawing S} {θ lam : ℕ} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} + (h : IsLambdaCompression H H' θ lam T T' d d') + {x y : S} (hx : x ∈ H.V) (hy : y ∈ H.V) + (hx' : x ∈ H'.V) (hy' : y ∈ H'.V) : d {x} {y} ≤ d' {x} {y} + lam := by + have hb := h.dist_le x y + rwa [pointDist_of_mem_vertices d hx hy, pointDist_of_mem_vertices d' hx' hy'] at hb + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/MinorModelRestriction.lean b/LeanPool/GraphMinor/GM16/MinorModelRestriction.lean new file mode 100644 index 0000000000..a23a192964 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/MinorModelRestriction.lean @@ -0,0 +1,94 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Minor.Model +public import Mathlib.Combinatorics.Graph.Simple + +/-! +# Restricting a minor model to a copy of a simple graph + +The wall in XVI (4.2) is a subgraph of the large square grid. +Keep the branch sets for its vertices and the chosen edges for its +edges. Deleting fewer chosen edges preserves the connected branch +graphs. Thus the grid minor model restricts to a wall minor model. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph Function +universe u v w x + +private theorem simple_inc {α : Type*} (H : SimpleGraph α) (e : Sym2 α) (v : α) : + (Graph.ofSimpleGraph H).Inc e v ↔ e ∈ H.edgeSet ∧ v ∈ e := by + constructor + · rintro ⟨w, he, hm⟩ + exact ⟨hm, he ▸ Sym2.mem_mk_left _ _⟩ + · rintro ⟨hm, hv⟩ + obtain ⟨w, he⟩ := Sym2.mem_iff_exists.mp hv + exact ⟨w, he, hm⟩ + +private theorem simple_no_loop {α : Type*} (H : SimpleGraph α) (e : Sym2 α) (v : α) : + ¬ (Graph.ofSimpleGraph H).IsLoopAt e v := by + rintro ⟨he, hm⟩ + rw [he] at hm + exact (show H.Adj v v from hm).ne rfl + +/-- Restrict a simple graph's minor model along an injective graph map. -/ +theorem IsMinorModel.restrict_simpleGraph_copy + {α : Type u} {β : Type v} {ν : Type w} {ξ : Type x} + {H : SimpleGraph ν} {K : SimpleGraph ξ} {G : Graph α β} + {ηv : ξ → Set α} {ηe : Sym2 ξ → β} + (h : IsMinorModel (Graph.ofSimpleGraph K) G ηv ηe) + (f : ν → ξ) (hf : Injective f) + (hAdj : ∀ a b, H.Adj a b → K.Adj (f a) (f b)) : + IsMinorModel (Graph.ofSimpleGraph H) G (ηv ∘ f) (ηe ∘ Sym2.map f) := by + have hEdges : ∀ e ∈ H.edgeSet, Sym2.map f e ∈ K.edgeSet := by + intro e he + induction e with + | h a b => exact hAdj a b he + have hInc (e : Sym2 ν) (he : e ∈ H.edgeSet) (a : ν) : + (Graph.ofSimpleGraph H).Inc e a ↔ + (Graph.ofSimpleGraph K).Inc (Sym2.map f e) (f a) := by + rw [simple_inc, simple_inc] + have hMem : f a ∈ Sym2.map f e ↔ a ∈ e := by + induction e with + | h b c => simp only [Sym2.map_mk, Sym2.mem_iff, hf.eq_iff] + rw [hMem] + exact and_congr (iff_of_true he (hEdges e he)) Iff.rfl + refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro a _ + exact h.vertex_nonempty (f a) (mem_univ _) + · intro a _ + exact h.vertex_subset (f a) (mem_univ _) + · intro e he + exact h.edge_mem _ (hEdges e he) + · intro a _ b _ hab + exact h.vertex_disjoint _ (mem_univ _) _ (mem_univ _) (fun hEq => hab (hf hEq)) + · intro e he e' he' hEq + exact Sym2.map.injective hf (h.edge_injOn (hEdges e he) (hEdges e' he') hEq) + · intro a _ e he + exact (hInc e he a).trans (h.inc_iff (f a) (mem_univ _) (Sym2.map f e) (hEdges e he)) + · intro a _ e he + refine ⟨fun hl => (simple_no_loop H e a hl).elim, ?_⟩ + intro hall + have hl := (h.isLoopAt_iff (f a) (mem_univ _) (Sym2.map f e) (hEdges e he)).mpr hall + exact (simple_no_loop K _ _ hl).elim + · intro a _ + obtain ⟨L, hL, hVL, hConn⟩ := h.connected (f a) (mem_univ _) + refine ⟨L, hL.trans ?_, hVL, hConn⟩ + have hImage : (ηe ∘ Sym2.map f) '' E(Graph.ofSimpleGraph H) ⊆ ηe '' E(Graph.ofSimpleGraph K) + := by + rintro _ ⟨e, he, rfl⟩ + exact ⟨Sym2.map f e, hEdges e he, rfl⟩ + refine ⟨subset_rfl, ?_⟩ + intro e x y hl + exact ⟨hl.1, fun he => hl.2 (hImage he)⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ModelBranchArms.lean b/LeanPool/GraphMinor/GM16/ModelBranchArms.lean new file mode 100644 index 0000000000..f61b7b2399 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ModelBranchArms.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.ConnectedBranchArms +public import Mathlib.Combinatorics.Graph.Simple + +/-! +# Branch arms in a subcubic minor model + +For a vertex of the wall in XVI (4.2), page 54, choose the end of +each incident model edge in its branch set. There are at most three +such occurrences. Construct arms to them in the connected branch +graph supplied by the model. The arms use none of the chosen model +edges, and two arms at the same branch centre meet only there, even +when two chosen edges have the same attachment vertex. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph GraphMinor.Surface GraphMinor.GM09 +universe u v w + +/-- The branch-set step in replacing the wall minor by a subdivision, +XVI (4.2), page 54. The graph containing the arms avoids all chosen +model edges. -/ +theorem model_vertex_arms {α : Type u} {β : Type v} {ν : Type w} + {H : SimpleGraph ν} {G : Graph α β} {ηv : ν → Set α} {ηe : Sym2 ν → β} + (h : IsMinorModel (Graph.ofSimpleGraph H) G ηv ηe) (v : ν) + (hFin : (H.neighborSet v).Finite) (hDeg : (H.neighborSet v).ncard ≤ 3) : + ∃ (K : Graph α β), K ≤ G.deleteEdges (ηe '' H.edgeSet) ∧ V(K) = ηv v ∧ + ∃ (m : α) (attach : H.neighborSet v → α) (P : H.neighborSet v → Graph α β), + m ∈ V(K) ∧ + (∀ i, attach i ∈ V(K) ∧ G.Inc (ηe s(v,i.val)) (attach i)) ∧ + (∀ i, IsGraphPathWithEnds K (P i) m (attach i)) ∧ + ∀ i j, i ≠ j → V(P i) ∩ V(P j) = {m} := by + classical + obtain ⟨K, hK, hVK, hConn⟩ := h.connected v (mem_univ _) + have hAttach (i : H.neighborSet v) : + ∃ x ∈ ηv v, G.Inc (ηe s(v,i.val)) x := by + have he : s(v,i.val) ∈ E(Graph.ofSimpleGraph H) := i.property + have hi : (Graph.ofSimpleGraph H).Inc s(v,i.val) v := ⟨i.val, rfl, he⟩ + exact (h.inc_iff v (mem_univ _) s(v,i.val) he).mp hi + let attach : H.neighborSet v → α := fun i => (hAttach i).choose + have hInK : ∀ i, attach i ∈ V(K) := fun i => hVK.symm ▸ (hAttach i).choose_spec.1 + let : Finite (H.neighborSet v) := hFin.to_subtype + obtain ⟨m, P, hm, hPath, hInter⟩ := + exists_connected_indexed_arms hConn hDeg attach hInK + exact ⟨K, hK, hVK, m, attach, P, hm, + fun i => ⟨hInK i, (hAttach i).choose_spec.2⟩, hPath, hInter⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ModelBranchCentres.lean b/LeanPool/GraphMinor/GM16/ModelBranchCentres.lean new file mode 100644 index 0000000000..351faaae09 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ModelBranchCentres.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.ModelBranchArms +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Choosing centres throughout a subcubic model + +Apply the branch-arm construction at every vertex of the minor. +Centres in different branch sets are distinct. Every arm stays in +its own branch set and avoids every chosen model edge. These facts +are the global compatibility needed in XVI (4.2), page 54. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph Function GraphMinor.Surface GraphMinor.GM09 +universe u v w + +/-- The centres and arms for a finite simple subcubic minor model, +as used to construct the subdivision in XVI (4.2), page 54. -/ +theorem exists_model_branch_centres {α : Type u} {β : Type v} {ν : Type w} [Finite ν] + {H : SimpleGraph ν} {G : Graph α β} {ηv : ν → Set α} {ηe : Sym2 ν → β} + (h : IsMinorModel (Graph.ofSimpleGraph H) G ηv ηe) + (hDeg : ∀ v, (H.neighborSet v).ncard ≤ 3) : + ∃ (c : ν → α) (attach : ∀ v, H.neighborSet v → α) + (arm : ∀ v, H.neighborSet v → Graph α β), + Injective c ∧ + (∀ v, c v ∈ ηv v) ∧ + (∀ v i, attach v i ∈ ηv v ∧ G.Inc (ηe s(v,i.val)) (attach v i)) ∧ + (∀ v i, IsGraphPathWithEnds G (arm v i) (c v) (attach v i)) ∧ + (∀ v i, V(arm v i) ⊆ ηv v ∧ Disjoint E(arm v i) (ηe '' H.edgeSet)) ∧ + (∀ v i j, i ≠ j → V(arm v i) ∩ V(arm v j) = {c v}) := by + classical + choose K hK hVK c attach arm hc hAttach hPath hInter using + fun v => model_vertex_arms h v (Set.toFinite _) (hDeg v) + have hCentres : ∀ v, c v ∈ ηv v := fun v => hVK v ▸ hc v + have hKG : ∀ v, K v ≤ G := fun v => (hK v).trans Graph.deleteEdges_le + refine ⟨c, attach, arm, ?_, hCentres, ?_, ?_, ?_, hInter⟩ + · intro v w heq + by_contra hne + have hd := h.vertex_disjoint v (mem_univ _) w (mem_univ _) hne + exact (disjoint_left.mp hd) (hCentres v) (heq.symm ▸ hCentres w) + · intro v i + exact ⟨hVK v ▸ (hAttach v i).1, (hAttach v i).2⟩ + · intro v i + exact (hPath v i).mono (hKG v) + · intro v i + refine ⟨?_, disjoint_left.mpr ?_⟩ + · intro x hx + exact hVK v ▸ (hPath v i).le.vertexSet_mono hx + · intro e he heChosen + have hDel := ((hPath v i).le.trans (hK v)).edgeSet_mono he + exact hDel.2 heChosen + +/-- A chosen model edge joins any of its incident points in the two +corresponding branch sets. The branch sets make these points distinct. -/ +theorem model_edge_between_branch_points {α : Type u} {β : Type v} {ν : Type w} + {H : SimpleGraph ν} {G : Graph α β} {ηv : ν → Set α} {ηe : Sym2 ν → β} + (h : IsMinorModel (Graph.ofSimpleGraph H) G ηv ηe) + {u v : ν} (huv : H.Adj u v) {x y : α} + (hx : x ∈ ηv u) (hy : y ∈ ηv v) + (hix : G.Inc (ηe s(u, v)) x) (hiy : G.Inc (ηe s(u, v)) y) : + G.IsLink (ηe s(u,v)) x y := by + have hxy : x ≠ y := (h.vertex_disjoint u (mem_univ _) v (mem_univ _) huv.ne).ne_of_mem hx hy + obtain ⟨z, hxz⟩ := hix + have hyz : y = z := hiy.eq_of_isLink_of_ne_left hxz hxy.symm + exact hyz.symm ▸ hxz + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ModelContractionMaps.lean b/LeanPool/GraphMinor/GM16/ModelContractionMaps.lean new file mode 100644 index 0000000000..2cffc82301 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ModelContractionMaps.lean @@ -0,0 +1,26 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Minor.Basic + +/-! +# The contraction realizing a minor model + +The vertex and edge equivalences of the contraction in XVI (4.2), page 53, retain the maps of +the given minor model. +-/ + +public section + +namespace GraphMinor.GM16 + +export GraphMinor (exists_contraction_realizing_model) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ModelFromBranchArms.lean b/LeanPool/GraphMinor/GM16/ModelFromBranchArms.lean new file mode 100644 index 0000000000..f3b28215b4 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ModelFromBranchArms.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Minor.Model +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM01.Defs +import LeanPool.GraphMinor.GM16.ConnectedPathStar +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Retaining a subcubic minor inside the subdivision subgraph + +The smaller branch set consists of its centre and its chosen +arms. These sets stay inside the original disjoint branch sets. +Their arms are connected and avoid the chosen model edges. Each +chosen edge still joins its two attachment points in the new +subgraph. Thus the same edge map, with these smaller branch sets, +is a minor model in the subdivision. This is the parenthetical +minor assertion about `N₄` in XVI (4.2), page 54. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Surface GM09 +universe u v w + +/-- A subgraph containing all chosen branch arms and chosen edges +retains the original simple-graph minor with the same edge map. -/ +theorem minorModel_from_branch_arms + {α : Type u} {β : Type v} {ν : Type w} {H : SimpleGraph ν} {G N : Graph α β} + {ηv : ν → Set α} {ηe : Sym2 ν → β} + (hModel : IsMinorModel (Graph.ofSimpleGraph H) G ηv ηe) (hNG : N ≤ G) + (c : ν → α) (attach : ∀ v, H.neighborSet v → α) + (arm : ∀ v, H.neighborSet v → Graph α β) + (hc : ∀ v, c v ∈ ηv v) (hcN : ∀ v, c v ∈ V(N)) + (hAttach : ∀ v i, G.Inc (ηe s(v, i.val)) (attach v i)) + (hPath : ∀ v i, IsGraphPathWithEnds G (arm v i) (c v) (attach v i)) + (hArmN : ∀ v i, arm v i ≤ N) + (hArmSub : ∀ v i, V(arm v i) ⊆ ηv v) + (hArmAvoid : ∀ v i, Disjoint E(arm v i) (ηe '' H.edgeSet)) + (hChosenN : ∀ e ∈ H.edgeSet, ηe e ∈ E(N)) : + IsMinorModel (Graph.ofSimpleGraph H) N (fun v => {c v} ∪ ⋃ i, V(arm v i)) ηe := by + have hSub (v : ν) : {c v} ∪ ⋃ i, V(arm v i) ⊆ ηv v := by + rintro x (hx | hx) + · exact (mem_singleton_iff.mp hx).symm ▸ hc v + · obtain ⟨i,hxi⟩ := mem_iUnion.mp hx + exact hArmSub v i hxi + have hIncN {e : β} (he : e ∈ E(N)) {x : α} (hx : G.Inc e x) : N.Inc e x := by + obtain ⟨y,hLink⟩ := hx + exact ⟨y,hNG.isLink_iff'.mpr ⟨hLink,he⟩⟩ + refine ⟨?_,?_,?_,?_,hModel.edge_injOn,?_,?_,?_⟩ + · intro v _ + exact ⟨c v,Or.inl (mem_singleton _)⟩ + · intro v _ x hx + rcases hx with hx | hx + · exact (mem_singleton_iff.mp hx).symm ▸ hcN v + · obtain ⟨i,hxi⟩ := mem_iUnion.mp hx + exact (hArmN v i).vertexSet_mono hxi + · intro e he + exact hChosenN e he + · intro a ha b hb hab + exact (hModel.vertex_disjoint a ha b hb hab).mono (hSub a) (hSub b) + · intro v _ e he + constructor + · rintro ⟨w,heq,heMem⟩ + have hAdj : H.Adj v w := by + have h : s(v,w) ∈ H.edgeSet := heq ▸ heMem + exact h + let i : H.neighborSet v := ⟨w,hAdj⟩ + have hPort : G.Inc (ηe e) (attach v i) := by + rw [heq] + exact hAttach v i + exact ⟨attach v i,Or.inr (mem_iUnion_of_mem i (hPath v i).right_mem),hIncN + (hChosenN e he) hPort⟩ + · rintro ⟨x,hx,y,hLink⟩ + exact (hModel.inc_iff v (mem_univ _) e he).mpr ⟨x,hSub v hx,y,hNG.isLink_mono hLink⟩ + · intro v _ e he + constructor + · rintro ⟨heq,heMem⟩ + have hMem : s(v,v) ∈ H.edgeSet := heq ▸ heMem + have hAdj : H.Adj v v := hMem + exact (hAdj.ne rfl).elim + · intro hall + apply (hModel.isLoopAt_iff v (mem_univ _) e he).mpr + intro x hx + exact hSub v (hall x (hIncN (hChosenN e he) hx)) + · intro v _ + let F := ηe '' H.edgeSet + have hArmDel (i : H.neighborSet v) : arm v i ≤ N.deleteEdges F := by + refine ⟨(hArmN v i).vertexSet_mono,?_⟩ + intro e x y hLink + exact ⟨(hArmN v i).isLink_mono hLink, + fun he => (disjoint_left.mp (hArmAvoid v i)) hLink.edge_mem he⟩ + let K := pathSystemGraph (N.deleteEdges F) {c v} (arm v) + have hRoot : ({c v} : Set α) ⊆ V(N.deleteEdges F) := by + rintro x hx + exact (mem_singleton_iff.mp hx).symm ▸ hcN v + refine ⟨K,pathSystemGraph_le hRoot hArmDel,rfl,?_⟩ + exact graphConnected_pathSystemGraph_star (fun i => (hPath v i).of_le (hArmDel i)) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ModelInducedTangle.lean b/LeanPool/GraphMinor/GM16/ModelInducedTangle.lean new file mode 100644 index 0000000000..4cb400d6f7 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ModelInducedTangle.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.HypergraphSupportedTangle +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM10.Defs2 +import LeanPool.GraphMinor.GM16.ModelContractionMaps +import LeanPool.GraphMinor.GM16.GraphIsoImage +import LeanPool.GraphMinor.GM10.Section6 + +/-! +# Inducing a tangle through a specified minor model + +The tangle construction in XVI (4.2), pages 53–54, must retain the +chosen edge names. Realise the model by contraction with those maps, +relabel the tangle of the minor, and apply X (6.1). Injectivity is +required only on actual vertices and edges, so unused names cause +no extra assumption. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Hypergraph GM10 GM15 +universe u v u' v' + +/-- The branch-set map of a minor model is injective on its vertices. -/ +theorem minorModel_vertexMap_injOn {α : Type u} {β : Type v} {ν : Type u'} {ε : Type v'} + {H : Graph ν ε} {G : Graph α β} {ηv : ν → Set α} {ηe : ε → β} + (h : IsMinorModel H G ηv ηe) : InjOn ηv V(H) := by + intro a ha b hb heq + by_contra hne + obtain ⟨x,hx⟩ := h.vertex_nonempty a ha + exact (disjoint_left.mp (h.vertex_disjoint a ha b hb hne)) hx (heq ▸ hx) + +/-- Induce a tangle through a minor model, preserving its specified +vertex and edge maps, as in XVI (4.2), pages 53–54. -/ +theorem exists_model_induced_tangle {α : Type u} {β : Type v} {ν : Type u'} {ε : Type v'} + {H : Graph ν ε} {G : Graph α β} {ηv : ν → Set α} {ηe : ε → β} + (hVH : V(H).Finite) (hEH : E(H).Finite) (hVG : V(G).Finite) (hEG : E(G).Finite) + (h : IsMinorModel H G ηv ηe) {θ : ℕ} (hθ : 2 ≤ θ) + {T : Set (Hypergraph ν ε × Hypergraph ν ε)} + (hT : IsTangle (Hypergraph.ofGraph H hVH hEH) θ T) : + ∃ (K : Graph (Set α) β) (hVK : V(K).Finite) (hEK : E(K).Finite), + IsMinor K G ∧ + Hypergraph.ofGraph K hVK hEK = imageHypergraph ηv ηe (Hypergraph.ofGraph H hVH hEH) ∧ + IsTangle (Hypergraph.ofGraph K hVK hEK) θ (imageHypergraphTangle ηv ηe T) ∧ + IsTangle (Hypergraph.ofGraph G hVG hEG) θ + (inducedTangle (Hypergraph.ofGraph G hVG hEG) (Hypergraph.ofGraph K hVK hEK) + (imageHypergraphTangle ηv ηe T) θ) := by + obtain ⟨G', hG', C, hC, φ, hv, he⟩ := exists_contraction_realizing_model h + let K := contract G' C + have hVK : V(K).Finite := by + let : Finite (V(H)) := hVH.to_subtype + let : Finite (V(K)) := Finite.of_equiv _ φ.vertexEquiv + exact Set.toFinite _ + have hEK : E(K).Finite := by + let : Finite (E(H)) := hEH.to_subtype + let : Finite (E(K)) := Finite.of_equiv _ φ.edgeEquiv + exact Set.toFinite _ + have hMinor : IsMinor K G := ⟨G', hG', C, hC, rfl⟩ + have hImage : Hypergraph.ofGraph K hVK hEK = imageHypergraph ηv ηe (Hypergraph.ofGraph H hVH hEH) + := + (imageHypergraph_of_iso hVH hEH hVK hEK φ ηv ηe hv he).symm + have hTK : IsTangle (Hypergraph.ofGraph K hVK hEK) θ (imageHypergraphTangle ηv ηe T) := by + rw [hImage] + exact isTangle_imageHypergraphTangle_on ηv ηe (minorModel_vertexMap_injOn h) h.edge_injOn hT + exact ⟨K, hVK, hEK, hMinor, hImage, hTK, + GM10.theorem_6_1_proof hVG hEG hVK hEK hMinor hθ hTK⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/NestedDiscContainment.lean b/LeanPool/GraphMinor/GM16/NestedDiscContainment.lean new file mode 100644 index 0000000000..e2f9a613be --- /dev/null +++ b/LeanPool/GraphMinor/GM16/NestedDiscContainment.lean @@ -0,0 +1,41 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# Containment from nested boundaries + +Inside a fixed closed disc a circle bounds only one closed disc. +Consequently, a smaller closed disc is contained in any other closed +disc there that contains its boundary. This places the battlefield's +inner disc inside the discs of the nest in XVI (8.1), Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface +universe u +variable {S : Type u} [TopologicalSpace S] + +/-- Among closed discs inside a fixed disc, containment of one +boundary in another disc implies containment of its whole disc. -/ +theorem closedDisc_subset_of_boundary_subset {D E E₀ : Set S} + (hD : IsClosedDisc D) (hE : IsClosedDisc E) (hE₀ : IsClosedDisc E₀) + (hED : E ⊆ D) (hE₀D : E₀ ⊆ D) (hbd : discBd E₀ ⊆ E) : E₀ ⊆ E := by + obtain ⟨F, hF, _⟩ := disc_oArc E (discBd E₀) hE hbd hE₀.isOArc_discBd + obtain ⟨G, _, hu⟩ := disc_oArc D (discBd E₀) hD + ((discBd_subset E₀).trans hE₀D) hE₀.isOArc_discBd + have h₀ : E₀ = G := hu E₀ hE₀D hE₀ rfl + have h₁ : F = G := hu F (hF.1.trans hED) hF.2.1 hF.2.2.1 + rw [h₀, ← h₁] + exact hF.1 + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/PathBoundaryIntersection.lean b/LeanPool/GraphMinor/GM16/PathBoundaryIntersection.lean new file mode 100644 index 0000000000..2581aa2068 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/PathBoundaryIntersection.lean @@ -0,0 +1,43 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM16.DrawingGraphPaths +import LeanPool.GraphMinor.GM16.Section9Attachments +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# A path meets a drawn boundary only at its boundary vertices + +If a path has only one vertex on a boundary subdrawing, it has no +edge there. Their point-set intersection is consequently their +vertex intersection. This is used when trimming Claim (10)'s paths +into the battlefield disc for XVI (8.1), Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 +universe u +variable {S : Type u} [TopologicalSpace S] + +/-- A path with at most one vertex on a subdrawing meets its whole +point set only at that vertex. -/ +theorem path_inter_subdrawing_subset_singleton {H P B : Drawing S} + {a b v : S} (hP : P.IsSubdrawing H) (hB : B.IsSubdrawing H) + (hPath : P.IsPathBetween a b) (hInter : P.V ∩ B.U ⊆ {v}) : + P.U ∩ B.U ⊆ {v} := by + have hE : Disjoint P.E B.E := path_edges_disjoint_of_singleton_inter + (toGraph_le_of_isSubdrawing hB) (graphPath_of_drawingPath hP hPath) + (fun _ hx => hInter ⟨hx.1, B.V_subset_U hx.2⟩) + rw [U_inter_of_disjoint hP hB hE] + exact fun _ hx => hInter ⟨hx.1, B.V_subset_U hx.2⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/PathCrossesZone.lean b/LeanPool/GraphMinor/GM16/PathCrossesZone.lean new file mode 100644 index 0000000000..3a28e1337b --- /dev/null +++ b/LeanPool/GraphMinor/GM16/PathCrossesZone.lean @@ -0,0 +1,65 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.GM11.Walks + +/-! +# A path crossing a zone has a boundary vertex + +At the first vertex outside the open zone, the entering edge lies +in the zone and its closure contains that vertex. Hence the vertex +lies on the boundary. This supplies the intersection with the annulus +in XVI (8.1), Claim (14). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- A walk from inside a zone to outside it contains a boundary vertex. -/ +theorem graphWalk_meets_zone_boundary {H : Drawing S} + {d : Set S → Set S → ℕ} {γ : ℕ} {z Λ : Set S} + (hZone : IsLambdaZoneAround H d γ z Λ) {a b : S} + (W : GraphWalk H.toGraph a b) (ha : a ∈ Λ) (hb : b ∉ Λ) : + ∃ v ∈ W.support, v ∈ H.V ∩ subBd Λ := by + induction W with + | nil _ => exact False.elim (hb ha) + | @cons a c b e hl W ih => + by_cases hc : c ∈ Λ + · obtain ⟨v, hv, hvBd⟩ := ih hc hb + exact ⟨v, List.mem_cons_of_mem _ hv, hvBd⟩ + · have heIn : e ⊆ Λ := by + rcases edge_subset_or_subset_compl_of_zone hZone hl.1 with he | he + · exact he + · have hcl := closure_minimal he (isClosed_univ.sdiff hZone.isOpenDisc.1) + have haCl : a ∈ closure e := (hl.2.2.2.symm ▸ (show a ∈ ({a, c} : Set S) from Or.inl + rfl)).1 + exact False.elim ((hcl haCl).2 ha) + have hcCl : c ∈ closure e := (hl.2.2.2.symm ▸ (show c ∈ ({a, c} : Set S) from Or.inr rfl)).1 + refine ⟨c, List.mem_cons_of_mem _ W.start_mem_support, hl.2.2.1, ?_⟩ + exact ⟨closure_mono heIn hcCl, subset_closure ⟨mem_univ _, hc⟩⟩ + +/-- A path subdrawing from inside a zone to outside it meets the +boundary at a vertex of that path. -/ +theorem drawingPath_meets_zone_boundary {H P : Drawing S} + {d : Set S → Set S → ℕ} {γ : ℕ} {z Λ : Set S} + (hZone : IsLambdaZoneAround H d γ z Λ) {a b : S} + (hP : P.IsSubdrawing H) (hPath : P.IsPathBetween a b) + (ha : a ∈ Λ) (hb : b ∉ Λ) : (P.V ∩ (H.V ∩ subBd Λ)).Nonempty := by + obtain ⟨W, _, hV, _⟩ := hPath + obtain ⟨W', hs, _⟩ := hP.exists_walk_up W + obtain ⟨v, hv, hvBd⟩ := graphWalk_meets_zone_boundary hZone W' ha hb + exact ⟨v, hV.symm ▸ (hs ▸ hv), hvBd⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/PathDrawingOnLine.lean b/LeanPool/GraphMinor/GM16/PathDrawingOnLine.lean new file mode 100644 index 0000000000..12f056fe2e --- /dev/null +++ b/LeanPool/GraphMinor/GM16/PathDrawingOnLine.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM16.PathIsoCard +import LeanPool.GraphMinor.GM16.LineDrawingPath +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.ArcDrawings +import LeanPool.GraphMinor.Surface.SurfaceGraph +import Mathlib.Order.Interval.Set.Infinite +import Mathlib.Data.Set.Card + +/-! +# Drawing an abstract path on a prescribed line + +Choose as many marked points on the line as the path has vertices, +including both ends. The existing line drawing construction gives +a drawing supported on that line. It is a path, and matching the +ordered vertex positions gives an isomorphism with the abstract +path that preserves both ends. This draws the replacing paths +of the subdivision in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology Surface GM09 GM11 +universe u v w + +/-- A line has infinitely many points. -/ +theorem infinite_of_isLineWithEnds {S : Type w} [TopologicalSpace S] + {L : Set S} {x y : S} (hL : IsLineWithEnds L x y) : L.Infinite := by + obtain ⟨e,_,_⟩ := hL + let : Infinite unitInterval := Set.Icc.infinite (show (0 : ℝ)<1 by norm_num) + have hInf : Infinite L := Infinite.of_injective e e.injective + exact infinite_coe_iff.mp hInf + +/-- A nontrivial abstract graph path can be drawn on any prescribed line, +with the isomorphism taking its stated ends to the line's stated ends. -/ +theorem exists_path_drawing_on_line {α : Type u} {β : Type v} + {S : Type w} [TopologicalSpace S] [T2Space S] + {G P : Graph α β} {a b : α} (hP : IsGraphPathWithEnds G P a b) (hab : a ≠ b) + {L : Set S} {x y : S} (hL : IsLineWithEnds L x y) (hxy : x ≠ y) : + ∃ Γ : GraphDrawing P S, Γ.drawing.U=L ∧ + (∀ z : V(P), z.val=a → (Γ.iso.vertexEquiv z).val=x) ∧ + (∀ z : V(P), z.val=b → (Γ.iso.vertexEquiv z).val=y) := by + classical + have hTwo : 2 ≤ V(P).ncard := by + have h := (Set.one_lt_ncard hP.vertexSet_finite).mpr ⟨a,hP.left_mem,b,hP.right_mem,hab⟩ + omega + have hPairL : ({x,y} : Set S) ⊆ L := by + rintro z (rfl | hz) + · exact hL.left_mem + · rw [mem_singleton_iff] at hz + exact hz.symm ▸ hL.right_mem + have hPairCard : ({x,y} : Set S).ncard ≤ V(P).ncard := by rw [ncard_pair hxy]; exact hTwo + obtain ⟨A, hAFinite, hPairA, hAL, hACard⟩ := (infinite_of_isLineWithEnds + hL).exists_superset_ncard_eq + hPairL ((finite_singleton y).insert x) hPairCard + have hxA : x ∈ A := hPairA (mem_insert x {y}) + have hyA : y ∈ A := hPairA (mem_insert_of_mem x rfl) + obtain ⟨D,hDU,hDV⟩ := exists_drawing_on_line A.ncard hL hxy hAFinite hxA hyA hAL le_rfl + have hDPath : D.IsPathBetween x y := drawing_isPathBetween_of_isLine_U (hDU.symm ▸ hL) + hxy (hDV.symm ▸ hxA) (hDV.symm ▸ hyA) + have hDGraphPath : IsGraphPathWithEnds D.toGraph D.toGraph x y := ⟨le_rfl,hDPath⟩ + have hCard : V(P).ncard=V(D.toGraph).ncard := by + change V(P).ncard=D.V.ncard + rw [hDV,hACard] + obtain ⟨φ,hLeft,hRight⟩ := exists_iso_of_paths_of_ncard_eq hP hDGraphPath hCard + exact ⟨⟨D,φ⟩,hDU,hLeft,hRight⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/PathEndSubpath.lean b/LeanPool/GraphMinor/GM16/PathEndSubpath.lean new file mode 100644 index 0000000000..4b29ae2f50 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/PathEndSubpath.lean @@ -0,0 +1,59 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM16.Section5Degree + +/-! +# Ends of paths inside subpaths + +A subpath can contain an end of the original path only as one of its +own ends. Otherwise its two parts through that vertex supply two +different neighbors, while the original path has only one neighbor +there. This is used to join the paths in XVI (8.1), Claim (9). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 +universe u v + +/-- An end of a path is never an internal vertex of one of its subpaths. -/ +theorem path_start_mem_subpath_is_end {α : Type u} {β : Type v} + {G P R : Graph α β} {a b x y : α} + (hP : IsGraphPathWithEnds G P a b) (hR : IsGraphPathWithEnds G R x y) + (hRP : R ≤ P) (haR : a ∈ V(R)) : a = x ∨ a = y := by + by_cases hax : a = x + · exact Or.inl hax + by_cases hay : a = y + · exact Or.inr hay + obtain ⟨L, N, hLR, hNR, hL, hN, _, hInter, _⟩ := hR.exists_split_at haR + obtain ⟨u, ⟨e, heu⟩, hua⟩ := path_exists_neighbor_at_start hL.symm hax + obtain ⟨v, ⟨f, hfv⟩, hva⟩ := path_exists_neighbor_at_start hN hay + have huP : P.Adj a u := ⟨e, (hLR.trans hRP).isLink_mono heu⟩ + have hvP : P.Adj a v := ⟨f, (hNR.trans hRP).isLink_mono hfv⟩ + have huv : u = v := path_start_neighbors_subsingleton hP huP hvP + have huBoth : u ∈ V(L) ∩ V(N) := ⟨heu.right_mem, huv.symm ▸ hfv.right_mem⟩ + have hua' : u = a := mem_singleton_iff.mp (hInter ▸ huBoth) + exact False.elim (hua hua') + +/-- A subpath meets the two original ends only at its own ends. -/ +theorem subpath_inter_ends_subset {α : Type u} {β : Type v} + {G P R : Graph α β} {a b x y : α} + (hP : IsGraphPathWithEnds G P a b) (hR : IsGraphPathWithEnds G R x y) + (hRP : R ≤ P) : V(R) ∩ ({a, b} : Set α) ⊆ {x, y} := by + rintro z ⟨hzR, rfl | hz⟩ + · exact path_start_mem_subpath_is_end hP hR hRP hzR + · rw [mem_singleton_iff] at hz + subst z + exact path_start_mem_subpath_is_end hP.symm hR hRP hzR + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/PathIsoCard.lean b/LeanPool/GraphMinor/GM16/PathIsoCard.lean new file mode 100644 index 0000000000..329d1eb0be --- /dev/null +++ b/LeanPool/GraphMinor/GM16/PathIsoCard.lean @@ -0,0 +1,51 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.Statement +import LeanPool.GraphMinor.GM16.PathIsoWalks +import LeanPool.GraphMinor.GM16.PathWalkEquivalences +import Mathlib.Data.Set.Card + +/-! +# Isomorphic paths with the same number of vertices + +A spanning simple walk enumerates the vertices of a path by a +finite interval with one more position than its length. Equal +vertex counts therefore give equal walk lengths. Matching these +positions gives an isomorphism preserving the stated ends. This +is used for the subdivision drawing in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Surface GM09 +universe u v u' v' + +/-- Paths with equal vertex cardinalities have an isomorphism that +matches their stated ends. -/ +theorem exists_iso_of_paths_of_ncard_eq + {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + {G P : Graph α β} {G' Q : Graph α' β'} {a b : α} {a' b' : α'} + (hP : IsGraphPathWithEnds G P a b) (hQ : IsGraphPathWithEnds G' Q a' b') + (hCard : V(P).ncard = V(Q).ncard) : + ∃ φ : Iso P Q, (∀ x : V(P), x.val=a → (φ.vertexEquiv x).val=a') ∧ + (∀ x : V(P), x.val=b → (φ.vertexEquiv x).val=b') := by + obtain ⟨W,hW,hV,hE⟩ := hP.2 + obtain ⟨W',hW',hV',hE'⟩ := hQ.2 + obtain ⟨φ,hφ⟩ := exists_pathWalk_vertexEquiv W hW hV + obtain ⟨φ',hφ'⟩ := exists_pathWalk_vertexEquiv W' hW' hV' + have hPCard : V(P).ncard=W.length+1 := by + simpa only [Nat.card_fin,Nat.card_coe_set_eq] using (Nat.card_congr φ).symm + have hQCard : V(Q).ncard=W'.length+1 := by + simpa only [Nat.card_fin,Nat.card_coe_set_eq] using (Nat.card_congr φ').symm + exact exists_iso_of_spanning_path_walks W W' hW hW' hV hE hV' hE' (by omega) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/PathIsoWalks.lean b/LeanPool/GraphMinor/GM16/PathIsoWalks.lean new file mode 100644 index 0000000000..fc812a854a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/PathIsoWalks.lean @@ -0,0 +1,88 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.PathWalkEquivalences +public import LeanPool.GraphMinor.Statement +import LeanPool.GraphMinor.GM16.GraphIsoEdgeEnds + +/-! +# Matching paths by their walk positions + +Two spanning simple walks of equal length enumerate their graph +vertices and edges in the same order. Match positions to construct +bijections. Consecutive positions preserve the ends of every edge, +so these bijections form an isomorphism taking the first and last +vertices to the corresponding ends. This is used to draw each +subdivision path on its prescribed line in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Surface +universe u v u' v' + +/-- Spanning simple walks of the same length give an isomorphism +matching both ends in their stated order. -/ +theorem exists_iso_of_spanning_path_walks + {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + {P : Graph α β} {Q : Graph α' β'} {a b : α} {a' b' : α'} + (W : GraphWalk P a b) (W' : GraphWalk Q a' b') (hW : W.IsSimple) (hW' : W'.IsSimple) + (hV : V(P) = {x | x ∈ W.support}) (hE : E(P) = {e | e ∈ W.edges}) + (hV' : V(Q) = {x | x ∈ W'.support}) (hE' : E(Q) = {e | e ∈ W'.edges}) + (hLen : W.length = W'.length) : + ∃ φ : Iso P Q, (∀ x : V(P), x.val=a → (φ.vertexEquiv x).val=a') ∧ + (∀ x : V(P), x.val=b → (φ.vertexEquiv x).val=b') := by + obtain ⟨vp,hvp⟩ := exists_pathWalk_vertexEquiv W hW hV + obtain ⟨vq,hvq⟩ := exists_pathWalk_vertexEquiv W' hW' hV' + obtain ⟨ep,hep⟩ := exists_pathWalk_edgeEquiv W hW hE + obtain ⟨eq,heq⟩ := exists_pathWalk_edgeEquiv W' hW' hE' + let vq' : Fin (W.length+1) ≃ V(Q) := (finCongr (congrArg (fun n => n+1) hLen)).trans vq + let eq' : Fin W.length ≃ E(Q) := (finCongr hLen).trans eq + have hvq' (i : Fin (W.length+1)) : + (vq' i).val = pathWalkVertex W' i.val (by omega) := hvq _ + have heq' (i : Fin W.length) : + (eq' i).val = pathWalkEdge W' i.val (by omega) := heq _ + let fv := vp.symm.trans vq' + let fe := ep.symm.trans eq' + have hVMap (i : Fin (W.length+1)) : fv (vp i) = vq' i := by + change vq' (vp.symm (vp i)) = vq' i + rw [vp.symm_apply_apply] + have hEnds (e : E(P)) : ∃ x y : V(P), P.IsLink e.val x.val y.val ∧ + Q.IsLink (fe e).val (fv x).val (fv y).val := by + let k := ep.symm e + let i₀ : Fin (W.length+1) := ⟨k.val,by omega⟩ + let i₁ : Fin (W.length+1) := ⟨k.val+1,by omega⟩ + refine ⟨vp i₀,vp i₁,?_,?_⟩ + · have h := pathWalkEdge_isLink W k.val k.isLt + rw [← hep k,← hvp i₀,← hvp i₁] at h + simpa only [k,Equiv.apply_symm_apply] using h + · have hEdge : (fe e).val = pathWalkEdge W' k.val (by omega) := heq' k + rw [hEdge,hVMap,hVMap,hvq',hvq'] + exact pathWalkEdge_isLink W' k.val (by omega) + let φ : Iso P Q := ⟨fv,fe,isLink_iff_of_edge_ends fv fe hEnds⟩ + refine ⟨φ,?_,?_⟩ + · intro x hx + let i : Fin (W.length+1) := ⟨0,by omega⟩ + have hpi : (vp i).val=a := (hvp i).trans (pathWalkVertex_zero W) + have hxi : x=vp i := Subtype.ext (hx.trans hpi.symm) + rw [hxi] + change (fv (vp i)).val=a' + rw [hVMap,hvq'] + exact pathWalkVertex_zero W' + · intro x hx + let i : Fin (W.length+1) := ⟨W.length,by omega⟩ + have hpi : (vp i).val=b := (hvp i).trans (pathWalkVertex_last W) + have hxi : x=vp i := Subtype.ext (hx.trans hpi.symm) + rw [hxi] + change (fv (vp i)).val=b' + rw [hVMap,hvq'] + simpa only [i,hLen] using pathWalkVertex_last W' + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/PathWalkCoordinates.lean b/LeanPool/GraphMinor/GM16/PathWalkCoordinates.lean new file mode 100644 index 0000000000..5a68cf764d --- /dev/null +++ b/LeanPool/GraphMinor/GM16/PathWalkCoordinates.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.Forest +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Positions along a graph path + +Enumerate the vertices and edges of a walk by their positions in +its two lists. The edge at position `i` joins the vertices at +positions `i` and `i+1`. For a simple walk these enumerations are +injective. They provide the endpoint-preserving isomorphisms used +to draw the replacing paths of the subdivision in XVI (4.2). +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Graph Surface GM11 +universe u v +variable {α : Type u} {β : Type v} {G : Graph α β} + +/-- The vertex at a specified position along a walk. -/ +def pathWalkVertex {a b : α} (W : GraphWalk G a b) (i : ℕ) (hi : i ≤ W.length) : α := + W.support[i]'(by rw [length_support]; omega) + +/-- The edge at a specified position along a walk. -/ +def pathWalkEdge {a b : α} (W : GraphWalk G a b) (i : ℕ) (hi : i < W.length) : β := + W.edges[i] + +/-- The first position is the starting vertex. -/ +theorem pathWalkVertex_zero {a b : α} (W : GraphWalk G a b) : + pathWalkVertex W 0 (Nat.zero_le _) = a := by + cases W <;> rfl + +/-- The last position is the final vertex. -/ +theorem pathWalkVertex_last {a b : α} (W : GraphWalk G a b) : + pathWalkVertex W W.length le_rfl = b := by + induction W with + | nil _ => rfl + | cons h W ih => + change pathWalkVertex W W.length le_rfl = _ + exact ih + +/-- Every edge joins its two consecutive vertex positions. -/ +theorem pathWalkEdge_isLink {a b : α} (W : GraphWalk G a b) (i : ℕ) (hi : i < W.length) : + G.IsLink (pathWalkEdge W i hi) (pathWalkVertex W i (by omega)) + (pathWalkVertex W (i+1) (by omega)) := by + induction W generalizing i with + | nil _ => simp only [GraphWalk.length_nil] at hi; omega + | cons h W ih => + cases i with + | zero => + change G.IsLink _ _ (pathWalkVertex W 0 (Nat.zero_le _)) + rw [pathWalkVertex_zero W] + exact h + | succ i => + have hi' : i < W.length := by simp only [GraphWalk.length_cons] at hi; omega + exact ih i hi' + +/-- Different vertex positions of a simple walk have different values. -/ +theorem pathWalkVertex_injective {a b : α} {W : GraphWalk G a b} (hW : W.IsSimple) + {i j : ℕ} (hi : i ≤ W.length) (hj : j ≤ W.length) + (he : pathWalkVertex W i hi = pathWalkVertex W j hj) : i=j := + hW.getElem_inj_iff.mp he + +/-- Different edge positions of a simple walk have different values. -/ +theorem pathWalkEdge_injective {a b : α} {W : GraphWalk G a b} (hW : W.IsSimple) + {i j : ℕ} (hi : i < W.length) (hj : j < W.length) + (he : pathWalkEdge W i hi = pathWalkEdge W j hj) : i=j := + hW.edges_nodup.getElem_inj_iff.mp he + +/-- Every position names a vertex in the walk's support. -/ +theorem pathWalkVertex_mem_support {a b : α} (W : GraphWalk G a b) (i : ℕ) (hi : i ≤ W.length) : + pathWalkVertex W i hi ∈ W.support := List.getElem_mem _ + +/-- Every position names an edge traversed by the walk. -/ +theorem pathWalkEdge_mem_edges {a b : α} (W : GraphWalk G a b) (i : ℕ) (hi : i < W.length) : + pathWalkEdge W i hi ∈ W.edges := List.getElem_mem _ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/PathWalkEquivalences.lean b/LeanPool/GraphMinor/GM16/PathWalkEquivalences.lean new file mode 100644 index 0000000000..d27587603a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/PathWalkEquivalences.lean @@ -0,0 +1,72 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.PathWalkCoordinates +import LeanPool.GraphMinor.GM11.Forest +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Enumerating a path's vertices and edges by finite intervals + +A simple walk lists each vertex and edge of its path exactly once. +The position maps therefore give equivalences with finite integer +intervals. The specifications retain the order along the path, +which fixes the two ends when matching it to a line drawing in +XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Surface GM11 +universe u v +variable {α : Type u} {β : Type v} {P : Graph α β} + +/-- The vertex positions of a spanning simple walk enumerate the path vertices. -/ +theorem exists_pathWalk_vertexEquiv {a b : α} (W : GraphWalk P a b) (hW : W.IsSimple) + (hV : V(P) = {x | x ∈ W.support}) : + ∃ φ : Fin (W.length+1) ≃ V(P), ∀ i, + (φ i).val = pathWalkVertex W i.val (by omega) := by + let f : Fin (W.length+1) → V(P) := fun i => + ⟨pathWalkVertex W i.val (by omega),(congrArg (fun A : Set α => pathWalkVertex W i.val + (by omega) ∈ A) hV).mpr + (pathWalkVertex_mem_support W i.val (by omega))⟩ + have hf : Function.Bijective f := by + constructor + · intro i j he + apply Fin.ext + exact pathWalkVertex_injective hW (by omega) (by omega) (congrArg Subtype.val he) + · intro x + have hx : x.val ∈ W.support := (congrArg (fun A : Set α => x.val ∈ A) hV).mp x.property + obtain ⟨i,hi,he⟩ := List.mem_iff_getElem.mp hx + have hi' : i < W.length+1 := length_support W ▸ hi + exact ⟨⟨i,hi'⟩,Subtype.ext he⟩ + exact ⟨Equiv.ofBijective f hf,fun _ => rfl⟩ + +/-- The edge positions of a spanning simple walk enumerate the path edges. -/ +theorem exists_pathWalk_edgeEquiv {a b : α} (W : GraphWalk P a b) (hW : W.IsSimple) + (hE : E(P) = {e | e ∈ W.edges}) : + ∃ φ : Fin W.length ≃ E(P), ∀ i, + (φ i).val = pathWalkEdge W i.val i.isLt := by + let f : Fin W.length → E(P) := fun i => + ⟨pathWalkEdge W i.val i.isLt,(congrArg (fun A : Set β => pathWalkEdge W i.val i.isLt ∈ A) + hE).mpr + (pathWalkEdge_mem_edges W i.val i.isLt)⟩ + have hf : Function.Bijective f := by + constructor + · intro i j he + apply Fin.ext + exact pathWalkEdge_injective hW i.isLt j.isLt (congrArg Subtype.val he) + · intro x + have hx : x.val ∈ W.edges := (congrArg (fun A : Set β => x.val ∈ A) hE).mp x.property + obtain ⟨i,hi,he⟩ := List.mem_iff_getElem.mp hx + exact ⟨⟨i,hi⟩,Subtype.ext he⟩ + exact ⟨Equiv.ofBijective f hf,fun _ => rfl⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ProperArrangement.lean b/LeanPool/GraphMinor/GM16/ProperArrangement.lean new file mode 100644 index 0000000000..b10ddbbc29 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ProperArrangement.lean @@ -0,0 +1,14 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM16.ProperArrangementFacts + +/-! Properness criteria for the arrangements used in XVI (7.2). -/ diff --git a/LeanPool/GraphMinor/GM16/ProperArrangementDefs.lean b/LeanPool/GraphMinor/GM16/ProperArrangementDefs.lean new file mode 100644 index 0000000000..ae868de131 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ProperArrangementDefs.lean @@ -0,0 +1,35 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Defs + +/-! Proper arrangements of segregations in a surface. -/ + +@[expose] public section + +namespace GraphMinor.GM16 + +open Set GraphMinor.GM09 GraphMinor.GM14 + +universe u v w + +variable {α : Type u} {β : Type v} + +/-- Proper arrangement of a segregation in a surface (Graph Minors XVI, Section 3, page 49): +"An arrangement is *proper* if $\Delta_i \cap \Delta_j = \emptyset$ for all $1 \le i < j \le k$ such +that $|\bar{\Omega}_i|, |\bar{\Omega}_j| > 3$." -/ +def IsProperArrangement {S : Type w} [TopologicalSpace S] + (S_seg : Set (Society α β)) (α_disc : Society α β → Set S) (α_pt : α → S) : Prop := + IsSurfaceArrangement S_seg α_disc α_pt ∧ + ∀ ⦃S₁ : Society α β⦄, S₁ ∈ S_seg → ∀ ⦃S₂ : Society α β⦄, S₂ ∈ S_seg → + S₁ ≠ S₂ → 3 < S₁.Ω.bar.ncard → 3 < S₂.Ω.bar.ncard → + Disjoint (α_disc S₁) (α_disc S₂) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ProperArrangementFacts.lean b/LeanPool/GraphMinor/GM16/ProperArrangementFacts.lean new file mode 100644 index 0000000000..2e917640cb --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ProperArrangementFacts.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.ProperArrangementDefs + +/-! +# Properness of the arrangements used in XVI (7.2) + +The observation on page 62 of XVI concerns the construction in XV (7.7). +The societies with more than three boundary vertices come from distinct +pieces whose vertex sets are disjoint by XV (7.6). An intersection of +their arrangement discs would give a common boundary vertex, so their +discs are disjoint. The second lemma expresses the same argument using +the disjoint containing discs in XV (7.5)(i). +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM14 +universe u v w + +/-- The properness observation in XVI, page 62: disjoint boundary vertex +sets for the large societies force disjoint arrangement discs. -/ +theorem IsSurfaceArrangement.isProper_of_disjoint_boundaries + {S : Type w} [TopologicalSpace S] + {α : Type u} {β : Type v} {𝒮 : Set (Society α β)} + {disc : Society α β → Set S} {pt : α → S} + (h : IsSurfaceArrangement 𝒮 disc pt) + (hDisj : ∀ A ∈ 𝒮, ∀ B ∈ 𝒮, A ≠ B → + 3 < A.Ω.bar.ncard → 3 < B.Ω.bar.ncard → Disjoint A.Ω.bar B.Ω.bar) : + IsProperArrangement 𝒮 disc pt := by + refine ⟨h, ?_⟩ + intro A hA B hB hne hlargeA hlargeB + refine disjoint_left.mpr ?_ + intro x hxA hxB + obtain ⟨v, hv, _⟩ := h.inter_discs _ hA _ hB hne ⟨hxA, hxB⟩ + exact (disjoint_left.mp (hDisj _ hA _ hB hne hlargeA hlargeB)) hv.1 hv.2 + +/-- The alternative properness check in XVI, page 62, using XV (7.5)(i): +each containing disc contains at most one large society's disc. -/ +theorem IsSurfaceArrangement.isProper_of_disjoint_containers + {S : Type w} [TopologicalSpace S] + {α : Type u} {β : Type v} {𝒮 : Set (Society α β)} + {disc : Society α β → Set S} {pt : α → S} + {ι : Type*} {Δ : ι → Set S} + (h : IsSurfaceArrangement 𝒮 disc pt) + (hΔ : Pairwise (fun i j => Disjoint (Δ i) (Δ j))) + (hContain : ∀ A ∈ 𝒮, 3 < A.Ω.bar.ncard → ∃ i, disc A ⊆ Δ i) + (hOne : ∀ i, ∀ A ∈ 𝒮, ∀ B ∈ 𝒮, + 3 < A.Ω.bar.ncard → 3 < B.Ω.bar.ncard → + disc A ⊆ Δ i → disc B ⊆ Δ i → A = B) : + IsProperArrangement 𝒮 disc pt := by + refine ⟨h, ?_⟩ + intro A hA B hB hne hlargeA hlargeB + obtain ⟨i, hi⟩ := hContain A hA hlargeA + obtain ⟨j, hj⟩ := hContain B hB hlargeB + have hij : i ≠ j := fun heq => hne (hOne i A hA B hB hlargeA hlargeB hi (heq ▸ hj)) + exact (hΔ hij).mono hi hj + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ProperBridgeIntersections.lean b/LeanPool/GraphMinor/GM16/ProperBridgeIntersections.lean new file mode 100644 index 0000000000..1ef1ce7566 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ProperBridgeIntersections.lean @@ -0,0 +1,28 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.BridgeFacts +public import LeanPool.GraphMinor.GM15.Section7 +public import LeanPool.GraphMinor.GM16.ProperArrangement + +/-! +# Bridge intersections in the local arrangement assembly + +These graph facts supply Claim (1) and Claim (2) of XV (7.7), pages 139–140. +-/ + +public section + +namespace GraphMinor.GM16 + +export GM14 (isBridge_of_component exists_bridge_of_mem_vertexSet exists_bridge_of_mem_edgeSet + isBridge_disjoint_edgeSet isBridge_vertexSet_eq_of_inter) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ProperDiscCoordinates.lean b/LeanPool/GraphMinor/GM16/ProperDiscCoordinates.lean new file mode 100644 index 0000000000..1939287d89 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ProperDiscCoordinates.lean @@ -0,0 +1,31 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.DiscBoundaryHomeomorphism +public import LeanPool.GraphMinor.GM15.Section7 +public import LeanPool.GraphMinor.GM16.ProperArrangement + +/-! +# Disc coordinates for proper arrangements + +Planar disc boundaries and increasing angle interpolation for XVI (7.2). +-/ + +public section + +namespace GraphMinor.GM16 + +export GM14 (isInteriorPoint_euclideanPlane + isClosedDisc_frontier_eq_discBd_euclideanPlane + isClosedDisc_subBd_eq_discBd_euclideanPlane + exists_strictMonoOn_interp + exists_circle_homeo_matching_angles) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ProperDiscExtension.lean b/LeanPool/GraphMinor/GM16/ProperDiscExtension.lean new file mode 100644 index 0000000000..d798d76361 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ProperDiscExtension.lean @@ -0,0 +1,27 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.DiscBoundaryHomeomorphism +public import LeanPool.GraphMinor.GM16.ProperDiscCoordinates + +/-! +# Extending homeomorphisms of disc boundaries + +Extending ordered boundary maps to discs in the proper arrangement of XVI (7.2). +-/ + +public section + +namespace GraphMinor.GM16 + +export GM14 (exists_disc_extension_of_bd_homeo + exists_angles_of_isClockwiseSeq) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ProperDiscIntersection.lean b/LeanPool/GraphMinor/GM16/ProperDiscIntersection.lean new file mode 100644 index 0000000000..5df0d69eb9 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ProperDiscIntersection.lean @@ -0,0 +1,26 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.DiscArrangement +public import LeanPool.GraphMinor.GM16.ProperDiscTransport + +/-! +# Intersections with normal disc boundaries + +Intersections of cells of the proper arrangement with a normal disc in XVI (7.2). +-/ + +public section + +namespace GraphMinor.GM16 + +export GM14 (inter_disc_subset_subBd_of_not_subset) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ProperDiscTransport.lean b/LeanPool/GraphMinor/GM16/ProperDiscTransport.lean new file mode 100644 index 0000000000..289556b2fc --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ProperDiscTransport.lean @@ -0,0 +1,27 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.DiscArrangement +public import LeanPool.GraphMinor.GM16.ProperDiscExtension + +/-! +# Transporting a disc arrangement to a surface + +Matching boundary points and transporting the disc arrangement in XVI (7.2). +-/ + +public section + +namespace GraphMinor.GM16 + +export GM14 (exists_bd_homeo_of_agreesWithOArcHomeo + exists_surface_disc_arrangement_of_isDiscArrangement) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ProperEyeInduction.lean b/LeanPool/GraphMinor/GM16/ProperEyeInduction.lean new file mode 100644 index 0000000000..c996aaa330 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ProperEyeInduction.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.ProperEyeInductionStep +public import LeanPool.GraphMinor.GM15.Section8 + +/-! +# Proper arrangements through the downward eye induction + +The induction in XV, pages 115–116, repeatedly applies the eye step. +The arrangement outcome keeps the same discs while its numerical bounds +increase. We retain its properness for XVI (7.2), page 62. +-/ + +public section +namespace GraphMinor.GM16 +open Set Function Topology +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM14 GM15 +universe u v w + +/-- XV (1.1), pages 115–116, with the properness retained from the actual +arrangement construction, as required in XVI (7.2), page 62. -/ +theorem proper_arrangement_or_independent_eyes_or_crosscap + : + ∀ (S : Type w) [TopologicalSpace S] [T2Space S], + IsSurface S → ConnectedSpace S → bd S = ∅ → + ∀ (κ φ μ : ℕ), + ∃ (θ lam p : ℕ), + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H₀ : Drawing S) (η₀ : SpanEmbedding H₀ G) (θ₀ : ℕ) + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ), + IsFlatSpan G H₀ η₀ θ_star θ₀ lam μ T_star T₀ → + HasTangleMetric H₀ θ₀ T₀ d₀ → + θ ≤ θ₀ → + (∃ (H' : Drawing S) (η' : SpanEmbedding H' G) (θ' : ℕ) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ), + IsSigmaSpan G H' η' θ_star θ' T_star T' ∧ + HasTangleMetric H' θ' T' d' ∧ + φ ≤ θ' ∧ + HasIndependentEyes G H' η' θ' T' d' (κ + 1)) ∨ + (∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S'), + IsObtainedByAddingCrosscap S S' ∧ + ∃ (H' : Drawing S') (η' : SpanEmbedding H' G) (θ' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + φ ≤ θ' ∧ IsSigmaSpan G H' η' θ_star θ' T_star T') ∨ + (∃ (𝒮 : Set (Society α β)) (disc : Society α β → Set S) (pt : α → S), + IsCentralSegregation G T_star 𝒮 ∧ + GM15.IsSegregationOfType G p κ 𝒮 ∧ IsProperArrangement 𝒮 disc pt) := + GM15.theorem_1_1_proper + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ProperEyeInductionStep.lean b/LeanPool/GraphMinor/GM16/ProperEyeInductionStep.lean new file mode 100644 index 0000000000..84796eefae --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ProperEyeInductionStep.lean @@ -0,0 +1,56 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.EyeInductionParameters +public import LeanPool.GraphMinor.GM16.ProperLocalAssembly + +/-! +# Properness through the eye induction + +The induction step in XV (1.2), proved on pages 144–145, either creates +another eye, adds a crosscap, or uses the arrangement from XV (7.7). +We retain the properness of that arrangement in the third outcome, +as required by XVI (7.2), page 62. +-/ + +public section +namespace GraphMinor.GM16 +open Set Function Topology +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM14 GM15 +universe u v w + +/-- The induction step of XV (1.2), retaining the proper arrangement +from XV (7.7) for the use in XVI (7.2), page 62. -/ +theorem proper_eye_induction_step + : + ∀ (S : Type w) [TopologicalSpace S] [T2Space S], + IsSurface S → ConnectedSpace S → bd S = ∅ → + ∀ (k φ μ lam_next θ_next : ℕ), + 8 ≤ φ → 12 ≤ μ → Even μ → 4 ≤ lam_next → + 4 * lam_next + μ + 2 ≤ θ_next → + ∃ (p_k lam_k θ_k : ℕ), + 4 * lam_k + μ + 2 ≤ θ_k ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H₀ : Drawing S) (η₀ : SpanEmbedding H₀ G) (θ₀ : ℕ) + (T₀ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₀ : Set S → Set S → ℕ), + IsFlatSpan G H₀ η₀ θ_star θ₀ lam_k μ T_star T₀ → + HasTangleMetric H₀ θ₀ T₀ d₀ → + θ_k ≤ θ₀ → + HasEyesAtDistance G H₀ η₀ θ₀ T₀ d₀ k θ_k → + Section7S1 S G θ_star T_star k μ lam_next θ_next ∨ + Section7S2 S G θ_star T_star φ ∨ + (∃ (𝒮 : Set (Society α β)) (disc : Society α β → Set S) (pt : α → S), + IsCentralSegregation G T_star 𝒮 ∧ + GM15.IsSegregationOfType G p_k k 𝒮 ∧ IsProperArrangement 𝒮 disc pt) := + GM15.theorem_1_2_proper + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ProperLocalAssembly.lean b/LeanPool/GraphMinor/GM16/ProperLocalAssembly.lean new file mode 100644 index 0000000000..54a28ccbda --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ProperLocalAssembly.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Section7 +public import LeanPool.GraphMinor.GM16.ProperArrangement + + +/-! +# The proper arrangement in the proof of XVI (7.2) + +We retain the arrangement constructed in XV (7.7), pages 139–142. +A large society belongs to one of its local segregations, each of which +has at most one large society. Distinct local pieces have disjoint vertex +sets by XV (7.6), so their large societies have disjoint boundary sets. +This proves the properness asserted in XVI, page 62. +-/ + +public section +namespace GraphMinor.GM16 +open Set Function Topology +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM14 GM15 +universe u v w +variable {α : Type u} {β : Type v} + +/-- The construction of XV (7.7), pages 139–142, gives a proper arrangement, +as observed in XVI (7.2), page 62. Its claims (1)–(9) build the segregation +and arrangement. Properness then follows from XV (7.6) and the fact that +each local segregation has at most one society with more than three ends. -/ +theorem exists_proper_arrangement_of_no_crooked_transactions + : + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (θ_star θ θ' lam π beta μ k : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (r : Fin k → Set S) + (η₀ : SpanEmbedding H (section7G0 G H η d θ' μ r)) + (S₀ : Set (Society α β)) (α₀_disc : Society α β → Set S) (α₀_pt : α → S) + (D : ∀ i : Fin k, Section75EyeData G H η θ_star θ θ' π beta μ T_star T d r S₀ α₀_disc α₀_pt i), + IsFlatSpan G H η θ_star θ lam μ T_star T → + HasTangleMetric H θ T d → + 1 ≤ μ → 2 ≤ π → π ≠ 3 → beta = 2 * π + 8 → + θ' + 13 * μ + 14 ≤ beta → 100 * beta ≤ θ → + Injective r → + (∀ i : Fin k, IsDrawingEye G H η θ T (r i)) → + (∀ i j : Fin k, i ≠ j → d (r i) (r j) = θ) → + (∀ v ∈ H.V, η₀.vMap v = η.vMap v) → + (∀ e ∈ H.E, η₀.eMap e = η.eMap e) → + IsThreeSegregation (section7G0 G H η d θ' μ r) S₀ → + IsTangleLocal (section7G0 G H η d θ' μ r) H η₀ T S₀ → + IsSurfaceArrangement S₀ α₀_disc α₀_pt → + IsCompatibleWith (section7G0 G H η d θ' μ r) H η₀ S₀ α₀_disc α₀_pt → + Pairwise (fun i j : Fin k => Disjoint (D i).Δ (D j).Δ) → + (∀ i : Fin k, ∀ P_set : Set (Graph α β), + (D i).localSociety.IsCrookedTransaction P_set → P_set.ncard ≠ π) → + ∃ (𝒮 : Set (Society α β)) (disc : Society α β → Set S) (pt : α → S), + IsCentralSegregation G T_star 𝒮 ∧ + GM15.IsSegregationOfType G (3 * π + 9) k 𝒮 ∧ IsProperArrangement 𝒮 disc pt := by + intro S _ _ α β G H η θ_star θ θ' lam π beta μ k T_star T d r η₀ S₀ α₀_disc α₀_pt D + hFlat hMetric hμ1 hπ2 hπ3 hbeta_eq hbeta_ge hθ_ge hr_inj hr_eye hr_dist hη₀_v hη₀_e + hThree hLocal hArr₀ hCompat₀ hDisj_Δ hno_crooked + obtain ⟨𝒮, disc, pt, hCentral, hType, hArr, hDisj⟩ := + assemble_eye_arrangement G H η θ_star θ θ' lam π beta μ k T_star T d r η₀ S₀ α₀_disc α₀_pt + D hFlat hMetric hμ1 hπ2 hπ3 hbeta_eq hbeta_ge hθ_ge hr_inj hr_eye hr_dist hη₀_v hη₀_e + hThree hLocal hArr₀ hCompat₀ hDisj_Δ hno_crooked + exact ⟨𝒮, disc, pt, hCentral, hType, + IsSurfaceArrangement.isProper_of_disjoint_boundaries hArr hDisj⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/RectangleStack.lean b/LeanPool/GraphMinor/GM16/RectangleStack.lean new file mode 100644 index 0000000000..1bfc9caebb --- /dev/null +++ b/LeanPool/GraphMinor/GM16/RectangleStack.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Topology.Instances.Real.Lemmas +import Mathlib.Tactic.Linarith + +/-! +# A stack of horizontal rectangles + +Each row is a rectangle of height one. The top of a stack of `n` +rows is at height `n`. A new row meets the stack only in the top +side of the last row. These set calculations support the disc +construction for the outer boundary of the wall in XVI (4.2). +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set + +/-- The union of the first `n` horizontal rectangles with the given +left and right sides. -/ +def rectangleStack (left right : ℕ → ℝ) (n : ℕ) : Set (ℝ × ℝ) := + ⋃ k < n, Icc (left k) (right k) ×ˢ Icc (k : ℝ) ((k : ℝ)+1) + +/-- Appending the next row is set union with its rectangle. -/ +theorem rectangleStack_succ (left right : ℕ → ℝ) (n : ℕ) : + rectangleStack left right (n+1) = rectangleStack left right n ∪ + (Icc (left n) (right n) ×ˢ Icc (n : ℝ) ((n : ℝ)+1)) := by + exact biUnion_lt_succ _ _ + +/-- The vertical coordinate of a point in the first `n` rows is at most `n`. -/ +theorem rectangleStack_vertical_le {left right : ℕ → ℝ} {n : ℕ} {p : ℝ × ℝ} + (hp : p ∈ rectangleStack left right n) : p.2 ≤ (n : ℝ) := by + obtain ⟨k,hk,hp⟩ := mem_iUnion₂.mp hp + have hk' : (k : ℝ)+1 ≤ (n : ℝ) := by exact_mod_cast hk + exact hp.2.2.trans hk' + +/-- A stack and the next row meet in the overlap of their horizontal +sides at the stack's top height. -/ +theorem rectangleStack_inter_next {left right : ℕ → ℝ} {n : ℕ} (hn : 1 ≤ n) : + rectangleStack left right n ∩ + (Icc (left n) (right n) ×ˢ Icc (n : ℝ) ((n : ℝ)+1)) = + Icc (max (left (n-1)) (left n)) (min (right (n-1)) (right n)) ×ˢ {(n : ℝ)} := by + ext p + constructor + · rintro ⟨hp,hpNew⟩ + obtain ⟨k,hk,hpOld⟩ := mem_iUnion₂.mp hp + have hnk : n ≤ k+1 := by exact_mod_cast (hpNew.2.1.trans hpOld.2.2) + have hkn : k = n-1 := by omega + have hpTop : p.2 = (n : ℝ) := le_antisymm + (rectangleStack_vertical_le (mem_iUnion₂.mpr ⟨k,hk,hpOld⟩)) hpNew.2.1 + refine ⟨⟨max_le ?_ hpNew.1.1,le_min ?_ hpNew.1.2⟩,hpTop⟩ + · exact hkn ▸ hpOld.1.1 + · exact hkn ▸ hpOld.1.2 + · rintro ⟨⟨hpLo,hpHi⟩,hpTop⟩ + have hPrev : n-1 < n := by omega + have hPrevReal : ((n-1 : ℕ) : ℝ)+1 = (n : ℝ) := by + exact_mod_cast (show n-1+1=n by omega) + have hPrevLe : ((n-1 : ℕ) : ℝ) ≤ (n : ℝ) := by exact_mod_cast (show n-1≤n by omega) + constructor + · apply mem_iUnion₂.mpr + refine ⟨n-1,hPrev,⟨⟨(max_le_iff.mp hpLo).1,(le_min_iff.mp hpHi).1⟩,?_⟩⟩ + exact ⟨hpTop.symm ▸ hPrevLe, by rw [hpTop,hPrevReal]⟩ + · exact ⟨⟨(max_le_iff.mp hpLo).2,(le_min_iff.mp hpHi).2⟩, + ⟨hpTop.ge,by rw [hpTop]; exact le_add_of_nonneg_right zero_le_one⟩⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/RectangleStackDisc.lean b/LeanPool/GraphMinor/GM16/RectangleStackDisc.lean new file mode 100644 index 0000000000..3cba29fcec --- /dev/null +++ b/LeanPool/GraphMinor/GM16/RectangleStackDisc.lean @@ -0,0 +1,55 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.RectangleStack +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM16.RectangleStackStep +import LeanPool.GraphMinor.GM16.RectangularDisc +import Mathlib.Tactic.Linarith + +/-! +# A stack of overlapping rows is a disc + +Start with the bottom rectangle. A new row meets the preceding +stack in the overlap of their horizontal sides. Positive overlap +makes that side a line, and the rectangle append lemma proves that +the union is still a disc. This constructs the enclosed disc for +the outer face of the wall in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- Nondegenerate rows whose consecutive horizontal intervals overlap +in positive length form a disc, after embedding in a closed surface. -/ +theorem isClosedDisc_rectangleStack {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {f : (ℝ × ℝ) → S} (hf : IsEmbedding f) + (left right : ℕ → ℝ) (hWidth : ∀ k, left k < right k) + (hOverlap : ∀ k, max (left k) (left (k + 1)) < min (right k) (right (k + 1))) + {n : ℕ} (hn : 1 ≤ n) : IsClosedDisc (f '' rectangleStack left right n) := by + induction n with + | zero => omega + | succ n ih => + by_cases hn0 : n = 0 + · subst n + have hRect := isClosedDisc_image_real_rectangle hf (hWidth 0) + (show (0 : ℝ) < 0+1 by norm_num) + simpa [rectangleStack] using hRect + have hn1 : 1 ≤ n := by omega + have hPrev : n-1+1 = n := by omega + have hPos : max (left (n-1)) (left n) < min (right (n-1)) (right n) := by + simpa only [hPrev] using hOverlap (n-1) + rw [rectangleStack_succ] + exact isClosedDisc_append_rectangle hS hf (ih hn1) (hWidth n) + (show (n : ℝ) < (n : ℝ)+1 by linarith) hPos + (fun _ hp => rectangleStack_vertical_le hp) (rectangleStack_inter_next hn1) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/RectangleStackStep.lean b/LeanPool/GraphMinor/GM16/RectangleStackStep.lean new file mode 100644 index 0000000000..e4722ffd9c --- /dev/null +++ b/LeanPool/GraphMinor/GM16/RectangleStackStep.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM16.DiscCoordinateBoundary +import LeanPool.GraphMinor.GM16.RectangularDisc +import LeanPool.GraphMinor.GM16.RectangularLines +import LeanPool.GraphMinor.GM16.LineImageEmbedding +import LeanPool.GraphMinor.Surface.DiscUnion + +/-! +# Adding a row to a disc made of rectangles + +The union of the wall's brick rows is a disc. At each step the new +row meets the previous rows in a horizontal interval at their top +height. Coordinate bounds put this interval on both disc boundaries, +so the disc union theorem applies. This file proves that step for +the coordinate embedding into a closed surface. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- Append a rectangle above a disc when the intersection is one +nondegenerate horizontal side. -/ +theorem isClosedDisc_append_rectangle {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {f : (ℝ × ℝ) → S} (hf : IsEmbedding f) + {A : Set (ℝ × ℝ)} {a b c d l r : ℝ} + (hA : IsClosedDisc (f '' A)) (hab : a < b) (hcd : c < d) (hlr : l < r) + (hBound : ∀ p ∈ A, p.2 ≤ c) + (hMeet : A ∩ (Icc a b ×ˢ Icc c d) = Icc l r ×ˢ {c}) : + IsClosedDisc (f '' (A ∪ (Icc a b ×ˢ Icc c d))) := by + let R := Icc a b ×ˢ Icc c d + let L := Icc l r ×ˢ {c} + have hR : IsClosedDisc (f '' R) := isClosedDisc_image_real_rectangle hf hab hcd + have hL := isLineWithEnds_image_embedding hf (horizontal_interval_isLine hlr c) + have hInter : (f '' A) ∩ (f '' R) = f '' L := by + rw [← image_inter hf.injective] + exact congrArg (fun X => f '' X) hMeet + have hLeft : f '' L ⊆ discBd (f '' A) := by + rintro x ⟨p,hp,rfl⟩ + have hpA : p ∈ A := (hMeet.symm ▸ (show p ∈ Icc l r ×ˢ {c} from hp)).1 + apply mem_discBd_of_vertical_max hS hA hf.continuous ?_ (mem_image_of_mem f hpA) hp.2 + intro q hq + obtain ⟨z,hz,hzq⟩ := hq + exact hf.injective hzq ▸ hBound z hz + have hRight : f '' L ⊆ discBd (f '' R) := by + rintro x ⟨p,hp,rfl⟩ + have hpR : p ∈ R := (hMeet.symm ▸ (show p ∈ Icc l r ×ˢ {c} from hp)).2 + apply mem_discBd_of_vertical_min hS hR hf.continuous ?_ (mem_image_of_mem f hpR) hp.2 + intro q hq + obtain ⟨z,hz,hzq⟩ := hq + exact hf.injective hzq ▸ hz.2.1 + have hDisc := (disc_union (f '' A) (f '' R) (f '' L) + (f (l,c)) (f (r,c)) hA hR hL hInter hLeft hRight).1 + rwa [image_union] + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/RectangularDisc.lean b/LeanPool/GraphMinor/GM16/RectangularDisc.lean new file mode 100644 index 0000000000..b5a07e9b3a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/RectangularDisc.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.Surface.Cap +import LeanPool.GraphMinor.Surface.Wedge +import Mathlib.Analysis.Complex.Basic + +/-! +# Closed rectangles as discs + +The rectangular faces of the wall are closed discs. Transfer the +rectangle theorem in complex coordinates to real coordinate pairs, +then carry the disc through the embedding used for the sphere +wall drawing. The interior of its image is contained in the image +of the open rectangle, which is the inclusion needed to check +that it misses the drawing. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- A nondegenerate closed rectangle in the real coordinate plane is a disc. -/ +theorem isClosedDisc_real_rectangle_with_boundary {a b c d : ℝ} (hab : a < b) (hcd : c < d) : + IsClosedDisc (Icc a b ×ˢ Icc c d) ∧ + discBd (Icc a b ×ˢ Icc c d) = frontier (Icc a b ×ˢ Icc c d) := by + let e : ℂ ≃ₜ (ℝ × ℝ) := Complex.equivRealProdCLM.toHomeomorph + obtain ⟨hD,hDb⟩ := Surface.isClosedDisc_rect hab hcd + obtain ⟨hImage,hImageB⟩ := isClosedDisc_image_injOn hD hD.isCompact + e.continuous.continuousOn e.injective.injOn + have he : e '' (Icc a b ×ℂ Icc c d) = Icc a b ×ˢ Icc c d := by + ext x + constructor + · rintro ⟨z,hz,rfl⟩ + exact hz + · intro hx + exact ⟨⟨x.1,x.2⟩,hx,rfl⟩ + refine ⟨he ▸ hImage,?_⟩ + rw [← he,hImageB,hDb,e.image_frontier] + +/-- A nondegenerate closed rectangle in real coordinates is a disc. -/ +theorem isClosedDisc_real_rectangle {a b c d : ℝ} (hab : a < b) (hcd : c < d) : + IsClosedDisc (Icc a b ×ˢ Icc c d) := + (isClosedDisc_real_rectangle_with_boundary hab hcd).1 + +/-- Carry a closed rectangle through an embedding into a Hausdorff space. -/ +theorem isClosedDisc_image_real_rectangle {S : Type*} [TopologicalSpace S] [T2Space S] + {f : (ℝ × ℝ) → S} (hf : IsEmbedding f) + {a b c d : ℝ} (hab : a < b) (hcd : c < d) : + IsClosedDisc (f '' (Icc a b ×ˢ Icc c d)) := + (isClosedDisc_image_injOn (isClosedDisc_real_rectangle hab hcd) + (isCompact_Icc.prod isCompact_Icc) hf.continuous.continuousOn hf.injective.injOn).1 + +/-- An interior point of an embedded closed rectangle comes from its open +rectangle. Only continuity and injectivity of the embedding are needed. -/ +theorem interior_image_rectangle_subset {S : Type*} [TopologicalSpace S] + {f : (ℝ × ℝ) → S} (hf : IsEmbedding f) (a b c d : ℝ) : + interior (f '' (Icc a b ×ˢ Icc c d)) ⊆ f '' (Ioo a b ×ˢ Ioo c d) := by + intro x hx + obtain ⟨y,_,rfl⟩ := interior_subset hx + refine ⟨y,?_,rfl⟩ + have hy := preimage_interior_subset_interior_preimage hf.continuous hx + rw [Set.preimage_image_eq _ hf.injective,interior_prod_eq,interior_Icc,interior_Icc] at hy + exact hy + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/RectangularGridDrawing.lean b/LeanPool/GraphMinor/GM16/RectangularGridDrawing.lean new file mode 100644 index 0000000000..05bb0af739 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/RectangularGridDrawing.lean @@ -0,0 +1,83 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.RectangularGridLines +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM16.RectangularGridLinePoints +import LeanPool.GraphMinor.GM16.RectangularGridLineIntersections +import LeanPool.GraphMinor.GM16.EmbeddedLineGraphDrawing + +/-! +# The straight-line drawing of a grid subgraph + +Place every vertex at its lattice point and use the assigned unit +lines for edges. The endpoint and intersection checks show that the +finite-line construction applies. The resulting graph drawing has +exactly the prescribed vertex map and edge closures. This includes +the alternating-edge wall used in XVI (4.2), page 53. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph Topology GraphMinor.Surface +universe u + +/-- A grid subgraph drawn in any space containing an embedded coordinate +plane, with both maps specified. -/ +theorem exists_rectangularGrid_embedded_drawing {m n : ℕ} + (H : SimpleGraph (Fin m × Fin n)) (hSub : H ≤ pathGraph m □ pathGraph n) + {S : Type u} [TopologicalSpace S] [T2Space S] (j : (ℝ × ℝ) → S) (hj : IsEmbedding j) : + ∃ Γ : GraphDrawing (Graph.ofSimpleGraph H) S, + Γ.drawing.V = range (j ∘ @rectangularGridPoint m n) ∧ + (∀ v : V(Graph.ofSimpleGraph H), (Γ.iso.vertexEquiv v).val = j (rectangularGridPoint v.val)) ∧ + (∀ e : E(Graph.ofSimpleGraph H), closure (Γ.iso.edgeEquiv e).val + = j '' rectangularGridLine e.val) := by + obtain ⟨Γ,hV,hVertices,hEdges⟩ := exists_graphDrawing_of_embedded_lines + (Graph.ofSimpleGraph H) (Set.toFinite _) (Set.toFinite _) + rectangularGridPoint (rectangularGridPoint_injective m n).injOn rectangularGridLine + (fun e v hLoop => by + have he : e ∈ H.edgeSet := hLoop.2 + rw [hLoop.1] at he + exact (show H.Adj v v from he).ne rfl) + (fun e he a b hLink => by + have hAdj : H.Adj a b := by + have he' : e ∈ H.edgeSet := he + rw [hLink.1] at he' + exact he' + rw [hLink.1] + exact rectangularGridLine_isLine (hSub hAdj)) + (fun e he v _ hv => by + have heH : e ∈ H.edgeSet := he + have hvEnd := rectangularGridLine_vertex (edgeSet_mono hSub heH) hv + obtain ⟨w,hEq⟩ := Sym2.mem_iff_exists.mp hvEnd + exact ⟨w,hEq,heH⟩) + (fun e he d hd hne x hx => by + have heH : e ∈ H.edgeSet := he + have hdH : d ∈ H.edgeSet := hd + obtain ⟨v,hv⟩ := rectangularGridLine_intersection (edgeSet_mono hSub heH) + (edgeSet_mono hSub hdH) hne hx + exact ⟨v,mem_univ _,hv⟩) j hj + refine ⟨Γ,?_,hVertices,hEdges⟩ + change Γ.drawing.V = (j ∘ rectangularGridPoint) '' Set.univ at hV + simpa only [image_univ] using hV + +/-- A subgraph of a finite rectangular grid has its straight-line +plane drawing, with the vertex and edge maps specified. -/ +theorem exists_rectangularGrid_drawing {m n : ℕ} + (H : SimpleGraph (Fin m × Fin n)) (hSub : H ≤ pathGraph m □ pathGraph n) : + ∃ Γ : GraphDrawing (Graph.ofSimpleGraph H) (ℝ × ℝ), + Γ.drawing.V = range (@rectangularGridPoint m n) ∧ + (∀ v : V(Graph.ofSimpleGraph H), (Γ.iso.vertexEquiv v).val = rectangularGridPoint v.val) ∧ + (∀ e : E(Graph.ofSimpleGraph H), closure (Γ.iso.edgeEquiv e).val = rectangularGridLine e.val) + := by + simpa only [Function.id_comp,id_eq,Set.image_id,Set.image_id'] using + exists_rectangularGrid_embedded_drawing H hSub id IsEmbedding.id + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/RectangularGridLineIntersections.lean b/LeanPool/GraphMinor/GM16/RectangularGridLineIntersections.lean new file mode 100644 index 0000000000..769ff48335 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/RectangularGridLineIntersections.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.RectangularGridLines +import LeanPool.GraphMinor.GM16.LatticeLineIntersections + +/-! +# Grid edges meet only at grid vertices + +Classify each edge as a horizontal or vertical unit line. Distinct +parallel edges have distinct starting lattice points, so they meet +only at an end. A horizontal and a vertical edge meet at the point +with the vertical edge's first coordinate and the horizontal edge's +second coordinate. That point is still a vertex of the finite grid. +These are the intersection checks for XVI (4.2)'s planar wall. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph + +/-- Lines assigned to different rectangular grid edges meet only at +vertex points of that same finite grid. -/ +theorem rectangularGridLine_intersection {m n : ℕ} + {e f : Sym2 (Fin m × Fin n)} + (he : e ∈ (pathGraph m □ pathGraph n).edgeSet) + (hf : f ∈ (pathGraph m □ pathGraph n).edgeSet) (hne : e ≠ f) + {x : ℝ × ℝ} (hx : x ∈ rectangularGridLine e ∩ rectangularGridLine f) : + ∃ z : Fin m × Fin n, rectangularGridPoint z = x := by + rcases rectangularGridLine_spec he with ⟨i,j,h,heq,hL⟩ | ⟨i,j,h,heq,hL⟩ <;> + rcases rectangularGridLine_spec hf with ⟨k,l,h',hfq,hL'⟩ | ⟨k,l,h',hfq,hL'⟩ + · rw [hL,hL'] at hx + have hStart : (i.val,j.val) ≠ (k.val,l.val) := by + intro hEq + have hik : i = k := Fin.ext (congrArg Prod.fst hEq) + have hjl : j = l := Fin.ext (congrArg Prod.snd hEq) + subst k + subst l + exact hne (heq.trans hfq.symm) + rcases horizontalLatticeLine_inter hStart hx with hPoint | hPoint + · exact ⟨(i,j),hPoint.symm⟩ + · exact ⟨(⟨i.val+1,h⟩,j),hPoint.symm⟩ + · rw [hL,hL'] at hx + exact ⟨(k,j),(horizontal_vertical_LatticeLine_inter hx).symm⟩ + · rw [hL,hL'] at hx + exact ⟨(i,l),(horizontal_vertical_LatticeLine_inter ⟨hx.2,hx.1⟩).symm⟩ + · rw [hL,hL'] at hx + have hStart : (i.val,j.val) ≠ (k.val,l.val) := by + intro hEq + have hik : i = k := Fin.ext (congrArg Prod.fst hEq) + have hjl : j = l := Fin.ext (congrArg Prod.snd hEq) + subst k + subst l + exact hne (heq.trans hfq.symm) + rcases verticalLatticeLine_inter hStart hx with hPoint | hPoint + · exact ⟨(i,j),hPoint.symm⟩ + · exact ⟨(i,⟨j.val+1,h⟩),hPoint.symm⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/RectangularGridLinePoints.lean b/LeanPool/GraphMinor/GM16/RectangularGridLinePoints.lean new file mode 100644 index 0000000000..a1011349f5 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/RectangularGridLinePoints.lean @@ -0,0 +1,73 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.RectangularGridLines +import LeanPool.GraphMinor.Surface.ArcTools + +/-! +# Ends and vertices of the grid lines + +The coordinate map is injective. Each actual grid edge is drawn as a +line joining its two vertex points, and no other grid vertex lies on +that line. These are the incidence checks for the drawing of the wall +in XVI (4.2), page 53. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph GraphMinor.Surface + +/-- Distinct finite grid vertices have distinct lattice points. -/ +theorem rectangularGridPoint_injective (m n : ℕ) : + Function.Injective (@rectangularGridPoint m n) := by + intro x y heq + have hi : (x.1.val : ℝ) = (y.1.val : ℝ) := congrArg Prod.fst heq + have hj : (x.2.val : ℝ) = (y.2.val : ℝ) := congrArg Prod.snd heq + exact Prod.ext (Fin.ext (Nat.cast_injective hi)) (Fin.ext (Nat.cast_injective hj)) + +/-- The line assigned to a grid edge joins its two prescribed ends. -/ +theorem rectangularGridLine_isLine {m n : ℕ} {x y : Fin m × Fin n} + (hAdj : (pathGraph m □ pathGraph n).Adj x y) : + IsLineWithEnds (rectangularGridLine s(x,y)) (rectangularGridPoint x) (rectangularGridPoint y) + := by + rcases rectangularGridLine_spec (e := s(x,y)) hAdj with ⟨i,j,h,hEq,hLine⟩ | ⟨i,j,h,hEq,hLine⟩ + · rw [hLine] + rcases Sym2.eq_iff.mp hEq with ⟨hx,hy⟩ | ⟨hx,hy⟩ + · rw [hx,hy] + exact horizontalLatticeLine_isLine i.val j.val + · rw [hx,hy] + exact (horizontalLatticeLine_isLine i.val j.val).symm + · rw [hLine] + rcases Sym2.eq_iff.mp hEq with ⟨hx,hy⟩ | ⟨hx,hy⟩ + · rw [hx,hy] + exact verticalLatticeLine_isLine i.val j.val + · rw [hx,hy] + exact (verticalLatticeLine_isLine i.val j.val).symm + +/-- A grid vertex on the line of an actual grid edge is one of that +edge's ends. -/ +theorem rectangularGridLine_vertex {m n : ℕ} {e : Sym2 (Fin m × Fin n)} + (he : e ∈ (pathGraph m □ pathGraph n).edgeSet) {z : Fin m × Fin n} + (hz : rectangularGridPoint z ∈ rectangularGridLine e) : z ∈ e := by + rcases rectangularGridLine_spec he with ⟨i,j,h,hEq,hLine⟩ | ⟨i,j,h,hEq,hLine⟩ + · rw [hLine] at hz + rcases latticePoint_mem_horizontal hz with hz | hz + · rw [hEq,Sym2.mem_iff] + exact Or.inl (Prod.ext (Fin.ext (congrArg Prod.fst hz)) (Fin.ext (congrArg Prod.snd hz))) + · rw [hEq,Sym2.mem_iff] + exact Or.inr (Prod.ext (Fin.ext (congrArg Prod.fst hz)) (Fin.ext (congrArg Prod.snd hz))) + · rw [hLine] at hz + rcases latticePoint_mem_vertical hz with hz | hz + · rw [hEq,Sym2.mem_iff] + exact Or.inl (Prod.ext (Fin.ext (congrArg Prod.fst hz)) (Fin.ext (congrArg Prod.snd hz))) + · rw [hEq,Sym2.mem_iff] + exact Or.inr (Prod.ext (Fin.ext (congrArg Prod.fst hz)) (Fin.ext (congrArg Prod.snd hz))) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/RectangularGridLines.lean b/LeanPool/GraphMinor/GM16/RectangularGridLines.lean new file mode 100644 index 0000000000..226066e563 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/RectangularGridLines.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM01.Defs +public import LeanPool.GraphMinor.GM16.LatticeLines + +/-! +# Coordinates and lines of a rectangular grid + +A grid vertex `(i,j)` is placed at its lattice point. Each horizontal +edge uses the unit line beginning at its lower first coordinate, and +each vertical edge uses the unit line beginning at its lower second +coordinate. The rule is symmetric in the ends, so it defines a line +for an unordered edge name. This is the planar drawing underlying +the wall in XVI (4.2), page 53. +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph + +/-- The point assigned to a vertex of a finite rectangular grid. -/ +def rectangularGridPoint {m n : ℕ} (x : Fin m × Fin n) : ℝ × ℝ := + latticePoint (x.1.val,x.2.val) + +/-- The unit line rule on a pair of grid vertices. Values on pairs +that are not grid edges are unused. -/ +def rectangularGridLinePair {m n : ℕ} (x y : Fin m × Fin n) : Set (ℝ × ℝ) := + if x.2 = y.2 then horizontalLatticeLine (min x.1.val y.1.val) (min x.2.val y.2.val) + else verticalLatticeLine (min x.1.val y.1.val) (min x.2.val y.2.val) + +/-- Reversing the ends leaves the line unchanged. -/ +theorem rectangularGridLinePair_symm {m n : ℕ} (x y : Fin m × Fin n) : + rectangularGridLinePair x y = rectangularGridLinePair y x := by + simp only [rectangularGridLinePair,eq_comm,min_comm] + +/-- The unit line assigned to an unordered grid edge. -/ +def rectangularGridLine {m n : ℕ} : Sym2 (Fin m × Fin n) → Set (ℝ × ℝ) := + Sym2.lift ⟨rectangularGridLinePair,rectangularGridLinePair_symm⟩ + +/-- Evaluation of the grid line map. -/ +theorem rectangularGridLine_mk {m n : ℕ} (x y : Fin m × Fin n) : + rectangularGridLine s(x,y) = rectangularGridLinePair x y := by rfl + +/-- Every grid edge is a positive horizontal or vertical unit edge, +with the assigned line in those same coordinates. -/ +theorem rectangularGridLine_spec {m n : ℕ} {e : Sym2 (Fin m × Fin n)} + (he : e ∈ (pathGraph m □ pathGraph n).edgeSet) : + (∃ (i : Fin m) (j : Fin n) (h : i.val + 1 < m), + e = s((i,j),(⟨i.val+1,h⟩,j)) ∧ rectangularGridLine e = horizontalLatticeLine i.val j.val) ∨ + (∃ (i : Fin m) (j : Fin n) (h : j.val + 1 < n), + e = s((i,j),(i,⟨j.val+1,h⟩)) ∧ rectangularGridLine e = verticalLatticeLine i.val j.val) := by + induction e with + | h x y => + have hAdj : (pathGraph m □ pathGraph n).Adj x y := he + rcases boxProd_adj.mp hAdj with ⟨hStep,hj⟩ | ⟨hStep,hi⟩ + · change (pathGraph m).Adj x.1 y.1 at hStep + change x.2 = y.2 at hj + have hjVal := congrArg Fin.val hj + rcases pathGraph_adj.mp hStep with hs | hs + · have hb : x.1.val + 1 < m := by omega + have hY : (⟨x.1.val+1,hb⟩,x.2) = y := Prod.ext (Fin.ext hs) hj + left + refine ⟨x.1,x.2,hb,congrArg (fun t => s(x,t)) hY.symm,?_⟩ + rw [rectangularGridLine_mk,rectangularGridLinePair,ite_eq_left hj, + min_eq_left (show x.1.val ≤ y.1.val by omega),min_eq_left (le_of_eq hjVal)] + · have hb : y.1.val + 1 < m := by omega + have hX : (⟨y.1.val+1,hb⟩,y.2) = x := Prod.ext (Fin.ext hs) hj.symm + left + refine ⟨y.1,y.2,hb,Sym2.eq_swap.trans (congrArg (fun t => s(y,t)) hX.symm),?_⟩ + rw [rectangularGridLine_mk,rectangularGridLinePair,ite_eq_left hj, + min_eq_right (show y.1.val ≤ x.1.val by omega),min_eq_right (le_of_eq hjVal.symm)] + · change (pathGraph n).Adj x.2 y.2 at hStep + change x.1 = y.1 at hi + have hiVal := congrArg Fin.val hi + have hjNe : x.2 ≠ y.2 := hStep.ne + rcases pathGraph_adj.mp hStep with hs | hs + · have hb : x.2.val + 1 < n := by omega + have hY : (x.1,⟨x.2.val+1,hb⟩) = y := Prod.ext hi (Fin.ext hs) + right + refine ⟨x.1,x.2,hb,congrArg (fun t => s(x,t)) hY.symm,?_⟩ + rw [rectangularGridLine_mk,rectangularGridLinePair,ite_eq_right hjNe, + min_eq_left (le_of_eq hiVal),min_eq_left (show x.2.val ≤ y.2.val by omega)] + · have hb : y.2.val + 1 < n := by omega + have hX : (y.1,⟨y.2.val+1,hb⟩) = x := Prod.ext hi.symm (Fin.ext hs) + right + refine ⟨y.1,y.2,hb,Sym2.eq_swap.trans (congrArg (fun t => s(y,t)) hX.symm),?_⟩ + rw [rectangularGridLine_mk,rectangularGridLinePair,ite_eq_right hjNe, + min_eq_right (le_of_eq hiVal.symm),min_eq_right (show y.2.val ≤ x.2.val by omega)] + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/RectangularLines.lean b/LeanPool/GraphMinor/GM16/RectangularLines.lean new file mode 100644 index 0000000000..eecf8d645e --- /dev/null +++ b/LeanPool/GraphMinor/GM16/RectangularLines.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.ArcDrawings + +/-! +# Straight sides of rectangles + +Parametrising a horizontal or vertical side by its varying +coordinate proves it is a line. Unlike the unit lattice lines, +these sides can have any positive length. They are used when +joining rows of wall bricks into the disc bounded by the wall's +outer boundary in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Surface GM11 + +/-- A nondegenerate horizontal interval is a line. -/ +theorem horizontal_interval_isLine {a b : ℝ} (hab : a < b) (c : ℝ) : + IsLineWithEnds (Icc a b ×ˢ {c}) (a,c) (b,c) := by + let f : ℝ → ℝ × ℝ := fun t => (t,c) + have hc : Continuous f := continuous_id.prodMk continuous_const + have hi : InjOn f (Icc a b) := fun _ _ _ _ h => congrArg Prod.fst h + have he : f '' Icc a b = Icc a b ×ˢ {c} := by + ext x + constructor + · rintro ⟨t,ht,rfl⟩ + exact ⟨ht,rfl⟩ + · rintro ⟨hx,hc⟩ + exact ⟨x.1,hx,Prod.ext rfl hc.symm⟩ + exact he ▸ isLine_of_injOn hc hab hi + +/-- A nondegenerate vertical interval is a line. -/ +theorem vertical_interval_isLine (c : ℝ) {a b : ℝ} (hab : a < b) : + IsLineWithEnds ({c} ×ˢ Icc a b) (c,a) (c,b) := by + let f : ℝ → ℝ × ℝ := fun t => (c,t) + have hc : Continuous f := continuous_const.prodMk continuous_id + have hi : InjOn f (Icc a b) := fun _ _ _ _ h => congrArg Prod.snd h + have he : f '' Icc a b = {c} ×ˢ Icc a b := by + ext x + constructor + · rintro ⟨t,ht,rfl⟩ + exact ⟨rfl,ht⟩ + · rintro ⟨hc,hx⟩ + exact ⟨x.2,hx,Prod.ext hc.symm rfl⟩ + exact he ▸ isLine_of_injOn hc hab hi + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/RigidDiscFaces.lean b/LeanPool/GraphMinor/GM16/RigidDiscFaces.lean new file mode 100644 index 0000000000..d102e43c77 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/RigidDiscFaces.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM16.LineInFace +import LeanPool.GraphMinor.GM16.LineDial +import LeanPool.GraphMinor.GM16.TwoFaceDial +import LeanPool.GraphMinor.GM11.PaintingFacts +import LeanPool.GraphMinor.Surface.CutLift + +/-! +# Rigidity from disc faces and their common boundary lines + +Split a normal circle at two points containing all its drawing +vertices. Each open half lies in one face. If the faces coincide, +the circle bounds an empty dial in that face. Otherwise their two +common points lie on the drawing. A common boundary line joins +them, and the two-face construction gives a dial. This reduces the +wall rigidity check in XVI (4.2) to its face geometry. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface GM11 GM14 + +/-- A drawing with disc faces and boundary lines joining common face +points is rigid. The hypotheses describe the face closures and their +intersections, rather than assume dials for normal circles. -/ +theorem isRigid_of_disc_faces {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H : Drawing S} + (hFaces : ∀ r ∈ H.R, IsClosedDisc (closure r) ∧ + closure r ∩ H.U ⊆ discBd (closure r)) + (hJoin : ∀ r ∈ H.R, ∀ s ∈ H.R, r ≠ s → ∀ a b : S, a ≠ b → + a ∈ closure r ∩ closure s → b ∈ closure r ∩ closure s → + ∃ K, IsLineWithEnds K a b ∧ K ⊆ closure r ∩ closure s) : IsRigid H := by + let : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + intro F hF hNormal hCard + obtain ⟨X, _, hVX, hXF, hXCard⟩ := (infinite_of_isOArc hF).exists_superset_ncard_eq + (inter_subset_left : F ∩ H.V ⊆ F) (H.finite_V.subset inter_subset_right) hCard + obtain ⟨a,b,hab,hX⟩ := Set.ncard_eq_two.mp hXCard + have haF : a ∈ F := hXF (hX.symm ▸ mem_insert a {b}) + have hbF : b ∈ F := hXF (hX.symm ▸ mem_insert_of_mem a rfl) + have hFPair : F ∩ H.V ⊆ {a,b} := hX ▸ hVX + obtain ⟨P₁,P₂,hP₁,hP₂,hUnion,_⟩ := hF.lines haF hbF hab + have hP₁F : P₁ ⊆ F := hUnion ▸ subset_union_left + have hP₂F : P₂ ⊆ F := hUnion ▸ subset_union_right + have hAvoid (P : Set S) (hPF : P ⊆ F) : Disjoint (P \ {a,b}) H.U := by + apply disjoint_left.mpr + rintro x ⟨hxP,hxEnds⟩ hxU + exact hxEnds (hFPair ⟨hPF hxP,hNormal ⟨hPF hxP,hxU⟩⟩) + obtain ⟨r,hr,hOpen₁,hClosed₁⟩ := exists_face_containing_line hP₁ (hAvoid P₁ hP₁F) + obtain ⟨s,hs,hOpen₂,hClosed₂⟩ := exists_face_containing_line hP₂ (hAvoid P₂ hP₂F) + have hEmpty (r : Set S) (hr : r ∈ H.R) : Disjoint (interior (closure r)) H.U := by + apply disjoint_left.mpr + intro x hx hxU + have hxBd := (hFaces r hr).2 ⟨interior_subset hx,hxU⟩ + have hxFr : x ∈ frontier (closure r) := + (GM11.IsClosedDisc.frontier_eq_discBd hS (hFaces r hr).1).symm ▸ hxBd + exact hxFr.2 hx + by_cases hrs : r = s + · subst s + apply exists_isDial_of_circle_in_empty_disc hS (hFaces r hr).1 hF + (hUnion ▸ union_subset hClosed₁ hClosed₂) (hEmpty r hr) + have hMeetU : closure r ∩ closure s ⊆ H.U := by + rintro x ⟨hxr,hxs⟩ + by_contra hn + have hxr' := (closure_region_subset hr hxr).resolve_right hn + have hxs' := (closure_region_subset hs hxs).resolve_right hn + exact hrs (region_eq_of_mem hr hs hxr' hxs') + have haBoth : a ∈ closure r ∩ closure s := ⟨hClosed₁ hP₁.left_mem,hClosed₂ hP₂.left_mem⟩ + have hbBoth : b ∈ closure r ∩ closure s := ⟨hClosed₁ hP₁.right_mem,hClosed₂ hP₂.right_mem⟩ + obtain ⟨K,hK,hKBoth⟩ := hJoin r hr s hs hrs a b hab haBoth hbBoth + have hEnds : F ∩ H.V = {a,b} := by + apply subset_antisymm hFPair + intro x hx + rcases hx with rfl | hx + · exact ⟨haF,hNormal ⟨haF,hMeetU haBoth⟩⟩ + · rw [mem_singleton_iff] at hx + subst x + exact ⟨hbF,hNormal ⟨hbF,hMeetU hbBoth⟩⟩ + rw [← hUnion] at hNormal hEnds ⊢ + apply exists_isDial_of_two_faces hS (hFaces r hr).1 (hFaces s hs).1 hP₁ hP₂ hK hab + hClosed₁ hClosed₂ _ _ (hKBoth.trans hMeetU) + (line_inter_face_boundary_subset hS hr (hFaces r hr).1 hOpen₁) + (line_inter_face_boundary_subset hS hs (hFaces s hs).1 hOpen₂) + (hFaces r hr).2 (hFaces s hs).2 _ hNormal hEnds + · exact fun x hx => (hFaces r hr).2 ⟨(hKBoth hx).1,hMeetU (hKBoth hx)⟩ + · exact fun x hx => (hFaces s hs).2 ⟨(hKBoth hx).2,hMeetU (hKBoth hx)⟩ + · exact fun x hx => (hFaces r hr).2 ⟨hx.1,hMeetU hx⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/RuralLinkage.lean b/LeanPool/GraphMinor/GM16/RuralLinkage.lean new file mode 100644 index 0000000000..a7d97eac18 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/RuralLinkage.lean @@ -0,0 +1,83 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +import LeanPool.GraphMinor.GM16.Section9Annuli + +import LeanPool.GraphMinor.GM09.Bridge + +/-! +# Replacing a rural boundary linkage by a linked set + +IX (10.5) offers either the desired linkage or a smaller set cutting +all paths from the outer boundary. An existing disjoint boundary +linkage rules out the cut by counting. One of the resulting paths +then avoids any set smaller than the linkage. This is the application +of IX (10.5) in XVI (8.1), Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.GM09 +universe u v + +/-- Breadth decreases when circuits are omitted from a nest. -/ +theorem hasBreadthGe_mono {α : Type u} {β : Type v} {N : Neighborhood α β} + {m n : ℕ} (h : N.HasBreadthGe n) (hmn : m ≤ n) : N.HasBreadthGe m := by + obtain ⟨P, C, hC, hDis, D, hD, hIn, hNest⟩ := h + let j : Fin m → Fin n := fun i => i.castLE hmn + have hj : Function.Injective j := by + intro i k heq + exact Fin.ext (congrArg (fun x : Fin n => x.val) heq) + refine ⟨P, fun i => C (j i), fun i => hC (j i), ?_, + fun i => D (j i), fun i => hD (j i), fun i => hIn (j i), ?_⟩ + · intro i k hik + exact hDis (fun heq => hik (hj heq)) + · intro i k hik + exact hNest (j i) (j k) hik + +/-- IX (10.5), applied when a boundary linkage already rules out its +separator outcome, replaces the boundary ends by the linked set. -/ +theorem rural_linkage_of_boundary_linkage + {α : Type u} {β : Type v} (S S₀ : Society α β) (N : Neighborhood α β) + (p : ℕ) (X Y : Set α) + (hRural : N.IsRural) (hBreadth : N.HasBreadthGe ((p + 1) / 2 + 1)) + (hLinked : N.IsLinked X) (hX : p ≤ X.ncard) + (hComp : S.IsComposition S₀ N) (hY : Y ⊆ V(S₀.G)) + (Q : Fin p → Graph α β) + (hQ : ∀ i, IsFromToPath S.G (Q i) S.Ω.bar Y) + (hDis : Pairwise (fun i j => Disjoint V(Q i) V(Q j))) : + ∃ P : Fin p → Graph α β, + (∀ i, ∃ x ∈ X, ∃ y ∈ Y, IsFromToPathWithEnds S.G (P i) S.Ω.bar Y x y) ∧ + Pairwise (fun i j => Disjoint V(P i) V(P j)) := by + rcases GraphMinor.GM09.gm16_theorem_10_5.{u, v} S S₀ N p X Y hRural hBreadth hLinked hX hComp hY + with h | h + · exact h + · obtain ⟨W, hWS, hWp, _, hCut⟩ := h + obtain ⟨i, hi⟩ := exists_disjoint_of_pairwise_disjoint + (fun i => V(Q i)) hDis W (S.finite_V.subset hWS) hWp + obtain ⟨x, hx, hxW⟩ := hCut (Q i) (hQ i) + exact False.elim (hi.notMem_of_mem_left hx hxW) + +/-- A disjoint rural linkage has a path avoiding any smaller finite +set. This is the last counting step of XVI (8.1), Claim (11), page 74. -/ +theorem rural_linkage_avoids_small_set {α : Type u} {β : Type v} + {G : Graph α β} {A X Y Z : Set α} {p : ℕ} + (P : Fin p → Graph α β) + (hP : ∀ i, ∃ x ∈ X, ∃ y ∈ Y, IsFromToPathWithEnds G (P i) A Y x y) + (hDis : Pairwise (fun i j => Disjoint V(P i) V(P j))) + (hZ : Z.Finite) (hCard : Z.ncard < p) : + ∃ x ∈ X, ∃ y ∈ Y, ∃ Q : Graph α β, + IsFromToPathWithEnds G Q A Y x y ∧ Disjoint V(Q) Z := by + obtain ⟨i, hi⟩ := exists_disjoint_of_pairwise_disjoint (fun i => V(P i)) hDis Z hZ hCard + obtain ⟨x, hx, y, hy, hxy⟩ := hP i + exact ⟨x, hx, y, hy, P i, hxy, hi⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section2.lean b/LeanPool/GraphMinor/GM16/Section2.lean new file mode 100644 index 0000000000..a80cf2912f --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section2.lean @@ -0,0 +1,961 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM10.GraphSubhypergraph +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM10.Section11 +import Mathlib.Data.Set.Card + +/-! +# Graph Minors XVI, Section 2: Structure Relative to a Tangle + +This file formalizes Section 2 ("Structure relative to a tangle", pages 47–48) of N. Robertson and +P. D. Seymour, *Graph Minors. XVI. Excluding a non-planar graph*, J. Combin. Theory Ser. B 89 +(2003) 43–76: + +- Correspondence between subgraphs/separations/locations/designs/tree-decompositions of a finite + graph `G` (`GraphMinor.GM16`) and those of `Hypergraph.ofGraph G` (`GraphMinor.GM10`). +- **Graph Minors XVI, (2.1)** (`theorem_2_1`, page 48): if a class of designs `𝒟` is `θ`-pervasive + in a finite graph `G` (`θ ≥ 1`), then `G` has a tree-decomposition `(T, τ)` over + `𝒟^{3θ - 2} ∪ ℛ_{4θ - 3}`, deduced from Graph Minors X, (11.1) (`GM10.theorem_11_1`). +- **Graph Minors XVI, (2.2)** (`theorem_2_2`, page 48): if `G` has a tree-decomposition `(T, τ)` + over a class of designs `𝒟`, then `G` is a tree-structure over the class `𝒟'` of torsos of + members of `𝒟` (`HasTreeStructureOver (torsosOfClass 𝒟) G`). +- **Graph Minors XVI, (2.3)** (`theorem_2_3`, page 48): if `𝒟` is `θ`-pervasive in a finite graph + `G` (`θ ≥ 1`), then `G` has a tree-structure over the class of graphs `G'` that either have + `|V(G')| ≤ 4θ - 3` or are loose `(≤ 3θ - 2)`-vertex extensions (`IsLooseVertexExtension`) of + torsos of members of `𝒟`. +-/ + +@[expose] public section + +namespace GraphMinor.GM16 + +open Set Function Graph SimpleGraph Hypergraph +open GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Correspondence between `Graph` and `Hypergraph.ofGraph` -/ + +export GM10 (subgraphOfSubhypergraph vertexSet_subgraphOfSubhypergraph + subgraphOfSubhypergraph_le edgeSet_subgraphOfSubhypergraph subgraphOfSubhypergraph_mono + ofGraph_subgraphOfSubhypergraph subgraphOfSubhypergraph_ofGraph) + +/-! ## Proof of Graph Minors XVI, (2.1) (page 48) -/ + +/-- **Graph Minors XVI, (2.1)** (page 48): +"For any $\theta \ge 1$, let $\mathscr{D}$ be a class of designs which is $\theta$-pervasive in a +graph $G$. Then $G$ has a tree-decomposition $(T, \tau)$ such that for each $t \in V(T)$, the +design of $t$ in $(T, \tau)$ belongs to $\mathscr{D}^{3\theta-2} \cup \mathscr{R}_{4\theta-3}$." -/ +theorem theorem_2_1_proof {G : Graph α β} {θ : ℕ} {𝒟 : Set (GraphDesign α β)} + (hV : V(G).Finite) (hE : E(G).Finite) (hθ : 1 ≤ θ) + (hperv : IsGraphPervasive G θ 𝒟) : + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Graph α β), + IsGraphTreeDecompositionOver G + (graphEnlargementClass 𝒟 (3 * θ - 2) ∪ smallGraphDesignClass (4 * θ - 3)) T τ := by + let G_H := Hypergraph.ofGraph G hV hE + let 𝒮 : Set (Design α β) := + {d_H | d_H.1 ≤ G_H ∧ IsDesign d_H ∧ (subgraphOfSubhypergraph G d_H.1, d_H.2) ∈ 𝒟} + have hperv_H : GM10.IsPervasive G_H θ 𝒮 := by + intro G'_H hG'_le θ' 𝒯 hθ' h𝒯 + let G' := subgraphOfSubhypergraph G G'_H + have hG'_le_G : G' ≤ G := subgraphOfSubhypergraph_le hG'_le + have hV' : V(G').Finite := G'_H.vertexSet_finite + have hE' : E(G').Finite := + G'_H.edgeSet_finite.subset (by rw [edgeSet_subgraphOfSubhypergraph hG'_le]) + have hof_G' : Hypergraph.ofGraph G' hV' hE' = G'_H := ofGraph_subgraphOfSubhypergraph hG'_le + have h𝒯_graph : IsGraphTangle G' θ' 𝒯 := ⟨hV', hE', hof_G'.symm ▸ h𝒯⟩ + obtain ⟨ℒ, hloc, hℒ_mem, hdes⟩ := hperv hG'_le_G hθ' h𝒯_graph + let ℒ_H : Set (Hypergraph α β × Hypergraph α β) := + {p_H ∈ 𝒯 | ∃ p ∈ ℒ, SeparationOfGraphSep G' p.1 p.2 p_H.1 p_H.2} + have hℒ_H_sub : ℒ_H ⊆ 𝒯 := fun _ h => h.1 + have hℒ_H_loc : GM10.IsLocation G'_H ℒ_H := by + refine ⟨fun p_H hp_H => h𝒯.isSeparation hp_H.1, ?_⟩ + rintro p₁ ⟨hp₁𝒯, p₁_G, hp₁ℒ, hsep₁⟩ p₂ ⟨hp₂𝒯, p₂_G, hp₂ℒ, hsep₂⟩ hne + have hp₁_le : p₁.1 ≤ G'_H := (h𝒯.isSeparation hp₁𝒯).left_le + have hp₂_le : p₂.2 ≤ G'_H := (h𝒯.isSeparation hp₂𝒯).right_le + have hne_G : p₁_G ≠ p₂_G := by + rintro rfl + apply hne + ext : 1 + · exact GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hp₁_le + (h𝒯.isSeparation hp₂𝒯).left_le + (hsep₁.2.1.trans hsep₂.2.1.symm) (hsep₁.2.2.1.trans hsep₂.2.2.1.symm) + · exact GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq (h𝒯.isSeparation hp₁𝒯).right_le + hp₂_le (hsep₁.2.2.2.1.trans hsep₂.2.2.2.1.symm) + (hsep₁.2.2.2.2.trans hsep₂.2.2.2.2.symm) + have hle_G : p₁_G.1 ≤ p₂_G.2 := hloc.left_le_right hp₁ℒ hp₂ℒ hne_G + rw [GM10.le_iff_of_le hp₁_le hp₂_le, hsep₁.2.1, hsep₂.2.2.2.1, + hsep₁.2.2.1, hsep₂.2.2.2.2] + exact ⟨hle_G.vertexSet_mono, hle_G.edgeSet_mono⟩ + have hcore_le : GM10.locationCore G'_H ℒ_H ≤ G_H := + (GM10.locationCore_le fun _ hp => hℒ_H_loc.isSeparation hp).trans hG'_le + have hcore_eq : subgraphOfSubhypergraph G (GM10.locationCore G'_H ℒ_H) = + graphLocationCore G' ℒ := by + have h1 : subgraphOfSubhypergraph G (GM10.locationCore G'_H ℒ_H) ≤ G := + subgraphOfSubhypergraph_le hcore_le + have hsub : {x ∈ V(G') | ∀ p ∈ ℒ, x ∈ V(p.2)} ⊆ V(G') := fun _ h => h.1 + have h2 : graphLocationCore G' ℒ ≤ G := + (restrict_le.trans (G'.induce_le hsub)).trans hG'_le_G + refine (Compatible.of_le_le h1 h2).ext ?_ ?_ + · ext v + simp only [vertexSet_subgraphOfSubhypergraph, GM10.locationCore, graphLocationCore, + vertexSet_restrict, vertexSet_induce, Set.mem_ofPred_eq, G'] + refine and_congr_right fun hvG' => ⟨fun h p hp => ?_, fun h p_H hp_H => ?_⟩ + · obtain ⟨p_H, hp_H𝒯, hsep⟩ := hℒ_mem p hp + rw [← hsep.2.2.2.1] + exact h p_H ⟨hp_H𝒯, p, hp, hsep⟩ + · obtain ⟨_, p, hp, hsep⟩ := hp_H + rw [hsep.2.2.2.1] + exact h p hp + · ext e + rw [edgeSet_subgraphOfSubhypergraph hcore_le] + simp only [GM10.locationCore, graphLocationCore, edgeSet_restrict, Graph.edgeSet_induce, + Set.mem_ofPred_eq, mem_inter_iff] + rw [edgeSet_subgraphOfSubhypergraph hG'_le] + constructor + · rintro ⟨heG', hall⟩ + have heG : e ∈ E(G) := hG'_le.edgeSet_subset heG' + obtain ⟨x, y, hlink⟩ := exists_isLink_of_mem_edgeSet heG + have hlink' : G'.IsLink e x y := + (hG'_le_G.isLink_iff (by rwa [edgeSet_subgraphOfSubhypergraph hG'_le])).mpr hlink + refine ⟨⟨x, y, hlink', ⟨hlink'.left_mem, fun p hp => ?_⟩, + ⟨hlink'.right_mem, fun p hp => ?_⟩⟩, heG', fun p hp => ?_⟩ + · obtain ⟨p_H, hp_H𝒯, hsep⟩ := hℒ_mem p hp + have he_p : e ∈ E(p.2) := hsep.2.2.2.2 ▸ hall p_H ⟨hp_H𝒯, p, hp, hsep⟩ + exact (((hloc.isSeparation hp).2.1.isLink_iff he_p).mpr hlink').left_mem + · obtain ⟨p_H, hp_H𝒯, hsep⟩ := hℒ_mem p hp + have he_p : e ∈ E(p.2) := hsep.2.2.2.2 ▸ hall p_H ⟨hp_H𝒯, p, hp, hsep⟩ + exact (((hloc.isSeparation hp).2.1.isLink_iff he_p).mpr hlink').right_mem + · obtain ⟨p_H, hp_H𝒯, hsep⟩ := hℒ_mem p hp + rw [← hsep.2.2.2.2] + exact hall p_H ⟨hp_H𝒯, p, hp, hsep⟩ + · rintro ⟨_, heG', hall⟩ + refine ⟨heG', fun p_H ⟨_, p, hp, hsep⟩ => ?_⟩ + rw [hsep.2.2.2.2] + exact hall p hp + have hM_eq : (GM10.locationDesign G'_H ℒ_H).2 = (graphLocationDesign G' ℒ).2 := by + ext X + simp only [GM10.locationDesign, graphLocationDesign, mem_image, GM10.inter_vertexSet] + constructor + · rintro ⟨p_H, ⟨_, p, hp, hsep⟩, rfl⟩ + exact ⟨p, hp, by rw [hsep.2.1, hsep.2.2.2.1]⟩ + · rintro ⟨p, hp, rfl⟩ + obtain ⟨p_H, hp_H𝒯, hsep⟩ := hℒ_mem p hp + exact ⟨p_H, ⟨hp_H𝒯, p, hp, hsep⟩, by rw [hsep.2.1, hsep.2.2.2.1]⟩ + refine ⟨ℒ_H, hℒ_H_loc, hℒ_H_sub, hcore_le, hℒ_H_loc.isDesign_locationDesign, ?_⟩ + change (subgraphOfSubhypergraph G (GM10.locationCore G'_H ℒ_H), + (GM10.locationDesign G'_H ℒ_H).2) ∈ 𝒟 + rwa [hcore_eq, hM_eq] + obtain ⟨ι, hfin, T, τ_H, hover⟩ := GM10.theorem_11_1_proof hθ hperv_H + let τ : ι → Graph α β := fun t => subgraphOfSubhypergraph G (τ_H t) + refine ⟨ι, hfin, T, τ, ⟨⟨hover.1.isTree, fun t => subgraphOfSubhypergraph_le (hover.1.le t), + ?_, ?_, ?_, ?_⟩, ?_⟩⟩ + · ext v + simp only [mem_iUnion, τ, vertexSet_subgraphOfSubhypergraph] + have hV_eq := congrArg Hypergraph.vertexSet hover.1.biUnion_eq + simpa [Hypergraph.biUnion, G_H, Hypergraph.ofGraph] using Set.ext_iff.mp hV_eq v + · ext e + simp only [mem_iUnion, τ] + have h_congr : (∃ i, e ∈ E(subgraphOfSubhypergraph G (τ_H i))) ↔ + (∃ i, e ∈ (τ_H i).edgeSet) := + exists_congr fun i => by rw [edgeSet_subgraphOfSubhypergraph (hover.1.le i)] + rw [h_congr] + have hE_eq := congrArg Hypergraph.edgeSet hover.1.biUnion_eq + simpa [Hypergraph.biUnion, G_H, Hypergraph.ofGraph] using Set.ext_iff.mp hE_eq e + · intro t₁ t₂ hne + dsimp only [τ] + rw [edgeSet_subgraphOfSubhypergraph (hover.1.le t₁), + edgeSet_subgraphOfSubhypergraph (hover.1.le t₂), Set.disjoint_iff_inter_eq_empty] + exact hover.1.edgeSet_inter_eq hne + · intro t₁ t₂ t₃ p hp ht₂ + dsimp only [τ] + rw [vertexSet_subgraphOfSubhypergraph, vertexSet_subgraphOfSubhypergraph, + vertexSet_subgraphOfSubhypergraph] + intro v hv + have hon : GM10.OnTreePath T t₁ t₃ t₂ := by + intro w hw + have heq_path : (⟨w, hw⟩ : T.Path t₁ t₃) = ⟨p, hp⟩ := + @Subsingleton.elim _ (hover.1.isTree.isAcyclic.subsingleton_path t₁ t₃) _ _ + have heq_walk : w = p := congrArg Subtype.val heq_path + rwa [heq_walk] + exact (hover.1.inter_le hon).vertexSet_subset hv + · intro t₀ + have hdes_eq : graphVertexDesign T τ t₀ = + (subgraphOfSubhypergraph G (GM10.vertexDesign T τ_H t₀).1, + (GM10.vertexDesign T τ_H t₀).2) := rfl + rw [hdes_eq] + have hτ₀_le : (GM10.vertexDesign T τ_H t₀).1 ≤ G_H := hover.1.le t₀ + have hE_τ₀ : E(subgraphOfSubhypergraph G (GM10.vertexDesign T τ_H t₀).1) ⊆ + (τ_H t₀).edgeSet := by + rw [edgeSet_subgraphOfSubhypergraph hτ₀_le] + exact subset_rfl + rcases hover.2 t₀ with ⟨d_H, ⟨hd_H_le, hd_H_des, hd_mem⟩, Z, hZ_card, henl⟩ | ⟨hdes, hcard⟩ + · left + refine ⟨(subgraphOfSubhypergraph G d_H.1, d_H.2), hd_mem, Z, hZ_card, ?_⟩ + refine ⟨⟨d_H.1.vertexSet_finite, + d_H.1.edgeSet_finite.subset (by rw [edgeSet_subgraphOfSubhypergraph hd_H_le]), + hd_H_des⟩, + ⟨(τ_H t₀).vertexSet_finite, (τ_H t₀).edgeSet_finite.subset hE_τ₀, henl.isDesign'⟩, + henl.subset_vertexSet, + subgraphOfSubhypergraph_mono hd_H_le hτ₀_le henl.le, + henl.sdiff_subset, ?_, henl.inter_mem⟩ + rw [edgeSet_subgraphOfSubhypergraph hτ₀_le, edgeSet_subgraphOfSubhypergraph hd_H_le] + exact henl.edgeSet_subset + · right + exact ⟨⟨(τ_H t₀).vertexSet_finite, (τ_H t₀).edgeSet_finite.subset hE_τ₀, hdes⟩, hcard⟩ + +/-! ## Proof of Graph Minors XVI, (2.2) (page 48) -/ + +/-- Every design `d = (H, M)` has `H` itself as a torso. -/ +theorem self_isTorsoOfDesign (d : GraphDesign α β) : IsTorsoOfDesign d d.1 := + ⟨rfl, le_rfl, fun _ h => (h.2 h.1).elim⟩ + +/-- Monotonicity of `HasTreeStructureOver` in the base class `𝒞`. -/ +theorem HasTreeStructureOver.mono {𝒞₁ 𝒞₂ : Set (Graph α β)} (hsub : 𝒞₁ ⊆ 𝒞₂) + {G : Graph α β} (h : HasTreeStructureOver 𝒞₁ G) : + HasTreeStructureOver 𝒞₂ G := by + induction h with + | base hG => exact HasTreeStructureOver.base (hsub hG) + | cliqueSum hsum _ _ ih₁ ih₂ => exact HasTreeStructureOver.cliqueSum hsum ih₁ ih₂ + +/-- A complete graph on a finite vertex set has a finite edge set. -/ +theorem IsCompleteGraphOn.edgeSet_finite {K : Graph α β} {W : Set α} + (hK : IsCompleteGraphOn K W) (hW : W.Finite) : E(K).Finite := by + classical + have : Fintype W := hW.fintype + let f : W × W → Option β := fun p => + if h : ∃ e, K.IsLink e p.1.1 p.2.1 then some h.choose else none + have hsub : Option.some '' E(K) ⊆ Set.range f := by + rintro _ ⟨e, he, rfl⟩ + obtain ⟨x, y, hlink⟩ := exists_isLink_of_mem_edgeSet he + have hx : x ∈ W := hK.1 ▸ hlink.left_mem + have hy : y ∈ W := hK.1 ▸ hlink.right_mem + have hxy : x ≠ y := fun h => hK.2.1 e x (h ▸ hlink) + obtain ⟨_, _, huniq⟩ := hK.2.2 x hx y hy hxy + have hex : ∃ e', K.IsLink e' x y := ⟨e, hlink⟩ + refine ⟨(⟨x, hx⟩, ⟨y, hy⟩), ?_⟩ + dsimp [f] + rw [dite_eq_left hex] + exact congrArg Option.some ((huniq hex.choose hex.choose_spec).trans (huniq e hlink).symm) + exact ((Set.finite_range f).subset hsub).of_finite_image (Option.some_injective β).injOn + +/-- If `G` has finite vertex and edge sets and `IsCliqueSum G G₁ G₂`, then `G₁` and `G₂` also have +finite vertex and edge sets. -/ +theorem IsCliqueSum.finite_of_finite {G G₁ G₂ : Graph α β} + (hsum : IsCliqueSum G G₁ G₂) (hV : V(G).Finite) (hE : E(G).Finite) : + (V(G₁).Finite ∧ E(G₁).Finite) ∧ (V(G₂).Finite ∧ E(G₂).Finite) := by + rcases hsum with ⟨H₁, H₂, K, hsep, hK, hsep₁, hsep₂⟩ + have hVH₁ : V(H₁).Finite := hV.subset hsep.1.vertexSet_mono + have hVH₂ : V(H₂).Finite := hV.subset hsep.2.1.vertexSet_mono + have hVK : V(K).Finite := by + rw [hK.1] + exact hVH₁.subset inter_subset_left + have hEK : E(K).Finite := hK.edgeSet_finite (hVH₁.subset inter_subset_left) + refine ⟨⟨?_, ?_⟩, ⟨?_, ?_⟩⟩ + · rw [← hsep₁.2.2.1]; exact hVH₁.union hVK + · rw [← hsep₁.2.2.2.1]; exact (hE.subset hsep.1.edgeSet_mono).union hEK + · rw [← hsep₂.2.2.1]; exact hVH₂.union hVK + · rw [← hsep₂.2.2.2.1]; exact (hE.subset hsep.2.1.edgeSet_mono).union hEK + +/-- Every base piece in a tree-structure of a finite graph has finite vertex and edge sets. -/ +theorem HasTreeStructureOver.with_finite {𝒞 : Set (Graph α β)} {G : Graph α β} + (h : HasTreeStructureOver 𝒞 G) (hV : V(G).Finite) (hE : E(G).Finite) : + HasTreeStructureOver {G' ∈ 𝒞 | V(G').Finite ∧ E(G').Finite} G := by + induction h with + | base hG => exact HasTreeStructureOver.base ⟨hG, hV, hE⟩ + | cliqueSum hsum _ _ ih₁ ih₂ => + obtain ⟨⟨hV₁, hE₁⟩, ⟨hV₂, hE₂⟩⟩ := hsum.finite_of_finite hV hE + exact HasTreeStructureOver.cliqueSum hsum (ih₁ hV₁ hE₁) (ih₂ hV₂ hE₂) + +/-- The subgraph of `G₀` with vertex set `W` and edge set `F`. -/ +def subgraphOfVE (G₀ : Graph α β) (W : Set α) (F : Set β) : Graph α β := + (G₀.induce W).restrict F + +@[simp] +theorem vertexSet_subgraphOfVE (G₀ : Graph α β) (W : Set α) (F : Set β) : + V(subgraphOfVE G₀ W F) = W := rfl + +theorem subgraphOfVE_le {G₀ : Graph α β} {W : Set α} {F : Set β} (hW : W ⊆ V(G₀)) : + subgraphOfVE G₀ W F ≤ G₀ := + restrict_le.trans (G₀.induce_le hW) + +theorem edgeSet_subgraphOfVE {G₀ : Graph α β} {W : Set α} {F : Set β} + (hF : ∀ e ∈ F, ∃ x ∈ W, ∃ y ∈ W, G₀.IsLink e x y) : + E(subgraphOfVE G₀ W F) = F := by + ext e + simp only [subgraphOfVE, edgeSet_restrict, mem_inter_iff, Graph.edgeSet_induce] + refine ⟨fun h => h.2, fun he => ⟨?_, he⟩⟩ + obtain ⟨x, hx, y, hy, hlink⟩ := hF e he + exact ⟨x, y, hlink, hx, hy⟩ + +theorem isGraphSeparation_subgraphOfVE {G₀ : Graph α β} + {W₀ W₁ W₂ : Set α} {F₀ F₁ F₂ : Set β} + (hW₀ : W₀ ⊆ V(G₀)) (hW₁ : W₁ ⊆ V(G₀)) (hW₂ : W₂ ⊆ V(G₀)) + (hF₀ : ∀ e ∈ F₀, ∃ x ∈ W₀, ∃ y ∈ W₀, G₀.IsLink e x y) + (hF₁ : ∀ e ∈ F₁, ∃ x ∈ W₁, ∃ y ∈ W₁, G₀.IsLink e x y) + (hF₂ : ∀ e ∈ F₂, ∃ x ∈ W₂, ∃ y ∈ W₂, G₀.IsLink e x y) + (hW_union : W₁ ∪ W₂ = W₀) (hF_union : F₁ ∪ F₂ = F₀) (hF_disj : Disjoint F₁ F₂) : + IsGraphSeparation (subgraphOfVE G₀ W₀ F₀) + (subgraphOfVE G₀ W₁ F₁) (subgraphOfVE G₀ W₂ F₂) := by + have hle₀ := subgraphOfVE_le (F := F₀) hW₀ + have hle₁ := subgraphOfVE_le (F := F₁) hW₁ + have hle₂ := subgraphOfVE_le (F := F₂) hW₂ + have hE₀ := edgeSet_subgraphOfVE hF₀ + have hE₁ := edgeSet_subgraphOfVE hF₁ + have hE₂ := edgeSet_subgraphOfVE hF₂ + refine ⟨?_, ?_, hW_union, ?_, ?_⟩ + · rw [(Compatible.of_le_le hle₁ hle₀).le_iff, hE₁, hE₀, ← hW_union, ← hF_union] + exact ⟨subset_union_left, subset_union_left⟩ + · rw [(Compatible.of_le_le hle₂ hle₀).le_iff, hE₂, hE₀, ← hW_union, ← hF_union] + exact ⟨subset_union_right, subset_union_right⟩ + · rw [hE₁, hE₂, hE₀, hF_union] + · rw [hE₁, hE₂] + exact hF_disj + +private theorem exists_torso_clique_extension {ι : Type*} [Finite ι] + {G : Graph α (β ⊕ ℕ)} (τ : ι → Graph α (β ⊕ ℕ)) (hV : V(G).Finite) (hE : E(G).Finite) : + let adhesionSet (eT : Sym2 ι) : Set α := {v ∈ V(G) | ∀ t ∈ eT, v ∈ V(τ t)} + ∃ (G_full : Graph α (β ⊕ ℕ)) (cliqueEdges : Sym2 ι → Set (β ⊕ ℕ)), + V(G_full) = V(G) ∧ G ≤ G_full ∧ + (∀ (eT : Sym2 ι) (e : β ⊕ ℕ), e ∈ cliqueEdges eT → + ∃ u ∈ adhesionSet eT, ∃ v ∈ adhesionSet eT, G_full.IsLink e u v) ∧ + (∀ eT, Disjoint E(G) (cliqueEdges eT)) ∧ + (∀ {eT₁ eT₂}, eT₁ ≠ eT₂ → Disjoint (cliqueEdges eT₁) (cliqueEdges eT₂)) ∧ + ∀ eT, IsCompleteGraphOn (subgraphOfVE G_full (adhesionSet eT) (cliqueEdges eT)) + (adhesionSet eT) := by + classical + intro adhesionSet + let indexFintype := Fintype.ofFinite ι + let _ : Fintype V(G) := hV.fintype + have hN_fin : (Sum.inr ⁻¹' E(G) : Set ℕ).Finite := + hE.preimage Sum.inr_injective.injOn + let B₀ : ℕ := hN_fin.toFinset.sup id + 1 + have hB₀_notMem : ∀ n : ℕ, (Sum.inr (B₀ + n) : β ⊕ ℕ) ∉ E(G) := by + intro n hmem + have hn_mem : B₀ + n ∈ hN_fin.toFinset := hN_fin.mem_toFinset.mpr hmem + have hle : B₀ + n ≤ hN_fin.toFinset.sup id := Finset.le_sup (f := id) hn_mem + omega + let enc := Fintype.equivFin (Sym2 ι × Sym2 V(G)) + let freshEdge (eT : Sym2 ι) (x y : V(G)) : β ⊕ ℕ := + Sum.inr (B₀ + (enc (eT, s(x, y))).1) + have hfresh_symm : ∀ (eT : Sym2 ι) (x y : V(G)), freshEdge eT x y = freshEdge eT y x := by + intro eT x y + dsimp [freshEdge] + rw [Sym2.eq_swap] + have hfresh_notMem : ∀ (eT : Sym2 ι) (x y : V(G)), freshEdge eT x y ∉ E(G) := + fun eT x y => hB₀_notMem _ + have hfresh_inj : ∀ {eT₁ eT₂ : Sym2 ι} {x₁ y₁ x₂ y₂ : V(G)}, + freshEdge eT₁ x₁ y₁ = freshEdge eT₂ x₂ y₂ ↔ eT₁ = eT₂ ∧ s(x₁, y₁) = s(x₂, y₂) := by + intro eT₁ eT₂ x₁ y₁ x₂ y₂ + constructor + · intro h + have h1 : B₀ + (enc (eT₁, s(x₁, y₁))).1 = B₀ + (enc (eT₂, s(x₂, y₂))).1 := + Sum.inr.inj h + have h2 : enc (eT₁, s(x₁, y₁)) = enc (eT₂, s(x₂, y₂)) := + Fin.ext (Nat.add_left_cancel h1) + exact Prod.mk.inj (enc.injective h2) + · rintro ⟨rfl, h⟩ + dsimp [freshEdge] + rw [h] + let G_full : Graph α (β ⊕ ℕ) := + { vertexSet := V(G) + edgeSet := E(G) ∪ + {e | ∃ (eT : Sym2 ι) (u v : α) (hu : u ∈ V(G)) (hv : v ∈ V(G)), + u ≠ v ∧ e = freshEdge eT ⟨u, hu⟩ ⟨v, hv⟩} + IsLink := fun e u v => + G.IsLink e u v ∨ + ∃ (eT : Sym2 ι) (hu : u ∈ V(G)) (hv : v ∈ V(G)), + u ≠ v ∧ e = freshEdge eT ⟨u, hu⟩ ⟨v, hv⟩ + isLink_symm := fun e _ => ⟨by + rintro u v (h | ⟨eT, hu, hv, hne, rfl⟩) + · exact Or.inl h.symm + · exact Or.inr ⟨eT, hv, hu, hne.symm, hfresh_symm eT ⟨u, hu⟩ ⟨v, hv⟩⟩⟩ + eq_or_eq_of_isLink_of_isLink := by + rintro e u v z w (h1 | ⟨eT₁, hu, hv, _, rfl⟩) (h2 | ⟨eT₂, hz, hw, _, he₂⟩) + · exact G.eq_or_eq_of_isLink_of_isLink h1 h2 + · exact (hfresh_notMem eT₂ ⟨z, hz⟩ ⟨w, hw⟩ (he₂ ▸ h1.edge_mem)).elim + · exact (hfresh_notMem eT₁ ⟨u, hu⟩ ⟨v, hv⟩ h2.edge_mem).elim + · rcases Sym2.eq_iff.mp (hfresh_inj.mp he₂).2 with ⟨huz, _⟩ | ⟨huw, _⟩ + · exact Or.inl (congrArg Subtype.val huz) + · exact Or.inr (congrArg Subtype.val huw) + edge_mem_iff_exists_isLink := fun e => by + constructor + · rintro (heG | ⟨eT, u, v, hu, hv, hne, rfl⟩) + · obtain ⟨u, v, h⟩ := exists_isLink_of_mem_edgeSet heG + exact ⟨u, v, Or.inl h⟩ + · exact ⟨u, v, Or.inr ⟨eT, hu, hv, hne, rfl⟩⟩ + · rintro ⟨u, v, h | ⟨eT, hu, hv, hne, rfl⟩⟩ + · exact Or.inl h.edge_mem + · exact Or.inr ⟨eT, u, v, hu, hv, hne, rfl⟩ + left_mem_of_isLink := by + rintro e u v (h | ⟨_, hu, _⟩) + · exact h.left_mem + · exact hu } + have hG_le_full : G ≤ G_full := + ⟨subset_rfl, fun _ _ _ h => Or.inl h⟩ + let cliqueEdges (eT : Sym2 ι) : Set (β ⊕ ℕ) := + {e | ∃ (u v : α) (hu : u ∈ adhesionSet eT) (hv : v ∈ adhesionSet eT), + u ≠ v ∧ e = freshEdge eT ⟨u, hu.1⟩ ⟨v, hv.1⟩} + have hW_K : ∀ eT : Sym2 ι, adhesionSet eT ⊆ V(G_full) := + fun _ _ h => h.1 + have hF_K : ∀ (eT : Sym2 ι) (e : β ⊕ ℕ), e ∈ cliqueEdges eT → + ∃ u ∈ adhesionSet eT, ∃ v ∈ adhesionSet eT, G_full.IsLink e u v := by + rintro eT e ⟨u, v, hu, hv, hne, rfl⟩ + exact ⟨u, hu, v, hv, Or.inr ⟨eT, hu.1, hv.1, hne, rfl⟩⟩ + let K (eT : Sym2 ι) : Graph α (β ⊕ ℕ) := + subgraphOfVE G_full (adhesionSet eT) (cliqueEdges eT) + have hK_le : ∀ eT : Sym2 ι, K eT ≤ G_full := fun eT => subgraphOfVE_le (hW_K eT) + have hK_E : ∀ eT : Sym2 ι, E(K eT) = cliqueEdges eT := + fun eT => edgeSet_subgraphOfVE (hF_K eT) + have hdisj_G_K : ∀ eT : Sym2 ι, Disjoint E(G) (cliqueEdges eT) := by + intro eT + refine Set.disjoint_left.mpr ?_ + rintro e heG ⟨u, v, hu, hv, _, rfl⟩ + exact hfresh_notMem eT ⟨u, hu.1⟩ ⟨v, hv.1⟩ heG + have hdisj_K : ∀ {eT₁ eT₂ : Sym2 ι}, eT₁ ≠ eT₂ → + Disjoint (cliqueEdges eT₁) (cliqueEdges eT₂) := by + intro eT₁ eT₂ hne + refine Set.disjoint_left.mpr ?_ + rintro e ⟨u₁, v₁, hu₁, hv₁, _, rfl⟩ ⟨u₂, v₂, hu₂, hv₂, _, he⟩ + exact hne (hfresh_inj.mp he).1 + have hK_complete : ∀ eT : Sym2 ι, IsCompleteGraphOn (K eT) (adhesionSet eT) := by + intro eT + refine ⟨rfl, ?_, ?_⟩ + · intro e x hloop + have heK : e ∈ cliqueEdges eT := hK_E eT ▸ hloop.edge_mem + have hlink_full : G_full.IsLink e x x := hloop.mono (hK_le eT) + rcases hlink_full with hG | ⟨eT', hx, _, hne, _⟩ + · exact Set.disjoint_left.mp (hdisj_G_K eT) hG.edge_mem heK + · exact hne rfl + · intro x hx y hy hxy + refine ⟨freshEdge eT ⟨x, hx.1⟩ ⟨y, hy.1⟩, ?_, ?_⟩ + · have he_mem : freshEdge eT ⟨x, hx.1⟩ ⟨y, hy.1⟩ ∈ E(K eT) := by + rw [hK_E eT] + exact ⟨x, y, hx, hy, hxy, rfl⟩ + exact ((hK_le eT).isLink_iff he_mem).mpr (Or.inr ⟨eT, hx.1, hy.1, hxy, rfl⟩) + · intro e hlink + have heK : e ∈ cliqueEdges eT := hK_E eT ▸ hlink.edge_mem + have hlink_full : G_full.IsLink e x y := hlink.mono (hK_le eT) + rcases hlink_full with hG | ⟨eT', hx', hy', _, rfl⟩ + · exact (Set.disjoint_left.mp (hdisj_G_K eT) hG.edge_mem heK).elim + · rcases heK with ⟨u, v, hu, hv, _, he⟩ + have heT_eq : eT' = eT := (hfresh_inj.mp he).1 + subst heT_eq + rfl + exact ⟨G_full, cliqueEdges, rfl, hG_le_full, hF_K, hdisj_G_K, hdisj_K, hK_complete⟩ + +private theorem boundary_edges_of_leaf {ι : Type*} {T : SimpleGraph ι} + [DecidableEq ι] {s : Finset ι} {t₀ t₁ : ι} (ht₀_s : t₀ ∈ s) (ht₁_s : t₁ ∈ s) + (hadj_t₀t₁ : T.Adj t₀ t₁) (ht₁_uniq : ∀ u ∈ s, T.Adj t₀ u → u = t₁) : + let boundaryEdges (s : Finset ι) : Set (Sym2 ι) := + {eT | ∃ t₁ ∈ s, ∃ t₂ ∉ s, T.Adj t₁ t₂ ∧ eT = s(t₁, t₂)} + let s' := s.erase t₀ + let e₀ : Sym2 ι := s(t₀, t₁) + let B₁ := boundaryEdges {t₀} \ {e₀} + let B₂ := boundaryEdges s' \ {e₀} + e₀ ∈ boundaryEdges {t₀} ∧ e₀ ∈ boundaryEdges s' ∧ boundaryEdges s = B₁ ∪ B₂ ∧ + Disjoint B₁ B₂ := by + intro boundaryEdges s' e₀ B₁ B₂ + have ht₀_ne_t₁ := hadj_t₀t₁.ne + have ht₁_s' : t₁ ∈ s' := Finset.mem_erase.mpr ⟨ht₀_ne_t₁.symm, ht₁_s⟩ + have he₀_mem_bd₁ : e₀ ∈ boundaryEdges {t₀} := + ⟨t₀, Finset.mem_singleton_self t₀, t₁, Finset.notMem_singleton.mpr ht₀_ne_t₁.symm, + hadj_t₀t₁, rfl⟩ + have he₀_mem_bd₂ : e₀ ∈ boundaryEdges s' := + ⟨t₁, ht₁_s', t₀, Finset.notMem_erase t₀ s, hadj_t₀t₁.symm, Sym2.eq_swap⟩ + have hB₁_char : ∀ eT : Sym2 ι, + eT ∈ B₁ ↔ ∃ w ∉ s, T.Adj t₀ w ∧ eT = s(t₀, w) := by + intro eT + simp only [B₁, boundaryEdges, mem_sdiff, mem_ofPred_eq, Finset.mem_singleton, + mem_singleton_iff] + constructor + · rintro ⟨⟨u, rfl, w, hw_ne, hadj, rfl⟩, hne_e₀⟩ + refine ⟨w, fun hws => ?_, hadj, rfl⟩ + have hw_eq : w = t₁ := ht₁_uniq w hws hadj + exact hne_e₀ (hw_eq ▸ rfl) + · rintro ⟨w, hws, hadj, rfl⟩ + refine ⟨⟨t₀, rfl, w, fun h => hws (h ▸ ht₀_s), hadj, rfl⟩, ?_⟩ + intro heq + rcases Sym2.eq_iff.mp heq with ⟨_, rfl⟩ | ⟨_, rfl⟩ + · exact hws ht₁_s + · exact hws ht₀_s + have hB₂_char : ∀ eT : Sym2 ι, + eT ∈ B₂ ↔ ∃ u ∈ s', ∃ w ∉ s, T.Adj u w ∧ eT = s(u, w) := by + intro eT + simp only [B₂, boundaryEdges, mem_sdiff, mem_ofPred_eq, mem_singleton_iff] + constructor + · rintro ⟨⟨u, hu_s', w, hw_s', hadj, rfl⟩, hne_e₀⟩ + refine ⟨u, hu_s', w, fun hws => ?_, hadj, rfl⟩ + have hw_t₀ : w = t₀ := by + by_contra hw_ne + exact hw_s' (Finset.mem_erase.mpr ⟨hw_ne, hws⟩) + subst hw_t₀ + have hu_t₁ : u = t₁ := ht₁_uniq u (Finset.mem_of_mem_erase hu_s') hadj.symm + subst hu_t₁ + exact hne_e₀ Sym2.eq_swap + · rintro ⟨u, hu_s', w, hws, hadj, rfl⟩ + refine ⟨⟨u, hu_s', w, fun h => hws (Finset.mem_of_mem_erase h), hadj, rfl⟩, ?_⟩ + intro heq + rcases Sym2.eq_iff.mp heq with ⟨_, rfl⟩ | ⟨_, rfl⟩ + · exact hws ht₁_s + · exact hws ht₀_s + have hbd_s : boundaryEdges s = B₁ ∪ B₂ := by + ext eT + rw [mem_union, hB₁_char, hB₂_char] + simp only [boundaryEdges, mem_ofPred_eq] + constructor + · rintro ⟨u, hu_s, w, hws, hadj, rfl⟩ + by_cases hu_t₀ : u = t₀ + · subst hu_t₀ + exact Or.inl ⟨w, hws, hadj, rfl⟩ + · exact Or.inr ⟨u, Finset.mem_erase.mpr ⟨hu_t₀, hu_s⟩, w, hws, hadj, rfl⟩ + · rintro (⟨w, hws, hadj, rfl⟩ | ⟨u, hu_s', w, hws, hadj, rfl⟩) + · exact ⟨t₀, ht₀_s, w, hws, hadj, rfl⟩ + · exact ⟨u, Finset.mem_of_mem_erase hu_s', w, hws, hadj, rfl⟩ + have hB₁_B₂_disj : Disjoint B₁ B₂ := by + refine Set.disjoint_left.mpr ?_ + intro eT h1 h2 + obtain ⟨w₁, hw₁s, _, rfl⟩ := (hB₁_char eT).mp h1 + obtain ⟨u, hu_s', w₂, hw₂s, _, heq⟩ := (hB₂_char _).mp h2 + rcases Sym2.eq_iff.mp heq with ⟨rfl, _⟩ | ⟨rfl, _⟩ + · exact Finset.ne_of_mem_erase hu_s' rfl + · exact hw₂s ht₀_s + exact ⟨he₀_mem_bd₁, he₀_mem_bd₂, hbd_s, hB₁_B₂_disj⟩ + +private theorem singleton_piece_is_torso {ι : Type*} + {T : SimpleGraph ι} {τ : ι → Graph α (β ⊕ ℕ)} {G_full : Graph α (β ⊕ ℕ)} + {adhesionSet : Sym2 ι → Set α} {cliqueEdges : Sym2 ι → Set (β ⊕ ℕ)} + (hadhesion_mk : ∀ t₁ t₂, adhesionSet s(t₁, t₂) = V(τ t₁) ∩ V(τ t₂)) + (hτ_le : ∀ t, τ t ≤ G_full) (hW_K : ∀ eT, adhesionSet eT ⊆ V(G_full)) + (hF_K : ∀ (eT : Sym2 ι) (e : β ⊕ ℕ), e ∈ cliqueEdges eT → + ∃ u ∈ adhesionSet eT, ∃ v ∈ adhesionSet eT, G_full.IsLink e u v) : + let boundaryEdges (s : Finset ι) : Set (Sym2 ι) := + {eT | ∃ t₁ ∈ s, ∃ t₂ ∉ s, T.Adj t₁ t₂ ∧ eT = s(t₁, t₂)} + let pieceV (s : Finset ι) : Set α := ⋃ t ∈ s, V(τ t) + let pieceE (s : Finset ι) : Set (β ⊕ ℕ) := + (⋃ t ∈ s, E(τ t)) ∪ (⋃ eT ∈ boundaryEdges s, cliqueEdges eT) + (∀ s : Finset ι, pieceV s ⊆ V(G_full)) → + (∀ (s : Finset ι) (e : β ⊕ ℕ), e ∈ pieceE s → + ∃ u ∈ pieceV s, ∃ v ∈ pieceV s, G_full.IsLink e u v) → + ∀ t₀ : ι, IsTorsoOfDesign (graphVertexDesign T τ t₀) + (subgraphOfVE G_full (pieceV {t₀}) (pieceE {t₀})) := by + classical + intro boundaryEdges pieceV pieceE hW_piece hF_piece + let subPiece (s : Finset ι) := subgraphOfVE G_full (pieceV s) (pieceE s) + let K (eT : Sym2 ι) := subgraphOfVE G_full (adhesionSet eT) (cliqueEdges eT) + have hK_le (eT : Sym2 ι) : K eT ≤ G_full := subgraphOfVE_le (hW_K eT) + have hK_E (eT : Sym2 ι) : E(K eT) = cliqueEdges eT := edgeSet_subgraphOfVE (hF_K eT) + intro t₀ + have hV_eq : V(τ t₀) = V(subPiece {t₀}) := by + change V(τ t₀) = ⋃ t ∈ ({t₀} : Finset ι), V(τ t) + simp + have hE_eq : E(subPiece {t₀}) = pieceE {t₀} := edgeSet_subgraphOfVE (hF_piece {t₀}) + have hle : τ t₀ ≤ subPiece {t₀} := by + rw [(Compatible.of_le_le (hτ_le t₀) + (subgraphOfVE_le (hW_piece {t₀}))).le_iff, hE_eq] + refine ⟨hV_eq.le, fun e he => Or.inl ?_⟩ + simp [he] + refine ⟨hV_eq, hle, ?_⟩ + rintro e ⟨he_sub, he_not_tau⟩ + rw [hE_eq] at he_sub + rcases he_sub with he_tau | he_bd + · simp only [Finset.mem_singleton, iUnion_iUnion_eq_left] at he_tau + exact (he_not_tau he_tau).elim + · obtain ⟨eT, ⟨t₁, ht₁, t₂, _, hadj, rfl⟩, heK⟩ := mem_iUnion₂.mp he_bd + have ht₁_eq : t₁ = t₀ := Finset.mem_singleton.mp ht₁ + subst ht₁_eq + refine ⟨V(τ t₁) ∩ V(τ t₂), ⟨t₂, hadj, rfl⟩, ?_⟩ + intro v hinc + rcases hinc with ⟨w, hlink⟩ + have hlink_full : G_full.IsLink e v w := hlink.mono (subgraphOfVE_le (hW_piece {t₁})) + have heK_mem : e ∈ E(K s(t₁, t₂)) := by rwa [hK_E] + have hlink_K : (K s(t₁, t₂)).IsLink e v w := + ((hK_le s(t₁, t₂)).isLink_iff heK_mem).mpr hlink_full + rw [← hadhesion_mk t₁ t₂] + exact hlink_K.left_mem + +private theorem leaf_decomposition_removal {ι : Type*} [Fintype ι] [DecidableEq ι] + {G : Graph α (β ⊕ ℕ)} {T : SimpleGraph ι} {τ : ι → Graph α (β ⊕ ℕ)} + (hTD : IsGraphTreeDecomposition G T τ) {s : Finset ι} + (hs_tree : (T.induce (s : Set ι)).IsTree) + (x₀ x₁ : s) (hdeg : ((T.induce (s : Set ι)).neighborSet x₀).ncard = 1) + (hadj_ind : (T.induce (s : Set ι)).Adj x₀ x₁) + (hx₁_uniq : ∀ u, (T.induce (s : Set ι)).Adj x₀ u → u = x₁) : + let s' := s.erase x₀.1 + (T.induce (s' : Set ι)).IsTree ∧ + V(τ x₀.1) ∩ (⋃ t ∈ s', V(τ t)) = V(τ x₀.1) ∩ V(τ x₁.1) := by + classical + intro s' + have hdeg1 : (T.induce (s : Set ι)).degree x₀ = 1 := + (SimpleGraph.ncard_neighborSet _ _).symm.trans hdeg + let t₀ := x₀.1 + let t₁ := x₁.1 + have hadj_t₀t₁ : T.Adj t₀ t₁ := hadj_ind + have ht₁_s' : t₁ ∈ s' := Finset.mem_erase.mpr ⟨hadj_t₀t₁.ne.symm, x₁.2⟩ + -- Show `(T.induce (s' : Set ι)).IsTree` + have hs'_tree : (T.induce (s' : Set ι)).IsTree := by + have hconn_compl : ((T.induce (s : Set ι)).induce {x₀}ᶜ).Connected := + hs_tree.connected.induce_compl_singleton_of_degree_eq_one hdeg1 + have htree_compl : ((T.induce (s : Set ι)).induce {x₀}ᶜ).IsTree := + ⟨hconn_compl, hs_tree.isAcyclic.induce {x₀}ᶜ⟩ + let e_equiv : (s' : Set ι) ≃ ({x₀}ᶜ : Set (s : Set ι)) := + { toFun := fun y => + ⟨⟨y.1, Finset.mem_of_mem_erase y.2⟩, + fun h => (Finset.ne_of_mem_erase y.2) (congrArg Subtype.val h)⟩ + invFun := fun z => + ⟨z.1.1, Finset.mem_erase.mpr ⟨fun h => z.2 (Subtype.ext h), z.1.2⟩⟩ + left_inv := fun _ => Subtype.ext rfl + right_inv := fun _ => Subtype.ext (Subtype.ext rfl) } + let iso_ind : T.induce (s' : Set ι) ≃g (T.induce (s : Set ι)).induce {x₀}ᶜ := + { toEquiv := e_equiv + map_rel_iff' := Iff.rfl } + exact iso_ind.symm.isTree_iff.mp htree_compl + -- Show `V(τ t₀) ∩ (⋃ t ∈ s', V(τ t)) = V(τ t₀) ∩ V(τ t₁)` + have hV_inter : V(τ t₀) ∩ (⋃ t ∈ s', V(τ t)) = V(τ t₀) ∩ V(τ t₁) := by + ext v + simp only [mem_inter_iff, mem_iUnion, exists_prop] + refine ⟨?_, fun ⟨hv₀, hv₁⟩ => ⟨hv₀, t₁, ht₁_s', hv₁⟩⟩ + rintro ⟨hv₀, u, hu_s', hvu⟩ + refine ⟨hv₀, ?_⟩ + have hu_s : u ∈ s := Finset.mem_of_mem_erase hu_s' + have hu_ne : u ≠ t₀ := Finset.ne_of_mem_erase hu_s' + obtain ⟨p_ind, hp_ind⟩ := hs_tree.connected.exists_isPath x₀ ⟨u, hu_s⟩ + have ht₁_in_p : x₁ ∈ p_ind.support := by + cases p_ind with + | nil => exact (hu_ne rfl).elim + | @cons _ w _ hadj_w q => + have hw_eq : w = x₁ := hx₁_uniq w hadj_w + subst hw_eq + exact Walk.support_cons _ _ ▸ List.mem_cons_of_mem x₀ q.start_mem_support + let p := p_ind.map (SimpleGraph.Embedding.induce (s : Set ι)).toHom + have hp_path : p.IsPath := hp_ind.map Subtype.val_injective + have ht₁_mem : t₁ ∈ p.support := by + rw [Walk.support_map, List.mem_map] + exact ⟨x₁, ht₁_in_p, rfl⟩ + exact hTD.inter_subset_of_mem_path p hp_path ht₁_mem ⟨hv₀, hvu⟩ + exact ⟨hs'_tree, hV_inter⟩ + +/-- **Graph Minors XVI, (2.2)** (page 48): +"Let $\mathscr{D}$ be a class of designs, and let $\mathscr{D}'$ be the class of torsos of members +of $\mathscr{D}$. If $G$ is a graph with a tree-decomposition $(T, \tau)$ such that $\mathscr{D}$ +contains the design of $t$ in $(T, \tau)$ for each $t \in V(T)$, then $G$ is a tree-structure over +$\mathscr{D}'$." -/ +theorem theorem_2_2_proof {ι : Type*} [Fintype ι] {G : Graph α (β ⊕ ℕ)} + {𝒟 : Set (GraphDesign α (β ⊕ ℕ))} {T : SimpleGraph ι} {τ : ι → Graph α (β ⊕ ℕ)} + (hV : V(G).Finite) (hE : E(G).Finite) + (hover : IsGraphTreeDecompositionOver G 𝒟 T τ) : + HasTreeStructureOver (torsosOfClass 𝒟) G := by + classical + have hTD := hover.1 + obtain ⟨G_full, cliqueEdges, hV_full, hG_le_full, hF_K, hdisj_G_K, hdisj_K, hK_complete⟩ := + exists_torso_clique_extension τ hV hE + let adhesionSet (eT : Sym2 ι) : Set α := {v ∈ V(G) | ∀ t ∈ eT, v ∈ V(τ t)} + have hadhesion_mk : ∀ t₁ t₂ : ι, adhesionSet s(t₁, t₂) = V(τ t₁) ∩ V(τ t₂) := by + intro t₁ t₂ + ext v + simp only [adhesionSet, mem_ofPred_eq, Sym2.mem_iff, forall_eq_or_imp, forall_eq, mem_inter_iff] + exact ⟨fun h => h.2, fun h => ⟨(hTD.le_G t₁).vertexSet_mono h.1, h⟩⟩ + have hW_K (eT : Sym2 ι) : adhesionSet eT ⊆ V(G_full) := + fun _ h => hV_full.symm ▸ h.1 + let K (eT : Sym2 ι) : Graph α (β ⊕ ℕ) := + subgraphOfVE G_full (adhesionSet eT) (cliqueEdges eT) + have hK_le (eT : Sym2 ι) : K eT ≤ G_full := subgraphOfVE_le (hW_K eT) + have hK_E (eT : Sym2 ι) : E(K eT) = cliqueEdges eT := edgeSet_subgraphOfVE (hF_K eT) + let boundaryEdges (s : Finset ι) : Set (Sym2 ι) := + {eT : Sym2 ι | ∃ t₁ ∈ s, ∃ t₂ ∉ s, T.Adj t₁ t₂ ∧ eT = s(t₁, t₂)} + let pieceV (s : Finset ι) : Set α := ⋃ t ∈ s, V(τ t) + let pieceE (s : Finset ι) : Set (β ⊕ ℕ) := + (⋃ t ∈ s, E(τ t)) ∪ (⋃ eT ∈ boundaryEdges s, cliqueEdges eT) + have hW_piece : ∀ s : Finset ι, pieceV s ⊆ V(G_full) := + fun s => iUnion₂_subset fun t _ => ((hTD.le_G t).trans hG_le_full).vertexSet_mono + have hF_piece : ∀ (s : Finset ι) (e : β ⊕ ℕ), e ∈ pieceE s → + ∃ u ∈ pieceV s, ∃ v ∈ pieceV s, G_full.IsLink e u v := by + intro s e he + rcases he with he_tau | he_bd + · obtain ⟨t, hts, het⟩ := mem_iUnion₂.mp he_tau + obtain ⟨u, v, hlink⟩ := exists_isLink_of_mem_edgeSet het + exact ⟨u, mem_iUnion₂.mpr ⟨t, hts, hlink.left_mem⟩, + v, mem_iUnion₂.mpr ⟨t, hts, hlink.right_mem⟩, + hlink.mono ((hTD.le_G t).trans hG_le_full)⟩ + · obtain ⟨eT, ⟨t₁, ht₁s, t₂, _, _, rfl⟩, heK⟩ := mem_iUnion₂.mp he_bd + obtain ⟨u, hu, v, hv, hlink⟩ := hF_K s(t₁, t₂) e heK + change u ∈ adhesionSet s(t₁, t₂) at hu + change v ∈ adhesionSet s(t₁, t₂) at hv + rw [hadhesion_mk] at hu hv + have hu_t₁ : u ∈ V(τ t₁) := hu.1 + have hv_t₁ : v ∈ V(τ t₁) := hv.1 + exact ⟨u, mem_iUnion₂.mpr ⟨t₁, ht₁s, hu_t₁⟩, + v, mem_iUnion₂.mpr ⟨t₁, ht₁s, hv_t₁⟩, hlink⟩ + let subPiece (s : Finset ι) : Graph α (β ⊕ ℕ) := + subgraphOfVE G_full (pieceV s) (pieceE s) + have hsubPiece_singleton_torso (t₀ : ι) : + IsTorsoOfDesign (graphVertexDesign T τ t₀) (subPiece {t₀}) := + singleton_piece_is_torso hadhesion_mk + (fun t => (hTD.le_G t).trans hG_le_full) hW_K hF_K hW_piece hF_piece t₀ + have hmain : ∀ (n : ℕ) (s : Finset ι), s.card = n → (T.induce (s : Set ι)).IsTree → + HasTreeStructureOver (torsosOfClass 𝒟) (subPiece s) := by + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro s hcard hs_tree + have hs_nonempty : s.Nonempty := by + obtain ⟨⟨x, hx⟩⟩ := hs_tree.connected.nonempty + exact ⟨x, hx⟩ + by_cases hn1 : n ≤ 1 + · have hcard1 : s.card ≤ 1 := hcard ▸ hn1 + obtain ⟨t₀, rfl⟩ := Finset.card_eq_one.mp (le_antisymm hcard1 hs_nonempty.card_pos) + exact HasTreeStructureOver.base ⟨graphVertexDesign T τ t₀, hover.2 t₀, + hsubPiece_singleton_torso t₀⟩ + · have hcard2 : 1 < s.card := by omega + obtain ⟨a₁, ha₁, a₂, ha₂, ha_ne⟩ := Finset.one_lt_card.mp hcard2 + have : Nontrivial (s : Set ι) := + ⟨⟨a₁, ha₁⟩, ⟨a₂, ha₂⟩, fun h => ha_ne (congrArg Subtype.val h)⟩ + obtain ⟨x₀, hdeg1⟩ := hs_tree.exists_vert_degree_one_of_nontrivial + obtain ⟨x₁, hadj_ind, hx₁_uniq⟩ := + (SimpleGraph.degree_eq_one_iff_existsUnique_adj (G := T.induce (s : Set ι)) + (v := x₀)).mp hdeg1 + let t₀ : ι := x₀.1 + let t₁ : ι := x₁.1 + have ht₀_s : t₀ ∈ s := x₀.2 + have ht₁_s : t₁ ∈ s := x₁.2 + have hadj_t₀t₁ : T.Adj t₀ t₁ := hadj_ind + have ht₀_ne_t₁ : t₀ ≠ t₁ := hadj_t₀t₁.ne + have ht₁_uniq : ∀ u ∈ s, T.Adj t₀ u → u = t₁ := by + intro u hu hadj_u + exact congrArg Subtype.val (hx₁_uniq ⟨u, hu⟩ hadj_u) + let s' : Finset ι := s.erase t₀ + have ht₁_s' : t₁ ∈ s' := Finset.mem_erase.mpr ⟨ht₀_ne_t₁.symm, ht₁_s⟩ + have hs'_insert : insert t₀ s' = s := Finset.insert_erase ht₀_s + obtain ⟨hs'_tree, hV_inter⟩ := + leaf_decomposition_removal hTD hs_tree x₀ x₁ + ((SimpleGraph.ncard_neighborSet _ _).trans hdeg1) hadj_ind hx₁_uniq + -- Decompose `boundaryEdges` around `e₀ := s(t₀, t₁)` + let e₀ : Sym2 ι := s(t₀, t₁) + let B₁ : Set (Sym2 ι) := boundaryEdges {t₀} \ {e₀} + let B₂ : Set (Sym2 ι) := boundaryEdges s' \ {e₀} + obtain ⟨he₀_mem_bd₁, he₀_mem_bd₂, hbd_s, hB₁_B₂_disj⟩ := + boundary_edges_of_leaf ht₀_s ht₁_s hadj_t₀t₁ ht₁_uniq + -- Define `H₁` and `H₂` + let E₁ : Set (β ⊕ ℕ) := E(τ t₀) ∪ (⋃ eT ∈ B₁, cliqueEdges eT) + let E₂ : Set (β ⊕ ℕ) := (⋃ u ∈ s', E(τ u)) ∪ (⋃ eT ∈ B₂, cliqueEdges eT) + have hE₁_sub : E₁ ⊆ pieceE {t₀} := by + refine union_subset_union ?_ (biUnion_subset_biUnion_left sdiff_subset) + simp + have hE₂_sub : E₂ ⊆ pieceE s' := + union_subset_union subset_rfl (biUnion_subset_biUnion_left sdiff_subset) + have hF_H₁ : ∀ e ∈ E₁, ∃ u ∈ pieceV {t₀}, ∃ v ∈ pieceV {t₀}, G_full.IsLink e u v := + fun e he => hF_piece {t₀} e (hE₁_sub he) + have hF_H₂ : ∀ e ∈ E₂, ∃ u ∈ pieceV s', ∃ v ∈ pieceV s', G_full.IsLink e u v := + fun e he => hF_piece s' e (hE₂_sub he) + let H₁ : Graph α (β ⊕ ℕ) := subgraphOfVE G_full (pieceV {t₀}) E₁ + let H₂ : Graph α (β ⊕ ℕ) := subgraphOfVE G_full (pieceV s') E₂ + have hV_t₀ : pieceV {t₀} = V(τ t₀) := by simp [pieceV] + have hsum : IsCliqueSum (subPiece s) (subPiece {t₀}) (subPiece s') := by + refine ⟨H₁, H₂, K e₀, ?_, ?_, ?_, ?_⟩ + · refine isGraphSeparation_subgraphOfVE (hW_piece s) (hW_piece {t₀}) (hW_piece s') + (hF_piece s) hF_H₁ hF_H₂ ?_ ?_ ?_ + · ext v + simp [pieceV, ← hs'_insert] + · dsimp only [E₁, E₂, pieceE] + rw [union_union_union_comm, ← biUnion_union, ← hbd_s] + congr 1 + ext e + simp [← hs'_insert] + · refine Disjoint.union_left ?_ ?_ <;> refine Disjoint.union_right ?_ ?_ + · rw [disjoint_iUnion₂_right] + intro u hu_s' + exact hTD.edge_disjoint (Finset.ne_of_mem_erase hu_s').symm + · rw [disjoint_iUnion₂_right] + intro eT _ + exact Disjoint.mono_left (hTD.le_G t₀).edgeSet_mono (hdisj_G_K eT) + · rw [disjoint_iUnion₂_left] + intro eT _ + rw [disjoint_iUnion₂_right] + intro u _ + exact (Disjoint.mono_left (hTD.le_G u).edgeSet_mono (hdisj_G_K eT)).symm + · rw [disjoint_iUnion₂_left] + intro eT₁ h₁ + rw [disjoint_iUnion₂_right] + intro eT₂ h₂ + exact hdisj_K fun heq => Set.disjoint_left.mp hB₁_B₂_disj h₁ (heq ▸ h₂) + · have hV_inter_H : V(H₁) ∩ V(H₂) = adhesionSet e₀ := by + change pieceV {t₀} ∩ pieceV s' = adhesionSet s(t₀, t₁) + rw [hV_t₀, hV_inter, hadhesion_mk] + rw [hV_inter_H] + exact hK_complete e₀ + · refine isGraphSeparation_subgraphOfVE (hW_piece {t₀}) (hW_piece {t₀}) (hW_K e₀) + (hF_piece {t₀}) hF_H₁ (hF_K e₀) ?_ ?_ ?_ + · rw [hV_t₀, hadhesion_mk] + exact union_eq_self_of_subset_right inter_subset_left + · dsimp only [E₁, pieceE] + rw [Finset.set_biUnion_singleton, Set.union_assoc] + congr 1 + rw [Set.union_comm, ← biUnion_insert, insert_sdiff_singleton, + insert_eq_of_mem he₀_mem_bd₁] + · refine Disjoint.union_left ?_ ?_ + · exact Disjoint.mono_left (hTD.le_G t₀).edgeSet_mono (hdisj_G_K e₀) + · rw [disjoint_iUnion₂_left] + intro eT heT + exact hdisj_K (Ne.symm fun h => heT.2 (h.symm ▸ rfl)) + · refine isGraphSeparation_subgraphOfVE (hW_piece s') (hW_piece s') (hW_K e₀) + (hF_piece s') hF_H₂ (hF_K e₀) ?_ ?_ ?_ + · rw [hadhesion_mk] + exact union_eq_self_of_subset_right fun v hv => + mem_iUnion₂.mpr ⟨t₁, ht₁_s', hv.2⟩ + · dsimp only [E₂, pieceE] + rw [Set.union_assoc] + congr 1 + rw [Set.union_comm, ← biUnion_insert, insert_sdiff_singleton, + insert_eq_of_mem he₀_mem_bd₂] + · refine Disjoint.union_left ?_ ?_ + · rw [disjoint_iUnion₂_left] + intro u _ + exact Disjoint.mono_left (hTD.le_G u).edgeSet_mono (hdisj_G_K e₀) + · rw [disjoint_iUnion₂_left] + intro eT heT + exact hdisj_K (Ne.symm fun h => heT.2 (h.symm ▸ rfl)) + have hlt : s'.card < n := by + rw [← hcard] + exact Finset.card_erase_lt_of_mem ht₀_s + have htree_t₀ : (T.induce (({t₀} : Finset ι) : Set ι)).IsTree := by + have : Nonempty (({t₀} : Finset ι) : Set ι) := ⟨⟨t₀, Finset.mem_singleton_self t₀⟩⟩ + have : Subsingleton (({t₀} : Finset ι) : Set ι) := + ⟨fun a b => Subtype.ext ((Finset.mem_singleton.mp a.2).trans + (Finset.mem_singleton.mp b.2).symm)⟩ + exact SimpleGraph.IsTree.of_subsingleton + exact HasTreeStructureOver.cliqueSum hsum + (ih 1 (by omega) {t₀} (Finset.card_singleton t₀) htree_t₀) + (ih s'.card hlt s' rfl hs'_tree) + have huniv_tree : (T.induce ((Finset.univ : Finset ι) : Set ι)).IsTree := by + rw [Finset.coe_univ] + let iso_univ : T.induce (Set.univ : Set ι) ≃g T := + { toEquiv := Equiv.Set.univ ι + map_rel_iff' := Iff.rfl } + exact iso_univ.isTree_iff.mpr hTD.isTree + have huniv_eq : subPiece Finset.univ = G := by + refine (Compatible.of_le_le (subgraphOfVE_le (hW_piece Finset.univ)) hG_le_full).ext ?_ ?_ + · change (⋃ t ∈ (Finset.univ : Finset ι), V(τ t)) = V(G) + simpa using hTD.vertexSet_union + · rw [edgeSet_subgraphOfVE (hF_piece Finset.univ)] + have hbd_univ : boundaryEdges Finset.univ = ∅ := by + ext eT + simp [boundaryEdges] + dsimp only [pieceE] + rw [hbd_univ, biUnion_empty, union_empty] + simpa using hTD.edgeSet_union + rw [← huniv_eq] + exact hmain Finset.univ.card Finset.univ rfl huniv_tree + +/-! ## Proof of Graph Minors XVI, (2.3) (page 48) -/ + +/-- Every torso of a member of `𝒟^n` is a loose `(≤ n)`-vertex extension of a torso of a member of +`𝒟` (Graph Minors XVI, Section 2, page 48): +"Now for $n \ge 0$, if $\mathscr{D}$ is a class of designs then every torso of a member of +$\mathscr{D}^n$ is a $(\le n)$-vertex extension of a torso of a member of $\mathscr{D}$." +This uses `IsLooseVertexExtension` because the definition of `𝒟^n` on page 47 allows `Z` to meet +`V(H)`, so a torso of `d` has vertex set `V(H)` and can retain vertices of `Z ∩ V(H)`. -/ +theorem exists_isTorsoOfDesign_isLooseVertexExtension_of_isGraphEnlargement + {n : ℕ} {d d' : GraphDesign α β} {G' : Graph α β} + (henl : IsGraphEnlargement n d d') (htorso : IsTorsoOfDesign d' G') : + ∃ H : Graph α β, IsTorsoOfDesign d H ∧ IsLooseVertexExtension n G' H := by + rcases henl with ⟨Z, hZ_card, hvia⟩ + have hd_le_G' : d.1 ≤ G' := hvia.le.trans htorso.2.1 + have hdel_le_G' : GM09.deleteVertices G' Z ≤ G' := G'.induce_le sdiff_subset + have hV_sub_d : V(G') \ Z ⊆ V(d.1) := by + intro v ⟨hvG', hvZ⟩ + rw [← htorso.1] at hvG' + by_contra hvd + exact hvZ (hvia.sdiff_subset ⟨hvG', hvd⟩) + let F : Set β := E(d.1) ∪ E(GM09.deleteVertices G' Z) + have hW_H : V(d.1) ⊆ V(G') := hd_le_G'.vertexSet_mono + have hF_H : ∀ e ∈ F, ∃ x ∈ V(d.1), ∃ y ∈ V(d.1), G'.IsLink e x y := by + rintro e (hed | he_del) + · obtain ⟨x, y, hlink⟩ := exists_isLink_of_mem_edgeSet hed + exact ⟨x, hlink.left_mem, y, hlink.right_mem, hlink.mono hd_le_G'⟩ + · obtain ⟨x, y, hlink⟩ := exists_isLink_of_mem_edgeSet he_del + exact ⟨x, hV_sub_d hlink.left_mem, y, hV_sub_d hlink.right_mem, hlink.mono hdel_le_G'⟩ + let H : Graph α β := subgraphOfVE G' V(d.1) F + have hH_le_G' : H ≤ G' := subgraphOfVE_le hW_H + have hH_E : E(H) = F := edgeSet_subgraphOfVE hF_H + refine ⟨H, ⟨rfl, ?_, ?_⟩, ?_⟩ + · rw [(Compatible.of_le_le hd_le_G' hH_le_G').le_iff, hH_E] + exact ⟨subset_rfl, subset_union_left⟩ + · rintro e ⟨heH, hed⟩ + rw [hH_E] at heH + have he_del : e ∈ E(GM09.deleteVertices G' Z) := heH.resolve_left hed + have heG' : e ∈ E(G') := hdel_le_G'.edgeSet_mono he_del + have hed' : e ∉ E(d'.1) := fun h => hed (hvia.edgeSet_subset h) + obtain ⟨X, hX_mem, hX_inc⟩ := htorso.2.2 e ⟨heG', hed'⟩ + have hX_ne_Z : X ≠ Z := by + rintro rfl + obtain ⟨x, y, hlink⟩ := exists_isLink_of_mem_edgeSet he_del + have hx_Z : x ∈ X := hX_inc x ⟨y, hlink.mono hdel_le_G'⟩ + exact hlink.left_mem.2 hx_Z + refine ⟨X ∩ V(d.1), hvia.inter_mem hX_mem hX_ne_Z, ?_⟩ + intro v ⟨w, hlink⟩ + exact ⟨hX_inc v ⟨w, hlink.mono hH_le_G'⟩, hlink.left_mem⟩ + · have hZ_finite := hvia.isDesign'.1.subset hvia.subset_vertexSet + have hZ_bound : Z.encard ≤ n := by + rw [← hZ_finite.cast_ncard_eq, Nat.cast_le] + exact hZ_card + refine ⟨Z, htorso.1 ▸ hvia.subset_vertexSet, hZ_bound, hH_le_G', ?_⟩ + have hdelH_le_G' : GM09.deleteVertices H Z ≤ G' := + (H.induce_le sdiff_subset).trans hH_le_G' + refine (Compatible.of_le_le hdel_le_G' hdelH_le_G').ext ?_ ?_ + · change V(G') \ Z = V(d.1) \ Z + exact Subset.antisymm (fun v hv => ⟨hV_sub_d hv, hv.2⟩) + (sdiff_subset_sdiff_left hW_H) + · ext e + simp only [GM09.deleteVertices, Graph.edgeSet_induce] + constructor + · intro he_del + rcases he_del with ⟨x, y, hlink, hx, hy⟩ + have heH : e ∈ E(H) := by + rw [hH_E] + exact Or.inr ⟨x, y, hlink, hx, hy⟩ + exact ⟨x, y, (hH_le_G'.isLink_iff heH).mpr hlink, + ⟨hV_sub_d hx, hx.2⟩, ⟨hV_sub_d hy, hy.2⟩⟩ + · rintro ⟨x, y, hlink, hx, hy⟩ + exact ⟨x, y, hlink.mono hH_le_G', ⟨hW_H hx.1, hx.2⟩, ⟨hW_H hy.1, hy.2⟩⟩ + +/-- **Graph Minors XVI, (2.3)** (page 48): +"For any $\theta \ge 1$, let $\mathscr{D}$ be a class of designs which is $\theta$-pervasive in a +graph $G$. Then $G$ may be constructed by clique-sums starting from graphs $G'$ such that either +* $|V(G')| \le 4\theta - 3$, or +* $G'$ is a $(\le 3\theta - 2)$-vertex extension of a torso of a member of $\mathscr{D}$." + +Note: This theorem is stated with the loose notion `IsLooseVertexExtension` (`G' \ Z = H \ Z` for a +subgraph `H ≤ G'` with `|Z| ≤ 3θ - 2`), because the sentence preceding (2.3) on page 48 ("every +torso of a member of $\mathscr{D}^n$ is a $(\le n)$-vertex extension of a torso of a +member of $\mathscr{D}$") fails with +the strict definition `deleteVertices G' Z = H` when the enlargement set `Z` meets `V(H)`. -/ +theorem theorem_2_3_proof {G : Graph α (β ⊕ ℕ)} {θ : ℕ} {𝒟 : Set (GraphDesign α (β ⊕ ℕ))} + (hV : V(G).Finite) (hE : E(G).Finite) (hθ : 1 ≤ θ) + (hperv : IsGraphPervasive G θ 𝒟) : + HasTreeStructureOver + {G' : Graph α (β ⊕ ℕ) | V(G').encard ≤ (4 * θ - 3 : ℕ) ∨ + ∃ H ∈ torsosOfClass 𝒟, IsLooseVertexExtension (3 * θ - 2) G' H} G := by + obtain ⟨ι, hfin, T, τ, hover⟩ := theorem_2_1_proof hV hE hθ hperv + refine (theorem_2_2_proof hV hE hover).mono ?_ + rintro G' ⟨d', hd'_mem, htorso⟩ + rcases hd'_mem with ⟨d, hd_mem, henl⟩ | ⟨hdesign, hcard⟩ + · right + obtain ⟨H, hH_torso, hext⟩ := + exists_isTorsoOfDesign_isLooseVertexExtension_of_isGraphEnlargement henl htorso + exact ⟨H, ⟨d, hd_mem, hH_torso⟩, hext⟩ + · left + rwa [← htorso.1, ← hdesign.1.cast_ncard_eq, Nat.cast_le] + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section3.lean b/LeanPool/GraphMinor/GM16/Section3.lean new file mode 100644 index 0000000000..aeedbfae6b --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section3.lean @@ -0,0 +1,1267 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +public import LeanPool.GraphMinor.GM16.Section2 +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.Menger.Basic +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Graph Minors XVI, Section 3: Surfaces, Societies, and Segregations + +This file formalizes Section 3 ("Surfaces, societies and segregations", pages 48–52) of +N. Robertson and P. D. Seymour, *Graph Minors. XVI. Excluding a non-planar graph*, J. Combin. +Theory Ser. B 89 (2003) 43–76: + +- Walk and connectedness equivalences between `G : Graph α β` and `(Hypergraph.ofGraph G hV + hE).skeleton`. +- Equivalence between `GM16.ControlsMinor`, `GM12.ControlsMinor`, and `GM15.ControlsCliqueMinor` + for tangles of order `≥ |V(L)|`. +- Derivation of linear decompositions for any given clockwise enumeration `t : Fin n → α` of a + `ρ`-vortex `(G, Ω)` (`exists_isLinearDecomposition_of_isRhoVortex`), following the + Menger/submodularity + argument of Graph Minors IX, (8.1) (pages 60–62) via `GraphMinor.menger`. +- **Graph Minors XVI, (3.2)** (`theorem_3_2 : GM16Theorem32Statement.{u, v}`, pages 50–51), with + its intermediate claims (1), (2), and (3) (`lemma_3_2_claim_1`, `lemma_3_2_claim_2`, + `lemma_3_2_claim_3`). +-/ + +public section + +namespace GraphMinor.GM16 + +open Set Function Graph SimpleGraph Hypergraph +open GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 GraphMinor.GM15 + +universe u v w + +variable {α : Type u} {β : Type v} + +/-! ## Walk and Connectedness Equivalences between `Graph` and `Hypergraph.skeleton` -/ + +/-- If `u ≠ v` and `e` is incident with both `u` and `v` in `G : Graph α β`, then `G.IsLink e u v`. +-/ +theorem isLink_of_inc_of_inc_of_ne {G : Graph α β} {e : β} {u v : α} + (hu : G.Inc e u) (hv : G.Inc e v) (huv : u ≠ v) : G.IsLink e u v := + GM10.isLink_of_inc_of_inc_of_ne hu hv huv + +/-- Reachability under `H.Adj` implies reachability in `(Hypergraph.ofGraph H hVH hEH).skeleton`. -/ +theorem skeleton_reachable_of_reflTransGen_adj {H : Graph α β} + (hVH : V(H).Finite) (hEH : E(H).Finite) {u v : α} + (h : Relation.ReflTransGen H.Adj u v) : + (Hypergraph.ofGraph H hVH hEH).skeleton.Reachable u v := by + induction h with + | refl => exact SimpleGraph.Reachable.refl _ + | @tail b c _ hadj ih => + by_cases hbc : b = c + · subst hbc; exact ih + · rcases hadj with ⟨e, hlink⟩ + have hadj_skel : (Hypergraph.ofGraph H hVH hEH).skeleton.Adj b c := + ⟨hbc, e, ⟨c, hlink⟩, ⟨b, hlink.symm⟩⟩ + exact ih.trans hadj_skel.reachable + +/-- Reachability in `(Hypergraph.ofGraph H hVH hEH).skeleton` implies `Relation.ReflTransGen H.Adj`. +-/ +theorem reflTransGen_adj_of_skeleton_walk {H : Graph α β} + {hVH : V(H).Finite} {hEH : E(H).Finite} {u v : α} + (w : (Hypergraph.ofGraph H hVH hEH).skeleton.Walk u v) : + Relation.ReflTransGen H.Adj u v := + GM10.reflTransGen_adj_of_skeleton_walk w + +/-- Every walk in `(Hypergraph.ofGraph H hVH hEH).skeleton` from `u ∈ V(H)` to `v` lifts to a +`GraphWalk H u v` with the same vertex support. -/ +theorem exists_graphWalk_of_skeleton_walk {H : Graph α β} (hVH : V(H).Finite) (hEH : E(H).Finite) + {u v : α} (hu : u ∈ V(H)) (w : (Hypergraph.ofGraph H hVH hEH).skeleton.Walk u v) : + ∃ W : GraphWalk H u v, W.support = w.support := by + induction w with + | nil => exact ⟨GraphWalk.nil hu, rfl⟩ + | @cons a b c hadj rest ih => + rcases hadj with ⟨hab, e, ha_inc, hb_inc⟩ + have hlink : H.IsLink e a b := isLink_of_inc_of_inc_of_ne ha_inc hb_inc hab + obtain ⟨W_rest, hsupp⟩ := ih hlink.right_mem + refine ⟨GraphWalk.cons hlink W_rest, ?_⟩ + change a :: W_rest.support = a :: rest.support + rw [hsupp] + +private theorem exists_graphWalk_in_sub {G P : Graph α β} {u v : α} (W : GraphWalk G u v) + (hVP : ∀ x ∈ W.support, x ∈ V(P)) + (hlinkP : ∀ {e x y}, e ∈ W.edges → x ∈ W.support → y ∈ W.support → + G.IsLink e x y → P.IsLink e x y) : + ∃ W_P : GraphWalk P u v, W_P.support = W.support ∧ W_P.edges = W.edges := by + induction W with + | @nil a ha => + refine ⟨GraphWalk.nil (hVP a (by simp [GraphWalk.support])), rfl, rfl⟩ + | @cons a b c e hlink rest ih => + have hVP_rest : ∀ x ∈ rest.support, x ∈ V(P) := fun x hx => + hVP x (by simp [GraphWalk.support, hx]) + have hlinkP_rest : ∀ {e' x y}, e' ∈ rest.edges → x ∈ rest.support → y ∈ rest.support → + G.IsLink e' x y → P.IsLink e' x y := fun he' hx hy hl => + hlinkP (by simp [GraphWalk.edges, he']) (by simp [GraphWalk.support, hx]) + (by simp [GraphWalk.support, hy]) hl + obtain ⟨W_rest, hsupp, hedges⟩ := ih hVP_rest hlinkP_rest + have ha_supp : a ∈ (GraphWalk.cons hlink rest).support := by simp [GraphWalk.support] + have hb_supp : b ∈ (GraphWalk.cons hlink rest).support := by + cases rest <;> simp [GraphWalk.support] + have he_edges : e ∈ (GraphWalk.cons hlink rest).edges := by simp [GraphWalk.edges] + have hlink_P : P.IsLink e a b := hlinkP he_edges ha_supp hb_supp hlink + refine ⟨GraphWalk.cons hlink_P W_rest, ?_, ?_⟩ + · simp [GraphWalk.support, hsupp] + · simp [GraphWalk.edges, hedges] + +private theorem graphWalk_support_subset_vertexSet {G : Graph α β} {u v : α} + (W : GraphWalk G u v) : ∀ x ∈ W.support, x ∈ V(G) := by + induction W with + | nil hv => + intro x hx + simp only [GraphWalk.support, List.mem_singleton] at hx + exact hx ▸ hv + | cons hlink _ ih => + intro x hx + simp only [GraphWalk.support, List.mem_cons] at hx + rcases hx with rfl | hx + · exact hlink.left_mem + · exact ih x hx + +private theorem exists_isLink_of_mem_graphWalk_edges {G : Graph α β} {u v : α} + (W : GraphWalk G u v) {e : β} (he : e ∈ W.edges) : + ∃ x y, G.IsLink e x y ∧ x ∈ W.support ∧ y ∈ W.support := by + induction W with + | nil _ => simp [GraphWalk.edges] at he + | @cons a b c e' hlink rest ih => + simp only [GraphWalk.edges, List.mem_cons] at he + rcases he with rfl | he + · refine ⟨a, b, hlink, by simp [GraphWalk.support], ?_⟩ + cases rest <;> simp [GraphWalk.support] + · obtain ⟨x, y, hl, hx, hy⟩ := ih he + exact ⟨x, y, hl, by simp [GraphWalk.support, hx], by simp [GraphWalk.support, hy]⟩ + +/-- Every simple path `w` in `(Hypergraph.ofGraph G hV hE).skeleton` from `a ∈ V(G)` to `b` lifts +to a graph path `P` of `G` with ends `a, b` and `V(P) = {x | x ∈ w.support}`. -/ +theorem exists_isGraphPathWithEnds_of_skeleton_isPath {G : Graph α β} + (hV : V(G).Finite) (hE : E(G).Finite) {a b : α} (ha : a ∈ V(G)) + (w : (Hypergraph.ofGraph G hV hE).skeleton.Walk a b) (hw : w.IsPath) : + ∃ P : Graph α β, IsGraphPathWithEnds G P a b ∧ V(P) = {x | x ∈ w.support} := by + obtain ⟨W, hsupp⟩ := exists_graphWalk_of_skeleton_walk hV hE ha w + let P : Graph α β := (G.induce {x | x ∈ W.support}).restrict {e | e ∈ W.edges} + have hP_le : P ≤ G := restrict_le.trans (G.induce_le (graphWalk_support_subset_vertexSet W)) + obtain ⟨W_P, hsupp_P, hedges_P⟩ := exists_graphWalk_in_sub (P := P) W + (fun x hx => hx) + (fun he hx hy hlink => ⟨he, hlink, hx, hy⟩) + refine ⟨P, ⟨hP_le, W_P, ?_, ?_, ?_⟩, ?_⟩ + · unfold GraphWalk.IsSimple + rw [hsupp_P, hsupp] + exact hw.support_nodup + · change {x | x ∈ W.support} = {x | x ∈ W_P.support} + rw [hsupp_P] + · ext e + simp only [P, edgeSet_restrict, mem_inter_iff, Graph.edgeSet_induce, Set.mem_ofPred_eq, + hedges_P] + exact ⟨fun h => h.2, fun he => ⟨exists_isLink_of_mem_graphWalk_edges W he, he⟩⟩ + · change {x | x ∈ W.support} = {x | x ∈ w.support} + rw [hsupp] + +/-- Equivalence between `GraphConnected H` and `GM12.IsConnectedSub` for a subhypergraph +`H_H ≤ Hypergraph.ofGraph G hV hE`. -/ +theorem graphConnected_subgraphOfSubhypergraph_iff {G : Graph α β} + {hV : V(G).Finite} {hE : E(G).Finite} {H_H : Hypergraph α β} + (hH : H_H ≤ Hypergraph.ofGraph G hV hE) (hne : H_H.vertexSet.Nonempty) : + GraphConnected (subgraphOfSubhypergraph G H_H) ↔ GM12.IsConnectedSub H_H := by + let H := subgraphOfSubhypergraph G H_H + have hVH : V(H).Finite := H_H.vertexSet_finite + have hEH : E(H).Finite := + H_H.edgeSet_finite.subset (by rw [edgeSet_subgraphOfSubhypergraph hH]) + have hof : Hypergraph.ofGraph H hVH hEH = H_H := ofGraph_subgraphOfSubhypergraph hH + constructor + · rintro ⟨_, hconn⟩ u hu v hv + rw [← hof] + exact skeleton_reachable_of_reflTransGen_adj hVH hEH (hconn u hu v hv) + · intro hconn + refine ⟨hne, fun u hu v hv => ?_⟩ + rw [← hof] at hconn + obtain ⟨w⟩ := hconn u hu v hv + exact reflTransGen_adj_of_skeleton_walk w + +/-! ## Equivalence of `GM16.ControlsMinor`, `GM12.ControlsMinor`, and `GM15.ControlsCliqueMinor` -/ + +/-- `GM12.ControlsMinor` implies `GM16.ControlsMinor`. -/ +theorem controlsMinor_of_gm12 {α' β' : Type*} {G : Graph α β} {hV : V(G).Finite} + {hE : E(G).Finite} {θ_star : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {L : Graph α' β'} + (h : GM12.ControlsMinor (Hypergraph.ofGraph G hV hE) θ_star T_star L) : + ControlsMinor G L T_star := by + rcases h with ⟨a, b, ha_conn, ha_disj, hb_link, hb_loop, hb_inj, _, hno_small⟩ + let α_v : α' → Graph α β := fun v => subgraphOfSubhypergraph G (a v) + refine ⟨α_v, b, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro v hv + obtain ⟨hle, hne, hconn⟩ := ha_conn v hv + exact ⟨subgraphOfSubhypergraph_le hle, hne, + (graphConnected_subgraphOfSubhypergraph_iff hle hne).mpr hconn⟩ + · intro u hu v hv huv + exact ha_disj u hu v hv huv + · intro e he u hu v hv huv hlink + obtain ⟨hbe, ⟨x, hx, hinc_x⟩, ⟨y, hy, hinc_y⟩⟩ := hb_link e u v hlink huv + have hxy : x ≠ y := (ha_disj u hu v hv huv).ne_of_mem hx hy + exact ⟨hbe, x, hx, y, hy, isLink_of_inc_of_inc_of_ne hinc_x hinc_y hxy⟩ + · intro e he v hv hloop + obtain ⟨hbe, hnot_mem, hends⟩ := hb_loop e v hloop + have hle : a v ≤ Hypergraph.ofGraph G hV hE := (ha_conn v hv).1 + rw [← edgeSet_subgraphOfSubhypergraph hle] at hnot_mem + obtain ⟨x, y, hlink⟩ := exists_isLink_of_mem_edgeSet hbe + exact ⟨⟨hbe, hnot_mem⟩, x, hends x ⟨y, hlink⟩, y, hends y ⟨x, hlink.symm⟩, hlink⟩ + · intro e he f hf hef + exact by_contra fun hne => hb_inj e he f hf hne hef + · intro A B hAB hord v hv + exact hno_small A B hAB hord v hv + +/-- `GM16.ControlsMinor` implies `GM12.ControlsMinor` when `V(L).ncard ≤ θ_star`. -/ +theorem gm12_controlsMinor_of_controlsMinor {α' β' : Type*} {G : Graph α β} + (hV : V(G).Finite) (hE : E(G).Finite) {θ_star : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} {L : Graph α' β'} + (h : ControlsMinor G L T_star) (hθ : V(L).ncard ≤ θ_star) : + GM12.ControlsMinor (Hypergraph.ofGraph G hV hE) θ_star T_star L := by + classical + rcases h with ⟨α_v, α_e, hα_conn, hα_disj, hα_link, hα_loop, hα_inj, hno_small⟩ + let a : α' → Hypergraph α β := fun v => + if hv : v ∈ V(L) then + Hypergraph.ofGraph (α_v v) (hV.subset (hα_conn v hv).1.vertexSet_mono) + (hE.subset (hα_conn v hv).1.edgeSet_mono) + else ⊥ + have ha_eq : ∀ {v : α'} (hv : v ∈ V(L)), + a v = Hypergraph.ofGraph (α_v v) (hV.subset (hα_conn v hv).1.vertexSet_mono) + (hE.subset (hα_conn v hv).1.edgeSet_mono) := fun hv => dite_eq_left hv + refine ⟨a, α_e, ?_, ?_, ?_, ?_, ?_, hθ, ?_⟩ + · intro v hv + obtain ⟨hle, hne, hconn⟩ := hα_conn v hv + have hle_H : a v ≤ Hypergraph.ofGraph G hV hE := by + rw [ha_eq hv] + exact ⟨hle.vertexSet_mono, hle.edgeSet_mono, fun e he => by + ext x; exact (hle.inc_congr he).symm⟩ + have hsub_eq : subgraphOfSubhypergraph G (a v) = α_v v := by + rw [ha_eq hv] + exact subgraphOfSubhypergraph_ofGraph hle _ _ + have hne_H : (a v).vertexSet.Nonempty := by rw [ha_eq hv]; exact hne + refine ⟨hle_H, hne_H, ?_⟩ + rw [← graphConnected_subgraphOfSubhypergraph_iff hle_H hne_H, hsub_eq] + exact hconn + · intro u hu v hv huv + rw [ha_eq hu, ha_eq hv] + exact hα_disj u hu v hv huv + · intro e u v hlink huv + obtain ⟨hbe, x, hx, y, hy, hlinkG⟩ := + hα_link e hlink.edge_mem u hlink.left_mem v hlink.right_mem huv hlink + rw [ha_eq hlink.left_mem, ha_eq hlink.right_mem] + exact ⟨hbe, ⟨x, hx, y, hlinkG⟩, ⟨y, hy, x, hlinkG.symm⟩⟩ + · intro e v hloop + have hv : v ∈ V(L) := hloop.left_mem + obtain ⟨⟨hbe, hnot_mem⟩, x, hx, y, hy, hlinkG⟩ := hα_loop e hloop.edge_mem v hv hloop + rw [ha_eq hv] + refine ⟨hbe, hnot_mem, fun z hz => ?_⟩ + rcases hz with ⟨w, hzw⟩ + rcases G.eq_or_eq_of_isLink_of_isLink hzw hlinkG with rfl | rfl + · exact hx + · exact hy + · intro e he f hf hne heq + exact hne (hα_inj he hf heq) + · intro A B hAB hord v hv + rw [ha_eq hv] + exact hno_small hAB hord v hv + +/-- Equivalence between `GM16.ControlsMinor` and `GM12.ControlsMinor` when `V(L).ncard ≤ θ_star`. -/ +theorem controlsMinor_iff_gm12 {α' β' : Type*} {G : Graph α β} + (hV : V(G).Finite) (hE : E(G).Finite) {θ_star : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} {L : Graph α' β'} + (hθ : V(L).ncard ≤ θ_star) : + ControlsMinor G L T_star ↔ + GM12.ControlsMinor (Hypergraph.ofGraph G hV hE) θ_star T_star L := + ⟨fun h => gm12_controlsMinor_of_controlsMinor hV hE h hθ, controlsMinor_of_gm12⟩ + +/-- `V(completeGraph p).ncard = p`. -/ +@[simp] +theorem vertexSet_completeGraph_ncard (p : ℕ) : V(completeGraph p).ncard = p := by + change (Set.univ : Set (Fin p)).ncard = p + simp + +/-- `GM16.ControlsMinor G (completeGraph p) T_star` implies `GM15.ControlsCliqueMinor G p T_star`. +-/ +theorem controlsCliqueMinor_of_controlsMinor {G : Graph α β} {p : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + (h : ControlsMinor G (completeGraph p) T_star) : + ControlsCliqueMinor G p T_star := by + rcases h with ⟨α_v, α_e, hconn, hdisj, hlink, _, _, hno_small⟩ + refine ⟨α_v, fun i => hconn i (mem_univ i), + fun i j hij => hdisj i (mem_univ i) j (mem_univ j) hij, + fun i j hij => ?_, + fun A B hAB hord i => hno_small hAB (by simpa using hord) i (mem_univ i)⟩ + have he : s(i, j) ∈ E(completeGraph p) := ⟨i, j, ne_of_lt hij, rfl⟩ + obtain ⟨hb, x, hx, y, hy, hlinkG⟩ := + hlink s(i, j) he i (mem_univ i) j (mem_univ j) (ne_of_lt hij) ⟨ne_of_lt hij, rfl⟩ + exact ⟨α_e s(i, j), hb, x, hx, y, hy, hlinkG⟩ + +/-- `GM12.ControlsMinor` for `completeGraph p` implies `GM15.ControlsCliqueMinor`. -/ +theorem controlsCliqueMinor_of_gm12 {G : Graph α β} + {hV : V(G).Finite} {hE : E(G).Finite} {θ_star p : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + (h : GM12.ControlsMinor (Hypergraph.ofGraph G hV hE) θ_star T_star (completeGraph p)) : + ControlsCliqueMinor G p T_star := + controlsCliqueMinor_of_controlsMinor (controlsMinor_of_gm12 h) + +/-- `GM15.ControlsCliqueMinor G p T_star` implies `GM16.ControlsMinor G (completeGraph p) T_star` +when `p ≠ 1` or `Nonempty β`. -/ +theorem controlsMinor_of_controlsCliqueMinor {G : Graph α β} {p : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + (hp : p ≠ 1 ∨ Nonempty β) (h : ControlsCliqueMinor G p T_star) : + ControlsMinor G (completeGraph p) T_star := by + classical + rcases h with ⟨X_sub, hconn, hdisj, hlink, hno_small⟩ + by_cases hp0 : p = 0 + · subst hp0 + refine ⟨X_sub, isEmptyElim, fun v _ => Fin.elim0 v, fun u _ => Fin.elim0 u, + fun e he => ?_, fun e he => ?_, fun e he => ?_, fun A B _ _ v _ => Fin.elim0 v⟩ + · rcases he with ⟨x, _⟩; exact Fin.elim0 x + · rcases he with ⟨x, _⟩; exact Fin.elim0 x + · rcases he with ⟨x, _⟩; exact Fin.elim0 x + have hβ : Nonempty β := by + rcases hp with hp1 | hβ + · have hp2 : 2 ≤ p := by omega + obtain ⟨b, _, _⟩ := hlink ⟨0, by omega⟩ ⟨1, by omega⟩ (Fin.mk_lt_mk.mpr Nat.zero_lt_one) + exact ⟨b⟩ + · exact hβ + have hex_edge : ∀ e : Sym2 (Fin p), e ∈ E(completeGraph p) → + ∃ b : β, b ∈ E(G) ∧ ∀ u v : Fin p, u ≠ v → e = s(u, v) → + ∃ x ∈ V(X_sub u), ∃ y ∈ V(X_sub v), G.IsLink b x y := by + rintro e ⟨i, j, hij, rfl⟩ + rcases lt_or_gt_of_ne hij with hlt | hgt + · obtain ⟨b, hb, x, hx, y, hy, hlinkG⟩ := hlink i j hlt + refine ⟨b, hb, fun u v _ heq => ?_⟩ + rcases Sym2.eq_iff.mp heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨x, hx, y, hy, hlinkG⟩ + · exact ⟨y, hy, x, hx, hlinkG.symm⟩ + · obtain ⟨b, hb, x, hx, y, hy, hlinkG⟩ := hlink j i hgt + refine ⟨b, hb, fun u v _ heq => ?_⟩ + rcases Sym2.eq_iff.mp heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨y, hy, x, hx, hlinkG.symm⟩ + · exact ⟨x, hx, y, hy, hlinkG⟩ + let α_e : Sym2 (Fin p) → β := fun e => + if he : e ∈ E(completeGraph p) then (hex_edge e he).choose else Classical.choice hβ + refine ⟨X_sub, α_e, fun v _ => hconn v, fun u _ v _ huv => hdisj u v huv, ?_, ?_, ?_, + fun A B hAB hord v _ => hno_small hAB (by simpa using hord) v⟩ + · intro e he u _ v _ huv hlinkL + dsimp only [α_e] + rw [dite_eq_left he] + have hspec := (hex_edge e he).choose_spec + exact ⟨hspec.1, hspec.2 u v huv hlinkL.2⟩ + · intro e _ v _ hloop + exact False.elim (hloop.1 rfl) + · intro e₁ he₁ e₂ he₂ heq + dsimp only [α_e] at heq + rw [dite_eq_left he₁, dite_eq_left he₂] at heq + rcases he₁ with ⟨u₁, v₁, huv₁, rfl⟩ + rcases he₂ with ⟨u₂, v₂, huv₂, rfl⟩ + obtain ⟨x₁, hx₁, y₁, hy₁, hl₁⟩ := + (hex_edge s(u₁, v₁) ⟨u₁, v₁, huv₁, rfl⟩).choose_spec.2 u₁ v₁ huv₁ rfl + obtain ⟨x₂, hx₂, y₂, hy₂, hl₂⟩ := + (hex_edge s(u₂, v₂) ⟨u₂, v₂, huv₂, rfl⟩).choose_spec.2 u₂ v₂ huv₂ rfl + rw [← heq] at hl₂ + have hxy₁ : x₁ ≠ y₁ := fun h => + Set.disjoint_left.mp (hdisj u₁ v₁ huv₁) hx₁ (h ▸ hy₁) + have hx_cases := G.eq_or_eq_of_isLink_of_isLink hl₁ hl₂ + have hy_cases := G.eq_or_eq_of_isLink_of_isLink hl₁.symm hl₂ + rw [Sym2.eq_iff] + rcases hx_cases with rfl | rfl + · have hy_eq : y₁ = y₂ := hy_cases.resolve_left hxy₁.symm + subst hy_eq + left + exact ⟨by_contra fun hne => Set.disjoint_left.mp (hdisj u₁ u₂ hne) hx₁ hx₂, + by_contra fun hne => Set.disjoint_left.mp (hdisj v₁ v₂ hne) hy₁ hy₂⟩ + · have hy_eq : y₁ = x₂ := hy_cases.resolve_right hxy₁.symm + subst hy_eq + right + exact ⟨by_contra fun hne => Set.disjoint_left.mp (hdisj u₁ v₂ hne) hx₁ hy₂, + by_contra fun hne => Set.disjoint_left.mp (hdisj v₁ u₂ hne) hy₁ hx₂⟩ + +/-! ## Linear Decompositions of `ρ`-Vortices and Graph Minors XVI, (3.2) (pages 50–51) -/ + +private lemma toFun_t_eq_of_isClockwiseSeq {S : Society α β} {n : ℕ} {t : Fin n → α} + (hn : 1 ≤ n) (ht_range : range t = S.Ω.bar) (ht_cw : S.Ω.IsClockwiseSeq (List.ofFn t)) + (i : Fin n) : + S.Ω.toFun (t i) = t ⟨(i.1 + 1) % n, Nat.mod_lt _ (by omega)⟩ := by + have hbar : {v | v ∈ List.ofFn t} = S.Ω.bar := by + ext v + simp [List.mem_ofFn, ← ht_range] + have hhit := ht_cw.2.2 i.1 (by simp) + simp only [List.length_ofFn, List.getElem_ofFn, hbar] at hhit + rcases hhit with ⟨k, hk1, hk_eq, _, hk_min⟩ + have hti_bar : t i ∈ S.Ω.bar := ht_range ▸ mem_range_self i + have hnext_bar : S.Ω.toFun (t i) ∈ S.Ω.bar := S.Ω.bijOn.mapsTo hti_bar + have hk_eq_one : k = 1 := by + by_contra hne + have hlt : 1 < k := by omega + exact hk_min 1 le_rfl hlt hnext_bar + subst hk_eq_one + exact hk_eq + +private lemma iterate_toFun_t_eq_of_isClockwiseSeq {S : Society α β} {n : ℕ} {t : Fin n → α} + (hn : 1 ≤ n) (ht_range : range t = S.Ω.bar) (ht_cw : S.Ω.IsClockwiseSeq (List.ofFn t)) + (i : Fin n) (m : ℕ) : + (S.Ω.toFun^[m]) (t i) = t ⟨(i.1 + m) % n, Nat.mod_lt _ (by omega)⟩ := by + induction m with + | zero => + simp only [Function.iterate_zero, id_eq, Nat.add_zero] + congr 1 + ext + exact (Nat.mod_eq_of_lt i.2).symm + | succ m ih => + rw [Function.iterate_succ_apply', ih, toFun_t_eq_of_isClockwiseSeq hn ht_range ht_cw] + congr 1 + ext + dsimp only + rw [Nat.mod_add_mod, Nat.add_assoc] + +private lemma firstHitIn_three_of_lt {S : Society α β} {n : ℕ} {t : Fin n → α} + (hn : 1 ≤ n) (ht_inj : Injective t) (ht_range : range t = S.Ω.bar) + (ht_cw : S.Ω.IsClockwiseSeq (List.ofFn t)) + {a b c : Fin n} (hab : a.1 < b.1) (hbc : b.1 < c.1) + {X : Set α} (hX : ∀ x, x ∈ X ↔ x = t a ∨ x = t b ∨ x = t c) : + S.Ω.FirstHitIn X (t a) (t b) ∧ + S.Ω.FirstHitIn X (t b) (t c) ∧ + S.Ω.FirstHitIn X (t c) (t a) := by + have hiter := iterate_toFun_t_eq_of_isClockwiseSeq hn ht_range ht_cw + refine ⟨?_, ?_, ?_⟩ + · refine ⟨b.1 - a.1, by omega, ?_, (hX (t b)).mpr (Or.inr (Or.inl rfl)), ?_⟩ + · rw [hiter] + congr 1; ext; dsimp only + rw [Nat.add_sub_of_le (le_of_lt hab), Nat.mod_eq_of_lt b.2] + · intro m hm1 hmk hmem + rw [hiter, hX] at hmem + rcases hmem with h | h | h <;> + have hval := congrArg Fin.val (ht_inj h) <;> + dsimp only at hval <;> + rw [Nat.mod_eq_of_lt (by omega)] at hval <;> + omega + · refine ⟨c.1 - b.1, by omega, ?_, (hX (t c)).mpr (Or.inr (Or.inr rfl)), ?_⟩ + · rw [hiter] + congr 1; ext; dsimp only + rw [Nat.add_sub_of_le (le_of_lt hbc), Nat.mod_eq_of_lt c.2] + · intro m hm1 hmk hmem + rw [hiter, hX] at hmem + rcases hmem with h | h | h <;> + have hval := congrArg Fin.val (ht_inj h) <;> + dsimp only at hval <;> + rw [Nat.mod_eq_of_lt (by omega)] at hval <;> + omega + · refine ⟨n - c.1 + a.1, by omega, ?_, (hX (t a)).mpr (Or.inl rfl), ?_⟩ + · rw [hiter] + congr 1; ext; dsimp only + have hsum : c.1 + (n - c.1 + a.1) = n + a.1 := by omega + rw [hsum, Nat.add_mod_left, Nat.mod_eq_of_lt a.2] + · intro m hm1 hmk hmem + rw [hiter, hX] at hmem + by_cases hlt : c.1 + m < n + · rcases hmem with h | h | h <;> + have hval := congrArg Fin.val (ht_inj h) <;> + dsimp only at hval <;> + rw [Nat.mod_eq_of_lt hlt] at hval <;> + omega + · have hmod : (c.1 + m) % n = c.1 + m - n := by + have hge : n ≤ c.1 + m := Nat.le_of_not_lt hlt + have eq_add : c.1 + m = (c.1 + m - n) + n := (Nat.sub_add_cancel hge).symm + conv_lhs => rw [eq_add] + rw [Nat.add_mod_right, Nat.mod_eq_of_lt (by omega)] + rcases hmem with h | h | h <;> + have hval := congrArg Fin.val (ht_inj h) <;> + dsimp only at hval <;> + rw [hmod] at hval <;> + omega + +private lemma isClockwise3_of_lt {S : Society α β} {n : ℕ} {t : Fin n → α} + (hn : 1 ≤ n) (ht_inj : Injective t) (ht_range : range t = S.Ω.bar) + (ht_cw : S.Ω.IsClockwiseSeq (List.ofFn t)) + {a b c : Fin n} (hab : a.1 < b.1) (hbc : b.1 < c.1) : + S.Ω.IsClockwise3 (t a) (t b) (t c) ∧ S.Ω.IsClockwise3 (t b) (t c) (t a) := by + have hne_ab : t a ≠ t b := fun h => by have := congrArg Fin.val (ht_inj h); omega + have hne_bc : t b ≠ t c := fun h => by have := congrArg Fin.val (ht_inj h); omega + have hne_ac : t a ≠ t c := fun h => by have := congrArg Fin.val (ht_inj h); omega + have hbar : ∀ i : Fin n, t i ∈ S.Ω.bar := fun i => ht_range ▸ mem_range_self i + have hX1 : ∀ x, x ∈ {v | v ∈ [t a, t b, t c]} ↔ x = t a ∨ x = t b ∨ x = t c := by + intro x; simp + have hX2 : ∀ x, x ∈ {v | v ∈ [t b, t c, t a]} ↔ x = t a ∨ x = t b ∨ x = t c := by + intro x; simp [or_comm, or_left_comm] + obtain ⟨h1_ab, h1_bc, h1_ca⟩ := + firstHitIn_three_of_lt hn ht_inj ht_range ht_cw hab hbc hX1 + obtain ⟨h2_ab, h2_bc, h2_ca⟩ := + firstHitIn_three_of_lt hn ht_inj ht_range ht_cw hab hbc hX2 + refine ⟨⟨?_, ?_, ?_⟩, ⟨?_, ?_, ?_⟩⟩ + · simp [hne_ab, hne_bc, hne_ac] + · intro v hv + simp only [List.mem_cons, List.not_mem_nil, or_false] at hv + rcases hv with rfl | rfl | rfl <;> exact hbar _ + · intro i hi + match i with + | 0 => exact h1_ab + | 1 => exact h1_bc + | 2 => simpa using h1_ca + · simp [hne_ab.symm, hne_bc, hne_ac.symm] + · intro v hv + simp only [List.mem_cons, List.not_mem_nil, or_false] at hv + rcases hv with rfl | rfl | rfl <;> exact hbar _ + · intro i hi + match i with + | 0 => exact h2_bc + | 1 => exact h2_ca + | 2 => simpa using h2_ab + +private lemma exists_separation_le_rho_of_isRhoVortex {S : Society α β} {ρ n : ℕ} {t : Fin n → α} + (hn : 1 ≤ n) (hvortex : IsRhoVortex S ρ) (ht_inj : Injective t) + (ht_range : range t = S.Ω.bar) (ht_cw : S.Ω.IsClockwiseSeq (List.ofFn t)) + {j : ℕ} (hj1 : 1 ≤ j) (hjn : j < n) : + let G_H := Hypergraph.ofGraph S.G S.finite_V S.finite_E + let A_set := {x : α | ∃ i : Fin n, i.1 < j ∧ t i = x} + let B_set := {x : α | ∃ i : Fin n, j ≤ i.1 ∧ t i = x} + ∃ Y Z : Hypergraph α β, + G_H.IsSeparation Y Z ∧ A_set ⊆ Y.vertexSet ∧ B_set ⊆ Z.vertexSet ∧ + separationOrder Y Z ≤ ρ := by + intro G_H A_set B_set + have hbar : ∀ i : Fin n, t i ∈ S.Ω.bar := fun i => ht_range ▸ mem_range_self i + have hA_sub : A_set ⊆ G_H.vertexSet := by + rintro _ ⟨i, _, rfl⟩ + exact S.bar_subset (hbar i) + have hB_sub : B_set ⊆ G_H.vertexSet := by + rintro _ ⟨i, _, rfl⟩ + exact S.bar_subset (hbar i) + let i₀ : Fin n := ⟨0, by omega⟩ + let ij : Fin n := ⟨j, hjn⟩ + have hA_int : A_set ⊆ S.Ω.interval (t i₀) (t ij) ∪ {t i₀} := by + rintro _ ⟨i, hi, rfl⟩ + by_cases hi0 : i.1 = 0 + · right + exact congrArg t (Fin.ext hi0) + · left + have h0i : i₀.1 < i.1 := Nat.pos_of_ne_zero hi0 + have hij : i.1 < ij.1 := hi + refine ⟨⟨hbar i, ?_⟩, (isClockwise3_of_lt hn ht_inj ht_range ht_cw h0i hij).1⟩ + simp only [mem_insert_iff, mem_singleton_iff, not_or] + exact ⟨fun h => by have := congrArg Fin.val (ht_inj h); omega, + fun h => by have := congrArg Fin.val (ht_inj h); omega⟩ + have hB_int : B_set ⊆ S.Ω.interval (t ij) (t i₀) ∪ {t ij} := by + rintro _ ⟨i, hi, rfl⟩ + by_cases hij_eq : i.1 = j + · right + exact congrArg t (Fin.ext hij_eq) + · left + have h0j : i₀.1 < ij.1 := hj1 + have hji : ij.1 < i.1 := by dsimp [ij]; omega + refine ⟨⟨hbar i, ?_⟩, (isClockwise3_of_lt hn ht_inj ht_range ht_cw h0j hji).2⟩ + simp only [mem_insert_iff, mem_singleton_iff, not_or] + exact ⟨fun h => by have := congrArg Fin.val (ht_inj h); dsimp [ij] at this; omega, + fun h => by have := congrArg Fin.val (ht_inj h); dsimp [i₀] at this; omega⟩ + have hnot_paths : ¬ HasDisjointPaths G_H.skeleton A_set B_set (ρ + 1) := by + rintro ⟨P_skel, hdisj_skel⟩ + have hex_P : ∀ k : Fin (ρ + 1), + ∃ P : Graph α β, + (∃ a ∈ S.Ω.interval (t i₀) (t ij) ∪ {t i₀}, + ∃ b ∈ S.Ω.interval (t ij) (t i₀) ∪ {t ij}, + IsGraphPathWithEnds S.G P a b) ∧ + V(P) = {x | x ∈ (P_skel k).walk.support} := by + intro k + have hfirst_G : (P_skel k).first ∈ V(S.G) := hA_sub (P_skel k).first_mem + obtain ⟨P, hP_path, hVP⟩ := exists_isGraphPathWithEnds_of_skeleton_isPath + S.finite_V S.finite_E hfirst_G (P_skel k).walk (P_skel k).isPath + exact ⟨P, ⟨(P_skel k).first, hA_int (P_skel k).first_mem, + (P_skel k).last, hB_int (P_skel k).last_mem, hP_path⟩, hVP⟩ + choose P hP_ends hVP using hex_P + have hne_0j : t i₀ ≠ t ij := fun h => by + have := congrArg Fin.val (ht_inj h); dsimp [i₀, ij] at this; omega + apply hvortex (t i₀) (hbar i₀) (t ij) (hbar ij) hne_0j + refine ⟨P, fun k₁ k₂ hk => ?_, hP_ends⟩ + dsimp only + rw [hVP k₁, hVP k₂] + exact hdisj_skel hk + have hnot_all : ¬ ∀ Y Z : Hypergraph α β, + G_H.IsSeparation Y Z → A_set ⊆ Y.vertexSet → B_set ⊆ Z.vertexSet → + ρ + 1 ≤ separationOrder Y Z := + fun hall => hnot_paths ((GraphMinor.menger G_H A_set B_set hA_sub hB_sub (ρ + 1)).mp hall) + push Not at hnot_all + rcases hnot_all with ⟨Y, Z, hsep, hAY, hBZ, hlt⟩ + exact ⟨Y, Z, hsep, hAY, hBZ, Nat.lt_succ_iff.mp hlt⟩ + +private lemma submodular_separationOrder (Y₁ Z₁ Y₂ Z₂ : Hypergraph α β) : + separationOrder (Y₁ ∩ Y₂) (Z₁ ∪ Z₂) + separationOrder (Y₁ ∪ Y₂) (Z₁ ∩ Z₂) ≤ + separationOrder Y₁ Z₁ + separationOrder Y₂ Z₂ := by + let U₁ : Set α := (Y₁.vertexSet ∩ Y₂.vertexSet) ∩ (Z₁.vertexSet ∪ Z₂.vertexSet) + let U₂ : Set α := (Y₁.vertexSet ∪ Y₂.vertexSet) ∩ (Z₁.vertexSet ∩ Z₂.vertexSet) + let S₁ : Set α := Y₁.vertexSet ∩ Z₁.vertexSet + let S₂ : Set α := Y₂.vertexSet ∩ Z₂.vertexSet + have hU₁_fin : U₁.Finite := ((Y₁ ∩ Y₂) ∩ (Z₁ ∪ Z₂)).vertexSet_finite + have hU₂_fin : U₂.Finite := ((Y₁ ∪ Y₂) ∩ (Z₁ ∩ Z₂)).vertexSet_finite + have hS₁_fin : S₁.Finite := (Y₁ ∩ Z₁).vertexSet_finite + have hS₂_fin : S₂.Finite := (Y₂ ∩ Z₂).vertexSet_finite + have h_union : U₁ ∪ U₂ ⊆ S₁ ∪ S₂ := by + intro v hv + simp only [U₁, U₂, S₁, S₂, mem_union, mem_inter_iff] at hv ⊢ + tauto + have h_inter : U₁ ∩ U₂ ⊆ S₁ ∩ S₂ := by + intro v hv + simp only [U₁, U₂, S₁, S₂, mem_union, mem_inter_iff] at hv ⊢ + tauto + have h1 := Set.ncard_union_add_ncard_inter U₁ U₂ hU₁_fin hU₂_fin + have h2 := Set.ncard_union_add_ncard_inter S₁ S₂ hS₁_fin hS₂_fin + have hle_u : (U₁ ∪ U₂).ncard ≤ (S₁ ∪ S₂).ncard := + Set.ncard_le_ncard h_union (hS₁_fin.union hS₂_fin) + have hle_i : (U₁ ∩ U₂).ncard ≤ (S₁ ∩ S₂).ncard := + Set.ncard_le_ncard h_inter (hS₁_fin.inter_of_left S₂) + unfold separationOrder + change U₁.ncard + U₂.ncard ≤ S₁.ncard + S₂.ncard + omega + +private lemma bot_le_hypergraph (G_H : Hypergraph α β) : (⊥ : Hypergraph α β) ≤ G_H := + ⟨empty_subset _, empty_subset _, fun _ h => h.elim⟩ + +private lemma isSeparation_bot_self (G_H : Hypergraph α β) : G_H.IsSeparation ⊥ G_H where + left_le := bot_le_hypergraph G_H + right_le := le_rfl + union_eq := Hypergraph.ext (empty_union _) (empty_union _) + (funext fun _ => funext fun _ => by simp [GM10.union_inc, GM10.bot_inc]) + edgeSet_inter_eq := empty_inter _ + +private theorem exists_minimum_separation + {ValidSep : Hypergraph α β → Hypergraph α β → Prop} {ρ : ℕ} + (hExists : ∃ Y Z, ValidSep Y Z ∧ separationOrder Y Z ≤ ρ) : + ∃ (Y Z : Hypergraph α β) (k : ℕ), + ValidSep Y Z ∧ separationOrder Y Z = k ∧ k ≤ ρ ∧ + (∀ Y' Z', ValidSep Y' Z' → k ≤ separationOrder Y' Z') ∧ + (∀ Y' Z', ValidSep Y' Z' → separationOrder Y' Z' = k → + Y.vertexSet.ncard + Y.edgeSet.ncard ≤ Y'.vertexSet.ncard + Y'.edgeSet.ncard) := by + obtain ⟨Y₀, Z₀, hval₀, hord₀⟩ := hExists + let Orders : Set ℕ := {k : ℕ | ∃ Y Z, ValidSep Y Z ∧ separationOrder Y Z = k} + have hOrders_ne : Orders.Nonempty := ⟨separationOrder Y₀ Z₀, Y₀, Z₀, hval₀, rfl⟩ + let k := sInf Orders + obtain ⟨Y₁, Z₁, hval₁, hk₁⟩ := Nat.sInf_mem hOrders_ne + have hk_le_ρ : k ≤ ρ := (Nat.sInf_le (s := Orders) ⟨Y₀, Z₀, hval₀, rfl⟩).trans hord₀ + have hk_min : ∀ Y' Z', ValidSep Y' Z' → k ≤ separationOrder Y' Z' := + fun Y' Z' hval' => Nat.sInf_le ⟨Y', Z', hval', rfl⟩ + let Sizes : Set ℕ := + {m : ℕ | ∃ Y Z, ValidSep Y Z ∧ separationOrder Y Z = k ∧ + Y.vertexSet.ncard + Y.edgeSet.ncard = m} + have hSizes_ne : Sizes.Nonempty := + ⟨Y₁.vertexSet.ncard + Y₁.edgeSet.ncard, Y₁, Z₁, hval₁, hk₁, rfl⟩ + obtain ⟨Y, Z, hval, hk, hmin_size⟩ := Nat.sInf_mem hSizes_ne + refine ⟨Y, Z, k, hval, hk, hk_le_ρ, hk_min, fun Y' Z' hval' hk' => ?_⟩ + rw [hmin_size] + exact Nat.sInf_le ⟨Y', Z', hval', hk', rfl⟩ + +private theorem nested_of_minimum_separations + {G_H Y₁ Y₂ Z₁ Z₂ : Hypergraph α β} {A₁ A₂ B₁ B₂ : Set α} + (hA : A₁ ⊆ A₂) (hB : B₂ ⊆ B₁) : + let ValidSep (A B : Set α) (Y Z : Hypergraph α β) := + G_H.IsSeparation Y Z ∧ A ⊆ Y.vertexSet ∧ B ⊆ Z.vertexSet + let k₁ := separationOrder Y₁ Z₁ + let k₂ := separationOrder Y₂ Z₂ + (hval_i : ValidSep A₁ B₁ Y₁ Z₁) → (hval_j : ValidSep A₂ B₂ Y₂ Z₂) → + (hki_min : ∀ Y Z, ValidSep A₁ B₁ Y Z → k₁ ≤ separationOrder Y Z) → + (hkj_min : ∀ Y Z, ValidSep A₂ B₂ Y Z → k₂ ≤ separationOrder Y Z) → + (hsize_min : ∀ Y Z, ValidSep A₁ B₁ Y Z → separationOrder Y Z = k₁ → + Y₁.vertexSet.ncard + Y₁.edgeSet.ncard ≤ Y.vertexSet.ncard + Y.edgeSet.ncard) → + Y₁ ≤ Y₂ ∧ Z₂ ≤ Z₁ := by + intro ValidSep k₁ k₂ hval_i hval_j hki_min hkj_min hsize_min + have hki_eq : separationOrder Y₁ Z₁ = k₁ := rfl + have hkj_eq : separationOrder Y₂ Z₂ = k₂ := rfl + have hsep_inter_union : G_H.IsSeparation (Y₁ ∩ Y₂) (Z₁ ∪ Z₂) := + (hval_i.1.symm.union_inter hval_j.1.symm).symm + have hval_iu : ValidSep A₁ B₁ (Y₁ ∩ Y₂) (Z₁ ∪ Z₂) := + ⟨hsep_inter_union, subset_inter hval_i.2.1 ((hA).trans hval_j.2.1), + hval_i.2.2.trans subset_union_left⟩ + have hsep_union_inter : G_H.IsSeparation (Y₁ ∪ Y₂) (Z₁ ∩ Z₂) := + hval_i.1.union_inter hval_j.1 + have hval_ui : ValidSep A₂ B₂ (Y₁ ∪ Y₂) (Z₁ ∩ Z₂) := + ⟨hsep_union_inter, hval_j.2.1.trans subset_union_right, + subset_inter ((hB).trans hval_i.2.2) hval_j.2.2⟩ + have hle_ki : k₁ ≤ separationOrder (Y₁ ∩ Y₂) (Z₁ ∪ Z₂) := + hki_min _ _ hval_iu + have hle_kj : k₂ ≤ separationOrder (Y₁ ∪ Y₂) (Z₁ ∩ Z₂) := + hkj_min _ _ hval_ui + have hsubmod := submodular_separationOrder (Y₁) (Z₁) (Y₂) (Z₂) + have hord_iu_eq : separationOrder (Y₁ ∩ Y₂) (Z₁ ∪ Z₂) = k₁ := by + omega + have hsize_le := hsize_min (Y₁ ∩ Y₂) (Z₁ ∪ Z₂) hval_iu hord_iu_eq + have hle_Yi : Y₁ ∩ Y₂ ≤ Y₁ := + GM10.inter_le_left hval_i.1.left_le hval_j.1.left_le + have hV_le : (Y₁ ∩ Y₂).vertexSet.ncard ≤ (Y₁).vertexSet.ncard := + Set.ncard_le_ncard hle_Yi.vertexSet_subset (Y₁).vertexSet_finite + have hE_le : (Y₁ ∩ Y₂).edgeSet.ncard ≤ (Y₁).edgeSet.ncard := + Set.ncard_le_ncard hle_Yi.edgeSet_subset (Y₁).edgeSet_finite + have hYi_inter_eq : Y₁ ∩ Y₂ = Y₁ := + GM10.eq_of_le_of_ncard_eq hle_Yi (by omega) (by omega) + have hYi_le_Yj : Y₁ ≤ Y₂ := by + rw [← hYi_inter_eq] + exact GM10.inter_le_right hval_i.1.left_le hval_j.1.left_le + refine ⟨hYi_le_Yj, ?_⟩ + rw [hYi_inter_eq] at hord_iu_eq + have hsub_inter : (Y₁ ∩ Z₁).vertexSet ⊆ + (Y₁ ∩ (Z₁ ∪ Z₂)).vertexSet := + inter_subset_inter_right _ subset_union_left + have hncard_inter_le : + (Y₁ ∩ (Z₁ ∪ Z₂)).vertexSet.ncard ≤ + (Y₁ ∩ Z₁).vertexSet.ncard := by + change separationOrder (Y₁) (Z₁ ∪ Z₂) ≤ separationOrder (Y₁) (Z₁) + omega + have hinter_eq : (Y₁ ∩ Z₁).vertexSet = + (Y₁ ∩ (Z₁ ∪ Z₂)).vertexSet := + Set.eq_of_subset_of_ncard_le hsub_inter hncard_inter_le + (Y₁ ∩ (Z₁ ∪ Z₂)).vertexSet_finite + rw [GM10.le_iff_of_le hval_j.1.right_le hval_i.1.right_le] + refine ⟨fun v hvZj => ?_, fun e heZj => ?_⟩ + · have hvG : v ∈ G_H.vertexSet := hval_j.1.right_le.vertexSet_subset hvZj + have hv_union : v ∈ (Y₁).vertexSet ∪ (Z₁).vertexSet := + hval_i.1.vertexSet_union.symm ▸ hvG + rcases hv_union with hvYi | hvZi + · have hv_in : v ∈ (Y₁ ∩ (Z₁ ∪ Z₂)).vertexSet := ⟨hvYi, Or.inr hvZj⟩ + rw [← hinter_eq] at hv_in + exact hv_in.2 + · exact hvZi + · have heG : e ∈ G_H.edgeSet := hval_j.1.right_le.edgeSet_subset heZj + have he_union : e ∈ (Y₁).edgeSet ∪ (Z₁).edgeSet := + hval_i.1.edgeSet_union.symm ▸ heG + rcases he_union with heYi | heZi + · have heYj : e ∈ (Y₂).edgeSet := hYi_le_Yj.edgeSet_subset heYi + exact (hval_j.1.notMem_edgeSet_left heZj heYj).elim + · exact heZi + +/-- Every `ρ`-vortex `(G, Ω)` with clockwise enumeration `t : Fin n → α` (`1 ≤ n`) admits a linear +decomposition `X : Fin n → Graph α β` with respect to `t` of depth `≤ ρ` +(following the proof of Graph Minors IX, (8.1), pages 60–62). -/ +theorem exists_isLinearDecomposition_of_isRhoVortex {S : Society α β} {ρ n : ℕ} {t : Fin n → α} + (hn : 1 ≤ n) (hvortex : IsRhoVortex S ρ) (ht_inj : Injective t) + (ht_range : range t = S.Ω.bar) (ht_cw : S.Ω.IsClockwiseSeq (List.ofFn t)) : + ∃ X : Fin n → Graph α β, + S.IsLinearDecomposition t X ∧ + ∀ i i' : Fin n, i < i' → (V(X i) ∩ V(X i')).ncard ≤ ρ := by + classical + let G_H := Hypergraph.ofGraph S.G S.finite_V S.finite_E + let A_set (j : ℕ) : Set α := {x : α | ∃ i : Fin n, i.1 < j ∧ t i = x} + let B_set (j : ℕ) : Set α := {x : α | ∃ i : Fin n, j ≤ i.1 ∧ t i = x} + let ValidSep (j : ℕ) (Y Z : Hypergraph α β) : Prop := + G_H.IsSeparation Y Z ∧ A_set j ⊆ Y.vertexSet ∧ B_set j ⊆ Z.vertexSet + have hA_mono : ∀ {i j : ℕ}, i ≤ j → A_set i ⊆ A_set j := by + rintro i j hij _ ⟨a, ha, rfl⟩ + exact ⟨a, lt_of_lt_of_le ha hij, rfl⟩ + have hB_anti : ∀ {i j : ℕ}, i ≤ j → B_set j ⊆ B_set i := by + rintro i j hij _ ⟨a, ha, rfl⟩ + exact ⟨a, le_trans hij ha, rfl⟩ + have hex_valid_sep : ∀ j : ℕ, ∃ Y₀ Z₀, ValidSep j Y₀ Z₀ ∧ separationOrder Y₀ Z₀ ≤ ρ := by + intro j + by_cases hj0 : j = 0 + · subst hj0 + refine ⟨⊥, G_H, ⟨isSeparation_bot_self G_H, ?_, ?_⟩, ?_⟩ + · rintro _ ⟨i, hi, rfl⟩; omega + · rintro _ ⟨i, _, rfl⟩; exact S.bar_subset (ht_range ▸ mem_range_self i) + · simp [separationOrder, GM10.bot_vertexSet] + · by_cases hjn : j < n + · obtain ⟨Y₀, Z₀, hsep₀, hA₀, hB₀, hord₀⟩ := + exists_separation_le_rho_of_isRhoVortex hn hvortex ht_inj ht_range ht_cw + (Nat.pos_of_ne_zero hj0) hjn + exact ⟨Y₀, Z₀, ⟨hsep₀, hA₀, hB₀⟩, hord₀⟩ + · refine ⟨G_H, ⊥, ⟨(isSeparation_bot_self G_H).symm, ?_, ?_⟩, ?_⟩ + · rintro _ ⟨i, _, rfl⟩; exact S.bar_subset (ht_range ▸ mem_range_self i) + · rintro _ ⟨i, hi, rfl⟩; exact absurd i.2 (not_lt_of_ge (le_trans (by omega) hi)) + · simp [separationOrder, GM10.bot_vertexSet] + choose Y_min Z_min k_min hval_min hk_eq hk_le hk_min hsize_min using (fun j + => exists_minimum_separation (hex_valid_sep j)) + let Y (j : ℕ) : Hypergraph α β := + if j = 0 then ⊥ else if j < n then Y_min j else G_H + let Z (j : ℕ) : Hypergraph α β := + if j = 0 then G_H else if j < n then Z_min j else ⊥ + have hY0 : Y 0 = ⊥ := ite_eq_left rfl + have hZ0 : Z 0 = G_H := ite_eq_left rfl + have hYn : Y n = G_H := by + dsimp [Y]; rw [ite_eq_right (by omega), ite_eq_right (lt_irrefl n)] + have hZn : Z n = ⊥ := by + dsimp [Z]; rw [ite_eq_right (by omega), ite_eq_right (lt_irrefl n)] + have hYZ_mid : ∀ {j : ℕ}, 1 ≤ j → j < n → Y j = Y_min j ∧ Z j = Z_min j := by + intro j hj1 hjn + have hj0 : j ≠ 0 := by omega + dsimp [Y, Z] + rw [ite_eq_right hj0, ite_eq_left hjn, ite_eq_right hj0, ite_eq_left hjn] + exact ⟨rfl, rfl⟩ + have hValid : ∀ j ≤ n, ValidSep j (Y j) (Z j) ∧ separationOrder (Y j) (Z j) ≤ ρ := by + intro j hjn + by_cases hj0 : j = 0 + · subst hj0 + rw [hY0, hZ0] + refine ⟨⟨isSeparation_bot_self G_H, ?_, ?_⟩, ?_⟩ + · rintro _ ⟨i, hi, rfl⟩; omega + · rintro _ ⟨i, _, rfl⟩; exact S.bar_subset (ht_range ▸ mem_range_self i) + · simp [separationOrder, GM10.bot_vertexSet] + · by_cases hlt : j < n + · obtain ⟨hY_eq, hZ_eq⟩ := hYZ_mid (by omega) hlt + rw [hY_eq, hZ_eq] + exact ⟨hval_min j, hk_eq j ▸ hk_le j⟩ + · have hjeq : j = n := by omega + subst hjeq + rw [hYn, hZn] + refine ⟨⟨(isSeparation_bot_self G_H).symm, ?_, ?_⟩, ?_⟩ + · rintro _ ⟨i, _, rfl⟩; exact S.bar_subset (ht_range ▸ mem_range_self i) + · rintro _ ⟨i, hi, rfl⟩; exact absurd i.2 (not_lt_of_ge hi) + · simp [separationOrder, GM10.bot_vertexSet] + have hChain : ∀ {i j : ℕ}, i ≤ j → j ≤ n → Y i ≤ Y j ∧ Z j ≤ Z i := by + intro i j hij hjn + by_cases hi0 : i = 0 + · subst hi0 + rw [hY0, hZ0] + exact ⟨bot_le_hypergraph (Y j), (hValid j hjn).1.1.right_le⟩ + · by_cases hjn_eq : j = n + · subst hjn_eq + rw [hYn, hZn] + exact ⟨(hValid i hij).1.1.left_le, bot_le_hypergraph (Z i)⟩ + · have hi1 : 1 ≤ i := by omega + have hj1 : 1 ≤ j := by omega + have hj_lt : j < n := by omega + have hi_lt : i < n := lt_of_le_of_lt hij hj_lt + obtain ⟨hYi, hZi⟩ := hYZ_mid hi1 hi_lt + obtain ⟨hYj, hZj⟩ := hYZ_mid hj1 hj_lt + rw [hYi, hZi, hYj, hZj] + apply nested_of_minimum_separations (hA_mono hij) (hB_anti hij) (hval_min i) (hval_min j) + · simpa only [hk_eq i] using hk_min i + · simpa only [hk_eq j] using hk_min j + · simpa only [hk_eq i] using hsize_min i + let X_H (i : Fin n) : Hypergraph α β := Y (i.1 + 1) ∩ Z i.1 + have hXH_le : ∀ i : Fin n, X_H i ≤ G_H := fun i => + GM10.inter_le (hValid (i.1 + 1) (by omega)).1.1.left_le + (hValid i.1 (le_of_lt i.2)).1.1.right_le + let X (i : Fin n) : Graph α β := subgraphOfSubhypergraph S.G (X_H i) + have hX_le : ∀ i : Fin n, X i ≤ S.G := fun i => subgraphOfSubhypergraph_le (hXH_le i) + refine ⟨X, ⟨ht_inj, ht_range, ht_cw, hX_le, ?_, ?_, ?_, ?_⟩, ?_⟩ + · have hV_eq : (⋃ P ∈ range X, V(P)) = V(S.G) := by + ext v + simp only [mem_iUnion, mem_range, exists_prop] + constructor + · rintro ⟨_, ⟨i, rfl⟩, hv⟩ + exact (hX_le i).vertexSet_mono hv + · intro hv + have hex_k : ∃ k : ℕ, k ≤ n ∧ v ∈ (Y k).vertexSet := + ⟨n, le_rfl, by rw [hYn]; exact hv⟩ + let k := Nat.find hex_k + have hk_spec : k ≤ n ∧ v ∈ (Y k).vertexSet := Nat.find_spec hex_k + have hk_pos : 1 ≤ k := by + by_contra h0 + have hk0 : k = 0 := by omega + have hv0 : v ∈ (Y 0).vertexSet := hk0 ▸ hk_spec.2 + rw [hY0] at hv0 + exact hv0 + have hnot_prev : ¬ (k - 1 ≤ n ∧ v ∈ (Y (k - 1)).vertexSet) := + Nat.find_min hex_k (by omega) + have hv_not_Y : v ∉ (Y (k - 1)).vertexSet := fun h => hnot_prev ⟨by omega, h⟩ + have hv_union : v ∈ (Y (k - 1)).vertexSet ∪ (Z (k - 1)).vertexSet := + (hValid (k - 1) (by omega)).1.1.vertexSet_union.symm ▸ hv + have hv_Z : v ∈ (Z (k - 1)).vertexSet := hv_union.resolve_left hv_not_Y + have hk_lt : k - 1 < n := by omega + refine ⟨X ⟨k - 1, hk_lt⟩, ⟨⟨k - 1, hk_lt⟩, rfl⟩, ?_⟩ + change v ∈ (Y (k - 1 + 1)).vertexSet ∧ v ∈ (Z (k - 1)).vertexSet + rw [Nat.sub_add_cancel hk_pos] + exact ⟨hk_spec.2, hv_Z⟩ + have hE_eq : (⋃ P ∈ range X, E(P)) = E(S.G) := by + ext e + simp only [mem_iUnion, mem_range, exists_prop] + constructor + · rintro ⟨_, ⟨i, rfl⟩, he⟩ + exact (hX_le i).edgeSet_mono he + · intro he + have hex_k : ∃ k : ℕ, k ≤ n ∧ e ∈ (Y k).edgeSet := + ⟨n, le_rfl, by rw [hYn]; exact he⟩ + let k := Nat.find hex_k + have hk_spec : k ≤ n ∧ e ∈ (Y k).edgeSet := Nat.find_spec hex_k + have hk_pos : 1 ≤ k := by + by_contra h0 + have hk0 : k = 0 := by omega + have he0 : e ∈ (Y 0).edgeSet := hk0 ▸ hk_spec.2 + rw [hY0] at he0 + exact he0 + have hnot_prev : ¬ (k - 1 ≤ n ∧ e ∈ (Y (k - 1)).edgeSet) := + Nat.find_min hex_k (by omega) + have he_not_Y : e ∉ (Y (k - 1)).edgeSet := fun h => hnot_prev ⟨by omega, h⟩ + have he_union : e ∈ (Y (k - 1)).edgeSet ∪ (Z (k - 1)).edgeSet := + (hValid (k - 1) (by omega)).1.1.edgeSet_union.symm ▸ he + have he_Z : e ∈ (Z (k - 1)).edgeSet := he_union.resolve_left he_not_Y + have hk_lt : k - 1 < n := by omega + refine ⟨X ⟨k - 1, hk_lt⟩, ⟨⟨k - 1, hk_lt⟩, rfl⟩, ?_⟩ + rw [edgeSet_subgraphOfSubhypergraph (hXH_le ⟨k - 1, hk_lt⟩)] + change e ∈ (Y (k - 1 + 1)).edgeSet ∧ e ∈ (Z (k - 1)).edgeSet + rw [Nat.sub_add_cancel hk_pos] + exact ⟨hk_spec.2, he_Z⟩ + have hU_le : subgraphSUnion S.G (range X) ≤ S.G := + restrict_le.trans (S.G.induce_le (by rw [hV_eq])) + refine (Compatible.of_le_le hU_le le_rfl).ext ?_ ?_ + · simpa [subgraphSUnion] using hV_eq + · ext e + simp only [subgraphSUnion, edgeSet_restrict, mem_inter_iff, Graph.edgeSet_induce, hV_eq, + hE_eq] + refine ⟨fun h => h.2, fun he => ⟨?_, he⟩⟩ + obtain ⟨x, y, hlink⟩ := exists_isLink_of_mem_edgeSet he + exact ⟨x, y, hlink, hlink.left_mem, hlink.right_mem⟩ + · intro i i' hii' + rw [edgeSet_subgraphOfSubhypergraph (hXH_le i), + edgeSet_subgraphOfSubhypergraph (hXH_le i'), Set.disjoint_left] + rintro e ⟨heY, _⟩ ⟨_, heZ⟩ + have hZ_le : Z i'.1 ≤ Z (i.1 + 1) := (hChain (by omega) (le_of_lt i'.2)).2 + have heZ' : e ∈ (Z (i.1 + 1)).edgeSet := hZ_le.edgeSet_subset heZ + exact (hValid (i.1 + 1) (by omega)).1.1.notMem_edgeSet_right heY heZ' + · intro i + exact ⟨(hValid (i.1 + 1) (by omega)).1.2.1 ⟨i, Nat.lt_succ_self i.1, rfl⟩, + (hValid i.1 (le_of_lt i.2)).1.2.2 ⟨i, le_rfl, rfl⟩⟩ + · intro i i' i'' hii' hi'i'' + have hY_le : Y (i.1 + 1) ≤ Y (i'.1 + 1) := + (hChain (Nat.add_le_add_right hii' 1) (by omega)).1 + have hZ_le : Z i''.1 ≤ Z i'.1 := + (hChain hi'i'' (le_of_lt i''.2)).2 + have hV_sub : V(X i) ∩ V(X i'') ⊆ V(X i') := by + rintro v ⟨⟨hvY, _⟩, ⟨_, hvZ⟩⟩ + exact ⟨hY_le.vertexSet_subset hvY, hZ_le.vertexSet_subset hvZ⟩ + have hE_sub : E(X i) ∩ E(X i'') ⊆ E(X i') := by + rw [edgeSet_subgraphOfSubhypergraph (hXH_le i), + edgeSet_subgraphOfSubhypergraph (hXH_le i''), + edgeSet_subgraphOfSubhypergraph (hXH_le i')] + rintro e ⟨⟨heY, _⟩, ⟨_, heZ⟩⟩ + exact ⟨hY_le.edgeSet_subset heY, hZ_le.edgeSet_subset heZ⟩ + have hinter_le : subgraphInter S.G (X i) (X i'') ≤ S.G := + restrict_le.trans (S.G.induce_le (inter_subset_left.trans (hX_le i).vertexSet_mono)) + rw [(Compatible.of_le_le hinter_le (hX_le i')).le_iff] + refine ⟨hV_sub, ?_⟩ + exact (edgeSet_restrict _ _).trans_subset (inter_subset_right.trans hE_sub) + · intro i i' hii' + have hZ_le : Z i'.1 ≤ Z (i.1 + 1) := (hChain (by omega) (le_of_lt i'.2)).2 + have hsub : V(X i) ∩ V(X i') ⊆ (Y (i.1 + 1) ∩ Z (i.1 + 1)).vertexSet := by + rintro v ⟨⟨hvY, _⟩, ⟨_, hvZ⟩⟩ + exact ⟨hvY, hZ_le.vertexSet_subset hvZ⟩ + exact (Set.ncard_le_ncard hsub (Y (i.1 + 1) ∩ Z (i.1 + 1)).vertexSet_finite).trans + (hValid (i.1 + 1) (by omega)).2 + +/-- `V(A_{i-1} ∩ A_i)` in the proof of Graph Minors XVI, (3.2) (page 50), with `A_0` null. -/ +def vortexPrevInter {n : ℕ} (A : Fin n → Graph α β) (i : Fin n) : Set α := + if h : 0 < i.1 then V(A ⟨i.1 - 1, by omega⟩) ∩ V(A i) else ∅ + +/-- `V(A_i ∩ A_{i+1})` in the proof of Graph Minors XVI, (3.2) (page 50), with `A_{n+1}` null. -/ +def vortexNextInter {n : ℕ} (A : Fin n → Graph α β) (i : Fin n) : Set α := + if h : i.1 + 1 < n then V(A i) ∩ V(A ⟨i.1 + 1, h⟩) else ∅ + +/-- The separator `V(A_{i-1} ∩ A_i) ∪ V(A_i ∩ A_{i+1}) ∪ {t_i}` in the proof of Graph Minors XVI, +(3.2) (page 50). -/ +def vortexSepSet {n : ℕ} (t : Fin n → α) (A : Fin n → Graph α β) (i : Fin n) : Set α := + vortexPrevInter A i ∪ vortexNextInter A i ∪ {t i} + +/-- The subgraph `B_i` in the proof of Graph Minors XVI, (3.2) (page 50). -/ +def vortexRightSubgraph (G : Graph α β) {n : ℕ} (t : Fin n → α) (A : Fin n → Graph α β) + (i : Fin n) : Graph α β := + (G.induce ((V(G) \ V(A i)) ∪ vortexSepSet t A i)).restrict (E(G) \ E(A i)) + +private lemma vortexSepSet_subset_A {S : Society α β} {n : ℕ} {t : Fin n → α} + {A : Fin n → Graph α β} (hLD : S.IsLinearDecomposition t A) (i : Fin n) : + vortexSepSet t A i ⊆ V(A i) := by + refine union_subset (union_subset ?_ ?_) (singleton_subset_iff.mpr (hLD.mem_vertexSet i)) + · unfold vortexPrevInter + split_ifs with h + · exact inter_subset_right + · exact empty_subset _ + · unfold vortexNextInter + split_ifs with h + · exact inter_subset_left + · exact empty_subset _ + +private lemma inter_subset_vortexSepSet {S : Society α β} {n : ℕ} {t : Fin n → α} + {A : Fin n → Graph α β} (hLD : S.IsLinearDecomposition t A) {i j : Fin n} (hij : i ≠ j) : + V(A i) ∩ V(A j) ⊆ vortexSepSet t A i := by + intro v ⟨hvi, hvj⟩ + rcases lt_or_gt_of_ne hij with hlt | hgt + · left; right + unfold vortexNextInter + have hnext : i.1 + 1 < n := by omega + rw [dite_eq_left hnext] + have hle1 : i ≤ ⟨i.1 + 1, hnext⟩ := Fin.mk_le_mk.mpr (by omega) + have hle2 : (⟨i.1 + 1, hnext⟩ : Fin n) ≤ j := Fin.mk_le_mk.mpr (by omega) + have hv_mid : v ∈ V(A ⟨i.1 + 1, hnext⟩) := + (hLD.inter_le i ⟨i.1 + 1, hnext⟩ j hle1 hle2).vertexSet_mono ⟨hvi, hvj⟩ + exact ⟨hvi, hv_mid⟩ + · left; left + unfold vortexPrevInter + have hprev : 0 < i.1 := by omega + rw [dite_eq_left hprev] + have hle1 : j ≤ ⟨i.1 - 1, by omega⟩ := Fin.mk_le_mk.mpr (by omega) + have hle2 : (⟨i.1 - 1, by omega⟩ : Fin n) ≤ i := Fin.mk_le_mk.mpr (by omega) + have hv_mid : v ∈ V(A ⟨i.1 - 1, by omega⟩) := + (hLD.inter_le j ⟨i.1 - 1, by omega⟩ i hle1 hle2).vertexSet_mono ⟨hvj, hvi⟩ + exact ⟨hv_mid, hvi⟩ + +private lemma isGraphSeparation_vortexRightSubgraph {S : Society α β} {n : ℕ} {t : Fin n → α} + {A : Fin n → Graph α β} (hLD : S.IsLinearDecomposition t A) (i : Fin n) : + IsGraphSeparation S.G (A i) (vortexRightSubgraph S.G t A i) ∧ + V(A i) ∩ V(vortexRightSubgraph S.G t A i) = vortexSepSet t A i ∧ + E(vortexRightSubgraph S.G t A i) = E(S.G) \ E(A i) := by + let B_i := vortexRightSubgraph S.G t A i + have hsep_sub_A : vortexSepSet t A i ⊆ V(A i) := vortexSepSet_subset_A hLD i + have hAi_sub_G : V(A i) ⊆ V(S.G) := (hLD.le_G i).vertexSet_mono + have hVB_sub_G : (V(S.G) \ V(A i)) ∪ vortexSepSet t A i ⊆ V(S.G) := + union_subset sdiff_subset (hsep_sub_A.trans hAi_sub_G) + have hBi_le : B_i ≤ S.G := restrict_le.trans (S.G.induce_le hVB_sub_G) + have hV_inter : V(A i) ∩ V(B_i) = vortexSepSet t A i := by + ext v + simp only [B_i, vortexRightSubgraph, vertexSet_restrict, vertexSet_induce, mem_inter_iff, + mem_union, mem_sdiff] + exact ⟨fun ⟨hvA, h⟩ => h.elim (fun ⟨_, hnot⟩ => (hnot hvA).elim) id, + fun hvS => ⟨hsep_sub_A hvS, Or.inr hvS⟩⟩ + have hV_union : V(A i) ∪ V(B_i) = V(S.G) := by + ext v + simp only [B_i, vortexRightSubgraph, vertexSet_restrict, vertexSet_induce, mem_union, mem_sdiff] + constructor + · rintro (hvA | (⟨hvG, _⟩ | hvS)) + · exact hAi_sub_G hvA + · exact hvG + · exact hAi_sub_G (hsep_sub_A hvS) + · intro hvG + by_cases hvA : v ∈ V(A i) + · exact Or.inl hvA + · exact Or.inr (Or.inl ⟨hvG, hvA⟩) + have hE_Bi : E(B_i) = E(S.G) \ E(A i) := by + ext e + simp only [B_i, vortexRightSubgraph, edgeSet_restrict, mem_inter_iff, Graph.edgeSet_induce] + refine ⟨fun h => h.2, fun ⟨heG, he_not_Ai⟩ => ⟨?_, heG, he_not_Ai⟩⟩ + have he_union : e ∈ E(subgraphSUnion S.G (range A)) := hLD.union_eq.symm ▸ heG + simp only [subgraphSUnion, edgeSet_restrict, mem_inter_iff, mem_iUnion, mem_range, + exists_prop] at he_union + obtain ⟨_, ⟨j, rfl⟩, heAj⟩ := he_union.2 + have hij : i ≠ j := fun h => he_not_Ai (h ▸ heAj) + obtain ⟨x, y, hlink⟩ := exists_isLink_of_mem_edgeSet heG + have hlink_j : (A j).IsLink e x y := ((hLD.le_G j).isLink_iff heAj).mpr hlink + have hx_Bi : x ∈ (V(S.G) \ V(A i)) ∪ vortexSepSet t A i := by + by_cases hxA : x ∈ V(A i) + · exact Or.inr (inter_subset_vortexSepSet hLD hij ⟨hxA, hlink_j.left_mem⟩) + · exact Or.inl ⟨hlink.left_mem, hxA⟩ + have hy_Bi : y ∈ (V(S.G) \ V(A i)) ∪ vortexSepSet t A i := by + by_cases hyA : y ∈ V(A i) + · exact Or.inr (inter_subset_vortexSepSet hLD hij ⟨hyA, hlink_j.right_mem⟩) + · exact Or.inl ⟨hlink.right_mem, hyA⟩ + exact ⟨x, y, hlink, hx_Bi, hy_Bi⟩ + have hE_union : E(A i) ∪ E(B_i) = E(S.G) := by + rw [hE_Bi] + ext e + exact ⟨fun h => h.elim (fun he => (hLD.le_G i).edgeSet_mono he) (fun he => he.1), + fun he => by by_cases h : e ∈ E(A i) <;> [exact Or.inl h; exact Or.inr ⟨he, h⟩]⟩ + have hE_disj : Disjoint E(A i) E(B_i) := by + rw [hE_Bi] + exact disjoint_sdiff_self_right + exact ⟨⟨hLD.le_G i, hBi_le, hV_union, hE_union, hE_disj⟩, hV_inter, hE_Bi⟩ + +/-- Claim (1) in the proof of Graph Minors XVI, (3.2) (page 50): +"(1) $A_i \subseteq B_j$ for $1 \le i, j \le n$ with $i \ne j$." -/ +theorem lemma_3_2_claim_1 {S : Society α β} {n : ℕ} {t : Fin n → α} + {A : Fin n → Graph α β} (hLD : S.IsLinearDecomposition t A) + {i j : Fin n} (hij : i ≠ j) : + A i ≤ vortexRightSubgraph S.G t A j := by + obtain ⟨hsep_j, _, hEB_j⟩ := isGraphSeparation_vortexRightSubgraph hLD j + rw [(Compatible.of_le_le (hLD.le_G i) hsep_j.2.1).le_iff] + refine ⟨fun v hvAi => ?_, fun e heAi => ?_⟩ + · by_cases hvAj : v ∈ V(A j) + · exact Or.inr (inter_subset_vortexSepSet hLD hij.symm ⟨hvAj, hvAi⟩) + · exact Or.inl ⟨(hLD.le_G i).vertexSet_mono hvAi, hvAj⟩ + · rw [hEB_j] + refine ⟨(hLD.le_G i).edgeSet_mono heAi, ?_⟩ + rcases lt_or_gt_of_ne hij with hlt | hgt + · exact Set.disjoint_left.mp (hLD.edge_disjoint i j hlt) heAi + · exact Set.disjoint_right.mp (hLD.edge_disjoint j i hgt) heAi + +/-- Claim (2) in the proof of Graph Minors XVI, (3.2) (page 50): +"(2) $t_i \in V(B_j)$ for $1 \le i, j \le n$." -/ +theorem lemma_3_2_claim_2 {S : Society α β} {n : ℕ} {t : Fin n → α} + {A : Fin n → Graph α β} (hLD : S.IsLinearDecomposition t A) + (i j : Fin n) : + t i ∈ V(vortexRightSubgraph S.G t A j) := by + by_cases hij : i = j + · subst hij + exact Or.inr (Or.inr (mem_singleton (t i))) + · exact (lemma_3_2_claim_1 hLD hij).vertexSet_mono (hLD.mem_vertexSet i) + +/-- Claim (3) in the proof of Graph Minors XVI, (3.2) (pages 50–51): +"(3) $X_i \cap X_k \subseteq X_j$ for $1 \le i \le j \le k \le n$." -/ +theorem lemma_3_2_claim_3 {S : Society α β} {n : ℕ} {t : Fin n → α} + {A : Fin n → Graph α β} (hLD : S.IsLinearDecomposition t A) + {i j k : Fin n} (hij : i ≤ j) (hjk : j ≤ k) : + (V(A i) ∩ V(vortexRightSubgraph S.G t A i)) ∩ + (V(A k) ∩ V(vortexRightSubgraph S.G t A k)) ⊆ + V(A j) ∩ V(vortexRightSubgraph S.G t A j) := by + rintro v ⟨⟨hvAi, hvBi⟩, ⟨hvAk, _⟩⟩ + by_cases hji : j = i + · subst hji + exact ⟨hvAi, hvBi⟩ + · have hij_ne : i ≠ j := Ne.symm hji + have hvAj : v ∈ V(A j) := (hLD.inter_le i j k hij hjk).vertexSet_mono ⟨hvAi, hvAk⟩ + have hvBj : v ∈ V(vortexRightSubgraph S.G t A j) := + (lemma_3_2_claim_1 hLD hij_ne).vertexSet_mono hvAi + exact ⟨hvAj, hvBj⟩ + +/-- **Graph Minors XVI, (3.2)** (page 50): +"Let $(G, \Omega)$ be a $\rho$-vortex, and let the vertices in $\bar{\Omega}$ be $t_1, \ldots, t_n$ +in order, where $n \ge 1$. Then there are separations $(A_1, B_1), \ldots, (A_n, B_n)$ of $G$, such +that: +1. $t_1, \ldots, t_n \in V(B_i)$ for $1 \le i \le n$, +2. $t_i \in V(A_i)$ for $1 \le i \le n$, +3. $\mathscr{L} = \{(A_1, B_1), \ldots, (A_n, B_n)\}$ is a location in $G$, +4. $(A_i, B_i)$ has order $\le 2\rho + 1$ for $1 \le i \le n$, and +5. every torso of the design of $\mathscr{L}$ is a $(2\rho + 1)$-ring with perimeter +$t_1, \ldots, t_n$." -/ +theorem theorem_3_2_with_edge_cover : + ∀ {α : Type u} {β : Type v} (S : Society α β) (ρ n : ℕ) (t : Fin n → α), + 1 ≤ n → IsRhoVortex S ρ → + Injective t → range t = S.Ω.bar → S.Ω.IsClockwiseSeq (List.ofFn t) → + ∃ A B : Fin n → Graph α β, + (∀ i : Fin n, IsGraphSeparation S.G (A i) (B i)) ∧ + (∀ i j : Fin n, t j ∈ V(B i)) ∧ + (∀ i : Fin n, t i ∈ V(A i)) ∧ + IsGraphLocation S.G (range fun i : Fin n => (A i, B i)) ∧ + (∀ i : Fin n, (V(A i) ∩ V(B i)).ncard ≤ 2 * ρ + 1) ∧ + (∀ x ∈ V(S.G), ∃ i, x ∈ V(A i)) ∧ + (∀ e ∈ E(S.G), ∃ i, e ∈ E(A i)) ∧ + (∀ H' : Graph α β, + IsTorsoOfDesign (graphLocationDesign S.G (range fun i : Fin n => (A i, B i))) H' → + IsRRing H' (2 * ρ + 1) (List.ofFn t)) := by + intro α β S ρ n t hn hvortex ht_inj ht_range ht_cw + obtain ⟨A, hLD, hdepth⟩ := + exists_isLinearDecomposition_of_isRhoVortex hn hvortex ht_inj ht_range ht_cw + let B : Fin n → Graph α β := vortexRightSubgraph S.G t A + have hsep_B : ∀ i : Fin n, + IsGraphSeparation S.G (A i) (B i) ∧ + V(A i) ∩ V(B i) = vortexSepSet t A i ∧ + E(B i) = E(S.G) \ E(A i) := + isGraphSeparation_vortexRightSubgraph hLD + have hord_le : ∀ i : Fin n, (V(A i) ∩ V(B i)).ncard ≤ 2 * ρ + 1 := by + intro i + rw [(hsep_B i).2.1] + unfold vortexSepSet + have hprev_fin : (vortexPrevInter A i).Finite := by + unfold vortexPrevInter + split_ifs with h + · exact S.finite_V.subset (inter_subset_right.trans (hLD.le_G i).vertexSet_mono) + · exact finite_empty + have hnext_fin : (vortexNextInter A i).Finite := by + unfold vortexNextInter + split_ifs with h + · exact S.finite_V.subset (inter_subset_left.trans (hLD.le_G i).vertexSet_mono) + · exact finite_empty + have hprev_le : (vortexPrevInter A i).ncard ≤ ρ := by + unfold vortexPrevInter + split_ifs with h + · exact hdepth ⟨i.1 - 1, by omega⟩ i (Fin.mk_lt_mk.mpr (by omega)) + · simp + have hnext_le : (vortexNextInter A i).ncard ≤ ρ := by + unfold vortexNextInter + split_ifs with h + · exact hdepth i ⟨i.1 + 1, h⟩ (Fin.mk_lt_mk.mpr (by omega)) + · simp + have h1 := Set.ncard_union_le (vortexPrevInter A i ∪ vortexNextInter A i) {t i} + have h2 := Set.ncard_union_le (vortexPrevInter A i) (vortexNextInter A i) + have h3 : ({t i} : Set α).ncard = 1 := Set.ncard_singleton (t i) + omega + have hloc : IsGraphLocation S.G (range fun i : Fin n => (A i, B i)) := by + refine ⟨finite_range _, ?_, ?_⟩ + · rintro _ ⟨i, rfl⟩ + exact (hsep_B i).1 + · rintro _ ⟨i, rfl⟩ _ ⟨j, rfl⟩ hne + have hij : i ≠ j := fun h => hne (congrArg (fun k => (A k, B k)) h) + exact lemma_3_2_claim_1 hLD hij + have hVertexCover : ∀ x ∈ V(S.G), ∃ i, x ∈ V(A i) := by + intro x hx + have hxUnion : x ∈ V(subgraphSUnion S.G (range A)) := hLD.union_eq.symm ▸ hx + obtain ⟨_, ⟨i, rfl⟩, hxi⟩ := mem_iUnion₂.mp hxUnion + exact ⟨i, hxi⟩ + have hCover : ∀ e ∈ E(S.G), ∃ i, e ∈ E(A i) := by + intro e he + have heUnion : e ∈ E(subgraphSUnion S.G (range A)) := hLD.union_eq.symm ▸ he + rw [edgeSet_subgraphSUnion (by rintro _ ⟨i, rfl⟩; exact hLD.le_G i)] at heUnion + obtain ⟨_, ⟨i, rfl⟩, hei⟩ := mem_iUnion₂.mp heUnion + exact ⟨i, hei⟩ + refine ⟨A, B, fun i => (hsep_B i).1, fun i j => lemma_3_2_claim_2 hLD j i, + hLD.mem_vertexSet, hloc, hord_le, hVertexCover, hCover, ?_⟩ + intro H' htorso + let ℒ := range fun i : Fin n => (A i, B i) + have hcore_V : V(graphLocationCore S.G ℒ) = ⋃ i : Fin n, (V(A i) ∩ V(B i)) := by + ext v + simp only [graphLocationCore, ℒ, vertexSet_restrict, vertexSet_induce, Set.mem_ofPred_eq, + mem_range, forall_exists_index, forall_apply_eq_imp_iff, mem_iUnion, mem_inter_iff] + constructor + · rintro ⟨hvG, hall⟩ + have hv_union : v ∈ V(subgraphSUnion S.G (range A)) := hLD.union_eq.symm ▸ hvG + simp only [subgraphSUnion, vertexSet_restrict, vertexSet_induce, mem_iUnion, mem_range, + exists_prop] at hv_union + obtain ⟨_, ⟨i, rfl⟩, hvAi⟩ := hv_union + exact ⟨i, hvAi, hall i⟩ + · rintro ⟨i, hvAi, hvBi⟩ + refine ⟨(hLD.le_G i).vertexSet_mono hvAi, fun j => ?_⟩ + by_cases hij : i = j + · exact hij ▸ hvBi + · exact (lemma_3_2_claim_1 hLD hij).vertexSet_mono hvAi + have hcore_E : E(graphLocationCore S.G ℒ) = ∅ := by + ext e + simp only [graphLocationCore, ℒ, edgeSet_restrict, mem_inter_iff, Graph.edgeSet_induce, + Set.mem_ofPred_eq, mem_range, forall_exists_index, forall_apply_eq_imp_iff, + mem_empty_iff_false, iff_false] + rintro ⟨_, heG, hall⟩ + have he_union : e ∈ E(subgraphSUnion S.G (range A)) := hLD.union_eq.symm ▸ heG + simp only [subgraphSUnion, edgeSet_restrict, mem_inter_iff, mem_iUnion, mem_range, + exists_prop] at he_union + obtain ⟨_, ⟨i, rfl⟩, heAi⟩ := he_union.2 + have heBi : e ∈ E(B i) := hall i + rw [(hsep_B i).2.2] at heBi + exact heBi.2 heAi + have hVH' : V(H') = ⋃ i : Fin n, (V(A i) ∩ V(B i)) := htorso.1.symm.trans hcore_V + let castFin (i : Fin (List.ofFn t).length) : Fin n := i.cast (List.length_ofFn) + let X_ring (i : Fin (List.ofFn t).length) : Set α := + V(A (castFin i)) ∩ V(B (castFin i)) + refine ⟨ht_cw.1, ?_, X_ring, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro x hx + rw [List.mem_ofFn] at hx + rcases hx with ⟨i, rfl⟩ + rw [hVH', mem_iUnion] + exact ⟨i, hLD.mem_vertexSet i, lemma_3_2_claim_2 hLD i i⟩ + · intro i + rw [hVH'] + exact subset_iUnion (fun k : Fin n => V(A k) ∩ V(B k)) (castFin i) + · rw [hVH'] + ext v + simp only [mem_iUnion, X_ring, castFin] + exact ⟨fun ⟨i, hv⟩ => ⟨i.cast (List.length_ofFn), hv⟩, + fun ⟨k, hv⟩ => ⟨k.cast (List.length_ofFn).symm, hv⟩⟩ + · intro e heH' + have he_diff : e ∈ E(H') \ E(graphLocationCore S.G ℒ) := by + rw [hcore_E] + exact ⟨heH', notMem_empty e⟩ + obtain ⟨X, hX_mem, hends⟩ := htorso.2.2 e he_diff + simp only [graphLocationDesign, mem_image, mem_range, exists_exists_eq_and] at hX_mem + rcases hX_mem with ⟨k, rfl⟩ + refine ⟨k.cast (List.length_ofFn).symm, fun v hv => ?_⟩ + simpa [X_ring, castFin] using hends v hv + · intro i + simp only [List.getElem_ofFn, X_ring, castFin] + exact ⟨hLD.mem_vertexSet (castFin i), lemma_3_2_claim_2 hLD (castFin i) (castFin i)⟩ + · intro i j k hij hjk + exact lemma_3_2_claim_3 hLD (Fin.mk_le_mk.mpr (Fin.mk_le_mk.mp hij)) + (Fin.mk_le_mk.mpr (Fin.mk_le_mk.mp hjk)) + · intro i + have hfinite : (X_ring i).Finite := + S.finite_V.subset (inter_subset_left.trans (hLD.le_G _).vertexSet_mono) + rw [← hfinite.cast_ncard_eq, Nat.cast_le] + exact hord_le (castFin i) + +/-- Graph Minors XVI, (3.2), page 50, by the paper's linear + decomposition and the separator sets of consecutive pieces. -/ +theorem theorem_3_2_proof : GM16Theorem32Statement.{u, v} := by + intro α β S ρ n t hn hvortex ht_inj ht_range ht_cw + obtain ⟨A, B, hsep, hbd, hmem, hloc, hord, _, _, htorso⟩ := + theorem_3_2_with_edge_cover S ρ n t hn hvortex ht_inj ht_range ht_cw + exact ⟨A, B, hsep, hbd, hmem, hloc, hord, htorso⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section4.lean b/LeanPool/GraphMinor/GM16/Section4.lean new file mode 100644 index 0000000000..88e6c42d74 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section4.lean @@ -0,0 +1,219 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section3 + +import LeanPool.GraphMinor.GM12.Bridge + +/-! +# Graph Minors XVI, Section 4: Induction on the Surface + +This file formalizes Section 4 ("Induction on the surface", pages 52–54) of +N. Robertson and P. D. Seymour, *Graph Minors. XVI. Excluding a non-planar graph*, J. Combin. +Theory Ser. B 89 (2003) 43–76: + +- `IsObtainedByAddingHandleOrCrosscap`: a surface `Σ'` obtained from `Σ` by adding a handle or a + crosscap. +- Statement of **Graph Minors XVI, (4.1)** (`GM16Theorem41Statement`, page 52). +- Statement of **Graph Minors XVI, (4.2)** (`GM16Theorem42Statement`, page 53). +- Statement and proof of **Graph Minors XVI, (4.3)** (`GM16Theorem43Statement`, `theorem_4_3`, + page 54), deduced from `GM12Theorem43Statement` and `controlsMinor_of_gm12`. +- Monotonicity of `IsSegregationOfType` (`IsSegregationOfType.mono`). +- Proof of **Graph Minors XVI, (3.1)** (`theorem_3_1`, page 54) from `(4.1)`, `(4.2)`, `(4.3)`, + and `GM12Theorem42Statement` by induction over the finite surface tower. +The backward and tower inductions are proved in `InductionsProved.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM16 + +open Set Function Topology +open Graph SimpleGraph Hypergraph +open GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 GraphMinor.GM15 + +universe u v w u' v' + +variable {α : Type u} {β : Type v} + +/-! ## Surface Operations and Statements of (4.1), (4.2), and (4.3) (pages 52–54) -/ + +/-- A surface `S'` is obtained from `S` by adding a handle or a crosscap +(Graph Minors XVI, Section 4, page 52). -/ +def IsObtainedByAddingHandleOrCrosscap + (S : Type w) [TopologicalSpace S] (S' : Type w) [TopologicalSpace S'] : Prop := + IsObtainedByAddingHandle S S' ∨ IsObtainedByAddingCrosscap S S' + +/-- Statement of Graph Minors XVI, (4.1) (page 52): +"Let $\Sigma$ be a surface and let $p \ge 0$, $\phi \ge 1$. Then there exist $\kappa, \rho, \zeta +\ge 0$ +and $\theta \ge 1$ such that if $\mathscr{T}^*$ is a tangle in a graph $G$, and there is a +$\Sigma$-span of order $\ge \theta$, then either +• there is a $\Sigma'$-span of order $\ge \phi$, for some surface $\Sigma'$ obtained from $\Sigma$ + by adding a handle or crosscap, or +• there exists $Z \subseteq V(G)$ with $|Z| \le \zeta$, and a $\mathscr{T}^* \setminus Z$-central + segregation of $G \setminus Z$ of type $(\rho, \kappa)$ with a proper arrangement in $\Sigma$, or +• $\mathscr{T}^*$ controls a $K_p$ minor of $G$." -/ +def GM16Theorem41Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ p φ : ℕ, 1 ≤ φ → + ∃ κ ρ ζ θ : ℕ, 1 ≤ θ ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star θ_span : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (hT : IsGraphTangle G θ_star T_star), + θ ≤ θ_span → IsSigmaSpan G H η θ_star θ_span T_star T → + (∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S') + (H' : Drawing S') (η' : SpanEmbedding H' G) (θ_span' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsClosedSurface S' ∧ ConnectedSpace S' ∧ + IsObtainedByAddingHandleOrCrosscap S S' ∧ + φ ≤ θ_span' ∧ IsSigmaSpan G H' η' θ_star θ_span' T_star T') ∨ + (∃ (Z : Set α) (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) (α_pt : α → S), + Z ⊆ V(G) ∧ Z.ncard ≤ ζ ∧ Z.ncard < θ_star ∧ + IsCentralSegregation (deleteVertices G Z) + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star) S_seg ∧ + IsSegregationOfType (deleteVertices G Z) ρ κ S_seg ∧ + IsProperArrangement S_seg α_disc α_pt) ∨ + ControlsMinor G (completeGraph p) T_star + +/-- Statement of Graph Minors XVI, (4.2) (page 53): +"For any integer $\theta \ge 1$ there exists $\theta^* \ge 1$ such that if $\mathscr{T}^*$ is a +tangle of order $\ge \theta^*$ in a graph $G$, there is a $\Sigma$-span of order $\ge \theta$, where +$\Sigma$ is the sphere." -/ +def GM16Theorem42Statement : Prop := + ∀ θ : ℕ, 1 ≤ θ → + ∃ θ_star : ℕ, 1 ≤ θ_star ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_G : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)), + IsGraphTangle G θ_G T_star → θ_star ≤ θ_G → + ∀ (S : Type w) [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → IsSphere S → + ∃ (H : Drawing S) (η : SpanEmbedding H G) (θ_span : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))), + θ ≤ θ_span ∧ IsSigmaSpan G H η θ_G θ_span T_star T + +/-- Statement of Graph Minors XVI, (4.3) (page 54): +"If $L$ is a graph and $\Sigma$ is a surface such that $L$ can be drawn in $\Sigma$, there is an +integer $\theta \ge 1$ with the following property. If $\mathscr{T}^*$ is a tangle in a graph $G$ +controlling no $L$ minor, then there is no $\Sigma$-span of order $\ge \theta$." -/ +def GM16Theorem43Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + {α' : Type u'} {β' : Type v'} (L : Graph α' β'), + IsClosedSurface S → ConnectedSpace S → V(L).Finite → E(L).Finite → + CanBeDrawnIn S L → + ∃ θ : ℕ, 1 ≤ θ ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) (θ_span : ℕ) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))), + IsGraphTangle G θ_star T_star → + ¬ ControlsMinor G L T_star → + θ ≤ θ_span → ¬ IsSigmaSpan G H η θ_star θ_span T_star T + +/-- **Graph Minors XVI, (4.3)** (page 54, citing Graph Minors XII, (4.3)): +"If $L$ is a graph and $\Sigma$ is a surface such that $L$ can be drawn in $\Sigma$, there is an +integer $\theta \ge 1$ with the following property. If $\mathscr{T}^*$ is a tangle in a graph $G$ +controlling no $L$ minor, then there is no $\Sigma$-span of order $\ge \theta$." -/ +theorem theorem_4_3_proof : + GM16Theorem43Statement.{u, v, w, u', v'} := by + intro S _ _ α' β' L hS hconn hVL hEL hdraw + obtain ⟨θ, hθ1, hprop⟩ := GraphMinor.GM12.gm16_theorem43.{u, v, w, u', v'} L hS hconn hVL hEL + hdraw + refine ⟨θ, hθ1, fun G θ_star T_star H η θ_span T hT hnot_ctrl hθ hSpan => ?_⟩ + have hnot_gm12 : + ¬ GM12.ControlsMinor (Hypergraph.ofGraph G hT.finite_V hT.finite_E) θ_star T_star L := + fun h => hnot_ctrl (controlsMinor_of_gm12 h) + exact hprop G θ_star T_star H η θ_span T hT hnot_gm12 hθ hSpan + +/-! ## Monotonicity of `IsRhoVortex` and `IsSegregationOfType` -/ + +/-- Monotonicity of `IsRhoVortex`: a `ρ₁`-vortex is a `ρ₂`-vortex whenever `ρ₁ ≤ ρ₂`. -/ +theorem IsRhoVortex.mono {S : Society α β} {ρ₁ ρ₂ : ℕ} (h : IsRhoVortex S ρ₁) (hle : ρ₁ ≤ ρ₂) : + IsRhoVortex S ρ₂ := by + intro u hu v hv huv ⟨P, hdisj, hends⟩ + refine h u hu v hv huv ⟨fun i => P ⟨i.1, by omega⟩, ?_, fun i => hends ⟨i.1, by omega⟩⟩ + intro i j hij + exact hdisj (fun h_eq => hij (Fin.ext (Fin.mk.inj h_eq))) + +/-- Monotonicity of `IsSegregationOfType`: a segregation of type `(ρ₁, κ₁)` is of type `(ρ₂, κ₂)` +whenever `ρ₁ ≤ ρ₂` and `κ₁ ≤ κ₂`. -/ +theorem IsSegregationOfType.mono {G : Graph α β} {ρ₁ κ₁ ρ₂ κ₂ : ℕ} + {S_seg : Set (Society α β)} (h : IsSegregationOfType G ρ₁ κ₁ S_seg) + (hρ : ρ₁ ≤ ρ₂) (hκ : κ₁ ≤ κ₂) : + IsSegregationOfType G ρ₂ κ₂ S_seg where + isSegregation := h.isSegregation + vortex_count_le := h.vortex_count_le.trans hκ + is_rho_vortex _ hS h3 := (h.is_rho_vortex hS h3).mono hρ + +/-! ## Proof of Graph Minors XVI, (3.1) from (4.1), (4.2), and (4.3) (page 54) -/ + +/-- A finite tower of closed connected surfaces `Σ_0, …, Σ_{n-1}` for a graph `L` +(Graph Minors XVI, Section 4, page 54): +"Up to homeomorphism, let $\Sigma_1, \dots, \Sigma_n$ be all the surfaces on which $L$ cannot be +drawn together with the sphere and all the surfaces which can be obtained from a surface on which +$L$ cannot be drawn by adding a handle or crosscap. (There are only finitely many up to +homeomorphism.) Let us number $\Sigma_1, \dots, \Sigma_n$ so that for $1 \le i, j \le n$, if +$\Sigma_j$ can be obtained from $\Sigma_i$ by adding a handle or crosscap then $j \ge i$." -/ +structure SurfaceTowerFor {α' : Type u'} {β' : Type v'} (L : Graph α' β') where + /-- Number of surfaces in the tower (`n ≥ 1`). -/ + n : ℕ + /-- `1 ≤ n`. -/ + one_le_n : 1 ≤ n + /-- The surfaces `Σ_0, …, Σ_{n-1}`. -/ + Surf : Fin n → Type w + /-- Topological space structure on each `Σ_i`. -/ + topSpace : ∀ i, TopologicalSpace (Surf i) + /-- Hausdorff structure on each `Σ_i`. -/ + t2Space : ∀ i, @T2Space (Surf i) (topSpace i) + /-- Each `Σ_i` is a closed surface. -/ + isClosedSurface : ∀ i, @IsClosedSurface (Surf i) (topSpace i) + /-- Each `Σ_i` is connected. -/ + isConnected : ∀ i, @ConnectedSpace (Surf i) (topSpace i) + /-- `Σ_0` is a 2-sphere. -/ + isSphere_zero : @IsSphere (Surf ⟨0, one_le_n⟩) (topSpace ⟨0, one_le_n⟩) + /-- If `L` cannot be drawn in `Σ_i` and `S'` is obtained from `Σ_i` by adding a handle or + crosscap, then `S'` appears at some later index `j > i` in the tower (up to homeomorphism, so any + `S'`-span of order `≥ φ` yields a `Σ_j`-span of order `≥ φ`). -/ + step_index : ∀ (i : Fin n), + ¬ @CanBeDrawnIn _ _ (Surf i) (topSpace i) L → + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star φ : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (S' : Type w) [TopologicalSpace S'] [T2Space S'] + (H' : Drawing S') (η' : SpanEmbedding H' G) (θ_span' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsClosedSurface S' → ConnectedSpace S' → + @IsObtainedByAddingHandleOrCrosscap (Surf i) (topSpace i) S' _ → + φ ≤ θ_span' → IsSigmaSpan G H' η' θ_star θ_span' T_star T' → + ∃ (j : Fin n), i < j ∧ + ∃ (H_j : @Drawing (Surf j) (topSpace j)) (η_j : @SpanEmbedding (Surf j) + (topSpace j) α β H_j G) + (θ_span_j : ℕ) + (T_j : Set (Hypergraph (Surf j) (Set (Surf j)) × Hypergraph (Surf j) (Set (Surf j)))), + φ ≤ θ_span_j ∧ + @IsSigmaSpan α β (Surf j) (topSpace j) (t2Space j) G H_j η_j θ_star θ_span_j T_star T_j + +/-- The finite surface tower used in Graph Minors XVI, proof of (3.1), page 54. +For a single vertex the sphere alone suffices, since the vertex can be drawn +in every surface. For the complete graph on five vertices, the sphere is the +only closed connected surface excluding the graph. Its one-step successors +must also be included. Existence of these towers is a surface topology result. -/ +def SurfaceTowerStatement : Prop := + ∀ {α' : Type u'} {β' : Type v'} (L : Graph α' β'), + V(L).Finite → E(L).Finite → Nonempty (SurfaceTowerFor.{u, v, w, u', v'} L) + +attribute [local instance] SurfaceTowerFor.topSpace SurfaceTowerFor.t2Space + + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section4Claim1.lean b/LeanPool/GraphMinor/GM16/Section4Claim1.lean new file mode 100644 index 0000000000..54c0038784 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section4Claim1.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4WallRows +public import LeanPool.GraphMinor.GM10.Defs +import LeanPool.GraphMinor.GM16.Section4WallRowImages + +/-! +# Claim (1) in the proof of XVI (4.2) + +The paper defines the wall tangle by placing a complete horizontal +row on the large side. Contracting the horizontal pairs induces a +tangle from the smaller grid. Its small side contains no complete +wall row. Every separation of order less than `θ` has an uncut row, +so the two definitions of the tangle agree. +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Graph Hypergraph GM10 + +/-- The set `𝒯₁` in XVI (4.2), page 53: the separations of order less +than `θ` whose large side includes a horizontal row of the wall. -/ +def sphereWallTangle (θ : ℕ) : + Set (Hypergraph (Fin (2 * θ + 1) × Fin θ) (Sym2 (Fin (2 * θ + 1) × Fin θ)) × + Hypergraph (Fin (2 * θ + 1) × Fin θ) (Sym2 (Fin (2 * θ + 1) × Fin θ))) := + {p | (Hypergraph.ofGraph (sphereWallGraph θ) (Set.toFinite _) (Set.toFinite _)).IsSeparation p.1 + p.2 ∧ + separationOrder p.1 p.2 < θ ∧ ∃ j : Fin θ, E(sphereWallRow θ j) ⊆ p.2.edgeSet} + +/-- Graph Minors XVI, (4.2), Claim (1), page 53: `𝒯₁` is a tangle +of order `θ` in `N₁`. The proof follows the paper's contraction to the +smaller grid, X (7.3), and induction of tangles by X (6.1). -/ +theorem theorem_4_2_claim_1 {θ : ℕ} (hθ : 2 ≤ θ) : + IsTangle (Hypergraph.ofGraph (sphereWallGraph θ) (Set.toFinite _) (Set.toFinite _)) θ + (sphereWallTangle θ) := by + obtain ⟨N₂, hV₂, hE₂, _, hImage, _, hT₁⟩ := exists_induced_wall_tangle θ hθ + have hEq : sphereWallTangle θ = inducedTangle + (Hypergraph.ofGraph (sphereWallGraph θ) (Set.toFinite _) (Set.toFinite _)) + (Hypergraph.ofGraph N₂ hV₂ hE₂) + (imageHypergraphTangle (sphereWallPair θ) (sphereWallGridEdge θ) (gridTangle θ)) θ := by + ext ⟨A, B⟩ + constructor + · rintro ⟨hSep, hOrd, j, hRow⟩ + rcases hT₁.axiom1 hSep hOrd with hm | hm + · exact hm + · exact (induced_wall_tangle_no_small_row hθ hV₂ hE₂ hImage hm j hRow).elim + · intro hm + have hSep := hT₁.isSeparation hm + have hOrd := hT₁.order_lt hm + refine ⟨hSep, hOrd, ?_⟩ + obtain ⟨j, hRow⟩ := sphereWall_separation_has_row hSep hOrd + refine ⟨j, ?_⟩ + rcases hRow with hA | hB + · exact (induced_wall_tangle_no_small_row hθ hV₂ hE₂ hImage hm j hA).elim + · exact hB + rw [hEq] + exact hT₁ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section4Control.lean b/LeanPool/GraphMinor/GM16/Section4Control.lean new file mode 100644 index 0000000000..b939ffc6b5 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section4Control.lean @@ -0,0 +1,110 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4Claim1 +public import LeanPool.GraphMinor.GM16.ModelInducedTangle +import LeanPool.GraphMinor.GM16.Section4GridMinor +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# The wall-induced tangle is contained in the original tangle + +This proves the paragraph following Step (2) in XVI (4.2), page 53. +The large side of every induced separation contains the images of a +whole wall row. Its reverse therefore cannot belong to the original +tangle, by Step (2). The first tangle axiom places the separation itself +in that tangle. The wall tangle and the controlled wall minor are both +constructed by the proved earlier steps. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Hypergraph GM10 GM15 +universe u v + +private theorem induced_wall_subset {θ : ℕ} {α : Type u} {β : Type v} + {G : Graph α β} {θG : ℕ} {Tstar : Set (Hypergraph α β × Hypergraph α β)} + (hT : IsGraphTangle G θG Tstar) (hθG : θ ≤ θG) + {ηv : Fin (2 * θ + 1) × Fin θ → Set α} + {ηe : Sym2 (Fin (2 * θ + 1) × Fin θ) → β} + (hModel : IsMinorModel (sphereWallGraph θ) G ηv ηe) + (hNoRow : ∀ A B : Hypergraph α β, (A,B) ∈ Tstar → separationOrder A B ≤ 2 * θ → + ∀ j : Fin θ, ¬ ηe '' E(sphereWallRow θ j) ⊆ A.edgeSet) + {K : Graph (Set α) β} (hVK : V(K).Finite) (hEK : E(K).Finite) + (hImage : Hypergraph.ofGraph K hVK hEK = imageHypergraph ηv ηe + (Hypergraph.ofGraph (sphereWallGraph θ) (Set.toFinite _) (Set.toFinite _))) : + inducedTangle (Hypergraph.ofGraph G hT.finite_V hT.finite_E) + (Hypergraph.ofGraph K hVK hEK) (imageHypergraphTangle ηv ηe (sphereWallTangle θ)) θ ⊆ Tstar + := by + rintro ⟨A,B⟩ hAB + obtain ⟨p, hp, hEdge⟩ := hAB.2.2 + obtain ⟨⟨A₀,B₀⟩, hSrc, hPair⟩ := hp + have hA := congrArg Prod.fst hPair + have hAE : ηe '' A₀.edgeSet = A.edgeSet ∩ E(K) := + (congrArg Hypergraph.edgeSet hA).trans hEdge + have hEN : E(K) = ηe '' E(sphereWallGraph θ) := congrArg Hypergraph.edgeSet hImage + obtain ⟨j, hj⟩ := hSrc.2.2 + have hBig : ηe '' E(sphereWallRow θ j) ⊆ B.edgeSet := by + rintro _ ⟨e, heRow, rfl⟩ + have heWall := (sphereWallRow_le θ j).edgeSet_mono heRow + have heG := hModel.edge_mem e heWall + have heK : ηe e ∈ E(K) := hEN.symm ▸ mem_image_of_mem ηe heWall + have heNotA : ηe e ∉ A.edgeSet := by + intro heA + obtain ⟨e₀, he₀, hEq⟩ := hAE.symm ▸ (show ηe e ∈ A.edgeSet ∩ E(K) from ⟨heA,heK⟩) + have he₀Wall := hSrc.1.left_le.edgeSet_subset he₀ + have hEq' : e₀ = e := hModel.edge_injOn he₀Wall heWall hEq + have heA₀ : e ∈ A₀.edgeSet := hEq' ▸ he₀ + exact hSrc.1.notMem_edgeSet_left (hj heRow) heA₀ + have heAB : ηe e ∈ A.edgeSet ∪ B.edgeSet := hAB.1.edgeSet_union.symm ▸ heG + exact heAB.resolve_left heNotA + have hOrd : separationOrder A B < θG := hAB.2.1.trans_le hθG + rcases hT.isTangle.axiom1 hAB.1 hOrd with hm | hm + · exact hm + · have hOrdSwap : separationOrder B A ≤ 2 * θ := by + rw [separationOrder_comm] + have hθOrd : separationOrder A B < θ := hAB.2.1 + omega + exact (hNoRow B A hm hOrdSwap j hBig).elim + +/-- The wall minor and its conformal induced tangle in XVI (4.2), +page 53. All graph and tangle steps are proved, with no statement +hypotheses. -/ +theorem exists_conformal_wall_minor (θ : ℕ) (hθ : 2 ≤ θ) : + ∃ θstar : ℕ, 1 ≤ θstar ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θG : ℕ) + (Tstar : Set (Hypergraph α β × Hypergraph α β)) (hT : IsGraphTangle G θG Tstar), + θstar ≤ θG → + ∃ (ηv : Fin (2 * θ + 1) × Fin θ → Set α) + (ηe : Sym2 (Fin (2 * θ + 1) × Fin θ) → β), + IsMinorModel (sphereWallGraph θ) G ηv ηe ∧ + ∃ (K : Graph (Set α) β) (hVK : V(K).Finite) (hEK : E(K).Finite), + IsMinor K G ∧ + Hypergraph.ofGraph K hVK hEK = imageHypergraph ηv ηe + (Hypergraph.ofGraph (sphereWallGraph θ) (Set.toFinite _) (Set.toFinite _)) ∧ + IsTangle (Hypergraph.ofGraph K hVK hEK) θ (imageHypergraphTangle ηv ηe + (sphereWallTangle θ)) ∧ + IsTangle (Hypergraph.ofGraph G hT.finite_V hT.finite_E) θ + (inducedTangle (Hypergraph.ofGraph G hT.finite_V hT.finite_E) + (Hypergraph.ofGraph K hVK hEK) (imageHypergraphTangle ηv ηe + (sphereWallTangle θ)) θ) ∧ + inducedTangle (Hypergraph.ofGraph G hT.finite_V hT.finite_E) + (Hypergraph.ofGraph K hVK hEK) (imageHypergraphTangle ηv ηe + (sphereWallTangle θ)) θ ⊆ Tstar := by + obtain ⟨θ₀, hθ₀, hWall⟩ := exists_wall_minor_no_small_row θ (by omega) + refine ⟨θ₀ + θ, by omega, ?_⟩ + intro α β G θG Tstar hT hOrd + obtain ⟨ηv, ηe, hModel, hNoRow⟩ := hWall G θG Tstar hT (by omega) + obtain ⟨K, hVK, hEK, hMinor, hImage, hTK, hTG⟩ := exists_model_induced_tangle + (Set.toFinite _) (Set.toFinite _) hT.finite_V hT.finite_E hModel hθ (theorem_4_2_claim_1 hθ) + exact ⟨ηv, ηe, hModel, K, hVK, hEK, hMinor, hImage, hTK, hTG, + induced_wall_subset hT (by omega) hModel hNoRow hVK hEK hImage⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section4GridMinor.lean b/LeanPool/GraphMinor/GM16/Section4GridMinor.lean new file mode 100644 index 0000000000..5502fabc02 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section4GridMinor.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4WallRows +public import LeanPool.GraphMinor.GM16.MinorModelRestriction +public import LeanPool.GraphMinor.GM15.Defs +import LeanPool.GraphMinor.GM10.Section7 +import LeanPool.GraphMinor.RST94.Theorem23 + +/-! +# The wall minor controlled by the tangle + +Use the large square grid supplied by Robertson, Seymour and Thomas, +then keep its rectangular wall. The wall rows are exactly the first +`θ` rows of that square grid. Thus no small side of the original tangle +contains a complete wall row. This is Step (2) and the following +restriction in XVI (4.2), page 53. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph Hypergraph GM10 GM15 +universe u v + +/-- The wall inclusion takes each whole horizontal row onto a row of +the large square grid, including all its edges. -/ +theorem sphereWallGridVertex_row_edges (θ : ℕ) (j : Fin θ) : + Sym2.map (sphereWallGridVertex θ) '' E(sphereWallRow θ j) = + (gridRowPath (2 * θ + 1) (Fin.castLE (by omega) j)).edgeSet := by + ext e + constructor + · rintro ⟨e₀, he₀, rfl⟩ + obtain ⟨x, y, hlink, hx, hy⟩ := he₀ + have hAdj : (sphereWallSimpleGraph θ).Adj x y := by + have he := hlink.2 + rw [hlink.1] at he + exact he + have hGrid := sphereWallGridVertex_adj hAdj + have heq : Sym2.map (sphereWallGridVertex θ) e₀ = + s(sphereWallGridVertex θ x, sphereWallGridVertex θ y) := by + rw [hlink.1, Sym2.map_mk] + refine ⟨?_, ?_⟩ + · rw [heq] + exact hGrid + · intro z hz + rw [heq] at hz + rcases (gridHypergraph_inc_sym2.mp hz).2 with rfl | rfl + · apply Fin.ext + simpa only [sphereWallGridVertex, Fin.val_castLE] using congrArg (Fin.val : Fin θ → ℕ) hx + · apply Fin.ext + simpa only [sphereWallGridVertex, Fin.val_castLE] using congrArg (Fin.val : Fin θ → ℕ) hy + · intro he + induction e with + | h x y => + have hAdj : (pathGraph (2 * θ + 1) □ pathGraph (2 * θ + 1)).Adj x y := he.1 + have hx := he.2 x (gridHypergraph_inc_sym2.mpr ⟨hAdj, Or.inl rfl⟩) + have hy := he.2 y (gridHypergraph_inc_sym2.mpr ⟨hAdj, Or.inr rfl⟩) + have hStep : (pathGraph (2 * θ + 1)).Adj x.2 y.2 := by + rcases boxProd_adj.mp hAdj with ⟨h, _⟩ | ⟨h, _⟩ + · exact (h.ne (hx.trans hy.symm)).elim + · exact h + let a : Fin (2 * θ + 1) × Fin θ := (x.2, j) + let b : Fin (2 * θ + 1) × Fin θ := (y.2, j) + have ha : sphereWallGridVertex θ a = x := Prod.ext hx.symm rfl + have hb : sphereWallGridVertex θ b = y := Prod.ext hy.symm rfl + refine ⟨s(a,b), ?_, ?_⟩ + · refine ⟨a, b, ⟨rfl, ?_⟩, rfl, rfl⟩ + exact Or.inl ⟨rfl, pathGraph_adj.mp hStep⟩ + · rw [Sym2.map_mk, ha, hb] + +/-- Graph Minors XVI, (4.2), Step (2) and the following paragraph, +page 53: a sufficiently large tangle has the specified wall minor, +and its small sides of order at most `2θ` contain no complete wall row. +The cited grid theorem is used through its proved theorem. -/ +theorem exists_wall_minor_no_small_row (θ : ℕ) (hθ : 1 ≤ θ) : + ∃ θ_star : ℕ, 1 ≤ θ_star ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_G : ℕ) + (T : Set (Hypergraph α β × Hypergraph α β)), + IsGraphTangle G θ_G T → θ_star ≤ θ_G → + ∃ (ηv : Fin (2 * θ + 1) × Fin θ → Set α) + (ηe : Sym2 (Fin (2 * θ + 1) × Fin θ) → β), + IsMinorModel (sphereWallGraph θ) G ηv ηe ∧ + ∀ A B : Hypergraph α β, (A,B) ∈ T → separationOrder A B ≤ 2 * θ → + ∀ j : Fin θ, ¬ ηe '' E(sphereWallRow θ j) ⊆ A.edgeSet := by + obtain ⟨θ_star, hθ_star, hGrid⟩ := RST94.rst94_theorem_2_3 θ hθ + refine ⟨θ_star, hθ_star, ?_⟩ + intro α β G θ_G T hT hθG + obtain ⟨ηv, ηe, hModel, hNoRow⟩ := hGrid G θ_G T hT hθG + refine ⟨ηv ∘ sphereWallGridVertex θ, ηe ∘ Sym2.map (sphereWallGridVertex θ), ?_, ?_⟩ + · exact IsMinorModel.restrict_simpleGraph_copy hModel (sphereWallGridVertex θ) + (sphereWallGridVertex_injective θ) (fun _ _ h => sphereWallGridVertex_adj h) + · intro A B hAB hOrd j hRow + apply hNoRow A B hAB hOrd (Fin.castLE (by omega) j) + rw [← sphereWallGridVertex_row_edges θ j, image_image] + exact hRow + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section4Proof.lean b/LeanPool/GraphMinor/GM16/Section4Proof.lean new file mode 100644 index 0000000000..7993219bb4 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section4Proof.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4 +import LeanPool.GraphMinor.GM16.Section4Control +import LeanPool.GraphMinor.GM16.SubcubicSubdivision +import LeanPool.GraphMinor.GM16.WallSubdivisionRigidity +import LeanPool.GraphMinor.GM16.InducedTangleEdgePatterns +import LeanPool.GraphMinor.GM16.GraphDrawingControlledTangle +import LeanPool.GraphMinor.GM16.SphereRespectful +import LeanPool.GraphMinor.GM14.Section6a +import LeanPool.GraphMinor.GM11.PlaneFacts + +/-! +# Graph Minors XVI (4.2): a sphere span + +Increase the desired order to an even height at least four. +The row-defined wall tangle and the controlled grid minor give a +wall minor whose induced tangle is contained in the ambient one. +Replace its subcubic branch sets by centres and disjoint arms, +retaining the same chosen edges inside the subdivision subgraph. +Draw that subdivision rigidly on the sphere wall's support. +The identical chosen edge map compares the two induced tangles, +and transporting the subdivision tangle to its drawing gives the +required controlled respectful tangle and hence the sphere span. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Hypergraph Topology Surface GM10 GM14 GM15 +universe u v w + +/-- Graph Minors XVI, (4.2), pages 53–54. Every sufficiently high-order +graph tangle has a sphere span of the prescribed order. The wall, +subdivision, drawing, and induced-tangle steps of the paper are all +proved; the initial height is increased to an even value at least four. -/ +theorem theorem_4_2_proof : GM16Theorem42Statement.{u,v,w} := by + intro θ _hθ + let height := 2*(θ+2) + have hHeight : 4 ≤ height := by dsimp only [height]; omega + have hEven : Even height := ⟨θ+2,by dsimp only [height]; omega⟩ + have hTwo : 2 ≤ height := by omega + obtain ⟨θ₀,hθ₀,hWall⟩ := exists_conformal_wall_minor height hTwo + refine ⟨θ₀+height,by omega,?_⟩ + intro α β G θG Tstar hT hOrder S _ _ hS hConn hSphere + let : ConnectedSpace S := hConn + have hHeightG : height ≤ θG := by omega + obtain ⟨ηv,ηe,hModelG,KG,hVKG,hEKG,_,hImageG,_,_,hConformalG⟩ := + hWall G θG Tstar hT (by omega) + obtain ⟨N,c,P,hNG,hcInj,_,hVN,hEN,hPaths,hInter,ηv',hModelN⟩ := + exists_subcubic_subdivision_with_minor hModelG (sphereWall_neighborSet_ncard_le_three height) + have hNV : V(N).Finite := hT.finite_V.subset hNG.vertexSet_mono + have hNE : E(N).Finite := hT.finite_E.subset hNG.edgeSet_mono + let W := Hypergraph.ofGraph (sphereWallGraph height) (Set.toFinite _) (Set.toFinite _) + obtain ⟨KN,hVKN,hEKN,_,hImageN,_,hTN₀⟩ := exists_model_induced_tangle + (Set.toFinite _) (Set.toFinite _) hNV hNE hModelN hTwo (theorem_4_2_claim_1 hTwo) + let TN := inducedTangle (Hypergraph.ofGraph N hNV hNE) (imageHypergraph ηv' ηe W) + (imageHypergraphTangle ηv' ηe (sphereWallTangle height)) height + have hTN : IsTangle (Hypergraph.ofGraph N hNV hNE) height TN := by + simpa only [TN,W,sphereWallGraph,hImageN] using hTN₀ + have hChosen : ηe '' W.edgeSet ⊆ (Hypergraph.ofGraph N hNV hNE).edgeSet := by + rintro e ⟨e₀,he₀,rfl⟩ + exact hModelN.edge_mem e₀ he₀ + have hConformalN : inducedTangle (Hypergraph.ofGraph G hT.finite_V hT.finite_E) + (Hypergraph.ofGraph N hNV hNE) TN height ⊆ Tstar := by + have hSub := inducedTangle_subset_of_same_edge_pattern W + (Hypergraph.ofGraph G hT.finite_V hT.finite_E) (Hypergraph.ofGraph N hNV hNE) + ηv ηv' ηe (sphereWallTangle height) height hChosen + apply hSub.trans + simpa only [hImageG] using hConformalG + have hPathData (e : (sphereWallSimpleGraph height).edgeSet) : + ∃ a b, e.val=s(a,b) ∧ (sphereWallSimpleGraph height).Adj a b ∧ + GM09.IsGraphPathWithEnds N (P e) (c a) (c b) ∧ V(P e) ∩ range c = {c a,c b} := by + obtain ⟨a,b,he,ha,hp,_,hRange⟩ := hPaths e + exact ⟨a,b,he,ha,hp,hRange⟩ + obtain ⟨_,Γ,_,hRigid,_⟩ := exists_rigid_wall_subdivision_drawing hS hSphere hHeight hEven + c hcInj P hPathData hInter hVN hEN + let v₀ : Fin (2*height+1) × Fin height := (⟨0,by omega⟩,⟨0,by omega⟩) + let : Nonempty α := ⟨c v₀⟩ + let : Nonempty β := ⟨ηe s(v₀,v₀)⟩ + obtain ⟨η,T,_,hControl⟩ := exists_controlled_drawing_tangle hT hHeightG hNG hNV hNE Γ TN hTN + hConformalN + have hU : Γ.drawing.U.Nonempty := by + have hv : c v₀ ∈ V(N) := hVN.symm ▸ Or.inl (mem_range_self v₀) + exact ⟨(Γ.iso.vertexEquiv ⟨c v₀,hv⟩).val, + Γ.drawing.V_subset_U (Γ.iso.vertexEquiv ⟨c v₀,hv⟩).property⟩ + have hRespectful : IsRespectfulDrawingTangle Γ.drawing height T := + ⟨⟨hConn,fun _ hr => isOpenDisc_region_of_isRigid hS hRigid hU hr⟩, + hControl.isTangle_H,drawing_tangle_isRespectful_of_isSphere hS hSphere Γ.drawing + hControl.isTangle_H⟩ + have hBd : bd S=∅ := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro x hx + exact hx (hS.2.2 x) + refine ⟨Γ.drawing,η,height,T,?_,?_⟩ + · dsimp only [height] + omega + · exact ⟨IsClosedSurface.isSurface hS,hConn,hBd,hRigid,hRespectful,hControl⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section4Wall.lean b/LeanPool/GraphMinor/GM16/Section4Wall.lean new file mode 100644 index 0000000000..104866ca39 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section4Wall.lean @@ -0,0 +1,180 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM01.Defs +import Mathlib.Data.Set.Card +import Mathlib.Algebra.Ring.Parity + +/-! +# The wall in Graph Minors XVI, (4.2) + +On page 53 the proof starts with a rectangular grid and deletes alternate +vertical edges. Coordinates here start at zero. The horizontal edges +remain, and a vertical edge above a vertex remains exactly when the sum +of its coordinates is even. At most one vertical edge meets each vertex, +so the resulting graph has maximum degree at most three. +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph +universe u + +/-- The graph `N₁` in the proof of XVI (4.2), page 53. Its vertex +`(i,j)` is the paper's vertex `(i+1,j+1)`. -/ +def sphereWallSimpleGraph (θ : ℕ) : SimpleGraph (Fin (2 * θ + 1) × Fin θ) where + Adj x y := + (x.2 = y.2 ∧ (x.1.val + 1 = y.1.val ∨ y.1.val + 1 = x.1.val)) ∨ + (x.1 = y.1 ∧ ((x.2.val + 1 = y.2.val ∧ Even (x.1.val + x.2.val)) ∨ + (y.2.val + 1 = x.2.val ∧ Even (y.1.val + y.2.val)))) + symm := ⟨by + intro x y h + rcases h with ⟨hxy, hstep⟩ | ⟨hxy, hstep⟩ + · exact Or.inl ⟨hxy.symm, hstep.symm⟩ + · exact Or.inr ⟨hxy.symm, hstep.symm⟩⟩ + loopless := ⟨fun x h => by + rcases h with ⟨_, hstep | hstep⟩ | ⟨_, ⟨hstep, _⟩ | ⟨hstep, _⟩⟩ <;> omega⟩ + +/-- The graph `N₁` from XVI (4.2), retaining the grid's edge names. -/ +def sphereWallGraph (θ : ℕ) : + Graph (Fin (2 * θ + 1) × Fin θ) (Sym2 (Fin (2 * θ + 1) × Fin θ)) := + Graph.ofSimpleGraph (sphereWallSimpleGraph θ) + +/-- Inclusion of the rectangular wall in the square grid of XVI (4.2), +page 53. The coordinates are exchanged so its horizontal paths are the +rows in `GM10.gridRowPath`. -/ +def sphereWallGridVertex (θ : ℕ) (x : Fin (2 * θ + 1) × Fin θ) : + Fin (2 * θ + 1) × Fin (2 * θ + 1) := + (Fin.castLE (by omega) x.2, x.1) + +/-- The wall inclusion is injective on vertices. -/ +theorem sphereWallGridVertex_injective (θ : ℕ) : + Function.Injective (sphereWallGridVertex θ) := by + intro x y h + have h₁ := congrArg (fun z => z.1.val) h + have h₂ := congrArg Prod.snd h + exact Prod.ext h₂ (Fin.ext h₁) + +/-- Every retained edge is an edge of the square grid. -/ +theorem sphereWallGridVertex_adj {θ : ℕ} + {x y : Fin (2 * θ + 1) × Fin θ} + (h : (sphereWallSimpleGraph θ).Adj x y) : + (pathGraph (2 * θ + 1) □ pathGraph (2 * θ + 1)).Adj + (sphereWallGridVertex θ x) (sphereWallGridVertex θ y) := by + rw [SimpleGraph.boxProd_adj] + rcases h with ⟨heq, hstep⟩ | ⟨heq, hstep⟩ + · right + refine ⟨SimpleGraph.pathGraph_adj.mpr hstep, ?_⟩ + apply Fin.ext + simpa only [sphereWallGridVertex, Fin.val_castLE] using congrArg (Fin.val : Fin θ → ℕ) heq + · left + refine ⟨SimpleGraph.pathGraph_adj.mpr ?_, heq⟩ + rcases hstep with ⟨hstep, _⟩ | ⟨hstep, _⟩ + · exact Or.inl hstep + · exact Or.inr hstep + +/-- No two different vertical neighbours meet the same vertex in `N₁`. +The potential vertical edges above and below have opposite parity. -/ +theorem sphereWall_vertical_neighbor_unique {θ : ℕ} + {x y z : Fin (2 * θ + 1) × Fin θ} + (hxy : (sphereWallSimpleGraph θ).Adj x y) + (hxz : (sphereWallSimpleGraph θ).Adj x z) + (hy : y.1 = x.1) (hz : z.1 = x.1) : y = z := by + have hyi : y.1.val = x.1.val := congrArg Fin.val hy + have hzi : z.1.val = x.1.val := congrArg Fin.val hz + have hstepy : (x.2.val + 1 = y.2.val ∧ Even (x.1.val + x.2.val)) ∨ + (y.2.val + 1 = x.2.val ∧ Even (y.1.val + y.2.val)) := by + rcases hxy with ⟨_, hstep | hstep⟩ | ⟨_, hstep⟩ + · omega + · omega + · exact hstep + have hstepz : (x.2.val + 1 = z.2.val ∧ Even (x.1.val + x.2.val)) ∨ + (z.2.val + 1 = x.2.val ∧ Even (z.1.val + z.2.val)) := by + rcases hxz with ⟨_, hstep | hstep⟩ | ⟨_, hstep⟩ + · omega + · omega + · exact hstep + apply Prod.ext (hy.trans hz.symm) + apply Fin.ext + rcases hstepy with ⟨hup, heven⟩ | ⟨hdown, heven⟩ <;> + rcases hstepz with ⟨hup', heven'⟩ | ⟨hdown', heven'⟩ + · omega + · rw [Nat.even_iff] at heven heven' + omega + · rw [Nat.even_iff] at heven heven' + omega + · omega + +/-- The maximum-degree assertion in the last paragraph of the proof of +XVI (4.2), page 54. The three possible neighbours are left, right, and +the unique vertical neighbour. -/ +theorem sphereWall_neighborSet_ncard_le_three (θ : ℕ) + (x : Fin (2 * θ + 1) × Fin θ) : + ((sphereWallSimpleGraph θ).neighborSet x).ncard ≤ 3 := by + classical + let tag : Fin (2 * θ + 1) × Fin θ → Fin 3 := fun y => + if y.1.val < x.1.val then 0 else if x.1.val < y.1.val then 1 else 2 + have hinj : InjOn tag ((sphereWallSimpleGraph θ).neighborSet x) := by + intro y hy z hz htag + change (sphereWallSimpleGraph θ).Adj x y at hy + change (sphereWallSimpleGraph θ).Adj x z at hz + by_cases hyl : y.1.val < x.1.val + · have hzl : z.1.val < x.1.val := by + by_contra hzl + simp only [tag, hyl, hzl, ↓reduceIte] at htag + split_ifs at htag <;> contradiction + have hyc : y.2 = x.2 ∧ y.1.val + 1 = x.1.val := by + rcases hy with ⟨h, hs | hs⟩ | ⟨h, _⟩ + · omega + · exact ⟨h.symm, hs⟩ + · have := congrArg Fin.val h; omega + have hzc : z.2 = x.2 ∧ z.1.val + 1 = x.1.val := by + rcases hz with ⟨h, hs | hs⟩ | ⟨h, _⟩ + · omega + · exact ⟨h.symm, hs⟩ + · have := congrArg Fin.val h; omega + exact Prod.ext (Fin.ext (by omega)) (hyc.1.trans hzc.1.symm) + · by_cases hyr : x.1.val < y.1.val + · have hzr : x.1.val < z.1.val := by + by_contra hzr + simp only [tag, hyl, hyr, hzr, ↓reduceIte] at htag + split_ifs at htag <;> contradiction + have hyc : y.2 = x.2 ∧ x.1.val + 1 = y.1.val := by + rcases hy with ⟨h, hs | hs⟩ | ⟨h, _⟩ + · exact ⟨h.symm, hs⟩ + · omega + · have := congrArg Fin.val h; omega + have hzc : z.2 = x.2 ∧ x.1.val + 1 = z.1.val := by + rcases hz with ⟨h, hs | hs⟩ | ⟨h, _⟩ + · exact ⟨h.symm, hs⟩ + · omega + · have := congrArg Fin.val h; omega + exact Prod.ext (Fin.ext (by omega)) (hyc.1.trans hzc.1.symm) + · have hzi : z.1.val = x.1.val := by + by_contra hzi + simp only [tag, hyl, hyr, ↓reduceIte] at htag + split_ifs at htag <;> omega + exact sphereWall_vertical_neighbor_unique hy hz (Fin.ext (by omega)) (Fin.ext hzi) + have hcard := Set.ncard_le_ncard_of_injOn tag (fun _ _ => Set.mem_univ _) hinj + (Set.finite_univ : (Set.univ : Set (Fin 3)).Finite) + simpa only [Set.ncard_univ, Nat.card_eq_fintype_card, Fintype.card_fin] using hcard + +/-- Every vertex of the wall has a horizontal neighbor. -/ +theorem sphereWall_no_isolated (θ : ℕ) (v : Fin (2 * θ + 1) × Fin θ) : + ∃ w, (sphereWallSimpleGraph θ).Adj v w := by + have hθ : 0 < θ := lt_of_le_of_lt (Nat.zero_le v.2.val) v.2.isLt + by_cases hi : v.1.val + 1 < 2 * θ + 1 + · exact ⟨(⟨v.1.val + 1, hi⟩, v.2), Or.inl ⟨rfl, Or.inl rfl⟩⟩ + · have hPrev : v.1.val - 1 < 2 * θ + 1 := by omega + refine ⟨(⟨v.1.val - 1, hPrev⟩, v.2), Or.inl ⟨rfl, Or.inr ?_⟩⟩ + change v.1.val - 1 + 1 = v.1.val + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section4WallContraction.lean b/LeanPool/GraphMinor/GM16/Section4WallContraction.lean new file mode 100644 index 0000000000..42a89404de --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section4WallContraction.lean @@ -0,0 +1,171 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4Wall +public import LeanPool.GraphMinor.Minor.Model +import Mathlib.Algebra.Ring.Parity + +/-! +# The contraction in XVI (4.2), Claim (1) + +Delete the last column of the wall, then contract each horizontal edge +from column `2i` to column `2i+1`. Each resulting vertex is a pair of +vertices of the wall. Between neighbouring pairs in one row there is a +horizontal edge. Between neighbouring rows there is one vertical edge, +selected by the parity of the lower row. These are exactly the edges of +the smaller square grid used on page 53. +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph + +/-- The two wall vertices identified with `(i,j)` in Claim (1) of +XVI (4.2), page 53. -/ +def sphereWallPairVertex (θ : ℕ) (v : Fin θ × Fin θ) (b : Fin 2) : + Fin (2 * θ + 1) × Fin θ := + (⟨2 * v.1.val + b.val, by omega⟩, v.2) + +/-- The quotient coordinate on the wall after contracting the pairs. +The final column is deleted in the proof, and its value here is unused. -/ +def sphereWallPairProjection (θ : ℕ) (x : Fin (2 * θ + 1) × Fin θ) : + Fin θ × Fin θ := + (⟨min (x.1.val / 2) (θ - 1), by have := x.2.isLt; omega⟩, x.2) + +/-- Each of the two pair vertices projects to its grid vertex. -/ +theorem sphereWallPairProjection_vertex (θ : ℕ) (v : Fin θ × Fin θ) (b : Fin 2) : + sphereWallPairProjection θ (sphereWallPairVertex θ v b) = v := by + apply Prod.ext + · apply Fin.ext + simp only [sphereWallPairProjection, sphereWallPairVertex] + have := v.1.isLt + have := b.isLt + omega + · rfl + +/-- The vertex set of a contracted pair. -/ +def sphereWallPair (θ : ℕ) (v : Fin θ × Fin θ) : + Set (Fin (2 * θ + 1) × Fin θ) := + {sphereWallPairVertex θ v 0, sphereWallPairVertex θ v 1} + +/-- Distinct contracted pairs have disjoint vertex sets. -/ +theorem sphereWallPair_disjoint {θ : ℕ} {u v : Fin θ × Fin θ} (hne : u ≠ v) : + Disjoint (sphereWallPair θ u) (sphereWallPair θ v) := by + refine disjoint_left.mpr ?_ + intro x hx hy + simp only [sphereWallPair, mem_insert_iff, mem_singleton_iff] at hx hy + rcases hx with rfl | rfl <;> rcases hy with h | h + all_goals + have hi := congrArg (fun z => z.1.val) h + have hj := congrArg Prod.snd h + apply hne + exact Prod.ext (Fin.ext (by simp only [sphereWallPairVertex] at hi; omega)) hj + +/-- The edge contracted within each pair is retained in the wall. -/ +theorem sphereWallPairVertex_adj (θ : ℕ) (v : Fin θ × Fin θ) : + (sphereWallSimpleGraph θ).Adj + (sphereWallPairVertex θ v 0) (sphereWallPairVertex θ v 1) := by + exact Or.inl ⟨rfl, Or.inl (by simp only [sphereWallPairVertex]; omega)⟩ + +/-- For grid edges in one row, choose the edge between successive pairs. +For edges between rows, choose the retained vertical edge. -/ +def sphereWallEdgePair (θ : ℕ) (x y : Fin θ × Fin θ) : + Sym2 (Fin (2 * θ + 1) × Fin θ) := + if x.2 = y.2 then + if x.1.val < y.1.val then + s(sphereWallPairVertex θ x 1, sphereWallPairVertex θ y 0) + else s(sphereWallPairVertex θ x 0, sphereWallPairVertex θ y 1) + else + s(sphereWallPairVertex θ x ⟨min x.2.val y.2.val % 2, Nat.mod_lt _ (by decide)⟩, + sphereWallPairVertex θ y ⟨min x.2.val y.2.val % 2, Nat.mod_lt _ (by decide)⟩) + +/-- The chosen edge does not depend on the order of its ends. -/ +theorem sphereWallEdgePair_symm (θ : ℕ) (x y : Fin θ × Fin θ) : + sphereWallEdgePair θ x y = sphereWallEdgePair θ y x := by + unfold sphereWallEdgePair + by_cases hj : x.2 = y.2 + · rw [ite_eq_left hj, ite_eq_left hj.symm] + rcases lt_trichotomy x.1.val y.1.val with hi | hi | hi + · rw [ite_eq_left hi, ite_eq_right (not_lt_of_gt hi)] + exact Sym2.eq_swap + · have hxy : x = y := Prod.ext (Fin.ext hi) hj + subst y + rfl + · rw [ite_eq_right (not_lt_of_gt hi), ite_eq_left hi] + exact Sym2.eq_swap + · rw [ite_eq_right hj, ite_eq_right (Ne.symm hj)] + simp only [min_comm y.2.val x.2.val] + exact Sym2.eq_swap + +/-- The edge map of the contraction model in XVI (4.2), Claim (1). -/ +def sphereWallGridEdge (θ : ℕ) : + Sym2 (Fin θ × Fin θ) → Sym2 (Fin (2 * θ + 1) × Fin θ) := + Sym2.lift ⟨sphereWallEdgePair θ, sphereWallEdgePair_symm θ⟩ + +/-- Evaluation of the contraction edge map. -/ +theorem sphereWallGridEdge_mk (θ : ℕ) (x y : Fin θ × Fin θ) : + sphereWallGridEdge θ s(x,y) = sphereWallEdgePair θ x y := by rfl + +/-- Projection is a left inverse for the chosen edge map. In particular, +no two edges of the smaller grid use the same wall edge. -/ +theorem sphereWallGridEdge_projection (θ : ℕ) (e : Sym2 (Fin θ × Fin θ)) : + Sym2.map (sphereWallPairProjection θ) (sphereWallGridEdge θ e) = e := by + induction e with + | h x y => + rw [sphereWallGridEdge_mk] + unfold sphereWallEdgePair + split_ifs <;> simp only [Sym2.map_mk, sphereWallPairProjection_vertex] + +/-- The contraction model's edge map is injective. -/ +theorem sphereWallGridEdge_injective (θ : ℕ) : + Function.Injective (sphereWallGridEdge θ) := by + intro e f heq + have h := congrArg (Sym2.map (sphereWallPairProjection θ)) heq + simpa only [sphereWallGridEdge_projection] using h + +/-- Both cases of the edge map give a retained wall edge. -/ +theorem sphereWallGridEdge_mem {θ : ℕ} {e : Sym2 (Fin θ × Fin θ)} + (he : e ∈ E(GM01.gridGraph θ)) : + sphereWallGridEdge θ e ∈ E(sphereWallGraph θ) := by + induction e with + | h x y => + have hxy : (pathGraph θ □ pathGraph θ).Adj x y := he + rw [SimpleGraph.boxProd_adj] at hxy + rw [sphereWallGridEdge_mk] + rcases hxy with ⟨hstep, hj⟩ | ⟨hstep, hi⟩ + · have hj' : x.2 = y.2 := hj + rw [sphereWallEdgePair, ite_eq_left hj'] + rcases SimpleGraph.pathGraph_adj.mp hstep with hstep | hstep + · rw [ite_eq_left (by omega)] + exact Or.inl ⟨hj', Or.inl (by simp only [sphereWallPairVertex]; omega)⟩ + · rw [ite_eq_right (by omega)] + exact Or.inl ⟨hj', Or.inr (by simp only [sphereWallPairVertex]; omega)⟩ + · have hj : x.2 ≠ y.2 := fun h => (SimpleGraph.pathGraph_adj.mp hstep).elim + (fun hs => by have := congrArg Fin.val h; omega) + (fun hs => by have := congrArg Fin.val h; omega) + rw [sphereWallEdgePair, ite_eq_right hj] + refine Or.inr ⟨?_, ?_⟩ + · exact congrArg (fun a : Fin θ => (⟨2 * a.val + min x.2.val y.2.val % 2, + by have := a.isLt; omega⟩ : Fin (2 * θ + 1))) hi + · rcases SimpleGraph.pathGraph_adj.mp hstep with hstep | hstep + · left + refine ⟨hstep, ?_⟩ + rw [Nat.even_iff] + simp only [sphereWallPairVertex] + rw [min_eq_left (by omega)] + omega + · right + refine ⟨hstep, ?_⟩ + rw [Nat.even_iff] + simp only [sphereWallPairVertex] + rw [min_eq_right (by omega)] + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section4WallDrawing.lean b/LeanPool/GraphMinor/GM16/Section4WallDrawing.lean new file mode 100644 index 0000000000..dfb5d9d2d8 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section4WallDrawing.lean @@ -0,0 +1,56 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4Wall +public import LeanPool.GraphMinor.GM16.RectangularGridLines +public import LeanPool.GraphMinor.Surface.TopologyStatements +import LeanPool.GraphMinor.GM16.RectangularGridDrawing +import LeanPool.GraphMinor.GM16.SpherePlaneEmbedding + +/-! +# Drawing the wall in any sphere + +The wall retains all horizontal grid edges and alternate vertical +ones. It is therefore a subgraph of the rectangular grid. Place that +grid's coordinate plane in the sphere and use its unit-line drawing. +The graph isomorphism and all edge closures are kept explicit for the +subdivision and rigidity steps of XVI (4.2), pages 53–54. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph Topology GraphMinor.Surface +universe u + +/-- The alternating-edge wall is a subgraph of its rectangular grid. -/ +theorem sphereWallSimpleGraph_le_rectangular (θ : ℕ) : + sphereWallSimpleGraph θ ≤ pathGraph (2 * θ + 1) □ pathGraph θ := by + intro x y h + rcases h with ⟨hj,hStep⟩ | ⟨hi,hStep⟩ + · exact Or.inl ⟨pathGraph_adj.mpr hStep,hj⟩ + · rcases hStep with ⟨hStep,_⟩ | ⟨hStep,_⟩ + · exact Or.inr ⟨pathGraph_adj.mpr (Or.inl hStep),hi⟩ + · exact Or.inr ⟨pathGraph_adj.mpr (Or.inr hStep),hi⟩ + +/-- The wall drawing used in XVI (4.2), page 53, with its coordinate +embedding, graph isomorphism, and every edge closure specified. -/ +theorem exists_sphereWall_drawing {S : Type u} [TopologicalSpace S] [T2Space S] + (hS : IsSphere S) (θ : ℕ) : + ∃ (j : (ℝ × ℝ) → S) (Γ : GraphDrawing (sphereWallGraph θ) S), + IsEmbedding j ∧ Γ.drawing.V = range (j ∘ @rectangularGridPoint (2 * θ + 1) θ) ∧ + (∀ v : V(sphereWallGraph θ), (Γ.iso.vertexEquiv v).val = j (rectangularGridPoint v.val)) ∧ + (∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val = j '' rectangularGridLine + e.val) := by + obtain ⟨j,hj⟩ := exists_plane_embedding_of_isSphere hS + obtain ⟨Γ,hV,hVertices,hEdges⟩ := exists_rectangularGrid_embedded_drawing + (sphereWallSimpleGraph θ) (sphereWallSimpleGraph_le_rectangular θ) j hj + exact ⟨j,Γ,hj,hV,hVertices,hEdges⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section4WallModel.lean b/LeanPool/GraphMinor/GM16/Section4WallModel.lean new file mode 100644 index 0000000000..2e4647fa6b --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section4WallModel.lean @@ -0,0 +1,173 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4WallContraction +import Mathlib.Combinatorics.Graph.Subgraph + +/-! +# The smaller grid as a minor of the wall + +This verifies the contraction in XVI (4.2), Claim (1), page 53. +The branch sets are the horizontal pairs, and the edge map is the +parity choice from `Section4WallContraction`. The internal pair edge +is different from every chosen grid edge. Thus each pair remains +connected after all chosen edges are removed. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph + +private theorem simpleGraph_inc_iff {α : Type*} (K : SimpleGraph α) (e : Sym2 α) (v : α) : + (Graph.ofSimpleGraph K).Inc e v ↔ e ∈ K.edgeSet ∧ v ∈ e := by + constructor + · rintro ⟨w, he, hmem⟩ + exact ⟨hmem, he ▸ Sym2.mem_mk_left v w⟩ + · rintro ⟨hmem, hv⟩ + obtain ⟨w, he⟩ := Sym2.mem_iff_exists.mp hv + exact ⟨w, he, hmem⟩ + +/-- Each vertex in a pair has that pair's quotient coordinate. -/ +theorem sphereWallPair_projection {θ : ℕ} {v : Fin θ × Fin θ} + {x : Fin (2 * θ + 1) × Fin θ} (hx : x ∈ sphereWallPair θ v) : + sphereWallPairProjection θ x = v := by + rcases hx with rfl | hx + · exact sphereWallPairProjection_vertex θ v 0 + · rw [mem_singleton_iff] at hx + subst x + exact sphereWallPairProjection_vertex θ v 1 + +/-- The chosen wall edge joins one vertex of each pair indexed by its +original grid ends. -/ +theorem sphereWallGridEdge_ends (θ : ℕ) (e : Sym2 (Fin θ × Fin θ)) : + ∃ (u v : Fin θ × Fin θ) (b c : Fin 2), + e = s(u,v) ∧ sphereWallGridEdge θ e = + s(sphereWallPairVertex θ u b, sphereWallPairVertex θ v c) := by + induction e with + | h u v => + rw [sphereWallGridEdge_mk] + unfold sphereWallEdgePair + split_ifs + · exact ⟨u, v, 1, 0, rfl, rfl⟩ + · exact ⟨u, v, 0, 1, rfl, rfl⟩ + · exact ⟨u, v, _, _, rfl, rfl⟩ + +private theorem pairVertex_mem (θ : ℕ) (v : Fin θ × Fin θ) (b : Fin 2) : + sphereWallPairVertex θ v b ∈ sphereWallPair θ v := by + have hb : b = 0 ∨ b = 1 := by + have := b.isLt + rcases Nat.eq_zero_or_pos b.val with h | h + · exact Or.inl (Fin.ext h) + · exact Or.inr (Fin.ext (by omega)) + rcases hb with rfl | rfl + · exact mem_insert _ _ + · exact mem_insert_of_mem _ (mem_singleton _) + +private theorem wallGrid_inc_iff {θ : ℕ} {e : Sym2 (Fin θ × Fin θ)} + (he : e ∈ E(GM01.gridGraph θ)) (v : Fin θ × Fin θ) : + (GM01.gridGraph θ).Inc e v ↔ ∃ x ∈ sphereWallPair θ v, + (sphereWallGraph θ).Inc (sphereWallGridEdge θ e) x := by + obtain ⟨u, w, b, c, heq, hEnds⟩ := sphereWallGridEdge_ends θ e + have hWall := sphereWallGridEdge_mem he + change (Graph.ofSimpleGraph (pathGraph θ □ pathGraph θ)).Inc e v ↔ _ + rw [simpleGraph_inc_iff] + constructor + · rintro ⟨_, hv⟩ + rw [heq, Sym2.mem_iff] at hv + rcases hv with hv | hv + · subst v + refine ⟨sphereWallPairVertex θ u b, pairVertex_mem θ u b, ?_⟩ + exact (simpleGraph_inc_iff _ _ _).mpr ⟨hWall, hEnds ▸ Sym2.mem_mk_left _ _⟩ + · subst v + refine ⟨sphereWallPairVertex θ w c, pairVertex_mem θ w c, ?_⟩ + exact (simpleGraph_inc_iff _ _ _).mpr ⟨hWall, hEnds ▸ Sym2.mem_mk_right _ _⟩ + · rintro ⟨x, hx, hinc⟩ + refine ⟨he, ?_⟩ + have hmem := ((simpleGraph_inc_iff _ _ _).mp hinc).2 + rw [hEnds, Sym2.mem_iff] at hmem + have hproj := sphereWallPair_projection hx + rw [heq, Sym2.mem_iff] + rcases hmem with rfl | rfl + · exact Or.inl ((sphereWallPairProjection_vertex θ u b).symm.trans hproj).symm + · exact Or.inr ((sphereWallPairProjection_vertex θ w c).symm.trans hproj).symm + +/-- The explicit pair contraction used in XVI (4.2), Claim (1), page 53. +The smaller square grid is a minor of the wall. -/ +theorem sphereWall_grid_model (θ : ℕ) : + IsMinorModel (GM01.gridGraph θ) (sphereWallGraph θ) + (sphereWallPair θ) (sphereWallGridEdge θ) := by + refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro v _ + exact ⟨sphereWallPairVertex θ v 0, mem_insert _ _⟩ + · intro v _ + exact subset_univ _ + · intro e he + exact sphereWallGridEdge_mem he + · intro u _ v _ hne + exact sphereWallPair_disjoint hne + · exact (sphereWallGridEdge_injective θ).injOn + · intro v _ e he + exact wallGrid_inc_iff he v + · intro v _ e he + have hnot : ¬ (GM01.gridGraph θ).IsLoopAt e v := by + rintro ⟨heq, hmem⟩ + change e ∈ (pathGraph θ □ pathGraph θ).edgeSet at hmem + rw [heq] at hmem + have hadj : (pathGraph θ □ pathGraph θ).Adj v v := hmem + exact hadj.ne rfl + refine ⟨fun h => (hnot h).elim, ?_⟩ + intro hall + obtain ⟨u, w, b, c, heq, hEnds⟩ := sphereWallGridEdge_ends θ e + have hw := sphereWallGridEdge_mem he + have hU := sphereWallPair_projection (hall _ + ((simpleGraph_inc_iff _ _ _).mpr ⟨hw, hEnds ▸ Sym2.mem_mk_left _ _⟩)) + have hW := sphereWallPair_projection (hall _ + ((simpleGraph_inc_iff _ _ _).mpr ⟨hw, hEnds ▸ Sym2.mem_mk_right _ _⟩)) + rw [sphereWallPairProjection_vertex] at hU hW + have huw : u = w := hU.trans hW.symm + have hmem : e ∈ (pathGraph θ □ pathGraph θ).edgeSet := he + rw [heq, huw] at hmem + have hadj : (pathGraph θ □ pathGraph θ).Adj w w := hmem + exact (hadj.ne rfl).elim + · intro v _ + let K := (sphereWallGraph θ).induce (sphereWallPair θ v) + have hKle : K ≤ (sphereWallGraph θ).deleteEdges + (sphereWallGridEdge θ '' E(GM01.gridGraph θ)) := by + refine ⟨?_, ?_⟩ + · exact subset_univ _ + · intro e x y hlink + refine ⟨hlink.1, ?_⟩ + intro hchosen + have hx := sphereWallPair_projection hlink.2.1 + have hy := sphereWallPair_projection hlink.2.2 + obtain ⟨e₀, he₀, heq⟩ := hchosen + have hexy : e = s(x,y) := hlink.1.1 + have hproj := congrArg (Sym2.map (sphereWallPairProjection θ)) heq + rw [sphereWallGridEdge_projection, hexy, Sym2.map_mk, hx, hy] at hproj + change e₀ ∈ (pathGraph θ □ pathGraph θ).edgeSet at he₀ + rw [hproj] at he₀ + have hadj : (pathGraph θ □ pathGraph θ).Adj v v := he₀ + exact hadj.ne rfl + have hVK : V(K) = sphereWallPair θ v := rfl + refine ⟨K, hKle, hVK, ?_⟩ + refine ⟨⟨sphereWallPairVertex θ v 0, hVK.symm ▸ mem_insert _ _⟩, ?_⟩ + intro x hx y hy + rw [hVK] at hx hy + have hxy : K.Adj (sphereWallPairVertex θ v 0) (sphereWallPairVertex θ v 1) := by + refine ⟨s(sphereWallPairVertex θ v 0, sphereWallPairVertex θ v 1), ?_⟩ + exact ⟨⟨rfl, sphereWallPairVertex_adj θ v⟩, pairVertex_mem θ v 0, pairVertex_mem θ v 1⟩ + simp only [sphereWallPair, mem_insert_iff, mem_singleton_iff] at hx hy + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl + · exact .refl + · exact .single hxy + · exact .single hxy.symm + · exact .refl + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section4WallRowImages.lean b/LeanPool/GraphMinor/GM16/Section4WallRowImages.lean new file mode 100644 index 0000000000..65d76534cf --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section4WallRowImages.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4WallRows +public import LeanPool.GraphMinor.GM16.Section4WallTangle +import LeanPool.GraphMinor.GM10.Section7 + +/-! +# Rows and the contraction in XVI (4.2) + +The surviving edges of a contracted horizontal row come from the +corresponding wall row. A small side of the induced grid tangle cannot +contain a full wall row, since its image would contain a grid column. +X (7.1) then supplies a grid row on that same small side, a contradiction. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Hypergraph GM10 + +/-- Each chosen edge of a horizontal grid path belongs to the same +horizontal wall row. -/ +theorem sphereWallGridEdge_col_subset_row (θ : ℕ) (j : Fin θ) : + sphereWallGridEdge θ '' (gridColPath θ j).edgeSet ⊆ E(sphereWallRow θ j) := by + rintro _ ⟨e, he, rfl⟩ + obtain ⟨u, v, b, c, heq, hEnds⟩ := sphereWallGridEdge_ends θ e + have hAdj : (SimpleGraph.pathGraph θ □ SimpleGraph.pathGraph θ).Adj u v := by + have hmem := he.1 + rw [heq] at hmem + exact hmem + have hu : u.2 = j := he.2 u (by rw [heq]; exact gridHypergraph_inc_sym2.mpr ⟨hAdj, Or.inl rfl⟩) + have hv : v.2 = j := he.2 v (by rw [heq]; exact gridHypergraph_inc_sym2.mpr ⟨hAdj, Or.inr rfl⟩) + have hWall := sphereWallGridEdge_mem he.1 + refine ⟨sphereWallPairVertex θ u b, sphereWallPairVertex θ v c, ?_, hu, hv⟩ + exact ⟨hEnds, hWall⟩ + +/-- A small side of the grid-induced wall tangle includes no complete +horizontal row, as used in XVI (4.2), Claim (1), page 53. -/ +theorem induced_wall_tangle_no_small_row {θ : ℕ} (hθ : 2 ≤ θ) + {N₂ : Graph (Set (Fin (2 * θ + 1) × Fin θ)) + (Sym2 (Fin (2 * θ + 1) × Fin θ))} + (hV₂ : V(N₂).Finite) (hE₂ : E(N₂).Finite) + (hImage : Hypergraph.ofGraph N₂ hV₂ hE₂ = imageHypergraph (sphereWallPair θ) + (sphereWallGridEdge θ) (gridHypergraph θ)) + {A B : Hypergraph (Fin (2 * θ + 1) × Fin θ) (Sym2 (Fin (2 * θ + 1) × Fin θ))} + (hAB : (A, B) ∈ inducedTangle + (Hypergraph.ofGraph (sphereWallGraph θ) (Set.toFinite _) (Set.toFinite _)) + (Hypergraph.ofGraph N₂ hV₂ hE₂) + (imageHypergraphTangle (sphereWallPair θ) (sphereWallGridEdge θ) (gridTangle θ)) θ) + (j : Fin θ) : ¬ E(sphereWallRow θ j) ⊆ A.edgeSet := by + intro hRow + obtain ⟨p, hp, hEdge⟩ := hAB.2.2 + obtain ⟨⟨A₀, B₀⟩, hGrid, hEq⟩ := hp + have hA := congrArg Prod.fst hEq + have hAE : sphereWallGridEdge θ '' A₀.edgeSet = A.edgeSet ∩ E(N₂) := + (congrArg Hypergraph.edgeSet hA).trans hEdge + have hEN : E(N₂) = sphereWallGridEdge θ '' (gridHypergraph θ).edgeSet := + congrArg Hypergraph.edgeSet hImage + have hCol : (gridColPath θ j).edgeSet ⊆ A₀.edgeSet := by + intro e he + have hInA : sphereWallGridEdge θ e ∈ A.edgeSet := + hRow (sphereWallGridEdge_col_subset_row θ j ⟨e, he, rfl⟩) + have hInN : sphereWallGridEdge θ e ∈ E(N₂) := hEN.symm ▸ ⟨e, he.1, rfl⟩ + obtain ⟨e₀, he₀, hMap⟩ := hAE.symm ▸ (show sphereWallGridEdge θ e ∈ A.edgeSet ∩ E(N₂) from + ⟨hInA, hInN⟩) + exact sphereWallGridEdge_injective θ hMap ▸ he₀ + have hSmall : IsSmallEdgeSet θ A₀.edgeSet := hGrid.2.2 + obtain ⟨i, hi⟩ := (GM10.theorem_7_1_proof hθ hGrid.1.left_le.edgeSet_subset hSmall.1).mpr ⟨j, + hCol⟩ + exact hSmall.2 i hi + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section4WallRows.lean b/LeanPool/GraphMinor/GM16/Section4WallRows.lean new file mode 100644 index 0000000000..7640626a35 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section4WallRows.lean @@ -0,0 +1,85 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4Wall +public import LeanPool.GraphMinor.GM16.ConnectedSeparationSide + +/-! +# Uncut rows of the wall in XVI (4.2) + +The horizontal rows are connected and have disjoint vertex sets. +A separator with fewer than `θ` vertices therefore misses some row. +That row, including all its edges, is on one side of the separation. +This is the row-selection step for the tangle in Claim (1), page 53. +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph Hypergraph + +/-- The path `P_j` in the proof of XVI (4.2), page 53. -/ +def sphereWallRow (θ : ℕ) (j : Fin θ) : + Graph (Fin (2 * θ + 1) × Fin θ) (Sym2 (Fin (2 * θ + 1) × Fin θ)) := + (sphereWallGraph θ).induce {x | x.2 = j} + +/-- Every horizontal row is a subgraph of the wall. -/ +theorem sphereWallRow_le (θ : ℕ) (j : Fin θ) : sphereWallRow θ j ≤ sphereWallGraph θ := + (sphereWallGraph θ).induce_le (subset_univ _) + +/-- Horizontal rows remain connected after the alternating deletions. -/ +theorem sphereWallRow_connected (θ : ℕ) (j : Fin θ) : GraphConnected (sphereWallRow θ j) := by + refine ⟨⟨(⟨0, by omega⟩, j), rfl⟩, ?_⟩ + intro x hx y hy + change x.2 = j at hx + change y.2 = j at hy + have hwalk (i k : Fin (2 * θ + 1)) : + Relation.ReflTransGen (sphereWallRow θ j).Adj (i,j) (k,j) := by + obtain ⟨w⟩ := preconnected_pathGraph (2 * θ + 1) i k + induction w with + | nil => exact .refl + | @cons a b c hab w ih => + apply Relation.ReflTransGen.trans ?_ ih + refine .single ⟨s((a,j),(b,j)), ?_⟩ + exact ⟨⟨rfl, Or.inl ⟨rfl, pathGraph_adj.mp hab⟩⟩, rfl, rfl⟩ + have h := hwalk x.1 y.1 + have hxEq : (x.1, j) = x := Prod.ext rfl hx.symm + have hyEq : (y.1, j) = y := Prod.ext rfl hy.symm + rw [hxEq, hyEq] at h + exact h + +/-- A set of fewer than `θ` wall vertices misses a horizontal row. -/ +theorem exists_sphereWallRow_disjoint {θ : ℕ} + (Z : Set (Fin (2 * θ + 1) × Fin θ)) (hZ : Z.ncard < θ) : + ∃ j : Fin θ, Disjoint V(sphereWallRow θ j) Z := by + have hImage : (Prod.snd '' Z).ncard < (Set.univ : Set (Fin θ)).ncard := by + simpa only [ncard_univ, Nat.card_eq_fintype_card, Fintype.card_fin] using + (Set.ncard_image_le (f := Prod.snd) (Set.toFinite Z)).trans_lt hZ + obtain ⟨j, _, hj⟩ := exists_mem_notMem_of_ncard_lt_ncard hImage + refine ⟨j, disjoint_left.mpr ?_⟩ + intro x hx hz + exact hj ⟨x, hz, hx⟩ + +/-- Every separation of order less than `θ` has an uncut row on one side. -/ +theorem sphereWall_separation_has_row {θ : ℕ} + {A B : Hypergraph (Fin (2 * θ + 1) × Fin θ) + (Sym2 (Fin (2 * θ + 1) × Fin θ))} + (hSep : (Hypergraph.ofGraph (sphereWallGraph θ) (Set.toFinite _) (Set.toFinite _)).IsSeparation + A B) + (hOrd : separationOrder A B < θ) : + ∃ j : Fin θ, (E(sphereWallRow θ j) ⊆ A.edgeSet) ∨ + (E(sphereWallRow θ j) ⊆ B.edgeSet) := by + obtain ⟨j, hj⟩ := exists_sphereWallRow_disjoint (A.vertexSet ∩ B.vertexSet) hOrd + refine ⟨j, ?_⟩ + rcases connected_subgraph_in_one_side (Set.toFinite _) (Set.toFinite _) hSep + (sphereWallRow_le θ j) (sphereWallRow_connected θ j) hj with hA | hB + · exact Or.inl hA.2 + · exact Or.inr hB.2 + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section4WallTangle.lean b/LeanPool/GraphMinor/GM16/Section4WallTangle.lean new file mode 100644 index 0000000000..fa4fbd0370 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section4WallTangle.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4WallModel +public import LeanPool.GraphMinor.GM16.HypergraphImageTangle +public import LeanPool.GraphMinor.GM10.Defs2 +import LeanPool.GraphMinor.GM16.ModelContractionMaps +import LeanPool.GraphMinor.GM16.GraphIsoImage +import LeanPool.GraphMinor.GM10.Section6 +import LeanPool.GraphMinor.GM10.Section7 + +/-! +# The grid-induced tangle in the wall + +In Claim (1) of XVI (4.2), page 53, contract the horizontal pairs of +the wall to obtain a square grid. X (7.3) supplies its tangle. Relabel +that tangle by the actual contraction maps, then apply X (6.1) to +induce a tangle of the same order in the wall. All the maps remain +explicit, so the chosen row edges can be compared in the next step. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Hypergraph GM10 + +/-- The contracted pair sets distinguish the grid vertices. -/ +theorem sphereWallPair_injective (θ : ℕ) : Function.Injective (sphereWallPair θ) := by + intro u v heq + by_contra hne + have hx : sphereWallPairVertex θ u 0 ∈ sphereWallPair θ u := mem_insert _ _ + have hy : sphereWallPairVertex θ u 0 ∈ sphereWallPair θ v := heq ▸ hx + exact (disjoint_left.mp (sphereWallPair_disjoint hne)) hx hy + +/-- The induced tangle construction in XVI (4.2), Claim (1), page 53. +The literal minor has the given pair sets and chosen edge names. -/ +theorem exists_induced_wall_tangle (θ : ℕ) (hθ : 2 ≤ θ) : + ∃ (N₂ : Graph (Set (Fin (2 * θ + 1) × Fin θ)) + (Sym2 (Fin (2 * θ + 1) × Fin θ))) + (hV₂ : V(N₂).Finite) (hE₂ : E(N₂).Finite), + IsMinor N₂ (sphereWallGraph θ) ∧ + Hypergraph.ofGraph N₂ hV₂ hE₂ = imageHypergraph (sphereWallPair θ) + (sphereWallGridEdge θ) (gridHypergraph θ) ∧ + IsTangle (Hypergraph.ofGraph N₂ hV₂ hE₂) θ + (imageHypergraphTangle (sphereWallPair θ) (sphereWallGridEdge θ) (gridTangle θ)) ∧ + IsTangle (Hypergraph.ofGraph (sphereWallGraph θ) (Set.toFinite _) (Set.toFinite _)) θ + (inducedTangle (Hypergraph.ofGraph (sphereWallGraph θ) (Set.toFinite _) (Set.toFinite _)) + (Hypergraph.ofGraph N₂ hV₂ hE₂) + (imageHypergraphTangle (sphereWallPair θ) (sphereWallGridEdge θ) (gridTangle θ)) θ) := by + classical + obtain ⟨G', hG', C, hC, φ, hv, he⟩ := exists_contraction_realizing_model (sphereWall_grid_model θ) + let N₂ := contract G' C + have hV₂ : V(N₂).Finite := by + let : Finite (V(GM01.gridGraph θ)) := Set.toFinite _ |>.to_subtype + let : Finite (V(N₂)) := Finite.of_equiv _ φ.vertexEquiv + exact Set.toFinite _ + have hE₂ : E(N₂).Finite := by + let : Finite (E(GM01.gridGraph θ)) := Set.toFinite _ |>.to_subtype + let : Finite (E(N₂)) := Finite.of_equiv _ φ.edgeEquiv + exact Set.toFinite _ + have hMinor : IsMinor N₂ (sphereWallGraph θ) := ⟨G', hG', C, hC, rfl⟩ + have hImage : Hypergraph.ofGraph N₂ hV₂ hE₂ = + imageHypergraph (sphereWallPair θ) (sphereWallGridEdge θ) (gridHypergraph θ) := by + exact (imageHypergraph_of_iso (Set.toFinite _) (Set.toFinite _) hV₂ hE₂ φ + (sphereWallPair θ) (sphereWallGridEdge θ) hv he).symm + have hT₂ : IsTangle (Hypergraph.ofGraph N₂ hV₂ hE₂) θ + (imageHypergraphTangle (sphereWallPair θ) (sphereWallGridEdge θ) (gridTangle θ)) := by + rw [hImage] + exact isTangle_imageHypergraphTangle _ _ (sphereWallPair_injective θ) + (sphereWallGridEdge_injective θ) (GM10.theorem_7_3_proof hθ) + exact ⟨N₂, hV₂, hE₂, hMinor, hImage, hT₂, + GM10.theorem_6_1_proof (Set.toFinite _) (Set.toFinite _) hV₂ hE₂ hMinor hθ hT₂⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section5.lean b/LeanPool/GraphMinor/GM16/Section5.lean new file mode 100644 index 0000000000..15ae690ce6 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section5.lean @@ -0,0 +1,288 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4 +import LeanPool.GraphMinor.GM16.Metric + +import LeanPool.GraphMinor.GM12.Bridge + +/-! +# Graph Minors XVI, Section 5: Induction on Horns + +This file formalizes Section 5 ("Induction on horns", pages 54–58) of +N. Robertson and P. D. Seymour, *Graph Minors. XVI. Excluding a non-planar graph*, J. Combin. +Theory Ser. B 89 (2003) 43–76: + +- Statements of **Graph Minors XVI, (5.1)** (`GM16Theorem51Statement`, page 55), + **(5.2)** (`GM16Theorem52Statement`, page 55), + **(5.3)** (`GM16Theorem53Statement`, page 56), + **(5.4)** (`GM16Theorem54Statement`, page 56), and + **(5.5)** (`GM16Theorem55Statement`, page 57). +- Proof of **Graph Minors XVI, (5.2)** (`theorem_5_2`, page 55), deduced from + `GM12Theorem44Statement` and `controlsMinor_of_gm12`. +- Monotonicity lemmas for horns and animals (`IsHorn.mono`, `IsAnimal.mono`, `HasAnimal.mono`, + `HasHairlessAnimal.mono`) and existence of a hairless animal with `0` horns from a `Σ`-span + (`hasHairlessAnimal_zero_of_isSigmaSpan`). +- Proof of **Graph Minors XVI, (4.1)** (`theorem_4_1`, page 58) from `(5.1)` and `(5.5)` by + induction on the number of horns `0 ≤ i ≤ μ = p * (p - 1) / 2`. +The backward and tower inductions are proved in `InductionsProved.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM16 + +open Set Function Topology +open Graph SimpleGraph Hypergraph +open GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 GraphMinor.GM15 + +universe u v w + +variable {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + +/-! ## Monotonicity of Horns and Animals -/ + +omit [T2Space S] in +/-- Monotonicity of `IsHorn`: a horn of cardinality `σ₁` and breadth `≥ θ₁` restricts to a horn of +cardinality `σ₂ ≤ σ₁` and breadth `≥ θ₂ ≤ θ₁`. -/ +theorem IsHorn.mono {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {d : Set S → Set S → ℕ} {v : α} {θ₁ σ₁ θ₂ σ₂ : ℕ} + {P : Fin σ₁ → Graph α β} {u : Fin σ₁ → S} + (h : IsHorn G H η d v θ₁ σ₁ P u) (hθ : θ₂ ≤ θ₁) (hσ : σ₂ ≤ σ₁) : + IsHorn G H η d v θ₂ σ₂ (fun i => P ⟨i.1, by omega⟩) (fun i => u ⟨i.1, by omega⟩) := by + rcases h with ⟨hv, hu, hP, hinter_H, hinter_P, hdist⟩ + refine ⟨hv, fun i => hu ⟨i.1, by omega⟩, fun i => hP ⟨i.1, by omega⟩, + fun i => hinter_H ⟨i.1, by omega⟩, ?_, ?_⟩ + · intro i j hij + exact hinter_P ⟨i.1, by omega⟩ ⟨j.1, by omega⟩ (fun h_eq => hij (Fin.ext (Fin.mk.inj h_eq))) + · intro i j hij + exact hθ.trans (hdist ⟨i.1, by omega⟩ ⟨j.1, by omega⟩ + (fun h_eq => hij (Fin.ext (Fin.mk.inj h_eq)))) + +/-- Monotonicity of `IsAnimal` in strength `(θ, σ)`: an animal of strength `≥ (θ₁, σ₁)` has +strength `≥ (θ₂, σ₂)` whenever `1 ≤ θ₂ ≤ θ₁` and `σ₂ ≤ σ₁`. -/ +theorem IsAnimal.mono {G : Graph α β} + {T_star : Set (Hypergraph α β × Hypergraph α β)} {θ_star : ℕ} + {H : Drawing S} {η : SpanEmbedding H G} {θ_span : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {X : Set α} {Y : Set S} + {χ δ θ₁ σ₁ θ₂ σ₂ : ℕ} + (h : IsAnimal G T_star θ_star H η θ_span T d X Y χ δ θ₁ σ₁) + (hθ₂_pos : 1 ≤ θ₂) (hθ : θ₂ ≤ θ₁) (hσ : σ₂ ≤ σ₁) : + IsAnimal G T_star θ_star H η θ_span T d X Y χ δ θ₂ σ₂ := by + rcases h with ⟨_, hθ₁_span, hSpan, hMet, hX_sub, hX_card, hY_sub, hY_card, hHorns, hHairs, + hY_dist⟩ + refine ⟨hθ₂_pos, hθ.trans hθ₁_span, hSpan, hMet, hX_sub, hX_card, hY_sub, hY_card, ?_, ?_, ?_⟩ + · intro v hv + obtain ⟨P, u, hHorn⟩ := hHorns v hv + exact ⟨_, _, hHorn.mono hθ hσ⟩ + · intro u hu + obtain ⟨v, P, hv, huv, hP, hdisj, hd⟩ := hHairs u hu + exact ⟨v, P, hv, huv, hP, hdisj, hθ.trans hd⟩ + · intro u₁ hu₁ u₂ hu₂ hne + exact hθ.trans (hY_dist u₁ hu₁ u₂ hu₂ hne) + +/-- Monotonicity of `HasAnimal` in strength `(θ, σ)`. -/ +theorem HasAnimal.mono {G : Graph α β} + {T_star : Set (Hypergraph α β × Hypergraph α β)} {θ_star : ℕ} + {χ δ θ₁ σ₁ θ₂ σ₂ : ℕ} + (h : HasAnimal S G T_star θ_star χ δ θ₁ σ₁) + (hθ₂_pos : 1 ≤ θ₂) (hθ : θ₂ ≤ θ₁) (hσ : σ₂ ≤ σ₁) : + HasAnimal S G T_star θ_star χ δ θ₂ σ₂ := by + obtain ⟨H, η, θ_span, T, d, X, Y, hAnim⟩ := h + exact ⟨H, η, θ_span, T, d, X, Y, hAnim.mono hθ₂_pos hθ hσ⟩ + +/-- Monotonicity of `HasHairlessAnimal` in strength `(θ, σ)`. -/ +theorem HasHairlessAnimal.mono {G : Graph α β} + {T_star : Set (Hypergraph α β × Hypergraph α β)} {θ_star : ℕ} + {χ θ₁ σ₁ θ₂ σ₂ : ℕ} + (h : HasHairlessAnimal S G T_star θ_star χ θ₁ σ₁) + (hθ₂_pos : 1 ≤ θ₂) (hθ : θ₂ ≤ θ₁) (hσ : σ₂ ≤ σ₁) : + HasHairlessAnimal S G T_star θ_star χ θ₂ σ₂ := + HasAnimal.mono h hθ₂_pos hθ hσ + +/-- Any `Σ`-span `(H, η, T)` of order `θ_span ≥ θ ≥ 1` with metric `d` yields a hairless animal +with `0` horns and strength `≥ (θ, σ)` for every `σ ≥ 0` (Graph Minors XVI, Section 5, page 58). -/ +theorem hasHairlessAnimal_zero_of_isSigmaSpan {G : Graph α β} + {T_star : Set (Hypergraph α β × Hypergraph α β)} {θ_star θ_span θ σ : ℕ} + {H : Drawing S} {η : SpanEmbedding H G} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hθ_pos : 1 ≤ θ) (hθ_le : θ ≤ θ_span) + (hSpan : IsSigmaSpan G H η θ_star θ_span T_star T) + (hMet : HasTangleMetric H θ_span T d) : + HasHairlessAnimal S G T_star θ_star 0 θ σ := by + refine ⟨H, η, θ_span, T, d, ∅, ∅, hθ_pos, hθ_le, hSpan, hMet, + empty_subset _, ncard_empty α, empty_subset _, ncard_empty S, ?_, ?_, ?_⟩ + · intro _ hv; exact False.elim hv + · intro _ hu; exact False.elim hu + · intro _ hu₁; exact False.elim hu₁ + +/-! ## Statements of (5.1), (5.2), (5.3), (5.4), and (5.5) (pages 55–57) -/ + +/-- Statement of Graph Minors XVI, (5.1) (page 55): +"Let $\Sigma$ be a surface and let $p, \tau, \chi \ge 0$ and $\phi, \psi \ge 1$. Then there exist +$\sigma, \kappa, \rho, \zeta \ge 0$ and $\theta \ge 1$ such that if $\mathscr{T}^*$ is a tangle in a +graph $G$, and there is a hairless animal with $\chi$ horns, of strength $\ge (\theta, \sigma)$, +then either: +1. there is a $\Sigma'$-span of order $\ge \phi$, for some surface $\Sigma'$ obtained from $\Sigma$ + by adding a handle or a crosscap, or +2. there is a hairless animal with $\chi + 1$ horns, of strength $\ge (\psi, \tau)$, or +3. there exists $Z \subseteq V(G)$ with $|Z| \le \zeta$, and a $\mathscr{T}^* \setminus Z$-central + segregation of $G \setminus Z$ of type $(\rho, \kappa)$ with a proper arrangement in $\Sigma$, or +4. $\mathscr{T}^*$ controls a $K_p$-minor of $G$." -/ +def GM16Theorem51Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ p τ χ φ ψ : ℕ, 1 ≤ φ → 1 ≤ ψ → + ∃ σ κ ρ ζ θ : ℕ, 1 ≤ θ ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (hT : IsGraphTangle G θ_star T_star), + HasHairlessAnimal S G T_star θ_star χ θ σ → + (∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S') + (H' : Drawing S') (η' : SpanEmbedding H' G) (θ_span' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsClosedSurface S' ∧ ConnectedSpace S' ∧ + IsObtainedByAddingHandleOrCrosscap S S' ∧ + φ ≤ θ_span' ∧ IsSigmaSpan G H' η' θ_star θ_span' T_star T') ∨ + HasHairlessAnimal S G T_star θ_star (χ + 1) ψ τ ∨ + (∃ (Z : Set α) (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) (α_pt : α → S), + Z ⊆ V(G) ∧ Z.ncard ≤ ζ ∧ Z.ncard < θ_star ∧ + IsCentralSegregation (deleteVertices G Z) + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star) S_seg ∧ + IsSegregationOfType (deleteVertices G Z) ρ κ S_seg ∧ + IsProperArrangement S_seg α_disc α_pt) ∨ + ControlsMinor G (completeGraph p) T_star + +/-- Statement of Graph Minors XVI, (5.2) (page 55): +"Let $\Sigma$ be a surface and let $p \ge 0$. Then there exists $\theta \ge 1$ such that if +$\mathscr{T}^*$ is a tangle in a graph $G$, and $H, \eta, \mathscr{T}$ is a $\Sigma$-span of order +$\ge \theta$ with metric $d$, and +* $s_1, t_1, \dots, s_\mu, t_\mu$ are distinct vertices of $H$, where $\mu = \frac{1}{2}p(p - 1)$, + such that $d(u, v) \ge \theta$ for all distinct $u, v \in \{s_1, t_1, \dots, s_\mu, t_\mu\}$, and +* $Q_1, \dots, Q_\mu$ are mutually disjoint $\eta(H)$-paths, such that $Q_i$ has ends + $\eta(s_i), \eta(t_i) (1 \le i \le \mu)$, +then $\mathscr{T}^*$ controls a $K_p$-minor of $G$." -/ +def GM16Theorem52Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ p : ℕ, ∃ θ : ℕ, 1 ≤ θ ∧ + let μ := p * (p - 1) / 2 + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star θ_span : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) + (s t : Fin μ → S) (Q : Fin μ → Graph α β), + IsSigmaSpan G H η θ_star θ_span T_star T → + HasTangleMetric H θ_span T d → + θ ≤ θ_span → + (∀ i : Fin μ, s i ∈ H.V ∧ t i ∈ H.V ∧ s i ≠ t i) → + Injective s → Injective t → Disjoint (range s) (range t) → + (∀ u ∈ range s ∪ range t, ∀ v ∈ range s ∪ range t, u ≠ v → θ ≤ d {u} {v}) → + (∀ i : Fin μ, IsHPathWithEnds G η.imageGraph (Q i) (η.vMap (s i)) (η.vMap (t i))) → + Pairwise (fun i j => Disjoint V(Q i) V(Q j)) → + ControlsMinor G (completeGraph p) T_star + +/-- **Graph Minors XVI, (5.2)** (page 55, citing Graph Minors XII, (4.4)): +"Let $\Sigma$ be a surface and let $p \ge 0$. Then there exists $\theta \ge 1$ such that if +$\mathscr{T}^*$ is a tangle in a graph $G$, and $H, \eta, \mathscr{T}$ is a $\Sigma$-span of order +$\ge \theta$ with metric $d$, and +* $s_1, t_1, \dots, s_\mu, t_\mu$ are distinct vertices of $H$, where $\mu = \frac{1}{2}p(p - 1)$, + such that $d(u, v) \ge \theta$ for all distinct $u, v \in \{s_1, t_1, \dots, s_\mu, t_\mu\}$, and +* $Q_1, \dots, Q_\mu$ are mutually disjoint $\eta(H)$-paths, such that $Q_i$ has ends + $\eta(s_i), \eta(t_i) (1 \le i \le \mu)$, +then $\mathscr{T}^*$ controls a $K_p$-minor of $G$." -/ +theorem theorem_5_2_proof : + GM16Theorem52Statement.{u, v, w} := by + intro S _ _ hS hconn p + obtain ⟨θ, hθ1, hprop⟩ := GraphMinor.GM12.gm16_theorem44.{u, v, w} hS hconn p + refine ⟨θ, hθ1, fun G θ_star θ_span T_star H η T d s t Q hSpan hMet hθ hst hs ht hdisj_st hd hQ + hdisj_Q => ?_⟩ + exact controlsMinor_of_gm12 (hprop G θ_star θ_span T_star H η T d s t Q hSpan hMet hθ hst hs ht + hdisj_st hd hQ hdisj_Q) + +/-- Statement of Graph Minors XVI, (5.3) (page 56): +"Let $G$ be a graph and let $Y \subseteq V(G)$, such that no component of $G$ contains exactly one +vertex in $Y$. If $\mu, \tau \ge 0$ are integers and $|Y| > \tau(\mu - 1)$, then either: +* there are $\mu$ disjoint paths of $G$ each with both ends distinct and in $Y$ and with no internal + vertex in $Y$, or +* there exist $v \in V(G)$ and $\tau$ paths $P_1, \dots, P_\tau$ of $G$, with ends + $v, u_i (1 \le i \le \tau)$ respectively, mutually disjoint except for $v$, and such that for + $1 \le i \le \tau, u_i \in Y$ and $u_i \ne v$, and no internal vertex of $P_i$ is in $Y$." -/ +def GM16Theorem53Statement : Prop := + ∀ {α : Type u} {β : Type v} (G : Graph α β) (Y : Set α) (μ τ : ℕ), + V(G).Finite → E(G).Finite → Y ⊆ V(G) → + (∀ y ∈ Y, ∃ y' ∈ Y, y' ≠ y ∧ Relation.ReflTransGen G.Adj y y') → + τ * (μ - 1) < Y.ncard → + (∃ (P : Fin μ → Graph α β) (s t : Fin μ → α), + Pairwise (fun i j => Disjoint V(P i) V(P j)) ∧ + ∀ i : Fin μ, s i ∈ Y ∧ t i ∈ Y ∧ s i ≠ t i ∧ + IsGraphPathWithEnds G (P i) (s i) (t i) ∧ + V(P i) ∩ Y = {s i, t i}) ∨ + (∃ (v : α) (P : Fin τ → Graph α β) (u : Fin τ → α), + v ∈ V(G) ∧ + (∀ i j : Fin τ, i ≠ j → V(P i) ∩ V(P j) = {v} ∧ Disjoint E(P i) E(P j)) ∧ + ∀ i : Fin τ, u i ∈ Y ∧ u i ≠ v ∧ + IsGraphPathWithEnds G (P i) v (u i) ∧ + V(P i) ∩ Y ⊆ {v, u i}) + +/-- Statement of Graph Minors XVI, (5.4) (page 56): +"Let $G$ be a graph, and let $v \in V(G)$. For $1 \le i \le n$ let $P_i$ be a path of $G$ +with distinct ends $v, u_i$, such that $P_1, \dots, P_n$ are mutually disjoint except for +$v$. Let $Q_1, \dots, Q_m$ be mutually disjoint paths of $G$, not passing through $v$, such +that $Q_i$ has ends $s_i, t_i$ for $1 \le i \le m$. Let* $$Z = \{u_1, \dots, u_n, s_1, t_1, +\dots, s_m, t_m\}.$$ *If $n \ge 5m + 2$, there are $m + 1$ mutually disjoint paths of $G$, +each with distinct ends both in $Z$." + +We require `s j ≠ t j` for every `j`. The printed statement omits this, +but its proof on page 57 uses that each `Q_j` has at least two vertices in +`Z`. This corrects the singleton-path counterexample. In the use in (5.5), +the `Q_j` are `H`-paths, whose ends are distinct by the definition in +Graph Minors XIV. -/ +def GM16Theorem54Statement : Prop := + ∀ {α : Type u} {β : Type v} (G : Graph α β) (v : α) (n m : ℕ) + (P : Fin n → Graph α β) (u : Fin n → α) + (Q : Fin m → Graph α β) (s t : Fin m → α), + V(G).Finite → E(G).Finite → v ∈ V(G) → + (∀ i : Fin n, u i ≠ v ∧ IsGraphPathWithEnds G (P i) v (u i)) → + (∀ i j : Fin n, i ≠ j → V(P i) ∩ V(P j) = {v} ∧ Disjoint E(P i) E(P j)) → + (∀ j : Fin m, v ∉ V(Q j) ∧ IsGraphPathWithEnds G (Q j) (s j) (t j)) → + (∀ j : Fin m, s j ≠ t j) → + Pairwise (fun i j => Disjoint V(Q i) V(Q j)) → + 5 * m + 2 ≤ n → + let Z := range u ∪ range s ∪ range t + ∃ (R : Fin (m + 1) → Graph α β) (a b : Fin (m + 1) → α), + Pairwise (fun i j => Disjoint V(R i) V(R j)) ∧ + ∀ i : Fin (m + 1), a i ∈ Z ∧ b i ∈ Z ∧ a i ≠ b i ∧ + IsGraphPathWithEnds G (R i) (a i) (b i) + +/-- Statement of Graph Minors XVI, (5.5) (page 57): +"For any surface $\Sigma$ and integer $p \ge 0$, there exists $\theta \ge 1$ such that, if +$\mathscr{T}^*$ is a tangle in a graph $G$ and there is a hairless animal with +$\frac{1}{2}p(p - 1)$ horns and with strength $\ge (\theta, 4p(p - 1))$, then $\mathscr{T}^*$ +controls a $K_p$-minor of $G$." -/ +def GM16Theorem55Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ p : ℕ, ∃ θ : ℕ, 1 ≤ θ ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)), + IsGraphTangle G θ_star T_star → + HasHairlessAnimal S G T_star θ_star (p * (p - 1) / 2) θ (4 * p * (p - 1)) → + ControlsMinor G (completeGraph p) T_star + +/-! ## Proof of Graph Minors XVI, (4.1) from (5.1) and (5.5) (page 58) -/ + + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section5Connections.lean b/LeanPool/GraphMinor/GM16/Section5Connections.lean new file mode 100644 index 0000000000..11693776f7 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section5Connections.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section5 +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Connections after removing the common start in XVI (5.4) + +A spoke meeting a path that avoids its start joins its other end to +both ends of that path after the common start is removed. At least one +of those two ends differs from the spoke end. This identifies the spokes +that avoid all the given paths in the last paragraph of (5.4). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 +universe u v + +/-- A graph walk witnesses reachability for the adjacency relation. -/ +theorem graphWalk_adj_reachable + {α : Type u} {β : Type v} {G : Graph α β} {a b : α} + (W : GraphWalk G a b) : Relation.ReflTransGen G.Adj a b := by + induction W with + | nil _ => exact .refl + | cons he W ih => exact .head ⟨_, he⟩ ih + +/-- A path in a graph supplies a walk in that graph. -/ +theorem graphPath_exists_walk + {α : Type u} {β : Type v} {G P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) : Nonempty (GraphWalk G a b) := by + obtain ⟨hPG, W, _, _, _⟩ := hP + obtain ⟨W', _, _⟩ := exists_walk_up_of_le hPG W + exact ⟨W'⟩ + +/-- A suffix of a path, starting after its first vertex, avoids that +first vertex. Split the path at the new starting vertex. -/ +theorem path_suffix_avoids_start + {α : Type u} {β : Type v} {G P : Graph α β} {a b w : α} + (hP : IsGraphPathWithEnds G P a b) (hw : w ∈ V(P)) (hwa : w ≠ a) : + ∃ R : Graph α β, R ≤ P ∧ IsGraphPathWithEnds G R w b ∧ a ∉ V(R) := by + obtain ⟨L, R, _, hRP, hL, hR, _, hinter, _⟩ := hP.exists_split_at hw + refine ⟨R, hRP, hR.mono hP.le, ?_⟩ + intro haR + have hamem : a ∈ ({w} : Set α) := hinter ▸ ⟨hL.left_mem, haR⟩ + have haw := mem_singleton_iff.mp hamem + exact hwa haw.symm + +/-- The connection used in XVI (5.4), page 57. If a spoke meets a path +with two different ends that avoids the common start, its other end is +joined to a different end of that path after the common start is deleted. -/ +theorem spoke_end_reaches_other_marked_end + {α : Type u} {β : Type v} {G P Q : Graph α β} {v a s t : α} + (hP : IsGraphPathWithEnds G P v a) + (hQ : IsGraphPathWithEnds G Q s t) (hst : s ≠ t) + (hvQ : v ∉ V(Q)) (hmeet : (V(P) ∩ V(Q)).Nonempty) : + ∃ z ∈ ({s, t} : Set α), z ≠ a ∧ + Nonempty (GraphWalk (deleteVertices G {v}) a z) := by + classical + obtain ⟨w, hwP, hwQ⟩ := hmeet + have hwv : w ≠ v := fun h => hvQ (h ▸ hwQ) + obtain ⟨R, _, hR, hvR⟩ := path_suffix_avoids_start hP hwP hwv + have hRD : IsGraphPathWithEnds (deleteVertices G {v}) R w a := + hR.in_deleteVertices (Set.disjoint_singleton_left.mpr hvR) + have hQD : IsGraphPathWithEnds (deleteVertices G {v}) Q s t := + hQ.in_deleteVertices (Set.disjoint_singleton_left.mpr hvQ) + have hreach : ∀ z ∈ V(Q), Nonempty (GraphWalk (deleteVertices G {v}) a z) := by + intro z hz + obtain ⟨L, _, _, hL⟩ := hQD.exists_subpath hwQ hz + obtain ⟨W₁⟩ := graphPath_exists_walk hRD.symm + obtain ⟨W₂⟩ := graphPath_exists_walk hL + exact ⟨W₁.append W₂⟩ + by_cases hsa : s = a + · refine ⟨t, mem_insert_of_mem s (mem_singleton t), ?_, hreach t hQ.right_mem⟩ + exact fun hta => hst (hsa.trans hta.symm) + · exact ⟨s, mem_insert s {t}, hsa, hreach s hQ.left_mem⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section5Degree.lean b/LeanPool/GraphMinor/GM16/Section5Degree.lean new file mode 100644 index 0000000000..6befc511e0 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section5Degree.lean @@ -0,0 +1,224 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section5 +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Walks + +/-! +# The degree bounds in XVI (5.4) + +A path has at most one neighbor at either end and at most two neighbors +at any vertex. Splitting at the vertex reduces the latter fact to the +former. These bounds exclude a fan of five paths in the union of the +spokes and the disjoint paths away from the common start. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 +universe u v + +/-- An end of a path has at most one neighbor in the path. -/ +theorem path_start_neighbors_subsingleton + {α : Type u} {β : Type v} {G P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) : {z | P.Adj a z}.Subsingleton := by + obtain ⟨_, W, hsimple, _, hE⟩ := hP + cases W with + | nil ha => + intro z hz + obtain ⟨e, he⟩ := hz + have heE := he.edge_mem + rw [hE] at heE + have : e ∈ ([] : List β) := heE + exact False.elim (List.not_mem_nil this) + | @cons a c b e he W => + have haW : a ∉ W.support := (List.nodup_cons.mp hsimple).1 + have hneighbor : ∀ z, P.Adj a z → z = c := by + intro z ⟨f, hf⟩ + have hfE := hf.edge_mem + rw [hE] at hfE + change f ∈ e :: W.edges at hfE + rcases List.mem_cons.mp hfE with rfl | hfE + · exact hf.right_unique he + · exact False.elim (haW (walk_isLink_mem_support W hfE hf).1) + intro z hz z' hz' + exact (hneighbor z hz).trans (hneighbor z' hz').symm + +/-- Every vertex of a path has at most two neighbors in it. This is the +path degree bound used in XVI (5.4), page 56. -/ +theorem path_neighbors_ncard_le_two + {α : Type u} {β : Type v} {G P : Graph α β} {a b x : α} + (hP : IsGraphPathWithEnds G P a b) : {z | P.Adj x z}.ncard ≤ 2 := by + classical + by_cases hx : x ∈ V(P) + · obtain ⟨P₁, P₂, h₁, h₂, hp₁, hp₂, hunion, _, _⟩ := hP.exists_split_at hx + have hs₁ := path_start_neighbors_subsingleton hp₁.symm + have hs₂ := path_start_neighbors_subsingleton hp₂ + have heq : {z | P.Adj x z} = {z | P₁.Adj x z} ∪ {z | P₂.Adj x z} := by + ext z + rw [← hunion] + constructor + · rintro ⟨e, he⟩ + rcases (subgraphUnion_isLink h₁ h₂).mp he with h | h + · exact Or.inl ⟨e, h⟩ + · exact Or.inr ⟨e, h⟩ + · rintro (⟨e, he⟩ | ⟨e, he⟩) + · exact ⟨e, (subgraphUnion_isLink h₁ h₂).mpr (Or.inl he)⟩ + · exact ⟨e, (subgraphUnion_isLink h₁ h₂).mpr (Or.inr he)⟩ + rw [heq] + have hc₁ := (ncard_le_one hs₁.finite).mpr (fun _ ha _ hb => hs₁ ha hb) + have hc₂ := (ncard_le_one hs₂.finite).mpr (fun _ ha _ hb => hs₂ ha hb) + have hc := ncard_union_le {z | P₁.Adj x z} {z | P₂.Adj x z} + omega + · have heq : {z | P.Adj x z} = ∅ := by + apply Set.eq_empty_iff_forall_notMem.mpr + rintro z ⟨e, he⟩ + exact hx he.left_mem + rw [heq, ncard_empty] + exact Nat.zero_le _ + +/-- In a union of paths, a vertex belonging to at most one member +has at most two neighbors. -/ +theorem path_family_neighbors_ncard_le_two + {α : Type u} {β : Type v} {ι : Type*} {G : Graph α β} + {P : ι → Graph α β} {a b : ι → α} {x : α} + (hP : ∀ i, IsGraphPathWithEnds G (P i) (a i) (b i)) + (hunique : ∀ i j, x ∈ V(P i) → x ∈ V(P j) → i = j) : + {z | (subgraphSUnion G (range P)).Adj x z}.ncard ≤ 2 := by + classical + let H := subgraphSUnion G (range P) + have hPG : ∀ R ∈ range P, R ≤ G := by + rintro R ⟨i, rfl⟩ + exact (hP i).le + have hHG : H ≤ G := subgraphSUnion_le hPG + have hmem : ∀ z, H.Adj x z → ∃ i, (P i).Adj x z := by + intro z ⟨e, he⟩ + have heE := he.edge_mem + rw [edgeSet_subgraphSUnion hPG] at heE + obtain ⟨R, ⟨i, rfl⟩, hei⟩ := mem_iUnion₂.mp heE + exact ⟨i, e, ((hP i).le.isLink_iff hei).mpr (he.mono hHG)⟩ + by_cases hex : ∃ i, x ∈ V(P i) + · obtain ⟨i, hxi⟩ := hex + have hsub : {z | H.Adj x z} ⊆ {z | (P i).Adj x z} := by + intro z hz + obtain ⟨j, hj⟩ := hmem z hz + obtain ⟨e, he⟩ := hj + have hji := hunique j i he.left_mem hxi + subst j + exact ⟨e, he⟩ + have hfin : {z | (P i).Adj x z}.Finite := (hP i).vertexSet_finite.subset + (by rintro z ⟨e, he⟩; exact he.right_mem) + exact (ncard_le_ncard hsub hfin).trans (path_neighbors_ncard_le_two (hP i)) + · have heq : {z | H.Adj x z} = ∅ := by + apply Set.eq_empty_iff_forall_notMem.mpr + intro z hz + obtain ⟨i, e, he⟩ := hmem z hz + exact hex ⟨i, he.left_mem⟩ + rw [heq, ncard_empty] + exact Nat.zero_le _ + +/-- A path with distinct ends has a neighbor different from its first +end. This follows from its first edge and its simple vertex list. -/ +theorem path_exists_neighbor_at_start + {α : Type u} {β : Type v} {G P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) (hab : a ≠ b) : + ∃ y, P.Adj a y ∧ y ≠ a := by + obtain ⟨_, W, hsimple, _, _⟩ := hP + cases W with + | nil _ => exact False.elim (hab rfl) + | @cons a c b e he W => + refine ⟨c, ⟨e, he⟩, ?_⟩ + intro hca + have haW := (List.nodup_cons.mp hsimple).1 + exact haW (hca ▸ W.start_mem_support) + +/-- A fan of `n` paths with distinct other ends needs at least `n` +neighbors at its centre. This excludes the five-path alternative in +XVI (5.4) once the degree is bounded by four. -/ +theorem fan_card_le_neighbors_ncard + {α : Type u} {β : Type v} {G : Graph α β} {x : α} {n : ℕ} + {P : Fin n → Graph α β} {b : Fin n → α} + (hV : V(G).Finite) + (hP : ∀ i, b i ≠ x ∧ IsGraphPathWithEnds G (P i) x (b i)) + (hinter : ∀ i j, i ≠ j → V(P i) ∩ V(P j) ⊆ {x}) : + n ≤ {z | G.Adj x z}.ncard := by + classical + have hex := fun i => path_exists_neighbor_at_start (hP i).2 (hP i).1.symm + choose y hy hne using hex + have hyinj : Function.Injective y := by + intro i j hyij + by_contra hij + obtain ⟨e, hei⟩ := hy i + obtain ⟨f, hfj⟩ := hy j + have hyj : y i ∈ V(P j) := hyij ▸ hfj.right_mem + have heq := mem_singleton_iff.mp (hinter i j hij ⟨hei.right_mem, hyj⟩) + exact hne i heq + have hsub : range y ⊆ {z | G.Adj x z} := by + rintro z ⟨i, rfl⟩ + obtain ⟨e, he⟩ := hy i + exact ⟨e, he.mono (hP i).2.le⟩ + have hfin : {z | G.Adj x z}.Finite := hV.subset + (by rintro z ⟨e, he⟩; exact he.right_mem) + have hc := ncard_le_ncard hsub hfin + simpa only [ncard_range_of_injective hyinj, Nat.card_fin] using hc + +/-- The union of two path families has at most four neighbors at a +vertex belonging to at most one member of each family. This is the +bound for the graph `H` in XVI (5.4), pages 56–57. -/ +theorem two_path_families_neighbors_ncard_le_four + {α : Type u} {β : Type v} {ι κ : Type*} {G : Graph α β} + {P : ι → Graph α β} {a b : ι → α} + {Q : κ → Graph α β} {s t : κ → α} {x : α} + (hV : V(G).Finite) + (hP : ∀ i, IsGraphPathWithEnds G (P i) (a i) (b i)) + (hQ : ∀ j, IsGraphPathWithEnds G (Q j) (s j) (t j)) + (hPu : ∀ i j, x ∈ V(P i) → x ∈ V(P j) → i = j) + (hQu : ∀ i j, x ∈ V(Q i) → x ∈ V(Q j) → i = j) : + {z | (subgraphSUnion G (range P ∪ range Q)).Adj x z}.ncard ≤ 4 := by + classical + let HP := subgraphSUnion G (range P) + let HQ := subgraphSUnion G (range Q) + let H := subgraphSUnion G (range P ∪ range Q) + have hPG : ∀ R ∈ range P, R ≤ G := by + rintro R ⟨i, rfl⟩ + exact (hP i).le + have hQG : ∀ R ∈ range Q, R ≤ G := by + rintro R ⟨j, rfl⟩ + exact (hQ j).le + have hRG : ∀ R ∈ range P ∪ range Q, R ≤ G := by + intro R hR + exact hR.elim (hPG R) (hQG R) + have hHP : HP ≤ G := subgraphSUnion_le hPG + have hHQ : HQ ≤ G := subgraphSUnion_le hQG + have hH : H ≤ G := subgraphSUnion_le hRG + have hsub : {z | H.Adj x z} ⊆ {z | HP.Adj x z} ∪ {z | HQ.Adj x z} := by + rintro z ⟨e, he⟩ + have heE := he.edge_mem + rw [edgeSet_subgraphSUnion hRG] at heE + obtain ⟨R, hR, heR⟩ := mem_iUnion₂.mp heE + have heR' := ((hRG R hR).isLink_iff heR).mpr (he.mono hH) + rcases hR with hR | hR + · exact Or.inl ⟨e, heR'.mono (le_subgraphSUnion hPG hR)⟩ + · exact Or.inr ⟨e, heR'.mono (le_subgraphSUnion hQG hR)⟩ + have hfin : ({z | HP.Adj x z} ∪ {z | HQ.Adj x z}).Finite := hV.subset (by + rintro z (⟨e, he⟩ | ⟨e, he⟩) + · exact hHP.vertexSet_mono he.right_mem + · exact hHQ.vertexSet_mono he.right_mem) + have hc := (ncard_le_ncard hsub hfin).trans + (ncard_union_le {z | HP.Adj x z} {z | HQ.Adj x z}) + have hcP := path_family_neighbors_ncard_le_two hP hPu + have hcQ := path_family_neighbors_ncard_le_two hQ hQu + change {z | HP.Adj x z}.ncard ≤ 2 at hcP + change {z | HQ.Adj x z}.ncard ≤ 2 at hcQ + change {z | H.Adj x z}.ncard ≤ 4 + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section5Five.lean b/LeanPool/GraphMinor/GM16/Section5Five.lean new file mode 100644 index 0000000000..121d0b7417 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section5Five.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section5 +import LeanPool.GraphMinor.GM16.Section5Linkage +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Regions + +import LeanPool.GraphMinor.GM11.CitedResults + +import LeanPool.GraphMinor.GM12.Bridge + +/-! +# Graph Minors XVI (5.5) + +Choose the threshold from (5.2) and double it. Claim (1), proved in +Section5Linkage, supplies the required number of disjoint old-graph paths +with separated ends. Their disjointness also makes all these ends +distinct, so (5.2) gives the controlled clique minor. +-/ + +public section +namespace GraphMinor.GM16 +open Set Function Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 + GraphMinor.GM15 +universe u v w + +/-- **Graph Minors XVI, (5.5)** (pages 57–58), by the paper's induction +on disjoint paths and then (5.2). The metric laws include the triangle inequality from XI (9.1), +and (5.2) uses XII (4.4). No statement of XVI is assumed. -/ +theorem theorem_5_5_proof + : GM16Theorem55Statement.{u, v, w} := by + classical + intro S _ _ hS hConn p + let μ := p * (p - 1) / 2 + obtain ⟨r, hr, h52⟩ := theorem_5_2_proof hS hConn p + refine ⟨2 * r, by omega, ?_⟩ + intro α β G θ_star T_star hT hAnimal + obtain ⟨H, η, θ_span, T, d, X, Y, hAnim⟩ := hAnimal + have hσ : 8 * μ ≤ 4 * p * (p - 1) := by + calc + 8 * μ = 4 * (μ * 2) := by ring + _ ≤ 4 * (p * (p - 1)) := Nat.mul_le_mul_left 4 (Nat.div_mul_le_self _ _) + _ = 4 * p * (p - 1) := by ring + have hAnim' : IsAnimal G T_star θ_star H η θ_span T d X Y μ 0 (2 * r) (8 * μ) := + hAnim.mono (by omega) le_rfl hσ + obtain ⟨_, horder, hSpan, hMet, hXsub, hXcard, _, _, hhorns, _, _⟩ := hAnim' + have hXfin : X.Finite := hT.finite_V.subset (fun x hx => (hXsub hx).1) + obtain ⟨_, _, _, hsymm, htri, _⟩ := GraphMinor.GM11.gm15_theorem_9_1.{w} H θ_span T d hS hConn + hMet + have hsymV : ∀ a ∈ H.V, ∀ b ∈ H.V, d {a} {b} = d {b} {a} := by + intro a ha b hb + exact hsymm {a} ((Or.inl (Or.inl ⟨a, ha, rfl⟩))) {b} ((Or.inl (Or.inl ⟨b, hb, rfl⟩))) + have htriV : ∀ a ∈ H.V, ∀ b ∈ H.V, ∀ c ∈ H.V, + d {a} {c} ≤ d {a} {b} + d {b} {c} := by + intro a ha b hb c hc + exact htri {a} ((Or.inl (Or.inl ⟨a, ha, rfl⟩))) {b} ((Or.inl (Or.inl ⟨b, hb, rfl⟩))) + {c} ((Or.inl (Or.inl ⟨c, hc, rfl⟩))) + obtain ⟨Q, s, t, hst, hQ, hQQ, _, hdist⟩ := theorem_5_5_claim_1 + hT.finite_V hT.finite_E hXfin hXcard hhorns hsymV htriV μ le_rfl + have hs : Injective s := by + intro i j hij + by_contra hne + have hsi := IsGraphPathWithEnds.left_mem (hQ i).2.1 + have hsj := IsGraphPathWithEnds.left_mem (hQ j).2.1 + have heq := congrArg η.vMap hij + exact (Set.disjoint_left.mp (hQQ hne)) hsi (heq ▸ hsj) + have ht : Injective t := by + intro i j hij + by_contra hne + have hti := IsGraphPathWithEnds.right_mem (hQ i).2.1 + have htj := IsGraphPathWithEnds.right_mem (hQ j).2.1 + have heq := congrArg η.vMap hij + exact (Set.disjoint_left.mp (hQQ hne)) hti (heq ▸ htj) + have hstdisj : Disjoint (range s) (range t) := by + apply Set.disjoint_left.mpr + rintro z ⟨i, rfl⟩ ⟨j, htj⟩ + by_cases hij : i = j + · subst j + exact (hst i).2.2 htj.symm + · have hsi := IsGraphPathWithEnds.left_mem (hQ i).2.1 + have htj' := IsGraphPathWithEnds.right_mem (hQ j).2.1 + have heq := congrArg η.vMap htj + exact (Set.disjoint_left.mp (hQQ hij)) hsi (heq ▸ htj') + exact h52 G θ_star θ_span T_star H η T d s t Q hSpan hMet (by omega) + hst hs ht hstdisj hdist hQ hQQ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section5Forest.lean b/LeanPool/GraphMinor/GM16/Section5Forest.lean new file mode 100644 index 0000000000..b8a94ffda1 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section5Forest.lean @@ -0,0 +1,119 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section5 +import LeanPool.GraphMinor.GM09.Section2c +import Mathlib.Combinatorics.Pigeonhole + +/-! +# Paths between marked vertices in XVI (5.3) + +The assumption on components supplies a path from each marked vertex to +another marked vertex. Stopping at the first other marked vertex gives a +path with no marked internal vertex. The counting argument groups marked +vertices by the vertex at which their paths meet a finite set. +-/ + +public section +namespace GraphMinor.GM16 + +open Set Graph GraphMinor.Surface GraphMinor.GM09 + +universe u v + +private theorem exists_walk_of_adj_reachable + {α : Type u} {β : Type v} {G : Graph α β} {a b : α} + (ha : a ∈ V(G)) (h : Relation.ReflTransGen G.Adj a b) : + Nonempty (GraphWalk G a b) := by + induction h with + | refl => exact ⟨.nil ha⟩ + | @tail b c _ hadj ih => + obtain ⟨W⟩ := ih + obtain ⟨e, he⟩ := hadj + exact ⟨W.append (.cons he (.nil he.right_mem))⟩ + +/-- In the setting of XVI (5.3), page 56, each marked vertex has a path +to a different marked vertex with no marked internal vertex. Stop a path +to another marked vertex at its first meeting with `Y \ {y}`. -/ +theorem exists_path_to_other_marked_vertex + {α : Type u} {β : Type v} {G : Graph α β} {Y : Set α} + (hYG : Y ⊆ V(G)) + (hcomp : ∀ y ∈ Y, ∃ y' ∈ Y, y' ≠ y ∧ Relation.ReflTransGen G.Adj y y') + {y : α} (hy : y ∈ Y) : + ∃ z ∈ Y, z ≠ y ∧ ∃ P : Graph α β, + IsGraphPathWithEnds G P y z ∧ V(P) ∩ Y = {y, z} := by + obtain ⟨y', hy', hne, hreach⟩ := hcomp y hy + obtain ⟨W⟩ := exists_walk_of_adj_reachable (hYG hy) hreach + obtain ⟨P, hP, _, _⟩ := exists_isGraphPathWithEnds_of_walk W + obtain ⟨z, ⟨_, hzY, hzy⟩, Q, _, hQ, hhit, _⟩ := + hP.exists_first_hit (S := Y \ {y}) + ⟨y', hP.right_mem, hy', by simpa using hne⟩ + have hQG := hQ.mono hP.le + have hzy' : z ≠ y := by simpa using hzy + refine ⟨z, hzY, hzy', Q, hQG, subset_antisymm ?_ ?_⟩ + · rintro x ⟨hxQ, hxY⟩ + by_cases hxy : x = y + · exact Or.inl hxy + · have : x ∈ ({z} : Set α) := + hhit ▸ ⟨hxQ, hxY, by simpa using hxy⟩ + exact Or.inr this + · rintro x (rfl | hx) + · exact ⟨hQG.left_mem, hy⟩ + · have hxz : x = z := mem_singleton_iff.mp hx + subst x + exact ⟨hQG.right_mem, hzY⟩ + +/-- The pigeonhole step in XVI (5.3), page 56. If each marked vertex +is assigned a vertex of `X`, and `|Y| > τ * |X|`, then at least `τ + 1` +marked vertices have the same assigned vertex. -/ +theorem exists_many_marked_vertices_at_one_vertex + {α : Type u} {X Y : Set α} {τ : ℕ} {f : α → α} + (hX : X.Finite) (hY : Y.Finite) (hf : ∀ y ∈ Y, f y ∈ X) + (hcard : τ * X.ncard < Y.ncard) : + ∃ x ∈ X, ∃ Y' ⊆ Y, τ + 1 ≤ Y'.ncard ∧ ∀ y ∈ Y', f y = x := by + classical + have hmaps : ∀ y ∈ hY.toFinset, f y ∈ hX.toFinset := by + intro y hy + exact hX.mem_toFinset.mpr (hf y (hY.mem_toFinset.mp hy)) + have hcount : hX.toFinset.card * τ < hY.toFinset.card := by + rw [← ncard_eq_toFinset_card _ hX, ← ncard_eq_toFinset_card _ hY] + simpa only [Nat.mul_comm] using hcard + obtain ⟨x, hx, hlarge⟩ := + Finset.exists_lt_card_fiber_of_mul_lt_card_of_maps_to hmaps hcount + let A := hY.toFinset.filter (fun y => f y = x) + refine ⟨x, hX.mem_toFinset.mp hx, (A : Set α), ?_, ?_, ?_⟩ + · intro y hy + exact hY.mem_toFinset.mp (Finset.mem_filter.mp hy).1 + · rw [Set.ncard_coe_finset] + exact hlarge + · intro y hy + exact (Finset.mem_filter.mp hy).2 + +/-- Graph Minors XVI, (5.3), the case `μ = 1`. A nonempty marked set +and the component hypothesis give a single path of the first outcome. -/ +theorem theorem_5_3_one + {α : Type u} {β : Type v} {G : Graph α β} {Y : Set α} + (hY : Y.Finite) (hYG : Y ⊆ V(G)) + (hcomp : ∀ y ∈ Y, ∃ y' ∈ Y, y' ≠ y ∧ Relation.ReflTransGen G.Adj y y') + (hcard : 0 < Y.ncard) : + ∃ (P : Fin 1 → Graph α β) (s t : Fin 1 → α), + Pairwise (fun i j => Disjoint V(P i) V(P j)) ∧ + ∀ i, s i ∈ Y ∧ t i ∈ Y ∧ s i ≠ t i ∧ + IsGraphPathWithEnds G (P i) (s i) (t i) ∧ V(P i) ∩ Y = {s i, t i} := by + obtain ⟨y, hy⟩ := (ncard_pos hY).mp hcard + obtain ⟨z, hz, hzy, P, hP, hinter⟩ := + exists_path_to_other_marked_vertex hYG hcomp hy + refine ⟨fun _ => P, fun _ => y, fun _ => z, ?_, ?_⟩ + · intro i j hij + exact False.elim (hij (Subsingleton.elim i j)) + · intro _ + exact ⟨hy, hz, hzy.symm, hP, hinter⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section5Four.lean b/LeanPool/GraphMinor/GM16/Section5Four.lean new file mode 100644 index 0000000000..5bc96bcde3 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section5Four.lean @@ -0,0 +1,127 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section5 +import LeanPool.GraphMinor.GM16.Section5Proof +import LeanPool.GraphMinor.GM16.Section5Paths +import LeanPool.GraphMinor.GM16.Section5Degree +import LeanPool.GraphMinor.GM16.Section5Connections +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Graph Minors XVI (5.4) + +Form the union of the spokes and the disjoint paths, and delete their +common start. Mark the vertices of `Z` in components containing at least +two vertices of `Z`. Apply (5.3) with five paths in the fan alternative. +The degree bound excludes that alternative. If there are too few marked +vertices, two spoke ends lie outside these components, and their spokes +avoid every given path. Joining these spokes gives the extra path. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 +universe u v + +/-- **Graph Minors XVI, (5.4)** (pages 56–57), with the distinct-end +correction documented in `GM16Theorem54Statement`. We retain unmarked +components when applying (5.3). This has no effect on its paths, whose +ends lie in components containing two marked vertices. -/ +theorem theorem_5_4_proof : GM16Theorem54Statement.{u, v} := by + classical + intro α β G v n m P u Q s t hV hE hv hP hPP hQ hst hQQ hn + dsimp only + let Z := range u ∪ range s ∪ range t + let H := subgraphSUnion G (range P ∪ range Q) + let D := deleteVertices H {v} + have hfamily : ∀ R ∈ range P ∪ range Q, R ≤ G := by + rintro R (⟨i, rfl⟩ | ⟨j, rfl⟩) + · exact (hP i).2.le + · exact (hQ j).2.le + have hHG : H ≤ G := subgraphSUnion_le hfamily + have hDH : D ≤ H := deleteVertices_le H {v} + have hDG : D ≤ G := hDH.trans hHG + have hDV : V(D).Finite := hV.subset hDG.vertexSet_mono + have hDE : E(D).Finite := hE.subset hDG.edgeSet_mono + have hPH : ∀ i, IsGraphPathWithEnds H (P i) v (u i) := fun i => + (hP i).2.of_le (le_subgraphSUnion hfamily (Or.inl ⟨i, rfl⟩)) + have hQH : ∀ j, IsGraphPathWithEnds H (Q j) (s j) (t j) := fun j => + (hQ j).2.of_le (le_subgraphSUnion hfamily (Or.inr ⟨j, rfl⟩)) + let Y : Set α := {y | y ∈ Z ∧ ∃ z ∈ Z, z ≠ y ∧ Nonempty (GraphWalk D y z)} + have hYD : Y ⊆ V(D) := by + rintro y ⟨_, z, _, _, ⟨W⟩⟩ + exact W.mem_vertexSet_of_mem_support W.start_mem_support + have hYfin : Y.Finite := hDV.subset hYD + have hcomp : ∀ y ∈ Y, ∃ z ∈ Y, z ≠ y ∧ Relation.ReflTransGen D.Adj y z := by + rintro y ⟨hyZ, z, hzZ, hzy, ⟨W⟩⟩ + exact ⟨z, ⟨hzZ, y, hyZ, hzy.symm, ⟨W.reverse⟩⟩, hzy, graphWalk_adj_reachable W⟩ + have hdegree : ∀ x ∈ V(D), {z | D.Adj x z}.ncard ≤ 4 := by + intro x hxD + have hxv : x ≠ v := by + have hx : x ∈ V(H) \ {v} := hxD + exact fun h => hx.2 (mem_singleton_iff.mpr h) + have hPu : ∀ i j, x ∈ V(P i) → x ∈ V(P j) → i = j := by + intro i j hxi hxj + by_contra hij + have hx : x ∈ ({v} : Set α) := (hPP i j hij).1 ▸ ⟨hxi, hxj⟩ + exact hxv (mem_singleton_iff.mp hx) + have hQu : ∀ i j, x ∈ V(Q i) → x ∈ V(Q j) → i = j := by + intro i j hxi hxj + by_contra hij + exact (Set.disjoint_left.mp (hQQ hij)) hxi hxj + have hHdegree := two_path_families_neighbors_ncard_le_four hV + (fun i => (hP i).2) (fun j => (hQ j).2) hPu hQu + change {z | H.Adj x z}.ncard ≤ 4 at hHdegree + have hsub : {z | D.Adj x z} ⊆ {z | H.Adj x z} := by + rintro z ⟨e, he⟩ + exact ⟨e, he.mono hDH⟩ + have hfin : {z | H.Adj x z}.Finite := hV.subset (by + rintro z ⟨e, he⟩ + exact hHG.vertexSet_mono he.right_mem) + exact (ncard_le_ncard hsub hfin).trans hHdegree + by_cases hlarge : 5 * m < Y.ncard + · have hcount : 5 * ((m + 1) - 1) < Y.ncard := by simpa using hlarge + rcases theorem_5_3_proof D Y (m + 1) 5 hDV hDE hYD hcomp hcount with + ⟨R, a, b, hdisj, hR⟩ | ⟨x, R, b, hxD, hinter, hR⟩ + · refine ⟨R, a, b, hdisj, ?_⟩ + intro i + obtain ⟨ha, hb, hab, hp, _⟩ := hR i + exact ⟨ha.1, hb.1, hab, hp.mono hDG⟩ + · have hfan := fan_card_le_neighbors_ncard hDV + (fun i => ⟨(hR i).2.1, (hR i).2.2.1⟩) + (fun i j hij => (hinter i j hij).1.subset) + have hbound := hdegree x hxD + omega + · have hsmall : Y.ncard ≤ 5 * m := Nat.le_of_not_gt hlarge + have huinj : Function.Injective u := spoke_ends_injective hP + (fun i j hij => (hPP i j hij).1) + obtain ⟨i, j, hij, hiY, hjY⟩ := exists_two_spoke_ends_outside huinj hYfin hsmall hn + have havoid : ∀ i, u i ∉ Y → ∀ j, Disjoint V(P i) V(Q j) := by + intro i hi j + apply Set.disjoint_left.mpr + intro w hwP hwQ + obtain ⟨z, hz, hzu, hwalk⟩ := spoke_end_reaches_other_marked_end + (hPH i) (hQH j) (hst j) (hQ j).1 ⟨w, hwP, hwQ⟩ + have hzZ : z ∈ Z := by + rcases hz with rfl | hz + · exact Or.inl (Or.inr ⟨j, rfl⟩) + · have hzt := mem_singleton_iff.mp hz + subst z + exact Or.inr ⟨j, rfl⟩ + exact hi ⟨Or.inl (Or.inl ⟨i, rfl⟩), z, hzZ, hzu, hwalk⟩ + exact theorem_5_4_of_two_avoiding_spokes (hP i).2 (hP j).2 (hP i).1 + (hPP i j hij).1 (Or.inl (Or.inl ⟨i, rfl⟩)) (Or.inl (Or.inl ⟨j, rfl⟩)) + (fun k => (hQ k).2) + (fun k => ⟨Or.inl (Or.inr ⟨k, rfl⟩), Or.inr ⟨k, rfl⟩, hst k⟩) + hQQ (havoid i hiY) (havoid j hjY) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section5HornSelection.lean b/LeanPool/GraphMinor/GM16/Section5HornSelection.lean new file mode 100644 index 0000000000..eaea89002b --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section5HornSelection.lean @@ -0,0 +1,116 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section5 +import Mathlib.Data.Fintype.EquivFin +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Selecting the spokes in XVI (5.5) + +At most `μ - 1` spokes meet another horn vertex. For each old path end, +at most one spoke end is too close, by the triangle inequality. Removing +both kinds of spokes leaves the `5 * μ` spokes used in (5.4). +-/ + +public section +namespace GraphMinor.GM16 +open Set Function Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w + +/-- Graph Minors XVI, proof of (5.5), Claim (1), page 57: select +`5 * μ` spokes avoiding the other horn vertices and staying far from +all the old path ends. -/ +theorem theorem_5_5_select_spokes + {S : Type w} [TopologicalSpace S] {α : Type u} {β : Type v} + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {d : Set S → Set S → ℕ} {x : α} {r μ m : ℕ} + {P : Fin (8 * μ) → Graph α β} {ends : Fin (8 * μ) → S} + (h : IsHorn G H η d x (2 * r) (8 * μ) P ends) + {X : Set α} (hX : X.Finite) (hxX : x ∈ X) (hXcard : X.ncard = μ) + {W : Set S} (hW : W.Finite) (hWH : W ⊆ H.V) (hWcard : W.ncard ≤ 2 * m) + (hm : m < μ) + (hsymm : ∀ a ∈ H.V, ∀ b ∈ H.V, d {a} {b} = d {b} {a}) + (htri : ∀ a ∈ H.V, ∀ b ∈ H.V, ∀ c ∈ H.V, + d {a} {c} ≤ d {a} {b} + d {b} {c}) : + ∃ f : Fin (5 * μ) ↪ Fin (8 * μ), ∀ i, + V(P (f i)) ∩ X = {x} ∧ ∀ z ∈ W, r ≤ d {ends (f i)} {z} := by + classical + let bad : Set (Fin (8 * μ)) := {i | ∃ y ∈ X, y ∈ V(P i) ∧ y ≠ x} + let near : Set (Fin (8 * μ)) := {i | ∃ z ∈ W, d {ends i} {z} < r} + have hbad : bad.ncard ≤ μ - 1 := by + let witness : Fin (8 * μ) → α := fun i => + if hi : i ∈ bad then (show ∃ y ∈ X, y ∈ V(P i) ∧ y ≠ x from hi).choose else x + have hw : ∀ i ∈ bad, witness i ∈ X ∧ witness i ∈ V(P i) ∧ witness i ≠ x := by + intro i hi + dsimp only [witness] + rw [dite_eq_left hi] + exact (show ∃ y ∈ X, y ∈ V(P i) ∧ y ≠ x from hi).choose_spec + have hinj : InjOn witness bad := by + intro i hi j hj heq + by_contra hij + have hy : witness i ∈ V(P i) ∩ V(P j) := + ⟨(hw i hi).2.1, heq ▸ (hw j hj).2.1⟩ + rw [(h.2.2.2.2.1 i j hij).1] at hy + exact (hw i hi).2.2 (mem_singleton_iff.mp hy) + have hbound := ncard_le_ncard_of_injOn witness + (fun i hi => show witness i ∈ X \ {x} from ⟨(hw i hi).1, (hw i hi).2.2⟩) + hinj hX.sdiff + have hcount := ncard_sdiff' (singleton_subset_iff.mpr hxX) hX + rw [ncard_singleton, hXcard] at hcount + omega + have hnear : near.ncard ≤ W.ncard := by + let witness : Fin (8 * μ) → S := fun i => + if hi : i ∈ near then (show ∃ z ∈ W, d {ends i} {z} < r from hi).choose else ends i + have hw : ∀ i ∈ near, witness i ∈ W ∧ d {ends i} {witness i} < r := by + intro i hi + dsimp only [witness] + rw [dite_eq_left hi] + exact (show ∃ z ∈ W, d {ends i} {z} < r from hi).choose_spec + have hinj : InjOn witness near := by + intro i hi j hj heq + by_contra hij + have hbound := htri (ends i) (h.2.1 i) (witness i) (hWH (hw i hi).1) + (ends j) (h.2.1 j) + rw [hsymm (witness i) (hWH (hw i hi).1) (ends j) (h.2.1 j)] at hbound + have hd := h.2.2.2.2.2 i j hij + have hdi := (hw i hi).2 + have hdj := (hw j hj).2 + rw [← heq] at hdj + omega + exact ncard_le_ncard_of_injOn witness (fun i hi => (hw i hi).1) hinj hW + let good : Set (Fin (8 * μ)) := univ \ (bad ∪ near) + have hgood : 5 * μ ≤ good.ncard := by + have hu := ncard_union_le bad near + have hc := ncard_sdiff' (subset_univ (bad ∪ near)) (toFinite univ) + have hall : (univ : Set (Fin (8 * μ))).ncard = 8 * μ := by simp + change 5 * μ ≤ (univ \ (bad ∪ near)).ncard + omega + let : Fintype good := Fintype.ofFinite good + have hcard : Fintype.card (Fin (5 * μ)) ≤ Fintype.card good := by + rw [Fintype.card_fin, ← Nat.card_eq_fintype_card, Nat.card_coe_set_eq] + exact hgood + obtain ⟨f⟩ := Function.Embedding.nonempty_of_card_le hcard + refine ⟨f.trans ⟨Subtype.val, Subtype.val_injective⟩, ?_⟩ + intro i + have hi : (f i).val ∉ bad ∧ (f i).val ∉ near := by + simpa only [good, mem_sdiff, mem_univ, true_and, mem_union, not_or] using (f i).property + constructor + · apply Set.Subset.antisymm + · rintro y ⟨hyP, hyX⟩ + apply mem_singleton_iff.mpr + by_contra hne + exact hi.1 ⟨y, hyX, hyP, hne⟩ + · rintro y rfl + exact ⟨(h.2.2.1 (f i).val).left_mem, hxX⟩ + · intro z hz + exact Nat.le_of_not_gt (fun hd => hi.2 ⟨z, hz, hd⟩) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section5Linkage.lean b/LeanPool/GraphMinor/GM16/Section5Linkage.lean new file mode 100644 index 0000000000..7b74dfd043 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section5Linkage.lean @@ -0,0 +1,152 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section5 +import LeanPool.GraphMinor.GM16.Section5HornSelection +import LeanPool.GraphMinor.GM16.Section5Reroute +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Building the disjoint paths in XVI (5.5) + +Claim (1) builds the paths one at a time. An unused horn vertex exists +because the old paths meet at most `m` horn vertices. Select spokes far +from the old ends, reroute by (5.4), and keep the metric separation since +all new ends are among the selected and old ends. +-/ + +public section +namespace GraphMinor.GM16 +open Set Function Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w + +/-- Graph Minors XVI, proof of (5.5), Claim (1), pages 57–58. -/ +theorem theorem_5_5_claim_1 + {S : Type w} [TopologicalSpace S] {α : Type u} {β : Type v} + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {d : Set S → Set S → ℕ} {X : Set α} {μ r : ℕ} + (hV : V(G).Finite) (hE : E(G).Finite) + (hX : X.Finite) (hXcard : X.ncard = μ) + (hhorns : ∀ x ∈ X, ∃ (P : Fin (8 * μ) → Graph α β) (ends : Fin (8 * μ) → S), + IsHorn G H η d x (2 * r) (8 * μ) P ends) + (hsymm : ∀ a ∈ H.V, ∀ b ∈ H.V, d {a} {b} = d {b} {a}) + (htri : ∀ a ∈ H.V, ∀ b ∈ H.V, ∀ c ∈ H.V, + d {a} {c} ≤ d {a} {b} + d {b} {c}) : + ∀ m, m ≤ μ → ∃ (Q : Fin m → Graph α β) (s t : Fin m → S), + (∀ i, s i ∈ H.V ∧ t i ∈ H.V ∧ s i ≠ t i) ∧ + (∀ i, IsHPathWithEnds G η.imageGraph (Q i) (η.vMap (s i)) (η.vMap (t i))) ∧ + Pairwise (fun i j => Disjoint V(Q i) V(Q j)) ∧ + ((⋃ i, V(Q i)) ∩ X).ncard ≤ m ∧ + ∀ a ∈ range s ∪ range t, ∀ b ∈ range s ∪ range t, + a ≠ b → r ≤ d {a} {b} := by + classical + intro m + induction m with + | zero => + intro _ + refine ⟨fun i => i.elim0, fun i => i.elim0, fun i => i.elim0, + fun i => i.elim0, fun i => i.elim0, fun i => i.elim0, ?_, ?_⟩ + · simp + · rintro a (⟨i, _⟩ | ⟨i, _⟩) <;> exact i.elim0 + | succ m ih => + intro hmμ + have hm : m < μ := by omega + obtain ⟨Q, s, t, hst, hQ, hQQ, hcount, hdist⟩ := ih (by omega) + have hex : ∃ x ∈ X, x ∉ ⋃ j, V(Q j) := by + by_contra h + have hsub : X ⊆ (⋃ j, V(Q j)) ∩ X := by + intro x hx + refine ⟨?_, hx⟩ + by_contra hxQ + exact h ⟨x, hx, hxQ⟩ + have hc := ncard_le_ncard hsub (hX.subset inter_subset_right) + omega + obtain ⟨x, hxX, hxQ⟩ := hex + obtain ⟨P, ends, hhorn⟩ := hhorns x hxX + let W := range s ∪ range t + have hW : W.Finite := (finite_range s).union (finite_range t) + have hWH : W ⊆ H.V := by + rintro z (⟨i, rfl⟩ | ⟨i, rfl⟩) + · exact (hst i).1 + · exact (hst i).2.1 + have hWcard : W.ncard ≤ 2 * m := by + have hs : (range s).ncard ≤ m := by + rw [← image_univ] + simpa using (ncard_image_le (f := s) (s := univ)) + have ht : (range t).ncard ≤ m := by + rw [← image_univ] + simpa using (ncard_image_le (f := t) (s := univ)) + have hc := ncard_union_le (range s) (range t) + change (range s ∪ range t).ncard ≤ 2 * m + omega + obtain ⟨f, hf⟩ := theorem_5_5_select_spokes hhorn hX hxX hXcard hW hWH hWcard hm hsymm htri + have hendsH : ∀ i, ends (f i) ∈ H.V := fun i => hhorn.2.1 (f i) + have hPne : ∀ i, η.vMap (ends (f i)) ≠ x := by + intro i h + exact hhorn.1.2 (h ▸ η.bijOn_v.mapsTo (hendsH i)) + have hpair : ∀ i j, i ≠ j → V(P (f i)) ∩ V(P (f j)) = {x} ∧ + Disjoint E(P (f i)) E(P (f j)) := by + intro i j hij + exact hhorn.2.2.2.2.1 (f i) (f j) (f.injective.ne hij) + have hxQi : ∀ j, x ∉ V(Q j) := fun j h => hxQ (mem_iUnion.mpr ⟨j, h⟩) + obtain ⟨R, a, b, hR, hRR, hnewcount, hnewends⟩ := theorem_5_5_reroute + hV hE η.imageGraph_le hX hhorn.1.1 + (fun i => ⟨hPne i, hhorn.2.2.1 (f i)⟩) + (fun i => η.bijOn_v.mapsTo (hendsH i)) + (fun i => hhorn.2.2.2.1 (f i)) hpair (fun i => (hf i).1) + hQ hQQ hxQi hcount (by omega : 5 * m + 2 ≤ 5 * μ) + let A := range (fun i : Fin (5 * μ) => ends (f i)) ∪ W + have hAH : A ⊆ H.V := by + rintro z (⟨i, rfl⟩ | hz) + · exact hendsH i + · exact hWH hz + have hAsep : ∀ z ∈ A, ∀ w ∈ A, z ≠ w → r ≤ d {z} {w} := by + rintro z (⟨i, rfl⟩ | hz) w (⟨j, rfl⟩ | hw) hne + · have hij : f i ≠ f j := fun h => hne (congrArg ends h) + have hd := hhorn.2.2.2.2.2 (f i) (f j) hij + change r ≤ d {ends (f i)} {ends (f j)} + omega + · exact (hf i).2 w hw + · rw [hsymm z (hWH hz) (ends (f j)) (hendsH j)] + exact (hf j).2 z hz + · exact hdist z hz w hw hne + have hlabels : ∀ z ∈ range (fun i : Fin (5 * μ) => η.vMap (ends (f i))) ∪ + range (fun j => η.vMap (s j)) ∪ range (fun j => η.vMap (t j)), + ∃ y ∈ A, η.vMap y = z := by + rintro z ((⟨i, rfl⟩ | ⟨j, rfl⟩) | ⟨j, rfl⟩) + · exact ⟨ends (f i), Or.inl ⟨i, rfl⟩, rfl⟩ + · exact ⟨s j, Or.inr (Or.inl ⟨j, rfl⟩), rfl⟩ + · exact ⟨t j, Or.inr (Or.inr ⟨j, rfl⟩), rfl⟩ + have hsa := fun i => hlabels (a i) (hnewends i).1 + have htb := fun i => hlabels (b i) (hnewends i).2 + choose s' hs'A hs'a using hsa + choose t' ht'A ht'b using htb + have hR' : ∀ i, IsHPathWithEnds G η.imageGraph (R i) + (η.vMap (s' i)) (η.vMap (t' i)) := by + intro i + rw [hs'a i, ht'b i] + exact hR i + refine ⟨R, s', t', ?_, hR', hRR, hnewcount, ?_⟩ + · intro i + refine ⟨hAH (hs'A i), hAH (ht'A i), ?_⟩ + intro heq + exact (hR' i).2.2.1 (congrArg η.vMap heq) + · intro z hz w hw hne + have hzA : z ∈ A := by + rcases hz with ⟨i, rfl⟩ | ⟨i, rfl⟩ + · exact hs'A i + · exact ht'A i + have hwA : w ∈ A := by + rcases hw with ⟨i, rfl⟩ | ⟨i, rfl⟩ + · exact hs'A i + · exact ht'A i + exact hAsep z hzA w hwA hne + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section5Minimal.lean b/LeanPool/GraphMinor/GM16/Section5Minimal.lean new file mode 100644 index 0000000000..ba1b665796 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section5Minimal.lean @@ -0,0 +1,54 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.ForestMarked +import Mathlib.Order.Minimal + +/-! +# Choosing the forest in XVI (5.3) + +Choose a subgraph with as few edges as possible while keeping the marked +vertices in the same components. A spanning forest of this subgraph keeps +the required connections and has no more edges. Minimality makes it the +whole subgraph, proving that the chosen subgraph is a forest. +-/ + +public section +namespace GraphMinor.GM16 +open Set SimpleGraph +universe u + +/-- The minimal-subgraph step in the proof of XVI (5.3), page 56. +All vertices are retained, including unused isolated vertices. They do +not affect the marked vertices or the paths used in the proof. -/ +theorem exists_minimal_marked_forest {V : Type u} [Finite V] + (G : SimpleGraph V) (Y : Set V) : + ∃ F ≤ G, F.IsAcyclic ∧ + ∀ a ∈ Y, ∀ b ∈ Y, G.Reachable a b → F.Reachable a b := by + classical + let := Fintype.ofFinite V + let P : SimpleGraph V → Prop := fun F => + F ≤ G ∧ ∀ a ∈ Y, ∀ b ∈ Y, G.Reachable a b → F.Reachable a b + obtain ⟨F, hF⟩ := exists_minimalFor_of_wellFoundedLT P + (fun F => F.edgeFinset.card) ⟨G, le_rfl, fun _ _ _ _ h => h⟩ + obtain ⟨H, hHF, hH, hreach⟩ := F.exists_isAcyclic_reachable_eq_le + have hHP : P H := by + refine ⟨hHF.trans hF.1.1, ?_⟩ + intro a ha b hb hab + rw [hreach] + exact hF.1.2 a ha b hb hab + have hcard := hF.2 hHP (Finset.card_le_card (edgeFinset_mono hHF)) + have heq : H.edgeFinset = F.edgeFinset := + Finset.eq_of_subset_of_card_le (edgeFinset_mono hHF) hcard + have hFH : F ≤ H := edgeFinset_subset_edgeFinset.mp (le_of_eq heq.symm) + have hFH_eq : F = H := le_antisymm hFH hHF + exact ⟨F, hF.1.1, hFH_eq ▸ hH, hF.1.2⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section5Packing.lean b/LeanPool/GraphMinor/GM16/Section5Packing.lean new file mode 100644 index 0000000000..6106a0eeed --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section5Packing.lean @@ -0,0 +1,116 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section5Forest +public import LeanPool.GraphMinor.GM16.ForestMarked +import Mathlib.Data.Fintype.EquivFin + +/-! +# The forest case of XVI (5.3) + +Pack the marked paths using the subtree packing theorem. If there are too +few paths, its cover has fewer than `μ` vertices. Assign each marked +vertex a first-hit path to this cover. The count in the paper supplies +`τ + 1` marked vertices assigned to one cover vertex. Omitting that +vertex itself leaves the required fan. +-/ + +public section +namespace GraphMinor.GM16 + +open Set SimpleGraph +universe u + +/-- Graph Minors XVI, proof of (5.3), page 56, after choosing the forest. +This proves both alternatives for a finite forest with the stated +condition on its marked vertices. -/ +theorem forest_marked_paths_or_fan + {V : Type u} [Finite V] (G : SimpleGraph V) (Y : Set V) (μ τ : ℕ) + (hG : G.IsAcyclic) + (hcomp : ∀ y ∈ Y, ∃ z ∈ Y, z ≠ y ∧ G.Reachable y z) + (hcount : τ * (μ - 1) < Y.ncard) : + (∃ Q : Fin μ → MarkedPath G Y, + Pairwise (fun i j => Disjoint {z | z ∈ (Q i).path.val.support} + {z | z ∈ (Q j).path.val.support})) ∨ + (∃ (x : V) (s : Fin τ → V) (P : ∀ i, G.Path (s i) x), + Function.Injective s ∧ + (∀ i j, i ≠ j → {z | z ∈ (P i).val.support} ∩ + {z | z ∈ (P j).val.support} = {x}) ∧ + ∀ i, s i ∈ Y ∧ s i ≠ x ∧ + ∀ z ∈ (P i).val.support, z ∈ Y → z = x ∨ z = s i) := by + classical + obtain ⟨I, X, hsize, hdisj, hcover⟩ := + forest_packing_cover G (fun q : MarkedPath G Y => {z | z ∈ q.path.val.support}) + hG (fun q => walk_isSubtreeSet q.path.val) + by_cases hlarge : μ ≤ I.card + · obtain ⟨e, he⟩ := Function.Embedding.exists_of_card_le_finset + (α := Fin μ) (s := I) (by simpa using hlarge) + refine Or.inl ⟨e, ?_⟩ + intro i j hij + exact hdisj (e i) (he ⟨i, rfl⟩) (e j) (he ⟨j, rfl⟩) (e.injective.ne hij) + · have hsmall : X.card ≤ μ - 1 := by omega + have hX : ∀ q : MarkedPath G Y, + ∃ x ∈ (X : Set V), x ∈ q.path.val.support := hcover + have hpaths : ∀ y : Y, ∃ x ∈ (X : Set V), ∃ p : G.Path y.val x, + ∀ z ∈ p.val.support, z ∈ (X : Set V) → z = x := by + intro y + obtain ⟨z, hz, hzy, ⟨r⟩⟩ := hcomp y.val y.property + obtain ⟨w, hwX, hwr⟩ := marked_cover_meets_walk hX r y.property hz hzy.symm + obtain ⟨x, hx, p, _, hfirst⟩ := exists_path_first_hit + (X := (X : Set V)) (U := univ) (r.takeUntil w hwr) hwX (by simp) + exact ⟨x, hx, p, hfirst⟩ + choose f hf p hp using hpaths + have hY : Y.Finite := Set.toFinite Y + obtain ⟨y₀, hy₀⟩ := (ncard_pos hY).mp (lt_of_le_of_lt (Nat.zero_le _) hcount) + let f' : V → V := fun y => if hy : y ∈ Y then f ⟨y, hy⟩ else f ⟨y₀, hy₀⟩ + have hf' : ∀ y ∈ Y, f' y ∈ (X : Set V) := by + intro y hy + simpa only [f', dite_eq_left hy] using hf ⟨y, hy⟩ + have hnum : τ * (X : Set V).ncard < Y.ncard := by + simpa only [Set.ncard_coe_finset] using + lt_of_le_of_lt (Nat.mul_le_mul_left τ hsmall) hcount + obtain ⟨x, _, Y', hY'Y, hY'card, hY'f⟩ := + exists_many_marked_vertices_at_one_vertex X.finite_toSet hY hf' hnum + let B := Y' \ {x} + have hB : B.Finite := (hY.subset hY'Y).sdiff + have hBcard : τ ≤ B.ncard := by + have hsub := ncard_le_ncard_sdiff_add_ncard Y' {x} (finite_singleton x) + rw [ncard_singleton] at hsub + dsimp only [B] + omega + obtain ⟨e, he⟩ := Function.Embedding.exists_of_card_le_finset + (α := Fin τ) (s := hB.toFinset) (by + rw [Fintype.card_fin, ← ncard_eq_toFinset_card B hB] + exact hBcard) + have heB : ∀ i, e i ∈ B := fun i => hB.mem_toFinset.mp (he ⟨i, rfl⟩) + have heY : ∀ i, e i ∈ Y := fun i => hY'Y (heB i).1 + have hfx : ∀ i, f ⟨e i, heY i⟩ = x := by + intro i + simpa only [f', dite_eq_left (heY i)] using hY'f (e i) (heB i).1 + have hP : ∀ i, ∃ q : G.Path (e i) x, + ∀ z ∈ q.val.support, z ∈ (X : Set V) → z = x := by + intro i + have h : ∃ q : G.Path (e i) (f ⟨e i, heY i⟩), + ∀ z ∈ q.val.support, z ∈ (X : Set V) → z = f ⟨e i, heY i⟩ := + ⟨p ⟨e i, heY i⟩, hp ⟨e i, heY i⟩⟩ + rw [hfx i] at h + exact h + choose P hP using hP + refine Or.inr ⟨x, e, P, e.injective, ?_, ?_⟩ + · intro i j hij + exact first_hit_paths_inter_eq hX (heY i) (heY j) (e.injective.ne hij) + (P i) (P j) (hP i) (hP j) + · intro i + refine ⟨heY i, ?_, ?_⟩ + · exact fun h => (heB i).2 (mem_singleton_iff.mpr h) + · intro z hz hzY + exact (first_hit_path_marked_only_at_ends hX (heY i) (P i) (hP i) z hz hzY).symm + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section5Paths.lean b/LeanPool/GraphMinor/GM16/Section5Paths.lean new file mode 100644 index 0000000000..37efd66430 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section5Paths.lean @@ -0,0 +1,136 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section5 +import LeanPool.GraphMinor.GM09.Basic + +/-! +# The last path construction in XVI (5.4) + +Two paths from the common vertex that avoid all the given disjoint paths +can be joined. Their union supplies the extra path in the last paragraph +of the proof on page 57. +-/ + +public section + +namespace GraphMinor.GM16 + +open Set Graph GraphMinor.GM09 + +universe u v + +/-- Spokes that meet only at their common start have distinct other ends. -/ +theorem spoke_ends_injective + {α : Type u} {β : Type v} {G : Graph α β} {v : α} + {n : ℕ} {P : Fin n → Graph α β} {u : Fin n → α} + (hP : ∀ i, u i ≠ v ∧ IsGraphPathWithEnds G (P i) v (u i)) + (hinter : ∀ i j, i ≠ j → V(P i) ∩ V(P j) = {v}) : + Function.Injective u := by + intro i j heq + by_contra hne + have hui : u i ∈ V(P j) := heq ▸ (hP j).2.right_mem + have : u i ∈ ({v} : Set α) := + hinter i j hne ▸ ⟨(hP i).2.right_mem, hui⟩ + exact (hP i).1 (mem_singleton_iff.mp this) + +/-- The count in the last paragraph of XVI (5.4), page 57: deleting a +set of at most `5 * m` vertices from at least `5 * m + 2` distinct spoke +ends leaves two ends. No containment between the deleted set and the +spoke ends is needed. -/ +theorem exists_two_spoke_ends_outside + {α : Type u} {n m : ℕ} {u : Fin n → α} {Y : Set α} + (hu : Function.Injective u) (hY : Y.Finite) + (hcard : Y.ncard ≤ 5 * m) (hn : 5 * m + 2 ≤ n) : + ∃ i j, i ≠ j ∧ u i ∉ Y ∧ u j ∉ Y := by + have hrange : (range u).ncard = n := by + simpa using ncard_range_of_injective hu + have hcount := ncard_le_ncard_sdiff_add_ncard (range u) Y hY + have htwo : 1 < (range u \ Y).ncard := by omega + obtain ⟨a, ⟨⟨i, rfl⟩, hi⟩, b, ⟨⟨j, rfl⟩, hj⟩, hab⟩ := + (one_lt_ncard ((finite_range u).sdiff)).mp htwo + exact ⟨i, j, fun h => hab (congrArg u h), hi, hj⟩ + +/-- Graph Minors XVI, proof of (5.4), page 57: two distinct spokes that +avoid every `Q_j` supply the additional path. The spoke ends are distinct +because the spokes meet only at their common start. -/ +theorem theorem_5_4_of_two_avoiding_spokes + {α : Type u} {β : Type v} {G P P' : Graph α β} {v a b : α} + {m : ℕ} {Q : Fin m → Graph α β} {s t : Fin m → α} {Z : Set α} + (hP : IsGraphPathWithEnds G P v a) + (hP' : IsGraphPathWithEnds G P' v b) + (hav : a ≠ v) (hPP' : V(P) ∩ V(P') = {v}) + (ha : a ∈ Z) (hb : b ∈ Z) + (hQ : ∀ j, IsGraphPathWithEnds G (Q j) (s j) (t j)) + (hst : ∀ j, s j ∈ Z ∧ t j ∈ Z ∧ s j ≠ t j) + (hdisj : Pairwise (fun i j => Disjoint V(Q i) V(Q j))) + (hPQ : ∀ j, Disjoint V(P) V(Q j)) + (hP'Q : ∀ j, Disjoint V(P') V(Q j)) : + ∃ (R : Fin (m + 1) → Graph α β) (x y : Fin (m + 1) → α), + Pairwise (fun i j => Disjoint V(R i) V(R j)) ∧ + ∀ i, x i ∈ Z ∧ y i ∈ Z ∧ x i ≠ y i ∧ + IsGraphPathWithEnds G (R i) (x i) (y i) := by + have hab : a ≠ b := by + intro hab + have haP' : a ∈ V(P') := hab ▸ hP'.right_mem + have : a ∈ ({v} : Set α) := hPP' ▸ ⟨hP.right_mem, haP'⟩ + exact hav (mem_singleton_iff.mp this) + let L := subgraphUnion G P P' + have hL : IsGraphPathWithEnds G L a b := hP.symm.subgraphUnion hP' hPP' + have hLQ : ∀ j, Disjoint V(L) V(Q j) := by + intro j + rw [vertexSet_subgraphUnion, disjoint_union_left] + exact ⟨hPQ j, hP'Q j⟩ + refine ⟨Fin.cons L Q, Fin.cons a s, Fin.cons b t, ?_, ?_⟩ + · intro i + refine Fin.cases ?_ (fun i => ?_) i + · intro j + refine Fin.cases ?_ (fun j => ?_) j + · intro hij + exact False.elim (hij rfl) + · intro _ + exact hLQ j + · intro j + refine Fin.cases ?_ (fun j => ?_) j + · intro _ + exact (hLQ i).symm + · intro hij + exact hdisj (fun h => hij (congrArg Fin.succ h)) + · intro i + refine Fin.cases ?_ (fun j => ?_) i + · exact ⟨ha, hb, hab, hL⟩ + · exact ⟨(hst j).1, (hst j).2.1, (hst j).2.2, hQ j⟩ + +/-- Graph Minors XVI, (5.4), the case `m = 0`. Two spokes form the +required path, as in the last paragraph of the proof on page 57. -/ +theorem theorem_5_4_zero + {α : Type u} {β : Type v} {G : Graph α β} {v : α} + {n : ℕ} {P : Fin n → Graph α β} {u : Fin n → α} + (hP : ∀ i, u i ≠ v ∧ IsGraphPathWithEnds G (P i) v (u i)) + (hinter : ∀ i j, i ≠ j → V(P i) ∩ V(P j) = {v}) + (hn : 2 ≤ n) : + ∃ (R : Fin 1 → Graph α β) (a b : Fin 1 → α), + Pairwise (fun i j => Disjoint V(R i) V(R j)) ∧ + ∀ i, a i ∈ range u ∧ b i ∈ range u ∧ a i ≠ b i ∧ + IsGraphPathWithEnds G (R i) (a i) (b i) := by + let i : Fin n := ⟨0, by omega⟩ + let j : Fin n := ⟨1, by omega⟩ + have hij : i ≠ j := by + intro h + have := congrArg Fin.val h + change 0 = 1 at this + contradiction + exact theorem_5_4_of_two_avoiding_spokes + (m := 0) (Q := fun k => k.elim0) (s := fun k => k.elim0) + (t := fun k => k.elim0) (hP i).2 (hP j).2 (hP i).1 (hinter i j hij) + ⟨i, rfl⟩ ⟨j, rfl⟩ (fun k => k.elim0) (fun k => k.elim0) + (fun k => k.elim0) (fun k => k.elim0) (fun k => k.elim0) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section5Proof.lean b/LeanPool/GraphMinor/GM16/Section5Proof.lean new file mode 100644 index 0000000000..8c79931d51 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section5Proof.lean @@ -0,0 +1,148 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section5Packing +import LeanPool.GraphMinor.GM16.Section5Minimal +import LeanPool.GraphMinor.GM09.Section3c +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Graph Minors XVI (5.3) + +Choose a minimal forest that keeps the connections between marked +vertices. Apply the subtree packing argument to it. The paths in this +forest lift to paths in the original graph with the same vertices, so +both the packing and the fan give the alternatives in (5.3). +-/ + +public section +namespace GraphMinor.GM16 + +open Set Graph SimpleGraph GraphMinor.Surface GraphMinor.GM09 +universe u v + +/-- Lift a path in a forest on the vertices of a graph back to that +graph. The set of vertices is exactly the image of the path support. -/ +theorem exists_graph_path_of_vertex_forest_path + {α : Type u} {β : Type v} (G : Graph α β) + (hV : V(G).Finite) (hE : E(G).Finite) + {F : SimpleGraph V(G)} + (hF : F ≤ (Hypergraph.ofGraph G hV hE).skeleton.induce V(G)) + {a b : V(G)} (p : F.Path a b) : + ∃ R : Graph α β, IsGraphPathWithEnds G R a.val b.val ∧ + V(R) = Subtype.val '' {z | z ∈ p.val.support} := by + let f : F →g (Hypergraph.ofGraph G hV hE).skeleton := + ⟨Subtype.val, fun h => hF h⟩ + have hp : (p.val.map f).IsPath := p.isPath.map Subtype.val_injective + obtain ⟨R, hR, hverts⟩ := exists_isGraphPathWithEnds_of_skeleton_isPath + hV hE a.property (p.val.map f) hp + have hsupp : (p.val.map f).support = p.val.support.map Subtype.val := + SimpleGraph.Walk.support_map f p.val + refine ⟨R, hR, ?_⟩ + rw [hverts, hsupp] + ext z + exact List.mem_map + +/-- **Graph Minors XVI, (5.3)** (page 56). A minimal forest preserving +the connections between marked vertices gives the subtree packing and +covering alternative. If the packing is too small, first-hit paths to +the cover and the paper's pigeonhole count give the required fan. -/ +theorem theorem_5_3_proof : GM16Theorem53Statement.{u, v} := by + classical + intro α β G Y μ τ hV hE hYG hcomp hcount + let U := V(G) + let : Finite U := hV.to_subtype + let K := (Hypergraph.ofGraph G hV hE).skeleton.induce V(G) + let Y₀ : Set U := {y | y.val ∈ Y} + have hYcard : Y₀.ncard = Y.ncard := by + apply Set.ncard_congr (fun y _ => y.val) + · intro y hy + exact hy + · intro a b _ _ hab + exact Subtype.ext hab + · intro y hy + exact ⟨⟨y, hYG hy⟩, hy, rfl⟩ + have hKcomp : ∀ y ∈ Y₀, ∃ z ∈ Y₀, z ≠ y ∧ K.Reachable y z := by + intro y hy + obtain ⟨z, hz, hzy, hreach⟩ := hcomp y.val hy + obtain ⟨w⟩ := skeleton_reachable_of_reflTransGen_adj hV hE hreach + obtain ⟨W, hW⟩ := exists_graphWalk_of_skeleton_walk hV hE y.property w + have hsupp : ∀ x ∈ w.support, x ∈ V(G) := by + intro x hx + apply W.mem_vertexSet_of_mem_support + rwa [hW] + refine ⟨⟨z, hYG hz⟩, hz, ?_, ⟨w.induce V(G) hsupp⟩⟩ + exact fun h => hzy (congrArg Subtype.val h) + obtain ⟨F, hFK, hF, hconn⟩ := exists_minimal_marked_forest K Y₀ + have hFcomp : ∀ y ∈ Y₀, ∃ z ∈ Y₀, z ≠ y ∧ F.Reachable y z := by + intro y hy + obtain ⟨z, hz, hzy, hr⟩ := hKcomp y hy + exact ⟨z, hz, hzy, hconn y hy z hz hr⟩ + have hnum : τ * (μ - 1) < Y₀.ncard := hYcard.symm ▸ hcount + rcases forest_marked_paths_or_fan F Y₀ μ τ hF hFcomp hnum with + ⟨Q, hQdisj⟩ | ⟨x, s, P, hs, hPinter, hPmarked⟩ + · have hlift := fun i => exists_graph_path_of_vertex_forest_path G hV hE hFK (Q i).path + choose R hR hverts using hlift + refine Or.inl ⟨R, fun i => (Q i).start.val, fun i => (Q i).finish.val, ?_, ?_⟩ + · intro i j hij + apply Set.disjoint_left.mpr + intro z hzi hzj + rw [hverts i] at hzi + rw [hverts j] at hzj + obtain ⟨a, ha, rfl⟩ := hzi + obtain ⟨b, hb, hba⟩ := hzj + have hba' : b = a := Subtype.ext hba + exact (Set.disjoint_left.mp (hQdisj hij)) ha (hba' ▸ hb) + · intro i + refine ⟨(Q i).start_mem, (Q i).finish_mem, + fun h => (Q i).ne (Subtype.ext h), hR i, Set.Subset.antisymm ?_ ?_⟩ + · rintro z ⟨hzR, hzY⟩ + rw [hverts i] at hzR + obtain ⟨a, ha, rfl⟩ := hzR + rcases (Q i).marked a ha hzY with h | h + · exact Or.inl (congrArg Subtype.val h) + · exact Or.inr (mem_singleton_iff.mpr (congrArg Subtype.val h)) + · rintro z (rfl | hz) + · exact ⟨IsGraphPathWithEnds.left_mem (hR i), (Q i).start_mem⟩ + · have hz' := mem_singleton_iff.mp hz + subst z + exact ⟨IsGraphPathWithEnds.right_mem (hR i), (Q i).finish_mem⟩ + · have hlift := fun i => exists_graph_path_of_vertex_forest_path G hV hE hFK (P i) + choose R hR hverts using hlift + have hinter : ∀ i j, i ≠ j → V(R i) ∩ V(R j) = {x.val} := by + intro i j hij + apply Set.Subset.antisymm + · rintro z ⟨hzi, hzj⟩ + rw [hverts i] at hzi + rw [hverts j] at hzj + obtain ⟨a, ha, rfl⟩ := hzi + obtain ⟨b, hb, hba⟩ := hzj + have hba' : b = a := Subtype.ext hba + have hai : a ∈ ({x} : Set U) := hPinter i j hij ▸ ⟨ha, hba' ▸ hb⟩ + exact mem_singleton_iff.mpr (congrArg Subtype.val (mem_singleton_iff.mp hai)) + · rintro z rfl + exact ⟨IsGraphPathWithEnds.right_mem (hR i), IsGraphPathWithEnds.right_mem (hR j)⟩ + refine Or.inr ⟨x.val, R, fun i => (s i).val, x.property, ?_, ?_⟩ + · intro i j hij + refine ⟨hinter i j hij, ?_⟩ + apply disjoint_edgeSet_of_inter_singleton (hR i) (IsGraphPathWithEnds.le (hR j)) + exact (hinter i j hij).subset + · intro i + refine ⟨(hPmarked i).1, fun h => (hPmarked i).2.1 (Subtype.ext h), + IsGraphPathWithEnds.symm (hR i), ?_⟩ + rintro z ⟨hzR, hzY⟩ + rw [hverts i] at hzR + obtain ⟨a, ha, rfl⟩ := hzR + rcases (hPmarked i).2.2 a ha hzY with h | h + · exact Or.inl (congrArg Subtype.val h) + · exact Or.inr (mem_singleton_iff.mpr (congrArg Subtype.val h)) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section5Reroute.lean b/LeanPool/GraphMinor/GM16/Section5Reroute.lean new file mode 100644 index 0000000000..87424832b3 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section5Reroute.lean @@ -0,0 +1,159 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section5 +import LeanPool.GraphMinor.GM16.Section5Four +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2c +import LeanPool.GraphMinor.GM09.Section3c + +/-! +# Rerouting the paths in XVI (5.5) + +Apply (5.4) in the union of the selected spokes and old paths. Shorten +each resulting path at its first other marked vertex. The union meets +the old graph only at the marked vertices and has no edge of that graph, +so the shortened paths are old-graph paths. Only the common spoke start +can be a new horn vertex on these paths. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM14 +universe u v + +/-- The shortening step on page 58 in XVI (5.5). A path with distinct +marked ends contains a path from its first end to another marked vertex +with no marked internal vertex. -/ +theorem path_trim_marked + {α : Type u} {β : Type v} {G P : Graph α β} {a b : α} {Z : Set α} + (hP : IsGraphPathWithEnds G P a b) (ha : a ∈ Z) (hb : b ∈ Z) (hab : a ≠ b) : + ∃ (c : α) (R : Graph α β), c ∈ Z ∧ a ≠ c ∧ R ≤ P ∧ + IsGraphPathWithEnds G R a c ∧ V(R) ∩ Z = {a, c} := by + obtain ⟨c, ⟨_, hcZ, hca⟩, R, hRP, hR, hhit, _⟩ := + hP.exists_first_hit (S := Z \ {a}) ⟨b, hP.right_mem, hb, by simpa using hab.symm⟩ + have hRG := hR.mono hP.le + refine ⟨c, R, hcZ, fun h => hca (mem_singleton_iff.mpr h.symm), hRP, hRG, + Set.Subset.antisymm ?_ ?_⟩ + · rintro z ⟨hzR, hzZ⟩ + by_cases hza : z = a + · exact Or.inl hza + · have hz : z ∈ ({c} : Set α) := hhit ▸ ⟨hzR, hzZ, by simpa using hza⟩ + exact Or.inr hz + · rintro z (rfl | hz) + · exact ⟨hRG.left_mem, ha⟩ + · have hzc := mem_singleton_iff.mp hz + subst z + exact ⟨hRG.right_mem, hcZ⟩ + +/-- The graph part of the induction step in XVI (5.5), Claim (1), +pages 57–58. The new paths have ends among the old ends and selected +spoke ends, and use at most one more horn vertex. -/ +theorem theorem_5_5_reroute + {α : Type u} {β : Type v} {G H : Graph α β} {X : Set α} + {x : α} {n m : ℕ} {P : Fin n → Graph α β} {u : Fin n → α} + {Q : Fin m → Graph α β} {s t : Fin m → α} + (hV : V(G).Finite) (hE : E(G).Finite) (hHG : H ≤ G) + (hX : X.Finite) (_hxG : x ∈ V(G)) + (hP : ∀ i, u i ≠ x ∧ IsGraphPathWithEnds G (P i) x (u i)) + (hPu : ∀ i, u i ∈ V(H)) + (hPH : ∀ i, V(P i) ∩ V(H) = {u i}) + (hPP : ∀ i j, i ≠ j → V(P i) ∩ V(P j) = {x} ∧ Disjoint E(P i) E(P j)) + (hPX : ∀ i, V(P i) ∩ X = {x}) + (hQ : ∀ j, IsHPathWithEnds G H (Q j) (s j) (t j)) + (hQQ : Pairwise (fun i j => Disjoint V(Q i) V(Q j))) + (hxQ : ∀ j, x ∉ V(Q j)) + (hcount : ((⋃ j, V(Q j)) ∩ X).ncard ≤ m) + (hn : 5 * m + 2 ≤ n) : + ∃ (R : Fin (m + 1) → Graph α β) (a b : Fin (m + 1) → α), + (∀ i, IsHPathWithEnds G H (R i) (a i) (b i)) ∧ + Pairwise (fun i j => Disjoint V(R i) V(R j)) ∧ + ((⋃ i, V(R i)) ∩ X).ncard ≤ m + 1 ∧ + ∀ i, a i ∈ range u ∪ range s ∪ range t ∧ b i ∈ range u ∪ range s ∪ range t := by + classical + let Z := range u ∪ range s ∪ range t + let J := subgraphSUnion G (range P ∪ range Q) + have hfamily : ∀ R ∈ range P ∪ range Q, R ≤ G := by + rintro R (⟨i, rfl⟩ | ⟨j, rfl⟩) + · exact (hP i).2.le + · exact (hQ j).2.1.le + have hJG : J ≤ G := subgraphSUnion_le hfamily + have hPJ : ∀ i, IsGraphPathWithEnds J (P i) x (u i) := fun i => + (hP i).2.of_le (le_subgraphSUnion hfamily (Or.inl ⟨i, rfl⟩)) + have hQJ : ∀ j, IsGraphPathWithEnds J (Q j) (s j) (t j) := fun j => + (hQ j).2.1.of_le (le_subgraphSUnion hfamily (Or.inr ⟨j, rfl⟩)) + have hnpos : 0 < n := by omega + let i₀ : Fin n := ⟨0, hnpos⟩ + have hxJ : x ∈ V(J) := (hPJ i₀).le.vertexSet_mono (hPJ i₀).left_mem + obtain ⟨R₀, a, b₀, hdisj₀, hR₀⟩ := theorem_5_4_proof J x n m P u Q s t + (hV.subset hJG.vertexSet_mono) (hE.subset hJG.edgeSet_mono) hxJ + (fun i => ⟨(hP i).1, hPJ i⟩) hPP + (fun j => ⟨hxQ j, hQJ j⟩) (fun j => (hQ j).2.2.1) hQQ hn + have htrim : ∀ i, ∃ (b : α) (R : Graph α β), b ∈ Z ∧ a i ≠ b ∧ R ≤ R₀ i ∧ + IsGraphPathWithEnds J R (a i) b ∧ V(R) ∩ Z = {a i, b} := by + intro i + obtain ⟨ha, hb, hab, hp⟩ := hR₀ i + exact path_trim_marked hp ha hb hab + choose b R hb hab hRR hR hRZ using htrim + have hZH : Z ⊆ V(H) := by + rintro z ((⟨i, rfl⟩ | ⟨j, rfl⟩) | ⟨j, rfl⟩) + · exact hPu i + · exact (hQ j).2.2.2.1 + · exact (hQ j).2.2.2.2.1 + have hJH : V(J) ∩ V(H) ⊆ Z := by + rintro z ⟨hzJ, hzH⟩ + obtain ⟨L, hL, hzL⟩ := mem_iUnion₂.mp hzJ + rcases hL with ⟨i, rfl⟩ | ⟨j, rfl⟩ + · have hzu := mem_singleton_iff.mp ((hPH i).subset ⟨hzL, hzH⟩) + exact Or.inl (Or.inl ⟨i, hzu.symm⟩) + · have hzst : z ∈ ({s j, t j} : Set α) := (hQ j).2.2.2.2.2.1 ▸ ⟨hzL, hzH⟩ + rcases hzst with hzs | hzt + · exact Or.inl (Or.inr ⟨j, hzs.symm⟩) + · exact Or.inr ⟨j, (mem_singleton_iff.mp hzt).symm⟩ + have hJedges : Disjoint E(J) E(H) := by + apply Set.disjoint_left.mpr + intro e heJ heH + rw [edgeSet_subgraphSUnion hfamily] at heJ + obtain ⟨L, hL, heL⟩ := mem_iUnion₂.mp heJ + rcases hL with ⟨i, rfl⟩ | ⟨j, rfl⟩ + · have hd := disjoint_edgeSet_of_inter_singleton (hP i).2 hHG (hPH i).subset + exact (Set.disjoint_left.mp hd) heL heH + · exact (Set.disjoint_left.mp (hQ j).2.2.2.2.2.2) heL heH + have hRX : ((⋃ i, V(R i)) ∩ X).ncard ≤ m + 1 := by + have hsub : (⋃ i, V(R i)) ∩ X ⊆ insert x ((⋃ j, V(Q j)) ∩ X) := by + rintro z ⟨hzR, hzX⟩ + obtain ⟨i, hzi⟩ := mem_iUnion.mp hzR + have hzJ := (hR i).le.vertexSet_mono hzi + obtain ⟨L, hL, hzL⟩ := mem_iUnion₂.mp hzJ + rcases hL with ⟨j, rfl⟩ | ⟨j, rfl⟩ + · exact Or.inl (mem_singleton_iff.mp ((hPX j).subset ⟨hzL, hzX⟩)) + · exact Or.inr ⟨mem_iUnion.mpr ⟨j, hzL⟩, hzX⟩ + have hfin := (hX.subset (inter_subset_right (s := ⋃ j, V(Q j)))).insert x + have hc := (ncard_le_ncard hsub hfin).trans (ncard_insert_le x ((⋃ j, V(Q j)) ∩ X)) + omega + refine ⟨R, a, b, ?_, ?_, hRX, ?_⟩ + · intro i + have ha : a i ∈ Z := (hR₀ i).1 + refine ⟨hHG, (hR i).mono hJG, hab i, hZH ha, hZH (hb i), + Set.Subset.antisymm ?_ ?_, ?_⟩ + · rintro z ⟨hzR, hzH⟩ + exact (hRZ i).subset ⟨hzR, hJH ⟨(hR i).le.vertexSet_mono hzR, hzH⟩⟩ + · rintro z (rfl | hz) + · exact ⟨(hR i).left_mem, hZH ha⟩ + · have hzb := mem_singleton_iff.mp hz + subst z + exact ⟨(hR i).right_mem, hZH (hb i)⟩ + · exact hJedges.mono_left (hR i).le.edgeSet_mono + · intro i j hij + exact (hdisj₀ hij).mono (hRR i).vertexSet_mono (hRR j).vertexSet_mono + · intro i + exact ⟨(hR₀ i).1, hb i⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6.lean b/LeanPool/GraphMinor/GM16/Section6.lean new file mode 100644 index 0000000000..3bd3644341 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6.lean @@ -0,0 +1,252 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.SpanRestriction + +public import LeanPool.GraphMinor.GM16.Section5 + +import LeanPool.GraphMinor.GM11.CitedResults + +/-! +# Graph Minors XVI, Section 6: Induction on Hairs + +This file formalizes Section 6 ("Induction on hairs", pages 58–61) of +N. Robertson and P. D. Seymour, *Graph Minors. XVI. Excluding a non-planar graph*, J. Combin. +Theory Ser. B 89 (2003) 43–76: + +- Restriction of a `SpanEmbedding H G` to a spanned subdrawing `H.span V' E'` + (`SpanEmbedding.restrictSpan`) + and to `clearedSubdrawing H Λ` (`SpanEmbedding.restrictCleared`). +- Statement of **Graph Minors XVI, (6.1)** (`GM16Theorem61Statement`, page 58). +- Statement and complete proof of **Graph Minors XVI, (6.2)** (`GM16Theorem62Statement`, + `theorem_6_2`, page 59): clearing a `λ`-zone preserves a horn of cardinality `σ` and breadth + `≥ θ - 4λ - 2` whenever a horn of cardinality `σ + 1` and breadth `≥ θ` is given. +- Statement of **Graph Minors XVI, (6.3)** (`GM16Theorem63Statement`, page 59). +- Complete proof of **Graph Minors XVI, (5.1)** (`theorem_5_1`, page 61) from `(6.1)` and `(6.3)` + by induction on the number of hairs `0 ≤ i ≤ δ`. +The backward and tower inductions are proved in `InductionsProved.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM16 + +open Set Function Topology +open Graph SimpleGraph Hypergraph +open GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 GraphMinor.GM15 + +universe u v w + +variable {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + +/-! ## Restriction of `SpanEmbedding` to Subdrawings -/ + +omit [T2Space S] in +/-- Every singleton vertex `{v}` with `v ∈ Γ.V` is an atom in `Γ.A`. -/ +theorem singleton_mem_A_of_mem_V {Γ : Drawing S} {v : S} (hv : v ∈ Γ.V) : + ({v} : Set S) ∈ Γ.A := + Or.inl (Or.inl ⟨v, hv, rfl⟩) + +/-- A vertex `w ∈ H.V` with `w ∉ Λ` belongs to `(clearedSubdrawing H Λ).V`. -/ +theorem mem_clearedSubdrawing_V {H : Drawing S} {Λ : Set S} {w : S} + (hw : w ∈ H.V) (hnot : w ∉ Λ) : + w ∈ (clearedSubdrawing H Λ).V := + Or.inl ⟨⟨hw, mem_univ w, hnot⟩, hw⟩ + +/-- Restriction of a `SpanEmbedding H G` to a spanned subdrawing `H.span V' E'`. -/ +def restrictSpan {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) (V' : Set S) (E' : Set (Set S)) : + SpanEmbedding (H.span V' E') G := + GM14.restrictSpan η V' E' + +/-- Restriction of a `SpanEmbedding H G` to `clearedSubdrawing H Λ = H.interSet (univ \ Λ)`. -/ +def restrictCleared {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) (Λ : Set S) : + SpanEmbedding (clearedSubdrawing H Λ) G := + GM14.restrictCleared η Λ + +@[simp] +theorem restrictCleared_vMap {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) (Λ : Set S) : + (restrictCleared η Λ).vMap = η.vMap := rfl + +theorem restrictCleared_imageGraph_le {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) (Λ : Set S) : + (restrictCleared η Λ).imageGraph ≤ η.imageGraph := + GM14.restrictCleared_imageGraph_le η Λ + +/-! ## Statements of (6.1), (6.2), and (6.3), and Proof of (6.2) (pages 58–60) -/ + +/-- Statement of Graph Minors XVI, (6.1) (page 58): +"Let $\Sigma$ be a surface, and let $p, \tau, \chi, \delta \ge 0$ and $\phi, \psi \ge 1$. Then there +exist $\sigma, \kappa, \rho, \zeta \ge 0$ and $\theta \ge 1$ such that if $\mathscr{T}^*$ is a +tangle +in a graph $G$, and there is an animal with $\chi$ horns and $\delta$ hairs, of strength +$\ge (\theta, \sigma)$, then either +1. there is a $\Sigma'$-span of order $\ge \phi$, for some surface $\Sigma'$ obtained from $\Sigma$ + by adding a handle or a crosscap, or +2. there is an animal with $\chi$ horns and $\delta + 1$ hairs, of strength $\ge (\psi, \tau)$, or +3. there exists $Z \subseteq V(G)$ with $|Z| \le \zeta$, and a $\mathscr{T}^* \setminus Z$-central + segregation of $G \setminus Z$ of type $(\rho, \kappa)$ with a proper arrangement in $\Sigma$, or +4. $\mathscr{T}^*$ controls a $K_p$-minor of $G$." -/ +def GM16Theorem61Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ p τ χ δ φ ψ : ℕ, 1 ≤ φ → 1 ≤ ψ → + ∃ σ κ ρ ζ θ : ℕ, 1 ≤ θ ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (hT : IsGraphTangle G θ_star T_star), + HasAnimal S G T_star θ_star χ δ θ σ → + (∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S') + (H' : Drawing S') (η' : SpanEmbedding H' G) (θ_span' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsClosedSurface S' ∧ ConnectedSpace S' ∧ + IsObtainedByAddingHandleOrCrosscap S S' ∧ + φ ≤ θ_span' ∧ IsSigmaSpan G H' η' θ_star θ_span' T_star T') ∨ + HasAnimal S G T_star θ_star χ (δ + 1) ψ τ ∨ + (∃ (Z : Set α) (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) (α_pt : α → S), + Z ⊆ V(G) ∧ Z.ncard ≤ ζ ∧ Z.ncard < θ_star ∧ + IsCentralSegregation (deleteVertices G Z) + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star) S_seg ∧ + IsSegregationOfType (deleteVertices G Z) ρ κ S_seg ∧ + IsProperArrangement S_seg α_disc α_pt) ∨ + ControlsMinor G (completeGraph p) T_star + +/-- Statement of Graph Minors XVI, (6.2) (page 59): +"Let $\Sigma$ be a surface and let $\sigma \ge 0$ be an integer. Let $\mathcal{T}^*$ be a tangle in +a graph $G$, and let $H, \mathcal{T}$ be a $\Sigma$-span of order $\theta$. Let $\lambda \ge 2$ be +an integer with $\theta \ge 4\lambda + 3$, let $\Lambda \subseteq \Sigma$ be a $\lambda$-zone such +that $H \cap (\Sigma \setminus \Lambda)$ is rigid, and let $\mathcal{T}'$ be the tangle in +$H' = H \cap (\Sigma \setminus \Lambda)$ of order $\theta - 4\lambda - 2$ which is a +$(4\lambda + 2)$-compression of $\mathcal{T}$. Let $v \in V(G) \setminus V(H)$, such that there is a +horn at $v$ over $H, \mathcal{T}$ with cardinality $\sigma + 1$ and breadth $\ge \theta$. Then there +is a horn at $v$ over $H', \mathcal{T}'$ with cardinality $\sigma$ and breadth +$\ge \theta - 4\lambda - 2$." -/ +def GM16Theorem62Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star θ lam σ : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) + (T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d d' : Set S → Set S → ℕ) + (Λ : Set S) (v : α) + (P : Fin (σ + 1) → Graph α β) (u : Fin (σ + 1) → S), + IsSigmaSpan G H η θ_star θ T_star T → + HasTangleMetric H θ T d → + 2 ≤ lam → 4 * lam + 3 ≤ θ → + IsLambdaZone H d lam Λ → + IsRigid (clearedSubdrawing H Λ) → + IsClearedTangle H T d θ lam Λ T' d' → + IsHorn G H η d v θ (σ + 1) P u → + ∃ (P' : Fin σ → Graph α β) (u' : Fin σ → S), + IsHorn G (clearedSubdrawing H Λ) (restrictCleared η Λ) d' v (θ - 4 * lam - 2) σ P' u' + +/-- **Graph Minors XVI, (6.2)** (page 59): +Clearing a `λ`-zone `Λ` (where `2 ≤ λ` and `4λ + 3 ≤ θ`) contains at most one end `u_i` of a horn +`{P_1, …, P_{σ+1}}` of breadth `≥ θ`, leaving a horn of cardinality `σ` and breadth +`≥ θ - 4λ - 2` over `H' = H ∩ (Σ \ Λ)` and the cleared tangle `T'`. -/ +theorem theorem_6_2_proof : + GM16Theorem62Statement.{u, v, w} := by + classical + intro S _ _ hS hconn α β G θ_star θ lam σ T_star H η T T' d d' Λ v P u + _hSpan hMet _hlam2 hθ_le hZone _hRigid hCleared hHorn + rcases hHorn with ⟨hv, hu_V, hP_path, hP_inter, hP_disj, hu_dist⟩ + obtain ⟨z, hzA, hZoneAround⟩ := hZone + obtain ⟨_, _, _, hsymm, htri, _⟩ := GraphMinor.GM11.gm15_theorem_9_1.{w} H θ T d hS hconn hMet + -- Claim: at most one index k : Fin (σ + 1) has u k ∈ Λ. + have hat_most_one : ∀ i j : Fin (σ + 1), u i ∈ Λ → u j ∈ Λ → i = j := by + intro i j hui huj + by_contra hij + have hui_A : ({u i} : Set S) ∈ H.A := singleton_mem_A_of_mem_V (hu_V i) + have huj_A : ({u j} : Set S) ∈ H.A := singleton_mem_A_of_mem_V (hu_V j) + have hdi : d z {u i} ≤ lam := + hZoneAround.dist_le {u i} hui_A (singleton_subset_iff.mpr (subset_closure hui)) + have hdj : d z {u j} ≤ lam := + hZoneAround.dist_le {u j} huj_A (singleton_subset_iff.mpr (subset_closure huj)) + have hdi_symm : d {u i} z = d z {u i} := hsymm {u i} hui_A z hzA + have htri_ij : d {u i} {u j} ≤ d {u i} z + d z {u j} := htri {u i} hui_A z hzA {u j} huj_A + have hge : θ ≤ d {u i} {u j} := hu_dist i j hij + omega + -- Choose an injection emb : Fin σ → Fin (σ + 1) avoiding Λ. + have hex_emb : ∃ emb : Fin σ → Fin (σ + 1), Injective emb ∧ ∀ i : Fin σ, u (emb i) ∉ Λ := by + by_cases hex : ∃ k : Fin (σ + 1), u k ∈ Λ + · obtain ⟨k₀, hk₀⟩ := hex + refine ⟨k₀.succAbove, Fin.succAbove_right_injective, fun i hui => ?_⟩ + exact Fin.succAbove_ne k₀ i (hat_most_one (k₀.succAbove i) k₀ hui hk₀) + · refine ⟨Fin.castSucc, Fin.castSucc_injective σ, fun i hui => hex ⟨Fin.castSucc i, hui⟩⟩ + obtain ⟨emb, hemb_inj, hu_not_mem⟩ := hex_emb + refine ⟨fun i => P (emb i), fun i => u (emb i), ?_⟩ + have hsub_V : V((restrictCleared η Λ).imageGraph) ⊆ V(η.imageGraph) := + (restrictCleared_imageGraph_le η Λ).vertexSet_mono + refine ⟨⟨hv.1, fun hv' => hv.2 (hsub_V hv')⟩, ?_, ?_, ?_, ?_, ?_⟩ + · intro i + exact mem_clearedSubdrawing_V (hu_V (emb i)) (hu_not_mem i) + · intro i + simpa [restrictCleared_vMap] using hP_path (emb i) + · intro i + apply Subset.antisymm + · calc + V(P (emb i)) ∩ V((restrictCleared η Λ).imageGraph) + ⊆ V(P (emb i)) ∩ V(η.imageGraph) := inter_subset_inter_right _ hsub_V + _ = {η.vMap (u (emb i))} := hP_inter (emb i) + · rw [singleton_subset_iff] + have hmem_Pi : η.vMap (u (emb i)) ∈ V(P (emb i)) := by + have : η.vMap (u (emb i)) ∈ V(P (emb i)) ∩ V(η.imageGraph) := by + rw [hP_inter (emb i)] + exact mem_singleton _ + exact this.1 + have hmem_H' : η.vMap (u (emb i)) ∈ V((restrictCleared η Λ).imageGraph) := + (restrictCleared η Λ).bijOn_v.mapsTo + (mem_clearedSubdrawing_V (hu_V (emb i)) (hu_not_mem i)) + exact ⟨hmem_Pi, hmem_H'⟩ + · intro i j hij + exact hP_disj (emb i) (emb j) (fun h_eq => hij (hemb_inj h_eq)) + · intro i j hij + have hemb_ne : emb i ≠ emb j := fun h_eq => hij (hemb_inj h_eq) + have hui_A : ({u (emb i)} : Set S) ∈ H.A := singleton_mem_A_of_mem_V (hu_V (emb i)) + have huj_A : ({u (emb j)} : Set S) ∈ H.A := singleton_mem_A_of_mem_V (hu_V (emb j)) + have hui_A' : ({u (emb i)} : Set S) ∈ (clearedSubdrawing H Λ).A := + singleton_mem_A_of_mem_V (mem_clearedSubdrawing_V (hu_V (emb i)) (hu_not_mem i)) + have huj_A' : ({u (emb j)} : Set S) ∈ (clearedSubdrawing H Λ).A := + singleton_mem_A_of_mem_V (mem_clearedSubdrawing_V (hu_V (emb j)) (hu_not_mem j)) + have hbd := (hCleared.dist_bounds {u (emb i)} hui_A {u (emb j)} huj_A + {u (emb i)} hui_A' {u (emb j)} huj_A' Subset.rfl Subset.rfl).1 + have hge := hu_dist (emb i) (emb j) hemb_ne + dsimp only + omega + +/-- Statement of Graph Minors XVI, (6.3) (page 59): +"Let $\Sigma$ be a surface, and let $p, \tau, \chi \ge 0$ and $\psi \ge 1$ be integers. Then there +exists $\delta \ge 0$ and $\theta \ge 1$ such that if $\mathcal{T}^*$ is a tangle in a graph $G$, +and +there is an animal with $\chi$ horns and $\delta$ hairs of strength $\ge (\theta, \tau + 1)$, then +either +- there is a hairless animal with $\chi + 1$ horns of strength $\ge (\psi, \tau)$, or +- $\mathcal{T}^*$ controls a $K_p$-minor of $G$." -/ +def GM16Theorem63Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ p τ χ ψ : ℕ, 1 ≤ ψ → + ∃ δ θ : ℕ, 1 ≤ θ ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)), + IsGraphTangle G θ_star T_star → + HasAnimal S G T_star θ_star χ δ θ (τ + 1) → + HasHairlessAnimal S G T_star θ_star (χ + 1) ψ τ ∨ + ControlsMinor G (completeGraph p) T_star + +/-! ## Proof of Graph Minors XVI, (5.1) from (6.1) and (6.3) (page 61) -/ + + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6ActiveBound.lean b/LeanPool/GraphMinor/GM16/Section6ActiveBound.lean new file mode 100644 index 0000000000..910626921f --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6ActiveBound.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6HairFamily +public import LeanPool.GraphMinor.GM16.Section6CliquePaths +import LeanPool.GraphMinor.GM16.Section5Proof +import LeanPool.GraphMinor.GM16.Section5Degree +import LeanPool.GraphMinor.GM16.Section6Linkages +import LeanPool.GraphMinor.GM16.Section6Animals + +import LeanPool.GraphMinor.GM12.Bridge + +/-! +# Bounding the active hairs in XVI (6.3) + +Apply (5.3) to the marked vertices in components of the truncated hair +union containing two marked vertices. Its path alternative gives the +controlled clique minor by (5.2). In its fan alternative, the centre is +outside the old drawing because its old vertices have at most one +neighbor. Shortening the fan gives the extra horn. If both desired +outcomes fail, at most `(μ - 1) * τ'` hairs are active. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w + +/-- Graph Minors XVI, proof of (6.3), Claims (1) and (2) and their +application of (5.3), page 60. The only exclusions are the two desired +outcomes of (6.3), not intermediate claims of its proof. -/ +theorem theorem_6_3_active_bound + {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {α : Type u} {β : Type v} {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {p τ τ' χ δ θ_star θ_span θ σ ψ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {X : Set α} {Y : Set S} + (hAnim : IsAnimal G T_star θ_star H η θ_span T d X Y χ δ θ σ) + (F : HairFamily G H η d X Y θ) + (hθ : cliquePathThreshold.{u, v, w} hS hConn p ≤ θ) + (hψ : 1 ≤ ψ) (hψθ : ψ ≤ θ) (hτσ : τ ≤ σ) (hττ' : τ ≤ τ') (hτ' : 2 ≤ τ') + (hNoClique : ¬ ControlsMinor G (completeGraph p) T_star) + (hNoHorn : ¬ HasHairlessAnimal S G T_star θ_star (χ + 1) ψ τ) : + F.active.ncard ≤ (p * (p - 1) / 2 - 1) * τ' := by + classical + have hSaved := hAnim + obtain ⟨_, horder, hSpan, hMet, _, _, hYsub, _, _, _, hsep⟩ := hAnim + let μ := p * (p - 1) / 2 + let A := activeMarkedVertices F.unionGraph (η.vMap '' Y) + have hG0V := hSpan.isControlling.isTangle_star.finite_V.subset F.union_le.vertexSet_mono + have hG0E := hSpan.isControlling.isTangle_star.finite_E.subset F.union_le.edgeSet_mono + have hAold : A ⊆ V(η.imageGraph) := by + intro x hx + obtain ⟨y, hy, rfl⟩ := hx.1 + exact η.bijOn_v.mapsTo (hYsub hy) + by_contra hnot + have hlarge : τ' * (μ - 1) < A.ncard := by + have hc := F.active_card_eq hYsub + change F.active.ncard = A.ncard at hc + rw [← hc] + simpa only [Nat.mul_comm] using Nat.lt_of_not_ge hnot + rcases theorem_5_3_proof F.unionGraph A μ τ' hG0V hG0E + (activeMarkedVertices_subset_vertexSet _ _) (activeMarkedVertices_component_hyp _ _) hlarge + with + ⟨P, a, b, hPP, hP⟩ | ⟨x, P, b, hxG0, hinter, hP⟩ + · apply hNoClique + apply (cliquePathThreshold_spec hS hConn p).2 G F.unionGraph θ_star θ_span + T_star H η T d Y P a b hSpan hMet (hθ.trans horder) hYsub + (fun y hy z hz hyz => hθ.trans (hsep y hy z hz hyz)) F.union_le + F.union_edges_disjoint_old F.union_inter_old.subset + · intro i + obtain ⟨ha, hb, hab, hp, _⟩ := hP i + exact ⟨hAold ha, hAold hb, hab, hp⟩ + · exact hPP + · have hxH : x ∉ V(η.imageGraph) := by + intro hxH + have hleaf := F.union_old_neighbors_subsingleton hYsub hxH + have hbound : {z | F.unionGraph.Adj x z}.ncard ≤ 1 := + (ncard_le_one hleaf.finite).mpr (fun _ ha _ hb => hleaf ha hb) + have hfan := fan_card_le_neighbors_ncard hG0V + (fun i => ⟨(hP i).2.1, (hP i).2.2.1⟩) + (fun i j hij => (hinter i j hij).1.subset) + omega + obtain ⟨R, ends, hHorn⟩ := horn_of_fan_in_subgraph F.union_le hxG0 hxH + F.union_inter_old.subset hYsub + (fun y hy z hz hyz => hψθ.trans (hsep y hy z hz hyz)) + (fun i => ⟨hAold (hP i).1, (hP i).2.2.1⟩) hinter + have hxX : x ∉ X := by + intro hxX + exact (Set.disjoint_left.mp F.union_avoids_horns) hxX hxG0 + apply hNoHorn + apply hSaved.add_horn hψ hψθ hτσ hxX + exact ⟨_, _, hHorn.mono le_rfl hττ'⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6Animals.lean b/LeanPool/GraphMinor/GM16/Section6Animals.lean new file mode 100644 index 0000000000..24da6d1aec --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6Animals.lean @@ -0,0 +1,59 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6 + +/-! +# Adding the new horn in XVI (6.3) + +A fan outside the old drawing gives a horn at a vertex outside the old +horn set. Add that vertex and drop the hairs. The old horns keep the +required strength by monotonicity, and the horn count increases by one. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w + +/-- Adding a new horn outside the old horn set gives the first outcome +in XVI (6.3), page 60. Existing hairs may be dropped. -/ +theorem IsAnimal.add_horn + {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ_span χ δ θ σ ψ τ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {X : Set α} {Y : Set S} + (h : IsAnimal G T_star θ_star H η θ_span T d X Y χ δ θ σ) + (hψ : 1 ≤ ψ) (hψθ : ψ ≤ θ) (hτσ : τ ≤ σ) + {v : α} (hvX : v ∉ X) + (hnew : ∃ (P : Fin τ → Graph α β) (ends : Fin τ → S), IsHorn G H η d v ψ τ P ends) : + HasHairlessAnimal S G T_star θ_star (χ + 1) ψ τ := by + obtain ⟨_, hθorder, hSpan, hMet, hXsub, hXcard, _, _, hHorns, _, _⟩ := h + obtain ⟨P, ends, hnew⟩ := hnew + have hXfin : X.Finite := hSpan.isControlling.isTangle_star.finite_V.subset + (fun x hx => (hXsub hx).1) + refine ⟨H, η, θ_span, T, d, insert v X, ∅, hψ, hψθ.trans hθorder, + hSpan, hMet, ?_, ?_, empty_subset _, ncard_empty S, ?_, ?_, ?_⟩ + · rintro x (rfl | hx) + · exact hnew.1 + · exact hXsub hx + · rw [ncard_insert_of_notMem hvX hXfin, hXcard] + · rintro x (rfl | hx) + · exact ⟨P, ends, hnew⟩ + · obtain ⟨Q, u, hQ⟩ := hHorns x hx + exact ⟨_, _, hQ.mono hψθ hτσ⟩ + · intro x hx + exact False.elim hx + · intro x hx + exact False.elim hx + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6ClearedHairGraph.lean b/LeanPool/GraphMinor/GM16/Section6ClearedHairGraph.lean new file mode 100644 index 0000000000..9fbe0d9085 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6ClearedHairGraph.lean @@ -0,0 +1,197 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6HairFamily +import LeanPool.GraphMinor.GM16.Section6ZoneWalks +import LeanPool.GraphMinor.GM16.Section6HairUnion +import LeanPool.GraphMinor.GM16.SpanPaths +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.Walks + +/-! +# The connected graph after clearing a zone in XVI (6.3) + +Join the full hair paths to the part of the old drawing in the closed +smaller zone. That part is connected and contains the far ends, rather +than `Y₄` as printed on page 60. The union is connected, avoids the horn +vertices, and meets the cleared drawing precisely at the near ends. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM11 + GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + +omit [T2Space S] in +private theorem span_image_connected {G : Graph α β} {H : Drawing S} + (η : SpanEmbedding H G) (hH : H.IsConnected) : IsGraphConnected η.imageGraph := by + constructor + · obtain ⟨a, ha⟩ := hH.1 + exact ⟨η.vMap a, η.bijOn_v.mapsTo ha⟩ + · intro x hx y hy + obtain ⟨a, ha, rfl⟩ := η.bijOn_v.surjOn hx + obtain ⟨b, hb, rfl⟩ := η.bijOn_v.surjOn hy + obtain ⟨W⟩ := hH.2 a ha b hb + exact ⟨mapSpanWalk η W⟩ + +private theorem disjoint_edges_of_disjoint_vertices {G C H : Graph α β} + (hCG : C ≤ G) (hHG : H ≤ G) (hd : Disjoint V(C) V(H)) : Disjoint E(C) E(H) := by + apply Set.disjoint_left.mpr + intro e heC heH + obtain ⟨a, b, he⟩ := C.exists_isLink_of_mem_edgeSet heC + have heH' := (hHG.isLink_iff heH).mpr (he.mono hCG) + exact (Set.disjoint_left.mp hd) he.left_mem heH'.left_mem + +/-- A drawing vertex in the open zone is absent from the cleared +embedded graph. -/ +theorem cleared_image_vertex_not_mem + {G : Graph α β} {H : Drawing S} (η : SpanEmbedding H G) {Λ : Set S} + (hΛ : IsOpen Λ) {y : S} (hy : y ∈ H.V) (hyΛ : y ∈ Λ) : + η.vMap y ∉ V((restrictCleared η Λ).imageGraph) := by + intro hyIm + obtain ⟨z, hz, heq⟩ := (restrictCleared η Λ).bijOn_v.surjOn hyIm + have hz' : z ∈ H.V ∧ z ∈ univ \ Λ := + (mem_interSet_V_iff (Γ := H) (by simpa only [← compl_eq_univ_sdiff] using + hΛ.isClosed_compl)).mp hz + have hzy : z = y := η.bijOn_v.injOn hz'.1 hy heq + exact hz'.2.2 (hzy.symm ▸ hyΛ) + +/-- Construct `G₂` in XVI (6.3), pages 60–61, and prove the properties +needed for the second application of (5.3). Its connected core contains +the far ends in the closed smaller zone, correcting the printed `Y₄`. -/ +theorem exists_connected_cleared_hair_graph + (hS : IsClosedSurface S) [ConnectedSpace S] + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {d : Set S → Set S → ℕ} {X : Set α} {Y Y₄ : Set S} {θ lam : ℕ} + (F : HairFamily G H η d X Y θ) (hY : Y ⊆ H.V) + (hX : X ⊆ V(G) \ V(η.imageGraph)) + (hH : (PaintingOrDrawing.drawing H).IsTwoCell) + {z Λ₁ Λ : Set S} (hZone : IsLambdaZoneAround H d lam z Λ₁) + (hΛ : IsOpen Λ) (hnest : closure Λ₁ ⊆ Λ) (hY₄ : Y₄ ⊆ Y) + (hfar : ∀ y ∈ Y₄, F.far y ∈ closure Λ₁) + (hnear : ∀ y ∈ Y₄, y ∉ Λ) : + ∃ K : Graph α β, K ≤ G ∧ IsGraphConnected K ∧ Disjoint X V(K) ∧ + Disjoint E(K) E((restrictCleared η Λ).imageGraph) ∧ + V(K) ∩ V((restrictCleared η Λ).imageGraph) = (restrictCleared η Λ).vMap '' Y₄ ∧ + ∀ x ∈ V((restrictCleared η Λ).imageGraph), {y | K.Adj x y}.Subsingleton := by + classical + let D := H.interSet (closure Λ₁) + let ηD := restrictSpan η (H.V ∩ closure Λ₁) {e | e ∈ H.E ∧ e ⊆ closure Λ₁} + let C := ηD.imageGraph + let η' := restrictCleared η Λ + let paths : Y₄ → Graph α β := fun y => F.path y.val + let K := subgraphSUnion G ({C} ∪ range paths) + have hC : IsGraphConnected C := span_image_connected ηD (zone_interSet_connected hS hH hZone) + have hCG : C ≤ G := ηD.imageGraph_le + have hCold : C ≤ η.imageGraph := by + apply Graph.restrict_le.trans + apply Graph.induce_le + rintro x ⟨y, hy, rfl⟩ + exact η.bijOn_v.mapsTo (H.spanV_subset _ _ hy) + have hCΛ : ∀ x ∈ V(C), ∃ y ∈ H.V, y ∈ Λ ∧ η.vMap y = x := by + intro x hx + obtain ⟨y, hy, rfl⟩ := ηD.bijOn_v.surjOn hx + have hyH := (Drawing.span_isSubdrawing H _ _).1 hy + have hycl : y ∈ closure Λ₁ := interSet_U_subset isClosed_closure (D.V_subset_U hy) + exact ⟨y, hyH, hnest hycl, rfl⟩ + have hCdisj : Disjoint V(C) V(η'.imageGraph) := by + apply Set.disjoint_left.mpr + intro x hxC hx' + obtain ⟨y, hy, hyΛ, rfl⟩ := hCΛ x hxC + exact cleared_image_vertex_not_mem η hΛ hy hyΛ hx' + have hfarC : ∀ y ∈ Y₄, η.vMap (F.far y) ∈ V(C) := by + intro y hy + apply ηD.bijOn_v.mapsTo + exact Or.inl ⟨⟨F.far_mem y (hY₄ hy), hfar y hy⟩, F.far_mem y (hY₄ hy)⟩ + have hPG : ∀ y : Y₄, paths y ≤ G := fun y => (F.is_hPath y.val (hY₄ y.property)).2.1.le + have hKG : K ≤ G := subgraphSUnion_le (by + rintro R (hR | ⟨y, rfl⟩) + · exact (mem_singleton_iff.mp hR) ▸ hCG + · exact hPG y) + have hConn : IsGraphConnected K := connected_union_of_core hCG hC hPG + (fun y => graphPath_isGraphConnected (F.is_hPath y.val (hY₄ y.property)).2.1) + (fun y => ⟨η.vMap (F.far y.val), hfarC y.val y.property, + (F.is_hPath y.val (hY₄ y.property)).2.1.right_mem⟩) + have hfamily : ∀ R ∈ ({C} : Set (Graph α β)) ∪ range paths, R ≤ G := by + rintro R (hR | ⟨y, rfl⟩) + · exact (mem_singleton_iff.mp hR) ▸ hCG + · exact hPG y + have hPinter : ∀ y : Y₄, V(paths y) ∩ V(η'.imageGraph) = {η.vMap y.val} := by + intro y + apply Set.Subset.antisymm + · rintro x ⟨hxP, hxH'⟩ + have hxH := (restrictCleared_imageGraph_le η Λ).vertexSet_mono hxH' + have hx : x ∈ ({η.vMap y.val, η.vMap (F.far y.val)} : Set α) := + (F.is_hPath y.val (hY₄ y.property)).2.2.2.2.2.1 ▸ ⟨hxP, hxH⟩ + rcases hx with hx | hx + · exact hx + · have heq := mem_singleton_iff.mp hx + have hfarNot := cleared_image_vertex_not_mem η hΛ (F.far_mem y.val (hY₄ y.property)) + (hnest (hfar y.val y.property)) + exact False.elim (hfarNot (heq ▸ hxH')) + · rintro x rfl + exact ⟨(F.is_hPath y.val (hY₄ y.property)).2.1.left_mem, + η'.bijOn_v.mapsTo (mem_clearedSubdrawing_V (hY (hY₄ y.property)) (hnear y.val y.property))⟩ + have hinter : V(K) ∩ V(η'.imageGraph) = η'.vMap '' Y₄ := by + apply Set.Subset.antisymm + · rintro x ⟨hxK, hxH'⟩ + obtain ⟨R, hR, hxR⟩ := mem_iUnion₂.mp hxK + rcases hR with hR | ⟨y, rfl⟩ + · have hRC := mem_singleton_iff.mp hR + exact False.elim ((Set.disjoint_left.mp hCdisj) (hRC ▸ hxR) hxH') + · have hxy := mem_singleton_iff.mp ((hPinter y).subset ⟨hxR, hxH'⟩) + exact ⟨y.val, y.property, hxy.symm⟩ + · rintro x ⟨y, hy, rfl⟩ + have hPnear : η.vMap y ∈ V(paths ⟨y, hy⟩) := (F.is_hPath y (hY₄ hy)).2.1.left_mem + exact ⟨(le_subgraphSUnion hfamily (Or.inr ⟨⟨y, hy⟩, rfl⟩)).vertexSet_mono hPnear, + η'.bijOn_v.mapsTo (mem_clearedSubdrawing_V (hY (hY₄ hy)) (hnear y hy))⟩ + refine ⟨K, hKG, hConn, ?_, ?_, hinter, ?_⟩ + · apply Set.disjoint_left.mpr + intro x hxX hxK + obtain ⟨R, hR, hxR⟩ := mem_iUnion₂.mp hxK + rcases hR with hR | ⟨y, rfl⟩ + · have hRC := mem_singleton_iff.mp hR + exact (hX hxX).2 (hCold.vertexSet_mono (hRC ▸ hxR)) + · exact (Set.disjoint_left.mp (F.avoids_horns y.val (hY₄ y.property))) hxX hxR + · apply Set.disjoint_left.mpr + intro e heK heH' + rw [edgeSet_subgraphSUnion hfamily] at heK + obtain ⟨R, hR, heR⟩ := mem_iUnion₂.mp heK + rcases hR with hR | ⟨y, rfl⟩ + · have hRC := mem_singleton_iff.mp hR + exact (Set.disjoint_left.mp (disjoint_edges_of_disjoint_vertices hCG η'.imageGraph_le hCdisj)) + (hRC ▸ heR) heH' + · exact (Set.disjoint_left.mp (F.is_hPath y.val (hY₄ y.property)).2.2.2.2.2.2) heR + ((restrictCleared_imageGraph_le η Λ).edgeSet_mono heH') + · intro x hxH' + have hleaf : {z | (subgraphSUnion G (range paths)).Adj x z}.Subsingleton := by + apply hair_union_old_neighbors_subsingleton + (P := paths) (a := fun y : Y₄ => η.vMap y.val) + (b := fun y : Y₄ => η.vMap (F.far y.val)) + (fun y => (F.is_hPath y.val (hY₄ y.property)).2.1) + (fun _ => le_rfl) hPinter ?_ hxH' + intro y z heq + exact Subtype.ext (η.bijOn_v.injOn (hY (hY₄ y.property)) (hY (hY₄ z.property)) heq) + have hsub : {z | K.Adj x z} ⊆ {z | (subgraphSUnion G (range paths)).Adj x z} := by + intro z hz + obtain ⟨R, hR, hAdj⟩ := (subgraphSUnion_adj_iff hfamily).mp hz + rcases hR with hR | hR + · have hRC := mem_singleton_iff.mp hR + obtain ⟨e, he⟩ := hAdj + exact False.elim ((Set.disjoint_left.mp hCdisj) (hRC ▸ he.left_mem) hxH') + · apply (subgraphSUnion_adj_iff (fun R hR => hfamily R (Or.inr hR))).mpr + exact ⟨R, hR, hAdj⟩ + intro a ha b hb + exact hleaf (hsub ha) (hsub hb) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6Clearing.lean b/LeanPool/GraphMinor/GM16/Section6Clearing.lean new file mode 100644 index 0000000000..e85611f624 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6Clearing.lean @@ -0,0 +1,146 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6 +import LeanPool.GraphMinor.GM16.Section8Truncation +import LeanPool.GraphMinor.GM12.Induced +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM12.Section4SpanSeparation + +/-! +# Clearing a zone in a span + +In XVI (6.3), page 60, the drawing and tangle obtained by clearing a zone +are again a span when the remaining drawing is rigid. Restrict a separation +to the original drawing and then to the cleared drawing. The membership +property of the cleared tangle preserves control by the ambient tangle. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Hypergraph GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 + GraphMinor.GM15 +universe u v w + +/-- Restriction of a separation along a span embedding is unique. -/ +theorem restrictedSeparation_unique + {S : Type w} [TopologicalSpace S] {α : Type u} {β : Type v} + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {A B : Hypergraph α β} {A₁ B₁ A₂ B₂ : Hypergraph S (Set S)} + (h₁ : IsRestrictedSeparation H G η A B A₁ B₁) + (h₂ : IsRestrictedSeparation H G η A B A₂ B₂) : A₁ = A₂ ∧ B₁ = B₂ := by + constructor + · apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq h₁.1.left_le h₂.1.left_le + · apply (η.bijOn_v.injOn.image_eq_image_iff h₁.1.left_le.vertexSet_subset + h₂.1.left_le.vertexSet_subset).mp + rw [h₁.2.1, h₂.2.1] + · apply (η.bijOn_e.injOn.image_eq_image_iff h₁.1.left_le.edgeSet_subset + h₂.1.left_le.edgeSet_subset).mp + rw [h₁.2.2.1, h₂.2.2.1] + · apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq h₁.1.right_le h₂.1.right_le + · apply (η.bijOn_v.injOn.image_eq_image_iff h₁.1.right_le.vertexSet_subset + h₂.1.right_le.vertexSet_subset).mp + rw [h₁.2.2.2.1, h₂.2.2.2.1] + · apply (η.bijOn_e.injOn.image_eq_image_iff h₁.1.right_le.edgeSet_subset + h₂.1.right_le.edgeSet_subset).mp + rw [h₁.2.2.2.2, h₂.2.2.2.2] + +/-- Restricting a separation to a cleared drawing is the same as +intersecting its restriction to the original drawing with that drawing. -/ +theorem restrictedSeparation_clear + {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {A B : Hypergraph α β} {A_H B_H : Hypergraph S (Set S)} (Λ : Set S) + (h : IsRestrictedSeparation H G η A B A_H B_H) : + IsRestrictedSeparation (clearedSubdrawing H Λ) G (restrictCleared η Λ) A B + (A_H ∩ (clearedSubdrawing H Λ).toHypergraph) + (B_H ∩ (clearedSubdrawing H Λ).toHypergraph) := by + let H' := clearedSubdrawing H Λ + let η' := restrictCleared η Λ + have hsub := clearedSubdrawing_isSubdrawing H Λ + have hHyp : H'.toHypergraph ≤ H.toHypergraph := by + refine ⟨hsub.1, hsub.2, fun e he => ?_⟩ + ext z + change (e ∈ H.E ∧ z ∈ H.V ∧ z ∈ closure e) ↔ + (e ∈ H'.E ∧ z ∈ H'.V ∧ z ∈ closure e) + constructor + · rintro ⟨_, hz, hze⟩ + have hz' : z ∈ closure e ∩ H'.V := by + rw [hsub.closure_inter_V he] + exact ⟨hze, hz⟩ + exact ⟨he, hz'.2, hze⟩ + · rintro ⟨_, hz, hze⟩ + exact ⟨hsub.2 he, hsub.1 hz, hze⟩ + have hηsub := restrictCleared_imageGraph_le η Λ + refine ⟨GM12.separation_inter_subgraph h.1 hHyp, ?_, ?_, ?_, ?_⟩ + · change η.vMap '' (A_H.vertexSet ∩ H'.V) = A.vertexSet ∩ V(η'.imageGraph) + rw [η.bijOn_v.injOn.image_inter h.1.left_le.vertexSet_subset hsub.1, h.2.1] + change (A.vertexSet ∩ V(η.imageGraph)) ∩ (η'.vMap '' H'.V) = _ + rw [η'.bijOn_v.image_eq, Set.inter_assoc, Set.inter_eq_right.mpr hηsub.vertexSet_mono] + · change η.eMap '' (A_H.edgeSet ∩ H'.E) = A.edgeSet ∩ E(η'.imageGraph) + rw [η.bijOn_e.injOn.image_inter h.1.left_le.edgeSet_subset hsub.2, h.2.2.1] + change (A.edgeSet ∩ E(η.imageGraph)) ∩ (η'.eMap '' H'.E) = _ + rw [η'.bijOn_e.image_eq, Set.inter_assoc, Set.inter_eq_right.mpr hηsub.edgeSet_mono] + · change η.vMap '' (B_H.vertexSet ∩ H'.V) = B.vertexSet ∩ V(η'.imageGraph) + rw [η.bijOn_v.injOn.image_inter h.1.right_le.vertexSet_subset hsub.1, h.2.2.2.1] + change (B.vertexSet ∩ V(η.imageGraph)) ∩ (η'.vMap '' H'.V) = _ + rw [η'.bijOn_v.image_eq, Set.inter_assoc, Set.inter_eq_right.mpr hηsub.vertexSet_mono] + · change η.eMap '' (B_H.edgeSet ∩ H'.E) = B.edgeSet ∩ E(η'.imageGraph) + rw [η.bijOn_e.injOn.image_inter h.1.right_le.edgeSet_subset hsub.2, h.2.2.2.2] + change (B.edgeSet ∩ E(η.imageGraph)) ∩ (η'.eMap '' H'.E) = _ + rw [η'.bijOn_e.image_eq, Set.inter_assoc, Set.inter_eq_right.mpr hηsub.edgeSet_mono] + +/-- Clearing a zone preserves a span if the cleared drawing is rigid. +This proves the assertion about `H', T'` in XVI (6.3), page 60. -/ +theorem IsSigmaSpan.clear + {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ lam : ℕ} {Λ : Set S} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} + (hSpan : IsSigmaSpan G H η θ_star θ T_star T) + (hclear : IsClearedTangle H T d θ lam Λ T' d') + (hrigid : IsRigid (clearedSubdrawing H Λ)) : + IsSigmaSpan G (clearedSubdrawing H Λ) (restrictCleared η Λ) + θ_star (θ - 4 * lam - 2) T_star T' := by + have hT := hSpan.isControlling.isTangle_star + have hforward : ∀ {A B : Hypergraph α β}, + (Hypergraph.ofGraph G hT.finite_V hT.finite_E).IsSeparation A B → + separationOrder A B < θ - 4 * lam - 2 → + ∀ {A' B'}, IsRestrictedSeparation (clearedSubdrawing H Λ) G + (restrictCleared η Λ) A B A' B' → + (A, B) ∈ T_star → (A', B') ∈ T' := by + intro A B hsep hord A' B' hrestr hm + obtain ⟨_, _, hrest, _, _, _, _, horder⟩ := + GM12.exists_span_restricted_separation hT.finite_V hT.finite_E H η hsep + have hmem := (hSpan.isControlling.controls hsep (by omega) hrest).mp hm + have hmem' := hclear.mem_of_order_lt _ _ hmem (horder.trans_lt hord) + obtain ⟨ha, hb⟩ := restrictedSeparation_unique (restrictedSeparation_clear Λ hrest) hrestr + rwa [ha, hb] at hmem' + refine ⟨hSpan.isSurface, hSpan.isConnected, hSpan.bd_empty, hrigid, + hclear.hasMetric.1, ⟨?_, hT, hclear.hasMetric.1.2.1, ?_⟩⟩ + · exact (Nat.sub_le _ _).trans ((Nat.sub_le _ _).trans hSpan.isControlling.theta_le) + · intro A B hsep hord A' B' hrestr + refine ⟨hforward hsep hord hrestr, ?_⟩ + intro hm + by_contra hnot + have hordstar : separationOrder A B < θ_star := + hord.trans_le ((Nat.sub_le _ _).trans ((Nat.sub_le _ _).trans hSpan.isControlling.theta_le)) + have hswap := (hT.isTangle.axiom1 hsep hordstar).resolve_left hnot + have hrestrswap : IsRestrictedSeparation (clearedSubdrawing H Λ) G + (restrictCleared η Λ) B A B' A' := + ⟨hrestr.1.symm, hrestr.2.2.2.1, hrestr.2.2.2.2, hrestr.2.1, hrestr.2.2.1⟩ + have hm' := hforward hsep.symm (by rwa [separationOrder_comm]) hrestrswap hswap + exact GM10.theorem_2_1_proof hclear.hasMetric.1.2.1 hm hm' + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6CliqueLinkage.lean b/LeanPool/GraphMinor/GM16/Section6CliqueLinkage.lean new file mode 100644 index 0000000000..3ea98cc6fb --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6CliqueLinkage.lean @@ -0,0 +1,102 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6CliquePaths +import LeanPool.GraphMinor.GM09.Basic + +import LeanPool.GraphMinor.GM12.Bridge + +/-! +# Applying the marked-path threshold to old-graph paths + +The union of old-graph paths has no old-graph edge, and its old-graph +vertices are just their ends. Thus the chosen threshold used in XVI +(6.3) applies directly to a separated family of old-graph paths. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w + +/-- Separated old-graph paths satisfy the marked-path threshold chosen +for the proof of XVI (6.3). -/ +theorem controlsMinor_of_separated_hPaths + {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) (p : ℕ) + {α : Type u} {β : Type v} {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ_span : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + {P : Fin (p * (p - 1) / 2) → Graph α β} {s t : Fin (p * (p - 1) / 2) → S} + (hSpan : IsSigmaSpan G H η θ_star θ_span T_star T) (hMet : HasTangleMetric H θ_span T d) + (horder : cliquePathThreshold.{u, v, w} hS hConn p ≤ θ_span) + (hst : ∀ i, s i ∈ H.V ∧ t i ∈ H.V) + (hP : ∀ i, IsHPathWithEnds G η.imageGraph (P i) (η.vMap (s i)) (η.vMap (t i))) + (hPP : Pairwise (fun i j => Disjoint V(P i) V(P j))) + (hsep : ∀ a ∈ range s ∪ range t, ∀ b ∈ range s ∪ range t, + a ≠ b → cliquePathThreshold.{u, v, w} hS hConn p ≤ d {a} {b}) : + ControlsMinor G (completeGraph p) T_star := by + let K := subgraphSUnion G (range P) + let Y := range s ∪ range t + have hF : ∀ R ∈ range P, R ≤ G := by + rintro R ⟨i, rfl⟩ + exact (hP i).2.1.le + have hKG : K ≤ G := subgraphSUnion_le hF + have hKH : Disjoint E(K) E(η.imageGraph) := by + apply Set.disjoint_left.mpr + intro e heK heH + rw [edgeSet_subgraphSUnion hF] at heK + obtain ⟨R, ⟨i, rfl⟩, heR⟩ := mem_iUnion₂.mp heK + exact (Set.disjoint_left.mp (hP i).2.2.2.2.2.2) heR heH + have hKY : V(K) ∩ V(η.imageGraph) ⊆ η.vMap '' Y := by + rintro x ⟨hxK, hxH⟩ + obtain ⟨R, ⟨i, rfl⟩, hxR⟩ := mem_iUnion₂.mp hxK + have hx : x ∈ ({η.vMap (s i), η.vMap (t i)} : Set α) := + (hP i).2.2.2.2.2.1 ▸ ⟨hxR, hxH⟩ + rcases hx with hx | hx + · exact ⟨s i, Or.inl ⟨i, rfl⟩, hx.symm⟩ + · exact ⟨t i, Or.inr ⟨i, rfl⟩, (mem_singleton_iff.mp hx).symm⟩ + have hY : Y ⊆ H.V := by + rintro y (⟨i, rfl⟩ | ⟨i, rfl⟩) + · exact (hst i).1 + · exact (hst i).2 + apply (cliquePathThreshold_spec hS hConn p).2 G K θ_star θ_span T_star H η T d Y + P (fun i => η.vMap (s i)) (fun i => η.vMap (t i)) hSpan hMet horder hY hsep hKG hKH hKY + · intro i + exact ⟨(hP i).2.2.2.1, (hP i).2.2.2.2.1, (hP i).2.2.1, + (hP i).2.1.of_le (le_subgraphSUnion hF ⟨i, rfl⟩)⟩ + · exact hPP + +/-- When `p` has no pair of distinct vertices, the path requirement is +empty. This supplies the small-`p` case of XVI (6.3), page 59. -/ +theorem controlsMinor_of_zero_pairs + {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) (p : ℕ) + {α : Type u} {β : Type v} {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ_span : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hSpan : IsSigmaSpan G H η θ_star θ_span T_star T) (hMet : HasTangleMetric H θ_span T d) + (horder : cliquePathThreshold.{u, v, w} hS hConn p ≤ θ_span) + (hμ : p * (p - 1) / 2 = 0) : ControlsMinor G (completeGraph p) T_star := by + have hempty : Fin (p * (p - 1) / 2) → False := by + intro i + have hi := i.isLt + omega + apply controlsMinor_of_separated_hPaths hS hConn p + (P := fun i => (hempty i).elim) (s := fun i => (hempty i).elim) + (t := fun i => (hempty i).elim) hSpan hMet horder + (fun i => (hempty i).elim) (fun i => (hempty i).elim) (fun i => (hempty i).elim) + rintro a (⟨i, _⟩ | ⟨i, _⟩) <;> exact (hempty i).elim + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6CliquePaths.lean b/LeanPool/GraphMinor/GM16/Section6CliquePaths.lean new file mode 100644 index 0000000000..0916fdda64 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6CliquePaths.lean @@ -0,0 +1,105 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6 +import LeanPool.GraphMinor.GM16.Section6Linkages + +public import LeanPool.GraphMinor.GM12.Bridge + +/-! +# The two applications of (5.2) in XVI (6.3) + +The paths used on pages 60–61 lie in a subgraph with no edge of the +embedded drawing. Its drawing vertices are all in a separated marked +set. Shortening the paths gives exactly the paths required by (5.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w + +/-- The threshold from (5.2) also applies to disjoint paths in any +subgraph whose old-graph vertices lie in a separated set. This proves +the form used twice in XVI (6.3), pages 60–61. -/ +theorem clique_threshold_for_marked_paths + {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) (p : ℕ) : + ∃ r : ℕ, 1 ≤ r ∧ + ∀ {α : Type u} {β : Type v} (G K : Graph α β) (θ_star θ_span : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (Y : Set S) + (P : Fin (p * (p - 1) / 2) → Graph α β) + (a b : Fin (p * (p - 1) / 2) → α), + IsSigmaSpan G H η θ_star θ_span T_star T → HasTangleMetric H θ_span T d → + r ≤ θ_span → Y ⊆ H.V → + (∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → r ≤ d {y} {z}) → + K ≤ G → Disjoint E(K) E(η.imageGraph) → + V(K) ∩ V(η.imageGraph) ⊆ η.vMap '' Y → + (∀ i, a i ∈ V(η.imageGraph) ∧ b i ∈ V(η.imageGraph) ∧ a i ≠ b i ∧ + GraphMinor.GM09.IsGraphPathWithEnds K (P i) (a i) (b i)) → + Pairwise (fun i j => Disjoint V(P i) V(P j)) → ControlsMinor G (completeGraph p) T_star + := by + obtain ⟨r, hr, h52⟩ := theorem_5_2_proof hS hConn p + refine ⟨r, hr, ?_⟩ + intro α β G K θ_star θ_span T_star H η T d Y P a b + hSpan hMet horder hY hsep hKG hKH hKY hP hPP + obtain ⟨R, s, t, hst, hR, hRR⟩ := + hPaths_of_disjoint_paths_in_subgraph hKG hKH hKY hP hPP + obtain ⟨hs, ht, hstdisj⟩ := hPath_end_labels_injective hR hRR + apply h52 G θ_star θ_span T_star H η T d s t R hSpan hMet horder + (fun i => ⟨hY (hst i).1, hY (hst i).2.1, (hst i).2.2⟩) hs ht hstdisj + · intro y hy z hz hyz + have hyY : y ∈ Y := by + rcases hy with ⟨i, rfl⟩ | ⟨i, rfl⟩ + · exact (hst i).1 + · exact (hst i).2.1 + have hzY : z ∈ Y := by + rcases hz with ⟨i, rfl⟩ | ⟨i, rfl⟩ + · exact (hst i).1 + · exact (hst i).2.1 + exact hsep y hyY z hzY hyz + · exact hR + · exact hRR + +/-- The threshold from (5.2) for the two marked-path applications in +XVI (6.3), pages 60–61. -/ +noncomputable def cliquePathThreshold.{u', v', w'} + {S : Type w'} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) (p : ℕ) : ℕ := + (clique_threshold_for_marked_paths.{u', v', w'} hS hConn p).choose + +/-- The marked-path property of the chosen threshold. -/ +theorem cliquePathThreshold_spec + {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) (p : ℕ) : + 1 ≤ cliquePathThreshold.{u, v, w} hS hConn p ∧ + ∀ {α : Type u} {β : Type v} (G K : Graph α β) (θ_star θ_span : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (Y : Set S) + (P : Fin (p * (p - 1) / 2) → Graph α β) + (a b : Fin (p * (p - 1) / 2) → α), + IsSigmaSpan G H η θ_star θ_span T_star T → HasTangleMetric H θ_span T d → + cliquePathThreshold.{u, v, w} hS hConn p ≤ θ_span → Y ⊆ H.V → + (∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → cliquePathThreshold.{u, v, w} hS + hConn p ≤ d {y} {z}) → + K ≤ G → Disjoint E(K) E(η.imageGraph) → + V(K) ∩ V(η.imageGraph) ⊆ η.vMap '' Y → + (∀ i, a i ∈ V(η.imageGraph) ∧ b i ∈ V(η.imageGraph) ∧ a i ≠ b i ∧ + GraphMinor.GM09.IsGraphPathWithEnds K (P i) (a i) (b i)) → + Pairwise (fun i j => Disjoint V(P i) V(P j)) → ControlsMinor G (completeGraph p) T_star + := by + exact (clique_threshold_for_marked_paths.{u, v, w} hS hConn p).choose_spec + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6ClusterProof.lean b/LeanPool/GraphMinor/GM16/Section6ClusterProof.lean new file mode 100644 index 0000000000..791fcb33ae --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6ClusterProof.lean @@ -0,0 +1,135 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6HairFamily +public import LeanPool.GraphMinor.GM16.Section6CliquePaths +import LeanPool.GraphMinor.GM16.Section6ActiveBound +import LeanPool.GraphMinor.GM16.Section6Clustering +import LeanPool.GraphMinor.GM16.Section6CliqueLinkage + +import LeanPool.GraphMinor.GM12.Bridge + +/-! +# Producing the cluster in XVI (6.3) + +The active hair bound leaves many hairs in separate components. Apply +the maximal-pair selection argument. Its separated-pair alternative gives +a clique minor, so failure of both desired outcomes yields a large set +of far hair ends close to one drawing vertex. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w + +private theorem hair_cluster_count_arithmetic {μ τ' : ℕ} (hμ : 1 ≤ μ) (hτ : 2 ≤ τ') : + 2 * (μ - 1) * (μ * τ') + (μ - 1) * τ' < 2 * μ ^ 2 * τ' ^ 2 := by + have hμsq : μ ≤ μ ^ 2 := by nlinarith + have hτsq : 2 * τ' ≤ τ' ^ 2 := by nlinarith + have hB := Nat.mul_le_mul_right τ' ((Nat.sub_le μ 1).trans hμsq) + have hA := Nat.mul_le_mul_right (μ * τ') (Nat.sub_le μ 1) + have hδ := Nat.mul_le_mul_left (2 * μ ^ 2) hτsq + have hpos : 0 < μ ^ 2 * τ' := Nat.mul_pos (pow_pos (by omega) _) (by omega) + nlinarith + +/-- Graph Minors XVI, proof of (6.3), page 60: if neither conclusion +holds, many far hair ends lie within distance less than `r` of one vertex. +This includes the construction of the maximal separated family, not a +hypothesis asserting its consequence. -/ +theorem theorem_6_3_far_end_cluster + {S : Type w} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + {α : Type u} {β : Type v} {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {p τ τ' χ δ θ_star θ_span θ σ ψ r : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {X : Set α} {Y : Set S} + (hAnim : IsAnimal G T_star θ_star H η θ_span T d X Y χ δ θ σ) + (F : HairFamily G H η d X Y θ) + (hμ : 1 ≤ p * (p - 1) / 2) + (hδ : δ = 2 * (p * (p - 1) / 2) ^ 2 * τ' ^ 2) + (hr₀ : cliquePathThreshold.{u, v, w} hS hConn p ≤ r) (hr : 1 + ≤ r) (hθ : 2 * r < θ) + (hψ : 1 ≤ ψ) (hψθ : ψ ≤ θ) (hτσ : τ ≤ σ) (hττ' : τ ≤ τ') (hτ' : 2 ≤ τ') + (hself : ∀ a ∈ H.V, d {a} {a} = 0) + (hsymm : ∀ a ∈ H.V, ∀ b ∈ H.V, d {a} {b} = d {b} {a}) + (htri : ∀ a ∈ H.V, ∀ b ∈ H.V, ∀ c ∈ H.V, + d {a} {c} ≤ d {a} {b} + d {b} {c}) + (hNoClique : ¬ ControlsMinor G (completeGraph p) T_star) + (hNoHorn : ¬ HasHairlessAnimal S G T_star θ_star (χ + 1) ψ τ) : + ∃ w ∈ H.V, ∃ Y₄ ⊆ Y, (p * (p - 1) / 2) * τ' ≤ Y₄.ncard ∧ + ∀ y ∈ Y₄, d {F.far y} {w} < r := by + classical + let μ := p * (p - 1) / 2 + have hSaved := hAnim + obtain ⟨_, horder, hSpan, hMet, _, _, hYsub, hYcard, _, _, hsep⟩ := hAnim + have hrθ : r ≤ θ := by omega + have hYfin : Y.Finite := H.finite_V.subset hYsub + have hsmall := theorem_6_3_active_bound hS hConn hSaved F (hr₀.trans hrθ) + hψ hψθ hτσ hττ' hτ' hNoClique hNoHorn + have hnum : 2 * (μ - 1) * (μ * τ') < (Y \ F.active).ncard := by + have ha := hair_cluster_count_arithmetic hμ hτ' + have hc := ncard_le_ncard_sdiff_add_ncard Y F.active + (hYfin.subset (fun _ h => h.1)) + rw [hδ] at hYcard + change F.active.ncard ≤ (μ - 1) * τ' at hsmall + change 2 * (μ - 1) * (μ * τ') + (μ - 1) * τ' < 2 * μ ^ 2 * τ' ^ 2 at ha + change Y.ncard = 2 * μ ^ 2 * τ' ^ 2 at hYcard + omega + rcases separated_pairs_or_far_end_cluster (hYfin.sdiff) (fun _ h => hYsub h.1) + (fun y hy => F.far_mem y hy.1) hr hself hsymm htri + (fun y hy z hz hyz => lt_of_lt_of_le hθ (hsep y hy.1 z hz.1 hyz)) hnum with + ⟨f, hf, hcross⟩ | ⟨w, hw, Y₄, hY₄, hY₄card, hnear⟩ + · have hpairH : ∀ i, ∀ a ∈ ({f i, F.far (f i)} : Set S), a ∈ H.V := by + intro i a ha + rcases ha with rfl | ha + · exact hYsub (hf i).1 + · exact (mem_singleton_iff.mp ha) ▸ F.far_mem (f i) (hf i).1 + have hcross_ne : ∀ i j, i ≠ j → ∀ a ∈ ({f i, F.far (f i)} : Set S), + ∀ b ∈ ({f j, F.far (f j)} : Set S), a ≠ b := by + intro i j hij a ha b hb heq + have hd := hcross i j hij a ha b hb + rw [heq, hself b (hpairH j b hb)] at hd + omega + have hPP : Pairwise (fun i j => Disjoint V(F.path (f i)) V(F.path (f j))) := by + intro i j hij + exact F.full_hairs_disjoint hYsub (hf i).1 (hf j).1 (f.injective.ne hij) (hf i).2 + (hcross_ne i j hij _ (mem_insert_of_mem _ (mem_singleton _)) _ (mem_insert _ _)) + (hcross_ne i j hij _ (mem_insert_of_mem _ (mem_singleton _)) _ + (mem_insert_of_mem _ (mem_singleton _))) + (hcross_ne i j hij _ (mem_insert _ _) _ (mem_insert_of_mem _ (mem_singleton _))) + have hsepR : ∀ a ∈ range f ∪ range (fun i => F.far (f i)), + ∀ b ∈ range f ∪ range (fun i => F.far (f i)), a ≠ b → r ≤ d {a} {b} := by + rintro a (⟨i, rfl⟩ | ⟨i, rfl⟩) b (⟨j, rfl⟩ | ⟨j, rfl⟩) hab + · have hij : i ≠ j := fun h => hab (congrArg f h) + exact hcross i j hij _ (mem_insert _ _) _ (mem_insert _ _) + · by_cases hij : i = j + · subst j + exact hrθ.trans (F.dist (f i) (hf i).1) + · exact hcross i j hij _ (mem_insert _ _) _ (mem_insert_of_mem _ (mem_singleton _)) + · by_cases hij : i = j + · subst j + rw [hsymm (F.far (f i)) (F.far_mem (f i) (hf i).1) (f i) (hYsub (hf i).1)] + exact hrθ.trans (F.dist (f i) (hf i).1) + · exact hcross i j hij _ (mem_insert_of_mem _ (mem_singleton _)) _ (mem_insert _ _) + · have hij : i ≠ j := fun h => hab (congrArg (fun i => F.far (f i)) h) + exact hcross i j hij _ (mem_insert_of_mem _ (mem_singleton _)) _ + (mem_insert_of_mem _ (mem_singleton _)) + apply False.elim + apply hNoClique + exact controlsMinor_of_separated_hPaths hS hConn p hSpan hMet + (hr₀.trans (hrθ.trans horder)) + (fun i => ⟨hYsub (hf i).1, F.far_mem (f i) (hf i).1⟩) + (fun i => F.is_hPath (f i) (hf i).1) hPP + (fun a ha b hb hab => hr₀.trans (hsepR a ha b hb hab)) + · exact ⟨w, hw, Y₄, fun y hy => (hY₄ hy).1, hY₄card, hnear⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6Clustering.lean b/LeanPool/GraphMinor/GM16/Section6Clustering.lean new file mode 100644 index 0000000000..dff943eed5 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6Clustering.lean @@ -0,0 +1,168 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section5Forest +import Mathlib.Data.Finset.Max +import Mathlib.Data.Finset.Powerset +import Mathlib.Data.Fintype.EquivFin + +/-! +# The cluster of far hair ends in XVI (6.3) + +Choose a largest family of pairs whose ends are far from the ends of +every other pair. Either it has `μ` members, or every remaining pair +has an end near this family. The pigeonhole principle gives many pairs +near one end. At most one near end of a hair can be in that group, since +all near ends are widely separated. Thus many far ends lie near one point. +-/ + +public section +namespace GraphMinor.GM16 +open Set Function +universe w + +/-- The maximal-family and pigeonhole argument producing `Y₄` in XVI +(6.3), page 60. The maximality condition applies to every member of `Y`, +correcting the printed sentence that says only `y ∈ Y₂`. -/ +theorem separated_pairs_or_far_end_cluster + {S : Type w} {U Y : Set S} {far : S → S} {d : S → S → ℕ} {r μ k : ℕ} + (hY : Y.Finite) (hYU : Y ⊆ U) (hfarU : ∀ y ∈ Y, far y ∈ U) + (hr : 1 ≤ r) + (hself : ∀ z ∈ U, d z z = 0) + (hsymm : ∀ a ∈ U, ∀ b ∈ U, d a b = d b a) + (htri : ∀ a ∈ U, ∀ b ∈ U, ∀ c ∈ U, d a c ≤ d a b + d b c) + (hsep : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → 2 * r < d y z) + (hcount : 2 * (μ - 1) * k < Y.ncard) : + (∃ f : Fin μ ↪ S, (∀ i, f i ∈ Y) ∧ + ∀ i j, i ≠ j → ∀ a ∈ ({f i, far (f i)} : Set S), + ∀ b ∈ ({f j, far (f j)} : Set S), r ≤ d a b) ∨ + (∃ w ∈ U, ∃ Y₄ ⊆ Y, k ≤ Y₄.ncard ∧ ∀ y ∈ Y₄, d (far y) w < r) := by + classical + let cross : S → S → Prop := fun y z => + ∀ a ∈ ({y, far y} : Set S), ∀ b ∈ ({z, far z} : Set S), r ≤ d a b + let good : Finset S → Prop := fun I => + ∀ y ∈ I, ∀ z ∈ I, y ≠ z → cross y z + let candidates := hY.toFinset.powerset.filter good + have hempty : (∅ : Finset S) ∈ candidates := by + simp only [candidates, Finset.mem_filter, Finset.mem_powerset] + exact ⟨Finset.empty_subset _, by intro y hy; exact False.elim (Finset.notMem_empty y hy)⟩ + obtain ⟨I, hI, hmax⟩ := Finset.exists_max_image candidates Finset.card ⟨∅, hempty⟩ + have hIY : (I : Set S) ⊆ Y := by + intro y hy + exact hY.mem_toFinset.mp ((Finset.mem_powerset.mp (Finset.mem_filter.mp hI).1) hy) + have hIgood : good I := (Finset.mem_filter.mp hI).2 + by_cases hlarge : μ ≤ I.card + · obtain ⟨f, hf⟩ := Function.Embedding.exists_of_card_le_finset + (α := Fin μ) (s := I) (by simpa using hlarge) + refine Or.inl ⟨f, fun i => hIY (hf ⟨i, rfl⟩), ?_⟩ + intro i j hij + exact hIgood (f i) (hf ⟨i, rfl⟩) (f j) (hf ⟨j, rfl⟩) (f.injective.ne hij) + · let W := (I : Set S) ∪ far '' (I : Set S) + have hW : W.Finite := I.finite_toSet.union (I.finite_toSet.image far) + have hWU : W ⊆ U := by + rintro z (hz | ⟨y, hy, rfl⟩) + · exact hYU (hIY hz) + · exact hfarU y (hIY hy) + have hWcard : W.ncard ≤ 2 * (μ - 1) := by + have hc := ncard_union_le (I : Set S) (far '' (I : Set S)) + have himg := ncard_image_le (f := far) (s := (I : Set S)) + rw [ncard_coe_finset] at hc himg + change ((I : Set S) ∪ far '' (I : Set S)).ncard ≤ 2 * (μ - 1) + omega + have hnear : ∀ y ∈ Y, ∃ w ∈ W, d y w < r ∨ d (far y) w < r := by + intro y hy + by_cases hyI : y ∈ I + · refine ⟨y, Or.inl hyI, Or.inl ?_⟩ + rw [hself y (hYU hy)] + exact hr + · by_contra hnone + have hfar : ∀ w ∈ W, r ≤ d y w ∧ r ≤ d (far y) w := by + intro w hw + exact ⟨Nat.le_of_not_gt (fun h => hnone ⟨w, hw, Or.inl h⟩), + Nat.le_of_not_gt (fun h => hnone ⟨w, hw, Or.inr h⟩)⟩ + have hcross : ∀ z ∈ I, cross y z := by + intro z hz a ha b hb + have hbW : b ∈ W := by + rcases hb with rfl | hb + · exact Or.inl hz + · exact Or.inr ⟨z, hz, (mem_singleton_iff.mp hb).symm⟩ + rcases ha with rfl | ha + · exact (hfar b hbW).1 + · have hay := mem_singleton_iff.mp ha + subst a + exact (hfar b hbW).2 + have hgood : good (insert y I) := by + intro a ha b hb hab + rcases Finset.mem_insert.mp ha with hay | haI + · subst a + rcases Finset.mem_insert.mp hb with hby | hbI + · exact False.elim (hab hby.symm) + · exact hcross b hbI + · rcases Finset.mem_insert.mp hb with hby | hbI + · subst b + intro z hz w hw + have hzU : z ∈ U := by + rcases hz with rfl | hz + · exact hYU (hIY haI) + · exact (mem_singleton_iff.mp hz) ▸ hfarU a (hIY haI) + have hwU : w ∈ U := by + rcases hw with rfl | hw + · exact hYU hy + · exact (mem_singleton_iff.mp hw) ▸ hfarU y hy + rw [hsymm z hzU w hwU] + exact hcross a haI w hw z hz + · exact hIgood a haI b hbI hab + have hinsert : insert y I ∈ candidates := by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_powerset.mpr ?_, hgood⟩ + exact Finset.insert_subset (hY.mem_toFinset.mpr hy) + (Finset.mem_powerset.mp (Finset.mem_filter.mp hI).1) + have hc := hmax (insert y I) hinsert + rw [Finset.card_insert_of_notMem hyI] at hc + omega + let witness : S → S := fun y => if hy : y ∈ Y then (hnear y hy).choose else y + have hwitness : ∀ y ∈ Y, witness y ∈ W ∧ + (d y (witness y) < r ∨ d (far y) (witness y) < r) := by + intro y hy + dsimp only [witness] + rw [dite_eq_left hy] + exact (hnear y hy).choose_spec + have hnum : k * W.ncard < Y.ncard := by + have hc := Nat.mul_le_mul_right k hWcard + rw [Nat.mul_comm W.ncard k] at hc + exact hc.trans_lt hcount + obtain ⟨w, hwW, Y₃, hY₃Y, hY₃card, hY₃w⟩ := + exists_many_marked_vertices_at_one_vertex hW hY + (fun y hy => (hwitness y hy).1) hnum + have hoptions : ∀ y ∈ Y₃, d y w < r ∨ d (far y) w < r := by + intro y hy + have hopt := (hwitness y (hY₃Y hy)).2 + rwa [hY₃w y hy] at hopt + let bad := {y ∈ Y₃ | d y w < r} + have hbadfin : bad.Finite := hY.subset (fun _ h => hY₃Y h.1) + have hbad : bad.ncard ≤ 1 := by + apply (ncard_le_one hbadfin).mpr + intro y hy z hz + by_contra hyz + have hyY := hY₃Y hy.1 + have hzY := hY₃Y hz.1 + have hc := htri y (hYU hyY) w (hWU hwW) z (hYU hzY) + rw [hsymm w (hWU hwW) z (hYU hzY)] at hc + have hd := hsep y hyY z hzY hyz + have hynear : d y w < r := hy.2 + have hznear : d z w < r := hz.2 + omega + refine Or.inr ⟨w, hWU hwW, Y₃ \ bad, fun y hy => hY₃Y hy.1, ?_, ?_⟩ + · have hc := ncard_le_ncard_sdiff_add_ncard Y₃ bad hbadfin + omega + · intro y hy + exact (hoptions y hy.1).resolve_left (fun h => hy.2 ⟨hy.1, h⟩) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6Components.lean b/LeanPool/GraphMinor/GM16/Section6Components.lean new file mode 100644 index 0000000000..fc7a5765ba --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6Components.lean @@ -0,0 +1,80 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6 +import LeanPool.GraphMinor.GM16.Section5Connections +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Components containing two marked vertices + +In XVI (6.3), pages 59–60, `Y₁` consists of the marked vertices in +components containing at least two marked vertices. Outside these +components, connected hair graphs with different marked near ends are +disjoint. We express the components by walks to avoid choosing names for +the individual components. +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 +universe u v + +/-- The marked vertices in components containing at least two marked +vertices, as in the definition of `Y₁` in XVI (6.3), page 59. -/ +def activeMarkedVertices {α : Type u} {β : Type v} (G : Graph α β) (Z : Set α) : Set α := + {y | y ∈ Z ∧ ∃ z ∈ Z, z ≠ y ∧ Nonempty (GraphWalk G y z)} + +/-- Every active marked vertex is a vertex of the graph. -/ +theorem activeMarkedVertices_subset_vertexSet + {α : Type u} {β : Type v} (G : Graph α β) (Z : Set α) : + activeMarkedVertices G Z ⊆ V(G) := by + rintro y ⟨_, z, _, _, ⟨W⟩⟩ + exact W.mem_vertexSet_of_mem_support W.start_mem_support + +/-- No component contains exactly one active marked vertex. A walk to +another marked vertex also makes that other vertex active. -/ +theorem activeMarkedVertices_component_hyp + {α : Type u} {β : Type v} (G : Graph α β) (Z : Set α) : + ∀ y ∈ activeMarkedVertices G Z, ∃ z ∈ activeMarkedVertices G Z, + z ≠ y ∧ Relation.ReflTransGen G.Adj y z := by + rintro y ⟨hy, z, hz, hzy, ⟨W⟩⟩ + exact ⟨z, ⟨hz, y, hy, hzy.symm, ⟨W.reverse⟩⟩, hzy, graphWalk_adj_reachable W⟩ + +/-- Any marked vertex joined to an active marked vertex is active. -/ +theorem activeMarkedVertices_of_walk + {α : Type u} {β : Type v} {G : Graph α β} {Z : Set α} {a b : α} + (ha : a ∈ activeMarkedVertices G Z) (hb : b ∈ Z) (W : GraphWalk G a b) : + b ∈ activeMarkedVertices G Z := by + by_cases hab : a = b + · exact hab ▸ ha + · exact ⟨hb, a, ha.1, hab, ⟨W.reverse⟩⟩ + +/-- Connected subgraphs with different marked near ends are disjoint +if the first near end is outside the active components. Otherwise their +meeting would join the two marked ends. This is the assertion about the +`Q_y` outside `Y₁` in XVI (6.3), page 60. -/ +theorem disjoint_connected_hairs_of_not_active + {α : Type u} {β : Type v} {G P Q : Graph α β} {Z : Set α} {a b : α} + (hPG : P ≤ G) (hQG : Q ≤ G) + (hP : IsGraphConnected P) (hQ : IsGraphConnected Q) + (haP : a ∈ V(P)) (hbQ : b ∈ V(Q)) + (haZ : a ∈ Z) (hbZ : b ∈ Z) (hab : a ≠ b) + (ha : a ∉ activeMarkedVertices G Z) : Disjoint V(P) V(Q) := by + apply Set.disjoint_left.mpr + intro w hwP hwQ + obtain ⟨W₁⟩ := hP.2 a haP w hwP + obtain ⟨W₂⟩ := hQ.2 w hwQ b hbQ + obtain ⟨W₁', _, _⟩ := exists_walk_up_of_le hPG W₁ + obtain ⟨W₂', _, _⟩ := exists_walk_up_of_le hQG W₂ + exact ha ⟨haZ, b, hbZ, hab.symm, ⟨W₁'.append W₂'⟩⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6HairFamily.lean b/LeanPool/GraphMinor/GM16/Section6HairFamily.lean new file mode 100644 index 0000000000..df0e2a486a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6HairFamily.lean @@ -0,0 +1,221 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6 +import LeanPool.GraphMinor.GM16.Section6HairGraphs +import LeanPool.GraphMinor.GM16.Section6HairUnion +public import LeanPool.GraphMinor.GM16.Section6Components +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Choosing the paths witnessing the hairs of an animal + +The hair clause in the definition of an animal supplies one path and one +far end for each hair. This file records those choices and proves the +properties of their endpoint-deleted union used in XVI (6.3), pages 59–60. +Connectedness and degree bounds are proved from the chosen paths. +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM11 + GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] {α : Type u} {β : Type v} + +/-- Choices witnessing exactly the hair clause in the definition of an +animal (XVI, Section 5, page 55), used on page 59 in the proof of (6.3). +The maps are total, with their side conditions required on `Y`. -/ +structure HairFamily (G : Graph α β) (H : Drawing S) (η : SpanEmbedding H G) + (d : Set S → Set S → ℕ) (X : Set α) (Y : Set S) (θ : ℕ) where + /-- The other end of the chosen hair at a vertex. -/ + far : S → S + /-- The graph of the chosen hair at a vertex. -/ + path : S → Graph α β + far_mem : ∀ y ∈ Y, far y ∈ H.V + ne : ∀ y ∈ Y, y ≠ far y + is_hPath : ∀ y ∈ Y, IsHPathWithEnds G η.imageGraph (path y) (η.vMap y) (η.vMap (far y)) + avoids_horns : ∀ y ∈ Y, Disjoint X V(path y) + dist : ∀ y ∈ Y, θ ≤ d {y} {far y} + +/-- Make the path choices in the hair clause of an animal. -/ +theorem IsAnimal.exists_hairFamily [T2Space S] + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} {d : Set S → Set S → ℕ} + {X : Set α} {Y : Set S} {θ_star θ_span χ δ θ σ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (h : IsAnimal G T_star θ_star H η θ_span T d X Y χ δ θ σ) : + Nonempty (HairFamily G H η d X Y θ) := by + classical + have hh := h.2.2.2.2.2.2.2.2.2.1 + choose far path hfar hne hpath hdisj hdist using (fun y : Y => hh y.val y.property) + let far' : S → S := fun y => if hy : y ∈ Y then far ⟨y, hy⟩ else y + let path' : S → Graph α β := fun y => if hy : y ∈ Y then path ⟨y, hy⟩ else G + refine ⟨⟨far', path', ?_, ?_, ?_, ?_, ?_⟩⟩ + · intro y hy + simpa only [far', dite_eq_left hy] using hfar ⟨y, hy⟩ + · intro y hy + simpa only [far', dite_eq_left hy] using hne ⟨y, hy⟩ + · intro y hy + simpa only [far', path', dite_eq_left hy] using hpath ⟨y, hy⟩ + · intro y hy + simpa only [path', dite_eq_left hy] using hdisj ⟨y, hy⟩ + · intro y hy + simpa only [far', dite_eq_left hy] using hdist ⟨y, hy⟩ + +namespace HairFamily +variable {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {d : Set S → Set S → ℕ} {X : Set α} {Y : Set S} {θ : ℕ} + +/-- The path with its far end deleted, called `Q_y` in XVI (6.3). -/ +def tail (F : HairFamily G H η d X Y θ) (y : S) : Graph α β := + deleteVertices (F.path y) {η.vMap (F.far y)} + +/-- The union of the truncated hair paths, called `G₀` in XVI (6.3). -/ +def unionGraph (F : HairFamily G H η d X Y θ) : Graph α β := + subgraphSUnion G (range (fun y : Y => F.tail y.val)) + +/-- The marked near ends in components of `G₀` containing two near ends, +called `Y₁` in XVI (6.3). -/ +def active (F : HairFamily G H η d X Y θ) : Set S := + {y ∈ Y | η.vMap y ∈ activeMarkedVertices F.unionGraph (η.vMap '' Y)} + +theorem tail_le (F : HairFamily G H η d X Y θ) {y : S} (hy : y ∈ Y) : F.tail y ≤ G := + (deleteVertices_le _ _).trans (F.is_hPath y hy).2.1.le + +theorem union_le (F : HairFamily G H η d X Y θ) : F.unionGraph ≤ G := by + apply subgraphSUnion_le + rintro R ⟨y, rfl⟩ + exact F.tail_le y.property + +theorem tail_le_union (F : HairFamily G H η d X Y θ) {y : S} (hy : y ∈ Y) : + F.tail y ≤ F.unionGraph := by + apply le_subgraphSUnion + · rintro R ⟨z, rfl⟩ + exact F.tail_le z.property + · exact ⟨⟨y, hy⟩, rfl⟩ + +theorem tail_connected (F : HairFamily G H η d X Y θ) {y : S} (hy : y ∈ Y) : + IsGraphConnected (F.tail y) := + path_delete_endpoint_connected (F.is_hPath y hy).2.1 (F.is_hPath y hy).2.2.1 + +theorem tail_inter_old (F : HairFamily G H η d X Y θ) {y : S} (hy : y ∈ Y) : + V(F.tail y) ∩ V(η.imageGraph) = {η.vMap y} := + truncated_hair_inter (F.is_hPath y hy) + +theorem near_mem_tail (F : HairFamily G H η d X Y θ) {y : S} (hy : y ∈ Y) : + η.vMap y ∈ V(F.tail y) := by + have hm : η.vMap y ∈ V(F.tail y) ∩ V(η.imageGraph) := by + rw [F.tail_inter_old hy] + exact mem_singleton _ + exact hm.1 + +/-- The old-graph vertices of `G₀` are exactly the marked near ends. -/ +theorem union_inter_old (F : HairFamily G H η d X Y θ) : + V(F.unionGraph) ∩ V(η.imageGraph) = η.vMap '' Y := by + apply Set.Subset.antisymm + · rintro x ⟨hx, hxH⟩ + obtain ⟨R, ⟨y, rfl⟩, hxR⟩ := mem_iUnion₂.mp hx + have heq := mem_singleton_iff.mp ((F.tail_inter_old y.property).subset ⟨hxR, hxH⟩) + exact ⟨y.val, y.property, heq.symm⟩ + · rintro x ⟨y, hy, rfl⟩ + exact ⟨(F.tail_le_union hy).vertexSet_mono (F.near_mem_tail hy), + ((F.tail_inter_old hy).symm ▸ mem_singleton (η.vMap y)).2⟩ + +/-- Every old-graph vertex has at most one neighbor in `G₀`. -/ +theorem union_old_neighbors_subsingleton (F : HairFamily G H η d X Y θ) + (hY : Y ⊆ H.V) {x : α} (hx : x ∈ V(η.imageGraph)) : + {z | F.unionGraph.Adj x z}.Subsingleton := by + apply hair_union_old_neighbors_subsingleton + (P := fun y : Y => F.path y.val) (a := fun y : Y => η.vMap y.val) + (b := fun y : Y => η.vMap (F.far y.val)) + (fun y => (F.is_hPath y.val y.property).2.1) + (fun _ => deleteVertices_le _ _) (fun y => F.tail_inter_old y.property) ?_ hx + intro y z heq + exact Subtype.ext (η.bijOn_v.injOn (hY y.property) (hY z.property) heq) + +/-- Truncated hairs with near ends outside `Y₁` are disjoint. -/ +theorem tails_disjoint_of_not_active (F : HairFamily G H η d X Y θ) + (hY : Y ⊆ H.V) {y z : S} (hy : y ∈ Y) (hz : z ∈ Y) (hyz : y ≠ z) + (hyactive : y ∉ F.active) : Disjoint V(F.tail y) V(F.tail z) := by + apply disjoint_connected_hairs_of_not_active (Z := η.vMap '' Y) (F.tail_le_union hy) + (F.tail_le_union hz) + (F.tail_connected hy) (F.tail_connected hz) (F.near_mem_tail hy) (F.near_mem_tail hz) + ⟨y, hy, rfl⟩ ⟨z, hz, rfl⟩ + (fun h => hyz (η.bijOn_v.injOn (hY hy) (hY hz) h)) + intro hactive + exact hyactive ⟨hy, hactive⟩ + +/-- No horn vertex lies on the truncated hair union. -/ +theorem union_avoids_horns (F : HairFamily G H η d X Y θ) : Disjoint X V(F.unionGraph) := by + apply Set.disjoint_left.mpr + intro x hxX hxU + obtain ⟨R, ⟨y, rfl⟩, hxR⟩ := mem_iUnion₂.mp hxU + exact (Set.disjoint_left.mp (F.avoids_horns y.val y.property)) hxX + ((deleteVertices_le _ _).vertexSet_mono hxR) + +/-- The truncated hair union has no edge of the embedded drawing. -/ +theorem union_edges_disjoint_old (F : HairFamily G H η d X Y θ) : + Disjoint E(F.unionGraph) E(η.imageGraph) := by + have hFG : ∀ R ∈ range (fun y : Y => F.tail y.val), R ≤ G := by + rintro R ⟨y, rfl⟩ + exact F.tail_le y.property + apply Set.disjoint_left.mpr + intro e heU heH + change e ∈ E(subgraphSUnion G (range (fun y : Y => F.tail y.val))) at heU + rw [edgeSet_subgraphSUnion hFG] at heU + obtain ⟨R, ⟨y, rfl⟩, heR⟩ := mem_iUnion₂.mp heU + exact (Set.disjoint_left.mp (F.is_hPath y.val y.property).2.2.2.2.2.2) + ((deleteVertices_le _ _).edgeSet_mono heR) heH + +/-- The drawing labels of active near ends count the same vertices as +`Y₁` in the embedded graph. -/ +theorem active_card_eq (F : HairFamily G H η d X Y θ) (hY : Y ⊆ H.V) : + F.active.ncard = (activeMarkedVertices F.unionGraph (η.vMap '' Y)).ncard := by + have hinj : InjOn η.vMap F.active := η.bijOn_v.injOn.mono (fun _ h => hY h.1) + have heq : η.vMap '' F.active = activeMarkedVertices F.unionGraph (η.vMap '' Y) := by + apply Set.Subset.antisymm + · rintro x ⟨y, hy, rfl⟩ + exact hy.2 + · intro x hx + obtain ⟨y, hy, rfl⟩ := hx.1 + exact ⟨y, ⟨hy, hx⟩, rfl⟩ + rw [← heq, hinj.ncard_image] + +/-- Outside the active components, full hair paths are disjoint when +their ends have different labels. This is used for the separated family +`Y₂` in XVI (6.3), page 60. -/ +theorem full_hairs_disjoint (F : HairFamily G H η d X Y θ) + (hY : Y ⊆ H.V) {y z : S} (hy : y ∈ Y) (hz : z ∈ Y) (hyz : y ≠ z) + (hyactive : y ∉ F.active) + (hfy_z : F.far y ≠ z) (hfy_fz : F.far y ≠ F.far z) + (hy_fz : y ≠ F.far z) : Disjoint V(F.path y) V(F.path z) := by + apply Set.disjoint_left.mpr + intro a hay haz + by_cases hafy : a = η.vMap (F.far y) + · have haH : a ∈ V(η.imageGraph) := hafy ▸ η.bijOn_v.mapsTo (F.far_mem y hy) + have haends : a ∈ ({η.vMap z, η.vMap (F.far z)} : Set α) := + (F.is_hPath z hz).2.2.2.2.2.1 ▸ ⟨haz, haH⟩ + rcases haends with haz' | haz' + · exact hfy_z (η.bijOn_v.injOn (F.far_mem y hy) (hY hz) (hafy.symm.trans haz')) + · exact hfy_fz (η.bijOn_v.injOn (F.far_mem y hy) (F.far_mem z hz) + (hafy.symm.trans (mem_singleton_iff.mp haz'))) + · by_cases hafz : a = η.vMap (F.far z) + · have haH : a ∈ V(η.imageGraph) := hafz ▸ η.bijOn_v.mapsTo (F.far_mem z hz) + have haends : a ∈ ({η.vMap y, η.vMap (F.far y)} : Set α) := + (F.is_hPath y hy).2.2.2.2.2.1 ▸ ⟨hay, haH⟩ + rcases haends with hay' | hay' + · exact hy_fz (η.bijOn_v.injOn (hY hy) (F.far_mem z hz) (hay'.symm.trans hafz)) + · exact hafy (mem_singleton_iff.mp hay') + · exact (Set.disjoint_left.mp (F.tails_disjoint_of_not_active hY hy hz hyz hyactive)) + ⟨hay, by simpa using hafy⟩ ⟨haz, by simpa using hafz⟩ + +end HairFamily +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6HairGraphs.lean b/LeanPool/GraphMinor/GM16/Section6HairGraphs.lean new file mode 100644 index 0000000000..29aad115e8 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6HairGraphs.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6 +import LeanPool.GraphMinor.GM16.Section5Degree +import LeanPool.GraphMinor.GM16.Section5Connections +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Walks + +/-! +# The truncated hair paths in XVI (6.3) + +Deleting the far end of a path leaves a connected graph containing its +near end. The resulting hair graph meets the embedded drawing at just +its marked near end. These are the graphs `Q_y` on page 59. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM14 +universe u v + +/-- Deleting one end of a path with distinct ends leaves a nonempty +connected graph, as used for `Q_y` in XVI (6.3), page 59. -/ +theorem path_delete_endpoint_connected + {α : Type u} {β : Type v} {G P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) (hab : a ≠ b) : + IsGraphConnected (deleteVertices P {b}) := by + classical + have hPV := hP.vertexSet_finite + have hPE := hP.edgeSet_finite + let K := (Hypergraph.ofGraph P hPV hPE).skeleton + have hleafP := path_start_neighbors_subsingleton hP.symm + have hleaf : (K.neighborSet b).Subsingleton := by + intro y hy z hz + obtain ⟨hby, e, hbe, hye⟩ := hy + obtain ⟨hbz, f, hbf, hzf⟩ := hz + exact hleafP ⟨e, isLink_of_inc_of_inc_of_ne hbe hye hby⟩ + ⟨f, isLink_of_inc_of_inc_of_ne hbf hzf hbz⟩ + refine ⟨⟨a, hP.left_mem, by simpa using hab⟩, ?_⟩ + intro y hy z hz + have hyP : y ∈ V(P) := hy.1 + have hzP : z ∈ V(P) := hz.1 + have hyb : y ≠ b := by simpa using hy.2 + have hzb : z ≠ b := by simpa using hz.2 + obtain ⟨L, _, hL, _⟩ := hP.exists_subpath hyP hzP + obtain ⟨W⟩ := graphPath_exists_walk hL + obtain ⟨q⟩ := skeleton_reachable_of_reflTransGen_adj hPV hPE (graphWalk_adj_reachable W) + have havoid : b ∉ q.toPath.val.support := + q.toPath.isPath.isTrail.notMem_support_of_subsingleton_neighborSet hyb.symm hzb.symm hleaf + obtain ⟨R, hR, hverts⟩ := exists_isGraphPathWithEnds_of_skeleton_isPath + hPV hPE hyP q.toPath.val q.toPath.isPath + have hbR : b ∉ V(R) := by + rw [hverts] + exact havoid + have hRD := hR.in_deleteVertices (Set.disjoint_singleton_left.mpr hbR) + exact graphPath_exists_walk hRD + +/-- A hair path with its far end removed meets the old graph only at +its near end, as in XVI (6.3), page 59. -/ +theorem truncated_hair_inter + {α : Type u} {β : Type v} {G H P : Graph α β} {a b : α} + (hP : IsHPathWithEnds G H P a b) : + V(deleteVertices P {b}) ∩ V(H) = {a} := by + apply Set.Subset.antisymm + · rintro z ⟨⟨hzP, hzb⟩, hzH⟩ + have hz : z ∈ ({a, b} : Set α) := hP.2.2.2.2.2.1 ▸ ⟨hzP, hzH⟩ + exact hz.resolve_right hzb + · rintro z rfl + exact ⟨⟨hP.2.1.left_mem, by simpa using hP.2.2.1⟩, hP.2.2.2.1⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6HairUnion.lean b/LeanPool/GraphMinor/GM16/Section6HairUnion.lean new file mode 100644 index 0000000000..f40ea71dd9 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6HairUnion.lean @@ -0,0 +1,114 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6 +import LeanPool.GraphMinor.GM16.Section5Degree +import LeanPool.GraphMinor.GM16.Section5Connections +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Unions of hair graphs in XVI (6.3) + +Each truncated hair meets the embedded drawing at its own near end. +Thus a drawing vertex in their union has at most one neighbor. For the +second application of (5.3), joining all full hair paths to a connected +subgraph containing their far ends gives a connected graph. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 +universe u v + +/-- Adjacency in a union of subgraphs comes from one of its members. -/ +theorem subgraphSUnion_adj_iff + {α : Type u} {β : Type v} {G : Graph α β} {F : Set (Graph α β)} + (hF : ∀ R ∈ F, R ≤ G) {x y : α} : + (subgraphSUnion G F).Adj x y ↔ ∃ R ∈ F, R.Adj x y := by + constructor + · rintro ⟨e, he⟩ + have heE := he.edge_mem + rw [edgeSet_subgraphSUnion hF] at heE + obtain ⟨R, hR, heR⟩ := mem_iUnion₂.mp heE + exact ⟨R, hR, e, ((hF R hR).isLink_iff heR).mpr (he.mono (subgraphSUnion_le hF))⟩ + · rintro ⟨R, hR, e, he⟩ + exact ⟨e, he.mono (le_subgraphSUnion hF hR)⟩ + +/-- The old-graph vertices in the union of truncated hairs have at most +one neighbor. Each belongs to just its own truncated hair. This is the +degree assertion in XVI (6.3), Claim (2), page 60. -/ +theorem hair_union_old_neighbors_subsingleton + {α : Type u} {β : Type v} {ι : Type*} {G H : Graph α β} + {P Q : ι → Graph α β} {a b : ι → α} + (hP : ∀ i, IsGraphPathWithEnds G (P i) (a i) (b i)) + (hQP : ∀ i, Q i ≤ P i) (hQH : ∀ i, V(Q i) ∩ V(H) = {a i}) + (ha : Function.Injective a) {x : α} (hx : x ∈ V(H)) : + {z | (subgraphSUnion G (range Q)).Adj x z}.Subsingleton := by + have hF : ∀ R ∈ range Q, R ≤ G := by + rintro R ⟨i, rfl⟩ + exact (hQP i).trans (hP i).le + intro z hz w hw + obtain ⟨R, ⟨i, rfl⟩, e, he⟩ := (subgraphSUnion_adj_iff hF).mp hz + obtain ⟨R, ⟨j, rfl⟩, f, hf⟩ := (subgraphSUnion_adj_iff hF).mp hw + have hxi : x = a i := mem_singleton_iff.mp ((hQH i).subset ⟨he.left_mem, hx⟩) + have hxj : x = a j := mem_singleton_iff.mp ((hQH j).subset ⟨hf.left_mem, hx⟩) + have hij : i = j := ha (hxi.symm.trans hxj) + subst j + subst x + exact path_start_neighbors_subsingleton (hP i) ⟨e, he.mono (hQP i)⟩ ⟨f, hf.mono (hQP i)⟩ + +/-- A graph path is connected. -/ +theorem graphPath_isGraphConnected + {α : Type u} {β : Type v} {G P : Graph α β} {a b : α} + (hP : IsGraphPathWithEnds G P a b) : IsGraphConnected P := by + refine ⟨⟨a, hP.left_mem⟩, ?_⟩ + intro x hx y hy + obtain ⟨R, _, hR, _⟩ := hP.exists_subpath hx hy + exact graphPath_exists_walk hR + +/-- A union of connected subgraphs, each meeting a connected core, +is connected. This is the graph `G₂` in XVI (6.3), page 61. -/ +theorem connected_union_of_core + {α : Type u} {β : Type v} {ι : Type*} {G C : Graph α β} {P : ι → Graph α β} + (hCG : C ≤ G) (hC : IsGraphConnected C) + (hPG : ∀ i, P i ≤ G) (hP : ∀ i, IsGraphConnected (P i)) + (hmeet : ∀ i, (V(C) ∩ V(P i)).Nonempty) : + IsGraphConnected (subgraphSUnion G ({C} ∪ range P)) := by + let J := subgraphSUnion G ({C} ∪ range P) + have hF : ∀ R ∈ ({C} : Set (Graph α β)) ∪ range P, R ≤ G := by + rintro R (hR | ⟨i, rfl⟩) + · exact (mem_singleton_iff.mp hR) ▸ hCG + · exact hPG i + have hCJ : C ≤ J := le_subgraphSUnion hF (Or.inl (mem_singleton C)) + have hPJ : ∀ i, P i ≤ J := fun i => le_subgraphSUnion hF (Or.inr ⟨i, rfl⟩) + obtain ⟨b, hb⟩ := hC.1 + have htoB : ∀ a ∈ V(J), Nonempty (GraphWalk J a b) := by + intro a ha + obtain ⟨R, hR, haR⟩ := mem_iUnion₂.mp ha + rcases hR with hR | ⟨i, rfl⟩ + · have hRC : R = C := mem_singleton_iff.mp hR + subst R + obtain ⟨W⟩ := hC.2 a haR b hb + obtain ⟨W', _, _⟩ := exists_walk_up_of_le hCJ W + exact ⟨W'⟩ + · obtain ⟨c, hcC, hcP⟩ := hmeet i + obtain ⟨W₁⟩ := (hP i).2 a haR c hcP + obtain ⟨W₂⟩ := hC.2 c hcC b hb + obtain ⟨W₁', _, _⟩ := exists_walk_up_of_le (hPJ i) W₁ + obtain ⟨W₂', _, _⟩ := exists_walk_up_of_le hCJ W₂ + exact ⟨W₁'.append W₂'⟩ + refine ⟨⟨b, hCJ.vertexSet_mono hb⟩, ?_⟩ + intro a ha c hc + obtain ⟨W₁⟩ := htoB a ha + obtain ⟨W₂⟩ := htoB c hc + exact ⟨W₁.append W₂.reverse⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6Linkages.lean b/LeanPool/GraphMinor/GM16/Section6Linkages.lean new file mode 100644 index 0000000000..036a853087 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6Linkages.lean @@ -0,0 +1,157 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6 +import LeanPool.GraphMinor.GM16.Section5Reroute +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2c + +/-! +# Paths and fans in the hair graphs of XVI (6.3) + +Shorten paths at their first meeting with the embedded drawing. A disjoint +family between drawing vertices becomes a family of old-graph paths. +A fan whose centre is outside the drawing becomes a horn. The ends stay +in the prescribed marked set, so their metric separation is retained. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w + +/-- Disjoint paths between vertices of the embedded drawing can be +shortened to old-graph paths, as used twice in XVI (6.3), pages 60–61. +The subgraph has no old-graph edge, and all its old-graph vertices have +labels in `Y`. -/ +theorem hPaths_of_disjoint_paths_in_subgraph + {S : Type w} [TopologicalSpace S] {α : Type u} {β : Type v} + {G K : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} {Y : Set S} + {n : ℕ} {P : Fin n → Graph α β} {a b : Fin n → α} + (hKG : K ≤ G) (hKH : Disjoint E(K) E(η.imageGraph)) + (hKY : V(K) ∩ V(η.imageGraph) ⊆ η.vMap '' Y) + (hP : ∀ i, a i ∈ V(η.imageGraph) ∧ b i ∈ V(η.imageGraph) ∧ a i ≠ b i ∧ + IsGraphPathWithEnds K (P i) (a i) (b i)) + (hPP : Pairwise (fun i j => Disjoint V(P i) V(P j))) : + ∃ (R : Fin n → Graph α β) (s t : Fin n → S), + (∀ i, s i ∈ Y ∧ t i ∈ Y ∧ s i ≠ t i) ∧ + (∀ i, IsHPathWithEnds G η.imageGraph (R i) (η.vMap (s i)) (η.vMap (t i))) ∧ + Pairwise (fun i j => Disjoint V(R i) V(R j)) := by + classical + have htrim : ∀ i, ∃ (c : α) (R : Graph α β), c ∈ V(η.imageGraph) ∧ a i ≠ c ∧ R ≤ P i ∧ + IsGraphPathWithEnds K R (a i) c ∧ V(R) ∩ V(η.imageGraph) = {a i, c} := by + intro i + exact path_trim_marked (hP i).2.2.2 (hP i).1 (hP i).2.1 (hP i).2.2.1 + choose c R hc hac hRP hR hinter using htrim + have hsa : ∀ i, ∃ y ∈ Y, η.vMap y = a i := by + intro i + exact hKY ⟨(hR i).le.vertexSet_mono (hR i).left_mem, (hP i).1⟩ + have htc : ∀ i, ∃ y ∈ Y, η.vMap y = c i := by + intro i + exact hKY ⟨(hR i).le.vertexSet_mono (hR i).right_mem, hc i⟩ + choose s hs hsa using hsa + choose t ht htc using htc + refine ⟨R, s, t, ?_, ?_, ?_⟩ + · intro i + refine ⟨hs i, ht i, ?_⟩ + intro heq + apply hac i + rw [← hsa i, ← htc i, heq] + · intro i + rw [hsa i, htc i] + exact ⟨η.imageGraph_le, (hR i).mono hKG, hac i, (hP i).1, hc i, hinter i, + hKH.mono_left (hR i).le.edgeSet_mono⟩ + · intro i j hij + exact (hPP hij).mono (hRP i).vertexSet_mono (hRP j).vertexSet_mono + +/-- A fan with centre outside the embedded drawing can be shortened to +a horn. This is the fan-to-horn step in XVI (6.3), pages 60–61. -/ +theorem horn_of_fan_in_subgraph + {S : Type w} [TopologicalSpace S] {α : Type u} {β : Type v} + {G K : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {Y : Set S} {d : Set S → Set S → ℕ} {x : α} {n r : ℕ} + {P : Fin n → Graph α β} {b : Fin n → α} + (hKG : K ≤ G) (hxK : x ∈ V(K)) (hxH : x ∉ V(η.imageGraph)) + (hKY : V(K) ∩ V(η.imageGraph) ⊆ η.vMap '' Y) (hY : Y ⊆ H.V) + (hsep : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → r ≤ d {y} {z}) + (hP : ∀ i, b i ∈ V(η.imageGraph) ∧ IsGraphPathWithEnds K (P i) x (b i)) + (hPP : ∀ i j, i ≠ j → V(P i) ∩ V(P j) = {x} ∧ Disjoint E(P i) E(P j)) : + ∃ (R : Fin n → Graph α β) (ends : Fin n → S), IsHorn G H η d x r n R ends := by + classical + have htrim : ∀ i, ∃ c ∈ V(η.imageGraph), ∃ R : Graph α β, + R ≤ P i ∧ IsGraphPathWithEnds K R x c ∧ V(R) ∩ V(η.imageGraph) = {c} := by + intro i + obtain ⟨c, ⟨_, hc⟩, R, hRP, hR, hhit, _⟩ := (hP i).2.exists_first_hit + (S := V(η.imageGraph)) ⟨b i, (hP i).2.right_mem, (hP i).1⟩ + exact ⟨c, hc, R, hRP, hR.mono (hP i).2.le, hhit⟩ + choose c hc R hRP hR hinter using htrim + have hlabels : ∀ i, ∃ y ∈ Y, η.vMap y = c i := by + intro i + exact hKY ⟨(hR i).le.vertexSet_mono (hR i).right_mem, hc i⟩ + choose ends hends heq using hlabels + have hRR : ∀ i j, i ≠ j → V(R i) ∩ V(R j) = {x} ∧ Disjoint E(R i) E(R j) := by + intro i j hij + constructor + · apply Set.Subset.antisymm + · exact (inter_subset_inter (hRP i).vertexSet_mono (hRP j).vertexSet_mono).trans + (hPP i j hij).1.subset + · rintro z rfl + exact ⟨(hR i).left_mem, (hR j).left_mem⟩ + · exact ((hPP i j hij).2).mono (hRP i).edgeSet_mono (hRP j).edgeSet_mono + refine ⟨R, ends, ⟨hKG.vertexSet_mono hxK, hxH⟩, fun i => hY (hends i), ?_, ?_, hRR, ?_⟩ + · intro i + rw [heq i] + exact (hR i).mono hKG + · intro i + rw [heq i] + exact hinter i + · intro i j hij + apply hsep (ends i) (hends i) (ends j) (hends j) + intro hendsij + have hcij : c i = c j := by rw [← heq i, ← heq j, hendsij] + have hci : c i ∈ V(R i) ∩ V(R j) := + ⟨(hR i).right_mem, hcij ▸ (hR j).right_mem⟩ + rw [(hRR i j hij).1, mem_singleton_iff] at hci + exact hxH (hci ▸ hc i) + +/-- Disjoint old-graph paths have distinct labels at all their ends. +This supplies the endpoint hypotheses of XVI (5.2). -/ +theorem hPath_end_labels_injective + {S : Type w} [TopologicalSpace S] {α : Type u} {β : Type v} + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {n : ℕ} {P : Fin n → Graph α β} {s t : Fin n → S} + (hP : ∀ i, IsHPathWithEnds G η.imageGraph (P i) (η.vMap (s i)) (η.vMap (t i))) + (hPP : Pairwise (fun i j => Disjoint V(P i) V(P j))) : + Function.Injective s ∧ Function.Injective t ∧ Disjoint (range s) (range t) := by + constructor + · intro i j hij + by_contra hne + have hsi := IsGraphPathWithEnds.left_mem (hP i).2.1 + have hsj := IsGraphPathWithEnds.left_mem (hP j).2.1 + have heq := congrArg η.vMap hij + exact (Set.disjoint_left.mp (hPP hne)) hsi (heq ▸ hsj) + constructor + · intro i j hij + by_contra hne + have hti := IsGraphPathWithEnds.right_mem (hP i).2.1 + have htj := IsGraphPathWithEnds.right_mem (hP j).2.1 + have heq := congrArg η.vMap hij + exact (Set.disjoint_left.mp (hPP hne)) hti (heq ▸ htj) + · apply Set.disjoint_left.mpr + rintro z ⟨i, rfl⟩ ⟨j, htj⟩ + by_cases hij : i = j + · subst j + exact (hP i).2.2.1 (congrArg η.vMap htj.symm) + · have hsi := IsGraphPathWithEnds.left_mem (hP i).2.1 + have htj' := IsGraphPathWithEnds.right_mem (hP j).2.1 + have heq := congrArg η.vMap htj + exact (Set.disjoint_left.mp (hPP hij)) hsi (heq ▸ htj') + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6Proof.lean b/LeanPool/GraphMinor/GM16/Section6Proof.lean new file mode 100644 index 0000000000..80a72eeece --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6Proof.lean @@ -0,0 +1,229 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6 +import LeanPool.GraphMinor.GM16.Section6ClusterProof +import LeanPool.GraphMinor.GM16.Section6ClearedHairGraph +import LeanPool.GraphMinor.GM16.Section6Clearing +import LeanPool.GraphMinor.GM16.Section6Animals +import LeanPool.GraphMinor.GM16.Section6CliqueLinkage +import LeanPool.GraphMinor.GM16.Section8Truncation +import LeanPool.GraphMinor.GM16.Section5Proof +import LeanPool.GraphMinor.GM16.Section5Degree +import LeanPool.GraphMinor.GM16.Section5Connections +import LeanPool.GraphMinor.GM16.Section6Linkages +import LeanPool.GraphMinor.GM16.Section6ZoneWalks +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM14.Section3b +import LeanPool.GraphMinor.GM11.Section810 + + +import LeanPool.GraphMinor.GM11.CitedResults + +import LeanPool.GraphMinor.GM12.Bridge + +import LeanPool.GraphMinor.GM12.Section710 + +import LeanPool.GraphMinor.GM14.Section9a + +import LeanPool.GraphMinor.GM14.Section9b + +/-! +# Graph Minors XVI (6.3) + +Bound the active hairs by (5.3), select a large cluster of far hair ends, +and clear a zone containing them. The remaining drawing is a span and +retains the near hair ends, which stay far apart in its metric. Join the +far ends inside the smaller zone. A second application of (5.3) to this +connected graph gives either the clique minor or an extra horn. + +On page 60, the connected subgraph must contain the far ends `v(y)`, +rather than `Y₄` as printed. Claim (3) puts `Y₄` outside the cleared zone. +The construction here uses the corrected far ends. See the correction to the +proof of (6.3) in `corrections/GM16.md`. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM11 + GraphMinor.GM14 GraphMinor.GM15 +universe u v w + +/-- **Graph Minors XVI, (6.3)** (pages 59–61), by the two applications +of (5.3), the maximal separated hair family, and clearing the far-end +cluster. The page-60 typo concerning the vertices of `H₂` is corrected +by joining the far ends inside the smaller closed zone. -/ +theorem theorem_6_3_proof + : GM16Theorem63Statement.{u, v, w} := by + classical + intro S _ _ hS hConn p τ χ ψ hψ + let : ConnectedSpace S := hConn + let μ := p * (p - 1) / 2 + let τ' := max τ 2 + let r := max ψ (max 3 (cliquePathThreshold.{u, v, w} hS hConn p)) + let θ := 5 * r + 34 + let δ := 2 * μ ^ 2 * τ' ^ 2 + have hψr : ψ ≤ r := le_max_left _ _ + have h3r : 3 ≤ r := (le_max_left _ _).trans (le_max_right _ _) + have hr₀ : cliquePathThreshold.{u, v, w} hS hConn p ≤ r := + (le_max_right _ _).trans (le_max_right _ _) + have hττ' : τ ≤ τ' := le_max_left _ _ + have hτ' : 2 ≤ τ' := le_max_right _ _ + have hrθ : r ≤ θ := by dsimp only [θ]; omega + refine ⟨δ, θ, by dsimp only [θ]; omega, ?_⟩ + intro α β G θ_star T_star hT hAnimal + by_cases hClique : ControlsMinor G (completeGraph p) T_star + · exact Or.inr hClique + by_cases hNew : HasHairlessAnimal S G T_star θ_star (χ + 1) ψ τ + · exact Or.inl hNew + apply False.elim + obtain ⟨H, η, θ_span, T₀, d₀, X, Y, hAnim₀⟩ := hAnimal + let T := GM10.truncation T₀ θ + let d : Set S → Set S → ℕ := fun a b => min (d₀ a b) θ + have hAnim : IsAnimal G T_star θ_star H η θ T d X Y χ δ θ (τ + 1) := + theorem_8_3_claim_1 hAnim₀ + have hSaved := hAnim + obtain ⟨_, _, hSpan, hMet, hXsub, hXcard, hYsub, _, hHorns, _, hSep⟩ := hAnim + by_cases hμzero : μ = 0 + · exact hClique (controlsMinor_of_zero_pairs hS hConn p hSpan hMet (hr₀.trans hrθ) hμzero) + have hμ : 1 ≤ μ := by omega + obtain ⟨F⟩ := hSaved.exists_hairFamily + obtain ⟨_, hself, _, hsymm, htri, _⟩ := GraphMinor.GM11.gm15_theorem_9_1.{w} H θ T d hS hConn hMet + have hselfV : ∀ a ∈ H.V, d {a} {a} = 0 := fun a ha => + hself {a} (singleton_mem_A_of_mem_V ha) + have hsymV : ∀ a ∈ H.V, ∀ b ∈ H.V, d {a} {b} = d {b} {a} := fun a ha b hb => + hsymm {a} (singleton_mem_A_of_mem_V ha) {b} (singleton_mem_A_of_mem_V hb) + have htriV : ∀ a ∈ H.V, ∀ b ∈ H.V, ∀ c ∈ H.V, + d {a} {c} ≤ d {a} {b} + d {b} {c} := fun a ha b hb c hc => + htri {a} (singleton_mem_A_of_mem_V ha) {b} (singleton_mem_A_of_mem_V hb) + {c} (singleton_mem_A_of_mem_V hc) + obtain ⟨w, hw, Y₄, hY₄, hY₄card, hnearFar⟩ := theorem_6_3_far_end_cluster hS hConn + hSaved F hμ rfl hr₀ (by omega) (by dsimp only [θ]; omega) + hψ (hψr.trans hrθ) (Nat.le_succ τ) hττ' hτ' hselfV hsymV htriV hClique hNew + have hwA := singleton_mem_A_of_mem_V hw + obtain ⟨Λ₁, hZone₁, hcontain₁⟩ := GraphMinor.GM14.theorem_9_2_proof.{w} H θ r T d {w} hS hConn + hMet hwA + (by omega) (by dsimp only [θ]; omega) + obtain ⟨Λ, hZone, hRigid, hcontain⟩ := GraphMinor.GM14.theorem_9_3_proof.{w} H θ + (r + 3) T d {w} hS hConn hSpan.isRigid hMet hwA + (by omega) (by dsimp only [θ]; omega) + change IsLambdaZoneAround H d (r + 8) {w} Λ at hZone + have hnest : closure Λ₁ ⊆ Λ := zone_closure_subset_of_atom_neighborhood hZone₁ + (by intro a ha hd; exact hcontain a ha hd) + have hfarΛ₁ : ∀ y ∈ Y₄, F.far y ∈ closure Λ₁ := by + intro y hy + have hfarH := F.far_mem y (hY₄ hy) + have hd : d {w} {F.far y} < r := by + rw [hsymV w hw (F.far y) hfarH] + exact hnearFar y hy + exact subset_closure (hcontain₁ {F.far y} (singleton_mem_A_of_mem_V hfarH) hd (mem_singleton _)) + have hnearOut : ∀ y ∈ Y₄, y ∉ Λ := by + intro y hy hyΛ + have hyH := hYsub (hY₄ hy) + have hfarH := F.far_mem y (hY₄ hy) + have hbound := hZone.dist_le {y} (singleton_mem_A_of_mem_V hyH) + (singleton_subset_iff.mpr (subset_closure hyΛ)) + have htri' := htriV y hyH w hw (F.far y) hfarH + rw [hsymV y hyH w hw, hsymV w hw (F.far y) hfarH] at htri' + have hfar := F.dist y (hY₄ hy) + have hnear := hnearFar y hy + change 5 * r + 34 ≤ d {y} {F.far y} at hfar + omega + let H' := clearedSubdrawing H Λ + let η' := restrictCleared η Λ + obtain ⟨T', d', hClear, _⟩ := GraphMinor.GM14.theorem_3_2_proof hS hConn + (by dsimp only [θ]; omega : 4 * (r + 8) + 3 ≤ θ) hMet hZone + have horder : θ - 4 * (r + 8) - 2 = r := by dsimp only [θ]; omega + have hSpan' : IsSigmaSpan G H' η' θ_star r T_star T' := by + simpa only [horder] using IsSigmaSpan.clear hSpan hClear hRigid + have hMet' : HasTangleMetric H' r T' d' := by + simpa only [horder] using hClear.hasMetric + have hY₄new : ∀ y ∈ Y₄, y ∈ H'.V := fun y hy => + mem_clearedSubdrawing_V (hYsub (hY₄ hy)) (hnearOut y hy) + have hSep' : ∀ y ∈ Y₄, ∀ z ∈ Y₄, y ≠ z → r ≤ d' {y} {z} := by + intro y hy z hz hyz + have hdist := hSep y (hY₄ hy) z (hY₄ hz) hyz + have hbound := (hClear.dist_bounds {y} (singleton_mem_A_of_mem_V (hYsub (hY₄ hy))) + {z} (singleton_mem_A_of_mem_V (hYsub (hY₄ hz))) + {y} (singleton_mem_A_of_mem_V (hY₄new y hy)) + {z} (singleton_mem_A_of_mem_V (hY₄new z hz)) Subset.rfl Subset.rfl).1 + change 5 * r + 34 ≤ d {y} {z} at hdist + omega + have hXnew : X ⊆ V(G) \ V(η'.imageGraph) := by + intro x hx + exact ⟨(hXsub hx).1, fun hx' => (hXsub hx).2 + ((restrictCleared_imageGraph_le η Λ).vertexSet_mono hx')⟩ + have hOldHorns : ∀ x ∈ X, ∃ (P : Fin τ → Graph α β) (ends : Fin τ → S), + IsHorn G H' η' d' x r τ P ends := by + intro x hx + obtain ⟨P, ends, hHorn⟩ := hHorns x hx + have h62 := theorem_6_2_proof hS hConn G θ_star θ (r + 8) τ T_star H η T T' d d' Λ x P ends + hSpan hMet (by omega) (by dsimp only [θ]; omega) + ⟨{w}, hwA, hZone⟩ hRigid hClear hHorn + simpa only [horder] using h62 + have hBase : IsAnimal G T_star θ_star H' η' r T' d' X ∅ χ 0 r τ := + ⟨by omega, le_rfl, hSpan', hMet', hXnew, hXcard, empty_subset _, ncard_empty S, + hOldHorns, fun _ h => False.elim h, fun _ h => False.elim h⟩ + obtain ⟨K, hKG, hConnK, hXK, hKH, hInter, hLeaf⟩ := exists_connected_cleared_hair_graph + hS F hYsub hXsub hMet.1.1 hZone₁ hZone.isOpenDisc.1 hnest hY₄ hfarΛ₁ hnearOut + let A := η'.vMap '' Y₄ + have hAK : A ⊆ V(K) := by + intro x hx + have hx' : x ∈ V(K) ∩ V(η'.imageGraph) := hInter.symm ▸ hx + exact hx'.1 + have hAH : A ⊆ V(η'.imageGraph) := by + rintro x ⟨y, hy, rfl⟩ + exact η'.bijOn_v.mapsTo (hY₄new y hy) + have hAcard : A.ncard = Y₄.ncard := (η'.bijOn_v.injOn.mono hY₄new).ncard_image + have hμτ : 2 ≤ μ * τ' := by + simpa only [Nat.one_mul] using Nat.mul_le_mul hμ hτ' + change μ * τ' ≤ Y₄.ncard at hY₄card + have hA2 : 1 < A.ncard := by omega + have hcompA : ∀ a ∈ A, ∃ b ∈ A, b ≠ a ∧ Relation.ReflTransGen K.Adj a b := by + intro a ha + obtain ⟨b, hb, hba⟩ := exists_ne_of_one_lt_ncard hA2 a + obtain ⟨W⟩ := hConnK.2 a (hAK ha) b (hAK hb) + exact ⟨b, hb, hba, graphWalk_adj_reachable W⟩ + have hcountA : τ' * (μ - 1) < A.ncard := by + have hpred : μ - 1 + 1 = μ := by omega + have hsum : τ' * (μ - 1) + τ' = μ * τ' := by + calc + τ' * (μ - 1) + τ' = (μ - 1 + 1) * τ' := by ring + _ = μ * τ' := by rw [hpred] + have hstrict : τ' * (μ - 1) < μ * τ' := by omega + omega + have hKV := hT.finite_V.subset hKG.vertexSet_mono + have hKE := hT.finite_E.subset hKG.edgeSet_mono + rcases theorem_5_3_proof K A μ τ' hKV hKE hAK hcompA hcountA with + ⟨P, a, b, hPP, hP⟩ | ⟨x, P, b, hxK, hinter, hP⟩ + · apply hClique + apply (cliquePathThreshold_spec hS hConn p).2 G K θ_star r T_star H' η' T' d' Y₄ + P a b hSpan' hMet' hr₀ hY₄new + (fun y hy z hz hyz => hr₀.trans (hSep' y hy z hz hyz)) hKG hKH hInter.subset + · intro i + obtain ⟨ha, hb, hab, hp, _⟩ := hP i + exact ⟨hAH ha, hAH hb, hab, hp⟩ + · exact hPP + · have hxH : x ∉ V(η'.imageGraph) := by + intro hxH + have hl := hLeaf x hxH + have hc : {z | K.Adj x z}.ncard ≤ 1 := + (ncard_le_one hl.finite).mpr (fun _ ha _ hb => hl ha hb) + have hf := fan_card_le_neighbors_ncard hKV + (fun i => ⟨(hP i).2.1, (hP i).2.2.1⟩) + (fun i j hij => (hinter i j hij).1.subset) + omega + obtain ⟨R, ends, hHorn⟩ := horn_of_fan_in_subgraph hKG hxK hxH hInter.subset hY₄new + (fun y hy z hz hyz => hψr.trans (hSep' y hy z hz hyz)) + (fun i => ⟨hAH (hP i).1, (hP i).2.2.1⟩) hinter + have hxX : x ∉ X := fun hxX => (Set.disjoint_left.mp hXK) hxX hxK + exact hNew (hBase.add_horn hψ hψr le_rfl hxX ⟨_, _, hHorn.mono le_rfl hττ'⟩) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section6ZoneWalks.lean b/LeanPool/GraphMinor/GM16/Section6ZoneWalks.lean new file mode 100644 index 0000000000..199df0cfe0 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section6ZoneWalks.lean @@ -0,0 +1,146 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6 +import LeanPool.GraphMinor.GM16.DrawingConnected +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.GM11.OArcCircuit +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Connections inside a zone in XVI (6.3) + +A zone boundary is a circuit of the drawing. A drawing path from a +vertex in the closed zone to that circuit can be stopped at its first +boundary vertex, and all its edges up to that point stay in the closed +zone. Paths along the boundary then join any two vertices in the closed +zone. In (6.3), these are the far ends `v(y)`, correcting the printed +occurrence of `Y₄` on page 60. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- The closed smaller zone lies inside the larger zone if the latter +contains all atoms at distance less than `lam + 1`. This is the nesting +step in XVI (6.3), page 60. -/ +theorem zone_closure_subset_of_atom_neighborhood [ConnectedSpace S] + {H : Drawing S} {d : Set S → Set S → ℕ} {z Λ₁ Λ : Set S} {lam : ℕ} + (h₁ : IsLambdaZoneAround H d lam z Λ₁) + (hΛ : ∀ a ∈ H.A, d z a < lam + 1 → a ⊆ Λ) : closure Λ₁ ⊆ Λ := by + intro x hx + obtain ⟨a, ha, hxa⟩ := exists_atom H x + have hd := h₁.dist_le a ha (zone_atom_subset_closure h₁ ha ⟨x, hxa, hx⟩) + exact hΛ a ha (by omega) hxa + +/-- A walk from the closed zone to its boundary has an initial segment +inside the closed zone ending on the boundary. An edge starting in the +open zone cannot lie in its closed complement. -/ +theorem walk_to_zone_boundary + {H : Drawing S} {d : Set S → Set S → ℕ} {z Λ : Set S} {lam : ℕ} + (hZone : IsLambdaZoneAround H d lam z Λ) {a b : S} (W : GraphWalk H.toGraph a b) : + a ∈ closure Λ → b ∈ subBd Λ → + ∃ c ∈ subBd Λ, Nonempty (GraphWalk (H.interSet (closure Λ)).toGraph a c) := by + have hSub : (H.interSet (closure Λ)).IsSubdrawing H := H.span_isSubdrawing _ _ + have hmem : ∀ a ∈ H.V, a ∈ closure Λ → a ∈ (H.interSet (closure Λ)).V := by + intro a ha hcl + exact Or.inl ⟨⟨ha, hcl⟩, ha⟩ + induction W with + | @nil a ha => + intro hcl hb + exact ⟨a, hb, ⟨.nil (hmem a ha hcl)⟩⟩ + | @cons a c b e he W ih => + intro ha hb + by_cases habd : a ∈ subBd Λ + · exact ⟨a, habd, ⟨.nil (hmem a he.2.1 ha)⟩⟩ + have haΛ : a ∈ Λ := by + rw [(isOpen_disjoint_subBd_and_closure_eq hZone.isOpenDisc.1).2] at ha + exact ha.resolve_right habd + have hacl : a ∈ closure e := (he.2.2.2 ▸ mem_insert a {c}).1 + have hccl : c ∈ closure e := (he.2.2.2 ▸ mem_insert_of_mem a (mem_singleton c)).1 + have heΛ : e ⊆ Λ := by + rcases edge_subset_or_subset_compl_of_zone hZone he.1 with heΛ | heout + · exact heΛ + · have hout : closure e ⊆ univ \ Λ := closure_minimal heout + (by simpa only [← compl_eq_univ_sdiff] using hZone.isOpenDisc.1.isClosed_compl) + exact False.elim ((hout hacl).2 haΛ) + have hecl : closure e ⊆ closure Λ := closure_mono heΛ + obtain ⟨w, hwbd, ⟨W'⟩⟩ := ih (hecl hccl) hb + have heH' : e ∈ (H.interSet (closure Λ)).E := by + change e ∈ (H.span _ _).E + rw [H.span_E] + exact ⟨⟨he.1, heΛ.trans subset_closure⟩, he.1⟩ + exact ⟨w, hwbd, ⟨.cons ((hSub.isLink_iff heH').mpr he) W'⟩⟩ + +omit [T2Space S] in +private theorem subdrawing_mem_V_of_mem_U + {C H : Drawing S} (hCH : C.IsSubdrawing H) {x : S} (hxU : x ∈ C.U) (hxH : x ∈ H.V) : + x ∈ C.V := by + rw [C.U_eq] at hxU + rcases hxU with hx | hx + · exact hx + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + have hx : x ∈ closure e ∩ C.V := by + rw [hCH.closure_inter_V he] + exact ⟨hxe, hxH⟩ + exact hx.2 + +omit [T2Space S] in +private theorem circuit_walk_between + {C : Drawing S} (hC : C.IsCircuit) {a b : S} (ha : a ∈ C.V) (hb : b ∈ C.V) : + Nonempty (GraphWalk C.toGraph a b) := by + obtain ⟨u, W, _, _, hV, _⟩ := hC + rw [hV] at ha hb + obtain ⟨W₁, _, _⟩ := W.exists_append_of_mem ha + obtain ⟨W₂, _, _⟩ := W.exists_append_of_mem hb + exact ⟨W₁.reverse.append W₂⟩ + +/-- The part of a two-cell drawing in the closed zone is connected. +This supplies the connected subgraph joining the far ends in XVI (6.3), +page 60. The paper prints `Y₄` instead of their far ends at this point. -/ +theorem zone_interSet_connected (hS : IsClosedSurface S) [ConnectedSpace S] + {H : Drawing S} {d : Set S → Set S → ℕ} {z Λ : Set S} {lam : ℕ} + (hH : (PaintingOrDrawing.drawing H).IsTwoCell) + (hZone : IsLambdaZoneAround H d lam z Λ) : + (H.interSet (closure Λ)).IsConnected := by + obtain ⟨C, hC, hCH, hCU⟩ := exists_circuit_of_oArc hZone.isOArc_bd hZone.bd_subset_U + obtain ⟨b, W₀, hclosed, hpos, hCV, hCE⟩ := hC + have hC' : C.IsCircuit := ⟨b, W₀, hclosed, hpos, hCV, hCE⟩ + have hbC : b ∈ C.V := hCV.symm ▸ W₀.start_mem_support + have hbH : b ∈ H.V := hCH.1 hbC + have hbbd : b ∈ subBd Λ := hCU ▸ C.V_subset_U hbC + have hCJ : C.IsSubdrawing (H.interSet (closure Λ)) := + subdrawing_interSet_of_U_subset hCH (by rw [hCU]; exact fun _ h => h.1) + have htoB : ∀ a ∈ (H.interSet (closure Λ)).V, + Nonempty (GraphWalk (H.interSet (closure Λ)).toGraph a b) := by + intro a ha + have haH : a ∈ H.V := (Drawing.span_isSubdrawing H _ _).1 ha + have hacl : a ∈ closure Λ := + interSet_U_subset isClosed_closure ((H.interSet (closure Λ)).V_subset_U ha) + obtain ⟨W⟩ := drawing_walk_of_twoCell hS hH haH hbH + obtain ⟨c, hcbd, ⟨W₁⟩⟩ := walk_to_zone_boundary hZone W hacl hbbd + have hcH : c ∈ H.V := (Drawing.span_isSubdrawing H _ _).1 + (W₁.mem_vertexSet_of_mem_support W₁.end_mem_support) + have hcC : c ∈ C.V := subdrawing_mem_V_of_mem_U hCH (hCU.symm ▸ hcbd) hcH + obtain ⟨W₂⟩ := circuit_walk_between hC' hcC hbC + obtain ⟨W₂', _, _⟩ := hCJ.exists_walk_up W₂ + exact ⟨W₁.append W₂'⟩ + refine ⟨⟨b, hCJ.1 hbC⟩, ?_⟩ + intro a ha b' hb' + obtain ⟨W₁⟩ := htoB a ha + obtain ⟨W₂⟩ := htoB b' hb' + exact ⟨W₁.append W₂.reverse⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section7.lean b/LeanPool/GraphMinor/GM16/Section7.lean new file mode 100644 index 0000000000..b6b390575b --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section7.lean @@ -0,0 +1,490 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6 +public import LeanPool.GraphMinor.GM10.Section8 +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Graph Minors XVI, Section 7: The Giant Steps Application + +This file formalizes Section 7 ("The Giant Steps application", pages 62–63) of +N. Robertson and P. D. Seymour, *Graph Minors. XVI. Excluding a non-planar graph*, J. Combin. +Theory Ser. B 89 (2003) 43–76: + +- Identification of `Hypergraph.ofGraph (GM09.deleteVertices G Z)` with + `(Hypergraph.ofGraph G _ _).deleteVertices Z` (`ofGraph_deleteVertices_eq`) and proof that + `deleteGraphVerticesTangle` is a graph tangle of order `θ_star - Z.ncard` in `GM09.deleteVertices + G Z` + (`isGraphTangle_deleteGraphVerticesTangle`). +- Statement and unconditional proof of **Graph Minors XVI, (7.3)** (`GM16Theorem73Statement`, + `theorem_7_3`, page 63), using **Graph Minors X, (2.9)** (`GM10.theorem_2_9`) and **(8.5)** + (`GM10.theorem_8_5`). +- Statement and unconditional proof of **Graph Minors XVI, (7.4)** (`GM16Theorem74Statement`, + `theorem_7_4`, page 63), lifting a `Σ`-span in `G \ Z` with respect to `T* \ Z` to a `Σ`-span in + `G` with respect to `T*`. +- Proof that `T*` controls every minor controlled by `T* \ Z` + (`controlsMinor_of_deleteGraphVerticesTangle`, page 63). +- Statements of **Graph Minors XVI, (7.1)** (`GM16Theorem71Statement`, page 62) and **(7.2)** + (`GM16Theorem72Statement`, page 62), and complete proof of **Graph Minors XVI, (6.1)** + (`theorem_6_1`, page 63) from `(7.1)` and `(7.2)`. +The backward and tower inductions are proved in `InductionsProved.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM16 + +open Set Function Topology +open Graph SimpleGraph Hypergraph +open GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 GraphMinor.GM15 + +universe u v w + +variable {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + +/-! ## Vertex Deletion on Graphs, Hypergraphs, and Tangles -/ + +/-- `Hypergraph.ofGraph G hV hE` is a graph hypergraph (`Hypergraph.IsGraph`). -/ +theorem isGraph_ofGraph (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) : + (Hypergraph.ofGraph G hV hE).IsGraph := by + intro e he + change e ∈ E(G) at he + rw [G.edge_mem_iff_exists_isLink] at he + obtain ⟨x, y, hlink⟩ := he + have hne : ((Hypergraph.ofGraph G hV hE).ends e).Nonempty := ⟨x, ⟨y, hlink⟩⟩ + refine ⟨hne, ?_⟩ + have hsub : (Hypergraph.ofGraph G hV hE).ends e ⊆ {x, y} := by + intro a ⟨z, haz⟩ + rcases G.eq_or_eq_of_isLink_of_isLink haz hlink with rfl | rfl + · exact mem_insert a {y} + · exact mem_insert_of_mem x (mem_singleton a) + have hle1 : ((Hypergraph.ofGraph G hV hE).ends e).ncard ≤ ({x, y} : Set α).ncard := + ncard_le_ncard hsub ((finite_singleton y).insert x) + have hle2 : ({x, y} : Set α).ncard ≤ 2 := by + have := ncard_insert_le x {y} + rw [ncard_singleton] at this + exact this + exact hle1.trans hle2 + +/-- Deleting `Z ∩ H.vertexSet` from a hypergraph `H` is the same as deleting `Z`. -/ +theorem deleteVertices_inter_vertexSet (H : Hypergraph α β) (Z : Set α) : + H.deleteVertices (Z ∩ H.vertexSet) = H.deleteVertices Z := by + have h1 : H.deleteVertices (Z ∩ H.vertexSet) ≤ H := deleteVertices_le H _ + have h2 : H.deleteVertices Z ≤ H := deleteVertices_le H _ + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq h1 h2 ?_ ?_ + · ext v + simp only [Hypergraph.deleteVertices, mem_sdiff, mem_inter_iff] + tauto + · ext e + simp only [Hypergraph.deleteVertices, mem_ofPred_eq, mem_inter_iff] + refine ⟨fun ⟨he, hno⟩ => ⟨he, fun v hvZ hinc => hno v ⟨hvZ, H.vertex_mem_of_inc hinc⟩ hinc⟩, + fun ⟨he, hno⟩ => ⟨he, fun v ⟨hvZ, _⟩ hinc => hno v hvZ hinc⟩⟩ + +/-- If `(A, B)` is a separation of `G_H`, then `(A.deleteVertices Z, B.deleteVertices Z)` is a +separation of `G_H.deleteVertices Z` with order `≤ separationOrder A B`. -/ +theorem isSeparation_deleteVertices {G_H A B : Hypergraph α β} + (hsep : G_H.IsSeparation A B) (Z : Set α) : + (G_H.deleteVertices Z).IsSeparation (A.deleteVertices Z) (B.deleteVertices Z) ∧ + separationOrder (A.deleteVertices Z) (B.deleteVertices Z) ≤ separationOrder A B := by + have hA_le : A.deleteVertices Z ≤ G_H.deleteVertices Z := by + refine ⟨sdiff_subset_sdiff hsep.left_le.vertexSet_subset Subset.rfl, ?_, ?_⟩ + · intro e ⟨heA, hno⟩ + exact ⟨hsep.left_le.edgeSet_subset heA, fun v hvZ hincG => + hno v hvZ ((inc_iff_of_le hsep.left_le heA).mpr hincG)⟩ + · intro e ⟨heA, _⟩ + ext v + simp only [Hypergraph.ends, mem_ofPred_eq, Hypergraph.deleteVertices] + simp_rw [inc_iff_of_le hsep.left_le heA] + have hB_le : B.deleteVertices Z ≤ G_H.deleteVertices Z := by + refine ⟨sdiff_subset_sdiff hsep.right_le.vertexSet_subset Subset.rfl, ?_, ?_⟩ + · intro e ⟨heB, hno⟩ + exact ⟨hsep.right_le.edgeSet_subset heB, fun v hvZ hincG => + hno v hvZ ((inc_iff_of_le hsep.right_le heB).mpr hincG)⟩ + · intro e ⟨heB, _⟩ + ext v + simp only [Hypergraph.ends, mem_ofPred_eq, Hypergraph.deleteVertices] + simp_rw [inc_iff_of_le hsep.right_le heB] + constructor + · rw [isSeparation_iff_of_le hA_le hB_le] + refine ⟨?_, ?_, ?_⟩ + · change (A.vertexSet \ Z) ∪ (B.vertexSet \ Z) = G_H.vertexSet \ Z + rw [← union_sdiff_distrib, hsep.vertexSet_union] + · ext e + simp only [Hypergraph.deleteVertices, mem_union, mem_ofPred_eq] + constructor + · rintro (⟨heA, hno⟩ | ⟨heB, hno⟩) + · exact ⟨hsep.left_le.edgeSet_subset heA, fun v hvZ hincG => + hno v hvZ ((inc_iff_of_le hsep.left_le heA).mpr hincG)⟩ + · exact ⟨hsep.right_le.edgeSet_subset heB, fun v hvZ hincG => + hno v hvZ ((inc_iff_of_le hsep.right_le heB).mpr hincG)⟩ + · rintro ⟨heG, hno⟩ + rcases hsep.edgeSet_union.symm ▸ heG with heA | heB + · exact Or.inl ⟨heA, fun v hvZ hincA => + hno v hvZ ((inc_iff_of_le hsep.left_le heA).mp hincA)⟩ + · exact Or.inr ⟨heB, fun v hvZ hincB => + hno v hvZ ((inc_iff_of_le hsep.right_le heB).mp hincB)⟩ + · ext e + simp only [Hypergraph.deleteVertices, mem_inter_iff, mem_ofPred_eq, mem_empty_iff_false, + iff_false] + rintro ⟨⟨heA, _⟩, ⟨heB, _⟩⟩ + exact hsep.notMem_edgeSet_right heA heB + · have hsub : (A.deleteVertices Z ∩ B.deleteVertices Z).vertexSet ⊆ (A ∩ B).vertexSet := by + intro v ⟨⟨hvA, _⟩, ⟨hvB, _⟩⟩ + exact ⟨hvA, hvB⟩ + exact ncard_le_ncard hsub (A ∩ B).vertexSet_finite + +/-- `Hypergraph.ofGraph (GM09.deleteVertices G Z)` coincides with +`(Hypergraph.ofGraph G hV hE).deleteVertices Z`. -/ +theorem ofGraph_deleteVertices_eq (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) + (Z : Set α) + (hV' : V(GM09.deleteVertices G Z).Finite := hV.subset (by simp [GM09.deleteVertices])) + (hE' : E(GM09.deleteVertices G Z).Finite := + hE.subset (G.induce_le sdiff_subset).edgeSet_mono) : + Hypergraph.ofGraph (GM09.deleteVertices G Z) hV' hE' = + (Hypergraph.ofGraph G hV hE).deleteVertices Z := by + have hle1 : Hypergraph.ofGraph (GM09.deleteVertices G Z) hV' hE' ≤ + Hypergraph.ofGraph G hV hE := by + have hle_G : GM09.deleteVertices G Z ≤ G := G.induce_le sdiff_subset + refine ⟨hle_G.vertexSet_mono, hle_G.edgeSet_mono, fun e he => ?_⟩ + ext v + simp only [Hypergraph.ends, Hypergraph.ofGraph, GM09.deleteVertices, Graph.Inc, + induce_isLink, mem_ofPred_eq, mem_sdiff] + change e ∈ E(G.induce (V(G) \ Z)) at he + rw [Graph.edgeSet_induce, mem_ofPred_eq] at he + obtain ⟨x, y, hlink, ⟨hxG, hxZ⟩, ⟨hyG, hyZ⟩⟩ := he + constructor + · rintro ⟨z, hlink'⟩ + have hv : v ∈ V(G) ∧ v ∉ Z := by + rcases G.eq_or_eq_of_isLink_of_isLink hlink' hlink with rfl | rfl + · exact ⟨hxG, hxZ⟩ + · exact ⟨hyG, hyZ⟩ + have hz : z ∈ V(G) ∧ z ∉ Z := by + rcases G.eq_or_eq_of_isLink_of_isLink hlink'.symm hlink with rfl | rfl + · exact ⟨hxG, hxZ⟩ + · exact ⟨hyG, hyZ⟩ + exact ⟨z, hlink', hv, hz⟩ + · rintro ⟨z, hlink', _, _⟩ + exact ⟨z, hlink'⟩ + have hle2 : (Hypergraph.ofGraph G hV hE).deleteVertices Z ≤ + Hypergraph.ofGraph G hV hE := deleteVertices_le _ _ + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle1 hle2 rfl ?_ + ext e + simp only [Hypergraph.ofGraph, GM09.deleteVertices, Hypergraph.deleteVertices, + Graph.edgeSet_induce, + mem_ofPred_eq, mem_sdiff] + constructor + · rintro ⟨u, v, hlink, ⟨huG, huZ⟩, ⟨hvG, hvZ⟩⟩ + refine ⟨(G.edge_mem_iff_exists_isLink e).mpr ⟨u, v, hlink⟩, fun w hwZ ⟨z, hwz⟩ => ?_⟩ + rcases G.eq_or_eq_of_isLink_of_isLink hwz hlink with rfl | rfl + · exact huZ hwZ + · exact hvZ hwZ + · rintro ⟨heG, hno⟩ + rw [G.edge_mem_iff_exists_isLink] at heG + obtain ⟨u, v, hlink⟩ := heG + exact ⟨u, v, hlink, + ⟨G.left_mem_of_isLink hlink, fun huZ => hno u huZ ⟨v, hlink⟩⟩, + ⟨G.left_mem_of_isLink hlink.symm, fun hvZ => hno v hvZ ⟨u, hlink.symm⟩⟩⟩ + +/-- If `T_star` is a graph tangle of order `θ_star` in `G` and `Z ⊆ V(G)` with `Z.ncard < θ_star`, +then `deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star` is a graph tangle of +order `θ_star - Z.ncard` in `GM09.deleteVertices G Z`. -/ +theorem isGraphTangle_deleteGraphVerticesTangle {G : Graph α β} {θ_star : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + (hT : IsGraphTangle G θ_star T_star) {Z : Set α} + (hZ_sub : Z ⊆ V(G)) (hZ_lt : Z.ncard < θ_star) : + IsGraphTangle (GM09.deleteVertices G Z) (θ_star - Z.ncard) + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star) where + finite_V := hT.finite_V.subset (by simp [GM09.deleteVertices]) + finite_E := hT.finite_E.subset (G.induce_le sdiff_subset).edgeSet_mono + isTangle := by + rw [ofGraph_deleteVertices_eq G hT.finite_V hT.finite_E Z] + exact GM10.theorem_8_5_proof (isGraph_ofGraph G hT.finite_V hT.finite_E) + hT.isTangle hZ_sub hZ_lt + +/-! ## Statements and Proofs of (7.3) and (7.4) (page 63) -/ + +/-- Statement of Graph Minors XVI, (7.3) (page 63): +"Let $\mathcal{T}^*$ be a tangle in a graph $G$, let $Z \subseteq V(G)$ with +$|Z| < ord(\mathcal{T}^*)$, and let $(A, B)$ be a separation of $G$ of order +$< ord(\mathcal{T}^*) - |Z|$. Then $(A, B) \in \mathcal{T}^*$ if and only if +$$(A \setminus (Z \cap V(A)), B \setminus (Z \cap V(B))) \in \mathcal{T}^* \setminus Z.$$" -/ +def GM16Theorem73Statement : Prop := + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (hT : IsGraphTangle G θ_star T_star) + (Z : Set α) (A B : Hypergraph α β), + Z ⊆ V(G) → Z.ncard < θ_star → + (Hypergraph.ofGraph G hT.finite_V hT.finite_E).IsSeparation A B → + separationOrder A B < θ_star - Z.ncard → + ((A, B) ∈ T_star ↔ + (A.deleteVertices (Z ∩ A.vertexSet), B.deleteVertices (Z ∩ B.vertexSet)) ∈ + deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star) + +/-- **Graph Minors XVI, (7.3)** (page 63): +For any separation `(A, B)` of `G` of order `< θ_star - |Z|`, `(A, B) ∈ T*` if and only if +`(A \ Z, B \ Z) ∈ T* \ Z`. -/ +theorem theorem_7_3_proof : GM16Theorem73Statement.{u, v} := by + intro α β G θ_star T_star hT Z A B hZ_sub hZ_lt hsep hord + rw [deleteVertices_inter_vertexSet A Z, deleteVertices_inter_vertexSet B Z] + let G_H := Hypergraph.ofGraph G hT.finite_V hT.finite_E + have hT_del : IsTangle (G_H.deleteVertices Z) (θ_star - Z.ncard) + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star) := + GM10.theorem_8_5_proof (isGraph_ofGraph G hT.finite_V hT.finite_E) hT.isTangle hZ_sub hZ_lt + have hback : ∀ {X Y : Hypergraph α β}, + G_H.IsSeparation X Y → separationOrder X Y < θ_star - Z.ncard → + (X.deleteVertices Z, Y.deleteVertices Z) ∈ + deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star → + (X, Y) ∈ T_star := by + intro X Y hsepXY hordXY hmem_del + rcases hmem_del.2.2 with ⟨⟨A_star, B_star⟩, hm, hZ_AB, hA_eq, hB_eq⟩ + dsimp only at hm hZ_AB hA_eq hB_eq + have hVX_sub : X.vertexSet ⊆ A_star.vertexSet := by + intro v hvX + by_cases hvZ : v ∈ Z + · exact (hZ_AB hvZ).1 + · have hv_del : v ∈ (X.deleteVertices Z).vertexSet := ⟨hvX, hvZ⟩ + rw [← hA_eq] at hv_del + exact hv_del.1 + exact GM10.theorem_2_9_proof hT.isTangle hm hsepXY (by omega) (Or.inr (Or.inl hVX_sub)) + constructor + · intro hAB + by_contra hnot_del + have ⟨hsep_del, hord_del_le⟩ := isSeparation_deleteVertices hsep Z + have hBA_del : (B.deleteVertices Z, A.deleteVertices Z) ∈ + deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star := + (hT_del.axiom1 hsep_del (hord_del_le.trans_lt hord)).resolve_left hnot_del + have hord_BA : separationOrder B A < θ_star - Z.ncard := by + rwa [separationOrder_comm] + have hBA : (B, A) ∈ T_star := hback hsep.symm hord_BA hBA_del + exact GM10.theorem_2_1_proof hT.isTangle hAB hBA + · exact hback hsep hord + +/-- Lift a `SpanEmbedding H G'` along a subgraph inclusion `G' ≤ G`. -/ +def liftSpanEmbedding {H : Drawing S} {G' G : Graph α β} + (η : SpanEmbedding H G') (hle : G' ≤ G) : + SpanEmbedding H G where + imageGraph := η.imageGraph + vMap := η.vMap + eMap := η.eMap + imageGraph_le := η.imageGraph_le.trans hle + bijOn_v := η.bijOn_v + bijOn_e := η.bijOn_e + inc_iff := η.inc_iff + +/-- Statement of Graph Minors XVI, (7.4) (page 63): +"Let $\mathcal{T}^*$ be a tangle in $G$, and let $Z \subseteq V(G)$ with $|Z| < ord(\mathcal{T}^*)$. +If $H, \eta, \mathcal{T}$ is a $\Sigma$-span in $G \setminus Z$ with respect to +$\mathcal{T}^* \setminus Z$ then $H, \eta, \mathcal{T}$ is a $\Sigma$-span in $G$ with respect to +$\mathcal{T}^*$." -/ +def GM16Theorem74Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + {α : Type u} {β : Type v} (G : Graph α β) (θ_star θ : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (hT : IsGraphTangle G θ_star T_star) + (Z : Set α) + (H : Drawing S) (η : SpanEmbedding H (GM09.deleteVertices G Z)) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))), + Z ⊆ V(G) → Z.ncard < θ_star → + IsSigmaSpan (GM09.deleteVertices G Z) H η (θ_star - Z.ncard) θ + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star) T → + IsSigmaSpan G H (liftSpanEmbedding η (G.induce_le sdiff_subset)) θ_star θ T_star T + +/-- **Graph Minors XVI, (7.4)** (page 63): +Every `Σ`-span in `G \ Z` with respect to `T* \ Z` is a `Σ`-span in `G` with respect to `T*`. -/ +theorem theorem_7_4_proof : GM16Theorem74Statement.{u, v, w} := by + intro S _ _ α β G θ_star θ T_star hT Z H η T hZ_sub hZ_lt hSpan + let η' := liftSpanEmbedding η (G.induce_le sdiff_subset) + have hθ_le_del : θ ≤ θ_star - Z.ncard := hSpan.isControlling.theta_le + refine ⟨hSpan.isSurface, hSpan.isConnected, hSpan.bd_empty, hSpan.isRigid, hSpan.isRespectful, + ⟨by omega, hT, hSpan.isControlling.isTangle_H, ?_⟩⟩ + intro A B hsep hord A_H B_H hRestr + have hord_lt_del : separationOrder A B < θ_star - Z.ncard := by omega + have h73 := theorem_7_3_proof G θ_star T_star hT Z A B hZ_sub hZ_lt hsep hord_lt_del + rw [deleteVertices_inter_vertexSet A Z, deleteVertices_inter_vertexSet B Z] at h73 + have ⟨hsep_del, hord_del_le⟩ := isSeparation_deleteVertices hsep Z + have hsep_del' : + (Hypergraph.ofGraph (GM09.deleteVertices G Z) + hSpan.isControlling.isTangle_star.finite_V + hSpan.isControlling.isTangle_star.finite_E).IsSeparation + (A.deleteVertices Z) (B.deleteVertices Z) := by + rwa [ofGraph_deleteVertices_eq G hT.finite_V hT.finite_E Z] + have hV_img_sub : V(η.imageGraph) ⊆ V(G) \ Z := by + simpa [GM09.deleteVertices] using η.imageGraph_le.vertexSet_mono + have hRestr_del : + IsRestrictedSeparation H (GM09.deleteVertices G Z) η + (A.deleteVertices Z) (B.deleteVertices Z) A_H B_H := by + rcases hRestr with ⟨hsepH, hVA, hEA, hVB, hEB⟩ + change η.vMap '' A_H.vertexSet = A.vertexSet ∩ V(η.imageGraph) at hVA + change η.eMap '' A_H.edgeSet = A.edgeSet ∩ E(η.imageGraph) at hEA + change η.vMap '' B_H.vertexSet = B.vertexSet ∩ V(η.imageGraph) at hVB + change η.eMap '' B_H.edgeSet = B.edgeSet ∩ E(η.imageGraph) at hEB + refine ⟨hsepH, ?_, ?_, ?_, ?_⟩ + · rw [hVA] + ext v + simp only [Hypergraph.deleteVertices, mem_inter_iff, mem_sdiff] + exact ⟨fun ⟨hvA, hvI⟩ => ⟨⟨hvA, (hV_img_sub hvI).2⟩, hvI⟩, + fun ⟨⟨hvA, _⟩, hvI⟩ => ⟨hvA, hvI⟩⟩ + · rw [hEA] + ext e + simp only [Hypergraph.deleteVertices, mem_inter_iff, mem_ofPred_eq] + refine ⟨fun ⟨heA, heI⟩ => ⟨⟨heA, fun v hvZ hincA => ?_⟩, heI⟩, + fun ⟨⟨heA, _⟩, heI⟩ => ⟨heA, heI⟩⟩ + have hincG : (Hypergraph.ofGraph G hT.finite_V hT.finite_E).Inc e v := + (inc_iff_of_le hsep.left_le heA).mp hincA + obtain ⟨w, hlinkG⟩ := hincG + have heI_save := heI + rw [η.imageGraph.edge_mem_iff_exists_isLink] at heI + obtain ⟨x, y, hlinkI⟩ := heI + have hlinkG' : G.IsLink e x y := (η'.imageGraph_le.isLink_iff heI_save).mp hlinkI + rcases G.eq_or_eq_of_isLink_of_isLink hlinkG hlinkG' with rfl | rfl + · exact (hV_img_sub (η.imageGraph.left_mem_of_isLink hlinkI)).2 hvZ + · exact (hV_img_sub (η.imageGraph.left_mem_of_isLink hlinkI.symm)).2 hvZ + · rw [hVB] + ext v + simp only [Hypergraph.deleteVertices, mem_inter_iff, mem_sdiff] + exact ⟨fun ⟨hvB, hvI⟩ => ⟨⟨hvB, (hV_img_sub hvI).2⟩, hvI⟩, + fun ⟨⟨hvB, _⟩, hvI⟩ => ⟨hvB, hvI⟩⟩ + · rw [hEB] + ext e + simp only [Hypergraph.deleteVertices, mem_inter_iff, mem_ofPred_eq] + refine ⟨fun ⟨heB, heI⟩ => ⟨⟨heB, fun v hvZ hincB => ?_⟩, heI⟩, + fun ⟨⟨heB, _⟩, heI⟩ => ⟨heB, heI⟩⟩ + have hincG : (Hypergraph.ofGraph G hT.finite_V hT.finite_E).Inc e v := + (inc_iff_of_le hsep.right_le heB).mp hincB + obtain ⟨w, hlinkG⟩ := hincG + have heI_save := heI + rw [η.imageGraph.edge_mem_iff_exists_isLink] at heI + obtain ⟨x, y, hlinkI⟩ := heI + have hlinkG' : G.IsLink e x y := (η'.imageGraph_le.isLink_iff heI_save).mp hlinkI + rcases G.eq_or_eq_of_isLink_of_isLink hlinkG hlinkG' with rfl | rfl + · exact (hV_img_sub (η.imageGraph.left_mem_of_isLink hlinkI)).2 hvZ + · exact (hV_img_sub (η.imageGraph.left_mem_of_isLink hlinkI.symm)).2 hvZ + rw [h73] + exact hSpan.isControlling.controls hsep_del' (hord_del_le.trans_lt hord) hRestr_del + +/-- If `T* \ Z` controls an `L`-minor of `G \ Z` and `|V(L)| ≤ ord(T*) - |Z|`, then `T*` controls +an `L`-minor of `G` (Graph Minors XVI, Section 7, page 63: "it is easy to see that $\mathcal{T}^*$ +controls every minor controlled by $\mathcal{T}^* \setminus Z$"). -/ +theorem controlsMinor_of_deleteGraphVerticesTangle + {α' : Type*} {β' : Type*} {G : Graph α β} {L : Graph α' β'} {θ_star : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + (hT : IsGraphTangle G θ_star T_star) {Z : Set α} + (hZ_sub : Z ⊆ V(G)) (hZ_lt : Z.ncard < θ_star) + (hVL_le : V(L).ncard ≤ θ_star - Z.ncard) + (hCtrl : ControlsMinor (GM09.deleteVertices G Z) L + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star)) : + ControlsMinor G L T_star := by + have hle_del : GM09.deleteVertices G Z ≤ G := G.induce_le sdiff_subset + obtain ⟨α_v, α_e, hconn, hdisj, hlink, hloop, hinj, htangle⟩ := hCtrl + refine ⟨α_v, α_e, ?_, hdisj, ?_, ?_, hinj, ?_⟩ + · intro v hv + obtain ⟨h_le, h_ne, h_gc⟩ := hconn v hv + exact ⟨h_le.trans hle_del, h_ne, h_gc⟩ + · intro e he u hu v hv huv hLlink + obtain ⟨he_del, x, hx, y, hy, hlink_del⟩ := hlink e he u hu v hv huv hLlink + exact ⟨hle_del.edgeSet_mono he_del, x, hx, y, hy, hlink_del.1⟩ + · intro e he v hv hLloop + obtain ⟨⟨he_del, he_not⟩, x, hx, y, hy, hlink_del⟩ := hloop e he v hv hLloop + exact ⟨⟨hle_del.edgeSet_mono he_del, he_not⟩, x, hx, y, hy, hlink_del.1⟩ + · intro A B hAB hord v hv hv_sub + have hsep : (Hypergraph.ofGraph G hT.finite_V hT.finite_E).IsSeparation A B := + hT.isTangle.isSeparation hAB + have hord_lt : separationOrder A B < θ_star - Z.ncard := hord.trans_le hVL_le + have h73 := (theorem_7_3_proof G θ_star T_star hT Z A B hZ_sub hZ_lt hsep hord_lt).mp hAB + rw [deleteVertices_inter_vertexSet A Z, deleteVertices_inter_vertexSet B Z] at h73 + have ⟨_, hord_del_le⟩ := isSeparation_deleteVertices hsep Z + have hv_del_sub : V(α_v v) ⊆ (A.deleteVertices Z).vertexSet := by + intro x hx + have hx_in : x ∈ V(GM09.deleteVertices G Z) := (hconn v hv).1.vertexSet_mono hx + have hx_not_Z : x ∉ Z := by + change x ∈ V(G) \ Z at hx_in + exact hx_in.2 + exact ⟨hv_sub hx, hx_not_Z⟩ + exact htangle h73 (hord_del_le.trans_lt hord) v hv hv_del_sub + +/-! ## Statements of (7.1) and (7.2), and Proof of (6.1) (pages 62–63) -/ + +/-- Statement of Graph Minors XVI, (7.1) (page 62): +"Let $\Sigma$ be a surface, and let $\tau, \chi, \delta, \lambda \ge 0, \theta' \ge 1$ and +$\phi, \psi \ge 3$. Then there exist $\theta \ge 1$ and $\sigma \ge 0$ such that if +$\mathcal{T}^*$ is a tangle in a graph $G$, and there is an animal with $\chi$ horns and $\delta$ +hairs, of strength $\ge (\theta, \sigma)$, then either +- there is a $\Sigma'$-span of order $\ge \phi$, for some surface $\Sigma'$ obtained from $\Sigma$ + by adding a handle, or +- there is an animal with $\chi$ horns and $\delta + 1$ hairs, of strength $\ge (\psi, \tau)$, or +- there exists $Z \subseteq V(G)$ with $|Z| \le \chi + \frac{1}{2}\delta^2\phi^2$ such that some + $\Sigma$-span of order $\ge \theta'$ in $G\setminus Z$ with respect to $\mathcal{T}^*\setminus Z$ + is $(\lambda, 2\psi)$-level." -/ +def GM16Theorem71Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ τ χ δ lam θ' φ ψ : ℕ, 1 ≤ θ' → 3 ≤ φ → 3 ≤ ψ → + ∃ θ σ : ℕ, 1 ≤ θ ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (hT : IsGraphTangle G θ_star T_star), + HasAnimal S G T_star θ_star χ δ θ σ → + (∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S') + (H' : Drawing S') (η' : SpanEmbedding H' G) (θ_span' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsClosedSurface S' ∧ ConnectedSpace S' ∧ + IsObtainedByAddingHandle S S' ∧ + φ ≤ θ_span' ∧ IsSigmaSpan G H' η' θ_star θ_span' T_star T') ∨ + HasAnimal S G T_star θ_star χ (δ + 1) ψ τ ∨ + (∃ (Z : Set α) (H_l : Drawing S) (η_l : SpanEmbedding H_l (GM09.deleteVertices G Z)) + (θ_l : ℕ) + (T_l : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d_l : Set S → Set S → ℕ), + Z ⊆ V(G) ∧ Z.ncard ≤ χ + δ ^ 2 * φ ^ 2 / 2 ∧ Z.ncard < θ_star ∧ + θ' ≤ θ_l ∧ + IsLevelSpan (GM09.deleteVertices G Z) H_l η_l (θ_star - Z.ncard) θ_l lam (2 * ψ) + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star) T_l d_l) + +/-- Statement of Graph Minors XVI, (7.2) (page 62, strengthened from Graph Minors XV, (8.4)): +"Let $\Sigma$ be a surface and let $p, \phi, \mu \ge 0$. Then there exist $\kappa, \lambda, \rho \ge +0$ +and $\theta \ge 1$ such that if $\mathcal{T}^*$ is a tangle in a graph $G$, and some $\Sigma$-span +of +order $\ge \theta$ is $(\lambda, \mu)$-level, then either: +1. there is a $\Sigma'$-span of order $\phi$, for some surface $\Sigma'$ obtained from $\Sigma$ by + adding a crosscap, or +2. there is a $\mathcal{T}^*$-central segregation of $G$ of type $(\rho, \kappa)$ with a proper + arrangement in $\Sigma$, or +3. $\mathcal{T}^*$ controls a $K_p$ minor of $G$." -/ +def GM16Theorem72Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ p φ μ : ℕ, + ∃ κ lam ρ θ : ℕ, 1 ≤ θ ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star θ_span : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ), + IsGraphTangle G θ_star T_star → + θ ≤ θ_span → + IsLevelSpan G H η θ_star θ_span lam μ T_star T d → + (∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S') + (H' : Drawing S') (η' : SpanEmbedding H' G) (θ_span' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsClosedSurface S' ∧ ConnectedSpace S' ∧ + IsObtainedByAddingCrosscap S S' ∧ + φ ≤ θ_span' ∧ IsSigmaSpan G H' η' θ_star θ_span' T_star T') ∨ + (∃ (S_seg : Set (Society α β)) + (α_disc : Society α β → Set S) (α_pt : α → S), + IsCentralSegregation G T_star S_seg ∧ + IsSegregationOfType G ρ κ S_seg ∧ + IsProperArrangement S_seg α_disc α_pt) ∨ + ControlsMinor G (completeGraph p) T_star + + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section7ProperProof.lean b/LeanPool/GraphMinor/GM16/Section7ProperProof.lean new file mode 100644 index 0000000000..7d4d217805 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section7ProperProof.lean @@ -0,0 +1,99 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section7 +public import LeanPool.GraphMinor.GM16.ProperEyeInduction +import LeanPool.GraphMinor.GM16.VortexComparison +import LeanPool.GraphMinor.GM16.Section3 +import LeanPool.GraphMinor.GM11.PlaneFacts + +import LeanPool.GraphMinor.GM09.Bridge + +import LeanPool.GraphMinor.GM12.Bridge + +import LeanPool.GraphMinor.GM12.Section710 + +import LeanPool.GraphMinor.GM12.Section77 + +import LeanPool.GraphMinor.GM14.Bridge + +import LeanPool.GraphMinor.GM15.Section3Crosscap + +import LeanPool.GraphMinor.GM15.Section3Parallel + +/-! +# Graph Minors XVI (7.2) + +We follow XV (8.4), using XV (8.3) to pass from level spans to flat +spans and XV (8.1) to replace independent eyes by a controlled clique. +The arrangement outcome retains properness from its construction in +XV (7.7), as the proof of XVI (7.2), page 62, requires. +-/ + +public section +namespace GraphMinor.GM16 +open Set Function Topology +open Graph SimpleGraph Hypergraph Surface GM06 GM09 GM10 GM11 GM14 GM15 +universe u v w + +/-- Graph Minors XVI, (7.2), page 62. The properness omitted from the +statement of XV (8.4) is proved at the construction of its arrangements +in XV (7.7) and retained through the downward eye induction. -/ +theorem theorem_7_2_proof + : + GM16Theorem72Statement.{u, v, w} := by + intro S _ _ hClosed hConn p φ μ + have hSurf : IsSurface S := hClosed.isSurface + have hBd : bd S = ∅ := by + ext x + exact iff_false_intro (fun hx => hx (hClosed.2.2 x)) + let p4 := max p 4 + obtain ⟨κ, φ₁, hClique⟩ := GM15.theorem_8_1_proof S hSurf hConn hBd p4 + let φ₂ := max φ φ₁ + obtain ⟨θ₁, lam, ρ, hMain⟩ := + proper_arrangement_or_independent_eyes_or_crosscap + S hSurf hConn hBd κ φ₂ μ + let θ := max (max θ₁ p4) (4 * (lam + μ + 2) + 3) + refine ⟨κ, lam + μ + 2, ρ, θ, ?_, ?_⟩ + · dsimp [θ]; omega + intro α β G θ_star θ_span T_star H η T d hT hθ hLevel + have hθ₁ : θ₁ ≤ θ_span := (le_max_left _ _).trans ((le_max_left _ _).trans hθ) + have hp4 : p4 ≤ θ_star := + ((le_max_right θ₁ p4).trans ((le_max_left _ _).trans hθ)).trans + hLevel.isSpan.isControlling.theta_le + have hFlat : IsFlatSpan G H η θ_star θ_span lam μ T_star T := + GM15.theorem_8_3_proof G H η θ_star θ_span lam μ T_star T d + (by have := (le_max_right (max θ₁ p4) (4 * (lam + μ + 2) + 3)).trans hθ; omega) + hLevel + rcases hMain G θ_star T_star H η θ_span T d hFlat hLevel.hasMetric hθ₁ with + ⟨H', η', θ', T', d', hSpan', hMetric', hφ₂, hEyes⟩ | + ⟨S', hTS', hT2S', hCross, H', η', θ', T', hφ₂, hSpan'⟩ | + ⟨𝒮, disc, pt, hCentral, hType, hProper⟩ + · right; right + have hMinor : ControlsCliqueMinor G p4 T_star := + hClique G θ_star T_star H' η' θ' T' d' hSpan' hMetric' hp4 + ((le_max_right φ φ₁).trans hφ₂) (hEyes.mono (Nat.le_succ κ)) + have hβ : Nonempty β := by + obtain ⟨X, _, _, hlink, _⟩ := hMinor + obtain ⟨e, _⟩ := hlink ⟨0, by dsimp [p4]; omega⟩ ⟨1, by dsimp [p4]; omega⟩ + (Fin.mk_lt_mk.mpr Nat.zero_lt_one) + exact ⟨e⟩ + exact controlsMinor_of_controlsCliqueMinor (Or.inr hβ) (hMinor.mono (le_max_left p 4)) + · left + have hClosed' : IsClosedSurface S' := + ⟨hSpan'.isSurface.1, hSpan'.isSurface.2.1, fun x => by + by_contra hx + exact Set.eq_empty_iff_forall_notMem.mp hSpan'.bd_empty x hx⟩ + exact ⟨S', hTS', hT2S', H', η', θ', T', hClosed', hSpan'.isConnected, + hCross, (le_max_left φ φ₁).trans hφ₂, hSpan'⟩ + · right; left + exact ⟨𝒮, disc, pt, hCentral, isSegregationOfType_of_gm15 hType, hProper⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section8.lean b/LeanPool/GraphMinor/GM16/Section8.lean new file mode 100644 index 0000000000..038fe042a7 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section8.lean @@ -0,0 +1,520 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +import LeanPool.GraphMinor.GM12.Section79 + +public import LeanPool.GraphMinor.GM16.Section7 +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Graph Minors XVI, Section 8: Non-Level `Σ`-Spans + +This file formalizes Section 8 ("Non-level $\Sigma$-spans", pages 64–70) of +N. Robertson and P. D. Seymour, *Graph Minors. XVI. Excluding a non-planar graph*, J. Combin. +Theory Ser. B 89 (2003) 43–76: + +- Truncation of a respectful tangle in a drawing (`IsRespectfulDrawingTangle.truncation`). +- Restriction of a `SpanEmbedding H G` to `G \ Z` when `Z` is disjoint from `V(η(H))` + (`restrictDeleteVertices`). +- Statement of **Graph Minors XVI, (8.1)** (`GM16Theorem81Statement`, page 64). +- Statement and complete proof of **Graph Minors XVI, (8.2)** (`GM16Theorem82Statement`, + `theorem_8_2`, pages 64–65): if `Z ⊆ V(G) \ V(η(H))` with `|Z| < ord(T)` and + `1 ≤ θ' ≤ ord(T) - |Z|`, the truncation `T'` of `T` to order `θ'` is a `Σ`-span in `G \ Z` + with respect to `T* \ Z`. +- Statement of **Graph Minors XVI, (8.3)** (`GM16Theorem83Statement`, page 65), together with + Claims (1) and (2) of the proof of `(7.1)` (`theorem_7_1_claim_1`, `theorem_7_1_claim_2`, + page 69). +-/ + +@[expose] public section + +namespace GraphMinor.GM16 + +open Set Function Topology +open Graph SimpleGraph Hypergraph +open GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 GraphMinor.GM15 + +universe u v w + +variable {S : Type w} [TopologicalSpace S] [T2Space S] {α : Type u} {β : Type v} + +/-! ## Truncation of Respectful Drawing Tangles and Span Embeddings -/ + +omit [T2Space S] in +/-- The truncation `GM10.truncation T θ'` of a respectful tangle `T` of order `θ` in `H` to order +`θ'` (`1 ≤ θ' ≤ θ`) is a respectful tangle of order `θ'` in `H` (Graph Minors XVI, Section 8, +page 64). -/ +theorem IsRespectfulDrawingTangle.truncation {H : Drawing S} {θ θ' : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hResp : IsRespectfulDrawingTangle H θ T) (h1 : 1 ≤ θ') (hle : θ' ≤ θ) : + IsRespectfulDrawingTangle H θ' (GM10.truncation T θ') := by + exact GM12.IsRespectfulDrawingTangle.truncation hResp h1 hle + +/-- If `K ≤ G` and `Disjoint V(K) Z`, then `K ≤ GM09.deleteVertices G Z`. -/ +theorem le_deleteVertices_of_disjoint {G K : Graph α β} {Z : Set α} + (hle : K ≤ G) (hdisj : Disjoint V(K) Z) : + K ≤ GM09.deleteVertices G Z := by + refine ⟨fun v hv => ⟨hle.vertexSet_mono hv, hdisj.notMem_of_mem_left hv⟩, + fun {e x y} hlink => ?_⟩ + have hxK : x ∈ V(K) := K.left_mem_of_isLink hlink + have hyK : y ∈ V(K) := K.left_mem_of_isLink hlink.symm + exact ⟨(hle.isLink_iff hlink.edge_mem).mp hlink, + ⟨hle.vertexSet_mono hxK, hdisj.notMem_of_mem_left hxK⟩, + ⟨hle.vertexSet_mono hyK, hdisj.notMem_of_mem_left hyK⟩⟩ + +/-- Restrict a `SpanEmbedding H G` to `GM09.deleteVertices G Z` when `Z` is disjoint from +`V(η.imageGraph)`. -/ +def restrictDeleteVertices {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) (Z : Set α) (hdisj : Disjoint V(η.imageGraph) Z) : + SpanEmbedding H (GM09.deleteVertices G Z) where + imageGraph := η.imageGraph + vMap := η.vMap + eMap := η.eMap + imageGraph_le := le_deleteVertices_of_disjoint η.imageGraph_le hdisj + bijOn_v := η.bijOn_v + bijOn_e := η.bijOn_e + inc_iff := η.inc_iff + +/-! ## Statements of (8.1), (8.2), and (8.3), and Proof of (8.2) (pages 64–65) -/ + +/-- Statement of Graph Minors XVI, (8.1) (page 64): +"Let $\Sigma$ be a surface and let $\delta \ge 0$ and $\phi, \psi \ge 3$. Then there exists +$\gamma \ge 0$ and $\theta > (4\gamma + 2)\delta$ such that if $\mathcal{T}^*$ is a tangle in a +graph $G$ and $H, \mathcal{T}$ is a $\Sigma$-span of order $\ge \theta$, and $Y \subseteq V(H)$ +satisfies $|Y| = \delta$ and $d(y, y') \ge \theta$ for all distinct $y, y' \in Y$ (where $d$ is the +metric of $\mathcal{T}$), then either: +1. there is a $\Sigma'$-span of order $\ge \phi$ for some surface $\Sigma'$ obtained from $\Sigma$ + by adding a handle, or +2. there is an $H$-path in $G$ with ends $s, t$, such that $d(s, t) \ge \psi$ and + $d(s, y) \ge \psi$ for all $y \in Y$, or +3. there is a $\gamma$-envelope $(\Lambda_y\colon y \in Y)$ around $Y$, and there exists + $Z \subseteq V(G) \setminus V(H')$ with $|Z| \le \frac{1}{2}\delta^2\phi^2$, such that $Z$ meets + every $H'$-path in $G$ with ends $s, t$, satisfying $d'(s, t) \ge 2\psi$, where + $H' = H \cap (\Sigma \setminus \cup (\Lambda_y\colon y \in Y))$ and $d'$ is the metric of the + $(4\gamma + 2)\delta$-compression of $\mathcal{T}$ in $H'$." -/ +def GM16Theorem81Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ δ φ ψ : ℕ, 3 ≤ φ → 3 ≤ ψ → + ∃ γ θ : ℕ, (4 * γ + 2) * δ < θ ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star θ_span : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (Y : Set S), + θ ≤ θ_span → + IsSigmaSpan G H η θ_star θ_span T_star T → + HasTangleMetric H θ_span T d → + Y ⊆ H.V → Y.ncard = δ → + (∀ y₁ ∈ Y, ∀ y₂ ∈ Y, y₁ ≠ y₂ → θ ≤ d {y₁} {y₂}) → + (∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S') + (H' : Drawing S') (η' : SpanEmbedding H' G) (θ_span' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsObtainedByAddingHandle S S' ∧ + φ ≤ θ_span' ∧ IsSigmaSpan G H' η' θ_star θ_span' T_star T') ∨ + (∃ (P : Graph α β) (s t : S), + s ∈ H.V ∧ t ∈ H.V ∧ + IsHPathWithEnds G η.imageGraph P (η.vMap s) (η.vMap t) ∧ + ψ ≤ d {s} {t} ∧ ∀ y ∈ Y, ψ ≤ d {s} {y}) ∨ + (∃ (Λ : S → Set S) (Z : Set α) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ), + IsEnvelope H d Y γ Λ ∧ + Z ⊆ V(G) \ V((restrictCleared η (⋃ y ∈ Y, Λ y)).imageGraph) ∧ + Z.ncard ≤ (δ ^ 2 * φ ^ 2) / 2 ∧ + IsSigmaSpan G (clearEnvelopeDrawing H Y Λ) + (restrictCleared η (⋃ y ∈ Y, Λ y)) θ_star (θ_span - (4 * γ + 2) * δ) T_star T' ∧ + IsLambdaCompression H (clearEnvelopeDrawing H Y Λ) + θ_span ((4 * γ + 2) * δ) T T' d d' ∧ + ∀ (P : Graph α β) (s t : S), + s ∈ (clearEnvelopeDrawing H Y Λ).V → + t ∈ (clearEnvelopeDrawing H Y Λ).V → + IsHPathWithEnds G (restrictCleared η (⋃ y ∈ Y, Λ y)).imageGraph P + (η.vMap s) (η.vMap t) → + 2 * ψ ≤ d' {s} {t} → + (Z ∩ V(P)).Nonempty) + +/-- Statement of Graph Minors XVI, (8.2) (page 64): +"Let $\mathcal{T}^*$ be a tangle in a graph $G$, and let $H, \mathcal{T}$ be a $\Sigma$-span. Let +$Z \subseteq V(G) \setminus V(H)$ with $|Z| < ord(\mathcal{T})$, let +$1 \le \theta' \le ord(\mathcal{T}) - |Z|$, and let $\mathcal{T}'$ be the truncation of +$\mathcal{T}$ to order $\theta'$. Then $H, \mathcal{T}'$ is a $\Sigma$-span in $G \setminus Z$ with +respect to $\mathcal{T}^* \setminus Z$." -/ +def GM16Theorem82Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S] + {α : Type u} {β : Type v} (G : Graph α β) (θ_star θ θ' : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (Z : Set α) + (hSpan : IsSigmaSpan G H η θ_star θ T_star T) + (_ : Z ⊆ V(G)) (hZ_disj : Disjoint V(η.imageGraph) Z) + (_ : Z.ncard < θ) (_ : 1 ≤ θ') (_ : θ' ≤ θ - Z.ncard), + IsSigmaSpan (GM09.deleteVertices G Z) H (restrictDeleteVertices η Z hZ_disj) + (θ_star - Z.ncard) θ' + (deleteGraphVerticesTangle G hSpan.isControlling.isTangle_star.finite_V + hSpan.isControlling.isTangle_star.finite_E Z T_star θ_star) + (GM10.truncation T θ') + +/-- **Graph Minors XVI, (8.2)** (pages 64–65): +If `H, η, T` is a `Σ`-span of order `θ` in `G` with respect to `T*`, `Z ⊆ V(G) \ V(η(H))` has +`|Z| < θ`, and `1 ≤ θ' ≤ θ - |Z|`, then the truncation `GM10.truncation T θ'` is a `Σ`-span in +`G \ Z` with respect to `T* \ Z`. -/ +theorem theorem_8_2_proof : GM16Theorem82Statement.{u, v, w} := by + intro S _ _ α β G θ_star θ θ' T_star H η T Z hSpan hZ_sub hZ_disj hZ_lt hθ'_pos hθ'_le + let hT_star := hSpan.isControlling.isTangle_star + have hθ_le : θ ≤ θ_star := hSpan.isControlling.theta_le + have hZ_lt_star : Z.ncard < θ_star := lt_of_lt_of_le hZ_lt hθ_le + have hT_del : IsGraphTangle (GM09.deleteVertices G Z) (θ_star - Z.ncard) + (deleteGraphVerticesTangle G hT_star.finite_V hT_star.finite_E Z T_star θ_star) := + isGraphTangle_deleteGraphVerticesTangle hT_star hZ_sub hZ_lt_star + have hResp' : IsRespectfulDrawingTangle H θ' (GM10.truncation T θ') := + IsRespectfulDrawingTangle.truncation hSpan.isRespectful hθ'_pos (hθ'_le.trans + (Nat.sub_le θ Z.ncard)) + refine ⟨hSpan.isSurface, hSpan.isConnected, hSpan.bd_empty, hSpan.isRigid, hResp', + ⟨by omega, hT_del, hResp'.2.1, ?_⟩⟩ + intro A B hsep hord A_H B_H hRestr + -- Any restricted separation `(A_H, B_H)` of `(A, B)` has order `≤ separationOrder A B < θ'`. + have hord_H : separationOrder A_H B_H < θ' := by + have hinj : InjOn η.vMap (A_H ∩ B_H).vertexSet := + η.bijOn_v.injOn.mono + (inter_subset_left.trans hRestr.1.left_le.vertexSet_subset) + have hsub_img : η.vMap '' (A_H ∩ B_H).vertexSet ⊆ (A ∩ B).vertexSet := by + rintro v ⟨u, ⟨huA, huB⟩, rfl⟩ + have huA' : η.vMap u ∈ (restrictDeleteVertices η Z hZ_disj).vMap '' A_H.vertexSet := + ⟨u, huA, rfl⟩ + have huB' : η.vMap u ∈ (restrictDeleteVertices η Z hZ_disj).vMap '' B_H.vertexSet := + ⟨u, huB, rfl⟩ + rw [hRestr.2.1] at huA' + rw [hRestr.2.2.2.1] at huB' + exact ⟨huA'.1, huB'.1⟩ + have hcard_eq : (η.vMap '' (A_H ∩ B_H).vertexSet).ncard = separationOrder A_H B_H := + hinj.ncard_image + have hcard_le : (η.vMap '' (A_H ∩ B_H).vertexSet).ncard ≤ separationOrder A B := + ncard_le_ncard hsub_img (A ∩ B).vertexSet_finite + omega + -- Forward direction on any `(X, Y) ∈ T* \ Z` of order `< θ'`: + have hfwd : ∀ {X Y : Hypergraph α β} {X_H Y_H : Hypergraph S (Set S)}, + separationOrder X Y < θ' → + IsRestrictedSeparation H (GM09.deleteVertices G Z) (restrictDeleteVertices η Z hZ_disj) + X Y X_H Y_H → + (X, Y) ∈ deleteGraphVerticesTangle G hT_star.finite_V hT_star.finite_E Z T_star θ_star → + (X_H, Y_H) ∈ T := by + intro X Y X_H Y_H hordXY hRestrXY hmem_del + rcases hmem_del.2.2 with ⟨⟨A_star, B_star⟩, hm, hZ_AB, hA_eq, hB_eq⟩ + dsimp only at hm hZ_AB hA_eq hB_eq + have hsep_star : (Hypergraph.ofGraph G hT_star.finite_V hT_star.finite_E).IsSeparation + A_star B_star := hT_star.isTangle.isSeparation hm + have hAB_union : (A_star ∩ B_star).vertexSet = (X ∩ Y).vertexSet ∪ Z := by + ext v + simp only [inter_vertexSet, mem_inter_iff, mem_union] + constructor + · intro ⟨hvA, hvB⟩ + by_cases hvZ : v ∈ Z + · exact Or.inr hvZ + · left + have hvX : v ∈ (A_star.deleteVertices Z).vertexSet := ⟨hvA, hvZ⟩ + have hvY : v ∈ (B_star.deleteVertices Z).vertexSet := ⟨hvB, hvZ⟩ + rw [hA_eq] at hvX + rw [hB_eq] at hvY + exact ⟨hvX, hvY⟩ + · rintro (⟨hvX, hvY⟩ | hvZ) + · rw [← hA_eq] at hvX + rw [← hB_eq] at hvY + exact ⟨hvX.1, hvY.1⟩ + · exact hZ_AB hvZ + have hZ_fin : Z.Finite := hT_star.finite_V.subset hZ_sub + have hord_star : separationOrder A_star B_star < θ := by + have hle_sum : separationOrder A_star B_star ≤ separationOrder X Y + Z.ncard := by + change (A_star ∩ B_star).vertexSet.ncard ≤ _ + rw [hAB_union] + exact ncard_union_le (X ∩ Y).vertexSet Z + omega + have hRestr_star : IsRestrictedSeparation H G η A_star B_star X_H Y_H := by + rcases hRestrXY with ⟨hsepH, hVX, hEX, hVY, hEY⟩ + change η.vMap '' X_H.vertexSet = X.vertexSet ∩ V(η.imageGraph) at hVX + change η.eMap '' X_H.edgeSet = X.edgeSet ∩ E(η.imageGraph) at hEX + change η.vMap '' Y_H.vertexSet = Y.vertexSet ∩ V(η.imageGraph) at hVY + change η.eMap '' Y_H.edgeSet = Y.edgeSet ∩ E(η.imageGraph) at hEY + refine ⟨hsepH, ?_, ?_, ?_, ?_⟩ + · rw [hVX, ← hA_eq] + ext v + simp only [Hypergraph.deleteVertices, mem_inter_iff, mem_sdiff] + exact ⟨fun ⟨⟨hvA, _⟩, hvI⟩ => ⟨hvA, hvI⟩, + fun ⟨hvA, hvI⟩ => ⟨⟨hvA, hZ_disj.notMem_of_mem_left hvI⟩, hvI⟩⟩ + · rw [hEX, ← hA_eq] + ext e + simp only [Hypergraph.deleteVertices, mem_inter_iff, mem_ofPred_eq] + refine ⟨fun ⟨⟨heA, _⟩, heI⟩ => ⟨heA, heI⟩, + fun ⟨heA, heI⟩ => ⟨⟨heA, fun v hvZ hincA => ?_⟩, heI⟩⟩ + have hincG : (Hypergraph.ofGraph G hT_star.finite_V hT_star.finite_E).Inc e v := + (inc_iff_of_le hsep_star.left_le heA).mp hincA + obtain ⟨w, hlinkG⟩ := hincG + have heI_save := heI + rw [η.imageGraph.edge_mem_iff_exists_isLink] at heI + obtain ⟨x, y, hlinkI⟩ := heI + have hlinkG' : G.IsLink e x y := (η.imageGraph_le.isLink_iff heI_save).mp hlinkI + rcases G.eq_or_eq_of_isLink_of_isLink hlinkG hlinkG' with rfl | rfl + · exact hZ_disj.notMem_of_mem_left (η.imageGraph.left_mem_of_isLink hlinkI) hvZ + · exact hZ_disj.notMem_of_mem_left (η.imageGraph.left_mem_of_isLink hlinkI.symm) hvZ + · rw [hVY, ← hB_eq] + ext v + simp only [Hypergraph.deleteVertices, mem_inter_iff, mem_sdiff] + exact ⟨fun ⟨⟨hvB, _⟩, hvI⟩ => ⟨hvB, hvI⟩, + fun ⟨hvB, hvI⟩ => ⟨⟨hvB, hZ_disj.notMem_of_mem_left hvI⟩, hvI⟩⟩ + · rw [hEY, ← hB_eq] + ext e + simp only [Hypergraph.deleteVertices, mem_inter_iff, mem_ofPred_eq] + refine ⟨fun ⟨⟨heB, _⟩, heI⟩ => ⟨heB, heI⟩, + fun ⟨heB, heI⟩ => ⟨⟨heB, fun v hvZ hincB => ?_⟩, heI⟩⟩ + have hincG : (Hypergraph.ofGraph G hT_star.finite_V hT_star.finite_E).Inc e v := + (inc_iff_of_le hsep_star.right_le heB).mp hincB + obtain ⟨w, hlinkG⟩ := hincG + have heI_save := heI + rw [η.imageGraph.edge_mem_iff_exists_isLink] at heI + obtain ⟨x, y, hlinkI⟩ := heI + have hlinkG' : G.IsLink e x y := (η.imageGraph_le.isLink_iff heI_save).mp hlinkI + rcases G.eq_or_eq_of_isLink_of_isLink hlinkG hlinkG' with rfl | rfl + · exact hZ_disj.notMem_of_mem_left (η.imageGraph.left_mem_of_isLink hlinkI) hvZ + · exact hZ_disj.notMem_of_mem_left (η.imageGraph.left_mem_of_isLink hlinkI.symm) hvZ + exact (hSpan.isControlling.controls hsep_star hord_star hRestr_star).mp hm + constructor + · intro hAB + exact ⟨hfwd hord hRestr hAB, hord_H⟩ + · rintro ⟨hAB_H, _⟩ + by_contra hnot_AB + have hord_lt_del : separationOrder A B < θ_star - Z.ncard := by omega + have hBA : (B, A) ∈ + deleteGraphVerticesTangle G hT_star.finite_V hT_star.finite_E Z T_star θ_star := + (hT_del.isTangle.axiom1 hsep hord_lt_del).resolve_left hnot_AB + have hord_BA : separationOrder B A < θ' := by + rwa [separationOrder_comm] + have hRestr_BA : IsRestrictedSeparation H (GM09.deleteVertices G Z) + (restrictDeleteVertices η Z hZ_disj) B A B_H A_H := + ⟨hRestr.1.symm, hRestr.2.2.2.1, hRestr.2.2.2.2, hRestr.2.1, hRestr.2.2.1⟩ + have hBA_H : (B_H, A_H) ∈ T := hfwd hord_BA hRestr_BA hBA + exact GM10.theorem_2_1_proof hSpan.isControlling.isTangle_H hAB_H hBA_H + +/-- Statement of Graph Minors XVI, (8.3) (page 65): +"Let $\Sigma$ be a surface, and let $\tau, \chi, \delta, \lambda, \zeta \ge 0$ and $\psi \ge 3$. +Then there exists $\theta > \zeta$ such that if $\mathcal{T}^*$ is a tangle in a graph $G$, and +$(H, \mathcal{T}, X, Y)$ is an animal with $\chi$ horns and $\delta$ hairs, of strength +$\ge (\theta, \zeta + \tau)$, and $Z \subseteq V(G) \setminus V(H)$ with $X \subseteq Z$ and +$|Z| \le \zeta$, then either: +- there is an animal with $\chi$ horns and $\delta + 1$ hairs of strength $\ge (\psi, \tau)$, or +- there is an $H$-path in $G \setminus Z$ with ends $s_1, s_2$ and there are distinct + $y_1, y_2 \in Y$ with $d(s_1, y_1), d(s_2, y_2) < \psi$, where $d$ is the metric of + $\mathcal{T}$, or +- $H, \mathcal{T}_0$ is a $(\lambda, 2\psi)$-level $\Sigma$-span of order $\theta - |Z|$ in + $G \setminus Z$ with respect to $\mathcal{T}^* \setminus Z$, where $\mathcal{T}_0$ is the + truncation of $\mathcal{T}$ to order $\theta - |Z|$." -/ +def GM16Theorem83Statement : Prop := + ∀ {S : Type w} [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ τ χ δ lam ζ ψ : ℕ, 3 ≤ ψ → + ∃ θ : ℕ, ζ < θ ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star θ_span : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (X : Set α) (Y : Set S) (Z : Set α) + (hAnim : IsAnimal G T_star θ_star H η θ_span T d X Y χ δ θ (ζ + τ)) + (_ : Z ⊆ V(G)) (hZ_disj : Disjoint V(η.imageGraph) Z) + (_ : X ⊆ Z) (_ : Z.ncard ≤ ζ), + HasAnimal S G T_star θ_star χ (δ + 1) ψ τ ∨ + (∃ (P : Graph α β) (s₁ s₂ y₁ y₂ : S), + s₁ ∈ H.V ∧ s₂ ∈ H.V ∧ y₁ ∈ Y ∧ y₂ ∈ Y ∧ y₁ ≠ y₂ ∧ + IsHPathWithEnds (GM09.deleteVertices G Z) η.imageGraph P + (η.vMap s₁) (η.vMap s₂) ∧ + d {s₁} {y₁} < ψ ∧ d {s₂} {y₂} < ψ) ∨ + (∃ d₀ : Set S → Set S → ℕ, + IsLevelSpan (GM09.deleteVertices G Z) H (restrictDeleteVertices η Z hZ_disj) + (θ_star - Z.ncard) (θ - Z.ncard) lam (2 * ψ) + (deleteGraphVerticesTangle G hAnim.2.2.1.isControlling.isTangle_star.finite_V + hAnim.2.2.1.isControlling.isTangle_star.finite_E Z T_star θ_star) + (GM10.truncation T (θ - Z.ncard)) d₀) + +/-! ## Hairs away from a rearrangement -/ + +omit [T2Space S] in +/-- Graph Minors XVI, proof of (8.3), Claim (10), page 67, cardinality part. +At most one hair can be close to the centre of the rearrangement: otherwise the triangle +inequality contradicts the distance between distinct hairs. -/ +theorem theorem_8_3_claim_10_card + {H : Drawing S} {d : Set S → Set S → ℕ} {Y : Set S} {z : Set S} + {θ r : ℕ} (hY : Y ⊆ H.V) (hz : z ∈ H.A) (hr : 2 * r ≤ θ) + (hsep : ∀ y₁ ∈ Y, ∀ y₂ ∈ Y, y₁ ≠ y₂ → θ ≤ d {y₁} {y₂}) + (hsymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, + d a c ≤ d a b + d b c) : + Y.ncard - 1 ≤ {y ∈ Y | r ≤ d z {y}}.ncard := by + let far : Set S := {y ∈ Y | r ≤ d z {y}} + have hfin : Y.Finite := H.toHypergraph.vertexSet_finite.subset hY + have hsub : far ⊆ Y := fun _ h => h.1 + have hsmall : (Y \ far).ncard ≤ 1 := by + apply (Set.ncard_le_one (hfin.sdiff)).2 + intro a ha b hb + by_contra hne + have haA := singleton_mem_A_of_mem_V (hY ha.1) + have hbA := singleton_mem_A_of_mem_V (hY hb.1) + have ha_near : d z {a} < r := by + by_contra hn + exact ha.2 ⟨ha.1, Nat.le_of_not_gt hn⟩ + have hb_near : d z {b} < r := by + by_contra hn + exact hb.2 ⟨hb.1, Nat.le_of_not_gt hn⟩ + have hab := htri {a} haA z hz {b} hbA + rw [hsymm {a} haA z hz] at hab + have hdist := hsep a ha.1 b hb.1 hne + omega + have hcount := Set.ncard_sdiff' hsub hfin + change Y.ncard - 1 ≤ far.ncard + omega + +/-! ## Subproofs in the Proof of (7.1) (page 69) -/ + +omit [T2Space S] in +/-- **Graph Minors XVI, Proof of (7.1), Claim (1)** (page 69): +"(1) *If there is a $\Sigma'$-span of order $\ge \phi$ in $G \setminus X$, for some surface +$\Sigma'$ obtained from $\Sigma$ by adding a handle, then 7.1.1 holds.*" -/ +theorem theorem_7_1_claim_1 + {G : Graph α β} {θ_star φ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + (hT : IsGraphTangle G θ_star T_star) + {X : Set α} (hX_sub : X ⊆ V(G)) (hX_lt : X.ncard < θ_star) + (hSpan_del : ∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S') + (H' : Drawing S') (η' : SpanEmbedding H' (GM09.deleteVertices G X)) (θ_span' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsObtainedByAddingHandle S S' ∧ + φ ≤ θ_span' ∧ + IsSigmaSpan (GM09.deleteVertices G X) H' η' (θ_star - X.ncard) θ_span' + (deleteGraphVerticesTangle G hT.finite_V hT.finite_E X T_star θ_star) T') : + ∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S') + (H' : Drawing S') (η' : SpanEmbedding H' G) (θ_span' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsObtainedByAddingHandle S S' ∧ + φ ≤ θ_span' ∧ IsSigmaSpan G H' η' θ_star θ_span' T_star T' := by + rcases hSpan_del with ⟨S', tS', hT2', H', η', θ_span', T', hHandle, hφ, hSpan'⟩ + exact ⟨S', tS', hT2', H', liftSpanEmbedding η' (G.induce_le sdiff_subset), θ_span', T', + hHandle, hφ, theorem_7_4_proof G θ_star θ_span' T_star hT X H' η' T' hX_sub hX_lt hSpan'⟩ + +/-- **Graph Minors XVI, Proof of (7.1), Claim (2)** (page 69): +"(2) *If there is an $H$-path in $G \setminus X$ with ends $s, t$ such that $d'(s, t) \ge \psi$ +and $d'(s, y) \ge \psi$ for all $y \in Y$, then 7.1.2 holds.* +*Subproof.* Then $d(s, t) \ge d'(s, t)$, and $d(s, y) \ge d'(s, y)$ for all $y \in Y$, and so +$(H, \mathscr{T}, X, Y \cup \{s\})$ is an animal (in $G$, with respect to $\mathscr{T}^*$) with +$\chi$ horns and $\delta + 1$ hairs, of strength $\ge (\psi, \sigma) \ge (\psi, \tau)$." -/ +theorem theorem_7_1_claim_2 + {G : Graph α β} {θ_star θ_span θ ψ τ σ χ δ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {H : Drawing S} {η : SpanEmbedding H G} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {X : Set α} {Y : Set S} + (hAnim : IsAnimal G T_star θ_star H η θ_span T d X Y χ δ θ σ) + (hψ_pos : 1 ≤ ψ) (hψ_le : ψ ≤ θ) (hτ_le : τ ≤ σ) + (hd_le : ∀ a ∈ H.A, ∀ b ∈ H.A, d' a b ≤ d a b) + (hd_symm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (hd_self : ∀ a ∈ H.A, d a a = 0) + {P : Graph α β} {s t : S} + (hs : s ∈ H.V) (ht : t ∈ H.V) + (hst_ne : s ≠ t) + (hP : IsHPathWithEnds G η.imageGraph P (η.vMap s) (η.vMap t)) + (hP_disj : Disjoint X V(P)) + (hst : ψ ≤ d' {s} {t}) + (hsy : ∀ y ∈ Y, ψ ≤ d' {s} {y}) : + HasAnimal S G T_star θ_star χ (δ + 1) ψ τ := by + rcases hAnim with + ⟨_, hθ_span, hSpan, hMet, hX_sub, hX_card, hY_sub, hY_card, hHorns, hHairs, hY_dist⟩ + have hs_A : ({s} : Set S) ∈ H.A := singleton_mem_A_of_mem_V hs + have ht_A : ({t} : Set S) ∈ H.A := singleton_mem_A_of_mem_V ht + have hs_not_Y : s ∉ Y := by + intro hsY + have h1 : ψ ≤ d {s} {s} := (hsy s hsY).trans (hd_le {s} hs_A {s} hs_A) + rw [hd_self {s} hs_A] at h1 + omega + have hY_fin : Y.Finite := H.toHypergraph.vertexSet_finite.subset hY_sub + have hYs_card : (insert s Y).ncard = δ + 1 := by + rw [ncard_insert_of_notMem hs_not_Y hY_fin, hY_card] + refine ⟨H, η, θ_span, T, d, X, insert s Y, + hψ_pos, hψ_le.trans hθ_span, hSpan, hMet, hX_sub, hX_card, + insert_subset hs hY_sub, hYs_card, ?_, ?_, ?_⟩ + · intro v hvX + obtain ⟨P_v, u_v, hHorn_v⟩ := hHorns v hvX + exact ⟨_, _, hHorn_v.mono hψ_le hτ_le⟩ + · intro y hy + rcases mem_insert_iff.mp hy with rfl | hyY + · exact ⟨t, P, ht, hst_ne, hP, hP_disj, hst.trans (hd_le {y} hs_A {t} ht_A)⟩ + · obtain ⟨v, Q, hv, hy_ne, hQ, hdisj, hdist⟩ := hHairs y hyY + exact ⟨v, Q, hv, hy_ne, hQ, hdisj, hψ_le.trans hdist⟩ + · intro y₁ hy₁ y₂ hy₂ hne + rcases mem_insert_iff.mp hy₁ with rfl | hy₁Y + · rcases mem_insert_iff.mp hy₂ with rfl | hy₂Y + · exact absurd rfl hne + · have hy₂_A : ({y₂} : Set S) ∈ H.A := singleton_mem_A_of_mem_V (hY_sub hy₂Y) + exact (hsy y₂ hy₂Y).trans (hd_le {y₁} hs_A {y₂} hy₂_A) + · rcases mem_insert_iff.mp hy₂ with rfl | hy₂Y + · have hy₁_A : ({y₁} : Set S) ∈ H.A := singleton_mem_A_of_mem_V (hY_sub hy₁Y) + rw [hd_symm {y₁} hy₁_A {y₂} hs_A] + exact (hsy y₁ hy₁Y).trans (hd_le {y₂} hs_A {y₁} hy₁_A) + · exact hψ_le.trans (hY_dist y₁ hy₁Y y₂ hy₂Y hne) + +/-- Graph Minors XVI, proof of (8.3), Claim (2), page 65. +A long path either supplies a new hair or has its ends near two distinct existing hairs. +The path is assumed disjoint from the horns, as follows in the paper from `X ⊆ Z`. -/ +theorem theorem_8_3_claim_2 + {G : Graph α β} {θ_star θ_span θ ψ τ σ χ δ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {H : Drawing S} {η : SpanEmbedding H G} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {X : Set α} {Y : Set S} + (hAnim : IsAnimal G T_star θ_star H η θ_span T d X Y χ δ θ σ) + (hψ : 1 ≤ ψ) (hψθ : ψ ≤ θ) (hτσ : τ ≤ σ) + (hsymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (hself : ∀ a ∈ H.A, d a a = 0) + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, + d a c ≤ d a b + d b c) + {P : Graph α β} {s t : S} (hs : s ∈ H.V) (ht : t ∈ H.V) + (hP : IsHPathWithEnds G η.imageGraph P (η.vMap s) (η.vMap t)) + (hdisj : Disjoint X V(P)) (hdist : 2 * ψ ≤ d {s} {t}) : + HasAnimal S G T_star θ_star χ (δ + 1) ψ τ ∨ + ∃ y₁ ∈ Y, ∃ y₂ ∈ Y, y₁ ≠ y₂ ∧ d {s} {y₁} < ψ ∧ d {t} {y₂} < ψ := by + classical + have hsA := singleton_mem_A_of_mem_V hs + have htA := singleton_mem_A_of_mem_V ht + have hst : s ≠ t := fun h => hP.2.2.1 (congrArg η.vMap h) + by_cases hfar : ∀ y ∈ Y, ψ ≤ d {s} {y} + · exact Or.inl (theorem_7_1_claim_2 hAnim hψ hψθ hτσ + (fun _ _ _ _ => le_rfl) hsymm hself hs ht hst hP hdisj + (by omega) hfar) + push Not at hfar + obtain ⟨y₁, hy₁, hnear₁⟩ := hfar + by_cases hfar : ∀ y ∈ Y, ψ ≤ d {t} {y} + · have hrev : IsHPathWithEnds G η.imageGraph P (η.vMap t) (η.vMap s) := by + rcases hP with ⟨hle, hp, hne, ha, hb, hv, he⟩ + refine ⟨hle, GM09.IsGraphPathWithEnds.symm hp, hne.symm, hb, ha, ?_, he⟩ + rw [hv, Set.pair_comm] + have hdist' : ψ ≤ d {t} {s} := by + rw [hsymm {t} htA {s} hsA] + omega + exact Or.inl (theorem_7_1_claim_2 hAnim hψ hψθ hτσ + (fun _ _ _ _ => le_rfl) hsymm hself ht hs hst.symm hrev hdisj hdist' hfar) + push Not at hfar + obtain ⟨y₂, hy₂, hnear₂⟩ := hfar + refine Or.inr ⟨y₁, hy₁, y₂, hy₂, ?_, hnear₁, hnear₂⟩ + intro heq + subst y₂ + have hyA := singleton_mem_A_of_mem_V (hAnim.2.2.2.2.2.2.1 hy₁) + have hbound := htri {s} hsA {y₁} hyA {t} htA + rw [hsymm {y₁} hyA {t} htA] at hbound + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section8Animal.lean b/LeanPool/GraphMinor/GM16/Section8Animal.lean new file mode 100644 index 0000000000..e87eaf6b37 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section8Animal.lean @@ -0,0 +1,153 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section8Hairs +public import LeanPool.GraphMinor.GM16.Section8HornSelection +import LeanPool.GraphMinor.GM16.MetricPoints +import LeanPool.GraphMinor.GM16.DrawingAtoms +import LeanPool.GraphMinor.GM09.Basic + +import LeanPool.GraphMinor.GM11.CitedResults + +/-! +# The animal after rearrangement + +Claims (6)–(12) of XVI (8.3) now assemble into an animal. The old horns keep +their selected paths. At most one old hair is lost and two new hairs come +from the new long path, so one can select exactly one more hair than before. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- The last step of the proof of Graph Minors XVI, (8.3), page 68: +Claims (6)–(12) give an animal with one more hair. -/ +theorem animal_of_rearrangement (hS : IsClosedSurface S) + {α : Type u} {β : Type v} {G : Graph α β} {H H' : Drawing S} + {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} {θ_star θ lam ψ ζ τ χ δ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z : Set S} {X : Set α} {Y : Set S} + (hAnim : IsAnimal G T_star θ_star H η θ T d X Y χ δ θ (ζ + τ)) + (h : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) + {Z : Set α} (hZfin : Z.Finite) (hXZ : X ⊆ Z) (hZcard : Z.ncard ≤ ζ) + (hnewZ : Disjoint V(η'.imageGraph) Z) + (hshort : ∀ (L : Graph α β) (s t : S), s ∈ H.V → t ∈ H.V → + IsHPathWithEnds G η.imageGraph L (η.vMap s) (η.vMap t) → + Disjoint V(L) Z → d {s} {t} < 2 * ψ) + {P : Graph α β} {s t : S} (hs : s ∈ H'.V) (ht : t ∈ H'.V) + (hP : IsHPathWithEnds G η'.imageGraph P (η'.vMap s) (η'.vMap t)) + (hPZ : Disjoint V(P) Z) (hst : 2 * ψ ≤ d' {s} {t}) + (hsnear : pointAtomDist H d s z ≤ lam) (htnear : pointAtomDist H d t z ≤ lam) + (hψ : 3 ≤ ψ) (hθ : ψ + (4 * lam + 2) ≤ θ) + (hHornRadius : 2 * (lam + 2 + 2 * ψ) ≤ θ) + (hHairRadius : 2 * (ψ + 5 * lam + 4) ≤ θ) : + HasAnimal S G T_star θ_star χ (δ + 1) ψ τ := by + classical + obtain ⟨hpos, _, hSpan, hMet, hX, hXcard, hY, hYcard, hHorns, hHairs, hYdist⟩ := hAnim + obtain ⟨_, hself, _, hsymm, htri, _⟩ := GraphMinor.GM11.gm15_theorem_9_1.{w} H θ T d hS + hSpan.isConnected hMet + obtain ⟨_, hself', _, hsymm', _, _⟩ := + GraphMinor.GM11.gm15_theorem_9_1.{w} H' (θ - (4 * lam + 2)) T' d' hS h.isSpan'.isConnected + h.isCompression.hasMetric' + have hprox := vertex_atom_dist_le_two hS hMet + let far : Set S := {y ∈ Y | ψ + 5 * lam + 4 ≤ d z {y}} + have hFarCount := theorem_8_3_claim_10 h hY hYcard hYdist hHairRadius (by omega) hsymm htri + have hfarNew : far ⊆ H'.V := fun _ hy => (hFarCount.2 _ hy).1 + have hfarOld : far ⊆ H.V := fun _ hy => hY hy.1 + have hfarFin : far.Finite := H.finite_V.subset hfarOld + have hsnot : s ∉ far := by + intro hsfar + have hsA := singleton_mem_A_of_mem_V (hfarOld hsfar) + rw [pointAtomDist_of_mem_vertex d (hfarOld hsfar) z, + hsymm {s} hsA z h.z_mem] at hsnear + have hdist := hsfar.2 + omega + have htnot : t ∉ far := by + intro htfar + have htA := singleton_mem_A_of_mem_V (hfarOld htfar) + rw [pointAtomDist_of_mem_vertex d (hfarOld htfar) z, + hsymm {t} htA z h.z_mem] at htnear + have hdist := htfar.2 + omega + have hstne : s ≠ t := fun heq => hP.2.2.1 (congrArg η'.vMap heq) + let hairs : Set S := far ∪ {s, t} + have hHairCount : δ + 1 ≤ hairs.ncard := by + have hEq : hairs = insert s (insert t far) := by ext x; simp [hairs] + rw [hEq, ncard_insert_of_notMem (by simpa using And.intro hstne hsnot) + (hfarFin.insert t), ncard_insert_of_notMem htnot hfarFin] + have hc : δ - 1 ≤ far.ncard := hFarCount.1 + omega + obtain ⟨chosen, hchosen, hchosenCard⟩ := exists_subset_card_eq hHairCount + have hHornsNew : ∀ v ∈ X, ∃ (P : Fin τ → Graph α β) (u : Fin τ → S), + IsHorn G H' η' d' v ψ τ P u := by + intro v hv + obtain ⟨Pv, ends, hHorn⟩ := hHorns v hv + obtain ⟨f, hf⟩ := theorem_8_3_claim_6 hHorn hZfin (hXZ hv) hZcard h.z_mem + hHornRadius hsymm htri + have hEnds := theorem_8_3_claim_8 h (fun i => hHorn.2.1 (f i)) + (fun i => by have hb := (hf i).1; omega) + (fun i j hij => hHorn.2.2.2.2.2 (f i) (f j) (fun heq => hij (f.injective heq))) hθ + have hinter : ∀ i, V(Pv (f i)) ∩ V(η'.imageGraph) = {η'.vMap (ends (f i))} := by + intro i + rw [(hEnds.1 i).2] + apply subset_antisymm + · exact theorem_8_3_claim_7 hS h hsymm htri hprox hself (by omega) hnewZ hshort + (hHorn.2.1 (f i)) (hXZ hv) (hHorn.2.2.1 (f i)) (hHorn.2.2.2.1 (f i)) + (hf i).2 (hf i).1 + · rintro a rfl + refine ⟨(hHorn.2.2.1 (f i)).right_mem, ?_⟩ + rw [← (hEnds.1 i).2] + exact η'.bijOn_v.mapsTo (hEnds.1 i).1 + refine ⟨_, _, theorem_8_3_claim_9 hHorn f ?_ hEnds.1 hinter hEnds.2⟩ + exact fun hvNew => hnewZ.notMem_of_mem_left hvNew (hXZ hv) + have hHairsNew : ∀ y ∈ hairs, ∃ (v : S) (Q : Graph α β), v ∈ H'.V ∧ y ≠ v ∧ + IsHPathWithEnds G η'.imageGraph Q (η'.vMap y) (η'.vMap v) ∧ + Disjoint X V(Q) ∧ ψ ≤ d' {y} {v} := by + intro y hy + rcases hy with hy | hy + · obtain ⟨x, Q, hx, _, hQ, hQX, hdist⟩ := hHairs y hy.1 + have hXold : Disjoint X V(η.imageGraph) := disjoint_left.mpr fun v hv hvOld => (hX hv).2 hvOld + exact theorem_8_3_claim_12 hS h hsymm htri hprox hself' + hXold (hY hy.1) hx hQ hQX hy.2 hψ hθ hdist + · have hPX : Disjoint X V(P) := disjoint_left.mpr fun v hv hvP => hPZ.notMem_of_mem_left hvP + (hXZ hv) + rcases hy with rfl | hy + · exact ⟨t, P, ht, hstne, hP, hPX, by omega⟩ + · rw [mem_singleton_iff] at hy + subst y + have hRev : IsHPathWithEnds G η'.imageGraph P (η'.vMap t) (η'.vMap s) := by + obtain ⟨hle, hp, hne, ha, hb, hv, he⟩ := hP + exact ⟨hle, hp.symm, hne.symm, hb, ha, by rw [hv, pair_comm], he⟩ + have hdist : ψ ≤ d' {t} {s} := by + rw [hsymm' {t} (singleton_mem_A_of_mem_V ht) {s} (singleton_mem_A_of_mem_V hs)] + omega + exact ⟨s, P, hs, hstne.symm, hRev, hPX, hdist⟩ + refine ⟨H', η', θ - (4 * lam + 2), T', d', X, chosen, by omega, by omega, + h.isSpan', h.isCompression.hasMetric', ?_, hXcard, ?_, hchosenCard, + hHornsNew, fun y hy => hHairsNew y (hchosen hy), ?_⟩ + · intro v hv + exact ⟨(hX hv).1, fun hvNew => hnewZ.notMem_of_mem_left hvNew (hXZ hv)⟩ + · intro y hy + rcases hchosen hy with hy | hy + · exact hfarNew hy + · rcases hy with rfl | hy + · exact hs + · exact mem_singleton_iff.mp hy ▸ ht + · have hsep := theorem_8_3_claim_11 h hfarOld hfarNew + (fun a ha b hb hne => hYdist a ha.1 b hb.1 hne) + (fun y hy => by have hb := hy.2; omega) hs ht hsnear htnear + (by omega) hθ hsymm hsymm' htri + exact fun a ha b hb hne => hsep a (hchosen ha) b (hchosen hb) hne + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section8Hairs.lean b/LeanPool/GraphMinor/GM16/Section8Hairs.lean new file mode 100644 index 0000000000..ffeb5bdef4 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section8Hairs.lean @@ -0,0 +1,147 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section8Paths +import LeanPool.GraphMinor.GM16.DrawingConnected +import LeanPool.GraphMinor.GM16.SpanPaths +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM16.MetricPoints + +/-! +# Keeping hairs after rearrangement + +This proves Claim (12) in XVI (8.3). Follow an old hair until it first meets +the new span again. If it never does, extend it through the old drawing until +it does. The two distance bounds proved in `Section8Paths` ensure that the +result is a long path of the new span. We use a two-unit larger cutoff for +retained hairs to cover the last-edge estimate. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- Graph Minors XVI, proof of (8.3), Claim (12), page 68. +A retained hair gives a long path of the rearranged span avoiding the horns. +The cutoff `ψ + 5λ + 4` is two larger than the paper's cutoff, to allow the +last-edge bound in `rearranged_exit_path_dist`. -/ +theorem theorem_8_3_claim_12 (hS : IsClosedSurface S) + {α : Type u} {β : Type v} {G : Graph α β} {H H' : Drawing S} + {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} {θ_star θ lam ψ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z : Set S} + (h : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) + (hsymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, + d a c ≤ d a b + d b c) + (hprox : ∀ x ∈ H.V, ∀ a ∈ H.A, x ∈ closure a → d {x} a ≤ 2) + (hself' : ∀ a ∈ H'.A, d' a a = 0) + {X : Set α} (hXold : Disjoint X V(η.imageGraph)) + {Q : Graph α β} {y x : S} (hy : y ∈ H.V) (hx : x ∈ H.V) + (hQ : IsHPathWithEnds G η.imageGraph Q (η.vMap y) (η.vMap x)) + (hQX : Disjoint X V(Q)) (hfar : ψ + 5 * lam + 4 ≤ d z {y}) + (hψ : 3 ≤ ψ) (hθ : ψ + (4 * lam + 2) ≤ θ) (hdist : θ ≤ d {y} {x}) : + ∃ (v : S) (P : Graph α β), v ∈ H'.V ∧ y ≠ v ∧ + IsHPathWithEnds G η'.imageGraph P (η'.vMap y) (η'.vMap v) ∧ + Disjoint X V(P) ∧ ψ ≤ d' {y} {v} := by + classical + have hkeep := h.vMap_eq y hy (by omega) + have hy' := hkeep.1 + have hynew : η.vMap y ∈ V(η'.imageGraph) := by + rw [← hkeep.2] + exact η'.bijOn_v.mapsTo hy' + by_cases hhit : ∃ w ∈ V(Q), w ∈ V(η'.imageGraph) ∧ w ≠ η.vMap y + · obtain ⟨w, hwQ, hwNew, hwne⟩ := hhit + obtain ⟨Q₀, hQ₀Q, _, hQ₀⟩ := hQ.2.1.exists_subpath hQ.2.1.left_mem hwQ + obtain ⟨w₀, hw₀, w₁, hw₁, P, hPQ₀, hP, _, hPnew⟩ := + hQ₀.exists_isFromToPathWithEnds (mem_singleton (η.vMap y)) + (show w ∈ V(η'.imageGraph) \ {η.vMap y} from ⟨hwNew, hwne⟩) + have hPQ : P ≤ Q := hPQ₀.trans hQ₀Q + rw [mem_singleton_iff] at hw₀ + subst w₀ + obtain ⟨v, hv, hmap⟩ := η'.bijOn_v.surjOn hw₁.1 + have hvQ : η'.vMap v ∈ V(Q) := by rw [hmap]; exact hPQ.vertexSet_mono hP.right_mem + have hvne : η'.vMap v ≠ η.vMap y := by simpa only [hmap, mem_singleton_iff] using hw₁.2 + have hd := rearranged_hair_hit_dist hS h hsymm htri hy hx hy' hv hQ hvQ hvne + (by omega) hθ hdist + have hPmap : IsGraphPathWithEnds G P (η'.vMap y) (η'.vMap v) := by + rw [hkeep.2, hmap] + exact hP + have hinter : V(P) ∩ V(η'.imageGraph) = {η'.vMap y, η'.vMap v} := by + rw [hkeep.2, hmap] + apply subset_antisymm + · rintro a ⟨haP, haNew⟩ + by_cases hay : a = η.vMap y + · exact mem_insert_iff.mpr (Or.inl hay) + · have haBoth : a ∈ V(P) ∩ (V(η'.imageGraph) \ {η.vMap y}) := ⟨haP, haNew, hay⟩ + rw [hPnew] at haBoth + exact mem_insert_of_mem _ haBoth + · rintro a (rfl | ha) + · exact ⟨hP.left_mem, hynew⟩ + · rw [mem_singleton_iff] at ha + subst a + exact ⟨hP.right_mem, hw₁.1⟩ + have hne : η'.vMap y ≠ η'.vMap v := by rw [hkeep.2]; exact hvne.symm + refine ⟨v, P, hv, fun heq => hne (congrArg η'.vMap heq), ?_, hQX.mono_right hPQ.vertexSet_mono, + hd⟩ + exact isHPath_of_far_ends hS η' h.isCompression.hasMetric' hy' hv hPmap hne hinter (hψ.trans hd) + · have hQnew : V(Q) ∩ V(η'.imageGraph) = {η.vMap y} := by + apply subset_antisymm + · rintro w ⟨hwQ, hwNew⟩ + apply mem_singleton_iff.mpr + by_contra hwne + exact hhit ⟨w, hwQ, hwNew, hwne⟩ + · rintro w rfl + exact ⟨hQ.2.1.left_mem, hynew⟩ + have hxnot : η.vMap x ∉ V(η'.imageGraph) := by + intro hxNew + have heq : η.vMap x = η.vMap y := + mem_singleton_iff.mp (hQnew ▸ ⟨hQ.2.1.right_mem, hxNew⟩) + exact hQ.2.2.1 heq.symm + obtain ⟨W⟩ := drawing_walk_of_twoCell hS h.isSpan.isRespectful.1 hx hy + obtain ⟨a, ha, b, hb, R, _, _, hR, _, hRnew⟩ := + exists_isFromToPathWithEnds_of_walk (mapSpanWalk η W) + (mem_singleton (η.vMap x)) hynew + rw [mem_singleton_iff] at ha + subst a + obtain ⟨v, hv, hmap⟩ := η'.bijOn_v.surjOn hb + have hRold : R ≤ η.imageGraph := hR.1 + have hRG : IsGraphPathWithEnds G R (η.vMap x) (η'.vMap v) := by + rw [hmap] + exact hR.mono η.imageGraph_le + have hRnew' : V(R) ∩ V(η'.imageGraph) = {η'.vMap v} := by rwa [hmap] + have hd := rearranged_exit_path_dist hS h hsymm htri + hprox hy hy' hv hRG hRold hRnew' hxnot hfar + have hne : y ≠ v := by + intro heq + subst v + rw [hself' {y} (singleton_mem_A_of_mem_V hy')] at hd + omega + have hmapne : η'.vMap y ≠ η'.vMap v := fun heq => hne (η'.bijOn_v.injOn hy' hv heq) + have hQmap : IsGraphPathWithEnds G Q (η'.vMap y) (η.vMap x) := by + rw [hkeep.2] + exact hQ.2.1 + obtain ⟨P, hPsub, hP⟩ := exists_hPath_of_two_paths η'.imageGraph_le hQmap hRG + (η'.bijOn_v.mapsTo hy') (η'.bijOn_v.mapsTo hv) hmapne (by rw [hkeep.2, hQnew]) + (by rw [hRnew']) + have hRX : Disjoint X V(R) := hXold.mono_right hRold.vertexSet_mono + have hPX : Disjoint X V(P) := by + apply disjoint_left.mpr + intro a haX haP + have haUnion := hPsub.vertexSet_mono haP + change a ∈ V(Q) ∪ V(R) at haUnion + exact haUnion.elim (fun haQ => hQX.notMem_of_mem_left haX haQ) + (fun haR => hRX.notMem_of_mem_left haX haR) + exact ⟨v, P, hv, hne, hP, hPX, hd⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section8HornSelection.lean b/LeanPool/GraphMinor/GM16/Section8HornSelection.lean new file mode 100644 index 0000000000..06fc0c6eb6 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section8HornSelection.lean @@ -0,0 +1,228 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section8 +import Mathlib.Data.Fintype.EquivFin +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM16.MetricPoints + +/-! +# Choosing horn paths in Graph Minors XVI + +In Claim (6) of the proof of (8.3), at most one horn end is near the +rearrangement centre. Each other excluded path uses a different vertex of the +deleted set apart from the horn vertex. These two bounds leave the required +number of paths. +-/ + +public section +namespace GraphMinor.GM16 +open Set Function Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- Graph Minors XVI, proof of (8.3), Claim (6), page 67. +From a horn with `ζ + τ` paths one can choose `τ` paths whose ends are far from +the centre and whose only deleted vertex is their common end. -/ +theorem theorem_8_3_claim_6 {α : Type u} {β : Type v} + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {d : Set S → Set S → ℕ} {v : α} {θ ζ τ r : ℕ} + {P : Fin (ζ + τ) → Graph α β} {ends : Fin (ζ + τ) → S} + (h : IsHorn G H η d v θ (ζ + τ) P ends) + {Z : Set α} (hZfin : Z.Finite) (hvZ : v ∈ Z) (hZcard : Z.ncard ≤ ζ) + {z : Set S} (hz : z ∈ H.A) (hr : 2 * r ≤ θ) + (hsymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, + d a c ≤ d a b + d b c) : + ∃ f : Fin τ ↪ Fin (ζ + τ), ∀ i, + r ≤ d z {ends (f i)} ∧ V(P (f i)) ∩ Z = {v} := by + classical + let bad : Set (Fin (ζ + τ)) := {i | ∃ x ∈ Z, x ∈ V(P i) ∧ x ≠ v} + let near : Set (Fin (ζ + τ)) := {i | d z {ends i} < r} + have hbad : bad.ncard ≤ ζ - 1 := by + let witness : Fin (ζ + τ) → α := fun i => + if hi : i ∈ bad then (show ∃ x ∈ Z, x ∈ V(P i) ∧ x ≠ v from hi).choose else v + have hw : ∀ i ∈ bad, witness i ∈ Z ∧ witness i ∈ V(P i) ∧ witness i ≠ v := by + intro i hi + dsimp only [witness] + rw [dite_eq_left hi] + exact (show ∃ x ∈ Z, x ∈ V(P i) ∧ x ≠ v from hi).choose_spec + have hinj : InjOn witness bad := by + intro i hi j hj heq + by_contra hne + have hx : witness i ∈ V(P i) ∩ V(P j) := ⟨(hw i hi).2.1, heq ▸ (hw j hj).2.1⟩ + rw [(h.2.2.2.2.1 i j hne).1] at hx + exact (hw i hi).2.2 (mem_singleton_iff.mp hx) + have hbound := ncard_le_ncard_of_injOn witness + (fun i hi => show witness i ∈ Z \ {v} from ⟨(hw i hi).1, (hw i hi).2.2⟩) + hinj (hZfin.sdiff) + have hcount := ncard_sdiff' (singleton_subset_iff.mpr hvZ) hZfin + rw [ncard_singleton] at hcount + omega + have hnear : near.ncard ≤ 1 := by + apply (ncard_le_one (toFinite near)).2 + intro i hi j hj + by_contra hne + have hiA := singleton_mem_A_of_mem_V (h.2.1 i) + have hjA := singleton_mem_A_of_mem_V (h.2.1 j) + have hbound := htri {ends i} hiA z hz {ends j} hjA + rw [hsymm {ends i} hiA z hz] at hbound + have hdist := h.2.2.2.2.2 i j hne + change d z {ends i} < r at hi + change d z {ends j} < r at hj + omega + let good : Set (Fin (ζ + τ)) := univ \ (bad ∪ near) + have hζ : 1 ≤ ζ := (ncard_pos hZfin).mpr ⟨v, hvZ⟩ |>.trans_le hZcard + have hgood : τ ≤ good.ncard := by + have hunion := ncard_union_le bad near + have hcount := ncard_sdiff' (subset_univ (bad ∪ near)) (toFinite univ) + have hall : (univ : Set (Fin (ζ + τ))).ncard = ζ + τ := by simp + change τ ≤ (univ \ (bad ∪ near)).ncard + omega + let : Fintype good := Fintype.ofFinite good + have hcard : Fintype.card (Fin τ) ≤ Fintype.card good := by + rw [Fintype.card_fin, ← Nat.card_eq_fintype_card, Nat.card_coe_set_eq] + exact hgood + obtain ⟨f⟩ := Function.Embedding.nonempty_of_card_le hcard + refine ⟨f.trans ⟨Subtype.val, Subtype.val_injective⟩, ?_⟩ + intro i + have hi : (f i).val ∉ bad ∧ (f i).val ∉ near := by + simpa only [good, mem_sdiff, mem_univ, true_and, mem_union, not_or] using (f i).property + have hfar : r ≤ d z {ends (f i).val} := Nat.le_of_not_gt hi.2 + refine ⟨hfar, ?_⟩ + apply subset_antisymm + · rintro x ⟨hxP, hxZ⟩ + apply mem_singleton_iff.mpr + by_contra hne + exact hi.1 ⟨x, hxZ, hxP, hne⟩ + · rintro x rfl + exact ⟨(GM09.IsGraphPathWithEnds.left_mem (h.2.2.1 (f i).val)), hvZ⟩ + +/-- Graph Minors XVI, proof of (8.3), Claim (8), page 67. +The selected ends survive the rearrangement, and compression preserves the +required breadth after subtracting `4λ + 2`. -/ +theorem theorem_8_3_claim_8 {α : Type u} {β : Type v} + {G : Graph α β} {H H' : Drawing S} {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} + {θ_star θ lam ψ τ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z : Set S} + (h : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) + {ends : Fin τ → S} (hends : ∀ i, ends i ∈ H.V) + (hfar : ∀ i, lam < d z {ends i}) + (hsep : ∀ i j, i ≠ j → θ ≤ d {ends i} {ends j}) + (hψ : ψ + (4 * lam + 2) ≤ θ) : + (∀ i, ends i ∈ H'.V ∧ η'.vMap (ends i) = η.vMap (ends i)) ∧ + ∀ i j, i ≠ j → ψ ≤ d' {ends i} {ends j} := by + have hkeep := fun i => h.vMap_eq (ends i) (hends i) (hfar i) + refine ⟨hkeep, ?_⟩ + intro i j hij + have hbound := compression_vertex_dist_le h.isCompression + (hends i) (hends j) (hkeep i).1 (hkeep j).1 + have hdist := hsep i j hij + omega + +/-- Graph Minors XVI, proof of (8.3), Claim (10), page 67. +At most one hair is discarded. Every retained hair is a vertex of the new +drawing and has the same image in the ambient graph. -/ +theorem theorem_8_3_claim_10 {α : Type u} {β : Type v} + {G : Graph α β} {H H' : Drawing S} {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} + {θ_star θ lam r δ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z : Set S} + (h : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) + {Y : Set S} (hY : Y ⊆ H.V) (hcard : Y.ncard = δ) + (hsep : ∀ y₁ ∈ Y, ∀ y₂ ∈ Y, y₁ ≠ y₂ → θ ≤ d {y₁} {y₂}) + (hr : 2 * r ≤ θ) (hlam : lam < r) + (hsymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, + d a c ≤ d a b + d b c) : + δ - 1 ≤ {y ∈ Y | r ≤ d z {y}}.ncard ∧ + ∀ y ∈ {y ∈ Y | r ≤ d z {y}}, y ∈ H'.V ∧ η'.vMap y = η.vMap y := by + refine ⟨?_, ?_⟩ + · rw [← hcard] + exact theorem_8_3_claim_10_card hY h.z_mem hr hsep hsymm htri + · intro y hy + exact h.vMap_eq y (hY hy.1) (hlam.trans_le hy.2) + +/-- Graph Minors XVI, proof of (8.3), Claim (11), pages 67–68. +The retained hairs and the two ends of the new path remain pairwise far apart. +The retained hairs are far from the centre, whereas both new ends are near it. -/ +theorem theorem_8_3_claim_11 {α : Type u} {β : Type v} + {G : Graph α β} {H H' : Drawing S} {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} + {θ_star θ lam ψ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z : Set S} + (h : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) + {Y : Set S} (hY : Y ⊆ H.V) (hY' : Y ⊆ H'.V) + (hsep : ∀ y₁ ∈ Y, ∀ y₂ ∈ Y, y₁ ≠ y₂ → θ ≤ d {y₁} {y₂}) + (hfar : ∀ y ∈ Y, ψ + 5 * lam + 2 ≤ d z {y}) + {s t : S} (hs : s ∈ H'.V) (ht : t ∈ H'.V) + (hsnear : pointAtomDist H d s z ≤ lam) (htnear : pointAtomDist H d t z ≤ lam) + (hst : ψ ≤ d' {s} {t}) (hθ : ψ + (4 * lam + 2) ≤ θ) + (hsymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (hsymm' : ∀ a ∈ H'.A, ∀ b ∈ H'.A, d' a b = d' b a) + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, + d a c ≤ d a b + d b c) : + ∀ y₁ ∈ Y ∪ {s, t}, ∀ y₂ ∈ Y ∪ {s, t}, y₁ ≠ y₂ → ψ ≤ d' {y₁} {y₂} := by + have hcross : ∀ y ∈ Y, ∀ x ∈ ({s, t} : Set S), ψ ≤ d' {y} {x} := by + intro y hy x hx + have hxV : x ∈ H'.V := by rcases hx with rfl | rfl <;> assumption + have hxnear : pointAtomDist H d x z ≤ lam := by rcases hx with rfl | rfl <;> assumption + have hbound := pointAtomDist_triangle htri y x h.z_mem + rw [pointAtomDist_of_mem_vertex d (hY hy) z, + hsymm {y} (singleton_mem_A_of_mem_V (hY hy)) z h.z_mem] at hbound + have hcompressed := h.isCompression.dist_le y x + rw [pointDist_of_mem_vertices d' (hY' hy) hxV] at hcompressed + have hdist := hfar y hy + omega + intro a ha b hb hne + rcases ha with ha | ha + · rcases hb with hb | hb + · have hbound := compression_vertex_dist_le h.isCompression (hY ha) (hY hb) (hY' ha) (hY' hb) + have hdist := hsep a ha b hb hne + omega + · exact hcross a ha b hb + · rcases hb with hb | hb + · have haV : a ∈ H'.V := by rcases ha with rfl | rfl <;> assumption + rw [hsymm' {a} (singleton_mem_A_of_mem_V haV) {b} (singleton_mem_A_of_mem_V (hY' hb))] + exact hcross b hb a ha + · rcases ha with rfl | rfl <;> rcases hb with rfl | rfl + · exact (hne rfl).elim + · exact hst + · rw [hsymm' _ (singleton_mem_A_of_mem_V ht) _ (singleton_mem_A_of_mem_V hs)] + exact hst + · exact (hne rfl).elim + +omit [T2Space S] in +/-- Graph Minors XVI, proof of (8.3), Claim (9), page 67. +The paths preserved in Claim (7), with the ends and breadth from Claim (8), +form a horn over the rearranged span. -/ +theorem theorem_8_3_claim_9 {α : Type u} {β : Type v} + {G : Graph α β} {H H' : Drawing S} {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} + {d d' : Set S → Set S → ℕ} {v : α} {θ ψ σ τ : ℕ} + {P : Fin σ → Graph α β} {ends : Fin σ → S} + (h : IsHorn G H η d v θ σ P ends) (f : Fin τ ↪ Fin σ) + (hv : v ∉ V(η'.imageGraph)) + (hends : ∀ i, ends (f i) ∈ H'.V ∧ η'.vMap (ends (f i)) = η.vMap (ends (f i))) + (hinter : ∀ i, V(P (f i)) ∩ V(η'.imageGraph) = {η'.vMap (ends (f i))}) + (hsep : ∀ i j, i ≠ j → ψ ≤ d' {ends (f i)} {ends (f j)}) : + IsHorn G H' η' d' v ψ τ (fun i => P (f i)) (fun i => ends (f i)) := by + refine ⟨⟨h.1.1, hv⟩, fun i => (hends i).1, ?_, hinter, ?_, hsep⟩ + · intro i + rw [(hends i).2] + exact h.2.2.1 (f i) + · intro i j hij + exact h.2.2.2.2.1 (f i) (f j) (fun heq => hij (f.injective heq)) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section8Main.lean b/LeanPool/GraphMinor/GM16/Section8Main.lean new file mode 100644 index 0000000000..c9936a0267 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section8Main.lean @@ -0,0 +1,177 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section8 +public import LeanPool.GraphMinor.GM15.Section4 +import LeanPool.GraphMinor.GM16.Section9Proof +import LeanPool.GraphMinor.GM16.Section8Proof +import LeanPool.GraphMinor.GM16.Section8Truncation +import LeanPool.GraphMinor.GM16.EnvelopeAnimal +import LeanPool.GraphMinor.GM16.SeparatedHairsCut +import LeanPool.GraphMinor.GM16.SpanSurface +import LeanPool.GraphMinor.GM16.Section5 +import LeanPool.GraphMinor.GM09.Basic + +import LeanPool.GraphMinor.GM09.Bridge + +import LeanPool.GraphMinor.GM11.CitedResults + +import LeanPool.GraphMinor.GM12.Section710 + +import LeanPool.GraphMinor.GM12.Section77 + +import LeanPool.GraphMinor.GM14.Section9a + +import LeanPool.GraphMinor.GM14.Section9b + +import LeanPool.GraphMinor.GM16.Theorem35Bridge + +/-! +# Graph Minors XVI, (7.1) + +Follow the proof on pages 69–70. Truncate and delete the horn centres, +then apply (8.1). The handle and extra-hair outcomes lift to the +original graph. In the envelope outcome, clear the horns and extend +the hairs to the boundary, producing the animal for (8.3). Its +close-pair outcome contradicts the separator. Its remaining outcomes +give either one more hair or the required level span. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 + GraphMinor.GM14 GraphMinor.GM15 +universe u v w + +/-- Graph Minors XVI, (7.1), pages 62 and 69–70, by the complete +proof using (8.1), (8.2), and (8.3), with all horns and hairs after +clearing constructed. No statement of XVI is assumed. -/ +theorem theorem_7_1_proof + : GM16Theorem71Statement.{u, v, w} := by + classical + intro S _ _ hS hConn τ χ δ lam θreq φ ψ hθreq hφ hψ + let : ConnectedSpace S := hConn + obtain ⟨γ, θ₁, hγ, hClear, h81⟩ := theorem_8_1_with_radius hS hConn δ φ ψ hφ hψ + let ζ := χ + δ ^ 2 * φ ^ 2 / 2 + obtain ⟨θ₂, hLower, hζθ₂, h83⟩ := theorem_8_3_with_bound hS hConn + (max (θreq + ζ) (4 * ψ + 2)) τ χ δ lam ζ ψ hψ + have hReq : θreq + ζ ≤ θ₂ := (le_max_left _ _).trans hLower + have hFour : 4 * ψ + 2 ≤ θ₂ := (le_max_right _ _).trans hLower + have hθ₂ : 1 ≤ θ₂ := by omega + let σ := δ + τ + ζ + let θ := χ + θ₁ + 3 * γ + (4 * γ + 2) * δ + θ₂ + refine ⟨θ, σ, by dsimp [θ]; omega, ?_⟩ + intro α β G θ_star T_star hT hHas + obtain ⟨H, η, θ_span, T, d, X, Y, hAnim⟩ := hHas + have hSaved := hAnim + obtain ⟨_, hθOrd, hSpan, hMet, hX, hXCard, hY, hYCard, _, _, _⟩ := hSaved + let θ₀ := θ - χ + have hθ₀ : θ₀ = θ₁ + 3 * γ + (4 * γ + 2) * δ + θ₂ := by dsimp [θ₀, θ]; omega + have hθ₀pos : 1 ≤ θ₀ := by rw [hθ₀]; omega + have hθ₀θ : θ₀ ≤ θ := Nat.sub_le _ _ + have hθ₁₀ : θ₁ ≤ θ₀ := by rw [hθ₀]; omega + have hBudget : θ₂ + 3 * γ + (4 * γ + 2) * δ ≤ θ₀ := by rw [hθ₀]; omega + let T₀ := truncation T θ₀ + let d₀ : Set S → Set S → ℕ := fun a b => min (d a b) θ₀ + have hNorm : IsAnimal G T_star θ_star H η θ₀ T₀ d₀ X Y χ δ θ₀ σ := + theorem_8_3_claim_1 (hAnim.mono hθ₀pos hθ₀θ le_rfl) + have hNormSaved := hNorm + obtain ⟨_, _, hSpan₀, hMet₀, _, _, _, _, _, _, hSep₀⟩ := hNormSaved + have hXsub : X ⊆ V(G) := fun x hx => (hX hx).1 + have hXdis : Disjoint V(η.imageGraph) X := disjoint_left.mpr fun x hx hxX => (hX hxX).2 hx + have hXlt : X.ncard < θ_span := by + rw [hXCard] + have hχθ : χ < θ := by dsimp [θ]; omega + exact lt_of_lt_of_le hχθ hθOrd + have hXltStar : X.ncard < θ_star := hXlt.trans_le hSpan.isControlling.theta_le + let ηDel := restrictDeleteVertices η X hXdis + let TstarDel := deleteGraphVerticesTangle G hT.finite_V hT.finite_E X T_star θ_star + have hSpanDel : IsSigmaSpan (deleteVertices G X) H ηDel + (θ_star - X.ncard) θ₀ TstarDel T₀ := theorem_8_2_proof G θ_star θ_span θ₀ T_star H η T X + hSpan hXsub hXdis hXlt hθ₀pos (by rw [hXCard]; exact Nat.sub_le_sub_right hθOrd χ) + have hYFin : Y.Finite := H.finite_V.subset hY + let ys := hYFin.toFinset + have hys : (ys : Set S) = Y := hYFin.coe_toFinset + have hysCard : ys.card = δ := (ncard_eq_toFinset_card _ hYFin).symm.trans hYCard + have hYS : (ys : Set S) ⊆ H.V := hys.symm ▸ hY + have hYSCard : (ys : Set S).ncard = δ := by rw [ncard_coe_finset, hysCard] + have hSepYS : ∀ y ∈ (ys : Set S), ∀ z ∈ (ys : Set S), y ≠ z → θ₁ ≤ d₀ {y} {z} := by + intro y hy z hz hyz + exact hθ₁₀.trans (hSep₀ y (hys ▸ hy) z (hys ▸ hz) hyz) + rcases h81 (deleteVertices G X) (θ_star - X.ncard) θ₀ TstarDel H ηDel T₀ d₀ + (ys : Set S) hθ₁₀ hSpanDel hMet₀ hYS hYSCard hSepYS with hHandle | hOld | hEnvCase + · obtain ⟨S', instS', instT2', H', η', θ', T', hHandle, hφ', hSpan'⟩ := hHandle + obtain ⟨S'', instS'', instT2'', H'', η'', θ'', T'', hHandle'', hφ'', hSpan''⟩ := + theorem_7_1_claim_1 hT hXsub hXltStar + ⟨S', instS', instT2', H', η', θ', T', hHandle, hφ', hSpan'⟩ + exact Or.inl ⟨S'', instS'', instT2'', H'', η'', θ'', T'', span_isClosedSurface hSpan'', + hSpan''.isConnected, hHandle'', hφ'', hSpan''⟩ + · obtain ⟨P, s, t, hs, ht, hP, hst, hsy⟩ := hOld + have hPG : IsHPathWithEnds G η.imageGraph P (η.vMap s) (η.vMap t) := + ⟨η.imageGraph_le, hP.2.1.mono (deleteVertices_le G X), hP.2.2⟩ + have hPX : Disjoint X V(P) := disjoint_left.mpr fun x hxX hxP => + (hP.2.1.1.vertexSet_mono hxP).2 hxX + obtain ⟨_, hSelf, _, hSymm, _, _⟩ := GraphMinor.GM11.gm15_theorem_9_1.{w} H θ_span T d hS hConn + hMet + have hsyY : ∀ y ∈ Y, ψ ≤ d₀ {s} {y} := hys ▸ hsy + have hstNe : s ≠ t := fun h => hP.2.2.1 (congrArg η.vMap h) + refine Or.inr (Or.inl (theorem_7_1_claim_2 hAnim (by omega) ?_ ?_ + (fun _ _ _ _ => Nat.min_le_left _ _) hSymm hSelf hs ht hstNe hPG hPX hst hsyY)) + · dsimp [θ] + omega + · dsimp [σ] + omega + · obtain ⟨Λ, Z, Tc, dc, hEnv, hZsub, hZCard, _, hComp, hCut⟩ := hEnvCase + let K := clearEnvelopeDrawing H (ys : Set S) Λ + let ηK := restrictCleared η (⋃ y ∈ (ys : Set S), Λ y) + have hCompYS : IsLambdaCompression H K θ₀ + ((4 * γ + 2) * ys.card) T₀ Tc d₀ dc := by simpa only [hysCard] using hComp + have hAnimYS : IsAnimal G T_star θ_star H η θ₀ T₀ d₀ X (ys : Set S) + χ ys.card θ₀ ((ζ + τ) + ys.card) := by + rw [hys, hysCard] + have hσ : σ = (ζ + τ) + δ := by dsimp [σ]; omega + rw [← hσ] + exact hNorm + obtain ⟨Y', hNew⟩ := animal_after_clearFamily hS ys Λ hγ η + hAnimYS hEnv hCompYS hθ₂ (by simpa only [hysCard] using hBudget) + have hNew' : IsAnimal G T_star θ_star K ηK (θ₀ - (4 * γ + 2) * δ) Tc dc X Y' + χ δ θ₂ (ζ + τ) := by simpa only [hysCard] using hNew + have hNewSaved := hNew' + obtain ⟨_, hθ₂Ord, hSpanK, hMetK, _, _, hY', _, _, _, hSep'⟩ := hNewSaved + have hKDisX : Disjoint V(ηK.imageGraph) X := hXdis.mono + (restrictCleared_imageGraph_le η (⋃ y ∈ (ys : Set S), Λ y)).vertexSet_mono Subset.rfl + have hKDisZ : Disjoint V(ηK.imageGraph) Z := disjoint_left.mpr fun x hxK hxZ => + (hZsub hxZ).2 hxK + let Ztot := X ∪ Z + have hZtotSub : Ztot ⊆ V(G) := union_subset hXsub (fun x hx => (hZsub hx).1.1) + have hZtotCard : Ztot.ncard ≤ ζ := by + have hc := ncard_union_le X Z + rw [hXCard] at hc + dsimp [Ztot, ζ] + omega + have hZtotLt : Ztot.ncard < θ_star := + lt_of_le_of_lt hZtotCard (hζθ₂.trans_le (hθ₂Ord.trans hSpanK.isControlling.theta_le)) + have hKDisTot : Disjoint V(ηK.imageGraph) Ztot := hKDisX.union_right hKDisZ + rcases h83 G θ_star (θ₀ - (4 * γ + 2) * δ) T_star K ηK Tc dc X Y' Ztot + hNew' hZtotSub hKDisTot subset_union_left hZtotCard with hNext | hClose | hLevel + · exact Or.inr (Or.inl hNext) + · obtain ⟨P, s, t, y, z, hs, ht, hy, hz, hyz, hP, hsy, htz⟩ := hClose + have hCut' : ∀ Q s t, s ∈ K.V → t ∈ K.V → + IsHPathWithEnds (deleteVertices G X) ηK.imageGraph Q (ηK.vMap s) (ηK.vMap t) → + 2 * ψ ≤ dc {s} {t} → (Z ∩ V(Q)).Nonempty := hCut + exact False.elim (close_pair_path_contradiction hS ηK hMetK hY' hSep' + (by omega) hCut' hs ht hy hz hyz hP hsy htz) + · obtain ⟨dLevel, hLevel⟩ := hLevel + refine Or.inr (Or.inr ⟨Ztot, K, restrictDeleteVertices ηK Ztot hKDisTot, + θ₂ - Ztot.ncard, truncation Tc (θ₂ - Ztot.ncard), dLevel, + hZtotSub, hZtotCard, hZtotLt, ?_, hLevel⟩) + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section8Paths.lean b/LeanPool/GraphMinor/GM16/Section8Paths.lean new file mode 100644 index 0000000000..6dca8482e5 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section8Paths.lean @@ -0,0 +1,274 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section8Rearrangement +import LeanPool.GraphMinor.GM16.DrawingAtoms +import LeanPool.GraphMinor.GM16.DrawingConnected +import LeanPool.GraphMinor.GM16.SpanPaths +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM16.MetricPoints +import LeanPool.GraphMinor.GM11.NiceStatements + +/-! +# Paths meeting the old span + +For XVI (8.3), Claim (5), choose a shortest path in the new drawing to the old +span. Its last edge cannot be far from the rearrangement centre, since that +edge would then be an unchanged old edge. A surviving end supplies the common +vertex needed to start this shortest-path argument. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- Graph Minors XVI, proof of (8.3), Claim (5), page 66. +Given a common vertex, every new vertex has a path in the new span to the old +span, meeting it just at an end at distance at most `λ + 2` from the centre. -/ +theorem theorem_8_3_claim_5 (hS : IsClosedSurface S) + {α : Type u} {β : Type v} {G : Graph α β} {H H' : Drawing S} + {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} {θ_star θ lam : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z : Set S} + (h : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) + (hsymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, + d a c ≤ d a b + d b c) + (hprox : ∀ x ∈ H.V, ∀ a ∈ H.A, x ∈ closure a → d {x} a ≤ 2) + (hcommon : (V(η.imageGraph) ∩ V(η'.imageGraph)).Nonempty) + {w : α} (hw : w ∈ V(η'.imageGraph)) (hwnot : w ∉ V(η.imageGraph)) : + ∃ (Q : Graph α β) (x : S), x ∈ H.V ∧ + Q ≤ η'.imageGraph ∧ IsGraphPathWithEnds G Q w (η.vMap x) ∧ + V(Q) ∩ V(η.imageGraph) = {η.vMap x} ∧ d z {x} ≤ lam + 2 := by + obtain ⟨a, ha, haw⟩ := η'.bijOn_v.surjOn hw + obtain ⟨q, hq, hq'⟩ := hcommon + obtain ⟨b, hb, hbq⟩ := η'.bijOn_v.surjOn hq' + obtain ⟨W⟩ := drawing_walk_of_twoCell hS h.isSpan'.isRespectful.1 ha hb + have W' : GraphWalk η'.imageGraph w q := by + simpa only [haw, hbq] using mapSpanWalk η' W + obtain ⟨w', hw', y, hy, Q, _, _, hQ, _, hinter⟩ := + exists_isFromToPathWithEnds_of_walk W' (show w ∈ ({w} : Set α) from mem_singleton w) hq + rw [mem_singleton_iff] at hw' + subst w' + obtain ⟨x, hx, hxy⟩ := η.bijOn_v.surjOn hy + have hQle : Q ≤ η'.imageGraph := hQ.1 + refine ⟨Q, x, hx, hQle, ?_, ?_, ?_⟩ + · rw [hxy] + exact hQ.mono η'.imageGraph_le + · rwa [hxy] + · by_contra hfar + have hfar' : lam + 3 ≤ d z {x} := by omega + have hxkeep := h.vMap_eq x hx (by omega) + obtain ⟨_, WQ, hsimple, hVQ, _⟩ := IsGraphPathWithEnds.symm hQ + cases WQ with + | nil hv => exact hwnot hy + | @cons y u w e hlink R => + have huy : u ≠ y := by + intro heq + have hnot := (List.nodup_cons.mp hsimple).1 + exact hnot (heq ▸ R.start_mem_support) + have hlinkNew := (hQle.isLink_iff hlink.edge_mem).mp hlink + obtain ⟨f, hf, hfe⟩ := η'.bijOn_e.surjOn hlinkNew.edge_mem + have hinc : η'.imageGraph.Inc (η'.eMap f) (η'.vMap x) := by + rw [hfe, hxkeep.2, hxy] + exact ⟨u, hlinkNew⟩ + have hxf := (η'.inc_iff f hf x hxkeep.1).mp hinc + obtain ⟨hfH, hmap⟩ := rearranged_incident_edge_eq hS h hsymm htri hprox hx hf hxf hfar' + have heOld : e ∈ E(η.imageGraph) := by + rw [← hfe, hmap] + exact η.bijOn_e.mapsTo hfH + have hlinkG := (η'.imageGraph_le.isLink_iff hlinkNew.edge_mem).mp hlinkNew + have hlinkOld := (η.imageGraph_le.isLink_iff heOld).mpr hlinkG + have huOld : u ∈ V(η.imageGraph) := η.imageGraph.left_mem_of_isLink hlinkOld.symm + have huBoth : u ∈ V(Q) ∩ V(η.imageGraph) := ⟨hlink.right_mem, huOld⟩ + rw [hinter, mem_singleton_iff] at huBoth + exact huy huBoth + +/-- Graph Minors XVI, proof of (8.3), Claim (7), page 67. +A selected horn path has no internal vertex in the rearranged span. Otherwise +Claim (5) and its remaining segment give a forbidden long old-span path. -/ +theorem theorem_8_3_claim_7 (hS : IsClosedSurface S) + {α : Type u} {β : Type v} {G : Graph α β} {H H' : Drawing S} + {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} {θ_star θ lam ψ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z : Set S} + (h : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) + (hsymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, + d a c ≤ d a b + d b c) + (hprox : ∀ x ∈ H.V, ∀ a ∈ H.A, x ∈ closure a → d {x} a ≤ 2) + (hself : ∀ a ∈ H.A, d a a = 0) (hψ : 1 ≤ ψ) + {Z : Set α} (hnewZ : Disjoint V(η'.imageGraph) Z) + (hshort : ∀ (L : Graph α β) (s t : S), s ∈ H.V → t ∈ H.V → + IsHPathWithEnds G η.imageGraph L (η.vMap s) (η.vMap t) → + Disjoint V(L) Z → d {s} {t} < 2 * ψ) + {P : Graph α β} {v : α} {u : S} (hu : u ∈ H.V) (hvZ : v ∈ Z) + (hP : IsGraphPathWithEnds G P v (η.vMap u)) + (hPH : V(P) ∩ V(η.imageGraph) = {η.vMap u}) + (hPZ : V(P) ∩ Z = {v}) (hfar : lam + 2 + 2 * ψ ≤ d z {u}) : + V(P) ∩ V(η'.imageGraph) ⊆ {η.vMap u} := by + intro w ⟨hwP, hwnew⟩ + by_contra hne + have hwne : w ≠ η.vMap u := fun heq => hne (mem_singleton_iff.mpr heq) + have hwnot : w ∉ V(η.imageGraph) := by + intro hwold + exact hwne (mem_singleton_iff.mp (hPH ▸ ⟨hwP, hwold⟩)) + have hwv : w ≠ v := by + intro heq + exact hnewZ.notMem_of_mem_left hwnew (heq ▸ hvZ) + have hukeep := h.vMap_eq u hu (by omega) + have huold := η.bijOn_v.mapsTo hu + have hunew : η.vMap u ∈ V(η'.imageGraph) := by + rw [← hukeep.2] + exact η'.bijOn_v.mapsTo hukeep.1 + obtain ⟨Q, x, hx, hQnew, hQ, hQH, hxclose⟩ := theorem_8_3_claim_5 hS h hsymm htri hprox + ⟨η.vMap u, huold, hunew⟩ hwnew hwnot + obtain ⟨R₁, R₂, hR₁P, hR₂P, hR₁, hR₂, _, hRinter, _⟩ := hP.exists_split_at hwP + have hvnot : v ∉ V(R₂) := by + intro hvR₂ + have hvBoth : v ∈ V(R₁) ∩ V(R₂) := ⟨hR₁.left_mem, hvR₂⟩ + rw [hRinter, mem_singleton_iff] at hvBoth + exact hwv hvBoth.symm + have hR₂Z : Disjoint V(R₂) Z := disjoint_left.mpr fun y hyR hyZ => by + have hy : y = v := mem_singleton_iff.mp (hPZ ▸ ⟨hR₂P.vertexSet_mono hyR, hyZ⟩) + exact hvnot (hy ▸ hyR) + have hR₂H : V(R₂) ∩ V(η.imageGraph) ⊆ {η.vMap u} := by + rintro y ⟨hyR, hyH⟩ + exact hPH ▸ ⟨hR₂P.vertexSet_mono hyR, hyH⟩ + have hxA := singleton_mem_A_of_mem_V hx + have huA := singleton_mem_A_of_mem_V hu + have hbound := htri z h.z_mem {x} hxA {u} huA + have hlong : 2 * ψ ≤ d {x} {u} := by omega + have hxu : x ≠ u := by + intro heq + subst x + rw [hself {u} huA] at hlong + omega + have hmapne : η.vMap x ≠ η.vMap u := fun heq => hxu (η.bijOn_v.injOn hx hu heq) + obtain ⟨L, hLsub, hL⟩ := exists_hPath_of_two_paths η.imageGraph_le hQ.symm + (hR₂.mono hP.le) (η.bijOn_v.mapsTo hx) huold hmapne + (by rw [hQH]) hR₂H + have hQZ : Disjoint V(Q) Z := hnewZ.mono_left hQnew.vertexSet_mono + have hLZ : Disjoint V(L) Z := by + apply disjoint_left.mpr + intro y hyL hyZ + have hy := hLsub.vertexSet_mono hyL + change y ∈ V(Q) ∪ V(R₂) at hy + exact hy.elim (fun hyQ => hQZ.notMem_of_mem_left hyQ hyZ) + (fun hyR => hR₂Z.notMem_of_mem_left hyR hyZ) + exact (Nat.not_lt_of_ge hlong) (hshort L x u hx hu hL hLZ) + +/-- The first new-span vertex met by an old hair is far from its retained +end. This is the first case of XVI (8.3), Claim (12), page 68. -/ +theorem rearranged_hair_hit_dist (hS : IsClosedSurface S) + {α : Type u} {β : Type v} {G : Graph α β} {H H' : Drawing S} + {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} {θ_star θ lam ψ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z : Set S} + (h : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) + (hsymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, + d a c ≤ d a b + d b c) + {P : Graph α β} {y x v : S} (hy : y ∈ H.V) (hx : x ∈ H.V) + (hy' : y ∈ H'.V) (hv' : v ∈ H'.V) + (hP : IsHPathWithEnds G η.imageGraph P (η.vMap y) (η.vMap x)) + (hvP : η'.vMap v ∈ V(P)) (hvy : η'.vMap v ≠ η.vMap y) + (hfar : ψ + 5 * lam + 2 ≤ d z {y}) + (hθ : ψ + (4 * lam + 2) ≤ θ) (hdist : θ ≤ d {y} {x}) : + ψ ≤ d' {y} {v} := by + obtain ⟨a, ha, hva⟩ := exists_atom H v + by_cases haway : lam < d z a + · obtain ⟨_, hv, hmap⟩ := old_vertex_of_far_atom hS h ha hva hv' haway + have hvBoth : η'.vMap v ∈ V(P) ∩ V(η.imageGraph) := by + refine ⟨hvP, ?_⟩ + rw [hmap] + exact η.bijOn_v.mapsTo hv + rw [hP.2.2.2.2.2.1] at hvBoth + have hveq : η'.vMap v = η.vMap x := by + rcases hvBoth with hsame | hsame + · exact (hvy hsame).elim + · exact mem_singleton_iff.mp hsame + have hvx : v = x := η.bijOn_v.injOn hv hx (hmap.symm.trans hveq) + subst v + have hb := compression_vertex_dist_le h.isCompression hy hx hy' hv' + omega + · have hnear : d z a ≤ lam := Nat.le_of_not_gt haway + have hyA := singleton_mem_A_of_mem_V hy + have hb := htri z h.z_mem a ha {y} hyA + rw [hsymm a ha {y} hyA] at hb + have hc := h.isCompression.dist_le y v + rw [pointDist_of_mem_atoms d hyA ha (mem_singleton y) hva, + pointDist_of_mem_vertices d' hy' hv'] at hc + omega + +/-- In the second case of XVI (8.3), Claim (12), the first new-span vertex +reached through the old drawing is far from the retained hair. +We retain hairs at distance `ψ + 5λ + 4`, two more than the paper's cutoff, +to keep a distance buffer for the last old edge. -/ +theorem rearranged_exit_path_dist (hS : IsClosedSurface S) + {α : Type u} {β : Type v} {G : Graph α β} {H H' : Drawing S} + {η : SpanEmbedding H G} {η' : SpanEmbedding H' G} {θ_star θ lam ψ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {z : Set S} + (h : IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z) + (hsymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, + d a c ≤ d a b + d b c) + (hprox : ∀ x ∈ H.V, ∀ a ∈ H.A, x ∈ closure a → d {x} a ≤ 2) + {R : Graph α β} {y x v : S} (hy : y ∈ H.V) (hy' : y ∈ H'.V) (hv' : v ∈ H'.V) + (hR : IsGraphPathWithEnds G R (η.vMap x) (η'.vMap v)) (hRold : R ≤ η.imageGraph) + (hRnew : V(R) ∩ V(η'.imageGraph) = {η'.vMap v}) + (hxnot : η.vMap x ∉ V(η'.imageGraph)) (hfar : ψ + 5 * lam + 4 ≤ d z {y}) : + ψ ≤ d' {y} {v} := by + by_contra hn + have hsmall : d' {y} {v} < ψ := Nat.lt_of_not_ge hn + obtain ⟨a, ha, hva⟩ := exists_atom H v + have hyA := singleton_mem_A_of_mem_V hy + have hb := htri z h.z_mem a ha {y} hyA + rw [hsymm a ha {y} hyA] at hb + have hc := h.isCompression.dist_le y v + rw [pointDist_of_mem_atoms d hyA ha (mem_singleton y) hva, + pointDist_of_mem_vertices d' hy' hv'] at hc + have hfar_a : lam + 2 < d z a := by omega + obtain ⟨heq, hv, hmap⟩ := old_vertex_of_far_atom hS h ha hva hv' (by omega) + have hvA := singleton_mem_A_of_mem_V hv + have hfar_v : lam + 2 < d z {v} := by simpa only [heq] using hfar_a + have hends : η.vMap x ≠ η'.vMap v := by + intro he + exact hxnot (he ▸ η'.bijOn_v.mapsTo hv') + obtain ⟨e, u, hlinkR, hune⟩ := path_edge_at_end hR hends + have hlinkOld := (hRold.isLink_iff hlinkR.edge_mem).mp hlinkR + obtain ⟨f, hf, hfe⟩ := η.bijOn_e.surjOn hlinkOld.edge_mem + have hinc : η.imageGraph.Inc (η.eMap f) (η.vMap v) := by + rw [hfe, ← hmap] + exact ⟨u, hlinkOld.symm⟩ + have hvf := (η.inc_iff f hf v hv).mp hinc + have hfA : f ∈ H.A := Or.inl (Or.inr hf) + have hp := hprox v hv f hfA hvf + have ht := htri z h.z_mem f hfA {v} hvA + rw [hsymm f hfA {v} hvA] at ht + have hfar_f : lam < d z f := by omega + obtain ⟨hf', hmapf⟩ := h.eMap_eq f hf hfar_f + have heNew : e ∈ E(η'.imageGraph) := by + rw [← hfe, ← hmapf] + exact η'.bijOn_e.mapsTo hf' + have hlinkG := (hR.1.isLink_iff hlinkR.edge_mem).mp hlinkR + have hlinkNew := (η'.imageGraph_le.isLink_iff heNew).mpr hlinkG + have huBoth : u ∈ V(R) ∩ V(η'.imageGraph) := ⟨hlinkR.left_mem, hlinkNew.left_mem⟩ + rw [hRnew, mem_singleton_iff] at huBoth + exact hune huBoth + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section8Proof.lean b/LeanPool/GraphMinor/GM16/Section8Proof.lean new file mode 100644 index 0000000000..473ca7c7f4 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section8Proof.lean @@ -0,0 +1,168 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section8Animal +import LeanPool.GraphMinor.GM16.MetricPoints +import LeanPool.GraphMinor.GM09.Basic + +import LeanPool.GraphMinor.GM11.CitedResults + +/-! +# Non-level spans give another hair + +This proves XVI (8.3) by its proof on pages 65–68. Truncate the animal, rule +out long paths avoiding the deleted set, and apply the definition of level. +A non-level rearrangement yields the extra hair by Claims (3)–(12). + +The threshold is increased from the paper's constant term `11` to `31`. +This allows the two-unit larger cutoff for retained hairs used in Claim (12). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w + +/-- Graph Minors XVI, (8.3), pages 65–68. The proof uses the metric laws, including the +triangle inequality from XI (9.1), and the truncation, vertex-deletion, and rearrangement lemmas. +The larger constant term `31` provides the buffer in Claim (12). -/ +theorem theorem_8_3_with_bound : + ∀ {S : Type w} [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ lower τ χ δ lam ζ ψ : ℕ, 3 ≤ ψ → + ∃ θ : ℕ, lower ≤ θ ∧ ζ < θ ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star θ_span : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (X : Set α) (Y : Set S) (Z : Set α) + (hAnim : IsAnimal G T_star θ_star H η θ_span T d X Y χ δ θ (ζ + τ)) + (_ : Z ⊆ V(G)) (hZ_disj : Disjoint V(η.imageGraph) Z) + (_ : X ⊆ Z) (_ : Z.ncard ≤ ζ), + HasAnimal S G T_star θ_star χ (δ + 1) ψ τ ∨ + (∃ (P : Graph α β) (s₁ s₂ y₁ y₂ : S), + s₁ ∈ H.V ∧ s₂ ∈ H.V ∧ y₁ ∈ Y ∧ y₂ ∈ Y ∧ y₁ ≠ y₂ ∧ + IsHPathWithEnds (GM09.deleteVertices G Z) η.imageGraph P + (η.vMap s₁) (η.vMap s₂) ∧ + d {s₁} {y₁} < ψ ∧ d {s₂} {y₂} < ψ) ∨ + (∃ d₀ : Set S → Set S → ℕ, + IsLevelSpan (GM09.deleteVertices G Z) H (restrictDeleteVertices η Z hZ_disj) + (θ_star - Z.ncard) (θ - Z.ncard) lam (2 * ψ) + (deleteGraphVerticesTangle G hAnim.2.2.1.isControlling.isTangle_star.finite_V + hAnim.2.2.1.isControlling.isTangle_star.finite_E Z T_star θ_star) + (GM10.truncation T (θ - Z.ncard)) d₀) := by + classical + intro S _ _ hS hConn lower τ χ δ lam ζ ψ hψ + let θ := lower + 4 * ψ + 10 * lam + 3 * ζ + 31 + refine ⟨θ, by dsimp [θ]; omega, by dsimp [θ]; omega, ?_⟩ + intro α β G θ_star θ_span T_star H η T d X Y Z hAnim hZsub hZdisj hXZ hZcard + let T₀ := GM10.truncation T θ + let d₀ : Set S → Set S → ℕ := fun a b => min (d a b) θ + have hNorm : IsAnimal G T_star θ_star H η θ T₀ d₀ X Y χ δ θ (ζ + τ) := + theorem_8_3_claim_1 hAnim + have hSpan := hNorm.2.2.1 + have hMet := hNorm.2.2.2.1 + have hT := hSpan.isControlling.isTangle_star + have hZfin : Z.Finite := hT.finite_V.subset hZsub + have hZlt : Z.ncard < θ := by dsimp [θ]; omega + have hZltStar : Z.ncard < θ_star := hZlt.trans_le hSpan.isControlling.theta_le + obtain ⟨_, hself, _, hsymm, htri, _⟩ := GraphMinor.GM11.gm15_theorem_9_1.{w} H θ T₀ d₀ hS hConn + hMet + have hψθ : ψ ≤ θ := by dsimp [θ]; omega + have hOldDel : η.imageGraph ≤ GM09.deleteVertices G Z := + le_deleteVertices_of_disjoint η.imageGraph_le hZdisj + by_cases hshort : ∀ (P : Graph α β) (s t : S), s ∈ H.V → t ∈ H.V → + IsHPathWithEnds G η.imageGraph P (η.vMap s) (η.vMap t) → + Disjoint V(P) Z → d₀ {s} {t} < 2 * ψ + · let η₀ := restrictDeleteVertices η Z hZdisj + let T_del := GM10.truncation T₀ (θ - Z.ncard) + let d_del : Set S → Set S → ℕ := fun a b => min (d₀ a b) (θ - Z.ncard) + let T_star_del := deleteGraphVerticesTangle G hT.finite_V hT.finite_E Z T_star θ_star + have hDel : IsSigmaSpan (GM09.deleteVertices G Z) H η₀ (θ_star - Z.ncard) + (θ - Z.ncard) T_star_del T_del := + theorem_8_2_proof G θ_star θ (θ - Z.ncard) T_star H η T₀ Z hSpan hZsub hZdisj hZlt + (by omega) le_rfl + have hDelMet : HasTangleMetric H (θ - Z.ncard) T_del d_del := + HasTangleMetric.truncation hMet (by omega) (Nat.sub_le _ _) + by_cases hlevel : IsLevelSpan (GM09.deleteVertices G Z) H η₀ (θ_star - Z.ncard) + (θ - Z.ncard) lam (2 * ψ) T_star_del T_del d_del + · right; right + refine ⟨d_del, ?_⟩ + have hEq : T_del = GM10.truncation T (θ - Z.ncard) := + truncation_truncation_eq T (Nat.sub_le _ _) + rwa [hEq] at hlevel + · have hnotstep : ¬ IsMuSteppedSpan (GM09.deleteVertices G Z) H η₀ d_del (2 * ψ) := by + rintro ⟨P, s, t, hs, ht, hP, hlong⟩ + have hPG : IsHPathWithEnds G η.imageGraph P (η.vMap s) (η.vMap t) := + ⟨η.imageGraph_le, hP.2.1.mono (G.induce_le sdiff_subset), hP.2.2⟩ + have hPZ : Disjoint V(P) Z := disjoint_left.mpr fun v hv hvZ => + (hP.2.1.1.vertexSet_mono hv).2 hvZ + have hb := hshort P s t hs ht hPG hPZ + change 2 * ψ ≤ min (d₀ {s} {t}) (θ - Z.ncard) at hlong + omega + obtain ⟨H', η', T'', d'', z, P, s, t, hRearr, hStep, hsnear, htnear⟩ := + theorem_8_3_claim_3 hDel hDelMet (by dsimp [θ]; omega) hnotstep hlevel + let lam' := lam + (Z.ncard + 3) / 4 + have hbudget : Z.ncard + (4 * lam + 2) ≤ 4 * lam' + 2 := by dsimp [lam']; omega + have hlam : lam ≤ lam' := Nat.le_add_right _ _ + have hgap : lam' < θ - Z.ncard := by dsimp [lam', θ]; omega + have hnewpos : 4 * lam' + 2 < θ := by dsimp [lam', θ]; omega + have hLift := theorem_8_3_claim_4 hSpan hMet hZsub hZdisj η' hRearr hlam hgap hbudget hnewpos + let η_new := liftSpanEmbedding η' (G.induce_le sdiff_subset) + let T_new := GM10.truncation T'' (θ - (4 * lam' + 2)) + let d_new : Set S → Set S → ℕ := fun a b => min (d'' a b) (θ - (4 * lam' + 2)) + have hNew : IsRearrangedWithin G H H' η η_new θ_star θ lam' T_star T₀ T_new d₀ d_new z + := hLift + have hnewZ : Disjoint V(η_new.imageGraph) Z := disjoint_left.mpr fun v hv hvZ => + (η'.imageGraph_le.vertexSet_mono hv).2 hvZ + have hPZ : Disjoint V(P) Z := disjoint_left.mpr fun v hv hvZ => + (hStep.2.2.1.2.1.1.vertexSet_mono hv).2 hvZ + have hPG : IsHPathWithEnds G η_new.imageGraph P (η_new.vMap s) (η_new.vMap t) := + ⟨η_new.imageGraph_le, hStep.2.2.1.2.1.mono (G.induce_le sdiff_subset), hStep.2.2.1.2.2⟩ + have hlong : 2 * ψ ≤ d_new {s} {t} := by + have hb := hStep.2.2.2 + change 2 * ψ ≤ min (d'' {s} {t}) (θ - (4 * lam' + 2)) + have hcut : 2 * ψ ≤ θ - (4 * lam' + 2) := by dsimp [θ, lam']; omega + exact le_min hb hcut + have hsnear' : pointAtomDist H d₀ s z ≤ lam' := by + change pointAtomDist H (fun a b => min (d₀ a b) (θ - Z.ncard)) s z ≤ lam at hsnear + rw [pointAtomDist_min] at hsnear + omega + have htnear' : pointAtomDist H d₀ t z ≤ lam' := by + change pointAtomDist H (fun a b => min (d₀ a b) (θ - Z.ncard)) t z ≤ lam at htnear + rw [pointAtomDist_min] at htnear + omega + left + exact animal_of_rearrangement hS hNorm hNew hZfin hXZ hZcard hnewZ hshort + hStep.1 hStep.2.1 hPG hPZ hlong hsnear' htnear' hψ + (by dsimp [θ, lam']; omega) (by dsimp [θ, lam']; omega) (by dsimp [θ, lam']; omega) + · push Not at hshort + obtain ⟨P, s, t, hs, ht, hP, hPZ, hlong⟩ := hshort + rcases theorem_8_3_claim_2 hNorm (by omega) hψθ (show τ ≤ ζ + τ by omega) hsymm hself htri + hs ht hP (hPZ.symm.mono_left hXZ) hlong with hnew | hnear + · exact Or.inl hnew + · obtain ⟨y₁, hy₁, y₂, hy₂, hne, hnear₁, hnear₂⟩ := hnear + right; left + refine ⟨P, s, t, y₁, y₂, hs, ht, hy₁, hy₂, hne, ?_, ?_, ?_⟩ + · exact ⟨hOldDel, hP.2.1.in_deleteVertices hPZ.symm, hP.2.2⟩ + · change min (d {s} {y₁}) θ < ψ at hnear₁ + omega + · change min (d {t} {y₂}) θ < ψ at hnear₂ + omega + +/-- Graph Minors XVI, (8.3), with its printed statement. The strengthened +proof also permits any prescribed lower bound on the chosen threshold, +as used in the proof of (7.1) on page 69. -/ +theorem theorem_8_3_proof : GM16Theorem83Statement.{u, v, w} := by + intro S _ _ hS hConn τ χ δ lam ζ ψ hψ + obtain ⟨θ, _, hζ, hRest⟩ := theorem_8_3_with_bound hS hConn 0 τ χ δ lam ζ ψ hψ + exact ⟨θ, hζ, hRest⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section8Rearrangement.lean b/LeanPool/GraphMinor/GM16/Section8Rearrangement.lean new file mode 100644 index 0000000000..9afebfea91 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section8Rearrangement.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section8Truncation +import LeanPool.GraphMinor.GM16.MetricPoints + +/-! +# Lifting a rearrangement in Graph Minors XVI + +Deleting vertices lowers the tangle order. In Claim (4) of the proof of (8.3), +the rearranged tangle is truncated once more so that the lost order is exactly +`4λ' + 2`. Lifting the span and comparing the two cutoffs gives the required +rearrangement in the original graph. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- Graph Minors XVI, proof of (8.3), Claim (3), pages 65–66. +Once the order bound and absence of long paths have been checked, failure to +be level supplies a rearrangement with a long path near its centre. -/ +theorem theorem_8_3_claim_3 {α : Type u} {β : Type v} + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ lam ψ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} + (hSpan : IsSigmaSpan G H η θ_star θ T_star T) (hMet : HasTangleMetric H θ T d) + (horder : 4 * lam + 2 * ψ + 2 ≤ θ) + (hnotstep : ¬ IsMuSteppedSpan G H η d (2 * ψ)) + (hnotlevel : ¬ IsLevelSpan G H η θ_star θ lam (2 * ψ) T_star T d) : + ∃ (H' : Drawing S) (η' : SpanEmbedding H' G) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ) (z : Set S) (P : Graph α β) (s t : S), + IsRearrangedWithin G H H' η η' θ_star θ lam T_star T T' d d' z ∧ + IsMuStepped G H' η' d' (2 * ψ) P s t ∧ + pointAtomDist H d s z ≤ lam ∧ pointAtomDist H d t z ≤ lam := by + classical + by_contra hn + apply hnotlevel + refine ⟨hSpan, hMet, horder, hnotstep, ?_⟩ + intro H' η' T' d' z hRearr P s t hStep hnear + exact hn ⟨H', η', T', d', z, P, s, t, hRearr, hStep, hnear⟩ + +/-- Graph Minors XVI, proof of (8.3), Claim (4), page 66, lifting and +rearrangement part. The inequalities are those satisfied by the paper's +choice `λ + |Z|/4 ≤ λ' < λ + |Z|/4 + 1`. -/ +theorem theorem_8_3_claim_4 {α : Type u} {β : Type v} + {G : Graph α β} {H H' : Drawing S} {η : SpanEmbedding H G} + {θ_star θ lam lam' : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T'' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d'' : Set S → Set S → ℕ} {z : Set S} + (hSpan : IsSigmaSpan G H η θ_star θ T_star T) + (hMet : HasTangleMetric H θ T d) {Z : Set α} + (hZsub : Z ⊆ V(G)) (hZdisj : Disjoint V(η.imageGraph) Z) + (η' : SpanEmbedding H' (GM09.deleteVertices G Z)) + (h : IsRearrangedWithin (GM09.deleteVertices G Z) H H' + (restrictDeleteVertices η Z hZdisj) η' (θ_star - Z.ncard) (θ - Z.ncard) lam + (deleteGraphVerticesTangle G hSpan.isControlling.isTangle_star.finite_V + hSpan.isControlling.isTangle_star.finite_E Z T_star θ_star) + (GM10.truncation T (θ - Z.ncard)) T'' + (fun a b => min (d a b) (θ - Z.ncard)) d'' z) + (hlam : lam ≤ lam') (hgap : lam' < θ - Z.ncard) + (hbudget : Z.ncard + (4 * lam + 2) ≤ 4 * lam' + 2) + (hpos : 4 * lam' + 2 < θ) : + IsRearrangedWithin G H H' η (liftSpanEmbedding η' (G.induce_le sdiff_subset)) + θ_star θ lam' T_star T (GM10.truncation T'' (θ - (4 * lam' + 2))) + d (fun a b => min (d'' a b) (θ - (4 * lam' + 2))) z := by + have hnewpos : 1 ≤ θ - (4 * lam' + 2) := by omega + have hle : θ - (4 * lam' + 2) ≤ (θ - Z.ncard) - (4 * lam + 2) := by omega + have hZlt : Z.ncard < θ_star := by + have hθ := hSpan.isControlling.theta_le + omega + have hnewSpan := IsSigmaSpan.truncation h.isSpan' hnewpos hle + have hnewMet := HasTangleMetric.truncation h.isCompression.hasMetric' hnewpos hle + refine ⟨h.z_mem, hSpan, ?_, ?_, ?_, ?_, ?_⟩ + · exact theorem_7_4_proof G θ_star (θ - (4 * lam' + 2)) T_star + hSpan.isControlling.isTangle_star Z H' η' + (GM10.truncation T'' (θ - (4 * lam' + 2))) hZsub hZlt hnewSpan + · intro a ha hfar + exact h.atom_mem a ha (lt_min (hlam.trans_lt hfar) (hlam.trans_lt hgap)) + · intro v hv hfar + exact h.vMap_eq v hv (lt_min (hlam.trans_lt hfar) (hlam.trans_lt hgap)) + · intro e he hfar + exact h.eMap_eq e he (lt_min (hlam.trans_lt hfar) (hlam.trans_lt hgap)) + · refine ⟨hpos, hMet, hnewMet, ?_⟩ + intro x y + have hbound := h.isCompression.dist_le x y + rw [pointDist_min] at hbound ⊢ + have hfull := pointDist_le_order hMet x y + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section8Truncation.lean b/LeanPool/GraphMinor/GM16/Section8Truncation.lean new file mode 100644 index 0000000000..b339647358 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section8Truncation.lean @@ -0,0 +1,115 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +import LeanPool.GraphMinor.GM12.Section79 + +public import LeanPool.GraphMinor.GM16.Section8 +import LeanPool.GraphMinor.GM16.MetricBounds +import LeanPool.GraphMinor.GM12.Section4WalkMetric + +/-! +# Truncating animals in Graph Minors XVI + +The same radial drawing and inside discs give the metric of a truncated tangle. +Its distances are the old distances cut off at the new order. Thus truncation +preserves an animal whose required strength is at most the new order, as used +in Claim (1) of the proof of XVI (8.3). +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +open Hypergraph +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- Truncation of a respectful drawing tangle cuts off its metric at the new order +(Graph Minors XVI, proof of (8.3), Claim (1), page 65). -/ +theorem HasTangleMetric.truncation {H : Drawing S} {θ θ' : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (h : HasTangleMetric H θ T d) + (hpos : 1 ≤ θ') (hle : θ' ≤ θ) : + HasTangleMetric H θ' (GM10.truncation T θ') (fun a b => min (d a b) θ') := + GM12.HasTangleMetric.truncation h hpos hle + +omit [T2Space S] in +/-- Restricting a separation to an embedded drawing cannot increase its order. -/ +theorem restrictedSeparation_order_le {α : Type u} {β : Type v} + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {A B : Hypergraph α β} {A_H B_H : Hypergraph S (Set S)} + (h : IsRestrictedSeparation H G η A B A_H B_H) : + separationOrder A_H B_H ≤ separationOrder A B := by + have hinj : Set.InjOn η.vMap (A_H ∩ B_H).vertexSet := + η.bijOn_v.injOn.mono (inter_subset_left.trans h.1.left_le.vertexSet_subset) + have hsub : η.vMap '' (A_H ∩ B_H).vertexSet ⊆ (A ∩ B).vertexSet := by + rintro x ⟨y, ⟨hyA, hyB⟩, rfl⟩ + have ha : η.vMap y ∈ η.vMap '' A_H.vertexSet := ⟨y, hyA, rfl⟩ + have hb : η.vMap y ∈ η.vMap '' B_H.vertexSet := ⟨y, hyB, rfl⟩ + rw [h.2.1] at ha + rw [h.2.2.2.1] at hb + exact ⟨ha.1, hb.1⟩ + have heq : (η.vMap '' (A_H ∩ B_H).vertexSet).ncard = separationOrder A_H B_H := + hinj.ncard_image + rw [← heq] + exact ncard_le_ncard hsub (A ∩ B).vertexSet_finite + +/-- Truncating the tangle of a span preserves control by its ambient tangle +(Graph Minors XVI, proof of (8.3), Claim (1), page 65). -/ +theorem IsSigmaSpan.truncation {α : Type u} {β : Type v} + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ θ' : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (h : IsSigmaSpan G H η θ_star θ T_star T) (hpos : 1 ≤ θ') (hle : θ' ≤ θ) : + IsSigmaSpan G H η θ_star θ' T_star (GM10.truncation T θ') := by + have hresp := IsRespectfulDrawingTangle.truncation h.isRespectful hpos hle + refine ⟨h.isSurface, h.isConnected, h.bd_empty, h.isRigid, hresp, + ⟨hle.trans h.isControlling.theta_le, h.isControlling.isTangle_star, hresp.2.1, ?_⟩⟩ + intro A B hsep hord A_H B_H hrestr + have hc := h.isControlling.controls hsep (hord.trans_le hle) hrestr + have hsmall := (restrictedSeparation_order_le hrestr).trans_lt hord + exact ⟨fun hm => ⟨hc.mp hm, hsmall⟩, fun hm => hc.mpr hm.1⟩ + +/-- Graph Minors XVI, proof of (8.3), Claim (1), page 65: an animal of +strength `(θ, σ)` can be represented with its span order exactly `θ`. +Its metric is the original metric cut off at `θ`. -/ +theorem theorem_8_3_claim_1 {α : Type u} {β : Type v} + {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} + {θ_star θ_span χ δ θ σ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {X : Set α} {Y : Set S} + (h : IsAnimal G T_star θ_star H η θ_span T d X Y χ δ θ σ) : + IsAnimal G T_star θ_star H η θ (GM10.truncation T θ) + (fun a b => min (d a b) θ) X Y χ δ θ σ := by + rcases h with ⟨hpos, hle, hspan, hmet, hX, hXcard, hY, hYcard, hhorn, hhair, hsep⟩ + refine ⟨hpos, le_rfl, IsSigmaSpan.truncation hspan hpos hle, + HasTangleMetric.truncation hmet hpos hle, hX, hXcard, hY, hYcard, ?_, ?_, ?_⟩ + · intro v hv + obtain ⟨P, u, hvG, hu, hpath, hinter, hpair, hdist⟩ := hhorn v hv + refine ⟨P, u, hvG, hu, hpath, hinter, hpair, ?_⟩ + intro i j hij + exact le_min (hdist i j hij) le_rfl + · intro y hy + obtain ⟨v, P, hv, hne, hp, hd, hdist⟩ := hhair y hy + exact ⟨v, P, hv, hne, hp, hd, le_min hdist le_rfl⟩ + · intro y₁ hy₁ y₂ hy₂ hne + exact le_min (hsep y₁ hy₁ y₂ hy₂ hne) le_rfl + +/-- Truncating twice is the same as truncating directly to the smaller order. -/ +theorem truncation_truncation_eq {α : Type u} {β : Type v} + (T : Set (Hypergraph α β × Hypergraph α β)) {a b : ℕ} (hle : b ≤ a) : + GM10.truncation (GM10.truncation T a) b = GM10.truncation T b := by + ext p + constructor + · exact fun h => ⟨h.1.1, h.2⟩ + · exact fun h => ⟨⟨h.1, h.2.trans_le hle⟩, h.2⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9AnnularAttachment.lean b/LeanPool/GraphMinor/GM16/Section9AnnularAttachment.lean new file mode 100644 index 0000000000..bce9e1dce6 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9AnnularAttachment.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section6 +import LeanPool.GraphMinor.GM16.AnnulusConnected +import LeanPool.GraphMinor.GM16.AnnulusPathIntersection +import LeanPool.GraphMinor.GM16.SpanAttachment +import LeanPool.GraphMinor.GM16.DrawingConnected +import LeanPool.GraphMinor.GM16.DrawingGraphPaths +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.Section88 + +/-! +# Meeting a clean annulus gives the forbidden attachment + +The path of Claim (11) crosses the clean annular subdrawing. The +annulus is connected and lies inside one cleared battlefield, so it +has no vertex in the cleared drawing. Its union with the clean path +therefore gives a clean attachment to any ambient path meeting it. +This is the implication used to prove XVI (8.1), Claim (14). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM11 + GraphMinor.GM14 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] +variable {α : Type u} {β : Type v} + +/-- The substantive implication of XVI (8.1), Claim (14), page 74: +meeting the clean annulus gives a clean attachment to the bad path. +The annulus's connectedness and its intersection with the clean path +are both proved from the drawing data. -/ +theorem section9_annular_intersection_gives_attachment (hS : IsClosedSurface S) + {G P₀ : Graph α β} {H P : Drawing S} (η : SpanEmbedding H G) + {Y : Set S} {Λ : S → Set S} {γ θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hMet : HasTangleMetric H θ T d) + (hZone : ∀ y ∈ Y, IsLambdaZoneAround H d γ {y} (Λ y)) + {y : S} (hy : y ∈ Y) + (η' : SpanEmbedding (clearEnvelopeDrawing H Y Λ) G) (hMap : η'.vMap = η.vMap) + {I O : Set S} {γI γO : ℕ} {a b : S} {X : Set S} {Z : Set α} + (hI : IsLambdaZoneAround H d γI {y} I) (hO : IsLambdaZoneAround H d γO {y} O) + (hNest : closure I ⊆ O) (hOuter : closure O ⊆ Λ y) + (hP : P.IsSubdrawing H) (hPath : P.IsPathBetween b a) (hbX : b ∈ X) + (ha : a ∈ O) (hb : b ∉ O) + (hPClear : P.V ∩ (clearEnvelopeDrawing H Y Λ).V = {b}) + (hPZ : Disjoint P.V (H.V ∩ η.vMap ⁻¹' Z)) + (hClean : Disjoint (closure O \ I) (H.V ∩ η.vMap ⁻¹' Z)) + (hHit : (V(P₀) ∩ (η.vMap '' (H.interSet (closure O \ I)).V)).Nonempty) : + ∃ c ∈ V(P₀), ∃ R : Graph α β, + IsGraphPathWithEnds G R (η.vMap b) c ∧ + V(R) ∩ V(η'.imageGraph) ⊆ η.vMap '' X ∧ Disjoint V(R) Z := by + let J := H.interSet (closure O \ I) + have hJH : J.IsSubdrawing H := interSet_isSub + have hJClosed : IsClosed (closure O \ I) := isClosed_closure.sdiff hI.isOpenDisc.1 + have hJInside : J.U ⊆ Λ y := fun _ hx => hOuter ((interSet_U_subset hJClosed hx).1) + have haH : a ∈ H.V := hP.1 (graphPath_of_drawingPath hP hPath).right_mem + have hH : IsGraphConnected H.toGraph := + ⟨⟨a, haH⟩, fun x hx z hz => drawing_walk_of_twoCell hS hMet.1.1 hx hz⟩ + have hConn : IsGraphConnected J.toGraph := annular_subdrawing_connected hS hI hO hNest hH + have hMeet : (P.V ∩ J.V).Nonempty := + drawingPath_meets_annular_subdrawing hI hO hNest hP (drawingPath_symm hPath) ha hb + have hJClear : Disjoint J.V (clearEnvelopeDrawing H Y Λ).V := by + apply disjoint_left.mpr + intro x hxJ hxClear + have hxΛ := hJInside (J.V_subset_U hxJ) + have hxOut := (clearFamily_U hZone ▸ (clearEnvelopeDrawing H Y Λ).V_subset_U hxClear).2 + exact hxOut (mem_iUnion₂.mpr ⟨y, hy, hxΛ⟩) + have hPZ' : Disjoint (η.vMap '' P.V) Z := by + apply disjoint_left.mpr + rintro x ⟨z, hz, rfl⟩ hxZ + exact hPZ.notMem_of_mem_left hz ⟨hP.1 hz, hxZ⟩ + have hJZ : Disjoint (η.vMap '' J.V) Z := by + apply disjoint_left.mpr + rintro x ⟨z, hz, rfl⟩ hxZ + exact hClean.notMem_of_mem_left (interSet_U_subset hJClosed (J.V_subset_U hz)) + ⟨hJH.1 hz, hxZ⟩ + apply span_connected_extension_gives_attachment η η' interSet_isSub hMap + hP hPath hJH hConn hMeet hHit _ hJClear hPZ' hJZ + intro x hx + have hxb : x = b := mem_singleton_iff.mp (hPClear ▸ hx) + exact hxb ▸ hbX + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9AnnularSeparation.lean b/LeanPool/GraphMinor/GM16/Section9AnnularSeparation.lean new file mode 100644 index 0000000000..cea990d7e8 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9AnnularSeparation.lean @@ -0,0 +1,82 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.Section9ZoneCuts +import LeanPool.GraphMinor.GM16.Section9Uncross +import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Normalizing the Menger separation between two boundaries + +Join the inner side of the separator to the closed inner zone and +cut off everything beyond the outer zone. The zone boundary vertices +already belong to the corresponding sides, so this uncrossing does +not enlarge the separator. The resulting inner side contains every +edge in the inner closed disc and only edges in the outer open disc. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- The annular normalization in the planar Menger argument of +XVI (8.1), Claim (10), page 73. -/ +theorem exists_annular_separation {H : Drawing S} {d : Set S → Set S → ℕ} + {γ γ' : ℕ} {z Λ M : Set S} {A B : Hypergraph S (Set S)} + (hΛ : IsLambdaZoneAround H d γ z Λ) (hM : IsLambdaZoneAround H d γ' z M) + (hNest : closure M ⊆ Λ) (hSep : H.toHypergraph.IsSeparation A B) + (hInner : H.V ∩ subBd M ⊆ A.vertexSet) (hOuter : H.V ∩ subBd Λ ⊆ B.vertexSet) : + ∃ A' B' : Hypergraph S (Set S), H.toHypergraph.IsSeparation A' B' ∧ + Hypergraph.separationOrder A' B' ≤ Hypergraph.separationOrder A B ∧ + (∀ e ∈ A'.edgeSet, e ⊆ Λ) ∧ + ∀ e ∈ H.E, e ⊆ closure M → e ∈ A'.edgeSet := by + let C := (PaintingOrDrawing.drawing H).inter (closure M) + let D := ((PaintingOrDrawing.drawing H).inter (univ \ M)).deleteEdges C.edgeSet + let E := ((PaintingOrDrawing.drawing H).inter (closure Λ)).deleteEdges + ((PaintingOrDrawing.drawing H).inter (univ \ Λ)).edgeSet + let F := (PaintingOrDrawing.drawing H).inter (univ \ Λ) + have hCD : H.toHypergraph.IsSeparation C D := (zone_cut_separations hM).1 + have hEF : H.toHypergraph.IsSeparation E F := (zone_cut_separations hΛ).2 + have hCE : C.edgeSet ⊆ E.edgeSet := by + intro e he + change e ∈ H.E ∧ e ⊆ closure M at he + change (e ∈ H.E ∧ e ⊆ closure Λ) ∧ ¬ (e ∈ H.E ∧ e ⊆ univ \ Λ) + refine ⟨⟨he.1, he.2.trans (hNest.trans subset_closure)⟩, ?_⟩ + intro hnot + obtain ⟨x, hxe⟩ := he.1.1 + exact (hnot.2 hxe).2 (hNest (he.2 hxe)) + have hCF : Disjoint C.vertexSet F.vertexSet := by + apply disjoint_left.mpr + rintro x ⟨_, hxM⟩ ⟨_, _, hxΛ⟩ + exact hxΛ (hNest hxM) + have hInner' : C.vertexSet ∩ D.vertexSet ⊆ A.vertexSet := by + rintro x ⟨⟨hxH, hxCl⟩, _, _, hxNot⟩ + exact hInner ⟨hxH, hxCl, subset_closure ⟨mem_univ _, hxNot⟩⟩ + have hOuter' : E.vertexSet ∩ F.vertexSet ⊆ B.vertexSet := by + rintro x ⟨⟨hxH, hxCl⟩, _, _, hxNot⟩ + exact hOuter ⟨hxH, hxCl, subset_closure ⟨mem_univ _, hxNot⟩⟩ + obtain ⟨hSep', hCutSub, hEdgesIn, hLeE⟩ := + uncross_annular_separation hSep hCD hEF hCE hCF hInner' hOuter' + refine ⟨(A ∪ C) ∩ E, (B ∩ D) ∪ F, hSep', ?_, ?_, ?_⟩ + · exact ncard_le_ncard hCutSub (A ∩ B).vertexSet_finite + · intro e he + have heE := hLeE.2 he + change (e ∈ H.E ∧ e ⊆ closure Λ) ∧ ¬ (e ∈ H.E ∧ e ⊆ univ \ Λ) at heE + rcases edge_subset_or_subset_compl_of_zone hΛ heE.1.1 with heIn | heOut + · exact heIn + · exact False.elim (heE.2 ⟨heE.1.1, heOut⟩) + · intro e heH heM + exact hEdgesIn ⟨heH, heM⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Annuli.lean b/LeanPool/GraphMinor/GM16/Section9Annuli.lean new file mode 100644 index 0000000000..18de22f6e3 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Annuli.lean @@ -0,0 +1,101 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.Section9NestedZones +import Mathlib.Data.Set.Card + +/-! +# Choosing an annulus untouched by the separator + +After Claim (12) of XVI (8.1), Section 9 takes `κ` annuli at indices +spaced by `ψ + 5`. The gap between consecutive annuli is at least +three, so their closed point sets are disjoint. A set with fewer than +`κ` points misses one of them. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe u w + +/-- The pigeonhole argument after Claim (12) in XVI (8.1), page 74. -/ +theorem exists_disjoint_of_pairwise_disjoint {α : Type u} {κ : ℕ} + (A : Fin κ → Set α) (hDis : Pairwise (fun i j => Disjoint (A i) (A j))) + (Z : Set α) (hZ : Z.Finite) (hCard : Z.ncard < κ) : ∃ i, Disjoint (A i) Z := by + classical + by_contra hn + have hex : ∀ i, ∃ x, x ∈ A i ∧ x ∈ Z := by + intro i + have hNot : ¬ Disjoint (A i) Z := fun h => hn ⟨i, h⟩ + exact not_disjoint_iff.mp hNot + choose x hxA hxZ using hex + have hinj : Function.Injective x := by + intro i j heq + by_contra hij + exact (hDis hij).notMem_of_mem_left (hxA i) (heq.symm ▸ hxA j) + have hsub : range x ⊆ Z := range_subset_iff.mpr hxZ + have hc := ncard_le_ncard hsub hZ + rw [ncard_range_of_injective hinj, Nat.card_fin] at hc + omega + +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The annuli chosen after Claim (12) of XVI (8.1), page 74, are +pairwise disjoint. The inner and outer indices lie in the specified +range of the zone family. -/ +theorem section9_annuli_pairwise_disjoint {H : Drawing S} {d : Set S → Set S → ℕ} + {y : S} {M : ℕ → Set S} {β κ ψ : ℕ} + (hκ : 3 ≤ κ) (hψ : 3 ≤ ψ) + (hMax : κ + (κ - 1) * (ψ + 5) ≤ β - ψ - 5) + (hM : ∀ i, 3 ≤ i → i ≤ β - 3 → + IsLambdaZoneAround H d (i + 2) {y} (M i) ∧ + ∀ a ∈ H.A, d {y} a < i → a ⊆ M i) : + Pairwise (fun r s : Fin κ => + Disjoint (closure (M (κ + r.val * (ψ + 5) + ψ + 2)) \ M (κ + r.val * (ψ + 5))) + (closure (M (κ + s.val * (ψ + 5) + ψ + 2)) \ M (κ + s.val * (ψ + 5)))) := by + have hIndex : ∀ r : Fin κ, + 3 ≤ κ + r.val * (ψ + 5) ∧ κ + r.val * (ψ + 5) + ψ + 2 ≤ β - 3 := by + intro r + have hr : r.val ≤ κ - 1 := by omega + have hm := Nat.mul_le_mul_right (ψ + 5) hr + omega + have hOrdered : ∀ r s : Fin κ, r < s → + Disjoint (closure (M (κ + r.val * (ψ + 5) + ψ + 2)) \ M (κ + r.val * (ψ + 5))) + (closure (M (κ + s.val * (ψ + 5) + ψ + 2)) \ M (κ + s.val * (ψ + 5))) := by + intro r s hrs + have hmul := Nat.mul_le_mul_right (ψ + 5) (Nat.succ_le_of_lt hrs) + rw [Nat.succ_mul] at hmul + have hgap : κ + r.val * (ψ + 5) + ψ + 2 + 3 ≤ κ + s.val * (ψ + 5) := by omega + have hr := hIndex r + have hs := hIndex s + have hSub := section9_nested_closures (hM _ (by omega) hr.2).1 + (hM _ hs.1 (by omega)).2 hgap + exact disjoint_left.mpr fun x hx hy => hy.2 (hSub hx.1) + intro r s hrs + rcases lt_or_gt_of_ne hrs with hlt | hgt + · exact hOrdered r s hlt + · exact (hOrdered s r hgt).symm + +/-- The clean annulus used for Claim (14) in XVI (8.1), page 74. -/ +theorem section9_exists_clean_annulus {H : Drawing S} {d : Set S → Set S → ℕ} + {y : S} {M : ℕ → Set S} {β κ ψ : ℕ} + (hκ : 3 ≤ κ) (hψ : 3 ≤ ψ) + (hMax : κ + (κ - 1) * (ψ + 5) ≤ β - ψ - 5) + (hM : ∀ i, 3 ≤ i → i ≤ β - 3 → + IsLambdaZoneAround H d (i + 2) {y} (M i) ∧ + ∀ a ∈ H.A, d {y} a < i → a ⊆ M i) + (Z : Set S) (hZ : Z.Finite) (hCard : Z.ncard < κ) : + ∃ r : Fin κ, Disjoint + (closure (M (κ + r.val * (ψ + 5) + ψ + 2)) \ M (κ + r.val * (ψ + 5))) Z := + exists_disjoint_of_pairwise_disjoint _ (section9_annuli_pairwise_disjoint hκ hψ hMax hM) Z hZ + hCard + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Attachments.lean b/LeanPool/GraphMinor/GM16/Section9Attachments.lean new file mode 100644 index 0000000000..1e883f2b5f --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Attachments.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section3c + +/-! +# Trimming the attachment paths in XVI (8.1) + +For Claim (9), an attachment from a boundary set to the bad path can +be trimmed at its last boundary vertex and first vertex of that path. +Its only vertex in the cleared drawing is then its initial vertex. +A simple path with only one vertex in a subgraph has no edge there. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM14 +universe u v + +/-- A path whose intersection with a subgraph is a singleton has no +edge in that subgraph, since such an edge would be a loop in the path. -/ +theorem path_edges_disjoint_of_singleton_inter {α : Type u} {β : Type v} + {G H P : Graph α β} {a b x : α} (hHG : H ≤ G) + (hP : IsGraphPathWithEnds G P a b) (hInter : V(P) ∩ V(H) ⊆ {x}) : + Disjoint E(P) E(H) := by + apply disjoint_left.mpr + intro e heP heH + obtain ⟨u, v, hl⟩ := P.exists_isLink_of_mem_edgeSet heP + have hlG := hP.1.isLink_mono hl + have hlH := (hHG.isLink_iff heH).mpr hlG + have hu : u = x := mem_singleton_iff.mp (hInter ⟨hl.left_mem, hlH.left_mem⟩) + have hv : v = x := mem_singleton_iff.mp (hInter ⟨hl.right_mem, hlH.right_mem⟩) + have hLoop : G.IsLink e x x := by simpa only [hu, hv] using hlG + exact hP.not_isLoopAt heP x hLoop + +/-- Trim one of the attachments in XVI (8.1), Claim (9), page 73, so +that it meets the cleared drawing in just its initial boundary vertex. -/ +theorem trim_boundary_attachment {α : Type u} {β : Type v} + {G H Q : Graph α β} {X A : Set α} {a x : α} + (hHG : H ≤ G) (hX : X ⊆ V(H)) (hQ : IsGraphPathWithEnds G Q a x) + (ha : a ∈ X) (hx : x ∈ A) (hQH : V(Q) ∩ V(H) ⊆ X) : + ∃ b ∈ X, ∃ y ∈ A, ∃ R : Graph α β, + R ≤ Q ∧ IsGraphPathWithEnds G R b y ∧ V(R) ∩ V(H) = {b} ∧ Disjoint E(R) E(H) := by + obtain ⟨b, hb, y, hy, R, hRQ, hR⟩ := hQ.exists_isFromToPathWithEnds ha hx + have hInter : V(R) ∩ V(H) = {b} := by + apply subset_antisymm + · rintro z ⟨hzR, hzH⟩ + exact hR.2.1 ▸ ⟨hzR, hQH ⟨hRQ.vertexSet_mono hzR, hzH⟩⟩ + · rintro z rfl + exact ⟨hR.1.left_mem, hX hb⟩ + exact ⟨b, hb, y, hy, R, hRQ, hR.1, hInter, + path_edges_disjoint_of_singleton_inter hHG hR.1 hInter.subset⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9BadPath.lean b/LeanPool/GraphMinor/GM16/Section9BadPath.lean new file mode 100644 index 0000000000..7bc67bc896 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9BadPath.lean @@ -0,0 +1,135 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +public import LeanPool.GraphMinor.GM15.Defs +import LeanPool.GraphMinor.GM16.Section9Claim11 +import LeanPool.GraphMinor.GM16.Section9AnnularAttachment +import LeanPool.GraphMinor.GM16.Section9ConsecutiveVertices +import LeanPool.GraphMinor.GM16.Section9Annuli +import LeanPool.GraphMinor.GM16.Section9NestedZones +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM16.SpanVertexPullback +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM14.Section3 + +import LeanPool.GraphMinor.GM09.Bridge + +import LeanPool.GraphMinor.GM14.Section9a + +/-! +# Excluding the bad path after the attachment choice + +Choose the nested zones and a separator-free annulus. Claim (11) +gives a clean path crossing that annulus. If the bad path met the +annulus, their union would give a forbidden attachment. The bad path +therefore misses the annulus, and the consecutive-vertex argument +finishes the metric contradiction. This assembles Claims (10)–(15) +of XVI (8.1) from their geometric data and the attachment case. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 + GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] +variable {α : Type u} {βe : Type v} + +/-- The contradiction in the last part of XVI (8.1), pages 73–75, +after choosing a battlefield with no clean attachment to the bad +path. The clean annulus, its exclusion, and its consecutive vertices +are derived within the proof. -/ +theorem section9_bad_path_contradiction + (hS : IsClosedSurface S) {G P₀ : Graph α βe} {H : Drawing S} + (η : SpanEmbedding H G) {θ θ' β κ ψ sep : ℕ} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {Y : Set S} + {Λ : S → Set S} {C : S → Drawing S} {X : S → Set S} + (η' : SpanEmbedding (clearEnvelopeDrawing H Y Λ) G) (hMap : η'.vMap = η.vMap) + (hMet : HasTangleMetric H θ T d) + (hNewMet : HasTangleMetric (clearEnvelopeDrawing H Y Λ) θ' T' d') + (hY : Y ⊆ H.V) + (hBattle : ∀ y ∈ Y, IsBattlefield H T d θ β {y} (Λ y) (C y) (X y)) + (hSep : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → sep ≤ d {y} {z}) + (hLe : ∀ x y : S, pointDist (clearEnvelopeDrawing H Y Λ) d' x y ≤ pointDist H d x y) + (hNoPath : ∀ Q s t, s ∈ H.V → t ∈ H.V → + IsHPathWithEnds G η.imageGraph Q (η.vMap s) (η.vMap t) → + ψ ≤ d {s} {t} → (∀ y ∈ Y, ψ ≤ d {s} {y}) → False) + (hκ : 3 ≤ κ) (hψ : 3 ≤ ψ) (hβ : κ + 3 ≤ β) (hβθ : β < θ) + (hθ : κ + (3 * β + 3) < θ) (hSepBudget : 2 * (3 * β + 3) + 2 * ψ < sep) + (hMax : κ + (κ - 1) * (ψ + 5) ≤ β - ψ - 5) + {Z : Set α} (hZ : Z.Finite) (hCard : Z.ncard < κ) + {y s₁ s₂ t₁ : S} (hy : y ∈ Y) (ht₁ : t₁ ∈ H.V) + (hs₁ : s₁ ∈ (clearEnvelopeDrawing H Y Λ).V) + (hs₂ : s₂ ∈ (clearEnvelopeDrawing H Y Λ).V) + (hP₀ : IsHPathWithEnds G η'.imageGraph P₀ (η.vMap s₁) (η.vMap s₂)) + (ht₁Λ : t₁ ∈ Λ y) (hShort₁ : d {s₁} {t₁} < ψ) + (hLong : 2 * ψ ≤ d' {s₁} {s₂}) + (hNoAttach : ∀ b ∈ X y, ∀ c ∈ V(P₀), ∀ R : Graph α βe, + IsGraphPathWithEnds G R (η.vMap b) c → + V(R) ∩ V(η'.imageGraph) ⊆ η.vMap '' X y → Disjoint V(R) Z → False) : False := by + classical + have hZone := fun z hz => (hBattle z hz).isZone + obtain ⟨_, _, _, hSymm, hTri, _⟩ := GM11.gm15_theorem_9_1 H θ T d hS inferInstance hMet + obtain ⟨_, _, _, hNewSymm, hNewTri, _⟩ := GM11.gm15_theorem_9_1 + (clearEnvelopeDrawing H Y Λ) θ' T' d' hS inferInstance hNewMet + have hFar : ∀ z ∈ Y, ∀ w ∈ Y, z ≠ w → 2 * (3 * β + 3) < d {z} {w} := by + intro z hz w hw hzw + exact lt_of_lt_of_le (by omega) (hSep z hz w hw hzw) + have hdis : ∀ z ∈ Y, ∀ w ∈ Y, z ≠ w → + Disjoint (closure (Λ z)) (closure (Λ w)) := by + intro z hz w hw hzw + exact section9_disjoint_zones (hZone z hz) (hZone w hw) hSymm hTri + (Nat.le_refl _) (hFar z hz w hw hzw) + obtain ⟨M, hM⟩ := section9_exists_nested_zones hS (hY hy) hMet hβθ + have hκβ : κ ≤ β - 3 := by omega + let ZS := H.V ∩ η.vMap ⁻¹' Z + obtain ⟨hZS, hZSCard⟩ := span_vertex_pullback_card η hZ + have hZSκ : ZS.ncard < κ := lt_of_le_of_lt hZSCard hCard + obtain ⟨r, hClean⟩ := section9_exists_clean_annulus hκ hψ hMax hM ZS hZS hZSκ + let i := κ + r.val * (ψ + 5) + have hr : r.val ≤ κ - 1 := by omega + have hMul := Nat.mul_le_mul_right (ψ + 5) hr + have hi : 3 ≤ i := by dsimp [i]; omega + have hij : i + ψ + 2 ≤ β - 3 := by dsimp [i]; omega + have hiβ : i ≤ β - 3 := by omega + have hI := (hM i hi hiβ).1 + have hO := (hM (i + ψ + 2) (by omega) hij).1 + have hNest : closure (M i) ⊆ M (i + ψ + 2) := + section9_nested_closures hI (hM (i + ψ + 2) (by omega) hij).2 (by omega) + have hκNest : closure (M κ) ⊆ M (i + ψ + 2) := + section9_nested_closures (hM κ hκ hκβ).1 + (hM (i + ψ + 2) (by omega) hij).2 (by dsimp [i]; omega) + have hOuter : closure (M (i + ψ + 2)) ⊆ Λ y := + section9_zone_inside_battlefield (hBattle y hy) hO (by omega) + obtain ⟨b, hb, a, ha, P, hPPath, hPH, hPClear, hPZ⟩ := theorem_8_1_claim_11 hS hMet hY hy hBattle + hFar (hM κ hκ hκβ).1 (hM κ hκ hκβ).2 + hκ hβ hθ hZS hZSκ + have haO : a ∈ M (i + ψ + 2) := hκNest ha.2.1 + have hbO : b ∉ M (i + ψ + 2) := by + intro hbo + exact ((isOpen_disjoint_subBd_and_closure_eq (hZone y hy).isOpenDisc.1).1).notMem_of_mem_left + (hOuter (subset_closure hbo)) ((hBattle y hy).isFree_X.1 hb).2 + have hMiss : Disjoint V(P₀) (η.vMap '' (H.interSet + (closure (M (i + ψ + 2)) \ M i)).V) := by + apply disjoint_left.mpr + intro x hxP₀ hxJ + have hHit : (V(P₀) ∩ (η.vMap '' (H.interSet + (closure (M (i + ψ + 2)) \ M i)).V)).Nonempty := ⟨x, hxP₀, hxJ⟩ + obtain ⟨c, hc, R, hR, hRClear, hRZ⟩ := section9_annular_intersection_gives_attachment + hS η hMet hZone hy η' hMap hI hO hNest hOuter hPH hPPath hb haO hbO hPClear hPZ hClean hHit + exact hNoAttach b hb c hc R hR hRClear hRZ + exact section9_contradiction_of_clean_annulus hS η η' hMap hMet hY hZone hdis + hSymm hTri hNewSymm hNewTri hLe hNoPath hψ hSepBudget hy ht₁ hs₁ hs₂ hP₀ + (fun z hz hyz => hSep y hy z hz hyz) hI hNest hOuter + (hM (i + ψ + 2) (by omega) hij).2 hMiss ht₁Λ hShort₁ hLong + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9BattlefieldFree.lean b/LeanPool/GraphMinor/GM16/Section9BattlefieldFree.lean new file mode 100644 index 0000000000..ab5fc43f7b --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9BattlefieldFree.lean @@ -0,0 +1,145 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +public import LeanPool.GraphMinor.GM15.Section4 +import LeanPool.GraphMinor.GM16.Section9FreeFamily +import LeanPool.GraphMinor.GM16.Section9Compressions +import LeanPool.GraphMinor.GM16.Section9Dials +import LeanPool.GraphMinor.GM16.Section9ZonePreservation +import LeanPool.GraphMinor.GM11.Section810 + +import LeanPool.GraphMinor.GM11.CitedResults + +import LeanPool.GraphMinor.GM12.Section710 + +import LeanPool.GraphMinor.GM12.Section77 + +/-! +# Free battlefield boundaries after all clearings + +For Claim (3) in XVI (8.1), clear a chosen battlefield first. Its +boundary set is free by the definition of a battlefield. Separation +of the centres keeps this set far from every later clearing. The +uniqueness of the total compression identifies this order of clearing +with any previously chosen order. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- Graph Minors XVI, proof of (8.1), Claim (3), page 72, including the +order-independence argument following the claim. The displayed parameter +bound below is supplied by Section 9's choices of constants. -/ +theorem battlefield_free_after_clearFamily + (hS : IsClosedSurface S) + {H : Drawing S} {θ β sep : ℕ} {ys : Finset S} + {Λ : S → Set S} {C : S → Drawing S} {X : S → Set S} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} (hY : ∀ y ∈ ys, y ∈ H.V) + (hBattle : ∀ y ∈ ys, IsBattlefield H T d θ β {y} (Λ y) (C y) (X y)) + (hdis : ∀ y ∈ ys, ∀ z ∈ ys, y ≠ z → Disjoint (closure (Λ y)) (closure (Λ z))) + (hsep : ∀ y ∈ ys, ∀ z ∈ ys, y ≠ z → sep ≤ d {y} {z}) + (hparam : 2 * β + 6 * (3 * β + 3) + 2 + (4 * (3 * β + 3) + 2) * ys.card < sep) + (hComp : IsLambdaCompression H (clearEnvelopeDrawing H (ys : Set S) Λ) + θ ((4 * (3 * β + 3) + 2) * ys.card) T T' d d') : + ∀ j ∈ ys, IsFreeSet (clearEnvelopeDrawing H (ys : Set S) Λ).toHypergraph T' + (θ - (4 * (3 * β + 3) + 2) * ys.card) (X j) := by + classical + intro j hj + let γ := 3 * β + 3 + let c := 4 * γ + 2 + let zs := ys.erase j + have hcard : zs.card + 1 = ys.card := Finset.card_erase_add_one hj + have hθj : c < θ := by + have hc := hComp.lam_lt + change c * ys.card < θ at hc + have hmul := Nat.mul_le_mul_left c (show 1 ≤ ys.card by omega) + omega + obtain ⟨hXbd, hXcard, T₁, d₁, hClear, hFree₁⟩ := (hBattle j hj).isFree_X + have hMet₁ : HasTangleMetric (clearedSubdrawing H (Λ j)) (θ - c) T₁ d₁ := by + simpa only [γ, c, Nat.sub_sub] using hClear.hasMetric + have hFree₁' : IsFreeSet (clearedSubdrawing H (Λ j)).toHypergraph T₁ (θ - c) (X j) := by + simpa only [γ, c, Nat.sub_sub] using hFree₁ + have hZone := fun y hy => (hBattle y hy).isZone + have hY₁ : ∀ y ∈ zs, y ∈ (clearedSubdrawing H (Λ j)).V := by + intro y hy + obtain ⟨hyj, hy⟩ := Finset.mem_erase.mp hy + exact (mem_interSet_V_iff (isClosed_univ.sdiff (hZone j hj).isOpenDisc.1)).mpr + ⟨hY y hy, mem_univ _, fun hyΩ => (hdis y hy j hj hyj).notMem_of_mem_left + (subset_closure ((hZone y hy).z_subset (mem_singleton y))) (subset_closure hyΩ)⟩ + have hZone₁ : ∀ y ∈ zs, + IsLambdaZoneAround (clearedSubdrawing H (Λ j)) d₁ γ {y} (Λ y) := by + intro y hy + obtain ⟨hyj, hy⟩ := Finset.mem_erase.mp hy + exact zone_after_disjoint_clearing (hY y hy) (hZone y hy) (hZone j hj) + (hdis y hy j hj hyj) hClear + obtain ⟨_, _, _, hsymm, htri, _⟩ := GraphMinor.GM11.gm15_theorem_9_1.{w} H θ T d hS inferInstance + hComp.hasMetric + have hFar : ∀ y ∈ zs, ∀ v ∈ X j, + 2 * (X j).ncard + 5 * γ + 2 + c * zs.card < d₁ {y} {v} := by + intro y hy v hv + obtain ⟨hyj, hy⟩ := Finset.mem_erase.mp hy + have hyA : ({y} : Set S) ∈ H.A := Or.inl (Or.inl ⟨y, hY y hy, rfl⟩) + have hjA := (hZone j hj).z_mem + have hvH := (hXbd hv).1 + have hvA : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hvH, rfl⟩) + have hdv := (hZone j hj).dist_le {v} hvA + (singleton_subset_iff.mpr (hXbd hv).2.1) + have htri' := htri {y} hyA {v} hvA {j} hjA + rw [hsymm {v} hvA {j} hjA] at htri' + have hsep' := hsep y hy j hj hyj + have hc := (compression_of_clearing hComp.hasMetric hθj hClear).dist_le y v + rw [pointDist_eq_of_mem_atom hyA hvA (mem_singleton y) (mem_singleton v), + pointDist_eq_of_mem_atom (Or.inl (Or.inl ⟨y, hY₁ y (Finset.mem_erase.mpr ⟨hyj, hy⟩), rfl⟩)) + (Or.inl (Or.inl ⟨v, hFree₁'.1 hv, rfl⟩)) (mem_singleton y) (mem_singleton v)] at hc + change d {y} {v} ≤ d₁ {y} {v} + c at hc + change d {j} {v} ≤ γ at hdv + change d {y} {j} ≤ d {y} {v} + d {j} {v} at htri' + have hpc : 2 * β + 6 * γ + 2 + c * ys.card < sep := hparam + rw [← hcard, Nat.mul_add c, Nat.mul_one] at hpc + rw [hXcard] + omega + have hθrem : c * zs.card < θ - c := by + have hc := hComp.lam_lt + change c * ys.card < θ at hc + rw [← hcard, Nat.mul_add, Nat.mul_one] at hc + omega + obtain ⟨T₂, d₂, hComp₂, _, hFree₂⟩ := exists_free_compression_clearFamily hS zs Λ γ + (by dsimp [γ]; omega) (X j) hMet₁ hY₁ hZone₁ + (fun y hy z hz hne => hdis y (Finset.mem_of_mem_erase hy) z (Finset.mem_of_mem_erase hz) hne) + hθrem hFree₁' hFar + have hSet : insert j (zs : Set S) = (ys : Set S) := by + rw [← Finset.coe_insert, Finset.insert_erase hj] + have hDraw : clearEnvelopeDrawing (clearedSubdrawing H (Λ j)) (zs : Set S) Λ = + clearEnvelopeDrawing H (ys : Set S) Λ := by + have hopen : ∀ y ∈ insert j (zs : Set S), IsOpen (Λ y) := by + intro y hy + have hmem : y ∈ ys := by + change y ∈ (ys : Set S) + rw [← hSet] + exact hy + exact (hZone y hmem).isOpenDisc.1 + rw [clearFamily_after_single _ _ _ _ hopen, hSet] + have hTot := compression_comp (compression_of_clearing hComp.hasMetric hθj hClear) hComp₂ + rw [hDraw] at hTot hFree₂ + have hLoss : c + c * zs.card = c * ys.card := by + rw [← hcard, Nat.mul_add, Nat.mul_one, Nat.add_comm] + rw [hLoss] at hTot + have hT : T₂ = T' := compression_unique hS inferInstance hTot hComp + rw [hT] at hFree₂ + have hOrder : θ - c - c * zs.card = θ - c * ys.card := by rw [Nat.sub_sub, hLoss] + rw [hOrder] at hFree₂ + exact hFree₂ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9BattlefieldLinked.lean b/LeanPool/GraphMinor/GM16/Section9BattlefieldLinked.lean new file mode 100644 index 0000000000..260ef7929b --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9BattlefieldLinked.lean @@ -0,0 +1,119 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.GM16.AnnularPathTrim +import LeanPool.GraphMinor.GM16.LineBoundarySide +import LeanPool.GraphMinor.GM16.DrawingGraphPaths +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM14.Section6a +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM09.Basic + +/-! +# The battlefield boundary set is linked in its annulus + +Trim each of the disjoint battlefield paths at its last inner-circle +vertex. The original path stays in the closed battlefield disc because +it meets the outer boundary only at its outer end. Its trimmed path +stays outside the inner disc and meets each boundary just once. Thus +these paths witness linkedness for IX (10.5), as used in XVI (8.1), +Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +omit [ConnectedSpace S] in +/-- The disjoint paths in a battlefield witness linkedness of its +chosen outer set in the annular neighborhood of XVI (8.1), Claim (11). -/ +theorem section9_battlefield_linked (hS : IsClosedSurface S) + {H C : Drawing S} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {θ β : ℕ} {z Λ X D₀ : Set S} + (hB : IsBattlefield H T d θ β z Λ C X) + (hD₀ : IsClosedDisc D₀) (hD₀D : D₀ ⊆ closure Λ) (hD₀bd : discBd D₀ = C.U) + (N : Neighborhood S (Set S)) + (hG : N.G = (H.interSet (closure Λ \ discInt D₀)).toGraph) + (hΩ : N.Ω.bar = H.V ∩ subBd Λ) + (hΩ₀ : N.Ω₀.bar = (H.interSet (closure Λ \ discInt D₀)).V ∩ C.U) : + N.IsLinked X := by + classical + let Q := H.interSet (closure Λ \ discInt D₀) + have hInt : discInt D₀ = interior D₀ := by + change D₀ \ discBd D₀ = interior D₀ + rw [← IsClosedDisc.subBd_eq_discBd hS hD₀, subBd_eq_frontier, self_sdiff_frontier] + have hfr₀ : frontier D₀ = C.U := by + rw [← subBd_eq_frontier, IsClosedDisc.subBd_eq_discBd hS hD₀, hD₀bd] + have hfr : frontier (closure Λ) = subBd Λ := by + rw [← subBd_eq_frontier] + exact subBd_closure_eq_subBd_of_isOpenDisc hS hB.isZone.isOpenDisc + hB.isZone.isOArc_bd hB.isZone.isClosedDisc_closure + have hΛdis := (isOpen_disjoint_subBd_and_closure_eq hB.isZone.isOpenDisc.1).1 + have hOut : ∀ v ∈ X, v ∉ D₀ := by + intro v hv hvD + have hvbd := (hB.isFree_X.1 hv).2 + have hvni : v ∉ interior (closure Λ) := (hfr.symm ▸ hvbd).2 + have hvn₀ : v ∉ interior D₀ := fun hi => hvni (interior_mono hD₀D hi) + have hvfr : v ∈ frontier D₀ := ⟨subset_closure hvD, hvn₀⟩ + exact hΛdis.notMem_of_mem_left + (hB.circuit_and_paths.2.2.1 (hfr₀ ▸ hvfr)) hvbd + obtain ⟨P, hP, hDis⟩ := hB.circuit_and_paths.2.2.2 + choose a ha b hb hPath hPH hBoundary using hP + have hInside (i : Fin β) : (P i).U ⊆ closure Λ := by + have haΛ := hB.circuit_and_paths.2.2.1 (C.V_subset_U (ha i)) + have hbBd := (hB.isFree_X.1 (hb i)).2 + have hab : a i ≠ b i := fun heq => + hΛdis.notMem_of_mem_left (heq ▸ haΛ) hbBd + apply line_subset_closed_of_boundary_end isClosed_closure + (GM11.isLine_of_isPathBetween (hPath i) hab) (subset_closure haΛ) hab hbBd.1 + intro x hx + exact (hBoundary i ▸ (show x ∈ (P i).U ∩ (H.U ∩ subBd Λ) from + ⟨hx.1, (hPH i).U_subset hx.1, hfr ▸ hx.2⟩)) + have hTrim (i : Fin β) := exists_annular_terminal_path + hB.circuit_and_paths.2.1 (hPH i) (hPath i) (ha i) + hD₀.isCompact.isClosed hfr₀ (hOut (b i) (hb i)) (hInside i) + choose c hc J hJPath hJP hJU hJVC hJUC using hTrim + have hJQ (i : Fin β) : (J i).IsSubdrawing Q := by + apply subdrawing_interSet_of_U_subset ((hJP i).trans (hPH i)) + rw [hInt] + exact hJU i + have hJG (i : Fin β) : IsGraphPathWithEnds N.G (J i).toGraph (b i) (c i) := by + rw [hG] + exact graphPath_of_drawingPath (hJQ i) (hJPath i) + constructor + · exact hΩ.symm ▸ hB.isFree_X.1 + · rw [hB.isFree_X.2.1] + refine ⟨fun i => (J i).toGraph, ?_, ?_⟩ + · intro i + refine ⟨b i, hb i, c i, ?_, hJG i, ?_, ?_⟩ + · rw [hΩ₀] + exact ⟨(hJQ i).1 (hJG i).right_mem, C.V_subset_U (hc i)⟩ + · rw [hΩ] + apply subset_antisymm + · rintro x ⟨hxJ, hxH, hxbd⟩ + have hxP := (hJP i).U_subset ((J i).V_subset_U hxJ) + exact hBoundary i ▸ ⟨hxP, hxH |> H.V_subset_U, hxbd⟩ + · rintro x rfl + exact ⟨(hJG i).left_mem, hB.isFree_X.1 (hb i)⟩ + · rw [hΩ₀] + apply subset_antisymm + · rintro x ⟨hxJ, _, hxC⟩ + exact hJUC i ▸ ⟨(J i).V_subset_U hxJ, hxC⟩ + · rintro x rfl + exact ⟨(hJG i).right_mem, (hJQ i).1 (hJG i).right_mem, C.V_subset_U (hc i)⟩ + · intro i j hij + exact (hDis hij).mono (hJP i).1 (hJP j).1 + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9BattlefieldNeighborhood.lean b/LeanPool/GraphMinor/GM16/Section9BattlefieldNeighborhood.lean new file mode 100644 index 0000000000..c0f9727f34 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9BattlefieldNeighborhood.lean @@ -0,0 +1,138 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.GM16.Section9BattlefieldNest +import LeanPool.GraphMinor.GM16.NestedDiscContainment +import LeanPool.GraphMinor.GM16.AnnulusPresentation +import LeanPool.GraphMinor.GM16.AnnulusBreadth +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM14.Section6a +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.Section88 + +/-! +# The rural neighborhood supplied by a battlefield + +For XVI (8.1), Claim (11), restrict the drawing to the annulus +between the inner battlefield circuit and the outer zone boundary. +The regional-distance bound gives nested circuits by XIV (5.5). +Uniqueness of the inside of a circle puts the inner disc inside all +of their discs. Transporting this annulus to the plane therefore gives +a rural neighborhood with breadth at least half the battlefield size. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The rural neighborhood and its breadth in XVI (8.1), Claim (11), +page 74. Its outer order consists of all vertices on the zone boundary. -/ +theorem section9_battlefield_neighborhood (hS : IsClosedSurface S) + {H C : Drawing S} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {θ β : ℕ} {z Λ X : Set S} + (hB : IsBattlefield H T d θ β z Λ C X) : + ∃ (D₀ : Set S) (N : Neighborhood S (Set S)), + IsClosedDisc D₀ ∧ D₀ ⊆ closure Λ ∧ discBd D₀ = C.U ∧ + N.G = (H.interSet (closure Λ \ discInt D₀)).toGraph ∧ + N.Ω.bar = H.V ∩ subBd Λ ∧ + N.Ω₀.bar = (H.interSet (closure Λ \ discInt D₀)).V ∩ C.U ∧ + N.IsRural ∧ N.HasBreadthGe (β / 2) := by + classical + let : CompactSpace S := hS.1 + have hD := hB.isZone.isClosedDisc_closure + have hbd : subBd (closure Λ) = subBd Λ := + subBd_closure_eq_subBd_of_isOpenDisc hS hB.isZone.isOpenDisc + hB.isZone.isOArc_bd hD + have hCU : C.U ⊆ closure Λ := hB.circuit_and_paths.2.2.1.trans subset_closure + have hCo := IsCircuit.isOArc_U hB.circuit_and_paths.1 + obtain ⟨D₀, hD₀, _⟩ := disc_oArc (closure Λ) C.U hD hCU hCo + have hInt (E : Set S) (hE : IsClosedDisc E) : discInt E = interior E := by + change E \ discBd E = interior E + rw [← IsClosedDisc.subBd_eq_discBd hS hE, subBd_eq_frontier, self_sdiff_frontier] + have hInt₀ := hInt D₀ hD₀.2.1 + let A := closure Λ \ discInt D₀ + have hAc : IsClosed A := by + change IsClosed (closure Λ \ discInt D₀) + rw [hInt₀] + exact isClosed_closure.sdiff isOpen_interior + let Q := H.interSet A + have hQV : ∀ x, x ∈ Q.V ↔ x ∈ H.V ∧ x ∈ A := fun _ => mem_interSet_V_iff hAc + have hOuterA : subBd Λ ⊆ A := by + intro x hx + refine ⟨hx.1, ?_⟩ + rw [hInt₀] + intro hxInt + have hxi := interior_mono hD₀.1 hxInt + have hxb : x ∈ subBd (closure Λ) := hbd.symm ▸ hx + rw [subBd_eq_frontier] at hxb + exact hxb.2 hxi + have hInnerA : C.U ⊆ A := by + intro x hx + have hxb : x ∈ discBd D₀ := hD₀.2.2.1.symm ▸ hx + exact ⟨hD₀.1 (Surface.discBd_subset D₀ hxb), fun h => h.2 hxb⟩ + have hOuterEq : Q.V ∩ discBd (closure Λ) = H.V ∩ subBd Λ := by + rw [← IsClosedDisc.subBd_eq_discBd hS hD, hbd] + ext x + exact ⟨fun h => ⟨(hQV x).mp h.1 |>.1, h.2⟩, + fun h => ⟨(hQV x).mpr ⟨h.1, hOuterA h.2⟩, h.2⟩⟩ + have hXfin : X.Finite := H.finite_V.subset (fun _ hx => (hB.isFree_X.1 hx).1) + have hXne : X.Nonempty := by + apply (ncard_pos hXfin).mp + rw [hB.isFree_X.2.1] + exact lt_of_lt_of_le (by decide : 0 < 4) hB.params_valid.1 + have hne : (Q.V ∩ discBd (closure Λ)).Nonempty := by + rw [hOuterEq] + exact hXne.mono hB.isFree_X.1 + have hne₀ : (Q.V ∩ discBd D₀).Nonempty := by + obtain ⟨c, W, _, _, hCV, _⟩ := hB.circuit_and_paths.1 + have hc : c ∈ C.V := hCV.symm ▸ W.start_mem_support + have hcU := C.V_subset_U hc + exact ⟨c, (hQV c).mpr ⟨hB.circuit_and_paths.2.1.1 hc, hInnerA hcU⟩, + hD₀.2.2.1.symm ▸ hcU⟩ + obtain ⟨N, P, f, hG, hΩ, hΩ₀, _, _, hΔ, hΔ₀, hdisc, hpoints⟩ := + exists_annular_presentation Q hD hD₀.2.1 hD₀.1 (interSet_U_subset hAc) hne hne₀ + obtain ⟨K, B, hK, hNest, hDis⟩ := section9_battlefield_nest hS hB + have hE (i : Fin (β / 2)) : D₀ ⊆ closure (B i) := + closedDisc_subset_of_boundary_subset hD (hK i).2.2.2.2.2.1 hD₀.2.1 + ((hK i).2.2.2.2.1.trans subset_closure) hD₀.1 + (hD₀.2.2.1 ▸ ((hK i).2.2.2.2.2.2.2.2.2.trans subset_closure)) + have hKQ (i : Fin (β / 2)) : (K i).IsSubdrawing Q ∧ (K i).IsCircuit := by + refine ⟨subdrawing_interSet_of_U_subset (hK i).1 ?_, (hK i).2.1⟩ + intro x hx + refine ⟨subset_closure ((hK i).2.2.1 hx), ?_⟩ + rw [hInt₀] + intro hxi + have hxb : x ∈ subBd (closure (B i)) := (hK i).2.2.2.2.2.2.2.1.symm ▸ hx + rw [subBd_eq_frontier] at hxb + exact hxb.2 (interior_mono (hE i) hxi) + have hBreadth : N.HasBreadthGe (β / 2) := by + apply hasBreadthGe_of_drawing_nest P Q hG hΔ hΔ₀ hdisc hpoints K + (fun i => closure (B i)) hKQ hDis + · intro i + refine ⟨(hK i).2.2.2.2.2.1, ?_, hE i, + (hK i).2.2.2.2.1.trans subset_closure⟩ + rw [← IsClosedDisc.subBd_eq_discBd hS (hK i).2.2.2.2.2.1] + exact (hK i).2.2.2.2.2.2.2.1 + · intro i j hij + rcases eq_or_lt_of_le hij with rfl | hlt + · exact Subset.rfl + · exact (hNest i j hlt).trans subset_closure + refine ⟨D₀, N, hD₀.2.1, hD₀.1, hD₀.2.2.1, hG, + hΩ.trans hOuterEq, ?_, ?_, hBreadth⟩ + · exact hΩ₀.trans (by rw [hD₀.2.2.1]) + · exact ⟨P.Γ, P.Δ, P.Δ₀, P.isClosedDisc_Δ, P.Δ₀_subset_Δ, + P.U_subset, P.mem_bd_Δ_iff, P.mem_bd_Δ₀_iff, P.agrees_Δ, P.agrees_Δ₀⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9BattlefieldNest.lean b/LeanPool/GraphMinor/GM16/Section9BattlefieldNest.lean new file mode 100644 index 0000000000..bd47f30aae --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9BattlefieldNest.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM14.Section5 +import LeanPool.GraphMinor.GM14.Section6a +import LeanPool.GraphMinor.Surface.CutLift +import LeanPool.GraphMinor.GM11.OArcCircuit + +/-! +# The nest between the battlefield circuit and its boundary + +In XVI (8.1), Claim (11), the regional distance in a battlefield +supplies the breadth needed by IX (10.5). Apply XIV (5.5) in the +closed battlefield disc to its inner circuit. The resulting circuits +are disjoint and nested, and all their closed discs lie in the open +battlefield disc. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +omit [ConnectedSpace S] in +/-- A circle is arc-connected: either of the two arcs between distinct +points lies in the circle. -/ +theorem oArc_isArcConnected {F : Set S} (hF : IsOArc F) : IsArcConnected F := by + intro x hx y hy hxy + obtain ⟨A, B, hA, _, hAB, _⟩ := hF.lines hx hy hxy + exact ⟨A, fun _ ha => hAB ▸ Or.inl ha, hA⟩ + +/-- The nested circuits used to obtain the breadth in XVI (8.1), +Claim (11), page 74, follow from XIV (5.5). -/ +theorem section9_battlefield_nest (hS : IsClosedSurface S) + {H C : Drawing S} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {θ β : ℕ} {z Λ X : Set S} + (hB : IsBattlefield H T d θ β z Λ C X) : + ∃ (K : Fin (β / 2) → Drawing S) (A : Fin (β / 2) → Set S), + (∀ i, (K i).IsSubdrawing H ∧ (K i).IsCircuit ∧ + (K i).U ⊆ Λ ∧ IsOpenDisc (A i) ∧ closure (A i) ⊆ Λ ∧ + IsClosedDisc (closure (A i)) ∧ subBd (A i) = (K i).U ∧ + subBd (closure (A i)) = (K i).U ∧ + closure (A i) \ (K i).U = A i ∧ C.U ⊆ A i) ∧ + (∀ i j, i < j → closure (A i) ⊆ A j) ∧ + Pairwise (fun i j => Disjoint (K i).U (K j).U) := by + have hbd : subBd (closure Λ) = subBd Λ := + subBd_closure_eq_subBd_of_isOpenDisc hS hB.isZone.isOpenDisc + hB.isZone.isOArc_bd hB.isZone.isClosedDisc_closure + have hdiff : closure Λ \ subBd (closure Λ) = Λ := by + rw [hbd, subBd_eq_frontier, closure_sdiff_frontier, hB.isZone.isOpenDisc.1.interior_eq] + have hCU : C.U ⊆ closure Λ \ subBd (closure Λ) := hdiff.symm ▸ hB.circuit_and_paths.2.2.1 + have hCo : IsOArc C.U := IsCircuit.isOArc_U hB.circuit_and_paths.1 + have hCne : C.U.Nonempty := by + obtain ⟨φ⟩ := hCo + exact ⟨(φ 1).val, (φ 1).prop⟩ + have hDist : β / 2 + 1 ≤ regionalDistance H C.U (subBd (closure Λ)) := by + rw [hbd, Nat.add_comm] + exact hB.regionalDistance_ge + obtain ⟨K, A, hK, hnest, hdis⟩ := theorem_5_5_proof hS H hB.isZone.isClosedDisc_closure + hCU hCne (oArc_isArcConnected hCo) (Nat.succ_le_succ (Nat.zero_le _)) hDist + refine ⟨K, A, ?_, hnest, hdis⟩ + intro i + obtain ⟨hKH, hKC, hKU, hAo, hAcl, hAd, hAb, hAcb, hAdiff, hCA⟩ := hK i + exact ⟨hKH, hKC, hdiff ▸ hKU, hAo, hdiff ▸ hAcl, + hAd, hAb, hAcb, hAdiff, hCA⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9BoundaryVertices.lean b/LeanPool/GraphMinor/GM16/Section9BoundaryVertices.lean new file mode 100644 index 0000000000..c7a8254212 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9BoundaryVertices.lean @@ -0,0 +1,60 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.ClearedPathVertices +import LeanPool.GraphMinor.GM16.Section9Zones + +/-! +# The battlefield boundary vertices survive clearing + +Every boundary point is retained when the separated discs are +cleared. An old vertex at such a point therefore remains a vertex. +Injectivity of the span map also keeps the boundary sets of distinct +battlefields disjoint. These are the endpoint facts used for the +global separator and Claim (9) of XVI (8.1). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] +variable {α : Type u} {β : Type v} + +/-- Every old vertex on a battlefield boundary survives clearing all +members of the separated family. -/ +theorem boundary_vertex_mem_clearFamily {H : Drawing S} {d : Set S → Set S → ℕ} + {Y : Set S} {γ : ℕ} {Λ : S → Set S} + (hZone : ∀ y ∈ Y, IsLambdaZoneAround H d γ {y} (Λ y)) + (hDis : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → Disjoint (closure (Λ y)) (closure (Λ z))) + {y x : S} (hy : y ∈ Y) (hx : x ∈ H.V ∩ subBd (Λ y)) : + x ∈ (clearEnvelopeDrawing H Y Λ).V := by + have hxU := zone_boundary_subset_clearFamily hZone hDis hy hx.2 + exact mem_clearFamily_of_notMem_union hx.1 (clearFamily_U hZone ▸ hxU).2 + +omit [ConnectedSpace S] in +/-- Distinct battlefield boundary sets remain disjoint after applying +the span vertex map. -/ +theorem battlefield_image_sets_disjoint {H C₁ C₂ : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {θ γ : ℕ} {z₁ z₂ Λ₁ Λ₂ X₁ X₂ : Set S} + (hB₁ : IsBattlefield H T d θ γ z₁ Λ₁ C₁ X₁) + (hB₂ : IsBattlefield H T d θ γ z₂ Λ₂ C₂ X₂) + (hDis : Disjoint (closure Λ₁) (closure Λ₂)) : + Disjoint (η.vMap '' X₁) (η.vMap '' X₂) := by + apply disjoint_left.mpr + rintro x ⟨a, ha, rfl⟩ ⟨b, hb, hba⟩ + have haH := hB₁.isFree_X.1 ha + have hbH := hB₂.isFree_X.1 hb + have hba' := η.bijOn_v.injOn hbH.1 haH.1 hba + exact hDis.notMem_of_mem_left haH.2.1 (hba' ▸ hbH.2.1) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9CircleSelection.lean b/LeanPool/GraphMinor/GM16/Section9CircleSelection.lean new file mode 100644 index 0000000000..2406bc6bc1 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9CircleSelection.lean @@ -0,0 +1,92 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM12.Defs +import LeanPool.GraphMinor.GM16.CircleListing +import LeanPool.GraphMinor.GM16.ErdosSzekeres +import Mathlib.Analysis.SpecialFunctions.Complex.Circle +import Mathlib.Tactic.Linarith + +/-! +# Selecting paths with ends in order on two circles + +This is the Erdős–Szekeres step of XVI (8.1), Claim (4). First order +the ends on one circle. The angle order on the second circle has an +increasing or decreasing subsequence of the desired size. In the +second case invert the circle parameter to reverse its orientation. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface +universe w +variable {S : Type w} [TopologicalSpace S] + +/-- Graph Minors XVI, proof of (8.1), Claim (4), page 72: from `m²` +pairs of distinct boundary points, select `m` pairs that occur in order +on both circles under suitable orientations. -/ +theorem section9_select_circle_orders {F₁ F₂ : Set S} + (φ₁ : Circle ≃ₜ F₁) (φ₂ : Circle ≃ₜ F₂) + (m : ℕ) (hm : 1 ≤ m) (a b : Fin (m ^ 2) → S) + (ha : Function.Injective a) (hb : Function.Injective b) + (haF : ∀ i, a i ∈ F₁) (hbF : ∀ i, b i ∈ F₂) : + ∃ g : Fin m → Fin (m ^ 2), Function.Injective g ∧ + GM12.IsListedInOrderOn F₁ (List.ofFn (a ∘ g)) ∧ + GM12.IsListedInOrderOn F₂ (List.ofFn (b ∘ g)) := by + classical + obtain ⟨e, τ, he, hτ, hτBounds, hτEq⟩ := exists_increasing_circle_angles φ₁ a ha haF + let pt : Fin (m ^ 2) → Circle := fun i => φ₂.symm ⟨b (e i), hbF (e i)⟩ + let angle : Fin (m ^ 2) → ℝ := fun i => Complex.arg (pt i).val + have hEq : ∀ i, (φ₂ (Circle.exp (angle i))).val = b (e i) := by + intro i + rw [show Circle.exp (angle i) = pt i from Circle.exp_arg (pt i)] + exact congrArg Subtype.val (φ₂.apply_symm_apply ⟨b (e i), hbF (e i)⟩) + have hAngle : Function.Injective angle := by + intro i j hij + exact he.1 (hb ((hEq i).symm.trans ((congrArg (fun t => (φ₂ (Circle.exp t)).val) hij).trans + (hEq j)))) + obtain ⟨sel, hsel, hOrder⟩ := erdos_szekeres_subsequence m hm angle hAngle + let g : Fin m → Fin (m ^ 2) := e ∘ sel + have hmpos : 0 < m := by omega + refine ⟨g, he.1.comp hsel.injective, ?_, ?_⟩ + · apply listedInOrderOn_of_angles φ₁ hmpos (a ∘ g) (τ ∘ sel) (hτ.comp hsel) + · intro i + have hi := hτBounds (sel i) + have hzero := hτBounds (sel ⟨0, hmpos⟩) + change τ (sel i) < τ (sel ⟨0, hmpos⟩) + 2 * Real.pi + linarith + · intro i + exact hτEq (sel i) + · rcases hOrder with hMono | hAnti + · apply listedInOrderOn_of_angles φ₂ hmpos (b ∘ g) (angle ∘ sel) hMono + · intro i + have hi := Complex.arg_le_pi (pt (sel i)).val + have hzero := Complex.neg_pi_lt_arg (pt (sel ⟨0, hmpos⟩)).val + change angle (sel i) < angle (sel ⟨0, hmpos⟩) + 2 * Real.pi + dsimp only [angle] at * + linarith + · intro i + exact hEq (sel i) + · let φ₂rev : Circle ≃ₜ F₂ := (Homeomorph.inv Circle).trans φ₂ + let τrev : Fin m → ℝ := fun i => -angle (sel i) + have hRevMono : StrictMono τrev := fun i j hij => neg_lt_neg (hAnti hij) + apply listedInOrderOn_of_angles φ₂rev hmpos (b ∘ g) τrev hRevMono + · intro i + have hi := Complex.neg_pi_lt_arg (pt (sel i)).val + have hzero := Complex.arg_le_pi (pt (sel ⟨0, hmpos⟩)).val + change -angle (sel i) < -angle (sel ⟨0, hmpos⟩) + 2 * Real.pi + dsimp only [angle] at * + linarith + · intro i + change (φ₂ ((Circle.exp (-angle (sel i)))⁻¹)).val = b (e (sel i)) + rw [Circle.exp_neg, inv_inv] + exact hEq (sel i) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Circles.lean b/LeanPool/GraphMinor/GM16/Section9Circles.lean new file mode 100644 index 0000000000..dd90444fbe --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Circles.lean @@ -0,0 +1,105 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.Surface.DiscMerge +import LeanPool.GraphMinor.GM11.Section7 + +/-! +# A circle crossing a zone boundary + +In Claim (2) of the proof of XVI (8.1), a normal circle meets at most two +vertices of the cleared drawing. A circle entering and leaving an open disc +must meet its boundary twice, since removing one point from a circle leaves +a connected set. This is the first step of the rigidity argument there. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface GraphMinor.GM11 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +private theorem preconnected_meets_boundary {F Δ : Set S} (hF : IsPreconnected F) + (hΔ : IsOpen Δ) (hin : (F ∩ Δ).Nonempty) (hout : (F \ closure Δ).Nonempty) : + (F ∩ subBd Δ).Nonempty := by + by_contra hn + have hcover : F ⊆ Δ ∪ (closure Δ)ᶜ := by + intro x hx + by_cases hxΔ : x ∈ Δ + · exact Or.inl hxΔ + · right + intro hxcl + have hxBd : x ∈ subBd Δ := by + rw [subBd_eq_frontier] + exact ⟨hxcl, by simpa only [hΔ.interior_eq] using hxΔ⟩ + exact hn ⟨x, hx, hxBd⟩ + obtain ⟨x, hxF, hxΔ⟩ := hin + obtain ⟨y, hyF, hyΔ⟩ := hout + obtain ⟨z, _, hzΔ, hzout⟩ := hF Δ (closure Δ)ᶜ hΔ isClosed_closure.isOpen_compl hcover + ⟨x, hxF, hxΔ⟩ ⟨y, hyF, hyΔ⟩ + exact hzout (subset_closure hzΔ) + +omit [T2Space S] in +/-- A circle meeting an open disc and the outside of its closure has at least +two boundary points. This is used in XVI, proof of (8.1), Claim (2), page 71. -/ +theorem oArc_crosses_boundary_twice {F Δ : Set S} (hF : IsOArc F) (hΔ : IsOpen Δ) + (hin : (F ∩ Δ).Nonempty) (hout : (F \ closure Δ).Nonempty) + (hfin : (F ∩ subBd Δ).Finite) : 2 ≤ (F ∩ subBd Δ).ncard := by + by_contra hn + have hsmall : (F ∩ subBd Δ).ncard ≤ 1 := by omega + obtain ⟨p, hpF, hpBd⟩ := preconnected_meets_boundary hF.isPreconnected hΔ hin hout + have hall := (Set.ncard_le_one hfin).mp hsmall + have hcl : closure (univ \ Δ) = univ \ Δ := (isClosed_univ.sdiff hΔ).closure_eq + have hpOut : p ∉ Δ := by + have hp := hpBd.2 + rw [hcl] at hp + exact hp.2 + obtain ⟨x, hxF, hxΔ⟩ := hin + obtain ⟨y, hyF, hyOut⟩ := hout + have hxp : x ≠ p := fun heq => hpOut (heq ▸ hxΔ) + have hyp : y ≠ p := fun heq => hyOut (heq ▸ hpBd.1) + have hpre := (isPathConnected_oArc_diff hF hpF).isConnected.isPreconnected + obtain ⟨q, hq, hqBd⟩ := preconnected_meets_boundary hpre hΔ + ⟨x, ⟨hxF, hxp⟩, hxΔ⟩ ⟨y, ⟨hyF, hyp⟩, hyOut⟩ + have hqp : q = p := hall q ⟨hq.1, hqBd⟩ p ⟨hpF, hpBd⟩ + exact hq.2 hqp + +omit [T2Space S] in +/-- In XVI, proof of (8.1), Claim (2), a normal circle meeting at most two +vertices cannot enter two of the pairwise disjoint battlefield discs. -/ +theorem oArc_not_meet_two_discs {K : Drawing S} {F Δ₁ Δ₂ : Set S} + (hF : IsOArc F) (hΔ₁ : IsOpen Δ₁) (hΔ₂ : IsOpen Δ₂) + (hdis : Disjoint (closure Δ₁) (closure Δ₂)) + (hbd₁ : subBd Δ₁ ⊆ K.U) (hbd₂ : subBd Δ₂ ⊆ K.U) + (hnormal : F ∩ K.U ⊆ K.V) (hcard : (F ∩ K.V).ncard ≤ 2) : + ¬ ((F ∩ Δ₁).Nonempty ∧ (F ∩ Δ₂).Nonempty) := by + rintro ⟨⟨x₁, hx₁F, hx₁⟩, ⟨x₂, hx₂F, hx₂⟩⟩ + have hsub₁ : F ∩ subBd Δ₁ ⊆ F ∩ K.V := by + rintro x ⟨hxF, hxBd⟩ + exact ⟨hxF, hnormal ⟨hxF, hbd₁ hxBd⟩⟩ + have hsub₂ : F ∩ subBd Δ₂ ⊆ F ∩ K.V := by + rintro x ⟨hxF, hxBd⟩ + exact ⟨hxF, hnormal ⟨hxF, hbd₂ hxBd⟩⟩ + have hcapFin : (F ∩ K.V).Finite := K.finite_V.subset inter_subset_right + have hfin₁ := hcapFin.subset hsub₁ + have hfin₂ := hcapFin.subset hsub₂ + have hcross₁ := oArc_crosses_boundary_twice hF hΔ₁ ⟨x₁, hx₁F, hx₁⟩ + ⟨x₂, hx₂F, hdis.notMem_of_mem_right (subset_closure hx₂)⟩ hfin₁ + have hcross₂ := oArc_crosses_boundary_twice hF hΔ₂ ⟨x₂, hx₂F, hx₂⟩ + ⟨x₁, hx₁F, hdis.notMem_of_mem_left (subset_closure hx₁)⟩ hfin₂ + have hdisCap : Disjoint (F ∩ subBd Δ₁) (F ∩ subBd Δ₂) := + disjoint_left.mpr fun x hx hy => hdis.notMem_of_mem_left hx.2.1 hy.2.1 + have hcount := ncard_le_ncard (union_subset hsub₁ hsub₂) hcapFin + rw [ncard_union_eq hdisCap hfin₁ hfin₂] at hcount + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Claim10.lean b/LeanPool/GraphMinor/GM16/Section9Claim10.lean new file mode 100644 index 0000000000..c804e90ad3 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Claim10.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.Section9AnnularSeparation +import LeanPool.GraphMinor.GM16.Section9NoAnnularSeparation +import LeanPool.GraphMinor.GM16.Section9NestedZones +import LeanPool.GraphMinor.GM16.DrawingSkeletonPaths +import LeanPool.GraphMinor.Menger.Basic + +/-! +# Claim (10) in the proof of XVI (8.1) + +Apply Menger between the inner and outer boundary vertices. A smaller +separator can be moved into the annulus without increasing its order. +The radial boundary argument then produces the short circuit ruled +out in Claim (10). Lift Menger's skeleton paths back to subdrawings. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- Graph Minors XVI, proof of (8.1), Claim (10), page 73. +There are `κ` mutually disjoint paths of `H` between the two zone +boundaries. The planar Menger duality step is supplied by the proved +annular separation and radial boundary lemmas. -/ +theorem theorem_8_1_claim_10 (hS : IsClosedSurface S) + {H C : Drawing S} {θ β κ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {y : S} {Λ M X : Set S} + (hMet : HasTangleMetric H θ T d) (hy : y ∈ H.V) + (hBattle : IsBattlefield H T d θ β {y} Λ C X) + (hM : IsLambdaZoneAround H d (κ + 2) {y} M) + (hCapture : ∀ a ∈ H.A, d {y} a < κ → a ⊆ M) + (hκ : 3 ≤ κ) (hβ : κ + 3 ≤ β) (hθ : κ + (3 * β + 3) < θ) : + ∃ P : Fin κ → Drawing S, + (∀ i, ∃ u ∈ H.V ∩ subBd M, ∃ v ∈ H.V ∩ subBd Λ, + (P i).IsPathBetween u v ∧ (P i).IsSubdrawing H) ∧ + Pairwise (fun i j => Disjoint (P i).V (P j).V) := by + have hNest : closure M ⊆ Λ := section9_zone_inside_battlefield hBattle hM hβ + have hCriterion : ∀ A B : Hypergraph S (Set S), H.toHypergraph.IsSeparation A B → + H.V ∩ subBd M ⊆ A.vertexSet → H.V ∩ subBd Λ ⊆ B.vertexSet → + κ ≤ Hypergraph.separationOrder A B := by + intro A B hSep hInner hOuter + by_contra hsmall + obtain ⟨A', B', hSep', hOrder', hEdgesOuter, hEdgesInner⟩ := + exists_annular_separation hBattle.isZone hM hNest hSep hInner hOuter + exact section9_no_annular_separation hS hMet hy hBattle.isZone hM hCapture hκ hθ hSep' + (lt_of_le_of_lt hOrder' (Nat.lt_of_not_ge hsmall)) hEdgesOuter hEdgesInner + obtain ⟨p, hDis⟩ := (GraphMinor.menger H.toHypergraph (H.V ∩ subBd M) (H.V ∩ subBd Λ) + inter_subset_left inter_subset_left κ).mp hCriterion + have hex : ∀ i : Fin κ, ∃ P : Drawing S, + P.IsPathBetween (p i).first (p i).last ∧ P.IsSubdrawing H ∧ + P.V = {x | x ∈ (p i).walk.support} := by + intro i + exact drawing_path_of_skeleton_path (p i).first_mem.1 (p i).walk (p i).isPath + choose P hP using hex + refine ⟨P, fun i => ⟨(p i).first, (p i).first_mem, (p i).last, (p i).last_mem, + (hP i).1, (hP i).2.1⟩, ?_⟩ + intro i j hij + rw [(hP i).2.2, (hP j).2.2] + exact hDis hij + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Claim11.lean b/LeanPool/GraphMinor/GM16/Section9Claim11.lean new file mode 100644 index 0000000000..d3113650ce --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Claim11.lean @@ -0,0 +1,168 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +import LeanPool.GraphMinor.GM16.Section9BattlefieldNeighborhood +import LeanPool.GraphMinor.GM16.Section9BattlefieldLinked +import LeanPool.GraphMinor.GM16.Section9InnerCapture +import LeanPool.GraphMinor.GM16.Section9Claim10 +import LeanPool.GraphMinor.GM16.Section9NestedZones +import LeanPool.GraphMinor.GM16.AnnularComposition +import LeanPool.GraphMinor.GM16.RuralLinkage +import LeanPool.GraphMinor.GM16.ZoneBoundaryLinkage +import LeanPool.GraphMinor.GM16.DrawingGraphPaths +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.GM11.OArcCircuit +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.Section88 + +import LeanPool.GraphMinor.GM09.Bridge + +/-! +# The rural linkage in XVI (8.1), Claim (11) + +Construct the rural battlefield annulus, prove its breadth and the +linkedness of the chosen boundary set, and compose it with the inner +society. Claim (10) supplies a disjoint outer-boundary linkage. +IX (10.5) replaces its boundary ends by the chosen free set. Counting +then gives a path avoiding the separator, with no other outer-boundary +vertex. All paths stay in the closed battlefield disc. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The rural-linkage argument of XVI (8.1), Claim (11), page 74. +The path is contained in the closed battlefield disc and has exactly +one vertex on its outer boundary, as needed for the cleared drawing. -/ +theorem section9_boundary_path_avoiding_separator + (hS : IsClosedSurface S) + {H C : Drawing S} {θ β κ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {y : S} {Λ M X Z : Set S} + (hMet : HasTangleMetric H θ T d) (hy : y ∈ H.V) + (hBattle : IsBattlefield H T d θ β {y} Λ C X) + (hM : IsLambdaZoneAround H d (κ + 2) {y} M) + (hCapture : ∀ a ∈ H.A, d {y} a < κ → a ⊆ M) + (hκ : 3 ≤ κ) (hβ : κ + 3 ≤ β) (hθ : κ + (3 * β + 3) < θ) + (hZ : Z.Finite) (hZκ : Z.ncard < κ) : + ∃ b ∈ X, ∃ a ∈ H.V ∩ subBd M, ∃ P : Drawing S, + P.IsPathBetween b a ∧ P.IsSubdrawing H ∧ P.U ⊆ closure Λ ∧ + P.V ∩ (H.V ∩ subBd Λ) = {b} ∧ Disjoint P.V Z := by + classical + obtain ⟨D₀, N, hD₀, hD₀D, hD₀bd, hNG, hΩ, hΩ₀, hRural, hBreadth⟩ := + section9_battlefield_neighborhood hS hBattle + have hLinked := section9_battlefield_linked hS hBattle hD₀ hD₀D hD₀bd N hNG hΩ hΩ₀ + have hInt : discInt D₀ = interior D₀ := by + change D₀ \ discBd D₀ = interior D₀ + rw [← IsClosedDisc.subBd_eq_discBd hS hD₀, subBd_eq_frontier, self_sdiff_frontier] + have hfr₀ : frontier D₀ = C.U := by + rw [← subBd_eq_frontier, IsClosedDisc.subBd_eq_discBd hS hD₀, hD₀bd] + have hNG' : N.G = (H.interSet (closure Λ \ interior D₀)).toGraph := by + simpa only [hInt] using hNG + have hInner : N.Ω₀.bar = (H.interSet (closure Λ \ interior D₀)).V ∩ frontier D₀ := by + simpa only [hInt, hfr₀] using hΩ₀ + obtain ⟨S_comp, S₀, hSG, hSΩ, hS₀G, hComp⟩ := exists_annular_composition H + isClosed_closure hD₀.isCompact.isClosed hD₀D + (hfr₀.symm ▸ IsCircuit.isOArc_U hBattle.circuit_and_paths.1) + (hfr₀.symm ▸ hBattle.circuit_and_paths.2.1.U_subset) N hNG' hInner + let Y := H.V ∩ subBd M + have hCaptureInner : closure M ⊆ discInt D₀ := section9_zone_inside_inner_disc + hS hBattle hD₀ hD₀D hD₀bd hM (by omega) + have hYS₀ : Y ⊆ V(S₀.G) := by + rw [hS₀G] + intro v hv + exact (mem_interSet_V_iff hD₀.isCompact.isClosed).mpr + ⟨hv.1, (hCaptureInner hv.2.1).1⟩ + obtain ⟨P, hP, hDis⟩ := theorem_8_1_claim_10 hS hMet hy hBattle hM hCapture hκ hβ hθ + have hYΛ : Y ⊆ Λ := fun _ hv => (section9_zone_inside_battlefield hBattle hM hβ) hv.2.1 + obtain ⟨Q, hQ, hQdis⟩ := linkage_inside_closed_zone hBattle.isZone hYΛ P hP hDis + have hQ' : ∀ i, IsFromToPath S_comp.G (Q i) S_comp.Ω.bar Y := by + intro i + rw [hSG, hSΩ, hΩ] + exact hQ i + obtain ⟨R, hR, hRdis⟩ := rural_linkage_of_boundary_linkage S_comp S₀ N κ X Y + hRural (hasBreadthGe_mono hBreadth (by omega)) hLinked + (by rw [hBattle.isFree_X.2.1]; omega) hComp hYS₀ Q hQ' hQdis + obtain ⟨b, hb, a, ha, R₀, hR₀, hR₀Z⟩ := rural_linkage_avoids_small_set R hR hRdis hZ hZκ + have hRpath : IsGraphPathWithEnds (H.interSet (closure Λ)).toGraph R₀ b a := by + rw [← hSG] + exact hR₀.1 + obtain ⟨J, hJPath, hJSub, hJR⟩ := exists_drawing_of_graphPath hRpath + refine ⟨b, hb, a, ha, J, hJPath, hJSub.trans interSet_isSub, + fun _ hx => interSet_U_subset isClosed_closure (hJSub.U_subset hx), ?_, ?_⟩ + · change V(J.toGraph) ∩ (H.V ∩ subBd Λ) = {b} + rw [hJR, ← hΩ, ← hSΩ] + exact hR₀.2.1 + · change Disjoint V(J.toGraph) Z + rw [hJR] + exact hR₀Z + +/-- Graph Minors XVI, proof of (8.1), Claim (11), page 74. +For the family of separated battlefields cleared in Section 9, the +path has exactly one vertex in the resulting cleared drawing. -/ +theorem theorem_8_1_claim_11 + (hS : IsClosedSurface S) + {H : Drawing S} {θ β κ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {Y : Set S} {y : S} + {Λ : S → Set S} {C : S → Drawing S} {X : S → Set S} {M Z : Set S} + (hMet : HasTangleMetric H θ T d) (hY : Y ⊆ H.V) (hy : y ∈ Y) + (hBattle : ∀ z ∈ Y, IsBattlefield H T d θ β {z} (Λ z) (C z) (X z)) + (hSep : ∀ z ∈ Y, ∀ w ∈ Y, z ≠ w → 2 * (3 * β + 3) < d {z} {w}) + (hM : IsLambdaZoneAround H d (κ + 2) {y} M) + (hCapture : ∀ a ∈ H.A, d {y} a < κ → a ⊆ M) + (hκ : 3 ≤ κ) (hβ : κ + 3 ≤ β) (hθ : κ + (3 * β + 3) < θ) + (hZ : Z.Finite) (hZκ : Z.ncard < κ) : + ∃ b ∈ X y, ∃ a ∈ H.V ∩ subBd M, ∃ P : Drawing S, + P.IsPathBetween b a ∧ P.IsSubdrawing H ∧ + P.V ∩ (clearEnvelopeDrawing H Y Λ).V = {b} ∧ Disjoint P.V Z := by + obtain ⟨b, hb, a, ha, P, hPath, hPH, hPU, hOuter, hPZ⟩ := + section9_boundary_path_avoiding_separator hS hMet (hY hy) (hBattle y hy) + hM hCapture hκ hβ hθ hZ hZκ + have hZone := fun z hz => (hBattle z hz).isZone + obtain ⟨_, _, _, hSymm, hTri, _⟩ := + GM11.gm15_theorem_9_1 H θ T d hS inferInstance hMet + have hdis : ∀ z ∈ Y, ∀ w ∈ Y, z ≠ w → + Disjoint (closure (Λ z)) (closure (Λ w)) := by + intro z hz w hw hzw + exact section9_disjoint_zones (hZone z hz) (hZone w hw) hSymm hTri + (Nat.le_refl _) (hSep z hz w hw hzw) + have hbOuter := (hBattle y hy).isFree_X.1 hb + have hbU : b ∈ (clearEnvelopeDrawing H Y Λ).U := + zone_boundary_subset_clearFamily hZone hdis hy hbOuter.2 + have hbOut : b ∉ ⋃ z ∈ Y, Λ z := (clearFamily_U hZone ▸ hbU).2 + have hClosed : IsClosed (univ \ ⋃ z ∈ Y, Λ z) := + isClosed_univ.sdiff (isOpen_iUnion fun z => isOpen_iUnion fun hz => + (hZone z hz).isOpenDisc.1) + have hbV : b ∈ (clearEnvelopeDrawing H Y Λ).V := + (mem_interSet_V_iff hClosed).mpr ⟨hbOuter.1, mem_univ _, hbOut⟩ + refine ⟨b, hb, a, ha, P, hPath, hPH, ?_, hPZ⟩ + apply subset_antisymm + · rintro v ⟨hvP, hvClear⟩ + have hvU := (clearEnvelopeDrawing H Y Λ).V_subset_U hvClear + have hvOld := (clearFamily_U hZone ▸ hvU).1 + have hvOut := (clearFamily_U hZone ▸ hvU).2 + have hvNot : v ∉ Λ y := fun h => hvOut (mem_iUnion₂.mpr ⟨y, hy, h⟩) + have hvBd : v ∈ subBd (Λ y) := + ⟨hPU (P.V_subset_U hvP), subset_closure ⟨mem_univ _, hvNot⟩⟩ + have hvH : v ∈ H.V := (interSet_isSub (Γ := H)).1 hvClear + exact hOuter ▸ ⟨hvP, hvH, hvBd⟩ + · rintro v rfl + exact ⟨(graphPath_of_drawingPath hPH hPath).left_mem, hbV⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Claim4.lean b/LeanPool/GraphMinor/GM16/Section9Claim4.lean new file mode 100644 index 0000000000..b3178f7e03 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Claim4.lean @@ -0,0 +1,114 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +public import LeanPool.GraphMinor.GM15.Section4 +public import LeanPool.GraphMinor.GM16.Section6 +import LeanPool.GraphMinor.GM16.Section9Rigidity +import LeanPool.GraphMinor.GM16.Section9SpanClearing +import LeanPool.GraphMinor.GM16.Section9BattlefieldFree +import LeanPool.GraphMinor.GM16.Section9SeparatedBoundaries +import LeanPool.GraphMinor.GM16.Section9HandleLinkage +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM16.Section9Regions +import LeanPool.GraphMinor.GM11.Section810 + +import LeanPool.GraphMinor.GM11.CitedResults + +import LeanPool.GraphMinor.GM12.Section710 + +import LeanPool.GraphMinor.GM12.Section77 + +import LeanPool.GraphMinor.GM16.Theorem35Bridge + +/-! +# Claim (4) in the proof of XVI (8.1) + +All the clearings give a controlled rigid span, and each battlefield +boundary set remains free. Distant centres rule out a region incident +with both boundaries. The ordered linkage selection and XV (3.5) +therefore give the required span with a handle added. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- Graph Minors XVI, proof of (8.1), Claim (4), page 72, with the +clearing, freeness, boundary circuits, and incidence conditions proved. -/ +theorem theorem_8_1_claim_4 + (hS : IsClosedSurface S) + {α : Type u} {βe : Type v} {G : Graph α βe} {H : Drawing S} (η : SpanEmbedding H G) + {θ_star θ β sep φ : ℕ} {ys : Finset S} + {T_star : Set (Hypergraph α βe × Hypergraph α βe)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {Λ : S → Set S} {C : S → Drawing S} {X : S → Set S} + (hSpan : IsSigmaSpan G H η θ_star θ T_star T) (hY : ∀ y ∈ ys, y ∈ H.V) + (hBattle : ∀ y ∈ ys, IsBattlefield H T d θ β {y} (Λ y) (C y) (X y)) + (hdis : ∀ y ∈ ys, ∀ z ∈ ys, y ≠ z → Disjoint (closure (Λ y)) (closure (Λ z))) + (hsep : ∀ y ∈ ys, ∀ z ∈ ys, y ≠ z → sep ≤ d {y} {z}) + (hparam : 2 * β + 6 * (3 * β + 3) + 2 + (4 * (3 * β + 3) + 2) * ys.card < sep) + (hbudget : (4 * (3 * β + 3) + 2) * ys.card + 8 < sep) + (hLineBudget : 4 * φ + (4 * (3 * β + 3) + 2) * ys.card ≤ sep) + (hφ : 3 ≤ φ) + (hComp : IsLambdaCompression H (clearEnvelopeDrawing H (ys : Set S) Λ) + θ ((4 * (3 * β + 3) + 2) * ys.card) T T' d d') + {y z : S} (hy : y ∈ ys) (hz : z ∈ ys) (hyz : y ≠ z) + (P : Fin (φ ^ 2) → Graph α βe) + (hLink : ∀ i, ∃ a ∈ X y, ∃ b ∈ X z, + IsHPathWithEnds G (restrictCleared η (⋃ q ∈ (ys : Set S), Λ q)).imageGraph + (P i) (η.vMap a) (η.vMap b)) + (hDis : Pairwise (fun i j => Disjoint V(P i) V(P j))) : + ∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S'), + IsObtainedByAddingHandle S S' ∧ + ∃ (H' : Drawing S') (η' : SpanEmbedding H' G) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsSigmaSpan G H' η' θ_star φ T_star T' := by + let K := clearEnvelopeDrawing H (ys : Set S) Λ + let η' := restrictCleared η (⋃ q ∈ (ys : Set S), Λ q) + have hZone := fun q hq => (hBattle q hq).isZone + have hEnv := envelope_of_battlefields hSpan.isRigid (fun q hq => hY q hq) hBattle hdis + have hSpan' := span_after_clearFamily hS ys Λ (3 * β + 3) η hSpan hEnv hComp + have hFree := battlefield_free_after_clearFamily hS hY hBattle hdis hsep hparam hComp + have hClosed : IsClosed (univ \ ⋃ q ∈ (ys : Set S), Λ q) := + isClosed_univ.sdiff (isOpen_iUnion fun q => isOpen_iUnion fun hq => (hZone q hq).isOpenDisc.1) + have hX : ∀ q ∈ ys, X q ⊆ (K.interSet (subBd (Λ q))).V := by + intro q hq x hx + have hxb := (hBattle q hq).isFree_X.1 hx + have hxK := zone_boundary_subset_clearFamily hZone hdis hq hxb.2 + have hxOut := ((clearFamily_U hZone) ▸ hxK).2 + have hxKV : x ∈ K.V := (mem_interSet_V_iff hClosed).mpr ⟨hxb.1, mem_univ _, hxOut⟩ + exact (mem_interSet_V_iff (show IsClosed (subBd (Λ q)) by + rw [subBd_eq_frontier]; exact isClosed_frontier)).mpr ⟨hxKV, hxb.2⟩ + have hne : Λ y ≠ Λ z := by + intro heq + have hyΛ := (hZone y hy).z_subset (mem_singleton y) + exact (hdis y hy z hz hyz).notMem_of_mem_left (subset_closure hyΛ) (subset_closure (heq ▸ hyΛ)) + have hex : ∀ i, ∃ a b, a ∈ X y ∧ b ∈ X z ∧ + IsHPathWithEnds G η'.imageGraph (P i) (η'.vMap a) (η'.vMap b) := by + intro i + obtain ⟨a, ha, b, hb, hp⟩ := hLink i + exact ⟨a, b, ha, hb, hp⟩ + choose a b hEnds using hex + exact handle_span_of_boundary_linkage η' hSpan' hComp.hasMetric' + (zone_mem_R_clearFamily hZone hdis hy) (zone_mem_R_clearFamily hZone hdis hz) hne + (hZone y hy).isOArc_bd (hZone z hz).isOArc_bd + (zone_boundary_isCircuit_clearFamily hZone hdis hy) (zone_boundary_isCircuit_clearFamily hZone + hdis hz) + (no_region_incident_two_cleared_boundaries hS (fun q hq => hY q hq) + hZone hdis hComp hy hz (hsep y hy z hz hyz) hbudget) + (normal_line_between_cleared_boundaries hS (fun q hq => hY q hq) + hZone hdis hComp hy hz hyz (hsep y hy z hz hyz) hLineBudget) + hφ (hX y hy) (hX z hz) (hFree y hy) (hFree z hz) P a b + (fun i => ⟨(hEnds i).1, (hEnds i).2.1⟩) (fun i => (hEnds i).2.2) hDis + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Claim9.lean b/LeanPool/GraphMinor/GM16/Section9Claim9.lean new file mode 100644 index 0000000000..596acab4e4 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Claim9.lean @@ -0,0 +1,124 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.Section9Attachments +import LeanPool.GraphMinor.GM16.PathEndSubpath +import LeanPool.GraphMinor.GM16.Section6HairUnion +import LeanPool.GraphMinor.GM09.Basic + +/-! +# At least one battlefield has no clean attachment to the bad path + +This is Claim (9) in the proof of XVI (8.1). Two clean attachments, +one from each boundary set, could be joined through the bad path. +Trim them first, and keep only the segment between their contacts +with that path. The resulting connected union avoids the separator +and meets the cleared drawing only in the two boundary ends. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM14 +universe u v + +/-- Graph Minors XVI, proof of (8.1), Claim (9), page 73: two clean +attachments to the bad path contradict its boundary-path separator. +The subpath between the contacts avoids the original two ends unless +one of those ends is itself a contact. -/ +theorem section9_no_two_clean_attachments {α : Type u} {β : Type v} + {G H P₀ Q₁ Q₂ : Graph α β} {X₁ X₂ Z : Set α} {s₁ s₂ a b x y : α} + (hHG : H ≤ G) (hX₁ : X₁ ⊆ V(H)) (hX₂ : X₂ ⊆ V(H)) (hDisX : Disjoint X₁ X₂) + (hP₀ : IsHPathWithEnds G H P₀ s₁ s₂) (hPZ : V(P₀) ∩ Z ⊆ {s₁, s₂}) + (hCut : ∀ P a b, IsHPathWithEnds G H P a b → a ∈ X₁ → b ∈ X₂ → (V(P) ∩ Z).Nonempty) + (hQ₁ : IsGraphPathWithEnds G Q₁ a x) (ha : a ∈ X₁) (hx : x ∈ V(P₀)) + (hQ₁H : V(Q₁) ∩ V(H) ⊆ X₁) (hQ₁Z : Disjoint V(Q₁) Z) + (hQ₂ : IsGraphPathWithEnds G Q₂ b y) (hb : b ∈ X₂) (hy : y ∈ V(P₀)) + (hQ₂H : V(Q₂) ∩ V(H) ⊆ X₂) (hQ₂Z : Disjoint V(Q₂) Z) : False := by + obtain ⟨a', ha', x', hx', A, hAQ₁, hA, hAH, hAE⟩ := + trim_boundary_attachment hHG hX₁ hQ₁ ha hx hQ₁H + obtain ⟨b', hb', y', hy', B, hBQ₂, hB, hBH, hBE⟩ := + trim_boundary_attachment hHG hX₂ hQ₂ hb hy hQ₂H + have hAZ := hQ₁Z.mono hAQ₁.vertexSet_mono Subset.rfl + have hBZ := hQ₂Z.mono hBQ₂.vertexSet_mono Subset.rfl + obtain ⟨R, hRP, _, hR⟩ := hP₀.2.1.exists_subpath hx' hy' + have hRend := subpath_inter_ends_subset hP₀.2.1 hR hRP + have hRZ : Disjoint V(R) Z := by + apply disjoint_left.mpr + intro w hwR hwZ + have hwEnd := hPZ ⟨hRP.vertexSet_mono hwR, hwZ⟩ + have hwNew := hRend ⟨hwR, hwEnd⟩ + rcases hwNew with hwx | hwy + · exact hAZ.notMem_of_mem_left hA.right_mem (hwx ▸ hwZ) + · rw [mem_singleton_iff] at hwy + exact hBZ.notMem_of_mem_left hB.right_mem (hwy ▸ hwZ) + have hRH : V(R) ∩ V(H) ⊆ {a', b'} := by + rintro w ⟨hwR, hwH⟩ + have hwEnd : w ∈ ({s₁, s₂} : Set α) := hP₀.2.2.2.2.2.1 ▸ ⟨hRP.vertexSet_mono hwR, hwH⟩ + have hwNew := hRend ⟨hwR, hwEnd⟩ + rcases hwNew with hwx | hwy + · have hxH : x' ∈ V(H) := hwx ▸ hwH + have hxa : x' = a' := mem_singleton_iff.mp (hAH ▸ ⟨hA.right_mem, hxH⟩) + exact Or.inl (hwx.trans hxa) + · rw [mem_singleton_iff] at hwy + have hyH : y' ∈ V(H) := hwy ▸ hwH + have hyb : y' = b' := mem_singleton_iff.mp (hBH ▸ ⟨hB.right_mem, hyH⟩) + exact Or.inr (hwy.trans hyb) + have hRE : Disjoint E(R) E(H) := hP₀.2.2.2.2.2.2.mono hRP.edgeSet_mono Subset.rfl + let J₁ := subgraphUnion G R A + have hJ₁G : J₁ ≤ G := subgraphUnion_le hR.1 hA.1 + have hRJ₁ : R ≤ J₁ := le_subgraphUnion_left hR.1 hA.1 + have hAJ₁ : A ≤ J₁ := le_subgraphUnion_right hR.1 hA.1 + have hConn₁ : IsGraphConnected J₁ := isGraphConnected_subgraphUnion hR.1 hA.1 + (graphPath_isGraphConnected hR) (graphPath_isGraphConnected hA) ⟨x', hR.left_mem, hA.right_mem⟩ + let J := subgraphUnion G J₁ B + have hJG : J ≤ G := subgraphUnion_le hJ₁G hB.1 + have hJ₁J : J₁ ≤ J := le_subgraphUnion_left hJ₁G hB.1 + have hBJ : B ≤ J := le_subgraphUnion_right hJ₁G hB.1 + have hConn : IsGraphConnected J := isGraphConnected_subgraphUnion hJ₁G hB.1 + hConn₁ (graphPath_isGraphConnected hB) ⟨y', hRJ₁.vertexSet_mono hR.right_mem, hB.right_mem⟩ + have hJV : V(J) = (V(R) ∪ V(A)) ∪ V(B) := by + rw [show J = subgraphUnion G J₁ B from rfl, vertexSet_subgraphUnion, + show J₁ = subgraphUnion G R A from rfl, vertexSet_subgraphUnion] + have hJE : E(J) = (E(R) ∪ E(A)) ∪ E(B) := by + rw [show J = subgraphUnion G J₁ B from rfl, edgeSet_subgraphUnion hJ₁G hB.1, + show J₁ = subgraphUnion G R A from rfl, edgeSet_subgraphUnion hR.1 hA.1] + have hJZ : Disjoint V(J) Z := by + rw [hJV] + exact (hRZ.union_left hAZ).union_left hBZ + have hJH : V(J) ∩ V(H) ⊆ {a', b'} := by + rintro w ⟨hwJ, hwH⟩ + rw [hJV] at hwJ + rcases hwJ with (hwR | hwA) | hwB + · exact hRH ⟨hwR, hwH⟩ + · exact Or.inl (mem_singleton_iff.mp (hAH ▸ ⟨hwA, hwH⟩)) + · exact Or.inr (mem_singleton_iff.mp (hBH ▸ ⟨hwB, hwH⟩)) + have hJEdges : Disjoint E(J) E(H) := by + rw [hJE] + exact (hRE.union_left hAE).union_left hBE + have haJ : a' ∈ V(J) := hJ₁J.vertexSet_mono (hAJ₁.vertexSet_mono hA.left_mem) + have hbJ : b' ∈ V(J) := hBJ.vertexSet_mono hB.left_mem + obtain ⟨W⟩ := hConn.2 a' haJ b' hbJ + obtain ⟨L, hL, _, _⟩ := exists_isGraphPathWithEnds_of_walk W + have hLG := hL.mono hJG + have hLH : V(L) ∩ V(H) = {a', b'} := by + apply subset_antisymm + · rintro w ⟨hwL, hwH⟩ + exact hJH ⟨hL.1.vertexSet_mono hwL, hwH⟩ + · rintro w (rfl | rfl) + · exact ⟨hL.left_mem, hX₁ ha'⟩ + · exact ⟨hL.right_mem, hX₂ hb'⟩ + have hHP : IsHPathWithEnds G H L a' b' := + ⟨hHG, hLG, fun he => hDisX.notMem_of_mem_left ha' (he.symm ▸ hb'), hX₁ ha', hX₂ hb', hLH, + hJEdges.mono hL.1.edgeSet_mono Subset.rfl⟩ + obtain ⟨w, hwL, hwZ⟩ := hCut L a' b' hHP ha' hb' + exact hJZ.notMem_of_mem_left (hL.1.vertexSet_mono hwL) hwZ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9ClearFamily.lean b/LeanPool/GraphMinor/GM16/Section9ClearFamily.lean new file mode 100644 index 0000000000..80dbbcb55a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9ClearFamily.lean @@ -0,0 +1,210 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +public import LeanPool.GraphMinor.GM15.Defs +import LeanPool.GraphMinor.GM16.Section9Compressions +import LeanPool.GraphMinor.GM16.Section9Dials +import LeanPool.GraphMinor.GM16.Section9ZonePreservation +import LeanPool.GraphMinor.GM16.EnvelopeAfterClearing +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM14.Section3b + + +import LeanPool.GraphMinor.GM12.Section710 + +/-! +# Clearing all the battlefield discs + +XVI (8.1), page 71, clears the discs one at a time. Each remaining +disc is still a zone. Induction gives the stated total loss of order +and the two comparisons of point distances. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- Clearing one disc preserves the centres and zones of the remaining disjoint discs. -/ +theorem clearing_preserves_disjoint_zones + {H : Drawing S} {γ θ : ℕ} + {T T₁ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d₁ : Set S → Set S → ℕ} {ys : Finset S} {j : S} {Λ : S → Set S} + (hY : ∀ y ∈ ys, y ∈ H.V) + (hZone : ∀ y ∈ ys, IsLambdaZoneAround H d γ {y} (Λ y)) + (hjZone : IsLambdaZoneAround H d γ {j} (Λ j)) + (hdis : ∀ y ∈ ys, Disjoint (closure (Λ y)) (closure (Λ j))) + (hClear : IsClearedTangle H T d θ γ (Λ j) T₁ d₁) : + (∀ y ∈ ys, y ∈ (clearedSubdrawing H (Λ j)).V) ∧ + ∀ y ∈ ys, IsLambdaZoneAround (clearedSubdrawing H (Λ j)) d₁ γ {y} (Λ y) := by + constructor + · intro y hy + exact (mem_interSet_V_iff (isClosed_univ.sdiff hjZone.isOpenDisc.1)).mpr + ⟨hY y hy, mem_univ _, fun hyj => (hdis y hy).notMem_of_mem_left + (subset_closure ((hZone y hy).z_subset (mem_singleton y))) (subset_closure hyj)⟩ + · intro y hy + exact zone_after_disjoint_clearing (hY y hy) (hZone y hy) hjZone (hdis y hy) hClear + +omit [ConnectedSpace S] in +/-- Clearing the empty family leaves the drawing unchanged. -/ +theorem clearEnvelopeDrawing_empty (H : Drawing S) (Λ : S → Set S) : + clearEnvelopeDrawing H (↑(∅ : Finset S)) Λ = H := by + change H.interSet (univ \ ⋃ y ∈ (↑(∅ : Finset S) : Set S), Λ y) = H + simpa using drawing_interSet_univ H + +omit [ConnectedSpace S] in +/-- Clearing an inserted disc first yields the same drawing as removing the union at once. -/ +theorem clearEnvelopeDrawing_insert [DecidableEq S] (H : Drawing S) (ys : Finset S) (j : S) + (Λ : S → Set S) (hOpen : ∀ y ∈ insert j ys, IsOpen (Λ y)) : + clearEnvelopeDrawing (clearedSubdrawing H (Λ j)) (ys : Set S) Λ = + clearEnvelopeDrawing H (↑(insert j ys)) Λ := by + unfold clearEnvelopeDrawing clearedSubdrawing + have hclosedYs : IsClosed (univ \ ⋃ y ∈ (ys : Set S), Λ y) := + isClosed_univ.sdiff (isOpen_iUnion fun y => isOpen_iUnion fun hy => + hOpen y (Finset.mem_insert_of_mem hy)) + rw [drawing_interSet_inter_closed H (isClosed_univ.sdiff (hOpen j (Finset.mem_insert_self _ _))) + hclosedYs] + congr 1 + ext x + simp only [mem_inter_iff, mem_sdiff, mem_univ, true_and, mem_iUnion, + Finset.mem_coe, Finset.mem_insert] + constructor + · rintro ⟨hxj, hxys⟩ ⟨y, hy, hxy⟩ + rcases hy with rfl | hy + · exact hxj hxy + · exact hxys ⟨y, hy, hxy⟩ + · intro hx + exact ⟨fun hxj => hx ⟨j, Or.inl rfl, hxj⟩, + fun ⟨y, hy, hxy⟩ => hx ⟨y, Or.inr hy, hxy⟩⟩ + +omit [ConnectedSpace S] in +/-- Combine the compression and point-distance comparison from one clearing with the rest. -/ +theorem compression_of_clearFamily_insert [DecidableEq S] + {H : Drawing S} {γ θ : ℕ} {ys : Finset S} {j : S} (hj : j ∉ ys) {Λ : S → Set S} + {T T₁ T₂ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d₁ d₂ : Set S → Set S → ℕ} + (hMet : HasTangleMetric H θ T d) (hθj : 4 * γ + 2 < θ) + (hClear : IsClearedTangle H T d θ γ (Λ j) T₁ d₁) + (heq : clearEnvelopeDrawing (clearedSubdrawing H (Λ j)) (ys : Set S) Λ = + clearEnvelopeDrawing H (↑(insert j ys)) Λ) + (hComp₂ : IsLambdaCompression (clearedSubdrawing H (Λ j)) + (clearEnvelopeDrawing (clearedSubdrawing H (Λ j)) (ys : Set S) Λ) + (θ - (4 * γ + 2)) ((4 * γ + 2) * ys.card) T₁ T₂ d₁ d₂) + (hLe₂ : ∀ x y : S, + pointDist (clearEnvelopeDrawing (clearedSubdrawing H (Λ j)) (ys : Set S) Λ) d₂ x y ≤ + pointDist (clearedSubdrawing H (Λ j)) d₁ x y) : + IsLambdaCompression H (clearEnvelopeDrawing H (↑(insert j ys)) Λ) + θ ((4 * γ + 2) * (insert j ys).card) T T₂ d d₂ ∧ + ∀ x y : S, + pointDist (clearEnvelopeDrawing H (↑(insert j ys)) Λ) d₂ x y ≤ pointDist H d x y := by + constructor + · have hc := compression_comp (compression_of_clearing hMet hθj hClear) hComp₂ + rw [heq] at hc + simpa only [Finset.card_insert_of_notMem hj, Nat.mul_add, Nat.mul_one, Nat.add_comm] using hc + · intro x y + rw [← heq] + exact (hLe₂ x y).trans (clearing_pointDist_le hClear x y) + +/-- The successive clearings in XVI (8.1), page 71, have total loss +`(4γ + 2)|Y|`. No choice of their order is part of the conclusion. -/ +theorem exists_compression_clearFamily + (hS : IsClosedSurface S) (ys : Finset S) (Λ : S → Set S) (γ : ℕ) + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hMet : HasTangleMetric H θ T d) + (hY : ∀ y ∈ ys, y ∈ H.V) + (hZone : ∀ y ∈ ys, IsLambdaZoneAround H d γ {y} (Λ y)) + (hdis : ∀ y ∈ ys, ∀ z ∈ ys, y ≠ z → Disjoint (closure (Λ y)) (closure (Λ z))) + (hθ : (4 * γ + 2) * ys.card < θ) : + ∃ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (d' : Set S → Set S → ℕ), + IsLambdaCompression H (clearEnvelopeDrawing H (ys : Set S) Λ) + θ ((4 * γ + 2) * ys.card) T T' d d' ∧ + ∀ x y : S, pointDist (clearEnvelopeDrawing H (ys : Set S) Λ) d' x y ≤ pointDist H d x y := by + classical + induction ys using Finset.induction_on generalizing H θ T d with + | empty => + have heq := clearEnvelopeDrawing_empty H Λ + refine ⟨T, d, ?_, ?_⟩ + · simpa only [Finset.card_empty, Nat.mul_zero, heq, Nat.sub_zero] using + (show IsLambdaCompression H H θ 0 T T d d from + ⟨by simpa using hθ, hMet, hMet, fun _ _ => Nat.le_add_right _ _⟩) + · intro x y + rw [heq] + | @insert j ys hj ih => + have hjmem : j ∈ insert j ys := Finset.mem_insert_self _ _ + have hθj : 4 * γ + 2 < θ := by + rw [Finset.card_insert_of_notMem hj] at hθ + have hb := Nat.mul_le_mul_left (4 * γ + 2) (show 1 ≤ ys.card + 1 by omega) + omega + obtain ⟨T₁, d₁, hClear, _⟩ := GraphMinor.GM14.theorem_3_2_proof hS inferInstance + (by omega) hMet (hZone j hjmem) + let H₁ := clearedSubdrawing H (Λ j) + have hMet₁ : HasTangleMetric H₁ (θ - (4 * γ + 2)) T₁ d₁ := by + simpa only [Nat.sub_sub] using hClear.hasMetric + obtain ⟨hY₁, hZone₁⟩ := clearing_preserves_disjoint_zones + (fun y hy => hY y (Finset.mem_insert_of_mem hy)) + (fun y hy => hZone y (Finset.mem_insert_of_mem hy)) (hZone j hjmem) + (fun y hy => hdis y (Finset.mem_insert_of_mem hy) j hjmem + (fun heq => hj (heq ▸ hy))) hClear + have hθ₁ : (4 * γ + 2) * ys.card < θ - (4 * γ + 2) := by + rw [Finset.card_insert_of_notMem hj, Nat.mul_add, Nat.mul_one] at hθ + omega + obtain ⟨T₂, d₂, hComp₂, hLe₂⟩ := ih hMet₁ hY₁ hZone₁ + (fun y hy z hz hne => hdis y (Finset.mem_insert_of_mem hy) z (Finset.mem_insert_of_mem hz) + hne) hθ₁ + have heq := clearEnvelopeDrawing_insert H ys j Λ + (fun y hy => (hZone y hy).isOpenDisc.1) + obtain ⟨hComp, hLe⟩ := compression_of_clearFamily_insert hj hMet hθj hClear heq hComp₂ hLe₂ + exact ⟨T₂, d₂, hComp, hLe⟩ + +/-- Clear one disc of an envelope, then compress along the remaining discs. The first clearing +preserves the remaining envelope, and the two compressions combine with the total order loss. -/ +theorem exists_compression_clearEnvelope_insert [DecidableEq S] + (hS : IsClosedSurface S) {H : Drawing S} {θ γ : ℕ} {ys : Finset S} {j : S} + (hj : j ∉ ys) {Λ : S → Set S} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {d : Set S → Set S → ℕ} + (hMet : HasTangleMetric H θ T d) (hEnv : IsEnvelope H d (↑(insert j ys)) γ Λ) + (hθ : (4 * γ + 2) * (insert j ys).card < θ) : + ∃ (T₁ T₂ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d₁ d₂ : Set S → Set S → ℕ), + IsClearedTangle H T d θ γ (Λ j) T₁ d₁ ∧ IsRigid (clearedSubdrawing H (Λ j)) ∧ + IsEnvelope (clearedSubdrawing H (Λ j)) d₁ (ys : Set S) γ Λ ∧ + IsLambdaCompression (clearedSubdrawing H (Λ j)) + (clearEnvelopeDrawing (clearedSubdrawing H (Λ j)) (ys : Set S) Λ) + (θ - (4 * γ + 2)) ((4 * γ + 2) * ys.card) T₁ T₂ d₁ d₂ ∧ + IsLambdaCompression H (clearEnvelopeDrawing H (↑(insert j ys)) Λ) + θ ((4 * γ + 2) * (insert j ys).card) T T₂ d d₂ := by + let c := 4 * γ + 2 + have hθsum : c * ys.card + c < θ := by + simpa only [c, Finset.card_insert_of_notMem hj, Nat.mul_add, Nat.mul_one] using hθ + have hθj : c < θ := by omega + have hjmem : j ∈ insert j ys := Finset.mem_insert_self _ _ + obtain ⟨T₁, d₁, hClear, _⟩ := GraphMinor.GM14.theorem_3_2_proof hS inferInstance + (by dsimp only [c] at hθj; omega) hMet (hEnv.2.1 j hjmem) + have hRig : IsRigid (clearedSubdrawing H (Λ j)) := by + have h := hEnv.2.2.2 {j} (singleton_subset_iff.mpr hjmem) + have hu : (⋃ y ∈ ({j} : Set S), Λ y) = Λ j := by simp + rw [hu] at h + exact h + have hEnv₁ := envelope_after_clearing (show j ∉ (ys : Set S) from hj) + (by simpa only [Finset.coe_insert] using hEnv) hClear + have hMet₁ : HasTangleMetric (clearedSubdrawing H (Λ j)) (θ - c) T₁ d₁ := by + simpa only [c, Nat.sub_sub] using hClear.hasMetric + have hθrem : c * ys.card < θ - c := by omega + obtain ⟨T₂, d₂, hComp₂, hLe₂⟩ := exists_compression_clearFamily hS ys Λ γ hMet₁ + (fun y hy => hEnv₁.1 hy) hEnv₁.2.1 hEnv₁.2.2.1 hθrem + have hDraw := clearEnvelopeDrawing_insert H ys j Λ + (fun y hy => (hEnv.2.1 y hy).isOpenDisc.1) + exact ⟨T₁, T₂, d₁, d₂, hClear, hRig, hEnv₁, hComp₂, + (compression_of_clearFamily_insert hj hMet hθj hClear hDraw hComp₂ hLe₂).1⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Compressions.lean b/LeanPool/GraphMinor/GM16/Section9Compressions.lean new file mode 100644 index 0000000000..a81120cadb --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Compressions.lean @@ -0,0 +1,109 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM15.Section4 +import LeanPool.GraphMinor.GM14.Section3 + +import LeanPool.GraphMinor.GM12.Section77 + +/-! +# Composing the compressions in XVI (8.1) + +The clearings in Section 9 lose `4γ + 2` units of order each. Their +metric losses add. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- The losses in two successive compressions add, as used in the proof +of Graph Minors XVI, (8.1), page 71. -/ +theorem compression_comp {H H₁ H₂ : Drawing S} {θ lam₁ lam₂ : ℕ} + {T T₁ T₂ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d₁ d₂ : Set S → Set S → ℕ} + (h₁ : IsLambdaCompression H H₁ θ lam₁ T T₁ d d₁) + (h₂ : IsLambdaCompression H₁ H₂ (θ - lam₁) lam₂ T₁ T₂ d₁ d₂) : + IsLambdaCompression H H₂ θ (lam₁ + lam₂) T T₂ d d₂ := by + refine ⟨by have := h₂.lam_lt; omega, h₁.hasMetric, ?_, ?_⟩ + · simpa only [Nat.sub_sub] using h₂.hasMetric' + · intro x y + have hxy₁ := h₁.dist_le x y + have hxy₂ := h₂.dist_le x y + omega + +/-- Uniqueness of the total compression used in XVI (8.1), page 72. +Apply XV (4.1) in both directions, using one radial drawing for both +representations. XII (7.7) identifies the metrics of the second tangle. -/ +theorem compression_unique + {H H' : Drawing S} {θ lam : ℕ} + {T T₁ T₂ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d₁ d₂ : Set S → Set S → ℕ} (hS : IsClosedSurface S) (hConn : ConnectedSpace S) + (h₁ : IsLambdaCompression H H' θ lam T T₁ d d₁) + (h₂ : IsLambdaCompression H H' θ lam T T₂ d d₂) : T₁ = T₂ := by + obtain ⟨_, K, ins₁, hK, hins₁, hd₁⟩ := h₁.hasMetric' + obtain ⟨ins₂, hins₂⟩ := exists_derivedSlope h₂.hasMetric'.1 hK.2.1 + let d₂K := tangleMetric H' K ins₂ (θ - lam) + have hM₂K : HasTangleMetric H' (θ - lam) T₂ d₂K := + ⟨h₂.hasMetric'.1, K, ins₂, hK, hins₂, fun _ _ _ _ => rfl⟩ + have hEq := (tangleMetric_eq_of_hasTangleMetric hS hConn h₂.hasMetric' hM₂K).2.1 + have h₂K : IsLambdaCompression H H' θ lam T T₂ d d₂K := + ⟨h₂.lam_lt, h₂.hasMetric, hM₂K, fun x y => by rw [← hEq x y]; exact h₂.dist_le x y⟩ + have h12 := (GraphMinor.GM15.theorem_4_1_proof.{w} H H' H' K K θ lam lam T T₁ T₂ d d₁ d₂K ins₁ + ins₂ + hS h₁ h₂K hK hins₁ hd₁ hK hins₂ (fun _ _ _ _ => rfl)).2 rfl rfl le_rfl + have h21 := (GraphMinor.GM15.theorem_4_1_proof.{w} H H' H' K K θ lam lam T T₂ T₁ d d₂K d₁ ins₂ + ins₁ + hS h₂K h₁ hK hins₂ (fun _ _ _ _ => rfl) hK hins₁ hd₁).2 rfl rfl le_rfl + exact subset_antisymm h12 h21 + +/-- A clearing is a compression with loss `4γ + 2`. The point distances +are compared by taking the atoms containing the two points. -/ +theorem compression_of_clearing {H : Drawing S} {θ γ : ℕ} {Λ : Set S} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} (hMet : HasTangleMetric H θ T d) + (hθ : 4 * γ + 2 < θ) (hClear : IsClearedTangle H T d θ γ Λ T' d') : + IsLambdaCompression H (clearedSubdrawing H Λ) θ (4 * γ + 2) T T' d d' := by + refine ⟨hθ, hMet, ?_, ?_⟩ + · simpa only [Nat.sub_sub] using hClear.hasMetric + · intro x y + obtain ⟨a, ha, hxa⟩ := exists_atom_of_point H x + obtain ⟨b, hb, hyb⟩ := exists_atom_of_point H y + obtain ⟨a', ha', hxa'⟩ := exists_atom_of_point (clearedSubdrawing H Λ) x + obtain ⟨b', hb', hyb'⟩ := exists_atom_of_point (clearedSubdrawing H Λ) y + have hSub := clearedSubdrawing_isSubdrawing H Λ + have hbound := (hClear.dist_bounds a ha b hb a' ha' b' hb' + (atom_subset_of_isSubdrawing hSub ha ha' hxa hxa') + (atom_subset_of_isSubdrawing hSub hb hb' hyb hyb')).1 + rw [pointDist_eq_of_mem_atom ha hb hxa hyb, + pointDist_eq_of_mem_atom ha' hb' hxa' hyb'] + omega + +/-- Clearing does not increase point distances. Together with the preceding +compression bound this gives both metric comparisons used in XVI (8.1). -/ +theorem clearing_pointDist_le {H : Drawing S} {θ γ : ℕ} {Λ : Set S} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} (hClear : IsClearedTangle H T d θ γ Λ T' d') + (x y : S) : pointDist (clearedSubdrawing H Λ) d' x y ≤ pointDist H d x y := by + obtain ⟨a, ha, hxa⟩ := exists_atom_of_point H x + obtain ⟨b, hb, hyb⟩ := exists_atom_of_point H y + obtain ⟨a', ha', hxa'⟩ := exists_atom_of_point (clearedSubdrawing H Λ) x + obtain ⟨b', hb', hyb'⟩ := exists_atom_of_point (clearedSubdrawing H Λ) y + have hSub := clearedSubdrawing_isSubdrawing H Λ + rw [pointDist_eq_of_mem_atom ha hb hxa hyb, + pointDist_eq_of_mem_atom ha' hb' hxa' hyb'] + exact (hClear.dist_bounds a ha b hb a' ha' b' hb' + (atom_subset_of_isSubdrawing hSub ha ha' hxa hxa') + (atom_subset_of_isSubdrawing hSub hb hb' hyb hyb')).2 + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9ConsecutiveVertices.lean b/LeanPool/GraphMinor/GM16/Section9ConsecutiveVertices.lean new file mode 100644 index 0000000000..3bfab48fc6 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9ConsecutiveVertices.lean @@ -0,0 +1,104 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM15.Defs +import LeanPool.GraphMinor.GM16.SpanMarkedSegments +import LeanPool.GraphMinor.GM16.ClearedPathVertices +import LeanPool.GraphMinor.GM16.Section9FinalMetric +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.Section88 + +/-! +# Choosing the consecutive vertices for the final contradiction + +Stop the bad path at its first old vertex outside the shell and +trim backwards to the preceding old vertex. The clean annulus is +disjoint from the path, so that preceding vertex lies outside the +outer zone. The two vertices therefore satisfy the hypotheses of +the metric contradiction after Claim (15) of XVI (8.1). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 + GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] +variable {α : Type u} {βe : Type v} + +/-- The vertex choice and final contradiction of XVI (8.1), pages +74–75, after the bad path is known to miss the clean annulus. -/ +theorem section9_contradiction_of_clean_annulus (hS : IsClosedSurface S) + {G P₀ : Graph α βe} {H : Drawing S} (η : SpanEmbedding H G) + {θ γ i ψ sep : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {Y : Set S} {Λ : S → Set S} {I O : Set S} + (η' : SpanEmbedding (clearEnvelopeDrawing H Y Λ) G) (hMap : η'.vMap = η.vMap) + (hMet : HasTangleMetric H θ T d) (hY : Y ⊆ H.V) + (hZone : ∀ y ∈ Y, IsLambdaZoneAround H d γ {y} (Λ y)) + (hdis : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → Disjoint (closure (Λ y)) (closure (Λ z))) + (hSymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (hTri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) + (hNewSymm : ∀ a ∈ (clearEnvelopeDrawing H Y Λ).A, + ∀ b ∈ (clearEnvelopeDrawing H Y Λ).A, d' a b = d' b a) + (hNewTri : ∀ a ∈ (clearEnvelopeDrawing H Y Λ).A, + ∀ b ∈ (clearEnvelopeDrawing H Y Λ).A, ∀ c ∈ (clearEnvelopeDrawing H Y Λ).A, + d' a c ≤ d' a b + d' b c) + (hLe : ∀ x y : S, pointDist (clearEnvelopeDrawing H Y Λ) d' x y ≤ pointDist H d x y) + (hNoPath : ∀ Q s t, s ∈ H.V → t ∈ H.V → + IsHPathWithEnds G η.imageGraph Q (η.vMap s) (η.vMap t) → + ψ ≤ d {s} {t} → (∀ y ∈ Y, ψ ≤ d {s} {y}) → False) + (hψ : 3 ≤ ψ) (hSepBudget : 2 * γ + 2 * ψ < sep) + {y s₁ s₂ t₁ : S} (hy : y ∈ Y) (ht₁ : t₁ ∈ H.V) + (hs₁ : s₁ ∈ (clearEnvelopeDrawing H Y Λ).V) + (hs₂ : s₂ ∈ (clearEnvelopeDrawing H Y Λ).V) + (hP₀ : IsHPathWithEnds G η'.imageGraph P₀ (η.vMap s₁) (η.vMap s₂)) + (hSep : ∀ z ∈ Y, y ≠ z → sep ≤ d {y} {z}) + (hI : IsLambdaZoneAround H d (i + 2) {y} I) + (hNest : closure I ⊆ O) (hOuter : closure O ⊆ Λ y) + (hCapture : ∀ a ∈ H.A, d {y} a < i + ψ + 2 → a ⊆ O) + (hMiss : Disjoint V(P₀) (η.vMap '' (H.interSet (closure O \ I)).V)) + (ht₁Λ : t₁ ∈ Λ y) (hShort₁ : d {s₁} {t₁} < ψ) + (hLong : 2 * ψ ≤ d' {s₁} {s₂}) : False := by + have hClearSub : (clearEnvelopeDrawing H Y Λ).IsSubdrawing H := interSet_isSub + have hs₁H := hClearSub.1 hs₁ + have hs₂H := hClearSub.1 hs₂ + have hs₁Out : s₁ ∉ Λ y := by + have hout := (clearFamily_U hZone ▸ (clearEnvelopeDrawing H Y Λ).V_subset_U hs₁).2 + exact fun h => hout (mem_iUnion₂.mpr ⟨y, hy, h⟩) + have hs₂Out : s₂ ∉ Λ y := by + have hout := (clearFamily_U hZone ▸ (clearEnvelopeDrawing H Y Λ).V_subset_U hs₂).2 + exact fun h => hout (mem_iUnion₂.mpr ⟨y, hy, h⟩) + have hst : s₁ ≠ s₂ := fun heq => hP₀.2.2.1 (congrArg η.vMap heq) + obtain ⟨u, hu, v, hv, huv, hvs, hvShell, huCase, R, hRP, hR, hInter⟩ := + exists_consecutive_span_exit η hs₁H hs₂H hst + (show s₂ ∉ Λ y \ I from fun h => hs₂Out h.1) hP₀.2.1 + have huI : u ∉ I := by + rcases huCase with hueq | huShell + · subst u + exact fun h => hs₁Out (hOuter (subset_closure (hNest (subset_closure h)))) + · exact huShell.2 + have huO : u ∉ O := by + intro huo + have huJ : u ∈ (H.interSet (closure O \ I)).V := + (mem_interSet_V_iff (isClosed_closure.sdiff hI.isOpenDisc.1)).mpr + ⟨hu, subset_closure huo, huI⟩ + exact hMiss.notMem_of_mem_left (hRP.vertexSet_mono hR.left_mem) + (mem_image_of_mem η.vMap huJ) + have huCase' : u = s₁ ∨ u ∈ Λ y := huCase.imp id And.left + have hvPlace : v = s₂ ∨ v ∈ ⋃ z ∈ Y, Λ z := old_vertex_place_on_cleared_path + η η' hMap hs₁H hs₂H hv hP₀ (hRP.vertexSet_mono hR.right_mem) hvs + exact section9_final_metric_contradiction hS η hMet hY hZone hdis hSymm hTri + hNewSymm hNewTri hLe hNoPath hψ hSepBudget hy hs₁H hs₂H ht₁ hu hv hs₁ hs₂ + hSep hI hCapture huO huCase' hvShell hvPlace ht₁Λ hShort₁ hLong hR huv hInter + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Dials.lean b/LeanPool/GraphMinor/GM16/Section9Dials.lean new file mode 100644 index 0000000000..c0bb82f746 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Dials.lean @@ -0,0 +1,138 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.Ties +import LeanPool.GraphMinor.GM11.Walks + +/-! +# Dials after clearing disjoint zones + +In Claim (2) of XVI (8.1), a dial for the drawing with one zone cleared +must avoid every other zone. A dial cannot contain a circle of the +drawing: its drawing part is either on the normal boundary or a line. +A zone disjoint from the dial boundary is therefore outside the dial. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- A dial for a normal circle contains no circle of the drawing. +This supplies the missing justification in XVI (8.1), Claim (2), page 71. -/ +theorem dial_contains_no_oArc + {H : Drawing S} {F Δ J : Set S} (hD : IsDial H F Δ) + (hNormal : F ∩ H.U ⊆ H.V) (hJ : IsOArc J) (hJU : J ⊆ H.U) (hJΔ : J ⊆ Δ) : False := by + rcases hD.2.2 with hsmall | ⟨a, b, hab, _, hPath⟩ + · have hJV : J ⊆ H.V := fun x hx => hNormal ⟨hsmall ⟨hJΔ hx, hJU hx⟩, hJU hx⟩ + exact infinite_of_isOArc hJ (H.finite_V.subset hJV) + · obtain ⟨f, _, _⟩ := GraphMinor.GM11.isLine_of_isPathBetween hPath hab + exact not_isOArc_of_subset_line ⟨f⟩ hJ (oArc_subset_interSet_U hJ hJU hJΔ) + +/-- A dial whose boundary avoids an open disc also avoids the disc if +its boundary circle lies in the drawing. Otherwise the entire boundary +circle of that disc would lie in the dial. -/ +theorem dial_disjoint_open_disc + {H : Drawing S} {F Δ Ω : Set S} (hD : IsDial H F Δ) + (hNormal : F ∩ H.U ⊆ H.V) (hΩ : IsOpenDisc Ω) + (hBd : IsOArc (subBd Ω)) (hBdU : subBd Ω ⊆ H.U) + (hFΩ : Disjoint F Ω) : Disjoint Δ Ω := by + have hdis : Disjoint Ω (frontier Δ) := by + rw [← subBd_eq_frontier, hD.2.1] + exact hFΩ.symm + rcases subset_or_disjoint_of_frontier hD.1.isClosed hΩ.isPathConnected.isConnected.isPreconnected + hdis with + hsub | hdis + · have hcl : closure Ω ⊆ Δ := closure_minimal hsub hD.1.isClosed + exact False.elim (dial_contains_no_oArc hD hNormal hBd hBdU (fun _ h => hcl h.1)) + · exact hdis.symm + +omit [ConnectedSpace S] in +/-- Restriction to two closed sets is restriction to their intersection. -/ +theorem drawing_interSet_inter_closed (H : Drawing S) {A B : Set S} + (hA : IsClosed A) (hB : IsClosed B) : + (H.interSet A).interSet B = H.interSet (A ∩ B) := by + apply Drawing.ext_of_V_E + · ext x + rw [mem_interSet_V_iff hB, mem_interSet_V_iff hA, mem_interSet_V_iff (hA.inter hB)] + simp only [mem_inter_iff] + tauto + · ext e + rw [mem_interSet_E_iff, mem_interSet_E_iff, mem_interSet_E_iff] + simp only [subset_inter_iff] + tauto + +omit [ConnectedSpace S] in +/-- Restriction to closed sets preserves inclusion of those sets. -/ +theorem drawing_interSet_mono_closed (H : Drawing S) {A B : Set S} + (hA : IsClosed A) (hB : IsClosed B) (hAB : A ⊆ B) : + (H.interSet A).IsSubdrawing (H.interSet B) := by + constructor + · intro x hx + have hx' := (mem_interSet_V_iff hA).mp hx + exact (mem_interSet_V_iff hB).mpr ⟨hx'.1, hAB hx'.2⟩ + · intro e he + obtain ⟨heH, heA⟩ := mem_interSet_E_iff.mp he + exact mem_interSet_E_iff.mpr ⟨heH, heA.trans hAB⟩ + +omit [ConnectedSpace S] in +/-- Restriction to the whole surface changes no drawing. -/ +theorem drawing_interSet_univ (H : Drawing S) : H.interSet univ = H := by + apply Drawing.ext_of_V_E + · ext x + rw [mem_interSet_V_iff isClosed_univ] + exact and_iff_left (mem_univ x) + · ext e + rw [mem_interSet_E_iff] + simp only [subset_univ, and_true] + +omit [ConnectedSpace S] in +/-- A dial remains a dial in a subdrawing when its intersection with the +dial and the vertices on its boundary are unchanged. -/ +theorem dial_of_subdrawing_same_inter + {H K : Drawing S} {F Δ : Set S} (hD : IsDial H F Δ) + (hKH : K.IsSubdrawing H) (hFV : F ∩ K.V = F ∩ H.V) + (hinter : H.interSet Δ = K.interSet Δ) : IsDial K F Δ := by + refine ⟨hD.1, hD.2.1, ?_⟩ + rcases hD.2.2 with hsmall | ⟨a, b, hab, hEnds, hPath⟩ + · exact Or.inl (fun _ h => hsmall ⟨h.1, hKH.U_subset h.2⟩) + · refine Or.inr ⟨a, b, hab, hFV.trans hEnds, ?_⟩ + exact hinter ▸ hPath + +omit [ConnectedSpace S] in +/-- Clearing one disc followed by a family amounts to clearing their +union. This identifies the drawings in the two orders used in XVI (8.1). -/ +theorem clearFamily_after_single (H : Drawing S) (Y : Set S) (Λ : S → Set S) (j : S) + (hOpen : ∀ y ∈ insert j Y, IsOpen (Λ y)) : + clearEnvelopeDrawing (clearedSubdrawing H (Λ j)) Y Λ = + clearEnvelopeDrawing H (insert j Y) Λ := by + unfold clearEnvelopeDrawing clearedSubdrawing + have hclosed : IsClosed (univ \ ⋃ y ∈ Y, Λ y) := + isClosed_univ.sdiff (isOpen_iUnion fun y => isOpen_iUnion fun hy => hOpen y + (mem_insert_of_mem j hy)) + rw [drawing_interSet_inter_closed H (isClosed_univ.sdiff (hOpen j (mem_insert j Y))) hclosed] + congr 1 + ext x + simp only [mem_inter_iff, mem_sdiff, mem_univ, true_and, mem_iUnion, mem_insert_iff] + constructor + · rintro ⟨hxj, hxY⟩ ⟨y, hy, hxy⟩ + rcases hy with rfl | hy + · exact hxj hxy + · exact hxY ⟨y, hy, hxy⟩ + · intro hx + exact ⟨fun hxj => hx ⟨j, Or.inl rfl, hxj⟩, + fun ⟨y, hy, hxy⟩ => hx ⟨y, Or.inr hy, hxy⟩⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9FinalMetric.lean b/LeanPool/GraphMinor/GM16/Section9FinalMetric.lean new file mode 100644 index 0000000000..e6162d0c78 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9FinalMetric.lean @@ -0,0 +1,115 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM15.Defs +import LeanPool.GraphMinor.GM16.Section9LastVertexBounds +import LeanPool.GraphMinor.GM16.Section9ShortPaths +import LeanPool.GraphMinor.GM16.Section9Regions +import LeanPool.GraphMinor.GM16.SpanPaths +import LeanPool.GraphMinor.GM16.MetricPoints + +/-! +# The final metric contradiction in XVI (8.1) + +The last vertex before the path leaves the shell is far from all +battlefield centres. Its next old-drawing segment must therefore be +short. That segment cannot enter the inner zone, cross to another +battlefield, or reach the other end of the original path. These are +exactly the last cases on page 75. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The final contradiction following Claim (15) in XVI (8.1), page 75. +The inputs describe the consecutive old vertices chosen there, including +their positions relative to the clean annulus. The distance bounds of +Claim (15) and the shortness of their connecting segment are derived. -/ +theorem section9_final_metric_contradiction (hS : IsClosedSurface S) + {α : Type u} {βe : Type v} {G P : Graph α βe} {H : Drawing S} (η : SpanEmbedding H G) + {θ γ i ψ sep : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {Y : Set S} {Λ : S → Set S} {Minner Mouter : Set S} + (hMet : HasTangleMetric H θ T d) (hY : Y ⊆ H.V) + (hZone : ∀ y ∈ Y, IsLambdaZoneAround H d γ {y} (Λ y)) + (hdis : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → Disjoint (closure (Λ y)) (closure (Λ z))) + (hSymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (hTri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) + (hNewSymm : ∀ a ∈ (clearEnvelopeDrawing H Y Λ).A, + ∀ b ∈ (clearEnvelopeDrawing H Y Λ).A, d' a b = d' b a) + (hNewTri : ∀ a ∈ (clearEnvelopeDrawing H Y Λ).A, + ∀ b ∈ (clearEnvelopeDrawing H Y Λ).A, ∀ c ∈ (clearEnvelopeDrawing H Y Λ).A, + d' a c ≤ d' a b + d' b c) + (hLe : ∀ x y : S, pointDist (clearEnvelopeDrawing H Y Λ) d' x y ≤ pointDist H d x y) + (hNoPath : ∀ Q s t, s ∈ H.V → t ∈ H.V → + IsHPathWithEnds G η.imageGraph Q (η.vMap s) (η.vMap t) → + ψ ≤ d {s} {t} → (∀ y ∈ Y, ψ ≤ d {s} {y}) → False) + (hψ : 3 ≤ ψ) (hSepBudget : 2 * γ + 2 * ψ < sep) + {y s₁ s₂ t₁ u v : S} (hy : y ∈ Y) + (hs₁ : s₁ ∈ H.V) (hs₂ : s₂ ∈ H.V) (ht₁ : t₁ ∈ H.V) (hu : u ∈ H.V) (hv : v ∈ H.V) + (hs₁New : s₁ ∈ (clearEnvelopeDrawing H Y Λ).V) + (hs₂New : s₂ ∈ (clearEnvelopeDrawing H Y Λ).V) + (hSep : ∀ z ∈ Y, y ≠ z → sep ≤ d {y} {z}) + (hInner : IsLambdaZoneAround H d (i + 2) {y} Minner) + (hCapture : ∀ a ∈ H.A, d {y} a < i + ψ + 2 → a ⊆ Mouter) + (huOut : u ∉ Mouter) (huCase : u = s₁ ∨ u ∈ Λ y) + (hvShell : v ∉ Λ y \ Minner) (hvPlace : v = s₂ ∨ v ∈ ⋃ z ∈ Y, Λ z) + (ht₁Λ : t₁ ∈ Λ y) (hShort₁ : d {s₁} {t₁} < ψ) + (hLong : 2 * ψ ≤ d' {s₁} {s₂}) + (hP : IsGraphPathWithEnds G P (η.vMap u) (η.vMap v)) (huv : u ≠ v) + (hInter : V(P) ∩ V(η.imageGraph) = {η.vMap u, η.vMap v}) : False := by + have hyH := hY hy + have hyA : ({y} : Set S) ∈ H.A := Or.inl (Or.inl ⟨y, hyH, rfl⟩) + have huA : ({u} : Set S) ∈ H.A := Or.inl (Or.inl ⟨u, hu, rfl⟩) + have hvA : ({v} : Set S) ∈ H.A := Or.inl (Or.inl ⟨v, hv, rfl⟩) + obtain ⟨hLower, hUpper⟩ := section9_last_vertex_bounds (hZone y hy) hyH hs₁ ht₁ hu + hSymm hTri hCapture huOut ht₁Λ hShort₁ huCase + have hFar := section9_last_vertex_far hY hy hu hTri hSymm hSep (by omega) + (show ψ ≤ d {u} {y} by omega) hUpper + have hShort : d {u} {v} < ψ := by + by_contra hlong + have hd : ψ ≤ d {u} {v} := by omega + exact hNoPath P u v hu hv (isHPath_of_far_ends hS η hMet hu hv hP + (fun he => huv (η.bijOn_v.injOn hu hv he)) hInter (hψ.trans hd)) hd hFar + have hvNotInner : v ∉ Minner := by + intro hvin + have hdv := hInner.dist_le {v} hvA (singleton_subset_iff.mpr (subset_closure hvin)) + have hb := hTri {u} huA {v} hvA {y} hyA + rw [hSymm {v} hvA {y} hyA] at hb + omega + have hvNotΛ : v ∉ Λ y := fun hvΛ => hvShell ⟨hvΛ, hvNotInner⟩ + rcases hvPlace with hvEnd | hvZones + · subst v + rcases huCase with huEnd | huΛ + · have hb := hLe s₁ s₂ + rw [pointDist_of_mem_vertices d hs₁ hs₂, + pointDist_of_mem_vertices d' hs₁New hs₂New] at hb + rw [huEnd] at hShort + omega + · have hShort₂ : d {s₂} {u} < ψ := by + rw [hSymm {s₂} hvA {u} huA] + exact hShort + exact section9_distinct_entered_regions hs₁ hs₂ ht₁ hu hs₁New hs₂New + (zone_mem_R_clearFamily hZone hdis hy) ht₁Λ huΛ hLe hNewTri hNewSymm hShort₁ hShort₂ hLong + · obtain ⟨z, hz, hvΛz⟩ := mem_iUnion₂.mp hvZones + have hyz : y ≠ z := fun he => hvNotΛ (he.symm ▸ hvΛz) + have hzA : ({z} : Set S) ∈ H.A := Or.inl (Or.inl ⟨z, hY hz, rfl⟩) + have hvz := (hZone z hz).dist_le {v} hvA (singleton_subset_iff.mpr (subset_closure hvΛz)) + have hb₁ := hTri {y} hyA {u} huA {z} hzA + have hb₂ := hTri {u} huA {v} hvA {z} hzA + rw [hSymm {y} hyA {u} huA] at hb₁ + rw [hSymm {v} hvA {z} hzA] at hb₂ + have hsep := hSep z hz hyz + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9FreeClearing.lean b/LeanPool/GraphMinor/GM16/Section9FreeClearing.lean new file mode 100644 index 0000000000..9d499e6113 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9FreeClearing.lean @@ -0,0 +1,49 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Section4 +import LeanPool.GraphMinor.GM16.Section9Compressions +import LeanPool.GraphMinor.GM16.Section9ZonePreservation +import LeanPool.GraphMinor.GM14.Section3 + +/-! +# Free sets under a battlefield clearing + +Claim (3) of XVI (8.1) uses XV (4.7). The atom condition in that +theorem follows from the zone bound: atoms farther than the radius +survive the clearing. This file supplies that application with all +its side conditions. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The application of XV (4.7) in XVI (8.1), Claim (3), page 72. +A free set sufficiently far from the centre remains free after clearing. -/ +theorem freeSet_after_clearing + (hS : IsClosedSurface S) {H : Drawing S} {θ γ : ℕ} {z Λ X : Set S} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} (hMet : HasTangleMetric H θ T d) + (hγ : 2 ≤ γ) (hθ : 4 * γ + 2 < θ) + (hZone : IsLambdaZoneAround H d γ z Λ) + (hClear : IsClearedTangle H T d θ γ Λ T' d') + (hFree : IsFreeSet H.toHypergraph T θ X) + (hFar : ∀ v ∈ X, 2 * X.ncard + 5 * γ + 2 < d z {v}) : + IsFreeSet (clearedSubdrawing H Λ).toHypergraph T' (θ - (4 * γ + 2)) X := by + exact GraphMinor.GM15.theorem_4_7_proof.{w} H (clearedSubdrawing H Λ) θ γ T T' d d' z X hS + inferInstance + hMet hZone.z_mem hγ hFree hFar (clearedSubdrawing_isTwoCell hMet.1.1 hZone) + (fun a ha hfar => far_atom_mem_cleared hZone ha hfar) + (compression_of_clearing hMet hθ hClear) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9FreeFamily.lean b/LeanPool/GraphMinor/GM16/Section9FreeFamily.lean new file mode 100644 index 0000000000..11dd22fce3 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9FreeFamily.lean @@ -0,0 +1,119 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +public import LeanPool.GraphMinor.GM15.Section4 +import LeanPool.GraphMinor.GM16.Section9FreeClearing +import LeanPool.GraphMinor.GM16.Section9Compressions +import LeanPool.GraphMinor.GM16.Section9Dials +import LeanPool.GraphMinor.GM16.Section9ClearFamily +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM14.Section3b + + +import LeanPool.GraphMinor.GM12.Section710 + +/-! +# Free sets after clearing the battlefield discs + +XVI (8.1), page 71, clears the discs one at a time. Each remaining +disc is still a zone. Induction gives the stated total loss of order +and the two comparisons of point distances. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The successive clearings in XVI (8.1), page 71, have total loss +`(4γ + 2)|Y|`. No choice of their order is part of the conclusion. -/ +theorem exists_free_compression_clearFamily + (hS : IsClosedSurface S) (ys : Finset S) (Λ : S → Set S) (γ : ℕ) + (hγ : 2 ≤ γ) (X : Set S) + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hMet : HasTangleMetric H θ T d) + (hY : ∀ y ∈ ys, y ∈ H.V) + (hZone : ∀ y ∈ ys, IsLambdaZoneAround H d γ {y} (Λ y)) + (hdis : ∀ y ∈ ys, ∀ z ∈ ys, y ≠ z → Disjoint (closure (Λ y)) (closure (Λ z))) + (hθ : (4 * γ + 2) * ys.card < θ) + (hFree : GM10.IsFreeSet H.toHypergraph T θ X) + (hFar : ∀ y ∈ ys, ∀ v ∈ X, + 2 * X.ncard + 5 * γ + 2 + (4 * γ + 2) * ys.card < d {y} {v}) : + ∃ (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (d' : Set S → Set S → ℕ), + IsLambdaCompression H (clearEnvelopeDrawing H (ys : Set S) Λ) + θ ((4 * γ + 2) * ys.card) T T' d d' ∧ + (∀ x y : S, pointDist (clearEnvelopeDrawing H (ys : Set S) Λ) d' x y ≤ pointDist H d x y) ∧ + GM10.IsFreeSet (clearEnvelopeDrawing H (ys : Set S) Λ).toHypergraph T' + (θ - (4 * γ + 2) * ys.card) X := by + classical + induction ys using Finset.induction_on generalizing H θ T d with + | empty => + have heq : clearEnvelopeDrawing H (↑(∅ : Finset S)) Λ = H := by + change H.interSet (univ \ ⋃ y ∈ (↑(∅ : Finset S) : Set S), Λ y) = H + simp only [Finset.coe_empty] + have hu : (⋃ y ∈ (∅ : Set S), Λ y) = ∅ := by simp + simpa using drawing_interSet_univ H + refine ⟨T, d, ?_, ?_, ?_⟩ + · simpa only [Finset.card_empty, Nat.mul_zero, heq, Nat.sub_zero] using + (show IsLambdaCompression H H θ 0 T T d d from + ⟨by simpa using hθ, hMet, hMet, fun _ _ => Nat.le_add_right _ _⟩) + · intro x y + rw [heq] + · simpa only [heq, Finset.card_empty, Nat.mul_zero, Nat.sub_zero] using hFree + | @insert j ys hj ih => + have hjmem : j ∈ insert j ys := Finset.mem_insert_self _ _ + have hθj : 4 * γ + 2 < θ := by + rw [Finset.card_insert_of_notMem hj] at hθ + have hb := Nat.mul_le_mul_left (4 * γ + 2) (show 1 ≤ ys.card + 1 by omega) + omega + obtain ⟨T₁, d₁, hClear, _⟩ := GraphMinor.GM14.theorem_3_2_proof hS inferInstance + (by omega) hMet (hZone j hjmem) + let H₁ := clearedSubdrawing H (Λ j) + have hMet₁ : HasTangleMetric H₁ (θ - (4 * γ + 2)) T₁ d₁ := by + simpa only [Nat.sub_sub] using hClear.hasMetric + obtain ⟨hY₁, hZone₁⟩ := clearing_preserves_disjoint_zones + (fun y hy => hY y (Finset.mem_insert_of_mem hy)) + (fun y hy => hZone y (Finset.mem_insert_of_mem hy)) (hZone j hjmem) + (fun y hy => hdis y (Finset.mem_insert_of_mem hy) j hjmem + (fun heq => hj (heq ▸ hy))) hClear + have hθ₁ : (4 * γ + 2) * ys.card < θ - (4 * γ + 2) := by + rw [Finset.card_insert_of_notMem hj, Nat.mul_add, Nat.mul_one] at hθ + omega + have hFree₁ := freeSet_after_clearing hS hMet hγ hθj (hZone j hjmem) hClear hFree + (fun v hv => by have := hFar j hjmem v hv; omega) + have hFar₁ : ∀ y ∈ ys, ∀ v ∈ X, + 2 * X.ncard + 5 * γ + 2 + (4 * γ + 2) * ys.card < d₁ {y} {v} := by + intro y hy v hv + have hOld := hFar y (Finset.mem_insert_of_mem hy) v hv + rw [Finset.card_insert_of_notMem hj, Nat.mul_add, Nat.mul_one] at hOld + have hc := (compression_of_clearing hMet hθj hClear).dist_le y v + rw [GraphMinor.GM15.pointDist_eq_of_mem_atom + (Or.inl (Or.inl ⟨y, hY y (Finset.mem_insert_of_mem hy), rfl⟩)) + (Or.inl (Or.inl ⟨v, hFree.1 hv, rfl⟩)) (mem_singleton y) (mem_singleton v), + GraphMinor.GM15.pointDist_eq_of_mem_atom + (Or.inl (Or.inl ⟨y, hY₁ y hy, rfl⟩)) + (Or.inl (Or.inl ⟨v, hFree₁.1 hv, rfl⟩)) (mem_singleton y) (mem_singleton v)] at hc + change d {y} {v} ≤ d₁ {y} {v} + (4 * γ + 2) at hc + omega + obtain ⟨T₂, d₂, hComp₂, hLe₂, hFree₂⟩ := ih hMet₁ hY₁ hZone₁ + (fun y hy z hz hne => hdis y (Finset.mem_insert_of_mem hy) z (Finset.mem_insert_of_mem hz) + hne) hθ₁ hFree₁ hFar₁ + have heq := clearEnvelopeDrawing_insert H ys j Λ + (fun y hy => (hZone y hy).isOpenDisc.1) + obtain ⟨hComp, hLe⟩ := compression_of_clearFamily_insert hj hMet hθj hClear heq hComp₂ hLe₂ + refine ⟨T₂, d₂, hComp, hLe, ?_⟩ + rw [heq] at hFree₂ + simpa only [Finset.card_insert_of_notMem hj, Nat.mul_add, Nat.mul_one, Nat.sub_sub, + Nat.add_comm] using hFree₂ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9GlobalCut.lean b/LeanPool/GraphMinor/GM16/Section9GlobalCut.lean new file mode 100644 index 0000000000..6c0fac0fe3 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9GlobalCut.lean @@ -0,0 +1,105 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.Section9HPathCuts +import LeanPool.GraphMinor.GM16.Section9PairCount +import LeanPool.GraphMinor.GM09.Basic + +/-! +# The global boundary separator in XVI (8.1) + +Claim (5), page 72, combines one Menger separator for every pair of +boundary sets. Either one pair has the required disjoint paths, or +the union of the separators meets all such paths and has the stated +size. Only unordered pairs contribute to the union. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM14 +universe u v + +/-- The Menger and union argument of XVI (8.1), Claim (5), page 72, +before Claim (4) turns its linkage alternative into a handle span. +Menger gives cuts of size less than `φ²`; the unordered-pair count +still gives precisely the printed global bound. -/ +theorem boundary_linkages_or_global_separator {α : Type u} {β : Type v} + (G H : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) (hHG : H ≤ G) + (δ φ : ℕ) (X : Fin δ → Set α) (hX : ∀ i, X i ⊆ V(H)) + (hDis : Pairwise (fun i j => Disjoint (X i) (X j))) : + (∃ i j : Fin δ, i < j ∧ ∃ P : Fin (φ ^ 2) → Graph α β, + (∀ k, ∃ a ∈ X i, ∃ b ∈ X j, IsHPathWithEnds G H (P k) a b) ∧ + Pairwise (fun k l => Disjoint V(P k) V(P l))) ∨ + (∃ Z ⊆ V(G), Z.ncard < δ ^ 2 * φ ^ 2 / 2 + 1 ∧ + Z ∩ V(H) ⊆ ⋃ i, X i ∧ + ∀ i j : Fin δ, i ≠ j → ∀ P a b, + IsHPathWithEnds G H P a b → a ∈ X i → b ∈ X j → (V(P) ∩ Z).Nonempty) := by + classical + by_cases hPack : ∃ i j : Fin δ, i < j ∧ ∃ P : Fin (φ ^ 2) → Graph α β, + (∀ k, ∃ a ∈ X i, ∃ b ∈ X j, IsHPathWithEnds G H (P k) a b) ∧ + Pairwise (fun k l => Disjoint V(P k) V(P l)) + · exact Or.inl hPack + have hex : ∀ i j : Fin δ, ∃ Z : Finset α, + (↑Z : Set α) ⊆ V(G) ∧ Z.card ≤ φ ^ 2 ∧ (↑Z : Set α) ∩ V(H) ⊆ X i ∪ X j ∧ + (i < j → ∀ P a b, IsHPathWithEnds G H P a b → a ∈ X i → b ∈ X j → + (V(P) ∩ (↑Z : Set α)).Nonempty) := by + intro i j + by_cases hij : i < j + · rcases disjoint_hPaths_or_boundary_separator G H hV hE hHG (X i) (X j) (hX i) (hX j) + (hDis (ne_of_lt hij)) (φ ^ 2) with hPaths | ⟨Z, hZG, hZcard, hZH, hCut⟩ + · exact False.elim (hPack ⟨i, j, hij, hPaths⟩) + · have hfin := hV.subset hZG + refine ⟨hfin.toFinset, ?_, ?_, ?_, fun _ => ?_⟩ + · simpa only [hfin.coe_toFinset] using hZG + · rw [← Set.ncard_eq_toFinset_card _ hfin] + exact le_of_lt hZcard + · simpa only [hfin.coe_toFinset] using hZH + · simpa only [hfin.coe_toFinset] using hCut + · refine ⟨∅, ?_, ?_, ?_, fun h => False.elim (hij h)⟩ + · simp + · simp + · simp + choose cuts hcutsG hcutsCard hcutsH hcutsHit using hex + let pairs : Finset (Fin δ × Fin δ) := + (Finset.univ ×ˢ Finset.univ).filter (fun p => p.1 < p.2) + let Zf := pairs.biUnion (fun p => cuts p.1 p.2) + have hmem : ∀ i j : Fin δ, i < j → (↑(cuts i j) : Set α) ⊆ ↑Zf := by + intro i j hij x hx + exact Finset.mem_biUnion.mpr ⟨(i, j), Finset.mem_filter.mpr + ⟨Finset.mem_product.mpr ⟨Finset.mem_univ _, Finset.mem_univ _⟩, hij⟩, hx⟩ + have hZG : (↑Zf : Set α) ⊆ V(G) := by + intro x hx + obtain ⟨p, _, hxp⟩ := Finset.mem_biUnion.mp hx + exact hcutsG p.1 p.2 hxp + have hZcard : (↑Zf : Set α).ncard < δ ^ 2 * φ ^ 2 / 2 + 1 := by + rw [Set.ncard_coe_finset] + have hb := pair_separator_union_bound (Finset.univ : Finset (Fin δ)) φ cuts + (fun i _ j _ _ => hcutsCard i j) + simpa only [Finset.card_univ, Fintype.card_fin] using hb + refine Or.inr ⟨↑Zf, hZG, hZcard, ?_, ?_⟩ + · rintro x ⟨hxZ, hxH⟩ + obtain ⟨p, _, hxp⟩ := Finset.mem_biUnion.mp hxZ + rcases hcutsH p.1 p.2 ⟨hxp, hxH⟩ with hi | hj + · exact mem_iUnion.mpr ⟨p.1, hi⟩ + · exact mem_iUnion.mpr ⟨p.2, hj⟩ + · intro i j hij P a b hP ha hb + rcases lt_or_gt_of_ne hij with hlt | hgt + · obtain ⟨x, hxP, hxCut⟩ := hcutsHit i j hlt P a b hP ha hb + exact ⟨x, hxP, hmem i j hlt hxCut⟩ + · have hP' : IsHPathWithEnds G H P b a := + ⟨hP.1, hP.2.1.symm, Ne.symm hP.2.2.1, hP.2.2.2.2.1, hP.2.2.2.1, + hP.2.2.2.2.2.1.trans (by ext x; simp only [mem_insert_iff, mem_singleton_iff]; exact + or_comm), + hP.2.2.2.2.2.2⟩ + obtain ⟨x, hxP, hxCut⟩ := hcutsHit j i hgt P b a hP' hb ha + exact ⟨x, hxP, hmem j i hgt hxCut⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9HPathCuts.lean b/LeanPool/GraphMinor/GM16/Section9HPathCuts.lean new file mode 100644 index 0000000000..a5ac17401e --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9HPathCuts.lean @@ -0,0 +1,132 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.Section9Menger +import LeanPool.GraphMinor.GM09.Basic +import Mathlib.Combinatorics.Graph.Delete + +/-! +# Separators for paths between battlefield boundaries + +In XVI (8.1), Claim (5), Menger is applied after removing the edges +of the cleared drawing and its vertices outside the two boundary sets. +Trimming a path between the two sets then gives a path whose only +vertices in the drawing are its ends. +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM14 +universe u v + +/-- The graph used for the pair of boundary sets in the Menger argument +of XVI (8.1), Claim (5), page 72. -/ +def boundaryPathGraph {α : Type u} {β : Type v} (G H : Graph α β) (X Y : Set α) : Graph α β := + (G.deleteVerts (V(H) \ (X ∪ Y))).deleteEdges E(H) + +/-- The auxiliary graph is a subgraph of the ambient graph. -/ +theorem boundaryPathGraph_le {α : Type u} {β : Type v} + (G H : Graph α β) (X Y : Set α) : boundaryPathGraph G H X Y ≤ G := + deleteEdges_le.trans deleteVerts_le + +/-- Vertices of the drawing retained in the auxiliary graph belong to +one of the two boundary sets. -/ +theorem boundaryPathGraph_vertex_mem {α : Type u} {β : Type v} + {G H : Graph α β} {X Y : Set α} {x : α} + (hx : x ∈ V(boundaryPathGraph G H X Y)) (hxH : x ∈ V(H)) : x ∈ X ∪ Y := by + change x ∈ V(G.deleteVerts (V(H) \ (X ∪ Y))) at hx + rw [vertexSet_deleteVerts] at hx + exact by_contra fun hnot => hx.2 ⟨hxH, hnot⟩ + +/-- A path trimmed between the two boundary sets is an `H`-path in +`G` when viewed in the auxiliary graph. -/ +theorem boundary_fromTo_isHPath {α : Type u} {β : Type v} + {G H P : Graph α β} {X Y : Set α} {a b : α} + (hHG : H ≤ G) (hX : X ⊆ V(H)) (hY : Y ⊆ V(H)) (hXY : Disjoint X Y) + (ha : a ∈ X) (hb : b ∈ Y) + (hP : IsFromToPathWithEnds (boundaryPathGraph G H X Y) P X Y a b) : + IsHPathWithEnds G H P a b := by + have hPG := hP.1.mono (boundaryPathGraph_le G H X Y) + refine ⟨hHG, hPG, fun heq => hXY.notMem_of_mem_left ha (heq.symm ▸ hb), hX ha, hY hb, ?_, ?_⟩ + · ext x + constructor + · rintro ⟨hxP, hxH⟩ + rcases boundaryPathGraph_vertex_mem (hP.1.1.vertexSet_mono hxP) hxH with hxX | hxY + · exact Or.inl (mem_singleton_iff.mp (hP.2.1 ▸ ⟨hxP, hxX⟩)) + · exact Or.inr (mem_singleton_iff.mp (hP.2.2 ▸ ⟨hxP, hxY⟩)) + · rintro (rfl | rfl) + · exact ⟨hPG.left_mem, hX ha⟩ + · exact ⟨hPG.right_mem, hY hb⟩ + · apply disjoint_left.mpr + intro e heP heH + have heK := hP.1.1.edgeSet_mono heP + change e ∈ E(G.deleteVerts (V(H) \ (X ∪ Y))) \ E(H) at heK + exact heK.2 heH + +/-- Every `H`-path between the two boundary sets lies in the auxiliary +graph used for Menger. -/ +theorem hPath_le_boundaryPathGraph {α : Type u} {β : Type v} + {G H P : Graph α β} {X Y : Set α} {a b : α} + (ha : a ∈ X) (hb : b ∈ Y) (hP : IsHPathWithEnds G H P a b) : + P ≤ boundaryPathGraph G H X Y := by + have hOut : ∀ x ∈ V(P), x ∉ V(H) \ (X ∪ Y) := by + intro x hxP hx + have hxEnd : x ∈ ({a, b} : Set α) := hP.2.2.2.2.2.1 ▸ ⟨hxP, hx.1⟩ + rcases hxEnd with rfl | rfl + · exact hx.2 (Or.inl ha) + · exact hx.2 (Or.inr hb) + constructor + · intro x hx + change x ∈ V(G.deleteVerts (V(H) \ (X ∪ Y))) + rw [vertexSet_deleteVerts] + exact ⟨hP.2.1.1.vertexSet_mono hx, hOut x hx⟩ + · intro e x y hlink + simp only [boundaryPathGraph, deleteEdges_isLink, deleteVerts_isLink] + exact ⟨⟨hP.2.1.1.isLink_mono hlink, hOut x hlink.left_mem, hOut y hlink.right_mem⟩, + fun heH => hP.2.2.2.2.2.2.notMem_of_mem_left hlink.edge_mem heH⟩ + +/-- The per-pair Menger alternative in XVI (8.1), Claim (5), page 72. +The cut meets the drawing only in the prescribed boundary sets. -/ +theorem disjoint_hPaths_or_boundary_separator {α : Type u} {β : Type v} + (G H : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) (hHG : H ≤ G) + (X Y : Set α) (hX : X ⊆ V(H)) (hY : Y ⊆ V(H)) (hXY : Disjoint X Y) (k : ℕ) : + (∃ P : Fin k → Graph α β, + (∀ i, ∃ a ∈ X, ∃ b ∈ Y, IsHPathWithEnds G H (P i) a b) ∧ + Pairwise (fun i j => Disjoint V(P i) V(P j))) ∨ + (∃ Z ⊆ V(G), Z.ncard < k ∧ Z ∩ V(H) ⊆ X ∪ Y ∧ + ∀ P a b, IsHPathWithEnds G H P a b → a ∈ X → b ∈ Y → (V(P) ∩ Z).Nonempty) := by + classical + let K := boundaryPathGraph G H X Y + have hKG := boundaryPathGraph_le G H X Y + have hXK : X ⊆ V(K) := by + intro x hx + change x ∈ V(G.deleteVerts (V(H) \ (X ∪ Y))) + rw [vertexSet_deleteVerts] + exact ⟨hHG.vertexSet_mono (hX hx), fun h => h.2 (Or.inl hx)⟩ + have hYK : Y ⊆ V(K) := by + intro y hy + change y ∈ V(G.deleteVerts (V(H) \ (X ∪ Y))) + rw [vertexSet_deleteVerts] + exact ⟨hHG.vertexSet_mono (hY hy), fun h => h.2 (Or.inr hy)⟩ + rcases disjoint_fromToPaths_or_separator K (hV.subset hKG.vertexSet_mono) + (hE.subset hKG.edgeSet_mono) X Y hXK hYK k with ⟨P, hP, hDis⟩ | ⟨Z, hZK, hZcard, hCut⟩ + · refine Or.inl ⟨P, fun i => ?_, hDis⟩ + obtain ⟨a, b, hp⟩ := hP i + have ha : a ∈ X := ((show a ∈ V(P i) ∩ X from hp.2.1.symm ▸ mem_singleton a)).2 + have hb : b ∈ Y := ((show b ∈ V(P i) ∩ Y from hp.2.2.symm ▸ mem_singleton b)).2 + exact ⟨a, ha, b, hb, boundary_fromTo_isHPath hHG hX hY hXY ha hb hp⟩ + · refine Or.inr ⟨Z, hZK.trans hKG.vertexSet_mono, hZcard, ?_, ?_⟩ + · rintro x ⟨hxZ, hxH⟩ + exact boundaryPathGraph_vertex_mem (hZK hxZ) hxH + · intro P a b hp ha hb + exact hCut P a b ⟨hPath_le_boundaryPathGraph ha hb hp, hp.2.1.2⟩ ha hb + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9HandleLinkage.lean b/LeanPool/GraphMinor/GM16/Section9HandleLinkage.lean new file mode 100644 index 0000000000..84695a9c4c --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9HandleLinkage.lean @@ -0,0 +1,101 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +import LeanPool.GraphMinor.GM16.Section9CircleSelection +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM14.Section3 + +import LeanPool.GraphMinor.GM16.Theorem35Bridge + +/-! +# Applying XV (3.5) to the selected boundary linkage + +XVI (8.1), Claim (4), starts with `φ²` disjoint paths. The selection +on two circles retains `φ` paths in the required orders. Their ends +remain free because they form subsets of the free boundary sets. +XV (3.5) then gives the span on the surface with a handle added. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 + GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- The linkage-to-handle step in XVI (8.1), Claim (4), page 72. +All the boundary order requirements of XV (3.5) are proved by the +Erdős–Szekeres selection, rather than omitted from the cited result. -/ +theorem handle_span_of_boundary_linkage + {α : Type u} {β : Type v} {G : Graph α β} {H : Drawing S} (η : SpanEmbedding H G) + {θ_star θ φ : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {d : Set S → Set S → ℕ} + {Λ₁ Λ₂ X₁ X₂ : Set S} + (hSpan : IsSigmaSpan G H η θ_star θ T_star T) (hMet : HasTangleMetric H θ T d) + (hΛ₁ : Λ₁ ∈ H.R) (hΛ₂ : Λ₂ ∈ H.R) (hne : Λ₁ ≠ Λ₂) + (hF₁ : IsOArc (subBd Λ₁)) (hF₂ : IsOArc (subBd Λ₂)) + (hC₁ : (H.interSet (subBd Λ₁)).IsCircuit) (hC₂ : (H.interSet (subBd Λ₂)).IsCircuit) + (hNoRegion : ∀ r ∈ H.R, ¬ ((∃ x ∈ (H.interSet (subBd Λ₁)).V, x ∈ closure r) ∧ + ∃ y ∈ (H.interSet (subBd Λ₂)).V, y ∈ closure r)) + (hLine : ∀ F : Set S, IsLine F → H.IsNormal F → F ⊆ univ \ (Λ₁ ∪ Λ₂) → + (F ∩ subBd Λ₁).Nonempty → (F ∩ subBd Λ₂).Nonempty → φ ≤ (F ∩ H.V).ncard) + (hφ : 3 ≤ φ) (hX₁ : X₁ ⊆ (H.interSet (subBd Λ₁)).V) + (hX₂ : X₂ ⊆ (H.interSet (subBd Λ₂)).V) + (hFree₁ : IsFreeSet H.toHypergraph T θ X₁) (hFree₂ : IsFreeSet H.toHypergraph T θ X₂) + (P : Fin (φ ^ 2) → Graph α β) (a b : Fin (φ ^ 2) → S) + (hEnds : ∀ i, a i ∈ X₁ ∧ b i ∈ X₂) + (hP : ∀ i, IsHPathWithEnds G η.imageGraph (P i) (η.vMap (a i)) (η.vMap (b i))) + (hDis : Pairwise (fun i j => Disjoint V(P i) V(P j))) : + ∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S'), + IsObtainedByAddingHandle S S' ∧ + ∃ (H' : Drawing S') (η' : SpanEmbedding H' G) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsSigmaSpan G H' η' θ_star φ T_star T' := by + have ha : Function.Injective a := by + intro i j hij + by_contra hneij + have hx := (hP i).2.1.left_mem + have hy := (hP j).2.1.left_mem + rw [← hij] at hy + exact (hDis hneij).notMem_of_mem_left hx hy + have hb : Function.Injective b := by + intro i j hij + by_contra hneij + have hx := (hP i).2.1.right_mem + have hy := (hP j).2.1.right_mem + rw [← hij] at hy + exact (hDis hneij).notMem_of_mem_left hx hy + obtain ⟨φ₁⟩ := hF₁ + obtain ⟨φ₂⟩ := hF₂ + have haF : ∀ i, a i ∈ subBd Λ₁ := by + intro i + exact interSet_U_subset (by rw [subBd_eq_frontier]; exact isClosed_frontier) + ((H.interSet (subBd Λ₁)).V_subset_U (hX₁ (hEnds i).1)) + have hbF : ∀ i, b i ∈ subBd Λ₂ := by + intro i + exact interSet_U_subset (by rw [subBd_eq_frontier]; exact isClosed_frontier) + ((H.interSet (subBd Λ₂)).V_subset_U (hX₂ (hEnds i).2)) + obtain ⟨g, hg, hOrder₁, hOrder₂⟩ := section9_select_circle_orders φ₁ φ₂ φ + (by omega) a b ha hb haF hbF + apply GraphMinor.GM16.gm15Theorem35.{u,v,w} G H η θ_star θ φ T_star T d Λ₁ Λ₂ (P ∘ g) (a ∘ g) + (b ∘ g) + hSpan hMet hΛ₁ hΛ₂ hne hC₁ hC₂ hNoRegion hLine hφ (ha.comp hg) (hb.comp hg) hOrder₁ hOrder₂ + (fun i => ⟨hX₁ (hEnds (g i)).1, hX₂ (hEnds (g i)).2⟩) (fun i => hP (g i)) + (fun i j hij => hDis (fun heq => hij (hg heq))) + · apply freeSet_subset hMet.1.2.1 hFree₁ + rintro x ⟨i, rfl⟩ + exact (hEnds (g i)).1 + · apply freeSet_subset hMet.1.2.1 hFree₂ + rintro x ⟨i, rfl⟩ + exact (hEnds (g i)).2 + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9InitialVertices.lean b/LeanPool/GraphMinor/GM16/Section9InitialVertices.lean new file mode 100644 index 0000000000..308362af05 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9InitialVertices.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM15.Defs +import LeanPool.GraphMinor.GM16.SpanMarkedSegments +import LeanPool.GraphMinor.GM16.ClearedPathVertices +import LeanPool.GraphMinor.GM16.Section9ShortPaths +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM16.MetricPoints +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM11.Section88 +import LeanPool.GraphMinor.GM09.Basic + +/-! +# The second old vertex enters a cleared disc + +Choose the next old drawing vertex along the bad path. Claim (7) +makes the initial segment short. This vertex cannot be the opposite +end because clearing does not increase distances, while the two new +ends are far apart. It therefore lies in a cleared disc. These are +the vertex choices used in XVI (8.1), Claims (7) and (8). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] +variable {α : Type u} {βe : Type v} + +/-- The next old vertex after a new-path end lies in a cleared +battlefield disc and is at old distance less than `ψ` from that end. +This includes the shortness and non-opposite-end steps of XVI (8.1), +Claims (7) and (8), pages 72–73. -/ +theorem section9_initial_vertex_enters_disc (hS : IsClosedSurface S) + {G P₀ : Graph α βe} {H : Drawing S} (η : SpanEmbedding H G) + {θ β ψ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {Y : Set S} + {Λ : S → Set S} {C : S → Drawing S} {X : S → Set S} + (η' : SpanEmbedding (clearEnvelopeDrawing H Y Λ) G) (hMap : η'.vMap = η.vMap) + (hMet : HasTangleMetric H θ T d) + (hBattle : ∀ y ∈ Y, IsBattlefield H T d θ β {y} (Λ y) (C y) (X y)) + (hψ : 3 ≤ ψ) (hβ : ψ ≤ β) + (hNoPath : ∀ Q s t, s ∈ H.V → t ∈ H.V → + IsHPathWithEnds G η.imageGraph Q (η.vMap s) (η.vMap t) → + ψ ≤ d {s} {t} → (∀ y ∈ Y, ψ ≤ d {s} {y}) → False) + (hLe : ∀ x y : S, pointDist (clearEnvelopeDrawing H Y Λ) d' x y ≤ pointDist H d x y) + {s₁ s₂ : S} (hs₁ : s₁ ∈ (clearEnvelopeDrawing H Y Λ).V) + (hs₂ : s₂ ∈ (clearEnvelopeDrawing H Y Λ).V) + (hP₀ : IsHPathWithEnds G η'.imageGraph P₀ (η.vMap s₁) (η.vMap s₂)) + (hLong : 2 * ψ ≤ d' {s₁} {s₂}) : + ∃ t ∈ H.V, ∃ y ∈ Y, t ∈ Λ y ∧ d {s₁} {t} < ψ ∧ t ≠ s₁ ∧ + ∃ R : Graph α βe, R ≤ P₀ ∧ IsGraphPathWithEnds G R (η.vMap s₁) (η.vMap t) ∧ + V(R) ∩ V(η.imageGraph) = {η.vMap s₁, η.vMap t} := by + have hClearSub : (clearEnvelopeDrawing H Y Λ).IsSubdrawing H := interSet_isSub + have hs₁H := hClearSub.1 hs₁ + have hs₂H := hClearSub.1 hs₂ + have hst : s₁ ≠ s₂ := fun heq => hP₀.2.2.1 (congrArg η.vMap heq) + obtain ⟨t, ht, hts, R, hRP, hR, hInter⟩ := + exists_initial_span_segment η hs₁H hs₂H hst hP₀.2.1 + have hZone := fun y hy => (hBattle y hy).isZone + have hsOut : ∀ y ∈ Y, s₁ ∉ Λ y := by + intro y hy + have hout := (clearFamily_U hZone ▸ (clearEnvelopeDrawing H Y Λ).V_subset_U hs₁).2 + exact fun h => hout (mem_iUnion₂.mpr ⟨y, hy, h⟩) + obtain ⟨_, _, _, hSymm, _, _⟩ := GM11.gm15_theorem_9_1 H θ T d hS inferInstance hMet + have hShort := section9_initial_segment_short hS η hMet hSymm hBattle hψ hβ + hNoPath hs₁H ht hsOut hR hts.symm hInter + have htNotEnd : t ≠ s₂ := by + intro heq + have hdist := hLe s₁ s₂ + rw [pointDist_of_mem_vertices d' hs₁ hs₂, pointDist_of_mem_vertices d hs₁H hs₂H] at hdist + rw [heq] at hShort + omega + have htPlace := old_vertex_place_on_cleared_path η η' hMap hs₁H hs₂H ht hP₀ + (hRP.vertexSet_mono hR.right_mem) hts + have htIn : t ∈ ⋃ y ∈ Y, Λ y := htPlace.resolve_left htNotEnd + obtain ⟨y, hy, hty⟩ := mem_iUnion₂.mp htIn + exact ⟨t, ht, y, hy, hty, hShort, hts, R, hRP, hR, hInter⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9InnerCapture.lean b/LeanPool/GraphMinor/GM16/Section9InnerCapture.lean new file mode 100644 index 0000000000..b39b344931 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9InnerCapture.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.Surface.DiscGrow +import LeanPool.GraphMinor.GM16.InnerOpenDisc +import LeanPool.GraphMinor.GM16.Section6ZoneWalks +import LeanPool.GraphMinor.GM14.Section6a + +/-! +# The captured zone lies inside the battlefield circuit + +Identify the battlefield's capturing open disc with the interior of +its inner closed disc. Every atom of the smaller zone closure has +radius at most its zone parameter, so the battlefield's capture +condition puts the whole smaller closure inside this inner disc. +This is the first assertion in the subproof of XVI (8.1), Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The zone in XVI (8.1), Claim (11), lies inside the inner +battlefield circuit when its radius is smaller than the battlefield size. -/ +theorem section9_zone_inside_inner_disc (hS : IsClosedSurface S) + {H C : Drawing S} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {θ β γ : ℕ} {z Λ X M D₀ : Set S} + (hB : IsBattlefield H T d θ β z Λ C X) + (hD₀ : IsClosedDisc D₀) (hD₀D : D₀ ⊆ closure Λ) (hBd : discBd D₀ = C.U) + (hM : IsLambdaZoneAround H d γ z M) (hγ : γ < β) : + closure M ⊆ discInt D₀ := by + obtain ⟨Ω, hΩ, hΩΛ, hΩbd, hCapture⟩ := hB.openDisc_includes + have hbd : discBd (closure Λ) = subBd Λ := by + rw [← IsClosedDisc.subBd_eq_discBd hS hB.isZone.isClosedDisc_closure, + subBd_closure_eq_subBd_of_isOpenDisc hS hB.isZone.isOpenDisc + hB.isZone.isOArc_bd hB.isZone.isClosedDisc_closure] + have hDis : Disjoint Ω (discBd (closure Λ)) := by + rw [hbd] + exact ((isOpen_disjoint_subBd_and_closure_eq hB.isZone.isOpenDisc.1).1).mono_left hΩΛ + have hEq : Ω = discInt D₀ := open_set_eq_discInt_of_boundary + hB.isZone.isClosedDisc_closure hD₀ hD₀D hΩ.1 + hΩ.isPathConnected.isConnected (hΩΛ.trans subset_closure) + (by rw [← subBd_eq_frontier, hΩbd, hBd]) hDis + rw [← hEq] + exact zone_closure_subset_of_atom_neighborhood hM + (fun a ha hda => hCapture a ha (lt_of_le_of_lt (Nat.lt_succ_iff.mp hda) hγ)) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9LastVertexBounds.lean b/LeanPool/GraphMinor/GM16/Section9LastVertexBounds.lean new file mode 100644 index 0000000000..bee758b605 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9LastVertexBounds.lean @@ -0,0 +1,81 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.Section9ShortPaths + +/-! +# The last old vertex before crossing the annulus + +Claim (15) in XVI (8.1) bounds the distance from this vertex to the +first battlefield centre. It is outside the larger nested zone, which +gives the lower bound. It either remains in the battlefield or is the +initial end of the path, which gives the upper bound. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] + +/-- Graph Minors XVI, proof of (8.1), Claim (15), page 75. +The two bounds use the atom capture of the outer zone and the short +initial segment from Claim (7). -/ +theorem section9_last_vertex_bounds {H : Drawing S} {d : Set S → Set S → ℕ} + {y s t u : S} {Λ M : Set S} {γ i ψ : ℕ} + (hZone : IsLambdaZoneAround H d γ {y} Λ) + (hy : y ∈ H.V) (hs : s ∈ H.V) (ht : t ∈ H.V) (hu : u ∈ H.V) + (hSymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (hTri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) + (hCapture : ∀ a ∈ H.A, d {y} a < i + ψ + 2 → a ⊆ M) + (huOut : u ∉ M) (htΛ : t ∈ Λ) (hShort : d {s} {t} < ψ) + (huCase : u = s ∨ u ∈ Λ) : + i + ψ + 2 ≤ d {u} {y} ∧ d {u} {y} ≤ γ + ψ := by + have hyA : ({y} : Set S) ∈ H.A := Or.inl (Or.inl ⟨y, hy, rfl⟩) + have huA : ({u} : Set S) ∈ H.A := Or.inl (Or.inl ⟨u, hu, rfl⟩) + have htA : ({t} : Set S) ∈ H.A := Or.inl (Or.inl ⟨t, ht, rfl⟩) + constructor + · rw [hSymm {u} huA {y} hyA] + by_contra hsmall + exact huOut (hCapture {u} huA (by omega) (mem_singleton u)) + · rcases huCase with huS | huΛ + · subst u + have hsA : ({s} : Set S) ∈ H.A := Or.inl (Or.inl ⟨s, hs, rfl⟩) + have hty := hZone.dist_le {t} htA (singleton_subset_iff.mpr (subset_closure htΛ)) + have hbound := hTri {s} hsA {t} htA {y} hyA + rw [hSymm {t} htA {y} hyA] at hbound + omega + · have hbound := hZone.dist_le {u} huA (singleton_subset_iff.mpr (subset_closure huΛ)) + rw [hSymm {u} huA {y} hyA] + exact hbound.trans (Nat.le_add_right γ ψ) + +/-- The last vertex in Claim (15) is far from every battlefield +centre. For the other centres use their separation from the first. -/ +theorem section9_last_vertex_far {H : Drawing S} {d : Set S → Set S → ℕ} + {Y : Set S} {y u : S} {γ ψ sep : ℕ} + (hY : Y ⊆ H.V) (hy : y ∈ Y) (hu : u ∈ H.V) + (hTri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, d a c ≤ d a b + d b c) + (hSymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (hSep : ∀ z ∈ Y, y ≠ z → sep ≤ d {y} {z}) + (hBudget : γ + 2 * ψ ≤ sep) (hLower : ψ ≤ d {u} {y}) (hUpper : d {u} {y} ≤ γ + ψ) : + ∀ z ∈ Y, ψ ≤ d {u} {z} := by + intro z hz + by_cases heq : y = z + · exact heq ▸ hLower + · have hyA : ({y} : Set S) ∈ H.A := Or.inl (Or.inl ⟨y, hY hy, rfl⟩) + have huA : ({u} : Set S) ∈ H.A := Or.inl (Or.inl ⟨u, hu, rfl⟩) + have hzA : ({z} : Set S) ∈ H.A := Or.inl (Or.inl ⟨z, hY hz, rfl⟩) + have hbound := hTri {y} hyA {u} huA {z} hzA + rw [hSymm {y} hyA {u} huA] at hbound + have hsep := hSep z hz heq + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Menger.lean b/LeanPool/GraphMinor/GM16/Section9Menger.lean new file mode 100644 index 0000000000..5ba2eb6753 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Menger.lean @@ -0,0 +1,111 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM16.Section3 +import LeanPool.GraphMinor.Menger.Basic +import LeanPool.GraphMinor.GM10.Defs +import LeanPool.GraphMinor.GM11.Walks + +/-! +# The path-separator alternative used in XVI (8.1) + +For Claim (5), apply Menger to two boundary sets. Trim each of the +disjoint paths at its first and last visits to those sets. If the +packing does not exist, the vertices of the resulting separation +meet every path between the sets. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM10 +universe u v + +private theorem skeleton_walk_meets_separation {α : Type u} {β : Type v} + {G A B : Hypergraph α β} (hsep : G.IsSeparation A B) + {x y : α} (w : G.skeleton.Walk x y) (hx : x ∈ A.vertexSet) (hy : y ∈ B.vertexSet) : + ∃ z ∈ w.support, z ∈ A.vertexSet ∩ B.vertexSet := by + induction w with + | nil => exact ⟨_, Walk.start_mem_support _, hx, hy⟩ + | @cons x x' y hadj rest ih => + by_cases hx' : x' ∈ A.vertexSet + · obtain ⟨z, hz, hzAB⟩ := ih hx' hy + exact ⟨z, List.mem_cons_of_mem _ hz, hzAB⟩ + · obtain ⟨_, e, hex, hex'⟩ := id hadj + have he : e ∈ (A ∪ B).edgeSet := by + rw [hsep.union_eq] + exact G.edge_mem_of_inc hex + rcases he with heA | heB + · have hinc : A.Inc e x' := by + change x' ∈ A.ends e + rw [← hsep.left_le.ends_eq e heA] + exact hex' + exact False.elim (hx' (A.vertex_mem_of_inc hinc)) + · have hinc : B.Inc e x := by + change x ∈ B.ends e + rw [← hsep.right_le.ends_eq e heB] + exact hex + exact ⟨x, Walk.start_mem_support _, hx, B.vertex_mem_of_inc hinc⟩ + +/-- Menger's theorem in the path form used by XVI (8.1), Claim (5), +page 72. The separator has size strictly below the requested packing. -/ +theorem disjoint_fromToPaths_or_separator {α : Type u} {β : Type v} + (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) + (X Y : Set α) (hX : X ⊆ V(G)) (hY : Y ⊆ V(G)) (k : ℕ) : + (∃ P : Fin k → Graph α β, + (∀ i, IsFromToPath G (P i) X Y) ∧ Pairwise (fun i j => Disjoint V(P i) V(P j))) ∨ + (∃ Z ⊆ V(G), Z.ncard < k ∧ + ∀ P x y, IsGraphPathWithEnds G P x y → x ∈ X → y ∈ Y → (V(P) ∩ Z).Nonempty) := by + classical + let GH := Hypergraph.ofGraph G hV hE + by_cases hPack : HasDisjointPaths GH.skeleton X Y k + · obtain ⟨p, hp⟩ := hPack + have hex : ∀ i : Fin k, ∃ Q : Graph α β, IsFromToPath G Q X Y ∧ + V(Q) ⊆ {z | z ∈ (p i).walk.support} := by + intro i + obtain ⟨R, hR, hRV⟩ := exists_isGraphPathWithEnds_of_skeleton_isPath hV hE + (hX (p i).first_mem) (p i).walk (p i).isPath + obtain ⟨x, hx, y, hy, Q, hQR, hQ⟩ := hR.exists_isFromToPathWithEnds (p i).first_mem + (p i).last_mem + exact ⟨Q, ⟨x, y, hQ⟩, hQR.vertexSet_mono.trans (le_of_eq hRV)⟩ + choose Q hQ hQV using hex + exact Or.inl ⟨Q, hQ, fun i j hij => (hp hij).mono (hQV i) (hQV j)⟩ + · have hnot : ¬ ∀ A B : Hypergraph α β, GH.IsSeparation A B → X ⊆ A.vertexSet → + Y ⊆ B.vertexSet → k ≤ Hypergraph.separationOrder A B := + fun hall => hPack ((GraphMinor.menger GH X Y hX hY k).mp hall) + push Not at hnot + obtain ⟨A, B, hsep, hXA, hYB, hlt⟩ := hnot + refine Or.inr ⟨A.vertexSet ∩ B.vertexSet, + inter_subset_left.trans hsep.left_le.1, hlt, ?_⟩ + intro P x y hP hx hy + obtain ⟨W, _, hPV, _⟩ := hP.2 + have hConvert : ∀ {a b : α} (W : GraphWalk P a b), + ∃ w : GH.skeleton.Walk a b, ∀ z ∈ w.support, z ∈ W.support := by + intro a b W + induction W with + | @nil a ha => exact ⟨.nil, fun _ h => h⟩ + | @cons a b c e hl rest ih => + obtain ⟨w, hw⟩ := ih + by_cases hab : a = b + · subst b + exact ⟨w, fun z hz => List.mem_cons_of_mem _ (hw z hz)⟩ + · have hlG := hP.1.isLink_mono hl + have hadj : GH.skeleton.Adj a b := ⟨hab, e, ⟨b, hlG⟩, ⟨a, hlG.symm⟩⟩ + refine ⟨.cons hadj w, ?_⟩ + intro z hz + rcases List.mem_cons.mp hz with rfl | hz + · exact List.mem_cons_self + · exact List.mem_cons_of_mem _ (hw z hz) + obtain ⟨w, hw⟩ := hConvert W + obtain ⟨z, hzw, hzAB⟩ := skeleton_walk_meets_separation hsep w (hXA hx) (hYB hy) + exact ⟨z, hPV.symm ▸ hw z hzw, hzAB⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9NestedZones.lean b/LeanPool/GraphMinor/GM16/Section9NestedZones.lean new file mode 100644 index 0000000000..ebc22f6155 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9NestedZones.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +import LeanPool.GraphMinor.GM16.Section6ZoneWalks + +import LeanPool.GraphMinor.GM14.Section9a + +/-! +# The nested zones in XVI (8.1) + +After Claim (9), Section 9 chooses zones at successive radii around +one centre. A gap of three between the indices puts the closure of +the smaller zone inside the larger one. The same atom argument puts +the annuli inside the battlefield disc. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The zone choices preceding Claim (10) in XVI (8.1), page 73. -/ +theorem section9_exists_nested_zones + (hS : IsClosedSurface S) {H : Drawing S} {θ β : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {y : S} (hy : y ∈ H.V) + (hMet : HasTangleMetric H θ T d) (hθ : β < θ) : + ∃ M : ℕ → Set S, ∀ i, 3 ≤ i → i ≤ β - 3 → + IsLambdaZoneAround H d (i + 2) {y} (M i) ∧ + ∀ a ∈ H.A, d {y} a < i → a ⊆ M i := by + classical + have hex : ∀ i : ℕ, ∃ A : Set S, (3 ≤ i ∧ i ≤ β - 3) → + IsLambdaZoneAround H d (i + 2) {y} A ∧ ∀ a ∈ H.A, d {y} a < i → a ⊆ A := by + intro i + by_cases hi : 3 ≤ i ∧ i ≤ β - 3 + · obtain ⟨A, hA⟩ := GraphMinor.GM14.theorem_9_2_proof.{w} H θ i T d {y} hS inferInstance hMet + (Or.inl (Or.inl ⟨y, hy, rfl⟩)) (by omega) (by omega) + exact ⟨A, fun _ => hA⟩ + · exact ⟨∅, fun h => False.elim (hi h)⟩ + choose M hM using hex + exact ⟨M, fun i hi hβ => hM i ⟨hi, hβ⟩⟩ + +/-- Graph Minors XVI, proof of (8.1), Claim (12), page 74. +The atom containing a point of the smaller closure has distance at +most `i + 2`, so it belongs to the larger zone when `i + 3 ≤ j`. -/ +theorem section9_nested_closures {H : Drawing S} {d : Set S → Set S → ℕ} + {y : S} {M : ℕ → Set S} {i j : ℕ} + (hi : IsLambdaZoneAround H d (i + 2) {y} (M i)) + (hj : ∀ a ∈ H.A, d {y} a < j → a ⊆ M j) (hgap : i + 3 ≤ j) : + closure (M i) ⊆ M j := + zone_closure_subset_of_atom_neighborhood hi (fun a ha hd => hj a ha (by omega)) + +/-- The battlefield containment in XVI (8.1), Claim (13), page 74. +The entire outer zone closure lies in the battlefield disc when its +radius is less than the battlefield size. -/ +theorem section9_zone_inside_battlefield {H : Drawing S} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {θ β i : ℕ} {y : S} {Λ M X : Set S} {C : Drawing S} + (hBattle : IsBattlefield H T d θ β {y} Λ C X) + (hM : IsLambdaZoneAround H d (i + 2) {y} M) (hbound : i + 3 ≤ β) : + closure M ⊆ Λ := by + obtain ⟨Δ, _, hΔΛ, _, hSmall⟩ := hBattle.openDisc_includes + exact (zone_closure_subset_of_atom_neighborhood hM + (fun a ha hd => hSmall a ha (by omega))).trans hΔΛ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9NoAnnularSeparation.lean b/LeanPool/GraphMinor/GM16/Section9NoAnnularSeparation.lean new file mode 100644 index 0000000000..9c2bd4bd35 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9NoAnnularSeparation.lean @@ -0,0 +1,102 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.Section9ZoneSeparation +import LeanPool.GraphMinor.GM16.Section9RadialBoundary +import LeanPool.GraphMinor.GM16.Section9RadialObstruction +import LeanPool.GraphMinor.GM16.DrawingConnected +import LeanPool.GraphMinor.GM11.RadialFacts +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM12.Section4WalkMetric +import LeanPool.GraphMinor.GM14.Section7b + +/-! +# No small separator between the nested zone boundaries + +The radial form of the planar Menger step in XVI (8.1), Claim (10), +marks the radial regions of the inner separation side. That side is +small in the tangle. Its radial boundary captures an edge at the +centre, so one of its circuits encloses the inner open zone. The +circuit has at most twice as many edges as separator vertices. The +short radial enclosure contradiction then rules it out. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The small-separator contradiction in the planar Menger step of +XVI (8.1), Claim (10), page 73. The separation has already been moved +into the annulus by `exists_annular_separation`. -/ +theorem section9_no_annular_separation (hS : IsClosedSurface S) + {H : Drawing S} {θ γ κ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {y : S} {Λ M : Set S} {A B : Hypergraph S (Set S)} + (hMet : HasTangleMetric H θ T d) (hy : y ∈ H.V) + (hΛ : IsLambdaZoneAround H d γ {y} Λ) + (hM : IsLambdaZoneAround H d (κ + 2) {y} M) + (hCapture : ∀ a ∈ H.A, d {y} a < κ → a ⊆ M) + (_hκ : 3 ≤ κ) (hOrder : κ + γ < θ) + (hSep : H.toHypergraph.IsSeparation A B) (hSmallOrder : Hypergraph.separationOrder A B < κ) + (hOuter : ∀ e ∈ A.edgeSet, e ⊆ Λ) + (hInner : ∀ e ∈ H.E, e ⊆ closure M → e ∈ A.edgeSet) : False := by + have hθ : 2 ≤ θ := by omega + have hAB : (A, B) ∈ T := separation_mem_of_edges_in_zone hS hMet hθ hy hΛ hSep + (by omega) (fun e he => (hOuter e he).trans subset_closure) + obtain ⟨hResp, K, ins, hK, hd, hMetric⟩ := hMet + have hMet : HasTangleMetric H θ T d := ⟨hResp, K, ins, hK, hd, hMetric⟩ + have hE := edges_nonempty_of_tangle hS hMet.1 hθ + have hFacts := regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hE + have hInd := (theorem_6_3_of_regionFacts (Γ := PaintingOrDrawing.drawing H) hS + hMet.1.2.1.isPretangle hK.2.1 hd hFacts).2 + have hMem : (A, B) ∈ inducedPretangle (PaintingOrDrawing.drawing H) K θ ins := hInd ▸ hAB + have hSmall := hMem.2.2 + let N := boundaryDrawing K (PaintingOrDrawing.regionsIncludingEdge K A) + have hNK : N.IsSubdrawing K := Drawing.span_isSubdrawing K _ _ + have hAnnulus := radial_boundary_in_annulus hS hK hE hΛ hM hSep hOuter hInner + obtain ⟨e, he, hye⟩ := exists_edge_of_regionFacts hS hFacts hy + have heM : e ⊆ M := by + rcases edge_subset_or_subset_compl_of_zone hM he with hIn | hOut + · exact hIn + · have hyOut := closure_minimal hOut (isClosed_univ.sdiff hM.isOpenDisc.1) hye + exact False.elim (hyOut.2 (hM.z_subset (mem_singleton y))) + have heA : e ∈ A.edgeSet := hInner e he (heM.trans subset_closure) + obtain ⟨r, hr, heR⟩ := radial_region_of_edge hK he + obtain ⟨D, hD, hDN, hLen, hRIns⟩ := hSmall.2 r ⟨hr, e, heA, heR⟩ + have hDK := hDN.trans hNK + have hCut : D.V ∩ H.V ⊆ (A ∩ B).vertexSet := by + rintro x ⟨hxD, hxH⟩ + exact boundary_vertex hS hFacts hSep hxH (hDN.1 hxD) + have hCount := ncard_le_ncard hCut (A ∩ B).vertexSet_finite + have hLength := (circuit_length_eq_two_mul_ncard hK.2.1 hD hDK).1 + have hShort : D.length < 2 * κ := by + change (D.V ∩ H.V).ncard ≤ Hypergraph.separationOrder A B at hCount + omega + have hDU : D.U ⊆ closure Λ := hDN.U_subset.trans hAnnulus.1 + have hDM : Disjoint D.U M := hAnnulus.2.mono hDN.U_subset Subset.rfl + obtain ⟨hIns, hInsBd, _⟩ := hd D hD hDK hLen + have hfr : frontier (ins D) = D.U := by rw [← subBd_eq_frontier, hInsBd] + have hMIns : M ⊆ ins D := by + obtain ⟨x, hxe⟩ := he.1 + exact subset_of_disjoint_frontier hM.isOpenDisc.isPathConnected.isConnected.isPreconnected + hIns.isClosed (hfr ▸ hDM.symm) (heM hxe) (hRIns (heR hxe)) + have hInsOut := GraphMinor.GM14.theorem_7_5_proof H K D θ γ T d ins {y} Λ + hS inferInstance hMet hK hd hΛ hD hDK hDU (by omega) + have hBd : discBd (ins D) = D.U := by + rw [← GraphMinor.GM11.IsClosedDisc.frontier_eq_discBd hS hIns, hfr] + obtain ⟨_, _, _, hSymm, _, _⟩ := GraphMinor.GM11.gm15_theorem_9_1 H θ T d hS inferInstance hMet + exact section9_no_short_radial_enclosure hS hMet hK hd hMetric hy + (hM.z_subset (mem_singleton y)) hΛ hCapture hSymm (by omega) hD hDK hShort hDU + hIns hInsOut hBd (fun x hx => ⟨hMIns hx, hDM.notMem_of_mem_right hx⟩) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9PairCount.lean b/LeanPool/GraphMinor/GM16/Section9PairCount.lean new file mode 100644 index 0000000000..0167581a26 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9PairCount.lean @@ -0,0 +1,85 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Data.Finset.Card +public import Mathlib.Data.Finset.Prod +import Mathlib.Algebra.Order.BigOperators.Group.Finset +import Mathlib.Algebra.BigOperators.Group.Finset.Basic +import Mathlib.Tactic.Linarith + +/-! +# Counting the pairs in XVI (8.1) + +Claim (5), page 72, takes the union of one separator for each unordered +pair of battlefield discs. There are at most half as many such pairs +as ordered pairs. Thus separators of size less than `φ²` already give +the stated bound. The printed per-pair bound `φ²/2` is unnecessary: +Menger's theorem gives size less than `φ²` from Claim (4). +-/ + +public section +namespace GraphMinor.GM16 +open Finset + +/-- The ordered pairs with first coordinate smaller than the second +occupy at most half of the square of a finite linearly ordered set. -/ +theorem twice_card_increasing_pairs {ι : Type*} [LinearOrder ι] (s : Finset ι) : + 2 * ((s ×ˢ s).filter (fun p => p.1 < p.2)).card ≤ s.card ^ 2 := by + classical + let t := (s ×ˢ s).filter (fun p => p.1 < p.2) + have hswap : (t.image Prod.swap).card = t.card := + card_image_of_injective t Prod.swap_injective + have hdis : Disjoint t (t.image Prod.swap) := by + apply disjoint_left.mpr + intro p hp hp' + obtain ⟨q, hq, hqp⟩ := mem_image.mp hp' + have hpLt := (mem_filter.mp hp).2 + have hqLt := (mem_filter.mp hq).2 + subst p + exact lt_asymm hpLt hqLt + have hsub : t ∪ t.image Prod.swap ⊆ s ×ˢ s := by + intro p hp + rcases mem_union.mp hp with hp | hp + · exact (mem_filter.mp hp).1 + · obtain ⟨q, hq, rfl⟩ := mem_image.mp hp + have hq' := mem_product.mp (mem_filter.mp hq).1 + exact mem_product.mpr ⟨hq'.2, hq'.1⟩ + have hc := card_le_card hsub + rw [card_union_of_disjoint hdis, hswap, card_product] at hc + simpa only [pow_two, two_mul] using hc + +/-- The union of one finite separator of size at most `φ²` for each +increasing pair satisfies the bound in XVI (8.1), Claim (5). In the +paper, Menger gives the stronger per-pair bound strictly below `φ²`. -/ +theorem pair_separator_union_bound {ι α : Type*} [LinearOrder ι] [DecidableEq α] + (s : Finset ι) (φ : ℕ) (Z : ι → ι → Finset α) + (hZ : ∀ i ∈ s, ∀ j ∈ s, i < j → (Z i j).card ≤ φ ^ 2) : + (((s ×ˢ s).filter (fun p => p.1 < p.2)).biUnion (fun p => Z p.1 p.2)).card < + s.card ^ 2 * φ ^ 2 / 2 + 1 := by + classical + let t := (s ×ˢ s).filter (fun p => p.1 < p.2) + have hb : (t.biUnion (fun p => Z p.1 p.2)).card ≤ t.card * φ ^ 2 := by + calc + _ ≤ ∑ p ∈ t, (Z p.1 p.2).card := card_biUnion_le + _ ≤ ∑ _p ∈ t, φ ^ 2 := by + apply sum_le_sum + intro p hp + have hm := mem_product.mp (mem_filter.mp hp).1 + exact hZ p.1 hm.1 p.2 hm.2 (mem_filter.mp hp).2 + _ = _ := by simp + have hpairs := twice_card_increasing_pairs s + have hm := Nat.mul_le_mul_right (φ ^ 2) hpairs + have hdouble : 2 * (t.biUnion (fun p => Z p.1 p.2)).card ≤ s.card ^ 2 * φ ^ 2 := by + dsimp only [t] at hb + nlinarith + dsimp only [t] at hdouble + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Parameters.lean b/LeanPool/GraphMinor/GM16/Section9Parameters.lean new file mode 100644 index 0000000000..882049736c --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Parameters.lean @@ -0,0 +1,130 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Ring +public import Mathlib.Algebra.Group.Nat.Even + +/-! +# The constants in the main proof of Graph Minors XVI + +Section 9 chooses the battlefield size before clearing the discs. The bounds +below check that this choice leaves enough order for every clearing and for +the later freeness argument. They also check that all the annuli used near +the end of the proof exist. +-/ + +public section +namespace GraphMinor.GM16 + +private theorem hairs_le_section9_kappa (δ φ : ℕ) (hφ : 3 ≤ φ) : + δ ≤ δ ^ 2 * φ ^ 2 / 2 + 1 := by + by_cases hδ : δ = 0 + · subst δ + simp + have hδpos : 1 ≤ δ := by omega + have hsquare : δ ≤ δ ^ 2 := by nlinarith + have hφsquare : 2 ≤ φ ^ 2 := by nlinarith + have hprod : 2 * δ ≤ δ ^ 2 * φ ^ 2 := by + calc + 2 * δ = δ * 2 := Nat.mul_comm _ _ + _ ≤ δ * φ ^ 2 := Nat.mul_le_mul_left δ hφsquare + _ ≤ δ ^ 2 * φ ^ 2 := Nat.mul_le_mul_right _ hsquare + omega + +private theorem section9_order_bounds (δ β : ℕ) (hδβ : δ ≤ β) : + (12 * β + 14) * δ < 12 * (δ + 3) * (β + 1) ∧ + 16 * β + 17 ≤ 12 * (δ + 3) * (β + 1) ∧ + 2 * β + 5 * (3 * β + 3) + 2 < + 12 * (δ + 3) * (β + 1) - (12 * β + 14) * (δ - 1) - 1 := by + have hδ : δ - 1 ≤ δ := Nat.sub_le _ _ + have hmul : (12 * β + 14) * (δ - 1) ≤ (12 * β + 14) * δ := + Nat.mul_le_mul_left _ hδ + by_cases hz : δ = 0 + · subst δ + simp only [Nat.zero_add, Nat.sub_zero, Nat.mul_zero, Nat.zero_sub] + constructor + · nlinarith + constructor + · nlinarith + · omega + · have hstep : δ - 1 + 1 = δ := by omega + constructor + · nlinarith + constructor + · nlinarith + · have heq : (12 * β + 14) * (δ - 1) + (12 * β + 14) = (12 * β + 14) * δ := by + calc + _ = (12 * β + 14) * ((δ - 1) + 1) := by ring + _ = _ := by rw [hstep] + have hbefore : 2 * β + 5 * (3 * β + 3) + 2 + + (12 * β + 14) * (δ - 1) + 1 < 12 * (δ + 3) * (β + 1) := by nlinarith + omega + +/-- The choices in Graph Minors XVI, proof of (8.1), pages 71–74, satisfy the +order and index bounds used in Claims (2), (3), and the annulus selection. -/ +theorem section9_parameters (δ φ ψ : ℕ) (hφ : 3 ≤ φ) (hψ : 3 ≤ ψ) : + ∃ κ β γ θ : ℕ, + κ = δ ^ 2 * φ ^ 2 / 2 + 1 ∧ 1 ≤ κ ∧ + Even β ∧ κ * (ψ + 6) ≤ β ∧ β ≤ κ * (ψ + 6) + 1 ∧ + γ = 3 * β + 3 ∧ θ = 12 * (δ + 3) * (β + 1) ∧ + 4 ≤ β ∧ (4 * γ + 2) * δ < θ ∧ 16 * β + 17 ≤ θ ∧ + 2 * β + 5 * γ + 2 < θ - (4 * γ + 2) * (δ - 1) - 1 ∧ + κ + (κ - 1) * (ψ + 5) ≤ β - ψ - 5 := by + let κ := δ ^ 2 * φ ^ 2 / 2 + 1 + let β := 2 * ((κ * (ψ + 6) + 1) / 2) + have hκ : 1 ≤ κ := by dsimp [κ]; omega + have hlow : κ * (ψ + 6) ≤ β := by dsimp [β]; omega + have hhigh : β ≤ κ * (ψ + 6) + 1 := by dsimp [β]; omega + have hκβ : κ ≤ β := by + have hb := Nat.mul_le_mul_left κ (show 1 ≤ ψ + 6 by omega) + omega + have hδβ : δ ≤ β := (hairs_le_section9_kappa δ φ hφ).trans hκβ + obtain ⟨hclear, hbig, hfree⟩ := section9_order_bounds δ β hδβ + refine ⟨κ, β, 3 * β + 3, 12 * (δ + 3) * (β + 1), rfl, hκ, + ⟨(κ * (ψ + 6) + 1) / 2, by dsimp [β]; omega⟩, hlow, hhigh, rfl, rfl, ?_, ?_, hbig, ?_, ?_⟩ + · have hb := Nat.mul_le_mul_right (ψ + 6) hκ + omega + · rw [show 4 * (3 * β + 3) + 2 = 12 * β + 14 by omega] + exact hclear + · rw [show 4 * (3 * β + 3) + 2 = 12 * β + 14 by omega] + exact hfree + · have hstep : κ - 1 + 1 = κ := by omega + have heq : κ + (κ - 1) * (ψ + 5) + ψ + 5 = κ * (ψ + 6) := by nlinarith + omega + +/-- Section 9's order bound leaves room to preserve a free boundary set +through all the other clearings in Claim (3). The triangle inequality +through its own centre gives this slightly stronger numerical check. -/ +theorem section9_free_bound (δ β : ℕ) (hδβ : δ ≤ β) : + 2 * β + 6 * (3 * β + 3) + 2 + (4 * (3 * β + 3) + 2) * δ < + 12 * (δ + 3) * (β + 1) := by + nlinarith + +/-- The number of centres is at most the separator parameter chosen +in Section 9, including the empty-family case. -/ +theorem section9_hairs_le_kappa (δ φ : ℕ) (hφ : 3 ≤ φ) : + δ ≤ δ ^ 2 * φ ^ 2 / 2 + 1 := hairs_le_section9_kappa δ φ hφ + +/-- The constants of Section 9 leave room for Claim (11), and the +separation is larger than the two battlefield radii and short segments. -/ +theorem section9_path_bounds {κ β ψ θ θspan : ℕ} + (hκ : 1 ≤ κ) (hβ : κ * (ψ + 6) ≤ β) (hψ : 3 ≤ ψ) + (hθ : 16 * β + 17 ≤ θ) (hspan : θ ≤ θspan) : + ψ ≤ β ∧ κ + 3 ≤ β ∧ β < θspan ∧ + κ + (3 * β + 3) < θspan ∧ 2 * (3 * β + 3) + 2 * ψ < θ := by + have hNine : κ * 9 ≤ β := + (Nat.mul_le_mul_left κ (show 9 ≤ ψ + 6 by omega)).trans hβ + have hPsi : ψ + 6 ≤ β := by + have h := Nat.mul_le_mul_right (ψ + 6) hκ + simpa only [one_mul] using h.trans hβ + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Proof.lean b/LeanPool/GraphMinor/GM16/Section9Proof.lean new file mode 100644 index 0000000000..fe279167ed --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Proof.lean @@ -0,0 +1,260 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section8 +public import LeanPool.GraphMinor.GM15.Section4 +import LeanPool.GraphMinor.GM16.Section9Parameters +import LeanPool.GraphMinor.GM16.SpanCongr +import LeanPool.GraphMinor.GM16.Section9Rigidity +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM16.Section9ClearFamily +import LeanPool.GraphMinor.GM16.Section9SpanClearing +import LeanPool.GraphMinor.GM16.Section9Claim4 +import LeanPool.GraphMinor.GM16.Section9GlobalCut +import LeanPool.GraphMinor.GM16.Section9BoundaryVertices +import LeanPool.GraphMinor.GM16.Section9SeparatorPaths +import LeanPool.GraphMinor.GM11.CitedResults +import Mathlib.Data.Fintype.EquivFin + +import LeanPool.GraphMinor.GM09.Bridge + +import LeanPool.GraphMinor.GM12.Section710 + +import LeanPool.GraphMinor.GM12.Section77 + +import LeanPool.GraphMinor.GM14.Section9a + +import LeanPool.GraphMinor.GM14.Section9b + +import LeanPool.GraphMinor.GM16.Theorem35Bridge + +/-! +# Graph Minors XVI, (8.1) + +Follow Section 9. Choose the paper's constants and separated +battlefields. Clear them successively, preserving rigidity, the +span, and the chosen free boundary sets. A large boundary linkage +adds a handle. Otherwise Menger gives the global separator, and +the clean-annulus argument proves that it meets every long path +in the cleared drawing. All numbered claims of Section 9 are +proved in the preceding modules. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 + GraphMinor.GM15 +universe u v w + +/-- Graph Minors XVI, (8.1), pages 64 and 71–75, by the complete +battlefield, clearing, linkage, and clean-annulus proof of Section 9. +Only statements of other papers are assumed. The separation constant +is increased by `4 * φ + 8` from the printed choice on page 71 to +supply the line condition missing from the printed XV (3.5). -/ +theorem theorem_8_1_with_radius + : + ∀ {S : Type w} [TopologicalSpace S] [T2Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ δ φ ψ : ℕ, 3 ≤ φ → 3 ≤ ψ → + ∃ γ θ : ℕ, 2 ≤ γ ∧ (4 * γ + 2) * δ < θ ∧ + ∀ {α : Type u} {β : Type v} (G : Graph α β) (θ_star θ_span : ℕ) + (T_star : Set (Hypergraph α β × Hypergraph α β)) + (H : Drawing S) (η : SpanEmbedding H G) + (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (Y : Set S), + θ ≤ θ_span → + IsSigmaSpan G H η θ_star θ_span T_star T → + HasTangleMetric H θ_span T d → + Y ⊆ H.V → Y.ncard = δ → + (∀ y₁ ∈ Y, ∀ y₂ ∈ Y, y₁ ≠ y₂ → θ ≤ d {y₁} {y₂}) → + (∃ (S' : Type w) (_ : TopologicalSpace S') (_ : T2Space S') + (H' : Drawing S') (η' : SpanEmbedding H' G) (θ_span' : ℕ) + (T' : Set (Hypergraph S' (Set S') × Hypergraph S' (Set S'))), + IsObtainedByAddingHandle S S' ∧ + φ ≤ θ_span' ∧ IsSigmaSpan G H' η' θ_star θ_span' T_star T') ∨ + (∃ (P : Graph α β) (s t : S), + s ∈ H.V ∧ t ∈ H.V ∧ + IsHPathWithEnds G η.imageGraph P (η.vMap s) (η.vMap t) ∧ + ψ ≤ d {s} {t} ∧ ∀ y ∈ Y, ψ ≤ d {s} {y}) ∨ + (∃ (Λ : S → Set S) (Z : Set α) + (T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d' : Set S → Set S → ℕ), + IsEnvelope H d Y γ Λ ∧ + Z ⊆ V(G) \ V((restrictCleared η (⋃ y ∈ Y, Λ y)).imageGraph) ∧ + Z.ncard ≤ (δ ^ 2 * φ ^ 2) / 2 ∧ + IsSigmaSpan G (clearEnvelopeDrawing H Y Λ) + (restrictCleared η (⋃ y ∈ Y, Λ y)) θ_star (θ_span - (4 * γ + 2) * δ) T_star T' ∧ + IsLambdaCompression H (clearEnvelopeDrawing H Y Λ) + θ_span ((4 * γ + 2) * δ) T T' d d' ∧ + ∀ (P : Graph α β) (s t : S), + s ∈ (clearEnvelopeDrawing H Y Λ).V → + t ∈ (clearEnvelopeDrawing H Y Λ).V → + IsHPathWithEnds G (restrictCleared η (⋃ y ∈ Y, Λ y)).imageGraph P + (η.vMap s) (η.vMap t) → + 2 * ψ ≤ d' {s} {t} → + (Z ∩ V(P)).Nonempty) := by + classical + intro S _ _ hS hConn δ φ ψ hφ hψ + let : ConnectedSpace S := hConn + obtain ⟨κ, β, γ, τ₀, hκEq, hκpos, hEven, hLow, _, hγ, hτ₀, hβ4, hClear₀, hBig₀, _, hMax⟩ := + section9_parameters δ φ ψ hφ hψ + -- The corrected XV (3.5) needs room for a normal line with fewer than φ vertices. + let τ := τ₀ + 4 * φ + 8 + have hClear : (4 * γ + 2) * δ < τ := by dsimp [τ]; omega + have hBig : 16 * β + 17 ≤ τ := by dsimp [τ]; omega + subst γ + refine ⟨3 * β + 3, τ, by omega, hClear, ?_⟩ + intro α βe G θ_star θ_span T_star H η T d Y hτSpan hSpan hMet hY hYCard hSep + obtain ⟨hψβ, hκβ, hβθ, hκθ, hSepBudget⟩ := section9_path_bounds hκpos hLow hψ hBig hτSpan + by_cases hOld : ∃ (P : Graph α βe) (s t : S), s ∈ H.V ∧ t ∈ H.V ∧ + IsHPathWithEnds G η.imageGraph P (η.vMap s) (η.vMap t) ∧ + ψ ≤ d {s} {t} ∧ ∀ y ∈ Y, ψ ≤ d {s} {y} + · exact Or.inr (Or.inl hOld) + have hNoPath : ∀ Q s t, s ∈ H.V → t ∈ H.V → + IsHPathWithEnds G η.imageGraph Q (η.vMap s) (η.vMap t) → + ψ ≤ d {s} {t} → (∀ y ∈ Y, ψ ≤ d {s} {y}) → False := by + intro Q s t hs ht hQ hst hsy + exact hOld ⟨Q, s, t, hs, ht, hQ, hst, hsy⟩ + have hBExists : ∀ y : S, ∃ (Λ : Set S) (C : Drawing S) (X : Set S), + y ∈ Y → IsBattlefield H T d θ_span β {y} Λ C X := by + intro y + by_cases hy : y ∈ Y + · obtain ⟨Λ, C, X, hB⟩ := GraphMinor.GM14.theorem_9_5_proof.{w} H θ_span β T d {y} hS hConn + hSpan.isRigid hMet + (Or.inl (Or.inl ⟨y, hY hy, rfl⟩)) hβ4 hEven (hBig.trans hτSpan) + obtain ⟨X', _, hB'⟩ := hB.normalize + exact ⟨Λ, C, X', fun _ => hB'⟩ + · exact ⟨∅, H, ∅, fun h => False.elim (hy h)⟩ + choose Λ C X hBattle using hBExists + have hZone := fun y hy => (hBattle y hy).isZone + obtain ⟨_, _, _, hSymm, hTri, _⟩ := GraphMinor.GM11.gm15_theorem_9_1.{w} H θ_span T d hS hConn + hMet + have hDis : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → Disjoint (closure (Λ y)) (closure (Λ z)) := by + intro y hy z hz hyz + exact section9_disjoint_zones (hZone y hy) (hZone z hz) hSymm hTri + (hSep y hy z hz hyz) (by omega) + have hEnv := envelope_of_battlefields hSpan.isRigid hY hBattle hDis + have hYFin : Y.Finite := H.finite_V.subset hY + let ys := hYFin.toFinset + have hys : (ys : Set S) = Y := hYFin.coe_toFinset + have hysCard : ys.card = δ := (ncard_eq_toFinset_card _ hYFin).symm.trans hYCard + have hYys : ∀ y ∈ ys, y ∈ H.V := fun y hy => hY (hYFin.mem_toFinset.mp hy) + have hBattleYs : ∀ y ∈ ys, IsBattlefield H T d θ_span β {y} (Λ y) (C y) (X y) := + fun y hy => hBattle y (hYFin.mem_toFinset.mp hy) + have hZoneYs := fun y hy => (hBattleYs y hy).isZone + have hDisYs : ∀ y ∈ ys, ∀ z ∈ ys, y ≠ z → Disjoint (closure (Λ y)) (closure (Λ z)) := + fun y hy z hz => hDis y (hYFin.mem_toFinset.mp hy) z (hYFin.mem_toFinset.mp hz) + have hClearSpan : (4 * (3 * β + 3) + 2) * ys.card < θ_span := by + rw [hysCard] + exact lt_of_lt_of_le hClear hτSpan + obtain ⟨T', d', hComp, hLe⟩ := exists_compression_clearFamily hS ys Λ + (3 * β + 3) hMet hYys hZoneYs hDisYs hClearSpan + have hEnvYs : IsEnvelope H d (ys : Set S) (3 * β + 3) Λ := hys.symm ▸ hEnv + have hSpanClear := span_after_clearFamily hS ys Λ (3 * β + 3) η hSpan hEnvYs hComp + let η' := restrictCleared η (⋃ y ∈ Y, Λ y) + have hMap : η'.vMap = η.vMap := rfl + have hCompY : IsLambdaCompression H (clearEnvelopeDrawing H Y Λ) θ_span + ((4 * (3 * β + 3) + 2) * δ) T T' d d' := by simpa only [hys, hysCard] using hComp + have hSpanY : IsSigmaSpan G (clearEnvelopeDrawing H Y Λ) η' θ_star + (θ_span - (4 * (3 * β + 3) + 2) * δ) T_star T' := by + have hDrawingEq : clearEnvelopeDrawing H (ys : Set S) Λ = clearEnvelopeDrawing H Y Λ := + congrArg (fun A => clearEnvelopeDrawing H A Λ) hys + have hSpanY' := span_congr_drawing_embedding hDrawingEq _ η' rfl rfl hSpanClear + simpa only [hysCard] using hSpanY' + have hLeY : ∀ x y : S, pointDist (clearEnvelopeDrawing H Y Λ) d' x y ≤ pointDist H d x y := by + simpa only [hys] using hLe + have hδκ : δ ≤ κ := by rw [hκEq]; exact section9_hairs_le_kappa δ φ hφ + have hδβ : δ ≤ β := hδκ.trans (by omega) + have hParam : 2 * β + 6 * (3 * β + 3) + 2 + + (4 * (3 * β + 3) + 2) * ys.card < τ := by + rw [hysCard] + have hfree := section9_free_bound δ β hδβ + dsimp [τ] + rw [hτ₀] + omega + have hLineBudget : 4 * φ + (4 * (3 * β + 3) + 2) * ys.card ≤ τ := by + rw [hysCard] + dsimp [τ] + omega + have hBudget : (4 * (3 * β + 3) + 2) * ys.card + 8 < τ := by omega + let : Fintype Y := hYFin.fintype + have hCardY : Fintype.card Y = δ := by + rw [← Nat.card_eq_fintype_card, Nat.card_coe_set_eq, hYCard] + let e : Fin δ ≃ Y := (finCongr hCardY.symm).trans (Fintype.equivFin Y).symm + let B : Fin δ → Set α := fun i => η.vMap '' X (e i).val + have hBsub : ∀ i, B i ⊆ V(η'.imageGraph) := by + intro i x hx + obtain ⟨v, hv, rfl⟩ := hx + rw [← hMap] + exact η'.bijOn_v.mapsTo (boundary_vertex_mem_clearFamily hZone hDis (e i).prop + ((hBattle (e i).val (e i).prop).isFree_X.1 hv)) + have hBdis : Pairwise (fun i j => Disjoint (B i) (B j)) := by + intro i j hij + have hNe : (e i).val ≠ (e j).val := fun h => hij (e.injective (Subtype.ext h)) + exact battlefield_image_sets_disjoint η (hBattle (e i).val (e i).prop) + (hBattle (e j).val (e j).prop) (hDis _ (e i).prop _ (e j).prop hNe) + rcases boundary_linkages_or_global_separator G η'.imageGraph + hSpan.isControlling.isTangle_star.finite_V hSpan.isControlling.isTangle_star.finite_E + η'.imageGraph_le δ φ B hBsub hBdis with hPack | hCut + · obtain ⟨i, j, hij, P, hP, hPDis⟩ := hPack + have hNe : (e i).val ≠ (e j).val := fun h => (ne_of_lt hij) (e.injective (Subtype.ext h)) + have hLink : ∀ k, ∃ a ∈ X (e i).val, ∃ b ∈ X (e j).val, + IsHPathWithEnds G η'.imageGraph (P k) (η.vMap a) (η.vMap b) := by + intro k + obtain ⟨a', ha', b', hb', hPk⟩ := hP k + obtain ⟨a, ha, rfl⟩ := ha' + obtain ⟨b, hb, rfl⟩ := hb' + exact ⟨a, ha, b, hb, hPk⟩ + have hSepYs : ∀ y ∈ ys, ∀ z ∈ ys, y ≠ z → τ ≤ d {y} {z} := + fun y hy z hz => hSep y (hYFin.mem_toFinset.mp hy) z (hYFin.mem_toFinset.mp hz) + have hLinkYs : ∀ k, ∃ a ∈ X (e i).val, ∃ b ∈ X (e j).val, + IsHPathWithEnds G (restrictCleared η (⋃ q ∈ (ys : Set S), Λ q)).imageGraph + (P k) (η.vMap a) (η.vMap b) := by + have hUnion : (⋃ q ∈ (ys : Set S), Λ q) = ⋃ q ∈ Y, Λ q := by rw [hys] + have hImage : (restrictCleared η (⋃ q ∈ (ys : Set S), Λ q)).imageGraph = η'.imageGraph := + congrArg (fun A => (restrictCleared η A).imageGraph) hUnion + simpa only [hImage] using hLink + obtain ⟨S', instS', instT2', hHandle, H', ηH', T'', hSpan'⟩ := theorem_8_1_claim_4 hS η hSpan + hYys hBattleYs hDisYs hSepYs hParam hBudget hLineBudget hφ hComp + (hYFin.mem_toFinset.mpr (e i).prop) (hYFin.mem_toFinset.mpr (e j).prop) hNe P hLinkYs hPDis + exact Or.inl ⟨S', instS', instT2', H', ηH', φ, T'', hHandle, Nat.le_refl _, hSpan'⟩ + · obtain ⟨Z₀, hZ₀G, hZ₀Card, _, hZ₀Cut⟩ := hCut + have hZ₀Fin := hSpan.isControlling.isTangle_star.finite_V.subset hZ₀G + have hCardκ : Z₀.ncard < κ := by rwa [← hκEq] at hZ₀Card + have hCutY : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → ∀ Q a b, + IsHPathWithEnds G η'.imageGraph Q a b → + a ∈ η.vMap '' X y → b ∈ η.vMap '' X z → (V(Q) ∩ Z₀).Nonempty := by + intro y hy z hz hyz Q a b hQ ha hb + let i := e.symm ⟨y, hy⟩ + let j := e.symm ⟨z, hz⟩ + have hi : (e i).val = y := congrArg Subtype.val (e.apply_symm_apply ⟨y, hy⟩) + have hj : (e j).val = z := congrArg Subtype.val (e.apply_symm_apply ⟨z, hz⟩) + have hij : i ≠ j := fun h => hyz (hi.symm.trans ((congrArg (fun k => (e k).val) h).trans hj)) + apply hZ₀Cut i j hij Q a b hQ + · simpa only [B, hi] using ha + · simpa only [B, hj] using hb + refine Or.inr (Or.inr ⟨Λ, Z₀ \ V(η'.imageGraph), T', d', hEnv, ?_, ?_, hSpanY, hCompY, ?_⟩) + · exact fun x hx => ⟨hZ₀G hx.1, hx.2⟩ + · have hc := ncard_le_ncard (show Z₀ \ V(η'.imageGraph) ⊆ Z₀ from sdiff_subset) hZ₀Fin + omega + · intro P s t hs ht hP hLong + exact section9_long_new_path_meets_separator hS η η' hMap hMet hCompY.hasMetric' + hY hBattle hSep hLeY hNoPath (by rw [hYCard]; exact hκEq) hφ hψ hψβ hκβ hβθ hκθ + hSepBudget hMax hZ₀Fin hCardκ hCutY hs ht hP hLong + +/-- Graph Minors XVI, (8.1), with the printed statement. The proof +above also records that its chosen zone radius is at least two. -/ +theorem theorem_8_1_proof + : GM16Theorem81Statement.{u, v, w} := by + intro S _ _ hS hConn δ φ ψ hφ hψ + obtain ⟨γ, θ, _, hClear, hRest⟩ := theorem_8_1_with_radius hS hConn δ φ ψ hφ hψ + exact ⟨γ, θ, hClear, hRest⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9RadialBoundary.lean b/LeanPool/GraphMinor/GM16/Section9RadialBoundary.lean new file mode 100644 index 0000000000..f92bb045e4 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9RadialBoundary.lean @@ -0,0 +1,112 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM16.Section9RadialRegions +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM11.Section5b +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.Walks + +import LeanPool.GraphMinor.GM11.RadialFacts + +/-! +# The radial boundary of an annular separation + +The separator in XVI (8.1), Claim (10), separates the inner disc +from the outside of the battlefield. Mark the radial regions that +contain edges on its inner side. Their boundary stays in the outer +disc closure and misses the inner open disc. Both assertions follow +by looking at an incident radial region on the appropriate side. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +omit [ConnectedSpace S] in +/-- The boundary drawing of a family of regions lies in every closed +set containing those regions. -/ +theorem boundaryDrawing_U_subset_closed (hS : IsClosedSurface S) (K : Drawing S) + {Z : Set (Set S)} {A : Set S} (hA : IsClosed A) + (hZA : ∀ r ∈ Z, r ⊆ A) : (boundaryDrawing K Z).U ⊆ A := by + have hV : (boundaryDrawing K Z).V ⊆ A := by + intro x hx + obtain ⟨⟨r, hrZ, hxr⟩, _⟩ := (mem_boundaryDrawing_V hS).mp hx + exact closure_minimal (hZA r hrZ) hA hxr.2.2 + have hE : ∀ e ∈ (boundaryDrawing K Z).E, closure e ⊆ A := by + intro e he + obtain ⟨⟨r, hrZ, hir⟩, _⟩ := mem_boundaryDrawing_E.mp he + have heR := edge_subset_closure_of_incident hS hir.1 hir.2.1 hir.2.2 + have heA : e ⊆ A := heR.trans (closure_minimal (hZA r hrZ) hA) + exact closure_minimal heA hA + rw [(boundaryDrawing K Z).U_eq] + exact union_subset hV (iUnion₂_subset hE) + +omit [T2Space S] [ConnectedSpace S] in +/-- An old edge is contained in a region of its radial drawing. -/ +theorem radial_region_of_edge {H K : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) {e : Set S} (he : e ∈ H.E) : + ∃ r ∈ K.R, e ⊆ r := by + obtain ⟨x, hxe⟩ := he.1 + have hDis : Disjoint e K.U := by + apply disjoint_left.mpr + intro p hpe hpK + have hEq : H.U ∩ K.U = H.V := hK.2.1.1 + exact (he.2.1 hpe).2 (hEq ▸ ⟨(he.2.1 hpe).1, hpK⟩) + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem (hDis.notMem_of_mem_left hxe) + exact ⟨r, hr, subset_region hr he.2.2.1.isConnected.isPreconnected hDis hxe hxr⟩ + +/-- The radial boundary of an inner separation side stays inside the +outer zone closure and outside the inner open zone. These are the +geometric conditions in the planar Menger step of XVI (8.1). -/ +theorem radial_boundary_in_annulus (hS : IsClosedSurface S) + {H K : Drawing S} {d : Set S → Set S → ℕ} {γ γ' : ℕ} + {z Λ M : Set S} {A B : Hypergraph S (Set S)} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hE : H.E.Nonempty) + (hΛ : IsLambdaZoneAround H d γ z Λ) (hM : IsLambdaZoneAround H d γ' z M) + (hSep : H.toHypergraph.IsSeparation A B) + (hOuter : ∀ e ∈ A.edgeSet, e ⊆ Λ) + (hInner : ∀ e ∈ H.E, e ⊆ closure M → e ∈ A.edgeSet) : + (boundaryDrawing K (PaintingOrDrawing.regionsIncludingEdge K A)).U ⊆ closure Λ ∧ + Disjoint (boundaryDrawing K (PaintingOrDrawing.regionsIncludingEdge K A)).U M := by + have hFacts := regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 hE + let ZA := PaintingOrDrawing.regionsIncludingEdge K A + let ZB := PaintingOrDrawing.regionsIncludingEdge K B + have hZA : ∀ r ∈ ZA, r ⊆ closure Λ := by + rintro r ⟨hr, e, heA, heR⟩ + have heH : e ∈ H.E := hSep.left_le.2 heA + exact (radial_region_subset_zone hK hS hΛ hr heH heR (hOuter e heA)).trans subset_closure + have hZB : ∀ r ∈ ZB, r ⊆ univ \ M := by + rintro r ⟨hr, e, heB, heR⟩ + have heH : e ∈ H.E := hSep.right_le.2 heB + have heDis : Disjoint e (closure M) := by + apply disjoint_left.mpr + intro x hxe hxM + have heCl := zone_atom_subset_closure hM (Or.inl (Or.inr heH)) ⟨x, hxe, hxM⟩ + exact hSep.notMem_edgeSet_right (hInner e heH heCl) heB + have hrDis := radial_region_disjoint_zone_closure hK hS hM hr heH heR heDis + exact fun x hx => ⟨mem_univ _, fun hxM => hrDis.notMem_of_mem_left hx (subset_closure hxM)⟩ + refine ⟨boundaryDrawing_U_subset_closed hS K isClosed_closure hZA, ?_⟩ + have hZA_R : ZA ⊆ K.R := fun _ h => h.1 + have hComp : K.R \ ZA = ZB := compl_regions hFacts hSep + have hEq : boundaryDrawing K ZA = boundaryDrawing K ZB := by + rw [← hComp] + exact (boundaryDrawing_compl hZA_R).symm + have hOut := boundaryDrawing_U_subset_closed hS K + (isClosed_univ.sdiff hM.isOpenDisc.1) hZB + rw [← hEq] at hOut + exact disjoint_left.mpr fun x hxN hxM => (hOut hxN).2 hxM + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9RadialObstruction.lean b/LeanPool/GraphMinor/GM16/Section9RadialObstruction.lean new file mode 100644 index 0000000000..446b67fa44 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9RadialObstruction.lean @@ -0,0 +1,91 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +import LeanPool.GraphMinor.GM14.Section7b +import LeanPool.GraphMinor.GM11.Section4c +import LeanPool.GraphMinor.GM11.Separate +import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# The short radial circuit contradiction in XVI (8.1) + +Claim (10) excludes a short radial circuit enclosing the inner zone. +XIV (7.5) puts its tangle inside in the battlefield disc. Uniqueness +of the inside of a circle within a disc identifies that inside with +the disc enclosing the zone. A radial region touching the circuit is +then too close to the centre to touch the boundary. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +omit [ConnectedSpace S] in +omit [T2Space S] in +/-- A radial circuit meets a region of the original drawing, at an end +of any of its edges on the region side of the radial bipartition. -/ +theorem radial_circuit_meets_region {H K D : Drawing S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hD : D.IsCircuit) (hDs : D.IsSubdrawing K) : + ∃ r ∈ H.R, (r ∩ D.U).Nonempty := by + obtain ⟨e, he⟩ := GraphMinor.GM11.IsCircuit.E_nonempty hD + obtain ⟨v, _, x, hx, hEnds⟩ := hK.2.1.2.2.2.2.1 e (hDs.2 he) + obtain ⟨r, hr, hxr⟩ := hK.2.1.2.2.2.1 x hx + have hxcl : x ∈ closure e := by + have hxPair : x ∈ ({v, x} : Set S) := Or.inr rfl + exact (hEnds.symm ▸ hxPair).1 + exact ⟨r, hr, x, hxr, D.closure_subset_U he hxcl⟩ + +/-- The contradiction part of XVI (8.1), Claim (10), page 73. +No radial circuit of length less than `2κ` can bound a disc inside +the battlefield that includes the entire atom-capturing inner zone. -/ +theorem section9_no_short_radial_enclosure (hS : IsClosedSurface S) + {H K D : Drawing S} {θ γ κ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {ins : Drawing S → Set S} {y : S} {Λ M Δ : Set S} + (hMet : HasTangleMetric H θ T d) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hMetric : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = tangleMetric H K ins θ a b) + (hy : y ∈ H.V) (hyM : y ∈ M) + (hZone : IsLambdaZoneAround H d γ {y} Λ) + (hCapture : ∀ a ∈ H.A, d {y} a < κ → a ⊆ M) + (hSymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (hκ : κ ≤ θ - γ) + (hD : D.IsCircuit) (hDs : D.IsSubdrawing K) (hLen : D.length < 2 * κ) + (hDU : D.U ⊆ closure Λ) (hΔ : IsClosedDisc Δ) (hΔsub : Δ ⊆ closure Λ) + (hΔbd : discBd Δ = D.U) (hMΔ : M ⊆ Δ \ D.U) : False := by + have hDlen : D.length < 2 * θ := by omega + obtain ⟨hIns, hInsBd, _⟩ := hd D hD hDs hDlen + have hInsSub : ins D ⊆ closure Λ := GraphMinor.GM14.theorem_7_5_proof H K D θ γ T d ins {y} Λ + hS inferInstance hMet hK hd hZone hD hDs hDU (by omega) + have hInsDiscBd : discBd (ins D) = D.U := by + rw [← GraphMinor.GM11.IsClosedDisc.frontier_eq_discBd hS hIns, ← subBd_eq_frontier] + exact hInsBd + obtain ⟨Δ₀, _, hUnique⟩ := disc_oArc (closure Λ) D.U hZone.isClosedDisc_closure hDU + (GraphMinor.GM11.IsCircuit.isOArc_U hD) + have hEq : Δ = ins D := + (hUnique Δ hΔsub hΔ hΔbd).trans (hUnique (ins D) hInsSub hIns hInsDiscBd).symm + have hyIns : y ∈ ins D := hEq ▸ (hMΔ hyM).1 + obtain ⟨r, hr, x, hxr, hxD⟩ := radial_circuit_meets_region hK hD hDs + have hxIns : x ∈ ins D := by + have hbd : x ∈ discBd (ins D) := hInsDiscBd.symm ▸ hxD + exact GraphMinor.Surface.discBd_subset _ hbd + have hyA : ({y} : Set S) ∈ H.A := Or.inl (Or.inl ⟨y, hy, rfl⟩) + have hBound := (tangleMetric_le_of_circuit hS hK hd hD hDs hDlen + (Or.inr hr) hyA ⟨x, hxr, hxIns⟩ ⟨y, mem_singleton y, hyIns⟩).1 + rw [← hMetric r (Or.inr hr) {y} hyA, hSymm r (Or.inr hr) {y} hyA] at hBound + have hrM : r ⊆ M := hCapture r (Or.inr hr) (by omega) + exact (hMΔ (hrM hxr)).2 hxD + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9RadialRegions.lean b/LeanPool/GraphMinor/GM16/Section9RadialRegions.lean new file mode 100644 index 0000000000..b35b001a38 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9RadialRegions.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.OArcCircuit +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM14.Section3 + +import LeanPool.GraphMinor.GM11.RadialFacts + +/-! +# Radial regions relative to a zone boundary + +In the planar Menger step of XVI (8.1), a radial region containing +an edge inside the zone stays inside it. A radial region containing +an edge outside the zone closure stays outside. A region crossing +the zone boundary would contain a second old edge, contrary to the +unique-edge property of radial regions. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- A radial region containing an old edge away from a zone boundary +cannot meet that boundary. This is the local separation fact used in +the radial form of the planar Menger argument in XVI (8.1). -/ +theorem radial_region_disjoint_zone_boundary {H K : Drawing S} + {d : Set S → Set S → ℕ} {γ : ℕ} {z Λ r e : Set S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hS : IsClosedSurface S) + (hZone : IsLambdaZoneAround H d γ z Λ) (hr : r ∈ K.R) (he : e ∈ H.E) + (heR : e ⊆ r) (heBd : Disjoint e (subBd Λ)) : Disjoint r (subBd Λ) := by + have hFacts := regionFacts_of_radial ⟨hK.1, hK.2.1⟩ hS hK.2.2 ⟨e, he⟩ + apply disjoint_left.mpr + intro x hxr hxbd + have hxNotHV : x ∉ H.V := fun hxV => region_subset hr hxr (K.V_subset_U (hK.2.1.2.1 hxV)) + obtain ⟨f, hf, hxf⟩ := H.exists_edge_of_mem (hZone.bd_subset_U hxbd) hxNotHV + have hfK : Disjoint f K.U := by + apply disjoint_left.mpr + intro p hpf hpK + have hU : H.U ∩ K.U = H.V := hK.2.1.1 + have hpHV : p ∈ H.V := hU ▸ ⟨(hf.2.1 hpf).1, hpK⟩ + exact (hf.2.1 hpf).2 hpHV + have hfR : f ⊆ r := subset_region hr hf.2.2.1.isConnected.isPreconnected hfK hxf hxr + have hef : e = f := hFacts.2.1 r hr e he f hf heR hfR + exact heBd.notMem_of_mem_left (hef.symm ▸ hxf) hxbd + +/-- An edge inside a zone has its entire radial region inside that zone. -/ +theorem radial_region_subset_zone {H K : Drawing S} + {d : Set S → Set S → ℕ} {γ : ℕ} {z Λ r e : Set S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hS : IsClosedSurface S) + (hZone : IsLambdaZoneAround H d γ z Λ) (hr : r ∈ K.R) (he : e ∈ H.E) + (heR : e ⊆ r) (heΛ : e ⊆ Λ) : r ⊆ Λ := by + have hΛBd := (isOpen_disjoint_subBd_and_closure_eq hZone.isOpenDisc.1).1 + have hrBd := radial_region_disjoint_zone_boundary hK hS hZone hr he heR + (hΛBd.mono heΛ Subset.rfl) + have hrFr : Disjoint r (frontier (closure Λ)) := hrBd.mono_right (by + rw [subBd_eq_frontier]; exact frontier_closure_subset) + obtain ⟨x, hxe⟩ := he.1 + have hrCl : r ⊆ closure Λ := + (subset_or_disjoint_of_frontier isClosed_closure (region_isPreconnected hr) hrFr).resolve_right + (fun hd => hd.notMem_of_mem_left (heR hxe) (subset_closure (heΛ hxe))) + intro x hxr + obtain ⟨_, hcl⟩ := isOpen_disjoint_subBd_and_closure_eq hZone.isOpenDisc.1 + have hx := hrCl hxr + rw [hcl] at hx + exact hx.resolve_right (hrBd.notMem_of_mem_left hxr) + +/-- An edge outside a zone closure has its radial region outside it. -/ +theorem radial_region_disjoint_zone_closure {H K : Drawing S} + {d : Set S → Set S → ℕ} {γ : ℕ} {z Λ r e : Set S} + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hS : IsClosedSurface S) + (hZone : IsLambdaZoneAround H d γ z Λ) (hr : r ∈ K.R) (he : e ∈ H.E) + (heR : e ⊆ r) (heΛ : Disjoint e (closure Λ)) : Disjoint r (closure Λ) := by + have hrBd := radial_region_disjoint_zone_boundary hK hS hZone hr he heR + (heΛ.mono_right (fun _ h => h.1)) + have hrFr : Disjoint r (frontier (closure Λ)) := hrBd.mono_right (by + rw [subBd_eq_frontier]; exact frontier_closure_subset) + obtain ⟨x, hxe⟩ := he.1 + exact (subset_or_disjoint_of_frontier isClosed_closure (region_isPreconnected hr) + hrFr).resolve_left + (fun hsub => heΛ.notMem_of_mem_left hxe (hsub (heR hxe))) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Regions.lean b/LeanPool/GraphMinor/GM16/Section9Regions.lean new file mode 100644 index 0000000000..58f6c14317 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Regions.lean @@ -0,0 +1,65 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM14.DiscSlope +import LeanPool.GraphMinor.GM14.Section3 + +/-! +# Regions created by clearing the battlefield discs + +Each cleared disc is a region of the final drawing in XVI (8.1). +The disc avoids that drawing, and its entire boundary survives. A +region meeting it cannot cross that boundary. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- Every member of a disjoint family of cleared zones is a region of +the resulting drawing, as used in XVI (8.1), Claims (4) and (8), page 72. -/ +theorem zone_mem_R_clearFamily {H : Drawing S} {d : Set S → Set S → ℕ} + {Y : Set S} {γ : ℕ} {Λ : S → Set S} + (hZone : ∀ y ∈ Y, IsLambdaZoneAround H d γ {y} (Λ y)) + (hdis : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → Disjoint (closure (Λ y)) (closure (Λ z))) + {y : S} (hy : y ∈ Y) : Λ y ∈ (clearEnvelopeDrawing H Y Λ).R := by + let K := clearEnvelopeDrawing H Y Λ + have hBd : subBd (Λ y) ⊆ K.U := zone_boundary_subset_clearFamily hZone hdis hy + have hΛK : Disjoint (Λ y) K.U := by + apply disjoint_left.mpr + intro x hxΛ hxK + have hx := (clearFamily_U hZone) ▸ hxK + exact hx.2 (mem_iUnion₂.mpr ⟨y, hy, hxΛ⟩) + have hyΛ : y ∈ Λ y := (hZone y hy).z_subset (mem_singleton y) + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem (Γ := K) (hΛK.notMem_of_mem_left hyΛ) + have hΛr : Λ y ⊆ r := subset_region hr + (hZone y hy).isOpenDisc.isPathConnected.isConnected.isPreconnected hΛK hyΛ hyr + have hfront : frontier (closure (Λ y)) ⊆ subBd (Λ y) := by + rw [subBd_eq_frontier] + exact frontier_closure_subset + have hrDis : Disjoint r (frontier (closure (Λ y))) := + disjoint_left.mpr fun x hxr hxfr => region_subset hr hxr (hBd (hfront hxfr)) + have hrCl : r ⊆ closure (Λ y) := + (subset_or_disjoint_of_frontier isClosed_closure (region_isPreconnected hr) hrDis).resolve_right + (fun hd => hd.notMem_of_mem_left hyr (subset_closure hyΛ)) + have hrΛ : r ⊆ Λ y := by + intro x hxr + have hxcl := hrCl hxr + obtain ⟨_, hcl⟩ := isOpen_disjoint_subBd_and_closure_eq (hZone y hy).isOpenDisc.1 + rw [hcl] at hxcl + exact hxcl.resolve_right (fun hxbd => region_subset hr hxr (hBd hxbd)) + exact subset_antisymm hrΛ hΛr ▸ hr + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Rigidity.lean b/LeanPool/GraphMinor/GM16/Section9Rigidity.lean new file mode 100644 index 0000000000..45be520c73 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Rigidity.lean @@ -0,0 +1,134 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.Section9Dials +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM16.Section9Circles +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM14.Section3 + +/-! +# Rigidity after clearing a family of zones + +This proves Claim (2) in the proof of XVI (8.1). A normal circle can +enter at most one zone. Use rigidity after clearing that one zone, +then show that its dial misses all the other zones. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- Graph Minors XVI, proof of (8.1), Claim (2), page 71. Clearing +pairwise disjoint zones preserves rigidity when each single clearing does. -/ +theorem clearFamily_isRigid {H : Drawing S} {d : Set S → Set S → ℕ} + {Y : Set S} {γ : ℕ} {Λ : S → Set S} (hH : IsRigid H) + (hZone : ∀ y ∈ Y, IsLambdaZoneAround H d γ {y} (Λ y)) + (hdis : ∀ y₁ ∈ Y, ∀ y₂ ∈ Y, y₁ ≠ y₂ → Disjoint (closure (Λ y₁)) (closure (Λ y₂))) + (hRigid : ∀ y ∈ Y, IsRigid (clearedSubdrawing H (Λ y))) : + IsRigid (clearEnvelopeDrawing H Y Λ) := by + classical + by_cases hY : Y.Nonempty + swap + · have he : Y = ∅ := not_nonempty_iff_eq_empty.mp hY + subst Y + have heU : (⋃ y ∈ (∅ : Set S), Λ y) = ∅ := by simp + change IsRigid (H.interSet (univ \ (⋃ y ∈ (∅ : Set S), Λ y))) + rw [heU, sdiff_empty, drawing_interSet_univ] + exact hH + intro F hF hNormal hCard + let K := clearEnvelopeDrawing H Y Λ + have hKU : K.U = H.U \ (⋃ y ∈ Y, Λ y) := clearFamily_U hZone + have hclosed : IsClosed (univ \ (⋃ y ∈ Y, Λ y)) := + isClosed_univ.sdiff (isOpen_iUnion fun y => isOpen_iUnion fun hy => (hZone y hy).isOpenDisc.1) + obtain ⟨j, hj, hAvoid⟩ : ∃ j ∈ Y, ∀ k ∈ Y, k ≠ j → Disjoint F (Λ k) := by + by_cases hm : ∃ j ∈ Y, (F ∩ Λ j).Nonempty + · obtain ⟨j, hj, hm⟩ := hm + refine ⟨j, hj, fun k hk hkj => ?_⟩ + apply disjoint_left.mpr + intro x hxF hxk + exact oArc_not_meet_two_discs hF (hZone j hj).isOpenDisc.1 + (hZone k hk).isOpenDisc.1 (hdis j hj k hk (Ne.symm hkj)) + (zone_boundary_subset_clearFamily hZone hdis hj) + (zone_boundary_subset_clearFamily hZone hdis hk) hNormal hCard ⟨hm, x, hxF, hxk⟩ + · obtain ⟨j, hj⟩ := hY + exact ⟨j, hj, fun k hk _ => disjoint_left.mpr fun x hxF hxk => hm ⟨k, hk, x, hxF, hxk⟩⟩ + let J := clearedSubdrawing H (Λ j) + have hJU : J.U = H.U \ Λ j := clearedSubdrawing_U (hZone j hj) + have hJclosed : IsClosed (univ \ Λ j) := isClosed_univ.sdiff (hZone j hj).isOpenDisc.1 + have hOut : ∀ x ∈ F, x ∉ Λ j → x ∉ ⋃ y ∈ Y, Λ y := by + intro x hxF hxj hxU + obtain ⟨k, hk, hxk⟩ := mem_iUnion₂.mp hxU + by_cases heq : k = j + · exact hxj (heq ▸ hxk) + · exact (hAvoid k hk heq).notMem_of_mem_left hxF hxk + have hFV : F ∩ K.V = F ∩ J.V := by + ext x + simp only [K, J, clearEnvelopeDrawing, clearedSubdrawing, + mem_inter_iff, mem_interSet_V_iff hclosed, mem_interSet_V_iff hJclosed] + constructor + · rintro ⟨hxF, hxH, _, hxU⟩ + exact ⟨hxF, hxH, mem_univ _, fun hxj => hxU (mem_iUnion₂.mpr ⟨j, hj, hxj⟩)⟩ + · rintro ⟨hxF, hxH, _, hxj⟩ + exact ⟨hxF, hxH, mem_univ _, hOut x hxF hxj⟩ + have hNormalJ : F ∩ J.U ⊆ J.V := by + rintro x ⟨hxF, hxJ⟩ + have hx := hJU ▸ hxJ + have hxK : x ∈ K.U := hKU ▸ ⟨hx.1, hOut x hxF hx.2⟩ + exact (congrArg (fun A : Set S => x ∈ A) hFV).mp ⟨hxF, hNormal ⟨hxF, hxK⟩⟩ |>.2 + obtain ⟨Δ, hDial⟩ := hRigid j hj F hF hNormalJ (hFV ▸ hCard) + have hΔavoid : ∀ k ∈ Y, k ≠ j → Disjoint Δ (Λ k) := by + intro k hk hkj + apply dial_disjoint_open_disc hDial hNormalJ (hZone k hk).isOpenDisc + (hZone k hk).isOArc_bd _ (hAvoid k hk hkj) + apply oArc_subset_interSet_U (hZone k hk).isOArc_bd (hZone k hk).bd_subset_U + intro x hx + exact ⟨mem_univ _, fun hxj => (hdis k hk j hj hkj).notMem_of_mem_left hx.1 (subset_closure hxj)⟩ + have hSub : K.IsSubdrawing J := drawing_interSet_mono_closed H hclosed hJclosed + (fun x hx => ⟨mem_univ _, fun hxj => hx.2 (mem_iUnion₂.mpr ⟨j, hj, hxj⟩)⟩) + have hInter : J.interSet Δ = K.interSet Δ := by + rw [show J = H.interSet (univ \ Λ j) from rfl, + show K = H.interSet (univ \ ⋃ y ∈ Y, Λ y) from rfl, + drawing_interSet_inter_closed H hJclosed hDial.1.isClosed, + drawing_interSet_inter_closed H hclosed hDial.1.isClosed] + congr 1 + ext x + constructor + · rintro ⟨⟨_, hxj⟩, hxΔ⟩ + refine ⟨⟨mem_univ _, ?_⟩, hxΔ⟩ + intro hxU + obtain ⟨k, hk, hxk⟩ := mem_iUnion₂.mp hxU + by_cases heq : k = j + · exact hxj (heq ▸ hxk) + · exact (hΔavoid k hk heq).notMem_of_mem_left hxΔ hxk + · rintro ⟨⟨_, hxU⟩, hxΔ⟩ + exact ⟨⟨mem_univ _, fun hxj => hxU (mem_iUnion₂.mpr ⟨j, hj, hxj⟩)⟩, hxΔ⟩ + exact ⟨Δ, dial_of_subdrawing_same_inter hDial hSub hFV hInter⟩ + +/-- The battlefields chosen in XVI (8.1), page 71, form an envelope. +The rigidity clause holds for every subfamily by Claim (2). -/ +theorem envelope_of_battlefields {H : Drawing S} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {θ β : ℕ} {Y : Set S} + {Λ : S → Set S} {C : S → Drawing S} {X : S → Set S} + (hH : IsRigid H) (hY : Y ⊆ H.V) + (hBattle : ∀ y ∈ Y, IsBattlefield H T d θ β {y} (Λ y) (C y) (X y)) + (hdis : ∀ y₁ ∈ Y, ∀ y₂ ∈ Y, y₁ ≠ y₂ → Disjoint (closure (Λ y₁)) (closure (Λ y₂))) : + IsEnvelope H d Y (3 * β + 3) Λ := by + refine ⟨hY, fun y hy => (hBattle y hy).isZone, hdis, ?_⟩ + intro Y' hYY + exact clearFamily_isRigid hH (fun y hy => (hBattle y (hYY hy)).isZone) + (fun y hy z hz hne => hdis y (hYY hy) z (hYY hz) hne) + (fun y hy => (hBattle y (hYY hy)).isRigid_cleared) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9SeparatedBoundaries.lean b/LeanPool/GraphMinor/GM16/Section9SeparatedBoundaries.lean new file mode 100644 index 0000000000..be396bf483 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9SeparatedBoundaries.lean @@ -0,0 +1,239 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM16.Section9Regions +import LeanPool.GraphMinor.GM16.LineInFace +import LeanPool.GraphMinor.Surface.ArcErase +import LeanPool.GraphMinor.Surface.ArcTools +import LeanPool.GraphMinor.GM11.CurveArc +import LeanPool.GraphMinor.GM16.DrawingAtoms +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM15.Section4 + +import LeanPool.GraphMinor.GM11.CitedResults + +/-! +# Lines and regions between distant battlefield boundaries + +XV (3.5), used in XVI (8.1), Claim (4), requires that no region touch +both boundary circuits. Four vertex-to-region comparisons would put +the two cleared regions at distance at most eight. The compression +bound and the original separation of the centres rule this out. +For the corrected line condition, split a normal line at its drawing +vertices. Each segment lies in one region closure and has endpoint +distance at most four. Compression then transfers the bound back +to the original centres. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- A normal line between drawing vertices crosses at most one region +between consecutive vertices. Each crossing costs at most four in the +metric, using the vertex-to-region bound two. -/ +private theorem normal_line_vertex_distance + (hS : IsClosedSurface S) + {H : Drawing S} {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric H θ T d) + {L : Set S} {a b : S} (hl : IsLineWithEnds L a b) + (hn : H.IsNormal L) (ha : a ∈ H.V) (hb : b ∈ H.V) : + d {a} {b} + 4 ≤ 4 * (L ∩ H.V).ncard := by + have hf : (L ∩ H.V).Finite := H.finite_V.subset inter_subset_right + induction hcard : (L ∩ H.V).ncard using Nat.strong_induction_on generalizing L a b with + | ind n ih => + have haL := Surface.IsLineWithEnds.left_mem hl + have hbL := Surface.IsLineWithEnds.right_mem hl + have hab := ends_ne hl + have haA : ({a} : Set S) ∈ H.A := Or.inl (Or.inl ⟨a, ha, rfl⟩) + have hbA : ({b} : Set S) ∈ H.A := Or.inl (Or.inl ⟨b, hb, rfl⟩) + obtain ⟨_, _, _, hsym, htri, _⟩ := GraphMinor.GM11.gm15_theorem_9_1.{w} H θ T d hS + inferInstance hm + by_cases hex : ∃ x ∈ L ∩ H.V, x ≠ a ∧ x ≠ b + · obtain ⟨x, hx, hxa, hxb⟩ := hex + obtain ⟨L₁, L₂, h₁, h₂, hu, hi⟩ := IsLineWithEnds.split hl hx.1 hxa hxb + have hs₁ : L₁ ⊆ L := fun _ h => hu ▸ Or.inl h + have hs₂ : L₂ ⊆ L := fun _ h => hu ▸ Or.inr h + have hf₁ : (L₁ ∩ H.V).Finite := hf.subset (inter_subset_inter_left _ hs₁) + have hf₂ : (L₂ ∩ H.V).Finite := hf.subset (inter_subset_inter_left _ hs₂) + have haNot : a ∉ L₂ := by + intro h + have : a = x := mem_singleton_iff.mp (hi ▸ ⟨Surface.IsLineWithEnds.left_mem h₁, h⟩) + exact hxa this.symm + have hbNot : b ∉ L₁ := by + intro h + have : b = x := mem_singleton_iff.mp (hi ▸ ⟨h, Surface.IsLineWithEnds.right_mem h₂⟩) + exact hxb this.symm + have hlt₁ : (L₁ ∩ H.V).ncard < n := by + rw [← hcard] + exact ncard_lt_ncard ⟨inter_subset_inter_left _ hs₁, + fun h => hbNot (h ⟨hbL, hb⟩).1⟩ hf + have hlt₂ : (L₂ ∩ H.V).ncard < n := by + rw [← hcard] + exact ncard_lt_ncard ⟨inter_subset_inter_left _ hs₂, + fun h => haNot (h ⟨haL, ha⟩).1⟩ hf + have hn₁ := ih _ hlt₁ h₁ (fun _ h => hn ⟨hs₁ h.1, h.2⟩) ha hx.2 hf₁ rfl + have hn₂ := ih _ hlt₂ h₂ (fun _ h => hn ⟨hs₂ h.1, h.2⟩) hx.2 hb hf₂ rfl + have hc := ncard_union_add_ncard_inter (L₁ ∩ H.V) (L₂ ∩ H.V) hf₁ hf₂ + have heU : (L₁ ∩ H.V) ∪ (L₂ ∩ H.V) = L ∩ H.V := by + rw [← union_inter_distrib_right, hu] + have heI : (L₁ ∩ H.V) ∩ (L₂ ∩ H.V) = {x} := by + rw [inter_inter_inter_comm, hi, inter_self, singleton_inter_of_mem hx.2] + rw [heU, heI, ncard_singleton, hcard] at hc + have ht := htri {a} haA {x} (Or.inl (Or.inl ⟨x, hx.2, rfl⟩)) {b} hbA + omega + · have havoid : Disjoint (L \ {a,b}) H.U := by + apply disjoint_left.mpr + intro x hx hxU + have hxV := hn ⟨hx.1, hxU⟩ + exact hex ⟨x, ⟨hx.1, hxV⟩, fun h => hx.2 (Or.inl h), fun h => hx.2 (Or.inr h)⟩ + obtain ⟨r, hr, _, hcl⟩ := exists_face_containing_line hl havoid + have hp := vertex_atom_dist_le_two hS hm + have h₁ := hp a ha r (Or.inr hr) (hcl haL) + have h₂ := hp b hb r (Or.inr hr) (hcl hbL) + have ht := htri {a} haA r (Or.inr hr) {b} hbA + rw [hsym r (Or.inr hr) {b} hbA] at ht + have hc : 2 ≤ (L ∩ H.V).ncard := by + have hs : {a,b} ⊆ L ∩ H.V := by + rintro x (rfl | rfl) <;> exact ⟨by assumption, by assumption⟩ + have hc := ncard_le_ncard hs hf + rw [ncard_pair hab] at hc + exact hc + omega + +omit [ConnectedSpace S] in +private theorem subline_between {L : Set S} (hl : IsLine L) + {a b : S} (ha : a ∈ L) (hb : b ∈ L) (hab : a ≠ b) : + ∃ P ⊆ L, IsLineWithEnds P a b := by + obtain ⟨f⟩ := hl + let g : unitInterval → S := fun t => (f t).val + have hg : IsArcMap g := ⟨continuous_subtype_val.comp f.continuous, + Subtype.val_injective.comp f.injective⟩ + obtain ⟨s, hs⟩ := f.surjective ⟨a, ha⟩ + obtain ⟨t, ht⟩ := f.surjective ⟨b, hb⟩ + have hga : g s = a := congrArg Subtype.val hs + have hgb : g t = b := congrArg Subtype.val ht + have hst : s ≠ t := fun h => hab (hga.symm.trans ((congrArg g h).trans hgb)) + have hline := (hg.sub hst).isLineWithEnds + rw [subArc_zero, subArc_one, hga, hgb] at hline + refine ⟨range (subArc g s t), ?_, hline⟩ + rintro x ⟨u, rfl⟩ + exact (f _).property + +/-- The extra line condition needed in the corrected XV (3.5). +A line with `n` drawing vertices puts the two cleared regions at +metric distance at most `4 n`. Compression adds at most `loss`. +Thus separation at least `4 φ + loss` forces at least `φ` vertices. -/ +theorem normal_line_between_cleared_boundaries + (hS : IsClosedSurface S) + {H : Drawing S} {Y : Set S} {Λ : S → Set S} {γ θ loss sep φ : ℕ} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} (hY : Y ⊆ H.V) + (hZone : ∀ y ∈ Y, IsLambdaZoneAround H d γ {y} (Λ y)) + (hdis : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → Disjoint (closure (Λ y)) (closure (Λ z))) + (hComp : IsLambdaCompression H (clearEnvelopeDrawing H Y Λ) θ loss T T' d d') + {y z : S} (hy : y ∈ Y) (hz : z ∈ Y) (hyz : y ≠ z) + (hsep : sep ≤ d {y} {z}) (hbudget : 4 * φ + loss ≤ sep) : + ∀ F : Set S, IsLine F → (clearEnvelopeDrawing H Y Λ).IsNormal F → + F ⊆ univ \ (Λ y ∪ Λ z) → + (F ∩ subBd (Λ y)).Nonempty → (F ∩ subBd (Λ z)).Nonempty → + φ ≤ (F ∩ (clearEnvelopeDrawing H Y Λ).V).ncard := by + let K := clearEnvelopeDrawing H Y Λ + have hyA : Λ y ∈ K.A := Or.inr (zone_mem_R_clearFamily hZone hdis hy) + have hzA : Λ z ∈ K.A := Or.inr (zone_mem_R_clearFamily hZone hdis + hz) + obtain ⟨_, _, _, hsym, htri, _⟩ := GraphMinor.GM11.gm15_theorem_9_1.{w} K + (θ - loss) T' d' hS inferInstance hComp.hasMetric' + intro F hF hn _ ⟨a, haF, haBd⟩ ⟨b, hbF, hbBd⟩ + have haV : a ∈ K.V := hn ⟨haF, zone_boundary_subset_clearFamily hZone hdis hy haBd⟩ + have hbV : b ∈ K.V := hn ⟨hbF, zone_boundary_subset_clearFamily hZone hdis hz hbBd⟩ + have hab : a ≠ b := by + intro h + exact (hdis y hy z hz hyz).notMem_of_mem_left haBd.1 (h ▸ hbBd.1) + obtain ⟨P, hPF, hP⟩ := subline_between hF haF hbF hab + have hdist := normal_line_vertex_distance hS hComp.hasMetric' hP + (fun _ h => hn ⟨hPF h.1, h.2⟩) haV hbV + have hc := ncard_le_ncard (inter_subset_inter_left K.V hPF) + (K.finite_V.subset inter_subset_right) + change d' {a} {b} + 4 ≤ 4 * (P ∩ K.V).ncard at hdist + change φ ≤ (F ∩ K.V).ncard + have hp := vertex_atom_dist_le_two hS hComp.hasMetric' + have h₁ := hp a haV (Λ y) hyA haBd.1 + have h₂ := hp b hbV (Λ z) hzA hbBd.1 + have haA : ({a} : Set S) ∈ K.A := Or.inl (Or.inl ⟨a, haV, rfl⟩) + have hbA : ({b} : Set S) ∈ K.A := Or.inl (Or.inl ⟨b, hbV, rfl⟩) + have ht₁ := htri (Λ y) hyA {a} haA (Λ z) hzA + have ht₂ := htri {a} haA {b} hbA (Λ z) hzA + rw [hsym (Λ y) hyA {a} haA] at ht₁ + have hOld := hComp.dist_le y z + rw [pointDist_eq_of_mem_atom (Or.inl (Or.inl ⟨y, hY hy, rfl⟩)) + (Or.inl (Or.inl ⟨z, hY hz, rfl⟩)) (mem_singleton y) (mem_singleton z), + pointDist_eq_of_mem_atom hyA hzA ((hZone y hy).z_subset (mem_singleton y)) + ((hZone z hz).z_subset (mem_singleton z))] at hOld + change d {y} {z} ≤ d' (Λ y) (Λ z) + loss at hOld + omega + +/-- The region-incidence side condition of XV (3.5) in the proof of +XVI (8.1), Claim (4), page 72. The constant eight uses the valid +vertex-to-incident-region bound two. -/ +theorem no_region_incident_two_cleared_boundaries + (hS : IsClosedSurface S) + {H : Drawing S} {Y : Set S} {Λ : S → Set S} {γ θ loss sep : ℕ} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} (hY : Y ⊆ H.V) + (hZone : ∀ y ∈ Y, IsLambdaZoneAround H d γ {y} (Λ y)) + (hdis : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → Disjoint (closure (Λ y)) (closure (Λ z))) + (hComp : IsLambdaCompression H (clearEnvelopeDrawing H Y Λ) θ loss T T' d d') + {y z : S} (hy : y ∈ Y) (hz : z ∈ Y) + (hsep : sep ≤ d {y} {z}) (hbudget : loss + 8 < sep) : + ∀ r ∈ (clearEnvelopeDrawing H Y Λ).R, + ¬ ((∃ u ∈ ((clearEnvelopeDrawing H Y Λ).interSet (subBd (Λ y))).V, u ∈ closure r) ∧ + ∃ v ∈ ((clearEnvelopeDrawing H Y Λ).interSet (subBd (Λ z))).V, v ∈ closure r) := by + let K := clearEnvelopeDrawing H Y Λ + have hyR : Λ y ∈ K.R := zone_mem_R_clearFamily hZone hdis hy + have hzR : Λ z ∈ K.R := zone_mem_R_clearFamily hZone hdis hz + have hyA : Λ y ∈ K.A := Or.inr hyR + have hzA : Λ z ∈ K.A := Or.inr + hzR + obtain ⟨_, _, _, hsymm, htri, _⟩ := GraphMinor.GM11.gm15_theorem_9_1.{w} K + (θ - loss) T' d' hS inferInstance hComp.hasMetric' + have hprox := vertex_atom_dist_le_two hS hComp.hasMetric' + intro r hr ⟨⟨u, hu, hur⟩, v, hv, hvr⟩ + have hu' := (mem_interSet_V_iff (show IsClosed (subBd (Λ y)) by + rw [subBd_eq_frontier]; exact isClosed_frontier)).mp hu + have hv' := (mem_interSet_V_iff (show IsClosed (subBd (Λ z)) by + rw [subBd_eq_frontier]; exact isClosed_frontier)).mp hv + have huA : ({u} : Set S) ∈ K.A := Or.inl (Or.inl ⟨u, hu'.1, rfl⟩) + have hvA : ({v} : Set S) ∈ K.A := Or.inl (Or.inl ⟨v, hv'.1, rfl⟩) + have hrA : r ∈ K.A := Or.inr hr + have h₁ := hprox u hu'.1 (Λ y) hyA hu'.2.1 + have h₂ := hprox u hu'.1 r hrA hur + have h₃ := hprox v hv'.1 r hrA hvr + have h₄ := hprox v hv'.1 (Λ z) hzA hv'.2.1 + have ht₁ := htri (Λ y) hyA {u} huA (Λ z) hzA + have ht₂ := htri {u} huA r hrA (Λ z) hzA + have ht₃ := htri r hrA {v} hvA (Λ z) hzA + rw [hsymm (Λ y) hyA {u} huA] at ht₁ + rw [hsymm r hrA {v} hvA] at ht₃ + have hNear : d' (Λ y) (Λ z) ≤ 8 := by omega + have hOld := hComp.dist_le y z + rw [pointDist_eq_of_mem_atom (Or.inl (Or.inl ⟨y, hY hy, rfl⟩)) + (Or.inl (Or.inl ⟨z, hY hz, rfl⟩)) (mem_singleton y) (mem_singleton z), + pointDist_eq_of_mem_atom hyA hzA ((hZone y hy).z_subset (mem_singleton y)) + ((hZone z hz).z_subset (mem_singleton z))] at hOld + change d {y} {z} ≤ d' (Λ y) (Λ z) + loss at hOld + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9SeparatorPaths.lean b/LeanPool/GraphMinor/GM16/Section9SeparatorPaths.lean new file mode 100644 index 0000000000..3772c2e844 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9SeparatorPaths.lean @@ -0,0 +1,150 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +public import LeanPool.GraphMinor.GM15.Defs +import LeanPool.GraphMinor.GM16.Section9BadPath +import LeanPool.GraphMinor.GM16.Section9InitialVertices +import LeanPool.GraphMinor.GM16.Section9Claim9 +import LeanPool.GraphMinor.GM16.Section9ShortPaths +import LeanPool.GraphMinor.GM16.Section9BoundaryVertices +import LeanPool.GraphMinor.GM16.Section9Regions +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM09.Basic +import Mathlib.Tactic.Linarith +import LeanPool.GraphMinor.GM11.Section88 + +import LeanPool.GraphMinor.GM09.Bridge + +import LeanPool.GraphMinor.GM14.Section9a + +/-! +# The global separator meets every long new path + +If a long path avoided the part of the separator outside the cleared +drawing, its separator vertices would be only its ends. Its first +old vertices enter distinct battlefield discs by Claims (7) and (8). +Claim (9) chooses one side with no clean attachment. The clean-annulus +argument on that side then gives the final contradiction. This +assembles the path conclusion of XVI (8.1). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 + GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] +variable {α : Type u} {βe : Type v} + +private theorem hPath_symm {G H P : Graph α βe} {a b : α} + (h : IsHPathWithEnds G H P a b) : IsHPathWithEnds G H P b a := + ⟨h.1, h.2.1.symm, h.2.2.1.symm, h.2.2.2.2.1, h.2.2.2.1, + h.2.2.2.2.2.1.trans (Set.pair_comm _ _), h.2.2.2.2.2.2⟩ + +/-- The path conclusion of XVI (8.1), Section 9, pages 72–75, for +a global boundary-path separator. All claims about the bad path, +including the attachment choice and final contradiction, are proved. -/ +theorem section9_long_new_path_meets_separator + (hS : IsClosedSurface S) {G P₀ : Graph α βe} {H : Drawing S} + (η : SpanEmbedding H G) {θ θ' β κ φ ψ sep : ℕ} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {Y : Set S} + {Λ : S → Set S} {C : S → Drawing S} {X : S → Set S} + (η' : SpanEmbedding (clearEnvelopeDrawing H Y Λ) G) (hMap : η'.vMap = η.vMap) + (hMet : HasTangleMetric H θ T d) + (hNewMet : HasTangleMetric (clearEnvelopeDrawing H Y Λ) θ' T' d') + (hY : Y ⊆ H.V) + (hBattle : ∀ y ∈ Y, IsBattlefield H T d θ β {y} (Λ y) (C y) (X y)) + (hSep : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → sep ≤ d {y} {z}) + (hLe : ∀ x y : S, pointDist (clearEnvelopeDrawing H Y Λ) d' x y ≤ pointDist H d x y) + (hNoPath : ∀ Q s t, s ∈ H.V → t ∈ H.V → + IsHPathWithEnds G η.imageGraph Q (η.vMap s) (η.vMap t) → + ψ ≤ d {s} {t} → (∀ y ∈ Y, ψ ≤ d {s} {y}) → False) + (hκEq : κ = Y.ncard ^ 2 * φ ^ 2 / 2 + 1) (hφ : 3 ≤ φ) (hψ : 3 ≤ ψ) (hψβ : ψ ≤ β) (hβ : κ + 3 + ≤ β) (hβθ : β < θ) + (hθ : κ + (3 * β + 3) < θ) (hSepBudget : 2 * (3 * β + 3) + 2 * ψ < sep) + (hMax : κ + (κ - 1) * (ψ + 5) ≤ β - ψ - 5) + {Z : Set α} (hZ : Z.Finite) (hCard : Z.ncard < κ) + (hCut : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → ∀ Q a b, + IsHPathWithEnds G η'.imageGraph Q a b → + a ∈ η.vMap '' X y → b ∈ η.vMap '' X z → (V(Q) ∩ Z).Nonempty) + {s₁ s₂ : S} (hs₁ : s₁ ∈ (clearEnvelopeDrawing H Y Λ).V) + (hs₂ : s₂ ∈ (clearEnvelopeDrawing H Y Λ).V) + (hP₀ : IsHPathWithEnds G η'.imageGraph P₀ (η.vMap s₁) (η.vMap s₂)) + (hLong : 2 * ψ ≤ d' {s₁} {s₂}) : ((Z \ V(η'.imageGraph)) ∩ V(P₀)).Nonempty := by + classical + by_contra hAvoid + have hPZ : V(P₀) ∩ Z ⊆ {η.vMap s₁, η.vMap s₂} := by + rintro x ⟨hxP, hxZ⟩ + have hxH : x ∈ V(η'.imageGraph) := by + by_contra hxNot + exact hAvoid ⟨x, ⟨hxZ, hxNot⟩, hxP⟩ + exact hP₀.2.2.2.2.2.1 ▸ ⟨hxP, hxH⟩ + obtain ⟨_, _, _, hSymm, hTri, _⟩ := GM11.gm15_theorem_9_1 H θ T d hS inferInstance hMet + obtain ⟨_, _, _, hNewSymm, hNewTri, _⟩ := GM11.gm15_theorem_9_1 + (clearEnvelopeDrawing H Y Λ) θ' T' d' hS inferInstance hNewMet + have hZone := fun y hy => (hBattle y hy).isZone + have hdis : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → + Disjoint (closure (Λ y)) (closure (Λ z)) := by + intro y hy z hz hyz + exact section9_disjoint_zones (hZone y hy) (hZone z hz) hSymm hTri + (hSep y hy z hz hyz) (by omega) + obtain ⟨t₁, ht₁, y₁, hy₁, ht₁Λ, hShort₁, _, _⟩ := section9_initial_vertex_enters_disc + hS η η' hMap hMet hBattle hψ hψβ hNoPath hLe hs₁ hs₂ hP₀ hLong + have hδ : 1 ≤ Y.ncard := (ncard_pos (H.finite_V.subset hY)).mpr ⟨y₁, hy₁⟩ + have hδsq : 1 ≤ Y.ncard ^ 2 := by nlinarith + have hφsq : 9 ≤ φ ^ 2 := by nlinarith + have hProd : 9 ≤ Y.ncard ^ 2 * φ ^ 2 := + hφsq.trans (by simpa only [one_mul] using Nat.mul_le_mul_right (φ ^ 2) hδsq) + have hκ : 3 ≤ κ := by rw [hκEq]; omega + have hP₀rev := hPath_symm hP₀ + have hLongrev : 2 * ψ ≤ d' {s₂} {s₁} := by + rw [hNewSymm {s₂} (Or.inl (Or.inl ⟨s₂, hs₂, rfl⟩)) + {s₁} (Or.inl (Or.inl ⟨s₁, hs₁, rfl⟩))] + exact hLong + obtain ⟨t₂, ht₂, y₂, hy₂, ht₂Λ, hShort₂, _, _⟩ := section9_initial_vertex_enters_disc + hS η η' hMap hMet hBattle hψ hψβ hNoPath hLe hs₂ hs₁ hP₀rev hLongrev + have hClearSub : (clearEnvelopeDrawing H Y Λ).IsSubdrawing H := interSet_isSub + have hyNe : y₁ ≠ y₂ := by + intro heq + subst y₂ + exact section9_distinct_entered_regions (hClearSub.1 hs₁) (hClearSub.1 hs₂) + ht₁ ht₂ hs₁ hs₂ (zone_mem_R_clearFamily hZone hdis hy₁) ht₁Λ ht₂Λ + hLe hNewTri hNewSymm hShort₁ hShort₂ hLong + have hXsub : ∀ y ∈ Y, η.vMap '' X y ⊆ V(η'.imageGraph) := by + intro y hy x hx + obtain ⟨v, hv, rfl⟩ := hx + rw [← hMap] + exact η'.bijOn_v.mapsTo (boundary_vertex_mem_clearFamily hZone hdis hy + ((hBattle y hy).isFree_X.1 hv)) + have hXdis : Disjoint (η.vMap '' X y₁) (η.vMap '' X y₂) := + battlefield_image_sets_disjoint η (hBattle y₁ hy₁) (hBattle y₂ hy₂) (hdis y₁ hy₁ y₂ hy₂ hyNe) + let Attach (y : S) : Prop := ∃ a ∈ η.vMap '' X y, ∃ c ∈ V(P₀), ∃ Q : Graph α βe, + IsGraphPathWithEnds G Q a c ∧ V(Q) ∩ V(η'.imageGraph) ⊆ η.vMap '' X y ∧ Disjoint V(Q) Z + by_cases hA₁ : Attach y₁ + · by_cases hA₂ : Attach y₂ + · obtain ⟨a, ha, x, hx, Q₁, hQ₁, hQ₁H, hQ₁Z⟩ := hA₁ + obtain ⟨b, hb, z, hz, Q₂, hQ₂, hQ₂H, hQ₂Z⟩ := hA₂ + exact section9_no_two_clean_attachments η'.imageGraph_le (hXsub y₁ hy₁) (hXsub y₂ hy₂) + hXdis hP₀ hPZ (hCut y₁ hy₁ y₂ hy₂ hyNe) hQ₁ ha hx hQ₁H hQ₁Z hQ₂ hb hz hQ₂H hQ₂Z + · apply section9_bad_path_contradiction hS η η' hMap hMet hNewMet hY hBattle + hSep hLe hNoPath hκ hψ hβ hβθ hθ hSepBudget hMax hZ hCard hy₂ ht₂ hs₂ hs₁ + hP₀rev ht₂Λ hShort₂ hLongrev + intro b hb c hc R hR hRClear hRZ + exact hA₂ ⟨η.vMap b, mem_image_of_mem _ hb, c, hc, R, hR, hRClear, hRZ⟩ + · apply section9_bad_path_contradiction hS η η' hMap hMet hNewMet hY hBattle + hSep hLe hNoPath hκ hψ hβ hβθ hθ hSepBudget hMax hZ hCard hy₁ ht₁ hs₁ hs₂ + hP₀ ht₁Λ hShort₁ hLong + intro b hb c hc R hR hRClear hRZ + exact hA₁ ⟨η.vMap b, mem_image_of_mem _ hb, c, hc, R, hR, hRClear, hRZ⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9ShortPaths.lean b/LeanPool/GraphMinor/GM16/Section9ShortPaths.lean new file mode 100644 index 0000000000..8ef6c02ad0 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9ShortPaths.lean @@ -0,0 +1,105 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM15.Defs +import LeanPool.GraphMinor.GM16.SpanPaths +import LeanPool.GraphMinor.GM16.MetricPoints +import LeanPool.GraphMinor.GM15.Section4 + +/-! +# The short initial segments in XVI (8.1) + +Claim (7), page 72, considers the segment from an end of the new path +to its next vertex in the old drawing. A point outside a battlefield +is far from its centre. If the segment had long ends, it would be a +forbidden old-drawing path. The only other case is a single drawing +edge, whose ends have distance at most two. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- Outside a battlefield disc, a vertex is at least the battlefield +size away from its centre, by clause (v) of XIV's definition. -/ +theorem battlefield_dist_ge_of_notMem {H : Drawing S} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {θ β : ℕ} {z Λ X : Set S} {C : Drawing S} + (h : IsBattlefield H T d θ β z Λ C X) {s : S} (hs : s ∈ H.V) (hsΛ : s ∉ Λ) : + β ≤ d z {s} := by + by_contra hlt + obtain ⟨Δ, _, hΔΛ, _, hsmall⟩ := h.openDisc_includes + exact hsΛ (hΔΛ (hsmall {s} (Or.inl (Or.inl ⟨s, hs, rfl⟩)) (by omega) (mem_singleton s))) + +/-- The metric conclusion of XVI (8.1), Claim (7), page 72. +The segment has no old drawing vertex except its ends. If their +distance were at least `ψ`, it would be the forbidden `H`-path. -/ +theorem section9_initial_segment_short (hS : IsClosedSurface S) + {α : Type u} {βe : Type v} {G P : Graph α βe} {H : Drawing S} + (η : SpanEmbedding H G) {θ β ψ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {Y : Set S} + {Λ : S → Set S} {C : S → Drawing S} {X : S → Set S} + (hMet : HasTangleMetric H θ T d) + (hSymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (hBattle : ∀ y ∈ Y, IsBattlefield H T d θ β {y} (Λ y) (C y) (X y)) + (hψ : 3 ≤ ψ) (hβ : ψ ≤ β) + (hNoPath : ∀ Q s t, s ∈ H.V → t ∈ H.V → + IsHPathWithEnds G η.imageGraph Q (η.vMap s) (η.vMap t) → + ψ ≤ d {s} {t} → (∀ y ∈ Y, ψ ≤ d {s} {y}) → False) + {s t : S} (hs : s ∈ H.V) (ht : t ∈ H.V) + (hsOut : ∀ y ∈ Y, s ∉ Λ y) + (hP : GraphMinor.GM09.IsGraphPathWithEnds G P (η.vMap s) (η.vMap t)) + (hst : s ≠ t) (hInter : V(P) ∩ V(η.imageGraph) = {η.vMap s, η.vMap t}) : + d {s} {t} < ψ := by + by_contra hlong + have hdist : ψ ≤ d {s} {t} := by omega + have hHP := isHPath_of_far_ends hS η hMet hs ht hP (fun heq => hst (η.bijOn_v.injOn hs ht heq)) + hInter (hψ.trans hdist) + apply hNoPath P s t hs ht hHP hdist + intro y hy + rw [hSymm {s} (Or.inl (Or.inl ⟨s, hs, rfl⟩)) {y} (hBattle y hy).isZone.z_mem] + exact hβ.trans (battlefield_dist_ge_of_notMem (hBattle y hy) hs (hsOut y hy)) + +omit [T2Space S] in +/-- The metric contradiction in XVI (8.1), Claim (8), page 73. +Two short initial segments cannot enter the same new region when the +ends of the new path are at distance at least `2ψ`. -/ +theorem section9_distinct_entered_regions + {H K : Drawing S} {d d' : Set S → Set S → ℕ} {ψ : ℕ} + {s₁ s₂ t₁ t₂ : S} {r : Set S} + (hs₁ : s₁ ∈ H.V) (hs₂ : s₂ ∈ H.V) + (ht₁ : t₁ ∈ H.V) (ht₂ : t₂ ∈ H.V) + (hs₁K : s₁ ∈ K.V) (hs₂K : s₂ ∈ K.V) (hr : r ∈ K.R) + (ht₁r : t₁ ∈ r) (ht₂r : t₂ ∈ r) + (hLe : ∀ x y : S, pointDist K d' x y ≤ pointDist H d x y) + (hTri : ∀ a ∈ K.A, ∀ b ∈ K.A, ∀ c ∈ K.A, d' a c ≤ d' a b + d' b c) + (hSymm : ∀ a ∈ K.A, ∀ b ∈ K.A, d' a b = d' b a) + (hShort₁ : d {s₁} {t₁} < ψ) (hShort₂ : d {s₂} {t₂} < ψ) + (hLong : 2 * ψ ≤ d' {s₁} {s₂}) : False := by + have hs₁A : ({s₁} : Set S) ∈ K.A := Or.inl (Or.inl ⟨s₁, hs₁K, rfl⟩) + have hs₂A : ({s₂} : Set S) ∈ K.A := Or.inl (Or.inl ⟨s₂, hs₂K, rfl⟩) + have hrA : r ∈ K.A := Or.inr hr + have h₁ := hLe s₁ t₁ + have h₂ := hLe s₂ t₂ + rw [pointDist_of_mem_vertices d hs₁ ht₁, + GraphMinor.GM15.pointDist_eq_of_mem_atom hs₁A hrA (mem_singleton s₁) ht₁r] at h₁ + rw [pointDist_of_mem_vertices d hs₂ ht₂, + GraphMinor.GM15.pointDist_eq_of_mem_atom hs₂A hrA (mem_singleton s₂) ht₂r] at h₂ + have hBound := hTri {s₁} hs₁A r hrA {s₂} hs₂A + rw [hSymm r hrA {s₂} hs₂A] at hBound + change d' {s₁} r ≤ d {s₁} {t₁} at h₁ + change d' {s₂} r ≤ d {s₂} {t₂} at h₂ + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9SpanClearing.lean b/LeanPool/GraphMinor/GM16/Section9SpanClearing.lean new file mode 100644 index 0000000000..be84fab175 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9SpanClearing.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +public import LeanPool.GraphMinor.GM16.Section6 +public import LeanPool.GraphMinor.GM15.Section4 +import LeanPool.GraphMinor.GM16.Section6Clearing +import LeanPool.GraphMinor.GM16.Section9ClearFamily +import LeanPool.GraphMinor.GM16.Section9Compressions +import LeanPool.GraphMinor.GM16.Section9Dials +import LeanPool.GraphMinor.GM16.Section9ZonePreservation +import LeanPool.GraphMinor.GM16.SpanCongr +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM14.Section3b + + +import LeanPool.GraphMinor.GM12.Section710 + +import LeanPool.GraphMinor.GM12.Section77 + +/-! +# The span after clearing the envelope + +In XVI (8.1), the drawing and tangle after all clearings are still a +span controlled by the original tangle. Apply the single-clearing +span lemma at each step. The envelope gives rigidity for every +intermediate drawing, and uniqueness of compression identifies the +result with the chosen final tangle. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- The span assertion after the successive clearings in the proof of +XVI (8.1), pages 71–72. The embedding is the restriction of the original +embedding to the complement of the entire envelope. -/ +theorem span_after_clearFamily + (hS : IsClosedSurface S) (ys : Finset S) (Λ : S → Set S) (γ : ℕ) + {α : Type u} {β : Type v} {G : Graph α β} {H : Drawing S} + (η : SpanEmbedding H G) {θ_star θ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} + (hSpan : IsSigmaSpan G H η θ_star θ T_star T) + (hEnv : IsEnvelope H d (ys : Set S) γ Λ) + (hComp : IsLambdaCompression H (clearEnvelopeDrawing H (ys : Set S) Λ) + θ ((4 * γ + 2) * ys.card) T T' d d') : + IsSigmaSpan G (clearEnvelopeDrawing H (ys : Set S) Λ) + (restrictCleared η (⋃ y ∈ (ys : Set S), Λ y)) + θ_star (θ - (4 * γ + 2) * ys.card) T_star T' := by + classical + induction ys using Finset.induction_on generalizing H θ T d T' d' with + | empty => + have hDraw := clearEnvelopeDrawing_empty H Λ + have hc : IsLambdaCompression H H θ 0 T T' d d' := by + simpa only [Finset.card_empty, Nat.mul_zero, hDraw] using hComp + have hSelf : IsLambdaCompression H H θ 0 T T d d := + ⟨hc.lam_lt, hc.hasMetric, by simpa only [Nat.sub_zero] using hc.hasMetric, + fun _ _ => Nat.le_add_right _ _⟩ + have hT := compression_unique hS inferInstance hSelf hc + have hSpan' := span_congr_drawing_embedding hDraw.symm η + (restrictCleared η (⋃ y ∈ (↑(∅ : Finset S) : Set S), Λ y)) rfl rfl hSpan + simpa only [Finset.card_empty, Nat.mul_zero, Nat.sub_zero, ← hT] using hSpan' + | @insert j ys hj ih => + let c := 4 * γ + 2 + obtain ⟨T₁, T₂, d₁, d₂, hClear, hRig₁, hEnv₁, hComp₂, hTot⟩ := + exists_compression_clearEnvelope_insert hS hj hComp.hasMetric hEnv hComp.lam_lt + let H₁ := clearedSubdrawing H (Λ j) + have hSpan₁ : IsSigmaSpan G H₁ (restrictCleared η (Λ j)) θ_star (θ - c) T_star T₁ := by + simpa only [c, Nat.sub_sub] using IsSigmaSpan.clear hSpan hClear hRig₁ + have hSpan₂ := ih (restrictCleared η (Λ j)) hSpan₁ hEnv₁ hComp₂ + have hDraw := clearEnvelopeDrawing_insert H ys j Λ + (fun y hy => (hEnv.2.1 y hy).isOpenDisc.1) + have hLoss : c + c * ys.card = c * (insert j ys).card := by + rw [Finset.card_insert_of_notMem hj, Nat.mul_add, Nat.mul_one, Nat.add_comm] + have hT : T₂ = T' := compression_unique hS inferInstance hTot hComp + have hTransport := span_congr_drawing_embedding hDraw + (restrictCleared (restrictCleared η (Λ j)) (⋃ y ∈ (ys : Set S), Λ y)) + (restrictCleared η (⋃ y ∈ (↑(insert j ys) : Set S), Λ y)) rfl rfl hSpan₂ + rw [hT] at hTransport + have hOrder : θ - c - c * ys.card = θ - c * (insert j ys).card := by + rw [Nat.sub_sub, hLoss] + rw [hOrder] at hTransport + exact hTransport + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Uncross.lean b/LeanPool/GraphMinor/GM16/Section9Uncross.lean new file mode 100644 index 0000000000..767a4de2fb --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Uncross.lean @@ -0,0 +1,53 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Hypergraph.Basic +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Moving a separator into the annulus + +The planar Menger argument of XVI (8.1), Claim (10), starts with a +separation between the inner and outer boundary vertices. Join its +inner side to the whole inner disc, then intersect it with the outer +disc. No new separator vertex appears: each boundary already lies +on the required side of the original separation. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.GM10 +universe u v + +/-- The uncrossing step that puts a boundary separator in the annulus +in XVI (8.1), Claim (10). It preserves every inner edge and adds no +separator vertex. -/ +theorem uncross_annular_separation {α : Type u} {β : Type v} + {G A B C D E F : Hypergraph α β} + (hAB : G.IsSeparation A B) (hCD : G.IsSeparation C D) (hEF : G.IsSeparation E F) + (hCE : C.edgeSet ⊆ E.edgeSet) (hCF : Disjoint C.vertexSet F.vertexSet) + (hInner : C.vertexSet ∩ D.vertexSet ⊆ A.vertexSet) + (hOuter : E.vertexSet ∩ F.vertexSet ⊆ B.vertexSet) : + G.IsSeparation ((A ∪ C) ∩ E) ((B ∩ D) ∪ F) ∧ + (((A ∪ C) ∩ E).vertexSet ∩ ((B ∩ D) ∪ F).vertexSet ⊆ A.vertexSet ∩ B.vertexSet) ∧ + C.edgeSet ⊆ ((A ∪ C) ∩ E).edgeSet ∧ ((A ∪ C) ∩ E) ≤ E := by + have h₁ := hAB.union_inter hCD + refine ⟨(h₁.symm.union_inter hEF.symm).symm, ?_, ?_, + inter_le_right h₁.left_le hEF.left_le⟩ + · rintro x ⟨⟨hxAC, hxE⟩, hxBDF⟩ + rcases hxBDF with ⟨hxB, hxD⟩ | hxF + · refine ⟨?_, hxB⟩ + exact hxAC.elim id (fun hxC => hInner ⟨hxC, hxD⟩) + · refine ⟨?_, hOuter ⟨hxE, hxF⟩⟩ + exact hxAC.elim id (fun hxC => False.elim (hCF.notMem_of_mem_left hxC hxF)) + · intro e he + exact ⟨Or.inr he, hCE he⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9ZoneCuts.lean b/LeanPool/GraphMinor/GM16/Section9ZoneCuts.lean new file mode 100644 index 0000000000..ea29bd6dc1 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9ZoneCuts.lean @@ -0,0 +1,99 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# The two cuts along a zone boundary + +For the planar Menger argument in XVI (8.1), cut along the inner and +outer boundary circles. Vertices on a circle belong to both sides. +Edges on it may be assigned to either side. These cuts let us move an +arbitrary boundary separator into the closed annulus without adding +separator vertices. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- Restriction to a closed set preserves the ends of every retained edge. -/ +theorem drawing_closed_inter_le (H : Drawing S) {A : Set S} (hA : IsClosed A) : + (PaintingOrDrawing.drawing H).inter A ≤ H.toHypergraph := by + refine ⟨inter_subset_left, fun _ h => h.1, ?_⟩ + intro e he + ext x + change (e ∈ H.E ∧ x ∈ H.V ∧ x ∈ closure e) ↔ + (e ∈ H.E ∧ x ∈ H.V ∧ x ∈ closure e) ∧ e ⊆ A ∧ x ∈ A + constructor + · intro hx + exact ⟨hx, he.2, closure_minimal he.2 hA hx.2.2⟩ + · exact fun h => h.1 + +private theorem separation_of_cover_deleting_edges {α β : Type*} + {G C D : Hypergraph α β} (hC : C ≤ G) (hD : D ≤ G) + (hV : C.vertexSet ∪ D.vertexSet = G.vertexSet) (hE : C.edgeSet ∪ D.edgeSet = G.edgeSet) : + G.IsSeparation C (D.deleteEdges C.edgeSet) := by + rw [isSeparation_iff_of_le hC ((deleteEdges_le D C.edgeSet).trans hD)] + refine ⟨hV, ?_, ?_⟩ + · change C.edgeSet ∪ (D.edgeSet \ C.edgeSet) = G.edgeSet + rw [← hE] + ext x + simp only [mem_union, mem_sdiff] + tauto + · change C.edgeSet ∩ (D.edgeSet \ C.edgeSet) = ∅ + exact Set.disjoint_iff_inter_eq_empty.mp Set.disjoint_sdiff_right + +/-- The cuts along the boundary of a zone, assigning boundary edges +first to the inside and then to the outside. These are the two fixed +cuts used to uncross a separator in XVI (8.1), Claim (10). -/ +theorem zone_cut_separations {H : Drawing S} {d : Set S → Set S → ℕ} + {γ : ℕ} {z Λ : Set S} (hZone : IsLambdaZoneAround H d γ z Λ) : + H.toHypergraph.IsSeparation + ((PaintingOrDrawing.drawing H).inter (closure Λ)) + (((PaintingOrDrawing.drawing H).inter (univ \ Λ)).deleteEdges + ((PaintingOrDrawing.drawing H).inter (closure Λ)).edgeSet) ∧ + H.toHypergraph.IsSeparation + (((PaintingOrDrawing.drawing H).inter (closure Λ)).deleteEdges + ((PaintingOrDrawing.drawing H).inter (univ \ Λ)).edgeSet) + ((PaintingOrDrawing.drawing H).inter (univ \ Λ)) := by + have hC := drawing_closed_inter_le H (A := closure Λ) isClosed_closure + have hD := drawing_closed_inter_le H (isClosed_univ.sdiff hZone.isOpenDisc.1) + have hV : ((PaintingOrDrawing.drawing H).inter (closure Λ)).vertexSet ∪ + ((PaintingOrDrawing.drawing H).inter (univ \ Λ)).vertexSet = H.toHypergraph.vertexSet := by + ext x + change (x ∈ H.V ∧ x ∈ closure Λ) ∨ (x ∈ H.V ∧ x ∈ univ \ Λ) ↔ x ∈ H.V + constructor + · exact fun h => h.elim And.left And.left + · intro hx + by_cases hxΛ : x ∈ Λ + · exact Or.inl ⟨hx, subset_closure hxΛ⟩ + · exact Or.inr ⟨hx, mem_univ _, hxΛ⟩ + have hE : ((PaintingOrDrawing.drawing H).inter (closure Λ)).edgeSet ∪ + ((PaintingOrDrawing.drawing H).inter (univ \ Λ)).edgeSet = H.toHypergraph.edgeSet := by + ext e + change (e ∈ H.E ∧ e ⊆ closure Λ) ∨ (e ∈ H.E ∧ e ⊆ univ \ Λ) ↔ e ∈ H.E + constructor + · exact fun h => h.elim And.left And.left + · intro he + rcases edge_subset_or_subset_compl_of_zone hZone he with heIn | heOut + · exact Or.inl ⟨he, heIn.trans subset_closure⟩ + · exact Or.inr ⟨he, heOut⟩ + exact ⟨separation_of_cover_deleting_edges hC hD hV hE, + (separation_of_cover_deleting_edges hD hC (Set.union_comm _ _ ▸ hV) + (Set.union_comm _ _ ▸ hE)).symm⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9ZonePreservation.lean b/LeanPool/GraphMinor/GM16/Section9ZonePreservation.lean new file mode 100644 index 0000000000..0a2a9ddb2c --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9ZonePreservation.lean @@ -0,0 +1,95 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.GM15.Section4 + +/-! +# Zones after clearing a disjoint zone + +In the proof of XVI (8.1), each battlefield disc remains a zone while +other discs are cleared. Its boundary and centre survive. Every atom +inside its closure is unchanged, so the upper distance bound follows +from the fact that clearing does not increase distances. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +omit [ConnectedSpace S] in +/-- An atom of the cleared drawing inside a disjoint closed set was already +an atom of the original drawing. The only new region is the cleared disc. -/ +theorem cleared_atom_mem_of_disjoint {H : Drawing S} {d : Set S → Set S → ℕ} + {γ : ℕ} {z Ω A a : Set S} (hΩ : IsLambdaZoneAround H d γ z Ω) + (hdis : Disjoint A Ω) (ha : a ∈ (clearedSubdrawing H Ω).A) (haA : a ⊆ A) : + a ∈ H.A := by + rcases ha with (⟨v, hv, rfl⟩ | he) | hr + · exact Or.inl (Or.inl ⟨v, (clearedSubdrawing_isSubdrawing H Ω).1 hv, rfl⟩) + · exact Or.inl (Or.inr ((clearedSubdrawing_isSubdrawing H Ω).2 he)) + · rcases clearedSubdrawing_region_eq_or_mem_R hΩ hr with heq | hrH + · obtain ⟨x, hxz⟩ := GraphMinor.GM15.atom_nonempty hΩ.z_mem + have hx := hΩ.z_subset hxz + exact False.elim (hdis.notMem_of_mem_left (haA (heq.symm ▸ hx)) hx) + · exact Or.inr hrH + +/-- Graph Minors XVI, proof of (8.1), page 71: a battlefield zone remains +a zone after another disc with disjoint closure is cleared. -/ +theorem zone_after_disjoint_clearing {H : Drawing S} + {T T' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d d' : Set S → Set S → ℕ} {θ γ : ℕ} {y z : S} {Λ Ω : Set S} + (hyH : y ∈ H.V) (hΛ : IsLambdaZoneAround H d γ {y} Λ) + (hΩ : IsLambdaZoneAround H d γ {z} Ω) + (hdis : Disjoint (closure Λ) (closure Ω)) + (hClear : IsClearedTangle H T d θ γ Ω T' d') : + IsLambdaZoneAround (clearedSubdrawing H Ω) d' γ {y} Λ := by + have hyΛ : y ∈ Λ := hΛ.z_subset (mem_singleton y) + have hyΩ : y ∉ Ω := fun hy => hdis.notMem_of_mem_left (subset_closure hyΛ) (subset_closure hy) + have hyNew : y ∈ (clearedSubdrawing H Ω).V := + (mem_interSet_V_iff (isClosed_univ.sdiff hΩ.isOpenDisc.1)).mpr ⟨hyH, mem_univ _, hyΩ⟩ + refine ⟨Or.inl (Or.inl ⟨y, hyNew, rfl⟩), hΛ.isOpenDisc, hΛ.z_subset, + hΛ.isOArc_bd, hΛ.isClosedDisc_closure, ?_, ?_, ?_⟩ + · apply oArc_subset_interSet_U hΛ.isOArc_bd hΛ.bd_subset_U + intro x hx + exact ⟨mem_univ _, fun hxΩ => hdis.notMem_of_mem_left hx.1 (subset_closure hxΩ)⟩ + · intro a ha haΛ + have haH := cleared_atom_mem_of_disjoint hΩ + (disjoint_left.mpr fun x hxΛ hxΩ => hdis.notMem_of_mem_left hxΛ (subset_closure hxΩ)) ha haΛ + exact ((hClear.dist_bounds {y} hΛ.z_mem a haH {y} + (Or.inl (Or.inl ⟨y, hyNew, rfl⟩)) a ha Subset.rfl Subset.rfl).2).trans (hΛ.dist_le a haH haΛ) + · intro he + exact hΛ.two_le_of_edge ((clearedSubdrawing_isSubdrawing H Ω).2 he) + +omit [ConnectedSpace S] in +/-- Every old atom farther than the radius from the centre survives a +clearing. Choose a point outside the zone closure. The only new atom +that is not an old atom is the cleared region itself. -/ +theorem far_atom_mem_cleared {H : Drawing S} {d : Set S → Set S → ℕ} + {γ : ℕ} {z Ω a : Set S} (hΩ : IsLambdaZoneAround H d γ z Ω) + (ha : a ∈ H.A) (hfar : γ < d z a) : a ∈ (clearedSubdrawing H Ω).A := by + have hnot : ¬ a ⊆ closure Ω := fun hsub => (Nat.not_le_of_lt hfar) (hΩ.dist_le a ha hsub) + obtain ⟨x, hxa, hxΩ⟩ := not_subset.mp hnot + obtain ⟨a', ha', hxa'⟩ := GraphMinor.GM15.exists_atom_of_point (clearedSubdrawing H Ω) x + have haH : a' ∈ H.A := by + rcases ha' with (⟨v, hv, rfl⟩ | he) | hr + · exact Or.inl (Or.inl ⟨v, (clearedSubdrawing_isSubdrawing H Ω).1 hv, rfl⟩) + · exact Or.inl (Or.inr ((clearedSubdrawing_isSubdrawing H Ω).2 he)) + · rcases clearedSubdrawing_region_eq_or_mem_R hΩ hr with heq | hrH + · exact False.elim (hxΩ (subset_closure (heq ▸ hxa'))) + · exact Or.inr hrH + have heq := GraphMinor.GM15.atom_eq_of_mem ha haH hxa hxa' + exact heq.symm ▸ ha' + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9ZoneSeparation.lean b/LeanPool/GraphMinor/GM16/Section9ZoneSeparation.lean new file mode 100644 index 0000000000..fcec1bf1a4 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9ZoneSeparation.lean @@ -0,0 +1,57 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +import LeanPool.GraphMinor.GM14.Section7a +import LeanPool.GraphMinor.GM16.DrawingConnected + +/-! +# A separation side contained in a zone is small + +The planar separator argument in XVI (8.1), Claim (10), uses the +inside of the battlefield. A low-order separation side whose edges +all lie in that zone belongs to the tangle. Otherwise XIV (7.3) +would put an edge on that side farther from the centre than the +zone's radius. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- Orient a small separation towards the complement of a zone. +This is the tangle orientation used in the radial form of the planar +Menger argument in XVI (8.1), Claim (10). -/ +theorem separation_mem_of_edges_in_zone (hS : IsClosedSurface S) + {H : Drawing S} {θ γ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} {y : S} {Λ : Set S} + {A B : Hypergraph S (Set S)} (hMet : HasTangleMetric H θ T d) (hθ : 2 ≤ θ) + (hy : y ∈ H.V) (hZone : IsLambdaZoneAround H d γ {y} Λ) + (hSep : H.toHypergraph.IsSeparation A B) + (hOrder : Hypergraph.separationOrder A B + γ < θ) + (hEdges : ∀ e ∈ A.edgeSet, e ⊆ closure Λ) : (A, B) ∈ T := by + by_contra hnot + have hBA := (hMet.1.2.1.axiom1 hSep (by omega)).resolve_left hnot + have hAne : A.edgeSet ≠ {{y}} := by + intro heq + have heA : ({y} : Set S) ∈ A.edgeSet := heq ▸ mem_singleton _ + have heH : ({y} : Set S) ∈ H.E := hSep.left_le.2 heA + exact (heH.2.1 (mem_singleton y)).2 hy + obtain ⟨e, heA, hFar⟩ := GraphMinor.GM14.theorem_7_3_proof H θ T d B A {y} + hS inferInstance (edges_nonempty_of_tangle hS hMet.1 hθ) hMet hZone.z_mem hBA hAne + have heH : e ∈ H.E := hSep.left_le.2 heA + have hNear := hZone.dist_le e (Or.inl (Or.inr heH)) (hEdges e heA) + rw [separationOrder_comm] at hFar + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Section9Zones.lean b/LeanPool/GraphMinor/GM16/Section9Zones.lean new file mode 100644 index 0000000000..338ba0522c --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Section9Zones.lean @@ -0,0 +1,169 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM11.OArcCircuit +import LeanPool.GraphMinor.GM11.CircuitRegions +import LeanPool.GraphMinor.GM11.NiceStatements +import LeanPool.GraphMinor.GM11.Section810 +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM14.Section3 + +/-! +# Disjoint battlefield zones + +In the proof of XVI (8.1), distant centres have disjoint battlefield discs. +To apply the zone distance bound to a point in both closures, first show that +the whole atom containing the point lies in both closures. A zone boundary +lies in the drawing, so an edge or region cannot cross it. +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 +universe w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- An atom meeting the closure of a zone lies wholly in that closure. -/ +theorem zone_atom_subset_closure {H : Drawing S} {d : Set S → Set S → ℕ} + {lam : ℕ} {z Λ a : Set S} (h : IsLambdaZoneAround H d lam z Λ) + (ha : a ∈ H.A) (hmeet : (a ∩ closure Λ).Nonempty) : a ⊆ closure Λ := by + have hfront : frontier (closure Λ) ⊆ subBd Λ := by + rw [subBd_eq_frontier] + exact frontier_closure_subset + have hpre : ∀ {A : Set S}, IsPreconnected A → Disjoint A (frontier (closure Λ)) → + (A ∩ closure Λ).Nonempty → A ⊆ closure Λ := by + intro A hA hdis ⟨x, hxA, hxΛ⟩ + exact (subset_or_disjoint_of_frontier isClosed_closure hA hdis).resolve_right + (fun hd => hd.notMem_of_mem_left hxA hxΛ) + rcases ha with (⟨x, hx, rfl⟩ | he) | hr + · obtain ⟨y, hy, hyΛ⟩ := hmeet + rw [mem_singleton_iff] at hy + exact singleton_subset_iff.mpr (hy ▸ hyΛ) + · by_cases hbd : (a ∩ subBd Λ).Nonempty + · exact (edge_subset_of_oArc h.isOArc_bd h.bd_subset_U he hbd).trans + (fun _ hx => hx.1) + · apply hpre he.2.2.1.isConnected.isPreconnected _ hmeet + exact disjoint_left.mpr fun x hxa hxfr => hbd ⟨x, hxa, hfront hxfr⟩ + · apply hpre (region_isPreconnected hr) _ hmeet + exact disjoint_left.mpr fun x hxr hxfr => + region_subset hr hxr (h.bd_subset_U (hfront hxfr)) + +/-- Graph Minors XVI, proof of (8.1), page 71: battlefield closures around +centres at distance greater than `2γ` are disjoint. -/ +theorem section9_disjoint_zones {H : Drawing S} {d : Set S → Set S → ℕ} + {γ θ : ℕ} {z₁ z₂ Λ₁ Λ₂ : Set S} + (h₁ : IsLambdaZoneAround H d γ z₁ Λ₁) (h₂ : IsLambdaZoneAround H d γ z₂ Λ₂) + (hsymm : ∀ a ∈ H.A, ∀ b ∈ H.A, d a b = d b a) + (htri : ∀ a ∈ H.A, ∀ b ∈ H.A, ∀ c ∈ H.A, + d a c ≤ d a b + d b c) + (hsep : θ ≤ d z₁ z₂) (hθ : 2 * γ < θ) : + Disjoint (closure Λ₁) (closure Λ₂) := by + apply disjoint_left.mpr + intro x hx₁ hx₂ + obtain ⟨a, ha, hxa⟩ := exists_atom H x + have hd₁ := h₁.dist_le a ha (zone_atom_subset_closure h₁ ha ⟨x, hxa, hx₁⟩) + have hd₂ := h₂.dist_le a ha (zone_atom_subset_closure h₂ ha ⟨x, hxa, hx₂⟩) + have hb := htri z₁ h₁.z_mem a ha z₂ h₂.z_mem + rw [hsymm a ha z₂ h₂.z_mem] at hb + omega + +omit [ConnectedSpace S] in +/-- A subdrawing contained in a set survives restriction to that set. -/ +theorem subdrawing_interSet_of_U_subset {H K : Drawing S} {T : Set S} + (hKH : K.IsSubdrawing H) (hKT : K.U ⊆ T) : K.IsSubdrawing (H.interSet T) := by + constructor + · intro x hx + exact Or.inl ⟨⟨hKH.1 hx, hKT (K.V_subset_U hx)⟩, hKH.1 hx⟩ + · intro e he + change e ∈ (H.span _ _).E + rw [H.span_E] + exact ⟨⟨hKH.2 he, (fun x hx => hKT (K.closure_subset_U he (subset_closure hx)))⟩, hKH.2 he⟩ + +/-- A circle in the old drawing survives restriction whenever its point set +does. In particular, battlefield boundaries survive clearing other zones. -/ +theorem oArc_subset_interSet_U {H : Drawing S} {F T : Set S} + (hF : IsOArc F) (hFH : F ⊆ H.U) (hFT : F ⊆ T) : F ⊆ (H.interSet T).U := by + obtain ⟨C, _, hCH, hCF⟩ := exists_circuit_of_oArc hF hFH + have hCT : C.U ⊆ T := hCF ▸ hFT + exact hCF ▸ (subdrawing_interSet_of_U_subset hCH hCT).U_subset + +/-- Clearing a family of disjoint zones retains every zone boundary. -/ +theorem zone_boundary_subset_clearFamily {H : Drawing S} {d : Set S → Set S → ℕ} + {Y : Set S} {γ : ℕ} {Λ : S → Set S} + (hZone : ∀ y ∈ Y, IsLambdaZoneAround H d γ {y} (Λ y)) + (hdis : ∀ y₁ ∈ Y, ∀ y₂ ∈ Y, y₁ ≠ y₂ → Disjoint (closure (Λ y₁)) (closure (Λ y₂))) + {y : S} (hy : y ∈ Y) : subBd (Λ y) ⊆ (clearEnvelopeDrawing H Y Λ).U := by + apply oArc_subset_interSet_U (hZone y hy).isOArc_bd (hZone y hy).bd_subset_U + intro x hx + refine ⟨mem_univ _, ?_⟩ + intro hxUnion + obtain ⟨z, hz, hxz⟩ := mem_iUnion₂.mp hxUnion + by_cases heq : y = z + · subst z + have hclosed : IsClosed (univ \ Λ y) := isClosed_univ.sdiff (hZone y hy).isOpenDisc.1 + have hxOut := hx.2 + rw [hclosed.closure_eq] at hxOut + exact hxOut.2 hxz + · exact (hdis y hy z hz heq).notMem_of_mem_left hx.1 (subset_closure hxz) + +omit [ConnectedSpace S] in +/-- The point set left after clearing a family of zones is the old point +set outside their union. This is used in XVI (8.1), Claim (2), page 71. -/ +theorem clearFamily_U {H : Drawing S} {d : Set S → Set S → ℕ} + {Y : Set S} {γ : ℕ} {Λ : S → Set S} + (hZone : ∀ y ∈ Y, IsLambdaZoneAround H d γ {y} (Λ y)) : + (clearEnvelopeDrawing H Y Λ).U = H.U \ (⋃ y ∈ Y, Λ y) := by + have hclosed : IsClosed (univ \ (⋃ y ∈ Y, Λ y)) := + isClosed_univ.sdiff (isOpen_iUnion fun y => isOpen_iUnion fun hy => (hZone y hy).isOpenDisc.1) + apply subset_antisymm + · intro x hx + exact ⟨interSet_isSub.U_subset hx, (interSet_U_subset hclosed hx).2⟩ + · rintro x ⟨hxH, hxOut⟩ + by_cases hxV : x ∈ H.V + · exact (clearEnvelopeDrawing H Y Λ).V_subset_U + ((mem_interSet_V_iff hclosed).mpr ⟨hxV, mem_univ _, hxOut⟩) + · obtain ⟨e, he, hxe⟩ := H.exists_edge_of_mem hxH hxV + have heOut : e ⊆ univ \ (⋃ y ∈ Y, Λ y) := by + intro z hz + refine ⟨mem_univ _, ?_⟩ + intro hzUnion + obtain ⟨y, hyY, hzy⟩ := mem_iUnion₂.mp hzUnion + rcases edge_subset_or_subset_compl_of_zone (hZone y hyY) he with heIn | heNot + · exact hxOut (mem_iUnion₂.mpr ⟨y, hyY, heIn hxe⟩) + · exact (heNot hz).2 hzy + exact (clearEnvelopeDrawing H Y Λ).closure_subset_U + (mem_interSet_E_iff.mpr ⟨he, heOut⟩) (subset_closure hxe) + +/-- The drawing on a circle contained in a drawing is a circuit. +This gives the boundary circuits used in XVI (8.1), Claim (4). -/ +theorem interSet_isCircuit_of_oArc {H : Drawing S} {F : Set S} + (hF : IsOArc F) (hFH : F ⊆ H.U) : (H.interSet F).IsCircuit := by + obtain ⟨C, hC, hCH, hCF⟩ := exists_circuit_of_oArc hF hFH + have hclosed : IsClosed F := (isCompact_of_isOArc hF).isClosed + have hHC : (H.interSet F).IsSubdrawing C := + interSet_isSubdrawing hCH hclosed hCF.symm.subset + have hCH' : C.IsSubdrawing (H.interSet F) := + subdrawing_interSet_of_U_subset hCH hCF.subset + have heq : H.interSet F = C := Drawing.ext_of_V_E + (subset_antisymm hHC.1 hCH'.1) (subset_antisymm hHC.2 hCH'.2) + exact heq.symm ▸ hC + +/-- Every boundary circuit remains a circuit after the whole family is +cleared, as required in XVI (8.1), Claim (4), page 72. -/ +theorem zone_boundary_isCircuit_clearFamily {H : Drawing S} {d : Set S → Set S → ℕ} + {Y : Set S} {γ : ℕ} {Λ : S → Set S} + (hZone : ∀ y ∈ Y, IsLambdaZoneAround H d γ {y} (Λ y)) + (hdis : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → Disjoint (closure (Λ y)) (closure (Λ z))) + {y : S} (hy : y ∈ Y) : + ((clearEnvelopeDrawing H Y Λ).interSet (subBd (Λ y))).IsCircuit := + interSet_isCircuit_of_oArc (hZone y hy).isOArc_bd (zone_boundary_subset_clearFamily hZone hdis hy) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SeparatedHairsCut.lean b/LeanPool/GraphMinor/GM16/SeparatedHairsCut.lean new file mode 100644 index 0000000000..42ae110928 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SeparatedHairsCut.lean @@ -0,0 +1,71 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM11.CitedResults +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Excluding the close-pair outcome after clearing + +The separator makes every surviving path shorter than `2ψ`. +A path whose ends are each within `ψ` of two different separated +hairs would then make those hairs less than `4ψ` apart. This is +the contradiction excluding the second outcome of (8.3) in XVI +(7.1), page 70. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] +variable {α : Type u} {β : Type v} + +/-- Two close ends of a surviving path contradict separated hairs +when the separator meets every path of length at least `2ψ` in the metric. -/ +theorem close_pair_path_contradiction (hS : IsClosedSurface S) + {G P : Graph α β} {H : Drawing S} (η : SpanEmbedding H G) + {θ sep ψ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hMet : HasTangleMetric H θ T d) + {X Z : Set α} {Y : Set S} (hY : Y ⊆ H.V) + (hSep : ∀ y ∈ Y, ∀ z ∈ Y, y ≠ z → sep ≤ d {y} {z}) + (hBudget : 4 * ψ ≤ sep) + (hCut : ∀ Q s t, s ∈ H.V → t ∈ H.V → + IsHPathWithEnds (deleteVertices G X) η.imageGraph Q (η.vMap s) (η.vMap t) → + 2 * ψ ≤ d {s} {t} → (Z ∩ V(Q)).Nonempty) + {s t y z : S} (hs : s ∈ H.V) (ht : t ∈ H.V) + (hy : y ∈ Y) (hz : z ∈ Y) (hyz : y ≠ z) + (hP : IsHPathWithEnds (deleteVertices G (X ∪ Z)) η.imageGraph P (η.vMap s) (η.vMap t)) + (hsy : d {s} {y} < ψ) (htz : d {t} {z} < ψ) : False := by + have hDel : deleteVertices G (X ∪ Z) ≤ deleteVertices G X := by + refine ⟨fun x hx => ⟨hx.1, fun hxX => hx.2 (Or.inl hxX)⟩, ?_⟩ + intro e a b hl + exact ⟨hl.1, ⟨hl.2.1.1, fun h => hl.2.1.2 (Or.inl h)⟩, + ⟨hl.2.2.1, fun h => hl.2.2.2 (Or.inl h)⟩⟩ + have hP' : IsHPathWithEnds (deleteVertices G X) η.imageGraph P (η.vMap s) (η.vMap t) := + ⟨hP.1.trans hDel, hP.2.1.mono hDel, hP.2.2⟩ + have hShort : d {s} {t} < 2 * ψ := by + by_contra hLong + obtain ⟨x, hxZ, hxP⟩ := hCut P s t hs ht hP' (Nat.le_of_not_gt hLong) + have hxDel := hP.2.1.1.vertexSet_mono hxP + exact hxDel.2 (Or.inr hxZ) + obtain ⟨_, _, _, hSymm, hTri, _⟩ := GM11.gm15_theorem_9_1 H θ T d hS inferInstance hMet + have hsA : ({s} : Set S) ∈ H.A := Or.inl (Or.inl ⟨s, hs, rfl⟩) + have htA : ({t} : Set S) ∈ H.A := Or.inl (Or.inl ⟨t, ht, rfl⟩) + have hyA : ({y} : Set S) ∈ H.A := Or.inl (Or.inl ⟨y, hY hy, rfl⟩) + have hzA : ({z} : Set S) ∈ H.A := Or.inl (Or.inl ⟨z, hY hz, rfl⟩) + have h₁ := hTri {y} hyA {s} hsA {z} hzA + have h₂ := hTri {s} hsA {t} htA {z} hzA + rw [hSymm {y} hyA {s} hsA] at h₁ + have hFar := hSep y hy z hz hyz + omega + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SimpleDrawingVertices.lean b/LeanPool/GraphMinor/GM16/SimpleDrawingVertices.lean new file mode 100644 index 0000000000..4db3a23de0 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SimpleDrawingVertices.lean @@ -0,0 +1,54 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import LeanPool.GraphMinor.GM01.Defs + +/-! +# The vertex map of a drawing of a simple graph + +The abstract vertex set is the whole vertex type. Evaluating the +vertex equivalence gives an injective map to the points of the +drawing, whose range is exactly its vertex set. This keeps the +centre coordinates explicit when drawing a subdivision in +XVI (4.2). +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Graph Surface +universe u v + +/-- The point assigned to an abstract simple-graph vertex by its drawing. -/ +def simpleDrawingVertex {ν : Type u} {S : Type v} [TopologicalSpace S] + {H : SimpleGraph ν} (Γ : GraphDrawing (Graph.ofSimpleGraph H) S) (v : ν) : S := + (Γ.iso.vertexEquiv ⟨v,mem_univ v⟩).val + +/-- Distinct abstract vertices are drawn at distinct points. -/ +theorem simpleDrawingVertex_injective {ν : Type u} {S : Type v} [TopologicalSpace S] + {H : SimpleGraph ν} (Γ : GraphDrawing (Graph.ofSimpleGraph H) S) : + Function.Injective (simpleDrawingVertex Γ) := by + intro a b he + exact congrArg Subtype.val (Γ.iso.vertexEquiv.injective (Subtype.ext he)) + +/-- The range of the vertex map is the vertex set of the drawing. -/ +theorem range_simpleDrawingVertex {ν : Type u} {S : Type v} [TopologicalSpace S] + {H : SimpleGraph ν} (Γ : GraphDrawing (Graph.ofSimpleGraph H) S) : + range (simpleDrawingVertex Γ) = Γ.drawing.V := by + ext x + constructor + · rintro ⟨v,rfl⟩ + exact (Γ.iso.vertexEquiv ⟨v,mem_univ v⟩).property + · intro hx + let v := Γ.iso.vertexEquiv.symm ⟨x,hx⟩ + refine ⟨v.val,?_⟩ + exact congrArg Subtype.val (Γ.iso.vertexEquiv.apply_symm_apply ⟨x,hx⟩) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SpanAttachment.lean b/LeanPool/GraphMinor/GM16/SpanAttachment.lean new file mode 100644 index 0000000000..44c65efe42 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SpanAttachment.lean @@ -0,0 +1,75 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM06.Defs +import LeanPool.GraphMinor.GM16.SpanSubdrawing +import LeanPool.GraphMinor.GM16.ConnectedAttachment +import LeanPool.GraphMinor.GM16.DrawingGraphPaths + +/-! +# Transporting the clean attachment through the span embedding + +Map the clean path and the connected annular subdrawing into the +ambient graph. Injectivity of the vertex map preserves their +intersections with the cleared drawing. Their connected union then +gives the attachment forbidden in XVI (8.1), Claim (9), completing +the graph step used in Claim (14). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM06 GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] +variable {α : Type u} {β : Type v} + +/-- A clean path joined to a clean connected subdrawing gives an +ambient attachment, with exactly the vertex-map interpretation of +its intersection with the cleared drawing. -/ +theorem span_connected_extension_gives_attachment + {G P₀ : Graph α β} {H H' P J : Drawing S} + (η : SpanEmbedding H G) (η' : SpanEmbedding H' G) + (hH' : H'.IsSubdrawing H) (hMap : η'.vMap = η.vMap) + {a b : S} {X : Set S} {Z : Set α} + (hP : P.IsSubdrawing H) (hPath : P.IsPathBetween a b) + (hJ : J.IsSubdrawing H) (hConn : IsGraphConnected J.toGraph) + (hMeet : (P.V ∩ J.V).Nonempty) (hHit : (V(P₀) ∩ (η.vMap '' J.V)).Nonempty) + (hPClear : P.V ∩ H'.V ⊆ X) (hJClear : Disjoint J.V H'.V) + (hPZ : Disjoint (η.vMap '' P.V) Z) (hJZ : Disjoint (η.vMap '' J.V) Z) : + ∃ c ∈ V(P₀), ∃ Q : Graph α β, + IsGraphPathWithEnds G Q (η.vMap a) c ∧ + V(Q) ∩ V(η'.imageGraph) ⊆ η.vMap '' X ∧ Disjoint V(Q) Z := by + obtain ⟨R, hR, hRV, _⟩ := exists_span_image_path η hP hPath + obtain ⟨ηJ, hηJv, _, _⟩ := exists_spanEmbedding_subdrawing η hJ + have hJV : V(ηJ.imageGraph) = η.vMap '' J.V := by + rw [← ηJ.bijOn_v.image_eq, hηJv] + have hH'V : V(η'.imageGraph) = η.vMap '' H'.V := by + rw [← η'.bijOn_v.image_eq, hMap] + have hRMeet : (V(R) ∩ V(ηJ.imageGraph)).Nonempty := by + obtain ⟨x, hxP, hxJ⟩ := hMeet + rw [hRV, hJV] + exact ⟨η.vMap x, mem_image_of_mem _ hxP, mem_image_of_mem _ hxJ⟩ + have hRHit : (V(P₀) ∩ V(ηJ.imageGraph)).Nonempty := hJV.symm ▸ hHit + have hRInt : V(R) ∩ V(η'.imageGraph) ⊆ η.vMap '' X := by + rw [hRV, hH'V, ← η.bijOn_v.injOn.image_inter hP.1 hH'.1] + exact image_mono hPClear + have hJInt : Disjoint V(ηJ.imageGraph) V(η'.imageGraph) := by + rw [hJV, hH'V] + apply disjoint_left.mpr + rintro x ⟨v, hv, rfl⟩ ⟨w, hw, heq⟩ + have hwv := η.bijOn_v.injOn (hH'.1 hw) (hJ.1 hv) heq + exact hJClear.notMem_of_mem_left hv (hwv ▸ hw) + have hRZ : Disjoint V(R) Z := hRV.symm ▸ hPZ + have hJZ' : Disjoint V(ηJ.imageGraph) Z := hJV.symm ▸ hJZ + exact connected_extension_gives_attachment hR ηJ.imageGraph_le + (spanEmbedding_image_connected ηJ hConn) hRMeet hRHit hRInt hJInt hRZ hJZ' + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SpanCongr.lean b/LeanPool/GraphMinor/GM16/SpanCongr.lean new file mode 100644 index 0000000000..04d5995e24 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SpanCongr.lean @@ -0,0 +1,58 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Defs + +/-! +# Identifying restricted span embeddings + +Successive clearings and clearing their union give the same drawing. +Their vertex and edge maps are unchanged. Since both images are +subgraphs of the same graph, these two maps determine the embedding, +and hence identify the corresponding span statements. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM14 GraphMinor.GM15 +universe u v w + +/-- Two embeddings of the same drawing into the same ambient graph +are equal when their vertex and edge maps agree. -/ +theorem spanEmbedding_eq_of_maps {S : Type w} [TopologicalSpace S] + {α : Type u} {β : Type v} {G : Graph α β} {H : Drawing S} + (η η' : SpanEmbedding H G) (hv : η.vMap = η'.vMap) (he : η.eMap = η'.eMap) : η = η' := by + have hV : V(η.imageGraph) = V(η'.imageGraph) := by + rw [← η.bijOn_v.image_eq, ← η'.bijOn_v.image_eq, hv] + have hE : E(η.imageGraph) = E(η'.imageGraph) := by + rw [← η.bijOn_e.image_eq, ← η'.bijOn_e.image_eq, he] + have hG : η.imageGraph = η'.imageGraph := + (Graph.Compatible.of_le_le η.imageGraph_le η'.imageGraph_le).ext hV hE + cases η + cases η' + simp only at hv he hG + cases hv + cases he + cases hG + rfl + +/-- Transport a span along equality of drawings and equality of its +vertex and edge maps. This is used for the iterated clearings in XVI. -/ +theorem span_congr_drawing_embedding {S : Type w} [TopologicalSpace S] [T2Space S] + {α : Type u} {β : Type v} {G : Graph α β} {H K : Drawing S} + (hHK : H = K) (η : SpanEmbedding H G) (η' : SpanEmbedding K G) + (hv : η.vMap = η'.vMap) (he : η.eMap = η'.eMap) + {θ_star θ : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hSpan : IsSigmaSpan G H η θ_star θ T_star T) : IsSigmaSpan G K η' θ_star θ T_star T := by + subst K + exact spanEmbedding_eq_of_maps η η' hv he ▸ hSpan + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SpanMarkedSegments.lean b/LeanPool/GraphMinor/GM16/SpanMarkedSegments.lean new file mode 100644 index 0000000000..63d125086d --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SpanMarkedSegments.lean @@ -0,0 +1,84 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM16.MarkedPathSegments +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Consecutive drawing vertices along an ambient path + +Apply the marked-path lemmas to the vertices of the image drawing. +The vertex bijection then identifies the selected vertices with +points of the original drawing. This supplies the choices of `t_i` +and of `u,v` in XVI (8.1), pages 72–75. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM14 +universe u v w +variable {S : Type w} [TopologicalSpace S] {α : Type u} {β : Type v} + +/-- Choose the second drawing vertex along a path starting at a +drawing vertex, and the segment up to that vertex. -/ +theorem exists_initial_span_segment {H : Drawing S} {G P : Graph α β} + (η : SpanEmbedding H G) {s t : S} (hs : s ∈ H.V) (ht : t ∈ H.V) (hst : s ≠ t) + (hP : IsGraphPathWithEnds G P (η.vMap s) (η.vMap t)) : + ∃ v ∈ H.V, v ≠ s ∧ ∃ R : Graph α β, + R ≤ P ∧ IsGraphPathWithEnds G R (η.vMap s) (η.vMap v) ∧ + V(R) ∩ V(η.imageGraph) = {η.vMap s, η.vMap v} := by + have hneq : η.vMap s ≠ η.vMap t := fun h => hst (η.bijOn_v.injOn hs ht h) + obtain ⟨v', hv', hvs, R, hRP, hR, hInter⟩ := exists_initial_marked_segment hP + (η.bijOn_v.mapsTo hs) (η.bijOn_v.mapsTo ht) hneq + obtain ⟨v, hv, hmap⟩ := η.bijOn_v.surjOn hv' + refine ⟨v, hv, ?_, R, hRP, ?_, ?_⟩ + · intro heq + exact hvs (hmap.symm.trans (congrArg η.vMap heq)) + · simpa only [hmap] using hR + · simpa only [hmap] using hInter + +/-- Choose the first drawing vertex outside a shell, distinct from +the initial end, and the last drawing vertex before it. This is the +selection immediately before Claim (15) of XVI (8.1), pages 74–75. -/ +theorem exists_consecutive_span_exit {H : Drawing S} {G P : Graph α β} + (η : SpanEmbedding H G) {B : Set S} {s t : S} + (hs : s ∈ H.V) (ht : t ∈ H.V) (hst : s ≠ t) (htB : t ∉ B) + (hP : IsGraphPathWithEnds G P (η.vMap s) (η.vMap t)) : + ∃ u ∈ H.V, ∃ v ∈ H.V, + u ≠ v ∧ v ≠ s ∧ v ∉ B ∧ (u = s ∨ u ∈ B) ∧ + ∃ R : Graph α β, R ≤ P ∧ IsGraphPathWithEnds G R (η.vMap u) (η.vMap v) ∧ + V(R) ∩ V(η.imageGraph) = {η.vMap u, η.vMap v} := by + have hneq : η.vMap s ≠ η.vMap t := fun h => hst (η.bijOn_v.injOn hs ht h) + have htOut : η.vMap t ∉ η.vMap '' (H.V ∩ B) := by + rintro ⟨x, hx, hxt⟩ + have hxt' := η.bijOn_v.injOn hx.1 ht hxt + exact htB (hxt' ▸ hx.2) + obtain ⟨u', hu', v', hv', huv', hvs', hvB', huCase, R, hRP, hR, hInter⟩ := + exists_consecutive_marked_exit hP (η.bijOn_v.mapsTo hs) (η.bijOn_v.mapsTo ht) hneq htOut + obtain ⟨u, hu, humap⟩ := η.bijOn_v.surjOn hu' + obtain ⟨v, hv, hvmap⟩ := η.bijOn_v.surjOn hv' + have huCase' : u = s ∨ u ∈ B := by + rcases huCase with hueq | ⟨x, hx, hxu⟩ + · exact Or.inl (η.bijOn_v.injOn hu hs (humap.trans hueq)) + · have hxu' := η.bijOn_v.injOn hx.1 hu (hxu.trans humap.symm) + exact Or.inr (hxu' ▸ hx.2) + refine ⟨u, hu, v, hv, ?_, ?_, ?_, huCase', R, hRP, ?_, ?_⟩ + · intro heq + exact huv' (humap.symm.trans ((congrArg η.vMap heq).trans hvmap)) + · intro heq + exact hvs' (hvmap.symm.trans (congrArg η.vMap heq)) + · intro hvB + exact hvB' ⟨v, ⟨hv, hvB⟩, hvmap⟩ + · simpa only [humap, hvmap] using hR + · simpa only [humap, hvmap] using hInter + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SpanPaths.lean b/LeanPool/GraphMinor/GM16/SpanPaths.lean new file mode 100644 index 0000000000..0a4d4875e0 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SpanPaths.lean @@ -0,0 +1,215 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM11.Section91 +import LeanPool.GraphMinor.GM11.Section5b +import LeanPool.GraphMinor.GM11.NiceStatements +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section3c + +/-! +# Paths under a span embedding + +The vertex and edge bijections of a span preserve links and hence walks. +Their images stay in the image subgraph. These facts let the path arguments +for XVI (8.3) pass between a drawing and its copy in the ambient graph. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM15 +universe u v w +variable {S : Type w} [TopologicalSpace S] {α : Type u} {β : Type v} + +/-- A span embedding preserves the two ends of an edge, including a loop. -/ +theorem spanEmbedding_map_isLink {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) {e : Set S} {x y : S} (he : H.toGraph.IsLink e x y) : + η.imageGraph.IsLink (η.eMap e) (η.vMap x) (η.vMap y) := by + have hx : x ∈ closure e := (he.2.2.2 ▸ mem_insert x {y}).1 + have hy : y ∈ closure e := (he.2.2.2 ▸ mem_insert_of_mem x (mem_singleton y)).1 + rw [Graph.isLink_iff_inc] + refine ⟨(η.inc_iff e he.1 x he.2.1).mpr hx, + (η.inc_iff e he.1 y he.2.2.1).mpr hy, ?_⟩ + intro z hz + obtain ⟨a, ha, rfl⟩ := η.bijOn_v.surjOn (hz.vertex_mem) + have haz := (η.inc_iff e he.1 a ha).mp hz + have haa : a ∈ ({x, y} : Set S) := he.2.2.2 ▸ ⟨haz, ha⟩ + rcases haa with rfl | haa + · exact Or.inl rfl + · exact Or.inr (congrArg η.vMap (mem_singleton_iff.mp haa)) + +/-- Map a drawing walk to the image graph of a span embedding. -/ +def mapSpanWalk {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) {x y : S} (W : GraphWalk H.toGraph x y) : + GraphWalk η.imageGraph (η.vMap x) (η.vMap y) := + match W with + | .nil hx => .nil (η.bijOn_v.mapsTo hx) + | .cons he W => .cons (spanEmbedding_map_isLink η he) (mapSpanWalk η W) + +/-- The mapped walk has exactly the mapped vertices of the original walk. -/ +theorem mapSpanWalk_support {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) {x y : S} (W : GraphWalk H.toGraph x y) : + (mapSpanWalk η W).support = W.support.map η.vMap := by + induction W with + | nil _ => rfl + | cons he W ih => + change _ :: (mapSpanWalk η W).support = _ :: W.support.map η.vMap + rw [ih] + +/-- The mapped walk has exactly the mapped edges of the original walk. -/ +theorem mapSpanWalk_edges {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) {x y : S} (W : GraphWalk H.toGraph x y) : + (mapSpanWalk η W).edges = W.edges.map η.eMap := by + induction W with + | nil _ => rfl + | cons he W ih => + change _ :: (mapSpanWalk η W).edges = _ :: W.edges.map η.eMap + rw [ih] + +/-- Two paths from the old graph to a common point outside it contain an +old-graph path between their distinct old ends. The paths may intersect +away from that common point. -/ +theorem exists_hPath_of_two_paths {G H P Q : Graph α β} {a w b : α} + (hHG : H ≤ G) (hP : GM09.IsGraphPathWithEnds G P a w) + (hQ : GM09.IsGraphPathWithEnds G Q w b) + (ha : a ∈ V(H)) (hb : b ∈ V(H)) (hab : a ≠ b) + (hPH : V(P) ∩ V(H) ⊆ {a}) (hQH : V(Q) ∩ V(H) ⊆ {b}) : + ∃ L : Graph α β, L ≤ GM09.subgraphUnion G P Q ∧ IsHPathWithEnds G H L a b := by + let U := GM09.subgraphUnion G P Q + have hPU : P ≤ U := GM09.le_subgraphUnion_left hP.1 hQ.1 + have hQU : Q ≤ U := GM09.le_subgraphUnion_right hP.1 hQ.1 + obtain ⟨WP, _, _, _⟩ := hP.2 + obtain ⟨WQ, _, _, _⟩ := hQ.2 + obtain ⟨WP', _, _⟩ := GM09.exists_walk_up_of_le hPU WP + obtain ⟨WQ', _, _⟩ := GM09.exists_walk_up_of_le hQU WQ + obtain ⟨L, hL, _, _⟩ := GM09.exists_isGraphPathWithEnds_of_walk (WP'.append WQ') + have hUG : U ≤ G := GM09.subgraphUnion_le hP.1 hQ.1 + have hLG : GM09.IsGraphPathWithEnds G L a b := hL.mono hUG + have hLsub : L ≤ U := hL.1 + have hPE := GM09.disjoint_edgeSet_of_inter_singleton hP hHG hPH + have hQE := GM09.disjoint_edgeSet_of_inter_singleton hQ hHG hQH + refine ⟨L, hLsub, hHG, hLG, hab, ha, hb, ?_, ?_⟩ + · apply subset_antisymm + · rintro x ⟨hxL, hxH⟩ + have hxU := hLsub.vertexSet_mono hxL + change x ∈ V(P) ∪ V(Q) at hxU + rcases hxU with hxP | hxQ + · exact mem_insert_iff.mpr (Or.inl (mem_singleton_iff.mp (hPH ⟨hxP, hxH⟩))) + · exact mem_insert_of_mem a (hQH ⟨hxQ, hxH⟩) + · intro x hx + rcases hx with rfl | hx + · exact ⟨hLG.left_mem, ha⟩ + · rw [mem_singleton_iff] at hx + subst x + exact ⟨hLG.right_mem, hb⟩ + · apply disjoint_left.mpr + intro e heL heH + have heU := hLsub.edgeSet_mono heL + rw [GM09.edgeSet_subgraphUnion hP.1 hQ.1] at heU + rcases heU with heP | heQ + · exact hPE.notMem_of_mem_left heP heH + · exact hQE.notMem_of_mem_left heQ heH + +/-- The ends of an image edge are at metric distance at most two. +Both ends lie on a common region of the original drawing. The two radial +spokes to its hub, each traversed twice, give a closed walk of length four. -/ +theorem metric_le_two_of_image_link [T2Space S] (hS : IsClosedSurface S) + {H : Drawing S} {G : Graph α β} (η : SpanEmbedding H G) + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {d : Set S → Set S → ℕ} (hm : HasTangleMetric H θ T d) + {x y : S} (hx : x ∈ H.V) (hy : y ∈ H.V) {e : β} + (he : e ∈ E(η.imageGraph)) (hlink : G.IsLink e (η.vMap x) (η.vMap y)) : + d {x} {y} ≤ 2 := by + let : ConnectedSpace S := hm.1.1.1 + have hl := (η.imageGraph_le.isLink_iff he).mpr hlink + obtain ⟨f, hf, hfe⟩ := η.bijOn_e.surjOn he + have hix : η.imageGraph.Inc (η.eMap f) (η.vMap x) := by rw [hfe]; exact ⟨η.vMap y, hl⟩ + have hiy : η.imageGraph.Inc (η.eMap f) (η.vMap y) := by rw [hfe]; exact ⟨η.vMap x, hl.symm⟩ + have hxf := (η.inc_iff f hf x hx).mp hix + have hyf := (η.inc_iff f hf y hy).mp hiy + obtain ⟨r, hr, hfr⟩ := exists_region_incident hS hf + have hxr := (closure_minimal hfr isClosed_closure) hxf + have hyr := (closure_minimal hfr isClosed_closure) hyf + obtain ⟨K, ins, hrad, _, hd⟩ := hm.2 + have hp := hrad.2.1 + have hxK := hp.2.1 hx + have hyK := hp.2.1 hy + have hxA : ({x} : Set S) ∈ H.A := Or.inl (Or.inl ⟨x, hx, rfl⟩) + have hyA : ({y} : Set S) ∈ H.A := Or.inl (Or.inl ⟨y, hy, rfl⟩) + rw [hd _ hxA _ hyA] + by_cases hθ : θ ≤ 2 + · exact (tangleMetric_le_order hp _ _).trans hθ + obtain ⟨c, ⟨hcr, hcK⟩, _⟩ := hp.2.2.1 r hr + obtain ⟨a, ha, hac⟩ := exists_spoke_at ⟨hrad.1, hp⟩ hrad.2.2 hS ⟨f, hf⟩ hr hcr hcK hx hxr + obtain ⟨b, hb, hbc⟩ := exists_spoke_at ⟨hrad.1, hp⟩ hrad.2.2 hS ⟨f, hf⟩ hr hcr hcK hy hyr + have la : K.toGraph.IsLink a x c := ⟨ha, hxK, hcK, hac⟩ + have lb : K.toGraph.IsLink b y c := ⟨hb, hyK, hcK, hbc⟩ + let W : GraphWalk K.toGraph x x := .cons la (.cons lb.symm (.cons lb (.cons la.symm (.nil hxK)))) + have hu : ∀ z ∈ W.support, z ∈ insWalk ins K W := fun z hz => + Or.inl ((mem_walkDrawing_U K W).mpr (Or.inl hz)) + apply tangleMetric_le + refine ⟨x, W, {x}, {y}, ?_, ?_, ?_, rfl, ?_, ?_⟩ + · exact ⟨hxA, Or.inl (Or.inl ⟨x, hxK, rfl⟩), Or.inl ⟨x, hx, rfl, rfl⟩⟩ + · exact ⟨hyA, Or.inl (Or.inl ⟨y, hyK, rfl⟩), Or.inl ⟨y, hy, rfl, rfl⟩⟩ + · change 4 < 2 * θ + omega + · rintro z rfl + exact hu _ (by simp [W, GraphWalk.support]) + · rintro z rfl + exact hu _ (by simp [W, GraphWalk.support]) + +/-- A path meeting a span just in its ends is a span path when the ends are +at distance at least three. That bound rules out a shared edge. -/ +theorem isHPath_of_far_ends [T2Space S] (hS : IsClosedSurface S) {H : Drawing S} {G P : Graph α β} + (η : SpanEmbedding H G) {d : Set S → Set S → ℕ} + {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hm : HasTangleMetric H θ T d) + {x y : S} (hx : x ∈ H.V) (hy : y ∈ H.V) + (hP : GM09.IsGraphPathWithEnds G P (η.vMap x) (η.vMap y)) + (hne : η.vMap x ≠ η.vMap y) + (hinter : V(P) ∩ V(η.imageGraph) = {η.vMap x, η.vMap y}) + (hdist : 3 ≤ d {x} {y}) : IsHPathWithEnds G η.imageGraph P (η.vMap x) (η.vMap y) := by + refine ⟨η.imageGraph_le, hP, hne, η.bijOn_v.mapsTo hx, η.bijOn_v.mapsTo hy, hinter, ?_⟩ + apply disjoint_left.mpr + intro e heP heH + obtain ⟨r, s, hlinkP⟩ := P.exists_isLink_of_mem_edgeSet heP + have hlinkG := (hP.1.isLink_iff heP).mp hlinkP + have hlinkH := (η.imageGraph_le.isLink_iff heH).mpr hlinkG + have hr : r ∈ ({η.vMap x, η.vMap y} : Set α) := hinter ▸ ⟨hlinkP.left_mem, hlinkH.left_mem⟩ + have hs : s ∈ ({η.vMap x, η.vMap y} : Set α) := hinter ▸ ⟨hlinkP.right_mem, hlinkH.right_mem⟩ + have hbad : G.IsLink e (η.vMap x) (η.vMap y) → False := by + intro hl + have hb := metric_le_two_of_image_link hS η hm hx hy heH hl + omega + rcases hr with rfl | hr <;> rcases hs with rfl | hs + · exact hP.not_isLoopAt heP _ hlinkG + · rw [mem_singleton_iff] at hs + exact hbad (hs ▸ hlinkG) + · rw [mem_singleton_iff] at hr + exact hbad (hr ▸ hlinkG.symm) + · rw [mem_singleton_iff] at hr hs + exact hP.not_isLoopAt heP _ (hr ▸ hs ▸ hlinkG) + +/-- A path with distinct ends has an edge at its last end, and the other +end of that edge is different. -/ +theorem path_edge_at_end {G P : Graph α β} {a b : α} + (hP : GM09.IsGraphPathWithEnds G P a b) (hab : a ≠ b) : + ∃ (e : β) (u : α), P.IsLink e u b ∧ u ≠ b := by + obtain ⟨_, W, hsimple, _, _⟩ := GM09.IsGraphPathWithEnds.symm hP + cases W with + | nil _ => exact (hab rfl).elim + | @cons b u a e hl R => + refine ⟨e, u, hl.symm, ?_⟩ + intro heq + exact (List.nodup_cons.mp hsimple).1 (heq ▸ R.start_mem_support) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SpanSubdrawing.lean b/LeanPool/GraphMinor/GM16/SpanSubdrawing.lean new file mode 100644 index 0000000000..8fe83f1ec7 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SpanSubdrawing.lean @@ -0,0 +1,120 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.GM11.Defs +import LeanPool.GraphMinor.GM16.Section6 +import LeanPool.GraphMinor.GM16.SpanPaths +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Restricting a span embedding to a subdrawing + +A subdrawing is spanned by its own vertices and edges. Restrict the +span embedding to that span and identify it with the given drawing. +The vertex and edge maps are retained, and the image graph is a +subgraph of the original image. This transfers the connected annulus +of XVI (8.1), Claim (14), to the ambient graph. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM14 GraphMinor.GM06 +universe u v w +variable {S : Type w} [TopologicalSpace S] [T2Space S] +variable {α : Type u} {β : Type v} + +/-- Every subdrawing is the span of its own vertices and edges. -/ +theorem span_subdrawing_eq {H J : Drawing S} (hJ : J.IsSubdrawing H) : + H.span J.V J.E = J := by + apply Drawing.ext_of_V_E + · rw [H.span_V] + change (J.V ∩ H.V) ∪ (⋃ e ∈ J.E ∩ H.E, closure e ∩ H.V) = J.V + apply subset_antisymm + · rintro x (hx | hx) + · exact hx.1 + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + exact (hJ.closure_inter_V he.1 ▸ hxe).2 + · intro x hx + exact Or.inl ⟨hx, hJ.1 hx⟩ + · rw [H.span_E] + exact inter_eq_left.mpr hJ.2 + +omit [T2Space S] in +private theorem cast_embedding_fields {D E : Drawing S} (h : D = E) + {G : Graph α β} (η : SpanEmbedding D G) : + (h ▸ η).vMap = η.vMap ∧ (h ▸ η).eMap = η.eMap ∧ + (h ▸ η).imageGraph = η.imageGraph := by + cases h + exact ⟨rfl, rfl, rfl⟩ + +/-- Restrict a span embedding to any subdrawing while keeping its +vertex and edge maps. Its image is a subgraph of the old image. -/ +theorem exists_spanEmbedding_subdrawing {H J : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) (hJ : J.IsSubdrawing H) : + ∃ ηJ : SpanEmbedding J G, ηJ.vMap = η.vMap ∧ ηJ.eMap = η.eMap ∧ + ηJ.imageGraph ≤ η.imageGraph := by + let η₀ := restrictSpan η J.V J.E + have hspan := span_subdrawing_eq hJ + let ηJ : SpanEmbedding J G := hspan ▸ η₀ + obtain ⟨hv, he, hIm⟩ := cast_embedding_fields hspan η₀ + refine ⟨ηJ, hv, he, ?_⟩ + change (hspan ▸ η₀).imageGraph ≤ η.imageGraph + rw [hIm] + apply Graph.restrict_le.trans + apply Graph.induce_le + intro x hx + obtain ⟨v, hv, rfl⟩ := hx + exact η.bijOn_v.mapsTo ((H.spanV_subset J.V J.E) hv) + +omit [T2Space S] in +/-- A span embedding carries a connected drawing to a connected +image graph. -/ +theorem spanEmbedding_image_connected {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) (hH : IsGraphConnected H.toGraph) : + IsGraphConnected η.imageGraph := by + constructor + · obtain ⟨a, ha⟩ := hH.1 + exact ⟨η.vMap a, η.bijOn_v.mapsTo ha⟩ + · intro x hx y hy + obtain ⟨a, ha, rfl⟩ := η.bijOn_v.surjOn hx + obtain ⟨b, hb, rfl⟩ := η.bijOn_v.surjOn hy + obtain ⟨W⟩ := hH.2 a ha b hb + exact ⟨mapSpanWalk η W⟩ + +omit [T2Space S] in +/-- A span embedding maps a drawing path to an ambient graph path +whose vertex set is exactly the image of the path's vertex set. -/ +theorem exists_span_image_path {H P : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) {a b : S} (hP : P.IsSubdrawing H) + (hPath : P.IsPathBetween a b) : + ∃ R : Graph α β, GraphMinor.GM09.IsGraphPathWithEnds G R (η.vMap a) (η.vMap b) ∧ + V(R) = η.vMap '' P.V ∧ R ≤ η.imageGraph := by + obtain ⟨W, hW, hV, _⟩ := hPath + obtain ⟨W', hs, _⟩ := hP.exists_walk_up W + have hSimple : (mapSpanWalk η W').IsSimple := by + change (mapSpanWalk η W').support.Nodup + rw [mapSpanWalk_support] + apply List.Nodup.map_on + · intro x hx y hy heq + exact η.bijOn_v.injOn (W'.mem_vertexSet_of_mem_support hx) + (W'.mem_vertexSet_of_mem_support hy) heq + · rw [hs] + exact hW + let R := GraphMinor.GM09.walkSubgraph (mapSpanWalk η W') + have hR := GraphMinor.GM09.isGraphPathWithEnds_walkSubgraph hSimple + refine ⟨R, hR.mono η.imageGraph_le, ?_, hR.1⟩ + change V(GraphMinor.GM09.walkSubgraph (mapSpanWalk η W')) = η.vMap '' P.V + rw [GraphMinor.GM09.vertexSet_walkSubgraph, mapSpanWalk_support, hs, hV] + ext x + simp only [mem_ofPred_eq, List.mem_map, mem_image] + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SpanSurface.lean b/LeanPool/GraphMinor/GM16/SpanSurface.lean new file mode 100644 index 0000000000..7018928340 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SpanSurface.lean @@ -0,0 +1,41 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Defs + +/-! +# The surface of a span is closed + +A span is drawn in a surface with empty boundary. Every point is +therefore an interior point, so the surface is closed. This supplies +the surface condition when lifting the handle outcome in XVI (7.1). +-/ + +public section +namespace GraphMinor.GM16 +open Set GraphMinor.Surface GraphMinor.GM15 +universe u v w + +/-- The surface underlying a span is a closed surface. -/ +theorem span_isClosedSurface {S : Type w} [TopologicalSpace S] [T2Space S] + {α : Type u} {β : Type v} {G : Graph α β} {H : Drawing S} {η : GraphMinor.GM14.SpanEmbedding H + G} + {θ_star θ : ℕ} {T_star : Set (Hypergraph α β × Hypergraph α β)} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (h : IsSigmaSpan G H η θ_star θ T_star T) : IsClosedSurface S := by + classical + refine ⟨h.isSurface.1, h.isSurface.2.1, ?_⟩ + intro x + by_contra hx + have hb : x ∈ bd S := hx + rw [h.bd_empty] at hb + exact hb + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SpanTransport.lean b/LeanPool/GraphMinor/GM16/SpanTransport.lean new file mode 100644 index 0000000000..feb6123769 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SpanTransport.lean @@ -0,0 +1,471 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM12.Section3HomeoWalks +public import LeanPool.GraphMinor.GM11.Walks +public import LeanPool.GraphMinor.Surface.ModelCriterion + +/-! +# Spans under a homeomorphism + +A homeomorphism `ψ` from a surface `S` to a surface `Z` carries a `Σ`-span in `S` to a `Σ`-span of +the same order in `Z` (`IsSigmaSpan.transport`). The surface tower of `Section4.lean` has one +surface for each homeomorphism class, and this is how a span in any surface reaches the tower. + +We map drawings with `mapDrawingHomeo`, and hypergraphs on points and sets of points with `mapH`. +Then we go through the parts of a span in turn: separations, tangles, 2-cell drawings, respectful +tangles, rigid drawings and the control of `T` by `T*`. +-/ + +@[expose] public section + +namespace GraphMinor.GM16 + +open Set Function Topology +open Hypergraph +open GraphMinor.Surface GraphMinor.GM07 GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM12 + GraphMinor.GM14 GraphMinor.GM15 + +universe u v w + +variable {S Z : Type w} [TopologicalSpace S] [TopologicalSpace Z] + +/-- The image of a hypergraph on points and sets of points under a homeomorphism. -/ +def mapH (ψ : S ≃ₜ Z) (A : Hypergraph S (Set S)) : Hypergraph Z (Set Z) where + vertexSet := ψ '' A.vertexSet + edgeSet := image ψ '' A.edgeSet + Inc e v := A.Inc (ψ.symm '' e) (ψ.symm v) + vertex_mem_of_inc _ v h := ⟨ψ.symm v, A.vertex_mem_of_inc h, by simp⟩ + edge_mem_of_inc e _ h := ⟨ψ.symm '' e, A.edge_mem_of_inc h, by simp [image_image]⟩ + vertexSet_finite := A.vertexSet_finite.image _ + edgeSet_finite := A.edgeSet_finite.image _ + +theorem symm_image_image (ψ : S ≃ₜ Z) (e : Set S) : ψ.symm '' (ψ '' e) = e := by + simp [image_image] + +theorem image_symm_image (ψ : S ≃ₜ Z) (e : Set Z) : ψ '' (ψ.symm '' e) = e := by + simp [image_image] + +theorem mapH_symm (ψ : S ≃ₜ Z) (A : Hypergraph S (Set S)) : mapH ψ.symm (mapH ψ A) = A := by + apply Hypergraph.ext + · exact symm_image_image ψ _ + · change image ψ.symm '' (image ψ '' A.edgeSet) = A.edgeSet + rw [image_image] + simp [symm_image_image] + · funext e v + change A.Inc (ψ.symm '' (ψ '' e)) (ψ.symm (ψ v)) = A.Inc e v + rw [symm_image_image, ψ.symm_apply_apply] + +theorem mapH_symm' (ψ : S ≃ₜ Z) (A : Hypergraph Z (Set Z)) : mapH ψ (mapH ψ.symm A) = A := + mapH_symm ψ.symm A + +theorem mapH_union (ψ : S ≃ₜ Z) (A B : Hypergraph S (Set S)) : mapH ψ (A ∪ B) = mapH ψ A ∪ mapH ψ B + := by + apply Hypergraph.ext + · exact image_union _ _ _ + · exact image_union _ _ _ + · rfl + +theorem mapH_inter (ψ : S ≃ₜ Z) (A B : Hypergraph S (Set S)) : mapH ψ (A ∩ B) = mapH ψ A ∩ mapH ψ B + := by + apply Hypergraph.ext + · exact image_inter ψ.injective + · exact image_inter (image_injective.mpr ψ.injective) + · rfl + +theorem mapH_le (ψ : S ≃ₜ Z) {A B : Hypergraph S (Set S)} (h : A ≤ B) : mapH ψ A ≤ mapH ψ B := by + have h' : IsSubhypergraph A B := h + refine ⟨image_mono h'.vertexSet_subset, image_mono h'.edgeSet_subset, ?_⟩ + rintro _ ⟨e, he, rfl⟩ + ext v + have h1 := h'.ends_eq e he + change B.Inc (ψ.symm '' (ψ '' e)) (ψ.symm v) ↔ A.Inc (ψ.symm '' (ψ '' e)) (ψ.symm v) + rw [symm_image_image] + exact Set.ext_iff.mp h1 _ + +theorem isSeparation_mapH (ψ : S ≃ₜ Z) {G A B : Hypergraph S (Set S)} (h : G.IsSeparation A B) : + (mapH ψ G).IsSeparation (mapH ψ A) (mapH ψ B) := by + refine ⟨mapH_le ψ h.left_le, mapH_le ψ h.right_le, ?_, ?_⟩ + · rw [← mapH_union, h.union_eq] + · rw [← mapH_inter] + change image ψ '' (A ∩ B).edgeSet = ∅ + rw [h.edgeSet_inter_eq, image_empty] + +theorem separationOrder_mapH (ψ : S ≃ₜ Z) (A B : Hypergraph S (Set S)) : separationOrder (mapH ψ A) + (mapH ψ B) = separationOrder A B := by + rw [separationOrder, ← mapH_inter] + exact ncard_image_of_injective _ ψ.injective + +/-- The image of a set of separations under a homeomorphism. -/ +def mapT (ψ : S ≃ₜ Z) (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) : Set (Hypergraph Z + (Set Z) × Hypergraph Z (Set Z)) := + (fun p => (mapH ψ p.1, mapH ψ p.2)) '' T + +theorem mem_mapT (ψ : S ≃ₜ Z) {T : Set (Hypergraph S (Set S) × Hypergraph S + (Set S))} {A B : Hypergraph S (Set S)} : (mapH ψ A, mapH ψ B) ∈ mapT ψ T ↔ (A, B) ∈ T := by + constructor + · rintro ⟨⟨A', B'⟩, h, he⟩ + obtain ⟨h1, h2⟩ := Prod.ext_iff.mp he + have h3 : A' = A := by + have := congrArg (mapH ψ.symm) h1 + simpa [mapH_symm] using this + have h4 : B' = B := by + have := congrArg (mapH ψ.symm) h2 + simpa [mapH_symm] using this + rwa [← h3, ← h4] + · intro h + exact ⟨_, h, rfl⟩ + +theorem mem_mapT' (ψ : S ≃ₜ Z) {T : Set (Hypergraph S (Set S) × Hypergraph S + (Set S))} {A B : Hypergraph Z (Set Z)} : (A, B) ∈ mapT ψ T ↔ (mapH ψ.symm A, mapH ψ.symm B) ∈ T + := by + rw [← mem_mapT ψ, mapH_symm', mapH_symm'] + +theorem isTangle_mapT (ψ : S ≃ₜ Z) {G : Hypergraph S (Set S)} {θ : ℕ} {T : Set (Hypergraph S + (Set S) × Hypergraph S (Set S))} (h : IsTangle G θ T) : + IsTangle (mapH ψ G) θ (mapT ψ T) := by + refine ⟨h.one_le, ?_, ?_, ?_, ?_, ?_⟩ + · rintro _ _ ⟨⟨A, B⟩, hp, he⟩ + obtain ⟨rfl, rfl⟩ := Prod.ext_iff.mp he + exact isSeparation_mapH ψ (h.isSeparation hp) + · rintro _ _ ⟨⟨A, B⟩, hp, he⟩ + obtain ⟨rfl, rfl⟩ := Prod.ext_iff.mp he + change separationOrder (mapH ψ A) (mapH ψ B) < θ + rw [separationOrder_mapH] + exact h.order_lt hp + · intro A B hs ho + have h1 := isSeparation_mapH ψ.symm hs + rw [mapH_symm] at h1 + have h2 : separationOrder (mapH ψ.symm A) (mapH ψ.symm B) < θ := by + rw [separationOrder_mapH] + exact ho + rcases h.axiom1 h1 h2 with h3 | h3 + · exact .inl ((mem_mapT' ψ).mpr h3) + · exact .inr ((mem_mapT' ψ).mpr h3) + · rintro _ B₁ _ B₂ _ B₃ ⟨⟨A₁, C₁⟩, h1, he₁⟩ ⟨⟨A₂, C₂⟩, h2, he₂⟩ ⟨⟨A₃, C₃⟩, h3, he₃⟩ he + obtain ⟨rfl, -⟩ := Prod.ext_iff.mp he₁ + obtain ⟨rfl, -⟩ := Prod.ext_iff.mp he₂ + obtain ⟨rfl, -⟩ := Prod.ext_iff.mp he₃ + apply h.axiom2 h1 h2 h3 + have := congrArg (mapH ψ.symm) he + simp only at this + rw [← mapH_union, ← mapH_union, mapH_symm, mapH_symm] at this + exact this + · rintro _ _ ⟨⟨A, B⟩, hp, he⟩ hv + obtain ⟨rfl, -⟩ := Prod.ext_iff.mp he + exact h.axiom3 hp (ψ.injective.image_injective hv) + +/-! ## Drawings -/ + +theorem toHypergraph_map (ψ : S ≃ₜ Z) (H : Drawing S) : (mapDrawingHomeo ψ H).toHypergraph + = mapH ψ H.toHypergraph := by + apply Hypergraph.ext + · rfl + · exact mapDrawingHomeo_edges ψ H + · funext e v + apply propext + change (e ∈ (mapDrawingHomeo ψ H).E ∧ v ∈ ψ '' H.V ∧ v ∈ closure e) ↔ (ψ.symm '' e ∈ H.E + ∧ ψ.symm v ∈ H.V ∧ ψ.symm v ∈ closure (ψ.symm '' e)) + rw [mapDrawingHomeo_edges] + constructor + · rintro ⟨⟨e', he, rfl⟩, ⟨v', hv, rfl⟩, h⟩ + refine ⟨by rwa [symm_image_image], by simpa using hv, ?_⟩ + rw [← ψ.symm.image_closure] + exact ⟨_, h, rfl⟩ + · rintro ⟨h1, h2, h3⟩ + refine ⟨⟨_, h1, image_symm_image ψ e⟩, ⟨_, h2, by simp⟩, ?_⟩ + rw [← ψ.symm.image_closure] at h3 + obtain ⟨w, hw, he⟩ := h3 + rwa [ψ.symm.injective he] at hw + +theorem map_R (ψ : S ≃ₜ Z) (H : Drawing S) : (mapDrawingHomeo ψ H).R = image ψ '' H.R := by + change componentsIn (univ \ ψ '' H.U) = image ψ '' componentsIn (univ \ H.U) + have h1 : univ \ ψ '' H.U = ψ '' (univ \ H.U) := by + rw [image_sdiff ψ.injective, image_univ_of_surjective ψ.surjective] + rw [h1] + exact (image_componentsIn ψ _).symm + +theorem isOpenDisc_image (ψ : S ≃ₜ Z) {Λ : Set S} (h : IsOpenDisc Λ) : IsOpenDisc (ψ '' Λ) := by + obtain ⟨h1, ⟨φ⟩⟩ := h + exact ⟨ψ.isOpenMap _ h1, ⟨φ.trans (ψ.image Λ)⟩⟩ + +theorem isClosedDisc_image (ψ : S ≃ₜ Z) {Δ : Set S} (h : IsClosedDisc Δ) : IsClosedDisc (ψ '' Δ) + := by + obtain ⟨φ⟩ := h + exact ⟨φ.trans (ψ.image Δ)⟩ + +theorem isOArc_homeo_image (ψ : S ≃ₜ Z) {F : Set S} (h : IsOArc F) : IsOArc (ψ '' F) := by + obtain ⟨φ⟩ := h + exact ⟨φ.trans (ψ.image F)⟩ + +theorem subBd_image (ψ : S ≃ₜ Z) (Δ : Set S) : subBd (ψ '' Δ) = ψ '' subBd Δ := by + have h1 : univ \ ψ '' Δ = ψ '' (univ \ Δ) := by + rw [image_sdiff ψ.injective, image_univ_of_surjective ψ.surjective] + rw [subBd, subBd, h1, image_inter ψ.injective, ψ.image_closure, ψ.image_closure] + +theorem map_U (ψ : S ≃ₜ Z) (H : Drawing S) : (mapDrawingHomeo ψ H).U = ψ '' H.U := rfl + +theorem map_V (ψ : S ≃ₜ Z) (H : Drawing S) : (mapDrawingHomeo ψ H).V = ψ '' H.V := rfl + +theorem image_inter_symm (ψ : S ≃ₜ Z) (F : Set Z) (A : Set S) : ψ '' (ψ.symm '' F ∩ A) = F ∩ ψ '' A + := by + rw [image_inter ψ.injective, image_symm_image] + +theorem ncard_symm (ψ : S ≃ₜ Z) (F : Set Z) (A : Set S) : (F ∩ ψ '' A).ncard = + (ψ.symm '' F ∩ A).ncard := by + rw [← image_inter_symm] + exact ncard_image_of_injective _ ψ.injective + +theorem normal_symm (ψ : S ≃ₜ Z) {F : Set Z} {U V : Set S} (h : F ∩ ψ '' U ⊆ ψ '' V) : ψ.symm '' F + ∩ U ⊆ V := by + intro x hx + have h1 : ψ x ∈ ψ '' (ψ.symm '' F ∩ U) := ⟨x, hx, rfl⟩ + rw [image_inter_symm] at h1 + obtain ⟨y, hy, he⟩ := h h1 + exact ψ.injective he ▸ hy + +/-- A connected space stays connected under a homeomorphism. -/ +theorem connected_homeo (ψ : S ≃ₜ Z) (h : ConnectedSpace S) : ConnectedSpace Z := + ψ.surjective.connectedSpace ψ.continuous + +theorem isTwoCell_map (ψ : S ≃ₜ Z) {H : Drawing S} (h : (PaintingOrDrawing.drawing H).IsTwoCell) : + (PaintingOrDrawing.drawing (mapDrawingHomeo ψ H)).IsTwoCell := by + refine ⟨connected_homeo ψ h.1, ?_⟩ + intro r hr + have hr' : r ∈ (mapDrawingHomeo ψ H).R := hr + rw [map_R] at hr' + obtain ⟨r₀, h0, rfl⟩ := hr' + exact isOpenDisc_image ψ (h.2 r₀ h0) + +section inter + +variable [T1Space S] [T1Space Z] + +omit [T1Space S] [T1Space Z] in +theorem inter_map (ψ : S ≃ₜ Z) (H : Drawing S) (Δ : Set S) : + (PaintingOrDrawing.drawing (mapDrawingHomeo ψ H)).inter (ψ '' Δ) = mapH ψ + ((PaintingOrDrawing.drawing H).inter Δ) := by + apply Hypergraph.ext + · exact (image_inter ψ.injective).symm + · change {e | e ∈ (mapDrawingHomeo ψ H).E ∧ e ⊆ ψ '' Δ} = image ψ '' {e | e ∈ H.E ∧ e ⊆ Δ} + rw [mapDrawingHomeo_edges] + ext e + constructor + · rintro ⟨⟨e₀, h0, rfl⟩, h1⟩ + exact ⟨e₀, ⟨h0, (image_subset_image_iff ψ.injective).mp h1⟩, rfl⟩ + · rintro ⟨e₀, ⟨h0, h1⟩, rfl⟩ + exact ⟨⟨e₀, h0, rfl⟩, image_mono h1⟩ + · funext e v + apply propext + change ((mapDrawingHomeo ψ H).toHypergraph.Inc e v ∧ e ⊆ ψ '' Δ ∧ v ∈ ψ '' Δ) ↔ + (H.toHypergraph.Inc (ψ.symm '' e) (ψ.symm v) ∧ ψ.symm '' e ⊆ Δ ∧ ψ.symm v ∈ Δ) + rw [toHypergraph_map] + refine and_congr Iff.rfl (and_congr ?_ ?_) + · rw [← image_subset_image_iff ψ.injective, image_symm_image] + · constructor + · rintro ⟨w, hw, rfl⟩ + simpa using hw + · intro h + exact ⟨_, h, by simp⟩ + +omit [T1Space S] [T1Space Z] in +theorem closure_compl_image (ψ : S ≃ₜ Z) (Δ : Set S) : closure (univ \ ψ '' Δ) = ψ '' closure + (univ \ Δ) := by + rw [ψ.image_closure, image_sdiff ψ.injective, image_univ_of_surjective ψ.surjective] + +omit [T1Space S] [T1Space Z] in +theorem interOutside_map (ψ : S ≃ₜ Z) (H : Drawing S) (Δ : Set S) : + (PaintingOrDrawing.drawing (mapDrawingHomeo ψ H)).interOutside (ψ '' Δ) = mapH ψ + ((PaintingOrDrawing.drawing H).interOutside Δ) := by + rw [PaintingOrDrawing.interOutside, PaintingOrDrawing.interOutside, closure_compl_image, + inter_map] + +omit [T1Space S] [T1Space Z] in +theorem isRespectful_map (ψ : S ≃ₜ Z) {H : Drawing S} {θ : ℕ} {T : Set (Hypergraph S + (Set S) × Hypergraph S (Set S))} + (h : (PaintingOrDrawing.drawing H).IsRespectful θ T) : (PaintingOrDrawing.drawing + (mapDrawingHomeo ψ H)).IsRespectful θ (mapT ψ T) := by + refine ⟨connected_homeo ψ h.1, fun F hF hN hc => ?_⟩ + have hN' : ψ.symm '' F ∩ H.U ⊆ H.V := normal_symm ψ hN + have hc' : (ψ.symm '' F ∩ H.V).ncard < θ := by + rw [← ncard_symm] + exact hc + obtain ⟨Δ, hΔ, hb, hm⟩ := h.2 (ψ.symm '' F) (isOArc_homeo_image ψ.symm hF) hN' hc' + refine ⟨ψ '' Δ, isClosedDisc_image ψ hΔ, ?_, ?_⟩ + · rw [subBd_image, hb, image_symm_image] + · rw [inter_map, interOutside_map] + exact (mem_mapT ψ).mpr hm + +/-- The path inside a closed set of a drawing maps to the corresponding path of the image. -/ +theorem interSet_map (ψ : S ≃ₜ Z) (H : Drawing S) (Δ : Set S) : + (mapDrawingHomeo ψ H).interSet (ψ '' Δ) = mapDrawingHomeo ψ (H.interSet Δ) := by + have hE : {e | e ∈ (mapDrawingHomeo ψ H).E ∧ e ⊆ ψ '' Δ} = image ψ '' {e | e ∈ H.E ∧ e ⊆ Δ} := by + rw [mapDrawingHomeo_edges] + ext e + constructor + · rintro ⟨⟨e₀, h0, rfl⟩, h1⟩ + exact ⟨e₀, ⟨h0, (image_subset_image_iff ψ.injective).mp h1⟩, rfl⟩ + · rintro ⟨e₀, ⟨h0, h1⟩, rfl⟩ + exact ⟨⟨e₀, h0, rfl⟩, image_mono h1⟩ + apply Drawing.ext_of_V_E + · change (mapDrawingHomeo ψ H).spanV ((mapDrawingHomeo ψ H).V ∩ ψ '' Δ) {e | e ∈ + (mapDrawingHomeo ψ H).E ∧ e ⊆ ψ '' Δ} = ψ '' H.spanV (H.V ∩ Δ) {e | e ∈ H.E ∧ e ⊆ Δ} + rw [hE] + ext z + constructor + · rintro (⟨⟨⟨v, hv, rfl⟩, ⟨w, hw, he⟩⟩, -⟩ | h) + · exact ⟨v, .inl ⟨⟨hv, ψ.injective he ▸ hw⟩, hv⟩, rfl⟩ + · obtain ⟨e, ⟨⟨e₀, h0, rfl⟩, -⟩, hz⟩ := mem_iUnion₂.mp h + rw [← ψ.image_closure, map_V, ← image_inter ψ.injective] at hz + obtain ⟨y, hy, rfl⟩ := hz + exact ⟨y, .inr (mem_iUnion₂.mpr ⟨e₀, ⟨h0, h0.1⟩, hy⟩), rfl⟩ + · rintro ⟨y, (⟨⟨h1, h2⟩, -⟩ | h), rfl⟩ + · exact .inl ⟨⟨⟨y, h1, rfl⟩, ⟨y, h2, rfl⟩⟩, ⟨y, h1, rfl⟩⟩ + · obtain ⟨e, ⟨h0, -⟩, hz⟩ := mem_iUnion₂.mp h + refine .inr (mem_iUnion₂.mpr ⟨ψ '' e, ⟨⟨e, h0, rfl⟩, ?_⟩, ?_⟩) + · rw [mapDrawingHomeo_edges] + exact ⟨e, h0.1, rfl⟩ + · rw [← ψ.image_closure, map_V, ← image_inter ψ.injective] + exact ⟨y, hz, rfl⟩ + · change ((mapDrawingHomeo ψ H).span _ _).E = (mapDrawingHomeo ψ (H.span _ _)).E + rw [Drawing.span_E, hE, mapDrawingHomeo_edges ψ (H.span _ _), Drawing.span_E, + mapDrawingHomeo_edges ψ H, image_inter (image_injective.mpr ψ.injective)] + +end inter + +/-- A walk maps to a walk of the image drawing, with the images of its vertices and its edges. -/ +theorem exists_walk_map (ψ : S ≃ₜ Z) (H : Drawing S) {x y : S} (W : GraphWalk H.toGraph x y) : + ∃ W' : GraphWalk (mapDrawingHomeo ψ H).toGraph (ψ x) (ψ y), W'.support = W.support.map ψ + ∧ W'.edges = W.edges.map (image ψ) := by + induction W with + | nil hx => exact ⟨.nil ⟨_, hx, rfl⟩, rfl, rfl⟩ + | cons hl rest ih => + obtain ⟨R, h1, h2⟩ := ih + exact ⟨.cons (isLink_mapDrawingHomeo ψ H hl) R, congrArg (List.cons _) h1, + congrArg (List.cons _) h2⟩ + +theorem isPathBetween_map (ψ : S ≃ₜ Z) {H : Drawing S} {a b : S} (h : H.IsPathBetween a b) : + (mapDrawingHomeo ψ H).IsPathBetween (ψ a) (ψ b) := by + obtain ⟨W, h1, h2, h3⟩ := h + obtain ⟨W', h4, h5⟩ := exists_walk_map ψ H W + refine ⟨W', ?_, ?_, ?_⟩ + · change W'.support.Nodup + rw [h4] + exact h1.map ψ.injective + · change ψ '' H.V = _ + rw [h2] + ext z + simp [h4] + · rw [mapDrawingHomeo_edges, h3] + ext z + simp [h5] + +theorem isRigid_map [T1Space S] [T1Space Z] (ψ : S ≃ₜ Z) {H : Drawing S} (h : IsRigid H) : IsRigid + (mapDrawingHomeo ψ H) := by + intro F hF hN hc + have hN' : ψ.symm '' F ∩ H.U ⊆ H.V := normal_symm ψ hN + have hc' : (ψ.symm '' F ∩ H.V).ncard ≤ 2 := by + rw [← ncard_symm] + exact hc + obtain ⟨Δ, hΔ, hb, hd⟩ := h (ψ.symm '' F) (isOArc_homeo_image ψ.symm hF) hN' hc' + refine ⟨ψ '' Δ, isClosedDisc_image ψ hΔ, by rw [subBd_image, hb, image_symm_image], ?_⟩ + rcases hd with hd | ⟨u, v, huv, h1, h2⟩ + · left + have h3 : ψ '' (Δ ∩ H.U) ⊆ F := by + refine (image_mono hd).trans ?_ + rw [image_symm_image] + rwa [image_inter ψ.injective] at h3 + · right + refine ⟨ψ u, ψ v, fun he => huv (ψ.injective he), ?_, ?_⟩ + · have h3 : ψ '' (ψ.symm '' F ∩ H.V) = {ψ u, ψ v} := by + rw [h1, image_pair] + rwa [image_inter_symm] at h3 + · rw [interSet_map] + exact isPathBetween_map ψ h2 + +/-- A span embedding of a drawing gives one of its image. -/ +def SpanEmbedding.mapHomeo {α : Type u} {β : Type v} {G : Graph α β} (ψ : S ≃ₜ Z) {H : Drawing S} + (η : SpanEmbedding H G) : SpanEmbedding (mapDrawingHomeo ψ H) G where + imageGraph := η.imageGraph + vMap := η.vMap ∘ ψ.symm + eMap := η.eMap ∘ image ψ.symm + imageGraph_le := η.imageGraph_le + bijOn_v := by + refine ⟨?_, ?_, ?_⟩ + · rintro _ ⟨v, hv, rfl⟩ + simpa using η.bijOn_v.mapsTo hv + · rintro _ ⟨v, hv, rfl⟩ _ ⟨w, hw, rfl⟩ he + simp only [comp_apply, ψ.symm_apply_apply] at he + rw [η.bijOn_v.injOn hv hw he] + · intro x hx + obtain ⟨v, hv, rfl⟩ := η.bijOn_v.surjOn hx + exact ⟨ψ v, ⟨v, hv, rfl⟩, by simp⟩ + bijOn_e := by + rw [mapDrawingHomeo_edges] + refine ⟨?_, ?_, ?_⟩ + · rintro _ ⟨e, he, rfl⟩ + simp only [comp_apply, symm_image_image] + exact η.bijOn_e.mapsTo he + · rintro _ ⟨e, he, rfl⟩ _ ⟨f, hf, rfl⟩ h + simp only [comp_apply, symm_image_image] at h + rw [η.bijOn_e.injOn he hf h] + · intro x hx + obtain ⟨e, he, rfl⟩ := η.bijOn_e.surjOn hx + exact ⟨ψ '' e, ⟨e, he, rfl⟩, by simp only [comp_apply, symm_image_image]⟩ + inc_iff := by + intro e he v hv + rw [mapDrawingHomeo_edges] at he + obtain ⟨e, he, rfl⟩ := he + obtain ⟨v, hv, rfl⟩ := hv + simp only [comp_apply, symm_image_image, ψ.symm_apply_apply] + rw [η.inc_iff e he v hv, ← ψ.image_closure] + exact ⟨fun h => ⟨v, h, rfl⟩, fun ⟨w, hw, h⟩ => ψ.injective h ▸ hw⟩ + +/-- A homeomorphism carries a span to a span of the same order. -/ +theorem IsSigmaSpan.transport [T2Space S] [T2Space Z] {α : Type u} {β : Type v} + (ψ : S ≃ₜ Z) {G : Graph α β} {H : Drawing S} {η : SpanEmbedding H G} {θ_star θ : ℕ} + {T_star : Set (Hypergraph α β × Hypergraph α β)} {T : Set (Hypergraph S (Set S) × Hypergraph S + (Set S))} (h : IsSigmaSpan G H η θ_star θ T_star T) : + IsSigmaSpan G (mapDrawingHomeo ψ H) (SpanEmbedding.mapHomeo ψ η) θ_star θ T_star (mapT ψ T) + := by + have hT : IsTangle (mapDrawingHomeo ψ H).toHypergraph θ (mapT ψ T) := by + rw [toHypergraph_map] + exact isTangle_mapT ψ h.isControlling.isTangle_H + refine ⟨?_, connected_homeo ψ h.isConnected, ?_, isRigid_map ψ h.isRigid, + ⟨isTwoCell_map ψ h.isRespectful.1, hT, isRespectful_map ψ h.isRespectful.2.2⟩, ?_⟩ + · have hS := h.isSurface + have : CompactSpace S := hS.1 + refine ⟨ψ.surjective.compactSpace ψ.continuous, inferInstance, fun x => ?_⟩ + simpa using isManifoldPoint_of_isOpenEmbedding ψ.isOpenEmbedding (hS.2.2 (ψ.symm x)) + · rw [← image_bd_homeomorph ψ, h.bd_empty, image_empty] + · refine ⟨h.isControlling.theta_le, h.isControlling.isTangle_star, hT, ?_⟩ + intro A B hs ho A_H B_H hr + obtain ⟨h1, h2, h3, h4, h5⟩ := hr + have h6 : H.toHypergraph.IsSeparation (mapH ψ.symm A_H) (mapH ψ.symm B_H) := by + have h7 := isSeparation_mapH ψ.symm h1 + rwa [toHypergraph_map, mapH_symm] at h7 + have hr' : IsRestrictedSeparation H G η A B (mapH ψ.symm A_H) (mapH ψ.symm B_H) := by + refine ⟨h6, ?_, ?_, ?_, ?_⟩ + · refine Eq.trans ?_ h2 + change η.vMap '' (ψ.symm '' _) = (η.vMap ∘ ψ.symm) '' _ + rw [image_comp] + · refine Eq.trans ?_ h3 + change η.eMap '' (image ψ.symm '' _) = (η.eMap ∘ image ψ.symm) '' _ + rw [image_comp] + · refine Eq.trans ?_ h4 + change η.vMap '' (ψ.symm '' _) = (η.vMap ∘ ψ.symm) '' _ + rw [image_comp] + · refine Eq.trans ?_ h5 + change η.eMap '' (image ψ.symm '' _) = (η.eMap ∘ image ψ.symm) '' _ + rw [image_comp] + rw [h.isControlling.controls hs ho hr', mem_mapT'] + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SpanVertexPullback.lean b/LeanPool/GraphMinor/GM16/SpanVertexPullback.lean new file mode 100644 index 0000000000..0023baf8fe --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SpanVertexPullback.lean @@ -0,0 +1,45 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import Mathlib.Data.Set.Card + +/-! +# Pulling a finite vertex set back through a span + +Restrict the preimage to the drawing vertices, where the span map is +injective. Its cardinality is at most that of the original finite +set. Thus the ambient separator in XVI (8.1) is still smaller than +`κ` when applying the drawn-path arguments of Claims (11)–(14). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM14 +universe u v w +variable {S : Type w} [TopologicalSpace S] {α : Type u} {β : Type v} + +/-- Pulling back an ambient finite set to the drawing vertices cannot +increase its cardinality. -/ +theorem span_vertex_pullback_card {H : Drawing S} {G : Graph α β} + (η : SpanEmbedding H G) {Z : Set α} (hZ : Z.Finite) : + (H.V ∩ η.vMap ⁻¹' Z).Finite ∧ (H.V ∩ η.vMap ⁻¹' Z).ncard ≤ Z.ncard := by + have hA : (H.V ∩ η.vMap ⁻¹' Z).Finite := H.finite_V.subset inter_subset_left + refine ⟨hA, ?_⟩ + have hi : InjOn η.vMap (H.V ∩ η.vMap ⁻¹' Z) := η.bijOn_v.injOn.mono inter_subset_left + have hIm : η.vMap '' (H.V ∩ η.vMap ⁻¹' Z) ⊆ Z := by + rintro x ⟨y, hy, rfl⟩ + exact hy.2 + calc + (H.V ∩ η.vMap ⁻¹' Z).ncard = (η.vMap '' (H.V ∩ η.vMap ⁻¹' Z)).ncard := + hi.ncard_image.symm + _ ≤ Z.ncard := ncard_le_ncard hIm hZ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SphereComplementDisc.lean b/LeanPool/GraphMinor/GM16/SphereComplementDisc.lean new file mode 100644 index 0000000000..cba6fa62a4 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SphereComplementDisc.lean @@ -0,0 +1,64 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import LeanPool.GraphMinor.Surface.TopologyStatements +import LeanPool.GraphMinor.Surface.SphereDisc +import LeanPool.GraphMinor.Surface.DiscsInSurface +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# The other disc bounded by a circle in a sphere + +The sphere disc theorem supplies two complementary discs with a +given boundary. Its uniqueness clause identifies a given disc as +one of them. The other is the closure of its complement. This +constructs the closed outer face from the disc enclosed by the +wall in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- In a sphere, the closure of a disc's complement is the other disc +with the same boundary. -/ +theorem isClosedDisc_closure_compl_of_isSphere {S : Type*} + [TopologicalSpace S] [T2Space S] (hS : IsSphere S) + {D : Set S} (hD : IsClosedDisc D) : + IsClosedDisc (closure Dᶜ) ∧ discBd (closure Dᶜ) = discBd D ∧ + D ∪ closure Dᶜ = univ ∧ D ∩ closure Dᶜ = discBd D := by + obtain ⟨D₁,D₂,_,h₁,h₂,hb₁,hb₂,hCup,hCap,_,hall⟩ := + sphere_disc S hS (discBd D) hD.isOArc_discBd + have other {A B : Set S} (hB : IsClosedDisc B) (hb : discBd B = discBd D) + (hu : A ∪ B = univ) (hi : A ∩ B = discBd D) : closure Aᶜ = B := by + apply subset_antisymm + · apply closure_minimal _ hB.isCompact.isClosed + intro x hx + exact (hu.ge (mem_univ x)).resolve_left hx + · apply hB.subset_closure_discInt.trans + apply closure_mono + intro x hx hxA + apply hx.2 + rw [hb,← hi] + exact ⟨hxA,hx.1⟩ + rcases hall D hD rfl with he | he + · subst D₁ + have hOther := other h₂ hb₂ hCup hCap + rw [hOther] + exact ⟨h₂,hb₂,hCup,hCap⟩ + · subst D₂ + have hCup' : D ∪ D₁ = univ := by rw [union_comm,hCup] + have hCap' : D ∩ D₁ = discBd D := by rw [inter_comm,hCap] + have hOther := other h₁ hb₁ hCup' hCap' + rw [hOther] + exact ⟨h₁,hb₁,hCup',hCap'⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SpherePlaneEmbedding.lean b/LeanPool/GraphMinor/GM16/SpherePlaneEmbedding.lean new file mode 100644 index 0000000000..0a800248b6 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SpherePlaneEmbedding.lean @@ -0,0 +1,45 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.TopologyStatements +import LeanPool.GraphMinor.Surface.Jordan +import Mathlib.Analysis.Complex.Basic + +/-! +# A coordinate plane in the sphere + +Use the sphere's defining homeomorphism with the one-point +compactification of the Euclidean plane. The inclusion of the plane +is an open embedding. Real coordinate pairs identify with that plane, +so the finite wall drawing of XVI (4.2) can be placed in any sphere. +-/ + +public section +namespace GraphMinor.GM16 +open Topology GraphMinor.Surface +universe u + +/-- Every sphere contains an embedded copy of the real coordinate +plane, as used for the drawing in XVI (4.2), page 53. -/ +theorem exists_plane_openEmbedding_of_isSphere {S : Type u} [TopologicalSpace S] + (hS : IsSphere S) : ∃ f : (ℝ × ℝ) → S, IsOpenEmbedding f := by + obtain ⟨h⟩ := hS + let e : (ℝ × ℝ) ≃ₜ EuclideanPlane := + Complex.equivRealProdCLM.toHomeomorph.symm.trans complexPlane.toHomeomorph + let f : (ℝ × ℝ) → S := fun x => h.symm ((e x : EuclideanPlane) : OnePoint EuclideanPlane) + exact ⟨f,h.symm.isOpenEmbedding.comp (OnePoint.isOpenEmbedding_coe.comp e.isOpenEmbedding)⟩ + +/-- Every sphere contains an embedded coordinate plane. -/ +theorem exists_plane_embedding_of_isSphere {S : Type u} [TopologicalSpace S] + (hS : IsSphere S) : ∃ f : (ℝ × ℝ) → S, IsEmbedding f := by + obtain ⟨f,hf⟩ := exists_plane_openEmbedding_of_isSphere hS + exact ⟨f,hf.isEmbedding⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SphereRespectful.lean b/LeanPool/GraphMinor/GM16/SphereRespectful.lean new file mode 100644 index 0000000000..96c7cf05d5 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SphereRespectful.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.Surface.TopologyStatements +import LeanPool.GraphMinor.GM11.Theorem61 +import LeanPool.GraphMinor.Surface.Schoenflies + +/-! +# Tangles in sphere drawings are respectful + +An `O`-arc in a sphere bounds two complementary closed discs. +If it meets a drawing only at fewer than `θ` vertices, those discs +give a separation of order less than `θ`. The first tangle axiom +chooses one side. This proves the respectfulness used for the sphere +span at the end of XVI (4.2), page 54. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Hypergraph GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 +universe u + +/-- The respectfulness step at the end of XVI (4.2), page 54: +every tangle in a drawing in a sphere is respectful. -/ +theorem drawing_tangle_isRespectful_of_isSphere + {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsClosedSurface S) (hSphere : IsSphere S) (D : Drawing S) {θ : ℕ} + {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (hT : IsTangle D.toHypergraph θ T) : + (PaintingOrDrawing.drawing D).IsRespectful θ T := by + let Γ := PaintingOrDrawing.drawing D + refine ⟨inferInstance,fun F hF hN hk => ?_⟩ + have hSepDisc (Δ : Set S) (hΔ : IsClosedDisc Δ) (hb : discBd Δ = F) : + Γ.toHypergraph.IsSeparation (Γ.inter Δ) (Γ.interOutside Δ) ∧ + separationOrder (Γ.inter Δ) (Γ.interOutside Δ) < θ := by + have hFr : frontier Δ = F := by rw [IsClosedDisc.frontier_eq_discBd hS hΔ,hb] + refine ⟨isSeparation_inter (IsClosedDisc.isCompact hΔ).isClosed (by rw [hFr]; exact hN),?_⟩ + refine (ncard_le_ncard (fun x hx => ?_) (D.finite_V.subset inter_subset_right)).trans_lt hk + rw [← hFr] + exact inter_outside_subset hx + have hBd (Δ : Set S) (hΔ : IsClosedDisc Δ) : subBd Δ = discBd Δ := by + rw [subBd_eq_frontier,IsClosedDisc.frontier_eq_discBd hS hΔ] + obtain ⟨Δ₁,Δ₂,_,hΔ₁,hΔ₂,hb₁,hb₂,hCup,hCap,_,_⟩ := sphere_disc S hSphere F hF + have outside {Δ Δ' : Set S} (h : IsClosedDisc Δ) (h' : IsClosedDisc Δ') + (hb' : discBd Δ' = F) (hUnion : Δ ∪ Δ' = univ) (hInter : Δ ∩ Δ' = F) : + closure (univ \ Δ) = Δ' := by + apply Subset.antisymm + · exact closure_minimal (fun x hx => (hUnion.ge (mem_univ x)).resolve_left hx.2) + (IsClosedDisc.isCompact h').isClosed + · refine (IsClosedDisc.subset_closure_discInt h').trans (closure_mono ?_) + intro x hx + refine ⟨mem_univ x,fun hxΔ => hx.2 ?_⟩ + rw [hb',← hInter] + exact ⟨hxΔ,hx.1⟩ + have h₁₂ := outside hΔ₁ hΔ₂ hb₂ hCup hCap + have h₂₁ := outside hΔ₂ hΔ₁ hb₁ (by rw [Set.union_comm,hCup]) (by rw [Set.inter_comm,hCap]) + obtain ⟨hSep,hOrd⟩ := hSepDisc Δ₁ hΔ₁ hb₁ + rcases hT.axiom1 hSep hOrd with hm | hm + · exact ⟨Δ₁,hΔ₁,(hBd _ hΔ₁).trans hb₁,hm⟩ + · refine ⟨Δ₂,hΔ₂,(hBd _ hΔ₂).trans hb₂,?_⟩ + have hOut₁ : Γ.interOutside Δ₁ = Γ.inter Δ₂ := by rw [PaintingOrDrawing.interOutside,h₁₂] + have hOut₂ : Γ.interOutside Δ₂ = Γ.inter Δ₁ := by rw [PaintingOrDrawing.interOutside,h₂₁] + rw [hOut₂] + rwa [hOut₁] at hm + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SubcubicArmIntersections.lean b/LeanPool/GraphMinor/GM16/SubcubicArmIntersections.lean new file mode 100644 index 0000000000..cb577a682e --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SubcubicArmIntersections.lean @@ -0,0 +1,54 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.ModelBranchCentres + +/-! +# Intersections between arms for distinct minor edges + +In XVI (4.2), page 54, arms in different branch sets are disjoint. +Two arms in the same branch set come from different neighbours when +the model edges differ. They therefore meet only at the branch centre. +This proves that the paths replacing different minor edges can meet +only at branch centres. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph +universe u v w + +/-- Arms belonging to different source edges can meet only at a branch +centre. This is the intersection check in XVI (4.2)'s subdivision step. -/ +theorem arm_intersection_subset_centres + {α : Type u} {β : Type v} {ν : Type w} + {H : SimpleGraph ν} {G : Graph α β} {ηv : ν → Set α} {ηe : Sym2 ν → β} + (h : IsMinorModel (Graph.ofSimpleGraph H) G ηv ηe) + (c : ν → α) (arm : ∀ v, H.neighborSet v → Graph α β) + (hSub : ∀ v i, V(arm v i) ⊆ ηv v) + (hInter : ∀ v i j, i ≠ j → V(arm v i) ∩ V(arm v j) = {c v}) + {a b d e : ν} (hab : H.Adj a b) (hde : H.Adj d e) + (hNe : s(a, b) ≠ s(d, e)) : + V(arm a ⟨b,hab⟩) ∩ V(arm d ⟨e,hde⟩) ⊆ range c := by + intro x hx + by_cases had : a = d + · subst d + have hbe : b ≠ e := fun heq => hNe (heq ▸ rfl) + have hIdx : (⟨b,hab⟩ : H.neighborSet a) ≠ ⟨e,hde⟩ := + fun heq => hbe (congrArg Subtype.val heq) + have hxc : x = c a := by + have hx' := hx + rw [hInter a _ _ hIdx] at hx' + exact hx' + exact ⟨a, hxc.symm⟩ + · have hd := h.vertex_disjoint a (mem_univ _) d (mem_univ _) had + exact ((disjoint_left.mp hd) (hSub a _ hx.1) (hSub d _ hx.2)).elim + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SubcubicEdgePaths.lean b/LeanPool/GraphMinor/GM16/SubcubicEdgePaths.lean new file mode 100644 index 0000000000..7a61d10164 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SubcubicEdgePaths.lean @@ -0,0 +1,148 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.ModelBranchCentres +public import LeanPool.GraphMinor.GM16.TwoBranchArmsPath +public import LeanPool.GraphMinor.GM16.GraphPathSystemUnion +import LeanPool.GraphMinor.GM16.BranchArmsInPathSystem +import LeanPool.GraphMinor.GM16.ModelFromBranchArms +import LeanPool.GraphMinor.GM16.SubcubicArmIntersections +import LeanPool.GraphMinor.GM09.Basic + +/-! +# The edge paths of a subcubic minor + +Construct a branch centre and arms at every vertex. For each source +edge, join the two corresponding arms through its chosen model edge. +The resulting path has exactly the vertices of those two arms. Paths +for different source edges meet only at branch centres. This proves +the path-system part of the subdivision assertion in XVI (4.2), page 54. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph Function GraphMinor.Surface GraphMinor.GM09 +universe u v w + +/-- Construct the paths replacing all edges of a finite simple +subcubic minor in XVI (4.2), page 54. -/ +theorem exists_subcubic_edge_paths_with_minor {α : Type u} {β : Type v} {ν : Type w} [Finite ν] + {H : SimpleGraph ν} {G : Graph α β} {ηv : ν → Set α} {ηe : Sym2 ν → β} + (h : IsMinorModel (Graph.ofSimpleGraph H) G ηv ηe) + (hDeg : ∀ v, (H.neighborSet v).ncard ≤ 3) : + ∃ (c : ν → α) (P : H.edgeSet → Graph α β), + Injective c ∧ (∀ v, c v ∈ ηv v) ∧ + (∀ e : H.edgeSet, ∃ a b, e.val = s(a,b) ∧ H.Adj a b ∧ + IsGraphPathWithEnds G (P e) (c a) (c b) ∧ ηe e.val ∈ E(P e) ∧ + V(P e) ∩ range c = {c a,c b}) ∧ + (∀ e f : H.edgeSet, e ≠ f → V(P e) ∩ V(P f) ⊆ range c) ∧ + ∃ ηv' : ν → Set α, IsMinorModel (Graph.ofSimpleGraph H) + (pathSystemGraph G (range c) P) ηv' ηe := by + classical + obtain ⟨c, attach, arm, hcInj, hc, hAttach, hPath, hSub, hInter⟩ := exists_model_branch_centres h + hDeg + have hEnds (e : H.edgeSet) : ∃ a b, e.val = s(a,b) ∧ H.Adj a b := by + obtain ⟨a, b, heq, he⟩ := (Graph.ofSimpleGraph H).exists_isLink_of_mem_edgeSet e.property + exact ⟨a, b, heq, by rw [heq] at he; exact he⟩ + choose a b hEq hAdj using hEnds + have hPaths (e : H.edgeSet) : ∃ Q : Graph α β, + IsGraphPathWithEnds G Q (c (a e)) (c (b e)) ∧ + V(Q) = V(arm (a e) ⟨b e,hAdj e⟩) ∪ V(arm (b e) ⟨a e,(hAdj e).symm⟩) ∧ + E(Q) = (E(arm (a e) ⟨b e,hAdj e⟩) ∪ {ηe e.val}) ∪ + E(arm (b e) ⟨a e,(hAdj e).symm⟩) := by + have hDisj : Disjoint V(arm (a e) ⟨b e,hAdj e⟩) V(arm (b e) ⟨a e,(hAdj e).symm⟩) := + (h.vertex_disjoint _ (mem_univ _) _ (mem_univ _) (hAdj e).ne).mono + (hSub _ _).1 (hSub _ _).1 + have hi := (hAttach (b e) ⟨a e,(hAdj e).symm⟩).2 + have hswap : s(b e,a e) = s(a e,b e) := Sym2.eq_swap + rw [hswap] at hi + have hLink := model_edge_between_branch_points h (hAdj e) + (hAttach (a e) ⟨b e,hAdj e⟩).1 (hAttach (b e) ⟨a e,(hAdj e).symm⟩).1 + (hAttach (a e) ⟨b e,hAdj e⟩).2 hi + rw [← hEq e] at hLink + exact exists_path_between_branch_arms (hPath _ _) (hPath _ _) hDisj hLink + choose P hP hVP hEP using hPaths + have hAtBranch (e : H.edgeSet) (x : α) (hx : x ∈ V(P e)) : + x ∈ ηv (a e) ∪ ηv (b e) := by + rw [hVP e] at hx + exact hx.elim (fun h => Or.inl ((hSub _ _).1 h)) (fun h => Or.inr ((hSub _ _).1 h)) + have hRange (e : H.edgeSet) : V(P e) ∩ range c = {c (a e),c (b e)} := by + apply Subset.antisymm + · rintro x ⟨hxP, z, rfl⟩ + rcases hAtBranch e (c z) hxP with hx | hx + · by_cases hza : z = a e + · exact hza ▸ mem_insert _ _ + · exact ((disjoint_left.mp (h.vertex_disjoint z (mem_univ _) (a e) (mem_univ _) hza)) + (hc z) hx).elim + · by_cases hzb : z = b e + · exact hzb ▸ mem_insert_of_mem _ (mem_singleton _) + · exact ((disjoint_left.mp (h.vertex_disjoint z (mem_univ _) (b e) (mem_univ _) hzb)) + (hc z) hx).elim + · intro x hx + rcases hx with rfl | hx + · exact ⟨(hP e).left_mem, mem_range_self _⟩ + · rw [mem_singleton_iff] at hx + subst x + exact ⟨(hP e).right_mem, mem_range_self _⟩ + have hPG : ∀ e, P e ≤ G := fun e => (hP e).le + have hCG : range c ⊆ V(G) := by + rintro x ⟨v,rfl⟩ + exact h.vertex_subset v (mem_univ _) (hc v) + have hNG := pathSystemGraph_le hCG hPG + have hcN (v : ν) : c v ∈ V(pathSystemGraph G (range c) P) := Or.inl (mem_range_self v) + obtain ⟨hArmN,hChosenN⟩ := branch_arms_le_pathSystemGraph (range c) arm P a b ηe hEq hAdj + (fun v i => (hPath v i).le) hPG hVP hEP + have hModelN := minorModel_from_branch_arms h hNG c attach arm hc hcN + (fun v i => (hAttach v i).2) hPath hArmN + (fun v i => (hSub v i).1) (fun v i => (hSub v i).2) hChosenN + refine ⟨c, P, hcInj, hc, ?_, ?_,_,hModelN⟩ + · intro e + refine ⟨a e, b e, hEq e, hAdj e, hP e, ?_, hRange e⟩ + rw [hEP e] + exact Or.inl (Or.inr (mem_singleton _)) + · intro e f hne x hx + have hEdgeNe : e.val ≠ f.val := fun heq => hne (Subtype.ext heq) + have h1 : s(a e,b e) ≠ s(a f,b f) := fun heq => hEdgeNe ((hEq e).trans (heq.trans (hEq f).symm)) + have h2 : s(a e,b e) ≠ s(b f,a f) := by + rw [Sym2.eq_swap (a := b f) (b := a f)] + exact h1 + have h3 : s(b e,a e) ≠ s(a f,b f) := by + rw [Sym2.eq_swap (a := b e) (b := a e)] + exact h1 + have h4 : s(b e,a e) ≠ s(b f,a f) := by + rw [Sym2.eq_swap (a := b e) (b := a e)] + exact h2 + rw [hVP e] at hx + rw [hVP f] at hx + rcases hx with ⟨hx₁ | hx₁, hx₂ | hx₂⟩ + · exact arm_intersection_subset_centres h c arm (fun v i => (hSub v i).1) hInter + (hAdj e) (hAdj f) h1 ⟨hx₁,hx₂⟩ + · exact arm_intersection_subset_centres h c arm (fun v i => (hSub v i).1) hInter + (hAdj e) (hAdj f).symm h2 ⟨hx₁,hx₂⟩ + · exact arm_intersection_subset_centres h c arm (fun v i => (hSub v i).1) hInter + (hAdj e).symm (hAdj f) h3 ⟨hx₁,hx₂⟩ + · exact arm_intersection_subset_centres h c arm (fun v i => (hSub v i).1) hInter + (hAdj e).symm (hAdj f).symm h4 ⟨hx₁,hx₂⟩ + +/-- The replacing-path part of the subcubic subdivision construction. -/ +theorem exists_subcubic_edge_paths {α : Type u} {β : Type v} {ν : Type w} [Finite ν] + {H : SimpleGraph ν} {G : Graph α β} {ηv : ν → Set α} {ηe : Sym2 ν → β} + (h : IsMinorModel (Graph.ofSimpleGraph H) G ηv ηe) + (hDeg : ∀ v, (H.neighborSet v).ncard ≤ 3) : + ∃ (c : ν → α) (P : H.edgeSet → Graph α β), + Injective c ∧ (∀ v, c v ∈ ηv v) ∧ + (∀ e : H.edgeSet, ∃ a b, e.val = s(a,b) ∧ H.Adj a b ∧ + IsGraphPathWithEnds G (P e) (c a) (c b) ∧ ηe e.val ∈ E(P e) ∧ + V(P e) ∩ range c = {c a,c b}) ∧ + (∀ e f : H.edgeSet, e ≠ f → V(P e) ∩ V(P f) ⊆ range c) := by + obtain ⟨c,P,hcInj,hc,hPaths,hInter,_⟩ := exists_subcubic_edge_paths_with_minor h hDeg + exact ⟨c,P,hcInj,hc,hPaths,hInter⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SubcubicSubdivision.lean b/LeanPool/GraphMinor/GM16/SubcubicSubdivision.lean new file mode 100644 index 0000000000..770ee4c21c --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SubcubicSubdivision.lean @@ -0,0 +1,86 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.SubcubicEdgePaths +public import LeanPool.GraphMinor.GM16.GraphPathSystemUnion +import LeanPool.GraphMinor.GM16.SubdivisionPathDisjoint +import LeanPool.GraphMinor.GM09.Basic + +/-! +# The subdivision subgraph of a subcubic minor + +This supplies the graph assertion in the last paragraph of XVI +(4.2), page 54. Use the constructed centres and replacing paths, +which are pairwise edge disjoint and meet only at their common branch +centres. Their union, with isolated centres retained, is the required +subgraph. The explicit centre map and edge paths describe the +isomorphism with a subdivision of the original simple graph. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph Function GraphMinor.GM09 +universe u v w + +/-- The subdivision assertion used in XVI (4.2), page 54, with its +isomorphism specified by the centre map and the replacing edge paths. -/ +theorem exists_subcubic_subdivision_with_minor {α : Type u} {β : Type v} {ν : Type w} [Finite ν] + {H : SimpleGraph ν} {G : Graph α β} {ηv : ν → Set α} {ηe : Sym2 ν → β} + (h : IsMinorModel (Graph.ofSimpleGraph H) G ηv ηe) + (hDeg : ∀ v, (H.neighborSet v).ncard ≤ 3) : + ∃ (N : Graph α β) (c : ν → α) (P : H.edgeSet → Graph α β), + N ≤ G ∧ Injective c ∧ (∀ v, c v ∈ ηv v) ∧ + V(N) = range c ∪ ⋃ e, V(P e) ∧ E(N) = ⋃ e, E(P e) ∧ + (∀ e : H.edgeSet, ∃ a b, e.val = s(a,b) ∧ H.Adj a b ∧ + IsGraphPathWithEnds N (P e) (c a) (c b) ∧ ηe e.val ∈ E(P e) ∧ + V(P e) ∩ range c = {c a,c b}) ∧ + (∀ e f : H.edgeSet, e ≠ f → Disjoint E(P e) E(P f) ∧ + V(P e) ∩ V(P f) ⊆ range c) ∧ + ∃ ηv' : ν → Set α, IsMinorModel (Graph.ofSimpleGraph H) N ηv' ηe := by + obtain ⟨c, P, hcInj, hc, hPaths, hInter, ηv', hModelN⟩ := exists_subcubic_edge_paths_with_minor h + hDeg + have hP : ∀ e, P e ≤ G := by + intro e + obtain ⟨_, _, _, _, hPath, _, _⟩ := hPaths e + exact hPath.le + have hC : range c ⊆ V(G) := by + rintro _ ⟨v,rfl⟩ + exact h.vertex_subset v (mem_univ _) (hc v) + have hDisj := subdivision_paths_edge_disjoint c hcInj P + (fun e => by + obtain ⟨a, b, he, _, hPath, _, hRange⟩ := hPaths e + exact ⟨a, b, he, hPath, hRange⟩) hInter + let N := pathSystemGraph G (range c) P + refine ⟨N, c, P, pathSystemGraph_le hC hP, hcInj, hc, + pathSystemGraph_vertexSet G (range c) P, pathSystemGraph_edgeSet hP, ?_, ?_,ηv',hModelN⟩ + · intro e + obtain ⟨a, b, he, hAdj, hPath, hChosen, hRange⟩ := hPaths e + exact ⟨a, b, he, hAdj, hPath.of_le (le_pathSystemGraph hP e), hChosen, hRange⟩ + · intro e f hne + exact ⟨hDisj e f hne, hInter e f hne⟩ + +/-- The explicit subdivision subgraph and its replacing paths in XVI (4.2). -/ +theorem exists_subcubic_subdivision {α : Type u} {β : Type v} {ν : Type w} [Finite ν] + {H : SimpleGraph ν} {G : Graph α β} {ηv : ν → Set α} {ηe : Sym2 ν → β} + (h : IsMinorModel (Graph.ofSimpleGraph H) G ηv ηe) + (hDeg : ∀ v, (H.neighborSet v).ncard ≤ 3) : + ∃ (N : Graph α β) (c : ν → α) (P : H.edgeSet → Graph α β), + N ≤ G ∧ Injective c ∧ (∀ v, c v ∈ ηv v) ∧ + V(N) = range c ∪ ⋃ e, V(P e) ∧ E(N) = ⋃ e, E(P e) ∧ + (∀ e : H.edgeSet, ∃ a b, e.val = s(a,b) ∧ H.Adj a b ∧ + IsGraphPathWithEnds N (P e) (c a) (c b) ∧ ηe e.val ∈ E(P e) ∧ + V(P e) ∩ range c = {c a,c b}) ∧ + (∀ e f : H.edgeSet, e ≠ f → Disjoint E(P e) E(P f) ∧ + V(P e) ∩ V(P f) ⊆ range c) := by + obtain ⟨N,c,P,hNG,hcInj,hc,hVN,hEN,hPaths,hInter,_⟩ := + exists_subcubic_subdivision_with_minor h hDeg + exact ⟨N,c,P,hNG,hcInj,hc,hVN,hEN,hPaths,hInter⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SubdivisionCentreCover.lean b/LeanPool/GraphMinor/GM16/SubdivisionCentreCover.lean new file mode 100644 index 0000000000..a5517b065b --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SubdivisionCentreCover.lean @@ -0,0 +1,49 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM01.Defs +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Branch centres occur on replacing paths + +If the original graph has no isolated vertices, choose an edge +incident with each vertex. Its replacing path contains that +vertex's centre as one of its ends. Thus the replacing paths +already contain all centres, and no separate isolated-vertex +piece is needed when gluing the wall subdivision drawing. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Surface GM09 +universe u v w + +/-- With no isolated original vertices, the replacing paths cover +all branch centres. -/ +theorem subdivision_centres_subset_path_union + {α : Type u} {β : Type v} {ν : Type w} {N : Graph α β} {H : SimpleGraph ν} + (c : ν → α) (P : H.edgeSet → Graph α β) + (hPaths : ∀ e : H.edgeSet, ∃ a b, e.val=s(a,b) ∧ + IsGraphPathWithEnds N (P e) (c a) (c b)) + (hNoIsolated : ∀ v, ∃ w, H.Adj v w) : range c ⊆ ⋃ e, V(P e) := by + rintro x ⟨v,rfl⟩ + obtain ⟨w,hw⟩ := hNoIsolated v + let e : H.edgeSet := ⟨s(v,w),hw⟩ + obtain ⟨a,b,he,hPath⟩ := hPaths e + have hv : v ∈ s(a,b) := he ▸ Sym2.mem_mk_left v w + rw [Sym2.mem_iff] at hv + refine mem_iUnion_of_mem e ?_ + rcases hv with hv | hv + · exact hv.symm ▸ hPath.left_mem + · exact hv.symm ▸ hPath.right_mem + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SubdivisionDrawing.lean b/LeanPool/GraphMinor/GM16/SubdivisionDrawing.lean new file mode 100644 index 0000000000..033c0c5509 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SubdivisionDrawing.lean @@ -0,0 +1,132 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.SimpleDrawingVertices +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM16.SubdivisionPathDrawings +import LeanPool.GraphMinor.GM16.SubdivisionCentreCover +import LeanPool.GraphMinor.GM16.FiniteDrawingUnion +import LeanPool.GraphMinor.GM16.DrawingFamilyCompatibility +import LeanPool.GraphMinor.GM16.GraphIsoUnion +import LeanPool.GraphMinor.GM16.DrawingGraphPaths +import LeanPool.GraphMinor.GM11.Walks +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Drawing a subdivision on the original support + +Draw the replacing paths on the original edge closures and glue +them at their common centre points. The source paths and target +drawings have compatible vertex maps and inverse maps, and their +edge sets are disjoint. Glue their graph isomorphisms. Since the +original graph has no isolated vertices, the paths cover all +centres. Their drawing has exactly the original support. This +supplies the drawing step in the final paragraph of XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology Surface GM09 GM11 +universe u v w t + +/-- A subdivision path system for a finite simple graph without isolated +vertices can be drawn on the original drawing's support, preserving centres. -/ +theorem exists_subdivision_drawing + {α : Type u} {β : Type v} {ν : Type w} [Finite ν] {S : Type t} + [TopologicalSpace S] [T2Space S] {N : Graph α β} {H : SimpleGraph ν} + (c : ν → α) (hc : Function.Injective c) (P : H.edgeSet → Graph α β) + (hPaths : ∀ e : H.edgeSet, ∃ a b, e.val=s(a,b) ∧ H.Adj a b ∧ + IsGraphPathWithEnds N (P e) (c a) (c b) ∧ V(P e) ∩ range c = {c a,c b}) + (hInter : ∀ e f, e ≠ f → Disjoint E(P e) E(P f) ∧ V(P e) ∩ V(P f) ⊆ range c) + (hVN : V(N)=range c ∪ ⋃ e, V(P e)) (hEN : E(N)=⋃ e, E(P e)) + (hNoIsolated : ∀ v, ∃ w, H.Adj v w) + (Γ : GraphDrawing (Graph.ofSimpleGraph H) S) : + ∃ Γ' : GraphDrawing N S, Γ'.drawing.U=Γ.drawing.U ∧ + ∀ v (x : V(N)), x.val=c v → (Γ'.iso.vertexEquiv x).val=simpleDrawingVertex Γ v := by + classical + obtain ⟨D,hDU,hCentre,hZMeet,hMeet⟩ := exists_subdivision_path_drawings c hc P hPaths Γ + have hPathOnly (e : H.edgeSet) : ∃ a b, e.val=s(a,b) ∧ IsGraphPathWithEnds N (P e) (c a) (c b) + := by + obtain ⟨a,b,he,_,hPath,_⟩ := hPaths e + exact ⟨a,b,he,hPath⟩ + have hCover := subdivision_centres_subset_path_union c P hPathOnly hNoIsolated + have hVN' : V(N)=⋃ e, V(P e) := hVN.trans (union_eq_self_of_subset_left hCover) + have hBaseCover : Γ.drawing.V ⊆ ⋃ e, (D e).drawing.V := by + intro x hx + obtain ⟨v,rfl⟩ := range_simpleDrawingVertex Γ ▸ hx + obtain ⟨e,hv⟩ := mem_iUnion.mp (hCover (mem_range_self v)) + have hPoint : simpleDrawingVertex Γ v ∈ (D e).drawing.V := + hCentre e v ⟨c v,hv⟩ rfl ▸ ((D e).iso.vertexEquiv ⟨c v,hv⟩).property + exact mem_iUnion_of_mem e hPoint + obtain ⟨J,hJU,hJV,hJE⟩ := exists_drawing_of_finite_drawings + (Set.toFinite (univ : Set H.edgeSet)) Γ.drawing.finite_V (fun e => (D e).drawing) + (fun e _ => hZMeet e) (fun e _ f _ hne => hMeet e f hne) + simp only [mem_univ,iUnion_true] at hJU hJV hJE + have hJV' : J.V=⋃ e, (D e).drawing.V := hJV.trans (union_eq_self_of_subset_left hBaseCover) + have hSub (e : H.edgeSet) : (D e).drawing.IsSubdrawing J := by + constructor + · intro x hx + exact hJV'.symm ▸ mem_iUnion_of_mem e hx + · intro f hf + exact hJE.symm ▸ mem_iUnion_of_mem e hf + have hQ (e : H.edgeSet) : (D e).drawing.toGraph ≤ J.toGraph := toGraph_le_of_isSubdrawing (hSub e) + have hP (e : H.edgeSet) : P e ≤ N := by + obtain ⟨_,_,_,_,hp,_⟩ := hPaths e + exact hp.le + have hTarget (e f : H.edgeSet) (hne : e ≠ f) : + (D e).drawing.U ∩ (D f).drawing.U ⊆ range (simpleDrawingVertex Γ) := by + rw [range_simpleDrawingVertex] + exact hMeet e f hne + have hPointSource (e : H.edgeSet) (v : ν) (hv : simpleDrawingVertex Γ v ∈ + (D e).drawing.U) : c v ∈ V(P e) := + source_centre_mem_of_path_drawing_support c P + (fun e => by obtain ⟨a,b,he,ha,hp,_⟩ := hPaths e; exact ⟨a,b,he,ha,hp⟩) Γ D hDU e v hv + obtain ⟨hvF,hvB⟩ := drawing_family_vertex_maps_compatible P D c (simpleDrawingVertex Γ) + (fun e f hne => (hInter e f hne).2) hTarget hPointSource hCentre + have heF (i j : H.edgeSet) (e : β) (hi : e ∈ E(P i)) (hj : e ∈ E(P j)) : + ((D i).iso.edgeEquiv ⟨e,hi⟩).val=((D j).iso.edgeEquiv ⟨e,hj⟩).val := by + by_cases hij : i=j + · subst j + rfl + exact ((disjoint_left.mp (hInter i j hij).1) hi hj).elim + have heB (i j : H.edgeSet) (e : Set S) (hi : e ∈ (D i).drawing.E) (hj : e ∈ (D j).drawing.E) : + ((D i).iso.edgeEquiv.symm ⟨e,hi⟩).val=((D j).iso.edgeEquiv.symm ⟨e,hj⟩).val := by + by_cases hij : i=j + · subst j + rfl + have hDisj := drawing_family_edges_disjoint (fun e => (D e).drawing) Γ.drawing.V hZMeet hMeet + hij + exact ((disjoint_left.mp hDisj) hi hj).elim + obtain ⟨φ,hφV,_⟩ := exists_iso_of_subgraph_unions P (fun e => (D e).drawing.toGraph) hP hQ + (fun e => (D e).iso) hVN' hEN hJV' hJE hvF hvB heF heB + have hJU' : J.U=Γ.drawing.U := by + rw [hJU,Γ.drawing.U_eq] + apply congrArg (fun X : Set S => Γ.drawing.V ∪ X) + ext x + constructor + · intro hx + obtain ⟨e,hxe⟩ := mem_iUnion.mp hx + exact mem_iUnion₂.mpr ⟨(Γ.iso.edgeEquiv e).val,(Γ.iso.edgeEquiv e).property,hDU e ▸ hxe⟩ + · intro hx + obtain ⟨e,he,hxe⟩ := mem_iUnion₂.mp hx + let e₀ := Γ.iso.edgeEquiv.symm ⟨e,he⟩ + apply mem_iUnion_of_mem e₀ + rw [hDU e₀] + have hMap : (Γ.iso.edgeEquiv e₀).val=e := congrArg Subtype.val + (Γ.iso.edgeEquiv.apply_symm_apply ⟨e,he⟩) + exact hMap.symm ▸ hxe + refine ⟨⟨J,φ⟩,hJU',?_⟩ + intro v x hx + obtain ⟨e,hv⟩ := mem_iUnion.mp (hCover (mem_range_self v)) + have hxEq : x=⟨c v,(hP e).vertexSet_mono hv⟩ := Subtype.ext hx + rw [hxEq] + exact (hφV e ⟨c v,hv⟩).trans (hCentre e v ⟨c v,hv⟩ rfl) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SubdivisionPathDisjoint.lean b/LeanPool/GraphMinor/GM16/SubdivisionPathDisjoint.lean new file mode 100644 index 0000000000..c42e2f9fe6 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SubdivisionPathDisjoint.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +public import Mathlib.Combinatorics.Graph.Simple +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section3c + +/-! +# Edge disjointness in a subdivision path system + +For XVI (4.2), page 54, distinct replacing paths meet only at branch +centres. If they shared an edge, both ends of that edge would be +centres. A path has no loop, so the two centres would be different. +They would be the two ends of both source edges, forcing those source +edges to be equal because the source graph is simple. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph Function GraphMinor.GM09 +universe u v w + +/-- The replacing paths for two different simple-graph edges are edge +disjoint once their vertex intersections are confined to centres. -/ +theorem subdivision_paths_edge_disjoint + {α : Type u} {β : Type v} {ν : Type w} {H : SimpleGraph ν} {G : Graph α β} + (c : ν → α) (hc : Injective c) (P : H.edgeSet → Graph α β) + (hPaths : ∀ e : H.edgeSet, ∃ a b, e.val = s(a,b) ∧ + IsGraphPathWithEnds G (P e) (c a) (c b) ∧ V(P e) ∩ range c = {c a,c b}) + (hInter : ∀ e f : H.edgeSet, e ≠ f → V(P e) ∩ V(P f) ⊆ range c) : + ∀ e f : H.edgeSet, e ≠ f → Disjoint E(P e) E(P f) := by + intro e f hne + refine disjoint_left.mpr ?_ + intro g hge hgf + obtain ⟨a, b, heq, hPe, hVe⟩ := hPaths e + obtain ⟨d, z, hfq, hPf, hVf⟩ := hPaths f + obtain ⟨x, y, hlink⟩ := (P e).exists_isLink_of_mem_edgeSet hge + have hlG := hPe.le.isLink_mono hlink + have hlF := (hPf.le.isLink_iff hgf).mpr hlG + have hxy : x ≠ y := by + intro hEq + have hLoop : G.IsLoopAt g y := hEq ▸ hlG + exact hPe.not_isLoopAt hge y hLoop + have hxRange := hInter e f hne ⟨hlink.left_mem, hlF.left_mem⟩ + have hyRange := hInter e f hne ⟨hlink.right_mem, hlF.right_mem⟩ + have hxe : x ∈ Sym2.map c e.val := by + have hx : x ∈ ({c a,c b} : Set α) := hVe ▸ ⟨hlink.left_mem, hxRange⟩ + simpa only [heq, Sym2.map_mk, Sym2.mem_iff, mem_insert_iff, mem_singleton_iff] using hx + have hye : y ∈ Sym2.map c e.val := by + have hy : y ∈ ({c a,c b} : Set α) := hVe ▸ ⟨hlink.right_mem, hyRange⟩ + simpa only [heq, Sym2.map_mk, Sym2.mem_iff, mem_insert_iff, mem_singleton_iff] using hy + have hxf : x ∈ Sym2.map c f.val := by + have hx : x ∈ ({c d,c z} : Set α) := hVf ▸ ⟨hlF.left_mem, hxRange⟩ + simpa only [hfq, Sym2.map_mk, Sym2.mem_iff, mem_insert_iff, mem_singleton_iff] using hx + have hyf : y ∈ Sym2.map c f.val := by + have hy : y ∈ ({c d,c z} : Set α) := hVf ▸ ⟨hlF.right_mem, hyRange⟩ + simpa only [hfq, Sym2.map_mk, Sym2.mem_iff, mem_insert_iff, mem_singleton_iff] using hy + have heEnds := (Sym2.mem_and_mem_iff hxy).mp ⟨hxe,hye⟩ + have hfEnds := (Sym2.mem_and_mem_iff hxy).mp ⟨hxf,hyf⟩ + exact hne (Subtype.ext (Sym2.map.injective hc (heEnds.trans hfEnds.symm))) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SubdivisionPathDrawings.lean b/LeanPool/GraphMinor/GM16/SubdivisionPathDrawings.lean new file mode 100644 index 0000000000..7eacdc43d4 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SubdivisionPathDrawings.lean @@ -0,0 +1,115 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.SimpleDrawingVertices +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM16.PathDrawingOnLine +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM11.RadialCorners + +/-! +# Drawing all replacing paths of a subdivision + +Draw each path on the closure of the corresponding original edge. +Its two ends map to the original edge ends. The path-system +intersection condition identifies every branch centre on that +path with one of those ends, so all centre maps agree. Distinct +path supports meet only at original drawing vertices. These are +the gluing data for the subdivision in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology Surface GM09 GM11 +universe u v w t + +/-- The replacing paths have drawings on the original edge lines, +with compatible maps at every centre and at every support intersection. -/ +theorem exists_subdivision_path_drawings + {α : Type u} {β : Type v} {ν : Type w} {S : Type t} + [TopologicalSpace S] [T2Space S] {N : Graph α β} {H : SimpleGraph ν} + (c : ν → α) (hc : Function.Injective c) (P : H.edgeSet → Graph α β) + (hPaths : ∀ e : H.edgeSet, ∃ a b, e.val=s(a,b) ∧ H.Adj a b ∧ + IsGraphPathWithEnds N (P e) (c a) (c b) ∧ V(P e) ∩ range c = {c a,c b}) + (Γ : GraphDrawing (Graph.ofSimpleGraph H) S) : + ∃ D : ∀ e : H.edgeSet, GraphDrawing (P e) S, + (∀ e, (D e).drawing.U=closure (Γ.iso.edgeEquiv e).val) ∧ + (∀ e v (x : V(P e)), x.val=c v → ((D e).iso.vertexEquiv x).val=simpleDrawingVertex Γ v) ∧ + (∀ e, (D e).drawing.U ∩ Γ.drawing.V ⊆ (D e).drawing.V) ∧ + (∀ e f, e ≠ f → (D e).drawing.U ∩ (D f).drawing.U ⊆ Γ.drawing.V) := by + classical + choose a b he hAdj hPath hRange using hPaths + have hLink (e : H.edgeSet) : Γ.drawing.toGraph.IsLink (Γ.iso.edgeEquiv e).val + (simpleDrawingVertex Γ (a e)) (simpleDrawingVertex Γ (b e)) := + (Γ.iso.isLink_iff e ⟨a e,mem_univ _⟩ ⟨b e,mem_univ _⟩).mp ⟨he e,e.property⟩ + have hNe (e : H.edgeSet) : simpleDrawingVertex Γ (a e) ≠ simpleDrawingVertex Γ (b e) := + (simpleDrawingVertex_injective Γ).ne (hAdj e).ne + have hL (e : H.edgeSet) : IsLineWithEnds (closure (Γ.iso.edgeEquiv e).val) + (simpleDrawingVertex Γ (a e)) (simpleDrawingVertex Γ (b e)) := + isLine_closure (Γ.iso.edgeEquiv e).property (hNe e) (hLink e).2.2.2 + choose D hDU hLeft hRight using fun e => exists_path_drawing_on_line + (hPath e) (hc.ne (hAdj e).ne) (hL e) (hNe e) + refine ⟨D,hDU,?_,?_,?_⟩ + · intro e v x hxc + have hxRange : c v ∈ V(P e) ∩ range c := ⟨hxc ▸ x.property,mem_range_self v⟩ + have hxPair : c v ∈ ({c (a e),c (b e)} : Set α) := hRange e ▸ hxRange + rcases hxPair with hx | hx + · have hv : v=a e := hc hx + subst v + exact hLeft e x hxc + · rw [mem_singleton_iff] at hx + have hv : v=b e := hc hx + subst v + exact hRight e x hxc + · intro e y hy + have hyEnds : y ∈ ({simpleDrawingVertex Γ (a e),simpleDrawingVertex Γ (b e)} : Set S) := + (hLink e).2.2.2 ▸ (show y ∈ closure (Γ.iso.edgeEquiv e).val ∩ Γ.drawing.V from ⟨hDU e ▸ + hy.1,hy.2⟩) + rcases hyEnds with hyA | hyB + · have hPoint : simpleDrawingVertex Γ (a e) ∈ (D e).drawing.V := + hLeft e ⟨c (a e),(hPath e).left_mem⟩ rfl ▸ + ((D e).iso.vertexEquiv ⟨c (a e),(hPath e).left_mem⟩).property + exact hyA.symm ▸ hPoint + · rw [mem_singleton_iff] at hyB + have hPoint : simpleDrawingVertex Γ (b e) ∈ (D e).drawing.V := + hRight e ⟨c (b e),(hPath e).right_mem⟩ rfl ▸ + ((D e).iso.vertexEquiv ⟨c (b e),(hPath e).right_mem⟩).property + exact hyB.symm ▸ hPoint + · intro e f hne + rw [hDU e,hDU f] + exact closure_inter_subset_V (Γ.iso.edgeEquiv e).property (Γ.iso.edgeEquiv f).property + (fun h => hne (Γ.iso.edgeEquiv.injective (Subtype.ext h))) + +/-- A centre point on a replacing path's support comes from a vertex +of that abstract path. -/ +theorem source_centre_mem_of_path_drawing_support + {α : Type u} {β : Type v} {ν : Type w} {S : Type t} + [TopologicalSpace S] {N : Graph α β} {H : SimpleGraph ν} + (c : ν → α) (P : H.edgeSet → Graph α β) + (hPaths : ∀ e : H.edgeSet, ∃ a b, e.val=s(a,b) ∧ H.Adj a b ∧ + IsGraphPathWithEnds N (P e) (c a) (c b)) + (Γ : GraphDrawing (Graph.ofSimpleGraph H) S) + (D : ∀ e : H.edgeSet, GraphDrawing (P e) S) + (hDU : ∀ e, (D e).drawing.U=closure (Γ.iso.edgeEquiv e).val) + (e : H.edgeSet) (v : ν) (hv : simpleDrawingVertex Γ v ∈ (D e).drawing.U) : c v ∈ V(P e) := by + obtain ⟨a,b,he,_,hPath⟩ := hPaths e + have hLink := (Γ.iso.isLink_iff e ⟨a,mem_univ _⟩ ⟨b,mem_univ _⟩).mp ⟨he,e.property⟩ + have hvBase : simpleDrawingVertex Γ v ∈ Γ.drawing.V := (Γ.iso.vertexEquiv ⟨v,mem_univ _⟩).property + have hvPair : simpleDrawingVertex Γ v ∈ ({simpleDrawingVertex Γ a,simpleDrawingVertex Γ b} : Set + S) := + hLink.2.2.2 ▸ ⟨hDU e ▸ hv,hvBase⟩ + rcases hvPair with hvA | hvB + · have hEq : v=a := simpleDrawingVertex_injective Γ hvA + exact hEq.symm ▸ hPath.left_mem + · rw [mem_singleton_iff] at hvB + have hEq : v=b := simpleDrawingVertex_injective Γ hvB + exact hEq.symm ▸ hPath.right_mem + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/SublineBetween.lean b/LeanPool/GraphMinor/GM16/SublineBetween.lean new file mode 100644 index 0000000000..160eff6e0f --- /dev/null +++ b/LeanPool/GraphMinor/GM16/SublineBetween.lean @@ -0,0 +1,54 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM11.RadialCorners +import LeanPool.GraphMinor.Surface.ArcTools + +/-! +# A subline joining two points of a line + +Pull two distinct points back to the unit interval and take the +closed interval between their parameters. Its image is the +required subline. This supplies the common boundary line for +any two points on a wall face's outer boundary arc. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface GM11 + +/-- Any two distinct points of a line are joined by a subline. -/ +theorem exists_subline_between {S : Type*} [TopologicalSpace S] [T2Space S] + {L : Set S} {a b x y : S} (hL : IsLineWithEnds L a b) + (hx : x ∈ L) (hy : y ∈ L) (hxy : x ≠ y) : + ∃ K, IsLineWithEnds K x y ∧ K ⊆ L := by + obtain ⟨e,_,_⟩ := hL + let p : unitInterval → S := fun t => (e t).val + let s := e.symm ⟨x,hx⟩ + let t := e.symm ⟨y,hy⟩ + have hpc : Continuous p := continuous_subtype_val.comp e.continuous + have hpi : Function.Injective p := fun _ _ he => e.injective (Subtype.ext he) + have hs : p s = x := congrArg Subtype.val (e.apply_symm_apply _) + have ht : p t = y := congrArg Subtype.val (e.apply_symm_apply _) + have hst : s ≠ t := fun he => hxy (hs.symm.trans ((congrArg p he).trans ht)) + rcases lt_or_gt_of_ne hst with h | h + · refine ⟨p '' Icc s t,?_,?_⟩ + · simpa only [hs,ht] using isLine_piece hpc hpi h + · rintro z ⟨u,_,rfl⟩ + exact (e u).property + · refine ⟨p '' Icc t s,?_,?_⟩ + · have hLine := isLine_piece hpc hpi h + rw [hs,ht] at hLine + exact hLine.symm + · rintro z ⟨u,_,rfl⟩ + exact (e u).property + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Theorem35Bridge.lean b/LeanPool/GraphMinor/GM16/Theorem35Bridge.lean new file mode 100644 index 0000000000..573bf98bc3 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Theorem35Bridge.lean @@ -0,0 +1,85 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Cited +public import LeanPool.GraphMinor.GM15.Section3Handle + +/-! +# Graph Minors XV, (3.5), in the form cited in Graph Minors XVI + +Graph Minors XVI cites (3.5) of Graph Minors XV in a form with no hypothesis `φ ≤ θ` and with no +hypothesis that the boundaries of the two regions are `O`-arcs. Both follow from what that form +assumes. The sets `{a_i}` are free, so `φ ≤ θ` +(`IsFreeSet`). And `H ∩ bd(Λ)` is a circuit whose point set is all of `bd(Λ)`, because each point of +`bd(Λ)` is a vertex or lies on an edge in `bd(Λ)` (`interSet_subBd_U`). +-/ + +@[expose] public section + +namespace GraphMinor.GM16 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe u v w + +variable {S : Type w} [TopologicalSpace S] [T2Space S] + +/-- For a region `Λ`, the boundary `bd(Λ)` is the point set of `H ∩ bd(Λ)`. -/ +theorem interSet_subBd_U (hS : IsClosedSurface S) {H : Drawing S} {Λ : Set S} + (hΛ : Λ ∈ H.R) : (H.interSet (subBd Λ)).U = subBd Λ := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hcl : IsClosed (subBd Λ) := by + rw [subBd_eq_frontier] + exact isClosed_frontier + refine Subset.antisymm (interSet_U_subset hcl) fun x hx => ?_ + have hxU : x ∈ H.U := by + by_contra hz + obtain ⟨r, hr, hzr⟩ := GM11.exists_region_of_notMem hz + obtain ⟨y, hyr, hyΛ⟩ := mem_closure_iff.mp hx.1 r (GM11.region_isOpen hr) hzr + have hrΛ : r = Λ := GM11.region_eq_of_mem hr hΛ hyr hyΛ + have hzΛ : x ∈ Λ := hrΛ ▸ hzr + have hzf : x ∈ frontier Λ := subBd_eq_frontier Λ ▸ hx + exact ((GM11.region_isOpen hΛ).interior_eq ▸ hzf.2) hzΛ + by_cases hxV : x ∈ H.V + · exact (H.interSet (subBd Λ)).V_subset_U (mem_interSet_V hxV hx) + obtain ⟨e, he, hxe⟩ := H.exists_edge_of_mem hxU hxV + have heU : e ⊆ H.U := subset_closure.trans (H.closure_subset_U he) + have hcle : e ⊆ closure Λ := edge_subset_closure_of_incident hS he hΛ ⟨x, hxe, hx.1⟩ + have hsub : e ⊆ subBd Λ := fun y hy => ⟨hcle hy, subset_closure ⟨mem_univ y, fun hyΛ + => region_subset hΛ hyΛ (heU hy)⟩⟩ + have hE : e ∈ (H.interSet (subBd Λ)).E := mem_interSet_E_iff.2 ⟨he, hsub⟩ + exact (H.interSet (subBd Λ)).closure_subset_U hE (subset_closure hxe) + +/-- **Graph Minors XV, (3.5)**, in the form of `GM16.GM15Theorem35Statement`. -/ +theorem gm15Theorem35 : GM16.GM15Theorem35Statement.{u, v, w} := by + intro S _ _ α β G H η θ_star θ φ T_star T d Λ₁ Λ₂ P a b hSpan hMet hΛ₁ hΛ₂ hne hC₁ hC₂ hNo hLine + hφ hia hib hOa hOb hmem hP hdis hFa hFb + have hS : IsClosedSurface S := + ⟨hSpan.isSurface.1, hSpan.isSurface.2.1, fun x => by_contra fun hx + => Set.eq_empty_iff_forall_notMem.mp hSpan.bd_empty x hx⟩ + have := hSpan.isConnected + have hcl : ∀ Λ : Set S, IsClosed (subBd Λ) := fun Λ => by + rw [subBd_eq_frontier] + exact isClosed_frontier + have hO₁ : IsOArc (subBd Λ₁) := interSet_subBd_U hS hΛ₁ ▸ IsCircuit.isOArc_U hC₁ + have hO₂ : IsOArc (subBd Λ₂) := interSet_subBd_U hS hΛ₂ ▸ IsCircuit.isOArc_U hC₂ + have hle : φ ≤ θ := by + have := hFa.2.1 + rwa [ncard_range_of_injective hia, Nat.card_fin] at this + have hV : ∀ {Λ : Set S} {x : S}, x ∈ (H.interSet (subBd Λ)).V ↔ x ∈ H.V ∩ subBd Λ := fun {Λ x} + => mem_interSet_V_iff (hcl Λ) + refine GraphMinor.GM15.theorem_3_5_proof.{u, v, w} G H η θ_star θ φ T_star T Λ₁ Λ₂ P a b hSpan + hΛ₁ hΛ₂ hne hO₁ hO₂ hC₁ hC₂ ?_ hLine hφ hle (List.nodup_ofFn.2 hia) + (List.nodup_ofFn.2 hib) hOa hOb + (fun i => ⟨hV.1 (hmem i).1, hV.1 (hmem i).2⟩) hP hdis hFa hFb + rintro r hr ⟨x, hxr, hx⟩ + refine Set.disjoint_left.mpr fun y hyr hy => hNo r hr ⟨⟨x, hV.2 hx, hxr⟩, y, hV.2 hy, hyr⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/Tower.lean b/LeanPool/GraphMinor/GM16/Tower.lean new file mode 100644 index 0000000000..a7106e577e --- /dev/null +++ b/LeanPool/GraphMinor/GM16/Tower.lean @@ -0,0 +1,211 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4 +public import LeanPool.GraphMinor.GM16.SpanTransport +public import LeanPool.GraphMinor.GM20.Draw10 +public import LeanPool.GraphMinor.Surface.HandleModel + +/-! +# The surface tower + +We prove `SurfaceTowerStatement`, which Graph Minors XVI, (3.1) needs (page 54). + +Fix a finite graph `L`. By `Draw.exists_canBeDrawn`, there is `L₀` such that `L` can be drawn in +every model `Σ(a, b, 0)` with `L₀ ≤ a` or `L₀ ≤ b`. So a surface in which `L` cannot be drawn has `2 +a + b ≤ 3 L₀`. Adding a crosscap raises `2 a + b` by one (`crosscap_model`), and adding a handle +raises it by two (`handle_model`). So the tower lists every model `Σ(a, b, 0)` with `2 a + b ≤ N`, +for `N = 3 L₀ + 2`, in the order of `2 a + b`. The surface after a step is homeomorphic to a later +member of the list, and spans move along homeomorphisms by `IsSigmaSpan.transport`. +-/ + +@[expose] public section + +namespace GraphMinor.GM16 + +open Set Function Topology +open Graph +open GraphMinor.Surface GraphMinor.GM07 GraphMinor.GM15 + +universe u v w u' v' + +/-- The handles of the surface at position `k` of the tower. The position is `e (N + 1) + x` for the +Euler genus `e`, and `x` picks the number of handles. -/ +def towerA (N k : ℕ) : ℕ := min (k % (N + 1)) (k / (N + 1) / 2) + +/-- The cross-caps of the surface at position `k` of the tower. -/ +def towerB (N k : ℕ) : ℕ := k / (N + 1) - 2 * towerA N k + +theorem tower_genus (N k : ℕ) : 2 * towerA N k + towerB N k = k / (N + 1) := by + have : towerA N k ≤ k / (N + 1) / 2 := min_le_right _ _ + simp only [towerB] + omega + +theorem tower_index {N a b : ℕ} (h : 2 * a + b ≤ N) : towerA N ((2 * a + b) * (N + 1) + a) = a + ∧ towerB N ((2 * a + b) * (N + 1) + a) = b := by + have ha : a < N + 1 := by omega + have h1 : ((2 * a + b) * (N + 1) + a) / (N + 1) = 2 * a + b := by + rw [Nat.add_comm, Nat.add_mul_div_right _ _ (by omega), Nat.div_eq_of_lt ha, Nat.zero_add] + have h2 : ((2 * a + b) * (N + 1) + a) % (N + 1) = a := by + rw [Nat.add_comm, Nat.add_mul_mod_self_right, Nat.mod_eq_of_lt ha] + have h3 : towerA N ((2 * a + b) * (N + 1) + a) = a := by + simp only [towerA, h1, h2] + omega + refine ⟨h3, ?_⟩ + simp only [towerB, h1, h3] + omega + +theorem bd_model (a b : ℕ) : bd (SurfaceModel a b 0) = ∅ := by + obtain ⟨ht, f, hf⟩ := presents_ew a b 0 + have := ht + have h1 := ncard_cuffs hf + have hfin := (cuff_statement.{0} _ (isSurface_model a b 0).1).2.1 + have h2 : cuffs (SurfaceModel a b 0) = ∅ := (ncard_eq_zero hfin).mp h1 + rw [eq_empty_iff_forall_notMem] + intro x hx + have h3 : connectedComponentIn (bd (SurfaceModel a b 0)) x ∈ cuffs (SurfaceModel a b 0) + := ⟨x, hx, rfl⟩ + rw [h2] at h3 + exact h3 + +theorem isClosedSurface_ulift (a b : ℕ) : IsClosedSurface (ULift.{w} (SurfaceModel a b 0)) := by + have hS := (isSurface_model a b 0).1 + have := hS.1 + have := hS.2.1 + let ψ : ULift.{w} (SurfaceModel a b 0) ≃ₜ SurfaceModel a b 0 := Homeomorph.ulift + refine ⟨inferInstance, ψ.isEmbedding.t2Space, fun x => ?_⟩ + refine (isInteriorPoint_homeomorph_iff ψ x).mp ?_ + by_contra h + have h1 : ψ x ∈ bd (SurfaceModel a b 0) := h + rw [bd_model] at h1 + exact h1 + +/-- A graph is drawn in all models of large genus, as a graph in the sense of Graph Minors XVI. -/ +theorem exists_drawn {α' : Type u'} {β' : Type v'} (L : Graph α' β') (hV : V(L).Finite) + (hE : E(L).Finite) : + ∃ L₀, ∀ a b : ℕ, L₀ ≤ a ∨ L₀ ≤ b → CanBeDrawnIn (ULift.{w} (SurfaceModel a b 0)) L := by + let H : Hypergraph α' β' := Hypergraph.ofGraph L hV hE + have hG : H.IsGraph := by + intro e he + obtain ⟨x, y, hl⟩ := Graph.exists_isLink_of_mem_edgeSet he + have hsub : H.ends e ⊆ {x, y} := by + rintro w ⟨z, hz⟩ + rcases hz.left_eq_or_eq hl with h | h + · exact .inl h + · exact .inr h + refine ⟨⟨x, ⟨y, hl⟩⟩, ?_⟩ + calc (H.ends e).ncard ≤ ({x, y} : Set α').ncard := ncard_le_ncard hsub (by simp) + _ ≤ 2 := ncard_insert_le _ _ |>.trans (by simp) + obtain ⟨L₀, hL⟩ := GM20.Draw.exists_canBeDrawn H hG + refine ⟨L₀, fun a b hab => ?_⟩ + have := (isSurface_model a b 0).1.2.1 + obtain ⟨ν, F, h1, h2, h3, h4, h5⟩ := hL a b 0 hab + let ψ : SurfaceModel a b 0 ≃ₜ ULift.{w} (SurfaceModel a b 0) := Homeomorph.ulift.symm + refine ⟨ψ ∘ ν, fun e => ψ '' F e, ψ.injective.comp_injOn h1, ?_, ?_, ?_, ?_⟩ + · intro e he u₁ u₂ hl hne + exact GM20.Draw.image_isLineWithEnds ψ (h2 e he u₁ u₂ hl.inc_left hl.inc_right hne) + · intro e he x hl + have he' : H.ends e = {x} := by + ext w + constructor + · rintro ⟨z, hz⟩ + exact mem_singleton_iff.mpr ((Graph.IsLink.left_eq_or_eq hz hl).elim id id) + · rintro rfl + exact ⟨w, hl⟩ + obtain ⟨h6, h7⟩ := h3 e he x he' + obtain ⟨g⟩ := h6 + exact ⟨⟨g.trans (ψ.image _)⟩, mem_image_of_mem _ h7⟩ + · intro e he f hf hef w hw + rw [← image_inter ψ.injective] at hw + obtain ⟨x, hx, rfl⟩ := hw + obtain ⟨v, hv, rfl⟩ := h4 e he f hf hef hx + exact ⟨v, hv, rfl⟩ + · intro e he v hv hm + obtain ⟨z, hz, hez⟩ := hm + exact h5 e he v hv (ψ.injective hez ▸ hz) + +theorem isSphere_tower {a b : ℕ} (ha : a = 0) (hb : b = 0) : IsSphere (ULift.{w} + (SurfaceModel a b 0)) := by + subst ha hb + obtain ⟨E⟩ := isSphere_model + exact ⟨Homeomorph.ulift.trans E⟩ + +/-- One step from a closed connected surface with a model gives a surface with a model of larger `2 +a + b`, by at most two. -/ +theorem step_model {S S' : Type w} [TopologicalSpace S] [TopologicalSpace S'] [ConnectedSpace S] + [ConnectedSpace S'] {a b : ℕ} (e : S ≃ₜ SurfaceModel a b 0) + (h : IsObtainedByAddingHandleOrCrosscap S S') : + ∃ a' b', Nonempty (S' ≃ₜ SurfaceModel a' b' 0) ∧ 2 * a + b < 2 * a' + b' ∧ 2 * a' + b' + ≤ 2 * a + b + 2 := by + have hb : bd S = ∅ := by + rw [← image_bd_homeomorph e.symm, bd_model, image_empty] + rcases h with ⟨hS, hS', hb', Λ₁, Λ₂, S₁, S₂, hΛ₁, hΛ₂, hd, -, -, hu, h1, h2, ⟨e₁⟩, ⟨e₂⟩⟩ | ⟨hS, + hS', hb', Λ, S₁, S₂, hΛ, -, hu, h1, h2, ⟨e₁⟩, ⟨e₂⟩⟩ + · obtain ⟨a', b', h3, h4⟩ := handle_model hS hb hS' hb' hΛ₁ hΛ₂ hd hu h1 h2 e₁ e₂ e + exact ⟨a', b', h3, by omega, by omega⟩ + · obtain ⟨a', b', h3, h4⟩ := crosscap_model hS hb hS' hb' hΛ hu h1 h2 e₁ e₂ e + exact ⟨a', b', h3, by omega, by omega⟩ + +/-- **The surface tower.** Every finite graph has a tower of closed connected surfaces that starts +with the sphere and is closed under adding a handle or a crosscap to a surface in which the graph +cannot be drawn. -/ +theorem surfaceTower : SurfaceTowerStatement.{u, v, w, u', v'} := by + intro α' β' L hV hE + obtain ⟨L₀, hL⟩ := exists_drawn.{w} L hV hE + let N : ℕ := 3 * L₀ + 2 + refine ⟨{ n := (N + 1) * (N + 1) + one_le_n := Nat.mul_pos (by omega) (by omega) + Surf := fun i => ULift.{w} (SurfaceModel (towerA N i) (towerB N i) 0) + topSpace := fun _ => inferInstance + t2Space := fun i => (isClosedSurface_ulift _ _).2.1 + isClosedSurface := fun i => isClosedSurface_ulift _ _ + isConnected := fun i => ?_ + isSphere_zero := isSphere_tower (by simp [towerA]) (by simp [towerB, towerA]) + step_index := ?_ }⟩ + · have := (isSurface_model (towerA N i) (towerB N i) 0).2 + exact Homeomorph.ulift.symm.surjective.connectedSpace Homeomorph.ulift.symm.continuous + · intro i hnot α β G θ_star φ T_star S' _ _ H' η' θ_span' T' hcl hconn hadd hφ hspan + have hc := (isSurface_model (towerA N i) (towerB N i) 0).2 + have hci : ConnectedSpace (ULift.{w} (SurfaceModel (towerA N i) (towerB N i) 0)) := + Homeomorph.ulift.symm.surjective.connectedSpace Homeomorph.ulift.symm.continuous + have hsmall : towerA N i < L₀ ∧ towerB N i < L₀ := by + by_contra h + exact hnot (hL _ _ (by omega)) + obtain ⟨a', b', ⟨e'⟩, h3, h4⟩ := step_model (Homeomorph.ulift : ULift.{w} (SurfaceModel + (towerA N i) (towerB N i) 0) ≃ₜ _) hadd + have hle : 2 * a' + b' ≤ N := by + simp only [N] + omega + obtain ⟨ea, eb⟩ := tower_index hle + set k := (2 * a' + b') * (N + 1) + a' with hk + have hkn : k < (N + 1) * (N + 1) := by + have : (2 * a' + b' + 1) * (N + 1) ≤ (N + 1) * (N + 1) := Nat.mul_le_mul_right _ (by omega) + have h5 : a' < N + 1 := by omega + rw [Nat.add_mul] at this + omega + have hik : (i : ℕ) < k := by + have h5 := tower_genus N i + have h6 : ∀ m : ℕ, m < (m / (N + 1) + 1) * (N + 1) := fun m => by + rw [Nat.mul_comm] + exact Nat.lt_mul_div_succ m (by omega) + replace h6 := h6 i + have h7 : ((i : ℕ) / (N + 1) + 1) * (N + 1) ≤ (2 * a' + b') * (N + 1) + := Nat.mul_le_mul_right _ (by omega) + omega + have hψ : ∀ x y, x = a' → y = b' → Nonempty (S' ≃ₜ ULift.{w} (SurfaceModel x y 0)) := by + rintro _ _ rfl rfl + exact ⟨e'.trans Homeomorph.ulift.symm⟩ + obtain ⟨ψ⟩ := hψ _ _ ea eb + have : T2Space (ULift.{w} (SurfaceModel (towerA N k) (towerB N k) 0)) := + (isClosedSurface_ulift _ _).2.1 + exact ⟨⟨k, hkn⟩, hik, mapDrawingHomeo ψ H', SpanEmbedding.mapHomeo ψ η', θ_span', mapT ψ T', + hφ, IsSigmaSpan.transport ψ hspan⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/TwoBranchArmsPath.lean b/LeanPool/GraphMinor/GM16/TwoBranchArmsPath.lean new file mode 100644 index 0000000000..7a06f391dc --- /dev/null +++ b/LeanPool/GraphMinor/GM16/TwoBranchArmsPath.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Defs +import LeanPool.GraphMinor.GM09.Basic + +/-! +# Joining two branch arms through a chosen edge + +In the subdivision step of XVI (4.2), page 54, take an arm from each +of two disjoint branch sets and the chosen edge between their ends. +Their union is a path between the branch centres. Its vertices are +exactly the vertices of the two arms, and its edges are exactly the +arm edges together with the chosen edge. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph GraphMinor.Surface GraphMinor.GM09 +universe u v + +/-- Join disjoint arms by one edge, keeping exact vertex and edge sets. +This is the edge-path construction in XVI (4.2), page 54. -/ +theorem exists_path_between_branch_arms {α : Type u} {β : Type v} + {G A B : Graph α β} {m x n y : α} {e : β} + (hA : IsGraphPathWithEnds G A m x) (hB : IsGraphPathWithEnds G B n y) + (hDisj : Disjoint V(A) V(B)) (hEdge : G.IsLink e x y) : + ∃ P : Graph α β, IsGraphPathWithEnds G P m n ∧ + V(P) = V(A) ∪ V(B) ∧ E(P) = (E(A) ∪ {e}) ∪ E(B) := by + have hxy : x ≠ y := hDisj.ne_of_mem hA.right_mem hB.right_mem + let W : GraphWalk G x y := .cons hEdge (.nil hEdge.right_mem) + let Q := walkSubgraph W + have hW : W.IsSimple := by + change [x,y].Nodup + exact List.nodup_cons.mpr ⟨by simpa only [List.mem_singleton] using hxy, + List.nodup_singleton y⟩ + have hQ : IsGraphPathWithEnds G Q x y := isGraphPathWithEnds_walkSubgraph hW + have hVQ : V(Q) = {x,y} := by + rw [vertexSet_walkSubgraph] + ext z + change z ∈ [x,y] ↔ z ∈ ({x,y} : Set α) + simp only [List.mem_cons, List.not_mem_nil, or_false, mem_insert_iff, mem_singleton_iff] + have hEQ : E(Q) = {e} := by + rw [edgeSet_walkSubgraph] + ext f + change f ∈ [e] ↔ f ∈ ({e} : Set β) + simp only [List.mem_singleton, mem_singleton_iff] + have hAQ : V(A) ∩ V(Q) = {x} := by + rw [hVQ] + apply Subset.antisymm + · rintro z ⟨hzA, hz⟩ + rcases hz with rfl | hz + · exact mem_singleton _ + · rw [mem_singleton_iff] at hz + subst z + exact ((disjoint_left.mp hDisj) hzA hB.right_mem).elim + · rintro z rfl + exact ⟨hA.right_mem, mem_insert _ _⟩ + let AQ := subgraphUnion G A Q + have hPathAQ : IsGraphPathWithEnds G AQ m y := hA.subgraphUnion hQ hAQ + have hAQB : V(AQ) ∩ V(B) = {y} := by + change (V(A) ∪ V(Q)) ∩ V(B) = {y} + rw [hVQ] + apply Subset.antisymm + · rintro z ⟨hzA | hzQ, hzB⟩ + · exact ((disjoint_left.mp hDisj) hzA hzB).elim + · rcases hzQ with rfl | hz + · exact ((disjoint_left.mp hDisj) hA.right_mem hzB).elim + · exact hz + · rintro z rfl + exact ⟨Or.inr (mem_insert_of_mem _ (mem_singleton _)), hB.right_mem⟩ + let P := subgraphUnion G AQ B + refine ⟨P, hPathAQ.subgraphUnion hB.symm hAQB, ?_, ?_⟩ + · change (V(A) ∪ V(Q)) ∪ V(B) = V(A) ∪ V(B) + rw [hVQ] + apply Subset.antisymm + · rintro z ((hzA | hzQ) | hzB) + · exact Or.inl hzA + · rcases hzQ with rfl | hz + · exact Or.inl hA.right_mem + · rw [mem_singleton_iff] at hz + subst z + exact Or.inr hB.right_mem + · exact Or.inr hzB + · exact union_subset (fun _ h => Or.inl (Or.inl h)) (fun _ h => Or.inr h) + · change E(subgraphUnion G AQ B) = _ + rw [edgeSet_subgraphUnion hPathAQ.le hB.le, + edgeSet_subgraphUnion hA.le hQ.le, hEQ] + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/TwoFaceDial.lean b/LeanPool/GraphMinor/GM16/TwoFaceDial.lean new file mode 100644 index 0000000000..4adb35428b --- /dev/null +++ b/LeanPool/GraphMinor/GM16/TwoFaceDial.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM16.FaceSubdisc +import LeanPool.GraphMinor.GM16.LineDial +import LeanPool.GraphMinor.GM11.Section7 +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.Surface.DiscUnion +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Gluing the two halves of a dial + +A circle with one line in each of two empty faces cuts off a disc +in each face. Each disc meets the drawing in the same boundary +subline. Glue the discs along that line. The glued boundary is the +original circle, and its intersection with the drawing is a line, +so its restricted drawing is a path. This is the two-face geometry +used for the wall rigidity assertion in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface GM14 GM11 + +/-- Two lines in empty faces, joined at their two ends, bound a dial +when a common boundary line joins the same ends. -/ +theorem exists_isDial_of_two_faces {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {H : Drawing S} {C₁ C₂ P₁ P₂ K : Set S} {a b : S} + (hC₁ : IsClosedDisc C₁) (hC₂ : IsClosedDisc C₂) + (hP₁ : IsLineWithEnds P₁ a b) (hP₂ : IsLineWithEnds P₂ a b) + (hK : IsLineWithEnds K a b) (hab : a ≠ b) + (hPC₁ : P₁ ⊆ C₁) (hPC₂ : P₂ ⊆ C₂) + (hKC₁ : K ⊆ discBd C₁) (hKC₂ : K ⊆ discBd C₂) (hKU : K ⊆ H.U) + (hPU₁ : P₁ ∩ discBd C₁ ⊆ {a,b}) (hPU₂ : P₂ ∩ discBd C₂ ⊆ {a,b}) + (hEmpty₁ : C₁ ∩ H.U ⊆ discBd C₁) (hEmpty₂ : C₂ ∩ H.U ⊆ discBd C₂) + (hMeet : C₁ ∩ C₂ ⊆ discBd C₁) + (hNormal : (P₁ ∪ P₂) ∩ H.U ⊆ H.V) + (hEnds : (P₁ ∪ P₂) ∩ H.V = {a,b}) : + ∃ Δ, IsDial H (P₁ ∪ P₂) Δ := by + obtain ⟨Δ₁,hΔC₁,hΔ₁,hbd₁,hSide₁,hU₁⟩ := + exists_face_subdisc hS hC₁ hP₁ hK hPC₁ hKC₁ hKU hPU₁ hEmpty₁ + obtain ⟨Δ₂,hΔC₂,hΔ₂,hbd₂,hSide₂,hU₂⟩ := + exists_face_subdisc hS hC₂ hP₂ hK hPC₂ hKC₂ hKU hPU₂ hEmpty₂ + have hKΔ₁ : K ⊆ Δ₁ := fun _ hx => (hSide₁.symm ▸ hx).1 + have hKΔ₂ : K ⊆ Δ₂ := fun _ hx => (hSide₂.symm ▸ hx).1 + have hInter : Δ₁ ∩ Δ₂ = K := by + apply subset_antisymm + · rintro x ⟨hx₁,hx₂⟩ + exact hSide₁ ▸ (show x ∈ Δ₁ ∩ discBd C₁ from + ⟨hx₁,hMeet ⟨hΔC₁ hx₁,hΔC₂ hx₂⟩⟩) + · intro x hx + exact ⟨hKΔ₁ hx,hKΔ₂ hx⟩ + have hKb₁ : K ⊆ discBd Δ₁ := fun _ hx => hbd₁.symm ▸ Or.inr hx + have hKb₂ : K ⊆ discBd Δ₂ := fun _ hx => hbd₂.symm ▸ Or.inr hx + obtain ⟨hDisc,hBd⟩ := disc_union Δ₁ Δ₂ K a b hΔ₁ hΔ₂ hK hInter hKb₁ hKb₂ + have hBoundary : discBd (Δ₁ ∪ Δ₂) = P₁ ∪ P₂ := by + rw [hBd,hbd₁,hbd₂] + ext x + constructor + · rintro ⟨hx,hn⟩ + rcases hx with (hx | hx) | (hx | hx) + · exact Or.inl hx + · have hxEnds : x ∈ ({a,b} : Set S) := by + by_contra h + exact hn ⟨hx,h⟩ + rcases hxEnds with rfl | hxEnds + · exact Or.inl hP₁.left_mem + · rw [mem_singleton_iff] at hxEnds + exact Or.inl (hxEnds.symm ▸ hP₁.right_mem) + · exact Or.inr hx + · have hxEnds : x ∈ ({a,b} : Set S) := by + by_contra h + exact hn ⟨hx,h⟩ + rcases hxEnds with rfl | hxEnds + · exact Or.inl hP₁.left_mem + · rw [mem_singleton_iff] at hxEnds + exact Or.inl (hxEnds.symm ▸ hP₁.right_mem) + · intro hx + refine ⟨hx.elim (fun h => Or.inl (Or.inl h)) (fun h => Or.inr (Or.inl h)),?_⟩ + rintro ⟨hxK,hxEnds⟩ + exact hxEnds (hx.elim (fun h => hPU₁ ⟨h,hKC₁ hxK⟩) + (fun h => hPU₂ ⟨h,hKC₂ hxK⟩)) + have hDrawing : H.U ∩ (Δ₁ ∪ Δ₂) = K := by + rw [inter_comm,union_inter_distrib_right,hU₁,hU₂,union_self] + refine ⟨Δ₁ ∪ Δ₂,isDial_of_line_intersection hDisc ?_ hNormal hab hEnds ?_⟩ + · rw [subBd_eq_frontier,GM11.IsClosedDisc.frontier_eq_discBd hS hDisc,hBoundary] + · exact hDrawing.symm ▸ hK + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/VortexComparison.lean b/LeanPool/GraphMinor/GM16/VortexComparison.lean new file mode 100644 index 0000000000..4d624c8052 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/VortexComparison.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM15.Defs +import LeanPool.GraphMinor.GM09.Section3a +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM09.Section2a +import LeanPool.GraphMinor.GM09.Section2d + +/-! +# Comparing the vortex definitions in XV and XVI + +For XVI (7.2), page 62, we use the segregations constructed in XV. +A half-open interval and its complement form a fence of the cyclic order. +Thus disjoint paths across the partition in XVI form a transaction in XV, +with the same cardinality bound. +-/ + +public section +namespace GraphMinor.GM16 +open Set Function Graph GraphMinor.GM09 GraphMinor.GM15 +universe u v + +/-- The two half-open intervals between distinct boundary vertices form + a fence of the cyclic order. -/ +theorem isFence_half_open_intervals {α : Type u} (Ω : CyclicPerm α) + {x y : α} (hx : x ∈ Ω.bar) (hy : y ∈ Ω.bar) (hxy : x ≠ y) : + Ω.IsFence (Ω.interval x y ∪ {x}) (Ω.interval y x ∪ {y}) := by + have hclosed := Ω.isFence_interval_compl hx hy hxy + have hA : Ω.interval x y ∪ {x} ⊆ {x, y} ∪ Ω.interval x y := by + rintro z (hz | rfl) + · exact Or.inr hz + · exact Or.inl (Or.inl rfl) + have hd : Disjoint (Ω.interval x y ∪ {x}) (Ω.interval y x ∪ {y}) := by + refine disjoint_left.mpr ?_ + rintro z (hz | rfl) (hz' | rfl) + · exact disjoint_left.mp (Ω.disjoint_interval_swap x y) hz hz' + · exact hz.1.2 (by simp) + · exact hz'.1.2 (by simp) + · exact hxy rfl + refine ⟨fun z hz => hclosed.1 (hA hz), ?_, hd, ?_, ?_⟩ + · rintro z (hz | rfl) + · exact hz.1.1 + · exact hy + · convert hclosed.2.2.2.1 using 1 + ext z + simp only [mem_union, mem_insert_iff, mem_singleton_iff] + tauto + · intro a₁ ha₁ a₂ ha₂ ha12 b₁ hb₁ b₂ hb₂ hb12 hc + rcases hb₁ with hb₁ | rfl <;> rcases hb₂ with hb₂ | rfl + · exact hclosed.2.2.2.2 _ (hA ha₁) _ (hA ha₂) ha12 _ hb₁ _ hb₂ hb12 hc + · have hc' := (Ω.crosses_iff_interval).mp hc.symm + rcases hc' with ⟨_, ha₂'⟩ | ⟨_, ha₁'⟩ + · exact disjoint_left.mp hd ha₂ (Or.inl (Ω.interval_subset_interval_left hb₁ ha₂')) + · exact disjoint_left.mp hd ha₁ (Or.inl (Ω.interval_subset_interval_left hb₁ ha₁')) + · have hc' := (Ω.crosses_iff_interval).mp hc.symm + rcases hc' with ⟨ha₁', _⟩ | ⟨ha₂', _⟩ + · exact disjoint_left.mp hd ha₁ (Or.inl (Ω.interval_subset_interval_left hb₂ ha₁')) + · exact disjoint_left.mp hd ha₂ (Or.inl (Ω.interval_subset_interval_left hb₂ ha₂')) + · exact hb12 rfl + +/-- The transaction bound of XV implies the vortex condition of XVI, +with the same bound. This supplies the change of wording in XVI (7.2). -/ +theorem isRhoVortex_of_isPVortex {α : Type u} {β : Type v} + {S : Society α β} {ρ : ℕ} (h : S.IsPVortex ρ) : IsRhoVortex S ρ := by + classical + intro u hu v hv huv + rintro ⟨P, hdisj, hpaths⟩ + choose a ha b hb hP using hpaths + have hfence := isFence_half_open_intervals S.Ω hu hv huv + have hne : ∀ i, a i ≠ b i := fun i heq => + disjoint_left.mp hfence.2.2.1 (ha i) (heq ▸ hb i) + have hΩ : ∀ i, S.IsOmegaPathWithEnds (P i) (a i) (b i) := + fun i => ⟨hP i, hne i, hfence.1 (ha i), hfence.2.1 (hb i)⟩ + have hinj : Injective P := by + intro i j hij + by_contra hneij + exact disjoint_left.mp (hdisj hneij) (hP i).left_mem (hij ▸ (hP i).left_mem) + have hTrans : S.IsTransaction (range P) := by + refine ⟨_, _, ⟨?_, ?_⟩, hfence, ?_⟩ + · rintro _ ⟨i, rfl⟩ + exact ⟨a i, b i, hΩ i⟩ + · rintro _ ⟨i, rfl⟩ _ ⟨j, rfl⟩ hneij + exact hdisj (fun heq => hneij (congrArg P heq)) + · rintro _ ⟨i, rfl⟩ + exact ⟨a i, ha i, b i, hb i, hΩ i⟩ + have hcount := h hTrans + rw [ncard_range_of_injective hinj] at hcount + simp only [Nat.card_eq_fintype_card, Fintype.card_fin] at hcount + exact Nat.not_succ_le_self ρ hcount + +/-- The societies of a segregation from XV satisfy the vortex condition +used by XVI, without changing the two bounds. -/ +theorem isSegregationOfType_of_gm15 {α : Type u} {β : Type v} + {G : Graph α β} {ρ κ : ℕ} {𝒮 : Set (Society α β)} + (h : GM15.IsSegregationOfType G ρ κ 𝒮) : IsSegregationOfType G ρ κ 𝒮 := + ⟨h.isSegregation, h.vortex_count_le, + fun _ hA hlarge => isRhoVortex_of_isPVortex (h.is_p_vortex hA hlarge)⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallBrickBoundary.lean b/LeanPool/GraphMinor/GM16/WallBrickBoundary.lean new file mode 100644 index 0000000000..c2ae62027f --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallBrickBoundary.lean @@ -0,0 +1,86 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4WallDrawing +import LeanPool.GraphMinor.GM16.WallEdgeInDrawing +import LeanPool.GraphMinor.GM16.RectangularDisc +import LeanPool.GraphMinor.Surface.Wedge +import Mathlib.Tactic.Linarith + +/-! +# The boundary of each wall brick lies in the drawing + +The top and bottom sides each consist of two retained horizontal +unit lines. The other two sides are vertical lines with the even +parity required by the wall. Thus the boundary of the embedded +closed rectangle belongs to the wall drawing. Together with its +empty interior this identifies a bounded face in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology Surface + +/-- Every side of a closed wall brick belongs to the drawing. -/ +theorem sphereWall_brick_frontier_image_subset_U {S : Type*} + [TopologicalSpace S] {θ : ℕ} + (f : (ℝ × ℝ) → S) (Γ : GraphDrawing (sphereWallGraph θ) S) + (hE : ∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val + = f '' rectangularGridLine e.val) + {i j : ℕ} (hi : i+2 < 2*θ+1) (hj : j+1 < θ) (hEven : Even (i+j)) : + f '' frontier (Icc (i : ℝ) ((i : ℝ)+2) ×ˢ Icc (j : ℝ) ((j : ℝ)+1)) ⊆ Γ.drawing.U := by + have hHorizontal {q : ℕ} (hq : q < θ) {p : ℝ × ℝ} + (hx : p.1 ∈ Icc (i : ℝ) ((i : ℝ)+2)) (hy : p.2 = (q : ℝ)) : f p ∈ Γ.drawing.U := by + by_cases hCut : p.1 ≤ (i : ℝ)+1 + · apply sphereWall_horizontal_line_subset_U f Γ hE (by omega : i+1<2*θ+1) hq + exact ⟨p,⟨⟨hx.1,hCut⟩,hy⟩,rfl⟩ + · apply sphereWall_horizontal_line_subset_U f Γ hE (by omega : (i+1)+1<2*θ+1) hq + refine ⟨p,⟨⟨?_,?_⟩,hy⟩,rfl⟩ + · simpa only [Nat.cast_add,Nat.cast_one] using (le_of_not_ge hCut) + · simp only [Nat.cast_add,Nat.cast_one] + linarith [hx.2] + have hVertical {q : ℕ} (hq : q < 2*θ+1) (he : Even (q+j)) {p : ℝ × ℝ} + (hx : p.1 = (q : ℝ)) (hy : p.2 ∈ Icc (j : ℝ) ((j : ℝ)+1)) : f p ∈ Γ.drawing.U := by + exact sphereWall_vertical_line_subset_U f Γ hE hq hj he ⟨p,⟨hx,hy⟩,rfl⟩ + have hEvenRight : Even ((i+2)+j) := by + obtain ⟨k,hk⟩ := hEven + exact ⟨k+1,by omega⟩ + rintro x ⟨p,hp,rfl⟩ + rw [frontier_prod_eq,isClosed_Icc.closure_eq,isClosed_Icc.closure_eq, + frontier_Icc (by linarith : (i : ℝ) ≤ (i : ℝ)+2), + frontier_Icc (by linarith : (j : ℝ) ≤ (j : ℝ)+1)] at hp + rcases hp with ⟨hx,hy⟩ | ⟨hx,hy⟩ + · rcases hy with hy | hy + · exact hHorizontal (by omega : j<θ) hx hy + · rw [mem_singleton_iff] at hy + apply hHorizontal (q := j+1) hj hx + simpa only [Nat.cast_add,Nat.cast_one] using hy + · rcases hx with hx | hx + · exact hVertical (by omega : i<2*θ+1) hEven hx hy + · rw [mem_singleton_iff] at hx + apply hVertical hi hEvenRight (p := p) _ hy + simpa only [Nat.cast_add,Nat.cast_ofNat] using hx + +/-- The intrinsic boundary of an embedded wall brick lies in the drawing. -/ +theorem sphereWall_brick_disc_boundary_subset_U {S : Type*} + [TopologicalSpace S] [T2Space S] {θ : ℕ} + (f : (ℝ × ℝ) → S) (hf : IsEmbedding f) (Γ : GraphDrawing (sphereWallGraph θ) S) + (hE : ∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val + = f '' rectangularGridLine e.val) + {i j : ℕ} (hi : i+2 < 2*θ+1) (hj : j+1 < θ) (hEven : Even (i+j)) : + discBd (f '' (Icc (i : ℝ) ((i : ℝ)+2) ×ˢ Icc (j : ℝ) ((j : ℝ)+1))) ⊆ Γ.drawing.U := by + obtain ⟨hRect,hB⟩ := isClosedDisc_real_rectangle_with_boundary + (by linarith : (i : ℝ) < (i : ℝ)+2) (by linarith : (j : ℝ) < (j : ℝ)+1) + obtain ⟨_,hImage⟩ := isClosedDisc_image_injOn hRect hRect.isCompact + hf.continuous.continuousOn hf.injective.injOn + rw [hImage,hB] + exact sphereWall_brick_frontier_image_subset_U f Γ hE hi hj hEven + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallBrickCover.lean b/LeanPool/GraphMinor/GM16/WallBrickCover.lean new file mode 100644 index 0000000000..b73e0a49da --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallBrickCover.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +import LeanPool.GraphMinor.GM16.IntervalTiling +import Mathlib.Tactic.Ring + +/-! +# The closed bricks cover the enclosed wall disc + +Tile each full even row by `θ` width-two bricks. Tile each shortened +odd row by `θ-1` such bricks, beginning at coordinate one. Their +left bottom corners have even coordinate sum, so they are exactly +the bricks whose boundary lines the wall retains. This cover +identifies all bounded regions in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set + +/-- Every point of the enclosed disc belongs to a closed brick with +valid wall coordinates and even corner parity. -/ +theorem wallEnclosedSet_subset_bricks {θ : ℕ} (hθ : 2 ≤ θ) + {p : ℝ × ℝ} (hp : p ∈ wallEnclosedSet θ) : + ∃ i j : ℕ, i+2 < 2*θ+1 ∧ j+1 < θ ∧ Even (i+j) ∧ + p ∈ Icc (i : ℝ) ((i : ℝ)+2) ×ˢ Icc (j : ℝ) ((j : ℝ)+1) := by + obtain ⟨j,hj,hpRow⟩ := mem_iUnion₂.mp hp + have hjBound : j+1 < θ := by omega + by_cases hEven : Even j + · have hRow : p ∈ Icc (0 : ℝ) (2*(θ : ℝ)) ×ˢ Icc (j : ℝ) ((j : ℝ)+1) := by + simpa only [wallRowRight,wallRowLeft,ite_eq_left hEven,Nat.cast_mul,Nat.cast_ofNat,sub_zero] + using hpRow + have hTile := rectangle_eq_union_width_two (0 : ℝ) (j : ℝ) ((j : ℝ)+1) (by omega : 1 ≤ θ) + simp only [zero_add] at hTile + obtain ⟨k,hk,hpBrick⟩ := mem_iUnion₂.mp (hTile ▸ hRow) + refine ⟨2*k,j,by omega,hjBound,?_,?_⟩ + · obtain ⟨t,ht⟩ := hEven + exact ⟨k+t,by omega⟩ + · simpa only [Nat.cast_mul,Nat.cast_ofNat] using hpBrick + · have hRow : p ∈ Icc (1 : ℝ) (2*(θ : ℝ)-1) ×ˢ Icc (j : ℝ) ((j : ℝ)+1) := by + simpa only [wallRowRight,wallRowLeft,ite_eq_right hEven,Nat.cast_mul,Nat.cast_ofNat] using + hpRow + have hEnd : (1 : ℝ)+2*((θ-1 : ℕ) : ℝ) = 2*(θ : ℝ)-1 := by + rw [Nat.cast_sub (by omega : 1 ≤ θ),Nat.cast_one] + ring + have hTile := rectangle_eq_union_width_two (1 : ℝ) (j : ℝ) ((j : ℝ)+1) (by omega : 1 ≤ θ-1) + rw [hEnd] at hTile + obtain ⟨k,hk,hpBrick⟩ := mem_iUnion₂.mp (hTile ▸ hRow) + refine ⟨2*k+1,j,by omega,hjBound,?_,?_⟩ + · obtain ⟨t,ht⟩ := Nat.not_even_iff_odd.mp hEven + exact ⟨k+t+1,by omega⟩ + · have hCast : ((2*k+1 : ℕ) : ℝ) = 1+2*(k : ℝ) := by + push_cast + ring + simpa only [hCast] using hpBrick + +/-- Every closed brick with valid wall coordinates is contained in the +enclosed union of rows. -/ +theorem wall_brick_subset_enclosedSet {θ i j : ℕ} + (hi : i + 2 < 2 * θ + 1) (hj : j + 1 < θ) (hEven : Even (i + j)) : + Icc (i : ℝ) ((i : ℝ)+2) ×ˢ Icc (j : ℝ) ((j : ℝ)+1) ⊆ wallEnclosedSet θ := by + intro p hp + apply mem_iUnion₂.mpr + refine ⟨j,by omega,?_,hp.2⟩ + by_cases hjEven : Even j + · simp only [wallRowLeft,wallRowRight,ite_eq_left hjEven,Nat.cast_mul,Nat.cast_ofNat,sub_zero] + have hiReal : (i : ℝ)+2 ≤ 2*(θ : ℝ) := by + exact_mod_cast (show i+2 ≤ 2*θ by omega) + exact ⟨(Nat.cast_nonneg i).trans hp.1.1,hp.1.2.trans hiReal⟩ + · obtain ⟨t,ht⟩ := Nat.not_even_iff_odd.mp hjEven + obtain ⟨s,hs⟩ := hEven + have hiLow : 1 ≤ i := by omega + have hiHigh : i+2 ≤ 2*θ-1 := by omega + have hθ : 1 ≤ 2*θ := by omega + simp only [wallRowLeft,wallRowRight,ite_eq_right hjEven,Nat.cast_mul,Nat.cast_ofNat] + have hiLowReal : (1 : ℝ) ≤ (i : ℝ) := by exact_mod_cast hiLow + have hiHighReal : (i : ℝ)+2 ≤ 2*(θ : ℝ)-1 := by + have h := (show ((i+2 : ℕ) : ℝ) ≤ ((2*θ-1 : ℕ) : ℝ) by exact_mod_cast hiHigh) + simpa only [Nat.cast_add,Nat.cast_mul,Nat.cast_ofNat,Nat.cast_one,Nat.cast_sub hθ] using h + exact ⟨hiLowReal.trans hp.1.1,hp.1.2.trans hiHighReal⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallBrickInterior.lean b/LeanPool/GraphMinor/GM16/WallBrickInterior.lean new file mode 100644 index 0000000000..6902fd1aa9 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallBrickInterior.lean @@ -0,0 +1,113 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4WallDrawing +import Mathlib.Tactic.Linarith +import LeanPool.GraphMinor.GM11.Walks + +/-! +# The interiors of the wall's bricks miss its drawing + +The bounded faces of the wall in XVI (4.2), page 53, are rectangles +of width two and height one. Horizontal grid lines miss their interiors. +The only possible vertical line through an interior would be the +middle line, which the alternating parity rule deletes. These +coordinate checks supply the empty interiors used for the dials. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph + +/-- No lattice vertex lies strictly between two consecutive horizontal +lattice lines. -/ +theorem rectangularGridPoint_notMem_open_brick {m n : ℕ} + (v : Fin m × Fin n) (i j : ℕ) : + rectangularGridPoint v ∉ Ioo (i : ℝ) ((i : ℝ)+2) ×ˢ Ioo (j : ℝ) ((j : ℝ)+1) := by + intro hv + have hy : (j : ℝ) < (v.2.val : ℝ) ∧ (v.2.val : ℝ) < (j : ℝ)+1 := hv.2 + have h₁ : j < v.2.val := by exact_mod_cast hy.1 + have h₂ : v.2.val < j + 1 := by exact_mod_cast hy.2 + omega + +/-- The closed line of a wall edge misses every brick interior whose +left bottom corner has even coordinate sum. -/ +theorem sphereWall_edge_disjoint_open_brick {θ : ℕ} + {e : Sym2 (Fin (2 * θ + 1) × Fin θ)} (he : e ∈ (sphereWallSimpleGraph θ).edgeSet) + (i j : ℕ) (hEven : Even (i + j)) : + Disjoint (rectangularGridLine e) + (Ioo (i : ℝ) ((i : ℝ)+2) ×ˢ Ioo (j : ℝ) ((j : ℝ)+1)) := by + apply Set.disjoint_left.mpr + intro x hx hxB + have heGrid : e ∈ (pathGraph (2 * θ + 1) □ pathGraph θ).edgeSet := + (SimpleGraph.edgeSet_mono (sphereWallSimpleGraph_le_rectangular θ)) he + rcases rectangularGridLine_spec heGrid with ⟨k,l,_,_,hLine⟩ | ⟨k,l,hb,heq,hLine⟩ + · rw [hLine] at hx + have hy : x.2 = (l.val : ℝ) := hx.2 + have h₁ : j < l.val := by exact_mod_cast (hy ▸ hxB.2.1) + have h₂ : l.val < j + 1 := by exact_mod_cast (hy ▸ hxB.2.2) + omega + · rw [hLine] at hx + have hxk : x.1 = (k.val : ℝ) := hx.1 + have h₁ : i < k.val := by exact_mod_cast (hxk ▸ hxB.1.1) + have h₂ : k.val < i+2 := by exact_mod_cast (hxk ▸ hxB.1.2) + have hk : k.val = i+1 := by omega + have hl₁ : (l.val : ℝ) < (j : ℝ)+1 := lt_of_le_of_lt hx.2.1 hxB.2.2 + have hl₂ : (j : ℝ) < (l.val : ℝ)+1 := lt_of_lt_of_le hxB.2.1 hx.2.2 + have hl₁' : l.val < j + 1 := by exact_mod_cast hl₁ + have hl₂' : j < l.val+1 := by exact_mod_cast hl₂ + have hl : l.val = j := by omega + rw [heq] at he + have hAdj : (sphereWallSimpleGraph θ).Adj (k,l) (k,⟨l.val+1,hb⟩) := he + have hEven' : Even (k.val+l.val) := by + rcases hAdj with ⟨hEq,_⟩ | ⟨_,hStep⟩ + · have h := congrArg Fin.val hEq + simp only at h + omega + · rcases hStep with ⟨_,h⟩ | ⟨h,_⟩ + · exact h + · simp only at h + omega + obtain ⟨a,ha⟩ := hEven + obtain ⟨b,hb⟩ := hEven' + omega + +/-- The open bricks miss the point set of the wall drawing, also after +embedding the coordinate plane in a sphere. -/ +theorem sphereWall_drawing_disjoint_open_brick {S : Type*} + [TopologicalSpace S] {θ : ℕ} + (f : (ℝ × ℝ) → S) (hf : Function.Injective f) + (Γ : GraphMinor.Surface.GraphDrawing (sphereWallGraph θ) S) + (hV : Γ.drawing.V = range (f ∘ @rectangularGridPoint (2 * θ + 1) θ)) + (hE : ∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val = + f '' rectangularGridLine e.val) + (i j : ℕ) (hEven : Even (i + j)) : + Disjoint Γ.drawing.U + (f '' (Ioo (i : ℝ) ((i : ℝ)+2) ×ˢ Ioo (j : ℝ) ((j : ℝ)+1))) := by + apply Set.disjoint_left.mpr + rintro x hx ⟨y,hy,hxy⟩ + rw [Γ.drawing.U_eq] at hx + rcases hx with hx | hx + · obtain ⟨v,hv⟩ := hV ▸ hx + have heq : rectangularGridPoint v = y := hf (hv.trans hxy.symm) + exact rectangularGridPoint_notMem_open_brick v i j (heq.symm ▸ hy) + · obtain ⟨e,he,hxe⟩ := mem_iUnion₂.mp hx + let e₀ : E(sphereWallGraph θ) := Γ.iso.edgeEquiv.symm ⟨e,he⟩ + have hmap : (Γ.iso.edgeEquiv e₀).val = e := + congrArg Subtype.val (Γ.iso.edgeEquiv.apply_symm_apply ⟨e,he⟩) + have heLine : x ∈ f '' rectangularGridLine e₀.val := by + rw [← hE e₀, hmap] + exact hxe + obtain ⟨z,hz,hzx⟩ := heLine + have hzy : z = y := hf (hzx.trans hxy.symm) + exact (Set.disjoint_left.mp (sphereWall_edge_disjoint_open_brick e₀.property i j hEven)) + hz (hzy.symm ▸ hy) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallBrickOuterLines.lean b/LeanPool/GraphMinor/GM16/WallBrickOuterLines.lean new file mode 100644 index 0000000000..01b2273cc2 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallBrickOuterLines.lean @@ -0,0 +1,81 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +import LeanPool.GraphMinor.GM16.WallLeftBrickLines +import LeanPool.GraphMinor.GM16.WallMiddleBrickLines +import LeanPool.GraphMinor.GM16.WallReflection +import LeanPool.GraphMinor.GM16.LineImageEmbedding +import Mathlib.Tactic.Linarith + +/-! +# Common boundary lines between a brick and the outside face + +Leftmost bricks have the boundary lines already constructed. +Middle bricks can meet the outside only at the top or bottom. +Reflect a rightmost brick to a leftmost one. These cases cover all +bricks and supply the remaining common-face-line geometry for +the rigidity assertion in XVI (4.2), page 53. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- Any two distinct points common to a closed brick and the outer +boundary can be joined within their intersection by a line. -/ +theorem exists_line_in_brick_outer_intersection {θ i j : ℕ} + (hθ : 4 ≤ θ) (hEven : Even θ) (hi : i + 2 < 2 * θ + 1) (hj : j + 1 < θ) + (hParity : Even (i + j)) {a b : ℝ × ℝ} (hab : a ≠ b) + (ha : a ∈ (Icc (i : ℝ) ((i : ℝ) + 2) ×ˢ Icc (j : ℝ) ((j : ℝ) + 1)) ∩ frontier + (wallEnclosedSet θ)) + (hb : b ∈ (Icc (i : ℝ) ((i : ℝ) + 2) ×ˢ Icc (j : ℝ) ((j : ℝ) + 1)) ∩ frontier + (wallEnclosedSet θ)) : + ∃ K, IsLineWithEnds K a b ∧ + K ⊆ (Icc (i : ℝ) ((i : ℝ)+2) ×ˢ Icc (j : ℝ) ((j : ℝ)+1)) ∩ frontier (wallEnclosedSet θ) := by + by_cases hiLeft : i ≤ 1 + · exact exists_line_in_left_brick_outer_intersection hθ hEven hiLeft hj hParity hab ha hb + by_cases hiMiddle : i+4 ≤ 2*θ + · exact exists_line_in_middle_brick_outer_intersection hθ hEven (by omega) hiMiddle hj hab ha hb + let k := 2*θ-(i+2) + have hk : k ≤ 1 := by dsimp only [k]; omega + have hki : k+i+2=2*θ := by dsimp only [k]; omega + have hkiReal : (k : ℝ)+(i : ℝ)+2=2*(θ : ℝ) := by exact_mod_cast hki + have hkParity : Even (k+j) := by + obtain ⟨t,ht⟩ := hParity + exact ⟨θ+j-t-1,by omega⟩ + let σ := wallHorizontalReflection θ + let B := Icc (i : ℝ) ((i : ℝ)+2) ×ˢ Icc (j : ℝ) ((j : ℝ)+1) + let B' := Icc (k : ℝ) ((k : ℝ)+2) ×ˢ Icc (j : ℝ) ((j : ℝ)+1) + have hRect : σ '' B' = B := by + rw [wallHorizontalReflection_image_rectangle] + rw [show 2*(θ : ℝ)-((k : ℝ)+2)=(i : ℝ) by linarith, + show 2*(θ : ℝ)-(k : ℝ)=(i : ℝ)+2 by linarith] + have hInter : σ '' (B' ∩ frontier (wallEnclosedSet θ)) = B ∩ frontier (wallEnclosedSet θ) := by + rw [image_inter σ.injective,hRect,wallHorizontalReflection_frontier] + have hSource (p : ℝ × ℝ) (hp : p ∈ B ∩ frontier (wallEnclosedSet θ)) : + σ p ∈ B' ∩ frontier (wallEnclosedSet θ) := by + constructor + · change (↑k ≤ 2*(θ : ℝ)-p.1 ∧ 2*(θ : ℝ)-p.1 ≤ ↑k+2) ∧ + p.2 ∈ Icc (j : ℝ) ((j : ℝ)+1) + exact ⟨⟨by linarith [hp.1.1.2],by linarith [hp.1.1.1]⟩,hp.1.2⟩ + · exact wallHorizontalReflection_frontier θ ▸ mem_image_of_mem σ hp.2 + obtain ⟨K,hK,hSub⟩ := exists_line_in_left_brick_outer_intersection hθ hEven hk hj hkParity + (fun he => hab (σ.injective he)) (hSource a ha) (hSource b hb) + refine ⟨σ '' K,?_,?_⟩ + · have hLine := isLineWithEnds_image_embedding σ.isEmbedding hK + have haσ : σ (σ a)=a := wallHorizontalReflection_involutive θ a + have hbσ : σ (σ b)=b := wallHorizontalReflection_involutive θ b + rw [haσ,hbσ] at hLine + exact hLine + · rw [← hInter] + exact image_mono hSub + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallBrickRegion.lean b/LeanPool/GraphMinor/GM16/WallBrickRegion.lean new file mode 100644 index 0000000000..69938a04c0 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallBrickRegion.lean @@ -0,0 +1,48 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4WallDrawing +import LeanPool.GraphMinor.GM16.WallBrickBoundary +import LeanPool.GraphMinor.GM16.WallBrickInterior +import LeanPool.GraphMinor.GM16.RectangularDisc +import LeanPool.GraphMinor.GM16.EmptyDiscRegion +import Mathlib.Tactic.Linarith + +/-! +# The bounded faces of the wall + +Each closed brick is a disc. Its boundary lies in the drawing and +its interior misses the drawing, so that interior is a region with +the closed brick as its closure. This supplies the bounded face +closures for the rigidity check in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology Surface + +/-- Every brick interior is a region of the sphere wall drawing, +with the prescribed embedded closed rectangle as its closure. -/ +theorem sphereWall_brick_is_region {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {θ : ℕ} (f : (ℝ × ℝ) → S) (hf : IsEmbedding f) + (Γ : GraphDrawing (sphereWallGraph θ) S) + (hV : Γ.drawing.V = range (f ∘ @rectangularGridPoint (2 * θ + 1) θ)) + (hE : ∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val + = f '' rectangularGridLine e.val) + {i j : ℕ} (hi : i + 2 < 2 * θ + 1) (hj : j + 1 < θ) (hEven : Even (i + j)) : + let C := f '' (Icc (i : ℝ) ((i : ℝ) + 2) ×ˢ Icc (j : ℝ) ((j : ℝ) + 1)) + interior C ∈ Γ.drawing.R ∧ closure (interior C) = C := by + apply empty_disc_is_region hS + (isClosedDisc_image_real_rectangle hf (by linarith) (by linarith)) + (sphereWall_brick_disc_boundary_subset_U f hf Γ hE hi hj hEven) + exact ((sphereWall_drawing_disjoint_open_brick f hf.injective Γ hV hE i j hEven).symm).mono_left + (interior_image_rectangle_subset hf _ _ _ _) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallDrawingEnclosed.lean b/LeanPool/GraphMinor/GM16/WallDrawingEnclosed.lean new file mode 100644 index 0000000000..e4ae14038c --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallDrawingEnclosed.lean @@ -0,0 +1,85 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4WallDrawing +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +import LeanPool.GraphMinor.GM16.WallRowsEnclosed +import LeanPool.GraphMinor.GM11.Walks + +/-! +# The whole even wall is inside its enclosed disc + +The row and side inclusions cover all coordinates of wall vertices +and all closed unit edge lines. The specified vertex and edge maps +of the sphere drawing therefore place its entire support in the +embedded enclosed disc. This makes the complementary disc empty +of drawing in its interior, as required for the outer face of +XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph SimpleGraph Topology Surface + +/-- Every closed edge line of an even-height wall lies in its enclosed disc. -/ +theorem sphereWall_line_subset_enclosed {θ : ℕ} (hθ : 2 ≤ θ) (hEven : Even θ) + {e : Sym2 (Fin (2 * θ + 1) × Fin θ)} (he : e ∈ (sphereWallSimpleGraph θ).edgeSet) : + rectangularGridLine e ⊆ wallEnclosedSet θ := by + have heGrid := SimpleGraph.edgeSet_mono (sphereWallSimpleGraph_le_rectangular θ) he + rcases rectangularGridLine_spec heGrid with ⟨k,l,hb,_,hLine⟩ | ⟨k,l,hb,heq,hLine⟩ + · rw [hLine] + rintro p ⟨hx,hy⟩ + apply wall_horizontal_row_subset_enclosed hEven l.isLt + have hTop : (k.val : ℝ)+1 ≤ 2*(θ : ℝ) := by + exact_mod_cast (show k.val+1 ≤ 2 * θ by omega) + exact ⟨⟨(Nat.cast_nonneg k.val).trans hx.1,hx.2.trans hTop⟩,hy⟩ + · have hParity : Even (k.val+l.val) := by + rw [heq] at he + have hAdj : (sphereWallSimpleGraph θ).Adj (k,l) (k,⟨l.val+1,hb⟩) := he + rcases hAdj with ⟨hEq,_⟩ | ⟨_,hStep⟩ + · have h := congrArg Fin.val hEq + simp only at h + omega + · rcases hStep with ⟨_,h⟩ | ⟨h,_⟩ + · exact h + · simp only at h + omega + rw [hLine] + exact wall_vertical_side_subset_enclosed hθ k.isLt hb hParity + +/-- The coordinate sphere drawing of an even-height wall is contained +in the embedded disc enclosed by its brick rows. -/ +theorem sphereWall_drawing_subset_enclosed {S : Type*} [TopologicalSpace S] + {θ : ℕ} (hθ : 2 ≤ θ) (hEven : Even θ) + (f : (ℝ × ℝ) → S) (Γ : GraphDrawing (sphereWallGraph θ) S) + (hV : Γ.drawing.V = range (f ∘ @rectangularGridPoint (2 * θ + 1) θ)) + (hE : ∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val + = f '' rectangularGridLine e.val) : + Γ.drawing.U ⊆ f '' wallEnclosedSet θ := by + intro x hx + rw [Γ.drawing.U_eq] at hx + rcases hx with hx | hx + · obtain ⟨v,hv⟩ := hV ▸ hx + have hSource : rectangularGridPoint v ∈ wallEnclosedSet θ := by + apply wall_horizontal_row_subset_enclosed hEven v.2.isLt + have hi : (v.1.val : ℝ) ≤ 2*(θ : ℝ) := by + exact_mod_cast (show v.1.val ≤ 2 * θ by omega) + exact ⟨⟨Nat.cast_nonneg _,hi⟩,rfl⟩ + exact ⟨rectangularGridPoint v,hSource,hv⟩ + · obtain ⟨e,he,hxe⟩ := mem_iUnion₂.mp hx + let e₀ : E(sphereWallGraph θ) := Γ.iso.edgeEquiv.symm ⟨e,he⟩ + have hmap : (Γ.iso.edgeEquiv e₀).val = e := + congrArg Subtype.val (Γ.iso.edgeEquiv.apply_symm_apply ⟨e,he⟩) + have hxLine : x ∈ f '' rectangularGridLine e₀.val := by + rw [← hE e₀,hmap] + exact hxe + exact image_mono (sphereWall_line_subset_enclosed hθ hEven e₀.property) hxLine + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallEdgeInDrawing.lean b/LeanPool/GraphMinor/GM16/WallEdgeInDrawing.lean new file mode 100644 index 0000000000..137abf25d8 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallEdgeInDrawing.lean @@ -0,0 +1,68 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4WallDrawing +import LeanPool.GraphMinor.GM11.Walks + +/-! +# The retained lattice lines belong to the wall drawing + +The graph isomorphism for the coordinate drawing identifies each +edge closure with its retained unit lattice line. In particular, +all horizontal lines and the even vertical lines belong to its +support. These are the sides of the closed brick faces in the +rigidity check for XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology Surface + +/-- Every horizontal unit line of the wall lies in its drawing. -/ +theorem sphereWall_horizontal_line_subset_U {S : Type*} [TopologicalSpace S] + {θ : ℕ} (f : (ℝ × ℝ) → S) (Γ : GraphDrawing (sphereWallGraph θ) S) + (hE : ∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val + = f '' rectangularGridLine e.val) + {i j : ℕ} (hi : i+1 < 2*θ+1) (hj : j < θ) : + f '' horizontalLatticeLine i j ⊆ Γ.drawing.U := by + let v : Fin (2*θ+1) × Fin θ := (⟨i,by omega⟩,⟨j,hj⟩) + let w : Fin (2*θ+1) × Fin θ := (⟨i+1,hi⟩,⟨j,hj⟩) + let e : E(sphereWallGraph θ) := ⟨s(v,w),Or.inl ⟨rfl,Or.inl rfl⟩⟩ + have hLine : rectangularGridLine e.val = horizontalLatticeLine i j := by + change rectangularGridLinePair v w = _ + simp only [rectangularGridLinePair,v,w,ite_true,min_self] + rw [min_eq_left (Nat.le_succ i)] + have hSub := Γ.drawing.closure_subset_U (Γ.iso.edgeEquiv e).property + rwa [hE e,hLine] at hSub + +/-- A vertical unit line retained by the parity rule lies in the drawing. -/ +theorem sphereWall_vertical_line_subset_U {S : Type*} [TopologicalSpace S] + {θ : ℕ} (f : (ℝ × ℝ) → S) (Γ : GraphDrawing (sphereWallGraph θ) S) + (hE : ∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val + = f '' rectangularGridLine e.val) + {i j : ℕ} (hi : i < 2*θ+1) (hj : j+1 < θ) (hEven : Even (i+j)) : + f '' verticalLatticeLine i j ⊆ Γ.drawing.U := by + let v : Fin (2*θ+1) × Fin θ := (⟨i,hi⟩,⟨j,by omega⟩) + let w : Fin (2*θ+1) × Fin θ := (⟨i,hi⟩,⟨j+1,hj⟩) + let e : E(sphereWallGraph θ) := ⟨s(v,w),Or.inr ⟨rfl,Or.inl ⟨rfl,hEven⟩⟩⟩ + have hNe : v.2 ≠ w.2 := by + intro he + have h := congrArg Fin.val he + change j = j+1 at h + omega + have hLine : rectangularGridLine e.val = verticalLatticeLine i j := by + change rectangularGridLinePair v w = _ + rw [rectangularGridLinePair,ite_eq_right hNe] + dsimp only [v,w] + rw [min_self,min_eq_left (Nat.le_succ j)] + have hSub := Γ.drawing.closure_subset_U (Γ.iso.edgeEquiv e).property + rwa [hE e,hLine] at hSub + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallEnclosedBoundary.lean b/LeanPool/GraphMinor/GM16/WallEnclosedBoundary.lean new file mode 100644 index 0000000000..bcb7d39884 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallEnclosedBoundary.lean @@ -0,0 +1,59 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4WallDrawing +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +import LeanPool.GraphMinor.GM16.WallBrickCover +import LeanPool.GraphMinor.GM16.WallBrickBoundary +import LeanPool.GraphMinor.GM16.RectangularDisc +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.Surface.Wedge +import Mathlib.Tactic.Linarith + +/-! +# The outer boundary of the enclosed wall disc + +The closed bricks cover the enclosed disc. A boundary point of +that disc belongs to a brick and cannot be interior to it. It +therefore belongs to the brick boundary, which lies in the wall +drawing. This gives the drawing boundary needed for the outside +face in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology Surface + +/-- The intrinsic boundary of the enclosed wall disc lies in the drawing. -/ +theorem sphereWall_enclosed_boundary_subset_U {S : Type*} + [TopologicalSpace S] [T2Space S] (hS : IsClosedSurface S) {θ : ℕ} (hθ : 2 ≤ θ) + (f : (ℝ × ℝ) → S) (hf : IsEmbedding f) (Γ : GraphDrawing (sphereWallGraph θ) S) + (hE : ∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val + = f '' rectangularGridLine e.val) : + discBd (f '' wallEnclosedSet θ) ⊆ Γ.drawing.U := by + have hDisc := isClosedDisc_image_wallEnclosedSet hS hf hθ + intro x hx + obtain ⟨p,hp,rfl⟩ := Surface.discBd_subset _ hx + obtain ⟨i,j,hi,hj,hEven,hpBrick⟩ := wallEnclosedSet_subset_bricks hθ hp + let B := f '' (Icc (i : ℝ) ((i : ℝ)+2) ×ˢ Icc (j : ℝ) ((j : ℝ)+1)) + have hB : IsClosedDisc B := isClosedDisc_image_real_rectangle hf (by linarith) (by linarith) + have hBBoundary : f p ∈ discBd B := by + rw [← GM11.IsClosedDisc.frontier_eq_discBd hS hB] + refine ⟨subset_closure (mem_image_of_mem f hpBrick),?_⟩ + intro hpInt + have hBSub : B ⊆ f '' wallEnclosedSet θ := image_mono (wall_brick_subset_enclosedSet hi hj + hEven) + have hpOuterInt := interior_mono hBSub hpInt + have hpOuterFr : f p ∈ frontier (f '' wallEnclosedSet θ) := + (GM11.IsClosedDisc.frontier_eq_discBd hS hDisc).symm ▸ hx + exact hpOuterFr.2 hpOuterInt + exact sphereWall_brick_disc_boundary_subset_U f hf Γ hE hi hj hEven hBBoundary + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallEnclosedCoordinates.lean b/LeanPool/GraphMinor/GM16/WallEnclosedCoordinates.lean new file mode 100644 index 0000000000..545263c39a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallEnclosedCoordinates.lean @@ -0,0 +1,79 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +import LeanPool.GraphMinor.GM16.IntervalTiling +import Mathlib.Tactic.Linarith + +/-! +# Coordinate bounds for the enclosed wall disc + +All rows lie in the full outer rectangle and contain the same +central rectangle. Inside an open unit-height strip, a point of +the enclosed disc belongs to that strip's unique row. These +coordinate facts locate the portions of a brick boundary that +can meet the outside face in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set + +/-- Global coordinate bounds for the enclosed row stack. -/ +theorem wallEnclosedSet_bounds {θ : ℕ} {p : ℝ × ℝ} (hp : p ∈ wallEnclosedSet θ) : + 0 ≤ p.1 ∧ p.1 ≤ 2*(θ : ℝ) ∧ 0 ≤ p.2 ∧ p.2 ≤ ((θ-1 : ℕ) : ℝ) := by + have hTop := rectangleStack_vertical_le hp + obtain ⟨j,_,hpRow⟩ := mem_iUnion₂.mp hp + have hLeft := wallRowLeft_bounds j + have hxRight : wallRowRight θ j ≤ 2*(θ : ℝ) := by + dsimp only [wallRowRight] + simp only [Nat.cast_mul,Nat.cast_ofNat] + linarith [hLeft.1] + exact ⟨hLeft.1.trans hpRow.1.1,hpRow.1.2.trans hxRight, + (Nat.cast_nonneg j).trans hpRow.2.1,hTop⟩ + +/-- Every row contains the common central horizontal interval. -/ +theorem central_rectangle_subset_wallEnclosedSet {θ : ℕ} (hθ : 2 ≤ θ) : + Icc (1 : ℝ) (2*(θ : ℝ)-1) ×ˢ Icc (0 : ℝ) ((θ-1 : ℕ) : ℝ) ⊆ wallEnclosedSet θ := by + rintro p ⟨hx,hy⟩ + have hTile := interval_eq_union_unit (by omega : 1 ≤ θ-1) + obtain ⟨j,hj,hyRow⟩ := mem_iUnion₂.mp (hTile ▸ hy) + apply mem_iUnion₂.mpr + refine ⟨j,hj,?_,hyRow⟩ + have hLeft := wallRowLeft_bounds j + have hRight : 2*(θ : ℝ)-1 ≤ wallRowRight θ j := by + dsimp only [wallRowRight] + simp only [Nat.cast_mul,Nat.cast_ofNat] + linarith [hLeft.2] + exact ⟨hLeft.2.trans hx.1,hx.2.trans hRight⟩ + +/-- Within an open unit-height strip, only its own row of rectangles +can contain a point of the enclosed disc. -/ +theorem wallEnclosedSet_mem_open_strip {θ j : ℕ} {p : ℝ × ℝ} + (hp : p ∈ wallEnclosedSet θ) (hy : p.2 ∈ Ioo (j : ℝ) ((j : ℝ) + 1)) : + j < θ-1 ∧ p.1 ∈ Icc (wallRowLeft j) (wallRowRight θ j) := by + obtain ⟨k,hk,hRow⟩ := mem_iUnion₂.mp hp + have hk₁ : k < j+1 := by exact_mod_cast (lt_of_le_of_lt hRow.2.1 hy.2) + have hk₂ : j < k+1 := by exact_mod_cast (lt_of_lt_of_le hy.1 hRow.2.2) + have hkj : k = j := by omega + subst k + exact ⟨hk,hRow.1⟩ + +/-- The common central open rectangle is inside the interior of the +enclosed wall disc. -/ +theorem central_open_rectangle_subset_interior_wallEnclosedSet {θ : ℕ} (hθ : 2 ≤ θ) : + Ioo (1 : ℝ) (2*(θ : ℝ)-1) ×ˢ Ioo (0 : ℝ) ((θ-1 : ℕ) : ℝ) ⊆ + interior (wallEnclosedSet θ) := by + apply interior_maximal _ (isOpen_Ioo.prod isOpen_Ioo) + intro p hp + exact central_rectangle_subset_wallEnclosedSet hθ + ⟨Ioo_subset_Icc_self hp.1,Ioo_subset_Icc_self hp.2⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallEnclosedDisc.lean b/LeanPool/GraphMinor/GM16/WallEnclosedDisc.lean new file mode 100644 index 0000000000..e99b932399 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallEnclosedDisc.lean @@ -0,0 +1,70 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.RectangleStack +public import LeanPool.GraphMinor.Surface.Defs +import LeanPool.GraphMinor.GM16.RectangleStackDisc +import Mathlib.Algebra.Ring.Parity +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.NormNum + +/-! +# The disc enclosed by the wall's outer boundary + +In each even row the bricks fill the horizontal interval from zero +to `2θ`. In each odd row they fill the interval from one to `2θ-1`. +Stacking those rectangles gives a disc, since consecutive rows +have an overlap of positive length when `θ ≥ 2`. This is the +bounded side of the outer boundary in the rigidity check of +XVI (4.2), page 53. +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- The left side of a row of wall bricks. -/ +def wallRowLeft (k : ℕ) : ℝ := if Even k then 0 else 1 + +/-- The right side of a row of wall bricks. -/ +def wallRowRight (θ k : ℕ) : ℝ := ((2*θ : ℕ) : ℝ) - wallRowLeft k + +/-- The union of the closed brick rows, enclosed by the outer wall boundary. -/ +def wallEnclosedSet (θ : ℕ) : Set (ℝ × ℝ) := + rectangleStack wallRowLeft (wallRowRight θ) (θ-1) + +/-- Every row starts between zero and one. -/ +theorem wallRowLeft_bounds (k : ℕ) : 0 ≤ wallRowLeft k ∧ wallRowLeft k ≤ 1 := by + unfold wallRowLeft + split_ifs <;> norm_num + +/-- The closed brick rows form a disc in the coordinate embedding. -/ +theorem isClosedDisc_image_wallEnclosedSet {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) {f : (ℝ × ℝ) → S} (hf : IsEmbedding f) + {θ : ℕ} (hθ : 2 ≤ θ) : IsClosedDisc (f '' wallEnclosedSet θ) := by + have hθReal : (4 : ℝ) ≤ ((2*θ : ℕ) : ℝ) := by + exact_mod_cast (show 4 ≤ 2*θ by omega) + have hWidth (k : ℕ) : wallRowLeft k < wallRowRight θ k := by + dsimp only [wallRowRight] + linarith [(wallRowLeft_bounds k).2] + have hRight (k : ℕ) : ((2*θ : ℕ) : ℝ)-1 ≤ wallRowRight θ k := by + dsimp only [wallRowRight] + linarith [(wallRowLeft_bounds k).2] + have hOverlap (k : ℕ) : max (wallRowLeft k) (wallRowLeft (k+1)) < + min (wallRowRight θ k) (wallRowRight θ (k+1)) := by + have hMax : max (wallRowLeft k) (wallRowLeft (k+1)) ≤ 1 := + max_le (wallRowLeft_bounds k).2 (wallRowLeft_bounds (k+1)).2 + have hMin : ((2*θ : ℕ) : ℝ)-1 ≤ min (wallRowRight θ k) (wallRowRight θ (k+1)) := + le_min (hRight k) (hRight (k+1)) + linarith + exact isClosedDisc_rectangleStack hS hf wallRowLeft (wallRowRight θ) + hWidth hOverlap (by omega : 1 ≤ θ-1) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallFaceDiscs.lean b/LeanPool/GraphMinor/GM16/WallFaceDiscs.lean new file mode 100644 index 0000000000..085ae777af --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallFaceDiscs.lean @@ -0,0 +1,72 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4WallDrawing +import LeanPool.GraphMinor.GM16.WallRegions +import LeanPool.GraphMinor.GM16.WallBrickRegion +import LeanPool.GraphMinor.GM16.WallOuterRegion +import LeanPool.GraphMinor.GM16.RectangularDisc +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.Section6 +import Mathlib.Tactic.Linarith + +/-! +# Every wall face has a disc closure + +The face classification gives either a brick interior or the +outside disc interior. Each has its stated disc as closure. Since +its interior is a region, any drawing point in that closed disc +lies on the disc boundary. This verifies the disc-face hypothesis +of the rigidity criterion for the wall in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology Surface GM11 + +/-- Every region of the even wall is the interior of its disc closure. -/ +theorem sphereWall_region_closedDisc {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hSphere : IsSphere S) {θ : ℕ} + (hθ : 2 ≤ θ) (hEven : Even θ) + (f : (ℝ × ℝ) → S) (hf : IsEmbedding f) (Γ : GraphDrawing (sphereWallGraph θ) S) + (hV : Γ.drawing.V = range (f ∘ @rectangularGridPoint (2 * θ + 1) θ)) + (hE : ∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val + = f '' rectangularGridLine e.val) + {r : Set S} (hr : r ∈ Γ.drawing.R) : + IsClosedDisc (closure r) ∧ interior (closure r) = r := by + rcases sphereWall_regions_classification hS hSphere hθ hEven f hf Γ hV hE hr with hOut | hBrick + · obtain ⟨hD,_,hCl⟩ := sphereWall_outer_is_region hS hSphere hθ hEven f hf Γ hV hE + rw [hOut,hCl] + exact ⟨hD,rfl⟩ + · obtain ⟨i,j,hi,hj,hParity,hrEq⟩ := hBrick + have hCl := (sphereWall_brick_is_region hS f hf Γ hV hE hi hj hParity).2 + rw [hrEq,hCl] + exact ⟨isClosedDisc_image_real_rectangle hf (by linarith) (by linarith),rfl⟩ + +/-- The wall verifies the disc-face and empty-interior conditions of +`isRigid_of_disc_faces`. -/ +theorem sphereWall_disc_faces {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hSphere : IsSphere S) {θ : ℕ} + (hθ : 2 ≤ θ) (hEven : Even θ) + (f : (ℝ × ℝ) → S) (hf : IsEmbedding f) (Γ : GraphDrawing (sphereWallGraph θ) S) + (hV : Γ.drawing.V = range (f ∘ @rectangularGridPoint (2 * θ + 1) θ)) + (hE : ∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val + = f '' rectangularGridLine e.val) + {r : Set S} (hr : r ∈ Γ.drawing.R) : + IsClosedDisc (closure r) ∧ closure r ∩ Γ.drawing.U ⊆ discBd (closure r) := by + obtain ⟨hDisc,hInt⟩ := sphereWall_region_closedDisc hS hSphere hθ hEven f hf Γ hV hE hr + refine ⟨hDisc,?_⟩ + rintro x ⟨hx,hxU⟩ + rw [← GM11.IsClosedDisc.frontier_eq_discBd hS hDisc] + refine ⟨subset_closure hx,?_⟩ + intro hxInt + exact region_subset hr (hInt ▸ hxInt) hxU + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallHorizontalBoundary.lean b/LeanPool/GraphMinor/GM16/WallHorizontalBoundary.lean new file mode 100644 index 0000000000..2f046d56d0 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallHorizontalBoundary.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +import LeanPool.GraphMinor.GM16.WallEnclosedCoordinates +import LeanPool.GraphMinor.GM16.WallRowsEnclosed +import LeanPool.GraphMinor.GM16.LocalCoordinateBoundary +import LeanPool.GraphMinor.GM16.LineClosedExtension +import LeanPool.GraphMinor.GM16.RectangularLines +import Mathlib.Tactic.Linarith + +/-! +# Horizontal parts of the outside wall boundary + +The bottom and top rows are extreme vertical coordinates. At each +intermediate row, the short left join borders an odd strip on +one side. Points to the left of that strip are outside the enclosed +disc. Local coordinate bounds therefore put the join on the +frontier. Closedness adds its two ends. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- The short horizontal join on the left of every row is on the outer boundary. -/ +theorem wall_left_horizontal_join_subset_frontier {θ j : ℕ} + (hθ : 2 ≤ θ) (hEven : Even θ) (hj : j < θ) : + Icc (0 : ℝ) 1 ×ˢ {(j : ℝ)} ⊆ frontier (wallEnclosedSet θ) := by + apply line_subset_closed_of_open_part_subset + (horizontal_interval_isLine (by norm_num : (0 : ℝ)<1) (j : ℝ)) isClosed_frontier + rintro p ⟨hp,hnEnds⟩ + have hpLt : p.1 < 1 := by + apply lt_of_le_of_ne hp.1.2 + intro he + exact hnEnds (Or.inr (mem_singleton_iff.mpr (Prod.ext he hp.2))) + have hθReal : (1 : ℝ) ≤ 2*(θ : ℝ) := by exact_mod_cast (show 1≤2*θ by omega) + have hpC : p ∈ wallEnclosedSet θ := wall_horizontal_row_subset_enclosed hEven hj + ⟨⟨hp.1.1,hp.1.2.trans hθReal⟩,hp.2⟩ + refine ⟨subset_closure hpC,?_⟩ + by_cases hj0 : j = 0 + · subst j + apply not_mem_interior_of_local_coordinate_min isOpen_univ isOpenMap_snd (mem_univ p) hp.2 + intro q hq + simpa only [Nat.cast_zero] using (wallEnclosedSet_bounds hq.1).2.2.1 + by_cases hjEven : Even j + · have hk : j-1+1=j := by omega + have hkOdd : ¬Even (j-1) := by + intro h + obtain ⟨a,ha⟩ := hjEven + obtain ⟨b,hb⟩ := h + omega + have hkReal : ((j-1 : ℕ) : ℝ)+1 = (j : ℝ) := by exact_mod_cast hk + let O : Set (ℝ × ℝ) := {q | q.1 < 1 ∧ ((j-1 : ℕ) : ℝ) < q.2} + have hO : IsOpen O := (isOpen_Iio.preimage continuous_fst).inter (isOpen_Ioi.preimage + continuous_snd) + have hpO : p ∈ O := ⟨hpLt,by rw [hp.2,← hkReal]; linarith⟩ + apply not_mem_interior_of_local_coordinate_min hO isOpenMap_snd hpO hp.2 + intro q hq + by_contra hLow + have hy : q.2 ∈ Ioo ((j-1 : ℕ) : ℝ) (((j-1 : ℕ) : ℝ)+1) := + ⟨hq.2.2,by rw [hkReal]; exact lt_of_not_ge hLow⟩ + have hLeft := (wallEnclosedSet_mem_open_strip hq.1 hy).2.1 + simp only [wallRowLeft,ite_eq_right hkOdd] at hLeft + exact (not_lt_of_ge hLeft) hq.2.1 + · let O : Set (ℝ × ℝ) := {q | q.1 < 1 ∧ q.2 < (j : ℝ)+1} + have hO : IsOpen O := (isOpen_Iio.preimage continuous_fst).inter (isOpen_Iio.preimage + continuous_snd) + have hpO : p ∈ O := ⟨hpLt,by rw [hp.2]; linarith⟩ + apply not_mem_interior_of_local_coordinate_max hO isOpenMap_snd hpO hp.2 + intro q hq + by_contra hHigh + have hy : q.2 ∈ Ioo (j : ℝ) ((j : ℝ)+1) := ⟨lt_of_not_ge hHigh,hq.2.2⟩ + have hLeft := (wallEnclosedSet_mem_open_strip hq.1 hy).2.1 + simp only [wallRowLeft,ite_eq_right hjEven] at hLeft + exact (not_lt_of_ge hLeft) hq.2.1 + +/-- The bottom horizontal row is on the outer boundary. -/ +theorem wall_bottom_row_subset_frontier {θ : ℕ} (hθ : 2 ≤ θ) (hEven : Even θ) : + Icc (0 : ℝ) (2*(θ : ℝ)) ×ˢ {(0 : ℝ)} ⊆ frontier (wallEnclosedSet θ) := by + intro p hp + have hpC := wall_horizontal_row_subset_enclosed hEven (by omega : 0<θ) + (show p ∈ Icc (0 : ℝ) (2*(θ : ℝ)) ×ˢ {((0 : ℕ) : ℝ)} from by simpa only [Nat.cast_zero] using + hp) + refine ⟨subset_closure hpC,?_⟩ + apply not_mem_interior_of_local_coordinate_min isOpen_univ isOpenMap_snd (mem_univ p) hp.2 + intro q hq + exact (wallEnclosedSet_bounds hq.1).2.2.1 + +/-- The top horizontal row is on the outer boundary. -/ +theorem wall_top_row_subset_frontier {θ : ℕ} (hθ : 2 ≤ θ) (hEven : Even θ) : + Icc (0 : ℝ) (2*(θ : ℝ)) ×ˢ {((θ-1 : ℕ) : ℝ)} ⊆ frontier (wallEnclosedSet θ) := by + intro p hp + have hpC := wall_horizontal_row_subset_enclosed hEven (by omega : θ-1<θ) hp + refine ⟨subset_closure hpC,?_⟩ + apply not_mem_interior_of_local_coordinate_max isOpen_univ isOpenMap_snd (mem_univ p) hp.2 + intro q hq + exact (wallEnclosedSet_bounds hq.1).2.2.2 + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallLeftBrickLines.lean b/LeanPool/GraphMinor/GM16/WallLeftBrickLines.lean new file mode 100644 index 0000000000..16c765907e --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallLeftBrickLines.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +import LeanPool.GraphMinor.GM16.WallLeftEvenArc +import LeanPool.GraphMinor.GM16.WallLeftOddArc +import LeanPool.GraphMinor.GM16.SublineBetween + +/-! +# Common outside-face lines for the leftmost bricks + +The parity rule puts a leftmost brick at coordinate zero in an +even row and at coordinate one in an odd row. The preceding +calculations give a line as the whole intersection with the outer +boundary. Taking a subline joins any two distinct common points, +as required by the rigidity criterion in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- Distinct outside boundary points of a leftmost brick can be joined +inside their common boundary. -/ +theorem exists_line_in_left_brick_outer_intersection {θ i j : ℕ} + (hθ : 4 ≤ θ) (hEven : Even θ) (hi : i ≤ 1) (hj : j + 1 < θ) (hParity : Even (i + j)) + {a b : ℝ × ℝ} (hab : a ≠ b) + (ha : a ∈ (Icc (i : ℝ) ((i : ℝ) + 2) ×ˢ Icc (j : ℝ) ((j : ℝ) + 1)) ∩ frontier + (wallEnclosedSet θ)) + (hb : b ∈ (Icc (i : ℝ) ((i : ℝ) + 2) ×ˢ Icc (j : ℝ) ((j : ℝ) + 1)) ∩ frontier + (wallEnclosedSet θ)) : + ∃ K, IsLineWithEnds K a b ∧ + K ⊆ (Icc (i : ℝ) ((i : ℝ)+2) ×ˢ Icc (j : ℝ) ((j : ℝ)+1)) ∩ frontier (wallEnclosedSet θ) := by + have hArc : ∃ x y : ℝ × ℝ, IsLineWithEnds + ((Icc (i : ℝ) ((i : ℝ)+2) ×ˢ Icc (j : ℝ) ((j : ℝ)+1)) ∩ frontier (wallEnclosedSet θ)) x y + := by + by_cases hi0 : i=0 + · subst i + have hjEven : Even j := by simpa only [Nat.zero_add] using hParity + simpa only [Nat.cast_zero,zero_add] using wall_left_even_brick_outer_intersection_isLine hθ + hEven hj hjEven + · have hi1 : i=1 := by omega + subst i + have hjOdd : ¬Even j := by + intro hjEven + obtain ⟨x,hx⟩ := hParity + obtain ⟨y,hy⟩ := hjEven + omega + simpa only [Nat.cast_one,show (1 : ℝ)+2=3 by norm_num] using + wall_left_odd_brick_outer_intersection_isLine hθ hEven hj hjOdd + obtain ⟨x,y,hLine⟩ := hArc + exact exists_subline_between hLine ha hb hab + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallLeftEvenArc.lean b/LeanPool/GraphMinor/GM16/WallLeftEvenArc.lean new file mode 100644 index 0000000000..e8cc52bdb5 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallLeftEvenArc.lean @@ -0,0 +1,90 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +public import LeanPool.GraphMinor.GM16.LeftRectangleArc +import LeanPool.GraphMinor.GM16.WallEnclosedCoordinates +import LeanPool.GraphMinor.GM16.WallBrickCover +import LeanPool.GraphMinor.GM16.WallHorizontalBoundary +import LeanPool.GraphMinor.GM16.WallRowBoundary +import LeanPool.GraphMinor.GM16.LeftBrickArcContainment +import LeanPool.GraphMinor.GM16.FaceSubdisc +import Mathlib.Tactic.Linarith + +/-! +# The outside boundary arc of a left brick in an even row + +Its left side is on the outer boundary. Its bottom and top sides +extend one unit to the right, or two units when they are the +bottom or top of the whole wall. These three sides form a line. +The central open rectangle excludes all other brick boundary +points from the outside boundary. This checks the left even-row +case of the common-face-line condition in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- A left brick in an even row meets the outside boundary in a line. -/ +theorem wall_left_even_brick_outer_intersection_isLine {θ j : ℕ} + (hθ : 4 ≤ θ) (hEven : Even θ) (hj : j + 1 < θ) (hjEven : Even j) : + ∃ a b : ℝ × ℝ, IsLineWithEnds + ((Icc (0 : ℝ) 2 ×ˢ Icc (j : ℝ) ((j : ℝ)+1)) ∩ frontier (wallEnclosedSet θ)) a b := by + let bottom : ℝ := if (j : ℝ)=0 then 2 else 1 + let top : ℝ := if (j : ℝ)+1=((θ-1 : ℕ) : ℝ) then 2 else 1 + let K := leftRectangleBoundaryArc 0 bottom top (j : ℝ) ((j : ℝ)+1) + have hb₂ : bottom ≤ 2 := by dsimp [bottom]; split_ifs <;> norm_num + have ht₂ : top ≤ 2 := by dsimp [top]; split_ifs <;> norm_num + have hM : (3 : ℝ) < 2*(θ : ℝ) := by exact_mod_cast (show 3<2*θ by omega) + have hTwo : (2 : ℝ) ≤ 2*(θ : ℝ) := by linarith + have hTopY : (j : ℝ)+1 ≤ ((θ-1 : ℕ) : ℝ) := by + exact_mod_cast (show j+1≤θ-1 by omega) + have hLine : IsLineWithEnds K (bottom,(j : ℝ)) (top,(j : ℝ)+1) := + leftRectangleBoundaryArc_isLine + (by dsimp [bottom]; split_ifs <;> norm_num) + (by dsimp [top]; split_ifs <;> norm_num) (by linarith) + have hKBrick : K ⊆ Icc (0 : ℝ) 2 ×ˢ Icc (j : ℝ) ((j : ℝ)+1) := by + rintro p ((hp | hp) | hp) + · exact ⟨⟨hp.1.1,hp.1.2.trans hb₂⟩,⟨hp.2.ge,by rw [hp.2]; linarith⟩⟩ + · exact ⟨⟨hp.1.ge,by rw [hp.1]; norm_num⟩,hp.2⟩ + · exact ⟨⟨hp.1.1,hp.1.2.trans ht₂⟩,⟨by rw [hp.2]; linarith,hp.2.le⟩⟩ + have hKFr : K ⊆ frontier (wallEnclosedSet θ) := by + rintro p ((hp | hp) | hp) + · by_cases hBot : (j : ℝ)=0 + · apply wall_bottom_row_subset_frontier (by omega : 2≤θ) hEven + exact ⟨⟨hp.1.1,(hp.1.2.trans hb₂).trans hTwo⟩,hp.2.trans hBot⟩ + · apply wall_left_horizontal_join_subset_frontier (by omega : 2≤θ) hEven (by omega : j<θ) + simpa only [bottom,ite_eq_right hBot] using hp + · have hSide := (wall_row_vertical_sides_subset_frontier (by omega : 2≤θ) hj).1 + rw [wallRowLeft,ite_eq_left hjEven] at hSide + exact hSide hp + · by_cases hTop : (j : ℝ)+1=((θ-1 : ℕ) : ℝ) + · apply wall_top_row_subset_frontier (by omega : 2≤θ) hEven + exact ⟨⟨hp.1.1,(hp.1.2.trans ht₂).trans hTwo⟩,hp.2.trans hTop⟩ + · apply wall_left_horizontal_join_subset_frontier (by omega : 2≤θ) hEven hj + simpa only [top,ite_eq_right hTop,Nat.cast_add,Nat.cast_one] using hp + have hBC : Icc (0 : ℝ) 2 ×ˢ Icc (j : ℝ) ((j : ℝ)+1) ⊆ wallEnclosedSet θ := by + have h := wall_brick_subset_enclosedSet (by omega : 0+2<2*θ+1) hj + (show Even (0+j) by simpa only [Nat.zero_add] using hjEven) + simpa only [Nat.cast_zero,zero_add] using h + have hIntoK : (Icc (0 : ℝ) 2 ×ˢ Icc (j : ℝ) ((j : ℝ)+1)) ∩ + frontier (wallEnclosedSet θ) ⊆ K := by + rintro p hp + have hpFr := inter_frontier_subset_frontier_of_subset hBC hp + have hpOut : p ∉ Ioo (1 : ℝ) (2*(θ : ℝ)-1) ×ˢ Ioo (0 : ℝ) ((θ-1 : ℕ) : ℝ) := + fun h => hp.2.2 (central_open_rectangle_subset_interior_wallEnclosedSet (by omega : 2≤θ) h) + exact left_brick_boundary_outside_central_subset_arc hM (Nat.cast_nonneg j) hTopY hpFr hpOut + have hEq : (Icc (0 : ℝ) 2 ×ˢ Icc (j : ℝ) ((j : ℝ)+1)) ∩ + frontier (wallEnclosedSet θ) = K := subset_antisymm hIntoK + (fun _ hp => ⟨hKBrick hp,hKFr hp⟩) + exact ⟨_,_,hEq.symm ▸ hLine⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallLeftOddArc.lean b/LeanPool/GraphMinor/GM16/WallLeftOddArc.lean new file mode 100644 index 0000000000..246cc24741 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallLeftOddArc.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +import LeanPool.GraphMinor.GM16.WallEnclosedCoordinates +import LeanPool.GraphMinor.GM16.WallRowBoundary +import LeanPool.GraphMinor.GM16.RectangularLines +import Mathlib.Tactic.Linarith + +/-! +# The outside boundary of a left brick in an odd row + +An odd row is strictly between the top and bottom of an even-height +wall. The left brick begins at coordinate one. All its other +points lie in the central open rectangle, so only its left side +can meet the outside boundary. That side is already on the +frontier by the row boundary calculation. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- A left brick in an odd row meets the outside boundary in its +single vertical side. -/ +theorem wall_left_odd_brick_outer_intersection_isLine {θ j : ℕ} + (hθ : 4 ≤ θ) (hEven : Even θ) (hj : j + 1 < θ) (hjOdd : ¬Even j) : + ∃ a b : ℝ × ℝ, IsLineWithEnds + ((Icc (1 : ℝ) 3 ×ˢ Icc (j : ℝ) ((j : ℝ)+1)) ∩ frontier (wallEnclosedSet θ)) a b := by + have hjPos : 0 < j := by + obtain ⟨a,ha⟩ := Nat.not_even_iff_odd.mp hjOdd + omega + have hjTop : j+1 < θ-1 := by + obtain ⟨a,ha⟩ := Nat.not_even_iff_odd.mp hjOdd + obtain ⟨b,hb⟩ := hEven + omega + have hM : (3 : ℝ) < 2*(θ : ℝ)-1 := by + have h : (4 : ℝ) < 2*(θ : ℝ) := by exact_mod_cast (show 4<2*θ by omega) + linarith + have hLow : (0 : ℝ) < (j : ℝ) := by exact_mod_cast hjPos + have hHigh : (j : ℝ)+1 < ((θ-1 : ℕ) : ℝ) := by exact_mod_cast hjTop + have hEq : (Icc (1 : ℝ) 3 ×ˢ Icc (j : ℝ) ((j : ℝ)+1)) ∩ + frontier (wallEnclosedSet θ) = {1} ×ˢ Icc (j : ℝ) ((j : ℝ)+1) := by + apply subset_antisymm + · rintro p ⟨hp,hpFr⟩ + have hx : p.1=1 := by + apply le_antisymm _ hp.1.1 + by_contra hn + have hpCentral : p ∈ Ioo (1 : ℝ) (2*(θ : ℝ)-1) ×ˢ Ioo (0 : ℝ) ((θ-1 : ℕ) : ℝ) := + ⟨⟨lt_of_not_ge hn,hp.1.2.trans_lt hM⟩,hLow.trans_le hp.2.1,hp.2.2.trans_lt hHigh⟩ + exact hpFr.2 (central_open_rectangle_subset_interior_wallEnclosedSet + (by omega : 2≤θ) hpCentral) + exact ⟨hx,hp.2⟩ + · intro p hp + have hSide := (wall_row_vertical_sides_subset_frontier (by omega : 2≤θ) hj).1 + rw [wallRowLeft,ite_eq_right hjOdd] at hSide + exact ⟨⟨⟨hp.1.ge,by rw [hp.1]; norm_num⟩,hp.2⟩,hSide hp⟩ + refine ⟨(1,(j : ℝ)),(1,(j : ℝ)+1),?_⟩ + rw [hEq] + exact vertical_interval_isLine 1 (by linarith) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallMiddleBrickLines.lean b/LeanPool/GraphMinor/GM16/WallMiddleBrickLines.lean new file mode 100644 index 0000000000..f284d3da30 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallMiddleBrickLines.lean @@ -0,0 +1,89 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +import LeanPool.GraphMinor.GM16.WallEnclosedCoordinates +import LeanPool.GraphMinor.GM16.WallHorizontalBoundary +import LeanPool.GraphMinor.GM16.RectangularLines +import LeanPool.GraphMinor.GM16.SublineBetween +import Mathlib.Tactic.Linarith + +/-! +# Common outside-face lines for the middle bricks + +A brick away from the left and right boundary lies strictly inside +the central horizontal interval. It can meet the outside boundary +only at the wall's bottom or top. Those sides are lines. A brick +at neither level has no point on the outside boundary. This gives +the middle-brick case of the rigidity criterion in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- Distinct outside boundary points of a middle brick can be joined +inside that common boundary. -/ +theorem exists_line_in_middle_brick_outer_intersection {θ i j : ℕ} + (hθ : 4 ≤ θ) (hEven : Even θ) (hiLeft : 2 ≤ i) (hiRight : i + 4 ≤ 2 * θ) + (hj : j + 1 < θ) {a b : ℝ × ℝ} (hab : a ≠ b) + (ha : a ∈ (Icc (i : ℝ) ((i : ℝ) + 2) ×ˢ Icc (j : ℝ) ((j : ℝ) + 1)) ∩ frontier + (wallEnclosedSet θ)) + (hb : b ∈ (Icc (i : ℝ) ((i : ℝ) + 2) ×ˢ Icc (j : ℝ) ((j : ℝ) + 1)) ∩ frontier + (wallEnclosedSet θ)) : + ∃ K, IsLineWithEnds K a b ∧ + K ⊆ (Icc (i : ℝ) ((i : ℝ)+2) ×ˢ Icc (j : ℝ) ((j : ℝ)+1)) ∩ frontier (wallEnclosedSet θ) := by + have hiLo : (1 : ℝ) < (i : ℝ) := by exact_mod_cast (show 1 < i by omega) + have hiHi : (i : ℝ)+4 ≤ 2*(θ : ℝ) := by exact_mod_cast hiRight + have hHeight : (1 : ℝ) < ((θ-1 : ℕ) : ℝ) := by exact_mod_cast (show 1<θ-1 by omega) + have hYOut (p : ℝ × ℝ) (hp : p ∈ (Icc (i : ℝ) ((i : ℝ)+2) ×ˢ Icc (j : ℝ) ((j : ℝ)+1)) ∩ + frontier (wallEnclosedSet θ)) : p.2 ≤ 0 ∨ ((θ-1 : ℕ) : ℝ) ≤ p.2 := by + by_cases hLow : 0 < p.2 + · right + by_contra hHigh + have hCentral : p ∈ Ioo (1 : ℝ) (2*(θ : ℝ)-1) ×ˢ Ioo (0 : ℝ) ((θ-1 : ℕ) : ℝ) := + ⟨⟨hiLo.trans_le hp.1.1.1,by linarith [hp.1.1.2]⟩,hLow,lt_of_not_ge hHigh⟩ + exact hp.2.2 (central_open_rectangle_subset_interior_wallEnclosedSet + (by omega : 2≤θ) hCentral) + · exact Or.inl (le_of_not_gt hLow) + have hKHorizontal {y : ℝ} (hRow : Icc (0 : ℝ) (2*(θ : ℝ)) ×ˢ {y} ⊆ frontier (wallEnclosedSet θ)) : + Icc (i : ℝ) ((i : ℝ)+2) ×ˢ {y} ⊆ frontier (wallEnclosedSet θ) := by + rintro p ⟨hx,hy⟩ + exact hRow ⟨⟨(Nat.cast_nonneg i).trans hx.1,by linarith [hx.2]⟩,hy⟩ + by_cases hj0 : j=0 + · have hy0 : (j : ℝ)=0 := by exact_mod_cast hj0 + have hAY := hYOut a ha + have hBY := hYOut b hb + have ha0 : a.2=0 := by rcases hAY with h | h <;> linarith [ha.1.2.1,ha.1.2.2] + have hb0 : b.2=0 := by rcases hBY with h | h <;> linarith [hb.1.2.1,hb.1.2.2] + have hLine := horizontal_interval_isLine (show (i : ℝ)<(i : ℝ)+2 by linarith) 0 + obtain ⟨K,hK,hSub⟩ := exists_subline_between hLine ⟨ha.1.1,ha0⟩ ⟨hb.1.1,hb0⟩ hab + refine ⟨K,hK,fun p hp => ?_⟩ + have hpK := hSub hp + exact ⟨⟨hpK.1,⟨by rw [hpK.2,hy0],by rw [hpK.2,hy0]; norm_num⟩⟩, + hKHorizontal (wall_bottom_row_subset_frontier (by omega : 2≤θ) hEven) hpK⟩ + by_cases hjTop : j + 1=θ-1 + · have hyTop : (j : ℝ)+1=((θ-1 : ℕ) : ℝ) := by exact_mod_cast hjTop + have hjPos : (0 : ℝ) < (j : ℝ) := by exact_mod_cast (show 0 linarith [ha.1.2.1,ha.1.2.2] + have hbTop : b.2=((θ-1 : ℕ) : ℝ) := by rcases hBY with h | h <;> linarith [hb.1.2.1,hb.1.2.2] + have hLine := horizontal_interval_isLine (show (i : ℝ)<(i : ℝ)+2 by linarith) (((θ-1 : ℕ) : ℝ)) + obtain ⟨K,hK,hSub⟩ := exists_subline_between hLine ⟨ha.1.1,haTop⟩ ⟨hb.1.1,hbTop⟩ hab + refine ⟨K,hK,fun p hp => ?_⟩ + have hpK := hSub hp + exact ⟨⟨hpK.1,⟨by rw [hpK.2,← hyTop]; linarith,by rw [hpK.2,hyTop]⟩⟩, + hKHorizontal (wall_top_row_subset_frontier (by omega : 2≤θ) hEven) hpK⟩ + have hjPos : (0 : ℝ) < (j : ℝ) := by exact_mod_cast (show 0 linarith [ha.1.2.1,ha.1.2.2] + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallOuterRegion.lean b/LeanPool/GraphMinor/GM16/WallOuterRegion.lean new file mode 100644 index 0000000000..110677b553 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallOuterRegion.lean @@ -0,0 +1,60 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4WallDrawing +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +import LeanPool.GraphMinor.GM16.WallDrawingEnclosed +import LeanPool.GraphMinor.GM16.WallEnclosedBoundary +import LeanPool.GraphMinor.GM16.SphereComplementDisc +import LeanPool.GraphMinor.GM16.EmptyDiscRegion +import LeanPool.GraphMinor.GM11.Section6 + +/-! +# The outside region of the even wall + +The wall support is inside its enclosed disc, and the boundary of +that disc lies in the support. The sphere's complementary disc +has the same boundary and no drawing in its interior. Its interior +is therefore the outside region, with that disc as its closure. +This supplies the outside disc face in the rigidity check for +XVI (4.2), page 53. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology Surface + +/-- The complementary disc gives the outside region of the sphere wall. -/ +theorem sphereWall_outer_is_region {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hSphere : IsSphere S) {θ : ℕ} + (hθ : 2 ≤ θ) (hEven : Even θ) + (f : (ℝ × ℝ) → S) (hf : IsEmbedding f) (Γ : GraphDrawing (sphereWallGraph θ) S) + (hV : Γ.drawing.V = range (f ∘ @rectangularGridPoint (2 * θ + 1) θ)) + (hE : ∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val + = f '' rectangularGridLine e.val) : + let D := closure (f '' wallEnclosedSet θ)ᶜ + IsClosedDisc D ∧ interior D ∈ Γ.drawing.R ∧ closure (interior D) = D := by + have hC := isClosedDisc_image_wallEnclosedSet hS hf hθ + obtain ⟨hD,hBd,_,hMeet⟩ := isClosedDisc_closure_compl_of_isSphere hSphere hC + have hDrawing := sphereWall_drawing_subset_enclosed hθ hEven f Γ hV hE + have hBdU : discBd (closure (f '' wallEnclosedSet θ)ᶜ) ⊆ Γ.drawing.U := by + rw [hBd] + exact sphereWall_enclosed_boundary_subset_U hS hθ f hf Γ hE + have hEmpty : Disjoint (interior (closure (f '' wallEnclosedSet θ)ᶜ)) Γ.drawing.U := by + apply disjoint_left.mpr + intro x hxInt hxU + have hxBd : x ∈ discBd (f '' wallEnclosedSet θ) := + hMeet ▸ ⟨hDrawing hxU,interior_subset hxInt⟩ + have hxFr : x ∈ frontier (closure (f '' wallEnclosedSet θ)ᶜ) := + (GM11.IsClosedDisc.frontier_eq_discBd hS hD).symm ▸ (hBd.symm ▸ hxBd) + exact hxFr.2 hxInt + exact ⟨hD,empty_disc_is_region hS hD hBdU hEmpty⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallReflection.lean b/LeanPool/GraphMinor/GM16/WallReflection.lean new file mode 100644 index 0000000000..931a5947a4 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallReflection.lean @@ -0,0 +1,114 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +import LeanPool.GraphMinor.GM16.WallHorizontalBoundary +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Ring + +/-! +# Reflection across the middle of the wall + +Every row interval is symmetric about the same vertical line. +Horizontal reflection therefore preserves the enclosed disc and +its frontier. It carries the left horizontal joins to the right +joins, and will also carry left outside-face boundary lines to +the corresponding right boundary lines. +-/ + +@[expose] public section +namespace GraphMinor.GM16 +open Set Topology Surface + +/-- Reflection across the vertical line through the wall's middle. -/ +def wallHorizontalReflection (θ : ℕ) : (ℝ × ℝ) ≃ₜ (ℝ × ℝ) where + toFun p := (2*(θ : ℝ)-p.1,p.2) + invFun p := (2*(θ : ℝ)-p.1,p.2) + left_inv p := Prod.ext (by dsimp; ring) rfl + right_inv p := Prod.ext (by dsimp; ring) rfl + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop + +/-- Reflecting twice is the identity. -/ +theorem wallHorizontalReflection_involutive (θ : ℕ) : Function.Involutive + (wallHorizontalReflection θ) := by + intro p + exact Prod.ext (by dsimp [wallHorizontalReflection]; ring) rfl + +/-- The enclosed stack is symmetric under horizontal reflection. -/ +theorem wallHorizontalReflection_mem_iff (θ : ℕ) (p : ℝ × ℝ) : + wallHorizontalReflection θ p ∈ wallEnclosedSet θ ↔ p ∈ wallEnclosedSet θ := by + constructor + · intro hp + obtain ⟨k,hk,hp⟩ := mem_iUnion₂.mp hp + apply mem_iUnion₂.mpr + refine ⟨k,hk,?_,hp.2⟩ + have hHor : wallRowLeft k ≤ 2*(θ : ℝ)-p.1 ∧ + 2*(θ : ℝ)-p.1 ≤ ((2*θ : ℕ) : ℝ)-wallRowLeft k := hp.1 + simp only [Nat.cast_mul,Nat.cast_ofNat] at hHor + dsimp only [wallRowRight] + simp only [Nat.cast_mul,Nat.cast_ofNat] + constructor <;> linarith [hHor.1,hHor.2] + · intro hp + obtain ⟨k,hk,hp⟩ := mem_iUnion₂.mp hp + apply mem_iUnion₂.mpr + refine ⟨k,hk,?_,hp.2⟩ + have hHor : wallRowLeft k ≤ p.1 ∧ p.1 ≤ ((2*θ : ℕ) : ℝ)-wallRowLeft k := hp.1 + simp only [Nat.cast_mul,Nat.cast_ofNat] at hHor + change wallRowLeft k ≤ 2*(θ : ℝ)-p.1 ∧ + 2*(θ : ℝ)-p.1 ≤ ((2*θ : ℕ) : ℝ)-wallRowLeft k + simp only [Nat.cast_mul,Nat.cast_ofNat] + constructor <;> linarith [hHor.1,hHor.2] + +/-- Reflection preserves the enclosed set. -/ +theorem wallHorizontalReflection_image (θ : ℕ) : + wallHorizontalReflection θ '' wallEnclosedSet θ = wallEnclosedSet θ := by + ext p + constructor + · rintro ⟨q,hq,rfl⟩ + exact (wallHorizontalReflection_mem_iff θ q).mpr hq + · intro hp + exact ⟨wallHorizontalReflection θ p,(wallHorizontalReflection_mem_iff θ p).mpr hp, + wallHorizontalReflection_involutive θ p⟩ + +/-- Reflection preserves the enclosed set's frontier. -/ +theorem wallHorizontalReflection_frontier (θ : ℕ) : + wallHorizontalReflection θ '' frontier (wallEnclosedSet θ) = frontier (wallEnclosedSet θ) := by + rw [(wallHorizontalReflection θ).image_frontier,wallHorizontalReflection_image] + +/-- Reflection carries a closed rectangle to the reflected rectangle. -/ +theorem wallHorizontalReflection_image_rectangle (θ : ℕ) (a b c d : ℝ) : + wallHorizontalReflection θ '' (Icc a b ×ˢ Icc c d) = + Icc (2*(θ : ℝ)-b) (2*(θ : ℝ)-a) ×ˢ Icc c d := by + ext p + constructor + · rintro ⟨q,hq,rfl⟩ + change (2*(θ : ℝ)-b ≤ 2*(θ : ℝ)-q.1 ∧ + 2*(θ : ℝ)-q.1 ≤ 2*(θ : ℝ)-a) ∧ q.2 ∈ Icc c d + exact ⟨⟨by linarith [hq.1.2],by linarith [hq.1.1]⟩,hq.2⟩ + · intro hp + refine ⟨wallHorizontalReflection θ p,?_,wallHorizontalReflection_involutive θ p⟩ + change (a ≤ 2*(θ : ℝ)-p.1 ∧ 2*(θ : ℝ)-p.1 ≤ b) ∧ p.2 ∈ Icc c d + exact ⟨⟨by linarith [hp.1.2],by linarith [hp.1.1]⟩,hp.2⟩ + +/-- The short horizontal joins on the right are on the outer boundary. -/ +theorem wall_right_horizontal_join_subset_frontier {θ j : ℕ} + (hθ : 2 ≤ θ) (hEven : Even θ) (hj : j < θ) : + Icc (2*(θ : ℝ)-1) (2*(θ : ℝ)) ×ˢ {(j : ℝ)} ⊆ frontier (wallEnclosedSet θ) := by + rintro p ⟨hx,hy⟩ + have hLeft : wallHorizontalReflection θ p ∈ Icc (0 : ℝ) 1 ×ˢ {(j : ℝ)} := by + change (0 ≤ 2*(θ : ℝ)-p.1 ∧ 2*(θ : ℝ)-p.1 ≤ 1) ∧ p.2 = (j : ℝ) + exact ⟨⟨by linarith [hx.2],by linarith [hx.1]⟩,hy⟩ + have hFr := wall_left_horizontal_join_subset_frontier hθ hEven hj hLeft + have hImage : p ∈ wallHorizontalReflection θ '' frontier (wallEnclosedSet θ) := + ⟨wallHorizontalReflection θ p,hFr,wallHorizontalReflection_involutive θ p⟩ + exact wallHorizontalReflection_frontier θ ▸ hImage + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallRegions.lean b/LeanPool/GraphMinor/GM16/WallRegions.lean new file mode 100644 index 0000000000..aae509a86a --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallRegions.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4WallDrawing +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +import LeanPool.GraphMinor.GM16.WallBrickCover +import LeanPool.GraphMinor.GM16.WallBrickRegion +import LeanPool.GraphMinor.GM16.WallBrickBoundary +import LeanPool.GraphMinor.GM16.WallOuterRegion +import LeanPool.GraphMinor.GM16.SphereComplementDisc +import LeanPool.GraphMinor.GM16.RectangularDisc +import LeanPool.GraphMinor.GM11.Regions +import LeanPool.GraphMinor.GM11.Section6 +import Mathlib.Tactic.Linarith + +/-! +# All regions of the sphere wall + +Choose a point of a region. If it is in the enclosed disc, the +brick cover places it in a closed brick. It cannot be on a brick +boundary, since those boundaries belong to the drawing. The region +is therefore that brick interior. A point outside the enclosed +disc instead lies in the outside region. This completes the face +classification needed for the rigidity check in XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology Surface GM11 + +/-- Every wall region is a brick interior or the outside region. -/ +theorem sphereWall_regions_classification {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hSphere : IsSphere S) {θ : ℕ} + (hθ : 2 ≤ θ) (hEven : Even θ) + (f : (ℝ × ℝ) → S) (hf : IsEmbedding f) (Γ : GraphDrawing (sphereWallGraph θ) S) + (hV : Γ.drawing.V = range (f ∘ @rectangularGridPoint (2 * θ + 1) θ)) + (hE : ∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val + = f '' rectangularGridLine e.val) + {r : Set S} (hr : r ∈ Γ.drawing.R) : + r = interior (closure (f '' wallEnclosedSet θ)ᶜ) ∨ + ∃ i j : ℕ, i+2 < 2 * θ + 1 ∧ j+1 < θ ∧ Even (i+j) ∧ + r = interior (f '' (Icc (i : ℝ) ((i : ℝ)+2) ×ˢ Icc (j : ℝ) ((j : ℝ)+1))) := by + obtain ⟨x,hxr⟩ := region_nonempty hr + have hxNot : x ∉ Γ.drawing.U := region_subset hr hxr + by_cases hxC : x ∈ f '' wallEnclosedSet θ + · obtain ⟨p,hp,rfl⟩ := hxC + obtain ⟨i,j,hi,hj,hParity,hpB⟩ := wallEnclosedSet_subset_bricks hθ hp + let B := f '' (Icc (i : ℝ) ((i : ℝ)+2) ×ˢ Icc (j : ℝ) ((j : ℝ)+1)) + have hB : IsClosedDisc B := isClosedDisc_image_real_rectangle hf (by linarith) (by linarith) + have hxInt : f p ∈ interior B := by + by_contra hn + have hxFr : f p ∈ frontier B := ⟨subset_closure (mem_image_of_mem f hpB),hn⟩ + have hxBd := GM11.IsClosedDisc.frontier_eq_discBd hS hB ▸ hxFr + exact hxNot (sphereWall_brick_disc_boundary_subset_U f hf Γ hE hi hj hParity hxBd) + have hRegion := (sphereWall_brick_is_region hS f hf Γ hV hE hi hj hParity).1 + exact Or.inr ⟨i,j,hi,hj,hParity,region_eq_of_mem hr hRegion hxr hxInt⟩ + · have hC := isClosedDisc_image_wallEnclosedSet hS hf hθ + obtain ⟨hD,hBd,hCup,_⟩ := isClosedDisc_closure_compl_of_isSphere hSphere hC + have hxD : x ∈ closure (f '' wallEnclosedSet θ)ᶜ := + (hCup.ge (mem_univ x)).resolve_left hxC + have hxInt : x ∈ interior (closure (f '' wallEnclosedSet θ)ᶜ) := by + by_contra hn + have hxFr : x ∈ frontier (closure (f '' wallEnclosedSet θ)ᶜ) := ⟨subset_closure hxD,hn⟩ + have hxBd := GM11.IsClosedDisc.frontier_eq_discBd hS hD ▸ hxFr + exact hxC (Surface.discBd_subset _ (hBd ▸ hxBd)) + have hRegion := (sphereWall_outer_is_region hS hSphere hθ hEven f hf Γ hV hE).2.1 + exact Or.inl (region_eq_of_mem hr hRegion hxr hxInt) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallRigidDrawing.lean b/LeanPool/GraphMinor/GM16/WallRigidDrawing.lean new file mode 100644 index 0000000000..e3c928cb67 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallRigidDrawing.lean @@ -0,0 +1,45 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.WallRigidity +import LeanPool.GraphMinor.GM16.RectangularGridDrawing +import LeanPool.GraphMinor.GM16.SpherePlaneEmbedding + +/-! +# A rigid drawing of the wall in every sphere + +Use the open coordinate plane in the sphere and draw the wall +with its retained lattice lines. The face calculations prove +rigidity. The vertex map and edge closures are retained for the +subdivision step at the end of XVI (4.2). +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology Surface GM14 + +/-- The rigid sphere wall drawing asserted in XVI (4.2), page 53, +with explicit coordinates and graph isomorphism. -/ +theorem exists_rigid_sphereWall_drawing {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hSphere : IsSphere S) {θ : ℕ} + (hθ : 4 ≤ θ) (hEven : Even θ) : + ∃ (f : (ℝ × ℝ) → S) (Γ : GraphDrawing (sphereWallGraph θ) S), + IsOpenEmbedding f ∧ Γ.drawing.V = range (f ∘ @rectangularGridPoint (2*θ+1) θ) ∧ + (∀ v : V(sphereWallGraph θ), (Γ.iso.vertexEquiv v).val = f (rectangularGridPoint v.val)) ∧ + (∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val = f '' rectangularGridLine + e.val) ∧ + IsRigid Γ.drawing := by + obtain ⟨f,hf⟩ := exists_plane_openEmbedding_of_isSphere hSphere + obtain ⟨Γ,hV,hVertices,hEdges⟩ := exists_rectangularGrid_embedded_drawing + (sphereWallSimpleGraph θ) (sphereWallSimpleGraph_le_rectangular θ) f hf.isEmbedding + exact ⟨f,Γ,hf,hV,hVertices,hEdges, + sphereWall_drawing_isRigid hS hSphere hθ hEven f hf Γ hV hEdges⟩ + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallRigidity.lean b/LeanPool/GraphMinor/GM16/WallRigidity.lean new file mode 100644 index 0000000000..2dd685b749 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallRigidity.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section4WallDrawing +public import LeanPool.GraphMinor.GM14.Defs +import LeanPool.GraphMinor.GM16.RigidDiscFaces +import LeanPool.GraphMinor.GM16.WallFaceDiscs +import LeanPool.GraphMinor.GM16.WallRegions +import LeanPool.GraphMinor.GM16.WallBrickRegion +import LeanPool.GraphMinor.GM16.WallOuterRegion +import LeanPool.GraphMinor.GM16.ConvexFaceLines +import LeanPool.GraphMinor.GM16.EmbeddedBrickOuterLines + +/-! +# Rigidity of the sphere wall drawing + +All face closures are discs. Common points of two brick closures +are joined by a line in their convex coordinate intersection. +For a brick and the outside face, use the boundary arc calculations. +The disc-face criterion then proves that the even wall drawing is +rigid, supplying the assertion in XVI (4.2), page 53. +-/ + +public section +namespace GraphMinor.GM16 +open Set Graph Topology Surface GM14 + +/-- Any two distinct common points of wall face closures are joined +by a line in their common boundary. -/ +theorem sphereWall_face_join_lines {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hSphere : IsSphere S) {θ : ℕ} + (hθ : 4 ≤ θ) (hEven : Even θ) + (f : (ℝ × ℝ) → S) (hf : IsOpenEmbedding f) (Γ : GraphDrawing (sphereWallGraph θ) S) + (hV : Γ.drawing.V = range (f ∘ @rectangularGridPoint (2 * θ + 1) θ)) + (hE : ∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val + = f '' rectangularGridLine e.val) : + ∀ r ∈ Γ.drawing.R, ∀ s ∈ Γ.drawing.R, r ≠ s → ∀ a b : S, a ≠ b → + a ∈ closure r ∩ closure s → b ∈ closure r ∩ closure s → + ∃ K, IsLineWithEnds K a b ∧ K ⊆ closure r ∩ closure s := by + intro r hr s hs hne a b hab ha hb + have hClass (t : Set S) (ht : t ∈ Γ.drawing.R) := + sphereWall_regions_classification hS hSphere (by omega : 2≤θ) hEven f hf.isEmbedding Γ hV hE ht + have hOutCl := (sphereWall_outer_is_region hS hSphere (by omega : 2≤θ) hEven f hf.isEmbedding Γ + hV hE).2.2 + rcases hClass r hr with hrOut | ⟨i,j,hi,hj,hParity,hrBrick⟩ + · rcases hClass s hs with hsOut | ⟨k,l,hk,hl,hParityS,hsBrick⟩ + · exact (hne (hrOut.trans hsOut.symm)).elim + · have hBrickCl := (sphereWall_brick_is_region hS f hf.isEmbedding Γ hV hE hk hl hParityS).2 + rw [hrOut,hOutCl,hsBrick,hBrickCl] at ha hb ⊢ + obtain ⟨K,hK,hSub⟩ := exists_line_in_embedded_brick_outer_intersection hS hSphere hf hθ hEven + hk hl hParityS hab ⟨ha.2,ha.1⟩ ⟨hb.2,hb.1⟩ + exact ⟨K,hK,fun x hx => ⟨(hSub hx).2,(hSub hx).1⟩⟩ + · have hrCl := (sphereWall_brick_is_region hS f hf.isEmbedding Γ hV hE hi hj hParity).2 + rcases hClass s hs with hsOut | ⟨k,l,hk,hl,hParityS,hsBrick⟩ + · rw [hrBrick,hrCl,hsOut,hOutCl] at ha hb ⊢ + exact exists_line_in_embedded_brick_outer_intersection hS hSphere hf hθ hEven hi hj hParity + hab ha hb + · have hsCl := (sphereWall_brick_is_region hS f hf.isEmbedding Γ hV hE hk hl hParityS).2 + rw [hrBrick,hrCl,hsBrick,hsCl] at ha hb ⊢ + exact exists_line_in_embedded_rectangles_intersection hf.isEmbedding + (i : ℝ) ((i : ℝ)+2) (j : ℝ) ((j : ℝ)+1) + (k : ℝ) ((k : ℝ)+2) (l : ℝ) ((l : ℝ)+1) hab ha hb + +/-- The explicit sphere drawing of the even wall is rigid, as used +in Graph Minors XVI (4.2), page 53. The height is at least four, +which is permitted by the paper's initial increase of `θ`. -/ +theorem sphereWall_drawing_isRigid {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsClosedSurface S) (hSphere : IsSphere S) {θ : ℕ} + (hθ : 4 ≤ θ) (hEven : Even θ) + (f : (ℝ × ℝ) → S) (hf : IsOpenEmbedding f) (Γ : GraphDrawing (sphereWallGraph θ) S) + (hV : Γ.drawing.V = range (f ∘ @rectangularGridPoint (2 * θ + 1) θ)) + (hE : ∀ e : E(sphereWallGraph θ), closure (Γ.iso.edgeEquiv e).val + = f '' rectangularGridLine e.val) : + IsRigid Γ.drawing := by + exact isRigid_of_disc_faces hS + (fun r hr => sphereWall_disc_faces hS hSphere (by omega : 2≤θ) hEven f hf.isEmbedding Γ hV hE + hr) + (sphereWall_face_join_lines hS hSphere hθ hEven f hf Γ hV hE) + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/WallRowBoundary.lean b/LeanPool/GraphMinor/GM16/WallRowBoundary.lean new file mode 100644 index 0000000000..e23d5d4143 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/WallRowBoundary.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +import LeanPool.GraphMinor.GM16.WallEnclosedCoordinates +import LeanPool.GraphMinor.GM16.LocalCoordinateBoundary +import LeanPool.GraphMinor.GM16.LineClosedExtension +import LeanPool.GraphMinor.GM16.RectangularLines +import Mathlib.Tactic.Linarith + +/-! +# The vertical sides of the outside wall boundary + +Inside an open unit-height strip, the enclosed disc has exactly +that row's horizontal interval. Its extreme horizontal coordinates +are boundary points. Closedness of the frontier adds the two row +corners. Thus both vertical sides of every row are on the outer +boundary, including the indented sides of odd rows. +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Surface + +private theorem vertical_side_subset_closed {C : Set (ℝ × ℝ)} (hC : IsClosed C) + (x y : ℝ) (hSub : ∀ p : ℝ × ℝ, p.1 = x → p.2 ∈ Ioo y (y+1) → p ∈ C) : + {x} ×ˢ Icc y (y+1) ⊆ C := by + apply line_subset_closed_of_open_part_subset + (vertical_interval_isLine x (by linarith : y componentsIn (univ \ U)) hSupport + apply isRigid_of_disc_faces hS + · intro r hr + have hFace := sphereWall_disc_faces hS hSphere (by omega : 2≤θ) hEven f hf.isEmbedding Γ hV hE + (hR ▸ hr) + simpa only [hSupport] using hFace + · intro r hr s hs hne a b hab ha hb + exact sphereWall_face_join_lines hS hSphere hθ hEven f hf Γ hV hE + r (hR ▸ hr) s (hR ▸ hs) hne a b hab ha hb + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM16/ZoneBoundaryLinkage.lean b/LeanPool/GraphMinor/GM16/ZoneBoundaryLinkage.lean new file mode 100644 index 0000000000..d106d9ad31 --- /dev/null +++ b/LeanPool/GraphMinor/GM16/ZoneBoundaryLinkage.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +import LeanPool.GraphMinor.GM16.DrawingGraphPaths +import LeanPool.GraphMinor.GM16.PathBoundaryIntersection +import LeanPool.GraphMinor.GM16.LineBoundarySide +import LeanPool.GraphMinor.GM16.Section9Zones +import LeanPool.GraphMinor.GM09.Basic +import LeanPool.GraphMinor.GM14.Section3 +import LeanPool.GraphMinor.GM11.Section6 +import LeanPool.GraphMinor.GM11.Section85 +import LeanPool.GraphMinor.GM11.Section88 +import LeanPool.GraphMinor.Surface.ArcTools + +/-! +# Keeping a boundary linkage inside its zone + +Trim each path from an interior vertex set to the zone boundary so +that it meets each end set only at its end. A trimmed path has just +one vertex on the outer circle and therefore just one point there. +Removing that point shows that the path stays in the closed disc. +This puts Claim (10)'s linkage in the society used for XVI (8.1), +Claim (11). +-/ + +public section +namespace GraphMinor.GM16 +open Set Topology Graph GraphMinor.Surface GraphMinor.GM09 GraphMinor.GM11 GraphMinor.GM14 +universe u +variable {S : Type u} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + +/-- Disjoint paths to a zone boundary can be trimmed into the closed +zone, with exactly one vertex on each of the two end sets. -/ +theorem linkage_inside_closed_zone {H : Drawing S} + {d : Set S → Set S → ℕ} {γ p : ℕ} {z Λ A : Set S} + (hZone : IsLambdaZoneAround H d γ z Λ) (hA : A ⊆ Λ) + (P : Fin p → Drawing S) + (hP : ∀ i, ∃ a ∈ A, ∃ b ∈ H.V ∩ subBd Λ, + (P i).IsPathBetween a b ∧ (P i).IsSubdrawing H) + (hDis : Pairwise (fun i j => Disjoint (P i).V (P j).V)) : + ∃ Q : Fin p → Graph S (Set S), + (∀ i, IsFromToPath (H.interSet (closure Λ)).toGraph (Q i) + (H.V ∩ subBd Λ) A) ∧ + Pairwise (fun i j => Disjoint V(Q i) V(Q j)) := by + classical + let B := H.interSet (subBd Λ) + have hBH : B.IsSubdrawing H := interSet_isSub + have hBU : B.U = subBd Λ := by + apply subset_antisymm + · exact interSet_U_subset (by rw [subBd_eq_frontier]; exact isClosed_frontier) + · exact oArc_subset_interSet_U hZone.isOArc_bd hZone.bd_subset_U Subset.rfl + have hBD : Disjoint Λ (subBd Λ) := + (isOpen_disjoint_subBd_and_closure_eq hZone.isOpenDisc.1).1 + have hTrim (i : Fin p) : ∃ b ∈ H.V ∩ subBd Λ, ∃ a ∈ A, + ∃ J : Drawing S, J.IsPathBetween b a ∧ J.IsSubdrawing H ∧ + J.IsSubdrawing (P i) ∧ J.V ∩ (H.V ∩ subBd Λ) = {b} ∧ + J.V ∩ A = {a} ∧ J.U ⊆ closure Λ := by + obtain ⟨a, ha, b, hb, hPath, hPH⟩ := hP i + obtain ⟨b', hb', a', ha', R, hRP, hR⟩ := + (graphPath_of_drawingPath hPH hPath).symm.exists_isFromToPathWithEnds hb ha + obtain ⟨J, hJPath, hJH, hJR⟩ := exists_drawing_of_graphPath hR.1 + have hJP : J.IsSubdrawing (P i) := by + constructor + · intro x hx + exact hRP.vertexSet_mono (hJR ▸ hx) + · intro e he + exact hRP.edgeSet_mono (hJR ▸ he) + have hOuter : J.V ∩ (H.V ∩ subBd Λ) = {b'} := by + change V(J.toGraph) ∩ (H.V ∩ subBd Λ) = {b'} + rw [hJR] + exact hR.2.1 + have hInner : J.V ∩ A = {a'} := by + change V(J.toGraph) ∩ A = {a'} + rw [hJR] + exact hR.2.2 + have hJbd : J.U ∩ subBd Λ ⊆ {b'} := by + rw [← hBU] + apply path_inter_subdrawing_subset_singleton hJH hBH hJPath + rw [hBU] + intro x hx + exact hOuter ▸ ⟨hx.1, hJH.1 hx.1, hx.2⟩ + have hne : b' ≠ a' := fun heq => hBD.notMem_of_mem_left (hA ha') (heq ▸ hb'.2) + have hLine := GM11.isLine_of_isPathBetween hJPath hne + have hJU : J.U ⊆ closure Λ := by + apply line_subset_closed_of_boundary_end isClosed_closure + (Surface.IsLineWithEnds.symm hLine) (subset_closure (hA ha')) hne.symm hb'.2.1 + intro x hx + rw [subBd_eq_frontier] at hJbd + exact hJbd ⟨hx.1, frontier_closure_subset hx.2⟩ + exact ⟨b', hb', a', ha', J, hJPath, hJH, hJP, hOuter, hInner, hJU⟩ + choose b hb a ha J hJPath hJH hJP hOuter hInner hJU using hTrim + refine ⟨fun i => (J i).toGraph, ?_, ?_⟩ + · intro i + refine ⟨b i, a i, ?_, hOuter i, hInner i⟩ + exact graphPath_of_drawingPath + (subdrawing_interSet_of_U_subset (hJH i) (hJU i)) (hJPath i) + · intro i j hij + exact (hDis hij).mono (hJP i).1 (hJP j).1 + +end GraphMinor.GM16 diff --git a/LeanPool/GraphMinor/GM17/AngleOrder.lean b/LeanPool/GraphMinor/GM17/AngleOrder.lean new file mode 100644 index 0000000000..3658de780a --- /dev/null +++ b/LeanPool/GraphMinor/GM17/AngleOrder.lean @@ -0,0 +1,108 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM09.Section7 +public import LeanPool.GraphMinor.Surface.DiscPolygon + +/-! +# Angles for a clockwise enumeration + +If the cyclic order of a society agrees with a parametrization of a circle in a surface, then a +clockwise enumeration of the society has increasing +angles (`exists_angles`). This is what is needed to use the polygon of `exists_polygon_in_disc` for +a vortex in XVII (13.1). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface GM09 + +universe u + +theorem isClockwise3_of_ofFn {α : Type u} {Ω : CyclicPerm α} {k : ℕ} {t : Fin k → α} + (h : Ω.IsClockwiseSeq (List.ofFn t)) {a b c : Fin k} (hab : a < b) (hbc : b < c) : + Ω.IsClockwise3 (t a) (t b) (t c) := by + have hb := b.2 + have hc := c.2 + refine CyclicPerm.IsClockwiseSeq.of_isBoundedSubseq h (M := [t a, t b, t c]) (lo := 0) (hi + := k) ⟨Nat.zero_le _, fun i => if i = 0 then a.1 else if i = 1 then b.1 else c.1, ?_, ?_⟩ + · intro i hi + simp only [List.length_cons, List.length_nil] at hi + interval_cases i + · exact ⟨by simp, Nat.zero_le _, by simp, by simp⟩ + · exact ⟨by simp, Nat.zero_le _, by simp, by simp⟩ + · exact ⟨by simp, Nat.zero_le _, by simp, by simp⟩ + · intro i j hij hj + simp only [List.length_cons, List.length_nil] at hj + have h1 : a.1 < b.1 := hab + have h2 : b.1 < c.1 := hbc + interval_cases j <;> interval_cases i <;> simp <;> omega + +theorem exp_inj_Ico {b x y : ℝ} (hx : x ∈ Ico b (b + 2 * Real.pi)) + (hy : y ∈ Ico b (b + 2 * Real.pi)) (h : Circle.exp x = Circle.exp y) : x = y := + Circle.exp_injOn_Ico (a := b) (b := b + 2 * Real.pi) (by simp) hx hy h + +theorem exists_angle_mem (b : ℝ) (w : Circle) : + ∃ t ∈ Ico b (b + 2 * Real.pi), Circle.exp t = w := + GraphMinor.Surface.exists_circleExp_mem_Ico b w + +/-- **Increasing angles for a clockwise enumeration.** -/ +theorem exists_angles {S : Type*} [TopologicalSpace S] {α : Type u} {Ω : CyclicPerm α} {k : ℕ} + (hk : 0 < k) {t : Fin k → α} + (ht : Ω.IsClockwiseSeq (List.ofFn t)) {ν : α → S} (hν : InjOn ν Ω.bar) {F : Set S} {φ : Circle + ≃ₜ F} (hA : AgreesWithOArcHomeo ν Ω F φ) : + ∃ s : Fin k → ℝ, StrictMono s ∧ (∀ i, s i < s ⟨0, hk⟩ + 2 * Real.pi) ∧ ∀ i, ν (t i) = (φ + (Circle.exp (s i))).1 := by + have hbar : ∀ i, t i ∈ Ω.bar := fun i => ht.2.1 _ (by simp [List.mem_ofFn]) + have htinj : Function.Injective t := List.nodup_ofFn.mp ht.1 + have hF : ∀ i, ν (t i) ∈ F := fun i => hA.1 _ (hbar i) + let i₀ : Fin k := ⟨0, hk⟩ + obtain ⟨b, -, hb⟩ := exists_angle_mem 0 (φ.symm ⟨ν (t i₀), hF i₀⟩) + have hex : ∀ i, ∃ x ∈ Ico b (b + 2 * Real.pi), Circle.exp x = φ.symm ⟨ν (t i), hF i⟩ := fun i + => exists_angle_mem b _ + choose s hs hse using hex + have hval : ∀ i, ν (t i) = (φ (Circle.exp (s i))).1 := fun i => by rw [hse, φ.apply_symm_apply] + have hs0 : s i₀ = b := exp_inj_Ico (hs i₀) ⟨le_rfl, by linarith [Real.pi_pos]⟩ (by rw [hse, hb]) + have hzero : ∀ i, i₀ < i → b < s i := fun i hi => by + refine lt_of_le_of_ne (hs i).1 fun he => ?_ + have h1 : ν (t i₀) = ν (t i) := by rw [hval, hval, hs0, he] + exact (hi.ne (htinj (hν (hbar _) (hbar _) h1))) + refine ⟨s, ?_, fun i => by rw [hs0]; exact (hs i).2, hval⟩ + intro x y hxy + by_cases hx : x = i₀ + · subst hx + rw [hs0] + exact hzero y hxy + have h0x : i₀ < x := by + change 0 < x.1 + exact Nat.pos_of_ne_zero fun h => hx (Fin.ext h) + obtain ⟨τ₁, τ₂, τ₃, h12, h23, h31, e1, e2, e3⟩ := hA.2 _ _ _ (isClockwise3_of_ofFn ht h0x hxy) + have he1 : Circle.exp τ₁ = Circle.exp b := by + rw [hb] + exact (φ.symm_apply_eq.mpr (Subtype.ext e1.symm)).symm + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp he1 + have hshift : ∀ τ, Circle.exp (τ - m * (2 * Real.pi)) = Circle.exp τ := fun τ => by + have := Circle_exp_add_int τ (-m) + rw [← this] + congr 1 + push_cast + ring + have hsv : ∀ (i : Fin k) (τ : ℝ), (φ (Circle.exp τ)).1 = ν (t i) → τ - m * (2 * Real.pi) ∈ Ico b + (b + 2 * Real.pi) → s i = τ - m * (2 * Real.pi) := fun i τ he hτ => by + refine exp_inj_Ico (hs i) hτ ?_ + rw [hse, hshift] + apply φ.symm_apply_eq.mpr + exact Subtype.ext he.symm + rw [hsv x τ₂ e2 ⟨by linarith, by linarith⟩, hsv y τ₃ e3 ⟨by linarith, by linarith⟩] + linarith + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/ArcDisc.lean b/LeanPool/GraphMinor/GM17/ArcDisc.lean new file mode 100644 index 0000000000..05a83872d0 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/ArcDisc.lean @@ -0,0 +1,440 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.PasteCuff +public import LeanPool.GraphMinor.Surface.DiscUnion +public import LeanPool.GraphMinor.Surface.DiscGrow +public import LeanPool.GraphMinor.Surface.ChartCells +public import LeanPool.GraphMinor.Surface.EdgeLoop + +/-! +# A disc cut off by an `I`-arc + +Let `F` be an `I`-arc of a surface with only its ends on the boundary, and let `Δ` be a closed disc +with `F ⊆ bd(Δ) ⊆ F ∪ bd(Σ)`. Then the +rest of `bd(Δ)` is an arc `I` of one cuff, `Δ` meets `bd(Σ)` exactly in `I`, and `Δ` is a +neighbourhood of each of its points off `F` +(`arc_disc_data`). To see the last claim at a point of `I`, paste a disc on the cuff. Then `Δ` and +the new disc form a larger disc with the point +in its inside. The three statements on such discs in Graph Minors XVII follow. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +/-- A line in an `O`-arc has a complementary line with the same ends. -/ +theorem oarc_split [T2Space S] {O L : Set S} {x y : S} (hO : IsOArc O) (hL : IsLineWithEnds L x y) + (hs : L ⊆ O) : + ∃ L', IsLineWithEnds L' x y ∧ L ∪ L' = O ∧ L ∩ L' = {x, y} := by + have hne := hL.ne' + have hx := hs hL.left_mem + have hy := hs hL.right_mem + obtain ⟨A, B, hA, hB, hu, hi⟩ := hO.lines hx hy hne + have hp := hL.isPreconnected_diff + have hcA : IsClosed A := hA.isCompact.isClosed + have hcB : IsClosed B := hB.isCompact.isClosed + have hcov : L \ {x, y} ⊆ A ∪ B := hu ▸ sdiff_subset.trans hs + have key : ¬ ((L \ {x, y}) ∩ A).Nonempty ∨ ¬ ((L \ {x, y}) ∩ B).Nonempty := by + by_contra h + push Not at h + obtain ⟨z, hz, hz'⟩ := isPreconnected_closed_iff.mp hp A B hcA hcB hcov h.1 h.2 + rw [hi] at hz' + exact hz.2 hz' + have hend : ∀ {P : Set S}, IsLineWithEnds P x y → L \ {x, y} ⊆ P → L = P := fun {P} hP hsub => by + have hLc : IsPreconnected L := by + obtain ⟨a, ha, hr, -, -⟩ := hL.exists_arc + rw [← hr] + exact isPreconnected_range ha.1 + refine hP.eq_of_subset hLc (fun z hz => ?_) hL.left_mem hL.right_mem + by_cases h : z ∈ ({x, y} : Set S) + · rcases h with rfl | rfl + · exact hP.left_mem + · exact hP.right_mem + · exact hsub ⟨hz, h⟩ + rcases key with h | h + · have h1 : L \ {x, y} ⊆ B := fun z hz => (hcov hz).resolve_left fun hA' => h ⟨z, hz, hA'⟩ + obtain rfl := hend hB h1 + exact ⟨A, hA, by rwa [union_comm], by rwa [inter_comm]⟩ + · have h1 : L \ {x, y} ⊆ A := fun z hz => (hcov hz).resolve_right fun hB' => h ⟨z, hz, hB'⟩ + obtain rfl := hend hA h1 + exact ⟨B, hB, hu, hi⟩ + +/-- The shape of a disc cut off by an `I`-arc. -/ +theorem arc_disc_data {F Δ : Set S} {n₁ n₂ : S} (hS : IsSurface S) (hF : IsLineWithEnds F n₁ n₂) + (hb : F ∩ bd S = {n₁, n₂}) (hΔ : IsClosedDisc Δ) + (h1 : F ⊆ discBd Δ) (h2 : discBd Δ ⊆ F ∪ bd S) : + ∃ I I' Θ, Θ ∈ cuffs S ∧ IsLineWithEnds I n₁ n₂ ∧ IsLineWithEnds I' n₁ n₂ ∧ I ∪ I' = Θ ∧ I ∩ I' + = {n₁, n₂} ∧ F ∪ I = discBd Δ ∧ F ∩ I = {n₁, n₂} ∧ + Δ ∩ bd S = I ∧ ∀ x ∈ Δ \ F, Δ ∈ 𝓝 x := by + have ht2 : T2Space S := hS.2.1 + have hman := hS.2.2 + obtain ⟨I, hI, hu, hi⟩ := oarc_split hΔ.isOArc_discBd hF h1 + have hn₁ : n₁ ∈ bd S := (hb ▸ mem_insert _ _ : n₁ ∈ F ∩ bd S).2 + have hn₂ : n₂ ∈ bd S := (hb ▸ mem_insert_of_mem _ rfl : n₂ ∈ F ∩ bd S).2 + have hIb : I ⊆ bd S := fun z hz => by + by_cases h : z ∈ F + · have h3 : z ∈ F ∩ I := ⟨h, hz⟩ + rw [hi] at h3 + rcases h3 with rfl | rfl + · exact hn₁ + · exact hn₂ + · exact (h2 (hu ▸ .inr hz)).resolve_left h + have hIc : IsPreconnected I := by + obtain ⟨a, ha, hr, -, -⟩ := hI.exists_arc + rw [← hr] + exact isPreconnected_range ha.1 + have hΘ : connectedComponentIn (bd S) n₁ ∈ cuffs S := ⟨n₁, hn₁, rfl⟩ + have hIΘ := hIc.subset_connectedComponentIn hI.left_mem hIb + obtain ⟨I', hI', hu', hi'⟩ := oarc_split ((cuff_statement.{0} S hS).2.2 _ hΘ) hI hIΘ + have hsubΔ : discBd Δ ⊆ Δ := by + rintro _ ⟨z, -, rfl⟩ + exact z.2 + have hIΔ : I ⊆ Δ := fun z hz => hsubΔ (hu ▸ .inr hz) + have hint : ∀ x ∈ Δ, x ∉ discBd Δ → Δ ∈ 𝓝 x := fun x hx hn => + Filter.mem_of_superset ((hΔ.isOpen_discInt hman).mem_nhds ⟨hx, hn⟩) sdiff_subset + have hmeet : Δ ∩ bd S = I := by + apply subset_antisymm + · rintro x ⟨hx, hxb⟩ + have hd : x ∈ discBd Δ := by + by_contra hn + exact hxb (isInteriorPoint_of_mem_discInt hman hΔ ⟨hx, hn⟩) + rw [← hu] at hd + rcases hd with hd | hd + · have h3 : x ∈ F ∩ bd S := ⟨hd, hxb⟩ + rw [hb] at h3 + rcases h3 with rfl | rfl + · exact hI.left_mem + · exact hI.right_mem + · exact hd + · exact fun z hz => ⟨hIΔ hz, hIb hz⟩ + refine ⟨I, I', _, hΘ, hI, hI', hu', hi', hu, hi, hmeet, fun x hx => ?_⟩ + by_cases hd : x ∈ discBd Δ + swap + · exact hint x hx.1 hd + have hxI : x ∈ I := by + rw [← hu] at hd + exact hd.resolve_left hx.2 + obtain ⟨S', tS', ι, D, hS', hι, hD, hcov, hm, hDb, hbdS⟩ := paste_disc.{0} S _ hS hΘ + have ht2' : T2Space S' := hS'.2.1 + obtain ⟨hL, -⟩ := IsLineWithEnds.map_of_embedding (L := I) (u := n₁) (v + := n₂) hι.isEmbedding hI |> fun h => (⟨h, trivial⟩ : _ ∧ True) + have hD' : ∀ y, ι y ∈ D ↔ y ∈ connectedComponentIn (bd S) n₁ := fun y => by + constructor + · intro h + have h3 : ι y ∈ range ι ∩ D := ⟨mem_range_self y, h⟩ + rw [hm] at h3 + obtain ⟨w, hw, he⟩ := h3 + exact hι.injective he ▸ hw + · intro h + have h3 : ι y ∈ range ι ∩ D := hm ▸ mem_image_of_mem _ h + exact h3.2 + have hAD : ι '' Δ ∩ D = ι '' I := by + apply subset_antisymm + · rintro _ ⟨⟨y, hy, rfl⟩, h⟩ + refine mem_image_of_mem _ ?_ + rw [← hmeet] + exact ⟨hy, connectedComponentIn_subset _ _ ((hD' y).mp h)⟩ + · rintro _ ⟨y, hy, rfl⟩ + exact ⟨mem_image_of_mem _ (hIΔ hy), (hD' y).mpr (hIΘ hy)⟩ + obtain ⟨hE, hEb⟩ := disc_union.{0} (ι '' Δ) D (ι '' I) (ι n₁) (ι n₂) + (image_emb_disc hι.isEmbedding hΔ) hD hL hAD + (by + rw [discBd_image hι.isEmbedding, ← hu] + exact image_mono subset_union_right) + (by + rw [hDb] + exact image_mono hIΘ) + have hxne : x ≠ n₁ ∧ x ≠ n₂ := by + constructor + · rintro rfl + exact hx.2 hF.left_mem + · rintro rfl + exact hx.2 hF.right_mem + have hxE : ι x ∈ discInt (ι '' Δ ∪ D) := by + refine ⟨.inl (mem_image_of_mem _ hx.1), fun h => ?_⟩ + rw [hEb] at h + refine h.2 ⟨mem_image_of_mem _ hxI, ?_⟩ + rintro (h3 | h3) + · exact hxne.1 (hι.injective h3) + · exact hxne.2 (hι.injective h3) + have hopen : IsOpen (ι ⁻¹' discInt (ι '' Δ ∪ D) \ I') := + ((hE.isOpen_discInt hS'.2.2).preimage hι.continuous).sdiff hI'.isCompact.isClosed + have hxI' : x ∉ I' := fun h => by + have h3 : x ∈ I ∩ I' := ⟨hxI, h⟩ + rw [hi'] at h3 + rcases h3 with h4 | h4 + · exact hxne.1 h4 + · exact hxne.2 h4 + refine Filter.mem_of_superset (hopen.mem_nhds ⟨hxE, hxI'⟩) ?_ + rintro y ⟨⟨h3 | h3, -⟩, hyI'⟩ + · obtain ⟨w, hw, he⟩ := h3 + exact hι.injective he ▸ hw + · have h4 := (hD' y).mp h3 + rw [← hu'] at h4 + exact hIΔ (h4.resolve_right hyI') + +/-- A pair of complementary lines of a circle are the two arcs between two angles. -/ +theorem circle_lines [T2Space S] {Θ I I' : Set S} (f : Circle ≃ₜ Θ) {t₁ t₃ : ℝ} (hlt : t₁ < t₃) + (ht₃ : t₃ < t₁ + 2 * Real.pi) + (hI : IsLineWithEnds I (GM19.cuffPoint f t₁) (GM19.cuffPoint f t₃)) (hI' : IsLineWithEnds I' + (GM19.cuffPoint f t₁) (GM19.cuffPoint f t₃)) (hu : I ∪ I' = Θ) : + GM19.cuffPoint f '' Icc t₁ t₃ ∩ GM19.cuffPoint f '' Icc t₃ (t₁ + 2 * Real.pi) ⊆ + {GM19.cuffPoint f t₁, GM19.cuffPoint f t₃} ∧ + ((I ⊆ GM19.cuffPoint f '' Icc t₁ t₃ ∧ I' ⊆ GM19.cuffPoint f '' Icc t₃ (t₁ + 2 * Real.pi)) ∨ + (I ⊆ GM19.cuffPoint f '' Icc t₃ (t₁ + 2 * Real.pi) ∧ I' ⊆ GM19.cuffPoint f '' Icc t₁ t₃)) + := by + have hpi := Real.pi_pos + set n₁ := GM19.cuffPoint f t₁ with e₁ + set n₂ := GM19.cuffPoint f t₃ with e₃ + let A : Set S := GM19.cuffPoint f '' Icc t₁ t₃ + let B : Set S := GM19.cuffPoint f '' Icc t₃ (t₁ + 2 * Real.pi) + have cc := cuffPoint_continuous f + have hcA : IsClosed A := (isCompact_Icc.image cc).isClosed + have hcB : IsClosed B := (isCompact_Icc.image cc).isClosed + have hAB : A ∪ B = Θ := by + ext x + constructor + · rintro (⟨t, -, rfl⟩ | ⟨t, -, rfl⟩) <;> exact cuffPoint_mem f t + · intro hx + obtain ⟨t, ht, rfl⟩ := exists_cuffPoint_mem_Ico f t₁ hx + rcases le_total t t₃ with h | h + · exact .inl ⟨t, ⟨ht.1, h⟩, rfl⟩ + · exact .inr ⟨t, ⟨h, ht.2.le⟩, rfl⟩ + have hABi : A ∩ B ⊆ {n₁, n₂} := by + rintro _ ⟨⟨t, ht, rfl⟩, ⟨t', ht', he⟩⟩ + rcases eq_or_lt_of_le ht'.2 with h | h + · left + rw [e₁, ← he, h, cuffPoint_add_two_pi] + · have := cuffPoint_injOn_Ico f t₁ ⟨ht.1, by linarith [ht.2]⟩ ⟨by linarith [ht'.1], h⟩ he.symm + right + have h6 : t = t₃ := by linarith [this, ht.2, ht'.1] + rw [e₃] + exact congrArg _ h6 + have hend₁ : n₁ ∈ A ∧ n₁ ∈ B := ⟨⟨t₁, ⟨le_rfl, hlt.le⟩, rfl⟩, ⟨t₁ + 2 * Real.pi, ⟨ht₃.le, + le_rfl⟩, by rw [cuffPoint_add_two_pi]⟩⟩ + have hend₂ : n₂ ∈ A ∧ n₂ ∈ B := ⟨⟨t₃, ⟨hlt.le, le_rfl⟩, rfl⟩, ⟨t₃, ⟨le_rfl, ht₃.le⟩, rfl⟩⟩ + have key : ∀ {L : Set S}, IsLineWithEnds L n₁ n₂ → L ⊆ Θ → L ⊆ A ∨ L ⊆ B := fun {L} hL hs => by + have hcov : L \ {n₁, n₂} ⊆ A ∪ B := hAB ▸ sdiff_subset.trans hs + have hsub : ∀ {P : Set S}, n₁ ∈ P → n₂ ∈ P → L \ {n₁, n₂} ⊆ P → L ⊆ P := fun {P} h1 h2 h3 z hz + => by + by_cases h : z ∈ ({n₁, n₂} : Set S) + · rcases h with rfl | rfl + · exact h1 + · exact h2 + · exact h3 ⟨hz, h⟩ + by_contra hc + push Not at hc + have h1 : ((L \ {n₁, n₂}) ∩ A).Nonempty := by + by_contra h + exact hc.2 (hsub hend₁.2 hend₂.2 fun z hz => (hcov hz).resolve_left fun hA' => h ⟨z, hz, hA'⟩) + have h2 : ((L \ {n₁, n₂}) ∩ B).Nonempty := by + by_contra h + exact hc.1 (hsub hend₁.1 hend₂.1 fun z hz => (hcov hz).resolve_right fun hB' => h ⟨z, hz, + hB'⟩) + obtain ⟨z, hz, hz'⟩ := isPreconnected_closed_iff.mp hL.isPreconnected_diff A B hcA hcB hcov h1 + h2 + exact hz.2 (hABi hz') + have hmid₁ : ∃ z ∈ A, z ∉ B := by + refine ⟨GM19.cuffPoint f ((t₁ + t₃) / 2), ⟨_, ⟨by linarith, by linarith⟩, rfl⟩, fun h => ?_⟩ + have h1 := hABi ⟨⟨_, ⟨by linarith, by linarith⟩, rfl⟩, h⟩ + have h3 : ((t₁ + t₃) / 2) ∈ Ico t₁ (t₁ + 2 * Real.pi) := ⟨by linarith, by linarith⟩ + rcases h1 with h1 | h1 + · have := cuffPoint_injOn_Ico f t₁ h3 ⟨le_rfl, by linarith⟩ h1 + linarith + · have := cuffPoint_injOn_Ico f t₁ h3 ⟨hlt.le, ht₃⟩ h1 + linarith + have hmid₂ : ∃ z ∈ B, z ∉ A := by + refine ⟨GM19.cuffPoint f ((t₃ + (t₁ + 2 * Real.pi)) / 2), ⟨_, ⟨by linarith, by linarith⟩, + rfl⟩, fun h => ?_⟩ + have h1 := hABi ⟨h, ⟨_, ⟨by linarith, by linarith⟩, rfl⟩⟩ + have h3 : ((t₃ + (t₁ + 2 * Real.pi)) / 2) ∈ Ico t₁ (t₁ + 2 * Real.pi) + := ⟨by linarith, by linarith⟩ + rcases h1 with h1 | h1 + · have := cuffPoint_injOn_Ico f t₁ h3 ⟨le_rfl, by linarith⟩ h1 + linarith + · have := cuffPoint_injOn_Ico f t₁ h3 ⟨hlt.le, ht₃⟩ h1 + linarith + have hI1 : I ⊆ Θ := fun z hz => hu ▸ .inl hz + have hI2 : I' ⊆ Θ := fun z hz => hu ▸ .inr hz + refine ⟨hABi, ?_⟩ + rcases key hI hI1 with h1 | h1 + · rcases key hI' hI2 with h2 | h2 + · obtain ⟨z, hz, hz'⟩ := hmid₂ + exact absurd ((hu ▸ hAB ▸ .inr hz : z ∈ I ∪ I').elim (fun h => h1 h) fun h => h2 h) hz' + · exact .inl ⟨h1, h2⟩ + · rcases key hI' hI2 with h2 | h2 + · exact .inr ⟨h1, h2⟩ + · obtain ⟨z, hz, hz'⟩ := hmid₁ + exact absurd ((hu ▸ hAB ▸ .inl hz : z ∈ I ∪ I').elim (fun h => h1 h) fun h => h2 h) hz' + +/-- Two complementary lines of an `O`-arc give the circular order of their points. -/ +theorem inOrder_of_lines [T2Space S] {Θ I I' : Set S} {n₁ n₂ n m : S} (hO : IsOArc Θ) + (hI : IsLineWithEnds I n₁ n₂) (hI' : IsLineWithEnds I' n₁ n₂) + (hu : I ∪ I' = Θ) (hn : n ∈ I) (hm : m ∈ I') : GM19.InOrderOn Θ n₁ n n₂ m := by + obtain ⟨f⟩ := hO + have hn₁ : n₁ ∈ Θ := hu ▸ .inl hI.left_mem + have hn₂ : n₂ ∈ Θ := hu ▸ .inl hI.right_mem + obtain ⟨t₁, -, rfl⟩ := exists_cuffPoint_mem_Ico f 0 hn₁ + obtain ⟨t₃, ht₃, rfl⟩ := exists_cuffPoint_mem_Ico f t₁ hn₂ + have hlt : t₁ < t₃ := lt_of_le_of_ne ht₃.1 fun h => hI.ne' (by rw [h]) + rcases (circle_lines f hlt ht₃.2 hI hI' hu).2 with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · obtain ⟨t₂, ht₂, rfl⟩ := h1 hn + obtain ⟨t₄, ht₄, rfl⟩ := h2 hm + exact ⟨f, t₁, t₂, t₃, t₄, ht₂.1, ht₂.2, ht₄.1, ht₄.2, rfl, rfl, rfl, rfl⟩ + · obtain ⟨t₂, ht₂, rfl⟩ := h2 hm + obtain ⟨t₄, ht₄, rfl⟩ := h1 hn + have h3 : GM19.InOrderOn Θ (GM19.cuffPoint f t₁) (GM19.cuffPoint f t₂) (GM19.cuffPoint f t₃) + (GM19.cuffPoint f t₄) := + ⟨f, t₁, t₂, t₃, t₄, ht₂.1, ht₂.2, ht₄.1, ht₄.2, rfl, rfl, rfl, rfl⟩ + exact inOrderOn_cyclic3 (inOrderOn_rev h3) + +/-- Points in order on an `O`-arc are on the two sides of two of them, for any pair of complementary +lines. -/ +theorem mem_of_inOrder [T2Space S] {Θ L L' : Set S} {x₁ x₂ x₃ x₄ : S} + (h : GM19.InOrderOn Θ x₁ x₂ x₃ x₄) (hL : IsLineWithEnds L x₁ x₃) + (hL' : IsLineWithEnds L' x₁ x₃) (hu : L ∪ L' = Θ) : (x₂ ∈ L ∧ x₄ ∈ L') ∨ (x₂ ∈ L' ∧ x₄ ∈ L) + := by + obtain ⟨f, t₁, t₂, t₃, t₄, h12, h23, h34, h41, rfl, rfl, rfl, rfl⟩ := h + have hlt : t₁ < t₃ := lt_of_le_of_ne (h12.trans h23) fun h => hL.ne' (by rw [h]) + have ht3 : t₃ < t₁ + 2 * Real.pi := lt_of_le_of_ne (h34.trans h41) fun h => hL.ne' + (by rw [h, cuffPoint_add_two_pi]) + obtain ⟨hi, hc⟩ := circle_lines f hlt ht3 hL hL' hu + have hm₂ : GM19.cuffPoint f t₂ ∈ GM19.cuffPoint f '' Icc t₁ t₃ := ⟨t₂, ⟨h12, h23⟩, rfl⟩ + have hm₄ : GM19.cuffPoint f t₄ ∈ GM19.cuffPoint f '' Icc t₃ (t₁ + 2 * Real.pi) + := ⟨t₄, ⟨h34, h41⟩, rfl⟩ + have hun : ∀ z, z ∈ Θ → z ∈ L ∨ z ∈ L' := fun z hz => (hu ▸ hz : z ∈ L ∪ L') + have hends : ∀ z, z ∈ ({GM19.cuffPoint f t₁, GM19.cuffPoint f t₃} : Set S) → z ∈ L ∧ z ∈ L' := by + rintro z (rfl | rfl) + · exact ⟨hL.left_mem, hL'.left_mem⟩ + · exact ⟨hL.right_mem, hL'.right_mem⟩ + rcases hc with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · left + constructor + · exact (hun _ (cuffPoint_mem f t₂)).elim id fun h => (hends _ (hi ⟨hm₂, h2 h⟩)).1 + · exact (hun _ (cuffPoint_mem f t₄)).elim (fun h => (hends _ (hi ⟨h1 h, hm₄⟩)).2) id + · right + constructor + · exact (hun _ (cuffPoint_mem f t₂)).elim (fun h => (hends _ (hi ⟨hm₂, h1 h⟩)).2) id + · exact (hun _ (cuffPoint_mem f t₄)).elim id fun h => (hends _ (hi ⟨h2 h, hm₄⟩)).1 + +/-- In a circular order with `x₁ = x₃`, one of the other two points is also `x₁`. -/ +theorem eq_of_inOrder {Θ : Set S} {x x₂ x₄ : S} (h : GM19.InOrderOn Θ x x₂ x x₄) : x₂ = x ∨ x₄ = x + := by + obtain ⟨f, t₁, t₂, t₃, t₄, h12, h23, h34, h41, h1, rfl, h3, rfl⟩ := h + rcases eq_or_lt_of_le (h34.trans h41) with h | h + · right + have h5 : t₄ = t₃ := le_antisymm (by linarith) h34 + rw [h5, h3] + · left + have h5 := cuffPoint_injOn_Ico f t₁ ⟨h12.trans h23, h⟩ ⟨le_rfl, by linarith [Real.pi_pos]⟩ + (h3.trans h1.symm) + have h6 : t₂ = t₁ := le_antisymm (by linarith) h12 + rw [h6, h1] + +/-- Order with three equal points. -/ +theorem inOrder_three {Θ : Set S} (hO : IsOArc Θ) {x b : S} (hx : x ∈ Θ) + (hb : b ∈ Θ) : GM19.InOrderOn Θ x x x b := by + obtain ⟨f⟩ := hO + obtain ⟨t, -, rfl⟩ := exists_cuffPoint_mem_Ico f 0 hx + obtain ⟨t', ht', rfl⟩ := exists_cuffPoint_mem_Ico f t hb + exact ⟨f, t, t, t, t', le_rfl, le_rfl, ht'.1, ht'.2.le, rfl, rfl, rfl, rfl⟩ + +/-- A cell lies inside or outside a disc cut off by an `I`-arc. -/ +theorem cell_side [T2Space S] {Γ : Painting S} {F Δ : Set S} {c : Set S} (hc : c ∈ Γ.C) + (hn : Γ.IsNormal F) (hΔ : IsClosedDisc Δ) (hnb : ∀ x ∈ Δ \ F, Δ ∈ 𝓝 x) : + c ⊆ Δ ∨ c ⊆ Δᶜ := by + have hp := (arcComponentsIn_isPathConnected hc).isConnected.isPreconnected + have hsub : c ⊆ interior Δ ∪ Δᶜ := fun x hx => by + by_cases h : x ∈ Δ + · refine .inl (mem_interior_iff_mem_nhds.mpr (hnb x ⟨h, fun hF => ?_⟩)) + exact (arcComponentsIn_subset hc hx).2 (hn ⟨hF, (arcComponentsIn_subset hc hx).1⟩) + · exact .inr h + rcases hp.subset_or_subset isOpen_interior hΔ.isClosed.isOpen_compl + (disjoint_left.mpr fun x hx hx' => hx' (interior_subset hx)) hsub with h | h + · exact .inl (h.trans interior_subset) + · exact .inr h + +/-- At each end of an arc of the boundary there is a border cell that meets the arc. -/ +theorem exists_border_cell [T2Space S] {Γ : Painting S} {I Δ : Set S} {n₁ n₂ : S} + (hI : IsLineWithEnds I n₁ n₂) (hIb : I ⊆ bd S) (hIΔ : I ⊆ Δ) (hn₁N : n₁ ∈ Γ.N) + (hside : ∀ c ∈ Γ.C, c ⊆ Δ ∨ c ⊆ Δᶜ) : ∃ c ∈ Γ.C, c ⊆ Δ ∧ (c ∩ bd S).Nonempty ∧ n₁ ∈ tilde c ∧ + (c ∩ I).Nonempty := by + have h3 : n₁ ∈ closure (I \ {n₁, n₂}) := hI.subset_closure_diff hI.left_mem + have hsplit : I \ {n₁, n₂} = (I \ {n₁, n₂}) \ Γ.N ∪ ((I \ {n₁, n₂}) ∩ Γ.N) := + (sdiff_union_inter _ _).symm + rw [hsplit, closure_union] at h3 + have h4 : n₁ ∉ closure ((I \ {n₁, n₂}) ∩ Γ.N) := by + rw [(Γ.finite_N.subset inter_subset_right).isClosed.closure_eq] + exact fun h => h.1.2 (mem_insert _ _) + have h5 := h3.resolve_right h4 + have hcov : (I \ {n₁, n₂}) \ Γ.N ⊆ ⋃₀ {c ∈ Γ.C | (c ∩ I).Nonempty} := by + intro z hz + have hzU : z ∈ Γ.U \ Γ.N := ⟨Γ.bd_subset (hIb hz.1.1), hz.2⟩ + obtain ⟨c, hc, hzc⟩ := exists_mem_arcComponentsIn hzU + exact ⟨c, ⟨hc, z, hzc, hz.1.1⟩, hzc⟩ + have h6 := closure_mono hcov h5 + have hfinite : {c ∈ Γ.C | (c ∩ I).Nonempty}.Finite := + Γ.finite_cells.subset fun _ hc => hc.1 + rw [hfinite.closure_sUnion] at h6 + obtain ⟨c, ⟨hc, z, hzc, hzI⟩, hnc⟩ := mem_iUnion₂.mp h6 + exact ⟨c, hc, (hside c hc).resolve_right fun h => h hzc (hIΔ hzI), ⟨z, hzc, hIb hzI⟩, ⟨hnc, + fun hnc' => (arcComponentsIn_subset hc hnc').2 hn₁N⟩, + ⟨z, hzc, hzI⟩⟩ + +/-- The surface part of (6.7) of Graph Minors XVII, page 177. -/ +theorem normalIArcDiscPainting : NormalIArcDiscPaintingStatement := by + unfold NormalIArcDiscPaintingStatement + intro S _ hcS ht2 hconn hS Γ F Δ Θ n₁ n₂ hnorm hF hb hΘ hn₁ hn₂ hΔ h1 h2 + obtain ⟨I, I', Θ', hΘ', hI, hI', hu', hi', hu, hi, hmeet, hnb⟩ := arc_disc_data hS hF hb hΔ h1 h2 + have hΘeq : Θ' = Θ := cuffs_disjoint_eq hΘ' hΘ (hu' ▸ .inl hI.left_mem) hn₁ + subst hΘeq + have hcl := hΔ.isClosed + have hIΘ : I ⊆ Θ' := fun z hz => hu' ▸ .inl hz + have hΘb : Θ' ⊆ bd S := by + obtain ⟨x, -, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + have hIΔ : I ⊆ Δ := fun z hz => (hmeet ▸ hz : z ∈ Δ ∩ bd S).1 + refine ⟨?_, ?_, ?_⟩ + · intro c₁ hc₁ hs₁ c₂ hc₂ hs₂ x ⟨hx₁, hx₂⟩ + by_contra hxF + have hx : x ∈ Δ := closure_minimal hs₁ hcl hx₁.1 + have h3 := mem_closure_iff_nhds.mp hx₂.1 _ (hnb x ⟨hx, hxF⟩) + obtain ⟨y, hy, hy'⟩ := h3 + exact (cell_side hc₂ hnorm hΔ hnb).resolve_left hs₂ hy' hy + · obtain ⟨c, hc, h3, h4, h5, -⟩ := + exists_border_cell hI (hIΘ.trans hΘb) hIΔ (hnorm ⟨hF.left_mem, Γ.bd_subset (hΘb hn₁)⟩) + fun c hc => cell_side hc hnorm hΔ hnb + exact ⟨c, hc, h3, h4, h5⟩ + · rintro n' ⟨⟨hn'N, hn'Δ⟩, hn'b⟩ c hc hcΘ hcΔ m hm + have hn'I : n' ∈ I := hmeet ▸ ⟨hn'Δ, hn'b⟩ + refine ⟨hIΘ hn'I, ?_⟩ + have hdis : c ⊆ Δᶜ := (cell_side hc hnorm hΔ hnb).resolve_left hcΔ + obtain ⟨u, v, -, htilde, hL, hdiff, -, -⟩ := Γ.border_cell_exists_ends hc (hcΘ.mono + (inter_subset_inter_right _ hΘb)) + have hLΘ := (Γ.border_cell_subset_cuff hc hΘ hcΘ).1 + have hsub : (closure c ∩ bd S) \ {u, v} ⊆ I' := by + intro z hz + have hzc : z ∈ c := (hdiff ▸ hz : z ∈ c ∩ bd S).1 + have h3 : z ∈ I ∪ I' := hu' ▸ hLΘ hz.1 + exact h3.resolve_left fun h => hdis hzc (hIΔ h) + have hmL : m ∈ closure c ∩ bd S := by + have h3 : m ∈ ({u, v} : Set S) := htilde ▸ hm + rcases h3 with rfl | rfl + · exact hL.left_mem + · exact hL.right_mem + have hmI' : m ∈ I' := closure_minimal hsub hI'.isCompact.isClosed (hL.subset_closure_diff hmL) + exact inOrder_of_lines ((cuff_statement.{0} S hS).2.2 _ hΘ) hI hI' hu' hn'I hmI' + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Basic.lean b/LeanPool/GraphMinor/GM17/Basic.lean new file mode 100644 index 0000000000..ef29a56fbc --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Basic.lean @@ -0,0 +1,679 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Defs2 +import LeanPool.GraphMinor.Surface.Disc +import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import Mathlib.Topology.Connected.PathConnected +import Mathlib.Analysis.Convex.PathConnected +import Mathlib.Analysis.Normed.Module.Connected +import Mathlib.LinearAlgebra.Dimension.RankNullity + +import LeanPool.GraphMinor.Surface.Classification + +import LeanPool.GraphMinor.Surface.ModelCriterion + +/-! +# Foundational Lemmas and Section 1 of Graph Minors XVII + +This file proves (1.1) of N. Robertson and P. D. Seymour, *Graph Minors. XVII. Taming a vortex*, +J. Combin. Theory Ser. B 77 (1999) 162–210, together with the foundational topological and +combinatorial lemmas on `arcComponentsIn`, closed discs with finitely many points removed, lines, +and paintings (`GM17.Painting`) that are used throughout Sections 2–14. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology Metric +open scoped Convex +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +/-! ## 1. Classification of Surfaces: (1.1) (Page 163) -/ + +/-- **Graph Minors XVII, (1.1)(i)** (page 163): +Every connected surface $\Sigma$ is homeomorphic to $\Sigma(a, b, c)$ for some integers +$a, b, c \ge 0$. -/ +theorem theorem_1_1_i + (S : Type u) [TopologicalSpace S] (hS : IsSurface S) (hConn : ConnectedSpace S) : + ∃ a b c : ℕ, Nonempty (S ≃ₜ SurfaceModel a b c) := + GraphMinor.Surface.classification.{u} S hS hConn + +/-- Corrected Graph Minors XVII, (1.1)(ii) (page 163). As in `ModelCriterionStatement`, the +coefficients in the printed $a + 2b$ are interchanged. The equation uses $2a + b$. +For integers $a, b, c, a', b', c' \ge 0$, the surfaces $\Sigma(a, b, c)$ and $\Sigma(a', b', c')$ +are homeomorphic if and only if $c = c'$, $2a + b = 2a' + b'$, and either $b, b'$ are both zero +or neither is zero. -/ +theorem theorem_1_1_ii + (a b c a' b' c' : ℕ) : + Nonempty (SurfaceModel a b c ≃ₜ SurfaceModel a' b' c') ↔ + c = c' ∧ 2 * a + b = 2 * a' + b' ∧ (b = 0 ↔ b' = 0) := + GraphMinor.Surface.modelCriterion.2 a b c a' b' c' + +/-- Graph Minors XVII, (1.1) (page 163), with the corrected handle and crosscap coefficients in +(1.1)(ii). -/ +theorem theorem_1_1_proof : + (∀ (S : Type u) [TopologicalSpace S], IsSurface S → ConnectedSpace S → + ∃ a b c : ℕ, Nonempty (S ≃ₜ SurfaceModel a b c)) ∧ + (∀ a b c a' b' c' : ℕ, + Nonempty (SurfaceModel a b c ≃ₜ SurfaceModel a' b' c') ↔ + c = c' ∧ 2 * a + b = 2 * a' + b' ∧ (b = 0 ↔ b' = 0)) := + ⟨GraphMinor.Surface.classification.{u}, GraphMinor.Surface.modelCriterion.2⟩ + +/-! ## 2. General Lemmas on `arcComponentsIn` -/ + +section ArcComponents + +variable {S : Type*} [TopologicalSpace S] {F : Set S} + +theorem arcComponentsIn_nonempty {c : Set S} (hc : c ∈ arcComponentsIn F) : c.Nonempty := + hc.1 + +theorem arcComponentsIn_subset {c : Set S} (hc : c ∈ arcComponentsIn F) : c ⊆ F := + hc.2.1 + +theorem arcComponentsIn_isPathConnected {c : Set S} (hc : c ∈ arcComponentsIn F) : + IsPathConnected c := + hc.2.2.1 + +theorem arcComponentsIn_maximal {c D : Set S} (hc : c ∈ arcComponentsIn F) + (hDF : D ⊆ F) (hD : IsPathConnected D) (hcD : c ⊆ D) : D = c := + hc.2.2.2 D hDF hD hcD + +/-- If $D \subseteq F$ is path-connected and meets an arc-component $c \in \text{arcComponentsIn } +F$, +then $D \subseteq c$. -/ +theorem subset_arcComponent_of_isPathConnected {c D : Set S} (hc : c ∈ arcComponentsIn F) + (hDF : D ⊆ F) (hD : IsPathConnected D) (hinter : (D ∩ c).Nonempty) : D ⊆ c := by + rcases hinter with ⟨x, hxD, hxc⟩ + have hunion : IsPathConnected (c ∪ D) := hc.2.2.1.union hD ⟨x, hxc, hxD⟩ + have heq : c ∪ D = c := hc.2.2.2 (c ∪ D) (union_subset hc.2.1 hDF) hunion subset_union_left + exact subset_union_right.trans heq.subset + +/-- Two arc-components of $F$ that share a point are equal. -/ +theorem arcComponentsIn_eq_of_mem {c₁ c₂ : Set S} + (hc₁ : c₁ ∈ arcComponentsIn F) (hc₂ : c₂ ∈ arcComponentsIn F) + {x : S} (hx₁ : x ∈ c₁) (hx₂ : x ∈ c₂) : c₁ = c₂ := by + have h12 : c₁ ⊆ c₂ := + subset_arcComponent_of_isPathConnected hc₂ hc₁.2.1 hc₁.2.2.1 ⟨x, hx₁, hx₂⟩ + have h21 : c₂ ⊆ c₁ := + subset_arcComponent_of_isPathConnected hc₁ hc₂.2.1 hc₂.2.2.1 ⟨x, hx₂, hx₁⟩ + exact Subset.antisymm h12 h21 + +/-- Distinct arc-components of $F$ are disjoint. -/ +theorem arcComponentsIn_disjoint {c₁ c₂ : Set S} + (hc₁ : c₁ ∈ arcComponentsIn F) (hc₂ : c₂ ∈ arcComponentsIn F) (hne : c₁ ≠ c₂) : + Disjoint c₁ c₂ := by + rw [Set.disjoint_left] + intro x hx₁ hx₂ + exact hne (arcComponentsIn_eq_of_mem hc₁ hc₂ hx₁ hx₂) + +theorem pathComponentIn_mem_arcComponentsIn {x : S} (hx : x ∈ F) : + pathComponentIn F x ∈ arcComponentsIn F := + GraphMinor.Surface.mem_arcComponentsIn_of_mem hx + +/-- Every point of $F$ belongs to an arc-component of $F$. -/ +theorem exists_mem_arcComponentsIn {x : S} (hx : x ∈ F) : + ∃ c ∈ arcComponentsIn F, x ∈ c := + ⟨pathComponentIn F x, pathComponentIn_mem_arcComponentsIn hx, mem_pathComponentIn_self hx⟩ + +/-- The union of all arc-components of $F$ is $F$. -/ +theorem sUnion_arcComponentsIn (F : Set S) : ⋃₀ arcComponentsIn F = F := by + ext x + constructor + · rintro ⟨c, hc, hxc⟩ + exact hc.2.1 hxc + · intro hx + exact exists_mem_arcComponentsIn hx + +/-- If a finite family $\mathcal{J}$ of nonempty, path-connected, pairwise disjoint subsets covers +$F$ and each $J \in \mathcal{J}$ satisfies $\bar{J} \cap F = J$, then +$\text{arcComponentsIn } F = \mathcal{J}$. -/ +theorem arcComponentsIn_eq_of_finite_cover {𝒥 : Set (Set S)} + (hfin : 𝒥.Finite) + (hcov : ⋃₀ 𝒥 = F) + (hne : ∀ J ∈ 𝒥, J.Nonempty) + (hpc : ∀ J ∈ 𝒥, IsPathConnected J) + (hdisj : ∀ J₁ ∈ 𝒥, ∀ J₂ ∈ 𝒥, J₁ ≠ J₂ → Disjoint J₁ J₂) + (hclosed : ∀ J ∈ 𝒥, closure J ∩ F = J) : + arcComponentsIn F = 𝒥 := by + have hsubF : ∀ J ∈ 𝒥, J ⊆ F := fun J hJ => hcov ▸ subset_sUnion_of_mem hJ + have hpre : ∀ {D : Set S} {J : Set S} {x : S}, + IsPreconnected D → D ⊆ F → J ∈ 𝒥 → x ∈ D → x ∈ J → D ⊆ J := by + intro D J x hD hDF hJ hxD hxJ + set B : Set S := ⋃ K ∈ 𝒥 \ {J}, closure K + have hBcl : IsClosed B := + (hfin.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure + have hAcl : IsClosed (closure J) := isClosed_closure + have hcover : D ⊆ closure J ∪ B := by + intro y hyD + have hyF : y ∈ ⋃₀ 𝒥 := hcov.symm ▸ hDF hyD + rcases hyF with ⟨K, hK, hyK⟩ + by_cases hKJ : K = J + · exact Or.inl (subset_closure (hKJ ▸ hyK)) + · exact Or.inr (mem_iUnion₂.mpr ⟨K, ⟨hK, hKJ⟩, subset_closure hyK⟩) + have hnone : ¬ (D ∩ B).Nonempty := by + intro ⟨z, hzD, hzB⟩ + obtain ⟨y, hyD, hyJ, hyB⟩ := isPreconnected_closed_iff.mp hD (closure J) B hAcl hBcl hcover + ⟨x, hxD, subset_closure hxJ⟩ ⟨z, hzD, hzB⟩ + obtain ⟨K, ⟨hK, hKJ⟩, hyK⟩ := mem_iUnion₂.mp hyB + have hyF : y ∈ F := hDF hyD + have hyJ' : y ∈ J := by rw [← hclosed J hJ]; exact ⟨hyJ, hyF⟩ + have hyK' : y ∈ K := by rw [← hclosed K hK]; exact ⟨hyK, hyF⟩ + exact Set.disjoint_left.mp (hdisj K hK J hJ hKJ) hyK' hyJ' + intro y hyD + have hyJ : y ∈ closure J := (hcover hyD).resolve_right fun hyB => hnone ⟨y, hyD, hyB⟩ + rw [← hclosed J hJ] + exact ⟨hyJ, hDF hyD⟩ + ext C + constructor + · rintro ⟨⟨x, hxC⟩, hCF, hCpc, hCmax⟩ + have hxF : x ∈ ⋃₀ 𝒥 := hcov.symm ▸ hCF hxC + rcases hxF with ⟨J, hJ, hxJ⟩ + have hCJ : C ⊆ J := hpre hCpc.isConnected.isPreconnected hCF hJ hxC hxJ + have heq : J = C := hCmax J (hsubF J hJ) (hpc J hJ) hCJ + exact heq ▸ hJ + · intro hJ + refine ⟨hne C hJ, hsubF C hJ, hpc C hJ, fun D hDF hDpc hCD => ?_⟩ + rcases hne C hJ with ⟨x, hxC⟩ + exact Subset.antisymm (hpre hDpc.isConnected.isPreconnected hDF hJ (hCD hxC) hxC) hCD + +end ArcComponents + +/-! ## 3. Closed Discs with Finitely Many Points Removed and Lines -/ + +section DiscsAndLines + +private theorem one_lt_finrank_euclideanPlane : 1 < Module.finrank ℝ EuclideanPlane := by + simp [EuclideanPlane] + +/-- Removing a countable subset from `ClosedUnitDisc` leaves a dense subset of `ClosedUnitDisc`. -/ +theorem closure_closedUnitDisc_diff_of_countable {K : Set EuclideanPlane} (hK : K.Countable) : + closure (ClosedUnitDisc \ K) = ClosedUnitDisc := by + refine Subset.antisymm (closure_minimal sdiff_subset isClosed_closedBall) ?_ + have hsub : OpenUnitDisc ⊆ closure (OpenUnitDisc ∩ Kᶜ) := + (hK.dense_compl ℝ).open_subset_closure_inter isOpen_ball + have hsub2 : closure (OpenUnitDisc ∩ Kᶜ) ⊆ closure (ClosedUnitDisc \ K) := by + refine closure_mono fun x ⟨hxO, hxK⟩ => ⟨ball_subset_closedBall hxO, hxK⟩ + have hcl : closure OpenUnitDisc = ClosedUnitDisc := + closure_ball (0 : EuclideanPlane) one_ne_zero + calc ClosedUnitDisc + _ = closure OpenUnitDisc := hcl.symm + _ ⊆ closure (closure (OpenUnitDisc ∩ Kᶜ)) := closure_mono hsub + _ = closure (OpenUnitDisc ∩ Kᶜ) := closure_closure + _ ⊆ closure (ClosedUnitDisc \ K) := hsub2 + +/-- Removing a countable subset from `ClosedUnitDisc` leaves a path-connected set. -/ +theorem isPathConnected_closedUnitDisc_diff_of_countable {K : Set EuclideanPlane} + (hK : K.Countable) : IsPathConnected (ClosedUnitDisc \ K) := by + obtain ⟨a, haO, haK⟩ : (OpenUnitDisc ∩ Kᶜ).Nonempty := + (hK.dense_compl ℝ).inter_open_nonempty OpenUnitDisc isOpen_ball ⟨0, zero_mem_openUnitDisc⟩ + have ha : a ∈ ClosedUnitDisc \ K := ⟨ball_subset_closedBall haO, haK⟩ + refine ⟨a, ha, ?_⟩ + intro b hb + rcases eq_or_ne a b with rfl | hab + · exact JoinedIn.refl ha + let c : EuclideanPlane := (2 : ℝ)⁻¹ • (a + b) + let x : EuclideanPlane := (2 : ℝ)⁻¹ • (b - a) + have Ia : c - x = a := by simp only [c, x]; module + have Ib : c + x = b := by simp only [c, x]; module + have x_ne_zero : x ≠ 0 := by simpa [x] using sub_ne_zero.2 hab.symm + obtain ⟨y, hy⟩ : ∃ y : EuclideanPlane, LinearIndependent ℝ ![x, y] := + exists_linearIndependent_pair_of_one_lt_finrank one_lt_finrank_euclideanPlane x_ne_zero + have hy_ne : y ≠ 0 := hy.ne_zero 1 + have hnorm_a : ‖a‖ < 1 := mem_ball_zero_iff.mp haO + have hnorm_b : ‖b‖ ≤ 1 := mem_closedBall_zero_iff.mp hb.1 + have hnorm_c : ‖c‖ < 1 := by + calc ‖c‖ = ‖(2 : ℝ)⁻¹ • (a + b)‖ := rfl + _ = 2⁻¹ * ‖a + b‖ := by rw [norm_smul, Real.norm_of_nonneg (by positivity)] + _ ≤ 2⁻¹ * (‖a‖ + ‖b‖) := mul_le_mul_of_nonneg_left (norm_add_le a b) (by positivity) + _ < 2⁻¹ * (1 + 1) := by linarith + _ = 1 := by norm_num + have A : Set.Countable {t : ℝ | ([c + x -[ℝ] c + t • y] ∩ K).Nonempty} := by + apply countable_ofPred_nonempty_of_disjoint _ (fun _ => inter_subset_right) hK + intro t t' htt' + apply disjoint_iff_inter_eq_empty.2 + have N : {c + x} ∩ K = ∅ := by + simpa only [singleton_inter_eq_empty, Ib] using hb.2 + rw [inter_assoc, inter_comm K, inter_assoc, inter_self, ← inter_assoc, ← subset_empty_iff, ← N] + apply inter_subset_inter_left + apply Eq.subset + apply segment_inter_eq_endpoint_of_linearIndependent_of_ne hy htt'.symm + have B : Set.Countable {t : ℝ | ([c - x -[ℝ] c + t • y] ∩ K).Nonempty} := by + apply countable_ofPred_nonempty_of_disjoint _ (fun _ => inter_subset_right) hK + intro t t' htt' + apply disjoint_iff_inter_eq_empty.2 + have N : {c - x} ∩ K = ∅ := by + simpa only [singleton_inter_eq_empty, Ia] using ha.2 + rw [inter_assoc, inter_comm K, inter_assoc, inter_self, ← inter_assoc, ← subset_empty_iff, ← N] + apply inter_subset_inter_left + rw [sub_eq_add_neg _ x] + apply Eq.subset + apply segment_inter_eq_endpoint_of_linearIndependent_of_ne _ htt'.symm + convert! hy.units_smul ![-1, 1] + simp [← List.ofFn_inj] + let r : ℝ := (1 - ‖c‖) / ‖y‖ + have hr : 0 < r := div_pos (sub_pos.mpr hnorm_c) (norm_pos_iff.mpr hy_ne) + obtain ⟨t, htIoo, htAB⟩ : + (Ioo (-r) r ∩ ({t : ℝ | ([c + x -[ℝ] c + t • y] ∩ K).Nonempty} ∪ + {t : ℝ | ([c - x -[ℝ] c + t • y] ∩ K).Nonempty})ᶜ).Nonempty := + ((A.union B).dense_compl ℝ).inter_open_nonempty (Ioo (-r) r) isOpen_Ioo ⟨0, neg_lt_zero.mpr hr, + hr⟩ + let z : EuclideanPlane := c + t • y + have hz_mem : z ∈ ClosedUnitDisc := by + rw [ClosedUnitDisc, mem_closedBall_zero_iff] + have htabs : |t| < r := abs_lt.mpr htIoo + have hty : ‖t • y‖ ≤ 1 - ‖c‖ := by + rw [norm_smul, Real.norm_eq_abs] + exact (mul_lt_mul_of_pos_right htabs (norm_pos_iff.mpr hy_ne)).le.trans_eq + (div_mul_cancel₀ (1 - ‖c‖) (norm_ne_zero_iff.mpr hy_ne)) + exact (norm_add_le c (t • y)).trans (by linarith) + simp only [compl_union, mem_inter_iff, mem_compl_iff, mem_ofPred_eq, not_nonempty_iff_eq_empty] + at htAB + have JA : JoinedIn (ClosedUnitDisc \ K) a z := by + apply JoinedIn.of_segment_subset + intro p hp + refine ⟨convex_closedUnitDisc.segment_subset ha.1 hz_mem hp, fun hpK => ?_⟩ + have hmem : p ∈ [c - x -[ℝ] z] ∩ K := ⟨by simpa [Ia] using hp, hpK⟩ + rw [htAB.2] at hmem + exact hmem + have JB : JoinedIn (ClosedUnitDisc \ K) b z := by + apply JoinedIn.of_segment_subset + intro p hp + refine ⟨convex_closedUnitDisc.segment_subset hb.1 hz_mem hp, fun hpK => ?_⟩ + have hmem : p ∈ [c + x -[ℝ] z] ∩ K := ⟨by simpa [Ib] using hp, hpK⟩ + rw [htAB.1] at hmem + exact hmem + exact JA.trans JB.symm + +variable {S : Type*} [TopologicalSpace S] + +/-- Every closed disc in a topological space is compact. -/ +theorem isCompact_of_isClosedDisc {Δ : Set S} (hΔ : IsClosedDisc Δ) : IsCompact Δ := by + rcases hΔ with ⟨φ⟩ + have : CompactSpace ClosedUnitDisc := isCompact_iff_compactSpace.mp (isCompact_closedBall 0 1) + have : CompactSpace Δ := φ.compactSpace + exact isCompact_iff_compactSpace.mpr ‹CompactSpace Δ› + +/-- Every closed disc in a T2 space is closed. -/ +theorem isClosed_of_isClosedDisc [T2Space S] {Δ : Set S} (hΔ : IsClosedDisc Δ) : IsClosed Δ := + (isCompact_of_isClosedDisc hΔ).isClosed + +/-- If $\Delta$ is a closed disc and $A \subseteq \Delta$ has $(\Delta \setminus A)$ finite, +then $A$ is path-connected. -/ +theorem isPathConnected_of_isClosedDisc_finite_diff {Δ A : Set S} + (hΔ : IsClosedDisc Δ) (hA : A ⊆ Δ) (hfin : (Δ \ A).Finite) : + IsPathConnected A := by + classical + rcases hΔ with ⟨φ⟩ + set K : Set EuclideanPlane := Subtype.val '' (φ ⁻¹' (Subtype.val ⁻¹' (Δ \ A))) + have hKfin : K.Finite := by + have hsub : (Subtype.val ⁻¹' (Δ \ A) : Set Δ).Finite := + hfin.preimage Subtype.val_injective.injOn + exact (hsub.preimage φ.injective.injOn).image Subtype.val + have hpc := isPathConnected_closedUnitDisc_diff_of_countable hKfin.countable + let f : EuclideanPlane → S := fun x => + if hx : x ∈ ClosedUnitDisc then (φ ⟨x, hx⟩).1 else (φ ⟨0, zero_mem_closedUnitDisc⟩).1 + have hf_cont : ContinuousOn f (ClosedUnitDisc \ K) := by + rw [continuousOn_iff_continuous_domRestrict] + have heq : (ClosedUnitDisc \ K).domRestrict f = + fun z : ↑(ClosedUnitDisc \ K) => (φ ⟨z.1, z.2.1⟩).1 := by + ext z + simp [f, z.2.1] + rw [heq] + exact continuous_subtype_val.comp (φ.continuous.comp (Continuous.subtype_mk + continuous_subtype_val _)) + have himg : f '' (ClosedUnitDisc \ K) = A := by + ext y + constructor + · rintro ⟨x, ⟨hxD, hxK⟩, rfl⟩ + simp only [f, hxD, dite_true] + by_contra hyA + apply hxK + exact ⟨⟨x, hxD⟩, ⟨(φ ⟨x, hxD⟩).2, hyA⟩, rfl⟩ + · intro hyA + obtain ⟨z, hz⟩ := φ.surjective ⟨y, hA hyA⟩ + have hyz : (φ z).1 = y := congrArg Subtype.val hz + refine ⟨z.1, ⟨z.2, ?_⟩, ?_⟩ + · rintro ⟨w, ⟨_, hwA⟩, hwz⟩ + have hw_eq : w = z := Subtype.ext hwz + rw [hw_eq, hyz] at hwA + exact hwA hyA + · simp only [f, z.2, dite_true, hyz] + rw [← himg] + exact hpc.image' hf_cont + +/-- If $\Delta$ is a closed disc in a T2 space and $A \subseteq \Delta$ has $(\Delta \setminus A)$ +finite, then $\bar{A} = \Delta$. -/ +theorem closure_eq_of_isClosedDisc_finite_diff [T2Space S] {Δ A : Set S} + (hΔ : IsClosedDisc Δ) (hA : A ⊆ Δ) (hfin : (Δ \ A).Finite) : + closure A = Δ := by + refine Subset.antisymm (closure_minimal hA (isClosed_of_isClosedDisc hΔ)) ?_ + rcases hΔ with ⟨φ⟩ + set K : Set EuclideanPlane := Subtype.val '' (φ ⁻¹' (Subtype.val ⁻¹' (Δ \ A))) + have hKfin : K.Finite := by + have hsub : (Subtype.val ⁻¹' (Δ \ A) : Set Δ).Finite := + hfin.preimage Subtype.val_injective.injOn + exact (hsub.preimage φ.injective.injOn).image Subtype.val + have hcl := closure_closedUnitDisc_diff_of_countable hKfin.countable + intro y hyΔ + obtain ⟨z, hz⟩ := φ.surjective ⟨y, hyΔ⟩ + have hyz : (φ z).1 = y := congrArg Subtype.val hz + rw [_root_.mem_closure_iff] + intro V hV hyV + have hz_mem : z.1 ∈ closure (ClosedUnitDisc \ K) := by rw [hcl]; exact z.2 + let U : Set EuclideanPlane := + {x : EuclideanPlane | ∃ hx : x ∈ ClosedUnitDisc, (φ ⟨x, hx⟩).1 ∈ V} + have hU_open_sub : IsOpen (Subtype.val ⁻¹' U : Set ClosedUnitDisc) := by + have heq : (Subtype.val ⁻¹' U : Set ClosedUnitDisc) = + (fun w : ClosedUnitDisc => (φ w).1) ⁻¹' V := by + ext w + simp [U] + rw [heq] + exact hV.preimage (continuous_subtype_val.comp φ.continuous) + obtain ⟨W, hW_open, hW_eq⟩ := isOpen_induced_iff.mp hU_open_sub + have hzW : z.1 ∈ W := by + have hzU : z ∈ Subtype.val ⁻¹' U := ⟨z.2, by rw [hyz]; exact hyV⟩ + rw [← hW_eq] at hzU + exact hzU + obtain ⟨x, hxW, hxD, hxK⟩ := _root_.mem_closure_iff.mp hz_mem W hW_open hzW + have hxU : (⟨x, hxD⟩ : ClosedUnitDisc) ∈ Subtype.val ⁻¹' U := by + rw [← hW_eq]; exact hxW + rcases hxU with ⟨_, hxV⟩ + refine ⟨(φ ⟨x, hxD⟩).1, hxV, ?_⟩ + by_contra hxA + apply hxK + exact ⟨⟨x, hxD⟩, ⟨(φ ⟨x, hxD⟩).2, hxA⟩, rfl⟩ + +/-- If $\Delta$ is a closed disc in a T2 space and $K$ is a finite set, then +$\widetilde{\Delta \setminus K} = \Delta \cap K$. -/ +theorem tilde_diff_eq_of_isClosedDisc_finite [T2Space S] {Δ K : Set S} + (hΔ : IsClosedDisc Δ) (hK : K.Finite) : + tilde (Δ \ K) = Δ ∩ K := by + have hfin : (Δ \ (Δ \ K)).Finite := hK.subset fun x hx => by + simp only [mem_sdiff, not_and, not_not] at hx + exact hx.2 hx.1 + have hcl : closure (Δ \ K) = Δ := closure_eq_of_isClosedDisc_finite_diff hΔ sdiff_subset hfin + ext x + simp only [tilde, hcl, mem_sdiff, mem_inter_iff, not_and, not_not] + exact ⟨fun ⟨hxΔ, h⟩ => ⟨hxΔ, h hxΔ⟩, fun ⟨hxΔ, hxK⟩ => ⟨hxΔ, fun _ => hxK⟩⟩ + +/-- Symmetry of `IsLineWithEnds`: a line with ends $u$ and $v$ is also a line with ends $v$ and $u$. +-/ +theorem isLineWithEnds_symm {L : Set S} {u v : S} (h : IsLineWithEnds L u v) : + IsLineWithEnds L v u := by + rcases h with ⟨f, hf0, hf1⟩ + let rev : unitInterval ≃ₜ unitInterval := + { toFun := unitInterval.symm + invFun := unitInterval.symm + left_inv := unitInterval.symm_symm + right_inv := unitInterval.symm_symm + continuous_toFun := unitInterval.continuous_symm + continuous_invFun := unitInterval.continuous_symm } + refine ⟨rev.trans f, ?_, ?_⟩ + · change (f (unitInterval.symm 0)).1 = v + rw [unitInterval.symm_zero] + exact hf1 + · change (f (unitInterval.symm 1)).1 = u + rw [unitInterval.symm_one] + exact hf0 + +/-- The two ends of a line are distinct. -/ +theorem ne_of_isLineWithEnds {L : Set S} {u v : S} (h : IsLineWithEnds L u v) : u ≠ v := by + rcases h with ⟨f, hf0, hf1⟩ + intro huv + have h01 : f 0 = f 1 := Subtype.ext (hf0.trans (huv.trans hf1.symm)) + have : (0 : unitInterval) = 1 := f.injective h01 + exact zero_ne_one this + +/-- Both ends of a line $L$ belong to $L$ and to `lineEnds L`. -/ +theorem ends_subset_of_isLineWithEnds {L : Set S} {u v : S} (h : IsLineWithEnds L u v) : + {u, v} ⊆ L ∧ {u, v} ⊆ lineEnds L := by + rcases h with ⟨f, hf0, hf1⟩ + refine ⟨?_, ?_⟩ + · rintro x (rfl | rfl) + · rw [← hf0]; exact (f 0).2 + · rw [← hf1]; exact (f 1).2 + · rintro x (rfl | rfl) + · exact ⟨v, f, hf0, hf1⟩ + · exact ⟨u, isLineWithEnds_symm ⟨f, hf0, hf1⟩⟩ + +/-- The interior $L \setminus \{u, v\}$ of a line $L$ with ends $u, v$ is path-connected and +nonempty. -/ +theorem isPathConnected_diff_ends_of_isLineWithEnds {L : Set S} {u v : S} + (hL : IsLineWithEnds L u v) : + (L \ {u, v}).Nonempty ∧ IsPathConnected (L \ {u, v}) := + ⟨hL.isPathConnected_interior.nonempty, hL.isPathConnected_interior⟩ + +end DiscsAndLines + +/-! ## 4. Foundational Lemmas for Paintings (`GM17.Painting`) -/ + +namespace Painting + +variable {S : Type} [TopologicalSpace S] (Γ : Painting S) + +theorem cell_nonempty {c : Set S} (hc : c ∈ Γ.C) : c.Nonempty := + hc.1 + +theorem cell_subset_diff {c : Set S} (hc : c ∈ Γ.C) : c ⊆ Γ.U \ Γ.N := + hc.2.1 + +theorem cell_subset_U {c : Set S} (hc : c ∈ Γ.C) : c ⊆ Γ.U := + (Γ.cell_subset_diff hc).trans sdiff_subset + +theorem cell_disjoint_N {c : Set S} (hc : c ∈ Γ.C) : Disjoint c Γ.N := + Set.disjoint_left.mpr fun _ hx => (Γ.cell_subset_diff hc hx).2 + +theorem cell_isPathConnected {c : Set S} (hc : c ∈ Γ.C) : IsPathConnected c := + hc.2.2.1 + +theorem cell_eq_of_mem {c₁ c₂ : Set S} (hc₁ : c₁ ∈ Γ.C) (hc₂ : c₂ ∈ Γ.C) + {x : S} (hx₁ : x ∈ c₁) (hx₂ : x ∈ c₂) : c₁ = c₂ := + arcComponentsIn_eq_of_mem hc₁ hc₂ hx₁ hx₂ + +theorem cell_disjoint {c₁ c₂ : Set S} (hc₁ : c₁ ∈ Γ.C) (hc₂ : c₂ ∈ Γ.C) (hne : c₁ ≠ c₂) : + Disjoint c₁ c₂ := + arcComponentsIn_disjoint hc₁ hc₂ hne + +theorem closure_cell_subset_U {c : Set S} (hc : c ∈ Γ.C) : closure c ⊆ Γ.U := + closure_minimal (Γ.cell_subset_U hc) Γ.isClosed_U + +theorem isClosedDisc_closure_cell {c : Set S} (hc : c ∈ Γ.C) : IsClosedDisc (closure c) := + (Γ.cell_disc c hc).1 + +theorem tilde_subset_discBd {c : Set S} (hc : c ∈ Γ.C) : tilde c ⊆ discBd (closure c) := + (Γ.cell_disc c hc).2.1 + +theorem finite_tilde_cell {c : Set S} (hc : c ∈ Γ.C) : (tilde c).Finite := + (Γ.cell_disc c hc).2.2.1 + +theorem ncard_tilde_cell_le {c : Set S} (hc : c ∈ Γ.C) : (tilde c).ncard ≤ 3 := + (Γ.cell_disc c hc).2.2.2 + +/-- For any cell $c \in C(\Gamma)$ and any $x \in \bar{c}$, the set $c \cup \{x\}$ is +path-connected. -/ +theorem isPathConnected_cell_insert {c : Set S} (hc : c ∈ Γ.C) {x : S} (hx : x ∈ closure c) : + IsPathConnected (c ∪ {x}) := by + have hsub : c ∪ {x} ⊆ closure c := union_subset subset_closure (singleton_subset_iff.mpr hx) + have hfin : (closure c \ (c ∪ {x})).Finite := + (Γ.finite_tilde_cell hc).subset fun y hy => ⟨hy.1, fun hyc => hy.2 (Or.inl hyc)⟩ + exact isPathConnected_of_isClosedDisc_finite_diff (Γ.isClosedDisc_closure_cell hc) hsub hfin + +/-- For every cell $c \in C(\Gamma)$, $\tilde{c} = \bar{c} \setminus c \subseteq N(\Gamma)$. -/ +theorem tilde_subset_N {c : Set S} (hc : c ∈ Γ.C) : tilde c ⊆ Γ.N := by + intro x ⟨hxcl, hxc⟩ + by_contra hxN + have hxU : x ∈ Γ.U := Γ.closure_cell_subset_U hc hxcl + have hsub : c ∪ {x} ⊆ Γ.U \ Γ.N := + union_subset (Γ.cell_subset_diff hc) (singleton_subset_iff.mpr ⟨hxU, hxN⟩) + have hpc : IsPathConnected (c ∪ {x}) := Γ.isPathConnected_cell_insert hc hxcl + have heq : c ∪ {x} = c := hc.2.2.2 (c ∪ {x}) hsub hpc subset_union_left + have hx_in_c : x ∈ c := heq ▸ Or.inr rfl + exact hxc hx_in_c + +/-- For every cell $c \in C(\Gamma)$, $\bar{c} \setminus N(\Gamma) = c$. -/ +theorem closure_cell_diff_N {c : Set S} (hc : c ∈ Γ.C) : closure c \ Γ.N = c := by + ext x + constructor + · rintro ⟨hxcl, hxN⟩ + by_contra hxc + exact hxN (Γ.tilde_subset_N hc ⟨hxcl, hxc⟩) + · intro hxc + exact ⟨subset_closure hxc, (Γ.cell_subset_diff hc hxc).2⟩ + +/-- For every cell $c \in C(\Gamma)$, $\bar{c} \cap N(\Gamma) = \tilde{c}$. -/ +theorem closure_cell_inter_N {c : Set S} (hc : c ∈ Γ.C) : closure c ∩ Γ.N = tilde c := by + ext x + constructor + · rintro ⟨hxcl, hxN⟩ + exact ⟨hxcl, fun hxc => (Γ.cell_subset_diff hc hxc).2 hxN⟩ + · intro hx + exact ⟨hx.1, Γ.tilde_subset_N hc hx⟩ + +/-- For distinct cells $c_1, c_2 \in C(\Gamma)$, $\bar{c}_1 \cap \bar{c}_2 = \tilde{c}_1 \cap +\tilde{c}_2 \subseteq N(\Gamma)$. -/ +theorem closure_cell_inter_closure_cell {c₁ c₂ : Set S} + (hc₁ : c₁ ∈ Γ.C) (hc₂ : c₂ ∈ Γ.C) (hne : c₁ ≠ c₂) : + closure c₁ ∩ closure c₂ = tilde c₁ ∩ tilde c₂ := by + ext x + constructor + · rintro ⟨hx₁, hx₂⟩ + by_cases hxN : x ∈ Γ.N + · rw [← Γ.closure_cell_inter_N hc₁, ← Γ.closure_cell_inter_N hc₂] + exact ⟨⟨hx₁, hxN⟩, ⟨hx₂, hxN⟩⟩ + · have h1 : x ∈ c₁ := by rw [← Γ.closure_cell_diff_N hc₁]; exact ⟨hx₁, hxN⟩ + have h2 : x ∈ c₂ := by rw [← Γ.closure_cell_diff_N hc₂]; exact ⟨hx₂, hxN⟩ + exact False.elim (hne (Γ.cell_eq_of_mem hc₁ hc₂ h1 h2)) + · rintro ⟨hx₁, hx₂⟩ + exact ⟨hx₁.1, hx₂.1⟩ + +theorem sUnion_cells : ⋃₀ Γ.C = Γ.U \ Γ.N := + sUnion_arcComponentsIn (Γ.U \ Γ.N) + +theorem U_eq_N_union_cells : Γ.U = Γ.N ∪ ⋃₀ Γ.C := by + rw [Γ.sUnion_cells] + ext x + simp only [mem_union, mem_sdiff] + constructor + · intro hx + by_cases h : x ∈ Γ.N + · exact Or.inl h + · exact Or.inr ⟨hx, h⟩ + · rintro (h | ⟨h, _⟩) + · exact Γ.N_subset h + · exact h + +theorem U_eq_N_union_biUnion_closure : Γ.U = Γ.N ∪ ⋃ c ∈ Γ.C, closure c := by + refine Subset.antisymm ?_ ?_ + · rw [Γ.U_eq_N_union_cells] + refine union_subset_union_right Γ.N ?_ + rintro x ⟨c, hc, hxc⟩ + exact mem_iUnion₂.mpr ⟨c, hc, subset_closure hxc⟩ + · exact union_subset Γ.N_subset (iUnion₂_subset fun c hc => Γ.closure_cell_subset_U hc) + +/-- For every border cell $c \in C(\Gamma)$, there exist distinct nodes $u, v \in N(\Gamma) \cap +\operatorname{bd}(\Sigma)$ +such that $\tilde{c} = \{u, v\}$, $\bar{c} \cap \operatorname{bd}(\Sigma)$ is a line with ends +$u, v$, and $c \cap \operatorname{bd}(\Sigma) = (\bar{c} \cap \operatorname{bd}(\Sigma)) \setminus +\{u, v\}$. -/ +theorem border_cell_exists_ends {c : Set S} (hc : c ∈ Γ.C) (hbd : (c ∩ bd S).Nonempty) : + ∃ u v : S, u ≠ v ∧ tilde c = {u, v} ∧ + IsLineWithEnds (closure c ∩ bd S) u v ∧ + c ∩ bd S = (closure c ∩ bd S) \ {u, v} ∧ + u ∈ Γ.N ∩ bd S ∧ v ∈ Γ.N ∩ bd S := by + obtain ⟨hncard, hfin, ⟨f⟩, hends⟩ := Γ.border_cell c hc hbd + set L := closure c ∩ bd S + let u : S := (f 0).1 + let v : S := (f 1).1 + have hL : IsLineWithEnds L u v := ⟨f, rfl, rfl⟩ + have huv : u ≠ v := ne_of_isLineWithEnds hL + have hsub_L : {u, v} ⊆ L := (ends_subset_of_isLineWithEnds hL).1 + have hsub_tilde : {u, v} ⊆ tilde c := hends ▸ (ends_subset_of_isLineWithEnds hL).2 + have hpair_ncard : ({u, v} : Set S).ncard = 2 := ncard_pair huv + have heq_tilde : {u, v} = tilde c := + eq_of_subset_of_ncard_le hsub_tilde (by omega) hfin + have hdiff : c ∩ bd S = L \ {u, v} := by + rw [heq_tilde] + ext x + simp only [L, tilde, mem_inter_iff, mem_sdiff, not_and, not_not] + exact ⟨fun ⟨hxc, hxbd⟩ => ⟨⟨subset_closure hxc, hxbd⟩, fun _ => hxc⟩, + fun ⟨⟨hxcl, hxbd⟩, h⟩ => ⟨h hxcl, hxbd⟩⟩ + have huN : u ∈ Γ.N := Γ.tilde_subset_N hc (heq_tilde ▸ mem_insert u {v}) + have hvN : v ∈ Γ.N := Γ.tilde_subset_N hc (heq_tilde ▸ mem_insert_of_mem u rfl) + have hubd : u ∈ bd S := (hsub_L (mem_insert u {v})).2 + have hvbd : v ∈ bd S := (hsub_L (mem_insert_of_mem u rfl)).2 + exact ⟨u, v, huv, heq_tilde.symm, hL, hdiff, ⟨huN, hubd⟩, ⟨hvN, hvbd⟩⟩ + +/-- If a cell $c \in C(\Gamma)$ meets a cuff $\Theta \in \text{cuffs } S$, then +$\bar{c} \cap \operatorname{bd}(\Sigma) \subseteq \Theta$, so $c$ borders no other cuff and +$\tilde{c} \subseteq N(\Gamma) \cap \Theta$. -/ +theorem border_cell_subset_cuff {c Θ : Set S} (hc : c ∈ Γ.C) (hΘ : Θ ∈ cuffs S) + (hinter : (c ∩ Θ).Nonempty) : + closure c ∩ bd S ⊆ Θ ∧ + c ∩ bd S = c ∩ Θ ∧ + closure c ∩ bd S = closure c ∩ Θ ∧ + tilde c ⊆ Γ.N ∩ Θ ∧ + ∀ Θ' ∈ cuffs S, (c ∩ Θ').Nonempty → Θ' = Θ := by + rcases hΘ with ⟨x₀, hx₀, rfl⟩ + have hΘ_sub : connectedComponentIn (bd S) x₀ ⊆ bd S := connectedComponentIn_subset (bd S) x₀ + have hbd : (c ∩ bd S).Nonempty := hinter.mono (inter_subset_inter_right c hΘ_sub) + obtain ⟨u, v, _, htilde, ⟨f, _, _⟩, _, hu, hv⟩ := Γ.border_cell_exists_ends hc hbd + have hconn_L : IsPreconnected (closure c ∩ bd S) := by + have hrange : Set.range (fun t : unitInterval => (f t).1) = closure c ∩ bd S := by + ext z + constructor + · rintro ⟨t, rfl⟩; exact (f t).2 + · intro hz; exact ⟨f.symm ⟨z, hz⟩, congrArg Subtype.val (f.apply_symm_apply ⟨z, hz⟩)⟩ + rw [← hrange] + exact isPreconnected_range (continuous_subtype_val.comp f.continuous) + rcases hinter with ⟨y, hyc, hyΘ⟩ + have hyL : y ∈ closure c ∩ bd S := ⟨subset_closure hyc, hΘ_sub hyΘ⟩ + have hsubΘ : closure c ∩ bd S ⊆ connectedComponentIn (bd S) x₀ := by + rw [connectedComponentIn_eq hyΘ] + exact hconn_L.subset_connectedComponentIn hyL inter_subset_right + have hc_eq : c ∩ bd S = c ∩ connectedComponentIn (bd S) x₀ := by + refine Subset.antisymm (fun z ⟨hzc, hzbd⟩ => ⟨hzc, hsubΘ ⟨subset_closure hzc, hzbd⟩⟩) ?_ + exact inter_subset_inter_right c hΘ_sub + have hcl_eq : closure c ∩ bd S = closure c ∩ connectedComponentIn (bd S) x₀ := by + refine Subset.antisymm (fun z hz => ⟨hz.1, hsubΘ hz⟩) ?_ + exact inter_subset_inter_right (closure c) hΘ_sub + have htilde_sub : tilde c ⊆ Γ.N ∩ connectedComponentIn (bd S) x₀ := by + intro z hz + have hz_bd : z ∈ bd S := by + rw [htilde] at hz + rcases hz with rfl | rfl + · exact hu.2 + · exact hv.2 + exact ⟨Γ.tilde_subset_N hc hz, hsubΘ ⟨hz.1, hz_bd⟩⟩ + refine ⟨hsubΘ, hc_eq, hcl_eq, htilde_sub, ?_⟩ + rintro Θ' ⟨x₁, _, rfl⟩ ⟨w, hwc, hwΘ'⟩ + have hwbd : w ∈ bd S := connectedComponentIn_subset (bd S) x₁ hwΘ' + have hwΘ : w ∈ connectedComponentIn (bd S) x₀ := hsubΘ ⟨subset_closure hwc, hwbd⟩ + exact (connectedComponentIn_eq hwΘ').trans (connectedComponentIn_eq hwΘ).symm + +/-- Every point of $\operatorname{bd}(\Sigma) \setminus N(\Gamma)$ belongs to a unique border cell +$c \in C(\Gamma)$. -/ +theorem exists_border_cell_of_mem_bd {x : S} (hx : x ∈ bd S \ Γ.N) : + ∃! c, c ∈ Γ.C ∧ x ∈ c := by + have hxU : x ∈ Γ.U \ Γ.N := ⟨Γ.bd_subset hx.1, hx.2⟩ + obtain ⟨c, hc, hxc⟩ := exists_mem_arcComponentsIn hxU + refine ⟨c, ⟨hc, hxc⟩, ?_⟩ + rintro c' ⟨hc', hxc'⟩ + exact Γ.cell_eq_of_mem hc' hc hxc' hxc + +end Painting + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Bigon.lean b/LeanPool/GraphMinor/GM17/Bigon.lean new file mode 100644 index 0000000000..2b1b8cce49 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Bigon.lean @@ -0,0 +1,201 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CapSide + +/-! +# Pushing a curve off a node + +We finish the proof of `CutNormalOArcPaintingStatement`, the surface part of (5.4) of Graph Minors +XVII (page 173). A normal `O`-arc `F` may pass through +nodes. The paper diverts `F` around them. We do this one node `n` at a time. We paste discs on all +cuffs (`exists_cap_discs`) and cut the closed surface along +`F`. All cells at `n`, and the disc on the cuff of `n`, come to `n` from the same side of `F`, +because a cell comes to a point from one side only and the cells +overlap the disc along the cuff. So the other lift of `n` is free (`exists_free_lift`). A thin wedge +at this lift (`exists_wedge`) is a disc `G` in the surface +that has a line of `F` around `n` on its boundary and meets the paint only at `n` (`exists_bigon`). +Swapping that line for the other side of `G` gives a curve +with one node fewer. A disc bounded by the new curve gives a disc bounded by `F` with the same +cells, by adding or removing `G` (`flip_disc`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {Y S : Type} [TopologicalSpace Y] [TopologicalSpace S] + +/-- Pasting discs on all the cuffs of a surface. -/ +theorem exists_cap_discs (n : ℕ) : ∀ (S : Type) [TopologicalSpace S] [ConnectedSpace S], IsSurface + S → (cuffs S).ncard = n → + ∃ (T : Type) (_ : TopologicalSpace T) (j : S → T) (cap : Set S → Set T), IsClosedSurface T + ∧ ConnectedSpace T ∧ IsClosedEmbedding j ∧ + (∀ C ∈ cuffs S, IsClosedDisc (cap C) ∧ discBd (cap C) = j '' C ∧ range j ∩ cap C = j '' C) + ∧ range j ∪ ⋃ C ∈ cuffs S, cap C = univ := by + classical + induction n with + | zero => + intro S _ _ hS hn + have hf := (cuff_statement.{0} S hS).2.1 + have he : cuffs S = ∅ := (Set.ncard_eq_zero hf).mp hn + refine ⟨S, _, id, fun _ => ∅, ⟨hS.1, hS.2.1, fun x => ?_⟩, ‹_›, IsClosedEmbedding.id, ?_, ?_⟩ + · by_contra hcon + have : connectedComponentIn (bd S) x ∈ cuffs S := ⟨x, hcon, rfl⟩ + rw [he] at this + exact this + · simp [he] + · simp + | succ n ih => + intro S _ _ hS hn + have hf := (cuff_statement.{0} S hS).2.1 + have hne : (cuffs S).Nonempty := (Set.ncard_pos hf).mp (by omega) + obtain ⟨C₀, hC₀⟩ := hne + obtain ⟨S', tS', ι, Δ, hS', hι, hΔ, hcov, hmeet, hΔb, hbd⟩ := paste_disc.{0} S C₀ hS hC₀ + obtain ⟨a, b, c, ⟨e⟩⟩ := classification.{0} S hS ‹_› + obtain ⟨-, ⟨e'⟩⟩ := paste_model hS hC₀ hS' hι hΔ hcov hmeet hΔb e + have hconn : ConnectedSpace S' := by + have := (isSurface_model a b (c - 1)).2 + exact e'.symm.surjective.connectedSpace e'.symm.continuous + have hOS := (cuff_statement.{0} S hS).2.2 + have hd : ∀ C ∈ cuffs S, C ≠ C₀ → ι '' C ∈ cuffs S' := fun C hC hne => + image_cuff hS hC₀ hι hbd hC (cuffs_disjoint hC₀ hC hne.symm) (hOS C hC) hS' + have hcuffs : cuffs S' = (fun C => ι '' C) '' (cuffs S \ {C₀}) := by + ext P + constructor + · intro hP + obtain ⟨x, hx, rfl⟩ := id hP + have hx' := hx + rw [hbd] at hx' + obtain ⟨y, ⟨hy, hyC⟩, rfl⟩ := hx' + have hC : connectedComponentIn (bd S) y ∈ cuffs S := ⟨y, hy, rfl⟩ + have hyy : y ∈ connectedComponentIn (bd S) y := mem_connectedComponentIn hy + have hne : connectedComponentIn (bd S) y ≠ C₀ := fun h => hyC (h ▸ hyy) + refine ⟨_, ⟨hC, hne⟩, ?_⟩ + exact cuffs_disjoint_eq (hd _ hC hne) hP (mem_image_of_mem _ hyy) + (mem_connectedComponentIn hx) + · rintro ⟨C, ⟨hC, hne⟩, rfl⟩ + exact hd C hC hne + have hinj : InjOn (fun C => ι '' C) (cuffs S \ {C₀}) := fun C _ C' _ h => + (image_eq_image hι.injective).mp h + have hcard : (cuffs S').ncard = n := by + rw [hcuffs, hinj.ncard_image, Set.ncard_sdiff_singleton_of_mem hC₀, hn] + rfl + obtain ⟨T, tT, j, cap, hT, hTc, hj, hcap, hcov'⟩ := ih S' hS' hcard + refine ⟨T, tT, j ∘ ι, fun C => if C = C₀ then j '' Δ else cap (ι '' C), hT, hTc, hj.comp hι, + ?_, ?_⟩ + · intro C hC + by_cases hCe : C = C₀ + · subst hCe + simp only [ite_true] + refine ⟨image_emb_disc hj.isEmbedding hΔ, ?_, ?_⟩ + · rw [discBd_image hj.isEmbedding, hΔb, image_comp] + · rw [range_comp, ← image_inter hj.injective, inter_comm (range ι) Δ, inter_comm, hmeet, + image_comp] + · change IsClosedDisc (if C = C₀ then j '' Δ else cap (ι '' C)) ∧ discBd (if C + = C₀ then j '' Δ else cap (ι '' C)) = (j ∘ ι) '' C ∧ + range (j ∘ ι) ∩ (if C = C₀ then j '' Δ else cap (ι '' C)) = (j ∘ ι) '' C + rw [ite_eq_right hCe] + obtain ⟨h1, h2, h3⟩ := hcap _ (hd C hC hCe) + refine ⟨h1, by rw [h2, image_comp], ?_⟩ + apply subset_antisymm + · rintro y ⟨⟨z, rfl⟩, hy⟩ + have h4 : (j ∘ ι) z ∈ j '' (ι '' C) := h3 ▸ ⟨⟨_, rfl⟩, hy⟩ + rw [image_comp] + exact h4 + · rw [image_comp] + rintro _ ⟨_, ⟨z, hz, rfl⟩, rfl⟩ + exact ⟨⟨z, rfl⟩, discBd_subset _ (h2 ▸ ⟨ι z, mem_image_of_mem _ hz, rfl⟩)⟩ + · rw [eq_univ_iff_forall] + intro y + rcases (hcov' ▸ mem_univ y : y ∈ range j ∪ ⋃ C ∈ cuffs S', cap C) with ⟨z, rfl⟩ | h1 + · rcases (hcov ▸ mem_univ z : z ∈ range ι ∪ Δ) with ⟨w, rfl⟩ | h1 + · exact .inl ⟨w, rfl⟩ + · refine .inr (mem_biUnion hC₀ ?_) + simp only [ite_true] + exact mem_image_of_mem _ h1 + · obtain ⟨C, hC, hy⟩ := mem_iUnion₂.mp h1 + rw [hcuffs] at hC + obtain ⟨C', ⟨hC', hne⟩, rfl⟩ := hC + refine .inr (mem_biUnion hC' ?_) + show y ∈ if C' = C₀ then j '' Δ else cap (ι '' C') + rw [ite_eq_right (show C' ≠ C₀ from hne)] + exact hy + +/-- Swapping one side of a disc in the boundary of another disc. -/ +theorem flip_disc [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) {G Δ' L₀ L₁ R : Set S} {u v : S} + (hG : IsClosedDisc G) (_hL₀ : IsLineWithEnds L₀ u v) + (hL₁ : IsLineWithEnds L₁ u v) (_hR : IsLineWithEnds R u v) (hbG : discBd G = L₀ ∪ L₁) + (h01 : L₀ ∩ L₁ = {u, v}) (h0R : L₀ ∩ R = {u, v}) (h1R : L₁ ∩ R = {u, v}) + (hGR : G ∩ R = {u, v}) (hΔ' : IsClosedDisc Δ') (hbΔ : discBd Δ' = L₁ ∪ R) : + ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = L₀ ∪ R ∧ ∀ c, Disjoint c G → (c ⊆ Δ ↔ c ⊆ Δ') := by + have hset : (discBd G ∪ discBd Δ') \ (L₁ \ {u, v}) = L₀ ∪ R := by + rw [hbG, hbΔ] + ext x + constructor + · rintro ⟨(h | h) | (h | h), hn⟩ + · exact .inl h + · have : x ∈ ({u, v} : Set S) := by + by_contra hc + exact hn ⟨h, hc⟩ + exact .inl (h01 ▸ this |>.1) + · have : x ∈ ({u, v} : Set S) := by + by_contra hc + exact hn ⟨h, hc⟩ + exact .inl (h01 ▸ this |>.1) + · exact .inr h + · rintro (h | h) + · exact ⟨.inl (.inl h), fun hn => hn.2 (h01 ▸ ⟨h, hn.1⟩)⟩ + · exact ⟨.inr (.inr h), fun hn => hn.2 (h1R ▸ ⟨hn.1, h⟩)⟩ + have hL₁G : L₁ ⊆ G := fun x hx => discBd_subset G (hbG ▸ Or.inr hx) + have hL₁Δ : L₁ ⊆ Δ' := fun x hx => discBd_subset Δ' (hbΔ ▸ Or.inl hx) + have hconn : IsPreconnected (G \ L₁) := by + refine hG.isPreconnected_discInt.subset_closure (fun x hx => ⟨hx.1, + fun h => hx.2 (hbG ▸ Or.inr h)⟩) ?_ + exact sdiff_subset.trans hG.subset_closure_discInt + have hdj : Disjoint (G \ L₁) (discBd Δ') := by + rw [hbΔ, disjoint_left] + rintro x ⟨hx, hx'⟩ (h | h) + · exact hx' h + · exact hx' (h1R.symm ▸ hGR ▸ ⟨hx, h⟩ : x ∈ L₁ ∩ R).1 + rcases hΔ'.side hman hconn hdj with h | h + · have hsub : G ⊆ Δ' := fun x hx => by + by_cases hL : x ∈ L₁ + · exact hL₁Δ hL + · exact (h ⟨hx, hL⟩).1 + have hmeet : discBd G ∩ discBd Δ' = L₁ := by + rw [hbG, hbΔ] + ext x + constructor + · rintro ⟨h1 | h1, h2 | h2⟩ + · exact h2 + · exact (h01 ▸ (h0R ▸ ⟨h1, h2⟩ : x ∈ ({u, v} : Set S)) : x ∈ L₀ ∩ L₁).2 + · exact h1 + · exact h1 + · exact fun hx => ⟨.inr hx, .inl hx⟩ + obtain ⟨h1, h2, -⟩ := disc_difference G Δ' L₁ u v hG hΔ' hsub hL₁ hmeet + refine ⟨_, h1, h2.trans hset, fun c hc => ⟨fun hs x hx => ?_, fun hs => ?_⟩⟩ + · exact closure_minimal sdiff_subset hΔ'.isClosed (hs hx) + · exact fun x hx => subset_closure ⟨hs hx, disjoint_left.mp hc hx⟩ + · have hmeet : G ∩ Δ' = L₁ := by + apply subset_antisymm + · rintro x ⟨hx, hx'⟩ + by_contra hL + exact disjoint_left.mp h ⟨hx, hL⟩ hx' + · exact subset_inter hL₁G hL₁Δ + obtain ⟨h1, h2⟩ := disc_union G Δ' L₁ u v hG hΔ' hL₁ hmeet (hbG ▸ subset_union_right) + (hbΔ ▸ subset_union_left) + refine ⟨_, h1, h2.trans hset, fun c hc => ⟨fun hs x hx => ?_, + fun hs => hs.trans subset_union_right⟩⟩ + exact (hs hx).resolve_left (disjoint_left.mp hc hx) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/BorderArc.lean b/LeanPool/GraphMinor/GM17/BorderArc.lean new file mode 100644 index 0000000000..d06081dcfb --- /dev/null +++ b/LeanPool/GraphMinor/GM17/BorderArc.lean @@ -0,0 +1,347 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.RegionCycle + +/-! +# Arcs along internal cells + +Here we prove the parts of `RegionBoundaryOArcCriterionStatement` on internal cells, which are used +in (8.6) of Graph Minors XVII (page 182). Two nodes of an internal cell on the +boundary of the surface are ends of a side, so pushing this side off the cell gives a normal `I`-arc +(`internal_arc`). If all nodes of an internal cell lie on the boundary of +the surface, one of these arcs bounds no disc with one cell (`internal_bd_arc`). Otherwise the discs +on all sides fill up the surface with few nodes. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +/-- A closed set that is a neighbourhood of its points off a finite set is everything off this set, +if it has a point off the finite set. -/ +theorem cover_off [T2Space S] [ConnectedSpace S] (hman : ∀ x : S, IsManifoldPoint x) {W A : Set S} + (hW : IsClosed W) (hA : A.Finite) (hne : (W \ A).Nonempty) + (hnb : ∀ x ∈ W, x ∉ A → W ∈ 𝓝 x) {y : S} (hy : y ∉ A) : y ∈ W := by + have hop : IsOpen (W \ A) := by + rw [isOpen_iff_mem_nhds] + exact fun x hx => Filter.inter_mem (hnb x hx.1 hx.2) (hA.isClosed.isOpen_compl.mem_nhds hx.2) + have hcl : closure (W \ A) ⊆ (W \ A) ∪ A := fun x hx => by + have h1 : x ∈ W := closure_minimal sdiff_subset hW hx + by_cases h2 : x ∈ A + · exact .inr h2 + · exact .inl ⟨h1, h2⟩ + exact (eq_compl_of_frontier_finite hman hop hne hA hcl hy).1 + +/-- Two discs that share a line of their boundaries and meet only there: their union is a +neighbourhood of the inner points of the line. -/ +theorem union_nhds [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) {D D' F : Set S} {u v x : S} + (hD : IsClosedDisc D) (hD' : IsClosedDisc D') (hF : IsLineWithEnds F u v) (hi : D ∩ D' = F) + (h1 : F ⊆ discBd D) (h2 : F ⊆ discBd D') + (hx : x ∈ F) (hu : x ≠ u) (hv : x ≠ v) : D ∪ D' ∈ 𝓝 x := by + obtain ⟨hE, hEb⟩ := disc_union _ _ _ _ _ hD hD' hF hi h1 h2 + have hxi : x ∈ discInt (D ∪ D') := by + refine ⟨.inl (discBd_subset D (h1 hx)), fun hm => ?_⟩ + rw [hEb] at hm + refine hm.2 ⟨hx, ?_⟩ + rintro (e | e) + · exact hu e + · exact hv e + exact Filter.mem_of_superset ((hE.isOpen_discInt hman).mem_nhds hxi) fun y hy => hy.1 + +/-- A disc whose boundary is a line and a part of the boundary of the surface. -/ +theorem disc_along_bd [T2Space S] (hS : IsSurface S) {Δ F : Set S} {u v : S} (hΔ : IsClosedDisc Δ) + (hF : IsLineWithEnds F u v) (hFb : F ∩ bd S = {u, v}) + (h1 : F ⊆ discBd Δ) (h2 : discBd Δ ⊆ F ∪ bd S) : + ∃ K, IsLineWithEnds K u v ∧ discBd Δ = F ∪ K ∧ F ∩ K = {u, v} ∧ K ⊆ bd S ∧ Δ ∩ bd S = K + ∧ ∀ x ∈ Δ, x ∉ F → Δ ∈ 𝓝 x := by + obtain ⟨K, hK, hun, hin⟩ := oarc_split hΔ.isOArc_discBd hF h1 + have hKb : K ⊆ bd S := fun x hx => by + by_cases hxF : x ∈ F + · have h3 : x ∈ F ∩ K := ⟨hxF, hx⟩ + rw [hin, ← hFb] at h3 + exact h3.2 + · exact (h2 (hun ▸ .inr hx)).resolve_left hxF + have hKΔ : K ⊆ discBd Δ := hun ▸ subset_union_right + have hDb : Δ ∩ bd S = K := by + apply subset_antisymm + · rintro y ⟨hy, hyb⟩ + have hyB : y ∈ discBd Δ := by + by_contra hn + exact hyb (isInteriorPoint_of_mem_discInt hS.2.2 hΔ ⟨hy, hn⟩) + rcases (hun ▸ hyB : y ∈ F ∪ K) with h3 | h3 + · have h4 : y ∈ F ∩ K := by + rw [hin, ← hFb] + exact ⟨h3, hyb⟩ + exact h4.2 + · exact h3 + · exact fun x hx => ⟨discBd_subset _ (hKΔ hx), hKb hx⟩ + refine ⟨K, hK, hun.symm, hin, hKb, hDb, fun x hx hxF => ?_⟩ + by_cases hxb : x ∈ discBd Δ + · have hxK : x ∈ K := (hun ▸ hxb : x ∈ F ∪ K).resolve_left hxF + refine disc_nhds hS hΔ hK hKΔ hDb hxK ?_ ?_ + · rintro rfl + exact hxF hF.left_mem + · rintro rfl + exact hxF hF.right_mem + · exact Filter.mem_of_superset ((hΔ.isOpen_discInt hS.2.2).mem_nhds ⟨hx, hxb⟩) fun y hy => hy.1 + +namespace Painting + +variable {Γ : Painting S} [T2Space S] + +/-- Two distinct nodes of a cell are the ends of a gap, as a cell has at most three nodes. -/ +theorem exists_gap_pair {c : Set S} {n₁ n₂ : S} (hc : c ∈ Γ.C) (h₁ : n₁ ∈ tilde c) + (h₂ : n₂ ∈ tilde c) (hne : n₁ ≠ n₂) : ∃ L, Γ.IsGap c L n₁ n₂ := by + classical + have hO := (Γ.isClosedDisc_closure_cell hc).isOArc_discBd + obtain ⟨A, B, hA, hB, hu, hi⟩ := hO.lines (Γ.tilde_subset_discBd hc h₁) + (Γ.tilde_subset_discBd hc h₂) hne + have hAs : A ⊆ discBd (closure c) := hu ▸ subset_union_left + have hBs : B ⊆ discBd (closure c) := hu ▸ subset_union_right + have hgap : ∀ {P : Set S}, IsLineWithEnds P n₁ n₂ → P ⊆ discBd (closure c) → + (∀ x ∈ P, x ∈ tilde c → x = n₁ ∨ x = n₂) → Γ.IsGap c P n₁ n₂ := fun {P} hP hs h => by + refine ⟨hc, hP, hs, ?_⟩ + apply subset_antisymm + · rintro x ⟨hx, hxN⟩ + have h3 : x ∈ tilde c := by + rw [← Γ.closure_cell_inter_N hc] + exact ⟨discBd_subset _ (hs hx), hxN⟩ + exact h x hx h3 + · rintro x (rfl | rfl) + · exact ⟨hP.left_mem, Γ.tilde_subset_N hc h₁⟩ + · exact ⟨hP.right_mem, Γ.tilde_subset_N hc h₂⟩ + by_cases hAg : ∀ x ∈ A, x ∈ tilde c → x = n₁ ∨ x = n₂ + · exact ⟨A, hgap hA hAs hAg⟩ + by_cases hBg : ∀ x ∈ B, x ∈ tilde c → x = n₁ ∨ x = n₂ + · exact ⟨B, hgap hB hBs hBg⟩ + exfalso + push Not at hAg hBg + obtain ⟨x, hx, hxt, hx1, hx2⟩ := hAg + obtain ⟨y, hy, hyt, hy1, hy2⟩ := hBg + have hxy : x ≠ y := by + rintro rfl + rcases (hi ▸ ⟨hx, hy⟩ : x ∈ ({n₁, n₂} : Set S)) with h | h + · exact hx1 h + · exact hx2 h + have hs : ({n₁, n₂, x, y} : Finset S).card = 4 := by + rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_pair hxy] + · simp only [Finset.mem_insert, Finset.mem_singleton, not_or] + exact ⟨Ne.symm hx2, Ne.symm hy2⟩ + · simp only [Finset.mem_insert, Finset.mem_singleton, not_or] + exact ⟨hne, Ne.symm hx1, Ne.symm hy1⟩ + have h4 : ((({n₁, n₂, x, y} : Finset S) : Set S)).ncard ≤ (tilde c).ncard := by + refine Set.ncard_le_ncard ?_ (Γ.finite_tilde_cell hc) + intro z hz + simp only [Finset.coe_insert, Finset.coe_singleton, mem_insert_iff, mem_singleton_iff] at hz + rcases hz with rfl | rfl | rfl | rfl <;> assumption + rw [Set.ncard_coe_finset, hs] at h4 + have := Γ.ncard_tilde_cell_le hc + omega + +omit [T2Space S] in +theorem isSide_of_internal {c L : Set S} {u v : S} (hL : Γ.IsGap c L u v) (hint : ¬ + (c ∩ bd S).Nonempty) : Γ.IsSide c L u v := + ⟨hL, disjoint_left.mpr fun x hx hxb => hint ⟨x, hL.mem_cell hx.1 (fun e => hx.2 (.inl e)) (fun e + => hx.2 (.inr e)), hxb⟩⟩ + +/-- The arc from a side with both ends on the boundary of the surface. -/ +theorem side_arc [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {c L : Set S} {u v : S} + (hL : Γ.IsSide c L u v) (hu : u ∈ bd S) (hv : v ∈ bd S) : + ∃ St F, IsClosedDisc St ∧ IsLineWithEnds F u v ∧ discBd St = L ∪ F ∧ L ∩ F = {u, v} + ∧ St ∩ Γ.U ⊆ L ∧ F ∩ bd S = {u, v} ∧ F ∩ Γ.N = {u, v} ∧ Γ.IsNormal F + ∧ (∀ x ∈ L, x ≠ u → x ≠ v → closure c ∪ St ∈ 𝓝 x) := by + have hcS : CompactSpace S := hS.1 + obtain ⟨St, F, r, hSt, hF, hb, hi, -, -, hSU, -, -, -, hnb⟩ := side_strip hS hΓ.isOpen hL + isClosed_empty (by simp) + have hFSt : F ⊆ St := (hb ▸ subset_union_right).trans (discBd_subset St) + have hUe : ∀ {x}, x ∈ F → x ∈ Γ.U → x = u ∨ x = v := fun {x} hx hxU + => hi.le ⟨hSU ⟨hFSt hx, hxU⟩, hx⟩ + refine ⟨St, F, hSt, hF, hb, hi, hSU, ?_, ?_, ?_, hnb⟩ + · apply subset_antisymm + · exact fun x hx => hUe hx.1 (Γ.bd_subset hx.2) + · rintro x (rfl | rfl) + · exact ⟨hF.left_mem, hu⟩ + · exact ⟨hF.right_mem, hv⟩ + · apply subset_antisymm + · exact fun x hx => hUe hx.1 (Γ.N_subset hx.2) + · rintro x (rfl | rfl) + · exact ⟨hF.left_mem, hL.1.left_mem_N⟩ + · exact ⟨hF.right_mem, hL.1.right_mem_N⟩ + · intro x hx + rcases hUe hx.1 hx.2 with rfl | rfl + · exact hL.1.left_mem_N + · exact hL.1.right_mem_N + +/-- Two nodes on the boundary of the surface of an internal cell are joined by a normal arc. -/ +theorem internal_arc [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {c : Set S} {n₁ n₂ : S} + (hc : c ∈ Γ.C) (hint : ¬ (c ∩ bd S).Nonempty) + (h₁ : n₁ ∈ closure c ∩ bd S) (h₂ : n₂ ∈ closure c ∩ bd S) (hne : n₁ ≠ n₂) : + ∃ F : Set S, IsLineWithEnds F n₁ n₂ ∧ Γ.IsNormal F ∧ F ∩ bd S = lineEnds F ∧ F ∩ bd S + = {n₁, n₂} ∧ F ∩ Γ.N = {n₁, n₂} ∧ + ∀ Δ : Set S, IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd S → (Δ ∩ + (bd S \ {n₁, n₂})).Nonempty ∧ ∀ c₀ ∈ Γ.C, (c₀ ∩ Δ).Nonempty → c₀ ⊆ Δ := by + have ht : ∀ {x}, x ∈ closure c ∩ bd S → x ∈ tilde c := fun {x} hx => ⟨hx.1, fun h + => hint ⟨x, h, hx.2⟩⟩ + obtain ⟨L, hL⟩ := exists_gap_pair hc (ht h₁) (ht h₂) hne + obtain ⟨St, F, -, hF, -, -, -, hFb, hFN, hnorm, -⟩ := side_arc hS hΓ + (isSide_of_internal hL hint) h₁.2 h₂.2 + refine ⟨F, hF, hnorm, by rw [lineEnds_eq hF, hFb], hFb, hFN, fun Δ hΔ h1 h2 => ?_⟩ + obtain ⟨K, hK, hun, hin, hKb, hDb, hnb⟩ := disc_along_bd hS hΔ hF hFb h1 h2 + constructor + · obtain ⟨z, hz, h3, h4, -⟩ := exists_inner hK (finite_empty (α := S)) + exact ⟨z, ⟨discBd_subset _ (hun ▸ .inr hz), hKb hz, by rintro (e | e); exacts [h3 e, h4 e]⟩⟩ + · rintro c₀ hc₀ ⟨x, hx, hxΔ⟩ + rcases cell_side hc₀ hnorm hΔ (fun y hy => hnb y hy.1 hy.2) with h | h + · exact h + · exact absurd hxΔ (h hx) + +/-- The piece of the surface on the far side of a side with ends on the boundary of the surface, if +the arc from the side bounds a disc with one cell and no other nodes. -/ +theorem side_piece [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {c L : Set S} {u v : S} + (hint : ¬ (c ∩ bd S).Nonempty) (hL : Γ.IsSide c L u v) (hu : u ∈ bd S) (hv : v ∈ bd S) + (hno : ∀ F : Set S, IsLine F → Γ.IsNormal F → F ∩ bd S = lineEnds F → (F ∩ Γ.N).ncard = 2 + → ∃ Δ : Set S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd S + ∧ Δ ∩ Γ.N ⊆ F ∧ {d ∈ Γ.C | d ⊆ Δ}.ncard = 1) : + ∃ D, IsClosed D ∧ (∀ x ∈ D, x ≠ u → x ≠ v → closure c ∪ D ∈ 𝓝 x) ∧ (∀ x ∈ L, x ≠ u → x ≠ v + → closure c ∪ D ∈ 𝓝 x) ∧ D ∩ Γ.N ⊆ {u, v} := by + have hman := hS.2.2 + have hc := hL.1.1 + obtain ⟨St, F, hSt, hF, hb, hi, hSU, hFb, hFN, hnorm, hnb⟩ := side_arc hS hΓ hL hu hv + have huv := hF.ne' + have hcard : (F ∩ Γ.N).ncard = 2 := by + rw [hFN, Set.ncard_pair huv] + obtain ⟨f, -, -⟩ := id hF + obtain ⟨Δ, hΔ, h1, h2, hN, hcount⟩ := hno F ⟨f⟩ hnorm (by rw [lineEnds_eq hF, hFb]) hcard + obtain ⟨K, hK, hun, hin, hKb, -, hnbΔ⟩ := disc_along_bd hS hΔ hF hFb h1 h2 + have hside := fun d hd => cell_side (Γ := Γ) (c := d) hd hnorm hΔ (fun y hy => hnbΔ y hy.1 hy.2) + have hKΔ : K ⊆ Δ := (hun ▸ subset_union_right : K ⊆ discBd Δ).trans (discBd_subset Δ) + obtain ⟨c', hc', hc'Δ, hc'b, -, -⟩ := exists_border_cell hK hKb hKΔ hL.1.left_mem_N hside + have hcoff : c ⊆ Δᶜ := by + rcases hside c hc with h | h + · exfalso + obtain ⟨a, ha⟩ := Set.ncard_eq_one.mp hcount + have e1 : c ∈ ({a} : Set (Set S)) := ha ▸ ⟨hc, h⟩ + have e2 : c' ∈ ({a} : Set (Set S)) := ha ▸ ⟨hc', hc'Δ⟩ + rw [mem_singleton_iff] at e1 e2 + exact hint (e1.trans e2.symm ▸ hc'b) + · exact h + have hLF : F ⊆ discBd St := hb ▸ subset_union_right + have hStΔ : St ∩ Δ = F := by + apply subset_antisymm + · have hY := isPreconnected_disc_diff hSt hLF + have hd : Disjoint (St \ F) (discBd Δ) := by + refine disjoint_left.mpr fun y hy hy' => ?_ + have hyK : y ∈ K := (hun ▸ hy' : y ∈ F ∪ K).resolve_left hy.2 + have hyL : y ∈ L := hSU ⟨hy.1, Γ.bd_subset (hKb hyK)⟩ + by_cases hu' : y = u + · exact hy.2 (hu' ▸ hF.left_mem) + · by_cases hv' : y = v + · exact hy.2 (hv' ▸ hF.right_mem) + · exact disjoint_left.mp hL.2 ⟨hyL, by rintro (e | e); exacts [hu' e, hv' e]⟩ (hKb hyK) + rcases hΔ.side hman hY hd with h | h + · exfalso + obtain ⟨z, hz, h3, h4, -⟩ := exists_inner hL.1.2.1 (finite_empty (α := S)) + have hzc := hL.1.mem_cell hz h3 h4 + have hzSt : z ∈ St := discBd_subset St (hb ▸ .inl hz) + have hzF : z ∉ F := fun h5 => by + rcases (hi ▸ ⟨hz, h5⟩ : z ∈ ({u, v} : Set S)) with e | e + · exact h3 e + · exact h4 e + exact hcoff hzc (h ⟨hzSt, hzF⟩).1 + · rintro y ⟨hy, hy'⟩ + by_contra hn + exact disjoint_left.mp h ⟨hy, hn⟩ hy' + · exact fun x hx => ⟨discBd_subset St (hLF hx), discBd_subset Δ (h1 hx)⟩ + refine ⟨St ∪ Δ, hSt.isClosed.union hΔ.isClosed, ?_, ?_, ?_⟩ + · rintro x hx hxu hxv + by_cases hxF : x ∈ F + · apply Filter.mem_of_superset (union_nhds hman hSt hΔ hF hStΔ hLF h1 hxF hxu hxv) + exact subset_union_right + · rcases hx with hx | hx + · by_cases hxL : x ∈ L + · exact Filter.mem_of_superset (hnb x hxL hxu hxv) + (union_subset_union_right _ subset_union_left) + · have hxi : x ∈ discInt St := ⟨hx, fun h => (hb ▸ h : x ∈ L ∪ F).elim hxL hxF⟩ + exact Filter.mem_of_superset ((hSt.isOpen_discInt hman).mem_nhds hxi) fun y hy => .inr + (.inl hy.1) + · exact Filter.mem_of_superset (hnbΔ x hx hxF) fun y hy => .inr (.inr hy) + · intro x hx hxu hxv + exact Filter.mem_of_superset (hnb x hx hxu hxv) (union_subset_union_right _ subset_union_left) + · rintro x ⟨hx | hx, hxN⟩ + · exact (hL.1.2.2.2 ▸ ⟨hSU ⟨hx, Γ.N_subset hxN⟩, hxN⟩ : x ∈ ({u, v} : Set S)) + · rw [← hFN] + exact ⟨hN ⟨hx, hxN⟩, hxN⟩ + +/-- If all nodes of an internal cell lie on the boundary of the surface, then the arc from one of +its sides bounds no disc with one cell and no other nodes. -/ +theorem internal_bd_arc [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {c : Set S} + (hc : c ∈ Γ.C) (hint : ¬ (c ∩ bd S).Nonempty) (ht : tilde c ⊆ bd S) : + ∃ F : Set S, IsLine F ∧ Γ.IsNormal F ∧ F ∩ bd S = lineEnds F ∧ (F ∩ Γ.N).ncard = 2 + ∧ ∀ Δ : Set S, IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd S → + ¬ (Δ ∩ Γ.N ⊆ F ∧ {d ∈ Γ.C | d ⊆ Δ}.ncard = 1) := by + classical + by_contra hcon + push Not at hcon + have hno : ∀ F : Set S, IsLine F → Γ.IsNormal F → F ∩ bd S = lineEnds F → (F ∩ Γ.N).ncard = 2 + → ∃ Δ : Set S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd S + ∧ Δ ∩ Γ.N ⊆ F ∧ {d ∈ Γ.C | d ⊆ Δ}.ncard = 1 := by + intro F h1 h2 h3 h4 + obtain ⟨Δ, h5, h6, h7, h8, h9⟩ := hcon F h1 h2 h3 h4 + exact ⟨Δ, h5, h6, h7, h8, h9⟩ + have hman := hS.2.2 + obtain ⟨x₀, hx₀, y₀, hy₀, hne⟩ := two_nodes hS hΓ hc + obtain ⟨𝓕, hf, hgap, hu⟩ := exists_gaps hc hx₀ hy₀ hne + have htN : ∀ {x}, x ∈ closure c → x ∈ Γ.N → x ∈ tilde c := fun {x} hx hn => by + rw [← Γ.closure_cell_inter_N hc] + exact ⟨hx, hn⟩ + have hkey : ∀ F ∈ 𝓕, ∃ D, IsClosed D ∧ (∀ x ∈ D, x ∉ tilde c → closure c ∪ D ∈ 𝓝 x) ∧ + (∀ x ∈ F, x ∉ tilde c → closure c ∪ D ∈ 𝓝 x) ∧ D ∩ Γ.N ⊆ tilde c := fun F hF => by + obtain ⟨u, v, hG⟩ := hgap F hF + have hut : u ∈ tilde c := htN (hG.subset_closure hG.2.1.left_mem) hG.left_mem_N + have hvt : v ∈ tilde c := htN (hG.subset_closure hG.2.1.right_mem) hG.right_mem_N + obtain ⟨D, h1, h2, h3, h4⟩ := side_piece hS hΓ hint (isSide_of_internal hG hint) (ht hut) + (ht hvt) hno + refine ⟨D, h1, fun x hx hxt => h2 x hx (fun e => hxt (e ▸ hut)) (fun e => hxt (e ▸ hvt)), + fun x hx hxt => h3 x hx (fun e => hxt (e ▸ hut)) (fun e => hxt (e ▸ hvt)), fun x hx => ?_⟩ + rcases h4 hx with rfl | rfl + · exact hut + · exact hvt + choose! D hDc hD1 hD2 hDN using hkey + let W : Set S := closure c ∪ ⋃ F ∈ 𝓕, D F + have hWc : IsClosed W := isClosed_closure.union (hf.isClosed_biUnion hDc) + have hsub : ∀ {F}, F ∈ 𝓕 → closure c ∪ D F ⊆ W := fun {F} hF x hx => hx.elim .inl (fun h => .inr + (mem_iUnion₂.mpr ⟨F, hF, h⟩)) + obtain ⟨z, hz⟩ := arcComponentsIn_nonempty hc + have hWne : (W \ tilde c).Nonempty := ⟨z, .inl (subset_closure hz), fun h => h.2 hz⟩ + have hnbW : ∀ x ∈ W, x ∉ tilde c → W ∈ 𝓝 x := by + rintro x (hx | hx) hxt + · by_cases hxb : x ∈ discBd (closure c) + · obtain ⟨F, hF, hxF⟩ := (hu ▸ hxb : x ∈ ⋃₀ 𝓕) + exact Filter.mem_of_superset (hD2 F hF x hxF hxt) (hsub hF) + · exact Filter.mem_of_superset (((Γ.isClosedDisc_closure_cell hc).isOpen_discInt + hman).mem_nhds ⟨hx, hxb⟩) fun y hy => .inl hy.1 + · obtain ⟨F, hF, hxF⟩ := mem_iUnion₂.mp hx + exact Filter.mem_of_superset (hD1 F hF x hxF hxt) (hsub hF) + refine hΓ.not_covered (Γ.finite_tilde_cell hc) ((Γ.ncard_tilde_cell_le hc).trans + (by norm_num)) fun n hn => ?_ + by_contra hnt + rcases cover_off hman hWc (Γ.finite_tilde_cell hc) hWne hnbW hnt with h | h + · exact hnt (htN h hn) + · obtain ⟨F, hF, h1⟩ := mem_iUnion₂.mp h + exact hnt (hDN F hF ⟨h1, hn⟩) + +end Painting + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/BorderCells.lean b/LeanPool/GraphMinor/GM17/BorderCells.lean new file mode 100644 index 0000000000..7e751386bd --- /dev/null +++ b/LeanPool/GraphMinor/GM17/BorderCells.lean @@ -0,0 +1,253 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.BorderArc + +/-! +# Curves around border cells + +Here we prove the parts of `RegionBoundaryOArcCriterionStatement` on border cells, which are used in +(8.4), (8.6) and (8.7) of Graph Minors XVII (pages 182 and 183). Two border +cells with the same nodes are pushed off along their outer sides to a normal `O`-arc (`two_border`). +A node with only border cells at it has exactly two cells. We paste a disc on the +cuff, add these two cells to it, and take a thin disc along the two outer sides, which gives a +normal `I`-arc past the node (`border_node`). In both cases a disc that bounds the curve +and misses the other nodes would fill up the surface, so there would be too few nodes. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +namespace Painting + +variable {Γ : Painting S} [T2Space S] + +/-- The outer side of a border cell. -/ +theorem border_side (hS : IsSurface S) {c : Set S} (hc : c ∈ Γ.C) (hbd : (c ∩ bd S).Nonempty) : + ∃ u v O, tilde c = {u, v} ∧ IsLineWithEnds (closure c ∩ bd S) u v ∧ Γ.IsSide c O u v ∧ discBd + (closure c) = (closure c ∩ bd S) ∪ O ∧ (closure c ∩ bd S) ∩ O = {u, v} ∧ u ∈ bd S ∧ v ∈ bd S + ∧ c ∩ bd S = (closure c ∩ bd S) \ {u, v} := by + obtain ⟨u, v, -, ht, hB, he, hu, hv⟩ := Γ.border_cell_exists_ends hc hbd + have hdisc := Γ.isClosedDisc_closure_cell hc + have hBs : closure c ∩ bd S ⊆ discBd (closure c) := fun x hx => by + by_contra hn + exact hx.2 (isInteriorPoint_of_mem_discInt hS.2.2 hdisc ⟨hx.1, hn⟩) + obtain ⟨B', hB', hun, hin⟩ := oarc_split hdisc.isOArc_discBd hB hBs + have hB'c : B' ⊆ closure c := (hun ▸ subset_union_right : B' ⊆ _).trans (discBd_subset _) + refine ⟨u, v, B', ht, hB, ⟨⟨hc, hB', hun ▸ subset_union_right, ?_⟩, ?_⟩, hun.symm, hin, hu.2, + hv.2, he⟩ + · rw [← ht, ← Γ.closure_cell_inter_N hc] + apply subset_antisymm + · exact fun z hz => ⟨hB'c hz.1, hz.2⟩ + · intro z hz + have h1 : z ∈ tilde c := by + rw [← Γ.closure_cell_inter_N hc] + exact hz + rw [ht] at h1 + rcases h1 with rfl | rfl + · exact ⟨hB'.left_mem, hz.2⟩ + · exact ⟨hB'.right_mem, hz.2⟩ + · refine disjoint_left.mpr fun x hx hxb => hx.2 ?_ + have h1 : x ∈ (closure c ∩ bd S) ∩ B' := ⟨⟨hB'c hx.1, hxb⟩, hx.1⟩ + rwa [hin] at h1 + +omit [T2Space S] in +/-- The closure of a border cell with a strip along its outer side is a neighbourhood of its points +off the nodes. -/ +theorem border_nhds (hS : IsSurface S) {c O St : Set S} {u v x : S} (hc : c ∈ Γ.C) (ht : tilde c + = {u, v}) (hB : IsLineWithEnds (closure c ∩ bd S) u v) + (hb : discBd (closure c) = (closure c ∩ bd S) ∪ O) + (hnb : ∀ x ∈ O, x ≠ u → x ≠ v → closure c ∪ St ∈ 𝓝 x) (hx : x ∈ closure c) + (hxt : x ∉ tilde c) : closure c ∪ St ∈ 𝓝 x := by + have hdisc := Γ.isClosedDisc_closure_cell hc + have hxu : x ≠ u := fun e => hxt (ht ▸ .inl e) + have hxv : x ≠ v := fun e => hxt (ht ▸ .inr e) + by_cases hxb : x ∈ discBd (closure c) + · rcases (hb ▸ hxb : x ∈ (closure c ∩ bd S) ∪ O) with h | h + · exact Filter.mem_of_superset (disc_nhds hS hdisc hB (hb ▸ subset_union_left) rfl h hxu hxv) + subset_union_left + · exact hnb x h hxu hxv + · exact Filter.mem_of_superset ((hdisc.isOpen_discInt hS.2.2).mem_nhds ⟨hx, + hxb⟩) fun y hy => .inl hy.1 + +/-- Two border cells with the same nodes are pushed off along their outer sides to a normal `O`-arc +that bounds no disc without other nodes. -/ +theorem two_border [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {c₁ c₂ : Set S} + (h₁ : c₁ ∈ Γ.C) (h₂ : c₂ ∈ Γ.C) (hne : c₁ ≠ c₂) (hb₁ : (c₁ ∩ bd S).Nonempty) + (hb₂ : (c₂ ∩ bd S).Nonempty) (he : tilde c₁ = tilde c₂) : + ∃ F : Set S, IsOArc F ∧ Γ.IsNormal F ∧ (F ∩ Γ.N).ncard = 2 ∧ ∀ Δ : Set S, IsClosedDisc Δ + → discBd Δ = F → ¬ (Δ ∩ Γ.N ⊆ F) := by + classical + have hcS : CompactSpace S := hS.1 + have hman := hS.2.2 + obtain ⟨u, v, O₁, ht₁, hB₁, hs₁, hd₁, hi₁, hu, hv, hc₁⟩ := border_side hS h₁ hb₁ + obtain ⟨u', v', O₂', ht₂, hB₂', hs₂', hd₂', hi₂', -, -, hc₂'⟩ := border_side hS h₂ hb₂ + have hpair : ({u', v'} : Set S) = {u, v} := by rw [← ht₂, ← he, ht₁] + obtain ⟨O₂, hs₂, hB₂, hd₂, hi₂, hc₂⟩ : ∃ O₂, Γ.IsSide c₂ O₂ u v ∧ IsLineWithEnds + (closure c₂ ∩ bd S) u v ∧ discBd (closure c₂) = (closure c₂ ∩ bd S) ∪ O₂ ∧ + (closure c₂ ∩ bd S) ∩ O₂ = {u, v} ∧ c₂ ∩ bd S = (closure c₂ ∩ bd S) \ {u, v} := by + have huv' := hB₂'.ne' + rcases (Set.ext_iff.mp hpair u').mp (.inl rfl) with rfl | rfl + · have : v' = v := by + rcases (Set.ext_iff.mp hpair v').mp (.inr rfl) with h | h + · exact absurd h.symm huv' + · exact h + subst this + exact ⟨O₂', hs₂', hB₂', hd₂', hi₂', hc₂'⟩ + · have : v' = u := by + rcases (Set.ext_iff.mp hpair v').mp (.inr rfl) with h | h + · exact h + · exact absurd h.symm huv' + subst this + refine ⟨O₂', hs₂'.symm, hB₂'.symm, hd₂', ?_, ?_⟩ + · rw [pair_comm] + exact hi₂' + · rw [pair_comm] + exact hc₂' + have huv := hB₁.ne' + obtain ⟨St₁, γ₁, r₁, hSt₁, hγ₁, hbS₁, hiS₁, -, -, hU₁, -, -, -, hnb₁⟩ + := side_strip hS hΓ.isOpen hs₁ isClosed_empty (by simp) + have hA : St₁ ∩ O₂ ⊆ {u, v} := by + rintro z ⟨hz, hz'⟩ + have hzO₁ := hU₁ ⟨hz, hs₂.1.subset_U hz'⟩ + by_cases hzN : z ∈ Γ.N + · exact hs₂.1.2.2.2.le ⟨hz', hzN⟩ + · exact absurd (hs₁.1.unique hs₂.1 hzO₁ hz' hzN).1 hne + obtain ⟨St₂, γ₂, r₂, hSt₂, hγ₂, hbS₂, hiS₂, -, hSA, hU₂, -, -, -, hnb₂⟩ + := side_strip hS hΓ.isOpen hs₂ hSt₁.isClosed hA + have hγS₁ : γ₁ ⊆ St₁ := (hbS₁ ▸ subset_union_right).trans (discBd_subset St₁) + have hγS₂ : γ₂ ⊆ St₂ := (hbS₂ ▸ subset_union_right).trans (discBd_subset St₂) + have hii : γ₁ ∩ γ₂ = {u, v} := by + apply subset_antisymm + · exact fun z hz => hSA ⟨hγS₂ hz.2, hγS₁ hz.1⟩ + · rintro z (rfl | rfl) + · exact ⟨hγ₁.left_mem, hγ₂.left_mem⟩ + · exact ⟨hγ₁.right_mem, hγ₂.right_mem⟩ + have hUF : ∀ {z}, z ∈ γ₁ ∪ γ₂ → z ∈ Γ.U → z = u ∨ z = v := by + rintro z (h | h) hzU + · exact hiS₁.le ⟨hU₁ ⟨hγS₁ h, hzU⟩, h⟩ + · exact hiS₂.le ⟨hU₂ ⟨hγS₂ h, hzU⟩, h⟩ + have huN := hs₁.1.left_mem_N + have hvN := hs₁.1.right_mem_N + have hFN : (γ₁ ∪ γ₂) ∩ Γ.N = {u, v} := by + apply subset_antisymm + · exact fun z hz => hUF hz.1 (Γ.N_subset hz.2) + · rintro z (rfl | rfl) + · exact ⟨.inl hγ₁.left_mem, huN⟩ + · exact ⟨.inl hγ₁.right_mem, hvN⟩ + have hnorm : Γ.IsNormal (γ₁ ∪ γ₂) := fun z hz => by + rcases hUF hz.1 hz.2 with rfl | rfl + · exact huN + · exact hvN + refine ⟨γ₁ ∪ γ₂, oArc_of_lines hγ₁ hγ₂ hii, hnorm, by rw [hFN, Set.ncard_pair huv], + fun Δ hΔ hbΔ hN => ?_⟩ + have hnbΔ : ∀ x ∈ Δ, x ∉ γ₁ ∪ γ₂ → Δ ∈ 𝓝 x := fun x hx hxF => + Filter.mem_of_superset ((hΔ.isOpen_discInt hman).mem_nhds ⟨hx, fun h => hxF + (hbΔ ▸ h)⟩) fun y hy => hy.1 + have hoff : ∀ {c}, c ∈ Γ.C → (c ∩ bd S).Nonempty → c ⊆ Δᶜ := fun {c} hc hb => by + rcases cell_side hc hnorm hΔ (fun y hy => hnbΔ y hy.1 hy.2) with h | h + · exfalso + obtain ⟨x, hx, hxb⟩ := hb + have hxF : x ∉ γ₁ ∪ γ₂ := fun hF => disjoint_left.mp (Γ.cell_disjoint_N hc) hx + (hnorm ⟨hF, Γ.cell_subset_U hc hx⟩) + exact hxb (isInteriorPoint_of_mem_discInt hman hΔ ⟨h hx, fun h' => hxF (hbΔ ▸ h')⟩) + · exact h + have hStΔ : ∀ {St O γ c γ' : Set S}, IsClosedDisc St → discBd St = O ∪ γ → γ' ∩ St ⊆ γ + → IsLineWithEnds O u v → O ∩ γ = {u, v} → (∀ x ∈ O, x ≠ u → x ≠ v → x ∈ c) → + c ⊆ Δᶜ → γ ∪ γ' = γ₁ ∪ γ₂ → St ∩ Δ = γ := by + intro St O γ c γ' hSt hbS hγ' hO hiO hmem hcoff hun + apply subset_antisymm + · have hY := isPreconnected_disc_diff hSt (L := γ) (hbS ▸ subset_union_right) + have hd : Disjoint (St \ γ) (discBd Δ) := by + rw [hbΔ, ← hun] + refine disjoint_left.mpr fun y hy hy' => hy'.elim hy.2 fun h => hy.2 (hγ' ⟨h, hy.1⟩) + rcases hΔ.side hman hY hd with h | h + · exfalso + obtain ⟨z, hz, h3, h4, -⟩ := exists_inner hO (finite_empty (α := S)) + have hzF : z ∉ γ := fun h5 => by + rcases (hiO ▸ ⟨hz, h5⟩ : z ∈ ({u, v} : Set S)) with e | e + · exact h3 e + · exact h4 e + exact hcoff (hmem z hz h3 h4) (h ⟨discBd_subset St (hbS ▸ .inl hz), hzF⟩).1 + · rintro y ⟨hy, hy'⟩ + by_contra hn + exact disjoint_left.mp h ⟨hy, hn⟩ hy' + · intro x hx + have hxS : x ∈ St := discBd_subset St (hbS ▸ .inr hx) + exact ⟨hxS, discBd_subset Δ (hbΔ ▸ hun ▸ .inl hx)⟩ + have hS₁Δ : St₁ ∩ Δ = γ₁ := hStΔ hSt₁ hbS₁ (γ' := γ₂) (fun z hz => by + rcases hSA ⟨hγS₂ hz.1, hz.2⟩ with rfl | rfl + · exact hγ₁.left_mem + · exact hγ₁.right_mem) hs₁.1.2.1 hiS₁ (fun x hx h3 h4 => hs₁.1.mem_cell hx h3 h4) + (hoff h₁ hb₁) rfl + have hS₂Δ : St₂ ∩ Δ = γ₂ := hStΔ hSt₂ hbS₂ (γ' := γ₁) (fun z hz => by + rcases hSA ⟨hz.2, hγS₁ hz.1⟩ with rfl | rfl + · exact hγ₂.left_mem + · exact hγ₂.right_mem) hs₂.1.2.1 hiS₂ (fun x hx h3 h4 => hs₂.1.mem_cell hx h3 h4) (hoff h₂ hb₂) + (union_comm _ _) + let W : Set S := Δ ∪ (closure c₁ ∪ St₁) ∪ (closure c₂ ∪ St₂) + have hWc : IsClosed W := (hΔ.isClosed.union (isClosed_closure.union hSt₁.isClosed)).union + (isClosed_closure.union hSt₂.isClosed) + have hA' : ({u, v} : Set S).Finite := toFinite _ + have hl₁ : closure c₁ ∪ St₁ ⊆ W := fun z hz => .inl (.inr hz) + have hl₂ : closure c₂ ∪ St₂ ⊆ W := fun z hz => .inr hz + have hlΔ : Δ ⊆ W := fun z hz => .inl (.inl hz) + have hγnb : ∀ {x}, x ∈ γ₁ ∪ γ₂ → x ∉ ({u, v} : Set S) → W ∈ 𝓝 x := by + rintro x (h | h) hxA + · have hF : γ₁ ⊆ discBd Δ := hbΔ ▸ subset_union_left + refine Filter.mem_of_superset (union_nhds hman hSt₁ hΔ hγ₁ hS₁Δ + (hbS₁ ▸ subset_union_right) hF h (fun e => hxA (.inl e)) (fun e => hxA (.inr e))) ?_ + exact union_subset (subset_union_right.trans hl₁) hlΔ + · have hF : γ₂ ⊆ discBd Δ := hbΔ ▸ subset_union_right + refine Filter.mem_of_superset (union_nhds hman hSt₂ hΔ hγ₂ hS₂Δ + (hbS₂ ▸ subset_union_right) hF h (fun e => hxA (.inl e)) (fun e => hxA (.inr e))) ?_ + exact union_subset (subset_union_right.trans hl₂) hlΔ + have hStnb : ∀ {St O γ c : Set S}, IsClosedDisc St → discBd St = O ∪ γ → γ ⊆ γ₁ ∪ γ₂ + → closure c ∪ St ⊆ W → tilde c = {u, v} → (∀ x ∈ O, x ≠ u → x ≠ v → closure c ∪ St ∈ 𝓝 x) → + ∀ x ∈ St, x ∉ ({u, v} : Set S) → W ∈ 𝓝 x := by + intro St O γ c hSt hbS hγ hsub ht hnb x hx hxA + by_cases hxO : x ∈ O + · exact Filter.mem_of_superset (hnb x hxO (fun e => hxA (.inl e)) (fun e => hxA (.inr e))) hsub + · by_cases hxγ : x ∈ γ + · exact hγnb (hγ hxγ) hxA + · refine Filter.mem_of_superset ((hSt.isOpen_discInt hman).mem_nhds ⟨hx, + fun h => (hbS ▸ h : x ∈ O ∪ γ).elim hxO hxγ⟩) fun y hy => hsub (.inr hy.1) + have hnbW : ∀ x ∈ W, x ∉ ({u, v} : Set S) → W ∈ 𝓝 x := by + rintro x ((h | (h | h)) | (h | h)) hxA + · by_cases hxF : x ∈ γ₁ ∪ γ₂ + · exact hγnb hxF hxA + · exact Filter.mem_of_superset (hnbΔ x h hxF) hlΔ + · have hx' : x ∉ tilde c₁ := ht₁.symm ▸ hxA + exact Filter.mem_of_superset (border_nhds hS h₁ ht₁ hB₁ hd₁ hnb₁ h hx') hl₁ + · exact hStnb hSt₁ hbS₁ subset_union_left hl₁ ht₁ hnb₁ x h hxA + · have ht₂ := he ▸ ht₁ + have hx' : x ∉ tilde c₂ := ht₂.symm ▸ hxA + exact Filter.mem_of_superset (border_nhds hS h₂ ht₂ hB₂ hd₂ hnb₂ h hx') hl₂ + · exact hStnb hSt₂ hbS₂ subset_union_right hl₂ (he ▸ ht₁) hnb₂ x h hxA + obtain ⟨z, hz⟩ := arcComponentsIn_nonempty h₁ + have hWne : (W \ {u, v}).Nonempty := ⟨z, hl₁ (.inl (subset_closure hz)), fun h + => disjoint_left.mp (Γ.cell_disjoint_N h₁) hz (h.elim (fun e => e ▸ huN) (fun e => e ▸ hvN))⟩ + refine hΓ.not_covered hA' ((Set.ncard_pair huv).le.trans (by norm_num)) fun n hn => ?_ + by_contra hnt + rcases cover_off hman hWc hA' hWne hnbW hnt with (h | (h | h)) | (h | h) + · exact hnt (hFN ▸ ⟨hN ⟨h, hn⟩, hn⟩) + · exact hnt (ht₁ ▸ Γ.closure_cell_inter_N h₁ ▸ ⟨h, hn⟩) + · exact hnt (hs₁.1.2.2.2 ▸ ⟨hU₁ ⟨h, Γ.N_subset hn⟩, hn⟩) + · exact hnt (ht₁ ▸ he ▸ Γ.closure_cell_inter_N h₂ ▸ ⟨h, hn⟩) + · exact hnt (hs₂.1.2.2.2 ▸ ⟨hU₂ ⟨h, Γ.N_subset hn⟩, hn⟩) + +end Painting + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/BorderNode.lean b/LeanPool/GraphMinor/GM17/BorderNode.lean new file mode 100644 index 0000000000..50e7e3b4c8 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/BorderNode.lean @@ -0,0 +1,387 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.NodeRing + +/-! +# A curve past a border node + +Here we prove the part of `RegionBoundaryOArcCriterionStatement` on a node on the boundary of the +surface with only border cells at it, which is used in (8.4) of Graph Minors XVII +(page 182). The two sides at the node of the two border cells at it lie on one region. A sector of +this region joins the two cells to a closed disc. A thin disc along the rest of its +boundary gives the normal `I`-arc past the node (`border_node`). A disc that bounds this arc and +misses the node would fill up the surface, so there would be only three nodes. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +namespace Painting + +variable {Γ : Painting S} [T2Space S] + +/-- `border_side` with a given node as first end. -/ +theorem border_side_at (hS : IsSurface S) {c : Set S} {n : S} (hc : c ∈ Γ.C) (hbd : + (c ∩ bd S).Nonempty) (hn : n ∈ tilde c) : + ∃ u O, tilde c = {n, u} ∧ IsLineWithEnds (closure c ∩ bd S) n u ∧ Γ.IsSide c O n u ∧ discBd + (closure c) = (closure c ∩ bd S) ∪ O ∧ (closure c ∩ bd S) ∩ O = {n, u} := by + obtain ⟨a, b, O, ht, hB, hs, hd, hi, -, -, -⟩ := border_side hS hc hbd + rcases (ht ▸ hn : n ∈ ({a, b} : Set S)) with rfl | rfl + · exact ⟨b, O, ht, hB, hs, hd, hi⟩ + · exact ⟨a, O, by rw [ht, pair_comm], hB.symm, hs.symm, hd, by rw [hi, pair_comm]⟩ + +private theorem normal_border_arc_cannot_bound_node_free_disc + {S : Type} + [TopologicalSpace S] + {Γ : Painting S} + [T2Space S] + [ConnectedSpace S] + (hS : IsSurface S) + (hΓ : Γ.Tame) + {n : S} + (hn : n ∈ Γ.N) + (hman : ∀ (x : S), IsManifoldPoint x) + (c₁ : Set S) + (h₁ : c₁ ∈ Γ.C) + (hnc₁ : n ∈ tilde c₁) + (u : S) + (hB₁ : IsLineWithEnds (closure c₁ ∩ bd S) n u) + (c₂ : Set S) + (h₂ : c₂ ∈ Γ.C) + (v : S) + (hB₂ : IsLineWithEnds (closure c₂ ∩ bd S) n v) + (E : Set S) + (hE : IsClosedDisc E) + (h₁E : closure c₁ ⊆ E) + (h₂E : closure c₂ ⊆ E) + (hEbd : ∀ {z : S}, z ∈ E → z ∈ bd S → z ∈ closure c₁ ∩ bd S ∨ z ∈ closure c₂ ∩ bd S) + (hEN : ∀ {z : S}, z ∈ E → z ∈ Γ.N → z = n ∨ z = u ∨ z = v) + (hBnb : ∀ {c : Set S}, c ∈ Γ.C → closure c ⊆ E → ∀ {a b x : S}, IsLineWithEnds (closure c ∩ bd + S) a b → closure c ∩ bd S ⊆ discBd (closure c) → x ∈ closure c ∩ bd S → x ≠ a → x ≠ b → E ∈ + 𝓝 x) + (hbs₁ : closure c₁ ∩ bd S ⊆ discBd (closure c₁)) + (hbs₂ : closure c₂ ∩ bd S ⊆ discBd (closure c₂)) + (hnu : n ≠ u) + (hnv : n ≠ v) + (huv : ¬u = v) + (L : Set S) + (hL : IsLineWithEnds L u v) + (hun : closure c₁ ∩ bd S ∪ closure c₂ ∩ bd S ∪ L = discBd E) + (hMsub : closure c₁ ∩ bd S ∪ closure c₂ ∩ bd S ⊆ discBd E) + (hLE : L ⊆ E) + (hLM : ∀ {z : S}, z ∈ L → z ∈ closure c₁ ∩ bd S ∪ closure c₂ ∩ bd S → z = u ∨ z = v) + (St : Set S) + (F : Set S) + (hSt : IsClosedDisc St) + (hF : IsLineWithEnds F u v) + (hbSt : discBd St = L ∪ F) + (hiF : L ∩ F = {u, v}) + (hStE : St ∩ E = L) + (hStZ : St ∩ (Γ.N ∪ ⋃ d ∈ Γ.C \ {c₁, c₂}, closure d) ⊆ {u, v}) + (hStb : St ∩ bd S ⊆ {u, v}) + (hnbS : ∀ x ∈ L, x ≠ u → x ≠ v → E ∪ St ∈ 𝓝 x) + (hFS : F ⊆ St) + (hLS : L ⊆ St) + (huL : u ∈ F) + (hvL : v ∈ F) + (huU : u ∈ Γ.N) + (hvU : v ∈ Γ.N) + (hFb : F ∩ bd S = {u, v}) + (hFN : F ∩ Γ.N = {u, v}) : + ∀ (Δ : Set S), IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd S → ¬(Δ ∩ Γ.N ⊆ F ∧ {c | c ∈ + Γ.C ∧ c ⊆ Δ}.ncard = 1) := by + let Z := Γ.N ∪ ⋃ d ∈ Γ.C \ {c₁, c₂}, closure d + rintro Δ hΔ h1 h2 ⟨hN, -⟩ + obtain ⟨K, hK, hunK, hinK, hKb, -, hnbΔ⟩ := disc_along_bd hS hΔ hF hFb h1 h2 + have hnΔ : n ∉ Δ := fun h => by + have h3 : n ∈ F ∩ Γ.N := ⟨hN ⟨h, hn⟩, hn⟩ + rw [hFN] at h3 + exact h3.elim hnu hnv + have hP := isPreconnected_disc_diff hE hMsub + have hPd : Disjoint (E \ ((closure c₁ ∩ bd S) ∪ (closure c₂ ∩ bd S))) (discBd Δ) := by + refine disjoint_left.mpr fun z hz hz' => ?_ + rcases (hunK ▸ hz' : z ∈ F ∪ K) with h | h + · have h3 : z ∈ L := hStE.le ⟨hFS h, hz.1⟩ + rcases hiF.le ⟨h3, h⟩ with rfl | rfl + · exact hz.2 (.inl hB₁.right_mem) + · exact hz.2 (.inr hB₂.right_mem) + · exact hz.2 (hEbd hz.1 (hKb h)) + have hPoff : Disjoint (E \ ((closure c₁ ∩ bd S) ∪ (closure c₂ ∩ bd S))) Δ := by + rcases hΔ.side hman hP hPd with h | h + · exfalso + have hsub : discInt E ⊆ E \ ((closure c₁ ∩ bd S) ∪ (closure c₂ ∩ bd S)) := fun z hz + => ⟨hz.1, fun h' => hz.2 (hMsub h')⟩ + have h3 : E ⊆ Δ := hE.subset_closure_discInt.trans (closure_minimal (hsub.trans + (h.trans fun _ h' => h'.1)) hΔ.isClosed) + exact hnΔ (h3 (h₁E hnc₁.1)) + · exact h + obtain ⟨w, hw, hwu, hwv, -⟩ := exists_inner hL (finite_empty (α := S)) + have hwF : w ∉ F := fun h => (hiF.le ⟨hw, h⟩).elim hwu hwv + have hwM : w ∉ (closure c₁ ∩ bd S) ∪ (closure c₂ ∩ bd S) := fun h => (hLM hw h).elim hwu hwv + have h1' : F ⊆ discBd Δ := h1 + have hStΔ : St ∩ Δ = F := by + apply subset_antisymm + · refine disc_off hman hSt (hbSt ▸ subset_union_right) hΔ (fun z hz hzF h => ?_) + (hLS hw) hwF (fun h => disjoint_left.mp hPoff ⟨hLE hw, hwM⟩ h) + rcases (hunK ▸ h : z ∈ F ∪ K) with h | h + · exact hzF h + · exact hzF ((hStb ⟨hz, hKb h⟩).elim (fun e' => e' ▸ huL) (fun e' => e' ▸ hvL)) + · exact fun z hz => ⟨hFS hz, discBd_subset Δ (h1 hz)⟩ + let W : Set S := (E ∪ St) ∪ Δ + have hWc : IsClosed W := (hE.isClosed.union hSt.isClosed).union hΔ.isClosed + have hFnb : ∀ {x}, x ∈ F → x ≠ u → x ≠ v → W ∈ 𝓝 x := fun {x} hx hxu hxv => + Filter.mem_of_superset (union_nhds hman hSt hΔ hF hStΔ (hbSt ▸ subset_union_right) h1 hx hxu + hxv) (union_subset (subset_union_right.trans subset_union_left) subset_union_right) + have hLnb : ∀ {x}, x ∈ L → x ≠ u → x ≠ v → W ∈ 𝓝 x := fun {x} hx hxu hxv => + Filter.mem_of_superset (hnbS x hx hxu hxv) subset_union_left + have hnbW : ∀ x ∈ W, x ∉ ({n, u, v} : Set S) → W ∈ 𝓝 x := by + intro x hx hxA + have hxn : x ≠ n := fun e' => hxA (.inl e') + have hxu : x ≠ u := fun e' => hxA (.inr (.inl e')) + have hxv : x ≠ v := fun e' => hxA (.inr (.inr e')) + rcases hx with (h | h) | h + · by_cases hxb : x ∈ discBd E + · rcases (hun ▸ hxb : x ∈ ((closure c₁ ∩ bd S) ∪ (closure c₂ ∩ bd S)) ∪ L) with (h3 | h3) | h3 + · exact Filter.mem_of_superset (hBnb h₁ h₁E hB₁ hbs₁ h3 hxn hxu) + (subset_union_left.trans subset_union_left) + · exact Filter.mem_of_superset (hBnb h₂ h₂E hB₂ hbs₂ h3 hxn hxv) + (subset_union_left.trans subset_union_left) + · exact hLnb h3 hxu hxv + · exact Filter.mem_of_superset ((hE.isOpen_discInt hman).mem_nhds ⟨h, + hxb⟩) fun y hy => .inl (.inl hy.1) + · by_cases hxL : x ∈ L + · exact hLnb hxL hxu hxv + · by_cases hxF : x ∈ F + · exact hFnb hxF hxu hxv + · exact Filter.mem_of_superset ((hSt.isOpen_discInt hman).mem_nhds ⟨h, + fun h3 => (hbSt ▸ h3 : x ∈ L ∪ F).elim hxL hxF⟩) fun y hy => .inl (.inr hy.1) + · by_cases hxF : x ∈ F + · exact hFnb hxF hxu hxv + · exact Filter.mem_of_superset (hnbΔ x h hxF) subset_union_right + obtain ⟨z, hz⟩ := arcComponentsIn_nonempty h₁ + have hzA : z ∉ ({n, u, v} : Set S) := fun h => by + refine disjoint_left.mp (Γ.cell_disjoint_N h₁) hz ?_ + rcases h with e' | e' | e' + · exact e' ▸ hn + · exact e' ▸ huU + · exact e' ▸ hvU + have hAc : ({n, u, v} : Set S).ncard ≤ 5 := by + have h3 := Set.ncard_insert_le n ({u, v} : Set S) + rw [Set.ncard_pair huv] at h3 + omega + refine hΓ.not_covered (A := {n, u, v}) (toFinite _) hAc fun y hy => ?_ + by_contra hyA + rcases cover_off hman hWc (toFinite _) ⟨z, .inl (.inl (h₁E (subset_closure hz))), hzA⟩ hnbW hyA + with (h | h) | h + · exact hyA (hEN h hy) + · exact hyA (.inr (hStZ ⟨h, .inl hy⟩)) + · exact hyA (.inr (hFN ▸ (⟨hN ⟨h, hy⟩, hy⟩ : y ∈ F ∩ Γ.N))) + +/-- A node on the boundary of the surface with only border cells at it is passed by a normal arc +that bounds no disc without further nodes. -/ +theorem border_node [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {n : S} (hn : n ∈ Γ.N) + (hall : ∀ c ∈ Γ.C, n ∈ tilde c → (c ∩ bd S).Nonempty) : + ∃ F : Set S, IsLine F ∧ Γ.IsNormal F ∧ F ∩ bd S = lineEnds F ∧ (F ∩ Γ.N).ncard = 2 ∧ + ∀ Δ : Set S, IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd S → ¬ (Δ ∩ Γ.N ⊆ F + ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard = 1) := by + classical + have hcS : CompactSpace S := hS.1 + have hman := hS.2.2 + obtain ⟨c₁, h₁, hnc₁⟩ := node_on_cell hS hΓ hn + obtain ⟨u, O₁, ht₁, hB₁, hs₁, hd₁, hi₁⟩ := border_side_at hS h₁ (hall c₁ h₁ hnc₁) hnc₁ + obtain ⟨St₀, γ₀, r, -, -, -, -, -, -, -, hr, -, hcl₁, -⟩ := side_strip hS hΓ.isOpen hs₁ + (isClosed_empty (X := S)) (by simp) + obtain ⟨L', hso', hnL', hL'ne⟩ := other_side hS hΓ hr ⟨c₁, n, u, hs₁, hcl₁⟩ hs₁.1.2.1.left_mem hn + obtain ⟨c₂, u', v', hs', hcl'⟩ := id hso' + obtain ⟨e, hsL⟩ := hs'.exists_end hnL' hn + have h₂ := hsL.1.1 + have hnc₂ : n ∈ tilde c₂ := Γ.closure_cell_inter_N h₂ ▸ ⟨hsL.1.subset_closure hnL', hn⟩ + have hne : c₁ ≠ c₂ := by + rintro rfl + obtain ⟨z, hz, h3, h4, -⟩ := exists_inner hsL.1.2.1 (finite_empty (α := S)) + have hzb : z ∉ bd S := fun h => disjoint_left.mp hsL.2 ⟨hz, by + rintro (e' | e') + · exact h3 e' + · exact h4 e'⟩ h + rcases (hd₁ ▸ hsL.1.2.2.1 hz : z ∈ (closure c₁ ∩ bd S) ∪ O₁) with h | h + · exact hzb h.2 + · exact hL'ne (hsL.1.unique hs₁.1 hz h (hsL.1.not_mem_N hz h3 h4)).2 + obtain ⟨v, O₂, ht₂, hB₂, hs₂, hd₂, hi₂⟩ := border_side_at hS h₂ (hall c₂ h₂ hnc₂) hnc₂ + have hL'O : L' = O₂ := by + have hev : e = v := by + have h3 : e ∈ tilde c₂ := Γ.closure_cell_inter_N h₂ ▸ ⟨hsL.1.subset_closure + hsL.1.2.1.right_mem, hsL.1.right_mem_N⟩ + rw [ht₂] at h3 + exact h3.elim (fun e' => absurd e'.symm hsL.1.2.1.ne') id + subst hev + have hsub : L' ⊆ O₂ := by + refine hsL.1.2.1.subset_closure_diff.trans (closure_minimal (fun z hz + => ?_) hs₂.1.2.1.isCompact.isClosed) + rcases (hd₂ ▸ hsL.1.2.2.1 hz.1 : z ∈ (closure c₂ ∩ bd S) ∪ O₂) with h | h + · exact absurd h.2 (disjoint_left.mp hsL.2 hz) + · exact h + exact hs₂.1.2.1.eq_of_subset (isPreconnected_line hsL.1.2.1) hsub hnL' hsL.1.2.1.right_mem + subst hL'O + have hmeet : ∀ {z}, z ∈ closure c₁ → z ∈ closure c₂ → z ∈ Γ.N ∧ (z = n ∨ z = u) ∧ (z = n ∨ z = v) + := fun {z} h h' => by + have hzN := closure_inter_closure h₁ h₂ hne ⟨h, h'⟩ + have h3 : z ∈ tilde c₁ := Γ.closure_cell_inter_N h₁ ▸ ⟨h, hzN⟩ + have h4 : z ∈ tilde c₂ := Γ.closure_cell_inter_N h₂ ▸ ⟨h', hzN⟩ + rw [ht₁] at h3 + rw [ht₂] at h4 + exact ⟨hzN, h3, h4⟩ + obtain ⟨E, hE, h₁E, h₂E, hEU, -, hbE⟩ := two_cell_disc hS hΓ hr hs₁ hs₂ hne hcl₁ hcl' ht₁ + (fun z hz => by + rw [ht₂] at hz + exact hz.2) + have hBB₁ : closure c₁ ∩ bd S ⊆ discBd E := fun z hz => hbE z (.inl (hd₁ ▸ .inl hz)) (fun h + => h.2 (hi₁.le ⟨hz, h.1⟩)) (fun h => disjoint_left.mp hs₂.2 h hz.2) + have hBB₂ : closure c₂ ∩ bd S ⊆ discBd E := fun z hz => hbE z (.inr (hd₂ ▸ .inl hz)) (fun h + => disjoint_left.mp hs₁.2 h hz.2) (fun h => h.2 (hi₂.le ⟨hz, h.1⟩)) + have hEbd : ∀ {z}, z ∈ E → z ∈ bd S → z ∈ closure c₁ ∩ bd S ∨ z ∈ closure c₂ ∩ bd S + := fun {z} hz hb => + (hEU ⟨hz, Γ.bd_subset hb⟩).elim (fun h => .inl ⟨h, hb⟩) (fun h => .inr ⟨h, hb⟩) + have hEN : ∀ {z}, z ∈ E → z ∈ Γ.N → z = n ∨ z = u ∨ z = v := fun {z} hz hzN => by + rcases hEU ⟨hz, Γ.N_subset hzN⟩ with h | h + · have h3 : z ∈ tilde c₁ := Γ.closure_cell_inter_N h₁ ▸ ⟨h, hzN⟩ + rw [ht₁] at h3 + exact h3.elim .inl (fun e' => .inr (.inl e')) + · have h3 : z ∈ tilde c₂ := Γ.closure_cell_inter_N h₂ ▸ ⟨h, hzN⟩ + rw [ht₂] at h3 + exact h3.elim .inl (fun e' => .inr (.inr e')) + have hBnb : ∀ {c}, c ∈ Γ.C → closure c ⊆ E → ∀ {a b x}, IsLineWithEnds (closure c ∩ bd S) a b + → closure c ∩ bd S ⊆ discBd (closure c) → x ∈ closure c ∩ bd S → + x ≠ a → x ≠ b → E ∈ 𝓝 x := by + intro c hc hcE a b x hl hs hx hxa hxb + exact Filter.mem_of_superset (disc_nhds hS (Γ.isClosedDisc_closure_cell hc) hl hs rfl hx hxa + hxb) hcE + have hbs₁ : closure c₁ ∩ bd S ⊆ discBd (closure c₁) := hd₁ ▸ subset_union_left + have hbs₂ : closure c₂ ∩ bd S ⊆ discBd (closure c₂) := hd₂ ▸ subset_union_left + have hnu : n ≠ u := hB₁.ne' + have hnv : n ≠ v := hB₂.ne' + by_cases huv : u = v + · exfalso + subst huv + have hi : (closure c₁ ∩ bd S) ∩ (closure c₂ ∩ bd S) = {n, u} := by + apply subset_antisymm + · exact fun z hz => (hmeet hz.1.1 hz.2.1).2.1 + · rintro z (rfl | rfl) + · exact ⟨hB₁.left_mem, hB₂.left_mem⟩ + · exact ⟨hB₁.right_mem, hB₂.right_mem⟩ + obtain ⟨ψ⟩ := id hE.isOArc_discBd + have hbc := oarc_eq ψ (oArc_of_lines hB₁ hB₂ hi) (union_subset hBB₁ hBB₂) + have hnbW : ∀ x ∈ E, x ∉ ({n, u} : Set S) → E ∈ 𝓝 x := fun x hx hxA => by + have hxn : x ≠ n := fun e' => hxA (.inl e') + have hxu : x ≠ u := fun e' => hxA (.inr e') + by_cases hxb : x ∈ discBd E + · rcases (hbc ▸ hxb : x ∈ (closure c₁ ∩ bd S) ∪ (closure c₂ ∩ bd S)) with h | h + · exact hBnb h₁ h₁E hB₁ hbs₁ h hxn hxu + · exact hBnb h₂ h₂E hB₂ hbs₂ h hxn hxu + · exact Filter.mem_of_superset ((hE.isOpen_discInt hman).mem_nhds ⟨hx, hxb⟩) fun y hy => hy.1 + obtain ⟨z, hz⟩ := arcComponentsIn_nonempty h₁ + have hzA : z ∉ ({n, u} : Set S) := fun h => disjoint_left.mp (Γ.cell_disjoint_N h₁) hz (h.elim + (fun e' => e' ▸ hn) (fun e' => e' ▸ hs₁.1.right_mem_N)) + refine hΓ.not_covered (A := {n, u}) (toFinite _) ((Set.ncard_pair hnu).le.trans + (by norm_num)) fun y hy => ?_ + by_contra hyA + rcases hEN (cover_off hman hE.isClosed (toFinite _) ⟨z, h₁E (subset_closure hz), hzA⟩ hnbW hyA) + hy with e' | e' | e' + · exact hyA (.inl e') + · exact hyA (.inr e') + · exact hyA (.inr e') + have hiM : (closure c₁ ∩ bd S) ∩ (closure c₂ ∩ bd S) = {n} := by + apply subset_antisymm + · rintro z ⟨hz, hz'⟩ + obtain ⟨-, h3, h4⟩ := hmeet hz.1 hz'.1 + rcases h3 with h3 | h3 + · exact h3 + · rcases h4 with h4 | h4 + · exact h4 + · exact absurd (h3.symm.trans h4) huv + · rintro _ rfl + exact ⟨hB₁.left_mem, hB₂.left_mem⟩ + have hM := hB₁.symm.union hB₂ hiM + obtain ⟨L, hL, hun, hin⟩ := oarc_split hE.isOArc_discBd hM (union_subset hBB₁ hBB₂) + have hMsub : (closure c₁ ∩ bd S) ∪ (closure c₂ ∩ bd S) ⊆ discBd E := union_subset hBB₁ hBB₂ + have hLb : L ⊆ discBd E := hun ▸ subset_union_right + have hLE : L ⊆ E := hLb.trans (discBd_subset E) + have hLM : ∀ {z}, z ∈ L → z ∈ (closure c₁ ∩ bd S) ∪ (closure c₂ ∩ bd S) → z = u ∨ z = v + := fun {z} h h' => hin.le ⟨h', h⟩ + have hLbd : ∀ x ∈ L, x ≠ u → x ≠ v → x ∉ bd S := fun x hx hxu hxv hb => + (hLM hx (hEbd (hLE hx) hb)).elim hxu hxv + have hLN : ∀ {z}, z ∈ L → z ∈ Γ.N → z = u ∨ z = v := fun {z} hz hzN => by + rcases hEN (hLE hz) hzN with rfl | e' | e' + · exact hLM hz (.inl hB₁.left_mem) + · exact .inl e' + · exact .inr e' + let Z : Set S := Γ.N ∪ ⋃ d ∈ Γ.C \ {c₁, c₂}, closure d + have hZ : IsClosed Z := others_closed Γ _ + have hZL : Z ∩ L ⊆ {u, v} := by + rintro z ⟨h | h, hz⟩ + · exact hLN hz h + · obtain ⟨d, hd, hzd⟩ := mem_iUnion₂.mp h + have hzN : z ∈ Γ.N := by + rcases hEU ⟨hLE hz, Γ.closure_cell_subset_U hd.1 hzd⟩ with h3 | h3 + · exact closure_inter_closure hd.1 h₁ (fun e' => hd.2 (.inl e')) ⟨hzd, h3⟩ + · exact closure_inter_closure hd.1 h₂ (fun e' => hd.2 (.inr e')) ⟨hzd, h3⟩ + exact hLN hz hzN + obtain ⟨St, F, hSt, hF, hbSt, hiF, hStE, hStZ, hStb, hnbS⟩ := strip_along hS hE hL hLb hLbd hZ hZL + have hFS : F ⊆ St := (hbSt ▸ subset_union_right).trans (discBd_subset St) + have hLS : L ⊆ St := (hbSt ▸ subset_union_left).trans (discBd_subset St) + have huL : u ∈ F := hF.left_mem + have hvL : v ∈ F := hF.right_mem + have hSU : ∀ {z}, z ∈ St → z ∈ Γ.U → z ∈ L := fun {z} hz hzU => by + have hend : z ∈ Z → z ∈ L := fun h => (hStZ ⟨hz, h⟩).elim (fun e' => e' ▸ hL.left_mem) (fun e' + => e' ▸ hL.right_mem) + by_cases hzN : z ∈ Γ.N + · exact hend (.inl hzN) + obtain ⟨d, hd, hzd⟩ := exists_mem_arcComponentsIn (F := Γ.U \ Γ.N) (x := z) ⟨hzU, hzN⟩ + by_cases hdc : d ∈ ({c₁, c₂} : Set (Set S)) + · have hzE : z ∈ E := hdc.elim (fun e' => h₁E (e' ▸ subset_closure hzd)) (fun e' => h₂E + (e' ▸ subset_closure hzd)) + exact hStE.le ⟨hz, hzE⟩ + · exact hend (.inr (mem_iUnion₂.mpr ⟨d, ⟨hd, hdc⟩, subset_closure hzd⟩)) + have hFU : ∀ {z}, z ∈ F → z ∈ Γ.U → z = u ∨ z = v := fun {z} hz hzU => hiF.le ⟨hSU + (hFS hz) hzU, hz⟩ + have huU : u ∈ Γ.N := hs₁.1.right_mem_N + have hvU : v ∈ Γ.N := hs₂.1.right_mem_N + have huB : u ∈ bd S := hB₁.right_mem.2 + have hvB : v ∈ bd S := hB₂.right_mem.2 + have hFb : F ∩ bd S = {u, v} := by + apply subset_antisymm + · exact fun z hz => hFU hz.1 (Γ.bd_subset hz.2) + · rintro z (rfl | rfl) + · exact ⟨huL, huB⟩ + · exact ⟨hvL, hvB⟩ + have hFN : F ∩ Γ.N = {u, v} := by + apply subset_antisymm + · exact fun z hz => hFU hz.1 (Γ.N_subset hz.2) + · rintro z (rfl | rfl) + · exact ⟨huL, huU⟩ + · exact ⟨hvL, hvU⟩ + have hnorm : Γ.IsNormal F := fun z hz => (hFU hz.1 hz.2).elim (fun e' => e' ▸ huU) (fun e' + => e' ▸ hvU) + obtain ⟨f, -, -⟩ := id hF + have hnoCap : ∀ Δ : Set S, IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd S → + ¬ (Δ ∩ Γ.N ⊆ F ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard = 1) := by + exact normal_border_arc_cannot_bound_node_free_disc (S := S) (Γ := Γ) hS hΓ (n := n) hn hman + c₁ h₁ hnc₁ u hB₁ c₂ h₂ v hB₂ E hE h₁E h₂E hEbd hEN hBnb hbs₁ hbs₂ hnu hnv huv L hL hun hMsub + hLE hLM St F hSt hF hbSt hiF hStE hStZ hStb hnbS hFS hLS huL hvL huU hvU hFb hFN + exact ⟨F, ⟨f⟩, hnorm, by rw [lineEnds_eq hF, hFb], by rw [hFN, Set.ncard_pair huv], hnoCap⟩ + +end Painting + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Bridge.lean b/LeanPool/GraphMinor/GM17/Bridge.lean new file mode 100644 index 0000000000..ad2c8ee74f --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Bridge.lean @@ -0,0 +1,148 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section9 +public import LeanPool.GraphMinor.GM17.Section9b +public import LeanPool.GraphMinor.GM17.Section11 +public import LeanPool.GraphMinor.GM17.Section14 +public import LeanPool.GraphMinor.GM17.Section14b +public import LeanPool.GraphMinor.GM17.Section13d +public import LeanPool.GraphMinor.GM19.Cited +import LeanPool.GraphMinor.GM17.PasteCuff +import LeanPool.GraphMinor.GM17.ArcDisc +import LeanPool.GraphMinor.GM17.MarkCross +import LeanPool.GraphMinor.GM17.ReplaceDisc +import LeanPool.GraphMinor.GM17.RegionDisc +import LeanPool.GraphMinor.GM17.CutArcPaint +import LeanPool.GraphMinor.GM17.PushNode +import LeanPool.GraphMinor.GM17.RegionBoundary +import LeanPool.GraphMinor.GM17.IndentMain +import LeanPool.GraphMinor.GM17.CellPartitionMain + +import LeanPool.GraphMinor.GM16.MainProof + +import LeanPool.GraphMinor.GM17.Section11Proved + +import LeanPool.GraphMinor.GM17.Section8Proved + +import LeanPool.GraphMinor.GM17.Section9Proved + +import LeanPool.GraphMinor.GM17.Section9bProved + +/-! +# Graph Minors XVII: Bridge Theorems for Cited Statements in XX + +This file proves the Graph Minors XVII statements cited in `GraphMinor/GM20/Cited.lean`: +- `gm17Theorem82` (`GM20.GM17Theorem82Statement`, (8.2), page 181); +- `gm17Theorem83` (`GM20.GM17Theorem83Statement`, (8.3), page 182); +- `gm17Theorem84` (`GM20.GM17Theorem84Statement`, (8.4), page 182); +- `gm17Theorem85` (`GM20.GM17Theorem85Statement`, (8.5), page 182); +- `gm17Theorem87` (`GM20.GM17Theorem87Statement`, (8.7), page 182); +- `gm17Theorem88` (`GM20.GM17Theorem88Statement`, (8.8), page 183); +- `gm17Theorem91` (`GM20.GM17Theorem91Statement`, (9.1), page 183); +- `gm17Theorem98` (`GM20.GM17Theorem98Statement`, (9.8), page 187); +- `gm17Theorem142` (`GM20.GM17Theorem142Statement`, (14.2), page 209), from (13.1); +- `gm17Theorem117` (`GM20.GM17Theorem117Statement`, (11.7), page 195). +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +/-- Proof of `GM20.GM17Theorem82Statement` in `GraphMinor/GM20/Cited.lean` +(Graph Minors XVII, (8.2), page 181). -/ +theorem gm17Theorem82 : + GM20.GM17Theorem82Statement.{u, v} := by + intro α β G 𝒯 θ p π hstand + obtain ⟨h1, h2, _⟩ := + theorem_8_2_proof + hstand.isTangle π hstand.isTrue hstand.isRedundant hstand.warp_le hstand.lt + exact ⟨by simpa [Painting.regions, Set.compl_eq_univ_sdiff] using h1, h2⟩ + +/-- Proof of `GM20.GM17Theorem83Statement` in `GraphMinor/GM20/Cited.lean` +(Graph Minors XVII, (8.3), page 182). -/ +theorem gm17Theorem83 : + GM20.GM17Theorem83Statement.{u, v} := + gm17_theorem_8_3 + +/-- Proof of `GM20.GM17Theorem84Statement` in `GraphMinor/GM20/Cited.lean` +(Graph Minors XVII, (8.4), page 182). -/ +theorem gm17Theorem84 : + GM20.GM17Theorem84Statement.{u, v} := by + intro α β G 𝒯 θ p π hstand + exact theorem_8_4_proof + hstand.isTangle π hstand.isTrue hstand.isRedundant hstand.warp_le hstand.lt + +/-- Proof of `GM20.GM17Theorem85Statement` in `GraphMinor/GM20/Cited.lean` +(Graph Minors XVII, (8.5), page 182). -/ +theorem gm17Theorem85 : + GM20.GM17Theorem85Statement.{u, v} := + gm17_theorem_8_5 + +/-- Proof of `GM20.GM17Theorem87Statement` in `GraphMinor/GM20/Cited.lean` +(Graph Minors XVII, (8.7), page 182). -/ +theorem gm17Theorem87 : + GM20.GM17Theorem87Statement.{u, v} := by + intro α β G 𝒯 θ p π hstand n hn + exact theorem_8_7_proof + hstand.isTangle π hstand.isTrue hstand.isRedundant hstand.warp_le hstand.lt hn + +/-- Proof of `GM20.GM17Theorem88Statement` in `GraphMinor/GM20/Cited.lean` +(Graph Minors XVII, (8.8), page 183). -/ +theorem gm17Theorem88 : + GM20.GM17Theorem88Statement.{u, v} := by + intro α β G 𝒯 θ p π hstand c₁ hc₁ c₂ hc₂ hne hsub + exact theorem_8_8_proof + hstand.isTangle π hstand.isTrue hstand.isRedundant hstand.warp_le hstand.lt hc₁ hc₂ hne hsub + +/-- Proof of `GM20.GM17Theorem91Statement` in `GraphMinor/GM20/Cited.lean` +(Graph Minors XVII, (9.1), page 183). -/ +theorem gm17Theorem91 : + GM20.GM17Theorem91Statement.{u, v} := by + intro α β G 𝒯 θ p π hstand c₀ hc₀ hint₀ n₁ hn₁ n₂ hn₂ hne + exact theorem_9_1_proof + hstand.isTangle π hstand.isTrue hstand.isRedundant hstand.warp_le hstand.lt + hc₀ hint₀ hn₁ hn₂ hne + +/-- Proof of `GM20.GM17Theorem98Statement` in `GraphMinor/GM20/Cited.lean` +(Graph Minors XVII, (9.8), page 187). -/ +theorem gm17Theorem98 : + GM20.GM17Theorem98Statement.{u, v} := by + intro α β G 𝒯 θ p π hstand Θ hΘ c₀ hc₀ hc₀_Θ n₁ hn₁ n₂ hn₂ hne + exact theorem_9_8_proof + hstand.isTangle π hstand.isTrue hstand.isRedundant hstand.warp_le hstand.lt + hΘ hc₀ hc₀_Θ hn₁ hn₂ hne + +/-- Proof of `GM20.GM17Theorem117Statement` in `GraphMinor/GM20/Cited.lean` +(Graph Minors XVII, (11.7), page 195). -/ +theorem gm17Theorem117 : GM20.GM17Theorem117Statement.{u, v} := by + intro α β G 𝒯 θ p π hstand c₀ hc₀ A B hAB hc₀A hle + exact theorem_11_7_proof + hstand.isTangle π hstand.isTrue hstand.isRedundant hstand.warp_le hstand.lt + hc₀ hAB hc₀A hle + +/-- Proof of `GM19.GM17Theorem141Statement` in `GraphMinor/GM19/Cited.lean` +(Graph Minors XVII, (14.1), page 207). -/ +theorem gm17Theorem141 : GM19.GM17Theorem141Statement.{u} := by + intro V E G θ θstar T h1 hlt hT + exact theorem_14_1_proof h1 hlt hT + +/-- `GM20.GM17Theorem142Statement`: Graph Minors XVII, (14.2) (page 209), from XVI (3.1). -/ +theorem gm17Theorem142 : GM20.GM17Theorem142Statement.{u, v} := + fun H hH => theorem_14_2_proof H hH + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CapSide.lean b/LeanPool/GraphMinor/GM17/CapSide.lean new file mode 100644 index 0000000000..d5f96bd750 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CapSide.lean @@ -0,0 +1,589 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.PaintTransfer +public import LeanPool.GraphMinor.GM17.CutArcPaint +public import LeanPool.GraphMinor.Surface.CutOArc + +/-! +# Cutting a painted surface along a curve off the paint + +Let `F` be an `O`-arc off `U(Γ)`. We cut along `F` with `cutOArc` and paste discs on the new cuffs +(`cap_lifts`). Each part then carries the cells on +its side (`side_cut`). This is the case of `CutNormalOArcPaintingStatement` where `F` meets no node +(`cut_off_paint`). The count of the surfaces is +in `side_tri`: a part after capping is simpler than the surface, unless the other part is a closed +disc. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {Y S : Type} [TopologicalSpace Y] [TopologicalSpace S] + +/-- The number of cuffs falls and the rest of the model stays. -/ +def CapDrops (W W' : Type) [TopologicalSpace W] [TopologicalSpace W'] : Prop := + ∀ a b c : ℕ, Nonempty (W ≃ₜ SurfaceModel a b c) → ∃ c' < c, Nonempty (W' ≃ₜ SurfaceModel a b c') + +theorem isOArc_preimage {W : Set Y} {X : Set Y} (hO : IsOArc X) (hs : X ⊆ W) : IsOArc + (Subtype.val ⁻¹' X : Set W) := by + obtain ⟨φ⟩ := hO + have he : Subtype.val '' (Subtype.val ⁻¹' X : Set W) = X := by + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hs] + exact ⟨(φ.trans (Homeomorph.setCongr he.symm)).trans (IsEmbedding.subtypeVal.homeomorphImage + _).symm⟩ + +theorem oarc_cuff (hY : IsSurface Y) {X : Set Y} (hO : IsOArc X) (hb : X ⊆ bd Y) : X ∈ cuffs Y := by + have ht2 : T2Space Y := hY.2.1 + obtain ⟨φ⟩ := id hO + have hx : (φ 1).1 ∈ X := (φ 1).2 + have hc : connectedComponentIn (bd Y) (φ 1).1 ∈ cuffs Y := ⟨_, hb hx, rfl⟩ + obtain ⟨φ'⟩ := (cuff_statement.{0} Y hY).2.2 _ hc + have h1 := oarc_eq φ' hO (hO.isPreconnected.subset_connectedComponentIn hx hb) + exact h1 ▸ hc + +/-- Capping one cuff. -/ +theorem cap_one [ConnectedSpace Y] (hY : IsSurface Y) {C : Set Y} (hC : C ∈ cuffs Y) : + ∃ (W : Type) (_ : TopologicalSpace W) (j : Y → W), IsSurface W ∧ ConnectedSpace W + ∧ IsClosedEmbedding j ∧ bd W = j '' (bd Y \ C) ∧ CapDrops Y W := by + obtain ⟨W, tW, j, Δ, hW, hj, hΔ, hcov, hmeet, hΔb, hbd⟩ := paste_disc.{0} Y C hY hC + obtain ⟨a, b, c, ⟨e⟩⟩ := classification.{0} Y hY ‹_› + obtain ⟨-, ⟨e'⟩⟩ := paste_model hY hC hW hj hΔ hcov hmeet hΔb e + have hconn : ConnectedSpace W := by + have := (isSurface_model a b (c - 1)).2 + exact e'.symm.surjective.connectedSpace e'.symm.continuous + refine ⟨W, tW, j, hW, hconn, hj, hbd, fun a' b' c' he => ?_⟩ + obtain ⟨e2⟩ := he + obtain ⟨h0, ⟨e3⟩⟩ := paste_model hY hC hW hj hΔ hcov hmeet hΔb e2 + exact ⟨c' - 1, by omega, ⟨e3⟩⟩ + +theorem image_cuff (_hY : IsSurface Y) {C : Set Y} (_hC : C ∈ cuffs Y) {W : Type} [TopologicalSpace + W] {j : Y → W} (hj : IsClosedEmbedding j) (hbd : bd W = j '' (bd Y \ C)) + {C' : Set Y} (hC' : C' ∈ cuffs Y) (hd : Disjoint C C') (hO : IsOArc C') + (hW : IsSurface W) : j '' C' ∈ cuffs W := by + have hO' : IsOArc (j '' C') := by + obtain ⟨φ⟩ := hO + exact ⟨φ.trans (hj.isEmbedding.homeomorphImage _)⟩ + refine oarc_cuff hW hO' ?_ + rw [hbd] + refine image_mono fun x hx => ⟨?_, fun h => disjoint_left.mp hd h hx⟩ + obtain ⟨y, -, rfl⟩ := hC' + exact connectedComponentIn_subset _ _ hx + +/-- Capping the cuffs in `B`, which are one `O`-arc or two disjoint ones. -/ +theorem cap_lifts [ConnectedSpace Y] (hY : IsSurface Y) {B : Set Y} (hb : B ⊆ bd Y) (hB : IsOArc B + ∨ ∃ P P', Disjoint P P' ∧ P ∪ P' = B ∧ IsOArc P ∧ IsOArc P') : + ∃ (W : Type) (_ : TopologicalSpace W) (j : Y → W), IsSurface W ∧ ConnectedSpace W + ∧ IsClosedEmbedding j ∧ bd W = j '' (bd Y \ B) ∧ CapDrops Y W := by + rcases hB with hB | ⟨P, P', hd, rfl, hP, hP'⟩ + · exact cap_one hY (oarc_cuff hY hB hb) + · have hC := oarc_cuff hY hP fun x hx => hb (.inl hx) + have hC' := oarc_cuff hY hP' fun x hx => hb (.inr hx) + obtain ⟨W, tW, j, hW, hc, hj, hbd, hdrop⟩ := cap_one hY hC + obtain ⟨W', tW', j', hW', hc', hj', hbd', hdrop'⟩ := cap_one hW (image_cuff hY hC hj hbd hC' hd + hP' hW) + refine ⟨W', tW', j' ∘ j, hW', hc', hj'.comp hj, ?_, fun a b c he => ?_⟩ + · rw [hbd', hbd, image_comp, ← image_sdiff hj.injective, sdiff_sdiff] + · obtain ⟨c₁, h1, he1⟩ := hdrop a b c he + obtain ⟨c₂, h2, he2⟩ := hdrop' a b c₁ he1 + exact ⟨c₂, h2.trans h1, he2⟩ + +variable [CompactSpace S] [T2Space S] + +/-- One side of the cut, after capping, carries the cells on that side. -/ +theorem side_cut [CompactSpace Y] (hS : IsSurface S) {Γ : Painting S} {ψ : Y + → S} {F : Set S} (hd : Disjoint F Γ.U) (hmap : CutMap ψ F) {W : Type} + [TopologicalSpace W] [T2Space W] {j : Y → W} (hj : IsClosedEmbedding j) + (hbd : bd W = j '' (bd Y \ ψ ⁻¹' F)) {L : Set Y} {u v : Y} + (hL : IsLineWithEnds L u v) (hLF : L ⊆ ψ ⁻¹' F) (hne : (keepCells Γ ψ F).Nonempty) : ∃ (ι : S + → W) (Γ' : Painting W), IsCutSidePainting S Γ ∅ (keepCells Γ ψ F) W ι Γ' := by + classical + have hneY : Nonempty Y := ⟨u⟩ + obtain ⟨σ, hσc, hσ₁, hσ₂⟩ := hmap.exists_sec + let R : Set S := range ψ \ F + obtain ⟨a, ha, hr, rfl, rfl⟩ := hL.exists_arc + have harc : IsArcMap (j ∘ a) := ⟨hj.continuous.comp ha.1, hj.injective.comp ha.2⟩ + obtain ⟨g, hg, hgm⟩ := exists_inj_line hS harc.isLineWithEnds + let ι : S → W := fun x => if x ∈ R then j (σ x) else g x + have hιR : ∀ x ∈ R, ι x = j (σ x) := fun x hx => ite_eq_left hx + have hιn : ∀ x, x ∉ R → ι x = g x := fun x hx => ite_eq_right hx + have hgB : ∀ x, ∃ y, g x = j y ∧ ψ y ∈ F := fun x => by + obtain ⟨t, ht⟩ := (hgm x).1 + exact ⟨a t, ht.symm, hLF (hr ▸ mem_range_self t)⟩ + have hσF : ∀ x ∈ R, ψ (σ x) ∉ F := fun x hx => by + rw [hσ₁ x hx] + exact hx.2 + have hcross : ∀ x x', x ∈ R → ι x ≠ g x' := fun x x' hx he => by + obtain ⟨y, hy, hyF⟩ := hgB x' + rw [hιR x hx, hy] at he + exact hσF x hx (hj.injective he ▸ hyF) + have hinj : Function.Injective ι := by + intro x x' he + by_cases hx : x ∈ R <;> by_cases hx' : x' ∈ R + · rw [hιR x hx, hιR x' hx'] at he + rw [← hσ₁ x hx, hj.injective he, hσ₁ x' hx'] + · exact absurd (he.trans (hιn x' hx')) (hcross x x' hx) + · exact absurd (he.symm.trans (hιn x hx)) (hcross x' x hx') + · rw [hιn x hx, hιn x' hx'] at he + exact hg he + have hrc : IsClosed (range ψ) := (isCompact_range hmap.cont).isClosed + let A : Set S := Γ.U ∩ range ψ + have hAR : A ⊆ R := fun x hx => ⟨hx.2, fun h => disjoint_left.mp hd h hx.1⟩ + have hconn : ∀ D : Set S, IsPreconnected D → D ⊆ Γ.U → (D ∩ A).Nonempty → D ⊆ A := by + intro D hD hDU ⟨x, hxD, hxA⟩ + have hsub : D ⊆ R ∪ (range ψ)ᶜ := fun y hy => by + by_cases hr : y ∈ range ψ + · exact .inl (hAR ⟨hDU hy, hr⟩) + · exact .inr hr + have h1 := hD.subset_left_of_subset_union hmap.isOpen hrc.isOpen_compl + (disjoint_left.mpr fun x hx hx' => hx' hx.1) hsub ⟨x, hxD, hAR hxA⟩ + exact fun y hy => ⟨hDU hy, (h1 hy).1⟩ + have hcont : ContinuousOn ι A := by + refine ContinuousOn.congr (f := j ∘ σ) (hj.continuous.comp_continuousOn + (hσc.mono hAR)) fun x hx => hιR x (hAR hx) + have hbdR : ∀ x ∈ R, σ x ∈ bd Y ↔ x ∈ bd S := fun x hx => by + rw [hmap.mem_bd_iff (hσF x hx), hσ₁ x hx] + have hb : bd W ⊆ ι '' A := by + rw [hbd] + rintro _ ⟨w, ⟨hw, hwF⟩, rfl⟩ + have hR : ψ w ∈ R := ⟨⟨w, rfl⟩, hwF⟩ + refine ⟨ψ w, ⟨Γ.bd_subset ((hmap.mem_bd_iff hwF).mp hw), w, rfl⟩, ?_⟩ + rw [hιR _ hR, hσ₂ w hwF] + have hbd' : ∀ x ∈ A, ι x ∈ bd W ↔ x ∈ bd S := fun x hx => by + have hR := hAR hx + rw [hιR x hR, hbd, hj.injective.mem_set_image] + constructor + · exact fun h => (hbdR x hR).mp h.1 + · exact fun h => ⟨(hbdR x hR).mpr h, hσF x hR⟩ + have hset : {c ∈ Γ.C | c ⊆ A} = keepCells Γ ψ F := by + ext c + constructor + · rintro ⟨hc, hs⟩ + exact ⟨hc, hs.trans hAR⟩ + · rintro ⟨hc, hs⟩ + exact ⟨hc, fun x hx => ⟨(arcComponentsIn_subset hc hx).1, (hs hx).1⟩⟩ + have hneA : ∃ c ∈ Γ.C, c ⊆ A := by + obtain ⟨c, hc⟩ := hset.symm ▸ hne + exact ⟨c, hc.1, hc.2⟩ + obtain ⟨Γ', hp⟩ := cutSide_of_part hS (Γ.isClosed_U.inter hrc) inter_subset_left hconn hinj hcont + hb hbd' hneA + exact ⟨ι, Γ', hset ▸ hp⟩ + +omit [CompactSpace S] in +/-- A side of a cut that is a closed disc gives a disc in the surface, with boundary the curve. -/ +theorem side_disc_image {ψ : Y → S} {F : Set S} {W : Set Y} {Γ : Painting S} [CompactSpace Y] + (_hS : IsSurface S) (hmap : CutMap (ψ ∘ (Subtype.val : W → Y)) F) + (hO : IsOArc F) (hnorm : Γ.IsNormal F) (hW : IsClosed W) (hinj : InjOn ψ W) + (hsurj : F ⊆ ψ '' W) (e : W ≃ₜ ClosedUnitDisc) : + IsClosedDisc (range (ψ ∘ (Subtype.val : W → Y))) ∧ discBd (range (ψ ∘ (Subtype.val : W → Y))) + = F ∧ + {c ∈ Γ.C | c ⊆ range (ψ ∘ (Subtype.val : W → Y))} = keepCells Γ (ψ ∘ (Subtype.val : W → Y)) F + := by + have hcomp : CompactSpace W := isCompact_iff_compactSpace.mp hW.isCompact + have hi : Function.Injective (ψ ∘ (Subtype.val : W → Y)) := fun y y' he => Subtype.ext + (hinj y.2 y'.2 he) + have hE : IsEmbedding (ψ ∘ (Subtype.val : W → Y)) := (hmap.cont.isClosedEmbedding hi).isEmbedding + let E : W ≃ₜ range (ψ ∘ (Subtype.val : W → Y)) := hE.toHomeomorph + have hD : IsClosedDisc (range (ψ ∘ (Subtype.val : W → Y))) := ⟨e.symm.trans E⟩ + have hbd : discBd (range (ψ ∘ (Subtype.val : W → Y))) = (ψ ∘ Subtype.val) '' bd W := by + rw [discBd, ← image_bd_homeomorph E, image_image] + rfl + refine ⟨hD, ?_, ?_⟩ + · have hs : F ⊆ discBd (range (ψ ∘ (Subtype.val : W → Y))) := by + rw [hbd] + intro x hx + obtain ⟨y, hy, rfl⟩ := hsurj hx + exact ⟨⟨y, hy⟩, hmap.bdF hx, rfl⟩ + obtain ⟨φ⟩ := hD.isOArc_discBd + exact (oarc_eq φ hO hs).symm + · ext c + constructor + · rintro ⟨hc, hs⟩ + exact ⟨hc, fun x hx => ⟨hs hx, fun hxF => (arcComponentsIn_subset hc hx).2 (hnorm ⟨hxF, + (arcComponentsIn_subset hc hx).1⟩)⟩⟩ + · rintro ⟨hc, hs⟩ + exact ⟨hc, fun x hx => (hs hx).1⟩ + +theorem cuffs_model {X : Type} [TopologicalSpace X] {a b c : ℕ} (e : X ≃ₜ SurfaceModel a b c) : + (cuffs X).ncard = c := by + obtain ⟨ht, f, hf⟩ := presents_ew a b c + have := ht + rw [ncard_cuffs_congr e] + exact ncard_cuffs hf + +omit [CompactSpace S] [T2Space S] in +/-- After capping, a part of the surface cut along an `O`-arc is simpler than the surface, unless +the other part is a closed disc. -/ +theorem side_tri [ConnectedSpace S] (hS : IsSurface S) {W W' : Set Y} {X : Set Y} (hhne : W ≠ W') + (hsc : spaceComponents Y = {W, W'}) (hX : (X ∩ W).Nonempty) (_hXb : IsOArc X) (hXbd : X ⊆ bd Y) + (hYs : IsSurface Y) (hW : IsClopen W) (hWc : ConnectedSpace W) + (hcase : CutIsSimpler Y S ∨ CutHasCopy Y S ClosedCylinder ∨ CutHasDisc Y) + (hpaste : Nonempty (W' ≃ₜ ClosedUnitDisc) → ∀ a b c, Nonempty (W ≃ₜ SurfaceModel a b c) → 0 < c + ∧ Nonempty (S ≃ₜ SurfaceModel a b (c - 1))) : + Nonempty (W ≃ₜ ClosedUnitDisc) ∨ ∀ (V : Type) [TopologicalSpace V], CapDrops W' V + → IsSimplerThan V S := by + obtain ⟨ds⟩ := nonempty_disc_homeo + obtain ⟨a', b', c', ⟨eS⟩⟩ := classification.{0} S hS ‹_› + have hdrop_simple : ∀ (V : Type) [TopologicalSpace V], CapDrops W' V → IsSimplerThan W' S + → IsSimplerThan V S := by + rintro V _ hV ⟨a, b, c, a₁, b₁, c₁, h1, h2, h3, h4, h5⟩ + obtain ⟨c₂, h6, h7⟩ := hV a b c h1 + exact ⟨a, b, c₂, a₁, b₁, c₁, h7, h2, h3, h4, by omega⟩ + rcases hcase with ⟨-, h⟩ | ⟨C₁, C₂, hne, he, ⟨e₁⟩, ⟨e₂⟩⟩ | ⟨C₁, C₂, hne, he, hdisc⟩ + · exact .inr fun V _ hV => hdrop_simple V hV (h W' (hsc ▸ mem_insert_of_mem _ rfl)) + · rcases Set.pair_eq_pair_iff.mp (he.symm.trans hsc) with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · refine .inr fun V _ hV => ?_ + obtain ⟨c₂, h6, h7⟩ := hV a' b' c' ⟨e₂.trans eS⟩ + exact ⟨a', b', c₂, a', b', c', h7, ⟨eS⟩, le_rfl, le_rfl, by omega⟩ + · by_cases hd : Nonempty (S ≃ₜ ClosedUnitDisc) + · obtain ⟨d⟩ := hd + exact .inl ⟨e₂.trans d⟩ + · refine .inr fun V _ hV => ?_ + obtain ⟨cy⟩ := nonempty_cyl_homeo + obtain ⟨c₂, h6, h7⟩ := hV 0 0 2 ⟨e₁.trans cy.symm⟩ + have hc0 : c' ≠ 0 := by + rintro rfl + obtain ⟨y, hy, hyW⟩ := hX + have hyb : (⟨y, hyW⟩ : C₂) ∈ bd C₂ := (mem_bd_sub hW.2).mpr (hXbd hy) + have h2 := cuffs_model (e₂.trans eS) + have h3 := (Set.ncard_pos (cuff_statement.{0} C₂ (isSurface_sub hYs hW)).2.1).mpr ⟨_, ⟨y, + hyW⟩, hyb, rfl⟩ + omega + have h1 : ¬ (a' = 0 ∧ b' = 0 ∧ c' = 1) := by + rintro ⟨rfl, rfl, rfl⟩ + exact hd ⟨eS.trans ds⟩ + exact ⟨0, 0, c₂, a', b', c', h7, ⟨eS⟩, by omega, by omega, by omega⟩ + · rcases Set.pair_eq_pair_iff.mp (he.symm.trans hsc) with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · obtain ⟨d⟩ := hdisc + exact .inl ⟨d.symm⟩ + · obtain ⟨d⟩ := hdisc + by_cases h0 : a' = 0 ∧ b' = 0 ∧ c' = 0 + · obtain ⟨rfl, rfl, rfl⟩ := h0 + obtain ⟨a, b, c, ⟨e⟩⟩ := classification.{0} C₂ (isSurface_sub hYs hW) hWc + obtain ⟨h1, ⟨e3⟩⟩ := hpaste ⟨d.symm⟩ a b c ⟨e⟩ + obtain ⟨h4, h5, -⟩ := modelCriterion.2 a b (c - 1) 0 0 0 |>.mp ⟨e3.symm.trans eS⟩ + have ha : a = 0 := by omega + have hb : b = 0 := by omega + have hc : c = 1 := by omega + subst ha hb hc + exact .inl ⟨e.trans ds⟩ + · refine .inr fun V _ hV => ?_ + obtain ⟨c₂, h6, h7⟩ := hV 0 0 1 ⟨d.symm.trans ds.symm⟩ + have h8 : c₂ = 0 := by omega + subst h8 + exact ⟨0, 0, 0, a', b', c', h7, ⟨eS⟩, by omega, by omega, by omega⟩ + +/-- The conclusion of `CutNormalOArcPaintingStatement`. -/ +def OArcConclusion (S : Type) [TopologicalSpace S] (Γ : Painting S) (F : Set S) : Prop := + (Γ.C.Nonempty ∧ + ∃ (S₀ : Type) (_ : TopologicalSpace S₀) (_ : CompactSpace S₀) (_ : T2Space S₀) + (_ : ConnectedSpace S₀) (ι₀ : S → S₀) (Γ₀ : Painting S₀), + IsSurface S₀ ∧ IsSimplerThan S₀ S ∧ + IsCutSidePainting S Γ ∅ Γ.C S₀ ι₀ Γ₀) ∨ + (∃ I₁ I₂ : Set (Set S), + I₁ ⊆ Γ.C ∧ I₂ = Γ.C \ I₁ ∧ + (∀ c₁ ∈ I₁, ∀ c₂ ∈ I₂, tilde c₁ ∩ tilde c₂ = ∅) ∧ + ((∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F ∧ {c ∈ Γ.C | c ⊆ Δ} = I₁) ∨ + (I₂.Nonempty → + ∃ (S' : Type) (_ : TopologicalSpace S') (_ : CompactSpace S') (_ : T2Space S') + (_ : ConnectedSpace S') (ι : S → S') (Γ' : Painting S'), + IsSurface S' ∧ IsSimplerThan S' S ∧ + IsCutSidePainting S Γ ∅ I₂ S' ι Γ')) ∧ + ((∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F ∧ {c ∈ Γ.C | c ⊆ Δ} = I₂) ∨ + (I₁.Nonempty → + ∃ (S' : Type) (_ : TopologicalSpace S') (_ : CompactSpace S') (_ : T2Space S') + (_ : ConnectedSpace S') (ι : S → S') (Γ' : Painting S'), + IsSurface S' ∧ IsSimplerThan S' S ∧ + IsCutSidePainting S Γ ∅ I₁ S' ι Γ'))) + +/-- A side of the cut, capped, with its painting. -/ +theorem side_package [CompactSpace Y] (hS : IsSurface S) {Γ : Painting S} {ψ : Y + → S} {F : Set S} (hd : Disjoint F Γ.U) (hψ : IsCutting ψ F) (hY : IsSurface Y) + (hFc : IsClosed F) {W : Set Y} (hW : IsClopen W) (hc : ConnectedSpace W) + (hB : IsOArc ((ψ ∘ (Subtype.val : W → Y)) ⁻¹' F) ∨ ∃ P P', Disjoint P P' ∧ P ∪ P' = (ψ ∘ + (Subtype.val : W → Y)) ⁻¹' F ∧ IsOArc P ∧ IsOArc P') : + ∃ (V : Type) (_ : TopologicalSpace V) (_ : CompactSpace V) (_ : T2Space V) + (_ : ConnectedSpace V), IsSurface V ∧ CapDrops W V ∧ + ((keepCells Γ (ψ ∘ (Subtype.val : W → Y)) F).Nonempty → ∃ (ι : S → V) + (Γ' : Painting V), + IsCutSidePainting S Γ ∅ (keepCells Γ (ψ ∘ (Subtype.val : W → Y)) F) V ι Γ') := by + have hmap := cutMap_sub hψ hFc hW + have hsurf := isSurface_sub hY hW + have hcW : CompactSpace W := hsurf.1 + have ht2W : T2Space W := hsurf.2.1 + obtain ⟨V, tV, j, hV, hcV, hj, hbd, hdrop⟩ := cap_lifts hsurf hmap.bdF hB + have hP : ∃ P, IsOArc P ∧ P ⊆ (ψ ∘ (Subtype.val : W → Y)) ⁻¹' F := by + rcases hB with h | ⟨P, P', -, hu, h, -⟩ + · exact ⟨_, h, subset_rfl⟩ + · exact ⟨P, h, hu ▸ subset_union_left⟩ + obtain ⟨P, hO, hs⟩ := hP + obtain ⟨φ⟩ := id hO + have hne : (φ 1).1 ≠ (φ (Circle.exp Real.pi)).1 := fun h => by + have h5 := congrArg (fun z : Circle => (z : ℂ)) (φ.injective (Subtype.ext h)) + norm_num at h5 + obtain ⟨A, B, hA, -, hu, -⟩ := hO.lines (φ 1).2 (φ (Circle.exp Real.pi)).2 hne + have hcV' : CompactSpace V := hV.1 + have ht2V : T2Space V := hV.2.1 + exact ⟨V, tV, hcV', ht2V, hcV, hV, hdrop, fun hne => side_cut hS hd hmap hj hbd hA (fun z hz + => hs (hu.subset (.inl hz))) hne⟩ + +omit [CompactSpace S] in +/-- Pasting back a side that is a closed disc gives the surface. -/ +theorem paste_side (hS : IsSurface S) {ψ : Y + → S} {F : Set S} (hψ : IsCutting ψ F) (hY : IsSurface Y) {W W' X : Set Y} (hW : IsClopen W) + (hu : W ∪ W' = univ) (hdW : Disjoint W W') (hXW : X ⊆ W) (hXb : IsOArc X) (hXe : BijOn ψ X F) + (hbX : X ⊆ bd Y) (hinj : InjOn ψ W) {Δ : Set S} (hΔ : IsClosedDisc Δ) + (hrΔ : Δ = ψ '' W') (hdΔ : discBd Δ = F) {a b c : ℕ} (e : W ≃ₜ SurfaceModel a b c) : 0 < c + ∧ Nonempty (S ≃ₜ SurfaceModel a b (c - 1)) := by + have hsurf := isSurface_sub hY hW + have hcW : CompactSpace W := hsurf.1 + have hι : IsClosedEmbedding (ψ ∘ (Subtype.val : W → Y)) := + (hψ.1.comp continuous_subtype_val).isClosedEmbedding fun y y' he => Subtype.ext + (hinj y.2 y'.2 he) + have hC : IsCuff (Subtype.val ⁻¹' X : Set W) := oarc_cuff hsurf (isOArc_preimage hXb hXW) fun y + hy => (mem_bd_sub hW.2).mpr (hbX hy) + have him : (ψ ∘ (Subtype.val : W → Y)) '' (Subtype.val ⁻¹' X : Set W) = F := by + rw [image_comp, Subtype.image_preimage_coe, inter_eq_right.mpr hXW, hXe.image_eq] + have hFΔ : F ⊆ Δ := hdΔ ▸ discBd_subset Δ + refine paste_model hsurf hC hS hι hΔ ?_ ?_ (by rw [him, hdΔ]) e + · rw [eq_univ_iff_forall] + intro x + obtain ⟨y, rfl⟩ := hψ.2.1 x + rcases (hu ▸ mem_univ y : y ∈ W ∪ W') with h | h + · exact .inl ⟨⟨y, h⟩, rfl⟩ + · exact .inr (hrΔ ▸ mem_image_of_mem _ h) + · rw [him] + apply subset_antisymm + · rintro _ ⟨⟨y, rfl⟩, h⟩ + rw [hrΔ] at h + obtain ⟨y', hy', he⟩ := h + by_contra hn + have hyF : y' ∈ ψ ⁻¹' Fᶜ := by rwa [mem_preimage, he] + have h1 : y' = y.1 := hψ.2.2.1 hyF hn he + exact disjoint_left.mp hdW y.2 (h1 ▸ hy') + · intro x hx + obtain ⟨y, hy, rfl⟩ := hXe.surjOn hx + exact ⟨⟨⟨y, hXW hy⟩, rfl⟩, hFΔ hx⟩ + +/-- The case where the cut surface is connected. -/ +theorem connected_case [CompactSpace Y] + (hS : IsSurface S) {Γ : Painting S} {ψ : Y → S} {F : Set S} + (hd : Disjoint F Γ.U) (hψ : IsCutting ψ F) (hY : IsSurface Y) + (hFc : IsClosed F) (hYc : ConnectedSpace Y) (hcase : CutIsSimpler Y S + ∨ CutHasCopy Y S ClosedCylinder ∨ CutHasDisc Y) + (hB : IsOArc (ψ ⁻¹' F) ∨ ∃ P P', Disjoint P P' ∧ P ∪ P' = ψ ⁻¹' F ∧ IsOArc P ∧ IsOArc P') + (hne : Γ.C.Nonempty) : OArcConclusion S Γ F := by + have hone : ∀ C ∈ spaceComponents Y, C = univ := fun C hC => by + rw [spaceComponents_eq] at hC + obtain ⟨y, rfl⟩ := hC + exact PreconnectedSpace.connectedComponent_eq_univ y + obtain ⟨y₀⟩ : Nonempty Y := inferInstance + have hunivc : univ ∈ spaceComponents Y := by + rw [spaceComponents_eq] + exact ⟨y₀, PreconnectedSpace.connectedComponent_eq_univ y₀⟩ + have hsimp : IsSimplerThan (univ : Set Y) S := by + rcases hcase with h | ⟨C₁, C₂, hneC, heq, -, -⟩ | ⟨C₁, C₂, hneC, heq, -⟩ + · exact h.2 univ hunivc + · exact absurd ((hone C₁ (heq ▸ mem_insert _ _)).trans (hone C₂ (heq ▸ mem_insert_of_mem _ + rfl)).symm) hneC + · exact absurd ((hone C₁ (heq ▸ mem_insert _ _)).trans (hone C₂ (heq ▸ mem_insert_of_mem _ + rfl)).symm) hneC + have hcu : ConnectedSpace ↥(univ : Set Y) := (Homeomorph.Set.univ + Y).symm.surjective.connectedSpace (Homeomorph.Set.univ Y).symm.continuous + have hB' : IsOArc ((ψ ∘ (Subtype.val : ↥(univ : Set Y) → Y)) ⁻¹' F) ∨ ∃ P P', Disjoint P P' + ∧ P ∪ P' = (ψ ∘ (Subtype.val : ↥(univ : Set Y) → Y)) ⁻¹' F ∧ IsOArc P ∧ IsOArc P' := by + rcases hB with h | ⟨P, P', hdj, hu, h1, h2⟩ + · exact .inl (isOArc_preimage h (subset_univ _)) + · refine .inr ⟨_, _, hdj.preimage Subtype.val, ?_, isOArc_preimage h1 (subset_univ _), + isOArc_preimage h2 (subset_univ _)⟩ + rw [← preimage_union, hu, preimage_comp] + obtain ⟨V, tV, hcV, ht2V, hconnV, hV, hdrop, hp⟩ := side_package hS hd hψ hY hFc isClopen_univ + hcu hB' + have hkeep : keepCells Γ (ψ ∘ (Subtype.val : ↥(univ : Set Y) → Y)) F = Γ.C := by + ext c + constructor + · exact fun h => h.1 + · refine fun hc => ⟨hc, fun x hx => ⟨?_, fun hxF => disjoint_left.mp hd hxF + (arcComponentsIn_subset hc hx).1⟩⟩ + obtain ⟨y, rfl⟩ := hψ.2.1 x + exact ⟨⟨y, mem_univ _⟩, rfl⟩ + obtain ⟨ι, Γ', hpp⟩ := hp (hkeep ▸ hne) + rw [hkeep] at hpp + obtain ⟨a, b, c, a₁, b₁, c₁, h1, h2, h3, h4, h5⟩ := hsimp + obtain ⟨c₂, h6, h7⟩ := hdrop a b c h1 + exact .inl ⟨hne, V, tV, hcV, ht2V, hconnV, ι, Γ', hV, ⟨a, b, c₂, a₁, b₁, c₁, h7, h2, h3, h4, + by omega⟩, hpp⟩ + +/-- The case of `CutNormalOArcPaintingStatement` of a curve off the paint. -/ +theorem cut_off_paint [ConnectedSpace S] (hS : IsSurface S) {Γ : Painting S} {F : Set S} + (hO : IsOArc F) (hd : Disjoint F Γ.U) : OArcConclusion S Γ F := by + have hdb : Disjoint F (bd S) := hd.mono_right Γ.bd_subset + have hFc : IsClosed F := by + obtain ⟨φ⟩ := id hO + have hc : IsCompact F := by + rw [isCompact_iff_compactSpace] + exact φ.compactSpace + exact hc.isClosed + by_cases hne : Γ.C.Nonempty + swap + · have hC : Γ.C = ∅ := not_nonempty_iff_eq_empty.mp hne + refine .inr ⟨∅, ∅, empty_subset _, by rw [hC, empty_sdiff], by simp, + .inr fun h => absurd h (by simp), .inr fun h => absurd h (by simp)⟩ + obtain ⟨Y, tY, ψ, hY, hψ, hcase, hlift⟩ := cutOArc.{0} S F hS ‹_› hO hdb + have ht2Y : T2Space Y := hY.2.1 + have hcY : CompactSpace Y := hY.1 + rcases hlift with ⟨X, X', hdX, hun, hOX, hOX', bX, bX'⟩ | hQ + swap + · obtain ⟨φ⟩ := id hQ + have hp := hQ.isPreconnected + rcases cut_comps hψ hY hp hp (union_self _) (φ 1).2 (φ 1).2 with hYc | ⟨W₁, W₂, -, -, h1, h2, + -, -, -, hdW, -, -⟩ + · exact connected_case hS hd hψ hY hFc hYc hcase (.inl hQ) hne + · exact absurd (h2 (φ 1).2) (disjoint_left.mp hdW (h1 (φ 1).2)) + obtain ⟨φ⟩ := id hOX + obtain ⟨φ'⟩ := id hOX' + rcases cut_comps hψ hY hOX.isPreconnected hOX'.isPreconnected hun (φ 1).2 + (φ' 1).2 with hYc | ⟨W₁, W₂, hne', hsc, hX₁, hX₂, hW₁, hW₂, hU, hdW, hc₁, hc₂⟩ + · exact connected_case hS hd hψ hY hFc hYc hcase (.inr ⟨X, X', hdX, hun, hOX, hOX'⟩) hne + have hfib : ∀ {W₀ X₀ X₁ : Set Y}, Disjoint W₀ X₁ → X₀ ∪ X₁ = ψ ⁻¹' F → X₀ ⊆ W₀ → (ψ ∘ + (Subtype.val : W₀ → Y)) ⁻¹' F = Subtype.val ⁻¹' X₀ := by + intro W₀ X₀ X₁ hd1 hu hs + ext y + change ψ y.1 ∈ F ↔ y.1 ∈ X₀ + constructor + · intro h + rcases (hu.symm.subset h : y.1 ∈ X₀ ∪ X₁) with h1 | h1 + · exact h1 + · exact absurd h1 (disjoint_left.mp hd1 y.2) + · intro h + exact hu.subset (Or.inl h) + have hd₁ : Disjoint W₁ X' := hdW.mono_right hX₂ + have hd₂ : Disjoint W₂ X := hdW.symm.mono_right hX₁ + have hun' : X' ∪ X = ψ ⁻¹' F := by rw [union_comm]; exact hun + have hB₁ := hfib hd₁ hun hX₁ + have hB₂ := hfib hd₂ hun' hX₂ + obtain ⟨V₁, tV₁, cV₁, tV₁', hV₁c, hV₁, hdrop₁, hp₁⟩ := side_package hS hd hψ hY hFc hW₁ hc₁ (.inl + (hB₁ ▸ isOArc_preimage hOX hX₁)) + obtain ⟨V₂, tV₂, cV₂, tV₂', hV₂c, hV₂, hdrop₂, hp₂⟩ := side_package hS hd hψ hY hFc hW₂ hc₂ (.inl + (hB₂ ▸ isOArc_preimage hOX' hX₂)) + have hm₁ := cutMap_sub hψ hFc hW₁ + have hm₂ := cutMap_sub hψ hFc hW₂ + let I₁ := keepCells Γ (ψ ∘ (Subtype.val : W₁ → Y)) F + let I₂ := keepCells Γ (ψ ∘ (Subtype.val : W₂ → Y)) F + let P₁ := range (ψ ∘ (Subtype.val : W₁ → Y)) \ F + let P₂ := range (ψ ∘ (Subtype.val : W₂ → Y)) \ F + have hPd : Disjoint P₁ P₂ := by + rw [disjoint_left] + rintro _ ⟨⟨y, rfl⟩, h1⟩ ⟨⟨y', he⟩, -⟩ + have he' : ψ y'.1 = ψ y.1 := he + have hy'F : y'.1 ∈ ψ ⁻¹' Fᶜ := by rwa [mem_preimage, he'] + have h2 : y'.1 = y.1 := hψ.2.2.1 hy'F h1 he' + exact disjoint_left.mp hdW y.2 (h2 ▸ y'.2) + have hPc : Fᶜ ⊆ P₁ ∪ P₂ := fun x hx => by + obtain ⟨y, rfl⟩ := hψ.2.1 x + rcases (hU ▸ mem_univ y : y ∈ W₁ ∪ W₂) with h | h + · exact .inl ⟨⟨⟨y, h⟩, rfl⟩, hx⟩ + · exact .inr ⟨⟨⟨y, h⟩, rfl⟩, hx⟩ + have hside : ∀ c ∈ Γ.C, c ⊆ P₁ ∨ c ⊆ P₂ := fun c hc => by + have hs : c ⊆ Fᶜ := fun x hx hxF => disjoint_left.mp hd hxF (arcComponentsIn_subset hc hx).1 + exact (arcComponentsIn_isPathConnected hc).isConnected.isPreconnected.subset_or_subset + hm₁.isOpen hm₂.isOpen hPd (hs.trans hPc) + have hI₂ : I₂ = Γ.C \ I₁ := by + ext c + constructor + · rintro ⟨hc, hs⟩ + refine ⟨hc, fun h => ?_⟩ + obtain ⟨x, hx⟩ := arcComponentsIn_nonempty hc + exact disjoint_left.mp hPd (h.2 hx) (hs hx) + · rintro ⟨hc, hn⟩ + exact ⟨hc, (hside c hc).resolve_left fun h => hn ⟨hc, h⟩⟩ + have hcl : ∀ {W₀ : Set Y}, IsClopen W₀ → ∀ c ∈ keepCells Γ (ψ ∘ (Subtype.val : W₀ + → Y)) F, closure c ⊆ range (ψ ∘ (Subtype.val : W₀ → Y)) \ F := by + intro W₀ hW₀ c hc + have hcW : CompactSpace W₀ := (isSurface_sub hY hW₀).1 + have hrc : IsClosed (range (ψ ∘ (Subtype.val : W₀ → Y))) := (isCompact_range + (hψ.1.comp continuous_subtype_val)).isClosed + refine fun x hx => ⟨closure_minimal (fun z hz => (hc.2 hz).1) hrc hx, + fun hxF => disjoint_left.mp hd hxF ?_⟩ + exact closure_minimal (fun z hz => (arcComponentsIn_subset hc.1 hz).1) Γ.isClosed_U hx + have hinj₁ : InjOn ψ W₁ := by + intro y hy y' hy' he + by_cases hF : ψ y ∈ F + · have h1 : y ∈ X := by + have := (hfib hd₁ hun hX₁).subset (show (⟨y, hy⟩ : W₁) ∈ _ from hF) + exact this + have h2 : y' ∈ X := by + have hy'F : ψ y' ∈ F := he ▸ hF + exact (hfib hd₁ hun hX₁).subset + (show (⟨y', hy'⟩ : W₁) ∈ _ from hy'F) + exact bX.injOn h1 h2 he + · have hy'F : y' ∈ ψ ⁻¹' Fᶜ := by rwa [mem_preimage, ← he] + exact hψ.2.2.1 hF hy'F he + have hinj₂ : InjOn ψ W₂ := by + intro y hy y' hy' he + by_cases hF : ψ y ∈ F + · have h1 : y ∈ X' := by + have := (hfib hd₂ hun' hX₂).subset (show (⟨y, hy⟩ : W₂) ∈ _ from hF) + exact this + have h2 : y' ∈ X' := by + have hy'F : ψ y' ∈ F := he ▸ hF + exact (hfib hd₂ hun' hX₂).subset + (show (⟨y', hy'⟩ : W₂) ∈ _ from hy'F) + exact bX'.injOn h1 h2 he + · have hy'F : y' ∈ ψ ⁻¹' Fᶜ := by rwa [mem_preimage, ← he] + exact hψ.2.2.1 hF hy'F he + have hbX : X ⊆ bd Y := fun y hy => hψ.2.2.2.2 (hun.subset (.inl hy)) + have hbX' : X' ⊆ bd Y := fun y hy => hψ.2.2.2.2 (hun.subset (.inr hy)) + have hnor : Γ.IsNormal F := fun x hx => absurd hx.2 (disjoint_left.mp hd hx.1) + have hdisc₁ : Nonempty (W₁ ≃ₜ ClosedUnitDisc) → ∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F + ∧ {c ∈ Γ.C | c ⊆ Δ} = I₁ ∧ Δ = ψ '' W₁ := by + rintro ⟨e⟩ + have : Nonempty W₁ := ⟨⟨_, hX₁ (φ 1).2⟩⟩ + obtain ⟨h1, h2, h3⟩ := side_disc_image hS hm₁ hO hnor hW₁.1 hinj₁ (fun x hx => + (bX.image_eq ▸ image_mono hX₁ : F ⊆ _) hx) e + exact ⟨_, h1, h2, h3, by rw [range_comp, Subtype.range_val]⟩ + have hdisc₂ : Nonempty (W₂ ≃ₜ ClosedUnitDisc) → ∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F + ∧ {c ∈ Γ.C | c ⊆ Δ} = I₂ ∧ Δ = ψ '' W₂ := by + rintro ⟨e⟩ + have : Nonempty W₂ := ⟨⟨_, hX₂ (φ' 1).2⟩⟩ + obtain ⟨h1, h2, h3⟩ := side_disc_image hS hm₂ hO hnor hW₂.1 hinj₂ (fun x hx => + (bX'.image_eq ▸ image_mono hX₂ : F ⊆ _) hx) e + exact ⟨_, h1, h2, h3, by rw [range_comp, Subtype.range_val]⟩ + have hU' : W₂ ∪ W₁ = univ := by rw [union_comm]; exact hU + have ht₁ := side_tri hS (W := W₁) (W' := W₂) (X := X) hne' hsc ⟨_, (φ 1).2, hX₁ + (φ 1).2⟩ hOX hbX hY hW₁ hc₁ hcase (fun hdd a b c ⟨e⟩ => by + obtain ⟨Δ, h1, h2, -, h4⟩ := hdisc₂ hdd + exact paste_side hS hψ hY hW₁ hU hdW hX₁ hOX bX hbX hinj₁ h1 h4 h2 e) + have ht₂ := side_tri hS (W := W₂) (W' := W₁) (X := X') hne'.symm (by rw [hsc, pair_comm]) ⟨_, + (φ' 1).2, hX₂ (φ' 1).2⟩ hOX' hbX' hY hW₂ hc₂ hcase (fun hdd a b c ⟨e⟩ => by + obtain ⟨Δ, h1, h2, -, h4⟩ := hdisc₁ hdd + exact paste_side hS hψ hY hW₂ hU' hdW.symm hX₂ hOX' bX' hbX' hinj₂ h1 h4 h2 e) + refine .inr ⟨I₁, I₂, fun c hc => hc.1, hI₂, ?_, ?_, ?_⟩ + · intro c₁ hc₁' c₂ hc₂' + rw [eq_empty_iff_forall_notMem] + rintro x ⟨hx, hx'⟩ + exact disjoint_left.mp hPd (hcl hW₁ c₁ hc₁' hx.1) (hcl hW₂ c₂ hc₂' hx'.1) + · rcases ht₁ with h | h + · obtain ⟨Δ, h1, h2, h3, -⟩ := hdisc₁ h + exact .inl ⟨Δ, h1, h2, h3⟩ + · refine .inr fun hne2 => ?_ + obtain ⟨ι, Γ', hpp⟩ := hp₂ hne2 + exact ⟨V₂, tV₂, cV₂, tV₂', hV₂c, ι, Γ', hV₂, h V₂ hdrop₂, hpp⟩ + · rcases ht₂ with h | h + · obtain ⟨Δ, h1, h2, h3, -⟩ := hdisc₂ h + exact .inl ⟨Δ, h1, h2, h3⟩ + · refine .inr fun hne2 => ?_ + obtain ⟨ι, Γ', hpp⟩ := hp₁ hne2 + exact ⟨V₁, tV₁, cV₁, tV₁', hV₁c, ι, Γ', hV₁, h V₁ hdrop₁, hpp⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CellLinkage.lean b/LeanPool/GraphMinor/GM17/CellLinkage.lean new file mode 100644 index 0000000000..d8000b1727 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CellLinkage.lean @@ -0,0 +1,402 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section2 +import LeanPool.GraphMinor.GM17.Section7 +import LeanPool.GraphMinor.GM17.CuffOrder + +/-! +# Walk transfer and linkages through a middle cell + +The proofs of Graph Minors XVII (7.3) and (11.3) use the same passage through the two side areas +and the same pairing of the two ends in the middle cell. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Surface Hypergraph GM10 + +universe u v + +/-- Lift a walk to the two side areas and the middle cell, preserving its vertex sequence. -/ +theorem walk_lifts_to_three_areas + {α β : Type*} {G : Hypergraph α β} (π : Portrayal G) + {Δ c I₁ I₂ N₁ N₂ : Set π.S} (active : Set π.S → Prop) (nodes : Set π.S → Set π.S) + (hborder_split : ∀ d ∈ π.Γ.C, d ⊆ Δ → (d ∩ bd π.S).Nonempty → d ≠ c → + tilde d ⊆ I₁ ∨ tilde d ⊆ I₂) + (hint_split : ∀ d ∈ π.Γ.C, d ⊆ Δ → ¬ (d ∩ bd π.S).Nonempty → + nodes d ⊆ N₁ ∪ I₁ ∨ nodes d ⊆ N₂ ∪ I₂) + {a b : α} (walk : (π.areaGraph Δ).skeleton.Walk a b) {supportVertices : Set α} + (hQ_sub : {z | z ∈ walk.support} ⊆ supportVertices) + (hcell_active : ∀ {d : Set π.S}, d ∈ π.Γ.C ∧ d ⊆ Δ → ¬ (d ∩ bd π.S).Nonempty → + ∀ {x y : α}, x ∈ supportVertices → y ∈ supportVertices → x ≠ y → + ∀ {e₀ : β}, (π.cellGraph d).Inc e₀ x → (π.cellGraph d).Inc e₀ y → active d) : + let I_Δ := {d | d ∈ π.Γ.C ∧ d ⊆ Δ} + let D₁ := {d | d ∈ I_Δ ∧ ((d ∩ bd π.S).Nonempty ∧ d ≠ c ∧ tilde d ⊆ I₁ ∨ + ¬ (d ∩ bd π.S).Nonempty ∧ active d ∧ nodes d ⊆ N₁ ∪ I₁)} + let D₂ := {d | d ∈ I_Δ ∧ ((d ∩ bd π.S).Nonempty ∧ d ≠ c ∧ tilde d ⊆ I₂ ∨ + ¬ (d ∩ bd π.S).Nonempty ∧ active d ∧ nodes d ⊆ N₂ ∪ I₂)} + let H₁ := π.cellsUnion D₁ + let H₂ := π.cellsUnion D₂ + let Hc := π.cellGraph c + ∃ w₀ : (H₁ ∪ (H₂ ∪ Hc)).skeleton.Walk a b, w₀.support = walk.support := by + intro I_Δ D₁ D₂ H₁ H₂ Hc + have hstep_all : ∀ {x y : α}, x ∈ supportVertices → y ∈ supportVertices → + (π.areaGraph Δ).skeleton.Adj x y → (H₁ ∪ (H₂ ∪ Hc)).skeleton.Adj x y := by + rintro x y hx hy ⟨hxy, e₀, hincx, hincy⟩ + have he₀_mem : e₀ ∈ (π.areaGraph Δ).edgeSet := + (π.areaGraph Δ).edge_mem_of_inc hincx + change e₀ ∈ ⋃ d ∈ _, _ at he₀_mem + rw [mem_iUnion₂] at he₀_mem + rcases he₀_mem with ⟨d, ⟨hd_I, hd_C⟩, hed⟩ + have hincx_G : G.Inc e₀ x := + (inc_iff_of_le (π.cellsUnion_le I_Δ) ((π.areaGraph Δ).edge_mem_of_inc hincx)).mp hincx + have hincy_G : G.Inc e₀ y := + (inc_iff_of_le (π.cellsUnion_le I_Δ) ((π.areaGraph Δ).edge_mem_of_inc hincy)).mp hincy + have hincx_d : (π.cellGraph d).Inc e₀ x := + (inc_iff_of_le (π.cellGraph_le d hd_C) hed).mpr hincx_G + have hincy_d : (π.cellGraph d).Inc e₀ y := + (inc_iff_of_le (π.cellGraph_le d hd_C) hed).mpr hincy_G + by_cases hdc : d = c + · subst hdc + exact ⟨hxy, e₀, Or.inr (Or.inr hincx_d), Or.inr (Or.inr hincy_d)⟩ + · by_cases hbd_d : (d ∩ bd π.S).Nonempty + · rcases hborder_split d hd_I.1 hd_I.2 hbd_d hdc with ht₁ | ht₂ + · have hd_D₁ : d ∈ D₁ := ⟨hd_I, Or.inl ⟨hbd_d, hdc, ht₁⟩⟩ + refine ⟨hxy, e₀, + Or.inl ((inc_iff_of_le (π.cellGraph_le_cellsUnion hd_D₁ hd_C) hed).mp hincx_d), + Or.inl ((inc_iff_of_le (π.cellGraph_le_cellsUnion hd_D₁ hd_C) hed).mp hincy_d)⟩ + · have hd_D₂ : d ∈ D₂ := ⟨hd_I, Or.inl ⟨hbd_d, hdc, ht₂⟩⟩ + refine ⟨hxy, e₀, + Or.inr (Or.inl ((inc_iff_of_le (π.cellGraph_le_cellsUnion hd_D₂ hd_C) hed).mp + hincx_d)), + Or.inr (Or.inl ((inc_iff_of_le (π.cellGraph_le_cellsUnion hd_D₂ hd_C) hed).mp + hincy_d))⟩ + · have hact_d : active d := + hcell_active hd_I hbd_d hx hy hxy hincx_d hincy_d + rcases hint_split d hd_I.1 hd_I.2 hbd_d with he₁ | he₂ + · have hd_D₁ : d ∈ D₁ := ⟨hd_I, Or.inr ⟨hbd_d, hact_d, he₁⟩⟩ + refine ⟨hxy, e₀, + Or.inl ((inc_iff_of_le (π.cellGraph_le_cellsUnion hd_D₁ hd_C) hed).mp hincx_d), + Or.inl ((inc_iff_of_le (π.cellGraph_le_cellsUnion hd_D₁ hd_C) hed).mp hincy_d)⟩ + · have hd_D₂ : d ∈ D₂ := ⟨hd_I, Or.inr ⟨hbd_d, hact_d, he₂⟩⟩ + refine ⟨hxy, e₀, + Or.inr (Or.inl ((inc_iff_of_le (π.cellGraph_le_cellsUnion hd_D₂ hd_C) hed).mp + hincx_d)), + Or.inr (Or.inl ((inc_iff_of_le (π.cellGraph_le_cellsUnion hd_D₂ hd_C) hed).mp + hincy_d))⟩ + have hlift_walk : ∀ {a b : α} (w : (π.areaGraph Δ).skeleton.Walk a b), + {z | z ∈ w.support} ⊆ {z | z ∈ supportVertices} → + ∃ w₀ : (H₁ ∪ (H₂ ∪ Hc)).skeleton.Walk a b, w₀.support = w.support := by + intro a b w hw_sub + induction w with + | nil => exact ⟨.nil, rfl⟩ + | @cons a x b hadj tail ih => + have ha_P : a ∈ supportVertices := hw_sub (SimpleGraph.Walk.start_mem_support _) + have hx_P : x ∈ supportVertices := + hw_sub (List.mem_cons_of_mem a (SimpleGraph.Walk.start_mem_support tail)) + obtain ⟨tail₀, hsup⟩ := ih (fun z hz => hw_sub (List.mem_cons_of_mem a hz)) + refine ⟨.cons (hstep_all ha_P hx_P hadj) tail₀, ?_⟩ + dsimp [SimpleGraph.Walk.support] + rw [hsup] + exact hlift_walk walk hQ_sub + +/-- A full linkage through the middle cell pairs the two marked end vertices. -/ +theorem no_partial_middle_cell_linkage + {α β : Type*} {G : Hypergraph α β} (π : Portrayal G) {Θ c : Set π.S} {p : ℕ} + (supportVertices : Fin (p + 1) → Set α) (hP_disj : Pairwise fun i j => + Disjoint (supportVertices i) (supportVertices j)) + (hwarp : π.warpAt Θ ≤ p) {m₁ m₂ : π.S} + (hm₁_bd : m₁ ∈ π.Γ.N ∩ bd π.S) (hm₂_bd : m₂ ∈ π.Γ.N ∩ bd π.S) (hm_ne : m₁ ≠ m₂) + (hc_C : c ∈ π.Γ.C) (hc_Θ : (c ∩ Θ).Nonempty) (hc_bd : (c ∩ bd π.S).Nonempty) + (htilde_c : tilde c = {m₁, m₂}) {j₀ : Fin (p + 1)} + (hP_m₁ : π.nodeVertex m₁ ∈ supportVertices j₀) + (hP_m₂ : ¬ (m₂ ∈ π.domγ ∧ π.nodeVertex m₂ ∈ supportVertices j₀)) + (hclaim : ∀ j, ∃ Q : PathFromTo (π.cellGraph c).skeleton (π.borderPlus m₁) (π.borderPlus m₂), + {z | z ∈ Q.walk.support} ⊆ supportVertices j) : False := by + let Q' : Fin (p + 1) → PathFromTo (π.cellGraph c).skeleton (π.borderPlus m₁) (π.borderPlus m₂) := + fun j => Classical.choose (hclaim j) + have hQ'_sub : ∀ j, {z | z ∈ (Q' j).walk.support} ⊆ supportVertices j := + fun j => Classical.choose_spec (hclaim j) + have hQ'_disj : Pairwise fun i j => + Disjoint {z | z ∈ (Q' i).walk.support} {z | z ∈ (Q' j).walk.support} := + fun _ _ hij => (hP_disj hij).mono (hQ'_sub _) (hQ'_sub _) + have hinj_Q'_first : Function.Injective (fun j => (Q' j).first) := by + intro i j hij + change (Q' i).first = (Q' j).first at hij + by_contra hne_ij + have hi_mem : (Q' j).first ∈ {z | z ∈ (Q' i).walk.support} := + hij ▸ SimpleGraph.Walk.start_mem_support (Q' i).walk + exact Set.disjoint_left.mp (hQ'_disj hne_ij) hi_mem + (SimpleGraph.Walk.start_mem_support (Q' j).walk) + have hinj_Q'_last : Function.Injective (fun j => (Q' j).last) := by + intro i j hij + change (Q' i).last = (Q' j).last at hij + by_contra hne_ij + have hi_mem : (Q' j).last ∈ {z | z ∈ (Q' i).walk.support} := + hij ▸ SimpleGraph.Walk.end_mem_support (Q' i).walk + exact Set.disjoint_left.mp (hQ'_disj hne_ij) hi_mem + (SimpleGraph.Walk.end_mem_support (Q' j).walk) + have hm₁_tc : m₁ ∈ tilde c := htilde_c ▸ mem_insert _ _ + have hm₂_tc : m₂ ∈ tilde c := htilde_c ▸ mem_insert_of_mem _ (mem_singleton _) + have hcw_le : π.cellWarp c ≤ p := (π.cellWarp_le_warpAt hc_C hc_Θ).trans hwarp + have hspec_c := π.cellWarp_spec hc_C hc_bd m₁ hm₁_tc m₂ hm₂_tc hm_ne + have hbp_m₁_le : (π.borderPlus m₁).ncard ≤ π.cellWarp c + 1 := + (π.ncard_borderPlus_le hm₁_bd).trans (Nat.add_le_add_right hspec_c.1 1) + have hbp_m₂_le : (π.borderPlus m₂).ncard ≤ π.cellWarp c + 1 := + (π.ncard_borderPlus_le hm₂_bd).trans (Nat.add_le_add_right hspec_c.2.1 1) + have hbp_m₁_ge : p + 1 ≤ (π.borderPlus m₁).ncard := by + have hsub : Set.range (fun j => (Q' j).first) ⊆ π.borderPlus m₁ := by + rintro _ ⟨j, rfl⟩; exact (Q' j).first_mem + have hcard_r : (Set.range (fun j => (Q' j).first)).ncard = p + 1 := by + rw [ncard_range_of_injective hinj_Q'_first, Nat.card_eq_fintype_card, Fintype.card_fin] + exact hcard_r ▸ ncard_le_ncard hsub (π.borderPlus_finite hm₁_bd) + have hbp_m₂_ge : p + 1 ≤ (π.borderPlus m₂).ncard := by + have hsub : Set.range (fun j => (Q' j).last) ⊆ π.borderPlus m₂ := by + rintro _ ⟨j, rfl⟩; exact (Q' j).last_mem + have hcard_r : (Set.range (fun j => (Q' j).last)).ncard = p + 1 := by + rw [ncard_range_of_injective hinj_Q'_last, Nat.card_eq_fintype_card, Fintype.card_fin] + exact hcard_r ▸ ncard_le_ncard hsub (π.borderPlus_finite hm₂_bd) + have hcw_eq : π.cellWarp c = p := by omega + have hlink_c : Portrayal.LinkagePairs (π.cellGraph c).skeleton + (π.borderPlus m₁) (π.borderPlus m₂) (p + 1) (π.nodeVertex m₁) (π.nodeVertex m₂) := by + have h1 : (π.borderPlus m₁).ncard = π.cellWarp c + 1 := by omega + have h2 : (π.borderPlus m₂).ncard = π.cellWarp c + 1 := by omega + have h0 := hspec_c.2.2 h1 h2 + rwa [hcw_eq] at h0 + have hm₂_dom : m₂ ∈ π.domγ := by + by_contra hm₂_not + have hbp_eq : π.borderPlus m₂ = π.borderSet m₂ := by + ext v; simp [Portrayal.borderPlus, hm₂_not] + rw [hbp_eq] at hbp_m₂_ge + have := hspec_c.2.1 + omega + obtain ⟨j₁, hj₁_first, hj₁_last⟩ := hlink_c Q' hQ'_disj + have hj₁_eq_j₀ : j₁ = j₀ := by + by_contra hne_j + exact Set.disjoint_left.mp (hP_disj hne_j) + (hQ'_sub j₁ (hj₁_first ▸ SimpleGraph.Walk.start_mem_support (Q' j₁).walk)) + hP_m₁ + have hm₂_in_P₀ : π.nodeVertex m₂ ∈ supportVertices j₀ := + hj₁_eq_j₀ ▸ hQ'_sub j₁ (hj₁_last ▸ SimpleGraph.Walk.end_mem_support (Q' j₁).walk) + exact hP_m₂ ⟨hm₂_dom, hm₂_in_P₀⟩ + +/-- A path using an edge of an interior cell meets at least two of that cell's nodes. -/ +theorem interior_cell_active_of_path_edge + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Δ : Set π.S} + {n₁ : π.S} + {n₂ : π.S} + {p : ℕ} + (P : Fin (p + 1) → PathFromTo (π.areaGraph Δ).skeleton (π.borderPlus n₁) (π.borderPlus n₂)) + (c₁_end : Set π.S) + (hc₁_C : c₁_end ∈ π.Γ.C) + (hc₁_Δ : c₁_end ⊆ Δ) + (hc₁_bd : (c₁_end ∩ bd π.S).Nonempty) + (hn₁_c₁ : n₁ ∈ tilde c₁_end) + (c₂_end : Set π.S) + (hc₂_C : c₂_end ∈ π.Γ.C) + (hc₂_Δ : c₂_end ⊆ Δ) + (hc₂_bd : (c₂_end ∩ bd π.S).Nonempty) + (hn₂_c₂ : n₂ ∈ tilde c₂_end) + (j : Fin (p + 1)) : + ∀ {d : Set π.S}, d ∈ ({d | d ∈ π.Γ.C ∧ d ⊆ Δ}) → ¬(d ∩ bd π.S).Nonempty → ∀ {x y : α}, x ∈ (P + j).walk.support → y ∈ (P j).walk.support → x ≠ y → ∀ {e₀ : β}, (π.cellGraph d).Inc e₀ x → + (π.cellGraph d).Inc e₀ y → (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' + (tilde d ∩ π.domγ)}.ncard) d j := by + let activeFor := fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ + π.domγ)}.ncard + let I_Δ := {d | d ∈ π.Γ.C ∧ d ⊆ Δ} + intro d hd hd_int x y hx_sup hy_sup hxy e₀ hincx hincy + by_contra hnot_act + have hle_one : ({z ∈ (P j).walk.support | + z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}).ncard ≤ 1 := by + change ¬ 2 ≤ _ at hnot_act + omega + let H₁ := π.cellsUnion (I_Δ \ {d}) + let H₂ := π.cellGraph d + have hH₁_le : H₁ ≤ G := π.cellsUnion_le _ + have hH₂_le : H₂ ≤ G := π.cellGraph_le d hd.1 + have h_union : H₁ ∪ H₂ = π.areaGraph Δ := by + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq (union_le hH₁_le hH₂_le) + (π.cellsUnion_le I_Δ) + · ext v + simp only [H₁, H₂, Portrayal.cellsUnion, union_vertexSet, mem_union, mem_iUnion] + exact ⟨by rintro (⟨d', ⟨⟨hd'₁, hd'₂⟩, _⟩, hv⟩ | hv) + · exact ⟨d', ⟨hd'₁, hd'₁.1⟩, hv⟩ + · exact ⟨d, ⟨hd, hd.1⟩, hv⟩, + by rintro ⟨d', ⟨hd'₁, _⟩, hv⟩ + by_cases hEq : d' = d + · exact Or.inr (hEq ▸ hv) + · exact Or.inl ⟨d', ⟨⟨hd'₁, hEq⟩, hd'₁.1⟩, hv⟩⟩ + · ext e' + simp only [H₁, H₂, Portrayal.cellsUnion, union_edgeSet, mem_union, mem_iUnion] + exact ⟨by rintro (⟨d', ⟨⟨hd'₁, hd'₂⟩, _⟩, he'⟩ | he') + · exact ⟨d', ⟨hd'₁, hd'₁.1⟩, he'⟩ + · exact ⟨d, ⟨hd, hd.1⟩, he'⟩, + by rintro ⟨d', ⟨hd'₁, _⟩, he'⟩ + by_cases hEq : d' = d + · exact Or.inr (hEq ▸ he') + · exact Or.inl ⟨d', ⟨⟨hd'₁, hEq⟩, hd'₁.1⟩, he'⟩⟩ + have hu_H₁ : (P j).first ∈ H₁.vertexSet := by + have hc₁_ne : c₁_end ≠ d := fun h => hd_int (h ▸ hc₁_bd) + have hvc₁ : (P j).first ∈ (π.cellGraph c₁_end).vertexSet := + π.borderPlus_subset_cellGraph hc₁_C hc₁_bd hn₁_c₁ (P j).first_mem + exact mem_biUnion ⟨⟨⟨hc₁_C, hc₁_Δ⟩, hc₁_ne⟩, hc₁_C⟩ hvc₁ + have hv_H₁ : (P j).last ∈ H₁.vertexSet := by + have hc₂_ne : c₂_end ≠ d := fun h => hd_int (h ▸ hc₂_bd) + have hvc₂ : (P j).last ∈ (π.cellGraph c₂_end).vertexSet := + π.borderPlus_subset_cellGraph hc₂_C hc₂_bd hn₂_c₂ (P j).last_mem + exact mem_biUnion ⟨⟨⟨hc₂_C, hc₂_Δ⟩, hc₂_ne⟩, hc₂_C⟩ hvc₂ + have hsub_inter : {z ∈ (P j).walk.support | z ∈ H₁.vertexSet ∩ H₂.vertexSet} ⊆ + {z ∈ (P j).walk.support | z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)} := by + rintro z ⟨hz_sup, hz₁, hz₂⟩ + change z ∈ ⋃ d' ∈ _, _ at hz₁ + rw [mem_iUnion₂] at hz₁ + rcases hz₁ with ⟨d', ⟨⟨hd'_I, hd'_ne⟩, _⟩, hzd'⟩ + exact ⟨hz_sup, π.p5 d hd.1 hd_int z hz₂ ⟨d', hd'_I.1, hd'_ne, hzd'⟩⟩ + have hcard_inter : ({z ∈ (P j).walk.support | z ∈ H₁.vertexSet ∩ H₂.vertexSet}).ncard ≤ 1 + := by + have hfin : ({z ∈ (P j).walk.support | + z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}).Finite := + (((π.Γ.finite_tilde_cell hd.1).inter_of_left _).image _).subset fun _ hz => hz.2 + exact (ncard_le_ncard hsub_inter hfin).trans hle_one + have hlift_w : ∀ {a b : α} (w : (π.areaGraph Δ).skeleton.Walk a b), + ∃ w' : (H₁ ∪ H₂).skeleton.Walk a b, w'.support = w.support := by + intro a b w + induction w with + | nil => exact ⟨.nil, rfl⟩ + | @cons a u b hadj tail ih => + obtain ⟨tail', hsup⟩ := ih + have hadj' : (H₁ ∪ H₂).skeleton.Adj a u := by + rw [h_union]; exact hadj + refine ⟨.cons hadj' tail', ?_⟩ + dsimp [SimpleGraph.Walk.support] + rw [hsup] + obtain ⟨w', hw'_sup⟩ := hlift_w (P j).walk + have hw'_path : w'.IsPath := by + rw [SimpleGraph.Walk.isPath_def, hw'_sup] + exact (P j).isPath.support_nodup + have hcard_w' : ({z ∈ w'.support | z ∈ H₁.vertexSet ∩ H₂.vertexSet}).ncard ≤ 1 := by + simpa only [hw'_sup] using hcard_inter + have hall_H₁ := walk_in_left_of_ncard_support_inter_le_one hH₁_le hH₂_le + hu_H₁ hv_H₁ w' hw'_path hcard_w' + have hx_H₁ : x ∈ H₁.vertexSet := hall_H₁ x (hw'_sup ▸ hx_sup) + have hy_H₁ : y ∈ H₁.vertexSet := hall_H₁ y (hw'_sup ▸ hy_sup) + have hx_H₂ : x ∈ H₂.vertexSet := H₂.vertex_mem_of_inc hincx + have hy_H₂ : y ∈ H₂.vertexSet := H₂.vertex_mem_of_inc hincy + have hpair : ({x, y} : Set α) ⊆ + {z ∈ (P j).walk.support | z ∈ H₁.vertexSet ∩ H₂.vertexSet} := by + rintro z (rfl | rfl) + · exact ⟨hx_sup, hx_H₁, hx_H₂⟩ + · exact ⟨hy_sup, hy_H₁, hy_H₂⟩ + have hfin₂ : ({z ∈ (P j).walk.support | z ∈ H₁.vertexSet ∩ H₂.vertexSet}).Finite := + H₁.vertexSet_finite.subset fun _ hz => hz.2.1 + have h2 : 2 ≤ ({z ∈ (P j).walk.support | z ∈ H₁.vertexSet ∩ H₂.vertexSet}).ncard := by + rw [← ncard_pair hxy] + exact ncard_le_ncard hpair hfin₂ + omega + +/-- A one-vertex path at the shared boundary gives a trivial path in the middle cell. -/ +theorem common_boundary_vertex_yields_trivial_path + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} + {Δ : Set π.S} + {n₁ : π.S} + {n₂ : π.S} + {p : ℕ} + (hΘ : Θ ∈ cuffs π.S) + (hn₁ : n₁ ∈ π.Γ.N ∩ Θ) + (hn₂ : n₂ ∈ π.Γ.N ∩ Θ) + (hinter_sub : ∀ n ∈ π.Γ.N ∩ (Θ ∩ discBd Δ), π.borderPlus n₁ ∩ π.borderPlus n₂ ⊆ π.borderPlus + n) + (P : Fin (p + 1) → PathFromTo (π.areaGraph Δ).skeleton (π.borderPlus n₁) (π.borderPlus n₂)) + (m₁ : π.S) + (m₂ : π.S) + (c : Set π.S) + (I₁ : Set π.S) + (I₂ : Set π.S) + (hm₁_mem : m₁ ∈ π.Γ.N ∩ (Θ ∩ discBd Δ)) + (hm₂_mem : m₂ ∈ π.Γ.N ∩ (Θ ∩ discBd Δ)) + (hI₁_sub : I₁ ⊆ Θ ∩ discBd Δ) + (hI₂_sub : I₂ ⊆ Θ ∩ discBd Δ) + (hord_I : ∀ n ∈ I₁ ∩ π.Γ.N, ∀ n' ∈ I₂ ∩ π.Γ.N, (n ≠ n₁ → n ≠ m₁ → GM19.InOrderOn Θ n₁ n m₁ n') + ∧ (m₁ ≠ n₁ → n' ≠ n₂ → GM19.InOrderOn Θ n₁ m₁ n' n₂) ∧ (n' ≠ m₂ → n' ≠ n₂ → GM19.InOrderOn Θ + n m₂ n' n₂) ∧ (n ≠ n₁ → m₂ ≠ n₂ → GM19.InOrderOn Θ n₁ n m₂ n₂)) + (j : Fin (p + 1)) + (Q : PathFromTo (π.areaGraph Δ).skeleton (⋃ n ∈ I₁ ∩ π.Γ.N, π.borderPlus n) + (⋃ n ∈ I₂ ∩ π.Γ.N, π.borderPlus n)) + (hQ_sub : {z | z ∈ Q.walk.support} ⊆ {z | z ∈ (P j).walk.support}) + (hst : Q.first = Q.last) : + ∃ Q' : PathFromTo (π.cellGraph c).skeleton (π.borderPlus m₁) (π.borderPlus m₂), + {z | z ∈ Q'.walk.support} ⊆ {z | z ∈ (P j).walk.support} ∧ + Q'.first ∈ (⋃ n ∈ I₁ ∩ π.Γ.N, π.borderPlus n) ∧ Q'.last ∈ (⋃ n ∈ I₂ ∩ π.Γ.N, π.borderPlus + n) := by + let B₁ := ⋃ n ∈ I₁ ∩ π.Γ.N, π.borderPlus n + let B₂ := ⋃ n ∈ I₂ ∩ π.Γ.N, π.borderPlus n + let s := Q.first + have hs_B₁₀ : s ∈ B₁ := Q.first_mem + have hs_B₂₀ : s ∈ B₂ := by + change Q.first ∈ B₂ + rw [hst] + exact Q.last_mem + have hs_B₁ : s ∈ B₁ := hs_B₁₀ + have hs_B₂ : s ∈ B₂ := hs_B₂₀ + rw [mem_iUnion₂] at hs_B₁ hs_B₂ + rcases hs_B₁ with ⟨n, hn_I₁, hsn⟩ + rcases hs_B₂ with ⟨n', hn'_I₂, hsn'⟩ + have hn_Θ : n ∈ π.Γ.N ∩ Θ := ⟨hn_I₁.2, (hI₁_sub hn_I₁.1).1⟩ + have hn'_Θ : n' ∈ π.Γ.N ∩ Θ := ⟨hn'_I₂.2, (hI₂_sub hn'_I₂.1).1⟩ + have hm₁_Θ : m₁ ∈ π.Γ.N ∩ Θ := ⟨hm₁_mem.1, hm₁_mem.2.1⟩ + have hm₂_Θ : m₂ ∈ π.Γ.N ∩ Θ := ⟨hm₂_mem.1, hm₂_mem.2.1⟩ + obtain ⟨hord₁, hord₂, hord₃, hord₄⟩ := hord_I n hn_I₁ n' hn'_I₂ + have hs_m₁ : s ∈ π.borderPlus m₁ := by + by_contra hnot_m₁ + have hs_n₁ : s ∈ π.borderPlus n₁ := by + by_cases hnn₁ : n = n₁ + · exact hnn₁ ▸ hsn + · have hnm₁ : n ≠ m₁ := fun h => hnot_m₁ (h ▸ hsn) + have hord := inOrderOn_cyclic (hord₁ hnn₁ hnm₁) + exact (π.p7 Θ hΘ n hn_Θ m₁ hm₁_Θ n' hn'_Θ n₁ hn₁ hord s hsn hsn').resolve_left hnot_m₁ + have hm₁_ne_n₁ : m₁ ≠ n₁ := fun h => hnot_m₁ (h ▸ hs_n₁) + have hs_n₂ : s ∈ π.borderPlus n₂ := by + by_cases hn'n₂ : n' = n₂ + · exact hn'n₂ ▸ hsn' + · have hord := hord₂ hm₁_ne_n₁ hn'n₂ + exact (π.p7 Θ hΘ n₁ hn₁ m₁ hm₁_Θ n' hn'_Θ n₂ hn₂ hord s hs_n₁ hsn').resolve_left hnot_m₁ + exact hnot_m₁ (hinter_sub m₁ hm₁_mem ⟨hs_n₁, hs_n₂⟩) + have hs_m₂ : s ∈ π.borderPlus m₂ := by + by_contra hnot_m₂ + have hs_n₂ : s ∈ π.borderPlus n₂ := by + by_cases hn'n₂ : n' = n₂ + · exact hn'n₂ ▸ hsn' + · have hn'm₂ : n' ≠ m₂ := fun h => hnot_m₂ (h ▸ hsn') + have hord := hord₃ hn'm₂ hn'n₂ + exact (π.p7 Θ hΘ n hn_Θ m₂ hm₂_Θ n' hn'_Θ n₂ hn₂ hord s hsn hsn').resolve_left hnot_m₂ + have hm₂_ne_n₂ : m₂ ≠ n₂ := fun h => hnot_m₂ (h ▸ hs_n₂) + have hs_n₁ : s ∈ π.borderPlus n₁ := by + by_cases hnn₁ : n = n₁ + · exact hnn₁ ▸ hsn + · have hord := inOrderOn_cyclic (hord₄ hnn₁ hm₂_ne_n₂) + exact (π.p7 Θ hΘ n hn_Θ m₂ hm₂_Θ n₂ hn₂ n₁ hn₁ hord s hsn hs_n₂).resolve_left hnot_m₂ + exact hnot_m₂ (hinter_sub m₂ hm₂_mem ⟨hs_n₁, hs_n₂⟩) + refine ⟨⟨s, s, .nil, SimpleGraph.Walk.IsPath.nil, hs_m₁, hs_m₂⟩, ?_, hs_B₁₀, hs_B₂₀⟩ + intro z hz + exact hQ_sub ((List.mem_singleton.mp hz) ▸ SimpleGraph.Walk.start_mem_support Q.walk) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CellNodes.lean b/LeanPool/GraphMinor/GM17/CellNodes.lean new file mode 100644 index 0000000000..e4d3e32609 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CellNodes.lean @@ -0,0 +1,305 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.RegionFrontier + +/-! +# Cells have two nodes and nodes lie on cells + +We collect the hypotheses of `RegionBoundaryOArcCriterionStatement` in `Painting.Tame`: there are at +least six nodes, all regions are open discs, and every normal `O`-arc +with at most one node bounds a disc that meets the paint only in the arc. Then every cell has at +least two nodes (`two_nodes`), which is the last part of (8.2) of +Graph Minors XVII (page 181), and every node lies on a cell (`node_on_cell`). To prove them we take +a curve around a cell or around a node. The curve bounds a disc on its other +side, so the surface is covered by two discs, which leaves room for too few nodes. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology Metric GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +/-- Two closed discs with the same boundary in a connected surface are equal, or else they cover the +surface and meet exactly in the boundary. -/ +theorem two_discs [ConnectedSpace S] (hS : IsSurface S) {Δ Δ' : Set S} (h : IsClosedDisc Δ) + (h' : IsClosedDisc Δ') (hb : discBd Δ = discBd Δ') : + Δ = Δ' ∨ (Δ ∪ Δ' = univ ∧ Δ ∩ Δ' = discBd Δ) := by + have ht2 : T2Space S := hS.2.1 + obtain ⟨T, tT, j, cap, hT, hTc, hj, -, -⟩ := exists_cap_discs _ S hS rfl + have hb' : discBd (j '' Δ) = discBd (j '' Δ') := by + rw [discBd_image hj.isEmbedding, discBd_image hj.isEmbedding, hb] + rcases two_discs_closed hT (image_emb_disc hj.isEmbedding h) (image_emb_disc hj.isEmbedding h') + hb' with h1 | ⟨h1, h2⟩ + · exact .inl (hj.injective.image_injective h1) + · right + constructor + · rw [eq_univ_iff_forall] + intro x + rcases (h1 ▸ mem_univ (j x) : j x ∈ j '' Δ ∪ j '' Δ') with h3 | h3 + · exact .inl (hj.injective.mem_set_image.mp h3) + · exact .inr (hj.injective.mem_set_image.mp h3) + · rw [discBd_image hj.isEmbedding] at h2 + ext x + have h3 := Set.ext_iff.mp h2 (j x) + simp only [mem_inter_iff, hj.injective.mem_set_image] at h3 + simpa using h3 + +/-- A closed disc around a closed disc in a surface that meets a closed set only where the small +disc does. -/ +theorem exists_ring_sub [ConnectedSpace S] (hS : IsSurface S) {E Z : Set S} (hE : IsClosedDisc E) + (hZ : IsClosed Z) (hZb : Z ∩ E ⊆ discBd E) (hEb : E ∩ bd S ⊆ Z) : + ∃ Δ, IsClosedDisc Δ ∧ E ⊆ Δ ∧ Δ ∩ Z = E ∩ Z ∧ discBd Δ ∩ E = E ∩ Z ∧ Δ ∩ bd S = E ∩ bd S := by + classical + have ht2 : T2Space S := hS.2.1 + have hcS : CompactSpace S := hS.1 + obtain ⟨T, tT, j, cap, hT, hTc, hj, hcap, hcov⟩ := exists_cap_discs _ S hS rfl + have hTs : IsSurface T := ⟨hT.1, hT.2.1, fun x => (hT.2.2 x).isManifoldPoint⟩ + have ht2T : T2Space T := hT.2.1 + have hfinC := (cuff_statement.{0} S hS).2.1 + let Z' : Set T := j '' Z ∪ ⋃ C ∈ cuffs S, cap C + have hZ' : IsClosed Z' := (hj.isClosedMap _ hZ).union (hfinC.isClosed_biUnion fun C hC => + (hcap C hC).1.isClosed) + have hbC : ∀ {C : Set S}, C ∈ cuffs S → C ⊆ bd S := fun {C} hC => by + obtain ⟨x, -, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + have hcapj : ∀ {x : S}, j x ∈ ⋃ C ∈ cuffs S, cap C → x ∈ bd S := fun {x} hx => by + obtain ⟨C, hC, hw⟩ := mem_iUnion₂.mp hx + obtain ⟨y, hy, he⟩ := ((hcap C hC).2.2 ▸ ⟨⟨x, rfl⟩, hw⟩ : j x ∈ j '' C) + obtain rfl := hj.injective he + exact hbC hC hy + have hjbd : ∀ {x : S}, x ∈ bd S → j x ∈ ⋃ C ∈ cuffs S, cap C := fun {x} hx => by + have hC : connectedComponentIn (bd S) x ∈ cuffs S := ⟨x, hx, rfl⟩ + refine mem_iUnion₂.mpr ⟨_, hC, ?_⟩ + have h1 : j x ∈ discBd (cap (connectedComponentIn (bd S) x)) := by + rw [(hcap _ hC).2.1] + exact mem_image_of_mem _ (mem_connectedComponentIn hx) + exact discBd_subset _ h1 + have hjZ : ∀ {x : S}, x ∈ E → j x ∈ Z' → x ∈ Z := fun {x} hxE hx => by + rcases hx with ⟨y, hy, he⟩ | hx + · exact hj.injective he ▸ hy + · exact hEb ⟨hxE, hcapj hx⟩ + have hB : IsClosedDisc (j '' E) := image_emb_disc hj.isEmbedding hE + have hbB : discBd (j '' E) = j '' discBd E := discBd_image hj.isEmbedding _ + have hZB : Z' ∩ j '' E ⊆ discBd (j '' E) := by + rintro _ ⟨hz, x, hx, rfl⟩ + rw [hbB] + exact mem_image_of_mem _ (hZb ⟨hjZ hx hz, hx⟩) + obtain ⟨Δ, hΔ, hsub, hin, hbd⟩ := exists_ring hTs hB (fun x _ => hT.2.2 x) hZ' hZB + have hΔr : Δ ⊆ range j := by + intro z hz + rcases (hcov ▸ mem_univ z : z ∈ range j ∪ ⋃ C ∈ cuffs S, cap C) with h | h + · exact h + · have h1 : z ∈ j '' E ∩ Z' := hin ▸ ⟨hz, .inr h⟩ + obtain ⟨y, -, rfl⟩ := h1.1 + exact mem_range_self _ + obtain ⟨hD, hDb⟩ := isClosedDisc_preimage hj hΔ hΔr + refine ⟨_, hD, fun x hx => hsub (mem_image_of_mem _ hx), ?_, ?_, ?_⟩ + · ext x + constructor + · rintro ⟨hx, hxZ⟩ + obtain ⟨y, hy, he⟩ := (hin ▸ ⟨hx, .inl (mem_image_of_mem _ hxZ)⟩ : j x ∈ j '' E ∩ Z').1 + obtain rfl := hj.injective he + exact ⟨hy, hxZ⟩ + · rintro ⟨hx, hxZ⟩ + exact ⟨hsub (mem_image_of_mem _ hx), hxZ⟩ + · ext x + constructor + · rw [hDb] + rintro ⟨hx, hxE⟩ + have h1 : j x ∈ j '' E ∩ Z' := by + rw [← hbd] + exact ⟨hx, mem_image_of_mem _ hxE⟩ + exact ⟨hxE, hjZ hxE h1.2⟩ + · rintro ⟨hx, hxZ⟩ + have h1 : j x ∈ discBd Δ ∩ j '' E := by + rw [hbd] + exact ⟨mem_image_of_mem _ hx, .inl (mem_image_of_mem _ hxZ)⟩ + rw [hDb] + exact ⟨h1.1, hx⟩ + · ext x + constructor + · rintro ⟨hx, hxb⟩ + obtain ⟨y, hy, he⟩ := (hin ▸ ⟨hx, .inr (hjbd hxb)⟩ : j x ∈ j '' E ∩ Z').1 + obtain rfl := hj.injective he + exact ⟨hy, hxb⟩ + · rintro ⟨hx, hxb⟩ + exact ⟨hsub (mem_image_of_mem _ hx), hxb⟩ + +namespace Painting + +/-- The hypotheses of the statement on boundaries of regions. -/ +structure Tame (Γ : Painting S) : Prop where + six : 6 ≤ Γ.N.ncard + open_disc : ∀ r ∈ Γ.regions, IsOpenDisc r + curve : ∀ F : Set S, IsOArc F → Γ.IsNormal F → (F ∩ Γ.N).ncard ≤ 1 → ∃ Δ : Set S, IsClosedDisc Δ + ∧ discBd Δ = F ∧ Δ ∩ Γ.U ⊆ F + +variable {Γ : Painting S} + +theorem Tame.isOpen (h : Γ.Tame) : ∀ r ∈ Γ.regions, IsOpen r := fun r hr => (h.open_disc r hr).1 + +/-- The nodes of a cover by two sets are few if each set has few nodes. -/ +theorem Tame.not_covered (h : Γ.Tame) {A : Set S} (hA : A.Finite) (hcard : A.ncard ≤ 5) + (hN : Γ.N ⊆ A) : False := by + have := Set.ncard_le_ncard hN hA + have := h.six + omega + +variable [T2Space S] + +/-- The closure of a cell without the nodes is off all other closures. -/ +theorem others_closed (Γ : Painting S) (G : Set (Set S)) : IsClosed (Γ.N ∪ ⋃ d ∈ Γ.C \ G, closure + d) := + Γ.finite_N.isClosed.union ((Γ.finite_cells.subset sdiff_subset).isClosed_biUnion fun _ _ + => isClosed_closure) + +omit [T2Space S] in +theorem mem_U_iff {x : S} : x ∈ Γ.U ↔ x ∈ Γ.N ∨ ∃ d ∈ Γ.C, x ∈ closure d := by + rw [Γ.U_eq_N_union_biUnion_closure] + simp + +/-- Every cell has two nodes. -/ +theorem two_nodes [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {c : Set S} + (hc : c ∈ Γ.C) : ∃ a ∈ tilde c, ∃ b ∈ tilde c, a ≠ b := by + classical + by_contra hne + push Not at hne + have hsmall : (tilde c).ncard ≤ 1 := by + rw [Set.ncard_le_one (Γ.finite_tilde_cell hc)] + exact hne + have hbd : ¬ (c ∩ bd S).Nonempty := fun h => by + obtain ⟨u, v, huv, ht, -⟩ := Γ.border_cell_exists_ends hc h + exact huv (hne u (ht ▸ .inl rfl) v (ht ▸ .inr rfl)) + have hdisc := Γ.isClosedDisc_closure_cell hc + let Z : Set S := Γ.N ∪ ⋃ d ∈ Γ.C \ {c}, closure d + have hZE : closure c ∩ Z ⊆ tilde c := by + rintro x ⟨hx, h | h⟩ + · rw [← Γ.closure_cell_inter_N hc] + exact ⟨hx, h⟩ + · obtain ⟨d, hd, hxd⟩ := mem_iUnion₂.mp h + rw [← Γ.closure_cell_inter_N hc] + exact ⟨hx, closure_inter_closure hc hd.1 (Ne.symm hd.2) ⟨hx, hxd⟩⟩ + have hEb : closure c ∩ bd S ⊆ Z := fun x hx => by + refine .inl (Γ.tilde_subset_N hc ⟨hx.1, fun h => hbd ⟨x, h, hx.2⟩⟩) + obtain ⟨Δ, hΔ, hsub, hin, hbdΔ, -⟩ := exists_ring_sub hS hdisc (others_closed Γ {c}) (fun x hx + => Γ.tilde_subset_discBd hc (hZE ⟨hx.2, hx.1⟩)) hEb + have hUZ : ∀ {x}, x ∈ Γ.U → x ∈ discBd Δ → x ∈ tilde c := fun {x} hxU hx => by + obtain h | ⟨d, hd, hxd⟩ := mem_U_iff.mp hxU + · exact hZE (hin ▸ ⟨discBd_subset _ hx, .inl h⟩) + · by_cases hdc : d = c + · subst hdc + exact hZE (hbdΔ ▸ ⟨hx, hxd⟩) + · exact hZE (hin ▸ ⟨discBd_subset _ hx, .inr (mem_iUnion₂.mpr ⟨d, ⟨hd, hdc⟩, hxd⟩)⟩) + have hnorm : Γ.IsNormal (discBd Δ) := fun x hx => Γ.tilde_subset_N hc (hUZ hx.2 hx.1) + have hc1 : (discBd Δ ∩ Γ.N).ncard ≤ 1 := by + refine (Set.ncard_le_ncard + (fun x (hx : x ∈ discBd Δ ∩ Γ.N) => hUZ (Γ.N_subset hx.2) hx.1) + (Γ.finite_tilde_cell hc)).trans hsmall + obtain ⟨Δ', hΔ', hb', hU'⟩ := hΓ.curve _ hΔ.isOArc_discBd hnorm hc1 + obtain ⟨x, hx⟩ := (arcComponentsIn_nonempty hc) + rcases two_discs hS hΔ hΔ' hb'.symm with he | ⟨hcov, -⟩ + · subst he + have h1 := hU' ⟨hsub (subset_closure hx), Γ.cell_subset_U hc hx⟩ + exact disjoint_left.mp (Γ.cell_disjoint_N hc) hx (hnorm ⟨h1, Γ.cell_subset_U hc hx⟩) + · refine hΓ.not_covered (Γ.finite_tilde_cell hc) (by omega) fun n hn => ?_ + rcases (hcov ▸ mem_univ n : n ∈ Δ ∪ Δ') with h | h + · exact hZE (hin ▸ ⟨h, .inl hn⟩) + · exact hUZ (Γ.N_subset hn) (hU' ⟨h, Γ.N_subset hn⟩) + +/-- A closed disc around an inner point of a surface inside a given open set, with the point in its +inside. -/ +theorem exists_small_disc {y : S} (hy : IsInteriorPoint y) {W : Set S} (hW : IsOpen W) + (hyW : y ∈ W) : ∃ E, IsClosedDisc E ∧ y ∈ E ∧ y ∉ discBd E ∧ E ⊆ W := by + obtain ⟨U₀, h, g, hc, hU₀, h0⟩ := hy.exists_ballChart hW hyW (R := 2) (by norm_num) + have hsub : closedBall (0 : ℂ) 1 ⊆ ball 0 2 := closedBall_subset_ball (by norm_num) + obtain ⟨hD, hbd⟩ := isClosedDisc_closedBall + obtain ⟨hE, hEb⟩ := isClosedDisc_image_injOn hD (isCompact_closedBall _ _) (hc.gc.mono hsub) + (fun a ha b hb he => by + rw [← hc.hg (hsub ha), ← hc.hg (hsub hb), he]) + refine ⟨_, hE, ⟨0, by simp, h0⟩, ?_, ?_⟩ + · rw [hEb, hbd] + rintro ⟨z, hz, he⟩ + have h1 : z = 0 := by + rw [← hc.hg (hsub (sphere_subset_closedBall hz)), he, ← h0, hc.hg (by simp)] + subst h1 + simp at hz + · rintro _ ⟨z, hz, rfl⟩ + exact hU₀ (hc.gm (hsub hz)) + +/-- Every node lies on a cell. -/ +theorem node_on_cell [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {n : S} + (hn : n ∈ Γ.N) : ∃ c ∈ Γ.C, n ∈ tilde c := by + classical + by_contra hno + push Not at hno + by_cases hb : n ∈ bd S + · have hC : connectedComponentIn (bd S) n ∈ cuffs S := ⟨n, hb, rfl⟩ + have hO : IsOArc (connectedComponentIn (bd S) n) := (cuff_statement.{0} S hS).2.2 _ hC + obtain ⟨φ⟩ := id hO + obtain ⟨y, hy, hyn⟩ : ∃ y ∈ connectedComponentIn (bd S) n, y ≠ n := by + by_cases h1 : (φ 1).1 = n + · refine ⟨(φ (Circle.exp Real.pi)).1, (φ _).2, fun h2 => ?_⟩ + have h3 : φ (Circle.exp Real.pi) = φ 1 := Subtype.ext (h2.trans h1.symm) + have h4 := φ.injective h3 + have h5 := congrArg (fun z : Circle => (z : ℂ)) h4 + simp [Circle.coe_exp] at h5 + norm_num at h5 + · exact ⟨_, (φ 1).2, h1⟩ + obtain ⟨I, B, hI, -, hu, -⟩ := hO.lines (mem_connectedComponentIn hb) hy (Ne.symm hyn) + have hIb : I ⊆ bd S := (hu ▸ subset_union_left : I ⊆ _).trans (connectedComponentIn_subset _ _) + obtain ⟨c, hc, -, -, hnc, -⟩ := exists_border_cell (Δ := univ) hI hIb (subset_univ _) hn + (fun c _ => .inl (subset_univ _)) + exact hno c hc hnc + · have hiso : ∀ d ∈ Γ.C, n ∉ closure d := fun d hd h => hno d hd ⟨h, fun h' => disjoint_left.mp + (Γ.cell_disjoint_N hd) h' hn⟩ + have hZ : IsClosed ((Γ.N \ {n}) ∪ ⋃ d ∈ Γ.C, closure d) := + (Γ.finite_N.subset sdiff_subset).isClosed.union (Γ.finite_cells.isClosed_biUnion fun _ _ + => isClosed_closure) + obtain ⟨E, hE, hnE, hnb, hEW⟩ := exists_small_disc (by_contra hb : IsInteriorPoint n) + hZ.isOpen_compl (by + rintro (h | h) + · exact h.2 rfl + · obtain ⟨d, hd, h⟩ := mem_iUnion₂.mp h + exact hiso d hd h) + have hEU : E ∩ Γ.U ⊆ {n} := by + rintro x ⟨hx, hxU⟩ + obtain h | ⟨d, hd, hxd⟩ := mem_U_iff.mp hxU + · by_contra hne + exact hEW hx (.inl ⟨h, hne⟩) + · exact absurd (.inr (mem_iUnion₂.mpr ⟨d, hd, hxd⟩)) (hEW hx) + have hFU : discBd E ∩ Γ.U = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro x ⟨hx, hxU⟩ + have h1 := hEU ⟨discBd_subset _ hx, hxU⟩ + exact hnb (h1 ▸ hx) + have hnorm : Γ.IsNormal (discBd E) := by + intro x hx + exact absurd hx (by rw [hFU]; exact notMem_empty _) + have hF0 : discBd E ∩ Γ.N = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro x ⟨hx, hxN⟩ + exact (eq_empty_iff_forall_notMem.mp hFU x) ⟨hx, Γ.N_subset hxN⟩ + obtain ⟨Δ', hΔ', hb', hU'⟩ := hΓ.curve _ hE.isOArc_discBd hnorm (by rw [hF0]; simp) + rcases two_discs hS hE hΔ' hb'.symm with he | ⟨hcov, -⟩ + · subst he + have h1 := hU' ⟨hnE, Γ.N_subset hn⟩ + exact hnb h1 + · refine hΓ.not_covered (finite_singleton n) (by simp) fun x hx => ?_ + rcases (hcov ▸ mem_univ x : x ∈ E ∪ Δ') with h | h + · exact hEU ⟨h, Γ.N_subset hx⟩ + · exact ((eq_empty_iff_forall_notMem.mp hF0 x) ⟨hb' ▸ hU' ⟨h, Γ.N_subset hx⟩, hx⟩).elim + +end Painting + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CellPartitionArc.lean b/LeanPool/GraphMinor/GM17/CellPartitionArc.lean new file mode 100644 index 0000000000..dc56b734d0 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CellPartitionArc.lean @@ -0,0 +1,274 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.RegionTools +public import LeanPool.GraphMinor.GM17.ThreeNodeReplace +public import LeanPool.GraphMinor.GM17.IndentMain + +/-! +# Arcs of an `O`-arc between marked points + +Let `A` be a finite set of marks on an `O`-arc `O`, with at least two marks. The arcs of `O` are the +lines of `O` with ends in `A` and no other marks (`IsArcOf`). In +the graph `H` of the proof of (11.1) of Graph Minors XVII, page 190, a region of `H` meets the +boundary of a region of the painting in one such arc. We +show that two arcs that share a point off `A` are equal, that there are finitely many, and that each +mark lies on exactly two of them. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +local notation "𝕀" => unitInterval + +variable {X : Type} [TopologicalSpace X] [T2Space X] + +/-- A line of `O` with ends in `A` and no other points of `A`. -/ +def IsArcOf (O A L : Set X) : Prop := ∃ a b, IsLineWithEnds L a b ∧ L ⊆ O ∧ L ∩ A = {a, b} + +omit [T2Space X] in +theorem IsArcOf.subset {O A L : Set X} (h : IsArcOf O A L) : L ⊆ O := by + obtain ⟨a, b, -, h, -⟩ := h + exact h + +theorem arc_sub_of_inner {O L L' : Set X} {a b a' b' z : X} (hO : IsOArc O) + (hL : IsLineWithEnds L a b) (hL' : IsLineWithEnds L' a' b') (hLO : L ⊆ O) + (hL'O : L' ⊆ O) (hA : ∀ x ∈ L', x ∉ ({a', b'} : Set X) → x ∉ ({a, b} : Set X)) + (hz : z ∈ L \ {a, b}) (hz' : z ∈ L' \ {a', b'}) : L' ⊆ L := by + obtain ⟨M, hM, hu, hi⟩ := oarc_split hO hL hLO + have hY : O \ {a, b} = (L ∪ M) \ {a, b} := by rw [hu] + have hcomp := inner_mem_comps hL hM hY hi + obtain ⟨x, -, hx⟩ := hcomp + have hpc : IsPreconnected (L' \ {a', b'}) := (GM11.isPathConnected_sdiff_pair + hL').isConnected.isPreconnected + have hsub : L' \ {a', b'} ⊆ O \ {a, b} := fun w hw => ⟨hL'O hw.1, hA w hw.1 hw.2⟩ + have hzO : z ∈ connectedComponentIn (O \ {a, b}) x := by rw [hx]; exact hz + have hle : L' \ {a', b'} ⊆ L \ {a, b} := by + rw [← hx, connectedComponentIn_eq hzO] + exact hpc.subset_connectedComponentIn hz' hsub + exact hL'.subset_closure_diff.trans (closure_minimal (hle.trans sdiff_subset) + (GM19.isClosed_of_cuffLine hL)) + +/-- Two arcs that share a point off the marks are equal. -/ +theorem arcOf_eq {O A L L' : Set X} {z : X} (hO : IsOArc O) (h : IsArcOf O A L) + (h' : IsArcOf O A L') (hz : z ∈ L) (hz' : z ∈ L') (hzA : z ∉ A) : L = L' := by + obtain ⟨a, b, hL, hLO, hLA⟩ := h + obtain ⟨a', b', hL', hL'O, hL'A⟩ := h' + have hend : ∀ {L a b}, L ∩ A = {a, b} → ∀ x, x ∈ ({a, b} : Set X) → x ∈ A := fun h x hx => + (h.symm.subset hx).2 + have hzn : z ∉ ({a, b} : Set X) := fun h3 => hzA (hend hLA z h3) + have hzn' : z ∉ ({a', b'} : Set X) := fun h3 => hzA (hend hL'A z h3) + refine Subset.antisymm (arc_sub_of_inner hO hL' hL hL'O hLO ?_ ⟨hz', hzn'⟩ ⟨hz, + hzn⟩) (arc_sub_of_inner hO hL hL' hLO hL'O ?_ ⟨hz, hzn⟩ ⟨hz', hzn'⟩) + · intro x hx hn h3 + exact hn (hLA.subset ⟨hx, hend hL'A x h3⟩) + · intro x hx hn h3 + exact hn (hL'A.subset ⟨hx, hend hLA x h3⟩) + +theorem arcOf_family {O A : Set X} {x y : X} (hO : IsOArc O) (hA : A.Finite) (hAO : A ⊆ O) + (hx : x ∈ A) (hy : y ∈ A) (hxy : x ≠ y) : + {L | IsArcOf O A L}.Finite ∧ ⋃₀ {L | IsArcOf O A L} = O := by + obtain ⟨𝓕, hf, hF, hu⟩ := exists_gaps_oarc hO hA hAO hx hy hxy + have harc : ∀ F ∈ 𝓕, IsArcOf O A F := fun F hFm => by + obtain ⟨a, -, b, -, h1, h2, h3⟩ := hF F hFm + exact ⟨a, b, h1, h2, h3⟩ + constructor + · refine hf.subset fun L hL => ?_ + obtain ⟨a, b, hl, hLO, hLA⟩ := id hL + obtain ⟨z, hz⟩ := line_inner_nonempty hl + have hzO : z ∈ ⋃₀ 𝓕 := hu ▸ hLO hz.1 + obtain ⟨F, hFm, hzF⟩ := hzO + have hzA : z ∉ A := fun h => hz.2 (hLA.subset ⟨hz.1, h⟩) + rw [arcOf_eq hO hL (harc F hFm) hz.1 hzF hzA] + exact hFm + · refine Subset.antisymm (sUnion_subset fun L hL => hL.subset) ?_ + exact hu.ge.trans (sUnion_subset_sUnion harc) + +omit [T2Space X] in +/-- Two connected subsets of a line that both contain its first point and another point share a +point off any finite set. -/ +theorem lines_overlap {B L L' E : Set X} {x y z z' : X} (hB : IsLineWithEnds B x y) + (hL : IsPreconnected L) (hL' : IsPreconnected L') (hLB : L ⊆ B) (hL'B : L' ⊆ B) + (hx : x ∈ L) (hx' : x ∈ L') (hz : z ∈ L) (hz' : z' ∈ L') (hzx : z ≠ x) (hzx' : z' ≠ x) + (hE : E.Finite) : ∃ p, p ∈ L ∧ p ∈ L' ∧ p ∉ E := by + obtain ⟨f, hf0, -⟩ := hB + let g : B → ℝ := fun p => (f.symm p : ℝ) + have hgc : Continuous g := continuous_subtype_val.comp f.symm.continuous + have hinj : Function.Injective g := fun p q h => f.symm.injective (Subtype.ext h) + have hval : ∀ {T : Set X}, T ⊆ B → Subtype.val '' (Subtype.val ⁻¹' T : Set B) = T := fun {T} hT + => by + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hT] + have hpc : ∀ {T : Set X}, IsPreconnected T → T ⊆ B → IsPreconnected (g '' + (Subtype.val ⁻¹' T : Set B)) := fun {T} hT hTB => by + refine IsPreconnected.image ?_ g hgc.continuousOn + rw [← Topology.IsInducing.subtypeVal.isPreconnected_image, hval hTB] + exact hT + have hx0 : g ⟨x, hLB hx⟩ = 0 := by + have h : (⟨x, hLB hx⟩ : B) = f 0 := Subtype.ext hf0.symm + simp [g, h] + have hpos : ∀ {w : X} (hw : w ∈ B), w ≠ x → 0 < g ⟨w, hw⟩ := fun {w} hw hne => by + refine lt_of_le_of_ne (f.symm _).2.1 fun h => hne ?_ + have h3 := hinj (h.symm.trans hx0.symm) + exact congrArg Subtype.val h3 + have hIcc : ∀ {T : Set X} {w : X}, IsPreconnected T → (hTB : T ⊆ B) → x ∈ T + → ∀ hw : w ∈ T, Set.Icc 0 (g ⟨w, hTB hw⟩) ⊆ g '' (Subtype.val ⁻¹' T : Set B) + := fun {T} {w} hT hTB hxT hw => + (hpc hT hTB).Icc_subset ⟨⟨x, hTB hxT⟩, hxT, hx0⟩ ⟨⟨w, hTB hw⟩, hw, rfl⟩ + have hs := lt_min (hpos (hLB hz) hzx) (hpos (hL'B hz') hzx') + set s := min (g ⟨z, hLB hz⟩) (g ⟨z', hL'B hz'⟩) with hsdef + have hE' : (g '' (Subtype.val ⁻¹' E : Set B)).Finite := (hE.preimage + Subtype.val_injective.injOn).image g + obtain ⟨t, ht, htE⟩ := ((Set.Icc_infinite hs).sdiff hE').nonempty + obtain ⟨p, hp, hpt⟩ := hIcc hL hLB hx hz ⟨ht.1, ht.2.trans (min_le_left _ _)⟩ + obtain ⟨p', hp', hpt'⟩ := hIcc hL' hL'B hx' hz' ⟨ht.1, ht.2.trans (min_le_right _ _)⟩ + obtain rfl : p = p' := hinj (hpt.trans hpt'.symm) + exact ⟨p.1, hp, hp', fun h => htE ⟨p, h, hpt⟩⟩ + +theorem IsArcOf.isClosed {O A L : Set X} (h : IsArcOf O A L) : IsClosed L := by + obtain ⟨a, b, h, -, -⟩ := h + exact GM19.isClosed_of_cuffLine h + +/-- Each mark on an `O`-arc with at least two marks lies on exactly two arcs. The arcs off the mark +have closed union, so the arcs at the mark cover a neighbourhood of it. One arc alone cannot do +this, by the other line of `O` between its ends. Two more arcs at the mark would lie in that other +line and overlap there. -/ +theorem arcs_at_mark {O A : Set X} {x y a : X} (hO : IsOArc O) (hA : A.Finite) (hAO : A ⊆ O) + (hx : x ∈ A) (hy : y ∈ A) (hxy : x ≠ y) (ha : a ∈ A) : + {L | IsArcOf O A L ∧ a ∈ L}.ncard = 2 := by + obtain ⟨hfin, hcov⟩ := arcOf_family hO hA hAO hx hy hxy + have haO : a ∈ ⋃₀ {L | IsArcOf O A L} := by rw [hcov]; exact hAO ha + obtain ⟨L, hLa, haL⟩ := haO + obtain ⟨b, hL⟩ : ∃ b, IsLineWithEnds L a b ∧ L ∩ A = {a, b} := by + obtain ⟨u, v, h1, -, h3⟩ := id hLa + rcases (h3 ▸ (⟨haL, ha⟩ : a ∈ L ∩ A) : a ∈ ({u, v} : Set X)) with rfl | rfl + · exact ⟨v, h1, h3⟩ + · exact ⟨u, h1.symm, by rw [h3, pair_comm]⟩ + obtain ⟨hLl, hLA⟩ := hL + have hLO := hLa.subset + obtain ⟨M, hM, hu, hi⟩ := oarc_split hO hLl hLO + have hinM : ∀ {L'}, IsArcOf O A L' → L' ≠ L → L' ⊆ M := fun {L'} h' hne => by + obtain ⟨u, v, hl, hl', hlA⟩ := id h' + refine hl.subset_closure_diff.trans (closure_minimal (fun w hw => ?_) + (GM19.isClosed_of_cuffLine hM)) + have hwA : w ∉ A := fun h => hw.2 (hlA.subset ⟨hw.1, h⟩) + have hwO : w ∈ L ∪ M := hu ▸ hl' hw.1 + rcases hwO with h | h + · exact absurd (arcOf_eq hO h' hLa hw.1 h hwA) hne + · exact h + have hsecond : ∃ L', IsArcOf O A L' ∧ a ∈ L' ∧ L' ≠ L := by + by_contra hno + push Not at hno + let T := ⋃₀ {L' | IsArcOf O A L' ∧ a ∉ L'} + have hTfin : {L' | IsArcOf O A L' ∧ a ∉ L'}.Finite := hfin.subset fun _ h => h.1 + have hTc : IsClosed T := hTfin.isClosed_sUnion fun L' h => h.1.isClosed + have hMT : M ⊆ T := hM.subset_closure_diff.trans (closure_minimal (fun w hw => ?_) hTc) + · exact (hMT hM.left_mem).elim fun L' h => h.1.2 h.2 + · have hwO : w ∈ ⋃₀ {L | IsArcOf O A L} := by rw [hcov]; exact hu ▸ .inr hw.1 + obtain ⟨L', hL', hwL'⟩ := hwO + have hane : a ∉ L' := fun h => by + have hLL := hno L' hL' h + rw [hLL] at hwL' + exact hw.2 (hi.subset ⟨hwL', hw.1⟩) + exact ⟨L', ⟨hL', hane⟩, hwL'⟩ + obtain ⟨L', hL', haL', hne⟩ := hsecond + have hset : {L | IsArcOf O A L ∧ a ∈ L} = {L, L'} := by + ext L₃ + simp only [mem_ofPred_eq, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨h3, ha3⟩ + by_contra hno + push Not at hno + have hother : ∀ {L₄}, IsArcOf O A L₄ → ∃ z ∈ L₄, z ≠ a ∧ IsPreconnected L₄ := fun {L₄} h₄ + => by + obtain ⟨u, v, hl, -, -⟩ := id h₄ + by_cases h : u = a + · exact ⟨v, hl.right_mem, fun e => hl.ne' (h.trans e.symm), line_preconnected hl⟩ + · exact ⟨u, hl.left_mem, h, line_preconnected hl⟩ + obtain ⟨z, hz, hza, hpc⟩ := hother hL' + obtain ⟨z', hz', hza', hpc'⟩ := hother h3 + obtain ⟨p, hp, hp', hpA⟩ := lines_overlap hM hpc hpc' (hinM hL' hne) + (hinM h3 hno.1) haL' ha3 hz hz' hza hza' hA + exact hno.2 (arcOf_eq hO h3 hL' hp' hp hpA) + · rintro (rfl | rfl) + · exact ⟨hLa, haL⟩ + · exact ⟨hL', haL'⟩ + rw [hset, ncard_pair hne.symm] + +omit [T2Space X] in +/-- A property of closed sets of a finite family with connected union is constant if it agrees on +any two sets that meet. -/ +theorem arcs_agree {𝓑 : Set (Set X)} {p : Set X → Prop} (hf : 𝓑.Finite) (hB : IsPreconnected + (⋃₀ 𝓑)) (hcl : ∀ L ∈ 𝓑, IsClosed L) (hag : ∀ L ∈ 𝓑, ∀ L' ∈ 𝓑, (L ∩ L').Nonempty → (p L ↔ p L')) + {L L' : Set X} (hL : L ∈ 𝓑) (hL' : L' ∈ 𝓑) (hn : L.Nonempty) (hn' : L'.Nonempty) : p L ↔ p L' + := by + by_contra hne + have key : ∀ {M M' : Set X}, M ∈ 𝓑 → M' ∈ 𝓑 → M.Nonempty → M'.Nonempty → p M → ¬ p M' → False + := fun {M M'} hM hM' hnM hnM' h1 h2 => by + have hfin : {K | K ∈ 𝓑 ∧ p K}.Finite := hf.subset fun _ h => h.1 + have hfin' : {K | K ∈ 𝓑 ∧ ¬ p K}.Finite := hf.subset fun _ h => h.1 + have hcT := hfin.isClosed_sUnion fun K h => hcl K h.1 + have hcT' := hfin'.isClosed_sUnion fun K h => hcl K h.1 + have hsub : ⋃₀ 𝓑 ⊆ ⋃₀ {K | K ∈ 𝓑 ∧ p K} ∪ ⋃₀ {K | K ∈ 𝓑 ∧ ¬ p K} := fun x ⟨K, hK, hx⟩ => by + by_cases hp : p K + · exact .inl ⟨K, ⟨hK, hp⟩, hx⟩ + · exact .inr ⟨K, ⟨hK, hp⟩, hx⟩ + obtain ⟨x, hx⟩ := hnM + obtain ⟨y, hy⟩ := hnM' + obtain ⟨z, -, ⟨K₁, h₁, hz₁⟩, ⟨K₂, h₂, hz₂⟩⟩ := isPreconnected_closed_iff.mp hB _ _ hcT hcT' + hsub ⟨x, ⟨M, hM, hx⟩, ⟨M, ⟨hM, h1⟩, hx⟩⟩ ⟨y, ⟨M', hM', hy⟩, ⟨M', ⟨hM', h2⟩, hy⟩⟩ + exact h₂.2 ((hag K₁ h₁.1 K₂ h₂.1 ⟨z, hz₁, hz₂⟩).mp h₁.2) + by_cases hp : p L + · exact key hL hL' hn hn' hp fun h => hne (iff_of_true hp h) + · exact key hL' hL hn' hn (by + by_contra h + exact hne (iff_of_false hp h)) hp + +/-- An arc of an `O`-arc with marks `u` and `v` lies in one of the two lines between them. -/ +theorem arc_sub_line {O A L C₁ C₂ : Set X} {u v : X} (hO : IsOArc O) (hu : u ∈ A) (hv : v ∈ A) + (hC₁ : IsLineWithEnds C₁ u v) (hC₂ : IsLineWithEnds C₂ u v) (hun : C₁ ∪ C₂ = O) + (hL : IsArcOf O A L) : L ⊆ C₁ ∨ L ⊆ C₂ := by + obtain ⟨a, b, hl, hlO, hlA⟩ := id hL + obtain ⟨z, hz⟩ := line_inner_nonempty hl + have hzA : z ∉ A := fun h => hz.2 (hlA.subset ⟨hz.1, h⟩) + have hzu : z ∉ ({u, v} : Set X) := by + rintro (rfl | rfl) + · exact hzA hu + · exact hzA hv + have hoff : ∀ x ∈ L, x ∉ ({a, b} : Set X) → x ∉ ({u, v} : Set X) := fun x hx hn h => by + refine hn (hlA.subset ⟨hx, ?_⟩) + rcases h with rfl | rfl + · exact hu + · exact hv + rcases (hun ▸ hlO hz.1 : z ∈ C₁ ∪ C₂) with h | h + · exact .inl (arc_sub_of_inner hO hC₁ hl (hun ▸ subset_union_left) hlO hoff ⟨h, hzu⟩ hz) + · exact .inr (arc_sub_of_inner hO hC₂ hl (hun ▸ subset_union_right) hlO hoff ⟨h, hzu⟩ hz) + +/-- The arcs inside a line between two marks cover it. -/ +theorem arcs_cover_line {O A C₁ C₂ : Set X} {u v : X} (hO : IsOArc O) (hA : A.Finite) (hAO : A ⊆ O) + (hu : u ∈ A) (hv : v ∈ A) (huv : u ≠ v) (hC₁ : IsLineWithEnds C₁ u v) + (hC₂ : IsLineWithEnds C₂ u v) + (hun : C₁ ∪ C₂ = O) (hin : C₁ ∩ C₂ = {u, v}) : ⋃₀ {L | IsArcOf O A L ∧ L ⊆ C₁} = C₁ := by + obtain ⟨hfin, hcov⟩ := arcOf_family hO hA hAO hu hv huv + refine Subset.antisymm (sUnion_subset fun L h => h.2) ?_ + have hCfin : {L | IsArcOf O A L ∧ L ⊆ C₁}.Finite := hfin.subset fun _ h => h.1 + have hcl := hCfin.isClosed_sUnion fun L h => h.1.isClosed + refine hC₁.subset_closure_diff.trans (closure_minimal (fun x hx => ?_) hcl) + have hxO : x ∈ ⋃₀ {L | IsArcOf O A L} := by + rw [hcov] + exact hun ▸ .inl hx.1 + obtain ⟨L, hL, hxL⟩ := hxO + rcases arc_sub_line hO hu hv hC₁ hC₂ hun hL with h | h + · exact ⟨L, ⟨hL, h⟩, hxL⟩ + · exact (hx.2 (hin.subset ⟨hx.1, h hxL⟩)).elim + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CellPartitionChord.lean b/LeanPool/GraphMinor/GM17/CellPartitionChord.lean new file mode 100644 index 0000000000..006e27752e --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CellPartitionChord.lean @@ -0,0 +1,281 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CellPartitionFace +public import LeanPool.GraphMinor.GM17.Section5 +import LeanPool.GraphMinor.Surface.CutLift + +/-! +# Claim (2) of the proof of (11.1) + +Claim (2) of the proof of (11.1) of Graph Minors XVII, page 190, says that a circuit of length four +of the graph `H` bounds a region of `H`, which holds one cell. We state it on faces: two different +faces with two common +nodes `u` and `v` have a cell with nodes `{u, v}` and with one gap on each face (`par_faces`). The +proof is the paper's. Chords through the two faces between `u` and `v` make a normal curve, which is +the case split of Claim (1). For two regions it is an +`O`-arc and we use the hypothesis (8.5). For a region and a cuff it is an `I`-arc and we use the +hypothesis (8.3). The two cuffs case cannot occur, as cuffs are disjoint. The disc holds a part of +each face, so a whole line of the face between `u` and `v`. +This line has no other nodes, so it is a gap, and the disc has at most one cell, so the two gaps +belong to one cell. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface Painting + +variable {S : Type} [TopologicalSpace S] [T2Space S] {Γ : Painting S} + +/-- A chord of a closed region between two nodes of its frontier. -/ +theorem chord_of_region [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) {r C₁ C₂ : Set S} {a + b : S} (hr : r ∈ Γ.regions) (hC₁ : IsLineWithEnds C₁ a b) (hC₂ : IsLineWithEnds C₂ a b) + (hu : C₁ ∪ C₂ = closure r \ r) (hi : C₁ ∩ C₂ = {a, b}) (haN : a ∈ Γ.N) (hbN : b ∈ Γ.N) + (hab : a ≠ b) : + ∃ F Δ₁ Δ₂, IsLineWithEnds F a b ∧ F \ {a, b} ⊆ r ∧ F ∩ Γ.N = {a, b} ∧ F ∩ Γ.U ⊆ {a, b} + ∧ F ∩ bd S ⊆ {a, b} ∧ IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ Δ₁ ∪ Δ₂ = closure r ∧ + Δ₁ ∩ Δ₂ = F ∧ discBd Δ₁ = C₁ ∪ F ∧ discBd Δ₂ = C₂ ∪ F := by + obtain ⟨hdR, hbR⟩ := region_disc hS (fun r hr => (h.hreg r hr).1) hr (h.hreg r hr).2 + obtain ⟨F, Δ₁, Δ₂, hF, hFb, hFR, hd₁, hd₂, hu', hi', hb₁, hb₂⟩ := split_disc hdR hC₁ hC₂ hab + (hu.trans hbR.symm) hi + have hFr : F \ {a, b} ⊆ r := fun x hx => by + by_contra h + have h3 : x ∈ F ∩ discBd (closure r) := ⟨hx.1, hbR ▸ ⟨hFR hx.1, h⟩⟩ + rw [hFb] at h3 + exact hx.2 h3 + have hrU : ∀ x ∈ r, x ∉ Γ.U := fun x hx => (arcComponentsIn_subset hr hx).2 + have hFend : ∀ x ∈ F, x ∉ r → x = a ∨ x = b := fun x hx h => by_contra fun h3 => h (hFr ⟨hx, h3⟩) + refine ⟨F, Δ₁, Δ₂, hF, hFr, ?_, fun x hx => hFend x hx.1 fun h => hrU x h hx.2, + fun x hx => hFend x hx.1 fun h => hrU x h (Γ.bd_subset hx.2), hd₁, hd₂, hu', hi', hb₁, hb₂⟩ + refine Subset.antisymm (fun x hx => hFend x hx.1 fun h => hrU x h (Γ.N_subset hx.2)) ?_ + rintro x (rfl | rfl) + · exact ⟨hF.left_mem, haN⟩ + · exact ⟨hF.right_mem, hbN⟩ + +omit [T2Space S] in +/-- A cell off a closed set `F` that meets a closed set `Δ` with `Δ \ F` open lies in `Δ`. -/ +theorem cell_in_disc {Δ F c : Set S} (hΔ : IsClosed Δ) (hF : IsClosed F) + (hnb : ∀ x ∈ Δ \ F, Δ ∈ 𝓝 x) (hc : c ∈ Γ.C) (hcF : Disjoint c F) {x : S} (hx : x ∈ c) + (hxΔ : x ∈ Δ) : c ⊆ Δ := by + have hW : IsOpen (Δ \ F) := by + rw [isOpen_iff_mem_nhds] + exact fun y hy => Filter.inter_mem (hnb y hy) (hF.isOpen_compl.mem_nhds hy.2) + have hpc : IsPreconnected c := (arcComponentsIn_isPathConnected hc).isConnected.isPreconnected + have hsub : c ⊆ (Δ \ F) ∪ Δᶜ := fun y hy => by + by_cases h : y ∈ Δ + · exact .inl ⟨h, disjoint_left.mp hcF hy⟩ + · exact .inr h + have hle := hpc.subset_left_of_subset_union hW hΔ.isOpen_compl (disjoint_left.mpr fun y hy hy' + => hy' hy.1) hsub ⟨x, hx, hxΔ, disjoint_left.mp hcF hx⟩ + exact hle.trans sdiff_subset + +/-- A line of a region's frontier inside a disc that has no other nodes is a gap of a cell inside +the disc. -/ +theorem gap_in_disc [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) {O C F Δ : Set S} {u v : + S} (hO : Γ.IsFace O) (hC : IsLineWithEnds C u v) (hCO : C ⊆ O) (hCΔ : C ⊆ Δ) (hΔ : IsClosed Δ) + (hF : IsClosed F) + (hnb : ∀ x ∈ Δ \ F, Δ ∈ 𝓝 x) (hN : Δ ∩ Γ.N ⊆ F) (hFN : F ∩ Γ.N = {u, v}) (hFU : F ∩ Γ.U ⊆ Γ.N) + (huN : u ∈ Γ.N) (hvN : v ∈ Γ.N) : ∃ c, Γ.IsGap c C u v ∧ c ⊆ Δ := by + have hCN : C ∩ Γ.N = {u, v} := by + refine Subset.antisymm (fun x hx => hFN ▸ ⟨hN ⟨hCΔ hx.1, hx.2⟩, hx.2⟩) ?_ + rintro x (rfl | rfl) + · exact ⟨hC.left_mem, huN⟩ + · exact ⟨hC.right_mem, hvN⟩ + have harc : IsArcOf O (Γ.N ∩ O) C := by + refine ⟨u, v, hC, hCO, ?_⟩ + rw [← hCN] + ext x + exact ⟨fun h => ⟨h.1, h.2.1⟩, fun h => ⟨h.1, h.2, hCO h.1⟩⟩ + obtain ⟨c, u', v', hG⟩ := arc_face_gap hS h hO harc + have hG' : Γ.IsGap c C u v := ⟨hG.1, hC, hG.2.2.1, hCN⟩ + obtain ⟨z, hz⟩ := line_inner_nonempty hC + have hzc : z ∈ c := hG'.mem_cell hz.1 (fun e => hz.2 (.inl e)) (fun e => hz.2 (.inr e)) + have hcF : Disjoint c F := disjoint_left.mpr fun x hx hxF => disjoint_left.mp + (Γ.cell_disjoint_N hG.1) hx (hFU ⟨hxF, Γ.cell_subset_U hG.1 hx⟩) + exact ⟨c, hG', cell_in_disc hΔ hF hnb hG.1 hcF hzc (hCΔ hz.1)⟩ + +omit [T2Space S] in +/-- The nodes of a cell in a disc are in the disc, so a cell with two gap ends has just these nodes. +-/ +theorem tilde_of_disc {c Δ F : Set S} {u v : S} (hc : c ∈ Γ.C) (hcΔ : c ⊆ Δ) (hΔ : IsClosed Δ) + (hN : Δ ∩ Γ.N ⊆ F) (hFN : F ∩ Γ.N = {u, v}) (hu : u ∈ tilde c) (hv : v ∈ tilde c) : tilde c + = {u, v} := by + refine Subset.antisymm (fun x hx => ?_) ?_ + · have hxN := Γ.tilde_subset_N hc hx + exact hFN ▸ ⟨hN ⟨closure_minimal hcΔ hΔ hx.1, hxN⟩, hxN⟩ + · rintro x (rfl | rfl) + · exact hu + · exact hv + +omit [T2Space S] in +theorem Painting.IsGap.left_mem_tilde {c L : Set S} {u v : S} (h : Γ.IsGap c L u v) : u ∈ tilde c := + ⟨h.subset_closure h.2.1.left_mem, fun hx => disjoint_left.mp (Γ.cell_disjoint_N h.1) hx + h.left_mem_N⟩ + +omit [T2Space S] in +theorem Painting.IsGap.right_mem_tilde {c L : Set S} {u v : S} (h : Γ.IsGap c L u v) : v ∈ tilde c + := + ⟨h.subset_closure h.2.1.right_mem, fun hx => disjoint_left.mp (Γ.cell_disjoint_N h.1) hx + h.right_mem_N⟩ + +/-- A disc with a chord of a region on its boundary holds one of the two lines of the frontier, as a +gap of a cell in the disc. -/ +theorem side_in_disc [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) {r C₁ C₂ F₀ Δ₁ Δ₂ F Δ : + Set S} {u v : S} (hr : r ∈ Γ.regions) (hC₁ : IsLineWithEnds C₁ u v) (hC₂ : IsLineWithEnds C₂ u v) + (hu : C₁ ∪ C₂ = closure r \ r) (hF₀ : IsLineWithEnds F₀ u v) (hF₀r : F₀ \ {u, v} ⊆ r) + (hd₁ : IsClosedDisc Δ₁) (hd₂ : IsClosedDisc Δ₂) (hu' : Δ₁ ∪ Δ₂ = closure r) (hi' : Δ₁ ∩ Δ₂ + = F₀) + (hb₁ : discBd Δ₁ = C₁ ∪ F₀) (hb₂ : discBd Δ₂ = C₂ ∪ F₀) (hΔ : IsClosedDisc Δ) + (h1 : F₀ ⊆ discBd Δ) (h2 : discBd Δ ∩ r ⊆ F₀) (hF : IsClosed F) (hnb : ∀ x ∈ Δ \ F, Δ ∈ 𝓝 x) + (hN : Δ ∩ Γ.N ⊆ F) (hFN : F ∩ Γ.N = {u, v}) (hFU : F ∩ Γ.U ⊆ Γ.N) (huN : u ∈ Γ.N) + (hvN : v ∈ Γ.N) : ∃ c L, Γ.IsGap c L u v ∧ c ⊆ Δ ∧ L ⊆ closure r \ r := by + have hO : Γ.IsFace (closure r \ r) := .inl ⟨r, hr, rfl⟩ + have hc₁ : C₁ ⊆ closure r \ r := hu ▸ subset_union_left + have hc₂ : C₂ ⊆ closure r \ r := hu ▸ subset_union_right + rcases chord_side hS (h.hopen r hr) hu.symm hF₀ hF₀r hd₁ hd₂ hu' hi' hb₁ hb₂ hΔ h1 h2 with h3 | h3 + · obtain ⟨c, hG, hc⟩ := gap_in_disc hS h hO hC₁ hc₁ (fun x hx => h3 (discBd_subset _ + (hb₁ ▸ .inl hx))) hΔ.isClosed hF hnb hN hFN hFU huN hvN + exact ⟨c, C₁, hG, hc, hc₁⟩ + · obtain ⟨c, hG, hc⟩ := gap_in_disc hS h hO hC₂ hc₂ (fun x hx => h3 (discBd_subset _ + (hb₂ ▸ .inl hx))) hΔ.isClosed hF hnb hN hFN hFU huN hvN + exact ⟨c, C₂, hG, hc, hc₂⟩ + +/-- The hypothesis (8.3) of (11.1). -/ +def Hyp83 (Γ : Painting S) : Prop := + ∀ F : Set S, IsLine F → Γ.IsNormal F → F ∩ bd S = lineEnds F → (F ∩ Γ.N).ncard = 2 → + ∃ Δ : Set S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd S ∧ Δ ∩ Γ.N ⊆ F + ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard = 1 + +/-- The hypothesis (8.5) of (11.1). -/ +def Hyp85 (Γ : Painting S) : Prop := + ∀ F : Set S, IsOArc F → Γ.IsNormal F → (F ∩ Γ.N).ncard = 2 → + ∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F ∧ Δ ∩ Γ.N ⊆ F ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard ≤ 1 + +omit [T2Space S] in +theorem cells_finite (Γ : Painting S) (Δ : Set S) : {c ∈ Γ.C | c ⊆ Δ}.Finite + := Γ.finite_cells.subset fun _ h => h.1 + +/-- Claim (2) for two regions, by the hypothesis (8.5). -/ +theorem par_regions [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) + (h85 : Hyp85 Γ) {r r' : Set S} {u v : S} (hr : r ∈ Γ.regions) (hr' : r' ∈ Γ.regions) + (hne : r ≠ r') + (hu : u ∈ closure r \ r) (hv : v ∈ closure r \ r) (hu' : u ∈ closure r' \ r') + (hv' : v ∈ closure r' \ r') (huN : u ∈ Γ.N) (hvN : v ∈ Γ.N) (huv : u ≠ v) : + ∃ c L L', Γ.IsGap c L u v ∧ Γ.IsGap c L' u v ∧ L ⊆ closure r \ r ∧ L' ⊆ closure r' \ r' + ∧ tilde c = {u, v} := by + have hman := hS.2.2 + obtain ⟨C₁, C₂, hC₁, hC₂, hun, hin⟩ := (h.hreg r hr).2.lines hu hv huv + obtain ⟨C₁', C₂', hC₁', hC₂', hun', hin'⟩ := (h.hreg r' hr').2.lines hu' hv' huv + obtain ⟨F₁, Δ₁, Δ₂, hF₁, hF₁r, hF₁N, hF₁U, -, hd₁, hd₂, hu₁, hi₁, hb₁, hb₂⟩ + := chord_of_region hS h hr hC₁ hC₂ hun hin huN hvN huv + obtain ⟨F₂, Δ₁', Δ₂', hF₂, hF₂r, hF₂N, hF₂U, -, hd₁', hd₂', hu₂, hi₂, hb₁', hb₂'⟩ + := chord_of_region hS h hr' hC₁' hC₂' hun' hin' huN hvN huv + have hdisj : ∀ x, x ∈ r → x ∈ r' → False := fun x hx hx' => hne (region_eq hr hr' hx hx') + have hsame : ∀ x ∈ F₂, x ∈ r → x ∈ F₁ := fun x hx hxr => by + by_cases h3 : x ∈ ({u, v} : Set S) + · rcases h3 with rfl | rfl + · exact hF₁.left_mem + · exact hF₁.right_mem + · exact (hdisj x hxr (hF₂r ⟨hx, h3⟩)).elim + have hsame' : ∀ x ∈ F₁, x ∈ r' → x ∈ F₂ := fun x hx hxr => by + by_cases h3 : x ∈ ({u, v} : Set S) + · rcases h3 with rfl | rfl + · exact hF₂.left_mem + · exact hF₂.right_mem + · exact (hdisj x (hF₁r ⟨hx, h3⟩) hxr).elim + have hi : F₁ ∩ F₂ = {u, v} := by + refine Subset.antisymm (fun x hx => ?_) ?_ + · by_contra h3 + exact hdisj x (hF₁r ⟨hx.1, h3⟩) (hF₂r ⟨hx.2, h3⟩) + · rintro x (rfl | rfl) + · exact ⟨hF₁.left_mem, hF₂.left_mem⟩ + · exact ⟨hF₁.right_mem, hF₂.right_mem⟩ + have hFO : IsOArc (F₁ ∪ F₂) := oArc_of_lines hF₁ hF₂ hi + have hFN : (F₁ ∪ F₂) ∩ Γ.N = {u, v} := by rw [union_inter_distrib_right, hF₁N, hF₂N, union_self] + have hUset : (F₁ ∪ F₂) ∩ Γ.U ⊆ {u, v} := by + rintro x ⟨h3 | h3, h4⟩ + · exact hF₁U ⟨h3, h4⟩ + · exact hF₂U ⟨h3, h4⟩ + have hnode : ({u, v} : Set S) ⊆ Γ.N := by + rintro x (rfl | rfl) + · exact huN + · exact hvN + have hFU : (F₁ ∪ F₂) ∩ Γ.U ⊆ Γ.N := hUset.trans hnode + obtain ⟨Δ, hΔ, hb, hN, hcard⟩ := h85 _ hFO hFU (by rw [hFN, ncard_pair huv]) + have hFc : IsClosed (F₁ ∪ F₂) := (GM19.isClosed_of_cuffLine hF₁).union + (GM19.isClosed_of_cuffLine hF₂) + have hnb : ∀ x ∈ Δ \ (F₁ ∪ F₂), Δ ∈ 𝓝 x := fun x hx => by + have hx' : x ∈ discInt Δ := ⟨hx.1, hb ▸ hx.2⟩ + exact Filter.mem_of_superset ((hΔ.isOpen_discInt hman).mem_nhds hx') sdiff_subset + obtain ⟨c, L, hG, hc, hLO⟩ := side_in_disc hS h hr hC₁ hC₂ hun hF₁ hF₁r hd₁ hd₂ hu₁ hi₁ hb₁ hb₂ + hΔ (hb ▸ subset_union_left) + (fun x hx => (hb ▸ hx.1 : x ∈ F₁ ∪ F₂).elim id fun h3 => hsame x h3 hx.2) hFc hnb hN hFN hFU + huN hvN + obtain ⟨c', L', hG', hc', hLO'⟩ := side_in_disc hS h hr' hC₁' hC₂' hun' hF₂ hF₂r hd₁' hd₂' hu₂ + hi₂ hb₁' hb₂' hΔ (hb ▸ subset_union_right) + (fun x hx => (hb ▸ hx.1 : x ∈ F₁ ∪ F₂).elim (fun h3 => hsame' x h3 hx.2) id) hFc hnb hN hFN hFU + huN hvN + obtain rfl : c = c' := (ncard_le_one (cells_finite Γ Δ)).mp hcard c ⟨hG.1, hc⟩ c' ⟨hG'.1, hc'⟩ + exact ⟨c, L, L', hG, hG', hLO, hLO', tilde_of_disc hG.1 hc hΔ.isClosed hN hFN hG.left_mem_tilde + hG.right_mem_tilde⟩ + +/-- Claim (2) for a region and a cuff, by the hypothesis (8.3). -/ +theorem par_region_cuff [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) + (h83 : Hyp83 Γ) {r Θ : Set S} {u v : S} (hr : r ∈ Γ.regions) (hΘ : Θ ∈ cuffs S) + (hu : u ∈ closure r \ r) (hv : v ∈ closure r \ r) (hu' : u ∈ Θ) (hv' : v ∈ Θ) (huN : u ∈ Γ.N) + (hvN : v ∈ Γ.N) (huv : u ≠ v) : + ∃ c L L', Γ.IsGap c L u v ∧ Γ.IsGap c L' u v ∧ L ⊆ closure r \ r ∧ L' ⊆ Θ ∧ tilde c = {u, v} + := by + obtain ⟨C₁, C₂, hC₁, hC₂, hun, hin⟩ := (h.hreg r hr).2.lines hu hv huv + have hub := cuff_subset hΘ hu' + have hvb := cuff_subset hΘ hv' + obtain ⟨F, Δ₁, Δ₂, Δ, hF, hFr, hFN, hd₁, hd₂, hu₁, hi₁, hb₁, hb₂, hΔ, h1, h2, hN, hcard, hnb, -⟩ + := + exists_chord_disc hS (fun r hr => (h.hreg r hr).1) (fun r hr => (h.hreg r hr).2) h83 hr hC₁ hC₂ + hun hin huN hvN huv hub hvb + have hrU : ∀ x ∈ r, x ∉ Γ.U := fun x hx => (arcComponentsIn_subset hr hx).2 + have hFend : ∀ x ∈ F, x ∉ r → x = u ∨ x = v := fun x hx h => by_contra fun h3 => h (hFr ⟨hx, h3⟩) + have hFU : F ∩ Γ.U ⊆ Γ.N := fun x hx => hFN.ge (hFend x hx.1 fun h3 => hrU x h3 hx.2) |>.2 + have hFb : F ∩ bd S = {u, v} := by + refine Subset.antisymm (fun x hx => hFend x hx.1 fun h3 => hrU x h3 (Γ.bd_subset hx.2)) ?_ + rintro x (rfl | rfl) + · exact ⟨hF.left_mem, hub⟩ + · exact ⟨hF.right_mem, hvb⟩ + have hFc : IsClosed F := GM19.isClosed_of_cuffLine hF + obtain ⟨c, L, hG, hc, hLO⟩ := side_in_disc hS h hr hC₁ hC₂ hun hF hFr hd₁ hd₂ hu₁ hi₁ hb₁ hb₂ hΔ + h1 + (fun x hx => (h2 hx.1).elim id fun hb => (hrU x hx.2 (Γ.bd_subset hb)).elim) hFc hnb hN hFN hFU + huN hvN + obtain ⟨I, I', Θ', hΘ', hI, -, hU, -, hFI, -, -, -⟩ := arc_disc_data hS hF hFb hΔ h1 h2 + have hIΘ' : I ⊆ Θ' := hU ▸ subset_union_left + obtain rfl : Θ' = Θ := cuff_eq hΘ' hΘ (hIΘ' hI.left_mem) hu' + obtain ⟨c', hG', hc'⟩ := gap_in_disc hS h (.inr hΘ') hI hIΘ' (fun x hx => discBd_subset _ + (hFI ▸ .inr hx)) hΔ.isClosed hFc hnb hN hFN hFU huN hvN + obtain rfl : c = c' := (ncard_le_one (cells_finite Γ Δ)).mp hcard.le c ⟨hG.1, hc⟩ c' ⟨hG'.1, hc'⟩ + exact ⟨c, L, I, hG, hG', hLO, hIΘ', tilde_of_disc hG.1 hc hΔ.isClosed hN hFN hG.left_mem_tilde + hG.right_mem_tilde⟩ + +/-- **Claim (2) of the proof of (11.1)**, on faces. -/ +theorem par_faces [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) (h83 : Hyp83 Γ) + (h85 : Hyp85 Γ) {O O' : Set S} {u v : S} (hO : Γ.IsFace O) (hO' : Γ.IsFace O') (hne : O ≠ O') + (hu : u ∈ O) (hv : v ∈ O) (hu' : u ∈ O') (hv' : v ∈ O') (huN : u ∈ Γ.N) (hvN : v ∈ Γ.N) + (huv : u ≠ v) : + ∃ c L L', Γ.IsGap c L u v ∧ Γ.IsGap c L' u v ∧ L ⊆ O ∧ L' ⊆ O' ∧ tilde c = {u, v} := by + rcases hO with ⟨r, hr, rfl⟩ | hO <;> rcases hO' with ⟨r', hr', rfl⟩ | hO' + · exact par_regions hS h h85 hr hr' (fun e => hne (by rw [e])) hu hv hu' hv' huN hvN huv + · exact par_region_cuff hS h h83 hr hO' hu hv hu' hv' huN hvN huv + · obtain ⟨c, L, L', h1, h2, h3, h4, h5⟩ := + par_region_cuff hS h h83 hr' hO hu' hv' hu hv huN hvN huv + exact ⟨c, L', L, h2, h1, h4, h3, h5⟩ + · exact absurd (cuff_eq hO hO' hu hu') hne + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CellPartitionCount.lean b/LeanPool/GraphMinor/GM17/CellPartitionCount.lean new file mode 100644 index 0000000000..aea4377056 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CellPartitionCount.lean @@ -0,0 +1,799 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Algebra.BigOperators.Group.Finset.Basic +public import Mathlib.Algebra.Group.Nat.Even +public import Mathlib.Algebra.BigOperators.Ring.Finset +public import Mathlib.Data.Finset.Card +public import Mathlib.Algebra.BigOperators.Ring.Nat +import Mathlib.Algebra.BigOperators.Group.Finset.Lemmas + +/-! +# Counting for the graph `δ(I)` + +This is the counting behind Claims (3) and (4) of the proof of (11.1) of Graph Minors XVII, pages +190 and 191. We do not draw the graph `H`. It is enough to +know the arcs between consecutive nodes on the boundaries of the regions and cuffs. Each arc has two +ends and lies on one face and on one cell. Mark some arcs. We call +`(f, n)` a change if an odd number of marked arcs of the face `f` end at `n`. Every face has an even +number of changes (`even_face`). If a cell has an even +number of arcs at each node, and arcs of a cell are all marked or all unmarked, then every node has +an even number of changes (`even_node`). So `δ(I)` has even valency. +If the faces with changes have pairs of change nodes that are all different, within three nodes, +then these faces form a triangle (`exists_triangle`). Claim (4) is `triangle_of_system`: under the +facts of `ArcSystem` every class of cells with at most three shared nodes, and with neither class on +all nodes, has such a triangle, by induction on the number of faces with changes. Two faces with the +same pair give a cell whose class we flip. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Finset + +variable {Arc Face Cell Node : Type*} + +open Classical in +/-- The number of marked arcs of a face at a node. -/ +noncomputable def markCount (A : Finset Arc) (fc : Arc → Face) (ends : Arc → Finset Node) (m : Arc + → Prop) (f : Face) (n : Node) : ℕ := + #{a ∈ A | fc a = f ∧ n ∈ ends a ∧ m a} + +theorem even_face (A : Finset Arc) (fc : Arc → Face) (ends : Arc → Finset Node) (m : Arc → Prop) + (f : Face) (Nd : Finset Node) + (hends : ∀ a ∈ A, fc a = f → ends a ⊆ Nd ∧ #(ends a) = 2) : + Even #{n ∈ Nd | Odd (markCount A fc ends m f n)} := by + classical + rw [← Finset.even_sum_iff_even_card_odd] + have h1 : ∀ n ∈ Nd, markCount A fc ends m f n = ∑ a ∈ A with fc a = f + ∧ m a, if n ∈ ends a then 1 else 0 := fun n _ => by + rw [markCount, card_filter, sum_filter] + refine sum_congr rfl fun a _ => ?_ + by_cases h : fc a = f <;> by_cases h' : m a <;> by_cases h'' : n ∈ ends a <;> simp [h, h', h''] + rw [sum_congr rfl h1, sum_comm] + have h2 : ∀ a ∈ ({a ∈ A | fc a = f ∧ m a} : Finset Arc), (∑ n ∈ Nd, if n ∈ ends a then 1 else 0) + = 2 := fun a ha => by + obtain ⟨ha1, ha2⟩ := mem_filter.mp ha + obtain ⟨h3, h4⟩ := hends a ha1 ha2.1 + rw [← card_filter, ← h4] + congr 1 + ext n + simp only [mem_filter] + exact ⟨fun h => h.2, fun h => ⟨h3 h, h⟩⟩ + rw [sum_congr rfl h2, sum_const, nsmul_eq_mul, Nat.cast_id] + exact even_two.mul_left _ + +open Classical in +theorem even_node (A : Finset Arc) (fc : Arc → Face) (ce : Arc → Cell) (ends : Arc → Finset Node) + (m : Cell → Prop) (Fc : Finset Face) (Cl : Finset Cell) (n : Node) + (hfc : ∀ a ∈ A, fc a ∈ Fc) (hce : ∀ a ∈ A, ce a ∈ Cl) (hcell : ∀ c ∈ Cl, Even #{a ∈ A | ce a + = c ∧ n ∈ ends a}) : + Even #{f ∈ Fc | Odd (markCount A fc ends (fun a => m (ce a)) f n)} := by + classical + rw [← Finset.even_sum_iff_even_card_odd] + have h1 : ∑ f ∈ Fc, markCount A fc ends (fun a => m (ce a)) f n = #{a ∈ A | n ∈ ends a ∧ m + (ce a)} := by + rw [card_eq_sum_card_fiberwise (f := fc) (t := Fc) (fun a ha => hfc a (mem_filter.mp ha).1)] + refine sum_congr rfl fun f _ => ?_ + rw [markCount, filter_filter] + congr 1 + ext a + simp only [mem_filter] + tauto + rw [h1, card_eq_sum_card_fiberwise (f := ce) (t := Cl) (fun a ha => hce a (mem_filter.mp ha).1)] + refine even_sum _ fun c hc => ?_ + by_cases hm : m c + · have h2 : ({a ∈ ({a ∈ A | n ∈ ends a ∧ m (ce a)} : Finset Arc) | ce a = c} : Finset Arc) + = {a ∈ A | ce a = c ∧ n ∈ ends a} := by + ext a + simp only [mem_filter] + constructor + · rintro ⟨⟨h1, h2, -⟩, h3⟩ + exact ⟨h1, h3, h2⟩ + · rintro ⟨h1, h3, h2⟩ + exact ⟨⟨h1, h2, h3 ▸ hm⟩, h3⟩ + rw [h2] + exact hcell c hc + · have h2 : ({a ∈ ({a ∈ A | n ∈ ends a ∧ m (ce a)} : Finset Arc) | ce a = c} : Finset Arc) = ∅ + := by + ext a + simp only [mem_filter, notMem_empty, iff_false] + rintro ⟨⟨-, -, h3⟩, h4⟩ + exact hm (h4 ▸ h3) + rw [h2] + simp + +open Classical in +/-- **Faces with different pairs of change nodes form a triangle.** -/ +theorem exists_triangle (P : Finset Face) (Z : Finset Node) (p : Face → Finset Node) (hZ : #Z ≤ 3) + (hp : ∀ f ∈ P, p f ⊆ Z ∧ #(p f) = 2) + (hinj : Set.InjOn p P) (hne : P.Nonempty) (heven : ∀ n ∈ Z, Even #{f ∈ P | n ∈ p f}) : + ∃ x y z f g h, x ≠ y ∧ y ≠ z ∧ x ≠ z ∧ Z = {x, y, z} ∧ P = {f, g, h} ∧ f ≠ g ∧ g ≠ h ∧ f ≠ h + ∧ p f = {x, y} ∧ p g = {y, z} ∧ p h = {x, z} := by + classical + obtain ⟨f, hf⟩ := hne + obtain ⟨u, v, huv, hfe⟩ := card_eq_two.mp (hp f hf).2 + have hu : u ∈ p f := by simp [hfe] + have hv : v ∈ p f := by simp [hfe] + have hother : ∀ {n}, n ∈ p f → ∃ g ∈ P, g ≠ f ∧ n ∈ p g := fun {n} hn => by + have hnZ := (hp f hf).1 hn + have hm : f ∈ ({f ∈ P | n ∈ p f} : Finset Face) := mem_filter.mpr ⟨hf, hn⟩ + have h2 : 1 < #({f ∈ P | n ∈ p f} : Finset Face) := by + have hpos := card_pos.mpr ⟨f, hm⟩ + obtain ⟨k, hk⟩ := heven n hnZ + omega + obtain ⟨g, hg, hne⟩ := exists_mem_ne h2 f + exact ⟨g, (mem_filter.mp hg).1, hne, (mem_filter.mp hg).2⟩ + obtain ⟨g, hg, hgf, hug⟩ := hother hu + obtain ⟨a, b, hab, hge⟩ := card_eq_two.mp (hp g hg).2 + have hgne : p g ≠ p f := fun h => hgf (hinj hg hf h) + obtain ⟨w, huw, hgw⟩ : ∃ w, u ≠ w ∧ p g = {u, w} := by + rw [hge] at hug ⊢ + simp only [mem_insert, mem_singleton] at hug + rcases hug with rfl | rfl + · exact ⟨b, hab, rfl⟩ + · exact ⟨a, hab.symm, pair_comm _ _⟩ + have hvw : v ≠ w := fun h => hgne (by rw [hgw, hfe, h]) + have hwZ : w ∈ Z := (hp g hg).1 (by simp [hgw]) + have hZe : Z = {u, v, w} := by + refine (eq_of_subset_of_card_le ?_ ?_).symm + · intro x hx + simp only [mem_insert, mem_singleton] at hx + rcases hx with rfl | rfl | rfl + · exact (hp f hf).1 hu + · exact (hp f hf).1 hv + · exact hwZ + · rw [card_insert_of_notMem (by simp [huv, huw]), card_insert_of_notMem + (by simpa using hvw), card_singleton] + exact hZ + have hpairs : ∀ e ∈ P, p e = {u, v} ∨ p e = {u, w} ∨ p e = {v, w} := fun e he => by + obtain ⟨hs, hc⟩ := hp e he + obtain ⟨a, b, hab, hee⟩ := card_eq_two.mp hc + have ha : a ∈ Z := hs (by simp [hee]) + have hb : b ∈ Z := hs (by simp [hee]) + rw [hZe] at ha hb + simp only [mem_insert, mem_singleton] at ha hb + rw [hee] + rcases ha with rfl | rfl | rfl <;> rcases hb with rfl | rfl | rfl <;> simp_all [pair_comm] + obtain ⟨h, hh, hhf, hvh⟩ := hother hv + have hhe : p h = {v, w} := by + rcases hpairs h hh with h3 | h3 | h3 + · exact absurd (hinj hh hf (h3.trans hfe.symm)) hhf + · rw [h3] at hvh + simp only [mem_insert, mem_singleton] at hvh + rcases hvh with h4 | h4 + · exact absurd h4 huv.symm + · exact absurd h4 hvw + · exact h3 + have hgh : g ≠ h := fun e => by + have h3 := (e ▸ hgw : p h = {u, w}).symm.trans hhe + have h4 : u ∈ ({v, w} : Finset Node) := h3 ▸ by simp + simp only [mem_insert, mem_singleton] at h4 + rcases h4 with h4 | h4 + · exact huv h4 + · exact huw h4 + refine ⟨v, u, w, f, g, h, huv.symm, huw, hvw, ?_, ?_, hgf.symm, hgh, hhf.symm, by rw [hfe, + pair_comm], hgw, hhe⟩ + · rw [hZe] + ext x + simp only [mem_insert, mem_singleton] + tauto + · ext e + simp only [mem_insert, mem_singleton] + constructor + · intro he + rcases hpairs e he with h3 | h3 | h3 + · exact .inl (hinj he hf (h3.trans hfe.symm)) + · exact .inr (.inl (hinj he hg (h3.trans hgw.symm))) + · exact .inr (.inr (hinj he hh (h3.trans hhe.symm))) + · rintro (rfl | rfl | rfl) + · exact hf + · exact hg + · exact hh + +section System + +variable [Fintype Arc] [Fintype Cell] (ce : Arc → Cell) (fc : Arc → Face) (ends : Arc → Finset Node) + +open Classical in +/-- `(f, n)` is a change of the class `I`: an edge of `δ(I)` in the proof of (11.1). -/ +def Chg (I : Finset Cell) (f : Face) (n : Node) : Prop := + Odd (markCount univ fc ends (fun a => ce a ∈ I) f n) + +omit [Fintype Cell] in +open Classical in +/-- The changes of a symmetric difference are the symmetric difference of the changes. -/ +theorem chg_symmDiff (I K : Finset Cell) (f : Face) (n : Node) : + Chg ce fc ends (symmDiff I K) f n ↔ ¬ (Chg ce fc ends I f n ↔ Chg ce fc ends K f n) := by + classical + have h : markCount univ fc ends (fun a => ce a ∈ I) f n + markCount univ fc ends (fun a + => ce a ∈ K) f n = + markCount univ fc ends (fun a => ce a ∈ symmDiff I K) f n + 2 * #{a | fc a = f ∧ n ∈ ends a + ∧ ce a ∈ I ∧ ce a ∈ K} := by + simp only [markCount, card_filter, mul_sum, ← sum_add_distrib] + refine sum_congr rfl fun a _ => ?_ + by_cases h1 : fc a = f <;> by_cases h2 : n ∈ ends a <;> by_cases h3 : ce a ∈ I + <;> by_cases h4 : ce a ∈ K <;> simp [h1, h2, h3, h4, mem_symmDiff] + simp only [Chg, Nat.odd_iff] + revert h + generalize markCount univ fc ends (fun a => ce a ∈ I) f n = x + generalize markCount univ fc ends (fun a => ce a ∈ K) f n = y + generalize markCount univ fc ends (fun a => ce a ∈ symmDiff I K) f n = z + generalize #{a | fc a = f ∧ n ∈ ends a ∧ ce a ∈ I ∧ ce a ∈ K} = w + intro h + rcases Nat.mod_two_eq_zero_or_one x with hx | hx <;> rcases Nat.mod_two_eq_zero_or_one y with hy + | hy <;> rcases Nat.mod_two_eq_zero_or_one z with hz | hz <;> + first | (simp [hx, hy, hz]; done) | omega + +open Classical in +/-- The facts on arcs, cells and faces that the proof of Claims (3) and (4) uses. `ti c` is the set +of nodes of the cell `c`. -/ +structure ArcSystem (ti : Cell → Finset Node) (Nd : Finset Node) : Prop where + ends_card : ∀ a, #(ends a) = 2 + ends_sub : ∀ a, ends a ⊆ ti (ce a) + ti_sub : ∀ c, ti c ⊆ Nd + cover : ∀ n ∈ Nd, ∃ c, n ∈ ti c + cell_two : ∀ c, ∀ n ∈ ti c, #{a | ce a = c ∧ n ∈ ends a} = 2 + face_two : ∀ a, ∀ n ∈ ends a, #{b | fc b = fc a ∧ n ∈ ends b} = 2 + empty : ∀ K : Finset Cell, (∀ f n, ¬ Chg ce fc ends K f n) → K = ∅ ∨ K = univ + par : ∀ f g : Face, ∀ u v : Node, f ≠ g → u ≠ v → (∃ a, fc a = f ∧ u ∈ ends a) → (∃ a, fc a = f + ∧ v ∈ ends a) → (∃ a, fc a = g ∧ u ∈ ends a) → (∃ a, fc a = g ∧ v ∈ ends a) → + ∃ c a b, ti c = {u, v} ∧ ce a = c ∧ ce b = c ∧ fc a = f ∧ fc b = g ∧ ends a = {u, v} ∧ ends b + = {u, v} + +variable {ce fc ends} {ti : Cell → Finset Node} {Nd : Finset Node} + +open Classical in +/-- The nodes of a class of cells. -/ +noncomputable def nodesOf (ti : Cell → Finset Node) (I : Finset Cell) : Finset Node := I.biUnion ti + +open Classical in +/-- The nodes with a change of `I` at the face `f`. -/ +noncomputable def chgNodes (ce : Arc → Cell) (fc : Arc → Face) (ends : Arc → Finset Node) + (Nd : Finset Node) (I : Finset Cell) (f : Face) : Finset Node := + {n ∈ Nd | Chg ce fc ends I f n} + +open Classical in +theorem nodesOf_sub (h : ArcSystem ce fc ends ti Nd) (I : Finset Cell) : nodesOf ti I ⊆ Nd := + biUnion_subset.mpr fun c _ => h.ti_sub c + +theorem chg_arcs (h : ArcSystem ce fc ends ti Nd) {I : Finset Cell} {f : Face} {n : Node} + (hc : Chg ce fc ends I f n) : + ∃ a b, fc a = f ∧ fc b = f ∧ n ∈ ends a ∧ n ∈ ends b ∧ ce a ∈ I ∧ ce b ∉ I := by + classical + have hpos := hc.pos + rw [markCount, card_pos] at hpos + obtain ⟨a, ha⟩ := hpos + simp only [mem_filter, mem_univ, true_and] at ha + obtain ⟨ha1, ha2, ha3⟩ := ha + have htot := h.face_two a n ha2 + rw [ha1] at htot + have hsplit : #({b | fc b = f ∧ n ∈ ends b} : Finset Arc) = markCount univ fc ends (fun a + => ce a ∈ I) f n + #{b | fc b = f ∧ n ∈ ends b ∧ ce b ∉ I} := by + simp only [markCount, card_filter, ← sum_add_distrib] + refine sum_congr rfl fun b _ => ?_ + by_cases h1 : fc b = f <;> by_cases h2 : n ∈ ends b <;> by_cases h3 : ce b ∈ I + <;> simp [h1, h2, h3] + obtain ⟨k, hk⟩ := hc + obtain ⟨b, hb⟩ : (({b | fc b = f ∧ n ∈ ends b ∧ ce b ∉ I} : Finset Arc)).Nonempty := by + rw [← card_pos] + omega + simp only [mem_filter, mem_univ, true_and] at hb + obtain ⟨hb1, hb2, hb3⟩ := hb + exact ⟨a, b, ha1, hb1, ha2, hb2, ha3, hb3⟩ + +open Classical in +theorem chg_shared (h : ArcSystem ce fc ends ti Nd) {I : Finset Cell} {f : Face} {n : Node} + (hc : Chg ce fc ends I f n) : + n ∈ nodesOf ti I ∩ nodesOf ti Iᶜ := by + classical + obtain ⟨a, b, -, -, ha, hb, hI, hJ⟩ := chg_arcs h hc + exact mem_inter.mpr ⟨mem_biUnion.mpr ⟨_, hI, h.ends_sub a ha⟩, mem_biUnion.mpr ⟨_, mem_compl.mpr + hJ, h.ends_sub b hb⟩⟩ + +open Classical in +theorem chg_mem (h : ArcSystem ce fc ends ti Nd) {I : Finset Cell} {f : Face} {n : Node} + (hc : Chg ce fc ends I f n) : n ∈ Nd := + nodesOf_sub h I (mem_inter.mp (chg_shared h hc)).1 + +open Classical in +/-- Two different arcs of a face at a node with a change have cells in different classes. -/ +theorem cells_differ (h : ArcSystem ce fc ends ti Nd) {I : Finset Cell} {f : Face} {n : Node} {a b + : Arc} (hc : Chg ce fc ends I f n) (ha : fc a = f) (hb : fc b = f) + (han : n ∈ ends a) (hbn : n ∈ ends b) (hab : a ≠ b) : ¬ (ce a ∈ I ↔ ce b ∈ I) := by + classical + intro hiff + have htot := h.face_two a n han + rw [ha] at htot + have hset : ({x | fc x = f ∧ n ∈ ends x} : Finset Arc) = {a, b} := by + refine (eq_of_subset_of_card_le ?_ ?_).symm + · intro x hx + simp only [mem_insert, mem_singleton] at hx + rcases hx with rfl | rfl + · exact mem_filter.mpr ⟨mem_univ _, ha, han⟩ + · exact mem_filter.mpr ⟨mem_univ _, hb, hbn⟩ + · rw [htot, card_pair hab] + have hm : Even (markCount univ fc ends (fun a => ce a ∈ I) f n) := by + by_cases hI : ce a ∈ I + · have h2 : markCount univ fc ends (fun a => ce a ∈ I) f n = 2 := by + rw [markCount] + refine (congrArg card (?_ : _ = ({a, b} : Finset Arc))).trans (card_pair hab) + rw [← hset] + ext x + simp only [mem_filter, mem_univ, true_and] + constructor + · exact fun h => ⟨h.1, h.2.1⟩ + · intro hx + have hx' : x ∈ ({a, b} : Finset Arc) := hset ▸ mem_filter.mpr ⟨mem_univ _, hx.1, hx.2⟩ + simp only [mem_insert, mem_singleton] at hx' + rcases hx' with rfl | rfl + · exact ⟨hx.1, hx.2, hI⟩ + · exact ⟨hx.1, hx.2, hiff.mp hI⟩ + rw [h2] + exact even_two + · have h2 : markCount univ fc ends (fun a => ce a ∈ I) f n = 0 := by + rw [markCount] + refine (congrArg card (?_ : _ = (∅ : Finset Arc))).trans card_empty + ext x + simp only [mem_filter, mem_univ, true_and, notMem_empty, iff_false] + rintro ⟨h1, h2, h3⟩ + have hx' : x ∈ ({a, b} : Finset Arc) := hset ▸ mem_filter.mpr ⟨mem_univ _, h1, h2⟩ + simp only [mem_insert, mem_singleton] at hx' + rcases hx' with rfl | rfl + · exact hI h3 + · exact hI (hiff.mpr h3) + rw [h2] + exact Even.zero + exact (Nat.not_even_iff_odd.mpr hc) hm + +omit [Fintype Cell] in +open Classical in +/-- Two arcs of a face at a node with cells in different classes make a change there. -/ +theorem chg_of_differ (htwo : ∀ a, ∀ n ∈ ends a, #{b | fc b = fc a ∧ n ∈ ends b} + = 2) {I : Finset Cell} {f : Face} {n : Node} {a b : Arc} (ha : fc a = f) (hb : fc b = f) + (han : n ∈ ends a) (hbn : n ∈ ends b) (hab : a ≠ b) (hd : ¬ (ce a ∈ I ↔ ce b ∈ I)) : Chg ce fc + ends I f n := by + classical + have htot := htwo a n han + rw [ha] at htot + have hset : ({x | fc x = f ∧ n ∈ ends x} : Finset Arc) = {a, b} := by + refine (eq_of_subset_of_card_le ?_ ?_).symm + · intro x hx + simp only [mem_insert, mem_singleton] at hx + rcases hx with rfl | rfl + · exact mem_filter.mpr ⟨mem_univ _, ha, han⟩ + · exact mem_filter.mpr ⟨mem_univ _, hb, hbn⟩ + · rw [htot, card_pair hab] + have hmem : ∀ x, fc x = f → n ∈ ends x → x = a ∨ x = b := fun x h1 h2 => by + have hx' : x ∈ ({a, b} : Finset Arc) := hset ▸ mem_filter.mpr ⟨mem_univ _, h1, h2⟩ + simpa using hx' + have hone : markCount univ fc ends (fun a => ce a ∈ I) f n = 1 := by + rw [markCount] + by_cases hI : ce a ∈ I + · refine (congrArg card (?_ : _ = ({a} : Finset Arc))).trans (card_singleton _) + ext x + simp only [mem_filter, mem_univ, true_and, mem_singleton] + constructor + · rintro ⟨h1, h2, h3⟩ + rcases hmem x h1 h2 with rfl | rfl + · rfl + · exact absurd (iff_of_true hI h3) hd + · rintro rfl + exact ⟨ha, han, hI⟩ + · have hJ : ce b ∈ I := by + by_contra hJ + exact hd (iff_of_false hI hJ) + refine (congrArg card (?_ : _ = ({b} : Finset Arc))).trans (card_singleton _) + ext x + simp only [mem_filter, mem_univ, true_and, mem_singleton] + constructor + · rintro ⟨h1, h2, h3⟩ + rcases hmem x h1 h2 with rfl | rfl + · exact absurd h3 hI + · rfl + · rintro rfl + exact ⟨hb, hbn, hJ⟩ + rw [Chg, hone] + exact odd_one + +open Classical in +/-- The arcs of a cell with two nodes are the two arcs given. -/ +theorem arcs_of_cell (h : ArcSystem ce fc ends ti Nd) {c : Cell} {u v : Node} {a b : Arc} + (ht : ti c = {u, v}) (ha : ce a = c) (hb : ce b = c) (hae : ends a = {u, v}) (hbe : ends b + = {u, v}) + (hab : a ≠ b) (x : Arc) (hx : ce x = c) : x = a ∨ x = b := by + classical + have hu : u ∈ ti c := by simp [ht] + have htot := h.cell_two c u hu + have hset : ({x | ce x = c ∧ u ∈ ends x} : Finset Arc) = {a, b} := by + refine (eq_of_subset_of_card_le ?_ ?_).symm + · intro y hy + simp only [mem_insert, mem_singleton] at hy + rcases hy with rfl | rfl + · exact mem_filter.mpr ⟨mem_univ _, ha, by simp [hae]⟩ + · exact mem_filter.mpr ⟨mem_univ _, hb, by simp [hbe]⟩ + · rw [htot, card_pair hab] + have hxe : ends x = {u, v} := by + refine eq_of_subset_of_card_le (ht ▸ hx ▸ h.ends_sub x) ?_ + rw [h.ends_card x] + exact card_le_two + have hm : x ∈ ({a, b} : Finset Arc) := hset ▸ mem_filter.mpr ⟨mem_univ _, hx, by simp [hxe]⟩ + simpa using hm + +theorem mem_chgNodes (h : ArcSystem ce fc ends ti Nd) {I : Finset Cell} {f : Face} {n : Node} : n ∈ + chgNodes ce fc ends Nd I f ↔ Chg ce fc ends I f n := by + classical + simp only [chgNodes, mem_filter, and_iff_right_iff_imp] + exact chg_mem h + +open Classical in +theorem chgNodes_card (h : ArcSystem ce fc ends ti Nd) {I : Finset Cell} + (hZ : #(nodesOf ti I ∩ nodesOf ti Iᶜ) ≤ 3) (f : Face) : + chgNodes ce fc ends Nd I f ⊆ nodesOf ti I ∩ nodesOf ti Iᶜ ∧ (#(chgNodes ce fc ends Nd I f) = 0 + ∨ #(chgNodes ce fc ends Nd I f) = 2) := by + classical + have hsub : chgNodes ce fc ends Nd I f ⊆ nodesOf ti I ∩ nodesOf ti Iᶜ := fun n hn => chg_shared h + ((mem_chgNodes h).mp hn) + have hev : Even #(chgNodes ce fc ends Nd I f) := by + have := even_face univ fc ends (fun a => ce a ∈ I) f Nd fun a _ _ => ⟨(h.ends_sub a).trans + (h.ti_sub _), h.ends_card a⟩ + convert this using 2 + ext n + rw [mem_filter, chgNodes, mem_filter] + rfl + have hle := (card_le_card hsub).trans hZ + obtain ⟨k, hk⟩ := hev + exact ⟨hsub, by omega⟩ + +variable (ce fc ends Nd) in +open Classical in +/-- The faces with a change of `I`. -/ +noncomputable def chgFaces (I : Finset Cell) : Finset Face := + {f ∈ univ.image fc | (chgNodes ce fc ends Nd I f).Nonempty} + +theorem mem_chgFaces (h : ArcSystem ce fc ends ti Nd) {I : Finset Cell} {f : Face} : f ∈ chgFaces + ce fc ends Nd I ↔ (chgNodes ce fc ends Nd I f).Nonempty := by + classical + simp only [chgFaces, mem_filter, and_iff_right_iff_imp] + rintro ⟨n, hn⟩ + obtain ⟨a, -, ha, -⟩ := chg_arcs h ((mem_chgNodes h).mp hn) + exact mem_image.mpr ⟨a, mem_univ _, ha⟩ + +open Classical in +theorem even_at_node (h : ArcSystem ce fc ends ti Nd) (I : Finset Cell) {n : Node} (_hn : n ∈ Nd) : + Even #{f ∈ chgFaces ce fc ends Nd I | n ∈ chgNodes ce fc ends Nd I f} := by + classical + have hc : ∀ c ∈ (univ : Finset Cell), Even #{a ∈ (univ : Finset Arc) | ce a = c ∧ n ∈ ends a} + := fun c _ => by + by_cases hnc : n ∈ ti c + · have h2 := h.cell_two c n hnc + have h3 : Even #({a | ce a = c ∧ n ∈ ends a} : Finset Arc) := h2 ▸ even_two + convert h3 + · have h0 : ({a ∈ (univ : Finset Arc) | ce a = c ∧ n ∈ ends a}) = ∅ := by + ext a + simp only [mem_filter, mem_univ, true_and, notMem_empty, iff_false] + rintro ⟨rfl, h2⟩ + exact hnc (h.ends_sub a h2) + rw [h0] + simp + have := even_node univ fc ce ends (· ∈ I) (univ.image fc) univ n (fun a _ => mem_image_of_mem fc + (mem_univ a)) (fun a _ => mem_univ _) hc + convert this using 2 + ext f + simp only [mem_filter, mem_chgFaces h, mem_chgNodes h] + constructor + · rintro ⟨h1, h2⟩ + obtain ⟨m, hm⟩ := h1 + exact ⟨(mem_filter.mp (mem_chgFaces h |>.mpr ⟨m, hm⟩)).1, h2⟩ + · rintro ⟨h1, h2⟩ + exact ⟨⟨n, (mem_chgNodes h).mpr h2⟩, h2⟩ + +open Classical in +/-- The arc of a pair of parallel faces at the first face is not that of another pair. -/ +theorem arcs_ne (h : ArcSystem ce fc ends ti Nd) {c c' : Cell} {u v : Node} {a b a' b' : Arc} {e e₁ + e₂ : Face} (ht : ti c = {u, v}) (ha : ce a = c) (hb : ce b = c) (hae : ends a = {u, v}) + (hbe : ends b = {u, v}) + (hfa : fc a = e) (hfb : fc b = e₁) (ha' : ce a' = c') (hb' : ce b' = c') (hfa' : fc a' = e) + (hfb' : fc b' = e₂) (h1 : e ≠ e₁) (h2 : e ≠ e₂) (h3 : e₁ ≠ e₂) : a ≠ a' := by + classical + rintro rfl + have hab : a ≠ b := fun e' => h1 (hfa.symm.trans ((congrArg fc e').trans hfb)) + obtain rfl : c = c' := ha.symm.trans ha' + rcases arcs_of_cell h ht ha hb hae hbe hab b' hb' with rfl | rfl + · exact h2 (hfa.symm.trans hfb') + · exact h3 (hfb.symm.trans hfb') + +open Classical in +/-- Three faces with the same pair of changes cannot exist, by Claim (2): the three cells of the +three pairs would lie in pairwise different classes. -/ +theorem no_three_faces (h : ArcSystem ce fc ends ti Nd) {I : Finset Cell} {f g k : Face} {u v : + Node} (huv : u ≠ v) (hf : chgNodes ce fc ends Nd I f = {u, v}) (hg : chgNodes ce fc ends Nd I g + = {u, v}) + (hk : chgNodes ce fc ends Nd I k = {u, v}) (hfg : f ≠ g) (hfk : f ≠ k) (hgk : g ≠ k) : False + := by + classical + have hch : ∀ {e}, chgNodes ce fc ends Nd I e = {u, v} → Chg ce fc ends I e u + ∧ Chg ce fc ends I e v := fun {e} he => + ⟨(mem_chgNodes h).mp (by simp [he]), (mem_chgNodes h).mp (by simp [he])⟩ + have hon : ∀ {e n}, Chg ce fc ends I e n → ∃ a, fc a = e ∧ n ∈ ends a := fun {e n} hc => by + obtain ⟨a, -, ha, -, han, -⟩ := chg_arcs h hc + exact ⟨a, ha, han⟩ + obtain ⟨hfu, hfv⟩ := hch hf + obtain ⟨hgu, hgv⟩ := hch hg + obtain ⟨hku, hkv⟩ := hch hk + obtain ⟨c₁, a₁, b₁, ht₁, ha₁, hb₁, hfa₁, hfb₁, hae₁, hbe₁⟩ := h.par f g u v hfg huv (hon hfu) + (hon hfv) (hon hgu) (hon hgv) + obtain ⟨c₂, a₂, b₂, ht₂, ha₂, hb₂, hfa₂, hfb₂, hae₂, hbe₂⟩ := h.par f k u v hfk huv (hon hfu) + (hon hfv) (hon hku) (hon hkv) + obtain ⟨c₃, a₃, b₃, ht₃, ha₃, hb₃, hfa₃, hfb₃, hae₃, hbe₃⟩ := h.par g k u v hgk huv (hon hgu) + (hon hgv) (hon hku) (hon hkv) + have hmem : ∀ {a}, ends a = {u, v} → u ∈ ends a := fun {a} he => by simp [he] + have d1 := cells_differ h hfu hfa₁ hfa₂ (hmem hae₁) (hmem hae₂) (arcs_ne h ht₁ ha₁ hb₁ hae₁ hbe₁ + hfa₁ hfb₁ ha₂ hb₂ hfa₂ hfb₂ hfg hfk hgk) + have d2 := cells_differ h hgu hfb₁ hfa₃ (hmem hbe₁) (hmem hae₃) (arcs_ne h ht₁ hb₁ ha₁ hbe₁ hae₁ + hfb₁ hfa₁ ha₃ hb₃ hfa₃ hfb₃ hfg.symm hgk hfk) + have d3 := cells_differ h hku hfb₂ hfb₃ (hmem hbe₂) (hmem hbe₃) (arcs_ne h ht₂ hb₂ ha₂ hbe₂ hae₂ + hfb₂ hfa₂ hb₃ ha₃ hfb₃ hfa₃ hfk.symm hgk.symm hfg) + rw [ha₁, ha₂] at d1 + rw [hb₁, ha₃] at d2 + rw [hb₂, hb₃] at d3 + tauto + +open Classical in +/-- The changes of one cell with two nodes, whose two arcs are on the faces `f` and `g`. -/ +theorem chg_single (h : ArcSystem ce fc ends ti Nd) {c : Cell} {u v : Node} {a b : Arc} {f g : + Face} (ht : ti c = {u, v}) (ha : ce a = c) (hb : ce b = c) (hfa : fc a = f) (hfb : fc b = g) + (hae : ends a = {u, v}) (hbe : ends b = {u, v}) + (hfg : f ≠ g) (e : Face) (n : Node) : Chg ce fc ends {c} e n ↔ (e = f ∨ e = g) ∧ (n = u ∨ n + = v) := by + classical + have hab : a ≠ b := fun e' => hfg (hfa.symm.trans ((congrArg fc e').trans hfb)) + have harcs := arcs_of_cell h ht ha hb hae hbe hab + have hin : ∀ {x}, n ∈ ends x → ends x = {u, v} → n = u ∨ n = v := fun {x} hx he + => by simpa [he] using hx + have hm : ∀ x, (fc x = e ∧ n ∈ ends x ∧ ce x = c) ↔ (x = a ∧ e = f ∧ (n = u ∨ n = v)) ∨ (x = b + ∧ e = g ∧ (n = u ∨ n = v)) := fun x => by + constructor + · rintro ⟨h1, h2, h3⟩ + rcases harcs x h3 with rfl | rfl + · exact .inl ⟨rfl, h1.symm.trans hfa, hin h2 hae⟩ + · exact .inr ⟨rfl, h1.symm.trans hfb, hin h2 hbe⟩ + · rintro (⟨rfl, rfl, h2⟩ | ⟨rfl, rfl, h2⟩) + · exact ⟨hfa, by simpa [hae] using h2, ha⟩ + · exact ⟨hfb, by simpa [hbe] using h2, hb⟩ + rw [Chg, markCount] + by_cases hn : n = u ∨ n = v + · by_cases hf : e = f + · have hc : ({x | fc x = e ∧ n ∈ ends x ∧ ce x ∈ ({c} : Finset Cell)} : Finset Arc).card = 1 + := by + refine (congrArg card (?_ : _ = ({a} : Finset Arc))).trans (card_singleton _) + ext x + simp only [mem_filter, mem_univ, true_and, mem_singleton, hm x] + have hne : e ≠ g := hf ▸ hfg + constructor + · rintro (⟨h1, -⟩ | ⟨-, h1, -⟩) + · exact h1 + · exact absurd h1 hne + · exact fun h1 => .inl ⟨h1, hf, hn⟩ + have hc' : Odd (({x | fc x = e ∧ n ∈ ends x ∧ ce x ∈ ({c} : Finset Cell)} : Finset Arc).card) + := hc ▸ odd_one + exact ⟨fun _ => ⟨.inl hf, hn⟩, fun _ => by convert hc'⟩ + · by_cases hg : e = g + · have hc : ({x | fc x = e ∧ n ∈ ends x ∧ ce x ∈ ({c} : Finset Cell)} : Finset Arc).card = 1 + := by + refine (congrArg card (?_ : _ = ({b} : Finset Arc))).trans (card_singleton _) + ext x + simp only [mem_filter, mem_univ, true_and, mem_singleton, hm x] + constructor + · rintro (⟨-, h1, -⟩ | ⟨h1, -⟩) + · exact absurd h1 hf + · exact h1 + · exact fun h1 => .inr ⟨h1, hg, hn⟩ + have hc' : Odd (({x | fc x = e ∧ n ∈ ends x ∧ ce x ∈ ({c} : Finset Cell)} : Finset + Arc).card) := hc ▸ odd_one + exact ⟨fun _ => ⟨.inr hg, hn⟩, fun _ => by convert hc'⟩ + · have hc : ({x | fc x = e ∧ n ∈ ends x ∧ ce x ∈ ({c} : Finset Cell)} : Finset Arc) = ∅ := by + ext x + simp only [mem_filter, mem_univ, true_and, notMem_empty, iff_false, mem_singleton, hm x] + tauto + constructor + · intro hodd + have : Odd (({x | fc x = e ∧ n ∈ ends x ∧ ce x ∈ ({c} : Finset Cell)} : Finset Arc).card) + := by convert hodd + rw [hc] at this + simp at this + · rintro ⟨h3 | h3, -⟩ + · exact absurd h3 hf + · exact absurd h3 hg + · have hc : ({x | fc x = e ∧ n ∈ ends x ∧ ce x ∈ ({c} : Finset Cell)} : Finset Arc) = ∅ := by + ext x + simp only [mem_filter, mem_univ, true_and, notMem_empty, iff_false, mem_singleton, hm x] + tauto + constructor + · intro hodd + have : Odd (({x | fc x = e ∧ n ∈ ends x ∧ ce x ∈ ({c} : Finset Cell)} : Finset Arc).card) + := by convert hodd + rw [hc] at this + simp at this + · rintro ⟨-, h3⟩ + exact absurd h3 hn + +theorem nodesOf_univ (h : ArcSystem ce fc ends ti Nd) : nodesOf ti (univ : Finset Cell) = Nd := by + classical + refine Subset.antisymm (nodesOf_sub h _) fun n hn => ?_ + obtain ⟨c, hc⟩ := h.cover n hn + exact mem_biUnion.mpr ⟨c, mem_univ _, hc⟩ + +variable (ce fc ends Nd ti) in +open Classical in +/-- `δ(I)` is a circuit of length six in the sense of Claim (4): three faces and three nodes in a +triangle. -/ +def IsTri (I : Finset Cell) : Prop := + ∃ x y z f g k, x ≠ y ∧ y ≠ z ∧ x ≠ z ∧ nodesOf ti I ∩ nodesOf ti Iᶜ = {x, y, z} + ∧ chgFaces ce fc ends Nd I = {f, g, k} ∧ f ≠ g ∧ g ≠ k ∧ f ≠ k ∧ + chgNodes ce fc ends Nd I f = {x, y} ∧ chgNodes ce fc ends Nd I g = {y, z} + ∧ chgNodes ce fc ends Nd I k = {x, z} + +open Classical in +/-- **Claim (4) of the proof of (11.1)**, page 191, by induction on the number of faces with +changes. If two faces have the same pair of changes, then the cell of Claim (2) on them is moved to +the other class. This removes these two faces and no others, and adds no shared nodes. The induction +gives a third face with the same pair, against `no_three_faces`. -/ +theorem triangle_of_system (h : ArcSystem ce fc ends ti Nd) : ∀ (m : ℕ) + (I : Finset Cell), #(chgFaces ce fc ends Nd I) = m → nodesOf ti I ≠ Nd → nodesOf ti Iᶜ ≠ Nd → + #(nodesOf ti I ∩ nodesOf ti Iᶜ) ≤ 3 → IsTri ce fc ends ti Nd I := by + classical + intro m + induction m using Nat.strong_induction_on with + | _ m ih => + intro I hm hI hJ hZ + by_cases hinj : Set.InjOn (chgNodes ce fc ends Nd I) (chgFaces ce fc ends Nd I : Set Face) + · have hne : (chgFaces ce fc ends Nd I).Nonempty := by + by_contra hne + have hno : ∀ f n, ¬ Chg ce fc ends I f n := fun f n hc => hne ⟨f, (mem_chgFaces h).mpr ⟨n, + (mem_chgNodes h).mpr hc⟩⟩ + rcases h.empty I hno with rfl | rfl + · exact hJ (by rw [compl_empty, nodesOf_univ h]) + · exact hI (nodesOf_univ h) + have hp : ∀ f ∈ chgFaces ce fc ends Nd I, chgNodes ce fc ends Nd I f ⊆ nodesOf ti I ∩ nodesOf + ti Iᶜ ∧ #(chgNodes ce fc ends Nd I f) = 2 := fun f hf => by + obtain ⟨h1, h2⟩ := chgNodes_card h hZ f + have h3 := card_pos.mpr ((mem_chgFaces h).mp hf) + exact ⟨h1, by omega⟩ + have heven : ∀ n ∈ nodesOf ti I ∩ nodesOf ti Iᶜ, Even #{f ∈ chgFaces ce fc ends Nd I | n ∈ + chgNodes ce fc ends Nd I f} := fun n hn => + even_at_node h I (nodesOf_sub h I (mem_inter.mp hn).1) + obtain ⟨x, y, z, f, g, k, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11⟩ + := exists_triangle _ _ _ hZ hp hinj hne heven + exact ⟨x, y, z, f, g, k, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11⟩ + · exfalso + simp only [Set.InjOn, not_forall] at hinj + obtain ⟨f, hf, g, hg, hEq, hfg⟩ := hinj + have hf' : f ∈ chgFaces ce fc ends Nd I := hf + have hg' : g ∈ chgFaces ce fc ends Nd I := hg + have hcard : #(chgNodes ce fc ends Nd I f) = 2 := by + obtain ⟨-, h2⟩ := chgNodes_card h hZ f + have h3 := card_pos.mpr ((mem_chgFaces h).mp hf') + omega + obtain ⟨u, v, huv, hfe⟩ := card_eq_two.mp hcard + have hge : chgNodes ce fc ends Nd I g = {u, v} := hEq ▸ hfe + have hDf : ∀ n, Chg ce fc ends I f n ↔ n = u ∨ n = v := fun n => by + rw [← mem_chgNodes h, hfe] + simp + have hDg : ∀ n, Chg ce fc ends I g n ↔ n = u ∨ n = v := fun n => by + rw [← mem_chgNodes h, hge] + simp + have hon : ∀ {e n}, Chg ce fc ends I e n → ∃ a, fc a = e ∧ n ∈ ends a := fun {e n} hc => by + obtain ⟨a, -, ha, -, han, -⟩ := chg_arcs h hc + exact ⟨a, ha, han⟩ + have hfu := (hDf u).mpr (.inl rfl) + have hfv := (hDf v).mpr (.inr rfl) + have hgu := (hDg u).mpr (.inl rfl) + have hgv := (hDg v).mpr (.inr rfl) + obtain ⟨c, a, b, ht, ha, hb, hfa, hfb, hae, hbe⟩ := h.par f g u v hfg huv (hon hfu) (hon hfv) + (hon hgu) (hon hgv) + have hS := chg_single h ht ha hb hfa hfb hae hbe hfg + set I' := symmDiff I {c} with hI'def + have hX : ∀ e n, Chg ce fc ends I' e n ↔ ¬ (Chg ce fc ends I e n ↔ ((e = f ∨ e = g) ∧ (n = u + ∨ n = v))) := fun e n => by + rw [hI'def, chg_symmDiff, hS e n] + have hoff : ∀ e, e ≠ f → e ≠ g → chgNodes ce fc ends Nd I' e = chgNodes ce fc ends Nd I e + := fun e h1 h2 => by + ext n + rw [mem_chgNodes h, mem_chgNodes h, hX] + simp [h1, h2] + have hf0 : chgNodes ce fc ends Nd I' f = ∅ := by + ext n + rw [mem_chgNodes h, hX, hDf] + simp only [notMem_empty, iff_false] + tauto + have hg0 : chgNodes ce fc ends Nd I' g = ∅ := by + ext n + rw [mem_chgNodes h, hX, hDg] + simp only [notMem_empty, iff_false] + tauto + have hF : chgFaces ce fc ends Nd I' = ((chgFaces ce fc ends Nd I).erase f).erase g := by + ext e + simp only [mem_erase, mem_chgFaces h] + by_cases h1 : e = f + · subst h1 + simp [hf0] + · by_cases h2 : e = g + · subst h2 + simp [hg0] + · simp [h1, h2, hoff e h1 h2] + have hlt : #(chgFaces ce fc ends Nd I') < m := by + rw [hF, card_erase_of_mem (mem_erase.mpr ⟨fun e => hfg e.symm, hg'⟩), card_erase_of_mem hf', + ← hm] + have := card_pos.mpr ⟨f, hf'⟩ + omega + have hc2 : ∀ x ∈ ti c, x ∈ nodesOf ti I ∩ nodesOf ti Iᶜ := fun x hx => by + have hx' : x = u ∨ x = v := by simpa [ht] using hx + rcases hx' with rfl | rfl + · exact chg_shared h hfu + · exact chg_shared h hfv + have hsub1 : nodesOf ti I' ⊆ nodesOf ti I := fun x hx => by + obtain ⟨c', hc', hxc⟩ := mem_biUnion.mp hx + by_cases e : c' = c + · exact (mem_inter.mp (hc2 x (e ▸ hxc))).1 + · refine mem_biUnion.mpr ⟨c', ?_, hxc⟩ + rcases mem_symmDiff.mp hc' with h3 | h3 + · exact h3.1 + · exact absurd (mem_singleton.mp h3.1) e + have hsub2 : nodesOf ti I'ᶜ ⊆ nodesOf ti Iᶜ := fun x hx => by + obtain ⟨c', hc', hxc⟩ := mem_biUnion.mp hx + by_cases e : c' = c + · exact (mem_inter.mp (hc2 x (e ▸ hxc))).2 + · refine mem_biUnion.mpr ⟨c', mem_compl.mpr fun h3 => ?_, hxc⟩ + exact (mem_compl.mp hc') (mem_symmDiff.mpr (.inl ⟨h3, fun h4 => e (mem_singleton.mp h4)⟩)) + have hI1 : nodesOf ti I' ≠ Nd := fun e => hI (Subset.antisymm (nodesOf_sub h I) (e ▸ hsub1)) + have hJ1 : nodesOf ti I'ᶜ ≠ Nd := fun e => hJ (Subset.antisymm (nodesOf_sub h _) (e ▸ hsub2)) + have hZs : nodesOf ti I' ∩ nodesOf ti I'ᶜ ⊆ nodesOf ti I ∩ nodesOf ti Iᶜ + := inter_subset_inter hsub1 hsub2 + obtain ⟨x, y, z, f', g', k', hxy, hyz, hxz, hZe, hP, hfg', hgk', hfk', hDf', hDg', hDk'⟩ + := ih _ hlt I' rfl hI1 hJ1 ((card_le_card hZs).trans hZ) + have hZeq : nodesOf ti I' ∩ nodesOf ti I'ᶜ = nodesOf ti I ∩ nodesOf ti Iᶜ := by + refine eq_of_subset_of_card_le hZs ?_ + have h3 : #(nodesOf ti I' ∩ nodesOf ti I'ᶜ) = 3 := by + rw [hZe, card_insert_of_notMem (by simp [hxy, hxz]), card_insert_of_notMem + (by simpa using hyz), card_singleton] + omega + have hu : u ∈ ({x, y, z} : Finset Node) := hZe ▸ hZeq ▸ chg_shared h hfu + have hv : v ∈ ({x, y, z} : Finset Node) := hZe ▸ hZeq ▸ chg_shared h hfv + obtain ⟨e, heP, hee⟩ : ∃ e ∈ ({f', g', k'} : Finset Face), chgNodes ce fc ends Nd I' e = {u, v} + := by + simp only [mem_insert, mem_singleton] at hu hv + rcases hu with rfl | rfl | rfl <;> rcases hv with rfl | rfl | rfl <;> + first + | exact absurd rfl huv + | exact ⟨f', by simp, hDf'⟩ + | exact ⟨f', by simp, hDf'.trans (pair_comm _ _)⟩ + | exact ⟨g', by simp, hDg'⟩ + | exact ⟨g', by simp, hDg'.trans (pair_comm _ _)⟩ + | exact ⟨k', by simp, hDk'⟩ + | exact ⟨k', by simp, hDk'.trans (pair_comm _ _)⟩ + have hef : e ≠ f := fun e' => by + have h3 : u ∈ chgNodes ce fc ends Nd I' e := by + rw [hee] + simp + rw [e', hf0] at h3 + simp at h3 + have heg : e ≠ g := fun e' => by + have h3 : u ∈ chgNodes ce fc ends Nd I' e := by + rw [hee] + simp + rw [e', hg0] at h3 + simp at h3 + exact no_three_faces h huv hfe hge ((hoff e hef heg).symm.trans hee) hfg hef.symm heg.symm + +end System + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CellPartitionEnd.lean b/LeanPool/GraphMinor/GM17/CellPartitionEnd.lean new file mode 100644 index 0000000000..b690dbda17 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CellPartitionEnd.lean @@ -0,0 +1,275 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CellPartitionSystem +public import LeanPool.GraphMinor.GM17.ReplaceDisc + +/-! +# The two sides of a curve through three nodes + +This is the last step of the proof of (11.1) of Graph Minors XVII, page 191. The curve `F` is made +of chords of the faces of the circuit `δ(I)`. We show that the cells inside a disc `Δ` bounded by +`F`, or by `F` and a part of `bd(Σ)`, are the class `I` or its complement. +The paper gets this from `U(D)` partitioning the cells. We say it with changes. The class `inside Δ` +of cells in `Δ` has changes at a region exactly where the curve `F` passes through the region: a +chord cuts the frontier into two lines, one in `Δ` and one out of `Δ` (`chord_chg`), and a region +off `F` lies on one side of it (`off_chord_no_chg`). So `I` and `inside Δ` have the same changes at +each region, and their symmetric difference has none. By `trivial_of_region_chg` the two classes are +equal or complementary (`match_of_chg`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface Painting + +attribute [local instance 2000] Classical.decEq Classical.propDecidable + +variable {S : Type} [TopologicalSpace S] [T2Space S] {Γ : Painting S} + +/-- A curve `F` on the boundary of a disc `Δ`, with the rest of the boundary on `bd(Σ)`. -/ +structure DiscData (Γ : Painting S) (F Δ : Set S) : Prop where + disc : IsClosedDisc Δ + closed : IsClosed F + normal : F ∩ Γ.U ⊆ Γ.N + nbhd : ∀ x ∈ Δ \ F, Δ ∈ 𝓝 x + sub : F ⊆ discBd Δ + bdry : discBd Δ ⊆ F ∪ bd S + +/-- A chord of the closure of a region between the nodes `u` and `v`, with the two lines of the +frontier and the two discs. -/ +structure ChordData (Γ : Painting S) (r : Set S) (u v : S) (F C₁ C₂ Δ₁ Δ₂ : Set S) : Prop where + line₁ : IsLineWithEnds C₁ u v + line₂ : IsLineWithEnds C₂ u v + union : C₁ ∪ C₂ = closure r \ r + inter : C₁ ∩ C₂ = {u, v} + chord : IsLineWithEnds F u v + inner : F \ {u, v} ⊆ r + nodes : F ∩ Γ.N = {u, v} + paint : F ∩ Γ.U ⊆ {u, v} + edge : F ∩ bd S ⊆ {u, v} + disc₁ : IsClosedDisc Δ₁ + disc₂ : IsClosedDisc Δ₂ + discs : Δ₁ ∪ Δ₂ = closure r + meet : Δ₁ ∩ Δ₂ = F + bd₁ : discBd Δ₁ = C₁ ∪ F + bd₂ : discBd Δ₂ = C₂ ∪ F + +/-- The class of cells inside a set. -/ +noncomputable def inside (Γ : Painting S) (Δ : Set S) : Finset (CellT Γ) + := open Classical in Finset.univ.filter fun c => c.1 ⊆ Δ + +omit [T2Space S] in +theorem mem_inside {Δ : Set S} {c : CellT Γ} : c ∈ inside Γ Δ ↔ c.1 ⊆ Δ := by simp [inside] + +theorem exists_chordData [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) {r : Set S} {u v : + S} (hr : r ∈ Γ.regions) (hu : u ∈ closure r \ r) (hv : v ∈ closure r \ r) (huN : u ∈ Γ.N) + (hvN : v ∈ Γ.N) (huv : u ≠ v) : + ∃ F C₁ C₂ Δ₁ Δ₂, ChordData Γ r u v F C₁ C₂ Δ₁ Δ₂ := by + obtain ⟨C₁, C₂, hC₁, hC₂, hun, hin⟩ := (h.hreg r hr).2.lines hu hv huv + obtain ⟨F, Δ₁, Δ₂, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11⟩ := chord_of_region hS h hr hC₁ + hC₂ hun hin huN hvN huv + exact ⟨F, C₁, C₂, Δ₁, Δ₂, hC₁, hC₂, hun, hin, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11⟩ + +omit [T2Space S] in +theorem region_off_paint {r : Set S} (hr : r ∈ Γ.regions) {x : S} (hx : x ∈ r) : x ∉ Γ.U := + (arcComponentsIn_subset hr hx).2 + +omit [T2Space S] in +theorem region_off_bd {r : Set S} (hr : r ∈ Γ.regions) {x : S} (hx : x ∈ r) : x ∉ bd S := fun h + => region_off_paint hr hx (Γ.bd_subset h) + +/-- A cell of a gap is in the disc when a point of the gap off the nodes is. -/ +theorem cell_test {F Δ c L : Set S} {u v z : S} (D : DiscData Γ F Δ) (hG : Γ.IsGap c L u v) + (hz : z ∈ L) (hzN : z ∉ Γ.N) : c ⊆ Δ ↔ z ∈ Δ := by + have hzu : z ≠ u := fun e => hzN (e ▸ hG.left_mem_N) + have hzv : z ≠ v := fun e => hzN (e ▸ hG.right_mem_N) + have hzc := hG.mem_cell hz hzu hzv + have hcF : Disjoint c F := disjoint_left.mpr fun x hx hxF => disjoint_left.mp + (Γ.cell_disjoint_N hG.1) hx (D.normal ⟨hxF, Γ.cell_subset_U hG.1 hx⟩) + exact ⟨fun h => h hzc, fun h => cell_in_disc D.disc.isClosed D.closed D.nbhd hG.1 hcF hzc h⟩ + +omit [T2Space S] in +theorem off_curve {F Δ c L : Set S} {u v z : S} (D : DiscData Γ F Δ) (hG : Γ.IsGap c L u v) + (hz : z ∈ L) (hzN : z ∉ Γ.N) : z ∉ F := fun h => hzN (D.normal ⟨h, hG.subset_U hz⟩) + +variable [ConnectedSpace S] + +theorem trivial_of_region_chg (hS : IsSurface S) (h : CellHyps Γ) (K : Finset (CellT Γ)) + (hno : ∀ r ∈ Γ.regions, ∀ n, ¬ Chg cellOf faceOf gapEnds K (closure r \ r) n) : K = ∅ ∨ K + = Finset.univ := by + have := trivial_of_regions hS h (K : Set (CellT Γ)) fun r hr L L' hL hL' => by + simp only [Finset.mem_coe] + exact class_const hS h (hno r hr) (side_faceOf hS h hr hL) (side_faceOf hS h hr hL') + rcases this with h1 | h1 + · exact .inl (Finset.coe_eq_empty.mp h1) + · exact .inr (Finset.coe_eq_univ.mp h1) + +open Classical in +/-- Two classes with the same changes at each region are equal or complementary. -/ +theorem match_of_chg (hS : IsSurface S) (h : CellHyps Γ) (I I₀ : Finset (CellT Γ)) + (hm : ∀ r ∈ Γ.regions, ∀ n, Chg cellOf faceOf gapEnds I (closure r \ r) n ↔ Chg cellOf faceOf + gapEnds I₀ (closure r \ r) n) : I₀ = I ∨ I₀ = Iᶜ := by + rcases trivial_of_region_chg hS h (symmDiff I I₀) fun r hr n hc => by + exact (chg_symmDiff cellOf faceOf gapEnds I I₀ _ n).mp (by convert hc) (hm r hr n) with h1 | h1 + · left + ext c + have := Finset.ext_iff.mp h1 c + simp only [Finset.mem_symmDiff, Finset.notMem_empty, iff_false] at this + tauto + · right + ext c + have := Finset.ext_iff.mp h1 c + simp only [Finset.mem_symmDiff, Finset.mem_univ, iff_true, Finset.mem_compl] at this ⊢ + tauto + +/-- A region off the curve lies on one side of it, so `inside Δ` has no changes there. -/ +theorem off_chord_no_chg (hS : IsSurface S) (h : CellHyps Γ) (sys : ArcSystem cellOf faceOf gapEnds + (cellNodes (Γ := Γ)) Γ.finite_N.toFinset) {r F Δ : Set S} (hr : r ∈ Γ.regions) + (D : DiscData Γ F Δ) (hd : Disjoint r F) (n : S) : + ¬ Chg cellOf faceOf gapEnds (inside Γ Δ) (closure r \ r) n := by + have hW : IsOpen (Δ \ F) := by + rw [isOpen_iff_mem_nhds] + exact fun y hy => Filter.inter_mem (D.nbhd y hy) (D.closed.isOpen_compl.mem_nhds hy.2) + have hpc : IsPreconnected r := (arcComponentsIn_isPathConnected hr).isConnected.isPreconnected + have hcase : ∀ t ∈ r, t ∈ Δ → r ⊆ Δ := fun t ht htΔ => by + have hsub : r ⊆ (Δ \ F) ∪ Δᶜ := fun y hy => by + by_cases h3 : y ∈ Δ + · exact .inl ⟨h3, disjoint_left.mp hd hy⟩ + · exact .inr h3 + exact (hpc.subset_left_of_subset_union hW D.disc.isClosed.isOpen_compl + (disjoint_left.mpr fun y hy hy' => hy' hy.1) hsub ⟨t, ht, htΔ, disjoint_left.mp hd ht⟩).trans + sdiff_subset + have hkey : ∀ g : GapT Γ, faceOf g = closure r \ r → (cellOf g ∈ inside Γ Δ ↔ r ⊆ Δ) := fun g hg + => by + obtain ⟨c, u, v, hs, hcl⟩ := face_side hS h hr hg + obtain ⟨z, hz⟩ := line_inner_nonempty hs.1.2.1 + have hzN : z ∉ Γ.N := hs.1.not_mem_N hz.1 (fun e => hz.2 (.inl e)) (fun e => hz.2 (.inr e)) + rw [mem_inside, cellOf_eq hs.1, cell_test D hs.1 hz.1 hzN] + constructor + · intro hzΔ + obtain ⟨w, hw, hw'⟩ := mem_closure_iff_nhds.mp (hcl hz.1) Δ (D.nbhd z ⟨hzΔ, off_curve D hs.1 + hz.1 hzN⟩) + exact hcase w hw' hw + · exact fun h3 => closure_minimal h3 D.disc.isClosed (hcl hz.1) + intro hc + obtain ⟨a, b, ha, hb, -, -, hI, hJ⟩ := chg_arcs sys hc + exact hJ ((hkey b hb).mpr ((hkey a ha).mp hI)) + +/-- The class `inside Δ` changes at a region cut by a chord of the curve exactly at the two ends of +the chord. The two parts of the region lie on opposite sides of the curve. -/ +theorem chord_chg (hS : IsSurface S) (h : CellHyps Γ) (sys : ArcSystem cellOf faceOf gapEnds + (cellNodes (Γ := Γ)) Γ.finite_N.toFinset) {r F₀ C₁ C₂ Δ₁ Δ₂ F Δ : Set S} {u v : S} + (hr : r ∈ Γ.regions) + (C : ChordData Γ r u v F₀ C₁ C₂ Δ₁ Δ₂) (D : DiscData Γ F Δ) (hsub : F₀ ⊆ F) + (hrF : ∀ x ∈ F, x ∈ r → x ∈ F₀) (huN : u ∈ Γ.N) (hvN : v ∈ Γ.N) (huv : u ≠ v) (n : S) : + Chg cellOf faceOf gapEnds (inside Γ Δ) (closure r \ r) n ↔ n = u ∨ n = v := by + have h2 : discBd Δ ∩ r ⊆ F₀ := fun x hx => (D.bdry hx.1).elim (fun h3 => hrF x h3 hx.2) fun hb => + (region_off_bd hr hx.2 hb).elim + have hside := chord_side hS (h.hopen r hr) C.union.symm C.chord C.inner C.disc₁ C.disc₂ C.discs + C.meet C.bd₁ C.bd₂ D.disc (hsub.trans D.sub) h2 + have hC₁₁ : C₁ ⊆ Δ₁ := fun x hx => discBd_subset _ (C.bd₁ ▸ .inl hx) + have hC₂₂ : C₂ ⊆ Δ₂ := fun x hx => discBd_subset _ (C.bd₂ ▸ .inl hx) + have hnot : ¬ (Δ₁ ⊆ Δ ∧ Δ₂ ⊆ Δ) := by + rintro ⟨h3, h4⟩ + obtain ⟨t, ht⟩ := line_inner_nonempty C.chord + have htr : t ∈ r := C.inner ht + have hi : IsInteriorPoint t := not_not.mp (region_off_bd hr htr) + obtain ⟨w, hw, hw'⟩ := mem_closure_iff.mp (mem_closure_compl (D.sub (hsub ht.1)) hi) r + (h.hopen r hr) htr + have hwc : w ∈ Δ₁ ∪ Δ₂ := C.discs ▸ subset_closure hw + exact hw' (hwc.elim (fun h5 => h3 h5) fun h5 => h4 h5) + have hoff : ∀ {X X' Cx Cx' : Set S}, IsClosedDisc X → X ∪ X' = closure r → X ∩ X' = F₀ → discBd X + = Cx ∪ F₀ → Cx' ⊆ X' → closure r \ r = Cx ∪ Cx' → ∀ z ∈ Cx, z ∉ F → z ∈ Δ → X ⊆ Δ := by + intro X X' Cx Cx' hX hXu hXi hXb hCx' hC z hz hzF hzΔ + have hin : discInt X ⊆ r := fun x hx => by + by_contra h3 + have hx' : x ∈ closure r \ r := ⟨hXu ▸ .inl hx.1, h3⟩ + rw [hC] at hx' + rcases hx' with h4 | h4 + · exact hx.2 (hXb ▸ .inl h4) + · exact hx.2 (hXb ▸ .inr (hXi ▸ ⟨hx.1, hCx' h4⟩)) + have hV : Δ ∩ Fᶜ ∈ 𝓝 z := Filter.inter_mem (D.nbhd z ⟨hzΔ, hzF⟩) + (D.closed.isOpen_compl.mem_nhds hzF) + obtain ⟨w, ⟨hwΔ, hwF⟩, hw⟩ := mem_closure_iff_nhds.mp (hX.subset_closure_discInt + (discBd_subset _ (hXb ▸ .inl hz))) _ hV + have hwr := hin hw + refine chord_part hS D.disc h2 hX hXu hXi hXb hCx' hC hwr (fun h3 => hwF + (hsub h3)) hw.1 ⟨hwΔ, fun h3 => ?_⟩ + exact (D.bdry h3).elim hwF fun hb => region_off_bd hr hwr hb + have hgap : ∀ g : GapT Γ, (g.1 ⊆ C₁ → (cellOf g ∈ inside Γ Δ ↔ Δ₁ ⊆ Δ)) ∧ (g.1 ⊆ C₂ → + (cellOf g ∈ inside Γ Δ ↔ Δ₂ ⊆ Δ)) := fun g => by + obtain ⟨c, a, b, hG⟩ := id g.2 + obtain ⟨z, hz⟩ := line_inner_nonempty hG.2.1 + have hzN : z ∉ Γ.N := hG.not_mem_N hz.1 (fun e => hz.2 (.inl e)) (fun e => hz.2 (.inr e)) + have hzF := off_curve D hG hz.1 hzN + rw [mem_inside, cellOf_eq hG, cell_test D hG hz.1 hzN] + constructor + · intro hs + exact ⟨fun h3 => hoff C.disc₁ C.discs C.meet C.bd₁ hC₂₂ C.union.symm z (hs hz.1) hzF h3, + fun h3 => h3 (hC₁₁ (hs hz.1))⟩ + · intro hs + refine ⟨fun h3 => hoff C.disc₂ (by rw [union_comm, C.discs]) (by rw [inter_comm, C.meet]) + C.bd₂ hC₁₁ (by rw [← C.union, union_comm]) z (hs hz.1) hzF h3, fun h3 => h3 (hC₂₂ + (hs hz.1))⟩ + have hO : Γ.IsFace (closure r \ r) := .inl ⟨r, hr, rfl⟩ + have hOa := (h.hreg r hr).2 + have hsub₁ : C₁ ⊆ closure r \ r := C.union ▸ subset_union_left + have hsub₂ : C₂ ⊆ closure r \ r := C.union ▸ subset_union_right + have huA : u ∈ Γ.N ∩ (closure r \ r) := ⟨huN, hsub₁ C.line₁.left_mem⟩ + have hvA : v ∈ Γ.N ∩ (closure r \ r) := ⟨hvN, hsub₁ C.line₁.right_mem⟩ + have hfin : (Γ.N ∩ (closure r \ r)).Finite := Γ.finite_N.subset inter_subset_left + have harc : ∀ {g : GapT Γ}, faceOf g = closure r \ r → IsArcOf (closure r \ r) (Γ.N ∩ + (closure r \ r)) g.1 := fun {g} hg => by + obtain ⟨c', u', v', hG'⟩ := id g.2 + exact gap_arc_face hG' (hg ▸ (faceOf_spec hS h g).2) + constructor + · intro hc + obtain ⟨a, b, ha, hb, han, hbn, hI, hJ⟩ := chg_arcs sys hc + have hna := (mem_gapEnds.mp han).2 + have hnb := (mem_gapEnds.mp hbn).2 + rcases arc_sub_line hOa huA hvA C.line₁ C.line₂ C.union (harc ha) with h3 | h3 + <;> rcases arc_sub_line hOa huA hvA C.line₁ C.line₂ C.union (harc hb) with h4 | h4 + · exact (hJ (((hgap b).1 h4).mpr (((hgap a).1 h3).mp hI))).elim + · exact C.inter.subset ⟨h3 hna, h4 hnb⟩ + · exact C.inter.subset ⟨h4 hnb, h3 hna⟩ + · exact (hJ (((hgap b).2 h4).mpr (((hgap a).2 h3).mp hI))).elim + · intro hn + have hn₁ : n ∈ C₁ := hn.elim (fun e => e ▸ C.line₁.left_mem) fun e => e ▸ C.line₁.right_mem + have hn₂ : n ∈ C₂ := hn.elim (fun e => e ▸ C.line₂.left_mem) fun e => e ▸ C.line₂.right_mem + have hnN : n ∈ Γ.N := hn.elim (fun e => e ▸ huN) fun e => e ▸ hvN + obtain ⟨L₁, ⟨h3, h4⟩, h5⟩ : n ∈ ⋃₀ {L | IsArcOf (closure r \ r) (Γ.N ∩ (closure r \ r)) L + ∧ L ⊆ C₁} := by + rw [arcs_cover_line hOa hfin inter_subset_right huA hvA huv C.line₁ C.line₂ C.union C.inter] + exact hn₁ + obtain ⟨L₂, ⟨h6, h7⟩, h8⟩ : n ∈ ⋃₀ {L | IsArcOf (closure r \ r) (Γ.N ∩ (closure r \ r)) L + ∧ L ⊆ C₂} := by + rw [arcs_cover_line hOa hfin inter_subset_right huA hvA huv C.line₂ C.line₁ + (by rw [union_comm, C.union]) (by rw [inter_comm, C.inter])] + exact hn₂ + let a : GapT Γ := ⟨L₁, arc_face_gap hS h hO h3⟩ + let b : GapT Γ := ⟨L₂, arc_face_gap hS h hO h6⟩ + have ha : faceOf a = closure r \ r := faceOf_eq hS h hO h3.subset + have hb : faceOf b = closure r \ r := faceOf_eq hS h hO h6.subset + have hab : a ≠ b := by + intro e + have e' : L₁ = L₂ := congrArg Subtype.val e + obtain ⟨c', s, t, hG'⟩ := a.2 + obtain ⟨z, hz⟩ := line_inner_nonempty hG'.2.1 + have hzN : z ∉ Γ.N := hG'.not_mem_N hz.1 (fun e => hz.2 (.inl e)) (fun e => hz.2 (.inr e)) + have hzu : z ∈ ({u, v} : Set S) := C.inter.subset ⟨h4 hz.1, h7 (e' ▸ hz.1)⟩ + exact hzN (hzu.elim (fun e => e ▸ huN) fun e => e ▸ hvN) + refine chg_of_differ (fun a n hn => face_two_gaps hS h a hn) ha hb (mem_gapEnds.mpr ⟨hnN, + h5⟩) (mem_gapEnds.mpr ⟨hnN, h8⟩) hab ?_ + rw [(hgap a).1 h4, (hgap b).2 h7] + tauto + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CellPartitionFace.lean b/LeanPool/GraphMinor/GM17/CellPartitionFace.lean new file mode 100644 index 0000000000..efa9101c01 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CellPartitionFace.lean @@ -0,0 +1,231 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CellPartitionArc +public import LeanPool.GraphMinor.GM17.CellPartitionCount + +/-! +# Faces of a painting + +The proof of (11.1) of Graph Minors XVII, page 190, draws a graph `H` with a vertex for each node +and each region of the painting in the capped surface, where the caps are regions too. +We keep only what is on the boundary of these regions. A *face* is the frontier of a region or a +cuff, and each is an `O`-arc. The gaps of cells are the arcs of `H` between nodes on a face: each +gap +lies on exactly one face (`exists_face`, `face_unique`), and the arcs of a face are gaps +(`arc_face_gap`). Painted regions are finite in number (`finite_regions`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface Painting + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +/-- The hypotheses of (11.1) on regions, cells and nodes. -/ +structure CellHyps (Γ : Painting S) : Prop where + hreg : ∀ R ∈ Γ.regions, IsOpenDisc R ∧ IsOArc (closure R \ R) + h2 : ∀ c ∈ Γ.C, 2 ≤ (tilde c).ncard + hn : ∀ n ∈ Γ.N, ∃ c ∈ Γ.C, n ∈ tilde c + +/-- A face is the frontier of a region or a cuff. -/ +def Painting.IsFace (Γ : Painting S) (O : Set S) : Prop := (∃ r ∈ Γ.regions, O = closure r \ r) + ∨ O ∈ cuffs S + +variable {Γ : Painting S} + +omit [T2Space S] in +theorem CellHyps.hopen (h : CellHyps Γ) : ∀ r ∈ Γ.regions, IsOpen r := fun r hr => (h.hreg r hr).1.1 + +omit [T2Space S] in +theorem CellHyps.two (h : CellHyps Γ) : ∀ c ∈ Γ.C, ∃ a ∈ tilde c, ∃ b ∈ tilde c, a ≠ b := fun c hc + => by + have hfin := Γ.finite_tilde_cell hc + have h1 : 1 < (tilde c).ncard := h.h2 c hc + exact (one_lt_ncard hfin).mp h1 + +theorem side_of_frontier [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) {r L c : Set S} {u + v : S} (hr : r ∈ Γ.regions) (hL : Γ.IsGap c L u v) (hsub : L ⊆ closure r \ r) : Γ.SideOf r L := by + have hcS : CompactSpace S := hS.1 + obtain ⟨z, hz⟩ := line_inner_nonempty hL.2.1 + have hzN : z ∉ Γ.N := hL.not_mem_N hz.1 (fun e => hz.2 (.inl e)) (fun e => hz.2 (.inr e)) + obtain ⟨L', hs, hz'⟩ := frontier_region hS h.hopen h.two hr (hsub hz.1).1 (hsub hz.1).2 hzN + obtain ⟨c', u', v', hs', hcl⟩ := id hs + obtain ⟨-, rfl⟩ := hL.unique hs'.1 hz.1 hz' hzN + exact hs + +/-- The boundary line of a border cell is a gap. -/ +theorem border_gap (hS : IsSurface S) {c : Set S} (hc : c ∈ Γ.C) (hbd : + (c ∩ bd S).Nonempty) : ∃ u v, Γ.IsGap c (closure c ∩ bd S) u v := by + obtain ⟨u, v, O, ht, hB, -, hd, -, -, -, -⟩ := border_side hS hc hbd + refine ⟨u, v, hc, hB, hd ▸ subset_union_left, ?_⟩ + ext x + constructor + · rintro ⟨hx, hxN⟩ + have : x ∈ tilde c := ⟨hx.1, fun h => disjoint_left.mp (Γ.cell_disjoint_N hc) h hxN⟩ + exact ht ▸ this + · rintro (rfl | rfl) + · exact ⟨hB.left_mem, Γ.tilde_subset_N hc (ht ▸ .inl rfl)⟩ + · exact ⟨hB.right_mem, Γ.tilde_subset_N hc (ht ▸ .inr rfl)⟩ + +theorem gap_or_border (hS : IsSurface S) {c L : Set S} {u v : S} (hL : Γ.IsGap c L u v) : Γ.IsSide + c L u v ∨ L = closure c ∩ bd S := by + by_cases hd : Disjoint (L \ {u, v}) (bd S) + · exact .inl ⟨hL, hd⟩ + · obtain ⟨x, hx, hxb⟩ := not_disjoint_iff.mp hd + have hxN : x ∉ Γ.N := hL.not_mem_N hx.1 (fun e => hx.2 (.inl e)) (fun e => hx.2 (.inr e)) + have hxc : x ∈ c := hL.mem_cell hx.1 (fun e => hx.2 (.inl e)) (fun e => hx.2 (.inr e)) + obtain ⟨u', v', hB⟩ := border_gap hS hL.1 ⟨x, hxc, hxb⟩ + exact .inr (hL.unique hB hx.1 ⟨subset_closure hxc, hxb⟩ hxN).2 + +omit [T2Space S] in +theorem cuff_eq {Θ Θ' : Set S} (hΘ : Θ ∈ cuffs S) (hΘ' : Θ' ∈ cuffs S) {x : S} (hx : x ∈ Θ) + (hx' : x ∈ Θ') : Θ = Θ' := by + obtain ⟨a, -, rfl⟩ := hΘ + obtain ⟨b, -, rfl⟩ := hΘ' + rw [connectedComponentIn_eq hx, connectedComponentIn_eq hx'] + +omit [T2Space S] in +theorem cuff_subset {Θ : Set S} (hΘ : Θ ∈ cuffs S) : Θ ⊆ bd S := by + obtain ⟨a, -, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + +/-- Each gap lies on a face. -/ +theorem exists_face [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) {c L : Set S} {u v : S} + (hL : Γ.IsGap c L u v) : ∃ O, Γ.IsFace O ∧ L ⊆ O := by + have hcS : CompactSpace S := hS.1 + rcases gap_or_border hS hL with hs | rfl + · obtain ⟨-, -, r, -, -, -, -, -, -, -, hr, -, hLr, -⟩ := + side_strip hS h.hopen hs isClosed_empty (by simp) + refine ⟨closure r \ r, .inl ⟨r, hr, rfl⟩, fun x hx => ⟨hLr hx, fun hxr => ?_⟩⟩ + exact (arcComponentsIn_subset hr hxr).2 (hL.subset_U hx) + · refine ⟨connectedComponentIn (bd S) u, .inr ⟨u, ?_, rfl⟩, ?_⟩ + · exact (hL.2.1.left_mem).2 + · exact (line_preconnected hL.2.1).subset_connectedComponentIn hL.2.1.left_mem + inter_subset_right + +omit [T2Space S] in +theorem side_off_bd {c L : Set S} {u v z : S} (hs : Γ.IsSide c L u v) (hz : z ∈ L) + (hzN : z ∉ Γ.N) : z ∉ bd S := fun hb => by + refine disjoint_left.mp hs.2 ⟨hz, ?_⟩ hb + rintro (rfl | rfl) + · exact hzN hs.1.left_mem_N + · exact hzN hs.1.right_mem_N + +/-- A gap lies on just one face. -/ +theorem face_unique [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) {c L O O' : Set S} {u + v + : S} (hL : Γ.IsGap c L u v) (hO : Γ.IsFace O) (hO' : Γ.IsFace O') (hs : L ⊆ O) (hs' : L ⊆ O') : O + = O' := by + have hcS : CompactSpace S := hS.1 + obtain ⟨z, hz⟩ := line_inner_nonempty hL.2.1 + have hzN : z ∉ Γ.N := hL.not_mem_N hz.1 (fun e => hz.2 (.inl e)) (fun e => hz.2 (.inr e)) + have hcross : ∀ {r Θ : Set S}, r ∈ Γ.regions → L ⊆ closure r \ r → Θ ∈ cuffs S → L ⊆ Θ → False + := fun {r Θ} hr hsub hΘ hsub' => by + obtain ⟨c', u', v', hsd, -⟩ := side_of_frontier hS h hr hL hsub + have hzL : z ∈ L := hz.1 + exact side_off_bd hsd hzL hzN (cuff_subset hΘ (hsub' hz.1)) + rcases hO with ⟨r, hr, rfl⟩ | hO <;> rcases hO' with ⟨r', hr', rfl⟩ | hO' + · rw [SideOf.unique hS h.hopen hr hr' (side_of_frontier hS h hr hL hs) + (side_of_frontier hS h hr' hL hs')] + · exact (hcross hr hs hO' hs').elim + · exact (hcross hr' hs' hO hs).elim + · exact cuff_eq hO hO' (hs hz.1) (hs' hz.1) + +omit [T2Space S] in +/-- A face is an `O`-arc. -/ +theorem face_oarc (hS : IsSurface S) (h : CellHyps Γ) {O : Set S} (hO : Γ.IsFace O) : IsOArc O := by + rcases hO with ⟨r, hr, rfl⟩ | hO + · exact (h.hreg r hr).2 + · exact (cuff_statement S hS).2.2 O hO + +omit [T2Space S] in +/-- A gap is an arc of the boundary of its cell, marked by the nodes of the cell. -/ +theorem gap_arc_cell {c L : Set S} {u v : S} (hL : Γ.IsGap c L u v) : IsArcOf (discBd (closure c)) + (tilde c) L := by + refine ⟨u, v, hL.2.1, hL.2.2.1, ?_⟩ + rw [← hL.2.2.2, ← Γ.closure_cell_inter_N hL.1] + ext z + exact ⟨fun h => ⟨h.1, h.2.2⟩, fun h => ⟨h.1, hL.subset_closure h.1, h.2⟩⟩ + +omit [T2Space S] in +theorem arc_cell_gap {c L : Set S} (hc : c ∈ Γ.C) (hL : IsArcOf (discBd (closure c)) + (tilde c) L) : ∃ u v, Γ.IsGap c L u v := by + obtain ⟨u, v, h1, h2, h3⟩ := hL + refine ⟨u, v, hc, h1, h2, ?_⟩ + rw [← h3, ← Γ.closure_cell_inter_N hc] + ext z + exact ⟨fun h => ⟨h.1, discBd_subset _ (h2 h.1), h.2⟩, fun h => ⟨h.1, h.2.2⟩⟩ + +omit [T2Space S] in +/-- A gap on a face is an arc of the face, marked by the nodes on the face. -/ +theorem gap_arc_face {c L O : Set S} {u v : S} (hL : Γ.IsGap c L u v) (hs : L ⊆ O) : IsArcOf O + (Γ.N ∩ O) L := by + refine ⟨u, v, hL.2.1, hs, ?_⟩ + rw [← hL.2.2.2] + ext z + exact ⟨fun h => ⟨h.1, h.2.1⟩, fun h => ⟨h.1, h.2, hs h.1⟩⟩ + +/-- An arc of a face is a gap. For a region this is `frontier_region`. For a cuff, a point of the +arc off the nodes lies on a border cell, whose boundary line is a gap on the same cuff. -/ +theorem arc_face_gap [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) {O L : Set S} + (hO : Γ.IsFace O) (hL : IsArcOf O (Γ.N ∩ O) L) : ∃ c u v, Γ.IsGap c L u v := by + have hcS : CompactSpace S := hS.1 + have hOA := face_oarc hS h hO + obtain ⟨u, v, h1, h2, h3⟩ := id hL + obtain ⟨z, hz⟩ := line_inner_nonempty h1 + have hzN : z ∉ Γ.N := fun hN => hz.2 (h3.subset ⟨hz.1, hN, h2 hz.1⟩) + have hzA : z ∉ Γ.N ∩ O := fun e => hzN e.1 + rcases hO with ⟨r, hr, rfl⟩ | hO + · obtain ⟨L', ⟨c', u', v', hs, hcl⟩, hz'⟩ := + frontier_region hS h.hopen h.two hr (h2 hz.1).1 (h2 hz.1).2 hzN + have hsub : L' ⊆ closure r \ r := fun x hx => ⟨hcl hx, fun hxr => + (arcComponentsIn_subset hr hxr).2 (hs.1.subset_U hx)⟩ + rw [arcOf_eq hOA hL (gap_arc_face hs.1 hsub) hz.1 hz' hzA] + exact ⟨c', u', v', hs.1⟩ + · have hzb := cuff_subset hO (h2 hz.1) + have hzU : z ∈ Γ.U := Γ.bd_subset hzb + obtain ⟨c, hc, hzc⟩ : ∃ c ∈ Γ.C, z ∈ c := by + have := Γ.U_eq_N_union_cells ▸ hzU + rcases this with h4 | h4 + · exact absurd h4 hzN + · exact h4 + obtain ⟨u', v', hB⟩ := border_gap hS hc ⟨z, hzc, hzb⟩ + have hsub : closure c ∩ bd S ⊆ O := by + obtain ⟨a, -, rfl⟩ := id hO + have hzC : z ∈ connectedComponentIn (bd S) a := h2 hz.1 + rw [connectedComponentIn_eq hzC] + exact (line_preconnected hB.2.1).subset_connectedComponentIn ⟨subset_closure hzc, + hzb⟩ inter_subset_right + rw [arcOf_eq hOA hL (gap_arc_face hB hsub) hz.1 ⟨subset_closure hzc, hzb⟩ hzA] + exact ⟨c, u', v', hB⟩ + +/-- Every region has a side, since its frontier is an `O`-arc, which is infinite. -/ +theorem region_side [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) {r : Set S} + (hr : r ∈ Γ.regions) : ∃ L, Γ.SideOf r L := by + have hcS : CompactSpace S := hS.1 + obtain ⟨y, hy, hyN⟩ := ((infinite_of_isOArc (h.hreg r hr).2).sdiff Γ.finite_N).nonempty + obtain ⟨L, hL, -⟩ := frontier_region hS h.hopen h.two hr hy.1 hy.2 hyN + exact ⟨L, hL⟩ + +theorem finite_regions [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) : Γ.regions.Finite + := by + have hcS : CompactSpace S := hS.1 + have hsub : Γ.regions ⊆ ⋃ L ∈ {L | ∃ c u v, Γ.IsGap c L u v}, {r | r ∈ Γ.regions ∧ Γ.SideOf r L} + := fun r hr => by + obtain ⟨L, hL⟩ := region_side hS h hr + obtain ⟨c, u, v, hs, -⟩ := id hL + exact mem_biUnion (x := L) ⟨c, u, v, hs.1⟩ ⟨hr, hL⟩ + refine (Γ.finite_gaps.biUnion fun L _ => ?_).subset hsub + exact Set.Subsingleton.finite fun r hr r' hr' => SideOf.unique hS h.hopen hr.1 hr'.1 hr.2 hr'.2 + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CellPartitionMain.lean b/LeanPool/GraphMinor/GM17/CellPartitionMain.lean new file mode 100644 index 0000000000..30caa8bf3a --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CellPartitionMain.lean @@ -0,0 +1,536 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CellPartitionEnd +public import LeanPool.GraphMinor.GM17.Section11 + +/-! +# (11.1) of Graph Minors XVII for paintings + +`cellPartitionPainting` proves `CellPartitionPaintingStatement`, which is (11.1) of Graph Minors +XVII with Claims (1)-(4), pages 189-191, for paintings without portrayals. The route is the paper's. +Claim (4), in `triangle_of_system`, gives three faces and three nodes in a triangle. At most one of +the faces is a cuff, as cuffs are disjoint. +This is the case split at the end of the paper's proof. If all three are regions, then three chords +make an `O`-arc (`tri_regions`). If one is a cuff and the third node is not on `bd(Σ)`, then two +chords make an `I`-arc (`tri_cuff`). If one is a cuff and the third node is on `bd(Σ)`, +then each chord cuts off one cell by (8.3). These two cells are a class, so the other class has all +nodes, against the hypothesis. This is the paper's Case 3. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface Painting + +attribute [local instance 2000] Classical.decEq Classical.propDecidable + +variable {S : Type} [TopologicalSpace S] [T2Space S] {Γ : Painting S} + +/-- The facts on arcs of a painting. -/ +abbrev PSys (Γ : Painting S) : Prop := ArcSystem cellOf faceOf gapEnds (cellNodes (Γ + := Γ)) Γ.finite_N.toFinset + +/-- The changes of a class of cells of a painting. -/ +abbrev Ch (I : Finset (CellT Γ)) (O : Set S) (n : S) : Prop := Chg cellOf faceOf gapEnds I O n + +open Classical in +/-- The conclusion of (11.1) for a class `I`, with the shared nodes `Z`. -/ +def Concl (Γ : Painting S) (I : Finset (CellT Γ)) (Z : Set S) : Prop := + (∃ F, IsOArc F ∧ Γ.IsNormal F ∧ Γ.N ∩ F = Z ∧ ∀ Δ, IsClosedDisc Δ → discBd Δ = F → inside Γ Δ = I + ∨ inside Γ Δ = Iᶜ) ∨ + (∃ F n₁ n₂, IsLineWithEnds F n₁ n₂ ∧ Γ.IsNormal F ∧ F ∩ bd S = {n₁, n₂} ∧ Γ.N ∩ F = Z + ∧ ∀ Δ, IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd S → inside Γ Δ = I ∨ inside Γ Δ = Iᶜ) + +variable [ConnectedSpace S] + +theorem frontier_inj (hS : IsSurface S) (h : CellHyps Γ) {r r' : Set S} (hr : r ∈ Γ.regions) + (hr' : r' ∈ Γ.regions) (e : closure r \ r = closure r' \ r') : r = r' := by + have hcS : CompactSpace S := hS.1 + obtain ⟨L, hL⟩ := region_side hS h hr + obtain ⟨c, u, v, hs, hcl⟩ := id hL + have hsub : L ⊆ closure r \ r := fun x hx => ⟨hcl hx, fun hxr => region_off_paint hr hxr + (hs.1.subset_U hx)⟩ + exact SideOf.unique hS h.hopen hr hr' hL (side_of_frontier hS h hr' hs.1 (e ▸ hsub)) + +theorem region_ne_cuff (hS : IsSurface S) (h : CellHyps Γ) {r Θ : Set S} (hr : r ∈ Γ.regions) + (hΘ : Θ ∈ cuffs S) : closure r \ r ≠ Θ := fun e => by + obtain ⟨L, c, u, v, hs, hcl⟩ := region_side hS h hr + obtain ⟨z, hz⟩ := line_inner_nonempty hs.1.2.1 + have hzN : z ∉ Γ.N := hs.1.not_mem_N hz.1 (fun e => hz.2 (.inl e)) (fun e => hz.2 (.inr e)) + have hzf : z ∈ closure r \ r := ⟨hcl hz.1, fun hxr => region_off_paint hr hxr + (hs.1.subset_U hz.1)⟩ + exact side_off_bd hs hz.1 hzN (cuff_subset hΘ (e ▸ hzf)) + +omit [ConnectedSpace S] in +omit [T2Space S] in +theorem chord_off {r r' F C₁ C₂ Δ₁ Δ₂ : Set S} {u v w : S} (hr : r ∈ Γ.regions) + (hr' : r' ∈ Γ.regions) (C : ChordData Γ r u v F C₁ C₂ Δ₁ Δ₂) (hw : w ∈ F) (hw' : w ∈ r') : r' = r + := by + by_cases hs : w ∈ ({u, v} : Set S) + · exact (region_off_paint hr' hw' (Γ.N_subset (C.nodes.ge hs).2)).elim + · exact region_eq hr' hr hw' (C.inner ⟨hw, hs⟩) + +omit [ConnectedSpace S] in +omit [T2Space S] in +theorem chord_meet {r r' F F' C₁ C₂ Δ₁ Δ₂ C₁' C₂' Δ₁' Δ₂' : Set S} {u v u' v' w : S} + (hr : r ∈ Γ.regions) (hr' : r' ∈ Γ.regions) (hne : r ≠ r') (C : ChordData Γ r u v F C₁ C₂ Δ₁ Δ₂) + (C' : ChordData Γ r' u' v' F' C₁' C₂' Δ₁' Δ₂') + (hw : w ∈ F) (hw' : w ∈ F') : w ∈ Γ.N := by + by_cases hs : w ∈ ({u, v} : Set S) + · exact (C.nodes.ge hs).2 + · by_cases hs' : w ∈ ({u', v'} : Set S) + · exact (C'.nodes.ge hs').2 + · exact (hne (region_eq hr hr' (C.inner ⟨hw, hs⟩) (C'.inner ⟨hw', hs'⟩))).elim + +theorem iff_chord (hS : IsSurface S) (h : CellHyps Γ) (sys : PSys Γ) {I : Finset + (CellT Γ)} {r F₀ C₁ C₂ Δ₁ Δ₂ F Δ : Set S} {u v : S} (hr : r ∈ Γ.regions) + (C : ChordData Γ r u v F₀ C₁ C₂ Δ₁ Δ₂) (D : DiscData Γ F Δ) (hsub : F₀ ⊆ F) + (hrF : ∀ x ∈ F, x ∈ r → x ∈ F₀) (huN : u ∈ Γ.N) (hvN : v ∈ Γ.N) (huv : u ≠ v) (hI : ∀ n, Ch I + (closure r \ r) n ↔ n = u ∨ n = v) (n : S) : + Ch I (closure r \ r) n ↔ Ch (inside Γ Δ) (closure r \ r) n := + (hI n).trans (chord_chg hS h sys hr C D hsub hrF huN hvN huv n).symm + +/-- Three regions: three chords make an `O`-arc. -/ +theorem tri_regions (hS : IsSurface S) (h : CellHyps Γ) (sys : PSys Γ) (I : Finset + (CellT Γ)) {r₁ r₂ r₃ : Set S} {x y z : S} (hr₁ : r₁ ∈ Γ.regions) (hr₂ : r₂ ∈ Γ.regions) + (hr₃ : r₃ ∈ Γ.regions) + (h12 : r₁ ≠ r₂) (h23 : r₂ ≠ r₃) (h13 : r₁ ≠ r₃) (hxy : x ≠ y) (hyz : y ≠ z) (hxz : x ≠ z) + (hxN : x ∈ Γ.N) (hyN : y ∈ Γ.N) (hzN : z ∈ Γ.N) + (hx₁ : x ∈ closure r₁ \ r₁) (hy₁ : y ∈ closure r₁ \ r₁) (hy₂ : y ∈ closure r₂ \ r₂) + (hz₂ : z ∈ closure r₂ \ r₂) (hx₃ : x ∈ closure r₃ \ r₃) (hz₃ : z ∈ closure r₃ \ r₃) + (H₁ : ∀ n, Ch I (closure r₁ \ r₁) n ↔ n = x ∨ n = y) (H₂ : ∀ n, Ch I (closure r₂ \ r₂) n ↔ n + = y ∨ n = z) (H₃ : ∀ n, Ch I (closure r₃ \ r₃) n ↔ n = x ∨ n = z) + (Hoth : ∀ e, e ≠ closure r₁ \ r₁ → e ≠ closure r₂ \ r₂ → e ≠ closure r₃ \ r₃ + → ∀ n, ¬ Ch I e n) : Concl Γ I {x, y, z} := by + have hman := hS.2.2 + obtain ⟨F₁, A₁, B₁, D₁, E₁, c₁⟩ := exists_chordData hS h hr₁ hx₁ hy₁ hxN hyN hxy + obtain ⟨F₂, A₂, B₂, D₂, E₂, c₂⟩ := exists_chordData hS h hr₂ hy₂ hz₂ hyN hzN hyz + obtain ⟨F₃, A₃, B₃, D₃, E₃, c₃⟩ := exists_chordData hS h hr₃ hx₃ hz₃ hxN hzN hxz + have hi : F₁ ∩ F₂ = {y} := by + ext w + constructor + · rintro ⟨a, b⟩ + have hN := chord_meet hr₁ hr₂ h12 c₁ c₂ a b + have h3 : w ∈ ({x, y} : Set S) := c₁.nodes ▸ ⟨a, hN⟩ + have h4 : w ∈ ({y, z} : Set S) := c₂.nodes ▸ ⟨b, hN⟩ + rcases h3 with rfl | rfl + · rcases h4 with e | e + · exact (hxy e).elim + · exact (hxz e).elim + · rfl + · rintro rfl + exact ⟨c₁.chord.right_mem, c₂.chord.left_mem⟩ + have hi3 : (F₁ ∪ F₂) ∩ F₃ = {x, z} := by + ext w + constructor + · rintro ⟨a | a, b⟩ + · have hN := chord_meet hr₁ hr₃ h13 c₁ c₃ a b + have h3 : w ∈ ({x, y} : Set S) := c₁.nodes ▸ ⟨a, hN⟩ + have h4 : w ∈ ({x, z} : Set S) := c₃.nodes ▸ ⟨b, hN⟩ + rcases h3 with rfl | rfl + · exact .inl rfl + · exact h4 + · have hN := chord_meet hr₂ hr₃ h23 c₂ c₃ a b + have h3 : w ∈ ({y, z} : Set S) := c₂.nodes ▸ ⟨a, hN⟩ + have h4 : w ∈ ({x, z} : Set S) := c₃.nodes ▸ ⟨b, hN⟩ + rcases h3 with rfl | rfl + · exact h4 + · exact .inr rfl + · rintro (rfl | rfl) + · exact ⟨.inl c₁.chord.left_mem, c₃.chord.left_mem⟩ + · exact ⟨.inr c₂.chord.right_mem, c₃.chord.right_mem⟩ + have hsN : ∀ {a b : S}, a ∈ Γ.N → b ∈ Γ.N → ({a, b} : Set S) ⊆ Γ.N := fun {a b} ha hb w hw + => hw.elim (fun e => e ▸ ha) fun e => e ▸ hb + have hFU : ((F₁ ∪ F₂) ∪ F₃) ∩ Γ.U ⊆ Γ.N := by + rintro w ⟨(a | a) | a, hU⟩ + · exact hsN hxN hyN (c₁.paint ⟨a, hU⟩) + · exact hsN hyN hzN (c₂.paint ⟨a, hU⟩) + · exact hsN hxN hzN (c₃.paint ⟨a, hU⟩) + have hFN : Γ.N ∩ ((F₁ ∪ F₂) ∪ F₃) = {x, y, z} := by + ext w + constructor + · rintro ⟨hN, (a | a) | a⟩ + · exact (c₁.nodes.subset ⟨a, hN⟩).elim .inl fun e => .inr (.inl e) + · exact (c₂.nodes.subset ⟨a, hN⟩).elim (fun e => .inr (.inl e)) fun e => .inr (.inr e) + · exact (c₃.nodes.subset ⟨a, hN⟩).elim .inl fun e => .inr (.inr e) + · rintro (rfl | rfl | rfl) + · exact ⟨hxN, .inl (.inl c₁.chord.left_mem)⟩ + · exact ⟨hyN, .inl (.inl c₁.chord.right_mem)⟩ + · exact ⟨hzN, .inl (.inr c₂.chord.right_mem)⟩ + have hFc : IsClosed ((F₁ ∪ F₂) ∪ F₃) := ((GM19.isClosed_of_cuffLine c₁.chord).union + (GM19.isClosed_of_cuffLine c₂.chord)).union (GM19.isClosed_of_cuffLine c₃.chord) + refine .inl ⟨_, oArc_of_lines (c₁.chord.union c₂.chord hi) c₃.chord hi3, hFU, hFN, + fun Δ hΔ hb => ?_⟩ + have D : DiscData Γ ((F₁ ∪ F₂) ∪ F₃) Δ := ⟨hΔ, hFc, hFU, fun x hx => Filter.mem_of_superset + ((hΔ.isOpen_discInt hman).mem_nhds ⟨hx.1, hb ▸ hx.2⟩) sdiff_subset, hb.ge, hb.le.trans + subset_union_left⟩ + refine match_of_chg hS h I _ fun r hr n => ?_ + by_cases e₁ : r = r₁ + · subst e₁ + refine iff_chord hS h sys hr c₁ D (subset_union_left.trans subset_union_left) ?_ hxN hyN hxy H₁ + n + rintro w ((a | a) | a) hw + · exact a + · exact (h12 (chord_off hr₂ hr c₂ a hw)).elim + · exact (h13 (chord_off hr₃ hr c₃ a hw)).elim + by_cases e₂ : r = r₂ + · subst e₂ + refine iff_chord hS h sys hr c₂ D (subset_union_right.trans subset_union_left) ?_ hyN hzN hyz + H₂ n + rintro w ((a | a) | a) hw + · exact (h12 (chord_off hr₁ hr c₁ a hw).symm).elim + · exact a + · exact (h23 (chord_off hr₃ hr c₃ a hw)).elim + by_cases e₃ : r = r₃ + · subst e₃ + refine iff_chord hS h sys hr c₃ D subset_union_right ?_ hxN hzN hxz H₃ n + rintro w ((a | a) | a) hw + · exact (h13 (chord_off hr₁ hr c₁ a hw).symm).elim + · exact (h23 (chord_off hr₂ hr c₂ a hw).symm).elim + · exact a + have hd : Disjoint r ((F₁ ∪ F₂) ∪ F₃) := disjoint_left.mpr fun w hw ha => by + rcases ha with (a | a) | a + · exact e₁ (chord_off hr₁ hr c₁ a hw) + · exact e₂ (chord_off hr₂ hr c₂ a hw) + · exact e₃ (chord_off hr₃ hr c₃ a hw) + exact iff_of_false (Hoth _ (fun e => e₁ (frontier_inj hS h hr hr₁ e)) (fun e => e₂ + (frontier_inj hS h hr hr₂ e)) (fun e => e₃ (frontier_inj hS h hr hr₃ e)) n) + (off_chord_no_chg hS h sys hr D hd n) + +theorem exists_gap_at (hS : IsSurface S) (h : CellHyps Γ) {O : Set S} {n m : S} (hO : Γ.IsFace O) + (hn : n ∈ O) (hm : m ∈ O) (hnN : n ∈ Γ.N) (hmN : m ∈ Γ.N) (hnm : n ≠ m) : ∃ a : GapT Γ, faceOf a + = O ∧ n ∈ gapEnds a := by + have hfin : (Γ.N ∩ O).Finite := Γ.finite_N.subset inter_subset_left + obtain ⟨-, hcov⟩ := arcOf_family (face_oarc hS h hO) hfin inter_subset_right ⟨hnN, hn⟩ ⟨hmN, hm⟩ + hnm + have hnO : n ∈ ⋃₀ {L | IsArcOf O (Γ.N ∩ O) L} := by + rw [hcov] + exact hn + obtain ⟨L, hL, hnL⟩ := hnO + exact ⟨⟨L, arc_face_gap hS h hO hL⟩, faceOf_eq hS h hO hL.subset, mem_gapEnds.mpr ⟨hnN, hnL⟩⟩ + +/-- Two nodes on the frontier of a region and on `bd(Σ)` are on the same cuff, by (8.3). -/ +theorem same_cuff (hS : IsSurface S) (h : CellHyps Γ) (h83 : Hyp83 Γ) {r : Set S} {x y : S} + (hr : r ∈ Γ.regions) (hx : x ∈ closure r \ r) (hy : y ∈ closure r \ r) (hxN : x ∈ Γ.N) + (hyN : y ∈ Γ.N) (hxy : x ≠ y) (hxb : x ∈ bd S) (hyb : y ∈ bd S) : + ∃ Θ ∈ cuffs S, x ∈ Θ ∧ y ∈ Θ := by + obtain ⟨C₁, C₂, hC₁, hC₂, hun, hin⟩ := (h.hreg r hr).2.lines hx hy hxy + obtain ⟨F, -, -, Δ, hF, hFr, -, -, -, -, -, -, -, hΔ, h1, h2, -, -, -, -⟩ := + exists_chord_disc hS (fun r hr => (h.hreg r hr).1) (fun r hr => (h.hreg r hr).2) h83 hr hC₁ hC₂ + hun hin hxN hyN hxy hxb hyb + have hFb : F ∩ bd S = {x, y} := by + refine Subset.antisymm (fun w hw => by_contra fun h3 => region_off_bd hr (hFr ⟨hw.1, + h3⟩) hw.2) ?_ + rintro w (rfl | rfl) + · exact ⟨hF.left_mem, hxb⟩ + · exact ⟨hF.right_mem, hyb⟩ + obtain ⟨I, I', Θ, hΘ, hI, -, hU, -, -⟩ := arc_disc_data hS hF hFb hΔ h1 h2 + exact ⟨Θ, hΘ, hU ▸ .inl hI.left_mem, hU ▸ .inl hI.right_mem⟩ + +open Classical in +/-- The paper's Case 3: two regions and a cuff, and the third node on `bd(Σ)`. The two cells cut off +by (8.3) have the changes of `I` at each region, so they are `I` or its complement, and the other +class has all nodes. -/ +theorem tri_cuff_bd (hS : IsSurface S) (h : CellHyps Γ) (h83 : Hyp83 Γ) (sys : PSys Γ) (I : Finset + (CellT Γ)) (hI : nodesOf cellNodes I ≠ Γ.finite_N.toFinset) (hJ : nodesOf cellNodes Iᶜ ≠ + Γ.finite_N.toFinset) + {r₁ r₂ Θ : Set S} {x y z : S} (hr₁ : r₁ ∈ Γ.regions) (hr₂ : r₂ ∈ Γ.regions) (hΘ : Θ ∈ cuffs S) + (h12 : r₁ ≠ r₂) (hxy : x ≠ y) (hyz : y ≠ z) (hxN : x ∈ Γ.N) (hyN : y ∈ Γ.N) (hzN : z ∈ Γ.N) + (hx₁ : x ∈ closure r₁ \ r₁) (hy₁ : y ∈ closure r₁ \ r₁) (hy₂ : y ∈ closure r₂ \ r₂) + (hz₂ : z ∈ closure r₂ \ r₂) (hx₃ : x ∈ Θ) (hz₃ : z ∈ Θ) (hyb : y ∈ bd S) + (H₁ : ∀ n, Ch I (closure r₁ \ r₁) n ↔ n = x ∨ n = y) (H₂ : ∀ n, Ch I (closure r₂ \ r₂) n ↔ n + = y ∨ n = z) + (Hoth : ∀ e, e ≠ closure r₁ \ r₁ → e ≠ closure r₂ \ r₂ → e ≠ Θ → ∀ n, ¬ Ch I e n) : False := by + have hxb := cuff_subset hΘ hx₃ + have hneΘ : ∀ {r}, r ∈ Γ.regions → closure r \ r ≠ Θ := fun hr => region_ne_cuff hS h hr hΘ + have hfne : closure r₁ \ r₁ ≠ closure r₂ \ r₂ := fun e => h12 (frontier_inj hS h hr₁ hr₂ e) + obtain ⟨Θ', hΘ', hxΘ, hyΘ⟩ := same_cuff hS h h83 hr₁ hx₁ hy₁ hxN hyN hxy hxb hyb + obtain rfl : Θ' = Θ := cuff_eq hΘ' hΘ hxΘ hx₃ + have hF₁ : Γ.IsFace (closure r₁ \ r₁) := .inl ⟨r₁, hr₁, rfl⟩ + have hF₂ : Γ.IsFace (closure r₂ \ r₂) := .inl ⟨r₂, hr₂, rfl⟩ + have hF₃ : Γ.IsFace Θ' := .inr hΘ + have on : ∀ {O n m}, Γ.IsFace O → n ∈ O → m ∈ O → n ∈ Γ.N → m ∈ Γ.N → n ≠ m → ∃ a, faceOf a = O + ∧ n ∈ gapEnds a := fun hO hn hm hnN hmN hnm => exists_gap_at hS h hO hn hm hnN hmN hnm + obtain ⟨c₁, a₁, b₁, ht₁, ha₁, hb₁, hfa₁, hfb₁, hae₁, hbe₁⟩ := sys.par _ _ x y (hneΘ hr₁) hxy + (on hF₁ hx₁ hy₁ hxN hyN hxy) (on hF₁ hy₁ hx₁ hyN hxN hxy.symm) (on hF₃ hx₃ hyΘ hxN hyN hxy) + (on hF₃ hyΘ hx₃ hyN hxN hxy.symm) + obtain ⟨c₂, a₂, b₂, ht₂, ha₂, hb₂, hfa₂, hfb₂, hae₂, hbe₂⟩ := sys.par _ _ y z (hneΘ hr₂) hyz + (on hF₂ hy₂ hz₂ hyN hzN hyz) (on hF₂ hz₂ hy₂ hzN hyN hyz.symm) (on hF₃ hyΘ hz₃ hyN hzN hyz) + (on hF₃ hz₃ hyΘ hzN hyN hyz.symm) + have S₁ := chg_single sys ht₁ ha₁ hb₁ hfa₁ hfb₁ hae₁ hbe₁ (hneΘ hr₁) + have S₂ := chg_single sys ht₂ ha₂ hb₂ hfa₂ hfb₂ hae₂ hbe₂ (hneΘ hr₂) + let I₀ : Finset (CellT Γ) := symmDiff {c₁} {c₂} + have hsd : ∀ e n, Ch I₀ e n ↔ ¬ (Ch {c₁} e n ↔ Ch {c₂} e n) := fun e n + => chg_symmDiff cellOf faceOf gapEnds {c₁} {c₂} e n + have hm := match_of_chg hS h I I₀ fun r hr n => by + change Ch I _ n ↔ Ch I₀ _ n + rw [hsd] + change _ ↔ ¬ (Chg cellOf faceOf gapEnds {c₁} _ n ↔ Chg cellOf faceOf gapEnds {c₂} _ n) + rw [S₁, S₂] + by_cases e₁ : r = r₁ + · subst e₁ + simp [H₁ n, hneΘ hr, hfne] + tauto + by_cases e₂ : r = r₂ + · subst e₂ + simp [H₂ n, hneΘ hr, hfne.symm] + tauto + have n₁ : closure r \ r ≠ closure r₁ \ r₁ := fun e => e₁ (frontier_inj hS h hr hr₁ e) + have n₂ : closure r \ r ≠ closure r₂ \ r₂ := fun e => e₂ (frontier_inj hS h hr hr₂ e) + simp [Hoth _ n₁ n₂ (hneΘ hr) n, n₁, n₂, hneΘ hr] + have hshared : ∀ m, m = x ∨ m = y ∨ m = z → m ∈ nodesOf cellNodes I ∩ nodesOf cellNodes Iᶜ := by + rintro m (rfl | rfl | rfl) + · exact chg_shared sys ((H₁ _).mpr (.inl rfl)) + · exact chg_shared sys ((H₁ _).mpr (.inr rfl)) + · exact chg_shared sys ((H₂ _).mpr (.inr rfl)) + have hsmall : ∀ c ∈ I₀, ∀ m ∈ cellNodes c, m ∈ nodesOf cellNodes I ∩ nodesOf cellNodes Iᶜ + := fun c hc m hmc => by + have hcc : c = c₁ ∨ c = c₂ := by + rcases Finset.mem_symmDiff.mp hc with h3 | h3 + · exact .inl (Finset.mem_singleton.mp h3.1) + · exact .inr (Finset.mem_singleton.mp h3.1) + refine hshared m ?_ + rcases hcc with rfl | rfl + · rw [ht₁] at hmc + simp only [Finset.mem_insert, Finset.mem_singleton] at hmc + tauto + · rw [ht₂] at hmc + simp only [Finset.mem_insert, Finset.mem_singleton] at hmc + tauto + rcases hm with e | e + · refine hJ (Finset.Subset.antisymm (nodesOf_sub sys _) fun n hn => ?_) + obtain ⟨c, hc⟩ := sys.cover n hn + by_cases hcI : c ∈ I + · exact (Finset.mem_inter.mp (hsmall c (e ▸ hcI) n hc)).2 + · exact Finset.mem_biUnion.mpr ⟨c, Finset.mem_compl.mpr hcI, hc⟩ + · refine hI (Finset.Subset.antisymm (nodesOf_sub sys _) fun n hn => ?_) + obtain ⟨c, hc⟩ := sys.cover n hn + by_cases hcI : c ∈ I + · exact Finset.mem_biUnion.mpr ⟨c, hcI, hc⟩ + · exact (Finset.mem_inter.mp (hsmall c (e ▸ Finset.mem_compl.mpr hcI) n hc)).1 + +open Classical in +/-- Two regions and a cuff. If the third node is off `bd(Σ)`, then two chords make an `I`-arc. The +other case is `tri_cuff_bd`. -/ +theorem tri_cuff (hS : IsSurface S) (h : CellHyps Γ) (h83 : Hyp83 Γ) (sys : PSys Γ) (I : Finset + (CellT Γ)) (hI : nodesOf cellNodes I ≠ Γ.finite_N.toFinset) (hJ : nodesOf cellNodes Iᶜ ≠ + Γ.finite_N.toFinset) + {r₁ r₂ Θ : Set S} {x y z : S} (hr₁ : r₁ ∈ Γ.regions) (hr₂ : r₂ ∈ Γ.regions) (hΘ : Θ ∈ cuffs S) + (h12 : r₁ ≠ r₂) (hxy : x ≠ y) (hyz : y ≠ z) (hxz : x ≠ z) (hxN : x ∈ Γ.N) (hyN : y ∈ Γ.N) + (hzN : z ∈ Γ.N) + (hx₁ : x ∈ closure r₁ \ r₁) (hy₁ : y ∈ closure r₁ \ r₁) (hy₂ : y ∈ closure r₂ \ r₂) + (hz₂ : z ∈ closure r₂ \ r₂) (hx₃ : x ∈ Θ) (hz₃ : z ∈ Θ) + (H₁ : ∀ n, Ch I (closure r₁ \ r₁) n ↔ n = x ∨ n = y) (H₂ : ∀ n, Ch I (closure r₂ \ r₂) n ↔ n + = y ∨ n = z) + (Hoth : ∀ e, e ≠ closure r₁ \ r₁ → e ≠ closure r₂ \ r₂ → e ≠ Θ → ∀ n, ¬ Ch I e n) : Concl Γ I + {x, y, z} := by + have hxb := cuff_subset hΘ hx₃ + have hzb := cuff_subset hΘ hz₃ + have hneΘ : ∀ {r}, r ∈ Γ.regions → closure r \ r ≠ Θ := fun hr => region_ne_cuff hS h hr hΘ + by_cases hyb : y ∈ bd S + · exact (tri_cuff_bd hS h h83 sys I hI hJ hr₁ hr₂ hΘ h12 hxy hyz hxN hyN hzN hx₁ hy₁ hy₂ hz₂ hx₃ + hz₃ hyb H₁ H₂ Hoth).elim + · obtain ⟨F₁, A₁, B₁, D₁, E₁, c₁⟩ := exists_chordData hS h hr₁ hx₁ hy₁ hxN hyN hxy + obtain ⟨F₂, A₂, B₂, D₂, E₂, c₂⟩ := exists_chordData hS h hr₂ hy₂ hz₂ hyN hzN hyz + have hi : F₁ ∩ F₂ = {y} := by + ext w + constructor + · rintro ⟨a, b⟩ + have hN := chord_meet hr₁ hr₂ h12 c₁ c₂ a b + have h3 : w ∈ ({x, y} : Set S) := c₁.nodes ▸ ⟨a, hN⟩ + have h4 : w ∈ ({y, z} : Set S) := c₂.nodes ▸ ⟨b, hN⟩ + rcases h3 with rfl | rfl + · rcases h4 with e | e + · exact (hxy e).elim + · exact (hxz e).elim + · rfl + · rintro rfl + exact ⟨c₁.chord.right_mem, c₂.chord.left_mem⟩ + have hline := c₁.chord.union c₂.chord hi + have hsN : ∀ {a b : S}, a ∈ Γ.N → b ∈ Γ.N → ({a, b} : Set S) ⊆ Γ.N := fun {a b} ha hb w hw + => hw.elim (fun e => e ▸ ha) fun e => e ▸ hb + have hFU : (F₁ ∪ F₂) ∩ Γ.U ⊆ Γ.N := by + rintro w ⟨a | a, hU⟩ + · exact hsN hxN hyN (c₁.paint ⟨a, hU⟩) + · exact hsN hyN hzN (c₂.paint ⟨a, hU⟩) + have hFb : (F₁ ∪ F₂) ∩ bd S = {x, z} := by + ext w + constructor + · rintro ⟨a | a, hb⟩ + · rcases c₁.edge ⟨a, hb⟩ with rfl | rfl + · exact .inl rfl + · exact (hyb hb).elim + · rcases c₂.edge ⟨a, hb⟩ with rfl | rfl + · exact (hyb hb).elim + · exact .inr rfl + · rintro (rfl | rfl) + · exact ⟨.inl c₁.chord.left_mem, hxb⟩ + · exact ⟨.inr c₂.chord.right_mem, hzb⟩ + have hFN : Γ.N ∩ (F₁ ∪ F₂) = {x, y, z} := by + ext w + constructor + · rintro ⟨hN, a | a⟩ + · exact (c₁.nodes.subset ⟨a, hN⟩).elim .inl fun e => .inr (.inl e) + · exact (c₂.nodes.subset ⟨a, hN⟩).elim (fun e => .inr (.inl e)) fun e => .inr (.inr e) + · rintro (rfl | rfl | rfl) + · exact ⟨hxN, .inl c₁.chord.left_mem⟩ + · exact ⟨hyN, .inl c₁.chord.right_mem⟩ + · exact ⟨hzN, .inr c₂.chord.right_mem⟩ + refine .inr ⟨_, x, z, hline, hFU, hFb, hFN, fun Δ hΔ h1 h2 => ?_⟩ + obtain ⟨-, -, -, -, -, -, -, -, -, -, -, hnb⟩ := arc_disc_data hS hline hFb hΔ h1 h2 + have D : DiscData Γ (F₁ ∪ F₂) Δ := ⟨hΔ, (GM19.isClosed_of_cuffLine c₁.chord).union + (GM19.isClosed_of_cuffLine c₂.chord), hFU, hnb, h1, h2⟩ + refine match_of_chg hS h I _ fun r hr n => ?_ + by_cases e₁ : r = r₁ + · subst e₁ + refine iff_chord hS h sys hr c₁ D subset_union_left ?_ hxN hyN hxy H₁ n + rintro w (a | a) hw + · exact a + · exact (h12 (chord_off hr₂ hr c₂ a hw)).elim + by_cases e₂ : r = r₂ + · subst e₂ + refine iff_chord hS h sys hr c₂ D subset_union_right ?_ hyN hzN hyz H₂ n + rintro w (a | a) hw + · exact (h12 (chord_off hr₁ hr c₁ a hw).symm).elim + · exact a + have hd : Disjoint r (F₁ ∪ F₂) := disjoint_left.mpr fun w hw ha => by + rcases ha with a | a + · exact e₁ (chord_off hr₁ hr c₁ a hw) + · exact e₂ (chord_off hr₂ hr c₂ a hw) + exact iff_of_false (Hoth _ (fun e => e₁ (frontier_inj hS h hr hr₁ e)) (fun e => e₂ + (frontier_inj hS h hr hr₂ e)) (hneΘ hr) n) (off_chord_no_chg hS h sys hr D hd n) + +omit [ConnectedSpace S] in +omit [T2Space S] in +theorem nodes_coe (A : Finset (CellT Γ)) (T : Set (Set S)) (hT : T ⊆ Γ.C) + (hA : ∀ c : CellT Γ, c ∈ A ↔ c.1 ∈ T) : (nodesOf cellNodes A : Set S) = Γ.tildeOfCells T := by + ext n + simp only [Finset.mem_coe, nodesOf, Finset.mem_biUnion, Painting.tildeOfCells, mem_iUnion, + exists_prop] + constructor + · rintro ⟨c, hc, hn⟩ + exact ⟨c.1, (hA c).mp hc, mem_cellNodes.mp hn⟩ + · rintro ⟨c, hc, hn⟩ + exact ⟨⟨c, hT hc⟩, (hA _).mpr hc, mem_cellNodes.mpr hn⟩ + +open Classical in +/-- **(11.1) of Graph Minors XVII for paintings.** -/ +theorem cellPartitionPainting : CellPartitionPaintingStatement := by + intro S _ _ hS Γ hreg h2 hn h83 h85 I J hu hd hI hJ hcard + have ht2 : T2Space S := hS.2.1 + have h : CellHyps Γ := ⟨hreg, h2, hn⟩ + have sys : PSys Γ := arcSystem hS h h83 h85 + have hIC : I ⊆ Γ.C := fun c hc => hu ▸ .inl hc + have hJC : J ⊆ Γ.C := fun c hc => hu ▸ .inr hc + let A : Finset (CellT Γ) := Finset.univ.filter fun c => c.1 ∈ I + have hA : ∀ c : CellT Γ, c ∈ A ↔ c.1 ∈ I := fun c => by simp [A] + have hAc : ∀ c : CellT Γ, c ∈ Aᶜ ↔ c.1 ∈ J := fun c => by + rw [Finset.mem_compl, hA] + have hcu : c.1 ∈ I ∪ J := by + rw [hu] + exact c.2 + constructor + · exact fun h3 => hcu.resolve_left h3 + · exact fun h3 h4 => disjoint_left.mp hd h4 h3 + have hc₁ := nodes_coe A I hIC hA + have hc₂ := nodes_coe Aᶜ J hJC hAc + have hNd : ((Γ.finite_N.toFinset : Finset S) : Set S) = Γ.N := by simp + have hI' : nodesOf cellNodes A ≠ Γ.finite_N.toFinset := fun e => hI (by rw [← hc₁, e, hNd]) + have hJ' : nodesOf cellNodes Aᶜ ≠ Γ.finite_N.toFinset := fun e => hJ (by rw [← hc₂, e, hNd]) + have hZc : ((nodesOf cellNodes A ∩ nodesOf cellNodes Aᶜ : Finset S) : Set S) + = Γ.tildeOfCells I ∩ Γ.tildeOfCells J := by + rw [Finset.coe_inter, hc₁, hc₂] + have hZle : (nodesOf cellNodes A ∩ nodesOf cellNodes Aᶜ).card ≤ 3 := by + rw [← Set.ncard_coe_finset, hZc] + exact hcard + obtain ⟨x, y, z, f, g, k, hxy, hyz, hxz, hZ, hP, hfg, hgk, hfk, hDf, hDg, hDk⟩ + := triangle_of_system sys _ A rfl hI' hJ' hZle + have hZs : Γ.tildeOfCells I ∩ Γ.tildeOfCells J = {x, y, z} := by + rw [← hZc, hZ] + simp + have Hf : ∀ n, Ch A f n ↔ n = x ∨ n = y := fun n => by + rw [Ch, ← mem_chgNodes sys, hDf] + simp + have Hg : ∀ n, Ch A g n ↔ n = y ∨ n = z := fun n => by + rw [Ch, ← mem_chgNodes sys, hDg] + simp + have Hk : ∀ n, Ch A k n ↔ n = x ∨ n = z := fun n => by + rw [Ch, ← mem_chgNodes sys, hDk] + simp + have Hoth : ∀ e, e ≠ f → e ≠ g → e ≠ k → ∀ n, ¬ Ch A e n := fun e h1 h2 h3 n hc => by + have hm : e ∈ chgFaces cellOf faceOf gapEnds Γ.finite_N.toFinset A := + (mem_chgFaces sys).mpr ⟨n, (mem_chgNodes sys).mpr hc⟩ + rw [hP] at hm + simp only [Finset.mem_insert, Finset.mem_singleton] at hm + tauto + have hface : ∀ {e n}, Ch A e n → Γ.IsFace e ∧ n ∈ e ∧ n ∈ Γ.N := fun {e n} hc => by + obtain ⟨a, -, ha, -, han, -⟩ := chg_arcs sys hc + obtain ⟨h3, h4⟩ := faceOf_spec hS h a + rw [ha] at h3 h4 + exact ⟨h3, h4 (mem_gapEnds.mp han).2, (mem_gapEnds.mp han).1⟩ + obtain ⟨hOf, hxf, hxN⟩ := hface ((Hf x).mpr (.inl rfl)) + obtain ⟨-, hyf, hyN⟩ := hface ((Hf y).mpr (.inr rfl)) + obtain ⟨hOg, hyg, -⟩ := hface ((Hg y).mpr (.inl rfl)) + obtain ⟨-, hzg, hzN⟩ := hface ((Hg z).mpr (.inr rfl)) + obtain ⟨hOk, hxk, -⟩ := hface ((Hk x).mpr (.inl rfl)) + obtain ⟨-, hzk, -⟩ := hface ((Hk z).mpr (.inr rfl)) + have hcon : Concl Γ A {x, y, z} := by + rcases hOf with ⟨r₁, hr₁, rfl⟩ | hf <;> rcases hOg with ⟨r₂, hr₂, rfl⟩ | hg + <;> rcases hOk with ⟨r₃, hr₃, rfl⟩ | hk + · exact tri_regions hS h sys A hr₁ hr₂ hr₃ (fun e => hfg (by rw [e])) (fun e => hgk + (by rw [e])) (fun e => hfk (by rw [e])) hxy hyz hxz hxN hyN hzN hxf hyf hyg hzg hxk hzk Hf Hg + Hk Hoth + · exact tri_cuff hS h h83 sys A hI' hJ' hr₁ hr₂ hk (fun e => hfg (by rw [e])) hxy hyz hxz hxN + hyN hzN hxf hyf hyg hzg hxk hzk Hf Hg Hoth + · have hc := tri_cuff hS h h83 sys A hI' hJ' hr₃ hr₁ hg (fun e => hfk + (by rw [e])) hxz.symm hxy hyz.symm hzN hxN hyN hzk hxk hxf hyf hzg hyg + (fun n => (Hk n).trans or_comm) Hf (fun e h1 h2 h3 => Hoth e h2 h3 h1) + have hset : ({z, x, y} : Set S) = {x, y, z} := by + ext w + simp only [mem_insert_iff, mem_singleton_iff] + tauto + rwa [hset] at hc + · exact (hgk (cuff_eq hg hk hzg hzk)).elim + · have hc := tri_cuff hS h h83 sys A hI' hJ' hr₂ hr₃ hf (fun e => hgk + (by rw [e])) hyz hxz.symm hxy.symm hyN hzN hxN hyg hzg hzk hxk hyf hxf + Hg (fun n => (Hk n).trans or_comm) (fun e h1 h2 h3 => Hoth e h3 h1 h2) + have hset : ({y, z, x} : Set S) = {x, y, z} := by + ext w + simp only [mem_insert_iff, mem_singleton_iff] + tauto + rwa [hset] at hc + · exact (hfk (cuff_eq hf hk hxf hxk)).elim + · exact (hfg (cuff_eq hf hg hyf hyg)).elim + · exact (hfg (cuff_eq hf hg hyf hyg)).elim + have hconv : ∀ {Δ : Set S}, inside Γ Δ = A ∨ inside Γ Δ = Aᶜ → {c ∈ Γ.C | c ⊆ Δ} = I + ∨ {c ∈ Γ.C | c ⊆ Δ} = J := fun {Δ} he => by + have key : ∀ {B : Finset (CellT Γ)} {T : Set (Set S)}, T ⊆ Γ.C → (∀ c : CellT Γ, c ∈ B ↔ c.1 ∈ + T) → inside Γ Δ = B → {c ∈ Γ.C | c ⊆ Δ} = T := fun {B T} hT hB e => by + ext c + constructor + · rintro ⟨hc, hs⟩ + exact (hB ⟨c, hc⟩).mp (e ▸ mem_inside.mpr hs) + · intro hc + exact ⟨hT hc, mem_inside.mp (e ▸ (hB ⟨c, hT hc⟩).mpr hc)⟩ + rcases he with e | e + · exact .inl (key hIC hA e) + · exact .inr (key hJC hAc e) + have h3 : (Γ.tildeOfCells I ∩ Γ.tildeOfCells J).ncard = 3 := by + rw [hZs, ncard_eq_toFinset_card'] + simp [Finset.card_insert_of_notMem, hxy, hxz, hyz] + refine ⟨h3, ?_⟩ + rw [hZs] + rcases hcon with ⟨F, h1, h2', h3', h4⟩ | ⟨F, n₁, n₂, h1, h2', h3', h4, h5⟩ + · exact .inl ⟨F, h1, h2', h3', fun Δ hΔ hb => hconv (h4 Δ hΔ hb)⟩ + · exact .inr ⟨F, n₁, n₂, h1, h2', h3', h4, fun Δ hΔ h6 h7 => hconv (h5 Δ hΔ h6 h7)⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CellPartitionSystem.lean b/LeanPool/GraphMinor/GM17/CellPartitionSystem.lean new file mode 100644 index 0000000000..c3bc43b464 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CellPartitionSystem.lean @@ -0,0 +1,397 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CellPartitionChord + +/-! +# The arc system of a painting + +We put the gaps of a painting into the frame of `GraphMinor/GM17/CellPartitionCount.lean`. An arc is +a gap, its cell is the cell of the gap, its face is the face of `exists_face`, and its ends are its +two nodes. `arcSystem` proves the facts of `ArcSystem`. Each node of a cell lies on two gaps of the +cell, and each node of a face lies on two gaps on the face, by `arcs_at_mark`. Two faces with two +common nodes come from `par_faces`. + +If the sides of each region lie in one class of cells, then this class or its complement is empty +(`trivial_of_regions`). This is the statement `E(δ(I)) ≠ ∅` of Claim (3) of the proof of (11.1) of +Graph Minors XVII, page 191. The closed cells and the closed regions of the class and those of its +complement +are two closed sets that cover the surface and meet only in nodes, so one of them is everything, as +the surface stays connected after removing finitely many points. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface Painting + +variable {S : Type} [TopologicalSpace S] [T2Space S] (Γ : Painting S) + +/-- The gaps of a painting, as a type. -/ +abbrev GapT : Type := {L : Set S // ∃ c u v, Γ.IsGap c L u v} + +/-- The cells of a painting, as a type. -/ +abbrev CellT : Type := {c : Set S // c ∈ Γ.C} + +noncomputable instance : Fintype (GapT Γ) := + have : Finite (GapT Γ) := Γ.finite_gaps.to_subtype + Fintype.ofFinite _ + +noncomputable instance : Fintype (CellT Γ) := + have : Finite (CellT Γ) := Set.Finite.to_subtype Γ.finite_cells + Fintype.ofFinite _ + +variable {Γ} + +/-- The cell of a gap. -/ +noncomputable def cellOf (L : GapT Γ) : CellT Γ := ⟨L.2.choose, by + obtain ⟨u, v, h⟩ := L.2.choose_spec + exact h.1⟩ + +omit [T2Space S] in +theorem cellOf_spec (L : GapT Γ) : ∃ u v, Γ.IsGap (cellOf L).1 L.1 u v := L.2.choose_spec + +open Classical in +/-- The face of a gap. -/ +noncomputable def faceOf (L : GapT Γ) : Set S := if h : ∃ O, Γ.IsFace O + ∧ L.1 ⊆ O then h.choose else ∅ + +open Classical in +/-- The two ends of a gap. -/ +noncomputable def gapEnds (L : GapT Γ) : Finset S := Γ.finite_N.toFinset.filter (· ∈ L.1) + +open Classical in +/-- The nodes of a cell. -/ +noncomputable def cellNodes (c : CellT Γ) : Finset S := Γ.finite_N.toFinset.filter (· ∈ tilde c.1) + +omit [T2Space S] in +theorem mem_gapEnds {L : GapT Γ} {n : S} : n ∈ gapEnds L ↔ n ∈ Γ.N ∧ n ∈ L.1 := by simp [gapEnds] + +omit [T2Space S] in +theorem mem_cellNodes {c : CellT Γ} {n : S} : n ∈ cellNodes c ↔ n ∈ tilde c.1 := by + simp only [cellNodes, Finset.mem_filter, Set.Finite.mem_toFinset, and_iff_right_iff_imp] + exact fun h => Γ.tilde_subset_N c.2 h + +omit [T2Space S] in +open Classical in +theorem gapEnds_eq {L : GapT Γ} {c : Set S} {u v : S} (h : Γ.IsGap c L.1 u v) : gapEnds L = {u, v} + := by + ext n + rw [mem_gapEnds, Finset.mem_insert, Finset.mem_singleton] + have := Set.ext_iff.mp h.2.2.2 n + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff] at this + rw [← this, and_comm] + +theorem cellOf_eq {L : GapT Γ} {c : Set S} {u v : S} (h : Γ.IsGap c L.1 u v) : (cellOf L).1 = c + := by + obtain ⟨u', v', h'⟩ := cellOf_spec L + obtain ⟨z, hz⟩ := line_inner_nonempty h.2.1 + exact (h'.unique h hz.1 hz.1 (h.not_mem_N hz.1 (fun e => hz.2 (.inl e)) (fun e => hz.2 + (.inr e)))).1 + +variable [ConnectedSpace S] + +theorem faceOf_spec (hS : IsSurface S) (h : CellHyps Γ) (L : GapT Γ) : Γ.IsFace (faceOf L) + ∧ L.1 ⊆ faceOf L := by + obtain ⟨c, u, v, hL⟩ := L.2 + have hex : ∃ O, Γ.IsFace O ∧ L.1 ⊆ O := exists_face hS h hL + rw [faceOf, dite_eq_left hex] + exact hex.choose_spec + +theorem faceOf_eq (hS : IsSurface S) (h : CellHyps Γ) {L : GapT Γ} {O : Set S} (hO : Γ.IsFace O) + (hs : L.1 ⊆ O) : faceOf L = O := by + obtain ⟨c, u, v, hL⟩ := L.2 + obtain ⟨h1, h2⟩ := faceOf_spec hS h L + exact face_unique hS h hL h1 hO h2 hs + +omit [T2Space S] [ConnectedSpace S] in +theorem card_gapset (T : Finset (GapT Γ)) (A : Set (Set S)) (h : ∀ L : Set S, L ∈ A ↔ ∃ hL, + (⟨L, hL⟩ : GapT Γ) ∈ T) : T.card = A.ncard := by + classical + have hA : A = ↑(T.image Subtype.val) := by + ext L + rw [h L] + simp only [Finset.coe_image, Set.mem_image, Finset.mem_coe] + constructor + · rintro ⟨hL, hm⟩ + exact ⟨_, hm, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨x.2, hx⟩ + rw [hA, Set.ncard_coe_finset, Finset.card_image_of_injective _ Subtype.val_injective] + +open Classical in +omit [ConnectedSpace S] in +theorem cell_two_gaps (h : CellHyps Γ) (c : CellT Γ) {n : S} + (hn : n ∈ cellNodes c) : ({a | cellOf a = c ∧ n ∈ gapEnds a} : Finset (GapT Γ)).card = 2 := by + obtain ⟨x, hx, y, hy, hxy⟩ := h.two c.1 c.2 + rw [card_gapset _ {L | IsArcOf (discBd (closure c.1)) (tilde c.1) L ∧ n ∈ L}] + · exact arcs_at_mark (Γ.isClosedDisc_closure_cell c.2).isOArc_discBd (Γ.finite_tilde_cell c.2) + (Γ.tilde_subset_discBd c.2) hx hy hxy (mem_cellNodes.mp hn) + · intro L + have hnN : n ∈ Γ.N := Γ.tilde_subset_N c.2 (mem_cellNodes.mp hn) + simp only [Finset.mem_filter, Finset.mem_univ, true_and, mem_gapEnds] + constructor + · rintro ⟨h1, h2⟩ + obtain ⟨u, v, hG⟩ := arc_cell_gap c.2 h1 + have hL : ∃ c u v, Γ.IsGap c L u v := ⟨c.1, u, v, hG⟩ + refine ⟨hL, Subtype.ext ?_, hnN, h2⟩ + exact cellOf_eq (L := ⟨L, hL⟩) hG + · rintro ⟨hL, h1, -, h3⟩ + obtain ⟨u, v, hG⟩ := cellOf_spec (⟨L, hL⟩ : GapT Γ) + rw [h1] at hG + exact ⟨gap_arc_cell hG, h3⟩ + +open Classical in +theorem face_two_gaps (hS : IsSurface S) (h : CellHyps Γ) (a : GapT Γ) {n : S} + (hn : n ∈ gapEnds a) : ({b | faceOf b = faceOf a ∧ n ∈ gapEnds b} : Finset (GapT Γ)).card = 2 + := by + obtain ⟨hO, hsub⟩ := faceOf_spec hS h a + obtain ⟨c, u, v, hG⟩ := id a.2 + rw [card_gapset _ {L | IsArcOf (faceOf a) (Γ.N ∩ faceOf a) L ∧ n ∈ L}] + · have hu : u ∈ Γ.N ∩ faceOf a := ⟨hG.left_mem_N, hsub hG.2.1.left_mem⟩ + have hv : v ∈ Γ.N ∩ faceOf a := ⟨hG.right_mem_N, hsub hG.2.1.right_mem⟩ + have hna := mem_gapEnds.mp hn + exact arcs_at_mark (face_oarc hS h hO) (Γ.finite_N.subset inter_subset_left) inter_subset_right + hu hv hG.2.1.ne' ⟨hna.1, hsub hna.2⟩ + · intro L + have hnN : n ∈ Γ.N := (mem_gapEnds.mp hn).1 + simp only [Finset.mem_filter, Finset.mem_univ, true_and, mem_gapEnds] + constructor + · rintro ⟨h1, h2⟩ + have hL := arc_face_gap hS h hO h1 + exact ⟨hL, faceOf_eq hS h hO h1.subset, hnN, h2⟩ + · rintro ⟨hL, h1, -, h3⟩ + obtain ⟨c', u', v', hG'⟩ := id hL + have hsub' := (faceOf_spec hS h (⟨L, hL⟩ : GapT Γ)).2 + rw [h1] at hsub' + exact ⟨gap_arc_face hG' hsub', h3⟩ + +/-- **`E(δ(I)) ≠ ∅`, on regions.** If the sides of each region have their cells on one side of the +class `K`, then `K` is empty or all cells. -/ +theorem trivial_of_regions (hS : IsSurface S) (h : CellHyps Γ) (K : Set (CellT Γ)) + (hno : ∀ r ∈ Γ.regions, ∀ L L' : GapT Γ, Γ.SideOf r L.1 → Γ.SideOf r L'.1 → + (cellOf L ∈ K ↔ cellOf L' ∈ K)) : K = ∅ ∨ K = univ := by + classical + have hcS : CompactSpace S := hS.1 + have hman := hS.2.2 + by_contra hne + push Not at hne + obtain ⟨hK, hK'⟩ := hne + obtain ⟨c, hc⟩ := hK + obtain ⟨c', hc'⟩ := (ne_univ_iff_exists_notMem _).mp hK' + have hfr := finite_regions hS h + let cellsOf : Set (CellT Γ) → Set (Set S) := fun T => (fun d : CellT Γ => closure d.1) '' T + let regOf : Prop → Set (Set S) := fun p => {r | r ∈ Γ.regions ∧ ∃ L : GapT Γ, Γ.SideOf r L.1 ∧ + (cellOf L ∈ K ↔ p)} + let W : Set S := ⋃₀ (cellsOf K ∪ (fun r => closure r) '' regOf True) + let W' : Set S := ⋃₀ (cellsOf Kᶜ ∪ (fun r => closure r) '' regOf False) + have hcl : ∀ (T : Set (CellT Γ)) (p : Prop), IsClosed (⋃₀ (cellsOf T ∪ (fun r + => closure r) '' regOf p)) := fun T p => by + have hreg : (regOf p).Finite := hfr.subset fun _ h => h.1 + refine ((Set.toFinite (cellsOf T)).union (hreg.image _)).isClosed_sUnion ?_ + rintro _ (⟨d, -, rfl⟩ | ⟨r, -, rfl⟩) <;> exact isClosed_closure + have hcover : ∀ y, y ∈ W ∨ y ∈ W' := fun y => by + by_cases hyU : y ∈ Γ.U + · obtain ⟨d, hd, hyd⟩ : ∃ d ∈ Γ.C, y ∈ closure d := by + rcases mem_U_iff.mp hyU with hN | hd + · obtain ⟨d, hd, hyd⟩ := h.hn y hN + exact ⟨d, hd, hyd.1⟩ + · exact hd + by_cases hdK : (⟨d, hd⟩ : CellT Γ) ∈ K + · exact .inl ⟨closure d, .inl ⟨⟨d, hd⟩, hdK, rfl⟩, hyd⟩ + · exact .inr ⟨closure d, .inl ⟨⟨d, hd⟩, hdK, rfl⟩, hyd⟩ + · obtain ⟨r, hr, hyr⟩ := exists_region hyU + obtain ⟨L, hL⟩ := region_side hS h hr + obtain ⟨d, u, v, hs, -⟩ := id hL + let L' : GapT Γ := ⟨L, d, u, v, hs.1⟩ + by_cases hk : cellOf L' ∈ K + · exact .inl ⟨closure r, .inr ⟨r, ⟨hr, L', hL, by simpa using hk⟩, rfl⟩, subset_closure hyr⟩ + · exact .inr ⟨closure r, .inr ⟨r, ⟨hr, L', hL, by simpa using hk⟩, rfl⟩, subset_closure hyr⟩ + have hsame : ∀ {p r}, r ∈ regOf p → ∀ L : GapT Γ, Γ.SideOf r L.1 → (cellOf L ∈ K ↔ p) + := fun {p r} hr L hL => by + obtain ⟨hr1, L₀, hL₀, he⟩ := hr + exact (hno r hr1 L L₀ hL hL₀).trans he + have hcr : ∀ {d r : Set S} (hd : d ∈ Γ.C) {y : S}, r ∈ Γ.regions → y ∈ closure d → y ∈ closure r + → y ∉ Γ.N → ∃ L : GapT Γ, Γ.SideOf r L.1 ∧ (cellOf L).1 = d := fun {d r} hd {y} hr h1 h2 hyN + => by + have hyr : y ∉ r := fun h3 => disjoint_left.mp (region_disjoint_closure hr hd) h3 h1 + obtain ⟨L, hL, hyL⟩ := frontier_region hS h.hopen h.two hr h2 hyr hyN + obtain ⟨c₀, u, v, hs, hcl⟩ := id hL + have hyu : y ≠ u := fun e => hyN (e ▸ hs.1.left_mem_N) + have hyv : y ≠ v := fun e => hyN (e ▸ hs.1.right_mem_N) + refine ⟨⟨L, c₀, u, v, hs.1⟩, hL, ?_⟩ + rw [cellOf_eq (L := ⟨L, c₀, u, v, hs.1⟩) hs.1] + exact Γ.cell_eq_of_mem hs.1.1 hd (hs.1.mem_cell hyL hyu hyv) (closure_eq_cell hd h1 hyN) + have hinter : ∀ y, y ∈ W → y ∈ W' → y ∈ Γ.N := by + rintro y ⟨_, h1, hy⟩ ⟨_, h2, hy'⟩ + by_contra hyN + rcases h1 with ⟨d, hd, rfl⟩ | ⟨r, hr, rfl⟩ <;> rcases h2 with ⟨d', hd', rfl⟩ | ⟨r', hr', rfl⟩ + · have he : d.1 = d'.1 := Γ.cell_eq_of_mem d.2 d'.2 (closure_eq_cell d.2 hy hyN) + (closure_eq_cell d'.2 hy' hyN) + exact hd' ((Subtype.ext he : d = d') ▸ hd) + · obtain ⟨L, hL, he⟩ := hcr d.2 hr'.1 hy hy' hyN + have h3 := hsame hr' L hL + rw [Subtype.ext he] at h3 + exact h3.mp hd + · obtain ⟨L, hL, he⟩ := hcr d'.2 hr.1 hy' hy hyN + have h3 := hsame hr L hL + rw [Subtype.ext he] at h3 + exact hd' (h3.mpr trivial) + · have hrr : r ≠ r' := by + rintro rfl + obtain ⟨L, hL⟩ := region_side hS h hr.1 + obtain ⟨d, u, v, hs, -⟩ := id hL + exact (hsame hr' ⟨L, d, u, v, hs.1⟩ hL).mp ((hsame hr ⟨L, d, u, v, hs.1⟩ hL).mpr trivial) + have hyr : y ∉ r := fun h3 => by + obtain ⟨w, hw, hw'⟩ := mem_closure_iff.mp hy' r (h.hopen r hr.1) h3 + exact hrr (region_eq hr.1 hr'.1 hw hw') + have hyr' : y ∉ r' := fun h3 => by + obtain ⟨w, hw, hw'⟩ := mem_closure_iff.mp hy r' (h.hopen r' hr'.1) h3 + exact hrr (region_eq hr.1 hr'.1 hw' hw) + obtain ⟨L, hL, hyL⟩ := frontier_region hS h.hopen h.two hr.1 hy hyr hyN + obtain ⟨L', hL', hyL'⟩ := frontier_region hS h.hopen h.two hr'.1 hy' hyr' hyN + obtain ⟨c₁, u, v, hs, hcl⟩ := id hL + obtain ⟨c₂, u', v', hs', hcl'⟩ := id hL' + obtain ⟨-, rfl⟩ := hs.1.unique hs'.1 hyL hyL' hyN + exact hrr (SideOf.unique hS h.hopen hr.1 hr'.1 hL hL') + have hwc : IsClosed W := hcl K True + have hwc' : IsClosed W' := hcl Kᶜ False + obtain ⟨x, hx⟩ := arcComponentsIn_nonempty c.2 + have hxN : x ∉ Γ.N := disjoint_left.mp (Γ.cell_disjoint_N c.2) hx + obtain ⟨y, hy⟩ := arcComponentsIn_nonempty c'.2 + have hyN : y ∉ Γ.N := disjoint_left.mp (Γ.cell_disjoint_N c'.2) hy + have hxW : x ∈ W := ⟨closure c.1, .inl ⟨c, hc, rfl⟩, subset_closure hx⟩ + have hyW' : y ∈ W' := ⟨closure c'.1, .inl ⟨c', hc', rfl⟩, subset_closure hy⟩ + have hnb : ∀ z ∈ W, z ∉ Γ.N → W ∈ 𝓝 z := fun z hz hzN => + Filter.mem_of_superset (hwc'.isOpen_compl.mem_nhds fun h3 => hzN (hinter z hz h3)) fun w hw => + (hcover w).resolve_right hw + exact hyN (hinter y (cover_off hman hwc Γ.finite_N ⟨x, hxW, hxN⟩ hnb hyN) hyW') + +theorem side_faceOf (hS : IsSurface S) (h : CellHyps Γ) {r : Set S} (hr : r ∈ Γ.regions) {L : GapT + Γ} (hL : Γ.SideOf r L.1) : faceOf L = closure r \ r := by + obtain ⟨c, u, v, hs, hcl⟩ := hL + exact faceOf_eq hS h (.inl ⟨r, hr, rfl⟩) fun x hx => ⟨hcl hx, fun hxr => + (arcComponentsIn_subset hr hxr).2 (hs.1.subset_U hx)⟩ + +theorem face_side (hS : IsSurface S) (h : CellHyps Γ) {r : Set S} (hr : r ∈ Γ.regions) {L : GapT Γ} + (hL : faceOf L = closure r \ r) : Γ.SideOf r L.1 := by + obtain ⟨c, u, v, hG⟩ := L.2 + exact side_of_frontier hS h hr hG (hL ▸ (faceOf_spec hS h L).2) + +/-- Two gaps on the same face at a node are in the same class if the node is not a change. -/ +theorem same_of_no_chg (hS : IsSurface S) (h : CellHyps Γ) {K : Finset + (CellT Γ)} {a b : GapT Γ} {n : S} (he : faceOf b = faceOf a) (hn : ¬ Chg cellOf faceOf gapEnds K + (faceOf a) n) + (han : n ∈ gapEnds a) (hbn : n ∈ gapEnds b) (hab : a ≠ b) : cellOf a ∈ K ↔ cellOf b ∈ K := by + by_contra hd + exact hn (chg_of_differ (fun a n hn => face_two_gaps hS h a hn) rfl he han hbn hab hd) + +/-- A class with no changes at a face is constant on the face. -/ +theorem class_const (hS : IsSurface S) (h : CellHyps Γ) {K : Finset (CellT Γ)} {O : Set S} + (hno : ∀ n, ¬ Chg cellOf faceOf gapEnds K O n) {a b : GapT Γ} (ha : faceOf a = O) (hb : faceOf b + = O) : cellOf a ∈ K ↔ cellOf b ∈ K := by + obtain ⟨hO, hsa⟩ := faceOf_spec hS h a + rw [ha] at hO hsa + have hsb := (faceOf_spec hS h b).2 + rw [hb] at hsb + have hOa := face_oarc hS h hO + obtain ⟨c, u, v, hG⟩ := id a.2 + have hu : u ∈ Γ.N ∩ O := ⟨hG.left_mem_N, hsa hG.2.1.left_mem⟩ + have hv : v ∈ Γ.N ∩ O := ⟨hG.right_mem_N, hsa hG.2.1.right_mem⟩ + have hfin : (Γ.N ∩ O).Finite := Γ.finite_N.subset inter_subset_left + obtain ⟨hf, hcov⟩ := arcOf_family hOa hfin inter_subset_right hu hv hG.2.1.ne' + let p : Set S → Prop := fun L => ∃ g : GapT Γ, g.1 = L ∧ cellOf g ∈ K + have hp : ∀ g : GapT Γ, p g.1 ↔ cellOf g ∈ K := fun g => ⟨fun ⟨g', e, h'⟩ => (Subtype.ext e : g' + = g) ▸ h', fun h' => ⟨g, rfl, h'⟩⟩ + have harc : ∀ {g : GapT Γ}, faceOf g = O → IsArcOf O (Γ.N ∩ O) g.1 := fun {g} hg => by + obtain ⟨c', u', v', hG'⟩ := id g.2 + exact gap_arc_face hG' (hg ▸ (faceOf_spec hS h g).2) + have hne : ∀ {L}, IsArcOf O (Γ.N ∩ O) L → L.Nonempty := fun {L} hL => by + obtain ⟨s, t, hl, -, -⟩ := hL + exact ⟨s, hl.left_mem⟩ + have hag : ∀ L ∈ {L | IsArcOf O (Γ.N ∩ O) L}, ∀ L' ∈ {L | IsArcOf O (Γ.N ∩ O) L}, + (L ∩ L').Nonempty → (p L ↔ p L') := by + intro L hL L' hL' ⟨x, hx, hx'⟩ + by_cases heq : L = L' + · rw [heq] + have hxA : x ∈ Γ.N ∩ O := by + by_contra hxA + exact heq (arcOf_eq hOa hL hL' hx hx' hxA) + obtain ⟨g, rfl⟩ : ∃ g : GapT Γ, g.1 = L := ⟨⟨L, arc_face_gap hS h hO hL⟩, rfl⟩ + obtain ⟨g', rfl⟩ : ∃ g : GapT Γ, g.1 = L' := ⟨⟨L', arc_face_gap hS h hO hL'⟩, rfl⟩ + have hg : faceOf g = O := faceOf_eq hS h hO hL.subset + have hg' : faceOf g' = O := faceOf_eq hS h hO hL'.subset + rw [hp, hp] + exact same_of_no_chg hS h (hg'.trans hg.symm) (hg ▸ hno x) (mem_gapEnds.mpr ⟨hxA.1, + hx⟩) (mem_gapEnds.mpr ⟨hxA.1, hx'⟩) fun e => heq (congrArg Subtype.val e) + have := arcs_agree (𝓑 := {L | IsArcOf O (Γ.N ∩ O) L}) (p := p) hf (by rw [hcov]; exact + hOa.isPreconnected) (fun L hL => IsArcOf.isClosed hL) hag (harc ha) (harc hb) (hne (harc ha)) + (hne (harc hb)) + rwa [hp, hp] at this + +/-- **`E(δ(I)) ≠ ∅`.** A class of cells with no changes is empty or all cells. -/ +theorem no_changes_trivial (hS : IsSurface S) (h : CellHyps Γ) (K : Finset (CellT Γ)) + (hno : ∀ f n, ¬ Chg cellOf faceOf gapEnds K f n) : K = ∅ ∨ K = Finset.univ := by + classical + have := trivial_of_regions hS h (K : Set (CellT Γ)) fun r hr L L' hL hL' => by + simp only [Finset.mem_coe] + exact class_const hS h (hno _) (side_faceOf hS h hr hL) (side_faceOf hS h hr hL') + rcases this with h1 | h1 + · exact .inl (Finset.coe_eq_empty.mp h1) + · exact .inr (Finset.coe_eq_univ.mp h1) + +/-- The gaps of a painting satisfy the facts of `ArcSystem`. -/ +theorem arcSystem (hS : IsSurface S) (h : CellHyps Γ) (h83 : Hyp83 Γ) + (h85 : Hyp85 Γ) : ArcSystem cellOf faceOf gapEnds (cellNodes (Γ := Γ)) Γ.finite_N.toFinset where + ends_card a := by + classical + obtain ⟨c, u, v, hG⟩ := a.2 + rw [gapEnds_eq (L := a) hG, Finset.card_pair hG.2.1.ne'] + ends_sub a n hn := by + obtain ⟨u, v, hG⟩ := cellOf_spec a + have hna := mem_gapEnds.mp hn + exact mem_cellNodes.mpr ⟨hG.subset_closure hna.2, fun hx => disjoint_left.mp (Γ.cell_disjoint_N + (cellOf a).2) hx hna.1⟩ + ti_sub c n hn := by + simpa using Γ.tilde_subset_N c.2 (mem_cellNodes.mp hn) + cover n hn := by + obtain ⟨c, hc, hnc⟩ := h.hn n (by simpa using hn) + exact ⟨⟨c, hc⟩, mem_cellNodes.mpr hnc⟩ + cell_two c n hn := by convert cell_two_gaps h c hn + face_two a n hn := by convert face_two_gaps hS h a hn + empty K hno := no_changes_trivial hS h K hno + par f g u v hfg huv := by + classical + rintro ⟨a, rfl, hau⟩ ⟨a', ha', hav⟩ ⟨b, rfl, hbu⟩ ⟨b', hb', hbv⟩ + obtain ⟨hOf, hsf⟩ := faceOf_spec hS h a + obtain ⟨hOg, hsg⟩ := faceOf_spec hS h b + have hsf' := (faceOf_spec hS h a').2 + have hsg' := (faceOf_spec hS h b').2 + rw [ha'] at hsf' + rw [hb'] at hsg' + have hu := mem_gapEnds.mp hau + have hv := mem_gapEnds.mp hav + have hu' := mem_gapEnds.mp hbu + have hv' := mem_gapEnds.mp hbv + obtain ⟨c, L, L', hG, hG', hL, hL', ht⟩ := par_faces hS h h83 h85 hOf hOg hfg (hsf hu.2) + (hsf' hv.2) (hsg hu'.2) (hsg' hv'.2) hu.1 hv.1 huv + have hcC : c ∈ Γ.C := hG.1 + refine ⟨⟨c, hcC⟩, ⟨L, c, u, v, hG⟩, ⟨L', c, u, v, hG'⟩, ?_, Subtype.ext (cellOf_eq (L + := ⟨L, c, u, v, hG⟩) hG), Subtype.ext (cellOf_eq (L := ⟨L', c, u, v, hG'⟩) hG'), faceOf_eq hS + h hOf hL, faceOf_eq hS h hOg hL', gapEnds_eq (L := ⟨L, c, u, v, hG⟩) hG, gapEnds_eq (L + := ⟨L', c, u, v, hG'⟩) hG'⟩ + ext n + rw [mem_cellNodes, Finset.mem_insert, Finset.mem_singleton] + change n ∈ tilde c ↔ _ + rw [ht] + rfl + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CliqueChord.lean b/LeanPool/GraphMinor/GM17/CliqueChord.lean new file mode 100644 index 0000000000..79c9439f1f --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CliqueChord.lean @@ -0,0 +1,273 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.ThreeNodeReplace +public import LeanPool.GraphMinor.GM17.ArcDisc +public import LeanPool.GraphMinor.GM17.ReplaceDisc + +/-! +# Disjoint chords in a closed disc + +This file holds the two surface facts behind Claim (1) of the proof of (12.2) of Graph Minors XVII +(page 198). The paper draws a graph `H` on the boundaries of the cells. A cycle of `H` is not +`Γ`-normal, so (8.5) does not apply to it directly. We push each edge of `H` we need off its cell, +into the region beside it. + +If several boundary lines of one closed disc are given, meeting only at common ends, then there are +chords with the same ends that are disjoint except at common ends (`chords_in_disc`). Each chord +cuts off a cap, and one disc `R` is left over. + +A closed disc lies on exactly one side of a line of its boundary (`disc_flip`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] [T2Space S] {ι : Type} + +/-- The result of cutting caps off a disc `D`: for each `i ∈ s`, the chord `Ch i` cuts the cap `Cap +i` off `D` along the line `G i` of its boundary, and `R` is what is left. -/ +structure ChordSys (D : Set S) (s : Finset ι) (G : ι → Set S) (a b : ι → S) (R : Set S) (Ch Cap : ι + → Set S) : Prop where + hR : IsClosedDisc R + line : ∀ i ∈ s, IsLineWithEnds (Ch i) (a i) (b i) + cap : ∀ i ∈ s, IsClosedDisc (Cap i) + capb : ∀ i ∈ s, discBd (Cap i) = G i ∪ Ch i + inter : ∀ i ∈ s, G i ∩ Ch i = {a i, b i} + chR : ∀ i ∈ s, Ch i ⊆ discBd R + capR : ∀ i ∈ s, Cap i ∩ R = Ch i + cover : D = R ∪ ⋃ i ∈ s, Cap i + pair : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → Cap i ∩ Cap j ⊆ {a i, b i} ∩ {a j, b j} + bdR : discBd R ⊆ (⋃ i ∈ s, Ch i) ∪ discBd D + capD : ∀ i ∈ s, Cap i ∩ discBd D ⊆ G i + +theorem chords_in_disc (hman : ∀ x : S, IsManifoldPoint x) {D : Set S} (hD : IsClosedDisc D) + (s : Finset ι) {G : ι → Set S} {a b : ι → S} + (hG : ∀ i ∈ s, IsLineWithEnds (G i) (a i) (b i)) (hsub : ∀ i ∈ s, G i ⊆ discBd D) + (hne : ∀ i ∈ s, a i ≠ b i) + (hp : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → G i ∩ G j ⊆ {a i, b i} ∩ {a j, b j}) : + ∃ R Ch Cap, ChordSys D s G a b R Ch Cap := by + classical + induction s using Finset.induction_on with + | empty => + refine ⟨D, fun _ => ∅, fun _ => ∅, ⟨hD, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩⟩ <;> simp + | insert k s hk ih => + obtain ⟨R, Ch, Cap, h⟩ := ih (fun i hi => hG i (Finset.mem_insert_of_mem hi)) (fun i hi + => hsub i (Finset.mem_insert_of_mem hi)) + (fun i hi => hne i (Finset.mem_insert_of_mem hi)) (fun i hi j hj => hp i + (Finset.mem_insert_of_mem hi) j (Finset.mem_insert_of_mem hj)) + have hkk := Finset.mem_insert_self k s + have hik : ∀ i ∈ s, i ≠ k := fun i hi e => hk (e ▸ hi) + have hmem : ∀ i ∈ s, i ∈ insert k s := fun i hi => Finset.mem_insert_of_mem hi + have hRD : R ⊆ D := by rw [h.cover]; exact subset_union_left + have hCapD : ∀ i ∈ s, Cap i ⊆ D := fun i hi x hx => by + rw [h.cover] + exact .inr (mem_biUnion hi hx) + have hChCap : ∀ i ∈ s, Ch i ⊆ Cap i := fun i hi x hx => by + rw [← h.capR i hi] at hx + exact hx.1 + have hGb' : ∀ x ∈ G k, x ∈ discBd D := fun x hx => hsub k hkk hx + have hGcap : ∀ i ∈ s, ∀ x ∈ Cap i, x ∈ G k → x ∈ ({a i, b i} : Set S) ∩ {a k, b k} + := fun i hi x hx hxk => + hp i (hmem i hi) k hkk (hik i hi) ⟨h.capD i hi ⟨hx, hGb' x hxk⟩, hxk⟩ + have hends : ∀ i ∈ s, ∀ x ∈ ({a i, b i} : Set S), x ∈ Ch i := fun i hi x hx => by + rcases hx with rfl | rfl + · exact (h.line i hi).left_mem + · exact (h.line i hi).right_mem + have hGR : G k ⊆ R := fun x hx => by + have hxD : x ∈ D := discBd_subset _ (hGb' x hx) + rw [h.cover] at hxD + rcases hxD with h1 | h1 + · exact h1 + · obtain ⟨i, hi, h2⟩ := mem_iUnion₂.1 h1 + exact discBd_subset _ (h.chR i hi (hends i hi x (hGcap i hi x h2 hx).1)) + have hGb : G k ⊆ discBd R := fun x hx => by + by_contra hn + exact (discInt_mono hman h.hR hRD ⟨hGR hx, hn⟩).2 (hGb' x hx) + obtain ⟨Q, hQ, hu, hi⟩ := oarc_split h.hR.isOArc_discBd (hG k hkk) hGb + obtain ⟨L, Δ₁, Δ₂, hL, hLb, hLR, hd₁, hd₂, hu', hi', hb₁, hb₂⟩ := split_disc h.hR (hG k hkk) hQ + (hne k hkk) hu hi + have hΔ₁R : Δ₁ ⊆ R := hu' ▸ subset_union_left + have hΔ₂R : Δ₂ ⊆ R := hu' ▸ subset_union_right + have hChΔ : ∀ i ∈ s, Ch i ⊆ discBd Δ₂ := fun i hi' x hx => by + have hxb : x ∈ discBd R := h.chR i hi' hx + rw [← hu] at hxb + rcases hxb with h1 | h1 + · have h3 : x ∈ G k ∩ Q := by + rw [hi] + exact (hGcap i hi' x (hChCap i hi' hx) h1).2 + rw [hb₂] + exact .inl h3.2 + · rw [hb₂] + exact .inl h1 + have hupC : ∀ i ∈ s, Function.update Ch k L i = Ch i := fun i hi => Function.update_of_ne + (hik i hi) _ _ + have hupK : ∀ i ∈ s, Function.update Cap k Δ₁ i = Cap i := fun i hi => Function.update_of_ne + (hik i hi) _ _ + have hupC' : Function.update Ch k L k = L := Function.update_self _ _ _ + have hupK' : Function.update Cap k Δ₁ k = Δ₁ := Function.update_self _ _ _ + have hLG : G k ∩ L = {a k, b k} := by + ext x + constructor + · rintro ⟨h1, h2⟩ + rw [← hLb] + exact ⟨h2, hGb h1⟩ + · intro h1 + have h2 : x ∈ L ∩ discBd R := by rw [hLb]; exact h1 + rcases h1 with rfl | rfl + · exact ⟨(hG k hkk).left_mem, h2.1⟩ + · exact ⟨(hG k hkk).right_mem, h2.1⟩ + have hLbD : ∀ x ∈ L, x ∈ discBd D → x ∈ ({a k, b k} : Set S) := fun x hx hxD => by + rw [← hLb] + refine ⟨hx, ?_⟩ + by_contra hn + exact (discInt_mono hman h.hR hRD ⟨hLR hx, hn⟩).2 hxD + refine ⟨Δ₂, Function.update Ch k L, Function.update Cap k Δ₁, ⟨hd₂, ?_, ?_, ?_, ?_, ?_, ?_, + ?_, ?_, ?_, ?_⟩⟩ + · intro i hi + rcases Finset.mem_insert.1 hi with rfl | hi + · rw [hupC']; exact hL + · rw [hupC i hi]; exact h.line i hi + · intro i hi + rcases Finset.mem_insert.1 hi with rfl | hi + · rw [hupK']; exact hd₁ + · rw [hupK i hi]; exact h.cap i hi + · intro i hi + rcases Finset.mem_insert.1 hi with rfl | hi + · rw [hupK', hupC']; exact hb₁ + · rw [hupK i hi, hupC i hi]; exact h.capb i hi + · intro i hi + rcases Finset.mem_insert.1 hi with rfl | hi + · rw [hupC']; exact hLG + · rw [hupC i hi]; exact h.inter i hi + · intro i hi + rcases Finset.mem_insert.1 hi with rfl | hi + · rw [hupC', hb₂]; exact subset_union_right + · rw [hupC i hi]; exact hChΔ i hi + · intro i hi + rcases Finset.mem_insert.1 hi with rfl | hi + · rw [hupK', hupC']; exact hi' + · rw [hupK i hi, hupC i hi] + refine Subset.antisymm (fun x hx => ?_) fun x hx => ⟨hChCap i hi hx, + discBd_subset _ (hChΔ i hi hx)⟩ + rw [← h.capR i hi] + exact ⟨hx.1, hΔ₂R hx.2⟩ + · ext x + constructor + · intro hx + rw [h.cover] at hx + rcases hx with hx | hx + · rw [← hu'] at hx + rcases hx with hx | hx + · exact .inr (mem_biUnion hkk (by rw [hupK']; exact hx)) + · exact .inl hx + · obtain ⟨i, hi, h2⟩ := mem_iUnion₂.1 hx + exact .inr (mem_biUnion (hmem i hi) (by rw [hupK i hi]; exact h2)) + · intro hx + rcases hx with hx | hx + · exact hRD (hΔ₂R hx) + · obtain ⟨i, hi, h2⟩ := mem_iUnion₂.1 hx + rcases Finset.mem_insert.1 hi with rfl | hi + · rw [hupK'] at h2 + exact hRD (hΔ₁R h2) + · rw [hupK i hi] at h2 + exact hCapD i hi h2 + · have hcross : ∀ i ∈ s, Cap i ∩ Δ₁ ⊆ {a i, b i} ∩ {a k, b k} := fun i hi x hx => by + have hxCh : x ∈ Ch i := by + rw [← h.capR i hi] + exact ⟨hx.1, hΔ₁R hx.2⟩ + have hxL : x ∈ L := by + rw [← hi'] + exact ⟨hx.2, discBd_subset _ (hChΔ i hi hxCh)⟩ + have hxe : x ∈ ({a k, b k} : Set S) := by + rw [← hLb] + exact ⟨hxL, h.chR i hi hxCh⟩ + have hxG : x ∈ G k := by + rcases hxe with rfl | rfl + · exact (hG k hkk).left_mem + · exact (hG k hkk).right_mem + exact hGcap i hi x hx.1 hxG + intro i hi j hj hij + rcases Finset.mem_insert.1 hi with e | hi' <;> rcases Finset.mem_insert.1 hj with e' | hj' + · exact absurd (e.trans e'.symm) hij + · rw [e, hupK', hupK j hj', inter_comm, inter_comm {a k, b k}] + exact hcross j hj' + · rw [e', hupK i hi', hupK'] + exact hcross i hi' + · rw [hupK i hi', hupK j hj'] + exact h.pair i hi' j hj' hij + · intro x hx + rw [hb₂] at hx + rcases hx with hx | hx + · have hxb : x ∈ discBd R := hu ▸ .inr hx + rcases h.bdR hxb with h1 | h1 + · obtain ⟨i, hi, h2⟩ := mem_iUnion₂.1 h1 + exact .inl (mem_biUnion (hmem i hi) (by rw [hupC i hi]; exact h2)) + · exact .inr h1 + · exact .inl (mem_biUnion hkk (by rw [hupC']; exact hx)) + · intro i hi x hx + rcases Finset.mem_insert.1 hi with rfl | hi + · rw [hupK'] at hx + rw [Function.update_self] at * + by_cases hxb : x ∈ discBd Δ₁ + · rw [hb₁] at hxb + rcases hxb with h1 | h1 + · exact h1 + · have := hLbD x h1 hx.2 + rcases this with rfl | rfl + · exact (hG i hkk).left_mem + · exact (hG i hkk).right_mem + · exact absurd hx.2 (discInt_mono hman hd₁ (hΔ₁R.trans hRD) ⟨hx.1, hxb⟩).2 + · rw [hupK i hi] at hx + exact h.capD i hi hx + +variable (hman : ∀ x : S, IsManifoldPoint x) +include hman + +/-- A preconnected set off the boundary of a disc lies in the disc or misses it. -/ +theorem disc_dichotomy {Δ A : Set S} (hΔ : IsClosedDisc Δ) (hA : IsPreconnected A) (hd : Disjoint A + (discBd Δ)) : A ⊆ Δ ∨ Disjoint A Δ := by + have hsub : A ⊆ discInt Δ ∪ Δᶜ := fun x hx => by + by_cases h : x ∈ Δ + · exact .inl ⟨h, disjoint_left.mp hd hx⟩ + · exact .inr h + have hdj : Disjoint (discInt Δ) Δᶜ := disjoint_left.mpr fun x hx hx' => hx' hx.1 + rcases hA.subset_or_subset (hΔ.isOpen_discInt hman) hΔ.isClosed.isOpen_compl hdj hsub with h | h + · exact .inl (h.trans sdiff_subset) + · exact .inr (disjoint_left.mpr fun x hx hx' => h hx hx') + +/-- Near a point of its boundary inside the surface, a closed disc lies on exactly one of two sides. +-/ +theorem disc_flip {Δ A B V : Set S} {x : S} (hΔ : IsClosedDisc Δ) (hx : x ∈ discBd Δ) + (hi : IsInteriorPoint x) (hV : IsOpen V) (hxV : x ∈ V) (hsub : V ⊆ A ∪ B ∪ discBd Δ) + (hA : IsPreconnected A) (hB : IsPreconnected B) (hAd : Disjoint A (discBd Δ)) (hBd : Disjoint B + (discBd Δ)) : (A ⊆ Δ ∧ Disjoint B Δ) ∨ (B ⊆ Δ ∧ Disjoint A Δ) := by + rcases disc_dichotomy hman hΔ hA hAd with h1 | h1 <;> rcases disc_dichotomy hman hΔ hB hBd with + h2 | h2 + · exfalso + obtain ⟨y, hy, hyc⟩ := mem_closure_iff.mp (mem_closure_compl hx hi) V hV hxV + rcases hsub hy with (h3 | h3) | h3 + · exact hyc (h1 h3) + · exact hyc (h2 h3) + · exact hyc (discBd_subset _ h3) + · exact .inl ⟨h1, h2⟩ + · exact .inr ⟨h2, h1⟩ + · exfalso + obtain ⟨y, hy, hyc⟩ := mem_closure_iff.mp (hΔ.subset_closure_discInt + (discBd_subset _ hx)) V hV hxV + rcases hsub hy with (h3 | h3) | h3 + · exact disjoint_left.mp h1 h3 hyc.1 + · exact disjoint_left.mp h2 h3 hyc.1 + · exact hyc.2 h3 + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CliqueDisc.lean b/LeanPool/GraphMinor/GM17/CliqueDisc.lean new file mode 100644 index 0000000000..ed57f9d587 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CliqueDisc.lean @@ -0,0 +1,589 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CliqueSphere + +/-! +# A clique of nodes lies in one disc + +This file proves the surface part of Claim (1) of the proof of (12.2) of Graph Minors XVII (page +198). Let `M` be a set of at least three nodes, any two on a common cell. Every normal `O`-arc with +at most three nodes bounds a disc with a property `P` (in the paper, "`α(Δ)` is small"), and no four +such discs contain all cells. + +As in the paper we take a circuit of length 3 on `M` with a maximal disc, and show `M` lies in this +disc (`clique_disc`). If `m₀ ∈ M` lies outside, the three circuits through `m₀` have discs that do +not include the first disc, so the four discs have the first one's inside to itself. Then the four +discs form a sphere, which is all of `Σ`, so they contain all cells (`four_discs_cover`), a +contradiction. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface Painting + +variable {S : Type} [TopologicalSpace S] [T2Space S] {Γ : Painting S} + +omit [TopologicalSpace S] [T2Space S] in +/-- Six pairs of four distinct points are distinct. -/ +theorem six_pairs_inj {a b c m : S} (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) (hma : m ≠ a) + (hmb : m ≠ b) (hmc : m ≠ c) (i j : Fin 6) (hij : i ≠ j) + (he : (![{a, b}, {b, c}, {c, a}, {m, a}, {m, b}, {m, c}] : Fin 6 → Set S) i + = ![{a, b}, {b, c}, {c, a}, {m, a}, {m, b}, {m, c}] j) : False := by + have hba := hab.symm + have hca := hac.symm + have hcb := hbc.symm + have ham := hma.symm + have hbm := hmb.symm + have hcm := hmc.symm + fin_cases i <;> fin_cases j <;> first + | exact hij rfl + | simp only [Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val, Fin.isValue, + Fin.mk_one, Fin.zero_eta, Fin.reduceFinMk, Set.pair_eq_pair_iff] at he + rcases he with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> first | exact absurd h1 ‹_› | exact absurd h2 ‹_› + +private theorem triangle_is_normal_arc + {S : Type} + [TopologicalSpace S] + [T2Space S] + {Γ : Painting S} + {M : Set S} + (L : Set S → Set S) + (𝓟 : Set (Set S)) + (hline : ∀ a ∈ M, ∀ b ∈ M, a ≠ b → IsLineWithEnds (L {a, b}) a b) + (hpp : ∀ {a b : S}, a ∈ M → b ∈ M → a ≠ b → {a, b} ∈ 𝓟) + (hpN : ∀ p ∈ 𝓟, p ⊆ Γ.N) + (hLU : ∀ p ∈ 𝓟, L p ∩ Γ.U ⊆ p) + (hLN : ∀ p ∈ 𝓟, L p ∩ Γ.N ⊆ p) + (hcom : ∀ p ∈ 𝓟, ∀ q ∈ 𝓟, p ≠ q → L p ∩ L q ⊆ p ∩ q) : + let E : S → S → Set S := fun x y => L {x, y} + let Φ : S → S → S → Set S := fun x y z => E x y ∪ E y z ∪ E z x + (∀ {a b c d : S}, a ≠ c → a ≠ d → ({a, b} : Set S) ≠ {c, d}) → + ∀ {a : S}, + ∀ {b : S}, + ∀ {c : S}, + (a ∈ M) → + (b ∈ M) → + (c ∈ M) → + (a ≠ b) → + (a ≠ c) → + (b ≠ c) → + IsOArc (Φ a b c) ∧ Γ.IsNormal (Φ a b c) ∧ (Φ a b c ∩ Γ.N).ncard ≤ 3 := by + intro E Φ hpne a b c ha hb hc hab hac hbc + have hp1 := hpp ha hb hab + have hp2 := hpp hb hc hbc + have hp3 := hpp hc ha hac.symm + have hne12 : ({a, b} : Set S) ≠ {b, c} := hpne hab hac + have hne13 : ({b, a} : Set S) ≠ {c, a} := hpne hbc hab.symm + have hne23 : ({b, c} : Set S) ≠ {c, a} := hpne hbc hab.symm + have hi1 : E a b ∩ E b c = {b} := by + apply Subset.antisymm + · intro x hx + obtain ⟨h1, h2⟩ := hcom _ hp1 _ hp2 hne12 hx + rcases h1 with rfl | rfl + · rcases h2 with h2 | h2 + · exact absurd h2 hab + · exact absurd h2 hac + · rfl + · rintro x rfl + exact ⟨(hline a ha x hb hab).right_mem, (hline x hb c hc hbc).left_mem⟩ + have hA : IsLineWithEnds (E a b ∪ E b c) a c := (hline a ha b hb hab).union + (hline b hb c hc hbc) hi1 + have hB : IsLineWithEnds (E c a) a c := (hline c hc a ha hac.symm).symm + have hi2 : (E a b ∪ E b c) ∩ E c a = {a, c} := by + apply Subset.antisymm + · rintro x ⟨h1 | h1, h2⟩ + · have h3 := hcom {a, b} hp1 {c, a} hp3 (by rw [pair_comm a b]; exact hne13) ⟨h1, h2⟩ + rcases h3.2 with rfl | rfl + · exact .inr rfl + · exact .inl rfl + · have h3 := hcom _ hp2 _ hp3 hne23 ⟨h1, h2⟩ + rcases h3.2 with rfl | rfl + · exact .inr rfl + · exact .inl rfl + · rintro x (rfl | rfl) + · exact ⟨.inl (hline x ha b hb hab).left_mem, (hline c hc x ha hac.symm).right_mem⟩ + · exact ⟨.inr (hline b hb x hc hbc).right_mem, (hline x hc a ha hac.symm).left_mem⟩ + have hsub : Φ a b c ∩ Γ.N ⊆ {a, b, c} := by + rintro x ⟨(h1 | h1) | h1, h2⟩ + · rcases hLN _ hp1 ⟨h1, h2⟩ with rfl | rfl + · exact .inl rfl + · exact .inr (.inl rfl) + · rcases hLN _ hp2 ⟨h1, h2⟩ with rfl | rfl + · exact .inr (.inl rfl) + · exact .inr (.inr rfl) + · rcases hLN _ hp3 ⟨h1, h2⟩ with rfl | rfl + · exact .inr (.inr rfl) + · exact .inl rfl + refine ⟨oArc_of_lines hA hB hi2, ?_, ?_⟩ + · rintro x ⟨(h1 | h1) | h1, h2⟩ + · exact hpN _ hp1 (hLU _ hp1 ⟨h1, h2⟩) + · exact hpN _ hp2 (hLU _ hp2 ⟨h1, h2⟩) + · exact hpN _ hp3 (hLU _ hp3 ⟨h1, h2⟩) + · have hf : ({a, b, c} : Set S).Finite := by simp + refine (ncard_le_ncard hsub hf).trans ?_ + exact (ncard_insert_le _ _).trans (by rw [ncard_pair hbc]) + +private theorem tetrahedral_disc_boundaries + {S : Type} + [TopologicalSpace S] + (E : S → S → Set S) + (hEc : ∀ (x y : S), E x y = E y x) : + let Φ : S → S → S → Set S := fun x y z => E x y ∪ E y z ∪ E z x + ∀ (𝒯 : Set (S × S × S)), + ∀ (dsc : S × S × S → Set S), + (∀ t ∈ 𝒯, discBd (dsc t) = Φ t.1 t.2.1 t.2.2) → + ∀ (a : S), + ∀ (b : S), + ∀ (c : S), + ∀ (m : S), + ∀ (Δ : Set S), + (discBd Δ = Φ a b c) → + ((m, b, c) ∈ 𝒯) → + ((a, m, c) ∈ 𝒯) → + ((a, b, m) ∈ 𝒯) → + ∀ (e : Fin 6 → Set S), + e 0 = E a b → e 1 = E b c → e 2 = E c a → + e 3 = E m a → e 4 = E m b → e 5 = E m c → + let D : Fin 4 → Set S := ![Δ, dsc (m, b, c), dsc (a, m, c), dsc (a, b, m)] + (∀ (x y z : Fin 6), ⋃ i ∈ ({x, y, z} : Finset (Fin 6)), e i = e x ∪ e y ∪ e z) → + ∀ (k : Fin 4), + discBd (D k) = ⋃ i ∈ circuitChords k, e i := by + intro Φ 𝒯 dsc hdB a b c m Δ hΔb ht1 ht2 ht3 e he₀ he₁ he₂ he₃ he₄ he₅ D hunion k + fin_cases k + · change discBd Δ = ⋃ i ∈ ({0, 1, 2} : Finset (Fin 6)), e i + rw [hunion, hΔb, he₀, he₁, he₂] + · change discBd (dsc (m, b, c)) = ⋃ i ∈ ({4, 1, 5} : Finset (Fin 6)), e i + rw [hunion, hdB _ ht1, he₄, he₁, he₅] + change E m b ∪ E b c ∪ E c m = E m b ∪ E b c ∪ E m c + rw [hEc c m] + · change discBd (dsc (a, m, c)) = ⋃ i ∈ ({3, 5, 2} : Finset (Fin 6)), e i + rw [hunion, hdB _ ht2, he₃, he₅, he₂] + change E a m ∪ E m c ∪ E c a = E m a ∪ E m c ∪ E c a + rw [hEc a m] + · change discBd (dsc (a, b, m)) = ⋃ i ∈ ({0, 4, 3} : Finset (Fin 6)), e i + rw [hunion, hdB _ ht3, he₀, he₄, he₃] + change E a b ∪ E b m ∪ E m a = E a b ∪ E m b ∪ E m a + rw [hEc b m] + +private theorem disc_side_vertex_on_boundary_or_off_disc + {S : Type} + [TopologicalSpace S] + {Γ : Painting S} + {M : Set S} + (hM : M ⊆ Γ.N) + (L : Set S → Set S) + (hline : ∀ a ∈ M, ∀ b ∈ M, a ≠ b → IsLineWithEnds (L {a, b}) a b) : + let E : S → S → Set S := fun x y => L {x, y} + let Φ : S → S → S → Set S := fun x y z => E x y ∪ E y z ∪ E z x + ∀ (𝒯 : Set (S × S × S)), + ∀ (dsc : S × S × S → Set S), + (∀ t ∈ 𝒯, discBd (dsc t) = Φ t.1 t.2.1 t.2.2) → + ∀ (a : S), + ∀ (b : S), + ∀ (c : S), + (a ∈ M) → + (b ∈ M) → + (c ∈ M) → + (a ≠ b) → + (a ≠ c) → + (b ≠ c) → + ∀ (m : S), + (m ∈ M) → + ∀ (Δ : Set S), + (a ∈ discBd Δ) → + (b ∈ discBd Δ) → + (c ∈ discBd Δ) → + (m ≠ a) → + (m ≠ b) → + (m ≠ c) → + ((m, b, c) ∈ 𝒯) → + ((a, m, c) ∈ 𝒯) → + ((a, b, m) ∈ 𝒯) → + let e : Fin 6 → Set S := fun i => L ((![{a, b}, {b, c}, {c, a}, {m, a}, {m, b}, {m, c}] : Fin + 6 → Set S) i) + let D : Fin 4 → Set S := ![Δ, dsc (m, b, c), dsc (a, m, c), dsc (a, b, m)] + (∀ {z x y : S}, z ∈ Γ.N → z ≠ x → z ≠ y → x ∈ M → y ∈ M → x ≠ y → z ∉ E x y) → + (∀ (k : Fin 4) (i : Fin 6), k ≠ 0 → i ∉ circuitChords 0 → i ∉ circuitChords k → k = + 1 ∧ i = 3 ∨ k = 2 ∧ i = 4 ∨ k = 3 ∧ i = 5) → + ∀ (k : Fin 4) (i : Fin 6), k ≠ 0 → i ∉ circuitChords 0 → i ∉ circuitChords k → ∃ z ∈ e i, z ∈ + discBd (D 0) ∧ z ∉ discBd (D k) := by + intro E Φ 𝒯 dsc hdB a b c ha hb hc hab hac hbc m hm Δ haΔ hbΔ hcΔ hma hmb hmc ht1 ht2 ht3 e D + hnotN hcase k i hk hi0 hik + rcases hcase k i hk hi0 hik with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · refine ⟨a, show a ∈ E m a from (hline m hm a ha hma).right_mem, haΔ, ?_⟩ + change a ∉ discBd (dsc (m, b, c)) + rw [hdB _ ht1] + rintro ((h1 | h1) | h1) + · exact hnotN (hM ha) hma.symm hab hm hb hmb h1 + · exact hnotN (hM ha) hab hac hb hc hbc h1 + · exact hnotN (hM ha) hac hma.symm hc hm hmc.symm h1 + · refine ⟨b, show b ∈ E m b from (hline m hm b hb hmb).right_mem, hbΔ, ?_⟩ + change b ∉ discBd (dsc (a, m, c)) + rw [hdB _ ht2] + rintro ((h1 | h1) | h1) + · exact hnotN (hM hb) hab.symm hmb.symm ha hm hma.symm h1 + · exact hnotN (hM hb) hmb.symm hbc hm hc hmc h1 + · exact hnotN (hM hb) hbc hab.symm hc ha hac.symm h1 + · refine ⟨c, show c ∈ E m c from (hline m hm c hc hmc).right_mem, hcΔ, ?_⟩ + change c ∉ discBd (dsc (a, b, m)) + rw [hdB _ ht3] + rintro ((h1 | h1) | h1) + · exact hnotN (hM hc) hac.symm hbc.symm ha hb hab h1 + · exact hnotN (hM hc) hbc.symm hmc.symm hb hm hmb.symm h1 + · exact hnotN (hM hc) hmc.symm hac.symm hm ha hma h1 + +private theorem outside_vertex_chord_disjoint_of_disc + {S : Type} + [TopologicalSpace S] + [T2Space S] + {M : Set S} + (hman : ∀ (x : S), IsManifoldPoint x) + (L : Set S → Set S) + (𝓟 : Set (Set S)) + (hline : ∀ a ∈ M, ∀ b ∈ M, a ≠ b → IsLineWithEnds (L {a, b}) a b) + (hdj : ∀ p ∈ 𝓟, ∀ q ∈ 𝓟, p ≠ q → Disjoint (L p \ p) (L q)) + (hpp : ∀ {a b : S}, a ∈ M → b ∈ M → a ≠ b → {a, b} ∈ 𝓟) : + let E : S → S → Set S := fun x y => L {x, y} + let Φ : S → S → S → Set S := fun x y z => E x y ∪ E y z ∪ E z x + (∀ {a b c d : S}, a ≠ c → a ≠ d → ({a, b} : Set S) ≠ {c, d}) → + ∀ (a : S), + ∀ (b : S), + ∀ (c : S), + (a ∈ M) → + (b ∈ M) → + (c ∈ M) → + (a ≠ b) → + (a ≠ c) → + (b ≠ c) → + ∀ (m : S), + (m ∈ M) → + ∀ (Δ : Set S), + (IsClosedDisc Δ) → + (discBd Δ = Φ a b c) → + (m ∉ Δ) → + (m ≠ a) → + (m ≠ b) → + (m ≠ c) → + ∀ (y : S), + (y ∈ M) → + (m ≠ y) → + Disjoint (E m y \ {m, y}) Δ := by + intro E Φ hpne a b c ha hb hc hab hac hbc m hm Δ hΔD hΔb hmΔ hma hmb hmc y hy hne + have hl := hline m hm y hy hne + have hoffb : Disjoint (E m y \ {m, y}) (discBd Δ) := by + rw [hΔb] + refine disjoint_left.mpr fun x hx hxb => ?_ + have hp := hpp hm hy hne + rcases hxb with (h1 | h1) | h1 + · exact disjoint_left.mp (hdj _ hp _ (hpp ha hb hab) (hpne hma hmb)) hx h1 + · exact disjoint_left.mp (hdj _ hp _ (hpp hb hc hbc) (hpne hmb hmc)) hx h1 + · exact disjoint_left.mp (hdj _ hp _ (hpp hc ha hac.symm) (hpne hmc hma)) hx h1 + rcases disc_dichotomy hman hΔD hl.isPreconnected_diff hoffb with h1 | h1 + · exact absurd (closure_minimal h1 hΔD.isClosed (hl.subset_closure_diff hl.left_mem)) hmΔ + · exact h1 + +private theorem triangle_disc_avoids_original_interior + {S : Type} + [TopologicalSpace S] + [T2Space S] + {M : Set S} + (hman : ∀ (x : S), IsManifoldPoint x) + (E : S → S → Set S) + (𝒯 : Set (S × S × S)) + (dsc : S × S × S → Set S) + (hdD : ∀ t ∈ 𝒯, IsClosedDisc (dsc t)) + (a : S) + (b : S) + (c : S) + (ha : a ∈ M) + (hb : b ∈ M) + (hc : c ∈ M) + (m : S) + (Δ : Set S) + (hmax : ∀ ⦃j : S × S × S⦄, (fun x => x ∈ 𝒯) j → Δ ⊆ dsc j → dsc j ⊆ Δ) + (hΔD : IsClosedDisc Δ) + (hmΔ : m ∉ Δ) + (haΔ : a ∈ discBd Δ) + (hbΔ : b ∈ discBd Δ) + (hcΔ : c ∈ discBd Δ) + (hma : m ≠ a) + (hmb : m ≠ b) + (hmc : m ≠ c) + (hintoff : ∀ y ∈ M, y ∈ discBd Δ → m ≠ y → Disjoint (discInt Δ) (E m y)) + (t' : S × S × S) + (ht' : t' ∈ 𝒯) + (hsub : discBd (dsc t') ⊆ discBd Δ ∪ E m a ∪ E m b ∪ E m c) + (hmb' : m ∈ discBd (dsc t')) : + Disjoint (discInt Δ) (dsc t') := by + have hoff : Disjoint (discInt Δ) (discBd (dsc t')) := disjoint_left.mpr fun x hx hxb => by + rcases hsub hxb with ((h1 | h1) | h1) | h1 + · exact hx.2 h1 + · exact disjoint_left.mp (hintoff a ha haΔ hma) hx h1 + · exact disjoint_left.mp (hintoff b hb hbΔ hmb) hx h1 + · exact disjoint_left.mp (hintoff c hc hcΔ hmc) hx h1 + rcases disc_dichotomy hman (hdD t' ht') hΔD.isPreconnected_discInt hoff with h1 | h1 + · have hsubΔ : Δ ⊆ dsc t' := hΔD.subset_closure_discInt.trans (closure_minimal h1 + (hdD t' ht').isClosed) + exact absurd (hmax ht' hsubΔ (discBd_subset _ hmb')) hmΔ + · exact h1 + +private theorem clique_chord_discs_cover + {S : Type} + [TopologicalSpace S] + [T2Space S] + {Γ : Painting S} + [ConnectedSpace S] + (hS : IsSurface S) + (L : Set S → Set S) + (𝓟 : Set (Set S)) + (hreg : ∀ p ∈ 𝓟, ∃ r ∈ Γ.regions, L p \ p ⊆ r ∧ ∀ x ∈ L p \ p, IsChordSide (L p) (L '' 𝓟) x) + (hdj : ∀ p ∈ 𝓟, ∀ q ∈ 𝓟, p ≠ q → Disjoint (L p \ p) (L q)) + (hpN : ∀ p ∈ 𝓟, p ⊆ Γ.N) + (Pp : Fin 6 → Set S) : + let e : Fin 6 → Set S := fun i => L (Pp i) + ∀ (D : Fin 4 → Set S), + (∀ (i : Fin 6), Pp i ∈ 𝓟) → + (∀ (i j : Fin 6), i ≠ j → Pp i ≠ Pp j) → + (∀ (k : Fin 4), IsClosedDisc (D k)) → + (∀ (k : Fin 4), discBd (D k) = ⋃ i ∈ circuitChords k, e i) → + (∀ (k : Fin 4), k ≠ 0 → Disjoint (discInt (D 0)) (D k)) → + (∀ p ∈ 𝓟, ∃ x y, p = {x, y} ∧ IsLineWithEnds (L p) x y) → + (∀ (k : Fin 4) (i : Fin 6), k ≠ 0 → i ∉ circuitChords 0 → i ∉ circuitChords k → ∃ z + ∈ e i, z ∈ discBd (D 0) ∧ z ∉ discBd (D k)) → + ∀ c ∈ Γ.C, ∃ k, c ⊆ D k := by + intro e D hPmem hinj hDd hDb hfree hLline hnode + exact four_discs_cover hS e Pp (fun i => hpN _ (hPmem i)) + (fun i => by + obtain ⟨x, y, hp, hl⟩ := hLline _ (hPmem i) + change Pp i ⊆ L (Pp i) + rw [hp] at hl ⊢ + rintro z (rfl | rfl) + · exact hl.left_mem + · exact hl.right_mem) + (fun i => by + obtain ⟨x, y, hp, hl⟩ := hLline _ (hPmem i) + change IsPreconnected (L (Pp i) \ Pp i) + rw [hp] at hl ⊢ + exact hl.isPreconnected_diff) + (fun i => by + obtain ⟨x, y, hp, hl⟩ := hLline _ (hPmem i) + change L (Pp i) ⊆ closure (L (Pp i) \ Pp i) + rw [hp] at hl ⊢ + exact fun z hz => hl.subset_closure_diff hz) + (fun i => by + obtain ⟨x, y, hp, hl⟩ := hLline _ (hPmem i) + change (L (Pp i) \ Pp i).Nonempty + rw [hp] at hl ⊢ + exact closure_nonempty_iff.mp ⟨x, hl.subset_closure_diff hl.left_mem⟩) + (fun i => by + obtain ⟨r, hr, hsub, -⟩ := hreg _ (hPmem i) + exact ⟨r, hr, hsub⟩) + (fun i x hx => by + obtain ⟨-, -, -, hs⟩ := hreg _ (hPmem i) + obtain ⟨V, A, B, h1, h2, h3, h4, h5, h6, h7⟩ := hs x hx + refine ⟨V, A, B, h1, h2, h3, h4, h5, h6, ?_⟩ + rintro _ ⟨j, rfl⟩ + exact h7 _ ⟨_, hPmem j, rfl⟩) + (fun i j hij => hdj _ (hPmem i) _ (hPmem j) (hinj i j hij)) D hDd hDb hfree hnode + +theorem clique_disc [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) {M : Set S} + (hM : M ⊆ Γ.N) (h3 : 3 ≤ M.ncard) + (hadj : ∀ a ∈ M, ∀ b ∈ M, a ≠ b → ∃ c ∈ Γ.C, a ∈ tilde c ∧ b ∈ tilde c) (Pr : Set S → Prop) + (h85 : ∀ F : Set S, IsOArc F → Γ.IsNormal F → (F ∩ Γ.N).ncard ≤ 3 → ∃ Δ, IsClosedDisc Δ + ∧ discBd Δ = F ∧ Pr Δ) + (hfour : ¬ ∃ D : Fin 4 → Set S, (∀ k, IsClosedDisc (D k) ∧ Γ.IsNormal (discBd (D k)) ∧ (discBd + (D k) ∩ Γ.N).ncard ≤ 3 ∧ Pr (D k)) ∧ ∀ c ∈ Γ.C, ∃ k, c ⊆ D k) : + ∃ Δ, IsClosedDisc Δ ∧ IsOArc (discBd Δ) ∧ Γ.IsNormal (discBd Δ) ∧ (discBd Δ ∩ Γ.N).ncard ≤ 3 + ∧ Pr Δ ∧ M ⊆ Δ := by + have hman := hS.2.2 + have hfinM : M.Finite := Γ.finite_N.subset hM + obtain ⟨a₀, b₀, c₀, ha₀, hb₀, hc₀, hab₀, hac₀, hbc₀⟩ := (Set.two_lt_ncard_iff hfinM).1 + (by omega : 2 < M.ncard) + obtain ⟨L, hL⟩ := exists_chords hS h hM ⟨a₀, ha₀⟩ hadj + let 𝓟 : Set (Set S) := {p | ∃ a ∈ M, ∃ b ∈ M, a ≠ b ∧ p = {a, b}} + obtain ⟨hline, hreg, hdj⟩ := hL 𝓟 rfl + have hpp : ∀ {a b}, a ∈ M → b ∈ M → a ≠ b → ({a, b} : Set S) ∈ 𝓟 := fun ha hb hab + => ⟨_, ha, _, hb, hab, rfl⟩ + have hpN : ∀ p ∈ 𝓟, p ⊆ Γ.N := by + rintro p ⟨a, ha, b, hb, -, rfl⟩ x (rfl | rfl) + · exact hM ha + · exact hM hb + have hLU : ∀ p ∈ 𝓟, L p ∩ Γ.U ⊆ p := fun p hp x hx => by + obtain ⟨r, hr, hsub, -⟩ := hreg p hp + by_contra hn + exact (arcComponentsIn_subset hr (hsub ⟨hx.1, hn⟩)).2 hx.2 + have hLN : ∀ p ∈ 𝓟, L p ∩ Γ.N ⊆ p := fun p hp x hx => hLU p hp ⟨hx.1, Γ.N_subset hx.2⟩ + have hcom : ∀ p ∈ 𝓟, ∀ q ∈ 𝓟, p ≠ q → L p ∩ L q ⊆ p ∩ q := fun p hp q hq hpq x hx => by + refine ⟨?_, ?_⟩ + · by_contra hn + exact disjoint_left.mp (hdj p hp q hq hpq) ⟨hx.1, hn⟩ hx.2 + · by_contra hn + exact disjoint_left.mp (hdj q hq p hp hpq.symm) ⟨hx.2, hn⟩ hx.1 + let E : S → S → Set S := fun x y => L {x, y} + have hEc : ∀ x y, E x y = E y x := fun x y => by + change L {x, y} = L {y, x} + rw [pair_comm] + let Φ : S → S → S → Set S := fun x y z => E x y ∪ E y z ∪ E z x + have hpne : ∀ {a b c d : S}, a ≠ c → a ≠ d → ({a, b} : Set S) ≠ {c, d} := fun {a b c d} h1 h2 he + => by + have : a ∈ ({c, d} : Set S) := he ▸ mem_insert _ _ + rcases this with h3 | h3 + · exact h1 h3 + · exact h2 h3 + have hΦ : ∀ {a b c : S}, a ∈ M → b ∈ M → c ∈ M → a ≠ b → a ≠ c → b ≠ c → IsOArc (Φ a b c) + ∧ Γ.IsNormal (Φ a b c) ∧ (Φ a b c ∩ Γ.N).ncard ≤ 3 := fun {a b c} ha hb hc hab hac hbc => by + exact triangle_is_normal_arc (S := S) (Γ := Γ) (M := M) L 𝓟 hline hpp hpN hLU hLN hcom + hpne (a := a) (b := b) (c := c) ha hb hc hab hac hbc + let 𝒯 : Set (S × S × S) := {t | t.1 ∈ M ∧ t.2.1 ∈ M ∧ t.2.2 ∈ M ∧ t.1 ≠ t.2.1 ∧ t.1 ≠ t.2.2 + ∧ t.2.1 ≠ t.2.2} + have h𝒯fin : 𝒯.Finite := (hfinM.prod (hfinM.prod hfinM)).subset fun t ht + => ⟨ht.1, ht.2.1, ht.2.2.1⟩ + have hd : ∀ t ∈ 𝒯, ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = Φ t.1 t.2.1 t.2.2 ∧ Pr Δ := fun t ht => by + obtain ⟨h1, h2, h3⟩ := hΦ ht.1 ht.2.1 ht.2.2.1 ht.2.2.2.1 ht.2.2.2.2.1 ht.2.2.2.2.2 + exact h85 _ h1 h2 h3 + choose! dsc hdD hdB hdP using hd + obtain ⟨⟨a, b, c⟩, ht, hmax⟩ := Set.Finite.exists_maximalFor dsc 𝒯 h𝒯fin ⟨(a₀, b₀, c₀), ha₀, hb₀, + hc₀, hab₀, hac₀, hbc₀⟩ + have ht0 : (a, b, c) ∈ 𝒯 := ht + obtain ⟨ha, hb, hc, hab, hac, hbc⟩ : a ∈ M ∧ b ∈ M ∧ c ∈ M ∧ a ≠ b ∧ a ≠ c ∧ b ≠ c := ht + have hΔD := hdD (a, b, c) ht0 + have hΔb : discBd (dsc (a, b, c)) = Φ a b c := hdB (a, b, c) ht0 + obtain ⟨hO, hnorm, hcard⟩ := hΦ ha hb hc hab hac hbc + refine ⟨dsc (a, b, c), hΔD, hΔb ▸ hO, hΔb ▸ hnorm, hΔb ▸ hcard, hdP _ ht0, fun m hm => ?_⟩ + by_contra hmΔ + set Δ := dsc (a, b, c) with hΔ + have haΔ : a ∈ discBd Δ := by + rw [hΔb] + exact .inl (.inl (hline a ha b hb hab).left_mem) + have hbΔ : b ∈ discBd Δ := by + rw [hΔb] + exact .inl (.inr (hline b hb c hc hbc).left_mem) + have hcΔ : c ∈ discBd Δ := by + rw [hΔb] + exact .inr (hline c hc a ha hac.symm).left_mem + have hma : m ≠ a := fun e => hmΔ (e ▸ discBd_subset _ haΔ) + have hmb : m ≠ b := fun e => hmΔ (e ▸ discBd_subset _ hbΔ) + have hmc : m ≠ c := fun e => hmΔ (e ▸ discBd_subset _ hcΔ) + have hchord : ∀ y, y ∈ M → y ∈ discBd Δ → m ≠ y → Disjoint (E m y \ {m, y}) Δ := fun y hy hyb hne + => by + exact outside_vertex_chord_disjoint_of_disc (S := S) (M := M) hman L 𝓟 hline hdj hpp hpne + a b c ha hb hc hab hac hbc m hm Δ hΔD hΔb hmΔ hma hmb hmc y hy hne + have hintoff : ∀ y, y ∈ M → y ∈ discBd Δ → m ≠ y → Disjoint (discInt Δ) (E m y) + := fun y hy hyb hne => disjoint_left.mpr fun x hx hxe => by + by_cases hxp : x ∈ ({m, y} : Set S) + · rcases hxp with rfl | rfl + · exact hmΔ hx.1 + · exact hx.2 hyb + · exact disjoint_left.mp (hchord y hy hyb hne) ⟨hxe, hxp⟩ hx.1 + have hk : ∀ t' ∈ 𝒯, discBd (dsc t') ⊆ discBd Δ ∪ E m a ∪ E m b ∪ E m c → m ∈ discBd (dsc t') + → Disjoint (discInt Δ) (dsc t') := fun t' ht' hsub hmb' => by + exact triangle_disc_avoids_original_interior (S := S) (M := M) hman E 𝒯 dsc hdD a b c ha hb hc + m Δ hmax hΔD hmΔ haΔ hbΔ hcΔ hma hmb hmc hintoff t' ht' hsub hmb' + have ht1 : (m, b, c) ∈ 𝒯 := ⟨hm, hb, hc, hmb, hmc, hbc⟩ + have ht2 : (a, m, c) ∈ 𝒯 := ⟨ha, hm, hc, hma.symm, hac, hmc⟩ + have ht3 : (a, b, m) ∈ 𝒯 := ⟨ha, hb, hm, hab, hma.symm, hmb.symm⟩ + have hbc' : E b c ⊆ discBd Δ := by rw [hΔb]; exact fun x hx => .inl (.inr hx) + have hab' : E a b ⊆ discBd Δ := by rw [hΔb]; exact fun x hx => .inl (.inl hx) + have hca' : E c a ⊆ discBd Δ := by rw [hΔb]; exact fun x hx => .inr hx + have hd1 : Disjoint (discInt Δ) (dsc (m, b, c)) := by + refine hk _ ht1 (fun x hx => ?_) ?_ + · rw [hdB _ ht1] at hx + rcases hx with (h1 | h1) | h1 + · exact .inl (.inr h1) + · exact .inl (.inl (.inl (hbc' h1))) + · exact .inr (hEc c m ▸ h1) + · rw [hdB _ ht1] + exact .inl (.inl (hline m hm b hb hmb).left_mem) + have hd2 : Disjoint (discInt Δ) (dsc (a, m, c)) := by + refine hk _ ht2 (fun x hx => ?_) ?_ + · rw [hdB _ ht2] at hx + rcases hx with (h1 | h1) | h1 + · exact .inl (.inl (.inr (hEc a m ▸ h1))) + · exact .inr h1 + · exact .inl (.inl (.inl (hca' h1))) + · rw [hdB _ ht2] + exact .inl (.inr (hline m hm c hc hmc).left_mem) + have hd3 : Disjoint (discInt Δ) (dsc (a, b, m)) := by + refine hk _ ht3 (fun x hx => ?_) ?_ + · rw [hdB _ ht3] at hx + rcases hx with (h1 | h1) | h1 + · exact .inl (.inl (.inl (hab' h1))) + · exact .inl (.inr (hEc b m ▸ h1)) + · exact .inl (.inl (.inr h1)) + · rw [hdB _ ht3] + exact .inr (hline m hm a ha hma).left_mem + let Pp : Fin 6 → Set S := ![{a, b}, {b, c}, {c, a}, {m, a}, {m, b}, {m, c}] + let e : Fin 6 → Set S := fun i => L (Pp i) + let D : Fin 4 → Set S := ![Δ, dsc (m, b, c), dsc (a, m, c), dsc (a, b, m)] + have hPmem : ∀ i, Pp i ∈ 𝓟 := fun i => by + fin_cases i + exacts [hpp ha hb hab, hpp hb hc hbc, hpp hc ha hac.symm, hpp hm ha hma, hpp hm hb hmb, hpp hm + hc hmc] + have hinj : ∀ i j, i ≠ j → Pp i ≠ Pp j := fun i j hij he => six_pairs_inj hab hac hbc hma hmb hmc + i j hij he + have hLcl : ∀ p ∈ 𝓟, IsClosed (L p) := by + rintro p ⟨x, hx, y, hy, hxy, rfl⟩ + exact (hline x hx y hy hxy).isCompact.isClosed + have hunion : ∀ x y z : Fin 6, (⋃ i ∈ ({x, y, z} : Finset (Fin 6)), e i) = e x ∪ e y ∪ e z + := fun x y z => by + ext w + simp only [mem_iUnion, Finset.mem_insert, Finset.mem_singleton, mem_union, exists_prop] + constructor + · rintro ⟨i, rfl | rfl | rfl, h1⟩ + · exact .inl (.inl h1) + · exact .inl (.inr h1) + · exact .inr h1 + · rintro ((h1 | h1) | h1) + · exact ⟨x, .inl rfl, h1⟩ + · exact ⟨y, .inr (.inl rfl), h1⟩ + · exact ⟨z, .inr (.inr rfl), h1⟩ + have hDd : ∀ k, IsClosedDisc (D k) := fun k => by + fin_cases k + exacts [hΔD, hdD _ ht1, hdD _ ht2, hdD _ ht3] + have hDb : ∀ k, discBd (D k) = ⋃ i ∈ circuitChords k, e i := fun k => by + exact tetrahedral_disc_boundaries (S := S) E hEc 𝒯 dsc hdB a b c m Δ hΔb ht1 ht2 ht3 e + rfl rfl rfl rfl rfl rfl hunion k + have hfree : ∀ k, k ≠ 0 → Disjoint (discInt (D 0)) (D k) := fun k hk0 => by + fin_cases k + · exact absurd rfl hk0 + · exact hd1 + · exact hd2 + · exact hd3 + have hLline : ∀ p ∈ 𝓟, ∃ x y, p = {x, y} ∧ IsLineWithEnds (L p) x y := by + rintro p ⟨x, hx, y, hy, hxy, rfl⟩ + exact ⟨x, y, rfl, hline x hx y hy hxy⟩ + have hnotN : ∀ {z x y : S}, z ∈ Γ.N → z ≠ x → z ≠ y → x ∈ M → y ∈ M → x ≠ y → z ∉ E x y := + fun hz h1 h2 hx hy hxy hzE => by + rcases hLN _ (hpp hx hy hxy) ⟨hzE, hz⟩ with h | h + · exact h1 h + · exact h2 h + have hcase : ∀ (k : Fin 4) (i : Fin 6), k ≠ 0 → i ∉ circuitChords 0 → i ∉ circuitChords k → + (k = 1 ∧ i = 3) ∨ (k = 2 ∧ i = 4) ∨ (k = 3 ∧ i = 5) := by decide + have hnode : ∀ k i, k ≠ 0 → i ∉ circuitChords 0 → i ∉ circuitChords k → + ∃ z ∈ e i, z ∈ discBd (D 0) ∧ z ∉ discBd (D k) := by + exact disc_side_vertex_on_boundary_or_off_disc (S := S) (Γ := Γ) (M := M) hM L hline 𝒯 dsc + hdB a b c ha hb hc hab hac hbc m hm Δ haΔ hbΔ hcΔ hma hmb hmc ht1 ht2 ht3 hnotN hcase + have hcov : ∀ c ∈ Γ.C, ∃ k, c ⊆ D k := by + exact clique_chord_discs_cover (S := S) (Γ := Γ) hS L 𝓟 hreg hdj hpN Pp D hPmem hinj hDd hDb + hfree hLline hnode + refine hfour ⟨D, fun k => ?_, hcov⟩ + fin_cases k + · exact ⟨hΔD, hΔb ▸ hnorm, hΔb ▸ hcard, hdP _ ht0⟩ + · obtain ⟨-, h2, h3⟩ := hΦ hm hb hc hmb hmc hbc + exact ⟨hdD _ ht1, (hdB _ ht1).symm ▸ h2, (hdB _ ht1).symm ▸ h3, hdP _ ht1⟩ + · obtain ⟨-, h2, h3⟩ := hΦ ha hm hc hma.symm hac hmc + exact ⟨hdD _ ht2, (hdB _ ht2).symm ▸ h2, (hdB _ ht2).symm ▸ h3, hdP _ ht2⟩ + · obtain ⟨-, h2, h3⟩ := hΦ ha hb hm hab hma.symm hmb.symm + exact ⟨hdD _ ht3, (hdB _ ht3).symm ▸ h2, (hdB _ ht3).symm ▸ h3, hdP _ ht3⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CliquePaint.lean b/LeanPool/GraphMinor/GM17/CliquePaint.lean new file mode 100644 index 0000000000..5cb6fa8aae --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CliquePaint.lean @@ -0,0 +1,344 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CliqueChord +public import LeanPool.GraphMinor.GM17.CellPartitionSystem + +/-! +# One chord for each pair of a clique of nodes + +This file builds the graph used in Claim (1) of the proof of (12.2) of Graph Minors XVII (page 198). +Let `M` be a set of nodes in which every two nodes lie on a common cell. The paper joins each pair +by an arc of `bd(cBar)`. Such an arc lies in `U(Γ)`, so a cycle of them is not `Γ`-normal. We push +each arc into the region beside it (`exists_chords`), which gives lines with the same ends that are +`Γ`-normal, and that are still disjoint off their ends. + +Each chord has two sides near each of its inner points (`IsChordSide`). This is what we use in place +of "`H` is drawn in `Σ`". +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface Painting + +variable {S : Type} [TopologicalSpace S] [T2Space S] {Γ : Painting S} + +/-- Two nodes of a cell are the ends of a side of it. A cell has at most three nodes, so the two +nodes are consecutive on one of the two lines between them. A border cell has two nodes, and only +one of its two lines lies on the cuff. -/ +theorem exists_side_pair [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) {c : Set S} {a b : + S} (hc : c ∈ Γ.C) (ha : a ∈ tilde c) (hb : b ∈ tilde c) (hab : a ≠ b) : + ∃ L r, Γ.IsSide c L a b ∧ r ∈ Γ.regions ∧ L ⊆ closure r := by + have hcS : CompactSpace S := hS.1 + have hfin := Γ.finite_tilde_cell hc + have hO := (Γ.isClosedDisc_closure_cell hc).isOArc_discBd + obtain ⟨A, B, hA, hB, hu, hi⟩ := hO.lines (Γ.tilde_subset_discBd hc ha) + (Γ.tilde_subset_discBd hc hb) hab + have hAs : A ⊆ discBd (closure c) := hu ▸ subset_union_left + have hBs : B ⊆ discBd (closure c) := hu ▸ subset_union_right + have hgap : ∀ X, IsLineWithEnds X a b → X ⊆ discBd (closure c) → (∀ x ∈ tilde c, x ∈ X → x = a + ∨ x = b) → Γ.IsGap c X a b := fun X hX hs ht => by + refine ⟨hc, hX, hs, ?_⟩ + ext x + constructor + · rintro ⟨hx, hxN⟩ + have : x ∈ tilde c := by + rw [← Γ.closure_cell_inter_N hc] + exact ⟨discBd_subset _ (hs hx), hxN⟩ + exact ht x this hx + · rintro (rfl | rfl) + · exact ⟨hX.left_mem, Γ.tilde_subset_N hc ha⟩ + · exact ⟨hX.right_mem, Γ.tilde_subset_N hc hb⟩ + have hside : ∃ L, Γ.IsSide c L a b := by + by_cases hbd : (c ∩ bd S).Nonempty + · have h2 : tilde c = {a, b} := by + have hsub : ({a, b} : Set S) ⊆ tilde c := by + rintro x (rfl | rfl) <;> assumption + exact (eq_of_subset_of_ncard_le hsub (by rw [ncard_pair hab, + (Γ.border_cell c hc hbd).1]) hfin).symm + have ht : ∀ X : Set S, ∀ x ∈ tilde c, x ∈ X → x = a ∨ x = b := fun X x hx _ => by + rw [h2] at hx + exact hx + have gA := hgap A hA hAs (ht A) + have gB := hgap B hB hBs (ht B) + rcases gap_or_border hS gA with h1 | h1 + · exact ⟨A, h1⟩ + rcases gap_or_border hS gB with h3 | h3 + · exact ⟨B, h3⟩ + exfalso + have hAB : A = B := h1.trans h3.symm + obtain ⟨z, hz, hza, hzb, -⟩ := exists_inner hA (finite_empty (α := S)) + have : z ∈ A ∩ B := ⟨hz, hAB ▸ hz⟩ + rw [hi] at this + exact this.elim hza hzb + · have hgapX : ∃ X, Γ.IsGap c X a b := by + by_cases hx : ∃ x ∈ tilde c, x ∈ A ∧ x ≠ a ∧ x ≠ b + · obtain ⟨x, hxt, hxA, hxa, hxb⟩ := hx + refine ⟨B, hgap B hB hBs fun y hy hyB => ?_⟩ + by_contra hn + push Not at hn + have hyA : y ∉ A := fun hyA => by + have : y ∈ A ∩ B := ⟨hyA, hyB⟩ + rw [hi] at this + exact this.elim hn.1 hn.2 + have hxy : x ≠ y := fun e => hyA (e ▸ hxA) + have h3 : ({a, b, x, y} : Set S) ⊆ tilde c := by + rintro z (rfl | rfl | rfl | rfl) <;> assumption + have hcard : ({a, b, x, y} : Set S).ncard = 4 := by + rw [ncard_insert_of_notMem (by simp [hab, hxa.symm, hn.1.symm]) (by simp), + ncard_insert_of_notMem (by simp [hxb.symm, hn.2.symm]) (by simp), ncard_pair hxy] + have := ncard_le_ncard h3 hfin + have := Γ.ncard_tilde_cell_le hc + omega + · push Not at hx + exact ⟨A, hgap A hA hAs fun y hy hyA => by + by_contra hn + push Not at hn + exact hn.2 (hx y hy hyA hn.1)⟩ + obtain ⟨X, hX⟩ := hgapX + rcases gap_or_border hS hX with h1 | h1 + · exact ⟨X, h1⟩ + · exfalso + obtain ⟨z, hz, hza, hzb, -⟩ := exists_inner hX.2.1 (finite_empty (α := S)) + exact hbd ⟨z, hX.mem_cell hz hza hzb, (h1 ▸ hz : z ∈ closure c ∩ bd S).2⟩ + obtain ⟨L, hL⟩ := hside + obtain ⟨-, -, r, -, -, -, -, -, -, -, hr, -, hLr, -⟩ := side_strip hS h.hopen hL isClosed_empty + (by simp) + exact ⟨L, r, hL, hr, hLr⟩ + +/-- Near the inner point `x` of the chord `E`, the surface is cut by `E` into two sides `A`, `B`, +which are off all the chords in `𝓔`. -/ +def IsChordSide (E : Set S) (𝓔 : Set (Set S)) (x : S) : Prop := + ∃ V A B, IsOpen V ∧ x ∈ V ∧ V ⊆ A ∪ B ∪ E ∧ IsPreconnected A ∧ IsPreconnected B ∧ x ∈ closure A + ∧ ∀ E' ∈ 𝓔, Disjoint A E' ∧ Disjoint B E' + +omit [T2Space S] in +theorem region_inter_N {r : Set S} (hr : r ∈ Γ.regions) : Disjoint r Γ.N := + disjoint_left.mpr fun _ hx hx' => (arcComponentsIn_subset hr hx).2 (Γ.N_subset hx') + +omit [TopologicalSpace S] [T2Space S] in +private theorem finite_node_pairs {M : Set S} (hfin : M.Finite) : + {p | ∃ a ∈ M, ∃ b ∈ M, a ≠ b ∧ p = ({a, b} : Set S)}.Finite := by + refine ((hfin.prod hfin).image fun t : S × S => ({t.1, t.2} : Set S)).subset ?_ + rintro p ⟨a, ha, b, hb, -, rfl⟩ + exact ⟨(a, b), ⟨ha, hb⟩, rfl⟩ + +/-- One chord for each pair of a clique of nodes. Each is a line with the ends of the pair, its +inner points lie in a region, chords are disjoint off their ends, and each has two sides at each +inner point. -/ +theorem exists_chords [ConnectedSpace S] (hS : IsSurface S) (h : CellHyps Γ) {M : Set S} + (hM : M ⊆ Γ.N) (hne : M.Nonempty) + (hadj : ∀ a ∈ M, ∀ b ∈ M, a ≠ b → ∃ c ∈ Γ.C, a ∈ tilde c ∧ b ∈ tilde c) : + ∃ L : Set S → Set S, ∀ 𝓟 : Set (Set S), 𝓟 = {p | ∃ a ∈ M, ∃ b ∈ M, a ≠ b ∧ p = {a, b}} → + (∀ a ∈ M, ∀ b ∈ M, a ≠ b → IsLineWithEnds (L {a, b}) a b) ∧ + (∀ p ∈ 𝓟, ∃ r ∈ Γ.regions, L p \ p ⊆ r ∧ ∀ x ∈ L p \ p, IsChordSide (L p) (L '' 𝓟) x) ∧ + (∀ p ∈ 𝓟, ∀ q ∈ 𝓟, p ≠ q → Disjoint (L p \ p) (L q)) := by + classical + have hcS : CompactSpace S := hS.1 + have hman := hS.2.2 + obtain ⟨m, hm⟩ := hne + have : Nonempty S := ⟨m⟩ + have hfinM : M.Finite := Γ.finite_N.subset hM + let P : Set (Set S) := {p | ∃ a ∈ M, ∃ b ∈ M, a ≠ b ∧ p = {a, b}} + have hPfin : P.Finite := finite_node_pairs hfinM + have hdata : ∀ p ∈ P, ∃ (a b : S) (G r c : Set S), p = {a, b} ∧ a ≠ b ∧ a ∈ M ∧ b ∈ M + ∧ Γ.IsSide c G a b ∧ r ∈ Γ.regions ∧ G ⊆ closure r := by + rintro p ⟨a, ha, b, hb, hab, rfl⟩ + obtain ⟨c, hc, hac, hbc⟩ := hadj a ha b hb hab + obtain ⟨G, r, hG, hr, hGr⟩ := exists_side_pair hS h hc hac hbc hab + exact ⟨a, b, G, r, c, rfl, hab, ha, hb, hG, hr, hGr⟩ + choose! A B G rg cl hpe hab haM hbM hside hrg hGr using hdata + have hdisc : ∀ r ∈ Γ.regions, IsClosedDisc (closure r) ∧ discBd (closure r) = closure r \ r + := fun r hr => + region_disc hS (fun r hr => (h.hreg r hr).1) hr (h.hreg r hr).2 + have hGD : ∀ p ∈ P, G p ⊆ discBd (closure (rg p)) := fun p hp x hx => by + rw [(hdisc _ (hrg p hp)).2] + exact ⟨hGr p hp hx, fun hxr => (arcComponentsIn_subset (hrg p hp) hxr).2 + ((hside p hp).1.subset_U hx)⟩ + have hsys : ∀ r ∈ Γ.regions, ∃ R Ch Cap, ChordSys (closure r) (hPfin.toFinset.filter fun p + => rg p = r) G A B R Ch Cap := fun r hr => by + refine chords_in_disc hman (hdisc r hr).1 _ (fun p hp => ?_) (fun p hp => ?_) (fun p hp + => ?_) fun p hp q hq hpq => ?_ + · have := Finset.mem_filter.1 hp + exact (hside p (by simpa using this.1)).1.2.1 + · have h1 := Finset.mem_filter.1 hp + have := hGD p (by simpa using h1.1) + rwa [h1.2] at this + · exact hab p (by simpa using (Finset.mem_filter.1 hp).1) + · have hpP : p ∈ P := by simpa using (Finset.mem_filter.1 hp).1 + have hqP : q ∈ P := by simpa using (Finset.mem_filter.1 hq).1 + rintro x ⟨hxp, hxq⟩ + by_cases hxN : x ∈ Γ.N + · have h1 : x ∈ G p ∩ Γ.N := ⟨hxp, hxN⟩ + have h2 : x ∈ G q ∩ Γ.N := ⟨hxq, hxN⟩ + rw [(hside p hpP).1.2.2.2] at h1 + rw [(hside q hqP).1.2.2.2] at h2 + exact ⟨h1, h2⟩ + · exfalso + obtain ⟨-, hGpq⟩ := (hside p hpP).1.unique (hside q hqP).1 hxp hxq hxN + apply hpq + have e1 := (hside p hpP).1.2.2.2 + have e2 := (hside q hqP).1.2.2.2 + rw [hpe p hpP, hpe q hqP, ← e1, ← e2, hGpq] + choose! Rr Ch Cap hs using hsys + let s : Set S → Finset (Set S) := fun r => hPfin.toFinset.filter fun p => rg p = r + have hmem : ∀ p ∈ P, p ∈ s (rg p) := fun p hp => Finset.mem_filter.2 ⟨by simpa using hp, rfl⟩ + have hmem' : ∀ {p r}, p ∈ s r → p ∈ P ∧ rg p = r := fun {p r} hp => by + have := Finset.mem_filter.1 hp + exact ⟨by simpa using this.1, this.2⟩ + let L : Set S → Set S := fun p => Ch (rg p) p + let C : Set S → Set S := fun p => Cap (rg p) p + have hsp : ∀ p ∈ P, ChordSys (closure (rg p)) (s (rg p)) G A B (Rr (rg p)) (Ch (rg p)) (Cap + (rg p)) := fun p hp => hs _ (hrg p hp) + have hLC : ∀ p ∈ P, L p ⊆ C p := fun p hp x hx => by + have : x ∈ Cap (rg p) p ∩ Rr (rg p) := by + rw [(hsp p hp).capR p (hmem p hp)] + exact hx + exact this.1 + have hRD : ∀ r ∈ Γ.regions, Rr r ⊆ closure r := fun r hr => by + have := (hs r hr).cover + intro x hx + rw [this] + exact .inl hx + have hCD : ∀ p ∈ P, C p ⊆ closure (rg p) := fun p hp x hx => by + rw [(hsp p hp).cover] + exact .inr (mem_biUnion (hmem p hp) hx) + have hLe : ∀ p ∈ P, p = {A p, B p} := hpe + have hLl : ∀ p ∈ P, IsLineWithEnds (L p) (A p) (B p) := fun p hp => (hsp p hp).line p (hmem p hp) + have hinner : ∀ p ∈ P, L p \ p ⊆ rg p := fun p hp x hx => by + have hxD : x ∈ closure (rg p) := hCD p hp (hLC p hp hx.1) + by_contra hn + have hb : x ∈ discBd (closure (rg p)) := by + rw [(hdisc _ (hrg p hp)).2] + exact ⟨hxD, hn⟩ + have h1 := (hsp p hp).capD p (hmem p hp) ⟨hLC p hp hx.1, hb⟩ + have h2 : x ∈ G p ∩ Ch (rg p) p := ⟨h1, hx.1⟩ + rw [(hsp p hp).inter p (hmem p hp)] at h2 + exact hx.2 (by rw [hpe p hp]; exact h2) + have hNp : ∀ p ∈ P, p ⊆ Γ.N := fun p hp x hx => by + rw [hpe p hp] at hx + rcases hx with rfl | rfl + · exact hM (haM p hp) + · exact hM (hbM p hp) + have hoff : ∀ p ∈ P, ∀ q ∈ P, rg p ≠ rg q → Disjoint (rg p) (L q) := fun p hp q hq hr + => disjoint_left.mpr fun x hx hxq => by + by_cases hxp : x ∈ q + · exact disjoint_left.mp (region_inter_N (hrg p hp)) hx (hNp q hq hxp) + · exact hr (region_eq (hrg p hp) (hrg q hq) hx (hinner q hq ⟨hxq, hxp⟩)) + have hsame : ∀ p ∈ P, ∀ q ∈ P, p ≠ q → rg p = rg q → C p ∩ C q ⊆ p := fun p hp q hq hpq hr => by + have hq' : q ∈ s (rg p) := by rw [hr]; exact hmem q hq + have := (hsp p hp).pair p (hmem p hp) q hq' hpq + intro x hx + have hx' : x ∈ Cap (rg p) p ∩ Cap (rg p) q := ⟨hx.1, by have := hx.2; simpa only [C, hr] using + this⟩ + rw [hpe p hp] + exact (this hx').1 + have hdj : ∀ p ∈ P, ∀ q ∈ P, p ≠ q → Disjoint (L p \ p) (L q) := fun p hp q hq hpq + => disjoint_left.mpr fun x hx hxq => by + by_cases hr : rg p = rg q + · exact hx.2 (hsame p hp q hq hpq hr ⟨hLC p hp hx.1, hLC q hq hxq⟩) + · exact disjoint_left.mp (hoff p hp q hq hr) (hinner p hp hx) hxq + refine ⟨L, fun 𝓟 h𝓟 => ?_⟩ + obtain rfl : 𝓟 = P := h𝓟 + refine ⟨fun a ha b hb hne' => ?_, fun p hp => ⟨rg p, hrg p hp, hinner p hp, fun x hx => ?_⟩, hdj⟩ + · have hp : ({a, b} : Set S) ∈ P := ⟨a, ha, b, hb, hne', rfl⟩ + have h1 := hLl _ hp + have h2 := hpe _ hp + have hA : A {a, b} = a ∨ A {a, b} = b := (Set.ext_iff.1 h2 _).2 (Or.inl rfl) + have hB : B {a, b} = a ∨ B {a, b} = b := (Set.ext_iff.1 h2 _).2 (Or.inr rfl) + have hne2 := hab _ hp + rcases hA with e1 | e1 <;> rcases hB with e2 | e2 + · exact absurd (e1.trans e2.symm) hne2 + · rwa [e1, e2] at h1 + · rw [e1, e2] at h1 + exact h1.symm + · exact absurd (e1.trans e2.symm) hne2 + · have hsysp := hsp p hp + have hmp := hmem p hp + have hr := hrg p hp + have hDb := (hdisc _ hr).2 + let r := rg p + have hdiscInt : ∀ Y, IsClosedDisc Y → Y ⊆ closure r → discInt Y ⊆ r := fun Y hY hYs x hx => by + have := discInt_mono hman hY hYs hx + by_contra hn + exact this.2 (by rw [hDb]; exact ⟨this.1, hn⟩) + have hAoff : ∀ q ∈ P, Disjoint (discInt (C p)) (L q) := fun q hq => disjoint_left.mpr fun y hy + hyq => by + by_cases he : q = p + · subst he + exact hy.2 (by rw [hsysp.capb q hmp]; exact .inr hyq) + by_cases hre : rg p = rg q + · have h3 := hsame p hp q hq (Ne.symm he) hre ⟨hy.1, hLC q hq hyq⟩ + have h4 : y ∈ L p := by + rw [hpe p hp] at h3 + rcases h3 with rfl | rfl + · exact (hLl p hp).left_mem + · exact (hLl p hp).right_mem + exact hy.2 (by rw [hsysp.capb p hmp]; exact .inr h4) + · exact disjoint_left.mp (hoff p hp q hq hre) (hdiscInt _ (hsysp.cap p hmp) (hCD p hp) hy) hyq + have hBoff : ∀ q ∈ P, Disjoint (discInt (Rr r)) (L q) := fun q hq + => disjoint_left.mpr fun y hy hyq => by + by_cases hre : rg p = rg q + · have h2 : L q ⊆ discBd (Rr r) := by + have := (hs (rg q) (hrg q hq)).chR q (hmem q hq) + simpa only [r, hre] using this + exact hy.2 (h2 hyq) + · exact disjoint_left.mp (hoff p hp q hq hre) (hdiscInt _ hsysp.hR (hRD r hr) hy) hyq + let W : Set S := ⋃ q ∈ (s r).erase p, Cap r q + have hWc : IsClosed W := isClosed_biUnion_finset fun q hq => (hsysp.cap q + (Finset.mem_of_mem_erase hq)).isClosed + refine ⟨r \ W, discInt (C p), discInt (Rr r), (h.hreg r hr).1.1.sdiff hWc, ⟨hinner p hp hx, + ?_⟩, ?_, (hsysp.cap p hmp).isPreconnected_discInt, hsysp.hR.isPreconnected_discInt, + (hsysp.cap p hmp).subset_closure_discInt (hLC p hp hx.1), ?_⟩ + · intro hxW + obtain ⟨q, hq, hxq⟩ := mem_iUnion₂.1 hxW + obtain ⟨hqs, hqr⟩ := hmem' (Finset.mem_of_mem_erase hq) + have hxq' : x ∈ C q := by + change x ∈ Cap (rg q) q + rw [hqr] + exact hxq + exact hx.2 (hsame p hp q hqs (Finset.ne_of_mem_erase hq).symm hqr.symm ⟨hLC p hp hx.1, hxq'⟩) + · rintro y ⟨hyr, hyW⟩ + have hyD : y ∈ closure r := subset_closure hyr + have hnb : y ∉ discBd (closure r) := fun hb => (by rw [hDb] at hb; exact hb.2 hyr) + have hoffW : ∀ i ∈ s r, i ≠ p → y ∉ Cap r i := fun i hi hip hy' => hyW (mem_biUnion + (Finset.mem_erase.2 ⟨hip, hi⟩) hy') + rw [hsysp.cover] at hyD + rcases hyD with hyR | hyU + · by_cases hyb : y ∈ discBd (Rr r) + · rcases hsysp.bdR hyb with h1 | h1 + · obtain ⟨i, hi, h2⟩ := mem_iUnion₂.1 h1 + by_cases hip : i = p + · subst hip + exact .inr h2 + · exfalso + refine hoffW i hi hip ?_ + have h3 : y ∈ Cap r i ∩ Rr r := by + rw [hsysp.capR i hi] + exact h2 + exact h3.1 + · exact absurd h1 hnb + · exact .inl (.inr ⟨hyR, hyb⟩) + · obtain ⟨i, hi, h2⟩ := mem_iUnion₂.1 hyU + by_cases hip : i = p + · subst hip + by_cases hyb : y ∈ discBd (Cap r i) + · rw [hsysp.capb i hi] at hyb + rcases hyb with h3 | h3 + · exact absurd (hGD i hp h3) hnb + · exact .inr h3 + · exact .inl (.inl ⟨h2, hyb⟩) + · exact absurd h2 (hoffW i hi hip) + · rintro _ ⟨q, hq, rfl⟩ + exact ⟨hAoff q hq, hBoff q hq⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CliqueSphere.lean b/LeanPool/GraphMinor/GM17/CliqueSphere.lean new file mode 100644 index 0000000000..6e8dc3a254 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CliqueSphere.lean @@ -0,0 +1,244 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CliquePaint +import LeanPool.GraphMinor.GM07.GoodEdge +import LeanPool.GraphMinor.Surface.SurfacePull + +/-! +# Four discs around four nodes form a sphere + +In the proof of (12.2) of Graph Minors XVII (page 198), four circuits of length 3 on four nodes +bound discs `Δ(C)`, `Δ(C₁)`, `Δ(C₂)`, `Δ(C₃)`, none of the last three including `Δ(C)`. The paper +says that their union "is a sphere, and hence equals `Σ`". We prove this (`four_discs_cover`). + +The union is closed. We show that it is a neighbourhood of each of its points other than the four +nodes. A point inside one of the discs is inside the union. A point `x` of a chord, other than its +ends, lies on the boundaries of exactly two of the discs, and near `x` the chord has two sides. +Each of the two discs takes one side, and they take different sides, since no two of the discs +share a point inside. So near `x` the two discs cover everything. Hence the union is open in the +connected set of interior points of `Σ` other than the four nodes, so it contains that set, and +taking closures, it is all of `Σ`. Finally each cell is connected and misses the chords, so it +lies in one of the discs. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface Painting + +variable {S : Type} [TopologicalSpace S] [T2Space S] {Γ : Painting S} + +/-- Which of six chords lie on which of four circuits. With the chords `ab, bc, ca, da, db, dc` +the circuits are `abc`, `dbc`, `adc`, `abd`. -/ +def circuitChords : Fin 4 → Finset (Fin 6) := ![{0, 1, 2}, {4, 1, 5}, {3, 5, 2}, {0, 4, 3}] + +/-- **The four discs are all of `Σ`, so every cell lies in one of them** (Graph Minors XVII, +(12.2), claim (1), page 198). Here `e i` are the six chords, with ends `P i`, and `D k` are the +four discs, bounded by the chords `circuitChords k`. The discs `D 1, D 2, D 3` miss the inside of +`D 0`. Each chord that is not on the boundary of `D 0` or of `D k` has an end on the boundary of +`D 0` that is not on the boundary of `D k`. -/ +theorem four_discs_cover [ConnectedSpace S] (hS : IsSurface S) (e P : Fin 6 → Set S) + (hP : ∀ i, P i ⊆ Γ.N) (hPe : ∀ i, P i ⊆ e i) (hpre : ∀ i, IsPreconnected (e i \ P i)) + (hecl : ∀ i, e i ⊆ closure (e i \ P i)) (hne : ∀ i, (e i \ P i).Nonempty) + (hreg : ∀ i, ∃ r ∈ Γ.regions, e i \ P i ⊆ r) + (hside : ∀ i, ∀ x ∈ e i \ P i, IsChordSide (e i) (range e) x) + (hdj : ∀ i j, i ≠ j → Disjoint (e i \ P i) (e j)) + (D : Fin 4 → Set S) (hD : ∀ k, IsClosedDisc (D k)) + (hb : ∀ k, discBd (D k) = ⋃ i ∈ circuitChords k, e i) + (hfree : ∀ k, k ≠ 0 → Disjoint (discInt (D 0)) (D k)) + (hnode : ∀ k i, k ≠ 0 → i ∉ circuitChords 0 → i ∉ circuitChords k → + ∃ z ∈ e i, z ∈ discBd (D 0) ∧ z ∉ discBd (D k)) : + ∀ c ∈ Γ.C, ∃ k, c ⊆ D k := by + have hman := hS.2.2 + let U : Set S := ⋃ k, D k + have hUc : IsClosed U := isClosed_iUnion_of_finite fun k => (hD k).isClosed + have hcc2 : ∀ i : Fin 6, ∃ k l, k ≠ l ∧ i ∈ circuitChords k ∧ i ∈ circuitChords l := by decide + have hcc0 : ∀ i : Fin 6, ∃ k, k ≠ 0 ∧ i ∈ circuitChords k := by decide + have hccD0 : ∀ k : Fin 4, k ≠ 0 → ∃ j, j ∈ circuitChords k ∧ j ∈ circuitChords 0 := by decide + have hccD0' : ∀ (k l : Fin 4) (j : Fin 6), k ≠ 0 → l ≠ 0 → k ≠ l → j ∈ circuitChords k → + j ∈ circuitChords 0 → j ∉ circuitChords l := by decide + have hebd : ∀ k i, i ∈ circuitChords k → e i ⊆ discBd (D k) := fun k i hi => by + rw [hb k] + exact subset_biUnion_of_mem (u := e) (Finset.mem_coe.2 hi) + have hoffbd : ∀ k i, i ∉ circuitChords k → Disjoint (e i \ P i) (discBd (D k)) := fun k i hi => by + rw [hb k] + refine disjoint_left.mpr fun x hx hx' => ?_ + obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.1 hx' + exact disjoint_left.mp (hdj i j fun h => hi (h ▸ hj)) hx hxj + have hdisjW : ∀ {A : Set S}, (∀ i, Disjoint A (e i)) → ∀ k, Disjoint A (discBd (D k)) := + fun {A} hA k => by + rw [hb k] + exact disjoint_left.mpr fun x hx hxb => by + obtain ⟨i, -, h2⟩ := mem_iUnion₂.1 hxb + exact disjoint_left.mp (hA i) hx h2 + have hopen : ∀ k, IsOpen (discInt (D k)) := fun k => (hD k).isOpen_discInt hman + have hcl0 : ∀ k, k ≠ 0 → Disjoint (discInt (D k)) (D 0) := fun k hk => by + have h1 : Disjoint (discInt (D k)) (discInt (D 0)) := + disjoint_left.mpr fun x hx hx0 => disjoint_left.mp (hfree k hk) hx0 hx.1 + exact (h1.closure_right (hopen k)).mono_right (hD 0).subset_closure_discInt + -- No chord meets the inside of a disc. + have hoff : ∀ k i, Disjoint (discInt (D k)) (e i) := by + intro k i + by_cases hk : k = 0 + · subst hk + obtain ⟨l, hl, hil⟩ := hcc0 i + exact disjoint_left.mpr fun x hx hxe => + disjoint_left.mp (hfree l hl) hx (discBd_subset _ (hebd l i hil hxe)) + by_cases hi0 : i ∈ circuitChords 0 + · exact (hcl0 k hk).mono_right ((hebd 0 i hi0).trans (discBd_subset _)) + by_cases hik : i ∈ circuitChords k + · exact disjoint_left.mpr fun x hx hxe => hx.2 (hebd k i hik hxe) + rcases disc_dichotomy hman (hD k) (hpre i) (hoffbd k i hik) with h1 | h1 + · exfalso + obtain ⟨z, hze, hz0, hzk⟩ := hnode k i hk hi0 hik + have hzD : z ∈ D k := closure_minimal h1 (hD k).isClosed (hecl i hze) + exact disjoint_left.mp (hcl0 k hk) ⟨hzD, hzk⟩ (discBd_subset _ hz0) + · have h2 : Disjoint (discInt (D k)) (e i \ P i) := h1.symm.mono_left fun x hx => hx.1 + exact (h2.closure_right (hopen k)).mono_right (hecl i) + -- Two of the discs cannot lie on the same side of a chord. + have hside2 : ∀ A : Set S, A.Nonempty → (∀ i, Disjoint A (e i)) → ∀ k l, k ≠ l → + A ⊆ D k → A ⊆ D l → False := by + intro A hA hAe k l hkl hk hl + have hAint : ∀ m, A ⊆ D m → A ⊆ discInt (D m) := fun m hm x hx => + ⟨hm hx, disjoint_left.mp (hdisjW hAe m) hx⟩ + obtain ⟨x, hx⟩ := hA + by_cases hk0 : k = 0 + · subst hk0 + exact disjoint_left.mp (hfree l (Ne.symm hkl)) (hAint 0 hk hx) (hl hx) + by_cases hl0 : l = 0 + · subst hl0 + exact disjoint_left.mp (hfree k hkl) (hAint 0 hl hx) (hk hx) + have hbdk : Disjoint (discInt (D k)) (discBd (D l)) := + (hdisjW (A := discInt (D k)) (hoff k) l) + rcases disc_dichotomy hman (hD l) (hD k).isPreconnected_discInt hbdk with h1 | h1 + · have hkl' : D k ⊆ D l := + (hD k).subset_closure_discInt.trans (closure_minimal h1 (hD l).isClosed) + obtain ⟨j, hjk, hj0⟩ := hccD0 k hk0 + obtain ⟨y, hy⟩ := hne j + have hyl : y ∈ D l := hkl' (discBd_subset _ (hebd k j hjk hy.1)) + have hyb : y ∈ discBd (D l) := by + by_contra hn + exact disjoint_left.mp (hoff l j) ⟨hyl, hn⟩ hy.1 + exact disjoint_left.mp (hoffbd l j (hccD0' k l j hk0 hl0 hkl hjk hj0)) hy hyb + · exact disjoint_left.mp h1 (hAint k hk hx) (hl hx) + -- Near a point of a chord other than its ends, the union covers everything. + have hchordint : ∀ i, ∀ x ∈ e i \ P i, x ∈ interior U := by + intro i x hx + obtain ⟨r, hr, hsub⟩ := hreg i + have hint : IsInteriorPoint x := by + by_contra hn + exact (arcComponentsIn_subset hr (hsub hx)).2 (Γ.bd_subset hn) + obtain ⟨V, A, B, hV, hxV, hVs, hA, hB, hclA, hoffAB⟩ := hside i x hx + have hAe : ∀ j, Disjoint A (e j) := fun j => (hoffAB _ ⟨j, rfl⟩).1 + have hBe : ∀ j, Disjoint B (e j) := fun j => (hoffAB _ ⟨j, rfl⟩).2 + obtain ⟨k, l, hkl, hik, hil⟩ := hcc2 i + have hflip : ∀ m, i ∈ circuitChords m → + (A ⊆ D m ∧ Disjoint B (D m)) ∨ (B ⊆ D m ∧ Disjoint A (D m)) := fun m hm => + disc_flip hman (hD m) (hebd m i hm hx.1) hint hV hxV + (hVs.trans (union_subset_union_right _ (hebd m i hm))) hA hB (hdisjW hAe m) + (hdisjW hBe m) + have hBne : ∀ m, i ∈ circuitChords m → Disjoint A (D m) → B.Nonempty := fun m hm hAm => by + have hxD : x ∈ closure (discInt (D m)) := + (hD m).subset_closure_discInt (discBd_subset _ (hebd m i hm hx.1)) + obtain ⟨y, hyV, hy⟩ := mem_closure_iff.mp hxD V hV hxV + rcases hVs hyV with (h1 | h1) | h1 + · exact absurd hy.1 (disjoint_left.mp hAm h1) + · exact ⟨y, h1⟩ + · exact absurd h1 (disjoint_left.mp (hoff m i) hy) + have hAne : A.Nonempty := closure_nonempty_iff.mp ⟨x, hclA⟩ + have heU : ∀ m, i ∈ circuitChords m → e i ⊆ U := fun m hm y hy => + mem_iUnion.2 ⟨m, discBd_subset _ (hebd m i hm hy)⟩ + have hcover : V ⊆ U := by + rcases hflip k hik with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> + rcases hflip l hil with ⟨h3, h4⟩ | ⟨h3, h4⟩ + · exact (hside2 A hAne hAe k l hkl h1 h3).elim + · intro y hy + rcases hVs hy with (h5 | h5) | h5 + · exact mem_iUnion.2 ⟨k, h1 h5⟩ + · exact mem_iUnion.2 ⟨l, h3 h5⟩ + · exact heU k hik h5 + · intro y hy + rcases hVs hy with (h5 | h5) | h5 + · exact mem_iUnion.2 ⟨l, h3 h5⟩ + · exact mem_iUnion.2 ⟨k, h1 h5⟩ + · exact heU k hik h5 + · exact (hside2 B (hBne k hik h2) hBe k l hkl h1 h3).elim + exact interior_maximal hcover hV hxV + -- The union is a neighbourhood of each of its points other than the ends of the chords. + let F : Set S := ⋃ i, P i + have hFfin : F.Finite := Γ.finite_N.subset (iUnion_subset hP) + have hFU : F ⊆ U := fun x hx => by + obtain ⟨i, hi⟩ := mem_iUnion.1 hx + obtain ⟨k, -, hik⟩ := hcc0 i + exact mem_iUnion.2 ⟨k, discBd_subset _ (hebd k i hik (hPe i hi))⟩ + have hUint : ∀ x ∈ U, x ∉ F → x ∈ interior U := fun x hx hxF => by + obtain ⟨k, hk⟩ := mem_iUnion.1 hx + by_cases hxb : x ∈ discBd (D k) + · rw [hb k] at hxb + obtain ⟨i, -, hxi⟩ := mem_iUnion₂.1 hxb + exact hchordint i x ⟨hxi, fun h => hxF (mem_iUnion.2 ⟨i, h⟩)⟩ + · have hdiscSub : discInt (D k) ⊆ U := fun _ hy => mem_iUnion.2 ⟨k, hy.1⟩ + exact interior_maximal hdiscSub (hopen k) ⟨hk, hxb⟩ + -- So the union contains every interior point other than the ends of the chords. + have hsub : (bd S)ᶜ \ F ⊆ U := by + have hpc := GM07.isPreconnected_interior_sdiff_finite hS hFfin + rcases hpc.subset_or_subset isOpen_interior hUc.isOpen_compl + (disjoint_left.mpr fun x hx hx' => hx' (interior_subset hx)) + (fun x hx => by + by_cases hxU : x ∈ U + · exact .inl (hUint x hxU hx.2) + · exact .inr hxU) with h1 | h1 + · exact h1.trans interior_subset + · exfalso + obtain ⟨x₀, hx₀⟩ := hne 0 + obtain ⟨r, hr, hsr⟩ := hreg 0 + have hint : IsInteriorPoint x₀ := by + by_contra hn + exact (arcComponentsIn_subset hr (hsr hx₀)).2 (Γ.bd_subset hn) + have hx₀F : x₀ ∉ F := fun h => by + obtain ⟨j, hj⟩ := mem_iUnion.1 h + by_cases hj0 : j = 0 + · subst hj0 + exact hx₀.2 hj + · exact disjoint_left.mp (hdj 0 j (Ne.symm hj0)) hx₀ (hPe j hj) + exact h1 ⟨fun h => h hint, hx₀F⟩ (interior_subset (hchordint 0 x₀ hx₀)) + -- Taking closures, the union is all of `Σ`. + have hall : ∀ x, x ∈ U := by + intro x + by_cases hxF : x ∈ F + · exact hFU hxF + by_cases hxb : x ∈ bd S + · have hcl := mem_closure_compl_bd (hman x) + have hx' : x ∈ closure ((bd S)ᶜ \ F) := by + rw [mem_closure_iff] at hcl ⊢ + intro O hO hxO + obtain ⟨y, hyO, hy⟩ := hcl (O ∩ Fᶜ) (hO.inter hFfin.isClosed.isOpen_compl) ⟨hxO, hxF⟩ + exact ⟨y, hyO.1, hy, hyO.2⟩ + exact closure_minimal hsub hUc hx' + · exact hsub ⟨hxb, hxF⟩ + -- Each cell misses the chords, so it lies in one disc. + have hoffU : ∀ i, e i ∩ Γ.U ⊆ Γ.N := fun i x hx => by + by_contra hn + obtain ⟨r, hr, hsub⟩ := hreg i + exact (arcComponentsIn_subset hr (hsub ⟨hx.1, fun h1 => hn (hP i h1)⟩)).2 hx.2 + have hcellW : ∀ c ∈ Γ.C, ∀ i, Disjoint c (e i) := fun c hc i => + disjoint_left.mpr fun x hx hxi => + disjoint_left.mp (Γ.cell_disjoint_N hc) hx (hoffU i ⟨hxi, Γ.cell_subset_U hc hx⟩) + intro c hc + have hcp : IsPreconnected c := (arcComponentsIn_isPathConnected hc).isConnected.isPreconnected + obtain ⟨z, hz⟩ := arcComponentsIn_nonempty hc + obtain ⟨k, hk⟩ := mem_iUnion.1 (hall z) + rcases disc_dichotomy hman (hD k) hcp (hdisjW (hcellW c hc) k) with h1 | h1 + · exact ⟨k, h1⟩ + · exact absurd hk (disjoint_left.mp h1 hz) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CuffOrder.lean b/LeanPool/GraphMinor/GM17/CuffOrder.lean new file mode 100644 index 0000000000..609ba87c52 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CuffOrder.lean @@ -0,0 +1,798 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Basic +import Mathlib.Analysis.Convex.PathConnected +import Mathlib.Analysis.SpecialFunctions.Complex.Circle +import Mathlib.Data.Finset.Sort +import LeanPool.GraphMinor.Surface.Circle + +/-! +# Circular Order on Cuffs and Cuff Enumerations in Paintings + +This file proves the properties of circular order `GM19.InOrderOn` on a cuff $\Theta$ (cyclic +shifts, reversal, and index orderings) and constructs the canonical cyclic enumeration +`Painting.CuffEnumeration` of the nodes and border cells around any cuff $\Theta$ of a painting +$\Gamma$ in a surface $S$. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface +open GraphMinor.GM19 + +universe u + +/-! ## 1. Properties of `GM19.cuffPoint` and `GM19.InOrderOn` -/ + +section CuffPoint + +variable {S : Type u} [TopologicalSpace S] {Θ : Set S} + +theorem cuffPoint_mem (f : Circle ≃ₜ Θ) (t : ℝ) : cuffPoint f t ∈ Θ := + (f (Circle.exp t)).2 + +theorem cuffPoint_continuous (f : Circle ≃ₜ Θ) : Continuous (cuffPoint f) := + continuous_subtype_val.comp (f.continuous.comp Circle.exp.continuous) + +theorem cuffPoint_eq_iff (f : Circle ≃ₜ Θ) {t₁ t₂ : ℝ} : + cuffPoint f t₁ = cuffPoint f t₂ ↔ ∃ m : ℤ, t₁ = t₂ + m * (2 * Real.pi) := by + simp only [cuffPoint] + constructor + · intro h + have h1 : f (Circle.exp t₁) = f (Circle.exp t₂) := Subtype.ext h + have h2 : Circle.exp t₁ = Circle.exp t₂ := f.injective h1 + rw [Circle.exp_eq_exp] at h2 + exact h2 + · rintro ⟨m, rfl⟩ + have h2 : Circle.exp (t₂ + m * (2 * Real.pi)) = Circle.exp t₂ := + Circle.exp_eq_exp.mpr ⟨m, rfl⟩ + rw [h2] + +theorem cuffPoint_add_two_pi (f : Circle ≃ₜ Θ) (t : ℝ) : + cuffPoint f (t + 2 * Real.pi) = cuffPoint f t := + (cuffPoint_eq_iff f).mpr ⟨1, by push_cast; ring⟩ + +theorem cuffPoint_sub_two_pi (f : Circle ≃ₜ Θ) (t : ℝ) : + cuffPoint f (t - 2 * Real.pi) = cuffPoint f t := + (cuffPoint_eq_iff f).mpr ⟨-1, by push_cast; ring⟩ + +theorem cuffPoint_injOn_Ico (f : Circle ≃ₜ Θ) (t₀ : ℝ) : + InjOn (cuffPoint f) (Ico t₀ (t₀ + 2 * Real.pi)) := by + intro t₁ ht₁ t₂ ht₂ h + obtain ⟨m, rfl⟩ := (cuffPoint_eq_iff f).mp h + have hpi : 0 < 2 * Real.pi := by positivity + have hm0 : m = 0 := by + by_contra hm + rcases lt_or_gt_of_ne hm with hlt | hgt + · have hm_le : (m : ℝ) ≤ -1 := by exact_mod_cast Int.le_sub_one_of_lt hlt + have : (m : ℝ) * (2 * Real.pi) ≤ -1 * (2 * Real.pi) := + mul_le_mul_of_nonneg_right hm_le hpi.le + linarith [ht₁.1, ht₂.2] + · have hm_ge : (1 : ℝ) ≤ m := by exact_mod_cast hgt + have : 1 * (2 * Real.pi) ≤ (m : ℝ) * (2 * Real.pi) := + mul_le_mul_of_nonneg_right hm_ge hpi.le + linarith [ht₁.2, ht₂.1] + simp [hm0] + +theorem exists_cuffPoint_mem_Ico (f : Circle ≃ₜ Θ) (t₀ : ℝ) {x : S} (hx : x ∈ Θ) : + ∃ t ∈ Ico t₀ (t₀ + 2 * Real.pi), cuffPoint f t = x := by + let z : Circle := f.symm ⟨x, hx⟩ + have hz : (f z).1 = x := congrArg Subtype.val (f.apply_symm_apply ⟨x, hx⟩) + let θ₀ : ℝ := Complex.arg (z : ℂ) + have hexp₀ : Circle.exp θ₀ = z := Circle.exp_arg z + have hpi : 0 < 2 * Real.pi := by positivity + let m : ℤ := ⌊(θ₀ - t₀) / (2 * Real.pi)⌋ + let t : ℝ := θ₀ - m * (2 * Real.pi) + have hm_le : (m : ℝ) ≤ (θ₀ - t₀) / (2 * Real.pi) := Int.floor_le _ + have hm_lt : (θ₀ - t₀) / (2 * Real.pi) < (m : ℝ) + 1 := Int.lt_floor_add_one _ + have h1 : (m : ℝ) * (2 * Real.pi) ≤ θ₀ - t₀ := (le_div_iff₀ hpi).mp hm_le + have h2 : θ₀ - t₀ < ((m : ℝ) + 1) * (2 * Real.pi) := (div_lt_iff₀ hpi).mp hm_lt + refine ⟨t, ⟨by linarith, by linarith⟩, ?_⟩ + have h_eq : cuffPoint f t = cuffPoint f θ₀ := + (cuffPoint_eq_iff f).mpr ⟨-m, by push_cast; ring⟩ + rw [h_eq, cuffPoint, hexp₀, hz] + +/-- Every `O`-arc is infinite. -/ +theorem infinite_of_isOArc (hΘ : IsOArc Θ) : Θ.Infinite := + hΘ.infinite + +/-! ### Symmetries of `GM19.InOrderOn` -/ + +/-- Cyclic permutation of `GM19.InOrderOn`: if $n_1, n_2, n_3, n_4$ are in order on $\Theta$, +then $n_2, n_3, n_4, n_1$ are in order on $\Theta$. -/ +theorem inOrderOn_cyclic {n₁ n₂ n₃ n₄ : S} (h : InOrderOn Θ n₁ n₂ n₃ n₄) : + InOrderOn Θ n₂ n₃ n₄ n₁ := by + rcases h with ⟨f, t₁, t₂, t₃, t₄, h12, h23, h34, h41, hn₁, hn₂, hn₃, hn₄⟩ + refine ⟨f, t₂, t₃, t₄, t₁ + 2 * Real.pi, h23, h34, h41, by linarith, + hn₂, hn₃, hn₄, ?_⟩ + rw [cuffPoint_add_two_pi, hn₁] + +theorem inOrderOn_cyclic2 {n₁ n₂ n₃ n₄ : S} (h : InOrderOn Θ n₁ n₂ n₃ n₄) : + InOrderOn Θ n₃ n₄ n₁ n₂ := + inOrderOn_cyclic (inOrderOn_cyclic h) + +theorem inOrderOn_cyclic3 {n₁ n₂ n₃ n₄ : S} (h : InOrderOn Θ n₁ n₂ n₃ n₄) : + InOrderOn Θ n₄ n₁ n₂ n₃ := + inOrderOn_cyclic (inOrderOn_cyclic2 h) + +/-- Reversal symmetry of `GM19.InOrderOn`: if $n_1, n_2, n_3, n_4$ are in order on $\Theta$, +then $n_4, n_3, n_2, n_1$ are in order on $\Theta$. -/ +theorem inOrderOn_rev {n₁ n₂ n₃ n₄ : S} (h : InOrderOn Θ n₁ n₂ n₃ n₄) : + InOrderOn Θ n₄ n₃ n₂ n₁ := by + rcases h with ⟨f, t₁, t₂, t₃, t₄, h12, h23, h34, h41, hn₁, hn₂, hn₃, hn₄⟩ + let f' : Circle ≃ₜ Θ := (Homeomorph.inv Circle).trans f + have hcp : ∀ t : ℝ, cuffPoint f' (-t) = cuffPoint f t := by + intro t + change (f (Circle.exp (-t))⁻¹).1 = (f (Circle.exp t)).1 + rw [Circle.exp_neg, inv_inv] + refine ⟨f', -t₄, -t₃, -t₂, -t₁, by linarith, by linarith, by linarith, by linarith, + by rw [hcp, hn₄], by rw [hcp, hn₃], by rw [hcp, hn₂], by rw [hcp, hn₁]⟩ + +end CuffPoint + +/-! ## 2. Cyclic Distance and Cyclic Order in `Fin k` -/ + +/-- Forward cyclic distance from $i$ to $j$ in `Fin k`: $(j - i) \bmod k$. -/ +def cyclicDist {k : ℕ} (i j : Fin k) : ℕ := + (j.1 + k - i.1) % k + +theorem cyclicDist_eq_ite {k : ℕ} (i j : Fin k) : + cyclicDist i j = if i.1 ≤ j.1 then j.1 - i.1 else j.1 + k - i.1 := by + unfold cyclicDist + have hi := i.2 + have hj := j.2 + split_ifs with h + · have heq : j.1 + k - i.1 = (j.1 - i.1) + 1 * k := by omega + rw [heq, Nat.add_mul_mod_self_right, Nat.mod_eq_of_lt (by omega)] + · exact Nat.mod_eq_of_lt (by omega) + +theorem cyclicDist_self {k : ℕ} (i : Fin k) : cyclicDist i i = 0 := by + rw [cyclicDist_eq_ite]; simp + +theorem cyclicDist_pos_of_ne {k : ℕ} {i j : Fin k} (hne : i ≠ j) : 0 < cyclicDist i j := by + have hval : i.1 ≠ j.1 := fun h => hne (Fin.ext h) + rw [cyclicDist_eq_ite] + have hi := i.2 + have hj := j.2 + split_ifs <;> omega + +theorem cyclicDist_lt {k : ℕ} (hk : 0 < k) (i j : Fin k) : cyclicDist i j < k := + Nat.mod_lt _ hk + +/-- If four indices $i_1, i_2, i_3, i_4 \in \text{Fin } k$ satisfy $i_1 \ne i_2$, $i_2 \ne i_3$, +$i_3 \ne i_4$, $i_4 \ne i_1$ and +$\text{cyclicDist } i_1\, i_2 + \text{cyclicDist } i_2\, i_3 + \text{cyclicDist } i_3\, i_4 \le k$, +then $i_1, i_2, i_3, i_4$ are in strict cyclic order around `Fin k`. -/ +theorem cyclicOrder_of_cyclicDist_le {k : ℕ} {i₁ i₂ i₃ i₄ : Fin k} + (h12 : i₁ ≠ i₂) (h23 : i₂ ≠ i₃) (h34 : i₃ ≠ i₄) (h41 : i₄ ≠ i₁) + (hle : cyclicDist i₁ i₂ + cyclicDist i₂ i₃ + cyclicDist i₃ i₄ ≤ k) : + (i₁ < i₂ ∧ i₂ < i₃ ∧ i₃ < i₄) ∨ + (i₂ < i₃ ∧ i₃ < i₄ ∧ i₄ < i₁) ∨ + (i₃ < i₄ ∧ i₄ < i₁ ∧ i₁ < i₂) ∨ + (i₄ < i₁ ∧ i₁ < i₂ ∧ i₂ < i₃) := by + have v12 : i₁.1 ≠ i₂.1 := fun h => h12 (Fin.ext h) + have v23 : i₂.1 ≠ i₃.1 := fun h => h23 (Fin.ext h) + have v34 : i₃.1 ≠ i₄.1 := fun h => h34 (Fin.ext h) + have v41 : i₄.1 ≠ i₁.1 := fun h => h41 (Fin.ext h) + have b1 := i₁.2; have b2 := i₂.2; have b3 := i₃.2; have b4 := i₄.2 + rw [cyclicDist_eq_ite, cyclicDist_eq_ite, cyclicDist_eq_ite] at hle + simp only [Fin.lt_def] + split_ifs at hle <;> omega + +/-- In any `CuffEnumeration`, four indices in strict cyclic order around `Fin k` have their +nodes in circular order on $\Theta$. -/ +theorem Painting.CuffEnumeration.inOrderOn_of_cyclic {S : Type} [TopologicalSpace S] + {Γ : Painting S} {Θ : Set S} {k : ℕ} (E : Γ.CuffEnumeration Θ k) + {i₁ i₂ i₃ i₄ : Fin k} + (h : (i₁ < i₂ ∧ i₂ < i₃ ∧ i₃ < i₄) ∨ + (i₂ < i₃ ∧ i₃ < i₄ ∧ i₄ < i₁) ∨ + (i₃ < i₄ ∧ i₄ < i₁ ∧ i₁ < i₂) ∨ + (i₄ < i₁ ∧ i₁ < i₂ ∧ i₂ < i₃)) : + InOrderOn Θ (E.node i₁) (E.node i₂) (E.node i₃) (E.node i₄) := by + rcases h with ⟨h1, h2, h3⟩ | ⟨h1, h2, h3⟩ | ⟨h1, h2, h3⟩ | ⟨h1, h2, h3⟩ + · exact E.nodes_in_order i₁ i₂ i₃ i₄ h1 h2 h3 + · exact inOrderOn_cyclic3 (E.nodes_in_order i₂ i₃ i₄ i₁ h1 h2 h3) + · exact inOrderOn_cyclic2 (E.nodes_in_order i₃ i₄ i₁ i₂ h1 h2 h3) + · exact inOrderOn_cyclic (E.nodes_in_order i₄ i₁ i₂ i₃ h1 h2 h3) + +/-- In any portrayal $\pi$ and cuff enumeration $E$ of $\Theta$, if four indices +$i_1, i_2, i_3, i_4 \in \text{Fin } k$ satisfy +$\text{cyclicDist } i_1\, i_2 + \text{cyclicDist } i_2\, i_3 + \text{cyclicDist } i_3\, i_4 \le k$, +then $\beta(n_{i_1} +) \cap \beta(n_{i_3} +) \subseteq \beta(n_{i_2} +) \cup \beta(n_{i_4} +)$ +(whether or not the four indices are distinct). -/ +theorem Portrayal.p7_of_cyclicDist {α : Type*} {β : Type*} {G : Hypergraph α β} + (π : Portrayal G) {Θ : Set π.S} {k : ℕ} (E : π.Γ.CuffEnumeration Θ k) + {i₁ i₂ i₃ i₄ : Fin k} + (hle : cyclicDist i₁ i₂ + cyclicDist i₂ i₃ + cyclicDist i₃ i₄ ≤ k) + {v : α} (hv₁ : v ∈ π.borderPlus (E.node i₁)) (hv₃ : v ∈ π.borderPlus (E.node i₃)) : + v ∈ π.borderPlus (E.node i₂) ∨ v ∈ π.borderPlus (E.node i₄) := by + by_cases h12 : i₁ = i₂ + · exact Or.inl (h12 ▸ hv₁) + by_cases h23 : i₂ = i₃ + · exact Or.inl (h23.symm ▸ hv₃) + by_cases h34 : i₃ = i₄ + · exact Or.inr (h34 ▸ hv₃) + by_cases h41 : i₄ = i₁ + · exact Or.inr (h41.symm ▸ hv₁) + have hord := E.inOrderOn_of_cyclic (cyclicOrder_of_cyclicDist_le h12 h23 h34 h41 hle) + have hn_mem : ∀ i : Fin k, E.node i ∈ π.Γ.N ∩ Θ := by + intro i + rw [← E.range_node] + exact mem_range_self i + exact π.p7 Θ E.cuff_mem (E.node i₁) (hn_mem i₁) (E.node i₂) (hn_mem i₂) + (E.node i₃) (hn_mem i₃) (E.node i₄) (hn_mem i₄) hord v hv₁ hv₃ + +/-! ## 3. Construction of `Painting.CuffEnumeration` -/ + +section CuffEnumeration + +variable {S : Type} [TopologicalSpace S] (Γ : Painting S) {Θ : Set S} + +private noncomputable def angleOf (f : Circle ≃ₜ Θ) (x : S) : ℝ := by + classical + exact if hx : x ∈ Θ then Classical.choose (exists_cuffPoint_mem_Ico f 0 hx) else 0 + +private theorem angleOf_mem_Ico (f : Circle ≃ₜ Θ) {x : S} (hx : x ∈ Θ) : + angleOf f x ∈ Ico (0 : ℝ) (0 + 2 * Real.pi) := by + simp only [angleOf, hx, dite_true] + exact (Classical.choose_spec (exists_cuffPoint_mem_Ico f 0 hx)).1 + +private theorem cuffPoint_angleOf (f : Circle ≃ₜ Θ) {x : S} (hx : x ∈ Θ) : + cuffPoint f (angleOf f x) = x := by + simp only [angleOf, hx, dite_true] + exact (Classical.choose_spec (exists_cuffPoint_mem_Ico f 0 hx)).2 + +private theorem angleOf_cuffPoint (f : Circle ≃ₜ Θ) {t : ℝ} + (ht : t ∈ Ico (0 : ℝ) (0 + 2 * Real.pi)) : + angleOf f (cuffPoint f t) = t := by + have hx : cuffPoint f t ∈ Θ := cuffPoint_mem f t + exact cuffPoint_injOn_Ico f 0 (angleOf_mem_Ico f hx) ht (cuffPoint_angleOf f hx) + +private theorem angleOf_injOn (f : Circle ≃ₜ Θ) : InjOn (angleOf f) Θ := by + intro x hx y hy h + rw [← cuffPoint_angleOf f hx, ← cuffPoint_angleOf f hy, h] + +/-- Every cuff $\Theta$ of a surface $S$ contains at least two nodes of any painting $\Gamma$. -/ +theorem Painting.two_le_ncard_nodes_inter_cuff (hΘ : Θ ∈ cuffs S) (hΘ_arc : IsOArc Θ) : + 2 ≤ (Γ.N ∩ Θ).ncard := by + have hinf : Θ.Infinite := infinite_of_isOArc hΘ_arc + have hinf_diff : (Θ \ Γ.N).Infinite := hinf.sdiff Γ.finite_N + obtain ⟨x, hxΘ, hxN⟩ := hinf_diff.nonempty + rcases hΘ with ⟨x₀, hx₀, hΘ_eq⟩ + have hx_comp : x ∈ connectedComponentIn (bd S) x₀ := by rwa [hΘ_eq] + have hxbd : x ∈ bd S := connectedComponentIn_subset (bd S) x₀ hx_comp + obtain ⟨c, ⟨hc, hxc⟩, _⟩ := Γ.exists_border_cell_of_mem_bd ⟨hxbd, hxN⟩ + have hΘ' : Θ ∈ cuffs S := ⟨x₀, hx₀, hΘ_eq⟩ + have hinter : (c ∩ Θ).Nonempty := ⟨x, hxc, hxΘ⟩ + have htilde_sub : tilde c ⊆ Γ.N ∩ Θ := (Γ.border_cell_subset_cuff hc hΘ' hinter).2.2.2.1 + have hncard : (tilde c).ncard = 2 := (Γ.border_cell c hc ⟨x, hxc, hxbd⟩).1 + have hfin : (Γ.N ∩ Θ).Finite := Γ.finite_N.inter_of_left Θ + linarith [ncard_le_ncard htilde_sub hfin] + +private noncomputable def nodeAngleFinset (f : Circle ≃ₜ Θ) : Finset ℝ := + ((Γ.finite_N.inter_of_left Θ).toFinset).image (angleOf f) + +private theorem card_nodeAngleFinset (f : Circle ≃ₜ Θ) : + (nodeAngleFinset Γ f).card = (Γ.N ∩ Θ).ncard := by + unfold nodeAngleFinset + have hinj : InjOn (angleOf f) ((Γ.finite_N.inter_of_left Θ).toFinset : Set S) := by + refine (angleOf_injOn f).mono ?_ + rw [Set.Finite.coe_toFinset] + exact inter_subset_right + rw [Finset.card_image_of_injOn hinj, ← ncard_eq_toFinset_card (Γ.N ∩ Θ) + (Γ.finite_N.inter_of_left Θ)] + +private noncomputable def nodeAngle (f : Circle ≃ₜ Θ) (i : Fin (Γ.N ∩ Θ).ncard) : ℝ := + (nodeAngleFinset Γ f).orderEmbOfFin (card_nodeAngleFinset Γ f) i + +private theorem strictMono_nodeAngle (f : Circle ≃ₜ Θ) : StrictMono (nodeAngle Γ f) := + ((nodeAngleFinset Γ f).orderEmbOfFin (card_nodeAngleFinset Γ f)).strictMono + +private theorem range_nodeAngle (f : Circle ≃ₜ Θ) : + Set.range (nodeAngle Γ f) = angleOf f '' (Γ.N ∩ Θ) := by + unfold nodeAngle + rw [Finset.range_orderEmbOfFin, nodeAngleFinset, Finset.coe_image, Set.Finite.coe_toFinset] + +private theorem nodeAngle_mem_Ico (f : Circle ≃ₜ Θ) (i : Fin (Γ.N ∩ Θ).ncard) : + nodeAngle Γ f i ∈ Ico (0 : ℝ) (0 + 2 * Real.pi) := by + have hmem : nodeAngle Γ f i ∈ Set.range (nodeAngle Γ f) := mem_range_self i + rw [range_nodeAngle] at hmem + rcases hmem with ⟨x, ⟨_, hxΘ⟩, h_eq⟩ + rw [← h_eq] + exact angleOf_mem_Ico f hxΘ + +private noncomputable def cuffNode (f : Circle ≃ₜ Θ) (i : Fin (Γ.N ∩ Θ).ncard) : S := + cuffPoint f (nodeAngle Γ f i) + +private theorem injective_cuffNode (f : Circle ≃ₜ Θ) : Function.Injective (cuffNode Γ f) := by + intro i j h + have h_eq : nodeAngle Γ f i = nodeAngle Γ f j := + cuffPoint_injOn_Ico f 0 (nodeAngle_mem_Ico Γ f i) (nodeAngle_mem_Ico Γ f j) h + exact (strictMono_nodeAngle Γ f).injective h_eq + +private theorem range_cuffNode (f : Circle ≃ₜ Θ) : + Set.range (cuffNode Γ f) = Γ.N ∩ Θ := by + ext x + constructor + · rintro ⟨i, rfl⟩ + have hmem : nodeAngle Γ f i ∈ Set.range (nodeAngle Γ f) := mem_range_self i + rw [range_nodeAngle] at hmem + rcases hmem with ⟨y, hy, hy_eq⟩ + unfold cuffNode + rw [← hy_eq, cuffPoint_angleOf f hy.2] + exact hy + · intro hx + have hmem : angleOf f x ∈ Set.range (nodeAngle Γ f) := by + rw [range_nodeAngle] + exact ⟨x, hx, rfl⟩ + rcases hmem with ⟨i, hi⟩ + refine ⟨i, ?_⟩ + unfold cuffNode + rw [hi, cuffPoint_angleOf f hx.2] + +private theorem cuffNode_inOrderOn (f : Circle ≃ₜ Θ) + (i₁ i₂ i₃ i₄ : Fin (Γ.N ∩ Θ).ncard) (h12 : i₁ < i₂) (h23 : i₂ < i₃) (h34 : i₃ < i₄) : + InOrderOn Θ (cuffNode Γ f i₁) (cuffNode Γ f i₂) (cuffNode Γ f i₃) (cuffNode Γ f i₄) := by + have hmono := strictMono_nodeAngle Γ f + have ht₁ := (nodeAngle_mem_Ico Γ f i₁).1 + have ht₄ := (nodeAngle_mem_Ico Γ f i₄).2 + exact ⟨f, nodeAngle Γ f i₁, nodeAngle Γ f i₂, nodeAngle Γ f i₃, nodeAngle Γ f i₄, + (hmono h12).le, (hmono h23).le, (hmono h34).le, by linarith, rfl, rfl, rfl, rfl⟩ + +private noncomputable def upperAngle (f : Circle ≃ₜ Θ) (hk : 2 ≤ (Γ.N ∩ Θ).ncard) + (i : Fin (Γ.N ∩ Θ).ncard) : ℝ := + if h : i.1 + 1 < (Γ.N ∩ Θ).ncard then + nodeAngle Γ f ⟨i.1 + 1, h⟩ + else + nodeAngle Γ f ⟨0, by omega⟩ + 2 * Real.pi + +private theorem nodeAngle_lt_upperAngle (f : Circle ≃ₜ Θ) (hk : 2 ≤ (Γ.N ∩ Θ).ncard) + (i : Fin (Γ.N ∩ Θ).ncard) : + nodeAngle Γ f i < upperAngle Γ f hk i := by + unfold upperAngle + split_ifs with h + · exact strictMono_nodeAngle Γ f (Nat.lt_succ_self i.1) + · have hi := (nodeAngle_mem_Ico Γ f i).2 + have h0 := (nodeAngle_mem_Ico Γ f ⟨0, by omega⟩).1 + linarith + +private theorem cuffPoint_upperAngle (f : Circle ≃ₜ Θ) (hk : 2 ≤ (Γ.N ∩ Θ).ncard) + (i : Fin (Γ.N ∩ Θ).ncard) : + cuffPoint f (upperAngle Γ f hk i) = + cuffNode Γ f ⟨(i.1 + 1) % (Γ.N ∩ Θ).ncard, Nat.mod_lt _ (by omega)⟩ := by + unfold upperAngle cuffNode + split_ifs with h + · congr 2 + apply Fin.ext + dsimp + exact (Nat.mod_eq_of_lt h).symm + · rw [cuffPoint_add_two_pi] + congr 2 + apply Fin.ext + dsimp + have heq : i.1 + 1 = (Γ.N ∩ Θ).ncard := by have := i.2; omega + rw [heq, Nat.mod_self] + +private theorem notMem_N_of_mem_Ioo (f : Circle ≃ₜ Θ) (hk : 2 ≤ (Γ.N ∩ Θ).ncard) + (i : Fin (Γ.N ∩ Θ).ncard) {t : ℝ} + (ht : t ∈ Ioo (nodeAngle Γ f i) (upperAngle Γ f hk i)) : + cuffPoint f t ∉ Γ.N := by + intro hxN + have hx : cuffPoint f t ∈ Γ.N ∩ Θ := ⟨hxN, cuffPoint_mem f t⟩ + rcases ht with ⟨ht₁, ht₂⟩ + unfold upperAngle at ht₂ + split_ifs at ht₂ with h + · have ht_Ico : t ∈ Ico (0 : ℝ) (0 + 2 * Real.pi) := + ⟨(nodeAngle_mem_Ico Γ f i).1.trans ht₁.le, + ht₂.trans (nodeAngle_mem_Ico Γ f ⟨i.1 + 1, h⟩).2⟩ + have ht_eq : angleOf f (cuffPoint f t) = t := angleOf_cuffPoint f ht_Ico + have hmem : t ∈ Set.range (nodeAngle Γ f) := by + rw [range_nodeAngle] + exact ⟨cuffPoint f t, hx, ht_eq⟩ + rcases hmem with ⟨j, rfl⟩ + have hij : i < j := (strictMono_nodeAngle Γ f).lt_iff_lt.mp ht₁ + have hji : j < ⟨i.1 + 1, h⟩ := (strictMono_nodeAngle Γ f).lt_iff_lt.mp ht₂ + have hij' : i.1 < j.1 := hij + have hji' : j.1 < i.1 + 1 := hji + omega + · by_cases hlt : t < 2 * Real.pi + · have ht_Ico : t ∈ Ico (0 : ℝ) (0 + 2 * Real.pi) := + ⟨(nodeAngle_mem_Ico Γ f i).1.trans ht₁.le, by linarith⟩ + have ht_eq : angleOf f (cuffPoint f t) = t := angleOf_cuffPoint f ht_Ico + have hmem : t ∈ Set.range (nodeAngle Γ f) := by + rw [range_nodeAngle] + exact ⟨cuffPoint f t, hx, ht_eq⟩ + rcases hmem with ⟨j, rfl⟩ + have hij : i < j := (strictMono_nodeAngle Γ f).lt_iff_lt.mp ht₁ + have hij' : i.1 < j.1 := hij + have hj_lt := j.2 + omega + · have ht_Ico : t - 2 * Real.pi ∈ Ico (0 : ℝ) (0 + 2 * Real.pi) := + ⟨by linarith, by linarith [(nodeAngle_mem_Ico Γ f ⟨0, by omega⟩).2]⟩ + have hcp : cuffPoint f (t - 2 * Real.pi) = cuffPoint f t := cuffPoint_sub_two_pi f t + have ht_eq : angleOf f (cuffPoint f t) = t - 2 * Real.pi := by + rw [← hcp] + exact angleOf_cuffPoint f ht_Ico + have hmem : t - 2 * Real.pi ∈ Set.range (nodeAngle Γ f) := by + rw [range_nodeAngle] + exact ⟨cuffPoint f t, hx, ht_eq⟩ + rcases hmem with ⟨j, hj⟩ + have hj0 : nodeAngle Γ f j < nodeAngle Γ f ⟨0, by omega⟩ := by linarith + have hj_lt : j < ⟨0, by omega⟩ := (strictMono_nodeAngle Γ f).lt_iff_lt.mp hj0 + exact Nat.not_lt_zero j.1 hj_lt + +private noncomputable def cuffArc (f : Circle ≃ₜ Θ) (hk : 2 ≤ (Γ.N ∩ Θ).ncard) + (i : Fin (Γ.N ∩ Θ).ncard) : Set S := + cuffPoint f '' Ioo (nodeAngle Γ f i) (upperAngle Γ f hk i) + +private noncomputable def cuffMidAngle (f : Circle ≃ₜ Θ) (hk : 2 ≤ (Γ.N ∩ Θ).ncard) + (i : Fin (Γ.N ∩ Θ).ncard) : ℝ := + (nodeAngle Γ f i + upperAngle Γ f hk i) / 2 + +private theorem cuffMidAngle_mem_Ioo (f : Circle ≃ₜ Θ) (hk : 2 ≤ (Γ.N ∩ Θ).ncard) + (i : Fin (Γ.N ∩ Θ).ncard) : + cuffMidAngle Γ f hk i ∈ Ioo (nodeAngle Γ f i) (upperAngle Γ f hk i) := by + have hlt := nodeAngle_lt_upperAngle Γ f hk i + unfold cuffMidAngle + exact ⟨by linarith, by linarith⟩ + +private noncomputable def cuffMidpoint (f : Circle ≃ₜ Θ) (hk : 2 ≤ (Γ.N ∩ Θ).ncard) + (i : Fin (Γ.N ∩ Θ).ncard) : S := + cuffPoint f (cuffMidAngle Γ f hk i) + +private theorem cuffMidpoint_mem_cuffArc (f : Circle ≃ₜ Θ) (hk : 2 ≤ (Γ.N ∩ Θ).ncard) + (i : Fin (Γ.N ∩ Θ).ncard) : + cuffMidpoint Γ f hk i ∈ cuffArc Γ f hk i := + ⟨cuffMidAngle Γ f hk i, cuffMidAngle_mem_Ioo Γ f hk i, rfl⟩ + +private theorem cuffArc_subset_cuff_diff_N (f : Circle ≃ₜ Θ) (hk : 2 ≤ (Γ.N ∩ Θ).ncard) + (i : Fin (Γ.N ∩ Θ).ncard) : + cuffArc Γ f hk i ⊆ Θ \ Γ.N := by + rintro x ⟨t, ht, rfl⟩ + exact ⟨cuffPoint_mem f t, notMem_N_of_mem_Ioo Γ f hk i ht⟩ + +private theorem cuffArc_subset_U_diff_N (hΘ : Θ ∈ cuffs S) (f : Circle ≃ₜ Θ) + (hk : 2 ≤ (Γ.N ∩ Θ).ncard) (i : Fin (Γ.N ∩ Θ).ncard) : + cuffArc Γ f hk i ⊆ Γ.U \ Γ.N := by + rcases hΘ with ⟨x₀, _, rfl⟩ + have hsub : connectedComponentIn (bd S) x₀ ⊆ Γ.U := + (connectedComponentIn_subset (bd S) x₀).trans Γ.bd_subset + exact (cuffArc_subset_cuff_diff_N Γ f hk i).trans (sdiff_subset_sdiff_left hsub) + +private theorem isPathConnected_cuffArc (f : Circle ≃ₜ Θ) (hk : 2 ≤ (Γ.N ∩ Θ).ncard) + (i : Fin (Γ.N ∩ Θ).ncard) : + IsPathConnected (cuffArc Γ f hk i) := + ((convex_Ioo _ _).isPathConnected ⟨_, cuffMidAngle_mem_Ioo Γ f hk i⟩).image + (cuffPoint_continuous f) + +private theorem angleOf_mem_of_mem_cuffArc (f : Circle ≃ₜ Θ) (hk : 2 ≤ (Γ.N ∩ Θ).ncard) + (i : Fin (Γ.N ∩ Θ).ncard) {x : S} (hx : x ∈ cuffArc Γ f hk i) : + if h : i.1 + 1 < (Γ.N ∩ Θ).ncard then + nodeAngle Γ f i < angleOf f x ∧ angleOf f x < nodeAngle Γ f ⟨i.1 + 1, h⟩ + else + nodeAngle Γ f i < angleOf f x ∨ angleOf f x < nodeAngle Γ f ⟨0, by omega⟩ := by + rcases hx with ⟨t, ⟨ht₁, ht₂⟩, rfl⟩ + have hxN : cuffPoint f t ∉ Γ.N := notMem_N_of_mem_Ioo Γ f hk i ⟨ht₁, ht₂⟩ + unfold upperAngle at ht₂ + split_ifs with h + · simp only [h, ↓reduceDIte] at ht₂ + have ht_Ico : t ∈ Ico (0 : ℝ) (0 + 2 * Real.pi) := + ⟨(nodeAngle_mem_Ico Γ f i).1.trans ht₁.le, + ht₂.trans (nodeAngle_mem_Ico Γ f ⟨i.1 + 1, h⟩).2⟩ + rw [angleOf_cuffPoint f ht_Ico] + exact ⟨ht₁, ht₂⟩ + · simp only [h, ↓reduceDIte] at ht₂ + by_cases hlt : t < 2 * Real.pi + · have ht_Ico : t ∈ Ico (0 : ℝ) (0 + 2 * Real.pi) := + ⟨(nodeAngle_mem_Ico Γ f i).1.trans ht₁.le, by linarith⟩ + rw [angleOf_cuffPoint f ht_Ico] + exact Or.inl ht₁ + · have ht_Ico : t - 2 * Real.pi ∈ Ico (0 : ℝ) (0 + 2 * Real.pi) := + ⟨by linarith, by linarith [(nodeAngle_mem_Ico Γ f ⟨0, by omega⟩).2]⟩ + have hcp : cuffPoint f (t - 2 * Real.pi) = cuffPoint f t := cuffPoint_sub_two_pi f t + rw [← hcp, angleOf_cuffPoint f ht_Ico] + exact Or.inr (by linarith) + +private theorem disjoint_cuffArc (f : Circle ≃ₜ Θ) (hk : 2 ≤ (Γ.N ∩ Θ).ncard) + {i j : Fin (Γ.N ∩ Θ).ncard} (hij : i ≠ j) : + Disjoint (cuffArc Γ f hk i) (cuffArc Γ f hk j) := by + have hlt_disj : ∀ {a b : Fin (Γ.N ∩ Θ).ncard}, a < b → + Disjoint (cuffArc Γ f hk a) (cuffArc Γ f hk b) := by + intro a b hab + rw [Set.disjoint_left] + intro x hxa hxb + have ha := angleOf_mem_of_mem_cuffArc Γ f hk a hxa + have hb := angleOf_mem_of_mem_cuffArc Γ f hk b hxb + have ha_lt : a.1 + 1 < (Γ.N ∩ Θ).ncard := by have := b.2; omega + simp only [ha_lt, ↓reduceDIte] at ha + have hle1 : (⟨a.1 + 1, ha_lt⟩ : Fin (Γ.N ∩ Θ).ncard) ≤ b := hab + have hmono1 := (strictMono_nodeAngle Γ f).monotone hle1 + have hle0 : (⟨0, by omega⟩ : Fin (Γ.N ∩ Θ).ncard) ≤ a := Nat.zero_le a.1 + have hmono0 := (strictMono_nodeAngle Γ f).monotone hle0 + split_ifs at hb with hb_lt + · linarith + · rcases hb with hb | hb <;> linarith + rcases lt_or_gt_of_ne hij with h | h + · exact hlt_disj h + · exact (hlt_disj h).symm + +private theorem iUnion_cuffArc (f : Circle ≃ₜ Θ) (hk : 2 ≤ (Γ.N ∩ Θ).ncard) : + (⋃ i, cuffArc Γ f hk i) = Θ \ Γ.N := by + refine Subset.antisymm (iUnion_subset fun i => cuffArc_subset_cuff_diff_N Γ f hk i) ?_ + rintro x ⟨hxΘ, hxN⟩ + rw [mem_iUnion] + set t := angleOf f x + have ht_Ico : t ∈ Ico (0 : ℝ) (0 + 2 * Real.pi) := angleOf_mem_Ico f hxΘ + have hcp : cuffPoint f t = x := cuffPoint_angleOf f hxΘ + have hnot_range : t ∉ Set.range (nodeAngle Γ f) := by + rw [range_nodeAngle] + rintro ⟨y, ⟨hyN, hyΘ⟩, hy_eq⟩ + have hxy : y = x := angleOf_injOn f hyΘ hxΘ hy_eq + exact hxN (hxy ▸ hyN) + by_cases h0 : t < nodeAngle Γ f ⟨0, by omega⟩ + · let i_last : Fin (Γ.N ∩ Θ).ncard := ⟨(Γ.N ∩ Θ).ncard - 1, by omega⟩ + refine ⟨i_last, t + 2 * Real.pi, ?_, by rw [cuffPoint_add_two_pi, hcp]⟩ + have hi_last : ¬ (i_last.1 + 1 < (Γ.N ∩ Θ).ncard) := by dsimp [i_last]; omega + have hup : upperAngle Γ f hk i_last = nodeAngle Γ f ⟨0, by omega⟩ + 2 * Real.pi := by + unfold upperAngle + simp only [hi_last, ↓reduceDIte] + rw [hup] + have hi_mem := (nodeAngle_mem_Ico Γ f i_last).2 + exact ⟨by linarith [ht_Ico.1], by linarith⟩ + · push Not at h0 + have h0_lt : nodeAngle Γ f ⟨0, by omega⟩ < t := + lt_of_le_of_ne h0 (fun h_eq => hnot_range ⟨⟨0, by omega⟩, h_eq⟩) + let S_lt : Finset (Fin (Γ.N ∩ Θ).ncard) := + Finset.univ.filter (fun i => nodeAngle Γ f i < t) + have hS_ne : S_lt.Nonempty := + ⟨⟨0, by omega⟩, Finset.mem_filter.mpr ⟨Finset.mem_univ _, h0_lt⟩⟩ + let i := S_lt.max' hS_ne + have hi_mem : i ∈ S_lt := Finset.max'_mem S_lt hS_ne + have hi_lt : nodeAngle Γ f i < t := (Finset.mem_filter.mp hi_mem).2 + refine ⟨i, t, ⟨hi_lt, ?_⟩, hcp⟩ + unfold upperAngle + split_ifs with h + · by_contra hge + push Not at hge + have hlt_next : nodeAngle Γ f ⟨i.1 + 1, h⟩ < t := + lt_of_le_of_ne hge (fun h_eq => hnot_range ⟨⟨i.1 + 1, h⟩, h_eq⟩) + have hmem_next : (⟨i.1 + 1, h⟩ : Fin (Γ.N ∩ Θ).ncard) ∈ S_lt := + Finset.mem_filter.mpr ⟨Finset.mem_univ _, hlt_next⟩ + have hle_max : (⟨i.1 + 1, h⟩ : Fin (Γ.N ∩ Θ).ncard) ≤ i := + Finset.le_max' S_lt _ hmem_next + have hle_val : i.1 + 1 ≤ i.1 := hle_max + omega + · have h0_nonneg := (nodeAngle_mem_Ico Γ f ⟨0, by omega⟩).1 + linarith [ht_Ico.2] + +private noncomputable def cuffCell (f : Circle ≃ₜ Θ) (hk : 2 ≤ (Γ.N ∩ Θ).ncard) + (i : Fin (Γ.N ∩ Θ).ncard) : Set S := + pathComponentIn (Γ.U \ Γ.N) (cuffMidpoint Γ f hk i) + +private theorem cuffCell_mem_C (hΘ : Θ ∈ cuffs S) (f : Circle ≃ₜ Θ) + (hk : 2 ≤ (Γ.N ∩ Θ).ncard) (i : Fin (Γ.N ∩ Θ).ncard) : + cuffCell Γ f hk i ∈ Γ.C := + pathComponentIn_mem_arcComponentsIn + (cuffArc_subset_U_diff_N Γ hΘ f hk i (cuffMidpoint_mem_cuffArc Γ f hk i)) + +private theorem cuffArc_subset_cuffCell (hΘ : Θ ∈ cuffs S) (f : Circle ≃ₜ Θ) + (hk : 2 ≤ (Γ.N ∩ Θ).ncard) (i : Fin (Γ.N ∩ Θ).ncard) : + cuffArc Γ f hk i ⊆ cuffCell Γ f hk i := + subset_arcComponent_of_isPathConnected (cuffCell_mem_C Γ hΘ f hk i) + (cuffArc_subset_U_diff_N Γ hΘ f hk i) (isPathConnected_cuffArc Γ f hk i) + ⟨cuffMidpoint Γ f hk i, cuffMidpoint_mem_cuffArc Γ f hk i, + mem_pathComponentIn_self (cuffArc_subset_U_diff_N Γ hΘ f hk i + (cuffMidpoint_mem_cuffArc Γ f hk i))⟩ + +private theorem cuffCell_inter_cuff_nonempty (hΘ : Θ ∈ cuffs S) (f : Circle ≃ₜ Θ) + (hk : 2 ≤ (Γ.N ∩ Θ).ncard) (i : Fin (Γ.N ∩ Θ).ncard) : + (cuffCell Γ f hk i ∩ Θ).Nonempty := + ⟨cuffMidpoint Γ f hk i, + cuffArc_subset_cuffCell Γ hΘ f hk i (cuffMidpoint_mem_cuffArc Γ f hk i), + cuffPoint_mem f (cuffMidAngle Γ f hk i)⟩ + +private theorem cuffCell_tilde (hΘ : Θ ∈ cuffs S) (f : Circle ≃ₜ Θ) + (hk : 2 ≤ (Γ.N ∩ Θ).ncard) (i : Fin (Γ.N ∩ Θ).ncard) : + tilde (cuffCell Γ f hk i) = + {cuffNode Γ f i, cuffNode Γ f ⟨(i.1 + 1) % (Γ.N ∩ Θ).ncard, Nat.mod_lt _ (by omega)⟩} := by + have hc : cuffCell Γ f hk i ∈ Γ.C := cuffCell_mem_C Γ hΘ f hk i + have hinter : (cuffCell Γ f hk i ∩ Θ).Nonempty := cuffCell_inter_cuff_nonempty Γ hΘ f hk i + have hsub_cuff := Γ.border_cell_subset_cuff hc hΘ hinter + have hbd : (cuffCell Γ f hk i ∩ bd S).Nonempty := by rw [hsub_cuff.2.1]; exact hinter + obtain ⟨hncard, hfin, _, _⟩ := Γ.border_cell (cuffCell Γ f hk i) hc hbd + have hlt := nodeAngle_lt_upperAngle Γ f hk i + have hcl_sub : cuffPoint f '' Icc (nodeAngle Γ f i) (upperAngle Γ f hk i) ⊆ + closure (cuffCell Γ f hk i) := by + rw [← closure_Ioo (ne_of_lt hlt)] + exact (image_closure_subset_closure_image (cuffPoint_continuous f)).trans + (closure_mono (cuffArc_subset_cuffCell Γ hΘ f hk i)) + have hnode1_cl : cuffNode Γ f i ∈ closure (cuffCell Γ f hk i) := + hcl_sub ⟨nodeAngle Γ f i, left_mem_Icc.mpr hlt.le, rfl⟩ + let j : Fin (Γ.N ∩ Θ).ncard := ⟨(i.1 + 1) % (Γ.N ∩ Θ).ncard, Nat.mod_lt _ (by omega)⟩ + have hnode2_cl : cuffNode Γ f j ∈ closure (cuffCell Γ f hk i) := by + rw [← cuffPoint_upperAngle Γ f hk i] + exact hcl_sub ⟨upperAngle Γ f hk i, right_mem_Icc.mpr hlt.le, rfl⟩ + have hnode_notMem : ∀ m : Fin (Γ.N ∩ Θ).ncard, cuffNode Γ f m ∉ cuffCell Γ f hk i := by + intro m hm + have hmN : cuffNode Γ f m ∈ Γ.N := by + have : cuffNode Γ f m ∈ Set.range (cuffNode Γ f) := mem_range_self m + rw [range_cuffNode] at this + exact this.1 + exact (Γ.cell_subset_diff hc hm).2 hmN + have hpair_sub : {cuffNode Γ f i, cuffNode Γ f j} ⊆ tilde (cuffCell Γ f hk i) := by + intro x hx + rcases hx with rfl | rfl + · exact ⟨hnode1_cl, hnode_notMem i⟩ + · exact ⟨hnode2_cl, hnode_notMem j⟩ + have hij : i ≠ j := by + intro h_eq + have hval : i.1 = (i.1 + 1) % (Γ.N ∩ Θ).ncard := congrArg Fin.val h_eq + have hi_lt := i.2 + by_cases h1 : i.1 + 1 < (Γ.N ∩ Θ).ncard + · rw [Nat.mod_eq_of_lt h1] at hval; omega + · have heq : i.1 + 1 = (Γ.N ∩ Θ).ncard := by omega + rw [heq, Nat.mod_self] at hval; omega + have hne : cuffNode Γ f i ≠ cuffNode Γ f j := + fun h => hij (injective_cuffNode Γ f h) + have hpair_ncard : ({cuffNode Γ f i, cuffNode Γ f j} : Set S).ncard = 2 := ncard_pair hne + exact (eq_of_subset_of_ncard_le hpair_sub (by omega) hfin).symm + +/-- For every border cell $c \in C(\Gamma)$ meeting a cuff $\Theta$, $c \cap \Theta$ is +path-connected. -/ +theorem Painting.isPathConnected_cell_inter_cuff {c Θ : Set S} (hc : c ∈ Γ.C) + (hΘ : Θ ∈ cuffs S) (hinter : (c ∩ Θ).Nonempty) : + IsPathConnected (c ∩ Θ) := by + have hsub := Γ.border_cell_subset_cuff hc hΘ hinter + have hbd : (c ∩ bd S).Nonempty := by rw [hsub.2.1]; exact hinter + obtain ⟨u, v, _, _, hL, hdiff, _, _⟩ := Γ.border_cell_exists_ends hc hbd + rw [← hsub.2.1, hdiff] + exact (isPathConnected_diff_ends_of_isLineWithEnds hL).2 + +private theorem range_cuffCell (hΘ : Θ ∈ cuffs S) (f : Circle ≃ₜ Θ) + (hk : 2 ≤ (Γ.N ∩ Θ).ncard) : + Set.range (cuffCell Γ f hk) = {c ∈ Γ.C | (c ∩ Θ).Nonempty} := by + ext c + constructor + · rintro ⟨i, rfl⟩ + exact ⟨cuffCell_mem_C Γ hΘ f hk i, cuffCell_inter_cuff_nonempty Γ hΘ f hk i⟩ + · rintro ⟨hc, x, hxc, hxΘ⟩ + have hxN : x ∉ Γ.N := (Γ.cell_subset_diff hc hxc).2 + have hx_union : x ∈ ⋃ i, cuffArc Γ f hk i := by + rw [iUnion_cuffArc] + exact ⟨hxΘ, hxN⟩ + rw [mem_iUnion] at hx_union + rcases hx_union with ⟨i, hxi⟩ + refine ⟨i, ?_⟩ + exact Γ.cell_eq_of_mem (cuffCell_mem_C Γ hΘ f hk i) hc + (cuffArc_subset_cuffCell Γ hΘ f hk i hxi) hxc + +private theorem cuffCell_inter_cuff_eq_cuffArc (hΘ : Θ ∈ cuffs S) (f : Circle ≃ₜ Θ) + (hk : 2 ≤ (Γ.N ∩ Θ).ncard) (i : Fin (Γ.N ∩ Θ).ncard) : + cuffCell Γ f hk i ∩ Θ = cuffArc Γ f hk i := by + refine Subset.antisymm ?_ (fun x hx => ⟨cuffArc_subset_cuffCell Γ hΘ f hk i hx, + (cuffArc_subset_cuff_diff_N Γ f hk i hx).1⟩) + have : T2Space Θ := f.t2Space + let closedArcΘ : Fin (Γ.N ∩ Θ).ncard → Set Θ := fun j => + (fun t : ℝ => f (Circle.exp t)) '' Icc (nodeAngle Γ f j) (upperAngle Γ f hk j) + have hclosed : ∀ j, IsClosed (closedArcΘ j) := fun j => + (isCompact_Icc.image (f.continuous.comp Circle.exp.continuous)).isClosed + have hmem_cuffArc_of_closedArcΘ : ∀ j (z : Θ), z ∈ closedArcΘ j → z.1 ∉ Γ.N → + z.1 ∈ cuffArc Γ f hk j := by + rintro j z ⟨t, ⟨ht₁, ht₂⟩, rfl⟩ hzN + have hne1 : t ≠ nodeAngle Γ f j := by + rintro rfl + have : cuffNode Γ f j ∈ Γ.N := by + have hmem : cuffNode Γ f j ∈ Set.range (cuffNode Γ f) := mem_range_self j + rw [range_cuffNode] at hmem + exact hmem.1 + exact hzN this + have hne2 : t ≠ upperAngle Γ f hk j := by + rintro rfl + have hcp : (f (Circle.exp (upperAngle Γ f hk j))).1 ∈ Γ.N := by + change cuffPoint f (upperAngle Γ f hk j) ∈ Γ.N + rw [cuffPoint_upperAngle] + have hmem : cuffNode Γ f ⟨(j.1 + 1) % (Γ.N ∩ Θ).ncard, Nat.mod_lt _ (by omega)⟩ ∈ + Set.range (cuffNode Γ f) := mem_range_self _ + rw [range_cuffNode] at hmem + exact hmem.1 + exact hzN hcp + exact ⟨t, ⟨lt_of_le_of_ne ht₁ hne1.symm, lt_of_le_of_ne ht₂ hne2⟩, rfl⟩ + let s : Set Θ := Subtype.val ⁻¹' (cuffCell Γ f hk i ∩ Θ) + have hs_img : Subtype.val '' s = cuffCell Γ f hk i ∩ Θ := by + ext y + constructor + · rintro ⟨_, hz, rfl⟩ + exact hz + · intro hy + exact ⟨⟨y, hy.2⟩, hy, rfl⟩ + have hs_conn : IsPreconnected (cuffCell Γ f hk i ∩ Θ) := + (Γ.isPathConnected_cell_inter_cuff (cuffCell_mem_C Γ hΘ f hk i) hΘ + (cuffCell_inter_cuff_nonempty Γ hΘ f hk i)).isConnected.isPreconnected + have hs_pre : IsPreconnected s := by + rwa [← Topology.IsEmbedding.subtypeVal.isInducing.isPreconnected_image, hs_img] + let t₁ : Set Θ := closedArcΘ i + let t₂ : Set Θ := ⋃ j ∈ ({j : Fin (Γ.N ∩ Θ).ncard | j ≠ i} : Set _), closedArcΘ j + have ht₁_closed : IsClosed t₁ := hclosed i + have ht₂_closed : IsClosed t₂ := + (Set.toFinite _).isClosed_biUnion (fun j _ => hclosed j) + have hs_notN : ∀ z ∈ s, z.1 ∉ Γ.N := + fun z hz => (Γ.cell_subset_diff (cuffCell_mem_C Γ hΘ f hk i) hz.1).2 + have hs_sub : s ⊆ t₁ ∪ t₂ := by + intro z hz + have hz_union : z.1 ∈ ⋃ j, cuffArc Γ f hk j := by + rw [iUnion_cuffArc] + exact ⟨z.2, hs_notN z hz⟩ + rw [mem_iUnion] at hz_union + rcases hz_union with ⟨j, t, ht, hzt⟩ + have hz_cl : z ∈ closedArcΘ j := + ⟨t, Ioo_subset_Icc_self ht, Subtype.ext hzt⟩ + by_cases hij : j = i + · left; subst hij; exact hz_cl + · right; exact mem_biUnion hij hz_cl + have h_mid : (⟨cuffMidpoint Γ f hk i, cuffPoint_mem f (cuffMidAngle Γ f hk i)⟩ : Θ) ∈ s ∩ t₁ := by + refine ⟨⟨cuffArc_subset_cuffCell Γ hΘ f hk i (cuffMidpoint_mem_cuffArc Γ f hk i), + cuffPoint_mem f (cuffMidAngle Γ f hk i)⟩, ?_⟩ + exact ⟨cuffMidAngle Γ f hk i, Ioo_subset_Icc_self (cuffMidAngle_mem_Ioo Γ f hk i), rfl⟩ + intro x hx + let z : Θ := ⟨x, hx.2⟩ + have hzs : z ∈ s := hx + rcases hs_sub hzs with hzt₁ | hzt₂ + · exact hmem_cuffArc_of_closedArcΘ i z hzt₁ (hs_notN z hzs) + · exfalso + obtain ⟨w, hws, hwt₁, hwt₂⟩ := + isPreconnected_closed_iff.mp hs_pre t₁ t₂ ht₁_closed ht₂_closed hs_sub ⟨_, h_mid⟩ ⟨z, hzs, + hzt₂⟩ + rw [mem_iUnion₂] at hwt₂ + rcases hwt₂ with ⟨j, hji, hwj⟩ + have hwi : w.1 ∈ cuffArc Γ f hk i := hmem_cuffArc_of_closedArcΘ i w hwt₁ (hs_notN w hws) + have hwj' : w.1 ∈ cuffArc Γ f hk j := hmem_cuffArc_of_closedArcΘ j w hwj (hs_notN w hws) + exact Set.disjoint_left.mp (disjoint_cuffArc Γ f hk (Ne.symm hji)) hwi hwj' + +private theorem injective_cuffCell (hΘ : Θ ∈ cuffs S) (f : Circle ≃ₜ Θ) + (hk : 2 ≤ (Γ.N ∩ Θ).ncard) : + Function.Injective (cuffCell Γ f hk) := by + intro i j h + by_contra hij + have h_eq : cuffArc Γ f hk i = cuffArc Γ f hk j := by + rw [← cuffCell_inter_cuff_eq_cuffArc Γ hΘ f hk i, + ← cuffCell_inter_cuff_eq_cuffArc Γ hΘ f hk j, h] + have hmid : cuffMidpoint Γ f hk i ∈ cuffArc Γ f hk j := + h_eq ▸ cuffMidpoint_mem_cuffArc Γ f hk i + exact Set.disjoint_left.mp (disjoint_cuffArc Γ f hk hij) + (cuffMidpoint_mem_cuffArc Γ f hk i) hmid + +/-- Every cuff $\Theta$ of a surface $S$ that is an O-arc admits a cyclic enumeration +$n_1, c_1, n_2, c_2, \dots, n_k, c_k, (n_1)$ of the nodes and cells of $\Gamma$ bordering $\Theta$, +with $k = |N(\Gamma) \cap \Theta| \ge 2$. +Graph Minors XVII, Section 2 (pages 165–166), Section 4 (page 170), and Section 10 (page 188). -/ +theorem Painting.exists_cuffEnumeration (hΘ : Θ ∈ cuffs S) (hΘ_arc : IsOArc Θ) : + Nonempty (Γ.CuffEnumeration Θ (Γ.N ∩ Θ).ncard) := by + obtain ⟨f⟩ := hΘ_arc + have hk : 2 ≤ (Γ.N ∩ Θ).ncard := Γ.two_le_ncard_nodes_inter_cuff hΘ ⟨f⟩ + exact ⟨{ + cuff_mem := hΘ + two_le := hk + node := cuffNode Γ f + cell := cuffCell Γ f hk + injective_node := injective_cuffNode Γ f + injective_cell := injective_cuffCell Γ hΘ f hk + range_node := range_cuffNode Γ f + range_cell := range_cuffCell Γ hΘ f hk + cell_tilde := cuffCell_tilde Γ hΘ f hk + nodes_in_order := cuffNode_inOrderOn Γ f + }⟩ + +end CuffEnumeration + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CutArcPaint.lean b/LeanPool/GraphMinor/GM17/CutArcPaint.lean new file mode 100644 index 0000000000..a99090b124 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CutArcPaint.lean @@ -0,0 +1,372 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CutSide +public import LeanPool.GraphMinor.Surface.CutIArc +public import LeanPool.GraphMinor.Surface.ModelCriterion + +/-! +# Cutting a painted surface along a normal `I`-arc + +We prove `CutNormalIArcPaintingStatement`, the surface part of (5.3) of Graph Minors XVII (page +172). We cut along the arc with `cutIArc`. +If the cut surface is connected, then `CutSetup.cutSide` gives the painting of the first case. If it +has two parts, then each part +either is simpler than the surface, or it is a closed disc and then its image in the surface is a +disc cut off by the arc. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {Y S : Type} [TopologicalSpace Y] [TopologicalSpace S] + +theorem cut_encard_le {ψ : Y → S} {F : Set S} (h : IsCutting ψ F) {x : S} (hx : x ∈ F) : + (ψ ⁻¹' {x}).encard ≤ 2 := by + obtain ⟨a, b, hab, he⟩ := Set.ncard_eq_two.mp (h.2.2.2.1 x hx) + rw [he, encard_pair hab] + +/-- The restriction of a cut to a clopen set. -/ +theorem cutMap_sub [CompactSpace Y] [T2Space S] {ψ : Y → S} {F : Set S} (h : IsCutting ψ F) + (hF : IsClosed F) {W : Set Y} (hW : IsClopen W) : + CutMap (ψ ∘ (Subtype.val : W → Y)) F := by + refine ⟨h.1.comp continuous_subtype_val, ?_, ?_, hF, ?_, ?_⟩ + · intro y hy y' hy' he + exact Subtype.ext (h.2.2.1 hy hy' he) + · have he : range (ψ ∘ (Subtype.val : W → Y)) \ F = (ψ '' Wᶜ ∪ F)ᶜ := by + ext x + constructor + · rintro ⟨⟨y, rfl⟩, hxF⟩ + rintro (⟨y', hy', he⟩ | h1) + · have hyF : y' ∈ ψ ⁻¹' Fᶜ := by rwa [mem_preimage, he] + have hyEq := h.2.2.1 (show y.1 ∈ ψ ⁻¹' Fᶜ from hxF) hyF he.symm + exact hy' (hyEq ▸ y.2) + · exact hxF h1 + · intro hx + obtain ⟨y, rfl⟩ := h.2.1 x + have hyW : y ∈ W := by + by_contra hn + exact hx (.inl ⟨y, hn, rfl⟩) + exact ⟨⟨⟨y, hyW⟩, rfl⟩, fun h1 => hx (.inr h1)⟩ + rw [he] + exact ((hW.2.isClosed_compl.isCompact.image h.1).isClosed.union hF).isOpen_compl + · intro x hx + have hs : Subtype.val '' ((ψ ∘ (Subtype.val : W → Y)) ⁻¹' {x}) ⊆ ψ ⁻¹' {x} := by + rintro _ ⟨y, hy, rfl⟩ + exact hy + rw [← Subtype.val_injective.injOn.encard_image] + exact (encard_le_encard hs).trans (cut_encard_le h hx) + · intro y hy + exact (mem_bd_sub hW.2).mpr (h.2.2.2.2 hy) + +variable [CompactSpace S] [T2Space S] + +omit [CompactSpace S] in +/-- What one part of the cut surface gives. -/ +theorem side_facts [CompactSpace Y] [T2Space Y] (hS : IsSurface S) (hY : IsSurface Y) {ψ : Y + → S} {F : Set S} (hψ : IsCutting ψ F) {Γ : Painting S} {n₁ n₂ : S} + (hnorm : Γ.IsNormal F) (hFl : IsLineWithEnds F n₁ n₂) (hb : F ∩ bd S = {n₁, n₂}) + (hint : ∀ c ∈ Γ.C, Γ.IsInternalCell c → Disjoint (tilde c) F) + {W : Set Y} (hW : IsClopen W) {Ks₀ : Set (Set Y)} (hfin : Ks₀.Finite) (hne : Ks₀.Nonempty) + (hsub : ∀ K ∈ Ks₀, K ⊆ W) (hcov : ⋃₀ Ks₀ = ψ ⁻¹' F ∩ W) + (hdis : Ks₀.PairwiseDisjoint id) (hK : ∀ K ∈ Ks₀, BijOn ψ K F ∧ ∃ u v, IsLineWithEnds K u v + ∧ ψ u = n₁ ∧ ψ v = n₂) : + (∃ (ι : S → W) (Γ' : Painting W), IsCutSidePainting S Γ F (keepCells Γ (ψ ∘ (Subtype.val : W + → Y)) F) W ι Γ') ∧ (cuffs W).Nonempty := by + obtain ⟨K₀, hK₀⟩ := hne + have hFc : IsClosed F := hFl.isCompact.isClosed + have hmap := cutMap_sub hψ hFc hW + have hneW : Nonempty W := by + obtain ⟨u, v, hl, -⟩ := (hK K₀ hK₀).2 + exact ⟨⟨u, hsub K₀ hK₀ hl.left_mem⟩⟩ + let Ks : Set (Set W) := (fun K => Subtype.val ⁻¹' K) '' Ks₀ + have hpull : ∀ K₁ ∈ Ks, ∃ u v, IsLineWithEnds K₁ u v ∧ (ψ ∘ Subtype.val) u = n₁ ∧ + (ψ ∘ Subtype.val) v = n₂ := by + rintro _ ⟨K, hKs, rfl⟩ + obtain ⟨-, u, v, hl, hu, hv⟩ := hK K hKs + obtain ⟨u', v', rfl, rfl, hl'⟩ := hl.pull (j := (Subtype.val : W → Y)) IsEmbedding.subtypeVal + (by rw [Subtype.range_val]; exact hsub K hKs) + exact ⟨u', v', hl', hu, hv⟩ + choose! e₁ e₂ hl' he₁ he₂ using hpull + have hL : LiftData (ψ ∘ (Subtype.val : W → Y)) F n₁ n₂ Ks e₁ e₂ := by + refine ⟨hfin.image _, hl', ?_, he₁, he₂, ?_, ?_⟩ + · rintro _ ⟨K, hKs, rfl⟩ + obtain ⟨hb1, -⟩ := hK K hKs + refine ⟨fun y hy => hb1.1 hy, fun y hy y' hy' he => Subtype.ext (hb1.2.1 hy hy' he), + fun x hx => ?_⟩ + obtain ⟨y, hy, rfl⟩ := hb1.2.2 hx + exact ⟨⟨y, hsub K hKs hy⟩, hy, rfl⟩ + · rintro _ ⟨K, hKs, rfl⟩ _ ⟨K', hKs', rfl⟩ hne + have hkk : K ≠ K' := fun he => hne (by rw [he]) + exact Disjoint.preimage _ (hdis hKs hKs' hkk) + · ext y + constructor + · rintro ⟨_, ⟨K, hKs, rfl⟩, hy⟩ + exact (hcov.subset ⟨K, hKs, hy⟩).1 + · intro hy + obtain ⟨K, hKs, hyK⟩ := hcov.symm.subset (⟨hy, y.2⟩ : y.1 ∈ ψ ⁻¹' F ∩ W) + exact ⟨_, ⟨K, hKs, rfl⟩, hyK⟩ + have hsurf := isSurface_sub hY hW + have hsetup : CutSetup Γ (ψ ∘ (Subtype.val : W → Y)) F n₁ n₂ Ks e₁ e₂ + := ⟨hmap, hL, hS, hsurf, hnorm, hFl, hb, hint⟩ + refine ⟨hsetup.cutSide ⟨K₀, hK₀, rfl⟩, ?_⟩ + have hl0 := hl' _ ⟨K₀, hK₀, rfl⟩ + have hb0 := hmap.bdF (show e₁ _ ∈ _ from by + have h1 : (ψ ∘ Subtype.val) (e₁ (Subtype.val ⁻¹' K₀)) = n₁ := he₁ _ ⟨K₀, hK₀, rfl⟩ + rw [mem_preimage, h1] + exact hFl.left_mem) + exact ⟨_, _, hb0, rfl⟩ + +omit [CompactSpace S] in +/-- A disc part of the cut surface gives a disc in the surface. -/ +theorem side_disc [CompactSpace Y] {ψ : Y + → S} {F : Set S} {W : Set Y} {Γ : Painting S} (hmap : CutMap (ψ ∘ (Subtype.val : W → Y)) F) + (hnorm : Γ.IsNormal F) (hW : IsClosed W) (hinj : InjOn ψ W) (hsurj : F ⊆ ψ '' W) [Nonempty W] + (e : W ≃ₜ ClosedUnitDisc) : + ∃ Δ : Set S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd S ∧ {c ∈ Γ.C | c ⊆ Δ} + = keepCells Γ (ψ ∘ (Subtype.val : W → Y)) F := by + have hcomp : CompactSpace W := isCompact_iff_compactSpace.mp hW.isCompact + have hi : Function.Injective (ψ ∘ (Subtype.val : W → Y)) := fun y y' he => Subtype.ext + (hinj y.2 y'.2 he) + have hE : IsEmbedding (ψ ∘ (Subtype.val : W → Y)) := (hmap.cont.isClosedEmbedding hi).isEmbedding + let E : W ≃ₜ range (ψ ∘ (Subtype.val : W → Y)) := hE.toHomeomorph + have hbd : discBd (range (ψ ∘ (Subtype.val : W → Y))) = (ψ ∘ Subtype.val) '' bd W := by + rw [discBd, ← image_bd_homeomorph E, image_image] + rfl + refine ⟨range (ψ ∘ (Subtype.val : W → Y)), ⟨e.symm.trans E⟩, ?_, ?_, ?_⟩ + · rw [hbd] + intro x hx + obtain ⟨y, hy, rfl⟩ := hsurj hx + exact ⟨⟨y, hy⟩, hmap.bdF hx, rfl⟩ + · rw [hbd] + rintro _ ⟨y, hy, rfl⟩ + by_cases hF : (ψ ∘ Subtype.val) y ∈ F + · exact .inl hF + · exact .inr ((hmap.mem_bd_iff hF).mp hy) + · ext c + constructor + · rintro ⟨hc, hs⟩ + exact ⟨hc, fun x hx => ⟨hs hx, fun hxF => (arcComponentsIn_subset hc hx).2 (hnorm ⟨hxF, + (arcComponentsIn_subset hc hx).1⟩)⟩⟩ + · rintro ⟨hc, hs⟩ + exact ⟨hc, fun x hx => (hs hx).1⟩ + +omit [CompactSpace S] [T2Space S] in +/-- A closed disc is simpler than a connected surface with a cuff that is not a closed disc. -/ +theorem disc_simpler {D : Type} [TopologicalSpace D] [ConnectedSpace S] (hS : IsSurface S) + (e : D ≃ₜ ClosedUnitDisc) (hn : ¬ Nonempty (S ≃ₜ ClosedUnitDisc)) + (hc : (cuffs S).Nonempty) : IsSimplerThan D S := by + obtain ⟨a', b', c', ⟨e'⟩⟩ := classification.{0} S hS ‹_› + obtain ⟨d⟩ := nonempty_disc_homeo + have hc0 : c' ≠ 0 := by + rintro rfl + obtain ⟨ht, f, hf⟩ := presents_ew a' b' 0 + have h1 := ncard_cuffs hf + rw [← ncard_cuffs_congr e'] at h1 + have h2 := (Set.ncard_pos (cuff_statement.{0} S hS).2.1).mpr hc + omega + have h1 : ¬ (a' = 0 ∧ b' = 0 ∧ c' = 1) := by + rintro ⟨rfl, rfl, rfl⟩ + exact hn ⟨e'.trans d⟩ + exact ⟨0, 0, 1, a', b', c', ⟨e.trans d.symm⟩, ⟨e'⟩, by omega, by omega, by omega⟩ + +/-- The surface part of (5.3) of Graph Minors XVII, page 172. -/ +theorem cutNormalIArc : CutNormalIArcPaintingStatement := by + unfold CutNormalIArcPaintingStatement + intro S _ hcS ht2 hconn hS Γ F n₁ n₂ hnorm hFl hb hint + have hne := hFl.ne' + obtain ⟨Y, tY, ψ, hY, hψ, h1, h2, X, X', hd, hun, lX, lX', bX, bX'⟩ + := cutIArc.{0} S F n₁ n₂ hS hconn hne hb hFl + have ht2Y : T2Space Y := hY.2.1 + have hcY : CompactSpace Y := hY.1 + have hends : ∀ {K : Set Y}, IsLine K → BijOn ψ K F → ∃ u v, IsLineWithEnds K u v ∧ ψ u = n₁ ∧ ψ v + = n₂ := by + intro K hl hbj + obtain ⟨f⟩ := hl + have hline : IsLineWithEnds K (f 0) (f 1) := ⟨f, rfl, rfl⟩ + obtain ⟨a, ha, hr, h0, h1'⟩ := hline.exists_arc + have harc : IsArcMap (ψ ∘ a) := ⟨hψ.1.comp ha.1, fun s t he => ha.2 (hbj.injOn + (hr ▸ mem_range_self s) (hr ▸ mem_range_self t) he)⟩ + have h3 := harc.isLineWithEnds + rw [range_comp, hr, hbj.image_eq] at h3 + have h4 := (lineEnds_eq h3).symm.trans (lineEnds_eq hFl) + simp only [Function.comp, h0, h1'] at h4 + rcases Set.pair_eq_pair_iff.mp h4 with ⟨h5, h6⟩ | ⟨h5, h6⟩ + · exact ⟨_, _, hline, h5, h6⟩ + · exact ⟨_, _, hline.symm, h6, h5⟩ + obtain ⟨x0, x1, hlX, hx0, hx1⟩ := hends lX bX + obtain ⟨y0, y1, hlX', hy0, hy1⟩ := hends lX' bX' + have pX := isPreconnected_line hlX + have pX' := isPreconnected_line hlX' + have hn₁b : n₁ ∈ bd S := (show n₁ ∈ F ∩ bd S from hb ▸ mem_insert _ _).2 + have hcuffS : (cuffs S).Nonempty := ⟨_, n₁, hn₁b, rfl⟩ + have hFc : IsClosed F := hFl.isCompact.isClosed + rcases cut_comps hψ hY pX pX' hun hlX.left_mem hlX'.left_mem with hYc | ⟨W₁, W₂, hne', hsc, hX₁, + hX₂, hW₁, hW₂, hU, hdW, hc₁, hc₂⟩ + · left + have hone : ∀ C ∈ spaceComponents Y, C = univ := fun C hC => by + rw [spaceComponents_eq] at hC + obtain ⟨y, rfl⟩ := hC + exact PreconnectedSpace.connectedComponent_eq_univ y + have hunivc : univ ∈ spaceComponents Y := by + rw [spaceComponents_eq] + exact ⟨x0, PreconnectedSpace.connectedComponent_eq_univ x0⟩ + have hsimp : IsSimplerThan (univ : Set Y) S := by + by_cases hs : connectedComponentIn (bd S) n₁ = connectedComponentIn (bd S) n₂ + · rcases h2 hs with hc | ⟨C₁, C₂, hneC, heq, -, -⟩ + · exact hc.2 univ hunivc + · exfalso + exact hneC ((hone C₁ (heq ▸ mem_insert _ _)).trans (hone C₂ + (heq ▸ mem_insert_of_mem _ rfl)).symm) + · obtain ⟨-, a, b, c, ⟨e⟩, ⟨e'⟩⟩ := h1 hs + exact ⟨a, b, c, a, b, c + 1, ⟨(Homeomorph.Set.univ Y).trans e'⟩, ⟨e⟩, le_rfl, le_rfl, + by omega⟩ + obtain ⟨⟨ι, Γ', hp⟩, hcuf⟩ := side_facts (W := univ) (Ks₀ := {X, X'}) hS hY hψ hnorm hFl hb + hint isClopen_univ (by simp) (by simp) (fun _ _ => subset_univ _) + (by rw [sUnion_pair, hun, inter_univ]) + (by + rintro K (rfl | rfl) K' (rfl | rfl) hne2 + · exact absurd rfl hne2 + · exact hd + · exact hd.symm + · exact absurd rfl hne2) + (by + rintro K (rfl | rfl) + · exact ⟨bX, x0, x1, hlX, hx0, hx1⟩ + · exact ⟨bX', y0, y1, hlX', hy0, hy1⟩) + have hkeep : keepCells Γ (ψ ∘ (Subtype.val : ↥(univ : Set Y) → Y)) F = Γ.C := by + ext c + refine ⟨fun h => h.1, fun hc => ⟨hc, fun x hx => ⟨?_, fun hxF => + (arcComponentsIn_subset hc hx).2 (hnorm ⟨hxF, (arcComponentsIn_subset hc hx).1⟩)⟩⟩⟩ + obtain ⟨y, rfl⟩ := hψ.2.1 x + exact ⟨⟨y, trivial⟩, rfl⟩ + rw [hkeep] at hp + exact ⟨(univ : Set Y), inferInstance, isCompact_iff_compactSpace.mp isCompact_univ, + inferInstance, isConnected_iff_connectedSpace.mp isConnected_univ, ι, Γ', + isSurface_sub hY isClopen_univ, hsimp, hcuf, hp⟩ + · right + have hdis₁ : ∀ y ∈ X', y ∉ W₁ := fun y hy hyW => disjoint_left.mp hdW hyW (hX₂ hy) + have hdis₂ : ∀ y ∈ X, y ∉ W₂ := fun y hy hyW => disjoint_right.mp hdW hyW (hX₁ hy) + have hcov₁ : ψ ⁻¹' F ∩ W₁ = X := by + apply subset_antisymm + · rintro y ⟨hy, hyW⟩ + exact ((hun ▸ hy : y ∈ X ∪ X').resolve_right fun h => hdis₁ y h hyW) + · intro y hy + exact ⟨hun ▸ .inl hy, hX₁ hy⟩ + have hcov₂ : ψ ⁻¹' F ∩ W₂ = X' := by + apply subset_antisymm + · rintro y ⟨hy, hyW⟩ + exact ((hun ▸ hy : y ∈ X ∪ X').resolve_left fun h => hdis₂ y h hyW) + · intro y hy + exact ⟨hun ▸ .inr hy, hX₂ hy⟩ + have hfacts : ∀ {W K : Set Y}, IsClopen W → K ⊆ W → ψ ⁻¹' F ∩ W = K → BijOn ψ K F → + (∃ u v, IsLineWithEnds K u v ∧ ψ u = n₁ ∧ ψ v = n₂) → ConnectedSpace W → + (IsSimplerThan W S → ∃ (S' : Type) (_ : TopologicalSpace S') (_ : CompactSpace S') + (_ : T2Space S') (_ : ConnectedSpace S') (ι : S → S') (Γ' : Painting S'), + IsSurface S' ∧ IsSimplerThan S' S ∧ (cuffs S').Nonempty ∧ IsCutSidePainting S Γ F + (keepCells Γ (ψ ∘ (Subtype.val : W → Y)) F) S' ι Γ') ∧ + (Nonempty (W ≃ₜ ClosedUnitDisc) → ∃ Δ : Set S, IsClosedDisc Δ ∧ F ⊆ discBd Δ + ∧ discBd Δ ⊆ F ∪ bd S ∧ {c ∈ Γ.C | c ⊆ Δ} = keepCells Γ (ψ ∘ (Subtype.val : W → Y)) F) + := by + intro W K hW hKW hcov hbj hex hcn + constructor + · intro hsimp + obtain ⟨⟨ι, Γ', hp⟩, hcuf⟩ := side_facts (W := W) (Ks₀ := {K}) hS hY hψ hnorm hFl hb hint + hW (by simp) (by simp) + (by rintro _ rfl; exact hKW) (by rw [sUnion_singleton, hcov]) (by simp) + (by rintro _ rfl; exact ⟨hbj, hex⟩) + exact ⟨W, inferInstance, isCompact_iff_compactSpace.mp hW.1.isCompact, inferInstance, + hcn, ι, Γ', isSurface_sub hY hW, hsimp, hcuf, hp⟩ + · rintro ⟨e⟩ + have hinj : InjOn ψ W := by + intro y hy y' hy' he + by_cases hF : ψ y ∈ F + · exact hbj.injOn (hcov ▸ ⟨hF, hy⟩) (hcov ▸ ⟨(he ▸ hF : ψ y' ∈ F), hy'⟩) he + · exact hψ.2.2.1 hF (by rw [mem_preimage, ← he]; exact hF) he + have : Nonempty W := ⟨e.symm ⟨0, by simp [ClosedUnitDisc]⟩⟩ + exact side_disc (cutMap_sub hψ hFc hW) hnorm hW.1 hinj (fun x hx => by + obtain ⟨y, hy, rfl⟩ := hbj.surjOn hx + exact ⟨y, hKW hy, rfl⟩) e + obtain ⟨hp₁, hq₁⟩ := hfacts hW₁ hX₁ hcov₁ bX ⟨x0, x1, hlX, hx0, hx1⟩ hc₁ + obtain ⟨hp₂, hq₂⟩ := hfacts hW₂ hX₂ hcov₂ bX' ⟨y0, y1, hlX', hy0, hy1⟩ hc₂ + have hm₁ := cutMap_sub hψ hFc hW₁ + have hm₂ := cutMap_sub hψ hFc hW₂ + have hdR : Disjoint (range (ψ ∘ (Subtype.val : W₁ → Y)) \ F) (range (ψ ∘ (Subtype.val : W₂ + → Y)) \ F) := by + rw [disjoint_left] + rintro _ ⟨⟨y, rfl⟩, hF⟩ ⟨⟨y', he⟩, -⟩ + have he' : ψ y'.1 = ψ y.1 := he + have h5 := hψ.2.2.1 (show y'.1 ∈ ψ ⁻¹' Fᶜ by rw [mem_preimage, he']; exact hF) hF he' + exact disjoint_left.mp hdW y.2 (h5 ▸ y'.2) + have hcov : ∀ x, x ∉ F → x ∈ (range (ψ ∘ (Subtype.val : W₁ → Y)) \ F) ∪ (range (ψ ∘ + (Subtype.val : W₂ → Y)) \ F) := fun x hx => by + obtain ⟨y, rfl⟩ := hψ.2.1 x + rcases (hU ▸ mem_univ y : y ∈ W₁ ∪ W₂) with hy | hy + · exact .inl ⟨⟨⟨y, hy⟩, rfl⟩, hx⟩ + · exact .inr ⟨⟨⟨y, hy⟩, rfl⟩, hx⟩ + have hoff : ∀ c ∈ Γ.C, ∀ x ∈ c, x ∉ F := fun c hc x hx hxF => (arcComponentsIn_subset hc hx).2 + (hnorm ⟨hxF, (arcComponentsIn_subset hc hx).1⟩) + have hcase : ∀ c ∈ Γ.C, c ∈ keepCells Γ (ψ ∘ (Subtype.val : W₁ → Y)) F ∨ c ∈ keepCells Γ (ψ ∘ + (Subtype.val : W₂ → Y)) F := fun c hc => by + rcases (arcComponentsIn_isPathConnected hc).isConnected.isPreconnected.subset_or_subset + hm₁.isOpen hm₂.isOpen hdR (fun x hx => hcov x (hoff c hc x hx)) with h5 | h5 + · exact .inl ⟨hc, h5⟩ + · exact .inr ⟨hc, h5⟩ + have hrc₁ : IsClosed (range (ψ ∘ (Subtype.val : W₁ → Y))) := by + have := isCompact_iff_compactSpace.mp hW₁.1.isCompact + exact (isCompact_range hm₁.cont).isClosed + have hrc₂ : IsClosed (range (ψ ∘ (Subtype.val : W₂ → Y))) := by + have := isCompact_iff_compactSpace.mp hW₂.1.isCompact + exact (isCompact_range hm₂.cont).isClosed + refine ⟨keepCells Γ (ψ ∘ (Subtype.val : W₁ → Y)) F, keepCells Γ (ψ ∘ (Subtype.val : W₂ + → Y)) F, fun c hc => hc.1, ?_, ?_, ?_⟩ + · ext c + constructor + · intro hc + refine ⟨hc.1, fun hc₁ => ?_⟩ + obtain ⟨x, hx⟩ := arcComponentsIn_nonempty hc.1 + exact disjoint_left.mp hdR (hc₁.2 hx) (hc.2 hx) + · rintro ⟨hc, hn⟩ + exact (hcase c hc).resolve_left hn + · intro c₁ hc₁ c₂ hc₂ x hx + by_contra hxF + have h5 : x ∈ range (ψ ∘ (Subtype.val : W₁ → Y)) := closure_minimal (fun z hz => + (hc₁.2 hz).1) hrc₁ hx.1.1 + have h6 : x ∈ range (ψ ∘ (Subtype.val : W₂ → Y)) := closure_minimal (fun z hz => + (hc₂.2 hz).1) hrc₂ hx.2.1 + exact disjoint_left.mp hdR ⟨h5, hxF⟩ ⟨h6, hxF⟩ + · have hW₁c : W₁ ∈ spaceComponents Y := hsc ▸ mem_insert _ _ + have hW₂c : W₂ ∈ spaceComponents Y := hsc ▸ mem_insert_of_mem _ rfl + by_cases hs : connectedComponentIn (bd S) n₁ = connectedComponentIn (bd S) n₂ + · rcases h2 hs with hc | ⟨C₁, C₂, hneC, heq, ⟨d⟩, ⟨s⟩⟩ + · exact ⟨.inr (hp₂ (hc.2 W₂ hW₂c)), .inr (hp₁ (hc.2 W₁ hW₁c))⟩ + · rcases Set.pair_eq_pair_iff.mp (hsc.symm.trans heq) with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · refine ⟨.inl (hq₁ ⟨d⟩), ?_⟩ + by_cases hD : Nonempty (S ≃ₜ ClosedUnitDisc) + · obtain ⟨e⟩ := hD + exact .inl (hq₂ ⟨s.trans e⟩) + · exact .inr (hp₁ (disc_simpler hS d hD hcuffS)) + · refine ⟨?_, .inl (hq₂ ⟨d⟩)⟩ + by_cases hD : Nonempty (S ≃ₜ ClosedUnitDisc) + · obtain ⟨e⟩ := hD + exact .inl (hq₁ ⟨s.trans e⟩) + · exact .inr (hp₂ (disc_simpler hS d hD hcuffS)) + · exfalso + obtain ⟨hYc, -⟩ := h1 hs + have hone : ∀ C ∈ spaceComponents Y, C = univ := fun C hC => by + rw [spaceComponents_eq] at hC + obtain ⟨y, rfl⟩ := hC + exact PreconnectedSpace.connectedComponent_eq_univ y + exact hne' ((hone W₁ hW₁c).trans (hone W₂ hW₂c).symm) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CutCell.lean b/LeanPool/GraphMinor/GM17/CutCell.lean new file mode 100644 index 0000000000..5701f1b4b5 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CutCell.lean @@ -0,0 +1,302 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.MarkCross +public import LeanPool.GraphMinor.Surface.Wedge +public import LeanPool.GraphMinor.Surface.CutTwoArc + +/-! +# Lifting a cell to the cut surface + +Let `ψ` be the map from a cut surface to the surface. It is a homeomorphism off the arc `F` +(`CutMap.exists_sec`, `CutMap.mem_bd_iff`). The +closure of the preimage of a cell off `F` is a copy of the closure of the cell +(`CutMap.exists_lift`). The key step is that a cell comes to +each point of `F` from one side only, because a small neighbourhood of a point of the boundary of a +disc stays connected after removing +the point. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology Filter Metric GraphMinor.Surface + +variable {Y S : Type} [TopologicalSpace Y] [TopologicalSpace S] + +/-- The properties of the map from one part of the cut surface to the surface. -/ +structure CutMap (ψ : Y → S) (F : Set S) : Prop where + cont : Continuous ψ + inj : InjOn ψ (ψ ⁻¹' Fᶜ) + isOpen : IsOpen (range ψ \ F) + closed : IsClosed F + fib : ∀ x ∈ F, (ψ ⁻¹' {x}).encard ≤ 2 + bdF : ψ ⁻¹' F ⊆ bd Y + +variable [CompactSpace Y] [T2Space Y] [T2Space S] {ψ : Y → S} {F : Set S} + +omit [T2Space Y] in +/-- The map has a continuous inverse off `F`. -/ +theorem CutMap.exists_sec [Nonempty Y] (h : CutMap ψ F) : + ∃ σ : S → Y, ContinuousOn σ (range ψ \ F) ∧ (∀ x ∈ range ψ \ F, ψ (σ x) = x) ∧ ∀ y, ψ y ∉ F → σ + (ψ y) = y := by + have hr : ∀ y, ψ y ∉ F → Function.invFun ψ (ψ y) = y := fun y hy => by + have h1 : ψ (Function.invFun ψ (ψ y)) = ψ y := Function.invFun_eq ⟨y, rfl⟩ + exact h.inj (show _ ∈ ψ ⁻¹' Fᶜ by rw [mem_preimage, h1]; exact hy) hy h1 + refine ⟨Function.invFun ψ, fun x hx => ?_, fun x hx => Function.invFun_eq hx.1, hr⟩ + rw [ContinuousWithinAt, _root_.tendsto_nhds] + intro V hV hxV + have hO : IsOpen (ψ '' Vᶜ)ᶜ := (h.cont.isClosedMap _ hV.isClosed_compl).isOpen_compl + have hxO : x ∈ (ψ '' Vᶜ)ᶜ := by + rintro ⟨y, hy, rfl⟩ + exact hy (by rw [hr y hx.2] at hxV; exact hxV) + filter_upwards [mem_nhdsWithin_of_mem_nhds (hO.mem_nhds hxO), self_mem_nhdsWithin] with x' h1 h2 + by_contra h3 + exact h1 ⟨_, h3, Function.invFun_eq h2.1⟩ + +omit [T2Space Y] in +/-- Off `F` the map keeps the boundary. -/ +theorem CutMap.mem_bd_iff [Nonempty Y] (h : CutMap ψ F) {y : Y} (hy : ψ y ∉ F) : y ∈ bd Y ↔ ψ y ∈ + bd S := by + obtain ⟨σ, h1, h2, h3⟩ := h.exists_sec + have hW : IsOpen (ψ ⁻¹' Fᶜ) := h.closed.isOpen_compl.preimage h.cont + let e : (ψ ⁻¹' Fᶜ : Set Y) ≃ₜ (range ψ \ F : Set S) := + { toFun := fun y => ⟨ψ y, mem_range_self _, y.2⟩ + invFun := fun x => ⟨σ x, show ψ (σ x) ∈ Fᶜ by rw [h2 x x.2]; exact x.2.2⟩ + left_inv := fun y => Subtype.ext (h3 y y.2) + right_inv := fun x => Subtype.ext (h2 x x.2) + continuous_toFun := (h.cont.comp continuous_subtype_val).subtype_mk _ + continuous_invFun := (continuousOn_iff_continuous_domRestrict.mp h1).subtype_mk _ } + have h4 := isInteriorPoint_homeomorph_iff e ⟨y, hy⟩ + have h5 := mem_bd_sub hW (x := ⟨y, hy⟩) + have h6 := mem_bd_sub h.isOpen (x := e ⟨y, hy⟩) + have h7 : (e ⟨y, hy⟩ : S) = ψ y := rfl + rw [h7] at h6 + rw [← h5, ← h6] + exact not_congr h4.symm + +omit [T2Space Y] in +/-- The preimage of a connected set off `F`. -/ +theorem CutMap.isPreconnected_preimage [Nonempty Y] (h : CutMap ψ F) {P : Set S} + (hP : IsPreconnected P) (hs : P ⊆ range ψ \ F) : IsPreconnected (ψ ⁻¹' P) := by + obtain ⟨σ, h1, h2, h3⟩ := h.exists_sec + have h4 : ψ ⁻¹' P = σ '' P := by + ext y + constructor + · intro hy + exact ⟨ψ y, hy, h3 y (hs hy).2⟩ + · rintro ⟨x, hx, rfl⟩ + rw [mem_preimage, h2 x (hs hx)] + exact hx + rw [h4] + exact hP.image _ (h1.mono hs) + +/-- A closed ball without a point of its sphere is convex. -/ +theorem isPreconnected_ball_diff {z₀ : ℂ} (hz : ‖z₀‖ = 1) (ε : ℝ) : IsPreconnected ((closedBall + (0 : ℂ) 1 ∩ ball z₀ ε) \ {z₀}) := by + refine Convex.isPreconnected (show Convex ℝ _ from ?_) + rw [convex_iff_forall_pos] + intro p hp q hq a b ha hb hab + refine ⟨(convex_iff_forall_pos.mp ((convex_closedBall (0 : ℂ) 1).inter + (convex_ball z₀ ε))) hp.1 hq.1 ha hb hab, fun he => ?_⟩ + by_cases hpq : p = q + · apply hp.2 + rw [mem_singleton_iff] at he ⊢ + rw [← he, ← hpq, ← add_smul, hab, one_smul] + · have h1 := (strictConvex_closedBall ℝ (0 : ℂ) 1) hp.1.1 hq.1.1 hpq ha hb hab + rw [interior_closedBall _ one_ne_zero, mem_singleton_iff.mp he] at h1 + simp [hz] at h1 + +/-- A cell off `F` comes to a point of `F` from one side only: the map is injective on the closure +of the preimage of the cell. -/ +theorem CutMap.injOn_closure [Nonempty Y] (h : CutMap ψ F) {c : Set S} (hcF : Disjoint c F) + (hA : IsClosedDisc (closure c)) (ht : tilde c ⊆ discBd (closure c)) + (hfin : (tilde c).Finite) (hcR : c ⊆ range ψ \ F) : InjOn ψ (closure (ψ ⁻¹' c)) := by + intro y hy y' hy' he + by_contra hne + have hmap : ψ '' closure (ψ ⁻¹' c) ⊆ closure c := (image_closure_subset_closure_image + h.cont).trans (closure_mono (image_preimage_subset _ _)) + have huA : ψ y ∈ closure c := hmap (mem_image_of_mem _ hy) + have huF : ψ y ∈ F := by + by_contra hn + exact hne (h.inj hn (by rw [mem_preimage, ← he]; exact hn) he) + have huc : ψ y ∉ c := fun hu => disjoint_left.mp hcF hu huF + have hut : ψ y ∈ tilde c := ⟨huA, huc⟩ + obtain ⟨V, V', hV, hV', hyV, hyV', hdis⟩ := t2_separation hne + have hfibs : ψ ⁻¹' {ψ y} ⊆ V ∪ V' := fun z hz => by + rcases eq_or_of_encard_le_two (h.fib _ huF) (show y ∈ ψ ⁻¹' {ψ y} from rfl) + (show y' ∈ ψ ⁻¹' {ψ y} from he.symm) hz hne with rfl | rfl + · exact .inl hyV + · exact .inr hyV' + have hO : IsOpen (ψ '' (V ∪ V')ᶜ)ᶜ := (h.cont.isClosedMap _ (hV.union + hV').isClosed_compl).isOpen_compl + have huO : ψ y ∈ (ψ '' (V ∪ V')ᶜ)ᶜ := by + rintro ⟨z, hz, hez⟩ + exact hz (hfibs hez) + obtain ⟨k, g, ch⟩ := hA.exists_isChart + have hAc : IsCompact (closure c) := isCompact_of_isClosedDisc hA + have hz₀ : ‖k (ψ y)‖ = 1 := by + have h1 : k (ψ y) ∈ sphere (0 : ℂ) 1 := ch.bd ▸ mem_image_of_mem _ (ht hut) + simpa using h1 + have hbad : IsCompact (closure c ∩ (ψ '' (V ∪ V')ᶜ)ᶜᶜ ∪ (tilde c \ {ψ y})) := + (hAc.inter_right hO.isClosed_compl).union (hfin.subset sdiff_subset).isCompact + have hbads : closure c ∩ (ψ '' (V ∪ V')ᶜ)ᶜᶜ ∪ (tilde c \ {ψ y}) ⊆ closure c + := union_subset inter_subset_left (sdiff_subset.trans (fun x hx => hx.1)) + have hk0 : k (ψ y) ∉ k '' (closure c ∩ (ψ '' (V ∪ V')ᶜ)ᶜᶜ ∪ (tilde c \ {ψ y})) := by + rintro ⟨x, hx, hex⟩ + have h1 : x = ψ y := by rw [← ch.gh (hbads hx), hex, ch.gh huA] + rcases hx with hx | hx + · exact hx.2 (h1 ▸ huO) + · exact hx.2 h1 + have hbado := (hbad.image_of_continuousOn (ch.hc.mono hbads)).isClosed.isOpen_compl + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hbado _ hk0 + have hgood : ∀ x ∈ closure c, k x ∈ ball (k (ψ y)) ε → x ∈ (ψ '' (V ∪ V')ᶜ)ᶜ ∧ (x ∈ tilde c → x + = ψ y) := fun x hx hk => by + have h1 : x ∉ closure c ∩ (ψ '' (V ∪ V')ᶜ)ᶜᶜ ∪ (tilde c \ {ψ y}) := fun hm => hball hk + (mem_image_of_mem _ hm) + constructor + · by_contra h2 + exact h1 (.inl ⟨hx, h2⟩) + · intro h2 + by_contra h3 + exact h1 (.inr ⟨h2, h3⟩) + set C : Set ℂ := (closedBall (0 : ℂ) 1 ∩ ball (k (ψ y)) ε) \ {k (ψ y)} with hC + have hCs : C ⊆ closedBall 0 1 := fun w hw => hw.1.1 + have hPc : g '' C ⊆ c := by + rintro _ ⟨w, hw, rfl⟩ + have hgA : g w ∈ closure c := ch.gm hw.1.1 + have hkg : k (g w) = w := ch.hg hw.1.1 + by_contra hn + have h1 := (hgood _ hgA (by rw [hkg]; exact hw.1.2)).2 ⟨hgA, hn⟩ + exact hw.2 (by rw [mem_singleton_iff, ← hkg, h1]) + have hP : IsPreconnected (g '' C) := (isPreconnected_ball_diff hz₀ ε).image _ (ch.gc.mono hCs) + have hT := h.isPreconnected_preimage hP (hPc.trans hcR) + have hTs : ψ ⁻¹' (g '' C) ⊆ V ∪ V' := by + rintro t ⟨w, hw, hew⟩ + have h1 := (hgood _ (ch.gm hw.1.1) (by rw [ch.hg hw.1.1]; exact hw.1.2)).1 + by_contra h2 + exact h1 ⟨t, h2, hew.symm⟩ + have hO2 : ∀ {y₁ : Y} {V₁ : Set Y}, y₁ ∈ closure (ψ ⁻¹' c) → ψ y₁ = ψ y → IsOpen V₁ → y₁ ∈ V₁ → ¬ + (ψ ⁻¹' (g '' C) ⊆ V₁ᶜ) := by + intro y₁ V₁ hy₁ he₁ hV₁ hyV₁ hsub + obtain ⟨O₂, hO₂, hO₂e⟩ := continuousOn_iff'.mp ch.hc (ball (k (ψ y)) ε) isOpen_ball + have hV₂ : IsOpen (V₁ ∩ ψ ⁻¹' O₂) := hV₁.inter (hO₂.preimage h.cont) + have hm : ψ y ∈ k ⁻¹' ball (k (ψ y)) ε ∩ closure c := ⟨mem_ball_self hε, huA⟩ + rw [hO₂e] at hm + have hy₂ : y₁ ∈ V₁ ∩ ψ ⁻¹' O₂ := by + refine ⟨hyV₁, ?_⟩ + rw [mem_preimage, he₁] + exact hm.1 + obtain ⟨w, ⟨hw1, hw2⟩, hw3⟩ := mem_closure_iff.mp hy₁ _ hV₂ hy₂ + have hwA : ψ w ∈ closure c := subset_closure hw3 + have hwk : k (ψ w) ∈ ball (k (ψ y)) ε := by + have : ψ w ∈ O₂ ∩ closure c := ⟨hw2, hwA⟩ + rw [← hO₂e] at this + exact this.1 + have hwn : ψ w ≠ ψ y := fun h9 => huc (h9 ▸ hw3) + have hwC : k (ψ w) ∈ C := ⟨⟨ch.hm hwA, hwk⟩, fun h9 => hwn (by rw [← ch.gh hwA, h9, ch.gh huA])⟩ + exact hsub (show w ∈ ψ ⁻¹' (g '' C) from ⟨_, hwC, ch.gh hwA⟩) hw1 + rcases hT.subset_or_subset hV hV' hdis hTs with h1 | h1 + · exact hO2 hy' he.symm hV' hyV' (h1.trans fun x hx hx' => disjoint_left.mp hdis hx hx') + · exact hO2 hy rfl hV hyV (h1.trans fun x hx hx' => disjoint_left.mp hdis hx' hx) + +omit [CompactSpace Y] [T2Space S] in +/-- The inverse of an injective map on a compact set is continuous. -/ +theorem continuousOn_invFunOn' {A T : Type*} [TopologicalSpace A] [Nonempty A] [TopologicalSpace T] + [T2Space T] {Δ : Set A} (hc : IsCompact Δ) + {f : A → T} (hf : ContinuousOn f Δ) (hi : InjOn f Δ) : ContinuousOn (Function.invFunOn f Δ) + (f '' Δ) := by + have hl : LeftInvOn (Function.invFunOn f Δ) f Δ := hi.leftInvOn_invFunOn + have hcomp : CompactSpace Δ := isCompact_iff_compactSpace.mp hc + let g : Δ → f '' Δ := fun x => ⟨f x, x.1, x.2, rfl⟩ + have hg : Continuous g := (continuousOn_iff_continuous_domRestrict.mp hf).subtype_mk _ + have hgb : Function.Bijective g := by + constructor + · intro x y h + exact Subtype.ext (hi x.2 y.2 (congrArg Subtype.val h)) + · rintro ⟨_, x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + let e : Δ ≃ₜ f '' Δ := hg.homeoOfEquivCompactToT2 (f := Equiv.ofBijective g hgb) + have hr : (f '' Δ).domRestrict (Function.invFunOn f Δ) = fun y => (e.symm y).1 := by + funext y + obtain ⟨x, rfl⟩ := e.surjective y + rw [e.symm_apply_apply] + exact hl x.2 + rw [continuousOn_iff_continuous_domRestrict, hr] + exact continuous_subtype_val.comp e.symm.continuous + +/-- The closure of the preimage of a cell is a copy of the closure of the cell. -/ +theorem CutMap.exists_lift [Nonempty Y] (h : CutMap ψ F) {c : Set S} (hcF : Disjoint c F) + (hA : IsClosedDisc (closure c)) (ht : tilde c ⊆ discBd (closure c)) + (hfin : (tilde c).Finite) (hcR : c ⊆ range ψ \ F) : + ∃ τ : S → Y, ContinuousOn τ (closure c) ∧ τ '' closure c = closure (ψ ⁻¹' c) ∧ + (∀ x ∈ closure c, ψ (τ x) = x) ∧ (∀ y ∈ closure (ψ ⁻¹' c), τ (ψ y) = y) ∧ + tilde (ψ ⁻¹' c) = τ '' tilde c ∧ IsClosedDisc (closure (ψ ⁻¹' c)) ∧ tilde (ψ ⁻¹' c) ⊆ discBd + (closure (ψ ⁻¹' c)) := by + have hi := h.injOn_closure hcF hA ht hfin hcR + set M := closure (ψ ⁻¹' c) with hM + have hMc : IsCompact M := isClosed_closure.isCompact + have hψM : ψ '' M = closure c := by + apply subset_antisymm + · exact (image_closure_subset_closure_image h.cont).trans (closure_mono + (image_preimage_subset _ _)) + · refine closure_minimal (fun x hx => ?_) (hMc.image h.cont).isClosed + obtain ⟨y, rfl⟩ := (hcR hx).1 + exact ⟨y, subset_closure hx, rfl⟩ + let τ : S → Y := Function.invFunOn ψ M + have hτc : ContinuousOn τ (closure c) := hψM ▸ continuousOn_invFunOn' hMc h.cont.continuousOn hi + have hl : ∀ y ∈ M, τ (ψ y) = y := fun y hy => hi.leftInvOn_invFunOn hy + have hr : ∀ x ∈ closure c, ψ (τ x) = x := fun x hx => Function.invFunOn_eq (hψM ▸ hx : x ∈ ψ '' M) + have hτM : τ '' closure c = M := by + rw [← hψM, image_image] + exact (image_congr hl).trans (image_id' _) + obtain ⟨h1, h2⟩ := hA.image hτc (by rw [hτM]; exact h.cont.continuousOn) hr + rw [hτM] at h1 h2 + have htl : tilde (ψ ⁻¹' c) = τ '' tilde c := by + apply subset_antisymm + · rintro y ⟨hy, hyc⟩ + have hyA : ψ y ∈ closure c := hψM ▸ mem_image_of_mem _ hy + exact ⟨ψ y, ⟨hyA, hyc⟩, hl y hy⟩ + · rintro _ ⟨x, hx, rfl⟩ + refine ⟨hτM.subset (mem_image_of_mem _ hx.1), fun hc => hx.2 ?_⟩ + rw [mem_preimage, hr x hx.1] at hc + exact hc + refine ⟨τ, hτc, hτM, hr, hl, htl, h1, ?_⟩ + rw [htl, h2] + exact image_mono ht + +omit [CompactSpace Y] [T2Space Y] [T2Space S] in +/-- A closed disc without two points of its boundary. -/ +theorem disc_diff_two [T2Space Y] {D : Set Y} {u v : Y} (hD : IsClosedDisc D) (hu : u ∈ discBd D) + (hv : v ∈ discBd D) : + closure (D \ {u, v}) = D ∧ tilde (D \ {u, v}) = {u, v} ∧ IsPathConnected (D \ {u, v}) ∧ + (D \ {u, v}).Nonempty := by + have hbd : discBd D ⊆ D := discBd_subset D + obtain ⟨hne, hpc, h1⟩ := hD.sdiff_of_inter_subset_discBd + (F := {u, v}) (by + rintro x ⟨rfl | rfl, -⟩ + · exact hu + · exact hv) + have h2 : tilde (D \ {u, v}) = {u, v} := by + rw [tilde, h1] + ext x + simp only [Set.mem_sdiff, not_and, not_not] + constructor + · rintro ⟨h3, h4⟩ + exact h4 h3 + · rintro h3 + refine ⟨?_, fun _ => h3⟩ + rcases h3 with rfl | rfl + · exact hbd hu + · exact hbd hv + exact ⟨h1, h2, hpc, hne⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CutPaint.lean b/LeanPool/GraphMinor/GM17/CutPaint.lean new file mode 100644 index 0000000000..0ca4775a29 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CutPaint.lean @@ -0,0 +1,438 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CutCell + +/-! +# The painting on the cut surface + +Let `ψ` map a part of the cut surface to the surface, and let `Γ` be a painting that is normal along +the arc `F`. We lift the cells that +lie in the image of `ψ`, and we add one new border cell along each lift of `F` (`cutPainting`). This +is the painting `Γ₀` of the proof of +(5.3) of Graph Minors XVII (page 172). The new cells are thin discs from `exists_wedge`. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {Y S : Type} [TopologicalSpace Y] [TopologicalSpace S] + +/-- The data of a cut: `Ks` are the lifts of the arc `F` in `Y`, and `e₁ K`, `e₂ K` are the ends of +a lift `K`. -/ +structure LiftData (ψ : Y → S) (F : Set S) (n₁ n₂ : S) (Ks : Set (Set Y)) (e₁ e₂ : Set Y + → Y) : Prop where + finite : Ks.Finite + line : ∀ K ∈ Ks, IsLineWithEnds K (e₁ K) (e₂ K) + bij : ∀ K ∈ Ks, BijOn ψ K F + end₁ : ∀ K ∈ Ks, ψ (e₁ K) = n₁ + end₂ : ∀ K ∈ Ks, ψ (e₂ K) = n₂ + disj : Ks.PairwiseDisjoint id + cover : ⋃₀ Ks = ψ ⁻¹' F + +omit [TopologicalSpace S] in +/-- There are disjoint thin discs along the lifts. -/ +theorem exists_wedges {ψ : Y → S} {F : Set S} {n₁ n₂ : S} {Ks : Set (Set Y)} {e₁ e₂ : Set Y → Y} + (hY : IsSurface Y) (hbdF : ψ ⁻¹' F ⊆ bd Y) + (hL : LiftData ψ F n₁ n₂ Ks e₁ e₂) {Z : Set Y} (hZ : IsClosed Z) (hZK : ∀ K ∈ Ks, Z ∩ K ⊆ + {e₁ K, e₂ K}) : + ∃ D : Set Y → Set Y, (∀ K ∈ Ks, IsClosedDisc (D K) ∧ K ⊆ discBd (D K) ∧ D K ∩ Z ⊆ {e₁ K, e₂ K} + ∧ D K ∩ bd Y = K) ∧ + ∀ K ∈ Ks, ∀ K' ∈ Ks, K ≠ K' → Disjoint (D K) (D K') := by + classical + have ht2 : T2Space Y := hY.2.1 + have hsub : ∀ Ls ⊆ Ks, Ls.Finite → ∃ D : Set Y → Set Y, (∀ K ∈ Ls, IsClosedDisc (D K) + ∧ K ⊆ discBd (D K) ∧ D K ∩ Z ⊆ {e₁ K, e₂ K} ∧ D K ∩ bd Y = K) ∧ + ∀ K ∈ Ls, ∀ K' ∈ Ls, K ≠ K' → Disjoint (D K) (D K') := by + intro Ls hLs hfin + induction Ls, hfin using Set.Finite.induction_on with + | empty => exact ⟨fun _ => ∅, by simp, by simp⟩ + | @insert K Ms hKn hfin ih => + obtain ⟨D, hD, hdis⟩ := ih ((subset_insert _ _).trans hLs) + have hKs : K ∈ Ks := hLs (mem_insert _ _) + have hKb : K ⊆ bd Y := fun z hz => hbdF (hL.cover ▸ ⟨K, hKs, hz⟩) + have hcl : IsClosed (Z ∪ ⋃ K' ∈ Ms, D K') := + hZ.union (hfin.isClosed_biUnion fun K' hK' => (hD K' hK').1.isClosed) + have hm : (Z ∪ ⋃ K' ∈ Ms, D K') ∩ K ⊆ {e₁ K, e₂ K} := by + rintro z ⟨h | h, hzK⟩ + · exact hZK K hKs ⟨h, hzK⟩ + · obtain ⟨K', hK', hz⟩ := mem_iUnion₂.mp h + have h1 : z ∈ D K' ∩ bd Y := ⟨hz, hKb hzK⟩ + rw [(hD K' hK').2.2.2] at h1 + have hne : K ≠ K' := fun h2 => hKn (h2 ▸ hK') + exact absurd h1 (disjoint_left.mp (hL.disj hKs (hLs ((subset_insert _ _) hK')) hne) hzK) + obtain ⟨E, hE, hEb, hEZ, hEbd⟩ := exists_wedge hY (hL.line K hKs) hKb hcl hm + have hdisE : ∀ K' ∈ Ms, Disjoint E (D K') := fun K' hK' => by + rw [disjoint_left] + intro z hzE hzD + have h1 : z ∈ E ∩ (Z ∪ ⋃ K' ∈ Ms, D K') := ⟨hzE, .inr (mem_iUnion₂.mpr ⟨K', hK', hzD⟩)⟩ + have h2 := hEZ h1 + have h3 : z ∈ K := by + rcases h2 with rfl | rfl + · exact (hL.line K hKs).left_mem + · exact (hL.line K hKs).right_mem + have h4 : z ∈ D K' ∩ bd Y := ⟨hzD, hKb h3⟩ + rw [(hD K' hK').2.2.2] at h4 + have hne : K ≠ K' := fun h5 => hKn (h5 ▸ hK') + exact disjoint_left.mp (hL.disj hKs (hLs ((subset_insert _ _) hK')) hne) h3 h4 + have hne' : ∀ K' ∈ Ms, K' ≠ K := fun K' h he => hKn (he ▸ h) + refine ⟨Function.update D K E, ?_, ?_⟩ + · rintro K' (rfl | hK') + · simp only [Function.update_self] + exact ⟨hE, hEb, fun z hz => hEZ ⟨hz.1, .inl hz.2⟩, hEbd⟩ + · rw [Function.update_of_ne (hne' _ hK')] + exact hD K' hK' + · rintro K₁ (rfl | h₁) K₂ (rfl | h₂) hne + · exact absurd rfl hne + · rw [Function.update_self, Function.update_of_ne (hne' _ h₂)] + exact hdisE K₂ h₂ + · rw [Function.update_self, Function.update_of_ne (hne' _ h₁)] + exact (hdisE K₁ h₁).symm + · rw [Function.update_of_ne (hne' _ h₁), Function.update_of_ne (hne' _ h₂)] + exact hdis K₁ h₁ K₂ h₂ hne + exact hsub Ks subset_rfl hL.finite + +/-- The hypotheses on a cut of a painted surface. -/ +structure CutSetup (Γ : Painting S) (ψ : Y → S) (F : Set S) (n₁ n₂ : S) (Ks : Set (Set Y)) + (e₁ e₂ : Set Y → Y) : Prop where + map : CutMap ψ F + lift : LiftData ψ F n₁ n₂ Ks e₁ e₂ + surfS : IsSurface S + surfY : IsSurface Y + norm : Γ.IsNormal F + arc : IsLineWithEnds F n₁ n₂ + bdF : F ∩ bd S = {n₁, n₂} + internal : ∀ c ∈ Γ.C, Γ.IsInternalCell c → Disjoint (tilde c) F + +/-- The cells of `Γ` in the image of `ψ`, off `F`. -/ +def keepCells (Γ : Painting S) (ψ : Y → S) (F : Set S) : Set (Set S) := {c ∈ Γ.C | c ⊆ range ψ \ F} + +/-- The nodes that stay: those off `F`, and the ends of `F`. -/ +def keepNodes (Γ : Painting S) (F : Set S) (n₁ n₂ : S) : Set S := (Γ.N \ F) ∪ {n₁, n₂} + +section + +variable {Γ : Painting S} {ψ : Y → S} {F : Set S} {n₁ n₂ : S} {Ks : Set (Set Y)} {e₁ e₂ : Set Y → Y} + +namespace CutSetup + +variable (h : CutSetup Γ ψ F n₁ n₂ Ks e₁ e₂) +include h + +theorem t2 : T2Space S := h.surfS.2.1 +theorem t2Y : T2Space Y := h.surfY.2.1 +theorem compY : CompactSpace Y := h.surfY.1 + +theorem n₁_mem : n₁ ∈ F ∩ bd S := h.bdF ▸ mem_insert _ _ +theorem n₂_mem : n₂ ∈ F ∩ bd S := h.bdF ▸ mem_insert_of_mem _ rfl + +theorem n₁_N : n₁ ∈ Γ.N := h.norm ⟨h.n₁_mem.1, Γ.bd_subset h.n₁_mem.2⟩ +theorem n₂_N : n₂ ∈ Γ.N := h.norm ⟨h.n₂_mem.1, Γ.bd_subset h.n₂_mem.2⟩ + +theorem keepNodes_subset : keepNodes Γ F n₁ n₂ ⊆ Γ.N := by + rintro x (hx | rfl | rfl) + · exact hx.1 + · exact h.n₁_N + · exact h.n₂_N + +theorem cell_disjoint {c : Set S} (hc : c ∈ Γ.C) : Disjoint c F := + disjoint_left.mpr fun _ hx hF => (arcComponentsIn_subset hc hx).2 (h.norm ⟨hF, + (arcComponentsIn_subset hc hx).1⟩) + +theorem side {c : Set S} (hc : c ∈ Γ.C) : c ⊆ range ψ \ F ∨ Disjoint c (range ψ) := by + have := h.t2 + have := h.t2Y + have := h.compY + have hrc : IsClosed (range ψ) := (isCompact_range h.map.cont).isClosed + have hp := (arcComponentsIn_isPathConnected hc).isConnected.isPreconnected + have hsub : c ⊆ (range ψ \ F) ∪ (range ψ)ᶜ := fun x hx => by + by_cases hr : x ∈ range ψ + · exact .inl ⟨hr, disjoint_left.mp (h.cell_disjoint hc) hx⟩ + · exact .inr hr + rcases hp.subset_or_subset h.map.isOpen hrc.isOpen_compl (disjoint_left.mpr fun x hx hx' + => hx' hx.1) hsub with h1 | h1 + · exact .inl h1 + · exact .inr (disjoint_left.mpr fun x hx hx' => h1 hx hx') + +theorem tilde_F {c : Set S} (hc : c ∈ Γ.C) : tilde c ∩ F ⊆ {n₁, n₂} := by + have := h.t2 + by_cases hb : (c ∩ bd S).Nonempty + · obtain ⟨u, v, -, htilde, -, -, hu, hv⟩ := Γ.border_cell_exists_ends hc hb + rintro x ⟨hx, hxF⟩ + rw [← h.bdF] + refine ⟨hxF, ?_⟩ + rw [htilde] at hx + rcases hx with rfl | rfl + · exact hu.2 + · exact hv.2 + · rintro x ⟨hx, hxF⟩ + exact absurd hxF (disjoint_left.mp (h.internal c hc ⟨hc, hb⟩) hx) + +theorem finite_nodes : (ψ ⁻¹' keepNodes Γ F n₁ n₂).Finite := by + refine (Γ.finite_N.subset h.keepNodes_subset).preimage' fun x _ => ?_ + by_cases hx : x ∈ F + · exact Set.finite_of_encard_le_coe (h.map.fib x hx) + · refine Set.Subsingleton.finite fun y hy y' hy' => ?_ + have h1 : ψ y = x := hy + have h2 : ψ y' = x := hy' + exact h.map.inj (show ψ y ∉ F by rwa [h1]) (show ψ y' ∉ F by rwa [h2]) (h1.trans h2.symm) + +theorem end_of_mem {K : Set Y} (hK : K ∈ Ks) {y : Y} (hy : y ∈ K) (h1 : ψ y = n₁ ∨ ψ y = n₂) : y ∈ + ({e₁ K, e₂ K} : Set Y) := by + have hl := h.lift.line K hK + have hi := (h.lift.bij K hK).injOn + rcases h1 with h1 | h1 + · exact .inl (hi hy hl.left_mem (h1.trans (h.lift.end₁ K hK).symm)) + · exact .inr (hi hy hl.right_mem (h1.trans (h.lift.end₂ K hK).symm)) + +variable [Nonempty Y] + +theorem exists_lift {c : Set S} (hc : c ∈ keepCells Γ ψ F) : + ∃ τ : S → Y, ContinuousOn τ (closure c) ∧ τ '' closure c = closure (ψ ⁻¹' c) ∧ + (∀ x ∈ closure c, ψ (τ x) = x) ∧ (∀ y ∈ closure (ψ ⁻¹' c), τ (ψ y) = y) ∧ + tilde (ψ ⁻¹' c) = τ '' tilde c ∧ IsClosedDisc (closure (ψ ⁻¹' c)) ∧ tilde (ψ ⁻¹' c) ⊆ discBd + (closure (ψ ⁻¹' c)) := by + have := h.t2 + have := h.t2Y + have := h.compY + exact h.map.exists_lift (h.cell_disjoint hc.1) (Γ.isClosedDisc_closure_cell hc.1) + (Γ.tilde_subset_discBd hc.1) (Γ.cell_disc c hc.1).2.2.1 hc.2 + +theorem closure_lift {c : Set S} (hc : c ∈ keepCells Γ ψ F) : closure + (ψ ⁻¹' c) ⊆ ψ ⁻¹' c ∪ ψ ⁻¹' keepNodes Γ F n₁ n₂ := by + obtain ⟨τ, -, -, h3, h4, h5, -, -⟩ := h.exists_lift hc + intro y hy + by_cases hyc : y ∈ ψ ⁻¹' c + · exact .inl hyc + · right + obtain ⟨x, hx, rfl⟩ := (h5 ▸ (⟨hy, hyc⟩ : y ∈ tilde (ψ ⁻¹' c)) : y ∈ τ '' tilde c) + rw [mem_preimage, h3 x hx.1] + by_cases hxF : x ∈ F + · exact .inr (h.tilde_F hc.1 ⟨hx, hxF⟩) + · exact .inl ⟨Γ.tilde_subset_N hc.1 hx, hxF⟩ + +omit [Nonempty Y] in +theorem lift_nodes {c : Set S} (hc : c ∈ keepCells Γ ψ F) : Disjoint (ψ ⁻¹' c) + (ψ ⁻¹' keepNodes Γ F n₁ n₂) := + disjoint_left.mpr fun _ hy hy' => (arcComponentsIn_subset hc.1 hy).2 (h.keepNodes_subset hy') + +/-- The closed set that the new cells have to avoid. -/ +def Z (_h : CutSetup Γ ψ F n₁ n₂ Ks e₁ e₂) : Set Y := (⋃ c ∈ keepCells Γ ψ F, closure + (ψ ⁻¹' c)) ∪ ψ ⁻¹' keepNodes Γ F n₁ n₂ + +omit [Nonempty Y] in +theorem isClosed_Z : IsClosed h.Z := by + have := h.t2Y + have hfin : (keepCells Γ ψ F).Finite := Γ.finite_cells.subset fun c hc => hc.1 + exact (hfin.isClosed_biUnion fun c _ => isClosed_closure).union h.finite_nodes.isClosed + +theorem Z_inter {K : Set Y} (hK : K ∈ Ks) : h.Z ∩ K ⊆ {e₁ K, e₂ K} := by + have hF : ∀ y ∈ K, ψ y ∈ F := fun y hy => (show y ∈ ψ ⁻¹' F from h.lift.cover ▸ ⟨K, hK, hy⟩) + have key : ∀ y ∈ K, y ∈ ψ ⁻¹' keepNodes Γ F n₁ n₂ → y ∈ ({e₁ K, e₂ K} : Set Y) := fun y hy hn + => by + rcases hn with hn | hn | hn + · exact absurd (hF y hy) hn.2 + · exact h.end_of_mem hK hy (.inl hn) + · exact h.end_of_mem hK hy (.inr hn) + rintro y ⟨hy | hy, hyK⟩ + · obtain ⟨c, hc, hyc⟩ := mem_iUnion₂.mp hy + rcases h.closure_lift hc hyc with h1 | h1 + · exact absurd (hF y hyK) (disjoint_left.mp (h.cell_disjoint hc.1) h1) + · exact key y hyK h1 + · exact key y hyK hy + +theorem exists_painting : ∃ (D : Set Y → Set Y) (Γ' : Painting Y), + (∀ K ∈ Ks, IsClosedDisc (D K) ∧ K ⊆ discBd (D K) ∧ D K ∩ h.Z ⊆ {e₁ K, e₂ K} ∧ D K ∩ bd Y = K) ∧ + Γ'.N = ψ ⁻¹' keepNodes Γ F n₁ n₂ ∧ Γ'.C = (fun c => ψ ⁻¹' c) '' keepCells Γ ψ F ∪ (fun K + => D K \ {e₁ K, e₂ K}) '' Ks := by + have ht2S := h.t2 + have ht2 := h.t2Y + have hcY := h.compY + obtain ⟨D, hD, hdis⟩ := exists_wedges h.surfY h.map.bdF h.lift h.isClosed_Z fun K hK + => h.Z_inter hK + have hfinC : (keepCells Γ ψ F).Finite := Γ.finite_cells.subset fun c hc => hc.1 + have hbdD : ∀ K ∈ Ks, e₁ K ∈ discBd (D K) ∧ e₂ K ∈ discBd (D K) := fun K hK => + ⟨(hD K hK).2.1 (h.lift.line K hK).left_mem, (hD K hK).2.1 (h.lift.line K hK).right_mem⟩ + have hnew := fun K (hK : K ∈ Ks) => disc_diff_two (hD K hK).1 (hbdD K hK).1 (hbdD K hK).2 + have hends : ∀ K ∈ Ks, e₁ K ∈ ψ ⁻¹' keepNodes Γ F n₁ n₂ ∧ + e₂ K ∈ ψ ⁻¹' keepNodes Γ F n₁ n₂ := by + intro K hK + constructor + · rw [mem_preimage, h.lift.end₁ K hK] + exact .inr (.inl rfl) + · rw [mem_preimage, h.lift.end₂ K hK] + exact .inr (.inr rfl) + have hDN : ∀ K ∈ Ks, ∀ y ∈ D K, y ∈ ψ ⁻¹' keepNodes Γ F n₁ n₂ → y ∈ ({e₁ K, e₂ K} : Set Y) + := fun K hK y hy hn => + (hD K hK).2.2.1 ⟨hy, .inr hn⟩ + let U' : Set Y := ((⋃ c ∈ keepCells Γ ψ F, closure (ψ ⁻¹' c)) ∪ ψ ⁻¹' keepNodes Γ F n₁ n₂) ∪ ⋃ K + ∈ Ks, D K + let N' : Set Y := ψ ⁻¹' keepNodes Γ F n₁ n₂ + let J : Set (Set Y) := (fun c => ψ ⁻¹' c) '' keepCells Γ ψ F ∪ (fun K => D K \ {e₁ K, e₂ K}) '' Ks + have hJ : arcComponentsIn (U' \ N') = J := by + refine arcComponentsIn_eq_of_finite_cover ((hfinC.image _).union (h.lift.finite.image _)) ?_ ?_ + ?_ ?_ ?_ + · ext y + constructor + · rintro ⟨d, (⟨c, hc, rfl⟩ | ⟨K, hK, rfl⟩), hy⟩ + · exact ⟨.inl (.inl (mem_iUnion₂.mpr ⟨c, hc, subset_closure hy⟩)), + disjoint_left.mp (h.lift_nodes hc) hy⟩ + · exact ⟨.inr (mem_iUnion₂.mpr ⟨K, hK, hy.1⟩), fun hn => hy.2 (hDN K hK y hy.1 hn)⟩ + · rintro ⟨(hy | hy) | hy, hn⟩ + · obtain ⟨c, hc, hyc⟩ := mem_iUnion₂.mp hy + exact ⟨_, .inl ⟨c, hc, rfl⟩, (h.closure_lift hc hyc).resolve_right hn⟩ + · exact absurd hy hn + · obtain ⟨K, hK, hyK⟩ := mem_iUnion₂.mp hy + refine ⟨_, .inr ⟨K, hK, rfl⟩, hyK, ?_⟩ + rintro (rfl | rfl) + · exact hn (hends K hK).1 + · exact hn (hends K hK).2 + · rintro d (⟨c, hc, rfl⟩ | ⟨K, hK, rfl⟩) + · obtain ⟨x, hx⟩ := arcComponentsIn_nonempty hc.1 + obtain ⟨y, rfl⟩ := (hc.2 hx).1 + exact ⟨y, hx⟩ + · exact (hnew K hK).2.2.2 + · rintro d (⟨c, hc, rfl⟩ | ⟨K, hK, rfl⟩) + · obtain ⟨σ, h1, h2, h3⟩ := h.map.exists_sec + have h4 : ψ ⁻¹' c = σ '' c := by + ext y + constructor + · intro hy + exact ⟨ψ y, hy, h3 y (hc.2 hy).2⟩ + · rintro ⟨x, hx, rfl⟩ + rw [mem_preimage, h2 x (hc.2 hx)] + exact hx + change IsPathConnected (ψ ⁻¹' c) + rw [h4] + exact (arcComponentsIn_isPathConnected hc.1).image' (h1.mono hc.2) + · exact (hnew K hK).2.2.1 + · have hcd : ∀ c ∈ keepCells Γ ψ F, ∀ K ∈ Ks, Disjoint (ψ ⁻¹' c) (D K \ {e₁ K, e₂ K}) + := fun c hc K hK => by + rw [disjoint_left] + intro y hy hy' + exact hy'.2 ((hD K hK).2.2.1 ⟨hy'.1, .inl (mem_iUnion₂.mpr ⟨c, hc, subset_closure hy⟩)⟩) + rintro d (⟨c, hc, rfl⟩ | ⟨K, hK, rfl⟩) d' (⟨c', hc', rfl⟩ | ⟨K', hK', rfl⟩) hne + · have hcc : c ≠ c' := fun he => hne (by rw [he]) + exact (arcComponentsIn_disjoint hc.1 hc'.1 hcc).preimage _ + · exact hcd c hc K' hK' + · exact (hcd c' hc' K hK).symm + · have hkk : K ≠ K' := fun he => hne (by rw [he]) + exact (hdis K hK K' hK' hkk).mono sdiff_subset sdiff_subset + · rintro d (⟨c, hc, rfl⟩ | ⟨K, hK, rfl⟩) + · apply subset_antisymm + · rintro y ⟨hy, -, hn⟩ + exact (h.closure_lift hc hy).resolve_right hn + · intro y hy + exact ⟨subset_closure hy, .inl (.inl (mem_iUnion₂.mpr ⟨c, hc, subset_closure hy⟩)), + disjoint_left.mp (h.lift_nodes hc) hy⟩ + · simp only [(hnew K hK).1] + apply subset_antisymm + · rintro y ⟨hy, -, hn⟩ + refine ⟨hy, ?_⟩ + rintro (rfl | rfl) + · exact hn (hends K hK).1 + · exact hn (hends K hK).2 + · intro y hy + exact ⟨hy.1, .inr (mem_iUnion₂.mpr ⟨K, hK, hy.1⟩), fun hn => hy.2 (hDN K hK y hy.1 hn)⟩ + let Γ' : Painting Y := + { U := U' + N := N' + isClosed_U := ((hfinC.isClosed_biUnion fun c _ => isClosed_closure).union + h.finite_nodes.isClosed).union + (h.lift.finite.isClosed_biUnion fun K hK => (hD K hK).1.isClosed) + N_subset := fun y hy => .inl (.inr hy) + finite_N := h.finite_nodes + finite_cells := by + rw [hJ] + exact (hfinC.image _).union (h.lift.finite.image _) + cell_disc := by + rw [hJ] + rintro d (⟨c, hc, rfl⟩ | ⟨K, hK, rfl⟩) + · obtain ⟨τ, -, -, -, -, h5, h6, h7⟩ := h.exists_lift hc + have hf := (Γ.cell_disc c hc.1).2.2 + exact ⟨h6, h7, h5 ▸ hf.1.image _, by + change (tilde (ψ ⁻¹' c)).ncard ≤ 3 + rw [h5] + exact (ncard_image_le hf.1).trans hf.2⟩ + · simp only [(hnew K hK).1, (hnew K hK).2.1] + refine ⟨(hD K hK).1, ?_, by simp, ?_⟩ + · rintro _ (rfl | rfl) + · exact (hbdD K hK).1 + · exact (hbdD K hK).2 + · exact (ncard_insert_le _ _).trans (by simp) + bd_subset := by + intro y hy + by_cases hyF : ψ y ∈ F + · obtain ⟨K, hK, hyK⟩ := (show y ∈ ⋃₀ Ks from h.lift.cover ▸ hyF) + exact .inr (mem_iUnion₂.mpr ⟨K, hK, discBd_subset _ ((hD K hK).2.1 hyK)⟩) + · have hyb := (h.map.mem_bd_iff hyF).mp hy + by_cases hyN : ψ y ∈ Γ.N + · exact .inl (.inr (.inl ⟨hyN, hyF⟩)) + · obtain ⟨c, hc, hyc⟩ := exists_mem_arcComponentsIn (show ψ y ∈ Γ.U \ Γ.N from + ⟨Γ.bd_subset hyb, hyN⟩) + have hck : c ∈ keepCells Γ ψ F := ⟨hc, (h.side hc).resolve_right fun h1 + => disjoint_left.mp h1 hyc (mem_range_self y)⟩ + exact .inl (.inl (mem_iUnion₂.mpr ⟨c, hck, subset_closure hyc⟩)) + border_cell := by + rw [hJ] + rintro d (⟨c, hc, rfl⟩ | ⟨K, hK, rfl⟩) hb + · obtain ⟨τ, h1, h2, h3, h4, h5, -, -⟩ := h.exists_lift hc + obtain ⟨y, hyc, hyb⟩ := hb + have hyF : ψ y ∉ F := disjoint_left.mp (h.cell_disjoint hc.1) hyc + have hb' : (c ∩ bd S).Nonempty := ⟨ψ y, hyc, (h.map.mem_bd_iff hyF).mp hyb⟩ + obtain ⟨u, v, huv, htilde, hL, hdiff, -, -⟩ := Γ.border_cell_exists_ends hc.1 hb' + have hLe : closure (ψ ⁻¹' c) ∩ bd Y = τ '' (closure c ∩ bd S) := by + apply subset_antisymm + · rintro y ⟨hy, hyb⟩ + have hyA : ψ y ∈ closure c := by + rw [← h2] at hy + obtain ⟨x, hx, rfl⟩ := hy + rw [h3 x hx] + exact hx + refine ⟨ψ y, ⟨hyA, ?_⟩, h4 y hy⟩ + by_cases hF : ψ y ∈ F + · have h9 : ψ y ∈ ({n₁, n₂} : Set S) := h.tilde_F hc.1 ⟨⟨hyA, disjoint_right.mp + (h.cell_disjoint hc.1) hF⟩, hF⟩ + exact (h.bdF.symm.subset h9).2 + · exact (h.map.mem_bd_iff hF).mp hyb + · rintro _ ⟨x, hx, rfl⟩ + refine ⟨h2.subset (mem_image_of_mem _ hx.1), ?_⟩ + by_cases hF : x ∈ F + · exact h.map.bdF (by rw [mem_preimage, h3 x hx.1]; exact hF) + · exact (h.map.mem_bd_iff (by rw [h3 x hx.1]; exact hF)).mpr + (by rw [h3 x hx.1]; exact hx.2) + obtain ⟨a, ha, hr, rfl, rfl⟩ := hL.exists_arc + have hmem : ∀ t, a t ∈ closure c := fun t => (hr.subset (mem_range_self t)).1 + have hcomp : Continuous (τ ∘ a) := h1.comp_continuous ha.1 hmem + have harc : IsArcMap (τ ∘ a) := ⟨hcomp, fun s t he => ha.2 (by + have := congrArg ψ he + simpa only [Function.comp, h3 _ (hmem _)] using this)⟩ + have hline := harc.isLineWithEnds + rw [range_comp, hr, ← hLe] at hline + have hne : τ (a 0) ≠ τ (a 1) := hline.ne' + have ht : tilde (ψ ⁻¹' c) = {τ (a 0), τ (a 1)} := by + rw [h5, htilde, image_pair] + rw [ht] + obtain ⟨f, -⟩ := id hline + exact ⟨ncard_pair hne, by simp, ⟨f⟩, lineEnds_eq hline⟩ + · simp only [(hnew K hK).1, (hnew K hK).2.1, (hD K hK).2.2.2] + have hl := h.lift.line K hK + obtain ⟨f, -⟩ := id hl + exact ⟨ncard_pair hl.ne', by simp, ⟨f⟩, lineEnds_eq hl⟩ } + exact ⟨D, Γ', hD, rfl, hJ⟩ + +end CutSetup + +end + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CutSide.lean b/LeanPool/GraphMinor/GM17/CutSide.lean new file mode 100644 index 0000000000..0814bd3e2a --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CutSide.lean @@ -0,0 +1,492 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CutPaint +public import Mathlib.Analysis.Complex.Cardinality +public import Mathlib.SetTheory.Cardinal.Continuum +public import Mathlib.Analysis.Real.Cardinality + +/-! +# One side of a cut is a cut-side painting + +We show that the painting of `CutSetup.exists_painting` together with an injection of the surface +into the cut surface is a cut-side +painting (`CutSetup.cutSide`). The injection is the inverse of `ψ` off the arc `F`. The rest of the +surface, which may be large, goes +injectively into the inside of a lift of `F`, which has as many points as the surface +(`exists_inj_line`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface Cardinal + +variable {Y S : Type} [TopologicalSpace Y] [TopologicalSpace S] + +/-- A surface has at most continuum many points. -/ +theorem mk_le_continuum (hS : IsSurface S) : #S ≤ 𝔠 := by + have hc : CompactSpace S := hS.1 + choose U O j k hU hO hx hj hk hm hm' hl hl' using fun x : S => (hS.2.2 x).exists_chart + obtain ⟨t, ht⟩ := CompactSpace.elim_nhds_subcover U fun x => (hU x).mem_nhds (hx x) + have hex : ∀ z : S, ∃ x ∈ t, z ∈ U x := fun z => by + have hz : z ∈ ⋃ x ∈ t, U x := ht ▸ mem_univ z + obtain ⟨x, hxt, hz⟩ := mem_iUnion₂.mp hz + exact ⟨x, hxt, hz⟩ + choose i hi hi' using hex + let f : S → t × ℂ := fun z => (⟨i z, hi z⟩, j (i z) z) + have hf : Function.Injective f := by + intro z z' he + have h1 : i z = i z' := congrArg (fun p => (p.1 : S)) (congrArg Prod.fst he) + have h2 : j (i z) z = j (i z') z' := congrArg Prod.snd he + rw [← h1] at h2 + have h3 := hl (i z) (hi' z) + have h4 := hl (i z) (h1 ▸ hi' z' : z' ∈ U (i z)) + rw [← h3, ← h4, h2] + calc #S ≤ #(t × ℂ) := mk_le_of_injective hf + _ = #t * 𝔠 := by rw [mk_prod, mk_complex]; simp + _ ≤ ℵ₀ * 𝔠 := mul_le_mul_left (mk_le_aleph0) _ + _ = 𝔠 := aleph0_mul_continuum + +/-- A surface goes injectively into the inside of any line. -/ +theorem exists_inj_line (hS : IsSurface S) {K : Set Y} {u v : Y} + (hK : IsLineWithEnds K u v) : + ∃ j : S → Y, Function.Injective j ∧ ∀ x, j x ∈ K ∧ j x ≠ u ∧ j x ≠ v := by + obtain ⟨a, ha, rfl, rfl, rfl⟩ := hK.exists_arc + have h1 : #S ≤ #(Ioo (0 : ℝ) 1) := by + rw [mk_Ioo_real zero_lt_one] + exact mk_le_continuum hS + obtain ⟨e⟩ := Cardinal.le_def _ _ |>.mp h1 + have hmem : ∀ x, (e x : ℝ) ∈ Icc (0 : ℝ) 1 := fun x => ⟨(e x).2.1.le, (e x).2.2.le⟩ + refine ⟨fun x => a ⟨e x, hmem x⟩, fun x x' h => ?_, fun x => ⟨mem_range_self _, fun h => ?_, + fun h => ?_⟩⟩ + · exact e.injective (Subtype.ext (congrArg (fun t : unitInterval => (t : ℝ)) (ha.2 h))) + · exact (e x).2.1.ne (congrArg Subtype.val (ha.2 h)).symm + · exact (e x).2.2.ne (congrArg Subtype.val (ha.2 h)) + +theorem isPreconnected_line {L : Set S} {u v : S} (hL : IsLineWithEnds L u v) : IsPreconnected L + := by + obtain ⟨a, ha, rfl, -, -⟩ := hL.exists_arc + exact isPreconnected_range ha.1 + +/-- A cuff contains every connected part of the boundary that meets it. -/ +theorem subset_cuff {Φ P : Set Y} (hΦ : Φ ∈ cuffs Y) (hP : IsPreconnected P) + (hb : P ⊆ bd Y) {x : Y} (hx : x ∈ Φ) (hxP : x ∈ P) : P ⊆ Φ := by + obtain ⟨p, -, rfl⟩ := hΦ + rw [connectedComponentIn_eq hx] + exact hP.subset_connectedComponentIn hxP hb + +/-- Each node on the boundary is an end of a border cell. -/ +theorem exists_cell_node [T2Space S] (hS : IsSurface S) {Γ : Painting S} {n : S} (hn : n ∈ Γ.N) + (hb : n ∈ bd S) : ∃ c ∈ Γ.C, n ∈ tilde c := by + have hΘ : connectedComponentIn (bd S) n ∈ cuffs S := ⟨n, hb, rfl⟩ + have hO := (cuff_statement.{0} S hS).2.2 _ hΘ + have hnΘ : n ∈ connectedComponentIn (bd S) n := mem_connectedComponentIn hb + obtain ⟨φ⟩ := id hO + have h1 : ∃ m ∈ connectedComponentIn (bd S) n, m ≠ n := by + by_contra hcon + push Not at hcon + have h2 := hcon _ (φ 1).2 + have h3 := hcon _ (φ (Circle.exp Real.pi)).2 + have h4 : φ 1 = φ (Circle.exp Real.pi) := Subtype.ext (h2.trans h3.symm) + have h5 := congrArg (fun z : Circle => (z : ℂ)) (φ.injective h4) + norm_num at h5 + obtain ⟨m, hm, hne⟩ := h1 + obtain ⟨A, B, hA, -, hu, -⟩ := hO.lines hnΘ hm hne.symm + have hAb : A ⊆ bd S := fun z hz => connectedComponentIn_subset _ _ (hu.subset (Or.inl hz)) + obtain ⟨c, hc, -, -, h2, -⟩ := exists_border_cell hA hAb (subset_univ _) hn fun _ _ => .inl + (subset_univ _) + exact ⟨c, hc, h2⟩ + +private theorem cut_cuff_node_order + {Y : Type} + {S : Type} + [TopologicalSpace Y] + [TopologicalSpace S] + {Γ : Painting S} + {ψ : Y → S} + {F : Set S} + {n₁ : S} + {n₂ : S} + {Ks : Set (Set Y)} + {e₁ : Set Y → Y} + {e₂ : Set Y → Y} + (h : CutSetup Γ ψ F n₁ n₂ Ks e₁ e₂) + [T2Space S] + [T2Space Y] + (Γ' : Painting Y) + (hN : Γ'.N = ψ ⁻¹' keepNodes Γ F n₁ n₂) + (σ : S → Y) + (hσ₁ : ∀ x ∈ range ψ \ F, ψ (σ x) = x) + (ι : S → Y) + (A : Set S) + (hA : A = {n | n ∈ Γ.N \ F ∧ ∃ c ∈ keepCells Γ ψ F, n ∈ tilde c}) + (hιR : ∀ x ∈ range ψ \ F, ι x = σ x) + (hAR : ∀ n ∈ A, n ∈ range ψ \ F) + (hOS : ∀ C ∈ cuffs S, IsOArc C) + (hOY : ∀ C ∈ cuffs Y, IsOArc C) + (hactive : ∀ n ∈ Γ.N, n ∉ F → n ∈ range ψ \ F → n ∈ bd S → n ∈ A) + (hlift : ∀ {L : Set S} {u v : S}, IsLineWithEnds L u v → L ⊆ bd S → + Disjoint L F → u ∈ range ψ \ F → + L ⊆ range ψ \ F ∧ IsLineWithEnds (σ '' L) (σ u) (σ v) ∧ σ '' L ⊆ bd Y) + (hcuffb : ∀ {Θ : Set S}, Θ ∈ cuffs S → Θ ⊆ bd S) + (hfull : ∀ Θ ∈ cuffs S, ∀ a ∈ Θ, a ∈ range ψ \ F → Disjoint Θ F → + ∀ Φ ∈ cuffs Y, σ a ∈ Φ → ∀ y ∈ Γ'.N, y ∈ Φ → ∃ m ∈ A ∩ Θ, y = ι m) + (hFnode : ∀ (Θ : Set S), ∀ p ∈ Θ, Θ ∈ cuffs S → p ∈ F → p ∈ F ∩ (Γ.N ∩ Θ)) : + ∀ Φ ∈ cuffs Y, ∀ x₁ ∈ Γ'.N ∩ Φ, ∀ x₂ ∈ Γ'.N ∩ Φ, ∀ x₃ ∈ Γ'.N ∩ Φ, ∀ x₄ ∈ Γ'.N ∩ Φ, + GM19.InOrderOn Φ x₁ x₂ x₃ x₄ → ∀ n₁ ∈ A, x₁ = ι n₁ → ∀ n₃ ∈ A, x₃ = ι n₃ → ∀ + Θ ∈ cuffs S, n₁ ∈ Θ → n₃ ∈ Θ → (∃ a ∈ F ∩ (Γ.N ∩ Θ), ∃ b ∈ F ∩ (Γ.N ∩ Θ), GM19.InOrderOn Θ + n₁ a n₃ b) ∨ (∃ n₂ ∈ A ∩ Θ, x₂ = ι n₂ ∧ + ∃ b ∈ F ∩ (Γ.N ∩ Θ) ∪ {m | m ∈ A ∩ Θ ∧ + x₄ = ι m}, GM19.InOrderOn Θ n₁ n₂ n₃ b) ∨ ∃ n₄ ∈ {n | n ∈ Γ.N \ F ∧ ∃ c ∈ keepCells Γ ψ F, n + ∈ tilde c} ∩ Θ, x₄ = ι n₄ ∧ ∃ a ∈ F ∩ (Γ.N ∩ Θ) ∪ {m | m ∈ {n | n ∈ Γ.N \ F ∧ ∃ c ∈ + keepCells Γ ψ F, n ∈ tilde c} ∩ Θ ∧ x₂ = ι m}, GM19.InOrderOn Θ n₁ a n₃ n₄ := by + subst A + let A : Set S := {n | n ∈ Γ.N \ F ∧ ∃ c ∈ keepCells Γ ψ F, n ∈ tilde c} + intro Φ hΦ x₁ hx₁ x₂ hx₂ x₃ hx₃ x₄ hx₄ hord a ha hxa e he hxe Θ hΘ haΘ heΘ + have haR := hAR a ha + have heR := hAR e he + have hO := hOS Θ hΘ + rw [hιR a haR] at hxa + rw [hιR e heR] at hxe + subst hxa hxe + have hb₀ : ∀ y ∈ Γ'.N ∩ Φ, ∃ b, b ∈ (F ∩ (Γ.N ∩ Θ)) ∪ {m ∈ A ∩ Θ | y = ι m} := fun y hy => by + by_cases hd : Disjoint Θ F + · obtain ⟨m, hm, hm'⟩ := hfull Θ hΘ a haΘ haR hd Φ hΦ hx₁.2 y hy.1 hy.2 + exact ⟨m, .inr ⟨hm, hm'⟩⟩ + · obtain ⟨p, hp, hpF⟩ := not_disjoint_iff.mp hd + exact ⟨p, .inl (hFnode Θ p hp hΘ hpF)⟩ + by_cases hae : a = e + · subst hae + right + rcases eq_of_inOrder hord with hx | hx + · left + obtain ⟨b, hb⟩ := hb₀ x₄ hx₄ + have hbΘ : b ∈ Θ := by + rcases hb with hb | hb + · exact hb.2.2 + · exact hb.1.2 + exact ⟨a, ⟨ha, haΘ⟩, by rw [hx, hιR a haR], b, hb, inOrder_three hO haΘ hbΘ⟩ + · right + obtain ⟨b, hb⟩ := hb₀ x₂ hx₂ + have hbΘ : b ∈ Θ := by + rcases hb with hb | hb + · exact hb.2.2 + · exact hb.1.2 + exact ⟨a, ⟨ha, haΘ⟩, by rw [hx, hιR a haR], b, hb, inOrderOn_cyclic2 + (inOrder_three hO haΘ hbΘ)⟩ + have hon : ∀ {L : Set S} {u v : S}, IsLineWithEnds L u v → L ⊆ Θ → Disjoint L F → u ∈ range ψ \ F + → ∀ y ∈ Γ'.N, y ∈ σ '' L → ∃ n ∈ A ∩ Θ, y = ι n ∧ n ∈ L := by + intro L u v hL hs hd hu y hyN hy + obtain ⟨hLR, -, -⟩ := hlift hL (hs.trans (hcuffb hΘ)) hd hu + obtain ⟨n, hn, rfl⟩ := hy + have hmk : ψ (σ n) ∈ keepNodes Γ F n₁ n₂ := by + have h1 := hyN + rw [hN] at h1 + exact h1 + rw [hσ₁ n (hLR hn)] at hmk + exact ⟨n, ⟨hactive n (h.keepNodes_subset hmk) (disjoint_left.mp hd hn) (hLR hn) (hcuffb hΘ + (hs hn)), hs hn⟩, (hιR n (hLR hn)).symm, hn⟩ + obtain ⟨L₁, L₂, hL₁, hL₂, hu₁₂, -⟩ := hO.lines haΘ heΘ hae + by_cases hex : ∃ L L' : Set S, IsLineWithEnds L a e ∧ IsLineWithEnds L' a e ∧ L ∪ L' = Θ + ∧ Disjoint L F + swap + · left + have d₁ : ¬ Disjoint L₁ F := fun d => hex ⟨L₁, L₂, hL₁, hL₂, hu₁₂, d⟩ + have d₂ : ¬ Disjoint L₂ F := fun d => + hex ⟨L₂, L₁, hL₂, hL₁, (union_comm _ _).trans hu₁₂, d⟩ + obtain ⟨p, hp, hpF⟩ := not_disjoint_iff.mp d₁ + obtain ⟨q, hq, hqF⟩ := not_disjoint_iff.mp d₂ + have hpΘ : p ∈ Θ := hu₁₂ ▸ .inl hp + have hqΘ : q ∈ Θ := hu₁₂ ▸ .inr hq + exact ⟨p, hFnode Θ p hpΘ hΘ hpF, q, hFnode Θ q hqΘ hΘ hqF, inOrder_of_lines hO hL₁ hL₂ hu₁₂ + hp hq⟩ + obtain ⟨L, L', hL, hL', hu, hd⟩ := hex + right + have hLΘ : L ⊆ Θ := fun z hz => hu ▸ .inl hz + obtain ⟨hLR, hLl, hLb⟩ := hlift hL (hLΘ.trans (hcuffb hΘ)) hd haR + have hsub : σ '' L ⊆ Φ := subset_cuff hΦ (isPreconnected_line hLl) hLb hx₁.2 hLl.left_mem + obtain ⟨Lc, hLc, huc, hic⟩ := oarc_split (hOY Φ hΦ) hLl hsub + have htail : ∀ y ∈ Γ'.N ∩ Φ, y ∈ Lc → ∃ b, b ∈ (F ∩ (Γ.N ∩ Θ)) ∪ {m ∈ A ∩ Θ | y = ι m} ∧ b ∈ L' + := by + intro y hy hyc + by_cases hd' : Disjoint L' F + · have hdΘ : Disjoint Θ F := by + rw [← hu] + exact disjoint_union_left.mpr ⟨hd, hd'⟩ + obtain ⟨m, hm, hm'⟩ := hfull Θ hΘ a haΘ haR hdΘ Φ hΦ hx₁.2 y hy.1 hy.2 + refine ⟨m, .inr ⟨hm, hm'⟩, ?_⟩ + rcases (hu ▸ hm.2 : m ∈ L ∪ L') with hmL | hmL + · have hym : y ∈ σ '' L := by + rw [hm', hιR m (hLR hmL)] + exact mem_image_of_mem _ hmL + have h1 : y ∈ σ '' L ∩ Lc := ⟨hym, hyc⟩ + rw [hic] at h1 + have h2 : m = a ∨ m = e := by + rw [hm', hιR m (hLR hmL)] at h1 + rcases h1 with h1 | h1 + · left + rw [← hσ₁ m (hLR hmL), h1, hσ₁ a haR] + · right + rw [← hσ₁ m (hLR hmL), h1, hσ₁ e heR] + rcases h2 with rfl | rfl + · exact hL'.left_mem + · exact hL'.right_mem + · exact hmL + · obtain ⟨p, hp, hpF⟩ := not_disjoint_iff.mp hd' + exact ⟨p, .inl (hFnode Θ p (hu ▸ .inr hp) hΘ hpF), hp⟩ + rcases mem_of_inOrder hord hLl hLc huc with ⟨h₂, h₄⟩ | ⟨h₂, h₄⟩ + · left + obtain ⟨n₂', hn₂', hx₂e, hn₂L⟩ := hon hL hLΘ hd haR x₂ hx₂.1 h₂ + obtain ⟨b, hb, hbL⟩ := htail x₄ hx₄ h₄ + exact ⟨n₂', hn₂', hx₂e, b, hb, inOrder_of_lines hO hL hL' hu hn₂L hbL⟩ + · right + obtain ⟨n₄', hn₄', hx₄e, hn₄L⟩ := hon hL hLΘ hd haR x₄ hx₄.1 h₄ + obtain ⟨b, hb, hbL⟩ := htail x₂ hx₂ h₂ + exact ⟨n₄', hn₄', hx₄e, b, hb, + inOrder_of_lines hO hL' hL ((union_comm _ _).trans hu) hbL hn₄L⟩ + +private theorem preconnected_set_respects_cut_range + {Y : Type} + {S : Type} + [TopologicalSpace Y] + [TopologicalSpace S] + {Γ : Painting S} + {ψ : Y → S} + {F : Set S} + {n₁ : S} + {n₂ : S} + {Ks : Set (Set Y)} + {e₁ : Set Y → Y} + {e₂ : Set Y → Y} + (h : CutSetup Γ ψ F n₁ n₂ Ks e₁ e₂) + (hrc : IsClosed (range ψ)) + {L : Set S} + (hL : IsPreconnected L) + (hd : Disjoint L F) + (hne : (L ∩ (range ψ \ F)).Nonempty) : + L ⊆ (range ψ \ F) := by + let R := range ψ \ F + have hsub : L ⊆ R ∪ (range ψ)ᶜ := fun x hx => by + by_cases hr : x ∈ range ψ + · exact .inl ⟨hr, disjoint_left.mp hd hx⟩ + · exact .inr hr + rcases hL.subset_or_subset h.map.isOpen hrc.isOpen_compl (disjoint_left.mpr fun x hx hx' + => hx' hx.1) hsub with h1 | h1 + · exact h1 + · obtain ⟨z, hz, hz'⟩ := hne + exact absurd hz'.1 (h1 hz) + +/-- One part of the cut surface carries a cut-side painting for the cells in it. -/ +theorem CutSetup.cutSide {Γ : Painting S} {ψ : Y → S} {F : Set S} {n₁ n₂ : S} {Ks : Set + (Set Y)} {e₁ e₂ : Set Y → Y} (h : CutSetup Γ ψ F n₁ n₂ Ks e₁ e₂) + [Nonempty Y] {K₀ : Set Y} (hK₀ : K₀ ∈ Ks) : ∃ (ι : S → Y) (Γ' : Painting Y), IsCutSidePainting + S Γ F (keepCells Γ ψ F) Y ι Γ' := by + classical + have ht2S := h.t2 + have ht2 := h.t2Y + have hcY := h.compY + obtain ⟨D, Γ', hD, hN, hC⟩ := h.exists_painting + obtain ⟨σ, hσc, hσ₁, hσ₂⟩ := h.map.exists_sec + obtain ⟨j, hj, hjm⟩ := exists_inj_line h.surfS (h.lift.line K₀ hK₀) + let R : Set S := range ψ \ F + let ι : S → Y := fun x => if x ∈ R then σ x else j x + have hιR : ∀ x ∈ R, ι x = σ x := fun x hx => ite_eq_left hx + have hιn : ∀ x, x ∉ R → ι x = j x := fun x hx => ite_eq_right hx + have hK₀F : ∀ y ∈ K₀, ψ y ∈ F := fun y hy => (show y ∈ ψ ⁻¹' F from h.lift.cover ▸ ⟨K₀, hK₀, hy⟩) + have hσF : ∀ x ∈ R, ψ (σ x) ∉ F := fun x hx => by + rw [hσ₁ x hx] + exact hx.2 + have hinj : Function.Injective ι := by + intro x x' he + by_cases hx : x ∈ R <;> by_cases hx' : x' ∈ R + · rw [hιR x hx, hιR x' hx'] at he + rw [← hσ₁ x hx, he, hσ₁ x' hx'] + · rw [hιR x hx, hιn x' hx'] at he + exact absurd (hK₀F _ (hjm x').1) (he ▸ hσF x hx) + · rw [hιn x hx, hιR x' hx'] at he + exact absurd (hK₀F _ (hjm x).1) (he ▸ hσF x' hx') + · rw [hιn x hx, hιn x' hx'] at he + exact hj he + have hrc : IsClosed (range ψ) := (isCompact_range h.map.cont).isClosed + have hclR : ∀ c ∈ keepCells Γ ψ F, closure c ⊆ range ψ := fun c hc => closure_minimal (fun x hx + => (hc.2 hx).1) hrc + have himg : ∀ c ∈ keepCells Γ ψ F, ι '' c = ψ ⁻¹' c := fun c hc => by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + rw [hιR x (hc.2 hx), mem_preimage, hσ₁ x (hc.2 hx)] + exact hx + · intro hy + have hyR : ψ y ∈ R := hc.2 hy + exact ⟨ψ y, hy, by rw [hιR _ hyR, hσ₂ y hyR.2]⟩ + let A : Set S := {n ∈ Γ.N \ F | ∃ c ∈ keepCells Γ ψ F, n ∈ tilde c} + have hAR : ∀ n ∈ A, n ∈ R := fun n hn => by + obtain ⟨c, hc, hnc⟩ := hn.2 + exact ⟨hclR c hc hnc.1, hn.1.2⟩ + have hOS := (cuff_statement.{0} S h.surfS).2.2 + have hOY := (cuff_statement.{0} Y h.surfY).2.2 + have hbdR : ∀ x ∈ R, σ x ∈ bd Y ↔ x ∈ bd S := fun x hx => by + rw [h.map.mem_bd_iff (hσF x hx), hσ₁ x hx] + have hactive : ∀ n ∈ Γ.N, n ∉ F → n ∈ R → n ∈ bd S → n ∈ A := fun n hn hnF hnR hnb => by + obtain ⟨c, hc, hnt⟩ := exists_cell_node h.surfS hn hnb + refine ⟨⟨hn, hnF⟩, c, ⟨hc, ?_⟩, hnt⟩ + refine (h.side hc).resolve_right fun hd => ?_ + obtain ⟨z, hz, hzc⟩ := mem_closure_iff.mp hnt.1 R h.map.isOpen hnR + exact disjoint_left.mp hd hzc hz.1 + have hconnR : ∀ {L : Set S}, IsPreconnected L → Disjoint L F → (L ∩ R).Nonempty → L ⊆ R + := fun {L} hL hd hne => by + exact preconnected_set_respects_cut_range (Y := Y) (S := S) (Γ := Γ) (ψ := ψ) (F := F) (n₁ := + n₁) (n₂ := n₂) (Ks := Ks) (e₁ := e₁) (e₂ := e₂) h hrc (L := L) hL hd hne + have hlift : ∀ {L : Set S} {u v : S}, IsLineWithEnds L u v → L ⊆ bd S → Disjoint L F → u ∈ R + → L ⊆ R ∧ IsLineWithEnds (σ '' L) (σ u) (σ v) ∧ σ '' L ⊆ bd Y := by + intro L u v hL hLb hd hu + have hLR := hconnR (isPreconnected_line hL) hd ⟨u, hL.left_mem, hu⟩ + refine ⟨hLR, ?_, ?_⟩ + · obtain ⟨a, ha, hr, rfl, rfl⟩ := hL.exists_arc + have hmem : ∀ t, a t ∈ R := fun t => hLR (hr ▸ mem_range_self t) + have harc : IsArcMap (σ ∘ a) := ⟨hσc.comp_continuous ha.1 hmem, fun s t he => ha.2 (by + have := congrArg ψ he + simpa only [Function.comp, hσ₁ _ (hmem _)] using this)⟩ + have hline := harc.isLineWithEnds + rwa [range_comp, hr] at hline + · rintro _ ⟨x, hx, rfl⟩ + exact (hbdR x (hLR hx)).mpr (hLb hx) + have hcuffb : ∀ {Θ : Set S}, Θ ∈ cuffs S → Θ ⊆ bd S := fun {Θ} hΘ => by + obtain ⟨x, -, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + have hcuffY : ∀ {Θ : Set Y}, Θ ∈ cuffs Y → Θ ⊆ bd Y := fun {Θ} hΘ => by + obtain ⟨x, -, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + have hfull : ∀ Θ ∈ cuffs S, ∀ a ∈ Θ, a ∈ R → Disjoint Θ F → ∀ Φ ∈ cuffs Y, σ a ∈ Φ + → ∀ y ∈ Γ'.N, y ∈ Φ → ∃ m ∈ A ∩ Θ, y = ι m := by + intro Θ hΘ a haΘ haR hd Φ hΦ hσa y hyN hyΦ + have hΘc : IsPreconnected Θ := by + obtain ⟨x, -, rfl⟩ := hΘ + exact isPreconnected_connectedComponentIn + have hΘR := hconnR hΘc hd ⟨a, haΘ, haR⟩ + have hX : IsOArc (σ '' Θ) := (hOS Θ hΘ).image (hσc.mono hΘR) h.map.cont.continuousOn fun x hx + => hσ₁ x (hΘR hx) + have hs : σ '' Θ ⊆ Φ := subset_cuff hΦ (hΘc.image _ (hσc.mono hΘR)) (by + rintro _ ⟨x, hx, rfl⟩ + exact (hbdR x (hΘR hx)).mpr (hcuffb hΘ hx)) hσa (mem_image_of_mem _ haΘ) + obtain ⟨φ⟩ := hOY Φ hΦ + have heq := oarc_eq φ hX hs + obtain ⟨m, hm, rfl⟩ := (heq ▸ hyΦ : y ∈ σ '' Θ) + have hmF : m ∉ F := disjoint_left.mp hd hm + have hmk : ψ (σ m) ∈ keepNodes Γ F n₁ n₂ := by + have h1 := hyN + rw [hN] at h1 + exact h1 + rw [hσ₁ m (hΘR hm)] at hmk + have hmN : m ∈ Γ.N := h.keepNodes_subset hmk + exact ⟨m, ⟨hactive m hmN hmF (hΘR hm) (hcuffb hΘ hm), hm⟩, (hιR m (hΘR hm)).symm⟩ + have hFnode : ∀ Θ, ∀ p ∈ Θ, Θ ∈ cuffs S → p ∈ F → p ∈ F ∩ (Γ.N ∩ Θ) := fun Θ p hp hΘ hF => by + have h1 : p ∈ ({n₁, n₂} : Set S) := h.bdF ▸ ⟨hF, hcuffb hΘ hp⟩ + refine ⟨hF, ?_, hp⟩ + rcases h1 with rfl | rfl + · exact h.n₁_N + · exact h.n₂_N + refine ⟨ι, Γ', ⟨hinj, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩⟩ + · rintro _ ⟨c, hc, rfl⟩ + change ι '' c ∈ Γ'.C + rw [himg c hc, hC] + exact .inl ⟨c, hc, rfl⟩ + · rw [hC] + exact ⟨_, .inr ⟨K₀, hK₀, rfl⟩⟩ + · rintro _ ⟨n, hn, rfl⟩ + rw [hιR n (hAR n hn), hN, mem_preimage, hσ₁ n (hAR n hn)] + exact .inl hn.1 + · intro c hc n hn + rw [himg c hc] + obtain ⟨τ, -, h2, h3, h4, h5, -, -⟩ := h.exists_lift hc + by_cases hnR : n ∈ R + · rw [hιR n hnR, h5] + constructor + · rintro ⟨x, hx, he⟩ + have h6 : x = n := by + have := congrArg ψ he + rwa [h3 x hx.1, hσ₁ n hnR] at this + exact h6 ▸ hx + · intro hx + refine ⟨n, hx, ?_⟩ + have h6 := hσ₂ (τ n) (by rw [h3 n hx.1]; exact hn) + rw [h3 n hx.1] at h6 + exact h6.symm + · have hnr : n ∉ range ψ := fun hr => hnR ⟨hr, hn⟩ + constructor + · intro hm + exfalso + rw [hιn n hnR] at hm + have h6 : j n ∈ h.Z ∩ K₀ := ⟨.inl (mem_iUnion₂.mpr ⟨c, hc, hm.1⟩), (hjm n).1⟩ + rcases h.Z_inter hK₀ h6 with h7 | h7 + · exact (hjm n).2.1 h7 + · exact (hjm n).2.2 h7 + · intro hm + exact absurd (hclR c hc hm.1) hnr + · intro c hc + rw [himg c hc] + constructor + · rintro ⟨y, hy, hyb⟩ + exact ⟨ψ y, hy, (h.map.mem_bd_iff (hc.2 hy).2).mp hyb⟩ + · rintro ⟨x, hx, hxb⟩ + obtain ⟨y, rfl⟩ := (hc.2 hx).1 + exact ⟨y, hx, (h.map.mem_bd_iff (hc.2 hx).2).mpr hxb⟩ + · intro n hn + rw [hιR n (hAR n hn)] + exact hbdR n (hAR n hn) + · intro d hd hni + rw [hC] at hd + rcases hd with ⟨c, hc, rfl⟩ | ⟨K, hK, rfl⟩ + · exact absurd ⟨c, hc, himg c hc⟩ hni + · have hb1 := (hD K hK).2.1 (h.lift.line K hK).left_mem + have hb2 := (hD K hK).2.1 (h.lift.line K hK).right_mem + simp only [(disc_diff_two (hD K hK).1 hb1 hb2).2.1] + rw [disjoint_left] + rintro y (rfl | rfl) ⟨n, hn, he⟩ + · have h1 := hσF n (hAR n hn) + rw [← hιR n (hAR n hn), he, h.lift.end₁ K hK] at h1 + exact h1 h.n₁_mem.1 + · have h1 := hσF n (hAR n hn) + rw [← hιR n (hAR n hn), he, h.lift.end₂ K hK] at h1 + exact h1 h.n₂_mem.1 + · intro Φ hΦ a ha hai b hb hbi + have haR := hAR a ha + have hbR := hAR b hb + rw [hιR a haR] at hai + rw [hιR b hbR] at hbi + have hab : a ≠ b := by + rintro rfl + exact hbi hai + have haB : a ∈ bd S := (hbdR a haR).mp (hcuffY hΦ hai) + have hΘ : connectedComponentIn (bd S) a ∈ cuffs S := ⟨a, haB, rfl⟩ + refine ⟨_, hΘ, mem_connectedComponentIn haB, ?_⟩ + by_cases hbΘ : b ∈ connectedComponentIn (bd S) a + swap + · exact .inl hbΘ + refine .inr ⟨hbΘ, ?_⟩ + have haΘ : a ∈ connectedComponentIn (bd S) a := mem_connectedComponentIn haB + set Θ := connectedComponentIn (bd S) a with hΘdef + obtain ⟨L₁, L₂, hL₁, hL₂, hu, -⟩ := (hOS Θ hΘ).lines haΘ hbΘ hab + have hfree : ∀ {L : Set S}, IsLineWithEnds L a b → L ⊆ Θ → ¬ Disjoint L F := fun {L} hL hs hd + => by + obtain ⟨-, h2, h3⟩ := hlift hL (hs.trans (hcuffb hΘ)) hd haR + exact hbi (subset_cuff hΦ (isPreconnected_line h2) h3 hai h2.left_mem h2.right_mem) + obtain ⟨p, hp, hpF⟩ := not_disjoint_iff.mp (hfree hL₁ fun z hz => hu ▸ .inl hz) + obtain ⟨q, hq, hqF⟩ := not_disjoint_iff.mp (hfree hL₂ fun z hz => hu ▸ .inr hz) + have hpΘ : p ∈ Θ := hu ▸ .inl hp + have hqΘ : q ∈ Θ := hu ▸ .inr hq + exact ⟨p, hFnode Θ p hpΘ hΘ hpF, q, hFnode Θ q hqΘ hΘ hqF, inOrder_of_lines + (hOS Θ hΘ) hL₁ hL₂ hu hp hq⟩ + · exact cut_cuff_node_order (Y := Y) (S := S) (Γ := Γ) (ψ := ψ) (F := F) (n₁ := n₁) (n₂ := n₂) + (Ks := Ks) (e₁ := e₁) (e₂ := e₂) h Γ' hN σ hσ₁ ι A rfl hιR hAR hOS hOY hactive hlift hcuffb + hfull hFnode +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/CycleOrder.lean b/LeanPool/GraphMinor/GM17/CycleOrder.lean new file mode 100644 index 0000000000..4698bce682 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/CycleOrder.lean @@ -0,0 +1,249 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CuffOrder +public import LeanPool.GraphMinor.GM12.Section2Corners + +/-! +# Order around a circle that is cut into lines + +An `O`-arc is cut into connected pieces `F i`, where `F i` joins the point `nd i` to the next point +and has no other point `nd j`. If a set `I` of +indices is an interval of `0, 1, ...` then, for four points in order around the arc, if the first +and third have index in `I`, so does the second or +the fourth (`mem_of_inOrderOn`). This gives (P7) in XVII (13.1). + +The proof uses any parametrization of the arc that shows the four points in order. The first and +third points cut it into two closed arcs. A piece +that avoids the two points lies in one of the two arcs. So all the points outside the interval +between the first and third are on the same arc. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface GM19 + +variable {T : Type*} [TopologicalSpace T] [T2Space T] {Θ : Set T} {k : ℕ} {nd : Fin k + → T} {F : Fin k → Set T} {nx : Fin k → Fin k} + {I : Set (Fin k)} + +private theorem mem_of_inOrderOn_aux (hinj : Function.Injective nd) (hnx : ∀ i, (nx i).1 = + (i.1 + 1) % k) + (hF : ∀ i, IsPreconnected (F i) ∧ F i ⊆ Θ ∧ nd i ∈ F i ∧ nd (nx i) ∈ F i ∧ ∀ j, nd j ∈ F i → j + = i ∨ j = nx i) + (hI : ∀ a b c, a < b → b < c → a ∈ I → c ∈ I → b ∈ I) {a b c d : Fin k} (hac : a < c) + (hba : b ≠ a) (hbc : b ≠ c) (hda : d ≠ a) (hdc : d ≠ c) + (h : InOrderOn Θ (nd a) (nd b) (nd c) (nd d)) (ha : a ∈ I) (hc : c ∈ I) : b ∈ I ∨ d ∈ I := by + obtain ⟨f, t₁, t₂, t₃, t₄, h12, h23, h34, h41, e1, e2, e3, e4⟩ := h + by_contra hn + push Not at hn + obtain ⟨hbI, hdI⟩ := hn + let Out : Fin k → Prop := fun j => j < a ∨ c < j + have hb : Out b := by + by_contra hb + simp only [Out, not_or, not_lt] at hb + exact hbI (hI a b c (lt_of_le_of_ne hb.1 hba.symm) (lt_of_le_of_ne hb.2 hbc) ha hc) + have hd : Out d := by + by_contra hb + simp only [Out, not_or, not_lt] at hb + exact hdI (hI a d c (lt_of_le_of_ne hb.1 hda.symm) (lt_of_le_of_ne hb.2 hdc) ha hc) + let A₁ : Set T := cuffPoint f '' Icc t₁ t₃ + let A₂ : Set T := cuffPoint f '' Icc t₃ (t₁ + 2 * Real.pi) + have hA₁ : IsClosed A₁ := (isCompact_Icc.image (cuffPoint_continuous f)).isClosed + have hA₂ : IsClosed A₂ := (isCompact_Icc.image (cuffPoint_continuous f)).isClosed + have hcov : Θ ⊆ A₁ ∪ A₂ := fun x hx => by + obtain ⟨t, ht, rfl⟩ := exists_cuffPoint_mem_Ico f t₁ hx + rcases le_total t t₃ with h | h + · exact Or.inl ⟨t, ⟨ht.1, h⟩, rfl⟩ + · exact Or.inr ⟨t, ⟨h, ht.2.le⟩, rfl⟩ + have hint : ∀ x, x ∈ A₁ → x ∈ A₂ → x = nd a ∨ x = nd c := by + rintro _ ⟨u, hu, rfl⟩ ⟨w, hw, he⟩ + obtain ⟨m, hm⟩ := (cuffPoint_eq_iff f).mp he + have hpi := Real.pi_pos + have h1 : (m : ℝ) * (2 * Real.pi) ≤ 2 * Real.pi := by linarith [hu.1, hw.2] + have h2 : -(2 * Real.pi) ≤ (m : ℝ) * (2 * Real.pi) := by linarith [hu.2, hw.1, hu.1, hw.2] + have h3 : (m : ℝ) ≤ 1 := by nlinarith + have h4 : (-1 : ℝ) ≤ m := by nlinarith + have h5 : m ≤ 1 := by exact_mod_cast h3 + have h6 : -1 ≤ m := by exact_mod_cast h4 + have hcases : m = -1 ∨ m = 0 ∨ m = 1 := by omega + rcases hcases with rfl | rfl | rfl + · exfalso + push_cast at hm + linarith [hu.2, hw.1] + · right + push_cast at hm + have : u = t₃ := by linarith [hu.2, hw.1] + rw [← e3, this] + · left + push_cast at hm + have : u = t₁ := by linarith [hu.1, hw.2] + rw [← e1, this] + have hb₁ : nd b ∈ A₁ := ⟨t₂, ⟨h12, h23⟩, e2⟩ + have hd₂ : nd d ∈ A₂ := ⟨t₄, ⟨h34, h41⟩, e4⟩ + have hin : ∀ j, Out j → nd j ∉ A₁ ∨ nd j ∉ A₂ := fun j hj => by + by_contra hn + push Not at hn + rcases hint _ hn.1 hn.2 with he | he + · have := hinj he + subst this + rcases hj with h | h + · exact lt_irrefl _ h + · exact lt_irrefl _ (hac.trans h) + · have := hinj he + subst this + rcases hj with h | h + · exact lt_irrefl _ (hac.trans h) + · exact lt_irrefl _ h + have hstep : ∀ j, Out j → Out (nx j) → (nd j ∈ A₁ ↔ nd (nx j) ∈ A₁) := fun j hj hj' => by + obtain ⟨h1, h2, h3, h4, h5⟩ := hF j + let Q : Bool → Set T := fun x => if x then A₁ else A₂ + have hQ : ∀ x, IsClosed (Q x) := fun x => by + cases x + · exact hA₂ + · exact hA₁ + have hcover : F j ⊆ ⋃ x, Q x := fun y hy => by + rcases hcov (h2 hy) with h | h + · exact mem_iUnion.2 ⟨true, h⟩ + · exact mem_iUnion.2 ⟨false, h⟩ + have hmiss : ∀ i : Fin k, Out j → Out (nx j) → (i = a ∨ i = c) → nd i ∉ F j := fun i _ _ hi hm + => by + rcases h5 i hm with rfl | rfl + · rcases hi with rfl | rfl + · rcases hj with h | h + · exact lt_irrefl _ h + · exact lt_irrefl _ (hac.trans h) + · rcases hj with h | h + · exact lt_irrefl _ (hac.trans h) + · exact lt_irrefl _ h + · rcases hi with rfl | rfl + · rcases hj' with h | h + · exact lt_irrefl _ h + · exact lt_irrefl _ (hac.trans h) + · rcases hj' with h | h + · exact lt_irrefl _ (hac.trans h) + · exact lt_irrefl _ h + have hdisj : ∀ x y : Bool, x ≠ y → Disjoint (F j) (Q x ∩ Q y) := fun x y hxy => by + refine Set.disjoint_left.mpr fun z hz hzz => ?_ + have hz' : z ∈ A₁ ∧ z ∈ A₂ := by + cases x <;> cases y + · exact absurd rfl hxy + · exact ⟨hzz.2, hzz.1⟩ + · exact hzz + · exact absurd rfl hxy + rcases hint z hz'.1 hz'.2 with rfl | rfl + · exact hmiss a hj hj' (Or.inl rfl) hz + · exact hmiss c hj hj' (Or.inr rfl) hz + constructor + · intro hm + exact GM12.preconnected_subset_closed_piece h1 Q hQ hcover hdisj (i := true) ⟨_, h3, hm⟩ h4 + · intro hm + exact GM12.preconnected_subset_closed_piece h1 Q hQ hcover hdisj (i := true) ⟨_, h4, hm⟩ h3 + have hk : 0 < k := Nat.zero_lt_of_lt a.2 + have hsucc : ∀ n (h : n + 1 < k), nx ⟨n, by omega⟩ = ⟨n + 1, h⟩ := fun n h => Fin.ext + (by rw [hnx]; exact Nat.mod_eq_of_lt h) + have hup : ∀ x y : ℕ, ∀ (hxy : x ≤ y) (hy : y < k), (c.1 < x ∨ y < a.1) → + (nd ⟨x, by omega⟩ ∈ A₁ ↔ nd ⟨y, hy⟩ ∈ A₁) := fun x y hxy => by + induction y, hxy using Nat.le_induction with + | base => exact fun _ _ => Iff.rfl + | succ y hxy ih => + intro hy hc' + refine (ih (by omega) (by omega)).trans ?_ + have := hstep ⟨y, by omega⟩ (by + rcases hc' with h | h + · exact Or.inr (Fin.lt_def.mpr (by simp only; omega)) + · exact Or.inl (Fin.lt_def.mpr (by simp only; omega))) (by + rw [hsucc y hy] + rcases hc' with h | h + · exact Or.inr (Fin.lt_def.mpr (by simp only; omega)) + · exact Or.inl (Fin.lt_def.mpr (by simp only; omega))) + rwa [hsucc y hy] at this + have hall : ∀ x y : Fin k, Out x → Out y → x ≤ y → (nd x ∈ A₁ ↔ nd y ∈ A₁) := fun x y hx hy hxy + => by + rcases hx with hx | hx + · rcases hy with hy | hy + · exact hup x.1 y.1 hxy y.2 (Or.inr hy) + · have hlast : k - 1 < k := by omega + have h0 := hup 0 x.1 (Nat.zero_le _) x.2 (Or.inr hx) + have h1 := hup y.1 (k - 1) (by omega) hlast (Or.inl hy) + have h3 : nx ⟨k - 1, hlast⟩ = ⟨0, hk⟩ := Fin.ext (by + rw [hnx] + simp only + rw [show k - 1 + 1 = k by omega, Nat.mod_self]) + have hlastOut : Out ⟨k - 1, hlast⟩ := by + right + change c.1 < k - 1 + have hyk := y.2 + have hcy : c.1 < y.1 := hy + omega + have hfirstOut : Out (nx ⟨k - 1, hlast⟩) := by + rw [h3] + left + change 0 < a.1 + have hxa : x.1 < a.1 := hx + omega + have h2 := hstep ⟨k - 1, hlast⟩ hlastOut hfirstOut + rw [h3] at h2 + exact h0.symm.trans (h2.symm.trans h1.symm) + · rcases hy with hy | hy + · exact absurd (lt_of_le_of_lt hxy (hy.trans (hac.trans hx))) (lt_irrefl _) + · exact hup x.1 y.1 hxy y.2 (Or.inl hx) + have hbd : nd b ∈ A₁ ↔ nd d ∈ A₁ := by + rcases le_total b d with h | h + · exact hall b d hb hd h + · exact (hall d b hd hb h).symm + rcases hin d hd with h | h + · exact h (hbd.mp hb₁) + · exact h hd₂ + +/-- **Order around a cut circle.** If the first and third of four points in order have index in the +interval `I`, then so does the second or the fourth. -/ +theorem mem_of_inOrderOn (hinj : Function.Injective nd) (hnx : ∀ i, (nx i).1 = (i.1 + 1) % k) + (hF : ∀ i, IsPreconnected (F i) ∧ F i ⊆ Θ ∧ nd i ∈ F i ∧ nd (nx i) ∈ F i ∧ ∀ j, nd j ∈ F i → j + = i ∨ j = nx i) + (hI : ∀ a b c, a < b → b < c → a ∈ I → c ∈ I → b ∈ I) {a b c d : Fin k} + (h : InOrderOn Θ (nd a) (nd b) (nd c) (nd d)) (ha : a ∈ I) (hc : c ∈ I) : b ∈ I ∨ d ∈ I := by + by_cases hba : b = a + · exact Or.inl (hba ▸ ha) + by_cases hbc : b = c + · exact Or.inl (hbc ▸ hc) + by_cases hda : d = a + · exact Or.inr (hda ▸ ha) + by_cases hdc : d = c + · exact Or.inr (hdc ▸ hc) + rcases lt_trichotomy a c with hac | rfl | hac + · exact mem_of_inOrderOn_aux hinj hnx hF hI hac hba hbc hda hdc h ha hc + · exfalso + obtain ⟨f, t₁, t₂, t₃, t₄, h12, h23, h34, h41, e1, e2, e3, e4⟩ := h + obtain ⟨m, hm⟩ := (cuffPoint_eq_iff f).mp (e1.trans e3.symm) + have hpi := Real.pi_pos + have h3 : (m : ℝ) ≤ 0 := by + by_contra hn + push Not at hn + nlinarith + have h4 : (-1 : ℝ) ≤ m := by + by_contra hn + push Not at hn + nlinarith + have h5 : m ≤ 0 := by exact_mod_cast h3 + have h6 : -1 ≤ m := by exact_mod_cast h4 + have hcases : m = -1 ∨ m = 0 := by omega + rcases hcases with rfl | rfl + · push_cast at hm + have : t₄ = t₃ := by linarith + exact hdc (hinj (by rw [← e4, ← e3, this])) + · push_cast at hm + have : t₂ = t₁ := by linarith + exact hba (hinj (by rw [← e2, ← e1, this])) + · exact (mem_of_inOrderOn_aux hinj hnx hF hI hac hdc hda hbc hba (inOrderOn_cyclic2 h) hc ha).symm + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Defs.lean b/LeanPool/GraphMinor/GM17/Defs.lean new file mode 100644 index 0000000000..614e547613 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Defs.lean @@ -0,0 +1,291 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Defs2 +public import LeanPool.GraphMinor.GM19.Defs +public import LeanPool.GraphMinor.Surface.TopologyStatements + +/-! +# Definitions for Graph Minors XVII: Taming a vortex + +This file formalizes the definitions behind the statements of N. Robertson and P. D. Seymour, +*Graph Minors. XVII. Taming a vortex*, J. Combin. Theory Ser. B 77 (1999) 162–210, that Graph +Minors XX cites: paintings without marches (`Painting`, Section 1), portrayals +(`Portrayal`, Section 2), warp (Section 3), central portrayals and small subhypergraphs (Section 4), +simpler and resembling portrayals (Section 5), `z`-redundancy (Section 6), truth and true portrayals +(Section 8), and tangles controlling a minor (Section 13). The surfaces `Σ(a, b, c)` and the +relation +"simpler" of Section 1 are `Surface.SurfaceModel` and `Surface.IsSimplerThan`. + +The surfaces of a portrayal live in `Type`. This loses nothing, since every compact surface is +homeomorphic to a space in `Type`. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 + +universe u v + +/-! ### Paintings (Section 1, pages 164–165) -/ + +/-- A painting (Graph Minors XVII, Section 1, page 164): "A *painting* $\Gamma$ in a surface +$\Sigma$ is a pair $(U, N)$, where $U \subseteq \Sigma$ is closed and $N \subseteq U$ is finite, +such that +(i) $U - N$ has only finitely many arc-wise connected components (which we call *cells* of +$\Gamma$); +(ii) for each cell $c$, its closure $\bar{c}$ is a disc and $\tilde{c}$ is a subset of the boundary +of this disc, and $|\tilde{c}| \le 3$; +(iii) $bd(\Sigma) \subseteq U$; +(iv) for each cell $c$, if $c \cap bd(\Sigma) \ne \emptyset$ then $|\tilde{c}| = 2$ and $\bar{c} +\cap bd(\Sigma)$ is a $[0, 1]$-arc with ends the two members of $\tilde{c}$." -/ +structure Painting (S : Type) [TopologicalSpace S] where + /-- The set `U(Γ)`. -/ + U : Set S + /-- The set `N(Γ)` of nodes. -/ + N : Set S + isClosed_U : IsClosed U + N_subset : N ⊆ U + finite_N : N.Finite + finite_cells : (arcComponentsIn (U \ N)).Finite + cell_disc : ∀ c ∈ arcComponentsIn (U \ N), + IsClosedDisc (closure c) ∧ tilde c ⊆ discBd (closure c) ∧ (tilde c).Finite ∧ + (tilde c).ncard ≤ 3 + bd_subset : bd S ⊆ U + border_cell : ∀ c ∈ arcComponentsIn (U \ N), (c ∩ bd S).Nonempty → + (tilde c).ncard = 2 ∧ (tilde c).Finite ∧ IsLine (closure c ∩ bd S) ∧ + lineEnds (closure c ∩ bd S) = tilde c + +namespace Painting + +variable {S : Type} [TopologicalSpace S] + +/-- The set `C(Γ)` of cells. -/ +def C (Γ : Painting S) : Set (Set S) := arcComponentsIn (Γ.U \ Γ.N) + +end Painting + +/-! ### Portrayals (Section 2, pages 165–166) -/ + +/-- A portrayal `π = (Σ, Γ, α, β, γ)` of a hypergraph `G` (Graph Minors XVII, Section 2, pages +165–166), with its axioms (P1)–(P7). Here `dom(γ)` is `domγ`, and `α`, `β`, `γ` are written +`cellGraph`, +`borderSet`, `nodeVertex`. -/ +structure Portrayal {α : Type u} {β : Type v} (G : Hypergraph α β) where + /-- The surface `Σ`. -/ + S : Type + /-- The topology of `Σ`. -/ + [top : TopologicalSpace S] + /-- (i) `Σ` is a surface. -/ + isSurface : IsSurface S + /-- (i) `Σ` is connected. -/ + connected : ConnectedSpace S + /-- (ii) The painting `Γ`. -/ + Γ : Painting S + /-- (iii) The subhypergraph `α(c)` of a cell `c`. -/ + cellGraph : Set S → Hypergraph α β + /-- (iv) The set `β(n)` of a border node `n`. -/ + borderSet : S → Set α + /-- (v) The domain of `γ`. -/ + domγ : Set S + /-- (v) The function `γ`. -/ + nodeVertex : S → α + cellGraph_le : ∀ c ∈ Γ.C, cellGraph c ≤ G + borderSet_subset : ∀ n ∈ Γ.N ∩ bd S, borderSet n ⊆ G.vertexSet + domγ_subset : domγ ⊆ Γ.N + nodeVertex_mem : ∀ n ∈ domγ, nodeVertex n ∈ G.vertexSet + nodeVertex_injOn : InjOn nodeVertex domγ + /-- (P1) `G = ∪ (α(c) : c ∈ C(Γ))`: every vertex of `G` lies in some `α(c)`. -/ + p1_vertex : ∀ v ∈ G.vertexSet, ∃ c ∈ Γ.C, v ∈ (cellGraph c).vertexSet + /-- (P1) `G = ∪ (α(c) : c ∈ C(Γ))`: every edge of `G` lies in some `α(c)`. -/ + p1_edge : ∀ e ∈ G.edgeSet, ∃ c ∈ Γ.C, e ∈ (cellGraph c).edgeSet + /-- (P1) `E(α(c) ∩ α(c')) = ∅` for distinct cells `c, c'`. -/ + p1_disjoint : ∀ c ∈ Γ.C, ∀ c' ∈ Γ.C, c ≠ c' → + Disjoint (cellGraph c).edgeSet (cellGraph c').edgeSet + /-- (P2) `γ(cTilde) ⊆ V(α(c))` for each cell `c`. -/ + p2 : ∀ c ∈ Γ.C, ∀ n ∈ tilde c ∩ domγ, nodeVertex n ∈ (cellGraph c).vertexSet + /-- (P3) `γ(n) ∉ β(n)` for each `n ∈ dom(γ) ∩ bd(Σ)`. -/ + p3_notMem : ∀ n ∈ domγ ∩ bd S, nodeVertex n ∉ borderSet n + /-- (P3) `β(n) ⊆ V(α(c))` for each border cell `c` and each `n ∈ cTilde`. -/ + p3_subset : ∀ c ∈ Γ.C, (c ∩ bd S).Nonempty → ∀ n ∈ tilde c, + borderSet n ⊆ (cellGraph c).vertexSet + /-- (P4) If `n₁, n₂` are nodes bordering different cuffs, then `β(n₁) ∩ β(n₂) = ∅`. -/ + p4_disjoint : ∀ Θ₁ ∈ cuffs S, ∀ Θ₂ ∈ cuffs S, Θ₁ ≠ Θ₂ → ∀ n₁ ∈ Γ.N ∩ Θ₁, ∀ n₂ ∈ Γ.N ∩ Θ₂, + Disjoint (borderSet n₁) (borderSet n₂) + /-- (P4) If `n₁` borders a cuff `Θ` and `n₂ ∈ dom(γ)` does not border `Θ`, then + `γ(n₂) ∉ β(n₁)`. -/ + p4_notMem : ∀ Θ ∈ cuffs S, ∀ n₁ ∈ Γ.N ∩ Θ, ∀ n₂ ∈ domγ, n₂ ∉ Θ → nodeVertex n₂ ∉ borderSet n₁ + /-- (P5) If `c` is an internal cell then `V(α(c) ∩ α(-c)) ⊆ γ(cTilde)`. -/ + p5 : ∀ c ∈ Γ.C, ¬ (c ∩ bd S).Nonempty → ∀ v ∈ (cellGraph c).vertexSet, + (∃ c' ∈ Γ.C, c' ≠ c ∧ v ∈ (cellGraph c').vertexSet) → v ∈ nodeVertex '' (tilde c ∩ domγ) + /-- (P6) If `c` is a border cell with ends `n₁, n₂`, then + `V(α(c) ∩ α(-c)) ⊆ β(n₁+) ∪ β(n₂+)`. -/ + p6 : ∀ c ∈ Γ.C, (c ∩ bd S).Nonempty → ∀ v ∈ (cellGraph c).vertexSet, + (∃ c' ∈ Γ.C, c' ≠ c ∧ v ∈ (cellGraph c').vertexSet) → + ∃ n ∈ tilde c, v ∈ borderSet n ∨ (n ∈ domγ ∧ v = nodeVertex n) + /-- (P7) If `n₁, n₂, n₃, n₄` are nodes bordering the same cuff of `Σ` and in order, then + `β(n₁+) ∩ β(n₃+) ⊆ β(n₂+) ∪ β(n₄+)`. -/ + p7 : ∀ Θ ∈ cuffs S, ∀ n₁ ∈ Γ.N ∩ Θ, ∀ n₂ ∈ Γ.N ∩ Θ, ∀ n₃ ∈ Γ.N ∩ Θ, ∀ n₄ ∈ Γ.N ∩ Θ, + GM19.InOrderOn Θ n₁ n₂ n₃ n₄ → ∀ v : α, + (v ∈ borderSet n₁ ∨ (n₁ ∈ domγ ∧ v = nodeVertex n₁)) → + (v ∈ borderSet n₃ ∨ (n₃ ∈ domγ ∧ v = nodeVertex n₃)) → + (v ∈ borderSet n₂ ∨ (n₂ ∈ domγ ∧ v = nodeVertex n₂)) ∨ + (v ∈ borderSet n₄ ∨ (n₄ ∈ domγ ∧ v = nodeVertex n₄)) + +attribute [instance] Portrayal.top + +namespace Portrayal + +variable {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) + +/-- `α(-c₀) = ∪ (α(c) : c ∈ C(Γ) - {c₀})` (Graph Minors XVII, Section 2, page 165): its vertices. -/ +def otherVertices (c₀ : Set π.S) : Set α := + {v | ∃ c ∈ π.Γ.C, c ≠ c₀ ∧ v ∈ (π.cellGraph c).vertexSet} + +/-- `β(n+)` (Graph Minors XVII, Section 2, page 165). -/ +def borderPlus (n : π.S) : Set α := + {v | v ∈ π.borderSet n ∨ (n ∈ π.domγ ∧ v = π.nodeVertex n)} + +/-- A linkage in `A⋆` from `X` to `Y` of `k` paths that pairs `x` with `y`: the path from `x` ends +at +`y` (Graph Minors XVII, Section 3, page 168). -/ +def LinkagePairs {α : Type u} (K : SimpleGraph α) (X Y : Set α) (k : ℕ) (x y : α) : Prop := + ∀ P : Fin k → PathFromTo K X Y, + (Pairwise fun i j ↦ Disjoint {z | z ∈ (P i).walk.support} {z | z ∈ (P j).walk.support}) → + ∃ i, (P i).first = x ∧ (P i).last = y + +/-- A cell `c` with ends `n₁, n₂` has warp `≤ p` (Graph Minors XVII, Section 3, page 168): "(i) +$|\beta(n_1)|, |\beta(n_2)| \le p$, and (ii) if $|\beta(n_1 +)| = |\beta(n_2 +)| = p + 1$, then +every linkage in $\alpha(c)^*$ from $\beta(n_1 +)$ to $\beta(n_2 +)$ pairs $\gamma(n_1)$ with +$\gamma(n_2)$." A linkage from `β(n₁+)` to `β(n₂+)` here has `p + 1` paths, one from each member. -/ +def CellWarpLE (c : Set π.S) (p : ℕ) : Prop := + ∀ n₁ ∈ tilde c, ∀ n₂ ∈ tilde c, n₁ ≠ n₂ → + (π.borderSet n₁).ncard ≤ p ∧ (π.borderSet n₂).ncard ≤ p ∧ + ((π.borderPlus n₁).ncard = p + 1 → (π.borderPlus n₂).ncard = p + 1 → + LinkagePairs (π.cellGraph c).skeleton (π.borderPlus n₁) (π.borderPlus n₂) (p + 1) + (π.nodeVertex n₁) (π.nodeVertex n₂)) + +/-- The warp of a cell: "the minimum $p \ge 0$ such that $c$ has warp $\le p$". -/ +noncomputable def cellWarp (c : Set π.S) : ℕ := sInf {p | π.CellWarpLE c p} + +/-- `π` has warp at `Θ` the maximum warp of the cells bordering `Θ` (Graph Minors XVII, Section 3, +page 168). -/ +noncomputable def warpAt (Θ : Set π.S) : ℕ := + sSup {p | ∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ p = π.cellWarp c} + +/-- The warp of `π`: "the maximum of the warp of $\pi$ at $\Theta$, over all cuffs $\Theta$ (or 1 if +$bd(\Sigma) = +\emptyset$)" (Graph Minors XVII, Section 3, page 168). We take `max 1` even when `bd(Σ) ≠ ∅` +so that "every 0-redundant $\mathscr{T}$-central portrayal has warp $\ge 1$" (Section 5, page 171) +and capping +the last cuff of warp 0 in (5.1) does not raise the warp from `0` to `1`. -/ +noncomputable def warp : ℕ := + open Classical in if (cuffs π.S).Nonempty then max 1 (sSup {p | ∃ Θ ∈ cuffs π.S, p + = π.warpAt Θ}) else 1 + +/-- `π` is `𝒯`-central: "$\alpha(c)$ is small relative to $\mathscr{T}$ for every $c \in +C(\Gamma)$", where `A ⊆ G` is +*small* if `(A, B) ∈ 𝒯` for some `B ⊆ G` (Graph Minors XVII, Section 4, page 169). -/ +def IsCentral (𝒯 : Set (Hypergraph α β × Hypergraph α β)) : Prop := + ∀ c ∈ π.Γ.C, ∃ B, (π.cellGraph c, B) ∈ 𝒯 + +/-- `π` is simpler than `π'` (Graph Minors XVII, Section 5, page 171): "(i) $\Sigma$ is simpler than +$\Sigma'$ and the warp of $\pi$ is at most that of $\pi'$, or (ii) there is a homeomorphism +$\psi \colon \Sigma \to \Sigma'$ such that for every cuff $\Theta$ of $\Sigma$, the warp of $\pi$ at +$\Theta$ is at most the warp of $\pi'$ at $\psi(\Theta)$, with strict inequality for some cuff +$\Theta$." -/ +def IsSimpler {α' : Type*} {β' : Type*} {G' : Hypergraph α' β'} (π' : Portrayal G') : Prop := + (IsSimplerThan π.S π'.S ∧ π.warp ≤ π'.warp) ∨ + ∃ ψ : π.S ≃ₜ π'.S, (∀ Θ ∈ cuffs π.S, π.warpAt Θ ≤ π'.warpAt (ψ '' Θ)) ∧ + ∃ Θ ∈ cuffs π.S, π.warpAt Θ < π'.warpAt (ψ '' Θ) + +/-- `π` resembles `π'` (Graph Minors XVII, Section 5, page 171). -/ +def Resembles {α' : Type*} {β' : Type*} {G' : Hypergraph α' β'} (π' : Portrayal G') : Prop := + ∃ ψ : π.S ≃ₜ π'.S, ∀ Θ ∈ cuffs π.S, π.warpAt Θ = π'.warpAt (ψ '' Θ) + +/-- `π` is 0-redundant relative to `𝒯` (Graph Minors XVII, Section 5, page 171): "there is no +$\mathscr{T}$-central portrayal of $G$ simpler than $\pi$." -/ +def IsZeroRedundant (𝒯 : Set (Hypergraph α β × Hypergraph α β)) : Prop := + ∀ π' : Portrayal G, π'.IsCentral 𝒯 → ¬ π'.IsSimpler π + +/-- `π` is `z`-redundant (Graph Minors XVII, Section 6, page 174): "$z < ord(\mathscr{T})$, and for +every $Z \subseteq V(G)$ with $|Z| \le z$ there is no $\mathscr{T}/Z$-central portrayal of $G/Z$ +simpler than $\pi$." -/ +def IsRedundant (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (θ z : ℕ) : Prop := + z < θ ∧ ∀ Z ⊆ G.vertexSet, Z.ncard ≤ z → ∀ π' : Portrayal (quotientVertices G Z), + π'.IsCentral (quotientTangle G 𝒯 Z) → ¬ π'.IsSimpler π + +/-- The truth `(τ₁, …, τ₆)` of a portrayal (Graph Minors XVII, Section 8, page 181): `τᵢ` is the +number of internal cells `c` with `|cTilde| = 4 - i` for `i ≤ 4`, `τ₅ = |N(Γ) - bd(Σ)|` and +`τ₆ = |N(Γ) ∩ bd(Σ)|`. -/ +noncomputable def truth : Fin 6 → ℕ := fun i ↦ + if i.1 < 4 then {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - i.1}.ncard + else if i.1 = 4 then (π.Γ.N \ bd π.S).ncard else (π.Γ.N ∩ bd π.S).ncard + +/-- `π` is truer than `π'`: its truth is lexicographically smaller (Graph Minors XVII, Section 8, +page 181). -/ +def IsTruer {G' : Hypergraph α β} (π' : Portrayal G') : Prop := + ∃ k : Fin 6, (∀ i < k, π.truth i = π'.truth i) ∧ π.truth k < π'.truth k + +/-- `π` is true relative to `𝒯` (Graph Minors XVII, Section 8, page 181): "A $0$-redundant +$\mathcal{T}$-central portrayal $\pi$ is *true* (relative to $\mathcal{T}$) if there is no truer +$\mathcal{T}$-central portrayal resembling $\pi$." -/ +def IsTrue (𝒯 : Set (Hypergraph α β × Hypergraph α β)) : Prop := + π.IsCentral 𝒯 ∧ π.IsZeroRedundant 𝒯 ∧ + ∀ π' : Portrayal G, π'.IsCentral 𝒯 → π'.IsTruer π → ¬ π'.Resembles π + +end Portrayal + +/-! ### Controlling a minor (Sections 13 and 14) -/ + +/-- `𝒯` controls an `H`-minor of `G*` (Graph Minors XVII, Section 14, page 207; Graph Minors XX, +Section 10, page 354), where `G*` is the 1-skeleton `G.skeleton`. Here `H` is a graph given by its +vertex set `V(H)`, edge set and ends, as in Graph Minors XX: an `H`-minor is a function `α` with +- for each `v ∈ V(H)`, `α(v)` is a non-null connected subgraph of `sk(G)`, and `α(u)` and `α(v)` are + disjoint for distinct `u, v`, +- `α(e) ∈ E(sk(G))` for each `e ∈ E(H)`, and `α(e) ≠ α(f)` for distinct `e, f`, +- for each `e ∈ E(H)` with distinct ends `u, v`, `α(e)` has one end in `V(α(u))` and the other in + `V(α(v))`, +- for each loop `e ∈ E(H)` with end `v`, `V(α(v))` contains both ends of `α(e)` and + `α(e) ∉ E(α(v))`, +- there do not exist `(A, B) ∈ 𝒯` of order `< |V(H)|` and `v ∈ V(H)` such that `V(α(v)) ⊆ V(A)`. +A connected subgraph `α(v)` is given by its vertex set `av v` and edge set `ae' v`. -/ +def ControlsMinor {α : Type u} {β : Type v} {α' : Type*} {β' : Type*} (G : Hypergraph α β) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (H : Hypergraph α' β') : Prop := + H.IsGraph ∧ ∃ (av : α' → Set α) (ae' : α' → Set (Sym2 α)) (ae : β' → Sym2 α), + (∀ v ∈ H.vertexSet, (av v).Nonempty ∧ av v ⊆ G.vertexSet ∧ ae' v ⊆ G.skeleton.edgeSet ∧ + (∀ x y, s(x, y) ∈ ae' v → x ∈ av v ∧ y ∈ av v) ∧ + ∀ x ∈ av v, ∀ y ∈ av v, Relation.ReflTransGen (fun a b ↦ s(a, b) ∈ ae' v) x y) ∧ + (∀ u ∈ H.vertexSet, ∀ v ∈ H.vertexSet, u ≠ v → Disjoint (av u) (av v)) ∧ + (∀ e ∈ H.edgeSet, ae e ∈ G.skeleton.edgeSet) ∧ InjOn ae H.edgeSet ∧ + (∀ e ∈ H.edgeSet, ∀ u v, u ≠ v → H.Inc e u → H.Inc e v → + ∃ x ∈ av u, ∃ y ∈ av v, ae e = s(x, y)) ∧ + (∀ e ∈ H.edgeSet, ∀ v, H.ends e = {v} → + ∃ x ∈ av v, ∃ y ∈ av v, ae e = s(x, y) ∧ ae e ∉ ae' v) ∧ + ∀ ⦃A B⦄, (A, B) ∈ 𝒯 → Hypergraph.separationOrder A B < H.vertexSet.ncard → + ∀ v ∈ H.vertexSet, ¬ av v ⊆ A.vertexSet + +/-- The surface `S` has a drawing of the hypergraph `H`, which is a graph: `H` can be drawn in `S` +(Graph Minors XVII, (14.2)). A drawing is a `Surface.Drawing` of a graph on `S` with vertices the +vertices of `H`, in which every edge of `H` is a line or loop. The drawing is given by an injective +map of `V(H)` into `S`, and for each edge `e` a set `edgeOf e`, with these pairwise disjoint and +meeting the vertices only at their ends. -/ +def CanBeDrawn {α' : Type*} {β' : Type*} (S : Type) [TopologicalSpace S] + (H : Hypergraph α' β') : Prop := + ∃ (ν : α' → S) (edgeOf : β' → Set S), InjOn ν H.vertexSet ∧ + (∀ e ∈ H.edgeSet, ∀ u v, H.Inc e u → H.Inc e v → u ≠ v → + IsLineWithEnds (edgeOf e) (ν u) (ν v)) ∧ + (∀ e ∈ H.edgeSet, ∀ v, H.ends e = {v} → IsOArc (edgeOf e) ∧ ν v ∈ edgeOf e) ∧ + (∀ e ∈ H.edgeSet, ∀ f ∈ H.edgeSet, e ≠ f → edgeOf e ∩ edgeOf f ⊆ ν '' H.vertexSet) ∧ + (∀ e ∈ H.edgeSet, ∀ v ∈ H.vertexSet, ν v ∈ edgeOf e → H.Inc e v) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Defs2.lean b/LeanPool/GraphMinor/GM17/Defs2.lean new file mode 100644 index 0000000000..955b6166bb --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Defs2.lean @@ -0,0 +1,602 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Defs +public import LeanPool.GraphMinor.GM10.Defs2 + +/-! +# Remaining Definitions of Graph Minors XVII (*Taming a Vortex*) + +This file extends `GraphMinor/GM17/Defs.lean` with the remaining definitions of +N. Robertson and P. D. Seymour, *Graph Minors. XVII. Taming a vortex*, J. Combin. Theory +Ser. B 77 (1999) 162–210: + +- **Sections 1–2 (Pages 164–166):** Internal and border cells, cells and nodes bordering a cuff, + cyclic enumerations of nodes and cells around a cuff, $\gamma(X)$ for $X \subseteq N(\Gamma)$, + unions of cell hypergraphs $\bigcup_{c \in I} \alpha(c)$, and area subhypergraphs + $\alpha(\Delta)$. +- **Section 4 (Pages 169–170):** Small subhypergraphs and attachments of a subhypergraph $A$ in $G$. +- **Section 5 (Page 171):** Shrinking an internal cell $c$ from a node $n \in \tilde{c}$, and the + resulting shrunken portrayal. +- **Section 6 (Pages 174–176):** Quotient portrayals on $G / Z$ and terminals of vertices on a cuff. +- **Section 8 (Pages 181–183):** Regions of a painting $\Gamma$ and the non-dominated cell set + $C^*(\Gamma)$. +- **Section 10 (Page 188):** Cuff orientations (tail and head of a border cell), standard linkages + in border cells, and the circumnavigation subgraphs $L(v, n_0)$. +- **Section 11 (Pages 189–196):** $\gamma(I)$ for $I \subseteq C(\Gamma)$, the standard linkage + vertex set $S$, and the crossing cell set $D(A, B)$. +- **Section 12 (Pages 196–200):** Cliques in $G$, tangles induced from a subhypergraph, the + 1-skeleton subhypergraph $A^*$, and the embodiment of a tangle in $G^*$ into $G$. +- **Section 13 (Pages 201–206):** Adding an isolated vertex $H + v$, the complexity invariant + $h_p(\pi)$, and standards $\sigma(\Sigma, p, z)$. +- **Section 14 (Pages 207–209):** The induced tangle $\mathcal{T}^*$ in the 1-skeleton $G^*$. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v w + +/-! ## 1. Paintings, Cells, Cuffs, and Areas (Sections 1–2, Pages 164–166) -/ + +open Classical in +/-- A subset $F \subseteq \Sigma$ is *$\Gamma$-normal* if $F \cap U(\Gamma) \subseteq N(\Gamma)$. +Graph Minors XVII, Section 1 (page 165). -/ +def Painting.IsNormal {S : Type} [TopologicalSpace S] (Γ : Painting S) (F : Set S) : Prop := + F ∩ Γ.U ⊆ Γ.N + +open Classical in +/-- A cell $c \in C(\Gamma)$ is *internal* if $c \cap \operatorname{bd}(\Sigma) = \emptyset$. +Graph Minors XVII, Section 1 (page 165). -/ +def Painting.IsInternalCell {S : Type} [TopologicalSpace S] (Γ : Painting S) (c : Set S) : Prop := + c ∈ Γ.C ∧ ¬ (c ∩ bd S).Nonempty + +open Classical in +/-- A cell $c \in C(\Gamma)$ is a *border cell* if $c \cap \operatorname{bd}(\Sigma) \ne \emptyset$. +Graph Minors XVII, Section 1 (page 165). -/ +def Painting.IsBorderCell {S : Type} [TopologicalSpace S] (Γ : Painting S) (c : Set S) : Prop := + c ∈ Γ.C ∧ (c ∩ bd S).Nonempty + +open Classical in +/-- A cell $c \in C(\Gamma)$ *borders* a cuff $\Theta$ of $\Sigma$ if $\Theta$ is a cuff and +$c \cap \Theta \ne \emptyset$. +Graph Minors XVII, Section 1 (page 165). -/ +def Painting.CellBordersCuff {S : Type} [TopologicalSpace S] + (Γ : Painting S) (c Θ : Set S) : Prop := + c ∈ Γ.C ∧ Θ ∈ cuffs S ∧ (c ∩ Θ).Nonempty + +open Classical in +/-- A node $n \in N(\Gamma)$ *borders* a cuff $\Theta$ of $\Sigma$ if $\Theta$ is a cuff and +$n \in \Theta$. +Graph Minors XVII, Section 1 (page 165). -/ +def Painting.NodeBordersCuff {S : Type} [TopologicalSpace S] + (Γ : Painting S) (n : S) (Θ : Set S) : Prop := + n ∈ Γ.N ∧ Θ ∈ cuffs S ∧ n ∈ Θ + +open Classical in +/-- A node $n \in N(\Gamma)$ is a *border node* if $n \in \operatorname{bd}(\Sigma)$. +Graph Minors XVII, Section 1 (page 165). -/ +def Painting.IsBorderNode {S : Type} [TopologicalSpace S] (Γ : Painting S) (n : S) : Prop := + n ∈ Γ.N ∧ n ∈ bd S + +open Classical in +/-- A node $n \in N(\Gamma)$ is an *internal node* if $n \notin \operatorname{bd}(\Sigma)$. +Graph Minors XVII, Section 1 (page 165). -/ +def Painting.IsInternalNode {S : Type} [TopologicalSpace S] (Γ : Painting S) (n : S) : Prop := + n ∈ Γ.N ∧ n ∉ bd S + +open Classical in +/-- An enumeration $n_1, c_1, n_2, c_2, \dots, n_k, c_k, (n_1)$ of the nodes and cells of $\Gamma$ +bordering a cuff $\Theta$ of $\Sigma$ in cyclic order around $\Theta$. +Graph Minors XVII, Section 2 (pages 165–166), Section 4 (page 170), and Section 10 (page 188). -/ +structure Painting.CuffEnumeration {S : Type} [TopologicalSpace S] + (Γ : Painting S) (Θ : Set S) (k : ℕ) where + /-- $\Theta$ is a cuff of $\Sigma$. -/ + cuff_mem : Θ ∈ cuffs S + /-- A cuff with border cells has at least two nodes on it. -/ + two_le : 2 ≤ k + /-- The $k$ nodes bordering $\Theta$ in cyclic order. -/ + node : Fin k → S + /-- The $k$ cells bordering $\Theta$ in cyclic order. -/ + cell : Fin k → Set S + /-- The nodes are pairwise distinct. -/ + injective_node : Function.Injective node + /-- The cells are pairwise distinct. -/ + injective_cell : Function.Injective cell + /-- `node` enumerates all of $N(\Gamma) \cap \Theta$. -/ + range_node : Set.range node = Γ.N ∩ Θ + /-- `cell` enumerates all cells of $\Gamma$ bordering $\Theta$. -/ + range_cell : Set.range cell = {c ∈ Γ.C | (c ∩ Θ).Nonempty} + /-- For each $i$, the ends of `cell i` are `node i` and `node ((i + 1) mod k)`. -/ + cell_tilde : ∀ i : Fin k, + tilde (cell i) = {node i, node ⟨(i.1 + 1) % k, Nat.mod_lt _ (by omega)⟩} + /-- Any four indices $i_1 < i_2 < i_3 < i_4$ have their nodes in circular order on $\Theta$. -/ + nodes_in_order : ∀ i₁ i₂ i₃ i₄ : Fin k, i₁ < i₂ → i₂ < i₃ → i₃ < i₄ → + GM19.InOrderOn Θ (node i₁) (node i₂) (node i₃) (node i₄) + +open Classical in +/-- The next index in `Fin k` in cyclic order: $(i + 1) \bmod k$. -/ +def cyclicSucc {k : ℕ} (hk : 0 < k) (i : Fin k) : Fin k := + ⟨(i.1 + 1) % k, Nat.mod_lt _ hk⟩ + +/-- The cyclic successor moves every index when there are at least two indices. -/ +theorem cyclicSucc_ne_self {k : ℕ} (hk : 2 ≤ k) (i : Fin k) : + cyclicSucc (by omega) i ≠ i := by + intro h + have hval : (i.1 + 1) % k = i.1 := congrArg Fin.val h + have hi := i.2 + by_cases hlt : i.1 + 1 < k + · rw [Nat.mod_eq_of_lt hlt] at hval + omega + · have hEq : i.1 + 1 = k := by omega + rw [hEq, Nat.mod_self] at hval + omega + +open Classical in +/-- The previous index in `Fin k` in cyclic order: $(i + k - 1) \bmod k$. -/ +def cyclicPred {k : ℕ} (hk : 0 < k) (i : Fin k) : Fin k := + ⟨(i.1 + k - 1) % k, Nat.mod_lt _ hk⟩ + +open Classical in +/-- For any $X \subseteq N(\Gamma)$ (or $X \subseteq \Sigma$), $\gamma(X)$ denotes +$\{\gamma(n) : n \in X \cap \operatorname{dom}(\gamma)\}$. +Graph Minors XVII, Section 2 (page 165). -/ +def Portrayal.gammaImage {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (X : Set π.S) : Set α := + π.nodeVertex '' (X ∩ π.domγ) + +open Classical in +/-- The union $\bigcup (\alpha(c) : c \in I)$ of the cell subhypergraphs over a subset +$I \subseteq C(\Gamma)$. +Graph Minors XVII, Section 2, (2.1) (page 166). -/ +def Portrayal.cellsUnion {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (I : Set (Set π.S)) : Hypergraph α β where + vertexSet := ⋃ c ∈ I ∩ π.Γ.C, (π.cellGraph c).vertexSet + edgeSet := ⋃ c ∈ I ∩ π.Γ.C, (π.cellGraph c).edgeSet + Inc e v := (∃ c ∈ I ∩ π.Γ.C, e ∈ (π.cellGraph c).edgeSet) ∧ G.Inc e v + vertex_mem_of_inc := by + rintro e v ⟨⟨c, hc, hec⟩, hinc⟩ + have hle := π.cellGraph_le c hc.2 + have hinc_c : (π.cellGraph c).Inc e v := by + have hends := hle.ends_eq e hec + change v ∈ G.ends e at hinc + rw [hends] at hinc + exact hinc + exact mem_iUnion₂.mpr ⟨c, hc, (π.cellGraph c).vertex_mem_of_inc hinc_c⟩ + edge_mem_of_inc := by + rintro e v ⟨⟨c, hc, hec⟩, _⟩ + exact mem_iUnion₂.mpr ⟨c, hc, hec⟩ + vertexSet_finite := G.vertexSet_finite.subset + (iUnion₂_subset fun c hc => (π.cellGraph_le c hc.2).vertexSet_subset) + edgeSet_finite := G.edgeSet_finite.subset + (iUnion₂_subset fun c hc => (π.cellGraph_le c hc.2).edgeSet_subset) + +open Classical in +/-- The subhypergraph $\alpha(-c_0) = \bigcup (\alpha(c) : c \in C(\Gamma) \setminus \{c_0\})$ +associated with the complement of a single cell $c_0$. +Graph Minors XVII, Section 2 (page 165). -/ +def Portrayal.otherCellsGraph {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (c₀ : Set π.S) : Hypergraph α β := + π.cellsUnion (π.Γ.C \ {c₀}) + +open Classical in +/-- For a subset $\Delta \subseteq \Sigma$, the subhypergraph +$\alpha(\Delta) = \bigcup (\alpha(c) : c \in C(\Gamma), c \subseteq \Delta)$. +Graph Minors XVII, Section 5 (page 171): "if $\Sigma' \subseteq \Sigma$ we denote $\bigcup(\alpha(c) +\colon c \in C(\Gamma), c +\subseteq \Sigma')$ by $\alpha(\Sigma')$." -/ +def Portrayal.areaGraph {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Δ : Set π.S) : Hypergraph α β := + π.cellsUnion {c ∈ π.Γ.C | c ⊆ Δ} + +/-! ## 2. Small Subhypergraphs and Attachments (Section 4, Pages 169–170) -/ + +open Classical in +/-- A subhypergraph $A \subseteq G$ is *small* relative to $\mathcal{T}$ if $(A, B) \in \mathcal{T}$ +for some $B \subseteq G$. +Graph Minors XVII, Section 4 (page 169). -/ +def IsSmallWrt {α : Type u} {β : Type v} + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (A : Hypergraph α β) : Prop := + ∃ B, (A, B) ∈ 𝒯 + +open Classical in +/-- A vertex $v \in V(A)$ is an *attachment* of a subhypergraph $A \subseteq G$ in $G$ if $v$ is +incident in $G$ with some edge $e \in E(G) \setminus E(A)$. +Graph Minors XVII, Section 4 (page 169): "If $A$ is a subhypergraph of $G$, an *attachment* of $A$ +in $G$ is a vertex of $A$ incident with an edge of $G$ not in $E(A)$." -/ +def IsAttachment {α : Type u} {β : Type v} (G A : Hypergraph α β) (v : α) : Prop := + v ∈ A.vertexSet ∧ ∃ e ∈ G.edgeSet \ A.edgeSet, G.Inc e v + +open Classical in +/-- The set of all attachments of a subhypergraph $A$ in $G$. +Graph Minors XVII, Section 4 (page 169). -/ +def attachments {α : Type u} {β : Type v} (G A : Hypergraph α β) : Set α := + {v ∈ A.vertexSet | ∃ e ∈ G.edgeSet \ A.edgeSet, G.Inc e v} + +open Classical in +/-- The complementary subhypergraph of $A \le G$ in $G$, with vertex set +$(V(G) \setminus V(A)) \cup \text{attachments}(G, A)$ and edge set $E(G) \setminus E(A)$, so that +$(A, \text{complSubhypergraph } G\, A)$ is a separation of $G$ whose intersection vertex set is +$\text{attachments}(G, A)$. +Graph Minors XVII, Section 4 (page 169). -/ +def complSubhypergraph {α : Type u} {β : Type v} (G A : Hypergraph α β) : Hypergraph α β where + vertexSet := (G.vertexSet \ A.vertexSet) ∪ attachments G A + edgeSet := G.edgeSet \ A.edgeSet + Inc e v := e ∈ G.edgeSet \ A.edgeSet ∧ G.Inc e v + vertex_mem_of_inc := by + rintro e v ⟨he, hinc⟩ + by_cases hv : v ∈ A.vertexSet + · exact Or.inr ⟨hv, e, he, hinc⟩ + · exact Or.inl ⟨G.vertex_mem_of_inc hinc, hv⟩ + edge_mem_of_inc := fun _ _ h => h.1 + vertexSet_finite := (G.vertexSet_finite.subset sdiff_subset).union + (A.vertexSet_finite.subset fun _ h => h.1) + edgeSet_finite := G.edgeSet_finite.subset sdiff_subset + +/-! ## 3. Shrinking a Cell from a Node (Section 5, Page 171) -/ + +open Classical in +/-- A painting $\Gamma'$ in $\Sigma$ is obtained from $\Gamma$ by *shrinking* an internal cell +$c \in C(\Gamma)$ from a node $n \in \tilde{c}$ using a closed disc $\Delta \subseteq \bar{c}$ if +$n \notin \Delta$, $\tilde{c} \setminus \{n\} \subseteq \Delta$, +$U(\Gamma') = (U(\Gamma) \setminus c) \cup \Delta$, $N(\Gamma') = N(\Gamma)$, and +$C(\Gamma') = (C(\Gamma) \setminus \{c\}) \cup \{\Delta \setminus (\tilde{c} \setminus \{n\})\}$. +Graph Minors XVII, Section 5 (page 171). -/ +def Painting.IsShrunkenFrom {S : Type} [TopologicalSpace S] + (Γ Γ' : Painting S) (c : Set S) (n : S) (Δ : Set S) : Prop := + Γ.IsInternalCell c ∧ + n ∈ tilde c ∧ + IsClosedDisc Δ ∧ + Δ ⊆ closure c ∧ + n ∉ Δ ∧ + tilde c \ {n} ⊆ Δ ∧ + Γ'.U = (Γ.U \ c) ∪ Δ ∧ + Γ'.N = Γ.N ∧ + let c' := Δ \ (tilde c \ {n}) + c' ∈ Γ'.C ∧ + ¬ (c' ∩ bd S).Nonempty ∧ + tilde c' = tilde c \ {n} ∧ + Γ'.C = (Γ.C \ {c}) ∪ {c'} + +/-! ## 4. Quotient Portrayal and Cuff Terminals (Section 6, Pages 174–176) -/ + +open Classical in +/-- Given a portrayal $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ of $G$ and a vertex subset +$Z \subseteq V(G)$, the quotient portrayal $\pi' = (\Sigma, \Gamma, \alpha', \beta', \gamma')$ of +$G / Z$ has $\alpha'(c) = \alpha(c) / (Z \cap V(\alpha(c)))$, $\beta'(n) = \beta(n) \setminus Z$, +and $\operatorname{dom}(\gamma') = \{n \in \operatorname{dom}(\gamma) \mid \gamma(n) \notin Z\}$. +Graph Minors XVII, Section 6, (6.2) (page 174). -/ +def Portrayal.quotientBy {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Z : Set α) : Portrayal (quotientVertices G Z) where + S := π.S + isSurface := π.isSurface + connected := π.connected + Γ := π.Γ + cellGraph c := quotientVertices (π.cellGraph c) (Z ∩ (π.cellGraph c).vertexSet) + borderSet n := π.borderSet n \ Z + domγ := {n ∈ π.domγ | π.nodeVertex n ∉ Z} + nodeVertex := π.nodeVertex + cellGraph_le c hc := by + have hle := π.cellGraph_le c hc + refine ⟨?_, hle.edgeSet_subset, ?_⟩ + · intro v hv + exact ⟨hle.vertexSet_subset hv.1, fun hz => hv.2 ⟨hz, hv.1⟩⟩ + · intro e he + ext v + have hends := hle.ends_eq e he + have hv_iff : (π.cellGraph c).Inc e v ↔ G.Inc e v := by + change v ∈ (π.cellGraph c).ends e ↔ v ∈ G.ends e + rw [hends] + exact ⟨fun ⟨hinc, hv⟩ => ⟨hv_iff.mpr hinc, fun ⟨hz, _⟩ => hv hz⟩, + fun ⟨hinc, hv⟩ => ⟨hv_iff.mp hinc, fun hz => hv ⟨hz, (π.cellGraph c).vertex_mem_of_inc + hinc⟩⟩⟩ + borderSet_subset n hn v hv := ⟨π.borderSet_subset n hn hv.1, hv.2⟩ + domγ_subset _ hn := π.domγ_subset hn.1 + nodeVertex_mem n hn := ⟨π.nodeVertex_mem n hn.1, hn.2⟩ + nodeVertex_injOn := π.nodeVertex_injOn.mono fun _ hn => hn.1 + p1_vertex v hv := by + rcases π.p1_vertex v hv.1 with ⟨c, hc, hvc⟩ + exact ⟨c, hc, hvc, fun ⟨hz, _⟩ => hv.2 hz⟩ + p1_edge := π.p1_edge + p1_disjoint := π.p1_disjoint + p2 c hc n hn := ⟨π.p2 c hc n ⟨hn.1, hn.2.1⟩, fun ⟨hz, _⟩ => hn.2.2 hz⟩ + p3_notMem n hn hmem := π.p3_notMem n ⟨hn.1.1, hn.2⟩ hmem.1 + p3_subset c hc hbd n hnt v hv := + ⟨π.p3_subset c hc hbd n hnt hv.1, fun ⟨hz, _⟩ => hv.2 hz⟩ + p4_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ hne n₁ hn₁ n₂ hn₂ := + (π.p4_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ hne n₁ hn₁ n₂ hn₂).mono sdiff_subset sdiff_subset + p4_notMem Θ hΘ n₁ hn₁ n₂ hn₂ hnot hmem := + π.p4_notMem Θ hΘ n₁ hn₁ n₂ hn₂.1 hnot hmem.1 + p5 c hc hbd v hv hex := by + rcases hex with ⟨c', hc', hne, hvc'⟩ + rcases π.p5 c hc hbd v hv.1 ⟨c', hc', hne, hvc'.1⟩ with ⟨n, ⟨hnt, hnd⟩, rfl⟩ + exact ⟨n, ⟨hnt, hnd, fun hz => hv.2 ⟨hz, hv.1⟩⟩, rfl⟩ + p6 c hc hbd v hv hex := by + rcases hex with ⟨c', hc', hne, hvc'⟩ + rcases π.p6 c hc hbd v hv.1 ⟨c', hc', hne, hvc'.1⟩ with ⟨n, hnt, hmem | ⟨hnd, rfl⟩⟩ + · exact ⟨n, hnt, Or.inl ⟨hmem, fun hz => hv.2 ⟨hz, hv.1⟩⟩⟩ + · exact ⟨n, hnt, Or.inr ⟨⟨hnd, fun hz => hv.2 ⟨hz, hv.1⟩⟩, rfl⟩⟩ + p7 Θ hΘ n₁ hn₁ n₂ hn₂ n₃ hn₃ n₄ hn₄ hord v hv₁ hv₃ := by + have hv₁' : v ∈ π.borderSet n₁ ∨ (n₁ ∈ π.domγ ∧ v = π.nodeVertex n₁) := by + rcases hv₁ with ⟨h, _⟩ | ⟨⟨h, _⟩, rfl⟩ + · exact Or.inl h + · exact Or.inr ⟨h, rfl⟩ + have hv₃' : v ∈ π.borderSet n₃ ∨ (n₃ ∈ π.domγ ∧ v = π.nodeVertex n₃) := by + rcases hv₃ with ⟨h, _⟩ | ⟨⟨h, _⟩, rfl⟩ + · exact Or.inl h + · exact Or.inr ⟨h, rfl⟩ + have hvZ : v ∉ Z := by + rcases hv₁ with ⟨_, hz⟩ | ⟨⟨_, hz⟩, rfl⟩ <;> exact hz + rcases π.p7 Θ hΘ n₁ hn₁ n₂ hn₂ n₃ hn₃ n₄ hn₄ hord v hv₁' hv₃' with + (h2 | ⟨h2, rfl⟩) | (h4 | ⟨h4, rfl⟩) + · exact Or.inl (Or.inl ⟨h2, hvZ⟩) + · exact Or.inl (Or.inr ⟨⟨h2, hvZ⟩, rfl⟩) + · exact Or.inr (Or.inl ⟨h4, hvZ⟩) + · exact Or.inr (Or.inr ⟨⟨h4, hvZ⟩, rfl⟩) + +/-! ## 5. Regions of $\Gamma$ and $C^*(\Gamma)$ (Section 8, Pages 181–183) -/ + +open Classical in +/-- A *region* of a painting $\Gamma$ in $\Sigma$ is an arc-wise connected component of +$\Sigma \setminus U(\Gamma)$. +Graph Minors XVII, Section 1 (page 165) and Section 8, (8.1)–(8.2) (page 181). -/ +def Painting.regions {S : Type} [TopologicalSpace S] (Γ : Painting S) : Set (Set S) := + arcComponentsIn (Set.univ \ Γ.U) + +open Classical in +/-- For a painting $\Gamma$, $C^*(\Gamma)$ is the set of all cells $c \in C(\Gamma)$ such that +there is no $c' \in C(\Gamma)$ with $c' \ne c$ and $\tilde{c} \subseteq \tilde{c}'$. +Graph Minors XVII, Section 8 (page 182): "We define $C^*(\Gamma)$ to be the set of all +$c \in C(\Gamma)$ such that there is no $c' \in C(\Gamma)$ with $c' \ne c$ and +$\tilde{c} \subseteq \tilde{c}'$." -/ +def Painting.CStar {S : Type} [TopologicalSpace S] (Γ : Painting S) : Set (Set S) := + {c ∈ Γ.C | ¬ ∃ c' ∈ Γ.C, c' ≠ c ∧ tilde c ⊆ tilde c'} + +/-! ## 6. Standard Linkages and Circumnavigating a Vortex (Section 10, Page 188) -/ + +open Classical in +/-- A family of $q$ paths `L : Fin q → PathFromTo (π.cellGraph c).skeleton (π.borderSet n₁) +(π.borderSet n₂)` +is a *standard linkage* in $\alpha(c)$ for a border cell $c$ with tail $n_1$ and head $n_2$ +(where $q = \text{warpAt}(\Theta)$) if: +1. The paths are pairwise vertex-disjoint and avoid $\gamma(n_1)$ and $\gamma(n_2)$; and +2. Either there is a path $L_0$ from $\gamma(n_1)$ to $\gamma(n_2)$ disjoint from all $L_i$, or + there is an internal cell $c' \in C(\Gamma)$ with $|\tilde{c}'| = 3$ and $\tilde{c} \subseteq + \tilde{c}'$. +Graph Minors XVII, Section 10 (page 188) and (9.8) (page 188). -/ +def Portrayal.IsStandardLinkage {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (c : Set π.S) (n₁ n₂ : π.S) (q : ℕ) + (L : Fin q → PathFromTo (π.cellGraph c).skeleton (π.borderSet n₁) (π.borderSet n₂)) : Prop := + (Pairwise fun i j => Disjoint {z | z ∈ (L i).walk.support} {z | z ∈ (L j).walk.support}) ∧ + (∀ i, π.nodeVertex n₁ ∉ (L i).walk.support ∧ π.nodeVertex n₂ ∉ (L i).walk.support) ∧ + ((∃ L₀ : PathFromTo (π.cellGraph c).skeleton {π.nodeVertex n₁} {π.nodeVertex n₂}, + ∀ i, Disjoint {z | z ∈ L₀.walk.support} {z | z ∈ (L i).walk.support}) ∨ + ∃ c' ∈ π.Γ.C, ¬ (c' ∩ bd π.S).Nonempty ∧ (tilde c').ncard = 3 ∧ tilde c ⊆ tilde c') + +open Classical in +/-- A choice of standard linkages around a cuff $\Theta$ with cyclic enumeration $E$. +Graph Minors XVII, Section 10 (page 188). -/ +structure CuffStandardLinkages {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Θ : Set π.S) (k q : ℕ) (E : π.Γ.CuffEnumeration Θ k) where + /-- The $q$ paths of the standard linkage in $\alpha(c_i)$ from $\beta(n_i)$ to $\beta(n_{i+1})$. + -/ + L : ∀ i : Fin k, + Fin q → PathFromTo (π.cellGraph (E.cell i)).skeleton + (π.borderSet (E.node i)) + (π.borderSet (E.node (cyclicSucc (by have := E.two_le; omega) i))) + /-- Each `L i` is a standard linkage in $\alpha(c_i)$. -/ + isStandard : ∀ i : Fin k, + π.IsStandardLinkage (E.cell i) (E.node i) + (E.node (cyclicSucc (by have := E.two_le; omega) i)) q (L i) + +open Classical in +/-- Given `SL : CuffStandardLinkages π Θ k q E`, a starting index $i_0 \in \text{Fin } k$, and a +vertex $v \in \beta(n_{i_0})$, the sequence of vertices $v_0, v_1, \dots, v_k$ obtained by +following the standard linkages around $\Theta$ starting at $v_0 = v$. +Graph Minors XVII, Section 10 (page 188). -/ +noncomputable def CuffStandardLinkages.traceVertex {α : Type u} {β : Type v} {G : Hypergraph α β} + {π : Portrayal G} {Θ : Set π.S} {k q : ℕ} {E : π.Γ.CuffEnumeration Θ k} + (SL : CuffStandardLinkages π Θ k q E) (i₀ : Fin k) (v : α) : ℕ → α + | 0 => v + | m + 1 => + let idx : Fin k := ⟨(i₀.1 + m) % k, Nat.mod_lt _ (by have := E.two_le; omega)⟩ + let cur := SL.traceVertex i₀ v m + if h : ∃ j : Fin q, (SL.L idx j).first = cur then + (SL.L idx (Classical.choose h)).last + else cur + +open Classical in +/-- The vertex set $V(L(v, n_{i_0}))$ of the circumnavigation subgraph $L(v, n_{i_0}) = P_1 \cup +\dots \cup P_k$ +around $\Theta$ starting at $v \in \beta(n_{i_0})$. +Graph Minors XVII, Section 10 (page 188). -/ +noncomputable def CuffStandardLinkages.circumnavigationVertices {α : Type u} {β : Type v} + {G : Hypergraph α β} {π : Portrayal G} {Θ : Set π.S} {k q : ℕ} + {E : π.Γ.CuffEnumeration Θ k} + (SL : CuffStandardLinkages π Θ k q E) (i₀ : Fin k) (v : α) : Set α := + ⋃ m ∈ Finset.range k, + let idx : Fin k := ⟨(i₀.1 + m) % k, Nat.mod_lt _ (by have := E.two_le; omega)⟩ + let cur := SL.traceVertex i₀ v m + if h : ∃ j : Fin q, (SL.L idx j).first = cur then + {z | z ∈ (SL.L idx (Classical.choose h)).walk.support} + else {cur} + +/-! ## 7. Surface Separations, $\gamma(I)$, $S$, and $D(A, B)$ (Section 11, Pages 189–196) -/ + +open Classical in +/-- For a subset of cells $I \subseteq C(\Gamma)$, the set of nodes +$\bigcup (\tilde{c} : c \in I) \subseteq N(\Gamma)$. +Graph Minors XVII, Section 11 (page 189). -/ +def Painting.tildeOfCells {S : Type} [TopologicalSpace S] + (_Γ : Painting S) (I : Set (Set S)) : Set S := + ⋃ c ∈ I, tilde c + +open Classical in +/-- For a subset of cells $I \subseteq C(\Gamma)$, the vertex set +$\gamma(I) = \bigcup (\gamma(\tilde{c}) : c \in I) \subseteq V(G)$. +Graph Minors XVII, Section 11 (page 189): "For $I \subseteq C(\Gamma)$ we define $\gamma(I) = +\bigcup (\gamma(\tilde{c}) \colon c \in +I)$." -/ +def Portrayal.gammaOfCells {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (I : Set (Set π.S)) : Set α := + ⋃ c ∈ I, π.gammaImage (tilde c) + +open Classical in +/-- For a separation $(A, B)$ of $G$, $D(A, B)$ is the set of cells $c \in C^*(\Gamma)$ such that +$\gamma(\tilde{c}) \not\subseteq V(A)$ and $\gamma(\tilde{c}) \not\subseteq V(B)$. +Graph Minors XVII, Section 11 (page 193): +"D(A, B) = \{c \in C^*(\Gamma) : \gamma(\tilde{c}) \nsubseteq V(A) \text{ and } +\gamma(\tilde{c}) \nsubseteq V(B)\}." -/ +def Portrayal.crossingCells {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (A B : Hypergraph α β) : Set (Set π.S) := + {c ∈ π.Γ.CStar | ¬ (π.gammaImage (tilde c) ⊆ A.vertexSet) ∧ + ¬ (π.gammaImage (tilde c) ⊆ B.vertexSet)} + +/-! ## 8. Cliques, Induced Tangles, and Embodiment (Section 12, Pages 196–200) -/ + +open Classical in +/-- A *clique* in a hypergraph $G$ is a subset $K \subseteq V(G)$ whose members are pairwise +adjacent in the 1-skeleton $G^*$. +Graph Minors XVII, Section 12 (page 196): "A *clique* in a hypergraph $G$ is (for our purposes) +a subset of $V(G)$ the members of which are mutually adjacent in $G^*$." -/ +def IsClique {α : Type u} {β : Type v} (G : Hypergraph α β) (K : Set α) : Prop := + K ⊆ G.vertexSet ∧ ∀ u ∈ K, ∀ v ∈ K, u ≠ v → G.skeleton.Adj u v + +/-- Given a subhypergraph $G' \le G$ and a tangle $\mathcal{T}'$ in $G'$ of order $\theta$, +the *tangle induced by $\mathcal{T}'$* in $G$ is the set of all separations $(A, B)$ of $G$ of +order $< \theta$ such that $(A \cap G', B \cap G') \in \mathcal{T}'$. +Graph Minors XVII, Section 12 (page 199). -/ +abbrev inducedSubhypergraphTangle {α : Type u} {β : Type v} + (G G' : Hypergraph α β) (𝒯' : Set (Hypergraph α β × Hypergraph α β)) (θ : ℕ) : + Set (Hypergraph α β × Hypergraph α β) := + GM10.inducedTangleFromSubgraph G G' θ 𝒯' + +open Classical in +/-- The 1-skeleton $A^*$ of a hypergraph $A$, viewed as a `Hypergraph α (Sym2 α)` with vertex set +$V(A)$ and edge set consisting of the edges of the simple graph `A.skeleton` (that is, pairs +$s(u, v)$ of distinct vertices of $A$ incident with a common edge of $A$). +Graph Minors XVII, Section 3 (page 168) and Section 12, (12.5) (page 200). -/ +def oneSkeletonHypergraph {α : Type u} {β : Type v} + (A : Hypergraph α β) : Hypergraph α (Sym2 α) where + vertexSet := A.vertexSet + edgeSet := A.skeleton.edgeSet + Inc e v := e ∈ A.skeleton.edgeSet ∧ v ∈ e + vertex_mem_of_inc := by + rintro e v ⟨he, hv⟩ + induction e using Sym2.ind with + | _ x y => + rw [SimpleGraph.mem_edgeSet] at he + rcases he with ⟨_, e₀, hx, hy⟩ + rcases Sym2.mem_iff.mp hv with rfl | rfl + · exact A.vertex_mem_of_inc hx + · exact A.vertex_mem_of_inc hy + edge_mem_of_inc := fun _ _ h => h.1 + vertexSet_finite := A.vertexSet_finite + edgeSet_finite := by + have hsub : A.skeleton.edgeSet ⊆ + (fun p : α × α => s(p.1, p.2)) '' (A.vertexSet ×ˢ A.vertexSet) := by + intro e he + induction e using Sym2.ind with + | _ x y => + rw [SimpleGraph.mem_edgeSet] at he + rcases he with ⟨_, e₀, hx, hy⟩ + exact ⟨(x, y), ⟨A.vertex_mem_of_inc hx, A.vertex_mem_of_inc hy⟩, rfl⟩ + exact ((A.vertexSet_finite.prod A.vertexSet_finite).image _).subset hsub + +open Classical in +/-- Given a tangle $\mathcal{T}^*$ of order $\theta$ in the 1-skeleton $G^*$ of a hypergraph $G$, +the *embodiment of $\mathcal{T}^*$ in $G$* is the set of all separations $(A, B)$ of $G$ of order +$< \theta$ such that $A^*$ is small relative to $\mathcal{T}^*$. +Graph Minors XVII, Section 12, (12.5) (page 200). -/ +def embodimentTangle {α : Type u} {β : Type v} + (G : Hypergraph α β) + (𝒯_star : Set (Hypergraph α (Sym2 α) × Hypergraph α (Sym2 α))) (θ : ℕ) : + Set (Hypergraph α β × Hypergraph α β) := + {p | G.IsSeparation p.1 p.2 ∧ separationOrder p.1 p.2 < θ ∧ + IsSmallWrt 𝒯_star (oneSkeletonHypergraph p.1)} + +/-! ## 9. Adding a Vertex, Complexity $h_p(\pi)$, and Standards (Section 13, Pages 203–206) -/ + +open Classical in +/-- For a subhypergraph $H \subseteq G$ and a vertex $v \in V(G)$, $H + v$ is the subhypergraph +$(V(H) \cup \{v\}, E(H))$ with the same edges and incidences as $H$. +Graph Minors XVII, Section 13, proof of (13.1) (page 203): "by $H + v$ we mean the hypergraph +$(V(H) \cup \{v\}, E(H))$." -/ +def addVertex {α : Type u} {β : Type v} (H : Hypergraph α β) (v : α) : Hypergraph α β where + vertexSet := H.vertexSet ∪ {v} + edgeSet := H.edgeSet + Inc := H.Inc + vertex_mem_of_inc := fun _ _ h => Or.inl (H.vertex_mem_of_inc h) + edge_mem_of_inc := H.edge_mem_of_inc + vertexSet_finite := H.vertexSet_finite.union (finite_singleton v) + edgeSet_finite := H.edgeSet_finite + +open Classical in +/-- The sum $r = \sum_{\Theta} \text{warpAt}(\pi, \Theta)$ of the warps of $\pi$ over all cuffs +$\Theta$ of $\Sigma$. +Graph Minors XVII, Section 13 (page 205). -/ +noncomputable def Portrayal.totalCuffWarp {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) : ℕ := + if h : (cuffs π.S).Finite then + ∑ Θ ∈ h.toFinset, π.warpAt Θ + else 0 + +open Classical in +/-- Given surface classification parameters $(a, b, c)$ such that $\Sigma \cong \Sigma(a, b, c)$, +the complexity $h_p(\pi) = (4a + 2b + c)^2 p + r$, where $r$ is the sum over all cuffs $\Theta$ +of $\Sigma$ of the warp of $\pi$ at $\Theta$. +Graph Minors XVII, Section 13 (page 205). -/ +noncomputable def Portrayal.hpWithParams {α : Type u} {β : Type v} {G : Hypergraph α β} + (p : ℕ) (π : Portrayal G) (a b c : ℕ) : ℕ := + (4 * a + 2 * b + c) ^ 2 * p + π.totalCuffWarp + +open Classical in +/-- The complexity $h_p(\pi) = (4a + 2b + c)^2 p + r$ of a portrayal $\pi = (\Sigma, \Gamma, \alpha, +\beta, \gamma)$, +where $4a + 2b + c$ is the minimum over all $(a, b, c)$ with $\Sigma \cong \Sigma(a, b, c)$ (which +is +unique by the classification of compact connected surfaces). +Graph Minors XVII, Section 13 (page 205). -/ +noncomputable def Portrayal.hp {α : Type u} {β : Type v} {G : Hypergraph α β} + (p : ℕ) (π : Portrayal G) : ℕ := + let g := sInf {k : ℕ | ∃ a b c : ℕ, Nonempty (π.S ≃ₜ SurfaceModel a b c) ∧ 4 * a + 2 * b + c = k} + g ^ 2 * p + π.totalCuffWarp + +open Classical in +/-- A function $\sigma$ assigning a natural number $\sigma(\Sigma, p, z)$ to each connected +surface $\Sigma$ and integers $p \ge 1$ and $z \ge 0$ is a *standard* if +$\sigma(\Sigma, p, z) = \sigma(\Sigma', p, z)$ whenever $\Sigma$ and $\Sigma'$ are homeomorphic. +Graph Minors XVII, Section 13 (page 205). -/ +def IsStandard (σ : (S : Type) → [TopologicalSpace S] → ℕ → ℕ → ℕ) : Prop := + ∀ (S S' : Type) [TopologicalSpace S] [TopologicalSpace S'] (p z : ℕ), + IsSurface S → ConnectedSpace S → IsSurface S' → ConnectedSpace S' → + Nonempty (S ≃ₜ S') → σ S p z = σ S' p z + +/-! ## 10. Tangle in the 1-Skeleton (Section 14, Pages 207–209) -/ + +open Classical in +/-- Given a tangle $\mathcal{T}$ in a hypergraph $G$ and $\theta^* \ge 1$, $\mathcal{T}^*$ is the +set of all separations $(A', B')$ of the 1-skeleton $G^*$ of order $< \theta^*$ such that there +exists $(A, B) \in \mathcal{T}$ with $V(A) = V(A')$ and $V(B) = V(B')$. +Graph Minors XVII, Section 14, (14.1) (page 207). -/ +def oneSkeletonTangle {α : Type u} {β : Type v} + (G : Hypergraph α β) (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (θ_star : ℕ) : + Set (Hypergraph α (Sym2 α) × Hypergraph α (Sym2 α)) := + {p | (oneSkeletonHypergraph G).IsSeparation p.1 p.2 ∧ + separationOrder p.1 p.2 < θ_star ∧ + ∃ q ∈ 𝒯, q.1.vertexSet = p.1.vertexSet ∧ q.2.vertexSet = p.2.vertexSet} + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/FreeLift.lean b/LeanPool/GraphMinor/GM17/FreeLift.lean new file mode 100644 index 0000000000..6057a1986d --- /dev/null +++ b/LeanPool/GraphMinor/GM17/FreeLift.lean @@ -0,0 +1,232 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Bigon + +/-! +# The free side of a curve at a node + +We cut a closed surface along a curve through a node `n`. The cells at `n` and the disc on the cuff +of `n` all come to `n` from one side, so one lift of `n` stays away +from the lift of the paint and the discs (`exists_free_lift`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {Y S T : Type} [TopologicalSpace Y] [TopologicalSpace S] [TopologicalSpace T] + +theorem cutMap_of_cutting {ψ : Y → T} {F : Set T} (h : IsCutting ψ F) + (hF : IsClosed F) : CutMap ψ F := by + refine ⟨h.1, h.2.2.1, ?_, hF, fun x hx => cut_encard_le h hx, h.2.2.2.2⟩ + rw [h.2.1.range_eq, ← compl_eq_univ_sdiff] + exact hF.isOpen_compl + +theorem disc_diff_finite [T2Space T] {D P : Set T} (hD : IsClosedDisc D) + (hP : P ∩ D ⊆ discBd D) : closure (D \ P) = D ∧ tilde (D \ P) ⊆ P ∩ D := by + have hcl := (hD.sdiff_of_inter_subset_discBd hP).2.2 + refine ⟨hcl, ?_⟩ + rintro x ⟨hx, hn⟩ + rw [hcl] at hx + refine ⟨?_, hx⟩ + by_contra hc + exact hn ⟨hx, hc⟩ + +theorem mem_closure_line_diff {L P : Set T} {u v x : T} (hL : IsLineWithEnds L u v) + (hx : x ∈ L) (hP : P.Finite) : x ∈ closure (L \ P) := by + obtain ⟨a, ha, rfl, -, -⟩ := hL.exists_arc + obtain ⟨t, rfl⟩ := hx + have hfin : (a ⁻¹' P).Finite := hP.preimage ha.2.injOn + have hd : Dense (univ \ a ⁻¹' P) := dense_univ.sdiff_finite hfin + have h1 : t ∈ closure (univ \ a ⁻¹' P) := hd t + refine image_closure_subset_closure_image ha.1 (mem_image_of_mem _ h1) |> closure_mono ?_ + rintro _ ⟨s, hs, rfl⟩ + exact ⟨mem_range_self s, hs.2⟩ + +/-- Every point in the closure of a set has a lift in the closure of the preimage. -/ +theorem exists_lift_closure [CompactSpace Y] [T2Space T] {ψ : Y → T} (hc : Continuous ψ) + (hs : Function.Surjective ψ) {Q : Set T} {x : T} (hx : x ∈ closure Q) : + ∃ y ∈ closure (ψ ⁻¹' Q), ψ y = x := by + have h1 : IsClosed (ψ '' closure (ψ ⁻¹' Q)) := (isClosed_closure.isCompact.image hc).isClosed + have h2 : Q ⊆ ψ '' closure (ψ ⁻¹' Q) := fun z hz => by + obtain ⟨y, rfl⟩ := hs z + exact ⟨y, subset_closure hz, rfl⟩ + exact closure_minimal h2 h1 hx + +theorem exists_free_lift [CompactSpace Y] [T2Space Y] + [T2Space T] (hS : IsSurface S) {Γ : Painting S} {F : Set S} + (hnorm : Γ.IsNormal F) (hint : ∀ c ∈ Γ.C, Γ.IsInternalCell c → Disjoint (tilde c) F) {n : S} + (hnF : n ∈ F) (hnN : n ∈ Γ.N) {j : S → T} {cap : Set S → Set T} + (hj : IsClosedEmbedding j) (hcap : ∀ C ∈ cuffs S, IsClosedDisc (cap C) ∧ discBd (cap C) + = j '' C ∧ range j ∩ cap C = j '' C) {ψ : Y → T} + (hψ : IsCutting ψ (j '' F)) (hFc : IsClosed (j '' F)) : + ∃ y, ψ y = j n ∧ y ∉ closure (ψ ⁻¹' ((j '' Γ.U ∪ ⋃ C ∈ cuffs S, cap C) \ j '' F)) := by + classical + have hm := cutMap_of_cutting hψ hFc + have hneY : Nonempty Y := ⟨(hψ.2.1 (j n)).choose⟩ + have hfinC := (cuff_statement.{0} S hS).2.1 + have hsurj : ∀ x, x ∈ range ψ := fun x => hψ.2.1 x + have hcell : ∀ c ∈ Γ.C, Disjoint c F := fun c hc => disjoint_left.mpr fun x hx hxF => + (arcComponentsIn_subset hc hx).2 (hnorm ⟨hxF, (arcComponentsIn_subset hc hx).1⟩) + have hinj_c : ∀ c ∈ Γ.C, InjOn ψ (closure (ψ ⁻¹' (j '' c))) := fun c hc => by + obtain ⟨h1, h2, h3, -⟩ := Γ.cell_disc c hc + refine hm.injOn_closure ?_ ?_ ?_ ?_ ?_ + · exact (disjoint_image_iff hj.injective).mpr (hcell c hc) + · rw [hj.closure_image_eq] + exact image_emb_disc hj.isEmbedding h1 + · rw [tilde_image_emb hj, hj.closure_image_eq, discBd_image hj.isEmbedding] + exact image_mono h2 + · rw [tilde_image_emb hj] + exact h3.image _ + · rintro _ ⟨x, hx, rfl⟩ + exact ⟨hsurj _, fun h => disjoint_left.mp ((disjoint_image_iff hj.injective).mpr + (hcell c hc)) (mem_image_of_mem _ hx) h⟩ + have hbC : ∀ {C : Set S}, C ∈ cuffs S → C ⊆ bd S := fun {C} hC => by + obtain ⟨x, -, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + have hPE : ∀ C ∈ cuffs S, (j '' F ∩ cap C ⊆ discBd (cap C)) ∧ (j '' F ∩ cap C).Finite := fun C hC + => by + obtain ⟨h1, h2, h3⟩ := hcap C hC + have h4 : j '' F ∩ cap C ⊆ j '' (F ∩ Γ.N) := by + rintro _ ⟨⟨x, hx, rfl⟩, hx'⟩ + obtain ⟨y, hy, he⟩ := (h3 ▸ ⟨⟨x, rfl⟩, hx'⟩ : j x ∈ j '' C) + obtain rfl := hj.injective he + exact mem_image_of_mem _ ⟨hx, hnorm ⟨hx, Γ.bd_subset (hbC hC hy)⟩⟩ + refine ⟨?_, ((Γ.finite_N.subset inter_subset_right).image _).subset h4⟩ + rw [h2] + rintro _ ⟨⟨x, hx, rfl⟩, hx'⟩ + exact h3 ▸ (⟨⟨x, rfl⟩, hx'⟩ : j x ∈ range j ∩ cap C) + have hinj_E : ∀ C ∈ cuffs S, InjOn ψ (closure (ψ ⁻¹' (cap C \ j '' F))) := fun C hC => by + obtain ⟨h1, -, -⟩ := hcap C hC + obtain ⟨h5, h6⟩ := hPE C hC + have hP : j '' F ∩ cap C ⊆ discBd (cap C) := h5 + obtain ⟨h7, h8⟩ := disc_diff_finite h1 hP + refine hm.injOn_closure disjoint_sdiff_left ?_ ?_ (h6.subset h8) fun x hx => ⟨hsurj _, hx.2⟩ + · rw [h7] + exact h1 + · rw [h7] + exact h8.trans h5 + have hfar : ∀ Q, j n ∉ closure Q → ∀ y, ψ y = j n → y ∉ closure (ψ ⁻¹' Q) := fun Q hQ y hy hc + => hQ (hy ▸ hψ.1.closure_preimage_subset Q hc) + let 𝒬 : Set (Set T) := (fun c => j '' c) '' Γ.C ∪ (fun C => cap C \ j '' F) '' cuffs S + have hfinQ : 𝒬.Finite := (Γ.finite_cells.image _).union (hfinC.image _) + have htil : ∀ c ∈ Γ.C, n ∈ closure c → n ∈ tilde c := fun c hc h => ⟨h, fun hn => + (arcComponentsIn_subset hc hn).2 hnN⟩ + have hbord : ∀ c ∈ Γ.C, n ∈ tilde c → (c ∩ bd S).Nonempty := fun c hc ht => by + by_contra hn + exact disjoint_left.mp (hint c hc ⟨hc, hn⟩) ht hnF + have hfree : ∃ y, ψ y = j n ∧ ∀ Q ∈ 𝒬, y ∉ closure (ψ ⁻¹' Q) := by + by_cases hnb : n ∈ bd S + · have hΘ : connectedComponentIn (bd S) n ∈ cuffs S := ⟨n, hnb, rfl⟩ + set Θ := connectedComponentIn (bd S) n with hΘdef + have hnΘ : n ∈ Θ := mem_connectedComponentIn hnb + obtain ⟨h1, h2, h3⟩ := hcap Θ hΘ + have hmE : j n ∈ cap Θ := discBd_subset _ (h2 ▸ mem_image_of_mem _ hnΘ) + have hcl₀ := (disc_diff_finite h1 (hPE Θ hΘ).1).1 + obtain ⟨y₀, hy₀, hy₀m⟩ := exists_lift_closure hψ.1 hψ.2.1 (hcl₀.symm ▸ hmE : j n ∈ closure + (cap Θ \ j '' F)) + have hmF : j n ∈ j '' F := mem_image_of_mem _ hnF + obtain ⟨a, b, hab, he⟩ := Set.ncard_eq_two.mp (hψ.2.2.2.1 _ hmF) + have hother : ∃ y, ψ y = j n ∧ y ≠ y₀ := by + have ha : ψ a = j n := (show a ∈ ψ ⁻¹' {j n} from he ▸ mem_insert _ _) + have hb : ψ b = j n := (show b ∈ ψ ⁻¹' {j n} from he ▸ mem_insert_of_mem _ rfl) + by_cases h : a = y₀ + · exact ⟨b, hb, fun h' => hab (h.trans h'.symm)⟩ + · exact ⟨a, ha, h⟩ + obtain ⟨y, hy, hyne⟩ := hother + refine ⟨y, hy, ?_⟩ + rintro Q (⟨c, hc, rfl⟩ | ⟨C, hC, rfl⟩) + · simp only + by_cases hnc : n ∈ closure c + · intro hyc + obtain ⟨u, v, -, htc, hl, hce, -, -⟩ := Γ.border_cell_exists_ends hc (hbord c hc + (htil c hc hnc)) + have hnL : n ∈ closure c ∩ bd S := ⟨hnc, hnb⟩ + have hLΘ : closure c ∩ bd S ⊆ Θ := subset_cuff hΘ (isPreconnected_line hl) + inter_subset_right hnΘ hnL + have hfinP : (F ∩ Γ.N ∪ {u, v}).Finite := (Γ.finite_N.subset inter_subset_right).union + (by simp) + let M : Set T := j '' ((closure c ∩ bd S) \ (F ∩ Γ.N ∪ {u, v})) + have hMc : M ⊆ j '' c := image_mono fun x hx => by + have h4 : x ∈ c ∩ bd S := hce ▸ ⟨hx.1, fun h => hx.2 (.inr h)⟩ + exact h4.1 + have hMQ : M ⊆ cap Θ \ j '' F := by + rintro _ ⟨x, hx, rfl⟩ + refine ⟨discBd_subset _ (h2 ▸ mem_image_of_mem _ (hLΘ hx.1)), ?_⟩ + rintro ⟨z, hz, he⟩ + obtain rfl := hj.injective he + exact hx.2 (.inl ⟨hz, hnorm ⟨hz, Γ.bd_subset hx.1.2⟩⟩) + have hmM : j n ∈ closure M := image_closure_subset_closure_image hj.continuous + (mem_image_of_mem _ (mem_closure_line_diff hl hnL hfinP)) + obtain ⟨y', hy', hy'm⟩ := exists_lift_closure hψ.1 hψ.2.1 hmM + have h5 := hinj_c c hc (closure_mono (preimage_mono hMc) hy') hyc (hy'm.trans hy.symm) + have h6 := hinj_E Θ hΘ (closure_mono (preimage_mono hMQ) hy') hy₀ (hy'm.trans hy₀m.symm) + exact hyne (h5.symm.trans h6) + · refine hfar _ ?_ y hy + rw [hj.closure_image_eq] + exact fun h => hnc (hj.injective.mem_set_image.mp h) + · simp only + by_cases hCe : C = Θ + · subst hCe + exact fun hyc => hyne (hinj_E _ hΘ hyc hy₀ (hy.trans hy₀m.symm)) + · refine hfar _ ?_ y hy + rw [(disc_diff_finite (hcap C hC).1 (hPE C hC).1).1] + intro hmem + obtain ⟨z, hz, he⟩ := ((hcap C hC).2.2 ▸ ⟨⟨n, rfl⟩, hmem⟩ : j n ∈ j '' C) + obtain rfl := hj.injective he + exact hCe (cuffs_disjoint_eq hC hΘ hz hnΘ) + · obtain ⟨y, hy⟩ := hψ.2.1 (j n) + refine ⟨y, hy, ?_⟩ + rintro Q (⟨c, hc, rfl⟩ | ⟨C, hC, rfl⟩) + · refine hfar _ ?_ y hy + simp only + rw [hj.closure_image_eq] + intro h + have hnc := hj.injective.mem_set_image.mp h + obtain ⟨u, v, -, htc, -, -, hu, hv⟩ := Γ.border_cell_exists_ends hc (hbord c hc + (htil c hc hnc)) + rcases (htc ▸ htil c hc hnc : n ∈ ({u, v} : Set S)) with rfl | rfl + · exact hnb hu.2 + · exact hnb hv.2 + · refine hfar _ ?_ y hy + simp only + rw [(disc_diff_finite (hcap C hC).1 (hPE C hC).1).1] + intro hmem + obtain ⟨z, hz, he⟩ := ((hcap C hC).2.2 ▸ ⟨⟨n, rfl⟩, hmem⟩ : j n ∈ j '' C) + obtain rfl := hj.injective he + exact hnb (hbC hC hz) + obtain ⟨y, hy, hyQ⟩ := hfree + refine ⟨y, hy, ?_⟩ + let B : Set Y := (⋃ Q ∈ 𝒬, closure (ψ ⁻¹' Q)) ∪ ψ ⁻¹' (j '' (Γ.N \ {n})) + have hBc : IsClosed B := (hfinQ.isClosed_biUnion fun _ _ => isClosed_closure).union + ((((Γ.finite_N.subset sdiff_subset).image _).isClosed).preimage hψ.1) + have hsub : ψ ⁻¹' ((j '' Γ.U ∪ ⋃ C ∈ cuffs S, cap C) \ j '' F) ⊆ B := by + rintro w ⟨h1 | h1, hwF⟩ + · obtain ⟨x, hx, hxw⟩ := h1 + by_cases hxN : x ∈ Γ.N + · refine .inr ⟨x, ⟨hxN, ?_⟩, hxw⟩ + rintro rfl + exact hwF ⟨_, hnF, hxw⟩ + · obtain ⟨c, hc, hxc⟩ := exists_mem_arcComponentsIn (F := Γ.U \ Γ.N) (x := x) ⟨hx, hxN⟩ + exact .inl (mem_biUnion (.inl (mem_image_of_mem _ hc)) (subset_closure ⟨x, hxc, hxw⟩)) + · obtain ⟨C, hC, hw⟩ := mem_iUnion₂.mp h1 + exact .inl (mem_biUnion (.inr (mem_image_of_mem _ hC)) (subset_closure ⟨hw, hwF⟩)) + intro hc + rcases closure_minimal hsub hBc hc with h1 | h1 + · obtain ⟨Q, hQ, h2⟩ := mem_iUnion₂.mp h1 + exact hyQ Q hQ h2 + · obtain ⟨x, hx, he⟩ := h1 + have := hj.injective (he.trans hy) + exact hx.2 this + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/IndentDisc.lean b/LeanPool/GraphMinor/GM17/IndentDisc.lean new file mode 100644 index 0000000000..2ddb523d8f --- /dev/null +++ b/LeanPool/GraphMinor/GM17/IndentDisc.lean @@ -0,0 +1,804 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.IndentPaint +public import LeanPool.GraphMinor.GM17.IndentPush +public import LeanPool.GraphMinor.Surface.DiscUnion +import LeanPool.GraphMinor.GM17.CellNodes + +/-! +# Pushing a node to a cuff across a disc + +Let `D` be a closed disc whose boundary is a line `A` of a cuff and a line `G` through an internal +node `n`, and suppose that `D` has +no nodes but `n` and the two ends. This is the disc `Δ₀ ∪ Δ₁ ∪ Δ₂` of the proof of (9.3) of Graph +Minors XVII, page 184, and the disc +`Δ ∪ Δ₁ ∪ Δ₂` of the proof of (9.4), page 185. We remove `D` from the surface, in the paper's words, +and show that what is left is the +surface again. A larger disc `B` around `D` has no further nodes (`exists_ring_sub`). Now `closure +(B \ D)` is a closed disc with boundary +`K ∪ G`, and `B` has a closed disc with boundary `K ∪ E` for a line `E` from an end of `A` to a +point `n'` of `A` and on to the other +end. So we can map one disc onto the other, fixing `K` and moving `n` to `n'` (`exists_disc_map`), +and this gives the new painting +(`indented_of_disc`). The rest of `B` is two discs `T₁`, `T₂` along `A`. They are the two new cells. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology Metric GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +private theorem indent_forbidden_set_meets_disc_at_boundary_arc + {S : Type} + [TopologicalSpace S] + (Γ : Painting S) + {D : Set S} + {A : Set S} + {n : S} + {n₁ : S} + {n₂ : S} + (hA : IsLineWithEnds A n₁ n₂) + (hDb : D ∩ bd S = A) + (hDN : D ∩ Γ.N = {n₁, n₂, n}) + (hAD : A ⊆ D) + (hAb : A ⊆ bd S) + (hn₂ : n₂ ≠ n) : + (Γ.N \ {n} ∪ bd S) ∩ D = A := by + ext x + constructor + · rintro ⟨(⟨hx, hxn⟩ | hx), hxD⟩ + · have h3 : x ∈ D ∩ Γ.N := ⟨hxD, hx⟩ + rw [hDN] at h3 + rcases h3 with rfl | rfl | h3 + · exact hA.left_mem + · exact hA.right_mem + · exact absurd h3 hxn + · exact hDb ▸ ⟨hxD, hx⟩ + · intro hx + exact ⟨.inr (hAb hx), hAD hx⟩ + +private theorem difference_disc_boundary_arcs + {S : Type} + [TopologicalSpace S] + {D : Set S} + {A : Set S} + {G : Set S} + {n₁ : S} + {n₂ : S} + (hbD : discBd D = A ∪ G) + (B : Set S) + (K : Set S) + (hK : IsLineWithEnds K n₁ n₂) + (hAK : A ∪ K = discBd B) + (hKnotA : ∀ {x : S}, x ∈ K → x ∈ A → x = n₁ ∨ x = n₂) + (hGnotA : ∀ {x : S}, x ∈ G → x ∈ A → x = n₁ ∨ x = n₂) + (Q : Set S) + (hbQ : discBd Q = (discBd D ∪ discBd B) \ (A \ {n₁, n₂})) + (hxA : ∀ {x : S}, x ∉ A \ {n₁, n₂} → x ∈ A → x = n₁ ∨ x = n₂) : + discBd Q = K ∪ G := by + rw [hbQ, hbD, ← hAK] + ext x + constructor + · rintro ⟨((h | h) | (h | h)), hx⟩ + · rcases hxA hx h with rfl | rfl + · exact .inl hK.left_mem + · exact .inl hK.right_mem + · exact .inr h + · rcases hxA hx h with rfl | rfl + · exact .inl hK.left_mem + · exact .inl hK.right_mem + · exact .inl h + · rintro (h | h) + · exact ⟨.inr (.inr h), fun h3 => h3.2 (hKnotA h h3.1)⟩ + · exact ⟨.inl (.inr h), fun h3 => h3.2 (hGnotA h h3.1)⟩ + +private theorem difference_disc_intersects_at_inner_arc + {S : Type} + [TopologicalSpace S] + {D : Set S} + {A : Set S} + {G : Set S} + {n₁ : S} + {n₂ : S} + (hG : IsLineWithEnds G n₁ n₂) + (hbD : discBd D = A ∪ G) + (hGnotA : ∀ {x : S}, x ∈ G → x ∈ A → x = n₁ ∨ x = n₂) + (Q : Set S) + (hQD : Q ∩ D = discBd D \ (A \ {n₁, n₂})) + (hxA : ∀ {x : S}, x ∉ A \ {n₁, n₂} → x ∈ A → x = n₁ ∨ x = n₂) : + Q ∩ D = G := by + rw [hQD, hbD] + ext x + constructor + · rintro ⟨(h | h), hx⟩ + · rcases hxA hx h with rfl | rfl + · exact hG.left_mem + · exact hG.right_mem + · exact h + · intro h + exact ⟨.inr h, fun h3 => h3.2 (hGnotA h h3.1)⟩ + +private theorem first_cut_meets_outer_arc_at_left_end + {S : Type} + [TopologicalSpace S] + {A : Set S} + {n₁ : S} + {n₂ : S} + {n' : S} + (hn'A : n' ∈ A \ {n₁, n₂}) + (B : Set S) + (K : Set S) + (hK : IsLineWithEnds K n₁ n₂) + (hKdB : K ⊆ discBd B) + (hKnotA : ∀ {x : S}, x ∈ K → x ∈ A → x = n₁ ∨ x = n₂) + (hn'1 : n' ≠ n₁) + (hn'2 : n' ≠ n₂) + (E₁ : Set S) + (hE₁ : IsLineWithEnds E₁ n₁ n') + (hE₁b : E₁ ∩ discBd B = {n₁, n'}) : + E₁ ∩ K = {n₁} := by + refine Subset.antisymm (fun x hx => ?_) ?_ + · have h3 : x ∈ E₁ ∩ discBd B := ⟨hx.1, hKdB hx.2⟩ + rw [hE₁b] at h3 + rcases h3 with rfl | rfl + · rfl + · rcases hKnotA hx.2 hn'A.1 with h | h + · exact absurd h hn'1 + · exact absurd h hn'2 + · rintro x rfl + exact ⟨hE₁.left_mem, hK.left_mem⟩ + +private theorem remaining_disc_boundary_is_second_arc_and_cut + {S : Type} + [TopologicalSpace S] + (K : Set S) + (A₂ : Set S) + (E₁ : Set S) + (R₁ : Set S) + (hbR₁ : discBd R₁ = K ∪ A₂ ∪ E₁) : + A₂ ∪ (E₁ ∪ K) = discBd R₁ := by + rw [hbR₁] + ext x + simp only [mem_union] + tauto + +private theorem second_boundary_arcs_meet_at_ends + {S : Type} + [TopologicalSpace S] + {A : Set S} + {n₁ : S} + {n₂ : S} + {n' : S} + (B : Set S) + (hAdB : A ⊆ discBd B) + (K : Set S) + (hK : IsLineWithEnds K n₁ n₂) + (hn'1 : n' ≠ n₁) + (A₁ : Set S) + (A₂ : Set S) + (hA₁ : IsLineWithEnds A₁ n₁ n') + (hA₂ : IsLineWithEnds A₂ n' n₂) + (hAi : A₁ ∩ A₂ = {n'}) + (hA₂A : A₂ ⊆ A) + (hKA₂ : K ∩ A₂ = {n₂}) + (E₁ : Set S) + (hE₁ : IsLineWithEnds E₁ n₁ n') + (hE₁b : E₁ ∩ discBd B = {n₁, n'}) : + A₂ ∩ (E₁ ∪ K) = {n', n₂} := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨hx, (h | h)⟩ + · have h3 : x ∈ E₁ ∩ discBd B := ⟨h, hAdB (hA₂A hx)⟩ + rw [hE₁b] at h3 + rcases h3 with rfl | rfl + · exact absurd (show x ∈ A₁ ∩ A₂ from ⟨hA₁.left_mem, hx⟩) (by rw [hAi]; exact hn'1.symm) + · exact .inl rfl + · exact .inr (hKA₂ ▸ ⟨h, hx⟩ : x ∈ ({n₂} : Set S)) + · rintro x (rfl | rfl) + · exact ⟨hA₂.left_mem, .inl hE₁.right_mem⟩ + · exact ⟨hA₂.right_mem, .inr hK.right_mem⟩ + +private theorem cuts_meet_at_new_boundary_node + {S : Type} + [TopologicalSpace S] + {n₁ : S} + {n₂ : S} + {n' : S} + (E₁ : Set S) + (R₁ : Set S) + (hE₁ : IsLineWithEnds E₁ n₁ n') + (hn₂E₁ : n₂ ∉ E₁) + (E₂ : Set S) + (hE₂ : IsLineWithEnds E₂ n' n₂) + (hE₂b : E₂ ∩ discBd R₁ = {n', n₂}) + (hE₁dR : E₁ ⊆ discBd R₁) : + E₁ ∩ E₂ = {n'} := by + refine Subset.antisymm (fun x hx => ?_) ?_ + · have h3 : x ∈ E₂ ∩ discBd R₁ := ⟨hx.2, hE₁dR hx.1⟩ + rw [hE₂b] at h3 + rcases h3 with rfl | rfl + · rfl + · exact absurd hx.1 hn₂E₁ + · rintro x rfl + exact ⟨hE₁.right_mem, hE₂.left_mem⟩ + +private theorem combined_cut_meets_outer_arc_at_ends + {S : Type} + [TopologicalSpace S] + {A : Set S} + {n₁ : S} + {n₂ : S} + {n' : S} + (hn'A : n' ∈ A \ {n₁, n₂}) + (K : Set S) + (hK : IsLineWithEnds K n₁ n₂) + (hKnotA : ∀ {x : S}, x ∈ K → x ∈ A → x = n₁ ∨ x = n₂) + (hn'1 : n' ≠ n₁) + (hn'2 : n' ≠ n₂) + (E₁ : Set S) + (R₁ : Set S) + (hE₁ : IsLineWithEnds E₁ n₁ n') + (hKE₁ : E₁ ∩ K = {n₁}) + (E₂ : Set S) + (hE₂ : IsLineWithEnds E₂ n' n₂) + (hE₂b : E₂ ∩ discBd R₁ = {n', n₂}) + (hKdR : K ⊆ discBd R₁) + (hE : IsLineWithEnds (E₁ ∪ E₂) n₁ n₂) : + K ∩ (E₁ ∪ E₂) = {n₁, n₂} := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨hx, (h | h)⟩ + · exact .inl (hKE₁ ▸ ⟨h, hx⟩ : x ∈ ({n₁} : Set S)) + · have h3 : x ∈ E₂ ∩ discBd R₁ := ⟨h, hKdR hx⟩ + rw [hE₂b] at h3 + rcases h3 with rfl | rfl + · rcases hKnotA hx hn'A.1 with h4 | h4 + · exact absurd h4 hn'1 + · exact absurd h4 hn'2 + · exact .inr rfl + · rintro x (rfl | rfl) + · exact ⟨hK.left_mem, .inl hE₁.left_mem⟩ + · exact ⟨hK.right_mem, .inr hE₂.right_mem⟩ + +private theorem indent_map_continuous_on_patch + {S : Type} + [TopologicalSpace S] + [T2Space S] + (B : Set S) + (K : Set S) + (Q : Set S) + (hQ : IsClosedDisc Q) + (hQB : Q ⊆ B) + (f : S → S) + (hfc : ContinuousOn f Q) + (hfK : ∀ x ∈ K, f x = x) + (hclB : ∀ x ∈ closure Bᶜ, x ∈ B → x ∈ K) + (hWU : (Q ∪ Bᶜ) = Q ∪ closure Bᶜ) + (φ : S → S) + (hφQ : ∀ x ∈ Q, φ x = f x) + (hφO : ∀ x ∉ Q, φ x = x) : + ContinuousOn φ (Q ∪ Bᶜ) := by + rw [hWU] + refine ContinuousOn.union_of_isClosed (hfc.congr hφQ) (continuousOn_id.congr fun x hx + => ?_) hQ.isClosed isClosed_closure + by_cases h : x ∈ Q + · by_cases hxB : x ∈ B + · rw [hφQ x h, hfK x (hclB x hx hxB)] + rfl + · exact absurd (hQB h) hxB + · exact hφO x h + +private theorem indent_map_injective_on_patch + {S : Type} + (B : Set S) + (Q : Set S) + (hQB : Q ⊆ B) + (Q' : Set S) + (f : S → S) + (hfi : InjOn f Q) + (hQ'B : Q' ⊆ B) + (φ : S → S) + (hφQ : ∀ x ∈ Q, φ x = f x) + (hφO : ∀ x ∉ Q, φ x = x) + (hfm : ∀ {x : S}, x ∈ Q → f x ∈ Q') : + InjOn φ (Q ∪ Bᶜ) := by + rintro x (hx | hx) y (hy | hy) hxy + · rw [hφQ x hx, hφQ y hy] at hxy + exact hfi hx hy hxy + · rw [hφQ x hx, hφO y fun h => hy (hQB h)] at hxy + exact absurd (hQ'B (hxy ▸ hfm hx)) hy + · rw [hφQ y hy, hφO x fun h => hx (hQB h)] at hxy + exact absurd (hQ'B (hxy.symm ▸ hfm hy)) hx + · rwa [hφO x fun h => hx (hQB h), hφO y fun h => hy (hQB h)] at hxy + +private theorem indent_discs_intersect_at_new_boundary_node + {S : Type} + [TopologicalSpace S] + {n₁ : S} + {n₂ : S} + {n' : S} + (A₁ : Set S) + (A₂ : Set S) + (hA₁ : IsLineWithEnds A₁ n₁ n') + (hA₂ : IsLineWithEnds A₂ n' n₂) + (E₁ : Set S) + (T₁ : Set S) + (R₁ : Set S) + (hiB₁ : T₁ ∩ R₁ = E₁) + (E₂ : Set S) + (T₂ : Set S) + (Q' : Set S) + (hiR₂ : T₂ ∩ Q' = E₂) + (hE₁Q' : E₁ ⊆ Q') + (hE₁₂ : E₁ ∩ E₂ = {n'}) + (hT₂R : T₂ ⊆ R₁) + (hA₁T : A₁ ⊆ T₁) + (hA₂T : A₂ ⊆ T₂) : + T₁ ∩ T₂ = {n'} := by + refine Subset.antisymm (fun x hx => ?_) ?_ + · have h3 : x ∈ E₁ := hiB₁ ▸ ⟨hx.1, hT₂R hx.2⟩ + have h4 : x ∈ E₂ := hiR₂ ▸ ⟨hx.2, hE₁Q' h3⟩ + exact hE₁₂ ▸ ⟨h3, h4⟩ + · rintro x rfl + exact ⟨hA₁T hA₁.right_mem, hA₂T hA₂.left_mem⟩ + +private theorem first_indent_disc_surface_boundary + {S : Type} + [TopologicalSpace S] + {A : Set S} + {n₁ : S} + {n' : S} + (hAb : A ⊆ bd S) + (B : Set S) + (A₁ : Set S) + (A₂ : Set S) + (hA₁ : IsLineWithEnds A₁ n₁ n') + (hAu : A₁ ∪ A₂ = A) + (hA₁A : A₁ ⊆ A) + (T₁ : Set S) + (T₂ : Set S) + (hT₁B : T₁ ⊆ B) + (hA₁T : A₁ ⊆ T₁) + (hA₂T : A₂ ⊆ T₂) + (hT : T₁ ∩ T₂ = {n'}) + (hB_A : ∀ {x : S}, x ∈ B → x ∈ bd S → x ∈ A) : + T₁ ∩ bd S = A₁ := by + refine Subset.antisymm (fun x hx => ?_) fun x hx => ⟨hA₁T hx, hAb (hA₁A hx)⟩ + have h3 : x ∈ A₁ ∪ A₂ := hAu ▸ hB_A (hT₁B hx.1) hx.2 + rcases h3 with h3 | h3 + · exact h3 + · have h4 : x = n' := hT.subset ⟨hx.1, hA₂T h3⟩ + exact h4 ▸ hA₁.right_mem + +private theorem second_indent_disc_surface_boundary + {S : Type} + [TopologicalSpace S] + {A : Set S} + {n₂ : S} + {n' : S} + (hAb : A ⊆ bd S) + (B : Set S) + (A₁ : Set S) + (A₂ : Set S) + (hA₂ : IsLineWithEnds A₂ n' n₂) + (hAu : A₁ ∪ A₂ = A) + (hA₂A : A₂ ⊆ A) + (T₁ : Set S) + (R₁ : Set S) + (T₂ : Set S) + (hR₁B : R₁ ⊆ B) + (hT₂R : T₂ ⊆ R₁) + (hA₁T : A₁ ⊆ T₁) + (hA₂T : A₂ ⊆ T₂) + (hT : T₁ ∩ T₂ = {n'}) + (hB_A : ∀ {x : S}, x ∈ B → x ∈ bd S → x ∈ A) : + T₂ ∩ bd S = A₂ := by + refine Subset.antisymm (fun x hx => ?_) fun x hx => ⟨hA₂T hx, hAb (hA₂A hx)⟩ + have h3 : x ∈ A₁ ∪ A₂ := hAu ▸ hB_A (hR₁B (hT₂R hx.1)) hx.2 + rcases h3 with h3 | h3 + · have h4 : x = n' := hT.subset ⟨hA₁T h3, hx.1⟩ + exact h4 ▸ hA₂.left_mem + · exact h3 + +private theorem indent_painting_from_push_maps + {S : Type} + [TopologicalSpace S] + (Γ : Painting S) + {D : Set S} + {A : Set S} + {G : Set S} + {Θ : Set S} + {c₀ : Set S} + {n : S} + {n₁ : S} + {n₂ : S} + {n' : S} + {R : Set (Set S)} + (hD : IsClosedDisc D) + (hDN : D ∩ Γ.N = {n₁, n₂, n}) + (hnG : n ∈ G \ {n₁, n₂}) + (hnb : n ∉ bd S) + (hn'A : n' ∈ A \ {n₁, n₂}) + (hn'c : n' ∈ c₀ ∩ Θ) + (hAΘ : A ⊆ Θ) + (hRsub : ∀ c ∈ Γ.C, c ∈ R → c ⊆ D) + (hRd : ∀ c ∈ Γ.C, c ∉ R → Disjoint c D) + [T2Space S] + [CompactSpace S] + (hAD : A ⊆ D) + (hGD : G ⊆ D) + (hAb : A ⊆ bd S) + (hn₁N : n₁ ∈ Γ.N) + (hn₂N : n₂ ∈ Γ.N) + (hnN : n ∈ Γ.N) + (hn₁ : n₁ ≠ n) + (hn₂ : n₂ ≠ n) + (B : Set S) + (hDB : D ⊆ B) + (hBZ : B ∩ (Γ.N \ {n} ∪ bd S) = A) + (K : Set S) + (hK : IsLineWithEnds K n₁ n₂) + (Q : Set S) + (hQB : Q ⊆ B) + (hBU : ∀ {x : S}, x ∈ B → x ∈ Q ∨ x ∈ D) + (hKQ : K ⊆ Q) + (hGQ : G ⊆ Q) + (hn'1 : n' ≠ n₁) + (hn'2 : n' ≠ n₂) + (A₁ : Set S) + (A₂ : Set S) + (hA₁ : IsLineWithEnds A₁ n₁ n') + (hA₂ : IsLineWithEnds A₂ n' n₂) + (hAu : A₁ ∪ A₂ = A) + (hA₁A : A₁ ⊆ A) + (hA₂A : A₂ ⊆ A) + (E₁ : Set S) + (T₁ : Set S) + (R₁ : Set S) + (hT₁ : IsClosedDisc T₁) + (hiB₁ : T₁ ∩ R₁ = E₁) + (hbT₁ : discBd T₁ = A₁ ∪ E₁) + (E₂ : Set S) + (T₂ : Set S) + (Q' : Set S) + (hT₂ : IsClosedDisc T₂) + (hiR₂ : T₂ ∩ Q' = E₂) + (hbT₂ : discBd T₂ = A₂ ∪ E₂) + (f : S → S) + (hfi : InjOn f Q) + (hfK : ∀ x ∈ K, f x = x) + (hfn : f n = n') + (hfG : f '' G = E₁ ∪ E₂) + (hR₁B : R₁ ⊆ B) + (hT₁B : T₁ ⊆ B) + (hQ'R : Q' ⊆ R₁) + (hT₂R : T₂ ⊆ R₁) + (hQ'B : Q' ⊆ B) + (W : Set S) + (hW : W = Q ∪ Bᶜ) + (hWc : IsClosed W) + (φ : S → S) + (hφQ : ∀ x ∈ Q, φ x = f x) + (hφO : ∀ x ∉ Q, φ x = x) + (hφc : ContinuousOn φ W) + (hfm : ∀ {x : S}, x ∈ Q → f x ∈ Q') + (hφi : InjOn φ W) + (hA₁T : A₁ ⊆ T₁) + (hA₂T : A₂ ⊆ T₂) + (hT : T₁ ∩ T₂ = {n'}) + (hB_A : ∀ {x : S}, x ∈ B → x ∈ bd S → x ∈ A) + (hb₁ : T₁ ∩ bd S = A₁) + (hb₂ : T₂ ∩ bd S = A₂) : + ∃ Γ', IsIndentedBorderPainting Γ Θ c₀ n₁ n₂ n R Γ' := by + subst W + let Z := Γ.N \ {n} ∪ bd S + have hBN : ∀ {x}, x ∈ B → x ∈ Γ.N \ {n} → x = n₁ ∨ x = n₂ := fun {x} hx hxN => by + have h3 : x ∈ A := hBZ ▸ (⟨hx, .inl hxN⟩ : x ∈ B ∩ Z) + have h4 : x ∈ D ∩ Γ.N := ⟨hAD h3, hxN.1⟩ + rw [hDN] at h4 + rcases h4 with h4 | h4 | h4 + · exact .inl h4 + · exact .inr h4 + · exact absurd h4 hxN.2 + have hfiber : ∀ {y}, y ∈ Q → y ∉ D → f y ∉ E₁ ∪ E₂ := fun {y} hy hyD hm => by + obtain ⟨g, hg, hgy⟩ := hfG.symm.subset hm + exact hyD (hfi (hGQ hg) hy hgy ▸ hGD hg) + have hoff : ∀ y, y ∉ D → φ y ∉ T₁ ∧ φ y ∉ T₂ := fun y hyD => by + by_cases hy : y ∈ Q + · rw [hφQ y hy] + refine ⟨fun h => hfiber hy hyD (.inl (hiB₁ ▸ ⟨h, hQ'R (hfm hy)⟩)), + fun h => hfiber hy hyD (.inr (hiR₂ ▸ ⟨h, hfm hy⟩))⟩ + · rw [hφO y hy] + have hyB : y ∉ B := fun h => (hBU h).elim hy hyD + exact ⟨fun h => hyB (hT₁B h), fun h => hyB (hR₁B (hT₂R h))⟩ + refine indented_of_push Γ (W := Q ∪ Bᶜ) (D := D) (T₁ := T₁) (T₂ := T₂) (A₁ := A₁) (A₂ := A₂) (φ + := φ) + (n' := n') hWc hD.isClosed + (fun x hx => ?_) hφc hφi hnN (.inl (hGQ hnG.1)) hn₁N hn₂N hn₁ hn₂ ?_ ((hφQ n + (hGQ hnG.1)).trans hfn) hnb ?_ hn'c + hRsub hRd hT₁ hT₂ hA₁ hA₂.symm (fun x hx => hbT₁ ▸ .inl hx) (fun x hx + => hbT₂ ▸ .inl hx) hb₁ hb₂ (hA₁A.trans hAΘ) (hA₂A.trans hAΘ) hT + ?_ ?_ hoff ?_ ?_ + · by_cases h : x ∈ B + · exact .inl ((hBU h).resolve_right hx) + · exact .inr h + · intro x hx hxn + by_cases hxB : x ∈ B + · have hxK : x ∈ K := by + rcases hBN hxB ⟨hx, hxn⟩ with rfl | rfl + · exact hK.left_mem + · exact hK.right_mem + exact ⟨.inl (hKQ hxK), (hφQ x (hKQ hxK)).trans (hfK x hxK)⟩ + · exact ⟨.inr hxB, hφO x fun h => hxB (hQB h)⟩ + · intro h + have h3 : n' ∈ D ∩ Γ.N := ⟨hAD hn'A.1, h⟩ + rw [hDN] at h3 + rcases h3 with h3 | h3 | h3 + · exact hn'1 h3 + · exact hn'2 h3 + · exact hnb (h3 ▸ hAb hn'A.1) + · rintro x ⟨hx, hxN⟩ + rcases hBN (hT₁B hx) hxN with h | h + · exact h + · subst h + have h4 : x = n' := hT.subset ⟨hx, hA₂T hA₂.right_mem⟩ + exact absurd h4.symm hn'2 + · rintro x ⟨hx, hxN⟩ + rcases hBN (hR₁B (hT₂R hx)) hxN with h | h + · subst h + have h4 : x = n' := hT.subset ⟨hA₁T hA₁.left_mem, hx⟩ + exact absurd h4.symm hn'1 + · exact h + · intro y hyD hb + by_cases hy : y ∈ Q + · exfalso + rcases hb with hb | hb + · exact hyD (hAD (hB_A (hQB hy) hb)) + · rw [hφQ y hy] at hb + have h3 := hB_A (hQ'B (hfm hy)) hb + have h4 := hoff y hyD + rw [hφQ y hy] at h4 + rw [← hAu] at h3 + rcases h3 with h3 | h3 + · exact h4.1 (hA₁T h3) + · exact h4.2 (hA₂T h3) + · exact hφO y hy + · intro x hx + by_cases hxB : x ∈ B + · have h3 : x ∈ A₁ ∪ A₂ := hAu ▸ hB_A hxB hx + rcases h3 with h3 | h3 + · exact .inl (hA₁T h3) + · exact .inr (.inl (hA₂T h3)) + · exact .inr (.inr ⟨fun h => hxB (hDB h), hφO x fun h => hxB (hQB h)⟩) + +private theorem first_boundary_arcs_meet_at_ends + {S : Type} + [TopologicalSpace S] + {A : Set S} + {n₁ : S} + {n₂ : S} + {n' : S} + (K : Set S) + (hK : IsLineWithEnds K n₁ n₂) + (hKnotA : ∀ {x : S}, x ∈ K → x ∈ A → x = n₁ ∨ x = n₂) + (hn'2 : n' ≠ n₂) + (A₁ : Set S) + (A₂ : Set S) + (hA₁ : IsLineWithEnds A₁ n₁ n') + (hA₂ : IsLineWithEnds A₂ n' n₂) + (hAi : A₁ ∩ A₂ = {n'}) + (hA₁A : A₁ ⊆ A) : + A₁ ∩ (K ∪ A₂) = {n₁, n'} := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨hx, (h | h)⟩ + · rcases hKnotA h (hA₁A hx) with rfl | rfl + · exact .inl rfl + · exact absurd (show x ∈ A₁ ∩ A₂ from ⟨hx, hA₂.right_mem⟩) (by rw [hAi]; exact hn'2.symm) + · exact .inr (hAi ▸ ⟨hx, h⟩ : x ∈ ({n'} : Set S)) + · rintro x (rfl | rfl) + · exact ⟨hA₁.left_mem, .inl hK.left_mem⟩ + · exact ⟨hA₁.right_mem, .inr hA₂.left_mem⟩ + +theorem indented_of_disc [ConnectedSpace S] (hS : IsSurface S) (Γ : Painting S) {D A G Θ c₀ : Set + S} {n n₁ n₂ n' : S} {R : Set (Set S)} + (hD : IsClosedDisc D) (hA : IsLineWithEnds A n₁ n₂) (hG : IsLineWithEnds G n₁ n₂) + (hbD : discBd D = A ∪ G) (hAG : A ∩ G = {n₁, n₂}) + (hDb : D ∩ bd S = A) (hDN : D ∩ Γ.N = {n₁, n₂, n}) (hnG : n ∈ G \ {n₁, n₂}) (hnb : n ∉ bd S) + (hn'A : n' ∈ A \ {n₁, n₂}) + (hn'c : n' ∈ c₀ ∩ Θ) (hAΘ : A ⊆ Θ) + (hRsub : ∀ c ∈ Γ.C, c ∈ R → c ⊆ D) (hRd : ∀ c ∈ Γ.C, c ∉ R → Disjoint c D) : + ∃ Γ' : Painting S, IsIndentedBorderPainting Γ Θ c₀ n₁ n₂ n R Γ' := by + classical + have ht2 : T2Space S := hS.2.1 + have hcS : CompactSpace S := hS.1 + have hne : n₁ ≠ n₂ := hA.ne' + have hAD : A ⊆ D := fun x hx => discBd_subset _ (hbD ▸ .inl hx) + have hGD : G ⊆ D := fun x hx => discBd_subset _ (hbD ▸ .inr hx) + have hAb : A ⊆ bd S := fun x hx => (hDb ▸ hx : x ∈ D ∩ bd S).2 + have hnodes : ∀ {x}, x ∈ ({n₁, n₂, n} : Set S) → x ∈ D ∧ x ∈ Γ.N := fun hx => hDN.symm.subset hx + have hn₁N : n₁ ∈ Γ.N := (hnodes (.inl rfl)).2 + have hn₂N : n₂ ∈ Γ.N := (hnodes (.inr (.inl rfl))).2 + have hnN : n ∈ Γ.N := (hnodes (.inr (.inr rfl))).2 + have hn₁ : n₁ ≠ n := fun h => hnG.2 (.inl h.symm) + have hn₂ : n₂ ≠ n := fun h => hnG.2 (.inr h.symm) + let Z : Set S := (Γ.N \ {n}) ∪ bd S + have hZc : IsClosed Z := (Γ.finite_N.subset sdiff_subset).isClosed.union (isClosed_bd S) + have hZD : Z ∩ D = A := by + exact indent_forbidden_set_meets_disc_at_boundary_arc (S := S) Γ (D := D) (A := A) (n := n) + (n₁ := n₁) (n₂ := n₂) hA hDb hDN hAD hAb hn₂ + obtain ⟨B, hB, hDB, hBZ, hbB, hBb⟩ := exists_ring_sub hS hD hZc + (by rw [hZD, hbD]; exact subset_union_left) (fun x hx => .inr hx.2) + rw [inter_comm D Z, hZD] at hBZ hbB + rw [hDb] at hBb + have hAdB : A ⊆ discBd B := fun x hx => by + have h3 : x ∈ A := hx + rw [← hbB] at h3 + exact h3.1 + have hbI : discBd D ∩ discBd B = A := by + refine Subset.antisymm (fun x hx => ?_) fun x hx => ⟨hbD ▸ .inl hx, hAdB hx⟩ + exact hbB ▸ (⟨hx.2, discBd_subset _ hx.1⟩ : x ∈ discBd B ∩ D) + obtain ⟨K, hK, hAK, hAK'⟩ := oarc_split hB.isOArc_discBd hA hAdB + have hKdB : K ⊆ discBd B := fun x hx => hAK ▸ .inr hx + have hKnotA : ∀ {x}, x ∈ K → x ∈ A → x = n₁ ∨ x = n₂ := fun {x} hx hx' => (hAK' ▸ ⟨hx', hx⟩ : x ∈ + ({n₁, n₂} : Set S)) + have hGnotA : ∀ {x}, x ∈ G → x ∈ A → x = n₁ ∨ x = n₂ := fun {x} hx hx' => (hAG ▸ ⟨hx', hx⟩ : x ∈ + ({n₁, n₂} : Set S)) + obtain ⟨hQ, hbQ, hQD⟩ := disc_difference D B A n₁ n₂ hD hB hDB hA hbI + set Q := closure (B \ D) with hQdef + have hQB : Q ⊆ B := closure_minimal sdiff_subset hB.isClosed + have hBU : ∀ {x}, x ∈ B → x ∈ Q ∨ x ∈ D := fun {x} hx => by + by_cases h : x ∈ D + · exact .inr h + · exact .inl (subset_closure ⟨hx, h⟩) + have hxA : ∀ {x}, x ∉ A \ {n₁, n₂} → x ∈ A → x = n₁ ∨ x = n₂ := fun hx h3 => by_contra fun h4 + => hx ⟨h3, h4⟩ + have hbQK : discBd Q = K ∪ G := by + exact difference_disc_boundary_arcs (S := S) (D := D) (A := A) (G := G) (n₁ := n₁) (n₂ := n₂) + hbD B K hK hAK hKnotA hGnotA Q hbQ hxA + have hQDG : Q ∩ D = G := by + exact difference_disc_intersects_at_inner_arc (S := S) (D := D) (A := A) (G := G) (n₁ := n₁) + (n₂ := n₂) hG hbD hGnotA Q hQD hxA + have hKQ : K ⊆ Q := fun x hx => discBd_subset _ (hbQK ▸ .inl hx) + have hGQ : G ⊆ Q := fun x hx => discBd_subset _ (hbQK ▸ .inr hx) + -- The cells along `A`, and the disc `Q'`. + have hn'1 : n' ≠ n₁ := fun h => hn'A.2 (.inl h) + have hn'2 : n' ≠ n₂ := fun h => hn'A.2 (.inr h) + obtain ⟨A₁, A₂, hA₁, hA₂, hAu, hAi⟩ := hA.split hn'A.1 hn'1 hn'2 + have hA₁A : A₁ ⊆ A := hAu ▸ subset_union_left + have hA₂A : A₂ ⊆ A := hAu ▸ subset_union_right + have hKA₂ : K ∩ A₂ = {n₂} := by + refine Subset.antisymm (fun x hx => ?_) ?_ + · rcases hKnotA hx.1 (hA₂A hx.2) with rfl | rfl + · have h3 : x ∈ A₁ ∩ A₂ := ⟨hA₁.left_mem, hx.2⟩ + rw [hAi] at h3 + exact absurd h3.symm hn'1 + · rfl + · rintro x rfl + exact ⟨hK.right_mem, hA₂.right_mem⟩ + have hC₁ : IsLineWithEnds (K ∪ A₂) n₁ n' := hK.union hA₂.symm hKA₂ + have hsplitB : A₁ ∪ (K ∪ A₂) = discBd B := by + rw [← hAK, ← hAu] + ext x + simp only [mem_union] + tauto + have hiB : A₁ ∩ (K ∪ A₂) = {n₁, n'} := by + exact first_boundary_arcs_meet_at_ends (S := S) (A := A) (n₁ := n₁) (n₂ := n₂) (n' := n') + K hK hKnotA hn'2 A₁ A₂ hA₁ hA₂ hAi hA₁A + obtain ⟨E₁, T₁, R₁, hE₁, hE₁b, hE₁B, hT₁, hR₁, huB, hiB₁, hbT₁, hbR₁⟩ + := split_disc hB hA₁ hC₁ hn'1.symm hsplitB hiB + have hKE₁ : E₁ ∩ K = {n₁} := by + exact first_cut_meets_outer_arc_at_left_end (S := S) (A := A) (n₁ := n₁) (n₂ := n₂) + (n' := n') hn'A B K hK hKdB hKnotA hn'1 hn'2 E₁ hE₁ hE₁b + have hC₂ : IsLineWithEnds (E₁ ∪ K) n' n₂ := hE₁.symm.union hK hKE₁ + have hbR : A₂ ∪ (E₁ ∪ K) = discBd R₁ := by + exact remaining_disc_boundary_is_second_arc_and_cut (S := S) K A₂ E₁ R₁ hbR₁ + have hn₂E₁ : n₂ ∉ E₁ := fun h => by + have h3 : n₂ ∈ E₁ ∩ discBd B := ⟨h, hKdB hK.right_mem⟩ + rw [hE₁b] at h3 + rcases h3 with h3 | h3 + · exact hne h3.symm + · exact hn'2 h3.symm + have hiR : A₂ ∩ (E₁ ∪ K) = {n', n₂} := by + exact second_boundary_arcs_meet_at_ends (S := S) (A := A) (n₁ := n₁) (n₂ := n₂) (n' + := n') B hAdB K hK hn'1 A₁ A₂ hA₁ hA₂ hAi hA₂A hKA₂ E₁ hE₁ hE₁b + obtain ⟨E₂, T₂, Q', hE₂, hE₂b, hE₂R, hT₂, hQ', huR, hiR₂, hbT₂, hbQ'⟩ + := split_disc hR₁ hA₂ hC₂ hn'2 hbR hiR + have hE₁Q' : E₁ ⊆ Q' := fun x hx => discBd_subset _ (hbQ' ▸ .inl (.inl hx)) + have hE₁dR : E₁ ⊆ discBd R₁ := fun x hx => hbR₁ ▸ .inr hx + have hKdR : K ⊆ discBd R₁ := fun x hx => hbR₁ ▸ .inl (.inl hx) + have hE₁₂ : E₁ ∩ E₂ = {n'} := by + exact cuts_meet_at_new_boundary_node (S := S) (n₁ := n₁) (n₂ := n₂) (n' := n') E₁ R₁ hE₁ hn₂E₁ + E₂ hE₂ hE₂b hE₁dR + have hE : IsLineWithEnds (E₁ ∪ E₂) n₁ n₂ := hE₁.union hE₂ hE₁₂ + have hbQE : discBd Q' = K ∪ (E₁ ∪ E₂) := by + rw [hbQ'] + ext x + simp only [mem_union] + tauto + have hKE : K ∩ (E₁ ∪ E₂) = {n₁, n₂} := by + exact combined_cut_meets_outer_arc_at_ends (S := S) (A := A) (n₁ := n₁) (n₂ := n₂) + (n' := n') hn'A K hK hKnotA hn'1 hn'2 E₁ R₁ hE₁ hKE₁ E₂ hE₂ hE₂b hKdR hE + have hn'E : n' ∈ (E₁ ∪ E₂) \ {n₁, n₂} := by + refine ⟨.inl hE₁.right_mem, ?_⟩ + rintro (h | h) + · exact hn'1 h + · exact hn'2 h + obtain ⟨f, hfc, hfi, hfQ, hfK, hfn, hfG⟩ := exists_disc_map hQ hQ' hK hG hE hbQK hbQE (by + refine Subset.antisymm (fun x hx => ?_) ?_ + · have h3 : x ∈ Q ∩ D := ⟨hKQ hx.1, hGD hx.2⟩ + have h4 : x ∈ discBd B ∩ D := ⟨hKdB hx.1, h3.2⟩ + rw [hbB] at h4 + exact hKnotA hx.1 h4 + · rintro x (rfl | rfl) + · exact ⟨hK.left_mem, hG.left_mem⟩ + · exact ⟨hK.right_mem, hG.right_mem⟩) hKE hnG hn'E + have hR₁B : R₁ ⊆ B := huB ▸ subset_union_right + have hT₁B : T₁ ⊆ B := huB ▸ subset_union_left + have hQ'R : Q' ⊆ R₁ := huR ▸ subset_union_right + have hT₂R : T₂ ⊆ R₁ := huR ▸ subset_union_left + have hQ'B : Q' ⊆ B := hQ'R.trans hR₁B + have hKb : K ∩ bd S = {n₁, n₂} := by + refine Subset.antisymm (fun x hx => ?_) ?_ + · have h3 : x ∈ B ∩ bd S := ⟨discBd_subset _ (hKdB hx.1), hx.2⟩ + rw [hBb] at h3 + exact hKnotA hx.1 h3 + · rintro x (rfl | rfl) + · exact ⟨hK.left_mem, hAb hA.left_mem⟩ + · exact ⟨hK.right_mem, hAb hA.right_mem⟩ + obtain ⟨-, -, -, -, -, -, -, -, -, -, -, hnbB⟩ := arc_disc_data hS hK hKb hB hKdB (fun x hx => by + rw [← hAK] at hx + rcases hx with h | h + · exact .inr (hAb h) + · exact .inl h) + have hclB : ∀ x, x ∈ closure Bᶜ → x ∈ B → x ∈ K := fun x hx hxB => by + by_contra h + obtain ⟨y, hy, hy'⟩ := mem_closure_iff_nhds.mp hx _ (hnbB x ⟨hxB, h⟩) + exact hy' hy + let W : Set S := Q ∪ Bᶜ + have hWU : W = Q ∪ closure Bᶜ := by + refine Subset.antisymm (union_subset_union_right _ subset_closure) + (union_subset subset_union_left fun x hx => ?_) + by_cases h : x ∈ B + · exact .inl (hKQ (hclB x hx h)) + · exact .inr h + have hWc : IsClosed W := by + rw [hWU] + exact hQ.isClosed.union isClosed_closure + let φ : S → S := fun x => if x ∈ Q then f x else x + have hφQ : ∀ x ∈ Q, φ x = f x := fun x hx => by simp only [φ, hx, ite_true] + have hφO : ∀ x, x ∉ Q → φ x = x := fun x hx => by simp only [φ, hx, ite_false] + have hφc : ContinuousOn φ W := by + exact indent_map_continuous_on_patch (S := S) B K Q hQ hQB f hfc hfK hclB hWU φ hφQ hφO + have hfm : ∀ {x}, x ∈ Q → f x ∈ Q' := fun hx => hfQ ▸ mem_image_of_mem f hx + have hφi : InjOn φ W := by + exact indent_map_injective_on_patch (S := S) B Q hQB Q' f hfi hQ'B φ hφQ hφO hfm + have hA₁T : A₁ ⊆ T₁ := fun x hx => discBd_subset _ (hbT₁ ▸ .inl hx) + have hA₂T : A₂ ⊆ T₂ := fun x hx => discBd_subset _ (hbT₂ ▸ .inl hx) + have hT : T₁ ∩ T₂ = {n'} := by + exact indent_discs_intersect_at_new_boundary_node (S := S) (n₁ := n₁) (n₂ := n₂) (n' + := n') A₁ A₂ hA₁ hA₂ E₁ T₁ R₁ hiB₁ E₂ T₂ Q' hiR₂ hE₁Q' hE₁₂ hT₂R hA₁T hA₂T + have hB_A : ∀ {x}, x ∈ B → x ∈ bd S → x ∈ A := fun {x} hx hb => (hBb ▸ ⟨hx, hb⟩ : x ∈ A) + have hb₁ : T₁ ∩ bd S = A₁ := by + exact first_indent_disc_surface_boundary (S := S) (A := A) (n₁ := n₁) (n' := n') hAb B A₁ A₂ + hA₁ hAu hA₁A T₁ T₂ hT₁B hA₁T hA₂T hT hB_A + have hb₂ : T₂ ∩ bd S = A₂ := by + exact second_indent_disc_surface_boundary (S := S) (A := A) (n₂ := n₂) (n' := n') hAb B A₁ A₂ + hA₂ hAu hA₂A T₁ R₁ T₂ hR₁B hT₂R hA₁T hA₂T hT hB_A + have hindented : ∃ Γ' : Painting S, IsIndentedBorderPainting Γ Θ c₀ n₁ n₂ n R Γ' := by + exact indent_painting_from_push_maps (S := S) Γ (D := D) (A := A) (G := G) (Θ := Θ) (c₀ := c₀) + (n := n) (n₁ := n₁) (n₂ := n₂) (n' := n') (R := R) hD hDN hnG hnb hn'A hn'c hAΘ hRsub hRd + hAD hGD hAb hn₁N hn₂N hnN hn₁ hn₂ B hDB hBZ K hK Q hQB hBU hKQ hGQ hn'1 hn'2 A₁ A₂ hA₁ hA₂ + hAu hA₁A hA₂A E₁ T₁ R₁ hT₁ hiB₁ hbT₁ E₂ T₂ Q' hT₂ hiR₂ hbT₂ f hfi hfK hfn hfG hR₁B hT₁B hQ'R + hT₂R hQ'B W rfl hWc φ hφQ hφO hφc hfm hφi hA₁T hA₂T hT hB_A hb₁ hb₂ + exact hindented + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/IndentMain.lean b/LeanPool/GraphMinor/GM17/IndentMain.lean new file mode 100644 index 0000000000..870fa067ff --- /dev/null +++ b/LeanPool/GraphMinor/GM17/IndentMain.lean @@ -0,0 +1,1012 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.IndentRegion +public import LeanPool.GraphMinor.GM17.BorderCells + +/-! +# Indenting a border cell + +We prove `indentedBorderPainting : IndentedBorderPaintingStatement`, the painting behind the proofs +of (9.3) and (9.4) of Graph Minors +XVII, pages 184 and 185. In both proofs a disc `D` holds a border cell `c₀`, and `D` has a third +node `n` on its boundary, and `indented_of_disc` +then gives the new painting. + +For (9.3) the region `r` next to `c₀` has an internal node `n₀`. The paper gets this from (8.3) and +the absence of an internal cell with `cTilde₀ ⊆ cTilde` +(`exists_internal_node`). Then `D` is `cBar₀` together with the part of `rBar` between the side of +`c₀` and two chords through `n₀`. + +For (9.4) there is an internal cell `c₃` with `cTilde₃ = {n₁, n₂, n₃}`. The disc in the paper's +sentence "Let $\Delta \subseteq \Sigma$ be the disc bounded by $F_1 \cup F_2 \cup (c_0 \cap +\Theta)$" needs +`c₃` to face `c₀`. We show this: the region `r` on the side of `c₃` between `n₁` and `n₂` has the +side of `c₀` as the rest of its frontier +(`region_between`), by (8.3) and (8.8). So `D = cBar₀ ∪ rBar ∪ cBar₃`. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology Metric GraphMinor.Surface Painting + +variable {S : Type} [TopologicalSpace S] + +theorem cell_disjoint_closure {Γ : Painting S} {c d : Set S} (hc : c ∈ Γ.C) + (hd : d ∈ Γ.C) (hne : c ≠ d) : Disjoint c (closure d) := + disjoint_left.mpr fun x hx hx' => by + by_cases h : x ∈ d + · exact disjoint_left.mp (arcComponentsIn_disjoint hc hd hne) hx h + · exact disjoint_left.mp (Γ.cell_disjoint_N hc) hx (Γ.tilde_subset_N hd ⟨hx', h⟩) + +theorem line_preconnected {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) : IsPreconnected L := + GraphMinor.Surface.IsLineWithEnds.isPreconnected hL + +/-- What a border cell looks like. -/ +theorem border_data [T2Space S] (hS : IsSurface S) {Γ : Painting S} {Θ c₀ : Set S} {n₁ n₂ : S} + (hΘ : Θ ∈ cuffs S) (hc₀ : c₀ ∈ Γ.C) + (hc₀Θ : (c₀ ∩ Θ).Nonempty) (ht : tilde c₀ = {n₁, n₂}) : + ∃ L₀ n', IsLineWithEnds (closure c₀ ∩ bd S) n₁ n₂ ∧ Γ.IsSide c₀ L₀ n₁ n₂ ∧ discBd (closure c₀) + = (closure c₀ ∩ bd S) ∪ L₀ ∧ + (closure c₀ ∩ bd S) ∩ L₀ = {n₁, n₂} ∧ n₁ ∈ bd S ∧ n₂ ∈ bd S ∧ closure c₀ ∩ bd S ⊆ Θ ∧ n' ∈ + (closure c₀ ∩ bd S) \ {n₁, n₂} ∧ n' ∈ c₀ ∩ Θ := by + obtain ⟨w, hwc, hwΘ⟩ := hc₀Θ + have hΘb : Θ ⊆ bd S := by + obtain ⟨x, -, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + have hbd : (c₀ ∩ bd S).Nonempty := ⟨w, hwc, hΘb hwΘ⟩ + obtain ⟨u, v, O, ht', hB, hO, hb, hi, hu, hv, -⟩ := Painting.border_side hS hc₀ hbd + have hmemA : w ∈ closure c₀ ∩ bd S := ⟨subset_closure hwc, hΘb hwΘ⟩ + have hsub : ∀ {a b : S}, IsLineWithEnds (closure c₀ ∩ bd S) a b → closure c₀ ∩ bd S ⊆ Θ := fun hL + => by + obtain ⟨x, -, rfl⟩ := hΘ + rw [connectedComponentIn_eq hwΘ] + exact (line_preconnected hL).subset_connectedComponentIn hmemA inter_subset_right + have hnot : w ∉ ({n₁, n₂} : Set S) := fun h => (ht ▸ h : w ∈ tilde c₀).2 hwc + rw [ht] at ht' + rcases (pair_eq_pair_iff.mp ht') with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨O, w, hB, hO, hb, hi, hu, hv, hsub hB, ⟨hmemA, hnot⟩, hwc, hwΘ⟩ + · exact ⟨O, w, hB.symm, hO.symm, hb, by rw [hi, pair_comm], hv, hu, hsub hB, ⟨hmemA, hnot⟩, + hwc, hwΘ⟩ + +/-- A disc `P` along the side of a border cell gives the painting. -/ +theorem indented_of_glue [ConnectedSpace S] (hS : IsSurface S) (Γ : Painting S) {P L₀ G Θ c₀ : Set + S} {n n₁ n₂ n' : S} {R : Set (Set S)} + (hc₀ : c₀ ∈ Γ.C) (ht : tilde c₀ = {n₁, n₂}) (hA : IsLineWithEnds (closure c₀ ∩ bd S) n₁ n₂) + (hL₀ : IsLineWithEnds L₀ n₁ n₂) + (hb₀ : discBd (closure c₀) = (closure c₀ ∩ bd S) ∪ L₀) (hi₀ : (closure c₀ ∩ bd S) ∩ L₀ + = {n₁, n₂}) + (hP : IsClosedDisc P) (hG : IsLineWithEnds G n₁ n₂) (hbP : discBd P = L₀ ∪ G) (hL₀G : L₀ ∩ G + = {n₁, n₂}) (hPc : P ∩ closure c₀ = L₀) + (hPb : P ∩ bd S ⊆ {n₁, n₂}) (hPN : P ∩ Γ.N = {n₁, n₂, n}) (hnG : n ∈ G \ {n₁, n₂}) + (hnb : n ∉ bd S) + (hAG : (closure c₀ ∩ bd S) ∩ G = {n₁, n₂}) (hn'A : n' ∈ (closure c₀ ∩ bd S) \ {n₁, n₂}) + (hn'c : n' ∈ c₀ ∩ Θ) (hAΘ : closure c₀ ∩ bd S ⊆ Θ) + (hc₀R : c₀ ∈ R) (hRc : ∀ c ∈ Γ.C, c ∈ R → c = c₀ ∨ c ⊆ P) (hRd : ∀ c ∈ Γ.C, c ∉ R + → Disjoint c P) : + ∃ Γ' : Painting S, IsIndentedBorderPainting Γ Θ c₀ n₁ n₂ n R Γ' := by + have ht2 : T2Space S := hS.2.1 + set A := closure c₀ ∩ bd S with hAdef + have hdc := Γ.isClosedDisc_closure_cell hc₀ + have hL₀b : L₀ ⊆ discBd (closure c₀) := fun x hx => hb₀ ▸ .inr hx + obtain ⟨hD, hbD⟩ := disc_union (closure c₀) P L₀ n₁ n₂ hdc hP hL₀ (by rw [inter_comm, hPc]) hL₀b + (fun x hx => hbP ▸ .inl hx) + have hend : ∀ {x}, x ∈ ({n₁, n₂} : Set S) → x ∈ A ∧ x ∈ L₀ ∧ x ∈ G := fun {x} hx => by + have h1 : x ∈ A ∩ L₀ := hi₀.symm.subset hx + have h2 : x ∈ L₀ ∩ G := hL₀G.symm.subset hx + exact ⟨h1.1, h1.2, h2.2⟩ + have hbD' : discBd (closure c₀ ∪ P) = A ∪ G := by + rw [hbD, hb₀, hbP] + ext x + constructor + · rintro ⟨((h | h) | (h | h)), hx⟩ + · exact .inl h + · exact .inl (hend (by_contra fun h3 => hx ⟨h, h3⟩)).1 + · exact .inl (hend (by_contra fun h3 => hx ⟨h, h3⟩)).1 + · exact .inr h + · rintro (h | h) + · refine ⟨.inl (.inl h), fun h3 => h3.2 ?_⟩ + exact hi₀ ▸ ⟨h, h3.1⟩ + · refine ⟨.inr (.inr h), fun h3 => h3.2 ?_⟩ + exact hL₀G ▸ ⟨h3.1, h⟩ + have hclN : closure c₀ ∩ Γ.N = {n₁, n₂} := by + rw [← ht] + ext x + constructor + · rintro ⟨hx, hxN⟩ + exact ⟨hx, fun h => disjoint_left.mp (Γ.cell_disjoint_N hc₀) h hxN⟩ + · intro hx + exact ⟨hx.1, Γ.tilde_subset_N hc₀ hx⟩ + refine indented_of_disc hS Γ hD hA hG hbD' hAG ?_ ?_ hnG hnb hn'A hn'c hAΘ ?_ ?_ + · refine Subset.antisymm ?_ fun x hx => ⟨.inl hx.1, hx.2⟩ + rintro x ⟨(h | h), hb⟩ + · exact ⟨h, hb⟩ + · exact (hend (hPb ⟨h, hb⟩)).1 + · rw [union_inter_distrib_right, hclN, hPN] + ext x + simp only [mem_union, mem_insert_iff, mem_singleton_iff] + tauto + · intro c hc hcR + rcases hRc c hc hcR with rfl | h + · exact subset_closure.trans subset_union_left + · exact h.trans subset_union_right + · intro c hc hcR + have hne : c ≠ c₀ := fun h => hcR (h ▸ hc₀R) + exact disjoint_union_right.mpr ⟨cell_disjoint_closure hc hc₀ hne, hRd c hc hcR⟩ + +private theorem nodes_of_region_cell_union + {S : Type} + [TopologicalSpace S] + (Γ : Painting S) + {c₀ : Set S} + {c₃ : Set S} + {n₁ : S} + {n₂ : S} + {n₃ : S} + (hc₃ : c₃ ∈ Γ.C) + (ht₃ : tilde c₃ = {n₁, n₂, n₃}) + (L₀ : Set S) + (hs₀ : Γ.IsSide c₀ L₀ n₁ n₂) + (L₃ : Set S) + (hg₃ : Γ.IsGap c₃ L₃ n₁ n₂) + (r : Set S) + (hrU : ∀ x ∈ r, x ∉ Γ.U) + (hfr' : ∀ x ∈ closure r, x ∉ r → x ∈ L₃ ∨ x ∈ L₀) + (hc₃out : ∀ x ∈ closure c₃, x ∉ c₃ → x = n₁ ∨ x = n₂ ∨ x = n₃) : + (closure r ∪ closure c₃) ∩ Γ.N = {n₁, n₂, n₃} := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨(h | h), hxN⟩ + · have hxr : x ∉ r := fun h3 => hrU x h3 (Γ.N_subset hxN) + rcases hfr' x h hxr with h3 | h3 + · rcases (hg₃.2.2.2.le ⟨h3, hxN⟩) with h4 | h4 + · exact .inl h4 + · exact .inr (.inl h4) + · rcases (hs₀.1.2.2.2.le ⟨h3, hxN⟩) with h4 | h4 + · exact .inl h4 + · exact .inr (.inl h4) + · have hx3 : x ∉ c₃ := fun h3 => disjoint_left.mp (Γ.cell_disjoint_N hc₃) h3 hxN + exact hc₃out x h hx3 + · rw [← ht₃] + intro x hx + exact ⟨.inr hx.1, Γ.tilde_subset_N hc₃ hx⟩ + +private theorem cuff_arc_subset_side + {S : Type} + [TopologicalSpace S] + [ConnectedSpace S] + (hS : IsSurface S) + (Γ : Painting S) + (h2 : ∀ c ∈ Γ.C, ∃ a ∈ tilde c, ∃ b ∈ tilde c, a ≠ b) + {c₀ : Set S} + {n₁ : S} + {n₂ : S} + [T2Space S] + [CompactSpace S] + (hreg' : ∀ r ∈ Γ.regions, IsOpen r) + (L₀ : Set S) + (hb₀ : discBd (closure c₀) = closure c₀ ∩ bd S ∪ L₀) + (L₃ : Set S) + (r : Set S) + (hr : r ∈ Γ.regions) + (C₂ : Set S) + (hu : L₃ ∪ C₂ = closure r \ r) + (Δ : Set S) + (hsd : ∀ c ∈ Γ.C, c ⊆ Δ ∨ c ⊆ Δᶜ) + (hC₂Δ : C₂ ⊆ Δ) + (hC₂N : ∀ x ∈ C₂, x ∈ Γ.N → x = n₁ ∨ x = n₂) + (huniq : ∀ c ∈ Γ.C, c ⊆ Δ → c = c₀) + (y : S) + (hy : y ∈ C₂ \ {n₁, n₂}) : + y ∈ L₀ := by + have hyC : y ∈ closure r \ r := hu ▸ .inr hy.1 + have hyN : y ∉ Γ.N := fun h => hy.2 (hC₂N y hy.1 h) + obtain ⟨L, ⟨c'', u, v, hL, hLr⟩, hyL⟩ := frontier_region hS hreg' h2 hr hyC.1 hyC.2 hyN + have hyu : y ≠ u := fun e => hyN (hL.1.2.2.2.ge (.inl e) |>.2) + have hyv : y ≠ v := fun e => hyN (hL.1.2.2.2.ge (.inr e) |>.2) + have hyc : y ∈ c'' := hL.1.mem_cell hyL hyu hyv + have hc'' := hL.1.1 + have hec := huniq c'' hc'' ((hsd c'' hc'').resolve_right fun h => h hyc (hC₂Δ hy.1)) + rw [hec] at hL + have hyb : y ∉ bd S := fun h => disjoint_left.mp hL.2 ⟨hyL, by + rintro (e | e) + · exact hyu e + · exact hyv e⟩ h + have h5 : y ∈ (closure c₀ ∩ bd S) ∪ L₀ := hb₀ ▸ hL.1.2.2.1 hyL + rcases h5 with h5 | h5 + · exact absurd h5.2 hyb + · exact h5 + +private theorem inner_piece_stays_inside_cut_disc + {S : Type} + [TopologicalSpace S] + (Γ : Painting S) + {c₃ : Set S} + {n₁ : S} + {n₂ : S} + {n₃ : S} + (hc₃ : c₃ ∈ Γ.C) + (hn₃ : n₃ ∈ Γ.N \ bd S) + [T2Space S] + (hn₃t : n₃ ∈ tilde c₃) + (hn₃₁ : n₃ ≠ n₁) + (hn₃₂ : n₃ ≠ n₂) + (L₃ : Set S) + (hg₃ : Γ.IsGap c₃ L₃ n₁ n₂) + (hL₃ : IsLineWithEnds L₃ n₁ n₂) + (F : Set S) + (Δ₁ : Set S) + (Δ₂ : Set S) + (Δ : Set S) + (hFN : F ∩ Γ.N = {n₁, n₂}) + (hb₁ : discBd Δ₁ = L₃ ∪ F) + (hΔ : IsClosedDisc Δ) + (h3 : Δ ∩ Γ.N ⊆ F) + (hside : Δ₁ ⊆ Δ ∨ Δ₂ ⊆ Δ) + (hsd : ∀ c ∈ Γ.C, c ⊆ Δ ∨ c ⊆ Δᶜ) : + Δ₂ ⊆ Δ := by + rcases hside with h | h + · exfalso + obtain ⟨z, hz⟩ := line_inner_nonempty hL₃ + have hz₁ : z ∈ c₃ := hg₃.mem_cell hz.1 (fun e => hz.2 (.inl e)) (fun e => hz.2 (.inr e)) + have hzΔ : z ∈ Δ := h (discBd_subset _ (hb₁ ▸ .inl hz.1)) + have hsubc : c₃ ⊆ Δ := (hsd c₃ hc₃).resolve_right fun h5 => h5 hz₁ hzΔ + have hn₃Δ : n₃ ∈ Δ := closure_minimal hsubc hΔ.isClosed hn₃t.1 + have h5 : n₃ ∈ F ∩ Γ.N := ⟨h3 ⟨hn₃Δ, hn₃.1⟩, hn₃.1⟩ + rw [hFN] at h5 + rcases h5 with h5 | h5 + · exact hn₃₁ h5 + · exact hn₃₂ h5 + · exact h + +private theorem joined_region_has_only_boundary_endpoints + {S : Type} + [TopologicalSpace S] + (Γ : Painting S) + {c₃ : Set S} + {n₁ : S} + {n₂ : S} + {n₃ : S} + (hint : ¬(c₃ ∩ bd S).Nonempty) + (hn₃ : n₃ ∈ Γ.N \ bd S) + (L₀ : Set S) + (L₃ : Set S) + (r : Set S) + (hrb : ∀ x ∈ r, x ∉ bd S) + (hfr' : ∀ x ∈ closure r, x ∉ r → x ∈ L₃ ∨ x ∈ L₀) + (hs₀' : ∀ x ∈ L₀, x ∈ bd S → x ∈ ({n₁, n₂} : Set S)) + (hs₃' : ∀ x ∈ L₃, x ∈ bd S → x ∈ ({n₁, n₂} : Set S)) + (hc₃out : ∀ x ∈ closure c₃, x ∉ c₃ → x = n₁ ∨ x = n₂ ∨ x = n₃) : + (closure r ∪ closure c₃) ∩ bd S ⊆ {n₁, n₂} := by + rintro x ⟨(h | h), hb⟩ + · rcases hfr' x h (hrb x · hb) with h3 | h3 + · exact hs₃' x h3 hb + · exact hs₀' x h3 hb + · by_cases hx : x ∈ c₃ + · exact absurd ⟨x, hx, hb⟩ hint + · rcases hc₃out x h hx with h3 | h3 | h3 + · exact .inl h3 + · exact .inr h3 + · exact absurd (h3 ▸ hb) hn₃.2 + +/-- Part (B) of the statement, with the hypotheses that it uses. -/ +theorem indented_of_cell [ConnectedSpace S] (hS : IsSurface S) (Γ : Painting S) + (hreg : ∀ r ∈ Γ.regions, IsOpenDisc r) (hfr : ∀ r ∈ Γ.regions, IsOArc (closure r \ r)) + (h83 : ∀ F : Set S, IsLine F → Γ.IsNormal F → F ∩ bd S = lineEnds F → (F ∩ Γ.N).ncard = 2 → + ∃ Δ : Set S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd S ∧ Δ ∩ Γ.N ⊆ F + ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard = 1) + (h2 : ∀ c ∈ Γ.C, ∃ a ∈ tilde c, ∃ b ∈ tilde c, a ≠ b) + (h88 : ∀ c₁ ∈ Γ.C, ∀ c₂ ∈ Γ.C, c₁ ≠ c₂ → tilde c₁ ⊆ tilde c₂ → (c₁ ∩ bd S).Nonempty ∧ + (tilde c₂).ncard = 3) + {Θ c₀ c₃ : Set S} {n₁ n₂ n₃ : S} (hΘ : Θ ∈ cuffs S) (hc₀ : c₀ ∈ Γ.C) (hc₀Θ : (c₀ ∩ Θ).Nonempty) + (hne : n₁ ≠ n₂) (ht₀ : tilde c₀ = {n₁, n₂}) + (hc₃ : c₃ ∈ Γ.C) (hint : ¬ (c₃ ∩ bd S).Nonempty) (hn₃ : n₃ ∈ Γ.N \ bd S) (ht₃ : tilde c₃ + = {n₁, n₂, n₃}) : + ∃ Γ' : Painting S, IsIndentedBorderPainting Γ Θ c₀ n₁ n₂ n₃ {c₀, c₃} Γ' := by + classical + have ht2 : T2Space S := hS.2.1 + have hcS : CompactSpace S := hS.1 + have hreg' : ∀ r ∈ Γ.regions, IsOpen r := fun r hr => (hreg r hr).1 + obtain ⟨L₀, n', hA, hs₀, hb₀, hi₀, hn₁b, hn₂b, hAΘ, hn'A, hn'c⟩ := border_data hS hΘ hc₀ hc₀Θ ht₀ + have hn₁t : n₁ ∈ tilde c₃ := ht₃ ▸ .inl rfl + have hn₂t : n₂ ∈ tilde c₃ := ht₃ ▸ .inr (.inl rfl) + have hn₃t : n₃ ∈ tilde c₃ := ht₃ ▸ .inr (.inr rfl) + have hn₁N : n₁ ∈ Γ.N := Γ.tilde_subset_N hc₃ hn₁t + have hn₂N : n₂ ∈ Γ.N := Γ.tilde_subset_N hc₃ hn₂t + have hn₃₁ : n₃ ≠ n₁ := fun h => hn₃.2 (h ▸ hn₁b) + have hn₃₂ : n₃ ≠ n₂ := fun h => hn₃.2 (h ▸ hn₂b) + obtain ⟨L₃, hg₃⟩ := exists_gap_pair hc₃ hn₁t hn₂t hne + have hs₃ : Γ.IsSide c₃ L₃ n₁ n₂ := isSide_of_internal hg₃ hint + have hL₃ : IsLineWithEnds L₃ n₁ n₂ := hg₃.2.1 + have hL₀ : IsLineWithEnds L₀ n₁ n₂ := hs₀.1.2.1 + have hc₀₃ : c₀ ≠ c₃ := fun h => by + obtain ⟨w, hw, hw'⟩ := (⟨n', hn'c.1, hn'A.1.2⟩ : (c₀ ∩ bd S).Nonempty) + exact hint ⟨w, h ▸ hw, hw'⟩ + obtain ⟨St, γ, r, -, -, -, -, -, -, -, hr, -, hL₃r, -⟩ := side_strip hS hreg' hs₃ (A + := ∅) isClosed_empty (by simp) + have hrU : ∀ x ∈ r, x ∉ Γ.U := fun x hx => (arcComponentsIn_subset hr hx).2 + have hrb : ∀ x ∈ r, x ∉ bd S := fun x hx h => hrU x hx (Γ.bd_subset h) + have hL₃C : L₃ ⊆ closure r \ r := fun x hx => + ⟨hL₃r hx, fun h => disjoint_left.mp (region_disjoint_closure hr hc₃) h (hg₃.subset_closure hx)⟩ + obtain ⟨C₂, hC₂, hu, hi⟩ := oarc_split (hfr r hr) hL₃ hL₃C + obtain ⟨hdR, hbR⟩ := region_disc hS hreg hr (hfr r hr) + obtain ⟨F, Δ₁, Δ₂, Δ, hF, hFr, hFN, -, -, -, -, hb₁, hb₂, hΔ, h1, h2', h3, h4, -, hside⟩ := + exists_chord_disc hS hreg hfr h83 hr hL₃ hC₂ hu hi hn₁N hn₂N hne hn₁b hn₂b + have hFb : F ∩ bd S = {n₁, n₂} := by + refine Subset.antisymm (fun x hx => by_contra fun h => hrb x (hFr ⟨hx.1, h⟩) hx.2) ?_ + rintro x (rfl | rfl) + · exact ⟨hF.left_mem, hn₁b⟩ + · exact ⟨hF.right_mem, hn₂b⟩ + have hnorm : Γ.IsNormal F := fun x hx => by + by_contra h + have h3' : x ∈ ({n₁, n₂} : Set S) := by_contra fun h4 => hrU x (hFr ⟨hx.1, h4⟩) hx.2 + exact h (hFN.symm.subset h3').2 + obtain ⟨I, -, -, -, hI, -, -, -, -, -, hmeet, hnb⟩ := arc_disc_data hS hF hFb hΔ h1 h2' + have hsd : ∀ c ∈ Γ.C, c ⊆ Δ ∨ c ⊆ Δᶜ := fun c hc => cell_side hc hnorm hΔ hnb + have hsub₂ : Δ₂ ⊆ Δ := by + exact inner_piece_stays_inside_cut_disc (S := S) Γ (c₃ := c₃) (n₁ := n₁) (n₂ := n₂) (n₃ := n₃) + hc₃ hn₃ hn₃t hn₃₁ hn₃₂ L₃ hg₃ hL₃ F Δ₁ Δ₂ Δ hFN hb₁ hΔ h3 hside hsd + have hC₂Δ : C₂ ⊆ Δ := fun x hx => hsub₂ (discBd_subset _ (hb₂ ▸ .inl hx)) + have hC₂N : ∀ x ∈ C₂, x ∈ Γ.N → x = n₁ ∨ x = n₂ := fun x hx hxN => hFN.subset ⟨h3 ⟨hC₂Δ hx, hxN⟩, + hxN⟩ + have hIb : I ⊆ bd S := fun x hx => (hmeet.symm.subset hx).2 + have hIΔ : I ⊆ Δ := fun x hx => (hmeet.symm.subset hx).1 + obtain ⟨c', hc', hc'Δ, hc'b, -, -⟩ := exists_border_cell hI hIb hIΔ hn₁N hsd + have htc' : tilde c' ⊆ {n₁, n₂} := fun x hx => by + have hxN := Γ.tilde_subset_N hc' hx + exact hFN ▸ (⟨h3 ⟨closure_minimal hc'Δ hΔ.isClosed hx.1, hxN⟩, hxN⟩ : x ∈ F ∩ Γ.N) + have hc'c₀ : c' = c₀ := by + by_contra hcne + have h5 := (h88 c' hc' c₀ hc₀ hcne (ht₀ ▸ htc')).2 + rw [ht₀, ncard_pair hne] at h5 + omega + have huniq : ∀ c ∈ Γ.C, c ⊆ Δ → c = c₀ := by + obtain ⟨a, ha⟩ := ncard_eq_one.mp h4 + have hm : c₀ ∈ {c ∈ Γ.C | c ⊆ Δ} := ⟨hc₀, hc'c₀ ▸ hc'Δ⟩ + rw [ha] at hm + intro c hc hcΔ + have hm' : c ∈ {c ∈ Γ.C | c ⊆ Δ} := ⟨hc, hcΔ⟩ + rw [ha] at hm' + exact hm'.trans hm.symm + have hC₂L₀ : C₂ \ {n₁, n₂} ⊆ L₀ := fun y hy => by + exact cuff_arc_subset_side (S := S) hS Γ h2 (c₀ := c₀) (n₁ := n₁) (n₂ := n₂) hreg' L₀ hb₀ L₃ r + hr C₂ hu Δ hsd hC₂Δ hC₂N huniq y hy + have hclosed : ∀ {L : Set S} {a b : S}, IsLineWithEnds L a b → IsClosed L := fun hL + => GM19.isClosed_of_cuffLine hL + have hC₂sub : C₂ ⊆ L₀ := hC₂.subset_closure_diff.trans (closure_minimal hC₂L₀ (hclosed hL₀)) + obtain ⟨y, hy⟩ := line_inner_nonempty hC₂ + have hyL₀ : y ∈ L₀ := hC₂L₀ hy + obtain ⟨St', γ', r₀, -, -, -, -, -, -, -, hr₀, hsubSt, hL₀r, hnbSt⟩ := side_strip hS hreg' hs₀ (A + := ∅) isClosed_empty (by simp) + have hrr : r = r₀ := region_of_strip hc₀ (fun x hx => hs₀.1.subset_closure hx) hsubSt hr₀ hr + (hnbSt y hyL₀ (fun e => hy.2 (.inl e)) (fun e => hy.2 (.inr e))) ((hu ▸ .inr hy.1 : y ∈ closure + r \ r).1) + rw [← hrr] at hL₀r + have hL₀C : L₀ \ {n₁, n₂} ⊆ C₂ := fun w hw => by + have hwc := hs₀.1.mem_cell hw.1 (fun e => hw.2 (.inl e)) (fun e => hw.2 (.inr e)) + have hwC : w ∈ closure r \ r := + ⟨hL₀r hw.1, fun h => disjoint_left.mp (region_disjoint_closure hr hc₀) h (subset_closure hwc)⟩ + rw [← hu] at hwC + rcases hwC with h5 | h5 + · have h6 := hg₃.mem_cell h5 (fun e => hw.2 (.inl e)) (fun e => hw.2 (.inr e)) + exact absurd h6 (disjoint_left.mp (arcComponentsIn_disjoint hc₀ hc₃ hc₀₃) hwc) + · exact h5 + have hEq : C₂ = L₀ := Subset.antisymm hC₂sub (hL₀.subset_closure_diff.trans (closure_minimal hL₀C + (hclosed hC₂))) + rw [hEq] at hu hi + have hinn₃ : ∀ x ∈ L₃, x ∉ ({n₁, n₂} : Set S) → x ∈ c₃ := fun x hx h => + hg₃.mem_cell hx (fun e => h (.inl e)) (fun e => h (.inr e)) + have hinn₀ : ∀ x ∈ L₀, x ∉ ({n₁, n₂} : Set S) → x ∈ c₀ := fun x hx h => + hs₀.1.mem_cell hx (fun e => h (.inl e)) (fun e => h (.inr e)) + have hend₃ : ∀ {x}, x ∈ ({n₁, n₂} : Set S) → x ∈ L₃ ∧ x ∈ L₀ := fun {x} hx => hi.symm.subset hx + have hfr' : ∀ x ∈ closure r, x ∉ r → x ∈ L₃ ∨ x ∈ L₀ := fun x hx h => hu.symm.subset ⟨hx, h⟩ + have hcc : ∀ x ∈ closure c₀, x ∈ closure c₃ → x ∈ ({n₁, n₂} : Set S) := fun x hx hx' => by + by_cases h : x ∈ c₀ + · exact absurd hx' (disjoint_left.mp (cell_disjoint_closure hc₀ hc₃ hc₀₃) h) + · exact ht₀ ▸ (⟨hx, h⟩ : x ∈ tilde c₀) + have hL₀cl : ∀ x ∈ L₀, x ∈ closure c₀ := fun x hx => hs₀.1.subset_closure hx + have hL₃cl : ∀ x ∈ L₃, x ∈ closure c₃ := fun x hx => hg₃.subset_closure hx + have hrnot : ∀ x ∈ closure c₃, x ∉ r := fun x hx h => disjoint_left.mp + (region_disjoint_closure hr hc₃) h hx + have hrnot₀ : ∀ x ∈ closure c₀, x ∉ r := fun x hx h => disjoint_left.mp + (region_disjoint_closure hr hc₀) h hx + have hrc₃ : closure r ∩ closure c₃ = L₃ := by + refine Subset.antisymm ?_ fun x hx => ⟨hL₃r hx, hL₃cl x hx⟩ + rintro x ⟨hx, hx'⟩ + rcases hfr' x hx (hrnot x hx') with h | h + · exact h + · exact (hend₃ (hcc x (hL₀cl x h) hx')).1 + have hrc₀ : closure r ∩ closure c₀ = L₀ := by + refine Subset.antisymm ?_ fun x hx => ⟨hL₀r hx, hL₀cl x hx⟩ + rintro x ⟨hx, hx'⟩ + rcases hfr' x hx (hrnot₀ x hx') with h | h + · exact (hend₃ (hcc x hx' (hL₃cl x h))).2 + · exact h + have hd₃ := Γ.isClosedDisc_closure_cell hc₃ + obtain ⟨G, hG, hu₃, hi₃⟩ := oarc_split hd₃.isOArc_discBd hL₃ hg₃.2.2.1 + have hGc : ∀ x ∈ G, x ∈ closure c₃ := fun x hx => discBd_subset _ (hu₃ ▸ .inr hx) + obtain ⟨hP, hbP⟩ := disc_union (closure r) (closure c₃) L₃ n₁ n₂ hdR hd₃ hL₃ hrc₃ + (hbR ▸ hL₃C) hg₃.2.2.1 + have hbP' : discBd (closure r ∪ closure c₃) = L₀ ∪ G := by + rw [hbP, hbR, ← hu₃, ← hu] + ext x + constructor + · rintro ⟨((h | h) | (h | h)), hx⟩ + · exact .inl (hend₃ (by_contra fun h3 => hx ⟨h, h3⟩)).2 + · exact .inl h + · exact .inl (hend₃ (by_contra fun h3 => hx ⟨h, h3⟩)).2 + · exact .inr h + · rintro (h | h) + · exact ⟨.inl (.inr h), fun h3 => h3.2 (hi ▸ ⟨h3.1, h⟩)⟩ + · exact ⟨.inr (.inr h), fun h3 => h3.2 (hi₃ ▸ ⟨h3.1, h⟩)⟩ + have hGend : ∀ {x}, x ∈ ({n₁, n₂} : Set S) → x ∈ G := fun {x} hx => (hi₃.symm.subset hx).2 + have hL₀G : L₀ ∩ G = {n₁, n₂} := by + refine Subset.antisymm (fun x hx => hcc x (hL₀cl x hx.1) (hGc x hx.2)) fun x hx + => ⟨(hend₃ hx).2, hGend hx⟩ + have hPc : (closure r ∪ closure c₃) ∩ closure c₀ = L₀ := by + refine Subset.antisymm ?_ fun x hx => ⟨.inl (hL₀r hx), hL₀cl x hx⟩ + rintro x ⟨(h | h), hx⟩ + · exact hrc₀ ▸ ⟨h, hx⟩ + · exact (hend₃ (hcc x hx h)).2 + have hs₀' : ∀ x ∈ L₀, x ∈ bd S → x ∈ ({n₁, n₂} : Set S) := fun x hx hb => + by_contra fun h => disjoint_left.mp hs₀.2 ⟨hx, h⟩ hb + have hs₃' : ∀ x ∈ L₃, x ∈ bd S → x ∈ ({n₁, n₂} : Set S) := fun x hx hb => + by_contra fun h => disjoint_left.mp hs₃.2 ⟨hx, h⟩ hb + have hc₃out : ∀ x ∈ closure c₃, x ∉ c₃ → x = n₁ ∨ x = n₂ ∨ x = n₃ := fun x hx h + => ht₃.subset ⟨hx, h⟩ + have hPb : (closure r ∪ closure c₃) ∩ bd S ⊆ {n₁, n₂} := by + exact joined_region_has_only_boundary_endpoints (S := S) Γ (c₃ := c₃) (n₁ := n₁) (n₂ := n₂) + (n₃ := n₃) hint hn₃ L₀ L₃ r hrb hfr' hs₀' hs₃' hc₃out + have hPN : (closure r ∪ closure c₃) ∩ Γ.N = {n₁, n₂, n₃} := by + exact nodes_of_region_cell_union (S := S) Γ (c₀ := c₀) (c₃ := c₃) (n₁ := n₁) (n₂ := n₂) (n₃ := + n₃) hc₃ ht₃ L₀ hs₀ L₃ hg₃ r hrU hfr' hc₃out + have hnG : n₃ ∈ G \ {n₁, n₂} := by + refine ⟨?_, ?_⟩ + · have h3 : n₃ ∈ L₃ ∪ G := hu₃ ▸ Γ.tilde_subset_discBd hc₃ hn₃t + rcases h3 with h3 | h3 + · rcases (hg₃.2.2.2.le ⟨h3, hn₃.1⟩) with h4 | h4 + · exact absurd h4 hn₃₁ + · exact absurd h4 hn₃₂ + · exact h3 + · rintro (h | h) + · exact hn₃₁ h + · exact hn₃₂ h + have hAG : (closure c₀ ∩ bd S) ∩ G = {n₁, n₂} := by + refine Subset.antisymm (fun x hx => hcc x hx.1.1 (hGc x hx.2)) fun x hx => ?_ + exact ⟨(hi₀.symm.subset hx).1, hGend hx⟩ + refine indented_of_glue hS Γ hc₀ ht₀ hA hL₀ hb₀ hi₀ hP hG hbP' hL₀G hPc hPb hPN hnG hn₃.2 hAG + hn'A hn'c hAΘ (.inl rfl) ?_ ?_ + · rintro c - (rfl | rfl) + · exact .inl rfl + · exact .inr (subset_closure.trans subset_union_right) + · intro c hc hcR + have hne₀ : c ≠ c₀ := fun h => hcR (.inl h) + have hne₃ : c ≠ c₃ := fun h => hcR (.inr h) + have hdis₀ := cell_disjoint_closure hc hc₀ hne₀ + have hdis₃ := cell_disjoint_closure hc hc₃ hne₃ + refine disjoint_union_right.mpr ⟨disjoint_left.mpr fun x hx hxr => ?_, hdis₃⟩ + have hxr' : x ∉ r := fun h => disjoint_left.mp (region_disjoint_closure hr hc) h + (subset_closure hx) + rcases hfr' x hxr hxr' with h | h + · exact disjoint_left.mp hdis₃ hx (hL₃cl x h) + · exact disjoint_left.mp hdis₀ hx (hL₀cl x h) + +private theorem exists_node_between_cuff_ends + {S : Type} + [TopologicalSpace S] + [ConnectedSpace S] + (hS : IsSurface S) + (Γ : Painting S) + (h2 : ∀ c ∈ Γ.C, ∃ a ∈ tilde c, ∃ b ∈ tilde c, a ≠ b) + (h88 : ∀ c₁ ∈ Γ.C, ∀ c₂ ∈ Γ.C, c₁ ≠ c₂ → tilde c₁ ⊆ tilde c₂ → (c₁ ∩ bd S).Nonempty ∧ (tilde + c₂).ncard = 3) + {r : Set S} + {c₀ : Set S} + {L₀ : Set S} + {C₂ : Set S} + {n₁ : S} + {n₂ : S} + (hc₀ : c₀ ∈ Γ.C) + (hne : n₁ ≠ n₂) + (ht₀ : tilde c₀ = {n₁, n₂}) + (hs₀ : Γ.IsSide c₀ L₀ n₁ n₂) + (hb₀ : discBd (closure c₀) = closure c₀ ∩ bd S ∪ L₀) + (hn₁b : n₁ ∈ bd S) + (hn₂b : n₂ ∈ bd S) + (hr : r ∈ Γ.regions) + (hC₂ : IsLineWithEnds C₂ n₁ n₂) + (hu : L₀ ∪ C₂ = closure r \ r) + (hi : L₀ ∩ C₂ = {n₁, n₂}) + (hno : ¬∃ c ∈ Γ.C, ¬(c ∩ bd S).Nonempty ∧ tilde c₀ ⊆ tilde c) + [T2Space S] + [CompactSpace S] + (hreg' : ∀ r ∈ Γ.regions, IsOpen r) + (hL₀ : IsLineWithEnds L₀ n₁ n₂) + (hn₁t : n₁ ∈ tilde c₀) + (hn₂t : n₂ ∈ tilde c₀) + (hn₁N : n₁ ∈ Γ.N) + (hn₂N : n₂ ∈ Γ.N) + (hrU : ∀ x ∈ r, x ∉ Γ.U) + (hall : ∀ n₀ ∈ C₂ \ {n₁, n₂}, n₀ ∈ Γ.N → n₀ ∈ bd S) : + ∃ n ∈ C₂ \ {n₁, n₂}, n ∈ Γ.N := by + by_contra hnone + push Not at hnone + obtain ⟨y, hy⟩ := line_inner_nonempty hC₂ + have hyC : y ∈ closure r \ r := hu ▸ .inr hy.1 + obtain ⟨L, ⟨c', u, v, hL, hLr⟩, hyL⟩ := frontier_region hS hreg' h2 hr hyC.1 hyC.2 (hnone y hy) + have hends : ∀ {w}, w ∈ L → w ∈ Γ.N → w = n₁ ∨ w = n₂ := fun {w} hw hwN => by + have hwC : w ∈ closure r \ r := ⟨hLr hw, fun h => hrU w h (Γ.N_subset hwN)⟩ + rw [← hu] at hwC + rcases hwC with h | h + · exact hs₀.1.2.2.2.le ⟨h, hwN⟩ + · exact by_contra fun h4 => hnone w ⟨h, h4⟩ hwN + have huL : u ∈ L ∩ Γ.N := hL.1.2.2.2.ge (.inl rfl) + have hvL : v ∈ L ∩ Γ.N := hL.1.2.2.2.ge (.inr rfl) + have hc' := hL.1.1 + have htm : ∀ {w}, w ∈ L ∩ Γ.N → w ∈ tilde c' := fun {w} hw => + ⟨hL.1.subset_closure hw.1, fun h => disjoint_left.mp (Γ.cell_disjoint_N hc') h hw.2⟩ + have huv : u ≠ v := hL.1.2.1.ne' + have hsub : tilde c₀ ⊆ tilde c' := by + rw [ht₀] + rintro x (rfl | rfl) + · rcases hends huL.1 huL.2 with h | h + · exact h ▸ htm huL + · rcases hends hvL.1 hvL.2 with h' | h' + · exact h' ▸ htm hvL + · exact absurd (h.trans h'.symm) huv + · rcases hends huL.1 huL.2 with h | h + · rcases hends hvL.1 hvL.2 with h' | h' + · exact absurd (h.trans h'.symm) huv + · exact h' ▸ htm hvL + · exact h ▸ htm huL + have hyb : y ∉ bd S := fun h => disjoint_left.mp hL.2 + ⟨hyL, by + rintro (e | e) + · exact hnone y hy (e ▸ huL.2) + · exact hnone y hy (e ▸ hvL.2)⟩ h + by_cases hce : c' = c₀ + · rw [hce] at hL + have h5 : y ∈ (closure c₀ ∩ bd S) ∪ L₀ := hb₀ ▸ hL.1.2.2.1 hyL + rcases h5 with h5 | h5 + · exact hyb h5.2 + · exact hy.2 (hi ▸ ⟨h5, hy.1⟩) + · have h3 := (h88 c₀ hc₀ c' hc' (Ne.symm hce) hsub).2 + refine hno ⟨c', hc', fun hbord => ?_, hsub⟩ + have h4 := (Γ.border_cell c' hc' hbord).1 + omega + +/-- The region next to a border cell has an internal node, by (8.3) and (8.8), when no internal cell +has all nodes of the border cell. The paper states this in the proof of (9.3), page 184. +Three nodes on `bd(Σ)` around the region would give three discs from (8.3) that, with the closed +region, cover the surface, which leaves too few nodes. -/ +theorem exists_internal_node [ConnectedSpace S] (hS : IsSurface S) (Γ : Painting S) (h6 : 6 + ≤ Γ.N.ncard) + (hreg : ∀ r ∈ Γ.regions, IsOpenDisc r) (hfr : ∀ r ∈ Γ.regions, IsOArc (closure r \ r)) + (h83 : ∀ F : Set S, IsLine F → Γ.IsNormal F → F ∩ bd S = lineEnds F → (F ∩ Γ.N).ncard = 2 → + ∃ Δ : Set S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd S ∧ Δ ∩ Γ.N ⊆ F + ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard = 1) + (h2 : ∀ c ∈ Γ.C, ∃ a ∈ tilde c, ∃ b ∈ tilde c, a ≠ b) + (h88 : ∀ c₁ ∈ Γ.C, ∀ c₂ ∈ Γ.C, c₁ ≠ c₂ → tilde c₁ ⊆ tilde c₂ → (c₁ ∩ bd S).Nonempty ∧ + (tilde c₂).ncard = 3) + {r c₀ L₀ C₂ : Set S} {n₁ n₂ : S} (hc₀ : c₀ ∈ Γ.C) (hne : n₁ ≠ n₂) (ht₀ : tilde c₀ = {n₁, n₂}) + (hs₀ : Γ.IsSide c₀ L₀ n₁ n₂) + (hb₀ : discBd (closure c₀) = (closure c₀ ∩ bd S) ∪ L₀) (hn₁b : n₁ ∈ bd S) (hn₂b : n₂ ∈ bd S) + (hr : r ∈ Γ.regions) + (hC₂ : IsLineWithEnds C₂ n₁ n₂) (hu : L₀ ∪ C₂ = closure r \ r) (hi : L₀ ∩ C₂ = {n₁, n₂}) + (hno : ¬ ∃ c ∈ Γ.C, ¬ (c ∩ bd S).Nonempty ∧ tilde c₀ ⊆ tilde c) : + ∃ n₀ ∈ C₂ \ {n₁, n₂}, n₀ ∈ Γ.N ∧ n₀ ∉ bd S := by + classical + have ht2 : T2Space S := hS.2.1 + have hcS : CompactSpace S := hS.1 + have hreg' : ∀ r ∈ Γ.regions, IsOpen r := fun r hr => (hreg r hr).1 + have hL₀ : IsLineWithEnds L₀ n₁ n₂ := hs₀.1.2.1 + have hn₁t : n₁ ∈ tilde c₀ := ht₀ ▸ .inl rfl + have hn₂t : n₂ ∈ tilde c₀ := ht₀ ▸ .inr rfl + have hn₁N : n₁ ∈ Γ.N := Γ.tilde_subset_N hc₀ hn₁t + have hn₂N : n₂ ∈ Γ.N := Γ.tilde_subset_N hc₀ hn₂t + have hrU : ∀ x ∈ r, x ∉ Γ.U := fun x hx => (arcComponentsIn_subset hr hx).2 + by_contra hall + push Not at hall + have hex : ∃ n ∈ C₂ \ {n₁, n₂}, n ∈ Γ.N := by + exact exists_node_between_cuff_ends (S := S) hS Γ h2 h88 (r := r) (c₀ := c₀) (L₀ := L₀) (C₂ := + C₂) (n₁ := n₁) (n₂ := n₂) hc₀ hne ht₀ hs₀ hb₀ hn₁b hn₂b hr hC₂ hu hi hno hreg' hL₀ hn₁t hn₂t + hn₁N hn₂N hrU hall + obtain ⟨n, hn, hnN⟩ := hex + have hnb : n ∈ bd S := hall n hn hnN + have hn1 : n ≠ n₁ := fun h => hn.2 (.inl h) + have hn2 : n ≠ n₂ := fun h => hn.2 (.inr h) + obtain ⟨S₁, S₂, hS₁, hS₂, hSu, hSi⟩ := hC₂.split hn.1 hn1 hn2 + have hS₁C : S₁ ⊆ C₂ := hSu ▸ subset_union_left + have hS₂C : S₂ ⊆ C₂ := hSu ▸ subset_union_right + have hL₀S₂ : L₀ ∩ S₂ = {n₂} := by + refine Subset.antisymm (fun x hx => ?_) ?_ + · rcases (hi.subset ⟨hx.1, hS₂C hx.2⟩ : x = n₁ ∨ x = n₂) with h | h + · have h3 : x ∈ S₁ ∩ S₂ := ⟨h ▸ hS₁.left_mem, hx.2⟩ + rw [hSi] at h3 + exact absurd (h3.symm.trans h) hn1 + · exact h + · rintro x rfl + exact ⟨hL₀.right_mem, hS₂.right_mem⟩ + have hL₀S₁ : L₀ ∩ S₁ = {n₁} := by + refine Subset.antisymm (fun x hx => ?_) ?_ + · rcases (hi.subset ⟨hx.1, hS₁C hx.2⟩ : x = n₁ ∨ x = n₂) with h | h + · exact h + · have h3 : x ∈ S₁ ∩ S₂ := ⟨hx.2, h ▸ hS₂.right_mem⟩ + rw [hSi] at h3 + exact absurd (h3.symm.trans h) hn2 + · rintro x rfl + exact ⟨hL₀.left_mem, hS₁.left_mem⟩ + have hT₁ : IsLineWithEnds (L₀ ∪ S₂) n₁ n := hL₀.union hS₂.symm hL₀S₂ + have hT₂ : IsLineWithEnds (L₀ ∪ S₁) n₂ n := hL₀.symm.union hS₁ hL₀S₁ + have hu₁ : S₁ ∪ (L₀ ∪ S₂) = closure r \ r := by + rw [← hu, ← hSu] + ext x + simp only [mem_union] + tauto + have hu₂ : S₂ ∪ (L₀ ∪ S₁) = closure r \ r := by + rw [← hu, ← hSu] + ext x + simp only [mem_union] + tauto + have hi₁ : S₁ ∩ (L₀ ∪ S₂) = {n₁, n} := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨hx, (h | h)⟩ + · exact .inl (hL₀S₁ ▸ ⟨h, hx⟩ : x ∈ ({n₁} : Set S)) + · exact .inr (hSi ▸ ⟨hx, h⟩ : x ∈ ({n} : Set S)) + · rintro x (rfl | rfl) + · exact ⟨hS₁.left_mem, .inl hL₀.left_mem⟩ + · exact ⟨hS₁.right_mem, .inr hS₂.left_mem⟩ + have hi₂ : S₂ ∩ (L₀ ∪ S₁) = {n₂, n} := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨hx, (h | h)⟩ + · exact .inl (hL₀S₂ ▸ ⟨h, hx⟩ : x ∈ ({n₂} : Set S)) + · exact .inr (hSi ▸ ⟨h, hx⟩ : x ∈ ({n} : Set S)) + · rintro x (rfl | rfl) + · exact ⟨hS₂.right_mem, .inl hL₀.right_mem⟩ + · exact ⟨hS₂.left_mem, .inr hS₁.right_mem⟩ + obtain ⟨F1, X₁, X₁', Δ1, -, hF1r, hF1N, -, -, -, -, hbX₁, hbX₁', hΔ1, -, -, h31, -, hnb1, hside1⟩ + := + exists_chord_disc hS hreg hfr h83 hr hS₁ hT₁ hu₁ hi₁ hn₁N hnN hn1.symm hn₁b hnb + obtain ⟨F2, X₂, X₂', Δ2, -, hF2r, hF2N, -, -, -, -, hbX₂, hbX₂', hΔ2, -, -, h32, -, hnb2, hside2⟩ + := + exists_chord_disc hS hreg hfr h83 hr hS₂.symm hT₂ hu₂ hi₂ hn₂N hnN hn2.symm hn₂b hnb + obtain ⟨F0, X₀, X₀', Δ0, -, hF0r, hF0N, -, -, -, -, hbX₀, hbX₀', hΔ0, -, -, h30, -, hnb0, hside0⟩ + := + exists_chord_disc hS hreg hfr h83 hr hL₀ hC₂ hu hi hn₁N hn₂N hne hn₁b hn₂b + have hS₁Δ : S₁ ⊆ Δ1 := by + rcases hside1 with h | h + · exact fun x hx => h (discBd_subset _ (hbX₁ ▸ .inl hx)) + · exfalso + have hm : n₂ ∈ F1 ∩ Γ.N := + ⟨h31 ⟨h (discBd_subset _ (hbX₁' ▸ .inl (.inl hL₀.right_mem))), hn₂N⟩, hn₂N⟩ + rw [hF1N] at hm + rcases hm with hm | hm + · exact hne hm.symm + · exact hn2 hm.symm + have hS₂Δ : S₂ ⊆ Δ2 := by + rcases hside2 with h | h + · exact fun x hx => h (discBd_subset _ (hbX₂ ▸ .inl hx)) + · exfalso + have hm : n₁ ∈ F2 ∩ Γ.N := + ⟨h32 ⟨h (discBd_subset _ (hbX₂' ▸ .inl (.inl hL₀.left_mem))), hn₁N⟩, hn₁N⟩ + rw [hF2N] at hm + rcases hm with hm | hm + · exact hne hm + · exact hn1 hm.symm + have hL₀Δ : L₀ ⊆ Δ0 := by + rcases hside0 with h | h + · exact fun x hx => h (discBd_subset _ (hbX₀ ▸ .inl hx)) + · exfalso + have hm : n ∈ F0 ∩ Γ.N := ⟨h30 ⟨h (discBd_subset _ (hbX₀' ▸ .inl hn.1)), hnN⟩, hnN⟩ + rw [hF0N] at hm + exact hn.2 hm + let A₀ : Set S := {n₁, n₂, n} + have hA₀ : A₀.Finite := by simp [A₀] + let W : Set S := closure r ∪ Δ0 ∪ Δ1 ∪ Δ2 + have hWc : IsClosed W := ((isClosed_closure.union hΔ0.isClosed).union hΔ1.isClosed).union + hΔ2.isClosed + have hrnb : ∀ {x}, x ∈ r → W ∈ 𝓝 x := fun {x} hx => + Filter.mem_of_superset ((hreg r hr).1.mem_nhds hx) (fun z hz => .inl (.inl (.inl + (subset_closure hz)))) + have hcase0 : ∀ {x}, x ∈ Δ0 → x ∉ A₀ → W ∈ 𝓝 x := fun {x} hx hxA => by + by_cases hF : x ∈ F0 + · exact hrnb (hF0r ⟨hF, fun h => hxA (h.elim .inl fun h' => .inr (.inl h'))⟩) + · exact Filter.mem_of_superset (hnb0 x ⟨hx, hF⟩) fun z hz => .inl (.inl (.inr hz)) + have hcase1 : ∀ {x}, x ∈ Δ1 → x ∉ A₀ → W ∈ 𝓝 x := fun {x} hx hxA => by + by_cases hF : x ∈ F1 + · exact hrnb (hF1r ⟨hF, fun h => hxA (h.elim .inl fun h' => .inr (.inr h'))⟩) + · exact Filter.mem_of_superset (hnb1 x ⟨hx, hF⟩) fun z hz => .inl (.inr hz) + have hcase2 : ∀ {x}, x ∈ Δ2 → x ∉ A₀ → W ∈ 𝓝 x := fun {x} hx hxA => by + by_cases hF : x ∈ F2 + · exact hrnb (hF2r ⟨hF, fun h => hxA (h.elim (.inr ∘ .inl) fun h' => .inr (.inr h'))⟩) + · exact Filter.mem_of_superset (hnb2 x ⟨hx, hF⟩) fun z hz => .inr hz + have hsplit : ∀ {x}, x ∈ closure r → x ∉ r → x ∈ Δ0 ∨ x ∈ Δ1 ∨ x ∈ Δ2 := fun {x} hx h => by + have h3 : x ∈ L₀ ∪ C₂ := hu ▸ ⟨hx, h⟩ + rcases h3 with h3 | h3 + · exact .inl (hL₀Δ h3) + · rw [← hSu] at h3 + rcases h3 with h3 | h3 + · exact .inr (.inl (hS₁Δ h3)) + · exact .inr (.inr (hS₂Δ h3)) + have hnbW : ∀ x ∈ W, x ∉ A₀ → W ∈ 𝓝 x := by + rintro x (((hx | hx) | hx) | hx) hxA + · by_cases h : x ∈ r + · exact hrnb h + · rcases hsplit hx h with h3 | h3 | h3 + · exact hcase0 h3 hxA + · exact hcase1 h3 hxA + · exact hcase2 h3 hxA + · exact hcase0 hx hxA + · exact hcase1 hx hxA + · exact hcase2 hx hxA + obtain ⟨z, hz⟩ := arcComponentsIn_nonempty hr + have hzA : z ∉ A₀ := by + have hzN : z ∉ Γ.N := fun h => hrU z hz (Γ.N_subset h) + rintro (rfl | rfl | rfl) + · exact hzN hn₁N + · exact hzN hn₂N + · exact hzN hnN + have hNA : Γ.N ⊆ A₀ := fun y hyN => by + by_contra hyA + have hyr : y ∉ r := fun h => hrU y h (Γ.N_subset hyN) + have hy0 : ∀ {y}, y ∈ Δ0 → y ∈ Γ.N → y ∈ A₀ := fun {y} h h' => by + rcases (hF0N.subset ⟨h30 ⟨h, h'⟩, h'⟩) with e | e + · exact .inl e + · exact .inr (.inl e) + have hy1 : ∀ {y}, y ∈ Δ1 → y ∈ Γ.N → y ∈ A₀ := fun {y} h h' => by + rcases (hF1N.subset ⟨h31 ⟨h, h'⟩, h'⟩) with e | e + · exact .inl e + · exact .inr (.inr e) + have hy2 : ∀ {y}, y ∈ Δ2 → y ∈ Γ.N → y ∈ A₀ := fun {y} h h' => by + rcases (hF2N.subset ⟨h32 ⟨h, h'⟩, h'⟩) with e | e + · exact .inr (.inl e) + · exact .inr (.inr e) + rcases cover_off hS.2.2 hWc hA₀ ⟨z, .inl (.inl (.inl (subset_closure hz))), hzA⟩ hnbW hyA with + ((h | h) | h) | h + · rcases hsplit h hyr with h3 | h3 | h3 + · exact hyA (hy0 h3 hyN) + · exact hyA (hy1 h3 hyN) + · exact hyA (hy2 h3 hyN) + · exact hyA (hy0 h hyN) + · exact hyA (hy1 h hyN) + · exact hyA (hy2 h hyN) + have hle : Γ.N.ncard ≤ A₀.ncard := ncard_le_ncard hNA hA₀ + have hle3 : A₀.ncard ≤ 3 := by + have h1 := ncard_insert_le n₁ ({n₂, n} : Set S) + have h2 := ncard_pair hn2.symm + change (insert n₁ {n₂, n} : Set S).ncard ≤ 3 + omega + omega + +/-- Part (A) of the statement, with the hypotheses that it uses. -/ +theorem indented_of_region [ConnectedSpace S] (hS : IsSurface S) (Γ : Painting S) (h6 : 6 + ≤ Γ.N.ncard) + (hreg : ∀ r ∈ Γ.regions, IsOpenDisc r) (hfr : ∀ r ∈ Γ.regions, IsOArc (closure r \ r)) + (h83 : ∀ F : Set S, IsLine F → Γ.IsNormal F → F ∩ bd S = lineEnds F → (F ∩ Γ.N).ncard = 2 → + ∃ Δ : Set S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd S ∧ Δ ∩ Γ.N ⊆ F + ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard = 1) + (h2 : ∀ c ∈ Γ.C, ∃ a ∈ tilde c, ∃ b ∈ tilde c, a ≠ b) + (h88 : ∀ c₁ ∈ Γ.C, ∀ c₂ ∈ Γ.C, c₁ ≠ c₂ → tilde c₁ ⊆ tilde c₂ → (c₁ ∩ bd S).Nonempty ∧ + (tilde c₂).ncard = 3) + {Θ c₀ : Set S} {n₁ n₂ : S} (hΘ : Θ ∈ cuffs S) (hc₀ : c₀ ∈ Γ.C) (hc₀Θ : (c₀ ∩ Θ).Nonempty) + (hne : n₁ ≠ n₂) (ht₀ : tilde c₀ = {n₁, n₂}) + (hno : ¬ ∃ c ∈ Γ.C, ¬ (c ∩ bd S).Nonempty ∧ tilde c₀ ⊆ tilde c) : + ∃ n₀ ∈ Γ.N \ bd S, ∃ Γ' : Painting S, IsIndentedBorderPainting Γ Θ c₀ n₁ n₂ n₀ {c₀} Γ' := by + classical + have ht2 : T2Space S := hS.2.1 + have hcS : CompactSpace S := hS.1 + have hreg' : ∀ r ∈ Γ.regions, IsOpen r := fun r hr => (hreg r hr).1 + obtain ⟨L₀, n', hA, hs₀, hb₀, hi₀, hn₁b, hn₂b, hAΘ, hn'A, hn'c⟩ := border_data hS hΘ hc₀ hc₀Θ ht₀ + have hL₀ : IsLineWithEnds L₀ n₁ n₂ := hs₀.1.2.1 + obtain ⟨St, γ, r, -, -, -, -, -, -, -, hr, -, hL₀r, -⟩ := side_strip hS hreg' hs₀ (A + := ∅) isClosed_empty (by simp) + have hrU : ∀ x ∈ r, x ∉ Γ.U := fun x hx => (arcComponentsIn_subset hr hx).2 + have hrb : ∀ x ∈ r, x ∉ bd S := fun x hx h => hrU x hx (Γ.bd_subset h) + have hL₀cl : ∀ x ∈ L₀, x ∈ closure c₀ := fun x hx => hs₀.1.subset_closure hx + have hL₀C : L₀ ⊆ closure r \ r := fun x hx => + ⟨hL₀r hx, fun h => disjoint_left.mp (region_disjoint_closure hr hc₀) h (hL₀cl x hx)⟩ + obtain ⟨C₂, hC₂, hu, hi⟩ := oarc_split (hfr r hr) hL₀ hL₀C + obtain ⟨n₀, hn₀, hn₀N, hn₀b⟩ := exists_internal_node hS Γ h6 hreg hfr h83 h2 h88 hc₀ hne ht₀ hs₀ + hb₀ hn₁b hn₂b hr hC₂ hu hi hno + refine ⟨n₀, ⟨hn₀N, hn₀b⟩, ?_⟩ + obtain ⟨hdR, hbR⟩ := region_disc hS hreg hr (hfr r hr) + have hn01 : n₀ ≠ n₁ := fun h => hn₀.2 (.inl h) + have hn02 : n₀ ≠ n₂ := fun h => hn₀.2 (.inr h) + have hn₀L : n₀ ∉ L₀ := fun h => hn₀.2 (hi ▸ ⟨h, hn₀.1⟩) + obtain ⟨S₁, S₂, hS₁, hS₂, hSu, hSi⟩ := hC₂.split hn₀.1 hn01 hn02 + have hS₁C : S₁ ⊆ C₂ := hSu ▸ subset_union_left + have hS₂C : S₂ ⊆ C₂ := hSu ▸ subset_union_right + have hn₁S₂ : n₁ ∉ S₂ := fun h => by + have h3 : n₁ ∈ S₁ ∩ S₂ := ⟨hS₁.left_mem, h⟩ + rw [hSi] at h3 + exact hn01 h3.symm + have hn₂S₁ : n₂ ∉ S₁ := fun h => by + have h3 : n₂ ∈ S₁ ∩ S₂ := ⟨h, hS₂.right_mem⟩ + rw [hSi] at h3 + exact hn02 h3.symm + have hL₀S₂ : L₀ ∩ S₂ = {n₂} := by + refine Subset.antisymm (fun x hx => ?_) ?_ + · rcases (hi.subset ⟨hx.1, hS₂C hx.2⟩ : x = n₁ ∨ x = n₂) with h | h + · exact absurd (h ▸ hx.2) hn₁S₂ + · exact h + · rintro x rfl + exact ⟨hL₀.right_mem, hS₂.right_mem⟩ + have hT₁ : IsLineWithEnds (L₀ ∪ S₂) n₁ n₀ := hL₀.union hS₂.symm hL₀S₂ + have hu₁ : S₁ ∪ (L₀ ∪ S₂) = discBd (closure r) := by + rw [hbR, ← hu, ← hSu] + ext x + simp only [mem_union] + tauto + have hi₁ : S₁ ∩ (L₀ ∪ S₂) = {n₁, n₀} := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨hx, (h | h)⟩ + · rcases (hi.subset ⟨h, hS₁C hx⟩ : x = n₁ ∨ x = n₂) with h3 | h3 + · exact .inl h3 + · exact absurd (h3 ▸ hx) hn₂S₁ + · exact .inr (hSi ▸ ⟨hx, h⟩ : x ∈ ({n₀} : Set S)) + · rintro x (rfl | rfl) + · exact ⟨hS₁.left_mem, .inl hL₀.left_mem⟩ + · exact ⟨hS₁.right_mem, .inr hS₂.left_mem⟩ + obtain ⟨G₁, Y₁, Y, hG₁, hG₁b, hG₁R, hY₁, hY, huY, hiY, hbY₁, hbY⟩ := split_disc hdR hS₁ hT₁ + hn01.symm hu₁ hi₁ + have hRb : ∀ {x}, x ∈ S₁ ∨ x ∈ L₀ ∨ x ∈ S₂ → x ∈ discBd (closure r) := fun {x} h => by + rw [← hu₁] + rcases h with h | h | h + · exact .inl h + · exact .inr (.inl h) + · exact .inr (.inr h) + have hG₁e : ∀ {x}, x ∈ G₁ → x ∈ discBd (closure r) → x = n₁ ∨ x = n₀ := fun {x} h h' + => hG₁b.subset ⟨h, h'⟩ + have hG₁L : G₁ ∩ L₀ = {n₁} := by + refine Subset.antisymm (fun x hx => ?_) ?_ + · rcases hG₁e hx.1 (hRb (.inr (.inl hx.2))) with h | h + · exact h + · exact absurd (h ▸ hx.2) hn₀L + · rintro x rfl + exact ⟨hG₁.left_mem, hL₀.left_mem⟩ + have hV : IsLineWithEnds (G₁ ∪ L₀) n₀ n₂ := hG₁.symm.union hL₀ hG₁L + have hbYu : S₂ ∪ (G₁ ∪ L₀) = discBd Y := by + rw [hbY] + ext x + simp only [mem_union] + tauto + have hiV : S₂ ∩ (G₁ ∪ L₀) = {n₀, n₂} := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨hx, (h | h)⟩ + · rcases hG₁e h (hRb (.inr (.inr hx))) with h3 | h3 + · exact absurd (h3 ▸ hx) hn₁S₂ + · exact .inl h3 + · exact .inr (hL₀S₂ ▸ ⟨h, hx⟩ : x ∈ ({n₂} : Set S)) + · rintro x (rfl | rfl) + · exact ⟨hS₂.left_mem, .inl hG₁.right_mem⟩ + · exact ⟨hS₂.right_mem, .inr hL₀.right_mem⟩ + obtain ⟨G₂, Y₂, P, hG₂, hG₂b, hG₂Y, hY₂, hP, huP, hiP, hbY₂, hbP⟩ := split_disc hY hS₂ hV hn02 + hbYu hiV + have hPY : P ⊆ Y := huP ▸ subset_union_right + have hYR : Y ⊆ closure r := huY ▸ subset_union_right + have hPR : P ⊆ closure r := hPY.trans hYR + have hYb : ∀ {x}, x ∈ S₂ ∨ x ∈ G₁ ∨ x ∈ L₀ → x ∈ discBd Y := fun {x} h => by + rw [← hbYu] + rcases h with h | h | h + · exact .inl h + · exact .inr (.inl h) + · exact .inr (.inr h) + have hG₂e : ∀ {x}, x ∈ G₂ → x ∈ discBd Y → x = n₀ ∨ x = n₂ := fun {x} h h' => hG₂b.subset ⟨h, h'⟩ + have hGG : G₁ ∩ G₂ = {n₀} := by + refine Subset.antisymm (fun x hx => ?_) ?_ + · rcases hG₂e hx.2 (hYb (.inr (.inl hx.1))) with h | h + · exact h + · have h3 := hG₁e hx.1 (hRb (.inr (.inl (h ▸ hL₀.right_mem)))) + rcases h3 with h3 | h3 + · exact absurd (h.symm.trans h3) hne.symm + · exact h3 + · rintro x rfl + exact ⟨hG₁.right_mem, hG₂.left_mem⟩ + have hG : IsLineWithEnds (G₁ ∪ G₂) n₁ n₂ := hG₁.union hG₂ hGG + have hbP' : discBd P = L₀ ∪ (G₁ ∪ G₂) := by + rw [hbP] + ext x + simp only [mem_union] + tauto + have hL₀G : L₀ ∩ (G₁ ∪ G₂) = {n₁, n₂} := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨hx, (h | h)⟩ + · exact .inl (hG₁L ▸ ⟨h, hx⟩ : x ∈ ({n₁} : Set S)) + · rcases hG₂e h (hYb (.inr (.inr hx))) with h3 | h3 + · exact absurd (h3 ▸ hx) hn₀L + · exact .inr h3 + · rintro x (rfl | rfl) + · exact ⟨hL₀.left_mem, .inl hG₁.left_mem⟩ + · exact ⟨hL₀.right_mem, .inr hG₂.right_mem⟩ + have hPC : ∀ x ∈ P, x ∉ r → x ∈ L₀ ∨ x = n₀ := fun x hx hxr => by + have h3 : x ∈ L₀ ∪ C₂ := hu ▸ ⟨hPR hx, hxr⟩ + rcases h3 with h3 | h3 + · exact .inl h3 + · rw [← hSu] at h3 + rcases h3 with h3 | h3 + · have h4 : x ∈ G₁ := hiY ▸ ⟨discBd_subset _ (hbY₁ ▸ .inl h3), hPY hx⟩ + rcases hG₁e h4 (hRb (.inl h3)) with h5 | h5 + · exact .inl (h5 ▸ hL₀.left_mem) + · exact .inr h5 + · have h4 : x ∈ G₂ := hiP ▸ ⟨discBd_subset _ (hbY₂ ▸ .inl h3), hx⟩ + rcases hG₂e h4 (hYb (.inl h3)) with h5 | h5 + · exact .inr h5 + · exact .inl (h5 ▸ hL₀.right_mem) + have hnotcl : n₀ ∉ closure c₀ := fun h => by + have h3 : n₀ ∈ tilde c₀ := ⟨h, fun h3 => disjoint_left.mp (Γ.cell_disjoint_N hc₀) h3 hn₀N⟩ + rw [ht₀] at h3 + rcases h3 with h3 | h3 + · exact hn01 h3 + · exact hn02 h3 + have hL₀P : L₀ ⊆ P := fun x hx => discBd_subset _ (hbP' ▸ .inl hx) + have hGP : G₁ ∪ G₂ ⊆ P := fun x hx => discBd_subset _ (hbP' ▸ .inr hx) + have hPc : P ∩ closure c₀ = L₀ := by + refine Subset.antisymm ?_ fun x hx => ⟨hL₀P hx, hL₀cl x hx⟩ + rintro x ⟨hx, hx'⟩ + rcases hPC x hx fun h => disjoint_left.mp (region_disjoint_closure hr hc₀) h hx' with h | h + · exact h + · exact absurd (h ▸ hx') hnotcl + have hs₀' : ∀ x ∈ L₀, x ∈ bd S → x ∈ ({n₁, n₂} : Set S) := fun x hx hb => + by_contra fun h => disjoint_left.mp hs₀.2 ⟨hx, h⟩ hb + have hPb : P ∩ bd S ⊆ {n₁, n₂} := by + rintro x ⟨hx, hb⟩ + rcases hPC x hx (hrb x · hb) with h | h + · exact hs₀' x h hb + · exact absurd (h ▸ hb) hn₀b + have hPN : P ∩ Γ.N = {n₁, n₂, n₀} := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨hx, hxN⟩ + rcases hPC x hx (fun h => hrU x h (Γ.N_subset hxN)) with h | h + · rcases (hs₀.1.2.2.2.le ⟨h, hxN⟩) with h3 | h3 + · exact .inl h3 + · exact .inr (.inl h3) + · exact .inr (.inr h) + · rintro x (rfl | rfl | rfl) + · exact ⟨hL₀P hL₀.left_mem, (hs₀.1.2.2.2.ge (.inl rfl)).2⟩ + · exact ⟨hL₀P hL₀.right_mem, (hs₀.1.2.2.2.ge (.inr rfl)).2⟩ + · exact ⟨hGP (.inl hG₁.right_mem), hn₀N⟩ + have hnG : n₀ ∈ (G₁ ∪ G₂) \ {n₁, n₂} := by + refine ⟨.inl hG₁.right_mem, ?_⟩ + rintro (h | h) + · exact hn01 h + · exact hn02 h + have hAG : (closure c₀ ∩ bd S) ∩ (G₁ ∪ G₂) = {n₁, n₂} := by + refine Subset.antisymm (fun x hx => ?_) fun x hx => ?_ + · rcases hPC x (hGP hx.2) (hrb x · hx.1.2) with h | h + · exact hs₀' x h hx.1.2 + · exact absurd (h ▸ hx.1.2) hn₀b + · exact ⟨(hi₀.symm.subset hx).1, (hL₀G.symm.subset hx).2⟩ + refine indented_of_glue hS Γ hc₀ ht₀ hA hL₀ hb₀ hi₀ hP hG hbP' hL₀G hPc hPb hPN hnG hn₀b hAG hn'A + hn'c hAΘ rfl ?_ ?_ + · rintro c - rfl + exact .inl rfl + · intro c hc hcR + have hne₀ : c ≠ c₀ := hcR + refine disjoint_left.mpr fun x hx hxP => ?_ + have hxr : x ∉ r := fun h => disjoint_left.mp (region_disjoint_closure hr hc) h + (subset_closure hx) + rcases hPC x hxP hxr with h | h + · exact disjoint_left.mp (cell_disjoint_closure hc hc₀ hne₀) hx (hL₀cl x h) + · exact disjoint_left.mp (Γ.cell_disjoint_N hc) hx (h ▸ hn₀N) + +/-- **The painting of the proofs of (9.3) and (9.4) of Graph Minors XVII**, pages 184 and 185, kept +in the same surface. -/ +theorem indentedBorderPainting : IndentedBorderPaintingStatement := by + unfold IndentedBorderPaintingStatement + intro S _ _ hS Γ h6 hreg hfr h2 h83 h88 Θ hΘ c₀ hc₀ hc₀Θ n₁ n₂ hne ht₀ + have ht2 : T2Space S := hS.2.1 + have h2' : ∀ c ∈ Γ.C, ∃ a ∈ tilde c, ∃ b ∈ tilde c, a ≠ b := fun c hc => + (one_lt_ncard (Γ.cell_disc c hc).2.2.1).mp (h2 c hc) + refine ⟨fun hno => indented_of_region hS Γ h6 hreg hfr h83 h2' h88 hΘ hc₀ hc₀Θ hne ht₀ hno, ?_⟩ + intro c₃ hc₃ hint n₃ hn₃ ht₃ + exact indented_of_cell hS Γ hreg hfr h83 h2' h88 hΘ hc₀ hc₀Θ hne ht₀ hc₃ hint hn₃ ht₃ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/IndentPaint.lean b/LeanPool/GraphMinor/GM17/IndentPaint.lean new file mode 100644 index 0000000000..7f2d119e0c --- /dev/null +++ b/LeanPool/GraphMinor/GM17/IndentPaint.lean @@ -0,0 +1,565 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section9b +public import LeanPool.GraphMinor.Surface.SurfacePull +public import LeanPool.GraphMinor.GM17.ThreeNodeReplace +import LeanPool.GraphMinor.GM17.CellNodes + +/-! +# A painting from a push of a node + +This is the bookkeeping for the step "Then `Γ'` is a painting in `Σ'`" of the proof of (9.3) of +Graph Minors XVII, page 184. Let `φ` be +an injection on a closed set `W` that holds everything outside a set `D`. Keep the cells of a +painting `Γ` that miss `D`, move them by `φ`, +and add two closed discs `T₁`, `T₂` along the boundary of the surface. If `φ` moves only one node +`n` and moves it to `n'`, this gives +a painting, and the new cells match the old ones outside the set `R` of cells in `D` +(`indented_of_push`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology Metric GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +/-- An injection continuous on a compact set maps closed discs to closed discs. -/ +theorem disc_of_injOn [T2Space S] {Δ : Set S} {φ : S → S} (hΔ : IsClosedDisc Δ) + (hc : ContinuousOn φ Δ) + (hi : InjOn φ Δ) : IsClosedDisc (φ '' Δ) ∧ discBd (φ '' Δ) = φ '' discBd Δ := by + obtain ⟨e⟩ := hΔ.isOArc_discBd + have : Nonempty S := ⟨(e 1).1⟩ + obtain ⟨ρ, hρ, hl⟩ := exists_inv_of_compactOn hΔ.isCompact hc hi + exact hΔ.image hc hρ hl + +/-- A closed injection keeps closures. -/ +theorem closure_image_of_injOn [T2Space S] [CompactSpace S] {W d : Set S} {φ : S → S} + (hW : IsClosed W) (hc : ContinuousOn φ W) + (hd : d ⊆ W) : closure (φ '' d) = φ '' closure d := by + have hcl : closure d ⊆ W := closure_minimal hd hW + refine Subset.antisymm (closure_minimal (image_mono subset_closure) ?_) ?_ + · exact (isClosed_closure.isCompact.image_of_continuousOn (hc.mono hcl)).isClosed + · exact (hc.mono hcl).image_closure + +variable [T2Space S] [CompactSpace S] + +private theorem indented_surface_cell_partition + {S : Type} + [TopologicalSpace S] + (Γ : Painting S) + {W : Set S} + {T₁ : Set S} + {T₂ : Set S} + {φ : S → S} + {n : S} + {n₁ : S} + {n₂ : S} + {n' : S} + (hφc : ContinuousOn φ W) + (hφi : InjOn φ W) + (hn₁N : n₁ ∈ Γ.N) + (hn₂N : n₂ ∈ Γ.N) + (hn₁ : n₁ ≠ n) + (hn₂ : n₂ ≠ n) + (hT₁ : IsClosedDisc T₁) + (hT₂ : IsClosedDisc T₂) + (hnode₁ : T₁ ∩ (Γ.N \ {n}) ⊆ {n₁}) + (hnode₂ : T₂ ∩ (Γ.N \ {n}) ⊆ {n₂}) + (K : Set (Set S)) (hK : K ⊆ Γ.C) + (hclN : ∀ d ∈ K, ∀ x ∈ closure d, x ∉ d → x ∈ Γ.N) + (hdW' : ∀ d ∈ K, d ⊆ W) + (hcl : ∀ d ∈ K, closure (φ '' d) = φ '' closure d) + (hφN : ∀ x ∈ Γ.N, φ x ∈ (Γ.N \ {n} ∪ {n'})) + (hcl₁ : closure (T₁ \ {n₁, n'}) = T₁) + (hcl₂ : closure (T₂ \ {n₂, n'}) = T₂) + (hne₁c : (T₁ \ {n₁, n'}).Nonempty) + (hne₂c : (T₂ \ {n₂, n'}).Nonempty) + (hdisj12 : Disjoint (T₁ \ {n₁, n'}) (T₂ \ {n₂, n'})) + (hnotN : ∀ d ∈ K, Disjoint (φ '' d) (Γ.N \ {n} ∪ {n'})) + (hJfin : (insert (T₁ \ {n₁, n'}) (insert (T₂ \ {n₂, n'}) ((fun d => φ '' d) '' K))).Finite) + (hsidefree : ∀ d ∈ K, Disjoint (φ '' d) (T₁ ∪ T₂)) : + arcComponentsIn ((((Γ.N \ {n} ∪ {n'}) ∪ ⋃ d ∈ K, closure (φ '' d)) ∪ T₁ ∪ T₂) \ (Γ.N \ {n} ∪ + {n'})) = (insert (T₁ \ {n₁, n'}) (insert (T₂ \ {n₂, n'}) ((fun d => φ '' d) '' K))) := by + let N' := Γ.N \ {n} ∪ {n'} + let U' := (N' ∪ ⋃ d ∈ K, closure (φ '' d)) ∪ T₁ ∪ T₂ + let c₁ := T₁ \ {n₁, n'} + let c₂ := T₂ \ {n₂, n'} + let J := insert c₁ (insert c₂ ((fun d => φ '' d) '' K)) + refine arcComponentsIn_eq_of_finite_cover hJfin ?_ ?_ ?_ ?_ ?_ + · ext x + constructor + · rintro ⟨e, (rfl | rfl | ⟨d, hd, rfl⟩), hx⟩ + · refine ⟨.inl (.inr hx.1), ?_⟩ + rintro (h1 | h1) + · exact hx.2 (.inl (hnode₁ ⟨hx.1, h1⟩)) + · exact hx.2 (.inr h1) + · refine ⟨.inr hx.1, ?_⟩ + rintro (h1 | h1) + · exact hx.2 (.inl (hnode₂ ⟨hx.1, h1⟩)) + · exact hx.2 (.inr h1) + · refine ⟨.inl (.inl (.inr (mem_biUnion hd (subset_closure hx)))), fun h => ?_⟩ + exact disjoint_left.mp (hnotN d hd) hx h + · rintro ⟨((hx | hx) | hx) | hx, hxN⟩ + · exact absurd hx hxN + · obtain ⟨d, hd, hx⟩ := mem_iUnion₂.mp hx + rw [hcl d hd] at hx + obtain ⟨y, hy, rfl⟩ := hx + by_cases hyd : y ∈ d + · exact ⟨_, .inr (.inr ⟨d, hd, rfl⟩), mem_image_of_mem _ hyd⟩ + · exact absurd (hφN y (hclN d hd y hy hyd)) hxN + · refine ⟨c₁, .inl rfl, hx, ?_⟩ + rintro (rfl | rfl) + · exact hxN (.inl ⟨hn₁N, hn₁⟩) + · exact hxN (.inr rfl) + · refine ⟨c₂, .inr (.inl rfl), hx, ?_⟩ + rintro (rfl | rfl) + · exact hxN (.inl ⟨hn₂N, hn₂⟩) + · exact hxN (.inr rfl) + · rintro e (rfl | rfl | ⟨d, hd, rfl⟩) + · exact hne₁c + · exact hne₂c + · exact (arcComponentsIn_nonempty (hK hd)).image _ + · rintro e (rfl | rfl | ⟨d, hd, rfl⟩) + · exact isPathConnected_of_isClosedDisc_finite_diff hT₁ sdiff_subset + (((finite_singleton _).insert _).subset fun x hx => by + by_contra h + exact hx.2 ⟨hx.1, h⟩) + · exact isPathConnected_of_isClosedDisc_finite_diff hT₂ sdiff_subset + (((finite_singleton _).insert _).subset fun x hx => by + by_contra h + exact hx.2 ⟨hx.1, h⟩) + · exact (arcComponentsIn_isPathConnected (hK hd)).image' (hφc.mono (hdW' d hd)) + · rintro e (rfl | rfl | ⟨d, hd, rfl⟩) e' (rfl | rfl | ⟨d', hd', rfl⟩) hne + · exact absurd rfl hne + · exact hdisj12 + · exact (hsidefree d' hd').symm.mono_left (sdiff_subset.trans subset_union_left : c₁ ⊆ T₁ ∪ + T₂) + · exact hdisj12.symm + · exact absurd rfl hne + · exact (hsidefree d' hd').symm.mono_left (sdiff_subset.trans subset_union_right : c₂ ⊆ T₁ ∪ + T₂) + · exact (hsidefree d hd).mono_right (sdiff_subset.trans subset_union_left : c₁ ⊆ T₁ ∪ T₂) + · exact (hsidefree d hd).mono_right (sdiff_subset.trans subset_union_right : c₂ ⊆ T₁ ∪ T₂) + · have hdd : d ≠ d' := fun h => hne (by rw [h]) + refine disjoint_left.mpr ?_ + rintro _ ⟨y, hy, rfl⟩ ⟨y', hy', he⟩ + have hyy : y' = y := hφi (hdW' d' hd' hy') (hdW' d hd hy) he + exact disjoint_left.mp (arcComponentsIn_disjoint (hK hd) (hK hd') hdd) hy (hyy ▸ hy') + · rintro e (rfl | rfl | ⟨d, hd, rfl⟩) + · rw [hcl₁] + ext x + constructor + · rintro ⟨hx, -, hxN⟩ + refine ⟨hx, ?_⟩ + rintro (rfl | rfl) + · exact hxN (.inl ⟨hn₁N, hn₁⟩) + · exact hxN (.inr rfl) + · intro hx + refine ⟨hx.1, .inl (.inr hx.1), ?_⟩ + rintro (h1 | h1) + · exact hx.2 (.inl (hnode₁ ⟨hx.1, h1⟩)) + · exact hx.2 (.inr h1) + · rw [hcl₂] + ext x + constructor + · rintro ⟨hx, -, hxN⟩ + refine ⟨hx, ?_⟩ + rintro (rfl | rfl) + · exact hxN (.inl ⟨hn₂N, hn₂⟩) + · exact hxN (.inr rfl) + · intro hx + refine ⟨hx.1, .inr hx.1, ?_⟩ + rintro (h1 | h1) + · exact hx.2 (.inl (hnode₂ ⟨hx.1, h1⟩)) + · exact hx.2 (.inr h1) + · ext x + constructor + · rintro ⟨hx, -, hxN⟩ + rw [hcl d hd] at hx + obtain ⟨y, hy, rfl⟩ := hx + by_cases hyd : y ∈ d + · exact mem_image_of_mem _ hyd + · exact absurd (hφN y (hclN d hd y hy hyd)) hxN + · intro hx + exact ⟨subset_closure hx, .inl (.inl (.inr (mem_biUnion hd (subset_closure hx)))), + fun h => disjoint_left.mp (hnotN d hd) hx h⟩ + +private theorem indented_painting_other_cells + {S : Type} + [TopologicalSpace S] + {T₁ : Set S} + {T₂ : Set S} + {φ : S → S} + {n₁ : S} + {n₂ : S} + {n' : S} + {Γ : Painting S} + (K : Set (Set S)) (hK : K ⊆ Γ.C) + (hsidefree : ∀ d ∈ K, Disjoint (φ '' d) (T₁ ∪ T₂)) + (Γ' : Painting S) + (hΓC : Γ'.C = (insert (T₁ \ {n₁, n'}) (insert (T₂ \ {n₂, n'}) ((fun d => φ '' d) '' K)))) : + Γ'.C \ {(T₁ \ {n₁, n'}), (T₂ \ {n₂, n'})} = (fun d => φ '' d) '' K := by + let c₁ := T₁ \ {n₁, n'} + let c₂ := T₂ \ {n₂, n'} + let J := insert c₁ (insert c₂ ((fun d => φ '' d) '' K)) + rw [hΓC] + ext e + constructor + · rintro ⟨(rfl | rfl | he), hne⟩ + · exact absurd (.inl rfl) hne + · exact absurd (.inr rfl) hne + · exact he + · rintro he + refine ⟨.inr (.inr he), ?_⟩ + obtain ⟨d, hd, rfl⟩ := he + obtain ⟨z, hz⟩ := (arcComponentsIn_nonempty (hK hd)).image φ + rintro (h | h) + · exact disjoint_left.mp (hsidefree d hd) hz (.inl ((show φ '' d = c₁ from h) ▸ hz).1) + · exact disjoint_left.mp (hsidefree d hd) hz (.inr ((show φ '' d = c₂ from h) ▸ hz).1) + +private noncomputable abbrev build_indented_border_painting + {S : Type} + [TopologicalSpace S] + [T2Space S] + (Γ : Painting S) + {W : Set S} + {D : Set S} + {T₁ : Set S} + {T₂ : Set S} + {A₁ : Set S} + {A₂ : Set S} + {φ : S → S} + {n : S} + {n₁ : S} + {n₂ : S} + {n' : S} + {R : Set (Set S)} + (hDc : IsClosed D) + (hφc : ContinuousOn φ W) + (hφi : InjOn φ W) + (hnb : n ∉ bd S) + (hRsub : ∀ c ∈ Γ.C, c ∈ R → c ⊆ D) + (hT₁ : IsClosedDisc T₁) + (hT₂ : IsClosedDisc T₂) + (hA₁ : IsLineWithEnds A₁ n₁ n') + (hA₂ : IsLineWithEnds A₂ n₂ n') + (hb₁ : T₁ ∩ bd S = A₁) + (hb₂ : T₂ ∩ bd S = A₂) + (hcov : ∀ x ∈ bd S, x ∈ T₁ ∨ x ∈ T₂ ∨ x ∉ D ∧ φ x = x) + (hne₁ : n₁ ≠ n') + (hne₂ : n₂ ≠ n') + (hKfin : (Γ.C \ R).Finite) + (hdW : ∀ d ∈ (Γ.C \ R), closure d ⊆ W) + (hcl : ∀ d ∈ (Γ.C \ R), closure (φ '' d) = φ '' closure d) + (hn₁T : n₁ ∈ discBd T₁) + (hn'T₁ : n' ∈ discBd T₁) + (hn₂T : n₂ ∈ discBd T₂) + (hn'T₂ : n' ∈ discBd T₂) + (hcl₁ : closure (T₁ \ {n₁, n'}) = T₁) + (hcl₂ : closure (T₂ \ {n₂, n'}) = T₂) + (ht₁ : tilde (T₁ \ {n₁, n'}) = {n₁, n'}) + (ht₂ : tilde (T₂ \ {n₂, n'}) = {n₂, n'}) + (hJfin : (insert (T₁ \ {n₁, n'}) (insert (T₂ \ {n₂, n'}) ((fun d => φ '' d) '' (Γ.C \ + R)))).Finite) + (hJ : arcComponentsIn ((((Γ.N \ {n} ∪ {n'}) ∪ ⋃ d ∈ (Γ.C \ R), closure (φ '' d)) ∪ T₁ ∪ T₂) \ + (Γ.N \ {n} ∪ {n'})) = (insert (T₁ \ {n₁, n'}) (insert (T₂ \ {n₂, n'}) ((fun d => φ '' d) '' + (Γ.C \ R))))) + (htilde : ∀ d ∈ (Γ.C \ R), tilde (φ '' d) = φ '' tilde d) + (hbdset : ∀ d ∈ (Γ.C \ R), ∀ y ∈ d, y ∈ bd S ∨ φ y ∈ bd S → φ y = y) + (hfixN : ∀ d ∈ (Γ.C \ R), (d ∩ bd S).Nonempty → ∀ x ∈ tilde d, φ x = x) : + Painting S := by + let K := Γ.C \ R + let N' := Γ.N \ {n} ∪ {n'} + let U' := (N' ∪ ⋃ d ∈ K, closure (φ '' d)) ∪ T₁ ∪ T₂ + let c₁ := T₁ \ {n₁, n'} + let c₂ := T₂ \ {n₂, n'} + let J := insert c₁ (insert c₂ ((fun d => φ '' d) '' K)) + exact { + U := U' + N := N' + isClosed_U := by + refine (((Γ.finite_N.subset sdiff_subset).union (finite_singleton _)).isClosed.union ?_ + |>.union hT₁.isClosed).union hT₂.isClosed + exact hKfin.isClosed_biUnion fun _ _ => isClosed_closure + N_subset := fun x hx => .inl (.inl (.inl hx)) + finite_N := (Γ.finite_N.subset sdiff_subset).union (finite_singleton _) + finite_cells := by + rw [hJ] + exact hJfin + cell_disc := by + rw [hJ] + rintro e (rfl | rfl | ⟨d, hd, rfl⟩) + · rw [hcl₁, ht₁] + refine ⟨hT₁, ?_, by simp, by rw [ncard_pair hne₁]; omega⟩ + rintro x (rfl | rfl) + · exact hn₁T + · exact hn'T₁ + · rw [hcl₂, ht₂] + refine ⟨hT₂, ?_, by simp, by rw [ncard_pair hne₂]; omega⟩ + rintro x (rfl | rfl) + · exact hn₂T + · exact hn'T₂ + · obtain ⟨h1, h2, h3, h4⟩ := Γ.cell_disc d hd.1 + have hD := disc_of_injOn h1 (hφc.mono (hdW d hd)) (hφi.mono (hdW d hd)) + change IsClosedDisc (closure (φ '' d)) ∧ tilde (φ '' d) ⊆ discBd (closure (φ '' d)) ∧ + (tilde (φ '' d)).Finite ∧ (tilde (φ '' d)).ncard ≤ 3 + rw [htilde d hd, hcl d hd] + exact ⟨hD.1, hD.2 ▸ image_mono h2, h3.image _, (ncard_image_le h3).trans h4⟩ + bd_subset := fun x hx => by + rcases hcov x hx with h | h | ⟨h1, h2⟩ + · exact .inl (.inr h) + · exact .inr h + · rcases Painting.mem_U_iff.mp (Γ.bd_subset hx) with h | ⟨d, hd, hxd⟩ + · refine .inl (.inl (.inl (.inl ⟨h, ?_⟩))) + rintro rfl + exact hnb hx + · by_cases hdR : d ∈ R + · exact absurd (closure_minimal (hRsub d hd hdR) hDc hxd) h1 + · have hdK : d ∈ K := ⟨hd, hdR⟩ + refine .inl (.inl (.inr (mem_biUnion hdK ?_))) + rw [hcl d hdK] + exact ⟨x, hxd, h2⟩ + border_cell := by + rw [hJ] + rintro e (rfl | rfl | ⟨d, hd, rfl⟩) hb + · rw [hcl₁, ht₁, hb₁, ncard_pair hne₁, lineEnds_eq hA₁] + exact ⟨rfl, by simp, ⟨hA₁.choose⟩, rfl⟩ + · rw [hcl₂, ht₂, hb₂, ncard_pair hne₂, lineEnds_eq hA₂] + exact ⟨rfl, by simp, ⟨hA₂.choose⟩, rfl⟩ + · have hbd' : (d ∩ bd S).Nonempty := by + obtain ⟨_, ⟨y, hy, rfl⟩, hyb⟩ := hb + exact ⟨y, hy, hbdset d hd y hy (.inr hyb) ▸ hyb⟩ + have h4 := Γ.border_cell d hd.1 hbd' + have hfc : ∀ x ∈ closure d, (x ∈ bd S ∨ φ x ∈ bd S) → φ x = x := fun x hx hb => by + by_cases hxd : x ∈ d + · exact hbdset d hd x hxd hb + · exact hfixN d hd hbd' x ⟨hx, hxd⟩ + have hY : closure (φ '' d) ∩ bd S = closure d ∩ bd S := by + rw [hcl d hd] + ext z + constructor + · rintro ⟨⟨y, hy, rfl⟩, hz⟩ + exact ⟨by rw [hfc y hy (.inr hz)]; exact hy, hz⟩ + · rintro ⟨hz, hzb⟩ + exact ⟨⟨z, hz, hfc z hz (.inl hzb)⟩, hzb⟩ + have ht : tilde (φ '' d) = tilde d := by + rw [htilde d hd] + exact (image_congr (hfixN d hd hbd')).trans (image_id' _) + change (tilde (φ '' d)).ncard = 2 ∧ (tilde (φ '' d)).Finite ∧ IsLine (closure + (φ '' d) ∩ bd S) ∧ + lineEnds (closure (φ '' d) ∩ bd S) = tilde (φ '' d) + rw [ht, hY] + exact h4 } + +theorem indented_of_push (Γ : Painting S) {W D T₁ T₂ A₁ A₂ Θ c₀ : Set S} {φ : S + → S} {n n₁ n₂ n' : S} {R : Set (Set S)} + (hW : IsClosed W) (hDc : IsClosed D) (hDW : Dᶜ ⊆ W) (hφc : ContinuousOn φ W) (hφi : InjOn φ W) + (hnN : n ∈ Γ.N) (hnW : n ∈ W) (hn₁N : n₁ ∈ Γ.N) (hn₂N : n₂ ∈ Γ.N) (hn₁ : n₁ ≠ n) (hn₂ : n₂ ≠ n) + (hfix : ∀ x ∈ Γ.N, x ≠ n → x ∈ W ∧ φ x = x) (hφn : φ n = n') (hnb : n ∉ bd S) (hn'N : n' ∉ Γ.N) + (hn'c : n' ∈ c₀ ∩ Θ) + (hRsub : ∀ c ∈ Γ.C, c ∈ R → c ⊆ D) (hRd : ∀ c ∈ Γ.C, c ∉ R → Disjoint c D) + (hT₁ : IsClosedDisc T₁) (hT₂ : IsClosedDisc T₂) (hA₁ : IsLineWithEnds A₁ n₁ n') + (hA₂ : IsLineWithEnds A₂ n₂ n') + (hA₁b : A₁ ⊆ discBd T₁) (hA₂b : A₂ ⊆ discBd T₂) (hb₁ : T₁ ∩ bd S = A₁) (hb₂ : T₂ ∩ bd S = A₂) + (hA₁Θ : A₁ ⊆ Θ) (hA₂Θ : A₂ ⊆ Θ) (hT : T₁ ∩ T₂ = {n'}) + (hnode₁ : T₁ ∩ (Γ.N \ {n}) ⊆ {n₁}) (hnode₂ : T₂ ∩ (Γ.N \ {n}) ⊆ {n₂}) + (hoff : ∀ y, y ∉ D → φ y ∉ T₁ ∧ φ y ∉ T₂) (hbd : ∀ y, y ∉ D → (y ∈ bd S ∨ φ y ∈ bd S) → φ y = y) + (hcov : ∀ x ∈ bd S, x ∈ T₁ ∨ x ∈ T₂ ∨ (x ∉ D ∧ φ x = x)) : + ∃ Γ' : Painting S, IsIndentedBorderPainting Γ Θ c₀ n₁ n₂ n R Γ' := by + classical + have hne₁ : n₁ ≠ n' := hA₁.ne' + have hne₂ : n₂ ≠ n' := hA₂.ne' + let K : Set (Set S) := Γ.C \ R + have hKfin : K.Finite := Γ.finite_cells.subset sdiff_subset + have hdc : ∀ d ∈ K, d ⊆ Dᶜ := fun d hd x hx hxD => disjoint_left.mp (hRd d hd.1 hd.2) hx hxD + have hclN : ∀ d ∈ K, ∀ x ∈ closure d, x ∉ d → x ∈ Γ.N := fun d hd x hx hxd + => Γ.tilde_subset_N hd.1 ⟨hx, hxd⟩ + have hdW : ∀ d ∈ K, closure d ⊆ W := fun d hd x hx => by + by_cases hxd : x ∈ d + · exact hDW (hdc d hd hxd) + · have hxN := hclN d hd x hx hxd + by_cases h : x = n + · exact h ▸ hnW + · exact (hfix x hxN h).1 + have hdW' : ∀ d ∈ K, d ⊆ W := fun d hd => subset_closure.trans (hdW d hd) + have hcl : ∀ d ∈ K, closure (φ '' d) = φ '' closure d := fun d hd => closure_image_of_injOn hW + hφc (hdW' d hd) + let N' : Set S := (Γ.N \ {n}) ∪ {n'} + have hφN : ∀ x ∈ Γ.N, φ x ∈ N' := fun x hx => by + by_cases h : x = n + · subst h + exact .inr hφn + · rw [(hfix x hx h).2] + exact .inl ⟨hx, h⟩ + let U' : Set S := N' ∪ (⋃ d ∈ K, closure (φ '' d)) ∪ T₁ ∪ T₂ + let c₁ : Set S := T₁ \ {n₁, n'} + let c₂ : Set S := T₂ \ {n₂, n'} + have hn₁T : n₁ ∈ discBd T₁ := hA₁b hA₁.left_mem + have hn'T₁ : n' ∈ discBd T₁ := hA₁b hA₁.right_mem + have hn₂T : n₂ ∈ discBd T₂ := hA₂b hA₂.left_mem + have hn'T₂ : n' ∈ discBd T₂ := hA₂b hA₂.right_mem + have hcl₁ : closure c₁ = T₁ := by + refine (hT₁.sdiff_of_inter_subset_discBd ?_).2.2 + rintro x ⟨rfl | rfl, -⟩ + · exact hn₁T + · exact hn'T₁ + have hcl₂ : closure c₂ = T₂ := by + refine (hT₂.sdiff_of_inter_subset_discBd ?_).2.2 + rintro x ⟨rfl | rfl, -⟩ + · exact hn₂T + · exact hn'T₂ + have ht₁ : tilde c₁ = {n₁, n'} := by + rw [tilde, hcl₁] + ext x + constructor + · rintro ⟨h3, h4⟩ + exact by_contra fun h => h4 ⟨h3, h⟩ + · intro h3 + refine ⟨?_, fun h => h.2 h3⟩ + rcases h3 with rfl | rfl + · exact discBd_subset _ hn₁T + · exact discBd_subset _ hn'T₁ + have ht₂ : tilde c₂ = {n₂, n'} := by + rw [tilde, hcl₂] + ext x + constructor + · rintro ⟨h3, h4⟩ + exact by_contra fun h => h4 ⟨h3, h⟩ + · intro h3 + refine ⟨?_, fun h => h.2 h3⟩ + rcases h3 with rfl | rfl + · exact discBd_subset _ hn₂T + · exact discBd_subset _ hn'T₂ + have hne₁c : c₁.Nonempty := by + obtain ⟨x, hx⟩ : (closure c₁).Nonempty := by + rw [hcl₁] + exact ⟨_, discBd_subset _ hn₁T⟩ + exact closure_nonempty_iff.mp ⟨x, hx⟩ + have hne₂c : c₂.Nonempty := by + obtain ⟨x, hx⟩ : (closure c₂).Nonempty := by + rw [hcl₂] + exact ⟨_, discBd_subset _ hn₂T⟩ + exact closure_nonempty_iff.mp ⟨x, hx⟩ + have hdisj12 : Disjoint c₁ c₂ := disjoint_left.mpr fun x hx hx' => by + have h3 : x ∈ T₁ ∩ T₂ := ⟨hx.1, hx'.1⟩ + rw [hT] at h3 + exact hx.2 (.inr h3) + have hne12 : c₁ ≠ c₂ := fun h => by + obtain ⟨x, hx⟩ := hne₁c + exact disjoint_left.mp hdisj12 hx (h ▸ hx) + have hnotN : ∀ d ∈ K, Disjoint (φ '' d) N' := fun d hd => disjoint_left.mpr fun x hx hxN => by + obtain ⟨y, hy, rfl⟩ := hx + have hyN : y ∉ Γ.N := fun h => disjoint_left.mp (Γ.cell_disjoint_N hd.1) hy h + rcases hxN with ⟨h1, h2⟩ | h1 + · have := hfix _ h1 h2 + exact hyN (hφi (hdW' d hd hy) this.1 this.2.symm ▸ h1) + · rw [← hφn] at h1 + exact hyN (hφi (hdW' d hd hy) hnW h1 ▸ hnN) + let J : Set (Set S) := insert c₁ (insert c₂ ((fun d => φ '' d) '' K)) + have hJfin : J.Finite := ((hKfin.image _).insert _).insert _ + have hsidefree : ∀ d ∈ K, Disjoint (φ '' d) (T₁ ∪ T₂) := fun d hd => disjoint_left.mpr fun x hx + hx' => by + obtain ⟨y, hy, rfl⟩ := hx + obtain ⟨h1, h2⟩ := hoff y (hdc d hd hy) + exact hx'.elim h1 h2 + have hJ : arcComponentsIn (U' \ N') = J := by + exact indented_surface_cell_partition (S := S) Γ (W := W) (T₁ := T₁) (T₂ := T₂) (φ := φ) + (n := n) (n₁ := n₁) (n₂ := n₂) (n' := n') hφc hφi hn₁N hn₂N hn₁ hn₂ hT₁ hT₂ hnode₁ + hnode₂ K sdiff_subset hclN hdW' hcl hφN hcl₁ hcl₂ hne₁c hne₂c hdisj12 hnotN hJfin hsidefree + have htilde : ∀ d ∈ K, tilde (φ '' d) = φ '' tilde d := fun d hd => by + rw [tilde, hcl d hd, tilde, image_sdiff_of_injOn (hφi.mono (hdW d hd)) subset_closure] + have hbdset : ∀ d ∈ K, ∀ y ∈ d, (y ∈ bd S ∨ φ y ∈ bd S) → φ y = y := fun d hd y hy h => hbd y + (hdc d hd hy) h + have hnotn : ∀ d ∈ K, (d ∩ bd S).Nonempty → n ∉ tilde d := fun d hd hb hn => by + have h4 := Γ.border_cell d hd.1 hb + have hends : ∀ x ∈ tilde d, x ∈ bd S := fun x hx => by + rw [← h4.2.2.2] at hx + obtain ⟨v, hv⟩ := hx + exact hv.left_mem.2 + exact hnb (hends n hn) + have hfixN : ∀ d ∈ K, (d ∩ bd S).Nonempty → ∀ x ∈ tilde d, φ x = x := fun d hd hb x hx => + (hfix x (Γ.tilde_subset_N hd.1 hx) fun h => hnotn d hd hb (h ▸ hx)).2 + let Γ' : Painting S := by + exact build_indented_border_painting (S := S) Γ (W := W) (D := D) (T₁ := T₁) (T₂ := T₂) (A₁ := + A₁) (A₂ := A₂) (φ := φ) (n := n) (n₁ := n₁) (n₂ := n₂) (n' := n') (R := R) hDc hφc hφi hnb + hRsub hT₁ hT₂ hA₁ hA₂ hb₁ hb₂ hcov hne₁ hne₂ hKfin hdW hcl hn₁T hn'T₁ hn₂T hn'T₂ hcl₁ hcl₂ + ht₁ ht₂ hJfin hJ htilde hbdset hfixN + have hΓC : Γ'.C = J := hJ + let cellMap : Set S → Set S := fun e => W ∩ φ ⁻¹' e + have hback : ∀ d ∈ K, cellMap (φ '' d) = d := fun d hd => by + ext x + constructor + · rintro ⟨hx, y, hy, he⟩ + exact hφi (hdW' d hd hy) hx he ▸ hy + · intro hx + exact ⟨hdW' d hd hx, mem_image_of_mem _ hx⟩ + have hset : Γ'.C \ {c₁, c₂} = (fun d => φ '' d) '' K := by + exact indented_painting_other_cells (S := S) (T₁ := T₁) (T₂ := T₂) (φ := φ) (n₁ := n₁) (n₂ := + n₂) (n' := n') (Γ := Γ) K sdiff_subset hsidefree Γ' hΓC + refine ⟨Γ', n', c₁, c₂, cellMap, hn'c, rfl, ?_, ?_, hne12, ?_, ?_, ht₁, ht₂, ?_, ?_, ?_, ?_⟩ + · rw [hΓC] + exact .inl rfl + · rw [hΓC] + exact .inr (.inl rfl) + · obtain ⟨z, hz⟩ := line_inner_nonempty hA₁ + exact ⟨z, ⟨discBd_subset _ (hA₁b hz.1), hz.2⟩, hA₁Θ hz.1⟩ + · obtain ⟨z, hz⟩ := line_inner_nonempty hA₂ + exact ⟨z, ⟨discBd_subset _ (hA₂b hz.1), hz.2⟩, hA₂Θ hz.1⟩ + · rw [hset] + refine ⟨?_, ?_, ?_⟩ + · rintro _ ⟨d, hd, rfl⟩ + change cellMap (φ '' d) ∈ _ + rw [hback d hd] + exact hd + · rintro _ ⟨d, hd, rfl⟩ _ ⟨d', hd', rfl⟩ h + change φ '' d = φ '' d' + have h3 : cellMap (φ '' d) = cellMap (φ '' d') := h + rw [hback d hd, hback d' hd'] at h3 + rw [h3] + · intro d hd + exact ⟨φ '' d, ⟨d, hd, rfl⟩, hback d hd⟩ + · intro e he Θ' hΘ' + rw [hset] at he + obtain ⟨d, hd, rfl⟩ := he + change ((φ '' d) ∩ Θ').Nonempty ↔ (cellMap (φ '' d) ∩ Θ').Nonempty + rw [hback d hd] + have hΘb : Θ' ⊆ bd S := by + obtain ⟨x, -, rfl⟩ := hΘ' + exact connectedComponentIn_subset _ _ + constructor + · rintro ⟨_, ⟨y, hy, rfl⟩, hyb⟩ + exact ⟨y, hy, hbdset d hd y hy (.inr (hΘb hyb)) ▸ hyb⟩ + · rintro ⟨y, hy, hyb⟩ + exact ⟨φ y, mem_image_of_mem _ hy, (hbdset d hd y hy (.inl (hΘb hyb))).symm ▸ hyb⟩ + · intro e he + rw [hset] at he + obtain ⟨d, hd, rfl⟩ := he + change ((φ '' d) ∩ bd S).Nonempty ↔ (cellMap (φ '' d) ∩ bd S).Nonempty + rw [hback d hd] + constructor + · rintro ⟨_, ⟨y, hy, rfl⟩, hyb⟩ + exact ⟨y, hy, hbdset d hd y hy (.inr hyb) ▸ hyb⟩ + · rintro ⟨y, hy, hyb⟩ + exact ⟨φ y, mem_image_of_mem _ hy, (hbdset d hd y hy (.inl hyb)).symm ▸ hyb⟩ + · intro e he + rw [hset] at he + obtain ⟨d, hd, rfl⟩ := he + change tilde (φ '' d) = _ '' tilde (cellMap (φ '' d)) + rw [hback d hd, htilde d hd] + refine image_congr fun x hx => ?_ + by_cases h : x = n + · simp [h, hφn] + · simp [h, (hfix x (Γ.tilde_subset_N hd.1 hx) h).2] + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/IndentPush.lean b/LeanPool/GraphMinor/GM17/IndentPush.lean new file mode 100644 index 0000000000..80d9865bc8 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/IndentPush.lean @@ -0,0 +1,218 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscUnion +public import LeanPool.GraphMinor.Surface.PlaneDisc +public import Mathlib.Analysis.SpecialFunctions.Pow.Continuity + +/-! +# Maps between closed discs with a fixed part of the boundary + +We build the homeomorphism behind the step "Then `Γ'` is a painting in `Σ'`" of the proof of (9.3) +of Graph Minors XVII, page 184. +Let `Q` and `Q'` be closed discs with boundaries `K ∪ G` and `K ∪ E`, for lines `G` and `E` with the +same ends as `K`. Then there +is a homeomorphism of `Q` onto `Q'` that fixes `K`, maps `G` onto `E`, and maps a given inner point +of `G` to a given inner point of +`E` (`exists_disc_map`). The boundary map extends over the discs by the Schoenflies theorem. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology Metric GraphMinor.Surface + +local notation "𝕀" => unitInterval + +/-- A power map of the unit interval onto itself moves any inner point to any other. -/ +theorem exists_interval_map {t t' : 𝕀} (h0 : t ≠ 0) (h1 : t ≠ 1) (h0' : t' ≠ 0) (h1' : t' ≠ 1) : + ∃ ρ : 𝕀 → 𝕀, Continuous ρ ∧ Function.Injective ρ ∧ ρ 0 = 0 ∧ ρ 1 = 1 ∧ ρ t = t' := by + have hp : (0 : ℝ) < t := lt_of_le_of_ne t.2.1 fun h => h0 (Subtype.ext h.symm) + have hl : (t : ℝ) < 1 := lt_of_le_of_ne t.2.2 fun h => h1 (Subtype.ext h) + have hp' : (0 : ℝ) < t' := lt_of_le_of_ne t'.2.1 fun h => h0' (Subtype.ext h.symm) + have hl' : (t' : ℝ) < 1 := lt_of_le_of_ne t'.2.2 fun h => h1' (Subtype.ext h) + have hlog : Real.log t < 0 := Real.log_neg hp hl + have hlog' : Real.log t' < 0 := Real.log_neg hp' hl' + set α : ℝ := Real.log t' / Real.log t with hα + have hαp : 0 < α := div_pos_of_neg_of_neg hlog' hlog + refine ⟨fun s => ⟨(s : ℝ) ^ α, Real.rpow_nonneg s.2.1 _, Real.rpow_le_one s.2.1 s.2.2 hαp.le⟩, + ?_, ?_, ?_, ?_, ?_⟩ + · exact Continuous.subtype_mk (continuous_subtype_val.rpow_const fun _ => .inr hαp.le) _ + · intro a b hab + have h3 : (a : ℝ) ^ α = (b : ℝ) ^ α := congrArg Subtype.val hab + exact Subtype.ext (Real.rpow_left_injOn hαp.ne' a.2.1 b.2.1 h3) + · exact Subtype.ext (by simp [Real.zero_rpow hαp.ne']) + · exact Subtype.ext (by simp) + · refine Subtype.ext ?_ + change (t : ℝ) ^ α = t' + rw [Real.rpow_def_of_pos hp, hα, mul_div_cancel₀ _ hlog.ne, Real.exp_log hp'] + +variable {X : Type*} [TopologicalSpace X] + +/-- **A homeomorphism of closed discs with prescribed boundary.** -/ +theorem exists_disc_map {Q Q' K G E : Set X} {a b z z' : X} (hQ : IsClosedDisc Q) + (hQ' : IsClosedDisc Q') + (hK : IsLineWithEnds K a b) (hG : IsLineWithEnds G a b) (hE : IsLineWithEnds E a b) + (hbQ : discBd Q = K ∪ G) (hbQ' : discBd Q' = K ∪ E) (hKG : K ∩ G = {a, b}) (hKE : K ∩ E + = {a, b}) + (hz : z ∈ G \ {a, b}) (hz' : z' ∈ E \ {a, b}) : + ∃ f : X → X, ContinuousOn f Q ∧ InjOn f Q ∧ f '' Q = Q' ∧ (∀ x ∈ K, f x = x) ∧ f z = z' + ∧ f '' G = E := by + classical + obtain ⟨h, g, c⟩ := hQ.exists_isChart + obtain ⟨h', g', c'⟩ := hQ'.exists_isChart + obtain ⟨fK, hK0, hK1⟩ := hK + obtain ⟨fG, hG0, hG1⟩ := hG + obtain ⟨fE, hE0, hE1⟩ := hE + let ζ : 𝕀 → X := fun s => (fK s).1 + let γ : 𝕀 → X := fun s => (fG s).1 + let ε : 𝕀 → X := fun s => (fE s).1 + have hζ : Continuous ζ := continuous_subtype_val.comp fK.continuous + have hγ : Continuous γ := continuous_subtype_val.comp fG.continuous + have hε : Continuous ε := continuous_subtype_val.comp fE.continuous + have iζ : Function.Injective ζ := fun u v h => fK.injective (Subtype.ext h) + have iγ : Function.Injective γ := fun u v h => fG.injective (Subtype.ext h) + have iε : Function.Injective ε := fun u v h => fE.injective (Subtype.ext h) + have rζ : range ζ = K := by + ext x + exact ⟨by rintro ⟨u, rfl⟩; exact (fK u).2, fun hx => ⟨fK.symm ⟨x, hx⟩, by simp [ζ]⟩⟩ + have rγ : range γ = G := by + ext x + exact ⟨by rintro ⟨u, rfl⟩; exact (fG u).2, fun hx => ⟨fG.symm ⟨x, hx⟩, by simp [γ]⟩⟩ + have rε : range ε = E := by + ext x + exact ⟨by rintro ⟨u, rfl⟩; exact (fE u).2, fun hx => ⟨fE.symm ⟨x, hx⟩, by simp [ε]⟩⟩ + obtain ⟨t, rfl⟩ : z ∈ range γ := rγ ▸ hz.1 + obtain ⟨t', rfl⟩ : z' ∈ range ε := rε ▸ hz'.1 + have ht0 : t ≠ 0 := fun h3 => hz.2 (.inl (by rw [h3]; exact hG0)) + have ht1 : t ≠ 1 := fun h3 => hz.2 (.inr (by rw [h3]; exact hG1)) + have ht0' : t' ≠ 0 := fun h3 => hz'.2 (.inl (by rw [h3]; exact hE0)) + have ht1' : t' ≠ 1 := fun h3 => hz'.2 (.inr (by rw [h3]; exact hE1)) + obtain ⟨ρ, hρ, iρ, ρ0, ρ1, ρt⟩ := exists_interval_map ht0 ht1 ht0' ht1' + let ε' : 𝕀 → X := ε ∘ ρ + have hsurj : range ρ = univ := by + have hsub := intermediate_value_univ (0 : 𝕀) 1 hρ + refine eq_univ_of_forall fun y => hsub ?_ + rw [ρ0, ρ1] + exact ⟨unitInterval.nonneg y, unitInterval.le_one y⟩ + have rK : ∀ s, ζ s ∈ K := fun s => (fK s).2 + have rG : ∀ s, γ s ∈ G := fun s => (fG s).2 + have rE : ∀ s, ε s ∈ E := fun s => (fE s).2 + have bK : ∀ s, ζ s ∈ discBd Q := fun s => hbQ ▸ .inl (rK s) + have bG : ∀ s, γ s ∈ discBd Q := fun s => hbQ ▸ .inr (rG s) + have bK' : ∀ s, ζ s ∈ discBd Q' := fun s => hbQ' ▸ .inl (rK s) + have bE : ∀ s, ε s ∈ discBd Q' := fun s => hbQ' ▸ .inr (rE s) + have onQ : ∀ s, ζ s ∈ Q := fun s => discBd_subset _ (bK s) + have onG : ∀ s, γ s ∈ Q := fun s => discBd_subset _ (bG s) + have onQ' : ∀ s, ζ s ∈ Q' := fun s => discBd_subset _ (bK' s) + have onE : ∀ s, ε s ∈ Q' := fun s => discBd_subset _ (bE s) + have hinjh : InjOn h Q := c.gh.injOn + have hinjh' : InjOn h' Q' := c'.gh.injOn + have arc : ∀ {h₀ : X → ℂ} {D : Set X} {e : 𝕀 → X}, ContinuousOn h₀ D → InjOn h₀ D → Continuous e → + Function.Injective e → (∀ s, e s ∈ D) → IsArcMap (h₀ ∘ e) := fun hc hi he hie hm => + ⟨hc.comp_continuous he hm, fun u v huv => hie (hi (hm u) (hm v) huv)⟩ + have mm : ∀ s u, ζ s = γ u → (s = 0 ∧ u = 0) ∨ (s = 1 ∧ u = 1) := fun s u hsu => by + have h3 : ζ s ∈ K ∩ G := ⟨rK s, hsu ▸ rG u⟩ + rw [hKG] at h3 + rcases h3 with h3 | h3 + · exact .inl ⟨iζ (h3.trans hK0.symm), iγ ((hsu.symm.trans h3).trans hG0.symm)⟩ + · exact .inr ⟨iζ (h3.trans hK1.symm), iγ ((hsu.symm.trans h3).trans hG1.symm)⟩ + have mm' : ∀ s u, ζ s = ε' u → (s = 0 ∧ u = 0) ∨ (s = 1 ∧ u = 1) := fun s u hsu => by + have h3 : ζ s ∈ K ∩ E := ⟨rK s, hsu ▸ rE _⟩ + rw [hKE] at h3 + rcases h3 with h3 | h3 + · refine .inl ⟨iζ (h3.trans hK0.symm), iρ (iε ?_)⟩ + show ε (ρ u) = ε (ρ 0) + rw [ρ0] + exact (hsu.symm.trans h3).trans hE0.symm + · refine .inr ⟨iζ (h3.trans hK1.symm), iρ (iε ?_)⟩ + show ε (ρ u) = ε (ρ 1) + rw [ρ1] + exact (hsu.symm.trans h3).trans hE1.symm + have e0 : γ 0 = ζ 0 := hG0.trans hK0.symm + have e1 : γ 1 = ζ 1 := hG1.trans hK1.symm + have e0' : ε' 0 = ζ 0 := by + change ε (ρ 0) = _ + rw [ρ0] + exact hE0.trans hK0.symm + have e1' : ε' 1 = ζ 1 := by + change ε (ρ 1) = _ + rw [ρ1] + exact hE1.trans hK1.symm + obtain ⟨h₀, k₀, m, hc, hd⟩ := exists_bdMatch_of_arcs (c := h ∘ ζ) (d := h ∘ γ) (c' := h' ∘ ζ) (d' + := h' ∘ ε') + (arc c.hc hinjh hζ iζ onQ) (arc c.hc hinjh hγ iγ onG) (arc c'.hc hinjh' hζ iζ onQ') + (arc c'.hc hinjh' (hε.comp hρ) (iε.comp iρ) fun s => onE _) + (by simp [e0]) (by simp [e1]) (by simp [e0']) (by simp [e1']) + (fun s u hsu => mm s u (hinjh (onQ s) (onG u) hsu)) + (fun s u hsu => mm' s u (hinjh' (onQ' s) (onE _) hsu)) + have sph : range (h ∘ ζ) ∪ range (h ∘ γ) = sphere 0 1 := by + rw [range_comp, range_comp, ← image_union, rζ, rγ, ← hbQ, c.bd] + have sph' : range (h' ∘ ζ) ∪ range (h' ∘ ε') = sphere 0 1 := by + have : range ε' = E := by + change range (ε ∘ ρ) = E + rw [range_comp] + rw [hsurj, image_univ, rε] + rw [range_comp, range_comp, ← image_union, rζ, this, ← hbQ', c'.bd] + rw [sph, sph'] at m + obtain ⟨φ₀⟩ := oArc_sphere + obtain ⟨ψ, χ, m', hψ⟩ := exists_bdMatch_closedInner ⟨φ₀⟩ ⟨φ₀⟩ m + rw [closedInner_sphere] at m' + have hψsph : EqOn ψ h₀ (sphere 0 1) := hψ + have bh : ∀ {x}, x ∈ discBd Q → h x ∈ sphere (0 : ℂ) 1 := fun hx => c.bd ▸ mem_image_of_mem h hx + refine ⟨g' ∘ ψ ∘ h, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · exact c'.gc.comp (m'.2.2.2.2.1.comp c.hc c.hm) (m'.1.comp c.hm) + · intro x hx y hy hxy + have h3 : ψ (h x) = ψ (h y) := c'.hg.injOn (m'.1 (c.hm hx)) (m'.1 (c.hm hy)) hxy + exact hinjh hx hy (m'.2.2.1.injOn (c.hm hx) (c.hm hy) h3) + · ext y + constructor + · rintro ⟨x, hx, rfl⟩ + exact c'.gm (m'.1 (c.hm hx)) + · intro hy + refine ⟨g (χ (h' y)), c.gm (m'.2.1 (c'.hm hy)), ?_⟩ + change g' (ψ (h (g (χ (h' y))))) = y + rw [c.hg (m'.2.1 (c'.hm hy)), m'.2.2.2.1 (c'.hm hy)] + exact c'.gh hy + · intro x hx + obtain ⟨s, rfl⟩ : x ∈ range ζ := rζ ▸ hx + change g' (ψ (h (ζ s))) = ζ s + rw [hψsph (bh (bK s))] + have := hc s + simp only [Function.comp] at this + rw [this] + exact c'.gh (onQ' s) + · change g' (ψ (h (γ t))) = ε t' + rw [hψsph (bh (bG t))] + have := hd t + simp only [Function.comp, ε', ρt] at this + rw [this] + exact c'.gh (onE _) + · have hval : ∀ s, g' (ψ (h (γ s))) = ε (ρ s) := fun s => by + rw [hψsph (bh (bG s))] + have := hd s + simp only [Function.comp, ε'] at this + rw [this, c'.gh (onE _)] + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + obtain ⟨s, rfl⟩ : x ∈ range γ := rγ ▸ hx + change g' (ψ (h (γ s))) ∈ E + rw [hval] + exact rE _ + · intro hy + obtain ⟨u, rfl⟩ : y ∈ range ε := rε ▸ hy + obtain ⟨s, rfl⟩ : u ∈ range ρ := by + rw [hsurj] + exact mem_univ _ + exact ⟨γ s, rG s, hval s⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/IndentRegion.lean b/LeanPool/GraphMinor/GM17/IndentRegion.lean new file mode 100644 index 0000000000..b85da9faa4 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/IndentRegion.lean @@ -0,0 +1,241 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.IndentDisc +public import LeanPool.GraphMinor.GM17.RegionDegree +public import LeanPool.GraphMinor.GM17.RegionFrontier +public import LeanPool.GraphMinor.GM17.BorderArc +import LeanPool.GraphMinor.GM17.PushNode +import LeanPool.GraphMinor.GM17.CuffOrder +import LeanPool.GraphMinor.Surface.HoleDisc +import LeanPool.GraphMinor.Surface.PushOff + +/-! +# The closure of a region, and chords of it + +Suppose that the regions of a painting are open discs with `O`-arcs as frontiers, as (8.1) and (8.2) +of Graph Minors XVII say. Then +the closure of a region is a closed disc (`region_disc`). We cap the cuffs and use `closure_disc`. A +chord of it with ends on `bd(Σ)` +is an `I`-arc to which (8.3) applies. The disc of (8.3) contains one of the two parts of the closed +region (`exists_chord_disc`). These facts +replace the sentences of the proofs of (9.3) and (9.4) on pages 184 and 185 that say what lies +around a region. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology Metric GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +theorem region_outside_off (hS : IsSurface S) {Γ : Painting S} + (hreg : ∀ r ∈ Γ.regions, IsOpen r) {r : Set S} + (hr : r ∈ Γ.regions) {y : S} (hy : y ∈ closure r \ r) (hyN : y ∉ Γ.N) : y ∈ closure + (closure r)ᶜ := by + have ht2 : T2Space S := hS.2.1 + have hyU : y ∈ Γ.U := by + by_contra hn + obtain ⟨r', hr', hyr'⟩ := Painting.exists_region (Γ := Γ) hn + obtain ⟨z, hz, hz'⟩ := mem_closure_iff.mp hy.1 r' (hreg r' hr') hyr' + exact hy.2 (Painting.region_eq hr hr' hz' hz ▸ hyr') + rcases Painting.mem_U_iff.mp hyU with h | ⟨d, hd, hyd⟩ + · exact absurd h hyN + have hdisc := (Γ.cell_disc d hd).1 + refine closure_mono (s := discInt (closure d)) ?_ (hdisc.subset_closure_discInt hyd) + intro z hz hzr + obtain ⟨w, hw, hw'⟩ := mem_closure_iff.mp hzr _ (hdisc.isOpen_discInt hS.2.2) hz + exact disjoint_left.mp (Painting.region_disjoint_closure hr hd) hw' hw.1 + +theorem region_outside (hS : IsSurface S) {Γ : Painting S} + (hreg : ∀ r ∈ Γ.regions, IsOpen r) {r : Set S} + (hr : r ∈ Γ.regions) (hF : IsOArc (closure r \ r)) {y : S} (hy : y ∈ closure r \ r) : y ∈ + closure (closure r)ᶜ := by + have ht2 : T2Space S := hS.2.1 + by_cases hyN : y ∈ Γ.N + · obtain ⟨p, hp, hne⟩ := (infinite_of_isOArc hF).exists_notMem_finite (finite_singleton y) + obtain ⟨A, B, hA, -, hAu, -⟩ := hF.lines hy hp (fun h => hne (h ▸ rfl)) + obtain ⟨q, L, hL, hLA, hLN⟩ := exists_sub_end hA Γ.finite_N + have hsub : L \ {y, q} ⊆ closure (closure r)ᶜ := fun z hz => by + refine region_outside_off hS hreg hr (hAu ▸ .inl (hLA hz.1)) fun hzN => ?_ + exact hz.2 (.inl (hLN ⟨hz.1, hzN⟩)) + exact closure_minimal hsub isClosed_closure (hL.subset_closure_diff hL.left_mem) + · exact region_outside_off hS hreg hr hy hyN + +/-- **The closure of a region is a closed disc.** -/ +theorem region_disc [ConnectedSpace S] (hS : IsSurface S) {Γ : Painting S} + (hreg : ∀ r ∈ Γ.regions, IsOpenDisc r) {r : Set S} + (hr : r ∈ Γ.regions) (hF : IsOArc (closure r \ r)) : IsClosedDisc (closure r) ∧ discBd + (closure r) = closure r \ r := by + have ht2 : T2Space S := hS.2.1 + have hcS : CompactSpace S := hS.1 + obtain ⟨T, tT, j, K, hT, hj, hK, hu, hi, hconnT⟩ := exists_capAll S hS + have hcT : ConnectedSpace T := hconnT inferInstance + have ht2T : T2Space T := hT.2.1 + have hro : IsOpen r := (hreg r hr).1 + have hreg' : ∀ r ∈ Γ.regions, IsOpen r := fun r hr => (hreg r hr).1 + have hrne : r.Nonempty := arcComponentsIn_nonempty hr + have : Nonempty S := hrne.to_subtype.map Subtype.val + have hrsub : ∀ x ∈ r, x ∉ Γ.U := fun x hx => (arcComponentsIn_subset hr hx).2 + have hint : ∀ x ∈ r, x ∉ bd S := fun x hx h => hrsub x hx (Γ.bd_subset h) + have hYK : ∀ x ∈ r, j x ∉ K := fun x hx h => by + have h1 : j x ∈ range j ∩ K := ⟨mem_range_self x, h⟩ + rw [hi] at h1 + obtain ⟨y, hy, he⟩ := h1 + exact hint x hx (hj.injective he ▸ hy) + have hYo : IsOpen (j '' r) := by + have hcl : IsClosed (K ∪ j '' rᶜ) := hK.union (hj.isClosedMap _ hro.isClosed_compl) + convert hcl.isOpen_compl using 1 + ext y + constructor + · rintro ⟨x, hx, rfl⟩ (h | ⟨x', hx', he⟩) + · exact hYK x hx h + · exact hx' (hj.injective he ▸ hx) + · intro h + have hy : y ∈ range j ∪ K := hu ▸ mem_univ y + rcases hy with ⟨x, rfl⟩ | hy + · by_contra h3 + exact h (.inr ⟨x, fun hx => h3 ⟨x, hx, rfl⟩, rfl⟩) + · exact absurd (.inl hy) h + have hclj : closure (j '' r) = j '' closure r := hj.closure_image_eq r + have hsT : IsSurface T := ⟨hT.1, hT.2.1, fun x => (hT.2.2 x).isManifoldPoint⟩ + obtain ⟨e⟩ := (hreg r hr).2 + have hod : IsOpenDisc (j '' r) := ⟨hYo, ⟨e.trans (hj.isEmbedding.homeomorphImage r)⟩⟩ + have hdiff : closure (j '' r) \ j '' r = j '' (closure r \ r) := by + rw [hclj, image_sdiff hj.injective] + obtain ⟨h1, h2⟩ := closure_disc hsT hod + (disjoint_left.mpr fun x _ hb => hb (hT.2.2 x)) + (by + rw [hdiff] + obtain ⟨φ⟩ := hF + exact ⟨φ.trans (hj.isEmbedding.homeomorphImage _)⟩) + (by + rw [hdiff] + rintro _ ⟨x, hx, rfl⟩ + refine closure_mono ?_ (image_closure_subset_closure_image hj.continuous (mem_image_of_mem j + (region_outside hS hreg' hr hF hx))) + rw [hclj] + rintro _ ⟨z, hz, rfl⟩ ⟨z', hz', he⟩ + exact hz (hj.injective he ▸ hz')) + have hsub : closure (j '' r) ⊆ range j := by + rw [hclj] + exact image_subset_range _ _ + obtain ⟨h3, h4⟩ := isClosedDisc_preimage hj h1 hsub + have hp : j ⁻¹' closure (j '' r) = closure r := by + rw [hclj, preimage_image_eq _ hj.injective] + rw [hp] at h3 h4 + refine ⟨h3, ?_⟩ + rw [h4, h2, hdiff, preimage_image_eq _ hj.injective] + +/-- A closed disc whose boundary misses most of a part of a region swallows that part, once they +overlap. -/ +theorem chord_part (hS : IsSurface S) {r F X X' Cx Cx' Δ : Set S} (hΔ : IsClosedDisc Δ) + (h2 : discBd Δ ∩ r ⊆ F) (hX : IsClosedDisc X) (hXu : X ∪ X' = closure r) (hXi : X ∩ X' = F) + (hXb : discBd X = Cx ∪ F) + (hCx' : Cx' ⊆ X') (hC : closure r \ r = Cx ∪ Cx') {w : S} (hwr : w ∈ r) (hwF : w ∉ F) + (hwX : w ∈ X) (hwΔ : w ∈ discInt Δ) : X ⊆ Δ := by + have ht2 : T2Space S := hS.2.1 + have hman := hS.2.2 + have hin : discInt X ⊆ r := fun x hx => by + by_contra h + have hx' : x ∈ closure r \ r := ⟨hXu ▸ .inl hx.1, h⟩ + rw [hC] at hx' + rcases hx' with h3 | h3 + · exact hx.2 (hXb ▸ .inl h3) + · exact hx.2 (hXb ▸ .inr (hXi ▸ ⟨hx.1, hCx' h3⟩)) + have hoff : ∀ x ∈ discInt X, x ∉ F := fun x hx h => hx.2 (hXb ▸ .inr h) + have hsub : discInt X ⊆ discInt Δ ∪ Δᶜ := fun x hx => by + by_cases h : x ∈ Δ + · exact .inl ⟨h, fun h3 => hoff x hx (h2 ⟨h3, hin hx⟩)⟩ + · exact .inr h + have hwX' : w ∈ discInt X := ⟨hwX, fun h => by + rw [hXb] at h + rcases h with h | h + · have h3 : w ∈ closure r \ r := hC ▸ .inl h + exact h3.2 hwr + · exact hwF h⟩ + have hle := hX.isPreconnected_discInt.subset_left_of_subset_union (hΔ.isOpen_discInt hman) + hΔ.isClosed.isOpen_compl + (disjoint_left.mpr fun x hx hx' => hx' hx.1) hsub ⟨w, hwX', hwΔ⟩ + exact hX.subset_closure_discInt.trans (closure_minimal (hle.trans sdiff_subset) hΔ.isClosed) + +theorem chord_side (hS : IsSurface S) {r C₁ C₂ F Δ₁ Δ₂ Δ : Set S} {a b : S} (hrO : IsOpen r) + (hcl : closure r \ r = C₁ ∪ C₂) (hF : IsLineWithEnds F a b) (hFr : F \ {a, b} ⊆ r) + (hd₁ : IsClosedDisc Δ₁) (hd₂ : IsClosedDisc Δ₂) + (hu : Δ₁ ∪ Δ₂ = closure r) (hi : Δ₁ ∩ Δ₂ = F) (hb₁ : discBd Δ₁ = C₁ ∪ F) (hb₂ : discBd Δ₂ + = C₂ ∪ F) (hΔ : IsClosedDisc Δ) + (h1 : F ⊆ discBd Δ) (h2 : discBd Δ ∩ r ⊆ F) : Δ₁ ⊆ Δ ∨ Δ₂ ⊆ Δ := by + have ht2 : T2Space S := hS.2.1 + obtain ⟨z, hz⟩ := line_inner_nonempty hF + have hzr : z ∈ r := hFr hz + obtain ⟨w, hwr, hwΔ⟩ := mem_closure_iff.mp (hΔ.subset_closure_discInt (discBd_subset _ + (h1 hz.1))) r hrO hzr + have hwF : w ∉ F := fun h => hwΔ.2 (h1 h) + have hwR : w ∈ Δ₁ ∪ Δ₂ := hu ▸ subset_closure hwr + have hC₁ : C₁ ⊆ Δ₁ := fun x hx => discBd_subset _ (hb₁ ▸ .inl hx) + have hC₂ : C₂ ⊆ Δ₂ := fun x hx => discBd_subset _ (hb₂ ▸ .inl hx) + rcases hwR with h | h + · exact .inl (chord_part hS hΔ h2 hd₁ hu hi hb₁ hC₂ hcl hwr hwF h hwΔ) + · exact .inr (chord_part hS hΔ h2 hd₂ (by rw [union_comm, hu]) (by rw [inter_comm, + hi]) hb₂ hC₁ (by rw [hcl, union_comm]) hwr hwF h hwΔ) + +/-- A chord of a closed region between two nodes on `bd(Σ)`, with the disc of (8.3). -/ +theorem exists_chord_disc [ConnectedSpace S] (hS : IsSurface S) {Γ : Painting S} + (hreg : ∀ r ∈ Γ.regions, IsOpenDisc r) (hfr : ∀ r ∈ Γ.regions, IsOArc (closure r \ r)) + (h83 : ∀ F : Set S, IsLine F → Γ.IsNormal F → F ∩ bd S = lineEnds F → (F ∩ Γ.N).ncard = 2 → + ∃ Δ : Set S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd S ∧ + Δ ∩ Γ.N ⊆ F ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard = 1) + {r C₁ C₂ : Set S} {a b : S} (hr : r ∈ Γ.regions) (hC₁ : IsLineWithEnds C₁ a b) + (hC₂ : IsLineWithEnds C₂ a b) + (hu : C₁ ∪ C₂ = closure r \ r) (hi : C₁ ∩ C₂ = {a, b}) (haN : a ∈ Γ.N) (hbN : b ∈ Γ.N) + (hab : a ≠ b) + (hab' : a ∈ bd S) (hbb : b ∈ bd S) : + ∃ F Δ₁ Δ₂ Δ, IsLineWithEnds F a b ∧ F \ {a, b} ⊆ r ∧ F ∩ Γ.N = {a, b} ∧ IsClosedDisc Δ₁ + ∧ IsClosedDisc Δ₂ ∧ Δ₁ ∪ Δ₂ = closure r ∧ + Δ₁ ∩ Δ₂ = F ∧ discBd Δ₁ = C₁ ∪ F ∧ discBd Δ₂ = C₂ ∪ F ∧ IsClosedDisc Δ ∧ F ⊆ discBd Δ + ∧ discBd Δ ⊆ F ∪ bd S ∧ Δ ∩ Γ.N ⊆ F ∧ + {c ∈ Γ.C | c ⊆ Δ}.ncard = 1 ∧ (∀ x ∈ Δ \ F, Δ ∈ 𝓝 x) ∧ (Δ₁ ⊆ Δ ∨ Δ₂ ⊆ Δ) := by + have ht2 : T2Space S := hS.2.1 + obtain ⟨hdR, hbR⟩ := region_disc hS hreg hr (hfr r hr) + obtain ⟨F, Δ₁, Δ₂, hF, hFb, hFR, hd₁, hd₂, hu', hi', hb₁, hb₂⟩ := + split_disc hdR hC₁ hC₂ hab (hu.trans hbR.symm) hi + have hFr : F \ {a, b} ⊆ r := fun x hx => by + by_contra h + have h3 : x ∈ F ∩ discBd (closure r) := ⟨hx.1, hbR ▸ ⟨hFR hx.1, h⟩⟩ + rw [hFb] at h3 + exact hx.2 h3 + have hrU : ∀ x ∈ r, x ∉ Γ.U := fun x hx => (arcComponentsIn_subset hr hx).2 + have hrb : Disjoint r (bd S) := disjoint_left.mpr fun x hx h => hrU x hx (Γ.bd_subset h) + have hFend : ∀ x ∈ F, x ∉ r → x = a ∨ x = b := fun x hx h => by_contra fun h3 => h (hFr ⟨hx, h3⟩) + have hFN : F ∩ Γ.N = {a, b} := by + refine Subset.antisymm (fun x hx => hFend x hx.1 fun h => hrU x h (Γ.N_subset hx.2)) ?_ + rintro x (rfl | rfl) + · exact ⟨hF.left_mem, haN⟩ + · exact ⟨hF.right_mem, hbN⟩ + have hFbd : F ∩ bd S = lineEnds F := by + rw [lineEnds_eq hF] + refine Subset.antisymm (fun x hx => hFend x hx.1 fun h => disjoint_left.mp hrb h hx.2) ?_ + rintro x (rfl | rfl) + · exact ⟨hF.left_mem, hab'⟩ + · exact ⟨hF.right_mem, hbb⟩ + obtain ⟨Δ, hΔ, h1, h2, h3, h4⟩ := h83 F ⟨hF.choose⟩ + (fun x hx => (hFN ▸ (show x ∈ ({a, b} : Set S) from hFend x hx.1 fun h + => hrU x h hx.2) : x ∈ F ∩ Γ.N).2) hFbd + (by rw [hFN, ncard_pair hab]) + have hFb : F ∩ bd S = {a, b} := by + rw [← lineEnds_eq hF, hFbd] + obtain ⟨-, -, -, -, -, -, -, -, -, -, -, hnb⟩ := arc_disc_data hS hF hFb hΔ h1 h2 + exact ⟨F, Δ₁, Δ₂, Δ, hF, hFr, hFN, hd₁, hd₂, hu', hi', hb₁, hb₂, hΔ, h1, h2, h3, h4, hnb, + chord_side hS (hreg r hr).1 hu.symm hF hFr hd₁ hd₂ hu' hi' hb₁ hb₂ hΔ h1 (fun x hx => + (h2 hx.1).elim id fun hb => (disjoint_left.mp hrb hx.2 hb).elim)⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/MarkCross.lean b/LeanPool/GraphMinor/GM17/MarkCross.lean new file mode 100644 index 0000000000..70e6da9bcd --- /dev/null +++ b/LeanPool/GraphMinor/GM17/MarkCross.lean @@ -0,0 +1,508 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.ReplaceDisc +public import LeanPool.GraphMinor.Surface.Crossing + +/-! +# Marked nodes on an arc of a cuff + +This file has the tools for `NormalIArcDiscRegionStatement`: a choice of a gap in a noncrossing +partition (`exists_gap`), and the circular +order of points along an arc of an `O`-arc (`inOrder_of_arc`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +/-- Let `R` be an equivalence relation on a finite linear order whose classes do not cross, and let +`P` be constant on classes, true at the +least point and false at the last point. Then there is a pair of consecutive points with `P` true +and false, and no class has points on +both sides of the pair. -/ +theorem exists_gap {α : Type*} [LinearOrder α] (T : Finset α) (R : α → α → Prop) (P : α → Prop) + (hrefl : ∀ a ∈ T, R a a) + (_hsymm : ∀ a b, R a b → R b a) (htrans : ∀ a b c, R a b → R b c → R a c) + (hP : ∀ a ∈ T, ∀ b ∈ T, R a b → P a → P b) + (hcross : ∀ a ∈ T, ∀ b ∈ T, ∀ a' ∈ T, ∀ b' ∈ T, a < b → b < a' → a' < b' → R a a' → R b b' + → R a b) {t₀ t₁ : α} (h₀ : t₀ ∈ T) (h₁ : t₁ ∈ T) + (hmin : ∀ t ∈ T, t₀ ≤ t) (hmax : ∀ t ∈ T, t ≤ t₁) (hP₀ : P t₀) (hP₁ : ¬ P t₁) : + ∃ p ∈ T, ∃ q ∈ T, p < q ∧ P p ∧ ¬ P q ∧ (∀ t ∈ T, t ≤ p ∨ q ≤ t) ∧ ∀ a ∈ T, ∀ b ∈ T, a ≤ p → q + ≤ b → ¬ R a b := by + classical + have hclosed : ∀ s ∈ T, (∀ a ∈ T, ∀ b ∈ T, a ≤ s → s < b → R s a → False) → True := fun _ _ _ + => trivial + have hM : ∀ s ∈ T, ∃ m ∈ T, R s m ∧ ∀ b ∈ T, R s b → b ≤ m := fun s hs => by + have hne : (T.filter (R s)).Nonempty := ⟨s, by simp [hs, hrefl s hs]⟩ + refine ⟨(T.filter (R s)).max' hne, (Finset.mem_filter.mp (Finset.max'_mem _ hne)).1, + (Finset.mem_filter.mp (Finset.max'_mem _ hne)).2, fun b hb hR => ?_⟩ + exact Finset.le_max' _ _ (by simp [hb, hR]) + let Cl : α → Prop := fun s => ∀ a ∈ T, ∀ b ∈ T, a ≤ s → s < b → ¬ R a b + obtain ⟨p₀, hp₀, hRp₀, hmaxp₀⟩ := hM t₀ h₀ + have hstep : ∀ s ∈ T, ∀ r ∈ T, s ≤ r → R s r → (∀ b ∈ T, R s b → b ≤ r) → + (∀ a ∈ T, ∀ b ∈ T, a < s → r < b → ¬ R a b) → Cl r := by + intro s hs r hr hsr hR hm hlow a ha b hb har hrb hab + rcases lt_or_ge a s with h | h + · exact hlow a ha b hb h hrb hab + rcases eq_or_lt_of_le h with rfl | h + · exact absurd (hm b hb hab) (not_le.mpr hrb) + rcases eq_or_lt_of_le har with rfl | h' + · exact absurd (hm b hb (htrans _ _ _ hR hab)) (not_le.mpr hrb) + have h3 := hcross s hs a ha r hr b hb h h' hrb hR hab + exact absurd (hm b hb (htrans _ _ _ h3 hab)) (not_le.mpr hrb) + have hCp₀ : Cl p₀ := hstep t₀ h₀ p₀ hp₀ (hmin _ hp₀) hRp₀ hmaxp₀ fun a ha b hb h => absurd + (hmin a ha) (not_le.mpr h) + have hne : (T.filter fun s => P s ∧ Cl s).Nonempty := by + exact ⟨p₀, Finset.mem_filter.mpr ⟨hp₀, hP _ h₀ _ hp₀ hRp₀ hP₀, hCp₀⟩⟩ + let p := (T.filter fun s => P s ∧ Cl s).max' hne + have hpm := Finset.mem_filter.mp (Finset.max'_mem _ hne) + have hpT : p ∈ T := hpm.1 + have hpP : P p := hpm.2.1 + have hpC : Cl p := hpm.2.2 + have hplt : p < t₁ := lt_of_le_of_ne (hmax p hpT) fun h => hP₁ (h ▸ hpP) + have hne2 : (T.filter fun s => p < s).Nonempty := + ⟨t₁, Finset.mem_filter.mpr ⟨h₁, hplt⟩⟩ + let q := (T.filter fun s => p < s).min' hne2 + have hqm := Finset.mem_filter.mp (Finset.min'_mem _ hne2) + have hqT : q ∈ T := hqm.1 + have hpq : p < q := hqm.2 + have hgap : ∀ t ∈ T, t ≤ p ∨ q ≤ t := fun t ht => by + rcases le_or_gt t p with h | h + · exact .inl h + · exact .inr (Finset.min'_le _ _ (by simp only [Finset.mem_filter]; exact ⟨ht, h⟩)) + have hPq : ¬ P q := by + intro hq + obtain ⟨r, hr, hRr, hmr⟩ := hM q hqT + have hqr : q ≤ r := hmr q hqT (hrefl q hqT) + have hCr : Cl r := hstep q hqT r hr hqr hRr hmr fun a ha b hb h hrb hab => by + refine hpC a ha b hb ?_ (lt_of_lt_of_le hpq (hqr.trans hrb.le)) hab + exact (hgap a ha).resolve_right (not_le.mpr h) + have h3 : r ≤ p := Finset.le_max' _ _ (by simp only [Finset.mem_filter]; exact ⟨hr, hP _ hqT _ + hr hRr hq, hCr⟩) + exact absurd (lt_of_lt_of_le hpq hqr) (not_lt.mpr h3) + exact ⟨p, hpT, q, hqT, hpq, hpP, hPq, hgap, fun a ha b hb h3 h4 => hpC a ha b hb h3 + (lt_of_lt_of_le hpq h4)⟩ + +variable {S : Type} [TopologicalSpace S] + +/-- The part of an arc between two parameters is a line. -/ +theorem isLine_piece [T2Space S] {a : unitInterval → S} (ha : IsArcMap a) {s r : unitInterval} + (h : s < r) : + IsLineWithEnds (a '' Icc s r) (a s) (a r) := by + have h1 := (isArcMap_pieceA ha s.2.1 (Subtype.coe_lt_coe.mpr h) r.2.2).isLineWithEnds + rw [pieceA_zero, pieceA_one, extI_coe, extI_coe, range_pieceA a s.2.1 + (Subtype.coe_lt_coe.mpr h).le r.2.2] at h1 + convert h1 using 1 + ext y + constructor + · rintro ⟨t, ht, rfl⟩ + exact ⟨t, ⟨ht.1, ht.2⟩, extI_coe a t⟩ + · rintro ⟨t, ht, rfl⟩ + have ht0 : t ∈ Icc (0 : ℝ) 1 := ⟨s.2.1.trans ht.1, ht.2.trans r.2.2⟩ + exact ⟨⟨t, ht0⟩, ⟨ht.1, ht.2⟩, (extI_of_mem a ht0).symm⟩ + +/-- Points along an arc of an `O`-arc are in circular order. -/ +theorem inOrder_of_arc [T2Space S] {Θ : Set S} (hO : IsOArc Θ) {a : unitInterval → S} + (ha : IsArcMap a) (hs : ∀ t, a t ∈ Θ) + {s₁ s₂ s₃ s₄ : unitInterval} (h12 : s₁ ≤ s₂) (h23 : s₂ ≤ s₃) (h34 : s₃ ≤ s₄) : GM19.InOrderOn Θ + (a s₁) (a s₂) (a s₃) (a s₄) := by + rcases eq_or_lt_of_le (h12.trans h23) with h | h + · obtain rfl : s₁ = s₂ := le_antisymm h12 (h23.trans h.ge) + obtain rfl : s₁ = s₃ := h + obtain ⟨f⟩ := id hO + obtain ⟨t, -, e⟩ := exists_cuffPoint_mem_Ico f 0 (hs s₁) + obtain ⟨t', ht', e'⟩ := exists_cuffPoint_mem_Ico f t (hs s₄) + exact ⟨f, t, t, t, t', le_rfl, le_rfl, ht'.1, ht'.2.le, e, e, e, e'⟩ + · have hL := isLine_piece ha h + obtain ⟨L', hL', hu, -⟩ := oarc_split hO hL (by rintro _ ⟨t, -, rfl⟩; exact hs t) + refine inOrder_of_lines hO hL hL' hu ⟨s₂, ⟨h12, h23⟩, rfl⟩ ?_ + rcases eq_or_lt_of_le h34 with rfl | h3 + · exact hL'.right_mem + · have h5 : a s₄ ∈ a '' Icc s₁ s₃ ∪ L' := hu ▸ hs s₄ + refine h5.resolve_left ?_ + rintro ⟨t, ht, he⟩ + have h6 := ha.2 he + exact absurd (h6 ▸ ht.2) (not_le.mpr h3) + +/-- Two points on opposite lines of a circle cross the ends of the lines. -/ +theorem pairsCross_of_lines [T2Space S] {C J₁ J₂ : Set S} {x y b d : S} + (hJ₁ : IsLineWithEnds J₁ x y) (hJ₂ : IsLineWithEnds J₂ x y) (hu : J₁ ∪ J₂ = C) + (hi : J₁ ∩ J₂ = {x, y}) (hb : b ∈ J₁) (hd : d ∈ J₂) (hbx : b ≠ x) (hby : b ≠ y) (hdx : d ≠ x) + (hdy : d ≠ y) : PairsCrossOn C x y b d := by + have hbC : b ∈ C := hu ▸ .inl hb + have hdC : d ∈ C := hu ▸ .inr hd + have hne : b ≠ d := by + rintro rfl + have h3 : b ∈ J₁ ∩ J₂ := ⟨hb, hd⟩ + rw [hi] at h3 + rcases h3 with h3 | h3 + · exact hbx h3 + · exact hby h3 + refine ⟨hu ▸ .inl hJ₁.left_mem, hbC, hu ▸ .inl hJ₁.right_mem, hdC, hJ₁.ne', hne, hbx.symm, + hdx.symm, hby.symm, hdy.symm, fun he => ?_⟩ + have hbm : b ∈ C \ {x, y} := ⟨hbC, by rintro (h | h); exacts [hbx h, hby h]⟩ + have hdm : d ∈ C \ {x, y} := ⟨hdC, by rintro (h | h); exacts [hdx h, hdy h]⟩ + have hd' : d ∈ connectedComponentIn (C \ {x, y}) b := he ▸ mem_connectedComponentIn hdm + have hsub := connectedComponentIn_subset (C \ {x, y}) b + obtain ⟨z, hz, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp isPreconnected_connectedComponentIn J₁ + J₂ hJ₁.isCompact.isClosed hJ₂.isCompact.isClosed + (fun z hz => hu ▸ (hsub hz).1) ⟨b, mem_connectedComponentIn hbm, hb⟩ ⟨d, hd', hd⟩ + exact (hsub hz).2 (hi ▸ ⟨hz₁, hz₂⟩) + +/-- Two nodes are linked if a chain of cells of the family `G` joins them, where `e d` is what cell +`d` joins. -/ +def Linked (G : Set (Set S)) (e : Set S → Set S) : S → S → Prop := + Relation.EqvGen fun u v => ∃ d ∈ G, u ∈ e d ∧ v ∈ e d + +/-- The nodes in `Q` linked to `x`, with the cells that link them. -/ +def linkedPart (Q : Set S) (G : Set (Set S)) (e : Set S → Set S) (x : S) : Set S := + {y ∈ Q | Linked G e x y} ∪ ⋃₀ {d ∈ G | ∃ y ∈ e d, Linked G e x y} + +section + +variable {Q : Set S} {G : Set (Set S)} {e : Set S → Set S} + +omit [TopologicalSpace S] in +theorem Linked.mem_iff (hQ : ∀ d ∈ G, e d ⊆ Q) {u v : S} (h : Linked G e u v) : u ∈ Q ↔ v ∈ Q := by + induction h with + | rel u v h => + obtain ⟨d, hd, hu, hv⟩ := h + exact ⟨fun _ => hQ d hd hv, fun _ => hQ d hd hu⟩ + | refl u => rfl + | symm u v _ ih => exact ih.symm + | trans u v w _ _ ih₁ ih₂ => exact ih₁.trans ih₂ + +theorem linkedPart_isPathConnected (hQ : ∀ d ∈ G, e d ⊆ Q) (hG : ∀ d ∈ G, IsPathConnected + (d ∪ e d)) {x : S} (hx : x ∈ Q) : + IsPathConnected (linkedPart Q G e x) := by + set P := linkedPart Q G e x with hP + have hcell : ∀ d ∈ G, ∀ y ∈ e d, Linked G e x y → d ∪ e d ⊆ P := by + intro d hd y hy hl z hz + rcases hz with hz | hz + · exact .inr ⟨d, ⟨hd, y, hy, hl⟩, hz⟩ + · exact .inl ⟨hQ d hd hz, hl.trans _ _ _ (.rel _ _ ⟨d, hd, hy, hz⟩)⟩ + have key : ∀ u v, Linked G e u v → Linked G e x u → JoinedIn P u v := by + intro u v h + induction h with + | rel u v h => + intro hl + obtain ⟨d, hd, hu, hv⟩ := h + exact ((hG d hd).joinedIn u (.inr hu) v (.inr hv)).mono (hcell d hd u hu hl) + | refl u => + intro hl + exact JoinedIn.refl (.inl ⟨(hl.mem_iff hQ).mp hx, hl⟩) + | symm u v h ih => + intro hl + exact (ih (hl.trans _ _ _ (.symm _ _ h))).symm + | trans u v w h _ ih₁ ih₂ => + intro hl + exact (ih₁ hl).trans (ih₂ (hl.trans _ _ _ h)) + refine ⟨x, .inl ⟨hx, .refl _⟩, fun y hy => ?_⟩ + rcases hy with hy | ⟨d, ⟨hd, z, hz, hl⟩, hy⟩ + · exact key x y hy.2 (.refl _) + · exact (key x z hl (.refl _)).trans (((hG d hd).joinedIn z (.inr hz) y (.inl hy)).mono + (hcell d hd z hz hl)) + +omit [TopologicalSpace S] in +/-- Two parts meet only if they are parts of one class. -/ +theorem linked_of_part (hQ : Disjoint Q (⋃₀ G)) (hdis : G.PairwiseDisjoint id) {x x' z : S} + (hz : z ∈ linkedPart Q G e x) (hz' : z ∈ linkedPart Q G e x') : + Linked G e x x' := by + rcases hz with hz | ⟨d, ⟨hd, y, hy, hl⟩, hzd⟩ + · rcases hz' with hz' | ⟨d, ⟨hd, -⟩, hzd⟩ + · exact hz.2.trans _ _ _ (.symm _ _ hz'.2) + · exact absurd (subset_sUnion_of_mem hd hzd) (disjoint_left.mp hQ hz.1) + · rcases hz' with hz' | ⟨d', ⟨hd', y', hy', hl'⟩, hzd'⟩ + · exact absurd (subset_sUnion_of_mem hd hzd) (disjoint_left.mp hQ hz'.1) + · have hdd : d = d' := by + by_contra hne + exact disjoint_left.mp (hdis hd hd' hne) hzd hzd' + subst hdd + exact (hl.trans _ _ _ (.rel _ _ ⟨d, hd, hy, hy'⟩)).trans _ _ _ (.symm _ _ hl') + +end + +/-- Two linked pairs whose endpoints alternate on a disc boundary belong to the same +linked component. -/ +theorem linked_of_alternating_ends {S : Type} [TopologicalSpace S] [T2Space S] + {Δ : Set S} (hΔ : IsClosedDisc Δ) {G : Set (Set S)} {e : Set S → Set S} {Q : Set S} + (hQΔ : Q ⊆ Δ) (hGΔ : ∀ d ∈ G, d ⊆ Δ) + (hGQ : ∀ d ∈ G, e d ⊆ Q) (hGpc : ∀ d ∈ G, IsPathConnected (d ∪ e d)) + (hQdis : Disjoint Q (⋃₀ G)) (hGdis : G.PairwiseDisjoint id) + {α : unitInterval → S} (ha : IsArcMap α) (hαbd : ∀ t, α t ∈ discBd Δ) + {T : Finset unitInterval} (hαQ : ∀ t ∈ T, α t ∈ Q) : + ∀ a ∈ T, ∀ b ∈ T, ∀ a' ∈ T, ∀ b' ∈ T, + a < b → b < a' → a' < b' → Linked G e (α a) (α a') → + Linked G e (α b) (α b') → Linked G e (α a) (α b) := by + intro a ha' b hb' a' ha'' b' hb'' hab hba hab' hla hlb + have hJ := isLine_piece ha (hab.trans hba) + have hO : IsOArc (discBd Δ) := hΔ.isOArc_discBd + have hJs : α '' Icc a a' ⊆ discBd Δ := by + rintro _ ⟨t, -, rfl⟩ + exact hαbd t + obtain ⟨J₂, hJ₂, hJu, hJi⟩ := oarc_split hO hJ hJs + have hb1 : α b' ∈ α '' Icc a a' ∪ J₂ := hJu ▸ hαbd b' + have hb2 : α b' ∈ J₂ := hb1.resolve_left fun ⟨t, ht, h9⟩ => absurd (ha.2 h9 ▸ ht.2) + (not_le.mpr hab') + have hcr := pairsCross_of_lines hJ hJ₂ hJu hJi ⟨b, ⟨hab.le, hba.le⟩, rfl⟩ hb2 (fun h9 => hab.ne + (ha.2 h9).symm) + (fun h9 => hba.ne (ha.2 h9)) (fun h9 => (hab.trans (hba.trans hab')).ne (ha.2 h9).symm) + (fun h9 => hab'.ne (ha.2 h9).symm) + have hQa : α a ∈ Q := hαQ a ha' + have hQb : α b ∈ Q := hαQ b hb' + have hsubP : ∀ x ∈ Q, linkedPart Q G e x ⊆ Δ := fun x _ => by + rintro z (hz | ⟨d, hd, hz⟩) + · exact hQΔ hz.1 + · exact hGΔ d hd.1 hz + obtain ⟨z, hz, hz'⟩ := disc_crossing.of_isPathConnected Δ _ _ (α a) (α a') (α b) (α b') hΔ + (hsubP _ hQa) (hsubP _ hQb) + (linkedPart_isPathConnected hGQ hGpc hQa) (linkedPart_isPathConnected hGQ hGpc hQb) + (.inl ⟨hQa, .refl _⟩) (.inl ⟨hαQ a' ha'', hla⟩) (.inl ⟨hQb, .refl _⟩) + (.inl ⟨hαQ b' hb'', hlb⟩) hcr + exact linked_of_part hQdis hGdis hz hz' + +/-- The surface part of (7.3) of Graph Minors XVII, page 179. Among the marked nodes on the arc `I` +we pick a place where marked meets unmarked, +in a gap that no linked pair spans. Linked pairs do not cross because of the crossing theorem for a +disc. -/ +theorem normalIArcDiscRegion_of_boundary + (S : Type) [TopologicalSpace S] (hS : IsSurface S) + (Γ : Painting S) (Θ : Set S) (n₁ n₂ : S) (F Δ : Set S) + (e : Set S → Set S) (P_mark : S → Prop) + (hΘ : Θ ∈ cuffs S) (hn₁ : n₁ ∈ Γ.N ∩ Θ) (hn₂ : n₂ ∈ Γ.N ∩ Θ) (hne : n₁ ≠ n₂) + (hnorm : Γ.IsNormal F) (hF : IsLineWithEnds F n₁ n₂) (hb : F ∩ bd S = {n₁, n₂}) + (hΔ : IsClosedDisc Δ) (h1 : F ⊆ discBd Δ) (h2 : discBd Δ ⊆ F ∪ Θ) + (he : ∀ d ∈ Γ.C, d ⊆ Δ → ¬ (d ∩ bd S).Nonempty → + e d ⊆ tilde d ∧ (e d = ∅ ∨ 2 ≤ (e d).ncard) ∧ + ∀ x ∈ e d, ∀ y ∈ e d, P_mark x → P_mark y) + (hP₁ : P_mark n₁) (hP₂ : ¬ P_mark n₂) : + ∃ (m₁ m₂ : S) (c I₁ I₂ N₁ N₂ : Set S), + m₁ ∈ Γ.N ∩ (Θ ∩ discBd Δ) ∧ m₂ ∈ Γ.N ∩ (Θ ∩ discBd Δ) ∧ m₁ ≠ m₂ ∧ + P_mark m₁ ∧ ¬ P_mark m₂ ∧ + c ∈ Γ.C ∧ c ⊆ Δ ∧ (c ∩ Θ).Nonempty ∧ tilde c = {m₁, m₂} ∧ + I₁ ⊆ Θ ∩ discBd Δ ∧ I₂ ⊆ Θ ∩ discBd Δ ∧ Disjoint I₁ I₂ ∧ + n₁ ∈ I₁ ∧ m₁ ∈ I₁ ∧ m₂ ∈ I₂ ∧ n₂ ∈ I₂ ∧ + N₁ ⊆ (Γ.N ∩ Δ) \ bd S ∧ N₂ ⊆ (Γ.N ∩ Δ) \ bd S ∧ Disjoint N₁ N₂ ∧ + (∀ n ∈ I₁ ∩ Γ.N, ∀ n' ∈ I₂ ∩ Γ.N, + (n ≠ n₁ → n ≠ m₁ → GM19.InOrderOn Θ n₁ n m₁ n') ∧ + (m₁ ≠ n₁ → n' ≠ n₂ → GM19.InOrderOn Θ n₁ m₁ n' n₂) ∧ + (n' ≠ m₂ → n' ≠ n₂ → GM19.InOrderOn Θ n m₂ n' n₂) ∧ + (n ≠ n₁ → m₂ ≠ n₂ → GM19.InOrderOn Θ n₁ n m₂ n₂)) ∧ + (∀ d ∈ Γ.C, d ⊆ Δ → (d ∩ bd S).Nonempty → d ≠ c → + tilde d ⊆ I₁ ∨ tilde d ⊆ I₂) ∧ + (∀ d ∈ Γ.C, d ⊆ Δ → ¬ (d ∩ bd S).Nonempty → + e d ⊆ N₁ ∪ I₁ ∨ e d ⊆ N₂ ∪ I₂) ∧ + (∃ c₁ ∈ Γ.C, c₁ ⊆ Δ ∧ (c₁ ∩ bd S).Nonempty ∧ n₁ ∈ tilde c₁) ∧ + (∃ c₂ ∈ Γ.C, c₂ ⊆ Δ ∧ (c₂ ∩ bd S).Nonempty ∧ n₂ ∈ tilde c₂) := by + have ht2 : T2Space S := hS.2.1 + have hΘb : Θ ⊆ bd S := by + obtain ⟨x, -, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + obtain ⟨I, I', Θ', hΘ', hI, hI', hu', hi', hu, hi, hmeet, hnb⟩ := arc_disc_data hS hF hb hΔ h1 + (h2.trans (union_subset_union_right _ hΘb)) + have hΘeq : Θ' = Θ := cuffs_disjoint_eq hΘ' hΘ (hu' ▸ .inl hI.left_mem) hn₁.2 + subst hΘeq + have hcl := hΔ.isClosed + have hIΘ : I ⊆ Θ' := fun z hz => hu' ▸ .inl hz + have hbdΔ : discBd Δ ⊆ Δ := by + rintro _ ⟨z, -, rfl⟩ + exact z.2 + have hIbd : I ⊆ discBd Δ := fun z hz => hu ▸ .inr hz + have hIΔ : I ⊆ Δ := hIbd.trans hbdΔ + have hside : ∀ c ∈ Γ.C, c ⊆ Δ ∨ c ⊆ Δᶜ := fun c hc => cell_side hc hnorm hΔ hnb + obtain ⟨c₁, hc₁, h3, h4, h5, -⟩ := exists_border_cell hI (hIΘ.trans hΘb) hIΔ hn₁.1 hside + obtain ⟨c₂, hc₂, h6, h7, h8, -⟩ := exists_border_cell hI.symm (hIΘ.trans hΘb) hIΔ hn₂.1 hside + let G : Set (Set S) := {d ∈ Γ.C | d ⊆ Δ ∧ ¬ (d ∩ bd S).Nonempty} + let Q : Set S := Γ.N ∩ Δ + have hGQ : ∀ d ∈ G, e d ⊆ Q := fun d hd x hx => by + have h9 := (he d hd.1 hd.2.1 hd.2.2).1 hx + exact ⟨Γ.tilde_subset_N hd.1 h9, closure_minimal hd.2.1 hcl h9.1⟩ + have hGpc : ∀ d ∈ G, IsPathConnected (d ∪ e d) := fun d hd => by + have h9 := (he d hd.1 hd.2.1 hd.2.2).1 + refine isPathConnected_of_isClosedDisc_finite_diff (Γ.isClosedDisc_closure_cell hd.1) + (union_subset subset_closure (h9.trans sdiff_subset)) (Γ.finite_N.subset fun x hx => ?_) + refine Γ.tilde_subset_N hd.1 ⟨hx.1, fun h => hx.2 (.inl h)⟩ + have hQdis : Disjoint Q (⋃₀ G) := disjoint_left.mpr fun x hx ⟨d, hd, hxd⟩ => + (arcComponentsIn_subset hd.1 hxd).2 hx.1 + have hGdis : G.PairwiseDisjoint id := fun d hd d' hd' hne => arcComponentsIn_disjoint hd.1 hd'.1 + hne + obtain ⟨α, ha, hr, rfl, rfl⟩ := hI.exists_arc + have hαI : ∀ t, α t ∈ I := fun t => hr ▸ mem_range_self t + have hTfin : (α ⁻¹' Γ.N).Finite := Γ.finite_N.preimage ha.2.injOn + let T : Finset unitInterval := hTfin.toFinset + have hT : ∀ {t}, t ∈ T ↔ α t ∈ Γ.N := by + intro t + exact hTfin.mem_toFinset + have hPrel : ∀ u v, Linked G e u v → (P_mark u ↔ P_mark v) := by + intro u v h + induction h with + | rel u v h => + obtain ⟨d, hd, hu, hv⟩ := h + have h9 := (he d hd.1 hd.2.1 hd.2.2).2.2 + exact ⟨fun h => h9 u hu v hv h, fun h => h9 v hv u hu h⟩ + | refl u => rfl + | symm u v _ ih => exact ih.symm + | trans u v w _ _ ih₁ ih₂ => exact ih₁.trans ih₂ + have hcross := linked_of_alternating_ends hΔ (G := G) (Q := Q) inter_subset_right + (fun _ hd => hd.2.1) hGQ hGpc hQdis hGdis ha + (fun t => hIbd (hαI t)) (T := T) (fun t ht => ⟨hT.mp ht, hIΔ (hαI t)⟩) + obtain ⟨p, hp, q, hq, hpq, hPp, hPq, hgap, hnol⟩ := exists_gap T (fun s t => Linked G e (α s) + (α t)) (fun s => P_mark (α s)) + (fun a _ => .refl _) (fun a b h => .symm _ _ h) (fun a b c h h' => .trans _ _ _ h h') + (fun a _ b _ h => (hPrel _ _ h).mp) hcross (hT.mpr hn₁.1) (hT.mpr hn₂.1) (fun _ _ + => unitInterval.nonneg') (fun _ _ => unitInterval.le_one') hP₁ hP₂ + have hLZ := isLine_piece ha hpq + obtain ⟨hZne, hZpc⟩ := isPathConnected_diff_ends_of_isLineWithEnds hLZ + set Z := α '' Icc p q \ {α p, α q} with hZdef + have hZt : ∀ z ∈ Z, ∃ t, p < t ∧ t < q ∧ α t = z := by + rintro _ ⟨⟨t, ht, rfl⟩, h9⟩ + refine ⟨t, lt_of_le_of_ne ht.1 fun h => h9 (.inl (h ▸ rfl)), lt_of_le_of_ne ht.2 fun h => h9 + (.inr (h ▸ rfl)), rfl⟩ + have hnoN : ∀ t, p < t → t < q → α t ∉ Γ.N := fun t h9 h10 h => by + rcases hgap t (hT.mpr h) with h11 | h11 + · exact absurd h11 (not_le.mpr h9) + · exact absurd h11 (not_le.mpr h10) + have hZsub : Z ⊆ Γ.U \ Γ.N := fun z hz => by + obtain ⟨t, h9, h10, rfl⟩ := hZt z hz + exact ⟨Γ.bd_subset (hΘb (hIΘ (hαI t))), hnoN t h9 h10⟩ + obtain ⟨z₀, hz₀⟩ := hZne + obtain ⟨c, hc, hz₀c⟩ := exists_mem_arcComponentsIn (hZsub hz₀) + have hZc : Z ⊆ c := subset_arcComponent_of_isPathConnected hc hZsub hZpc ⟨z₀, hz₀, hz₀c⟩ + have hz₀I : z₀ ∈ I := by + obtain ⟨t, -, -, rfl⟩ := hZt z₀ hz₀ + exact hαI t + have hcΔ : c ⊆ Δ := (hside c hc).resolve_right fun h => h hz₀c (hIΔ hz₀I) + have hcb : (c ∩ bd S).Nonempty := ⟨z₀, hz₀c, hΘb (hIΘ hz₀I)⟩ + have htc : tilde c = {α p, α q} := by + obtain ⟨u, v, huv, htilde, -, hdiff, -, -⟩ := Γ.border_cell_exists_ends hc hcb + have hend : ∀ x ∈ α '' Icc p q, x ∈ Γ.N → x ∈ tilde c := fun x hx hxN => + ⟨closure_mono hZc (hLZ.subset_closure_diff hx), fun h => (arcComponentsIn_subset hc h).2 hxN⟩ + have h9 := hend _ hLZ.left_mem (hT.mp hp) + have h10 := hend _ hLZ.right_mem (hT.mp hq) + have hpq' : α p ≠ α q := hLZ.ne' + rw [htilde] at h9 h10 ⊢ + rcases h9 with h9 | h9 <;> rcases h10 with h10 | h10 + · exact absurd (h9.trans h10.symm) hpq' + · rw [h9, h10] + · rw [h9, h10, pair_comm] + · exact absurd (h9.trans h10.symm) hpq' + have hIcl : ∀ s r : unitInterval, IsClosed (α '' Icc s r) := fun s r => + (isCompact_Icc.image ha.1).isClosed + let I₁ : Set S := α '' Icc 0 p + let I₂ : Set S := α '' Icc q 1 + have hI₁I : I₁ ⊆ I := by + rintro _ ⟨t, -, rfl⟩ + exact hαI t + have hI₂I : I₂ ⊆ I := by + rintro _ ⟨t, -, rfl⟩ + exact hαI t + have hI₁₂ : Disjoint I₁ I₂ := disjoint_left.mpr fun x ⟨t, ht, h9⟩ ⟨t', ht', h10⟩ => by + have h11 := ha.2 (h9.trans h10.symm) + exact absurd (ht.2.trans_lt (hpq.trans_le ht'.1)) (by rw [h11]; exact lt_irrefl _) + have hnode : ∀ x ∈ Q, x ∉ bd S ∨ x ∈ I₁ ∨ x ∈ I₂ := fun x hx => by + by_cases hxb : x ∈ bd S + · right + have h9 : x ∈ I := hmeet ▸ ⟨hx.2, hxb⟩ + rw [← hr] at h9 + obtain ⟨t, rfl⟩ := h9 + rcases hgap t (hT.mpr hx.1) with h10 | h10 + · exact .inl ⟨t, ⟨unitInterval.nonneg', h10⟩, rfl⟩ + · exact .inr ⟨t, ⟨h10, unitInterval.le_one'⟩, rfl⟩ + · exact .inl hxb + have hnl : ∀ x ∈ I₁, ∀ y ∈ I₂, x ∈ Γ.N → y ∈ Γ.N → ¬ Linked G e x y := by + rintro _ ⟨s, hs, rfl⟩ _ ⟨t, ht, rfl⟩ hx hy + exact hnol s (hT.mpr hx) t (hT.mpr hy) hs.2 ht.1 + let N₁ : Set S := {y ∈ (Γ.N ∩ Δ) \ bd S | ∃ w ∈ I₁ ∩ Γ.N, Linked G e w y} + let N₂ : Set S := ((Γ.N ∩ Δ) \ bd S) \ N₁ + refine ⟨α p, α q, c, I₁, I₂, N₁, N₂, ⟨hT.mp hp, hIΘ (hαI p), hIbd (hαI p)⟩, ⟨hT.mp hq, + hIΘ (hαI q), hIbd (hαI q)⟩, hLZ.ne', hPp, hPq, hc, hcΔ, + ⟨z₀, hz₀c, hIΘ hz₀I⟩, htc, fun x hx => ⟨hIΘ (hI₁I hx), hIbd (hI₁I hx)⟩, fun x hx => ⟨hIΘ + (hI₂I hx), hIbd (hI₂I hx)⟩, hI₁₂, + ⟨0, ⟨le_rfl, unitInterval.nonneg'⟩, rfl⟩, ⟨p, ⟨unitInterval.nonneg', le_rfl⟩, rfl⟩, ⟨q, + ⟨le_rfl, unitInterval.le_one'⟩, rfl⟩, ⟨1, ⟨unitInterval.le_one', le_rfl⟩, rfl⟩, + fun x hx => hx.1, sdiff_subset, disjoint_sdiff_right, ?_, ?_, ?_, ⟨c₁, hc₁, h3, h4, h5⟩, ⟨c₂, + hc₂, h6, h7, h8⟩⟩ + · rintro _ ⟨⟨s, hs, rfl⟩, -⟩ _ ⟨⟨t, ht, rfl⟩, -⟩ + have hO : IsOArc Θ' := (cuff_statement.{0} S hS).2.2 _ hΘ + have hf : ∀ t, α t ∈ Θ' := fun t => hIΘ (hαI t) + have hst : s ≤ t := hs.2.trans (hpq.le.trans ht.1) + exact ⟨fun _ _ => inOrder_of_arc hO ha hf hs.1 hs.2 (hpq.le.trans ht.1), fun _ _ + => inOrder_of_arc hO ha hf unitInterval.nonneg' (hpq.le.trans ht.1) unitInterval.le_one', + fun _ _ => inOrder_of_arc hO ha hf (hs.2.trans hpq.le) ht.1 unitInterval.le_one', fun _ _ + => inOrder_of_arc hO ha hf hs.1 (hs.2.trans hpq.le) unitInterval.le_one'⟩ + · intro d hd hdΔ hdb hdc + obtain ⟨u, v, -, htilde, hL, hdiff, -, -⟩ := Γ.border_cell_exists_ends hd hdb + have hW : (closure d ∩ bd S) \ {u, v} ⊆ I₁ ∪ I₂ := by + intro w hw + have hwd : w ∈ d ∩ bd S := hdiff ▸ hw + have hwI : w ∈ I := hmeet ▸ ⟨hdΔ hwd.1, hwd.2⟩ + rw [← hr] at hwI + obtain ⟨t, rfl⟩ := hwI + by_cases h9 : t ≤ p + · exact .inl ⟨t, ⟨unitInterval.nonneg', h9⟩, rfl⟩ + by_cases h10 : q ≤ t + · exact .inr ⟨t, ⟨h10, unitInterval.le_one'⟩, rfl⟩ + have h11 : α t ∈ Z := ⟨⟨t, ⟨(not_le.mp h9).le, (not_le.mp h10).le⟩, rfl⟩, by + rintro (h | h) + · exact (not_le.mp h9).ne (ha.2 h).symm + · exact (not_le.mp h10).ne (ha.2 h)⟩ + exact absurd (arcComponentsIn_eq_of_mem hd hc hwd.1 (hZc h11)) hdc + have htl : tilde d ⊆ closure ((closure d ∩ bd S) \ {u, v}) := by + rw [htilde] + rintro x (rfl | rfl) + · exact hL.subset_closure_diff hL.left_mem + · exact hL.subset_closure_diff hL.right_mem + by_cases hmeet₂ : ((closure d ∩ bd S) \ {u, v} ∩ I₂).Nonempty + · right + have h9 : (closure d ∩ bd S) \ {u, v} ⊆ I₂ := fun w hw => by + refine (hW hw).resolve_left fun hw₁ => ?_ + obtain ⟨z, -, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp hL.isPreconnected_diff I₁ I₂ + (hIcl _ _) (hIcl _ _) hW ⟨w, hw, hw₁⟩ hmeet₂ + exact disjoint_left.mp hI₁₂ hz₁ hz₂ + exact htl.trans (closure_minimal h9 (hIcl _ _)) + · left + have h9 : (closure d ∩ bd S) \ {u, v} ⊆ I₁ := fun w hw => + (hW hw).resolve_right fun hw₂ => hmeet₂ ⟨w, hw, hw₂⟩ + exact htl.trans (closure_minimal h9 (hIcl _ _)) + · intro d hd hdΔ hdb + have hdG : d ∈ G := ⟨hd, hdΔ, hdb⟩ + by_cases h : ∃ y ∈ e d, y ∈ N₁ ∪ I₁ + · left + obtain ⟨y, hy, hy'⟩ := h + have hw : ∃ w ∈ I₁ ∩ Γ.N, Linked G e w y := by + rcases hy' with hy' | hy' + · exact hy'.2 + · exact ⟨y, ⟨hy', (hGQ d hdG hy).1⟩, .refl _⟩ + obtain ⟨w, hw, hl⟩ := hw + intro x hx + have hl' : Linked G e w x := hl.trans _ _ _ (.rel _ _ ⟨d, hdG, hy, hx⟩) + rcases hnode x (hGQ d hdG hx) with h9 | h9 | h9 + · exact .inl ⟨⟨hGQ d hdG hx, h9⟩, w, hw, hl'⟩ + · exact .inr h9 + · exact absurd hl' (hnl w hw.1 x h9 hw.2 (hGQ d hdG hx).1) + · right + push Not at h + intro x hx + have h9 := h x hx + rcases hnode x (hGQ d hdG hx) with h10 | h10 | h10 + · exact .inl ⟨⟨hGQ d hdG hx, h10⟩, fun h11 => h9 (.inl h11)⟩ + · exact absurd (.inr h10) h9 + · exact .inr h10 + +/-- The marked-region partition for the two-node normal arc statement in XVII (7.3). -/ +theorem normalIArcDiscRegion : NormalIArcDiscRegionStatement := by + intro S _ hS Γ Θ n₁ n₂ F Δ e P_mark hΘ hn₁ hn₂ hne hnorm hF hb _ hΔ h1 h2 he hP₁ hP₂ + exact normalIArcDiscRegion_of_boundary S hS Γ Θ n₁ n₂ F Δ e P_mark + hΘ hn₁ hn₂ hne hnorm hF hb hΔ h1 h2 he hP₁ hP₂ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/NodeRing.lean b/LeanPool/GraphMinor/GM17/NodeRing.lean new file mode 100644 index 0000000000..4126a804ae --- /dev/null +++ b/LeanPool/GraphMinor/GM17/NodeRing.lean @@ -0,0 +1,482 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Sector + +/-! +# Curves around an internal node with few cells + +Here we prove the part of `RegionBoundaryOArcCriterionStatement` on internal nodes that lie on at +most one cell, or on two cells one of which has only two nodes, which is used in (8.7) +of Graph Minors XVII (page 183). We find a closed disc that holds these cells, has the node inside +or on its boundary and has its other nodes on its boundary, and take a ring around it +that is pinned at the other nodes (`ring_node`). If there are two cells, the disc is made of the two +cells and a sector of a region between them (`two_cell_disc`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +namespace Painting + +variable {Γ : Painting S} [T2Space S] + +/-- A ring around a disc that holds the cells at a node gives the curve of (8.7). -/ +theorem ring_node [ConnectedSpace S] (hS : IsSurface S) {E c₀ c₁ : Set S} {n : S} + (hE : IsClosedDisc E) (h₀ : c₀ ∈ Γ.C) (h₁ : c₁ ∈ Γ.C) (h₀E : closure c₀ ⊆ E) + (h₁E : closure c₁ ⊆ E) (hEU : E ∩ Γ.U ⊆ closure c₀ ∪ closure c₁) + (hnE : n ∈ E) (hn : n ∈ Γ.N) (hcells : ∀ d ∈ Γ.C, n ∈ tilde d → d = c₀ ∨ d = c₁) + (hP : ∀ z ∈ E, z ∈ Γ.N → z ≠ n → z ∈ discBd E) (hEb : E ∩ bd S ⊆ Γ.N) (hnb : n ∉ bd S) + (hcard : ((E ∩ Γ.N) \ {n}).ncard ≤ 3) (hthree : ((E ∩ Γ.N) \ {n}).ncard = 3 → + (tilde c₁).ncard ≠ 2) : + ∃ F : Set S, IsOArc F ∧ Γ.IsNormal F ∧ (F ∩ Γ.N).ncard ≤ 3 ∧ + ∀ Δ : Set S, IsClosedDisc Δ → discBd Δ = F → + ((Δ ∩ Γ.N ⊆ F ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard ≤ 1) ∨ ((F ∩ Γ.N).ncard = 3 ∧ ∀ c ∈ Γ.C, c ⊆ Δ → + (tilde c).ncard = 2)) → + ∃ d₁ ∈ Γ.C, ∃ d₂ ∈ Γ.C, Γ.C ⊆ {d₁, d₂} ∪ {c ∈ Γ.C | c ⊆ Δ} := by + classical + let Z : Set S := (Γ.N \ {n}) ∪ ⋃ d ∈ Γ.C \ {c₀, c₁}, closure d + have hZ : IsClosed Z := (Γ.finite_N.subset sdiff_subset).isClosed.union + (Γ.finite_cells.subset sdiff_subset |>.isClosed_biUnion fun _ _ => isClosed_closure) + have hUcell : ∀ {z}, z ∈ Γ.U → z ∉ Γ.N → ∃ d ∈ Γ.C, z ∈ d := fun {z} h h' => by + obtain ⟨d, hd, hz⟩ := exists_mem_arcComponentsIn (F := Γ.U \ Γ.N) (x := z) ⟨h, h'⟩ + exact ⟨d, hd, hz⟩ + have hnZ : n ∉ Z := by + rintro (h | h) + · exact h.2 rfl + · obtain ⟨d, hd, hnd⟩ := mem_iUnion₂.mp h + have h3 : n ∈ tilde d := by + rw [← Γ.closure_cell_inter_N hd.1] + exact ⟨hnd, hn⟩ + rcases hcells d hd.1 h3 with e | e + · exact hd.2 (.inl e) + · exact hd.2 (.inr e) + have hZE : ∀ z ∈ Z, z ∈ E → z ∈ Γ.N := by + rintro z (h | h) hzE + · exact h.1 + · obtain ⟨d, hd, hzd⟩ := mem_iUnion₂.mp h + rcases hEU ⟨hzE, Γ.closure_cell_subset_U hd.1 hzd⟩ with h' | h' + · exact closure_inter_closure hd.1 h₀ (fun e => hd.2 (.inl e)) ⟨hzd, h'⟩ + · exact closure_inter_closure hd.1 h₁ (fun e => hd.2 (.inr e)) ⟨hzd, h'⟩ + have hZb : Z ∩ E ⊆ discBd E := fun z hz => hP z hz.2 (hZE z hz.1 hz.2) (fun e => hnZ (e ▸ hz.1)) + have hEb' : E ∩ bd S ⊆ Z := fun z hz => .inl ⟨hEb hz, fun e => hnb ((mem_singleton_iff.mp e) ▸ + hz.2)⟩ + obtain ⟨Δ, hΔ, hEΔ, hΔZ, hbE, -⟩ := exists_ring_sub hS hE hZ hZb hEb' + have hnF : n ∉ discBd Δ := fun h => by + have h3 : n ∈ E ∩ Z := hbE ▸ ⟨h, hnE⟩ + exact hnZ h3.2 + have hN' : ∀ z ∈ Γ.N, z ≠ n → z ∈ Z := fun z hz hne => .inl ⟨hz, hne⟩ + have hFN : discBd Δ ∩ Γ.N = (E ∩ Γ.N) \ {n} := by + apply subset_antisymm + · rintro z ⟨hz, hzN⟩ + have hne : z ≠ n := fun e => hnF (e ▸ hz) + have h3 : z ∈ E ∩ Z := hΔZ ▸ ⟨discBd_subset Δ hz, hN' z hzN hne⟩ + exact ⟨⟨h3.1, hzN⟩, hne⟩ + · rintro z ⟨⟨hz, hzN⟩, hne⟩ + have h3 : z ∈ discBd Δ ∩ E := hbE.symm ▸ ⟨hz, hN' z hzN hne⟩ + exact ⟨h3.1, hzN⟩ + have hnorm : Γ.IsNormal (discBd Δ) := by + rintro z ⟨hz, hzU⟩ + by_contra hzN + obtain ⟨d, hd, hzd⟩ := hUcell hzU hzN + by_cases hdc : d = c₀ ∨ d = c₁ + · have hzE : z ∈ E := hdc.elim (fun e => h₀E (e ▸ subset_closure hzd)) (fun e => h₁E + (e ▸ subset_closure hzd)) + have h3 : z ∈ E ∩ Z := hbE ▸ ⟨hz, hzE⟩ + exact hzN (hZE z h3.2 hzE) + · have hzZ : z ∈ Z := .inr (mem_iUnion₂.mpr ⟨d, ⟨hd, hdc⟩, subset_closure hzd⟩) + have h3 : z ∈ E ∩ Z := hΔZ ▸ ⟨discBd_subset Δ hz, hzZ⟩ + exact hzN (hZE z hzZ h3.1) + refine ⟨discBd Δ, hΔ.isOArc_discBd, hnorm, hFN ▸ hcard, fun Δ' hΔ' hb halt => ?_⟩ + rcases two_discs hS hΔ hΔ' hb.symm with rfl | ⟨hcov, -⟩ + · exfalso + rcases halt with ⟨h1, -⟩ | ⟨h1, h2⟩ + · exact hnF (h1 ⟨hEΔ hnE, hn⟩) + · rw [hFN] at h1 + exact hthree h1 (h2 c₁ h₁ (subset_closure.trans (h₁E.trans hEΔ))) + · refine ⟨c₀, h₀, c₁, h₁, fun d hd => ?_⟩ + by_cases hdc : d ∈ ({c₀, c₁} : Set (Set S)) + · exact .inl hdc + · refine .inr ⟨hd, fun z hz => ?_⟩ + rcases (hcov.ge (mem_univ z) : z ∈ Δ ∪ Δ') with h | h + · exfalso + have hzZ : z ∈ Z := .inr (mem_iUnion₂.mpr ⟨d, ⟨hd, hdc⟩, subset_closure hz⟩) + have h3 : z ∈ E ∩ Z := hΔZ ▸ ⟨h, hzZ⟩ + exact disjoint_left.mp (Γ.cell_disjoint_N hd) hz (hZE z hzZ h3.1) + · exact h + +/-- The curve for a node on only one cell. -/ +theorem node_one [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {n : S} (hn : n ∈ Γ.N) + (hnb : n ∉ bd S) (h : {c ∈ Γ.C | n ∈ tilde c}.ncard ≤ 1) : + ∃ F : Set S, IsOArc F ∧ Γ.IsNormal F ∧ (F ∩ Γ.N).ncard ≤ 3 ∧ + ∀ Δ : Set S, IsClosedDisc Δ → discBd Δ = F → + ((Δ ∩ Γ.N ⊆ F ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard ≤ 1) ∨ ((F ∩ Γ.N).ncard = 3 ∧ ∀ c ∈ Γ.C, c ⊆ Δ → + (tilde c).ncard = 2)) → + ∃ d₁ ∈ Γ.C, ∃ d₂ ∈ Γ.C, Γ.C ⊆ {d₁, d₂} ∪ {c ∈ Γ.C | c ⊆ Δ} := by + obtain ⟨c, hc, hnc⟩ := node_on_cell hS hΓ hn + have hfin : {c ∈ Γ.C | n ∈ tilde c}.Finite := Γ.finite_cells.subset fun _ h => h.1 + have hcells : ∀ d ∈ Γ.C, n ∈ tilde d → d = c ∨ d = c := fun d hd hnd => + .inl ((Set.ncard_le_one_iff hfin).mp h ⟨hd, hnd⟩ ⟨hc, hnc⟩) + have hint : ¬ (c ∩ bd S).Nonempty := fun hb => by + obtain ⟨u, v, -, ht, -, -, hu, hv⟩ := Γ.border_cell_exists_ends hc hb + rcases (ht ▸ hnc : n ∈ ({u, v} : Set S)) with rfl | rfl + · exact hnb hu.2 + · exact hnb hv.2 + have hdisc := Γ.isClosedDisc_closure_cell hc + have htN : closure c ∩ Γ.N = tilde c := Γ.closure_cell_inter_N hc + have hle : ((closure c ∩ Γ.N) \ {n}).ncard ≤ 2 := by + rw [htN, Set.ncard_sdiff_singleton_of_mem hnc] + have := Γ.ncard_tilde_cell_le hc + omega + refine ring_node hS hdisc hc hc subset_rfl subset_rfl (fun z hz => .inl hz.1) hnc.1 hn hcells + (fun z hz hzN _ => ?_) (fun z hz => ?_) hnb (by omega) (by omega) + · refine Γ.tilde_subset_discBd hc ?_ + rw [← htN] + exact ⟨hz, hzN⟩ + · have h3 : z ∈ tilde c := ⟨hz.1, fun h' => hint ⟨z, h', hz.2⟩⟩ + exact Γ.tilde_subset_N hc h3 + +/-- A closed disc made of two cells at a node and a sector of a region between them. -/ +theorem two_cell_disc [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {c₀ c₁ t₀ t₁ r : Set S} + {n m e : S} (hr : r ∈ Γ.regions) (hs₀ : Γ.IsSide c₀ t₀ n m) (hs₁ : Γ.IsSide c₁ t₁ n e) + (hne : c₀ ≠ c₁) + (hcl₀ : t₀ ⊆ closure r) (hcl₁ : t₁ ⊆ closure r) (ht₀ : tilde c₀ = {n, m}) + (hinter : tilde c₀ ∩ tilde c₁ ⊆ {n, e}) : + ∃ E, IsClosedDisc E ∧ closure c₀ ⊆ E ∧ closure c₁ ⊆ E ∧ E ∩ Γ.U ⊆ closure c₀ ∪ closure c₁ ∧ + (∀ z ∈ E, z ∈ Γ.N → z ≠ n → z ∈ discBd E) ∧ + ∀ z, z ∈ discBd (closure c₀) ∪ discBd (closure c₁) → z ∉ t₀ \ {n, m} → z ∉ t₁ \ {n, e} + → z ∈ discBd E := by + have h₀ := hs₀.1.1 + have h₁ := hs₁.1.1 + have hmeet : ∀ {z}, z ∈ closure c₀ → z ∈ closure c₁ → (z = n ∨ z = e) ∧ (z = n ∨ z = m) + := fun {z} h h' => by + have hzN := closure_inter_closure h₀ h₁ hne ⟨h, h'⟩ + have h3 : z ∈ tilde c₀ := by + rw [← Γ.closure_cell_inter_N h₀] + exact ⟨h, hzN⟩ + have h4 : z ∈ tilde c₁ := by + rw [← Γ.closure_cell_inter_N h₁] + exact ⟨h', hzN⟩ + have h5 := hinter ⟨h3, h4⟩ + rw [ht₀] at h3 + exact ⟨h5, h3⟩ + have ht₀c := fun {z} (h : z ∈ t₀) => hs₀.1.subset_closure h + have ht₁c := fun {z} (h : z ∈ t₁) => hs₁.1.subset_closure h + have hnt₀ : n ∈ t₀ := hs₀.1.2.1.left_mem + have hmt₀ : m ∈ t₀ := hs₀.1.2.1.right_mem + have hnt₁ : n ∈ t₁ := hs₁.1.2.1.left_mem + have het₁ : e ∈ t₁ := hs₁.1.2.1.right_mem + obtain ⟨Y, hY, h₀Y, h₁Y, hYU⟩ := sector hS hΓ hr hs₀ hs₁ hcl₀ hcl₁ (fun z hz => (hmeet + (ht₀c hz.1) (ht₁c hz.2)).1) + have hsub : ∀ {z}, z ∈ closure c₀ → z ∈ closure c₁ → z ∈ t₀ ∧ z ∈ t₁ := fun {z} h h' => by + obtain ⟨h3, h4⟩ := hmeet h h' + refine ⟨h4.elim (fun e' => e' ▸ hnt₀) (fun e' => e' ▸ hmt₀), h3.elim (fun e' => e' ▸ hnt₁) + (fun e' => e' ▸ het₁)⟩ + have hm₀ : closure c₀ ∩ Y = t₀ := by + apply subset_antisymm + · rintro z ⟨h, h'⟩ + rcases hYU ⟨h', Γ.closure_cell_subset_U h₀ h⟩ with h3 | h3 + · exact h3 + · exact (hsub h (ht₁c h3)).1 + · exact fun z hz => ⟨ht₀c hz, discBd_subset Y (h₀Y hz)⟩ + obtain ⟨hA, hbA⟩ := disc_union _ _ _ _ _ (Γ.isClosedDisc_closure_cell h₀) hY hs₀.1.2.1 hm₀ + hs₀.1.2.2.1 h₀Y + have hm₁ : (closure c₀ ∪ Y) ∩ closure c₁ = t₁ := by + apply subset_antisymm + · rintro z ⟨h | h, h'⟩ + · exact (hsub h h').2 + · rcases hYU ⟨h, Γ.closure_cell_subset_U h₁ h'⟩ with h3 | h3 + · exact (hsub (ht₀c h3) h').2 + · exact h3 + · exact fun z hz => ⟨.inr (discBd_subset Y (h₁Y hz)), ht₁c hz⟩ + have ht₁A : t₁ ⊆ discBd (closure c₀ ∪ Y) := fun z hz => by + rw [hbA] + refine ⟨.inr (h₁Y hz), fun h => ?_⟩ + exact h.2 (hmeet (ht₀c h.1) (ht₁c hz)).2 + obtain ⟨hE, hbE⟩ := disc_union _ _ _ _ _ hA (Γ.isClosedDisc_closure_cell h₁) hs₁.1.2.1 hm₁ ht₁A + hs₁.1.2.2.1 + refine ⟨_, hE, fun z h => .inl (.inl h), fun z h => .inr h, ?_, ?_, ?_⟩ + · rintro z ⟨(h | h) | h, hzU⟩ + · exact .inl h + · exact (hYU ⟨h, hzU⟩).elim (fun h3 => .inl (ht₀c h3)) (fun h3 => .inr (ht₁c h3)) + · exact .inr h + · intro z hz hzN hne' + have hn₀ : z ∉ t₀ \ {n, m} := fun h => h.2 (hs₀.1.2.2.2.le ⟨h.1, hzN⟩) + have hn₁ : z ∉ t₁ \ {n, e} := fun h => h.2 (hs₁.1.2.2.2.le ⟨h.1, hzN⟩) + have hc₀ : z ∈ closure c₀ → z ∈ discBd (closure c₀) := fun h => Γ.tilde_subset_discBd h₀ + (Γ.closure_cell_inter_N h₀ ▸ ⟨h, hzN⟩) + have hc₁ : z ∈ closure c₁ → z ∈ discBd (closure c₁) := fun h => Γ.tilde_subset_discBd h₁ + (Γ.closure_cell_inter_N h₁ ▸ ⟨h, hzN⟩) + rw [hbE, hbA] + refine ⟨?_, hn₁⟩ + rcases hz with (h | h) | h + · exact .inl ⟨.inl (hc₀ h), hn₀⟩ + · rcases hYU ⟨h, Γ.N_subset hzN⟩ with h3 | h3 + · exact .inl ⟨.inl (hc₀ (ht₀c h3)), hn₀⟩ + · exact .inr (hc₁ (ht₁c h3)) + · exact .inr (hc₁ h) + · intro z hz hn₀ hn₁ + rw [hbE, hbA] + refine ⟨?_, hn₁⟩ + rcases hz with h | h + · exact .inl ⟨.inl h, hn₀⟩ + · exact .inr h + +/-- Two sides of a cell with the same two ends do not lie on one region, as this would leave only +these two nodes. -/ +theorem no_wrap [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {c L L' r : Set S} {n m : S} + (hr : r ∈ Γ.regions) (hL : Γ.IsSide c L n m) (hL' : Γ.IsSide c L' n m) (hne : L ≠ L') + (hcl : L ⊆ closure r) (hcl' : L' ⊆ closure r) (ht : tilde c = {n, m}) : False := by + have hcS : CompactSpace S := hS.1 + have hman := hS.2.2 + have hc := hL.1.1 + have hi : L ∩ L' = {n, m} := by + apply subset_antisymm + · rintro z ⟨h, h'⟩ + refine hL.1.2.2.2.le ⟨h, ?_⟩ + by_contra hn + exact hne (hL.1.unique hL'.1 h h' hn).2 + · rintro z (rfl | rfl) + · exact ⟨hL.1.2.1.left_mem, hL'.1.2.1.left_mem⟩ + · exact ⟨hL.1.2.1.right_mem, hL'.1.2.1.right_mem⟩ + have hO : IsOArc (L ∪ L') := oArc_of_lines hL.1.2.1 hL'.1.2.1 hi + have hdisc := Γ.isClosedDisc_closure_cell hc + obtain ⟨φ⟩ := id (frontier_isOArc hS hΓ hr) + obtain ⟨ψ⟩ := id hdisc.isOArc_discBd + have hU : L ∪ L' ⊆ Γ.U := union_subset hL.1.subset_U hL'.1.subset_U + have hfr : L ∪ L' = closure r \ r := oarc_eq φ hO fun z hz => ⟨union_subset hcl hcl' hz, fun h + => region_subset hr h (hU hz)⟩ + have hbc : L ∪ L' = discBd (closure c) := oarc_eq ψ hO (union_subset hL.1.2.2.1 hL'.1.2.2.1) + obtain ⟨St, γ, -, -, -, -, -, -, -, hStr, hnb⟩ := side_strip' hS hΓ hr hL hcl (isClosed_empty (X + := S)) (by simp) + obtain ⟨St', γ', -, -, -, -, -, -, -, hStr', hnb'⟩ := side_strip' hS hΓ hr hL' hcl' + (isClosed_empty (X := S)) (by simp) + let W : Set S := closure r ∪ closure c + have hStW : ∀ {St T : Set S}, T ⊆ closure r → St \ T ⊆ r → closure c ∪ St ⊆ W + := fun {St T} h1 h2 z hz => by + rcases hz with h | h + · exact .inr h + · by_cases hzT : z ∈ T + · exact .inl (h1 hzT) + · exact .inl (subset_closure (h2 ⟨h, hzT⟩)) + have hside : ∀ x ∈ L ∪ L', x ∉ ({n, m} : Set S) → W ∈ 𝓝 x := by + rintro x (h | h) hx + · exact Filter.mem_of_superset (hnb x h (fun e => hx (.inl e)) (fun e => hx (.inr e))) + (hStW hcl hStr) + · exact Filter.mem_of_superset (hnb' x h (fun e => hx (.inl e)) (fun e => hx (.inr e))) + (hStW hcl' hStr') + have hnbW : ∀ x ∈ W, x ∉ ({n, m} : Set S) → W ∈ 𝓝 x := by + rintro x (h | h) hx + · by_cases hxr : x ∈ r + · exact Filter.mem_of_superset ((hΓ.isOpen r hr).mem_nhds hxr) (subset_closure.trans + subset_union_left) + · exact hside x (hfr ▸ ⟨h, hxr⟩) hx + · by_cases hxb : x ∈ discBd (closure c) + · exact hside x (hbc ▸ hxb) hx + · exact Filter.mem_of_superset ((hdisc.isOpen_discInt hman).mem_nhds ⟨h, + hxb⟩) fun y hy => .inr hy.1 + have hWc : IsClosed W := isClosed_closure.union isClosed_closure + obtain ⟨z, hz⟩ := arcComponentsIn_nonempty hc + have hzA : z ∉ ({n, m} : Set S) := fun h => disjoint_left.mp (Γ.cell_disjoint_N hc) hz (h.elim + (fun e => e ▸ hL.1.left_mem_N) (fun e => e ▸ hL.1.right_mem_N)) + refine hΓ.not_covered (A := {n, m}) (toFinite _) ((Set.ncard_pair hL.1.2.1.ne').le.trans + (by norm_num)) fun y hy => ?_ + by_contra hyA + rcases cover_off hman hWc (toFinite _) ⟨z, .inr (subset_closure hz), hzA⟩ hnbW hyA with h | h + · refine hyA ?_ + by_cases hyr : y ∈ r + · exact absurd (Γ.N_subset hy) (region_subset hr hyr) + · rcases (hfr ▸ (⟨h, hyr⟩ : y ∈ closure r \ r) : y ∈ L ∪ L') with h3 | h3 + · exact hL.1.2.2.2.le ⟨h3, hy⟩ + · exact hL'.1.2.2.2.le ⟨h3, hy⟩ + · exact hyA (ht ▸ Γ.closure_cell_inter_N hc ▸ ⟨h, hy⟩) + +/-- The side next to a side of a two-node cell, around one of its nodes, is a side of another cell +at this node. -/ +theorem partner [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {c₀ c₁ L : Set S} {n m : S} + (hL : Γ.IsSide c₀ L n m) (ht : tilde c₀ = {n, m}) (hn : n ∈ Γ.N) (hcells : ∀ d ∈ Γ.C, n ∈ tilde d + → d = c₀ ∨ d = c₁) : + ∃ r L₁ e, r ∈ Γ.regions ∧ L ⊆ closure r ∧ Γ.SideOf r L ∧ Γ.SideOf r L₁ ∧ L₁ ≠ L + ∧ L₁ ⊆ closure r ∧ Γ.IsSide c₁ L₁ n e := by + have hcS : CompactSpace S := hS.1 + obtain ⟨St, γ, r, -, -, -, -, -, -, -, hr, -, hcl, -⟩ := side_strip hS hΓ.isOpen hL + (isClosed_empty (X := S)) (by simp) + have hso : Γ.SideOf r L := ⟨c₀, n, m, hL, hcl⟩ + obtain ⟨L', hso', hnL', hne⟩ := other_side hS hΓ hr hso hL.1.2.1.left_mem hn + obtain ⟨c', u', v', hs', hcl'⟩ := id hso' + obtain ⟨e, hs⟩ := hs'.exists_end hnL' hn + have hnt : n ∈ tilde c' := Γ.closure_cell_inter_N hs.1.1 ▸ ⟨hs.1.subset_closure hnL', hn⟩ + rcases hcells c' hs.1.1 hnt with rfl | rfl + · exfalso + have het : e ∈ tilde c' := Γ.closure_cell_inter_N hs.1.1 ▸ ⟨hs.1.subset_closure + hs.1.2.1.right_mem, hs.1.right_mem_N⟩ + rcases (ht ▸ het : e ∈ ({n, m} : Set S)) with rfl | rfl + · exact hs.1.2.1.ne' rfl + · exact no_wrap hS hΓ hr hL hs hne.symm hcl hcl' ht + · exact ⟨r, L', e, hr, hcl, hso, hso', hne, hcl', hs⟩ + +/-- The two sides of a two-node cell are the whole boundary of the closed cell. -/ +theorem other_gap {c L : Set S} {n m : S} (hL : Γ.IsSide c L n m) (ht : tilde c = {n, m}) (hint : ¬ + (c ∩ bd S).Nonempty) : ∃ R, Γ.IsSide c R n m ∧ R ≠ L := by + obtain ⟨R, hR, hun, hin⟩ := oarc_split (Γ.isClosedDisc_closure_cell hL.1.1).isOArc_discBd + hL.1.2.1 hL.1.2.2.1 + have hRs : R ⊆ discBd (closure c) := hun ▸ subset_union_right + have hG : Γ.IsGap c R n m := by + refine ⟨hL.1.1, hR, hRs, ?_⟩ + apply subset_antisymm + · rintro z ⟨h, hzN⟩ + exact ht ▸ Γ.closure_cell_inter_N hL.1.1 ▸ ⟨discBd_subset _ (hRs h), hzN⟩ + · rintro z (rfl | rfl) + · exact ⟨hR.left_mem, hL.1.left_mem_N⟩ + · exact ⟨hR.right_mem, hL.1.right_mem_N⟩ + refine ⟨R, isSide_of_internal hG hint, fun e => ?_⟩ + obtain ⟨z, hz, h3, h4, -⟩ := exists_inner hL.1.2.1 (finite_empty (α := S)) + exact (hin.le ⟨hz, e ▸ hz⟩).elim h3 h4 + +/-- The curve for a node on two cells, one of them with only two nodes. -/ +theorem node_two [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {n : S} {c₀ : Set S} + (hn : n ∈ Γ.N) (hnb : n ∉ bd S) (h : {c ∈ Γ.C | n ∈ tilde c}.ncard = 2) (h₀ : c₀ ∈ Γ.C) + (hnc₀ : n ∈ tilde c₀) (h2 : (tilde c₀).ncard = 2) : + ∃ F : Set S, IsOArc F ∧ Γ.IsNormal F ∧ (F ∩ Γ.N).ncard ≤ 3 ∧ + ∀ Δ : Set S, IsClosedDisc Δ → discBd Δ = F → + ((Δ ∩ Γ.N ⊆ F ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard ≤ 1) ∨ ((F ∩ Γ.N).ncard = 3 ∧ ∀ c ∈ Γ.C, c ⊆ Δ → + (tilde c).ncard = 2)) → + ∃ d₁ ∈ Γ.C, ∃ d₂ ∈ Γ.C, Γ.C ⊆ {d₁, d₂} ∪ {c ∈ Γ.C | c ⊆ Δ} := by + classical + have hcS : CompactSpace S := hS.1 + have hman := hS.2.2 + obtain ⟨x, y, hxy, hset⟩ := Set.ncard_eq_two.mp h + have hx : x ∈ {c ∈ Γ.C | n ∈ tilde c} := hset ▸ .inl rfl + have hy : y ∈ {c ∈ Γ.C | n ∈ tilde c} := hset ▸ .inr rfl + have hall : ∀ d ∈ Γ.C, n ∈ tilde d → d = x ∨ d = y := fun d hd hnd => by + have h3 : d ∈ {c ∈ Γ.C | n ∈ tilde c} := ⟨hd, hnd⟩ + rw [hset] at h3 + exact h3 + obtain ⟨c₁, hne, hc₁, hnc₁, hcells⟩ : ∃ c₁, c₀ ≠ c₁ ∧ c₁ ∈ Γ.C ∧ n ∈ tilde c₁ + ∧ ∀ d ∈ Γ.C, n ∈ tilde d → d = c₀ ∨ d = c₁ := by + rcases hall c₀ h₀ hnc₀ with rfl | rfl + · exact ⟨y, hxy, hy.1, hy.2, hall⟩ + · exact ⟨x, hxy.symm, hx.1, hx.2, fun d hd hnd => (hall d hd hnd).symm⟩ + have hint : ∀ d ∈ Γ.C, n ∈ tilde d → ¬ (d ∩ bd S).Nonempty := fun d hd hnd hb => by + obtain ⟨u, v, -, ht, -, -, hu, hv⟩ := Γ.border_cell_exists_ends hd hb + rcases (ht ▸ hnd : n ∈ ({u, v} : Set S)) with rfl | rfl + · exact hnb hu.2 + · exact hnb hv.2 + obtain ⟨m, hmn, ht⟩ : ∃ m, m ≠ n ∧ tilde c₀ = {n, m} := by + obtain ⟨p, q, hpq, htq⟩ := Set.ncard_eq_two.mp h2 + rcases (htq ▸ hnc₀ : n ∈ ({p, q} : Set S)) with rfl | rfl + · exact ⟨q, hpq.symm, htq⟩ + · exact ⟨p, hpq, by rw [htq, pair_comm]⟩ + have hmt : m ∈ tilde c₀ := ht ▸ .inr rfl + obtain ⟨s₀, hs₀G⟩ := exists_gap_pair h₀ hnc₀ hmt hmn.symm + have hs₀ := isSide_of_internal hs₀G (hint c₀ h₀ hnc₀) + obtain ⟨R, hR, hRne⟩ := other_gap hs₀ ht (hint c₀ h₀ hnc₀) + obtain ⟨r, s₁, a, hr, hcl₀, hso₀, hso₁, hne₁, hcl₁, hs₁⟩ := partner hS hΓ hs₀ ht hn hcells + obtain ⟨r', s₁', b, hr', hclR, hsoR, hso₁', hne₁', hcl₁', hs₁'⟩ := partner hS hΓ hR ht hn hcells + have hss : s₁ ≠ s₁' := by + rintro rfl + obtain rfl := SideOf.unique hS hΓ.isOpen hr hr' hso₁ hso₁' + exact three_sides hS hΓ hr hso₀ hsoR hso₁ hs₀.1.2.1.left_mem hR.1.2.1.left_mem + hs₁.1.2.1.left_mem hn hRne.symm hne₁.symm hne₁'.symm + have hN₁ := hs₁.1.2.2.2 + have hN₁' := hs₁'.1.2.2.2 + obtain ⟨t₀, t₁, ρ, e, hρ, hst₀, hst₁, hclt₀, hclt₁, hinter⟩ : ∃ t₀ t₁ ρ e, ρ ∈ Γ.regions + ∧ Γ.IsSide c₀ t₀ n m ∧ Γ.IsSide c₁ t₁ n e ∧ t₀ ⊆ closure ρ ∧ t₁ ⊆ closure ρ + ∧ tilde c₀ ∩ tilde c₁ ⊆ {n, e} := by + by_cases hm : m ∈ tilde c₁ + · have hor : m = a ∨ m = b := by + by_contra hcon + push Not at hcon + obtain ⟨hma, hmb⟩ := hcon + by_cases hab : a = b + · subst hab + have hi : s₁ ∩ s₁' = {n, a} := by + apply subset_antisymm + · rintro z ⟨h3, h4⟩ + refine hN₁.le ⟨h3, ?_⟩ + by_contra hzN + exact hss (hs₁.1.unique hs₁'.1 h3 h4 hzN).2 + · rintro z (rfl | rfl) + · exact ⟨hs₁.1.2.1.left_mem, hs₁'.1.2.1.left_mem⟩ + · exact ⟨hs₁.1.2.1.right_mem, hs₁'.1.2.1.right_mem⟩ + obtain ⟨ψ⟩ := id (Γ.isClosedDisc_closure_cell hc₁).isOArc_discBd + have hbc := oarc_eq ψ (oArc_of_lines hs₁.1.2.1 hs₁'.1.2.1 hi) + (union_subset hs₁.1.2.2.1 hs₁'.1.2.2.1) + have hmN : m ∈ Γ.N := Γ.tilde_subset_N h₀ hmt + rcases (hbc ▸ Γ.tilde_subset_discBd hc₁ hm : m ∈ s₁ ∪ s₁') with h3 | h3 + · exact (hN₁.le ⟨h3, hmN⟩).elim hmn hma + · exact (hN₁'.le ⟨h3, hmN⟩).elim hmn hma + · have hat : a ∈ tilde c₁ := Γ.closure_cell_inter_N hc₁ ▸ ⟨hs₁.1.subset_closure + hs₁.1.2.1.right_mem, hs₁.1.right_mem_N⟩ + have hbt : b ∈ tilde c₁ := Γ.closure_cell_inter_N hc₁ ▸ ⟨hs₁'.1.subset_closure + hs₁'.1.2.1.right_mem, hs₁'.1.right_mem_N⟩ + have hcard : ({n, a, b, m} : Finset S).card = 4 := by + rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, + Finset.card_pair hmb.symm] + · simp only [Finset.mem_insert, Finset.mem_singleton, not_or] + exact ⟨hab, hma.symm⟩ + · simp only [Finset.mem_insert, Finset.mem_singleton, not_or] + exact ⟨hs₁.1.2.1.ne', hs₁'.1.2.1.ne', hmn.symm⟩ + have h4 : ((({n, a, b, m} : Finset S) : Set S)).ncard ≤ (tilde c₁).ncard := by + refine Set.ncard_le_ncard ?_ (Γ.finite_tilde_cell hc₁) + intro z hz + simp only [Finset.coe_insert, Finset.coe_singleton, mem_insert_iff, + mem_singleton_iff] at hz + rcases hz with rfl | rfl | rfl | rfl <;> assumption + rw [Set.ncard_coe_finset, hcard] at h4 + have := Γ.ncard_tilde_cell_le hc₁ + omega + rcases hor with rfl | rfl + · refine ⟨s₀, s₁, r, m, hr, hs₀, hs₁, hcl₀, hcl₁, fun z hz => ?_⟩ + rw [ht] at hz + exact hz.1 + · refine ⟨R, s₁', r', m, hr', hR, hs₁', hclR, hcl₁', fun z hz => ?_⟩ + rw [ht] at hz + exact hz.1 + · refine ⟨s₀, s₁, r, a, hr, hs₀, hs₁, hcl₀, hcl₁, fun z hz => ?_⟩ + rcases (ht ▸ hz.1 : z ∈ ({n, m} : Set S)) with rfl | rfl + · exact .inl rfl + · exact absurd hz.2 hm + obtain ⟨E, hE, h₀E, h₁E, hEU, hP, -⟩ := two_cell_disc hS hΓ hρ hst₀ hst₁ hne hclt₀ hclt₁ ht hinter + have htN : ∀ {c z}, c ∈ Γ.C → z ∈ closure c → z ∈ Γ.N → z ∈ tilde c := fun hc h h' + => Γ.closure_cell_inter_N hc ▸ ⟨h, h'⟩ + have hEb : E ∩ bd S ⊆ Γ.N := by + rintro z ⟨hz, hzb⟩ + rcases hEU ⟨hz, Γ.bd_subset hzb⟩ with h3 | h3 + · by_contra hzN + exact hint c₀ h₀ hnc₀ ⟨z, closure_eq_cell h₀ h3 hzN, hzb⟩ + · by_contra hzN + exact hint c₁ hc₁ hnc₁ ⟨z, closure_eq_cell hc₁ h3 hzN, hzb⟩ + have hsub : (E ∩ Γ.N) \ {n} ⊆ insert m (tilde c₁ \ {n}) := by + rintro z ⟨⟨hz, hzN⟩, hzn⟩ + rcases hEU ⟨hz, Γ.N_subset hzN⟩ with h3 | h3 + · rcases (ht ▸ htN h₀ h3 hzN : z ∈ ({n, m} : Set S)) with e' | e' + · exact absurd e' hzn + · exact .inl e' + · exact .inr ⟨htN hc₁ h3 hzN, hzn⟩ + have hfin : (insert m (tilde c₁ \ {n})).Finite := ((Γ.finite_tilde_cell hc₁).subset + sdiff_subset).insert m + have hle : ((E ∩ Γ.N) \ {n}).ncard ≤ (tilde c₁).ncard := by + have h1 := Set.ncard_le_ncard hsub hfin + have h3 := Set.ncard_insert_le m (tilde c₁ \ {n}) + have h4 := Set.ncard_sdiff_singleton_of_mem hnc₁ + have h5 : 0 < (tilde c₁).ncard := (Set.ncard_pos (Γ.finite_tilde_cell hc₁)).mpr ⟨n, hnc₁⟩ + omega + have h3 := Γ.ncard_tilde_cell_le hc₁ + exact ring_node hS hE h₀ hc₁ h₀E h₁E hEU (h₀E hnc₀.1) hn hcells hP hEb hnb (by omega) (by omega) + +end Painting + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/PaintDiscs.lean b/LeanPool/GraphMinor/GM17/PaintDiscs.lean new file mode 100644 index 0000000000..9420baeb9f --- /dev/null +++ b/LeanPool/GraphMinor/GM17/PaintDiscs.lean @@ -0,0 +1,96 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.FreeLift +public import LeanPool.GraphMinor.GM11.PaintingCells +public import LeanPool.GraphMinor.Surface.RemoveDiscs + +/-! +# A painting from closed discs + +A finite family of closed discs that meet only in a finite set `N` of points on their boundaries is +a painting (`exists_painting_of_discs`). Its cells +are the discs minus `N`. This is the form in which the painting of XVII (13.1) is built. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {T : Type} [TopologicalSpace T] [T2Space T] {ι : Type*} [Finite ι] + +/-- **A painting from closed discs.** -/ +theorem exists_painting_of_discs {D : ι → Set T} {N : Set T} (hD : ∀ i, IsClosedDisc (D i)) + (hN : N.Finite) (hNb : ∀ i, N ∩ D i ⊆ discBd (D i)) + (hdis : ∀ i j, i ≠ j → D i ∩ D j ⊆ N) (hNU : N ⊆ ⋃ i, D i) (h3 : ∀ i, (N ∩ D i).ncard ≤ 3) + (hbd : bd T ⊆ ⋃ i, D i) + (hb : ∀ i, ((D i \ N) ∩ bd T).Nonempty → (N ∩ D i).ncard = 2 ∧ IsLine (D i ∩ bd T) ∧ lineEnds + (D i ∩ bd T) = N ∩ D i) : + ∃ Γ : Painting T, Γ.U = (⋃ i, D i) ∧ Γ.N = N ∧ Γ.C = range (fun i => D i \ N) ∧ + ∀ i, closure (D i \ N) = D i ∧ tilde (D i \ N) = N ∩ D i := by + have hcl : ∀ i, closure (D i \ N) = D i := fun i => (disc_diff_finite (hD i) (hNb i)).1 + have htl : ∀ i, tilde (D i \ N) = N ∩ D i := fun i => by + rw [tilde, hcl] + ext x + simp only [mem_sdiff, mem_inter_iff, not_and, not_not] + exact ⟨fun h => ⟨h.2 h.1, h.1⟩, fun h => ⟨h.2, fun _ => h.1⟩⟩ + have hne : ∀ i, (D i \ N).Nonempty := fun i => by + by_contra hn + rw [not_nonempty_iff_eq_empty] at hn + have h1 := hcl i + rw [hn, closure_empty] at h1 + obtain ⟨x, hx⟩ := (IsOArc.isConnected' (hD i).isOArc_discBd).nonempty + have := discBd_subset _ hx + rw [← h1] at this + exact this + have hdc : ∀ i, IsClosed (D i) := fun i => (hD i).isClosed + have hC : arcComponentsIn ((⋃ i, D i) \ N) = range (fun i => D i \ N) := by + refine arcComponentsIn_eq_of_finite_cover (Set.finite_range _) ?_ ?_ ?_ ?_ ?_ + · ext x + simp + · rintro _ ⟨i, rfl⟩ + exact hne i + · rintro _ ⟨i, rfl⟩ + exact GM11.isPathConnected_disc_sdiff (hD i) (hNb i) + · rintro _ ⟨i, rfl⟩ _ ⟨j, rfl⟩ hij + have hij' : i ≠ j := fun h => hij (h ▸ rfl) + exact Set.disjoint_left.mpr fun x hx hx' => hx.2 (hdis i j hij' ⟨hx.1, hx'.1⟩) + · rintro _ ⟨i, rfl⟩ + rw [show closure (D i \ N) = D i from hcl i] + ext x + constructor + · rintro ⟨h1, -, h2⟩ + exact ⟨h1, h2⟩ + · rintro ⟨h1, h2⟩ + exact ⟨h1, mem_iUnion.2 ⟨i, h1⟩, h2⟩ + refine ⟨{ U := ⋃ i, D i, N := N, isClosed_U := isClosed_iUnion_of_finite hdc, N_subset + := hNU, finite_N := hN, finite_cells := ?_, cell_disc := ?_, bd_subset := hbd, border_cell + := ?_ }, rfl, rfl, hC, fun i => ⟨hcl i, htl i⟩⟩ + · rw [hC] + exact Set.finite_range _ + · rw [hC] + rintro _ ⟨i, rfl⟩ + rw [hcl] + refine ⟨hD i, ?_, ?_, ?_⟩ + · rw [htl] + exact hNb i + · rw [htl] + exact hN.subset inter_subset_left + · rw [htl] + exact h3 i + · rw [hC] + rintro _ ⟨i, rfl⟩ h + obtain ⟨h1, h2, h4⟩ := hb i h + rw [hcl, htl] + exact ⟨h1, hN.subset inter_subset_left, h2, h4⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/PaintTransfer.lean b/LeanPool/GraphMinor/GM17/PaintTransfer.lean new file mode 100644 index 0000000000..0b64592de0 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/PaintTransfer.lean @@ -0,0 +1,321 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CutSide + +/-! +# Moving part of a painting to another surface + +Let `K` be a closed part of the painted set `U(Γ)` of a surface `S` that is a union of connected +parts of `U(Γ)`. Suppose an injection `ι` of `S` +into a surface `T` is continuous on `K`, and the boundary of `T` is the image of the part of the +boundary of `S` in `K`. Then `K` carries a +painting of `T` (`Painting.transfer`), and this is a cut-side painting for the cells in `K` with +nothing cut (`cutSide_of_part`). We use it for +a curve off `U(Γ)`, in the proof of (5.4) of Graph Minors XVII (page 173). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {S T K : Type} [TopologicalSpace S] [TopologicalSpace T] [TopologicalSpace K] + +theorem isClosedDisc_swap {v : K → S} {f : K → T} (hv : IsEmbedding v) + (hf : IsEmbedding f) {D : Set K} (h : IsClosedDisc (v '' D)) : IsClosedDisc (f '' D) := by + obtain ⟨φ⟩ := h + exact ⟨(φ.trans (hv.homeomorphImage D).symm).trans (hf.homeomorphImage D)⟩ + +theorem isLine_swap {v : K → S} {f : K → T} (hv : IsEmbedding v) (hf : IsEmbedding f) {D : Set K} + (h : IsLine (v '' D)) : IsLine (f '' D) := by + obtain ⟨φ⟩ := h + exact ⟨(φ.trans (hv.homeomorphImage D).symm).trans (hf.homeomorphImage D)⟩ + +/-- The cells of a part of a painted set are cells of the painting. -/ +theorem image_mem_C {Γ : Painting S} {v : K → S} (hv : IsEmbedding v) + (hconn : ∀ D : Set S, IsPreconnected D → D ⊆ Γ.U → (D ∩ range v).Nonempty → D ⊆ range v) + (hr : range v ⊆ Γ.U) {c : Set K} (hc : c ∈ arcComponentsIn (univ \ v ⁻¹' Γ.N)) : v '' c ∈ Γ.C + := by + have h1 := mem_image_of_mem (fun c => v '' c) hc + rw [← arcComps_image hv] at h1 + refine ⟨h1.1, ?_, h1.2.2.1, fun D hDF hD hsub => ?_⟩ + · refine h1.2.1.trans ?_ + rintro _ ⟨x, hx, rfl⟩ + exact ⟨hr ⟨x, rfl⟩, hx.2⟩ + · obtain ⟨y, hy⟩ := h1.1 + have h2 := hconn D hD.isConnected.isPreconnected (fun x hx => (hDF hx).1) ⟨y, hsub hy, + (image_subset_range _ _ (h1.2.1 hy)).elim fun x hx => ⟨x, hx⟩⟩ + refine h1.2.2.2 D (fun x hx => ?_) hD hsub + obtain ⟨z, rfl⟩ := h2 hx + exact ⟨z, ⟨mem_univ _, (hDF hx).2⟩, rfl⟩ + +/-- The cells of the painting that meet a part of the painted set come from cells of the part. -/ +theorem exists_arc_of_C {Γ : Painting S} {v : K → S} (hv : IsEmbedding v) + (hconn : ∀ D : Set S, IsPreconnected D → D ⊆ Γ.U → (D ∩ range v).Nonempty → D ⊆ range v) + (hr : range v ⊆ Γ.U) {c : Set S} (hc : c ∈ Γ.C) (hs : (c ∩ range v).Nonempty) : ∃ c₁ ∈ + arcComponentsIn (univ \ v ⁻¹' Γ.N), v '' c₁ = c := by + obtain ⟨_, hxc, x, rfl⟩ := hs + obtain ⟨c₁, hc₁, hx⟩ := exists_mem_arcComponentsIn (F := univ \ v ⁻¹' Γ.N) (x := x) ⟨mem_univ _, + (arcComponentsIn_subset hc hxc).2⟩ + exact ⟨c₁, hc₁, arcComponentsIn_eq_of_mem (image_mem_C hv hconn hr hc₁) hc + (mem_image_of_mem _ hx) hxc⟩ + +/-- Part of a painting moves to another surface. -/ +noncomputable def Painting.transfer (Γ : Painting S) {v : K → S} {f : K → T} + (hv : IsClosedEmbedding v) (hf : IsClosedEmbedding f) + (hconn : ∀ D : Set S, IsPreconnected D → D ⊆ Γ.U → (D ∩ range v).Nonempty → D ⊆ range v) + (hr : range v ⊆ Γ.U) (hb : bd T ⊆ range f) + (hbd : ∀ x, f x ∈ bd T ↔ v x ∈ bd S) : Painting T where + U := range f + N := f '' (v ⁻¹' Γ.N) + isClosed_U := hf.isClosed_range + N_subset := image_subset_range _ _ + finite_N := (Γ.finite_N.preimage hv.injective.injOn).image _ + finite_cells := by + rw [← image_univ, ← image_sdiff hf.injective, arcComps_image hf.isEmbedding] + refine Set.Finite.image _ (Set.Finite.of_finite_image (f := fun c => v '' c) + (Γ.finite_cells.subset ?_) ?_) + · rintro _ ⟨c, hc, rfl⟩ + exact image_mem_C hv.isEmbedding hconn hr hc + · exact fun c _ c' _ he => (image_eq_image hv.injective).mp he + cell_disc := by + rw [← image_univ, ← image_sdiff hf.injective, arcComps_image hf.isEmbedding] + rintro _ ⟨c₁, hc₁, rfl⟩ + obtain ⟨h1, h2, h3, h4⟩ := Γ.cell_disc _ (image_mem_C hv.isEmbedding hconn hr hc₁) + rw [tilde_image_emb hv, hv.closure_image_eq, discBd_image hv.isEmbedding, + ncard_image_of_injective _ hv.injective] at * + simp only + rw [tilde_image_emb hf, hf.closure_image_eq, discBd_image hf.isEmbedding, + ncard_image_of_injective _ hf.injective] + exact ⟨isClosedDisc_swap hv.isEmbedding hf.isEmbedding h1, image_mono + ((image_subset_image_iff hv.injective).mp h2), + ((h3.preimage hv.injective.injOn).subset (by rw [preimage_image_eq _ hv.injective])).image _, + h4⟩ + bd_subset := hb + border_cell := by + rw [← image_univ, ← image_sdiff hf.injective, arcComps_image hf.isEmbedding] + rintro _ ⟨c₁, hc₁, rfl⟩ ⟨_, ⟨x, hx, rfl⟩, hxb⟩ + have hmem := image_mem_C hv.isEmbedding hconn hr hc₁ + obtain ⟨h1, h2, h3, h4⟩ := Γ.border_cell _ hmem ⟨v x, mem_image_of_mem _ hx, (hbd x).mp hxb⟩ + have h5 : closure c₁ ∩ v ⁻¹' bd S = closure c₁ ∩ f ⁻¹' bd T := by + ext y + exact and_congr_right fun _ => (hbd y).symm + have h6 : closure (v '' c₁) ∩ bd S = v '' (closure c₁ ∩ v ⁻¹' bd S) := by + rw [hv.closure_image_eq, image_inter_preimage] + have h7 : closure (f '' c₁) ∩ bd T = f '' (closure c₁ ∩ v ⁻¹' bd S) := by + rw [h5, hf.closure_image_eq, image_inter_preimage] + rw [tilde_image_emb hv, ncard_image_of_injective _ hv.injective] at h1 + rw [tilde_image_emb hv] at h2 + rw [h6] at h3 + rw [h6, tilde_image_emb hv, lineEnds_image hv.isEmbedding] at h4 + simp only + rw [h7, tilde_image_emb hf, ncard_image_of_injective _ hf.injective, + lineEnds_image hf.isEmbedding, (image_eq_image hv.injective).mp h4] + exact ⟨h1, ((h2.preimage hv.injective.injOn).subset (by rw [preimage_image_eq _ + hv.injective])).image _, isLine_swap hv.isEmbedding hf.isEmbedding h3, rfl⟩ + +theorem Painting.transfer_C (Γ : Painting S) {v : K → S} {f : K → T} (hv : IsClosedEmbedding v) + (hf : IsClosedEmbedding f) + (hconn : ∀ D : Set S, IsPreconnected D → D ⊆ Γ.U → (D ∩ range v).Nonempty → D ⊆ range v) + (hr : range v ⊆ Γ.U) (hb : bd T ⊆ range f) + (hbd : ∀ x, f x ∈ bd T ↔ v x ∈ bd S) : (Γ.transfer hv hf hconn hr hb hbd).C = (fun c + => f '' c) '' arcComponentsIn (univ \ v ⁻¹' Γ.N) := by + change arcComponentsIn (range f \ f '' (v ⁻¹' Γ.N)) = _ + rw [← image_univ, ← image_sdiff hf.injective, arcComps_image hf.isEmbedding] + +/-- A cuff is closed. -/ +theorem isClosed_of_cuff [T2Space S] (hS : IsSurface S) {Θ : Set S} (hΘ : Θ ∈ cuffs S) : IsClosed Θ + := by + obtain ⟨φ⟩ := (cuff_statement.{0} S hS).2.2 Θ hΘ + have hc : IsCompact Θ := by + rw [isCompact_iff_compactSpace] + exact φ.compactSpace + exact hc.isClosed + +/-- The order of points on a cuff moves along an injection that is continuous on the cuff. -/ +theorem inOrderOn_of_image {Θ : Set S} {Φ : Set T} [CompactSpace Θ] [T2Space T] {ι : S → T} + (hι : Function.Injective ι) (hc : ContinuousOn ι Θ) (he : ι '' Θ = Φ) + {a b c d : S} (h : GM19.InOrderOn Φ (ι a) (ι b) (ι c) (ι d)) : GM19.InOrderOn Θ a b c d := by + obtain ⟨g, t₁, t₂, t₃, t₄, h1, h2, h3, h4, h5, h6, h7, h8⟩ := h + have hcont : Continuous fun x : Θ => ι x.1 := continuousOn_iff_continuous_domRestrict.mp hc + have hemb : IsEmbedding fun x : Θ => ι x.1 := (hcont.isClosedEmbedding fun x y h => Subtype.ext + (hι h)).isEmbedding + have hr : Φ = range fun x : Θ => ι x.1 := by + rw [← he] + ext z + constructor + · rintro ⟨x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + · rintro ⟨x, rfl⟩ + exact ⟨x.1, x.2, rfl⟩ + let g' : Circle ≃ₜ Θ := (g.trans (Homeomorph.setCongr hr)).trans hemb.toHomeomorph.symm + have hg : ∀ t, ι (GM19.cuffPoint g' t) = GM19.cuffPoint g t := fun t => by + have h9 := hemb.toHomeomorph.apply_symm_apply (Homeomorph.setCongr hr (g (Circle.exp t))) + exact congrArg Subtype.val h9 + refine ⟨g', t₁, t₂, t₃, t₄, h1, h2, h3, h4, hι ?_, hι ?_, hι ?_, hι ?_⟩ + · rw [hg, h5] + · rw [hg, h6] + · rw [hg, h7] + · rw [hg, h8] + +/-- A part of a painted set gives a cut-side painting for the cells in it. -/ +theorem cutSide_of_part [CompactSpace S] [T2Space S] [T2Space T] + (hS : IsSurface S) {Γ : Painting S} {A : Set S} (hA : IsClosed A) (hAU : A ⊆ Γ.U) + (hconn : ∀ D : Set S, IsPreconnected D → D ⊆ Γ.U → (D ∩ A).Nonempty → D ⊆ A) {ι : S → T} + (hι : Function.Injective ι) (hcont : ContinuousOn ι A) (hb : bd T ⊆ ι '' A) + (hbd : ∀ x ∈ A, ι x ∈ bd T ↔ x ∈ bd S) (hne : ∃ c ∈ Γ.C, c ⊆ A) : ∃ Γ' : Painting T, + IsCutSidePainting S Γ ∅ {c ∈ Γ.C | c ⊆ A} T ι Γ' := by + classical + have hcK : CompactSpace A := isCompact_iff_compactSpace.mp hA.isCompact + have hv : IsClosedEmbedding (Subtype.val : A → S) := hA.isClosedEmbedding_subtypeVal + have hf0 : Continuous fun x : A => ι x.1 := continuousOn_iff_continuous_domRestrict.mp hcont + have hf : IsClosedEmbedding fun x : A => ι x.1 := hf0.isClosedEmbedding fun x y h => Subtype.ext + (hι h) + have hrv : range (Subtype.val : A → S) = A := Subtype.range_val + have hrf : range (fun x : A => ι x.1) = ι '' A := by + ext z + constructor + · rintro ⟨x, rfl⟩ + exact ⟨x.1, x.2, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + have hconn' : ∀ D : Set S, IsPreconnected D → D ⊆ Γ.U → (D ∩ range (Subtype.val : A + → S)).Nonempty → D ⊆ range (Subtype.val : A → S) := by + rw [hrv] + exact hconn + have hr : range (Subtype.val : A → S) ⊆ Γ.U := hrv.subset.trans hAU + have hb' : bd T ⊆ range fun x : A => ι x.1 := hrf ▸ hb + have hbd' : ∀ x : A, ι x.1 ∈ bd T ↔ x.1 ∈ bd S := fun x => hbd x.1 x.2 + let Γ' := Γ.transfer hv hf hconn' hr hb' hbd' + have hC : Γ'.C = (fun c => ι '' c) '' {c ∈ Γ.C | c ⊆ A} := by + rw [Painting.transfer_C] + ext d + constructor + · rintro ⟨c₁, hc₁, rfl⟩ + refine ⟨Subtype.val '' c₁, ⟨image_mem_C hv.isEmbedding hconn' hr hc₁, ?_⟩, image_image _ _ _⟩ + rintro _ ⟨x, -, rfl⟩ + exact x.2 + · rintro ⟨c, ⟨hc, hs⟩, rfl⟩ + obtain ⟨x, hx⟩ := arcComponentsIn_nonempty hc + have hx' : x ∈ range (Subtype.val : A → S) := by + rw [hrv] + exact hs hx + obtain ⟨c₁, hc₁, rfl⟩ := exists_arc_of_C hv.isEmbedding hconn' hr hc ⟨x, hx, hx'⟩ + exact ⟨c₁, hc₁, (image_image _ _ _).symm⟩ + have hN : Γ'.N = ι '' (Γ.N ∩ A) := by + change (fun x : A => ι x.1) '' (Subtype.val ⁻¹' Γ.N) = _ + ext z + constructor + · rintro ⟨x, hx, rfl⟩ + exact ⟨x.1, ⟨hx, x.2⟩, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨⟨x, hx.2⟩, hx.1, rfl⟩ + have htil : ∀ c ⊆ A, tilde (ι '' c) = ι '' tilde c := fun c hs => by + have h1 : c = Subtype.val '' (Subtype.val ⁻¹' c : Set A) := by + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hs] + have h2 : ι '' c = (fun x : A => ι x.1) '' (Subtype.val ⁻¹' c : Set A) := by + conv_lhs => rw [h1] + rw [image_image] + rw [h2, tilde_image_emb hf] + conv_rhs => rw [h1, tilde_image_emb hv] + rw [image_image] + have hcl : ∀ c ⊆ A, closure c ⊆ A := fun c hs => closure_minimal hs hA + have hcuffb : ∀ {Θ : Set S}, Θ ∈ cuffs S → Θ ⊆ bd S := fun {Θ} hΘ => by + obtain ⟨x, -, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + have hcuffc : ∀ {Θ : Set S}, Θ ∈ cuffs S → IsPreconnected Θ := fun {Θ} hΘ => by + obtain ⟨x, -, rfl⟩ := hΘ + exact isPreconnected_connectedComponentIn + have hΦ : ∀ Φ ∈ cuffs T, ∃ Θ ∈ cuffs S, Θ ⊆ A ∧ ι '' Θ = Φ := by + rintro _ ⟨x, hx, rfl⟩ + obtain ⟨y, hyA, rfl⟩ := hb hx + have hyb : y ∈ bd S := (hbd y hyA).mp hx + have hΘ : connectedComponentIn (bd S) y ∈ cuffs S := ⟨y, hyb, rfl⟩ + have hsA := hconn _ (hcuffc hΘ) ((hcuffb hΘ).trans Γ.bd_subset) ⟨y, mem_connectedComponentIn + hyb, hyA⟩ + refine ⟨_, hΘ, hsA, subset_antisymm ?_ ?_⟩ + · refine IsPreconnected.subset_connectedComponentIn ((hcuffc hΘ).image _ + (hcont.mono hsA)) ⟨y, mem_connectedComponentIn hyb, rfl⟩ ?_ + rintro _ ⟨z, hz, rfl⟩ + exact (hbd z (hsA hz)).mpr (hcuffb hΘ hz) + · have hQ : connectedComponentIn (bd T) (ι y) ⊆ range fun x : A => ι x.1 := + (connectedComponentIn_subset _ _).trans hb' + have h3 := image_preimage_eq_of_subset hQ + have h4 : IsPreconnected ((fun x : A => ι x.1) ⁻¹' connectedComponentIn (bd T) (ι y)) := by + rw [← hf.isEmbedding.isInducing.isPreconnected_image, h3] + exact isPreconnected_connectedComponentIn + have h5 := h4.image _ continuous_subtype_val.continuousOn + have h6 := h5.subset_connectedComponentIn (x := y) ⟨⟨y, hyA⟩, mem_connectedComponentIn hx, + rfl⟩ (by + rintro _ ⟨z, hz, rfl⟩ + exact (hbd' z).mp (connectedComponentIn_subset _ _ hz)) + rw [← h3] + rintro _ ⟨z, hz, rfl⟩ + exact ⟨z.1, h6 ⟨z, hz, rfl⟩, rfl⟩ + have hactive : ∀ n ∈ Γ.N, n ∈ A → n ∈ bd S → + n ∈ {n ∈ Γ.N \ (∅ : Set S) | ∃ c ∈ {c ∈ Γ.C | c ⊆ A}, n ∈ tilde c} := fun n hn hnA hnb => by + obtain ⟨c, hc, hnt⟩ := exists_cell_node hS hn hnb + refine ⟨⟨hn, notMem_empty _⟩, c, ⟨hc, ?_⟩, hnt⟩ + have h1 : IsPreconnected (insert n c) := (arcComponentsIn_isPathConnected + hc).isConnected.isPreconnected.subset_closure (subset_insert _ _) + (insert_subset hnt.1 subset_closure) + exact (subset_insert _ _).trans (hconn _ h1 (insert_subset (Γ.N_subset hn) fun x hx => + (arcComponentsIn_subset hc hx).1) ⟨n, mem_insert _ _, hnA⟩) + have hkA : ∀ n ∈ {n ∈ Γ.N \ (∅ : Set S) | ∃ c ∈ {c ∈ Γ.C | c ⊆ A}, n ∈ tilde c}, n ∈ A := by + rintro n ⟨-, c, hc, hnt⟩ + exact hcl c hc.2 hnt.1 + have hmemN : ∀ {Θ : Set S}, Θ ∈ cuffs S → Θ ⊆ A → ∀ x ∈ Γ'.N ∩ ι '' Θ, ∃ n ∈ {n ∈ Γ.N \ + (∅ : Set S) | ∃ c ∈ {c ∈ Γ.C | c ⊆ A}, n ∈ tilde c} ∩ Θ, x = ι n := by + rintro Θ hΘ hs x ⟨hx, n, hn, rfl⟩ + rw [hN] at hx + obtain ⟨m, hm, he⟩ := hx + obtain rfl := hι he + exact ⟨m, ⟨hactive m hm.1 hm.2 (hcuffb hΘ hn), hn⟩, rfl⟩ + refine ⟨Γ', ?_⟩ + obtain ⟨c₀, hc₀, hs₀⟩ := hne + refine ⟨hι, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · exact hC.symm.subset + · exact ⟨ι '' c₀, by rw [hC]; exact mem_image_of_mem _ (⟨hc₀, hs₀⟩ : c₀ ∈ {c ∈ Γ.C | c ⊆ A})⟩ + · rintro _ ⟨n, hn, rfl⟩ + rw [hN] + exact mem_image_of_mem _ ⟨hn.1.1, hkA n hn⟩ + · rintro c hc n - + rw [htil c hc.2] + exact hι.mem_set_image + · rintro c ⟨hc, hs⟩ + constructor + · rintro ⟨_, ⟨x, hx, rfl⟩, hxb⟩ + exact ⟨x, hx, (hbd x (hs hx)).mp hxb⟩ + · rintro ⟨x, hx, hxb⟩ + exact ⟨ι x, mem_image_of_mem _ hx, (hbd x (hs hx)).mpr hxb⟩ + · intro n hn + exact hbd n (hkA n hn) + · intro d hd hn + exact absurd (hC.subset hd) hn + · intro Φ hΦ' n₁ hn₁ h₁ n₂ hn₂ h₂ + obtain ⟨Θ, hΘ, hsA, rfl⟩ := hΦ Φ hΦ' + refine ⟨Θ, hΘ, hι.mem_set_image.mp h₁, .inl fun h => h₂ (mem_image_of_mem _ h)⟩ + · intro Φ hΦ' x₁ hx₁ x₂ hx₂ x₃ _ x₄ hx₄ hord n₁ hn₁ h₁ n₃ hn₃ h₃ Θ hΘ hnΘ hnΘ' + obtain ⟨Θ₀, hΘ₀, hsA, rfl⟩ := hΦ Φ hΦ' + have hn₁0 : n₁ ∈ Θ₀ := by + have h9 : x₁ ∈ ι '' Θ₀ := hx₁.2 + rw [h₁] at h9 + exact hι.mem_set_image.mp h9 + obtain rfl := cuffs_disjoint_eq hΘ hΘ₀ hnΘ hn₁0 + obtain ⟨n₂, hn₂, rfl⟩ := hmemN hΘ hsA _ hx₂ + obtain ⟨n₄, hn₄, rfl⟩ := hmemN hΘ hsA _ hx₄ + have hcK : CompactSpace Θ := isCompact_iff_compactSpace.mp (isClosed_of_cuff hS hΘ).isCompact + subst h₁ h₃ + exact .inr (.inl ⟨n₂, hn₂, rfl, n₄, .inr ⟨hn₄, rfl⟩, inOrderOn_of_image hι + (hcont.mono hsA) rfl hord⟩) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/PasteCuff.lean b/LeanPool/GraphMinor/GM17/PasteCuff.lean new file mode 100644 index 0000000000..58b0671341 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/PasteCuff.lean @@ -0,0 +1,226 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section8 +public import LeanPool.GraphMinor.Surface.PasteModel +public import LeanPool.GraphMinor.Surface.PasteDisc + +/-! +# Pasting a disc on a cuff of a painted surface + +We prove `PasteCuffPaintingStatement`, the surface fact behind (5.1) of Graph Minors XVII (page +171). A painting moves along a closed +embedding of surfaces (`Painting.pushClosed`), as long as the boundary of the new surface is in the +image of `U(Γ)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {S S' : Type} [TopologicalSpace S] [TopologicalSpace S'] {ι : S → S'} + +theorem arcComps_image (hι : IsEmbedding ι) (W : Set S) : + arcComponentsIn (ι '' W) = (fun c => ι '' c) '' arcComponentsIn W := by + have himg : ∀ c ∈ arcComponentsIn W, ι '' c ∈ arcComponentsIn (ι '' W) := fun c hc => by + refine ⟨hc.1.image _, image_mono hc.2.1, hc.2.2.1.image hι.continuous, fun D hDF hD hsub => ?_⟩ + have hDr : ι '' (ι ⁻¹' D) = D := image_preimage_eq_of_subset (hDF.trans + (image_subset_range _ _)) + have hpc : IsPathConnected (ι ⁻¹' D) := by + rw [hι.isInducing.isPathConnected_iff, hDr] + exact hD + have hsub' : ι ⁻¹' D ⊆ W := fun x hx => by + obtain ⟨y, hy, hyx⟩ := hDF hx + exact hι.injective hyx ▸ hy + have := hc.2.2.2 (ι ⁻¹' D) hsub' hpc fun x hx => hsub (mem_image_of_mem _ hx) + rw [← hDr, this] + ext d + constructor + · intro hd + obtain ⟨x, hx⟩ := hd.1 + obtain ⟨y, hy, rfl⟩ := hd.2.1 hx + obtain ⟨c, hc, hyc⟩ := exists_mem_arcComponentsIn hy + refine ⟨c, hc, ?_⟩ + exact arcComponentsIn_eq_of_mem (himg c hc) hd (mem_image_of_mem _ hyc) hx + · rintro ⟨c, hc, rfl⟩ + exact himg c hc + +theorem discBd_image (hι : IsEmbedding ι) (Δ : Set S) : discBd (ι '' Δ) = ι '' discBd Δ := by + have h := image_bd_homeomorph (hι.homeomorphImage Δ) + rw [discBd, discBd, ← h, image_image, image_image] + rfl + +theorem image_emb_disc (hι : IsEmbedding ι) {Δ : Set S} (h : IsClosedDisc Δ) : IsClosedDisc + (ι '' Δ) := by + obtain ⟨φ⟩ := h + exact ⟨φ.trans (hι.homeomorphImage Δ)⟩ + +theorem tilde_image_emb (hι : IsClosedEmbedding ι) (c : Set S) : tilde (ι '' c) = ι '' tilde c := by + rw [tilde, tilde, hι.closure_image_eq, image_sdiff hι.injective] + +theorem isLine_image (hι : IsEmbedding ι) {L : Set S} (h : IsLine L) : IsLine (ι '' L) := by + obtain ⟨f⟩ := h + exact ⟨f.trans (hι.homeomorphImage L)⟩ + +theorem lineEnds_image (hι : IsEmbedding ι) {L : Set S} : lineEnds (ι '' L) = ι '' lineEnds L := by + ext x + constructor + · rintro ⟨y, f, h1, h2⟩ + let f' := f.trans (hι.homeomorphImage L).symm + have hf : ∀ t, ι (f' t).1 = (f t).1 := fun t => by + have h3 := (hι.homeomorphImage L).apply_symm_apply (f t) + exact congrArg Subtype.val h3 + exact ⟨(f' 0).1, ⟨(f' 1).1, f', rfl, rfl⟩, (hf 0).trans h1⟩ + · rintro ⟨_, ⟨y, f, rfl, rfl⟩, rfl⟩ + exact ⟨ι (f 1).1, f.trans (hι.homeomorphImage L), rfl, rfl⟩ + +/-- A painting moves along a closed embedding, if the boundary of the new surface lies in the image +of `U(Γ)` and the border cells of the +image come from border cells with the same boundary. -/ +noncomputable def Painting.pushClosed (Γ : Painting S) (hι : IsClosedEmbedding ι) + (hb : bd S' ⊆ ι '' Γ.U) + (hbord : ∀ c ∈ Γ.C, (ι '' c ∩ bd S').Nonempty → (c ∩ bd S).Nonempty ∧ closure (ι '' c) ∩ bd S' + = ι '' (closure c ∩ bd S)) : Painting S' where + U := ι '' Γ.U + N := ι '' Γ.N + isClosed_U := hι.isClosedMap _ Γ.isClosed_U + N_subset := image_mono Γ.N_subset + finite_N := Γ.finite_N.image _ + finite_cells := by + rw [← image_sdiff hι.injective, arcComps_image hι.isEmbedding] + exact Γ.finite_cells.image _ + cell_disc := by + rw [← image_sdiff hι.injective, arcComps_image hι.isEmbedding] + rintro _ ⟨c, hc, rfl⟩ + obtain ⟨h1, h2, h3, h4⟩ := Γ.cell_disc c hc + simp only + rw [tilde_image_emb hι, hι.closure_image_eq, discBd_image hι.isEmbedding, + ncard_image_of_injective _ hι.injective] + exact ⟨image_emb_disc hι.isEmbedding h1, image_mono h2, h3.image _, h4⟩ + bd_subset := hb + border_cell := by + rw [← image_sdiff hι.injective, arcComps_image hι.isEmbedding] + rintro _ ⟨c, hc, rfl⟩ h + obtain ⟨h0, h5⟩ := hbord c hc h + obtain ⟨h1, h2, h3, h4⟩ := Γ.border_cell c hc h0 + simp only + rw [tilde_image_emb hι, h5, ncard_image_of_injective _ hι.injective, + lineEnds_image hι.isEmbedding, h4] + exact ⟨h1, h2.image _, isLine_image hι.isEmbedding h3, rfl⟩ + +theorem Painting.pushClosed_C (Γ : Painting S) (hι : IsClosedEmbedding ι) (hb) (hbord) : + (Γ.pushClosed hι hb hbord).C = (fun c => ι '' c) '' Γ.C := by + change arcComponentsIn (ι '' Γ.U \ ι '' Γ.N) = _ + rw [← image_sdiff hι.injective, arcComps_image hι.isEmbedding] + rfl + +theorem cuffs_disjoint_eq {C C' : Set S} (h : C ∈ cuffs S) (h' : C' ∈ cuffs S) {x : S} (hx : x ∈ C) + (hx' : x ∈ C') : C = C' := by + by_contra hne + exact disjoint_left.mp (cuffs_disjoint h h' hne) hx hx' + +/-- (5.1) of Graph Minors XVII, the surface part. -/ +theorem pasteCuffPainting : PasteCuffPaintingStatement := by + unfold PasteCuffPaintingStatement + intro S _ hcS ht2 hconn hS Γ Θ hΘ + obtain ⟨S', tS', ι, Δ, hS', hι, hΔ, hcov, hmeet, hΔb, hbdS⟩ := paste_disc.{0} S Θ hS hΘ + obtain ⟨a, b, c, ⟨e⟩⟩ := classification.{0} S hS hconn + obtain ⟨hc0, ⟨e'⟩⟩ := paste_model hS hΘ hS' hι hΔ hcov hmeet hΔb e + have hcS' : CompactSpace S' := hS'.1 + have ht2' : T2Space S' := hS'.2.1 + have hconn' : ConnectedSpace S' := by + have := (isSurface_model a b (c - 1)).2 + exact e'.symm.surjective.connectedSpace e'.symm.continuous + have hbsub : bd S ⊆ Γ.U := Γ.bd_subset + have hcuffΘ : Θ ⊆ bd S := by + obtain ⟨x, -, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + have hb : bd S' ⊆ ι '' Γ.U := by + rw [hbdS] + exact image_mono (sdiff_subset.trans hbsub) + have hbord : ∀ c ∈ Γ.C, (ι '' c ∩ bd S').Nonempty → (c ∩ bd S).Nonempty ∧ closure + (ι '' c) ∩ bd S' = ι '' (closure c ∩ bd S) := by + rintro c hc ⟨_, ⟨x, hx, rfl⟩, hxb⟩ + rw [hbdS] at hxb + obtain ⟨y, ⟨hy, hyΘ⟩, he⟩ := hxb + obtain rfl := hι.injective he + refine ⟨⟨y, hx, hy⟩, ?_⟩ + have hΘ₂ : connectedComponentIn (bd S) y ∈ cuffs S := ⟨y, hy, rfl⟩ + have hne : connectedComponentIn (bd S) y ≠ Θ := fun h => hyΘ (h ▸ mem_connectedComponentIn hy) + have h1 := (Γ.border_cell_subset_cuff hc hΘ₂ ⟨y, hx, mem_connectedComponentIn hy⟩).1 + have h2 := cuffs_disjoint hΘ₂ hΘ hne + rw [hι.closure_image_eq, hbdS, ← image_inter hι.injective] + congr 1 + ext z + constructor + · rintro ⟨h3, h4, -⟩ + exact ⟨h3, h4⟩ + · intro h3 + exact ⟨h3.1, h3.2, disjoint_left.mp h2 (h1 h3)⟩ + have hcomp : ∀ y ∈ bd S \ Θ, connectedComponentIn (bd S') (ι y) = ι '' connectedComponentIn + (bd S) y := by + rintro y ⟨hy, hyΘ⟩ + have hΘ₂ : connectedComponentIn (bd S) y ∈ cuffs S := ⟨y, hy, rfl⟩ + have hne : connectedComponentIn (bd S) y ≠ Θ := fun h => hyΘ (h ▸ mem_connectedComponentIn hy) + have h2 := cuffs_disjoint hΘ₂ hΘ hne + have hyb : ι y ∈ bd S' := hbdS ▸ ⟨y, ⟨hy, hyΘ⟩, rfl⟩ + apply subset_antisymm + · have hQ := connectedComponentIn_subset (bd S') (ι y) + have hQr : connectedComponentIn (bd S') (ι y) ⊆ range ι := by + rw [hbdS] at hQ ⊢ + exact hQ.trans (image_subset_range _ _) + have h3 : ι '' (ι ⁻¹' connectedComponentIn (bd S') (ι y)) = connectedComponentIn (bd S') + (ι y) := image_preimage_eq_of_subset hQr + have h4 : IsPreconnected (ι ⁻¹' connectedComponentIn (bd S') (ι y)) := by + rw [← hι.isEmbedding.isInducing.isPreconnected_image, h3] + exact isPreconnected_connectedComponentIn + have h5 : ι ⁻¹' connectedComponentIn (bd S') (ι y) ⊆ bd S := fun z hz => by + have h6 := hQ hz + rw [hbdS] at h6 + obtain ⟨w, hw, he⟩ := h6 + exact hι.injective he ▸ hw.1 + have h7 := h4.subset_connectedComponentIn (mem_connectedComponentIn hyb) h5 + rw [← h3] + exact image_mono h7 + · refine IsPreconnected.subset_connectedComponentIn (isPreconnected_connectedComponentIn.image + _ hι.continuous.continuousOn) + ⟨y, mem_connectedComponentIn hy, rfl⟩ ?_ + rintro _ ⟨z, hz, rfl⟩ + rw [hbdS] + exact ⟨z, ⟨connectedComponentIn_subset _ _ hz, fun h => disjoint_left.mp h2 hz h⟩, rfl⟩ + have hcuffs : cuffs S' = (fun Θ' => ι '' Θ') '' (cuffs S \ {Θ}) := by + ext P + constructor + · rintro ⟨x, hx, rfl⟩ + have hx' := hx + rw [hbdS] at hx' + obtain ⟨y, hy, rfl⟩ := hx' + refine ⟨connectedComponentIn (bd S) y, ⟨⟨y, hy.1, rfl⟩, fun h => hy.2 ?_⟩, (hcomp y hy).symm⟩ + have h1 : connectedComponentIn (bd S) y = Θ := h + exact h1 ▸ mem_connectedComponentIn hy.1 + · rintro ⟨_, ⟨⟨y, hy, rfl⟩, hne⟩, rfl⟩ + have hyΘ : y ∉ Θ := fun h => hne (cuffs_disjoint_eq hΘ ⟨y, hy, rfl⟩ h + (mem_connectedComponentIn hy)).symm + exact ⟨ι y, hbdS ▸ ⟨y, ⟨hy, hyΘ⟩, rfl⟩, hcomp y ⟨hy, hyΘ⟩⟩ + refine ⟨S', tS', hcS', ht2', hconn', hS', ⟨a, b, c - 1, a, b, c, ⟨e'⟩, ⟨e⟩, le_rfl, le_rfl, + by omega⟩, ι, Γ.pushClosed hι hb hbord, hι.injective, rfl, + Γ.pushClosed_C hι hb hbord, hbdS, hcuffs, fun c _ => tilde_image_emb hι c, ?_⟩ + rintro Θ' hΘ' hne n₁ h₁ n₂ h₂ n₃ h₃ n₄ h₄ ⟨f, t₁, t₂, t₃, t₄, h12, h23, h34, h41, e1, e2, e3, e4⟩ + let f' := f.trans (hι.isEmbedding.homeomorphImage Θ').symm + have hf : ∀ t, ι (GM19.cuffPoint f' t) = GM19.cuffPoint f t := fun t => by + have h3 := (hι.isEmbedding.homeomorphImage Θ').apply_symm_apply (f (Circle.exp t)) + exact congrArg Subtype.val h3 + exact ⟨f', t₁, t₂, t₃, t₄, h12, h23, h34, h41, hι.injective ((hf _).trans e1), + hι.injective ((hf _).trans e2), + hι.injective ((hf _).trans e3), hι.injective ((hf _).trans e4)⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/PushNode.lean b/LeanPool/GraphMinor/GM17/PushNode.lean new file mode 100644 index 0000000000..abc3fbb295 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/PushNode.lean @@ -0,0 +1,405 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.FreeLift +public import LeanPool.GraphMinor.GM17.MarkCross +public import LeanPool.GraphMinor.Surface.Wedge + +/-! +# The surface part of (5.4) of Graph Minors XVII + +See the module docstring of `GraphMinor.GM17.Bigon`. Here we build the disc `G` at a node +(`exists_bigon`) and prove `cutNormalOArc : CutNormalOArcPaintingStatement` by induction on +the number of nodes on the curve. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {Y S T : Type} [TopologicalSpace Y] [TopologicalSpace S] [TopologicalSpace T] + +/-- A short piece of a line at one of its ends that misses a finite set. -/ +theorem exists_sub_end [T2Space T] {K E : Set T} {y p : T} (hK : IsLineWithEnds K y p) + (hE : E.Finite) : ∃ q L, IsLineWithEnds L y q ∧ L ⊆ K ∧ L ∩ E ⊆ {y} := by + obtain ⟨a, ha, rfl, rfl, rfl⟩ := hK.exists_arc + have hfin : (a ⁻¹' E \ {0}).Finite := (hE.preimage ha.2.injOn).subset sdiff_subset + have hn : (a ⁻¹' E \ {0})ᶜ ∈ 𝓝 (0 : unitInterval) := hfin.isClosed.isOpen_compl.mem_nhds fun h + => h.2 rfl + obtain ⟨u, hu, hs⟩ := exists_Ico_subset_of_mem_nhds hn ⟨1, by simp⟩ + obtain ⟨r, hr, hr'⟩ := exists_between hu + refine ⟨a r, _, isLine_piece ha hr, image_subset_range _ _, ?_⟩ + rintro _ ⟨⟨t, ht, rfl⟩, hE'⟩ + have h1 : t ∉ a ⁻¹' E \ {0} := hs ⟨ht.1, ht.2.trans_lt hr'⟩ + have h2 : t = 0 := by + by_contra h + exact h1 ⟨hE', h⟩ + exact h2 ▸ rfl + +omit [TopologicalSpace T] in +theorem exists_pair_line {ψ : Y → T} {Z : Set T} {a b : T} {X X' : Set Y} + (h : LiftPair ψ Z a b X X') {y : Y} (hy : ψ y ∈ Z) : + ∃ K k₀ k₁, IsLineWithEnds K k₀ k₁ ∧ y ∈ K ∧ BijOn ψ K Z ∧ ψ k₀ = a ∧ ψ k₁ = b := by + obtain ⟨x0, x1, y0, y1, h1, h2, -, h4, h5, h6, h7, h8, h9, h10⟩ := h + rcases (h4.symm.subset hy : y ∈ X ∪ X') with h | h + · exact ⟨X, x0, x1, h1, h, h5, h7, h9⟩ + · exact ⟨X', y0, y1, h2, h, h6, h8, h10⟩ + +omit [TopologicalSpace T] in +/-- Two lines of the preimage of a curve that leave a point on it. -/ +theorem exists_two_lines [T2Space Y] {ψ : Y → T} {Z₁ Z₂ : Set T} {u c : T} {X₁ Y₁ X₂ Y₂ : Set Y} + (h1 : LiftPair ψ Z₁ u c X₁ Y₁) (h2 : LiftPair ψ Z₂ c u X₂ Y₂) + (hi : Z₁ ∩ Z₂ = {u, c}) (_hne : u ≠ c) {y : Y} (hy : ψ y ∈ Z₁ ∪ Z₂) : + ∃ K₁ K₂ p₁ p₂, IsLineWithEnds K₁ y p₁ ∧ IsLineWithEnds K₂ y p₂ ∧ InjOn ψ K₁ ∧ InjOn ψ K₂ + ∧ K₁ ⊆ ψ ⁻¹' (Z₁ ∪ Z₂) ∧ K₂ ⊆ ψ ⁻¹' (Z₁ ∪ Z₂) ∧ + (∀ x ∈ K₁, ∀ x' ∈ K₂, ψ x = ψ x' → x = x' ∨ ψ x ∈ ({u, c} : Set T)) ∧ ∀ x ∈ K₁, x ∈ K₂ → x + = y ∨ ψ x ∈ ({u, c} : Set T) := by + have hmid : ∀ {Z : Set T} {a b : T}, Z ⊆ Z₁ ∪ Z₂ → (∃ K k₀ k₁, IsLineWithEnds K k₀ k₁ ∧ y ∈ K + ∧ BijOn ψ K Z ∧ ψ k₀ = a ∧ ψ k₁ = b) → ψ y ≠ a → ψ y ≠ b → + ∃ K₁ K₂ p₁ p₂, IsLineWithEnds K₁ y p₁ ∧ IsLineWithEnds K₂ y p₂ ∧ InjOn ψ K₁ ∧ InjOn ψ K₂ + ∧ K₁ ⊆ ψ ⁻¹' (Z₁ ∪ Z₂) ∧ K₂ ⊆ ψ ⁻¹' (Z₁ ∪ Z₂) ∧ + (∀ x ∈ K₁, ∀ x' ∈ K₂, ψ x = ψ x' → x = x' ∨ ψ x ∈ ({u, c} : Set T)) ∧ ∀ x ∈ K₁, x ∈ K₂ → x + = y ∨ ψ x ∈ ({u, c} : Set T) := by + rintro Z a b hZ ⟨K, k₀, k₁, hK, hyK, hb, h3, h4⟩ ha hb' + obtain ⟨L₁, L₂, h5, h6, h7, h8⟩ := hK.split hyK (fun h => ha (h ▸ h3)) (fun h => hb' (h ▸ h4)) + have hs₁ : L₁ ⊆ K := h7 ▸ subset_union_left + have hs₂ : L₂ ⊆ K := h7 ▸ subset_union_right + refine ⟨L₁, L₂, k₀, k₁, h5.symm, h6, hb.injOn.mono hs₁, hb.injOn.mono hs₂, + fun x hx => hZ (hb.mapsTo (hs₁ hx)), fun x hx => hZ (hb.mapsTo (hs₂ hx)), ?_, ?_⟩ + · exact fun x hx x' hx' he => .inl (hb.injOn (hs₁ hx) (hs₂ hx') he) + · intro x hx hx' + exact .inl (h8.subset ⟨hx, hx'⟩) + have hcross : ∀ {K₁ K₂ : Set Y}, BijOn ψ K₁ Z₁ → BijOn ψ K₂ Z₂ → (∀ x ∈ K₁, ∀ x' ∈ K₂, ψ x = ψ x' + → x = x' ∨ ψ x ∈ ({u, c} : Set T)) ∧ ∀ x ∈ K₁, x ∈ K₂ → x = y ∨ ψ x ∈ ({u, c} : Set T) := by + intro K₁ K₂ h3 h4 + constructor + · exact fun x hx x' hx' he => .inr (hi ▸ ⟨h3.mapsTo hx, he ▸ h4.mapsTo hx'⟩) + · exact fun x hx hx' => .inr (hi ▸ ⟨h3.mapsTo hx, h4.mapsTo hx'⟩) + by_cases hu : ψ y = u + · have hu₁ : u ∈ Z₁ ∩ Z₂ := hi ▸ mem_insert _ _ + obtain ⟨K, k₀, k₁, hK, hyK, hb, h3, -⟩ := exists_pair_line h1 (hu ▸ hu₁.1 : ψ y ∈ Z₁) + obtain ⟨K', k₀', k₁', hK', hyK', hb', -, h4⟩ := exists_pair_line h2 (hu ▸ hu₁.2 : ψ y ∈ Z₂) + have e1 : k₀ = y := hb.injOn hK.left_mem hyK (h3.trans hu.symm) + have e2 : k₁' = y := hb'.injOn hK'.right_mem hyK' (h4.trans hu.symm) + subst e1 + obtain ⟨hc1, hc2⟩ := hcross hb hb' + exact ⟨K, K', k₁, k₀', hK, e2 ▸ hK'.symm, hb.injOn, hb'.injOn, + fun x hx => .inl (hb.mapsTo hx), fun x hx => .inr (hb'.mapsTo hx), hc1, hc2⟩ + by_cases hc : ψ y = c + · have hu₁ : c ∈ Z₁ ∩ Z₂ := hi ▸ mem_insert_of_mem _ rfl + obtain ⟨K, k₀, k₁, hK, hyK, hb, -, h3⟩ := exists_pair_line h1 (hc ▸ hu₁.1 : ψ y ∈ Z₁) + obtain ⟨K', k₀', k₁', hK', hyK', hb', h4, -⟩ := exists_pair_line h2 (hc ▸ hu₁.2 : ψ y ∈ Z₂) + have e1 : k₁ = y := hb.injOn hK.right_mem hyK (h3.trans hc.symm) + have e2 : k₀' = y := hb'.injOn hK'.left_mem hyK' (h4.trans hc.symm) + subst e1 + obtain ⟨hc1, hc2⟩ := hcross hb hb' + exact ⟨K, K', k₀, k₁', hK.symm, e2 ▸ hK', hb.injOn, hb'.injOn, + fun x hx => .inl (hb.mapsTo hx), fun x hx => .inr (hb'.mapsTo hx), hc1, hc2⟩ + rcases hy with hy | hy + · exact hmid subset_union_left (exists_pair_line h1 hy) hu hc + · exact hmid subset_union_right (exists_pair_line h2 hy) hc hu + +theorem line_image [T2Space T] {L : Set Y} {u v : Y} {f : Y → T} (hc : Continuous f) + (hi : InjOn f L) (hL : IsLineWithEnds L u v) : IsLineWithEnds (f '' L) (f u) (f v) := + hL.image_under_injOn hc.continuousOn hi + +/-- At a node on a normal curve there is a thin disc with a line of the curve around the node on its +boundary, which meets the paint only at the node. -/ +theorem exists_bigon [CompactSpace S] [T2Space S] [ConnectedSpace S] (hS : IsSurface S) {Γ : + Painting S} {F : Set S} (hO : IsOArc F) (hnorm : Γ.IsNormal F) + (hint : ∀ c ∈ Γ.C, Γ.IsInternalCell c → Disjoint (tilde c) F) {n : S} (hnF : n ∈ F) + (hnU : n ∈ Γ.U) : + ∃ G L₀ L₁ u v, IsClosedDisc G ∧ IsLineWithEnds L₀ u v ∧ IsLineWithEnds L₁ u v ∧ discBd G + = L₀ ∪ L₁ ∧ L₀ ∩ L₁ = {u, v} ∧ G ∩ F = L₀ ∧ G ∩ Γ.U ⊆ {n} ∧ n ∈ L₀ ∧ n ≠ u ∧ n ≠ v := by + classical + obtain ⟨T, tT, j, cap, hT, hTc, hj, hcap, hcov⟩ := exists_cap_discs _ S hS rfl + have hcT : CompactSpace T := hT.1 + have ht2T : T2Space T := hT.2.1 + have hTs : IsSurface T := ⟨hT.1, hT.2.1, fun x => (hT.2.2 x).isManifoldPoint⟩ + have hOt : IsOArc (j '' F) := by + obtain ⟨φ⟩ := id hO + exact ⟨φ.trans (hj.isEmbedding.homeomorphImage _)⟩ + have hFc : IsClosed (j '' F) := by + obtain ⟨φ⟩ := id hOt + have hc : IsCompact (j '' F) := by + rw [isCompact_iff_compactSpace] + exact φ.compactSpace + exact hc.isClosed + have hd : Disjoint (j '' F) (bd T) := disjoint_left.mpr fun x _ h => h (hT.2.2 x) + obtain ⟨Y, tY, t2Y, ψ, hY, hψ, -, Z₁, Z₂, u, c, X₁, Y₁, X₂, Y₂, h7, h8, hi, hun, huc, -, -⟩ + := exists_cut_loop hTs hOt hd + have hcY : CompactSpace Y := hY.1 + have hnN : n ∈ Γ.N := hnorm ⟨hnF, hnU⟩ + obtain ⟨yHat, hyHat, hyHatZ⟩ := exists_free_lift hS hnorm hint hnF hnN hj hcap hψ hFc + let A : Set T := j '' Γ.U ∪ ⋃ C ∈ cuffs S, cap C + have hfinC := (cuff_statement.{0} S hS).2.1 + have hAc : IsClosed A := (hj.isClosedMap _ Γ.isClosed_U).union (hfinC.isClosed_biUnion fun C hC + => (hcap C hC).1.isClosed) + have hAF : A ∩ j '' F ⊆ j '' (F ∩ Γ.N) := by + rintro _ ⟨h1 | h1, ⟨x, hx, rfl⟩⟩ + · obtain ⟨z, hz, he⟩ := h1 + obtain rfl := hj.injective he + exact mem_image_of_mem _ ⟨hx, hnorm ⟨hx, hz⟩⟩ + · obtain ⟨C, hC, hw⟩ := mem_iUnion₂.mp h1 + obtain ⟨y, hy, he⟩ := ((hcap C hC).2.2 ▸ ⟨⟨x, rfl⟩, hw⟩ : j x ∈ j '' C) + obtain rfl := hj.injective he + have hb : y ∈ bd S := by + obtain ⟨p, -, rfl⟩ := hC + exact connectedComponentIn_subset _ _ hy + exact mem_image_of_mem _ ⟨hx, hnorm ⟨hx, Γ.bd_subset hb⟩⟩ + let E : Set Y := ψ ⁻¹' (j '' (F ∩ Γ.N) ∪ {u, c}) + have hEfin : E.Finite := by + refine Set.Finite.preimage' (((Γ.finite_N.subset inter_subset_right).image _).union + (by simp)) fun b hb => ?_ + have hbF : b ∈ j '' F := by + rcases hb with ⟨x, hx, rfl⟩ | hb + · exact mem_image_of_mem _ hx.1 + · rw [← hun] + exact .inl ((hi ▸ hb : b ∈ Z₁ ∩ Z₂).1) + exact Set.finite_of_encard_le_coe (k := 2) (cut_encard_le hψ hbF) + have hyHatF : ψ yHat ∈ Z₁ ∪ Z₂ := hun ▸ hyHat ▸ mem_image_of_mem _ hnF + obtain ⟨K₁, K₂, p₁, p₂, hK₁, hK₂, hi₁, hi₂, hs₁, hs₂, hcr, hcr'⟩ := exists_two_lines h7 h8 hi huc + hyHatF + obtain ⟨q₁, L₁, hl₁, hsL₁, hE₁⟩ := exists_sub_end hK₁ hEfin + obtain ⟨q₂, L₂, hl₂, hsL₂, hE₂⟩ := exists_sub_end hK₂ hEfin + have huE : ∀ {x}, ψ x ∈ ({u, c} : Set T) → x ∈ E := fun h => .inr h + have h12 : L₁ ∩ L₂ = {yHat} := by + apply subset_antisymm + · rintro x ⟨hx, hx'⟩ + rcases hcr' x (hsL₁ hx) (hsL₂ hx') with h | h + · exact h + · exact hE₁ ⟨hx, huE h⟩ + · rintro _ rfl + exact ⟨hl₁.left_mem, hl₂.left_mem⟩ + have hL := hl₁.symm.union hl₂ h12 + set L := L₁ ∪ L₂ with hLdef + have hLinj : InjOn ψ L := by + have hcross : ∀ x ∈ L₁, ∀ x' ∈ L₂, ψ x = ψ x' → x = x' := fun x hx x' hx' he => by + rcases hcr x (hsL₁ hx) x' (hsL₂ hx') he with h | h + · exact h + · have h1 : x = yHat := hE₁ ⟨hx, huE h⟩ + have h2 : x' = yHat := hE₂ ⟨hx', huE (he ▸ h)⟩ + exact h1.trans h2.symm + rintro x (hx | hx) x' (hx' | hx') he + · exact hi₁ (hsL₁ hx) (hsL₁ hx') he + · exact hcross x hx x' hx' he + · exact (hcross x' hx' x hx he.symm).symm + · exact hi₂ (hsL₂ hx) (hsL₂ hx') he + have hLF : L ⊆ ψ ⁻¹' (j '' F) := by + rw [← hun] + rintro x (hx | hx) + · exact hs₁ (hsL₁ hx) + · exact hs₂ (hsL₂ hx) + have hLE : L ∩ E ⊆ {yHat} := by + rintro x ⟨hx | hx, hxE⟩ + · exact hE₁ ⟨hx, hxE⟩ + · exact hE₂ ⟨hx, hxE⟩ + have hLb : L ⊆ bd Y := hLF.trans hψ.2.2.2.2 + let Z₀ : Set Y := closure (ψ ⁻¹' (A \ j '' F)) + let Z : Set Y := Z₀ ∪ ψ ⁻¹' (j '' (F ∩ Γ.N) \ {j n}) + have hZc : IsClosed Z := isClosed_closure.union ((((Γ.finite_N.subset inter_subset_right).image + j).subset sdiff_subset).isClosed.preimage hψ.1) + have hZ₀ : ∀ {x}, x ∈ Z₀ → ψ x ∈ A := fun {x} hx => by + have h1 := hψ.1.closure_preimage_subset _ hx + exact closure_minimal sdiff_subset hAc h1 + have hZL : Z ∩ L ⊆ {q₁, q₂} := by + rintro x ⟨hx | hx, hxL⟩ + · have h1 : ψ x ∈ j '' (F ∩ Γ.N) := hAF ⟨hZ₀ hx, hLF hxL⟩ + obtain rfl : x = yHat := hLE ⟨hxL, .inl h1⟩ + exact absurd hx hyHatZ + · obtain rfl : x = yHat := hLE ⟨hxL, .inl hx.1⟩ + exact absurd hyHat hx.2 + obtain ⟨D, hD, hLD, hDZ, hDb⟩ := exists_wedge hY hL hLb hZc hZL + have hq₁ : q₁ ≠ yHat := hl₁.ne'.symm + have hq₂ : q₂ ≠ yHat := hl₂.ne'.symm + have hDinj : InjOn ψ D := by + intro y hy y' hy' he + by_cases hF : ψ y ∈ j '' F + · have h1 : y ∈ L := hDb ▸ ⟨hy, hψ.2.2.2.2 hF⟩ + have h2 : y' ∈ L := hDb ▸ ⟨hy', hψ.2.2.2.2 (show ψ y' ∈ _ from he ▸ hF)⟩ + exact hLinj h1 h2 + he + · have hy'F : ψ y' ∉ j '' F := he ▸ hF + exact hψ.2.2.1 hF hy'F he + have hneY : Nonempty Y := ⟨yHat⟩ + obtain ⟨hGt, hGb⟩ := isClosedDisc_image_injOn hD hD.isCompact hψ.1.continuousOn hDinj + have hq : ∀ {y}, y ∈ ({q₁, q₂} : Set Y) → y ∈ L := by + rintro y (rfl | rfl) + · exact hL.left_mem + · exact hL.right_mem + have hqE : ∀ {y}, y ∈ ({q₁, q₂} : Set Y) → ψ y ∉ j '' (F ∩ Γ.N) := by + rintro y hy h + have h1 : y = yHat := hLE ⟨hq hy, .inl h⟩ + rcases hy with rfl | rfl + · exact hq₁ h1 + · exact hq₂ h1 + have hGA : ψ '' D ∩ A ⊆ {j n} := by + rintro _ ⟨⟨y, hy, rfl⟩, hyA⟩ + by_cases hF : ψ y ∈ j '' F + · by_contra hne + have h1 : ψ y ∈ j '' (F ∩ Γ.N) := hAF ⟨hyA, hF⟩ + have h2 : y ∈ ({q₁, q₂} : Set Y) := hDZ ⟨hy, .inr ⟨h1, hne⟩⟩ + exact hqE h2 h1 + · have h2 : y ∈ ({q₁, q₂} : Set Y) := hDZ ⟨hy, .inl (subset_closure ⟨hyA, hF⟩)⟩ + exact absurd (hLF (hq h2)) hF + have hGr : ψ '' D ⊆ range j := by + intro z hz + rcases (hcov ▸ mem_univ z : z ∈ range j ∪ ⋃ C ∈ cuffs S, cap C) with h | h + · exact h + · have h1 := hGA ⟨hz, .inr h⟩ + rw [mem_singleton_iff.mp h1] + exact mem_range_self n + have hneS : Nonempty S := ⟨n⟩ + obtain ⟨hG, hGbd⟩ := isClosedDisc_preimage hj hGt hGr + obtain ⟨L', hL', hun', hin'⟩ := oarc_split hD.isOArc_discBd hL hLD + have hD' : discBd D ⊆ D := discBd_subset D + have hsL : L ⊆ D := hLD.trans hD' + have hsL' : L' ⊆ D := (hun' ▸ subset_union_right).trans hD' + have hl0 := line_image hψ.1 (hDinj.mono hsL) hL + have hl1 := line_image hψ.1 (hDinj.mono hsL') hL' + obtain ⟨u₀, v₀, hu₀, hv₀, hlA⟩ := hl0.pull hj.isEmbedding ((image_mono hsL).trans hGr) + obtain ⟨u₁, v₁, hu₁, hv₁, hlB⟩ := hl1.pull hj.isEmbedding ((image_mono hsL').trans hGr) + obtain rfl : u₁ = u₀ := hj.injective (hu₁.trans hu₀.symm) + obtain rfl : v₁ = v₀ := hj.injective (hv₁.trans hv₀.symm) + have hnL : yHat ∈ L := .inl hl₁.left_mem + refine ⟨_, _, _, u₁, v₁, hG, hlA, hlB, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [hGbd, hGb, ← hun', image_union, preimage_union] + · ext x + constructor + · rintro ⟨⟨y, hy, he⟩, ⟨y', hy', he'⟩⟩ + have h1 : y = y' := hDinj (hsL hy) (hsL' hy') (he.trans he'.symm) + have h2 : y ∈ L ∩ L' := ⟨hy, h1 ▸ hy'⟩ + rw [hin'] at h2 + rcases h2 with rfl | rfl + · exact .inl (hj.injective (he.symm.trans hu₁.symm)) + · exact .inr (hj.injective (he.symm.trans hv₁.symm)) + · rintro (rfl | rfl) + · exact ⟨⟨_, hL.left_mem, hu₀.symm⟩, ⟨_, hL'.left_mem, hu₀.symm⟩⟩ + · exact ⟨⟨_, hL.right_mem, hv₀.symm⟩, ⟨_, hL'.right_mem, hv₀.symm⟩⟩ + · ext x + constructor + · rintro ⟨⟨y, hy, he⟩, + hxF⟩ + have hyF : ψ y ∈ j '' F := he.symm ▸ mem_image_of_mem j hxF + have h1 : y ∈ L := hDb ▸ ⟨hy, hψ.2.2.2.2 hyF⟩ + exact ⟨y, h1, he⟩ + · rintro ⟨y, hy, he⟩ + refine ⟨⟨y, hsL hy, he⟩, ?_⟩ + have h1 := hLF hy + rw [mem_preimage, he] at h1 + exact hj.injective.mem_set_image.mp h1 + · rintro x ⟨hx, hxU⟩ + exact hj.injective (hGA ⟨hx, .inl (mem_image_of_mem _ hxU)⟩) + · exact ⟨yHat, hnL, hyHat⟩ + · rintro rfl + have h1 : ψ q₁ = ψ yHat := hu₀.symm.trans hyHat.symm + exact hq₁ (hLinj hL.left_mem hnL h1) + · rintro rfl + have h1 : ψ q₂ = ψ yHat := hv₀.symm.trans hyHat.symm + exact hq₂ (hLinj hL.right_mem hnL h1) + +/-- The conclusion for a curve follows from the conclusion for the curve with a line swapped. -/ +theorem conclusion_flip [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) {Γ : Painting S} {G L₀ L₁ R + : Set S} {u v n : S} (hG : IsClosedDisc G) (hL₀ : IsLineWithEnds L₀ u v) + (hL₁ : IsLineWithEnds L₁ u v) (hR : IsLineWithEnds R u v) (hbG : discBd G = L₀ ∪ L₁) + (h01 : L₀ ∩ L₁ = {u, v}) (h0R : L₀ ∩ R = {u, v}) (h1R : L₁ ∩ R = {u, v}) + (hGR : G ∩ R = {u, v}) (hGU : G ∩ Γ.U ⊆ {n}) (hnN : n ∈ Γ.N) (h : OArcConclusion S Γ + (L₁ ∪ R)) : OArcConclusion S Γ (L₀ ∪ R) := by + have hd : ∀ c ∈ Γ.C, Disjoint c G := fun c hc => disjoint_left.mpr fun x hx hxG => by + have h1 := arcComponentsIn_subset hc hx + have h2 : x = n := hGU ⟨hxG, h1.1⟩ + exact h1.2 (h2 ▸ hnN) + have hflip : ∀ I : Set (Set S), (∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = L₁ ∪ R + ∧ {c ∈ Γ.C | c ⊆ Δ} = I) → + ∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = L₀ ∪ R ∧ {c ∈ Γ.C | c ⊆ Δ} = I := by + rintro I ⟨Δ', h1, h2, rfl⟩ + obtain ⟨Δ, h3, h4, h5⟩ := flip_disc hman hG hL₀ hL₁ hR hbG h01 h0R h1R hGR h1 h2 + refine ⟨Δ, h3, h4, ?_⟩ + ext c + constructor + · rintro ⟨hc, hs⟩ + exact ⟨hc, (h5 c (hd c hc)).mp hs⟩ + · rintro ⟨hc, hs⟩ + exact ⟨hc, (h5 c (hd c hc)).mpr hs⟩ + rcases h with h | ⟨I₁, I₂, h1, h2, h3, h4, h5⟩ + · exact .inl h + · exact .inr ⟨I₁, I₂, h1, h2, h3, h4.imp (hflip _) id, h5.imp (hflip _) id⟩ + +theorem conclusion_induct [CompactSpace S] [T2Space S] [ConnectedSpace S] + (hS : IsSurface S) {Γ : Painting S} (k : ℕ) : ∀ F : Set S, IsOArc F → Γ.IsNormal F → + (∀ c ∈ Γ.C, Γ.IsInternalCell c → Disjoint (tilde c) F) → (F ∩ Γ.U).ncard = k + → OArcConclusion S Γ F := by + induction k using Nat.strong_induction_on with + | _ k ih => + intro F hO hnorm hint hk + have hfin : (F ∩ Γ.U).Finite := Γ.finite_N.subset hnorm + by_cases hk0 : k = 0 + · have he : F ∩ Γ.U = ∅ := (Set.ncard_eq_zero hfin).mp (hk.trans hk0) + exact cut_off_paint hS hO (disjoint_iff_inter_eq_empty.mpr he) + obtain ⟨n, hnF, hnU⟩ := (Set.ncard_pos hfin).mp (by omega) + have hman := hS.2.2 + have hnN : n ∈ Γ.N := hnorm ⟨hnF, hnU⟩ + obtain ⟨G, L₀, L₁, u, v, hG, hl₀, hl₁, hbG, h01, hGF, hGU, hnL, hnu, hnv⟩ + := exists_bigon hS hO hnorm hint hnF hnU + have hsF : L₀ ⊆ F := hGF ▸ inter_subset_right + obtain ⟨R, hR, hun, h0R⟩ := oarc_split hO hl₀ hsF + have hRF : R ⊆ F := hun ▸ subset_union_right + have hsG : L₁ ⊆ G := (hbG ▸ subset_union_right).trans (discBd_subset G) + have hsG₀ : L₀ ⊆ G := (hbG ▸ subset_union_left).trans (discBd_subset G) + have hGR : G ∩ R = {u, v} := by + apply subset_antisymm + · rintro x ⟨hx, hxR⟩ + have h1 : x ∈ L₀ := hGF ▸ ⟨hx, hRF hxR⟩ + exact h0R ▸ ⟨h1, hxR⟩ + · rw [← h0R] + exact fun x hx => ⟨hsG₀ hx.1, hx.2⟩ + have h1R : L₁ ∩ R = {u, v} := by + apply subset_antisymm + · exact fun x hx => hGR ▸ ⟨hsG hx.1, hx.2⟩ + · rintro x (rfl | rfl) + · exact ⟨hl₁.left_mem, hR.left_mem⟩ + · exact ⟨hl₁.right_mem, hR.right_mem⟩ + have hF' : IsOArc (L₁ ∪ R) := oArc_of_lines hl₁ hR h1R + have hnL₁ : n ∉ L₁ := fun h => by + rcases (h01 ▸ ⟨hnL, h⟩ : n ∈ ({u, v} : Set S)) with h | h + · exact hnu h + · exact hnv h + have hnR : n ∉ R := fun h => by + rcases (h0R ▸ ⟨hnL, h⟩ : n ∈ ({u, v} : Set S)) with h | h + · exact hnu h + · exact hnv h + have hsub : (L₁ ∪ R) ∩ Γ.U ⊆ (F ∩ Γ.U) \ {n} := by + rintro x ⟨hx | hx, hxU⟩ + · have h1 : x = n := hGU ⟨hsG hx, hxU⟩ + exact absurd hx (h1 ▸ hnL₁) + · exact ⟨⟨hRF hx, hxU⟩, fun h => hnR ((mem_singleton_iff.mp h) ▸ hx)⟩ + have hnorm' : Γ.IsNormal (L₁ ∪ R) := fun x hx => hnorm (hsub hx).1 + have hint' : ∀ c ∈ Γ.C, Γ.IsInternalCell c → Disjoint (tilde c) (L₁ ∪ R) := fun c hc hi + => disjoint_left.mpr fun x hx hxF => by + have hxU : x ∈ Γ.U := closure_minimal (fun z hz => (arcComponentsIn_subset hc hz).1) + Γ.isClosed_U hx.1 + exact disjoint_left.mp (hint c hc hi) hx (hsub ⟨hxF, hxU⟩).1.1 + have hcard : ((L₁ ∪ R) ∩ Γ.U).ncard < k := by + have h1 := Set.ncard_le_ncard hsub (hfin.subset sdiff_subset) + rw [Set.ncard_sdiff_singleton_of_mem (show n ∈ F ∩ Γ.U from ⟨hnF, hnU⟩), hk] at h1 + omega + have h2 := ih _ hcard _ hF' hnorm' hint' rfl + rw [← hun] + exact conclusion_flip hman hG hl₀ hl₁ hR hbG h01 h0R h1R hGR hGU hnN h2 + +/-- The surface part of (5.4) of Graph Minors XVII, page 173. -/ +theorem cutNormalOArc : CutNormalOArcPaintingStatement := by + unfold CutNormalOArcPaintingStatement + intro S _ hcS ht2 hconn hS Γ F hnorm hO hint + exact conclusion_induct hS _ F hO hnorm hint rfl + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/ReEdge.lean b/LeanPool/GraphMinor/GM17/ReEdge.lean new file mode 100644 index 0000000000..ec16f2cd6f --- /dev/null +++ b/LeanPool/GraphMinor/GM17/ReEdge.lean @@ -0,0 +1,388 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section12c + +/-! +# Moving a portrayal to another hypergraph on the same vertices + +Let `π` be a portrayal of `H₁`, and let `H₂` be a hypergraph with the same vertices, each of whose +edges lies inside an edge of `H₁`, or has at most one end. Keep the painting, `β` and `γ`, and the +vertices of each cell. Put each edge of `H₂` into a cell that holds its ends, and in which any two +of its ends are adjacent. The result is a portrayal of `H₂`, and its warps do not go up, because the +1-skeleton of each cell does not grow. + +Graph Minors XVII does this silently in three places: in the proof of (12.6), to pass between `G ∪ +G*`, `G` and `G*`; in the proof of (13.3), to pass between `G \ Z` and `G / Z`; and in the proof of +(14.2). We use it for all of them. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface GraphMinor.GM10 GraphMinor.Hypergraph + +universe u v w + +variable {α : Type u} {β₁ : Type v} {β₂ : Type w} + +/-- Each edge of `H₂` lies inside an edge of `H₁`, or has at most one end. -/ +@[expose] def EdgesCovered (H₂ : Hypergraph α β₂) (H₁ : Hypergraph α β₁) : Prop := + ∀ e ∈ H₂.edgeSet, (∃ e₁ ∈ H₁.edgeSet, H₂.ends e ⊆ H₁.ends e₁) ∨ (H₂.ends e).Subsingleton + +/-- A tangle needs a vertex: so a portrayal of a hypergraph with a tangle has a cell. -/ +theorem Portrayal.cells_nonempty {β : Type v} {G : Hypergraph α β} {θ : ℕ} {𝒯 : Set + (Hypergraph α β × Hypergraph α β)} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) : π.Γ.C.Nonempty := by + by_cases hV : G.vertexSet.Nonempty + · obtain ⟨v, hv⟩ := hV + obtain ⟨c, hc, -⟩ := π.p1_vertex v hv + exact ⟨c, hc⟩ + · exfalso + have hV' : G.vertexSet = ∅ := not_nonempty_iff_eq_empty.1 hV + have hs : G.IsSeparation G (G.deleteEdges G.edgeSet) := + isSeparation_deleteEdges le_rfl le_rfl (by simp) (by simp) + have hord : separationOrder G (G.deleteEdges G.edgeSet) < θ := by + have : separationOrder G (G.deleteEdges G.edgeSet) = 0 := by + change (G.vertexSet ∩ G.vertexSet).ncard = 0 + simp [hV'] + have := h𝒯.one_le + omega + rcases h𝒯.axiom1 hs hord with h | h + · exact h𝒯.axiom3 h rfl + · exact h𝒯.axiom3 h rfl + +/-- A cell for each edge of `H₂`, as in the head of this file. -/ +theorem Portrayal.exists_cellChoice {H₁ : Hypergraph α β₁} (π : Portrayal H₁) {H₂ : Hypergraph α β₂} + (hV : H₂.vertexSet = H₁.vertexSet) (hne : π.Γ.C.Nonempty) (hcov : EdgesCovered H₂ H₁) : + ∃ f : β₂ → Set π.S, ∀ e ∈ H₂.edgeSet, f e ∈ π.Γ.C ∧ H₂.ends e ⊆ (π.cellGraph (f e)).vertexSet ∧ + ∀ x ∈ H₂.ends e, ∀ y ∈ H₂.ends e, x ≠ y → (π.cellGraph (f e)).skeleton.Adj x y := by + have h : ∀ e, ∃ c : Set π.S, e ∈ H₂.edgeSet → c ∈ π.Γ.C ∧ H₂.ends e ⊆ (π.cellGraph c).vertexSet ∧ + ∀ x ∈ H₂.ends e, ∀ y ∈ H₂.ends e, x ≠ y → (π.cellGraph c).skeleton.Adj x y := by + intro e + by_cases he : e ∈ H₂.edgeSet + · rcases hcov e he with ⟨e₁, he₁, hsub⟩ | hsub + · obtain ⟨c, hc, hec⟩ := π.p1_edge e₁ he₁ + refine ⟨c, fun _ => ⟨hc, fun x hx => ?_, fun x hx y hy hxy => skeleton_adj_of_mem + (π.cellGraph_le c hc) hec (hsub hx) (hsub hy) hxy⟩⟩ + have h1 : x ∈ (π.cellGraph c).ends e₁ := by + rw [← (π.cellGraph_le c hc).ends_eq e₁ hec] + exact hsub hx + exact (π.cellGraph c).vertex_mem_of_inc h1 + · rcases (H₂.ends e).eq_empty_or_nonempty with h0 | ⟨v, hv⟩ + · obtain ⟨c, hc⟩ := hne + exact ⟨c, fun _ => ⟨hc, by simp [h0], by simp [h0]⟩⟩ + · have hv' : v ∈ H₁.vertexSet := hV ▸ H₂.vertex_mem_of_inc hv + obtain ⟨c, hc, hvc⟩ := π.p1_vertex v hv' + refine ⟨c, fun _ => ⟨hc, fun x hx => ?_, fun x hx y hy hxy => absurd (hsub hx hy) hxy⟩⟩ + rw [hsub hx hv] + exact hvc + · exact ⟨∅, fun h => absurd h he⟩ + choose f hf using h + exact ⟨f, fun e he => hf e he⟩ + +/-- The cell `c` of the moved portrayal: the vertices of `α(c)`, and the edges sent to `c`. -/ +@[expose] def reEdgeCell {H₁ : Hypergraph α β₁} (π : Portrayal H₁) (H₂ : Hypergraph α β₂) (f : β₂ + → Set π.S) + (hf : ∀ e ∈ H₂.edgeSet, H₂.ends e ⊆ (π.cellGraph (f e)).vertexSet) + (c : Set π.S) : Hypergraph α β₂ where + vertexSet := (π.cellGraph c).vertexSet + edgeSet := {e ∈ H₂.edgeSet | f e = c} + Inc e v := H₂.Inc e v ∧ f e = c + vertex_mem_of_inc := by + rintro e v ⟨h, rfl⟩ + exact hf e (H₂.edge_mem_of_inc h) h + edge_mem_of_inc := fun _ _ h => ⟨H₂.edge_mem_of_inc h.1, h.2⟩ + vertexSet_finite := (π.cellGraph c).vertexSet_finite + edgeSet_finite := H₂.edgeSet_finite.subset (sep_subset _ _) + +/-- The moved portrayal. Every condition (P2) to (P7) speaks only of the vertices of cells, of `β` +and of `γ`, which do not change. -/ +@[expose] noncomputable def Portrayal.reEdge {H₁ : Hypergraph α β₁} (π : Portrayal H₁) + (H₂ : Hypergraph α β₂) + (hV : H₂.vertexSet = H₁.vertexSet) (f : β₂ → Set π.S) + (hC : ∀ e ∈ H₂.edgeSet, f e ∈ π.Γ.C) + (hf : ∀ e ∈ H₂.edgeSet, H₂.ends e ⊆ (π.cellGraph (f e)).vertexSet) : Portrayal H₂ where + S := π.S + isSurface := π.isSurface + connected := π.connected + Γ := π.Γ + cellGraph := reEdgeCell π H₂ f hf + borderSet := π.borderSet + domγ := π.domγ + nodeVertex := π.nodeVertex + cellGraph_le := fun c hc => ⟨hV ▸ (π.cellGraph_le c hc).vertexSet_subset, sep_subset _ _, fun e + he => by + ext v + exact ⟨fun h => ⟨h, he.2⟩, fun h => h.1⟩⟩ + borderSet_subset := fun n hn => hV ▸ π.borderSet_subset n hn + domγ_subset := π.domγ_subset + nodeVertex_mem := fun n hn => hV ▸ π.nodeVertex_mem n hn + nodeVertex_injOn := π.nodeVertex_injOn + p1_vertex := fun v hv => π.p1_vertex v (hV ▸ hv) + p1_edge := fun e he => ⟨f e, hC e he, he, rfl⟩ + p1_disjoint := fun c _ c' _ hne => Set.disjoint_left.2 fun e h h' => hne (h.2.symm.trans h'.2) + p2 := π.p2 + p3_notMem := π.p3_notMem + p3_subset := π.p3_subset + p4_disjoint := π.p4_disjoint + p4_notMem := π.p4_notMem + p5 := π.p5 + p6 := π.p6 + p7 := π.p7 + +/-- A linkage statement passes to a subgraph, which has fewer linkages. -/ +theorem linkagePairs_mono {K₁ K₂ : SimpleGraph α} (h : K₂ ≤ K₁) {X Y : Set α} {k : ℕ} {x y : α} + (hL : Portrayal.LinkagePairs K₁ X Y k x y) : Portrayal.LinkagePairs K₂ X Y k x y := by + intro P hP + let Q : Fin k → PathFromTo K₁ X Y := fun i => + ⟨(P i).first, (P i).last, (P i).walk.mapLe h, (SimpleGraph.Walk.isPath_mapLe h).2 (P i).isPath, + (P i).first_mem, (P i).last_mem⟩ + have hQ : ∀ i, (Q i).walk.support = (P i).walk.support := fun i => + SimpleGraph.Walk.support_mapLe_eq_support h (P i).walk + obtain ⟨i, h1, h2⟩ := hL Q (fun i j hij => by + change Disjoint {z | z ∈ (Q i).walk.support} {z | z ∈ (Q j).walk.support} + rw [hQ i, hQ j] + exact hP hij) + exact ⟨i, h1, h2⟩ + +/-- `π₁` has warp at most that of `π₂` at each cuff, over a homeomorphism of their surfaces. -/ +@[expose] def Portrayal.WarpLE {α₁ α₂ b₁ b₂ : Type*} {G₁ : Hypergraph α₁ b₁} {G₂ : Hypergraph α₂ + b₂} (π₁ : Portrayal G₁) (π₂ : Portrayal G₂) : Prop := + ∃ ψ : π₁.S ≃ₜ π₂.S, ∀ Θ ∈ cuffs π₁.S, π₁.warpAt Θ ≤ π₂.warpAt (ψ '' Θ) + +section WarpLE + +variable {a₀ a₁ a₂ b₀ b₁ b₂ : Type*} {G₀ : Hypergraph a₀ b₀} {G₁ : Hypergraph a₁ b₁} {G₂ : + Hypergraph a₂ b₂} + {π₀ : Portrayal G₀} {π₁ : Portrayal G₁} {π₂ : Portrayal G₂} + +theorem Portrayal.Resembles.warpLE (h : π₁.Resembles π₂) : π₁.WarpLE π₂ := by + obtain ⟨ψ, hψ⟩ := h + exact ⟨ψ, fun Θ hΘ => (hψ Θ hΘ).le⟩ + +theorem Portrayal.WarpLE.trans (h : π₀.WarpLE π₁) (h' : π₁.WarpLE π₂) : π₀.WarpLE π₂ := by + obtain ⟨ψ, hψ⟩ := h + obtain ⟨ψ', hψ'⟩ := h' + refine ⟨ψ.trans ψ', fun Θ hΘ => ?_⟩ + have h1 := hψ Θ hΘ + have h2 := hψ' (ψ '' Θ) (image_cuff_mem_cuffs ψ hΘ) + have e : (ψ.trans ψ') '' Θ = ψ' '' (ψ '' Θ) := by + change (ψ' ∘ ψ) '' Θ = _ + rw [image_comp] + rw [e] + exact h1.trans h2 + +theorem Portrayal.WarpLE.warp_le (h : π₁.WarpLE π₂) : π₁.warp ≤ π₂.warp := by + classical + obtain ⟨ψ, hψ⟩ := h + unfold Portrayal.warp + by_cases hne : (cuffs π₁.S).Nonempty + · have hne₂ : (cuffs π₂.S).Nonempty := by + obtain ⟨Θ, hΘ⟩ := hne + exact ⟨ψ '' Θ, image_cuff_mem_cuffs ψ hΘ⟩ + rw [ite_eq_left hne, ite_eq_left hne₂] + refine max_le_max le_rfl (csSup_le ?_ ?_) + · obtain ⟨Θ, hΘ⟩ := hne + exact ⟨_, Θ, hΘ, rfl⟩ + · rintro _ ⟨Θ, hΘ, rfl⟩ + have h3 := π₂.warpAt_le_warp (image_cuff_mem_cuffs ψ hΘ) + unfold Portrayal.warp at h3 + rw [ite_eq_left hne₂] at h3 + refine (hψ Θ hΘ).trans ?_ + refine le_csSup ?_ ⟨_, image_cuff_mem_cuffs ψ hΘ, rfl⟩ + refine ⟨max 1 (sSup {p | ∃ Θ ∈ cuffs π₂.S, p = π₂.warpAt Θ}), ?_⟩ + rintro _ ⟨Θ', hΘ', rfl⟩ + have h4 := π₂.warpAt_le_warp hΘ' + unfold Portrayal.warp at h4 + rw [ite_eq_left hne₂] at h4 + exact h4 + · rw [ite_eq_right hne] + split_ifs + · exact le_max_left _ _ + · exact le_rfl + +/-- "Simpler than" for surfaces does not see a homeomorphism on the left. -/ +theorem isSimplerThan_congr_left {X X' Y : Type} [TopologicalSpace X] [TopologicalSpace X'] + [TopologicalSpace Y] + (e : X ≃ₜ X') (h : IsSimplerThan X' Y) : IsSimplerThan X Y := by + obtain ⟨a, b, c, a', b', c', ⟨f⟩, hY, h'⟩ := h + exact ⟨a, b, c, a', b', c', ⟨e.trans f⟩, hY, h'⟩ + +/-- "Simpler than" for surfaces does not see a homeomorphism on the right. -/ +theorem isSimplerThan_congr_right {X Y Y' : Type} [TopologicalSpace X] [TopologicalSpace Y] + [TopologicalSpace Y'] + (e : Y ≃ₜ Y') (h : IsSimplerThan X Y') : IsSimplerThan X Y := by + obtain ⟨a, b, c, a', b', c', hX, ⟨f⟩, h'⟩ := h + exact ⟨a, b, c, a', b', c', hX, ⟨e.trans f⟩, h'⟩ + +/-- A simpler portrayal stays simpler when the right side has warps no smaller. -/ +theorem Portrayal.IsSimpler.trans_warpLE (h : π₀.IsSimpler π₁) (h' : π₁.WarpLE π₂) : π₀.IsSimpler + π₂ := by + have hw := h'.warp_le + obtain ⟨ψ', hψ'⟩ := h' + rcases h with ⟨hs, hle⟩ | ⟨ψ, hle, Θ, hΘ, hlt⟩ + · exact .inl ⟨isSimplerThan_congr_right ψ'.symm hs, hle.trans hw⟩ + · have e : ∀ Θ : Set π₀.S, (ψ.trans ψ') '' Θ = ψ' '' (ψ '' Θ) := fun Θ => by + change (ψ' ∘ ψ) '' Θ = _ + rw [image_comp] + refine .inr ⟨ψ.trans ψ', fun Θ hΘ => ?_, Θ, hΘ, ?_⟩ + · rw [e] + exact (hle Θ hΘ).trans (hψ' _ (image_cuff_mem_cuffs ψ hΘ)) + · rw [e] + exact hlt.trans_le (hψ' _ (image_cuff_mem_cuffs ψ hΘ)) + +/-- A portrayal with warps no larger than a simpler portrayal is simpler. -/ +theorem Portrayal.WarpLE.trans_isSimpler (h : π₀.WarpLE π₁) (h' : π₁.IsSimpler π₂) : π₀.IsSimpler + π₂ := by + have hw := h.warp_le + obtain ⟨ψ, hψ⟩ := h + rcases h' with ⟨hs, hle⟩ | ⟨ψ', hle, Θ, hΘ, hlt⟩ + · exact .inl ⟨isSimplerThan_congr_left ψ hs, hw.trans hle⟩ + · have e : ∀ Θ : Set π₀.S, (ψ.trans ψ') '' Θ = ψ' '' (ψ '' Θ) := fun Θ => by + change (ψ' ∘ ψ) '' Θ = _ + rw [image_comp] + have hΘ' : ψ.symm '' Θ ∈ cuffs π₀.S := image_cuff_mem_cuffs ψ.symm hΘ + refine .inr ⟨ψ.trans ψ', fun Φ hΦ => ?_, ψ.symm '' Θ, hΘ', ?_⟩ + · rw [e] + exact (hψ Φ hΦ).trans (hle _ (image_cuff_mem_cuffs ψ hΦ)) + · have hi : ψ '' (ψ.symm '' Θ) = Θ := by ext x; simp + rw [e, hi] + have h1 := hψ _ hΘ' + rw [hi] at h1 + exact h1.trans_lt hlt + +/-- A portrayal simpler than one of warp `≤ p` has warp `≤ p`. -/ +theorem Portrayal.IsSimpler.warp_le (h : π₁.IsSimpler π₂) : π₁.warp ≤ π₂.warp := by + rcases h with ⟨-, h⟩ | ⟨ψ, hle, -⟩ + · exact h + · exact Portrayal.WarpLE.warp_le ⟨ψ, hle⟩ + +end WarpLE + +/-- The moved portrayal has warps no larger, since each cell has no new adjacent pair. -/ +theorem Portrayal.reEdge_warpLE {H₁ : Hypergraph α β₁} (π : Portrayal H₁) (H₂ : Hypergraph α β₂) + (hV : H₂.vertexSet = H₁.vertexSet) (f : β₂ → Set π.S) + (hC : ∀ e ∈ H₂.edgeSet, f e ∈ π.Γ.C) + (hf : ∀ e ∈ H₂.edgeSet, H₂.ends e ⊆ (π.cellGraph (f e)).vertexSet) + (hadj : ∀ e ∈ H₂.edgeSet, ∀ x ∈ H₂.ends e, ∀ y ∈ H₂.ends e, x ≠ y → (π.cellGraph + (f e)).skeleton.Adj x y) : + (π.reEdge H₂ hV f hC hf).WarpLE π := by + have : T2Space π.S := π.isSurface.2.1 + refine ⟨Homeomorph.refl π.S, fun Θ hΘ => ?_⟩ + have himg : (Homeomorph.refl π.S : π.S → π.S) '' Θ = Θ := image_id Θ + refine le_of_le_of_eq ?_ (congrArg π.warpAt himg.symm) + refine ((π.reEdge H₂ hV f hC hf).warpAt_le_iff (Θ := Θ)).mpr fun c hc hcΘ => ?_ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x + have hbd : (c ∩ bd π.S).Nonempty := hcΘ.mono (inter_subset_inter_right _ hΘ_bd) + refine le_trans (Nat.sInf_le ?_) (π.cellWarp_le_warpAt hc hcΘ) + have hsk : (reEdgeCell π H₂ f hf c).skeleton ≤ (π.cellGraph c).skeleton := by + rintro x y ⟨hne, e, hx, hy⟩ + have hadj' := hadj e (H₂.edge_mem_of_inc hx.1) x hx.1 y hy.1 hne + rwa [hx.2] at hadj' + intro n₁ hn₁ n₂ hn₂ hne + obtain ⟨h1, h2, h3⟩ := π.cellWarp_spec hc hbd n₁ hn₁ n₂ hn₂ hne + exact ⟨h1, h2, fun a b => linkagePairs_mono hsk (h3 a b)⟩ + +/-- Moving a portrayal: if the tangle `𝒯₂` holds every separation `(A, D)` of `H₂` of small order on +the vertices of a cell, then the moved portrayal is `𝒯₂`-central. -/ +theorem Portrayal.exists_moved {H₁ : Hypergraph α β₁} (π : Portrayal H₁) {H₂ : Hypergraph α β₂} + (hV : H₂.vertexSet = H₁.vertexSet) (hne : π.Γ.C.Nonempty) (hcov : EdgesCovered H₂ H₁) + {𝒯₂ : Set (Hypergraph α β₂ × Hypergraph α β₂)} {θ₂ : ℕ} + (hord : ∀ c ∈ π.Γ.C, ((π.cellGraph c).vertexSet ∩ π.otherVertices c).ncard < θ₂) + (hdom : ∀ c ∈ π.Γ.C, ∀ A D : Hypergraph α β₂, H₂.IsSeparation A D → separationOrder A D < θ₂ → + A.vertexSet = (π.cellGraph c).vertexSet → (A, D) ∈ 𝒯₂) : + ∃ π₂ : Portrayal H₂, π₂.IsCentral 𝒯₂ ∧ π₂.WarpLE π := by + obtain ⟨f, hf⟩ := π.exists_cellChoice hV hne hcov + have hC : ∀ e ∈ H₂.edgeSet, f e ∈ π.Γ.C := fun e he => (hf e he).1 + have hf' : ∀ e ∈ H₂.edgeSet, H₂.ends e ⊆ (π.cellGraph (f e)).vertexSet := fun e he => + (hf e he).2.1 + refine ⟨π.reEdge H₂ hV f hC hf', fun c hc => ?_, π.reEdge_warpLE H₂ hV f hC hf' fun e he => + (hf e he).2.2⟩ + let π₂ := π.reEdge H₂ hV f hC hf' + have hle : π₂.cellGraph c ≤ H₂ := π₂.cellGraph_le c hc + refine ⟨complSubhypergraph H₂ (π₂.cellGraph c), hdom c hc _ _ (isSeparation_complSubhypergraph + hle) ?_ rfl⟩ + rw [separationOrder_complSubhypergraph] + have hsub : attachments H₂ (π₂.cellGraph c) ⊆ (π.cellGraph c).vertexSet ∩ π.otherVertices c := + π₂.attachments_cellGraph_subset_otherVertices hc + exact (ncard_le_ncard hsub ((π.cellGraph c).vertexSet_finite.inter_of_left _)).trans_lt + (hord c hc) + +/-- The edges of `H*` lie inside edges of `H`. -/ +theorem edgesCovered_oneSkeleton {b : Type*} (H : Hypergraph α b) : EdgesCovered + (oneSkeletonHypergraph H) H := by + intro s hs + induction s using Sym2.ind with + | _ x y => + obtain ⟨hne, e, hx, hy⟩ := (SimpleGraph.mem_edgeSet _).1 hs + refine .inl ⟨e, H.edge_mem_of_inc hx, ?_⟩ + rintro v ⟨-, hv⟩ + rcases Sym2.mem_iff.1 hv with rfl | rfl + · exact hx + · exact hy + +/-- `H₂ / Z` keeps being covered by `H₁ / Z`. -/ +theorem EdgesCovered.quotient {H₁ : Hypergraph α β₁} {H₂ : Hypergraph α β₂} + (h : EdgesCovered H₂ H₁) (Z : Set α) : + EdgesCovered (quotientVertices H₂ Z) (quotientVertices H₁ Z) := by + intro e he + rcases h e he with ⟨e₁, he₁, hs⟩ | hs + · exact .inl ⟨e₁, he₁, fun x hx => ⟨hs hx.1, hx.2⟩⟩ + · exact .inr fun x hx y hy => hs hx.1 hy.1 + +/-- Redundancy passes from `π₂` to any `π₁` with warps no larger, when each quotient of `𝒯₁` lies +below a quotient of `𝒯₂`. Given a portrayal simpler than `π₁`, move it to `H₂ / Z`; it is simpler +than `π₂`. The bound on `θ₂` keeps the cells of the moved portrayal below the order of `𝒯₂ / Z`. -/ +theorem Portrayal.IsRedundant.of_moved {H₁ : Hypergraph α β₁} {H₂ : Hypergraph α β₂} + {𝒯₁ : Set (Hypergraph α β₁ × Hypergraph α β₁)} {𝒯₂ : Set (Hypergraph α β₂ × Hypergraph α β₂)} + {θ₁ θ₂ z p : ℕ} (h𝒯₁ : IsTangle H₁ θ₁ 𝒯₁) (h𝒯₂ : IsTangle H₂ θ₂ 𝒯₂) (hθ₁ : z + max 3 + (2 * p + 2) < θ₁) + (hV : H₂.vertexSet = H₁.vertexSet) (hcov : EdgesCovered H₂ H₁) + (hθ₂ : z + max 3 (2 * p + 2) < θ₂) + {π₁ : Portrayal H₁} {π₂ : Portrayal H₂} (hred : π₂.IsRedundant 𝒯₂ θ₂ z) (hwarp : π₂.warp ≤ p) + (hle : π₁.WarpLE π₂) + (hdom : ∀ Z ⊆ H₁.vertexSet, Z.ncard ≤ z → ∀ A B, (A, B) ∈ quotientTangle H₁ 𝒯₁ Z → + separationOrder A B ≤ max 3 (2 * p + 2) → + ∃ A' B', (A', B') ∈ quotientTangle H₂ 𝒯₂ Z ∧ A.vertexSet ⊆ A'.vertexSet) : + π₁.IsRedundant 𝒯₁ θ₁ z := by + refine ⟨by omega, fun Z hZ hcard π' hcen hsimp => ?_⟩ + have hZ₂ : Z ⊆ H₂.vertexSet := hV ▸ hZ + have hZlt₁ : Z.ncard < θ₁ := by omega + have hZlt₂ : Z.ncard < θ₂ := by omega + have ht₁ := theorem_4_2_proof h𝒯₁ hZ hZlt₁ + have ht₂ := theorem_4_2_proof h𝒯₂ hZ₂ hZlt₂ + have hs₂ : π'.IsSimpler π₂ := hsimp.trans_warpLE hle + have hw' : π'.warp ≤ p := hs₂.warp_le.trans hwarp + obtain ⟨π'', hc'', hl''⟩ := π'.exists_moved (H₂ := quotientVertices H₂ Z) + (by change H₂.vertexSet \ Z = H₁.vertexSet \ Z; rw [hV]) + (π'.cells_nonempty ht₁) (hcov.quotient Z) (θ₂ := θ₂ - Z.ncard) (𝒯₂ := quotientTangle H₂ 𝒯₂ Z) + (fun c hc => by have := π'.ncard_cell_inter_other_le hw' hc; omega) + (fun c hc A D hs ho hVA => by + obtain ⟨B, hB⟩ := hcen c hc + have hle := (π'.cellGraph_le c hc) + have hsmall : ((π'.cellGraph c).vertexSet ∩ π'.otherVertices c).ncard ≤ max 3 (2 * p + 2) + := π'.ncard_cell_inter_other_le hw' hc + have ho₀ : separationOrder (π'.cellGraph c) (complSubhypergraph (quotientVertices H₁ Z) + (π'.cellGraph c)) ≤ max 3 (2 * p + 2) := by + rw [separationOrder_complSubhypergraph] + exact (ncard_le_ncard (π'.attachments_cellGraph_subset_otherVertices hc) + ((π'.cellGraph c).vertexSet_finite.inter_of_left _)).trans hsmall + have hB' := GM10.theorem_2_9_proof ht₁ hB (isSeparation_complSubhypergraph hle) (by omega) + (.inr (.inl subset_rfl)) + obtain ⟨A', B', hm, hsub⟩ := hdom Z hZ hcard _ _ hB' ho₀ + exact GM10.theorem_2_9_proof ht₂ hm hs ho (.inr (.inl (hVA ▸ hsub)))) + exact hred.2 Z hZ₂ hcard π'' hc'' (hl''.trans_isSimpler hs₂) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/RegionBoundary.lean b/LeanPool/GraphMinor/GM17/RegionBoundary.lean new file mode 100644 index 0000000000..7c16c6b83d --- /dev/null +++ b/LeanPool/GraphMinor/GM17/RegionBoundary.lean @@ -0,0 +1,49 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.BorderNode +public import LeanPool.GraphMinor.GM17.Section8 + +/-! +# The boundary of regions of a tame painting + +This file proves `RegionBoundaryOArcCriterionStatement`, the surface work of (8.2), (8.4), (8.6), +(8.7) and (8.8) of Graph Minors XVII (pages 181 to 183). The parts are proved in +`GraphMinor.GM17.RegionCycle`, `GraphMinor.GM17.CellNodes`, `GraphMinor.GM17.BorderArc`, +`GraphMinor.GM17.BorderCells`, `GraphMinor.GM17.NodeRing` and +`GraphMinor.GM17.BorderNode`. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +/-- **Graph Minors XVII, (8.2), and the pushing off of cells in (8.4), (8.6), (8.7) and (8.8)** +(pages 181 to 183). -/ +theorem regionBoundaryOArcCriterion : RegionBoundaryOArcCriterionStatement := by + unfold RegionBoundaryOArcCriterionStatement + intro S _ _ hS Γ h6 hreg hO + have ht2 : T2Space S := hS.2.1 + have hΓ : Γ.Tame := ⟨h6, hreg, hO⟩ + refine ⟨fun r hr => Painting.frontier_isOArc hS hΓ hr, fun c hc => ?_, + fun n hn => Painting.node_on_cell hS hΓ hn, ?_, ?_, ?_, ?_⟩ + · obtain ⟨a, ha, b, hb, hne⟩ := Painting.two_nodes hS hΓ hc + exact (Set.one_lt_ncard_iff (Γ.finite_tilde_cell hc)).mpr ⟨a, b, ha, hb, hne⟩ + · exact fun n hn hall => Painting.border_node hS hΓ hn.1 hall + · exact fun c hc hint => ⟨fun n₁ h₁ n₂ h₂ hne => Painting.internal_arc hS hΓ hc hint h₁ h₂ hne, + fun ht => Painting.internal_bd_arc hS hΓ hc hint ht⟩ + · exact fun c₁ h₁ c₂ h₂ hne hb₁ hb₂ he => Painting.two_border hS hΓ h₁ h₂ hne hb₁ hb₂ he + · rintro n ⟨hn, hnb⟩ (h | ⟨h, c₀, h₀, hnc, h2⟩) + · exact Painting.node_one hS hΓ hn hnb h + · exact Painting.node_two hS hΓ hn hnb h h₀ hnc h2 + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/RegionCycle.lean b/LeanPool/GraphMinor/GM17/RegionCycle.lean new file mode 100644 index 0000000000..f9d523b6aa --- /dev/null +++ b/LeanPool/GraphMinor/GM17/RegionCycle.lean @@ -0,0 +1,259 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.RegionDegree + +/-! +# The frontier of a region is an `O`-arc + +A connected union of finitely many lines, in which two lines meet only in marked points and each +marked point lies on exactly two lines, is an `O`-arc +(`isOArc_sUnion`). We follow a path of lines as far as it goes. Applied to the sides of a region +this gives (8.2) of Graph Minors XVII (page 181): the frontier of every +region of a tame painting is an `O`-arc (`frontier_isOArc`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {X : Type} [TopologicalSpace X] [T2Space X] + +/-- A path of lines inside a family: its inner marked points have all their lines in the path, and +each end lies on one line of the path. -/ +structure IsPathOf (𝓛 : Set (Set X)) (V : Set X) (𝓐 : Set (Set X)) (a b : X) : Prop where + sub : 𝓐 ⊆ 𝓛 + line : IsLineWithEnds (⋃₀ 𝓐) a b + sat : ∀ x ∈ V, x ∈ ⋃₀ 𝓐 → x ≠ a → x ≠ b → ∀ L ∈ 𝓛, x ∈ L → L ∈ 𝓐 + left : ∃ L ∈ 𝓐, a ∈ L ∧ ∀ L' ∈ 𝓐, a ∈ L' → L' = L + right : ∃ L ∈ 𝓐, b ∈ L ∧ ∀ L' ∈ 𝓐, b ∈ L' → L' = L + +omit [T2Space X] in +theorem IsPathOf.symm {𝓛 : Set (Set X)} {V : Set X} {𝓐 : Set (Set X)} {a b : X} + (h : IsPathOf 𝓛 V 𝓐 a b) : IsPathOf 𝓛 V 𝓐 b a := + ⟨h.sub, h.line.symm, fun x hx hm hb ha L hL hxL => h.sat x hx hm ha hb L hL hxL, h.right, h.left⟩ + +/-- A connected union of lines that meet two at a time in marked points, with exactly two lines at +each marked point, is an `O`-arc. -/ +theorem isOArc_sUnion {𝓛 : Set (Set X)} {V : Set X} (hf : 𝓛.Finite) (hline : ∀ L ∈ 𝓛, ∃ u v, + IsLineWithEnds L u v ∧ L ∩ V = {u, v}) (hin : ∀ L ∈ 𝓛, ∀ L' ∈ 𝓛, L ≠ L' → L ∩ L' ⊆ V) + (hdeg : ∀ x ∈ V, ∀ L ∈ 𝓛, x ∈ L → ∃ L' ∈ 𝓛, L' ≠ L ∧ x ∈ L') + (hdeg3 : ∀ x ∈ V, ∀ L₁ ∈ 𝓛, ∀ L₂ ∈ 𝓛, ∀ L₃ ∈ 𝓛, x ∈ L₁ → x ∈ L₂ → x ∈ L₃ → L₁ ≠ L₂ → L₁ ≠ L₃ + → L₂ ≠ L₃ → False) (hconn : IsPreconnected (⋃₀ 𝓛)) {L₀ : Set X} (hL₀ : L₀ ∈ 𝓛) : + IsOArc (⋃₀ 𝓛) := by + classical + have hmain : ∀ n : ℕ, ∀ (𝓐 : Set (Set X)) (a b : X), IsPathOf 𝓛 V 𝓐 a b → (𝓛 \ 𝓐).ncard = n + → a ∈ V → b ∈ V → IsOArc (⋃₀ 𝓛) := by + intro n + induction n using Nat.strong_induction_on with + | _ n ih => + intro 𝓐 a b hP hn haV hbV + obtain ⟨L_b, hL_b, hbL, huniq⟩ := hP.right + obtain ⟨L', hL', hne, hbL'⟩ := hdeg b hbV L_b (hP.sub hL_b) hbL + have hL'𝓐 : L' ∉ 𝓐 := fun h => hne (huniq L' h hbL') + obtain ⟨u, v, hl, hiV⟩ := hline L' hL' + obtain ⟨w, hlw, hiw⟩ : ∃ w, IsLineWithEnds L' b w ∧ L' ∩ V = {b, w} := by + rcases (hiV.le ⟨hbL', hbV⟩ : b ∈ ({u, v} : Set X)) with rfl | rfl + · exact ⟨v, hl, hiV⟩ + · exact ⟨u, hl.symm, by rw [pair_comm]; exact hiV⟩ + have hmeet : ∀ {z}, z ∈ ⋃₀ 𝓐 → z ∈ L' → z = b ∨ z = w := fun {z} hz hz' => by + obtain ⟨L, hL, hzL⟩ := hz + exact hiw.le ⟨hz', hin L (hP.sub hL) L' hL' (fun e => hL'𝓐 (e ▸ hL)) ⟨hzL, hz'⟩⟩ + have hwV : w ∈ V := (hiw.ge (mem_insert_of_mem _ rfl) : w ∈ L' ∩ V).2 + have hbw := hlw.ne' + by_cases hw : w ∈ ⋃₀ 𝓐 + · have hwa : w = a := by + by_contra hwa + exact hL'𝓐 (hP.sat w hwV hw hwa (Ne.symm hbw) L' hL' hlw.right_mem) + subst hwa + have hne' : w ≠ b := Ne.symm hbw + have hi : (⋃₀ 𝓐) ∩ L' = {w, b} := by + apply subset_antisymm + · rintro z ⟨h1, h2⟩ + rcases hmeet h1 h2 with h | h + · exact .inr h + · exact .inl h + · rintro z (rfl | rfl) + · exact ⟨hw, hlw.right_mem⟩ + · exact ⟨hP.line.right_mem, hbL'⟩ + have hO : IsOArc (⋃₀ 𝓐 ∪ L') := oArc_of_lines hP.line hlw.symm hi + obtain ⟨L_a, hL_a, haL, -⟩ := hP.left + have hrest : ∀ L ∈ 𝓛, L ∉ 𝓐 → L ≠ L' → Disjoint L (⋃₀ 𝓐 ∪ L') := fun L hL h1 h2 => by + refine disjoint_left.mpr fun z hz hz' => ?_ + have hzV : z ∈ V := by + rcases hz' with ⟨L'', hL'', hz''⟩ | hz' + · exact hin L hL L'' (hP.sub hL'') (fun e => h1 (e ▸ hL'')) ⟨hz, hz''⟩ + · exact hin L hL L' hL' h2 ⟨hz, hz'⟩ + by_cases hzw : z = w + · subst hzw + exact hdeg3 z hzV L_a (hP.sub hL_a) L' hL' L hL haL hlw.right_mem hz (fun e => hL'𝓐 + (e ▸ hL_a)) (fun e => h1 (e ▸ hL_a)) (Ne.symm h2) + · by_cases hzb : z = b + · subst hzb + exact hdeg3 z hzV L_b (hP.sub hL_b) L' hL' L hL hbL hbL' hz (Ne.symm hne) (fun e + => h1 (e ▸ hL_b)) (Ne.symm h2) + · rcases hz' with hz' | hz' + · exact h1 (hP.sat z hzV hz' hzw hzb L hL hz) + · rcases hiw.le ⟨hz', hzV⟩ with h | h + · exact hzb h + · exact hzw h + have hall : ⋃₀ 𝓛 = ⋃₀ 𝓐 ∪ L' := by + apply subset_antisymm + · rintro z ⟨L, hL, hz⟩ + by_cases h1 : L ∈ 𝓐 + · exact .inl ⟨L, h1, hz⟩ + · by_cases h2 : L = L' + · exact .inr (h2 ▸ hz) + · exfalso + have hO1 : IsClosed (⋃₀ 𝓐 ∪ L') := hP.line.isCompact.isClosed.union + hlw.isCompact.isClosed + have hR : IsClosed (⋃₀ (𝓛 \ insert L' 𝓐)) := (hf.subset + sdiff_subset).isClosed_sUnion fun L₁ hL₁ => by + obtain ⟨u₁, v₁, h3, -⟩ := hline L₁ hL₁.1 + exact h3.isCompact.isClosed + have hcov : ⋃₀ 𝓛 ⊆ (⋃₀ 𝓐 ∪ L') ∪ ⋃₀ (𝓛 \ insert L' 𝓐) := by + rintro y ⟨L₁, hL₁, hy⟩ + by_cases h3 : L₁ ∈ 𝓐 + · exact .inl (.inl ⟨L₁, h3, hy⟩) + · by_cases h4 : L₁ = L' + · exact .inl (.inr (h4 ▸ hy)) + · exact .inr ⟨L₁, ⟨hL₁, by rintro (h5 | h5); exacts [h4 h5, h3 h5]⟩, hy⟩ + have hbU : b ∈ ⋃₀ 𝓛 := ⟨L', hL', hbL'⟩ + have hLout : L ∈ 𝓛 \ insert L' 𝓐 := by + refine ⟨hL, ?_⟩ + rintro (h5 | h5) + · exact h2 h5 + · exact h1 h5 + obtain ⟨y, -, hy, hy'⟩ := isPreconnected_closed_iff.mp hconn _ _ hO1 hR hcov + ⟨b, hbU, .inr hbL'⟩ ⟨z, ⟨L, hL, hz⟩, ⟨L, hLout, hz⟩⟩ + obtain ⟨L₁, hL₁, hyL₁⟩ := hy' + refine disjoint_left.mp (hrest L₁ hL₁.1 (fun h5 => hL₁.2 (.inr h5)) (fun h5 + => hL₁.2 (.inl h5))) hyL₁ hy + · rintro z (⟨L, hL, hz⟩ | hz) + · exact ⟨L, hP.sub hL, hz⟩ + · exact ⟨L', hL', hz⟩ + rw [hall] + exact hO + · have hi : (⋃₀ 𝓐) ∩ L' = {b} := by + apply subset_antisymm + · rintro z ⟨h1, h2⟩ + rcases hmeet h1 h2 with h | h + · exact h + · exact absurd (h ▸ h1) hw + · rintro _ rfl + exact ⟨hP.line.right_mem, hbL'⟩ + have hab := hP.line.ne' + have haL' : a ∉ L' := fun h => hab (by + have h1 : a ∈ (⋃₀ 𝓐) ∩ L' := ⟨hP.line.left_mem, h⟩ + rw [hi] at h1 + exact h1) + have hP' : IsPathOf 𝓛 V (insert L' 𝓐) a w := by + refine ⟨insert_subset hL' hP.sub, ?_, ?_, ?_, ?_⟩ + · rw [sUnion_insert, union_comm] + exact hP.line.union hlw hi + · rintro x hx hm hxa hxw L hL hxL + by_cases hxb : x = b + · subst hxb + by_cases h1 : L = L' + · exact .inl h1 + · by_cases h2 : L = L_b + · exact .inr (h2 ▸ hL_b) + · exact (hdeg3 x hx L_b (hP.sub hL_b) L' hL' L hL hbL hbL' hxL (Ne.symm hne) + (Ne.symm h2) (Ne.symm h1)).elim + · rcases hm with ⟨L₁, rfl | h1, hx1⟩ + · rcases hiw.le ⟨hx1, hx⟩ with h | h + · exact absurd h hxb + · exact absurd h hxw + · exact .inr (hP.sat x hx ⟨L₁, h1, hx1⟩ hxa hxb L hL hxL) + · obtain ⟨L_a, h1, h2, h3⟩ := hP.left + refine ⟨L_a, .inr h1, h2, ?_⟩ + rintro L₁ (rfl | h4) h5 + · exact absurd h5 haL' + · exact h3 L₁ h4 h5 + · refine ⟨L', .inl rfl, hlw.right_mem, ?_⟩ + rintro L₁ (rfl | h4) h5 + · rfl + · exact absurd ⟨L₁, h4, h5⟩ hw + have hlt : (𝓛 \ insert L' 𝓐).ncard < n := by + rw [← hn] + refine Set.ncard_lt_ncard ?_ (hf.subset sdiff_subset) + refine ⟨fun x hx => ⟨hx.1, fun h => hx.2 (.inr h)⟩, fun h => ?_⟩ + exact (h ⟨hL', hL'𝓐⟩).2 (.inl rfl) + exact ih _ hlt _ a w hP' rfl haV hwV + obtain ⟨u, v, hl, hiV⟩ := hline L₀ hL₀ + have hu : u ∈ V := (hiV.ge (mem_insert _ _) : u ∈ L₀ ∩ V).2 + have hv : v ∈ V := (hiV.ge (mem_insert_of_mem _ rfl) : v ∈ L₀ ∩ V).2 + refine hmain _ {L₀} u v ⟨singleton_subset_iff.mpr hL₀, by simpa using hl, ?_, ?_, ?_⟩ rfl hu hv + · rintro x hx hm hxu hxv L hL hxL + rw [sUnion_singleton] at hm + rcases hiV.le ⟨hm, hx⟩ with h | h + · exact absurd h hxu + · exact absurd h hxv + · exact ⟨L₀, rfl, hl.left_mem, fun L' h _ => h⟩ + · exact ⟨L₀, rfl, hl.right_mem, fun L' h _ => h⟩ + +namespace Painting + +variable {S : Type} [TopologicalSpace S] {Γ : Painting S} + +/-- The frontier of a region of a tame painting is the union of the sides of the region. -/ +theorem frontier_eq_sides [T2Space S] [ConnectedSpace S] (hS : IsSurface S) + (hΓ : Γ.Tame) {r : Set S} (hr : r ∈ Γ.regions) : closure r \ r = ⋃₀ {L | Γ.SideOf r L} := by + have hcS : CompactSpace S := hS.1 + apply subset_antisymm + · rintro y ⟨hy, hyr⟩ + by_cases hyN : y ∈ Γ.N + · obtain ⟨L, hL, hyL⟩ := first_side hS hΓ hr hy hyN + exact ⟨L, hL, hyL⟩ + · obtain ⟨L, hL, hyL⟩ := + frontier_region hS hΓ.isOpen (fun c hc => two_nodes hS hΓ hc) hr hy hyr hyN + exact ⟨L, hL, hyL⟩ + · rintro y ⟨L, ⟨c, u, v, hs, hcl⟩, hy⟩ + exact ⟨hcl hy, fun h => region_subset hr h (hs.1.subset_U hy)⟩ + +/-- The frontier of a region of a tame painting is an `O`-arc. -/ +theorem frontier_isOArc [T2Space S] [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {r : Set S} + (hr : r ∈ Γ.regions) : IsOArc (closure r \ r) := by + have hcS : CompactSpace S := hS.1 + have hne : (closure r \ r).Nonempty := by + by_contra hem + have h1 : closure r ⊆ r := fun x hx => by + by_contra hn + exact hem ⟨x, hx, hn⟩ + have hclop : IsClopen r := ⟨closure_subset_iff_isClosed.mp h1, hΓ.isOpen r hr⟩ + obtain ⟨x, hx⟩ := arcComponentsIn_nonempty hr + have huniv := hclop.eq_univ ⟨x, hx⟩ + have hNe : Γ.N.Nonempty := by + by_contra h + have h0 : Γ.N = ∅ := not_nonempty_iff_eq_empty.mp h + have := hΓ.six + rw [h0] at this + simp at this + obtain ⟨n, hn⟩ := hNe + exact region_subset hr (huniv ▸ mem_univ n) (Γ.N_subset hn) + rw [frontier_eq_sides hS hΓ hr] at hne ⊢ + obtain ⟨y, L₀, hL₀, -⟩ := hne + refine isOArc_sUnion (V := Γ.N) (finite_sideOf r) ?_ ?_ ?_ ?_ ?_ hL₀ + · rintro L ⟨c, u, v, hs, -⟩ + exact ⟨u, v, hs.1.2.1, hs.1.2.2.2⟩ + · exact fun L hL L' hL' hne z hz => sides_inter hL hL' hne hz.1 hz.2 + · rintro x hx L hL hxL + obtain ⟨L', h1, h2, h3⟩ := other_side hS hΓ hr hL hxL hx + exact ⟨L', h1, h3, h2⟩ + · intro x hx L₁ h₁ L₂ h₂ L₃ h₃ h1 h2 h3 h12 h13 h23 + exact three_sides hS hΓ hr h₁ h₂ h₃ h1 h2 h3 hx h12 h13 h23 + · rw [← frontier_eq_sides hS hΓ hr] + exact isPreconnected_frontier (hΓ.open_disc r hr) + +end Painting + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/RegionDegree.lean b/LeanPool/GraphMinor/GM17/RegionDegree.lean new file mode 100644 index 0000000000..00ef09536d --- /dev/null +++ b/LeanPool/GraphMinor/GM17/RegionDegree.lean @@ -0,0 +1,505 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Theta + +/-! +# The frontier of a region at a node + +Let `Γ` be a tame painting. A node on the frontier of a region `r` is an end of exactly two sides of +`r`. There are at least two, because just beyond a side of a cell at a node +there is more of the frontier (`near_region`, `other_side`). There are at most two (`three_sides`): +for three sides at a node, we close up curves through `r` and the node. The +hypothesis on curves with one node gives three discs, and these cover the surface by `theta_cover`, +which is impossible. This is the content of the proof of (8.2) of +Graph Minors XVII (page 182). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +namespace Painting + +variable {Γ : Painting S} [T2Space S] + +omit [T2Space S] in +/-- Near a point of the boundary of a cell in the closure of a region, there is more of the frontier +off a given line of the boundary of the cell. -/ +theorem near_region [ConnectedSpace S] (hS : IsSurface S) (hreg : ∀ r ∈ Γ.regions, IsOpen r) {r c L + : Set S} {a b : S} (hr : r ∈ Γ.regions) (hc : c ∈ Γ.C) (ha : a ∈ closure r) + (hL : IsLineWithEnds L a b) (hLc : L ⊆ discBd (closure c)) : a ∈ closure ((closure r \ r) \ L) + := by + obtain ⟨T, tT, j, cap, hT, hTc, hj, hcap, hcov⟩ := exists_cap_discs _ S hS rfl + have hTs : IsSurface T := ⟨hT.1, hT.2.1, fun x => (hT.2.2 x).isManifoldPoint⟩ + have ht2T : T2Space T := hT.2.1 + have hfinC := (cuff_statement.{0} S hS).2.1 + have hbC : ∀ {C : Set S}, C ∈ cuffs S → C ⊆ bd S := fun {C} hC => by + obtain ⟨x, -, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + have hrb : Disjoint r (bd S) := disjoint_left.mpr fun x hx hb => region_subset hr hx + (Γ.bd_subset hb) + have hW : IsOpen (j '' r) := by + have h1 : (j '' r)ᶜ = j '' rᶜ ∪ ⋃ C ∈ cuffs S, cap C := by + ext y + constructor + · intro hy + rcases (hcov ▸ mem_univ y : y ∈ range j ∪ ⋃ C ∈ cuffs S, cap C) with ⟨x, rfl⟩ | h + · exact .inl ⟨x, fun hx => hy (mem_image_of_mem _ hx), rfl⟩ + · exact .inr h + · rintro (⟨x, hx, rfl⟩ | h) hm + · exact hx (hj.injective.mem_set_image.mp hm) + · obtain ⟨C, hC, hw⟩ := mem_iUnion₂.mp h + obtain ⟨x, hx, rfl⟩ := hm + obtain ⟨y, hy, he⟩ := ((hcap C hC).2.2 ▸ ⟨⟨x, rfl⟩, hw⟩ : j x ∈ j '' C) + obtain rfl := hj.injective he + exact disjoint_left.mp hrb hx (hbC hC hy) + rw [← isClosed_compl_iff, h1] + exact (hj.isClosedMap _ (hreg r hr).isClosed_compl).union (hfinC.isClosed_biUnion fun C hC => + (hcap C hC).1.isClosed) + have hdisc := Γ.isClosedDisc_closure_cell hc + have hB := image_emb_disc hj.isEmbedding hdisc + have hd : Disjoint (j '' r) (j '' closure c) := (disjoint_image_iff hj.injective).mpr + (region_disjoint_closure hr hc) + have hcl : closure (j '' r) = j '' closure r := hj.closure_image_eq r + have h1 := frontier_near hTs hB (fun x _ => hT.2.2 x) hW hd (hcl ▸ mem_image_of_mem _ ha) + (hL.map_of_embedding hj.isEmbedding) (by + rw [discBd_image hj.isEmbedding] + exact image_mono hLc) + have hfr : frontier (j '' r) \ j '' L = j '' ((closure r \ r) \ L) := by + rw [hW.frontier_eq, hcl] + ext y + constructor + · rintro ⟨⟨⟨x, hx, rfl⟩, h1⟩, h2⟩ + exact ⟨x, ⟨⟨hx, fun h => h1 (mem_image_of_mem _ h)⟩, fun h => h2 (mem_image_of_mem _ h)⟩, rfl⟩ + · rintro ⟨x, ⟨⟨hx, h1⟩, h2⟩, rfl⟩ + exact ⟨⟨mem_image_of_mem _ hx, fun h => h1 (hj.injective.mem_set_image.mp h)⟩, + fun h => h2 (hj.injective.mem_set_image.mp h)⟩ + rw [hfr, hj.closure_image_eq] at h1 + exact hj.injective.mem_set_image.mp h1 + +theorem finite_sideOf (r : Set S) : {L | Γ.SideOf r L}.Finite := + finite_gaps.subset fun _ ⟨c, u, v, hL, _⟩ => ⟨c, u, v, hL.1⟩ + +/-- At a point in the closure of a region near which there is more of its frontier off a line, there +is a side of the region off the line. -/ +theorem exists_side_near [CompactSpace S] [ConnectedSpace S] (hS : IsSurface S) + (hreg : ∀ r ∈ Γ.regions, IsOpen r) (h2 : ∀ c ∈ Γ.C, ∃ a ∈ tilde c, ∃ b ∈ tilde c, a ≠ b) + {r L : Set S} {a : S} (hr : r ∈ Γ.regions) (haL : a ∈ L) + (h : a ∈ closure ((closure r \ r) \ L)) : ∃ L', Γ.SideOf r L' ∧ a ∈ L' ∧ (L' \ L).Nonempty := by + classical + have hsub : (closure r \ r) \ L ⊆ (Γ.N \ {a}) ∪ ⋃ L' ∈ {L' | Γ.SideOf r L'}, L' \ L := by + rintro y ⟨⟨hy, hyr⟩, hyL⟩ + by_cases hyN : y ∈ Γ.N + · exact .inl ⟨hyN, fun e => hyL ((show y = a from e) ▸ haL)⟩ + · obtain ⟨L', hL', hyL'⟩ := frontier_region hS hreg h2 hr hy hyr hyN + exact .inr (mem_iUnion₂.mpr ⟨L', hL', hyL', hyL⟩) + have h3 := closure_mono hsub h + rw [closure_union, (finite_sideOf r).closure_biUnion, (Γ.finite_N.subset + sdiff_subset).isClosed.closure_eq] at h3 + rcases h3 with h3 | h3 + · exact absurd rfl h3.2 + · obtain ⟨L', hL', ha'⟩ := mem_iUnion₂.mp h3 + obtain ⟨c, u, v, hs, -⟩ := id hL' + exact ⟨L', hL', closure_minimal sdiff_subset hs.1.2.1.isCompact.isClosed ha', + closure_nonempty_iff.mp ⟨_, ha'⟩⟩ + +omit [T2Space S] in +theorem IsSide.exists_end {c L : Set S} {u v a : S} (h : Γ.IsSide c L u v) (ha : a ∈ L) + (haN : a ∈ Γ.N) : ∃ b, Γ.IsSide c L a b := by + rcases (h.1.2.2.2.le ⟨ha, haN⟩ : a ∈ ({u, v} : Set S)) with rfl | rfl + · exact ⟨v, h⟩ + · exact ⟨u, h.symm⟩ + +/-- A second side of a region at a node of a side. -/ +theorem other_side [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {r L : Set S} {a : S} + (hr : r ∈ Γ.regions) (hL : Γ.SideOf r L) (ha : a ∈ L) (haN : a ∈ Γ.N) : + ∃ L', Γ.SideOf r L' ∧ a ∈ L' ∧ L' ≠ L := by + have hcS : CompactSpace S := hS.1 + obtain ⟨c, u, v, hs, hcl⟩ := hL + obtain ⟨b, hs'⟩ := hs.exists_end ha haN + have h1 := near_region hS hΓ.isOpen hr hs.1.1 (hcl ha) hs'.1.2.1 hs'.1.2.2.1 + obtain ⟨L', h2, h3, h4⟩ := exists_side_near hS hΓ.isOpen (fun c hc => two_nodes hS hΓ hc) hr ha h1 + refine ⟨L', h2, h3, ?_⟩ + rintro rfl + obtain ⟨z, hz⟩ := h4 + exact hz.2 hz.1 + +/-- A node in the closure of a region lies on a side of the region. -/ +theorem first_side [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {r : Set S} {a : S} + (hr : r ∈ Γ.regions) (ha : a ∈ closure r) (haN : a ∈ Γ.N) : ∃ L, Γ.SideOf r L ∧ a ∈ L := by + have hcS : CompactSpace S := hS.1 + obtain ⟨c, hc, hac⟩ := node_on_cell hS hΓ haN + obtain ⟨x, hx, y, hy, hxy⟩ := two_nodes hS hΓ hc + obtain ⟨b, hb, hba⟩ : ∃ b ∈ tilde c, a ≠ b := by + by_cases h : a = x + · exact ⟨y, hy, h ▸ hxy⟩ + · exact ⟨x, hx, h⟩ + have hO := (Γ.isClosedDisc_closure_cell hc).isOArc_discBd + obtain ⟨L₀, B, hL₀, -, hu, -⟩ := hO.lines (Γ.tilde_subset_discBd hc hac) + (Γ.tilde_subset_discBd hc hb) hba + have h1 := near_region hS hΓ.isOpen hr hc ha hL₀ (hu ▸ subset_union_left) + obtain ⟨L', h2, h3, -⟩ := exists_side_near hS hΓ.isOpen (fun c hc => two_nodes hS hΓ hc) hr + hL₀.left_mem h1 + exact ⟨L', h2, h3⟩ + +/-- A strip along a side of a region. -/ +theorem side_strip' [CompactSpace S] [ConnectedSpace S] (hS : IsSurface S) + (hΓ : Γ.Tame) {c L A r : Set S} {a b : S} (hr : r ∈ Γ.regions) (hL : Γ.IsSide c L a b) + (hcl : L ⊆ closure r) (hA : IsClosed A) (hAL : A ∩ L ⊆ {a, b}) : + ∃ St γ, IsClosedDisc St ∧ IsLineWithEnds γ a b ∧ discBd St = L ∪ γ ∧ L ∩ γ = {a, b} + ∧ St ∩ closure c = L ∧ St ∩ A ⊆ {a, b} ∧ St ∩ Γ.U ⊆ L ∧ St \ L ⊆ r ∧ + ∀ x ∈ L, x ≠ a → x ≠ b → closure c ∪ St ∈ 𝓝 x := by + obtain ⟨St, γ, r₀, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11⟩ := side_strip hS hΓ.isOpen hL hA + hAL + obtain rfl : r = r₀ := SideOf.unique hS hΓ.isOpen hr h8 ⟨c, a, b, hL, hcl⟩ ⟨c, a, b, hL, h10⟩ + exact ⟨St, γ, h1, h2, h3, h4, h5, h6, h7, h9, h11⟩ + +omit [T2Space S] in +/-- A line that leaves a strip at its end leaves it through the far side. -/ +theorem bridge_end {St L γ β : Set S} {x y : S} (hman : ∀ x : S, IsManifoldPoint x) + (hSt : IsClosedDisc St) (hb : discBd St = L ∪ γ) (hβ : IsLineWithEnds β x y) + (hi : β ∩ St = {x}) (hx : x ∉ L) : x ∈ γ := by + have hxSt : x ∈ St := (hi.ge rfl : x ∈ β ∩ St).2 + have hxb : x ∈ discBd St := by + by_contra hn + have h1 : x ∈ closure (β \ {x, y}) := hβ.subset_closure_diff hβ.left_mem + obtain ⟨z, hz, hz'⟩ := mem_closure_iff.mp h1 _ (hSt.isOpen_discInt hman) ⟨hxSt, hn⟩ + have h2 : z ∈ β ∩ St := ⟨hz'.1, hz.1⟩ + rw [hi] at h2 + exact hz'.2 (.inl h2) + exact (hb ▸ hxb : x ∈ L ∪ γ).resolve_left hx + +omit [T2Space S] in +theorem not_mem_closure_union {A B : Set S} {a : S} (h : a ∉ closure A) + (h' : a ∉ closure B) : a ∉ closure (A ∪ B) := by + rw [closure_union] + rintro (h1 | h1) + · exact h h1 + · exact h' h1 + +omit [T2Space S] in +/-- A curve through a node with the rest in a region bounds a disc that misses the rest of the +paint. -/ +theorem curve_disc (hΓ : Γ.Tame) {r F : Set S} {a : S} (hr : r ∈ Γ.regions) (haN : a ∈ Γ.N) + (hF : IsOArc F) (hFr : ∀ x ∈ F, x ≠ a → x ∈ r) : + ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = F ∧ ∀ x ∈ Γ.U, x ≠ a → x ∉ Δ := by + have hU : ∀ {x}, x ∈ F → x ∈ Γ.U → x = a := fun {x} hx hxU => by + by_contra hne + exact region_subset hr (hFr x hx hne) hxU + obtain ⟨Δ, hΔ, hb, hsub⟩ := hΓ.curve F hF (fun x hx => by + rw [hU hx.1 hx.2] + exact haN) (by + have hsub : F ∩ Γ.N ⊆ {a} := fun _ hx => hU hx.1 (Γ.N_subset hx.2) + exact (Set.ncard_le_ncard hsub (finite_singleton a)).trans (by simp)) + exact ⟨Δ, hΔ, hb, fun x hxU hne hxΔ => hne (hU (hsub ⟨hxΔ, hxU⟩) hxU)⟩ + +/-- Two lines at a node along the far sides of two strips, closed up inside the region. -/ +theorem exists_loop {r St₁ St₂ L₁ L₂ γ₁ γ₂ : Set S} {a b₁ b₂ : S} (hS : IsSurface S) (_ : Γ.Tame) + (hr : r ∈ Γ.regions) (haN : a ∈ Γ.N) (hb₁N : b₁ ∈ Γ.N) (hb₂N : b₂ ∈ Γ.N) + (h₁ : IsClosedDisc St₁) (h₂ : IsClosedDisc St₂) + (hγ₁ : IsLineWithEnds γ₁ a b₁) (hγ₂ : IsLineWithEnds γ₂ a b₂) (hb₁ : discBd St₁ = L₁ ∪ γ₁) + (hb₂ : discBd St₂ = L₂ ∪ γ₂) (hr₁ : St₁ \ L₁ ⊆ r) (hr₂ : St₂ \ L₂ ⊆ r) + (hd₁ : Disjoint L₁ r) (hd₂ : Disjoint L₂ r) + (hi₁ : L₁ ∩ γ₁ = {a, b₁}) (hi₂ : L₂ ∩ γ₂ = {a, b₂}) (hin : St₂ ∩ St₁ ⊆ {a, b₂}) : + ∃ A₁ A₂ x y β, IsLineWithEnds A₁ a x ∧ IsLineWithEnds A₂ a x ∧ A₁ ∩ A₂ = {a, x} ∧ x ∈ r + ∧ A₁ ⊆ γ₁ ∧ IsLineWithEnds β y x ∧ β ⊆ r ∧ β ⊆ A₂ ∧ y ∈ γ₂ ∧ + β ∩ St₂ = {y} ∧ β ∩ St₁ = {x} ∧ + (∃ A' R₁ R₂, IsLineWithEnds A' a y ∧ A' ⊆ γ₂ ∧ + A₂ = A' ∪ β ∧ IsLineWithEnds R₁ x b₁ ∧ IsLineWithEnds R₂ y b₂ ∧ + A₁ ∪ R₁ = γ₁ ∧ A₁ ∩ R₁ = {x} ∧ A' ∪ R₂ = γ₂ ∧ A' ∩ R₂ = {y}) ∧ + (∀ z ∈ A₁, z ≠ a → z ∈ r) ∧ (∀ z ∈ A₂, z ≠ a → z ∈ r) := by + have hman := hS.2.2 + have hNr : ∀ {z}, z ∈ Γ.N → z ∉ r := fun {z} hz h => region_subset hr h (Γ.N_subset hz) + have hinner : ∀ {L γ St : Set S} {b : S}, discBd St = L ∪ γ → IsLineWithEnds γ a b → L ∩ γ + = {a, b} → St \ L ⊆ r → ∃ e ∈ γ, e ∈ St ∧ e ∈ r := fun {L γ St b} hb hγ hi hsub => by + obtain ⟨e, he, h1, h2, -⟩ := exists_inner hγ (finite_empty (α := S)) + have h3 : e ∉ L := fun h => by + rcases (hi ▸ ⟨h, he⟩ : e ∈ ({a, b} : Set S)) with h4 | h4 + · exact h1 h4 + · exact h2 h4 + have h4 : e ∈ St := discBd_subset St (hb ▸ .inr he) + exact ⟨e, he, h4, hsub ⟨h4, h3⟩⟩ + obtain ⟨e₁, -, he₁, he₁r⟩ := hinner hb₁ hγ₁ hi₁ hr₁ + obtain ⟨e₂, -, he₂, he₂r⟩ := hinner hb₂ hγ₂ hi₂ hr₂ + have hsep : ∀ z ∈ r, z ∈ St₁ → z ∉ St₂ := fun z hz h1 h2 => by + rcases hin ⟨h2, h1⟩ with rfl | rfl + · exact hNr haN hz + · exact hNr hb₂N hz + obtain ⟨β, x, y, hβ, hβr, hx, hy, hβ₁, hβ₂⟩ := exists_bridge (arcComponentsIn_isPathConnected hr) + h₁.isClosed h₂.isClosed he₁ he₁r he₂ he₂r hsep + have hxr : x ∈ r := hβr hβ.left_mem + have hyr : y ∈ r := hβr hβ.right_mem + have hxγ : x ∈ γ₁ := bridge_end hman h₁ hb₁ hβ hβ₁ (fun h => disjoint_left.mp hd₁ h hxr) + have hyγ : y ∈ γ₂ := bridge_end hman h₂ hb₂ hβ.symm hβ₂ (fun h => disjoint_left.mp hd₂ h hyr) + have hxa : x ≠ a := fun e => hNr haN (e ▸ hxr) + have hya : y ≠ a := fun e => hNr haN (e ▸ hyr) + have hxb : x ≠ b₁ := fun e => hNr hb₁N (e ▸ hxr) + have hyb : y ≠ b₂ := fun e => hNr hb₂N (e ▸ hyr) + obtain ⟨A₁, R₁, hA₁, hR₁, hu₁, hi'₁⟩ := hγ₁.split hxγ hxa hxb + obtain ⟨A', R₂, hA', hR₂, hu₂, hi'₂⟩ := hγ₂.split hyγ hya hyb + have hA₁s : A₁ ⊆ γ₁ := hu₁ ▸ subset_union_left + have hA's : A' ⊆ γ₂ := hu₂ ▸ subset_union_left + have hA₁b : x ≠ b₁ → b₁ ∉ A₁ := fun h h' => h (hi'₁.le ⟨h', hR₁.right_mem⟩).symm + have hA'b : y ≠ b₂ → b₂ ∉ A' := fun h h' => h (hi'₂.le ⟨h', hR₂.right_mem⟩).symm + have hγ₁St : γ₁ ⊆ St₁ := (hb₁ ▸ subset_union_right).trans (discBd_subset St₁) + have hγ₂St : γ₂ ⊆ St₂ := (hb₂ ▸ subset_union_right).trans (discBd_subset St₂) + have hA'β : A' ∩ β = {y} := by + apply subset_antisymm + · rintro z ⟨h1, h2⟩ + rw [← hβ₂] + exact ⟨h2, hγ₂St (hA's h1)⟩ + · rintro _ rfl + exact ⟨hA'.right_mem, hβ.right_mem⟩ + have hA₂ := hA'.union hβ.symm hA'β + have hA₁r : ∀ z ∈ A₁, z ≠ a → z ∈ r := fun z hz hne => by + refine hr₁ ⟨hγ₁St (hA₁s hz), fun hL => ?_⟩ + rcases (hi₁ ▸ ⟨hL, hA₁s hz⟩ : z ∈ ({a, b₁} : Set S)) with h | h + · exact hne h + · exact hA₁b hxb (h ▸ hz) + have hA'r : ∀ z ∈ A', z ≠ a → z ∈ r := fun z hz hne => by + refine hr₂ ⟨hγ₂St (hA's hz), fun hL => ?_⟩ + rcases (hi₂ ▸ ⟨hL, hA's hz⟩ : z ∈ ({a, b₂} : Set S)) with h | h + · exact hne h + · exact hA'b hyb (h ▸ hz) + refine ⟨A₁, A' ∪ β, x, y, β, hA₁, hA₂, ?_, hxr, hA₁s, hβ.symm, hβr, subset_union_right, hyγ, + hβ₂, hβ₁, ⟨A', R₁, R₂, hA', hA's, rfl, hR₁, hR₂, hu₁, hi'₁, hu₂, hi'₂⟩, hA₁r, ?_⟩ + · apply subset_antisymm + · rintro z ⟨h1, h2 | h2⟩ + · by_cases hza : z = a + · exact .inl hza + · exact absurd (hsep z (hA₁r z h1 hza) (hγ₁St (hA₁s h1))) (not_not.mpr (hγ₂St (hA's h2))) + · have h3 : z ∈ β ∩ St₁ := ⟨h2, hγ₁St (hA₁s h1)⟩ + rw [hβ₁] at h3 + exact .inr h3 + · rintro z (rfl | rfl) + · exact ⟨hA₁.left_mem, .inl hA'.left_mem⟩ + · exact ⟨hA₁.right_mem, .inr hβ.left_mem⟩ + · rintro z (h | h) hne + · exact hA'r z h hne + · exact hβr h + +/-- Two different sides of a region meet at most in nodes. -/ +theorem sides_inter {r L L' : Set S} (h : Γ.SideOf r L) (h' : Γ.SideOf r L') (hne : L ≠ L') {z : S} + (hz : z ∈ L) (hz' : z ∈ L') : z ∈ Γ.N := by + obtain ⟨c, u, v, hs, -⟩ := h + obtain ⟨c', u', v', hs', -⟩ := h' + by_contra hn + exact hne (hs.1.unique hs'.1 hz hz' hn).2 + +/-- A region has at most two sides at a node. -/ +theorem three_sides [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {r L₁ L₂ L₃ : Set S} {a : + S} (hr : r ∈ Γ.regions) (h₁ : Γ.SideOf r L₁) (h₂ : Γ.SideOf r L₂) (h₃ : Γ.SideOf r L₃) + (ha₁ : a ∈ L₁) (ha₂ : a ∈ L₂) (ha₃ : a ∈ L₃) (haN : a ∈ Γ.N) (h12 : L₁ ≠ L₂) (h13 : L₁ ≠ L₃) + (h23 : L₂ ≠ L₃) : False := by + classical + have hcS : CompactSpace S := hS.1 + have hman := hS.2.2 + have hNr : ∀ {z}, z ∈ Γ.N → z ∉ r := fun {z} hz h => region_subset hr h (Γ.N_subset hz) + obtain ⟨c₁, u₁, v₁, hs₁', hcl₁⟩ := id h₁ + obtain ⟨c₂, u₂, v₂, hs₂', hcl₂⟩ := id h₂ + obtain ⟨c₃, u₃, v₃, hs₃', hcl₃⟩ := id h₃ + obtain ⟨b₁, hs₁⟩ := hs₁'.exists_end ha₁ haN + obtain ⟨b₂, hs₂⟩ := hs₂'.exists_end ha₂ haN + obtain ⟨b₃, hs₃⟩ := hs₃'.exists_end ha₃ haN + have hU₁ := hs₁.1.subset_U + have hU₂ := hs₂.1.subset_U + have hU₃ := hs₃.1.subset_U + have hdr : ∀ {L : Set S}, L ⊆ Γ.U → Disjoint L r := fun {L} hL => disjoint_left.mpr fun x hx hx' + => region_subset hr hx' (hL hx) + obtain ⟨St₁, γ₁, hSt₁, hγ₁, hb₁, hi₁, -, -, hU'₁, hr₁, -⟩ := side_strip' hS hΓ hr hs₁ hcl₁ + (isClosed_empty (X := S)) (by simp) + have hAL₂ : St₁ ∩ L₂ ⊆ {a, b₂} := fun z hz => by + have h1 := hU'₁ ⟨hz.1, hU₂ hz.2⟩ + exact hs₂.1.2.2.2.le ⟨hz.2, sides_inter h₁ h₂ h12 h1 hz.2⟩ + obtain ⟨St₂, γ₂, hSt₂, hγ₂, hb₂, hi₂, -, hA₂', hU'₂, hr₂, -⟩ := side_strip' hS hΓ hr hs₂ hcl₂ + hSt₁.isClosed hAL₂ + obtain ⟨A₁, A₂, x, y, β, hA₁, hA₂, hi, hxr, hA₁s, hβ, hβr, hβA, hyγ, hβ₂, hβ₁, ⟨A', -, -, hA', + hA's, rfl, -⟩, hA₁r, hA₂r⟩ := + exists_loop hS hΓ hr haN hs₁.1.right_mem_N hs₂.1.right_mem_N hSt₁ hSt₂ hγ₁ hγ₂ hb₁ hb₂ + hr₁ hr₂ (hdr hU₁) (hdr hU₂) hi₁ hi₂ hA₂' + set A₂ := A' ∪ β with hA₂def + let F := A₁ ∪ A₂ + have hFO : IsOArc F := oArc_of_lines hA₁ hA₂ hi + have hFr : ∀ z ∈ F, z ≠ a → z ∈ r := fun z hz hne => hz.elim (fun h => hA₁r z h hne) (fun h + => hA₂r z h hne) + have hFc : IsClosed F := hA₁.isCompact.isClosed.union hA₂.isCompact.isClosed + have hAL₃ : (F ∪ St₁ ∪ St₂) ∩ L₃ ⊆ {a, b₃} := by + rintro z ⟨h, hz⟩ + refine hs₃.1.2.2.2.le ⟨hz, ?_⟩ + rcases h with (h | h) | h + · by_cases hza : z = a + · exact hza ▸ haN + · exact absurd (hU₃ hz) (region_subset hr (hFr z h hza)) + · exact sides_inter h₁ h₃ h13 (hU'₁ ⟨h, hU₃ hz⟩) hz + · exact sides_inter h₂ h₃ h23 (hU'₂ ⟨h, hU₃ hz⟩) hz + obtain ⟨St₃, γ₃, hSt₃, hγ₃, hb₃, hi₃, -, hA₃', hU'₃, hr₃, -⟩ := side_strip' hS hΓ hr hs₃ hcl₃ + ((hFc.union hSt₁.isClosed).union hSt₂.isClosed) hAL₃ + have hb₃N := hs₃.1.right_mem_N + obtain ⟨e₃, he₃, he₃a, he₃b, -⟩ := exists_inner hγ₃ (finite_empty (α := S)) + have hγ₃St : γ₃ ⊆ St₃ := (hb₃ ▸ subset_union_right).trans (discBd_subset St₃) + have he₃r : e₃ ∈ r := hr₃ ⟨hγ₃St he₃, fun h => by + rcases (hi₃ ▸ ⟨h, he₃⟩ : e₃ ∈ ({a, b₃} : Set S)) with h1 | h1 + · exact he₃a h1 + · exact he₃b h1⟩ + have hF3 : ∀ z, z ∈ F → z ∈ St₃ → z = a ∨ z = b₃ := fun z h h' => hA₃' ⟨h', .inl (.inl h)⟩ + obtain ⟨β₃, q, q₃, hβ₃, hβ₃r, hqF, hq₃, hβF, hβ₃St⟩ := exists_bridge + (arcComponentsIn_isPathConnected hr) hFc hSt₃.isClosed (Or.inl hA₁.right_mem) hxr + (hγ₃St he₃) he₃r + (fun z hz h1 h2 => by + rcases hF3 z h1 h2 with rfl | rfl + · exact hNr haN hz + · exact hNr hb₃N hz) + have hqr : q ∈ r := hβ₃r hβ₃.left_mem + have hq₃r : q₃ ∈ r := hβ₃r hβ₃.right_mem + have hq₃γ : q₃ ∈ γ₃ := bridge_end hman hSt₃ hb₃ hβ₃.symm hβ₃St (fun h => disjoint_left.mp + (hdr hU₃) h hq₃r) + have hqa : q ≠ a := fun e => hNr haN (e ▸ hqr) + have hq₃a : q₃ ≠ a := fun e => hNr haN (e ▸ hq₃r) + have hq₃b : q₃ ≠ b₃ := fun e => hNr hb₃N (e ▸ hq₃r) + obtain ⟨A₃, hA₃, hA₃s, hA₃b⟩ := sub_line hγ₃ hq₃γ hq₃a + have hA₃β : A₃ ∩ β₃ = {q₃} := by + apply subset_antisymm + · rintro z ⟨h1, h2⟩ + rw [← hβ₃St] + exact ⟨h2, hγ₃St (hA₃s h1)⟩ + · rintro _ rfl + exact ⟨hA₃.right_mem, hβ₃.right_mem⟩ + have hP₃ : IsLineWithEnds (A₃ ∪ β₃) a q := hA₃.union hβ₃.symm hA₃β + obtain ⟨P₁, P₂, hP₁, hP₂, hun, hin, hg₁, hg₂⟩ := split_oarc hA₁ hA₂ hi hqF hqa + set P₃ := A₃ ∪ β₃ with hP₃def + have hP₃F : P₃ ∩ F = {a, q} := by + apply subset_antisymm + · rintro z ⟨h1 | h1, h2⟩ + · rcases hF3 z h2 (hγ₃St (hA₃s h1)) with h | h + · exact .inl h + · exact absurd (h ▸ h1) (hA₃b hq₃b) + · have h3 : z ∈ β₃ ∩ F := ⟨h1, h2⟩ + rw [hβF] at h3 + exact .inr h3 + · rintro z (rfl | rfl) + · exact ⟨hP₃.left_mem, .inl hA₁.left_mem⟩ + · exact ⟨hP₃.right_mem, hqF⟩ + have hP₁F : P₁ ⊆ F := subset_union_left.trans hun.subset + have hP₂F : P₂ ⊆ F := subset_union_right.trans hun.subset + have hP₁₃ : P₁ ∩ P₃ = {a, q} := by + apply subset_antisymm + · exact fun z hz => by rw [← hP₃F]; exact ⟨hz.2, hP₁F hz.1⟩ + · rintro z (rfl | rfl) + · exact ⟨hP₁.left_mem, hP₃.left_mem⟩ + · exact ⟨hP₁.right_mem, hP₃.right_mem⟩ + have hP₂₃ : P₂ ∩ P₃ = {a, q} := by + apply subset_antisymm + · exact fun z hz => by rw [← hP₃F]; exact ⟨hz.2, hP₂F hz.1⟩ + · rintro z (rfl | rfl) + · exact ⟨hP₂.left_mem, hP₃.left_mem⟩ + · exact ⟨hP₂.right_mem, hP₃.right_mem⟩ + have hP₃r : ∀ z ∈ P₃, z ≠ a → z ∈ r := fun z hz hne => by + rcases hz with h | h + · refine hr₃ ⟨hγ₃St (hA₃s h), fun hL => ?_⟩ + rcases (hi₃ ▸ ⟨hL, hA₃s h⟩ : z ∈ ({a, b₃} : Set S)) with h1 | h1 + · exact hne h1 + · exact hA₃b hq₃b (h1 ▸ h) + · exact hβ₃r h + obtain ⟨Δ₃, hΔ₃, hbd₃, hU₃'⟩ := curve_disc hΓ hr haN hFO hFr + obtain ⟨Δ₁, hΔ₁, hbd₁, hU₁'⟩ := curve_disc hΓ hr haN (oArc_of_lines hP₂ hP₃ hP₂₃) (F := P₂ ∪ P₃) + (fun z hz hne => Or.elim hz (fun h => hFr z (hP₂F h) hne) (fun h => hP₃r z h hne)) + obtain ⟨Δ₂, hΔ₂, hbd₂, hU₂'⟩ := curve_disc hΓ hr haN (oArc_of_lines hP₁ hP₃ hP₁₃) (F := P₁ ∪ P₃) + (fun z hz hne => Or.elim hz (fun h => hFr z (hP₁F h) hne) (fun h => hP₃r z h hne)) + let B : Set S := {b₁, b₂, b₃} \ {a} + have hBf : B.Finite := (toFinite _).subset sdiff_subset + have haB : a ∉ closure B := by + rw [hBf.isClosed.closure_eq] + exact fun h => h.2 rfl + have hgen : ∀ {P Q Sp Sq Sk : Set S}, a ∉ closure (P \ Sp) → a ∉ closure (Q \ Sq) → + (∀ z ∈ Sp, z ∈ Sk → z = a ∨ z ∈ B) → (∀ z ∈ Sq, z ∈ Sk → z = a ∨ z ∈ B) → + a ∉ closure (((P ∪ Q) ∩ Sk) \ {a}) := fun {P Q Sp Sq Sk} gP gQ hp hq h => by + refine not_mem_closure_union (not_mem_closure_union gP gQ) haB (closure_mono ?_ h) + rintro z ⟨⟨h1 | h1, h2⟩, h3⟩ + · by_cases h4 : z ∈ Sp + · exact .inr ((hp z h4 h2).resolve_left h3) + · exact .inl (.inl ⟨h1, h4⟩) + · by_cases h4 : z ∈ Sq + · exact .inr ((hq z h4 h2).resolve_left h3) + · exact .inl (.inr ⟨h1, h4⟩) + have hb₂B : ∀ z, z = a ∨ z = b₂ → z = a ∨ z ∈ B := by + rintro z (h | rfl) + · exact .inl h + · by_cases h : z = a + · exact .inl h + · exact .inr ⟨.inr (.inl rfl), h⟩ + have hb₃B : ∀ z, z = a ∨ z = b₃ → z = a ∨ z ∈ B := by + rintro z (h | rfl) + · exact .inl h + · by_cases h : z = a + · exact .inl h + · exact .inr ⟨.inr (.inr rfl), h⟩ + have h31 : ∀ z ∈ St₁, z ∈ St₃ → z = a ∨ z ∈ B := fun z h h' => hb₃B z (hA₃' ⟨h', .inl (.inr h)⟩) + have h32 : ∀ z ∈ St₂, z ∈ St₃ → z = a ∨ z ∈ B := fun z h h' => hb₃B z (hA₃' ⟨h', .inr h⟩) + have h21 : ∀ z ∈ St₁, z ∈ St₂ → z = a ∨ z ∈ B := fun z h h' => hb₂B z (hA₂' ⟨h', h⟩) + have h12' : ∀ z ∈ St₂, z ∈ St₁ → z = a ∨ z ∈ B := fun z h h' => h21 z h' h + have h13' : ∀ z ∈ St₃, z ∈ St₁ → z = a ∨ z ∈ B := fun z h h' => h31 z h' h + have h23' : ∀ z ∈ St₃, z ∈ St₂ → z = a ∨ z ∈ B := fun z h h' => h32 z h' h + have hA₁St : A₁ ⊆ St₁ := hA₁s.trans ((hb₁ ▸ subset_union_right).trans (discBd_subset St₁)) + have hA'St : A' ⊆ St₂ := hA's.trans ((hb₂ ▸ subset_union_right).trans (discBd_subset St₂)) + have g₁ : a ∉ closure (P₁ \ St₁) := fun h => by + have h5 : P₁ \ St₁ ⊆ P₁ \ A₁ := fun z hz => ⟨hz.1, fun h' => hz.2 (hA₁St h')⟩ + exact hg₁ (closure_mono h5 h) + have hβa : a ∉ closure β := by + rw [hβ.isCompact.isClosed.closure_eq] + exact fun h => hNr haN (hβr h) + have g₂ : a ∉ closure (P₂ \ St₂) := fun h => by + refine not_mem_closure_union hg₂ hβa (closure_mono ?_ h) + rintro z ⟨h1, h2⟩ + by_cases h3 : z ∈ β + · exact .inr h3 + · exact .inl ⟨h1, fun h4 => h4.elim (fun h5 => h2 (hA'St h5)) h3⟩ + have g₃ : a ∉ closure (P₃ \ St₃) := fun h => by + have hβ₃a : a ∉ closure β₃ := by + rw [hβ₃.isCompact.isClosed.closure_eq] + exact fun h => hNr haN (hβ₃r h) + refine hβ₃a (closure_mono ?_ h) + rintro z ⟨h1 | h1, h2⟩ + · exact absurd (hγ₃St (hA₃s h1)) h2 + · exact h1 + have hLb₁ : L₁ ⊆ discBd St₁ := hb₁ ▸ subset_union_left + have hLb₂ : L₂ ⊆ discBd St₂ := hb₂ ▸ subset_union_left + have hLb₃ : L₃ ⊆ discBd St₃ := hb₃ ▸ subset_union_left + have hb12 : discBd Δ₃ = P₁ ∪ P₂ := by rw [hbd₃, hun] + have hinner : ∀ {P Q : Set S}, P ∩ Q = {a, q} → Disjoint (P \ {a, q}) Q := fun he => + disjoint_left.mpr fun _ hz hz' => hz.2 (he ▸ ⟨hz.1, hz'⟩) + have hinner' : ∀ {P Q : Set S}, P ∩ Q = {a, q} → Disjoint (Q \ {a, q}) P := fun he => + disjoint_left.mpr fun _ hz hz' => hz.2 (he ▸ ⟨hz', hz.1⟩) + have hd₃ : Disjoint (P₃ \ {a, q}) Δ₃ := third_off hman hSt₃ hs₃.1.2.1 hLb₃ hΔ₃ hb12 (fun z hz hne + => hU₃' z (hU₃ hz) hne) hP₃ + (by + refine disjoint_union_right.mpr ⟨hinner' hP₁₃, hinner' hP₂₃⟩) g₃ (hgen g₁ g₂ h31 h32) + have hd₁ : Disjoint (P₁ \ {a, q}) Δ₁ := third_off hman hSt₁ hs₁.1.2.1 hLb₁ hΔ₁ hbd₁ (fun z hz hne + => hU₁' z (hU₁ hz) hne) hP₁ + (by + refine disjoint_union_right.mpr ⟨hinner hin, hinner hP₁₃⟩) g₁ (hgen g₂ g₃ h12' h13') + have hd₂ : Disjoint (P₂ \ {a, q}) Δ₂ := third_off hman hSt₂ hs₂.1.2.1 hLb₂ hΔ₂ hbd₂ (fun z hz hne + => hU₂' z (hU₂ hz) hne) hP₂ + (by + exact disjoint_union_right.mpr ⟨hinner' hin, hinner hP₂₃⟩) g₂ (hgen g₁ g₃ h21 h23') + have hcov := theta_cover hS hP₁ hP₂ hP₃ hin hP₂₃ hΔ₃ hΔ₁ hΔ₂ hb12 hbd₁ hbd₂ hd₃ hd₁ hd₂ + obtain ⟨z, hz, hza, -, -⟩ := exists_inner hs₁.1.2.1 (finite_empty (α := S)) + rcases (hcov ▸ mem_univ z : z ∈ Δ₃ ∪ Δ₁ ∪ Δ₂) with (h | h) | h + · exact hU₃' z (hU₁ hz) hza h + · exact hU₁' z (hU₁ hz) hza h + · exact hU₂' z (hU₁ hz) hza h + +end Painting + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/RegionDisc.lean b/LeanPool/GraphMinor/GM17/RegionDisc.lean new file mode 100644 index 0000000000..ae9c1b6538 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/RegionDisc.lean @@ -0,0 +1,114 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section8 +public import LeanPool.GraphMinor.Surface.CutRetract +public import LeanPool.GraphMinor.Surface.OpenDisc +public import LeanPool.GraphMinor.Surface.Disc + +/-! +# Regions of a painting are open discs + +We prove `RegionOpenDiscCriterionStatement`, the surface fact behind (8.1) of Graph Minors XVII +(page 181). Cap all cuffs, so that we +are in a surface without boundary, and apply Graph Minors VII, (4.2) (`open_disc`) to the region. A +region misses `bd(Σ)`, so it stays +open after capping. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +/-- (8.1) of Graph Minors XVII, the surface part: every region is an open disc when every `O`-arc +off `U(Γ)` bounds a disc off +`U(Γ)`. -/ +theorem regionOpenDiscCriterion : RegionOpenDiscCriterionStatement := by + unfold RegionOpenDiscCriterionStatement + intro S _ hconn hS Γ hne hF r hr + have hcS : CompactSpace S := hS.1 + have ht2 : T2Space S := hS.2.1 + obtain ⟨T, tT, j, K, hT, hj, hK, hu, hi, hconnT⟩ := exists_capAll S hS + have hcT : ConnectedSpace T := hconnT hconn + have ht2T : T2Space T := hT.2.1 + have hrsub : ∀ x ∈ r, x ∉ Γ.U := fun x hx => (arcComponentsIn_subset hr hx).2 + have hrpc := arcComponentsIn_isPathConnected hr + have hint : ∀ x ∈ r, IsInteriorPoint x := fun x hx => by + by_contra h + exact hrsub x hx (Γ.bd_subset h) + have hUc : IsOpen Γ.Uᶜ := Γ.isClosed_U.isOpen_compl + have hro : IsOpen r := by + refine isOpen_iff_mem_nhds.mpr fun x hx => ?_ + obtain ⟨V, hV, hxV, hsub, ⟨e⟩⟩ := (hint x hx).exists_subset hUc (hrsub x hx) + have hVp : IsPathConnected V := by + have h1 := isPathConnected_iff_pathConnectedSpace.mp isPathConnected_openUnitDisc + exact isPathConnected_iff_pathConnectedSpace.mpr (e.symm.surjective.pathConnectedSpace + e.symm.continuous) + have h3 : V ⊆ r := subset_arcComponent_of_isPathConnected hr (fun y hy + => ⟨mem_univ _, hsub hy⟩) hVp ⟨x, hxV, hx⟩ + exact Filter.mem_of_superset (hV.mem_nhds hxV) h3 + obtain ⟨x₀, hx₀⟩ := hne + obtain ⟨s, cs, hs⟩ := (haveI : Nonempty S := ⟨x₀⟩; exists_sec hj.continuous hj.injective) + have hYK : ∀ x ∈ r, j x ∉ K := fun x hx h => by + have h1 : j x ∈ range j ∩ K := ⟨mem_range_self x, h⟩ + rw [hi] at h1 + obtain ⟨y, hy, he⟩ := h1 + exact (hj.injective he ▸ hy) (hint x hx) + have hYo : IsOpen (j '' r) := by + have hcl : IsClosed (K ∪ j '' rᶜ) := hK.union (hj.isClosedMap _ hro.isClosed_compl) + convert hcl.isOpen_compl using 1 + ext y + constructor + · rintro ⟨x, hx, rfl⟩ (h | ⟨x', hx', he⟩) + · exact hYK x hx h + · exact hx' (hj.injective he ▸ hx) + · intro h + have hy : y ∈ range j ∪ K := hu ▸ mem_univ y + rcases hy with ⟨x, rfl⟩ | hy + · by_contra h3 + exact h (.inr ⟨x, fun hx => h3 ⟨x, hx, rfl⟩, rfl⟩) + · exact absurd (.inl hy) h + have hYc : IsConnected (j '' r) := hrpc.isConnected.image _ hj.continuous.continuousOn + have hYF : ∀ F : Set T, F ⊆ j '' r → IsOArc F → ∃ Δ : Set T, Δ ⊆ j '' r ∧ IsClosedDisc Δ + ∧ discBd Δ = F := by + intro F hFr hO + have hFj : F ⊆ range j := fun y hy => image_subset_range _ _ (hFr hy) + have hs' : ∀ y ∈ F, j (s y) = y := fun y hy => by + obtain ⟨x, rfl⟩ := hFj hy + rw [hs] + have hO' : IsOArc (s '' F) := hO.image (cs.mono hFj) (hj.continuous.continuousOn) fun y hy + => hs' y hy + have hsr : s '' F ⊆ r := by + rintro _ ⟨y, hy, rfl⟩ + obtain ⟨x, hx, rfl⟩ := hFr hy + rwa [hs] + obtain ⟨Δ, hΔ, hb, hd⟩ := hF _ hO' (disjoint_left.mpr fun x hx => hrsub x (hsr hx)) + have hΔr : Δ ⊆ r := by + refine subset_arcComponent_of_isPathConnected hr (fun y hy => ⟨mem_univ _, + disjoint_left.mp hd hy⟩) + (isPathConnected_of_isClosedDisc_finite_diff hΔ Subset.rfl (by simp)) ?_ + obtain ⟨φ⟩ := hO' + obtain ⟨x, h5⟩ := φ 1 + have h6 : x ∈ discBd Δ := hb ▸ h5 + obtain ⟨z, -, hz⟩ := h6 + exact ⟨x, hz ▸ z.2, hsr h5⟩ + obtain ⟨h1, h2⟩ := hΔ.image (f := j) (f' := s) hj.continuous.continuousOn (cs.mono + (image_subset_range _ _)) fun x _ => hs x + refine ⟨_, image_mono hΔr, h1, ?_⟩ + rw [h2, hb, image_image] + exact (image_congr hs').trans (image_id' F) + rcases open_disc T (j '' r) hT hcT hYc hYo hYF with ⟨-, h⟩ | ⟨-, ⟨e⟩⟩ + · obtain ⟨x, hx, he⟩ := h ▸ mem_univ (j x₀) + exact (hrsub x hx (hj.injective he ▸ hx₀)).elim + · exact ⟨hro, ⟨e.trans (hj.isEmbedding.homeomorphImage r).symm⟩⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/RegionFrontier.lean b/LeanPool/GraphMinor/GM17/RegionFrontier.lean new file mode 100644 index 0000000000..8dbcb0de31 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/RegionFrontier.lean @@ -0,0 +1,183 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Sides +import LeanPool.GraphMinor.GM11.PaintingRegions + +/-! +# The frontier of a region + +Let `r` be a region of a painting and assume that all regions are open discs. A strip along a side +of a cell lies, off the side, in a single region, the region of the side +(`strip_region`). The frontier of a region consists of nodes and of sides of cells +(`frontier_region`), and it is connected (`isPreconnected_frontier`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +namespace Painting + +variable {Γ : Painting S} [T2Space S] + +omit [T2Space S] in +theorem region_subset {r : Set S} (hr : r ∈ Γ.regions) : r ⊆ Γ.Uᶜ := fun _ hx => + (arcComponentsIn_subset hr hx).2 + +omit [T2Space S] in +theorem region_disjoint_closure {r c : Set S} (hr : r ∈ Γ.regions) (hc : c ∈ Γ.C) : Disjoint r + (closure c) := + disjoint_left.mpr fun _ hx hx' => region_subset hr hx (closure_minimal + (Γ.cell_subset_U hc) Γ.isClosed_U hx') + +omit [T2Space S] in +theorem exists_region {x : S} (hx : x ∉ Γ.U) : ∃ r ∈ Γ.regions, x ∈ r := + exists_mem_arcComponentsIn (F := univ \ Γ.U) ⟨mem_univ _, hx⟩ + +omit [T2Space S] in +theorem region_eq {r r' : Set S} (hr : r ∈ Γ.regions) (hr' : r' ∈ Γ.regions) {x : S} (hx : x ∈ r) + (hx' : x ∈ r') : r = r' := + arcComponentsIn_eq_of_mem hr hr' hx hx' + +omit [T2Space S] in +/-- A connected set off the paint lies in one region, if regions are open. -/ +theorem subset_region (hreg : ∀ r ∈ Γ.regions, IsOpen r) {P : Set S} (hP : IsPreconnected P) + (hU : Disjoint P Γ.U) {r : Set S} (hr : r ∈ Γ.regions) (hm : (P ∩ r).Nonempty) : P ⊆ r := by + have hO : IsOpen (⋃ r' ∈ Γ.regions \ {r}, r') := isOpen_biUnion fun r' h => hreg r' h.1 + refine hP.subset_left_of_subset_union (hreg r hr) hO ?_ (fun x hx => ?_) hm + · refine disjoint_left.mpr fun x hx hx' => ?_ + obtain ⟨r', hr', hxr'⟩ := mem_iUnion₂.mp hx' + exact hr'.2 (region_eq hr'.1 hr hxr' hx) + · obtain ⟨r', hr', hxr'⟩ := exists_region (Γ := Γ) (disjoint_left.mp hU hx) + by_cases he : r' = r + · exact .inl (he ▸ hxr') + · exact .inr (mem_iUnion₂.mpr ⟨r', ⟨hr', he⟩, hxr'⟩) + +omit [T2Space S] in +/-- A disc minus a line of its boundary is connected. -/ +theorem isPreconnected_disc_diff {D L : Set S} (hD : IsClosedDisc D) (hL : L ⊆ discBd D) : + IsPreconnected (D \ L) := + hD.isPreconnected_discInt.subset_closure (fun _x hx => ⟨hx.1, fun h => hx.2 (hL h)⟩) + (sdiff_subset.trans hD.subset_closure_discInt) + +omit [T2Space S] in +/-- The part of a strip off its line lies in a single region. -/ +theorem strip_region (hreg : ∀ r ∈ Γ.regions, IsOpen r) {L St : Set S} (hSt : IsClosedDisc St) + (hLb : L ⊆ discBd St) (hSU : St ∩ Γ.U ⊆ L) : + ∃ r ∈ Γ.regions, St \ L ⊆ r := by + obtain ⟨φ⟩ := hSt.isOArc_discBd + obtain ⟨x, hx⟩ : (discInt St).Nonempty := + closure_nonempty_iff.mp ⟨_, hSt.subset_closure_discInt (discBd_subset St (φ 1).2)⟩ + have hxU : x ∉ Γ.U := fun h => hx.2 (hLb (hSU ⟨hx.1, h⟩)) + obtain ⟨r, hr, hxr⟩ := exists_region (Γ := Γ) hxU + refine ⟨r, hr, subset_region hreg (isPreconnected_disc_diff hSt hLb) ?_ hr ⟨x, ⟨hx.1, + fun h => hx.2 (hLb h)⟩, hxr⟩⟩ + exact disjoint_left.mpr fun y hy hyU => hy.2 (hSU ⟨hy.1, hyU⟩) + +omit [T2Space S] in +/-- A region near an inner point of a side is the region of the strip of the side. -/ +theorem region_of_strip {c L St r r' : Set S} {y : S} (hc : c ∈ Γ.C) (hLc : L ⊆ closure c) + (hsub : St \ L ⊆ r) (hr : r ∈ Γ.regions) (hr' : r' ∈ Γ.regions) (hnb : closure c ∪ St ∈ 𝓝 y) + (hy : y ∈ closure r') : r' = r := by + obtain ⟨z, hzV, hz⟩ := mem_closure_iff_nhds.mp hy _ hnb + rcases hzV with h | h + · exact absurd h (disjoint_left.mp (region_disjoint_closure hr' hc) hz) + · exact region_eq hr' hr hz (hsub ⟨h, fun hL => disjoint_left.mp (region_disjoint_closure hr' hc) + hz (hLc hL)⟩) + +/-- A strip along a side with its region. -/ +theorem side_strip [CompactSpace S] [ConnectedSpace S] (hS : IsSurface S) + (hreg : ∀ r ∈ Γ.regions, IsOpen r) {c L A : Set S} {u v : S} + (hL : Γ.IsSide c L u v) (hA : IsClosed A) (hAL : A ∩ L ⊆ {u, v}) : + ∃ St γ r, IsClosedDisc St ∧ IsLineWithEnds γ u v ∧ discBd St = L ∪ γ ∧ L ∩ γ = {u, v} + ∧ St ∩ closure c = L ∧ St ∩ A ⊆ {u, v} ∧ St ∩ Γ.U ⊆ L ∧ + r ∈ Γ.regions ∧ St \ L ⊆ r ∧ L ⊆ closure r ∧ ∀ x ∈ L, x ≠ u → x ≠ v → closure c ∪ St ∈ 𝓝 x + := by + have hbd : ∀ x ∈ L, x ≠ u → x ≠ v → x ∉ bd S := by + intro x hx hu hv + exact disjoint_left.mp hL.2 ⟨hx, by rintro (e | e); exacts [hu e, hv e]⟩ + obtain ⟨St, γ, hSt, hγ, hb, hi, hc, hSA, hSU, hnb⟩ := + exists_strip hS hL.1.1 hL.1.2.1 hL.1.2.2.1 hbd + (fun x hx hu hv => hL.1.not_mem_N hx hu hv) hA hAL + have hLb : L ⊆ discBd St := hb ▸ subset_union_left + obtain ⟨r, hr, hsub⟩ := strip_region hreg hSt hLb hSU + refine ⟨St, γ, r, hSt, hγ, hb, hi, hc, hSA, hSU, hr, hsub, ?_, hnb⟩ + have h1 : discInt St ⊆ r := fun x hx => hsub ⟨hx.1, fun h => hx.2 (hLb h)⟩ + exact (hLb.trans (discBd_subset St)).trans (hSt.subset_closure_discInt.trans (closure_mono h1)) + +/-- The relation between a region and the sides on its frontier. -/ +def SideOf (Γ : Painting S) (r L : Set S) : Prop := ∃ c u v, Γ.IsSide c L u v ∧ L ⊆ closure r + +/-- The frontier of a region off the nodes lies on sides of this region. -/ +theorem frontier_region [CompactSpace S] [ConnectedSpace S] (hS : IsSurface S) + (hreg : ∀ r ∈ Γ.regions, IsOpen r) (h2 : ∀ c ∈ Γ.C, ∃ a ∈ tilde c, ∃ b ∈ tilde c, a ≠ b) + {r : Set S} (hr : r ∈ Γ.regions) {y : S} + (hy : y ∈ closure r) (hyr : y ∉ r) (hyN : y ∉ Γ.N) : ∃ L, Γ.SideOf r L ∧ y ∈ L := by + have hyU : y ∈ Γ.U := by + by_contra hn + obtain ⟨r', hr', hyr'⟩ := exists_region (Γ := Γ) hn + obtain ⟨z, hz, hz'⟩ := mem_closure_iff.mp hy r' (hreg r' hr') hyr' + exact hyr ((region_eq hr' hr hz hz') ▸ hyr') + obtain ⟨c, hc, hyc⟩ := exists_mem_arcComponentsIn (F := Γ.U \ Γ.N) (x := y) ⟨hyU, hyN⟩ + have hdisc := Γ.isClosedDisc_closure_cell hc + have hrc := region_disjoint_closure hr hc + have hycl := subset_closure hyc + have hyb : y ∈ discBd (closure c) := by + by_contra hn + have h1 : y ∈ discInt (closure c) := ⟨hycl, hn⟩ + obtain ⟨z, hz, hz'⟩ := mem_closure_iff.mp hy _ (hdisc.isOpen_discInt hS.2.2) h1 + exact disjoint_left.mp hrc hz' hz.1 + have hyS : y ∉ bd S := fun hb => by + obtain ⟨u, v, -, ht, hB, he, -, -⟩ := Γ.border_cell_exists_ends hc ⟨y, hyc, hb⟩ + have hBs : closure c ∩ bd S ⊆ discBd (closure c) := fun x hx => by + by_contra hn + exact hx.2 (isInteriorPoint_of_mem_discInt hS.2.2 hdisc ⟨hx.1, hn⟩) + have hyi : y ∈ (closure c ∩ bd S) \ {u, v} := he ▸ ⟨hyc, hb⟩ + have hnb := disc_nhds hS hdisc hB hBs rfl hyi.1 (fun e => hyi.2 (.inl e)) (fun e => hyi.2 + (.inr e)) + obtain ⟨z, hz, hz'⟩ := mem_closure_iff_nhds.mp hy _ hnb + exact disjoint_left.mp hrc hz' hz + obtain ⟨L, u, v, hL, hyL, hyu, hyv⟩ := exists_side hS hc (h2 c hc) hyb hyN hyS + obtain ⟨St, γ, r₀, -, -, -, -, -, -, -, hr₀, hsub, hcl, hnb⟩ := side_strip hS hreg hL + (isClosed_empty) (by simp) + have he := region_of_strip hc hL.1.subset_closure hsub hr₀ hr (hnb y hyL hyu hyv) hy + exact ⟨L, ⟨c, u, v, hL, he ▸ hcl⟩, hyL⟩ + +/-- A side lies on the frontier of one region only. -/ +theorem SideOf.unique [CompactSpace S] [ConnectedSpace S] (hS : IsSurface S) + (hreg : ∀ r ∈ Γ.regions, IsOpen r) {r r' L : Set S} (hr : r ∈ Γ.regions) + (hr' : r' ∈ Γ.regions) (h : Γ.SideOf r L) + (h' : Γ.SideOf r' L) : r = r' := by + obtain ⟨c, u, v, hL, hcl⟩ := h + obtain ⟨c', u', v', hL', hcl'⟩ := h' + obtain ⟨St, γ, r₀, -, -, -, -, -, -, -, hr₀, hsub, -, hnb⟩ := side_strip hS hreg hL + (isClosed_empty) (by simp) + obtain ⟨z, hz, hzu, hzv, -⟩ := exists_inner hL.1.2.1 (finite_empty (α := S)) + rw [region_of_strip hL.1.1 hL.1.subset_closure hsub hr₀ hr (hnb z hz hzu hzv) (hcl hz), + region_of_strip hL.1.1 hL.1.subset_closure hsub hr₀ hr' (hnb z hz hzu hzv) (hcl' hz)] + +end Painting + +/-- The ring between a radius and the unit circle in the plane is connected. -/ +theorem isPreconnected_ring {ρ : ℝ} (hρ : 0 ≤ ρ) : + IsPreconnected {z : EuclideanPlane | ρ < ‖z‖ ∧ ‖z‖ < 1} := + GM11.isPreconnected_annulus hρ + +/-- The frontier of an open disc in a compact space is connected. -/ +theorem isPreconnected_frontier [T2Space S] [CompactSpace S] {r : Set S} + (hr : IsOpenDisc r) : IsPreconnected (closure r \ r) := by + simpa only [frontier, hr.1.interior_eq] using GM11.isPreconnected_frontier hr + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/RegionTools.lean b/LeanPool/GraphMinor/GM17/RegionTools.lean new file mode 100644 index 0000000000..89c988c16c --- /dev/null +++ b/LeanPool/GraphMinor/GM17/RegionTools.lean @@ -0,0 +1,382 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Strip +public import LeanPool.GraphMinor.GM17.ReplaceDisc +public import LeanPool.GraphMinor.Surface.VertexLink +public import LeanPool.GraphMinor.Surface.Dissection + +/-! +# Tools for regions of a surface + +Three facts about surfaces that the study of regions of a painting uses. An open set with finite +frontier in a connected surface is the whole surface without +that frontier (`eq_compl_of_frontier_finite`). Just outside a disc, near a point of its boundary, a +surface looks like a connected piece (`exists_outer`). Two closed +discs in a connected closed surface with the same boundary are equal or cover the surface +(`two_discs`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology Metric Filter GraphMinor.Surface + +/-- An open set of a connected surface whose frontier is finite is everything off its frontier. -/ +theorem eq_compl_of_frontier_finite {S : Type} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + (hman : ∀ x : S, IsManifoldPoint x) {W A : Set S} (hW : IsOpen W) (hne : W.Nonempty) + (hA : A.Finite) (hcl : closure W ⊆ W ∪ A) : Aᶜ ⊆ W := by + classical + have hN : ∀ a : S, ∃ N, IsOpen N ∧ a ∈ N ∧ N ∩ A ⊆ {a} ∧ IsPreconnected (N \ {a}) := fun a => by + have h1 : IsOpen (A \ {a})ᶜ := (hA.subset sdiff_subset).isClosed.isOpen_compl + obtain ⟨N, hN, hmem, hs, hp⟩ := (hman a).exists_punctured h1 (fun h => h.2 rfl) + refine ⟨N, hN, hmem, fun y hy => ?_, hp⟩ + by_contra hne' + exact hs hy.1 ⟨hy.2, hne'⟩ + choose N hNo hNm hNA hNp using hN + have hsub : ∀ a, (N a \ {a}).Nonempty → ((N a \ {a}) ∩ W).Nonempty → N a \ {a} ⊆ W := fun a _ hm + => by + have hcov : N a \ {a} ⊆ W ∪ (closure W)ᶜ := fun y hy => by + by_cases hc : y ∈ closure W + · rcases hcl hc with h | h + · exact .inl h + · exact absurd (hNA a ⟨hy.1, h⟩) hy.2 + · exact .inr hc + have h1 := (hNp a).subset_left_of_subset_union hW isClosed_closure.isOpen_compl + (disjoint_left.mpr fun x hx hx' => hx' (subset_closure hx)) hcov + exact h1 hm + let W' : Set S := W ∪ {a | a ∈ A ∧ ((N a \ {a}) ∩ W).Nonempty} + have hop : IsOpen W' := by + rw [isOpen_iff_mem_nhds] + rintro x (h | ⟨hxA, hm⟩) + · exact Filter.mem_of_superset (hW.mem_nhds h) subset_union_left + · refine Filter.mem_of_superset ((hNo x).mem_nhds (hNm x)) fun y hy => ?_ + by_cases hyx : y = x + · exact hyx ▸ .inr ⟨hxA, hm⟩ + · exact .inl (hsub x (hm.mono inter_subset_left) hm ⟨hy, hyx⟩) + have hcl' : IsClosed W' := by + rw [← isOpen_compl_iff, isOpen_iff_mem_nhds] + intro x hx + have hxW : x ∉ W := fun h => hx (.inl h) + by_cases hxA : x ∈ A + · have hem : (N x \ {x}) ∩ W = ∅ := by + by_contra hne' + exact hx (.inr ⟨hxA, nonempty_iff_ne_empty.mpr hne'⟩) + refine Filter.mem_of_superset ((hNo x).mem_nhds (hNm x)) fun y hy => ?_ + by_cases hyx : y = x + · exact hyx ▸ hx + · have hyA : y ∉ A := fun h => hyx (hNA x ⟨hy, h⟩) + have hyW : y ∉ W := fun h => (eq_empty_iff_forall_notMem.mp hem y) ⟨⟨hy, hyx⟩, h⟩ + rintro (h | h) + · exact hyW h + · exact hyA h.1 + · have hxc : x ∉ closure W := fun h => (hcl h).elim hxW hxA + have h1 : IsOpen ((closure W)ᶜ ∩ Aᶜ) := isClosed_closure.isOpen_compl.inter + hA.isClosed.isOpen_compl + refine Filter.mem_of_superset (h1.mem_nhds ⟨hxc, hxA⟩) fun y hy => ?_ + rintro (h | h) + · exact hy.1 (subset_closure h) + · exact hy.2 h.1 + have huniv : W' = univ := IsClopen.eq_univ ⟨hcl', hop⟩ (hne.mono subset_union_left) + intro x hx + rcases (huniv ▸ mem_univ x : x ∈ W') with h | h + · exact h + · exact absurd h.1 hx + +/-- A connected piece just outside the unit disc, near a point of the unit circle. -/ +theorem exists_sector {w : ℂ} (hw : ‖w‖ = 1) {ε : ℝ} (hε : 0 < ε) : + ∃ A : Set ℂ, IsPreconnected A ∧ A ⊆ ball w ε ∧ (∀ z ∈ A, 1 < ‖z‖) ∧ ∀ᶠ z in 𝓝 w, 1 < ‖z‖ + → z ∈ A := by + have hw0 : w ≠ 0 := fun h => by simp [h] at hw + have hc : Continuous fun ζ : ℂ => w * Complex.exp ζ := by fun_prop + have h0 : (fun ζ : ℂ => w * Complex.exp ζ) 0 = w := by simp + obtain ⟨δ, hδ, hball⟩ := Metric.continuous_iff.mp hc 0 ε hε + let Q : Set ℂ := ball 0 δ ∩ {ζ | 0 < ζ.re} + have hQ : Convex ℝ Q := (convex_ball _ _).inter (convex_halfSpace_gt Complex.reLm.isLinear 0) + refine ⟨(fun ζ => w * Complex.exp ζ) '' Q, hQ.isPreconnected.image _ hc.continuousOn, ?_, ?_, ?_⟩ + · rintro _ ⟨ζ, hζ, rfl⟩ + have h1 := hball ζ hζ.1 + simp only [Complex.exp_zero, mul_one] at h1 + exact h1 + · rintro _ ⟨ζ, hζ, rfl⟩ + rw [norm_mul, hw, one_mul, Complex.norm_exp] + exact Real.one_lt_exp_iff.mpr hζ.2 + · have hl : ContinuousAt (fun z : ℂ => Complex.log (z / w)) w := by + refine ContinuousAt.clog (by fun_prop) ?_ + rw [div_self hw0] + exact Complex.ofReal_mem_slitPlane.mpr one_pos + have h1 : Complex.log (w / w) = 0 := by + rw [div_self hw0, Complex.log_one] + have h2 := hl.eventually (ball_mem_nhds (Complex.log (w / w)) hδ) + filter_upwards [h2, isOpen_ne.mem_nhds (show w ≠ 0 from hw0)] with z hz hz0 hn + rw [h1] at hz + refine ⟨Complex.log (z / w), ⟨hz, ?_⟩, ?_⟩ + · change 0 < (Complex.log (z / w)).re + rw [Complex.log_re, norm_div, hw, div_one] + exact Real.log_pos hn + · change w * Complex.exp (Complex.log (z / w)) = z + rw [Complex.exp_log (div_ne_zero hz0 hw0)] + field_simp + +/-- Near a point of the boundary of a disc, the outside of the disc is a connected piece, as small +as we like. -/ +theorem exists_outer {T : Type} [TopologicalSpace T] (hT : IsSurface T) {B V : Set T} {a : T} + (hB : IsClosedDisc B) (hint : ∀ x ∈ discBd B, IsInteriorPoint x) + (ha : a ∈ discBd B) (hV : V ∈ 𝓝 a) : + ∃ P Q, IsPreconnected P ∧ P ⊆ V ∧ Disjoint P B ∧ IsOpen Q ∧ a ∈ Q ∧ Q ⊆ V ∧ Q \ B ⊆ P := by + have ht2 : T2Space T := hT.2.1 + have hman := hT.2.2 + obtain ⟨Δ', hΔ', hin, -⟩ := exists_disc_around hman hB hint isOpen_univ (subset_univ _) + obtain ⟨p⟩ := hB.isOArc_discBd + obtain ⟨c, c', hcc, hc'c, hmc, hmc', hl, hr, hcB, hcb, hcp⟩ := exists_disc_collar hB hΔ' hin p + obtain ⟨w₀, rfl⟩ : ∃ w₀ : Circle, (p w₀).1 = a := by + obtain ⟨w, hw⟩ := p.surjective ⟨a, ha⟩ + exact ⟨w, congrArg Subtype.val hw⟩ + have hw₀ : ‖(w₀ : ℂ)‖ = 1 := Circle.norm_coe w₀ + have hcw : c w₀ = (p w₀).1 := hcp w₀ + have h2 : (w₀ : ℂ) ∈ ball (0 : ℂ) 2 := by simp [hw₀] + have hcat : ContinuousAt c w₀ := hcc.continuousAt (closedBall_mem_nhds_of_mem h2) + have hV' : c ⁻¹' V ∈ 𝓝 (w₀ : ℂ) := hcat (by rw [hcw]; exact hV) + obtain ⟨ε, hε, hεV⟩ := Metric.mem_nhds_iff.mp (Filter.inter_mem hV' (isOpen_ball.mem_nhds h2)) + obtain ⟨A, hAp, hAb, hAn, hAe⟩ := exists_sector hw₀ hε + obtain ⟨ε', hε', hA'⟩ := Metric.eventually_nhds_iff_ball.mp hAe + have hAs : A ⊆ ball 0 2 := fun z hz => (hεV (hAb hz)).2 + have hclosed2 : ball (0 : ℂ) 2 ⊆ closedBall 0 2 := ball_subset_closedBall + have hsph : c '' sphere 0 2 = discBd Δ' := hcb + have hopen : IsOpen (discInt Δ') := hΔ'.isOpen_discInt hman + have hintΔ : ∀ z ∈ ball (0 : ℂ) 2, c z ∈ discInt Δ' := fun z hz => by + refine ⟨hmc (hclosed2 hz), fun hb => ?_⟩ + rw [← hsph] at hb + obtain ⟨z', hz', he⟩ := hb + have h3 : z' = z := by + rw [← hl (sphere_subset_closedBall hz'), he, hl (hclosed2 hz)] + rw [h3, mem_sphere_zero_iff_norm] at hz' + rw [mem_ball_zero_iff] at hz + linarith + have hc'a : c' (c w₀) = w₀ := hl (hclosed2 h2) + let Q : Set T := discInt Δ' ∩ c' ⁻¹' (ball w₀ (min ε ε')) + have hmemΔ : ∀ {x}, x ∈ discInt Δ' → x ∈ Δ' := fun hx => hx.1 + have hQo : IsOpen Q := by + have h3 : ContinuousOn c' (discInt Δ') := hc'c.mono fun x hx => hx.1 + exact h3.isOpen_inter_preimage hopen isOpen_ball + have hcyQ : ∀ {y}, y ∈ Q → c (c' y) = y := fun {y} hy => hr hy.1.1 + have hQb : ∀ {y}, y ∈ Q → c' y ∈ ball (w₀ : ℂ) (min ε ε') := fun hy => hy.2 + refine ⟨c '' A, Q, hAp.image _ (hcc.mono (hAs.trans hclosed2)), ?_, ?_, hQo, ?_, ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact (hεV (hAb hz)).1 + · refine disjoint_left.mpr ?_ + rintro _ ⟨z, hz, rfl⟩ hm + rw [← hcB] at hm + obtain ⟨z', hz', he⟩ := hm + have h3 : z' = z := by + rw [← hl (closedBall_subset_closedBall (by norm_num) hz'), he, hl (hclosed2 (hAs hz))] + rw [h3, mem_closedBall_zero_iff] at hz' + linarith [hAn z hz] + · refine ⟨by rw [← hcw]; exact hintΔ _ h2, ?_⟩ + change c' (p w₀).1 ∈ ball (w₀ : ℂ) (min ε ε') + rw [← hcw, hc'a] + exact mem_ball_self (lt_min hε hε') + · intro y hy + have h3 := hcyQ hy + have h4 := hQb hy + rw [← h3] + exact (hεV (ball_subset_ball (min_le_left _ _) h4)).1 + · rintro y ⟨hy, hyB⟩ + have h3 := hcyQ hy + have h4 := hQb hy + refine ⟨c' y, ?_, h3⟩ + refine hA' _ (ball_subset_ball (min_le_right _ _) h4) ?_ + by_contra hn + exact hyB (h3 ▸ hcB ▸ mem_image_of_mem _ (mem_closedBall_zero_iff.mpr (not_lt.mp hn))) + +/-- Near a point of the boundary of a disc in the closure of an open set off the disc, there are +frontier points of that set off any line of the boundary with that end. -/ +theorem frontier_near {T : Type} [TopologicalSpace T] (hT : IsSurface T) {B W L : Set T} {a b : T} + (hB : IsClosedDisc B) (hint : ∀ x ∈ discBd B, IsInteriorPoint x) + (hW : IsOpen W) (hWB : Disjoint W B) + (ha : a ∈ closure W) (hL : IsLineWithEnds L a b) (hLB : L ⊆ discBd B) : a ∈ closure + (frontier W \ L) := by + have ht2 : T2Space T := hT.2.1 + by_contra hn + have hV : (closure (frontier W \ L))ᶜ ∈ 𝓝 a := isClosed_closure.isOpen_compl.mem_nhds hn + have hab : a ∈ discBd B := hLB hL.left_mem + obtain ⟨P, Q, hP, hPV, hPB, hQ, haQ, hQV, hQB⟩ := exists_outer hT hB hint hab hV + have hmeet : (P ∩ W).Nonempty := by + obtain ⟨z, hzQ, hzW⟩ := mem_closure_iff.mp ha Q hQ haQ + exact ⟨z, hQB ⟨hzQ, disjoint_left.mp hWB hzW⟩, hzW⟩ + have hPW : P ⊆ W := by + refine hP.subset_left_of_subset_union hW isClosed_closure.isOpen_compl + (disjoint_left.mpr fun x hx hx' => hx' (subset_closure hx)) (fun y hy => ?_) hmeet + by_contra hcon + have h1 : y ∉ W := fun h => hcon (.inl h) + have h2 : y ∈ closure W := by + by_contra h + exact hcon (.inr h) + have hyf : y ∈ frontier W := by + rw [hW.frontier_eq] + exact ⟨h2, h1⟩ + exact hPV hy (subset_closure ⟨hyf, fun hyL => disjoint_left.mp hPB hy (discBd_subset B + (hLB hyL))⟩) + obtain ⟨L', hL', hun, hin⟩ := oarc_split hB.isOArc_discBd hL hLB + have h3 : a ∈ closure (L' \ {a, b}) := hL'.subset_closure_diff hL'.left_mem + obtain ⟨y, hyQ, hyL'⟩ := mem_closure_iff.mp h3 Q hQ haQ + have hyb : y ∈ discBd B := hun ▸ Or.inr hyL'.1 + have hyL : y ∉ L := fun h => hyL'.2 (hin ▸ ⟨h, hyL'.1⟩) + have hycl : y ∈ closure P := by + have h4 : y ∈ closure Bᶜ := mem_closure_compl hyb (hint y hyb) + refine closure_mono hQB ?_ + refine mem_closure_iff.mpr fun O hO hyO => ?_ + obtain ⟨z, hz, hzB⟩ := mem_closure_iff.mp h4 (O ∩ Q) (hO.inter hQ) ⟨hyO, hyQ⟩ + exact ⟨z, hz.1, hz.2, hzB⟩ + have hyW : y ∉ W := fun h => disjoint_left.mp hWB h (discBd_subset B hyb) + have hyf : y ∈ frontier W := by + rw [hW.frontier_eq] + exact ⟨closure_mono hPW hycl, hyW⟩ + exact hQV hyQ (subset_closure ⟨hyf, hyL⟩) + +/-- Two closed discs with the same boundary in a connected closed surface are equal, or else they +cover the surface and meet exactly in the boundary. -/ +theorem two_discs_closed {T : Type} [TopologicalSpace T] [ConnectedSpace T] + (hT : IsClosedSurface T) {Δ Δ' : Set T} (h : IsClosedDisc Δ) (h' : IsClosedDisc Δ') + (hb : discBd Δ = discBd Δ') : + Δ = Δ' ∨ (Δ ∪ Δ' = univ ∧ Δ ∩ Δ' = discBd Δ) := by + have ht2 : T2Space T := hT.2.1 + have hTs : IsSurface T := ⟨hT.1, hT.2.1, fun x => (hT.2.2 x).isManifoldPoint⟩ + have hman := hTs.2.2 + by_cases hm : (discInt Δ ∩ Δ').Nonempty + · obtain ⟨z, hz, hz'⟩ := hm + exact .inl (eq_of_int_meet hman (G := discBd Δ) h h' subset_rfl hb.ge + (disjoint_left.mpr fun x hx hx' => hx.2 hx') + (disjoint_left.mpr fun x hx hx' => hx.2 (hb ▸ hx')) hz hz') + right + have hd : Disjoint (discInt Δ) Δ' := disjoint_left.mpr fun x hx hx' => hm ⟨x, hx, hx'⟩ + constructor + · refine IsClopen.eq_univ ⟨h.isClosed.union h'.isClosed, ?_⟩ ?_ + · rw [isOpen_iff_mem_nhds] + intro x hx + by_cases hxb : x ∈ discBd Δ + · obtain ⟨P, Q, hP, -, hPB, hQ, hxQ, -, hQB⟩ := + exists_outer hTs h' (fun y _ => hT.2.2 y) (hb ▸ hxb) Filter.univ_mem + have h1 : (P ∩ discInt Δ).Nonempty := by + obtain ⟨z, hzQ, hzi⟩ := mem_closure_iff.mp (h.subset_closure_discInt + (discBd_subset Δ hxb)) Q hQ hxQ + exact ⟨z, hQB ⟨hzQ, disjoint_left.mp hd hzi⟩, hzi⟩ + have h2 : Disjoint P (discBd Δ) := by + rw [hb] + exact hPB.mono_right (discBd_subset Δ') + rcases h.side hman hP h2 with h3 | h3 + · refine Filter.mem_of_superset (hQ.mem_nhds hxQ) fun y hy => ?_ + by_cases hyB : y ∈ Δ' + · exact .inr hyB + · exact .inl (h3 (hQB ⟨hy, hyB⟩)).1 + · obtain ⟨z, hz, hzi⟩ := h1 + exact absurd hzi.1 (disjoint_left.mp h3 hz) + · rcases hx with hx | hx + · exact Filter.mem_of_superset ((h.isOpen_discInt hman).mem_nhds ⟨hx, + hxb⟩) fun y hy => .inl hy.1 + · exact Filter.mem_of_superset ((h'.isOpen_discInt hman).mem_nhds ⟨hx, + hb ▸ hxb⟩) fun y hy => .inr hy.1 + · obtain ⟨φ⟩ := h.isOArc_discBd + exact ⟨_, .inl (discBd_subset Δ (φ 1).2)⟩ + · apply subset_antisymm + · rintro x ⟨hx, hx'⟩ + by_contra hn + exact disjoint_left.mp hd ⟨hx, hn⟩ hx' + · exact fun x hx => ⟨discBd_subset Δ hx, discBd_subset Δ' (hb ▸ hx)⟩ + +/-- A line with two marked ends and finitely many more marked points is a finite union of lines +between consecutive marks. -/ +theorem exists_gaps_line {X : Type} [TopologicalSpace X] [T2Space X] (n : ℕ) : ∀ {L : Set X} {u v : + X} {A : Set X}, IsLineWithEnds L u v → A.Finite → A ⊆ L → u ∈ A → v ∈ A → A.ncard = n → + ∃ 𝓕 : Set (Set X), 𝓕.Finite ∧ (∀ F ∈ 𝓕, ∃ a ∈ A, ∃ b ∈ A, IsLineWithEnds F a b ∧ F ⊆ L ∧ F ∩ A + = {a, b}) ∧ ⋃₀ 𝓕 = L := by + classical + induction n using Nat.strong_induction_on with + | _ n ih => + intro L u v A hL hA hAL hu hv hn + by_cases hmore : ∃ z ∈ A, z ≠ u ∧ z ≠ v + · obtain ⟨z, hz, hzu, hzv⟩ := hmore + obtain ⟨L₁, L₂, hL₁, hL₂, hun, hin⟩ := hL.split (hAL hz) hzu hzv + have hsub : ∀ {Q : Set X} {x}, x ∈ Q → (∃ y ∈ A, y ∉ Q) → (A ∩ Q).ncard < n := fun {Q x} _ hy + => by + rw [← hn] + obtain ⟨y, hy, hyQ⟩ := hy + exact Set.ncard_lt_ncard ⟨inter_subset_left, fun h => hyQ (h hy).2⟩ hA + have hvL₁ : v ∉ L₁ := fun h => by + have h1 : v ∈ L₁ ∩ L₂ := ⟨h, hL₂.right_mem⟩ + rw [hin] at h1 + exact hzv h1.symm + have huL₂ : u ∉ L₂ := fun h => by + have h1 : u ∈ L₁ ∩ L₂ := ⟨hL₁.left_mem, h⟩ + rw [hin] at h1 + exact hzu h1.symm + obtain ⟨𝓕₁, hf₁, h₁, hu₁⟩ := ih _ (hsub hL₁.left_mem ⟨v, hv, hvL₁⟩) hL₁ + (hA.subset inter_subset_left) inter_subset_right ⟨hu, hL₁.left_mem⟩ ⟨hz, hL₁.right_mem⟩ rfl + obtain ⟨𝓕₂, hf₂, h₂, hu₂⟩ := ih _ (hsub hL₂.left_mem ⟨u, hu, huL₂⟩) hL₂ + (hA.subset inter_subset_left) inter_subset_right ⟨hz, hL₂.left_mem⟩ ⟨hv, hL₂.right_mem⟩ rfl + refine ⟨𝓕₁ ∪ 𝓕₂, hf₁.union hf₂, ?_, by rw [sUnion_union, hu₁, hu₂, hun]⟩ + have hstep : ∀ {Q : Set X}, Q ⊆ L → ∀ {F a b}, (∃ a' ∈ A ∩ Q, ∃ b' ∈ A ∩ Q, a' = a ∧ b' = b + ∧ IsLineWithEnds F a b ∧ F ⊆ Q ∧ F ∩ (A ∩ Q) = {a, b}) → + a ∈ A ∧ b ∈ A ∧ IsLineWithEnds F a b ∧ F ⊆ L ∧ F ∩ A = {a, b} := by + rintro Q hQ F a b ⟨a', ha', b', hb', rfl, rfl, hF, hFQ, hFi⟩ + refine ⟨ha'.1, hb'.1, hF, hFQ.trans hQ, ?_⟩ + rw [← hFi] + ext y + exact ⟨fun h => ⟨h.1, h.2, hFQ h.1⟩, fun h => ⟨h.1, h.2.1⟩⟩ + rintro F (hF | hF) + · obtain ⟨a, ha, b, hb, h1, h2, h3⟩ := h₁ F hF + obtain ⟨h4, h5, h6⟩ := hstep (hun ▸ subset_union_left) ⟨a, ha, b, hb, rfl, rfl, h1, h2, h3⟩ + exact ⟨a, h4, b, h5, h6⟩ + · obtain ⟨a, ha, b, hb, h1, h2, h3⟩ := h₂ F hF + obtain ⟨h4, h5, h6⟩ := hstep (hun ▸ subset_union_right) ⟨a, ha, b, hb, rfl, rfl, h1, h2, h3⟩ + exact ⟨a, h4, b, h5, h6⟩ + · push Not at hmore + refine ⟨{L}, finite_singleton _, ?_, sUnion_singleton _⟩ + rintro F rfl + refine ⟨u, hu, v, hv, hL, subset_rfl, ?_⟩ + apply subset_antisymm + · rintro x ⟨-, hx⟩ + by_cases hxu : x = u + · exact .inl hxu + · exact .inr (hmore x hx hxu) + · rintro x (rfl | rfl) + · exact ⟨hL.left_mem, hu⟩ + · exact ⟨hL.right_mem, hv⟩ + +/-- An `O`-arc with at least two marked points, finitely many, is a finite union of lines between +consecutive marks. -/ +theorem exists_gaps_oarc {X : Type} [TopologicalSpace X] [T2Space X] {O A : Set X} {x y : X} + (hO : IsOArc O) (hA : A.Finite) (hAO : A ⊆ O) (hx : x ∈ A) (hy : y ∈ A) (hxy : x ≠ y) : + ∃ 𝓕 : Set (Set X), 𝓕.Finite ∧ (∀ F ∈ 𝓕, ∃ a ∈ A, ∃ b ∈ A, IsLineWithEnds F a b ∧ F ⊆ O ∧ F ∩ A + = {a, b}) ∧ ⋃₀ 𝓕 = O := by + obtain ⟨B₁, B₂, hB₁, hB₂, hun, hin⟩ := hO.lines (hAO hx) (hAO hy) hxy + have hpart : ∀ {B : Set X}, IsLineWithEnds B x y → B ⊆ O → ∃ 𝓕 : Set (Set X), 𝓕.Finite ∧ + (∀ F ∈ 𝓕, ∃ a ∈ A, ∃ b ∈ A, IsLineWithEnds F a b ∧ F ⊆ O ∧ F ∩ A = {a, b} ∧ F ⊆ B) ∧ + ⋃₀ 𝓕 = B := by + intro B hB hBO + obtain ⟨𝓕, hf, h, hu⟩ := exists_gaps_line _ hB (hA.subset (inter_subset_left (t + := B))) inter_subset_right ⟨hx, hB.left_mem⟩ ⟨hy, hB.right_mem⟩ rfl + refine ⟨𝓕, hf, fun F hF => ?_, hu⟩ + obtain ⟨a, ha, b, hb, h1, h2, h3⟩ := h F hF + refine ⟨a, ha.1, b, hb.1, h1, h2.trans hBO, ?_, h2⟩ + rw [← h3] + ext z + exact ⟨fun h => ⟨h.1, h.2, h2 h.1⟩, fun h => ⟨h.1, h.2.1⟩⟩ + obtain ⟨𝓕₁, hf₁, h₁, hu₁⟩ := hpart hB₁ (hun ▸ subset_union_left) + obtain ⟨𝓕₂, hf₂, h₂, hu₂⟩ := hpart hB₂ (hun ▸ subset_union_right) + refine ⟨𝓕₁ ∪ 𝓕₂, hf₁.union hf₂, ?_, by rw [sUnion_union, hu₁, hu₂, hun]⟩ + rintro F (hF | hF) + · obtain ⟨a, ha, b, hb, h1, h2, h3, -⟩ := h₁ F hF + exact ⟨a, ha, b, hb, h1, h2, h3⟩ + · obtain ⟨a, ha, b, hb, h1, h2, h3, -⟩ := h₂ F hF + exact ⟨a, ha, b, hb, h1, h2, h3⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/ReplaceDisc.lean b/LeanPool/GraphMinor/GM17/ReplaceDisc.lean new file mode 100644 index 0000000000..080c6fb17f --- /dev/null +++ b/LeanPool/GraphMinor/GM17/ReplaceDisc.lean @@ -0,0 +1,282 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.ArcDisc + +/-! +# Replacing a disc by one border cell + +We prove `NormalIArcReplaceDiscPaintingStatement`, the surface part of (7.4) of Graph Minors XVII +(pages 180–181): the part of a painting +inside a disc cut off by an `I`-arc can be replaced by one border cell. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +/-- The ends of a line are the two points given. -/ +theorem lineEnds_eq {L : Set S} {u v : S} (h : IsLineWithEnds L u v) : lineEnds L + = {u, v} := by + apply subset_antisymm _ (ends_subset_of_isLineWithEnds h).2 + rintro x ⟨y, f', h1, -⟩ + obtain ⟨f, rfl, rfl⟩ := h + let g : unitInterval ≃ₜ unitInterval := f'.trans f.symm + have hg : ∀ t, (f (g t)).1 = (f' t).1 := fun t => by simp [g] + rcases g.continuous.strictMono_of_inj g.injective with hm | ha + · left + obtain ⟨t, ht⟩ := g.surjective 0 + have : g 0 = 0 := le_antisymm ((hm.monotone unitInterval.nonneg').trans_eq ht) + unitInterval.nonneg' + rw [← h1, ← hg, this] + · right + obtain ⟨t, ht⟩ := g.surjective 1 + have : g 0 = 1 := le_antisymm unitInterval.le_one' (ht.symm.le.trans + (ha.antitone unitInterval.nonneg')) + rw [← h1, ← hg, this] + rfl + +/-- A boundary point of a closed disc that is an inner point of the space is a limit of points off +the disc. -/ +theorem mem_closure_compl {Δ : Set S} {x : S} (hx : x ∈ discBd Δ) (hi : IsInteriorPoint x) : x ∈ + closure Δᶜ := by + by_contra hn + have hint : x ∈ interior Δ := by + rw [interior_eq_compl_closure_compl] + exact hn + obtain ⟨V, hV, hxV, hsub, ⟨e⟩⟩ := hi.exists_subset isOpen_interior hint + obtain ⟨z, hz, rfl⟩ := hx + have h1 : Subtype.val '' (Subtype.val ⁻¹' V : Set Δ) = V := + image_preimage_eq_of_subset fun y hy => by + rw [Subtype.range_val] + exact interior_subset (hsub hy) + exact hz ⟨_, hV.preimage continuous_subtype_val, hxV, + ⟨(IsEmbedding.subtypeVal.homeomorphImage _).trans ((Homeomorph.setCongr h1).trans e)⟩⟩ + +private theorem nodes_outside_cut_disc + (S : Type) + [TopologicalSpace S] + (Γ : Painting S) + (n₁ : S) + (n₂ : S) + (F : Set S) + (Δ : Set S) + (hFN : F ∩ Γ.N = {n₁, n₂}) + (hnb : ∀ x ∈ Δ \ F, Δ ∈ 𝓝 x) + (hFΔ : F ⊆ closure Δᶜ) + (hnF : {n₁, n₂} ⊆ F ∩ Γ.N) : + Γ.N ∩ closure Δᶜ = Γ.N \ Δ ∪ {n₁, n₂} := by + apply subset_antisymm + · rintro x ⟨hx, hxc⟩ + by_cases h : x ∈ Δ + · right + by_cases hxF : x ∈ F + · exact hFN ▸ ⟨hxF, hx⟩ + · have h3 := hnb x ⟨h, hxF⟩ + obtain ⟨y, hy, hy'⟩ := mem_closure_iff_nhds.mp hxc _ h3 + exact absurd hy hy' + · exact .inl ⟨hx, h⟩ + · rintro x (⟨hx, h⟩ | hx) + · exact ⟨hx, subset_closure h⟩ + · have h3 := hnF hx + exact ⟨h3.2, hFΔ h3.1⟩ + +/-- The surface part of (7.4) of Graph Minors XVII, pages 180–181. -/ +theorem normalIArcReplaceDisc : NormalIArcReplaceDiscPaintingStatement := by + unfold NormalIArcReplaceDiscPaintingStatement + intro S _ hS Γ n₁ n₂ F Δ hnorm hF hb hFN hΔ h1 h2 + have ht2 : T2Space S := hS.2.1 + obtain ⟨I, I', Θ, hΘ, hI, hI', hu', hi', hu, hi, hmeet, hnb⟩ := arc_disc_data hS hF hb hΔ h1 h2 + have hcl := hΔ.isClosed + have hIΘ : I ⊆ Θ := fun z hz => hu' ▸ .inl hz + have hΘb : Θ ⊆ bd S := by + obtain ⟨x, -, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + have hIΔ : I ⊆ Δ := fun z hz => (hmeet ▸ hz : z ∈ Δ ∩ bd S).1 + have hbdΔ : discBd Δ ⊆ Δ := by + rintro _ ⟨z, -, rfl⟩ + exact z.2 + have hside : ∀ c ∈ Γ.C, c ⊆ Δ ∨ c ⊆ Δᶜ := fun c hc => cell_side hc hnorm hΔ hnb + have hFΔ : F ⊆ closure Δᶜ := by + have h3 : F \ {n₁, n₂} ⊆ closure Δᶜ := fun x hx => by + refine mem_closure_compl (h1 hx.1) ?_ + by_contra hn + exact hx.2 (hb ▸ ⟨hx.1, hn⟩) + exact (hF.subset_closure_diff).trans (closure_minimal h3 isClosed_closure) + have hnF : ({n₁, n₂} : Set S) ⊆ F ∩ Γ.N := hFN.symm.subset + have hn₁N : n₁ ∈ Γ.N := (hnF (mem_insert _ _)).2 + have hn₂N : n₂ ∈ Γ.N := (hnF (mem_insert_of_mem _ rfl)).2 + have hn₁F : n₁ ∈ F := (hnF (mem_insert _ _)).1 + have hn₂F : n₂ ∈ F := (hnF (mem_insert_of_mem _ rfl)).1 + have hn₁Δ : n₁ ∈ Δ := hbdΔ (h1 hn₁F) + have hn₂Δ : n₂ ∈ Δ := hbdΔ (h1 hn₂F) + have hNeq : Γ.N ∩ closure Δᶜ = (Γ.N \ Δ) ∪ {n₁, n₂} := by + exact nodes_outside_cut_disc S Γ n₁ n₂ F Δ hFN hnb hFΔ hnF + let c' : Set S := Δ \ {n₁, n₂} + let N' : Set S := (Γ.N \ Δ) ∪ {n₁, n₂} + obtain ⟨hc'ne, hc'pc, hc'cl⟩ : + c'.Nonempty ∧ IsPathConnected c' ∧ closure c' = Δ := by + refine hΔ.sdiff_of_inter_subset_discBd ?_ + rintro x ⟨rfl | rfl, -⟩ + · exact h1 hn₁F + · exact h1 hn₂F + have hc't : tilde c' = {n₁, n₂} := by + rw [tilde, hc'cl] + ext x + simp only [c', mem_sdiff, not_and, not_not] + constructor + · rintro ⟨h3, h4⟩ + exact h4 h3 + · rintro h3 + refine ⟨?_, fun _ => h3⟩ + rcases h3 with rfl | rfl + · exact hn₁Δ + · exact hn₂Δ + have hne₂ : n₁ ≠ n₂ := hF.ne' + have hdΔ : Disjoint N' c' := by + rw [disjoint_left] + rintro x (⟨-, h⟩ | h) hx + · exact h hx.1 + · exact hx.2 h + have hIne : ∃ z, z ∈ I \ {n₁, n₂} := by + by_contra h + push Not at h + have h3 := hI.subset_closure_diff hI.left_mem + rw [show I \ {n₁, n₂} = ∅ from eq_empty_iff_forall_notMem.mpr fun z hz => h z hz, + closure_empty] at h3 + exact h3 + obtain ⟨z, hzI⟩ := hIne + have hzc' : z ∈ c' := ⟨hIΔ hzI.1, hzI.2⟩ + let J : Set (Set S) := insert c' {c ∈ Γ.C | c ⊆ Δᶜ} + have hJ_finite : J.Finite := by + have hfinite : {c ∈ Γ.C | c ⊆ Δᶜ}.Finite := + Γ.finite_cells.subset fun _ hc => hc.1 + exact hfinite.insert _ + have hJ : arcComponentsIn ((Γ.U ∪ Δ) \ N') = J := by + refine arcComponentsIn_eq_of_finite_cover hJ_finite ?_ ?_ ?_ ?_ ?_ + · ext x + constructor + · rintro ⟨d, (rfl | ⟨hd, hdc⟩), hx⟩ + · exact ⟨.inr hx.1, fun h => disjoint_left.mp hdΔ h hx⟩ + · refine ⟨.inl (arcComponentsIn_subset hd hx).1, ?_⟩ + rintro (h | h) + · exact (arcComponentsIn_subset hd hx).2 h.1 + · exact hdc hx (hbdΔ (h1 (hnF h).1)) + · rintro ⟨hx | hx, hxN⟩ + · by_cases h : x ∈ Δ + · exact ⟨c', .inl rfl, h, fun h3 => hxN (.inr h3)⟩ + · have hxN' : x ∉ Γ.N := fun h3 => hxN (.inl ⟨h3, h⟩) + obtain ⟨c, hc, hxc⟩ := exists_mem_arcComponentsIn (show x ∈ Γ.U \ Γ.N from ⟨hx, hxN'⟩) + exact ⟨c, .inr ⟨hc, (hside c hc).resolve_left fun h3 => h (h3 hxc)⟩, hxc⟩ + · exact ⟨c', .inl rfl, hx, fun h3 => hxN (.inr h3)⟩ + · rintro d (rfl | ⟨hd, -⟩) + · exact hc'ne + · exact arcComponentsIn_nonempty hd + · rintro d (rfl | ⟨hd, -⟩) + · exact hc'pc + · exact arcComponentsIn_isPathConnected hd + · rintro d (rfl | ⟨hd, hdc⟩) d' (rfl | ⟨hd', hdc'⟩) hne + · exact absurd rfl hne + · exact disjoint_left.mpr fun x hx hx' => hdc' hx' hx.1 + · exact disjoint_left.mpr fun x hx hx' => hdc hx hx'.1 + · exact arcComponentsIn_disjoint hd hd' hne + · rintro d (rfl | ⟨hd, hdc⟩) + · rw [hc'cl] + ext x + constructor + · rintro ⟨hx, -, hxN⟩ + exact ⟨hx, fun h3 => hxN (.inr h3)⟩ + · intro hx + exact ⟨hx.1, .inr hx.1, fun h3 => disjoint_left.mp hdΔ h3 hx⟩ + · ext x + constructor + · rintro ⟨hx, -, hxN⟩ + by_contra h + have hxt : x ∈ tilde d := ⟨hx, h⟩ + have h3 : x ∈ Γ.N ∩ closure Δᶜ := ⟨Γ.tilde_subset_N hd hxt, closure_mono hdc hx⟩ + exact hxN (show x ∈ (Γ.N \ Δ) ∪ {n₁, n₂} from hNeq ▸ h3) + · intro hx + refine ⟨subset_closure hx, .inl (arcComponentsIn_subset hd hx).1, ?_⟩ + rintro (h | h) + · exact (arcComponentsIn_subset hd hx).2 h.1 + · exact hdc hx (hbdΔ (h1 (hnF h).1)) + have hF'eq : discBd Δ ∩ Θ = I := by + apply subset_antisymm + · rintro x ⟨hx, hxΘ⟩ + exact hmeet ▸ ⟨hbdΔ hx, hΘb hxΘ⟩ + · exact fun x hx => ⟨hu ▸ .inr hx, hIΘ hx⟩ + let Γ' : Painting S := + { U := Γ.U ∪ Δ + N := N' + isClosed_U := Γ.isClosed_U.union hcl + N_subset := by + rintro x (h | h) + · exact .inl (Γ.N_subset h.1) + · exact .inr (hbdΔ (h1 (hnF h).1)) + finite_N := (Γ.finite_N.subset sdiff_subset).union (by simp) + finite_cells := by + rw [hJ] + exact hJ_finite + cell_disc := by + rw [hJ] + rintro d (rfl | ⟨hd, -⟩) + · rw [hc'cl, hc't] + refine ⟨hΔ, fun x hx => ?_, by simp, ?_⟩ + · exact h1 (hnF hx).1 + · rw [ncard_pair hne₂] + omega + · exact Γ.cell_disc d hd + bd_subset := fun x hx => .inl (Γ.bd_subset hx) + border_cell := by + rw [hJ] + rintro d (rfl | ⟨hd, -⟩) h + · rw [hc'cl, hc't, hmeet, lineEnds_eq hI, ncard_pair hne₂] + exact ⟨rfl, by simp, ⟨hI.choose⟩, rfl⟩ + · exact Γ.border_cell d hd h } + have hΓC : Γ'.C = J := hJ + obtain ⟨c₁, hc₁, h3, h4, h5, -⟩ := exists_border_cell hI (hIΘ.trans hΘb) hIΔ hn₁N hside + obtain ⟨c₂, hc₂, h6, h7, h8, -⟩ := exists_border_cell hI.symm (hIΘ.trans hΘb) hIΔ hn₂N hside + refine ⟨Γ', Θ, I', ?_⟩ + intro c'' F' + have hc'' : c'' = c' := rfl + have hF' : F' = I := hF'eq + refine ⟨rfl, hNeq.symm, rfl, hΘ, ⟨hn₁N, hIΘ hI.left_mem⟩, ⟨hn₂N, hIΘ hI.right_mem⟩, ?_, ?_, ?_, + ?_, hI', ?_, ?_, hside, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [← hu] + exact union_subset_union_right _ hIΘ + · rw [hF'] + exact hmeet + · rw [hF'] + exact hI + · rw [← hu'] + exact subset_union_right + · rw [hF'] + exact hu' + · rw [hF'] + exact hi' + · intro c hc hcΔ x hx + have h9 : x ∈ Γ.N ∩ closure Δᶜ := ⟨Γ.tilde_subset_N hc hx, closure_mono hcΔ hx.1⟩ + rw [hNeq] at h9 + exact h9 + · rw [hc'', hΓC] + exact .inl rfl + · exact ⟨z, hzc', hIΘ hzI.1⟩ + · exact hc't + · exact hΓC + · rintro ⟨-, h9⟩ + exact h9 hzc' hzc'.1 + · exact ⟨c₁, hc₁, h3, h4, h5⟩ + · exact ⟨c₂, hc₂, h6, h7, h8⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section10.lean b/LeanPool/GraphMinor/GM17/Section10.lean new file mode 100644 index 0000000000..b30c819032 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section10.lean @@ -0,0 +1,462 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section9b +import LeanPool.GraphMinor.GM17.PasteCuff +import LeanPool.GraphMinor.GM17.MarkCross +import LeanPool.GraphMinor.GM17.ReplaceDisc +import LeanPool.GraphMinor.GM17.RegionDisc +import LeanPool.GraphMinor.GM17.CutArcPaint +import LeanPool.GraphMinor.GM17.PushNode + +import LeanPool.GraphMinor.Surface.Cuffs + +/-! +# Graph Minors XVII, Section 10: Circumnavigating a Vortex + +This file formalizes Section 10 (pages 188–189) of N. Robertson and P. D. Seymour, +*Graph Minors. XVII. Taming a vortex*, J. Combin. Theory Ser. B 77 (1999), 162–210: +- Standard linkages around a cuff (`exists_cuffStandardLinkages`) and the circumnavigation walks + $L(v, n_0)$ (`CuffStandardLinkages.circWalk`, `CuffStandardLinkages.circumnavigationVertices`). +- **Graph Minors XVII, (10.1)** (`theorem_10_1`, page 188): structural properties of $L(v, n_0)$ + (paths vs. circuits, disjointness of tails, and shared endpoints). +- **Graph Minors XVII, (10.2)** (`theorem_10_2`, page 188): no separation $(A, B) \in \mathcal{T}$ + of order $\le z$ satisfies $V(L(v, n_0)) \subseteq V(A)$. +- **Graph Minors XVII, (10.3)** (`theorem_10_3`, page 189): for each cuff $\Theta$, no separation + $(A, B) \in \mathcal{T}$ of order $\le z$ satisfies $\gamma(N(\Gamma) \cap \Theta) \subseteq + V(A)$. +The portrayal deductions that use painting results are proved in `Section10Proved`. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Function Topology Metric +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +/-! ## 1. Helper Lemmas on Walks and Subhypergraphs -/ + +theorem skeleton_le_of_le {α : Type u} {β : Type v} + {H₁ H₂ : Hypergraph α β} (h : H₁ ≤ H₂) : + H₁.skeleton ≤ H₂.skeleton := by + intro u v ⟨hne, e, heu, hev⟩ + have heH₁ : e ∈ H₁.edgeSet := H₁.edge_mem_of_inc heu + have hends := h.ends_eq e heH₁ + have heu' : H₂.Inc e u := by change u ∈ H₂.ends e; rw [hends]; exact heu + have hev' : H₂.Inc e v := by change v ∈ H₂.ends e; rw [hends]; exact hev + exact ⟨hne, e, heu', hev'⟩ + +theorem end_mem_support_tail_of_support_tail_ne_nil {α : Type u} {G : SimpleGraph α} {u w : α} + (W : G.Walk u w) (h : W.support.tail ≠ []) : w ∈ W.support.tail := by + cases W with + | nil => simp at h + | cons _ W' => exact W'.end_mem_support + +theorem start_eq_end_of_support_tail_eq_nil {α : Type u} {G : SimpleGraph α} {u w : α} + (W : G.Walk u w) (h : W.support.tail = []) : u = w := by + cases W with + | nil => rfl + | cons _ W' => + exfalso + exact SimpleGraph.Walk.support_ne_nil W' h + +/-! ## 2. Entry Uniqueness on a Cuff (Dual of Claim (1) of (6.6)) -/ + +/-- Dual of `lemma_6_6_claim_1`: for each $x \in V(G)$, there is at most one index $i \in \text{Fin +} k$ +such that $x \notin \beta(n_i+)$ and $x \in \beta(n_{i+1}+)$. -/ +theorem unique_entry_index {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} {k : ℕ} (E : π.Γ.CuffEnumeration Θ k) + {x : α} {i₁ i₂ : Fin k} + (hi₁ : x ∉ π.borderPlus (E.node i₁) ∧ + x ∈ π.borderPlus (E.node (cyclicSucc (by have := E.two_le; omega) i₁))) + (hi₂ : x ∉ π.borderPlus (E.node i₂) ∧ + x ∈ π.borderPlus (E.node (cyclicSucc (by have := E.two_le; omega) i₂))) : + i₁ = i₂ := by + by_contra hne + have hk : 2 ≤ k := E.two_le + have hk_pos : 0 < k := by omega + have v12 : i₁.1 ≠ i₂.1 := fun h => hne (Fin.ext h) + have b1 := i₁.2 + have b2 := i₂.2 + have hcyc : cyclicDist (cyclicSucc hk_pos i₁) i₂ + cyclicDist i₂ (cyclicSucc hk_pos i₂) + + cyclicDist (cyclicSucc hk_pos i₂) i₁ ≤ k := by + have hnext1 : (cyclicSucc hk_pos i₁).1 = if i₁.1 + 1 < k then i₁.1 + 1 else 0 := by + change (i₁.1 + 1) % k = _ + split_ifs with h + · exact Nat.mod_eq_of_lt h + · have : i₁.1 + 1 = k := by omega + rw [this, Nat.mod_self] + have hnext2 : (cyclicSucc hk_pos i₂).1 = if i₂.1 + 1 < k then i₂.1 + 1 else 0 := by + change (i₂.1 + 1) % k = _ + split_ifs with h + · exact Nat.mod_eq_of_lt h + · have : i₂.1 + 1 = k := by omega + rw [this, Nat.mod_self] + simp only [cyclicDist_eq_ite, hnext1, hnext2] + split_ifs <;> omega + have hp7 := π.p7_of_cyclicDist E hcyc hi₁.2 hi₂.2 + rcases hp7 with h2 | h1 + · exact hi₂.1 h2 + · exact hi₁.1 h1 + +/-! ## 3. Standard Linkages and Circumnavigation Walks $L(v, n_0)$ (Page 188) -/ + +section Circumnavigation + +variable {α : Type u} {β : Type v} {G : Hypergraph α β} +variable {π : Portrayal G} {Θ : Set π.S} {k q : ℕ} {E : π.Γ.CuffEnumeration Θ k} +variable (SL : CuffStandardLinkages π Θ k q E) + +theorem Painting.CuffEnumeration.cell_mem (E : π.Γ.CuffEnumeration Θ k) (i : Fin k) : + E.cell i ∈ π.Γ.C := by + have h : E.cell i ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self i + exact h.1 + +theorem Painting.CuffEnumeration.cell_inter_cuff_nonempty + (E : π.Γ.CuffEnumeration Θ k) (i : Fin k) : + (E.cell i ∩ Θ).Nonempty := by + have h : E.cell i ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self i + exact h.2 + +theorem Painting.CuffEnumeration.node_mem (E : π.Γ.CuffEnumeration Θ k) (i : Fin k) : + E.node i ∈ π.Γ.N ∩ Θ := by + rw [← E.range_node]; exact mem_range_self i + +open Classical in +/-- Next vertex along the standard linkage at step $i : \text{Fin } k$. -/ +noncomputable def CuffStandardLinkages.stepVertex (i : Fin k) (u : α) : α := + if h : ∃ j : Fin q, (SL.L i j).first = u then + (SL.L i (Classical.choose h)).last + else u + +open Classical in +/-- The walk in $(\pi.\text{cellGraph } (E.\text{cell } i)).\text{skeleton}$ from $u$ to +`SL.stepVertex i u`. -/ +noncomputable def CuffStandardLinkages.stepCellWalk (i : Fin k) (u : α) : + (π.cellGraph (E.cell i)).skeleton.Walk u (SL.stepVertex i u) := + if h : ∃ j : Fin q, (SL.L i j).first = u then + ((SL.L i (Classical.choose h)).walk).copy (Classical.choose_spec h) + (by dsimp [CuffStandardLinkages.stepVertex]; rw [dite_eq_left h]) + else + SimpleGraph.Walk.nil.copy rfl + (by dsimp [CuffStandardLinkages.stepVertex]; rw [dite_eq_right h]) + +/-- The walk in $G.\text{skeleton}$ from $u$ to `SL.stepVertex i u`. -/ +noncomputable def CuffStandardLinkages.stepWalk (i : Fin k) (u : α) : + G.skeleton.Walk u (SL.stepVertex i u) := + (SL.stepCellWalk i u).map + (SimpleGraph.Hom.ofLE (skeleton_le_of_le (π.cellGraph_le (E.cell i) (E.cell_mem i)))) + +@[simp] +theorem CuffStandardLinkages.support_stepWalk (i : Fin k) (u : α) : + (SL.stepWalk i u).support = (SL.stepCellWalk i u).support := by + simp [CuffStandardLinkages.stepWalk] + +/-- Cyclic index `(i₀.1 + m) % k` used at step `m` of `traceVertex`. -/ +def stepIdx {k : ℕ} (hk : 2 ≤ k) (i₀ : Fin k) (m : ℕ) : Fin k := + ⟨(i₀.1 + m) % k, Nat.mod_lt _ (by omega)⟩ + +@[simp] +theorem stepIdx_zero {k : ℕ} (hk : 2 ≤ k) (i₀ : Fin k) : + stepIdx hk i₀ 0 = i₀ := by + ext; simp [stepIdx, Nat.mod_eq_of_lt i₀.2] + +@[simp] +theorem stepIdx_self {k : ℕ} (hk : 2 ≤ k) (i₀ : Fin k) : + stepIdx hk i₀ k = i₀ := by + ext; simp [stepIdx, Nat.add_mod_right, Nat.mod_eq_of_lt i₀.2] + +theorem stepIdx_succ {k : ℕ} (hk : 2 ≤ k) (i₀ : Fin k) (m : ℕ) : + stepIdx hk i₀ (m + 1) = cyclicSucc (by omega) (stepIdx hk i₀ m) := by + ext + change (i₀.1 + (m + 1)) % k = ((i₀.1 + m) % k + 1) % k + rw [← Nat.add_assoc, Nat.mod_add_mod] + +theorem stepIdx_ne_of_lt {k : ℕ} (hk : 2 ≤ k) (i₀ : Fin k) {m₁ m₂ : ℕ} + (hm₁ : m₁ < m₂) (hm₂ : m₂ < k) : + stepIdx hk i₀ m₁ ≠ stepIdx hk i₀ m₂ := by + intro hEq + have hval : (i₀.1 + m₁) % k = (i₀.1 + m₂) % k := congrArg Fin.val hEq + have hi₀ := i₀.2 + by_cases h1 : i₀.1 + m₁ < k <;> by_cases h2 : i₀.1 + m₂ < k + · rw [Nat.mod_eq_of_lt h1, Nat.mod_eq_of_lt h2] at hval; omega + · have h2' : i₀.1 + m₂ = (i₀.1 + m₂ - k) + 1 * k := by omega + rw [Nat.mod_eq_of_lt h1, h2', Nat.add_mul_mod_self_right, Nat.mod_eq_of_lt (by omega)] at hval + omega + · omega + · have h1' : i₀.1 + m₁ = (i₀.1 + m₁ - k) + 1 * k := by omega + have h2' : i₀.1 + m₂ = (i₀.1 + m₂ - k) + 1 * k := by omega + rw [h1', h2', Nat.add_mul_mod_self_right, Nat.add_mul_mod_self_right, + Nat.mod_eq_of_lt (by omega), Nat.mod_eq_of_lt (by omega)] at hval + omega + +theorem stepIdx_surjective {k : ℕ} (hk : 2 ≤ k) (i₀ : Fin k) (j : Fin k) : + ∃ r < k, stepIdx hk i₀ r = j := by + by_cases hle : i₀.1 ≤ j.1 + · refine ⟨j.1 - i₀.1, by omega, ?_⟩ + ext + change (i₀.1 + (j.1 - i₀.1)) % k = j.1 + rw [Nat.add_sub_of_le hle, Nat.mod_eq_of_lt j.2] + · refine ⟨j.1 + k - i₀.1, by omega, ?_⟩ + ext + change (i₀.1 + (j.1 + k - i₀.1)) % k = j.1 + have hEq : i₀.1 + (j.1 + k - i₀.1) = j.1 + k := by omega + rw [hEq, Nat.add_mod_right, Nat.mod_eq_of_lt j.2] + +theorem CuffStandardLinkages.traceVertex_succ (i₀ : Fin k) (v : α) (m : ℕ) : + SL.traceVertex i₀ v (m + 1) = SL.stepVertex (stepIdx E.two_le i₀ m) (SL.traceVertex i₀ v m) := + rfl + +/-- Inductively defined walk $P_1 \cup \dots \cup P_m$ ($0 \le m \le k$) in $G^*$ from $v$ to +`SL.traceVertex i₀ v m`, giving $L(v, n_0)$ when $m = k$ +(Graph Minors XVII, Section 10, page 188). -/ +noncomputable def CuffStandardLinkages.circWalk + (SL : CuffStandardLinkages π Θ k q E) (i₀ : Fin k) (v : α) : + (m : ℕ) → G.skeleton.Walk v (SL.traceVertex i₀ v m) + | 0 => .nil + | m + 1 => + (SL.circWalk i₀ v m).append + (SL.stepWalk (stepIdx E.two_le i₀ m) (SL.traceVertex i₀ v m)) + +theorem CuffStandardLinkages.support_tail_circWalk_succ (i₀ : Fin k) (v : α) (m : ℕ) : + (SL.circWalk i₀ v (m + 1)).support.tail = + (SL.circWalk i₀ v m).support.tail ++ + (SL.stepWalk (stepIdx E.two_le i₀ m) (SL.traceVertex i₀ v m)).support.tail := by + change ((SL.circWalk i₀ v m).append + (SL.stepWalk (stepIdx E.two_le i₀ m) (SL.traceVertex i₀ v m))).support.tail = _ + rw [SimpleGraph.Walk.support_append] + have hcons := (SL.circWalk i₀ v m).cons_tail_support + conv_lhs => rw [← hcons, List.cons_append, List.tail_cons] + +theorem CuffStandardLinkages.mem_support_tail_circWalk_iff (i₀ : Fin k) (v : α) (m : ℕ) (z : α) : + z ∈ (SL.circWalk i₀ v m).support.tail ↔ + ∃ r < m, z ∈ (SL.stepWalk (stepIdx E.two_le i₀ r) (SL.traceVertex i₀ v r)).support.tail := by + induction m with + | zero => + change z ∈ ([] : List α) ↔ _ + simp + | succ m ih => + rw [SL.support_tail_circWalk_succ, List.mem_append, ih] + constructor + · rintro (⟨r, hr, hz⟩ | hz) + · exact ⟨r, Nat.lt_succ_of_lt hr, hz⟩ + · exact ⟨m, Nat.lt_succ_self m, hz⟩ + · rintro ⟨r, hr, hz⟩ + rcases Nat.lt_succ_iff_lt_or_eq.mp hr with hlt | rfl + · exact Or.inl ⟨r, hlt, hz⟩ + · exact Or.inr hz + +theorem CuffStandardLinkages.last_inj (i : Fin k) {a b : Fin q} + (hEq : (SL.L i a).last = (SL.L i b).last) : a = b := by + by_contra hne + have ha : (SL.L i a).last ∈ (SL.L i a).walk.support := + (SL.L i a).walk.end_mem_support + have hb : (SL.L i a).last ∈ (SL.L i b).walk.support := by + rw [hEq] + exact (SL.L i b).walk.end_mem_support + exact Set.disjoint_left.mp ((SL.isStandard i).1 hne) ha hb + +theorem CuffStandardLinkages.exists_first_eq + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i : Fin k) {u : α} (hu : u ∈ π.borderSet (E.node i)) : + ∃ a : Fin q, (SL.L i a).first = u := by + have hΘ_bd : Θ ⊆ bd π.S := by + rcases E.cuff_mem with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hn_bd : E.node i ∈ π.Γ.N ∩ bd π.S := ⟨(E.node_mem i).1, hΘ_bd (E.node_mem i).2⟩ + have hfin : (π.borderSet (E.node i)).Finite := π.borderSet_finite hn_bd + exact exists_first_eq_of_ncard_le hfin (hcard i).le (SL.L i) (SL.isStandard i).1 hu + +theorem CuffStandardLinkages.exists_last_eq + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i : Fin k) {w : α} + (hw : w ∈ π.borderSet (E.node (cyclicSucc (by have := E.two_le; omega) i))) : + ∃ a : Fin q, (SL.L i a).last = w := by + have hΘ_bd : Θ ⊆ bd π.S := by + rcases E.cuff_mem with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + let j := cyclicSucc (by have := E.two_le; omega) i + have hj_bd : E.node j ∈ π.Γ.N ∩ bd π.S := ⟨(E.node_mem j).1, hΘ_bd (E.node_mem j).2⟩ + have hfin : (π.borderSet (E.node j)).Finite := π.borderSet_finite hj_bd + exact exists_last_eq_of_ncard_le hfin (hcard j).le (SL.L i) (SL.isStandard i).1 hw + +theorem CuffStandardLinkages.step_spec_of_mem + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i : Fin k) {u : α} (hu : u ∈ π.borderSet (E.node i)) : + ∃ a : Fin q, + (SL.L i a).first = u ∧ + SL.stepVertex i u = (SL.L i a).last ∧ + (SL.stepCellWalk i u).support = (SL.L i a).walk.support ∧ + (SL.stepWalk i u).support = (SL.L i a).walk.support ∧ + (SL.stepWalk i u).IsPath ∧ + SL.stepVertex i u ∈ π.borderSet (E.node (cyclicSucc (by have := E.two_le; omega) i)) := by + have hex := SL.exists_first_eq hcard i hu + let a := Classical.choose hex + have ha : (SL.L i a).first = u := Classical.choose_spec hex + have hstep : SL.stepVertex i u = (SL.L i a).last := dite_eq_left hex + have hcell_sup : (SL.stepCellWalk i u).support = (SL.L i a).walk.support := by + unfold CuffStandardLinkages.stepCellWalk + rw [dite_eq_left hex, SimpleGraph.Walk.support_copy] + have hwalk_sup : (SL.stepWalk i u).support = (SL.L i a).walk.support := + (SL.support_stepWalk i u).trans hcell_sup + have hisPath : (SL.stepWalk i u).IsPath := by + rw [SimpleGraph.Walk.isPath_def, hwalk_sup] + exact (SL.L i a).isPath.support_nodup + refine ⟨a, ha, hstep, hcell_sup, hwalk_sup, hisPath, ?_⟩ + rw [hstep] + exact (SL.L i a).last_mem + +theorem CuffStandardLinkages.stepVertex_injOn + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i : Fin k) : + InjOn (SL.stepVertex i) (π.borderSet (E.node i)) := by + intro u₁ hu₁ u₂ hu₂ hEq + obtain ⟨a₁, ha₁, hstep₁, _, _, _, _⟩ := SL.step_spec_of_mem hcard i hu₁ + obtain ⟨a₂, ha₂, hstep₂, _, _, _, _⟩ := SL.step_spec_of_mem hcard i hu₂ + have ha_eq : a₁ = a₂ := SL.last_inj i (hstep₁.symm.trans (hEq.trans hstep₂)) + rw [← ha₁, ← ha₂, ha_eq] + +theorem CuffStandardLinkages.traceVertex_mem_borderSet + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i₀ : Fin k) {v : α} (hv : v ∈ π.borderSet (E.node i₀)) (m : ℕ) : + SL.traceVertex i₀ v m ∈ π.borderSet (E.node (stepIdx E.two_le i₀ m)) := by + induction m with + | zero => + rw [stepIdx_zero] + exact hv + | succ m ih => + rw [SL.traceVertex_succ, stepIdx_succ] + exact (SL.step_spec_of_mem hcard (stepIdx E.two_le i₀ m) ih).choose_spec.2.2.2.2.2 + +theorem CuffStandardLinkages.traceVertex_injOn + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i₀ : Fin k) (m : ℕ) : + InjOn (fun v => SL.traceVertex i₀ v m) (π.borderSet (E.node i₀)) := by + induction m with + | zero => exact fun _ _ _ _ h => h + | succ m ih => + intro v₁ hv₁ v₂ hv₂ hEq + apply ih hv₁ hv₂ + exact SL.stepVertex_injOn hcard (stepIdx E.two_le i₀ m) + (SL.traceVertex_mem_borderSet hcard i₀ hv₁ m) + (SL.traceVertex_mem_borderSet hcard i₀ hv₂ m) hEq + +theorem CuffStandardLinkages.mem_support_inter_borderSet_left + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i : Fin k) (a : Fin q) {z : α} + (hz_sup : z ∈ (SL.L i a).walk.support) + (hz_bs : z ∈ π.borderSet (E.node i)) : + z = (SL.L i a).first := by + obtain ⟨b, hb⟩ := SL.exists_first_eq hcard i hz_bs + have hab : a = b := by + by_contra hne + exact Set.disjoint_left.mp ((SL.isStandard i).1 hne) hz_sup + (hb ▸ (SL.L i b).walk.start_mem_support) + rw [hab, hb] + +theorem CuffStandardLinkages.mem_support_inter_borderSet_right + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i : Fin k) (a : Fin q) {z : α} + (hz_sup : z ∈ (SL.L i a).walk.support) + (hz_bs : z ∈ π.borderSet (E.node (cyclicSucc (by have := E.two_le; omega) i))) : + z = (SL.L i a).last := by + obtain ⟨b, hb⟩ := SL.exists_last_eq hcard i hz_bs + have hab : a = b := by + by_contra hne + exact Set.disjoint_left.mp ((SL.isStandard i).1 hne) hz_sup + (hb ▸ (SL.L i b).walk.end_mem_support) + rw [hab, hb] + +/-- The vertex set of `SL.circWalk i₀ v k` equals `SL.circumnavigationVertices i₀ v`. -/ +theorem CuffStandardLinkages.support_circWalk_eq_circumnavigationVertices + (i₀ : Fin k) (v : α) : + {z | z ∈ (SL.circWalk i₀ v k).support} = SL.circumnavigationVertices i₀ v := by + classical + have hstep_set : ∀ r : ℕ, + {z | z ∈ (SL.stepWalk (stepIdx E.two_le i₀ r) (SL.traceVertex i₀ v r)).support} = + (let idx : Fin k := ⟨(i₀.1 + r) % k, Nat.mod_lt _ (by have := E.two_le; omega)⟩ + let cur := SL.traceVertex i₀ v r + if h : ∃ j : Fin q, (SL.L idx j).first = cur then + {z | z ∈ (SL.L idx (Classical.choose h)).walk.support} + else {cur}) := by + intro r + rw [SL.support_stepWalk] + dsimp only [CuffStandardLinkages.stepCellWalk, stepIdx] + by_cases h : ∃ j : Fin q, + (SL.L ⟨(i₀.1 + r) % k, Nat.mod_lt _ (by have := E.two_le; omega)⟩ j).first = + SL.traceVertex i₀ v r + · rw [dite_eq_left h, dite_eq_left h, SimpleGraph.Walk.support_copy] + · rw [dite_eq_right h, dite_eq_right h, SimpleGraph.Walk.support_copy] + ext z + simp + have hind : ∀ m : ℕ, 1 ≤ m → + {z | z ∈ (SL.circWalk i₀ v m).support} = + ⋃ r ∈ Finset.range m, + {z | z ∈ (SL.stepWalk (stepIdx E.two_le i₀ r) (SL.traceVertex i₀ v r)).support} := by + intro m hm + induction m with + | zero => omega + | succ m ih => + rcases m with _ | m + · ext z + change z ∈ (SimpleGraph.Walk.nil.append (SL.stepWalk (stepIdx E.two_le i₀ 0) v)).support ↔ + z ∈ ⋃ r ∈ Finset.range 1, + {z | z ∈ (SL.stepWalk (stepIdx E.two_le i₀ r) (SL.traceVertex i₀ v r)).support} + rw [SimpleGraph.Walk.nil_append, Finset.range_one] + simp only [Finset.mem_singleton, iUnion_iUnion_eq_left, mem_ofPred_eq] + rfl + · rw [Finset.range_add_one] + ext z + simp only [Finset.mem_insert, iUnion_iUnion_eq_or_left, mem_union, mem_ofPred_eq] + change z ∈ ((SL.circWalk i₀ v (m + 1)).append + (SL.stepWalk (stepIdx E.two_le i₀ (m + 1)) (SL.traceVertex i₀ v (m + 1)))).support ↔ _ + rw [SimpleGraph.Walk.mem_support_append_iff, or_comm] + exact or_congr Iff.rfl (Set.ext_iff.mp (ih (by omega)) z) + rw [hind k (by linarith [E.two_le])] + unfold CuffStandardLinkages.circumnavigationVertices + refine iUnion₂_congr fun r _ => hstep_set r + +theorem CuffStandardLinkages.support_stepCellWalk_subset_circumnavigationVertices + (i₀ : Fin k) (v : α) {r : ℕ} (hr : r < k) : + {z | z ∈ (SL.stepCellWalk (stepIdx E.two_le i₀ r) (SL.traceVertex i₀ v r)).support} ⊆ + SL.circumnavigationVertices i₀ v := by + intro z hz + change z ∈ (SL.stepCellWalk (stepIdx E.two_le i₀ r) (SL.traceVertex i₀ v r)).support at hz + unfold CuffStandardLinkages.circumnavigationVertices + refine mem_iUnion₂.mpr ⟨r, Finset.mem_range.mpr hr, ?_⟩ + dsimp only [CuffStandardLinkages.stepCellWalk, stepIdx] at hz ⊢ + by_cases h : ∃ j : Fin q, + (SL.L ⟨(i₀.1 + r) % k, Nat.mod_lt _ (by have := E.two_le; omega)⟩ j).first = + SL.traceVertex i₀ v r + · rw [dite_eq_left h, SimpleGraph.Walk.support_copy] at hz + rw [dite_eq_left h] + exact hz + · rw [dite_eq_right h, SimpleGraph.Walk.support_copy] at hz + rw [dite_eq_right h] + simpa using hz + +theorem CuffStandardLinkages.traceVertex_mem_circumnavigationVertices + (i₀ : Fin k) (v : α) {r : ℕ} (hr : r < k) : + SL.traceVertex i₀ v r ∈ SL.circumnavigationVertices i₀ v := + SL.support_stepCellWalk_subset_circumnavigationVertices i₀ v hr + (SimpleGraph.Walk.start_mem_support _) + +end Circumnavigation + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section10Proved.lean b/LeanPool/GraphMinor/GM17/Section10Proved.lean new file mode 100644 index 0000000000..41f4625336 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section10Proved.lean @@ -0,0 +1,718 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section10 +import LeanPool.GraphMinor.GM17.Section5Proved +public import LeanPool.GraphMinor.GM17.Section6Proved +import LeanPool.GraphMinor.GM17.Section7Proved +import LeanPool.GraphMinor.GM17.Section8Proved +import LeanPool.GraphMinor.GM17.Section9Proved +import LeanPool.GraphMinor.GM17.Section9bProved + +public import LeanPool.GraphMinor.GM17.Section9b +import LeanPool.GraphMinor.GM17.PasteCuff +import LeanPool.GraphMinor.GM17.MarkCross +import LeanPool.GraphMinor.GM17.ReplaceDisc +import LeanPool.GraphMinor.GM17.RegionDisc +import LeanPool.GraphMinor.GM17.CutArcPaint +import LeanPool.GraphMinor.GM17.PushNode + +import LeanPool.GraphMinor.Surface.Cuffs + +import LeanPool.GraphMinor.GM17.IndentMain + +import LeanPool.GraphMinor.GM17.RegionBoundary + +/-! +# Graph Minors XVII: proved deductions of Section10 + +The portrayal deductions use the existing painting proofs. The definitions and +independent geometric lemmas are imported from `Section10`. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Function Topology Metric +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +/-! ## 1. Helper Lemmas on Walks and Subhypergraphs -/ + +private lemma walk_support_subset_vertexSet {α : Type u} {β : Type v} + {H : Hypergraph α β} {u v : α} (hu : u ∈ H.vertexSet) + (W : H.skeleton.Walk u v) : + {z | z ∈ W.support} ⊆ H.vertexSet := + fun _ hz => Hypergraph.skeleton_walk_support_subset_vertexSet W hu _ hz + +/-- Existence of `CuffStandardLinkages` from (9.8) (`theorem_9_8_proof`). -/ +theorem exists_cuffStandardLinkages + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {Θ : Set π.S} {k : ℕ} (E : π.Γ.CuffEnumeration Θ k) : + Nonempty (CuffStandardLinkages π Θ k (π.warpAt Θ) E) := by + have hk_pos : 0 < k := by have := E.two_le; omega + have hex : ∀ i : Fin k, + ∃ L : Fin (π.warpAt Θ) → + PathFromTo (π.cellGraph (E.cell i)).skeleton + (π.borderSet (E.node i)) (π.borderSet (E.node (cyclicSucc hk_pos i))), + π.IsStandardLinkage (E.cell i) (E.node i) (E.node (cyclicSucc hk_pos i)) + (π.warpAt Θ) L := by + intro i + have hc_mem : E.cell i ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self i + have htilde := E.cell_tilde i + have hn₁ : E.node i ∈ tilde (E.cell i) := htilde ▸ mem_insert _ _ + have hn₂ : E.node (cyclicSucc hk_pos i) ∈ tilde (E.cell i) := + htilde ▸ mem_insert_of_mem _ (mem_singleton _) + have hne : E.node i ≠ E.node (cyclicSucc hk_pos i) := + E.injective_node.ne (cyclicSucc_ne_self E.two_le i).symm + exact (theorem_9_8_proof h𝒯 π htrue hred hwarp hθ E.cuff_mem hc_mem.1 hc_mem.2 + hn₁ hn₂ hne).2.2.2.2 + choose L hstd using hex + exact ⟨⟨L, hstd⟩⟩ + +section Circumnavigation + +variable {α : Type u} {β : Type v} {G : Hypergraph α β} +variable {π : Portrayal G} {Θ : Set π.S} {k q : ℕ} {E : π.Γ.CuffEnumeration Θ k} +variable (SL : CuffStandardLinkages π Θ k q E) + +theorem CuffStandardLinkages.mem_support_tail_subset_cellGraph + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i : Fin k) {u z : α} (hu : u ∈ π.borderSet (E.node i)) + (hz_tail : z ∈ (SL.stepWalk i u).support.tail) : + z ∈ (π.cellGraph (E.cell i)).vertexSet := by + obtain ⟨a, ha, _, _, hwalk_sup, _, _⟩ := SL.step_spec_of_mem hcard i hu + have hz_sup : z ∈ (SL.L i a).walk.support := + hwalk_sup ▸ List.mem_of_mem_tail hz_tail + have hΘ_bd : Θ ⊆ bd π.S := by + rcases E.cuff_mem with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hbd_i : (E.cell i ∩ bd π.S).Nonempty := + (E.cell_inter_cuff_nonempty i).mono (inter_subset_inter_right _ hΘ_bd) + exact walk_support_subset_vertexSet + (π.p3_subset (E.cell i) (E.cell_mem i) hbd_i (E.node i) + (E.cell_tilde i ▸ mem_insert _ _) (ha ▸ (SL.L i a).first_mem)) + (SL.L i a).walk hz_sup + +/-- Key structural property of the tail of a step walk: any vertex $z$ in +`(SL.stepWalk i u).support.tail` that also lies in `π.otherVertices (E.cell i)` (or in +`π.borderSet (E.node i) ∪ π.borderSet (E.node (cyclicSucc hk i))`) equals `SL.stepVertex i u` +and belongs to `π.borderPlus (E.node (cyclicSucc hk i)) \ π.borderPlus (E.node i)`. -/ +theorem CuffStandardLinkages.mem_tail_stepWalk_inter_other + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i : Fin k) {u z : α} (hu : u ∈ π.borderSet (E.node i)) + (hz_tail : z ∈ (SL.stepWalk i u).support.tail) + (hz_other : z ∈ π.otherVertices (E.cell i) ∨ + z ∈ π.borderSet (E.node i) ∪ + π.borderSet (E.node (cyclicSucc (by have := E.two_le; omega) i))) : + z = SL.stepVertex i u ∧ + z ∉ π.borderPlus (E.node i) ∧ + z ∈ π.borderPlus (E.node (cyclicSucc (by have := E.two_le; omega) i)) := by + obtain ⟨a, ha, hstep, _, hwalk_sup, hisPath, hstep_mem⟩ := SL.step_spec_of_mem hcard i hu + have hsup_cons : (SL.stepWalk i u).support = u :: (SL.stepWalk i u).support.tail := + ((SL.stepWalk i u).cons_tail_support).symm + have hnodup : (u :: (SL.stepWalk i u).support.tail).Nodup := + hsup_cons ▸ hisPath.support_nodup + have hz_ne_u : z ≠ u := fun hEq => (List.nodup_cons.mp hnodup).1 (hEq ▸ hz_tail) + have hz_sup : z ∈ (SL.L i a).walk.support := + hwalk_sup ▸ List.mem_of_mem_tail hz_tail + have hz_not_bs₁ : z ∉ π.borderSet (E.node i) := by + intro hz_bs₁ + have hEq := SL.mem_support_inter_borderSet_left hcard i a hz_sup hz_bs₁ + exact hz_ne_u (hEq.trans ha) + have hz_not_bp₁ : z ∉ π.borderPlus (E.node i) := by + rintro (hz_bs₁ | ⟨_, rfl⟩) + · exact hz_not_bs₁ hz_bs₁ + · exact ((SL.isStandard i).2.1 a).1 hz_sup + have hz_bs_union : z ∈ π.borderSet (E.node i) ∪ + π.borderSet (E.node (cyclicSucc (by have := E.two_le; omega) i)) := by + rcases hz_other with hvo | hbu + · have hΘ_bd : Θ ⊆ bd π.S := by + rcases E.cuff_mem with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hbd_i : (E.cell i ∩ bd π.S).Nonempty := + (E.cell_inter_cuff_nonempty i).mono (inter_subset_inter_right _ hΘ_bd) + have hzc : z ∈ (π.cellGraph (E.cell i)).vertexSet := + SL.mem_support_tail_subset_cellGraph hcard i hu hz_tail + obtain ⟨m, hm_t, hzm_bp⟩ := π.p6_borderPlus (E.cell_mem i) hbd_i hzc hvo + rw [E.cell_tilde i] at hm_t + rcases hm_t with rfl | rfl + · exact (hz_not_bp₁ hzm_bp).elim + · rcases hzm_bp with h | ⟨_, rfl⟩ + · exact Or.inr h + · exact (((SL.isStandard i).2.1 a).2 hz_sup).elim + · exact hbu + have hz_bs₂ : z ∈ π.borderSet (E.node (cyclicSucc (by have := E.two_le; omega) i)) := + hz_bs_union.resolve_left hz_not_bs₁ + have hz_eq_last : z = (SL.L i a).last := + SL.mem_support_inter_borderSet_right hcard i a hz_sup hz_bs₂ + exact ⟨hz_eq_last.trans hstep.symm, hz_not_bp₁, Or.inl hz_bs₂⟩ + +/-- For any two distinct pairs $(i_1, u_1) \ne (i_2, u_2)$ with $u_1 \in \beta(E.\text{node } i_1)$ +and $u_2 \in \beta(E.\text{node } i_2)$, the tails `(SL.stepWalk i₁ u₁).support.tail` and +`(SL.stepWalk i₂ u₂).support.tail` are disjoint. -/ +theorem CuffStandardLinkages.disjoint_support_tail_stepWalk + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + {i₁ i₂ : Fin k} {u₁ u₂ : α} + (hu₁ : u₁ ∈ π.borderSet (E.node i₁)) + (hu₂ : u₂ ∈ π.borderSet (E.node i₂)) + (hne : i₁ ≠ i₂ ∨ u₁ ≠ u₂) : + List.Disjoint (SL.stepWalk i₁ u₁).support.tail (SL.stepWalk i₂ u₂).support.tail := by + intro z hz₁ hz₂ + by_cases hi : i₁ = i₂ + · subst hi + have hu_ne : u₁ ≠ u₂ := hne.resolve_left (not_not.mpr rfl) + obtain ⟨a₁, ha₁, _, _, hsup₁, _, _⟩ := SL.step_spec_of_mem hcard i₁ hu₁ + obtain ⟨a₂, ha₂, _, _, hsup₂, _, _⟩ := SL.step_spec_of_mem hcard i₁ hu₂ + have ha_ne : a₁ ≠ a₂ := by + rintro rfl + exact hu_ne (ha₁.symm.trans ha₂) + exact Set.disjoint_left.mp ((SL.isStandard i₁).1 ha_ne) + (hsup₁ ▸ List.mem_of_mem_tail hz₁) + (hsup₂ ▸ List.mem_of_mem_tail hz₂) + · have hcell_ne : E.cell i₁ ≠ E.cell i₂ := E.injective_cell.ne hi + have hzc₁ : z ∈ (π.cellGraph (E.cell i₁)).vertexSet := + SL.mem_support_tail_subset_cellGraph hcard i₁ hu₁ hz₁ + have hzc₂ : z ∈ (π.cellGraph (E.cell i₂)).vertexSet := + SL.mem_support_tail_subset_cellGraph hcard i₂ hu₂ hz₂ + have hvo₁ : z ∈ π.otherVertices (E.cell i₁) := ⟨E.cell i₂, E.cell_mem i₂, hcell_ne.symm, hzc₂⟩ + have hvo₂ : z ∈ π.otherVertices (E.cell i₂) := ⟨E.cell i₁, E.cell_mem i₁, hcell_ne, hzc₁⟩ + obtain ⟨_, hnot₁, hmem₁⟩ := SL.mem_tail_stepWalk_inter_other hcard i₁ hu₁ hz₁ (Or.inl hvo₁) + obtain ⟨_, hnot₂, hmem₂⟩ := SL.mem_tail_stepWalk_inter_other hcard i₂ hu₂ hz₂ (Or.inl hvo₂) + exact hi (unique_entry_index π E ⟨hnot₁, hmem₁⟩ ⟨hnot₂, hmem₂⟩) + +/-- For every $v \in \beta(E.\text{node } i_0)$ and $m \le k$, `(SL.circWalk i₀ v m).support.tail` +is duplicate-free. -/ +theorem CuffStandardLinkages.nodup_support_tail_circWalk + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i₀ : Fin k) {v : α} (hv : v ∈ π.borderSet (E.node i₀)) + {m : ℕ} (hm : m ≤ k) : + (SL.circWalk i₀ v m).support.tail.Nodup := by + induction m with + | zero => + change ([] : List α).Nodup + exact List.nodup_nil + | succ m ih => + rw [SL.support_tail_circWalk_succ] + refine List.nodup_append.mpr ⟨ih (by omega), ?_, ?_⟩ + · have hisPath := (SL.step_spec_of_mem hcard (stepIdx E.two_le i₀ m) + (SL.traceVertex_mem_borderSet hcard i₀ hv m)).choose_spec.2.2.2.2.1 + have hcons := (SL.stepWalk (stepIdx E.two_le i₀ m) (SL.traceVertex i₀ v m)).cons_tail_support + exact (List.nodup_cons.mp (hcons ▸ hisPath.support_nodup)).2 + · intro z₁ hz₁ z₂ hz₂ hEq + subst hEq + rw [SL.mem_support_tail_circWalk_iff] at hz₁ + rcases hz₁ with ⟨r, hr, hzr⟩ + exact SL.disjoint_support_tail_stepWalk hcard + (SL.traceVertex_mem_borderSet hcard i₀ hv r) + (SL.traceVertex_mem_borderSet hcard i₀ hv m) + (Or.inl (stepIdx_ne_of_lt E.two_le i₀ hr hm)) hzr hz₂ + +/-- For distinct $v_1, v_2 \in \beta(E.\text{node } i_0)$, `(SL.circWalk i₀ v₁ k).support.tail` +and `(SL.circWalk i₀ v₂ k).support.tail` are disjoint. -/ +theorem CuffStandardLinkages.disjoint_support_tail_circWalk + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i₀ : Fin k) {v₁ v₂ : α} + (hv₁ : v₁ ∈ π.borderSet (E.node i₀)) + (hv₂ : v₂ ∈ π.borderSet (E.node i₀)) + (hne : v₁ ≠ v₂) : + List.Disjoint (SL.circWalk i₀ v₁ k).support.tail (SL.circWalk i₀ v₂ k).support.tail := by + intro z hz₁ hz₂ + rw [SL.mem_support_tail_circWalk_iff] at hz₁ hz₂ + rcases hz₁ with ⟨r₁, hr₁, hzr₁⟩ + rcases hz₂ with ⟨r₂, hr₂, hzr₂⟩ + have hne_step : stepIdx E.two_le i₀ r₁ ≠ stepIdx E.two_le i₀ r₂ ∨ + SL.traceVertex i₀ v₁ r₁ ≠ SL.traceVertex i₀ v₂ r₂ := by + rcases lt_trichotomy r₁ r₂ with hlt | rfl | hgt + · exact Or.inl (stepIdx_ne_of_lt E.two_le i₀ hlt hr₂) + · exact Or.inr (fun hEq => hne (SL.traceVertex_injOn hcard i₀ r₁ hv₁ hv₂ hEq)) + · exact Or.inl (stepIdx_ne_of_lt E.two_le i₀ hgt hr₁).symm + exact SL.disjoint_support_tail_stepWalk hcard + (SL.traceVertex_mem_borderSet hcard i₀ hv₁ r₁) + (SL.traceVertex_mem_borderSet hcard i₀ hv₂ r₂) + hne_step hzr₁ hzr₂ + +theorem CuffStandardLinkages.support_tail_circWalk_ne_nil + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p z : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (hT : π.IsCentral 𝒯) + (hwarp : π.warp ≤ p) (hred : π.IsRedundant 𝒯 θ z) + (hz : 3 ≤ z) (hθ : z + max 3 (2 * p + 2) < θ) + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i₀ : Fin k) {v : α} (hv : v ∈ π.borderSet (E.node i₀)) : + (SL.circWalk i₀ v k).support.tail ≠ [] := by + intro hnil + have hstep_nil : ∀ r < k, + (SL.stepWalk (stepIdx E.two_le i₀ r) (SL.traceVertex i₀ v r)).support.tail = [] := by + intro r hr + by_contra hne + obtain ⟨z, hz⟩ := List.exists_mem_of_ne_nil _ hne + have hz_all : z ∈ (SL.circWalk i₀ v k).support.tail := + (SL.mem_support_tail_circWalk_iff i₀ v k z).mpr ⟨r, hr, hz⟩ + rw [hnil] at hz_all + exact List.not_mem_nil hz_all + have htrace_eq : ∀ r ≤ k, SL.traceVertex i₀ v r = v := by + intro r hr + induction r with + | zero => rfl + | succ r ih => + have h_eq := start_eq_end_of_support_tail_eq_nil + (SL.stepWalk (stepIdx E.two_le i₀ r) (SL.traceVertex i₀ v r)) + (hstep_nil r (by omega)) + exact h_eq.symm.trans (ih (by omega)) + have hΘ_bd : Θ ⊆ bd π.S := by + rcases E.cuff_mem with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hv_G : v ∈ G.vertexSet := + π.borderSet_subset (E.node i₀) ⟨(E.node_mem i₀).1, hΘ_bd (E.node_mem i₀).2⟩ hv + have hX_sub : ({v} : Set α) ⊆ G.vertexSet := singleton_subset_iff.mpr hv_G + have hX_card : 3 * ({v} : Set α).ncard ≤ z := by + rw [ncard_singleton]; omega + refine theorem_6_6_proof h𝒯 π hT hwarp hred hθ E.cuff_mem hX_sub hX_card ?_ + intro n hn + have hn_range : n ∈ Set.range E.node := by rwa [E.range_node] + rcases hn_range with ⟨j, rfl⟩ + obtain ⟨r, hr_lt, hr_eq⟩ := stepIdx_surjective E.two_le i₀ j + refine ⟨v, mem_singleton v, Or.inl ?_⟩ + have hmem := SL.traceVertex_mem_borderSet hcard i₀ hv r + rw [htrace_eq r (by omega), hr_eq] at hmem + exact hmem + +theorem CuffStandardLinkages.mem_support_tail_circWalk_inter_borderSet_iff + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i₀ : Fin k) + (hne_nil : ∀ w ∈ π.borderSet (E.node i₀), (SL.circWalk i₀ w k).support.tail ≠ []) + {v u : α} (hv : v ∈ π.borderSet (E.node i₀)) (hu : u ∈ π.borderSet (E.node i₀)) : + u ∈ (SL.circWalk i₀ v k).support.tail ↔ u = SL.traceVertex i₀ v k := by + constructor + · intro hu_tail + have hΘ_bd : Θ ⊆ bd π.S := by + rcases E.cuff_mem with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hn₀_bd : E.node i₀ ∈ π.Γ.N ∩ bd π.S := ⟨(E.node_mem i₀).1, hΘ_bd (E.node_mem i₀).2⟩ + have hfin : (π.borderSet (E.node i₀)).Finite := π.borderSet_finite hn₀_bd + let f : α → α := fun w => SL.traceVertex i₀ w k + have hf_sub : f '' π.borderSet (E.node i₀) ⊆ π.borderSet (E.node i₀) := by + rintro _ ⟨w, hw, rfl⟩ + have hmem := SL.traceVertex_mem_borderSet hcard i₀ hw k + rwa [stepIdx_self] at hmem + have hf_card : (f '' π.borderSet (E.node i₀)).ncard = (π.borderSet (E.node i₀)).ncard := + (SL.traceVertex_injOn hcard i₀ k).ncard_image + have hf_eq : f '' π.borderSet (E.node i₀) = π.borderSet (E.node i₀) := + eq_of_subset_of_ncard_le hf_sub hf_card.ge hfin + obtain ⟨v', hv', hv'_eq⟩ : ∃ v' ∈ π.borderSet (E.node i₀), SL.traceVertex i₀ v' k = u := by + rw [← hf_eq] at hu + exact hu + have hu_tail' : u ∈ (SL.circWalk i₀ v' k).support.tail := by + rw [← hv'_eq] + exact end_mem_support_tail_of_support_tail_ne_nil _ (hne_nil v' hv') + have hvv' : v = v' := by + by_contra hne + exact SL.disjoint_support_tail_circWalk hcard i₀ hv hv' hne hu_tail hu_tail' + rw [hvv', hv'_eq] + · rintro rfl + exact end_mem_support_tail_of_support_tail_ne_nil _ (hne_nil v hv) + +/-- **Graph Minors XVII, (10.1)** (page 188): +"With notation as before, if $v_k \ne v$ then $L(v, n_0)$ is a path, and if $v_k = v$ then +$L(v, n_0)$ is a circuit; and for distinct $v, v' \in \beta(n_0)$, $L(v, n_0)$ and $L(v', n_0)$ +are edge-disjoint, and if some vertex $u$ belongs to both of them then both are paths and $u$ is +an initial vertex of one and a terminal vertex of the other." -/ +theorem theorem_10_1_proof + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p z : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (hT : π.IsCentral 𝒯) + (hwarp : π.warp ≤ p) (hred : π.IsRedundant 𝒯 θ z) + (hz : 3 ≤ z) (hθ : z + max 3 (2 * p + 2) < θ) + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i₀ : Fin k) : + (∀ v ∈ π.borderSet (E.node i₀), + {z | z ∈ (SL.circWalk i₀ v k).support} = SL.circumnavigationVertices i₀ v ∧ + (SL.circWalk i₀ v k).support.tail ≠ [] ∧ + (SL.circWalk i₀ v k).support.tail.Nodup ∧ + (SL.traceVertex i₀ v k ≠ v → (SL.circWalk i₀ v k).IsPath) ∧ + (SL.traceVertex i₀ v k = v → + {z | z ∈ (SL.circWalk i₀ v k).support.tail} = SL.circumnavigationVertices i₀ v)) ∧ + (∀ v ∈ π.borderSet (E.node i₀), ∀ v' ∈ π.borderSet (E.node i₀), v ≠ v' → + List.Disjoint (SL.circWalk i₀ v k).support.tail (SL.circWalk i₀ v' k).support.tail ∧ + ∀ u ∈ SL.circumnavigationVertices i₀ v ∩ SL.circumnavigationVertices i₀ v', + (SL.circWalk i₀ v k).IsPath ∧ (SL.circWalk i₀ v' k).IsPath ∧ + SL.traceVertex i₀ v k ≠ v ∧ SL.traceVertex i₀ v' k ≠ v' ∧ + ((u = v ∧ u = SL.traceVertex i₀ v' k) ∨ (u = v' ∧ u = SL.traceVertex i₀ v k))) := by + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have hne_nil : ∀ w ∈ π.borderSet (E.node i₀), (SL.circWalk i₀ w k).support.tail ≠ [] := + fun w hw => SL.support_tail_circWalk_ne_nil + h𝒯 hT hwarp hred hz hθ hcard i₀ hw + have hisPath_of_ne : ∀ v ∈ π.borderSet (E.node i₀), + SL.traceVertex i₀ v k ≠ v → (SL.circWalk i₀ v k).IsPath := by + intro v hv hne + rw [SimpleGraph.Walk.isPath_def, ← (SL.circWalk i₀ v k).cons_tail_support] + refine List.nodup_cons.mpr ⟨?_, SL.nodup_support_tail_circWalk hcard i₀ hv le_rfl⟩ + rw [SL.mem_support_tail_circWalk_inter_borderSet_iff hcard i₀ hne_nil hv hv] + exact hne.symm + refine ⟨fun v hv => ⟨SL.support_circWalk_eq_circumnavigationVertices i₀ v, + hne_nil v hv, SL.nodup_support_tail_circWalk hcard i₀ hv le_rfl, + hisPath_of_ne v hv, ?_⟩, ?_⟩ + · intro hEq + rw [← SL.support_circWalk_eq_circumnavigationVertices i₀ v] + ext z + simp only [mem_ofPred_eq] + have hcons := (SL.circWalk i₀ v k).cons_tail_support + conv_rhs => rw [← hcons, List.mem_cons] + refine ⟨fun hz => Or.inr hz, ?_⟩ + rintro (rfl | hz) + · rw [SL.mem_support_tail_circWalk_inter_borderSet_iff hcard i₀ hne_nil hv hv] + exact hEq.symm + · exact hz + · intro v hv v' hv' hne + have hdisj := SL.disjoint_support_tail_circWalk hcard i₀ hv hv' hne + refine ⟨hdisj, ?_⟩ + rintro u ⟨hu_v, hu_v'⟩ + rw [← SL.support_circWalk_eq_circumnavigationVertices i₀ v] at hu_v + rw [← SL.support_circWalk_eq_circumnavigationVertices i₀ v'] at hu_v' + change u ∈ (SL.circWalk i₀ v k).support at hu_v + change u ∈ (SL.circWalk i₀ v' k).support at hu_v' + rw [← (SL.circWalk i₀ v k).cons_tail_support, List.mem_cons] at hu_v + rw [← (SL.circWalk i₀ v' k).cons_tail_support, List.mem_cons] at hu_v' + rcases hu_v with rfl | hu_tail_v <;> rcases hu_v' with hEq | hu_tail_v' + · exact (hne hEq).elim + · have hv_eq : u = SL.traceVertex i₀ v' k := + (SL.mem_support_tail_circWalk_inter_borderSet_iff hcard i₀ hne_nil hv' hv).mp hu_tail_v' + have hne_v' : SL.traceVertex i₀ v' k ≠ v' := by + rw [← hv_eq]; exact hne + have hne_v : SL.traceVertex i₀ u k ≠ u := by + intro hEq + exact hne (SL.traceVertex_injOn hcard i₀ k hv hv' (hEq.trans hv_eq)) + exact ⟨hisPath_of_ne u hv hne_v, hisPath_of_ne v' hv' hne_v', + hne_v, hne_v', Or.inl ⟨rfl, hv_eq⟩⟩ + · subst hEq + have hv'_eq : u = SL.traceVertex i₀ v k := + (SL.mem_support_tail_circWalk_inter_borderSet_iff hcard i₀ hne_nil hv hv').mp hu_tail_v + have hne_v : SL.traceVertex i₀ v k ≠ v := by + rw [← hv'_eq]; exact hne.symm + have hne_v' : SL.traceVertex i₀ u k ≠ u := by + intro hEq + exact hne (SL.traceVertex_injOn hcard i₀ k hv hv' (hv'_eq.symm.trans hEq.symm)) + exact ⟨hisPath_of_ne v hv hne_v, hisPath_of_ne u hv' hne_v', + hne_v, hne_v', Or.inr ⟨rfl, hv'_eq⟩⟩ + · exact (hdisj hu_tail_v hu_tail_v').elim + +/-! ## 4. Non-Containment of $L(v, n_0)$ and $\gamma(N(\Gamma) \cap \Theta)$: (10.2) and (10.3) +(Pages 188–189) -/ + +/-- **Graph Minors XVII, (10.2)** (page 188): +"There is no $(A, B) \in \mathcal{T}$ of order $\le z$ with $V(L(v, n_0)) \subseteq V(A)$." + +Note on hypergraph edges: the paper's proof applies [1, Theorem (2.8)] to deduce $L(v, n_0) +\subseteq A$ +and hence that each $P_i$ is a path of $(A \cap \alpha(c_i))^*$. In a hypergraph $G$, an edge +$e \in E(\alpha(c_i))$ witnessing an adjacency of $P_i$ may also be incident with a third vertex +outside +$V(A)$, so $e$ may belong to $E(B)$ even when $B$ is minimal. Using `theorem_6_5_walk_subset` (which +is the vertex-support statement proved by the proof of (6.5) on page 176), the contradiction holds +directly from $V(P_i) \subseteq V(L(v, n_0)) \subseteq V(A)$ without assuming edges have size $\le +2$. -/ +theorem theorem_10_2_proof + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p z : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (hT : π.IsCentral 𝒯) + (hwarp : π.warp ≤ p) (hred : π.IsRedundant 𝒯 θ z) + (_hz : 2 * p + 3 ≤ z) (hθ : z + 2 * p + 2 < θ) + (hq : π.warpAt Θ = q) + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i₀ : Fin k) {v : α} (hv : v ∈ π.borderSet (E.node i₀)) + {A B : Hypergraph α β} (hAB : (A, B) ∈ 𝒯) (hord : separationOrder A B ≤ z) : + ¬ (SL.circumnavigationVertices i₀ v ⊆ A.vertexSet) := by + intro hsub + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have hk_pos : 0 < k := by have := E.two_le; omega + have hq_pos : 1 ≤ π.warpAt Θ := + theorem_5_1_proof π hT (hred.isZeroRedundant h𝒯) E.cuff_mem + have hp_pos : 1 ≤ p := + (hq_pos.trans (π.warpAt_le_warp E.cuff_mem)).trans hwarp + have hθ_max : z + max 3 (2 * p + 2) < θ := by omega + rcases theorem_6_5_walk_subset + h𝒯 π hT hwarp hred hθ_max hAB hord E.cuff_mem hq with + ⟨n, hn, _, hdisj⟩ | + ⟨c, hc, hcΘ, n₁, n₂, hne, htilde, _, _, _, _, hno_walk, _, _, _⟩ + · have hn_range : n ∈ Set.range E.node := by rwa [E.range_node] + rcases hn_range with ⟨j, rfl⟩ + obtain ⟨r, hr_lt, hr_eq⟩ := stepIdx_surjective E.two_le i₀ j + have hmem_bs : SL.traceVertex i₀ v r ∈ π.borderSet (E.node j) := by + rw [← hr_eq] + exact SL.traceVertex_mem_borderSet hcard i₀ hv r + have hmem_A : SL.traceVertex i₀ v r ∈ A.vertexSet := + hsub (SL.traceVertex_mem_circumnavigationVertices i₀ v hr_lt) + exact Set.disjoint_left.mp hdisj hmem_bs hmem_A + · have hc_range : c ∈ Set.range E.cell := by + rw [E.range_cell]; exact ⟨hc, hcΘ⟩ + rcases hc_range with ⟨j, rfl⟩ + obtain ⟨r, hr_lt, rfl⟩ := stepIdx_surjective E.two_le i₀ j + set idx := stepIdx E.two_le i₀ r + let u₀ := SL.traceVertex i₀ v r + let v₀ := SL.stepVertex idx u₀ + have hu₀_bs : u₀ ∈ π.borderSet (E.node idx) := + SL.traceVertex_mem_borderSet hcard i₀ hv r + have hv₀_bs : v₀ ∈ π.borderSet (E.node (cyclicSucc hk_pos idx)) := + (SL.step_spec_of_mem hcard idx hu₀_bs).choose_spec.2.2.2.2.2 + let W : (π.cellGraph (E.cell idx)).skeleton.Walk u₀ v₀ := SL.stepCellWalk idx u₀ + have hW_sub : {z | z ∈ W.support} ⊆ A.vertexSet := + (SL.support_stepCellWalk_subset_circumnavigationVertices i₀ v hr_lt).trans hsub + have htilde_j : tilde (E.cell idx) = {E.node idx, E.node (cyclicSucc hk_pos idx)} := + E.cell_tilde idx + have hn₁_mem : n₁ ∈ ({E.node idx, E.node (cyclicSucc hk_pos idx)} : Set π.S) := by + rw [← htilde_j, htilde]; exact mem_insert _ _ + have hn₂_mem : n₂ ∈ ({E.node idx, E.node (cyclicSucc hk_pos idx)} : Set π.S) := by + rw [← htilde_j, htilde]; exact mem_insert_of_mem _ (mem_singleton _) + rcases hn₁_mem with rfl | rfl <;> rcases hn₂_mem with rfl | rfl + · exact hne rfl + · exact hno_walk u₀ hu₀_bs v₀ hv₀_bs W hW_sub + · refine hno_walk v₀ hv₀_bs u₀ hu₀_bs W.reverse ?_ + intro z hz + change z ∈ W.reverse.support at hz + rw [SimpleGraph.Walk.support_reverse, List.mem_reverse] at hz + exact hW_sub hz + · exact hne rfl + +theorem CuffStandardLinkages.circumnavigationVertices_subset_cellsUnion + (hcard : ∀ r : Fin k, (π.borderSet (E.node r)).ncard = q) + (i₀ : Fin k) {v : α} (hv : v ∈ π.borderSet (E.node i₀)) : + SL.circumnavigationVertices i₀ v ⊆ + (π.cellsUnion {c ∈ π.Γ.C | (c ∩ Θ).Nonempty}).vertexSet := by + classical + have hΘ_bd : Θ ⊆ bd π.S := by + rcases E.cuff_mem with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + intro z hz + unfold CuffStandardLinkages.circumnavigationVertices at hz + rw [mem_iUnion₂] at hz + rcases hz with ⟨r, _, hzr⟩ + set idx : Fin k := stepIdx E.two_le i₀ r + have hc_mem : E.cell idx ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self idx + have hbd_idx : (E.cell idx ∩ bd π.S).Nonempty := + hc_mem.2.mono (inter_subset_inter_right _ hΘ_bd) + have hcur_bs : SL.traceVertex i₀ v r ∈ π.borderSet (E.node idx) := + SL.traceVertex_mem_borderSet hcard i₀ hv r + have hcur_c : SL.traceVertex i₀ v r ∈ (π.cellGraph (E.cell idx)).vertexSet := + π.p3_subset (E.cell idx) hc_mem.1 hbd_idx (E.node idx) + (E.cell_tilde idx ▸ mem_insert _ _) hcur_bs + refine mem_iUnion₂.mpr ⟨E.cell idx, ⟨hc_mem, hc_mem.1⟩, ?_⟩ + change z ∈ (if h : ∃ j : Fin q, (SL.L idx j).first = SL.traceVertex i₀ v r then + {z | z ∈ (SL.L idx (Classical.choose h)).walk.support} + else {SL.traceVertex i₀ v r}) at hzr + by_cases h : ∃ j : Fin q, (SL.L idx j).first = SL.traceVertex i₀ v r + · rw [dite_eq_left h] at hzr + have hfirst_c : (SL.L idx (Classical.choose h)).first ∈ + (π.cellGraph (E.cell idx)).vertexSet := by + rw [Classical.choose_spec h]; exact hcur_c + exact walk_support_subset_vertexSet hfirst_c (SL.L idx (Classical.choose h)).walk hzr + · rw [dite_eq_right h] at hzr + rw [mem_singleton_iff.mp hzr] + exact hcur_c + +end Circumnavigation + +/-- **Graph Minors XVII, (10.3)** (page 189): +"For each cuff $\Theta$, there is no $(A, B) \in \mathcal{T}$ of order $\le z$ with +$\gamma(N(\Gamma) \cap \Theta) \subseteq V(A)$." -/ +theorem theorem_10_3_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p z : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (hT : π.IsCentral 𝒯) (htrue : π.IsTrue 𝒯) + (hwarp : π.warp ≤ p) (hred : π.IsRedundant 𝒯 θ z) + (hz : 2 * p + 3 ≤ z) (hθ : z + 2 * p + 2 < θ) + {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) + {A B : Hypergraph α β} (hAB : (A, B) ∈ 𝒯) (hord : separationOrder A B ≤ z) : + ¬ (π.gammaImage (π.Γ.N ∩ Θ) ⊆ A.vertexSet) := by + intro hγ_sub + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have hΘ_arc : IsOArc Θ := (cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hq_pos : 1 ≤ π.warpAt Θ := + theorem_5_1_proof π hT (hred.isZeroRedundant h𝒯) hΘ + let I₁ : Set (Set π.S) := {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} + let I₂ : Set (Set π.S) := π.Γ.C \ I₁ + have hcov : I₁ ∪ I₂ = π.Γ.C := by + ext c + simp only [I₁, I₂, mem_union, mem_sdiff, mem_ofPred_eq] + tauto + have hdisj : Disjoint I₁ I₂ := disjoint_sdiff_self_right + let A₁ := π.cellsUnion I₁ + let A₂ := π.cellsUnion I₂ + have hsepA₁₂ : G.IsSeparation A₁ A₂ := π.isSeparation_cellsUnion hcov hdisj + have hA₁₂_sub_γ : (A₁ ∩ A₂).vertexSet ⊆ π.gammaImage (π.Γ.N ∩ Θ) := by + intro v hv + rw [(theorem_2_1_proof π hcov hdisj).2] at hv + rcases hv with hγ | hbs + · rw [mem_iUnion₂] at hγ + rcases hγ with ⟨c₁, hc₁, hγ⟩ + rw [mem_iUnion₂] at hγ + rcases hγ with ⟨c₂, _, hγ₁, _⟩ + have htilde₁ : tilde c₁ ⊆ π.Γ.N ∩ Θ := + (π.Γ.border_cell_subset_cuff hc₁.1 hΘ hc₁.2).2.2.2.1 + exact π.gammaImage_mono htilde₁ hγ₁ + · rw [mem_iUnion₂] at hbs + rcases hbs with ⟨n, ⟨c₁, hc₁, _, c₂, hc₂, hc₂_bd, hnc₁, hnc₂⟩, _⟩ + exfalso + have hnΘ : n ∈ Θ := ((π.Γ.border_cell_subset_cuff hc₁.1 hΘ hc₁.2).2.2.2.1 hnc₁).2 + rcases hc₂_bd with ⟨x, hxc₂, hxbd⟩ + let Θ' := connectedComponentIn (bd π.S) x + have hΘ' : Θ' ∈ cuffs π.S := ⟨x, hxbd, rfl⟩ + have hc₂Θ' : (c₂ ∩ Θ').Nonempty := ⟨x, hxc₂, mem_connectedComponentIn hxbd⟩ + have hnΘ' : n ∈ Θ' := ((π.Γ.border_cell_subset_cuff hc₂.1 hΘ' hc₂Θ').2.2.2.1 hnc₂).2 + rcases hΘ with ⟨x₀, _, rfl⟩ + have hΘ_eq : connectedComponentIn (bd π.S) x₀ = Θ' := + (connectedComponentIn_eq hnΘ).trans (connectedComponentIn_eq hnΘ').symm + exact hc₂.2 ⟨hc₂.1, hΘ_eq.symm ▸ hc₂Θ'⟩ + have hA₁₂_sub_A : (A₁ ∩ A₂).vertexSet ⊆ A.vertexSet := hA₁₂_sub_γ.trans hγ_sub + have hsepAB : G.IsSeparation A B := h𝒯.isSeparation hAB + let B₁ := B ∩ A₁ + let B₂ := B ∩ A₂ + have hB₁_le : B₁ ≤ G := inter_le hsepAB.right_le hsepA₁₂.left_le + have hB₂_le : B₂ ≤ G := inter_le hsepAB.right_le hsepA₁₂.right_le + have hB_union_V : B₁.vertexSet ∪ B₂.vertexSet = B.vertexSet := by + ext x + simp only [B₁, B₂, inter_vertexSet, mem_union, mem_inter_iff] + refine ⟨fun h => h.elim And.left And.left, fun hxB => ?_⟩ + have hxG : x ∈ A₁.vertexSet ∪ A₂.vertexSet := + hsepA₁₂.vertexSet_union.symm ▸ hsepAB.right_le.vertexSet_subset hxB + rcases hxG with hx₁ | hx₂ + · exact Or.inl ⟨hxB, hx₁⟩ + · exact Or.inr ⟨hxB, hx₂⟩ + have hB_union_E : B₁.edgeSet ∪ B₂.edgeSet = B.edgeSet := by + ext e + simp only [B₁, B₂, inter_edgeSet, mem_union, mem_inter_iff] + refine ⟨fun h => h.elim And.left And.left, fun heB => ?_⟩ + have heG : e ∈ A₁.edgeSet ∪ A₂.edgeSet := + hsepA₁₂.edgeSet_union.symm ▸ hsepAB.right_le.edgeSet_subset heB + rcases heG with he₁ | he₂ + · exact Or.inl ⟨heB, he₁⟩ + · exact Or.inr ⟨heB, he₂⟩ + have hB_inter_E : B₁.edgeSet ∩ B₂.edgeSet = ∅ := by + ext e + simp only [B₁, B₂, inter_edgeSet, mem_inter_iff, mem_empty_iff_false, iff_false] + rintro ⟨⟨_, he₁⟩, ⟨_, he₂⟩⟩ + exact hsepA₁₂.notMem_edgeSet_right he₁ he₂ + have hsep1 : G.IsSeparation (A ∪ B₁) B₂ := by + rw [isSeparation_iff_of_le (union_le hsepAB.left_le hB₁_le) hB₂_le] + refine ⟨?_, ?_, ?_⟩ + · rw [union_vertexSet, Set.union_assoc, hB_union_V, hsepAB.vertexSet_union] + · rw [union_edgeSet, Set.union_assoc, hB_union_E, hsepAB.edgeSet_union] + · ext e + simp only [union_edgeSet, mem_inter_iff, mem_union, mem_empty_iff_false, iff_false, not_and] + rintro (heA | heB₁) heB₂ + · exact hsepAB.notMem_edgeSet_right heA heB₂.1 + · exact Set.notMem_empty e (hB_inter_E ▸ ⟨heB₁, heB₂⟩) + have hsep2 : G.IsSeparation (A ∪ B₂) B₁ := by + rw [isSeparation_iff_of_le (union_le hsepAB.left_le hB₂_le) hB₁_le] + refine ⟨?_, ?_, ?_⟩ + · rw [union_vertexSet, Set.union_assoc, Set.union_comm B₂.vertexSet, hB_union_V, + hsepAB.vertexSet_union] + · rw [union_edgeSet, Set.union_assoc, Set.union_comm B₂.edgeSet, hB_union_E, + hsepAB.edgeSet_union] + · ext e + simp only [union_edgeSet, mem_inter_iff, mem_union, mem_empty_iff_false, iff_false, not_and] + rintro (heA | heB₂) heB₁ + · exact hsepAB.notMem_edgeSet_right heA heB₁.1 + · exact Set.notMem_empty e (hB_inter_E ▸ ⟨heB₁, heB₂⟩) + have hsub_inter1 : ((A ∪ B₁) ∩ B₂).vertexSet ⊆ (A ∩ B).vertexSet := by + rintro x ⟨hxA | ⟨hxB, hxA₁⟩, hxB, hxA₂⟩ + · exact ⟨hxA, hxB⟩ + · exact ⟨hA₁₂_sub_A ⟨hxA₁, hxA₂⟩, hxB⟩ + have hsub_inter2 : ((A ∪ B₂) ∩ B₁).vertexSet ⊆ (A ∩ B).vertexSet := by + rintro x ⟨hxA | ⟨hxB, hxA₂⟩, hxB, hxA₁⟩ + · exact ⟨hxA, hxB⟩ + · exact ⟨hA₁₂_sub_A ⟨hxA₁, hxA₂⟩, hxB⟩ + have hord1 : separationOrder (A ∪ B₁) B₂ ≤ z := + (ncard_le_ncard hsub_inter1 (A ∩ B).vertexSet_finite).trans hord + have hord2 : separationOrder (A ∪ B₂) B₁ ≤ z := + (ncard_le_ncard hsub_inter2 (A ∩ B).vertexSet_finite).trans hord + have hnot_both : ¬ ((B₂, A ∪ B₁) ∈ 𝒯 ∧ (B₁, A ∪ B₂) ∈ 𝒯) := by + rintro ⟨hm1, hm2⟩ + apply h𝒯.axiom2 hAB hm1 hm2 + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (union_le (union_le hsepAB.left_le hB₂_le) hB₁_le) le_rfl + · rw [union_vertexSet, union_vertexSet, Set.union_assoc, Set.union_comm B₂.vertexSet, + hB_union_V, hsepAB.vertexSet_union] + · rw [union_edgeSet, union_edgeSet, Set.union_assoc, Set.union_comm B₂.edgeSet, + hB_union_E, hsepAB.edgeSet_union] + have hm1_or_m2 : (A ∪ B₁, B₂) ∈ 𝒯 ∨ (A ∪ B₂, B₁) ∈ 𝒯 := by + rcases h𝒯.axiom1 hsep1 (by omega) with h1 | h1 + · exact Or.inl h1 + · rcases h𝒯.axiom1 hsep2 (by omega) with h2 | h2 + · exact Or.inr h2 + · exact (hnot_both ⟨h1, h2⟩).elim + rcases hm1_or_m2 with hm1 | hm2 + · obtain ⟨E⟩ := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + have hred_2p3 : π.IsRedundant 𝒯 θ (2 * p + 3) := hred.mono hz + obtain ⟨SL⟩ := exists_cuffStandardLinkages h𝒯 π htrue hred_2p3 hwarp + (by omega) E + have hcard : ∀ r : Fin (π.Γ.N ∩ Θ).ncard, (π.borderSet (E.node r)).ncard = π.warpAt Θ := + fun r => theorem_9_4_proof h𝒯 π htrue hred_2p3 hwarp (by omega) hΘ (E.node_mem r) + let i₀ : Fin (π.Γ.N ∩ Θ).ncard := ⟨0, by linarith [E.two_le]⟩ + have hn₀_bd : E.node i₀ ∈ π.Γ.N ∩ bd π.S := ⟨(E.node_mem i₀).1, hΘ_bd (E.node_mem i₀).2⟩ + have hne_bs : (π.borderSet (E.node i₀)).Nonempty := + (ncard_pos (π.borderSet_finite hn₀_bd)).mp (by rw [hcard i₀]; exact hq_pos) + rcases hne_bs with ⟨v, hv⟩ + have hsub_A₁ : SL.circumnavigationVertices i₀ v ⊆ (A ∪ B₁).vertexSet := by + refine (SL.circumnavigationVertices_subset_cellsUnion hcard i₀ hv).trans ?_ + intro x hxA₁ + have hxG : x ∈ A.vertexSet ∪ B.vertexSet := + hsepAB.vertexSet_union.symm ▸ hsepA₁₂.left_le.vertexSet_subset hxA₁ + rcases hxG with hxA | hxB + · exact Or.inl hxA + · exact Or.inr ⟨hxB, hxA₁⟩ + exact theorem_10_2_proof SL h𝒯 hT hwarp hred hz hθ rfl hcard i₀ hv hm1 hord1 hsub_A₁ + · have hsmall : IsSmallWrt 𝒯 (A ∪ B₂) := ⟨B₁, hm2⟩ + have hatt_sub : attachments G (A ∪ B₂) ⊆ (A ∩ B).vertexSet := + (attachments_subset_inter_of_isSeparation hsep2).trans hsub_inter2 + have hatt_lt : (attachments G (A ∪ B₂)).ncard < θ - 2 * p := by + have hle : (attachments G (A ∪ B₂)).ncard ≤ z := + (ncard_le_ncard hatt_sub (A ∩ B).vertexSet_finite).trans hord + omega + refine theorem_4_3_proof h𝒯 π hT hwarp ⟨A ∪ B₂, hsmall, hatt_lt, ?_⟩ + intro n hn_dom + by_cases hnΘ : n ∈ Θ + · have hxA : π.nodeVertex n ∈ A.vertexSet := + hγ_sub ⟨n, ⟨⟨π.domγ_subset hn_dom, hnΘ⟩, hn_dom⟩, rfl⟩ + exact Or.inl hxA + · have hred_2p3 : π.IsRedundant 𝒯 θ (2 * p + 3) := hred.mono hz + obtain ⟨c, hc, hnc⟩ := + (theorem_8_2_proof + h𝒯 π htrue hred_2p3 hwarp (by omega)).2.2 n (π.domγ_subset hn_dom) + have hvc : π.nodeVertex n ∈ (π.cellGraph c).vertexSet := π.p2 c hc n ⟨hnc, hn_dom⟩ + have hc_not_I₁ : c ∉ I₁ := by + rintro ⟨_, hcΘ⟩ + exact hnΘ ((π.Γ.border_cell_subset_cuff hc hΘ hcΘ).2.2.2.1 hnc).2 + have hc_I₂ : c ∈ I₂ := ⟨hc, hc_not_I₁⟩ + have hxA₂ : π.nodeVertex n ∈ A₂.vertexSet := + mem_iUnion₂.mpr ⟨c, ⟨hc_I₂, hc⟩, hvc⟩ + have hxG : π.nodeVertex n ∈ A.vertexSet ∪ B.vertexSet := + hsepAB.vertexSet_union.symm ▸ π.nodeVertex_mem n hn_dom + rcases hxG with hxA | hxB + · exact Or.inl hxA + · exact Or.inr ⟨hxB, hxA₂⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section11.lean b/LeanPool/GraphMinor/GM17/Section11.lean new file mode 100644 index 0000000000..36efb1cbbc --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section11.lean @@ -0,0 +1,401 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section10 +import LeanPool.GraphMinor.GM17.PasteCuff +import LeanPool.GraphMinor.GM17.ArcDisc +import LeanPool.GraphMinor.GM17.MarkCross +import LeanPool.GraphMinor.GM17.ReplaceDisc +import LeanPool.GraphMinor.GM17.RegionDisc +import LeanPool.GraphMinor.GM17.CutArcPaint +import LeanPool.GraphMinor.GM17.PushNode + +/-! +# Graph Minors XVII, Section 11: Surface Separations in a True Portrayal + +This file formalizes Section 11 (pages 189–196) of N. Robertson and P. D. Seymour, +*Graph Minors. XVII. Taming a vortex*, J. Combin. Theory Ser. B 77 (1999), 162–210: +- **Graph Minors XVII, (11.1)** (`theorem_11_1`, pages 189–191): for any partition $I, J$ of + $C(\Gamma)$ with $\gamma(I), \gamma(J) \ne \gamma(N(\Gamma))$ and + $|\gamma(I) \cap \gamma(J)| \le 3$, $|\gamma(I) \cap \gamma(J)| = 3$ and there is a disc + $\Delta \subseteq \Sigma$ whose cells are $I$ or $J$, with $\alpha(\Delta)$ small and bounded by + a $\Gamma$-normal $O$-arc or a $\Gamma$-normal $I$-arc and $\operatorname{bd}(\Sigma)$. +- **Graph Minors XVII, (11.2)** (`theorem_11_2`, pages 191–192): characterization of separations + $(A, B) \in \mathcal{T}$ of order $< \operatorname{ord}(\mathcal{T}) - 4p - 3$ with + $\alpha(c_0) \subseteq A$, $\gamma(I) \subseteq V(A)$, $\gamma(J) \subseteq V(B)$, and + $|\{n \in N(\Gamma) : \gamma(n) \in V(A \cap B)\}| \le |\tilde{c}_0|$. +- **Graph Minors XVII, (11.3)** (`theorem_11_3`, pages 192–193): for a $\Gamma$-normal $I$-arc $F$ + with $F \cap N(\Gamma) = \{n_1, n_2, n_3\}$ and ends $n_1, n_2$, if $\Delta$ contains a cell $c_0$ + with $|\tilde{c}_0| = 3$, either $\tilde{c}_0 = \Delta \cap N(\Gamma)$ or no separation $(A_1, + A_2)$ + of $\alpha(\Delta)$ has $V(A_1 \cap A_2) = \{\gamma(n_1), \gamma(n_2)\}$, $\gamma(n_3) \in + V(A_1)$, + and $\beta(n_1) \cup \beta(n_2) \subseteq V(A_2)$. +- **Graph Minors XVII, (11.4)** (`theorem_11_4`, pages 193–194): for any separation $(A, B)$ of $G$ + and $d \in D(A, B)$, $V(A \cap B) \cap (V(\alpha(d)) \setminus (S \cup V(\alpha(-d)))) \ne + \emptyset$. +- **Graph Minors XVII, (11.5)** (`theorem_11_5`, page 194): + $|D(A, B)| \le |V(A \cap B) \setminus (S \cup \gamma(N(\Gamma)))|$. +- **Graph Minors XVII, (11.6)** (`theorem_11_6`, pages 194–195): + $|V(A \cap B) \setminus S| \le |\tilde{c}_0|$, and equality implies + $|V(A \cap B) \cap S| = |V(\alpha(c_0) \cap \alpha(-c_0)) \cap S|$. +- **Graph Minors XVII, (11.7)** (`theorem_11_7`, pages 195–196): + $|V(A \cap B)| = |V(\alpha(c_0) \cap \alpha(-c_0))|$. +The portrayal deductions that use painting results are proved in `Section11Proved`. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Function Topology Metric +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +/-! ## 1. Basic Lemmas on `tildeOfCells` and `gammaOfCells` -/ + +theorem Painting.tildeOfCells_subset_N {S : Type} [TopologicalSpace S] + (Γ : Painting S) {I : Set (Set S)} (hI : I ⊆ Γ.C) : + Γ.tildeOfCells I ⊆ Γ.N := by + intro n hn + unfold Painting.tildeOfCells at hn + rw [mem_iUnion₂] at hn + rcases hn with ⟨c, hcI, hnc⟩ + exact Γ.tilde_subset_N (hI hcI) hnc + +theorem Painting.tildeOfCells_finite {S : Type} [TopologicalSpace S] + (Γ : Painting S) {I : Set (Set S)} (hI : I ⊆ Γ.C) : + (Γ.tildeOfCells I).Finite := + Γ.finite_N.subset (Γ.tildeOfCells_subset_N hI) + +theorem Painting.tildeOfCells_mono {S : Type} [TopologicalSpace S] + (Γ : Painting S) {I₁ I₂ : Set (Set S)} (h : I₁ ⊆ I₂) : + Γ.tildeOfCells I₁ ⊆ Γ.tildeOfCells I₂ := + biUnion_mono h fun _ _ => Subset.rfl + +theorem Painting.tildeOfCells_union {S : Type} [TopologicalSpace S] + (Γ : Painting S) (I J : Set (Set S)) : + Γ.tildeOfCells (I ∪ J) = Γ.tildeOfCells I ∪ Γ.tildeOfCells J := by + unfold Painting.tildeOfCells + exact biUnion_union _ _ _ + +theorem Painting.tildeOfCells_eq_N {S : Type} [TopologicalSpace S] + (Γ : Painting S) (hnode : ∀ n ∈ Γ.N, ∃ c ∈ Γ.C, n ∈ tilde c) : + Γ.tildeOfCells Γ.C = Γ.N := by + refine Subset.antisymm (Γ.tildeOfCells_subset_N Subset.rfl) fun n hn => ?_ + obtain ⟨c, hc, hnc⟩ := hnode n hn + exact mem_biUnion hc hnc + +theorem Portrayal.gammaImage_eq_image_of_subset_N {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (hdom : π.domγ = π.Γ.N) {X : Set π.S} (hX : X ⊆ π.Γ.N) : + π.gammaImage X = π.nodeVertex '' X := by + unfold Portrayal.gammaImage + rw [hdom, inter_eq_self_of_subset_left hX] + +theorem Portrayal.gammaOfCells_eq_gammaImage_tildeOfCells {α : Type u} {β : Type v} + {G : Hypergraph α β} (π : Portrayal G) (I : Set (Set π.S)) : + π.gammaOfCells I = π.gammaImage (π.Γ.tildeOfCells I) := by + ext v + simp only [Portrayal.gammaOfCells, Portrayal.gammaImage, Painting.tildeOfCells, + mem_iUnion, mem_image, mem_inter_iff] + constructor + · rintro ⟨c, hcI, n, ⟨hnc, hndom⟩, rfl⟩ + exact ⟨n, ⟨⟨c, hcI, hnc⟩, hndom⟩, rfl⟩ + · rintro ⟨n, ⟨⟨c, hcI, hnc⟩, hndom⟩, rfl⟩ + exact ⟨c, hcI, n, ⟨hnc, hndom⟩, rfl⟩ + +theorem Portrayal.gammaOfCells_eq_image_tildeOfCells {α : Type u} {β : Type v} + {G : Hypergraph α β} (π : Portrayal G) (hdom : π.domγ = π.Γ.N) + {I : Set (Set π.S)} (hI : I ⊆ π.Γ.C) : + π.gammaOfCells I = π.nodeVertex '' (π.Γ.tildeOfCells I) := by + rw [π.gammaOfCells_eq_gammaImage_tildeOfCells, + π.gammaImage_eq_image_of_subset_N hdom (π.Γ.tildeOfCells_subset_N hI)] + +theorem Portrayal.gammaOfCells_inter_eq_image {α : Type u} {β : Type v} + {G : Hypergraph α β} (π : Portrayal G) (hdom : π.domγ = π.Γ.N) + {I J : Set (Set π.S)} (hI : I ⊆ π.Γ.C) (hJ : J ⊆ π.Γ.C) : + π.gammaOfCells I ∩ π.gammaOfCells J = + π.nodeVertex '' (π.Γ.tildeOfCells I ∩ π.Γ.tildeOfCells J) := by + rw [π.gammaOfCells_eq_image_tildeOfCells hdom hI, + π.gammaOfCells_eq_image_tildeOfCells hdom hJ] + have hinj : InjOn π.nodeVertex π.Γ.N := hdom ▸ π.nodeVertex_injOn + exact (hinj.image_inter (π.Γ.tildeOfCells_subset_N hI) (π.Γ.tildeOfCells_subset_N hJ)).symm + +theorem Portrayal.ncard_gammaOfCells_inter {α : Type u} {β : Type v} + {G : Hypergraph α β} (π : Portrayal G) (hdom : π.domγ = π.Γ.N) + {I J : Set (Set π.S)} (hI : I ⊆ π.Γ.C) (hJ : J ⊆ π.Γ.C) : + (π.gammaOfCells I ∩ π.gammaOfCells J).ncard = + (π.Γ.tildeOfCells I ∩ π.Γ.tildeOfCells J).ncard := by + rw [π.gammaOfCells_inter_eq_image hdom hI hJ] + have hinj : InjOn π.nodeVertex (π.Γ.tildeOfCells I ∩ π.Γ.tildeOfCells J) := + (hdom ▸ π.nodeVertex_injOn).mono (inter_subset_left.trans (π.Γ.tildeOfCells_subset_N hI)) + exact hinj.ncard_image + +/-! ## 2. Cell Partitions and Surface Separations: (11.1) and (11.2) (Pages 189–192) -/ + +/-- Pure surface-and-painting topological property for **Graph Minors XVII, (11.1)** +(pages 189–191, Claims (1)–(4)): +Given a painting $\Gamma$ in a connected surface $S$ satisfying the region and 2-node arc +properties of (8.1)–(8.5), for any partition $I, J$ of $C(\Gamma)$ with +$\tilde{I}, \tilde{J} \ne N(\Gamma)$ and $|\tilde{I} \cap \tilde{J}| \le 3$, we have +$|\tilde{I} \cap \tilde{J}| = 3$ and there is either: +(1) a $\Gamma$-normal $O$-arc $F \subseteq S$ with $N(\Gamma) \cap F = \tilde{I} \cap \tilde{J}$ + such that for every closed disc $\Delta \subseteq S$ with $\operatorname{bd}(\Delta) = F$, + $\{c \in C(\Gamma) : c \subseteq \Delta\}$ is one of $I, J$; or +(2) a $\Gamma$-normal $I$-arc $F \subseteq S$ with $N(\Gamma) \cap F = \tilde{I} \cap \tilde{J}$ + such that for every closed disc $\Delta \subseteq S$ with + $F \subseteq \operatorname{bd}(\Delta) \subseteq F \cup \operatorname{bd}(S)$, + $\{c \in C(\Gamma) : c \subseteq \Delta\}$ is one of $I, J$. -/ +def CellPartitionPaintingStatement : Prop := + ∀ (S : Type) [TopologicalSpace S] [ConnectedSpace S], + IsSurface S → ∀ (Γ : Painting S), + (∀ R ∈ Γ.regions, IsOpenDisc R ∧ IsOArc (closure R \ R)) → + (∀ c ∈ Γ.C, 2 ≤ (tilde c).ncard) → + (∀ n ∈ Γ.N, ∃ c ∈ Γ.C, n ∈ tilde c) → + (∀ F : Set S, IsLine F → Γ.IsNormal F → F ∩ bd S = lineEnds F → + (F ∩ Γ.N).ncard = 2 → + ∃ Δ : Set S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd S ∧ + Δ ∩ Γ.N ⊆ F ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard = 1) → + (∀ F : Set S, IsOArc F → Γ.IsNormal F → (F ∩ Γ.N).ncard = 2 → + ∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F ∧ + Δ ∩ Γ.N ⊆ F ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard ≤ 1) → + ∀ I J : Set (Set S), + I ∪ J = Γ.C → Disjoint I J → + Γ.tildeOfCells I ≠ Γ.N → Γ.tildeOfCells J ≠ Γ.N → + (Γ.tildeOfCells I ∩ Γ.tildeOfCells J).ncard ≤ 3 → + (Γ.tildeOfCells I ∩ Γ.tildeOfCells J).ncard = 3 ∧ + ((∃ F : Set S, IsOArc F ∧ Γ.IsNormal F ∧ + Γ.N ∩ F = Γ.tildeOfCells I ∩ Γ.tildeOfCells J ∧ + ∀ Δ : Set S, IsClosedDisc Δ → discBd Δ = F → + {c ∈ Γ.C | c ⊆ Δ} = I ∨ {c ∈ Γ.C | c ⊆ Δ} = J) ∨ + (∃ F : Set S, ∃ n₁ n₂ : S, IsLineWithEnds F n₁ n₂ ∧ Γ.IsNormal F ∧ + F ∩ bd S = {n₁, n₂} ∧ + Γ.N ∩ F = Γ.tildeOfCells I ∩ Γ.tildeOfCells J ∧ + ∀ Δ : Set S, IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd S → + {c ∈ Γ.C | c ⊆ Δ} = I ∨ {c ∈ Γ.C | c ⊆ Δ} = J)) + +/-- Pure surface-and-painting topological property for **Graph Minors XVII, (11.3)** +(page 193): +Given a painting $\Gamma$ on a surface $S$, a $\Gamma$-normal $I$-arc $F$ with ends +$n_1, n_2 \in \operatorname{bd}(S)$ and $F \cap \Gamma.N = \{n_1, n_2, n_3\}$ of cardinality $3$, +and a closed disc $\Delta \subseteq S$ with $F \subseteq \operatorname{bd}(\Delta) \subseteq F \cup +\operatorname{bd}(S)$, +replacing $\Delta$ by two discs $\Delta_1, \Delta_2 \subseteq \Delta$ gives a painting +$\Gamma' = ((U(\Gamma) \setminus \Delta) \cup \Delta_1 \cup \Delta_2, (N(\Gamma) \setminus \Delta) +\cup \{n_1, n_2, n_3\})$ +on $S$ with an internal cell $c_1 = \Delta_1 \setminus \{n_1, n_2, n_3\}$ ($\tilde{c}_1 = \{n_1, +n_2, n_3\}$), +a border cell $c_2 = \Delta_2 \setminus \{n_1, n_2\}$ ($\tilde{c}_2 = \{n_1, n_2\}$), and +$C(\Gamma') = \{c_1, c_2\} \cup \{c \in C(\Gamma) \mid c \subseteq S \setminus \Delta\}$. -/ +def ThreeNodeIArcReplaceDiscPaintingStatement : Prop := + ∀ (S : Type) [TopologicalSpace S], IsSurface S → + ∀ (Γ : Painting S) (n₁ n₂ n₃ : S) (F Δ : Set S), + Γ.IsNormal F → IsLineWithEnds F n₁ n₂ → + F ∩ bd S = {n₁, n₂} → F ∩ Γ.N = {n₁, n₂, n₃} → (F ∩ Γ.N).ncard = 3 → + IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd S → + ∃ (Γ' : Painting S) (Θ c₁ c₂ : Set S), + Γ'.N = (Γ.N \ Δ) ∪ {n₁, n₂, n₃} ∧ + Γ'.N ⊆ Γ.N ∧ + Θ ∈ cuffs S ∧ + n₁ ∈ Γ.N ∩ Θ ∧ n₂ ∈ Γ.N ∩ Θ ∧ + discBd Δ ⊆ F ∪ Θ ∧ + (∀ c ∈ Γ.C, c ⊆ Δ ∨ c ⊆ Δᶜ) ∧ + (∀ c ∈ Γ.C, c ⊆ Δᶜ → tilde c ⊆ Γ'.N) ∧ + c₁ ∈ Γ'.C ∧ ¬ (c₁ ∩ bd S).Nonempty ∧ tilde c₁ = {n₁, n₂, n₃} ∧ + c₂ ∈ Γ'.C ∧ (c₂ ∩ Θ).Nonempty ∧ tilde c₂ = {n₁, n₂} ∧ + c₁ ≠ c₂ ∧ + c₁ ∉ {c ∈ Γ.C | c ⊆ Δᶜ} ∧ + c₂ ∉ {c ∈ Γ.C | c ⊆ Δᶜ} ∧ + Γ'.C = insert c₁ (insert c₂ {c ∈ Γ.C | c ⊆ Δᶜ}) + +/-- A choice of cuff enumerations and standard linkages across all cuffs $\Theta \in +\text{cuffs}(\Sigma)$ +of a portrayal $\pi$. Its vertex union `sys.S` formalizes $S$, "the union, over all border cells +$c$, +of the vertex set of the standard linkage in $\alpha(c)$" +(Graph Minors XVII, Section 11, page 193). -/ +structure Portrayal.SystemOfStandardLinkages {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) where + /-- Cyclic enumeration of each cuff $\Theta$. -/ + E : ∀ Θ ∈ cuffs π.S, π.Γ.CuffEnumeration Θ (π.Γ.N ∩ Θ).ncard + /-- Standard linkages around each cuff $\Theta$. -/ + SL : ∀ Θ (hΘ : Θ ∈ cuffs π.S), + CuffStandardLinkages π Θ (π.Γ.N ∩ Θ).ncard (π.warpAt Θ) (E Θ hΘ) + +namespace Portrayal.SystemOfStandardLinkages + +variable {α : Type u} {β : Type v} {G : Hypergraph α β} {π : Portrayal G} + +/-- The vertex set of the standard linkage in the $i$-th border cell on cuff $\Theta$. -/ +def cellSet (sys : π.SystemOfStandardLinkages) (Θ : Set π.S) (hΘ : Θ ∈ cuffs π.S) + (i : Fin (π.Γ.N ∩ Θ).ncard) : Set α := + ⋃ j : Fin (π.warpAt Θ), {z | z ∈ ((sys.SL Θ hΘ).L i j).walk.support} + +/-- The union of the vertex sets of the standard linkages over all border cells on cuff $\Theta$. -/ +def cuffSet (sys : π.SystemOfStandardLinkages) (Θ : Set π.S) (hΘ : Θ ∈ cuffs π.S) : Set α := + ⋃ i : Fin (π.Γ.N ∩ Θ).ncard, sys.cellSet Θ hΘ i + +/-- The union $S$, over all border cells $c$, of the vertex set of the standard linkage in +$\alpha(c)$ +(Graph Minors XVII, Section 11, page 193). -/ +def S (sys : π.SystemOfStandardLinkages) : Set α := + ⋃ (Θ : Set π.S) (hΘ : Θ ∈ cuffs π.S), sys.cuffSet Θ hΘ + +theorem cellSet_subset_S (sys : π.SystemOfStandardLinkages) {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) + (i : Fin (π.Γ.N ∩ Θ).ncard) : + sys.cellSet Θ hΘ i ⊆ sys.S := + fun _ hz => mem_iUnion₂.mpr ⟨Θ, hΘ, mem_iUnion.mpr ⟨i, hz⟩⟩ + +theorem cuffSet_subset_S (sys : π.SystemOfStandardLinkages) {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) : + sys.cuffSet Θ hΘ ⊆ sys.S := + fun _ hz => mem_iUnion₂.mpr ⟨Θ, hΘ, hz⟩ + +end Portrayal.SystemOfStandardLinkages + +/-- For any separation $(A, B)$ of $G$, if $x, y$ are adjacent in $G^*$ with $x \notin V(A)$ and +$y \in V(A)$, then $y \in V(A \cap B)$ (and symmetrically if $x \in V(A)$ and $y \notin V(A)$, then +$x \in V(A \cap B)$). -/ +theorem mem_inter_of_adj_of_isSeparation {α : Type u} {β : Type v} + {G A B : Hypergraph α β} (hsep : G.IsSeparation A B) {x y : α} + (hadj : G.skeleton.Adj x y) (hx : x ∈ A.vertexSet) (hy : y ∉ A.vertexSet) : + x ∈ (A ∩ B).vertexSet := by + refine ⟨hx, ?_⟩ + rcases hadj with ⟨_, e, hincx, hincy⟩ + have heG : e ∈ G.edgeSet := G.edge_mem_of_inc hincx + rw [← hsep.edgeSet_union] at heG + rcases heG with heA | heB + · have hyA : y ∈ A.vertexSet := + A.vertex_mem_of_inc ((inc_iff_of_le hsep.left_le heA).mpr hincy) + exact (hy hyA).elim + · exact B.vertex_mem_of_inc ((inc_iff_of_le hsep.right_le heB).mpr hincx) + +/-- If $W$ is a walk in $G^*$ from $u_1 \notin V(A)$ to $u_2 \in V(A) \setminus V(B)$ where $(A, B)$ +is a separation of $G$, then some internal vertex $v \in W.\text{support} \setminus \{u_1, u_2\}$ +belongs to $V(A \cap B)$. -/ +theorem exists_internal_mem_inter_of_walk_of_isSeparation {α : Type u} {β : Type v} + {G A B : Hypergraph α β} (hsep : G.IsSeparation A B) + {u₁ u₂ : α} (W : G.skeleton.Walk u₁ u₂) + (hu₁ : u₁ ∉ A.vertexSet) (hu₂A : u₂ ∈ A.vertexSet) (hu₂B : u₂ ∉ B.vertexSet) : + ∃ v ∈ W.support, v ≠ u₁ ∧ v ≠ u₂ ∧ v ∈ (A ∩ B).vertexSet := by + have hex : ∃ v ∈ W.support, v ∈ (A ∩ B).vertexSet := by + induction W with + | nil => exact (hu₁ hu₂A).elim + | @cons x y z hadj W' ih => + by_cases hyA : y ∈ A.vertexSet + · exact ⟨y, List.mem_cons_of_mem x W'.start_mem_support, + mem_inter_of_adj_of_isSeparation hsep hadj.symm hyA hu₁⟩ + · obtain ⟨v, hv_sup, hv_inter⟩ := ih hyA hu₂A hu₂B + exact ⟨v, List.mem_cons_of_mem x hv_sup, hv_inter⟩ + obtain ⟨v, hv_sup, hv_inter⟩ := hex + refine ⟨v, hv_sup, ?_, ?_, hv_inter⟩ + · rintro rfl; exact hu₁ hv_inter.1 + · rintro rfl; exact hu₂B hv_inter.2 + +/-- If $W$ is a walk in $G^*$ from $y \notin V(A)$ to $v \in V(A)$ where $(A, B)$ is a separation +of $G$, then some vertex $b \in W.\text{support}.\text{tail}$ belongs to $V(A \cap B)$, and +$v \in W.\text{support}.\text{tail}$. -/ +theorem exists_tail_mem_inter_of_walk_of_notMem {α : Type u} {β : Type v} + {G A B : Hypergraph α β} (hsep : G.IsSeparation A B) + {y v : α} (W : G.skeleton.Walk y v) + (hy : y ∉ A.vertexSet) (hv : v ∈ A.vertexSet) : + (∃ b ∈ W.support.tail, b ∈ (A ∩ B).vertexSet) ∧ v ∈ W.support.tail := by + have hne_nil : W.support.tail ≠ [] := by + intro hnil + exact hy (start_eq_end_of_support_tail_eq_nil W hnil ▸ hv) + refine ⟨?_, end_mem_support_tail_of_support_tail_ne_nil W hne_nil⟩ + induction W with + | nil => exact (hy hv).elim + | @cons x y' z hadj W' ih => + rw [SimpleGraph.Walk.support_cons, List.tail_cons, ← W'.cons_tail_support] + by_cases hy' : y' ∈ A.vertexSet + · exact ⟨y', List.mem_cons_self, + mem_inter_of_adj_of_isSeparation hsep hadj.symm hy' hy⟩ + · obtain ⟨b, hb_tail, hb_AB⟩ := ih hy' hv + (fun hnil => hy' (start_eq_end_of_support_tail_eq_nil W' hnil ▸ hv)) + exact ⟨b, List.mem_cons_of_mem y' hb_tail, hb_AB⟩ + +/-- If $W$ is a walk in $G^*$ from $u \in V(A)$ to $v \in V(A)$ where $(A, B)$ is a separation of +$G$, and $W.\text{support}.\text{tail}$ contains a vertex outside $V(A)$, then +$W.\text{support}.\text{tail} = L_1 \mathbin{+\!+} m :: L_2$ where every vertex of $L_1$ is in +$V(A)$, $m \notin V(A)$, there is a vertex $a \in V(A \cap B)$ with $(L_1 = [] \land a = u) \lor +a \in L_1$, and there is a vertex $b \in V(A \cap B)$ with $b \in L_2$ and $v \in L_2$. -/ +theorem walk_first_last_out_of_isSeparation {α : Type u} {β : Type v} + {G A B : Hypergraph α β} (hsep : G.IsSeparation A B) + {u v : α} (W : G.skeleton.Walk u v) + (hu : u ∈ A.vertexSet) (hv : v ∈ A.vertexSet) + (hex : ∃ z ∈ W.support.tail, z ∉ A.vertexSet) : + ∃ (L₁ L₂ : List α) (m a b : α), + W.support.tail = L₁ ++ m :: L₂ ∧ + (∀ x ∈ L₁, x ∈ A.vertexSet) ∧ + m ∉ A.vertexSet ∧ + a ∈ (A ∩ B).vertexSet ∧ ((L₁ = [] ∧ a = u) ∨ a ∈ L₁) ∧ + b ∈ (A ∩ B).vertexSet ∧ b ∈ L₂ ∧ v ∈ L₂ := by + induction W with + | nil => + rcases hex with ⟨z, hz, _⟩ + exact (List.not_mem_nil hz).elim + | @cons x y z hadj W' ih => + rw [SimpleGraph.Walk.support_cons, List.tail_cons, ← W'.cons_tail_support] at hex ⊢ + by_cases hy : y ∈ A.vertexSet + · have hex' : ∃ w ∈ W'.support.tail, w ∉ A.vertexSet := by + rcases hex with ⟨w, hw, hw_notA⟩ + rcases List.mem_cons.mp hw with rfl | hw_tail + · exact (hw_notA hy).elim + · exact ⟨w, hw_tail, hw_notA⟩ + obtain ⟨L₁', L₂, m, a, b, hEq, hL₁', hm, ha_AB, ha_mem, hb_AB, hb_L₂, hv_L₂⟩ := + ih hy hv hex' + refine ⟨y :: L₁', L₂, m, a, b, ?_, ?_, hm, ha_AB, ?_, hb_AB, hb_L₂, hv_L₂⟩ + · rw [List.cons_append, hEq] + · intro w hw + rcases List.mem_cons.mp hw with rfl | hw' + · exact hy + · exact hL₁' w hw' + · refine Or.inr ?_ + rcases ha_mem with ⟨_, rfl⟩ | ha_L₁' + · exact List.mem_cons_self + · exact List.mem_cons_of_mem y ha_L₁' + · obtain ⟨⟨b, hb_tail, hb_AB⟩, hv_tail⟩ := + exists_tail_mem_inter_of_walk_of_notMem hsep W' hy hv + exact ⟨[], W'.support.tail, y, x, b, rfl, + fun _ h => (List.not_mem_nil h).elim, hy, + mem_inter_of_adj_of_isSeparation hsep hadj hu hy, + Or.inl ⟨rfl, rfl⟩, hb_AB, hb_tail, hv_tail⟩ + +/-- The tail of the first step walk `(sys.SL Θ hΘ).stepWalk i₀ u` is a prefix of the tail of +`(sys.SL Θ hΘ).circWalk i₀ u k`. -/ +theorem Portrayal.SystemOfStandardLinkages.exists_support_tail_circWalk_eq_append + {α : Type u} {β : Type v} {G : Hypergraph α β} + {π : Portrayal G} (sys : π.SystemOfStandardLinkages) + {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (i₀ : Fin (π.Γ.N ∩ Θ).ncard) (u : α) : + ∃ rest : List α, + ((sys.SL Θ hΘ).circWalk i₀ u (π.Γ.N ∩ Θ).ncard).support.tail = + ((sys.SL Θ hΘ).stepWalk i₀ u).support.tail ++ rest := by + have hind : ∀ m : ℕ, 1 ≤ m → + ∃ rest : List α, + ((sys.SL Θ hΘ).circWalk i₀ u m).support.tail = + ((sys.SL Θ hΘ).stepWalk i₀ u).support.tail ++ rest := by + intro m hm + induction m with + | zero => omega + | succ m ih => + rcases m with _ | m + · refine ⟨[], ?_⟩ + rw [CuffStandardLinkages.support_tail_circWalk_succ, List.append_nil] + change [] ++ ((sys.SL Θ hΘ).stepWalk (stepIdx (sys.E Θ hΘ).two_le i₀ 0) u).support.tail = _ + rw [List.nil_append, stepIdx_zero] + · obtain ⟨rest, hrest⟩ := ih (by omega) + rw [CuffStandardLinkages.support_tail_circWalk_succ, hrest, List.append_assoc] + exact ⟨_, rfl⟩ + exact hind (π.Γ.N ∩ Θ).ncard (by have := (sys.E Θ hΘ).two_le; omega) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section11Proved.lean b/LeanPool/GraphMinor/GM17/Section11Proved.lean new file mode 100644 index 0000000000..e311b88e7a --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section11Proved.lean @@ -0,0 +1,3063 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section11 +import LeanPool.GraphMinor.GM17.Section5Proved +import LeanPool.GraphMinor.GM17.Section6Proved +import LeanPool.GraphMinor.GM17.Section7Proved +import LeanPool.GraphMinor.GM17.Section8Proved +import LeanPool.GraphMinor.GM17.Section9Proved +import LeanPool.GraphMinor.GM17.Section9bProved +import LeanPool.GraphMinor.GM17.Section10Proved + +public import LeanPool.GraphMinor.GM17.Section10 +import LeanPool.GraphMinor.GM17.PasteCuff +import LeanPool.GraphMinor.GM17.ArcDisc +import LeanPool.GraphMinor.GM17.MarkCross +import LeanPool.GraphMinor.GM17.ReplaceDisc +import LeanPool.GraphMinor.GM17.RegionDisc +import LeanPool.GraphMinor.GM17.CutArcPaint +import LeanPool.GraphMinor.GM17.PushNode + +import LeanPool.GraphMinor.GM17.CellPartitionMain + +import LeanPool.GraphMinor.GM17.IndentMain + +import LeanPool.GraphMinor.GM17.RegionBoundary + +import LeanPool.GraphMinor.GM17.ThreeNodeReplace +import LeanPool.GraphMinor.GM17.CellLinkage + +/-! +# Graph Minors XVII: proved deductions of Section11 + +The portrayal deductions use the existing painting proofs. The definitions and +independent geometric lemmas are imported from `Section11`. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Function Topology Metric +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +/-! ## 1. Basic Lemmas on `tildeOfCells` and `gammaOfCells` -/ + +/-- **Graph Minors XVII, (11.1)** (page 189): +"Let $I, J$ be a partition of $C(\Gamma)$ with $\gamma(I), \gamma(J) \ne N(\Gamma)$ and +$|\gamma(I) \cap \gamma(J)| \le 3$. Then $|\gamma(I) \cap \gamma(J)| = 3$ and there is a +disc $\Delta \subseteq \Sigma$ such that* (i) *$\{c \in C(\Gamma) \colon c \subseteq +\Delta\}$ is one of $I, J$,* (ii) *$\alpha(\Delta)$ is small, and* (iii) *either +$\operatorname{bd}(\Delta)$ is a $\Gamma$-normal $O$-arc in $\Sigma$ and $N(\Gamma) \cap +\operatorname{bd}(\Delta) = \gamma(I) \cap \gamma(J)$, or $F \subseteq +\operatorname{bd}(\Delta) \subseteq F \cup \operatorname{bd}(\Sigma)$ and $N(\Gamma) \cap F += \gamma(I) \cap \gamma(J)$ for some $\Gamma$-normal $I$-arc $F$." -/ +theorem theorem_11_1_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 4)) + (hwarp : π.warp ≤ p) + (hθ : 6 * p + 8 < θ) + {I J : Set (Set π.S)} + (hcov : I ∪ J = π.Γ.C) (hdisj : Disjoint I J) + (hI_ne : π.Γ.tildeOfCells I ≠ π.Γ.N) + (hJ_ne : π.Γ.tildeOfCells J ≠ π.Γ.N) + (hcard_le : (π.Γ.tildeOfCells I ∩ π.Γ.tildeOfCells J).ncard ≤ 3) : + (π.Γ.tildeOfCells I ∩ π.Γ.tildeOfCells J).ncard = 3 ∧ + ∃ Δ : Set π.S, IsClosedDisc Δ ∧ + ({c ∈ π.Γ.C | c ⊆ Δ} = I ∨ {c ∈ π.Γ.C | c ⊆ Δ} = J) ∧ + IsSmallWrt 𝒯 (π.areaGraph Δ) ∧ + ((IsOArc (discBd Δ) ∧ π.Γ.IsNormal (discBd Δ) ∧ + π.Γ.N ∩ discBd Δ = π.Γ.tildeOfCells I ∩ π.Γ.tildeOfCells J) ∨ + (∃ F : Set π.S, ∃ n₁ n₂ : π.S, + IsLineWithEnds F n₁ n₂ ∧ π.Γ.IsNormal F ∧ F ∩ bd π.S = {n₁, n₂} ∧ + F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd π.S ∧ + π.Γ.N ∩ F = π.Γ.tildeOfCells I ∩ π.Γ.tildeOfCells J)) := by + have : ConnectedSpace π.S := π.connected + have hp_pos : 1 ≤ p := π.one_le_warp.trans hwarp + have hred3 : π.IsRedundant 𝒯 θ (2 * p + 3) := hred.mono (by omega) + have hθ3 : 4 * p + 5 < θ := by omega + obtain ⟨h82_oarc, h82_card, h82_node⟩ := + theorem_8_2_proof + h𝒯 π htrue hred3 hwarp hθ3 + have hreg : ∀ R ∈ π.Γ.regions, IsOpenDisc R ∧ IsOArc (closure R \ R) := + fun R hR => ⟨theorem_8_1_proof + h𝒯 π htrue hred3 hwarp hθ3 hR, h82_oarc R hR⟩ + have h83 : ∀ F : Set π.S, IsLine F → π.Γ.IsNormal F → F ∩ bd π.S = lineEnds F → + (F ∩ π.Γ.N).ncard = 2 → + ∃ Δ : Set π.S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd π.S ∧ + Δ ∩ π.Γ.N ⊆ F ∧ {c ∈ π.Γ.C | c ⊆ Δ}.ncard = 1 := + fun _ hL hnorm hFbd hcard => + theorem_8_3_proof h𝒯 π htrue hred3 hwarp hθ3 hL hnorm hFbd hcard + have h85_two : ∀ F : Set π.S, IsOArc F → π.Γ.IsNormal F → (F ∩ π.Γ.N).ncard = 2 → + ∃ Δ : Set π.S, IsClosedDisc Δ ∧ discBd Δ = F ∧ + Δ ∩ π.Γ.N ⊆ F ∧ {c ∈ π.Γ.C | c ⊆ Δ}.ncard ≤ 1 := by + intro F hO hnorm hcard2 + obtain ⟨Δ, hΔ, hbd, _, hcases⟩ := + theorem_8_5_proof + h𝒯 π htrue hred3 hwarp hθ3 hO hnorm (by omega) + rcases hcases with ⟨hΔ_N, hΔ_c⟩ | ⟨hcard3, _⟩ + · exact ⟨Δ, hΔ, hbd, hΔ_N, hΔ_c⟩ + · omega + obtain ⟨hcard_eq3, hcases⟩ := + GraphMinor.GM17.cellPartitionPainting π.S π.isSurface π.Γ hreg h82_card h82_node h83 h85_two I J + hcov hdisj hI_ne hJ_ne hcard_le + refine ⟨hcard_eq3, ?_⟩ + have hθ_6 : (2 * p + 4) + max 3 (2 * p + 2) < θ := by omega + rcases hcases with ⟨F, hO, hnorm, hNF, hΔ_cells⟩ | ⟨F, n₁, n₂, hF, hnorm, hFbd, hNF, hΔ_cells⟩ + · -- Case 1: `F` is a `Γ`-normal `O`-arc in `Σ`. + have hFγ_le : (F ∩ π.domγ).ncard ≤ 2 * p + 4 := by + have hsub : F ∩ π.domγ ⊆ π.Γ.N ∩ F := fun x hx => ⟨π.domγ_subset hx.2, hx.1⟩ + have hfin : (π.Γ.N ∩ F).Finite := π.Γ.finite_N.inter_of_left F + have hle3 : (F ∩ π.domγ).ncard ≤ 3 := by + calc (F ∩ π.domγ).ncard + _ ≤ (π.Γ.N ∩ F).ncard := ncard_le_ncard hsub hfin + _ = 3 := by rw [hNF, hcard_eq3] + omega + obtain ⟨Δ, hΔ, hbd, hsmall⟩ := + theorem_6_4_proof h𝒯 π htrue.1 hwarp hred hθ_6 hO hnorm hFγ_le + refine ⟨Δ, hΔ, hΔ_cells Δ hΔ hbd, hsmall, Or.inl ?_⟩ + rw [hbd] + exact ⟨hO, hnorm, hNF⟩ + · -- Case 2: `F` is a `Γ`-normal `I`-arc in `Σ`. + have hFγ_le : 2 * p ≤ 2 * p + 4 ∧ (F ∩ π.domγ).ncard ≤ (2 * p + 4) - 2 * p := by + have hsub : F ∩ π.domγ ⊆ π.Γ.N ∩ F := fun x hx => ⟨π.domγ_subset hx.2, hx.1⟩ + have hfin : (π.Γ.N ∩ F).Finite := π.Γ.finite_N.inter_of_left F + have hle3 : (F ∩ π.domγ).ncard ≤ 3 := by + calc (F ∩ π.domγ).ncard + _ ≤ (π.Γ.N ∩ F).ncard := ncard_le_ncard hsub hfin + _ = 3 := by rw [hNF, hcard_eq3] + omega + obtain ⟨Δ, hΔ, hF_bd, hbd_sub, hsmall⟩ := + theorem_6_3_proof h𝒯 π htrue.1 hwarp hred hθ_6 + hnorm hF hFbd hFγ_le + exact ⟨Δ, hΔ, hΔ_cells Δ hΔ hF_bd hbd_sub, hsmall, + Or.inr ⟨F, n₁, n₂, hF, hnorm, hFbd, hF_bd, hbd_sub, hNF⟩⟩ + +/-- Attachment bound for `π.areaGraph Δ` when `Δ` is bounded either by a `Γ`-normal `O$-arc with +$3$ nodes or by a `Γ`-normal $I$-arc $F$ with $3$ nodes and $\operatorname{bd}(\Sigma)$: +in either case, $\alpha(\Delta)$ has at most $2p + 3$ attachments in $G$. -/ +private theorem ncard_attachments_areaGraph_le + {α : Type u} {β : Type v} {G : Hypergraph α β} {p : ℕ} + (π : Portrayal G) (hwarp : π.warp ≤ p) + {Δ : Set π.S} (hΔ : IsClosedDisc Δ) + (hbd_cases : + (IsOArc (discBd Δ) ∧ π.Γ.IsNormal (discBd Δ) ∧ (π.Γ.N ∩ discBd Δ).ncard = 3) ∨ + (∃ F : Set π.S, ∃ n₁ n₂ : π.S, + IsLineWithEnds F n₁ n₂ ∧ π.Γ.IsNormal F ∧ F ∩ bd π.S = {n₁, n₂} ∧ + F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd π.S ∧ (π.Γ.N ∩ F).ncard = 3)) : + (attachments G (π.areaGraph Δ)).ncard ≤ 2 * p + 3 := by + rcases hbd_cases with ⟨_, hnorm, hcard3⟩ | ⟨F, n₁, n₂, hF, hnorm, hFbd, hF_bd, hbd_sub, hcard3⟩ + · -- Case 1: `discBd Δ` is a `Γ`-normal `O`-arc with `3` nodes. + have hle := π.ncard_attachments_areaGraph_le_normal_disc hΔ hnorm + rw [Set.inter_comm, hcard3] at hle + omega + · -- Case 2: `F` is a `Γ`-normal `I`-arc with ends `n₁, n₂` and `3` nodes. + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have : ConnectedSpace π.S := π.connected + let I₁ : Set (Set π.S) := {c ∈ π.Γ.C | c ⊆ Δ} + let I₂ : Set (Set π.S) := {c ∈ π.Γ.C | ¬ c ⊆ Δ} + have hcov : I₁ ∪ I₂ = π.Γ.C := by + ext c + simp only [I₁, I₂, mem_union, mem_sep_iff] + refine ⟨fun h => h.elim And.left And.left, ?_⟩ + intro hc + by_cases h : c ⊆ Δ + · exact Or.inl ⟨hc, h⟩ + · exact Or.inr ⟨hc, h⟩ + have hdisj : Disjoint I₁ I₂ := by + rw [Set.disjoint_left] + exact fun _ h₁ h₂ => h₂.2 h₁.2 + have hsep : G.IsSeparation (π.cellsUnion I₁) (π.cellsUnion I₂) := + π.isSeparation_cellsUnion hcov hdisj + have hatt_sub_inter : attachments G (π.areaGraph Δ) ⊆ + (π.cellsUnion I₁ ∩ π.cellsUnion I₂).vertexSet := + attachments_subset_inter_of_isSeparation hsep + have h21 := (theorem_2_1_proof π hcov hdisj).2 + obtain ⟨_, _, _, _, _, _, _, _, _, _, _, hnb⟩ := + arc_disc_data π.isSurface hF hFbd hΔ hF_bd hbd_sub + have hsep_F : ∀ c₁ ∈ I₁, ∀ c₂ ∈ I₂, tilde c₁ ∩ tilde c₂ ⊆ F := by + intro c₁ hc₁ c₂ hc₂ x ⟨hx₁, hx₂⟩ + by_contra hxF + have hxΔ : x ∈ Δ := closure_minimal hc₁.2 hΔ.isClosed hx₁.1 + obtain ⟨y, hyΔ, hyc₂⟩ := mem_closure_iff_nhds.mp hx₂.1 Δ (hnb x ⟨hxΔ, hxF⟩) + exact (cell_side hc₂.1 hnorm hΔ hnb).resolve_left hc₂.2 hyc₂ hyΔ + have hatt_sub : attachments G (π.areaGraph Δ) ⊆ + π.borderSet n₁ ∪ π.borderSet n₂ ∪ π.nodeVertex '' (π.Γ.N ∩ F) := by + intro v hv + have hv_inter := hatt_sub_inter hv + rw [h21] at hv_inter + rcases hv_inter with hγ | hbs + · rw [mem_iUnion₂] at hγ + rcases hγ with ⟨c₁, hc₁, hγ⟩ + rw [mem_iUnion₂] at hγ + rcases hγ with ⟨c₂, hc₂, hγ⟩ + rw [← π.gammaImage_inter, Portrayal.mem_gammaImage_iff] at hγ + rcases hγ with ⟨n, ⟨hnd, hndom⟩, rfl⟩ + exact Or.inr ⟨n, ⟨π.domγ_subset hndom, hsep_F c₁ hc₁ c₂ hc₂ hnd⟩, rfl⟩ + · rw [mem_iUnion₂] at hbs + rcases hbs with ⟨n, ⟨c₁, hc₁, hbd₁, c₂, hc₂, _, hnd⟩, hvn⟩ + have hnF : n ∈ F := hsep_F c₁ hc₁ c₂ hc₂ hnd + obtain ⟨u₁, v₁, _, htilde₁, _, _, hu₁, hv₁⟩ := π.Γ.border_cell_exists_ends hc₁.1 hbd₁ + have hn_uv : n ∈ ({u₁, v₁} : Set π.S) := htilde₁ ▸ hnd.1 + have hnbd : n ∈ bd π.S := by rcases hn_uv with rfl | rfl <;> [exact hu₁.2; exact hv₁.2] + have hn_pair : n ∈ ({n₁, n₂} : Set π.S) := hFbd ▸ ⟨hnF, hnbd⟩ + rcases hn_pair with rfl | rfl + · exact Or.inl (Or.inl hvn) + · exact Or.inl (Or.inr hvn) + have hn₁_mem : n₁ ∈ F ∩ bd π.S := hFbd ▸ mem_insert _ _ + have hn₂_mem : n₂ ∈ F ∩ bd π.S := hFbd ▸ mem_insert_of_mem _ (mem_singleton _) + have hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S := + ⟨hnorm ⟨hn₁_mem.1, π.Γ.bd_subset hn₁_mem.2⟩, hn₁_mem.2⟩ + have hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S := + ⟨hnorm ⟨hn₂_mem.1, π.Γ.bd_subset hn₂_mem.2⟩, hn₂_mem.2⟩ + have hn₁_card : (π.borderSet n₁).ncard ≤ p := + (π.ncard_borderSet_le_warp hn₁_bd).trans hwarp + have hn₂_card : (π.borderSet n₂).ncard ≤ p := + (π.ncard_borderSet_le_warp hn₂_bd).trans hwarp + have hNF_fin : (π.Γ.N ∩ F).Finite := π.Γ.finite_N.inter_of_left F + have hfin_u : (π.borderSet n₁ ∪ π.borderSet n₂ ∪ π.nodeVertex '' (π.Γ.N ∩ F)).Finite := + ((π.borderSet_finite hn₁_bd).union (π.borderSet_finite hn₂_bd)).union (hNF_fin.image _) + have h0 := ncard_le_ncard hatt_sub hfin_u + have h1 := ncard_union_le (π.borderSet n₁ ∪ π.borderSet n₂) (π.nodeVertex '' (π.Γ.N ∩ F)) + have h2 := ncard_union_le (π.borderSet n₁) (π.borderSet n₂) + have h3 := ncard_image_le (f := π.nodeVertex) hNF_fin + omega + +private theorem nontrivial_cell_partition_determines_disc_side + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {θ : ℕ} + {p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 4)) + (hwarp : π.warp ≤ p) + (hθ : 6 * p + 8 < θ) + {A : Hypergraph α β} + {B : Hypergraph α β} + (hord : A.separationOrder B + 4 * p + 3 < θ) + {c₀ : Set π.S} + (hc₀ : c₀ ∈ π.Γ.C) + {I : Set (Set π.S)} + {J : Set (Set π.S)} + (hcov : I ∪ J = π.Γ.C) + (hdisj : Disjoint I J) + (hc₀I : c₀ ∈ I) + [this : T2Space π.S] + (hθ3 : 4 * p + 5 < θ) + (h82_node : ∀ n ∈ π.Γ.N, ∃ c ∈ π.Γ.C, n ∈ tilde c) + (hXY_eq : ({n | n ∈ π.Γ.N ∧ π.nodeVertex n ∈ A.vertexSet}) ∩ ({n | n ∈ π.Γ.N ∧ π.nodeVertex n + ∈ B.vertexSet}) = {n | n ∈ π.Γ.N ∧ π.nodeVertex n ∈ (A ∩ B).vertexSet}) + (hXY_fin : (({n | n ∈ π.Γ.N ∧ π.nodeVertex n ∈ A.vertexSet}) ∩ ({n | n ∈ π.Γ.N ∧ π.nodeVertex + n ∈ B.vertexSet})).Finite) + (hJ_sub : J ⊆ π.Γ.C) + (htI_sub_X : π.Γ.tildeOfCells I ⊆ ({n | n ∈ π.Γ.N ∧ π.nodeVertex n ∈ A.vertexSet})) + (htJ_sub_Y : π.Γ.tildeOfCells J ⊆ ({n | n ∈ π.Γ.N ∧ π.nodeVertex n ∈ B.vertexSet})) + (htIJ_union : π.Γ.tildeOfCells I ∪ π.Γ.tildeOfCells J = π.Γ.N) + (hc₀_le3 : (tilde c₀).ncard ≤ 3) + (hXY_le : (({n | n ∈ π.Γ.N ∧ π.nodeVertex n ∈ A.vertexSet}) ∩ ({n | n ∈ π.Γ.N ∧ π.nodeVertex n + ∈ B.vertexSet})).ncard ≤ (tilde c₀).ncard) + (htIJ_sub_XY : π.Γ.tildeOfCells I ∩ π.Γ.tildeOfCells J ⊆ ({n | n ∈ π.Γ.N ∧ π.nodeVertex n ∈ + A.vertexSet}) ∩ ({n | n ∈ π.Γ.N ∧ π.nodeVertex n ∈ B.vertexSet})) + (htIJ_le : (π.Γ.tildeOfCells I ∩ π.Γ.tildeOfCells J).ncard ≤ (({n | n ∈ π.Γ.N ∧ π.nodeVertex n + ∈ A.vertexSet}) ∩ ({n | n ∈ π.Γ.N ∧ π.nodeVertex n ∈ B.vertexSet})).ncard) + (hA_small : IsSmallWrt 𝒯 A) + (hatt_A : (attachments G A).ncard ≤ A.separationOrder B) + (htI_ne_N : π.Γ.tildeOfCells I ≠ π.Γ.N) + (htJ_ne_N : ¬π.Γ.tildeOfCells J = π.Γ.N) : + {n | n ∈ π.Γ.N ∧ π.nodeVertex n ∈ (A ∩ B).vertexSet}.ncard = (tilde c₀).ncard ∧ (({n | n ∈ + π.Γ.N ∧ π.nodeVertex n ∈ A.vertexSet} = tilde c₀ ∧ ∀ n ∈ π.Γ.N, π.nodeVertex n ∈ + B.vertexSet) ∨ (tilde c₀).ncard = 3 ∧ ∃ (F Δ : Set π.S) (n₁ n₂ : π.S), IsLineWithEnds F n₁ + n₂ ∧ π.Γ.IsNormal F ∧ F ∩ bd π.S = {n₁, n₂} ∧ IsClosedDisc Δ ∧ IsSmallWrt 𝒯 (π.areaGraph Δ) + ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd π.S ∧ I = {c | c ∈ π.Γ.C ∧ c ⊆ Δ} ∧ ∀ n ∈ π.Γ.N, + (π.nodeVertex n ∈ A.vertexSet ↔ n ∈ Δ) ∧ (π.nodeVertex n ∈ B.vertexSet ↔ n ∈ closure (univ \ + Δ)) ∧ (π.nodeVertex n ∈ B.vertexSet ↔ n ∈ univ \ Δ ∪ F)) := by + let X := {n | n ∈ π.Γ.N ∧ π.nodeVertex n ∈ A.vertexSet} + let Y := {n | n ∈ π.Γ.N ∧ π.nodeVertex n ∈ B.vertexSet} + -- Case `π.Γ.tildeOfCells J ≠ π.Γ.N`: apply (11.1). + obtain ⟨htIJ_eq3, Δ, hΔ, hΔ_cells, hΔ_small, hΔ_cases⟩ := + theorem_11_1_proof h𝒯 π htrue hred hwarp hθ + hcov hdisj htI_ne_N htJ_ne_N (by omega) + have hXY_eq3 : (X ∩ Y).ncard = 3 := + Nat.le_antisymm (hXY_le.trans hc₀_le3) (htIJ_eq3 ▸ htIJ_le) + have hc₀_eq3 : (tilde c₀).ncard = 3 := by omega + have hcard_eq : {n ∈ π.Γ.N | π.nodeVertex n ∈ (A ∩ B).vertexSet}.ncard = (tilde c₀).ncard := by + rw [← hXY_eq, hXY_eq3, hc₀_eq3] + have htIJ_eq_XY : π.Γ.tildeOfCells I ∩ π.Γ.tildeOfCells J = X ∩ Y := + eq_of_subset_of_ncard_le htIJ_sub_XY (by omega) hXY_fin + have hX_eq_tI : X = π.Γ.tildeOfCells I := by + refine Subset.antisymm (fun n hnX => ?_) htI_sub_X + rcases htIJ_union ▸ hnX.1 with hnI | hnJ + · exact hnI + · have hnXY : n ∈ X ∩ Y := ⟨hnX, htJ_sub_Y hnJ⟩ + rw [← htIJ_eq_XY] at hnXY + exact hnXY.1 + have hY_eq_tJ : Y = π.Γ.tildeOfCells J := by + refine Subset.antisymm (fun n hnY => ?_) htJ_sub_Y + rcases htIJ_union ▸ hnY.1 with hnI | hnJ + · have hnXY : n ∈ X ∩ Y := ⟨htI_sub_X hnI, hnY⟩ + rw [← htIJ_eq_XY] at hnXY + exact hnXY.2 + · exact hnJ + -- Show `{c ∈ π.Γ.C | c ⊆ Δ} = I` using (4.3) applied to `A ∪ π.areaGraph Δ`. + have hbd_card : + (IsOArc (discBd Δ) ∧ π.Γ.IsNormal (discBd Δ) ∧ (π.Γ.N ∩ discBd Δ).ncard = 3) ∨ + (∃ F : Set π.S, ∃ n₁ n₂ : π.S, + IsLineWithEnds F n₁ n₂ ∧ π.Γ.IsNormal F ∧ F ∩ bd π.S = {n₁, n₂} ∧ + F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd π.S ∧ (π.Γ.N ∩ F).ncard = 3) := by + rcases hΔ_cases with ⟨hO, hnorm, hNF⟩ | ⟨F, n₁, n₂, hF, hnorm, hFbd, hF_bd, hbd_sub, hNF⟩ + · exact Or.inl ⟨hO, hnorm, by rw [hNF, htIJ_eq3]⟩ + · exact Or.inr ⟨F, n₁, n₂, hF, hnorm, hFbd, hF_bd, hbd_sub, by rw [hNF, htIJ_eq3]⟩ + have hatt_Δ : (attachments G (π.areaGraph Δ)).ncard ≤ 2 * p + 3 := + ncard_attachments_areaGraph_le π hwarp hΔ hbd_card + have hatt_union : (attachments G (A ∪ π.areaGraph Δ)).ncard + 2 * p < θ := by + have hsub : attachments G (A ∪ π.areaGraph Δ) ⊆ + attachments G A ∪ attachments G (π.areaGraph Δ) := + fun _ hv => attachments_union_subset hv + have hle : (attachments G (A ∪ π.areaGraph Δ)).ncard ≤ + (attachments G A).ncard + (attachments G (π.areaGraph Δ)).ncard := + (ncard_le_ncard hsub (attachments_finite.union attachments_finite)).trans + (ncard_union_le _ _) + omega + have hAΔ_small : IsSmallWrt 𝒯 (A ∪ π.areaGraph Δ) := + hA_small.union h𝒯 hΔ_small (by omega) + have hex_n₀ : ∃ n₀ ∈ π.domγ, π.nodeVertex n₀ ∉ (A ∪ π.areaGraph Δ).vertexSet := by + by_contra hnot + push Not at hnot + exact theorem_4_3_proof h𝒯 π htrue.1 hwarp + ⟨A ∪ π.areaGraph Δ, hAΔ_small, by omega, hnot⟩ + obtain ⟨n₀, hn₀γ, hn₀_not⟩ := hex_n₀ + have hn₀N : n₀ ∈ π.Γ.N := π.domγ_subset hn₀γ + have hn₀_notX : n₀ ∉ X := fun h => hn₀_not (Or.inl h.2) + obtain ⟨c₁, hc₁, hn₀_c₁⟩ := h82_node n₀ hn₀N + have hc₁_notI : c₁ ∉ I := by + intro hc₁I + exact hn₀_notX (htI_sub_X (mem_biUnion hc₁I hn₀_c₁)) + have hc₁J : c₁ ∈ J := (hcov ▸ hc₁).resolve_left hc₁_notI + have hc₁_notΔ : ¬ c₁ ⊆ Δ := by + intro hc₁Δ + have hv_c₁ : π.nodeVertex n₀ ∈ (π.cellGraph c₁).vertexSet := + π.p2 c₁ hc₁ n₀ ⟨hn₀_c₁, hn₀γ⟩ + have hv_Δ : π.nodeVertex n₀ ∈ (π.areaGraph Δ).vertexSet := + mem_biUnion ⟨⟨hc₁, hc₁Δ⟩, hc₁⟩ hv_c₁ + exact hn₀_not (Or.inr hv_Δ) + have hcells_eq_I : {c ∈ π.Γ.C | c ⊆ Δ} = I := by + rcases hΔ_cells with hEq | hEq + · exact hEq + · exfalso + have : c₁ ∈ {c ∈ π.Γ.C | c ⊆ Δ} := hEq.symm ▸ hc₁J + exact hc₁_notΔ this.2 + -- Note that `c₀ ∈ I` since if `c₀ ∈ J`, then `tilde c₀ ⊆ X ∩ Y` so `tilde c₀ ⊆ tildeOfCells I`, + -- which is fine, wait: if `c₀ ∈ J`, then `tilde c₀ ⊆ htJ_sub_Y` AND `tilde c₀ ⊆ X`, + -- so `tilde c₀ ⊆ X ∩ Y = tildeOfCells I ∩ tildeOfCells J`. + -- Wait: what if `discBd Δ` is a `Γ`-normal `O`-arc? + rcases hΔ_cases with ⟨hO, hnorm, hNF⟩ | ⟨F, n₁, n₂, hF, hnorm, hFbd, hF_bd, hbd_sub, hNF⟩ + · -- Rule out the `Γ`-normal `O`-arc case using (8.5) / (7.2). + exfalso + have hc₀_Δ : c₀ ⊆ Δ := (hcells_eq_I.symm ▸ hc₀I).2 + have hFN_eq3 : (discBd Δ ∩ π.Γ.N).ncard = 3 := by + rw [Set.inter_comm, hNF, htIJ_eq3] + have hnode_bd : ∀ n ∈ discBd Δ ∩ π.domγ, ∃ d ∈ π.Γ.C, n ∈ tilde d := + fun n hn => h82_node n (π.domγ_subset hn.2) + obtain ⟨π', _, hπ'_central, hπ'_res, h72⟩ := + theorem_7_2_proof h𝒯 (by omega) π htrue.1 hΔ hnorm (by omega) hnode_bd hΔ_small + rcases h72 ⟨c₀, hc₀, hc₀_Δ, by omega⟩ with htruer | ⟨hΔ_N, _⟩ + · exact htrue.2.2 π' hπ'_central htruer hπ'_res + · have htI_sub_tJ : π.Γ.tildeOfCells I ⊆ π.Γ.tildeOfCells J := by + intro n hnI + rw [← hcells_eq_I] at hnI + rcases mem_iUnion₂.mp hnI with ⟨c, ⟨hcC, hcΔ⟩, hnc⟩ + have hnΔ : n ∈ Δ := closure_minimal hcΔ hΔ.isClosed hnc.1 + have hnN : n ∈ π.Γ.N := π.Γ.tilde_subset_N hcC hnc + have hn_bd : n ∈ π.Γ.N ∩ discBd Δ := ⟨hnN, hΔ_N ⟨hnΔ, hnN⟩⟩ + rw [hNF] at hn_bd + exact hn_bd.2 + have hJ_eq_N : π.Γ.tildeOfCells J = π.Γ.N := by + rw [← htIJ_union, union_eq_self_of_subset_left htI_sub_tJ] + exact htJ_ne_N hJ_eq_N + · -- `F` is a `Γ`-normal `I`-arc with ends `n₁, n₂`. + obtain ⟨_, _, _, _, _, _, _, _, _, _, _, hnb⟩ := + arc_disc_data π.isSurface hF hFbd hΔ hF_bd hbd_sub + refine ⟨hcard_eq, Or.inr ⟨hc₀_eq3, F, Δ, n₁, n₂, hF, hnorm, hFbd, hΔ, hΔ_small, + hF_bd, hbd_sub, hcells_eq_I.symm, fun n hnN => ?_⟩⟩ + have hnA_iff_tI' : π.nodeVertex n ∈ A.vertexSet ↔ n ∈ π.Γ.tildeOfCells I := by + calc π.nodeVertex n ∈ A.vertexSet + _ ↔ n ∈ X := ⟨fun h => ⟨hnN, h⟩, fun h => h.2⟩ + _ ↔ n ∈ π.Γ.tildeOfCells I := by rw [hX_eq_tI] + have hnB_iff_tJ : π.nodeVertex n ∈ B.vertexSet ↔ n ∈ π.Γ.tildeOfCells J := by + calc π.nodeVertex n ∈ B.vertexSet + _ ↔ n ∈ Y := ⟨fun h => ⟨hnN, h⟩, fun h => h.2⟩ + _ ↔ n ∈ π.Γ.tildeOfCells J := by rw [hY_eq_tJ] + have htI_iff_Δ : n ∈ π.Γ.tildeOfCells I ↔ n ∈ Δ := by + constructor + · intro hnI + rw [← hcells_eq_I] at hnI + rcases mem_iUnion₂.mp hnI with ⟨c, ⟨_, hcΔ⟩, hnc⟩ + exact closure_minimal hcΔ hΔ.isClosed hnc.1 + · intro hnΔ + by_cases hnF : n ∈ F + · have hn_inter : n ∈ π.Γ.N ∩ F := ⟨hnN, hnF⟩ + rw [hNF] at hn_inter + exact hn_inter.1 + · obtain ⟨c, hcC, hnc⟩ := h82_node n hnN + obtain ⟨y, hyΔ, hyc⟩ := mem_closure_iff_nhds.mp hnc.1 Δ (hnb n ⟨hnΔ, hnF⟩) + have hcΔ : c ⊆ Δ := (cell_side hcC hnorm hΔ hnb).resolve_right fun h => h hyc hyΔ + have hcI : c ∈ I := hcells_eq_I ▸ ⟨hcC, hcΔ⟩ + exact mem_biUnion hcI hnc + have htJ_imp_cl : n ∈ π.Γ.tildeOfCells J → n ∈ closure (Set.univ \ Δ) := by + intro hnJ + rcases mem_iUnion₂.mp hnJ with ⟨c, hcJ, hnc⟩ + have hcC : c ∈ π.Γ.C := hJ_sub hcJ + have hc_notΔ : ¬ c ⊆ Δ := by + intro hcΔ + have hcI : c ∈ I := hcells_eq_I ▸ ⟨hcC, hcΔ⟩ + exact Set.disjoint_left.mp hdisj hcI hcJ + have hc_compl : c ⊆ Set.univ \ Δ := by + have := (cell_side hcC hnorm hΔ hnb).resolve_left hc_notΔ + exact fun x hx => ⟨ trivial, this hx ⟩ + exact closure_mono hc_compl hnc.1 + have hcl_imp_union : n ∈ closure (Set.univ \ Δ) → n ∈ (Set.univ \ Δ) ∪ F := by + intro hn_cl + by_cases hnF : n ∈ F + · exact Or.inr hnF + · left + refine ⟨trivial, fun hnΔ => ?_⟩ + obtain ⟨y, hyΔ, hy_compl⟩ := mem_closure_iff_nhds.mp hn_cl Δ (hnb n ⟨hnΔ, hnF⟩) + exact hy_compl.2 hyΔ + have hunion_imp_tJ : n ∈ (Set.univ \ Δ) ∪ F → n ∈ π.Γ.tildeOfCells J := by + rintro (⟨_, hn_notΔ⟩ | hnF) + · have hn_notI : n ∉ π.Γ.tildeOfCells I := mt htI_iff_Δ.mp hn_notΔ + exact (htIJ_union ▸ hnN).resolve_left hn_notI + · have hn_inter : n ∈ π.Γ.N ∩ F := ⟨hnN, hnF⟩ + rw [hNF] at hn_inter + exact hn_inter.2 + refine ⟨hnA_iff_tI'.trans htI_iff_Δ, + hnB_iff_tJ.trans ⟨htJ_imp_cl, fun h => hunion_imp_tJ (hcl_imp_union h)⟩, + hnB_iff_tJ.trans ⟨fun h => hcl_imp_union (htJ_imp_cl h), hunion_imp_tJ⟩⟩ + +/-- **Graph Minors XVII, (11.2)** (pages 191–192): +"Let $(A, B) \in \mathscr{T}$ have order $< ord(\mathscr{T}) - 4p - 3$, let $c_0 \in C(\Gamma)$ +with $\alpha(c_0) \subseteq A$, let $I, J$ be a partition of $C(\Gamma)$ so that $\gamma(I) +\subseteq V(A)$ and $\gamma(J) \subseteq V(B)$ and let +$$|\{n \in N(\Gamma) : \gamma(n) \in V(A \cap B)\}| \le |\tilde{c}_0|.$$ +Then equality holds, and either +(i) $\{n \in N(\Gamma) : \gamma(n) \in V(A)\} = \tilde{c}_0$ and $\gamma(n) \in V(B)$ for all $n +\in N(\Gamma)$, or +(ii) $|\tilde{c}_0| = 3$, and there is a $\Gamma$-normal $I$-arc $F$ and a disc $\Delta \subseteq +\Sigma$ with $\alpha(\Delta)$ small and with $F \subseteq bd(\Delta) \subseteq F \cup bd(\Sigma)$, +such that $I = \{c \in C(\Gamma) : c \subseteq \Delta\}$ and for all $n \in N(\Gamma)$, $\gamma(n) +\in V(A)$ if and only if $n \in \Delta$, and $\gamma(n) \in V(B)$ if and only if..." + +We also record the equivalent condition $n \in (\Sigma \setminus \Delta) \cup F$ for +$\gamma(n) \in V(B)$ in (ii). -/ +theorem theorem_11_2_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 4)) + (hwarp : π.warp ≤ p) + (hθ : 6 * p + 8 < θ) + {A B : Hypergraph α β} (hAB : (A, B) ∈ 𝒯) + (hord : separationOrder A B + 4 * p + 3 < θ) + {c₀ : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) (hc₀A : π.cellGraph c₀ ≤ A) + {I J : Set (Set π.S)} (hcov : I ∪ J = π.Γ.C) (hdisj : Disjoint I J) + (hc₀I : c₀ ∈ I) + (hI_A : π.gammaOfCells I ⊆ A.vertexSet) + (hJ_B : π.gammaOfCells J ⊆ B.vertexSet) + (hcard_le : {n ∈ π.Γ.N | π.nodeVertex n ∈ (A ∩ B).vertexSet}.ncard ≤ (tilde c₀).ncard) : + {n ∈ π.Γ.N | π.nodeVertex n ∈ (A ∩ B).vertexSet}.ncard = (tilde c₀).ncard ∧ + (({n ∈ π.Γ.N | π.nodeVertex n ∈ A.vertexSet} = tilde c₀ ∧ + ∀ n ∈ π.Γ.N, π.nodeVertex n ∈ B.vertexSet) ∨ + ((tilde c₀).ncard = 3 ∧ + ∃ F Δ : Set π.S, ∃ n₁ n₂ : π.S, + IsLineWithEnds F n₁ n₂ ∧ π.Γ.IsNormal F ∧ F ∩ bd π.S = {n₁, n₂} ∧ + IsClosedDisc Δ ∧ IsSmallWrt 𝒯 (π.areaGraph Δ) ∧ + F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd π.S ∧ + I = {c ∈ π.Γ.C | c ⊆ Δ} ∧ + (∀ n ∈ π.Γ.N, + (π.nodeVertex n ∈ A.vertexSet ↔ n ∈ Δ) ∧ + (π.nodeVertex n ∈ B.vertexSet ↔ n ∈ closure (Set.univ \ Δ)) ∧ + (π.nodeVertex n ∈ B.vertexSet ↔ n ∈ (Set.univ \ Δ) ∪ F)))) := by + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have : ConnectedSpace π.S := π.connected + have hred3 : π.IsRedundant 𝒯 θ (2 * p + 3) := hred.mono (by omega) + have hθ3 : 4 * p + 5 < θ := by omega + obtain ⟨_, h82_card, h82_node⟩ := + theorem_8_2_proof + h𝒯 π htrue hred3 hwarp hθ3 + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof + h𝒯 π htrue hred3 hwarp hθ3 + have hsep : G.IsSeparation A B := h𝒯.isSeparation hAB + let X : Set π.S := {n ∈ π.Γ.N | π.nodeVertex n ∈ A.vertexSet} + let Y : Set π.S := {n ∈ π.Γ.N | π.nodeVertex n ∈ B.vertexSet} + have hXY_eq : X ∩ Y = {n ∈ π.Γ.N | π.nodeVertex n ∈ (A ∩ B).vertexSet} := by + ext n + simp only [X, Y, mem_inter_iff, mem_ofPred_eq, inter_vertexSet] + tauto + have hX_fin : X.Finite := π.Γ.finite_N.subset fun _ hn => hn.1 + have hY_fin : Y.Finite := π.Γ.finite_N.subset fun _ hn => hn.1 + have hXY_fin : (X ∩ Y).Finite := hX_fin.inter_of_left Y + have hc₀_sub_X : tilde c₀ ⊆ X := by + intro n hn + refine ⟨π.Γ.tilde_subset_N hc₀ hn, hc₀A.1 ?_⟩ + exact π.p2 c₀ hc₀ n ⟨hn, hdom ▸ π.Γ.tilde_subset_N hc₀ hn⟩ + have hI_sub : I ⊆ π.Γ.C := hcov ▸ subset_union_left + have hJ_sub : J ⊆ π.Γ.C := hcov ▸ subset_union_right + have htI_sub_X : π.Γ.tildeOfCells I ⊆ X := by + intro n hn + refine ⟨π.Γ.tildeOfCells_subset_N hI_sub hn, hI_A ?_⟩ + rw [π.gammaOfCells_eq_image_tildeOfCells hdom hI_sub] + exact mem_image_of_mem _ hn + have htJ_sub_Y : π.Γ.tildeOfCells J ⊆ Y := by + intro n hn + refine ⟨π.Γ.tildeOfCells_subset_N hJ_sub hn, hJ_B ?_⟩ + rw [π.gammaOfCells_eq_image_tildeOfCells hdom hJ_sub] + exact mem_image_of_mem _ hn + have htIJ_union : π.Γ.tildeOfCells I ∪ π.Γ.tildeOfCells J = π.Γ.N := by + rw [← π.Γ.tildeOfCells_union, hcov, π.Γ.tildeOfCells_eq_N h82_node] + have hXY_union : X ∪ Y = π.Γ.N := by + refine Subset.antisymm (union_subset (fun _ h => h.1) (fun _ h => h.1)) ?_ + rw [← htIJ_union] + exact union_subset_union htI_sub_X htJ_sub_Y + have hc₀_le3 : (tilde c₀).ncard ≤ 3 := π.Γ.ncard_tilde_cell_le hc₀ + have hXY_le : (X ∩ Y).ncard ≤ (tilde c₀).ncard := by rwa [hXY_eq] + have htIJ_sub_XY : π.Γ.tildeOfCells I ∩ π.Γ.tildeOfCells J ⊆ X ∩ Y := + inter_subset_inter htI_sub_X htJ_sub_Y + have htIJ_le : (π.Γ.tildeOfCells I ∩ π.Γ.tildeOfCells J).ncard ≤ (X ∩ Y).ncard := + ncard_le_ncard htIJ_sub_XY hXY_fin + -- By (4.3), `X ≠ π.Γ.N`, hence `π.Γ.tildeOfCells I ≠ π.Γ.N`. + have hA_small : IsSmallWrt 𝒯 A := ⟨B, hAB⟩ + have hatt_A : (attachments G A).ncard ≤ separationOrder A B := + ncard_le_ncard (attachments_subset_inter_of_isSeparation hsep) + (G.vertexSet_finite.subset (inter_subset_left.trans hsep.1.1)) + have hX_ne_N : X ≠ π.Γ.N := by + intro hXN + apply theorem_4_3_proof h𝒯 π htrue.1 hwarp + refine ⟨A, hA_small, by omega, fun n hnγ => ?_⟩ + have hnX : n ∈ X := hXN.symm ▸ π.domγ_subset hnγ + exact hnX.2 + have htI_ne_N : π.Γ.tildeOfCells I ≠ π.Γ.N := by + intro hIN + exact hX_ne_N (Subset.antisymm (fun _ h => h.1) (hIN ▸ htI_sub_X)) + by_cases htJ_ne_N : π.Γ.tildeOfCells J = π.Γ.N + · -- Case `π.Γ.tildeOfCells J = π.Γ.N`: then `Y = π.Γ.N` and `X = tilde c₀`, giving (i). + have hYN : Y = π.Γ.N := Subset.antisymm (fun _ h => h.1) (htJ_ne_N ▸ htJ_sub_Y) + have hXY_eq_X : X ∩ Y = X := by + have hX_N : X ⊆ π.Γ.N := fun _ h => h.1 + rw [hYN, inter_eq_self_of_subset_left hX_N] + have hX_eq_c₀ : X = tilde c₀ := by + apply (eq_of_subset_of_ncard_le hc₀_sub_X ?_ hX_fin).symm + rw [← hXY_eq_X] + exact hXY_le + refine ⟨?_, Or.inl ⟨hX_eq_c₀, fun n hn => ?_⟩⟩ + · rw [← hXY_eq, hXY_eq_X, hX_eq_c₀] + · have hnY : n ∈ Y := hYN.symm ▸ hn + exact hnY.2 + · exact nontrivial_cell_partition_determines_disc_side (α := α) (β := β) (G := G) (𝒯 := 𝒯) (θ := + θ) (p := p) h𝒯 π htrue hred hwarp hθ (A := A) (B := B) hord (c₀ := c₀) hc₀ (I := I) (J := J) + hcov hdisj hc₀I hθ3 h82_node hXY_eq hXY_fin hJ_sub htI_sub_X htJ_sub_Y htIJ_union hc₀_le3 + hXY_le htIJ_sub_XY htIJ_le hA_small hatt_A htI_ne_N htJ_ne_N +/-! ## 3. Three-Node Normal $I$-Arc Disc Separation: (11.3) (Pages 192–193) -/ + +private noncomputable abbrev portrayal_after_two_cell_replacement + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {F : Set π.S} + {Δ : Set π.S} + {n₁ : π.S} + {n₂ : π.S} + {n₃ : π.S} + (hF : IsLineWithEnds F n₁ n₂) + (hFbd : F ∩ bd π.S = {n₁, n₂}) + (hFN : F ∩ π.Γ.N = {n₁, n₂, n₃}) + (A₁ : Hypergraph α β) + (A₂ : Hypergraph α β) + (hsep : (π.areaGraph Δ).IsSeparation A₁ A₂) + (hinter_V : (A₁ ∩ A₂).vertexSet = {π.nodeVertex n₁, π.nodeVertex n₂}) + (hn₃_A₁ : π.nodeVertex n₃ ∈ A₁.vertexSet) + (hbs_A₂ : π.borderSet n₁ ∪ π.borderSet n₂ ⊆ A₂.vertexSet) + (Γ' : Painting π.S) + (Θ : Set π.S) + (c₁ : Set π.S) + (c₂ : Set π.S) + (hN'_eq : Γ'.N = π.Γ.N \ Δ ∪ {n₁, n₂, n₃}) + (hN'_sub : Γ'.N ⊆ π.Γ.N) + (hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ) + (hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ) + (hdich : ∀ c ∈ π.Γ.C, c ⊆ Δ ∨ c ⊆ Δᶜ) + (htilde_I₂ : ∀ c ∈ π.Γ.C, c ⊆ Δᶜ → tilde c ⊆ Γ'.N) + (hc₁_mem : c₁ ∈ Γ'.C) + (hc₁_int : ¬(c₁ ∩ bd π.S).Nonempty) + (htilde_c₁ : tilde c₁ = {n₁, n₂, n₃}) + (hc₂_mem : c₂ ∈ Γ'.C) + (hc₂_Θ : (c₂ ∩ Θ).Nonempty) + (htilde_c₂ : tilde c₂ = {n₁, n₂}) + (hc₁_ne_c₂ : c₁ ≠ c₂) + (hc₁_not_I₂ : c₁ ∉ {c | c ∈ π.Γ.C ∧ c ⊆ Δᶜ}) + (hc₂_not_I₂ : c₂ ∉ {c | c ∈ π.Γ.C ∧ c ⊆ Δᶜ}) + (hC' : Γ'.C = insert c₁ (insert c₂ {c | c ∈ π.Γ.C ∧ c ⊆ Δᶜ})) + (hc₂_bd : (c₂ ∩ bd π.S).Nonempty) + (hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S) + (hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S) + (hn₃_FN : n₃ ∈ F ∩ π.Γ.N) + (hn₁_dom : n₁ ∈ π.domγ) + (hn₂_dom : n₂ ∈ π.domγ) + (hn₃_dom : n₃ ∈ π.domγ) + (hne₁₂ : n₁ ≠ n₂) + (hne₃₁ : n₃ ≠ n₁) + (hne₃₂ : n₃ ≠ n₂) + (hn₁_A₁A₂ : π.nodeVertex n₁ ∈ (A₁ ∩ A₂).vertexSet) + (hn₂_A₁A₂ : π.nodeVertex n₂ ∈ (A₁ ∩ A₂).vertexSet) + (hn₃_not_A₂ : π.nodeVertex n₃ ∉ A₂.vertexSet) + (hbp_c₂_sub_A₂ : ∀ {n : π.S}, n ∈ tilde c₂ → π.borderPlus n ⊆ A₂.vertexSet) + (htilde_c₂_N' : tilde c₂ ⊆ Γ'.N ∩ bd π.S) + (htilde_c₁_N' : tilde c₁ ⊆ Γ'.N) + (hdisj_I : Disjoint ({c : Set π.S | c ∈ π.Γ.C ∧ c ⊆ Δ}) ({c : Set π.S | c ∈ π.Γ.C ∧ c ⊆ Δᶜ})) + (hinter_I₁_I₂ : (π.areaGraph Δ).vertexSet ∩ (π.cellsUnion ({c : Set π.S | c ∈ π.Γ.C + ∧ c ⊆ Δᶜ})).vertexSet ⊆ π.borderSet n₁ ∪ + π.borderSet n₂ ∪ {π.nodeVertex n₁, π.nodeVertex n₂, π.nodeVertex n₃}) + (cellG : Set π.S → Hypergraph α β) + (hcellG_c₁ : cellG c₁ = A₁) + (hcellG_c₂ : cellG c₂ = A₂) + (hcellG_I₂ : ∀ {c : Set π.S}, c ∈ ({c : Set π.S | c ∈ π.Γ.C ∧ c ⊆ Δᶜ}) → cellG c + = π.cellGraph c) + (hA₁_le_G : A₁ ≤ G) + (hA₂_le_G : A₂ ≤ G) : + Portrayal G := by + let I₁ := {c : Set π.S | c ∈ π.Γ.C ∧ c ⊆ Δ} + let I₂ := {c : Set π.S | c ∈ π.Γ.C ∧ c ⊆ Δᶜ} + classical + exact + { S := π.S + top := π.top + isSurface := π.isSurface + connected := π.connected + Γ := Γ' + cellGraph := cellG + borderSet := π.borderSet + domγ := π.domγ ∩ Γ'.N + nodeVertex := π.nodeVertex + cellGraph_le := fun c hc => by + rcases hC' ▸ hc with rfl | rfl | hc_I₂ + · rw [hcellG_c₁]; exact hA₁_le_G + · rw [hcellG_c₂]; exact hA₂_le_G + · rw [hcellG_I₂ hc_I₂]; exact π.cellGraph_le c hc_I₂.1 + borderSet_subset := fun n hn => π.borderSet_subset n ⟨hN'_sub hn.1, hn.2⟩ + domγ_subset := inter_subset_right + nodeVertex_mem := fun n hn => π.nodeVertex_mem n hn.1 + nodeVertex_injOn := π.nodeVertex_injOn.mono inter_subset_left + p1_vertex := fun v hv => by + rcases π.p1_vertex v hv with ⟨c, hc, hvc⟩ + rcases hdich c hc with hc_in | hc_out + · have hv_Δ : v ∈ (π.areaGraph Δ).vertexSet := + mem_biUnion ⟨⟨hc, hc_in⟩, hc⟩ hvc + rw [← hsep.vertexSet_union] at hv_Δ + rcases hv_Δ with hv₁ | hv₂ + · exact ⟨c₁, hc₁_mem, hcellG_c₁ ▸ hv₁⟩ + · exact ⟨c₂, hc₂_mem, hcellG_c₂ ▸ hv₂⟩ + · refine ⟨c, hC'.symm ▸ Or.inr (Or.inr ⟨hc, hc_out⟩), ?_⟩ + rw [hcellG_I₂ ⟨hc, hc_out⟩]; exact hvc + p1_edge := fun e he => by + rcases π.p1_edge e he with ⟨c, hc, hec⟩ + rcases hdich c hc with hc_in | hc_out + · have he_Δ : e ∈ (π.areaGraph Δ).edgeSet := + mem_biUnion ⟨⟨hc, hc_in⟩, hc⟩ hec + rw [← hsep.edgeSet_union] at he_Δ + rcases he_Δ with he₁ | he₂ + · exact ⟨c₁, hc₁_mem, hcellG_c₁ ▸ he₁⟩ + · exact ⟨c₂, hc₂_mem, hcellG_c₂ ▸ he₂⟩ + · refine ⟨c, hC'.symm ▸ Or.inr (Or.inr ⟨hc, hc_out⟩), ?_⟩ + rw [hcellG_I₂ ⟨hc, hc_out⟩]; exact hec + p1_disjoint := fun d₁ hd₁ d₂ hd₂ hne_d => by + have hdisj_Δ_I₂ : ∀ {d : Set π.S}, d ∈ I₂ → + Disjoint (π.areaGraph Δ).edgeSet (π.cellGraph d).edgeSet := by + intro d hd + rw [Set.disjoint_left] + intro e heΔ hed + change e ∈ ⋃ c₀ ∈ _, _ at heΔ + rw [mem_iUnion₂] at heΔ + rcases heΔ with ⟨c₀, hc₀, hec₀⟩ + have hc₀_ne : c₀ ≠ d := fun h => Set.disjoint_left.mp hdisj_I hc₀.1 (h ▸ hd) + exact Set.disjoint_left.mp (π.p1_disjoint c₀ hc₀.2 d hd.1 hc₀_ne) hec₀ hed + rcases hC' ▸ hd₁ with rfl | rfl | hd₁_I₂ <;> + rcases hC' ▸ hd₂ with rfl | rfl | hd₂_I₂ + · exact False.elim (hne_d rfl) + · rw [hcellG_c₁, hcellG_c₂]; exact hsep.disjoint_edgeSet + · rw [hcellG_c₁, hcellG_I₂ hd₂_I₂] + exact (hdisj_Δ_I₂ hd₂_I₂).mono_left hsep.left_le.edgeSet_subset + · rw [hcellG_c₂, hcellG_c₁]; exact hsep.disjoint_edgeSet.symm + · exact False.elim (hne_d rfl) + · rw [hcellG_c₂, hcellG_I₂ hd₂_I₂] + exact (hdisj_Δ_I₂ hd₂_I₂).mono_left hsep.right_le.edgeSet_subset + · rw [hcellG_I₂ hd₁_I₂, hcellG_c₁] + exact ((hdisj_Δ_I₂ hd₁_I₂).mono_left hsep.left_le.edgeSet_subset).symm + · rw [hcellG_I₂ hd₁_I₂, hcellG_c₂] + exact ((hdisj_Δ_I₂ hd₁_I₂).mono_left hsep.right_le.edgeSet_subset).symm + · rw [hcellG_I₂ hd₁_I₂, hcellG_I₂ hd₂_I₂] + exact π.p1_disjoint d₁ hd₁_I₂.1 d₂ hd₂_I₂.1 hne_d + p2 := fun c hc n hn => by + rcases hC' ▸ hc with rfl | rfl | hc_I₂ + · rw [hcellG_c₁] + rcases (htilde_c₁ ▸ hn.1 : n ∈ ({n₁, n₂, n₃} : Set π.S)) with rfl | rfl | rfl + · exact hn₁_A₁A₂.1 + · exact hn₂_A₁A₂.1 + · exact hn₃_A₁ + · rw [hcellG_c₂] + exact hbp_c₂_sub_A₂ hn.1 (Or.inr ⟨hn.2.1, rfl⟩) + · rw [hcellG_I₂ hc_I₂] + exact π.p2 c hc_I₂.1 n ⟨hn.1, hn.2.1⟩ + p3_notMem := fun n hn => π.p3_notMem n ⟨hn.1.1, hn.2⟩ + p3_subset := fun c hc hbd n hnt v hv => by + rcases hC' ▸ hc with rfl | rfl | hc_I₂ + · exact False.elim (hc₁_int hbd) + · rw [hcellG_c₂] + exact hbp_c₂_sub_A₂ hnt (Or.inl hv) + · rw [hcellG_I₂ hc_I₂] + exact π.p3_subset c hc_I₂.1 hbd n hnt hv + p4_disjoint := fun Θ₁ hΘ₁ Θ₂ hΘ₂ hne_Θ u₁ hu₁ u₂ hu₂ => + π.p4_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ hne_Θ u₁ ⟨hN'_sub hu₁.1, hu₁.2⟩ u₂ ⟨hN'_sub hu₂.1, hu₂.2⟩ + p4_notMem := fun Θ' hΘ' u₁ hu₁ u₂ hu₂ hnot => + π.p4_notMem Θ' hΘ' u₁ ⟨hN'_sub hu₁.1, hu₁.2⟩ u₂ hu₂.1 hnot + p5 := fun c hc hint v hvc hex => by + rcases hex with ⟨d', hd', hd'_ne, hvd'⟩ + rcases hC' ▸ hc with h1 | h2 | hc_I₂ + · rw [h1, hcellG_c₁] at hvc + have hv_triple : v ∈ ({π.nodeVertex n₁, π.nodeVertex n₂, π.nodeVertex n₃} : Set α) := by + rcases hC' ▸ hd' with hd'₁ | hd'₂ | hd'_I₂ + · exact False.elim (hd'_ne (hd'₁.trans h1.symm)) + · rw [hd'₂, hcellG_c₂] at hvd' + have hv_inter : v ∈ (A₁ ∩ A₂).vertexSet := ⟨hvc, hvd'⟩ + rw [hinter_V] at hv_inter + rcases hv_inter with rfl | rfl <;> simp + · rw [hcellG_I₂ hd'_I₂] at hvd' + have hv_Δ : v ∈ (π.areaGraph Δ).vertexSet := hsep.left_le.vertexSet_subset hvc + have hv_I₂ : v ∈ (π.cellsUnion I₂).vertexSet := + mem_biUnion ⟨hd'_I₂, hd'_I₂.1⟩ hvd' + rcases hinter_I₁_I₂ ⟨hv_Δ, hv_I₂⟩ with hv_bs | hv_tr + · have hv_A₂ : v ∈ A₂.vertexSet := hbs_A₂ hv_bs + have hv_inter : v ∈ (A₁ ∩ A₂).vertexSet := ⟨hvc, hv_A₂⟩ + rw [hinter_V] at hv_inter + rcases hv_inter with rfl | rfl <;> simp + · exact hv_tr + rw [h1] + rcases hv_triple with rfl | rfl | rfl + · have hn₁_t : n₁ ∈ tilde c₁ := htilde_c₁ ▸ Or.inl rfl + exact ⟨n₁, ⟨hn₁_t, hn₁_dom, htilde_c₁_N' hn₁_t⟩, rfl⟩ + · have hn₂_t : n₂ ∈ tilde c₁ := htilde_c₁ ▸ Or.inr (Or.inl rfl) + exact ⟨n₂, ⟨hn₂_t, hn₂_dom, htilde_c₁_N' hn₂_t⟩, rfl⟩ + · have hn₃_t : n₃ ∈ tilde c₁ := htilde_c₁ ▸ Or.inr (Or.inr rfl) + exact ⟨n₃, ⟨hn₃_t, hn₃_dom, htilde_c₁_N' hn₃_t⟩, rfl⟩ + · exact False.elim (hint (h2 ▸ hc₂_bd)) + · rw [hcellG_I₂ hc_I₂] at hvc + have hex_π : ∃ d₀ ∈ π.Γ.C, d₀ ≠ c ∧ v ∈ (π.cellGraph d₀).vertexSet := by + rcases hC' ▸ hd' with hd'₁ | hd'₂ | hd'_I₂ + · rw [hd'₁, hcellG_c₁] at hvd' + have hv_Δ : v ∈ (π.areaGraph Δ).vertexSet := hsep.left_le.vertexSet_subset hvd' + change v ∈ ⋃ d₀ ∈ _, _ at hv_Δ + rw [mem_iUnion₂] at hv_Δ + rcases hv_Δ with ⟨d₀, hd₀, hvd₀⟩ + exact ⟨d₀, hd₀.2, fun h => Set.disjoint_left.mp hdisj_I hd₀.1 (h ▸ hc_I₂), hvd₀⟩ + · rw [hd'₂, hcellG_c₂] at hvd' + have hv_Δ : v ∈ (π.areaGraph Δ).vertexSet := hsep.right_le.vertexSet_subset hvd' + change v ∈ ⋃ d₀ ∈ _, _ at hv_Δ + rw [mem_iUnion₂] at hv_Δ + rcases hv_Δ with ⟨d₀, hd₀, hvd₀⟩ + exact ⟨d₀, hd₀.2, fun h => Set.disjoint_left.mp hdisj_I hd₀.1 (h ▸ hc_I₂), hvd₀⟩ + · rw [hcellG_I₂ hd'_I₂] at hvd' + exact ⟨d', hd'_I₂.1, hd'_ne, hvd'⟩ + obtain ⟨n, ⟨hnt, hndom⟩, hnv⟩ := π.p5 c hc_I₂.1 hint v hvc hex_π + exact ⟨n, ⟨hnt, hndom, htilde_I₂ c hc_I₂.1 hc_I₂.2 hnt⟩, hnv⟩ + p6 := fun c hc hbd v hvc hex => by + rcases hex with ⟨d', hd', hd'_ne, hvd'⟩ + rcases hC' ▸ hc with h1 | h2 | hc_I₂ + · exact False.elim (hc₁_int (h1 ▸ hbd)) + · rw [h2, hcellG_c₂] at hvc + have hv_bp : v ∈ π.borderSet n₁ ∪ π.borderSet n₂ ∪ + {π.nodeVertex n₁, π.nodeVertex n₂} := by + rcases hC' ▸ hd' with hd'₁ | hd'₂ | hd'_I₂ + · rw [hd'₁, hcellG_c₁] at hvd' + have hv_inter : v ∈ (A₁ ∩ A₂).vertexSet := ⟨hvd', hvc⟩ + rw [hinter_V] at hv_inter + exact Or.inr hv_inter + · exact False.elim (hd'_ne (hd'₂.trans h2.symm)) + · rw [hcellG_I₂ hd'_I₂] at hvd' + have hv_Δ : v ∈ (π.areaGraph Δ).vertexSet := hsep.right_le.vertexSet_subset hvc + have hv_I₂ : v ∈ (π.cellsUnion I₂).vertexSet := + mem_biUnion ⟨hd'_I₂, hd'_I₂.1⟩ hvd' + rcases hinter_I₁_I₂ ⟨hv_Δ, hv_I₂⟩ with hv_bs | (rfl | rfl | rfl) + · exact Or.inl hv_bs + · exact Or.inr (Or.inl rfl) + · exact Or.inr (Or.inr rfl) + · exact False.elim (hn₃_not_A₂ hvc) + rw [h2] + have hn₁_t : n₁ ∈ tilde c₂ := htilde_c₂ ▸ Or.inl rfl + have hn₂_t : n₂ ∈ tilde c₂ := htilde_c₂ ▸ Or.inr rfl + rcases hv_bp with (hv_bs₁ | hv_bs₂) | (rfl | rfl) + · exact ⟨n₁, hn₁_t, Or.inl hv_bs₁⟩ + · exact ⟨n₂, hn₂_t, Or.inl hv_bs₂⟩ + · exact ⟨n₁, hn₁_t, Or.inr ⟨⟨hn₁_dom, (htilde_c₂_N' hn₁_t).1⟩, rfl⟩⟩ + · exact ⟨n₂, hn₂_t, Or.inr ⟨⟨hn₂_dom, (htilde_c₂_N' hn₂_t).1⟩, rfl⟩⟩ + · rw [hcellG_I₂ hc_I₂] at hvc + have hex_π : ∃ d₀ ∈ π.Γ.C, d₀ ≠ c ∧ v ∈ (π.cellGraph d₀).vertexSet := by + rcases hC' ▸ hd' with hd'₁ | hd'₂ | hd'_I₂ + · rw [hd'₁, hcellG_c₁] at hvd' + have hv_Δ : v ∈ (π.areaGraph Δ).vertexSet := hsep.left_le.vertexSet_subset hvd' + change v ∈ ⋃ d₀ ∈ _, _ at hv_Δ + rw [mem_iUnion₂] at hv_Δ + rcases hv_Δ with ⟨d₀, hd₀, hvd₀⟩ + exact ⟨d₀, hd₀.2, fun h => Set.disjoint_left.mp hdisj_I hd₀.1 (h ▸ hc_I₂), hvd₀⟩ + · rw [hd'₂, hcellG_c₂] at hvd' + have hv_Δ : v ∈ (π.areaGraph Δ).vertexSet := hsep.right_le.vertexSet_subset hvd' + change v ∈ ⋃ d₀ ∈ _, _ at hv_Δ + rw [mem_iUnion₂] at hv_Δ + rcases hv_Δ with ⟨d₀, hd₀, hvd₀⟩ + exact ⟨d₀, hd₀.2, fun h => Set.disjoint_left.mp hdisj_I hd₀.1 (h ▸ hc_I₂), hvd₀⟩ + · rw [hcellG_I₂ hd'_I₂] at hvd' + exact ⟨d', hd'_I₂.1, hd'_ne, hvd'⟩ + obtain ⟨n, hnt, hvn⟩ := π.p6 c hc_I₂.1 hbd v hvc hex_π + have hn_N' : n ∈ Γ'.N := htilde_I₂ c hc_I₂.1 hc_I₂.2 hnt + refine ⟨n, hnt, ?_⟩ + rcases hvn with hv_bs | ⟨hn_dom, hnv⟩ + · exact Or.inl hv_bs + · exact Or.inr ⟨⟨hn_dom, hn_N'⟩, hnv⟩ + p7 := fun Θ' hΘ' u₁ hu₁ u₂ hu₂ u₃ hu₃ u₄ hu₄ hord v hv₁ hv₃ => by + have hv₁' : v ∈ π.borderPlus u₁ := hv₁.imp id (fun ⟨h, hv⟩ => ⟨h.1, hv⟩) + have hv₃' : v ∈ π.borderPlus u₃ := hv₃.imp id (fun ⟨h, hv⟩ => ⟨h.1, hv⟩) + rcases π.p7 Θ' hΘ' u₁ ⟨hN'_sub hu₁.1, hu₁.2⟩ u₂ ⟨hN'_sub hu₂.1, hu₂.2⟩ + u₃ ⟨hN'_sub hu₃.1, hu₃.2⟩ u₄ ⟨hN'_sub hu₄.1, hu₄.2⟩ hord v hv₁' hv₃' with h₂ | h₄ + · exact Or.inl (h₂.imp id (fun ⟨h, hv⟩ => ⟨⟨h, hu₂.1⟩, hv⟩)) + · exact Or.inr (h₄.imp id (fun ⟨h, hv⟩ => ⟨⟨h, hu₄.1⟩, hv⟩)) } + +private theorem area_cells_share_only_frontier_vertices + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {F : Set π.S} + {Δ : Set π.S} + {n₁ : π.S} + {n₂ : π.S} + {n₃ : π.S} + (hF : IsLineWithEnds F n₁ n₂) + (hFbd : F ∩ bd π.S = {n₁, n₂}) + (hFN : F ∩ π.Γ.N = {n₁, n₂, n₃}) + (hΔ : IsClosedDisc Δ) + [T2Space π.S] + (A₁ : Hypergraph α β) + (A₂ : Hypergraph α β) + (hinter_V : (A₁ ∩ A₂).vertexSet = {π.nodeVertex n₁, π.nodeVertex n₂}) + (hn₃_A₁ : π.nodeVertex n₃ ∈ A₁.vertexSet) + (hbs_A₂ : π.borderSet n₁ ∪ π.borderSet n₂ ⊆ A₂.vertexSet) + (Γ' : Painting π.S) + (Θ : Set π.S) + (c₁ : Set π.S) + (c₂ : Set π.S) + (hN'_eq : Γ'.N = π.Γ.N \ Δ ∪ {n₁, n₂, n₃}) + (hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ) + (hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ) + (htilde_I₂ : ∀ c ∈ π.Γ.C, c ⊆ Δᶜ → tilde c ⊆ Γ'.N) + (htilde_c₁ : tilde c₁ = {n₁, n₂, n₃}) + (htilde_c₂ : tilde c₂ = {n₁, n₂}) + (hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S) + (hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S) + (hn₃_FN : n₃ ∈ F ∩ π.Γ.N) + (hn₁_dom : n₁ ∈ π.domγ) + (hn₂_dom : n₂ ∈ π.domγ) + (hn₃_dom : n₃ ∈ π.domγ) + (hne₁₂ : n₁ ≠ n₂) + (hne₃₁ : n₃ ≠ n₁) + (hne₃₂ : n₃ ≠ n₂) + (hn₁_A₁A₂ : π.nodeVertex n₁ ∈ (A₁ ∩ A₂).vertexSet) + (hn₂_A₁A₂ : π.nodeVertex n₂ ∈ (A₁ ∩ A₂).vertexSet) + (hn₃_not_A₂ : π.nodeVertex n₃ ∉ A₂.vertexSet) + (hpart : ({c : Set π.S | c ∈ π.Γ.C ∧ c ⊆ Δ}) ∪ ({c : Set π.S | c ∈ π.Γ.C ∧ c ⊆ Δᶜ}) = π.Γ.C) + (hdisj_I : Disjoint ({c : Set π.S | c ∈ π.Γ.C ∧ c ⊆ Δ}) ({c : Set π.S | c ∈ π.Γ.C ∧ c ⊆ Δᶜ})) : + (π.areaGraph Δ).vertexSet ∩ (π.cellsUnion ({c : Set π.S | c ∈ π.Γ.C + ∧ c ⊆ Δᶜ})).vertexSet ⊆ π.borderSet n₁ ∪ π.borderSet n₂ ∪ + {π.nodeVertex n₁, π.nodeVertex n₂, π.nodeVertex n₃} := by + let I₁ := {c : Set π.S | c ∈ π.Γ.C ∧ c ⊆ Δ} + let I₂ := {c : Set π.S | c ∈ π.Γ.C ∧ c ⊆ Δᶜ} + have hv_inter := theorem_2_1_claim_3 π hpart hdisj_I + have hX_inter : (⋃ c ∈ I₁, tilde c) ∩ (⋃ c ∈ I₂, tilde c) ⊆ {n₁, n₂, n₃} := by + rintro n ⟨hX₁, hX₂⟩ + rw [mem_iUnion₂] at hX₁ hX₂ + rcases hX₁ with ⟨d₁, hd₁, hnd₁⟩ + rcases hX₂ with ⟨d₂, hd₂, hnd₂⟩ + have hnΔ : n ∈ Δ := closure_minimal hd₁.2 hΔ.isClosed hnd₁.1 + have hnN' : n ∈ Γ'.N := htilde_I₂ d₂ hd₂.1 hd₂.2 hnd₂ + rw [hN'_eq] at hnN' + rcases hnN' with ⟨_, hn_notΔ⟩ | hn_triple + · exact False.elim (hn_notΔ hnΔ) + · exact hn_triple + intro v hv + rcases hv_inter hv with ⟨n, ⟨hX, _⟩, rfl⟩ | hY + · right + rcases hX_inter hX with rfl | rfl | rfl <;> simp + · rw [mem_iUnion₂] at hY + rcases hY with ⟨n, ⟨hY₁, hY₂⟩, hvn⟩ + rw [mem_iUnion₂] at hY₁ hY₂ + rcases hY₁ with ⟨d₁, ⟨hd₁, hbd₁⟩, hnd₁⟩ + rcases hY₂ with ⟨d₂, ⟨hd₂, _⟩, hnd₂⟩ + have hn_triple : n ∈ ({n₁, n₂, n₃} : Set π.S) := + hX_inter ⟨mem_biUnion hd₁ hnd₁, mem_biUnion hd₂ hnd₂⟩ + obtain ⟨u₁, v₁, _, htilde₁, _, _, hu₁, hv₁⟩ := π.Γ.border_cell_exists_ends hd₁.1 hbd₁ + have hnbd : n ∈ bd π.S := by + rcases (htilde₁ ▸ hnd₁ : n ∈ ({u₁, v₁} : Set π.S)) with rfl | rfl <;> + [exact hu₁.2; exact hv₁.2] + have hn_pair : n ∈ ({n₁, n₂} : Set π.S) := by + rcases hn_triple with rfl | rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + · exact hFbd ▸ ⟨hn₃_FN.1, hnbd⟩ + rcases hn_pair with rfl | rfl + · exact Or.inl (Or.inl hvn) + · exact Or.inl (Or.inr hvn) + +private theorem replacement_border_linkage + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 4)) (hwarp : π.warp ≤ p) (hθ : 6 * p + 8 < θ) + {F Δ Θ c₂ : Set π.S} {n₁ n₂ : π.S} + (hnorm : π.Γ.IsNormal F) (hF : IsLineWithEnds F n₁ n₂) (hFbd : F ∩ bd π.S = {n₁, n₂}) + (hFN_card : (F ∩ π.Γ.N).ncard = 3) (hΔ : IsClosedDisc Δ) + (hsmall : IsSmallWrt 𝒯 (π.areaGraph Δ)) (hF_bd : F ⊆ discBd Δ) + (hbd_sub : discBd Δ ⊆ F ∪ bd π.S) {A₂ : Hypergraph α β} (hA₂_le : A₂ ≤ π.areaGraph Δ) + (hdom : π.domγ = π.Γ.N) (hΘ : Θ ∈ cuffs π.S) + (hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ) (hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ) (hbd_Θ : discBd Δ ⊆ F ∪ Θ) + (htilde_c₂ : tilde c₂ = {n₁, n₂}) (hΘ_bd : Θ ⊆ bd π.S) + (hbs_le_q : ∀ {n : π.S}, n ∈ π.Γ.N ∩ Θ → (π.borderSet n).ncard ≤ π.warpAt Θ) : + ∀ u₁ ∈ tilde c₂, ∀ u₂ ∈ tilde c₂, u₁ ≠ u₂ → + (π.borderSet u₁).ncard ≤ π.warpAt Θ ∧ (π.borderSet u₂).ncard ≤ π.warpAt Θ ∧ + ((π.borderPlus u₁).ncard = π.warpAt Θ + 1 → (π.borderPlus u₂).ncard = π.warpAt Θ + 1 → + Portrayal.LinkagePairs A₂.skeleton (π.borderPlus u₁) (π.borderPlus u₂) + (π.warpAt Θ + 1) (π.nodeVertex u₁) (π.nodeVertex u₂)) := by + let q := π.warpAt Θ + intro u₁ hu₁ u₂ hu₂ hu_ne + have hu₁_pair : u₁ = n₁ ∨ u₁ = n₂ := by + have h : u₁ ∈ ({n₁, n₂} : Set π.S) := htilde_c₂ ▸ hu₁ + exact h + have hu₂_pair : u₂ = n₁ ∨ u₂ = n₂ := by + have h : u₂ ∈ ({n₁, n₂} : Set π.S) := htilde_c₂ ▸ hu₂ + exact h + have hu₁_Θ : u₁ ∈ π.Γ.N ∩ Θ := by + rcases hu₁_pair with h | h <;> rw [h] <;> assumption + have hu₂_Θ : u₂ ∈ π.Γ.N ∩ Θ := by + rcases hu₂_pair with h | h <;> rw [h] <;> assumption + have hu₁_bd : u₁ ∈ π.Γ.N ∩ bd π.S := ⟨hu₁_Θ.1, hΘ_bd hu₁_Θ.2⟩ + have hu₂_bd : u₂ ∈ π.Γ.N ∩ bd π.S := ⟨hu₂_Θ.1, hΘ_bd hu₂_Θ.2⟩ + refine ⟨hbs_le_q hu₁_Θ, hbs_le_q hu₂_Θ, fun hcard₁ hcard₂ => ?_⟩ + by_cases hq0 : q = 0 + · have hbs₁_le : (π.borderSet u₁).ncard ≤ 0 := hq0 ▸ hbs_le_q hu₁_Θ + have hbs₂_le : (π.borderSet u₂).ncard ≤ 0 := hq0 ▸ hbs_le_q hu₂_Θ + have hbs₁_emp : π.borderSet u₁ = ∅ := + (ncard_eq_zero (hs := π.borderSet_finite hu₁_bd)).mp (Nat.eq_zero_of_le_zero hbs₁_le) + have hbs₂_emp : π.borderSet u₂ = ∅ := + (ncard_eq_zero (hs := π.borderSet_finite hu₂_bd)).mp (Nat.eq_zero_of_le_zero hbs₂_le) + have hu₁_dom : u₁ ∈ π.domγ := hdom ▸ hu₁_Θ.1 + have hu₂_dom : u₂ ∈ π.domγ := hdom ▸ hu₂_Θ.1 + have hbp₁_eq : π.borderPlus u₁ = {π.nodeVertex u₁} := by + ext v; simp [Portrayal.borderPlus, hbs₁_emp, hu₁_dom] + have hbp₂_eq : π.borderPlus u₂ = {π.nodeVertex u₂} := by + ext v; simp [Portrayal.borderPlus, hbs₂_emp, hu₂_dom] + intro L _ + exact ⟨0, mem_singleton_iff.mp (hbp₁_eq ▸ (L 0).first_mem), + mem_singleton_iff.mp (hbp₂_eq ▸ (L 0).last_mem)⟩ + · have hq_le_p : q ≤ p := (π.warpAt_le_warp hΘ).trans hwarp + have hθ_67 : (2 * p + 4) + max 3 (2 * p + 2) < θ := by omega + have hpair_eq : ({u₁, u₂} : Set π.S) = {n₁, n₂} := by + rcases hu₁_pair with h1 | h1 <;> rcases hu₂_pair with h2 | h2 + · exact False.elim (hu_ne (h1.trans h2.symm)) + · rw [h1, h2] + · rw [h1, h2]; exact pair_comm n₂ n₁ + · exact False.elim (hu_ne (h1.trans h2.symm)) + have hF_u : IsLineWithEnds F u₁ u₂ := by + rcases hu₁_pair with h1 | h1 <;> rcases hu₂_pair with h2 | h2 + · exact False.elim (hu_ne (h1.trans h2.symm)) + · rw [h1, h2]; exact hF + · rw [h1, h2]; exact isLineWithEnds_symm hF + · exact False.elim (hu_ne (h1.trans h2.symm)) + have hFbd_u : F ∩ bd π.S = {u₁, u₂} := hFbd.trans hpair_eq.symm + have hFγ_le : 2 * p + 1 ≤ 2 * p + 4 ∧ (F ∩ π.domγ).ncard ≤ (2 * p + 4) - 2 * p - 1 := by + rw [hdom, hFN_card] + omega + have hinter_bd : ∀ n ∈ π.Γ.N ∩ (Θ ∩ discBd Δ), + π.borderPlus u₁ ∩ π.borderPlus u₂ ⊆ π.borderPlus n := by + rintro n ⟨hnN, hnΘ, hnbd⟩ + have hnΔ : n ∈ Δ := discBd_subset Δ hnbd + have hn_bdS : n ∈ bd π.S := hΘ_bd hnΘ + exact theorem_6_7_proof + h𝒯 π htrue.1 hwarp hred hθ_67 + hnorm hF_u hFbd_u hFγ_le hΔ hF_bd hbd_sub hsmall + ⟨⟨hnN, hnΔ⟩, hn_bdS⟩ + have hlink_Δ : Portrayal.LinkagePairs (π.areaGraph Δ).skeleton + (π.borderPlus u₁) (π.borderPlus u₂) (q + 1) + (π.nodeVertex u₁) (π.nodeVertex u₂) := + linkage_pairs_of_boundary_cut π hΘ hu₁_Θ hu₂_Θ hu_ne hnorm hF_u hFbd_u + hΔ hF_bd hbd_Θ hinter_bd le_rfl hcard₁ hcard₂ + intro L hL_disj + have hstep_A₂ : ∀ {a b : α}, A₂.skeleton.Adj a b → (π.areaGraph Δ).skeleton.Adj a b := by + rintro a b ⟨hab, e, hinca, hincb⟩ + have he_A₂ : e ∈ A₂.edgeSet := A₂.edge_mem_of_inc hinca + have he_Δ : e ∈ (π.areaGraph Δ).edgeSet := hA₂_le.edgeSet_subset he_A₂ + have hinca_Δ : (π.areaGraph Δ).Inc e a := + (inc_iff_of_le hA₂_le he_A₂).mp hinca + have hincb_Δ : (π.areaGraph Δ).Inc e b := + (inc_iff_of_le hA₂_le he_A₂).mp hincb + exact ⟨hab, e, hinca_Δ, hincb_Δ⟩ + have hlift_A₂ : ∀ {a b : α} (w : A₂.skeleton.Walk a b), + ∃ w' : (π.areaGraph Δ).skeleton.Walk a b, w'.support = w.support := by + intro a b w + induction w with + | nil => exact ⟨.nil, rfl⟩ + | @cons a x b hadj tail ih => + obtain ⟨tail', hsup⟩ := ih + refine ⟨.cons (hstep_A₂ hadj) tail', ?_⟩ + dsimp [SimpleGraph.Walk.support] + rw [hsup] + let L' : Fin (q + 1) → + PathFromTo (π.areaGraph Δ).skeleton (π.borderPlus u₁) (π.borderPlus u₂) := fun i => + let w' := Classical.choose (hlift_A₂ (L i).walk) + have hw'_sup : w'.support = (L i).walk.support := + Classical.choose_spec (hlift_A₂ (L i).walk) + { first := (L i).first + last := (L i).last + walk := w' + isPath := by + rw [SimpleGraph.Walk.isPath_def, hw'_sup] + exact (L i).isPath.support_nodup + first_mem := (L i).first_mem + last_mem := (L i).last_mem } + have hL'_disj : Pairwise fun i j => + Disjoint {z | z ∈ (L' i).walk.support} {z | z ∈ (L' j).walk.support} := by + intro i j hij + have hi : (L' i).walk.support = (L i).walk.support := + Classical.choose_spec (hlift_A₂ (L i).walk) + have hj : (L' j).walk.support = (L j).walk.support := + Classical.choose_spec (hlift_A₂ (L j).walk) + simpa only [hi, hj] using hL_disj hij + exact hlink_Δ L' hL'_disj + +private theorem replacement_does_not_increase_internal_cells + {S : Type} [TopologicalSpace S] (Γ Γ' : Painting S) + {Δ c₀ c₁ c₂ : Set S} (hc₀ : c₀ ∈ Γ.C) (hc₀_int : ¬ (c₀ ∩ bd S).Nonempty) + (hc₀_card : (tilde c₀).ncard = 3) (hc₁_int : ¬ (c₁ ∩ bd S).Nonempty) + (hc₁_card : (tilde c₁).ncard = 3) (hc₂_bd : (c₂ ∩ bd S).Nonempty) + (hc₀_not_I₂ : c₀ ∉ {c | c ∈ Γ.C ∧ c ⊆ Δᶜ}) + (hc₁_not_I₂ : c₁ ∉ {c | c ∈ Γ.C ∧ c ⊆ Δᶜ}) + (hC' : Γ'.C = insert c₁ (insert c₂ {c | c ∈ Γ.C ∧ c ⊆ Δᶜ})) : + {c ∈ Γ'.C | ¬ (c ∩ bd S).Nonempty ∧ (tilde c).ncard = 3}.ncard ≤ + {c ∈ Γ.C | ¬ (c ∩ bd S).Nonempty ∧ (tilde c).ncard = 3}.ncard := by + let I₂ := {c | c ∈ Γ.C ∧ c ⊆ Δᶜ} + let B₀ := {c ∈ I₂ | ¬ (c ∩ bd S).Nonempty ∧ (tilde c).ncard = 3} + have hB₀_fin : B₀.Finite := Γ.finite_cells.subset fun _ h => h.1.1 + have hset_new : {c ∈ Γ'.C | ¬ (c ∩ bd S).Nonempty ∧ (tilde c).ncard = 3} = + insert c₁ B₀ := by + ext c + simp only [B₀, mem_ofPred_eq, hC', mem_insert_iff] + constructor + · rintro ⟨rfl | rfl | hc_I₂, hint, hcard_c⟩ + · exact Or.inl rfl + · exact False.elim (hint hc₂_bd) + · exact Or.inr ⟨hc_I₂, hint, hcard_c⟩ + · rintro (rfl | ⟨hc_I₂, hint, hcard_c⟩) + · exact ⟨Or.inl rfl, hc₁_int, hc₁_card⟩ + · exact ⟨Or.inr (Or.inr hc_I₂), hint, hcard_c⟩ + have hc₁_not_B₀ : c₁ ∉ B₀ := fun h => hc₁_not_I₂ h.1 + have hsub_old : insert c₀ B₀ ⊆ + {c ∈ Γ.C | ¬ (c ∩ bd S).Nonempty ∧ (tilde c).ncard = 3} := by + rintro c (rfl | ⟨hc_I₂, hint, hcard_c⟩) + · exact ⟨hc₀, hc₀_int, hc₀_card⟩ + · exact ⟨hc_I₂.1, hint, hcard_c⟩ + have hc₀_not_B₀ : c₀ ∉ B₀ := fun h => hc₀_not_I₂ h.1 + rw [hset_new, ncard_insert_of_notMem hc₁_not_B₀ hB₀_fin] + have hle_old := ncard_le_ncard hsub_old (Γ.finite_cells.subset fun _ h => h.1) + rw [ncard_insert_of_notMem hc₀_not_B₀ hB₀_fin] at hle_old + exact hle_old + +private theorem replacement_preserves_truth_profile + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (π' : Portrayal G) + (hπ'_central : π'.IsCentral 𝒯) + (hπ'_resembles : π'.Resembles π) + (htruth_le : ∀ (i : Fin 6), π'.truth i ≤ π.truth i) : + ∀ (i : Fin 6), π'.truth i = π.truth i := by + intro i + refine le_antisymm (htruth_le i) ?_ + by_contra hlt + have hex_lt : ∃ k : Fin 6, π'.truth k < π.truth k := ⟨i, lt_of_not_ge hlt⟩ + have hex_nat : ∃ n, ∃ hn : n < 6, π'.truth ⟨n, hn⟩ < π.truth ⟨n, hn⟩ := by + rcases hex_lt with ⟨⟨n, hn⟩, h⟩ + exact ⟨n, hn, h⟩ + let m := Nat.find hex_nat + obtain ⟨hm6, hm_lt⟩ := Nat.find_spec hex_nat + have htruer : π'.IsTruer π := by + refine ⟨⟨m, hm6⟩, fun j hj => ?_, hm_lt⟩ + apply le_antisymm (htruth_le j) + by_contra hlt_j + exact Nat.find_min hex_nat hj ⟨j.2, lt_of_not_ge hlt_j⟩ + exact htrue.2.2 π' hπ'_central htruer hπ'_resembles + +private theorem replacement_portrayal_keeps_all_disc_nodes + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {θ : ℕ} + {p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 4)) + (hwarp : π.warp ≤ p) + (hθ : 6 * p + 8 < θ) + {F : Set π.S} + {Δ : Set π.S} + {c₀ : Set π.S} + {n₁ : π.S} + {n₂ : π.S} + {n₃ : π.S} + (hnorm : π.Γ.IsNormal F) + (hF : IsLineWithEnds F n₁ n₂) + (hFbd : F ∩ bd π.S = {n₁, n₂}) + (hFN : F ∩ π.Γ.N = {n₁, n₂, n₃}) + (hFN_card : (F ∩ π.Γ.N).ncard = 3) + (hΔ : IsClosedDisc Δ) + (hsmall : IsSmallWrt 𝒯 (π.areaGraph Δ)) + (hF_bd : F ⊆ discBd Δ) + (hbd_sub : discBd Δ ⊆ F ∪ bd π.S) + (hc₀ : c₀ ∈ π.Γ.C) + (hc₀_Δ : c₀ ⊆ Δ) + (hc₀_card : (tilde c₀).ncard = 3) + [T2Space π.S] + (A₁ : Hypergraph α β) + (A₂ : Hypergraph α β) + (hsep : (π.areaGraph Δ).IsSeparation A₁ A₂) + (hinter_V : (A₁ ∩ A₂).vertexSet = {π.nodeVertex n₁, π.nodeVertex n₂}) + (hn₃_A₁ : π.nodeVertex n₃ ∈ A₁.vertexSet) + (hbs_A₂ : π.borderSet n₁ ∪ π.borderSet n₂ ⊆ A₂.vertexSet) + (hθ3 : 4 * p + 5 < θ) + (hdom : π.domγ = π.Γ.N) + (Γ' : Painting π.S) + (Θ : Set π.S) + (c₁ : Set π.S) + (c₂ : Set π.S) + (hN'_eq : Γ'.N = π.Γ.N \ Δ ∪ {n₁, n₂, n₃}) + (hN'_sub : Γ'.N ⊆ π.Γ.N) + (hΘ : Θ ∈ cuffs π.S) + (hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ) + (hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ) + (hbd_Θ : discBd Δ ⊆ F ∪ Θ) + (hdich : ∀ c ∈ π.Γ.C, c ⊆ Δ ∨ c ⊆ Δᶜ) + (htilde_I₂ : ∀ c ∈ π.Γ.C, c ⊆ Δᶜ → tilde c ⊆ Γ'.N) + (hc₁_mem : c₁ ∈ Γ'.C) + (hc₁_int : ¬(c₁ ∩ bd π.S).Nonempty) + (htilde_c₁ : tilde c₁ = {n₁, n₂, n₃}) + (hc₂_mem : c₂ ∈ Γ'.C) + (hc₂_Θ : (c₂ ∩ Θ).Nonempty) + (htilde_c₂ : tilde c₂ = {n₁, n₂}) + (hc₁_ne_c₂ : c₁ ≠ c₂) + (hc₁_not_I₂ : c₁ ∉ {c | c ∈ π.Γ.C ∧ c ⊆ Δᶜ}) + (hc₂_not_I₂ : c₂ ∉ {c | c ∈ π.Γ.C ∧ c ⊆ Δᶜ}) + (hC' : Γ'.C = insert c₁ (insert c₂ {c | c ∈ π.Γ.C ∧ c ⊆ Δᶜ})) + (hΘ_bd : Θ ⊆ bd π.S) + (hc₂_bd : (c₂ ∩ bd π.S).Nonempty) + (hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S) + (hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S) + (hn₃_FN : n₃ ∈ F ∩ π.Γ.N) + (hn₁_dom : n₁ ∈ π.domγ) + (hn₂_dom : n₂ ∈ π.domγ) + (hn₃_dom : n₃ ∈ π.domγ) + (hne₁₂ : n₁ ≠ n₂) + (hne₃₁ : n₃ ≠ n₁) + (hne₃₂ : n₃ ≠ n₂) + (hn₁_A₁A₂ : π.nodeVertex n₁ ∈ (A₁ ∩ A₂).vertexSet) + (hn₂_A₁A₂ : π.nodeVertex n₂ ∈ (A₁ ∩ A₂).vertexSet) + (hn₃_not_A₂ : π.nodeVertex n₃ ∉ A₂.vertexSet) + (hbp_c₂_sub_A₂ : ∀ {n : π.S}, n ∈ tilde c₂ → π.borderPlus n ⊆ A₂.vertexSet) + (htilde_c₂_N' : tilde c₂ ⊆ Γ'.N ∩ bd π.S) + (htilde_c₁_N' : tilde c₁ ⊆ Γ'.N) + (hdisj_I : Disjoint ({c | c ∈ π.Γ.C ∧ c ⊆ Δ}) ({c | c ∈ π.Γ.C ∧ c ⊆ Δᶜ})) + (hinter_I₁_I₂ : (π.areaGraph Δ).vertexSet ∩ (π.cellsUnion ({c | c ∈ π.Γ.C ∧ c ⊆ + Δᶜ})).vertexSet ⊆ π.borderSet n₁ ∪ π.borderSet n₂ ∪ {π.nodeVertex n₁, π.nodeVertex n₂, + π.nodeVertex n₃}) + (cellG : Set π.S → Hypergraph α β) + (hcellG_c₁ : cellG c₁ = A₁) + (hcellG_c₂ : cellG c₂ = A₂) + (hcellG_I₂ : ∀ {c : Set π.S}, c ∈ ({c | c ∈ π.Γ.C ∧ c ⊆ Δᶜ}) → cellG c = π.cellGraph c) + (hA₁_le_G : A₁ ≤ G) + (hA₂_le_G : A₂ ≤ G) : + tilde c₀ = Δ ∩ π.Γ.N := by + let I₁ := {c | c ∈ π.Γ.C ∧ c ⊆ Δ} + let I₂ := {c | c ∈ π.Γ.C ∧ c ⊆ Δᶜ} + let π' : Portrayal G := + portrayal_after_two_cell_replacement (α := α) (β := β) (G := G) π (F := F) (Δ := Δ) + (n₁ := n₁) (n₂ := n₂) (n₃ := n₃) hF hFbd hFN A₁ A₂ hsep hinter_V hn₃_A₁ hbs_A₂ Γ' Θ c₁ c₂ + hN'_eq hN'_sub hn₁_Θ hn₂_Θ hdich htilde_I₂ hc₁_mem hc₁_int htilde_c₁ hc₂_mem hc₂_Θ + htilde_c₂ hc₁_ne_c₂ hc₁_not_I₂ hc₂_not_I₂ hC' hc₂_bd hn₁_bd hn₂_bd hn₃_FN hn₁_dom + hn₂_dom hn₃_dom hne₁₂ hne₃₁ hne₃₂ hn₁_A₁A₂ hn₂_A₁A₂ hn₃_not_A₂ hbp_c₂_sub_A₂ htilde_c₂_N' + htilde_c₁_N' hdisj_I hinter_I₁_I₂ cellG hcellG_c₁ hcellG_c₂ hcellG_I₂ hA₁_le_G hA₂_le_G + have hbp'_eq : ∀ {n : π.S}, n ∈ Γ'.N → π'.borderPlus n = π.borderPlus n := by + intro n hn + ext v + change (v ∈ π.borderSet n ∨ n ∈ π.domγ ∩ Γ'.N ∧ v = π.nodeVertex n) ↔ + (v ∈ π.borderSet n ∨ n ∈ π.domγ ∧ v = π.nodeVertex n) + exact or_congr_right ⟨fun ⟨h, hv⟩ => ⟨h.1, hv⟩, fun ⟨h, hv⟩ => ⟨⟨h, hn⟩, hv⟩⟩ + have hcw_I₂ : ∀ {c : Set π.S}, c ∈ I₂ → (c ∩ bd π.S).Nonempty → + π'.cellWarp c = π.cellWarp c := by + intro c hc_I₂ _ + have hcg : π'.cellGraph c = π.cellGraph c := hcellG_I₂ hc_I₂ + have hnt_N' : ∀ {n : π.S}, n ∈ tilde c → n ∈ Γ'.N := + fun hn => htilde_I₂ c hc_I₂.1 hc_I₂.2 hn + have hiff : ∀ q : ℕ, π'.CellWarpLE c q ↔ π.CellWarpLE c q := by + intro q + simp only [Portrayal.CellWarpLE, hcg] + refine forall₂_congr fun u₁ hu₁ => forall₂_congr fun u₂ hu₂ => + forall_congr' fun _ => ?_ + rw [hbp'_eq (hnt_N' hu₁), hbp'_eq (hnt_N' hu₂)] + change sInf {p | π'.CellWarpLE c p} = sInf {p | π.CellWarpLE c p} + congr 1; ext p; exact hiff p + let q := π.warpAt Θ + have hΘ_arc : IsOArc Θ := (cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + have hbs_le_q : ∀ {n : π.S}, n ∈ π.Γ.N ∩ Θ → (π.borderSet n).ncard ≤ q := by + intro n hn_Θ + obtain ⟨E⟩ := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + have hn_range : n ∈ Set.range E.node := by rw [E.range_node]; exact hn_Θ + rcases hn_range with ⟨i, rfl⟩ + have hc_range : E.cell i ∈ {d ∈ π.Γ.C | (d ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self i + have hbd_c : (E.cell i ∩ bd π.S).Nonempty := + hc_range.2.mono (inter_subset_inter_right _ hΘ_bd) + have hn_t : E.node i ∈ tilde (E.cell i) := by + rw [E.cell_tilde i]; exact mem_insert _ _ + exact (π.ncard_borderSet_le_cellWarp hc_range.1 hbd_c hn_t).trans + (π.cellWarp_le_warpAt hc_range.1 hc_range.2) + have hcw_c₂ : π'.cellWarp c₂ ≤ q := by + apply csInf_le (OrderBot.bddBelow _) + intro u₁ hu₁ u₂ hu₂ hu_ne + have hcg_c₂ : π'.cellGraph c₂ = A₂ := hcellG_c₂ + rw [hbp'_eq (htilde_c₂_N' hu₁).1, hbp'_eq (htilde_c₂_N' hu₂).1, hcg_c₂] + exact replacement_border_linkage h𝒯 π htrue hred hwarp hθ hnorm hF hFbd hFN_card + hΔ hsmall hF_bd hbd_sub hsep.right_le hdom hΘ hn₁_Θ hn₂_Θ hbd_Θ htilde_c₂ hΘ_bd + hbs_le_q u₁ hu₁ u₂ hu₂ hu_ne + have hwarpAt_le : ∀ Θ' ∈ cuffs π.S, π'.warpAt Θ' ≤ π.warpAt Θ' := by + intro Θ' hΘ' + apply csSup_le' + rintro r ⟨c, hc_mem, hc_Θ', rfl⟩ + have hΘ'_bd : Θ' ⊆ bd π.S := by + rcases hΘ' with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hbd_c : (c ∩ bd π.S).Nonempty := hc_Θ'.mono (inter_subset_inter_right _ hΘ'_bd) + rcases hC' ▸ hc_mem with h1 | h2 | hc_I₂ + · exact False.elim (hc₁_int (h1 ▸ hbd_c)) + · have hΘ'_eq : Θ' = Θ := + (Γ'.border_cell_subset_cuff hc₂_mem hΘ hc₂_Θ).2.2.2.2 Θ' hΘ' (h2 ▸ hc_Θ') + rw [h2, hΘ'_eq] + exact hcw_c₂ + · rw [hcw_I₂ hc_I₂ hbd_c] + exact π.cellWarp_le_warpAt hc_I₂.1 hc_Θ' + have hwarp' : π'.warp ≤ p := by + have hne_cuffs : (cuffs π'.S).Nonempty := ⟨Θ, hΘ⟩ + have hSup_bdd : ∀ r ∈ {r | ∃ Θ' ∈ cuffs π'.S, r = π'.warpAt Θ'}, r ≤ p := by + rintro r ⟨Θ', hΘ', rfl⟩ + exact (hwarpAt_le Θ' hΘ').trans ((π.warpAt_le_warp hΘ').trans hwarp) + unfold Portrayal.warp + rw [ite_eq_left hne_cuffs] + exact max_le (π.one_le_warp.trans hwarp) (csSup_le ⟨π'.warpAt Θ, Θ, hΘ, rfl⟩ hSup_bdd) + have hπ'_central : π'.IsCentral 𝒯 := by + intro c hc_mem + have hatt_lt : (attachments G (π'.cellGraph c)).ncard < θ := by + have hle := π'.ncard_attachments_cellGraph_le hwarp' hc_mem + omega + change IsSmallWrt 𝒯 (cellG c) + change (attachments G (cellG c)).ncard < θ at hatt_lt + rcases hC' ▸ hc_mem with h1 | h2 | hc_I₂ + · rw [h1, hcellG_c₁] at hatt_lt ⊢ + exact hsmall.mono h𝒯 hsep.left_le hatt_lt + · rw [h2, hcellG_c₂] at hatt_lt ⊢ + exact hsmall.mono h𝒯 hsep.right_le hatt_lt + · rw [hcellG_I₂ hc_I₂] + exact htrue.1 c hc_I₂.1 + have hzero_red : π.IsZeroRedundant 𝒯 := hred.isZeroRedundant h𝒯 + have hwarpAt_eq : ∀ Θ' ∈ cuffs π.S, π'.warpAt Θ' = π.warpAt Θ' := by + intro Θ' hΘ' + refine le_antisymm (hwarpAt_le Θ' hΘ') ?_ + by_contra hlt + have hlt' : π'.warpAt Θ' < π.warpAt Θ' := lt_of_not_ge hlt + have hsimpler : π'.IsSimpler π := by + right + refine ⟨Homeomorph.refl π.S, ?_, Θ', hΘ', ?_⟩ + · intro Θ'' hΘ'' + rw [Homeomorph.refl_apply, image_id] + exact hwarpAt_le Θ'' hΘ'' + · rw [Homeomorph.refl_apply, image_id] + exact hlt' + exact hzero_red π' hπ'_central hsimpler + have hπ'_resembles : π'.Resembles π := by + refine ⟨Homeomorph.refl π.S, fun Θ' hΘ' => ?_⟩ + rw [Homeomorph.refl_apply, image_id] + exact hwarpAt_eq Θ' hΘ' + -- Compare `π'.truth` and `π.truth`. + have hc₁_card : (tilde c₁).ncard = 3 := by + rw [← hFN_card, hFN, htilde_c₁] + have htruth_sub_pos : ∀ i : Fin 6, 0 < i.1 → i.1 < 4 → + {c ∈ Γ'.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - i.1} ⊆ + {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - i.1} := by + intro i hi_pos _ c ⟨hc_mem, hint, hcard_c⟩ + have hne₁ : c ≠ c₁ := by + rintro rfl + omega + have hne₂ : c ≠ c₂ := fun h => hint (h ▸ hc₂_bd) + exact ⟨(((hC' ▸ hc_mem).resolve_left hne₁).resolve_left hne₂).1, hint, hcard_c⟩ + have hc₀_int : ¬ (c₀ ∩ bd π.S).Nonempty := by + intro hbd₀ + obtain ⟨u₀, v₀, hne_uv, htilde₀, _, _, _, _⟩ := π.Γ.border_cell_exists_ends hc₀ hbd₀ + have h2 : (tilde c₀).ncard = 2 := by rw [htilde₀, ncard_pair hne_uv] + omega + have htruth_le_0 : π'.truth 0 ≤ π.truth 0 := by + simp only [Portrayal.truth, Fin.val_zero, Nat.sub_zero, show (0 : ℕ) < 4 by decide, ↓reduceIte] + exact replacement_does_not_increase_internal_cells π.Γ Γ' hc₀ hc₀_int hc₀_card hc₁_int + hc₁_card hc₂_bd (fun hc => Set.disjoint_left.mp hdisj_I ⟨hc₀, hc₀_Δ⟩ hc) hc₁_not_I₂ hC' + have htruth_le : ∀ i : Fin 6, π'.truth i ≤ π.truth i := by + intro i + by_cases hi0 : i = 0 + · exact hi0 ▸ htruth_le_0 + · have hi_pos : 0 < i.1 := Nat.pos_of_ne_zero (fun h => hi0 (Fin.ext h)) + simp only [Portrayal.truth] + split_ifs with h4 h5 + · exact ncard_le_ncard (htruth_sub_pos i hi_pos h4) + (π.Γ.finite_cells.subset fun _ h => h.1) + · exact ncard_le_ncard (sdiff_subset_sdiff hN'_sub Subset.rfl) + (π.Γ.finite_N.subset sdiff_subset) + · exact ncard_le_ncard (inter_subset_inter_left _ hN'_sub) + (π.Γ.finite_N.subset inter_subset_left) + have htruth_eq : ∀ i : Fin 6, π'.truth i = π.truth i := by + exact replacement_preserves_truth_profile (α := α) (β := β) (G := G) (𝒯 := 𝒯) π htrue π' + hπ'_central hπ'_resembles htruth_le + have hN_int_eq : Γ'.N \ bd π.S = π.Γ.N \ bd π.S := by + apply eq_of_subset_of_ncard_le (sdiff_subset_sdiff hN'_sub Subset.rfl) _ + (π.Γ.finite_N.subset sdiff_subset) + have htr := htruth_eq ⟨4, by decide⟩ + simp only [Portrayal.truth] at htr + exact htr.ge + have hN_bd_eq : Γ'.N ∩ bd π.S = π.Γ.N ∩ bd π.S := by + apply eq_of_subset_of_ncard_le (inter_subset_inter_left _ hN'_sub) _ + (π.Γ.finite_N.subset inter_subset_left) + have htr := htruth_eq ⟨5, by decide⟩ + simp only [Portrayal.truth] at htr + exact htr.ge + have hN_eq_all : Γ'.N = π.Γ.N := by + refine Subset.antisymm hN'_sub fun x hx => ?_ + by_cases hxbd : x ∈ bd π.S + · have hx' : x ∈ π.Γ.N ∩ bd π.S := ⟨hx, hxbd⟩ + rw [← hN_bd_eq] at hx' + exact hx'.1 + · have hx' : x ∈ π.Γ.N \ bd π.S := ⟨hx, hxbd⟩ + rw [← hN_int_eq] at hx' + exact hx'.1 + have hΔ_N_sub : Δ ∩ π.Γ.N ⊆ {n₁, n₂, n₃} := by + rintro x ⟨hxΔ, hxN⟩ + have hxN' : x ∈ Γ'.N := hN_eq_all.symm ▸ hxN + rw [hN'_eq] at hxN' + rcases hxN' with ⟨_, hx_notΔ⟩ | hx_tr + · exact False.elim (hx_notΔ hxΔ) + · exact hx_tr + have htc₀_sub : tilde c₀ ⊆ Δ ∩ π.Γ.N := + fun x hx => ⟨closure_minimal hc₀_Δ hΔ.isClosed hx.1, π.Γ.tilde_subset_N hc₀ hx⟩ + have hΔ_N_fin : (Δ ∩ π.Γ.N).Finite := π.Γ.finite_N.inter_of_right Δ + have hΔ_N_le3 : (Δ ∩ π.Γ.N).ncard ≤ 3 := by + have hfin_tr : ({n₁, n₂, n₃} : Set π.S).Finite := by + rw [← hFN]; exact π.Γ.finite_N.inter_of_right F + calc (Δ ∩ π.Γ.N).ncard + _ ≤ ({n₁, n₂, n₃} : Set π.S).ncard := ncard_le_ncard hΔ_N_sub hfin_tr + _ = 3 := by rw [← hFN, hFN_card] + exact eq_of_subset_of_ncard_le htc₀_sub (by omega) hΔ_N_fin + +/-- **Graph Minors XVII, (11.3)** (pages 192–193): +"Let $F \subseteq \Sigma$ be a $\Gamma$-normal $I$-arc with $F \cap N(\Gamma) = \{n_1, n_2, n_3\}$, +where $F$ has ends $n_1, n_2$, and let $\Delta \subseteq \Sigma$ be the disc with $\alpha(\Delta)$ +small and $F \subseteq \operatorname{bd}(\Delta) \subseteq F \cup \operatorname{bd}(\Sigma)$. +Suppose that there is a cell $c_0 \subseteq \Delta$ with $|\tilde{c}_0| = 3$. Then either +(i) $\tilde{c}_0 = \Delta \cap N(\Gamma)$ or +(ii) there is no separation $(A_1, A_2)$ of $\alpha(\Delta)$ with +$V(A_1 \cap A_2) = \{\gamma(n_1), \gamma(n_2)\}$, $\gamma(n_3) \in V(A_1)$, and +$\beta(n_1) \cup \beta(n_2) \subseteq V(A_2)$." -/ +theorem theorem_11_3_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 4)) + (hwarp : π.warp ≤ p) + (hθ : 6 * p + 8 < θ) + {F Δ c₀ : Set π.S} {n₁ n₂ n₃ : π.S} + (hnorm : π.Γ.IsNormal F) (hF : IsLineWithEnds F n₁ n₂) + (hFbd : F ∩ bd π.S = {n₁, n₂}) + (hFN : F ∩ π.Γ.N = {n₁, n₂, n₃}) (hFN_card : (F ∩ π.Γ.N).ncard = 3) + (hΔ : IsClosedDisc Δ) (hsmall : IsSmallWrt 𝒯 (π.areaGraph Δ)) + (hF_bd : F ⊆ discBd Δ) (hbd_sub : discBd Δ ⊆ F ∪ bd π.S) + (hc₀ : c₀ ∈ π.Γ.C) (hc₀_Δ : c₀ ⊆ Δ) (hc₀_card : (tilde c₀).ncard = 3) : + tilde c₀ = Δ ∩ π.Γ.N ∨ + ¬ ∃ A₁ A₂ : Hypergraph α β, + (π.areaGraph Δ).IsSeparation A₁ A₂ ∧ + (A₁ ∩ A₂).vertexSet = {π.nodeVertex n₁, π.nodeVertex n₂} ∧ + π.nodeVertex n₃ ∈ A₁.vertexSet ∧ + π.borderSet n₁ ∪ π.borderSet n₂ ⊆ A₂.vertexSet := by + classical + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have : ConnectedSpace π.S := π.connected + by_cases hex_sep : ∃ A₁ A₂ : Hypergraph α β, + (π.areaGraph Δ).IsSeparation A₁ A₂ ∧ + (A₁ ∩ A₂).vertexSet = {π.nodeVertex n₁, π.nodeVertex n₂} ∧ + π.nodeVertex n₃ ∈ A₁.vertexSet ∧ + π.borderSet n₁ ∪ π.borderSet n₂ ⊆ A₂.vertexSet + · left + rcases hex_sep with ⟨A₁, A₂, hsep, hinter_V, hn₃_A₁, hbs_A₂⟩ + have hred3 : π.IsRedundant 𝒯 θ (2 * p + 3) := hred.mono (by omega) + have hθ3 : 4 * p + 5 < θ := by omega + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof + h𝒯 π htrue hred3 hwarp hθ3 + obtain ⟨Γ', Θ, c₁, c₂, + hN'_eq, hN'_sub, hΘ, hn₁_Θ, hn₂_Θ, hbd_Θ, hdich, htilde_I₂, + hc₁_mem, hc₁_int, htilde_c₁, + hc₂_mem, hc₂_Θ, htilde_c₂, + hc₁_ne_c₂, hc₁_not_I₂, hc₂_not_I₂, hC'⟩ := + GraphMinor.GM17.threeNodeIArcReplaceDisc π.S π.isSurface π.Γ n₁ n₂ n₃ F Δ hnorm hF hFbd hFN + hFN_card hΔ hF_bd hbd_sub + let I₁ : Set (Set π.S) := {c ∈ π.Γ.C | c ⊆ Δ} + let I₂ : Set (Set π.S) := {c ∈ π.Γ.C | c ⊆ Δᶜ} + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hc₂_bd : (c₂ ∩ bd π.S).Nonempty := hc₂_Θ.mono (inter_subset_inter_right _ hΘ_bd) + have hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S := ⟨hn₁_Θ.1, hΘ_bd hn₁_Θ.2⟩ + have hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S := ⟨hn₂_Θ.1, hΘ_bd hn₂_Θ.2⟩ + have hn₃_FN : n₃ ∈ F ∩ π.Γ.N := hFN ▸ Or.inr (Or.inr rfl) + have hn₁_dom : n₁ ∈ π.domγ := hdom ▸ hn₁_Θ.1 + have hn₂_dom : n₂ ∈ π.domγ := hdom ▸ hn₂_Θ.1 + have hn₃_dom : n₃ ∈ π.domγ := hdom ▸ hn₃_FN.2 + have hne₁₂ : n₁ ≠ n₂ := ne_of_isLineWithEnds hF + have hne₃₁ : n₃ ≠ n₁ := by + rintro rfl + have hsub : F ∩ π.Γ.N ⊆ {n₃, n₂} := by + rw [hFN] + rintro x (rfl | rfl | rfl) <;> simp + have hle : (F ∩ π.Γ.N).ncard ≤ 2 := + (ncard_le_ncard hsub ((finite_singleton n₂).insert n₃)).trans (ncard_pair hne₁₂).le + omega + have hne₃₂ : n₃ ≠ n₂ := by + rintro rfl + have hsub : F ∩ π.Γ.N ⊆ {n₁, n₃} := by + rw [hFN] + rintro x (rfl | rfl | rfl) <;> simp + have hle : (F ∩ π.Γ.N).ncard ≤ 2 := + (ncard_le_ncard hsub ((finite_singleton n₃).insert n₁)).trans (ncard_pair hne₁₂).le + omega + have hn₁_A₁A₂ : π.nodeVertex n₁ ∈ (A₁ ∩ A₂).vertexSet := + hinter_V ▸ mem_insert _ _ + have hn₂_A₁A₂ : π.nodeVertex n₂ ∈ (A₁ ∩ A₂).vertexSet := + hinter_V ▸ mem_insert_of_mem _ rfl + have hn₃_not_A₂ : π.nodeVertex n₃ ∉ A₂.vertexSet := by + intro hn₃_A₂ + have hmem : π.nodeVertex n₃ ∈ ({π.nodeVertex n₁, π.nodeVertex n₂} : Set α) := + hinter_V ▸ ⟨hn₃_A₁, hn₃_A₂⟩ + rcases hmem with hEq | hEq + · exact hne₃₁ (π.nodeVertex_injOn hn₃_dom hn₁_dom hEq) + · exact hne₃₂ (π.nodeVertex_injOn hn₃_dom hn₂_dom hEq) + have hbp_c₂_sub_A₂ : ∀ {n : π.S}, n ∈ tilde c₂ → π.borderPlus n ⊆ A₂.vertexSet := by + intro n hn + rw [htilde_c₂] at hn + rcases hn with rfl | rfl + · rintro v (hv | ⟨_, rfl⟩) + · exact hbs_A₂ (Or.inl hv) + · exact hn₁_A₁A₂.2 + · rintro v (hv | ⟨_, rfl⟩) + · exact hbs_A₂ (Or.inr hv) + · exact hn₂_A₁A₂.2 + have htilde_c₂_N' : tilde c₂ ⊆ Γ'.N ∩ bd π.S := by + intro x hx + rw [htilde_c₂] at hx + rcases hx with rfl | rfl + · exact ⟨hN'_eq ▸ Or.inr (Or.inl rfl), hn₁_bd.2⟩ + · exact ⟨hN'_eq ▸ Or.inr (Or.inr (Or.inl rfl)), hn₂_bd.2⟩ + have htilde_c₁_N' : tilde c₁ ⊆ Γ'.N := by + intro x hx + rw [htilde_c₁] at hx + exact hN'_eq ▸ Or.inr hx + have hpart : I₁ ∪ I₂ = π.Γ.C := by + refine Subset.antisymm (union_subset (fun _ h => h.1) (fun _ h => h.1)) fun c hc => ?_ + rcases hdich c hc with hc_in | hc_out + · exact Or.inl ⟨hc, hc_in⟩ + · exact Or.inr ⟨hc, hc_out⟩ + have hdisj_I : Disjoint I₁ I₂ := by + rw [Set.disjoint_left] + intro c hc₁ hc₂ + obtain ⟨x, hx⟩ := π.Γ.cell_nonempty hc₁.1 + exact hc₂.2 hx (hc₁.2 hx) + have hinter_I₁_I₂ : (π.areaGraph Δ).vertexSet ∩ (π.cellsUnion I₂).vertexSet ⊆ + π.borderSet n₁ ∪ π.borderSet n₂ ∪ + {π.nodeVertex n₁, π.nodeVertex n₂, π.nodeVertex n₃} := by + exact area_cells_share_only_frontier_vertices (α := α) (β := β) (G := G) π (F := F) (Δ := Δ) + (n₁ := n₁) (n₂ := n₂) (n₃ := n₃) hF hFbd hFN hΔ A₁ A₂ hinter_V hn₃_A₁ hbs_A₂ Γ' Θ c₁ c₂ + hN'_eq hn₁_Θ hn₂_Θ htilde_I₂ htilde_c₁ htilde_c₂ hn₁_bd hn₂_bd hn₃_FN hn₁_dom + hn₂_dom hn₃_dom hne₁₂ hne₃₁ hne₃₂ hn₁_A₁A₂ hn₂_A₁A₂ hn₃_not_A₂ hpart hdisj_I + let cellG : Set π.S → Hypergraph α β := fun c => + if c = c₁ then A₁ else if c = c₂ then A₂ else π.cellGraph c + have hcellG_c₁ : cellG c₁ = A₁ := by dsimp [cellG]; rw [ite_eq_left rfl] + have hcellG_c₂ : cellG c₂ = A₂ := by + dsimp [cellG]; rw [ite_eq_right hc₁_ne_c₂.symm, ite_eq_left rfl] + have hcellG_I₂ : ∀ {c : Set π.S}, c ∈ I₂ → cellG c = π.cellGraph c := by + intro c hc + have h1 : c ≠ c₁ := by rintro rfl; exact hc₁_not_I₂ hc + have h2 : c ≠ c₂ := by rintro rfl; exact hc₂_not_I₂ hc + dsimp [cellG]; rw [ite_eq_right h1, ite_eq_right h2] + have hA₁_le_G : A₁ ≤ G := hsep.left_le.trans (π.cellsUnion_le I₁) + have hA₂_le_G : A₂ ≤ G := hsep.right_le.trans (π.cellsUnion_le I₁) + have replacementForcesNodes : tilde c₀ = Δ ∩ π.Γ.N := by + exact replacement_portrayal_keeps_all_disc_nodes (α := α) (β := β) (G := G) (𝒯 := 𝒯) (θ := + θ) (p := p) h𝒯 π htrue hred hwarp hθ (F := F) (Δ := Δ) (c₀ := c₀) (n₁ := n₁) (n₂ := n₂) + (n₃ := n₃) hnorm hF hFbd hFN hFN_card hΔ hsmall hF_bd hbd_sub hc₀ hc₀_Δ hc₀_card A₁ A₂ + hsep hinter_V hn₃_A₁ hbs_A₂ hθ3 hdom Γ' Θ c₁ c₂ hN'_eq hN'_sub hΘ hn₁_Θ hn₂_Θ hbd_Θ hdich + htilde_I₂ hc₁_mem hc₁_int htilde_c₁ hc₂_mem hc₂_Θ htilde_c₂ hc₁_ne_c₂ hc₁_not_I₂ + hc₂_not_I₂ hC' hΘ_bd hc₂_bd hn₁_bd hn₂_bd hn₃_FN hn₁_dom hn₂_dom hn₃_dom hne₁₂ hne₃₁ hne₃₂ + hn₁_A₁A₂ hn₂_A₁A₂ hn₃_not_A₂ hbp_c₂_sub_A₂ htilde_c₂_N' htilde_c₁_N' hdisj_I hinter_I₁_I₂ + cellG hcellG_c₁ hcellG_c₂ hcellG_I₂ hA₁_le_G hA₂_le_G + exact replacementForcesNodes + · exact Or.inr hex_sep + +/-! ## 5. Standard Linkage Union $S$ and Crossing Cells $D(A, B)$: (11.4)–(11.7) (Pages 193–196) -/ + +namespace Portrayal.SystemOfStandardLinkages + +variable {α : Type u} {β : Type v} {G : Hypergraph α β} {π : Portrayal G} + +private lemma walk_support_subset_vertexSet {H : Hypergraph α β} {u v : α} + (hu : u ∈ H.vertexSet) (W : H.skeleton.Walk u v) : + {z | z ∈ W.support} ⊆ H.vertexSet := + fun _ hz => Hypergraph.skeleton_walk_support_subset_vertexSet W hu _ hz + +theorem cellSet_subset_cellGraph (sys : π.SystemOfStandardLinkages) + {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (i : Fin (π.Γ.N ∩ Θ).ncard) : + sys.cellSet Θ hΘ i ⊆ (π.cellGraph ((sys.E Θ hΘ).cell i)).vertexSet := by + intro z hz + rw [cellSet, mem_iUnion] at hz + rcases hz with ⟨j, hzj⟩ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hbd_i : ((sys.E Θ hΘ).cell i ∩ bd π.S).Nonempty := + ((sys.E Θ hΘ).cell_inter_cuff_nonempty i).mono (inter_subset_inter_right _ hΘ_bd) + have hfirst_mem : ((sys.SL Θ hΘ).L i j).first ∈ (π.cellGraph ((sys.E Θ hΘ).cell i)).vertexSet := + π.p3_subset ((sys.E Θ hΘ).cell i) ((sys.E Θ hΘ).cell_mem i) hbd_i ((sys.E Θ hΘ).node i) + (((sys.E Θ hΘ).cell_tilde i) ▸ mem_insert _ _) (((sys.SL Θ hΘ).L i j).first_mem) + exact walk_support_subset_vertexSet hfirst_mem ((sys.SL Θ hΘ).L i j).walk hzj + +end Portrayal.SystemOfStandardLinkages + +/-- Existence of a `SystemOfStandardLinkages` from (9.8) (`exists_cuffStandardLinkages`). -/ +theorem exists_systemOfStandardLinkages + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) : + Nonempty π.SystemOfStandardLinkages := by + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have hexE : ∀ Θ ∈ cuffs π.S, Nonempty (π.Γ.CuffEnumeration Θ (π.Γ.N ∩ Θ).ncard) := by + intro Θ hΘ + have hΘ_arc : IsOArc Θ := (cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + exact π.Γ.exists_cuffEnumeration hΘ hΘ_arc + let E_fn : ∀ Θ ∈ cuffs π.S, π.Γ.CuffEnumeration Θ (π.Γ.N ∩ Θ).ncard := + fun Θ hΘ => Classical.choice (hexE Θ hΘ) + let SL_fn : ∀ Θ (hΘ : Θ ∈ cuffs π.S), + CuffStandardLinkages π Θ (π.Γ.N ∩ Θ).ncard (π.warpAt Θ) (E_fn Θ hΘ) := + fun Θ hΘ => Classical.choice + (exists_cuffStandardLinkages h𝒯 π htrue hred hwarp hθ (E_fn Θ hΘ)) + exact ⟨⟨E_fn, SL_fn⟩⟩ + +/-- For every node $n \in N(\Gamma)$, $\gamma(n)$ belongs to at least two distinct cells of +$\Gamma$, +and hence $\gamma(n) \in V(\alpha(-c))$ for every $c \in C(\Gamma)$ and $n \in N(\Gamma)$. -/ +theorem Portrayal.gammaImage_N_subset_otherVertices + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + (c : Set π.S) : + π.gammaImage π.Γ.N ⊆ π.otherVertices c := by + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have : ConnectedSpace π.S := π.connected + rintro v ⟨n, ⟨hnN, hndom⟩, rfl⟩ + have h87 := (theorem_8_7_proof + h𝒯 π htrue hred hwarp hθ hnN).1 + have hfin : {d ∈ π.Γ.CStar | n ∈ tilde d}.Finite := + π.Γ.finite_cells.subset fun _ hd => hd.1.1 + have hsub_ne : ({d ∈ π.Γ.CStar | n ∈ tilde d} \ {c}).Nonempty := by + by_contra hemp + have hsub : {d ∈ π.Γ.CStar | n ∈ tilde d} ⊆ {c} := + fun d hd => by_contra fun hne => hemp ⟨d, hd, hne⟩ + have hle1 : {d ∈ π.Γ.CStar | n ∈ tilde d}.ncard ≤ 1 := + (ncard_le_ncard hsub (finite_singleton c)).trans (ncard_singleton c).le + omega + obtain ⟨d, ⟨hd_star, hnd⟩, hd_ne⟩ := hsub_ne + exact ⟨d, hd_star.1, mem_singleton_iff.not.mp hd_ne, π.p2 d hd_star.1 n ⟨hnd, hndom⟩⟩ + +/-- Disjointness of $\gamma(N(\Gamma))$ and $S$: $\gamma(N(\Gamma)) \cap S = \emptyset$. -/ +theorem Portrayal.SystemOfStandardLinkages.disjoint_gammaImage_N_S + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + (sys : π.SystemOfStandardLinkages) : + Disjoint (π.gammaImage π.Γ.N) sys.S := by + rw [Set.disjoint_left] + rintro v ⟨n, ⟨hnN, hndom⟩, rfl⟩ hvS + rw [Portrayal.SystemOfStandardLinkages.S, mem_iUnion₂] at hvS + rcases hvS with ⟨Θ, hΘ, hv_cuff⟩ + rw [Portrayal.SystemOfStandardLinkages.cuffSet, mem_iUnion] at hv_cuff + rcases hv_cuff with ⟨i, hv_cell⟩ + have hvc : π.nodeVertex n ∈ (π.cellGraph ((sys.E Θ hΘ).cell i)).vertexSet := + sys.cellSet_subset_cellGraph hΘ i hv_cell + have hvo : π.nodeVertex n ∈ π.otherVertices ((sys.E Θ hΘ).cell i) := + π.gammaImage_N_subset_otherVertices h𝒯 htrue hred hwarp hθ ((sys.E Θ hΘ).cell i) + ⟨n, ⟨hnN, hndom⟩, rfl⟩ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hbd_i : ((sys.E Θ hΘ).cell i ∩ bd π.S).Nonempty := + ((sys.E Θ hΘ).cell_inter_cuff_nonempty i).mono (inter_subset_inter_right _ hΘ_bd) + obtain ⟨m, hm_t, hvm_bp⟩ := π.p6_borderPlus ((sys.E Θ hΘ).cell_mem i) hbd_i hvc hvo + have hk_pos : 0 < (π.Γ.N ∩ Θ).ncard := by have := (sys.E Θ hΘ).two_le; omega + have htilde_i := (sys.E Θ hΘ).cell_tilde i + have hn₁_t : (sys.E Θ hΘ).node i ∈ tilde ((sys.E Θ hΘ).cell i) := + htilde_i ▸ mem_insert _ _ + have hn₂_t : (sys.E Θ hΘ).node (cyclicSucc hk_pos i) ∈ tilde ((sys.E Θ hΘ).cell i) := + htilde_i ▸ mem_insert_of_mem _ (mem_singleton _) + have hne₁₂ : (sys.E Θ hΘ).node i ≠ (sys.E Θ hΘ).node (cyclicSucc hk_pos i) := + (sys.E Θ hΘ).injective_node.ne (cyclicSucc_ne_self (sys.E Θ hΘ).two_le i).symm + have h98 := theorem_9_8_proof h𝒯 π htrue hred hwarp hθ hΘ + ((sys.E Θ hΘ).cell_mem i) ((sys.E Θ hΘ).cell_inter_cuff_nonempty i) hn₁_t hn₂_t hne₁₂ + rw [Portrayal.SystemOfStandardLinkages.cellSet, mem_iUnion] at hv_cell + rcases hv_cell with ⟨j, hzj⟩ + rw [htilde_i] at hm_t + rcases hm_t with rfl | rfl + · rcases hvm_bp with hv_bs | ⟨_, hEq⟩ + · exact Set.disjoint_left.mp h98.2.2.1 hv_bs ⟨n, hnN, rfl⟩ + · exact (((sys.SL Θ hΘ).isStandard i).2.1 j).1 (hEq ▸ hzj) + · rcases hvm_bp with hv_bs | ⟨_, hEq⟩ + · exact Set.disjoint_left.mp h98.2.2.2.1 hv_bs ⟨n, hnN, rfl⟩ + · exact (((sys.SL Θ hΘ).isStandard i).2.1 j).2 (hEq ▸ hzj) + +/-- For every cuff $\Theta$ and index $i$, $\beta(n_i) \cup \beta(n_{i+1}) \subseteq \text{cellSet } +\Theta\ i$. -/ +theorem Portrayal.SystemOfStandardLinkages.borderSet_subset_cellSet + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + (sys : π.SystemOfStandardLinkages) + {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (i : Fin (π.Γ.N ∩ Θ).ncard) : + let hk_pos : 0 < (π.Γ.N ∩ Θ).ncard := by have := (sys.E Θ hΘ).two_le; omega + (∀ r : Fin (π.Γ.N ∩ Θ).ncard, (π.borderSet ((sys.E Θ hΘ).node r)).ncard = π.warpAt Θ) ∧ + π.borderSet ((sys.E Θ hΘ).node i) ⊆ sys.cellSet Θ hΘ i ∧ + π.borderSet ((sys.E Θ hΘ).node (cyclicSucc hk_pos i)) ⊆ sys.cellSet Θ hΘ i := by + intro hk_pos + have hcard : ∀ r : Fin (π.Γ.N ∩ Θ).ncard, + (π.borderSet ((sys.E Θ hΘ).node r)).ncard = π.warpAt Θ := by + intro r + have htilde_r := (sys.E Θ hΘ).cell_tilde r + have hn₁_t : (sys.E Θ hΘ).node r ∈ tilde ((sys.E Θ hΘ).cell r) := + htilde_r ▸ mem_insert _ _ + have hn₂_t : (sys.E Θ hΘ).node (cyclicSucc hk_pos r) ∈ tilde ((sys.E Θ hΘ).cell r) := + htilde_r ▸ mem_insert_of_mem _ (mem_singleton _) + have hne₁₂ : (sys.E Θ hΘ).node r ≠ (sys.E Θ hΘ).node (cyclicSucc hk_pos r) := + (sys.E Θ hΘ).injective_node.ne (cyclicSucc_ne_self (sys.E Θ hΘ).two_le r).symm + exact (theorem_9_8_proof h𝒯 π htrue hred hwarp hθ hΘ + ((sys.E Θ hΘ).cell_mem r) ((sys.E Θ hΘ).cell_inter_cuff_nonempty r) hn₁_t hn₂_t hne₁₂).1 + refine ⟨hcard, ?_, ?_⟩ + · intro u hu + obtain ⟨j, hj⟩ := (sys.SL Θ hΘ).exists_first_eq hcard i hu + exact mem_iUnion.mpr ⟨j, hj ▸ ((sys.SL Θ hΘ).L i j).walk.start_mem_support⟩ + · intro u hu + obtain ⟨j, hj⟩ := (sys.SL Θ hΘ).exists_last_eq hcard i hu + exact mem_iUnion.mpr ⟨j, hj ▸ ((sys.SL Θ hΘ).L i j).walk.end_mem_support⟩ + +/-- For an internal cell $c_0 \in C(\Gamma)$: +(1) $V(\alpha(c_0) \cap \alpha(-c_0)) = \gamma(\tilde{c}_0)$, and +(2) $V(\alpha(c_0)) \cap S = \emptyset$. -/ +theorem Portrayal.SystemOfStandardLinkages.internal_cell_properties + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + (sys : π.SystemOfStandardLinkages) + {c₀ : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) (hint : ¬ (c₀ ∩ bd π.S).Nonempty) : + (π.cellGraph c₀).vertexSet ∩ π.otherVertices c₀ = π.gammaImage (tilde c₀) ∧ + Disjoint (π.cellGraph c₀).vertexSet sys.S := by + have hinter_eq : (π.cellGraph c₀).vertexSet ∩ π.otherVertices c₀ = π.gammaImage (tilde c₀) := by + refine Subset.antisymm (fun v ⟨hvc, hvo⟩ => π.p5 c₀ hc₀ hint v hvc hvo) ?_ + rintro v ⟨n, ⟨hnt, hndom⟩, rfl⟩ + exact ⟨π.p2 c₀ hc₀ n ⟨hnt, hndom⟩, + π.gammaImage_N_subset_otherVertices h𝒯 htrue hred hwarp hθ c₀ + ⟨n, ⟨π.Γ.tilde_subset_N hc₀ hnt, hndom⟩, rfl⟩⟩ + refine ⟨hinter_eq, ?_⟩ + rw [Set.disjoint_left] + intro v hvc hvS + rw [Portrayal.SystemOfStandardLinkages.S, mem_iUnion₂] at hvS + rcases hvS with ⟨Θ, hΘ, hv_cuff⟩ + rw [Portrayal.SystemOfStandardLinkages.cuffSet, mem_iUnion] at hv_cuff + rcases hv_cuff with ⟨i, hv_cell⟩ + have hvd : v ∈ (π.cellGraph ((sys.E Θ hΘ).cell i)).vertexSet := + sys.cellSet_subset_cellGraph hΘ i hv_cell + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hbd_i : ((sys.E Θ hΘ).cell i ∩ bd π.S).Nonempty := + ((sys.E Θ hΘ).cell_inter_cuff_nonempty i).mono (inter_subset_inter_right _ hΘ_bd) + have hd_ne : (sys.E Θ hΘ).cell i ≠ c₀ := fun h => hint (h ▸ hbd_i) + have hvo : v ∈ π.otherVertices c₀ := ⟨(sys.E Θ hΘ).cell i, (sys.E Θ hΘ).cell_mem i, hd_ne, hvd⟩ + have hv_γ : v ∈ π.gammaImage (tilde c₀) := hinter_eq ▸ ⟨hvc, hvo⟩ + have hv_γN : v ∈ π.gammaImage π.Γ.N := by + rcases hv_γ with ⟨n, ⟨hnt, hndom⟩, rfl⟩ + exact ⟨n, ⟨π.Γ.tilde_subset_N hc₀ hnt, hndom⟩, rfl⟩ + exact Set.disjoint_left.mp + (sys.disjoint_gammaImage_N_S h𝒯 π htrue hred hwarp hθ) + hv_γN (sys.cellSet_subset_S hΘ i hv_cell) + +/-- For a border cell $c_0 = E.\text{cell } i$ on cuff $\Theta$: +(1) $V(\alpha(c_0) \cap \alpha(-c_0)) = (\beta(n_i) \cup \beta(n_{i+1})) \cup \gamma(\tilde{c}_0)$, +(2) $V(\alpha(c_0) \cap \alpha(-c_0)) \cap S = \beta(n_i) \cup \beta(n_{i+1})$, +(3) $V(\alpha(c_0) \cap \alpha(-c_0)) \setminus S = \gamma(\tilde{c}_0)$, and +(4) $V(\alpha(c_0)) \setminus (S \cup V(\alpha(-c_0))) = V(\alpha(c_0)) \setminus (\text{cellSet } +\Theta\ i \cup V(\alpha(-c_0)))$. -/ +theorem Portrayal.SystemOfStandardLinkages.border_cell_properties + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + (sys : π.SystemOfStandardLinkages) + {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (i : Fin (π.Γ.N ∩ Θ).ncard) : + let hk_pos : 0 < (π.Γ.N ∩ Θ).ncard := by have := (sys.E Θ hΘ).two_le; omega + let c₀ := (sys.E Θ hΘ).cell i + let n₁ := (sys.E Θ hΘ).node i + let n₂ := (sys.E Θ hΘ).node (cyclicSucc hk_pos i) + (π.cellGraph c₀).vertexSet ∩ π.otherVertices c₀ = + (π.borderSet n₁ ∪ π.borderSet n₂) ∪ π.gammaImage (tilde c₀) ∧ + ((π.cellGraph c₀).vertexSet ∩ π.otherVertices c₀) ∩ sys.S = + π.borderSet n₁ ∪ π.borderSet n₂ ∧ + ((π.cellGraph c₀).vertexSet ∩ π.otherVertices c₀) \ sys.S = + π.gammaImage (tilde c₀) ∧ + (π.cellGraph c₀).vertexSet \ (sys.S ∪ π.otherVertices c₀) = + (π.cellGraph c₀).vertexSet \ (sys.cellSet Θ hΘ i ∪ π.otherVertices c₀) := by + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + intro hk_pos c₀ n₁ n₂ + have hc₀ : c₀ ∈ π.Γ.C := (sys.E Θ hΘ).cell_mem i + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hbd_c₀ : (c₀ ∩ bd π.S).Nonempty := + ((sys.E Θ hΘ).cell_inter_cuff_nonempty i).mono (inter_subset_inter_right _ hΘ_bd) + have htilde_c₀ : tilde c₀ = {n₁, n₂} := (sys.E Θ hΘ).cell_tilde i + have hn₁_t : n₁ ∈ tilde c₀ := htilde_c₀ ▸ mem_insert _ _ + have hn₂_t : n₂ ∈ tilde c₀ := htilde_c₀ ▸ mem_insert_of_mem _ (mem_singleton _) + have hinter_eq : (π.cellGraph c₀).vertexSet ∩ π.otherVertices c₀ = + (π.borderSet n₁ ∪ π.borderSet n₂) ∪ π.gammaImage (tilde c₀) := by + refine Subset.antisymm ?_ ?_ + · rintro v ⟨hvc, hvo⟩ + obtain ⟨m, hm_t, hvm_bp⟩ := π.p6_borderPlus hc₀ hbd_c₀ hvc hvo + rcases hvm_bp with hv_bs | ⟨hmdom, rfl⟩ + · rw [htilde_c₀] at hm_t + rcases hm_t with rfl | rfl + · exact Or.inl (Or.inl hv_bs) + · exact Or.inl (Or.inr hv_bs) + · exact Or.inr ⟨m, ⟨hm_t, hmdom⟩, rfl⟩ + · rintro v ((hv_bs₁ | hv_bs₂) | ⟨m, ⟨hm_t, hmdom⟩, rfl⟩) + · refine ⟨π.p3_subset c₀ hc₀ hbd_c₀ n₁ hn₁_t hv_bs₁, ?_⟩ + obtain ⟨r, hr_lt, hr_eq⟩ := + stepIdx_surjective (sys.E Θ hΘ).two_le (cyclicSucc hk_pos i) i + have hr_pos : 0 < r := by + by_contra hr0 + have hr_zero : r = 0 := by omega + rw [hr_zero, stepIdx_zero] at hr_eq + exact cyclicSucc_ne_self (sys.E Θ hΘ).two_le i hr_eq + let prev := stepIdx (sys.E Θ hΘ).two_le (cyclicSucc hk_pos i) (r - 1) + have hsucc_prev : cyclicSucc hk_pos prev = i := by + rw [← stepIdx_succ, Nat.sub_add_cancel hr_pos, hr_eq] + have hprev_ne : prev ≠ i := by + rw [← hsucc_prev] + exact (cyclicSucc_ne_self (sys.E Θ hΘ).two_le prev).symm + have hcell_ne : (sys.E Θ hΘ).cell prev ≠ c₀ := + (sys.E Θ hΘ).injective_cell.ne hprev_ne + have hbd_prev : ((sys.E Θ hΘ).cell prev ∩ bd π.S).Nonempty := + ((sys.E Θ hΘ).cell_inter_cuff_nonempty prev).mono (inter_subset_inter_right _ hΘ_bd) + have hn₁_prev : n₁ ∈ tilde ((sys.E Θ hΘ).cell prev) := by + rw [(sys.E Θ hΘ).cell_tilde prev] + change n₁ ∈ {(sys.E Θ hΘ).node prev, (sys.E Θ hΘ).node (cyclicSucc hk_pos prev)} + rw [hsucc_prev] + exact mem_insert_of_mem _ (mem_singleton _) + exact ⟨(sys.E Θ hΘ).cell prev, (sys.E Θ hΘ).cell_mem prev, hcell_ne, + π.p3_subset ((sys.E Θ hΘ).cell prev) ((sys.E Θ hΘ).cell_mem prev) hbd_prev n₁ + hn₁_prev hv_bs₁⟩ + · refine ⟨π.p3_subset c₀ hc₀ hbd_c₀ n₂ hn₂_t hv_bs₂, ?_⟩ + let next := cyclicSucc hk_pos i + have hnext_ne : next ≠ i := cyclicSucc_ne_self (sys.E Θ hΘ).two_le i + have hcell_ne : (sys.E Θ hΘ).cell next ≠ c₀ := + (sys.E Θ hΘ).injective_cell.ne hnext_ne + have hbd_next : ((sys.E Θ hΘ).cell next ∩ bd π.S).Nonempty := + ((sys.E Θ hΘ).cell_inter_cuff_nonempty next).mono (inter_subset_inter_right _ hΘ_bd) + have hn₂_next : n₂ ∈ tilde ((sys.E Θ hΘ).cell next) := by + rw [(sys.E Θ hΘ).cell_tilde next] + exact mem_insert _ _ + exact ⟨(sys.E Θ hΘ).cell next, (sys.E Θ hΘ).cell_mem next, hcell_ne, + π.p3_subset ((sys.E Θ hΘ).cell next) ((sys.E Θ hΘ).cell_mem next) hbd_next n₂ + hn₂_next hv_bs₂⟩ + · exact ⟨π.p2 c₀ hc₀ m ⟨hm_t, hmdom⟩, + π.gammaImage_N_subset_otherVertices h𝒯 htrue hred hwarp hθ c₀ + ⟨m, ⟨π.Γ.tilde_subset_N hc₀ hm_t, hmdom⟩, rfl⟩⟩ + obtain ⟨_, hbs₁_sub, hbs₂_sub⟩ := + sys.borderSet_subset_cellSet h𝒯 π htrue hred hwarp hθ hΘ i + have hbs_sub_S : π.borderSet n₁ ∪ π.borderSet n₂ ⊆ sys.S := + union_subset (hbs₁_sub.trans (sys.cellSet_subset_S hΘ i)) + (hbs₂_sub.trans (sys.cellSet_subset_S hΘ i)) + have hγ_disj_S : Disjoint (π.gammaImage (tilde c₀)) sys.S := by + refine (sys.disjoint_gammaImage_N_S h𝒯 π htrue hred hwarp hθ).mono_left ?_ + rintro v ⟨m, ⟨hm_t, hmdom⟩, rfl⟩ + exact ⟨m, ⟨π.Γ.tilde_subset_N hc₀ hm_t, hmdom⟩, rfl⟩ + refine ⟨hinter_eq, ?_, ?_, ?_⟩ + · rw [hinter_eq, union_inter_distrib_right, + inter_eq_self_of_subset_left hbs_sub_S, + hγ_disj_S.inter_eq, union_empty] + · have hbs_sdiff : (π.borderSet n₁ ∪ π.borderSet n₂) \ sys.S = ∅ := + eq_empty_of_forall_notMem fun x hx => hx.2 (hbs_sub_S hx.1) + rw [hinter_eq, union_sdiff_distrib, hbs_sdiff, empty_union, + hγ_disj_S.sdiff_eq_left] + · ext v + simp only [mem_sdiff, mem_union, not_or] + refine and_congr_right fun hvc => ⟨fun ⟨hnotS, hnotO⟩ => ⟨fun hcell => hnotS + (sys.cellSet_subset_S hΘ i hcell), hnotO⟩, ?_⟩ + rintro ⟨hnot_cell, hnotO⟩ + refine ⟨fun hvS => ?_, hnotO⟩ + rw [Portrayal.SystemOfStandardLinkages.S, mem_iUnion₂] at hvS + rcases hvS with ⟨Θ', hΘ', hv_cuff⟩ + rw [Portrayal.SystemOfStandardLinkages.cuffSet, mem_iUnion] at hv_cuff + rcases hv_cuff with ⟨i', hv_cell⟩ + have hvd' : v ∈ (π.cellGraph ((sys.E Θ' hΘ').cell i')).vertexSet := + sys.cellSet_subset_cellGraph hΘ' i' hv_cell + by_cases hcell_eq : (sys.E Θ' hΘ').cell i' = c₀ + · have hΘ'_eq : Θ' = Θ := + (π.Γ.border_cell_subset_cuff hc₀ hΘ ((sys.E Θ hΘ).cell_inter_cuff_nonempty i)).2.2.2.2 + Θ' hΘ' (hcell_eq ▸ (sys.E Θ' hΘ').cell_inter_cuff_nonempty i') + rcases hΘ'_eq with rfl + have hi'_eq : i' = i := (sys.E Θ' hΘ').injective_cell hcell_eq + rcases hi'_eq with rfl + exact hnot_cell hv_cell + · exact hnotO ⟨(sys.E Θ' hΘ').cell i', (sys.E Θ' hΘ').cell_mem i', hcell_eq, hvd'⟩ + +/-- **Graph Minors XVII, (11.4)** (pages 193–194): +"For any separation $(A, B)$ of $G$, if $d \in D(A, B)$ then* +$$ +V(A \cap B) \cap (V(\alpha(d)) - (S \cup V(\alpha(-d)))) \ne \emptyset. +$$" -/ +theorem theorem_11_4_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + (sys : π.SystemOfStandardLinkages) + {A B : Hypergraph α β} (hsep : G.IsSeparation A B) + {d : Set π.S} (hd : d ∈ π.crossingCells A B) : + ((A ∩ B).vertexSet ∩ ((π.cellGraph d).vertexSet \ (sys.S ∪ π.otherVertices d))).Nonempty := by + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have : ConnectedSpace π.S := π.connected + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof + h𝒯 π htrue hred hwarp hθ + rcases hd with ⟨⟨hdC, hd_max⟩, hnotA, hnotB⟩ + rw [Set.not_subset] at hnotA hnotB + rcases hnotA with ⟨u₁, ⟨n₁, ⟨hn₁_t, hn₁_dom⟩, rfl⟩, hu₁_notA⟩ + rcases hnotB with ⟨u₂, ⟨n₂, ⟨hn₂_t, hn₂_dom⟩, rfl⟩, hu₂_notB⟩ + have hu₂_G : π.nodeVertex n₂ ∈ G.vertexSet := π.nodeVertex_mem n₂ hn₂_dom + rw [← hsep.vertexSet_union] at hu₂_G + have hu₂_A : π.nodeVertex n₂ ∈ A.vertexSet := hu₂_G.resolve_right hu₂_notB + have hne₁₂ : n₁ ≠ n₂ := by + rintro rfl + exact hu₁_notA hu₂_A + by_cases hbd : (d ∩ bd π.S).Nonempty + · -- Border cell case: use the node path `L₀` from the standard linkage in `α(d)`. + rcases hbd with ⟨x₀, hxd, hxbd⟩ + let Θ := connectedComponentIn (bd π.S) x₀ + have hΘ : Θ ∈ cuffs π.S := ⟨x₀, hxbd, rfl⟩ + have hdΘ : (d ∩ Θ).Nonempty := ⟨x₀, hxd, mem_connectedComponentIn hxbd⟩ + have hd_range : d ∈ Set.range (sys.E Θ hΘ).cell := by + rw [(sys.E Θ hΘ).range_cell]; exact ⟨hdC, hdΘ⟩ + rcases hd_range with ⟨i, rfl⟩ + have hk_pos : 0 < (π.Γ.N ∩ Θ).ncard := by have := (sys.E Θ hΘ).two_le; omega + have hstd := (sys.SL Θ hΘ).isStandard i + rcases hstd.2.2 with ⟨L₀, hL₀_disj⟩ | ⟨c', hc'C, hint', _, hsub'⟩ + · have htilde_i : tilde ((sys.E Θ hΘ).cell i) = + {(sys.E Θ hΘ).node i, (sys.E Θ hΘ).node (cyclicSucc hk_pos i)} := + (sys.E Θ hΘ).cell_tilde i + have hn₁_pair : n₁ = (sys.E Θ hΘ).node i ∨ n₁ = (sys.E Θ hΘ).node (cyclicSucc hk_pos i) := by + have h : n₁ ∈ ({(sys.E Θ hΘ).node i, (sys.E Θ hΘ).node (cyclicSucc hk_pos i)} : Set π.S) := + htilde_i ▸ hn₁_t + exact h + have hn₂_pair : n₂ = (sys.E Θ hΘ).node i ∨ n₂ = (sys.E Θ hΘ).node (cyclicSucc hk_pos i) := by + have h : n₂ ∈ ({(sys.E Θ hΘ).node i, (sys.E Θ hΘ).node (cyclicSucc hk_pos i)} : Set π.S) := + htilde_i ▸ hn₂_t + exact h + have hbd_props := sys.border_cell_properties h𝒯 π htrue hred hwarp hθ hΘ i + have hbs_props := sys.borderSet_subset_cellSet h𝒯 π htrue hred hwarp hθ hΘ i + have hL₀_first : L₀.first = π.nodeVertex ((sys.E Θ hΘ).node i) := + mem_singleton_iff.mp L₀.first_mem + have hL₀_last : L₀.last = π.nodeVertex ((sys.E Θ hΘ).node (cyclicSucc hk_pos i)) := + mem_singleton_iff.mp L₀.last_mem + have hL₀_internal : ∀ v ∈ L₀.walk.support, + v ≠ π.nodeVertex ((sys.E Θ hΘ).node i) → + v ≠ π.nodeVertex ((sys.E Θ hΘ).node (cyclicSucc hk_pos i)) → + v ∈ (π.cellGraph ((sys.E Θ hΘ).cell i)).vertexSet \ + (sys.S ∪ π.otherVertices ((sys.E Θ hΘ).cell i)) := by + intro v hv_sup hne_first hne_last + rw [hbd_props.2.2.2] + have hfirst_c : L₀.first ∈ (π.cellGraph ((sys.E Θ hΘ).cell i)).vertexSet := by + rw [hL₀_first] + have hndom_i : (sys.E Θ hΘ).node i ∈ π.domγ := by + rw [hdom]; exact ((sys.E Θ hΘ).node_mem i).1 + exact π.p2 ((sys.E Θ hΘ).cell i) hdC ((sys.E Θ hΘ).node i) + ⟨htilde_i ▸ mem_insert _ _, hndom_i⟩ + have hvc : v ∈ (π.cellGraph ((sys.E Θ hΘ).cell i)).vertexSet := + Portrayal.SystemOfStandardLinkages.walk_support_subset_vertexSet hfirst_c L₀.walk hv_sup + have hnot_cellSet : v ∉ sys.cellSet Θ hΘ i := by + rw [Portrayal.SystemOfStandardLinkages.cellSet, mem_iUnion] + rintro ⟨j, hzj⟩ + exact Set.disjoint_left.mp (hL₀_disj j) hv_sup hzj + refine ⟨hvc, fun hmem => ?_⟩ + rcases hmem with hcell | hvo + · exact hnot_cellSet hcell + · have hv_inter : v ∈ (π.cellGraph ((sys.E Θ hΘ).cell i)).vertexSet ∩ + π.otherVertices ((sys.E Θ hΘ).cell i) := ⟨hvc, hvo⟩ + rw [hbd_props.1] at hv_inter + rcases hv_inter with (hv_bs₁ | hv_bs₂) | ⟨m, ⟨hm_t, _⟩, rfl⟩ + · exact hnot_cellSet (hbs_props.2.1 hv_bs₁) + · exact hnot_cellSet (hbs_props.2.2 hv_bs₂) + · rw [htilde_i] at hm_t + rcases hm_t with rfl | rfl + · exact hne_first rfl + · exact hne_last rfl + have hex_W : ∃ W : (π.cellGraph ((sys.E Θ hΘ).cell i)).skeleton.Walk + (π.nodeVertex n₁) (π.nodeVertex n₂), + ∀ v ∈ W.support, v ∈ L₀.walk.support := by + rcases hn₁_pair with h1 | h1 <;> rcases hn₂_pair with h2 | h2 + · exact (hne₁₂ (h1.trans h2.symm)).elim + · refine ⟨L₀.walk.copy (hL₀_first.trans (congrArg π.nodeVertex h1.symm)) + (hL₀_last.trans (congrArg π.nodeVertex h2.symm)), ?_⟩ + intro v hv + rwa [SimpleGraph.Walk.support_copy] at hv + · refine ⟨L₀.walk.reverse.copy (hL₀_last.trans (congrArg π.nodeVertex h1.symm)) + (hL₀_first.trans (congrArg π.nodeVertex h2.symm)), ?_⟩ + intro v hv + rw [SimpleGraph.Walk.support_copy, SimpleGraph.Walk.support_reverse, + List.mem_reverse] at hv + exact hv + · exact (hne₁₂ (h1.trans h2.symm)).elim + obtain ⟨W, hW_sub⟩ := hex_W + let WG : G.skeleton.Walk (π.nodeVertex n₁) (π.nodeVertex n₂) := + W.map (SimpleGraph.Hom.ofLE (skeleton_le_of_le (π.cellGraph_le _ hdC))) + obtain ⟨v, hv_sup, hv_ne₁, hv_ne₂, hv_AB⟩ := + exists_internal_mem_inter_of_walk_of_isSeparation hsep WG hu₁_notA hu₂_A hu₂_notB + rw [SimpleGraph.Walk.support_map, List.mem_map] at hv_sup + rcases hv_sup with ⟨v', hv'_W, rfl⟩ + change v' ≠ π.nodeVertex n₁ at hv_ne₁ + change v' ≠ π.nodeVertex n₂ at hv_ne₂ + change v' ∈ (A ∩ B).vertexSet at hv_AB + have hv'_L₀ : v' ∈ L₀.walk.support := hW_sub v' hv'_W + have hne_i : v' ≠ π.nodeVertex ((sys.E Θ hΘ).node i) := by + rcases hn₁_pair with h1 | h1 <;> rcases hn₂_pair with h2 | h2 + · exact (hne₁₂ (h1.trans h2.symm)).elim + · rwa [← h1] + · rwa [← h2] + · exact (hne₁₂ (h1.trans h2.symm)).elim + have hne_succ : v' ≠ π.nodeVertex ((sys.E Θ hΘ).node (cyclicSucc hk_pos i)) := by + rcases hn₁_pair with h1 | h1 <;> rcases hn₂_pair with h2 | h2 + · exact (hne₁₂ (h1.trans h2.symm)).elim + · rwa [← h2] + · rwa [← h1] + · exact (hne₁₂ (h1.trans h2.symm)).elim + exact ⟨v', hv_AB, hL₀_internal v' hv'_L₀ hne_i hne_succ⟩ + · exfalso + have hc'_ne : c' ≠ (sys.E Θ hΘ).cell i := fun h => hint' (h ▸ ⟨x₀, hxd, hxbd⟩) + exact hd_max ⟨c', hc'C, hc'_ne, hsub'⟩ + · -- Internal cell case: use (9.1) (`theorem_9_1_proof`). + obtain ⟨L₀, hL₀_int⟩ := + theorem_9_1_proof h𝒯 π htrue hred hwarp hθ hdC hbd hn₁_t hn₂_t hne₁₂ + have hint_props := sys.internal_cell_properties h𝒯 π htrue hred hwarp hθ hdC hbd + have hL₀_first : L₀.first = π.nodeVertex n₁ := mem_singleton_iff.mp L₀.first_mem + have hL₀_last : L₀.last = π.nodeVertex n₂ := mem_singleton_iff.mp L₀.last_mem + let W : (π.cellGraph d).skeleton.Walk (π.nodeVertex n₁) (π.nodeVertex n₂) := + L₀.walk.copy hL₀_first hL₀_last + let WG : G.skeleton.Walk (π.nodeVertex n₁) (π.nodeVertex n₂) := + W.map (SimpleGraph.Hom.ofLE (skeleton_le_of_le (π.cellGraph_le d hdC))) + obtain ⟨v, hv_sup, hv_ne₁, hv_ne₂, hv_AB⟩ := + exists_internal_mem_inter_of_walk_of_isSeparation hsep WG hu₁_notA hu₂_A hu₂_notB + rw [SimpleGraph.Walk.support_map, List.mem_map] at hv_sup + rcases hv_sup with ⟨v', hv'_W, rfl⟩ + change v' ≠ π.nodeVertex n₁ at hv_ne₁ + change v' ≠ π.nodeVertex n₂ at hv_ne₂ + change v' ∈ (A ∩ B).vertexSet at hv_AB + have hv'_L₀ : v' ∈ L₀.walk.support := by + dsimp only [W] at hv'_W + rwa [SimpleGraph.Walk.support_copy] at hv'_W + have hfirst_c : L₀.first ∈ (π.cellGraph d).vertexSet := by + rw [hL₀_first] + exact π.p2 d hdC n₁ ⟨hn₁_t, hn₁_dom⟩ + have hv'_c : v' ∈ (π.cellGraph d).vertexSet := + Portrayal.SystemOfStandardLinkages.walk_support_subset_vertexSet + hfirst_c L₀.walk hv'_L₀ + refine ⟨v', hv_AB, hv'_c, ?_⟩ + rintro (hv'_S | hv'_O) + · exact Set.disjoint_left.mp hint_props.2 hv'_c hv'_S + · have hv'_γ : v' ∈ π.gammaImage (tilde d) := hint_props.1 ▸ ⟨hv'_c, hv'_O⟩ + have hv'_img : v' ∈ π.nodeVertex '' tilde d := by + rcases hv'_γ with ⟨m, ⟨hm_t, _⟩, rfl⟩ + exact ⟨m, hm_t, rfl⟩ + rcases hL₀_int v' hv'_L₀ hv'_img with hEq₁ | hEq₂ + · exact hv_ne₁ hEq₁ + · exact hv_ne₂ hEq₂ + +/-- **Graph Minors XVII, (11.5)** (page 194): +"For any separation $(A, B)$ of $G$,* +$$|D(A, B)| \le |V(A \cap B) - (S \cup \gamma(N(\Gamma)))|.$$" -/ +theorem theorem_11_5_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + (sys : π.SystemOfStandardLinkages) + {A B : Hypergraph α β} (hsep : G.IsSeparation A B) : + (π.crossingCells A B).ncard ≤ + ((A ∩ B).vertexSet \ (sys.S ∪ π.gammaImage π.Γ.N)).ncard := by + classical + by_cases hD_ne : (π.crossingCells A B).Nonempty + · obtain ⟨d₀, hd₀⟩ := hD_ne + have hex : ∀ d : π.crossingCells A B, + ∃ v : α, v ∈ (A ∩ B).vertexSet ∧ + v ∈ (π.cellGraph d.1).vertexSet \ (sys.S ∪ π.otherVertices d.1) := + fun d => theorem_11_4_proof h𝒯 π htrue hred hwarp hθ sys hsep d.2 + choose v_fn hv_spec using hex + let f : Set π.S → α := fun d => + if hd : d ∈ π.crossingCells A B then v_fn ⟨d, hd⟩ else v_fn ⟨d₀, hd₀⟩ + have hf_maps : f '' π.crossingCells A B ⊆ + (A ∩ B).vertexSet \ (sys.S ∪ π.gammaImage π.Γ.N) := by + rintro _ ⟨d, hd, rfl⟩ + dsimp only [f] + rw [dite_eq_left hd] + obtain ⟨hv_AB, hvc, hv_not⟩ := hv_spec ⟨d, hd⟩ + refine ⟨hv_AB, fun hmem => hv_not ?_⟩ + rcases hmem with hv_S | hv_γN + · exact Or.inl hv_S + · exact Or.inr (π.gammaImage_N_subset_otherVertices h𝒯 htrue hred hwarp hθ d hv_γN) + have hf_inj : InjOn f (π.crossingCells A B) := by + intro d₁ hd₁ d₂ hd₂ hEq + dsimp only [f] at hEq + rw [dite_eq_left hd₁, dite_eq_left hd₂] at hEq + by_contra hne + obtain ⟨_, _, hv₁_not⟩ := hv_spec ⟨d₁, hd₁⟩ + obtain ⟨_, hvc₂, _⟩ := hv_spec ⟨d₂, hd₂⟩ + exact hv₁_not (Or.inr ⟨d₂, hd₂.1.1, Ne.symm hne, hEq ▸ hvc₂⟩) + have hfin_target : ((A ∩ B).vertexSet \ (sys.S ∪ π.gammaImage π.Γ.N)).Finite := + (G.vertexSet_finite.subset (inter_subset_left.trans hsep.left_le.vertexSet_subset)).subset + sdiff_subset + rw [← hf_inj.ncard_image] + exact ncard_le_ncard hf_maps hfin_target + · rw [not_nonempty_iff_eq_empty.mp hD_ne, ncard_empty] + exact Nat.zero_le _ + +/-! ## 5. Bounding and Determining $|V(A \cap B)|$: (11.6) and (11.7) (Pages 194–196) -/ + +/-- Every vertex in the support of `(sys.SL Θ hΘ).circWalk i₀ u k` belongs to `sys.S`. -/ +theorem Portrayal.SystemOfStandardLinkages.support_circWalk_subset_S + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + (sys : π.SystemOfStandardLinkages) + {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (i₀ : Fin (π.Γ.N ∩ Θ).ncard) + {u : α} (hu : u ∈ π.borderSet ((sys.E Θ hΘ).node i₀)) + {z : α} (hz : z ∈ ((sys.SL Θ hΘ).circWalk i₀ u (π.Γ.N ∩ Θ).ncard).support) : + z ∈ sys.S := by + obtain ⟨hcard, hbs₁_sub, _⟩ := + sys.borderSet_subset_cellSet h𝒯 π htrue hred hwarp hθ hΘ i₀ + rw [← ((sys.SL Θ hΘ).circWalk i₀ u (π.Γ.N ∩ Θ).ncard).cons_tail_support, List.mem_cons] at hz + rcases hz with rfl | hz_tail + · exact sys.cellSet_subset_S hΘ i₀ (hbs₁_sub hu) + · rw [CuffStandardLinkages.mem_support_tail_circWalk_iff] at hz_tail + rcases hz_tail with ⟨r, _, hzr⟩ + set idx := stepIdx (sys.E Θ hΘ).two_le i₀ r + have hcur_bs : (sys.SL Θ hΘ).traceVertex i₀ u r ∈ π.borderSet ((sys.E Θ hΘ).node idx) := + (sys.SL Θ hΘ).traceVertex_mem_borderSet hcard i₀ hu r + obtain ⟨j, _, _, _, hwalk_sup, _, _⟩ := (sys.SL Θ hΘ).step_spec_of_mem hcard idx hcur_bs + have hz_j : z ∈ (((sys.SL Θ hΘ).L idx j).walk).support := + hwalk_sup ▸ List.mem_of_mem_tail hzr + exact sys.cellSet_subset_S hΘ idx (mem_iUnion.mpr ⟨j, hz_j⟩) + +/-- For every cell $c_0 \in C(\Gamma)$, $|V(\alpha(c_0) \cap \alpha(-c_0))| \le 2p + 2$. -/ +theorem Portrayal.SystemOfStandardLinkages.ncard_inter_otherVertices_le + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + (sys : π.SystemOfStandardLinkages) + {c₀ : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) : + ((π.cellGraph c₀).vertexSet ∩ π.otherVertices c₀).ncard ≤ 2 * p + 2 := by + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have hp_pos : 1 ≤ p := π.one_le_warp.trans hwarp + have hγ_le : (π.gammaImage (tilde c₀)).ncard ≤ (tilde c₀).ncard := by + have hsub : π.gammaImage (tilde c₀) ⊆ π.nodeVertex '' tilde c₀ := by + rintro _ ⟨n, ⟨hnt, _⟩, rfl⟩ + exact ⟨n, hnt, rfl⟩ + exact (ncard_le_ncard hsub ((π.Γ.finite_tilde_cell hc₀).image π.nodeVertex)).trans + (ncard_image_le (π.Γ.finite_tilde_cell hc₀)) + by_cases hbd : (c₀ ∩ bd π.S).Nonempty + · rcases hbd with ⟨x₀, hxc₀, hxbd⟩ + let Θ := connectedComponentIn (bd π.S) x₀ + have hΘ : Θ ∈ cuffs π.S := ⟨x₀, hxbd, rfl⟩ + have hc₀Θ : (c₀ ∩ Θ).Nonempty := ⟨x₀, hxc₀, mem_connectedComponentIn hxbd⟩ + have hc₀_range : c₀ ∈ Set.range (sys.E Θ hΘ).cell := by + rw [(sys.E Θ hΘ).range_cell]; exact ⟨hc₀, hc₀Θ⟩ + rcases hc₀_range with ⟨i₀, hi₀_eq⟩ + have hk_pos : 0 < (π.Γ.N ∩ Θ).ncard := by have := (sys.E Θ hΘ).two_le; omega + have hbd_props := sys.border_cell_properties h𝒯 π htrue hred hwarp hθ hΘ i₀ + obtain ⟨hcard, _, _⟩ := + sys.borderSet_subset_cellSet h𝒯 π htrue hred hwarp hθ hΘ i₀ + have hq_le_p : π.warpAt Θ ≤ p := (π.warpAt_le_warp hΘ).trans hwarp + have hbs₁_le : (π.borderSet ((sys.E Θ hΘ).node i₀)).ncard ≤ p := + (hcard i₀).trans_le hq_le_p + have hbs₂_le : (π.borderSet ((sys.E Θ hΘ).node (cyclicSucc hk_pos i₀))).ncard ≤ p := + (hcard (cyclicSucc hk_pos i₀)).trans_le hq_le_p + have htc₀_le2 : (tilde ((sys.E Θ hΘ).cell i₀)).ncard ≤ 2 := by + rw [(sys.E Θ hΘ).cell_tilde i₀] + exact (ncard_insert_le _ _).trans (by rw [ncard_singleton]) + have hγ_le2 : (π.gammaImage (tilde ((sys.E Θ hΘ).cell i₀))).ncard ≤ 2 := by + rw [hi₀_eq]; exact hγ_le.trans (hi₀_eq ▸ htc₀_le2) + rw [← hi₀_eq, hbd_props.1] + have h1 := ncard_union_le + (π.borderSet ((sys.E Θ hΘ).node i₀) ∪ + π.borderSet ((sys.E Θ hΘ).node (cyclicSucc hk_pos i₀))) + (π.gammaImage (tilde ((sys.E Θ hΘ).cell i₀))) + have h2 := ncard_union_le + (π.borderSet ((sys.E Θ hΘ).node i₀)) + (π.borderSet ((sys.E Θ hΘ).node (cyclicSucc hk_pos i₀))) + omega + · have hint_props := sys.internal_cell_properties h𝒯 π htrue hred hwarp hθ hc₀ hbd + rw [hint_props.1] + have htc₀_le3 : (tilde c₀).ncard ≤ 3 := π.Γ.ncard_tilde_cell_le hc₀ + omega + +private theorem circumnavigation_walk_crosses_separation + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {θ : ℕ} + {p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + (sys : π.SystemOfStandardLinkages) + {A : Hypergraph α β} + {B : Hypergraph α β} + (hAB : (A, B) ∈ 𝒯) + (hsep : G.IsSeparation A B) + (Θ : Set π.S) + (hΘ : Θ ∈ cuffs π.S) + (i₀ : Fin (π.Γ.N ∩ Θ).ncard) + (hcard : ∀ (r : Fin (π.Γ.N ∩ Θ).ncard), (π.borderSet ((sys.E Θ hΘ).node r)).ncard = π.warpAt + Θ) + (hbs₁_sub_A : π.borderSet ((sys.E Θ hΘ).node i₀) ⊆ A.vertexSet) + (hord_le : A.separationOrder B ≤ 2 * p + 3) : + ∀ (u : ↑(π.borderSet ((sys.E Θ hΘ).node i₀))), ∃ (L₁ L₂ : List α) (m a b : α), + ((sys.SL Θ hΘ).circWalk i₀ (↑u) + (π.Γ.N ∩ Θ).ncard).support.tail = L₁ ++ m :: L₂ ∧ (∀ x ∈ L₁, x ∈ A.vertexSet) ∧ m ∉ + A.vertexSet ∧ a ∈ (A ∩ B).vertexSet ∧ (L₁ = [] ∧ a = ↑u ∨ a ∈ L₁) ∧ b ∈ (A ∩ B).vertexSet + ∧ b ∈ L₂ ∧ (sys.SL Θ + hΘ).traceVertex i₀ (↑u) (π.Γ.N ∩ Θ).ncard ∈ L₂ := by + let n₁ := (sys.E Θ hΘ).node i₀ + intro u + have hu_A : u.1 ∈ A.vertexSet := hbs₁_sub_A u.2 + have hv_bs₁ : (sys.SL Θ hΘ).traceVertex i₀ u.1 (π.Γ.N ∩ Θ).ncard ∈ π.borderSet n₁ := by + have hmem := (sys.SL Θ hΘ).traceVertex_mem_borderSet hcard i₀ u.2 (π.Γ.N ∩ Θ).ncard + rwa [stepIdx_self] at hmem + have hv_A : (sys.SL Θ hΘ).traceVertex i₀ u.1 (π.Γ.N ∩ Θ).ncard ∈ A.vertexSet := + hbs₁_sub_A hv_bs₁ + have hnot_sub : ¬ ((sys.SL Θ hΘ).circumnavigationVertices i₀ u.1 ⊆ A.vertexSet) := + theorem_10_2_proof (sys.SL Θ hΘ) h𝒯 htrue.1 hwarp hred le_rfl (by omega) rfl hcard i₀ u.2 + hAB hord_le + rw [← (sys.SL Θ hΘ).support_circWalk_eq_circumnavigationVertices i₀ u.1, + Set.not_subset] at hnot_sub + rcases hnot_sub with ⟨z, hz_sup, hz_notA⟩ + change z ∈ ((sys.SL Θ hΘ).circWalk i₀ u.1 (π.Γ.N ∩ Θ).ncard).support at hz_sup + rw [← ((sys.SL Θ hΘ).circWalk i₀ u.1 (π.Γ.N ∩ Θ).ncard).cons_tail_support, + List.mem_cons] at hz_sup + have hz_tail : z ∈ ((sys.SL Θ hΘ).circWalk i₀ u.1 (π.Γ.N ∩ Θ).ncard).support.tail := + hz_sup.resolve_left fun hEq => hz_notA (hEq ▸ hu_A) + exact walk_first_last_out_of_isSeparation hsep + ((sys.SL Θ hΘ).circWalk i₀ u.1 (π.Γ.N ∩ Θ).ncard) hu_A hv_A ⟨z, hz_tail, hz_notA⟩ + +private theorem empty_prefix_starts_on_both_borders + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + (sys : π.SystemOfStandardLinkages) + {c₀ : Set π.S} + {A : Hypergraph α β} + (hc₀A : π.cellGraph c₀ ≤ A) + (X : Set α) + (Θ : Set π.S) + (hΘ : Θ ∈ cuffs π.S) + (i₀ : Fin (π.Γ.N ∩ Θ).ncard) + (hi₀_eq : (sys.E Θ hΘ).cell i₀ = c₀) + (hcard : ∀ (r : Fin (π.Γ.N ∩ Θ).ncard), (π.borderSet ((sys.E Θ hΘ).node r)).ncard = π.warpAt + Θ) + (L₁_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → List α) + (L₂_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → List α) + (m_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → α) + (a_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → α) + (b_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → α) + (hwalk_spec : ∀ (u : ↑(π.borderSet ((sys.E Θ hΘ).node i₀))), ((sys.SL Θ hΘ).circWalk i₀ (↑u) + (π.Γ.N ∩ + Θ).ncard).support.tail = L₁_fn u ++ m_fn u :: L₂_fn u ∧ (∀ x ∈ L₁_fn u, x ∈ A.vertexSet) ∧ + m_fn u ∉ A.vertexSet ∧ a_fn u ∈ X ∧ (L₁_fn u = [] ∧ a_fn u = ↑u ∨ a_fn u ∈ L₁_fn u) ∧ b_fn u + ∈ X ∧ b_fn u ∈ L₂_fn u ∧ (sys.SL Θ hΘ).traceVertex i₀ (↑u) (π.Γ.N ∩ Θ).ncard ∈ L₂_fn u) : + ∀ (u : ↑(π.borderSet ((sys.E Θ hΘ).node i₀))), L₁_fn u = [] → a_fn u = ↑u ∧ ↑u ∈ π.borderSet + ((sys.E Θ hΘ).node i₀) ∩ π.borderSet ((sys.E Θ hΘ).node (cyclicSucc (Nat.zero_lt_of_lt + (sys.E Θ hΘ).two_le) i₀)) := by + let n₁ := (sys.E Θ hΘ).node i₀ + intro u hnil + obtain ⟨hEq, _, hm_notA, _, ha_cases, _, _, _⟩ := hwalk_spec u + have ha_eq : a_fn u = u.1 := by + rcases ha_cases with ⟨_, hEq_u⟩ | ha_L₁ + · exact hEq_u + · rw [hnil] at ha_L₁; exact (List.not_mem_nil ha_L₁).elim + refine ⟨ha_eq, u.2, ?_⟩ + obtain ⟨rest, hrest⟩ := sys.exists_support_tail_circWalk_eq_append hΘ i₀ u.1 + rw [hnil, List.nil_append] at hEq + have hstep_nil : ((sys.SL Θ hΘ).stepWalk i₀ u.1).support.tail = [] := by + rcases hstep_eq : ((sys.SL Θ hΘ).stepWalk i₀ u.1).support.tail with _ | ⟨hd, tl⟩ + · rfl + · exfalso + rw [hstep_eq, List.cons_append] at hrest + have hhd_eq : hd = m_fn u := List.cons.inj (hrest.symm.trans hEq) |>.1 + have hhd_tail : hd ∈ ((sys.SL Θ hΘ).stepWalk i₀ u.1).support.tail := + hstep_eq ▸ List.mem_cons_self + have hhd_c₀ : hd ∈ (π.cellGraph c₀).vertexSet := by + rw [← hi₀_eq] + exact (sys.SL Θ hΘ).mem_support_tail_subset_cellGraph hcard i₀ u.2 hhd_tail + exact hm_notA (hhd_eq ▸ hc₀A.vertexSet_subset hhd_c₀) + have hu_eq_step : u.1 = (sys.SL Θ hΘ).stepVertex i₀ u.1 := + start_eq_end_of_support_tail_eq_nil _ hstep_nil + rw [hu_eq_step] + exact ((sys.SL Θ hΘ).step_spec_of_mem hcard i₀ u.2).choose_spec.2.2.2.2.2 + +private theorem nonempty_prefix_has_distinct_interior_start + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + (sys : π.SystemOfStandardLinkages) + {A : Hypergraph α β} + (X : Set α) + (Θ : Set π.S) + (hΘ : Θ ∈ cuffs π.S) + (i₀ : Fin (π.Γ.N ∩ Θ).ncard) + (hcard : ∀ (r : Fin (π.Γ.N ∩ Θ).ncard), (π.borderSet ((sys.E Θ hΘ).node r)).ncard = π.warpAt + Θ) + (hne_nil : ∀ w ∈ π.borderSet ((sys.E Θ hΘ).node i₀), ((sys.SL Θ hΘ).circWalk i₀ w + (π.Γ.N ∩ Θ).ncard).support.tail + ≠ []) + (L₁_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → List α) + (L₂_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → List α) + (m_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → α) + (a_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → α) + (b_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → α) + (hwalk_spec : ∀ (u : ↑(π.borderSet ((sys.E Θ hΘ).node i₀))), ((sys.SL Θ hΘ).circWalk i₀ (↑u) + (π.Γ.N ∩ + Θ).ncard).support.tail = L₁_fn u ++ m_fn u :: L₂_fn u ∧ (∀ x ∈ L₁_fn u, x ∈ A.vertexSet) ∧ + m_fn u ∉ A.vertexSet ∧ a_fn u ∈ X ∧ (L₁_fn u = [] ∧ a_fn u = ↑u ∨ a_fn u ∈ L₁_fn u) ∧ b_fn u + ∈ X ∧ b_fn u ∈ L₂_fn u ∧ (sys.SL Θ hΘ).traceVertex i₀ (↑u) (π.Γ.N ∩ Θ).ncard ∈ L₂_fn u) : + ∀ (u : ↑(π.borderSet ((sys.E Θ hΘ).node i₀))), L₁_fn u ≠ [] → a_fn u ∈ + ((sys.SL Θ hΘ).circWalk i₀ (↑u) (π.Γ.N ∩ + Θ).ncard).support.tail ∧ a_fn u ≠ b_fn u ∧ a_fn u ∉ π.borderSet ((sys.E Θ hΘ).node i₀) := by + let n₁ := (sys.E Θ hΘ).node i₀ + intro u hne + obtain ⟨hEq, _, _, _, ha_cases, _, hb_L₂, hv_L₂⟩ := hwalk_spec u + have ha_L₁ : a_fn u ∈ L₁_fn u := + ha_cases.resolve_left fun h => hne h.1 + have hnodup : (L₁_fn u ++ m_fn u :: L₂_fn u).Nodup := + hEq ▸ (sys.SL Θ hΘ).nodup_support_tail_circWalk hcard i₀ u.2 le_rfl + have hdisj_L₁_L₂ : List.Disjoint (L₁_fn u) (m_fn u :: L₂_fn u) := + fun x hx₁ hx₂ => (List.nodup_append.mp hnodup).2.2 x hx₁ x hx₂ rfl + have ha_tail : a_fn u ∈ ((sys.SL Θ hΘ).circWalk i₀ u.1 (π.Γ.N ∩ Θ).ncard).support.tail := + hEq ▸ List.mem_append_left _ ha_L₁ + have ha_ne_b : a_fn u ≠ b_fn u := fun hEq_ab => + hdisj_L₁_L₂ ha_L₁ (hEq_ab ▸ List.mem_cons_of_mem _ hb_L₂) + have ha_ne_v : a_fn u ≠ (sys.SL Θ hΘ).traceVertex i₀ u.1 (π.Γ.N ∩ Θ).ncard := fun hEq_av + => + hdisj_L₁_L₂ ha_L₁ (hEq_av ▸ List.mem_cons_of_mem _ hv_L₂) + have ha_not_bs₁ : a_fn u ∉ π.borderSet n₁ := by + intro ha_bs₁ + have hEq_av := ((sys.SL Θ hΘ).mem_support_tail_circWalk_inter_borderSet_iff + hcard i₀ hne_nil u.2 ha_bs₁).mp ha_tail + exact ha_ne_v hEq_av + exact ⟨ha_tail, ha_ne_b, ha_not_bs₁⟩ + +private theorem circumnavigation_prefix_map_injective + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + (sys : π.SystemOfStandardLinkages) + (Θ : Set π.S) + (hΘ : Θ ∈ cuffs π.S) + (i₀ : Fin (π.Γ.N ∩ Θ).ncard) + (n₂ : π.S) + (hcard : ∀ (r : Fin (π.Γ.N ∩ Θ).ncard), (π.borderSet ((sys.E Θ hΘ).node r)).ncard = π.warpAt + Θ) + (L₁_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → List α) + (a_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → α) + (b_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → α) + (a_map : α → α) + (hmap_a : ∀ u (hu : u ∈ π.borderSet ((sys.E Θ hΘ).node i₀)), + a_map u = a_fn ⟨u, hu⟩) + (ha_nil_case : ∀ (u : ↑(π.borderSet ((sys.E Θ hΘ).node i₀))), L₁_fn u = [] → a_fn u = ↑u + ∧ ↑u ∈ π.borderSet ((sys.E Θ hΘ).node i₀) ∩ + π.borderSet n₂) + (ha_nonnil_case : ∀ (u : ↑(π.borderSet ((sys.E Θ hΘ).node i₀))), L₁_fn u ≠ [] → a_fn u ∈ + ((sys.SL Θ hΘ).circWalk + i₀ (↑u) (π.Γ.N ∩ Θ).ncard).support.tail ∧ a_fn u ≠ b_fn u ∧ a_fn u ∉ π.borderSet + ((sys.E Θ hΘ).node i₀)) : + InjOn a_map (π.borderSet ((sys.E Θ hΘ).node i₀)) := by + let n₁ := (sys.E Θ hΘ).node i₀ + intro u₁ hu₁ u₂ hu₂ hEq + rw [hmap_a u₁ hu₁, hmap_a u₂ hu₂] at hEq + by_contra hne + by_cases h1 : L₁_fn ⟨u₁, hu₁⟩ = [] <;> by_cases h2 : L₁_fn ⟨u₂, hu₂⟩ = [] + · have h1_eq := (ha_nil_case ⟨u₁, hu₁⟩ h1).1 + have h2_eq := (ha_nil_case ⟨u₂, hu₂⟩ h2).1 + exact hne (h1_eq.symm.trans (hEq.trans h2_eq)) + · have h1_eq := (ha_nil_case ⟨u₁, hu₁⟩ h1).1 + have h2_not := (ha_nonnil_case ⟨u₂, hu₂⟩ h2).2.2 + exact h2_not (hEq ▸ h1_eq ▸ hu₁) + · have h1_not := (ha_nonnil_case ⟨u₁, hu₁⟩ h1).2.2 + have h2_eq := (ha_nil_case ⟨u₂, hu₂⟩ h2).1 + exact h1_not (hEq.symm ▸ h2_eq ▸ hu₂) + · have h1_tail := (ha_nonnil_case ⟨u₁, hu₁⟩ h1).1 + have h2_tail := (ha_nonnil_case ⟨u₂, hu₂⟩ h2).1 + exact (sys.SL Θ hΘ).disjoint_support_tail_circWalk hcard i₀ hu₁ hu₂ hne + h1_tail (hEq ▸ h2_tail) + +private theorem circumnavigation_image_intersection_on_both_borders + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + (sys : π.SystemOfStandardLinkages) + (Θ : Set π.S) + (hΘ : Θ ∈ cuffs π.S) + (i₀ : Fin (π.Γ.N ∩ Θ).ncard) + (n₂ : π.S) + (hcard : ∀ (r : Fin (π.Γ.N ∩ Θ).ncard), (π.borderSet ((sys.E Θ hΘ).node r)).ncard = π.warpAt + Θ) + (L₁_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → List α) + (a_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → α) + (b_fn : ↑(π.borderSet ((sys.E Θ hΘ).node i₀)) → α) + (a_map : α → α) + (hmap_a : ∀ u (hu : u ∈ π.borderSet ((sys.E Θ hΘ).node i₀)), + a_map u = a_fn ⟨u, hu⟩) + (b_map : α → α) + (hmap_b : ∀ u (hu : u ∈ π.borderSet ((sys.E Θ hΘ).node i₀)), + b_map u = b_fn ⟨u, hu⟩) + (hb_in_tail : ∀ (u : ↑(π.borderSet ((sys.E Θ hΘ).node i₀))), b_fn u ∈ + ((sys.SL Θ hΘ).circWalk i₀ (↑u) (π.Γ.N ∩ + Θ).ncard).support.tail) + (ha_nil_case : ∀ (u : ↑(π.borderSet ((sys.E Θ hΘ).node i₀))), L₁_fn u = [] → a_fn u = ↑u + ∧ ↑u ∈ π.borderSet ((sys.E Θ hΘ).node i₀) ∩ + π.borderSet n₂) + (ha_nonnil_case : ∀ (u : ↑(π.borderSet ((sys.E Θ hΘ).node i₀))), L₁_fn u ≠ [] → a_fn u ∈ + ((sys.SL Θ hΘ).circWalk + i₀ (↑u) (π.Γ.N ∩ Θ).ncard).support.tail ∧ a_fn u ≠ b_fn u ∧ a_fn u ∉ π.borderSet + ((sys.E Θ hΘ).node i₀)) : + a_map '' π.borderSet ((sys.E Θ hΘ).node i₀) ∩ b_map '' π.borderSet + ((sys.E Θ hΘ).node i₀) ⊆ π.borderSet ((sys.E Θ hΘ).node i₀) ∩ π.borderSet n₂ := by + let n₁ := (sys.E Θ hΘ).node i₀ + rintro z ⟨⟨u₁, hu₁, rfl⟩, ⟨u₂, hu₂, hEq⟩⟩ + have hEq' : a_fn ⟨u₁, hu₁⟩ = b_fn ⟨u₂, hu₂⟩ := by + rw [hmap_a u₁ hu₁, hmap_b u₂ hu₂] at hEq + exact hEq.symm + by_cases h1 : L₁_fn ⟨u₁, hu₁⟩ = [] + · obtain ⟨ha_eq, hu₁_mem⟩ := ha_nil_case ⟨u₁, hu₁⟩ h1 + rw [hmap_a u₁ hu₁, ha_eq] + exact hu₁_mem + · exfalso + obtain ⟨ha₁_tail, ha₁_ne_b₁, _⟩ := ha_nonnil_case ⟨u₁, hu₁⟩ h1 + have hb₂_tail := hb_in_tail ⟨u₂, hu₂⟩ + by_cases hu_eq : u₁ = u₂ + · subst hu_eq + exact ha₁_ne_b₁ hEq' + · exact (sys.SL Θ hΘ).disjoint_support_tail_circWalk hcard i₀ hu₁ hu₂ hu_eq + ha₁_tail (hEq' ▸ hb₂_tail) + +/-- **Graph Minors XVII, (11.6)** (page 194): +"$|V(A \cap B) - S| \le |\tilde{c}_0|$, and if equality holds then* +$$|V(A \cap B) \cap S| = |V(\alpha(c_0) \cap \alpha(-c_0)) \cap S|.$$" -/ +theorem theorem_11_6_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + (sys : π.SystemOfStandardLinkages) + {c₀ : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) + {A B : Hypergraph α β} (hAB : (A, B) ∈ 𝒯) + (hc₀A : π.cellGraph c₀ ≤ A) + (hle : separationOrder A B ≤ ((π.cellGraph c₀).vertexSet ∩ π.otherVertices c₀).ncard) : + ((A ∩ B).vertexSet \ sys.S).ncard ≤ (tilde c₀).ncard ∧ + (((A ∩ B).vertexSet \ sys.S).ncard = (tilde c₀).ncard → + ((A ∩ B).vertexSet ∩ sys.S).ncard = + (((π.cellGraph c₀).vertexSet ∩ π.otherVertices c₀) ∩ sys.S).ncard) := by + classical + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have : ConnectedSpace π.S := π.connected + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof h𝒯 π htrue hred hwarp hθ + have hsep : G.IsSeparation A B := h𝒯.isSeparation hAB + set X := (A ∩ B).vertexSet + set Y := (π.cellGraph c₀).vertexSet ∩ π.otherVertices c₀ + have hX_fin : X.Finite := (A ∩ B).vertexSet_finite + have hY_fin : Y.Finite := (π.cellGraph c₀).vertexSet_finite.subset inter_subset_left + have hX_split : (X ∩ sys.S).ncard + (X \ sys.S).ncard = X.ncard := + ncard_inter_add_ncard_sdiff_eq_ncard X sys.S hX_fin + have hY_split : (Y ∩ sys.S).ncard + (Y \ sys.S).ncard = Y.ncard := + ncard_inter_add_ncard_sdiff_eq_ncard Y sys.S hY_fin + have hγ_card : (π.gammaImage (tilde c₀)).ncard = (tilde c₀).ncard := by + have hsub_dom : tilde c₀ ⊆ π.domγ := hdom ▸ π.Γ.tilde_subset_N hc₀ + have himg : π.gammaImage (tilde c₀) = π.nodeVertex '' tilde c₀ := by + ext v + simp only [Portrayal.gammaImage, mem_image] + exact ⟨fun ⟨n, ⟨hnt, _⟩, hEq⟩ => ⟨n, hnt, hEq⟩, + fun ⟨n, hnt, hEq⟩ => ⟨n, ⟨hnt, hsub_dom hnt⟩, hEq⟩⟩ + rw [himg, (π.nodeVertex_injOn.mono hsub_dom).ncard_image] + have hY_diff_card : (Y \ sys.S).ncard = (tilde c₀).ncard := by + by_cases hbd : (c₀ ∩ bd π.S).Nonempty + · rcases hbd with ⟨x₀, hxc₀, hxbd⟩ + let Θ := connectedComponentIn (bd π.S) x₀ + have hΘ : Θ ∈ cuffs π.S := ⟨x₀, hxbd, rfl⟩ + have hc₀Θ : (c₀ ∩ Θ).Nonempty := ⟨x₀, hxc₀, mem_connectedComponentIn hxbd⟩ + have hc₀_range : c₀ ∈ Set.range (sys.E Θ hΘ).cell := by + rw [(sys.E Θ hΘ).range_cell]; exact ⟨hc₀, hc₀Θ⟩ + rcases hc₀_range with ⟨i₀, hi₀_eq⟩ + have hbd_props := sys.border_cell_properties h𝒯 π htrue hred hwarp hθ hΘ i₀ + have hdiff_eq : Y \ sys.S = π.gammaImage (tilde c₀) := by + dsimp only [Y] + rw [← hi₀_eq] + exact hbd_props.2.2.1 + rw [hdiff_eq, hγ_card] + · have hint_props := sys.internal_cell_properties h𝒯 π htrue hred hwarp hθ hc₀ hbd + have hdiff_eq : Y \ sys.S = π.gammaImage (tilde c₀) := by + dsimp only [Y] + rw [(hint_props.2.mono_left inter_subset_left).sdiff_eq_left, hint_props.1] + rw [hdiff_eq, hγ_card] + have hinter_le : (Y ∩ sys.S).ncard ≤ (X ∩ sys.S).ncard := by + by_cases hbd : (c₀ ∩ bd π.S).Nonempty + · rcases hbd with ⟨x₀, hxc₀, hxbd⟩ + let Θ := connectedComponentIn (bd π.S) x₀ + have hΘ : Θ ∈ cuffs π.S := ⟨x₀, hxbd, rfl⟩ + have hc₀Θ : (c₀ ∩ Θ).Nonempty := ⟨x₀, hxc₀, mem_connectedComponentIn hxbd⟩ + have hc₀_range : c₀ ∈ Set.range (sys.E Θ hΘ).cell := by + rw [(sys.E Θ hΘ).range_cell]; exact ⟨hc₀, hc₀Θ⟩ + rcases hc₀_range with ⟨i₀, hi₀_eq⟩ + have hk_pos : 0 < (π.Γ.N ∩ Θ).ncard := by have := (sys.E Θ hΘ).two_le; omega + let n₁ := (sys.E Θ hΘ).node i₀ + let n₂ := (sys.E Θ hΘ).node (cyclicSucc hk_pos i₀) + have hbd_props := sys.border_cell_properties h𝒯 π htrue hred hwarp hθ hΘ i₀ + obtain ⟨hcard, hbs₁_sub, _⟩ := + sys.borderSet_subset_cellSet h𝒯 π htrue hred hwarp hθ hΘ i₀ + have hY_inter : Y ∩ sys.S = π.borderSet n₁ ∪ π.borderSet n₂ := by + dsimp only [Y] + rw [← hi₀_eq] + exact hbd_props.2.1 + have hΘ_bd : Θ ⊆ bd π.S := connectedComponentIn_subset (bd π.S) x₀ + have hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S := + ⟨((sys.E Θ hΘ).node_mem i₀).1, hΘ_bd ((sys.E Θ hΘ).node_mem i₀).2⟩ + have hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S := + ⟨((sys.E Θ hΘ).node_mem (cyclicSucc hk_pos i₀)).1, + hΘ_bd ((sys.E Θ hΘ).node_mem (cyclicSucc hk_pos i₀)).2⟩ + have hbs₁_fin : (π.borderSet n₁).Finite := π.borderSet_finite hn₁_bd + have hbs₂_fin : (π.borderSet n₂).Finite := π.borderSet_finite hn₂_bd + have hc₀_bd : (c₀ ∩ bd π.S).Nonempty := ⟨x₀, hxc₀, hxbd⟩ + have htilde_i₀ : tilde c₀ = {n₁, n₂} := hi₀_eq ▸ (sys.E Θ hΘ).cell_tilde i₀ + have hn₁_t : n₁ ∈ tilde c₀ := htilde_i₀ ▸ mem_insert _ _ + have hbs₁_sub_A : π.borderSet n₁ ⊆ A.vertexSet := + (π.p3_subset c₀ hc₀ hc₀_bd n₁ hn₁_t).trans hc₀A.vertexSet_subset + have hp_pos : 1 ≤ p := π.one_le_warp.trans hwarp + have hY_le : Y.ncard ≤ 2 * p + 2 := + sys.ncard_inter_otherVertices_le h𝒯 π htrue hred hwarp hθ hc₀ + have hord_le : separationOrder A B ≤ 2 * p + 3 := by + change X.ncard ≤ Y.ncard at hle + change X.ncard ≤ 2 * p + 3 + omega + have hne_nil : ∀ w ∈ π.borderSet n₁, + ((sys.SL Θ hΘ).circWalk i₀ w (π.Γ.N ∩ Θ).ncard).support.tail ≠ [] := + fun w hw => (sys.SL Θ hΘ).support_tail_circWalk_ne_nil + h𝒯 htrue.1 hwarp hred (by omega) (by omega) hcard i₀ hw + have hex_walk : ∀ u : π.borderSet n₁, + ∃ (L₁ L₂ : List α) (m a b : α), + ((sys.SL Θ hΘ).circWalk i₀ u.1 (π.Γ.N ∩ Θ).ncard).support.tail = L₁ ++ m :: L₂ ∧ + (∀ x ∈ L₁, x ∈ A.vertexSet) ∧ + m ∉ A.vertexSet ∧ + a ∈ X ∧ ((L₁ = [] ∧ a = u.1) ∨ a ∈ L₁) ∧ + b ∈ X ∧ b ∈ L₂ ∧ (sys.SL Θ hΘ).traceVertex i₀ u.1 (π.Γ.N ∩ Θ).ncard ∈ L₂ := by + exact circumnavigation_walk_crosses_separation (α := α) (β := β) (G := G) (𝒯 := 𝒯) (θ := + θ) (p := p) h𝒯 π htrue hred hwarp hθ sys (A := A) (B := B) hAB hsep Θ hΘ + i₀ hcard hbs₁_sub_A hord_le + choose L₁_fn L₂_fn m_fn a_fn b_fn hwalk_spec using hex_walk + by_cases hbs₁_ne : (π.borderSet n₁).Nonempty + · obtain ⟨u₀, hu₀⟩ := hbs₁_ne + let a_map : α → α := fun u => if hu : u ∈ π.borderSet n₁ then a_fn ⟨u, hu⟩ else a_fn ⟨u₀, + hu₀⟩ + let b_map : α → α := fun u => if hu : u ∈ π.borderSet n₁ then b_fn ⟨u, hu⟩ else b_fn ⟨u₀, + hu₀⟩ + have ha_mem_XS : ∀ u ∈ π.borderSet n₁, a_map u ∈ X ∩ sys.S := by + intro u hu + dsimp only [a_map] + rw [dite_eq_left hu] + obtain ⟨hEq, _, _, ha_X, ha_cases, _, _, _⟩ := hwalk_spec ⟨u, hu⟩ + refine ⟨ha_X, ?_⟩ + apply sys.support_circWalk_subset_S h𝒯 π htrue hred hwarp hθ hΘ i₀ hu + rw [← ((sys.SL Θ hΘ).circWalk i₀ u (π.Γ.N ∩ Θ).ncard).cons_tail_support, List.mem_cons] + rcases ha_cases with ⟨_, hEq_u⟩ | ha_L₁ + · exact Or.inl hEq_u + · exact Or.inr (hEq ▸ List.mem_append_left _ ha_L₁) + have hb_mem_XS : ∀ u ∈ π.borderSet n₁, b_map u ∈ X ∩ sys.S := by + intro u hu + dsimp only [b_map] + rw [dite_eq_left hu] + obtain ⟨hEq, _, _, _, _, hb_X, hb_L₂, _⟩ := hwalk_spec ⟨u, hu⟩ + refine ⟨hb_X, ?_⟩ + apply sys.support_circWalk_subset_S h𝒯 π htrue hred hwarp hθ hΘ i₀ hu + rw [← ((sys.SL Θ hΘ).circWalk i₀ u (π.Γ.N ∩ Θ).ncard).cons_tail_support, List.mem_cons] + exact Or.inr (hEq ▸ List.mem_append_right _ (List.mem_cons_of_mem _ hb_L₂)) + have hb_in_tail : ∀ u : π.borderSet n₁, + b_fn u ∈ ((sys.SL Θ hΘ).circWalk i₀ u.1 (π.Γ.N ∩ Θ).ncard).support.tail := by + intro u + obtain ⟨hEq, _, _, _, _, _, hb_L₂, _⟩ := hwalk_spec u + exact hEq ▸ List.mem_append_right _ (List.mem_cons_of_mem _ hb_L₂) + have ha_nil_case : ∀ u : π.borderSet n₁, L₁_fn u = [] → + a_fn u = u.1 ∧ u.1 ∈ π.borderSet n₁ ∩ π.borderSet n₂ := by + exact empty_prefix_starts_on_both_borders (α := α) (β := β) (G := G) π sys (c₀ := c₀) (A + := A) hc₀A X Θ hΘ i₀ hi₀_eq hcard L₁_fn L₂_fn m_fn a_fn b_fn hwalk_spec + have ha_nonnil_case : ∀ u : π.borderSet n₁, L₁_fn u ≠ [] → + a_fn u ∈ ((sys.SL Θ hΘ).circWalk i₀ u.1 (π.Γ.N ∩ Θ).ncard).support.tail ∧ + a_fn u ≠ b_fn u ∧ + a_fn u ∉ π.borderSet n₁ := by + exact nonempty_prefix_has_distinct_interior_start (α := α) (β := β) (G := G) π sys (A := + A) X Θ hΘ i₀ hcard hne_nil L₁_fn L₂_fn m_fn a_fn b_fn hwalk_spec + have ha_inj : InjOn a_map (π.borderSet n₁) := by + exact circumnavigation_prefix_map_injective (α := α) (β := β) (G := G) π sys Θ hΘ i₀ + n₂ hcard L₁_fn a_fn b_fn a_map (fun _ h => dite_eq_left h) ha_nil_case ha_nonnil_case + have hb_inj : InjOn b_map (π.borderSet n₁) := by + intro u₁ hu₁ u₂ hu₂ hEq + dsimp only [b_map] at hEq + rw [dite_eq_left hu₁, dite_eq_left hu₂] at hEq + by_contra hne + exact (sys.SL Θ hΘ).disjoint_support_tail_circWalk hcard i₀ hu₁ hu₂ hne + (hb_in_tail ⟨u₁, hu₁⟩) (hEq ▸ hb_in_tail ⟨u₂, hu₂⟩) + have hinter_ab_sub : + (a_map '' π.borderSet n₁) ∩ (b_map '' π.borderSet n₁) ⊆ + π.borderSet n₁ ∩ π.borderSet n₂ := by + exact circumnavigation_image_intersection_on_both_borders (α := α) (β := β) (G := G) π + sys Θ hΘ i₀ n₂ hcard L₁_fn a_fn b_fn a_map (fun _ h => dite_eq_left h) b_map + (fun _ h => dite_eq_left h) hb_in_tail ha_nil_case + ha_nonnil_case + set A_set := a_map '' π.borderSet n₁ + set B_set := b_map '' π.borderSet n₁ + have hA_fin : A_set.Finite := hbs₁_fin.image a_map + have hB_fin : B_set.Finite := hbs₁_fin.image b_map + have hA_card : A_set.ncard = π.warpAt Θ := by + rw [ha_inj.ncard_image, hcard i₀] + have hB_card : B_set.ncard = π.warpAt Θ := by + rw [hb_inj.ncard_image, hcard i₀] + have hbs₁_card : (π.borderSet n₁).ncard = π.warpAt Θ := hcard i₀ + have hbs₂_card : (π.borderSet n₂).ncard = π.warpAt Θ := hcard (cyclicSucc hk_pos i₀) + have hinter_card_le : (A_set ∩ B_set).ncard ≤ (π.borderSet n₁ ∩ π.borderSet n₂).ncard := + ncard_le_ncard hinter_ab_sub (hbs₁_fin.subset inter_subset_left) + have hunion_bs : + (π.borderSet n₁ ∪ π.borderSet n₂).ncard + (π.borderSet n₁ ∩ π.borderSet n₂).ncard = + π.warpAt Θ + π.warpAt Θ := by + rw [ncard_union_add_ncard_inter _ _ hbs₁_fin hbs₂_fin, hbs₁_card, hbs₂_card] + have hunion_AB : + (A_set ∪ B_set).ncard + (A_set ∩ B_set).ncard = π.warpAt Θ + π.warpAt Θ := by + rw [ncard_union_add_ncard_inter _ _ hA_fin hB_fin] + exact congrArg₂ (· + ·) hA_card hB_card + have hbs_le_AB : (π.borderSet n₁ ∪ π.borderSet n₂).ncard ≤ (A_set ∪ B_set).ncard := by + omega + have hAB_sub_XS : A_set ∪ B_set ⊆ X ∩ sys.S := by + rintro z (⟨u, hu, rfl⟩ | ⟨u, hu, rfl⟩) + · exact ha_mem_XS u hu + · exact hb_mem_XS u hu + rw [hY_inter] + exact hbs_le_AB.trans (ncard_le_ncard hAB_sub_XS (hX_fin.subset inter_subset_left)) + · have hq0 : π.warpAt Θ = 0 := by + have h1 := hcard i₀ + rw [not_nonempty_iff_eq_empty.mp hbs₁_ne, ncard_empty] at h1 + exact h1.symm + have hbs₂_empty : π.borderSet n₂ = ∅ := by + have hcard2 : (π.borderSet n₂).ncard = 0 := (hcard (cyclicSucc hk_pos i₀)).trans hq0 + exact (ncard_eq_zero hbs₂_fin).mp hcard2 + rw [hY_inter, not_nonempty_iff_eq_empty.mp hbs₁_ne, hbs₂_empty, empty_union, ncard_empty] + exact Nat.zero_le _ + · have hint_props := sys.internal_cell_properties h𝒯 π htrue hred hwarp hθ hc₀ hbd + have hY_inter_empty : Y ∩ sys.S = ∅ := + (hint_props.2.mono_left inter_subset_left).inter_eq + rw [hY_inter_empty, ncard_empty] + exact Nat.zero_le _ + change X.ncard ≤ Y.ncard at hle + omega + +private theorem distinct_nodes_for_dual_vertices + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {A : Hypergraph α β} + {B : Hypergraph α β} + (hdom : π.domγ = π.Γ.N) + (hsep : G.IsSeparation A B) + : + ∀ (d : π.crossingCells A B), ∃ n ∈ tilde ↑d, π.nodeVertex n ∉ (A ∩ B).vertexSet ∧ (π.gammaImage + (tilde ↑d) ⊆ + insert (π.nodeVertex n) A.vertexSet ∨ π.gammaImage (tilde ↑d) ⊆ insert (π.nodeVertex n) + B.vertexSet) := by + intro ⟨d, ⟨hd_star, hnotA, hnotB⟩⟩ + have hdC : d ∈ π.Γ.C := hd_star.1 + let TA := {n ∈ tilde d | π.nodeVertex n ∉ A.vertexSet} + let TB := {n ∈ tilde d | π.nodeVertex n ∉ B.vertexSet} + have htd_fin : (tilde d).Finite := π.Γ.finite_tilde_cell hdC + have hTA_fin : TA.Finite := htd_fin.subset fun _ h => h.1 + have hTB_fin : TB.Finite := htd_fin.subset fun _ h => h.1 + have hTA_ne : TA.Nonempty := by + rw [Set.not_subset] at hnotA + rcases hnotA with ⟨_, ⟨n, ⟨hnt, _⟩, rfl⟩, hn_notA⟩ + exact ⟨n, hnt, hn_notA⟩ + have hTB_ne : TB.Nonempty := by + rw [Set.not_subset] at hnotB + rcases hnotB with ⟨_, ⟨n, ⟨hnt, _⟩, rfl⟩, hn_notB⟩ + exact ⟨n, hnt, hn_notB⟩ + have hdisj_TAB : Disjoint TA TB := by + rw [Set.disjoint_left] + intro n hnA hnB + have hndom : n ∈ π.domγ := hdom ▸ π.Γ.tilde_subset_N hdC hnA.1 + have hnG : π.nodeVertex n ∈ G.vertexSet := π.nodeVertex_mem n hndom + rw [← hsep.vertexSet_union] at hnG + rcases hnG with hA | hB + · exact hnA.2 hA + · exact hnB.2 hB + have hTAB_le : TA.ncard + TB.ncard ≤ 3 := by + rw [← ncard_union_eq hdisj_TAB hTA_fin hTB_fin] + have hsub : TA ∪ TB ⊆ tilde d := union_subset (fun _ h => h.1) (fun _ h => h.1) + exact (ncard_le_ncard hsub htd_fin).trans + (π.Γ.ncard_tilde_cell_le hdC) + have hTA_pos : 1 ≤ TA.ncard := hTA_ne.ncard_pos hTA_fin + have hTB_pos : 1 ≤ TB.ncard := hTB_ne.ncard_pos hTB_fin + have h1 : TA.ncard = 1 ∨ TB.ncard = 1 := by omega + rcases h1 with hTA1 | hTB1 + · obtain ⟨n, hn_eq⟩ := ncard_eq_one.mp hTA1 + have hn_TA : n ∈ TA := hn_eq ▸ mem_singleton n + refine ⟨n, hn_TA.1, fun hAB_mem => hn_TA.2 hAB_mem.1, Or.inl ?_⟩ + rintro _ ⟨m, ⟨hmt, _⟩, rfl⟩ + by_cases hmA : π.nodeVertex m ∈ A.vertexSet + · exact Or.inr hmA + · have hm_TA : m ∈ TA := ⟨hmt, hmA⟩ + rw [hn_eq, mem_singleton_iff] at hm_TA + exact Or.inl (congrArg π.nodeVertex hm_TA) + · obtain ⟨n, hn_eq⟩ := ncard_eq_one.mp hTB1 + have hn_TB : n ∈ TB := hn_eq ▸ mem_singleton n + refine ⟨n, hn_TB.1, fun hAB_mem => hn_TB.2 hAB_mem.2, Or.inr ?_⟩ + rintro _ ⟨m, ⟨hmt, _⟩, rfl⟩ + by_cases hmB : π.nodeVertex m ∈ B.vertexSet + · exact Or.inr hmB + · have hm_TB : m ∈ TB := ⟨hmt, hmB⟩ + rw [hn_eq, mem_singleton_iff] at hm_TB + exact Or.inl (congrArg π.nodeVertex hm_TB) + +private theorem vertices_of_each_cell_lie_on_one_separation_side + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {θ : ℕ} + {p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hwarp : π.warp ≤ p) + {A : Hypergraph α β} + {B : Hypergraph α β} + (hred23 : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hθ45 : 4 * p + 5 < θ) + (n_fn : ↑(π.crossingCells A B) → π.S) + (hn_spec : ∀ (d : ↑(π.crossingCells A B)), n_fn d ∈ tilde ↑d ∧ π.nodeVertex (n_fn d) ∉ + (A ∩ B).vertexSet ∧ + (π.gammaImage (tilde ↑d) ⊆ insert (π.nodeVertex (n_fn d)) A.vertexSet ∨ π.gammaImage (tilde + ↑d) ⊆ insert (π.nodeVertex (n_fn d)) B.vertexSet)) + (W_D : Set α) + (hW_D : ∀ d, π.nodeVertex (n_fn d) ∈ W_D) + (A' : Hypergraph α β) + (B' : Hypergraph α β) + (hA'_V : A'.vertexSet = A.vertexSet ∪ W_D) + (hB'_V : B'.vertexSet = B.vertexSet ∪ W_D) : + ∀ c ∈ π.Γ.C, π.gammaImage (tilde c) ⊆ A'.vertexSet ∨ π.gammaImage (tilde c) ⊆ B'.vertexSet := by + let D := π.crossingCells A B + have hstar_side : ∀ c' ∈ π.Γ.CStar, + π.gammaImage (tilde c') ⊆ A'.vertexSet ∨ π.gammaImage (tilde c') ⊆ B'.vertexSet := by + intro c' hc' + by_cases hc'_D : c' ∈ D + · rcases (hn_spec ⟨c', hc'_D⟩).2.2 with hsubA | hsubB + · refine Or.inl (hsubA.trans ?_) + rw [hA'_V] + exact insert_subset (Or.inr (hW_D ⟨c', hc'_D⟩)) subset_union_left + · refine Or.inr (hsubB.trans ?_) + rw [hB'_V] + exact insert_subset (Or.inr (hW_D ⟨c', hc'_D⟩)) subset_union_left + · by_cases hA_sub : π.gammaImage (tilde c') ⊆ A.vertexSet + · exact Or.inl (hA_sub.trans (hA'_V.symm ▸ subset_union_left)) + · have hB_sub : π.gammaImage (tilde c') ⊆ B.vertexSet := by + by_contra hnotB + exact hc'_D ⟨hc', hA_sub, hnotB⟩ + exact Or.inr (hB_sub.trans (hB'_V.symm ▸ subset_union_left)) + intro c hc + obtain ⟨c', hc'_star, htilde_sub⟩ := + exists_mem_CStar_tilde_subset h𝒯 π htrue hred23 hwarp hθ45 hc + rcases hstar_side c' hc'_star with hA' | hB' + · exact Or.inl ((π.gammaImage_mono htilde_sub).trans hA') + · exact Or.inr ((π.gammaImage_mono htilde_sub).trans hB') + +private theorem separation_vertices_partition_off_linkages + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {θ : ℕ} + {p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hwarp : π.warp ≤ p) + {A : Hypergraph α β} + {B : Hypergraph α β} + (hred23 : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hθ45 : 4 * p + 5 < θ) + (sys : π.SystemOfStandardLinkages) : + ((A ∩ B).vertexSet ∩ π.gammaImage π.Γ.N).ncard + ((A ∩ B).vertexSet \ (sys.S ∪ π.gammaImage + π.Γ.N)).ncard = ((A ∩ B).vertexSet \ sys.S).ncard := by + have hdisj_γS : Disjoint (π.gammaImage π.Γ.N) sys.S := + sys.disjoint_gammaImage_N_S h𝒯 π htrue hred23 hwarp hθ45 + have h1 : (A ∩ B).vertexSet ∩ π.gammaImage π.Γ.N = + ((A ∩ B).vertexSet \ sys.S) ∩ π.gammaImage π.Γ.N := by + ext v + simp only [mem_inter_iff, mem_sdiff] + exact ⟨fun ⟨hvAB, hvγ⟩ => ⟨⟨hvAB, Set.disjoint_left.mp hdisj_γS hvγ⟩, hvγ⟩, + fun ⟨⟨hvAB, _⟩, hvγ⟩ => ⟨hvAB, hvγ⟩⟩ + have h2 : (A ∩ B).vertexSet \ (sys.S ∪ π.gammaImage π.Γ.N) = + ((A ∩ B).vertexSet \ sys.S) \ π.gammaImage π.Γ.N := by + ext v + simp only [mem_sdiff, mem_union, not_or, and_assoc] + rw [h1, h2] + exact ncard_inter_add_ncard_sdiff_eq_ncard + ((A ∩ B).vertexSet \ sys.S) (π.gammaImage π.Γ.N) + ((A ∩ B).vertexSet_finite.subset sdiff_subset) + +/-- **Graph Minors XVII, (11.7)** (page 195): +"$|V(A \cap B)| = |V(\alpha(c_0) \cap \alpha(-c_0))|.$" -/ +theorem theorem_11_7_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 4)) + (hwarp : π.warp ≤ p) + (hθ : 6 * p + 8 < θ) + {c₀ : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) + {A B : Hypergraph α β} (hAB : (A, B) ∈ 𝒯) + (hc₀A : π.cellGraph c₀ ≤ A) + (hle : separationOrder A B ≤ ((π.cellGraph c₀).vertexSet ∩ π.otherVertices c₀).ncard) : + separationOrder A B = ((π.cellGraph c₀).vertexSet ∩ π.otherVertices c₀).ncard := by + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have : ConnectedSpace π.S := π.connected + have hp_pos : 1 ≤ p := π.one_le_warp.trans hwarp + have hred23 : π.IsRedundant 𝒯 θ (2 * p + 3) := hred.mono (by omega) + have hθ45 : 4 * p + 5 < θ := by omega + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof + h𝒯 π htrue hred23 hwarp hθ45 + obtain ⟨sys⟩ := exists_systemOfStandardLinkages h𝒯 π htrue hred23 hwarp hθ45 + have hsep : G.IsSeparation A B := h𝒯.isSeparation hAB + have h116 := theorem_11_6_proof h𝒯 π htrue hred23 hwarp hθ45 sys hc₀ hAB hc₀A hle + have h115 := theorem_11_5_proof h𝒯 π htrue hred23 hwarp hθ45 sys hsep + set D := π.crossingCells A B + have hD_fin : D.Finite := π.Γ.finite_cells.subset fun _ hd => hd.1.1 + have hex_nd : ∀ d : D, ∃ n : π.S, + n ∈ tilde d.1 ∧ + π.nodeVertex n ∉ (A ∩ B).vertexSet ∧ + (π.gammaImage (tilde d.1) ⊆ insert (π.nodeVertex n) A.vertexSet ∨ + π.gammaImage (tilde d.1) ⊆ insert (π.nodeVertex n) B.vertexSet) := by + exact distinct_nodes_for_dual_vertices π hdom hsep + choose n_fn hn_spec using hex_nd + let N_D : Set π.S := {n : π.S | ∃ d : D, n_fn d = n} + have hND_sub_N : N_D ⊆ π.Γ.N := by + rintro _ ⟨d, rfl⟩ + exact π.Γ.tilde_subset_N d.2.1.1 (hn_spec d).1 + have hND_card_le : N_D.ncard ≤ D.ncard := by + have : Finite D := hD_fin.to_subtype + let f : D → N_D := fun d => ⟨n_fn d, ⟨d, rfl⟩⟩ + have hf : Function.Surjective f := by + rintro ⟨_, ⟨d, rfl⟩⟩ + exact ⟨d, rfl⟩ + simpa only [Nat.card_coe_set_eq] using Nat.card_le_card_of_surjective f hf + let W_D : Set α := π.nodeVertex '' N_D + have hWD_sub_G : W_D ⊆ G.vertexSet := by + rintro _ ⟨n, hn, rfl⟩ + exact π.nodeVertex_mem n (hdom ▸ hND_sub_N hn) + have hWD_card_le : W_D.ncard ≤ D.ncard := + (ncard_image_le (π.Γ.finite_N.subset hND_sub_N)).trans hND_card_le + let E_D : Hypergraph α β := { + vertexSet := W_D + edgeSet := ∅ + Inc := fun _ _ => False + vertex_mem_of_inc := fun _ _ h => h.elim + edge_mem_of_inc := fun _ _ h => h.elim + vertexSet_finite := G.vertexSet_finite.subset hWD_sub_G + edgeSet_finite := finite_empty + } + have hED_le : E_D ≤ G := ⟨hWD_sub_G, empty_subset _, fun _ h => h.elim⟩ + let A' := A ∪ E_D + let B' := B ∪ E_D + have hA'_le : A' ≤ G := union_le hsep.left_le hED_le + have hB'_le : B' ≤ G := union_le hsep.right_le hED_le + have hA'_V : A'.vertexSet = A.vertexSet ∪ W_D := rfl + have hB'_V : B'.vertexSet = B.vertexSet ∪ W_D := rfl + have hA'_E : A'.edgeSet = A.edgeSet := union_empty A.edgeSet + have hB'_E : B'.edgeSet = B.edgeSet := union_empty B.edgeSet + have hsep' : G.IsSeparation A' B' := by + rw [isSeparation_iff_of_le hA'_le hB'_le] + refine ⟨?_, ?_, ?_⟩ + · rw [hA'_V, hB'_V, ← union_union_distrib_right, hsep.vertexSet_union, + union_eq_self_of_subset_right hWD_sub_G] + · rw [hA'_E, hB'_E, hsep.edgeSet_union] + · rw [hA'_E, hB'_E]; exact hsep.edgeSet_inter_eq + have hAB'_V : (A' ∩ B').vertexSet = (A ∩ B).vertexSet ∪ W_D := by + change (A.vertexSet ∪ W_D) ∩ (B.vertexSet ∪ W_D) = A.vertexSet ∩ B.vertexSet ∪ W_D + ext v; simp only [mem_inter_iff, mem_union]; tauto + have hord_AB_le : separationOrder A B ≤ 2 * p + 2 := + hle.trans (sys.ncard_inter_otherVertices_le h𝒯 π htrue hred23 hwarp hθ45 hc₀) + have hD_le_3 : D.ncard ≤ 3 := by + have hsub1 : (A ∩ B).vertexSet \ (sys.S ∪ π.gammaImage π.Γ.N) ⊆ (A ∩ B).vertexSet \ sys.S := + sdiff_subset_sdiff Subset.rfl subset_union_left + have hle1 : ((A ∩ B).vertexSet \ (sys.S ∪ π.gammaImage π.Γ.N)).ncard ≤ + ((A ∩ B).vertexSet \ sys.S).ncard := + ncard_le_ncard hsub1 ((A ∩ B).vertexSet_finite.subset sdiff_subset) + exact (h115.trans hle1).trans (h116.1.trans (π.Γ.ncard_tilde_cell_le hc₀)) + have hord_A'B'_le : separationOrder A' B' ≤ 2 * p + 5 := by + change (A' ∩ B').vertexSet.ncard ≤ 2 * p + 5 + rw [hAB'_V] + have hle_sum := ncard_union_le (A ∩ B).vertexSet W_D + have : W_D.ncard ≤ 3 := hWD_card_le.trans hD_le_3 + change (A ∩ B).vertexSet.ncard ≤ 2 * p + 2 at hord_AB_le + omega + have hA'B'_mem : (A', B') ∈ 𝒯 := + GM10.theorem_2_9_case_1 h𝒯 hAB hsep' (by omega) subset_union_left + have hc₀A' : π.cellGraph c₀ ≤ A' := hc₀A.trans (le_union_left hsep.left_le hED_le) + have hcell_side : ∀ c ∈ π.Γ.C, + π.gammaImage (tilde c) ⊆ A'.vertexSet ∨ π.gammaImage (tilde c) ⊆ B'.vertexSet := by + exact vertices_of_each_cell_lie_on_one_separation_side (α := α) (β := β) (G := G) (𝒯 := 𝒯) (θ + := θ) (p := p) h𝒯 π htrue hwarp (A := A) (B := B) hred23 hθ45 n_fn hn_spec W_D (fun d + => ⟨n_fn d, ⟨d, rfl⟩, rfl⟩) A' + B' hA'_V hB'_V + let I : Set (Set π.S) := {c ∈ π.Γ.C | c = c₀ ∨ ¬ (π.gammaImage (tilde c) ⊆ B'.vertexSet)} + let J : Set (Set π.S) := π.Γ.C \ I + have hIJ_union : I ∪ J = π.Γ.C := by + ext c + simp only [I, J, mem_union, mem_sdiff, mem_ofPred_eq] + tauto + have hIJ_disj : Disjoint I J := disjoint_sdiff_self_right + have hc₀_γA : π.gammaImage (tilde c₀) ⊆ A'.vertexSet := by + rintro _ ⟨n, ⟨hnt, hndom⟩, rfl⟩ + exact Or.inl (hc₀A.vertexSet_subset (π.p2 c₀ hc₀ n ⟨hnt, hndom⟩)) + have hγI : π.gammaOfCells I ⊆ A'.vertexSet := by + unfold Portrayal.gammaOfCells + refine iUnion₂_subset ?_ + rintro c ⟨hcC, rfl | hnotB'⟩ + · exact hc₀_γA + · exact (hcell_side c hcC).resolve_right hnotB' + have hγJ : π.gammaOfCells J ⊆ B'.vertexSet := by + unfold Portrayal.gammaOfCells + refine iUnion₂_subset ?_ + rintro c ⟨hcC, hnotI⟩ + by_contra hnotB' + exact hnotI ⟨hcC, Or.inr hnotB'⟩ + have hN_A'B'_eq : + {n ∈ π.Γ.N | π.nodeVertex n ∈ (A' ∩ B').vertexSet} = + {n ∈ π.Γ.N | π.nodeVertex n ∈ (A ∩ B).vertexSet} ∪ N_D := by + ext n + simp only [mem_ofPred_eq, hAB'_V, mem_union] + constructor + · rintro ⟨hnN, hnAB | ⟨m, hm_ND, hEq⟩⟩ + · exact Or.inl ⟨hnN, hnAB⟩ + · have hm_eq : m = n := + π.nodeVertex_injOn (hdom ▸ hND_sub_N hm_ND) (hdom ▸ hnN) hEq + exact Or.inr (hm_eq ▸ hm_ND) + · rintro (⟨hnN, hnAB⟩ | hn_ND) + · exact ⟨hnN, Or.inl hnAB⟩ + · exact ⟨hND_sub_N hn_ND, Or.inr ⟨n, hn_ND, rfl⟩⟩ + have hN_AB_card_eq : + {n ∈ π.Γ.N | π.nodeVertex n ∈ (A ∩ B).vertexSet}.ncard = + ((A ∩ B).vertexSet ∩ π.gammaImage π.Γ.N).ncard := by + have himg : π.nodeVertex '' {n ∈ π.Γ.N | π.nodeVertex n ∈ (A ∩ B).vertexSet} = + (A ∩ B).vertexSet ∩ π.gammaImage π.Γ.N := by + ext v + simp only [mem_image, mem_ofPred_eq, mem_inter_iff, Portrayal.gammaImage] + exact ⟨fun ⟨n, ⟨hnN, hvAB⟩, hEq⟩ => ⟨hEq ▸ hvAB, n, ⟨hnN, hdom ▸ hnN⟩, hEq⟩, + fun ⟨hvAB, n, ⟨hnN, _⟩, hEq⟩ => ⟨n, ⟨hnN, hEq.symm ▸ hvAB⟩, hEq⟩⟩ + have hsub : {n ∈ π.Γ.N | π.nodeVertex n ∈ (A ∩ B).vertexSet} ⊆ π.domγ := + fun _ h => hdom ▸ h.1 + rw [← himg, (π.nodeVertex_injOn.mono hsub).ncard_image] + have hsplit_AB_diff_S : + ((A ∩ B).vertexSet ∩ π.gammaImage π.Γ.N).ncard + + ((A ∩ B).vertexSet \ (sys.S ∪ π.gammaImage π.Γ.N)).ncard = + ((A ∩ B).vertexSet \ sys.S).ncard := by + exact separation_vertices_partition_off_linkages (α := α) (β := β) (G := G) (𝒯 := 𝒯) (θ := θ) + (p := p) h𝒯 π htrue hwarp (A := A) (B := B) hred23 hθ45 sys + have hN_A'B'_le_diff : + {n ∈ π.Γ.N | π.nodeVertex n ∈ (A' ∩ B').vertexSet}.ncard ≤ + ((A ∩ B).vertexSet \ sys.S).ncard := by + rw [hN_A'B'_eq] + have hle_u := ncard_union_le {n ∈ π.Γ.N | π.nodeVertex n ∈ (A ∩ B).vertexSet} N_D + rw [hN_AB_card_eq] at hle_u + omega + have hN_A'B'_le_tc₀ : + {n ∈ π.Γ.N | π.nodeVertex n ∈ (A' ∩ B').vertexSet}.ncard ≤ (tilde c₀).ncard := + hN_A'B'_le_diff.trans h116.1 + have h112 := (theorem_11_2_proof h𝒯 π htrue hred hwarp hθ + hA'B'_mem (by omega) hc₀ hc₀A' hIJ_union hIJ_disj ⟨hc₀, Or.inl rfl⟩ hγI hγJ hN_A'B'_le_tc₀).1 + have hdiff_eq_tc₀ : ((A ∩ B).vertexSet \ sys.S).ncard = (tilde c₀).ncard := by omega + have hinter_eq := h116.2 hdiff_eq_tc₀ + set X := (A ∩ B).vertexSet + set Y := (π.cellGraph c₀).vertexSet ∩ π.otherVertices c₀ + have hX_split : (X ∩ sys.S).ncard + (X \ sys.S).ncard = X.ncard := + ncard_inter_add_ncard_sdiff_eq_ncard X sys.S (A ∩ B).vertexSet_finite + have hY_split : (Y ∩ sys.S).ncard + (Y \ sys.S).ncard = Y.ncard := + ncard_inter_add_ncard_sdiff_eq_ncard Y sys.S + ((π.cellGraph c₀).vertexSet_finite.subset inter_subset_left) + have hγ_card : (π.gammaImage (tilde c₀)).ncard = (tilde c₀).ncard := by + have hsub_dom : tilde c₀ ⊆ π.domγ := hdom ▸ π.Γ.tilde_subset_N hc₀ + have himg : π.gammaImage (tilde c₀) = π.nodeVertex '' tilde c₀ := by + ext v + simp only [Portrayal.gammaImage, mem_image] + exact ⟨fun ⟨n, ⟨hnt, _⟩, hEq⟩ => ⟨n, hnt, hEq⟩, + fun ⟨n, hnt, hEq⟩ => ⟨n, ⟨hnt, hsub_dom hnt⟩, hEq⟩⟩ + rw [himg, (π.nodeVertex_injOn.mono hsub_dom).ncard_image] + have hY_diff_card : (Y \ sys.S).ncard = (tilde c₀).ncard := by + by_cases hbd : (c₀ ∩ bd π.S).Nonempty + · rcases hbd with ⟨x₀, hxc₀, hxbd⟩ + let Θ := connectedComponentIn (bd π.S) x₀ + have hΘ : Θ ∈ cuffs π.S := ⟨x₀, hxbd, rfl⟩ + have hc₀Θ : (c₀ ∩ Θ).Nonempty := ⟨x₀, hxc₀, mem_connectedComponentIn hxbd⟩ + have hc₀_range : c₀ ∈ Set.range (sys.E Θ hΘ).cell := by + rw [(sys.E Θ hΘ).range_cell]; exact ⟨hc₀, hc₀Θ⟩ + rcases hc₀_range with ⟨i₀, hi₀_eq⟩ + have hbd_props := sys.border_cell_properties h𝒯 π htrue hred23 hwarp hθ45 hΘ i₀ + have hdiff_eq : Y \ sys.S = π.gammaImage (tilde c₀) := by + dsimp only [Y] + rw [← hi₀_eq] + exact hbd_props.2.2.1 + rw [hdiff_eq, hγ_card] + · have hint_props := sys.internal_cell_properties h𝒯 π htrue hred23 hwarp hθ45 hc₀ hbd + have hdiff_eq : Y \ sys.S = π.gammaImage (tilde c₀) := by + dsimp only [Y] + rw [(hint_props.2.mono_left inter_subset_left).sdiff_eq_left, hint_props.1] + rw [hdiff_eq, hγ_card] + change X.ncard = Y.ncard + omega + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section12.lean b/LeanPool/GraphMinor/GM17/Section12.lean new file mode 100644 index 0000000000..b78fea4b90 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section12.lean @@ -0,0 +1,1764 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section11 +import LeanPool.GraphMinor.GM17.PasteCuff +import LeanPool.GraphMinor.GM17.ArcDisc +import LeanPool.GraphMinor.GM17.MarkCross +import LeanPool.GraphMinor.GM17.ReplaceDisc +import LeanPool.GraphMinor.GM17.RegionDisc +import LeanPool.GraphMinor.GM17.RegionBoundary +import LeanPool.GraphMinor.GM17.CutArcPaint +import LeanPool.GraphMinor.GM17.PushNode +import LeanPool.GraphMinor.GM17.IndentMain +import LeanPool.GraphMinor.GM17.CliqueDisc + +import LeanPool.GraphMinor.GM17.Section5Proved + +import LeanPool.GraphMinor.GM17.Section6Proved +import LeanPool.GraphMinor.GM17.Section7 + +import LeanPool.GraphMinor.GM17.Section8Proved + +import LeanPool.GraphMinor.GM17.Section9bProved + +/-! +# Graph Minors XVII, Section 12: Filling Out a Portrayal of the 1-Skeleton + +This file formalizes Section 12 (pages 196–201) of Robertson and Seymour, *Graph Minors. XVII. +Taming a Vortex*, J. Combin. Theory Ser. B 77 (1999), 162–210: + +- **(12.1)** (`theorem_12_1`, page 197) +- **(12.2)** (`theorem_12_2`, page 198) +- **(12.3)** (`theorem_12_3`, page 199) +- **(12.4)** (`theorem_12_4`, page 200) +- **(12.5)** (`theorem_12_5`, page 200) +- **(12.6)** (`theorem_12_6`, page 200) +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.GM19 +open GraphMinor.Hypergraph + +universe u v + +/-! ## 1. Cliques on a Cuff: (12.1) (Pages 196–197) -/ + +theorem cuffs_eq_of_nonempty_inter {S : Type} [TopologicalSpace S] {Θ₁ Θ₂ : Set S} + (hΘ₁ : Θ₁ ∈ cuffs S) (hΘ₂ : Θ₂ ∈ cuffs S) (hne : (Θ₁ ∩ Θ₂).Nonempty) : + Θ₁ = Θ₂ := by + rcases hΘ₁ with ⟨x₁, _, rfl⟩ + rcases hΘ₂ with ⟨x₂, _, rfl⟩ + rcases hne with ⟨x, hx₁, hx₂⟩ + have h1 := connectedComponentIn_eq hx₁ + have h2 := connectedComponentIn_eq hx₂ + exact h1.trans h2.symm + +theorem Painting.exists_cuff_of_border_cell {S : Type} [TopologicalSpace S] (Γ : Painting S) + {c : Set S} (hc : c ∈ Γ.C) (hbd : (c ∩ bd S).Nonempty) : + ∃ Θ ∈ cuffs S, (c ∩ Θ).Nonempty ∧ tilde c ⊆ Γ.N ∩ Θ := by + rcases hbd with ⟨x, hxc, hxbd⟩ + refine ⟨connectedComponentIn (bd S) x, ⟨x, hxbd, rfl⟩, + ⟨x, hxc, mem_connectedComponentIn hxbd⟩, ?_⟩ + exact (Γ.border_cell_subset_cuff hc ⟨x, hxbd, rfl⟩ ⟨x, hxc, mem_connectedComponentIn + hxbd⟩).2.2.2.1 + +/-- Under the standing hypotheses of Section 8 (`(2p + 3)`-redundancy and `4p + 5 < θ`), for every +cell $c \in C(\Gamma)$ and node $n \in N(\Gamma)$, $\gamma(n) \in V(\alpha(c))$ if and only if +$n \in \tilde{c}$. -/ +theorem nodeVertex_mem_cellGraph_iff + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {c : Set π.S} (hc : c ∈ π.Γ.C) {n : π.S} (hn : n ∈ π.Γ.N) : + π.nodeVertex n ∈ (π.cellGraph c).vertexSet ↔ n ∈ tilde c := by + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof h𝒯 π htrue hred hwarp hθ + have hn_dom : n ∈ π.domγ := hdom.symm ▸ hn + refine ⟨fun hvc => ?_, fun hnt => π.p2 c hc n ⟨hnt, hn_dom⟩⟩ + have h87 := (theorem_8_7_proof h𝒯 π htrue hred hwarp hθ hn).1 + have hex_other : ∃ d ∈ π.Γ.C, d ≠ c ∧ n ∈ tilde d := by + by_contra! hall + have hsub : {d ∈ π.Γ.CStar | n ∈ tilde d} ⊆ {c} := + fun d hd => mem_singleton_iff.mpr (by by_contra hne; exact hall d hd.1.1 hne hd.2) + have hle : {d ∈ π.Γ.CStar | n ∈ tilde d}.ncard ≤ ({c} : Set (Set π.S)).ncard := + ncard_le_ncard hsub (finite_singleton c) + rw [ncard_singleton] at hle + omega + obtain ⟨d, hd, hdc, hnd⟩ := hex_other + have hvd : π.nodeVertex n ∈ (π.cellGraph d).vertexSet := π.p2 d hd n ⟨hnd, hn_dom⟩ + by_cases hbd : (c ∩ bd π.S).Nonempty + · obtain ⟨n₁, n₂, hne12, htilde, _, _, _, _⟩ := π.Γ.border_cell_exists_ends hc hbd + obtain ⟨Θ, hΘ, hcΘ, _⟩ := π.Γ.exists_cuff_of_border_cell hc hbd + have hn₁_t : n₁ ∈ tilde c := htilde ▸ mem_insert _ _ + have hn₂_t : n₂ ∈ tilde c := htilde ▸ mem_insert_of_mem _ (mem_singleton _) + obtain ⟨-, -, hdisj₁, hdisj₂, -⟩ := + theorem_9_8_proof h𝒯 π htrue hred hwarp hθ hΘ hc hcΘ hn₁_t hn₂_t hne12 + obtain ⟨m, hmt, hmem | ⟨hm_dom, hEq⟩⟩ := π.p6 c hc hbd (π.nodeVertex n) hvc ⟨d, hd, hdc, hvd⟩ + · exfalso + rcases (htilde ▸ hmt : m ∈ ({n₁, n₂} : Set π.S)) with rfl | rfl + · exact Set.disjoint_left.mp hdisj₁ hmem ⟨n, hn, rfl⟩ + · exact Set.disjoint_left.mp hdisj₂ hmem ⟨n, hn, rfl⟩ + · have hmn : m = n := π.nodeVertex_injOn hm_dom hn_dom hEq.symm + exact hmn ▸ hmt + · obtain ⟨m, ⟨hmt, hm_dom⟩, hEq⟩ := π.p5 c hc hbd (π.nodeVertex n) hvc ⟨d, hd, hdc, hvd⟩ + have hmn : m = n := π.nodeVertex_injOn hm_dom hn_dom hEq + exact hmn ▸ hmt + +/-- Arithmetic helper on `cyclicDist` for a cuff enumeration `E`: if `m ∈ {j, cyclicSucc hk0 j}`, +then `cyclicDist i m ≤ cyclicDist i b` whenever `cyclicDist i j < cyclicDist i b`. -/ +private theorem cyclicDist_end_le_of_lt {k : ℕ} (hk2 : 2 ≤ k) {i j b : Fin k} + (hlt : cyclicDist i j < cyclicDist i b) {m : Fin k} + (hm : m = j ∨ m = cyclicSucc (by omega : 0 < k) j) : + cyclicDist i m ≤ cyclicDist i b := by + have hk0 : 0 < k := by omega + rcases hm with rfl | rfl + · exact hlt.le + · have hi := i.2; have hj := j.2; have hb := b.2 + rw [cyclicDist_eq_ite i j, cyclicDist_eq_ite i b] at hlt + rw [cyclicDist_eq_ite i (cyclicSucc hk0 j), cyclicDist_eq_ite i b] + dsimp [cyclicSucc] + by_cases hj1 : j.1 + 1 < k + · have hmod : (j.1 + 1) % k = j.1 + 1 := Nat.mod_eq_of_lt hj1 + simp only [hmod] + split_ifs at hlt ⊢ <;> omega + · have hmod : (j.1 + 1) % k = 0 := by + have : j.1 + 1 = k := by omega + rw [this, Nat.mod_self] + simp only [hmod] + split_ifs at hlt ⊢ <;> omega + +private theorem cyclicDist_three_sum_le {k : ℕ} (hk : 0 < k) {i x b y : Fin k} + (hxb : cyclicDist i x ≤ cyclicDist i b) (hby : cyclicDist i b ≤ cyclicDist i y) + (hx_pos : 0 < cyclicDist i x) : + cyclicDist x b + cyclicDist b y + cyclicDist y i ≤ k := by + have hi := i.2; have hx := x.2; have hb := b.2; have hy := y.2 + rw [cyclicDist_eq_ite i x, cyclicDist_eq_ite i b] at hxb + rw [cyclicDist_eq_ite i b, cyclicDist_eq_ite i y] at hby + rw [cyclicDist_eq_ite i x] at hx_pos + rw [cyclicDist_eq_ite x b, cyclicDist_eq_ite b y, cyclicDist_eq_ite y i] + split_ifs at hxb hby hx_pos ⊢ <;> omega + +/-- If $j_a, j_b, j_c$ are cell indices around $\Theta$ with +$\operatorname{cyclicDist} i\, j_a < \operatorname{cyclicDist} i\, j_b < \operatorname{cyclicDist} +i\, j_c$, +and $v \in V(\alpha(c_a)) \cap V(\alpha(c_c)) \setminus V(\alpha(c_b))$, then +$v \in \beta(n_i+)$. -/ +private theorem mem_borderPlus_of_cyclicDist_lt {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {Θ : Set π.S} {k : ℕ} (E : π.Γ.CuffEnumeration Θ k) + (i ja jb jc : Fin k) + (hab : cyclicDist i ja < cyclicDist i jb) + (hbc : cyclicDist i jb < cyclicDist i jc) + {v : α} + (hva : v ∈ (π.cellGraph (E.cell ja)).vertexSet) + (hvb : v ∉ (π.cellGraph (E.cell jb)).vertexSet) + (hvc : v ∈ (π.cellGraph (E.cell jc)).vertexSet) : + v ∈ π.borderPlus (E.node i) := by + have hk2 : 2 ≤ k := E.two_le + have hk0 : 0 < k := by omega + have hcell_mem : ∀ j : Fin k, E.cell j ∈ π.Γ.C ∧ (E.cell j ∩ bd π.S).Nonempty := by + intro j + have hrange : E.cell j ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self j + have hΘ_bd : Θ ⊆ bd π.S := by + rcases E.cuff_mem with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + exact ⟨hrange.1, hrange.2.mono (inter_subset_inter_right _ hΘ_bd)⟩ + have hne_ac : E.cell ja ≠ E.cell jc := by + intro hEq + have hja_jc : ja = jc := E.injective_cell hEq + subst hja_jc + omega + obtain ⟨na, hna_t, hv_na⟩ := π.p6 (E.cell ja) (hcell_mem ja).1 (hcell_mem ja).2 v hva + ⟨E.cell jc, (hcell_mem jc).1, hne_ac.symm, hvc⟩ + obtain ⟨nc, hnc_t, hv_nc⟩ := π.p6 (E.cell jc) (hcell_mem jc).1 (hcell_mem jc).2 v hvc + ⟨E.cell ja, (hcell_mem ja).1, hne_ac, hva⟩ + rw [E.cell_tilde ja] at hna_t + rw [E.cell_tilde jc] at hnc_t + have hma_ex : ∃ ma : Fin k, (ma = ja ∨ ma = cyclicSucc hk0 ja) ∧ na = E.node ma := by + rcases hna_t with rfl | hna_t + · exact ⟨ja, Or.inl rfl, rfl⟩ + · exact ⟨cyclicSucc hk0 ja, Or.inr rfl, mem_singleton_iff.mp hna_t⟩ + have hmc_ex : ∃ mc : Fin k, (mc = jc ∨ mc = cyclicSucc hk0 jc) ∧ nc = E.node mc := by + rcases hnc_t with rfl | hnc_t + · exact ⟨jc, Or.inl rfl, rfl⟩ + · exact ⟨cyclicSucc hk0 jc, Or.inr rfl, mem_singleton_iff.mp hnc_t⟩ + obtain ⟨ma, hma_cases, rfl⟩ := hma_ex + obtain ⟨mc, hmc_cases, rfl⟩ := hmc_ex + change v ∈ π.borderPlus (E.node ma) at hv_na + change v ∈ π.borderPlus (E.node mc) at hv_nc + by_cases hma_i : ma = i + · exact hma_i ▸ hv_na + by_cases hmc_i : mc = i + · exact hmc_i ▸ hv_nc + have hd_ma_pos : 0 < cyclicDist i ma := cyclicDist_pos_of_ne (Ne.symm hma_i) + have hd_mc_pos : 0 < cyclicDist i mc := cyclicDist_pos_of_ne (Ne.symm hmc_i) + have hd_ma_le : cyclicDist i ma ≤ cyclicDist i jb := + cyclicDist_end_le_of_lt hk2 hab hma_cases + have hd_jb_le : cyclicDist i jb ≤ cyclicDist i mc := by + rcases hmc_cases with rfl | rfl + · exact hbc.le + · have hi := i.2; have hjc := jc.2; have hjb := jb.2 + rw [cyclicDist_eq_ite i jb, cyclicDist_eq_ite i jc] at hbc + rw [cyclicDist_eq_ite i (cyclicSucc hk0 jc)] at hd_mc_pos + rw [cyclicDist_eq_ite i jb, cyclicDist_eq_ite i (cyclicSucc hk0 jc)] + dsimp [cyclicSucc] at hd_mc_pos ⊢ + by_cases hj1 : jc.1 + 1 < k + · have hmod : (jc.1 + 1) % k = jc.1 + 1 := Nat.mod_eq_of_lt hj1 + simp only [hmod] at hd_mc_pos ⊢ + split_ifs at hbc hd_mc_pos ⊢ <;> omega + · have hmod : (jc.1 + 1) % k = 0 := by + have : jc.1 + 1 = k := by omega + rw [this, Nat.mod_self] + simp only [hmod] at hd_mc_pos ⊢ + split_ifs at hbc hd_mc_pos ⊢ <;> omega + have hsum : cyclicDist ma jb + cyclicDist jb mc + cyclicDist mc i ≤ k := + cyclicDist_three_sum_le hk0 hd_ma_le hd_jb_le hd_ma_pos + have hv_not_jb : v ∉ π.borderPlus (E.node jb) := by + intro hv_jb + have hjb_t : E.node jb ∈ tilde (E.cell jb) := by + rw [E.cell_tilde jb]; exact mem_insert _ _ + exact hvb (π.borderPlus_subset_cellGraph (hcell_mem jb).1 (hcell_mem jb).2 hjb_t hv_jb) + exact (π.p7_of_cyclicDist E hsum hv_na hv_nc).resolve_left hv_not_jb + +private theorem cover_two_border_vertices + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {θ : ℕ} + {p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hwarp : π.warp ≤ p) + {Θ : Set π.S} + (hΘ : Θ ∈ cuffs π.S) + (hred3 : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hθ5 : 4 * p + 5 < θ) + (hΘ_bd : Θ ⊆ bd π.S) + (n : ℕ) + (K : Set α) + (hcard : K.ncard = n) + (hK : IsClique G K) + (hK_sub : K ⊆ ⋃ c ∈ {c | c ∈ π.Γ.C ∧ (c ∩ Θ).Nonempty}, (π.cellGraph c).vertexSet) + (hn2 : n = 2) : + ∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ K ⊆ (π.cellGraph c).vertexSet := by + obtain ⟨x₁, x₂, hne12, hK_eq⟩ := ncard_eq_two.mp (hcard.trans hn2) + have hx₁K : x₁ ∈ K := hK_eq ▸ mem_insert _ _ + have hx₂K : x₂ ∈ K := hK_eq ▸ mem_insert_of_mem _ (mem_singleton _) + obtain ⟨_, e, he₁, he₂⟩ := hK.2 x₁ hx₁K x₂ hx₂K hne12 + have heG : e ∈ G.edgeSet := G.edge_mem_of_inc he₁ + obtain ⟨c, hc, hec⟩ := π.p1_edge e heG + have hx₁c : x₁ ∈ (π.cellGraph c).vertexSet := + (π.cellGraph c).vertex_mem_of_inc ((inc_iff_of_le (π.cellGraph_le c hc) hec).mpr he₁) + have hx₂c : x₂ ∈ (π.cellGraph c).vertexSet := + (π.cellGraph c).vertex_mem_of_inc ((inc_iff_of_le (π.cellGraph_le c hc) hec).mpr he₂) + by_cases hcΘ : (c ∩ Θ).Nonempty + · refine ⟨c, hc, hcΘ, ?_⟩ + rw [hK_eq] + rintro x (rfl | rfl) <;> assumption + · obtain ⟨c₁, ⟨hc₁, hc₁Θ⟩, hx₁c₁⟩ := mem_iUnion₂.mp (hK_sub hx₁K) + obtain ⟨c₂, ⟨hc₂, hc₂Θ⟩, hx₂c₂⟩ := mem_iUnion₂.mp (hK_sub hx₂K) + have hne_c₁ : c ≠ c₁ := fun h => hcΘ (h ▸ hc₁Θ) + have hne_c₂ : c ≠ c₂ := fun h => hcΘ (h ▸ hc₂Θ) + have hbd₁ : (c₁ ∩ bd π.S).Nonempty := hc₁Θ.mono (inter_subset_inter_right _ hΘ_bd) + have hbd₂ : (c₂ ∩ bd π.S).Nonempty := hc₂Θ.mono (inter_subset_inter_right _ hΘ_bd) + obtain ⟨n₁, hn₁_t, hx₁_bp⟩ := π.p6 c₁ hc₁ hbd₁ x₁ hx₁c₁ ⟨c, hc, hne_c₁, hx₁c⟩ + obtain ⟨n₂, hn₂_t, hx₂_bp⟩ := π.p6 c₂ hc₂ hbd₂ x₂ hx₂c₂ ⟨c, hc, hne_c₂, hx₂c⟩ + have hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ := (π.Γ.border_cell_subset_cuff hc₁ hΘ hc₁Θ).2.2.2.1 hn₁_t + have hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ := (π.Γ.border_cell_subset_cuff hc₂ hΘ hc₂Θ).2.2.2.1 hn₂_t + have hint : ¬ (c ∩ bd π.S).Nonempty := by + intro hbd_c + obtain ⟨Θ', hΘ', hcΘ', htilde_c⟩ := π.Γ.exists_cuff_of_border_cell hc hbd_c + obtain ⟨n', hn'_t, hx₁_bp'⟩ := π.p6 c hc hbd_c x₁ hx₁c ⟨c₁, hc₁, hne_c₁.symm, hx₁c₁⟩ + have hn'_Θ' : n' ∈ π.Γ.N ∩ Θ' := htilde_c hn'_t + have hΘ'_bd : Θ' ⊆ bd π.S := by + rcases hΘ' with ⟨y₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) y₀ + obtain ⟨Θ₀, hΘ₀, hn₁Θ₀, hn'Θ₀⟩ := π.cuff_eq_of_borderPlus_inter_nonempty + ⟨hn₁_Θ.1, hΘ_bd hn₁_Θ.2⟩ ⟨hn'_Θ'.1, hΘ'_bd hn'_Θ'.2⟩ hx₁_bp hx₁_bp' + have hΘ₀_eq_Θ : Θ₀ = Θ := + cuffs_eq_of_nonempty_inter hΘ₀ hΘ ⟨n₁, hn₁Θ₀, hn₁_Θ.2⟩ + have hΘ₀_eq_Θ' : Θ₀ = Θ' := + cuffs_eq_of_nonempty_inter hΘ₀ hΘ' ⟨n', hn'Θ₀, hn'_Θ'.2⟩ + exact hcΘ (hΘ₀_eq_Θ ▸ hΘ₀_eq_Θ' ▸ hcΘ') + obtain ⟨m₁, ⟨hm₁_t, hm₁_dom⟩, hm₁_eq⟩ := + π.p5 c hc hint x₁ hx₁c ⟨c₁, hc₁, hne_c₁.symm, hx₁c₁⟩ + obtain ⟨m₂, ⟨hm₂_t, hm₂_dom⟩, hm₂_eq⟩ := + π.p5 c hc hint x₂ hx₂c ⟨c₂, hc₂, hne_c₂.symm, hx₂c₂⟩ + have hdisj_n₁ : Disjoint (π.borderSet n₁) (π.nodeVertex '' π.Γ.N) := + theorem_9_7_proof h𝒯 π htrue hred3 hwarp hθ5 ⟨hn₁_Θ.1, hΘ_bd hn₁_Θ.2⟩ + have hdisj_n₂ : Disjoint (π.borderSet n₂) (π.nodeVertex '' π.Γ.N) := + theorem_9_7_proof h𝒯 π htrue hred3 hwarp hθ5 ⟨hn₂_Θ.1, hΘ_bd hn₂_Θ.2⟩ + have hx₁_eq : x₁ = π.nodeVertex n₁ := by + rcases hx₁_bp with hx₁_bs | ⟨_, hEq⟩ + · exfalso + exact Set.disjoint_left.mp hdisj_n₁ hx₁_bs + ⟨m₁, π.domγ_subset hm₁_dom, hm₁_eq⟩ + · exact hEq + have hx₂_eq : x₂ = π.nodeVertex n₂ := by + rcases hx₂_bp with hx₂_bs | ⟨_, hEq⟩ + · exfalso + exact Set.disjoint_left.mp hdisj_n₂ hx₂_bs + ⟨m₂, π.domγ_subset hm₂_dom, hm₂_eq⟩ + · exact hEq + have hn₁_tc : n₁ ∈ tilde c := + (nodeVertex_mem_cellGraph_iff h𝒯 π htrue hred3 hwarp hθ5 hc hn₁_Θ.1).mp + (hx₁_eq ▸ hx₁c) + have hn₂_tc : n₂ ∈ tilde c := + (nodeVertex_mem_cellGraph_iff h𝒯 π htrue hred3 hwarp hθ5 hc hn₂_Θ.1).mp + (hx₂_eq ▸ hx₂c) + have hne_n : n₁ ≠ n₂ := fun h => hne12 (hx₁_eq.trans (h ▸ hx₂_eq.symm)) + have hcl_eq : closure c ∩ bd π.S = tilde c ∩ bd π.S := + Painting.closure_cell_inter_bd_eq_tilde_inter_bd hint + have hn₁_cl : n₁ ∈ closure c ∩ bd π.S := hcl_eq.symm ▸ ⟨hn₁_tc, hΘ_bd hn₁_Θ.2⟩ + have hn₂_cl : n₂ ∈ closure c ∩ bd π.S := hcl_eq.symm ▸ ⟨hn₂_tc, hΘ_bd hn₂_Θ.2⟩ + have h86 := theorem_8_6_proof h𝒯 π htrue hred3 hwarp hθ5 hc hint + have hpair_sub : ({n₁, n₂} : Set π.S) ⊆ closure c ∩ bd π.S := by + rintro x (rfl | rfl) <;> assumption + have hfin_cl : (closure c ∩ bd π.S).Finite := by + rw [hcl_eq] + exact (π.Γ.finite_tilde_cell hc).inter_of_left _ + have hge2 : 2 ≤ (closure c ∩ bd π.S).ncard := by + have := ncard_le_ncard hpair_sub hfin_cl + rw [ncard_pair hne_n] at this + exact this + have heq2 : (closure c ∩ bd π.S).ncard = 2 := le_antisymm h86.1 hge2 + obtain ⟨c₀, hc₀, hbd₀, htilde₀⟩ := (h86.2 heq2).2 n₁ hn₁_cl n₂ hn₂_cl hne_n + obtain ⟨Θ₀, hΘ₀, hc₀Θ₀, htilde₀_sub⟩ := π.Γ.exists_cuff_of_border_cell hc₀ hbd₀ + have hn₁_t₀ : n₁ ∈ tilde c₀ := htilde₀ ▸ mem_insert _ _ + have hn₂_t₀ : n₂ ∈ tilde c₀ := htilde₀ ▸ mem_insert_of_mem _ (mem_singleton _) + have hΘ₀_eq : Θ₀ = Θ := + cuffs_eq_of_nonempty_inter hΘ₀ hΘ ⟨n₁, (htilde₀_sub hn₁_t₀).2, hn₁_Θ.2⟩ + have hc₀Θ : (c₀ ∩ Θ).Nonempty := hΘ₀_eq ▸ hc₀Θ₀ + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof h𝒯 π htrue hred3 hwarp hθ5 + have hx₁_c₀ : x₁ ∈ (π.cellGraph c₀).vertexSet := + hx₁_eq ▸ π.p2 c₀ hc₀ n₁ ⟨hn₁_t₀, hdom.symm ▸ hn₁_Θ.1⟩ + have hx₂_c₀ : x₂ ∈ (π.cellGraph c₀).vertexSet := + hx₂_eq ▸ π.p2 c₀ hc₀ n₂ ⟨hn₂_t₀, hdom.symm ▸ hn₂_Θ.1⟩ + refine ⟨c₀, hc₀, hc₀Θ, ?_⟩ + rw [hK_eq] + rintro x (rfl | rfl) <;> assumption + +/-- **Graph Minors XVII, (12.1)** (page 197): +"Let $\mathscr{T}$ be a tangle of order $> 4p+9$ in a hypergraph $G$, let +$\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a true, $(2p+7)$-redundant, +$\mathscr{T}$-central portrayal of $G$ with warp $\le p$, and let $\Theta$ be a cuff of $\Sigma$. +For every clique $K$ of $G$ with +$$K \subseteq \bigcup (V(\alpha(c)) \colon c \in C(\Gamma) \text{ bordering } \Theta)$$ +there is a cell $c$ bordering $\Theta$ with $K \subseteq V(\alpha(c))$." -/ +theorem theorem_12_1_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 7)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 9 < θ) + {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) + {K : Set α} (hK : IsClique G K) + (hK_sub : K ⊆ ⋃ c ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty}, (π.cellGraph c).vertexSet) : + ∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ K ⊆ (π.cellGraph c).vertexSet := by + classical + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have hp1 : 1 ≤ p := π.one_le_warp.trans hwarp + have hred3 : π.IsRedundant 𝒯 θ (2 * p + 3) := hred.mono (by omega) + have hθ5 : 4 * p + 5 < θ := by omega + have hΘ_arc : IsOArc Θ := (cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + obtain ⟨E⟩ := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + set k := (π.Γ.N ∩ Θ).ncard + have hk2 : 2 ≤ k := E.two_le + -- Strong induction on `K.ncard` + suffices hind : ∀ n : ℕ, ∀ K : Set α, K.ncard = n → IsClique G K → + K ⊆ ⋃ c ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty}, (π.cellGraph c).vertexSet → + ∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ K ⊆ (π.cellGraph c).vertexSet from + hind K.ncard K rfl hK hK_sub + intro n + induction n using Nat.strong_induction_on with + | ind n ih => + intro K hcard hK hK_sub + have hK_fin : K.Finite := G.vertexSet_finite.subset hK.1 + by_cases hn1 : n ≤ 1 + · by_cases hKne : K.Nonempty + · obtain ⟨x, hx⟩ := hKne + have hK_eq : K = {x} := + ( eq_of_subset_of_ncard_le (singleton_subset_iff.mpr hx) + (by rw [ncard_singleton]; omega) hK_fin ).symm + obtain ⟨c, ⟨hc, hcΘ⟩, hxc⟩ := mem_iUnion₂.mp (hK_sub hx) + exact ⟨c, hc, hcΘ, hK_eq.symm ▸ singleton_subset_iff.mpr hxc⟩ + · rw [not_nonempty_iff_eq_empty] at hKne + have hc0 : E.cell ⟨0, by omega⟩ ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self _ + exact ⟨E.cell ⟨0, by omega⟩, hc0.1, hc0.2, hKne.symm ▸ empty_subset _⟩ + by_cases hn2 : n = 2 + · exact cover_two_border_vertices (α := α) (β := β) (G := G) (𝒯 := 𝒯) (θ := θ) (p := p) h𝒯 π + htrue hwarp (Θ := Θ) hΘ hred3 hθ5 hΘ_bd n K hcard hK hK_sub hn2 + · -- Now `3 ≤ n` + have hn3 : 3 ≤ n := by omega + obtain ⟨x₁, hx₁K⟩ : K.Nonempty := (ncard_pos hK_fin).mp (by omega) + have hK1_card : (K \ {x₁}).ncard = n - 1 := by + rw [ncard_sdiff_singleton_of_mem hx₁K, hcard] + obtain ⟨x₂, hx₂_mem⟩ : (K \ {x₁}).Nonempty := + (ncard_pos hK_fin.sdiff).mp (by omega) + have hx₂K : x₂ ∈ K := hx₂_mem.1 + have hne12 : x₁ ≠ x₂ := Ne.symm hx₂_mem.2 + have hK12_card : (K \ {x₁, x₂}).ncard = n - 2 := by + have hsub12 : ({x₁, x₂} : Set α) ⊆ K := by + rintro x (rfl | rfl) <;> assumption + have heq := ncard_sdiff_add_ncard_of_subset hsub12 hK_fin + rw [ncard_pair hne12, hcard] at heq + omega + obtain ⟨x₃, hx₃_mem⟩ : (K \ {x₁, x₂}).Nonempty := + (ncard_pos hK_fin.sdiff).mp (by omega) + have hx₃K : x₃ ∈ K := hx₃_mem.1 + have hne13 : x₁ ≠ x₃ := fun h => hx₃_mem.2 (Or.inl h.symm) + have hne23 : x₂ ≠ x₃ := fun h => hx₃_mem.2 (Or.inr h.symm) + have hclique_diff : ∀ x ∈ K, IsClique G (K \ {x}) ∧ (K \ {x}).ncard = n - 1 := by + intro x hx + refine ⟨⟨sdiff_subset.trans hK.1, fun u hu v hv huv => hK.2 u hu.1 v hv.1 huv⟩, ?_⟩ + rw [ncard_sdiff_singleton_of_mem hx, hcard] + obtain ⟨c₁, hc₁, hc₁Θ, hsub₁⟩ := ih (n - 1) (by omega) (K \ {x₁}) + (hclique_diff x₁ hx₁K).2 (hclique_diff x₁ hx₁K).1 (sdiff_subset.trans hK_sub) + obtain ⟨c₂, hc₂, hc₂Θ, hsub₂⟩ := ih (n - 1) (by omega) (K \ {x₂}) + (hclique_diff x₂ hx₂K).2 (hclique_diff x₂ hx₂K).1 (sdiff_subset.trans hK_sub) + obtain ⟨c₃, hc₃, hc₃Θ, hsub₃⟩ := ih (n - 1) (by omega) (K \ {x₃}) + (hclique_diff x₃ hx₃K).2 (hclique_diff x₃ hx₃K).1 (sdiff_subset.trans hK_sub) + by_cases hx₁_in : x₁ ∈ (π.cellGraph c₁).vertexSet + · refine ⟨c₁, hc₁, hc₁Θ, fun y hy => ?_⟩ + by_cases hyx : y = x₁ + · exact hyx ▸ hx₁_in + · exact hsub₁ ⟨hy, hyx⟩ + by_cases hx₂_in : x₂ ∈ (π.cellGraph c₂).vertexSet + · refine ⟨c₂, hc₂, hc₂Θ, fun y hy => ?_⟩ + by_cases hyx : y = x₂ + · exact hyx ▸ hx₂_in + · exact hsub₂ ⟨hy, hyx⟩ + by_cases hx₃_in : x₃ ∈ (π.cellGraph c₃).vertexSet + · refine ⟨c₃, hc₃, hc₃Θ, fun y hy => ?_⟩ + by_cases hyx : y = x₃ + · exact hyx ▸ hx₃_in + · exact hsub₃ ⟨hy, hyx⟩ + exfalso + have hc₁_range : c₁ ∈ Set.range E.cell := by rw [E.range_cell]; exact ⟨hc₁, hc₁Θ⟩ + have hc₂_range : c₂ ∈ Set.range E.cell := by rw [E.range_cell]; exact ⟨hc₂, hc₂Θ⟩ + have hc₃_range : c₃ ∈ Set.range E.cell := by rw [E.range_cell]; exact ⟨hc₃, hc₃Θ⟩ + obtain ⟨j₁, hj₁⟩ := hc₁_range + obtain ⟨j₂, hj₂⟩ := hc₂_range + obtain ⟨j₃, hj₃⟩ := hc₃_range + subst hj₁ hj₂ hj₃ + have hx₁_2 : x₁ ∈ (π.cellGraph (E.cell j₂)).vertexSet := hsub₂ ⟨hx₁K, hne12⟩ + have hx₁_3 : x₁ ∈ (π.cellGraph (E.cell j₃)).vertexSet := hsub₃ ⟨hx₁K, hne13⟩ + have hx₂_1 : x₂ ∈ (π.cellGraph (E.cell j₁)).vertexSet := hsub₁ ⟨hx₂K, hne12.symm⟩ + have hx₂_3 : x₂ ∈ (π.cellGraph (E.cell j₃)).vertexSet := hsub₃ ⟨hx₂K, hne23⟩ + have hx₃_1 : x₃ ∈ (π.cellGraph (E.cell j₁)).vertexSet := hsub₁ ⟨hx₃K, hne13.symm⟩ + have hx₃_2 : x₃ ∈ (π.cellGraph (E.cell j₂)).vertexSet := hsub₂ ⟨hx₃K, hne23.symm⟩ + have hj12 : j₁ ≠ j₂ := fun h => hx₁_in (h ▸ hx₁_2) + have hj13 : j₁ ≠ j₃ := fun h => hx₁_in (h ▸ hx₁_3) + have hj23 : j₂ ≠ j₃ := fun h => hx₂_in (h ▸ hx₂_3) + -- Claim (2): `{x₁, x₂, x₃} ∩ β(n+) ≠ ∅` for all `n ∈ N(Γ) ∩ Θ`. + have hclaim2 : ∀ n ∈ π.Γ.N ∩ Θ, (({x₁, x₂, x₃} : Set α) ∩ π.borderPlus n).Nonempty := by + intro n hn + have hn_range : n ∈ Set.range E.node := by rw [E.range_node]; exact hn + rcases hn_range with ⟨i, rfl⟩ + have hd12 : cyclicDist i j₁ ≠ cyclicDist i j₂ := by + intro hEq + have hi := i.2; have h1 := j₁.2; have h2 := j₂.2 + rw [cyclicDist_eq_ite i j₁, cyclicDist_eq_ite i j₂] at hEq + apply hj12; ext; split_ifs at hEq <;> omega + have hd13 : cyclicDist i j₁ ≠ cyclicDist i j₃ := by + intro hEq + have hi := i.2; have h1 := j₁.2; have h3 := j₃.2 + rw [cyclicDist_eq_ite i j₁, cyclicDist_eq_ite i j₃] at hEq + apply hj13; ext; split_ifs at hEq <;> omega + have hd23 : cyclicDist i j₂ ≠ cyclicDist i j₃ := by + intro hEq + have hi := i.2; have h2 := j₂.2; have h3 := j₃.2 + rw [cyclicDist_eq_ite i j₂, cyclicDist_eq_ite i j₃] at hEq + apply hj23; ext; split_ifs at hEq <;> omega + have hperm : + (cyclicDist i j₁ < cyclicDist i j₂ ∧ cyclicDist i j₂ < cyclicDist i j₃) ∨ + (cyclicDist i j₃ < cyclicDist i j₂ ∧ cyclicDist i j₂ < cyclicDist i j₁) ∨ + (cyclicDist i j₂ < cyclicDist i j₁ ∧ cyclicDist i j₁ < cyclicDist i j₃) ∨ + (cyclicDist i j₃ < cyclicDist i j₁ ∧ cyclicDist i j₁ < cyclicDist i j₂) ∨ + (cyclicDist i j₁ < cyclicDist i j₃ ∧ cyclicDist i j₃ < cyclicDist i j₂) ∨ + (cyclicDist i j₂ < cyclicDist i j₃ ∧ cyclicDist i j₃ < cyclicDist i j₁) := by + omega + rcases hperm with ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨h1, h2⟩ + · exact ⟨x₂, Or.inr (Or.inl rfl), + mem_borderPlus_of_cyclicDist_lt π E i j₁ j₂ j₃ h1 h2 hx₂_1 hx₂_in hx₂_3⟩ + · exact ⟨x₂, Or.inr (Or.inl rfl), + mem_borderPlus_of_cyclicDist_lt π E i j₃ j₂ j₁ h1 h2 hx₂_3 hx₂_in hx₂_1⟩ + · exact ⟨x₁, Or.inl rfl, + mem_borderPlus_of_cyclicDist_lt π E i j₂ j₁ j₃ h1 h2 hx₁_2 hx₁_in hx₁_3⟩ + · exact ⟨x₁, Or.inl rfl, + mem_borderPlus_of_cyclicDist_lt π E i j₃ j₁ j₂ h1 h2 hx₁_3 hx₁_in hx₁_2⟩ + · exact ⟨x₃, Or.inr (Or.inr rfl), + mem_borderPlus_of_cyclicDist_lt π E i j₁ j₃ j₂ h1 h2 hx₃_1 hx₃_in hx₃_2⟩ + · exact ⟨x₃, Or.inr (Or.inr rfl), + mem_borderPlus_of_cyclicDist_lt π E i j₂ j₃ j₁ h1 h2 hx₃_2 hx₃_in hx₃_1⟩ + have hX_sub : ({x₁, x₂, x₃} : Set α) ⊆ G.vertexSet := by + rintro x (rfl | rfl | rfl) + · exact hK.1 hx₁K + · exact hK.1 hx₂K + · exact hK.1 hx₃K + have hX_card : 3 * ({x₁, x₂, x₃} : Set α).ncard ≤ 2 * p + 7 := by + have hle3 : ({x₁, x₂, x₃} : Set α).ncard ≤ 3 := by + have h1 := ncard_insert_le x₁ ({x₂, x₃} : Set α) + have h2 := ncard_insert_le x₂ ({x₃} : Set α) + rw [ncard_singleton] at h2 + omega + omega + exact theorem_6_6_proof h𝒯 π htrue.1 hwarp hred (by omega) hΘ + hX_sub hX_card hclaim2 + +/-! ## 2. Cliques in General: (12.2) (Page 198) -/ + +private theorem no_four_discs_in_portrayal + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {θ : ℕ} + {p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 9 < θ) : + ¬∃ Δ₀ Δ₁ Δ₂ Δ₃, (IsClosedDisc Δ₀ ∧ π.Γ.IsNormal (discBd Δ₀) ∧ (discBd Δ₀ ∩ π.Γ.N).ncard ≤ 3 ∧ + IsSmallWrt 𝒯 (π.areaGraph Δ₀)) ∧ (IsClosedDisc Δ₁ ∧ π.Γ.IsNormal (discBd Δ₁) ∧ (discBd Δ₁ ∩ + π.Γ.N).ncard ≤ 3 ∧ IsSmallWrt 𝒯 (π.areaGraph Δ₁)) ∧ (IsClosedDisc Δ₂ ∧ π.Γ.IsNormal (discBd + Δ₂) ∧ (discBd Δ₂ ∩ π.Γ.N).ncard ≤ 3 ∧ IsSmallWrt 𝒯 (π.areaGraph Δ₂)) ∧ (IsClosedDisc Δ₃ ∧ + π.Γ.IsNormal (discBd Δ₃) ∧ (discBd Δ₃ ∩ π.Γ.N).ncard ≤ 3 ∧ IsSmallWrt 𝒯 (π.areaGraph Δ₃)) ∧ + ∀ c ∈ π.Γ.C, c ⊆ Δ₀ ∨ c ⊆ Δ₁ ∨ c ⊆ Δ₂ ∨ c ⊆ Δ₃ := by + rintro ⟨Δ₀, Δ₁, Δ₂, Δ₃, + ⟨hΔ₀, hnorm₀, hcard₀, hsmall₀⟩, + ⟨hΔ₁, hnorm₁, hcard₁, hsmall₁⟩, + ⟨_, _, _, ⟨B₂, hAB₂⟩⟩, + ⟨_, _, _, ⟨B₃, hAB₃⟩⟩, + hcov⟩ + have hatt₀ : (attachments G (π.areaGraph Δ₀)).ncard ≤ 3 := + (π.ncard_attachments_areaGraph_le_normal_disc hΔ₀ hnorm₀).trans hcard₀ + have hatt₁ : (attachments G (π.areaGraph Δ₁)).ncard ≤ 3 := + (π.ncard_attachments_areaGraph_le_normal_disc hΔ₁ hnorm₁).trans hcard₁ + have hatt_u : (attachments G (π.areaGraph Δ₀ ∪ π.areaGraph Δ₁)).ncard < θ := by + have hsub : attachments G (π.areaGraph Δ₀ ∪ π.areaGraph Δ₁) ⊆ + attachments G (π.areaGraph Δ₀) ∪ attachments G (π.areaGraph Δ₁) := by + rintro v ⟨hv₀ | hv₁, e, ⟨heG, he_not⟩, hinc⟩ + · exact Or.inl ⟨hv₀, e, ⟨heG, fun he₀ => he_not (Or.inl he₀)⟩, hinc⟩ + · exact Or.inr ⟨hv₁, e, ⟨heG, fun he₁ => he_not (Or.inr he₁)⟩, hinc⟩ + have hle := (ncard_le_ncard hsub (attachments_finite.union attachments_finite)).trans + (ncard_union_le _ _) + omega + obtain ⟨B₀₁, hAB₀₁⟩ := hsmall₀.union h𝒯 hsmall₁ hatt_u + let A₀₁ := π.areaGraph Δ₀ ∪ π.areaGraph Δ₁ + let A₂ := π.areaGraph Δ₂ + let A₃ := π.areaGraph Δ₃ + have hle_all : A₀₁ ∪ A₂ ∪ A₃ ≤ G := + union_le (union_le (h𝒯.isSeparation hAB₀₁).left_le (h𝒯.isSeparation hAB₂).left_le) + (h𝒯.isSeparation hAB₃).left_le + have hV_eq : (A₀₁ ∪ A₂ ∪ A₃).vertexSet = G.vertexSet := by + refine Subset.antisymm hle_all.vertexSet_subset fun v hvG => ?_ + obtain ⟨c, hc, hvc⟩ := π.p1_vertex v hvG + rcases hcov c hc with hc₀ | hc₁ | hc₂ | hc₃ + · exact Or.inl (Or.inl (Or.inl (mem_biUnion ⟨⟨hc, hc₀⟩, hc⟩ hvc))) + · exact Or.inl (Or.inl (Or.inr (mem_biUnion ⟨⟨hc, hc₁⟩, hc⟩ hvc))) + · exact Or.inl (Or.inr (mem_biUnion ⟨⟨hc, hc₂⟩, hc⟩ hvc)) + · exact Or.inr (mem_biUnion ⟨⟨hc, hc₃⟩, hc⟩ hvc) + have hE_eq : (A₀₁ ∪ A₂ ∪ A₃).edgeSet = G.edgeSet := by + refine Subset.antisymm hle_all.edgeSet_subset fun e heG => ?_ + obtain ⟨c, hc, hec⟩ := π.p1_edge e heG + rcases hcov c hc with hc₀ | hc₁ | hc₂ | hc₃ + · exact Or.inl (Or.inl (Or.inl (mem_biUnion ⟨⟨hc, hc₀⟩, hc⟩ hec))) + · exact Or.inl (Or.inl (Or.inr (mem_biUnion ⟨⟨hc, hc₁⟩, hc⟩ hec))) + · exact Or.inl (Or.inr (mem_biUnion ⟨⟨hc, hc₂⟩, hc⟩ hec)) + · exact Or.inr (mem_biUnion ⟨⟨hc, hc₃⟩, hc⟩ hec) + exact h𝒯.axiom2 hAB₀₁ hAB₂ hAB₃ + (eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle_all le_rfl hV_eq hE_eq) + +private theorem clique_vertices_in_cells_of_cuff + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {K : Set α} + (hK : IsClique G K) + (x : α) + (hxK : x ∈ K) + (hx_not_N : x ∉ π.nodeVertex '' π.Γ.N) + (d : Set π.S) + (hd : d ∈ π.Γ.C) + (hxd : x ∈ (π.cellGraph d).vertexSet) + (hcell_border : ∀ c ∈ π.Γ.C, x ∈ (π.cellGraph c).vertexSet → (c ∩ bd π.S).Nonempty ∧ ∃ n ∈ + tilde c, x ∈ π.borderSet n) + (nd : π.S) + (hx_nd : x ∈ π.borderSet nd) + (Θ : Set π.S) + (hΘ : Θ ∈ cuffs π.S) + (hdΘ : (d ∩ Θ).Nonempty) + (hnd_Θ : nd ∈ π.Γ.N ∩ Θ) : + K ⊆ ⋃ c ∈ {c | c ∈ π.Γ.C ∧ (c ∩ Θ).Nonempty}, (π.cellGraph c).vertexSet := by + intro y hyK + by_cases hyx : y = x + · subst hyx + exact mem_iUnion₂.mpr ⟨d, ⟨hd, hdΘ⟩, hxd⟩ + · obtain ⟨_, e, hex, hey⟩ := hK.2 x hxK y hyK (Ne.symm hyx) + obtain ⟨c, hc, hec⟩ := π.p1_edge e (G.edge_mem_of_inc hex) + have hxc : x ∈ (π.cellGraph c).vertexSet := + (π.cellGraph c).vertex_mem_of_inc ((inc_iff_of_le (π.cellGraph_le c hc) hec).mpr hex) + have hyc : y ∈ (π.cellGraph c).vertexSet := + (π.cellGraph c).vertex_mem_of_inc ((inc_iff_of_le (π.cellGraph_le c hc) hec).mpr hey) + obtain ⟨hbd_c, nc, hnc_t, hx_nc⟩ := hcell_border c hc hxc + obtain ⟨Θ', hΘ', hcΘ', htilde_c⟩ := π.Γ.exists_cuff_of_border_cell hc hbd_c + have hnc_Θ' : nc ∈ π.Γ.N ∩ Θ' := htilde_c hnc_t + have hΘ_eq : Θ' = Θ := by + by_contra hne_Θ + exact Set.disjoint_left.mp + (π.p4_disjoint Θ hΘ Θ' hΘ' (Ne.symm hne_Θ) nd hnd_Θ nc hnc_Θ') hx_nd hx_nc + exact mem_iUnion₂.mpr ⟨c, ⟨hc, hΘ_eq ▸ hcΘ'⟩, hyc⟩ + +/-- **Graph Minors XVII, (12.2)** (page 198): +"Let $\mathscr{T}$ be a tangle of order $>4p+9$ in a hypergraph $G$, and let +$\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a true, $(2p+7)$-redundant, +$\mathscr{T}$-central portrayal of $G$, with warp $\le p$. Then for every clique $K$ of $G$, either +(i) there is a disc $\Delta \subseteq \Sigma$ such that $\alpha(\Delta)$ is small, +$K \subseteq V(\alpha(\Delta))$, and $\operatorname{bd}(\Delta)$ is a $\Gamma$-normal $O$-arc with +$|\operatorname{bd}(\Delta) \cap N(\Gamma)| \le 3$, or +(ii) $K \subseteq V(\alpha(c))$ for some $c \in C(\Gamma)$." + +In (i) we prove $K \subseteq V(\alpha(\Delta)) \cup \gamma(\operatorname{bd}(\Delta) \cap +N(\Gamma))$. The paper's proof gives $M \subseteq \Delta(C)$, and a node of +$\operatorname{bd}(\Delta)$ need not lie on a cell inside $\Delta$. This is what (12.4) uses, since +the cell made by (7.2) contains $\gamma(\operatorname{bd}(\Delta) \cap N(\Gamma))$. -/ +theorem theorem_12_2_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 7)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 9 < θ) + {K : Set α} (hK : IsClique G K) : + (∃ Δ : Set π.S, IsClosedDisc Δ ∧ IsSmallWrt 𝒯 (π.areaGraph Δ) ∧ + K ⊆ (π.areaGraph Δ).vertexSet ∪ π.nodeVertex '' (discBd Δ ∩ π.Γ.N) ∧ + IsOArc (discBd Δ) ∧ π.Γ.IsNormal (discBd Δ) ∧ + (discBd Δ ∩ π.Γ.N).ncard ≤ 3) ∨ + (∃ c ∈ π.Γ.C, K ⊆ (π.cellGraph c).vertexSet) := by + classical + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have : ConnectedSpace π.S := π.connected + have hred3 : π.IsRedundant 𝒯 θ (2 * p + 3) := hred.mono (by omega) + have hθ5 : 4 * p + 5 < θ := by omega + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof h𝒯 π htrue hred3 hwarp hθ5 + -- Claim (2): If there exists `x ∈ K` and a cell `c` with `x ∈ V(α(c)) - V(α(-c))`, then (ii) + -- holds. + by_cases hclaim2 : ∃ x ∈ K, ∃ c ∈ π.Γ.C, + x ∈ (π.cellGraph c).vertexSet ∧ x ∉ π.otherVertices c + · right + rcases hclaim2 with ⟨x, hxK, c, hc, hxc, hx_not_other⟩ + refine ⟨c, hc, fun y hyK => ?_⟩ + by_cases hyx : y = x + · exact hyx ▸ hxc + · obtain ⟨_, e, hex, hey⟩ := hK.2 x hxK y hyK (Ne.symm hyx) + obtain ⟨c', hc', hec'⟩ := π.p1_edge e (G.edge_mem_of_inc hex) + have hxc' : x ∈ (π.cellGraph c').vertexSet := + (π.cellGraph c').vertex_mem_of_inc ((inc_iff_of_le (π.cellGraph_le c' hc') hec').mpr hex) + have hyc' : y ∈ (π.cellGraph c').vertexSet := + (π.cellGraph c').vertex_mem_of_inc ((inc_iff_of_le (π.cellGraph_le c' hc') hec').mpr hey) + have hcc' : c' = c := by + by_contra hne + exact hx_not_other ⟨c', hc', hne, hxc'⟩ + exact hcc' ▸ hyc' + push Not at hclaim2 + -- Next, if there exists `x ∈ K` not in `π.nodeVertex '' π.Γ.N`, reduce to (12.1). + by_cases hex_non_node : ∃ x ∈ K, x ∉ π.nodeVertex '' π.Γ.N + · right + rcases hex_non_node with ⟨x, hxK, hx_not_N⟩ + obtain ⟨d, hd, hxd⟩ := π.p1_vertex x (hK.1 hxK) + have hcell_border : ∀ c ∈ π.Γ.C, x ∈ (π.cellGraph c).vertexSet → + (c ∩ bd π.S).Nonempty ∧ ∃ n ∈ tilde c, x ∈ π.borderSet n := by + intro c hc hxc + obtain ⟨c', hc', hne, hxc'⟩ := hclaim2 x hxK c hc hxc + have hbd : (c ∩ bd π.S).Nonempty := by + by_contra hint + obtain ⟨n, ⟨_, hn_dom⟩, hEq⟩ := π.p5 c hc hint x hxc ⟨c', hc', hne, hxc'⟩ + exact hx_not_N ⟨n, π.domγ_subset hn_dom, hEq⟩ + obtain ⟨n, hnt, hmem | ⟨hn_dom, hEq⟩⟩ := π.p6 c hc hbd x hxc ⟨c', hc', hne, hxc'⟩ + · exact ⟨hbd, n, hnt, hmem⟩ + · exact False.elim (hx_not_N ⟨n, π.domγ_subset hn_dom, hEq.symm⟩) + obtain ⟨hbd_d, nd, hnd_t, hx_nd⟩ := hcell_border d hd hxd + obtain ⟨Θ, hΘ, hdΘ, htilde_d⟩ := π.Γ.exists_cuff_of_border_cell hd hbd_d + have hnd_Θ : nd ∈ π.Γ.N ∩ Θ := htilde_d hnd_t + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hK_sub_Θ : K ⊆ ⋃ c ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty}, (π.cellGraph c).vertexSet := by + exact clique_vertices_in_cells_of_cuff (α := α) (β := β) (G := G) π (K := K) hK x hxK + hx_not_N d hd hxd hcell_border nd hx_nd Θ hΘ hdΘ hnd_Θ + obtain ⟨c, hc, _, hK_c⟩ := + theorem_12_1_proof h𝒯 π htrue hred hwarp hθ hΘ hK hK_sub_Θ + exact ⟨c, hc, hK_c⟩ + · -- Claim (1): `K ⊆ π.nodeVertex '' π.Γ.N`. + push Not at hex_non_node + let M : Set π.S := {n ∈ π.Γ.N | π.nodeVertex n ∈ K} + have hM_sub : M ⊆ π.Γ.N := fun _ h => h.1 + have hM_fin : M.Finite := π.Γ.finite_N.subset hM_sub + have hK_eq_M : K = π.nodeVertex '' M := by + ext x + constructor + · intro hxK + obtain ⟨n, hnN, rfl⟩ := hex_non_node x hxK + exact ⟨n, ⟨hnN, hxK⟩, rfl⟩ + · rintro ⟨n, ⟨_, hxK⟩, rfl⟩ + exact hxK + have hinj_M : InjOn π.nodeVertex M := + π.nodeVertex_injOn.mono (fun _ h => hdom.symm ▸ h.1) + have hadj_M : ∀ m₁ ∈ M, ∀ m₂ ∈ M, m₁ ≠ m₂ → ∃ c ∈ π.Γ.C, m₁ ∈ tilde c ∧ m₂ ∈ tilde c := by + intro m₁ hm₁ m₂ hm₂ hne + have hne_v : π.nodeVertex m₁ ≠ π.nodeVertex m₂ := hinj_M.ne hm₁ hm₂ hne + obtain ⟨_, e, he₁, he₂⟩ := hK.2 (π.nodeVertex m₁) hm₁.2 (π.nodeVertex m₂) hm₂.2 hne_v + obtain ⟨c, hc, hec⟩ := π.p1_edge e (G.edge_mem_of_inc he₁) + have hv₁c : π.nodeVertex m₁ ∈ (π.cellGraph c).vertexSet := + (π.cellGraph c).vertex_mem_of_inc ((inc_iff_of_le (π.cellGraph_le c hc) hec).mpr he₁) + have hv₂c : π.nodeVertex m₂ ∈ (π.cellGraph c).vertexSet := + (π.cellGraph c).vertex_mem_of_inc ((inc_iff_of_le (π.cellGraph_le c hc) hec).mpr he₂) + have hm₁_tc : m₁ ∈ tilde c := + (nodeVertex_mem_cellGraph_iff h𝒯 π htrue hred3 hwarp hθ5 hc hm₁.1).mp hv₁c + have hm₂_tc : m₂ ∈ tilde c := + (nodeVertex_mem_cellGraph_iff h𝒯 π htrue hred3 hwarp hθ5 hc hm₂.1).mp hv₂c + exact ⟨c, hc, hm₁_tc, hm₂_tc⟩ + by_cases hex_cell : ∃ c ∈ π.Γ.C, M ⊆ tilde c + · right + rcases hex_cell with ⟨c, hc, hMc⟩ + refine ⟨c, hc, ?_⟩ + rw [hK_eq_M] + rintro _ ⟨m, hm, rfl⟩ + exact π.p2 c hc m ⟨hMc hm, hdom.symm ▸ hm.1⟩ + have hM_ge3 : 3 ≤ M.ncard := by + by_contra! hlt3 + apply hex_cell + by_cases hM1 : M.ncard ≤ 1 + · by_cases hMne : M.Nonempty + · obtain ⟨m, hm⟩ := hMne + have hM_eq : M = {m} := + (eq_of_subset_of_ncard_le (singleton_subset_iff.mpr hm) + (by rw [ncard_singleton]; omega) hM_fin).symm + obtain ⟨c, hc, hvc⟩ := π.p1_vertex (π.nodeVertex m) (hK.1 hm.2) + have hmt : m ∈ tilde c := + (nodeVertex_mem_cellGraph_iff h𝒯 π htrue hred3 hwarp hθ5 hc hm.1).mp hvc + exact ⟨c, hc, hM_eq.symm ▸ singleton_subset_iff.mpr hmt⟩ + · rw [not_nonempty_iff_eq_empty] at hMne + have hG_ne : G.vertexSet.Nonempty := by + by_contra hemp + rw [not_nonempty_iff_eq_empty] at hemp + have hmem := IsTangle.discrete_mem h𝒯 (empty_subset G.vertexSet) + (by rw [ncard_empty]; exact h𝒯.one_le) + exact h𝒯.axiom3 hmem hemp.symm + obtain ⟨v₀, hv₀⟩ := hG_ne + obtain ⟨c, hc, _⟩ := π.p1_vertex v₀ hv₀ + exact ⟨c, hc, hMne.symm ▸ empty_subset _⟩ + · have hM2 : M.ncard = 2 := by omega + obtain ⟨m₁, m₂, hne, hM_eq⟩ := ncard_eq_two.mp hM2 + have hm₁ : m₁ ∈ M := hM_eq ▸ mem_insert _ _ + have hm₂ : m₂ ∈ M := hM_eq ▸ mem_insert_of_mem _ (mem_singleton _) + obtain ⟨c, hc, ht₁, ht₂⟩ := hadj_M m₁ hm₁ m₂ hm₂ hne + refine ⟨c, hc, ?_⟩ + rw [hM_eq] + rintro m (rfl | rfl) <;> assumption + obtain ⟨h82_reg, h82_card, h82_node⟩ := + theorem_8_2_proof h𝒯 π htrue hred3 hwarp hθ5 + have h85_disc : ∀ F : Set π.S, IsOArc F → π.Γ.IsNormal F → (F ∩ π.Γ.N).ncard ≤ 3 → + ∃ Δ : Set π.S, IsClosedDisc Δ ∧ discBd Δ = F ∧ IsSmallWrt 𝒯 (π.areaGraph Δ) := by + intro F hO hnorm hcard + obtain ⟨Δ, hΔ, hbd, hsmall, _⟩ := + theorem_8_5_proof h𝒯 π htrue hred3 hwarp hθ5 hO hnorm hcard + exact ⟨Δ, hΔ, hbd, hsmall⟩ + have hno_four : ¬ ∃ Δ₀ Δ₁ Δ₂ Δ₃ : Set π.S, + (IsClosedDisc Δ₀ ∧ π.Γ.IsNormal (discBd Δ₀) ∧ (discBd Δ₀ ∩ π.Γ.N).ncard ≤ 3 ∧ + IsSmallWrt 𝒯 (π.areaGraph Δ₀)) ∧ + (IsClosedDisc Δ₁ ∧ π.Γ.IsNormal (discBd Δ₁) ∧ (discBd Δ₁ ∩ π.Γ.N).ncard ≤ 3 ∧ + IsSmallWrt 𝒯 (π.areaGraph Δ₁)) ∧ + (IsClosedDisc Δ₂ ∧ π.Γ.IsNormal (discBd Δ₂) ∧ (discBd Δ₂ ∩ π.Γ.N).ncard ≤ 3 ∧ + IsSmallWrt 𝒯 (π.areaGraph Δ₂)) ∧ + (IsClosedDisc Δ₃ ∧ π.Γ.IsNormal (discBd Δ₃) ∧ (discBd Δ₃ ∩ π.Γ.N).ncard ≤ 3 ∧ + IsSmallWrt 𝒯 (π.areaGraph Δ₃)) ∧ + ∀ c ∈ π.Γ.C, c ⊆ Δ₀ ∨ c ⊆ Δ₁ ∨ c ⊆ Δ₂ ∨ c ⊆ Δ₃ := by + exact no_four_discs_in_portrayal (α := α) (β := β) (G := G) (𝒯 := 𝒯) (θ := θ) (p := p) h𝒯 π + hwarp hθ + have hcellHyps : CellHyps π.Γ := + ⟨fun r hr => ⟨theorem_8_1_proof h𝒯 π htrue hred3 hwarp hθ5 hr, h82_reg r hr⟩, h82_card, + h82_node⟩ + obtain ⟨Δ, hΔ, hO, hnorm, hcard, hsmall, hM_in⟩ := + clique_disc π.isSurface hcellHyps hM_sub hM_ge3 hadj_M (fun Δ => IsSmallWrt 𝒯 + (π.areaGraph Δ)) h85_disc + (fun ⟨D, hD, hcov⟩ => hno_four ⟨D 0, D 1, D 2, D 3, hD 0, hD 1, hD 2, hD 3, fun c hc => by + obtain ⟨k, hk⟩ := hcov c hc + fin_cases k + exacts [.inl hk, .inr (.inl hk), .inr (.inr (.inl hk)), .inr (.inr (.inr hk))]⟩) + left + refine ⟨Δ, hΔ, hsmall, ?_, hO, hnorm, hcard⟩ + rw [hK_eq_M] + rintro _ ⟨m, hm, rfl⟩ + by_cases hmb : m ∈ discBd Δ + · exact .inr ⟨m, ⟨hmb, hm.1⟩, rfl⟩ + · left + obtain ⟨c, hc, hmc⟩ := h82_node m hm.1 + have hint : m ∈ discInt Δ := ⟨hM_in hm, hmb⟩ + have hman := π.isSurface.2.2 + obtain ⟨z, hzi, hzc⟩ := mem_closure_iff.mp hmc.1 _ (hΔ.isOpen_discInt hman) hint + have hoff : Disjoint c (discBd Δ) := disjoint_left.mpr fun y hy hyb => + disjoint_left.mp (π.Γ.cell_disjoint_N hc) hy (hnorm ⟨hyb, π.Γ.cell_subset_U hc hy⟩) + have hcΔ : c ⊆ Δ := by + rcases disc_dichotomy hman hΔ (arcComponentsIn_isPathConnected + hc).isConnected.isPreconnected hoff with h1 | h1 + · exact h1 + · exact absurd hzi.1 (disjoint_left.mp h1 hzc) + exact mem_biUnion ⟨⟨hc, hcΔ⟩, hc⟩ (π.p2 c hc m ⟨hmc, hdom.symm ▸ hm.1⟩) + +/-! ## 3. Adding an Edge Whose Ends Form a Clique: (12.3) (Page 199) -/ + +/-- If $G' \le G$ and $\mathcal{T}'$ is a tangle of order $\theta$ in $G'$, then the induced tangle +`inducedSubhypergraphTangle G G' 𝒯' θ` is a tangle of order $\theta$ in $G$. +Graph Minors XVII, Section 12 (page 199): "Then $\mathscr{T}$ is clearly a tangle in $G$; we call +it the *tangle induced by* $\mathscr{T}'$." -/ +theorem isTangle_inducedSubhypergraphTangle {α : Type u} {β : Type v} + {G G' : Hypergraph α β} {𝒯' : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + (hle : G' ≤ G) (h𝒯' : IsTangle G' θ 𝒯') : + IsTangle G θ (inducedSubhypergraphTangle G G' 𝒯' θ) := + GM10.isTangle_inducedTangleFromSubgraph hle h𝒯' + +/-- Given a subhypergraph $H \le G$ and an edge $e \in E(G)$ with $\operatorname{ends}_G(e) +\subseteq V(H)$, +`addEdge G H e he hends` is the subhypergraph $(V(H), E(H) \cup \{e\})$ of $G$. +Graph Minors XVII, Section 12, (12.3) (page 199). -/ +@[expose] def addEdge {α : Type u} {β : Type v} (G H : Hypergraph α β) (e : β) + (he : e ∈ G.edgeSet) (hends : G.ends e ⊆ H.vertexSet) : Hypergraph α β where + vertexSet := H.vertexSet + edgeSet := H.edgeSet ∪ {e} + Inc f v := H.Inc f v ∨ (f = e ∧ G.Inc e v) + vertex_mem_of_inc := by + rintro f v (h | ⟨_, h⟩) + · exact H.vertex_mem_of_inc h + · exact hends h + edge_mem_of_inc := by + rintro f v (h | ⟨rfl, _⟩) + · exact Or.inl (H.edge_mem_of_inc h) + · exact Or.inr (mem_singleton f) + vertexSet_finite := H.vertexSet_finite + edgeSet_finite := H.edgeSet_finite.union (finite_singleton e) + +theorem addEdge_le {α : Type u} {β : Type v} {G H : Hypergraph α β} {e : β} + (hH : H ≤ G) (he : e ∈ G.edgeSet) (hends : G.ends e ⊆ H.vertexSet) : + addEdge G H e he hends ≤ G where + vertexSet_subset := hH.vertexSet_subset + edgeSet_subset := union_subset hH.edgeSet_subset (singleton_subset_iff.mpr he) + ends_eq := by + rintro f (hf | rfl) + · ext v + have hEq := congrArg (v ∈ ·) (hH.ends_eq f hf) + exact ⟨fun hG => Or.inl (hEq.mp hG), fun h => h.elim hEq.mpr (fun ⟨rfl, hG⟩ => hG)⟩ + · ext v + exact ⟨fun hG => Or.inr ⟨rfl, hG⟩, fun h => h.elim (fun hH_inc => by + have hfH : f ∈ H.edgeSet := H.edge_mem_of_inc hH_inc + have hEq := congrArg (v ∈ ·) (hH.ends_eq f hfH) + exact hEq.mpr hH_inc) And.right⟩ + +/-- If a walk `w` in `K₂` is not a walk in a subgraph `K₁ ≤ K₂`, then `w` traverses an edge of `K₂` +that is not in `K₁`. -/ +private theorem exists_adj_not_adj_of_not_walk {α : Type u} {K₁ K₂ : SimpleGraph α} + {a b : α} (w : K₂.Walk a b) + (hnot : ¬ ∃ w₁ : K₁.Walk a b, w₁.support = w.support) : + ∃ v₁ ∈ w.support, ∃ v₂ ∈ w.support, K₂.Adj v₁ v₂ ∧ ¬ K₁.Adj v₁ v₂ := by + induction w with + | nil => + exfalso + exact hnot ⟨.nil, rfl⟩ + | @cons x y z hadj tail ih => + by_cases hadj₁ : K₁.Adj x y + · have hnot_tail : ¬ ∃ w₁ : K₁.Walk y z, w₁.support = tail.support := by + rintro ⟨w₁, hsup⟩ + exact hnot ⟨.cons hadj₁ w₁, by simp [hsup]⟩ + obtain ⟨v₁, hv₁, v₂, hv₂, h2, h1⟩ := ih hnot_tail + exact ⟨v₁, List.mem_cons_of_mem x hv₁, v₂, List.mem_cons_of_mem x hv₂, h2, h1⟩ + · exact ⟨x, SimpleGraph.Walk.start_mem_support _, + y, List.mem_cons_of_mem x (SimpleGraph.Walk.start_mem_support _), hadj, hadj₁⟩ + +/-- In a linkage `P : Fin m → PathFromTo K X Y` of pairwise vertex-disjoint paths where +`X` is finite with `X.ncard = m`, every vertex in `(P i₀).walk.support ∩ X` equals `(P i₀).first`. +-/ +private theorem eq_first_of_mem_support_of_linkage {α : Type u} {K : SimpleGraph α} + {X Y : Set α} {m : ℕ} (hX_fin : X.Finite) (hX_card : X.ncard = m) + (P : Fin m → PathFromTo K X Y) + (hP_disj : Pairwise fun i j => Disjoint {z | z ∈ (P i).walk.support} {z | z ∈ + (P j).walk.support}) + {i₀ : Fin m} {v : α} (hv_sup : v ∈ (P i₀).walk.support) (hv_X : v ∈ X) : + v = (P i₀).first := by + have hinj : Function.Injective (fun i : Fin m => (P i).first) := by + intro i j hij + change (P i).first = (P j).first at hij + by_contra hne + have hmem_i : (P j).first ∈ (P i).walk.support := + hij ▸ SimpleGraph.Walk.start_mem_support (P i).walk + exact Set.disjoint_left.mp (hP_disj hne) + hmem_i (SimpleGraph.Walk.start_mem_support (P j).walk) + have hsub : Set.range (fun i : Fin m => (P i).first) ⊆ X := by + rintro _ ⟨i, rfl⟩; exact (P i).first_mem + have hrange_card : (Set.range (fun i : Fin m => (P i).first)).ncard = m := by + rw [ncard_range_of_injective hinj, Nat.card_fin] + have hrange_eq : Set.range (fun i : Fin m => (P i).first) = X := + eq_of_subset_of_ncard_le hsub (by rw [hrange_card, hX_card]) hX_fin + obtain ⟨j, hj⟩ : v ∈ Set.range (fun i : Fin m => (P i).first) := hrange_eq.symm ▸ hv_X + have hji₀ : j = i₀ := by + by_contra hne + exact Set.disjoint_left.mp (hP_disj hne) + (hj ▸ SimpleGraph.Walk.start_mem_support (P j).walk) hv_sup + exact hj.symm.trans (congrArg (fun i => (P i).first) hji₀) + +/-- Symmetric version for `Y`: every vertex in `(P i₀).walk.support ∩ Y` equals `(P i₀).last`. -/ +private theorem eq_last_of_mem_support_of_linkage {α : Type u} {K : SimpleGraph α} + {X Y : Set α} {m : ℕ} (hY_fin : Y.Finite) (hY_card : Y.ncard = m) + (P : Fin m → PathFromTo K X Y) + (hP_disj : Pairwise fun i j => Disjoint {z | z ∈ (P i).walk.support} {z | z ∈ + (P j).walk.support}) + {i₀ : Fin m} {v : α} (hv_sup : v ∈ (P i₀).walk.support) (hv_Y : v ∈ Y) : + v = (P i₀).last := by + have hinj : Function.Injective (fun i : Fin m => (P i).last) := by + intro i j hij + change (P i).last = (P j).last at hij + by_contra hne + have hmem_i : (P j).last ∈ (P i).walk.support := + hij ▸ SimpleGraph.Walk.end_mem_support (P i).walk + exact Set.disjoint_left.mp (hP_disj hne) + hmem_i (SimpleGraph.Walk.end_mem_support (P j).walk) + have hsub : Set.range (fun i : Fin m => (P i).last) ⊆ Y := by + rintro _ ⟨i, rfl⟩; exact (P i).last_mem + have hrange_card : (Set.range (fun i : Fin m => (P i).last)).ncard = m := by + rw [ncard_range_of_injective hinj, Nat.card_fin] + have hrange_eq : Set.range (fun i : Fin m => (P i).last) = Y := + eq_of_subset_of_ncard_le hsub (by rw [hrange_card, hY_card]) hY_fin + obtain ⟨j, hj⟩ : v ∈ Set.range (fun i : Fin m => (P i).last) := hrange_eq.symm ▸ hv_Y + have hji₀ : j = i₀ := by + by_contra hne + exact Set.disjoint_left.mp (hP_disj hne) + (hj ▸ SimpleGraph.Walk.end_mem_support (P j).walk) hv_sup + exact hj.symm.trans (congrArg (fun i => (P i).last) hji₀) + +private theorem cyclicDist_chain {k : ℕ} {a b c : Fin k} (h : cyclicDist a b + ≤ cyclicDist a c) : cyclicDist a b + cyclicDist b c = cyclicDist a c := by + have ha := a.2 + have hb := b.2 + have hc := c.2 + rw [cyclicDist_eq_ite a b, cyclicDist_eq_ite a c] at h + rw [cyclicDist_eq_ite a b, cyclicDist_eq_ite b c, cyclicDist_eq_ite a c] + split_ifs at h ⊢ <;> omega + +private theorem cyclicDist_add_swap {k : ℕ} {a b : Fin k} (h : a ≠ b) : cyclicDist a b + cyclicDist + b a = k := by + have ha := a.2 + have hb := b.2 + have hne : a.1 ≠ b.1 := fun e => h (Fin.ext e) + rw [cyclicDist_eq_ite a b, cyclicDist_eq_ite b a] + split_ifs <;> omega + +private theorem cyclicDist_succ {k : ℕ} (hk : 0 < k) (a t : Fin k) (hne : cyclicSucc hk t ≠ a) : + cyclicDist a (cyclicSucc hk t) = cyclicDist a t + 1 := by + have ha := a.2 + have ht := t.2 + have hne' : (cyclicSucc hk t).1 ≠ a.1 := fun e => hne (Fin.ext e) + have hs : ((cyclicSucc hk t).1 = t.1 + 1 ∧ t.1 + 1 < k) ∨ ((cyclicSucc hk t).1 = 0 ∧ t.1 + 1 = k) + := by + by_cases h : t.1 + 1 < k + · exact .inl ⟨Nat.mod_eq_of_lt h, h⟩ + · have h2 : t.1 + 1 = k := by omega + refine .inr ⟨?_, h2⟩ + change (t.1 + 1) % k = 0 + rw [h2] + exact Nat.mod_self k + have hs2 := (cyclicSucc hk t).2 + rw [cyclicDist_eq_ite a t, cyclicDist_eq_ite a (cyclicSucc hk t)] + generalize (cyclicSucc hk t).1 = u at * + rcases hs with ⟨h1, h2⟩ | ⟨h1, h2⟩ <;> subst h1 <;> split_ifs <;> omega + +/-- Cyclic-order helper for Claim (1) in the proof of (12.3) (page 199): the two vertices `w₁`, `w₂` +lie on the two ends of the cell `E.cell j₀`, and each lies on an end `m₁`, `m₂` of another cell +`E.cell j`. +We measure positions on the cuff from `j₀`. If `i` comes before `m₂`, then (P7) for `j₀'`, `i`, +`m₂`, `j₀` puts `w₂` on `i`. If not, then `i` comes after `m₁`, and (P7) for `j₀`, `j₀'`, `m₁`, `i` +puts `w₁` on `i`. -/ +private theorem borderPlus_nonempty_of_two_ends_in_other_cell + {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {Θ : Set π.S} {k : ℕ} (E : π.Γ.CuffEnumeration Θ k) + {j₀ j : Fin k} (hne_j : j ≠ j₀) + {w₁ w₂ : α} + (hw₁_j₀ : w₁ ∈ π.borderPlus (E.node j₀)) + (hw₁_not_next : w₁ ∉ π.borderPlus (E.node (cyclicSucc (Nat.lt_of_lt_of_le + (by decide) E.two_le) j₀))) + (hw₂_next : w₂ ∈ π.borderPlus (E.node (cyclicSucc (Nat.lt_of_lt_of_le + (by decide) E.two_le) j₀))) + (hw₂_not_j₀ : w₂ ∉ π.borderPlus (E.node j₀)) + (hw₁_c₀ : w₁ ∈ (π.cellGraph (E.cell j₀)).vertexSet) + (hw₂_c₀ : w₂ ∈ (π.cellGraph (E.cell j₀)).vertexSet) + (hw₁_c : w₁ ∈ (π.cellGraph (E.cell j)).vertexSet) + (hw₂_c : w₂ ∈ (π.cellGraph (E.cell j)).vertexSet) + (i : Fin k) : + (({w₁, w₂} : Set α) ∩ π.borderPlus (E.node i)).Nonempty := by + have hk0 : 0 < k := Nat.lt_of_lt_of_le (by decide) E.two_le + have hcell_mem : ∀ r : Fin k, E.cell r ∈ π.Γ.C ∧ (E.cell r ∩ bd π.S).Nonempty := by + intro r + have hrange : E.cell r ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self r + have hΘ_bd : Θ ⊆ bd π.S := by + rcases E.cuff_mem with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + exact ⟨hrange.1, hrange.2.mono (inter_subset_inter_right _ hΘ_bd)⟩ + have hne_cell : E.cell j ≠ E.cell j₀ := fun h => hne_j (E.injective_cell h) + obtain ⟨n_m₁, hm₁_t, hw₁_m₁⟩ := π.p6 (E.cell j) (hcell_mem j).1 (hcell_mem j).2 w₁ hw₁_c + ⟨E.cell j₀, (hcell_mem j₀).1, hne_cell.symm, hw₁_c₀⟩ + obtain ⟨n_m₂, hm₂_t, hw₂_m₂⟩ := π.p6 (E.cell j) (hcell_mem j).1 (hcell_mem j).2 w₂ hw₂_c + ⟨E.cell j₀, (hcell_mem j₀).1, hne_cell.symm, hw₂_c₀⟩ + rw [E.cell_tilde j] at hm₁_t hm₂_t + have hm₁_ex : ∃ m₁ : Fin k, (m₁ = j ∨ m₁ = cyclicSucc hk0 j) ∧ n_m₁ = E.node m₁ := by + rcases hm₁_t with rfl | hm₁_t + · exact ⟨j, Or.inl rfl, rfl⟩ + · exact ⟨cyclicSucc hk0 j, Or.inr rfl, mem_singleton_iff.mp hm₁_t⟩ + have hm₂_ex : ∃ m₂ : Fin k, (m₂ = j ∨ m₂ = cyclicSucc hk0 j) ∧ n_m₂ = E.node m₂ := by + rcases hm₂_t with rfl | hm₂_t + · exact ⟨j, Or.inl rfl, rfl⟩ + · exact ⟨cyclicSucc hk0 j, Or.inr rfl, mem_singleton_iff.mp hm₂_t⟩ + obtain ⟨m₁, hm₁_cases, rfl⟩ := hm₁_ex + obtain ⟨m₂, hm₂_cases, rfl⟩ := hm₂_ex + change w₁ ∈ π.borderPlus (E.node m₁) at hw₁_m₁ + change w₂ ∈ π.borderPlus (E.node m₂) at hw₂_m₂ + set j₀' := cyclicSucc hk0 j₀ with hj₀' + have hj₀ne : j₀' ≠ j₀ := cyclicSucc_ne_self E.two_le j₀ + by_cases hi_j₀ : i = j₀ + · exact ⟨w₁, Or.inl rfl, hi_j₀ ▸ hw₁_j₀⟩ + by_cases hi_j₀' : i = j₀' + · exact ⟨w₂, Or.inr rfl, hi_j₀' ▸ hw₂_next⟩ + by_cases hi_m₁ : i = m₁ + · exact ⟨w₁, Or.inl rfl, hi_m₁ ▸ hw₁_m₁⟩ + by_cases hi_m₂ : i = m₂ + · exact ⟨w₂, Or.inr rfl, hi_m₂ ▸ hw₂_m₂⟩ + have hm₁_ne_j₀' : m₁ ≠ j₀' := fun h => hw₁_not_next (h ▸ hw₁_m₁) + have hm₂_ne_j₀ : m₂ ≠ j₀ := fun h => hw₂_not_j₀ (h ▸ hw₂_m₂) + have hd1 : cyclicDist j₀ j₀' = 1 := by + have h1 := cyclicDist_succ hk0 j₀ j₀ hj₀ne + rw [cyclicDist_self] at h1 + exact h1 + have hinj : ∀ {a b : Fin k}, a ≠ j₀ → b ≠ j₀ → a ≠ b → cyclicDist j₀ a ≠ cyclicDist j₀ b + := fun {a b} ha hb hab e => by + have h1 := cyclicDist_add_swap ha.symm + have h2 := cyclicDist_add_swap hb.symm + have h3 : a.1 ≠ b.1 := fun e' => hab (Fin.ext e') + have ha' : a.1 ≠ j₀.1 := fun e' => ha (Fin.ext e') + have hb' : b.1 ≠ j₀.1 := fun e' => hb (Fin.ext e') + have h4 := a.2 + have h5 := b.2 + have h6 := j₀.2 + rw [cyclicDist_eq_ite j₀ a, cyclicDist_eq_ite j₀ b] at e + split_ifs at e <;> omega + have hp_i : 1 < cyclicDist j₀ i := by + have h1 := cyclicDist_pos_of_ne (Ne.symm hi_j₀) + have h2 := hinj hi_j₀ hj₀ne hi_j₀' + omega + have hlt := cyclicDist_lt hk0 j₀ i + have hltm := cyclicDist_lt hk0 j₀ m₂ + have hm₂_ne := hinj hi_j₀ hm₂_ne_j₀ hi_m₂ + by_cases hcmp : cyclicDist j₀ i < cyclicDist j₀ m₂ + · -- `w₂` lies on `i`, by (P7) for `j₀'`, `i`, `m₂`, `j₀`. + refine ⟨w₂, Or.inr rfl, ?_⟩ + have hsum : cyclicDist j₀' i + cyclicDist i m₂ + cyclicDist m₂ j₀ ≤ k := by + have h0 := cyclicDist_chain (a := j₀) (b := j₀') (c := i) (by omega) + have h1 := cyclicDist_chain hcmp.le + have h2 := cyclicDist_add_swap hm₂_ne_j₀.symm + omega + exact (π.p7_of_cyclicDist E hsum hw₂_next hw₂_m₂).resolve_right hw₂_not_j₀ + · -- `w₁` lies on `i`, by (P7) for `j₀`, `j₀'`, `m₁`, `i`. + refine ⟨w₁, Or.inl rfl, ?_⟩ + have hgt : cyclicDist j₀ m₂ < cyclicDist j₀ i := by omega + have hj₁ : j ≠ j₀ := hne_j + have hm₂pos := cyclicDist_pos_of_ne (Ne.symm hm₂_ne_j₀) + have hm₁_lt : cyclicDist j₀ m₁ < cyclicDist j₀ i ∧ m₁ ≠ j₀ := by + rcases hm₁_cases with h1 | h1 + · rw [h1] + refine ⟨?_, hne_j⟩ + rcases hm₂_cases with h2 | h2 + · rw [← h2] + exact hgt + · have h3 := cyclicDist_succ hk0 j₀ j (h2 ▸ hm₂_ne_j₀) + rw [← h2] at h3 + omega + · rcases hm₂_cases with h2 | h2 + · by_cases h3 : cyclicSucc hk0 j = j₀ + · exfalso + have h4 : cyclicDist j₀ j + 1 = k := by + have h5 := cyclicDist_add_swap hne_j.symm + have h6 : cyclicDist j j₀ = 1 := by + rw [← h3] + have h7 := cyclicDist_succ hk0 j j (cyclicSucc_ne_self E.two_le j) + rw [cyclicDist_self] at h7 + exact h7 + omega + rw [h2] at hgt + omega + · have h4 := cyclicDist_succ hk0 j₀ j h3 + rw [← h1] at h4 h3 + rw [h2] at hgt + refine ⟨?_, h3⟩ + have h5 := hinj hi_j₀ h3 hi_m₁ + omega + · have e : m₂ = m₁ := h2.trans h1.symm + exact ⟨e ▸ hgt, e ▸ hm₂_ne_j₀⟩ + obtain ⟨hlt₁, hm₁j⟩ := hm₁_lt + have hp1 : cyclicDist j₀ j₀' ≤ cyclicDist j₀ m₁ := by + have h1 := cyclicDist_pos_of_ne (Ne.symm hm₁j) + omega + have hsum : cyclicDist j₀ j₀' + cyclicDist j₀' m₁ + cyclicDist m₁ i ≤ k := by + have h1 := cyclicDist_chain hp1 + have h2 := cyclicDist_chain hlt₁.le + omega + exact (π.p7_of_cyclicDist E hsum hw₁_j₀ hw₁_m₁).resolve_left hw₁_not_next + +/-- The cell graphs of `π'` in (12.3): the edge `e` is added to the graph of the cell `c₀`, and +every other cell keeps its graph. -/ +@[expose] noncomputable def addEdgeCell {α : Type u} {β : Type v} {G : Hypergraph α β} {e : β} + (π : Portrayal (G.deleteEdges {e})) {c₀ : Set π.S} (he : e ∈ G.edgeSet) + (hends : G.ends e ⊆ (π.cellGraph c₀).vertexSet) (c : Set π.S) : Hypergraph α β := + open Classical in if c = c₀ then addEdge G (π.cellGraph c₀) e he hends else π.cellGraph c + +theorem addEdgeCell_vertexSet {α : Type u} {β : Type v} {G : Hypergraph α β} {e : β} + (π : Portrayal (G.deleteEdges {e})) {c₀ : Set π.S} (he : e ∈ G.edgeSet) + (hends : G.ends e ⊆ (π.cellGraph c₀).vertexSet) (c : Set π.S) : + (addEdgeCell π he hends c).vertexSet = (π.cellGraph c).vertexSet := by + dsimp only [addEdgeCell] + split_ifs with h + · subst h; rfl + · rfl + +theorem deleteEdges_singleton_le {α : Type u} {β : Type v} (G : Hypergraph α β) (e : β) : + G.deleteEdges {e} ≤ G := + ⟨subset_rfl, sdiff_subset, fun f hf => by + ext v + exact ⟨fun h => ⟨h, hf.2⟩, fun h => h.1⟩⟩ + +/-- The separation `(α(c), α(-c))` has order at most `max(3, 2p + 2)` when `π` has warp `≤ p`: by +(P5) for an internal cell, and by (P6) for a border cell. -/ +theorem Portrayal.ncard_cell_inter_other_le {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {p : ℕ} (hwarp : π.warp ≤ p) {c : Set π.S} (hc : c ∈ π.Γ.C) : + ((π.cellGraph c).vertexSet ∩ π.otherVertices c).ncard ≤ max 3 (2 * p + 2) := by + by_cases hbd : (c ∩ bd π.S).Nonempty + · obtain ⟨n₁, n₂, _, htilde, _, _, hn₁_mem, hn₂_mem⟩ := π.Γ.border_cell_exists_ends hc hbd + have hsub_bp : (π.cellGraph c).vertexSet ∩ π.otherVertices c ⊆ + π.borderPlus n₁ ∪ π.borderPlus n₂ := by + rintro v ⟨hvc, d, hd, hne, hvd⟩ + obtain ⟨n, hnt, hv_bp⟩ := π.p6 c hc hbd v hvc ⟨d, hd, hne, hvd⟩ + rcases (htilde ▸ hnt : n ∈ ({n₁, n₂} : Set π.S)) with rfl | rfl + · exact Or.inl hv_bp + · exact Or.inr hv_bp + have hb₁ : (π.borderPlus n₁).ncard ≤ p + 1 := + (π.ncard_borderPlus_le hn₁_mem).trans + (Nat.add_le_add_right ((π.ncard_borderSet_le_warp hn₁_mem).trans hwarp) 1) + have hb₂ : (π.borderPlus n₂).ncard ≤ p + 1 := + (π.ncard_borderPlus_le hn₂_mem).trans + (Nat.add_le_add_right ((π.ncard_borderSet_le_warp hn₂_mem).trans hwarp) 1) + have hfin_u : (π.borderPlus n₁ ∪ π.borderPlus n₂).Finite := + (π.borderPlus_finite hn₁_mem).union (π.borderPlus_finite hn₂_mem) + have hle := (ncard_le_ncard hsub_bp hfin_u).trans (ncard_union_le _ _) + omega + · have hsub_γ : (π.cellGraph c).vertexSet ∩ π.otherVertices c ⊆ + π.nodeVertex '' (tilde c ∩ π.domγ) := by + rintro v ⟨hvc, d, hd, hne, hvd⟩ + exact π.p5 c hc hbd v hvc ⟨d, hd, hne, hvd⟩ + have hsub_t : tilde c ∩ π.domγ ⊆ tilde c := inter_subset_left + have hfin_t : (tilde c).Finite := π.Γ.finite_tilde_cell hc + have hcard_t : (tilde c).ncard ≤ 3 := π.Γ.ncard_tilde_cell_le hc + have hle := (ncard_le_ncard hsub_γ ((hfin_t.subset hsub_t).image _)).trans + ((ncard_image_le (hfin_t.subset hsub_t)).trans (ncard_le_ncard hsub_t hfin_t)) + omega + +/-- The portrayal `π' = (Σ, Γ, α', β, γ)` of (12.3): the portrayal `π` of `G \ e` with the edge `e` +added to the cell `c₀`. It is a portrayal of `G`, since all ends of `e` lie in `V(α(c₀))`. -/ +@[expose] noncomputable def addEdgePortrayal {α : Type u} {β : Type v} {G : Hypergraph α β} {e : β} + (π : Portrayal (G.deleteEdges {e})) {c₀ : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) (he : e ∈ G.edgeSet) + (hends : G.ends e ⊆ (π.cellGraph c₀).vertexSet) : Portrayal G := + { S := π.S + top := π.top + isSurface := π.isSurface + connected := π.connected + Γ := π.Γ + cellGraph := addEdgeCell π he hends + borderSet := π.borderSet + domγ := π.domγ + nodeVertex := π.nodeVertex + cellGraph_le := fun c hc => by + dsimp only [addEdgeCell]; split_ifs with h + · exact addEdge_le ((π.cellGraph_le c₀ hc₀).trans (deleteEdges_singleton_le G e)) he hends + · exact (π.cellGraph_le c hc).trans (deleteEdges_singleton_le G e) + borderSet_subset := π.borderSet_subset + domγ_subset := π.domγ_subset + nodeVertex_mem := π.nodeVertex_mem + nodeVertex_injOn := π.nodeVertex_injOn + p1_vertex := fun v hv => by + obtain ⟨c, hc, hvc⟩ := π.p1_vertex v hv + exact ⟨c, hc, (addEdgeCell_vertexSet π he hends c).symm ▸ hvc⟩ + p1_edge := fun f hf => by + by_cases hfe : f = e + · subst hfe + refine ⟨c₀, hc₀, ?_⟩ + dsimp only [addEdgeCell] + rw [ite_eq_left rfl] + exact Or.inr (mem_singleton f) + · obtain ⟨c, hc, hfc⟩ := π.p1_edge f ⟨hf, hfe⟩ + refine ⟨c, hc, ?_⟩ + dsimp only [addEdgeCell]; split_ifs with h + · subst h; exact Or.inl hfc + · exact hfc + p1_disjoint := fun c₁ hc₁ c₂ hc₂ hne => by + have hdisj₀ := π.p1_disjoint c₁ hc₁ c₂ hc₂ hne + have he_not : ∀ c ∈ π.Γ.C, e ∉ (π.cellGraph c).edgeSet := fun c hc hec => + ((π.cellGraph_le c hc).edgeSet_subset hec).2 (mem_singleton e) + dsimp only [addEdgeCell] + split_ifs with h1 h2 h2 + · exact False.elim (hne (h1.trans h2.symm)) + · change Disjoint ((π.cellGraph c₀).edgeSet ∪ {e}) (π.cellGraph c₂).edgeSet + rw [disjoint_union_left, disjoint_singleton_left] + exact ⟨h1 ▸ hdisj₀, he_not c₂ hc₂⟩ + · change Disjoint (π.cellGraph c₁).edgeSet ((π.cellGraph c₀).edgeSet ∪ {e}) + rw [disjoint_union_right, disjoint_singleton_right] + exact ⟨h2 ▸ hdisj₀, he_not c₁ hc₁⟩ + · exact hdisj₀ + p2 := fun c hc n hn => (addEdgeCell_vertexSet π he hends c).symm ▸ π.p2 c hc n hn + p3_notMem := π.p3_notMem + p3_subset := fun c hc hbd n hnt v hv => (addEdgeCell_vertexSet π he hends c).symm ▸ π.p3_subset + c hc hbd n hnt hv + p4_disjoint := π.p4_disjoint + p4_notMem := π.p4_notMem + p5 := fun c hc hint v hvc hex => by + rcases hex with ⟨c', hc', hne, hvc'⟩ + exact π.p5 c hc hint v (addEdgeCell_vertexSet π he hends c ▸ hvc) ⟨c', hc', hne, + addEdgeCell_vertexSet π he hends c' ▸ hvc'⟩ + p6 := fun c hc hbd v hvc hex => by + rcases hex with ⟨c', hc', hne, hvc'⟩ + exact π.p6 c hc hbd v (addEdgeCell_vertexSet π he hends c ▸ hvc) ⟨c', hc', hne, + addEdgeCell_vertexSet π he hends c' ▸ hvc'⟩ + p7 := π.p7 } + +theorem addEdgePortrayal_central {α : Type u} {β : Type v} {G : Hypergraph α β} {e : β} + (he : e ∈ G.edgeSet) {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle (G.deleteEdges {e}) θ 𝒯) (hθ : 2 * p + 8 < θ) + (π : Portrayal (G.deleteEdges {e})) (hcentral : π.IsCentral 𝒯) (hwarp : π.warp ≤ p) + {c₀ : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) (hends : G.ends e ⊆ (π.cellGraph c₀).vertexSet) : + (addEdgePortrayal π hc₀ he hends).IsCentral (inducedSubhypergraphTangle G + (G.deleteEdges {e}) 𝒯 θ) := by + classical + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + intro c hc + let A := (addEdgePortrayal π hc₀ he hends).cellGraph c + let D := complSubhypergraph G A + have hA_le : A ≤ G := (addEdgePortrayal π hc₀ he hends).cellGraph_le c hc + have hsep_AD : G.IsSeparation A D := isSeparation_complSubhypergraph hA_le + have hother_eq : (addEdgePortrayal π hc₀ he hends).otherVertices c = π.otherVertices c := by + ext v + simp only [Portrayal.otherVertices, mem_ofPred_eq] + exact ⟨fun ⟨d, hd, hne, hvd⟩ => ⟨d, hd, hne, addEdgeCell_vertexSet π he hends d ▸ hvd⟩, + fun ⟨d, hd, hne, hvd⟩ => ⟨d, hd, hne, (addEdgeCell_vertexSet π he hends d).symm ▸ hvd⟩⟩ + have hatt_sub : attachments G A ⊆ (π.cellGraph c).vertexSet ∩ π.otherVertices c := by + have hsub := (addEdgePortrayal π hc₀ he hends).attachments_cellGraph_subset_otherVertices hc + rw [hother_eq] at hsub + exact fun v hv => ⟨(addEdgeCell_vertexSet π he hends c).subset (hsub hv).1, (hsub hv).2⟩ + have hcard_other := π.ncard_cell_inter_other_le hwarp hc + have hord_AD : separationOrder A D < θ := by + rw [separationOrder_complSubhypergraph] + have hfin_inter : ((π.cellGraph c).vertexSet ∩ π.otherVertices c).Finite := + (π.cellGraph c).vertexSet_finite.inter_of_left _ + have hle := (ncard_le_ncard hatt_sub hfin_inter).trans hcard_other + omega + have hA_inter_G₀ : A ∩ (G.deleteEdges {e}) = π.cellGraph c := by + have hle1 : A ∩ (G.deleteEdges {e}) ≤ (G.deleteEdges {e}) := inter_le_right hA_le + (deleteEdges_singleton_le G e) + have hle2 : π.cellGraph c ≤ (G.deleteEdges {e}) := π.cellGraph_le c hc + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle1 hle2 + · change (addEdgeCell π he hends c).vertexSet ∩ G.vertexSet = (π.cellGraph c).vertexSet + rw [addEdgeCell_vertexSet π he hends c] + exact inter_eq_self_of_subset_left hle2.vertexSet_subset + · change (addEdgeCell π he hends c).edgeSet ∩ (G.deleteEdges {e}).edgeSet = + (π.cellGraph c).edgeSet + dsimp only [addEdgeCell] + split_ifs with h + · rw [h] + ext f + change (f ∈ (π.cellGraph c₀).edgeSet ∨ f = e) ∧ (f ∈ G.edgeSet ∧ f ≠ e) ↔ + f ∈ (π.cellGraph c₀).edgeSet + exact ⟨fun ⟨h1, _, hne⟩ => h1.resolve_right hne, + fun hf => ⟨Or.inl hf, (π.cellGraph_le c₀ hc₀).edgeSet_subset hf⟩⟩ + · exact inter_eq_self_of_subset_left hle2.edgeSet_subset + have hsep_G₀ : (G.deleteEdges {e}).IsSeparation (π.cellGraph c) (D ∩ (G.deleteEdges {e})) := by + rw [← hA_inter_G₀] + have h1 : A ∩ (G.deleteEdges {e}) ≤ (G.deleteEdges {e}) := inter_le_right hsep_AD.left_le + (deleteEdges_singleton_le G e) + have h2 : D ∩ (G.deleteEdges {e}) ≤ (G.deleteEdges {e}) := inter_le_right hsep_AD.right_le + (deleteEdges_singleton_le G e) + rw [isSeparation_iff_of_le h1 h2] + refine ⟨?_, ?_, ?_⟩ + · change (A.vertexSet ∩ (G.deleteEdges {e}).vertexSet) ∪ (D.vertexSet ∩ + (G.deleteEdges {e}).vertexSet) = (G.deleteEdges {e}).vertexSet + rw [← union_inter_distrib_right, hsep_AD.vertexSet_union] + exact Set.inter_self _ + · change (A.edgeSet ∩ (G.deleteEdges {e}).edgeSet) ∪ (D.edgeSet ∩ (G.deleteEdges {e}).edgeSet) + = (G.deleteEdges {e}).edgeSet + rw [← union_inter_distrib_right, hsep_AD.edgeSet_union, + inter_eq_self_of_subset_right (deleteEdges_singleton_le G e).edgeSet_subset] + · ext f + change (f ∈ A.edgeSet ∧ f ∈ (G.deleteEdges {e}).edgeSet) ∧ (f ∈ D.edgeSet ∧ f ∈ + (G.deleteEdges {e}).edgeSet) ↔ False + have hdisj_f : f ∉ (A ∩ D).edgeSet := hsep_AD.edgeSet_inter_eq ▸ notMem_empty f + change ¬ (f ∈ A.edgeSet ∧ f ∈ D.edgeSet) at hdisj_f + tauto + have hord_G₀ : separationOrder (π.cellGraph c) (D ∩ (G.deleteEdges {e})) < θ := by + rw [← hA_inter_G₀] + have hsub : ((A ∩ (G.deleteEdges {e})) ∩ (D ∩ (G.deleteEdges {e}))).vertexSet ⊆ + (A ∩ D).vertexSet := + fun _ ⟨⟨hA, _⟩, ⟨hD, _⟩⟩ => ⟨hA, hD⟩ + exact (ncard_le_ncard hsub (A ∩ D).vertexSet_finite).trans_lt hord_AD + have hmem_𝒯 : (π.cellGraph c, D ∩ (G.deleteEdges {e})) ∈ 𝒯 := + theorem_4_1_i h𝒯 (hcentral c hc) hsep_G₀ hord_G₀ + exact ⟨D, hsep_AD, hord_AD, by rwa [hA_inter_G₀]⟩ + +private theorem false_of_adjacent_cell_border_paths + {α : Type u} {β : Type v} {G : Hypergraph α β} {e : β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle (G.deleteEdges {e}) θ 𝒯) (hθ : 2 * p + 8 < θ) + (π : Portrayal (G.deleteEdges {e})) (hcentral : π.IsCentral 𝒯) + (hred6 : π.IsRedundant 𝒯 θ 6) (hwarp : π.warp ≤ p) + (hdisj : ∀ n ∈ π.Γ.N ∩ bd π.S, Disjoint (π.borderSet n) (π.nodeVertex '' π.domγ)) + {c c' Θ : Set π.S} (hc : c ∈ π.Γ.C) (hc' : c' ∈ π.Γ.C) (hne_c' : c' ≠ c) + (hΘ : Θ ∈ cuffs π.S) (hcΘ : (c ∩ Θ).Nonempty) + {n₁ n₂ : π.S} (hn₁ : n₁ ∈ tilde c) (hn₂ : n₂ ∈ tilde c) (hne12 : n₁ ≠ n₂) + (hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S) (hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S) + {u₁ u₂ : α} (hu₁_ne_u₂ : u₁ ≠ u₂) + (hu₁_bp₁ : u₁ ∈ π.borderPlus n₁) (hu₂_bp₂ : u₂ ∈ π.borderPlus n₂) + (hu₁_not_bp₂ : u₁ ∉ π.borderPlus n₂) (hu₂_not_bp₁ : u₂ ∉ π.borderPlus n₁) + (hu₁_c : u₁ ∈ (π.cellGraph c).vertexSet) (hu₂_c : u₂ ∈ (π.cellGraph c).vertexSet) + (hu₁_c' : u₁ ∈ (π.cellGraph c').vertexSet) (hu₂_c' : u₂ ∈ (π.cellGraph c').vertexSet) + (hex_bs : u₁ ∈ π.borderSet n₁ ∨ u₂ ∈ π.borderSet n₂) : False := by + classical + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have hbd_c' : (c' ∩ bd π.S).Nonempty := by + by_contra hint_c' + rcases hex_bs with hu₁_bs | hu₂_bs + · obtain ⟨m, ⟨_, hm_dom⟩, hm_eq⟩ := + π.p5 c' hc' hint_c' u₁ hu₁_c' ⟨c, hc, hne_c'.symm, hu₁_c⟩ + exact Set.disjoint_left.mp (hdisj n₁ hn₁_bd) hu₁_bs ⟨m, hm_dom, hm_eq⟩ + · obtain ⟨m, ⟨_, hm_dom⟩, hm_eq⟩ := + π.p5 c' hc' hint_c' u₂ hu₂_c' ⟨c, hc, hne_c'.symm, hu₂_c⟩ + exact Set.disjoint_left.mp (hdisj n₂ hn₂_bd) hu₂_bs ⟨m, hm_dom, hm_eq⟩ + obtain ⟨Θ', hΘ', hc'Θ', htilde_c'_Θ'⟩ := π.Γ.exists_cuff_of_border_cell hc' hbd_c' + have hΘ'_bd : Θ' ⊆ bd π.S := by + rcases hΘ' with ⟨y₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) y₀ + have htilde_c_Θ : tilde c ⊆ π.Γ.N ∩ Θ := (π.Γ.border_cell_subset_cuff hc hΘ hcΘ).2.2.2.1 + have hΘ'_eq_Θ : Θ' = Θ := by + obtain ⟨n', hn'_t, hu₁_bp'⟩ := π.p6 c' hc' hbd_c' u₁ hu₁_c' ⟨c, hc, hne_c'.symm, hu₁_c⟩ + have hn'_Θ' : n' ∈ π.Γ.N ∩ Θ' := htilde_c'_Θ' hn'_t + obtain ⟨Θ₀, hΘ₀, hn₁Θ₀, hn'Θ₀⟩ := π.cuff_eq_of_borderPlus_inter_nonempty + hn₁_bd ⟨hn'_Θ'.1, hΘ'_bd hn'_Θ'.2⟩ hu₁_bp₁ hu₁_bp' + have h1 : Θ₀ = Θ := cuffs_eq_of_nonempty_inter hΘ₀ hΘ ⟨n₁, hn₁Θ₀, (htilde_c_Θ hn₁).2⟩ + have h2 : Θ₀ = Θ' := cuffs_eq_of_nonempty_inter hΘ₀ hΘ' ⟨n', hn'Θ₀, hn'_Θ'.2⟩ + exact h2.symm.trans h1 + have hc'Θ : (c' ∩ Θ).Nonempty := hΘ'_eq_Θ ▸ hc'Θ' + have hΘ_arc : IsOArc Θ := (cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + obtain ⟨E⟩ := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + have hc_range : c ∈ Set.range E.cell := by rw [E.range_cell]; exact ⟨hc, hcΘ⟩ + have hc'_range : c' ∈ Set.range E.cell := by rw [E.range_cell]; exact ⟨hc', hc'Θ⟩ + obtain ⟨j₀, hj₀⟩ := hc_range + obtain ⟨j, hj⟩ := hc'_range + subst hj₀ hj + have hne_j : j ≠ j₀ := fun h => hne_c' (congrArg E.cell h) + have hk0 : 0 < (π.Γ.N ∩ Θ).ncard := Nat.lt_of_lt_of_le (by decide) E.two_le + have hn₁_ends : n₁ = E.node j₀ ∨ n₁ = E.node (cyclicSucc hk0 j₀) := by + have h := hn₁ + rw [E.cell_tilde j₀] at h + rcases h with rfl | h + · exact Or.inl rfl + · exact Or.inr (mem_singleton_iff.mp h) + have hn₂_ends : n₂ = E.node j₀ ∨ n₂ = E.node (cyclicSucc hk0 j₀) := by + have h := hn₂ + rw [E.cell_tilde j₀] at h + rcases h with rfl | h + · exact Or.inl rfl + · exact Or.inr (mem_singleton_iff.mp h) + have hclaim1 : ∀ n ∈ π.Γ.N ∩ Θ, (({u₁, u₂} : Set α) ∩ π.borderPlus n).Nonempty := by + intro n hn + have hn_range : n ∈ Set.range E.node := by rw [E.range_node]; exact hn + rcases hn_range with ⟨i, rfl⟩ + rcases hn₁_ends with hn₁_eq | hn₁_eq <;> rcases hn₂_ends with hn₂_eq | hn₂_eq + · exact False.elim (hne12 (hn₁_eq.trans hn₂_eq.symm)) + · rw [hn₁_eq] at hu₁_bp₁ hu₂_not_bp₁ + rw [hn₂_eq] at hu₂_bp₂ hu₁_not_bp₂ + exact borderPlus_nonempty_of_two_ends_in_other_cell π E hne_j + hu₁_bp₁ hu₁_not_bp₂ hu₂_bp₂ hu₂_not_bp₁ hu₁_c hu₂_c hu₁_c' hu₂_c' i + · rw [hn₁_eq] at hu₁_bp₁ hu₂_not_bp₁ + rw [hn₂_eq] at hu₂_bp₂ hu₁_not_bp₂ + rw [Set.pair_comm] + exact borderPlus_nonempty_of_two_ends_in_other_cell π E hne_j + hu₂_bp₂ hu₂_not_bp₁ hu₁_bp₁ hu₁_not_bp₂ hu₂_c hu₁_c hu₂_c' hu₁_c' i + · exact False.elim (hne12 (hn₁_eq.trans hn₂_eq.symm)) + have hX_sub : ({u₁, u₂} : Set α) ⊆ (G.deleteEdges {e}).vertexSet := by + rintro x (rfl | rfl) + · exact (π.cellGraph_le (E.cell j₀) hc).vertexSet_subset hu₁_c + · exact (π.cellGraph_le (E.cell j₀) hc).vertexSet_subset hu₂_c + have hX_card : 3 * ({u₁, u₂} : Set α).ncard ≤ 6 := by + rw [ncard_pair hu₁_ne_u₂] + have hp_pos : 1 ≤ p := + (theorem_5_1_proof π hcentral (hred6.isZeroRedundant h𝒯) hΘ).trans + ((π.warpAt_le_warp hΘ).trans hwarp) + exact theorem_6_6_proof h𝒯 π hcentral hwarp hred6 (by omega) hΘ + hX_sub hX_card hclaim1 + +private theorem exists_path_not_in_original_cell + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {e : β} + (he : e ∈ G.edgeSet) + (π : Portrayal (G.deleteEdges {e})) + {c : Set π.S} + (hc : c ∈ π.Γ.C) + (hends : G.ends e ⊆ (π.cellGraph c).vertexSet) : + let q₀ : ℕ := π.cellWarp c + ∀ (n₁ : π.S), + ∀ (n₂ : π.S), + ((π.borderSet n₁).ncard ≤ π.cellWarp c ∧ (π.borderSet n₂).ncard ≤ π.cellWarp c ∧ + ((π.borderPlus n₁).ncard = π.cellWarp c + 1 → (π.borderPlus n₂).ncard = π.cellWarp c + 1 → + Portrayal.LinkagePairs (π.cellGraph c).skeleton (π.borderPlus n₁) (π.borderPlus n₂) + (π.cellWarp c + 1) (π.nodeVertex n₁) (π.nodeVertex n₂))) → + ((π.borderPlus n₁).ncard = q₀ + 1) → + ((π.borderPlus n₂).ncard = q₀ + 1) → + ∀ (P : Fin (q₀ + 1) → PathFromTo ((addEdgePortrayal π hc he hends).cellGraph c).skeleton + (π.borderPlus n₁) (π.borderPlus n₂)), + (Pairwise fun i j => Disjoint {z | z ∈ (P i).walk.support} {z | z ∈ (P + j).walk.support}) → + (¬∃ i, (P i).first = π.nodeVertex n₁ ∧ (P i).last = π.nodeVertex n₂) → + ∃ i₀ : Fin (q₀ + 1), ¬∃ w₀ : (π.cellGraph c).skeleton.Walk (P i₀).first (P i₀).last, + w₀.support = (P i₀).walk.support := by + intro q₀ n₁ n₂ hspec hb₁ hb₂ P hP hnot_pair + by_contra! hall_walk + choose w₀ hw₀_sup using hall_walk + let P₀ : Fin (q₀ + 1) → + PathFromTo (π.cellGraph c).skeleton (π.borderPlus n₁) (π.borderPlus n₂) := fun i => + { first := (P i).first + last := (P i).last + walk := w₀ i + isPath := by + rw [SimpleGraph.Walk.isPath_def, hw₀_sup i] + exact (P i).isPath.support_nodup + first_mem := (P i).first_mem + last_mem := (P i).last_mem } + have hP₀_disj : Pairwise fun i j => + Disjoint {z | z ∈ (P₀ i).walk.support} {z | z ∈ (P₀ j).walk.support} := by + intro i j hij + dsimp [P₀] + rw [hw₀_sup i, hw₀_sup j] + exact hP hij + exact hnot_pair (hspec.2.2 hb₁ hb₂ P₀ hP₀_disj) + +/-- The heart of (12.3): adding `e` to the cell `c` does not raise the warp of `c`. The paper's step +"Consequently `c` borders `Θ`" (page 199) uses that `β(n)` misses the image of `γ` for each border +node `n`, which is (9.7) when `π` is true. We take this as a condition, since (12.4) also uses this +result for a portrayal made by (7.2), which need not be true. -/ +theorem addEdgePortrayal_cellWarp {α : Type u} {β : Type v} {G : Hypergraph α β} {e : β} + (he : e ∈ G.edgeSet) (hK : IsClique (G.deleteEdges {e}) (G.ends e)) + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle (G.deleteEdges {e}) θ 𝒯) (hθ : 2 * p + 8 < θ) + (π : Portrayal (G.deleteEdges {e})) (hcentral : π.IsCentral 𝒯) + (hred6 : π.IsRedundant 𝒯 θ 6) (hwarp : π.warp ≤ p) + (hdisj : ∀ n ∈ π.Γ.N ∩ bd π.S, Disjoint (π.borderSet n) (π.nodeVertex '' π.domγ)) + {c : Set π.S} (hc : c ∈ π.Γ.C) (hends : G.ends e ⊆ (π.cellGraph c).vertexSet) + {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (hcΘ : (c ∩ Θ).Nonempty) : + (addEdgePortrayal π hc he hends).cellWarp c = π.cellWarp c := by + classical + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hbd_c : (c ∩ bd π.S).Nonempty := hcΘ.mono (inter_subset_inter_right _ hΘ_bd) + have hsk_le : (π.cellGraph c).skeleton ≤ ((addEdgePortrayal π hc he hends).cellGraph c).skeleton + := by + intro u v ⟨hne, f, hfu, hfv⟩ + refine ⟨hne, f, ?_, ?_⟩ <;> + · dsimp only [addEdgePortrayal, addEdgeCell] + rw [ite_eq_left rfl] + exact Or.inl ‹_› + have hform : ∀ r, (addEdgePortrayal π hc he hends).CellWarpLE c r ↔ ∀ n₁ ∈ tilde c, ∀ n₂ ∈ tilde + c, n₁ ≠ n₂ → + (π.borderSet n₁).ncard ≤ r ∧ (π.borderSet n₂).ncard ≤ r ∧ + ((π.borderPlus n₁).ncard = r + 1 → (π.borderPlus n₂).ncard = r + 1 → + Portrayal.LinkagePairs ((addEdgePortrayal π hc he hends).cellGraph c).skeleton + (π.borderPlus n₁) + (π.borderPlus n₂) (r + 1) (π.nodeVertex n₁) (π.nodeVertex n₂)) := fun _ => Iff.rfl + have hle_iff : ∀ r : ℕ, (addEdgePortrayal π hc he hends).CellWarpLE c r → π.CellWarpLE c r := by + intro r h + rw [hform] at h + intro n₁ hn₁ n₂ hn₂ hne + obtain ⟨h1, h2, h3⟩ := h n₁ hn₁ n₂ hn₂ hne + refine ⟨h1, h2, fun hb₁ hb₂ P hP => ?_⟩ + let P' : Fin (r + 1) → + PathFromTo ((addEdgePortrayal π hc he hends).cellGraph c).skeleton + ((addEdgePortrayal π hc he hends).borderPlus n₁) ((addEdgePortrayal π hc he + hends).borderPlus n₂) := fun i => + { first := (P i).first + last := (P i).last + walk := (P i).walk.map (SimpleGraph.Hom.ofLE hsk_le) + isPath := by + rw [SimpleGraph.Walk.isPath_def, SimpleGraph.Walk.support_map] + exact (P i).isPath.support_nodup.map (fun _ _ h => h) + first_mem := (P i).first_mem + last_mem := (P i).last_mem } + have hP' : Pairwise fun i j => + Disjoint {z | z ∈ (P' i).walk.support} {z | z ∈ (P' j).walk.support} := by + intro i j hij + dsimp [P'] + rw [SimpleGraph.Walk.support_map, SimpleGraph.Walk.support_map, + show (⇑(SimpleGraph.Hom.ofLE hsk_le) : α → α) = id from rfl] + simp only [List.map_id] + exact hP hij + exact h3 hb₁ hb₂ P' hP' + set q₀ := π.cellWarp c + set q := π.warpAt Θ + have hq₀_le_q : q₀ ≤ q := π.cellWarp_le_warpAt hc hcΘ + obtain ⟨u₀, v₀, hne_uv₀, htilde_c, _, _, hu₀_mem, hv₀_mem⟩ := + π.Γ.border_cell_exists_ends hc hbd_c + have hex_le : ∃ r, (addEdgePortrayal π hc he hends).CellWarpLE c r := by + refine ⟨(π.borderSet u₀).ncard + (π.borderSet v₀).ncard + 1, + (hform _).2 fun n₁ hn₁ n₂ hn₂ _ => ?_⟩ + have hn₁' : n₁ ∈ ({u₀, v₀} : Set π.S) := htilde_c ▸ hn₁ + have hn₂' : n₂ ∈ ({u₀, v₀} : Set π.S) := htilde_c ▸ hn₂ + have hb₁_le : (π.borderSet n₁).ncard ≤ (π.borderSet u₀).ncard + (π.borderSet v₀).ncard := by + rcases hn₁' with rfl | rfl <;> omega + have hb₂_le : (π.borderSet n₂).ncard ≤ (π.borderSet u₀).ncard + (π.borderSet v₀).ncard := by + rcases hn₂' with rfl | rfl <;> omega + refine ⟨by omega, by omega, fun hcard₁ _ => ?_⟩ + exfalso + have hn₁_mem : n₁ ∈ π.Γ.N ∩ bd π.S := by rcases hn₁' with rfl | rfl <;> assumption + have hbp_le := π.ncard_borderPlus_le hn₁_mem + change (π.borderPlus n₁).ncard = _ at hcard₁ + omega + have hwarpOrders : {r : ℕ | (addEdgePortrayal π hc he hends).CellWarpLE c r}.Nonempty := hex_le + have hge : q₀ ≤ (addEdgePortrayal π hc he hends).cellWarp c := + Nat.sInf_le (hle_iff ((addEdgePortrayal π hc he hends).cellWarp c) (Nat.sInf_mem hwarpOrders)) + suffices hle_q₀ : (addEdgePortrayal π hc he hends).CellWarpLE c q₀ from + le_antisymm (Nat.sInf_le hle_q₀) hge + refine (hform _).2 ?_ + intro n₁ hn₁ n₂ hn₂ hne12 + have hspec := π.cellWarp_spec hc hbd_c n₁ hn₁ n₂ hn₂ hne12 + refine ⟨hspec.1, hspec.2.1, fun hb₁ hb₂ P hP => ?_⟩ + by_contra hnot_pair + have hn₁' : n₁ ∈ ({u₀, v₀} : Set π.S) := htilde_c ▸ hn₁ + have hn₂' : n₂ ∈ ({u₀, v₀} : Set π.S) := htilde_c ▸ hn₂ + have hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S := by rcases hn₁' with rfl | rfl <;> assumption + have hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S := by rcases hn₂' with rfl | rfl <;> assumption + -- Since `π.CellWarpLE c q₀` holds, some path `P i₀` is not a walk in `(π.cellGraph c).skeleton` + have hex_not_walk : ∃ i₀ : Fin (q₀ + 1), + ¬ ∃ w₀ : (π.cellGraph c).skeleton.Walk (P i₀).first (P i₀).last, + w₀.support = (P i₀).walk.support := by + exact exists_path_not_in_original_cell (α := α) (β := β) (G := G) (e := e) he π (c := c) hc + hends n₁ n₂ hspec hb₁ hb₂ P hP hnot_pair + obtain ⟨i₀, hi₀_not⟩ := hex_not_walk + obtain ⟨v₁, hv₁_sup, v₂, hv₂_sup, hadj', hnot_adj⟩ := + exists_adj_not_adj_of_not_walk (P i₀).walk hi₀_not + have hv_ends : v₁ ≠ v₂ ∧ v₁ ∈ G.ends e ∧ v₂ ∈ G.ends e := by + rcases hadj' with ⟨hne_v, f, hfv₁, hfv₂⟩ + have hno : ∀ {g : β} {v : α}, (π.cellGraph c).Inc g v → g ≠ e := fun h hg => + ((π.cellGraph_le c hc).edgeSet_subset ((π.cellGraph c).edge_mem_of_inc h)).2 + (mem_singleton_iff.2 hg) + dsimp only [addEdgePortrayal, addEdgeCell] at hfv₁ hfv₂ + rw [ite_eq_left rfl] at hfv₁ hfv₂ + rcases hfv₁ with hfv₁ | ⟨hfe, hfv₁⟩ + · rcases hfv₂ with hfv₂ | ⟨hfe, _⟩ + · exact False.elim (hnot_adj ⟨hne_v, f, hfv₁, hfv₂⟩) + · exact False.elim (hno hfv₁ hfe) + · rcases hfv₂ with hfv₂ | ⟨_, hfv₂⟩ + · exact False.elim (hno hfv₂ hfe) + · exact ⟨hne_v, hfe ▸ hfv₁, hfe ▸ hfv₂⟩ + obtain ⟨hne_v, hv₁_e, hv₂_e⟩ := hv_ends + have hv₁_c : v₁ ∈ (π.cellGraph c).vertexSet := hends hv₁_e + have hv₂_c : v₂ ∈ (π.cellGraph c).vertexSet := hends hv₂_e + obtain ⟨_, f', hf'₁, hf'₂⟩ := hK.2 v₁ hv₁_e v₂ hv₂_e hne_v + obtain ⟨c', hc', hf'c'⟩ := π.p1_edge f' ((G.deleteEdges {e}).edge_mem_of_inc hf'₁) + have hv₁_c' : v₁ ∈ (π.cellGraph c').vertexSet := + (π.cellGraph c').vertex_mem_of_inc ((inc_iff_of_le (π.cellGraph_le c' hc') hf'c').mpr hf'₁) + have hv₂_c' : v₂ ∈ (π.cellGraph c').vertexSet := + (π.cellGraph c').vertex_mem_of_inc ((inc_iff_of_le (π.cellGraph_le c' hc') hf'c').mpr hf'₂) + have hne_c' : c' ≠ c := by + intro h + rw [h] at hf'c' + exact hnot_adj ⟨hne_v, f', + (inc_iff_of_le (π.cellGraph_le c hc) hf'c').mpr hf'₁, + (inc_iff_of_le (π.cellGraph_le c hc) hf'c').mpr hf'₂⟩ + have htilde_pair : tilde c = {n₁, n₂} := by + have hsub_pair : ({n₁, n₂} : Set π.S) ⊆ tilde c := by + rintro x (rfl | rfl) <;> assumption + exact (eq_of_subset_of_ncard_le hsub_pair + (by rw [ncard_pair hne12, (π.Γ.border_cell c hc hbd_c).1]) + (π.Γ.finite_tilde_cell hc)).symm + have hv₁_bp12 : v₁ ∈ π.borderPlus n₁ ∪ π.borderPlus n₂ := by + obtain ⟨n, hnt, hbp⟩ := π.p6 c hc hbd_c v₁ hv₁_c ⟨c', hc', hne_c', hv₁_c'⟩ + rcases (htilde_pair ▸ hnt : n ∈ ({n₁, n₂} : Set π.S)) with rfl | rfl + · exact Or.inl hbp + · exact Or.inr hbp + have hv₂_bp12 : v₂ ∈ π.borderPlus n₁ ∪ π.borderPlus n₂ := by + obtain ⟨n, hnt, hbp⟩ := π.p6 c hc hbd_c v₂ hv₂_c ⟨c', hc', hne_c', hv₂_c'⟩ + rcases (htilde_pair ▸ hnt : n ∈ ({n₁, n₂} : Set π.S)) with rfl | rfl + · exact Or.inl hbp + · exact Or.inr hbp + have hbp₁_fin : (π.borderPlus n₁).Finite := π.borderPlus_finite hn₁_bd + have hbp₂_fin : (π.borderPlus n₂).Finite := π.borderPlus_finite hn₂_bd + have hv₁_end : v₁ = (P i₀).first ∨ v₁ = (P i₀).last := by + rcases hv₁_bp12 with h1 | h2 + · exact Or.inl (eq_first_of_mem_support_of_linkage hbp₁_fin hb₁ P hP hv₁_sup h1) + · exact Or.inr (eq_last_of_mem_support_of_linkage hbp₂_fin hb₂ P hP hv₁_sup h2) + have hv₂_end : v₂ = (P i₀).first ∨ v₂ = (P i₀).last := by + rcases hv₂_bp12 with h1 | h2 + · exact Or.inl (eq_first_of_mem_support_of_linkage hbp₁_fin hb₁ P hP hv₂_sup h1) + · exact Or.inr (eq_last_of_mem_support_of_linkage hbp₂_fin hb₂ P hP hv₂_sup h2) + set u₁ := (P i₀).first + set u₂ := (P i₀).last + have hu₁_ne_u₂ : u₁ ≠ u₂ := by + rcases hv₁_end with h1 | h1 <;> rcases hv₂_end with h2 | h2 + · exact False.elim (hne_v (h1.trans h2.symm)) + · exact h1 ▸ h2 ▸ hne_v + · exact h1 ▸ h2 ▸ hne_v.symm + · exact False.elim (hne_v (h1.trans h2.symm)) + have hu_pair : ({u₁, u₂} : Set α) = {v₁, v₂} := by + rcases hv₁_end with h1 | h1 <;> rcases hv₂_end with h2 | h2 + · exact False.elim (hne_v (h1.trans h2.symm)) + · rw [h1, h2] + · rw [h1, h2, Set.pair_comm] + · exact False.elim (hne_v (h1.trans h2.symm)) + have hu₁_bp₁ : u₁ ∈ π.borderPlus n₁ := (P i₀).first_mem + have hu₂_bp₂ : u₂ ∈ π.borderPlus n₂ := (P i₀).last_mem + have hu₁_not_bp₂ : u₁ ∉ π.borderPlus n₂ := fun h => + hu₁_ne_u₂ (eq_last_of_mem_support_of_linkage hbp₂_fin hb₂ P hP + (SimpleGraph.Walk.start_mem_support _) h) + have hu₂_not_bp₁ : u₂ ∉ π.borderPlus n₁ := fun h => + hu₁_ne_u₂.symm (eq_first_of_mem_support_of_linkage hbp₁_fin hb₁ P hP + (SimpleGraph.Walk.end_mem_support _) h) + have hu₁_c : u₁ ∈ (π.cellGraph c).vertexSet := by + have : u₁ ∈ ({v₁, v₂} : Set α) := hu_pair ▸ mem_insert _ _ + rcases this with rfl | rfl <;> assumption + have hu₂_c : u₂ ∈ (π.cellGraph c).vertexSet := by + have : u₂ ∈ ({v₁, v₂} : Set α) := hu_pair ▸ mem_insert_of_mem _ (mem_singleton _) + rcases this with rfl | rfl <;> assumption + have hu₁_c' : u₁ ∈ (π.cellGraph c').vertexSet := by + have : u₁ ∈ ({v₁, v₂} : Set α) := hu_pair ▸ mem_insert _ _ + rcases this with rfl | rfl <;> assumption + have hu₂_c' : u₂ ∈ (π.cellGraph c').vertexSet := by + have : u₂ ∈ ({v₁, v₂} : Set α) := hu_pair ▸ mem_insert_of_mem _ (mem_singleton _) + rcases this with rfl | rfl <;> assumption + -- At least one of `u₁ ∈ π.borderSet n₁` or `u₂ ∈ π.borderSet n₂` holds + have hex_bs : u₁ ∈ π.borderSet n₁ ∨ u₂ ∈ π.borderSet n₂ := by + rcases hu₁_bp₁ with h1 | ⟨_, hEq1⟩ + · exact Or.inl h1 + · rcases hu₂_bp₂ with h2 | ⟨_, hEq2⟩ + · exact Or.inr h2 + · exact False.elim (hnot_pair ⟨i₀, hEq1, hEq2⟩) + -- Deduce `c'` is a border cell bordering `Θ` + exact false_of_adjacent_cell_border_paths (G := G) (e := e) h𝒯 hθ π hcentral hred6 hwarp hdisj + hc hc' hne_c' hΘ hcΘ hn₁ hn₂ hne12 hn₁_bd hn₂_bd hu₁_ne_u₂ hu₁_bp₁ hu₂_bp₂ + hu₁_not_bp₂ hu₂_not_bp₁ hu₁_c hu₂_c hu₁_c' hu₂_c' hex_bs + +theorem addEdgePortrayal_central_resembles + {α : Type u} {β : Type v} {G : Hypergraph α β} {e : β} (he : e ∈ G.edgeSet) + (hK : IsClique (G.deleteEdges {e}) (G.ends e)) + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle (G.deleteEdges {e}) θ 𝒯) (hθ : 2 * p + 8 < θ) + (π : Portrayal (G.deleteEdges {e})) (hcentral : π.IsCentral 𝒯) + (hred : π.IsRedundant 𝒯 θ 6) (hwarp : π.warp ≤ p) + (hdisj : ∀ n ∈ π.Γ.N ∩ bd π.S, Disjoint (π.borderSet n) (π.nodeVertex '' π.domγ)) + {c₀ : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) (hends : G.ends e ⊆ (π.cellGraph c₀).vertexSet) : + (addEdgePortrayal π hc₀ he hends).IsCentral (inducedSubhypergraphTangle G + (G.deleteEdges {e}) 𝒯 θ) ∧ + (addEdgePortrayal π hc₀ he hends).Resembles π := by + classical + refine ⟨addEdgePortrayal_central he h𝒯 (by omega) π hcentral hwarp hc₀ hends, + Homeomorph.refl π.S, fun Θ hΘ => ?_⟩ + refine Eq.trans ?_ (congrArg π.warpAt (image_id Θ).symm) + have hcellWarp_eq : ∀ c ∈ π.Γ.C, (c ∩ Θ).Nonempty → + (addEdgePortrayal π hc₀ he hends).cellWarp c = π.cellWarp c := by + intro c hc hcΘ + by_cases hcc₀ : c = c₀ + · subst hcc₀ + exact addEdgePortrayal_cellWarp he hK h𝒯 hθ π hcentral hred hwarp hdisj hc hends hΘ hcΘ + · have hcellG_c : (addEdgePortrayal π hc₀ he hends).cellGraph c = π.cellGraph c + := ite_eq_right hcc₀ + unfold Portrayal.cellWarp Portrayal.CellWarpLE + rw [hcellG_c] + rfl + change sSup {r : ℕ | ∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ r = (addEdgePortrayal π hc₀ he + hends).cellWarp c} = + sSup {r : ℕ | ∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ r = π.cellWarp c} + congr 1 + ext r + exact ⟨fun ⟨c, hc, hcΘ, hr⟩ => ⟨c, hc, hcΘ, hr.trans (hcellWarp_eq c hc hcΘ)⟩, + fun ⟨c, hc, hcΘ, hr⟩ => ⟨c, hc, hcΘ, hr.trans (hcellWarp_eq c hc hcΘ).symm⟩⟩ + +/-- **Graph Minors XVII, (12.3)** (page 199): "Let $e$ be an edge of a hypergraph $G$, and let $K$ +be the set of ends of $e$. Let $K$ be a clique of $G \setminus e$. Let $\mathscr{T}$ be a tangle in +$G \setminus e$ of order $> 2p+8$, inducing a tangle $\mathscr{T}'$ in $G$. Let $\pi = (\Sigma, +\Gamma, \alpha, \beta, \gamma)$ be a 6-redundant, $\mathscr{T}$-central portrayal of $G \setminus +e$ with warp $\le p$. Let $c_0 \in C(\Gamma)$ with $K \subseteq V(\alpha(c_0))$. Define $\alpha'$ +by $$\begin{aligned} \alpha'(c_0) &= (V(\alpha(c_0)), E(\alpha(c_0)) \cup \{e\}) \\ \alpha'(c) &= +\alpha(c) \qquad (c \in C(\Gamma) - \{c_0\}). \end{aligned}$$ Then $\pi' = (\Sigma, \Gamma, +\alpha', \beta, \gamma)$ is a $\mathscr{T}'$-central portrayal of $G$, resembling $\pi$." Here `π'` +is `addEdgePortrayal`. + +The step "Consequently $c$ borders $\Theta$" of the paper's proof needs the conclusion of (9.7) (no +vertex of $\beta(n)$ is $\gamma$ of a node), which the paper does not cite there; (9.7) is proved +for true, $(2p+3)$-redundant portrayals with $\operatorname{ord}(\mathscr{T}) > 4p+5$. So here $\pi$ +is assumed true and $\max(6, 2p+3)$-redundant with $\theta > \max(2p+8, 4p+5)$. +`addEdgePortrayal_central_resembles` has the printed hypotheses plus the conclusion of (9.7). -/ +theorem theorem_12_3_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} {e : β} (he : e ∈ G.edgeSet) + (hK : IsClique (G.deleteEdges {e}) (G.ends e)) + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle (G.deleteEdges {e}) θ 𝒯) (hθ : max (2 * p + 8) (4 * p + 5) < θ) + (π : Portrayal (G.deleteEdges {e})) (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (max 6 (2 * p + 3))) (hwarp : π.warp ≤ p) + {c₀ : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) (hends : G.ends e ⊆ (π.cellGraph c₀).vertexSet) : + (addEdgePortrayal π hc₀ he hends).IsCentral (inducedSubhypergraphTangle G + (G.deleteEdges {e}) 𝒯 θ) ∧ + (addEdgePortrayal π hc₀ he hends).Resembles π := + addEdgePortrayal_central_resembles he hK h𝒯 (by omega) π htrue.1 (hred.mono (by omega)) hwarp + (fun n hn => (theorem_9_7_proof h𝒯 π htrue + (hred.mono (by omega)) hwarp (by omega) hn).mono_right (image_mono π.domγ_subset)) hc₀ hends + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section12b.lean b/LeanPool/GraphMinor/GM17/Section12b.lean new file mode 100644 index 0000000000..cf18a3faad --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section12b.lean @@ -0,0 +1,113 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section12 +import LeanPool.GraphMinor.GM17.PasteCuff +import LeanPool.GraphMinor.GM17.ArcDisc +import LeanPool.GraphMinor.GM17.MarkCross +import LeanPool.GraphMinor.GM17.ReplaceDisc +import LeanPool.GraphMinor.GM17.RegionDisc +import LeanPool.GraphMinor.GM17.RegionBoundary +import LeanPool.GraphMinor.GM17.CutArcPaint +import LeanPool.GraphMinor.GM17.PushNode +import LeanPool.GraphMinor.GM17.IndentMain +import Mathlib.Data.DFinsupp.WellFounded + +import LeanPool.GraphMinor.GM17.Section8Proved + +import LeanPool.GraphMinor.GM17.Section9bProved + +/-! +# Graph Minors XVII, Section 12: from a portrayal of `G \ e` to a portrayal of `G` + +This file continues Section 12 of Robertson and Seymour, *Graph Minors. XVII. Taming a Vortex*, J. +Combin. Theory Ser. B 77 (1999), 162–210: + +- **(12.4)** (`theorem_12_4`, page 200). +- **(12.5)** (`theorem_12_5`, page 200). + +We also prove that a central portrayal resembling a `z`-redundant one is `z`-redundant, and that +there is a true one among them (`exists_true_resembling`). The paper uses this in the first line of +the proof of (12.4), and at the end of the proofs of (13.4) and (14.2). +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface GraphMinor.GM10 GraphMinor.Hypergraph + +universe u v + +variable {α : Type u} {β : Type v} {G : Hypergraph α β} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + +/-- Redundancy depends only on the warps and the surface, so it passes to a portrayal that +resembles. -/ +theorem Portrayal.IsRedundant.of_resembles {π₁ π₂ : Portrayal G} {θ z : ℕ} (hr : π₁.Resembles π₂) + (h : π₂.IsRedundant 𝒯 θ z) : π₁.IsRedundant 𝒯 θ z := + ⟨h.1, fun Z hZ hc π' hπ' hs => h.2 Z hZ hc π' hπ' (hr.isSimpler_iff.mp hs)⟩ + +/-- Among the central portrayals resembling a redundant `π`, one with least truth is true. Truths +are ordered lexicographically on `ℕ⁶`, which is a well-order. -/ +theorem exists_true_resembling {π : Portrayal G} {θ z : ℕ} (h𝒯 : IsTangle G θ 𝒯) + (hc : π.IsCentral 𝒯) (hred : π.IsRedundant 𝒯 θ z) : + ∃ π' : Portrayal G, π'.IsTrue 𝒯 ∧ π'.Resembles π ∧ π'.IsRedundant 𝒯 θ z := by + let Q : Set (Fin 6 → ℕ) := {t | ∃ π' : Portrayal G, π'.IsCentral 𝒯 ∧ π'.Resembles π ∧ π'.truth + = t} + have hQ : Q.Nonempty := ⟨π.truth, π, hc, Portrayal.Resembles.refl π, rfl⟩ + have hwf : WellFounded (Pi.Lex (· < ·) (· < ·) : (Fin 6 → ℕ) → (Fin 6 → ℕ) → Prop) + := InvImage.wf toLex (wellFounded_lt (α := Lex (Fin 6 → ℕ))) + obtain ⟨t, ⟨π₀, hc₀, hr₀, rfl⟩, hmin⟩ := hwf.has_min Q hQ + refine ⟨π₀, ⟨hc₀, hr₀.isZeroRedundant (hred.isZeroRedundant h𝒯), fun π' hc' htr hr' => ?_⟩, + hr₀, hred.of_resembles hr₀⟩ + obtain ⟨k, h1, h2⟩ := htr + exact hmin π'.truth ⟨π', hc', hr'.trans hr₀, rfl⟩ ⟨k, fun i hi => h1 i hi, h2⟩ + +/-- **Graph Minors XVII, (12.4)** (page 200): "Let $e$ be an edge of a hypergraph $G$, such that the +set of ends of $e$ is a clique of $G \setminus e$. Let $\mathscr{T}$ be a tangle in $G \setminus e$, +of order $>4p+9$, inducing a tangle $\mathscr{T}'$ in $G$. Let $\pi$ be a $(2p+7)$-redundant, +$\mathscr{T}$-central portrayal of $G \setminus e$ with warp $\le p$. Then there is a +$\mathscr{T}'$-central portrayal of $G$ resembling $\pi$." -/ +theorem theorem_12_4_proof {e : β} (he : e ∈ G.edgeSet) (hK : IsClique (G.deleteEdges {e}) + (G.ends e)) + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} (h𝒯 : IsTangle (G.deleteEdges {e}) θ 𝒯) + (hθ : 4 * p + 9 < θ) + (π : Portrayal (G.deleteEdges {e})) (hc : π.IsCentral 𝒯) (hred : π.IsRedundant 𝒯 θ (2 * p + 7)) + (hwarp : π.warp ≤ p) : + ∃ π' : Portrayal G, π'.IsCentral (inducedSubhypergraphTangle G (G.deleteEdges {e}) 𝒯 θ) + ∧ π'.Resembles π := by + obtain ⟨π₁, htrue, hr₁, hred₁⟩ := exists_true_resembling h𝒯 hc hred + have hw₁ : π₁.warp ≤ p := hr₁.warp_eq ▸ hwarp + have hred3 : π₁.IsRedundant 𝒯 θ (2 * p + 3) := hred₁.mono (by omega) + have hθ5 : 4 * p + 5 < θ := by omega + rcases theorem_12_2_proof h𝒯 π₁ htrue hred₁ hw₁ hθ hK with ⟨Δ, hΔ, hsmall, hKΔ, -, hnorm, hcard⟩ + | ⟨c, hc₁, hKc⟩ + · have hdom : π₁.domγ = π₁.Γ.N := + theorem_8_4_proof h𝒯 π₁ htrue hred3 hw₁ hθ5 + obtain ⟨-, -, h82_node⟩ := theorem_8_2_proof h𝒯 π₁ htrue hred3 hw₁ hθ5 + obtain ⟨π₂, -, hc₂, hr₂, ⟨c, hc₂c, hsub⟩, himp, -⟩ := theorem_7_2_cell h𝒯 + (by omega) π₁ htrue.1 hΔ hnorm hcard (fun n hn => h82_node n (π₁.domγ_subset hn.2)) hsmall + have hdisj₁ : ∀ n ∈ π₁.Γ.N ∩ bd π₁.S, Disjoint (π₁.borderSet n) (π₁.nodeVertex '' π₁.domγ) + := fun n hn => + (theorem_9_7_proof h𝒯 π₁ htrue hred3 hw₁ hθ5 hn).mono_right (image_mono π₁.domγ_subset) + have hends : G.ends e ⊆ (π₂.cellGraph c).vertexSet := fun x hx => by + rw [hdom] at hsub + refine hsub ?_ + rcases hKΔ hx with h1 | ⟨n, hn, rfl⟩ + · exact .inl h1 + · exact .inr ⟨n, ⟨hn.1, hn.2⟩, rfl⟩ + have h := addEdgePortrayal_central_resembles he hK h𝒯 (by omega) π₂ hc₂ + ((hred₁.of_resembles hr₂).mono (by omega)) (hr₂.warp_eq ▸ hw₁) (himp hdisj₁) hc₂c hends + exact ⟨_, h.1, h.2.trans (hr₂.trans hr₁)⟩ + · have h := theorem_12_3_proof he hK h𝒯 (by omega) π₁ htrue (hred₁.mono (by omega)) hw₁ hc₁ hKc + exact ⟨_, h.1, h.2.trans hr₁⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section12c.lean b/LeanPool/GraphMinor/GM17/Section12c.lean new file mode 100644 index 0000000000..dcdc78334c --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section12c.lean @@ -0,0 +1,170 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section12b + +/-! +# Graph Minors XVII, Section 12: the embodiment of a tangle + +This file proves (12.5) of Robertson and Seymour, *Graph Minors. XVII. Taming a Vortex*, J. Combin. +Theory Ser. B 77 (1999), 200: from a tangle `𝒯*` in the 1-skeleton `G*` we get a tangle in `G`, +called the embodiment of `𝒯*` in `G`. + +- **(12.5)** (`theorem_12_5`, page 200). +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface GraphMinor.GM10 GraphMinor.Hypergraph + +universe u v + +variable {α : Type u} {β : Type v} + +/-- An edge of `A ≤ G` joins, in `A*`, any two distinct ends it has in `G`. -/ +theorem skeleton_adj_of_mem {G A : Hypergraph α β} (hA : A ≤ G) {e : β} + (he : e ∈ A.edgeSet) {x y : α} + (hx : G.Inc e x) (hy : G.Inc e y) (hne : x ≠ y) : A.skeleton.Adj x y := by + have h := hA.ends_eq e he + have h' : ∀ z, G.Inc e z → A.Inc e z := fun z hz => by + have : z ∈ G.ends e := hz + rw [h] at this + exact this + exact ⟨hne, e, h' x hx, h' y hy⟩ + +/-- `H ≤ G` gives `H* ≤ G*`. -/ +theorem oneSkeleton_le {G A : Hypergraph α β} (hA : A ≤ G) : oneSkeletonHypergraph A + ≤ oneSkeletonHypergraph G := by + have hE : A.skeleton.edgeSet ⊆ G.skeleton.edgeSet := by + intro s hs + induction s using Sym2.ind with + | _ x y => + obtain ⟨hne, e, hx, hy⟩ := (SimpleGraph.mem_edgeSet _).1 hs + have he := A.edge_mem_of_inc hx + have hsub : A.ends e ⊆ G.ends e := by rw [hA.ends_eq e he] + exact (SimpleGraph.mem_edgeSet _).2 ⟨hne, e, hsub hx, hsub hy⟩ + refine ⟨hA.vertexSet_subset, hE, fun s hs => ?_⟩ + ext v + exact ⟨fun h => ⟨hs, h.2⟩, fun h => ⟨hE hs, h.2⟩⟩ + +/-- `(A₁ ∪ A₂ ∪ A₃)* = A₁* ∪ A₂* ∪ A₃*` when the `Aᵢ` are subhypergraphs of `A₁ ∪ A₂ ∪ A₃`. -/ +theorem oneSkeleton_union {G A₁ A₂ A₃ : Hypergraph α β} (h : A₁ ∪ A₂ ∪ A₃ = G) (h₁ : A₁ ≤ G) + (h₂ : A₂ ≤ G) (h₃ : A₃ ≤ G) : + oneSkeletonHypergraph A₁ ∪ oneSkeletonHypergraph A₂ ∪ oneSkeletonHypergraph A₃ + = oneSkeletonHypergraph G := by + have hE : ∀ s, s ∈ G.skeleton.edgeSet → s ∈ A₁.skeleton.edgeSet ∨ s ∈ A₂.skeleton.edgeSet + ∨ s ∈ A₃.skeleton.edgeSet := by + intro s hs + induction s using Sym2.ind with + | _ x y => + obtain ⟨hne, e, hx, hy⟩ := (SimpleGraph.mem_edgeSet _).1 hs + have he : e ∈ (A₁ ∪ A₂ ∪ A₃).edgeSet := h ▸ G.edge_mem_of_inc hx + rcases he with (he | he) | he + · exact .inl ((SimpleGraph.mem_edgeSet _).2 (skeleton_adj_of_mem h₁ he hx hy hne)) + · exact .inr (.inl ((SimpleGraph.mem_edgeSet _).2 (skeleton_adj_of_mem h₂ he hx hy hne))) + · exact .inr (.inr ((SimpleGraph.mem_edgeSet _).2 (skeleton_adj_of_mem h₃ he hx hy hne))) + have hle : ∀ {A : Hypergraph α β}, A ≤ G → A.skeleton.edgeSet ⊆ G.skeleton.edgeSet := fun hA => + (oneSkeleton_le hA).edgeSet_subset + refine Hypergraph.ext ?_ ?_ ?_ + · rw [← h]; rfl + · refine Subset.antisymm ?_ fun s hs => ?_ + · rintro s ((hs | hs) | hs) + exacts [hle h₁ hs, hle h₂ hs, hle h₃ hs] + · rcases hE s hs with hs | hs | hs + exacts [.inl (.inl hs), .inl (.inr hs), .inr hs] + · funext s v + apply propext + constructor + · rintro ((hs | hs) | hs) + exacts [⟨hle h₁ hs.1, hs.2⟩, ⟨hle h₂ hs.1, hs.2⟩, ⟨hle h₃ hs.1, hs.2⟩] + · rintro ⟨hs, hv⟩ + rcases hE s hs with hs | hs | hs + exacts [.inl (.inl ⟨hs, hv⟩), .inl (.inr ⟨hs, hv⟩), .inr ⟨hs, hv⟩] + +/-- Deleting edges keeps a subhypergraph. -/ +theorem deleteEdges_le (G : Hypergraph α β) (F : Set β) : G.deleteEdges F ≤ G := + ⟨subset_rfl, sdiff_subset, fun f hf => by + ext v + exact ⟨fun h => ⟨h, hf.2⟩, fun h => h.1⟩⟩ + +/-- The separation `(A, B \ E(A))` of `G`, made from a separation with `V(A) ∪ V(B) = V(G)`. -/ +theorem isSeparation_deleteEdges {G A B : Hypergraph α β} (hA : A ≤ G) (hB : B ≤ G) + (hV : A.vertexSet ∪ B.vertexSet = G.vertexSet) + (hE : A.edgeSet ∪ B.edgeSet = G.edgeSet) : G.IsSeparation A (B.deleteEdges A.edgeSet) := by + refine (isSeparation_iff_of_le hA ((deleteEdges_le B _).trans hB)).2 ⟨hV, ?_, ?_⟩ + · rw [← hE] + ext e + change e ∈ A.edgeSet ∨ e ∈ B.edgeSet \ A.edgeSet ↔ _ + by_cases h : e ∈ A.edgeSet <;> simp [h] + · ext e + change e ∈ A.edgeSet ∩ (B.edgeSet \ A.edgeSet) ↔ _ + simp + +/-- A separation of `G` covers the edges of `G*`. -/ +theorem edgeSet_oneSkeleton_union {G A B : Hypergraph α β} (hsep : G.IsSeparation A B) : + (oneSkeletonHypergraph A).edgeSet ∪ (oneSkeletonHypergraph B).edgeSet = + (oneSkeletonHypergraph G).edgeSet := by + have hA := oneSkeleton_le hsep.left_le + have hB := oneSkeleton_le hsep.right_le + refine Subset.antisymm (union_subset hA.edgeSet_subset hB.edgeSet_subset) fun t ht => ?_ + induction t using Sym2.ind with + | _ x y => + obtain ⟨hne, e, hx, hy⟩ := (SimpleGraph.mem_edgeSet _).1 ht + have he : e ∈ A.edgeSet ∪ B.edgeSet := hsep.edgeSet_union ▸ G.edge_mem_of_inc hx + rcases he with he | he + · exact .inl ((SimpleGraph.mem_edgeSet _).2 (skeleton_adj_of_mem hsep.left_le he hx hy hne)) + · exact .inr ((SimpleGraph.mem_edgeSet _).2 (skeleton_adj_of_mem hsep.right_le he hx hy hne)) + +/-- A separation `(A, B)` of `G` gives the separation `(A*, B* \ E(A*))` of `G*`, on the same +vertices. -/ +theorem isSeparation_oneSkeleton {G A B : Hypergraph α β} (hsep : G.IsSeparation A B) : + (oneSkeletonHypergraph G).IsSeparation (oneSkeletonHypergraph A) + ((oneSkeletonHypergraph B).deleteEdges (oneSkeletonHypergraph A).edgeSet) := + isSeparation_deleteEdges (oneSkeleton_le hsep.left_le) (oneSkeleton_le hsep.right_le) + hsep.vertexSet_union + (edgeSet_oneSkeleton_union hsep) + +/-- **Graph Minors XVII, (12.5)** (page 200): "Let $G$ be a hypergraph, and let $\mathscr{T}^*$ be a +tangle in $G^*$ of order $\theta$. Let $\mathscr{T}$ be the set of all separations $(A, B)$ of $G$ +of order $<\theta$ such that $A^*$ is small relative to $\mathscr{T}^*$. Then $\mathscr{T}$ is a +tangle in $G$ of order $\theta$." -/ +theorem theorem_12_5_proof {G : Hypergraph α β} {θ : ℕ} {𝒯s : Set (Hypergraph α + (Sym2 α) × Hypergraph α (Sym2 α))} + (h𝒯 : IsTangle (oneSkeletonHypergraph G) θ 𝒯s) : IsTangle G θ (embodimentTangle G 𝒯s θ) := by + refine ⟨h𝒯.one_le, fun _ _ h => h.1, fun _ _ h => h.2.1, ?_, ?_, ?_⟩ + · intro A B hsep hord + have hA := oneSkeleton_le hsep.left_le + have hB := oneSkeleton_le hsep.right_le + have hV : A.vertexSet ∪ B.vertexSet = G.vertexSet := hsep.vertexSet_union + have hE := edgeSet_oneSkeleton_union hsep + have hs₁ := isSeparation_deleteEdges hA hB hV hE + have hs₂ := isSeparation_deleteEdges hB hA + (by rwa [Set.union_comm]) (by rwa [Set.union_comm]) + have ho₁ : separationOrder (oneSkeletonHypergraph A) ((oneSkeletonHypergraph B).deleteEdges + (oneSkeletonHypergraph A).edgeSet) < θ := hord + have ho₂ : separationOrder (oneSkeletonHypergraph B) ((oneSkeletonHypergraph A).deleteEdges + (oneSkeletonHypergraph B).edgeSet) < θ := by + change (B.vertexSet ∩ A.vertexSet).ncard < θ + rw [Set.inter_comm]; exact hord + rcases h𝒯.axiom1 hs₁ ho₁ with h | h + · exact .inl ⟨hsep, hord, _, h⟩ + · have hord' : separationOrder B A < θ := by + change (B.vertexSet ∩ A.vertexSet).ncard < θ + rw [Set.inter_comm]; exact hord + exact .inr ⟨hsep.symm, hord', _, GM10.theorem_2_9_proof h𝒯 h hs₂ ho₂ (.inr (.inl subset_rfl))⟩ + · rintro A₁ B₁ A₂ B₂ A₃ B₃ ⟨hs₁, -, C₁, h₁⟩ ⟨hs₂, -, C₂, h₂⟩ ⟨hs₃, -, C₃, h₃⟩ hG + exact h𝒯.axiom2 h₁ h₂ h₃ (oneSkeleton_union hG hs₁.left_le hs₂.left_le hs₃.left_le) + · rintro A B ⟨-, -, C, h⟩ hV + exact h𝒯.axiom3 h hV + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section12d.lean b/LeanPool/GraphMinor/GM17/Section12d.lean new file mode 100644 index 0000000000..f1cd869614 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section12d.lean @@ -0,0 +1,273 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.ReEdge + +/-! +# Graph Minors XVII, Section 12: from a portrayal of `G*` to a portrayal of `G` + +This file proves (12.6) of Robertson and Seymour, *Graph Minors. XVII. Taming a Vortex*, J. Combin. +Theory Ser. B 77 (1999), 200. + +- **(12.6)** (`theorem_12_6`, page 200). + +The proof adds the edges of `G` to `G*` one at a time, by (12.4). The hypergraph `G ∪ G*` of the +paper is `mixGraph G E(G)`, whose edges are in `β ⊕ Sym2 α`. + +At the end we delete the edges of `G*`. The paper says only that this gives a portrayal resembling +`π`, but a deletion can lower a warp. We show that it does not: `G*` can be put back by +`Portrayal.exists_moved`, so a lower warp would give a central portrayal of `G*` simpler than `π`. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface GraphMinor.GM10 GraphMinor.Hypergraph + +universe u v + +variable {α : Type u} {β : Type v} + +/-- Hypergraphs with the same vertices and 1-skeleton have the same `G*`. -/ +theorem oneSkeleton_eq_of_skeleton_eq {b₁ b₂ : Type*} {A : Hypergraph α b₁} {B : Hypergraph α b₂} + (hV : A.vertexSet = B.vertexSet) (h : A.skeleton = B.skeleton) : + oneSkeletonHypergraph A = oneSkeletonHypergraph B := by + refine Hypergraph.ext hV (by change A.skeleton.edgeSet = B.skeleton.edgeSet; rw [h]) ?_ + funext s v + apply propext + change (s ∈ A.skeleton.edgeSet ∧ v ∈ s) ↔ (s ∈ B.skeleton.edgeSet ∧ v ∈ s) + rw [h] + +section Embodiment + +variable {b : Type*} {H : Hypergraph α b} {R : Hypergraph α (Sym2 α)} {θ : ℕ} + {𝒯s : Set (Hypergraph α (Sym2 α) × Hypergraph α (Sym2 α))} + +theorem embodiment_isTangle (hH : oneSkeletonHypergraph H = R) (h𝒯 : IsTangle R θ 𝒯s) : + IsTangle H θ (embodimentTangle H 𝒯s θ) := + theorem_12_5_proof (hH ▸ h𝒯) + +/-- If `A*` is small, then the separation of `G*` made from `(A, B)` is in `𝒯*`. -/ +theorem skeleton_mem_of_embodiment (hH : oneSkeletonHypergraph H = R) + (h𝒯 : IsTangle R θ 𝒯s) {A B : Hypergraph α b} + (h : (A, B) ∈ embodimentTangle H 𝒯s θ) : + (oneSkeletonHypergraph A, (oneSkeletonHypergraph B).deleteEdges (oneSkeletonHypergraph + A).edgeSet) ∈ 𝒯s := by + subst hH + obtain ⟨hs, ho, C, hC⟩ := h + exact GM10.theorem_2_9_proof h𝒯 hC (isSeparation_oneSkeleton hs) ho (.inr (.inl subset_rfl)) + +/-- A separation of `H` of small order whose left side lies on the vertices of a member of `𝒯*` is +in the embodiment. -/ +theorem embodiment_mem (hH : oneSkeletonHypergraph H = R) (h𝒯 : IsTangle R θ 𝒯s) {A D : Hypergraph + α b} + (hs : H.IsSeparation A D) (ho : separationOrder A D < θ) {A₀ B₀ : Hypergraph α (Sym2 α)} (hm : + (A₀, B₀) ∈ 𝒯s) + (hsub : A.vertexSet ⊆ A₀.vertexSet) : (A, D) ∈ embodimentTangle H 𝒯s θ := by + subst hH + exact ⟨hs, ho, _, GM10.theorem_2_9_proof h𝒯 hm (isSeparation_oneSkeleton hs) ho (.inr + (.inl hsub))⟩ + +/-- A member of a quotient of the embodiment lies on the vertices of a member of the same quotient +of `𝒯*`. -/ +theorem embodiment_quotient_dom (hH : oneSkeletonHypergraph H = R) (h𝒯 : IsTangle R θ 𝒯s) {Z : Set + α} {A B : Hypergraph α b} + (h : (A, B) ∈ quotientTangle H (embodimentTangle H 𝒯s θ) Z) : + ∃ A' B', (A', B') ∈ quotientTangle R 𝒯s Z ∧ A.vertexSet ⊆ A'.vertexSet := by + obtain ⟨-, ⟨A₀, B₀⟩, hm, hZ, h1, h2⟩ := h + have hm' := skeleton_mem_of_embodiment hH h𝒯 hm + have hs := h𝒯.isSeparation hm' + dsimp only at h1 h2 hZ + subst h1 h2 + exact ⟨_, _, ⟨GM10.IsSeparation.quotientVertices hs Z, _, hm', hZ, rfl, rfl⟩, subset_rfl⟩ + +end Embodiment + +/-- The hypergraph `G_i` of the paper: the vertices of `G`, the edges of `X`, and the edges of `G*`. +-/ +@[expose] def mixGraph (G : Hypergraph α β) (X : Set β) : Hypergraph α (β ⊕ Sym2 α) where + vertexSet := G.vertexSet + edgeSet := Sum.inl '' (X ∩ G.edgeSet) ∪ Sum.inr '' G.skeleton.edgeSet + Inc e v := Sum.elim (fun e => e ∈ X ∧ G.Inc e v) (fun s => s ∈ G.skeleton.edgeSet ∧ v ∈ s) e + vertex_mem_of_inc := by + rintro (e | s) v h + · exact G.vertex_mem_of_inc h.2 + · exact (oneSkeletonHypergraph G).vertex_mem_of_inc (e := s) h + edge_mem_of_inc := by + rintro (e | s) v h + · exact .inl ⟨e, ⟨h.1, G.edge_mem_of_inc h.2⟩, rfl⟩ + · exact .inr ⟨s, h.1, rfl⟩ + vertexSet_finite := G.vertexSet_finite + edgeSet_finite := ((G.edgeSet_finite.subset inter_subset_right).image _).union + ((oneSkeletonHypergraph G).edgeSet_finite.image _) + +theorem mixGraph_skeleton (G : Hypergraph α β) (X : Set β) : (mixGraph G X).skeleton = G.skeleton + := by + ext x y + constructor + · rintro ⟨hne, (e | s), hx, hy⟩ + · exact ⟨hne, e, hx.2, hy.2⟩ + · have hs : s = s(x, y) := ((Sym2.mem_and_mem_iff hne).1 ⟨hx.2, hy.2⟩) + subst hs + exact (SimpleGraph.mem_edgeSet _).1 hx.1 + · intro h + have hm : s(x, y) ∈ G.skeleton.edgeSet := (SimpleGraph.mem_edgeSet _).2 h + exact ⟨h.1, .inr s(x, y), ⟨hm, Sym2.mem_mk_left _ _⟩, ⟨hm, Sym2.mem_mk_right _ _⟩⟩ + +theorem mixGraph_oneSkeleton (G : Hypergraph α β) (X : Set β) : + oneSkeletonHypergraph (mixGraph G X) = oneSkeletonHypergraph G := + oneSkeleton_eq_of_skeleton_eq rfl (mixGraph_skeleton G X) + +/-- Deleting the new edge `x` from `G_{i}` gives `G_{i-1}`. -/ +theorem mixGraph_deleteEdges (G : Hypergraph α β) {X : Set β} {x : β} (hx : x ∉ X) : + (mixGraph G (insert x X)).deleteEdges {Sum.inl x} = mixGraph G X := by + refine Hypergraph.ext rfl ?_ ?_ + · ext e + constructor + · rintro ⟨(⟨f, ⟨hf, hfE⟩, rfl⟩ | ⟨s, hs, rfl⟩), hne⟩ + · rcases hf with rfl | hf + · exact absurd rfl hne + · exact .inl ⟨f, ⟨hf, hfE⟩, rfl⟩ + · exact .inr ⟨s, hs, rfl⟩ + · rintro (⟨f, ⟨hf, hfE⟩, rfl⟩ | ⟨s, hs, rfl⟩) + · refine ⟨.inl ⟨f, ⟨.inr hf, hfE⟩, rfl⟩, ?_⟩ + rintro h + rw [mem_singleton_iff, Sum.inl_injective.eq_iff] at h + exact hx (h ▸ hf) + · exact ⟨.inr ⟨s, hs, rfl⟩, by simp⟩ + · funext e v + apply propext + rcases e with e | s + · change ((e ∈ insert x X ∧ G.Inc e v) ∧ Sum.inl e ∉ ({Sum.inl x} : Set (β ⊕ Sym2 α))) ↔ (e ∈ X + ∧ G.Inc e v) + constructor + · rintro ⟨⟨h1 | h1, h2⟩, h3⟩ + · exact absurd (by rw [h1]; rfl) h3 + · exact ⟨h1, h2⟩ + · rintro ⟨h1, h2⟩ + refine ⟨⟨.inr h1, h2⟩, ?_⟩ + rintro h + rw [mem_singleton_iff, Sum.inl_injective.eq_iff] at h + exact hx (h ▸ h1) + · change ((s ∈ G.skeleton.edgeSet ∧ v ∈ s) ∧ Sum.inr s ∉ ({Sum.inl x} : Set (β ⊕ Sym2 α))) ↔ + (s ∈ G.skeleton.edgeSet ∧ v ∈ s) + simp + +/-- (12.4), with `G \ e` named `G₀`. -/ +theorem theorem_12_4_of_eq {b : Type*} {H G₀ : Hypergraph α b} {e : b} (he : e ∈ H.edgeSet) + (hG₀ : H.deleteEdges {e} = G₀) + (hK : IsClique G₀ (H.ends e)) {𝒯 : Set (Hypergraph α b × Hypergraph α b)} {θ p : ℕ} + (h𝒯 : IsTangle G₀ θ 𝒯) + (hθ : 4 * p + 9 < θ) (π : Portrayal G₀) (hc : π.IsCentral 𝒯) (hred : π.IsRedundant 𝒯 θ + (2 * p + 7)) (hwarp : π.warp ≤ p) : + ∃ π' : Portrayal H, π'.IsCentral (inducedSubhypergraphTangle H G₀ 𝒯 θ) ∧ π'.Resembles π := by + subst hG₀ + exact theorem_12_4_proof he hK h𝒯 hθ π hc hred hwarp + +/-- A central portrayal of `H`, with warps at most those of a redundant `π` of `G*`, resembles `π`. +Otherwise, moving it to `G*` gives a central portrayal simpler than `π`. -/ +theorem resembles_of_warpLE {b : Type*} {G : Hypergraph α β} {H : Hypergraph α b} {θ p : ℕ} + {𝒯s : Set (Hypergraph α (Sym2 α) × Hypergraph α (Sym2 α))} (hH : oneSkeletonHypergraph H + = oneSkeletonHypergraph G) + (h𝒯 : IsTangle (oneSkeletonHypergraph G) θ 𝒯s) (hθ : max 3 (2 * p + 2) < θ) {π : Portrayal + (oneSkeletonHypergraph G)} + (hred : π.IsRedundant 𝒯s θ (2 * p + 7)) {π₁ : Portrayal H} (hc₁ : π₁.IsCentral + (embodimentTangle H 𝒯s θ)) + (hw₁ : π₁.warp ≤ p) (hl : π₁.WarpLE π) : π₁.Resembles π := by + obtain ⟨ψ, hψ⟩ := id hl + rcases Portrayal.resembles_or_isSimpler_of_warpAt_le ψ hψ with h | h + · exact h + exfalso + have hV : (oneSkeletonHypergraph G).vertexSet = H.vertexSet := (congrArg Hypergraph.vertexSet + hH).symm + obtain ⟨π₂, hc₂, hl₂⟩ := π₁.exists_moved (H₂ := oneSkeletonHypergraph G) hV + (π₁.cells_nonempty (embodiment_isTangle hH h𝒯)) (hH ▸ edgesCovered_oneSkeleton H) (θ₂ := θ) (𝒯₂ + := 𝒯s) + (fun c hc => by have := π₁.ncard_cell_inter_other_le hw₁ hc; omega) + (fun c hc A D hs ho hVA => by + obtain ⟨B, hB⟩ := hc₁ c hc + exact GM10.theorem_2_9_proof h𝒯 (skeleton_mem_of_embodiment hH h𝒯 hB) hs ho (.inr + (.inl hVA.subset))) + exact hred.isZeroRedundant h𝒯 π₂ hc₂ (hl₂.trans_isSimpler h) + +/-- **Graph Minors XVII, (12.6)** (page 200): "Let $G$ be a hypergraph, and let $\mathscr{T}^*$ be a +tangle in $G^*$ of order $>4p+9$. Let $\mathscr{T}$ be the embodiment of $\mathscr{T}^*$ in $G$. Let +$\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a $(2p+7)$-redundant, $\mathscr{T}^*$-central +portrayal of $G^*$ with warp $\le p$. Then there is a $\mathscr{T}$-central portrayal of $G$ +resembling $\pi$." -/ +theorem theorem_12_6_proof {G : Hypergraph α β} {θ p : ℕ} {𝒯s : Set (Hypergraph α + (Sym2 α) × Hypergraph α (Sym2 α))} + (h𝒯 : IsTangle (oneSkeletonHypergraph G) θ 𝒯s) (hθ : 4 * p + 9 < θ) (π : Portrayal + (oneSkeletonHypergraph G)) + (hc : π.IsCentral 𝒯s) (hred : π.IsRedundant 𝒯s θ (2 * p + 7)) (hwarp : π.warp ≤ p) : + ∃ π' : Portrayal G, π'.IsCentral (embodimentTangle G 𝒯s θ) ∧ π'.Resembles π := by + have hp : 1 ≤ p := π.one_le_warp.trans hwarp + have hmax : max 3 (2 * p + 2) = 2 * p + 2 := by omega + have hstage : ∀ X (π₁ : Portrayal (mixGraph G X)), π₁.Resembles π → π₁.IsRedundant + (embodimentTangle (mixGraph G X) 𝒯s θ) θ (2 * p + 7) := by + intro X π₁ hr + refine Portrayal.IsRedundant.of_moved (embodiment_isTangle (mixGraph_oneSkeleton G X) h𝒯) h𝒯 + (by omega) rfl ?_ (by omega) hred hwarp hr.warpLE + fun Z _ _ A B h _ => embodiment_quotient_dom (mixGraph_oneSkeleton G X) h𝒯 h + exact mixGraph_oneSkeleton G X ▸ edgesCovered_oneSkeleton (mixGraph G X) + have hmain : ∀ X : Set β, X.Finite → X ⊆ G.edgeSet → ∃ π₁ : Portrayal (mixGraph G X), + π₁.IsCentral (embodimentTangle (mixGraph G X) 𝒯s θ) ∧ π₁.Resembles π := by + intro X hX + induction X, hX using Set.Finite.induction_on with + | empty => + intro _ + obtain ⟨π₁, hc₁, hl₁⟩ := π.exists_moved (H₂ := mixGraph G ∅) (θ₂ := θ) rfl + (π.cells_nonempty h𝒯) + (by + rintro _ (⟨f, ⟨hf, -⟩, rfl⟩ | ⟨s, hs, rfl⟩) + · exact absurd hf (notMem_empty f) + · exact .inl ⟨s, hs, fun v hv => hv⟩) + (fun c hc' => by have := π.ncard_cell_inter_other_le hwarp hc'; omega) + (fun c hc' A D hs ho hVA => by + obtain ⟨B, hB⟩ := hc c hc' + exact embodiment_mem (mixGraph_oneSkeleton G ∅) h𝒯 hs ho hB hVA.subset) + exact ⟨π₁, hc₁, resembles_of_warpLE (p := p) (mixGraph_oneSkeleton G ∅) h𝒯 + (by omega) hred hc₁ (hl₁.warp_le.trans hwarp) hl₁⟩ + | @insert x X hxX _ ih => + intro hsub + obtain ⟨π₀, hc₀, hr₀⟩ := ih ((subset_insert _ _).trans hsub) + have he : (Sum.inl x : β ⊕ Sym2 α) ∈ (mixGraph G (insert x X)).edgeSet := + .inl ⟨x, ⟨mem_insert _ _, hsub (mem_insert _ _)⟩, rfl⟩ + have hK : IsClique (mixGraph G X) ((mixGraph G (insert x X)).ends (Sum.inl x)) := + ⟨fun v hv => G.vertex_mem_of_inc hv.2, fun u hu v hv hne => by + rw [mixGraph_skeleton] + exact ⟨hne, x, hu.2, hv.2⟩⟩ + obtain ⟨π', hc', hr'⟩ := theorem_12_4_of_eq he (mixGraph_deleteEdges G hxX) hK + (embodiment_isTangle (mixGraph_oneSkeleton G X) h𝒯) hθ π₀ hc₀ (hstage X π₀ hr₀) + (hr₀.warp_eq ▸ hwarp) + refine ⟨π', fun c hcc => ?_, hr'.trans hr₀⟩ + obtain ⟨D, hs, ho, hm⟩ := hc' c hcc + obtain ⟨C, hC⟩ := hm.2.2 + have hVsub : (π'.cellGraph c).vertexSet ⊆ (oneSkeletonHypergraph + (π'.cellGraph c ∩ mixGraph G X)).vertexSet := + fun v hv => ⟨hv, (π'.cellGraph_le c hcc).vertexSet_subset hv⟩ + exact ⟨D, embodiment_mem (mixGraph_oneSkeleton G _) h𝒯 hs ho hC hVsub⟩ + obtain ⟨π₁, hc₁, hr₁⟩ := hmain _ G.edgeSet_finite subset_rfl + have hw₁ : π₁.warp ≤ p := hr₁.warp_eq ▸ hwarp + have hH := mixGraph_oneSkeleton G G.edgeSet + obtain ⟨π', hc', hl'⟩ := π₁.exists_moved (H₂ := G) (θ₂ := θ) rfl (π₁.cells_nonempty + (embodiment_isTangle hH h𝒯)) + (fun e he => .inl ⟨.inl e, .inl ⟨e, ⟨he, he⟩, rfl⟩, fun v hv => ⟨he, hv⟩⟩) + (fun c hc' => by have := π₁.ncard_cell_inter_other_le hw₁ hc'; omega) + (fun c hc' A D hs ho hVA => by + obtain ⟨B, hB⟩ := hc₁ c hc' + exact embodiment_mem rfl h𝒯 hs ho (skeleton_mem_of_embodiment hH h𝒯 hB) hVA.subset) + have hl : π'.WarpLE π := hl'.trans hr₁.warpLE + exact ⟨π', hc', resembles_of_warpLE (p := p) rfl h𝒯 (by omega) hred hc' + (hl.warp_le.trans hwarp) hl⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section13Proved.lean b/LeanPool/GraphMinor/GM17/Section13Proved.lean new file mode 100644 index 0000000000..073d228f5b --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section13Proved.lean @@ -0,0 +1,152 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section13d +public import LeanPool.GraphMinor.Surface.DrawCarry + +import LeanPool.GraphMinor.GM17.Section8Proved + +/-! +# Graph Minors XVII, (13.4) + +(13.4) follows the paper's proof (page 207): a planar `H` is handled by (13.1) directly; otherwise +`a*`, `b*` are chosen with `2a* + b*` maximum such that `H` cannot be drawn in `Σ(a*, b*, 0)`, and +`q = 4a* + 2b* + q₀`. That maximum exists because `H` can be drawn in `Σ(a, b, c)` once `a` or `b` +is +large (`GM20.Draw.exists_canBeDrawn`). +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface GraphMinor.GM10 GraphMinor.Hypergraph + +universe u v + +variable {α : Type u} {β : Type v} + +/-- **Graph Minors XVII, (13.4)** (page 206): "For any graph $H$ and standard $\sigma$, there are +numbers $p, q, z$ and $\theta > z$, such that for every graph $G$ and every tangle $\mathscr{T}$ in +$G$ of order $\ge \theta$, either (i) $\mathscr{T}$ controls an $H$-minor of $G$, or (ii) there +exists $Z \subseteq V(G)$ with $|Z| \le z$, and a $(\mathscr{T} \setminus Z)$-central portrayal $\pi += (\Sigma, \Gamma, \alpha, \beta, \gamma)$ of $G \setminus Z$ with warp $\le p$, such that $\Sigma$ +has $\le q$ cuffs, $H$ cannot be drawn in $\Sigma$, and $\pi$ is $\sigma(\Sigma, p, |Z|)$-redundant +and true." -/ +theorem theorem_13_4_proof {α' β' : Type} (H : Hypergraph α' β') (hH : H.IsGraph) + (σ : (S : Type) → [TopologicalSpace S] → ℕ → ℕ → ℕ) (hσ : IsStandard σ) : + ∃ p q z θ : ℕ, z < θ ∧ ∀ {α : Type u} {β : Type v} (G : Hypergraph α β), G.IsGraph → ∀ (θ' : ℕ) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)), IsTangle G θ' 𝒯 → θ ≤ θ' → + ControlsMinor G 𝒯 H ∨ ∃ Z ⊆ G.vertexSet, Z.ncard ≤ z ∧ ∃ π : Portrayal (G.deleteVertices Z), + π.warp ≤ p ∧ (cuffs π.S).encard ≤ q ∧ ¬ CanBeDrawn π.S H ∧ π.IsTrue + (deleteVerticesTangle G Z 𝒯 θ') ∧ + π.IsRedundant (deleteVerticesTangle G Z 𝒯 θ') (θ' - Z.ncard) (σ π.S p Z.ncard) := by + classical + obtain ⟨p₀, q₀, z₀, θ₀, hz₀, h1⟩ := GraphMinor.GM17.theorem_13_1_proof.{u, v} H hH + -- "If $H$ is planar, let $p, q, z, \theta$ be as in (13.1); then the theorem is satisfied (for + -- (13.1)(ii) cannot hold since $H$ is planar)." + by_cases hplanar : CanBeDrawn (SurfaceModel 0 0 0) H + · refine ⟨p₀, q₀, z₀, θ₀, hz₀, ?_⟩ + intro α β G hG θ' 𝒯 h𝒯 hθ + rcases h1 G hG θ' 𝒯 h𝒯 hθ with hctrl | ⟨Z₀, -, -, π₀, -, -, -, hdr₀⟩ + · exact .inl hctrl + · exfalso + obtain ⟨a₀, b₀, c₀, ⟨e₀⟩⟩ := classification π₀.S π₀.isSurface π₀.connected + have : T2Space π₀.S := π₀.isSurface.2.1 + have : T2Space (SurfaceModel a₀ b₀ c₀) := e₀.symm.isEmbedding.t2Space + exact hdr₀ (GM20.Draw.CanBeDrawn.map e₀.symm + (canBeDrawn_of_le hH (Nat.zero_le a₀) (Nat.zero_le b₀) hplanar)) + -- "Choose $a^*, b^* \ge 0$ with $2a^* + b^*$ maximum so that $H$ cannot be drawn in + -- $\Sigma(a^*, b^*, 0)$." The maximum exists, since `H` can be drawn when `a` or `b` is large. + obtain ⟨L, hL⟩ := GM20.Draw.exists_canBeDrawn H hH + have hsmall : ∀ a b : ℕ, ¬ CanBeDrawn (SurfaceModel a b 0) H → 2 * a + b < 3 * L + 1 := by + intro a b hn + have : T2Space (SurfaceModel a b 0) := (isSurface_model a b 0).1.2.1 + by_contra hlt + exact hn (hL a b 0 (by omega)) + let Pm : ℕ → Prop := fun n => ∃ a b : ℕ, 2 * a + b = n ∧ ¬ CanBeDrawn (SurfaceModel a b 0) H + have hP0 : Pm 0 := ⟨0, 0, rfl, hplanar⟩ + let m := Nat.findGreatest Pm (3 * L) + obtain ⟨aS, bS, hmS, -⟩ : Pm m := Nat.findGreatest_spec (P := Pm) (Nat.zero_le _) hP0 + have hmax : ∀ a b : ℕ, ¬ CanBeDrawn (SurfaceModel a b 0) H → 2 * a + b ≤ 2 * aS + bS := by + intro a b hn + have hle : 2 * a + b ≤ m := + Nat.le_findGreatest (P := Pm) (by have := hsmall a b hn; omega) ⟨a, b, rfl, hn⟩ + omega + set p := max p₀ 1 with hpdef + have hp : 1 ≤ p := le_max_right _ _ + -- "Let $q = 4a^* + 2b^* + q_0$, and let $h = p(q^2 + q_0)$." + set q := 4 * aS + 2 * bS + q₀ with hq + obtain ⟨θ₁, z, hz, hzz, h3⟩ := theorem_13_3_proof.{u, v} σ hσ hp (q ^ 2 * p + q₀ * p) z₀ + refine ⟨p, q, z, max θ₀ θ₁, lt_max_of_lt_right hz, ?_⟩ + intro α β G hG θ' 𝒯 h𝒯 hθ + rcases h1 G hG θ' 𝒯 h𝒯 ((le_max_left _ _).trans hθ) with hctrl | ⟨Z₀, hZ₀, hc₀, π₀, hcen₀, hw₀, + hcu₀, hdr₀⟩ + · exact .inl hctrl + refine .inr ?_ + have hθ₁ : θ₁ ≤ θ' := (le_max_right _ _).trans hθ + obtain ⟨a₀, b₀, c₀, ⟨e₀⟩⟩ := classification π₀.S π₀.isSurface π₀.connected + have hc₀c : c₀ ≤ q₀ := by + have h₁ := ncard_cuffs_of_homeo e₀ + have h₂ : ((cuffs π₀.S).ncard : ℕ∞) = (cuffs π₀.S).encard := π₀.finite_cuffs.cast_ncard_eq + rw [← h₂, h₁] at hcu₀ + exact_mod_cast hcu₀ + -- $H$ cannot be drawn in $\Sigma(a_0, b_0, 0)$, since it cannot be drawn in $\Sigma_0$, and so + -- $2a_0 + b_0 \le 2a^* + b^*$ by the choice of $a^*, b^*$. + have hab : 2 * a₀ + b₀ ≤ 2 * aS + bS := by + refine hmax a₀ b₀ fun hd => ?_ + have : T2Space π₀.S := π₀.isSurface.2.1 + have : T2Space (SurfaceModel a₀ b₀ c₀) := e₀.symm.isEmbedding.t2Space + exact hdr₀ (GM20.Draw.CanBeDrawn.map e₀.symm (canBeDrawn_of_le hH le_rfl le_rfl hd)) + -- "$4a_0 + 2b_0 + c_0 \le 4a^* + 2b^* + q_0 = q$" + have hrank₀ : 4 * a₀ + 2 * b₀ + c₀ ≤ q := by omega + have hh : π₀.hp p ≤ q ^ 2 * p + q₀ * p := by + rw [π₀.hp_eq p e₀] + have h₁ := π₀.totalCuffWarp_le (p := p) (hw₀.trans (le_max_left _ _)) (ncard_cuffs_of_homeo e₀) + have h₂ : (4 * a₀ + 2 * b₀ + c₀) ^ 2 * p ≤ q ^ 2 * p := Nat.mul_le_mul_right _ + (Nat.pow_le_pow_left hrank₀ 2) + have h₃ : c₀ * p ≤ q₀ * p := Nat.mul_le_mul_right _ hc₀c + omega + obtain ⟨Z, -, hZ, hcZ, π, hcen, hrel, hred⟩ := h3 G hG θ' 𝒯 h𝒯 hθ₁ Z₀ hZ₀ hc₀ π₀ hcen₀ (hw₀.trans + (le_max_left _ _)) hh + have hzθ : Z.ncard < θ' := by omega + have ht := GM10.theorem_8_5_proof hG h𝒯 hZ hzθ + obtain ⟨π', htrue, hres, hred'⟩ := exists_true_resembling ht hcen hred + obtain ⟨a, b, c, ⟨e⟩⟩ := classification π.S π.isSurface π.connected + have hstep : (4 * a + 2 * b + c ≤ q) ∧ ¬ CanBeDrawn π.S H := by + rcases hrel with hs | hs + · rcases hs with ⟨hS, -⟩ | ⟨ψ, -, -⟩ + · refine ⟨?_, fun hd => hdr₀ (hS.canBeDrawn hH hd)⟩ + obtain ⟨a₁, b₁, c₁, a₂, b₂, c₂, ⟨e₁⟩, ⟨e₂⟩, -, -, hlt⟩ := hS + have h₁ := model_rank_eq e e₁ + have h₂ := model_rank_eq e₀ e₂ + omega + · exact ⟨by rwa [model_rank_eq e (ψ.trans e₀)], + fun hd => hdr₀ (GM20.Draw.CanBeDrawn.map ψ hd)⟩ + · obtain ⟨ψ, -⟩ := hs + exact ⟨by rwa [model_rank_eq e (ψ.trans e₀)], + fun hd => hdr₀ (GM20.Draw.CanBeDrawn.map ψ hd)⟩ + obtain ⟨ψ', -⟩ := id hres + have hwarp : π'.warp ≤ p := by + rw [hres.warp_eq] + rcases hrel with hs | hs + · exact hs.warp_le.trans (hw₀.trans (le_max_left _ _)) + · rw [hs.warp_eq] + exact hw₀.trans (le_max_left _ _) + refine ⟨Z, hZ, hcZ, π', hwarp, ?_, fun hd => hstep.2 (GM20.Draw.CanBeDrawn.map ψ' hd), htrue, ?_⟩ + · have h₁ := ncard_cuffs_of_homeo (ψ'.trans e) + rw [← π'.finite_cuffs.cast_ncard_eq, h₁] + have : c ≤ q := by omega + exact_mod_cast this + · rw [hσ π'.S π.S p Z.ncard π'.isSurface π'.connected π.isSurface π.connected ⟨ψ'⟩] + exact hred' + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section13a.lean b/LeanPool/GraphMinor/GM17/Section13a.lean new file mode 100644 index 0000000000..bcc9104a82 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section13a.lean @@ -0,0 +1,123 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section12d +import LeanPool.GraphMinor.Surface.ModelCriterion + +/-! +# Graph Minors XVII, Section 13: the complexity of a portrayal + +This file proves (13.2) of Robertson and Seymour, *Graph Minors. XVII. Taming a Vortex*, J. Combin. +Theory Ser. B 77 (1999), 205. We read the number `4a + 2b + c` from the model criterion, and the +number of cuffs is `c`. + +- **(13.2)** (`theorem_13_2`, page 205). +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface GraphMinor.GM10 GraphMinor.Hypergraph + +universe u v u' v' + +/-- The number of cuffs of a surface homeomorphic to `Σ(a, b, c)` is `c`. -/ +theorem ncard_cuffs_of_homeo {S : Type} [TopologicalSpace S] {a b c : ℕ} + (e : S ≃ₜ SurfaceModel a b c) : (cuffs S).ncard = c := by + obtain ⟨ht, f, hf⟩ := presents_ew a b c + let := ht + rw [ncard_cuffs_congr e] + exact ncard_cuffs hf + +/-- The number `4a + 2b + c` depends only on the surface. -/ +theorem model_rank_eq {S : Type} [TopologicalSpace S] {a b c a' b' c' : ℕ} + (e : S ≃ₜ SurfaceModel a b c) (e' : S ≃ₜ SurfaceModel a' b' c') : + 4 * a + 2 * b + c = 4 * a' + 2 * b' + c' := by + obtain ⟨h3, h4, -⟩ := (modelCriterion.2 a b c a' b' c').mp ⟨e.symm.trans e'⟩ + omega + +variable {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} {G : Hypergraph α β} {G' : + Hypergraph α' β'} + +theorem Portrayal.hp_eq (p : ℕ) (π : Portrayal G) {a b c : ℕ} (e : π.S ≃ₜ SurfaceModel a b c) : + π.hp p = (4 * a + 2 * b + c) ^ 2 * p + π.totalCuffWarp := by + have h : sInf {k : ℕ | ∃ a b c : ℕ, Nonempty (π.S ≃ₜ SurfaceModel a b c) ∧ 4 * a + 2 * b + c = k} + = 4 * a + 2 * b + c := by + refine le_antisymm (Nat.sInf_le ⟨a, b, c, ⟨e⟩, rfl⟩) (le_csInf ⟨_, a, b, c, ⟨e⟩, rfl⟩ ?_) + rintro _ ⟨a', b', c', ⟨e'⟩, rfl⟩ + exact (model_rank_eq e e').le + unfold Portrayal.hp + simp only [h] + +theorem Portrayal.finite_cuffs (π : Portrayal G) : (cuffs π.S).Finite := + (cuff_statement.{0} π.S π.isSurface).2.1 + +theorem Portrayal.totalCuffWarp_eq (π : Portrayal G) : π.totalCuffWarp + = ∑ Θ ∈ π.finite_cuffs.toFinset, π.warpAt Θ := by + unfold Portrayal.totalCuffWarp + rw [dite_eq_left π.finite_cuffs] + +theorem Portrayal.totalCuffWarp_le (π : Portrayal G) {p c : ℕ} (hw : π.warp ≤ p) (hc : + (cuffs π.S).ncard = c) : π.totalCuffWarp ≤ c * p := by + rw [π.totalCuffWarp_eq] + refine (Finset.sum_le_card_nsmul _ _ p fun Θ hΘ => ?_).trans ?_ + · exact (π.warpAt_le_warp (π.finite_cuffs.mem_toFinset.1 hΘ)).trans hw + · rw [smul_eq_mul, ← Set.ncard_eq_toFinset_card _ π.finite_cuffs, hc] + +/-- **Graph Minors XVII, (13.2)** (page 205): "Let $p \ge 1$, and let $\pi$, $\pi'$ be portrayals of +$G$, $G'$ respectively. If $\pi$ has warp $\le p$, and $\pi'$ is simpler than $\pi$, then $h_p(\pi') +< h_p(\pi)$." -/ +theorem theorem_13_2_proof {p : ℕ} (hp : 1 ≤ p) (π : Portrayal G) (π' : Portrayal G') (hw : π.warp + ≤ p) (hs : π'.IsSimpler π) : + π'.hp p < π.hp p := by + rcases hs with ⟨hS, hle⟩ | ⟨ψ, hle, Θ₀, hΘ₀, hlt⟩ + · obtain ⟨a', b', c', a, b, c, ⟨e'⟩, ⟨e⟩, -, -, hrk⟩ := hS + rw [π'.hp_eq p e', π.hp_eq p e] + have hr' := π'.totalCuffWarp_le (hle.trans hw) (ncard_cuffs_of_homeo e') + set g' := 4 * a' + 2 * b' + c' + set g := 4 * a + 2 * b + c + have hc' : c' ≤ g' := by omega + have h1 : c' * p ≤ g' * p := Nat.mul_le_mul_right p hc' + have h2 : g' + 1 ≤ g := hrk + have h3 : g' * g' + g' < g * g := by nlinarith + have h4 : (g' * g' + g' + 1) * p ≤ (g * g) * p := Nat.mul_le_mul_right p h3 + have hpos : 0 < p := hp + have h5 : g' ^ 2 * p + c' * p < g ^ 2 * p := by nlinarith + omega + · obtain ⟨a, b, c, ⟨e⟩⟩ := classification π.S π.isSurface π.connected + rw [π'.hp_eq p (ψ.trans e), π.hp_eq p e, π'.totalCuffWarp_eq, π.totalCuffWarp_eq] + refine Nat.add_lt_add_left ?_ _ + have hinj : Set.InjOn (fun Θ : Set π'.S => ψ '' Θ) (cuffs π'.S) := fun _ _ _ _ h + => ψ.injective.image_injective h + have him : (fun Θ : Set π'.S => ψ '' Θ) '' cuffs π'.S = cuffs π.S := by + refine Subset.antisymm ?_ fun Φ hΦ => + ⟨ψ.symm '' Φ, image_cuff_mem_cuffs ψ.symm hΦ, by ext x; simp⟩ + rintro _ ⟨Θ, hΘ, rfl⟩ + exact image_cuff_mem_cuffs ψ hΘ + have hsum : ∑ Φ ∈ π.finite_cuffs.toFinset, π.warpAt Φ = ∑ Θ ∈ π'.finite_cuffs.toFinset, + π.warpAt (ψ '' Θ) := by + symm + refine Finset.sum_bij (fun Θ _ => ψ '' Θ) ?_ ?_ ?_ fun _ _ => rfl + · intro Θ hΘ + exact π.finite_cuffs.mem_toFinset.2 (image_cuff_mem_cuffs ψ (π'.finite_cuffs.mem_toFinset.1 + hΘ)) + · intro Θ _ Θ' _ h + exact ψ.injective.image_injective h + · intro Φ hΦ + exact ⟨ψ.symm '' Φ, + π'.finite_cuffs.mem_toFinset.2 + (image_cuff_mem_cuffs ψ.symm (π.finite_cuffs.mem_toFinset.1 hΦ)), by ext x; simp⟩ + rw [hsum] + exact Finset.sum_lt_sum (fun Θ hΘ => hle Θ (π'.finite_cuffs.mem_toFinset.1 hΘ)) ⟨Θ₀, + π'.finite_cuffs.mem_toFinset.2 hΘ₀, hlt⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section13b.lean b/LeanPool/GraphMinor/GM17/Section13b.lean new file mode 100644 index 0000000000..767e71ee6a --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section13b.lean @@ -0,0 +1,274 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section13a +public import LeanPool.GraphMinor.GM10.Section8 +import LeanPool.GraphMinor.Surface.AddCrosscap + +import LeanPool.GraphMinor.GM17.Section8Proved + +/-! +# Graph Minors XVII, Section 13: raising redundancy + +This file proves (13.3) of Robertson and Seymour, *Graph Minors. XVII. Taming a Vortex*, J. Combin. +Theory Ser. B 77 (1999), 162-210. + +- **(13.3)** (`theorem_13_3`, page 205). + +The proof is by induction on `h`. If `π₀` is not redundant, then `π₀` has a simpler portrayal after +a few more vertices are moved to `Z`, and (13.2) says that `h_p` falls. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface GraphMinor.GM10 GraphMinor.Hypergraph + +universe u v + +/-- "Simpler than" for surfaces is transitive. The middle surface may come with two different +models, and the model criterion moves crosscap pairs to handles on the last surface so that the +first model still fits. -/ +theorem isSimplerThan_trans {X Y W : Type} [TopologicalSpace X] [TopologicalSpace Y] + [TopologicalSpace W] + (h : IsSimplerThan X Y) (h' : IsSimplerThan Y W) : IsSimplerThan X W := by + obtain ⟨a, b, c, a₁, b₁, c₁, hX, ⟨e₁⟩, h1, h2, h3⟩ := h + obtain ⟨a₂, b₂, c₂, a₃, b₃, c₃, ⟨e₂⟩, ⟨e₃⟩, h4, h5, h6⟩ := h' + obtain ⟨h7, h8, h9⟩ := (modelCriterion.2 a₁ b₁ c₁ a₂ b₂ c₂).mp ⟨e₁.symm.trans e₂⟩ + obtain ha | ha := le_total a₁ a₂ + · obtain ⟨j, rfl⟩ := Nat.exists_eq_add_of_le ha + have hb₁ : b₁ = b₂ + 2 * j := by omega + obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le h4 + have hc : (a₁ + j + k - j : ℕ) = a₁ + k := by omega + obtain ⟨f⟩ := (modelCriterion.2 (a₁ + j + k) b₃ c₃ (a₁ + k) (b₃ + 2 * j) c₃).mpr + ⟨rfl, by omega, by + constructor + · intro hb + obtain rfl : j = 0 := by_contra fun hj => by have := h9.mp (by omega); omega + omega + · intro hb; omega⟩ + exact ⟨a, b, c, a₁ + k, b₃ + 2 * j, c₃, hX, ⟨e₃.trans f⟩, by omega, by omega, by omega⟩ + · obtain ⟨j, rfl⟩ := Nat.exists_eq_add_of_le ha + have hb₂ : b₂ = b₁ + 2 * j := by omega + obtain ⟨k, hk⟩ := Nat.exists_eq_add_of_le h5 + obtain ⟨f⟩ := (modelCriterion.2 a₃ (b₁ + 2 * j + k) c₃ (a₃ + j) (b₁ + k) c₃).mpr + ⟨rfl, by omega, by + constructor + · intro hb; omega + · intro hb + obtain rfl : j = 0 := by_contra fun hj => by have := h9.mpr (by omega); omega + omega⟩ + subst hb₂ hk + exact ⟨a, b, c, a₃ + j, b₁ + k, c₃, hX, ⟨e₃.trans f⟩, by omega, by omega, by omega⟩ + +variable {α : Type u} {β : Type v} + +theorem isSimpler_trans {a₀ a₁ a₂ b₀ b₁ b₂ : Type*} {G₀ : Hypergraph a₀ b₀} {G₁ : Hypergraph a₁ b₁} + {G₂ : Hypergraph a₂ b₂} + {π₀ : Portrayal G₀} {π₁ : Portrayal G₁} {π₂ : Portrayal G₂} (h : π₀.IsSimpler π₁) + (h' : π₁.IsSimpler π₂) : π₀.IsSimpler π₂ := by + rcases h' with ⟨hs', hle'⟩ | ⟨ψ, hle, hex⟩ + · rcases h with ⟨hs, hle⟩ | ⟨ψ, hle, -⟩ + · exact .inl ⟨isSimplerThan_trans hs hs', hle.trans hle'⟩ + · exact Portrayal.WarpLE.trans_isSimpler ⟨ψ, hle⟩ (.inl ⟨hs', hle'⟩) + · exact h.trans_warpLE ⟨ψ, hle⟩ + +/-- A separation stays one after deleting vertices. -/ +theorem isSeparation_deleteVertices {G A B : Hypergraph α β} (hs : G.IsSeparation A B) (Z : Set α) : + (G.deleteVertices Z).IsSeparation (A.deleteVertices Z) (B.deleteVertices Z) := by + have hle : ∀ {C : Hypergraph α β}, C ≤ G → C.deleteVertices Z ≤ G.deleteVertices Z := by + intro C hC + have hI : ∀ e ∈ C.edgeSet, ∀ v, G.Inc e v ↔ C.Inc e v := fun e he v => by + have h := hC.ends_eq e he + exact Set.ext_iff.1 h v + refine ⟨fun v hv => ⟨hC.vertexSet_subset hv.1, hv.2⟩, ?_, ?_⟩ + · rintro e ⟨he, hn⟩ + exact ⟨hC.edgeSet_subset he, fun v hv hi => hn v hv ((hI e he v).1 hi)⟩ + · rintro e ⟨he, hn⟩ + ext v + exact ⟨fun h => ⟨(hI e he v).1 h.1, hn⟩, fun h => ⟨(hI e he v).2 h.1, + fun w hw hi => hn w hw ((hI e he w).1 hi)⟩⟩ + refine (isSeparation_iff_of_le (hle hs.left_le) (hle hs.right_le)).2 ⟨?_, ?_, ?_⟩ + · change (A.vertexSet \ Z) ∪ (B.vertexSet \ Z) = G.vertexSet \ Z + rw [← Set.union_sdiff_distrib, hs.vertexSet_union] + · ext e + constructor + · rintro (⟨he, hn⟩ | ⟨he, hn⟩) + · exact (hle hs.left_le).edgeSet_subset ⟨he, hn⟩ + · exact (hle hs.right_le).edgeSet_subset ⟨he, hn⟩ + · rintro ⟨he, hn⟩ + have hI : ∀ {C : Hypergraph α β}, C ≤ G → e ∈ C.edgeSet → ∀ v, ¬ C.Inc e v ∨ G.Inc e v := by + intro C hC hec v + by_cases h : C.Inc e v + · exact .inr (Set.ext_iff.1 (hC.ends_eq e hec) v |>.2 h) + · exact .inl h + have heU : e ∈ A.edgeSet ∪ B.edgeSet := hs.edgeSet_union ▸ he + rcases heU with h | h + · exact .inl ⟨h, fun v hv hi => hn v hv ((hI hs.left_le h v).resolve_left (not_not.2 hi))⟩ + · exact .inr ⟨h, fun v hv hi => hn v hv ((hI hs.right_le h v).resolve_left (not_not.2 hi))⟩ + · ext e + constructor + · rintro ⟨h1, h2⟩ + have : e ∈ (A ∩ B).edgeSet := ⟨h1.1, h2.1⟩ + rw [hs.edgeSet_inter_eq] at this + exact this + · exact fun h => absurd h (notMem_empty e) + +theorem separationOrder_deleteVertices {A B : Hypergraph α β} {Z : Set α} (hZ : Z ⊆ + (A ∩ B).vertexSet) : + separationOrder (A.deleteVertices Z) (B.deleteVertices Z) + Z.ncard = separationOrder A B := by + change ((A.vertexSet \ Z) ∩ (B.vertexSet \ Z)).ncard + Z.ncard = (A.vertexSet ∩ B.vertexSet).ncard + have e : (A.vertexSet \ Z) ∩ (B.vertexSet \ Z) = (A.vertexSet ∩ B.vertexSet) \ Z := by + ext v; simp only [mem_inter_iff, mem_sdiff]; tauto + rw [e] + exact Set.ncard_sdiff_add_ncard_of_subset hZ (A.vertexSet_finite.inter_of_left _) + +/-- One step of the proof of (13.3): if `π₀` is not `s`-redundant, then a simpler central portrayal +exists after moving at most `s` more vertices into `Z₀`. The paper notes that `(G \ Z₀) / Y` and `G +\ (Z₀ ∪ Y)` differ only by edges with at most one end; we pass between them by +`Portrayal.exists_moved`. -/ +theorem descent_step {G : Hypergraph α β} (hG : G.IsGraph) {θ' p s : ℕ} {𝒯 : Set + (Hypergraph α β × Hypergraph α β)} + (h𝒯 : IsTangle G θ' 𝒯) {Z₀ : Set α} (hZ₀ : Z₀ ⊆ G.vertexSet) (hbound : Z₀.ncard + s + max 3 + (2 * p + 2) < θ') + (π₀ : Portrayal (G.deleteVertices Z₀)) (hw : π₀.warp ≤ p) + (hnot : ¬ π₀.IsRedundant (deleteVerticesTangle G Z₀ 𝒯 θ') (θ' - Z₀.ncard) s) : + ∃ Z, Z₀ ⊆ Z ∧ Z ⊆ G.vertexSet ∧ Z.ncard ≤ Z₀.ncard + s ∧ ∃ π : Portrayal (G.deleteVertices Z), + π.IsCentral (deleteVerticesTangle G Z 𝒯 θ') ∧ π.IsSimpler π₀ := by + have hlt : s < θ' - Z₀.ncard := by omega + have ht₀ := GM10.theorem_8_5_proof hG h𝒯 hZ₀ (by omega) + simp only [Portrayal.IsRedundant, not_and, not_forall, not_not] at hnot + obtain ⟨Y, hY, hYc, π', hc', hs'⟩ := hnot hlt + have hYV : Y ⊆ G.vertexSet := fun v hv => (hY hv).1 + have hdisjunion : Z₀ ⊆ Z₀ ∪ Y := subset_union_left + have hcard : (Z₀ ∪ Y).ncard ≤ Z₀.ncard + s := (ncard_union_le _ _).trans (by omega) + have hsub : Z₀ ∪ Y ⊆ G.vertexSet := union_subset hZ₀ hYV + have ht₁ := GM10.theorem_8_5_proof hG h𝒯 hsub (by omega) + have hw' : π'.warp ≤ p := hs'.warp_le.trans hw + have hV : (G.deleteVertices (Z₀ ∪ Y)).vertexSet = (quotientVertices + (G.deleteVertices Z₀) Y).vertexSet := by + change G.vertexSet \ (Z₀ ∪ Y) = (G.vertexSet \ Z₀) \ Y + rw [Set.sdiff_sdiff] + have hcov : EdgesCovered (G.deleteVertices (Z₀ ∪ Y)) (quotientVertices (G.deleteVertices Z₀) Y) + := by + rintro e ⟨he, hn⟩ + have hn₀ : ∀ v ∈ Z₀, ¬ G.Inc e v := fun v hv => hn v (.inl hv) + refine .inl ⟨e, ⟨he, hn₀⟩, ?_⟩ + rintro v ⟨hi, hn'⟩ + exact ⟨⟨hi, hn₀⟩, fun hv => hn' v (.inr hv) hi⟩ + obtain ⟨π, hc, hl⟩ := π'.exists_moved (H₂ := G.deleteVertices (Z₀ ∪ Y)) (θ₂ := θ' - + (Z₀ ∪ Y).ncard) (𝒯₂ := deleteVerticesTangle G (Z₀ ∪ Y) 𝒯 θ') hV + (π'.cells_nonempty (theorem_4_2_proof ht₀ hY (by omega))) hcov + (fun c hc => by have := π'.ncard_cell_inter_other_le hw' hc; omega) + (fun c hc A D hs ho hVA => by + obtain ⟨B, hB⟩ := hc' c hc + obtain ⟨-, ⟨A₁, B₁⟩, ⟨-, -, ⟨A₂, B₂⟩, hm₂, hZ, h3, h4⟩, hYs, h1, h2⟩ := hB + dsimp only at h1 h2 h3 h4 hZ hYs + subst h3 h4 + have hVc : (π'.cellGraph c).vertexSet = (A₂.vertexSet \ Z₀) \ Y := by rw [← h1]; rfl + have hZ' : Z₀ ∪ Y ⊆ (A₂ ∩ B₂).vertexSet := + union_subset hZ fun v hv => ⟨(hYs hv).1.1, (hYs hv).2.1⟩ + have hsep := isSeparation_deleteVertices (h𝒯.isSeparation hm₂) (Z₀ ∪ Y) + have hord := separationOrder_deleteVertices hZ' + have hlt₂ := h𝒯.order_lt hm₂ + have hm : (A₂.deleteVertices (Z₀ ∪ Y), B₂.deleteVertices (Z₀ ∪ Y)) ∈ deleteVerticesTangle G + (Z₀ ∪ Y) 𝒯 θ' := + ⟨hsep, by dsimp only; omega, ⟨A₂, B₂⟩, hm₂, hZ', rfl, rfl⟩ + refine GM10.theorem_2_9_proof ht₁ hm hs ho (.inr (.inl ?_)) + rw [hVA, hVc] + rintro v ⟨⟨h5, h6⟩, h7⟩ + exact ⟨h5, fun h => h.elim h6 h7⟩) + exact ⟨Z₀ ∪ Y, hdisjunion, hsub, hcard, π, hc, hl.trans_isSimpler hs'⟩ + +/-- An upper bound on `σ(Σ, p, z')` over the surfaces `Σ` with `h_p ≤ h` and over `z' ≤ z`. There +are finitely many such surfaces, as the paper says, since `p ≥ 1`. -/ +noncomputable def sigmaBound (σ : (S : Type) → [TopologicalSpace S] → ℕ → ℕ → ℕ) (p h z : ℕ) : ℕ := + (Finset.range (h + 1) ×ˢ Finset.range (h + 1) ×ˢ Finset.range (h + 1) ×ˢ Finset.range (z + 1)).sup + fun t => σ (SurfaceModel t.1 t.2.1 t.2.2.1) p t.2.2.2 + +theorem le_sigmaBound {σ : (S : Type) → [TopologicalSpace S] → ℕ → ℕ → ℕ} + (hσ : IsStandard σ) {p h z z' : ℕ} (hp : 1 ≤ p) + {G : Hypergraph α β} (π : Portrayal G) (hh : π.hp p ≤ h) (hz : z' ≤ z) : σ π.S p z' + ≤ sigmaBound σ p h z := by + obtain ⟨a, b, c, ⟨e⟩⟩ := classification π.S π.isSurface π.connected + rw [π.hp_eq p e] at hh + set g := 4 * a + 2 * b + c + have h1 : g ≤ g ^ 2 * p := by + nlinarith [Nat.le_self_pow (n := 2) (by norm_num) g, Nat.zero_le (g ^ 2)] + have hg : g ≤ h := by omega + have hs : IsSurface (SurfaceModel a b c) := isSurface_of_homeo e π.isSurface + have hco : ConnectedSpace (SurfaceModel a b c) := by + have := π.connected + exact e.surjective.connectedSpace e.continuous + rw [hσ π.S (SurfaceModel a b c) p z' π.isSurface π.connected hs hco ⟨e⟩] + have hm : (a, b, c, z') ∈ Finset.range (h + 1) ×ˢ Finset.range (h + 1) ×ˢ Finset.range + (h + 1) ×ˢ Finset.range (z + 1) := by + simp only [Finset.mem_product, Finset.mem_range] + omega + exact Finset.le_sup (f := fun t : ℕ × ℕ × ℕ × ℕ => σ (SurfaceModel t.1 t.2.1 t.2.2.1) p t.2.2.2) + hm + +/-- **Graph Minors XVII, (13.3)** (page 205): "For any standard $\sigma$ and all $p \ge 1$ and $h$, +$z_0 \ge 0$, there exist $\theta$, $z$ with $\theta > z \ge z_0$ and with the following property. +Let $\mathcal{T}$ be a tangle of order $\ge \theta$ in a graph $G$, let $Z_0 \subseteq V(G)$ with +$|Z_0| \le z_0$, and let $\pi_0$ be a $(\mathcal{T} \setminus Z_0)$-central portrayal of $G +\setminus Z_0$ with warp $\le p$ and with $h_p(\pi_0) \le h$. Then there exist $Z \subseteq V(G)$ +with $Z_0 \subseteq Z$ such that $|Z| \le z$, and a $(\mathcal{T} \setminus Z)$-central portrayal +$\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ of $G \setminus Z$, such that $\pi$ is simpler than +or resembles $\pi_0$, and $\pi$ is $\sigma(\Sigma, p, |Z|)$-redundant." + +We read a bound on all `σ` from `sigmaBound`, so the paper's reduction to its condition (1) is not +needed. -/ +theorem theorem_13_3_proof (σ : (S : Type) → [TopologicalSpace S] → ℕ → ℕ → ℕ) + (hσ : IsStandard σ) {p : ℕ} (hp : 1 ≤ p) (h z₀ : ℕ) : + ∃ θ z : ℕ, z < θ ∧ z₀ ≤ z ∧ ∀ {α : Type u} {β : Type v} (G : Hypergraph α β), G.IsGraph → ∀ + (θ' : ℕ) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)), IsTangle G θ' 𝒯 → θ ≤ θ' + → ∀ Z₀ ⊆ G.vertexSet, Z₀.ncard ≤ z₀ → + ∀ π₀ : Portrayal (G.deleteVertices Z₀), π₀.IsCentral (deleteVerticesTangle G Z₀ 𝒯 θ') + → π₀.warp ≤ p → π₀.hp p ≤ h → + ∃ Z, Z₀ ⊆ Z ∧ Z ⊆ G.vertexSet ∧ Z.ncard ≤ z ∧ ∃ π : Portrayal (G.deleteVertices Z), + π.IsCentral (deleteVerticesTangle G Z 𝒯 θ') ∧ (π.IsSimpler π₀ ∨ π.Resembles π₀) ∧ + π.IsRedundant (deleteVerticesTangle G Z 𝒯 θ') (θ' - Z.ncard) (σ π.S p Z.ncard) := by + induction h generalizing z₀ with + | zero => + set M := sigmaBound σ p 0 z₀ + refine ⟨z₀ + M + max 3 (2 * p + 2) + 1, z₀, by omega, le_rfl, ?_⟩ + intro α β G hG θ' 𝒯 h𝒯 hθ Z₀ hZ₀ hcard π₀ hc hw hh + have hs : σ π₀.S p Z₀.ncard ≤ M := le_sigmaBound hσ hp π₀ hh hcard + by_cases hred : π₀.IsRedundant (deleteVerticesTangle G Z₀ 𝒯 θ') (θ' - Z₀.ncard) + (σ π₀.S p Z₀.ncard) + · exact ⟨Z₀, subset_rfl, hZ₀, hcard, π₀, hc, .inr (Portrayal.Resembles.refl π₀), hred⟩ + · exfalso + obtain ⟨Z, -, -, -, π, -, hsimp⟩ := descent_step hG h𝒯 hZ₀ (by omega) π₀ hw hred + have := theorem_13_2_proof hp π₀ π hw hsimp + omega + | succ h ih => + set M := sigmaBound σ p (h + 1) z₀ + obtain ⟨θ₁, z, hz, hz₀, hmain⟩ := ih (z₀ + M) + refine ⟨max θ₁ (z₀ + M + max 3 (2 * p + 2) + 1), z, by omega, by omega, ?_⟩ + intro α β G hG θ' 𝒯 h𝒯 hθ Z₀ hZ₀ hcard π₀ hc hw hh + have hs : σ π₀.S p Z₀.ncard ≤ M := le_sigmaBound hσ hp π₀ hh hcard + by_cases hred : π₀.IsRedundant (deleteVerticesTangle G Z₀ 𝒯 θ') (θ' - Z₀.ncard) + (σ π₀.S p Z₀.ncard) + · exact ⟨Z₀, subset_rfl, hZ₀, by omega, π₀, hc, .inr (Portrayal.Resembles.refl π₀), hred⟩ + · obtain ⟨Z₁, h01, hZ₁, hc₁, π₁, hcen₁, hsimp⟩ := descent_step hG h𝒯 hZ₀ (by omega) π₀ hw hred + have hdrop := theorem_13_2_proof hp π₀ π₁ hw hsimp + obtain ⟨Z, h1Z, hZ, hcZ, π, hcen, hrel, hredZ⟩ := hmain G hG θ' 𝒯 h𝒯 (by omega) Z₁ hZ₁ + (by omega) π₁ hcen₁ + (hsimp.warp_le.trans hw) (by omega) + refine ⟨Z, h01.trans h1Z, hZ, hcZ, π, hcen, .inl ?_, hredZ⟩ + rcases hrel with hr | hr + · exact isSimpler_trans hr hsimp + · exact hr.warpLE.trans_isSimpler hsimp + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section13c.lean b/LeanPool/GraphMinor/GM17/Section13c.lean new file mode 100644 index 0000000000..ae9a43797c --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section13c.lean @@ -0,0 +1,52 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section13b +public import LeanPool.GraphMinor.Surface.DrawCarry + +/-! +# Graph Minors XVII, Section 13: a redundant portrayal + +This file states (13.1) of Robertson and Seymour, *Graph Minors. XVII. Taming a Vortex*, J. Combin. +Theory Ser. B 77 (1999), 162-210, for graphs. The refinement (13.4) is proved in `Section13Proved`. + +- `Theorem131Statement`: the statement of (13.1) (page 202), for graphs. + +(13.4) is proved in `Section13Proved` by the paper's argument, with `a*`, `b*` as on page 207. Truth +comes from `exists_true_resembling`. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface GraphMinor.GM10 GraphMinor.Hypergraph + +universe u v + +/-- **Graph Minors XVII, (13.1)** (page 202), for graphs: "For any graph $H$ there are numbers $p$, +$q$, $z$ and $\theta > z$, such that for every hypergraph $G$ and every tangle $\mathcal{T}$ in $G$ +of order $\ge \theta$, either (i) $\mathcal{T}$ controls an $H$-minor of $G^*$, or (ii) there exists +$Z \subseteq V(G)$ with $|Z| \le z$ and a $\mathcal{T} \setminus Z$-central portrayal $\pi = +(\Sigma, \Gamma, \alpha, \beta, \gamma)$ of $G \setminus Z$ with warp $\le p$, such that $\Sigma$ +has $\le q$ cuffs and $H$ cannot be drawn in $\Sigma$." + +The paper says "hypergraph", but its proof starts from "every graph", and (13.4) and (14.2) use it +only for graphs. -/ +@[expose] def Theorem131Statement : Prop := + ∀ {α' β' : Type} (H : Hypergraph α' β'), H.IsGraph → + ∃ p q z θ : ℕ, z < θ ∧ ∀ {α : Type u} {β : Type v} (G : Hypergraph α β), G.IsGraph → ∀ (θ' : ℕ) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)), IsTangle G θ' 𝒯 → θ ≤ θ' → + ControlsMinor G 𝒯 H ∨ ∃ Z ⊆ G.vertexSet, Z.ncard ≤ z ∧ ∃ π : Portrayal (G.deleteVertices Z), + π.IsCentral (deleteVerticesTangle G Z 𝒯 θ') ∧ π.warp ≤ p ∧ (cuffs π.S).encard ≤ q + ∧ ¬ CanBeDrawn π.S H + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section13d.lean b/LeanPool/GraphMinor/GM17/Section13d.lean new file mode 100644 index 0000000000..bfd8802d2c --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section13d.lean @@ -0,0 +1,120 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section13c +public import LeanPool.GraphMinor.GM17.SubdivideDraw +public import LeanPool.GraphMinor.GM17.VortexPortrayal +public import LeanPool.GraphMinor.GM16.Section7 + +import LeanPool.GraphMinor.GM16.MainProof + +import LeanPool.GraphMinor.GM17.Section8Proved + +/-! +# Graph Minors XVII, (13.1) + +We prove (13.1) (page 202) from XVI (3.1). The route is the paper's. Given a graph `H`, we apply +(3.1). If `G` has no minor controlled by the tangle, then (3.1) gives a set `Z` of few vertices and +a +central segregation of `G \ Z` of type `(ρ, κ)` with a proper arrangement in a surface in which `H` +cannot be drawn. The arrangement gives a portrayal, by `exists_portrayal_of_arrangement`. + +There is one change. The minors of (3.1) use edges of `G`, and those of XVII use edges of the simple +graph `G*`. If `H` has loops or parallel edges, then a minor in the first sense need not give a +minor in the second. So we apply (3.1) to the double subdivision of `H`, which is simple. A minor of +it gives a minor of `H` in `G*` (`controlsMinor_of_subdiv`), and if it cannot be drawn in a surface +then `H` cannot either (`canBeDrawnIn_subdiv`). +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface GraphMinor.GM10 GraphMinor.Hypergraph + +universe u v + +/-- A hypergraph with a tangle of positive order has a vertex. If not, then `G` and its complement +have no vertices, so neither axiom (i) nor axiom (iii) can hold. -/ +theorem nonempty_of_isTangle {α : Type u} {β : Type v} {G : Hypergraph α β} {θ : ℕ} {𝒯 : Set + (Hypergraph α β × Hypergraph α β)} (ht : IsTangle G θ 𝒯) : Nonempty α := by + by_contra hne + rw [not_nonempty_iff] at hne + have hsub : ∀ A B : Set α, A = B := fun A B => Subsingleton.elim A B + have hord : separationOrder G (complSubhypergraph G G) < θ := by + have h1 := ht.one_le + have : separationOrder G (complSubhypergraph G G) = 0 := by + rw [separationOrder, hsub (G ∩ complSubhypergraph G G).vertexSet ∅, Set.ncard_empty] + omega + rcases ht.axiom1 (isSeparation_complSubhypergraph le_rfl) hord with h | h + · exact ht.axiom3 h (hsub _ _) + · exact ht.axiom3 h (hsub _ _) + +/-- Graph Minors XVII (13.1) (page 202), for graphs. Subdivide each edge of `H` twice before +applying XVI (3.1). The controlled minor of the subdivision then gives a controlled `H`-minor. -/ +theorem theorem_13_1_proof : Theorem131Statement.{u, v} := by + classical + intro α' β' H hH + have hex : ∀ e : ↥H.edgeSet, ∃ x y, H.ends e.1 = {x, y} := fun e => exists_ends hH e.2 + choose a b hab using hex + have ha : ∀ e, a e ∈ H.vertexSet := fun e => H.vertex_mem_of_inc (e := e.1) (by + change a e ∈ H.ends e.1 + rw [hab] + exact Or.inl rfl) + have hb : ∀ e, b e ∈ H.vertexSet := fun e => H.vertex_mem_of_inc (e := e.1) (by + change b e ∈ H.ends e.1 + rw [hab] + exact Or.inr rfl) + have : Finite ↥H.edgeSet := H.edgeSet_finite.to_subtype + have hVL : (subdiv H a b ha hb).vertexSet.Finite := (H.vertexSet_finite.image _).union + (Set.finite_range _) + have hEL : (subdiv H a b ha hb).edgeSet.Finite := Set.toFinite _ + obtain ⟨κ, ρ, ζ, θ₀, -, hL⟩ := GraphMinor.GM16.theorem_3_1_proof.{u, v, 0, 0, 0} + (subdiv H a b ha hb) hVL hEL + refine ⟨ρ + 1, κ, ζ, max θ₀ (ζ + max 3 (2 * (ρ + 1) + 2) + 1), by omega, ?_⟩ + intro α β G hG θ' 𝒯 ht hθ + have hθ₁ : θ₀ ≤ θ' := (le_max_left _ _).trans hθ + have hθ₂ : ζ + max 3 (2 * (ρ + 1) + 2) + 1 ≤ θ' := (le_max_right _ _).trans hθ + have := nonempty_of_isTangle ht + obtain ⟨Gr, hV, hE, rfl⟩ : ∃ (Gr : Graph α β) (hV : Gr.vertexSet.Finite) + (hE : Gr.edgeSet.Finite), Hypergraph.ofGraph Gr hV hE = G := + ⟨toGraph G hG, G.vertexSet_finite, G.edgeSet_finite, ofGraph_toGraph G hG _ _⟩ + by_cases hc : GM16.ControlsMinor Gr (subdiv H a b ha hb) 𝒯 + · exact .inl (controlsMinor_of_subdiv hH hab ha hb hV hE hc) + right + obtain ⟨Z, Seg, Sp, _, _, D, ν, hZ, hZ₁, hZ₂, hS, hcon, hnd, hcent, hty, harr⟩ + := hL Gr θ' 𝒯 ⟨hV, hE, ht⟩ hθ₁ hc + have hV' : (GM09.deleteVertices Gr Z).vertexSet.Finite := hV.subset + (by simp [GM09.deleteVertices]) + have hE' : (GM09.deleteVertices Gr Z).edgeSet.Finite := hE.subset (Gr.induce_le + sdiff_subset).edgeSet_mono + have hπ := exists_portrayal_of_arrangement hS hV' hE' hty harr + rw [GM16.ofGraph_deleteVertices_eq Gr hV hE Z hV' hE'] at hπ + obtain ⟨π, ⟨j, hj⟩, hw, hq, hcell⟩ := hπ + refine ⟨Z, hZ, hZ₁, π, ?_, hw, hq, fun hd => hnd (canBeDrawnIn_subdiv hab ha hb + (CanBeDrawn.of_isEmbedding hj hd))⟩ + intro c hcC + have ht' := GM10.theorem_8_5_proof hG ht hZ hZ₂ + have hle := π.cellGraph_le c hcC + have hsep := isSeparation_complSubhypergraph hle + have hord : separationOrder (π.cellGraph c) (complSubhypergraph ((ofGraph Gr hV + hE).deleteVertices Z) (π.cellGraph c)) < θ' - Z.ncard := by + rw [separationOrder_complSubhypergraph] + have hsub := π.attachments_cellGraph_subset_otherVertices hcC + have h1 := Set.ncard_le_ncard hsub ((π.cellGraph c).vertexSet_finite.inter_of_left _) + have h2 := π.ncard_cell_inter_other_le hw hcC + omega + rcases ht'.axiom1 hsep hord with h | h + · exact ⟨_, h⟩ + · obtain ⟨s, hs, hsub⟩ := hcell c hcC + exact absurd hsub (hcent.2 hs h) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section14.lean b/LeanPool/GraphMinor/GM17/Section14.lean new file mode 100644 index 0000000000..d199147c5f --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section14.lean @@ -0,0 +1,498 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Defs2 +public import LeanPool.GraphMinor.GM10.TangleLemmas +public import LeanPool.GraphMinor.GM10.BranchWidth + +/-! +# Graph Minors XVII, Section 14: Hypergraph Form of the Excluded Minor Theorem + +This file formalizes Section 14 (pages 207–210) of Robertson and Seymour, *Graph Minors. XVII. +Taming a Vortex*, J. Combin. Theory Ser. B 77 (1999), 162–210. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +/-! ## 1. Tangles in the 1-Skeleton: (14.1) (Pages 207–209) -/ + +/-- Every separation `(A', B')` of `G*` lifts to a separation `(A, B)` of `G` with the same vertex +sets `V(A) = V(A')` and `V(B) = V(B')`. -/ +theorem exists_separation_of_oneSkeletonHypergraph_separation + {α : Type u} {β : Type v} {G : Hypergraph α β} + {A' B' : Hypergraph α (Sym2 α)} + (hsep' : (oneSkeletonHypergraph G).IsSeparation A' B') : + ∃ A B : Hypergraph α β, G.IsSeparation A B ∧ + A.vertexSet = A'.vertexSet ∧ B.vertexSet = B'.vertexSet := by + have hends : ∀ e ∈ G.edgeSet, G.ends e ⊆ A'.vertexSet ∨ G.ends e ⊆ B'.vertexSet := by + intro e he + by_contra! hnot + rcases hnot with ⟨hnotA, hnotB⟩ + obtain ⟨u, hu, huA⟩ := not_subset.mp hnotA + obtain ⟨v, hv, hvB⟩ := not_subset.mp hnotB + have huv_ne : u ≠ v := by + rintro rfl + have huG : u ∈ G.vertexSet := G.vertex_mem_of_inc hu + have huAB : u ∈ A'.vertexSet ∪ B'.vertexSet := hsep'.vertexSet_union.symm ▸ huG + exact huAB.elim huA hvB + have hs_edge : s(u, v) ∈ (oneSkeletonHypergraph G).edgeSet := by + change s(u, v) ∈ G.skeleton.edgeSet + rw [SimpleGraph.mem_edgeSet] + exact ⟨huv_ne, e, hu, hv⟩ + have hs_AB : s(u, v) ∈ A'.edgeSet ∪ B'.edgeSet := hsep'.edgeSet_union.symm ▸ hs_edge + rcases hs_AB with hsA | hsB + · have hu_inc : A'.Inc s(u, v) u := + (inc_iff_of_le hsep'.left_le hsA).2 ⟨hs_edge, Sym2.mem_mk_left u v⟩ + exact huA (A'.vertex_mem_of_inc hu_inc) + · have hv_inc : B'.Inc s(u, v) v := + (inc_iff_of_le hsep'.right_le hsB).2 ⟨hs_edge, Sym2.mem_mk_right u v⟩ + exact hvB (B'.vertex_mem_of_inc hv_inc) + let A : Hypergraph α β := + { vertexSet := A'.vertexSet + edgeSet := {e ∈ G.edgeSet | G.ends e ⊆ A'.vertexSet} + Inc := fun e v => (e ∈ G.edgeSet ∧ G.ends e ⊆ A'.vertexSet) ∧ G.Inc e v + vertex_mem_of_inc := fun _ _ h => h.1.2 h.2 + edge_mem_of_inc := fun _ _ h => h.1 + vertexSet_finite := A'.vertexSet_finite + edgeSet_finite := G.edgeSet_finite.subset fun _ h => h.1 } + let B : Hypergraph α β := + { vertexSet := B'.vertexSet + edgeSet := {e ∈ G.edgeSet | ¬ G.ends e ⊆ A'.vertexSet} + Inc := fun e v => (e ∈ G.edgeSet ∧ ¬ G.ends e ⊆ A'.vertexSet) ∧ G.Inc e v + vertex_mem_of_inc := fun e _ h => (hends e h.1.1).resolve_left h.1.2 h.2 + edge_mem_of_inc := fun _ _ h => h.1 + vertexSet_finite := B'.vertexSet_finite + edgeSet_finite := G.edgeSet_finite.subset fun _ h => h.1 } + have hA_le : A ≤ G := + { vertexSet_subset := hsep'.left_le.vertexSet_subset + edgeSet_subset := fun _ h => h.1 + ends_eq := fun e he => by ext v; exact ⟨fun h => ⟨he, h⟩, fun h => h.2⟩ } + have hB_le : B ≤ G := + { vertexSet_subset := hsep'.right_le.vertexSet_subset + edgeSet_subset := fun _ h => h.1 + ends_eq := fun e he => by ext v; exact ⟨fun h => ⟨he, h⟩, fun h => h.2⟩ } + refine ⟨A, B, (isSeparation_iff_of_le hA_le hB_le).2 ⟨hsep'.vertexSet_union, ?_, ?_⟩, rfl, rfl⟩ + · ext e + simp only [A, B, mem_union, mem_sep_iff] + exact ⟨fun h => h.elim And.left And.left, fun he => by + by_cases h : G.ends e ⊆ A'.vertexSet + · exact Or.inl ⟨he, h⟩ + · exact Or.inr ⟨he, h⟩⟩ + · ext e + change (e ∈ G.edgeSet ∧ G.ends e ⊆ A'.vertexSet) ∧ + (e ∈ G.edgeSet ∧ ¬ G.ends e ⊆ A'.vertexSet) ↔ False + tauto + +/-- Given `(A, B) ∈ 𝒯` and `W ⊆ V(B)` with `|(V(A) ∪ W) ∩ V(B)| < θ`, there is a separation +`(A⁺, B⁻) ∈ 𝒯` with `V(A⁺) = V(A) ∪ W`, `V(B⁻) = V(B)`, and +`E(A⁺) = {e ∈ E(G) | G.ends e ⊆ V(A) ∪ W}`. -/ +private theorem exists_maximal_separation_in_tangle + {α : Type u} {β : Type v} {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {A B : Hypergraph α β} (hAB : (A, B) ∈ 𝒯) + {W : Set α} (hWB : W ⊆ B.vertexSet) + (hord : ((A.vertexSet ∪ W) ∩ B.vertexSet).ncard < θ) : + ∃ Aplus Bminus : Hypergraph α β, (Aplus, Bminus) ∈ 𝒯 ∧ + Aplus.vertexSet = A.vertexSet ∪ W ∧ + Bminus.vertexSet = B.vertexSet ∧ + Aplus.edgeSet = {e ∈ G.edgeSet | G.ends e ⊆ A.vertexSet ∪ W} := by + have hsep := h𝒯.isSeparation hAB + have hWG : W ⊆ G.vertexSet := hWB.trans hsep.right_le.vertexSet_subset + have hends_B : ∀ e ∈ G.edgeSet, ¬ G.ends e ⊆ A.vertexSet ∪ W → G.ends e ⊆ B.vertexSet := by + intro e he hnot + have he_not_A : e ∉ A.edgeSet := by + intro heA + apply hnot + intro v hv + have hvA : A.Inc e v := (inc_iff_of_le hsep.left_le heA).2 hv + exact Or.inl (A.vertex_mem_of_inc hvA) + have heB : e ∈ B.edgeSet := (hsep.edgeSet_union.symm ▸ he).resolve_left he_not_A + intro v hv + exact B.vertex_mem_of_inc ((inc_iff_of_le hsep.right_le heB).2 hv) + let Aplus : Hypergraph α β := + { vertexSet := A.vertexSet ∪ W + edgeSet := {e ∈ G.edgeSet | G.ends e ⊆ A.vertexSet ∪ W} + Inc := fun e v => (e ∈ G.edgeSet ∧ G.ends e ⊆ A.vertexSet ∪ W) ∧ G.Inc e v + vertex_mem_of_inc := fun _ _ h => h.1.2 h.2 + edge_mem_of_inc := fun _ _ h => h.1 + vertexSet_finite := A.vertexSet_finite.union (B.vertexSet_finite.subset hWB) + edgeSet_finite := G.edgeSet_finite.subset fun _ h => h.1 } + let Bminus : Hypergraph α β := + { vertexSet := B.vertexSet + edgeSet := {e ∈ G.edgeSet | ¬ G.ends e ⊆ A.vertexSet ∪ W} + Inc := fun e v => (e ∈ G.edgeSet ∧ ¬ G.ends e ⊆ A.vertexSet ∪ W) ∧ G.Inc e v + vertex_mem_of_inc := fun e _ h => hends_B e h.1.1 h.1.2 h.2 + edge_mem_of_inc := fun _ _ h => h.1 + vertexSet_finite := B.vertexSet_finite + edgeSet_finite := G.edgeSet_finite.subset fun _ h => h.1 } + have hAplus_le : Aplus ≤ G := + { vertexSet_subset := union_subset hsep.left_le.vertexSet_subset hWG + edgeSet_subset := fun _ h => h.1 + ends_eq := fun e he => by ext v; exact ⟨fun h => ⟨he, h⟩, fun h => h.2⟩ } + have hBminus_le : Bminus ≤ G := + { vertexSet_subset := hsep.right_le.vertexSet_subset + edgeSet_subset := fun _ h => h.1 + ends_eq := fun e he => by ext v; exact ⟨fun h => ⟨he, h⟩, fun h => h.2⟩ } + have hsep_new : G.IsSeparation Aplus Bminus := by + rw [isSeparation_iff_of_le hAplus_le hBminus_le] + refine ⟨?_, ?_, ?_⟩ + · change (A.vertexSet ∪ W) ∪ B.vertexSet = G.vertexSet + rw [Set.union_assoc, union_eq_right.mpr hWB, hsep.vertexSet_union] + · ext e + simp only [Aplus, Bminus, mem_union, mem_sep_iff] + exact ⟨fun h => h.elim And.left And.left, fun he => by + by_cases h : G.ends e ⊆ A.vertexSet ∪ W + · exact Or.inl ⟨he, h⟩ + · exact Or.inr ⟨he, h⟩⟩ + · ext e + change (e ∈ G.edgeSet ∧ G.ends e ⊆ A.vertexSet ∪ W) ∧ + (e ∈ G.edgeSet ∧ ¬ G.ends e ⊆ A.vertexSet ∪ W) ↔ False + tauto + have hmem : (Aplus, Bminus) ∈ 𝒯 := + theorem_2_9_case_1 h𝒯 hAB hsep_new hord subset_rfl + exact ⟨Aplus, Bminus, hmem, rfl, rfl, rfl⟩ + +/-- Claim (1) in the proof of **Graph Minors XVII, (14.1)** (page 208): +"If $(A'_1, B'_1), (A'_2, B'_2) \in \mathscr{T}^*$ then $B'_1 \not\subseteq A'_2$." -/ +theorem theorem_14_1_claim_1 + {α : Type u} {β : Type v} {G : Hypergraph α β} {θ θstar : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {A'₁ B'₁ A'₂ B'₂ : Hypergraph α (Sym2 α)} + (h1 : (A'₁, B'₁) ∈ oneSkeletonTangle G 𝒯 θstar) + (h2 : (A'₂, B'₂) ∈ oneSkeletonTangle G 𝒯 θstar) : + ¬ B'₁ ≤ A'₂ := by + intro hle + obtain ⟨_, _, ⟨A₁, B₁⟩, hAB₁, hVA₁, hVB₁⟩ := h1 + obtain ⟨_, _, ⟨A₂, B₂⟩, hAB₂, hVA₂, hVB₂⟩ := h2 + have hsub : B₁.vertexSet ⊆ A₂.vertexSet := by + rw [hVB₁, hVA₂] + exact hle.vertexSet_subset + have hsep₂ := (h𝒯.isSeparation hAB₂).symm + have hord₂ : separationOrder B₂ A₂ < θ := by + rw [separationOrder_comm] + exact h𝒯.order_lt hAB₂ + have hB₂A₂ : (B₂, A₂) ∈ 𝒯 := theorem_2_9_case_1 h𝒯 hAB₁ hsep₂ hord₂ hsub + exact GraphMinor.GM10.theorem_2_1_proof h𝒯 hAB₂ hB₂A₂ + +/-- Claim (2) in the proof of **Graph Minors XVII, (14.1)** (page 208): +"There do not exist subhypergraphs $A'_1$, $A'_2$, $A'_3$ of $G^*$, mutually edge-disjoint, with +$A'_1 \cup A'_2 \cup A'_3 = G^*$, and with $(A'_1, A'_2 \cup A'_3)$, $(A'_2, A'_3 \cup A'_1)$, +$(A'_3, A'_1 \cup A'_2)$ all in $\mathscr{T}^*$." -/ +theorem theorem_14_1_claim_2 + {α : Type u} {β : Type v} {G : Hypergraph α β} {θ θstar : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (hlt : 3 * θstar < 2 * θ + 3) (h𝒯 : IsTangle G θ 𝒯) : + ¬ ∃ A'₁ A'₂ A'₃ : Hypergraph α (Sym2 α), + A'₁ ≤ oneSkeletonHypergraph G ∧ + A'₂ ≤ oneSkeletonHypergraph G ∧ + A'₃ ≤ oneSkeletonHypergraph G ∧ + Disjoint A'₁.edgeSet A'₂.edgeSet ∧ + Disjoint A'₁.edgeSet A'₃.edgeSet ∧ + Disjoint A'₂.edgeSet A'₃.edgeSet ∧ + A'₁ ∪ A'₂ ∪ A'₃ = oneSkeletonHypergraph G ∧ + (A'₁, A'₂ ∪ A'₃) ∈ oneSkeletonTangle G 𝒯 θstar ∧ + (A'₂, A'₃ ∪ A'₁) ∈ oneSkeletonTangle G 𝒯 θstar ∧ + (A'₃, A'₁ ∪ A'₂) ∈ oneSkeletonTangle G 𝒯 θstar := by + rintro ⟨A'₁, A'₂, A'₃, _, _, _, _, _, _, hU', hm1, hm2, hm3⟩ + let B'₁ := A'₂ ∪ A'₃ + let B'₂ := A'₃ ∪ A'₁ + let B'₃ := A'₁ ∪ A'₂ + let V₁ := A'₁.vertexSet + let V₂ := A'₂.vertexSet + let V₃ := A'₃.vertexSet + let W₀ := V₁ ∩ V₂ ∩ V₃ + let W₁ := (V₂ ∩ V₃) \ V₁ + let W₂ := (V₃ ∩ V₁) \ V₂ + let W₃ := (V₁ ∩ V₂) \ V₃ + let W := W₀ ∪ W₁ ∪ W₂ ∪ W₃ + have hW₀_fin : W₀.Finite := A'₁.vertexSet_finite.subset (inter_subset_left.trans + inter_subset_left) + have hW₁_fin : W₁.Finite := A'₂.vertexSet_finite.subset (sdiff_subset.trans inter_subset_left) + have hW₂_fin : W₂.Finite := A'₃.vertexSet_finite.subset (sdiff_subset.trans inter_subset_left) + have hW₃_fin : W₃.Finite := A'₁.vertexSet_finite.subset (sdiff_subset.trans inter_subset_left) + have hdisj01 : Disjoint W₀ W₁ := Set.disjoint_left.mpr fun _ h0 h1 => h1.2 h0.1.1 + have hdisj02 : Disjoint W₀ W₂ := Set.disjoint_left.mpr fun _ h0 h2 => h2.2 h0.1.2 + have hdisj03 : Disjoint W₀ W₃ := Set.disjoint_left.mpr fun _ h0 h3 => h3.2 h0.2 + have hdisj12 : Disjoint W₁ W₂ := Set.disjoint_left.mpr fun _ h1 h2 => h1.2 h2.1.2 + have hdisj13 : Disjoint W₁ W₃ := Set.disjoint_left.mpr fun _ h1 h3 => h1.2 h3.1.1 + have hdisj23 : Disjoint W₂ W₃ := Set.disjoint_left.mpr fun _ h2 h3 => h2.2 h3.1.2 + have hI₁ : V₁ ∩ (V₂ ∪ V₃) = W₀ ∪ W₂ ∪ W₃ := by + ext x + simp only [W₀, W₂, W₃, mem_inter_iff, mem_union, mem_sdiff] + tauto + have hI₂ : V₂ ∩ (V₃ ∪ V₁) = W₀ ∪ W₃ ∪ W₁ := by + ext x + simp only [W₀, W₃, W₁, mem_inter_iff, mem_union, mem_sdiff] + tauto + have hI₃ : V₃ ∩ (V₁ ∪ V₂) = W₀ ∪ W₁ ∪ W₂ := by + ext x + simp only [W₀, W₁, W₂, mem_inter_iff, mem_union, mem_sdiff] + tauto + have hcard1 : (W₀ ∪ W₂ ∪ W₃).ncard = W₀.ncard + W₂.ncard + W₃.ncard := by + rw [ncard_union_eq (hdisj03.union_left hdisj23) (hW₀_fin.union hW₂_fin) hW₃_fin, + ncard_union_eq hdisj02 hW₀_fin hW₂_fin] + have hcard2 : (W₀ ∪ W₃ ∪ W₁).ncard = W₀.ncard + W₃.ncard + W₁.ncard := by + rw [ncard_union_eq (hdisj01.union_left hdisj13.symm) (hW₀_fin.union hW₃_fin) hW₁_fin, + ncard_union_eq hdisj03 hW₀_fin hW₃_fin] + have hcard3 : (W₀ ∪ W₁ ∪ W₂).ncard = W₀.ncard + W₁.ncard + W₂.ncard := by + rw [ncard_union_eq (hdisj02.union_left hdisj12) (hW₀_fin.union hW₁_fin) hW₂_fin, + ncard_union_eq hdisj01 hW₀_fin hW₁_fin] + have hcardW : W.ncard = W₀.ncard + W₁.ncard + W₂.ncard + W₃.ncard := by + dsimp [W] + rw [ncard_union_eq ((hdisj03.union_left hdisj13).union_left hdisj23) + ((hW₀_fin.union hW₁_fin).union hW₂_fin) hW₃_fin, hcard3] + have hord1 : W₀.ncard + W₂.ncard + W₃.ncard < θstar := by + have h : (V₁ ∩ (V₂ ∪ V₃)).ncard < θstar := hm1.2.1 + rwa [hI₁, hcard1] at h + have hord2 : W₀.ncard + W₃.ncard + W₁.ncard < θstar := by + have h : (V₂ ∩ (V₃ ∪ V₁)).ncard < θstar := hm2.2.1 + rwa [hI₂, hcard2] at h + have hord3 : W₀.ncard + W₁.ncard + W₂.ncard < θstar := by + have h : (V₃ ∩ (V₁ ∪ V₂)).ncard < θstar := hm3.2.1 + rwa [hI₃, hcard3] at h + have hW_lt : W.ncard < θ := by + rw [hcardW] + omega + obtain ⟨hsep'1, _, ⟨A₁₀, B₁₀⟩, hAB₁₀, hVA₁₀, hVB₁₀⟩ := hm1 + obtain ⟨hsep'2, _, ⟨A₂₀, B₂₀⟩, hAB₂₀, hVA₂₀, hVB₂₀⟩ := hm2 + obtain ⟨hsep'3, _, ⟨A₃₀, B₃₀⟩, hAB₃₀, hVA₃₀, hVB₃₀⟩ := hm3 + change A₁₀.vertexSet = V₁ at hVA₁₀ + change B₁₀.vertexSet = V₂ ∪ V₃ at hVB₁₀ + change A₂₀.vertexSet = V₂ at hVA₂₀ + change B₂₀.vertexSet = V₃ ∪ V₁ at hVB₂₀ + change A₃₀.vertexSet = V₃ at hVA₃₀ + change B₃₀.vertexSet = V₁ ∪ V₂ at hVB₃₀ + have hW₁_sub : W₁ ⊆ B₁₀.vertexSet := by + rw [hVB₁₀] + exact fun _ hx => Or.inl hx.1.1 + have hW₂_sub : W₂ ⊆ B₂₀.vertexSet := by + rw [hVB₂₀] + exact fun _ hx => Or.inl hx.1.1 + have hW₃_sub : W₃ ⊆ B₃₀.vertexSet := by + rw [hVB₃₀] + exact fun _ hx => Or.inl hx.1.1 + have hW_eq1 : (A₁₀.vertexSet ∪ W₁) ∩ B₁₀.vertexSet = W := by + rw [hVA₁₀, union_inter_distrib_right, inter_eq_left.mpr hW₁_sub, hVB₁₀, hI₁] + dsimp [W] + ac_rfl + have hW_eq2 : (A₂₀.vertexSet ∪ W₂) ∩ B₂₀.vertexSet = W := by + rw [hVA₂₀, union_inter_distrib_right, inter_eq_left.mpr hW₂_sub, hVB₂₀, hI₂] + dsimp [W] + ac_rfl + have hW_eq3 : (A₃₀.vertexSet ∪ W₃) ∩ B₃₀.vertexSet = W := by + rw [hVA₃₀, union_inter_distrib_right, inter_eq_left.mpr hW₃_sub, hVB₃₀, hI₃] + obtain ⟨A₁, B₁, hAB₁, hVA₁, _, hEA₁⟩ := + exists_maximal_separation_in_tangle h𝒯 hAB₁₀ hW₁_sub (hW_eq1.symm ▸ hW_lt) + obtain ⟨A₂, B₂, hAB₂, hVA₂, _, hEA₂⟩ := + exists_maximal_separation_in_tangle h𝒯 hAB₂₀ hW₂_sub (hW_eq2.symm ▸ hW_lt) + obtain ⟨A₃, B₃, hAB₃, hVA₃, _, hEA₃⟩ := + exists_maximal_separation_in_tangle h𝒯 hAB₃₀ hW₃_sub (hW_eq3.symm ▸ hW_lt) + rw [hVA₁₀] at hVA₁ hEA₁ + rw [hVA₂₀] at hVA₂ hEA₂ + rw [hVA₃₀] at hVA₃ hEA₃ + have hW_sub_1 : W ⊆ V₁ ∪ W₁ := by + have : W = (V₁ ∩ (V₂ ∪ V₃)) ∪ W₁ := by + rw [hI₁]; dsimp [W]; ac_rfl + rw [this] + exact union_subset_union_left _ inter_subset_left + have hU'_V : (V₁ ∪ V₂) ∪ V₃ = G.vertexSet := + congrArg Hypergraph.vertexSet hU' + have hV_union : (A₁ ∪ A₂ ∪ A₃).vertexSet = G.vertexSet := by + have hle := union_le (union_le (h𝒯.isSeparation hAB₁).left_le (h𝒯.isSeparation hAB₂).left_le) + (h𝒯.isSeparation hAB₃).left_le + refine Subset.antisymm hle.vertexSet_subset ?_ + rw [← hU'_V] + intro x hx + simp only [union_vertexSet, hVA₁, hVA₂, hVA₃, mem_union] at hx ⊢ + tauto + have hE_union : (A₁ ∪ A₂ ∪ A₃).edgeSet = G.edgeSet := by + have hle := union_le (union_le (h𝒯.isSeparation hAB₁).left_le (h𝒯.isSeparation hAB₂).left_le) + (h𝒯.isSeparation hAB₃).left_le + refine Subset.antisymm hle.edgeSet_subset ?_ + intro e heG + simp only [union_edgeSet, hEA₁, hEA₂, hEA₃, mem_union, mem_sep_iff] + by_cases hsubW : G.ends e ⊆ W + · exact Or.inl (Or.inl ⟨heG, hsubW.trans hW_sub_1⟩) + · obtain ⟨v, hv_end, hv_notW⟩ := not_subset.mp hsubW + have hvG : v ∈ (V₁ ∪ V₂) ∪ V₃ := + hU'_V.symm ▸ G.vertex_mem_of_inc hv_end + have hadj_sub : ∀ {A' B' : Hypergraph α (Sym2 α)}, + (oneSkeletonHypergraph G).IsSeparation A' B' → + v ∈ A'.vertexSet → v ∉ B'.vertexSet → G.ends e ⊆ A'.vertexSet := by + intro A' B' hsep' hvA' hv_notB' v' hv'_end + by_cases hvv' : v' = v + · exact hvv' ▸ hvA' + · have hs_edge : s(v, v') ∈ (oneSkeletonHypergraph G).edgeSet := by + change s(v, v') ∈ G.skeleton.edgeSet + rw [SimpleGraph.mem_edgeSet] + exact ⟨Ne.symm hvv', e, hv_end, hv'_end⟩ + rcases hsep'.edgeSet_union.symm ▸ hs_edge with hsA | hsB + · exact A'.vertex_mem_of_inc + ((inc_iff_of_le hsep'.left_le hsA).2 ⟨hs_edge, Sym2.mem_mk_right v v'⟩) + · exfalso + exact hv_notB' (B'.vertex_mem_of_inc + ((inc_iff_of_le hsep'.right_le hsB).2 ⟨hs_edge, Sym2.mem_mk_left v v'⟩)) + have hv_not1 : v ∉ V₁ ∩ (V₂ ∪ V₃) := by + rw [hI₁] + intro h + apply hv_notW + simp only [W, mem_union] at h ⊢ + tauto + have hv_not2 : v ∉ V₂ ∩ (V₃ ∪ V₁) := by + rw [hI₂] + intro h + apply hv_notW + simp only [W, mem_union] at h ⊢ + tauto + have hv_not3 : v ∉ V₃ ∩ (V₁ ∪ V₂) := by + rw [hI₃] + intro h + apply hv_notW + simp only [W, mem_union] at h ⊢ + tauto + rcases hvG with (hv1 | hv2) | hv3 + · have hnotB1 : v ∉ B'₁.vertexSet := fun hB => hv_not1 ⟨hv1, hB⟩ + exact Or.inl (Or.inl ⟨heG, (hadj_sub hsep'1 hv1 hnotB1).trans subset_union_left⟩) + · have hnotB2 : v ∉ B'₂.vertexSet := fun hB => hv_not2 ⟨hv2, hB⟩ + exact Or.inl (Or.inr ⟨heG, (hadj_sub hsep'2 hv2 hnotB2).trans subset_union_left⟩) + · have hnotB3 : v ∉ B'₃.vertexSet := fun hB => hv_not3 ⟨hv3, hB⟩ + exact Or.inr ⟨heG, (hadj_sub hsep'3 hv3 hnotB3).trans subset_union_left⟩ + have hle_all := union_le (union_le (h𝒯.isSeparation hAB₁).left_le (h𝒯.isSeparation hAB₂).left_le) + (h𝒯.isSeparation hAB₃).left_le + exact h𝒯.axiom2 hAB₁ hAB₂ hAB₃ + (eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle_all le_rfl hV_union hE_union) + +/-- **Graph Minors XVII, (14.1)** (page 207): +"Let $\mathscr{T}$ be a tangle of order $\theta$ in a hypergraph $G$. Let $\theta^* \ge 1$ with +$\theta^* < 2/3\theta + 1$, and let $\mathscr{T}^*$ be the set of all separations $(A', B')$ of +$G^*$ of order $< \theta^*$ such that there exists $(A, B) \in \mathscr{T}$ with $V(A) = V(A')$ +and $V(B) = V(B')$. Then $\mathscr{T}^*$ is a tangle in $G^*$ of order $\theta^*$." -/ +theorem theorem_14_1_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} {θ θstar : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (h1 : 1 ≤ θstar) (hlt : 3 * θstar < 2 * θ + 3) (h𝒯 : IsTangle G θ 𝒯) : + IsTangle (oneSkeletonHypergraph G) θstar (oneSkeletonTangle G 𝒯 θstar) := by + have hθ_ge1 : 1 ≤ θ := h𝒯.one_le + have hθstar_le_θ : θstar ≤ θ := by omega + have hsep : ∀ ⦃A' B'⦄, (A', B') ∈ oneSkeletonTangle G 𝒯 θstar → + (oneSkeletonHypergraph G).IsSeparation A' B' := fun _ _ h => h.1 + have hord : ∀ ⦃A' B'⦄, (A', B') ∈ oneSkeletonTangle G 𝒯 θstar → + separationOrder A' B' < θstar := fun _ _ h => h.2.1 + have hax1 : TangleAxiom1 (oneSkeletonHypergraph G) θstar (oneSkeletonTangle G 𝒯 θstar) := by + intro A' B' hsep' hord' + obtain ⟨A, B, hsepAB, hVA, hVB⟩ := exists_separation_of_oneSkeletonHypergraph_separation hsep' + have hordAB : separationOrder A B < θ := by + change (A.vertexSet ∩ B.vertexSet).ncard < θ + rw [hVA, hVB] + exact hord'.trans_le hθstar_le_θ + rcases h𝒯.axiom1 hsepAB hordAB with hAB | hBA + · exact Or.inl ⟨hsep', hord', ⟨(A, B), hAB, hVA, hVB⟩⟩ + · exact Or.inr ⟨hsep'.symm, by rwa [separationOrder_comm], ⟨(B, A), hBA, hVB, hVA⟩⟩ + have hax3 : TangleAxiom3 (oneSkeletonHypergraph G) (oneSkeletonTangle G 𝒯 θstar) := by + intro A' B' ⟨_, _, ⟨A, B⟩, hAB, hVA, _⟩ hVA'_G + exact h𝒯.axiom3 hAB (hVA.trans hVA'_G) + refine ⟨h1, hsep, hord, hax1, ?_, hax3⟩ + by_cases h2 : 2 ≤ θstar + · exact GraphMinor.GM10.theorem_4_5_proof h2 hsep hord hax1 + (fun _ _ _ _ hm1 hm2 => theorem_14_1_claim_1 h𝒯 hm1 hm2) + (theorem_14_1_claim_2 hlt h𝒯) + · have hθstar_eq1 : θstar = 1 := by omega + intro A'₁ B'₁ A'₂ B'₂ A'₃ B'₃ hm1 hm2 hm3 hU' + obtain ⟨hsep'1, hord'1, ⟨A₁₀, B₁₀⟩, hAB₁₀, hVA₁₀, hVB₁₀⟩ := hm1 + obtain ⟨hsep'2, hord'2, ⟨A₂₀, B₂₀⟩, hAB₂₀, hVA₂₀, hVB₂₀⟩ := hm2 + obtain ⟨hsep'3, hord'3, ⟨A₃₀, B₃₀⟩, hAB₃₀, hVA₃₀, hVB₃₀⟩ := hm3 + change separationOrder A'₁ B'₁ < θstar at hord'1 + change separationOrder A'₂ B'₂ < θstar at hord'2 + change separationOrder A'₃ B'₃ < θstar at hord'3 + change A₁₀.vertexSet = A'₁.vertexSet at hVA₁₀ + change B₁₀.vertexSet = B'₁.vertexSet at hVB₁₀ + change A₂₀.vertexSet = A'₂.vertexSet at hVA₂₀ + change B₂₀.vertexSet = B'₂.vertexSet at hVB₂₀ + change A₃₀.vertexSet = A'₃.vertexSet at hVA₃₀ + change B₃₀.vertexSet = B'₃.vertexSet at hVB₃₀ + have hemp1 : (A₁₀.vertexSet ∪ ∅) ∩ B₁₀.vertexSet = ∅ := by + rw [union_empty, hVA₁₀, hVB₁₀] + apply (ncard_eq_zero (A'₁ ∩ B'₁).vertexSet_finite).mp + change separationOrder A'₁ B'₁ = 0 + omega + have hemp2 : (A₂₀.vertexSet ∪ ∅) ∩ B₂₀.vertexSet = ∅ := by + rw [union_empty, hVA₂₀, hVB₂₀] + apply (ncard_eq_zero (A'₂ ∩ B'₂).vertexSet_finite).mp + change separationOrder A'₂ B'₂ = 0 + omega + have hemp3 : (A₃₀.vertexSet ∪ ∅) ∩ B₃₀.vertexSet = ∅ := by + rw [union_empty, hVA₃₀, hVB₃₀] + apply (ncard_eq_zero (A'₃ ∩ B'₃).vertexSet_finite).mp + change separationOrder A'₃ B'₃ = 0 + omega + have h0_lt_θ : (∅ : Set α).ncard < θ := by rw [ncard_empty]; omega + obtain ⟨A₁, B₁, hAB₁, hVA₁, _, hEA₁⟩ := + exists_maximal_separation_in_tangle h𝒯 hAB₁₀ (empty_subset _) (hemp1.symm ▸ h0_lt_θ) + obtain ⟨A₂, B₂, hAB₂, hVA₂, _, hEA₂⟩ := + exists_maximal_separation_in_tangle h𝒯 hAB₂₀ (empty_subset _) (hemp2.symm ▸ h0_lt_θ) + obtain ⟨A₃, B₃, hAB₃, hVA₃, _, hEA₃⟩ := + exists_maximal_separation_in_tangle h𝒯 hAB₃₀ (empty_subset _) (hemp3.symm ▸ h0_lt_θ) + rw [union_empty, hVA₁₀] at hVA₁ hEA₁ + rw [union_empty, hVA₂₀] at hVA₂ hEA₂ + rw [union_empty, hVA₃₀] at hVA₃ hEA₃ + have hle_all := union_le (union_le (h𝒯.isSeparation hAB₁).left_le + (h𝒯.isSeparation hAB₂).left_le) + (h𝒯.isSeparation hAB₃).left_le + have hV_union : (A₁ ∪ A₂ ∪ A₃).vertexSet = G.vertexSet := by + have hU'_V : (A'₁ ∪ A'₂ ∪ A'₃).vertexSet = G.vertexSet := + congrArg Hypergraph.vertexSet hU' + simpa [hVA₁, hVA₂, hVA₃] using hU'_V + have hE_union : (A₁ ∪ A₂ ∪ A₃).edgeSet = G.edgeSet := by + refine Subset.antisymm hle_all.edgeSet_subset ?_ + intro e heG + simp only [union_edgeSet, hEA₁, hEA₂, hEA₃, mem_union, mem_sep_iff] + by_cases hne : (G.ends e).Nonempty + · obtain ⟨v, hv_end⟩ := hne + have hvG : v ∈ (A'₁ ∪ A'₂ ∪ A'₃).vertexSet := + hU'.symm ▸ (G.vertex_mem_of_inc hv_end : v ∈ (oneSkeletonHypergraph G).vertexSet) + have hdisj_AB : ∀ {A' B' : Hypergraph α (Sym2 α)}, + (oneSkeletonHypergraph G).IsSeparation A' B' → + (A'.vertexSet ∩ B'.vertexSet) = ∅ → + v ∈ A'.vertexSet → G.ends e ⊆ A'.vertexSet := by + intro A' B' hsep' hdisj hvA' v' hv'_end + by_cases hvv' : v' = v + · exact hvv' ▸ hvA' + · have hs_edge : s(v, v') ∈ (oneSkeletonHypergraph G).edgeSet := by + change s(v, v') ∈ G.skeleton.edgeSet + rw [SimpleGraph.mem_edgeSet] + exact ⟨Ne.symm hvv', e, hv_end, hv'_end⟩ + rcases hsep'.edgeSet_union.symm ▸ hs_edge with hsA | hsB + · exact A'.vertex_mem_of_inc + ((inc_iff_of_le hsep'.left_le hsA).2 ⟨hs_edge, Sym2.mem_mk_right v v'⟩) + · exfalso + have hvB' : v ∈ B'.vertexSet := B'.vertex_mem_of_inc + ((inc_iff_of_le hsep'.right_le hsB).2 ⟨hs_edge, Sym2.mem_mk_left v v'⟩) + exact notMem_empty v (hdisj ▸ ⟨hvA', hvB'⟩) + rcases hvG with (hv1 | hv2) | hv3 + · rw [union_empty, hVA₁₀, hVB₁₀] at hemp1 + exact Or.inl (Or.inl ⟨heG, hdisj_AB hsep'1 hemp1 hv1⟩) + · rw [union_empty, hVA₂₀, hVB₂₀] at hemp2 + exact Or.inl (Or.inr ⟨heG, hdisj_AB hsep'2 hemp2 hv2⟩) + · rw [union_empty, hVA₃₀, hVB₃₀] at hemp3 + exact Or.inr ⟨heG, hdisj_AB hsep'3 hemp3 hv3⟩ + · rw [not_nonempty_iff_eq_empty] at hne + exact Or.inl (Or.inl ⟨heG, hne.symm ▸ empty_subset _⟩) + exact h𝒯.axiom2 hAB₁ hAB₂ hAB₃ + (eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle_all le_rfl hV_union hE_union) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section14b.lean b/LeanPool/GraphMinor/GM17/Section14b.lean new file mode 100644 index 0000000000..0d3eaa27ec --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section14b.lean @@ -0,0 +1,263 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section13c +public import LeanPool.GraphMinor.GM17.Section14 + +import LeanPool.GraphMinor.GM17.Section13Proved + +import LeanPool.GraphMinor.GM17.Section13d + +import LeanPool.GraphMinor.GM17.Section8Proved + +/-! +# Graph Minors XVII, Section 14: the hypergraph form of the excluded minor theorem + +This file proves (14.2) of Robertson and Seymour, *Graph Minors. XVII. Taming a Vortex*, J. Combin. +Theory Ser. B 77 (1999), 162-210 (`theorem_14_2`, page 209), from (13.1). + +We pass to the tangle `𝒯*` of (14.1) in the 1-skeleton `G*`, apply (13.4) there, and use (12.6) to +go back to `G / Z`. Each cell stays small, since a separation of `G* \ Z` that is small comes from a +separation of `G` in `𝒯`. The same reason carries redundancy over, by +`Portrayal.IsRedundant.of_moved`, which the paper leaves to the reader. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface GraphMinor.GM10 GraphMinor.Hypergraph + +universe u v + +variable {α : Type u} {β : Type v} + +/-- An edge of the skeleton of `G / Z` is an edge of the skeleton of `G` with no end in `Z`. -/ +theorem mem_skeleton_quotient {G : Hypergraph α β} {Z : Set α} {s : Sym2 α} : + s ∈ (quotientVertices G Z).skeleton.edgeSet ↔ s ∈ G.skeleton.edgeSet ∧ ∀ v ∈ Z, v ∉ s := by + induction s using Sym2.ind with + | _ x y => + constructor + · intro hs + rw [SimpleGraph.mem_edgeSet] at hs + obtain ⟨hne, e, hx, hy⟩ := hs + refine ⟨(SimpleGraph.mem_edgeSet _).2 ⟨hne, e, hx.1, hy.1⟩, fun v hv hm => ?_⟩ + rcases Sym2.mem_iff.mp hm with rfl | rfl + · exact hx.2 hv + · exact hy.2 hv + · rintro ⟨hs, hZ⟩ + rw [SimpleGraph.mem_edgeSet] at hs + obtain ⟨hne, e, hx, hy⟩ := hs + exact (SimpleGraph.mem_edgeSet _).2 ⟨hne, e, ⟨hx, fun h => hZ x h (Sym2.mem_mk_left _ _)⟩, + ⟨hy, fun h => hZ y h (Sym2.mem_mk_right _ _)⟩⟩ + +/-- "`G* \ Z = (G/Z)*`" (page 210). -/ +theorem oneSkeleton_quotient (G : Hypergraph α β) (Z : Set α) : + oneSkeletonHypergraph (quotientVertices G Z) = (oneSkeletonHypergraph G).deleteVertices Z := by + have hI : ∀ (s : Sym2 α), (∀ v ∈ Z, ¬ (s ∈ G.skeleton.edgeSet ∧ v ∈ s)) ↔ (s ∈ G.skeleton.edgeSet + → ∀ v ∈ Z, v ∉ s) := fun s => by + constructor + · exact fun h hs v hv hm => h v hv ⟨hs, hm⟩ + · exact fun h v hv hm => h hm.1 v hv hm.2 + refine Hypergraph.ext rfl ?_ ?_ + · ext s + change s ∈ (quotientVertices G Z).skeleton.edgeSet ↔ s ∈ G.skeleton.edgeSet ∧ ∀ v ∈ Z, ¬ + (s ∈ G.skeleton.edgeSet ∧ v ∈ s) + rw [mem_skeleton_quotient, hI] + exact ⟨fun h => ⟨h.1, fun _ => h.2⟩, fun h => ⟨h.1, h.2 h.1⟩⟩ + · funext s v + apply propext + change (s ∈ (quotientVertices G Z).skeleton.edgeSet ∧ v ∈ s) ↔ ((s ∈ G.skeleton.edgeSet + ∧ v ∈ s) ∧ ∀ w ∈ Z, ¬ (s ∈ G.skeleton.edgeSet ∧ w ∈ s)) + rw [mem_skeleton_quotient, hI] + exact ⟨fun h => ⟨⟨h.1.1, h.2⟩, fun _ => h.1.2⟩, fun h => ⟨⟨h.1.1, h.2 h.1.1⟩, h.1.2⟩⟩ + +theorem oneSkeleton_isGraph (G : Hypergraph α β) : (oneSkeletonHypergraph G).IsGraph := by + intro s hs + induction s using Sym2.ind with + | _ x y => + have hend : (oneSkeletonHypergraph G).ends s(x, y) ⊆ {x, y} := fun w hw => by + have hw' : w ∈ s(x, y) := hw.2 + rcases Sym2.mem_iff.mp hw' with rfl | rfl + · exact .inl rfl + · exact .inr rfl + refine ⟨⟨x, hs, Sym2.mem_mk_left _ _⟩, ?_⟩ + calc ((oneSkeletonHypergraph G).ends s(x, y)).ncard ≤ ({x, y} : Set α).ncard + := ncard_le_ncard hend (by simp) + _ ≤ 2 := ncard_insert_le _ _ |>.trans (by simp) + +/-- The 1-skeleton has the same simple graph. -/ +theorem skeleton_oneSkeleton (G : Hypergraph α β) : (oneSkeletonHypergraph G).skeleton = G.skeleton + := by + ext x y + constructor + · rintro ⟨hne, s, hx, hy⟩ + induction s using Sym2.ind with + | _ u v => + have hadj : G.skeleton.Adj u v := hx.1 + rcases Sym2.mem_iff.mp hx.2 with rfl | rfl <;> rcases Sym2.mem_iff.mp hy.2 with rfl | rfl + · exact absurd rfl hne + · exact hadj + · exact hadj.symm + · exact absurd rfl hne + · intro h + exact ⟨h.1, s(x, y), ⟨h, Sym2.mem_mk_left _ _⟩, ⟨h, Sym2.mem_mk_right _ _⟩⟩ + +/-- A separation of `G` in `𝒯`, of order below `θ*`, gives a separation of `G*` in `𝒯*` with the +same vertex sets. -/ +theorem oneSkeleton_mem {G : Hypergraph α β} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ θs : ℕ} + (h𝒯 : IsTangle G θ 𝒯) {A B : Hypergraph α β} (h : (A, B) ∈ 𝒯) + (ho : separationOrder A B < θs) : + (oneSkeletonHypergraph A, (oneSkeletonHypergraph B).deleteEdges (oneSkeletonHypergraph + A).edgeSet) ∈ oneSkeletonTangle G 𝒯 θs := + ⟨isSeparation_oneSkeleton (h𝒯.isSeparation h), ho, (A, B), h, rfl, rfl⟩ + +/-- The tangle `𝒯*` controls no more than `𝒯` does: step (1) of the proof of (14.2) (page 209). -/ +theorem controlsMinor_of_oneSkeleton {α' β' : Type} {G : Hypergraph α β} {H : Hypergraph α' β'} {𝒯 + : Set (Hypergraph α β × Hypergraph α β)} {θ θs : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (hle : H.vertexSet.ncard ≤ θs) (hc : ControlsMinor + (oneSkeletonHypergraph G) (oneSkeletonTangle G 𝒯 θs) H) : ControlsMinor G 𝒯 H := by + obtain ⟨hH, av, ae', ae, h₁, h₂, h₃, h₄, h₅, h₆, h₇⟩ := hc + rw [skeleton_oneSkeleton] at h₁ h₃ + refine ⟨hH, av, ae', ae, h₁, h₂, h₃, h₄, h₅, h₆, fun A B hm ho v hv => ?_⟩ + exact h₇ (oneSkeleton_mem h𝒯 hm (lt_of_lt_of_le ho hle)) ho v hv + +theorem separationOrder_quotient {A B : Hypergraph α β} {Z : Set α} (hZ : Z ⊆ (A ∩ B).vertexSet) : + separationOrder (quotientVertices A Z) (quotientVertices B Z) + Z.ncard = separationOrder A B + := separationOrder_deleteVertices hZ + +/-- A separation in `𝒯 / Z / Y` of small order is below a separation in `𝒯* \ Z / Y`. The paper +leaves this step of (14.2) to the reader. -/ +theorem quotient_dom {G : Hypergraph α β} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ θs : ℕ} + (h𝒯 : IsTangle G θ 𝒯) {Z Y : Set α} + {A B : Hypergraph α β} (hm : (A, B) ∈ quotientTangle (quotientVertices G Z) + (quotientTangle G 𝒯 Z) Y) + (hord : separationOrder A B + Y.ncard + Z.ncard < θs) : + ∃ A' B', (A', B') ∈ quotientTangle ((oneSkeletonHypergraph G).deleteVertices Z) + (deleteVerticesTangle (oneSkeletonHypergraph G) Z (oneSkeletonTangle G 𝒯 θs) θs) Y ∧ + A.vertexSet ⊆ A'.vertexSet := by + obtain ⟨-, ⟨A₀, B₀⟩, ⟨-, ⟨A₃, B₃⟩, hm₃, hZ₃, h₁, h₂⟩, hY₀, h₃, h₄⟩ := hm + dsimp only at h₁ h₂ h₃ h₄ hZ₃ hY₀ + subst h₁ h₂ h₃ h₄ + have hsep₃ := h𝒯.isSeparation hm₃ + have e₁ := separationOrder_quotient hZ₃ + have e₂ := separationOrder_quotient hY₀ + have ho : separationOrder A₃ B₃ < θs := by omega + have hm₅ := oneSkeleton_mem h𝒯 hm₃ ho + set A₅ := oneSkeletonHypergraph A₃ + set B₅ := (oneSkeletonHypergraph B₃).deleteEdges (oneSkeletonHypergraph A₃).edgeSet + have hsepd := isSeparation_deleteVertices (isSeparation_oneSkeleton hsep₃) Z + have hZ₅ : Z ⊆ (A₅ ∩ B₅).vertexSet := hZ₃ + have e₃ := separationOrder_deleteVertices hZ₅ + have e₄ : separationOrder A₅ B₅ = separationOrder A₃ B₃ := rfl + refine ⟨quotientVertices (A₅.deleteVertices Z) Y, quotientVertices (B₅.deleteVertices Z) Y, + ⟨GM10.IsSeparation.quotientVertices hsepd Y, (A₅.deleteVertices Z, B₅.deleteVertices Z), + ⟨hsepd, ?_, (A₅, B₅), hm₅, hZ₅, rfl, rfl⟩, hY₀, rfl, rfl⟩, subset_rfl⟩ + dsimp only + omega + +/-- A cell small for the embodiment of `𝒯* \ Z` lies in a separation of `𝒯 / Z`: step (2) of the +proof of (14.2) (page 210). -/ +theorem embodiment_dom {G : Hypergraph α β} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ θs θ₂ : + ℕ} (h𝒯 : IsTangle G θ 𝒯) {Z : Set α} + {A B : Hypergraph α β} + (hm : (A, B) ∈ embodimentTangle (quotientVertices G Z) (deleteVerticesTangle + (oneSkeletonHypergraph G) Z (oneSkeletonTangle G 𝒯 θs) θs) θ₂) : + ∃ A' B', (A', B') ∈ quotientTangle G 𝒯 Z ∧ A.vertexSet ⊆ A'.vertexSet := by + obtain ⟨-, -, B₁, -, -, ⟨A₂, B₂⟩, hm₂, hZ₂, h₁, -⟩ := hm + obtain ⟨-, -, ⟨A₃, B₃⟩, hm₃, hv₁, hv₂⟩ := hm₂ + dsimp only at h₁ hZ₂ hv₁ hv₂ + have hZ₃ : Z ⊆ (A₃ ∩ B₃).vertexSet := fun v hv => ⟨hv₁ ▸ (hZ₂ hv).1, hv₂ ▸ (hZ₂ hv).2⟩ + refine ⟨quotientVertices A₃ Z, quotientVertices B₃ Z, ⟨GM10.IsSeparation.quotientVertices + (h𝒯.isSeparation hm₃) Z, (A₃, B₃), hm₃, hZ₃, rfl, rfl⟩, ?_⟩ + have h₂ : A.vertexSet = A₂.vertexSet \ Z := by + have := congrArg Hypergraph.vertexSet h₁ + exact this.symm + rw [h₂, ← hv₁] + exact subset_rfl + +theorem encard_cuffs_congr {G₁ : Hypergraph α β} {G₂ : Hypergraph α (Sym2 α)} {π₁ : Portrayal G₁} + {π₂ : Portrayal G₂} (e : π₁.S ≃ₜ π₂.S) : + (cuffs π₁.S).encard = (cuffs π₂.S).encard := by + obtain ⟨a, b, c, ⟨e₂⟩⟩ := classification π₂.S π₂.isSurface π₂.connected + rw [← π₁.finite_cuffs.cast_ncard_eq, ← π₂.finite_cuffs.cast_ncard_eq, ncard_cuffs_of_homeo e₂, + ncard_cuffs_of_homeo (e.trans e₂)] + +/-- **Graph Minors XVII, (14.2)** (page 209): "For any graph $H$ there are numbers $p, q, z$ and +$\theta > z$, such that for every hypergraph $G$ and every tangle $\mathscr{T}$ in $G$ of order $\ge +\theta$, either (i) $\mathscr{T}$ controls an $H$-minor of $G^*$, or (ii) there exists $Z \subseteq +V(G)$ with $|Z| \le z$ and a $\mathscr{T}/Z$-central portrayal $\pi = (\Sigma, \Gamma, \alpha, +\beta, \gamma)$ of $G/Z$ with warp $\le p$, such that $\Sigma$ has $\le q$ cuffs and $H$ cannot be +drawn in $\Sigma$, and $\pi$ is true and $(2p + 7)$-redundant." -/ +theorem theorem_14_2_proof {α' β' : Type} (H : Hypergraph α' β') (hH : H.IsGraph) : + ∃ p q z θ : ℕ, z < θ ∧ ∀ {α : Type u} {β : Type v} (G : Hypergraph α β) (θ' : ℕ) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)), IsTangle G θ' 𝒯 → θ ≤ θ' → + ControlsMinor G 𝒯 H ∨ ∃ Z ⊆ G.vertexSet, Z.ncard ≤ z ∧ + ∃ π : Portrayal (quotientVertices G Z), π.warp ≤ p ∧ (cuffs π.S).encard ≤ q ∧ + ¬ CanBeDrawn π.S H ∧ π.IsTrue (quotientTangle G 𝒯 Z) ∧ + π.IsRedundant (quotientTangle G 𝒯 Z) (θ' - Z.ncard) (2 * p + 7) := by + obtain ⟨p, q, z, θ₀, hz, h4⟩ := theorem_13_4_proof H hH (fun _ _ p _ => 2 * p + 7) + (fun _ _ _ _ _ _ _ _ _ _ _ => rfl) + set θs := H.vertexSet.ncard + θ₀ + 4 * p + z + 10 with hθs + refine ⟨p, q, z, 3 * θs, by omega, ?_⟩ + intro α β G θ' 𝒯 h𝒯 hθ + by_cases hctrl : ControlsMinor G 𝒯 H + · exact .inl hctrl + refine .inr ?_ + have hts : IsTangle (oneSkeletonHypergraph G) θs (oneSkeletonTangle G 𝒯 θs) := theorem_14_1_proof + (by omega) (by omega) h𝒯 + rcases h4 (oneSkeletonHypergraph G) (oneSkeleton_isGraph G) θs _ hts + (by omega) with hc | ⟨Z, hZ, hcZ, π₁, hw, hcu, hdr, htrue, hred⟩ + · exact absurd (controlsMinor_of_oneSkeleton h𝒯 (by omega) hc) hctrl + have hp : 1 ≤ p := π₁.one_le_warp.trans hw + have hmax : max 3 (2 * p + 2) = 2 * p + 2 := by omega + have hZG : Z ⊆ G.vertexSet := hZ + have hts₁ := GM10.theorem_8_5_proof (oneSkeleton_isGraph G) hts hZ (by omega) + set T' := deleteVerticesTangle (oneSkeletonHypergraph G) Z (oneSkeletonTangle G 𝒯 θs) θs with hT' + obtain ⟨π₁', e₁, hts', hcen', hw', hred'⟩ : ∃ π₁' : Portrayal (oneSkeletonHypergraph + (quotientVertices G Z)), Nonempty (π₁'.S ≃ₜ π₁.S) ∧ + IsTangle (oneSkeletonHypergraph (quotientVertices G Z)) (θs - Z.ncard) T' ∧ π₁'.IsCentral T' + ∧ π₁'.warp ≤ p ∧ π₁'.IsRedundant T' (θs - Z.ncard) (2 * p + 7) := by + rw [oneSkeleton_quotient] + exact ⟨π₁, ⟨Homeomorph.refl _⟩, hts₁, htrue.1, hw, hred⟩ + obtain ⟨e₁⟩ := e₁ + obtain ⟨π₂, hc₂, hres₂⟩ := theorem_12_6_proof hts' (by omega) π₁' hcen' hred' hw' + have hw₂ : π₂.warp ≤ p := by rw [hres₂.warp_eq]; exact hw' + have ht := GM10.theorem_6_2_proof h𝒯 hZG (by omega) + have hred₂ : π₂.IsRedundant (quotientTangle G 𝒯 Z) (θ' - Z.ncard) (2 * p + 7) := by + refine Portrayal.IsRedundant.of_moved ht hts' (by omega) rfl (edgesCovered_oneSkeleton _) + (by omega) hred' hw' hres₂.warpLE ?_ + intro Y _ hY A B hm ho + rw [oneSkeleton_quotient] + exact quotient_dom h𝒯 hm (by omega) + have hc₃ : π₂.IsCentral (quotientTangle G 𝒯 Z) := by + intro c hc + obtain ⟨B, hB⟩ := hc₂ c hc + obtain ⟨A', B', hm, hsub⟩ := embodiment_dom h𝒯 hB + have hle := π₂.cellGraph_le c hc + have hsmall := π₂.ncard_cell_inter_other_le hw₂ hc + have ho₀ : separationOrder (π₂.cellGraph c) (complSubhypergraph (quotientVertices G Z) + (π₂.cellGraph c)) ≤ max 3 (2 * p + 2) := by + rw [separationOrder_complSubhypergraph] + exact (ncard_le_ncard (π₂.attachments_cellGraph_subset_otherVertices hc) + ((π₂.cellGraph c).vertexSet_finite.inter_of_left _)).trans hsmall + exact ⟨_, GM10.theorem_2_9_proof ht hm (isSeparation_complSubhypergraph hle) (by omega) (.inr + (.inl hsub))⟩ + obtain ⟨π, htrue', hres, hred₃⟩ := exists_true_resembling ht hc₃ hred₂ + obtain ⟨ψ, -⟩ := id hres + obtain ⟨ψ₂, -⟩ := id hres₂ + have hS : π.S ≃ₜ π₁.S := ψ.trans (ψ₂.trans e₁) + refine ⟨Z, hZG, hcZ, π, by rwa [hres.warp_eq], ?_, + fun hd => hdr (GM20.Draw.CanBeDrawn.map hS hd), htrue', hred₃⟩ + rw [encard_cuffs_congr hS] + exact hcu + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section2.lean b/LeanPool/GraphMinor/GM17/Section2.lean new file mode 100644 index 0000000000..13de21d4bb --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section2.lean @@ -0,0 +1,840 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CuffOrder +public import LeanPool.GraphMinor.GM10.TangleLemmas + +import LeanPool.GraphMinor.Surface.Cuffs + +/-! +# Sections 2 and 3 of Graph Minors XVII: Portrayals, (2.1), and Warp + +This file formalizes Sections 2 and 3 (pages 165–169) of N. Robertson and P. D. Seymour, +*Graph Minors. XVII. Taming a vortex*, J. Combin. Theory Ser. B 77 (1999) 162–210: +- Basic properties of `Portrayal.borderPlus`, `Portrayal.gammaImage`, `Portrayal.cellsUnion`, + `Portrayal.otherCellsGraph`, and `Portrayal.areaGraph`. +- Theorem (2.1) (`theorem_2_1`, pages 166–168), characterizing the intersection of `cellsUnion I₁` + and `cellsUnion I₂` for a partition `(I₁, I₂)` of `C(Γ)`, with its subproof claims (1), (2), (3). +- Basic properties of cell warp (`CellWarpLE`, `cellWarp`), cuff warp (`warpAt`), and portrayal + warp (`warp`) from Section 3 (page 168). +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +/-! ## 1. Basic Lemmas on Portrayals -/ + +namespace Portrayal + +variable {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) + +theorem mem_borderPlus_iff {n : π.S} {v : α} : + v ∈ π.borderPlus n ↔ v ∈ π.borderSet n ∨ (n ∈ π.domγ ∧ v = π.nodeVertex n) := + Iff.rfl + +theorem borderSet_subset_borderPlus (n : π.S) : π.borderSet n ⊆ π.borderPlus n := + fun _ hv => Or.inl hv + +theorem nodeVertex_mem_borderPlus {n : π.S} (hn : n ∈ π.domγ) : + π.nodeVertex n ∈ π.borderPlus n := + Or.inr ⟨hn, rfl⟩ + +theorem borderPlus_eq_borderSet {n : π.S} (hn : n ∉ π.domγ) : + π.borderPlus n = π.borderSet n := by + ext v + simp only [borderPlus, mem_ofPred_eq, hn, false_and, or_false] + +theorem borderPlus_eq_insert {n : π.S} (hn : n ∈ π.domγ) : + π.borderPlus n = insert (π.nodeVertex n) (π.borderSet n) := by + ext v + simp only [borderPlus, mem_ofPred_eq, hn, true_and, mem_insert_iff, or_comm] + +theorem borderSet_finite {n : π.S} (hn : n ∈ π.Γ.N ∩ bd π.S) : + (π.borderSet n).Finite := + G.vertexSet_finite.subset (π.borderSet_subset n hn) + +theorem borderPlus_subset_vertexSet {n : π.S} (hn : n ∈ π.Γ.N ∩ bd π.S) : + π.borderPlus n ⊆ G.vertexSet := by + rintro v (hv | ⟨hdom, rfl⟩) + · exact π.borderSet_subset n hn hv + · exact π.nodeVertex_mem n hdom + +theorem borderPlus_finite {n : π.S} (hn : n ∈ π.Γ.N ∩ bd π.S) : + (π.borderPlus n).Finite := + G.vertexSet_finite.subset (π.borderPlus_subset_vertexSet hn) + +theorem ncard_borderPlus_of_mem_domγ {n : π.S} (hdom : n ∈ π.domγ) (hbd : n ∈ bd π.S) : + (π.borderPlus n).ncard = (π.borderSet n).ncard + 1 := by + have hn : n ∈ π.Γ.N ∩ bd π.S := ⟨π.domγ_subset hdom, hbd⟩ + rw [π.borderPlus_eq_insert hdom, + ncard_insert_of_notMem (π.p3_notMem n ⟨hdom, hbd⟩) (π.borderSet_finite hn)] + +theorem ncard_borderPlus_of_notMem_domγ {n : π.S} (hdom : n ∉ π.domγ) : + (π.borderPlus n).ncard = (π.borderSet n).ncard := by + rw [π.borderPlus_eq_borderSet hdom] + +theorem ncard_borderPlus_le {n : π.S} (hn : n ∈ π.Γ.N ∩ bd π.S) : + (π.borderPlus n).ncard ≤ (π.borderSet n).ncard + 1 := by + by_cases hdom : n ∈ π.domγ + · rw [π.ncard_borderPlus_of_mem_domγ hdom hn.2] + · rw [π.ncard_borderPlus_of_notMem_domγ hdom] + omega + +theorem borderPlus_subset_cellGraph {c : Set π.S} (hc : c ∈ π.Γ.C) + (hbd : (c ∩ bd π.S).Nonempty) {n : π.S} (hn : n ∈ tilde c) : + π.borderPlus n ⊆ (π.cellGraph c).vertexSet := by + rintro v (hv | ⟨hdom, rfl⟩) + · exact π.p3_subset c hc hbd n hn hv + · exact π.p2 c hc n ⟨hn, hdom⟩ + +theorem mem_gammaImage_iff {X : Set π.S} {v : α} : + v ∈ π.gammaImage X ↔ ∃ n ∈ X ∩ π.domγ, π.nodeVertex n = v := + Iff.rfl + +theorem gammaImage_mono {X Y : Set π.S} (h : X ⊆ Y) : + π.gammaImage X ⊆ π.gammaImage Y := + image_mono (inter_subset_inter_left π.domγ h) + +theorem gammaImage_inter {X Y : Set π.S} : + π.gammaImage (X ∩ Y) = π.gammaImage X ∩ π.gammaImage Y := by + have h : (X ∩ Y) ∩ π.domγ = (X ∩ π.domγ) ∩ (Y ∩ π.domγ) := by + ext x; simp only [mem_inter_iff]; tauto + unfold gammaImage + rw [h] + exact π.nodeVertex_injOn.image_inter inter_subset_right inter_subset_right + +theorem gammaImage_tilde_subset_cellGraph {c : Set π.S} (hc : c ∈ π.Γ.C) : + π.gammaImage (tilde c) ⊆ (π.cellGraph c).vertexSet := by + rintro v ⟨n, hn, rfl⟩ + exact π.p2 c hc n hn + +theorem cellsUnion_le (I : Set (Set π.S)) : π.cellsUnion I ≤ G where + vertexSet_subset := iUnion₂_subset fun c hc => (π.cellGraph_le c hc.2).vertexSet_subset + edgeSet_subset := iUnion₂_subset fun c hc => (π.cellGraph_le c hc.2).edgeSet_subset + ends_eq e he := by + obtain ⟨c, hc, hec⟩ := mem_iUnion₂.mp he + ext v + exact ⟨fun hinc => ⟨⟨c, hc, hec⟩, hinc⟩, fun ⟨_, hinc⟩ => hinc⟩ + +theorem cellGraph_le_cellsUnion {I : Set (Set π.S)} {c : Set π.S} + (hcI : c ∈ I) (hcC : c ∈ π.Γ.C) : + π.cellGraph c ≤ π.cellsUnion I := by + rw [le_iff_of_le (π.cellGraph_le c hcC) (π.cellsUnion_le I)] + exact ⟨subset_iUnion₂ (s := fun c _ => (π.cellGraph c).vertexSet) c ⟨hcI, hcC⟩, + subset_iUnion₂ (s := fun c _ => (π.cellGraph c).edgeSet) c ⟨hcI, hcC⟩⟩ + +theorem cellsUnion_C : π.cellsUnion π.Γ.C = G := by + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq (π.cellsUnion_le π.Γ.C) le_rfl + · refine Subset.antisymm (π.cellsUnion_le π.Γ.C).vertexSet_subset ?_ + intro v hv + obtain ⟨c, hc, hvc⟩ := π.p1_vertex v hv + exact mem_iUnion₂.mpr ⟨c, ⟨hc, hc⟩, hvc⟩ + · refine Subset.antisymm (π.cellsUnion_le π.Γ.C).edgeSet_subset ?_ + intro e he + obtain ⟨c, hc, hec⟩ := π.p1_edge e he + exact mem_iUnion₂.mpr ⟨c, ⟨hc, hc⟩, hec⟩ + +theorem cellsUnion_union (I₁ I₂ : Set (Set π.S)) : + π.cellsUnion (I₁ ∪ I₂) = π.cellsUnion I₁ ∪ π.cellsUnion I₂ := by + have h1 : π.cellsUnion (I₁ ∪ I₂) ≤ G := π.cellsUnion_le (I₁ ∪ I₂) + have h2 : π.cellsUnion I₁ ∪ π.cellsUnion I₂ ≤ G := + union_le (π.cellsUnion_le I₁) (π.cellsUnion_le I₂) + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq h1 h2 + · ext v + simp only [cellsUnion, union_vertexSet, mem_union, mem_iUnion₂, mem_inter_iff] + constructor + · rintro ⟨c, ⟨hc1 | hc2, hcC⟩, h⟩ + · exact Or.inl ⟨c, ⟨hc1, hcC⟩, h⟩ + · exact Or.inr ⟨c, ⟨hc2, hcC⟩, h⟩ + · rintro (⟨c, ⟨hc1, hcC⟩, h⟩ | ⟨c, ⟨hc2, hcC⟩, h⟩) + · exact ⟨c, ⟨Or.inl hc1, hcC⟩, h⟩ + · exact ⟨c, ⟨Or.inr hc2, hcC⟩, h⟩ + · ext e + simp only [cellsUnion, union_edgeSet, mem_union, mem_iUnion₂, mem_inter_iff] + constructor + · rintro ⟨c, ⟨hc1 | hc2, hcC⟩, h⟩ + · exact Or.inl ⟨c, ⟨hc1, hcC⟩, h⟩ + · exact Or.inr ⟨c, ⟨hc2, hcC⟩, h⟩ + · rintro (⟨c, ⟨hc1, hcC⟩, h⟩ | ⟨c, ⟨hc2, hcC⟩, h⟩) + · exact ⟨c, ⟨Or.inl hc1, hcC⟩, h⟩ + · exact ⟨c, ⟨Or.inr hc2, hcC⟩, h⟩ + +theorem otherCellsGraph_vertexSet (c₀ : Set π.S) : + (π.otherCellsGraph c₀).vertexSet = π.otherVertices c₀ := by + ext v + simp only [otherCellsGraph, cellsUnion, otherVertices, mem_iUnion, mem_inter_iff, + mem_sdiff, mem_singleton_iff, mem_ofPred_eq] + tauto + +theorem p6_borderPlus {c : Set π.S} (hc : c ∈ π.Γ.C) (hbd : (c ∩ bd π.S).Nonempty) + {v : α} (hvc : v ∈ (π.cellGraph c).vertexSet) (hvo : v ∈ π.otherVertices c) : + ∃ n ∈ tilde c, v ∈ π.borderPlus n := + π.p6 c hc hbd v hvc hvo + +/-- If $v \in V(\alpha(c) \cap \alpha(-c))$ and $v \notin \gamma(\tilde{c})$, then $c$ is a border +cell and $v \in \beta(n)$ for some $n \in \tilde{c}$. -/ +theorem border_of_mem_otherVertices_notMem_gammaImage {c : Set π.S} (hc : c ∈ π.Γ.C) + {v : α} (hvc : v ∈ (π.cellGraph c).vertexSet) (hvo : v ∈ π.otherVertices c) + (hnot : v ∉ π.gammaImage (tilde c)) : + (c ∩ bd π.S).Nonempty ∧ ∃ n ∈ tilde c, v ∈ π.borderSet n := by + have hbd : (c ∩ bd π.S).Nonempty := by + by_contra hnot_bd + exact hnot (π.p5 c hc hnot_bd v hvc hvo) + obtain ⟨n, hn, hvn⟩ := π.p6_borderPlus hc hbd hvc hvo + rcases hvn with hvn | ⟨hdom, rfl⟩ + · exact ⟨hbd, n, hn, hvn⟩ + · exfalso + exact hnot ⟨n, ⟨hn, hdom⟩, rfl⟩ + +/-- If $c_1, c_2 \in C(\Gamma)$ are distinct, $c_1$ borders a cuff $\Theta$, $n_1 \in \tilde{c}_1$, +$v \in \beta(n_1) \cap V(\alpha(c_2))$, and $c_2$ does not border $\Theta$, then $c_2$ is internal +and there exists $n \in \tilde{c}_2 \cap \operatorname{dom}(\gamma) \cap \Theta$ with +$v = \gamma(n)$. +Graph Minors XVII, proof of (2.1), Claim (3) (page 167). -/ +theorem exists_node_of_not_borders_cuff {c₁ c₂ Θ : Set π.S} + (hc₁ : c₁ ∈ π.Γ.C) (hc₂ : c₂ ∈ π.Γ.C) (hne : c₁ ≠ c₂) + (hΘ : Θ ∈ cuffs π.S) (hc₁Θ : (c₁ ∩ Θ).Nonempty) (hc₂Θ : ¬ (c₂ ∩ Θ).Nonempty) + {n₁ : π.S} (hn₁ : n₁ ∈ tilde c₁) {v : α} + (hvn₁ : v ∈ π.borderSet n₁) (hvc₂ : v ∈ (π.cellGraph c₂).vertexSet) : + ¬ (c₂ ∩ bd π.S).Nonempty ∧ ∃ n ∈ tilde c₂ ∩ π.domγ, n ∈ Θ ∧ v = π.nodeVertex n := by + have hn₁Θ : n₁ ∈ π.Γ.N ∩ Θ := (π.Γ.border_cell_subset_cuff hc₁ hΘ hc₁Θ).2.2.2.1 hn₁ + have hvo₂ : v ∈ π.otherVertices c₂ := + ⟨c₁, hc₁, hne, π.p3_subset c₁ hc₁ + (by rw [(π.Γ.border_cell_subset_cuff hc₁ hΘ hc₁Θ).2.1]; exact hc₁Θ) n₁ hn₁ hvn₁⟩ + have hnot_bd₂ : ¬ (c₂ ∩ bd π.S).Nonempty := by + rintro ⟨x, hxc₂, hxbd⟩ + let Θ' := connectedComponentIn (bd π.S) x + have hΘ' : Θ' ∈ cuffs π.S := ⟨x, hxbd, rfl⟩ + have hc₂Θ' : (c₂ ∩ Θ').Nonempty := ⟨x, hxc₂, mem_connectedComponentIn hxbd⟩ + have hΘ_ne : Θ ≠ Θ' := fun h => hc₂Θ (h ▸ hc₂Θ') + obtain ⟨n₂, hn₂, hvn₂⟩ := π.p6_borderPlus hc₂ ⟨x, hxc₂, hxbd⟩ hvc₂ hvo₂ + have hn₂Θ' : n₂ ∈ π.Γ.N ∩ Θ' := (π.Γ.border_cell_subset_cuff hc₂ hΘ' hc₂Θ').2.2.2.1 hn₂ + rcases hvn₂ with hvn₂ | ⟨hdom₂, rfl⟩ + · exact Set.disjoint_left.mp (π.p4_disjoint Θ hΘ Θ' hΘ' hΘ_ne n₁ hn₁Θ n₂ hn₂Θ') hvn₁ hvn₂ + · have hn₂_not_Θ : n₂ ∉ Θ := by + intro hn₂_in_Θ + rcases hΘ with ⟨x₀, hx₀, rfl⟩ + have heq : connectedComponentIn (bd π.S) x₀ = Θ' := + (connectedComponentIn_eq hn₂_in_Θ).trans (connectedComponentIn_eq hn₂Θ'.2).symm + exact hΘ_ne heq + exact π.p4_notMem Θ hΘ n₁ hn₁Θ n₂ hdom₂ hn₂_not_Θ hvn₁ + obtain ⟨n, hn, rfl⟩ := π.p5 c₂ hc₂ hnot_bd₂ v hvc₂ hvo₂ + have hn_in_Θ : n ∈ Θ := by + by_contra hn_not_Θ + exact π.p4_notMem Θ hΘ n₁ hn₁Θ n hn.2 hn_not_Θ hvn₁ + exact ⟨hnot_bd₂, n, hn, hn_in_Θ, rfl⟩ + +end Portrayal + +/-! ## 2. Cyclic Partition Lemma on a Cuff Enumeration -/ + +private theorem cyclicDist_shift {k : ℕ} (hk : 0 < k) (base : Fin k) {u v : ℕ} + (huv : u ≤ v) (hvu : v - u < k) : + cyclicDist (⟨(base.1 + u) % k, Nat.mod_lt _ hk⟩ : Fin k) + (⟨(base.1 + v) % k, Nat.mod_lt _ hk⟩ : Fin k) = v - u := by + set r := (base.1 + u) % k + set d := v - u + have hr_lt : r < k := Nat.mod_lt _ hk + have hiv_eq : (base.1 + v) % k = (r + d) % k := by + dsimp [r, d] + have heq : base.1 + v = (base.1 + u) + (v - u) := by omega + rw [heq, Nat.mod_add_mod] + rw [cyclicDist_eq_ite] + dsimp + by_cases hrd : r + d < k + · have hiv_val : (base.1 + v) % k = r + d := hiv_eq.trans (Nat.mod_eq_of_lt hrd) + split_ifs <;> omega + · have hsub : (r + d - k) % k = r + d - k := Nat.mod_eq_of_lt (by omega) + have hadd : ((r + d - k) + k) % k = (r + d - k) % k := Nat.add_mod_right _ _ + have heq : (r + d - k) + k = r + d := by omega + have hmod_eq : ((r + d - k) + k) % k = (r + d) % k := congrArg (· % k) heq + have hiv_val : (base.1 + v) % k = r + d - k := by omega + split_ifs <;> omega + +/-- If `E` is a cuff enumeration of $\Theta$ and `(I₁, I₂)` partitions the cells on $\Theta$, with +`E.cell j₁ ∈ I₁` and `E.cell j₂ ∈ I₂`, then for any $n_1 \in \widetilde{E.\text{cell } j_1}$ and +$n_2 \in \widetilde{E.\text{cell } j_2}$ there exist indices $r_3, r_4$ such that both `E.node r₃` +and `E.node r₄` lie in $\tilde{c}_1' \cap \tilde{c}_2'$ for some border cells $c_1' \in I_1$, +$c_2' \in I_2$, and `cyclicDist a₁ r₃ + cyclicDist r₃ a₂ + cyclicDist a₂ r₄ ≤ k` where +`E.node a₁ = n₁` and `E.node a₂ = n₂`. +Graph Minors XVII, proof of (2.1), Claim (3) (page 167). -/ +theorem Painting.CuffEnumeration.exists_boundary_nodes_of_partition + {S : Type} [TopologicalSpace S] {Γ : Painting S} {Θ : Set S} {k : ℕ} + (E : Γ.CuffEnumeration Θ k) {I₁ I₂ : Set (Set S)} + (hcov : ∀ i : Fin k, E.cell i ∈ I₁ ∨ E.cell i ∈ I₂) + (hdisj : Disjoint I₁ I₂) + {j₁ j₂ : Fin k} (hj₁ : E.cell j₁ ∈ I₁) (hj₂ : E.cell j₂ ∈ I₂) + {n₁ n₂ : S} (hn₁ : n₁ ∈ tilde (E.cell j₁)) (hn₂ : n₂ ∈ tilde (E.cell j₂)) : + ∃ a₁ r₃ a₂ r₄ : Fin k, + E.node a₁ = n₁ ∧ E.node a₂ = n₂ ∧ + (∃ i₁ i₂ : Fin k, E.cell i₁ ∈ I₁ ∧ E.cell i₂ ∈ I₂ ∧ + E.node r₃ ∈ tilde (E.cell i₁) ∩ tilde (E.cell i₂)) ∧ + (∃ i₁ i₂ : Fin k, E.cell i₁ ∈ I₁ ∧ E.cell i₂ ∈ I₂ ∧ + E.node r₄ ∈ tilde (E.cell i₁) ∩ tilde (E.cell i₂)) ∧ + cyclicDist a₁ r₃ + cyclicDist r₃ a₂ + cyclicDist a₂ r₄ ≤ k := by + have hk : 2 ≤ k := E.two_le + have hk_pos : 0 < k := by omega + have hj_ne : j₁ ≠ j₂ := fun h => Set.disjoint_left.mp hdisj hj₁ (h ▸ hj₂) + set d₁₂ := cyclicDist j₁ j₂ + set d₂₁ := cyclicDist j₂ j₁ + have hd₁₂_pos : 0 < d₁₂ := cyclicDist_pos_of_ne hj_ne + have hd₂₁_pos : 0 < d₂₁ := cyclicDist_pos_of_ne hj_ne.symm + have hd_sum : d₁₂ + d₂₁ = k := by + have h1 := cyclicDist_eq_ite j₁ j₂ + have h2 := cyclicDist_eq_ite j₂ j₁ + have := j₁.2; have := j₂.2 + split_ifs at h1 h2 <;> omega + -- Step 1: find transition along forward arc from j₁ to j₂ + have hex₁ : ∃ t : ℕ, t < d₁₂ ∧ + E.cell ⟨(j₁.1 + t) % k, Nat.mod_lt _ hk_pos⟩ ∈ I₁ ∧ + E.cell ⟨(j₁.1 + (t + 1)) % k, Nat.mod_lt _ hk_pos⟩ ∈ I₂ := by + by_contra hno + push Not at hno + have hall : ∀ t ≤ d₁₂, E.cell ⟨(j₁.1 + t) % k, Nat.mod_lt _ hk_pos⟩ ∈ I₁ := by + intro t ht + induction t with + | zero => + have h0 : (⟨(j₁.1 + 0) % k, Nat.mod_lt _ hk_pos⟩ : Fin k) = j₁ := by + apply Fin.ext; dsimp; exact Nat.mod_eq_of_lt j₁.2 + rw [h0]; exact hj₁ + | succ t ih => + have ht_lt : t < d₁₂ := by omega + have hit := ih (by omega) + rcases hcov ⟨(j₁.1 + (t + 1)) % k, Nat.mod_lt _ hk_pos⟩ with h1 | h2 + · exact h1 + · exact False.elim (hno t ht_lt hit h2) + have hend := hall d₁₂ le_rfl + have h_idx : (⟨(j₁.1 + d₁₂) % k, Nat.mod_lt _ hk_pos⟩ : Fin k) = j₂ := by + apply Fin.ext; dsimp [d₁₂] + have h1 := cyclicDist_eq_ite j₁ j₂ + have := j₁.2; have := j₂.2 + split_ifs at h1 with hle + · rw [h1] + have heq : j₁.1 + (j₂.1 - j₁.1) = j₂.1 := by omega + rw [heq, Nat.mod_eq_of_lt j₂.2] + · rw [h1] + have heq : j₁.1 + (j₂.1 + k - j₁.1) = j₂.1 + k := by omega + rw [heq, Nat.add_mod_right, Nat.mod_eq_of_lt j₂.2] + rw [h_idx] at hend + exact Set.disjoint_left.mp hdisj hend hj₂ + rcases hex₁ with ⟨t₁, ht₁_lt, ht₁_I₁, ht₁_I₂⟩ + -- Step 2: find transition along forward arc from j₂ to j₁ + have hex₂ : ∃ t : ℕ, t < d₂₁ ∧ + E.cell ⟨(j₂.1 + t) % k, Nat.mod_lt _ hk_pos⟩ ∈ I₂ ∧ + E.cell ⟨(j₂.1 + (t + 1)) % k, Nat.mod_lt _ hk_pos⟩ ∈ I₁ := by + by_contra hno + push Not at hno + have hall : ∀ t ≤ d₂₁, E.cell ⟨(j₂.1 + t) % k, Nat.mod_lt _ hk_pos⟩ ∈ I₂ := by + intro t ht + induction t with + | zero => + have h0 : (⟨(j₂.1 + 0) % k, Nat.mod_lt _ hk_pos⟩ : Fin k) = j₂ := by + apply Fin.ext; dsimp; exact Nat.mod_eq_of_lt j₂.2 + rw [h0]; exact hj₂ + | succ t ih => + have ht_lt : t < d₂₁ := by omega + have hit := ih (by omega) + rcases hcov ⟨(j₂.1 + (t + 1)) % k, Nat.mod_lt _ hk_pos⟩ with h1 | h2 + · exact False.elim (hno t ht_lt hit h1) + · exact h2 + have hend := hall d₂₁ le_rfl + have h_idx : (⟨(j₂.1 + d₂₁) % k, Nat.mod_lt _ hk_pos⟩ : Fin k) = j₁ := by + apply Fin.ext; dsimp [d₂₁] + have h1 := cyclicDist_eq_ite j₂ j₁ + have := j₁.2; have := j₂.2 + split_ifs at h1 with hle + · rw [h1] + have heq : j₂.1 + (j₁.1 - j₂.1) = j₁.1 := by omega + rw [heq, Nat.mod_eq_of_lt j₁.2] + · rw [h1] + have heq : j₂.1 + (j₁.1 + k - j₂.1) = j₁.1 + k := by omega + rw [heq, Nat.add_mod_right, Nat.mod_eq_of_lt j₁.2] + rw [h_idx] at hend + exact Set.disjoint_left.mp hdisj hj₁ hend + rcases hex₂ with ⟨t₂, ht₂_lt, ht₂_I₂, ht₂_I₁⟩ + let u₁ : Fin k := ⟨(j₁.1 + t₁) % k, Nat.mod_lt _ hk_pos⟩ + let r₃ : Fin k := ⟨(j₁.1 + (t₁ + 1)) % k, Nat.mod_lt _ hk_pos⟩ + let u₂ : Fin k := ⟨(j₂.1 + t₂) % k, Nat.mod_lt _ hk_pos⟩ + let r₄ : Fin k := ⟨(j₂.1 + (t₂ + 1)) % k, Nat.mod_lt _ hk_pos⟩ + have hr₃_u₁ : r₃ = ⟨(u₁.1 + 1) % k, Nat.mod_lt _ hk_pos⟩ := by + apply Fin.ext; dsimp [r₃, u₁] + simp only [← Nat.add_assoc, Nat.mod_add_mod] + have hr₄_u₂ : r₄ = ⟨(u₂.1 + 1) % k, Nat.mod_lt _ hk_pos⟩ := by + apply Fin.ext; dsimp [r₄, u₂] + simp only [← Nat.add_assoc, Nat.mod_add_mod] + have hr₃_tilde : E.node r₃ ∈ tilde (E.cell u₁) ∩ tilde (E.cell r₃) := by + refine ⟨?_, ?_⟩ + · rw [E.cell_tilde u₁, hr₃_u₁]; exact mem_insert_of_mem _ rfl + · rw [E.cell_tilde r₃]; exact mem_insert _ _ + have hr₄_tilde : E.node r₄ ∈ tilde (E.cell r₄) ∩ tilde (E.cell u₂) := by + refine ⟨?_, ?_⟩ + · rw [E.cell_tilde r₄]; exact mem_insert _ _ + · rw [E.cell_tilde u₂, hr₄_u₂]; exact mem_insert_of_mem _ rfl + -- Step 3: identify a₁ and a₂ + rw [E.cell_tilde j₁] at hn₁ + rw [E.cell_tilde j₂] at hn₂ + have ha₁_ex : ∃ s₁ ≤ 1, ∃ a₁ : Fin k, + a₁ = ⟨(j₁.1 + s₁) % k, Nat.mod_lt _ hk_pos⟩ ∧ E.node a₁ = n₁ := by + rcases hn₁ with rfl | rfl + · refine ⟨0, by omega, j₁, ?_, rfl⟩ + apply Fin.ext; dsimp; exact (Nat.mod_eq_of_lt j₁.2).symm + · exact ⟨1, le_rfl, ⟨(j₁.1 + 1) % k, Nat.mod_lt _ hk_pos⟩, rfl, rfl⟩ + have ha₂_ex : ∃ s₂ ≤ 1, ∃ a₂ : Fin k, + a₂ = ⟨(j₂.1 + s₂) % k, Nat.mod_lt _ hk_pos⟩ ∧ E.node a₂ = n₂ := by + rcases hn₂ with rfl | rfl + · refine ⟨0, by omega, j₂, ?_, rfl⟩ + apply Fin.ext; dsimp; exact (Nat.mod_eq_of_lt j₂.2).symm + · exact ⟨1, le_rfl, ⟨(j₂.1 + 1) % k, Nat.mod_lt _ hk_pos⟩, rfl, rfl⟩ + rcases ha₁_ex with ⟨s₁, hs₁_le, a₁, ha₁_eq, ha₁_node⟩ + rcases ha₂_ex with ⟨s₂, hs₂_le, a₂, ha₂_eq, ha₂_node⟩ + refine ⟨a₁, r₃, a₂, r₄, ha₁_node, ha₂_node, + ⟨u₁, r₃, ht₁_I₁, ht₁_I₂, hr₃_tilde⟩, + ⟨r₄, u₂, ht₂_I₁, ht₂_I₂, hr₄_tilde⟩, ?_⟩ + -- Step 4: bound cyclicDist a₁ r₃ + cyclicDist r₃ a₂ + cyclicDist a₂ r₄ ≤ k + have hd₁₂_lt : d₁₂ < k := cyclicDist_lt hk_pos j₁ j₂ + have hd₂₁_lt : d₂₁ < k := cyclicDist_lt hk_pos j₂ j₁ + have hdist1 : cyclicDist a₁ r₃ = (t₁ + 1) - s₁ := by + rw [ha₁_eq] + exact cyclicDist_shift hk_pos j₁ (by omega) (by omega) + have hdist3 : cyclicDist a₂ r₄ = (t₂ + 1) - s₂ := by + rw [ha₂_eq] + exact cyclicDist_shift hk_pos j₂ (by omega) (by omega) + have ha₂_from_j₁ : a₂ = ⟨(j₁.1 + (d₁₂ + s₂)) % k, Nat.mod_lt _ hk_pos⟩ := by + rw [ha₂_eq] + apply Fin.ext; dsimp + have hj₂_eq : j₂.1 = (j₁.1 + d₁₂) % k := by + dsimp [d₁₂] + have h1 := cyclicDist_eq_ite j₁ j₂ + have := j₁.2; have := j₂.2 + split_ifs at h1 with hle + · rw [h1] + have heq : j₁.1 + (j₂.1 - j₁.1) = j₂.1 := by omega + rw [heq, Nat.mod_eq_of_lt j₂.2] + · rw [h1] + have heq : j₁.1 + (j₂.1 + k - j₁.1) = j₂.1 + k := by omega + rw [heq, Nat.add_mod_right, Nat.mod_eq_of_lt j₂.2] + rw [hj₂_eq, Nat.mod_add_mod, Nat.add_assoc] + have hdist2 : cyclicDist r₃ a₂ = (d₁₂ + s₂) - (t₁ + 1) := by + rw [ha₂_from_j₁] + exact cyclicDist_shift hk_pos j₁ (by omega) (by omega) + rw [hdist1, hdist2, hdist3] + omega + +/-! ## 3. Theorem (2.1) (Pages 166–168) -/ + +section Theorem21 + +variable {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) + +/-- Graph Minors XVII, (2.1), Claim (1) (page 167): +$\gamma(X_1 \cap X_2) \subseteq V(A_1 \cap A_2)$. -/ +theorem theorem_2_1_claim_1 {I₁ I₂ : Set (Set π.S)} + (hI₁ : I₁ ⊆ π.Γ.C) (hI₂ : I₂ ⊆ π.Γ.C) : + π.gammaImage ((⋃ c ∈ I₁, tilde c) ∩ (⋃ c ∈ I₂, tilde c)) ⊆ + (π.cellsUnion I₁ ∩ π.cellsUnion I₂).vertexSet := by + rintro v ⟨n, ⟨⟨hX₁, hX₂⟩, hdom⟩, rfl⟩ + rw [mem_iUnion₂] at hX₁ hX₂ + rcases hX₁ with ⟨c₁, hc₁I₁, hnc₁⟩ + rcases hX₂ with ⟨c₂, hc₂I₂, hnc₂⟩ + refine ⟨?_, ?_⟩ + · exact mem_iUnion₂.mpr ⟨c₁, ⟨hc₁I₁, hI₁ hc₁I₁⟩, π.p2 c₁ (hI₁ hc₁I₁) n ⟨hnc₁, hdom⟩⟩ + · exact mem_iUnion₂.mpr ⟨c₂, ⟨hc₂I₂, hI₂ hc₂I₂⟩, π.p2 c₂ (hI₂ hc₂I₂) n ⟨hnc₂, hdom⟩⟩ + +/-- Graph Minors XVII, (2.1), Claim (2) (page 167): +$\bigcup (\beta(n) : n \in Y_1 \cap Y_2) \subseteq V(A_1 \cap A_2)$. -/ +theorem theorem_2_1_claim_2 {I₁ I₂ : Set (Set π.S)} + (hI₁ : I₁ ⊆ π.Γ.C) (hI₂ : I₂ ⊆ π.Γ.C) : + (⋃ n ∈ (⋃ c ∈ {c ∈ I₁ | (c ∩ bd π.S).Nonempty}, tilde c) ∩ + (⋃ c ∈ {c ∈ I₂ | (c ∩ bd π.S).Nonempty}, tilde c), π.borderSet n) ⊆ + (π.cellsUnion I₁ ∩ π.cellsUnion I₂).vertexSet := by + intro v hv + rw [mem_iUnion₂] at hv + rcases hv with ⟨n, ⟨hY₁, hY₂⟩, hvn⟩ + rw [mem_iUnion₂] at hY₁ hY₂ + rcases hY₁ with ⟨c₁, ⟨hc₁I₁, hc₁bd⟩, hnc₁⟩ + rcases hY₂ with ⟨c₂, ⟨hc₂I₂, hc₂bd⟩, hnc₂⟩ + refine ⟨?_, ?_⟩ + · exact mem_iUnion₂.mpr ⟨c₁, ⟨hc₁I₁, hI₁ hc₁I₁⟩, + π.p3_subset c₁ (hI₁ hc₁I₁) hc₁bd n hnc₁ hvn⟩ + · exact mem_iUnion₂.mpr ⟨c₂, ⟨hc₂I₂, hI₂ hc₂I₂⟩, + π.p3_subset c₂ (hI₂ hc₂I₂) hc₂bd n hnc₂ hvn⟩ + +/-- Helper for (2.1) Claim (3) when both $c_1 \in I_1$ and $c_2 \in I_2$ border the same cuff +$\Theta$, with $v \in \beta(n_1) \cap V(\alpha(c_2))$. -/ +private theorem theorem_2_1_claim_3_same_cuff + {I₁ I₂ : Set (Set π.S)} (hcov : I₁ ∪ I₂ = π.Γ.C) (hdisj : Disjoint I₁ I₂) + {c₁ c₂ Θ : Set π.S} (hc₁I₁ : c₁ ∈ I₁) (hc₂I₂ : c₂ ∈ I₂) + (hΘ : Θ ∈ cuffs π.S) (hc₁Θ : (c₁ ∩ Θ).Nonempty) (hc₂Θ : (c₂ ∩ Θ).Nonempty) + {n₁ : π.S} (hn₁ : n₁ ∈ tilde c₁) {v : α} + (hvn₁ : v ∈ π.borderSet n₁) (hvc₂ : v ∈ (π.cellGraph c₂).vertexSet) : + v ∈ π.gammaImage ((⋃ c ∈ I₁, tilde c) ∩ (⋃ c ∈ I₂, tilde c)) ∪ + (⋃ n ∈ (⋃ c ∈ {c ∈ I₁ | (c ∩ bd π.S).Nonempty}, tilde c) ∩ + (⋃ c ∈ {c ∈ I₂ | (c ∩ bd π.S).Nonempty}, tilde c), π.borderSet n) := by + have hc₁C : c₁ ∈ π.Γ.C := hcov ▸ Or.inl hc₁I₁ + have hc₂C : c₂ ∈ π.Γ.C := hcov ▸ Or.inr hc₂I₂ + have hne : c₁ ≠ c₂ := fun h => Set.disjoint_left.mp hdisj hc₁I₁ (h ▸ hc₂I₂) + have hc₁bd : (c₁ ∩ bd π.S).Nonempty := by + rw [(π.Γ.border_cell_subset_cuff hc₁C hΘ hc₁Θ).2.1]; exact hc₁Θ + have hc₂bd : (c₂ ∩ bd π.S).Nonempty := by + rw [(π.Γ.border_cell_subset_cuff hc₂C hΘ hc₂Θ).2.1]; exact hc₂Θ + have hvo₂ : v ∈ π.otherVertices c₂ := + ⟨c₁, hc₁C, hne, π.p3_subset c₁ hc₁C hc₁bd n₁ hn₁ hvn₁⟩ + obtain ⟨n₂, hn₂, hvn₂⟩ := π.p6_borderPlus hc₂C hc₂bd hvc₂ hvo₂ + have hΘ_arc : IsOArc Θ := (GraphMinor.Surface.cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + obtain ⟨E⟩ := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + have hc₁_range : c₁ ∈ Set.range E.cell := by rw [E.range_cell]; exact ⟨hc₁C, hc₁Θ⟩ + have hc₂_range : c₂ ∈ Set.range E.cell := by rw [E.range_cell]; exact ⟨hc₂C, hc₂Θ⟩ + rcases hc₁_range with ⟨j₁, rfl⟩ + rcases hc₂_range with ⟨j₂, rfl⟩ + have hcov_E : ∀ i : Fin (π.Γ.N ∩ Θ).ncard, E.cell i ∈ I₁ ∨ E.cell i ∈ I₂ := by + intro i + have hiC : E.cell i ∈ π.Γ.C := by + have : E.cell i ∈ Set.range E.cell := mem_range_self i + rw [E.range_cell] at this + exact this.1 + rwa [← hcov] at hiC + obtain ⟨a₁, r₃, a₂, r₄, ha₁, ha₂, hr₃_mem, hr₄_mem, hdist⟩ := + E.exists_boundary_nodes_of_partition hcov_E hdisj hc₁I₁ hc₂I₂ hn₁ hn₂ + have hva₁ : v ∈ π.borderPlus (E.node a₁) := by + rw [ha₁]; exact Or.inl hvn₁ + have hva₂ : v ∈ π.borderPlus (E.node a₂) := by + rw [ha₂]; exact hvn₂ + have hv_or : v ∈ π.borderPlus (E.node r₃) ∨ v ∈ π.borderPlus (E.node r₄) := + π.p7_of_cyclicDist E hdist hva₁ hva₂ + have h_finish : ∀ r : Fin (π.Γ.N ∩ Θ).ncard, + (∃ i₁ i₂ : Fin (π.Γ.N ∩ Θ).ncard, E.cell i₁ ∈ I₁ ∧ E.cell i₂ ∈ I₂ ∧ + E.node r ∈ tilde (E.cell i₁) ∩ tilde (E.cell i₂)) → + v ∈ π.borderPlus (E.node r) → + v ∈ π.gammaImage ((⋃ c ∈ I₁, tilde c) ∩ (⋃ c ∈ I₂, tilde c)) ∪ + (⋃ n ∈ (⋃ c ∈ {c ∈ I₁ | (c ∩ bd π.S).Nonempty}, tilde c) ∩ + (⋃ c ∈ {c ∈ I₂ | (c ∩ bd π.S).Nonempty}, tilde c), π.borderSet n) := by + rintro r ⟨i₁, i₂, hi₁I₁, hi₂I₂, hnr₁, hnr₂⟩ hvr + have hi₁_range : E.cell i₁ ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self i₁ + have hi₂_range : E.cell i₂ ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self i₂ + have hi₁_bd : (E.cell i₁ ∩ bd π.S).Nonempty := by + rw [(π.Γ.border_cell_subset_cuff hi₁_range.1 hΘ hi₁_range.2).2.1]; exact hi₁_range.2 + have hi₂_bd : (E.cell i₂ ∩ bd π.S).Nonempty := by + rw [(π.Γ.border_cell_subset_cuff hi₂_range.1 hΘ hi₂_range.2).2.1]; exact hi₂_range.2 + rcases hvr with hvr_b | ⟨hdom, rfl⟩ + · right + refine mem_iUnion₂.mpr ⟨E.node r, ⟨?_, ?_⟩, hvr_b⟩ + · exact mem_iUnion₂.mpr ⟨E.cell i₁, ⟨hi₁I₁, hi₁_bd⟩, hnr₁⟩ + · exact mem_iUnion₂.mpr ⟨E.cell i₂, ⟨hi₂I₂, hi₂_bd⟩, hnr₂⟩ + · left + refine ⟨E.node r, ⟨⟨?_, ?_⟩, hdom⟩, rfl⟩ + · exact mem_iUnion₂.mpr ⟨E.cell i₁, hi₁I₁, hnr₁⟩ + · exact mem_iUnion₂.mpr ⟨E.cell i₂, hi₂I₂, hnr₂⟩ + rcases hv_or with h3 | h4 + · exact h_finish r₃ hr₃_mem h3 + · exact h_finish r₄ hr₄_mem h4 + +/-- Helper for (2.1) Claim (3) when $c_1 \in I_1$ borders a cuff $\Theta$, $n_1 \in \tilde{c}_1$, +$v \in \beta(n_1)$, and $c_2 \in I_2$ satisfies $v \in V(\alpha(c_2))$. -/ +private theorem theorem_2_1_claim_3_of_border + {I₁ I₂ : Set (Set π.S)} (hcov : I₁ ∪ I₂ = π.Γ.C) (hdisj : Disjoint I₁ I₂) + {c₁ c₂ : Set π.S} (hc₁I₁ : c₁ ∈ I₁) (hc₂I₂ : c₂ ∈ I₂) + (hc₁bd : (c₁ ∩ bd π.S).Nonempty) {n₁ : π.S} (hn₁ : n₁ ∈ tilde c₁) + {v : α} (hvn₁ : v ∈ π.borderSet n₁) (hvc₂ : v ∈ (π.cellGraph c₂).vertexSet) : + v ∈ π.gammaImage ((⋃ c ∈ I₁, tilde c) ∩ (⋃ c ∈ I₂, tilde c)) ∪ + (⋃ n ∈ (⋃ c ∈ {c ∈ I₁ | (c ∩ bd π.S).Nonempty}, tilde c) ∩ + (⋃ c ∈ {c ∈ I₂ | (c ∩ bd π.S).Nonempty}, tilde c), π.borderSet n) := by + have hc₁C : c₁ ∈ π.Γ.C := hcov ▸ Or.inl hc₁I₁ + have hc₂C : c₂ ∈ π.Γ.C := hcov ▸ Or.inr hc₂I₂ + have hne : c₁ ≠ c₂ := fun h => Set.disjoint_left.mp hdisj hc₁I₁ (h ▸ hc₂I₂) + rcases hc₁bd with ⟨x, hxc₁, hxbd⟩ + let Θ := connectedComponentIn (bd π.S) x + have hΘ : Θ ∈ cuffs π.S := ⟨x, hxbd, rfl⟩ + have hc₁Θ : (c₁ ∩ Θ).Nonempty := ⟨x, hxc₁, mem_connectedComponentIn hxbd⟩ + by_cases hc₂Θ : (c₂ ∩ Θ).Nonempty + · exact theorem_2_1_claim_3_same_cuff π hcov hdisj hc₁I₁ hc₂I₂ hΘ hc₁Θ hc₂Θ hn₁ hvn₁ hvc₂ + · obtain ⟨_, n, ⟨hnc₂, hdom⟩, hnΘ, rfl⟩ := + π.exists_node_of_not_borders_cuff hc₁C hc₂C hne hΘ hc₁Θ hc₂Θ hn₁ hvn₁ hvc₂ + have hΘ_arc : IsOArc Θ := (GraphMinor.Surface.cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + obtain ⟨E⟩ := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + have hn_range : n ∈ Set.range E.node := by + rw [E.range_node] + exact ⟨π.domγ_subset hdom, hnΘ⟩ + rcases hn_range with ⟨i, hi_eq⟩ + let c := E.cell i + have hc_range : c ∈ {c' ∈ π.Γ.C | (c' ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self i + have hnc : n ∈ tilde c := by + rw [E.cell_tilde i, ← hi_eq] + exact mem_insert _ _ + have hvc : π.nodeVertex n ∈ (π.cellGraph c).vertexSet := π.p2 c hc_range.1 n ⟨hnc, hdom⟩ + have hc_mem : c ∈ I₁ ∪ I₂ := hcov.symm ▸ hc_range.1 + rcases hc_mem with hcI₁ | hcI₂ + · left + refine ⟨n, ⟨⟨?_, ?_⟩, hdom⟩, rfl⟩ + · exact mem_iUnion₂.mpr ⟨c, hcI₁, hnc⟩ + · exact mem_iUnion₂.mpr ⟨c₂, hc₂I₂, hnc₂⟩ + · exact theorem_2_1_claim_3_same_cuff π hcov hdisj hc₁I₁ hcI₂ + hΘ hc₁Θ hc_range.2 hn₁ hvn₁ hvc + +/-- Graph Minors XVII, (2.1), Claim (3) (pages 167–168): +$V(A_1 \cap A_2) \subseteq \gamma(X_1 \cap X_2) \cup \bigcup (\beta(n) : n \in Y_1 \cap Y_2)$. -/ +theorem theorem_2_1_claim_3 + {I₁ I₂ : Set (Set π.S)} (hcov : I₁ ∪ I₂ = π.Γ.C) (hdisj : Disjoint I₁ I₂) : + (π.cellsUnion I₁ ∩ π.cellsUnion I₂).vertexSet ⊆ + π.gammaImage ((⋃ c ∈ I₁, tilde c) ∩ (⋃ c ∈ I₂, tilde c)) ∪ + (⋃ n ∈ (⋃ c ∈ {c ∈ I₁ | (c ∩ bd π.S).Nonempty}, tilde c) ∩ + (⋃ c ∈ {c ∈ I₂ | (c ∩ bd π.S).Nonempty}, tilde c), π.borderSet n) := by + rintro v ⟨hv₁, hv₂⟩ + rw [Portrayal.cellsUnion, mem_iUnion₂] at hv₁ hv₂ + rcases hv₁ with ⟨c₁, ⟨hc₁I₁, hc₁C⟩, hvc₁⟩ + rcases hv₂ with ⟨c₂, ⟨hc₂I₂, hc₂C⟩, hvc₂⟩ + have hne : c₁ ≠ c₂ := fun h => Set.disjoint_left.mp hdisj hc₁I₁ (h ▸ hc₂I₂) + by_cases hγ₁ : v ∈ π.gammaImage (tilde c₁) + · by_cases hγ₂ : v ∈ π.gammaImage (tilde c₂) + · left + have h_inter : v ∈ π.gammaImage (tilde c₁ ∩ tilde c₂) := by + rw [π.gammaImage_inter] + exact ⟨hγ₁, hγ₂⟩ + refine π.gammaImage_mono ?_ h_inter + intro n ⟨hnc₁, hnc₂⟩ + exact ⟨mem_iUnion₂.mpr ⟨c₁, hc₁I₁, hnc₁⟩, mem_iUnion₂.mpr ⟨c₂, hc₂I₂, hnc₂⟩⟩ + · have hvo₂ : v ∈ π.otherVertices c₂ := ⟨c₁, hc₁C, hne, hvc₁⟩ + obtain ⟨hc₂bd, n₂, hn₂, hvn₂⟩ := + π.border_of_mem_otherVertices_notMem_gammaImage hc₂C hvc₂ hvo₂ hγ₂ + have hcov' : I₂ ∪ I₁ = π.Γ.C := by rw [Set.union_comm, hcov] + have hsymm := theorem_2_1_claim_3_of_border π hcov' hdisj.symm hc₂I₂ hc₁I₁ + hc₂bd hn₂ hvn₂ hvc₁ + rw [Set.inter_comm (⋃ c ∈ I₂, tilde c), + Set.inter_comm (⋃ c ∈ {c ∈ I₂ | (c ∩ bd π.S).Nonempty}, tilde c)] at hsymm + exact hsymm + · have hvo₁ : v ∈ π.otherVertices c₁ := ⟨c₂, hc₂C, hne.symm, hvc₂⟩ + obtain ⟨hc₁bd, n₁, hn₁, hvn₁⟩ := + π.border_of_mem_otherVertices_notMem_gammaImage hc₁C hvc₁ hvo₁ hγ₁ + exact theorem_2_1_claim_3_of_border π hcov hdisj hc₁I₁ hc₂I₂ hc₁bd hn₁ hvn₁ hvc₂ + +/-- **Graph Minors XVII, (2.1)** (page 166): +Given a portrayal $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ of $G$, let $(I_1, I_2)$ be a +partition of $C(\Gamma)$, and let $A_i = \bigcup (\alpha(c) : c \in I_i)$ for $i = 1, 2$. Then +$E(A_1 \cap A_2) = \emptyset$, and +$$V(A_1 \cap A_2) = \bigcup (\gamma(\tilde{c}_1) \cap \gamma(\tilde{c}_2) : c_1 \in I_1, c_2 \in +I_2) + \cup \bigcup (\beta(n) : \exists \text{ border cells } c_1 \in I_1, c_2 \in I_2 \text{ with } + n \in \tilde{c}_1 \cap \tilde{c}_2).$$ -/ +theorem theorem_2_1_proof + {I₁ I₂ : Set (Set π.S)} (hcov : I₁ ∪ I₂ = π.Γ.C) (hdisj : Disjoint I₁ I₂) : + (π.cellsUnion I₁ ∩ π.cellsUnion I₂).edgeSet = ∅ ∧ + (π.cellsUnion I₁ ∩ π.cellsUnion I₂).vertexSet = + (⋃ c₁ ∈ I₁, ⋃ c₂ ∈ I₂, π.gammaImage (tilde c₁) ∩ π.gammaImage (tilde c₂)) ∪ + (⋃ n ∈ {n : π.S | ∃ c₁ ∈ I₁, (c₁ ∩ bd π.S).Nonempty ∧ + ∃ c₂ ∈ I₂, (c₂ ∩ bd π.S).Nonempty ∧ n ∈ tilde c₁ ∩ tilde c₂}, π.borderSet n) := by + have hI₁ : I₁ ⊆ π.Γ.C := hcov ▸ subset_union_left + have hI₂ : I₂ ⊆ π.Γ.C := hcov ▸ subset_union_right + refine ⟨?_, ?_⟩ + · ext e + simp only [inter_edgeSet, Portrayal.cellsUnion, mem_inter_iff, mem_iUnion, + mem_empty_iff_false, iff_false, not_and] + rintro ⟨c₁, ⟨hc₁I₁, hc₁C⟩, he₁⟩ ⟨c₂, ⟨hc₂I₂, hc₂C⟩, he₂⟩ + have hne : c₁ ≠ c₂ := fun h => Set.disjoint_left.mp hdisj hc₁I₁ (h ▸ hc₂I₂) + exact Set.disjoint_left.mp (π.p1_disjoint c₁ hc₁C c₂ hc₂C hne) he₁ he₂ + · have h_eq_X : π.gammaImage ((⋃ c ∈ I₁, tilde c) ∩ (⋃ c ∈ I₂, tilde c)) = + ⋃ c₁ ∈ I₁, ⋃ c₂ ∈ I₂, π.gammaImage (tilde c₁) ∩ π.gammaImage (tilde c₂) := by + ext v + simp only [← π.gammaImage_inter, Portrayal.mem_gammaImage_iff, mem_iUnion] + constructor + · rintro ⟨n, ⟨⟨hX₁, hX₂⟩, hdom⟩, rfl⟩ + rw [mem_iUnion₂] at hX₁ hX₂ + rcases hX₁ with ⟨c₁, hc₁, hnc₁⟩ + rcases hX₂ with ⟨c₂, hc₂, hnc₂⟩ + exact ⟨c₁, hc₁, c₂, hc₂, n, ⟨⟨hnc₁, hnc₂⟩, hdom⟩, rfl⟩ + · rintro ⟨c₁, hc₁, c₂, hc₂, n, ⟨⟨hnc₁, hnc₂⟩, hdom⟩, rfl⟩ + exact ⟨n, ⟨⟨mem_iUnion₂.mpr ⟨c₁, hc₁, hnc₁⟩, mem_iUnion₂.mpr ⟨c₂, hc₂, hnc₂⟩⟩, hdom⟩, rfl⟩ + have h_eq_Y : (⋃ n ∈ (⋃ c ∈ {c ∈ I₁ | (c ∩ bd π.S).Nonempty}, tilde c) ∩ + (⋃ c ∈ {c ∈ I₂ | (c ∩ bd π.S).Nonempty}, tilde c), π.borderSet n) = + ⋃ n ∈ {n : π.S | ∃ c₁ ∈ I₁, (c₁ ∩ bd π.S).Nonempty ∧ + ∃ c₂ ∈ I₂, (c₂ ∩ bd π.S).Nonempty ∧ n ∈ tilde c₁ ∩ tilde c₂}, π.borderSet n := by + ext v + simp only [mem_iUnion, mem_inter_iff, mem_ofPred_eq] + tauto + rw [← h_eq_X, ← h_eq_Y] + exact Subset.antisymm (theorem_2_1_claim_3 π hcov hdisj) + (union_subset (theorem_2_1_claim_1 π hI₁ hI₂) (theorem_2_1_claim_2 π hI₁ hI₂)) + +/-- For any partition $(I_1, I_2)$ of $C(\Gamma)$, $(\bigcup_{c \in I_1} \alpha(c), +\bigcup_{c \in I_2} \alpha(c))$ is a separation of $G$. -/ +theorem Portrayal.isSeparation_cellsUnion {I₁ I₂ : Set (Set π.S)} + (hcov : I₁ ∪ I₂ = π.Γ.C) (hdisj : Disjoint I₁ I₂) : + G.IsSeparation (π.cellsUnion I₁) (π.cellsUnion I₂) where + left_le := π.cellsUnion_le I₁ + right_le := π.cellsUnion_le I₂ + union_eq := by + rw [← π.cellsUnion_union, hcov, π.cellsUnion_C] + edgeSet_inter_eq := by + ext e + simp only [inter_edgeSet, Portrayal.cellsUnion, mem_inter_iff, mem_iUnion, + mem_empty_iff_false, iff_false, not_and] + rintro ⟨c₁, ⟨hc₁I₁, hc₁C⟩, he₁⟩ ⟨c₂, ⟨hc₂I₂, hc₂C⟩, he₂⟩ + have hne : c₁ ≠ c₂ := fun h => Set.disjoint_left.mp hdisj hc₁I₁ (h ▸ hc₂I₂) + exact Set.disjoint_left.mp (π.p1_disjoint c₁ hc₁C c₂ hc₂C hne) he₁ he₂ + +end Theorem21 + +/-! ## 4. Properties of Warp (Section 3, Page 169) -/ + +namespace Portrayal + +variable {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) + +theorem cellWarpLE_mono {c : Set π.S} (hc : c ∈ π.Γ.C) (hbd : (c ∩ bd π.S).Nonempty) + {p q : ℕ} (hp : π.CellWarpLE c p) (hpq : p ≤ q) : + π.CellWarpLE c q := by + rcases eq_or_lt_of_le hpq with rfl | hlt + · exact hp + · intro n₁ hn₁ n₂ hn₂ hne + obtain ⟨h1, h2, _⟩ := hp n₁ hn₁ n₂ hn₂ hne + refine ⟨h1.trans hpq, h2.trans hpq, fun hplus₁ _ => ?_⟩ + obtain ⟨u, v, _, htilde, _, _, hu, hv⟩ := π.Γ.border_cell_exists_ends hc hbd + have hn₁_mem : n₁ ∈ π.Γ.N ∩ bd π.S := by + rw [htilde] at hn₁ + rcases hn₁ with rfl | rfl + · exact hu + · exact hv + have hle := π.ncard_borderPlus_le hn₁_mem + omega + +theorem cellWarpLE_ncard_vertexSet {c : Set π.S} (hc : c ∈ π.Γ.C) (hbd : (c ∩ bd π.S).Nonempty) : + π.CellWarpLE c G.vertexSet.ncard := by + intro n₁ hn₁ n₂ hn₂ _ + obtain ⟨u, v, _, htilde, _, _, hu, hv⟩ := π.Γ.border_cell_exists_ends hc hbd + have hn₁_mem : n₁ ∈ π.Γ.N ∩ bd π.S := by + rw [htilde] at hn₁; rcases hn₁ with rfl | rfl <;> assumption + have hn₂_mem : n₂ ∈ π.Γ.N ∩ bd π.S := by + rw [htilde] at hn₂; rcases hn₂ with rfl | rfl <;> assumption + have h1 : (π.borderSet n₁).ncard ≤ G.vertexSet.ncard := + ncard_le_ncard (π.borderSet_subset n₁ hn₁_mem) G.vertexSet_finite + have h2 : (π.borderSet n₂).ncard ≤ G.vertexSet.ncard := + ncard_le_ncard (π.borderSet_subset n₂ hn₂_mem) G.vertexSet_finite + refine ⟨h1, h2, fun hplus₁ _ => ?_⟩ + have hle : (π.borderPlus n₁).ncard ≤ G.vertexSet.ncard := + ncard_le_ncard (π.borderPlus_subset_vertexSet hn₁_mem) G.vertexSet_finite + omega + +theorem cellWarp_spec {c : Set π.S} (hc : c ∈ π.Γ.C) (hbd : (c ∩ bd π.S).Nonempty) : + π.CellWarpLE c (π.cellWarp c) := by + have hne : {p | π.CellWarpLE c p}.Nonempty := + ⟨G.vertexSet.ncard, π.cellWarpLE_ncard_vertexSet hc hbd⟩ + exact Nat.sInf_mem hne + +theorem cellWarp_le_iff {c : Set π.S} (hc : c ∈ π.Γ.C) (hbd : (c ∩ bd π.S).Nonempty) {p : ℕ} : + π.cellWarp c ≤ p ↔ π.CellWarpLE c p := + ⟨fun h => π.cellWarpLE_mono hc hbd (π.cellWarp_spec hc hbd) h, + fun h => Nat.sInf_le h⟩ + +theorem ncard_borderSet_le_cellWarp {c : Set π.S} (hc : c ∈ π.Γ.C) (hbd : (c ∩ bd π.S).Nonempty) + {n : π.S} (hn : n ∈ tilde c) : + (π.borderSet n).ncard ≤ π.cellWarp c := by + obtain ⟨u, v, huv, htilde, _, _, _, _⟩ := π.Γ.border_cell_exists_ends hc hbd + have hu : u ∈ tilde c := htilde ▸ mem_insert u {v} + have hv : v ∈ tilde c := htilde ▸ mem_insert_of_mem u rfl + have hspec := π.cellWarp_spec hc hbd u hu v hv huv + rw [htilde] at hn + rcases hn with rfl | rfl + · exact hspec.1 + · exact hspec.2.1 + +theorem bddAbove_warpAt_set (Θ : Set π.S) : + BddAbove {p | ∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ p = π.cellWarp c} := by + have hfin : {p | ∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ p = π.cellWarp c}.Finite := by + refine (π.Γ.finite_cells.image π.cellWarp).subset ?_ + rintro p ⟨c, hc, _, rfl⟩ + exact ⟨c, hc, rfl⟩ + exact hfin.bddAbove + +theorem cellWarp_le_warpAt {c Θ : Set π.S} (hc : c ∈ π.Γ.C) (hcΘ : (c ∩ Θ).Nonempty) : + π.cellWarp c ≤ π.warpAt Θ := + le_csSup (π.bddAbove_warpAt_set Θ) ⟨c, hc, hcΘ, rfl⟩ + +theorem warpAt_le_iff {Θ : Set π.S} {q : ℕ} : + π.warpAt Θ ≤ q ↔ ∀ c ∈ π.Γ.C, (c ∩ Θ).Nonempty → π.cellWarp c ≤ q := by + unfold warpAt + constructor + · intro h c hc hcΘ + exact (le_csSup (π.bddAbove_warpAt_set Θ) ⟨c, hc, hcΘ, rfl⟩).trans h + · intro h + by_cases hne : {p | ∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ p = π.cellWarp c}.Nonempty + · refine csSup_le hne ?_ + rintro p ⟨c, hc, hcΘ, rfl⟩ + exact h c hc hcΘ + · rw [not_nonempty_iff_eq_empty.mp hne, csSup_empty] + exact Nat.zero_le q + +theorem exists_cell_cellWarp_eq_warpAt {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (hΘ_arc : IsOArc Θ) : + ∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ π.cellWarp c = π.warpAt Θ := by + obtain ⟨E⟩ := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + have hc0 : E.cell ⟨0, by linarith [E.two_le]⟩ ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self _ + have hne : {p | ∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ p = π.cellWarp c}.Nonempty := + ⟨_, E.cell ⟨0, by linarith [E.two_le]⟩, hc0.1, hc0.2, rfl⟩ + have hmem := Nat.sSup_mem hne (π.bddAbove_warpAt_set Θ) + rcases hmem with ⟨c, hc, hcΘ, h_eq⟩ + exact ⟨c, hc, hcΘ, h_eq.symm⟩ + +theorem ncard_borderSet_le_warpAt {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (hΘ_arc : IsOArc Θ) + {n : π.S} (hn : n ∈ π.Γ.N ∩ Θ) : + (π.borderSet n).ncard ≤ π.warpAt Θ := by + obtain ⟨E⟩ := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + have hn_range : n ∈ Set.range E.node := by rw [E.range_node]; exact hn + rcases hn_range with ⟨i, rfl⟩ + have hc_range : E.cell i ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self i + have hbd : (E.cell i ∩ bd π.S).Nonempty := by + rw [(π.Γ.border_cell_subset_cuff hc_range.1 hΘ hc_range.2).2.1]; exact hc_range.2 + have hni : E.node i ∈ tilde (E.cell i) := by + rw [E.cell_tilde i]; exact mem_insert _ _ + exact (π.ncard_borderSet_le_cellWarp hc_range.1 hbd hni).trans + (π.cellWarp_le_warpAt hc_range.1 hc_range.2) + +theorem bddAbove_warp_set : + BddAbove {p | ∃ Θ ∈ cuffs π.S, p = π.warpAt Θ} := by + have hfin : {p | ∃ Θ ∈ cuffs π.S, p = π.warpAt Θ}.Finite := by + refine ((GraphMinor.Surface.cuff_statement.{0} π.S π.isSurface).2.1.image π.warpAt).subset ?_ + rintro p ⟨Θ, hΘ, rfl⟩ + exact ⟨Θ, hΘ, rfl⟩ + exact hfin.bddAbove + +theorem one_le_warp : 1 ≤ π.warp := by + unfold warp + split_ifs + · exact le_max_left 1 _ + · exact le_rfl + +theorem warpAt_le_warp {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) : + π.warpAt Θ ≤ π.warp := by + have hne : (cuffs π.S).Nonempty := ⟨Θ, hΘ⟩ + unfold warp + simp only [hne, ↓reduceIte] + exact (le_csSup (π.bddAbove_warp_set) ⟨Θ, hΘ, rfl⟩).trans (le_max_right _ _) + +theorem ncard_borderSet_le_warp + {n : π.S} (hn : n ∈ π.Γ.N ∩ bd π.S) : + (π.borderSet n).ncard ≤ π.warp := by + let Θ := connectedComponentIn (bd π.S) n + have hΘ : Θ ∈ cuffs π.S := ⟨n, hn.2, rfl⟩ + have hΘ_arc : IsOArc Θ := (GraphMinor.Surface.cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + have hnΘ : n ∈ π.Γ.N ∩ Θ := ⟨hn.1, mem_connectedComponentIn hn.2⟩ + exact (π.ncard_borderSet_le_warpAt hΘ hΘ_arc hnΘ).trans (π.warpAt_le_warp hΘ) + +end Portrayal + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section4.lean b/LeanPool/GraphMinor/GM17/Section4.lean new file mode 100644 index 0000000000..8ce6bc28bd --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section4.lean @@ -0,0 +1,701 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section2 +public import LeanPool.GraphMinor.GM10.Section6 + +import LeanPool.GraphMinor.Surface.Cuffs + +/-! +# Section 4 of Graph Minors XVII: Tangles and Portrayals + +This file formalizes Section 4 (pages 168–170) of N. Robertson and P. D. Seymour, +*Graph Minors. XVII. Taming a vortex*, J. Combin. Theory Ser. B 77 (1999) 162–210: +- Basic properties of `attachments`, `complSubhypergraph`, and `IsSmallWrt`. +- **Graph Minors XVII, (4.1)** (`theorem_4_1_i`, `theorem_4_1_ii`, `theorem_4_1`, page 169): + elementary properties of small subhypergraphs relative to a tangle $\mathcal{T}$. +- **Graph Minors XVII, (4.2)** (`theorem_4_2`, page 169): the quotient tangle $\mathcal{T} / Z$ + in $G / Z$ has order $\operatorname{ord}(\mathcal{T}) - |Z|$. +- **Graph Minors XVII, (4.3)** (`theorem_4_3`, pages 169–170), with its subproof claims (1), (2), + and (3): a $\mathcal{T}$-central portrayal of warp $\le p$ has no small subhypergraph $A \le G$ + with $< \theta - 2p$ attachments containing $\gamma(\operatorname{dom}(\gamma))$. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +/-! ## 1. Attachments, Complementary Subhypergraphs, and Small Subhypergraphs -/ + +section Attachments + +variable {α : Type u} {β : Type v} {G A A₁ A₂ B : Hypergraph α β} + +theorem mem_attachments_iff {v : α} : + v ∈ attachments G A ↔ v ∈ A.vertexSet ∧ ∃ e ∈ G.edgeSet \ A.edgeSet, G.Inc e v := + Iff.rfl + +theorem attachments_subset_vertexSet : attachments G A ⊆ A.vertexSet := + fun _ h => h.1 + +theorem attachments_finite : (attachments G A).Finite := + A.vertexSet_finite.subset attachments_subset_vertexSet + +@[simp] +theorem complSubhypergraph_vertexSet (G A : Hypergraph α β) : + (complSubhypergraph G A).vertexSet = (G.vertexSet \ A.vertexSet) ∪ attachments G A := + rfl + +@[simp] +theorem complSubhypergraph_edgeSet (G A : Hypergraph α β) : + (complSubhypergraph G A).edgeSet = G.edgeSet \ A.edgeSet := + rfl + +@[simp] +theorem complSubhypergraph_inc (G A : Hypergraph α β) (e : β) (v : α) : + (complSubhypergraph G A).Inc e v ↔ e ∈ G.edgeSet \ A.edgeSet ∧ G.Inc e v := + Iff.rfl + +theorem complSubhypergraph_le (hA : A ≤ G) : complSubhypergraph G A ≤ G where + vertexSet_subset := + union_subset sdiff_subset (attachments_subset_vertexSet.trans hA.vertexSet_subset) + edgeSet_subset := sdiff_subset + ends_eq e he := by + ext v + simp only [Hypergraph.ends, mem_ofPred_eq, complSubhypergraph_inc] + exact ⟨fun h => ⟨he, h⟩, fun h => h.2⟩ + +theorem isSeparation_complSubhypergraph (hA : A ≤ G) : + G.IsSeparation A (complSubhypergraph G A) := by + rw [isSeparation_iff_of_le hA (complSubhypergraph_le hA)] + refine ⟨?_, ?_, ?_⟩ + · ext v + simp only [complSubhypergraph_vertexSet, mem_union, mem_sdiff] + constructor + · rintro (hvA | ⟨hvG, _⟩ | hvAtt) + · exact hA.vertexSet_subset hvA + · exact hvG + · exact hA.vertexSet_subset hvAtt.1 + · intro hvG + by_cases hvA : v ∈ A.vertexSet + · exact Or.inl hvA + · exact Or.inr (Or.inl ⟨hvG, hvA⟩) + · ext e + simp only [complSubhypergraph_edgeSet, mem_union, mem_sdiff] + constructor + · rintro (heA | ⟨heG, _⟩) + · exact hA.edgeSet_subset heA + · exact heG + · intro heG + by_cases heA : e ∈ A.edgeSet + · exact Or.inl heA + · exact Or.inr ⟨heG, heA⟩ + · exact inter_sdiff_self A.edgeSet G.edgeSet + +theorem inter_complSubhypergraph_vertexSet (G A : Hypergraph α β) : + (A ∩ complSubhypergraph G A).vertexSet = attachments G A := by + ext v + simp only [inter_vertexSet, complSubhypergraph_vertexSet, mem_inter_iff, mem_union, mem_sdiff] + constructor + · rintro ⟨hvA, ⟨_, hnot⟩ | hvAtt⟩ + · exact (hnot hvA).elim + · exact hvAtt + · intro hvAtt + exact ⟨hvAtt.1, Or.inr hvAtt⟩ + +theorem separationOrder_complSubhypergraph (G A : Hypergraph α β) : + separationOrder A (complSubhypergraph G A) = (attachments G A).ncard := by + rw [separationOrder, inter_complSubhypergraph_vertexSet] + +theorem attachments_subset_inter_of_isSeparation (hsep : G.IsSeparation A B) : + attachments G A ⊆ (A ∩ B).vertexSet := by + rintro v ⟨hvA, e, ⟨heG, heA⟩, hinc⟩ + have heAB : e ∈ A.edgeSet ∪ B.edgeSet := by rwa [hsep.edgeSet_union] + have heB : e ∈ B.edgeSet := heAB.resolve_left heA + have hincB : B.Inc e v := (inc_iff_of_le hsep.right_le heB).2 hinc + exact ⟨hvA, B.vertex_mem_of_inc hincB⟩ + +theorem ncard_attachments_le_separationOrder (hsep : G.IsSeparation A B) : + (attachments G A).ncard ≤ separationOrder A B := + ncard_le_ncard (attachments_subset_inter_of_isSeparation hsep) (A ∩ B).vertexSet_finite + +theorem attachments_union_subset : + attachments G (A₁ ∪ A₂) ⊆ attachments G A₁ ∪ attachments G A₂ := by + rintro v ⟨hv₁ | hv₂, e, ⟨heG, heU⟩, hinc⟩ + · exact Or.inl ⟨hv₁, e, ⟨heG, fun he₁ => heU (Or.inl he₁)⟩, hinc⟩ + · exact Or.inr ⟨hv₂, e, ⟨heG, fun he₂ => heU (Or.inr he₂)⟩, hinc⟩ + +theorem Portrayal.attachments_cellGraph_subset_otherVertices (π : Portrayal G) + {c : Set π.S} (_hc : c ∈ π.Γ.C) : + attachments G (π.cellGraph c) ⊆ (π.cellGraph c).vertexSet ∩ π.otherVertices c := by + rintro v ⟨hvc, e, ⟨heG, henot⟩, hinc⟩ + obtain ⟨c', hc', hec'⟩ := π.p1_edge e heG + have hne : c' ≠ c := fun h => henot (h ▸ hec') + have hinc' : (π.cellGraph c').Inc e v := + (inc_iff_of_le (π.cellGraph_le c' hc') hec').2 hinc + exact ⟨hvc, c', hc', hne, (π.cellGraph c').vertex_mem_of_inc hinc'⟩ + +theorem IsSmallWrt.le_G {θ : ℕ} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : IsTangle G θ 𝒯) (h : IsSmallWrt 𝒯 A) : A ≤ G := by + rcases h with ⟨B, hAB⟩ + exact (h𝒯.isSeparation hAB).left_le + +theorem IsSmallWrt.vertexSet_ne {θ : ℕ} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : IsTangle G θ 𝒯) (h : IsSmallWrt 𝒯 A) : A.vertexSet ≠ G.vertexSet := by + rcases h with ⟨B, hAB⟩ + exact h𝒯.axiom3 hAB + +theorem IsSmallWrt.ne_G {θ : ℕ} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : IsTangle G θ 𝒯) (h : IsSmallWrt 𝒯 A) : A ≠ G := + fun heq => h.vertexSet_ne h𝒯 (congrArg Hypergraph.vertexSet heq) + +theorem IsSmallWrt.ncard_attachments_lt {θ : ℕ} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : IsTangle G θ 𝒯) (h : IsSmallWrt 𝒯 A) : (attachments G A).ncard < θ := by + rcases h with ⟨B, hAB⟩ + exact (ncard_attachments_le_separationOrder (h𝒯.isSeparation hAB)).trans_lt (h𝒯.order_lt hAB) + +end Attachments + +/-! ## 2. Graph Minors XVII, (4.1) and (4.2) (Page 169) -/ + +/-- **Graph Minors XVII, (4.1)(i)** (page 169): +If $A \subseteq G$ is small relative to a tangle $\mathcal{T}$ of order $\theta$ in $G$, then +$(A, B) \in \mathcal{T}$ for every $B \subseteq G$ such that $(A, B)$ is a separation of $G$ of +order $< \theta$. -/ +theorem theorem_4_1_i {α : Type u} {β : Type v} {G A B : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + (hA : IsSmallWrt 𝒯 A) (hsep : G.IsSeparation A B) (hord : separationOrder A B < θ) : + (A, B) ∈ 𝒯 := by + rcases hA with ⟨B₀, hAB₀⟩ + exact GM10.theorem_2_9_proof h𝒯 hAB₀ hsep hord (Or.inr (Or.inl Subset.rfl)) + +/-- **Graph Minors XVII, (4.1)(ii)** (page 169): +If $A_1, A_2 \subseteq G$ are small relative to a tangle $\mathcal{T}$ of order $\theta$ in $G$, +and $A \subseteq A_1 \cup A_2$ has $< \theta$ attachments in $G$, then $A$ is small relative to +$\mathcal{T}$. -/ +theorem theorem_4_1_ii {α : Type u} {β : Type v} {G A A₁ A₂ : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + (hA₁ : IsSmallWrt 𝒯 A₁) (hA₂ : IsSmallWrt 𝒯 A₂) + (hA : A ≤ A₁ ∪ A₂) (hatt : (attachments G A).ncard < θ) : + IsSmallWrt 𝒯 A := by + have hA₁_le : A₁ ≤ G := hA₁.le_G h𝒯 + have hA₂_le : A₂ ≤ G := hA₂.le_G h𝒯 + have hA_le : A ≤ G := hA.trans (union_le hA₁_le hA₂_le) + let B := complSubhypergraph G A + have hsep : G.IsSeparation A B := isSeparation_complSubhypergraph hA_le + have hord : separationOrder A B < θ := by + rwa [separationOrder_complSubhypergraph] + refine ⟨B, ?_⟩ + rcases h𝒯.axiom1 hsep hord with hAB | hBA + · exact hAB + · exfalso + rcases hA₁ with ⟨B₁, hAB₁⟩ + rcases hA₂ with ⟨B₂, hAB₂⟩ + apply h𝒯.axiom2 hBA hAB₁ hAB₂ + have hU_le : B ∪ A₁ ∪ A₂ ≤ G := union_le (union_le hsep.right_le hA₁_le) hA₂_le + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq hU_le le_rfl + · refine Subset.antisymm hU_le.vertexSet_subset ?_ + rw [← hsep.vertexSet_union] + rintro v (hvA | hvB) + · rcases hA.vertexSet_subset hvA with hv₁ | hv₂ + · exact Or.inl (Or.inr hv₁) + · exact Or.inr hv₂ + · exact Or.inl (Or.inl hvB) + · refine Subset.antisymm hU_le.edgeSet_subset ?_ + rw [← hsep.edgeSet_union] + rintro e (heA | heB) + · rcases hA.edgeSet_subset heA with he₁ | he₂ + · exact Or.inl (Or.inr he₁) + · exact Or.inr he₂ + · exact Or.inl (Or.inl heB) + +/-- **Graph Minors XVII, (4.1)** (page 169): +(i) If $A \subseteq G$ is small then $(A, B) \in \mathcal{T}$ for every $B \subseteq G$ such that +$(A, B)$ is a separation of $G$ of order $< \operatorname{ord}(\mathcal{T})$. +(ii) If $A_1, A_2 \subseteq G$ are small and $A \subseteq A_1 \cup A_2$ has +$< \operatorname{ord}(\mathcal{T})$ attachments in $G$ then $A$ is small. -/ +theorem theorem_4_1_proof {α : Type u} {β : Type v} {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) : + (∀ A B, IsSmallWrt 𝒯 A → G.IsSeparation A B → separationOrder A B < θ → (A, B) ∈ 𝒯) ∧ + (∀ A A₁ A₂, IsSmallWrt 𝒯 A₁ → IsSmallWrt 𝒯 A₂ → A ≤ A₁ ∪ A₂ → + (attachments G A).ncard < θ → IsSmallWrt 𝒯 A) := + ⟨fun _ _ hA hsep hord => theorem_4_1_i h𝒯 hA hsep hord, + fun _ _ _ hA₁ hA₂ hA hatt => theorem_4_1_ii h𝒯 hA₁ hA₂ hA hatt⟩ + +theorem IsSmallWrt.mono {α : Type u} {β : Type v} {G A A₁ : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + (hA₁ : IsSmallWrt 𝒯 A₁) (hA : A ≤ A₁) (hatt : (attachments G A).ncard < θ) : + IsSmallWrt 𝒯 A := by + have hle : A ≤ A₁ ∪ A₁ := by rw [GM10.union_self]; exact hA + exact theorem_4_1_ii h𝒯 hA₁ hA₁ hle hatt + +theorem IsSmallWrt.union {α : Type u} {β : Type v} {G A₁ A₂ : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + (hA₁ : IsSmallWrt 𝒯 A₁) (hA₂ : IsSmallWrt 𝒯 A₂) + (hatt : (attachments G (A₁ ∪ A₂)).ncard < θ) : + IsSmallWrt 𝒯 (A₁ ∪ A₂) := + theorem_4_1_ii h𝒯 hA₁ hA₂ le_rfl hatt + +/-- **Graph Minors XVII, (4.2)** (page 169): +If $\mathcal{T}$ is a tangle in a hypergraph $G$, and $Z \subseteq V(G)$ with +$|Z| < \operatorname{ord}(\mathcal{T})$, then $\mathcal{T} / Z$ is a tangle in $G / Z$ of order +$\operatorname{ord}(\mathcal{T}) - |Z|$. +(Proved in Graph Minors X, Theorem (6.2).) -/ +theorem theorem_4_2_proof {α : Type u} {β : Type v} {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {Z : Set α} (hZ : Z ⊆ G.vertexSet) (hZ_lt : Z.ncard < θ) : + IsTangle (quotientVertices G Z) (θ - Z.ncard) (quotientTangle G 𝒯 Z) := + GM10.theorem_6_2_proof h𝒯 hZ hZ_lt + +/-! ## 3. Graph Minors XVII, (4.3) (Pages 169–170) -/ + +/-- Attachment inclusion in Claim (1) of **Graph Minors XVII, (4.3)** (page 169): +For any internal cell $c \in C(\Gamma)$ and any subhypergraph $A \le G$ with +$\gamma(\operatorname{dom}(\gamma)) \subseteq V(A)$, every attachment of $A \cup \alpha(c)$ in $G$ +is an attachment of $A$ in $G$. -/ +theorem theorem_4_3_claim_1_attachments {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {A : Hypergraph α β} + (hdom : ∀ n ∈ π.domγ, π.nodeVertex n ∈ A.vertexSet) + {c : Set π.S} (hc : c ∈ π.Γ.C) (hint : ¬ (c ∩ bd π.S).Nonempty) : + attachments G (A ∪ π.cellGraph c) ⊆ attachments G A := by + rintro v ⟨hvU, e, ⟨heG, henotU⟩, hinc⟩ + have henotA : e ∉ A.edgeSet := fun heA => henotU (Or.inl heA) + have henotC : e ∉ (π.cellGraph c).edgeSet := fun heC => henotU (Or.inr heC) + rcases hvU with hvA | hvC + · exact ⟨hvA, e, ⟨heG, henotA⟩, hinc⟩ + · have hvo : v ∈ π.otherVertices c := + (π.attachments_cellGraph_subset_otherVertices hc ⟨hvC, e, ⟨heG, henotC⟩, hinc⟩).2 + obtain ⟨n, hn, rfl⟩ := π.p5 c hc hint v hvC hvo + exact ⟨hdom n hn.2, e, ⟨heG, henotA⟩, hinc⟩ + +/-- Claim (1) in the proof of **Graph Minors XVII, (4.3)** (page 169): +For a maximal small subhypergraph $A \le G$ with $< \theta - 2p$ attachments and +$\gamma(\operatorname{dom}(\gamma)) \subseteq V(A)$, every internal cell $c \in C(\Gamma)$ satisfies +$\alpha(c) \le A$. -/ +theorem theorem_4_3_claim_1 {α : Type u} {β : Type v} {G : Hypergraph α β} {θ p : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) (hcentral : π.IsCentral 𝒯) + {A : Hypergraph α β} (hAsmall : IsSmallWrt 𝒯 A) + (hatt : (attachments G A).ncard < θ - 2 * p) + (hdom : ∀ n ∈ π.domγ, π.nodeVertex n ∈ A.vertexSet) + (hmax : ∀ A' : Hypergraph α β, A ≤ A' → IsSmallWrt 𝒯 A' → + (attachments G A').ncard < θ - 2 * p → + (∀ n ∈ π.domγ, π.nodeVertex n ∈ A'.vertexSet) → A' = A) + {c : Set π.S} (hc : c ∈ π.Γ.C) (hint : ¬ (c ∩ bd π.S).Nonempty) : + π.cellGraph c ≤ A := by + let A' := A ∪ π.cellGraph c + have hA_le : A ≤ G := hAsmall.le_G h𝒯 + have hc_le : π.cellGraph c ≤ G := π.cellGraph_le c hc + have hle_A' : A ≤ A' := le_union_left hA_le hc_le + have hatt_sub : attachments G A' ⊆ attachments G A := + theorem_4_3_claim_1_attachments π hdom hc hint + have hatt_A' : (attachments G A').ncard < θ - 2 * p := + (ncard_le_ncard hatt_sub attachments_finite).trans_lt hatt + have hatt_lt_θ : (attachments G A').ncard < θ := by omega + have hsmall_A' : IsSmallWrt 𝒯 A' := hAsmall.union h𝒯 (hcentral c hc) hatt_lt_θ + have hdom_A' : ∀ n ∈ π.domγ, π.nodeVertex n ∈ A'.vertexSet := + fun n hn => Or.inl (hdom n hn) + have heq : A' = A := hmax A' hle_A' hsmall_A' hatt_A' hdom_A' + rw [← heq] + exact le_union_right hA_le hc_le + +/-- The partial union $X_j = A \cup \alpha(c_1) \cup \dots \cup \alpha(c_j)$ along a cuff +enumeration `E` in the proof of **Graph Minors XVII, (4.3)** (page 170). -/ +def cuffPrefixUnion {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {Θ : Set π.S} {k : ℕ} (E : π.Γ.CuffEnumeration Θ k) + (A : Hypergraph α β) (j : ℕ) : Hypergraph α β := + A ∪ π.cellsUnion {c | ∃ i : Fin k, i.1 < j ∧ E.cell i = c} + +theorem cuffPrefixUnion_zero {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {Θ : Set π.S} {k : ℕ} (E : π.Γ.CuffEnumeration Θ k) + {A : Hypergraph α β} (hA : A ≤ G) : + cuffPrefixUnion π E A 0 = A := by + have hle : cuffPrefixUnion π E A 0 ≤ G := + union_le hA (π.cellsUnion_le _) + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle hA + · ext v + simp only [cuffPrefixUnion, union_vertexSet, Portrayal.cellsUnion, mem_union, mem_iUnion, + mem_inter_iff, mem_ofPred_eq, Nat.not_lt_zero, false_and, exists_false, iUnion_false, + mem_empty_iff_false, or_false] + · ext e + simp only [cuffPrefixUnion, union_edgeSet, Portrayal.cellsUnion, mem_union, mem_iUnion, + mem_inter_iff, mem_ofPred_eq, Nat.not_lt_zero, false_and, exists_false, iUnion_false, + mem_empty_iff_false, or_false] + +theorem cuffPrefixUnion_succ {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {Θ : Set π.S} {k : ℕ} (E : π.Γ.CuffEnumeration Θ k) + {A : Hypergraph α β} (hA : A ≤ G) {j : ℕ} (hj : j < k) : + cuffPrefixUnion π E A (j + 1) = + cuffPrefixUnion π E A j ∪ π.cellGraph (E.cell ⟨j, hj⟩) := by + have hcell_mem : E.cell ⟨j, hj⟩ ∈ π.Γ.C := by + have h : E.cell ⟨j, hj⟩ ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self _ + exact h.1 + have h1 : cuffPrefixUnion π E A (j + 1) ≤ G := + union_le hA (π.cellsUnion_le _) + have h2 : cuffPrefixUnion π E A j ∪ π.cellGraph (E.cell ⟨j, hj⟩) ≤ G := + union_le (union_le hA (π.cellsUnion_le _)) (π.cellGraph_le _ hcell_mem) + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq h1 h2 + · ext v + simp only [cuffPrefixUnion, union_vertexSet, Portrayal.cellsUnion, mem_union, mem_iUnion, + mem_inter_iff, mem_ofPred_eq] + constructor + · rintro (hvA | ⟨c, ⟨⟨i, hi, rfl⟩, hcC⟩, hvc⟩) + · exact Or.inl (Or.inl hvA) + · rcases Nat.lt_succ_iff_lt_or_eq.mp hi with hlt | heq + · exact Or.inl (Or.inr ⟨E.cell i, ⟨⟨i, hlt, rfl⟩, hcC⟩, hvc⟩) + · have hi_eq : i = ⟨j, hj⟩ := Fin.ext heq + exact Or.inr (hi_eq ▸ hvc) + · rintro ((hvA | ⟨c, ⟨⟨i, hi, rfl⟩, hcC⟩, hvc⟩) | hvc) + · exact Or.inl hvA + · exact Or.inr ⟨E.cell i, ⟨⟨i, Nat.lt_succ_of_lt hi, rfl⟩, hcC⟩, hvc⟩ + · exact Or.inr ⟨E.cell ⟨j, hj⟩, ⟨⟨⟨j, hj⟩, Nat.lt_succ_self j, rfl⟩, hcell_mem⟩, hvc⟩ + · ext e + simp only [cuffPrefixUnion, union_edgeSet, Portrayal.cellsUnion, mem_union, mem_iUnion, + mem_inter_iff, mem_ofPred_eq] + constructor + · rintro (heA | ⟨c, ⟨⟨i, hi, rfl⟩, hcC⟩, hec⟩) + · exact Or.inl (Or.inl heA) + · rcases Nat.lt_succ_iff_lt_or_eq.mp hi with hlt | heq + · exact Or.inl (Or.inr ⟨E.cell i, ⟨⟨i, hlt, rfl⟩, hcC⟩, hec⟩) + · have hi_eq : i = ⟨j, hj⟩ := Fin.ext heq + exact Or.inr (hi_eq ▸ hec) + · rintro ((heA | ⟨c, ⟨⟨i, hi, rfl⟩, hcC⟩, hec⟩) | hec) + · exact Or.inl heA + · exact Or.inr ⟨E.cell i, ⟨⟨i, Nat.lt_succ_of_lt hi, rfl⟩, hcC⟩, hec⟩ + · exact Or.inr ⟨E.cell ⟨j, hj⟩, ⟨⟨⟨j, hj⟩, Nat.lt_succ_self j, rfl⟩, hcell_mem⟩, hec⟩ + +/-- Claim (2) in the proof of **Graph Minors XVII, (4.3)** (page 170): +For $1 \le j \le k$, every attachment of $X_j$ which is not an attachment of $A$ is in +$\beta(n_1) \cup \beta(n_{j+1})$, and when $j = k$ every attachment of $X_k$ is an attachment of +$A$. In particular, if $A$ has $< \theta - 2p$ attachments and $\pi$ has warp $\le p$, then $X_j$ +has fewer than $\theta$ attachments. -/ +theorem theorem_4_3_claim_2 {α : Type u} {β : Type v} {G : Hypergraph α β} {θ p : ℕ} + (π : Portrayal G) (hwarp : π.warp ≤ p) + {Θ : Set π.S} {k : ℕ} (E : π.Γ.CuffEnumeration Θ k) + {A : Hypergraph α β} (hatt : (attachments G A).ncard < θ - 2 * p) + (hdom : ∀ n ∈ π.domγ, π.nodeVertex n ∈ A.vertexSet) + (_hint : ∀ c ∈ π.Γ.C, ¬ (c ∩ bd π.S).Nonempty → π.cellGraph c ≤ A) + {j : ℕ} (hj_pos : 1 ≤ j) (hj_le : j ≤ k) : + have hk_pos : 0 < k := by linarith [E.two_le] + attachments G (cuffPrefixUnion π E A j) \ attachments G A ⊆ + π.borderSet (E.node ⟨0, hk_pos⟩) ∪ + π.borderSet (E.node ⟨j % k, Nat.mod_lt _ hk_pos⟩) ∧ + (j = k → attachments G (cuffPrefixUnion π E A j) ⊆ attachments G A) ∧ + (attachments G (cuffPrefixUnion π E A j)).ncard < θ := by + classical + have hk_pos : 0 < k := by linarith [E.two_le] + let r₀ : Fin k := ⟨0, hk_pos⟩ + let r_j : Fin k := ⟨j % k, Nat.mod_lt _ hk_pos⟩ + -- First prove the core property for any v ∈ attachments G (X_j) \ attachments G A + have hcore : ∀ v ∈ attachments G (cuffPrefixUnion π E A j) \ attachments G A, + j < k ∧ v ∈ π.borderSet (E.node r₀) ∪ π.borderSet (E.node r_j) := by + rintro v ⟨⟨hvX, e, ⟨heG, henotX⟩, hinc⟩, hvnotAttA⟩ + have henotA : e ∉ A.edgeSet := fun heA => henotX (Or.inl heA) + have hvnotA : v ∉ A.vertexSet := fun hvA => hvnotAttA ⟨hvA, e, ⟨heG, henotA⟩, hinc⟩ + have hvCells : v ∈ (π.cellsUnion {c | ∃ i : Fin k, i.1 < j ∧ E.cell i = c}).vertexSet := + hvX.resolve_left hvnotA + simp only [Portrayal.cellsUnion, mem_iUnion, mem_inter_iff, mem_ofPred_eq] at hvCells + rcases hvCells with ⟨_, ⟨⟨i, hi_lt, rfl⟩, hiC⟩, hvi⟩ + have hiΘ : (E.cell i ∩ Θ).Nonempty := by + have h : E.cell i ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self i + exact h.2 + have hibd : (E.cell i ∩ bd π.S).Nonempty := by + rw [(π.Γ.border_cell_subset_cuff hiC E.cuff_mem hiΘ).2.1]; exact hiΘ + obtain ⟨c, hcC, hec⟩ := π.p1_edge e heG + have hvc : v ∈ (π.cellGraph c).vertexSet := + (π.cellGraph c).vertex_mem_of_inc ((inc_iff_of_le (π.cellGraph_le c hcC) hec).2 hinc) + have hne_ic : E.cell i ≠ c := by + rintro rfl + apply henotX + right + simp only [Portrayal.cellsUnion, mem_iUnion, mem_inter_iff, mem_ofPred_eq] + exact ⟨E.cell i, ⟨⟨i, hi_lt, rfl⟩, hiC⟩, hec⟩ + have hvo_i : v ∈ π.otherVertices (E.cell i) := ⟨c, hcC, hne_ic.symm, hvc⟩ + obtain ⟨n_h, hn_h_tilde, hvn_h_plus⟩ := π.p6_borderPlus hiC hibd hvi hvo_i + have hvn_h : v ∈ π.borderSet n_h := by + rcases hvn_h_plus with h | ⟨hdom_nh, rfl⟩ + · exact h + · exact (hvnotA (hdom n_h hdom_nh)).elim + have hcΘ : (c ∩ Θ).Nonempty := by + by_contra hnotΘ + obtain ⟨_, n, hn, _, rfl⟩ := + π.exists_node_of_not_borders_cuff hiC hcC hne_ic E.cuff_mem hiΘ hnotΘ hn_h_tilde hvn_h hvc + exact hvnotA (hdom n hn.2) + have hc_range : c ∈ Set.range E.cell := by + rw [E.range_cell]; exact ⟨hcC, hcΘ⟩ + rcases hc_range with ⟨j', rfl⟩ + have hj'_ge : j ≤ j'.1 := by + by_contra hlt + push Not at hlt + apply henotX + right + simp only [Portrayal.cellsUnion, mem_iUnion, mem_inter_iff, mem_ofPred_eq] + exact ⟨E.cell j', ⟨⟨j', hlt, rfl⟩, hcC⟩, hec⟩ + have hj_lt_k : j < k := lt_of_le_of_lt hj'_ge j'.2 + refine ⟨hj_lt_k, ?_⟩ + have hj'bd : (E.cell j' ∩ bd π.S).Nonempty := by + rw [(π.Γ.border_cell_subset_cuff hcC E.cuff_mem hcΘ).2.1]; exact hcΘ + have hvo_j' : v ∈ π.otherVertices (E.cell j') := ⟨E.cell i, hiC, hne_ic, hvi⟩ + obtain ⟨n_h', hn_h'_tilde, hvn_h'_plus⟩ := π.p6_borderPlus hcC hj'bd hvc hvo_j' + -- Identify the indices a, b in Fin k for n_h and n_h' + rw [E.cell_tilde i] at hn_h_tilde + rw [E.cell_tilde j'] at hn_h'_tilde + let a : Fin k := + if n_h = E.node i then i else ⟨(i.1 + 1) % k, Nat.mod_lt _ hk_pos⟩ + have ha_eq : E.node a = n_h := by + dsimp [a] + split_ifs with h + · exact h.symm + · rcases hn_h_tilde with h1 | h2 + · exact (h h1).elim + · exact h2.symm + have ha_le : a.1 ≤ j := by + dsimp [a] + split_ifs + · omega + · dsimp + rw [Nat.mod_eq_of_lt (by omega)] + omega + let b : Fin k := + if n_h' = E.node j' then j' else ⟨(j'.1 + 1) % k, Nat.mod_lt _ hk_pos⟩ + have hb_eq : E.node b = n_h' := by + dsimp [b] + split_ifs with h + · exact h.symm + · rcases hn_h'_tilde with h1 | h2 + · exact (h h1).elim + · exact h2.symm + have hb_range : j ≤ b.1 ∨ b.1 = 0 := by + dsimp [b] + split_ifs + · exact Or.inl hj'_ge + · dsimp + by_cases hsucc : j'.1 + 1 < k + · rw [Nat.mod_eq_of_lt hsucc] + exact Or.inl (by omega) + · have heq : j'.1 + 1 = k := by omega + rw [heq, Nat.mod_self] + exact Or.inr rfl + have hr₀_val : r₀.1 = 0 := rfl + have hr_j_val : r_j.1 = j := Nat.mod_eq_of_lt hj_lt_k + have hdist_ar : cyclicDist a r_j = j - a.1 := by + rw [cyclicDist_eq_ite, hr_j_val] + simp only [ha_le, ↓reduceIte] + have hdist_sum : cyclicDist a r_j + cyclicDist r_j b + cyclicDist b r₀ ≤ k := by + rcases hb_range with hb_ge | hb_zero + · have h1 : cyclicDist r_j b = b.1 - j := by + rw [cyclicDist_eq_ite, hr_j_val] + simp only [hb_ge, ↓reduceIte] + have h2 : cyclicDist b r₀ = k - b.1 := by + rw [cyclicDist_eq_ite, hr₀_val] + have hb_pos : 0 < b.1 := by omega + split_ifs <;> omega + have := b.2 + omega + · have h1 : cyclicDist r_j b = k - j := by + rw [cyclicDist_eq_ite, hr_j_val, hb_zero] + split_ifs <;> omega + have h2 : cyclicDist b r₀ = 0 := by + have hb_r₀ : b = r₀ := Fin.ext hb_zero + rw [hb_r₀, cyclicDist_self] + omega + have hva_plus : v ∈ π.borderPlus (E.node a) := ha_eq.symm ▸ hvn_h_plus + have hvb_plus : v ∈ π.borderPlus (E.node b) := hb_eq.symm ▸ hvn_h'_plus + have h_or := π.p7_of_cyclicDist E hdist_sum hva_plus hvb_plus + rcases h_or with hvr_j | hvr₀ + · rcases hvr_j with h | ⟨hdom_rj, rfl⟩ + · exact Or.inr h + · exact (hvnotA (hdom (E.node r_j) hdom_rj)).elim + · rcases hvr₀ with h | ⟨hdom_r0, rfl⟩ + · exact Or.inl h + · exact (hvnotA (hdom (E.node r₀) hdom_r0)).elim + have hsub : attachments G (cuffPrefixUnion π E A j) \ attachments G A ⊆ + π.borderSet (E.node r₀) ∪ π.borderSet (E.node r_j) := + fun v hv => (hcore v hv).2 + have hjk : j = k → attachments G (cuffPrefixUnion π E A j) ⊆ attachments G A := by + intro hjk v hv + by_contra hvnot + have hlt := (hcore v ⟨hv, hvnot⟩).1 + omega + refine ⟨hsub, hjk, ?_⟩ + have hcov : attachments G (cuffPrefixUnion π E A j) ⊆ + attachments G A ∪ (π.borderSet (E.node r₀) ∪ π.borderSet (E.node r_j)) := by + intro v hv + by_cases hvA : v ∈ attachments G A + · exact Or.inl hvA + · exact Or.inr (hsub ⟨hv, hvA⟩) + have hn_bd : ∀ i : Fin k, E.node i ∈ π.Γ.N ∩ bd π.S := by + intro i + have h : E.node i ∈ π.Γ.N ∩ Θ := by + rw [← E.range_node]; exact mem_range_self i + rcases E.cuff_mem with ⟨x₀, _, hΘ_eq⟩ + refine ⟨h.1, ?_⟩ + have h2 : E.node i ∈ connectedComponentIn (bd π.S) x₀ := hΘ_eq ▸ h.2 + exact connectedComponentIn_subset (bd π.S) x₀ h2 + have hcard0 : (π.borderSet (E.node r₀)).ncard ≤ p := + (π.ncard_borderSet_le_warp (hn_bd r₀)).trans hwarp + have hcardj : (π.borderSet (E.node r_j)).ncard ≤ p := + (π.ncard_borderSet_le_warp (hn_bd r_j)).trans hwarp + have hfin0 : (π.borderSet (E.node r₀)).Finite := π.borderSet_finite (hn_bd r₀) + have hfinj : (π.borderSet (E.node r_j)).Finite := π.borderSet_finite (hn_bd r_j) + have hcard_union : + (attachments G (cuffPrefixUnion π E A j)).ncard ≤ + (attachments G A).ncard + (π.borderSet (E.node r₀)).ncard + + (π.borderSet (E.node r_j)).ncard := by + calc (attachments G (cuffPrefixUnion π E A j)).ncard + _ ≤ (attachments G A ∪ (π.borderSet (E.node r₀) ∪ π.borderSet (E.node r_j))).ncard := + ncard_le_ncard hcov (attachments_finite.union (hfin0.union hfinj)) + _ ≤ (attachments G A).ncard + + (π.borderSet (E.node r₀) ∪ π.borderSet (E.node r_j)).ncard := + ncard_union_le _ _ + _ ≤ (attachments G A).ncard + + ((π.borderSet (E.node r₀)).ncard + (π.borderSet (E.node r_j)).ncard) := + Nat.add_le_add_left (ncard_union_le _ _) _ + _ = (attachments G A).ncard + (π.borderSet (E.node r₀)).ncard + + (π.borderSet (E.node r_j)).ncard := by omega + omega + +/-- Claim (3) in the proof of **Graph Minors XVII, (4.3)** (page 170): +For $0 \le j \le k$, $X_j$ is small relative to $\mathcal{T}$. -/ +theorem theorem_4_3_claim_3 {α : Type u} {β : Type v} {G : Hypergraph α β} {θ p : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) (hcentral : π.IsCentral 𝒯) (hwarp : π.warp ≤ p) + {Θ : Set π.S} {k : ℕ} (E : π.Γ.CuffEnumeration Θ k) + {A : Hypergraph α β} (hAsmall : IsSmallWrt 𝒯 A) + (hatt : (attachments G A).ncard < θ - 2 * p) + (hdom : ∀ n ∈ π.domγ, π.nodeVertex n ∈ A.vertexSet) + (hint : ∀ c ∈ π.Γ.C, ¬ (c ∩ bd π.S).Nonempty → π.cellGraph c ≤ A) : + ∀ j ≤ k, IsSmallWrt 𝒯 (cuffPrefixUnion π E A j) := by + have hA_le : A ≤ G := hAsmall.le_G h𝒯 + intro j hj + induction j with + | zero => + rw [cuffPrefixUnion_zero π E hA_le] + exact hAsmall + | succ j ih => + have hj_lt : j < k := Nat.lt_of_succ_le hj + have hprev : IsSmallWrt 𝒯 (cuffPrefixUnion π E A j) := ih (Nat.le_of_lt hj_lt) + have hcell_mem : E.cell ⟨j, hj_lt⟩ ∈ π.Γ.C := by + have h : E.cell ⟨j, hj_lt⟩ ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self _ + exact h.1 + have hcell_small : IsSmallWrt 𝒯 (π.cellGraph (E.cell ⟨j, hj_lt⟩)) := + hcentral _ hcell_mem + have hatt_succ : (attachments G (cuffPrefixUnion π E A (j + 1))).ncard < θ := + (theorem_4_3_claim_2 π hwarp E hatt hdom hint (Nat.succ_pos j) hj).2.2 + rw [cuffPrefixUnion_succ π E hA_le hj_lt] at hatt_succ ⊢ + exact hprev.union h𝒯 hcell_small hatt_succ + +/-- **Graph Minors XVII, (4.3)** (pages 169–170): +Let $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a $\mathcal{T}$-central portrayal of a +hypergraph $G$, with $\operatorname{warp} \le p$, and let $\mathcal{T}$ have order $\theta$. +There is no small subhypergraph $A \subseteq G$ with $< \theta - 2p$ attachments, such that +$\gamma(n) \in V(A)$ for all $n \in \operatorname{dom}(\gamma)$. -/ +theorem theorem_4_3_proof {α : Type u} {β : Type v} {G : Hypergraph α β} {θ p : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) (hcentral : π.IsCentral 𝒯) (hwarp : π.warp ≤ p) : + ¬ ∃ A : Hypergraph α β, + IsSmallWrt 𝒯 A ∧ + (attachments G A).ncard < θ - 2 * p ∧ + (∀ n ∈ π.domγ, π.nodeVertex n ∈ A.vertexSet) := by + rintro ⟨A₀, hA₀_small, hA₀_att, hA₀_dom⟩ + let P : Hypergraph α β → Prop := fun A => + IsSmallWrt 𝒯 A ∧ + (attachments G A).ncard < θ - 2 * p ∧ + (∀ n ∈ π.domγ, π.nodeVertex n ∈ A.vertexSet) + let μ : Hypergraph α β → ℕ := fun A => + (G.vertexSet.ncard + G.edgeSet.ncard) - (A.vertexSet.ncard + A.edgeSet.ncard) + -- By well-foundedness of < on ℕ, choose A ∈ P minimizing μ A (hence maximal under ≤) + have hP_nonempty : {A | P A}.Nonempty := ⟨A₀, hA₀_small, hA₀_att, hA₀_dom⟩ + let A := WellFounded.min ( InvImage.wf μ wellFounded_lt ) {A | P A} hP_nonempty + have hPA : P A := WellFounded.min_mem (InvImage.wf μ wellFounded_lt) {A | P A} hP_nonempty + rcases hPA with ⟨hAsmall, hatt, hdom⟩ + have hA_le : A ≤ G := hAsmall.le_G h𝒯 + have hmax : ∀ A' : Hypergraph α β, A ≤ A' → IsSmallWrt 𝒯 A' → + (attachments G A').ncard < θ - 2 * p → + (∀ n ∈ π.domγ, π.nodeVertex n ∈ A'.vertexSet) → A' = A := by + intro A' hle hA'small hA'att hA'dom + have hPA' : A' ∈ {B | P B} := ⟨hA'small, hA'att, hA'dom⟩ + have hnot_lt : ¬ μ A' < μ A := + WellFounded.not_lt_min (InvImage.wf μ wellFounded_lt) {B | P B} hPA' + have hA'_le : A' ≤ G := hA'small.le_G h𝒯 + have hV_A' : A'.vertexSet.ncard ≤ G.vertexSet.ncard := + ncard_le_ncard hA'_le.vertexSet_subset G.vertexSet_finite + have hE_A' : A'.edgeSet.ncard ≤ G.edgeSet.ncard := + ncard_le_ncard hA'_le.edgeSet_subset G.edgeSet_finite + have hV_le : A.vertexSet.ncard ≤ A'.vertexSet.ncard := + ncard_le_ncard hle.vertexSet_subset A'.vertexSet_finite + have hE_le : A.edgeSet.ncard ≤ A'.edgeSet.ncard := + ncard_le_ncard hle.edgeSet_subset A'.edgeSet_finite + dsimp [μ] at hnot_lt + exact (eq_of_le_of_ncard_eq hle (by omega) (by omega)).symm + -- Claim (1): every internal cell c satisfies π.cellGraph c ≤ A + have hint : ∀ c ∈ π.Γ.C, ¬ (c ∩ bd π.S).Nonempty → π.cellGraph c ≤ A := + fun c hc hnot_bd => theorem_4_3_claim_1 h𝒯 π hcentral hAsmall hatt hdom hmax hc hnot_bd + -- Since A ≠ G, some cell c₁ ∈ π.Γ.C has ¬ (π.cellGraph c₁ ≤ A) + have hex_c₁ : ∃ c₁ ∈ π.Γ.C, ¬ (π.cellGraph c₁ ≤ A) := by + by_contra hall + push Not at hall + apply hAsmall.ne_G h𝒯 + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq hA_le le_rfl + · refine Subset.antisymm hA_le.vertexSet_subset ?_ + intro v hv + obtain ⟨c, hc, hvc⟩ := π.p1_vertex v hv + exact (hall c hc).vertexSet_subset hvc + · refine Subset.antisymm hA_le.edgeSet_subset ?_ + intro e he + obtain ⟨c, hc, hec⟩ := π.p1_edge e he + exact (hall c hc).edgeSet_subset hec + rcases hex_c₁ with ⟨c₁, hc₁, hnot_le_c₁⟩ + -- By Claim (1), c₁ is a border cell, so it borders some cuff Θ + have hbd_c₁ : (c₁ ∩ bd π.S).Nonempty := by + by_contra hnot_bd + exact hnot_le_c₁ (hint c₁ hc₁ hnot_bd) + rcases hbd_c₁ with ⟨x₀, hxc₁, hxbd⟩ + let Θ := connectedComponentIn (bd π.S) x₀ + have hΘ : Θ ∈ cuffs π.S := ⟨x₀, hxbd, rfl⟩ + have hΘ_arc : IsOArc Θ := (GraphMinor.Surface.cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + have hc₁Θ : (c₁ ∩ Θ).Nonempty := ⟨x₀, hxc₁, mem_connectedComponentIn hxbd⟩ + obtain ⟨E⟩ := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + set k := (π.Γ.N ∩ Θ).ncard + have hk_pos : 1 ≤ k := by linarith [E.two_le] + -- By Claims (2) and (3) for j = k, X_k is small and has attachments ⊆ attachments G A + have hXk_small : IsSmallWrt 𝒯 (cuffPrefixUnion π E A k) := + theorem_4_3_claim_3 h𝒯 π hcentral hwarp E hAsmall hatt hdom hint k le_rfl + have hXk_att_sub : attachments G (cuffPrefixUnion π E A k) ⊆ attachments G A := + (theorem_4_3_claim_2 π hwarp E hatt hdom hint hk_pos le_rfl).2.1 rfl + have hXk_att : (attachments G (cuffPrefixUnion π E A k)).ncard < θ - 2 * p := + (ncard_le_ncard hXk_att_sub attachments_finite).trans_lt hatt + have hXk_dom : ∀ n ∈ π.domγ, π.nodeVertex n ∈ (cuffPrefixUnion π E A k).vertexSet := + fun n hn => Or.inl (hdom n hn) + have hA_le_Xk : A ≤ cuffPrefixUnion π E A k := + le_union_left hA_le (π.cellsUnion_le _) + have hXk_eq_A : cuffPrefixUnion π E A k = A := + hmax (cuffPrefixUnion π E A k) hA_le_Xk hXk_small hXk_att hXk_dom + -- Yet c₁ = E.cell i for some i : Fin k, so π.cellGraph c₁ ≤ X_k = A, contradiction! + have hc₁_range : c₁ ∈ Set.range E.cell := by + rw [E.range_cell]; exact ⟨hc₁, hc₁Θ⟩ + rcases hc₁_range with ⟨i, rfl⟩ + have hi_le_Xk : π.cellGraph (E.cell i) ≤ cuffPrefixUnion π E A k := + (π.cellGraph_le_cellsUnion (I := {c | ∃ j : Fin k, j.1 < k ∧ E.cell j = c}) + ⟨i, i.2, rfl⟩ hc₁).trans (le_union_right hA_le (π.cellsUnion_le _)) + rw [hXk_eq_A] at hi_le_Xk + exact hnot_le_c₁ hi_le_Xk + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section5.lean b/LeanPool/GraphMinor/GM17/Section5.lean new file mode 100644 index 0000000000..0e24d28a17 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section5.lean @@ -0,0 +1,2257 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Defs2 + +public import LeanPool.GraphMinor.GM17.Section4 +import LeanPool.GraphMinor.Surface.DiscUnion +import LeanPool.GraphMinor.Surface.DiscsInSurface +import Mathlib.Analysis.SpecialFunctions.Complex.Circle +import Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds + +import LeanPool.GraphMinor.Surface.Cuffs + +/-! +# Graph Minors XVII, Section 5: Simplifying a Portrayal + +This file formalizes Section 5 (pages 170–173) of Robertson and Seymour, +*Graph Minors. XVII. Taming a vortex*, J. Combin. Theory Ser. B 77 (1999), 162–210: + +- Construction of the shrunken painting $\Gamma'$ (`Painting.isShrunkenFrom_of_disc`, + `Painting.exists_isShrunkenFrom`) when shrinking an internal cell $c \in C(\Gamma)$ from a node + $n \in \tilde{c}$. +- **(5.1)** (`theorem_5_1`, `one_le_warp_of_isZeroRedundant`, page 171): If $\pi$ is a 0-redundant + $\mathcal{T}$-central portrayal of $G$, then for each cuff $\Theta$ of $\Sigma$, $\pi$ has warp + $\ge 1$ at $\Theta$, and hence $\operatorname{warp}(\pi) \ge 1$. +- **(5.2)** (`Portrayal.shrinkCell`, `theorem_5_2`, page 171): Shrinking an internal cell $c$ from + a node $n \in \tilde{c}$ when $\gamma(n) \notin V(\alpha(c))$ yields a truer portrayal $\pi'$ that + resembles $\pi$ and preserves $\mathcal{T}$-centrality. +- **(5.3)** (`theorem_5_3`, page 172): Cutting $\Sigma$ along a $\Gamma$-normal $I$-arc $F$ with + ends $n_1, n_2$ such that $\beta(n_1) = \beta(n_2) = F \cap \operatorname{dom}(\gamma) = + \emptyset$ + yields a closed disc $\Delta \subseteq \Sigma$ with $F \subseteq \operatorname{bd}(\Delta) + \subseteq + F \cup \operatorname{bd}(\Sigma)$ and $\alpha(\Delta)$ small. +- **(5.4)** (`theorem_5_4`, page 173): Cutting $\Sigma$ along a $\Gamma$-normal $O$-arc $F$ with + $F \cap \operatorname{dom}(\gamma) = \emptyset$ yields a closed disc $\Delta \subseteq \Sigma$ + with $\operatorname{bd}(\Delta) = F$ and $\alpha(\Delta)$ small. +The portrayal deductions that use painting results are proved in `Section5Proved`. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM10 GraphMinor.Hypergraph + +local notation "𝕀" => unitInterval + +universe u v + +/-! ## 1. Shrinking a Cell from a Node (Page 171) -/ + +/-- If $\Delta$ and $D$ are closed discs with $\Delta \subseteq D$, then every point of +$\Delta \cap \operatorname{bd}(D)$ belongs to $\operatorname{bd}(\Delta)$. -/ +theorem disc_inter_discBd_subset_discBd {S : Type*} [TopologicalSpace S] + {D Δ : Set S} (hD : IsClosedDisc D) (hΔ : IsClosedDisc Δ) (hsub : Δ ⊆ D) : + Δ ∩ discBd D ⊆ discBd Δ := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + obtain ⟨d1, d2⟩ := c.disc_h hsub hΔ + have hbd_sub : discBd Δ ⊆ D := (discBd_subset Δ).trans hsub + have hG : Nonempty (Circle ≃ₜ h '' discBd Δ) := c.oArc_h hbd_sub hΔ.isOArc_discBd + have heq : h '' Δ = closedInner (h '' discBd Δ) := eq_closedInner_of_discBd hG d1 d2 + have hdisj : Disjoint (inner (h '' discBd Δ)) (sphere 0 1) := + (components_closedBall_sdiff hG (c.image_subset hbd_sub)).2.1 + rintro x ⟨hxΔ, hxbd⟩ + have hxhΔ : h x ∈ inner (h '' discBd Δ) ∪ h '' discBd Δ := by + rw [← closedInner, ← heq] + exact mem_image_of_mem h hxΔ + have hxhs : h x ∈ sphere (0 : ℂ) 1 := by + rw [← c.bd] + exact mem_image_of_mem h hxbd + rcases hxhΔ with hxin | ⟨y, hy, hyx⟩ + · exact (Set.disjoint_left.mp hdisj hxin hxhs).elim + · have hyx' : y = x := c.gh.injOn (hbd_sub hy) (hsub hxΔ) hyx + exact hyx' ▸ hy + +/-- In the closed unit disc of $\mathbb{C}$, for any boundary point $z_0 \in S^1$ and any finite +subset $K \subseteq S^1 \setminus \{z_0\}$, there is a closed disc $Z \subseteq \overline{B}(0, 1)$ +with $z_0 \notin Z$ and $K \subseteq Z$. -/ +private theorem exists_shrunken_disc_complex {z₀ : ℂ} (hz₀ : z₀ ∈ sphere (0 : ℂ) 1) + {K : Set ℂ} (hKfin : K.Finite) (hKsub : K ⊆ sphere (0 : ℂ) 1 \ {z₀}) : + ∃ Z : Set ℂ, IsClosedDisc Z ∧ Z ⊆ closedBall (0 : ℂ) 1 ∧ z₀ ∉ Z ∧ K ⊆ Z := by + let t₀ : Circle := ⟨z₀, hz₀⟩ + have hex_ε : ∃ ε : ℝ, 0 < ε ∧ ∀ w ∈ K, ε ≤ dist w z₀ := by + rcases K.eq_empty_or_nonempty with rfl | hKne + · exact ⟨1, one_pos, fun _ hw => hw.elim⟩ + · obtain ⟨w₀, hw₀K, hmin⟩ := + Finset.exists_min_image hKfin.toFinset (fun w => dist w z₀) (hKfin.toFinset_nonempty.mpr + hKne) + rw [Finite.mem_toFinset] at hw₀K + have hw₀_ne : w₀ ≠ z₀ := (hKsub hw₀K).2 + exact ⟨dist w₀ z₀, dist_pos.mpr hw₀_ne, fun w hw => hmin w (hKfin.mem_toFinset.mpr hw)⟩ + obtain ⟨ε, hεpos, hεK⟩ := hex_ε + set η : ℝ := min (ε / 2) 1 with hη_def + have hηpos : 0 < η := lt_min (half_pos hεpos) one_pos + have hηle1 : η ≤ 1 := min_le_right _ _ + have hηlt_pi : η < Real.pi := lt_of_le_of_lt hηle1 (by linarith [Real.two_le_pi]) + have hηlt_ε : η < ε := lt_of_le_of_lt (min_le_left _ _) (half_lt_self hεpos) + have hgap : 0 < 2 * Real.pi - 2 * η := by linarith + let P : ℝ → ℂ := fun θ => ((t₀ * Circle.exp θ : Circle) : ℂ) + have hP_cont : Continuous P := + continuous_subtype_val.comp (continuous_const.mul Circle.exp.continuous) + have hP_sphere : ∀ θ, P θ ∈ sphere (0 : ℂ) 1 := fun θ => (t₀ * Circle.exp θ).2 + have hP_zero : P 0 = z₀ := by + change ((t₀ * Circle.exp 0 : Circle) : ℂ) = z₀ + rw [Circle.exp_zero, mul_one] + have hP_dist : ∀ θ, |θ| ≤ η → dist (P θ) z₀ ≤ η := by + intro θ hθ + have h1 : ((t₀ * Circle.exp θ : Circle) : ℂ) - (t₀ : ℂ) = + t₀ * (Complex.exp (Complex.I * θ) - 1) := by + rw [Circle.coe_mul, Circle.coe_exp] + ring_nf + have h2 : dist (P θ) z₀ ≤ |θ| := by + change dist ((t₀ * Circle.exp θ : Circle) : ℂ) (t₀ : ℂ) ≤ |θ| + rw [dist_eq_norm, h1, norm_mul, Circle.norm_coe, one_mul] + exact Real.norm_exp_I_mul_ofReal_sub_one_le + exact h2.trans hθ + have hP_inj : ∀ θ₁ θ₂, |θ₁ - θ₂| < 2 * Real.pi → P θ₁ = P θ₂ → θ₁ = θ₂ := by + intro θ₁ θ₂ hdiff hEq + have h1 : t₀ * Circle.exp θ₁ = t₀ * Circle.exp θ₂ := Subtype.ext hEq + have h2 : Circle.exp θ₁ = Circle.exp θ₂ := mul_left_cancel h1 + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h2 + have hle : (m : ℝ) * (2 * Real.pi) = θ₁ - θ₂ := by linarith + have habs := abs_lt.mp hdiff + have hm1 : (m : ℝ) < 1 := by + by_contra hc; rw [not_lt] at hc; nlinarith [Real.pi_pos] + have hm2 : (-1 : ℝ) < m := by + by_contra hc; rw [not_lt] at hc; nlinarith [Real.pi_pos] + have hm3 : m < 1 := by exact_mod_cast hm1 + have hm4 : -1 < m := by exact_mod_cast hm2 + have hm0 : m = 0 := by omega + subst hm0 + push_cast at hle + linarith + let c₀ : 𝕀 → ℂ := fun s => P (η + (2 * Real.pi - 2 * η) * (s : ℝ)) + have hc₀_angle : ∀ s : 𝕀, η ≤ η + (2 * Real.pi - 2 * η) * (s : ℝ) ∧ + η + (2 * Real.pi - 2 * η) * (s : ℝ) ≤ 2 * Real.pi - η := fun s => by + constructor <;> nlinarith [s.2.1, s.2.2] + have hc₀ : IsArcMap c₀ := by + refine ⟨hP_cont.comp (continuous_const.add (continuous_const.mul continuous_subtype_val)), + fun s₁ s₂ hEq => ?_⟩ + have ha₁ := hc₀_angle s₁ + have ha₂ := hc₀_angle s₂ + have hθ := hP_inj _ _ (abs_lt.mpr ⟨by linarith, by linarith⟩) hEq + exact Subtype.ext (mul_left_cancel₀ hgap.ne' (by linarith)) + let r : 𝕀 → ℝ := fun s => 1 - (s : ℝ) * (1 - (s : ℝ)) + have hr_pos : ∀ s : 𝕀, 0 < r s := fun s => by + have hs0 := s.2.1 + have hs1 := s.2.2 + have hsq : 0 ≤ ((s : ℝ) - 1 / 2) ^ 2 := sq_nonneg _ + dsimp [r] + nlinarith + have hr_le : ∀ s : 𝕀, r s ≤ 1 := fun s => by + dsimp [r] + nlinarith [mul_nonneg s.2.1 (sub_nonneg.mpr s.2.2)] + let e : 𝕀 → ℂ := fun s => (r s : ℂ) * P (η - 2 * η * (s : ℝ)) + have he_norm : ∀ s : 𝕀, ‖e s‖ = r s := fun s => by + simp only [e, norm_mul, Complex.norm_real, Real.norm_of_nonneg (hr_pos s).le, + mem_sphere_zero_iff_norm.mp (hP_sphere _), mul_one] + have he_angle : ∀ s : 𝕀, -η ≤ η - 2 * η * (s : ℝ) ∧ η - 2 * η * (s : ℝ) ≤ η := fun s => by + constructor <;> nlinarith [s.2.1, s.2.2] + have he : IsArcMap e := by + refine ⟨(Complex.continuous_ofReal.comp (continuous_const.sub + (continuous_subtype_val.mul (continuous_const.sub continuous_subtype_val)))).mul + (hP_cont.comp (continuous_const.sub (continuous_const.mul continuous_subtype_val))), + fun s₁ s₂ hEq => ?_⟩ + have hn : r s₁ = r s₂ := by rw [← he_norm s₁, ← he_norm s₂, hEq] + have hcr : (r s₁ : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr (hr_pos s₁).ne' + have hP_eq : P (η - 2 * η * (s₁ : ℝ)) = P (η - 2 * η * (s₂ : ℝ)) := by + apply mul_left_cancel₀ hcr + calc (r s₁ : ℂ) * P (η - 2 * η * (s₁ : ℝ)) = e s₁ := rfl + _ = e s₂ := hEq + _ = (r s₁ : ℂ) * P (η - 2 * η * (s₂ : ℝ)) := by simp [e, hn] + have ha₁ := he_angle s₁ + have ha₂ := he_angle s₂ + have hθ := hP_inj _ _ + (abs_lt.mpr ⟨by linarith [ha₁.1, ha₂.2, hηlt_pi], by linarith [ha₁.2, ha₂.1, hηlt_pi]⟩) hP_eq + have hmul : (2 * η) * (s₁ : ℝ) = (2 * η) * (s₂ : ℝ) := by linarith [hθ] + have h2η : (2 * η : ℝ) ≠ 0 := by positivity + exact Subtype.ext (mul_left_cancel₀ h2η hmul) + have hc₀_0 : c₀ 0 = e 0 := by + simp [c₀, e, r] + have hc₀_1 : c₀ 1 = e 1 := by + simp only [c₀, e, r, Icc.coe_one, mul_one, sub_self, mul_zero, sub_zero, Complex.ofReal_one, + one_mul, P] + congr 2 + have h2pi : η + (2 * Real.pi - 2 * η) = (η - 2 * η) + 2 * Real.pi := by ring + rw [h2pi, Circle.exp_add, Circle.exp_two_pi, mul_one] + have he_sphere : ∀ t : 𝕀, e t ∈ sphere (0 : ℂ) 1 → t = 0 ∨ t = 1 := by + intro t ht + have hn : r t = 1 := by rw [← he_norm t, mem_sphere_zero_iff_norm.mp ht] + have hmul : (t : ℝ) * (1 - (t : ℝ)) = 0 := by dsimp [r] at hn; linarith + rcases mul_eq_zero.mp hmul with ht0 | ht1 + · exact Or.inl (Subtype.ext ht0) + · have h1 : (t : ℝ) = 1 := by linarith + exact Or.inr (Subtype.ext h1) + have hmeet : ∀ s t : 𝕀, c₀ s = e t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + intro s t hst + have het : e t ∈ sphere (0 : ℂ) 1 := hst ▸ hP_sphere _ + rcases he_sphere t het with rfl | rfl + · exact Or.inl ⟨hc₀.2 (hst.trans hc₀_0.symm), rfl⟩ + · exact Or.inr ⟨hc₀.2 (hst.trans hc₀_1.symm), rfl⟩ + have hG : Nonempty (Circle ≃ₜ (range c₀ ∪ range e : Set ℂ)) := + oArc_of_two_arcs hc₀ he hc₀_0 hc₀_1 hmeet + have hG_sub : range c₀ ∪ range e ⊆ closedBall (0 : ℂ) 1 := by + rintro z (⟨s, rfl⟩ | ⟨t, rfl⟩) + · exact sphere_subset_closedBall (hP_sphere _) + · exact mem_closedBall_zero_iff.mpr (by rw [he_norm]; exact hr_le t) + obtain ⟨hZ_disc, _⟩ := isClosedDisc_closedInner hG + have hZ_sub : closedInner (range c₀ ∪ range e) ⊆ closedBall (0 : ℂ) 1 := + closedInner_subset_closedBall hG hG_sub + have hZ_disj : Disjoint (inner (range c₀ ∪ range e)) (sphere (0 : ℂ) 1) := + (components_closedBall_sdiff hG hG_sub).2.1 + refine ⟨closedInner (range c₀ ∪ range e), hZ_disc, hZ_sub, ?_, ?_⟩ + · rintro (hz₀_in | ⟨s, hs⟩ | ⟨t, ht⟩) + · exact Set.disjoint_left.mp hZ_disj hz₀_in hz₀ + · have ha := hc₀_angle s + have hEq : P (η + (2 * Real.pi - 2 * η) * (s : ℝ)) = P 0 := hs.trans hP_zero.symm + have hθ := hP_inj _ 0 (abs_lt.mpr ⟨by linarith, by linarith⟩) hEq + linarith + · rcases he_sphere t (ht.symm ▸ hz₀) with rfl | rfl + · have hEq : P η = P 0 := by simpa [e, r, hP_zero] using ht + have hθ := hP_inj η 0 (abs_lt.mpr ⟨by linarith, by linarith⟩) hEq + linarith + · have hEq : P (-η) = P 0 := by + have ht' : e 1 = z₀ := ht + simp only [e, r, Icc.coe_one, sub_self, mul_zero, sub_zero, Complex.ofReal_one, + one_mul, mul_one] at ht' + rw [show η - 2 * η = -η by ring] at ht' + exact ht'.trans hP_zero.symm + have hθ := hP_inj (-η) 0 (abs_lt.mpr ⟨by linarith, by linarith⟩) hEq + linarith + · intro w hwK + obtain ⟨hw_sphere, _⟩ := hKsub hwK + obtain ⟨θ, hθ₁, hθ₂, hθ_eq⟩ := + exists_angle_near t₀ ⟨w, hw_sphere⟩ η hηpos.le hηlt_pi.le + have hPw : P θ = w := (congrArg Subtype.val hθ_eq).symm + have hθ_ge : η ≤ θ := by + by_contra hlt + rw [not_le] at hlt + have hd : dist w z₀ ≤ η := by + rw [← hPw] + exact hP_dist θ (abs_le.mpr ⟨hθ₁, hlt.le⟩) + linarith [hεK w hwK] + refine Or.inr (Or.inl ⟨⟨(θ - η) / (2 * Real.pi - 2 * η), + div_nonneg (sub_nonneg.mpr hθ_ge) hgap.le, + (div_le_one hgap).mpr (by linarith)⟩, ?_⟩) + dsimp [c₀] + rw [mul_div_cancel₀ _ hgap.ne', add_sub_cancel, hPw] + +/-- In any closed disc $D$, given a boundary point $n \in \operatorname{bd}(D)$ and a finite subset +$K \subseteq \operatorname{bd}(D) \setminus \{n\}$, there exists a closed disc $\Delta \subseteq D$ +such that $n \notin \Delta$ and $K \subseteq \Delta$ (and hence $K \subseteq +\operatorname{bd}(\Delta)$). -/ +theorem exists_shrunken_disc {S : Type*} [TopologicalSpace S] + {D : Set S} (hD : IsClosedDisc D) {n : S} (hn : n ∈ discBd D) + {K : Set S} (hKfin : K.Finite) (hKsub : K ⊆ discBd D \ {n}) : + ∃ Δ : Set S, IsClosedDisc Δ ∧ Δ ⊆ D ∧ n ∉ Δ ∧ K ⊆ Δ ∧ K ⊆ discBd Δ := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hz₀ : h n ∈ sphere (0 : ℂ) 1 := by + rw [← c.bd] + exact mem_image_of_mem h hn + have hKh_sub : h '' K ⊆ sphere (0 : ℂ) 1 \ {h n} := by + rintro _ ⟨x, hxK, rfl⟩ + obtain ⟨hx_bd, hx_ne⟩ := hKsub hxK + refine ⟨?_, fun hEq => hx_ne (c.gh.injOn (discBd_subset D hx_bd) (discBd_subset D hn) hEq)⟩ + rw [← c.bd] + exact mem_image_of_mem h hx_bd + obtain ⟨Z, hZ_disc, hZ_sub, hz₀_not, hKZ⟩ := + exists_shrunken_disc_complex hz₀ (hKfin.image h) hKh_sub + obtain ⟨hΔ_disc, _⟩ := c.disc_g hZ_sub hZ_disc + have hΔ_sub : g '' Z ⊆ D := c.g_subset hZ_sub + have hn_not : n ∉ g '' Z := by + rintro ⟨z, hzZ, hgz⟩ + have hzh : z = h n := by + rw [← hgz, c.hg (hZ_sub hzZ)] + exact hz₀_not (hzh ▸ hzZ) + have hK_sub_Δ : K ⊆ g '' Z := by + intro x hxK + have hxD : x ∈ D := discBd_subset D (hKsub hxK).1 + exact ⟨h x, hKZ (mem_image_of_mem h hxK), c.gh hxD⟩ + have hK_bd : K ⊆ discBd (g '' Z) := fun x hxK => + disc_inter_discBd_subset_discBd hD hΔ_disc hΔ_sub ⟨hK_sub_Δ hxK, (hKsub hxK).1⟩ + exact ⟨g '' Z, hΔ_disc, hΔ_sub, hn_not, hK_sub_Δ, hK_bd⟩ + +/-- Given a painting $\Gamma$ in a Hausdorff space $S$, an internal cell $c \in C(\Gamma)$, +a node $n \in \tilde{c}$, and a closed disc $\Delta \subseteq \bar{c}$ with $n \notin \Delta$ and +$\tilde{c} \setminus \{n\} \subseteq \Delta$, the set $U' = (U(\Gamma) \setminus c) \cup \Delta$ +with node set $N' = N(\Gamma)$ forms a painting $\Gamma'$ in $S$ obtained from $\Gamma$ by +shrinking $c$ from $n$. +Graph Minors XVII, Section 5 (page 171). -/ +theorem Painting.isShrunkenFrom_of_disc {S : Type} [TopologicalSpace S] [T2Space S] + (Γ : Painting S) {c : Set S} (hc : Γ.IsInternalCell c) {n : S} (hn : n ∈ tilde c) + {Δ : Set S} (hΔ : IsClosedDisc Δ) (hΔ_sub : Δ ⊆ closure c) + (hnΔ : n ∉ Δ) (htilde_sub : tilde c \ {n} ⊆ Δ) : + ∃ Γ' : Painting S, Γ.IsShrunkenFrom Γ' c n Δ := by + have hcC : c ∈ Γ.C := hc.1 + have hD : IsClosedDisc (closure c) := Γ.isClosedDisc_closure_cell hcC + have htilde_bdD : tilde c \ {n} ⊆ discBd (closure c) := + sdiff_subset.trans (Γ.tilde_subset_discBd hcC) + have htilde_bdΔ : tilde c \ {n} ⊆ discBd Δ := fun x hx => + disc_inter_discBd_subset_discBd hD hΔ hΔ_sub ⟨htilde_sub hx, htilde_bdD hx⟩ + have htilde_fin : (tilde c \ {n}).Finite := + (Γ.finite_tilde_cell hcC).subset sdiff_subset + set c' : Set S := Δ \ (tilde c \ {n}) + have hc'_diff_fin : (Δ \ c').Finite := by + refine htilde_fin.subset fun x hx => ?_ + simp only [c', mem_sdiff] at hx + by_contra hnot + exact hx.2 ⟨hx.1, hnot⟩ + have hc'_path : IsPathConnected c' := + isPathConnected_of_isClosedDisc_finite_diff hΔ sdiff_subset hc'_diff_fin + have hcl_c' : closure c' = Δ := + closure_eq_of_isClosedDisc_finite_diff hΔ sdiff_subset hc'_diff_fin + have htilde_c' : tilde c' = tilde c \ {n} := by + rw [tilde_diff_eq_of_isClosedDisc_finite hΔ htilde_fin, inter_eq_right.mpr htilde_sub] + have hcl_c_diff : closure c \ Γ.N = c := Γ.closure_cell_diff_N hcC + have hcl_c_inter : closure c ∩ Γ.N = tilde c := Γ.closure_cell_inter_N hcC + have hΔ_inter_N : Δ ∩ Γ.N = tilde c \ {n} := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨hxΔ, hxN⟩ + have hxt : x ∈ tilde c := by + rw [← hcl_c_inter] + exact ⟨hΔ_sub hxΔ, hxN⟩ + exact ⟨hxt, fun hxn => hnΔ (mem_singleton_iff.mp hxn ▸ hxΔ)⟩ + · intro x hx + exact ⟨htilde_sub hx, Γ.tilde_subset_N hcC hx.1⟩ + have hc'_eq : Δ \ Γ.N = c' := by + ext x + simp only [c', ← hΔ_inter_N, mem_sdiff, mem_inter_iff] + tauto + set F : Set S := ((Γ.U \ c) ∪ Δ) \ Γ.N + have hcov : ⋃₀ ((Γ.C \ {c}) ∪ {c'}) = F := by + ext x + simp only [F, mem_sUnion, mem_union, mem_sdiff, mem_singleton_iff] + constructor + · rintro ⟨d, ⟨hdC, hdc⟩ | rfl, hxd⟩ + · have hxUN : x ∈ Γ.U \ Γ.N := Γ.cell_subset_diff hdC hxd + have hxc : x ∉ c := fun hxc => hdc (Γ.cell_eq_of_mem hdC hcC hxd hxc) + exact ⟨Or.inl ⟨hxUN.1, hxc⟩, hxUN.2⟩ + · have hxΔN : x ∈ Δ \ Γ.N := by rwa [hc'_eq] + exact ⟨Or.inr hxΔN.1, hxΔN.2⟩ + · rintro ⟨⟨hxU, hxc⟩ | hxΔ, hxN⟩ + · have hxUN : x ∈ Γ.U \ Γ.N := ⟨hxU, hxN⟩ + rw [← Γ.sUnion_cells, mem_sUnion] at hxUN + obtain ⟨d, hdC, hxd⟩ := hxUN + have hdc : d ≠ c := fun hEq => hxc (hEq ▸ hxd) + exact ⟨d, Or.inl ⟨hdC, hdc⟩, hxd⟩ + · have hxc' : x ∈ c' := by rw [← hc'_eq]; exact ⟨hxΔ, hxN⟩ + exact ⟨c', Or.inr rfl, hxc'⟩ + have hC'_fin : ((Γ.C \ {c}) ∪ {c'}).Finite := + (Γ.finite_cells.subset sdiff_subset).union (finite_singleton c') + have hC'_ne : ∀ d ∈ (Γ.C \ {c}) ∪ {c'}, d.Nonempty := by + rintro d (⟨hdC, _⟩ | rfl) + · exact Γ.cell_nonempty hdC + · exact hc'_path.nonempty + have hC'_path : ∀ d ∈ (Γ.C \ {c}) ∪ {c'}, IsPathConnected d := by + rintro d (⟨hdC, _⟩ | rfl) + · exact Γ.cell_isPathConnected hdC + · exact hc'_path + have hC'_disj : ∀ d₁ ∈ (Γ.C \ {c}) ∪ {c'}, ∀ d₂ ∈ (Γ.C \ {c}) ∪ {c'}, + d₁ ≠ d₂ → Disjoint d₁ d₂ := by + rintro d₁ (⟨hd₁C, hd₁c⟩ | rfl) d₂ (⟨hd₂C, hd₂c⟩ | rfl) hne + · exact Γ.cell_disjoint hd₁C hd₂C hne + · refine Set.disjoint_left.mpr fun x hxd₁ hxc' => ?_ + have hx_inter : x ∈ closure d₁ ∩ closure c := ⟨subset_closure hxd₁, hΔ_sub hxc'.1⟩ + rw [Γ.closure_cell_inter_closure_cell hd₁C hcC hd₁c] at hx_inter + exact (Γ.cell_subset_diff hd₁C hxd₁).2 (Γ.tilde_subset_N hd₁C hx_inter.1) + · refine Set.disjoint_left.mpr fun x hxc' hxd₂ => ?_ + have hx_inter : x ∈ closure c ∩ closure d₂ := ⟨hΔ_sub hxc'.1, subset_closure hxd₂⟩ + rw [Γ.closure_cell_inter_closure_cell hcC hd₂C (Ne.symm hd₂c)] at hx_inter + exact (Γ.cell_subset_diff hd₂C hxd₂).2 (Γ.tilde_subset_N hd₂C hx_inter.2) + · exact (hne rfl).elim + have hC'_closed : ∀ d ∈ (Γ.C \ {c}) ∪ {c'}, closure d ∩ F = d := by + rintro d (⟨hdC, hdc⟩ | rfl) + · refine Subset.antisymm ?_ fun x hxd => ⟨subset_closure hxd, ?_⟩ + · rintro x ⟨hxd_cl, -, hxN⟩ + rw [← Γ.closure_cell_diff_N hdC] + exact ⟨hxd_cl, hxN⟩ + · rw [← hcov] + exact mem_sUnion.mpr ⟨d, Or.inl ⟨hdC, hdc⟩, hxd⟩ + · refine Subset.antisymm ?_ fun x hxc' => ⟨subset_closure hxc', ?_⟩ + · rintro x ⟨hxc'_cl, -, hxN⟩ + rw [hcl_c'] at hxc'_cl + rw [← hc'_eq] + exact ⟨hxc'_cl, hxN⟩ + · rw [← hcov] + exact mem_sUnion.mpr ⟨c', Or.inr rfl, hxc'⟩ + have hC'_eq : arcComponentsIn F = (Γ.C \ {c}) ∪ {c'} := + arcComponentsIn_eq_of_finite_cover hC'_fin hcov hC'_ne hC'_path hC'_disj hC'_closed + have hU'_closed : IsClosed ((Γ.U \ c) ∪ Δ) := by + have hU'_eq : (Γ.U \ c) ∪ Δ = Γ.N ∪ ⋃ d ∈ (Γ.C \ {c}) ∪ {c'}, closure d := by + ext x + simp only [mem_union, mem_sdiff, mem_iUnion, mem_singleton_iff] + constructor + · rintro (⟨hxU, hxc⟩ | hxΔ) + · by_cases hxN : x ∈ Γ.N + · exact Or.inl hxN + · have hxF : x ∈ F := ⟨Or.inl ⟨hxU, hxc⟩, hxN⟩ + rw [← hcov, mem_sUnion] at hxF + obtain ⟨d, hd, hxd⟩ := hxF + exact Or.inr ⟨d, hd, subset_closure hxd⟩ + · rw [← hcl_c'] at hxΔ + exact Or.inr ⟨c', Or.inr rfl, hxΔ⟩ + · rintro (hxN | ⟨d, ⟨hdC, hdc⟩ | rfl, hxd⟩) + · exact Or.inl ⟨Γ.N_subset hxN, fun hxc => (Γ.cell_subset_diff hcC hxc).2 hxN⟩ + · by_cases hxc : x ∈ c + · exfalso + have hx_inter : x ∈ closure d ∩ closure c := ⟨hxd, subset_closure hxc⟩ + rw [Γ.closure_cell_inter_closure_cell hdC hcC hdc] at hx_inter + exact (Γ.cell_subset_diff hcC hxc).2 (Γ.tilde_subset_N hcC hx_inter.2) + · exact Or.inl ⟨Γ.closure_cell_subset_U hdC hxd, hxc⟩ + · rw [hcl_c'] at hxd + exact Or.inr hxd + rw [hU'_eq] + exact Γ.finite_N.isClosed.union (hC'_fin.isClosed_biUnion fun _ _ => isClosed_closure) + have hc'_bd : ¬ (c' ∩ bd S).Nonempty := by + rintro ⟨x, hxc', hxbd⟩ + have hx_cl_bd : x ∈ closure c ∩ bd S := ⟨hΔ_sub hxc'.1, hxbd⟩ + have hxN : x ∈ Γ.N := by + by_contra hxN + have hxc : x ∈ c := by + rw [← hcl_c_diff] + exact ⟨hx_cl_bd.1, hxN⟩ + exact hc.2 ⟨x, hxc, hxbd⟩ + have hxΔ : x ∈ Δ \ Γ.N := by rwa [hc'_eq] + exact hxΔ.2 hxN + let Γ' : Painting S := + { U := (Γ.U \ c) ∪ Δ + N := Γ.N + isClosed_U := hU'_closed + N_subset := fun x hxN => + Or.inl ⟨Γ.N_subset hxN, fun hxc => (Γ.cell_subset_diff hcC hxc).2 hxN⟩ + finite_N := Γ.finite_N + finite_cells := by rw [hC'_eq]; exact hC'_fin + cell_disc := by + intro d hd + rw [hC'_eq] at hd + rcases hd with ⟨hdC, _⟩ | rfl + · exact Γ.cell_disc d hdC + · refine ⟨?_, ?_, ?_, ?_⟩ + · rw [hcl_c'] + exact hΔ + · rw [hcl_c', htilde_c'] + exact htilde_bdΔ + · rw [htilde_c'] + exact htilde_fin + · rw [htilde_c'] + exact Nat.le_trans (ncard_le_ncard sdiff_subset (Γ.finite_tilde_cell hcC)) + (Γ.ncard_tilde_cell_le hcC) + bd_subset := fun x hxbd => + Or.inl ⟨Γ.bd_subset hxbd, fun hxc => hc.2 ⟨x, hxc, hxbd⟩⟩ + border_cell := by + intro d hd hdbd + rw [hC'_eq] at hd + rcases hd with ⟨hdC, _⟩ | rfl + · exact Γ.border_cell d hdC hdbd + · exact (hc'_bd hdbd).elim } + have hΓ'C : Γ'.C = (Γ.C \ {c}) ∪ {c'} := hC'_eq + refine ⟨Γ', hc, hn, hΔ, hΔ_sub, hnΔ, htilde_sub, rfl, rfl, ?_, hc'_bd, htilde_c', hΓ'C⟩ + rw [hΓ'C] + exact Or.inr rfl + +/-- Given a painting $\Gamma$ in a Hausdorff space $S$, an internal cell $c \in C(\Gamma)$, and a +node $n \in \tilde{c}$, there exist a closed disc $\Delta \subseteq \bar{c}$ and a painting +$\Gamma'$ in $S$ obtained from $\Gamma$ by shrinking $c$ from $n$. +Graph Minors XVII, Section 5 (page 171). -/ +theorem Painting.exists_isShrunkenFrom {S : Type} [TopologicalSpace S] [T2Space S] + (Γ : Painting S) {c : Set S} (hc : Γ.IsInternalCell c) {n : S} (hn : n ∈ tilde c) : + ∃ (Δ : Set S) (Γ' : Painting S), Γ.IsShrunkenFrom Γ' c n Δ := by + have hcC : c ∈ Γ.C := hc.1 + have hD : IsClosedDisc (closure c) := Γ.isClosedDisc_closure_cell hcC + have hn_bd : n ∈ discBd (closure c) := Γ.tilde_subset_discBd hcC hn + have hK_fin : (tilde c \ {n}).Finite := + (Γ.finite_tilde_cell hcC).subset sdiff_subset + have hK_sub : tilde c \ {n} ⊆ discBd (closure c) \ {n} := + fun _ hx => ⟨Γ.tilde_subset_discBd hcC hx.1, hx.2⟩ + obtain ⟨Δ, hΔ, hΔ_sub, hnΔ, hK_Δ, -⟩ := exists_shrunken_disc hD hn_bd hK_fin hK_sub + obtain ⟨Γ', hsh⟩ := Γ.isShrunkenFrom_of_disc hc hn hΔ hΔ_sub hnΔ hK_Δ + exact ⟨Δ, Γ', hsh⟩ + +/-! ## 2. Shrinking a Cell in a Portrayal: (5.2) (Page 171) -/ + +private theorem shrunk_cell_not_mem_old {S : Type} [TopologicalSpace S] + {Γ Γ' : Painting S} {c₀ : Set S} {n : S} {Δ : Set S} + (hsh : Γ.IsShrunkenFrom Γ' c₀ n Δ) : + Δ \ (tilde c₀ \ {n}) ∉ Γ.C \ {c₀} := by + let c' : Set S := Δ \ (tilde c₀ \ {n}) + have hc₀C : c₀ ∈ Γ.C := hsh.1.1 + have hc'C : c' ∈ Γ'.C := hsh.2.2.2.2.2.2.2.2.1 + rintro ⟨hc'Γ, hc'ne⟩ + obtain ⟨x, hxc'⟩ := Γ'.cell_nonempty hc'C + have hx_inter : x ∈ closure c' ∩ closure c₀ := ⟨subset_closure hxc', hsh.2.2.2.1 hxc'.1⟩ + rw [Γ.closure_cell_inter_closure_cell hc'Γ hc₀C hc'ne] at hx_inter + exact (Γ.cell_subset_diff hc'Γ hxc').2 (Γ.tilde_subset_N hc'Γ hx_inter.1) + +private theorem shrunk_cell_cases {S : Type} [TopologicalSpace S] + {Γ Γ' : Painting S} {c₀ : Set S} {n : S} {Δ : Set S} + (hsh : Γ.IsShrunkenFrom Γ' c₀ n Δ) {d : Set S} (hd : d ∈ Γ'.C) : + (d ∈ Γ.C \ {c₀} ∧ d ≠ Δ \ (tilde c₀ \ {n})) ∨ d = Δ \ (tilde c₀ \ {n}) := by + rw [hsh.2.2.2.2.2.2.2.2.2.2.2] at hd + rcases hd with hd | rfl + · exact Or.inl ⟨hd, fun hEq => shrunk_cell_not_mem_old hsh (hEq ▸ hd)⟩ + · exact Or.inr rfl + +@[expose] public section + +/-- Given a portrayal $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ of $G$, an internal cell +$c_0 \in C(\Gamma)$, a node $n \in \tilde{c}_0$ such that +$n \in \operatorname{dom}(\gamma) \implies \gamma(n) \notin V(\alpha(c_0))$, and a painting +$\Gamma'$ obtained from $\Gamma$ by shrinking $c_0$ from $n$ using $\Delta$, the portrayal +$\pi' = (\Sigma, \Gamma', \alpha', \beta, \gamma)$ obtained from $\pi$ by shrinking $c_0$ from $n$, +where $\alpha'(c') = \alpha(c_0)$ for $c' = \Delta \setminus (\tilde{c}_0 \setminus \{n\})$ and +$\alpha'(c) = \alpha(c)$ for $c \in C(\Gamma) \setminus \{c_0\}$. +Graph Minors XVII, Section 5 (page 171). -/ +noncomputable def Portrayal.shrinkCell {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Γ' : Painting π.S) (c₀ : Set π.S) (n : π.S) (Δ : Set π.S) + (hsh : π.Γ.IsShrunkenFrom Γ' c₀ n Δ) + (hn_γ : n ∈ π.domγ → π.nodeVertex n ∉ (π.cellGraph c₀).vertexSet) : + Portrayal G where + S := π.S + top := π.top + isSurface := π.isSurface + connected := π.connected + Γ := Γ' + cellGraph := open Classical in fun d => + if d = Δ \ (tilde c₀ \ {n}) then π.cellGraph c₀ else π.cellGraph d + borderSet := π.borderSet + domγ := π.domγ + nodeVertex := π.nodeVertex + cellGraph_le := by + classical + intro d hd + by_cases hEq : d = Δ \ (tilde c₀ \ {n}) + · rw [ite_eq_left hEq] + exact π.cellGraph_le c₀ hsh.1.1 + · rw [ite_eq_right hEq] + rcases shrunk_cell_cases hsh hd with ⟨⟨hdC, _⟩, _⟩ | rfl + · exact π.cellGraph_le d hdC + · exact (hEq rfl).elim + borderSet_subset := by + rw [hsh.2.2.2.2.2.2.2.1] + exact π.borderSet_subset + domγ_subset := by + rw [hsh.2.2.2.2.2.2.2.1] + exact π.domγ_subset + nodeVertex_mem := π.nodeVertex_mem + nodeVertex_injOn := π.nodeVertex_injOn + p1_vertex := by + classical + intro v hv + obtain ⟨d₀, hd₀C, hvd₀⟩ := π.p1_vertex v hv + by_cases hd₀ : d₀ = c₀ + · subst hd₀ + exact ⟨Δ \ (tilde d₀ \ {n}), hsh.2.2.2.2.2.2.2.2.1, by rwa [ite_eq_left rfl]⟩ + · have hne : d₀ ≠ Δ \ (tilde c₀ \ {n}) := + fun hEq => shrunk_cell_not_mem_old hsh (hEq ▸ ⟨hd₀C, hd₀⟩) + refine ⟨d₀, ?_, ?_⟩ + · rw [hsh.2.2.2.2.2.2.2.2.2.2.2]; exact Or.inl ⟨hd₀C, hd₀⟩ + · rwa [ite_eq_right hne] + p1_edge := by + classical + intro e he + obtain ⟨d₀, hd₀C, hed₀⟩ := π.p1_edge e he + by_cases hd₀ : d₀ = c₀ + · subst hd₀ + exact ⟨Δ \ (tilde d₀ \ {n}), hsh.2.2.2.2.2.2.2.2.1, by rwa [ite_eq_left rfl]⟩ + · have hne : d₀ ≠ Δ \ (tilde c₀ \ {n}) := + fun hEq => shrunk_cell_not_mem_old hsh (hEq ▸ ⟨hd₀C, hd₀⟩) + refine ⟨d₀, ?_, ?_⟩ + · rw [hsh.2.2.2.2.2.2.2.2.2.2.2]; exact Or.inl ⟨hd₀C, hd₀⟩ + · rwa [ite_eq_right hne] + p1_disjoint := by + classical + intro d₁ hd₁ d₂ hd₂ hne + rcases shrunk_cell_cases hsh hd₁ with ⟨⟨hd₁C, hd₁c₀⟩, hd₁c'⟩ | rfl <;> + rcases shrunk_cell_cases hsh hd₂ with ⟨⟨hd₂C, hd₂c₀⟩, hd₂c'⟩ | rfl + · rw [ite_eq_right hd₁c', ite_eq_right hd₂c'] + exact π.p1_disjoint d₁ hd₁C d₂ hd₂C hne + · rw [ite_eq_right hd₁c', ite_eq_left rfl] + exact π.p1_disjoint d₁ hd₁C c₀ hsh.1.1 hd₁c₀ + · rw [ite_eq_left rfl, ite_eq_right hd₂c'] + exact π.p1_disjoint c₀ hsh.1.1 d₂ hd₂C (Ne.symm hd₂c₀) + · exact (hne rfl).elim + p2 := by + classical + intro d hd m hm + rcases shrunk_cell_cases hsh hd with ⟨⟨hdC, _⟩, hdc'⟩ | rfl + · rw [ite_eq_right hdc'] + exact π.p2 d hdC m hm + · rw [ite_eq_left rfl] + rw [hsh.2.2.2.2.2.2.2.2.2.2.1] at hm + exact π.p2 c₀ hsh.1.1 m ⟨hm.1.1, hm.2⟩ + p3_notMem := π.p3_notMem + p3_subset := by + classical + intro d hd hdbd m hm + rcases shrunk_cell_cases hsh hd with ⟨⟨hdC, _⟩, hdc'⟩ | rfl + · rw [ite_eq_right hdc'] + exact π.p3_subset d hdC hdbd m hm + · exact (hsh.2.2.2.2.2.2.2.2.2.1 hdbd).elim + p4_disjoint := by + rw [hsh.2.2.2.2.2.2.2.1] + exact π.p4_disjoint + p4_notMem := by + rw [hsh.2.2.2.2.2.2.2.1] + exact π.p4_notMem + p5 := by + classical + intro d hd hdbd v hv ⟨d₂, hd₂, hd₂_ne, hv₂⟩ + rcases shrunk_cell_cases hsh hd with ⟨⟨hdC, hdc₀⟩, hdc'⟩ | rfl + · rw [ite_eq_right hdc'] at hv + rcases shrunk_cell_cases hsh hd₂ with ⟨⟨hd₂C, _⟩, hd₂c'⟩ | rfl + · rw [ite_eq_right hd₂c'] at hv₂ + exact π.p5 d hdC hdbd v hv ⟨d₂, hd₂C, hd₂_ne, hv₂⟩ + · rw [ite_eq_left rfl] at hv₂ + exact π.p5 d hdC hdbd v hv ⟨c₀, hsh.1.1, Ne.symm hdc₀, hv₂⟩ + · rw [ite_eq_left rfl] at hv + rcases shrunk_cell_cases hsh hd₂ with ⟨⟨hd₂C, hd₂c₀⟩, hd₂c'⟩ | rfl + · rw [ite_eq_right hd₂c'] at hv₂ + obtain ⟨m, ⟨hm_tilde, hm_γ⟩, rfl⟩ := + π.p5 c₀ hsh.1.1 hsh.1.2 v hv ⟨d₂, hd₂C, hd₂c₀, hv₂⟩ + have hmn : m ≠ n := fun hEq => hn_γ (hEq ▸ hm_γ) (hEq ▸ hv) + rw [hsh.2.2.2.2.2.2.2.2.2.2.1] + exact ⟨m, ⟨⟨hm_tilde, hmn⟩, hm_γ⟩, rfl⟩ + · exact (hd₂_ne rfl).elim + p6 := by + classical + intro d hd hdbd v hv ⟨d₂, hd₂, hd₂_ne, hv₂⟩ + rcases shrunk_cell_cases hsh hd with ⟨⟨hdC, hdc₀⟩, hdc'⟩ | rfl + · rw [ite_eq_right hdc'] at hv + rcases shrunk_cell_cases hsh hd₂ with ⟨⟨hd₂C, _⟩, hd₂c'⟩ | rfl + · rw [ite_eq_right hd₂c'] at hv₂ + exact π.p6 d hdC hdbd v hv ⟨d₂, hd₂C, hd₂_ne, hv₂⟩ + · rw [ite_eq_left rfl] at hv₂ + exact π.p6 d hdC hdbd v hv ⟨c₀, hsh.1.1, Ne.symm hdc₀, hv₂⟩ + · exact (hsh.2.2.2.2.2.2.2.2.2.1 hdbd).elim + p7 := by + rw [hsh.2.2.2.2.2.2.2.1] + exact π.p7 + +end + +/-- Shrinking an internal cell preserves $\mathcal{T}$-centrality. +Graph Minors XVII, (5.2) (page 171). -/ +theorem Portrayal.shrinkCell_isCentral {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (π : Portrayal G) (hT : π.IsCentral 𝒯) + (Γ' : Painting π.S) (c₀ : Set π.S) (n : π.S) (Δ : Set π.S) + (hsh : π.Γ.IsShrunkenFrom Γ' c₀ n Δ) + (hn_γ : n ∈ π.domγ → π.nodeVertex n ∉ (π.cellGraph c₀).vertexSet) : + (π.shrinkCell Γ' c₀ n Δ hsh hn_γ).IsCentral 𝒯 := by + classical + dsimp only [Portrayal.IsCentral, Portrayal.shrinkCell] + intro d hd + rcases shrunk_cell_cases hsh hd with ⟨⟨hdC, _⟩, hdc'⟩ | rfl + · rw [ite_eq_right hdc'] + exact hT d hdC + · rw [ite_eq_left rfl] + exact hT c₀ hsh.1.1 + +/-- Shrinking an internal cell produces a portrayal that resembles $\pi$. +Graph Minors XVII, (5.2) (page 171). -/ +theorem Portrayal.shrinkCell_resembles {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Γ' : Painting π.S) (c₀ : Set π.S) (n : π.S) (Δ : Set π.S) + (hsh : π.Γ.IsShrunkenFrom Γ' c₀ n Δ) + (hn_γ : n ∈ π.domγ → π.nodeVertex n ∉ (π.cellGraph c₀).vertexSet) : + (π.shrinkCell Γ' c₀ n Δ hsh hn_γ).Resembles π := by + classical + let c' : Set π.S := Δ \ (tilde c₀ \ {n}) + have hc₀_bd : ¬ (c₀ ∩ bd π.S).Nonempty := hsh.1.2 + have hc'_bd : ¬ (c' ∩ bd π.S).Nonempty := hsh.2.2.2.2.2.2.2.2.2.1 + have hΓ'C : Γ'.C = (π.Γ.C \ {c₀}) ∪ {c'} := hsh.2.2.2.2.2.2.2.2.2.2.2 + dsimp only [Portrayal.Resembles, Portrayal.warpAt, Portrayal.cellWarp, Portrayal.CellWarpLE, + Portrayal.borderPlus, Portrayal.shrinkCell] + refine ⟨Homeomorph.refl π.S, fun Θ hΘ => ?_⟩ + have himg : (Homeomorph.refl π.S : π.S → π.S) '' Θ = Θ := image_id Θ + rw [himg] + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + congr 1 + ext p + constructor + · rintro ⟨d, hd, hdΘ, rfl⟩ + rcases shrunk_cell_cases hsh hd with ⟨⟨hdC, _⟩, hdc'⟩ | rfl + · refine ⟨d, hdC, hdΘ, ?_⟩ + congr 1 + ext q + rw [ite_eq_right hdc'] + · exact (hc'_bd (hdΘ.mono (inter_subset_inter_right _ hΘ_bd))).elim + · rintro ⟨d, hdC, hdΘ, rfl⟩ + have hdc₀ : d ≠ c₀ := fun hEq => hc₀_bd ((hEq ▸ hdΘ).mono (inter_subset_inter_right _ hΘ_bd)) + have hdc' : d ≠ c' := by rintro rfl; exact shrunk_cell_not_mem_old hsh ⟨hdC, hdc₀⟩ + refine ⟨d, ?_, hdΘ, ?_⟩ + · rw [hΓ'C] + exact Or.inl ⟨hdC, hdc₀⟩ + · congr 1 + ext q + rw [ite_eq_right hdc'] + +/-- Shrinking an internal cell produces a portrayal that is strictly truer than $\pi$. +Graph Minors XVII, Section 8 (page 182) and (5.2) (page 171). -/ +theorem Portrayal.shrinkCell_isTruer {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Γ' : Painting π.S) (c₀ : Set π.S) (n : π.S) (Δ : Set π.S) + (hsh : π.Γ.IsShrunkenFrom Γ' c₀ n Δ) + (hn_γ : n ∈ π.domγ → π.nodeVertex n ∉ (π.cellGraph c₀).vertexSet) : + (π.shrinkCell Γ' c₀ n Δ hsh hn_γ).IsTruer π := by + classical + let c' : Set π.S := Δ \ (tilde c₀ \ {n}) + have hc₀C : c₀ ∈ π.Γ.C := hsh.1.1 + have hc₀_bd : ¬ (c₀ ∩ bd π.S).Nonempty := hsh.1.2 + have hn_tilde : n ∈ tilde c₀ := hsh.2.1 + have hc'_bd : ¬ (c' ∩ bd π.S).Nonempty := hsh.2.2.2.2.2.2.2.2.2.1 + have htilde_c' : tilde c' = tilde c₀ \ {n} := hsh.2.2.2.2.2.2.2.2.2.2.1 + have hΓ'C : Γ'.C = (π.Γ.C \ {c₀}) ∪ {c'} := hsh.2.2.2.2.2.2.2.2.2.2.2 + set q := (tilde c₀).ncard with hq_def + have hq_le : q ≤ 3 := π.Γ.ncard_tilde_cell_le hc₀C + have hq_pos : 1 ≤ q := + (ncard_pos (π.Γ.finite_tilde_cell hc₀C)).mpr ⟨n, hn_tilde⟩ + have hncard_c' : (tilde c').ncard = q - 1 := by + rw [htilde_c', ncard_sdiff_singleton_of_mem hn_tilde] + let k : Fin 6 := ⟨3 - q, by omega⟩ + have hk_val : k.1 = 3 - q := rfl + dsimp only [Portrayal.IsTruer, Portrayal.truth, Portrayal.shrinkCell] + refine ⟨k, fun i hik => ?_, ?_⟩ + · have hik_val : i.1 < 3 - q := hik + have hi4 : i.1 < 4 := by omega + have hqi : q < 3 - i.1 := by omega + rw [ite_eq_left hi4, ite_eq_left hi4] + congr 1 + ext d + simp only [mem_sep_iff, hΓ'C, mem_union, mem_sdiff, mem_singleton_iff] + constructor + · rintro (⟨⟨hdC, _⟩ | rfl, hdbd, hdq⟩) + · exact ⟨hdC, hdbd, hdq⟩ + · omega + · rintro ⟨hdC, hdbd, hdq⟩ + have hdc₀ : d ≠ c₀ := by + rintro rfl + rw [← hq_def] at hdq + omega + exact ⟨Or.inl ⟨hdC, hdc₀⟩, hdbd, hdq⟩ + · have hk4 : k.1 < 4 := by omega + have hqk : 3 - k.1 = q := by omega + rw [ite_eq_left hk4, ite_eq_left hk4, hqk] + set S_old := {d ∈ π.Γ.C | ¬ (d ∩ bd π.S).Nonempty ∧ (tilde d).ncard = q} + set S_new := {d ∈ Γ'.C | ¬ (d ∩ bd π.S).Nonempty ∧ (tilde d).ncard = q} + have hEq : S_new = S_old \ {c₀} := by + ext d + simp only [S_new, S_old, mem_sep_iff, hΓ'C, mem_union, mem_sdiff, mem_singleton_iff] + constructor + · rintro (⟨⟨hdC, hdc₀⟩ | rfl, hdbd, hdq⟩) + · exact ⟨⟨hdC, hdbd, hdq⟩, hdc₀⟩ + · omega + · rintro ⟨⟨hdC, hdbd, hdq⟩, hdc₀⟩ + exact ⟨Or.inl ⟨hdC, hdc₀⟩, hdbd, hdq⟩ + have hc₀_mem : c₀ ∈ S_old := ⟨hc₀C, hc₀_bd, rfl⟩ + have hS_old_fin : S_old.Finite := π.Γ.finite_cells.subset fun _ h => h.1 + rw [hEq, ncard_sdiff_singleton_of_mem hc₀_mem] + have hpos : 0 < S_old.ncard := (ncard_pos hS_old_fin).mpr ⟨c₀, hc₀_mem⟩ + omega + +/-- **Graph Minors XVII, (5.2)** (page 171): +"Let $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a hypergraph $G$. Let $c \in C(\Gamma)$ be +internal, and let $n \in \tilde{c} - \operatorname{dom}(\gamma)$. Let $\Gamma'$ be obtained by +shrinking $c$ from $n$; and let $\alpha'$ be defined by $\alpha'(c') = \alpha(c)$, where $c'$ is +the shrunken $c$, and otherwise $\alpha' = \alpha$. Then $\pi' = (\Sigma, \Gamma', \alpha', \beta, +\gamma)$ is a portrayal of $G$." (The paper omits "portrayal of a" before "hypergraph $G$".) + +Moreover, if $\pi$ is $\mathcal{T}$-central, then $\pi'$ is $\mathcal{T}$-central, resembles $\pi$, +and is truer than $\pi$ (holding more generally whenever +$n \in \operatorname{dom}(\gamma) \implies \gamma(n) \notin V(\alpha(c))$). -/ +theorem theorem_5_2_proof {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) [T2Space π.S] + {c₀ : Set π.S} (hc₀ : π.Γ.IsInternalCell c₀) {n : π.S} (hn : n ∈ tilde c₀) + (hn_γ : n ∈ π.domγ → π.nodeVertex n ∉ (π.cellGraph c₀).vertexSet) : + ∃ (Δ : Set π.S) (Γ' : Painting π.S) (hsh : π.Γ.IsShrunkenFrom Γ' c₀ n Δ), + let π' := π.shrinkCell Γ' c₀ n Δ hsh hn_γ + (∀ 𝒯, π.IsCentral 𝒯 → π'.IsCentral 𝒯) ∧ π'.Resembles π ∧ π'.IsTruer π := by + obtain ⟨Δ, Γ', hsh⟩ := π.Γ.exists_isShrunkenFrom hc₀ hn + exact ⟨Δ, Γ', hsh, fun _ hT => π.shrinkCell_isCentral hT Γ' c₀ n Δ hsh hn_γ, + π.shrinkCell_resembles Γ' c₀ n Δ hsh hn_γ, + π.shrinkCell_isTruer Γ' c₀ n Δ hsh hn_γ⟩ + +/-! ## 3. Positive Warp at Cuffs of 0-Redundant Portrayals: (5.1) (Page 171) -/ + +/-- If a portrayal $\pi$ has warp $0$ at a cuff $\Theta \in \text{cuffs}(\Sigma)$, then +$\beta(n) = \emptyset$ for every node $n \in N(\Gamma) \cap \Theta$, and consequently every cell +$c \in C(\Gamma)$ bordering $\Theta$ satisfies the internal-cell condition **(P5)**: +$V(\alpha(c) \cap \alpha(-c)) \subseteq \gamma(\tilde{c} \cap \operatorname{dom}(\gamma))$. +Graph Minors XVII, proof of (5.1) (page 171). -/ +theorem Portrayal.borderSet_eq_empty_of_warpAt_eq_zero + {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) + (hwarp : π.warpAt Θ = 0) : + (∀ n ∈ π.Γ.N ∩ Θ, π.borderSet n = ∅) ∧ + (∀ c ∈ π.Γ.C, (c ∩ Θ).Nonempty → ∀ v ∈ (π.cellGraph c).vertexSet, + (∃ c' ∈ π.Γ.C, c' ≠ c ∧ v ∈ (π.cellGraph c').vertexSet) → + v ∈ π.nodeVertex '' (tilde c ∩ π.domγ)) := by + have hΘ_arc : IsOArc Θ := (GraphMinor.Surface.cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + have hβ : ∀ n ∈ π.Γ.N ∩ Θ, π.borderSet n = ∅ := by + intro n hn + have hle : (π.borderSet n).ncard ≤ 0 := hwarp ▸ π.ncard_borderSet_le_warpAt hΘ hΘ_arc hn + have hfin : (π.borderSet n).Finite := by + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + exact G.vertexSet_finite.subset (π.borderSet_subset n ⟨hn.1, hΘ_bd hn.2⟩) + exact (ncard_eq_zero hfin).mp (Nat.eq_zero_of_le_zero hle) + refine ⟨hβ, fun c hc hinter v hv hex => ?_⟩ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hcbd : (c ∩ bd π.S).Nonempty := hinter.mono (inter_subset_inter_right c hΘ_bd) + have htilde_Θ : tilde c ⊆ π.Γ.N ∩ Θ := + (π.Γ.border_cell_subset_cuff hc hΘ hinter).2.2.2.1 + obtain ⟨n, hn_tilde, hvn | ⟨hn_γ, rfl⟩⟩ := π.p6 c hc hcbd v hv hex + · rw [hβ n (htilde_Θ hn_tilde)] at hvn + exact hvn.elim + · exact ⟨n, ⟨hn_tilde, hn_γ⟩, rfl⟩ + +@[expose] public section + +/-- Topological surface-capping statement for (5.1) (page 171): given a painting $\Gamma$ in a +connected compact surface $\Sigma$ and a cuff $\Theta \in \text{cuffs}(\Sigma)$, pasting a closed +disc onto $\Theta$ yields a connected compact surface $\Sigma'$, a closed embedding +$\iota \colon \Sigma \to \Sigma'$, and a painting $\Gamma' = (\iota '' U(\Gamma), \iota '' +N(\Gamma))$ +in $\Sigma'$ such that $\Sigma'$ is simpler than $\Sigma$, $\operatorname{bd}(\Sigma') = +\iota '' (\operatorname{bd}(\Sigma) \setminus \Theta)$, $\text{cuffs}(\Sigma') = +\{\iota '' \Theta' \mid \Theta' \in \text{cuffs}(\Sigma) \setminus \{\Theta\}\}$, and the cells of +$\Gamma'$ are $\{\iota '' c \mid c \in C(\Gamma)\}$. -/ +def PasteCuffPaintingStatement : Prop := + ∀ (S : Type) [TopologicalSpace S] [CompactSpace S] [T2Space S] [ConnectedSpace S], + IsSurface S → ∀ (Γ : Painting S) (Θ : Set S), Θ ∈ cuffs S → + ∃ (S' : Type) (_ : TopologicalSpace S') (_ : CompactSpace S') (_ : T2Space S') + (_ : ConnectedSpace S'), + IsSurface S' ∧ IsSimplerThan S' S ∧ + ∃ (ι : S → S') (Γ' : Painting S'), + Function.Injective ι ∧ + Γ'.N = ι '' Γ.N ∧ + Γ'.C = (fun c => ι '' c) '' Γ.C ∧ + bd S' = ι '' (bd S \ Θ) ∧ + cuffs S' = (fun Θ' => ι '' Θ') '' (cuffs S \ {Θ}) ∧ + (∀ c ∈ Γ.C, tilde (ι '' c) = ι '' tilde c) ∧ + (∀ Θ' ∈ cuffs S, Θ' ≠ Θ → ∀ n₁ ∈ Γ.N ∩ Θ', ∀ n₂ ∈ Γ.N ∩ Θ', + ∀ n₃ ∈ Γ.N ∩ Θ', ∀ n₄ ∈ Γ.N ∩ Θ', + GM19.InOrderOn (ι '' Θ') (ι n₁) (ι n₂) (ι n₃) (ι n₄) → + GM19.InOrderOn Θ' n₁ n₂ n₃ n₄) + +end + +/-- Corollary of (5.1) (page 171): "From (5.1), every 0-redundant $\mathscr{T}$-central portrayal +has warp $\ge 1$." -/ +theorem one_le_warp_of_isZeroRedundant + {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) : + 1 ≤ π.warp := + π.one_le_warp + +/-! ## 4. Cutting Along a $\Gamma$-Normal $I$-Arc or $O$-Arc: (5.3) and (5.4) (Pages 172–173) -/ + +/-- Separation of $G$ of order $0$ induced by a curve $F$ with $F \cap \operatorname{dom}(\gamma) = +\emptyset$ and $\beta(n) = \emptyset$ for all $n \in F \cap N(\Gamma) \cap +\operatorname{bd}(\Sigma)$ +that partitions $C(\Gamma)$ into $I_1$ and $I_2 = C(\Gamma) \setminus I_1$ so that any node in +$\tilde{c}_1 \cap \tilde{c}_2$ ($c_1 \in I_1, c_2 \in I_2$) lies in $F$: by (2.1) +(`theorem_2_1_proof`), +$(\alpha(I_1), \alpha(I_2))$ is a separation of $G$ of order $0$. +Graph Minors XVII, proofs of (5.3) and (5.4) (pages 172–173). -/ +theorem Portrayal.isSeparation_order_zero_of_normal_cut + {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {F : Set π.S} + (hγ : F ∩ π.domγ = ∅) + (hβ : ∀ n ∈ F ∩ (π.Γ.N ∩ bd π.S), π.borderSet n = ∅) + {I₁ I₂ : Set (Set π.S)} + (hI₁ : I₁ ⊆ π.Γ.C) (hI₂ : I₂ = π.Γ.C \ I₁) + (hsep : ∀ c₁ ∈ I₁, ∀ c₂ ∈ I₂, tilde c₁ ∩ tilde c₂ ⊆ F) : + G.IsSeparation (π.cellsUnion I₁) (π.cellsUnion I₂) ∧ + (π.cellsUnion I₁).vertexSet ∩ (π.cellsUnion I₂).vertexSet = ∅ := by + have hunion : I₁ ∪ I₂ = π.Γ.C := by + rw [hI₂, union_sdiff_self, union_eq_self_of_subset_left hI₁] + have hdisj : Disjoint I₁ I₂ := by + rw [hI₂] + exact disjoint_sdiff_self_right + refine ⟨π.isSeparation_cellsUnion hunion hdisj, ?_⟩ + have h21 := (theorem_2_1_proof π hunion hdisj).2 + change (π.cellsUnion I₁ ∩ π.cellsUnion I₂).vertexSet = ∅ + rw [h21, eq_empty_iff_forall_notMem] + rintro v (hγv | hβv) + · simp only [mem_iUnion, mem_inter_iff] at hγv + obtain ⟨c₁, hc₁, c₂, hc₂, ⟨n₁, ⟨hn₁c₁, hn₁γ⟩, hEq₁⟩, ⟨n₂, ⟨hn₂c₂, hn₂γ⟩, hEq₂⟩⟩ := hγv + obtain rfl : n₁ = n₂ := π.nodeVertex_injOn hn₁γ hn₂γ (hEq₁.trans hEq₂.symm) + have hnF : n₁ ∈ F := hsep c₁ hc₁ c₂ hc₂ ⟨hn₁c₁, hn₂c₂⟩ + have hmem : n₁ ∈ F ∩ π.domγ := ⟨hnF, hn₁γ⟩ + rw [hγ] at hmem + exact hmem + · simp only [mem_iUnion, mem_ofPred_eq] at hβv + obtain ⟨n, ⟨c₁, hc₁, hc₁bd, c₂, hc₂, _, hn₁, hn₂⟩, hvn⟩ := hβv + have hnF : n ∈ F := hsep c₁ hc₁ c₂ hc₂ ⟨hn₁, hn₂⟩ + obtain ⟨u, w, _, htilde, _, _, hu, hw⟩ := π.Γ.border_cell_exists_ends (hI₁ hc₁) hc₁bd + have hn_bd : n ∈ π.Γ.N ∩ bd π.S := by + rw [htilde] at hn₁ + rcases hn₁ with rfl | rfl + · exact hu + · exact hw + rw [hβ n ⟨hnF, hn_bd⟩] at hvn + exact hvn + +private lemma homeomorph_image_symm_image {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + (ψ : X ≃ₜ Y) (s : Set Y) : ψ '' (ψ.symm '' s) = s := by + rw [image_image] + simp [ψ.apply_symm_apply] + +/-- Any homeomorphism $\psi \colon X \simeq_t Y$ maps cuffs of $X$ to cuffs of $Y$. -/ +theorem image_cuff_mem_cuffs {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + (ψ : X ≃ₜ Y) {Θ : Set X} (hΘ : Θ ∈ cuffs X) : + ψ '' Θ ∈ cuffs Y := by + rcases hΘ with ⟨x, hx, rfl⟩ + rw [ψ.image_connectedComponentIn hx, image_bd_homeomorph ψ] + exact ⟨ψ x, image_bd_homeomorph ψ ▸ mem_image_of_mem ψ hx, rfl⟩ + +/-- `IsSimplerThan` is invariant under homeomorphism of the right-hand space. -/ +theorem IsSimplerThan.congr_right {X Y₁ Y₂ : Type*} + [TopologicalSpace X] [TopologicalSpace Y₁] [TopologicalSpace Y₂] + (ψ : Y₁ ≃ₜ Y₂) : + IsSimplerThan X Y₁ ↔ IsSimplerThan X Y₂ := by + unfold IsSimplerThan + constructor + · rintro ⟨a, b, c, a', b', c', hX, ⟨hY₁⟩, hb, h1, h2⟩ + exact ⟨a, b, c, a', b', c', hX, ⟨ψ.symm.trans hY₁⟩, hb, h1, h2⟩ + · rintro ⟨a, b, c, a', b', c', hX, ⟨hY₂⟩, hb, h1, h2⟩ + exact ⟨a, b, c, a', b', c', hX, ⟨ψ.trans hY₂⟩, hb, h1, h2⟩ + +/-- `Portrayal.Resembles` is reflexive. -/ +theorem Portrayal.Resembles.refl {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) : π.Resembles π := + ⟨Homeomorph.refl π.S, fun Θ _ => by simp⟩ + +/-- `Portrayal.Resembles` is symmetric. -/ +theorem Portrayal.Resembles.symm {α₁ α₂ β₁ β₂ : Type*} {G₁ : Hypergraph α₁ β₁} {G₂ : Hypergraph α₂ + β₂} + {π₁ : Portrayal G₁} {π₂ : Portrayal G₂} (h : π₁.Resembles π₂) : + π₂.Resembles π₁ := by + rcases h with ⟨ψ, hψ⟩ + refine ⟨ψ.symm, fun Φ hΦ => ?_⟩ + have hΘ : ψ.symm '' Φ ∈ cuffs π₁.S := image_cuff_mem_cuffs ψ.symm hΦ + have hEq := hψ (ψ.symm '' Φ) hΘ + rw [homeomorph_image_symm_image ψ Φ] at hEq + exact hEq.symm + +/-- `Portrayal.Resembles` is transitive. -/ +theorem Portrayal.Resembles.trans {α₁ α₂ α₃ β₁ β₂ β₃ : Type*} {G₁ : Hypergraph α₁ β₁} + {G₂ : Hypergraph α₂ β₂} {G₃ : Hypergraph α₃ β₃} + {π₁ : Portrayal G₁} {π₂ : Portrayal G₂} {π₃ : Portrayal G₃} + (h₁₂ : π₁.Resembles π₂) (h₂₃ : π₂.Resembles π₃) : + π₁.Resembles π₃ := by + rcases h₁₂ with ⟨ψ₁, hψ₁⟩ + rcases h₂₃ with ⟨ψ₂, hψ₂⟩ + refine ⟨ψ₁.trans ψ₂, fun Θ hΘ => ?_⟩ + have hΦ : ψ₁ '' Θ ∈ cuffs π₂.S := image_cuff_mem_cuffs ψ₁ hΘ + change π₁.warpAt Θ = π₃.warpAt ((ψ₂ ∘ ψ₁) '' Θ) + rw [image_comp, hψ₁ Θ hΘ, hψ₂ (ψ₁ '' Θ) hΦ] + +/-- Resembling portrayals have equal warp. -/ +theorem Portrayal.Resembles.warp_eq {α₁ α₂ β₁ β₂ : Type*} {G₁ : Hypergraph α₁ β₁} {G₂ : Hypergraph + α₂ β₂} + {π₁ : Portrayal G₁} {π₂ : Portrayal G₂} (h : π₁.Resembles π₂) : + π₁.warp = π₂.warp := by + classical + rcases h with ⟨ψ, hψ⟩ + have hcuffs_iff : (cuffs π₁.S).Nonempty ↔ (cuffs π₂.S).Nonempty := + ⟨fun ⟨Θ, hΘ⟩ => ⟨ψ '' Θ, image_cuff_mem_cuffs ψ hΘ⟩, + fun ⟨Φ, hΦ⟩ => ⟨ψ.symm '' Φ, image_cuff_mem_cuffs ψ.symm hΦ⟩⟩ + unfold Portrayal.warp + by_cases hne : (cuffs π₁.S).Nonempty + · rw [ite_eq_left hne, ite_eq_left (hcuffs_iff.mp hne)] + refine congrArg (max 1) (congrArg sSup ?_) + ext p + constructor + · rintro ⟨Θ, hΘ, rfl⟩ + exact ⟨ψ '' Θ, image_cuff_mem_cuffs ψ hΘ, hψ Θ hΘ⟩ + · rintro ⟨Φ, hΦ, rfl⟩ + have hΘ : ψ.symm '' Φ ∈ cuffs π₁.S := image_cuff_mem_cuffs ψ.symm hΦ + refine ⟨ψ.symm '' Φ, hΘ, ?_⟩ + have hEq := hψ (ψ.symm '' Φ) hΘ + rw [homeomorph_image_symm_image ψ Φ] at hEq + exact hEq.symm + · rw [ite_eq_right hne, ite_eq_right (mt hcuffs_iff.mpr hne)] + +/-- Resembling portrayals have the same `IsSimpler` relation on the right. -/ +theorem Portrayal.Resembles.isSimpler_iff {α₀ α₁ α₂ β₀ β₁ β₂ : Type*} + {G₀ : Hypergraph α₀ β₀} {G₁ : Hypergraph α₁ β₁} {G₂ : Hypergraph α₂ β₂} + {π₀ : Portrayal G₀} {π₁ : Portrayal G₁} {π₂ : Portrayal G₂} + (h : π₁.Resembles π₂) : + π₀.IsSimpler π₁ ↔ π₀.IsSimpler π₂ := by + have hw : π₁.warp = π₂.warp := h.warp_eq + rcases h with ⟨ψ, hψ⟩ + unfold Portrayal.IsSimpler + rw [IsSimplerThan.congr_right ψ, hw] + refine or_congr Iff.rfl ⟨?_, ?_⟩ + · rintro ⟨φ, hle, Θ₀, hΘ₀, hlt⟩ + refine ⟨φ.trans ψ, fun Θ hΘ => ?_, Θ₀, hΘ₀, ?_⟩ + · change π₀.warpAt Θ ≤ π₂.warpAt ((ψ ∘ φ) '' Θ) + rw [image_comp, ← hψ (φ '' Θ) (image_cuff_mem_cuffs φ hΘ)] + exact hle Θ hΘ + · change π₀.warpAt Θ₀ < π₂.warpAt ((ψ ∘ φ) '' Θ₀) + rw [image_comp, ← hψ (φ '' Θ₀) (image_cuff_mem_cuffs φ hΘ₀)] + exact hlt + · rintro ⟨φ, hle, Θ₀, hΘ₀, hlt⟩ + refine ⟨φ.trans ψ.symm, fun Θ hΘ => ?_, Θ₀, hΘ₀, ?_⟩ + · have hΦ : (φ.trans ψ.symm) '' Θ ∈ cuffs π₁.S := + image_cuff_mem_cuffs (φ.trans ψ.symm) hΘ + rw [hψ _ hΦ] + change π₀.warpAt Θ ≤ π₂.warpAt (ψ '' ((ψ.symm ∘ φ) '' Θ)) + rw [image_comp, homeomorph_image_symm_image ψ] + exact hle Θ hΘ + · have hΦ₀ : (φ.trans ψ.symm) '' Θ₀ ∈ cuffs π₁.S := + image_cuff_mem_cuffs (φ.trans ψ.symm) hΘ₀ + rw [hψ _ hΦ₀] + change π₀.warpAt Θ₀ < π₂.warpAt (ψ '' ((ψ.symm ∘ φ) '' Θ₀)) + rw [image_comp, homeomorph_image_symm_image ψ] + exact hlt + +/-- If $\pi_1$ resembles $\pi_2$ and $\pi_2$ is 0-redundant relative to $\mathcal{T}$, then +$\pi_1$ is also 0-redundant relative to $\mathcal{T}$. -/ +theorem Portrayal.Resembles.isZeroRedundant {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {π₁ π₂ : Portrayal G} (h : π₁.Resembles π₂) (hred : π₂.IsZeroRedundant 𝒯) : + π₁.IsZeroRedundant 𝒯 := + fun π₀ hT hsimp => hred π₀ hT (h.isSimpler_iff.mp hsimp) + +/-- If $\pi'$ is a portrayal of $G / Z$ ($|Z| \le z$) that resembles a $z$-redundant portrayal +$\pi$ of $G$, then $\pi'$ is 0-redundant relative to $\mathcal{T} / Z$. +Graph Minors XVII, proofs of (6.3) and (6.4) (page 175). -/ +theorem Portrayal.Resembles.isZeroRedundant_quotient + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ z : ℕ} + {Z : Set α} {π : Portrayal G} {π' : Portrayal (quotientVertices G Z)} + (h : π'.Resembles π) (hred : π.IsRedundant 𝒯 θ z) + (hZ : Z ⊆ G.vertexSet) (hZ_card : Z.ncard ≤ z) : + π'.IsZeroRedundant (quotientTangle G 𝒯 Z) := + fun π₀ hT hsimp => hred.2 Z hZ hZ_card π₀ hT (h.isSimpler_iff.mp hsimp) + +/-- Shrinking an internal cell $c_0$ from $n$ preserves $\Gamma$-normality of any set $F$. -/ +theorem Painting.IsNormal.of_isShrunkenFrom {S : Type} [TopologicalSpace S] + {Γ Γ' : Painting S} {c₀ : Set S} {n : S} {Δ : Set S} {F : Set S} + (hnorm : Γ.IsNormal F) (hsh : Γ.IsShrunkenFrom Γ' c₀ n Δ) : + Γ'.IsNormal F := by + have hU_sub : Γ'.U ⊆ Γ.U := by + rw [hsh.2.2.2.2.2.2.1] + rintro x (⟨hxU, _⟩ | hxΔ) + · exact hxU + · exact Γ.isClosed_U.closure_subset_iff.mpr (Γ.cell_subset_U hsh.1.1) (hsh.2.2.2.1 hxΔ) + intro x ⟨hxF, hxU'⟩ + rw [hsh.2.2.2.2.2.2.2.1] + exact hnorm ⟨hxF, hU_sub hxU'⟩ + +private lemma frontier_closedDisc_subset_discBd {S : Type*} [TopologicalSpace S] [T2Space S] + (hS : IsSurface S) {D : Set S} (hD : IsClosedDisc D) : + frontier D ⊆ discBd D := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have h_open : IsOpen (g '' Metric.ball (0 : ℂ) 1) := c.isOpen_image_ball hS.2.2 + have h_sub_int : g '' Metric.ball (0 : ℂ) 1 ⊆ interior D := + h_open.subset_interior_iff.mpr (c.g_subset Metric.ball_subset_closedBall) + intro x ⟨hx_cl, hx_not_int⟩ + have hxD : x ∈ D := (isClosed_of_isClosedDisc hD).closure_eq ▸ hx_cl + rw [← (c.union_ball).1] at hxD + exact hxD.resolve_left fun hx_ball => hx_not_int (h_sub_int hx_ball) + +/-- Shrinking an internal cell $c_0$ from $n$ preserves $\alpha(D)$ for every closed disc +$D \subseteq \Sigma$ whose boundary is contained in $F \cup \operatorname{bd}(\Sigma)$ for a +$\Gamma$-normal set $F$. -/ +theorem Portrayal.shrinkCell_areaGraph_eq {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) [T2Space π.S] + (Γ' : Painting π.S) (c₀ : Set π.S) (n : π.S) (Δ : Set π.S) + (hsh : π.Γ.IsShrunkenFrom Γ' c₀ n Δ) + (hn_γ : n ∈ π.domγ → π.nodeVertex n ∉ (π.cellGraph c₀).vertexSet) + {F D : Set π.S} (hnorm : π.Γ.IsNormal F) + (hD : IsClosedDisc D) (hDbd : discBd D ⊆ F ∪ bd π.S) : + (π.shrinkCell Γ' c₀ n Δ hsh hn_γ).areaGraph D = π.areaGraph D := by + classical + let c' : Set π.S := Δ \ (tilde c₀ \ {n}) + have hc₀C : c₀ ∈ π.Γ.C := hsh.1.1 + have hc₀_bd : ¬ (c₀ ∩ bd π.S).Nonempty := hsh.1.2 + have hc'C : c' ∈ Γ'.C := hsh.2.2.2.2.2.2.2.2.1 + have hΓ'C : Γ'.C = (π.Γ.C \ {c₀}) ∪ {c'} := hsh.2.2.2.2.2.2.2.2.2.2.2 + have hc'_sub_c₀ : c' ⊆ c₀ := by + intro x hx + have hx_cl : x ∈ closure c₀ := hsh.2.2.2.1 hx.1 + have hx_not_N : x ∉ π.Γ.N := by + intro hxN + have hx_tilde : x ∈ tilde c₀ := by + rw [← π.Γ.closure_cell_inter_N hc₀C] + exact ⟨hx_cl, hxN⟩ + have hxn : x ≠ n := fun hEq => hsh.2.2.2.2.1 (hEq ▸ hx.1) + exact hx.2 ⟨hx_tilde, hxn⟩ + rw [← π.Γ.closure_cell_diff_N hc₀C] + exact ⟨hx_cl, hx_not_N⟩ + have hc'_sub_iff : c' ⊆ D ↔ c₀ ⊆ D := by + refine ⟨fun hc'D => ?_, fun hc₀D => hc'_sub_c₀.trans hc₀D⟩ + by_contra hnot + obtain ⟨y, hyc₀, hyD⟩ := not_subset.mp hnot + obtain ⟨x, hxc'⟩ := Γ'.cell_nonempty hc'C + have hxc₀ : x ∈ c₀ := hc'_sub_c₀ hxc' + have hxD : x ∈ D := hc'D hxc' + have hc₀_conn : IsPreconnected c₀ := (π.Γ.cell_isPathConnected hc₀C).isConnected.isPreconnected + have hD_closed : IsClosed D := isClosed_of_isClosedDisc hD + have h_open₁ : IsOpen (interior D) := isOpen_interior + have h_open₂ : IsOpen Dᶜ := hD_closed.isOpen_compl + have h_disj : Disjoint (c₀ ∩ interior D) (c₀ ∩ Dᶜ) := + disjoint_left.mpr fun z ⟨_, hz1⟩ ⟨_, hz2⟩ => hz2 (interior_subset hz1) + have h_not_sub : ¬ c₀ ⊆ interior D ∪ Dᶜ := by + intro hsub + have h_ne₁ : (c₀ ∩ interior D).Nonempty := by + rcases hsub hxc₀ with hx_int | hx_compl + · exact ⟨x, hxc₀, hx_int⟩ + · exact (hx_compl hxD).elim + have h_ne₂ : (c₀ ∩ Dᶜ).Nonempty := ⟨y, hyc₀, hyD⟩ + obtain ⟨z, hz⟩ := hc₀_conn (interior D) Dᶜ h_open₁ h_open₂ hsub h_ne₁ h_ne₂ + exact h_disj.le_bot ⟨⟨hz.1, hz.2.1⟩, ⟨hz.1, hz.2.2⟩⟩ + obtain ⟨z, hzc₀, hz_not⟩ := not_subset.mp h_not_sub + have hz_fr : z ∈ frontier D := by + rw [frontier, hD_closed.closure_eq] + exact ⟨by_contra fun hzD => hz_not (Or.inr hzD), fun hz_int => hz_not (Or.inl hz_int)⟩ + have hz_bd : z ∈ F ∪ bd π.S := + hDbd (frontier_closedDisc_subset_discBd π.isSurface hD hz_fr) + rcases hz_bd with hzF | hzbd + · have hz_diff : z ∈ π.Γ.U \ π.Γ.N := π.Γ.cell_subset_diff hc₀C hzc₀ + exact hz_diff.2 (hnorm ⟨hzF, hz_diff.1⟩) + · exact hc₀_bd ⟨z, hzc₀, hzbd⟩ + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq + ((π.shrinkCell Γ' c₀ n Δ hsh hn_γ).cellsUnion_le _) (π.cellsUnion_le _) + · dsimp only [Portrayal.areaGraph, Portrayal.cellsUnion, Portrayal.shrinkCell] + ext v + simp only [mem_iUnion, mem_inter_iff, mem_ofPred_eq] + constructor + · rintro ⟨d, ⟨⟨hd, hdD⟩, _⟩, hvd⟩ + rcases shrunk_cell_cases hsh hd with ⟨⟨hdC, _⟩, hdc'⟩ | rfl + · rw [ite_eq_right hdc'] at hvd + exact ⟨d, ⟨⟨hdC, hdD⟩, hdC⟩, hvd⟩ + · rw [ite_eq_left rfl] at hvd + exact ⟨c₀, ⟨⟨hc₀C, hc'_sub_iff.mp hdD⟩, hc₀C⟩, hvd⟩ + · rintro ⟨d, ⟨⟨hdC, hdD⟩, _⟩, hvd⟩ + by_cases hdc₀ : d = c₀ + · subst hdc₀ + exact ⟨c', ⟨⟨hc'C, hc'_sub_iff.mpr hdD⟩, hc'C⟩, by rwa [ite_eq_left rfl]⟩ + · have hdc' : d ≠ c' := by rintro rfl; exact shrunk_cell_not_mem_old hsh ⟨hdC, hdc₀⟩ + have hd' : d ∈ Γ'.C := by rw [hΓ'C]; exact Or.inl ⟨hdC, hdc₀⟩ + exact ⟨d, ⟨⟨hd', hdD⟩, hd'⟩, by rwa [ite_eq_right hdc']⟩ + · dsimp only [Portrayal.areaGraph, Portrayal.cellsUnion, Portrayal.shrinkCell] + ext e + simp only [mem_iUnion, mem_inter_iff, mem_ofPred_eq] + constructor + · rintro ⟨d, ⟨⟨hd, hdD⟩, _⟩, hed⟩ + rcases shrunk_cell_cases hsh hd with ⟨⟨hdC, _⟩, hdc'⟩ | rfl + · rw [ite_eq_right hdc'] at hed + exact ⟨d, ⟨⟨hdC, hdD⟩, hdC⟩, hed⟩ + · rw [ite_eq_left rfl] at hed + exact ⟨c₀, ⟨⟨hc₀C, hc'_sub_iff.mp hdD⟩, hc₀C⟩, hed⟩ + · rintro ⟨d, ⟨⟨hdC, hdD⟩, _⟩, hed⟩ + by_cases hdc₀ : d = c₀ + · subst hdc₀ + exact ⟨c', ⟨⟨hc'C, hc'_sub_iff.mpr hdD⟩, hc'C⟩, by rwa [ite_eq_left rfl]⟩ + · have hdc' : d ≠ c' := by rintro rfl; exact shrunk_cell_not_mem_old hsh ⟨hdC, hdc₀⟩ + have hd' : d ∈ Γ'.C := by rw [hΓ'C]; exact Or.inl ⟨hdC, hdc₀⟩ + exact ⟨d, ⟨⟨hd', hdD⟩, hd'⟩, by rwa [ite_eq_right hdc']⟩ + +/-- The finite set of pairs $(c, n)$ where $c \in C(\Gamma)$ is an internal cell and +$n \in \tilde{c} \cap F$. -/ +private def internalNodesOn {S : Type} [TopologicalSpace S] (Γ : Painting S) (F : Set S) : + Set (Set S × S) := + {p ∈ Γ.C ×ˢ Γ.N | ¬ (p.1 ∩ bd S).Nonempty ∧ p.2 ∈ tilde p.1 ∩ F} + +private lemma finite_internalNodesOn {S : Type} [TopologicalSpace S] (Γ : Painting S) (F : Set S) : + (internalNodesOn Γ F).Finite := + (Γ.finite_cells.prod Γ.finite_N).subset fun _ h => h.1 + +private lemma ncard_internalNodesOn_lt_of_isShrunkenFrom {S : Type} [TopologicalSpace S] + {Γ Γ' : Painting S} {c₀ : Set S} {n : S} {Δ F : Set S} + (hsh : Γ.IsShrunkenFrom Γ' c₀ n Δ) (hnF : n ∈ F) : + (internalNodesOn Γ' F).ncard < (internalNodesOn Γ F).ncard := by + classical + let c' : Set S := Δ \ (tilde c₀ \ {n}) + have hc₀C : c₀ ∈ Γ.C := hsh.1.1 + have hc₀_bd : ¬ (c₀ ∩ bd S).Nonempty := hsh.1.2 + have hn_tilde : n ∈ tilde c₀ := hsh.2.1 + have hΓ'N : Γ'.N = Γ.N := hsh.2.2.2.2.2.2.2.1 + have htilde_c' : tilde c' = tilde c₀ \ {n} := hsh.2.2.2.2.2.2.2.2.2.2.1 + let f : Set S × S → Set S × S := fun p => + if p.1 = c' then (c₀, p.2) else p + have hf_inj : InjOn f (internalNodesOn Γ' F) := by + rintro ⟨d₁, m₁⟩ h₁ ⟨d₂, m₂⟩ h₂ hEq + dsimp only [f] at hEq + rcases shrunk_cell_cases hsh h₁.1.1 with ⟨⟨_, hd₁c₀⟩, hd₁c'⟩ | rfl <;> + rcases shrunk_cell_cases hsh h₂.1.1 with ⟨⟨_, hd₂c₀⟩, hd₂c'⟩ | rfl + · rw [ite_eq_right hd₁c', ite_eq_right hd₂c'] at hEq + exact hEq + · rw [ite_eq_right hd₁c', ite_eq_left rfl] at hEq + exact (hd₁c₀ (Prod.ext_iff.mp hEq).1).elim + · rw [ite_eq_left rfl, ite_eq_right hd₂c'] at hEq + exact (hd₂c₀ (Prod.ext_iff.mp hEq).1.symm).elim + · rw [ite_eq_left rfl, ite_eq_left rfl] at hEq + exact Prod.ext rfl (Prod.ext_iff.mp hEq).2 + have hf_sub : f '' (internalNodesOn Γ' F) ⊆ internalNodesOn Γ F \ {(c₀, n)} := by + rintro _ ⟨⟨d, m⟩, ⟨⟨hd, hmN⟩, hdbd, hm_tilde, hmF⟩, rfl⟩ + rw [hΓ'N] at hmN + dsimp only [f] + rcases shrunk_cell_cases hsh hd with ⟨⟨hdC, hdc₀⟩, hdc'⟩ | rfl + · rw [ite_eq_right hdc'] + exact ⟨⟨⟨hdC, hmN⟩, hdbd, hm_tilde, hmF⟩, fun hEq => hdc₀ (Prod.ext_iff.mp hEq).1⟩ + · rw [ite_eq_left rfl] + rw [htilde_c'] at hm_tilde + exact ⟨⟨⟨hc₀C, hmN⟩, hc₀_bd, hm_tilde.1, hmF⟩, + fun hEq => hm_tilde.2 (Prod.ext_iff.mp hEq).2⟩ + have hmem : (c₀, n) ∈ internalNodesOn Γ F := + ⟨⟨hc₀C, Γ.tilde_subset_N hc₀C hn_tilde⟩, hc₀_bd, hn_tilde, hnF⟩ + have hfin : (internalNodesOn Γ F).Finite := finite_internalNodesOn Γ F + have hfin_sdiff : (internalNodesOn Γ F \ {(c₀, n)}).Finite := hfin.subset sdiff_subset + calc (internalNodesOn Γ' F).ncard + = (f '' (internalNodesOn Γ' F)).ncard := hf_inj.ncard_image.symm + _ ≤ (internalNodesOn Γ F \ {(c₀, n)}).ncard := ncard_le_ncard hf_sub hfin_sdiff + _ = (internalNodesOn Γ F).ncard - 1 := ncard_sdiff_singleton_of_mem hmem + _ < (internalNodesOn Γ F).ncard := by + have hpos : 0 < (internalNodesOn Γ F).ncard := (ncard_pos hfin).mpr ⟨(c₀, n), hmem⟩ + omega + +/-- Step 1 of the proof of (5.3) and (5.4) (pages 172–173): by repeatedly applying (5.2) +(`Portrayal.shrinkCell`) and inducting on the number of pairs $(c, n)$ with $c \in C(\Gamma)$ +internal and $n \in \tilde{c} \cap F$, any property $P(\pi, F)$ that is preserved under shrinking an +internal cell $c_0$ from $n \in \tilde{c}_0 \cap F$ and holds whenever +$\tilde{c} \cap F = \emptyset$ for all internal cells $c \in C(\Gamma)$ holds for every +0-redundant $\mathcal{T}$-central portrayal $\pi$ and every $\Gamma$-normal subset +$F \subseteq \Sigma$ with $F \cap \operatorname{dom}(\gamma) = \emptyset$. -/ +theorem Portrayal.induction_shrink_internal_cells {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {P : ∀ (π : Portrayal G), Set π.S → Prop} + (hbase : ∀ (π : Portrayal G) [CompactSpace π.S] [T2Space π.S], + π.IsCentral 𝒯 → π.IsZeroRedundant 𝒯 → + ∀ (F : Set π.S), π.Γ.IsNormal F → F ∩ π.domγ = ∅ → + (∀ c ∈ π.Γ.C, π.Γ.IsInternalCell c → Disjoint (tilde c) F) → + P π F) + (hstep : ∀ (π : Portrayal G) [CompactSpace π.S] [T2Space π.S] + (Γ' : Painting π.S) (c₀ : Set π.S) (n : π.S) (Δ₀ : Set π.S) + (hsh : π.Γ.IsShrunkenFrom Γ' c₀ n Δ₀) + (hn_γ : n ∈ π.domγ → π.nodeVertex n ∉ (π.cellGraph c₀).vertexSet) + (F : Set π.S), π.Γ.IsNormal F → + P (π.shrinkCell Γ' c₀ n Δ₀ hsh hn_γ) F → P π F) + (π : Portrayal G) [CompactSpace π.S] [T2Space π.S] + (hT : π.IsCentral 𝒯) (hred : π.IsZeroRedundant 𝒯) + {F : Set π.S} (hnorm : π.Γ.IsNormal F) (hFγ : F ∩ π.domγ = ∅) : + P π F := by + suffices hmain : ∀ k : ℕ, ∀ (π₁ : Portrayal G) [CompactSpace π₁.S] [T2Space π₁.S], + π₁.IsCentral 𝒯 → π₁.IsZeroRedundant 𝒯 → + ∀ (F₁ : Set π₁.S), π₁.Γ.IsNormal F₁ → F₁ ∩ π₁.domγ = ∅ → + (internalNodesOn π₁.Γ F₁).ncard ≤ k → P π₁ F₁ by + exact hmain (internalNodesOn π.Γ F).ncard π hT hred F hnorm hFγ le_rfl + intro k + induction k with + | zero => + intro π₁ _ _ hT₁ hred₁ F₁ hnorm₁ hF₁γ hle + refine hbase π₁ hT₁ hred₁ F₁ hnorm₁ hF₁γ ?_ + intro c hc hc_int + rw [disjoint_left] + intro n hn_tilde hnF + have hmem : (c, n) ∈ internalNodesOn π₁.Γ F₁ := + ⟨⟨hc, π₁.Γ.tilde_subset_N hc hn_tilde⟩, hc_int.2, hn_tilde, hnF⟩ + have hpos : 0 < (internalNodesOn π₁.Γ F₁).ncard := + (ncard_pos (finite_internalNodesOn π₁.Γ F₁)).mpr ⟨(c, n), hmem⟩ + omega + | succ k ih => + intro π₁ _ _ hT₁ hred₁ F₁ hnorm₁ hF₁γ hle + by_cases hex : ∃ c ∈ π₁.Γ.C, π₁.Γ.IsInternalCell c ∧ ∃ n ∈ tilde c, n ∈ F₁ + · obtain ⟨c₀, _, hc₀_int, n, hn_tilde, hnF⟩ := hex + have hn_not_γ : n ∉ π₁.domγ := fun hnγ => + eq_empty_iff_forall_notMem.mp hF₁γ n ⟨hnF, hnγ⟩ + have hn_γ : n ∈ π₁.domγ → π₁.nodeVertex n ∉ (π₁.cellGraph c₀).vertexSet := + fun hnγ => (hn_not_γ hnγ).elim + obtain ⟨Δ₀, Γ₂, hsh⟩ := π₁.Γ.exists_isShrunkenFrom hc₀_int hn_tilde + let π₂ := π₁.shrinkCell Γ₂ c₀ n Δ₀ hsh hn_γ + have : CompactSpace π₂.S := π₂.isSurface.1 + have : T2Space π₂.S := π₂.isSurface.2.1 + have : ConnectedSpace π₂.S := π₂.connected + have hT₂ : π₂.IsCentral 𝒯 := π₁.shrinkCell_isCentral hT₁ Γ₂ c₀ n Δ₀ hsh hn_γ + have hres₂ : π₂.Resembles π₁ := π₁.shrinkCell_resembles Γ₂ c₀ n Δ₀ hsh hn_γ + have hred₂ : π₂.IsZeroRedundant 𝒯 := hres₂.isZeroRedundant hred₁ + have hnorm₂ : Γ₂.IsNormal F₁ := hnorm₁.of_isShrunkenFrom hsh + have hlt : (internalNodesOn Γ₂ F₁).ncard < (internalNodesOn π₁.Γ F₁).ncard := + ncard_internalNodesOn_lt_of_isShrunkenFrom hsh hnF + have hle₂ : (internalNodesOn π₂.Γ F₁).ncard ≤ k := by + change (internalNodesOn Γ₂ F₁).ncard ≤ k + omega + exact hstep π₁ Γ₂ c₀ n Δ₀ hsh hn_γ F₁ hnorm₁ (ih π₂ hT₂ hred₂ F₁ hnorm₂ hF₁γ hle₂) + · refine hbase π₁ hT₁ hred₁ F₁ hnorm₁ hF₁γ ?_ + intro c hc hc_int + rw [disjoint_left] + intro n hn_tilde hnF + exact hex ⟨c, hc, hc_int, n, hn_tilde, hnF⟩ + +/-- If $H_1, H_2 \le G$ are vertex-disjoint subhypergraphs of $G$, any walk in $(H_1 \cup H_2)^*$ +starting at a vertex in $V(H_1)$ is a walk in $H_1^*$ with the same support. -/ +private lemma walk_skeleton_sup_of_disjoint {α : Type u} {β : Type v} + {G H₁ H₂ : Hypergraph α β} (hH₁ : H₁ ≤ G) (hH₂ : H₂ ≤ G) + (hdisj : H₁.vertexSet ∩ H₂.vertexSet = ∅) + {u w : α} (hu : u ∈ H₁.vertexSet) + (W : (H₁ ∪ H₂).skeleton.Walk u w) : + ∃ W' : H₁.skeleton.Walk u w, W'.support = W.support := by + induction W with + | nil => exact ⟨SimpleGraph.Walk.nil, rfl⟩ + | @cons u v w hadj W_tail ih => + rcases hadj with ⟨huv, e, heu, hev⟩ + have heu₁ : H₁.Inc e u := by + rcases heu with heu₁ | heu₂ + · exact heu₁ + · exfalso + exact eq_empty_iff_forall_notMem.mp hdisj u ⟨hu, H₂.vertex_mem_of_inc heu₂⟩ + have hev₁ : H₁.Inc e v := by + rcases hev with hev₁ | hev₂ + · exact hev₁ + · exfalso + have heG : G.Inc e u := inc_of_le hH₁ heu₁ + have heH₂ : e ∈ H₂.edgeSet := H₂.edge_mem_of_inc hev₂ + have heu₂ : H₂.Inc e u := (inc_iff_of_le hH₂ heH₂).mpr heG + exact eq_empty_iff_forall_notMem.mp hdisj u ⟨hu, H₂.vertex_mem_of_inc heu₂⟩ + have hv : v ∈ H₁.vertexSet := H₁.vertex_mem_of_inc hev₁ + have hadj₁ : H₁.skeleton.Adj u v := ⟨huv, e, heu₁, hev₁⟩ + obtain ⟨W'_tail, hsupp⟩ := ih hv + exact ⟨SimpleGraph.Walk.cons hadj₁ W'_tail, by + dsimp [SimpleGraph.Walk.support] + rw [hsupp]⟩ + +/-- If $H_1, H_2 \le G$ are vertex-disjoint subhypergraphs of $G$ and $X \subseteq V(H_1)$, then +`LinkagePairs` in $H_1^*$ implies `LinkagePairs` in $(H_1 \cup H_2)^*$. -/ +theorem linkagePairs_sup_of_disjoint {α : Type u} {β : Type v} + {G H₁ H₂ : Hypergraph α β} (hH₁ : H₁ ≤ G) (hH₂ : H₂ ≤ G) + (hdisj : H₁.vertexSet ∩ H₂.vertexSet = ∅) + {X Y : Set α} (hX : X ⊆ H₁.vertexSet) {k : ℕ} {x y : α} + (hlink : Portrayal.LinkagePairs H₁.skeleton X Y k x y) : + Portrayal.LinkagePairs (H₁ ∪ H₂).skeleton X Y k x y := by + intro P hP_disj + have hlift : ∀ i : Fin k, ∃ Q : PathFromTo H₁.skeleton X Y, + Q.first = (P i).first ∧ Q.last = (P i).last ∧ Q.walk.support = (P i).walk.support := by + intro i + obtain ⟨W', hsupp⟩ := walk_skeleton_sup_of_disjoint hH₁ hH₂ hdisj (hX (P i).first_mem) + (P i).walk + have hisPath : W'.IsPath := by + rw [SimpleGraph.Walk.isPath_def, hsupp, ← SimpleGraph.Walk.isPath_def] + exact (P i).isPath + exact ⟨⟨(P i).first, (P i).last, W', hisPath, (P i).first_mem, (P i).last_mem⟩, + rfl, rfl, hsupp⟩ + choose Q hQ_first hQ_last hQ_supp using hlift + have hQ_disj : Pairwise fun i j => + Disjoint {z | z ∈ (Q i).walk.support} {z | z ∈ (Q j).walk.support} := by + intro i j hij + rw [hQ_supp i, hQ_supp j] + exact hP_disj hij + obtain ⟨i, hfirst, hlast⟩ := hlink Q hQ_disj + exact ⟨i, (hQ_first i).symm.trans hfirst, (hQ_last i).symm.trans hlast⟩ + +/-- Pure surface-and-painting relation saying that $(S', \iota, \Gamma')$ is the painting on the +surface obtained from $(S, \Gamma)$ by cutting along a curve $F \subseteq S$ and keeping the cell +set $I_{\text{keep}} \subseteq C(\Gamma)$. -/ +structure IsCutSidePainting (S : Type) [TopologicalSpace S] + (Γ : Painting S) (F : Set S) (I_keep : Set (Set S)) + (S' : Type) [TopologicalSpace S'] (ι : S → S') (Γ' : Painting S') : Prop where + /-- $\iota$ is injective. -/ + inj : Function.Injective ι + /-- Every cell of $I_{\text{keep}}$ maps to a cell of $\Gamma'$. -/ + cells_sub : (fun c => ι '' c) '' I_keep ⊆ Γ'.C + /-- $C(\Gamma')$ is nonempty. -/ + cells_nonempty : Γ'.C.Nonempty + /-- Every active node of $I_{\text{keep}}$ outside $F$ maps to a node of $\Gamma'$. -/ + nodes_sub : ι '' {n ∈ Γ.N \ F | ∃ c ∈ I_keep, n ∈ tilde c} ⊆ Γ'.N + /-- A node outside $F$ lies in $\tilde{c}$ exactly when its image lies in the corresponding set of + $\iota '' c$, for every $c \in I_{\text{keep}}$. At an end of $F$ this can fail: the surface + $\Gamma_0$ of the + proof of (5.3) has two copies of such an end, one for each side of $F$. -/ + tilde_image : ∀ c ∈ I_keep, ∀ n ∉ F, ι n ∈ tilde (ι '' c) ↔ n ∈ tilde c + /-- Border cell preservation for $c \in I_{\text{keep}}$. -/ + bd_cell_iff : ∀ c ∈ I_keep, ((ι '' c) ∩ bd S').Nonempty ↔ (c ∩ bd S).Nonempty + /-- Boundary node preservation for active nodes of $I_{\text{keep}}$ outside $F$. -/ + bd_node_iff : ∀ n ∈ {n ∈ Γ.N \ F | ∃ c ∈ I_keep, n ∈ tilde c}, ι n ∈ bd S' ↔ n ∈ bd S + /-- Any new cell in $C(\Gamma') \setminus (\text{image}(\iota) '' I_{\text{keep}})$ has no active + nodes from $I_{\text{keep}} \setminus F$. -/ + new_cell_disjoint : ∀ d ∈ Γ'.C, d ∉ (fun c => ι '' c) '' I_keep → + Disjoint (tilde d) (ι '' {n ∈ Γ.N \ F | ∃ c ∈ I_keep, n ∈ tilde c}) + /-- Separation of cuffs on $S'$ corresponds either to distinct cuffs of $S$ or to separation along + a cuff of $S$ by nodes of $F$. -/ + cuff_sep : ∀ Φ ∈ cuffs S', + ∀ n₁ ∈ {n ∈ Γ.N \ F | ∃ c ∈ I_keep, n ∈ tilde c}, ι n₁ ∈ Φ → + ∀ n₂ ∈ {n ∈ Γ.N \ F | ∃ c ∈ I_keep, n ∈ tilde c}, ι n₂ ∉ Φ → + ∃ Θ ∈ cuffs S, n₁ ∈ Θ ∧ + (n₂ ∉ Θ ∨ (n₂ ∈ Θ ∧ ∃ a ∈ F ∩ (Γ.N ∩ Θ), ∃ b ∈ F ∩ (Γ.N ∩ Θ), + GM19.InOrderOn Θ n₁ a n₂ b)) + /-- Cyclic order on a cuff $\Phi$ of $S'$ lifts to a cuff $\Theta$ of $S$. -/ + cuff_order : ∀ Φ ∈ cuffs S', + ∀ x₁ ∈ Γ'.N ∩ Φ, ∀ x₂ ∈ Γ'.N ∩ Φ, ∀ x₃ ∈ Γ'.N ∩ Φ, ∀ x₄ ∈ Γ'.N ∩ Φ, + GM19.InOrderOn Φ x₁ x₂ x₃ x₄ → + ∀ n₁ ∈ {n ∈ Γ.N \ F | ∃ c ∈ I_keep, n ∈ tilde c}, x₁ = ι n₁ → + ∀ n₃ ∈ {n ∈ Γ.N \ F | ∃ c ∈ I_keep, n ∈ tilde c}, x₃ = ι n₃ → + ∀ Θ ∈ cuffs S, n₁ ∈ Θ → n₃ ∈ Θ → + (∃ a ∈ F ∩ (Γ.N ∩ Θ), ∃ b ∈ F ∩ (Γ.N ∩ Θ), GM19.InOrderOn Θ n₁ a n₃ b) ∨ + (∃ n₂ ∈ {n ∈ Γ.N \ F | ∃ c ∈ I_keep, n ∈ tilde c} ∩ Θ, x₂ = ι n₂ ∧ + ∃ b ∈ (F ∩ (Γ.N ∩ Θ)) ∪ {m ∈ {n ∈ Γ.N \ F | ∃ c ∈ I_keep, n ∈ tilde c} ∩ Θ | x₄ = ι m}, + GM19.InOrderOn Θ n₁ n₂ n₃ b) ∨ + (∃ n₄ ∈ {n ∈ Γ.N \ F | ∃ c ∈ I_keep, n ∈ tilde c} ∩ Θ, x₄ = ι n₄ ∧ + ∃ a ∈ (F ∩ (Γ.N ∩ Θ)) ∪ {m ∈ {n ∈ Γ.N \ F | ∃ c ∈ I_keep, n ∈ tilde c} ∩ Θ | x₂ = ι m}, + GM19.InOrderOn Θ n₁ a n₃ n₄) + +private lemma exists_cuff_of_mem_bd {S : Type*} [TopologicalSpace S] {x : S} (hx : x ∈ bd S) : + ∃ Θ ∈ cuffs S, x ∈ Θ := + ⟨connectedComponentIn (bd S) x, ⟨x, hx, rfl⟩, mem_connectedComponentIn hx⟩ + +private lemma Painting.border_cell_subset_bd {S : Type} [TopologicalSpace S] + (Γ : Painting S) {c : Set S} (hc : c ∈ Γ.C) (hbd : (c ∩ bd S).Nonempty) : + tilde c ⊆ bd S := by + obtain ⟨u, v, _, htilde, _, _, hu, hv⟩ := Γ.border_cell_exists_ends hc hbd + intro n hn + rw [htilde] at hn + rcases hn with rfl | rfl + · exact hu.2 + · exact hv.2 + +@[simp] +theorem Portrayal.cellsUnion_empty_vertexSet {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) : (π.cellsUnion ∅).vertexSet = ∅ := by + ext v + simp [Portrayal.cellsUnion] + +@[simp] +theorem Portrayal.cellsUnion_empty_edgeSet {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) : (π.cellsUnion ∅).edgeSet = ∅ := by + ext e + simp [Portrayal.cellsUnion] + +theorem Portrayal.isSmallWrt_cellsUnion_empty {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + (π : Portrayal G) (hTangle : IsTangle G θ 𝒯) (hθ : 1 ≤ θ) : + IsSmallWrt 𝒯 (π.cellsUnion ∅) := by + have hcov : (∅ : Set (Set π.S)) ∪ π.Γ.C = π.Γ.C := empty_union _ + have hdisj : Disjoint (∅ : Set (Set π.S)) π.Γ.C := Set.empty_disjoint _ + have hsep : G.IsSeparation (π.cellsUnion ∅) (π.cellsUnion π.Γ.C) := + π.isSeparation_cellsUnion hcov hdisj + have hord : separationOrder (π.cellsUnion ∅) (π.cellsUnion π.Γ.C) < θ := by + unfold separationOrder + have hinter : (π.cellsUnion ∅ ∩ π.cellsUnion π.Γ.C).vertexSet = ∅ := by + rw [inter_vertexSet, π.cellsUnion_empty_vertexSet, empty_inter] + rw [hinter, ncard_empty] + exact hθ + rcases hTangle.axiom1 hsep hord with h1 | h2 + · exact ⟨π.cellsUnion π.Γ.C, h1⟩ + · exfalso + have hV : (π.cellsUnion π.Γ.C).vertexSet = G.vertexSet := + congrArg Hypergraph.vertexSet π.cellsUnion_C + exact hTangle.axiom3 h2 hV + +private def cutSideNodes {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (F : Set π.S) (kept : Set (Set π.S)) : Set π.S := + {n ∈ π.Γ.N \ F | ∃ c ∈ kept, n ∈ tilde c} + +open Classical in +private noncomputable def cutSideGraph {α : Type u} {β : Type v} {G : Hypergraph α β} + {S' : Type} (π : Portrayal G) (absorbed : Set (Set π.S)) + (baseGraph : Set S' → Hypergraph α β) (distinguished d : Set S') : Hypergraph α β := + if d = distinguished then baseGraph d ∪ π.cellsUnion absorbed else baseGraph d + +open Classical in +/-- A vertex shared by distinct cut-side cells comes from two retained original cells. -/ +private theorem cutSideGraph_shared_vertex + {α : Type u} {β : Type v} {G : Hypergraph α β} {S' : Type} + (π : Portrayal G) {I_keep I_absorb : Set (Set π.S)} {ι : π.S → S'} + {baseGraph : Set S' → Hypergraph α β} {d₀ d d₂ : Set S'} + (hV_disj : (π.cellsUnion I_keep).vertexSet ∩ (π.cellsUnion I_absorb).vertexSet = ∅) + (hbase_eq : ∀ c ∈ I_keep, baseGraph (ι '' c) = π.cellGraph c) + (hbase_bot : ∀ d ∉ (fun c => ι '' c) '' I_keep, baseGraph d = π.cellsUnion ∅) + (hbase_sub_keep : ∀ d, (baseGraph d).vertexSet ⊆ (π.cellsUnion I_keep).vertexSet) + {v : α} (hd₂_ne : d₂ ≠ d) + (hv : v ∈ (cutSideGraph π I_absorb baseGraph d₀ d).vertexSet) + (hv₂ : v ∈ (cutSideGraph π I_absorb baseGraph d₀ d₂).vertexSet) : + ∃ c ∈ I_keep, ∃ c₂ ∈ I_keep, d = ι '' c ∧ d₂ = ι '' c₂ ∧ + v ∈ (π.cellGraph c).vertexSet ∧ v ∈ (π.cellGraph c₂).vertexSet := by + have base_of_ne : ∀ {A : Set S'}, A ≠ d₀ → + v ∈ (cutSideGraph π I_absorb baseGraph d₀ A).vertexSet → + v ∈ (baseGraph A).vertexSet := by + intro A hA hmem + simpa only [cutSideGraph, ite_eq_right hA] using hmem + have hv_keep : v ∈ (π.cellsUnion I_keep).vertexSet := by + by_cases hd : d = d₀ + · exact hbase_sub_keep d₂ (base_of_ne (fun h => hd₂_ne (h.trans hd.symm)) hv₂) + · exact hbase_sub_keep d (base_of_ne hd hv) + have hv_not_abs : v ∉ (π.cellsUnion I_absorb).vertexSet := + fun h => eq_empty_iff_forall_notMem.mp hV_disj v ⟨hv_keep, h⟩ + have recover : ∀ {A : Set S'}, v ∈ (cutSideGraph π I_absorb baseGraph d₀ A).vertexSet → + ∃ c ∈ I_keep, A = ι '' c ∧ v ∈ (π.cellGraph c).vertexSet := by + intro A hmem + have hbase : v ∈ (baseGraph A).vertexSet := by + dsimp [cutSideGraph] at hmem + split_ifs at hmem + · exact hmem.resolve_right hv_not_abs + · exact hmem + have hA : A ∈ (fun c => ι '' c) '' I_keep := by + by_contra hnot + rw [hbase_bot A hnot, π.cellsUnion_empty_vertexSet] at hbase + exact hbase + obtain ⟨c, hc, rfl⟩ := hA + exact ⟨c, hc, rfl, hbase_eq c hc ▸ hbase⟩ + obtain ⟨c, hc, hd, hcV⟩ := recover hv + obtain ⟨c₂, hc₂, hd₂, hc₂V⟩ := recover hv₂ + exact ⟨c, hc, c₂, hc₂, hd, hd₂, hcV, hc₂V⟩ + +open Classical in +private noncomputable def assembleCutSidePortrayal + {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {F : Set π.S} {I_keep I_absorb : Set (Set π.S)} + {S' : Type} [tS' : TopologicalSpace S'] [connS' : ConnectedSpace S'] + (hsS' : IsSurface S') {ι : π.S → S'} {Γ' : Painting S'} + (hcut : IsCutSidePainting π.S π.Γ F I_keep S' ι Γ') + (hI_keep : I_keep ⊆ π.Γ.C) (hI_absorb : I_absorb = π.Γ.C \ I_keep) + (hV_disj : (π.cellsUnion I_keep).vertexSet ∩ (π.cellsUnion I_absorb).vertexSet = ∅) + (hFγ : F ∩ π.domγ = ∅) + (baseGraph : Set S' → Hypergraph α β) (d₀ : Set S') (hd₀_mem : d₀ ∈ Γ'.C) + (hbase_eq : ∀ c ∈ I_keep, baseGraph (ι '' c) = π.cellGraph c) + (hbase_bot : ∀ d ∉ (fun c => ι '' c) '' I_keep, baseGraph d = π.cellsUnion ∅) + (hbase_le : ∀ d, baseGraph d ≤ G) + (hbase_sub_keep : ∀ d, (baseGraph d).vertexSet ⊆ (π.cellsUnion I_keep).vertexSet) + (hle_α' : ∀ d, baseGraph d ≤ cutSideGraph π I_absorb baseGraph d₀ d) + (β' : S' → Set α) (γ' : S' → α) + (hβ'_eq : ∀ n ∈ cutSideNodes π F I_keep, β' (ι n) = π.borderSet n) + (hβ'_empty : ∀ x ∉ ι '' cutSideNodes π F I_keep, β' x = ∅) + (hγ'_eq : ∀ n, γ' (ι n) = π.nodeVertex n) + (hbp_F : ∀ n ∈ F ∩ (π.Γ.N ∩ bd π.S), ∀ v : α, + ¬ (v ∈ π.borderSet n ∨ n ∈ π.domγ ∧ v = π.nodeVertex n)) + (hbp_sep_Θ : ∀ {Θ : Set π.S}, Θ ∈ cuffs π.S → ∀ {n₁ n₂ a b : π.S}, + n₁ ∈ π.Γ.N ∩ Θ → n₂ ∈ π.Γ.N ∩ Θ → a ∈ F ∩ (π.Γ.N ∩ Θ) → + b ∈ F ∩ (π.Γ.N ∩ Θ) → GM19.InOrderOn Θ n₁ a n₂ b → ∀ v : α, + v ∈ π.borderSet n₁ ∨ n₁ ∈ π.domγ ∧ v = π.nodeVertex n₁ → + v ∈ π.borderSet n₂ ∨ n₂ ∈ π.domγ ∧ v = π.nodeVertex n₂ → False) + (hbp_same_cuff : ∀ {n₁ n₂ : π.S} {Θ : Set π.S}, Θ ∈ cuffs π.S → + n₁ ∈ π.Γ.N ∩ Θ → n₂ ∈ π.Γ.N → ∀ v : α, + v ∈ π.borderSet n₁ ∨ n₁ ∈ π.domγ ∧ v = π.nodeVertex n₁ → + n₂ ∈ bd π.S ∧ v ∈ π.borderSet n₂ ∨ n₂ ∈ π.domγ ∧ v = π.nodeVertex n₂ → n₂ ∈ Θ) : + Portrayal G where + S := S' + top := tS' + isSurface := hsS' + connected := connS' + Γ := Γ' + cellGraph := cutSideGraph π I_absorb baseGraph d₀ + borderSet := β' + domγ := ι '' (cutSideNodes π F I_keep ∩ π.domγ) + nodeVertex := γ' + cellGraph_le := by + intro d _ + dsimp [cutSideGraph] + split_ifs + · exact union_le (hbase_le d) (π.cellsUnion_le I_absorb) + · exact hbase_le d + borderSet_subset := by + intro x ⟨_, hxbd⟩ + by_cases hxN₁ : x ∈ ι '' (cutSideNodes π F I_keep) + · obtain ⟨n, hn, rfl⟩ := hxN₁ + rw [hβ'_eq n hn] + exact π.borderSet_subset n ⟨hn.1.1, (hcut.bd_node_iff n hn).mp hxbd⟩ + · rw [hβ'_empty x hxN₁] + exact empty_subset _ + domγ_subset := by + refine Subset.trans (image_mono inter_subset_left) hcut.nodes_sub + nodeVertex_mem := by + rintro _ ⟨n, ⟨_, hnγ⟩, rfl⟩ + rw [hγ'_eq n] + exact π.nodeVertex_mem n hnγ + nodeVertex_injOn := by + rintro _ ⟨n₁, ⟨_, hn₁γ⟩, rfl⟩ _ ⟨n₂, ⟨_, hn₂γ⟩, rfl⟩ hEq + rw [hγ'_eq n₁, hγ'_eq n₂] at hEq + rw [π.nodeVertex_injOn hn₁γ hn₂γ hEq] + p1_vertex := by + intro v hv + obtain ⟨c, hc, hvc⟩ := π.p1_vertex v hv + by_cases hc_keep : c ∈ I_keep + · refine ⟨ι '' c, hcut.cells_sub (mem_image_of_mem _ hc_keep), ?_⟩ + exact (hle_α' (ι '' c)).vertexSet_subset (by rwa [hbase_eq c hc_keep]) + · have hc_abs : c ∈ I_absorb := by + rw [hI_absorb] + exact ⟨hc, hc_keep⟩ + refine ⟨d₀, hd₀_mem, ?_⟩ + dsimp [cutSideGraph] + rw [ite_eq_left rfl] + exact Or.inr ((π.cellGraph_le_cellsUnion hc_abs hc).vertexSet_subset hvc) + p1_edge := by + intro e he + obtain ⟨c, hc, hec⟩ := π.p1_edge e he + by_cases hc_keep : c ∈ I_keep + · refine ⟨ι '' c, hcut.cells_sub (mem_image_of_mem _ hc_keep), ?_⟩ + exact (hle_α' (ι '' c)).edgeSet_subset (by rwa [hbase_eq c hc_keep]) + · have hc_abs : c ∈ I_absorb := by + rw [hI_absorb] + exact ⟨hc, hc_keep⟩ + refine ⟨d₀, hd₀_mem, ?_⟩ + dsimp [cutSideGraph] + rw [ite_eq_left rfl] + exact Or.inr ((π.cellGraph_le_cellsUnion hc_abs hc).edgeSet_subset hec) + p1_disjoint := by + have hbase_disj_abs : ∀ d, Disjoint (baseGraph d).edgeSet (π.cellsUnion I_absorb).edgeSet := by + intro d + by_cases hd : ∃ c ∈ I_keep, d = ι '' c + · obtain ⟨c, hc, rfl⟩ := hd + rw [hbase_eq c hc, disjoint_left] + intro e hec he_abs + rw [Portrayal.cellsUnion, mem_iUnion₂] at he_abs + obtain ⟨c₂, ⟨hc₂, hc₂C⟩, hec₂⟩ := he_abs + have hne : c ≠ c₂ := by + rintro rfl + rw [hI_absorb] at hc₂ + exact hc₂.2 hc + exact (π.p1_disjoint c (hI_keep hc) c₂ hc₂C hne).le_bot ⟨hec, hec₂⟩ + · rw [hbase_bot d (fun ⟨c, hc, hEq⟩ => hd ⟨c, hc, hEq.symm⟩), + π.cellsUnion_empty_edgeSet] + exact Set.empty_disjoint _ + have hbase_disj : ∀ d₁ d₂, d₁ ≠ d₂ → Disjoint (baseGraph d₁).edgeSet (baseGraph d₂).edgeSet + := by + intro d₁ d₂ hne + by_cases hd₁ : ∃ c₁ ∈ I_keep, d₁ = ι '' c₁ + · by_cases hd₂ : ∃ c₂ ∈ I_keep, d₂ = ι '' c₂ + · obtain ⟨c₁, hc₁, rfl⟩ := hd₁ + obtain ⟨c₂, hc₂, rfl⟩ := hd₂ + rw [hbase_eq c₁ hc₁, hbase_eq c₂ hc₂] + exact π.p1_disjoint c₁ (hI_keep hc₁) c₂ (hI_keep hc₂) + (fun h => hne (congrArg _ h)) + · rw [hbase_bot d₂ (fun ⟨c, hc, hEq⟩ => hd₂ ⟨c, hc, hEq.symm⟩), + π.cellsUnion_empty_edgeSet] + exact Set.disjoint_empty _ + · rw [hbase_bot d₁ (fun ⟨c, hc, hEq⟩ => hd₁ ⟨c, hc, hEq.symm⟩), + π.cellsUnion_empty_edgeSet] + exact Set.empty_disjoint _ + intro d₁ _ d₂ _ hne + dsimp [cutSideGraph] + by_cases hd₁ : d₁ = d₀ + · have hd₂ : d₂ ≠ d₀ := fun h => hne (hd₁.trans h.symm) + rw [ite_eq_left hd₁, ite_eq_right hd₂, union_edgeSet] + exact (hbase_disj d₁ d₂ hne).union_left (hbase_disj_abs d₂).symm + · rw [ite_eq_right hd₁] + split_ifs with hd₂ + · rw [union_edgeSet] + exact (hbase_disj d₁ d₂ hne).union_right (hbase_disj_abs d₁) + · exact hbase_disj d₁ d₂ hne + p2 := by + rintro d hd _ ⟨hx_tilde, ⟨n, ⟨hnN₁, hnγ⟩, rfl⟩⟩ + have hd_mem : d ∈ (fun c => ι '' c) '' I_keep := by + by_contra hd_not + exact (hcut.new_cell_disjoint d hd hd_not).le_bot ⟨hx_tilde, mem_image_of_mem ι hnN₁⟩ + obtain ⟨c, hc, rfl⟩ := hd_mem + replace hx_tilde := (hcut.tilde_image c hc n hnN₁.1.2).mp hx_tilde + rw [hγ'_eq n] + exact (hle_α' (ι '' c)).vertexSet_subset + (by rw [hbase_eq c hc]; exact π.p2 c (hI_keep hc) n ⟨hx_tilde, hnγ⟩) + p3_notMem := by + rintro _ ⟨⟨n, ⟨hnN₁, hnγ⟩, rfl⟩, hxbd⟩ + rw [hγ'_eq n, hβ'_eq n hnN₁] + exact π.p3_notMem n ⟨hnγ, (hcut.bd_node_iff n hnN₁).mp hxbd⟩ + p3_subset := by + intro d hd hdbd x hx_tilde + by_cases hxN₁ : x ∈ ι '' (cutSideNodes π F I_keep) + · obtain ⟨n, hnN₁, rfl⟩ := hxN₁ + have hd_mem : d ∈ (fun c => ι '' c) '' I_keep := by + by_contra hd_not + exact (hcut.new_cell_disjoint d hd hd_not).le_bot ⟨hx_tilde, mem_image_of_mem ι hnN₁⟩ + obtain ⟨c, hc, rfl⟩ := hd_mem + replace hx_tilde := (hcut.tilde_image c hc n hnN₁.1.2).mp hx_tilde + rw [hβ'_eq n hnN₁] + refine Subset.trans ?_ (hle_α' (ι '' c)).vertexSet_subset + rw [hbase_eq c hc] + exact π.p3_subset c (hI_keep hc) ((hcut.bd_cell_iff c hc).mp hdbd) n hx_tilde + · rw [hβ'_empty x hxN₁] + exact empty_subset _ + p4_disjoint := by + intro Φ₁ hΦ₁ Φ₂ hΦ₂ hne x₁ hx₁ x₂ hx₂ + by_cases hx₁N₁ : x₁ ∈ ι '' (cutSideNodes π F I_keep) + · by_cases hx₂N₁ : x₂ ∈ ι '' (cutSideNodes π F I_keep) + · obtain ⟨n₁, hn₁, rfl⟩ := hx₁N₁ + obtain ⟨n₂, hn₂, rfl⟩ := hx₂N₁ + rw [hβ'_eq n₁ hn₁, hβ'_eq n₂ hn₂] + have hx₂_not_Φ₁ : ι n₂ ∉ Φ₁ := by + intro hmem + have hEq : Φ₁ = Φ₂ := by + rcases hΦ₁ with ⟨z₁, _, rfl⟩ + rcases hΦ₂ with ⟨z₂, _, rfl⟩ + exact (connectedComponentIn_eq hmem).trans (connectedComponentIn_eq hx₂.2).symm + exact hne hEq + obtain ⟨Θ, hΘ, hn₁Θ, hn₂_cases⟩ := hcut.cuff_sep Φ₁ hΦ₁ n₁ hn₁ hx₁.2 n₂ hn₂ hx₂_not_Φ₁ + have hΦ₂_bd : Φ₂ ⊆ bd S' := by + rcases hΦ₂ with ⟨z₂, _, rfl⟩ + exact connectedComponentIn_subset (bd S') z₂ + have hn₂_bd : n₂ ∈ bd π.S := (hcut.bd_node_iff n₂ hn₂).mp (hΦ₂_bd hx₂.2) + rw [disjoint_left] + intro v hv₁ hv₂ + rcases hn₂_cases with hn₂_not_Θ | ⟨hn₂Θ, a, ha, b, hb, hord⟩ + · exact hn₂_not_Θ (hbp_same_cuff hΘ ⟨hn₁.1.1, hn₁Θ⟩ hn₂.1.1 v + (Or.inl hv₁) (Or.inl ⟨hn₂_bd, hv₂⟩)) + · exact hbp_sep_Θ hΘ ⟨hn₁.1.1, hn₁Θ⟩ ⟨hn₂.1.1, hn₂Θ⟩ ha hb hord v + (Or.inl hv₁) (Or.inl hv₂) + · rw [hβ'_empty x₂ hx₂N₁] + exact Set.disjoint_empty _ + · rw [hβ'_empty x₁ hx₁N₁] + exact Set.empty_disjoint _ + p4_notMem := by + rintro Φ hΦ x₁ hx₁ _ ⟨n₂, ⟨hn₂, hn₂γ⟩, rfl⟩ hx₂_not_Φ hv₁ + by_cases hx₁N₁ : x₁ ∈ ι '' (cutSideNodes π F I_keep) + · obtain ⟨n₁, hn₁, rfl⟩ := hx₁N₁ + rw [hγ'_eq n₂, hβ'_eq n₁ hn₁] at hv₁ + obtain ⟨Θ, hΘ, hn₁Θ, hn₂_cases⟩ := hcut.cuff_sep Φ hΦ n₁ hn₁ hx₁.2 n₂ hn₂ hx₂_not_Φ + rcases hn₂_cases with hn₂_not_Θ | ⟨hn₂Θ, a, ha, b, hb, hord⟩ + · exact hn₂_not_Θ (hbp_same_cuff hΘ ⟨hn₁.1.1, hn₁Θ⟩ hn₂.1.1 (π.nodeVertex n₂) + (Or.inl hv₁) (Or.inr ⟨hn₂γ, rfl⟩)) + · exact hbp_sep_Θ hΘ ⟨hn₁.1.1, hn₁Θ⟩ ⟨hn₂.1.1, hn₂Θ⟩ ha hb hord (π.nodeVertex n₂) + (Or.inl hv₁) (Or.inr ⟨hn₂γ, rfl⟩) + · rw [hβ'_empty x₁ hx₁N₁] at hv₁ + exact hv₁ + p5 := by + intro d hd hdbd v hv ⟨d₂, _, hd₂_ne, hv₂⟩ + obtain ⟨c, hc, c₂, hc₂, rfl, rfl, hv_base, hv₂_base⟩ := + cutSideGraph_shared_vertex π hV_disj hbase_eq hbase_bot hbase_sub_keep hd₂_ne hv hv₂ + have hc_bd : ¬ (c ∩ bd π.S).Nonempty := mt (hcut.bd_cell_iff c hc).mpr hdbd + have hc₂_ne : c₂ ≠ c := fun h => hd₂_ne (congrArg _ h) + obtain ⟨n, ⟨hn_tilde, hnγ⟩, rfl⟩ := + π.p5 c (hI_keep hc) hc_bd v hv_base ⟨c₂, hI_keep hc₂, hc₂_ne, hv₂_base⟩ + have hnF : n ∉ F := fun h => eq_empty_iff_forall_notMem.mp hFγ n ⟨h, hnγ⟩ + have hnN₁ : n ∈ cutSideNodes π F I_keep := + ⟨⟨π.Γ.tilde_subset_N (hI_keep hc) hn_tilde, hnF⟩, c, hc, hn_tilde⟩ + exact ⟨ι n, ⟨(hcut.tilde_image c hc n hnF).mpr hn_tilde, mem_image_of_mem ι ⟨hnN₁, hnγ⟩⟩, + hγ'_eq n⟩ + p6 := by + intro d hd hdbd v hv ⟨d₂, _, hd₂_ne, hv₂⟩ + obtain ⟨c, hc, c₂, hc₂, rfl, rfl, hv_base, hv₂_base⟩ := + cutSideGraph_shared_vertex π hV_disj hbase_eq hbase_bot hbase_sub_keep hd₂_ne hv hv₂ + have hc_bd : (c ∩ bd π.S).Nonempty := (hcut.bd_cell_iff c hc).mp hdbd + have hc₂_ne : c₂ ≠ c := fun h => hd₂_ne (congrArg _ h) + obtain ⟨n, hn_tilde, hvn⟩ := + π.p6 c (hI_keep hc) hc_bd v hv_base ⟨c₂, hI_keep hc₂, hc₂_ne, hv₂_base⟩ + have hn_bd : n ∈ π.Γ.N ∩ bd π.S := + ⟨π.Γ.tilde_subset_N (hI_keep hc) hn_tilde, + π.Γ.border_cell_subset_bd (hI_keep hc) hc_bd hn_tilde⟩ + have hnF : n ∉ F := fun h => hbp_F n ⟨h, hn_bd⟩ v hvn + have hnN₁ : n ∈ cutSideNodes π F I_keep := ⟨⟨hn_bd.1, hnF⟩, c, hc, hn_tilde⟩ + refine ⟨ι n, (hcut.tilde_image c hc n hnF).mpr hn_tilde, ?_⟩ + rw [hβ'_eq n hnN₁, hγ'_eq n, hcut.inj.mem_set_image] + rcases hvn with hvn | ⟨hnγ, rfl⟩ + · exact Or.inl hvn + · exact Or.inr ⟨⟨hnN₁, hnγ⟩, rfl⟩ + p7 := by + intro Φ hΦ x₁ hx₁ x₂ hx₂ x₃ hx₃ x₄ hx₄ hord v hv₁ hv₃ + have hx₁N₁ : ∃ n₁ ∈ cutSideNodes π F I_keep, x₁ = ι n₁ ∧ + (v ∈ π.borderSet n₁ ∨ (n₁ ∈ π.domγ ∧ v = π.nodeVertex n₁)) := by + by_cases h : x₁ ∈ ι '' (cutSideNodes π F I_keep) + · obtain ⟨n₁, hn₁, rfl⟩ := h + rw [hβ'_eq n₁ hn₁, hγ'_eq n₁, hcut.inj.mem_set_image] at hv₁ + exact ⟨n₁, hn₁, rfl, hv₁.imp_right fun ⟨⟨_, hn₁γ⟩, hEq⟩ => ⟨hn₁γ, hEq⟩⟩ + · rw [hβ'_empty x₁ h] at hv₁ + rcases hv₁ with hv₁ | ⟨⟨n₁, ⟨hn₁, _⟩, rfl⟩, _⟩ + · exact hv₁.elim + · exact (h ⟨n₁, hn₁, rfl⟩).elim + have hx₃N₁ : ∃ n₃ ∈ cutSideNodes π F I_keep, x₃ = ι n₃ ∧ + (v ∈ π.borderSet n₃ ∨ (n₃ ∈ π.domγ ∧ v = π.nodeVertex n₃)) := by + by_cases h : x₃ ∈ ι '' (cutSideNodes π F I_keep) + · obtain ⟨n₃, hn₃, rfl⟩ := h + rw [hβ'_eq n₃ hn₃, hγ'_eq n₃, hcut.inj.mem_set_image] at hv₃ + exact ⟨n₃, hn₃, rfl, hv₃.imp_right fun ⟨⟨_, hn₃γ⟩, hEq⟩ => ⟨hn₃γ, hEq⟩⟩ + · rw [hβ'_empty x₃ h] at hv₃ + rcases hv₃ with hv₃ | ⟨⟨n₃, ⟨hn₃, _⟩, rfl⟩, _⟩ + · exact hv₃.elim + · exact (h ⟨n₃, hn₃, rfl⟩).elim + obtain ⟨n₁, hn₁, hx₁_eq, hvn₁⟩ := hx₁N₁ + obtain ⟨n₃, hn₃, hx₃_eq, hvn₃⟩ := hx₃N₁ + have hΦ_bd : Φ ⊆ bd S' := by + rcases hΦ with ⟨z₀, _, rfl⟩ + exact connectedComponentIn_subset (bd S') z₀ + have hn₁_bd : n₁ ∈ bd π.S := (hcut.bd_node_iff n₁ hn₁).mp (hx₁_eq ▸ hΦ_bd hx₁.2) + have hn₃_bd : n₃ ∈ bd π.S := (hcut.bd_node_iff n₃ hn₃).mp (hx₃_eq ▸ hΦ_bd hx₃.2) + obtain ⟨Θ, hΘ, hn₁Θ⟩ := exists_cuff_of_mem_bd hn₁_bd + have hn₃Θ : n₃ ∈ Θ := + hbp_same_cuff hΘ ⟨hn₁.1.1, hn₁Θ⟩ hn₃.1.1 v hvn₁ + (hvn₃.imp_left fun h => ⟨hn₃_bd, h⟩) + rcases hcut.cuff_order Φ hΦ x₁ hx₁ x₂ hx₂ x₃ hx₃ x₄ hx₄ hord + n₁ hn₁ hx₁_eq n₃ hn₃ hx₃_eq Θ hΘ hn₁Θ hn₃Θ with + ⟨a, ha, b, hb, hordΘ⟩ | + ⟨n₂, ⟨hn₂N₁, hn₂Θ⟩, hx₂_eq, b, hb, hordΘ⟩ | + ⟨n₄, ⟨hn₄N₁, hn₄Θ⟩, hx₄_eq, a, ha, hordΘ⟩ + · exact (hbp_sep_Θ hΘ ⟨hn₁.1.1, hn₁Θ⟩ ⟨hn₃.1.1, hn₃Θ⟩ ha hb hordΘ v hvn₁ hvn₃).elim + · have hb_mem : b ∈ π.Γ.N ∩ Θ := by + rcases hb with hbF | ⟨⟨hbN₁, hbΘ⟩, _⟩ + · exact hbF.2 + · exact ⟨hbN₁.1.1, hbΘ⟩ + rcases π.p7 Θ hΘ n₁ ⟨hn₁.1.1, hn₁Θ⟩ n₂ ⟨hn₂N₁.1.1, hn₂Θ⟩ n₃ ⟨hn₃.1.1, hn₃Θ⟩ + b hb_mem hordΘ v hvn₁ hvn₃ with hvn₂ | hvnb + · left + rw [hx₂_eq, hβ'_eq n₂ hn₂N₁, hγ'_eq n₂, hcut.inj.mem_set_image] + exact hvn₂.imp_right fun ⟨hn₂γ, hEq⟩ => ⟨⟨hn₂N₁, hn₂γ⟩, hEq⟩ + · rcases hb with hbF | ⟨⟨hbN₁, _⟩, hx₄_eq⟩ + · have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨z₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) z₀ + exact (hbp_F b ⟨hbF.1, hbF.2.1, hΘ_bd hbF.2.2⟩ v hvnb).elim + · right + rw [hx₄_eq, hβ'_eq b hbN₁, hγ'_eq b, hcut.inj.mem_set_image] + exact hvnb.imp_right fun ⟨hbγ, hEq⟩ => ⟨⟨hbN₁, hbγ⟩, hEq⟩ + · have ha_mem : a ∈ π.Γ.N ∩ Θ := by + rcases ha with haF | ⟨⟨haN₁, haΘ⟩, _⟩ + · exact haF.2 + · exact ⟨haN₁.1.1, haΘ⟩ + rcases π.p7 Θ hΘ n₁ ⟨hn₁.1.1, hn₁Θ⟩ a ha_mem n₃ ⟨hn₃.1.1, hn₃Θ⟩ + n₄ ⟨hn₄N₁.1.1, hn₄Θ⟩ hordΘ v hvn₁ hvn₃ with hvna | hvn₄ + · rcases ha with haF | ⟨⟨haN₁, _⟩, hx₂_eq⟩ + · have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨z₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) z₀ + exact (hbp_F a ⟨haF.1, haF.2.1, hΘ_bd haF.2.2⟩ v hvna).elim + · left + rw [hx₂_eq, hβ'_eq a haN₁, hγ'_eq a, hcut.inj.mem_set_image] + exact hvna.imp_right fun ⟨haγ, hEq⟩ => ⟨⟨haN₁, haγ⟩, hEq⟩ + · right + rw [hx₄_eq, hβ'_eq n₄ hn₄N₁, hγ'_eq n₄, hcut.inj.mem_set_image] + exact hvn₄.imp_right fun ⟨hn₄γ, hEq⟩ => ⟨⟨hn₄N₁, hn₄γ⟩, hEq⟩ + +private theorem cutSideCellWarp {α : Type u} {β : Type v} {G : Hypergraph α β} + (π π' : Portrayal G) {F : Set π.S} {I_keep I_absorb : Set (Set π.S)} + {ι : π.S → π'.S} (hcut : IsCutSidePainting π.S π.Γ F I_keep π'.S ι π'.Γ) + (hI_keep : I_keep ⊆ π.Γ.C) (hFγ : F ∩ π.domγ = ∅) + (hβF : ∀ n ∈ F ∩ (π.Γ.N ∩ bd π.S), π.borderSet n = ∅) + (hV_disj : (π.cellsUnion I_keep).vertexSet ∩ (π.cellsUnion I_absorb).vertexSet = ∅) + (baseGraph : Set π'.S → Hypergraph α β) (d₀ : Set π'.S) + (hbase_eq : ∀ c ∈ I_keep, baseGraph (ι '' c) = π.cellGraph c) + (hα' : ∀ d, π'.cellGraph d = cutSideGraph π I_absorb baseGraph d₀ d) + (hβ'_eq : ∀ n ∈ cutSideNodes π F I_keep, π'.borderSet (ι n) = π.borderSet n) + (hβ'_empty : ∀ x ∉ ι '' cutSideNodes π F I_keep, π'.borderSet x = ∅) + (hγ'_eq : ∀ n, π'.nodeVertex (ι n) = π.nodeVertex n) + (hdom' : π'.domγ = ι '' (cutSideNodes π F I_keep ∩ π.domγ)) : + ∀ d ∈ π'.Γ.C, (d ∩ bd π'.S).Nonempty → π'.cellWarp d ≤ π.warp := by + classical + let N₁ := cutSideNodes π F I_keep + intro d hd hdbd + by_cases hd_mem : d ∈ (fun c => ι '' c) '' I_keep + · obtain ⟨c, hc, rfl⟩ := hd_mem + have hcbd : (c ∩ bd π.S).Nonempty := (hcut.bd_cell_iff c hc).mp hdbd + rcases hcbd with ⟨x₀, hx₀c, hx₀bd⟩ + have hcbd' : (c ∩ bd π.S).Nonempty := ⟨x₀, hx₀c, hx₀bd⟩ + obtain ⟨Θ, hΘ, hx₀Θ⟩ := exists_cuff_of_mem_bd hx₀bd + have hcΘ : (c ∩ Θ).Nonempty := ⟨x₀, hx₀c, hx₀Θ⟩ + have hle_c : π'.cellWarp (ι '' c) ≤ π.cellWarp c := by + rw [π'.cellWarp_le_iff hd hdbd] + have hc_le : π.CellWarpLE c (π.cellWarp c) := π.cellWarp_spec (hI_keep hc) hcbd' + have hβ_eq_c : ∀ n ∈ tilde c, π'.borderSet (ι n) = π.borderSet n := by + intro n hn + by_cases hnF : n ∈ F + · have hn_bd : n ∈ π.Γ.N ∩ bd π.S := + ⟨π.Γ.tilde_subset_N (hI_keep hc) hn, + π.Γ.border_cell_subset_bd (hI_keep hc) hcbd' hn⟩ + have hnotN₁ : ι n ∉ ι '' N₁ := by + rintro ⟨m, hm, hEq⟩ + obtain rfl := hcut.inj hEq + exact hm.1.2 hnF + rw [hβ'_empty (ι n) hnotN₁, hβF n ⟨hnF, hn_bd⟩] + · exact hβ'_eq n ⟨⟨π.Γ.tilde_subset_N (hI_keep hc) hn, hnF⟩, c, hc, hn⟩ + have hbp_eq_c : ∀ n ∈ tilde c, π'.borderPlus (ι n) = π.borderPlus n := by + intro n hn + ext v + simp only [Portrayal.borderPlus, mem_ofPred_eq] + rw [hdom', hβ_eq_c n hn, hγ'_eq n, hcut.inj.mem_set_image] + refine or_congr Iff.rfl (and_congr_left fun _ => ⟨fun h => h.2, fun hnγ => ?_⟩) + have hnF : n ∉ F := fun h => eq_empty_iff_forall_notMem.mp hFγ n ⟨h, hnγ⟩ + exact ⟨⟨⟨π.Γ.tilde_subset_N (hI_keep hc) hn, hnF⟩, c, hc, hn⟩, hnγ⟩ + have hmem_N₁ : ∀ x, (π'.borderPlus x).ncard = π.cellWarp c + 1 → x ∈ ι '' N₁ := by + intro x hx + by_contra hxN + have hemp : π'.borderPlus x = ∅ := by + ext v + simp only [Portrayal.borderPlus, mem_ofPred_eq, mem_empty_iff_false, iff_false, not_or] + refine ⟨?_, ?_⟩ + · rw [hβ'_empty x hxN] + exact notMem_empty v + · rw [hdom'] + rintro ⟨⟨n, ⟨hnN₁, _⟩, rfl⟩, _⟩ + exact hxN (mem_image_of_mem ι hnN₁) + rw [hemp, ncard_empty] at hx + omega + have hsize : ∀ x ∈ tilde (ι '' c), (π'.borderSet x).ncard ≤ π.cellWarp c := by + intro x hx + by_cases hxN : x ∈ ι '' N₁ + · obtain ⟨n, hnN₁, rfl⟩ := hxN + have hn := (hcut.tilde_image c hc n hnN₁.1.2).mp hx + obtain ⟨u, v, huv, htilde, -, -, -, -⟩ := π.Γ.border_cell_exists_ends (hI_keep hc) hcbd' + obtain ⟨m, hm, hmn⟩ : ∃ m ∈ tilde c, n ≠ m := by + rw [htilde] at hn ⊢ + rcases hn with rfl | rfl + · exact ⟨v, Or.inr rfl, huv⟩ + · exact ⟨u, Or.inl rfl, huv.symm⟩ + rw [hβ_eq_c n hn] + exact (hc_le n hn m hm hmn).1 + · rw [hβ'_empty x hxN, ncard_empty] + exact Nat.zero_le _ + intro x₁ hx₁ x₂ hx₂ hne + change (π'.borderSet x₁).ncard ≤ π.cellWarp c ∧ (π'.borderSet x₂).ncard ≤ π.cellWarp c ∧ + ((π'.borderPlus x₁).ncard = π.cellWarp c + 1 → + (π'.borderPlus x₂).ncard = π.cellWarp c + 1 → + Portrayal.LinkagePairs (π'.cellGraph (ι '' c)).skeleton (π'.borderPlus x₁) + (π'.borderPlus x₂) + (π.cellWarp c + 1) (π'.nodeVertex x₁) (π'.nodeVertex x₂)) + refine ⟨hsize x₁ hx₁, hsize x₂ hx₂, fun hbpx₁ hbpx₂ => ?_⟩ + obtain ⟨n₁, hn₁N, rfl⟩ := hmem_N₁ x₁ hbpx₁ + obtain ⟨n₂, hn₂N, rfl⟩ := hmem_N₁ x₂ hbpx₂ + have hn₁ := (hcut.tilde_image c hc n₁ hn₁N.1.2).mp hx₁ + have hn₂ := (hcut.tilde_image c hc n₂ hn₂N.1.2).mp hx₂ + have hne_n : n₁ ≠ n₂ := fun h => hne (congrArg ι h) + obtain ⟨h1, h2, hlink⟩ := hc_le n₁ hn₁ n₂ hn₂ hne_n + rw [hbp_eq_c n₁ hn₁] at hbpx₁ + rw [hbp_eq_c n₂ hn₂] at hbpx₂ + rw [hbp_eq_c n₁ hn₁, hbp_eq_c n₂ hn₂] + rw [hγ'_eq n₁, hγ'_eq n₂] + have hlink₀ := hlink hbpx₁ hbpx₂ + rw [hα'] + dsimp [cutSideGraph] + split_ifs + · rw [hbase_eq c hc] + have hdisj_c : (π.cellGraph c).vertexSet ∩ (π.cellsUnion I_absorb).vertexSet = ∅ := by + rw [eq_empty_iff_forall_notMem] + intro v ⟨hvc, hv_abs⟩ + exact eq_empty_iff_forall_notMem.mp hV_disj v + ⟨(π.cellGraph_le_cellsUnion hc (hI_keep hc)).vertexSet_subset hvc, hv_abs⟩ + have hbp₁_sub : π.borderPlus n₁ ⊆ (π.cellGraph c).vertexSet := by + rintro v (hvβ | ⟨hn₁γ, rfl⟩) + · exact π.p3_subset c (hI_keep hc) hcbd' n₁ hn₁ hvβ + · exact π.p2 c (hI_keep hc) n₁ ⟨hn₁, hn₁γ⟩ + exact linkagePairs_sup_of_disjoint (π.cellGraph_le c (hI_keep hc)) + (π.cellsUnion_le I_absorb) hdisj_c hbp₁_sub hlink₀ + · rwa [hbase_eq c hc] + exact le_trans hle_c + (le_trans (π.cellWarp_le_warpAt (hI_keep hc) hcΘ) (π.warpAt_le_warp hΘ)) + · have h0 : π'.cellWarp d = 0 := by + apply Nat.eq_zero_of_le_zero + rw [π'.cellWarp_le_iff hd hdbd] + intro x₁ hx₁ x₂ hx₂ _ + have hx₁_not : x₁ ∉ ι '' N₁ := + disjoint_left.mp (hcut.new_cell_disjoint d hd hd_mem) hx₁ + have hx₂_not : x₂ ∉ ι '' N₁ := + disjoint_left.mp (hcut.new_cell_disjoint d hd hd_mem) hx₂ + have hbp₁_empty : π'.borderPlus x₁ = ∅ := by + ext v + simp only [Portrayal.borderPlus, mem_ofPred_eq, mem_empty_iff_false, iff_false, not_or] + refine ⟨?_, ?_⟩ + · rw [hβ'_empty x₁ hx₁_not] + exact notMem_empty v + · rw [hdom'] + rintro ⟨⟨n, ⟨hnN₁, _⟩, rfl⟩, _⟩ + exact hx₁_not (mem_image_of_mem ι hnN₁) + change (π'.borderSet x₁).ncard ≤ 0 ∧ (π'.borderSet x₂).ncard ≤ 0 ∧ _ + rw [hβ'_empty x₁ hx₁_not, hβ'_empty x₂ hx₂_not, hbp₁_empty, ncard_empty] + exact ⟨le_rfl, le_rfl, fun h => by omega⟩ + rw [h0] + exact Nat.zero_le _ + +private theorem warp_le_of_cellWarp_le {α : Type u} {β : Type v} {G : Hypergraph α β} + (π π' : Portrayal G) + (hcell : ∀ d ∈ π'.Γ.C, (d ∩ bd π'.S).Nonempty → π'.cellWarp d ≤ π.warp) : + π'.warp ≤ π.warp := by + by_cases hne' : (cuffs π'.S).Nonempty + · have hSup_bdd : ∀ Φ ∈ cuffs π'.S, π'.warpAt Φ ≤ π.warp := by + intro Φ hΦ + have hΦ_bd : Φ ⊆ bd π'.S := by + rcases hΦ with ⟨z₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π'.S) z₀ + unfold Portrayal.warpAt + by_cases hset_ne : {p | ∃ d ∈ π'.Γ.C, (d ∩ Φ).Nonempty ∧ p = π'.cellWarp d}.Nonempty + · refine csSup_le hset_ne ?_ + rintro p ⟨d, hd, hdΦ, rfl⟩ + exact hcell d hd (hdΦ.mono (inter_subset_inter_right d hΦ_bd)) + · rw [not_nonempty_iff_eq_empty.mp hset_ne, csSup_empty] + exact Nat.zero_le _ + unfold Portrayal.warp + rw [ite_eq_left hne'] + obtain ⟨Φ₀, hΦ₀⟩ := hne' + refine max_le π.one_le_warp (csSup_le ⟨π'.warpAt Φ₀, Φ₀, hΦ₀, rfl⟩ ?_) + rintro p ⟨Φ, hΦ, rfl⟩ + exact hSup_bdd Φ hΦ + · unfold Portrayal.warp + rw [ite_eq_right hne'] + exact π.one_le_warp + +/-- Unified portrayal construction for the proofs of (5.3) and (5.4) (pages 172–173): +given a $\mathcal{T}$-central portrayal $\pi$ of $G$, a normal cut along $F$ with +$F \cap \operatorname{dom}(\gamma) = \emptyset$ and $\beta = \emptyset$ on +$F \cap N(\Gamma) \cap \operatorname{bd}(\Sigma)$ partitioning $C(\Gamma)$ into $I_{\text{keep}}$ +and $I_{\text{absorb}} = C(\Gamma) \setminus I_{\text{keep}}$ such that $\alpha(I_{\text{absorb}})$ +is small relative to $\mathcal{T}$, if the cut side $I_{\text{keep}}$ yields a simpler surface +$S'$ with a painting $\Gamma'$ satisfying `IsCutSidePainting`, then there is a $\mathcal{T}$-central +portrayal $\pi'$ of $G$ on $S'$ that is simpler than $\pi$. -/ +theorem Portrayal.exists_simpler_of_isCutSidePainting + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + (hTangle : IsTangle G θ 𝒯) (hθ : 1 ≤ θ) + (π : Portrayal G) (hT : π.IsCentral 𝒯) + {F : Set π.S} (hFγ : F ∩ π.domγ = ∅) + (hβF : ∀ n ∈ F ∩ (π.Γ.N ∩ bd π.S), π.borderSet n = ∅) + {I_keep I_absorb : Set (Set π.S)} + (hI_keep : I_keep ⊆ π.Γ.C) (hI_absorb : I_absorb = π.Γ.C \ I_keep) + (hsep : ∀ c₁ ∈ I_keep, ∀ c₂ ∈ I_absorb, tilde c₁ ∩ tilde c₂ ⊆ F) + (hsmall : IsSmallWrt 𝒯 (π.cellsUnion I_absorb)) + {S' : Type} [tS' : TopologicalSpace S'] [connS' : ConnectedSpace + S'] + (hsS' : IsSurface S') (hsimpS' : IsSimplerThan S' π.S) + {ι : π.S → S'} {Γ' : Painting S'} + (hcut : IsCutSidePainting π.S π.Γ F I_keep S' ι Γ') : + ∃ π' : Portrayal G, π'.IsCentral 𝒯 ∧ π'.IsSimpler π := by + classical + have : ConnectedSpace π.S := π.connected + have hI_absorb_sub : I_absorb ⊆ π.Γ.C := hI_absorb ▸ sdiff_subset + have ⟨hsep_G, hV_disj⟩ := + π.isSeparation_order_zero_of_normal_cut hFγ hβF hI_keep hI_absorb hsep + let N₁ := cutSideNodes π F I_keep + have hcell_eq : ∀ {c₁ c₂ : Set π.S}, ι '' c₁ = ι '' c₂ → c₁ = c₂ := + fun h => hcut.inj.image_injective h + let d₀ : Set S' := hcut.cells_nonempty.some + have hd₀_mem : d₀ ∈ Γ'.C := hcut.cells_nonempty.some_mem + let baseGraph : Set S' → Hypergraph α β := fun d => + if h : ∃ c ∈ I_keep, d = ι '' c then π.cellGraph h.choose else π.cellsUnion ∅ + have hbase_eq : ∀ c ∈ I_keep, baseGraph (ι '' c) = π.cellGraph c := by + intro c hc + have hex : ∃ c₀ ∈ I_keep, ι '' c = ι '' c₀ := ⟨c, hc, rfl⟩ + dsimp [baseGraph] + rw [dite_eq_left hex] + exact congrArg π.cellGraph (hcell_eq hex.choose_spec.2).symm + have hbase_bot : ∀ d, d ∉ (fun c => ι '' c) '' I_keep → baseGraph d = π.cellsUnion ∅ := by + intro d hd + have hnot : ¬ ∃ c ∈ I_keep, d = ι '' c := fun ⟨c, hc, hEq⟩ => hd ⟨c, hc, hEq.symm⟩ + dsimp [baseGraph] + rw [dite_eq_right hnot] + have hbase_le : ∀ d, baseGraph d ≤ G := by + intro d + by_cases hd : ∃ c ∈ I_keep, d = ι '' c + · obtain ⟨c, hc, rfl⟩ := hd + rw [hbase_eq c hc] + exact π.cellGraph_le c (hI_keep hc) + · rw [hbase_bot d (fun ⟨c, hc, hEq⟩ => hd ⟨c, hc, hEq.symm⟩)] + exact π.cellsUnion_le ∅ + have hbase_sub_keep : ∀ d, (baseGraph d).vertexSet ⊆ (π.cellsUnion I_keep).vertexSet := by + intro d v hv + by_cases hd : ∃ c ∈ I_keep, d = ι '' c + · obtain ⟨c, hc, rfl⟩ := hd + rw [hbase_eq c hc] at hv + exact (π.cellGraph_le_cellsUnion hc (hI_keep hc)).vertexSet_subset hv + · rw [hbase_bot d (fun ⟨c, hc, hEq⟩ => hd ⟨c, hc, hEq.symm⟩), + π.cellsUnion_empty_vertexSet] at hv + exact hv.elim + let α' : Set S' → Hypergraph α β := fun d => + if d = d₀ then baseGraph d ∪ π.cellsUnion I_absorb else baseGraph d + have hle_α' : ∀ d, baseGraph d ≤ α' d := by + intro d + dsimp [α'] + split_ifs + · exact le_union_left (hbase_le d) (π.cellsUnion_le I_absorb) + · exact le_rfl + let β' : S' → Set α := fun x => + if h : ∃ n ∈ N₁, x = ι n then π.borderSet h.choose else ∅ + have hβ'_eq : ∀ n ∈ N₁, β' (ι n) = π.borderSet n := by + intro n hn + have hex : ∃ m ∈ N₁, ι n = ι m := ⟨n, hn, rfl⟩ + dsimp [β'] + rw [dite_eq_left hex] + exact congrArg π.borderSet (hcut.inj hex.choose_spec.2).symm + have hβ'_empty : ∀ x ∉ ι '' N₁, β' x = ∅ := by + intro x hx + have hnot : ¬ ∃ n ∈ N₁, x = ι n := fun ⟨n, hn, hEq⟩ => hx ⟨n, hn, hEq.symm⟩ + dsimp [β'] + rw [dite_eq_right hnot] + let γ' : S' → α := fun x => + if h : ∃ n, x = ι n then π.nodeVertex h.choose + else π.nodeVertex (Classical.arbitrary π.S) + have hγ'_eq : ∀ n : π.S, γ' (ι n) = π.nodeVertex n := by + intro n + have hex : ∃ m, ι n = ι m := ⟨n, rfl⟩ + dsimp [γ'] + rw [dite_eq_left hex] + exact congrArg π.nodeVertex (hcut.inj hex.choose_spec).symm + have hbp_F : ∀ n ∈ F ∩ (π.Γ.N ∩ bd π.S), + ∀ v, ¬ (v ∈ π.borderSet n ∨ (n ∈ π.domγ ∧ v = π.nodeVertex n)) := by + rintro n ⟨hnF, hnN, hnbd⟩ v (hvn | ⟨hnγ, _⟩) + · rw [hβF n ⟨hnF, hnN, hnbd⟩] at hvn + exact hvn + · exact eq_empty_iff_forall_notMem.mp hFγ n ⟨hnF, hnγ⟩ + have hbp_sep_Θ : ∀ {Θ : Set π.S}, Θ ∈ cuffs π.S → + ∀ {n₁ n₂ a b : π.S}, n₁ ∈ π.Γ.N ∩ Θ → n₂ ∈ π.Γ.N ∩ Θ → + a ∈ F ∩ (π.Γ.N ∩ Θ) → b ∈ F ∩ (π.Γ.N ∩ Θ) → + GM19.InOrderOn Θ n₁ a n₂ b → + ∀ v, (v ∈ π.borderSet n₁ ∨ (n₁ ∈ π.domγ ∧ v = π.nodeVertex n₁)) → + (v ∈ π.borderSet n₂ ∨ (n₂ ∈ π.domγ ∧ v = π.nodeVertex n₂)) → False := by + intro Θ hΘ n₁ n₂ a b hn₁ hn₂ ha hb hord v hv₁ hv₂ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + rcases π.p7 Θ hΘ n₁ hn₁ a ha.2 n₂ hn₂ b hb.2 hord v hv₁ hv₂ with hva | hvb + · exact hbp_F a ⟨ha.1, ha.2.1, hΘ_bd ha.2.2⟩ v hva + · exact hbp_F b ⟨hb.1, hb.2.1, hΘ_bd hb.2.2⟩ v hvb + have hbp_same_cuff : ∀ {n₁ n₂ : π.S} {Θ : Set π.S}, Θ ∈ cuffs π.S → + n₁ ∈ π.Γ.N ∩ Θ → n₂ ∈ π.Γ.N → + ∀ v, (v ∈ π.borderSet n₁ ∨ (n₁ ∈ π.domγ ∧ v = π.nodeVertex n₁)) → + ((n₂ ∈ bd π.S ∧ v ∈ π.borderSet n₂) ∨ (n₂ ∈ π.domγ ∧ v = π.nodeVertex n₂)) → + n₂ ∈ Θ := by + intro n₁ n₂ Θ hΘ hn₁ hn₂N v hv₁ hv₂ + by_contra hn₂Θ + rcases hv₁ with hv₁β | ⟨hn₁γ, rfl⟩ + · rcases hv₂ with ⟨hn₂bd, hv₂β⟩ | ⟨hn₂γ, rfl⟩ + · obtain ⟨Θ₂, hΘ₂, hn₂Θ₂⟩ := exists_cuff_of_mem_bd hn₂bd + have hne : Θ ≠ Θ₂ := fun hEq => hn₂Θ (hEq ▸ hn₂Θ₂) + exact (π.p4_disjoint Θ hΘ Θ₂ hΘ₂ hne n₁ hn₁ n₂ ⟨hn₂N, hn₂Θ₂⟩).le_bot ⟨hv₁β, hv₂β⟩ + · exact π.p4_notMem Θ hΘ n₁ hn₁ n₂ hn₂γ hn₂Θ hv₁β + · rcases hv₂ with ⟨hn₂bd, hv₂β⟩ | ⟨hn₂γ, hEq⟩ + · obtain ⟨Θ₂, hΘ₂, hn₂Θ₂⟩ := exists_cuff_of_mem_bd hn₂bd + have hn₁_not_Θ₂ : n₁ ∉ Θ₂ := by + intro hn₁Θ₂ + have hEqΘ : Θ = Θ₂ := by + rcases hΘ with ⟨x₁, _, rfl⟩ + rcases hΘ₂ with ⟨x₂, _, rfl⟩ + exact (connectedComponentIn_eq hn₁.2).trans (connectedComponentIn_eq hn₁Θ₂).symm + exact hn₂Θ (hEqΘ ▸ hn₂Θ₂) + exact π.p4_notMem Θ₂ hΘ₂ n₂ ⟨hn₂N, hn₂Θ₂⟩ n₁ hn₁γ hn₁_not_Θ₂ hv₂β + · rw [← π.nodeVertex_injOn hn₁γ hn₂γ hEq] at hn₂Θ + exact hn₂Θ hn₁.2 + let π' : Portrayal G := + assembleCutSidePortrayal π hsS' hcut hI_keep hI_absorb hV_disj hFγ baseGraph d₀ hd₀_mem + hbase_eq hbase_bot hbase_le hbase_sub_keep hle_α' β' γ' hβ'_eq hβ'_empty hγ'_eq + hbp_F hbp_sep_Θ hbp_same_cuff + have hπ'_central : π'.IsCentral 𝒯 := by + change ∀ d ∈ Γ'.C, IsSmallWrt 𝒯 (α' d) + intro d _ + have hbase_small : IsSmallWrt 𝒯 (baseGraph d) := by + dsimp [baseGraph] + split_ifs with hd + · exact hT hd.choose (hI_keep hd.choose_spec.1) + · exact π.isSmallWrt_cellsUnion_empty hTangle hθ + dsimp [α'] + by_cases hd₀_eq : d = d₀ + · rw [ite_eq_left hd₀_eq] + have hatt_abs_empty : attachments G (π.cellsUnion I_absorb) = ∅ := by + rw [eq_empty_iff_forall_notMem] + intro v hv + have hsub := attachments_subset_inter_of_isSeparation hsep_G.symm hv + rw [inter_vertexSet, Set.inter_comm, hV_disj] at hsub + exact hsub + have hatt_lt : (attachments G (baseGraph d ∪ π.cellsUnion I_absorb)).ncard < θ := by + have hsub : attachments G (baseGraph d ∪ π.cellsUnion I_absorb) ⊆ + attachments G (baseGraph d) := by + refine Subset.trans attachments_union_subset ?_ + rw [hatt_abs_empty, union_empty] + exact (ncard_le_ncard hsub attachments_finite).trans_lt + (hbase_small.ncard_attachments_lt hTangle) + exact hbase_small.union hTangle hsmall hatt_lt + · rw [ite_eq_right hd₀_eq] + exact hbase_small + have hcellWarp_le : ∀ d ∈ Γ'.C, (d ∩ bd S').Nonempty → π'.cellWarp d ≤ π.warp := + cutSideCellWarp π π' hcut hI_keep hFγ hβF hV_disj baseGraph d₀ hbase_eq + (fun _ => rfl) hβ'_eq hβ'_empty hγ'_eq rfl + exact ⟨π', hπ'_central, Or.inl ⟨hsimpS', warp_le_of_cellWarp_le π π' hcellWarp_le⟩⟩ + +@[expose] public section + +/-- Pure surface-and-painting topological cutting statement for (5.3) (page 172): +given a connected compact surface $\Sigma$, a painting $\Gamma$ in $\Sigma$, and a $\Gamma$-normal +$I$-arc $F \subseteq \Sigma$ with ends $n_1, n_2$ such that $F \cap \operatorname{bd}(\Sigma) = +\{n_1, n_2\}$ and $\tilde{c} \cap F = \emptyset$ for every internal cell $c \in C(\Gamma)$, cutting +$\Sigma$ along $F$ either: +(1) produces a connected simpler surface $\Sigma_0$ carrying a cut-side painting for the full cell +set $C(\Gamma)$ with at least one cuff, or +(2) partitions $C(\Gamma)$ into $I_1$ and $I_2 = C(\Gamma) \setminus I_1$ (separated by $F$) such +that for each side $(I_{\text{keep}}, I_{\text{absorb}}) \in \{(I_1, I_2), (I_2, I_1)\}$, either +$I_{\text{absorb}}$ is the set of cells in a closed disc $\Delta \subseteq \Sigma$ with +$F \subseteq \operatorname{bd}(\Delta) \subseteq F \cup \operatorname{bd}(\Sigma)$, or the surface +$\Sigma'$ of side $I_{\text{keep}}$ is simpler than $\Sigma$, has at least one cuff, and carries a +cut-side painting for $I_{\text{keep}}$. -/ +def CutNormalIArcPaintingStatement : Prop := + ∀ (S : Type) [TopologicalSpace S] [CompactSpace S] [T2Space S] [ConnectedSpace S], + IsSurface S → ∀ (Γ : Painting S) (F : Set S) (n₁ n₂ : S), + Γ.IsNormal F → IsLineWithEnds F n₁ n₂ → F ∩ bd S = {n₁, n₂} → + (∀ c ∈ Γ.C, Γ.IsInternalCell c → Disjoint (tilde c) F) → + (∃ (S₀ : Type) (_ : TopologicalSpace S₀) (_ : CompactSpace S₀) (_ : T2Space S₀) + (_ : ConnectedSpace S₀) (ι₀ : S → S₀) (Γ₀ : Painting S₀), + IsSurface S₀ ∧ IsSimplerThan S₀ S ∧ (cuffs S₀).Nonempty ∧ + IsCutSidePainting S Γ F Γ.C S₀ ι₀ Γ₀) ∨ + (∃ I₁ I₂ : Set (Set S), + I₁ ⊆ Γ.C ∧ I₂ = Γ.C \ I₁ ∧ + (∀ c₁ ∈ I₁, ∀ c₂ ∈ I₂, tilde c₁ ∩ tilde c₂ ⊆ F) ∧ + ((∃ Δ : Set S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd S ∧ + {c ∈ Γ.C | c ⊆ Δ} = I₁) ∨ + (∃ (S' : Type) (_ : TopologicalSpace S') (_ : CompactSpace S') (_ : T2Space S') + (_ : ConnectedSpace S') (ι : S → S') (Γ' : Painting S'), + IsSurface S' ∧ IsSimplerThan S' S ∧ (cuffs S').Nonempty ∧ + IsCutSidePainting S Γ F I₂ S' ι Γ')) ∧ + ((∃ Δ : Set S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd S ∧ + {c ∈ Γ.C | c ⊆ Δ} = I₂) ∨ + (∃ (S' : Type) (_ : TopologicalSpace S') (_ : CompactSpace S') (_ : T2Space S') + (_ : ConnectedSpace S') (ι : S → S') (Γ' : Painting S'), + IsSurface S' ∧ IsSimplerThan S' S ∧ (cuffs S').Nonempty ∧ + IsCutSidePainting S Γ F I₁ S' ι Γ'))) + +end + +@[expose] public section + +/-- Pure surface-and-painting topological cutting statement for (5.4) (page 173): +given a connected compact surface $\Sigma$, a painting $\Gamma$ in $\Sigma$, and a $\Gamma$-normal +$O$-arc $F \subseteq \Sigma$ such that $\tilde{c} \cap F = \emptyset$ for every internal cell +$c \in C(\Gamma)$, diverting $F$ around $F \cap \operatorname{bd}(\Sigma)$ and cutting $\Sigma$ +along $F$ (pasting discs onto the resulting new cuffs) either: +(1) produces a connected simpler surface $\hat{\Sigma}_0$ carrying a cut-side painting for the full +cell set $C(\Gamma)$ (whenever $C(\Gamma)$ is nonempty), or +(2) partitions $C(\Gamma)$ into $I_1$ and $I_2 = C(\Gamma) \setminus I_1$ (separated by +$F \cap \operatorname{bd}(\Sigma) = \emptyset$ after diverting) such that for each side +$(I_{\text{keep}}, I_{\text{absorb}}) \in \{(I_1, I_2), (I_2, I_1)\}$ with $I_{\text{keep}}$ +nonempty, either $I_{\text{absorb}}$ is the set of cells in a closed disc $\Delta \subseteq \Sigma$ +with $\operatorname{bd}(\Delta) = F$, or the capped surface $\hat{\Sigma}'$ of side +$I_{\text{keep}}$ +is simpler than $\Sigma$ and carries a cut-side painting for $I_{\text{keep}}$. -/ +def CutNormalOArcPaintingStatement : Prop := + ∀ (S : Type) [TopologicalSpace S] [CompactSpace S] [T2Space S] [ConnectedSpace S], + IsSurface S → ∀ (Γ : Painting S) (F : Set S), + Γ.IsNormal F → IsOArc F → + (∀ c ∈ Γ.C, Γ.IsInternalCell c → Disjoint (tilde c) F) → + (Γ.C.Nonempty ∧ + ∃ (S₀ : Type) (_ : TopologicalSpace S₀) (_ : CompactSpace S₀) (_ : T2Space S₀) + (_ : ConnectedSpace S₀) (ι₀ : S → S₀) (Γ₀ : Painting S₀), + IsSurface S₀ ∧ IsSimplerThan S₀ S ∧ + IsCutSidePainting S Γ ∅ Γ.C S₀ ι₀ Γ₀) ∨ + (∃ I₁ I₂ : Set (Set S), + I₁ ⊆ Γ.C ∧ I₂ = Γ.C \ I₁ ∧ + (∀ c₁ ∈ I₁, ∀ c₂ ∈ I₂, tilde c₁ ∩ tilde c₂ = ∅) ∧ + ((∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F ∧ {c ∈ Γ.C | c ⊆ Δ} = I₁) ∨ + (I₂.Nonempty → + ∃ (S' : Type) (_ : TopologicalSpace S') (_ : CompactSpace S') (_ : T2Space S') + (_ : ConnectedSpace S') (ι : S → S') (Γ' : Painting S'), + IsSurface S' ∧ IsSimplerThan S' S ∧ + IsCutSidePainting S Γ ∅ I₂ S' ι Γ')) ∧ + ((∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F ∧ {c ∈ Γ.C | c ⊆ Δ} = I₂) ∨ + (I₁.Nonempty → + ∃ (S' : Type) (_ : TopologicalSpace S') (_ : CompactSpace S') (_ : T2Space S') + (_ : ConnectedSpace S') (ι : S → S') (Γ' : Painting S'), + IsSurface S' ∧ IsSimplerThan S' S ∧ + IsCutSidePainting S Γ ∅ I₁ S' ι Γ'))) + +end + +end GraphMinor.GM17 + +end diff --git a/LeanPool/GraphMinor/GM17/Section5Proved.lean b/LeanPool/GraphMinor/GM17/Section5Proved.lean new file mode 100644 index 0000000000..1334c9b54c --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section5Proved.lean @@ -0,0 +1,524 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section5 + +public import LeanPool.GraphMinor.GM17.Section4 +import LeanPool.GraphMinor.Surface.DiscUnion +import LeanPool.GraphMinor.Surface.DiscsInSurface +import Mathlib.Analysis.SpecialFunctions.Complex.Circle +import Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds + +import LeanPool.GraphMinor.Surface.Cuffs + +import LeanPool.GraphMinor.GM17.CutArcPaint + +import LeanPool.GraphMinor.GM17.PasteCuff + +import LeanPool.GraphMinor.GM17.PushNode + +/-! +# Graph Minors XVII: proved deductions of Section5 + +The portrayal deductions use the existing painting proofs. The definitions and +independent geometric lemmas are imported from `Section5`. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM10 GraphMinor.Hypergraph + +local notation "𝕀" => unitInterval + +universe u v + +/-! ## 1. Shrinking a Cell from a Node (Page 171) -/ + +open Classical in +private noncomputable abbrev capped_zero_warp_portrayal + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} + (hp5_Θ : ∀ c ∈ π.Γ.C, (c ∩ Θ).Nonempty → ∀ v ∈ (π.cellGraph c).vertexSet, (∃ c' ∈ π.Γ.C, c' ≠ + c ∧ v ∈ (π.cellGraph c').vertexSet) → v ∈ π.nodeVertex '' (tilde c ∩ π.domγ)) + (S' : Type) + [tS' : TopologicalSpace S'] + [connS' : ConnectedSpace S'] + (hsS' : IsSurface S') + (ι : π.S → S') + (Γ' : Painting S') + (hι_inj : Function.Injective ι) + (hΓ'N : Γ'.N = ι '' π.Γ.N) + (hΓ'C : Γ'.C = (fun c => ι '' c) '' π.Γ.C) + (hbdS' : bd S' = ι '' (bd π.S \ Θ)) + (hcuffsS' : cuffs S' = (fun Θ' => ι '' Θ') '' (cuffs π.S \ {Θ})) + (htilde_ι : ∀ c ∈ π.Γ.C, tilde (ι '' c) = ι '' tilde c) + (horder_ι : ∀ Θ' ∈ cuffs π.S, Θ' ≠ Θ → ∀ n₁ ∈ π.Γ.N ∩ Θ', ∀ n₂ ∈ π.Γ.N ∩ Θ', ∀ n₃ ∈ π.Γ.N ∩ + Θ', ∀ n₄ ∈ π.Γ.N ∩ Θ', GM19.InOrderOn (ι '' Θ') (ι n₁) (ι n₂) (ι n₃) (ι n₄) → GM19.InOrderOn + Θ' n₁ n₂ n₃ n₄) + (α' : Set S' → Hypergraph α β) + (hα'_eq : ∀ c ∈ π.Γ.C, α' (ι '' c) = π.cellGraph c) + (β' : S' → Set α) + (hβ'_eq : ∀ (n : π.S), β' (ι n) = π.borderSet n) + (γ' : S' → α) + (hγ'_eq : ∀ (n : π.S), γ' (ι n) = π.nodeVertex n) + (hbd_iff : ∀ c ∈ π.Γ.C, (ι '' c ∩ bd S').Nonempty ↔ + (c ∩ bd π.S).Nonempty ∧ ¬(c ∩ Θ).Nonempty) : Portrayal G := + { S := S' + top := tS' + isSurface := hsS' + connected := connS' + Γ := Γ' + cellGraph := α' + borderSet := β' + domγ := ι '' π.domγ + nodeVertex := γ' + cellGraph_le := by + intro d hd + rw [hΓ'C] at hd + obtain ⟨c, hc, rfl⟩ := hd + rw [hα'_eq c hc] + exact π.cellGraph_le c hc + borderSet_subset := by + intro x ⟨hxN, hxbd⟩ + rw [hΓ'N] at hxN + rw [hbdS'] at hxbd + rcases hxN with ⟨n, hnN, rfl⟩ + rcases hxbd with ⟨m, hmbd, hmn⟩ + obtain rfl := hι_inj hmn + rw [hβ'_eq m] + exact π.borderSet_subset m ⟨hnN, hmbd.1⟩ + domγ_subset := by + rw [hΓ'N] + exact image_mono π.domγ_subset + nodeVertex_mem := by + rintro _ ⟨n, hn, rfl⟩ + rw [hγ'_eq n] + exact π.nodeVertex_mem n hn + nodeVertex_injOn := by + rintro _ ⟨n₁, hn₁, rfl⟩ _ ⟨n₂, hn₂, rfl⟩ hEq + rw [hγ'_eq n₁, hγ'_eq n₂] at hEq + rw [π.nodeVertex_injOn hn₁ hn₂ hEq] + p1_vertex := by + intro v hv + obtain ⟨c, hc, hvc⟩ := π.p1_vertex v hv + exact ⟨ι '' c, hΓ'C ▸ mem_image_of_mem _ hc, by rwa [hα'_eq c hc]⟩ + p1_edge := by + intro e he + obtain ⟨c, hc, hec⟩ := π.p1_edge e he + exact ⟨ι '' c, hΓ'C ▸ mem_image_of_mem _ hc, by rwa [hα'_eq c hc]⟩ + p1_disjoint := by + intro d₁ hd₁ d₂ hd₂ hne + rw [hΓ'C] at hd₁ hd₂ + obtain ⟨c₁, hc₁, rfl⟩ := hd₁ + obtain ⟨c₂, hc₂, rfl⟩ := hd₂ + rw [hα'_eq c₁ hc₁, hα'_eq c₂ hc₂] + exact π.p1_disjoint c₁ hc₁ c₂ hc₂ (fun h => hne (congrArg _ h)) + p2 := by + intro d hd x hx + rw [hΓ'C] at hd + obtain ⟨c, hc, rfl⟩ := hd + rw [htilde_ι c hc, ← image_inter hι_inj] at hx + obtain ⟨n, hn, rfl⟩ := hx + rw [hγ'_eq n, hα'_eq c hc] + exact π.p2 c hc n hn + p3_notMem := by + intro x ⟨hxγ, hxbd⟩ + rw [hbdS'] at hxbd + rcases hxγ with ⟨n, hnγ, rfl⟩ + rcases hxbd with ⟨m, hmbd, hmn⟩ + obtain rfl := hι_inj hmn + rw [hγ'_eq m, hβ'_eq m] + exact π.p3_notMem m ⟨hnγ, hmbd.1⟩ + p3_subset := by + intro d hd hdbd x hx + rw [hΓ'C] at hd + obtain ⟨c, hc, rfl⟩ := hd + rw [htilde_ι c hc] at hx + obtain ⟨n, hn, rfl⟩ := hx + rw [hβ'_eq n, hα'_eq c hc] + exact π.p3_subset c hc ((hbd_iff c hc).mp hdbd).1 n hn + p4_disjoint := by + intro Φ₁ hΦ₁ Φ₂ hΦ₂ hne x₁ hx₁ x₂ hx₂ + rw [hcuffsS'] at hΦ₁ hΦ₂ + obtain ⟨Θ₁, ⟨hΘ₁, _⟩, rfl⟩ := hΦ₁ + obtain ⟨Θ₂, ⟨hΘ₂, _⟩, rfl⟩ := hΦ₂ + rw [hΓ'N, ← image_inter hι_inj] at hx₁ hx₂ + obtain ⟨n₁, hn₁, rfl⟩ := hx₁ + obtain ⟨n₂, hn₂, rfl⟩ := hx₂ + rw [hβ'_eq n₁, hβ'_eq n₂] + exact π.p4_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ (fun h => hne (congrArg _ h)) n₁ hn₁ n₂ hn₂ + p4_notMem := by + intro Φ hΦ x₁ hx₁ x₂ hx₂ hx₂Φ + rw [hcuffsS'] at hΦ + obtain ⟨Θ₁, ⟨hΘ₁, _⟩, rfl⟩ := hΦ + rw [hΓ'N, ← image_inter hι_inj] at hx₁ + obtain ⟨n₁, hn₁, rfl⟩ := hx₁ + obtain ⟨n₂, hn₂, rfl⟩ := hx₂ + rw [hγ'_eq n₂, hβ'_eq n₁] + exact π.p4_notMem Θ₁ hΘ₁ n₁ hn₁ n₂ hn₂ (fun h => hx₂Φ (mem_image_of_mem ι h)) + p5 := by + intro d hd hdbd v hv ⟨d₂, hd₂, hd₂_ne, hv₂⟩ + rw [hΓ'C] at hd hd₂ + obtain ⟨c, hc, rfl⟩ := hd + obtain ⟨c₂, hc₂, rfl⟩ := hd₂ + rw [hα'_eq c hc] at hv + rw [hα'_eq c₂ hc₂] at hv₂ + have hc₂_ne : c₂ ≠ c := fun h => hd₂_ne (congrArg _ h) + rw [htilde_ι c hc, ← image_inter hι_inj] + by_cases hcΘ : (c ∩ Θ).Nonempty + · obtain ⟨n, hn, rfl⟩ := hp5_Θ c hc hcΘ v hv ⟨c₂, hc₂, hc₂_ne, hv₂⟩ + exact ⟨ι n, mem_image_of_mem ι hn, hγ'_eq n⟩ + · have hcbd : ¬ (c ∩ bd π.S).Nonempty := + fun h => hdbd ((hbd_iff c hc).mpr ⟨h, hcΘ⟩) + obtain ⟨n, hn, rfl⟩ := π.p5 c hc hcbd v hv ⟨c₂, hc₂, hc₂_ne, hv₂⟩ + exact ⟨ι n, mem_image_of_mem ι hn, hγ'_eq n⟩ + p6 := by + intro d hd hdbd v hv ⟨d₂, hd₂, hd₂_ne, hv₂⟩ + rw [hΓ'C] at hd hd₂ + obtain ⟨c, hc, rfl⟩ := hd + obtain ⟨c₂, hc₂, rfl⟩ := hd₂ + rw [hα'_eq c hc] at hv + rw [hα'_eq c₂ hc₂] at hv₂ + have hc₂_ne : c₂ ≠ c := fun h => hd₂_ne (congrArg _ h) + obtain ⟨n, hn, hvn⟩ := + π.p6 c hc ((hbd_iff c hc).mp hdbd).1 v hv ⟨c₂, hc₂, hc₂_ne, hv₂⟩ + rw [htilde_ι c hc] + refine ⟨ι n, mem_image_of_mem ι hn, ?_⟩ + rw [hβ'_eq n, hγ'_eq n] + rcases hvn with hvn | ⟨hnγ, rfl⟩ + · exact Or.inl hvn + · exact Or.inr ⟨mem_image_of_mem ι hnγ, rfl⟩ + p7 := by + intro Φ hΦ x₁ hx₁ x₂ hx₂ x₃ hx₃ x₄ hx₄ hord v hv₁ hv₃ + rw [hcuffsS'] at hΦ + obtain ⟨Θ', ⟨hΘ', hΘ'ne⟩, rfl⟩ := hΦ + rw [hΓ'N, ← image_inter hι_inj] at hx₁ hx₂ hx₃ hx₄ + obtain ⟨n₁, hn₁, rfl⟩ := hx₁ + obtain ⟨n₂, hn₂, rfl⟩ := hx₂ + obtain ⟨n₃, hn₃, rfl⟩ := hx₃ + obtain ⟨n₄, hn₄, rfl⟩ := hx₄ + rw [hβ'_eq, hγ'_eq, hι_inj.mem_set_image] at hv₁ hv₃ ⊢ + rw [hβ'_eq, hγ'_eq, hι_inj.mem_set_image] + exact π.p7 Θ' hΘ' n₁ hn₁ n₂ hn₂ n₃ hn₃ n₄ hn₄ + (horder_ι Θ' hΘ' hΘ'ne n₁ hn₁ n₂ hn₂ n₃ hn₃ n₄ hn₄ hord) v hv₁ hv₃ } + +/-- **Graph Minors XVII, (5.1)** (page 171): +"If $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ is a 0-redundant $\mathscr{T}$-central +portrayal of a hypergraph $G$, then for each cuff $\Theta$ of $\Sigma$, $\pi$ has warp $\ge +1$ at $\Theta$." -/ +theorem theorem_5_1_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (π : Portrayal G) [CompactSpace π.S] [T2Space π.S] + (hT : π.IsCentral 𝒯) (hred : π.IsZeroRedundant 𝒯) + {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) : + 1 ≤ π.warpAt Θ := by + classical + by_contra hlt + have hw0 : π.warpAt Θ = 0 := by omega + obtain ⟨hβ0, hp5_Θ⟩ := π.borderSet_eq_empty_of_warpAt_eq_zero hΘ hw0 + have : ConnectedSpace π.S := π.connected + obtain ⟨S', tS', cS', h2S', connS', hsS', hsimpS', ι, Γ', hι_inj, hΓ'N, hΓ'C, hbdS', hcuffsS', + htilde_ι, horder_ι⟩ := GraphMinor.GM17.pasteCuffPainting π.S π.isSurface π.Γ Θ hΘ + have hcell_eq : ∀ {c₁ c₂ : Set π.S}, ι '' c₁ = ι '' c₂ → c₁ = c₂ := + fun h => hι_inj.image_injective h + let α' : Set S' → Hypergraph α β := fun d => + if h : ∃ c ∈ π.Γ.C, d = ι '' c then π.cellGraph h.choose else ⊥ + have hα'_eq : ∀ c ∈ π.Γ.C, α' (ι '' c) = π.cellGraph c := by + intro c hc + have hex : ∃ c₀ ∈ π.Γ.C, ι '' c = ι '' c₀ := ⟨c, hc, rfl⟩ + dsimp [α'] + rw [dite_eq_left hex] + exact congrArg π.cellGraph (hcell_eq hex.choose_spec.2).symm + let β' : S' → Set α := fun x => + if h : ∃ n, x = ι n then π.borderSet h.choose else ∅ + have hβ'_eq : ∀ n : π.S, β' (ι n) = π.borderSet n := by + intro n + have hex : ∃ m, ι n = ι m := ⟨n, rfl⟩ + dsimp [β'] + rw [dite_eq_left hex] + exact congrArg π.borderSet (hι_inj hex.choose_spec).symm + let γ' : S' → α := fun x => + if h : ∃ n, x = ι n then π.nodeVertex h.choose + else π.nodeVertex (Classical.arbitrary π.S) + have hγ'_eq : ∀ n : π.S, γ' (ι n) = π.nodeVertex n := by + intro n + have hex : ∃ m, ι n = ι m := ⟨n, rfl⟩ + dsimp [γ'] + rw [dite_eq_left hex] + exact congrArg π.nodeVertex (hι_inj hex.choose_spec).symm + have hbd_iff : ∀ c ∈ π.Γ.C, + ((ι '' c) ∩ bd S').Nonempty ↔ (c ∩ bd π.S).Nonempty ∧ ¬ (c ∩ Θ).Nonempty := by + intro c hc + rw [hbdS', ← image_inter hι_inj, image_nonempty] + constructor + · rintro ⟨x, hxc, hxbd, hxΘ⟩ + refine ⟨⟨x, hxc, hxbd⟩, fun hcΘ => ?_⟩ + have hsub := (π.Γ.border_cell_subset_cuff hc hΘ hcΘ).1 + exact hxΘ (hsub ⟨subset_closure hxc, hxbd⟩) + · rintro ⟨⟨x, hxc, hxbd⟩, hcΘ⟩ + exact ⟨x, hxc, hxbd, fun hxΘ => hcΘ ⟨x, hxc, hxΘ⟩⟩ + let π' : Portrayal G := + capped_zero_warp_portrayal (α := α) (β := β) (G := G) π (Θ := Θ) hp5_Θ S' hsS' ι Γ' hι_inj + hΓ'N hΓ'C hbdS' hcuffsS' htilde_ι horder_ι α' hα'_eq β' hβ'_eq γ' hγ'_eq hbd_iff + have hπ'_central : π'.IsCentral 𝒯 := by + intro d hd + change ∃ B, (α' d, B) ∈ 𝒯 + rw [hΓ'C] at hd + obtain ⟨c, hc, rfl⟩ := hd + rw [hα'_eq c hc] + exact hT c hc + have hcellWarp_eq : ∀ c ∈ π.Γ.C, π'.cellWarp (ι '' c) = π.cellWarp c := by + intro c hc + have hbp : ∀ n : π.S, π'.borderPlus (ι n) = π.borderPlus n := by + intro n + ext v + simp only [Portrayal.borderPlus, mem_ofPred_eq] + change (v ∈ β' (ι n) ∨ (ι n ∈ ι '' π.domγ ∧ v = γ' (ι n))) ↔ _ + rw [hβ'_eq n, hγ'_eq n, hι_inj.mem_set_image] + unfold Portrayal.cellWarp Portrayal.CellWarpLE + congr 1 + ext p + change (∀ x₁ ∈ tilde (ι '' c), ∀ x₂ ∈ tilde (ι '' c), x₁ ≠ x₂ → + (β' x₁).ncard ≤ p ∧ (β' x₂).ncard ≤ p ∧ + ((π'.borderPlus x₁).ncard = p + 1 → (π'.borderPlus x₂).ncard = p + 1 → + Portrayal.LinkagePairs (α' (ι '' c)).skeleton (π'.borderPlus x₁) (π'.borderPlus x₂) + (p + 1) + (γ' x₁) (γ' x₂))) ↔ _ + rw [htilde_ι c hc, hα'_eq c hc] + constructor + · intro h n₁ hn₁ n₂ hn₂ hne + have := h (ι n₁) (mem_image_of_mem ι hn₁) (ι n₂) (mem_image_of_mem ι hn₂) + (fun hEq => hne (hι_inj hEq)) + rwa [hβ'_eq n₁, hβ'_eq n₂, hbp n₁, hbp n₂, hγ'_eq n₁, hγ'_eq n₂] at this + · rintro h _ ⟨n₁, hn₁, rfl⟩ _ ⟨n₂, hn₂, rfl⟩ hne + rw [hβ'_eq n₁, hβ'_eq n₂, hbp n₁, hbp n₂, hγ'_eq n₁, hγ'_eq n₂] + exact h n₁ hn₁ n₂ hn₂ (fun hEq => hne (congrArg ι hEq)) + have hwarpAt_eq : ∀ Θ' ∈ cuffs π.S, Θ' ≠ Θ → π'.warpAt (ι '' Θ') = π.warpAt Θ' := by + intro Θ' hΘ' _ + unfold Portrayal.warpAt + congr 1 + ext p + change (∃ d ∈ Γ'.C, (d ∩ (ι '' Θ')).Nonempty ∧ p = π'.cellWarp d) ↔ _ + rw [hΓ'C] + constructor + · rintro ⟨_, ⟨c, hc, rfl⟩, hinter, rfl⟩ + rw [← image_inter hι_inj, image_nonempty] at hinter + exact ⟨c, hc, hinter, hcellWarp_eq c hc⟩ + · rintro ⟨c, hc, hinter, rfl⟩ + refine ⟨ι '' c, mem_image_of_mem _ hc, ?_, (hcellWarp_eq c hc).symm⟩ + rw [← image_inter hι_inj, image_nonempty] + exact hinter + have hwarp_le : π'.warp ≤ π.warp := by + by_cases hne' : (cuffs S').Nonempty + · have hSup_bdd : ∀ p ∈ {p | ∃ Φ ∈ cuffs S', p = π'.warpAt Φ}, p ≤ π.warp := by + rintro p ⟨Φ, hΦ, rfl⟩ + rw [hcuffsS'] at hΦ + obtain ⟨Θ', ⟨hΘ', hΘ'ne⟩, rfl⟩ := hΦ + rw [hwarpAt_eq Θ' hΘ' hΘ'ne] + exact π.warpAt_le_warp hΘ' + unfold Portrayal.warp + rw [ite_eq_left hne'] + obtain ⟨Φ₀, hΦ₀⟩ := hne' + exact max_le π.one_le_warp (csSup_le ⟨π'.warpAt Φ₀, Φ₀, hΦ₀, rfl⟩ hSup_bdd) + · have h1 : π'.warp = 1 := by + unfold Portrayal.warp + exact ite_eq_right hne' + rw [h1] + exact π.one_le_warp + exact hred π' hπ'_central (Or.inl ⟨hsimpS', hwarp_le⟩) + +private lemma areaGraph_eq_cellsUnion {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {Δ : Set π.S} {I : Set (Set π.S)} + (hcells : {c ∈ π.Γ.C | c ⊆ Δ} = I) : + π.areaGraph Δ = π.cellsUnion I := by + unfold Portrayal.areaGraph + rw [hcells] + +/-- **Graph Minors XVII, (5.3)** (page 172): +"Let $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a 0-redundant $\mathscr{T}$-central +portrayal of a hypergraph $G$. Let $F$ be a $\Gamma$-normal I-arc with ends $n_1, n_2$ such +that $\beta(n_1) = \beta(n_2) = F \cap \operatorname{dom}(\gamma) = \emptyset$. Then there +is a disc $\Delta \subseteq \Sigma$ with $F \subseteq \operatorname{bd}(\Delta) \subseteq F +\cup \operatorname{bd}(\Sigma)$ such that $\alpha(\Delta)$ is small." -/ +theorem theorem_5_3_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + (hTangle : IsTangle G θ 𝒯) (hθ : 1 ≤ θ) + (π : Portrayal G) [CompactSpace π.S] [T2Space π.S] + (hT : π.IsCentral 𝒯) (hred : π.IsZeroRedundant 𝒯) + {F : Set π.S} {n₁ n₂ : π.S} + (hnorm : π.Γ.IsNormal F) (hF : IsLineWithEnds F n₁ n₂) + (hFbd : F ∩ bd π.S = {n₁, n₂}) + (hβ₁ : π.borderSet n₁ = ∅) (hβ₂ : π.borderSet n₂ = ∅) + (hFγ : F ∩ π.domγ = ∅) : + ∃ Δ : Set π.S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd π.S ∧ + IsSmallWrt 𝒯 (π.areaGraph Δ) := by + let P : ∀ (π₁ : Portrayal G), Set π₁.S → Prop := fun π₁ F₁ => + ∀ (m₁ m₂ : π₁.S), IsLineWithEnds F₁ m₁ m₂ → F₁ ∩ bd π₁.S = {m₁, m₂} → + π₁.borderSet m₁ = ∅ → π₁.borderSet m₂ = ∅ → + ∃ Δ : Set π₁.S, IsClosedDisc Δ ∧ F₁ ⊆ discBd Δ ∧ discBd Δ ⊆ F₁ ∪ bd π₁.S ∧ + IsSmallWrt 𝒯 (π₁.areaGraph Δ) + suffices hP : P π F from hP n₁ n₂ hF hFbd hβ₁ hβ₂ + refine Portrayal.induction_shrink_internal_cells ?_ ?_ π hT hred hnorm hFγ + · intro π₁ _ _ hT₁ hred₁ F₁ hnorm₁ hF₁γ hdisj m₁ m₂ hF₁ hF₁bd hm₁ hm₂ + have : ConnectedSpace π₁.S := π₁.connected + have hβF₁ : ∀ n ∈ F₁ ∩ (π₁.Γ.N ∩ bd π₁.S), π₁.borderSet n = ∅ := by + rintro n ⟨hnF, _, hnbd⟩ + have hn : n ∈ ({m₁, m₂} : Set π₁.S) := hF₁bd ▸ ⟨hnF, hnbd⟩ + rcases hn with rfl | rfl + · exact hm₁ + · exact hm₂ + rcases GraphMinor.GM17.cutNormalIArc π₁.S π₁.isSurface π₁.Γ F₁ m₁ m₂ hnorm₁ hF₁ hF₁bd hdisj with + ⟨S₀, tS₀, cS₀, h2S₀, connS₀, ι₀, Γ₀, hsS₀, hsimpS₀, _, hcut₀⟩ | + ⟨I₁, I₂, hI₁, hI₂, hsep, hside₁, hside₂⟩ + · have hsmall_empty : IsSmallWrt 𝒯 (π₁.cellsUnion (π₁.Γ.C \ π₁.Γ.C)) := by + rw [sdiff_self] + exact π₁.isSmallWrt_cellsUnion_empty hTangle hθ + obtain ⟨π', hπ'T, hπ'S⟩ := + π₁.exists_simpler_of_isCutSidePainting hTangle hθ hT₁ hF₁γ hβF₁ + subset_rfl rfl (fun _ _ _ h => (sdiff_self ▸ h).elim) + hsmall_empty hsS₀ hsimpS₀ hcut₀ + exact (hred₁ π' hπ'T hπ'S).elim + · obtain ⟨hIsSep, hinter_empty⟩ := + π₁.isSeparation_order_zero_of_normal_cut hF₁γ hβF₁ hI₁ hI₂ hsep + have hord_lt : separationOrder (π₁.cellsUnion I₁) (π₁.cellsUnion I₂) < θ := by + unfold separationOrder + rw [inter_vertexSet, hinter_empty, ncard_empty] + exact hθ + rcases hTangle.axiom1 hIsSep hord_lt with h1 | h2 + · have hsmall₁ : IsSmallWrt 𝒯 (π₁.cellsUnion I₁) := ⟨π₁.cellsUnion I₂, h1⟩ + rcases hside₁ with ⟨Δ, hΔ, hFΔ, hΔbd, hcells⟩ | + ⟨S', tS', cS', h2S', connS', ι, Γ', hsS', hsimpS', _, hcut'⟩ + · refine ⟨Δ, hΔ, hFΔ, hΔbd, ?_⟩ + rwa [areaGraph_eq_cellsUnion π₁ hcells] + · have hI₂_sub : I₂ ⊆ π₁.Γ.C := hI₂ ▸ sdiff_subset + have hI₁_eq : I₁ = π₁.Γ.C \ I₂ := by + ext c + simp only [hI₂, mem_sdiff] + exact ⟨fun hc => ⟨hI₁ hc, fun h => h.2 hc⟩, + fun hc => by_contra fun h => hc.2 ⟨hc.1, h⟩⟩ + have hsep' : ∀ c₂ ∈ I₂, ∀ c₁ ∈ I₁, tilde c₂ ∩ tilde c₁ ⊆ F₁ := + fun c₂ hc₂ c₁ hc₁ => Set.inter_comm (tilde c₂) (tilde c₁) ▸ hsep c₁ hc₁ c₂ hc₂ + obtain ⟨π', hπ'T, hπ'S⟩ := + π₁.exists_simpler_of_isCutSidePainting hTangle hθ hT₁ hF₁γ hβF₁ + hI₂_sub hI₁_eq hsep' hsmall₁ hsS' hsimpS' hcut' + exact (hred₁ π' hπ'T hπ'S).elim + · have hsmall₂ : IsSmallWrt 𝒯 (π₁.cellsUnion I₂) := ⟨π₁.cellsUnion I₁, h2⟩ + rcases hside₂ with ⟨Δ, hΔ, hFΔ, hΔbd, hcells⟩ | + ⟨S', tS', cS', h2S', connS', ι, Γ', hsS', hsimpS', _, hcut'⟩ + · refine ⟨Δ, hΔ, hFΔ, hΔbd, ?_⟩ + rwa [areaGraph_eq_cellsUnion π₁ hcells] + · obtain ⟨π', hπ'T, hπ'S⟩ := + π₁.exists_simpler_of_isCutSidePainting hTangle hθ hT₁ hF₁γ hβF₁ + hI₁ hI₂ hsep hsmall₂ hsS' hsimpS' hcut' + exact (hred₁ π' hπ'T hπ'S).elim + · intro π₁ _ _ Γ' c₀ n Δ₀ hsh hn_γ F₁ hnorm₁ ih m₁ m₂ hF₁ hF₁bd hm₁ hm₂ + obtain ⟨Δ, hΔ, hFΔ, hΔbd, hsmall⟩ := ih m₁ m₂ hF₁ hF₁bd hm₁ hm₂ + rw [π₁.shrinkCell_areaGraph_eq Γ' c₀ n Δ₀ hsh hn_γ hnorm₁ hΔ hΔbd] at hsmall + exact ⟨Δ, hΔ, hFΔ, hΔbd, hsmall⟩ + +/-- **Graph Minors XVII, (5.4)** (page 173): +"Let $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a 0-redundant $\mathscr{T}$-central +portrayal of a hypergraph $G$. Let $F \subseteq \Sigma$ be a $\Gamma$-normal O-arc with $F +\cap \operatorname{dom}(\gamma) = \emptyset$. Then there is a disc $\Delta \subseteq \Sigma$ +with $\operatorname{bd}(\Delta) = F$ such that $\alpha(\Delta)$ is small." -/ +theorem theorem_5_4_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + (hTangle : IsTangle G θ 𝒯) (hθ : 1 ≤ θ) + (π : Portrayal G) [CompactSpace π.S] [T2Space π.S] + (hT : π.IsCentral 𝒯) (hred : π.IsZeroRedundant 𝒯) + {F : Set π.S} (hnorm : π.Γ.IsNormal F) (hF : IsOArc F) + (hFγ : F ∩ π.domγ = ∅) : + ∃ Δ : Set π.S, IsClosedDisc Δ ∧ discBd Δ = F ∧ + IsSmallWrt 𝒯 (π.areaGraph Δ) := by + let P : ∀ (π₁ : Portrayal G), Set π₁.S → Prop := fun π₁ F₁ => + IsOArc F₁ → + ∃ Δ : Set π₁.S, IsClosedDisc Δ ∧ discBd Δ = F₁ ∧ + IsSmallWrt 𝒯 (π₁.areaGraph Δ) + suffices hP : P π F from hP hF + refine Portrayal.induction_shrink_internal_cells ?_ ?_ π hT hred hnorm hFγ + · intro π₁ _ _ hT₁ hred₁ F₁ hnorm₁ _ hdisj hF₁ + have : ConnectedSpace π₁.S := π₁.connected + have hF₀γ : (∅ : Set π₁.S) ∩ π₁.domγ = ∅ := empty_inter _ + have hβF₀ : ∀ n ∈ (∅ : Set π₁.S) ∩ (π₁.Γ.N ∩ bd π₁.S), π₁.borderSet n = ∅ := + fun _ h => h.1.elim + have hkeep_ne : ∀ {I_keep I_absorb : Set (Set π₁.S)}, + I_keep ⊆ π₁.Γ.C → I_absorb = π₁.Γ.C \ I_keep → + IsSmallWrt 𝒯 (π₁.cellsUnion I_absorb) → I_keep.Nonempty := by + intro I_keep I_absorb _ hI_abs hsmall + by_contra hnot + have h_empty : I_keep = ∅ := not_nonempty_iff_eq_empty.mp hnot + have h_all : I_absorb = π₁.Γ.C := by rw [hI_abs, h_empty, sdiff_empty] + rw [h_all, π₁.cellsUnion_C] at hsmall + exact hsmall.ne_G hTangle rfl + rcases GraphMinor.GM17.cutNormalOArc π₁.S π₁.isSurface π₁.Γ F₁ hnorm₁ hF₁ hdisj with + ⟨_, S₀, tS₀, cS₀, h2S₀, connS₀, ι₀, Γ₀, hsS₀, hsimpS₀, hcut₀⟩ | + ⟨I₁, I₂, hI₁, hI₂, hsep, hside₁, hside₂⟩ + · have hsmall_empty : IsSmallWrt 𝒯 (π₁.cellsUnion (π₁.Γ.C \ π₁.Γ.C)) := by + rw [sdiff_self] + exact π₁.isSmallWrt_cellsUnion_empty hTangle hθ + obtain ⟨π', hπ'T, hπ'S⟩ := + π₁.exists_simpler_of_isCutSidePainting hTangle hθ hT₁ hF₀γ hβF₀ + subset_rfl rfl (fun _ _ _ h => (sdiff_self ▸ h).elim) + hsmall_empty hsS₀ hsimpS₀ hcut₀ + exact (hred₁ π' hπ'T hπ'S).elim + · have hsep₀ : ∀ c₁ ∈ I₁, ∀ c₂ ∈ I₂, tilde c₁ ∩ tilde c₂ ⊆ (∅ : Set π₁.S) := + fun c₁ hc₁ c₂ hc₂ => (hsep c₁ hc₁ c₂ hc₂).subset + obtain ⟨hIsSep, hinter_empty⟩ := + π₁.isSeparation_order_zero_of_normal_cut hF₀γ hβF₀ hI₁ hI₂ hsep₀ + have hord_lt : separationOrder (π₁.cellsUnion I₁) (π₁.cellsUnion I₂) < θ := by + unfold separationOrder + rw [inter_vertexSet, hinter_empty, ncard_empty] + exact hθ + rcases hTangle.axiom1 hIsSep hord_lt with h1 | h2 + · have hsmall₁ : IsSmallWrt 𝒯 (π₁.cellsUnion I₁) := ⟨π₁.cellsUnion I₂, h1⟩ + rcases hside₁ with ⟨Δ, hΔ, hΔbd, hcells⟩ | hsimpler₁ + · refine ⟨Δ, hΔ, hΔbd, ?_⟩ + rwa [areaGraph_eq_cellsUnion π₁ hcells] + · have hI₂_sub : I₂ ⊆ π₁.Γ.C := hI₂ ▸ sdiff_subset + have hI₁_eq : I₁ = π₁.Γ.C \ I₂ := by + ext c + simp only [hI₂, mem_sdiff] + exact ⟨fun hc => ⟨hI₁ hc, fun h => h.2 hc⟩, + fun hc => by_contra fun h => hc.2 ⟨hc.1, h⟩⟩ + have hI₂_ne : I₂.Nonempty := hkeep_ne hI₂_sub hI₁_eq hsmall₁ + obtain ⟨S', tS', cS', h2S', connS', ι, Γ', hsS', hsimpS', hcut'⟩ := hsimpler₁ hI₂_ne + have hsep' : ∀ c₂ ∈ I₂, ∀ c₁ ∈ I₁, tilde c₂ ∩ tilde c₁ ⊆ (∅ : Set π₁.S) := + fun c₂ hc₂ c₁ hc₁ => Set.inter_comm (tilde c₂) (tilde c₁) ▸ hsep₀ c₁ hc₁ c₂ hc₂ + obtain ⟨π', hπ'T, hπ'S⟩ := + π₁.exists_simpler_of_isCutSidePainting hTangle hθ hT₁ hF₀γ hβF₀ + hI₂_sub hI₁_eq hsep' hsmall₁ hsS' hsimpS' hcut' + exact (hred₁ π' hπ'T hπ'S).elim + · have hsmall₂ : IsSmallWrt 𝒯 (π₁.cellsUnion I₂) := ⟨π₁.cellsUnion I₁, h2⟩ + rcases hside₂ with ⟨Δ, hΔ, hΔbd, hcells⟩ | hsimpler₂ + · refine ⟨Δ, hΔ, hΔbd, ?_⟩ + rwa [areaGraph_eq_cellsUnion π₁ hcells] + · have hI₁_ne : I₁.Nonempty := hkeep_ne hI₁ hI₂ hsmall₂ + obtain ⟨S', tS', cS', h2S', connS', ι, Γ', hsS', hsimpS', hcut'⟩ := hsimpler₂ hI₁_ne + obtain ⟨π', hπ'T, hπ'S⟩ := + π₁.exists_simpler_of_isCutSidePainting hTangle hθ hT₁ hF₀γ hβF₀ + hI₁ hI₂ hsep₀ hsmall₂ hsS' hsimpS' hcut' + exact (hred₁ π' hπ'T hπ'S).elim + · intro π₁ _ _ Γ' c₀ n Δ₀ hsh hn_γ F₁ hnorm₁ ih hF₁ + obtain ⟨Δ, hΔ, hΔbd, hsmall⟩ := ih hF₁ + have hΔbd_sub : discBd Δ ⊆ F₁ ∪ bd π₁.S := hΔbd ▸ subset_union_left + rw [π₁.shrinkCell_areaGraph_eq Γ' c₀ n Δ₀ hsh hn_γ hnorm₁ hΔ hΔbd_sub] at hsmall + exact ⟨Δ, hΔ, hΔbd, hsmall⟩ + +end GraphMinor.GM17 + +end diff --git a/LeanPool/GraphMinor/GM17/Section6.lean b/LeanPool/GraphMinor/GM17/Section6.lean new file mode 100644 index 0000000000..db515e79f3 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section6.lean @@ -0,0 +1,1070 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section5 + +import LeanPool.GraphMinor.Surface.Cuffs + +/-! +# Section 6 of Graph Minors XVII: Redundancy + +This file formalizes Section 6 (pages 173–178) of N. Robertson and P. D. Seymour, +*Graph Minors. XVII. Taming a vortex*, J. Combin. Theory Ser. B 77 (1999) 162–210: +- **Graph Minors XVII, (6.1)** (`theorem_6_1`, page 174): smallness of $A$ relative to + $\mathcal{T}$ is equivalent to smallness of $A / (Z \cap V(A))$ relative to $\mathcal{T} / Z$ + when $A / (Z \cap V(A))$ has fewer than $\theta - |Z|$ attachments in $G / Z$. +- **Graph Minors XVII, (6.2)** (`theorem_6_2`, page 174): the quotient portrayal + $\pi' = \pi.\text{quotientBy } Z$ is a $(\mathcal{T} / Z)$-central portrayal of $G / Z$, + resembling or simpler than $\pi$. +- **Graph Minors XVII, (6.3)** (`theorem_6_3`, page 174): a $\Gamma$-normal $I$-arc $F$ with + $|F \cap \operatorname{dom}(\gamma)| \le z - 2p$ cuts off a disc $\Delta$ with $\alpha(\Delta)$ + small. +- **Graph Minors XVII, (6.4)** (`theorem_6_4`, page 175): a $\Gamma$-normal $O$-arc $F$ with + $|F \cap \operatorname{dom}(\gamma)| \le z$ bounds a disc $\Delta$ with $\alpha(\Delta)$ small. +- **Graph Minors XVII, (6.5)** (`theorem_6_5`, page 175): behavior of a separation $(A, B) \in + \mathcal{T}$ + of order $\le z$ on a cuff $\Theta$ where $\pi$ has warp $p$. +- **Graph Minors XVII, (6.6)** (`theorem_6_6`, page 176), with its subproof claims (1), (2), and + (3): + no vertex set $X \subseteq V(G)$ of size $\le z / 3$ meets $\beta(n+)$ for every node $n$ + bordering a cuff $\Theta$. +- **Graph Minors XVII, (6.7)** (`theorem_6_7`, page 177): for a $\Gamma$-normal $I$-arc $F$ with + ends $n_1, n_2$ and $|F \cap \operatorname{dom}(\gamma)| \le z - 2p - 1$, the disc $\Delta$ of + (6.3) satisfies $\beta(n_1 +) \cap \beta(n_2 +) \subseteq \beta(n+)$ for all + $n \in N(\Gamma) \cap \Delta \cap \operatorname{bd}(\Sigma)$. +The portrayal deductions that use painting results are proved in `Section6Proved`. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +/-! ## 1. Quotient Hypergraphs and Graph Minors XVII, (6.1) (Page 174) -/ + +/-- For any hypergraph $A$ and vertex set $Z$, $A / (Z \cap V(A)) = A / Z$. -/ +@[simp] +theorem quotientVertices_inter_vertexSet {α : Type u} {β : Type v} + (A : Hypergraph α β) (Z : Set α) : + quotientVertices A (Z ∩ A.vertexSet) = quotientVertices A Z := by + have hle₁ : quotientVertices A (Z ∩ A.vertexSet) ≤ quotientVertices A Z := by + refine ⟨fun v hv => ⟨hv.1, fun hz => hv.2 ⟨hz, hv.1⟩⟩, Subset.rfl, fun e _ => ?_⟩ + ext v + change (A.Inc e v ∧ v ∉ Z) ↔ (A.Inc e v ∧ v ∉ Z ∩ A.vertexSet) + exact ⟨fun ⟨hinc, hv⟩ => ⟨hinc, fun ⟨hz, _⟩ => hv hz⟩, + fun ⟨hinc, hv⟩ => ⟨hinc, fun hz => hv ⟨hz, A.vertex_mem_of_inc hinc⟩⟩⟩ + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle₁ le_rfl ?_ rfl + ext v + change v ∈ A.vertexSet \ (Z ∩ A.vertexSet) ↔ v ∈ A.vertexSet \ Z + simp only [mem_sdiff, mem_inter_iff] + tauto + +@[simp] +theorem quotientVertices_empty {α : Type u} {β : Type v} (A : Hypergraph α β) : + quotientVertices A ∅ = A := by + have hle : quotientVertices A ∅ ≤ A := by + refine ⟨sdiff_subset, Subset.rfl, fun e _ => ?_⟩ + ext v + change A.Inc e v ↔ (A.Inc e v ∧ v ∉ (∅ : Set α)) + simp + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle le_rfl sdiff_empty rfl + +theorem quotientVertices_mono {α : Type u} {β : Type v} {G A : Hypergraph α β} + (hA : A ≤ G) (Z : Set α) : + quotientVertices A Z ≤ quotientVertices G Z where + vertexSet_subset := sdiff_subset_sdiff hA.vertexSet_subset Subset.rfl + edgeSet_subset := hA.edgeSet_subset + ends_eq e he := by + ext v + change ((G.Inc e v ∧ v ∉ Z) ↔ (A.Inc e v ∧ v ∉ Z)) + rw [inc_iff_of_le hA he] + +/-- The attachments of $A / Z$ in $G / Z$ are exactly the attachments of $A$ in $G$ outside $Z$. -/ +@[simp] +theorem attachments_quotientVertices {α : Type u} {β : Type v} + (G A : Hypergraph α β) (Z : Set α) : + attachments (quotientVertices G Z) (quotientVertices A Z) = attachments G A \ Z := by + ext v + simp only [attachments, quotientVertices, mem_ofPred_eq, mem_sdiff] + tauto + +/-- The complementary subhypergraph of $A / Z$ in $G / Z$ is $(G \setminus A) / Z$. -/ +theorem complSubhypergraph_quotientVertices {α : Type u} {β : Type v} + {G A : Hypergraph α β} (hA : A ≤ G) (Z : Set α) : + complSubhypergraph (quotientVertices G Z) (quotientVertices A Z) = + quotientVertices (complSubhypergraph G A) Z := by + have h1 : complSubhypergraph (quotientVertices G Z) (quotientVertices A Z) ≤ + quotientVertices G Z := + complSubhypergraph_le (quotientVertices_mono hA Z) + have h2 : quotientVertices (complSubhypergraph G A) Z ≤ quotientVertices G Z := + quotientVertices_mono (complSubhypergraph_le hA) Z + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq h1 h2 + · rw [complSubhypergraph_vertexSet, attachments_quotientVertices] + ext v + change v ∈ ((G.vertexSet \ Z) \ (A.vertexSet \ Z)) ∪ (attachments G A \ Z) ↔ + v ∈ ((G.vertexSet \ A.vertexSet) ∪ attachments G A) \ Z + simp only [mem_union, mem_sdiff] + tauto + · rfl + +/-- Adding a subset $W \subseteq V(G)$ of isolated vertices to a subhypergraph $A \le G$ gives the +subhypergraph $C \le G$ with $V(C) = V(A) \cup W$ and $E(C) = E(A)$. -/ +@[expose] +def addVertices {α : Type u} {β : Type v} (G A : Hypergraph α β) (W : Set α) + (hW : W ⊆ G.vertexSet) : Hypergraph α β where + vertexSet := A.vertexSet ∪ W + edgeSet := A.edgeSet + Inc := A.Inc + vertex_mem_of_inc _ _ h := Or.inl (A.vertex_mem_of_inc h) + edge_mem_of_inc := A.edge_mem_of_inc + vertexSet_finite := A.vertexSet_finite.union (G.vertexSet_finite.subset hW) + edgeSet_finite := A.edgeSet_finite + +@[simp] +theorem addVertices_vertexSet {α : Type u} {β : Type v} (G A : Hypergraph α β) (W : Set α) + (hW : W ⊆ G.vertexSet) : + (addVertices G A W hW).vertexSet = A.vertexSet ∪ W := + rfl + +@[simp] +theorem addVertices_edgeSet {α : Type u} {β : Type v} (G A : Hypergraph α β) (W : Set α) + (hW : W ⊆ G.vertexSet) : + (addVertices G A W hW).edgeSet = A.edgeSet := + rfl + +theorem le_addVertices {α : Type u} {β : Type v} {G A : Hypergraph α β} {W : Set α} + (hW : W ⊆ G.vertexSet) : + A ≤ addVertices G A W hW where + vertexSet_subset := subset_union_left + edgeSet_subset := Subset.rfl + ends_eq _ _ := rfl + +theorem addVertices_le {α : Type u} {β : Type v} {G A : Hypergraph α β} {W : Set α} + (hA : A ≤ G) (hW : W ⊆ G.vertexSet) : + addVertices G A W hW ≤ G where + vertexSet_subset := union_subset hA.vertexSet_subset hW + edgeSet_subset := hA.edgeSet_subset + ends_eq := hA.ends_eq + +theorem quotientVertices_addVertices {α : Type u} {β : Type v} {G A : Hypergraph α β} {W : Set α} + (hA : A ≤ G) (hW : W ⊆ G.vertexSet) : + quotientVertices (addVertices G A W hW) W = quotientVertices A W := by + have h1 : quotientVertices (addVertices G A W hW) W ≤ quotientVertices G W := + quotientVertices_mono (addVertices_le hA hW) W + have h2 : quotientVertices A W ≤ quotientVertices G W := + quotientVertices_mono hA W + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq h1 h2 + · ext v + change v ∈ (A.vertexSet ∪ W) \ W ↔ v ∈ A.vertexSet \ W + simp only [mem_sdiff, mem_union] + tauto + · rfl + +/-- **Graph Minors XVII, (6.1)** (page 174): +"Let $\mathscr{T}$ be a tangle of order $\theta$ in a hypergraph $G$, and let $Z \subseteq +V(G)$ with $|Z| < \theta$. Let $A \subseteq G$ such that $A/Z'$ has fewer than $\theta - +|Z|$ attachments in $G/Z$, where $Z' = Z \cap V(A)$. Then $A$ is small relative to +$\mathscr{T}$ if and only if $A/Z'$ is small relative to $\mathscr{T}/Z$." -/ +theorem theorem_6_1_proof {α : Type u} {β : Type v} {G A : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {Z : Set α} (hZ : Z ⊆ G.vertexSet) (hZ_lt : Z.ncard < θ) + (hA : A ≤ G) + (hatt : (attachments (quotientVertices G Z) + (quotientVertices A (Z ∩ A.vertexSet))).ncard < θ - Z.ncard) : + IsSmallWrt 𝒯 A ↔ + IsSmallWrt (quotientTangle G 𝒯 Z) (quotientVertices A (Z ∩ A.vertexSet)) := by + rw [quotientVertices_inter_vertexSet] at hatt ⊢ + let A' := quotientVertices A Z + have hA'_le : A' ≤ quotientVertices G Z := quotientVertices_mono hA Z + let B₀ := complSubhypergraph G A + have hsep₀ : G.IsSeparation A B₀ := isSeparation_complSubhypergraph hA + let D' := complSubhypergraph (quotientVertices G Z) A' + have hsep' : (quotientVertices G Z).IsSeparation A' D' := + isSeparation_complSubhypergraph hA'_le + -- Following the paper's proof, let C have V(C) = V(A) ∪ Z and E(C) = E(A), and let D have + -- V(D) = V(B₀) ∪ Z and E(D) = E(B₀), so Z ⊆ V(C ∩ D), C / Z = A', D / Z = D', and (C, D) is a + -- separation of G of order < θ. + let C := addVertices G A Z hZ + let D := addVertices G B₀ Z hZ + have hC_le : C ≤ G := addVertices_le hA hZ + have hD_le : D ≤ G := addVertices_le hsep₀.right_le hZ + have hCZ : quotientVertices C Z = A' := quotientVertices_addVertices hA hZ + have hDZ : quotientVertices D Z = D' := by + rw [quotientVertices_addVertices hsep₀.right_le hZ] + exact (complSubhypergraph_quotientVertices hA Z).symm + have hZ_CD : Z ⊆ (C ∩ D).vertexSet := + subset_inter subset_union_right subset_union_right + have hsepCD : G.IsSeparation C D := by + rw [isSeparation_iff_of_le hC_le hD_le] + refine ⟨?_, hsep₀.edgeSet_union, hsep₀.edgeSet_inter_eq⟩ + ext v + simp only [C, D, addVertices_vertexSet, mem_union] + constructor + · rintro ((hvA | hvZ) | (hvB | hvZ)) + · exact hA.vertexSet_subset hvA + · exact hZ hvZ + · exact hsep₀.right_le.vertexSet_subset hvB + · exact hZ hvZ + · intro hvG + rw [← hsep₀.vertexSet_union] at hvG + rcases hvG with hvA | hvB + · exact Or.inl (Or.inl hvA) + · exact Or.inr (Or.inl hvB) + have hsepAD : G.IsSeparation A D := by + rw [isSeparation_iff_of_le hA hD_le] + refine ⟨?_, hsep₀.edgeSet_union, hsep₀.edgeSet_inter_eq⟩ + ext v + simp only [D, addVertices_vertexSet, mem_union] + constructor + · rintro (hvA | (hvB | hvZ)) + · exact hA.vertexSet_subset hvA + · exact hsep₀.right_le.vertexSet_subset hvB + · exact hZ hvZ + · intro hvG + rw [← hsep₀.vertexSet_union] at hvG + rcases hvG with hvA | hvB + · exact Or.inl hvA + · exact Or.inr (Or.inl hvB) + have hordCD : separationOrder C D < θ := by + have hinter : (C ∩ D).vertexSet = (attachments G A \ Z) ∪ Z := by + ext v + simp only [inter_vertexSet, C, D, B₀, addVertices_vertexSet, complSubhypergraph_vertexSet, + mem_inter_iff, mem_union, mem_sdiff] + constructor + · rintro ⟨hvA | hvZ, (⟨_, hvnotA⟩ | hvAtt) | hvZ⟩ + · exact (hvnotA hvA).elim + · by_cases hz : v ∈ Z + · exact Or.inr hz + · exact Or.inl ⟨hvAtt, hz⟩ + · exact Or.inr hvZ + · exact Or.inr hvZ + · exact Or.inr hvZ + · exact Or.inr hvZ + · rintro (⟨hvAtt, _⟩ | hvZ) + · exact ⟨Or.inl hvAtt.1, Or.inl (Or.inr hvAtt)⟩ + · exact ⟨Or.inr hvZ, Or.inr hvZ⟩ + have hdisj : Disjoint (attachments G A \ Z) Z := disjoint_sdiff_self_left + have hcard : separationOrder C D = (attachments G A \ Z).ncard + Z.ncard := by + rw [separationOrder, hinter, + ncard_union_eq hdisj (attachments_finite.sdiff) (G.vertexSet_finite.subset hZ)] + rw [attachments_quotientVertices] at hatt + omega + have hordAD : separationOrder A D < θ := by + have hsub : (A ∩ D).vertexSet ⊆ (C ∩ D).vertexSet := + inter_subset_inter_left _ subset_union_left + exact (ncard_le_ncard hsub (C ∩ D).vertexSet_finite).trans_lt hordCD + have hTangleQ : IsTangle (quotientVertices G Z) (θ - Z.ncard) (quotientTangle G 𝒯 Z) := + theorem_4_2_proof h𝒯 hZ hZ_lt + -- Now follow the two cases of the paper's proof: (C, D) ∈ 𝒯 or (C, D) ∉ 𝒯. + rcases h𝒯.axiom1 hsepCD hordCD with hCD | hDC + · have hA_small : IsSmallWrt 𝒯 A := by + rcases h𝒯.axiom1 hsepAD hordAD with hAD | hDA + · exact ⟨D, hAD⟩ + · exfalso + apply h𝒯.axiom2 hCD hDA hDA + have hU_le : C ∪ D ∪ D ≤ G := union_le (union_le hC_le hD_le) hD_le + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq hU_le le_rfl + · rw [union_vertexSet, union_vertexSet, Set.union_assoc, Set.union_self, + hsepCD.vertexSet_union] + · rw [union_edgeSet, union_edgeSet, Set.union_assoc, Set.union_self, hsepCD.edgeSet_union] + have hA'_small : IsSmallWrt (quotientTangle G 𝒯 Z) A' := + ⟨D', hsep', ⟨(C, D), hCD, hZ_CD, hCZ, hDZ⟩⟩ + exact ⟨fun _ => hA'_small, fun _ => hA_small⟩ + · have hA_not_small : ¬ IsSmallWrt 𝒯 A := by + rintro ⟨B₁, hAB₁⟩ + have hA₁_le := (h𝒯.isSeparation hAB₁).left_le + apply h𝒯.axiom2 hDC hAB₁ hAB₁ + have hU_le : D ∪ A ∪ A ≤ G := union_le (union_le hD_le hA₁_le) hA₁_le + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq hU_le le_rfl + · rw [union_vertexSet, union_vertexSet, Set.union_assoc, Set.union_self, Set.union_comm, + hsepAD.vertexSet_union] + · rw [union_edgeSet, union_edgeSet, Set.union_assoc, Set.union_self, Set.union_comm, + hsepAD.edgeSet_union] + have hD'A'_mem : (D', A') ∈ quotientTangle G 𝒯 Z := by + refine ⟨hsep'.symm, ⟨(D, C), hDC, ?_, hDZ, hCZ⟩⟩ + rw [GM10.inter_comm] + exact hZ_CD + have hA'_not_small : ¬ IsSmallWrt (quotientTangle G 𝒯 Z) A' := by + rintro ⟨B₁', hA'B₁'⟩ + have hA₁'_le := (hTangleQ.isSeparation hA'B₁').left_le + apply hTangleQ.axiom2 hD'A'_mem hA'B₁' hA'B₁' + have hU_le : D' ∪ A' ∪ A' ≤ quotientVertices G Z := + union_le (union_le hsep'.right_le hA₁'_le) hA₁'_le + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq hU_le le_rfl + · rw [union_vertexSet, union_vertexSet, Set.union_assoc, Set.union_self, Set.union_comm, + hsep'.vertexSet_union] + · rw [union_edgeSet, union_edgeSet, Set.union_assoc, Set.union_self, Set.union_comm, + hsep'.edgeSet_union] + exact ⟨fun h => (hA_not_small h).elim, fun h => (hA'_not_small h).elim⟩ + +/-! ## 2. Quotient Portrayal and Graph Minors XVII, (6.2)–(6.4) (Pages 174–175) -/ + +/-- If a portrayal $\pi'$ on a surface homeomorphic to $\pi.S$ has warp at each cuff at most that +of $\pi$, then $\pi'$ either resembles or is simpler than $\pi$. -/ +theorem Portrayal.resembles_or_isSimpler_of_warpAt_le + {α α' β β' : Type*} {G : Hypergraph α β} {G' : Hypergraph α' β'} + {π : Portrayal G} {π' : Portrayal G'} + (ψ : π'.S ≃ₜ π.S) + (hle : ∀ Θ ∈ cuffs π'.S, π'.warpAt Θ ≤ π.warpAt (ψ '' Θ)) : + π'.Resembles π ∨ π'.IsSimpler π := by + by_cases hex : ∃ Θ ∈ cuffs π'.S, π'.warpAt Θ < π.warpAt (ψ '' Θ) + · exact Or.inr (Or.inr ⟨ψ, hle, hex⟩) + · refine Or.inl ⟨ψ, fun Θ hΘ => le_antisymm (hle Θ hΘ) ?_⟩ + by_contra hlt + exact hex ⟨Θ, hΘ, Nat.lt_of_not_le hlt⟩ + +theorem Portrayal.warpAt_eq_of_warpAt_le_of_not_isSimpler + {α : Type u} {β : Type v} {G G' : Hypergraph α β} + {π : Portrayal G} {π' : Portrayal G'} + (ψ : π'.S ≃ₜ π.S) + (hle : ∀ Θ ∈ cuffs π'.S, π'.warpAt Θ ≤ π.warpAt (ψ '' Θ)) + (hnot : ¬ π'.IsSimpler π) : + ∀ Θ ∈ cuffs π'.S, π'.warpAt Θ = π.warpAt (ψ '' Θ) := by + intro Θ hΘ + refine le_antisymm (hle Θ hΘ) ?_ + by_contra hlt + exact hnot (Or.inr ⟨ψ, hle, Θ, hΘ, Nat.lt_of_not_le hlt⟩) + +/-- Any walk in $(H / W)^*$ is a walk in $H^*$ with the same support. -/ +theorem walk_skeleton_of_quotientVertices {α : Type u} {β : Type v} + {H : Hypergraph α β} {W : Set α} {u w : α} + (P : (quotientVertices H W).skeleton.Walk u w) : + ∃ P' : H.skeleton.Walk u w, P'.support = P.support := by + induction P with + | nil => exact ⟨SimpleGraph.Walk.nil, rfl⟩ + | @cons u v w hadj P_tail ih => + rcases hadj with ⟨huv, e, ⟨heu, _⟩, ⟨hev, _⟩⟩ + have hadj' : H.skeleton.Adj u v := ⟨huv, e, heu, hev⟩ + obtain ⟨P'_tail, hsupp⟩ := ih + exact ⟨SimpleGraph.Walk.cons hadj' P'_tail, by + dsimp [SimpleGraph.Walk.support] + rw [hsupp]⟩ + +@[simp] +theorem Portrayal.quotientBy_borderPlus {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Z : Set α) (n : π.S) : + (π.quotientBy Z).borderPlus n = π.borderPlus n \ Z := by + ext v + simp only [Portrayal.borderPlus, Portrayal.quotientBy, mem_sdiff, mem_ofPred_eq] + constructor + · rintro (⟨h, hz⟩ | ⟨⟨h, hz⟩, rfl⟩) + · exact ⟨Or.inl h, hz⟩ + · exact ⟨Or.inr ⟨h, rfl⟩, hz⟩ + · rintro ⟨h | ⟨h, rfl⟩, hz⟩ + · exact Or.inl ⟨h, hz⟩ + · exact Or.inr ⟨⟨h, hz⟩, rfl⟩ + +theorem Portrayal.quotientBy_cellsUnion {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Z : Set α) (I : Set (Set π.S)) : + (π.quotientBy Z).cellsUnion I = + quotientVertices (π.cellsUnion I) (Z ∩ (π.cellsUnion I).vertexSet) := by + rw [quotientVertices_inter_vertexSet] + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq + ((π.quotientBy Z).cellsUnion_le I) (quotientVertices_mono (π.cellsUnion_le I) Z) + · ext v + simp only [Portrayal.cellsUnion, Portrayal.quotientBy, quotientVertices, mem_iUnion, + mem_inter_iff, mem_sdiff] + constructor + · rintro ⟨c, hc, hvc, hvnot⟩ + exact ⟨⟨c, hc, hvc⟩, fun hz => hvnot ⟨hz, hvc⟩⟩ + · rintro ⟨⟨c, hc, hvc⟩, hvZ⟩ + exact ⟨c, hc, hvc, fun ⟨hz, _⟩ => hvZ hz⟩ + · rfl + +theorem Portrayal.quotientBy_areaGraph {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Z : Set α) (Δ : Set π.S) : + (π.quotientBy Z).areaGraph Δ = + quotientVertices (π.areaGraph Δ) (Z ∩ (π.areaGraph Δ).vertexSet) := + π.quotientBy_cellsUnion Z {c ∈ π.Γ.C | c ⊆ Δ} + +/-- A walk lift preserving support transports the warp condition to smaller border sets. -/ +theorem Portrayal.cellWarp_pair_of_walk_lift {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {c : Set π.S} (hc : c ∈ π.Γ.C) (hbd : (c ∩ bd π.S).Nonempty) + {n₁ n₂ : π.S} (hn₁ : n₁ ∈ tilde c) (hn₂ : n₂ ∈ tilde c) (hne : n₁ ≠ n₂) + {K : SimpleGraph α} {B₁ B₂ U₁ U₂ : Set α} + (hB₁ : B₁ ⊆ π.borderSet n₁) (hB₂ : B₂ ⊆ π.borderSet n₂) + (hU₁ : U₁ ⊆ π.borderPlus n₁) (hU₂ : U₂ ⊆ π.borderPlus n₂) + (hlift : ∀ {a b : α}, a ∈ U₁ → (W : K.Walk a b) → + ∃ W' : (π.cellGraph c).skeleton.Walk a b, W'.support = W.support) : + B₁.ncard ≤ π.cellWarp c ∧ B₂.ncard ≤ π.cellWarp c ∧ + (U₁.ncard = π.cellWarp c + 1 → U₂.ncard = π.cellWarp c + 1 → + Portrayal.LinkagePairs K U₁ U₂ (π.cellWarp c + 1) (π.nodeVertex n₁) (π.nodeVertex n₂)) := by + obtain ⟨u, v, _, htilde, _, _, hu, hv⟩ := π.Γ.border_cell_exists_ends hc hbd + have hn₁' : n₁ ∈ ({u, v} : Set π.S) := htilde ▸ hn₁ + have hn₂' : n₂ ∈ ({u, v} : Set π.S) := htilde ▸ hn₂ + have hn₁_mem : n₁ ∈ π.Γ.N ∩ bd π.S := by + rcases hn₁' with rfl | rfl <;> assumption + have hn₂_mem : n₂ ∈ π.Γ.N ∩ bd π.S := by + rcases hn₂' with rfl | rfl <;> assumption + have hspec := π.cellWarp_spec hc hbd n₁ hn₁ n₂ hn₂ hne + refine ⟨(ncard_le_ncard hB₁ (π.borderSet_finite hn₁_mem)).trans hspec.1, + (ncard_le_ncard hB₂ (π.borderSet_finite hn₂_mem)).trans hspec.2.1, + fun hcard₁ hcard₂ P hP_disj => ?_⟩ + have hcard₁' : (π.borderPlus n₁).ncard = π.cellWarp c + 1 := by + have hle := (π.ncard_borderPlus_le hn₁_mem).trans (Nat.add_le_add_right hspec.1 1) + have hge := ncard_le_ncard hU₁ (π.borderPlus_finite hn₁_mem) + omega + have hcard₂' : (π.borderPlus n₂).ncard = π.cellWarp c + 1 := by + have hle := (π.ncard_borderPlus_le hn₂_mem).trans (Nat.add_le_add_right hspec.2.1 1) + have hge := ncard_le_ncard hU₂ (π.borderPlus_finite hn₂_mem) + omega + choose W hW using fun i => hlift (P i).first_mem (P i).walk + let Q (i : Fin (π.cellWarp c + 1)) : + PathFromTo (π.cellGraph c).skeleton (π.borderPlus n₁) (π.borderPlus n₂) := + ⟨(P i).first, (P i).last, W i, + (by rw [SimpleGraph.Walk.isPath_def, hW i]; exact (P i).isPath.support_nodup), + hU₁ (P i).first_mem, hU₂ (P i).last_mem⟩ + have hQ_disj : Pairwise fun i j => + Disjoint {z | z ∈ (Q i).walk.support} {z | z ∈ (Q j).walk.support} := by + intro i j hij + change Disjoint {z | z ∈ (W i).support} {z | z ∈ (W j).support} + rw [hW i, hW j] + exact hP_disj hij + obtain ⟨i, hfirst, hlast⟩ := hspec.2.2 hcard₁' hcard₂' Q hQ_disj + exact ⟨i, hfirst, hlast⟩ + +theorem Portrayal.quotientBy_cellWarp_le {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Z : Set α) + {c : Set π.S} (hc : c ∈ π.Γ.C) (hbd : (c ∩ bd π.S).Nonempty) : + (π.quotientBy Z).cellWarp c ≤ π.cellWarp c := by + apply Nat.sInf_le + intro n₁ hn₁ n₂ hn₂ hne + refine π.cellWarp_pair_of_walk_lift hc hbd hn₁ hn₂ hne sdiff_subset sdiff_subset ?_ ?_ ?_ + · rw [π.quotientBy_borderPlus Z n₁] + exact sdiff_subset + · rw [π.quotientBy_borderPlus Z n₂] + exact sdiff_subset + · intro _ _ _ W + exact walk_skeleton_of_quotientVertices W + +theorem Portrayal.quotientBy_warpAt_le {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Z : Set α) {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) : + (π.quotientBy Z).warpAt Θ ≤ π.warpAt Θ := by + refine ((π.quotientBy Z).warpAt_le_iff (Θ := Θ)).mpr fun c hc hcΘ => ?_ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x + have hbd : (c ∩ bd π.S).Nonempty := hcΘ.mono (inter_subset_inter_right _ hΘ_bd) + exact (π.quotientBy_cellWarp_le Z hc hbd).trans (π.cellWarp_le_warpAt hc hcΘ) + +/-- Every cell $c \in C(\Gamma)$ of a portrayal $\pi$ with $\operatorname{warp}(\pi) \le p$ has at +most $\max(3, 2p + 2)$ attachments in $G$ (which equals $2p + 2$ whenever $p \ge 1$). -/ +theorem Portrayal.ncard_attachments_cellGraph_le {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {p : ℕ} (hwarp : π.warp ≤ p) + {c : Set π.S} (hc : c ∈ π.Γ.C) : + (attachments G (π.cellGraph c)).ncard ≤ max 3 (2 * p + 2) := by + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have hsub := π.attachments_cellGraph_subset_otherVertices hc + by_cases hbd : (c ∩ bd π.S).Nonempty + · obtain ⟨n₁, n₂, _, htilde, _, _, hn₁_mem, hn₂_mem⟩ := π.Γ.border_cell_exists_ends hc hbd + have hsub₂ : (π.cellGraph c).vertexSet ∩ π.otherVertices c ⊆ + π.borderPlus n₁ ∪ π.borderPlus n₂ := by + rintro v ⟨hvc, hvo⟩ + obtain ⟨n, hnt, hvn⟩ := π.p6_borderPlus hc hbd hvc hvo + rw [htilde] at hnt + rcases hnt with rfl | rfl + · exact Or.inl hvn + · exact Or.inr hvn + have hcw_le : π.cellWarp c ≤ p := by + rcases hbd with ⟨x, hxc, hxbd⟩ + have hΘ : connectedComponentIn (bd π.S) x ∈ cuffs π.S := ⟨x, hxbd, rfl⟩ + have hcΘ : (c ∩ connectedComponentIn (bd π.S) x).Nonempty := + ⟨x, hxc, mem_connectedComponentIn hxbd⟩ + exact (π.cellWarp_le_warpAt hc hcΘ).trans ((π.warpAt_le_warp hΘ).trans hwarp) + have h₁ : (π.borderPlus n₁).ncard ≤ p + 1 := by + have hn₁ : n₁ ∈ tilde c := by rw [htilde]; exact mem_insert _ _ + exact (π.ncard_borderPlus_le hn₁_mem).trans + (Nat.add_le_add_right ((π.ncard_borderSet_le_cellWarp hc hbd hn₁).trans hcw_le) 1) + have h₂ : (π.borderPlus n₂).ncard ≤ p + 1 := by + have hn₂ : n₂ ∈ tilde c := by rw [htilde]; exact mem_insert_of_mem _ (mem_singleton _) + exact (π.ncard_borderPlus_le hn₂_mem).trans + (Nat.add_le_add_right ((π.ncard_borderSet_le_cellWarp hc hbd hn₂).trans hcw_le) 1) + have hcard : (attachments G (π.cellGraph c)).ncard ≤ + (π.borderPlus n₁).ncard + (π.borderPlus n₂).ncard := + (ncard_le_ncard (hsub.trans hsub₂) + ((π.borderPlus_finite hn₁_mem).union (π.borderPlus_finite hn₂_mem))).trans + (ncard_union_le _ _) + omega + · have hsub₂ : (π.cellGraph c).vertexSet ∩ π.otherVertices c ⊆ + π.nodeVertex '' (tilde c ∩ π.domγ) := by + rintro v ⟨hvc, hvo⟩ + obtain ⟨n, hn, rfl⟩ := π.p5 c hc hbd v hvc hvo + exact ⟨n, hn, rfl⟩ + have hcard₁ : (attachments G (π.cellGraph c)).ncard ≤ (tilde c ∩ π.domγ).ncard := + (ncard_le_ncard (hsub.trans hsub₂) + (((π.Γ.finite_tilde_cell hc).inter_of_left _).image _)).trans + (ncard_image_le ((π.Γ.finite_tilde_cell hc).inter_of_left _)) + have hcard₂ : (tilde c ∩ π.domγ).ncard ≤ (tilde c).ncard := + ncard_le_ncard inter_subset_left (π.Γ.finite_tilde_cell hc) + have hcard₃ : (tilde c).ncard ≤ 3 := π.Γ.ncard_tilde_cell_le hc + omega + +/-- **Graph Minors XVII, (6.2)** (page 174): +"Let $\mathscr{T}$ be a tangle in a hypergraph $G$ and let $\pi = (\Sigma, \Gamma, \alpha, \beta, +\gamma)$ be a $\mathscr{T}$-central portrayal of $G$ with $warp \le p$. Let $Z \subseteq V(G)$, +with $|Z| < ord(\mathscr{T}) - 2p - 2$. Define +$$ \begin{aligned} \alpha'(c) &= \alpha(c)/(Z \cap V(\alpha(c))) && (c \in C(\Gamma)) \\ \beta'(n) +&= \beta(n) - Z && (n \in N(\Gamma) \cap bd(\Sigma)) \\ \gamma' &= \gamma \mid \{n : n \in +dom(\gamma), \gamma(n) \notin Z\}. \end{aligned} $$ +Then $\pi' = (\Sigma, \Gamma, \alpha', \beta', \gamma')$ is a $\mathscr{T}/Z$-central portrayal of +$G/Z$, resembling or simpler than $\pi$." + +Note: For an internal cell $c \in C(\Gamma)$ the number of attachments of +$\alpha(c)$ is bounded by $|\tilde{c}| \le 3$, which is $\le 2p + 2$ whenever $p \ge 1$ (in +particular for all 0-redundant portrayals by (5.1)), while for $p = 0$ the bound is +$\max(3, 2p + 2) = 3$. -/ +theorem theorem_6_2_proof {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) (hT : π.IsCentral 𝒯) (hwarp : π.warp ≤ p) + {Z : Set α} (hZ : Z ⊆ G.vertexSet) + (hZ_lt : Z.ncard + max 3 (2 * p + 2) < θ) : + (π.quotientBy Z).IsCentral (quotientTangle G 𝒯 Z) ∧ + ((π.quotientBy Z).Resembles π ∨ (π.quotientBy Z).IsSimpler π) := by + have : T2Space π.S := π.isSurface.2.1 + refine ⟨fun c hc => ?_, ?_⟩ + · change IsSmallWrt (quotientTangle G 𝒯 Z) + (quotientVertices (π.cellGraph c) (Z ∩ (π.cellGraph c).vertexSet)) + have hatt_le : (attachments (quotientVertices G Z) + (quotientVertices (π.cellGraph c) (Z ∩ (π.cellGraph c).vertexSet))).ncard ≤ + max 3 (2 * p + 2) := by + rw [quotientVertices_inter_vertexSet, attachments_quotientVertices] + exact (ncard_le_ncard sdiff_subset attachments_finite).trans + (π.ncard_attachments_cellGraph_le hwarp hc) + exact (theorem_6_1_proof h𝒯 hZ (by omega) (π.cellGraph_le c hc) (by omega)).mp (hT c hc) + · apply Portrayal.resembles_or_isSimpler_of_warpAt_le (π' := π.quotientBy Z) (Homeomorph.refl π.S) + intro Θ hΘ + have hle := π.quotientBy_warpAt_le Z hΘ + have himg : (Homeomorph.refl π.S : π.S → π.S) '' Θ = Θ := image_id Θ + change (π.quotientBy Z).warpAt Θ ≤ π.warpAt ((Homeomorph.refl π.S : π.S → π.S) '' Θ) + rw [himg] + exact hle + +/-- Every $z$-redundant portrayal is $0$-redundant. -/ +theorem Portrayal.IsRedundant.isZeroRedundant {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ z : ℕ} + {π : Portrayal G} (h𝒯 : IsTangle G θ 𝒯) (hred : π.IsRedundant 𝒯 θ z) : + π.IsZeroRedundant 𝒯 := by + intro π' hT' hsimp + have hT'' : (π'.quotientBy ∅).IsCentral (quotientTangle G 𝒯 ∅) := by + intro c hc + obtain ⟨B, hAB⟩ := hT' c hc + have hsep := h𝒯.isSeparation hAB + refine ⟨quotientVertices B ∅, ?_⟩ + change (quotientVertices (π'.cellGraph c) (∅ ∩ _), quotientVertices B ∅) ∈ + quotientTangle G 𝒯 ∅ + rw [quotientVertices_inter_vertexSet] + exact ⟨IsSeparation.quotientVertices hsep ∅, ⟨(π'.cellGraph c, B), hAB, empty_subset _, rfl, + rfl⟩⟩ + have hcg_eq : ∀ c : Set π'.S, (π'.quotientBy ∅).cellGraph c = π'.cellGraph c := fun c => + (quotientVertices_inter_vertexSet (π'.cellGraph c) ∅).trans (quotientVertices_empty _) + have hbp_eq : ∀ n : π'.S, (π'.quotientBy ∅).borderPlus n = π'.borderPlus n := by + intro n + rw [π'.quotientBy_borderPlus ∅ n, sdiff_empty] + have hbs_eq : ∀ n : π'.S, (π'.quotientBy ∅).borderSet n = π'.borderSet n := by + intro n + change π'.borderSet n \ ∅ = π'.borderSet n + exact sdiff_empty + have hnv_eq : ∀ n : π'.S, (π'.quotientBy ∅).nodeVertex n = π'.nodeVertex n := fun _ => rfl + have hcw_eq : ∀ c : Set π'.S, (π'.quotientBy ∅).cellWarp c = π'.cellWarp c := by + intro c + unfold Portrayal.cellWarp Portrayal.CellWarpLE + congr 1; ext p + refine forall_congr' fun n₁ => imp_congr_right fun _ => + forall_congr' fun n₂ => imp_congr_right fun _ => + imp_congr_right fun _ => ?_ + rw [hbs_eq n₁, hbs_eq n₂, hbp_eq n₁, hbp_eq n₂, hcg_eq c, hnv_eq n₁, hnv_eq n₂] + have hwarpAt_eq : ∀ Θ : Set π'.S, (π'.quotientBy ∅).warpAt Θ = π'.warpAt Θ := by + intro Θ + unfold Portrayal.warpAt + congr 1; ext q + exact exists_congr fun c => and_congr_right fun _ => + and_congr_right fun _ => by rw [hcw_eq c] + have hwarp_eq : (π'.quotientBy ∅).warp = π'.warp := by + classical + unfold Portrayal.warp + change (if (cuffs π'.S).Nonempty then _ else 1) = _ + split_ifs + · refine congrArg (max 1) (congrArg sSup ?_) + ext q + exact exists_congr fun Θ => and_congr_right fun _ => by rw [hwarpAt_eq Θ] + · rfl + have hsimp' : (π'.quotientBy ∅).IsSimpler π := by + rcases hsimp with ⟨hS, hw⟩ | ⟨ψ, hle, Θ, hΘ, hlt⟩ + · exact Or.inl ⟨hS, hwarp_eq.trans_le hw⟩ + · refine Or.inr ⟨ψ, fun Φ hΦ => ?_, Θ, hΘ, ?_⟩ + · exact (hwarpAt_eq Φ).trans_le (hle Φ hΦ) + · exact (hwarpAt_eq Θ).trans_lt hlt + exact hred.2 ∅ (empty_subset _) (by simp) (π'.quotientBy ∅) hT'' hsimp' + +/-- When $\pi$ is $z$-redundant and $|Z| \le z$, $\pi.\text{quotientBy } Z$ resembles $\pi$ and is +$0$-redundant relative to $\mathcal{T} / Z$. -/ +theorem Portrayal.quotientBy_resembles_and_isZeroRedundant + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p z : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) (hT : π.IsCentral 𝒯) (hwarp : π.warp ≤ p) + (hred : π.IsRedundant 𝒯 θ z) + {Z : Set α} (hZ : Z ⊆ G.vertexSet) (hZ_le : Z.ncard ≤ z) + (hZ_lt : Z.ncard + max 3 (2 * p + 2) < θ) : + (π.quotientBy Z).IsCentral (quotientTangle G 𝒯 Z) ∧ + (π.quotientBy Z).Resembles π ∧ + (π.quotientBy Z).IsZeroRedundant (quotientTangle G 𝒯 Z) := by + obtain ⟨hT', hres_or_simp⟩ := theorem_6_2_proof h𝒯 π hT hwarp hZ hZ_lt + have hnot_simp : ¬ (π.quotientBy Z).IsSimpler π := hred.2 Z hZ hZ_le (π.quotientBy Z) hT' + have hres : (π.quotientBy Z).Resembles π := hres_or_simp.resolve_right hnot_simp + refine ⟨hT', hres, ?_⟩ + exact hres.isZeroRedundant_quotient hred hZ hZ_le + +/-- The portrayal after restricting cells to one side of a separation +and identifying its boundary vertices. -/ +@[expose] +noncomputable def Portrayal.restrictQuotient {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (A B : Hypergraph α β) (hsep : IsSeparation G A B) + (c' : Set π.S) (hc' : c' ∈ π.Γ.C) : + Portrayal (quotientVertices G (A.vertexSet ∩ B.vertexSet)) := by + classical + let Z := A.vertexSet ∩ B.vertexSet + have hnotA_iff : ∀ {v : α}, v ∈ G.vertexSet → (v ∉ A.vertexSet ↔ v ∈ B.vertexSet ∧ v ∉ Z) := by + intro v hv + have hvAB : v ∈ A.vertexSet ∪ B.vertexSet := hsep.vertexSet_union ▸ hv + refine ⟨fun hvA => ⟨hvAB.resolve_left hvA, fun hZ => hvA hZ.1⟩, fun ⟨_, hvZ⟩ hvA => hvZ ⟨hvA, + ‹_›⟩⟩ + let QB : Set π.S → Hypergraph α β := fun c => quotientVertices (π.cellGraph c ∩ B) Z + let QA : Hypergraph α β := quotientVertices A Z + have hQB_le : ∀ c ∈ π.Γ.C, QB c ≤ quotientVertices G Z := by + intro c hc + refine quotientVertices_mono ?_ Z + exact ⟨inter_subset_left.trans (π.cellGraph_le c hc).1, + inter_subset_left.trans (π.cellGraph_le c hc).2, + fun e he => by + ext v + simp only [ends, Inter.inter, mem_ofPred_eq] + have h1 := congrArg (v ∈ ·) ((π.cellGraph_le c hc).3 e he.1) + have h2 := congrArg (v ∈ ·) (hsep.right_le.3 e he.2) + dsimp [ends] at h1 h2 + exact ⟨fun h => ⟨h1.mp h, h2.mp h⟩, fun h => h1.mpr h.1⟩⟩ + have hQA_le : QA ≤ quotientVertices G Z := quotientVertices_mono hsep.left_le Z + have hunion_le : ∀ {H₁ H₂ H : Hypergraph α β}, H₁ ≤ H → H₂ ≤ H → H₁ ∪ H₂ ≤ H := + fun h₁ h₂ => union_le h₁ h₂ + let α' : Set π.S → Hypergraph α β := fun c => if c = c' then QB c ∪ QA else QB c + have hα'_notA : ∀ c ∈ π.Γ.C, ∀ v, v ∉ A.vertexSet → + (v ∈ (α' c).vertexSet ↔ v ∈ (π.cellGraph c).vertexSet) := by + intro c hc v hvA + dsimp only [α', QB, QA, quotientVertices, Union.union, Inter.inter] + split_ifs + · constructor + · rintro (⟨⟨hvc, _⟩, _⟩ | ⟨hvA', _⟩) + · exact hvc + · exact (hvA hvA').elim + · intro hvc + have hB := (hnotA_iff ((π.cellGraph_le c hc).1 hvc)).mp hvA + exact Or.inl ⟨⟨hvc, hB.1⟩, hB.2⟩ + · constructor + · exact fun ⟨⟨hvc, _⟩, _⟩ => hvc + · intro hvc + have hB := (hnotA_iff ((π.cellGraph_le c hc).1 hvc)).mp hvA + exact ⟨⟨hvc, hB.1⟩, hB.2⟩ + have hα'_other : ∀ {c₁ c₂ : Set π.S}, c₁ ∈ π.Γ.C → c₂ ∈ π.Γ.C → c₁ ≠ c₂ → + ∀ {v : α}, v ∈ (α' c₁).vertexSet → v ∈ (α' c₂).vertexSet → + v ∉ A.vertexSet ∧ v ∈ (π.cellGraph c₁).vertexSet ∧ v ∈ (π.cellGraph c₂).vertexSet := by + intro c₁ c₂ hc₁ hc₂ hne v hv₁ hv₂ + have hvnotA : v ∉ A.vertexSet := by + intro hvA + by_cases h₁ : c₁ = c' + · have h₂ : c₂ ≠ c' := fun h => hne (h₁.trans h.symm) + dsimp only [α'] at hv₂ + rw [ite_eq_right h₂] at hv₂ + exact hv₂.2 ⟨hvA, hv₂.1.2⟩ + · dsimp only [α'] at hv₁ + rw [ite_eq_right h₁] at hv₁ + exact hv₁.2 ⟨hvA, hv₁.1.2⟩ + exact ⟨hvnotA, (hα'_notA c₁ hc₁ v hvnotA).mp hv₁, (hα'_notA c₂ hc₂ v hvnotA).mp hv₂⟩ + exact + { S := π.S + top := π.top + isSurface := π.isSurface + connected := π.connected + Γ := π.Γ + cellGraph := α' + borderSet := fun n => π.borderSet n \ A.vertexSet + domγ := {n ∈ π.domγ | π.nodeVertex n ∉ A.vertexSet} + nodeVertex := π.nodeVertex + cellGraph_le := by + intro c hc + dsimp only [α'] + split_ifs + · exact hunion_le (hQB_le c hc) hQA_le + · exact hQB_le c hc + borderSet_subset := by + intro n hn v ⟨hvn, hvA⟩ + have hvG := π.borderSet_subset n hn hvn + exact ⟨hvG, ((hnotA_iff hvG).mp hvA).2⟩ + domγ_subset := fun n hn => π.domγ_subset hn.1 + nodeVertex_mem := by + intro n ⟨hn, hvA⟩ + have hvG := π.nodeVertex_mem n hn + exact ⟨hvG, ((hnotA_iff hvG).mp hvA).2⟩ + nodeVertex_injOn := π.nodeVertex_injOn.mono fun _ hn => hn.1 + p1_vertex := by + rintro v ⟨hvG, hvZ⟩ + by_cases hvA : v ∈ A.vertexSet + · refine ⟨c', hc', ?_⟩ + dsimp only [α'] + rw [ite_eq_left rfl] + exact Or.inr ⟨hvA, hvZ⟩ + · obtain ⟨c, hc, hvc⟩ := π.p1_vertex v hvG + exact ⟨c, hc, (hα'_notA c hc v hvA).mpr hvc⟩ + p1_edge := by + intro e heG + have heAB : e ∈ A.edgeSet ∪ B.edgeSet := hsep.edgeSet_union ▸ heG + rcases heAB with heA | heB + · refine ⟨c', hc', ?_⟩ + dsimp only [α'] + rw [ite_eq_left rfl] + exact Or.inr heA + · obtain ⟨c, hc, hec⟩ := π.p1_edge e heG + refine ⟨c, hc, ?_⟩ + dsimp only [α'] + split_ifs + · exact Or.inl ⟨hec, heB⟩ + · exact ⟨hec, heB⟩ + p1_disjoint := by + intro c₁ hc₁ c₂ hc₂ hne + refine Set.disjoint_left.mpr fun e he₁ he₂ => ?_ + have hdisjAB : Disjoint A.edgeSet B.edgeSet := + Set.disjoint_iff_inter_eq_empty.mpr hsep.edgeSet_inter_eq + dsimp only [α', QB, QA, quotientVertices, Union.union, Inter.inter] at he₁ he₂ + split_ifs at he₁ he₂ with h₁ h₂ + · exact hne (h₁.trans h₂.symm) + · rcases he₁ with ⟨hec₁, _⟩ | heA + · exact Set.disjoint_left.mp (π.p1_disjoint c₁ hc₁ c₂ hc₂ hne) hec₁ he₂.1 + · exact Set.disjoint_left.mp hdisjAB heA he₂.2 + · rcases he₂ with ⟨hec₂, _⟩ | heA + · exact Set.disjoint_left.mp (π.p1_disjoint c₁ hc₁ c₂ hc₂ hne) he₁.1 hec₂ + · exact Set.disjoint_left.mp hdisjAB heA he₁.2 + · exact Set.disjoint_left.mp (π.p1_disjoint c₁ hc₁ c₂ hc₂ hne) he₁.1 he₂.1 + p2 := by + intro c hc n ⟨hnt, hnγ, hvA⟩ + exact (hα'_notA c hc (π.nodeVertex n) hvA).mpr (π.p2 c hc n ⟨hnt, hnγ⟩) + p3_notMem := fun n ⟨⟨hnγ, _⟩, hnbd⟩ hmem => π.p3_notMem n ⟨hnγ, hnbd⟩ hmem.1 + p3_subset := by + intro c hc hbd n hnt v ⟨hvn, hvA⟩ + exact (hα'_notA c hc v hvA).mpr (π.p3_subset c hc hbd n hnt hvn) + p4_disjoint := fun Θ₁ hΘ₁ Θ₂ hΘ₂ hne n₁ hn₁ n₂ hn₂ => + (π.p4_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ hne n₁ hn₁ n₂ hn₂).mono sdiff_subset sdiff_subset + p4_notMem := fun Θ hΘ n₁ hn₁ n₂ hn₂ hn₂Θ hmem => + π.p4_notMem Θ hΘ n₁ hn₁ n₂ hn₂.1 hn₂Θ hmem.1 + p5 := by + intro c hc hbd v hv₁ ⟨c₂, hc₂, hne, hv₂⟩ + obtain ⟨hvA, hvc₁, hvc₂⟩ := hα'_other hc hc₂ hne.symm hv₁ hv₂ + obtain ⟨n, ⟨hnt, hnγ⟩, rfl⟩ := π.p5 c hc hbd v hvc₁ ⟨c₂, hc₂, hne, hvc₂⟩ + exact ⟨n, ⟨hnt, hnγ, hvA⟩, rfl⟩ + p6 := by + intro c hc hbd v hv₁ ⟨c₂, hc₂, hne, hv₂⟩ + obtain ⟨hvA, hvc₁, hvc₂⟩ := hα'_other hc hc₂ hne.symm hv₁ hv₂ + obtain ⟨n, hnt, hvn | ⟨hnγ, rfl⟩⟩ := π.p6 c hc hbd v hvc₁ ⟨c₂, hc₂, hne, hvc₂⟩ + · exact ⟨n, hnt, Or.inl ⟨hvn, hvA⟩⟩ + · exact ⟨n, hnt, Or.inr ⟨⟨hnγ, hvA⟩, rfl⟩⟩ + p7 := by + intro Θ hΘ n₁ hn₁ n₂ hn₂ n₃ hn₃ n₄ hn₄ hord v hv₁ hv₃ + have hvA : v ∉ A.vertexSet := by + rcases hv₁ with ⟨_, hvA⟩ | ⟨⟨_, hvA⟩, rfl⟩ <;> exact hvA + have hv₁' : v ∈ π.borderPlus n₁ := by + rcases hv₁ with ⟨hvn₁, _⟩ | ⟨⟨hn₁γ, _⟩, rfl⟩ + · exact Or.inl hvn₁ + · exact Or.inr ⟨hn₁γ, rfl⟩ + have hv₃' : v ∈ π.borderPlus n₃ := by + rcases hv₃ with ⟨hvn₃, _⟩ | ⟨⟨hn₃γ, _⟩, rfl⟩ + · exact Or.inl hvn₃ + · exact Or.inr ⟨hn₃γ, rfl⟩ + rcases π.p7 Θ hΘ n₁ hn₁ n₂ hn₂ n₃ hn₃ n₄ hn₄ hord v hv₁' hv₃' with + (hvn₂ | ⟨hn₂γ, rfl⟩) | (hvn₄ | ⟨hn₄γ, rfl⟩) + · exact Or.inl (Or.inl ⟨hvn₂, hvA⟩) + · exact Or.inl (Or.inr ⟨⟨hn₂γ, hvA⟩, rfl⟩) + · exact Or.inr (Or.inl ⟨hvn₄, hvA⟩) + · exact Or.inr (Or.inr ⟨⟨hn₄γ, hvA⟩, rfl⟩) } + +theorem Portrayal.restrictQuotient_borderPlus {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (A B : Hypergraph α β) (hsep : IsSeparation G A B) + (c' : Set π.S) (hc' : c' ∈ π.Γ.C) (n : π.S) : + (π.restrictQuotient A B hsep c' hc').borderPlus n = π.borderPlus n \ A.vertexSet := by + ext v + simp only [Portrayal.borderPlus, Portrayal.restrictQuotient, mem_ofPred_eq, mem_sdiff] + constructor + · rintro (⟨h, hvA⟩ | ⟨⟨hnγ, hvA⟩, rfl⟩) + · exact ⟨Or.inl h, hvA⟩ + · exact ⟨Or.inr ⟨hnγ, rfl⟩, hvA⟩ + · rintro ⟨h | ⟨hnγ, rfl⟩, hvA⟩ + · exact Or.inl ⟨h, hvA⟩ + · exact Or.inr ⟨⟨hnγ, hvA⟩, rfl⟩ + +theorem Portrayal.restrictQuotient_isCentral {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) (hT : π.IsCentral 𝒯) (hwarp : π.warp ≤ p) + {A B : Hypergraph α β} (hAB : (A, B) ∈ 𝒯) + (hZ_lt : (A.vertexSet ∩ B.vertexSet).ncard + max 3 (2 * p + 2) < θ) + (c' : Set π.S) (hc' : c' ∈ π.Γ.C) : + (π.restrictQuotient A B (h𝒯.isSeparation hAB) c' hc').IsCentral + (quotientTangle G 𝒯 (A.vertexSet ∩ B.vertexSet)) := by + classical + set Z := A.vertexSet ∩ B.vertexSet + have hsep := h𝒯.isSeparation hAB + have hZ_sub : Z ⊆ G.vertexSet := inter_subset_left.trans hsep.left_le.1 + have hTangle' : IsTangle (quotientVertices G Z) (θ - Z.ncard) (quotientTangle G 𝒯 Z) := + theorem_4_2_proof h𝒯 hZ_sub (by omega) + obtain ⟨hT_quot, _⟩ := theorem_6_2_proof h𝒯 π hT hwarp hZ_sub hZ_lt + have hQB_small : ∀ c ∈ π.Γ.C, + IsSmallWrt (quotientTangle G 𝒯 Z) (quotientVertices (π.cellGraph c ∩ B) Z) := by + intro c hc + have hsmall_c : IsSmallWrt (quotientTangle G 𝒯 Z) (quotientVertices (π.cellGraph c) Z) := by + have := hT_quot c hc + change IsSmallWrt (quotientTangle G 𝒯 Z) + (quotientVertices (π.cellGraph c) (Z ∩ (π.cellGraph c).vertexSet)) at this + rwa [quotientVertices_inter_vertexSet] at this + have hle : quotientVertices (π.cellGraph c ∩ B) Z ≤ quotientVertices (π.cellGraph c) Z := + quotientVertices_mono (inter_le_left (π.cellGraph_le c hc) hsep.right_le) Z + have hatt_le : (attachments (quotientVertices G Z) + (quotientVertices (π.cellGraph c ∩ B) Z)).ncard ≤ max 3 (2 * p + 2) := by + rw [attachments_quotientVertices] + have hsub_att : attachments G (π.cellGraph c ∩ B) \ Z ⊆ attachments G (π.cellGraph c) := by + rintro v ⟨⟨⟨hvc, hvB⟩, e, ⟨heG, he_not⟩, hinc⟩, hvZ⟩ + have heAB : e ∈ A.edgeSet ∪ B.edgeSet := hsep.edgeSet_union ▸ heG + have he_not_A : e ∉ A.edgeSet := by + intro heA + have hincA : A.Inc e v := (inc_iff_of_le hsep.left_le heA).2 hinc + exact hvZ ⟨A.vertex_mem_of_inc hincA, hvB⟩ + have heB : e ∈ B.edgeSet := heAB.resolve_left he_not_A + exact ⟨hvc, e, ⟨heG, fun hec => he_not ⟨hec, heB⟩⟩, hinc⟩ + exact (ncard_le_ncard hsub_att attachments_finite).trans + (π.ncard_attachments_cellGraph_le hwarp hc) + exact hsmall_c.mono hTangle' hle (by omega) + have hQA_small : IsSmallWrt (quotientTangle G 𝒯 Z) (quotientVertices A Z) := + ⟨quotientVertices B Z, IsSeparation.quotientVertices hsep Z, ⟨(A, B), hAB, subset_rfl, rfl, + rfl⟩⟩ + have hQA_att_empty : attachments (quotientVertices G Z) (quotientVertices A Z) = ∅ := by + rw [attachments_quotientVertices] + ext v + simp only [mem_sdiff, mem_empty_iff_false, iff_false, not_and, not_not] + intro hvAtt + exact attachments_subset_inter_of_isSeparation hsep hvAtt + intro c hc + change IsSmallWrt (quotientTangle G 𝒯 Z) (if c = c' then _ else _) + split_ifs + · refine (hQB_small c hc).union hTangle' hQA_small ?_ + have hsub := @attachments_union_subset α β (quotientVertices G Z) + (quotientVertices (π.cellGraph c ∩ B) Z) (quotientVertices A Z) + rw [hQA_att_empty, union_empty] at hsub + exact (ncard_le_ncard hsub attachments_finite).trans_lt + ((hQB_small c hc).ncard_attachments_lt hTangle') + · exact hQB_small c hc + +/-- Next index around `Fin k` for $k \ge 2$. -/ +def nextIdx {k : ℕ} (hk : 2 ≤ k) (i : Fin k) : Fin k := + cyclicSucc (by omega) i + +theorem nextIdx_ne_self {k : ℕ} (hk : 2 ≤ k) (i : Fin k) : nextIdx hk i ≠ i := + cyclicSucc_ne_self hk i + +/-- **Graph Minors XVII, proof of (6.6), Claim (1)** (page 176): +"For each $x \in X$ there is at most one $n \in N(\Gamma) \cap \Theta$ such that +$x \in \beta(n+)$ and $x \notin \beta(n'+)$ where $n'$ is the node of $N(\Gamma)$ bordering +$\Theta$ immediately following $n$." -/ +theorem lemma_6_6_claim_1 {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} {k : ℕ} (E : π.Γ.CuffEnumeration Θ k) + {x : α} {i₁ i₂ : Fin k} + (hi₁ : x ∈ π.borderPlus (E.node i₁) ∧ x ∉ π.borderPlus (E.node (nextIdx E.two_le i₁))) + (hi₂ : x ∈ π.borderPlus (E.node i₂) ∧ x ∉ π.borderPlus (E.node (nextIdx E.two_le i₂))) : + i₁ = i₂ := by + by_contra hne + have hk : 2 ≤ k := E.two_le + have v12 : i₁.1 ≠ i₂.1 := fun h => hne (Fin.ext h) + have b1 := i₁.2 + have b2 := i₂.2 + have hcyc : cyclicDist i₁ (nextIdx hk i₁) + cyclicDist (nextIdx hk i₁) i₂ + + cyclicDist i₂ (nextIdx hk i₂) ≤ k := by + have hnext1 : (nextIdx hk i₁).1 = if i₁.1 + 1 < k then i₁.1 + 1 else 0 := by + dsimp [nextIdx, cyclicSucc] + split_ifs with h + · exact Nat.mod_eq_of_lt h + · have : i₁.1 + 1 = k := by omega + rw [this, Nat.mod_self] + have hnext2 : (nextIdx hk i₂).1 = if i₂.1 + 1 < k then i₂.1 + 1 else 0 := by + dsimp [nextIdx, cyclicSucc] + split_ifs with h + · exact Nat.mod_eq_of_lt h + · have : i₂.1 + 1 = k := by omega + rw [this, Nat.mod_self] + simp only [cyclicDist_eq_ite, hnext1, hnext2] + split_ifs <;> omega + have hp7 := π.p7_of_cyclicDist E hcyc hi₁.1 hi₂.1 + rcases hp7 with h1 | h2 + · exact hi₁.2 h1 + · exact hi₂.2 h2 + +/-- **Graph Minors XVII, proof of (6.6), Claim (2)** (page 176): +"For each $n \in N(\Gamma) \cap \Theta$, if $|\beta(n)| = q$ then $W \cap \beta(n) \ne \emptyset$." +-/ +theorem lemma_6_6_claim_2 {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {Θ : Set π.S} (hΘ_bd : Θ ⊆ bd π.S) + {q : ℕ} {X : Set α} (hX : ∀ n ∈ π.Γ.N ∩ Θ, (X ∩ π.borderPlus n).Nonempty) + {z_fn : α → α} + (hz_spec : ∀ x ∈ X, ∀ n ∈ π.domγ ∩ bd π.S, x = π.nodeVertex n → (π.borderSet n).ncard = q → + z_fn x ∈ π.borderSet n) + {W : Set α} (hXW : X ⊆ W) (hzW : z_fn '' X ⊆ W) + {n : π.S} (hn : n ∈ π.Γ.N ∩ Θ) (hcard : (π.borderSet n).ncard = q) : + (W ∩ π.borderSet n).Nonempty := by + obtain ⟨x, hxX, hxn⟩ := hX n hn + rcases hxn with hxn_bs | ⟨hn_dom, rfl⟩ + · exact ⟨x, hXW hxX, hxn_bs⟩ + · exact ⟨z_fn (π.nodeVertex n), hzW ⟨π.nodeVertex n, hxX, rfl⟩, + hz_spec (π.nodeVertex n) hxX n ⟨hn_dom, hΘ_bd hn.2⟩ rfl hcard⟩ + +/-- **Graph Minors XVII, proof of (6.6), Claim (3)** (page 177): +"For each cell $c$ bordering $\Theta$ with ends $n_1, n_2 \in \operatorname{dom}(\gamma)$, if +$\gamma(n_1), \gamma(n_2) \notin W$ and $|\beta(n_1) - W| = |\beta(n_2) - W| = q - 1$ then +$W \cap \beta(n_1) \cap \beta(n_2) \ne \emptyset$." -/ +theorem lemma_6_6_claim_3 {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} {k : ℕ} (E : π.Γ.CuffEnumeration Θ k) + {X : Set α} (hX : ∀ n ∈ π.Γ.N ∩ Θ, (X ∩ π.borderPlus n).Nonempty) + {y_fn : α → α} + (hy_spec : ∀ x ∈ X, ∀ i : Fin k, + x ∈ π.borderPlus (E.node i) → x ∉ π.borderPlus (E.node (nextIdx E.two_le i)) → + E.node i ∈ π.domγ → y_fn x = π.nodeVertex (E.node i)) + {W : Set α} (hXW : X ⊆ W) (hyW : y_fn '' X ⊆ W) + {c : Set π.S} (hc : c ∈ π.Γ.C) (hcΘ : (c ∩ Θ).Nonempty) + {n₁ n₂ : π.S} (htilde : tilde c = {n₁, n₂}) + (hn₁_dom : n₁ ∈ π.domγ) (hn₂_dom : n₂ ∈ π.domγ) + (hn₁_notW : π.nodeVertex n₁ ∉ W) (hn₂_notW : π.nodeVertex n₂ ∉ W) : + (W ∩ π.borderSet n₁ ∩ π.borderSet n₂).Nonempty := by + have hc_range : c ∈ Set.range E.cell := by + rw [E.range_cell]; exact ⟨hc, hcΘ⟩ + rcases hc_range with ⟨i, rfl⟩ + let m₁ := E.node i + let m₂ := E.node (nextIdx E.two_le i) + have htilde_i : tilde (E.cell i) = {m₁, m₂} := E.cell_tilde i + have hpair_eq : ({m₁, m₂} : Set π.S) = {n₁, n₂} := htilde_i.symm.trans htilde + have hm₁_mem : m₁ ∈ ({n₁, n₂} : Set π.S) := hpair_eq ▸ mem_insert _ _ + have hm₂_mem : m₂ ∈ ({n₁, n₂} : Set π.S) := hpair_eq ▸ mem_insert_of_mem _ (mem_singleton _) + have hm₁_dom : m₁ ∈ π.domγ := by rcases hm₁_mem with h | h <;> exact h ▸ ‹_› + have hm₂_dom : m₂ ∈ π.domγ := by rcases hm₂_mem with h | h <;> exact h ▸ ‹_› + have hm₁_notW : π.nodeVertex m₁ ∉ W := by rcases hm₁_mem with h | h <;> exact h ▸ ‹_› + have hm₂_notW : π.nodeVertex m₂ ∉ W := by rcases hm₂_mem with h | h <;> exact h ▸ ‹_› + have hm₁_Θ : m₁ ∈ π.Γ.N ∩ Θ := by + rw [← E.range_node]; exact mem_range_self i + obtain ⟨x, hxX, hxm₁⟩ := hX m₁ hm₁_Θ + have hxW : x ∈ W := hXW hxX + have hx_bs₁ : x ∈ π.borderSet m₁ := by + rcases hxm₁ with h | ⟨_, rfl⟩ + · exact h + · exact (hm₁_notW hxW).elim + have hxm₂ : x ∈ π.borderPlus m₂ := by + by_contra hnot + have hy_eq := hy_spec x hxX i hxm₁ hnot hm₁_dom + exact hm₁_notW (hy_eq ▸ hyW ⟨x, hxX, rfl⟩) + have hx_bs₂ : x ∈ π.borderSet m₂ := by + rcases hxm₂ with h | ⟨_, rfl⟩ + · exact h + · exact (hm₂_notW hxW).elim + have h_inter_eq : π.borderSet m₁ ∩ π.borderSet m₂ = π.borderSet n₁ ∩ π.borderSet n₂ := by + have hm_ne : m₁ ≠ m₂ := E.injective_node.ne (nextIdx_ne_self E.two_le i).symm + rcases hm₁_mem with h₁ | h₁ <;> rcases hm₂_mem with h₂ | h₂ + · exact (hm_ne (h₁.trans h₂.symm)).elim + · rw [h₁, h₂] + · rw [h₁, h₂, Set.inter_comm] + · exact (hm_ne (h₁.trans h₂.symm)).elim + refine ⟨x, ?_⟩ + rw [Set.inter_assoc, ← h_inter_eq, ← Set.inter_assoc] + exact ⟨⟨hxW, hx_bs₁⟩, hx_bs₂⟩ + +/-- The discrete (edgeless) subhypergraph of $G$ on a vertex subset $W \subseteq V(G)$. -/ +@[expose] +def discreteSubhypergraph {α : Type u} {β : Type v} (G : Hypergraph α β) (W : Set α) + (hW : W ⊆ G.vertexSet) : Hypergraph α β where + vertexSet := W + edgeSet := ∅ + Inc _ _ := False + vertex_mem_of_inc _ _ h := h.elim + edge_mem_of_inc _ _ h := h.elim + vertexSet_finite := G.vertexSet_finite.subset hW + edgeSet_finite := finite_empty + +theorem IsTangle.discrete_mem {α : Type u} {β : Type v} {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) + {W : Set α} (hW : W ⊆ G.vertexSet) (hcard : W.ncard < θ) : + (discreteSubhypergraph G W hW, G) ∈ 𝒯 := by + let A := discreteSubhypergraph G W hW + have hA_le : A ≤ G := ⟨hW, empty_subset _, fun _ h => h.elim⟩ + have hsep : G.IsSeparation A G := by + rw [isSeparation_iff_of_le hA_le le_rfl] + exact ⟨union_eq_self_of_subset_left hW, empty_union _, empty_inter _⟩ + have hord : separationOrder A G < θ := by + change (W ∩ G.vertexSet).ncard < θ + rwa [inter_eq_self_of_subset_left hW] + have hGA_not : (G, A) ∉ 𝒯 := fun hGA => h𝒯.axiom3 hGA rfl + exact (h𝒯.axiom1 hsep hord).resolve_right hGA_not + +/-- Pure surface-and-painting topological property of a closed disc $\Delta \subseteq \Sigma$ +bounded by a $\Gamma$-normal $I$-arc $F$ (with ends $n_1, n_2$ on a cuff $\Theta$) and +$\operatorname{bd}(\Sigma)$: +(1) for every $c_1 \in C(\Gamma)$ with $c_1 \subseteq \Delta$ and every $c_2 \in C(\Gamma)$ with + $c_2 \not\subseteq \Delta$, $\tilde{c}_1 \cap \tilde{c}_2 \subseteq F$; +(2) there is a border cell $c_1 \in C(\Gamma)$ with $c_1 \subseteq \Delta$ and $n_1 \in +\tilde{c}_1$; + and +(3) for every node $n' \in N(\Gamma) \cap \Delta \cap \operatorname{bd}(\Sigma)$ and every cell + $c \in C(\Gamma)$ bordering $\Theta$ with $c \not\subseteq \Delta$ and $m \in \tilde{c}$, + $n' \in \Theta$ and $n_1, n', n_2, m$ are in order on $\Theta$. -/ +@[expose] def NormalIArcDiscPaintingStatement : Prop := + ∀ (S : Type) [TopologicalSpace S] [CompactSpace S] [T2Space S] [ConnectedSpace S], + IsSurface S → ∀ (Γ : Painting S) (F Δ : Set S) (Θ : Set S) (n₁ n₂ : S), + Γ.IsNormal F → IsLineWithEnds F n₁ n₂ → F ∩ bd S = {n₁, n₂} → + Θ ∈ cuffs S → n₁ ∈ Θ → n₂ ∈ Θ → + IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd S → + (∀ c₁ ∈ Γ.C, c₁ ⊆ Δ → ∀ c₂ ∈ Γ.C, ¬ c₂ ⊆ Δ → tilde c₁ ∩ tilde c₂ ⊆ F) ∧ + (∃ c₁ ∈ Γ.C, c₁ ⊆ Δ ∧ (c₁ ∩ bd S).Nonempty ∧ n₁ ∈ tilde c₁) ∧ + (∀ n' ∈ Γ.N ∩ Δ ∩ bd S, ∀ c ∈ Γ.C, (c ∩ Θ).Nonempty → ¬ c ⊆ Δ → ∀ m ∈ tilde c, + n' ∈ Θ ∧ GM19.InOrderOn Θ n₁ n' n₂ m) + +theorem Portrayal.cuff_eq_of_borderPlus_inter_nonempty {α : Type u} {β : Type v} + {G : Hypergraph α β} (π : Portrayal G) + {n₁ n₂ : π.S} (hn₁ : n₁ ∈ π.Γ.N ∩ bd π.S) (hn₂ : n₂ ∈ π.Γ.N ∩ bd π.S) + {v : α} (hv₁ : v ∈ π.borderPlus n₁) (hv₂ : v ∈ π.borderPlus n₂) : + ∃ Θ ∈ cuffs π.S, n₁ ∈ Θ ∧ n₂ ∈ Θ := by + let Θ₁ := connectedComponentIn (bd π.S) n₁ + let Θ₂ := connectedComponentIn (bd π.S) n₂ + have hΘ₁ : Θ₁ ∈ cuffs π.S := ⟨n₁, hn₁.2, rfl⟩ + have hΘ₂ : Θ₂ ∈ cuffs π.S := ⟨n₂, hn₂.2, rfl⟩ + have hn₁Θ₁ : n₁ ∈ Θ₁ := mem_connectedComponentIn hn₁.2 + have hn₂Θ₂ : n₂ ∈ Θ₂ := mem_connectedComponentIn hn₂.2 + refine ⟨Θ₁, hΘ₁, hn₁Θ₁, ?_⟩ + by_contra hn₂_not_Θ₁ + have hne : Θ₁ ≠ Θ₂ := fun h => hn₂_not_Θ₁ (h ▸ hn₂Θ₂) + have hn₁_not_Θ₂ : n₁ ∉ Θ₂ := fun h => hne (connectedComponentIn_eq h).symm + rcases hv₁ with hv₁ | ⟨hn₁γ, rfl⟩ <;> rcases hv₂ with hv₂ | ⟨hn₂γ, hEq⟩ + · exact Set.disjoint_left.mp (π.p4_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ hne n₁ ⟨hn₁.1, hn₁Θ₁⟩ n₂ ⟨hn₂.1, hn₂Θ₂⟩) + hv₁ hv₂ + · rw [hEq] at hv₁ + exact π.p4_notMem Θ₁ hΘ₁ n₁ ⟨hn₁.1, hn₁Θ₁⟩ n₂ hn₂γ hn₂_not_Θ₁ hv₁ + · exact π.p4_notMem Θ₂ hΘ₂ n₂ ⟨hn₂.1, hn₂Θ₂⟩ n₁ hn₁γ hn₁_not_Θ₂ hv₂ + · have := π.nodeVertex_injOn hn₁γ hn₂γ hEq + exact hn₂_not_Θ₁ (this ▸ hn₁Θ₁) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section6Proved.lean b/LeanPool/GraphMinor/GM17/Section6Proved.lean new file mode 100644 index 0000000000..95efddc016 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section6Proved.lean @@ -0,0 +1,1013 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section6 +import LeanPool.GraphMinor.GM17.Section5Proved + +public import LeanPool.GraphMinor.GM17.Section5 + +import LeanPool.GraphMinor.Surface.Cuffs + +import LeanPool.GraphMinor.GM17.ArcDisc + +import LeanPool.GraphMinor.GM17.CutArcPaint + +import LeanPool.GraphMinor.GM17.PasteCuff + +import LeanPool.GraphMinor.GM17.PushNode + +/-! +# Graph Minors XVII: proved deductions of Section6 + +The portrayal deductions use the existing painting proofs. The definitions and +independent geometric lemmas are imported from `Section6`. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +/-! ## 1. Quotient Hypergraphs and Graph Minors XVII, (6.1) (Page 174) -/ + +/-- **Graph Minors XVII, (6.3)** (page 174): +"Let $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a $z$-redundant $\mathscr{T}$-central +portrayal of $G$, with $warp \le p$. Let $ord(\mathscr{T}) > z + 2p + 2$, and let $F +\subseteq \Sigma$ be a $\Gamma$-normal $I$-arc with ends $n_1, n_2$ and with $|F \cap +dom(\gamma)| \le z - 2p$. Then there is a disc $\Delta \subseteq \Sigma$ with $F \subseteq +bd(\Delta) \subseteq F \cup bd(\Sigma)$ such that $\alpha(\Delta)$ is small." -/ +theorem theorem_6_3_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p z : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) (hT : π.IsCentral 𝒯) + (hwarp : π.warp ≤ p) (hred : π.IsRedundant 𝒯 θ z) + (hθ : z + max 3 (2 * p + 2) < θ) + {F : Set π.S} {n₁ n₂ : π.S} (hnorm : π.Γ.IsNormal F) + (hF : IsLineWithEnds F n₁ n₂) (hFbd : F ∩ bd π.S = {n₁, n₂}) + (hFγ_le : 2 * p ≤ z ∧ (F ∩ π.domγ).ncard ≤ z - 2 * p) : + ∃ Δ : Set π.S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd π.S ∧ + IsSmallWrt 𝒯 (π.areaGraph Δ) := by + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have hn₁_mem : n₁ ∈ F ∩ bd π.S := hFbd ▸ mem_insert _ _ + have hn₂_mem : n₂ ∈ F ∩ bd π.S := hFbd ▸ mem_insert_of_mem _ (mem_singleton _) + have hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S := + ⟨hnorm (show n₁ ∈ F ∩ π.Γ.U from ⟨hn₁_mem.1, π.Γ.bd_subset hn₁_mem.2⟩), hn₁_mem.2⟩ + have hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S := + ⟨hnorm (show n₂ ∈ F ∩ π.Γ.U from ⟨hn₂_mem.1, π.Γ.bd_subset hn₂_mem.2⟩), hn₂_mem.2⟩ + let Z : Set α := π.borderSet n₁ ∪ π.borderSet n₂ ∪ π.nodeVertex '' (F ∩ π.domγ) + have hZ_sub : Z ⊆ G.vertexSet := by + refine union_subset (union_subset (π.borderSet_subset n₁ hn₁_bd) (π.borderSet_subset n₂ + hn₂_bd)) ?_ + rintro _ ⟨n, ⟨_, hnγ⟩, rfl⟩ + exact π.nodeVertex_mem n hnγ + have hn₁_card : (π.borderSet n₁).ncard ≤ p := + (π.ncard_borderSet_le_warp hn₁_bd).trans hwarp + have hn₂_card : (π.borderSet n₂).ncard ≤ p := + (π.ncard_borderSet_le_warp hn₂_bd).trans hwarp + have hFγ_fin : (F ∩ π.domγ).Finite := + (π.Γ.finite_N.subset π.domγ_subset).inter_of_right F + have hZ_le : Z.ncard ≤ z := by + have h1 : Z.ncard ≤ (π.borderSet n₁ ∪ π.borderSet n₂).ncard + + (π.nodeVertex '' (F ∩ π.domγ)).ncard := ncard_union_le _ _ + have h2 : (π.borderSet n₁ ∪ π.borderSet n₂).ncard ≤ + (π.borderSet n₁).ncard + (π.borderSet n₂).ncard := ncard_union_le _ _ + have h3 : (π.nodeVertex '' (F ∩ π.domγ)).ncard ≤ (F ∩ π.domγ).ncard := + ncard_image_le hFγ_fin + omega + obtain ⟨hT', _, hred'⟩ := + π.quotientBy_resembles_and_isZeroRedundant h𝒯 hT hwarp hred hZ_sub hZ_le (by omega) + have hTangle' : IsTangle (quotientVertices G Z) (θ - Z.ncard) (quotientTangle G 𝒯 Z) := + theorem_4_2_proof h𝒯 hZ_sub (by omega) + have hβ₁' : (π.quotientBy Z).borderSet n₁ = ∅ := by + ext v + simp only [Portrayal.quotientBy, mem_sdiff, mem_empty_iff_false, iff_false, not_and, not_not] + exact fun hv => Or.inl (Or.inl hv) + have hβ₂' : (π.quotientBy Z).borderSet n₂ = ∅ := by + ext v + simp only [Portrayal.quotientBy, mem_sdiff, mem_empty_iff_false, iff_false, not_and, not_not] + exact fun hv => Or.inl (Or.inr hv) + have hFγ' : F ∩ (π.quotientBy Z).domγ = ∅ := by + ext n + simp only [Portrayal.quotientBy, mem_inter_iff, mem_ofPred_eq, mem_empty_iff_false, iff_false, + not_and, not_not] + exact fun hnF hnγ => Or.inr ⟨n, ⟨hnF, hnγ⟩, rfl⟩ + have : CompactSpace (π.quotientBy Z).S := (π.quotientBy Z).isSurface.1 + have : T2Space (π.quotientBy Z).S := (π.quotientBy Z).isSurface.2.1 + obtain ⟨Δ, hΔ, hF_bd, hbd_sub, hsmall'⟩ := + theorem_5_3_proof hTangle' (by omega) (π.quotientBy Z) hT' hred' + hnorm hF hFbd hβ₁' hβ₂' hFγ' + refine ⟨Δ, hΔ, hF_bd, hbd_sub, ?_⟩ + have hatt' := hsmall'.ncard_attachments_lt hTangle' + rw [π.quotientBy_areaGraph Z Δ] at hsmall' hatt' + exact (theorem_6_1_proof h𝒯 hZ_sub (by omega) (π.cellsUnion_le _) hatt').mpr hsmall' + +/-- **Graph Minors XVII, (6.4)** (page 175): +"Let $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a $z$-redundant $\mathscr{T}$-central +portrayal of $G$, with $warp \le p$. Let $ord(\mathscr{T}) > z + 2p + 2$, and let $F +\subseteq \Sigma$ be a $\Gamma$-normal $O$-arc with $|F \cap dom(\gamma)| \le z$. Then there +is a disc $\Delta \subseteq \Sigma$ with $bd(\Delta) = F$ such that $\alpha(\Delta)$ is +small." -/ +theorem theorem_6_4_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p z : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) (hT : π.IsCentral 𝒯) + (hwarp : π.warp ≤ p) (hred : π.IsRedundant 𝒯 θ z) + (hθ : z + max 3 (2 * p + 2) < θ) + {F : Set π.S} (hO : IsOArc F) (hnorm : π.Γ.IsNormal F) + (hFγ_le : (F ∩ π.domγ).ncard ≤ z) : + ∃ Δ : Set π.S, IsClosedDisc Δ ∧ discBd Δ = F ∧ + IsSmallWrt 𝒯 (π.areaGraph Δ) := by + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + let Z : Set α := π.nodeVertex '' (F ∩ π.domγ) + have hZ_sub : Z ⊆ G.vertexSet := by + rintro _ ⟨n, ⟨_, hnγ⟩, rfl⟩ + exact π.nodeVertex_mem n hnγ + have hFγ_fin : (F ∩ π.domγ).Finite := + (π.Γ.finite_N.subset π.domγ_subset).inter_of_right F + have hZ_le : Z.ncard ≤ z := + (ncard_image_le hFγ_fin).trans hFγ_le + obtain ⟨hT', _, hred'⟩ := + π.quotientBy_resembles_and_isZeroRedundant h𝒯 hT hwarp hred hZ_sub hZ_le (by omega) + have hTangle' : IsTangle (quotientVertices G Z) (θ - Z.ncard) (quotientTangle G 𝒯 Z) := + theorem_4_2_proof h𝒯 hZ_sub (by omega) + have hFγ' : F ∩ (π.quotientBy Z).domγ = ∅ := by + ext n + simp only [Portrayal.quotientBy, mem_inter_iff, mem_ofPred_eq, mem_empty_iff_false, iff_false, + not_and, not_not] + exact fun hnF hnγ => ⟨n, ⟨hnF, hnγ⟩, rfl⟩ + have : CompactSpace (π.quotientBy Z).S := (π.quotientBy Z).isSurface.1 + have : T2Space (π.quotientBy Z).S := (π.quotientBy Z).isSurface.2.1 + obtain ⟨Δ, hΔ, hbd_eq, hsmall'⟩ := + theorem_5_4_proof hTangle' (by omega) (π.quotientBy Z) hT' hred' + hnorm hO hFγ' + refine ⟨Δ, hΔ, hbd_eq, ?_⟩ + have hatt' := hsmall'.ncard_attachments_lt hTangle' + rw [π.quotientBy_areaGraph Z Δ] at hsmall' hatt' + exact (theorem_6_1_proof h𝒯 hZ_sub (by omega) (π.cellsUnion_le _) hatt').mpr hsmall' + +/-! ## 3. Separation Restriction Portrayal and (6.5) (Pages 175–176) -/ + +private lemma walk_skeleton_mono {α : Type u} {β : Type v} + {H₁ H₂ : Hypergraph α β} (h : H₁ ≤ H₂) {u v : α} + (W : H₁.skeleton.Walk u v) : + ∃ W' : H₂.skeleton.Walk u v, W'.support = W.support := by + induction W with + | nil => exact ⟨.nil, rfl⟩ + | @cons u w v hadj W ih => + obtain ⟨W', hsupp⟩ := ih + rcases hadj with ⟨hne, e, heu, hew⟩ + have heH₁ : e ∈ H₁.edgeSet := H₁.edge_mem_of_inc heu + have hends := h.ends_eq e heH₁ + have heu' : H₂.Inc e u := by + change u ∈ H₂.ends e; rw [hends]; exact heu + have hew' : H₂.Inc e w := by + change w ∈ H₂.ends e; rw [hends]; exact hew + refine ⟨.cons ⟨hne, e, heu', hew'⟩ W', ?_⟩ + dsimp [SimpleGraph.Walk.support] + rw [hsupp] + +private lemma walk_skeleton_union_left_of_disjoint {α : Type u} {β : Type v} + {H₁ H₂ : Hypergraph α β} (hdisjV : Disjoint H₁.vertexSet H₂.vertexSet) + (hdisjE : Disjoint H₁.edgeSet H₂.edgeSet) + {u v : α} (hu : u ∈ H₁.vertexSet) (W : (H₁ ∪ H₂).skeleton.Walk u v) : + ∃ W' : H₁.skeleton.Walk u v, W'.support = W.support := by + induction W with + | nil => exact ⟨.nil, rfl⟩ + | @cons u w v hadj W ih => + rcases hadj with ⟨hne, e, heu, hew⟩ + have heu₁ : H₁.Inc e u := by + rcases heu with heu₁ | heu₂ + · exact heu₁ + · exact (Set.disjoint_left.mp hdisjV hu (H₂.vertex_mem_of_inc heu₂)).elim + have hew₁ : H₁.Inc e w := by + rcases hew with hew₁ | hew₂ + · exact hew₁ + · exact (Set.disjoint_left.mp hdisjE (H₁.edge_mem_of_inc heu₁) + (H₂.edge_mem_of_inc hew₂)).elim + have hw : w ∈ H₁.vertexSet := H₁.vertex_mem_of_inc hew₁ + obtain ⟨W', hsupp⟩ := ih hw + refine ⟨.cons ⟨hne, e, heu₁, hew₁⟩ W', ?_⟩ + dsimp [SimpleGraph.Walk.support] + rw [hsupp] + +private lemma walk_support_subset_vertexSet {α : Type u} {β : Type v} + {H : Hypergraph α β} {u v : α} (hu : u ∈ H.vertexSet) + (W : H.skeleton.Walk u v) : + {z | z ∈ W.support} ⊆ H.vertexSet := + fun _ hz => Hypergraph.skeleton_walk_support_subset_vertexSet W hu _ hz + +/-- Given a portrayal $\pi$ of $G$, a separation $(A, B)$ of $G$ with $Z = V(A \cap B)$, and a +cell $c' \in C(\Gamma)$, the portrayal $\pi' = (\Sigma, \Gamma, \alpha', \beta', \gamma')$ of +$G / Z$ constructed in the proof of (6.5) (page 175), where +$\alpha'(c') = ((\alpha(c') \cap B) / Z) \cup (A / Z)$, +$\alpha'(c) = (\alpha(c) \cap B) / Z$ for $c \ne c'$, +$\beta'(n) = \beta(n) \setminus V(A)$, and +$\gamma' = \gamma \mid \{n \in \operatorname{dom}(\gamma) : \gamma(n) \notin V(A)\}$. -/ +theorem Portrayal.restrictQuotient_walk_lift {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (A B : Hypergraph α β) (hsep : IsSeparation G A B) + (c' : Set π.S) (hc' : c' ∈ π.Γ.C) {c : Set π.S} (hc : c ∈ π.Γ.C) + {u v : α} (hu : u ∈ (π.cellGraph c).vertexSet \ A.vertexSet) + (W : ((π.restrictQuotient A B hsep c' hc').cellGraph c).skeleton.Walk u v) : + ∃ W' : (π.cellGraph c ∩ B).skeleton.Walk u v, + W'.support = W.support ∧ {z | z ∈ W'.support} ⊆ (π.cellGraph c).vertexSet \ A.vertexSet := by + classical + have huG : u ∈ G.vertexSet := (π.cellGraph_le c hc).1 hu.1 + have huAB : u ∈ A.vertexSet ∪ B.vertexSet := hsep.vertexSet_union ▸ huG + have huB : u ∈ B.vertexSet := huAB.resolve_left hu.2 + have huZ : u ∉ A.vertexSet ∩ B.vertexSet := fun hZ => hu.2 hZ.1 + have huQB : u ∈ (quotientVertices (π.cellGraph c ∩ B) (A.vertexSet ∩ B.vertexSet)).vertexSet := + ⟨⟨hu.1, huB⟩, huZ⟩ + have hW_QB : ∃ W₀ : (quotientVertices (π.cellGraph c ∩ B) (A.vertexSet ∩ + B.vertexSet)).skeleton.Walk u v, + W₀.support = W.support := by + by_cases hcc' : c = c' + · have hle : (π.restrictQuotient A B hsep c' hc').cellGraph c ≤ + quotientVertices (π.cellGraph c ∩ B) (A.vertexSet ∩ B.vertexSet) ∪ + quotientVertices A (A.vertexSet ∩ B.vertexSet) := by + change (if c = c' then _ else _) ≤ _ + rw [ite_eq_left hcc'] + obtain ⟨W₁, hsupp₁⟩ := walk_skeleton_mono hle W + have hdisjV : Disjoint + (quotientVertices (π.cellGraph c ∩ B) (A.vertexSet ∩ B.vertexSet)).vertexSet + (quotientVertices A (A.vertexSet ∩ B.vertexSet)).vertexSet := by + refine Set.disjoint_left.mpr fun x ⟨⟨_, hxB⟩, hxZ⟩ ⟨hxA, _⟩ => hxZ ⟨hxA, hxB⟩ + have hdisjE : Disjoint + (quotientVertices (π.cellGraph c ∩ B) (A.vertexSet ∩ B.vertexSet)).edgeSet + (quotientVertices A (A.vertexSet ∩ B.vertexSet)).edgeSet := by + have hdisjAB : Disjoint A.edgeSet B.edgeSet := + Set.disjoint_iff_inter_eq_empty.mpr hsep.edgeSet_inter_eq + refine Set.disjoint_left.mpr fun e ⟨_, heB⟩ heA => Set.disjoint_left.mp hdisjAB heA heB + obtain ⟨W₀, hsupp₀⟩ := walk_skeleton_union_left_of_disjoint hdisjV hdisjE huQB W₁ + exact ⟨W₀, hsupp₀.trans hsupp₁⟩ + · have hle : (π.restrictQuotient A B hsep c' hc').cellGraph c ≤ + quotientVertices (π.cellGraph c ∩ B) (A.vertexSet ∩ B.vertexSet) := by + change (if c = c' then _ else _) ≤ _ + rw [ite_eq_right hcc'] + exact walk_skeleton_mono hle W + obtain ⟨W₀, hsupp₀⟩ := hW_QB + have hsub_supp : {z | z ∈ W₀.support} ⊆ (π.cellGraph c).vertexSet \ A.vertexSet := by + intro z hz + have hzQB := walk_support_subset_vertexSet huQB W₀ hz + exact ⟨hzQB.1.1, fun hzA => hzQB.2 ⟨hzA, hzQB.1.2⟩⟩ + obtain ⟨W', hsupp'⟩ := walk_skeleton_of_quotientVertices W₀ + exact ⟨W', hsupp'.trans hsupp₀, fun z hz => hsub_supp (by rwa [← hsupp'])⟩ + +theorem Portrayal.restrictQuotient_cellWarp_le {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (A B : Hypergraph α β) (hsep : IsSeparation G A B) + (c' : Set π.S) (hc' : c' ∈ π.Γ.C) + {c : Set π.S} (hc : c ∈ π.Γ.C) (hbd : (c ∩ bd π.S).Nonempty) : + (π.restrictQuotient A B hsep c' hc').cellWarp c ≤ π.cellWarp c := by + apply Nat.sInf_le + intro n₁ hn₁ n₂ hn₂ hne + have hbp₁ := π.restrictQuotient_borderPlus A B hsep c' hc' n₁ + have hbp₂ := π.restrictQuotient_borderPlus A B hsep c' hc' n₂ + refine π.cellWarp_pair_of_walk_lift hc hbd hn₁ hn₂ hne sdiff_subset sdiff_subset ?_ ?_ ?_ + · rw [hbp₁] + exact sdiff_subset + · rw [hbp₂] + exact sdiff_subset + · intro a b ha W + have ha' : a ∈ π.borderPlus n₁ \ A.vertexSet := hbp₁ ▸ ha + have ha_cell : a ∈ (π.cellGraph c).vertexSet \ A.vertexSet := + ⟨π.borderPlus_subset_cellGraph hc hbd hn₁ ha'.1, ha'.2⟩ + obtain ⟨W₀, hsupp₀, _⟩ := π.restrictQuotient_walk_lift A B hsep c' hc' hc ha_cell W + have hle : π.cellGraph c ∩ B ≤ π.cellGraph c := + inter_le_left (π.cellGraph_le c hc) hsep.right_le + obtain ⟨W', hsupp'⟩ := walk_skeleton_mono hle W₀ + exact ⟨W', hsupp'.trans hsupp₀⟩ + +theorem Portrayal.restrictQuotient_warpAt_le {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (A B : Hypergraph α β) (hsep : IsSeparation G A B) + (c' : Set π.S) (hc' : c' ∈ π.Γ.C) {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) : + (π.restrictQuotient A B hsep c' hc').warpAt Θ ≤ π.warpAt Θ := by + refine ((π.restrictQuotient A B hsep c' hc').warpAt_le_iff (Θ := Θ)).mpr fun c hc hcΘ => ?_ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x + have hbd : (c ∩ bd π.S).Nonempty := hcΘ.mono (inter_subset_inter_right _ hΘ_bd) + exact (π.restrictQuotient_cellWarp_le A B hsep c' hc' hc hbd).trans (π.cellWarp_le_warpAt hc hcΘ) + +private theorem exists_not_cellWarpLE_pair + {α β : Type*} {G : Hypergraph α β} {p : ℕ} + (π : Portrayal G) (c : Set π.S) (hnot_le : ¬π.CellWarpLE c (p - 1)) : + ∃ m₁ ∈ tilde c, ∃ m₂ ∈ tilde c, m₁ ≠ m₂ ∧ + ¬((π.borderSet m₁).ncard ≤ p - 1 ∧ (π.borderSet m₂).ncard ≤ p - 1 ∧ + ((π.borderPlus m₁).ncard = p - 1 + 1 → (π.borderPlus m₂).ncard = p - 1 + 1 → + Portrayal.LinkagePairs (π.cellGraph c).skeleton (π.borderPlus m₁) (π.borderPlus m₂) + (p - 1 + 1) (π.nodeVertex m₁) (π.nodeVertex m₂))) := by + by_contra h_all + apply hnot_le + intro m₁ hm₁ m₂ hm₂ hm_ne + by_contra h_neg + exact h_all ⟨m₁, hm₁, m₂, hm₂, hm_ne, h_neg⟩ + +private theorem lift_restricted_linkage_paths + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {p : ℕ} + (π : Portrayal G) + {A : Hypergraph α β} + {B : Hypergraph α β} + (c' : Set π.S) + (hc' : c' ∈ π.Γ.C) + (hsep : G.IsSeparation A B) + (c : Set π.S) + (hc : c ∈ (π.restrictQuotient A B hsep c' hc').Γ.C) + (hbd : (c ∩ bd π.S).Nonempty) + (m₁ : π.S) + (hm₁_t : m₁ ∈ tilde c) + (m₂ : π.S) + (P : Fin p → PathFromTo ((π.restrictQuotient A B hsep c' hc').cellGraph c).skeleton + ((π.restrictQuotient A B hsep c' hc').borderPlus m₁) ((π.restrictQuotient A B hsep c' + hc').borderPlus m₂)) + (hbp₁ : (π.restrictQuotient A B hsep c' hc').borderPlus m₁ = π.borderPlus m₁ \ A.vertexSet) + (hbp₂ : (π.restrictQuotient A B hsep c' hc').borderPlus m₂ = π.borderPlus m₂ \ A.vertexSet) : + ∀ i : Fin p, ∃ Q : PathFromTo (π.cellGraph c).skeleton (π.borderPlus m₁) (π.borderPlus m₂), + Q.first = (P i).first ∧ Q.last = (P i).last ∧ Q.walk.support = (P i).walk.support ∧ + {z | z ∈ Q.walk.support} ⊆ (π.cellGraph c).vertexSet \ A.vertexSet := by + intro i + have hfirst_bp : (P i).first ∈ π.borderPlus m₁ \ A.vertexSet := + (Set.ext_iff.mp hbp₁ (P i).first).mp (P i).first_mem + have hlast_bp : (P i).last ∈ π.borderPlus m₂ \ A.vertexSet := + (Set.ext_iff.mp hbp₂ (P i).last).mp (P i).last_mem + have hfirst_c : (P i).first ∈ (π.cellGraph c).vertexSet \ A.vertexSet := + ⟨π.borderPlus_subset_cellGraph hc hbd hm₁_t hfirst_bp.1, hfirst_bp.2⟩ + obtain ⟨W₀, hsupp₀, hsub₀⟩ := + π.restrictQuotient_walk_lift A B hsep c' hc' hc hfirst_c (P i).walk + have hle_Bc : π.cellGraph c ∩ B ≤ π.cellGraph c := + inter_le_left (π.cellGraph_le c hc) hsep.right_le + obtain ⟨W', hsupp'⟩ := walk_skeleton_mono hle_Bc W₀ + have hsupp : W'.support = (P i).walk.support := hsupp'.trans hsupp₀ + have hisPath : W'.IsPath := by + rw [SimpleGraph.Walk.isPath_def, hsupp] + exact SimpleGraph.Walk.IsPath.support_nodup (P i).isPath + refine ⟨⟨(P i).first, (P i).last, W', hisPath, hfirst_bp.1, hlast_bp.1⟩, + rfl, rfl, hsupp, fun z hz => hsub₀ (by rwa [← hsupp'])⟩ + +private theorem disjoint_paths_with_one_extra {α : Type*} {g : SimpleGraph α} + {U V A : Set α} {p : ℕ} (Q : Fin p → PathFromTo g U V) + (Q_extra : PathFromTo g U V) + (hQ_disj : Pairwise fun i j => + Disjoint {z | z ∈ (Q i).walk.support} {z | z ∈ (Q j).walk.support}) + (hQ_sub : ∀ i, {z | z ∈ (Q i).walk.support} ⊆ Aᶜ) + (hQ_extra : {z | z ∈ Q_extra.walk.support} ⊆ A) : + let Q_all : Fin (p + 1) → PathFromTo g U V := + fun i => if h : i.1 < p then Q ⟨i.1, h⟩ else Q_extra + Pairwise fun i j => Disjoint {z | z ∈ (Q_all i).walk.support} + {z | z ∈ (Q_all j).walk.support} := by + dsimp only + intro i j hij + refine Set.disjoint_left.mpr fun z hzi hzj => ?_ + change z ∈ (if h : i.1 < p then Q ⟨i.1, h⟩ else Q_extra).walk.support at hzi + change z ∈ (if h : j.1 < p then Q ⟨j.1, h⟩ else Q_extra).walk.support at hzj + by_cases hi : i.1 < p <;> by_cases hj : j.1 < p + · rw [dite_eq_left hi] at hzi + rw [dite_eq_left hj] at hzj + have hij' : (⟨i.1, hi⟩ : Fin p) ≠ ⟨j.1, hj⟩ := + fun h => hij (Fin.ext (Fin.mk.inj_iff.mp h)) + exact Set.disjoint_left.mp (hQ_disj hij') hzi hzj + · rw [dite_eq_left hi] at hzi + rw [dite_eq_right hj] at hzj + exact hQ_sub ⟨i.1, hi⟩ hzi (hQ_extra hzj) + · rw [dite_eq_right hi] at hzi + rw [dite_eq_left hj] at hzj + exact hQ_sub ⟨j.1, hj⟩ hzj (hQ_extra hzi) + · exact hij (Fin.ext (by omega)) + +private theorem ncard_endsets_ge_of_disjoint_paths {α : Type*} {g : SimpleGraph α} + {U V : Set α} {p : ℕ} (Q : Fin p → PathFromTo g U V) + (hQ : Pairwise fun i j => + Disjoint {z | z ∈ (Q i).walk.support} {z | z ∈ (Q j).walk.support}) + (hU : U.Finite) (hV : V.Finite) : + p ≤ U.ncard ∧ p ≤ V.ncard := by + have cardinal (B : Set α) (hB : B.Finite) (f : Fin p → α) (hf : ∀ i, f i ∈ B) + (hsupp : ∀ i, f i ∈ (Q i).walk.support) : p ≤ B.ncard := by + have hinj : Injective f := by + intro i j h + by_contra hne + exact Set.disjoint_left.mp (hQ hne) (hsupp i) (h ▸ hsupp j) + have hcard : (range f).ncard = p := by + rw [ncard_range_of_injective hinj, Nat.card_eq_fintype_card, Fintype.card_fin] + exact hcard ▸ ncard_le_ncard (range_subset_iff.mpr hf) hB + exact ⟨cardinal U hU (fun i => (Q i).first) (fun i => (Q i).first_mem) + (fun i => (Q i).walk.start_mem_support), + cardinal V hV (fun i => (Q i).last) (fun i => (Q i).last_mem) + (fun i => (Q i).walk.end_mem_support)⟩ + +private theorem exists_borderSet_disjoint_of_sdiff_card + {α β : Type*} {G : Hypergraph α β} {π : Portrayal G} + {A : Hypergraph α β} {Θ : Set π.S} {p : ℕ} + (hΘ : Θ ∈ cuffs π.S) (hΘ_arc : IsOArc Θ) (hp : π.warpAt Θ = p) + (hΘ_bd : Θ ⊆ bd π.S) + (hcard : ∃ n ∈ π.Γ.N ∩ Θ, p ≤ (π.borderSet n \ A.vertexSet).ncard) : + ∃ n ∈ π.Γ.N ∩ Θ, (π.borderSet n).ncard = p ∧ Disjoint (π.borderSet n) A.vertexSet := by + obtain ⟨n, hn, hle⟩ := hcard + have hn_bd : n ∈ π.Γ.N ∩ bd π.S := ⟨hn.1, hΘ_bd hn.2⟩ + have hle_p : (π.borderSet n).ncard ≤ p := hp ▸ π.ncard_borderSet_le_warpAt hΘ hΘ_arc hn + have hsub_le : (π.borderSet n \ A.vertexSet).ncard ≤ (π.borderSet n).ncard := + ncard_le_ncard sdiff_subset (π.borderSet_finite hn_bd) + have h_eq : π.borderSet n \ A.vertexSet = π.borderSet n := + eq_of_subset_of_ncard_le sdiff_subset (by omega) (π.borderSet_finite hn_bd) + refine ⟨n, hn, by omega, Set.disjoint_left.mpr fun v hvn hvA => ?_⟩ + have hvn' : v ∈ π.borderSet n \ A.vertexSet := h_eq.symm ▸ hvn + exact hvn'.2 hvA + +/-- Vertex-support form of **Graph Minors XVII, (6.5)** (page 175). In case (ii), no walk $W$ of +$\alpha(c)^*$ between $\beta(n_1)$ and $\beta(n_2)$ has +vertex support lies in $V(A)$ (since the $p$ paths in $\alpha'(c) = (\alpha(c) \cap B)/Z$ lift to +$p$ disjoint paths in $\alpha(c)^*$ with vertex support in $V(\alpha(c)) \setminus V(A)$). -/ +theorem theorem_6_5_walk_subset + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ q p z : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) (hT : π.IsCentral 𝒯) + (hwarp : π.warp ≤ q) (hred : π.IsRedundant 𝒯 θ z) + (hθ : z + max 3 (2 * q + 2) < θ) + {A B : Hypergraph α β} (hAB : (A, B) ∈ 𝒯) (hord : separationOrder A B ≤ z) + {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (hp : π.warpAt Θ = p) : + (∃ n ∈ π.Γ.N ∩ Θ, (π.borderSet n).ncard = p ∧ Disjoint (π.borderSet n) A.vertexSet) ∨ + (∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ ∃ n₁ n₂ : π.S, n₁ ≠ n₂ ∧ tilde c = {n₁, n₂} ∧ + n₁ ∈ π.domγ ∧ n₂ ∈ π.domγ ∧ + π.nodeVertex n₁ ∉ A.vertexSet ∧ π.nodeVertex n₂ ∉ A.vertexSet ∧ + (∀ u ∈ π.borderSet n₁, ∀ v ∈ π.borderSet n₂, + ∀ W : (π.cellGraph c).skeleton.Walk u v, ¬ ({z | z ∈ W.support} ⊆ A.vertexSet)) ∧ + (π.borderSet n₁ \ A.vertexSet).ncard = p - 1 ∧ + (π.borderSet n₂ \ A.vertexSet).ncard = p - 1 ∧ 2 ≤ p) := by + classical + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have hΘ_arc : IsOArc Θ := (GraphMinor.Surface.cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x + have hp_pos : 1 ≤ p := by + rw [← hp] + exact theorem_5_1_proof π hT (hred.isZeroRedundant h𝒯) hΘ + obtain ⟨c', hc', hc'Θ, hc'warp⟩ := π.exists_cell_cellWarp_eq_warpAt hΘ hΘ_arc + set Z := A.vertexSet ∩ B.vertexSet + have hsep := h𝒯.isSeparation hAB + have hZ_sub : Z ⊆ G.vertexSet := inter_subset_left.trans hsep.left_le.1 + have hZ_le : (A.vertexSet ∩ B.vertexSet).ncard ≤ z := by + change (A ∩ B).vertexSet.ncard ≤ z + exact hord + let π' := π.restrictQuotient A B hsep c' hc' + have hT' : π'.IsCentral (quotientTangle G 𝒯 Z) := + π.restrictQuotient_isCentral h𝒯 hT hwarp hAB (by omega) c' hc' + have hnot_simp : ¬ π'.IsSimpler π := hred.2 Z hZ_sub hZ_le π' hT' + have hwarpAt_eq : π'.warpAt Θ = p := by + have hEq := Portrayal.warpAt_eq_of_warpAt_le_of_not_isSimpler (π' := π') (π := π) + (Homeomorph.refl π.S) + (fun Φ hΦ => by + have hle := π.restrictQuotient_warpAt_le A B hsep c' hc' hΦ + have himg : (Homeomorph.refl π.S : π.S → π.S) '' Φ = Φ := image_id Φ + change π'.warpAt Φ ≤ π.warpAt ((Homeomorph.refl π.S : π.S → π.S) '' Φ) + rw [himg] + exact hle) + hnot_simp Θ hΘ + have himg : (Homeomorph.refl π.S : π.S → π.S) '' Θ = Θ := image_id Θ + change π'.warpAt Θ = π.warpAt ((Homeomorph.refl π.S : π.S → π.S) '' Θ) at hEq + rw [himg, hp] at hEq + exact hEq + by_cases hcase1 : ∃ n ∈ π.Γ.N ∩ Θ, p ≤ (π.borderSet n \ A.vertexSet).ncard + · exact Or.inl (exists_borderSet_disjoint_of_sdiff_card hΘ hΘ_arc hp hΘ_bd hcase1) + · refine Or.inr ?_ + have hcase1' : ∀ n ∈ π.Γ.N ∩ Θ, (π.borderSet n \ A.vertexSet).ncard < p := by + intro n hn + exact Nat.lt_of_not_ge fun hge => hcase1 ⟨n, hn, hge⟩ + obtain ⟨c : Set π.S, hc, hcΘ, hcw'⟩ := π'.exists_cell_cellWarp_eq_warpAt hΘ hΘ_arc + rw [hwarpAt_eq] at hcw' + have hbd : (c ∩ bd π.S).Nonempty := hcΘ.mono (inter_subset_inter_right _ hΘ_bd) + have htilde_Θ : tilde c ⊆ π.Γ.N ∩ Θ := (π.Γ.border_cell_subset_cuff hc hΘ hcΘ).2.2.2.1 + obtain ⟨n₁, n₂, hne, htilde, _, _, hn₁_bd, hn₂_bd⟩ := π.Γ.border_cell_exists_ends hc hbd + have hn₁_t : n₁ ∈ tilde c := htilde ▸ mem_insert _ _ + have hn₂_t : n₂ ∈ tilde c := htilde ▸ mem_insert_of_mem _ (mem_singleton _) + have hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ := htilde_Θ hn₁_t + have hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ := htilde_Θ hn₂_t + have hnot_le : ¬ π'.CellWarpLE c (p - 1) := by + intro hle + have := (π'.cellWarp_le_iff hc hbd).mpr hle + omega + have hm_exists : ∃ m₁ ∈ tilde c, ∃ m₂ ∈ tilde c, m₁ ≠ m₂ ∧ + ¬ ((π'.borderSet m₁).ncard ≤ p - 1 ∧ (π'.borderSet m₂).ncard ≤ p - 1 ∧ + ((π'.borderPlus m₁).ncard = p - 1 + 1 → (π'.borderPlus m₂).ncard = p - 1 + 1 → + Portrayal.LinkagePairs (π'.cellGraph c).skeleton (π'.borderPlus m₁) (π'.borderPlus m₂) + (p - 1 + 1) (π'.nodeVertex m₁) (π'.nodeVertex m₂))) := by + exact exists_not_cellWarpLE_pair π' c hnot_le + obtain ⟨m₁ : π.S, hm₁_t, m₂ : π.S, hm₂_t, hm_ne, hm_cond⟩ := hm_exists + have hsub_eq : p - 1 + 1 = p := Nat.sub_add_cancel hp_pos + rw [hsub_eq] at hm_cond + have hm₁_Θ : m₁ ∈ π.Γ.N ∩ Θ := htilde_Θ hm₁_t + have hm₂_Θ : m₂ ∈ π.Γ.N ∩ Θ := htilde_Θ hm₂_t + have hm₁_bd : m₁ ∈ π.Γ.N ∩ bd π.S := ⟨hm₁_Θ.1, hΘ_bd hm₁_Θ.2⟩ + have hm₂_bd : m₂ ∈ π.Γ.N ∩ bd π.S := ⟨hm₂_Θ.1, hΘ_bd hm₂_Θ.2⟩ + have hm₁_lt : (π'.borderSet m₁).ncard ≤ p - 1 := by + have := hcase1' m₁ hm₁_Θ + change (π.borderSet m₁ \ A.vertexSet).ncard ≤ p - 1 + omega + have hm₂_lt : (π'.borderSet m₂).ncard ≤ p - 1 := by + have := hcase1' m₂ hm₂_Θ + change (π.borderSet m₂ \ A.vertexSet).ncard ≤ p - 1 + omega + have hm_not_link : ¬ ((π'.borderPlus m₁).ncard = p → + (π'.borderPlus m₂).ncard = p → + Portrayal.LinkagePairs (π'.cellGraph c).skeleton (π'.borderPlus m₁) (π'.borderPlus m₂) + p (π'.nodeVertex m₁) (π'.nodeVertex m₂)) := + fun h => hm_cond ⟨hm₁_lt, hm₂_lt, h⟩ + have hm_link_ex : (π'.borderPlus m₁).ncard = p ∧ + (π'.borderPlus m₂).ncard = p ∧ + ∃ (P : Fin p → PathFromTo (π'.cellGraph c).skeleton + (π'.borderPlus m₁) (π'.borderPlus m₂)), + (Pairwise fun i j => + Disjoint {z | z ∈ (P i).walk.support} {z | z ∈ (P j).walk.support}) ∧ + ∀ i : Fin p, + (P i).first = π'.nodeVertex m₁ → (P i).last ≠ π'.nodeVertex m₂ := by + by_contra h_neg + apply hm_not_link + intro h1 h2 P hP_disj + by_contra h_no_i + apply h_neg + refine ⟨h1, h2, P, hP_disj, fun i hfirst hlast => h_no_i ⟨i, hfirst, hlast⟩⟩ + obtain ⟨hbp₁_eq, hbp₂_eq, P, hP_disj, hP_not_pair⟩ := hm_link_ex + have hm₁_dom' : m₁ ∈ π'.domγ := by + by_contra hnot + rw [π'.ncard_borderPlus_of_notMem_domγ hnot] at hbp₁_eq + omega + have hm₂_dom' : m₂ ∈ π'.domγ := by + by_contra hnot + rw [π'.ncard_borderPlus_of_notMem_domγ hnot] at hbp₂_eq + omega + have hm₁_card : (π.borderSet m₁ \ A.vertexSet).ncard = p - 1 := by + have := π'.ncard_borderPlus_of_mem_domγ hm₁_dom' hm₁_bd.2 + change (π'.borderPlus m₁).ncard = (π.borderSet m₁ \ A.vertexSet).ncard + 1 at this + omega + have hm₂_card : (π.borderSet m₂ \ A.vertexSet).ncard = p - 1 := by + have := π'.ncard_borderPlus_of_mem_domγ hm₂_dom' hm₂_bd.2 + change (π'.borderPlus m₂).ncard = (π.borderSet m₂ \ A.vertexSet).ncard + 1 at this + omega + have hp_ge2 : 2 ≤ p := by + by_contra hlt + have hp1 : p = 1 := by omega + subst hp1 + have hbp₁_sing : π'.borderPlus m₁ = {π'.nodeVertex m₁} := by + have hempty : π'.borderSet m₁ = ∅ := + (ncard_eq_zero ((π.borderSet_finite hm₁_bd).subset sdiff_subset)).mp hm₁_card + rw [π'.borderPlus_eq_insert hm₁_dom', hempty, insert_empty_eq] + have hbp₂_sing : π'.borderPlus m₂ = {π'.nodeVertex m₂} := by + have hempty : π'.borderSet m₂ = ∅ := + (ncard_eq_zero ((π.borderSet_finite hm₂_bd).subset sdiff_subset)).mp hm₂_card + rw [π'.borderPlus_eq_insert hm₂_dom', hempty, insert_empty_eq] + have hfirst0 : (P ⟨0, Nat.zero_lt_one⟩).first = π'.nodeVertex m₁ := + mem_singleton_iff.mp (hbp₁_sing ▸ (P ⟨0, Nat.zero_lt_one⟩).first_mem) + have hlast0 : (P ⟨0, Nat.zero_lt_one⟩).last = π'.nodeVertex m₂ := + mem_singleton_iff.mp (hbp₂_sing ▸ (P ⟨0, Nat.zero_lt_one⟩).last_mem) + exact hP_not_pair ⟨0, Nat.zero_lt_one⟩ hfirst0 hlast0 + have htilde_m : tilde c = {m₁, m₂} := by + have h1 : m₁ ∈ ({n₁, n₂} : Set π.S) := htilde ▸ hm₁_t + have h2 : m₂ ∈ ({n₁, n₂} : Set π.S) := htilde ▸ hm₂_t + refine htilde.trans ?_ + rcases h1 with rfl | rfl <;> rcases h2 with rfl | rfl + · exact (hm_ne rfl).elim + · rfl + · exact Set.pair_comm _ _ + · exact (hm_ne rfl).elim + refine ⟨c, hc, hcΘ, m₁, m₂, hm_ne, htilde_m, hm₁_dom'.1, hm₂_dom'.1, hm₁_dom'.2, hm₂_dom'.2, + ?_, hm₁_card, hm₂_card, hp_ge2⟩ + intro u₀ hu₀ v₀ hv₀ W_c hW_sub + let W_cp := W_c.toPath.1 + have hW_cp_path : W_cp.IsPath := W_c.toPath.2 + have hW_cp_supp_A : {z | z ∈ W_cp.support} ⊆ A.vertexSet := + fun z hz => hW_sub (SimpleGraph.Walk.support_toPath_subset_support W_c hz) + let Q_extra : PathFromTo (π.cellGraph c).skeleton (π.borderPlus m₁) (π.borderPlus m₂) := + ⟨u₀, v₀, W_cp, hW_cp_path, Or.inl hu₀, Or.inl hv₀⟩ + have hbp₁ := π.restrictQuotient_borderPlus A B hsep c' hc' m₁ + have hbp₂ := π.restrictQuotient_borderPlus A B hsep c' hc' m₂ + have hlift_linkage : ∀ i : Fin p, + ∃ Q : PathFromTo (π.cellGraph c).skeleton (π.borderPlus m₁) (π.borderPlus m₂), + Q.first = (P i).first ∧ Q.last = (P i).last ∧ + Q.walk.support = (P i).walk.support ∧ + {z | z ∈ Q.walk.support} ⊆ (π.cellGraph c).vertexSet \ A.vertexSet := by + exact lift_restricted_linkage_paths (α := α) (β := β) (G := G) (p := p) π (A := A) (B := B) + c' hc' hsep c hc hbd m₁ hm₁_t m₂ P hbp₁ hbp₂ + choose Q hQ_first hQ_last hQ_supp hQ_sub using hlift_linkage + let Q_all : Fin (p + 1) → + PathFromTo (π.cellGraph c).skeleton (π.borderPlus m₁) (π.borderPlus m₂) := + fun i => if h : i.1 < p then Q ⟨i.1, h⟩ else Q_extra + have hQ_all_disj : Pairwise fun i j => + Disjoint {z | z ∈ (Q_all i).walk.support} {z | z ∈ (Q_all j).walk.support} := by + apply disjoint_paths_with_one_extra Q Q_extra _ _ hW_cp_supp_A + · intro i j hij + simpa only [hQ_supp] using hP_disj hij + · exact fun i _ hz => (hQ_sub i hz).2 + obtain ⟨hbp₁_ge, hbp₂_ge⟩ := + ncard_endsets_ge_of_disjoint_paths Q_all hQ_all_disj + (π.borderPlus_finite hm₁_bd) (π.borderPlus_finite hm₂_bd) + have hcw_le_p : π.cellWarp c ≤ p := hp ▸ π.cellWarp_le_warpAt hc hcΘ + have hspec_c := (π.cellWarp_le_iff hc hbd).mp hcw_le_p m₁ hm₁_t m₂ hm₂_t hm_ne + have hbp₁_le : (π.borderPlus m₁).ncard ≤ p + 1 := + (π.ncard_borderPlus_le hm₁_bd).trans (Nat.add_le_add_right hspec_c.1 1) + have hbp₂_le : (π.borderPlus m₂).ncard ≤ p + 1 := + (π.ncard_borderPlus_le hm₂_bd).trans (Nat.add_le_add_right hspec_c.2.1 1) + obtain ⟨i, hfirst_i, hlast_i⟩ := + hspec_c.2.2 (by omega) (by omega) Q_all hQ_all_disj + dsimp only [Q_all] at hfirst_i hlast_i + split_ifs at hfirst_i hlast_i with hi + · exact hP_not_pair ⟨i.1, hi⟩ + ((hQ_first ⟨i.1, hi⟩).symm.trans hfirst_i) + ((hQ_last ⟨i.1, hi⟩).symm.trans hlast_i) + · have hu₀_A : u₀ ∈ A.vertexSet := hW_cp_supp_A W_cp.start_mem_support + exact hm₁_dom'.2 (hfirst_i ▸ hu₀_A) + +/-- **Graph Minors XVII, (6.5)** (page 175): +"Let $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a $z$-redundant $\mathscr{T}$-central +portrayal of a hypergraph $G$ with $warp \le q$, let $(A, B) \in \mathscr{T}$ have order +$\le z$, let $\Theta$ be a cuff of $\Sigma$, and let $\pi$ have warp $p$ at $\Theta$. Let +$ord(\mathscr{T}) > z + 2q + 2$. Then there exists either* (i) *a node $n$ bordering +$\Theta$ with $|\beta(n)| = p$ and $\beta(n) \cap V(A) = \emptyset$, or* (ii) *a cell $c$ +bordering $\Theta$ with ends $n_1, n_2 \in dom(\gamma)$, such that $\gamma(n_1), \gamma(n_2) +\notin V(A)$, there is no path of $(A \cap \alpha(c))^*$ between $\beta(n_1)$ and +$\beta(n_2)$, and* $$|\beta(n_1) - V(A)| = |\beta(n_2) - V(A)| = p - 1 \ge 1.$$" -/ +theorem theorem_6_5_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ q p z : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) (hT : π.IsCentral 𝒯) + (hwarp : π.warp ≤ q) (hred : π.IsRedundant 𝒯 θ z) + (hθ : z + max 3 (2 * q + 2) < θ) + {A B : Hypergraph α β} (hAB : (A, B) ∈ 𝒯) (hord : separationOrder A B ≤ z) + {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (hp : π.warpAt Θ = p) : + (∃ n ∈ π.Γ.N ∩ Θ, (π.borderSet n).ncard = p ∧ Disjoint (π.borderSet n) A.vertexSet) ∨ + (∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ ∃ n₁ n₂ : π.S, n₁ ≠ n₂ ∧ tilde c = {n₁, n₂} ∧ + n₁ ∈ π.domγ ∧ n₂ ∈ π.domγ ∧ + π.nodeVertex n₁ ∉ A.vertexSet ∧ π.nodeVertex n₂ ∉ A.vertexSet ∧ + (∀ u ∈ (A ∩ π.cellGraph c).vertexSet ∩ π.borderSet n₁, + ∀ v ∈ (A ∩ π.cellGraph c).vertexSet ∩ π.borderSet n₂, + IsEmpty ((A ∩ π.cellGraph c).skeleton.Walk u v)) ∧ + (π.borderSet n₁ \ A.vertexSet).ncard = p - 1 ∧ + (π.borderSet n₂ \ A.vertexSet).ncard = p - 1 ∧ 2 ≤ p) := by + rcases theorem_6_5_walk_subset h𝒯 π hT hwarp hred hθ hAB hord hΘ hp with + hnode | ⟨c, hc, hcΘ, n₁, n₂, hne, ht, hd₁, hd₂, hv₁, hv₂, hwalk, hc₁, hc₂, hp₂⟩ + · exact Or.inl hnode + · refine Or.inr ⟨c, hc, hcΘ, n₁, n₂, hne, ht, hd₁, hd₂, hv₁, hv₂, ?_, hc₁, hc₂, hp₂⟩ + intro u hu v hv + refine ⟨fun W => ?_⟩ + have hsep := h𝒯.isSeparation hAB + have hle : A ∩ π.cellGraph c ≤ π.cellGraph c := + inter_le_right hsep.left_le (π.cellGraph_le c hc) + obtain ⟨W', hsupp⟩ := walk_skeleton_mono hle W + apply hwalk u hu.2 v hv.2 W' + intro z hz + rw [hsupp] at hz + exact (walk_support_subset_vertexSet hu.1 W hz).1 + +/-! ## 4. Hitting All Border-Plus Sets on a Cuff: (6.6) (Pages 176–177) -/ + +/-- **Graph Minors XVII, (6.6)** (page 176): +"Let $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a $z$-redundant $\mathscr{T}$-central +portrayal of $G$ with $warp \le p$ and $ord(\mathscr{T}) > z + 2p + 2$, and let $\Theta$ be +a cuff. There is no $X \subseteq V(G)$ with $|X| \le z/3$ such that $X \cap \beta(n+) \ne +\emptyset$ for every node $n$ bordering $\Theta$." -/ +theorem theorem_6_6_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p z : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) (hT : π.IsCentral 𝒯) + (hwarp : π.warp ≤ p) (hred : π.IsRedundant 𝒯 θ z) + (hθ : z + max 3 (2 * p + 2) < θ) + {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) + {X : Set α} (hX_sub : X ⊆ G.vertexSet) (hX_card : 3 * X.ncard ≤ z) : + ¬ (∀ n ∈ π.Γ.N ∩ Θ, (X ∩ π.borderPlus n).Nonempty) := by + classical + intro hX + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have hΘ_arc : IsOArc Θ := (GraphMinor.Surface.cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + obtain ⟨E⟩ := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + set k := (π.Γ.N ∩ Θ).ncard + set q := π.warpAt Θ with hq_def + have hq_pos : 1 ≤ q := + theorem_5_1_proof π hT (hred.isZeroRedundant h𝒯) hΘ + let y_fn : α → α := fun x => + if h : ∃ i : Fin k, + x ∈ π.borderPlus (E.node i) ∧ + x ∉ π.borderPlus (E.node (nextIdx E.two_le i)) ∧ + E.node i ∈ π.domγ then + π.nodeVertex (E.node (Classical.choose h)) + else x + have hy_spec : ∀ x ∈ X, ∀ i : Fin k, + x ∈ π.borderPlus (E.node i) → x ∉ π.borderPlus (E.node (nextIdx E.two_le i)) → + E.node i ∈ π.domγ → y_fn x = π.nodeVertex (E.node i) := by + intro x _ i hx₁ hx₂ hdom + have hex : ∃ j : Fin k, + x ∈ π.borderPlus (E.node j) ∧ + x ∉ π.borderPlus (E.node (nextIdx E.two_le j)) ∧ + E.node j ∈ π.domγ := ⟨i, hx₁, hx₂, hdom⟩ + dsimp only [y_fn] + rw [dite_eq_left hex] + have hspec := Classical.choose_spec hex + have hij := lemma_6_6_claim_1 π E ⟨hspec.1, hspec.2.1⟩ ⟨hx₁, hx₂⟩ + rw [hij] + let z_fn : α → α := fun x => + if h : ∃ n ∈ π.domγ ∩ bd π.S, x = π.nodeVertex n ∧ (π.borderSet n).ncard = q then + have hne : (π.borderSet (Classical.choose h)).Nonempty := by + have hspec := Classical.choose_spec h + have hfin : (π.borderSet (Classical.choose h)).Finite := + π.borderSet_finite ⟨π.domγ_subset hspec.1.1, hspec.1.2⟩ + exact (ncard_pos hfin).mp (by omega) + Classical.choose hne + else x + have hz_spec : ∀ x ∈ X, ∀ n ∈ π.domγ ∩ bd π.S, x = π.nodeVertex n → + (π.borderSet n).ncard = q → z_fn x ∈ π.borderSet n := by + intro x _ n hdom hEq hcard + have hex : ∃ m ∈ π.domγ ∩ bd π.S, x = π.nodeVertex m ∧ (π.borderSet m).ncard = q := + ⟨n, hdom, hEq, hcard⟩ + dsimp only [z_fn] + rw [dite_eq_left hex] + have hspec := Classical.choose_spec hex + have hmn : Classical.choose hex = n := + π.nodeVertex_injOn hspec.1.1 hdom.1 (hspec.2.1.symm.trans hEq) + have hfin : (π.borderSet (Classical.choose hex)).Finite := + π.borderSet_finite ⟨π.domγ_subset hspec.1.1, hspec.1.2⟩ + have hne : (π.borderSet (Classical.choose hex)).Nonempty := + (ncard_pos hfin).mp (by omega) + exact hmn ▸ Classical.choose_spec hne + let W : Set α := X ∪ y_fn '' X ∪ z_fn '' X + have hXW : X ⊆ W := subset_union_left.trans subset_union_left + have hyW : y_fn '' X ⊆ W := subset_union_right.trans subset_union_left + have hzW : z_fn '' X ⊆ W := subset_union_right + have hW_sub : W ⊆ G.vertexSet := by + refine union_subset (union_subset hX_sub ?_) ?_ + · rintro _ ⟨x, hxX, rfl⟩ + dsimp only [y_fn] + split_ifs with h + · exact π.nodeVertex_mem _ (Classical.choose_spec h).2.2 + · exact hX_sub hxX + · rintro _ ⟨x, hxX, rfl⟩ + dsimp only [z_fn] + split_ifs with h + · have hspec := Classical.choose_spec h + have hfin : (π.borderSet (Classical.choose h)).Finite := + π.borderSet_finite ⟨π.domγ_subset hspec.1.1, hspec.1.2⟩ + have hne : (π.borderSet (Classical.choose h)).Nonempty := + (ncard_pos hfin).mp (by omega) + exact π.borderSet_subset _ ⟨π.domγ_subset hspec.1.1, hspec.1.2⟩ + (Classical.choose_spec hne) + · exact hX_sub hxX + have hX_fin : X.Finite := G.vertexSet_finite.subset hX_sub + have hW_card : W.ncard ≤ z := by + have h1 : W.ncard ≤ (X ∪ y_fn '' X).ncard + (z_fn '' X).ncard := ncard_union_le _ _ + have h2 : (X ∪ y_fn '' X).ncard ≤ X.ncard + (y_fn '' X).ncard := ncard_union_le _ _ + have h3 : (y_fn '' X).ncard ≤ X.ncard := ncard_image_le hX_fin + have h4 : (z_fn '' X).ncard ≤ X.ncard := ncard_image_le hX_fin + omega + let A := discreteSubhypergraph G W hW_sub + have hAG_mem : (A, G) ∈ 𝒯 := IsTangle.discrete_mem h𝒯 hW_sub (by omega) + have hord_AG : separationOrder A G ≤ z := by + unfold separationOrder + have hEq : (A ∩ G).vertexSet = W := inter_eq_self_of_subset_left hW_sub + rw [hEq] + exact hW_card + rcases theorem_6_5_proof h𝒯 π hT hwarp hred hθ hAG_mem hord_AG hΘ rfl with + ⟨n, hn, hcard, hdisj⟩ | + ⟨c, hc, hcΘ, n₁, n₂, _, htilde, hn₁_dom, hn₂_dom, hn₁_notW, hn₂_notW, hno_walk, _, _, _⟩ + · obtain ⟨w, hwW, hwn⟩ := lemma_6_6_claim_2 π hΘ_bd hX hz_spec hXW hzW hn hcard + exact Set.disjoint_left.mp hdisj hwn hwW + · obtain ⟨x, ⟨hxW, hxn₁⟩, hxn₂⟩ := + lemma_6_6_claim_3 π E hX hy_spec hXW hyW hc hcΘ htilde hn₁_dom hn₂_dom hn₁_notW hn₂_notW + have hbd : (c ∩ bd π.S).Nonempty := hcΘ.mono (inter_subset_inter_right _ hΘ_bd) + have hn₁_t : n₁ ∈ tilde c := htilde ▸ mem_insert _ _ + have hxc : x ∈ (π.cellGraph c).vertexSet := π.p3_subset c hc hbd n₁ hn₁_t hxn₁ + have hxAc : x ∈ (A ∩ π.cellGraph c).vertexSet := ⟨hxW, hxc⟩ + exact (hno_walk x ⟨hxAc, hxn₁⟩ x ⟨hxAc, hxn₂⟩).false .nil + +/-! ## 5. Disc Cut by a Normal $I$-Arc and (6.7) (Pages 177–178) -/ + +/-- **Graph Minors XVII, (6.7)** (page 177): +"Let $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a $z$-redundant $\mathscr{T}$-central +portrayal of $G$ with $warp \le p$. Let $ord(\mathscr{T}) > z + 2p + 2$, and let $F$ be a +$\Sigma$-normal $I$-arc with ends $n_1, n_2$ and with $|F \cap dom(\gamma)| \le z - 2p - 1$. Let +$\Delta$ be as in (6.3). Then $\beta(n_1 +) \cap \beta(n_2 +) \subseteq \beta(n+)$ for all $n \in +N(\Gamma) \cap \Delta \cap bd(\Sigma)$." (The paper writes "$\Sigma$-normal" for +"$\Gamma$-normal".) -/ +theorem theorem_6_7_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p z : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) (hT : π.IsCentral 𝒯) + (hwarp : π.warp ≤ p) (hred : π.IsRedundant 𝒯 θ z) + (hθ : z + max 3 (2 * p + 2) < θ) + {F Δ : Set π.S} {n₁ n₂ : π.S} (hnorm : π.Γ.IsNormal F) + (hF : IsLineWithEnds F n₁ n₂) (hFbd : F ∩ bd π.S = {n₁, n₂}) + (hFγ_le : 2 * p + 1 ≤ z ∧ (F ∩ π.domγ).ncard ≤ z - 2 * p - 1) + (hΔ : IsClosedDisc Δ) (hF_bd : F ⊆ discBd Δ) (hbd_sub : discBd Δ ⊆ F ∪ bd π.S) + (hsmall : IsSmallWrt 𝒯 (π.areaGraph Δ)) + {n' : π.S} (hn' : n' ∈ π.Γ.N ∩ Δ ∩ bd π.S) : + π.borderPlus n₁ ∩ π.borderPlus n₂ ⊆ π.borderPlus n' := by + classical + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have : ConnectedSpace π.S := π.connected + rintro v ⟨hv₁, hv₂⟩ + by_contra hvn' + have hn₁_mem : n₁ ∈ F ∩ bd π.S := hFbd ▸ mem_insert _ _ + have hn₂_mem : n₂ ∈ F ∩ bd π.S := hFbd ▸ mem_insert_of_mem _ (mem_singleton _) + have hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S := + ⟨hnorm (show n₁ ∈ F ∩ π.Γ.U from ⟨hn₁_mem.1, π.Γ.bd_subset hn₁_mem.2⟩), hn₁_mem.2⟩ + have hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S := + ⟨hnorm (show n₂ ∈ F ∩ π.Γ.U from ⟨hn₂_mem.1, π.Γ.bd_subset hn₂_mem.2⟩), hn₂_mem.2⟩ + obtain ⟨Θ, hΘ, hn₁Θ, hn₂Θ⟩ := π.cuff_eq_of_borderPlus_inter_nonempty hn₁_bd hn₂_bd hv₁ hv₂ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + obtain ⟨hsep_F, ⟨c₁, hc₁, hc₁Δ, hc₁bd, hn₁_c₁⟩, hord_Θ⟩ := + GraphMinor.GM17.normalIArcDiscPainting π.S π.isSurface π.Γ F Δ Θ n₁ n₂ hnorm hF hFbd hΘ hn₁Θ + hn₂Θ hΔ hF_bd hbd_sub + set q := π.warpAt Θ + have hq_pos : 1 ≤ q := + theorem_5_1_proof π hT (hred.isZeroRedundant h𝒯) hΘ + let I₁ := {c ∈ π.Γ.C | c ⊆ Δ} + let I₂ := π.Γ.C \ I₁ + have hI₁_sub : I₁ ⊆ π.Γ.C := fun _ hc => hc.1 + have hsep_I : ∀ d₁ ∈ I₁, ∀ d₂ ∈ I₂, tilde d₁ ∩ tilde d₂ ⊆ F := + fun d₁ hd₁ d₂ hd₂ => hsep_F d₁ hd₁.1 hd₁.2 d₂ hd₂.1 (fun h => hd₂.2 ⟨hd₂.1, h⟩) + have hatt_sub : attachments G (π.areaGraph Δ) ⊆ + π.borderSet n₁ ∪ π.borderSet n₂ ∪ π.nodeVertex '' (F ∩ π.domγ) := by + intro w hw + have hw_inter : w ∈ (π.cellsUnion I₁ ∩ π.cellsUnion I₂).vertexSet := by + rcases hw with ⟨hw₁, e, ⟨heG, he_not₁⟩, hew⟩ + obtain ⟨c₂, hc₂, hec₂⟩ := π.p1_edge e heG + have hc₂_I₂ : c₂ ∈ I₂ := + ⟨hc₂, fun hc₂_I₁ => he_not₁ (mem_biUnion ⟨hc₂_I₁, hc₂⟩ hec₂)⟩ + have hwc₂ : w ∈ (π.cellGraph c₂).vertexSet := by + have hends := (π.cellGraph_le c₂ hc₂).3 e hec₂ + exact (π.cellGraph c₂).vertex_mem_of_inc + (by change w ∈ (π.cellGraph c₂).ends e; rw [← hends]; exact hew) + exact ⟨hw₁, mem_biUnion ⟨hc₂_I₂, hc₂⟩ hwc₂⟩ + have hcov : I₁ ∪ I₂ = π.Γ.C := union_sdiff_cancel hI₁_sub + have hdisj_I : Disjoint I₁ I₂ := disjoint_sdiff_self_right + have h21_eq := (theorem_2_1_proof π hcov hdisj_I).2 + rw [h21_eq] at hw_inter + rcases hw_inter with hw_γ | hw_β + · rw [mem_iUnion₂] at hw_γ + rcases hw_γ with ⟨d₁, hd₁, hw_γ⟩ + rw [mem_iUnion₂] at hw_γ + rcases hw_γ with ⟨d₂, hd₂, hw_γ⟩ + rw [← π.gammaImage_inter, Portrayal.mem_gammaImage_iff] at hw_γ + rcases hw_γ with ⟨n, ⟨hnd, hnγ⟩, rfl⟩ + have hnF : n ∈ F := hsep_I d₁ hd₁ d₂ hd₂ hnd + exact Or.inr ⟨n, ⟨hnF, hnγ⟩, rfl⟩ + · rw [mem_iUnion₂] at hw_β + rcases hw_β with ⟨n, ⟨d₁, hd₁, _, d₂, hd₂, hbd₂, hnd⟩, hwn⟩ + have hnF : n ∈ F := hsep_I d₁ hd₁ d₂ hd₂ hnd + obtain ⟨u₂, v₂, _, htilde₂, _, _, hu₂, hv₂⟩ := π.Γ.border_cell_exists_ends hd₂.1 hbd₂ + have hn_uv : n ∈ ({u₂, v₂} : Set π.S) := htilde₂ ▸ hnd.2 + have hnbd : n ∈ bd π.S := by rcases hn_uv with rfl | rfl <;> exact ‹n ∈ π.Γ.N ∩ bd π.S›.2 + have hn_pair : n ∈ ({n₁, n₂} : Set π.S) := hFbd ▸ ⟨hnF, hnbd⟩ + rcases hn_pair with rfl | rfl + · exact Or.inl (Or.inl hwn) + · exact Or.inl (Or.inr hwn) + have hn₁_card : (π.borderSet n₁).ncard ≤ p := + (π.ncard_borderSet_le_warp hn₁_bd).trans hwarp + have hn₂_card : (π.borderSet n₂).ncard ≤ p := + (π.ncard_borderSet_le_warp hn₂_bd).trans hwarp + have hFγ_fin : (F ∩ π.domγ).Finite := + (π.Γ.finite_N.subset π.domγ_subset).inter_of_right F + have hatt_le : (attachments G (π.areaGraph Δ)).ncard ≤ z - 1 := by + have hfin_u : (π.borderSet n₁ ∪ π.borderSet n₂ ∪ π.nodeVertex '' (F ∩ π.domγ)).Finite := + ((π.borderSet_finite hn₁_bd).union (π.borderSet_finite hn₂_bd)).union (hFγ_fin.image _) + have h0 := ncard_le_ncard hatt_sub hfin_u + have h1 := ncard_union_le (π.borderSet n₁ ∪ π.borderSet n₂) (π.nodeVertex '' (F ∩ π.domγ)) + have h2 := ncard_union_le (π.borderSet n₁) (π.borderSet n₂) + have h3 := ncard_image_le (f := π.nodeVertex) hFγ_fin + omega + have hv_in_Δ : v ∈ (π.areaGraph Δ).vertexSet := by + have hvc₁ : v ∈ (π.cellGraph c₁).vertexSet := + π.borderPlus_subset_cellGraph hc₁ hc₁bd hn₁_c₁ hv₁ + exact mem_biUnion ⟨⟨hc₁, hc₁Δ⟩, hc₁⟩ hvc₁ + have hvG : v ∈ G.vertexSet := (π.cellsUnion_le I₁).1 hv_in_Δ + let u : α := + if h : ∃ n ∈ π.Γ.N ∩ Θ ∩ π.domγ, π.nodeVertex n = v ∧ (π.borderSet n).Nonempty then + Classical.choose (Classical.choose_spec h).2.2 + else v + have huG : u ∈ G.vertexSet := by + dsimp only [u] + split_ifs with h + · have hspec := Classical.choose_spec h + exact π.borderSet_subset _ ⟨hspec.1.1.1, hΘ_bd hspec.1.1.2⟩ + (Classical.choose_spec hspec.2.2) + · exact hvG + let Hu := discreteSubhypergraph G {u} (singleton_subset_iff.mpr huG) + have hHu_small : IsSmallWrt 𝒯 Hu := + ⟨G, IsTangle.discrete_mem h𝒯 (singleton_subset_iff.mpr huG) (by simp; omega)⟩ + let A := π.areaGraph Δ ∪ Hu + have hvA : v ∈ A.vertexSet := Or.inl hv_in_Δ + have huA : u ∈ A.vertexSet := Or.inr (mem_singleton u) + have hA_le_G : A ≤ G := by + have h1 := π.cellsUnion_le I₁ + have h2 : Hu ≤ G := ⟨singleton_subset_iff.mpr huG, empty_subset _, fun _ h => h.elim⟩ + exact union_le h1 h2 + have hatt_A_le : (attachments G A).ncard ≤ z := by + have hsub : attachments G A ⊆ attachments G (π.areaGraph Δ) ∪ {u} := by + rintro w ⟨hwΔ | rfl, e, ⟨heG, he_not⟩, hinc⟩ + · exact Or.inl ⟨hwΔ, e, ⟨heG, fun heΔ => he_not (Or.inl heΔ)⟩, hinc⟩ + · exact Or.inr (mem_singleton u) + have h0 := ncard_le_ncard hsub (attachments_finite.union (finite_singleton u)) + have h1 := ncard_union_le (attachments G (π.areaGraph Δ)) {u} + have h2 : ({u} : Set α).ncard = 1 := ncard_singleton u + omega + have hsmall_A : IsSmallWrt 𝒯 A := by + refine hsmall.union h𝒯 hHu_small ?_ + change (attachments G A).ncard < θ + omega + let B := complSubhypergraph G A + have hsep_AB : G.IsSeparation A B := isSeparation_complSubhypergraph hA_le_G + have hord_AB : separationOrder A B ≤ z := by + rw [separationOrder_complSubhypergraph] + exact hatt_A_le + have hAB : (A, B) ∈ 𝒯 := theorem_4_1_i h𝒯 hsmall_A hsep_AB (by omega) + rcases theorem_6_5_proof h𝒯 π hT hwarp hred hθ hAB hord_AB hΘ rfl with + ⟨n, hn, hcard, hdisj⟩ | + ⟨c, hc, hcΘ, m₁, m₂, _, htilde, hm₁_dom, hm₂_dom, hm₁_notA, hm₂_notA, hno_walk, _, _, _⟩ + · have hΘ_arc : IsOArc Θ := (GraphMinor.Surface.cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + obtain ⟨E⟩ := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + have hn_range : n ∈ Set.range E.node := by rw [E.range_node]; exact hn + rcases hn_range with ⟨i, rfl⟩ + let c := E.cell i + have hc_range : c ∈ {d ∈ π.Γ.C | (d ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self i + have hbd_c : (c ∩ bd π.S).Nonempty := hc_range.2.mono (inter_subset_inter_right _ hΘ_bd) + have hn_t : E.node i ∈ tilde c := by + rw [E.cell_tilde i]; exact mem_insert _ _ + have hn_bd : E.node i ∈ π.Γ.N ∩ bd π.S := ⟨hn.1, hΘ_bd hn.2⟩ + have hbs_ne : (π.borderSet (E.node i)).Nonempty := + (ncard_pos (π.borderSet_finite hn_bd)).mp (by omega) + have hc_not_Δ : ¬ c ⊆ Δ := by + intro hcΔ + obtain ⟨w, hwn⟩ := hbs_ne + have hwc : w ∈ (π.cellGraph c).vertexSet := + π.p3_subset c hc_range.1 hbd_c (E.node i) hn_t hwn + have hwA : w ∈ A.vertexSet := Or.inl (mem_biUnion ⟨⟨hc_range.1, hcΔ⟩, hc_range.1⟩ hwc) + exact Set.disjoint_left.mp hdisj hwn hwA + obtain ⟨hn'Θ, hord⟩ := hord_Θ n' hn' c hc_range.1 hc_range.2 hc_not_Δ (E.node i) hn_t + have hvn : v ∈ π.borderPlus (E.node i) := by + have hp7 := π.p7 Θ hΘ n₁ ⟨hn₁_bd.1, hn₁Θ⟩ n' ⟨hn'.1.1, hn'Θ⟩ + n₂ ⟨hn₂_bd.1, hn₂Θ⟩ (E.node i) hn hord v hv₁ hv₂ + exact hp7.resolve_left hvn' + rcases hvn with hvn_bs | ⟨hn_dom, hEq_v⟩ + · exact Set.disjoint_left.mp hdisj hvn_bs hvA + · have hex : ∃ m ∈ π.Γ.N ∩ Θ ∩ π.domγ, + π.nodeVertex m = v ∧ (π.borderSet m).Nonempty := + ⟨E.node i, ⟨hn, hn_dom⟩, hEq_v.symm, hbs_ne⟩ + have hu_mem : u ∈ π.borderSet (E.node i) := by + dsimp only [u] + rw [dite_eq_left hex] + have hspec := Classical.choose_spec hex + have hmi : Classical.choose hex = E.node i := + π.nodeVertex_injOn hspec.1.2 hn_dom (hspec.2.1.trans hEq_v) + exact hmi ▸ Classical.choose_spec hspec.2.2 + exact Set.disjoint_left.mp hdisj hu_mem huA + · have hm₁_t : m₁ ∈ tilde c := htilde ▸ mem_insert _ _ + have hm₂_t : m₂ ∈ tilde c := htilde ▸ mem_insert_of_mem _ (mem_singleton _) + have htilde_Θ : tilde c ⊆ π.Γ.N ∩ Θ := (π.Γ.border_cell_subset_cuff hc hΘ hcΘ).2.2.2.1 + have hm₁_Θ : m₁ ∈ π.Γ.N ∩ Θ := htilde_Θ hm₁_t + have hm₂_Θ : m₂ ∈ π.Γ.N ∩ Θ := htilde_Θ hm₂_t + have hc_not_Δ : ¬ c ⊆ Δ := by + intro hcΔ + have hvc : π.nodeVertex m₁ ∈ (π.cellGraph c).vertexSet := π.p2 c hc m₁ ⟨hm₁_t, hm₁_dom⟩ + exact hm₁_notA (Or.inl (mem_biUnion ⟨⟨hc, hcΔ⟩, hc⟩ hvc)) + obtain ⟨hn'Θ, hord₁⟩ := hord_Θ n' hn' c hc hcΘ hc_not_Δ m₁ hm₁_t + obtain ⟨_, hord₂⟩ := hord_Θ n' hn' c hc hcΘ hc_not_Δ m₂ hm₂_t + have hvm₁ : v ∈ π.borderPlus m₁ := + (π.p7 Θ hΘ n₁ ⟨hn₁_bd.1, hn₁Θ⟩ n' ⟨hn'.1.1, hn'Θ⟩ + n₂ ⟨hn₂_bd.1, hn₂Θ⟩ m₁ hm₁_Θ hord₁ v hv₁ hv₂).resolve_left hvn' + have hvm₂ : v ∈ π.borderPlus m₂ := + (π.p7 Θ hΘ n₁ ⟨hn₁_bd.1, hn₁Θ⟩ n' ⟨hn'.1.1, hn'Θ⟩ + n₂ ⟨hn₂_bd.1, hn₂Θ⟩ m₂ hm₂_Θ hord₂ v hv₁ hv₂).resolve_left hvn' + have hvm₁_bs : v ∈ π.borderSet m₁ := by + rcases hvm₁ with h | ⟨_, rfl⟩ + · exact h + · exact (hm₁_notA hvA).elim + have hvm₂_bs : v ∈ π.borderSet m₂ := by + rcases hvm₂ with h | ⟨_, rfl⟩ + · exact h + · exact (hm₂_notA hvA).elim + have hbd_c : (c ∩ bd π.S).Nonempty := hcΘ.mono (inter_subset_inter_right _ hΘ_bd) + have hvc : v ∈ (π.cellGraph c).vertexSet := π.p3_subset c hc hbd_c m₁ hm₁_t hvm₁_bs + have hvAc : v ∈ (A ∩ π.cellGraph c).vertexSet := ⟨hvA, hvc⟩ + exact (hno_walk v ⟨hvAc, hvm₁_bs⟩ v ⟨hvAc, hvm₂_bs⟩).false .nil + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section7.lean b/LeanPool/GraphMinor/GM17/Section7.lean new file mode 100644 index 0000000000..7d1de543f5 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section7.lean @@ -0,0 +1,2449 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section6 +public import LeanPool.GraphMinor.Surface.DiscsInSurface + +import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.DiscGrow + +/-! +# Graph Minors XVII, Section 7: Some Constructions + +This file formalizes Section 7 (pages 178–181) of Robertson and Seymour, *Graph Minors. XVII. +Taming a Vortex*, J. Combin. Theory Ser. B 77 (1999), 162–210: + +- **Disc-in-surface painting lemmas**: For any closed disc $\Delta \subseteq \Sigma$ in a surface + $\Sigma$, $\Delta \setminus \operatorname{bd}(\Delta)$ is open in $\Sigma$ and disjoint from + $\operatorname{bd}(\Sigma)$. If $\operatorname{bd}(\Delta)$ is $\Gamma$-normal, every cell of + $\Gamma$ lies either in $\Delta \setminus \operatorname{bd}(\Delta)$ or in $\Sigma \setminus + \Delta$, + every border cell lies in $\Sigma \setminus \Delta$, and every node in + $\operatorname{bd}(\Delta) \cap N(\Gamma)$ lies in $\overline{\Sigma \setminus \Delta}$. +- **(7.1)** (`theorem_7_1_proof`, page 178) uses disc removal and cell merging to construct a + central, resembling portrayal when the normal disc has at most one boundary node. +- **(7.2)** (`theorem_7_2_proof`, page 178) uses internal cell replacement to construct a central, + resembling portrayal when the normal disc has at most three boundary nodes. The Lean premises + include tangle order greater than three and cell incidence for each marked boundary node. +- **(7.3)** (`theorem_7_3_proof` in `Section7Proved`, pages 178–180). If $F \subseteq \Sigma$ is + a $\Gamma$-normal $I$-arc + with ends $n_1, n_2 \in \Theta$ and $F \cap N(\Gamma) = \{n_1, n_2\}$, $\Delta \subseteq \Sigma$ + is a disc with $F \subseteq \operatorname{bd}(\Delta) \subseteq F \cup \Theta$, + $\beta(n_1+) \cap \beta(n_2+) \subseteq \beta(n+)$ for all $n \in N(\Gamma) \cap + \operatorname{bd}(\Delta)$, + $\pi$ has warp $\le p$ at $\Theta$, and $|\beta(n_1+)| = |\beta(n_2+)| = p + 1$, then every + linkage in $\alpha(\Delta)$ from $\beta(n_1+)$ to $\beta(n_2+)$ pairs $\gamma(n_1)$ with + $\gamma(n_2)$. +- **(7.4)** (`theorem_7_4_proof` in `Section7Proved`, pages 180–181) uses border cell replacement. + The disc lies between a normal $I$-arc with two nodes and the surface boundary. The result gives + a central, resembling portrayal. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology Metric +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +/-! ## 1. Discs and Normal Boundaries in Paintings -/ + +section DiscNormalLemmas + +variable {S : Type} [TopologicalSpace S] + +/-- In a surface $S$, for any closed disc $\Delta \subseteq S$, the interior +$\Delta \setminus \operatorname{discBd} \Delta$ is open in $S$ and consists of interior points of +$S$ (hence is disjoint from $\operatorname{bd} S$). -/ +theorem isOpen_and_disjoint_bd_of_isClosedDisc (hS : IsSurface S) {Δ : Set S} + (hΔ : IsClosedDisc Δ) : + IsOpen (Δ \ discBd Δ) ∧ Disjoint (Δ \ discBd Δ) (bd S) ∧ + Δ ∩ bd S ⊆ discBd Δ ∧ Δ \ discBd Δ ⊆ interior Δ ∧ frontier Δ ⊆ discBd Δ := by + have : T2Space S := hS.2.1 + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + obtain ⟨hunion, hdisj⟩ := c.union_ball + have hdiff_eq : Δ \ discBd Δ = g '' ball 0 1 := by + ext x + constructor + · rintro ⟨hxΔ, hxbd⟩ + rw [← hunion] at hxΔ + exact hxΔ.resolve_right hxbd + · intro hx + exact ⟨hunion ▸ Or.inl hx, Set.disjoint_left.mp hdisj hx⟩ + have hopen_ball : IsOpen (g '' ball 0 1) := c.isOpen_image_ball hS.2.2 + have hopen : IsOpen (Δ \ discBd Δ) := hdiff_eq ▸ hopen_ball + obtain ⟨e₁, -⟩ := exists_homeomorph_image (c.gc.mono ball_subset_closedBall) + (c.hc.mono (c.g_subset ball_subset_closedBall)) (c.hg.mono ball_subset_closedBall) + obtain ⟨e₂⟩ := exists_homeomorph_ball (0 : ℂ) one_pos + have hdisj_bd : Disjoint (Δ \ discBd Δ) (bd S) := by + rw [hdiff_eq] + exact Set.disjoint_left.mpr fun x hx hxbd => + hxbd ⟨g '' ball 0 1, hopen_ball, hx, ⟨e₁.symm.trans e₂⟩⟩ + have hbd_sub : Δ ∩ bd S ⊆ discBd Δ := fun x ⟨hxΔ, hxbd⟩ => by + by_contra hx + exact Set.disjoint_left.mp hdisj_bd ⟨hxΔ, hx⟩ hxbd + have hint : Δ \ discBd Δ ⊆ interior Δ := interior_maximal sdiff_subset hopen + have hcl : closure Δ = Δ := (isClosed_of_isClosedDisc hΔ).closure_eq + have hfr : frontier Δ ⊆ discBd Δ := by + intro x ⟨hxcl, hxint⟩ + rw [hcl] at hxcl + by_contra hx + exact hxint (hint ⟨hxcl, hx⟩) + exact ⟨hopen, hdisj_bd, hbd_sub, hint, hfr⟩ + +/-- In a surface $S$, no point $x \in \operatorname{discBd} \Delta$ with $x \notin \operatorname{bd} +S$ +lies in $\operatorname{interior} \Delta$; consequently $x \in \overline{S \setminus \Delta}$. -/ +theorem mem_closure_compl_of_mem_discBd_not_bd {Δ : Set S} + (hΔ : IsClosedDisc Δ) {x : S} (hx : x ∈ discBd Δ) (hxbd : x ∉ bd S) : + x ∈ closure (Set.univ \ Δ) := by + have hnot_int : x ∉ interior Δ := by + intro hxint + have hx' : IsInteriorPoint x := not_not.mp hxbd + obtain ⟨W, hW_open, hxW, ⟨f⟩⟩ := hx' + have : Nonempty S := ⟨x⟩ + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + obtain ⟨b⟩ := exists_homeomorph_ball (0 : ℂ) one_pos + obtain ⟨a, a', h1, h2, h3, h4, h5, h6⟩ := exists_functions_of_homeomorph (b.trans f.symm) + let U := W ∩ interior Δ + have hU_open : IsOpen U := hW_open.inter isOpen_interior + have hxU : x ∈ U := ⟨hxW, hxint⟩ + have hD : IsOpen (ball (0 : ℂ) 1 ∩ a ⁻¹' U) := h1.isOpen_inter_preimage isOpen_ball hU_open + have haΔ : ∀ z ∈ ball (0 : ℂ) 1 ∩ a ⁻¹' U, a z ∈ Δ := + fun z hz => interior_subset hz.2.2 + have hG : ContinuousOn (h ∘ a) (ball (0 : ℂ) 1 ∩ a ⁻¹' U) := + c.hc.comp (h1.mono inter_subset_left) haΔ + have hGi : InjOn (h ∘ a) (ball (0 : ℂ) 1 ∩ a ⁻¹' U) := fun z hz w hw he => + h5.injOn hz.1 hw.1 (c.gh.injOn (haΔ z hz) (haΔ w hw) he) + have hopen := isOpen_image_of_injOn hD hG hGi + have hsub_cb : (h ∘ a) '' (ball (0 : ℂ) 1 ∩ a ⁻¹' U) ⊆ closedBall (0 : ℂ) 1 := by + rintro _ ⟨z, hz, rfl⟩ + exact c.hm (haΔ z hz) + have hsub_int : (h ∘ a) '' (ball (0 : ℂ) 1 ∩ a ⁻¹' U) ⊆ interior (closedBall (0 : ℂ) 1) := + interior_maximal hsub_cb hopen + rw [interior_closedBall (0 : ℂ) one_ne_zero] at hsub_int + have hmem : h x ∈ (h ∘ a) '' (ball (0 : ℂ) 1 ∩ a ⁻¹' U) := by + refine ⟨a' x, ⟨h4 hxW, ?_⟩, ?_⟩ + · change a (a' x) ∈ U + rw [h6 hxW] + exact hxU + · change h (a (a' x)) = h x + rw [h6 hxW] + have hball : h x ∈ ball (0 : ℂ) 1 := hsub_int hmem + have hsph : h x ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem h hx + exact (mem_ball_zero_iff.mp hball).ne (mem_sphere_zero_iff_norm.mp hsph) + have hcompl : Set.univ \ Δ = Δᶜ := by ext y; simp + rw [hcompl, closure_compl] + exact hnot_int + +/-- For a painting $\Gamma$ in a surface $S$ and a closed disc $\Delta \subseteq S$ whose boundary +$\operatorname{discBd} \Delta$ is $\Gamma$-normal ($\operatorname{discBd} \Delta \cap \Gamma.U +\subseteq \Gamma.N$): +1. Every cell $c \in \Gamma.C$ satisfies either $c \subseteq \Delta \setminus \operatorname{discBd} + \Delta$ + or $c \subseteq S \setminus \Delta$. +2. Every border cell $c \in \Gamma.C$ satisfies $c \subseteq S \setminus \Delta$. +3. Every node $x \in \operatorname{discBd} \Delta \cap \Gamma.N$ lies in $\overline{S \setminus + \Delta}$. -/ +theorem normal_disc_cell_dichotomy (hS : IsSurface S) (Γ : Painting S) {Δ : Set S} + (hΔ : IsClosedDisc Δ) (hnorm : discBd Δ ∩ Γ.U ⊆ Γ.N) : + (∀ c ∈ Γ.C, c ⊆ Δ \ discBd Δ ∨ c ⊆ Set.univ \ Δ) ∧ + (∀ c ∈ Γ.C, (c ∩ bd S).Nonempty → c ⊆ Set.univ \ Δ) ∧ + (discBd Δ ∩ Γ.N ⊆ closure (Set.univ \ Δ)) := by + have : T2Space S := hS.2.1 + obtain ⟨hopen, _, hbd_sub, hint, hfr⟩ := isOpen_and_disjoint_bd_of_isClosedDisc hS hΔ + have hcell_disj_bd : ∀ c ∈ Γ.C, Disjoint c (discBd Δ) := by + intro c hc + refine Set.disjoint_left.mpr fun x hxc hxbd => ?_ + have hxU : x ∈ Γ.U := Γ.cell_subset_U hc hxc + have hxN : x ∈ Γ.N := hnorm ⟨hxbd, hxU⟩ + exact (Γ.cell_subset_diff hc hxc).2 hxN + have h1 : ∀ c ∈ Γ.C, c ⊆ Δ \ discBd Δ ∨ c ⊆ Set.univ \ Δ := by + intro c hc + have hdisj := hcell_disj_bd c hc + by_cases hsub : c ⊆ Set.univ \ Δ + · exact Or.inr hsub + · left + have hne_in : (c ∩ Δ).Nonempty := by + rw [Set.not_subset] at hsub + rcases hsub with ⟨x, hxc, hx⟩ + simp only [mem_sdiff, mem_univ, true_and, not_not] at hx + exact ⟨x, hxc, hx⟩ + have hc_sub_Δ : c ⊆ Δ := by + by_contra hnot + rw [Set.not_subset] at hnot + rcases hnot with ⟨y, hyc, hyΔ⟩ + have hne_out : (c ∩ Δᶜ).Nonempty := ⟨y, hyc, hyΔ⟩ + obtain ⟨z, hzc, hzfr⟩ := inter_frontier_nonempty_of_isPreconnected + (Γ.cell_isPathConnected hc).isConnected.isPreconnected hne_in hne_out + exact Set.disjoint_left.mp hdisj hzc (hfr hzfr) + exact fun x hxc => ⟨hc_sub_Δ hxc, Set.disjoint_left.mp hdisj hxc⟩ + have h2 : ∀ c ∈ Γ.C, (c ∩ bd S).Nonempty → c ⊆ Set.univ \ Δ := by + intro c hc ⟨x, hxc, hxbd⟩ + rcases h1 c hc with hsub | hsub + · exfalso + have hxΔ : x ∈ Δ \ discBd Δ := hsub hxc + exact hxΔ.2 (hbd_sub ⟨hxΔ.1, hxbd⟩) + · exact hsub + have h3 : discBd Δ ∩ Γ.N ⊆ closure (Set.univ \ Δ) := by + rintro x ⟨hxbdΔ, hxN⟩ + by_cases hxbdS : x ∈ bd S + · let Θ := connectedComponentIn (bd S) x + have hΘ : Θ ∈ cuffs S := ⟨x, hxbdS, rfl⟩ + have hΘ_arc : IsOArc Θ := (cuff_statement S hS).2.2 Θ hΘ + have hxΘ : x ∈ Γ.N ∩ Θ := ⟨hxN, mem_connectedComponentIn hxbdS⟩ + obtain ⟨E⟩ := Γ.exists_cuffEnumeration hΘ hΘ_arc + have hx_range : x ∈ Set.range E.node := by rw [E.range_node]; exact hxΘ + rcases hx_range with ⟨i, hi⟩ + have hc_range : E.cell i ∈ {c ∈ Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self i + have hbd_cell : (E.cell i ∩ bd S).Nonempty := + hc_range.2.mono (inter_subset_inter_right _ (connectedComponentIn_subset _ _)) + have hc_out : E.cell i ⊆ Set.univ \ Δ := h2 (E.cell i) hc_range.1 hbd_cell + have hx_tilde : x ∈ tilde (E.cell i) := by + rw [← hi, E.cell_tilde i] + exact mem_insert _ _ + exact closure_mono hc_out hx_tilde.1 + · exact mem_closure_compl_of_mem_discBd_not_bd hΔ hxbdΔ hxbdS + exact ⟨h1, h2, h3⟩ + +/-- If $\operatorname{discBd} \Delta$ is $\Gamma$-normal and $c \in \Gamma.C$ satisfies +$c \subseteq S \setminus \Delta$, then $\bar{c} \subseteq \overline{S \setminus \Delta}$ and +$\bar{c} \cap \Delta = \tilde{c} \cap \operatorname{discBd} \Delta \subseteq \Gamma.N \cap +\overline{S \setminus \Delta}$. -/ +theorem closure_cell_inter_disc_of_subset_compl (hS : IsSurface S) (Γ : Painting S) {Δ : Set S} + (hΔ : IsClosedDisc Δ) (hnorm : discBd Δ ∩ Γ.U ⊆ Γ.N) {c : Set S} (hc : c ∈ Γ.C) + (hsub : c ⊆ Set.univ \ Δ) : + closure c ⊆ closure (Set.univ \ Δ) ∧ + closure c ∩ Δ = tilde c ∩ discBd Δ := by + have : T2Space S := hS.2.1 + obtain ⟨hopen, _, _, _, _⟩ := isOpen_and_disjoint_bd_of_isClosedDisc hS hΔ + refine ⟨closure_mono hsub, Subset.antisymm ?_ ?_⟩ + · rintro x ⟨hxcl, hxΔ⟩ + have hxbd : x ∈ discBd Δ := by + by_contra hxnot + have hx_in : x ∈ Δ \ discBd Δ := ⟨hxΔ, hxnot⟩ + obtain ⟨y, hy_open, hyc⟩ := _root_.mem_closure_iff.mp hxcl (Δ \ discBd Δ) hopen hx_in + exact (hsub hyc).2 hy_open.1 + have hxU : x ∈ Γ.U := Γ.closure_cell_subset_U hc hxcl + have hxN : x ∈ Γ.N := hnorm ⟨hxbd, hxU⟩ + rw [← Γ.closure_cell_inter_N hc] + exact ⟨⟨hxcl, hxN⟩, hxbd⟩ + · rintro x ⟨hxt, hxbd⟩ + exact ⟨hxt.1, discBd_subset Δ hxbd⟩ + +end DiscNormalLemmas + +/-- The attachments of a closed disc with normal boundary lie among its boundary node images. -/ +theorem Portrayal.attachments_areaGraph_subset_normal_disc + {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {Δ : Set π.S} (hΔ : IsClosedDisc Δ) + (hnorm : π.Γ.IsNormal (discBd Δ)) : + attachments G (π.areaGraph Δ) ⊆ π.nodeVertex '' (discBd Δ ∩ π.Γ.N) := by + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have : ConnectedSpace π.S := π.connected + let I₁ : Set (Set π.S) := {c ∈ π.Γ.C | c ⊆ Δ} + let I₂ : Set (Set π.S) := {c ∈ π.Γ.C | ¬ c ⊆ Δ} + have hcov : I₁ ∪ I₂ = π.Γ.C := by + ext c + simp only [I₁, I₂, mem_union, mem_sep_iff] + exact ⟨fun h => h.elim And.left And.left, + fun hc => by by_cases h : c ⊆ Δ <;> [exact Or.inl ⟨hc, h⟩; exact Or.inr ⟨hc, h⟩]⟩ + have hdisj : Disjoint I₁ I₂ := by + rw [Set.disjoint_left] + exact fun _ h₁ h₂ => h₂.2 h₁.2 + have hsep : G.IsSeparation (π.cellsUnion I₁) (π.cellsUnion I₂) := + π.isSeparation_cellsUnion hcov hdisj + have hatt_sub_inter : attachments G (π.areaGraph Δ) ⊆ + (π.cellsUnion I₁ ∩ π.cellsUnion I₂).vertexSet := + attachments_subset_inter_of_isSeparation hsep + have h21 := (theorem_2_1_proof π hcov hdisj).2 + obtain ⟨hdich, hno_bd, _⟩ := normal_disc_cell_dichotomy π.isSurface π.Γ hΔ hnorm + intro v hv + have hv_inter := hatt_sub_inter hv + rw [h21] at hv_inter + rcases hv_inter with hγ | hbs + · rw [mem_iUnion₂] at hγ + rcases hγ with ⟨c₁, hc₁, hγ⟩ + rw [mem_iUnion₂] at hγ + rcases hγ with ⟨c₂, hc₂, hγ⟩ + rw [← π.gammaImage_inter, Portrayal.mem_gammaImage_iff] at hγ + rcases hγ with ⟨n, ⟨hnc₁, hndom⟩, rfl⟩ + have hc₂_out : c₂ ⊆ Set.univ \ Δ := + (hdich c₂ hc₂.1).resolve_left fun h => hc₂.2 (h.trans sdiff_subset) + have hcl_inter := + (closure_cell_inter_disc_of_subset_compl π.isSurface π.Γ hΔ hnorm hc₂.1 hc₂_out).2 + have hn_Δ : n ∈ Δ := (isClosed_of_isClosedDisc hΔ).closure_subset_iff.mpr hc₁.2 hnc₁.1.1 + have hn_bdΔ : n ∈ discBd Δ := by + have : n ∈ closure c₂ ∩ Δ := ⟨hnc₁.2.1, hn_Δ⟩ + rw [hcl_inter] at this + exact this.2 + exact ⟨n, ⟨hn_bdΔ, π.domγ_subset hndom⟩, rfl⟩ + · rw [mem_iUnion₂] at hbs + rcases hbs with ⟨n, ⟨c₁, hc₁, hbd₁, _⟩, _⟩ + have hc₁_out : c₁ ⊆ Set.univ \ Δ := hno_bd c₁ hc₁.1 hbd₁ + rcases hbd₁ with ⟨x, hxc₁, _⟩ + exact ((hc₁_out hxc₁).2 (hc₁.2 hxc₁)).elim + +/-- A disc with normal boundary has at most as many attachments as boundary nodes. -/ +theorem Portrayal.ncard_attachments_areaGraph_le_normal_disc + {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {Δ : Set π.S} (hΔ : IsClosedDisc Δ) + (hnorm : π.Γ.IsNormal (discBd Δ)) : + (attachments G (π.areaGraph Δ)).ncard ≤ (discBd Δ ∩ π.Γ.N).ncard := by + have hfin : (discBd Δ ∩ π.Γ.N).Finite := π.Γ.finite_N.inter_of_right _ + exact (ncard_le_ncard (π.attachments_areaGraph_subset_normal_disc hΔ hnorm) (hfin.image _)).trans + (ncard_image_le hfin) + +/-! ## 2. Removing a Disc with $\le 1$ Boundary Node: (7.1) (Page 178) -/ + +section Theorem71 + +variable {S : Type} [TopologicalSpace S] + +/-- The painting $\Gamma'$ of Graph Minors XVII, (7.1) (page 178): +if there is a cell $c \in \Gamma.C$ with $c \subseteq S \setminus \Delta$ and +$\tilde{c} \cap \operatorname{discBd} \Delta \ne \emptyset$, then +$\Gamma' = (U(\Gamma) \cap \overline{S \setminus \Delta}, N(\Gamma) \cap \overline{S \setminus +\Delta})$; +otherwise $\Gamma' = (U(\Gamma) \setminus \Delta, N(\Gamma) \setminus \Delta)$. +In both cases, $C(\Gamma') = \{c \in C(\Gamma) \mid c \subseteq S \setminus \Delta\}$. -/ +noncomputable def Painting.removeDiscWithCells (hS : IsSurface S) (Γ : Painting S) (Δ : Set S) + (hΔ : IsClosedDisc Δ) (hnorm : discBd Δ ∩ Γ.U ⊆ Γ.N) : + {Γ' : Painting S // Γ'.C = {c ∈ Γ.C | c ⊆ Set.univ \ Δ}} := by + classical + have : T2Space S := hS.2.1 + obtain ⟨hopen, _, hbd_sub, _, _⟩ := isOpen_and_disjoint_bd_of_isClosedDisc hS hΔ + obtain ⟨hdich, hbd_cells, hN_bd_cl⟩ := normal_disc_cell_dichotomy hS Γ hΔ hnorm + set I₂ : Set (Set S) := {c ∈ Γ.C | c ⊆ Set.univ \ Δ} + have hI₂_fin : I₂.Finite := Γ.finite_cells.subset fun _ h => h.1 + let hasTouch : Prop := ∃ c ∈ I₂, (tilde c ∩ discBd Δ).Nonempty + let U' : Set S := + if hasTouch then Γ.U ∩ closure (Set.univ \ Δ) else Γ.U \ Δ + let N' : Set S := + if hasTouch then Γ.N ∩ closure (Set.univ \ Δ) else Γ.N \ Δ + have hN'_sub_N : N' ⊆ Γ.N := by + dsimp only [N'] + split_ifs + · exact inter_subset_left + · exact sdiff_subset + have hN'_sub_U' : N' ⊆ U' := by + dsimp only [N', U'] + split_ifs + · exact inter_subset_inter_left _ Γ.N_subset + · exact sdiff_le_sdiff_right Γ.N_subset + have hN'_fin : N'.Finite := Γ.finite_N.subset hN'_sub_N + have htilde_sub_N' : ∀ c ∈ I₂, tilde c ⊆ N' := by + intro c ⟨hc, hc_sub⟩ + have hcl_sub := (closure_cell_inter_disc_of_subset_compl hS Γ hΔ hnorm hc hc_sub).1 + have hcl_inter := (closure_cell_inter_disc_of_subset_compl hS Γ hΔ hnorm hc hc_sub).2 + dsimp only [N'] + split_ifs with ht + · exact fun x hx => ⟨Γ.tilde_subset_N hc hx, hcl_sub hx.1⟩ + · intro x hx + refine ⟨Γ.tilde_subset_N hc hx, fun hxΔ => ht ⟨c, ⟨hc, hc_sub⟩, x, ?_⟩⟩ + rw [← hcl_inter] + exact ⟨hx.1, hxΔ⟩ + have hcl_sub_U' : ∀ c ∈ I₂, closure c ⊆ U' := by + intro c ⟨hc, hc_sub⟩ + have hcl_sub := (closure_cell_inter_disc_of_subset_compl hS Γ hΔ hnorm hc hc_sub).1 + have hcl_inter := (closure_cell_inter_disc_of_subset_compl hS Γ hΔ hnorm hc hc_sub).2 + dsimp only [U'] + split_ifs with ht + · exact fun x hx => ⟨Γ.closure_cell_subset_U hc hx, hcl_sub hx⟩ + · intro x hx + refine ⟨Γ.closure_cell_subset_U hc hx, fun hxΔ => ht ⟨c, ⟨hc, hc_sub⟩, x, ?_⟩⟩ + rw [← hcl_inter] + exact ⟨hx, hxΔ⟩ + have hU'_eq : U' = N' ∪ ⋃ c ∈ I₂, closure c := by + refine Subset.antisymm ?_ + (union_subset hN'_sub_U' (iUnion₂_subset fun c hc => hcl_sub_U' c hc)) + intro x hxU' + have hxU : x ∈ Γ.U := by + dsimp only [U'] at hxU' + split_ifs at hxU' <;> exact hxU'.1 + by_cases hxN : x ∈ Γ.N + · left + dsimp only [N', U'] at hxU' ⊢ + split_ifs at hxU' ⊢ with ht + · exact ⟨hxN, hxU'.2⟩ + · exact ⟨hxN, hxU'.2⟩ + · right + have hx_cells : x ∈ ⋃₀ Γ.C := by + rw [Γ.sUnion_cells] + exact ⟨hxU, hxN⟩ + rcases hx_cells with ⟨c, hc, hxc⟩ + rcases hdich c hc with hc_in | hc_out + · exfalso + have hx_open : x ∈ Δ \ discBd Δ := hc_in hxc + dsimp only [U'] at hxU' + split_ifs at hxU' with ht + · obtain ⟨y, hy_open, hy_out⟩ := + _root_.mem_closure_iff.mp hxU'.2 (Δ \ discBd Δ) hopen hx_open + exact hy_out.2 hy_open.1 + · exact hxU'.2 hx_open.1 + · exact mem_iUnion₂.mpr ⟨c, ⟨hc, hc_out⟩, subset_closure hxc⟩ + have hU'_closed : IsClosed U' := by + rw [hU'_eq] + exact hN'_fin.isClosed.union (hI₂_fin.isClosed_biUnion fun c _ => isClosed_closure) + have hbd_N_eq : N' ∩ bd S = Γ.N ∩ bd S := by + refine Subset.antisymm (inter_subset_inter_left _ hN'_sub_N) ?_ + rintro x ⟨hxN, hxbd⟩ + refine ⟨?_, hxbd⟩ + dsimp only [N'] + split_ifs with ht + · by_cases hxΔ : x ∈ Δ + · exact ⟨hxN, hN_bd_cl ⟨hbd_sub ⟨hxΔ, hxbd⟩, hxN⟩⟩ + · exact ⟨hxN, subset_closure ⟨trivial, hxΔ⟩⟩ + · refine ⟨hxN, fun hxΔ => ?_⟩ + have hx_bdΔ : x ∈ discBd Δ := hbd_sub ⟨hxΔ, hxbd⟩ + let Θ := connectedComponentIn (bd S) x + have hΘ : Θ ∈ cuffs S := ⟨x, hxbd, rfl⟩ + have hΘ_arc : IsOArc Θ := (cuff_statement S hS).2.2 Θ hΘ + obtain ⟨E⟩ := Γ.exists_cuffEnumeration hΘ hΘ_arc + have hx_range : x ∈ Set.range E.node := by + rw [E.range_node]; exact ⟨hxN, mem_connectedComponentIn hxbd⟩ + rcases hx_range with ⟨i, hi⟩ + have hc_range : E.cell i ∈ {c ∈ Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self i + have hbd_c : (E.cell i ∩ bd S).Nonempty := + hc_range.2.mono (inter_subset_inter_right _ (connectedComponentIn_subset _ _)) + have hc_I₂ : E.cell i ∈ I₂ := ⟨hc_range.1, hbd_cells (E.cell i) hc_range.1 hbd_c⟩ + have hx_tilde : x ∈ tilde (E.cell i) := by + rw [← hi, E.cell_tilde i] + exact mem_insert _ _ + exact ht ⟨E.cell i, hc_I₂, x, hx_tilde, hx_bdΔ⟩ + have hbd_sub_U' : bd S ⊆ U' := by + intro x hxbd + by_cases hxN : x ∈ Γ.N + · have hxN' : x ∈ N' ∩ bd S := hbd_N_eq.symm ▸ ⟨hxN, hxbd⟩ + exact hN'_sub_U' hxN'.1 + · obtain ⟨c, ⟨hc, hxc⟩, _⟩ := Γ.exists_border_cell_of_mem_bd ⟨hxbd, hxN⟩ + have hc_I₂ : c ∈ I₂ := ⟨hc, hbd_cells c hc ⟨x, hxc, hxbd⟩⟩ + exact hcl_sub_U' c hc_I₂ (subset_closure hxc) + have hcov : ⋃₀ I₂ = U' \ N' := by + ext x + constructor + · rintro ⟨c, hcI₂, hxc⟩ + refine ⟨hcl_sub_U' c hcI₂ (subset_closure hxc), fun hxN' => ?_⟩ + exact (Γ.cell_subset_diff hcI₂.1 hxc).2 (hN'_sub_N hxN') + · rintro ⟨hxU', hxN'⟩ + rw [hU'_eq] at hxU' + rcases hxU' with hxN'2 | hxcl + · exact False.elim (hxN' hxN'2) + · rcases mem_iUnion₂.mp hxcl with ⟨c, hcI₂, hxcl_c⟩ + have hxN : x ∉ Γ.N := fun hxN => + hxN' (htilde_sub_N' c hcI₂ ((Γ.closure_cell_inter_N hcI₂.1).symm ▸ ⟨hxcl_c, hxN⟩)) + have hxc : x ∈ c := by + rw [← Γ.closure_cell_diff_N hcI₂.1] + exact ⟨hxcl_c, hxN⟩ + exact ⟨c, hcI₂, hxc⟩ + have hC_eq : arcComponentsIn (U' \ N') = I₂ := by + apply arcComponentsIn_eq_of_finite_cover hI₂_fin hcov + · intro c hcI₂ + exact Γ.cell_nonempty hcI₂.1 + · intro c hcI₂ + exact Γ.cell_isPathConnected hcI₂.1 + · intro c₁ hc₁ c₂ hc₂ hne + exact Γ.cell_disjoint hc₁.1 hc₂.1 hne + · intro c hcI₂ + refine Subset.antisymm ?_ (fun x hxc => ⟨subset_closure hxc, hcov ▸ ⟨c, hcI₂, hxc⟩⟩) + rintro x ⟨hxcl, _, hxN'⟩ + have hxN : x ∉ Γ.N := fun hxN => + hxN' (htilde_sub_N' c hcI₂ ((Γ.closure_cell_inter_N hcI₂.1).symm ▸ ⟨hxcl, hxN⟩)) + rw [← Γ.closure_cell_diff_N hcI₂.1] + exact ⟨hxcl, hxN⟩ + refine ⟨?_, ?_⟩ + · exact + { U := U' + N := N' + isClosed_U := hU'_closed + bd_subset := hbd_sub_U' + N_subset := hN'_sub_U' + finite_N := hN'_fin + finite_cells := hC_eq ▸ hI₂_fin + cell_disc := fun c hc => Γ.cell_disc c (hC_eq ▸ hc).1 + border_cell := fun c hc hbd => Γ.border_cell c (hC_eq ▸ hc).1 hbd } + · exact hC_eq + +/-- The painting obtained by removing a disc. -/ +noncomputable def Painting.removeDisc (hS : IsSurface S) (Γ : Painting S) (Δ : Set S) + (hΔ : IsClosedDisc Δ) (hnorm : discBd Δ ∩ Γ.U ⊆ Γ.N) : Painting S := + (Γ.removeDiscWithCells hS Δ hΔ hnorm).1 + +theorem Painting.removeDisc_C (hS : IsSurface S) (Γ : Painting S) (Δ : Set S) + (hΔ : IsClosedDisc Δ) (hnorm : discBd Δ ∩ Γ.U ⊆ Γ.N) : + (Γ.removeDisc hS Δ hΔ hnorm).C = {c ∈ Γ.C | c ⊆ Set.univ \ Δ} := + (Γ.removeDiscWithCells hS Δ hΔ hnorm).2 + +theorem Painting.removeDisc_N_subset (hS : IsSurface S) (Γ : Painting S) (Δ : Set S) + (hΔ : IsClosedDisc Δ) (hnorm : discBd Δ ∩ Γ.U ⊆ Γ.N) : + (Γ.removeDisc hS Δ hΔ hnorm).N ⊆ Γ.N \ (Δ \ discBd Δ) := by + classical + have : T2Space S := hS.2.1 + obtain ⟨hopen, _, _, _, _⟩ := isOpen_and_disjoint_bd_of_isClosedDisc hS hΔ + intro x hx + change x ∈ if (∃ c ∈ {c ∈ Γ.C | c ⊆ Set.univ \ Δ}, (tilde c ∩ discBd Δ).Nonempty) + then Γ.N ∩ closure (Set.univ \ Δ) else Γ.N \ Δ at hx + split_ifs at hx with ht + · refine ⟨hx.1, fun hx_open => ?_⟩ + obtain ⟨y, hy_open, hy_out⟩ := + _root_.mem_closure_iff.mp hx.2 (Δ \ discBd Δ) hopen hx_open + exact hy_out.2 hy_open.1 + · exact ⟨hx.1, fun hx_open => hx.2 hx_open.1⟩ + +theorem Painting.removeDisc_N_inter_bd (hS : IsSurface S) (Γ : Painting S) (Δ : Set S) + (hΔ : IsClosedDisc Δ) (hnorm : discBd Δ ∩ Γ.U ⊆ Γ.N) : + (Γ.removeDisc hS Δ hΔ hnorm).N ∩ bd S = Γ.N ∩ bd S := by + classical + have : T2Space S := hS.2.1 + obtain ⟨_, _, hbd_sub, _, _⟩ := isOpen_and_disjoint_bd_of_isClosedDisc hS hΔ + obtain ⟨_, hbd_cells, hN_bd_cl⟩ := normal_disc_cell_dichotomy hS Γ hΔ hnorm + set I₂ : Set (Set S) := {c ∈ Γ.C | c ⊆ Set.univ \ Δ} + let hasTouch : Prop := ∃ c ∈ I₂, (tilde c ∩ discBd Δ).Nonempty + refine Subset.antisymm + (inter_subset_inter_left _ ((Γ.removeDisc_N_subset hS Δ hΔ hnorm).trans sdiff_subset)) ?_ + rintro x ⟨hxN, hxbd⟩ + refine ⟨?_, hxbd⟩ + change x ∈ if hasTouch then Γ.N ∩ closure (Set.univ \ Δ) else Γ.N \ Δ + split_ifs with ht + · by_cases hxΔ : x ∈ Δ + · exact ⟨hxN, hN_bd_cl ⟨hbd_sub ⟨hxΔ, hxbd⟩, hxN⟩⟩ + · exact ⟨hxN, subset_closure ⟨trivial, hxΔ⟩⟩ + · refine ⟨hxN, fun hxΔ => ?_⟩ + have hx_bdΔ : x ∈ discBd Δ := hbd_sub ⟨hxΔ, hxbd⟩ + let Θ := connectedComponentIn (bd S) x + have hΘ : Θ ∈ cuffs S := ⟨x, hxbd, rfl⟩ + have hΘ_arc : IsOArc Θ := (cuff_statement S hS).2.2 Θ hΘ + obtain ⟨E⟩ := Γ.exists_cuffEnumeration hΘ hΘ_arc + have hx_range : x ∈ Set.range E.node := by + rw [E.range_node]; exact ⟨hxN, mem_connectedComponentIn hxbd⟩ + rcases hx_range with ⟨i, hi⟩ + have hc_range : E.cell i ∈ {c ∈ Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self i + have hbd_c : (E.cell i ∩ bd S).Nonempty := + hc_range.2.mono (inter_subset_inter_right _ (connectedComponentIn_subset _ _)) + have hc_I₂ : E.cell i ∈ I₂ := ⟨hc_range.1, hbd_cells (E.cell i) hc_range.1 hbd_c⟩ + have hx_tilde : x ∈ tilde (E.cell i) := by + rw [← hi, E.cell_tilde i] + exact mem_insert _ _ + exact ht ⟨E.cell i, hc_I₂, x, hx_tilde, hx_bdΔ⟩ + +/-- If $H = H_1 \cup H_2$ is a union of two subhypergraphs of $G$, $u, v \in V(H_1)$, and +$w : (H_1 \cup H_2).\text{skeleton}.\text{Walk } u\; v$ is a simple path whose support contains at +most one vertex of $V(H_1) \cap V(H_2)$, then every vertex in $w.\text{support}$ belongs to +$V(H_1)$. -/ +theorem walk_in_left_of_ncard_support_inter_le_one {α : Type u} {β : Type v} + {G H₁ H₂ : Hypergraph α β} (hH₁ : H₁ ≤ G) (hH₂ : H₂ ≤ G) + {u v : α} (hu : u ∈ H₁.vertexSet) (hv : v ∈ H₁.vertexSet) + (w : (H₁ ∪ H₂).skeleton.Walk u v) (hp : w.IsPath) + (hcard : ({z ∈ w.support | z ∈ H₁.vertexSet ∩ H₂.vertexSet}).ncard ≤ 1) : + ∀ z ∈ w.support, z ∈ H₁.vertexSet := by + classical + by_contra hnot + push Not at hnot + rcases hnot with ⟨z, hz_sup, hz_not₁⟩ + obtain ⟨w₁, w₂, hw_eq⟩ := SimpleGraph.Walk.mem_support_iff_exists_append.mp hz_sup + have hex_cut : ∀ {a b : α} (p : (H₁ ∪ H₂).skeleton.Walk a b), + a ∈ H₁.vertexSet → b ∉ H₁.vertexSet → + ∃ x ∈ p.support, x ≠ b ∧ x ∈ H₁.vertexSet ∩ H₂.vertexSet := by + intro a b p + induction p with + | nil => intro ha hb; exact False.elim (hb ha) + | @cons x y c hadj p ih => + intro hx hc + by_cases hy : y ∈ H₁.vertexSet + · obtain ⟨w₀, hw₀_sup, hw₀_ne, hw₀_mem⟩ := ih hy hc + exact ⟨w₀, List.mem_cons_of_mem x hw₀_sup, hw₀_ne, hw₀_mem⟩ + · refine ⟨x, SimpleGraph.Walk.start_mem_support _, fun h => hc (h ▸ hx), hx, ?_⟩ + rcases hadj with ⟨_, e, hincx, hincy⟩ + rcases hincy with hincy₁ | hincy₂ + · exact False.elim (hy (H₁.vertex_mem_of_inc hincy₁)) + · rcases hincx with hincx₁ | hincx₂ + · have he₂ : e ∈ H₂.edgeSet := H₂.edge_mem_of_inc hincy₂ + have hincxG : G.Inc e x := (inc_iff_of_le hH₁ (H₁.edge_mem_of_inc hincx₁)).mp hincx₁ + have hincx₂ : H₂.Inc e x := (inc_iff_of_le hH₂ he₂).mpr hincxG + exact H₂.vertex_mem_of_inc hincx₂ + · exact H₂.vertex_mem_of_inc hincx₂ + obtain ⟨x₁, hx₁_sup, _, hx₁_inter⟩ := hex_cut w₁ hu hz_not₁ + obtain ⟨x₂, hx₂_sup, hx₂_ne_z, hx₂_inter⟩ := hex_cut w₂.reverse hv hz_not₁ + rw [SimpleGraph.Walk.support_reverse, List.mem_reverse] at hx₂_sup + have hx₁_w : x₁ ∈ w.support := + hw_eq ▸ SimpleGraph.Walk.support_subset_support_append_left w₁ w₂ hx₁_sup + have hx₂_w : x₂ ∈ w.support := + hw_eq ▸ SimpleGraph.Walk.support_subset_support_append_right w₁ w₂ hx₂_sup + have hx₁_eq_x₂ : x₁ = x₂ := by + by_contra hne + have hpair : ({x₁, x₂} : Set α) ⊆ {y ∈ w.support | y ∈ H₁.vertexSet ∩ H₂.vertexSet} := by + rintro y (rfl | rfl) + · exact ⟨hx₁_w, hx₁_inter⟩ + · exact ⟨hx₂_w, hx₂_inter⟩ + have hfin : ({y ∈ w.support | y ∈ H₁.vertexSet ∩ H₂.vertexSet}).Finite := + H₁.vertexSet_finite.subset fun _ hy => hy.2.1 + have h2 : 2 ≤ ({y ∈ w.support | y ∈ H₁.vertexSet ∩ H₂.vertexSet}).ncard := by + rw [← ncard_pair hne] + exact ncard_le_ncard hpair hfin + omega + rw [← hx₁_eq_x₂] at hx₂_sup + have hnodup := hw_eq ▸ hp.support_nodup + rw [SimpleGraph.Walk.support_append] at hnodup + have hdisj := List.nodup_append.mp hnodup + cases w₂ with + | nil => exact hx₂_ne_z (hx₁_eq_x₂.symm.trans (List.mem_singleton.mp hx₂_sup)) + | cons hadj p' => + have hx₁_in_tail : x₁ ∈ p'.support := by + rcases List.mem_cons.mp hx₂_sup with rfl | htail + · exact False.elim (hx₂_ne_z hx₁_eq_x₂.symm) + · exact htail + exact hdisj.2.2 x₁ hx₁_sup x₁ hx₁_in_tail rfl + +/-- If $H = H_1 \cup H_2$ is a union of two subhypergraphs whose vertex sets share at most one +vertex ($|V(H_1) \cap V(H_2)| \le 1$), then any simple path in $H^*$ with both endpoints in +$V(H_1)$ lies entirely in $H_1^*$. -/ +private theorem walk_in_left_of_ncard_inter_le_one {α : Type u} {β : Type v} + {G H₁ H₂ : Hypergraph α β} + (hH₁ : H₁ ≤ G) (hH₂ : H₂ ≤ G) + (hcard : (H₁.vertexSet ∩ H₂.vertexSet).ncard ≤ 1) + {u v : α} (hu : u ∈ H₁.vertexSet) (hv : v ∈ H₁.vertexSet) + (w : (H₁ ∪ H₂).skeleton.Walk u v) (hp : w.IsPath) : + ∀ z ∈ w.support, z ∈ H₁.vertexSet := by + have hsub : {z ∈ w.support | z ∈ H₁.vertexSet ∩ H₂.vertexSet} ⊆ + H₁.vertexSet ∩ H₂.vertexSet := fun _ h => h.2 + exact walk_in_left_of_ncard_support_inter_le_one hH₁ hH₂ hu hv w hp + ((ncard_le_ncard hsub (H₁.vertexSet_finite.subset inter_subset_left)).trans hcard) + +/-- Given a path `P : PathFromTo (H₁ ∪ H₂).skeleton S₁ S₂` with `S₁, S₂ ⊆ H₁.vertexSet`, +`Disjoint H₁.edgeSet H₂.edgeSet`, and `(H₁.vertexSet ∩ H₂.vertexSet).ncard ≤ 1`, `P` restricts +to a path in `H₁.skeleton` with the same vertex support. -/ +private noncomputable def restrictPathFromToLeft {α : Type u} {β : Type v} + {G H₁ H₂ : Hypergraph α β} + (hH₁ : H₁ ≤ G) (hH₂ : H₂ ≤ G) + (hcard : (H₁.vertexSet ∩ H₂.vertexSet).ncard ≤ 1) + {S₁ S₂ : Set α} (hS₁ : S₁ ⊆ H₁.vertexSet) (hS₂ : S₂ ⊆ H₁.vertexSet) + (P : PathFromTo (H₁ ∪ H₂).skeleton S₁ S₂) : + {Q : PathFromTo H₁.skeleton S₁ S₂ // + Q.first = P.first ∧ Q.last = P.last ∧ + ∀ z, z ∈ Q.walk.support ↔ z ∈ P.walk.support} := by + classical + have hsup : ∀ z ∈ P.walk.support, z ∈ H₁.vertexSet := + walk_in_left_of_ncard_inter_le_one hH₁ hH₂ hcard (hS₁ P.first_mem) (hS₂ P.last_mem) + P.walk P.isPath + have hadj : ∀ {x y : α}, x ∈ H₁.vertexSet → y ∈ H₁.vertexSet → + (H₁ ∪ H₂).skeleton.Adj x y → H₁.skeleton.Adj x y := by + rintro x y hx hy ⟨hne, e, hincx, hincy⟩ + have he₁_or_₂ : e ∈ H₁.edgeSet ∨ e ∈ H₂.edgeSet := by + rcases hincx with h | h + · exact Or.inl (H₁.edge_mem_of_inc h) + · exact Or.inr (H₂.edge_mem_of_inc h) + rcases he₁_or_₂ with he₁ | he₂ + · have hincxG : G.Inc e x := by + rcases hincx with h | h + · exact (inc_iff_of_le hH₁ (H₁.edge_mem_of_inc h)).mp h + · exact (inc_iff_of_le hH₂ (H₂.edge_mem_of_inc h)).mp h + have hincyG : G.Inc e y := by + rcases hincy with h | h + · exact (inc_iff_of_le hH₁ (H₁.edge_mem_of_inc h)).mp h + · exact (inc_iff_of_le hH₂ (H₂.edge_mem_of_inc h)).mp h + exact ⟨hne, e, (inc_iff_of_le hH₁ he₁).mpr hincxG, (inc_iff_of_le hH₁ he₁).mpr hincyG⟩ + · exfalso + have hincxG : G.Inc e x := by + rcases hincx with h | h + · exact (inc_iff_of_le hH₁ (H₁.edge_mem_of_inc h)).mp h + · exact (inc_iff_of_le hH₂ (H₂.edge_mem_of_inc h)).mp h + have hincyG : G.Inc e y := by + rcases hincy with h | h + · exact (inc_iff_of_le hH₁ (H₁.edge_mem_of_inc h)).mp h + · exact (inc_iff_of_le hH₂ (H₂.edge_mem_of_inc h)).mp h + have hincx₂ : H₂.Inc e x := (inc_iff_of_le hH₂ he₂).mpr hincxG + have hincy₂ : H₂.Inc e y := (inc_iff_of_le hH₂ he₂).mpr hincyG + have hx_inter : x ∈ H₁.vertexSet ∩ H₂.vertexSet := ⟨hx, H₂.vertex_mem_of_inc hincx₂⟩ + have hy_inter : y ∈ H₁.vertexSet ∩ H₂.vertexSet := ⟨hy, H₂.vertex_mem_of_inc hincy₂⟩ + have hpair : ({x, y} : Set α) ⊆ H₁.vertexSet ∩ H₂.vertexSet := by + rintro z (rfl | rfl) <;> assumption + have hfin : (H₁.vertexSet ∩ H₂.vertexSet).Finite := H₁.vertexSet_finite.subset + inter_subset_left + have h2 : 2 ≤ (H₁.vertexSet ∩ H₂.vertexSet).ncard := by + rw [← ncard_pair hne] + exact ncard_le_ncard hpair hfin + omega + have hwalk : ∀ {a b : α} (w : (H₁ ∪ H₂).skeleton.Walk a b), + (∀ z ∈ w.support, z ∈ H₁.vertexSet) → + {w' : H₁.skeleton.Walk a b // w'.support = w.support} := by + intro a b w + induction w with + | nil => intro _; exact ⟨.nil, rfl⟩ + | @cons x y c hadj_xy p ih => + intro hmem + have hx : x ∈ H₁.vertexSet := hmem x (SimpleGraph.Walk.start_mem_support _) + have hy : y ∈ H₁.vertexSet := + hmem y (List.mem_cons_of_mem x (SimpleGraph.Walk.start_mem_support _)) + obtain ⟨p', hp'⟩ := ih fun z hz => hmem z (List.mem_cons_of_mem x hz) + refine ⟨.cons (hadj hx hy hadj_xy) p', ?_⟩ + simp [hp'] + obtain ⟨w', hw'_sup⟩ := hwalk P.walk hsup + have hp' : w'.IsPath := by + rw [SimpleGraph.Walk.isPath_def, hw'_sup] + exact P.isPath.support_nodup + refine ⟨⟨P.first, P.last, w', hp', P.first_mem, P.last_mem⟩, rfl, rfl, fun z => ?_⟩ + rw [hw'_sup] + +private def discInsideCells {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Δ : Set π.S) : Set (Set π.S) := + {c ∈ π.Γ.C | c ⊆ Δ} + +private def discOutsideCells {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Δ : Set π.S) : Set (Set π.S) := + {c ∈ π.Γ.C | c ⊆ univ \ Δ} + +/-- Restricting the node set preserves the border linkage axiom on the remaining nodes. -/ +private theorem p7_of_restricted_nodes {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {N' : Set π.S} (hN' : N' ⊆ π.Γ.N) : + let plus (n : π.S) : Set α := + {v | v ∈ π.borderSet n ∨ (n ∈ π.domγ ∩ N' ∧ v = π.nodeVertex n)} + ∀ Θ ∈ cuffs π.S, ∀ n₁ ∈ N' ∩ Θ, ∀ n₂ ∈ N' ∩ Θ, ∀ n₃ ∈ N' ∩ Θ, ∀ n₄ ∈ N' ∩ Θ, + GM19.InOrderOn Θ n₁ n₂ n₃ n₄ → ∀ v : α, v ∈ plus n₁ → v ∈ plus n₃ → + v ∈ plus n₂ ∨ v ∈ plus n₄ := by + intro plus Θ hΘ n₁ hn₁ n₂ hn₂ n₃ hn₃ n₄ hn₄ hord v hv₁ hv₃ + have hplus : ∀ n ∈ N', plus n = π.borderPlus n := by + intro n hn + ext x + simp [plus, Portrayal.borderPlus, hn] + rw [hplus n₁ hn₁.1] at hv₁ + rw [hplus n₃ hn₃.1] at hv₃ + rw [hplus n₂ hn₂.1, hplus n₄ hn₄.1] + exact π.p7 Θ hΘ n₁ ⟨hN' hn₁.1, hn₁.2⟩ n₂ ⟨hN' hn₂.1, hn₂.2⟩ + n₃ ⟨hN' hn₃.1, hn₃.2⟩ n₄ ⟨hN' hn₄.1, hn₄.2⟩ hord v hv₁ hv₃ + +private noncomputable abbrev removeDiscPortrayal + {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) + (Δ : Set π.S) + (c' : Set π.S) + (hc' : c' ∈ π.Γ.C) + (hdich : ∀ c ∈ π.Γ.C, c ⊆ Δ \ discBd Δ ∨ c ⊆ univ \ Δ) + (Γ' : Painting π.S) + (hN'_sub : Γ'.N ⊆ π.Γ.N \ (Δ \ discBd Δ)) + (hN'_bd : Γ'.N ∩ bd π.S = π.Γ.N ∩ bd π.S) + (hc'_mem : c' ∈ Γ'.C) + (hC' : Γ'.C = (discOutsideCells π Δ)) + (hdisj_I : Disjoint (discInsideCells π Δ) (discOutsideCells π Δ)) + (hI₁_le : π.areaGraph Δ ≤ G) + (hinter_sub_c' : (π.areaGraph Δ).vertexSet ∩ (π.cellsUnion (discOutsideCells π Δ)).vertexSet ⊆ + (π.cellGraph c').vertexSet) + (htilde_sub_N' : ∀ c ∈ Γ'.C, tilde c ⊆ Γ'.N) + : Portrayal G := open Classical in + let cellG : Set π.S → Hypergraph α β := fun c => + if c = c' then π.cellGraph c' ∪ π.areaGraph Δ else π.cellGraph c + have common_cell_membership : ∀ c ∈ Γ'.C, ∀ v ∈ (cellG c).vertexSet, + (∃ d ∈ Γ'.C, d ≠ c ∧ v ∈ (cellG d).vertexSet) → + c ∈ π.Γ.C ∧ v ∈ (π.cellGraph c).vertexSet ∧ + ∃ d ∈ π.Γ.C, d ≠ c ∧ v ∈ (π.cellGraph d).vertexSet := by + intro c hc v hv hex + rw [hC'] at hc + rcases hex with ⟨d, hd, hne, hvd⟩ + rw [hC'] at hd + have hvc : v ∈ (π.cellGraph c).vertexSet := by + dsimp only [cellG] at hv hvd + split_ifs at hv with hcc' + · rcases hv with hvc' | hvΔ + · rwa [hcc'] + · have hvd_d : v ∈ (π.cellGraph d).vertexSet := by + split_ifs at hvd with hdc' + · exact False.elim (hne (hdc'.trans hcc'.symm)) + · exact hvd + rw [hcc'] + exact hinter_sub_c' ⟨hvΔ, mem_iUnion₂.mpr ⟨d, ⟨hd, hd.1⟩, hvd_d⟩⟩ + · exact hv + have hvd' : ∃ d' ∈ π.Γ.C, d' ≠ c ∧ v ∈ (π.cellGraph d').vertexSet := by + dsimp only [cellG] at hvd + split_ifs at hvd with hdc' + · rcases hvd with hvc' | hvΔ + · exact ⟨d, hd.1, hne, hdc'.symm ▸ hvc'⟩ + · exact ⟨d, hd.1, hne, hdc'.symm ▸ hinter_sub_c' ⟨hvΔ, mem_iUnion₂.mpr ⟨c, ⟨hc, + hc.1⟩, hvc⟩⟩⟩ + · exact ⟨d, hd.1, hne, hvd⟩ + exact ⟨hc.1, hvc, hvd'⟩ + { S := π.S + isSurface := π.isSurface + connected := π.connected + Γ := Γ' + cellGraph := cellG + borderSet := π.borderSet + domγ := π.domγ ∩ Γ'.N + nodeVertex := π.nodeVertex + cellGraph_le := fun c hc => by + rw [hC'] at hc + dsimp only [cellG] + split_ifs with hcc' + · exact union_le (π.cellGraph_le c' hc') hI₁_le + · exact π.cellGraph_le c hc.1 + borderSet_subset := fun n hn => π.borderSet_subset n (hN'_bd ▸ hn) + domγ_subset := fun _ hn => hn.2 + nodeVertex_mem := fun n hn => π.nodeVertex_mem n hn.1 + nodeVertex_injOn := π.nodeVertex_injOn.mono inter_subset_left + p1_vertex := fun v hv => by + rcases π.p1_vertex v hv with ⟨c, hc, hvc⟩ + rcases hdich c hc with hc_in | hc_out + · refine ⟨c', hc'_mem, ?_⟩ + change v ∈ (if c' = c' then π.cellGraph c' ∪ π.areaGraph Δ else π.cellGraph c').vertexSet + simp only [↓reduceIte] + right + exact mem_iUnion₂.mpr ⟨c, ⟨⟨hc, hc_in.trans sdiff_subset⟩, hc⟩, hvc⟩ + · refine ⟨c, hC'.symm ▸ ⟨hc, hc_out⟩, ?_⟩ + dsimp only [cellG] + split_ifs with hcc' + · rw [← hcc']; exact Or.inl hvc + · exact hvc + p1_edge := fun e he => by + rcases π.p1_edge e he with ⟨c, hc, hec⟩ + rcases hdich c hc with hc_in | hc_out + · refine ⟨c', hc'_mem, ?_⟩ + change e ∈ (if c' = c' then π.cellGraph c' ∪ π.areaGraph Δ else π.cellGraph c').edgeSet + simp only [↓reduceIte] + right + exact mem_iUnion₂.mpr ⟨c, ⟨⟨hc, hc_in.trans sdiff_subset⟩, hc⟩, hec⟩ + · refine ⟨c, hC'.symm ▸ ⟨hc, hc_out⟩, ?_⟩ + dsimp only [cellG] + split_ifs with hcc' + · rw [← hcc']; exact Or.inl hec + · exact hec + p1_disjoint := fun c₁ hc₁ c₂ hc₂ hne => by + rw [hC'] at hc₁ hc₂ + dsimp only [cellG] + split_ifs with h1 h2 h2 + · exact False.elim (hne (h1.trans h2.symm)) + · rw [← h1] + refine Disjoint.union_left (π.p1_disjoint c₁ hc₁.1 c₂ hc₂.1 hne) ?_ + rw [Set.disjoint_left] + intro e he₁ he₂ + rcases mem_iUnion₂.mp he₁ with ⟨c₀, hc₀, hec₀⟩ + have hc₀_ne : c₀ ≠ c₂ := fun h => + Set.disjoint_left.mp hdisj_I hc₀.1 (h ▸ hc₂) + exact Set.disjoint_left.mp (π.p1_disjoint c₀ hc₀.2 c₂ hc₂.1 hc₀_ne) hec₀ he₂ + · rw [← h2] + refine Disjoint.union_right (π.p1_disjoint c₁ hc₁.1 c₂ hc₂.1 hne) ?_ + rw [Set.disjoint_left] + intro e he₁ he₂ + rcases mem_iUnion₂.mp he₂ with ⟨c₀, hc₀, hec₀⟩ + have hc₁_ne : c₁ ≠ c₀ := fun h => + Set.disjoint_left.mp hdisj_I hc₀.1 (h ▸ hc₁) + exact Set.disjoint_left.mp (π.p1_disjoint c₁ hc₁.1 c₀ hc₀.2 hc₁_ne) he₁ hec₀ + · exact π.p1_disjoint c₁ hc₁.1 c₂ hc₂.1 hne + p2 := fun c hc n hn => by + rw [hC'] at hc + have hvm : π.nodeVertex n ∈ (π.cellGraph c).vertexSet := + π.p2 c hc.1 n ⟨hn.1, hn.2.1⟩ + dsimp only [cellG] + split_ifs with hcc' + · rw [← hcc']; exact Or.inl hvm + · exact hvm + p3_notMem := fun n hn => π.p3_notMem n ⟨hn.1.1, hn.2⟩ + p3_subset := fun c hc hbd n hnt v hv => by + rw [hC'] at hc + have hvm := π.p3_subset c hc.1 hbd n hnt hv + dsimp only [cellG] + split_ifs with hcc' + · rw [← hcc']; exact Or.inl hvm + · exact hvm + p4_disjoint := fun Θ₁ hΘ₁ Θ₂ hΘ₂ hne n₁ hn₁ n₂ hn₂ => + π.p4_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ hne n₁ ⟨(hN'_sub hn₁.1).1, hn₁.2⟩ n₂ ⟨(hN'_sub hn₂.1).1, hn₂.2⟩ + p4_notMem := fun Θ hΘ n₁ hn₁ n₂ hn₂ hnot => + π.p4_notMem Θ hΘ n₁ ⟨(hN'_sub hn₁.1).1, hn₁.2⟩ n₂ hn₂.1 hnot + p5 := fun c hc hbd v hv hex => by + obtain ⟨hc_old, hvc, hvd'⟩ := common_cell_membership c hc v hv hex + obtain ⟨n, ⟨hnt, hndom⟩, rfl⟩ := π.p5 c hc_old hbd v hvc hvd' + exact ⟨n, ⟨hnt, hndom, htilde_sub_N' c hc hnt⟩, rfl⟩ + p6 := fun c hc hbd v hv hex => by + obtain ⟨hc_old, hvc, hvd'⟩ := common_cell_membership c hc v hv hex + obtain ⟨n, hnt, hmem | ⟨hndom, rfl⟩⟩ := π.p6 c hc_old hbd v hvc hvd' + · exact ⟨n, hnt, Or.inl hmem⟩ + · exact ⟨n, hnt, Or.inr ⟨⟨hndom, htilde_sub_N' c hc hnt⟩, rfl⟩⟩ + p7 := p7_of_restricted_nodes π (fun _ hn => (hN'_sub hn).1) } + +/-- If an unchanged cell keeps the enlarged border sets of its ends, its warp bounds agree. -/ +private theorem cellWarpLE_iff_of_borderPlus_eq {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) {c : Set π.S} {q : ℕ} {borderPlus : π.S → Set α} + (hplus : ∀ n ∈ tilde c, borderPlus n = π.borderPlus n) : + (∀ n₁ ∈ tilde c, ∀ n₂ ∈ tilde c, n₁ ≠ n₂ → + (π.borderSet n₁).ncard ≤ q ∧ (π.borderSet n₂).ncard ≤ q ∧ + ((borderPlus n₁).ncard = q + 1 → (borderPlus n₂).ncard = q + 1 → + Portrayal.LinkagePairs (π.cellGraph c).skeleton (borderPlus n₁) (borderPlus n₂) (q + 1) + (π.nodeVertex n₁) (π.nodeVertex n₂))) ↔ π.CellWarpLE c q := by + constructor <;> intro h n₁ hn₁ n₂ hn₂ hne <;> + simpa only [hplus n₁ hn₁, hplus n₂ hn₂] using h n₁ hn₁ n₂ hn₂ hne + +/-- Equal warp bounds on corresponding cells give equal suprema of their minimum bounds. -/ +private theorem cuffWarp_eq_of_cellWarpLE_iff {X : Type u} {C C' : Set (Set X)} {Θ : Set X} + {P P' : Set X → ℕ → Prop} + (hmem : ∀ c, (c ∩ Θ).Nonempty → (c ∈ C' ↔ c ∈ C)) + (hcell : ∀ c q, c ∈ C' → (c ∩ Θ).Nonempty → (P' c q ↔ P c q)) : + sSup {p : ℕ | ∃ c ∈ C', (c ∩ Θ).Nonempty ∧ p = sInf {q | P' c q}} = + sSup {p : ℕ | ∃ c ∈ C, (c ∩ Θ).Nonempty ∧ p = sInf {q | P c q}} := by + have hwarp (c) (hc : c ∈ C') (hne : (c ∩ Θ).Nonempty) : + sInf {q | P' c q} = sInf {q | P c q} := + congrArg sInf (Set.ext fun q => hcell c q hc hne) + congr 1 + ext p + constructor + · rintro ⟨c, hc, hne, rfl⟩ + exact ⟨c, (hmem c hne).mp hc, hne, hwarp c hc hne⟩ + · rintro ⟨c, hc, hne, rfl⟩ + have hc' := (hmem c hne).mpr hc + exact ⟨c, hc', hne, (hwarp c hc' hne).symm⟩ + +private theorem removeDiscWarpAt + {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) + (Δ : Set π.S) + (c' : Set π.S) + (hc' : c' ∈ π.Γ.C) + (hdich : ∀ c ∈ π.Γ.C, c ⊆ Δ \ discBd Δ ∨ c ⊆ univ \ Δ) + (Γ' : Painting π.S) + (hN'_sub : Γ'.N ⊆ π.Γ.N \ (Δ \ discBd Δ)) + (hN'_bd : Γ'.N ∩ bd π.S = π.Γ.N ∩ bd π.S) + (hc'_mem : c' ∈ Γ'.C) + (hC' : Γ'.C = (discOutsideCells π Δ)) + (hdisj_I : Disjoint (discInsideCells π Δ) (discOutsideCells π Δ)) + (hI₁_le : π.areaGraph Δ ≤ G) + (hinter_sub_c' : (π.areaGraph Δ).vertexSet ∩ (π.cellsUnion (discOutsideCells π Δ)).vertexSet ⊆ + (π.cellGraph c').vertexSet) + (htilde_sub_N' : ∀ c ∈ Γ'.C, tilde c ⊆ Γ'.N) + (hcard : (discBd Δ ∩ π.Γ.N).ncard ≤ 1) + (hbd_cells : ∀ c ∈ π.Γ.C, (c ∩ bd π.S).Nonempty → c ⊆ univ \ Δ) + (hinter_sub : (π.areaGraph Δ).vertexSet ∩ (π.cellsUnion (discOutsideCells π Δ)).vertexSet ⊆ + π.nodeVertex '' (tilde c' ∩ discBd Δ ∩ π.domγ)) : + let π' := removeDiscPortrayal π Δ c' hc' hdich Γ' hN'_sub hN'_bd hc'_mem hC' hdisj_I hI₁_le + hinter_sub_c' htilde_sub_N' + ∀ Θ ∈ cuffs π.S, π'.warpAt Θ = π.warpAt Θ := by + classical + intro π' + let I₂ := discOutsideCells π Δ + let cellG : Set π.S → Hypergraph α β := fun c => + if c = c' then π.cellGraph c' ∪ π.areaGraph Δ else π.cellGraph c + have hborderPlus_eq : ∀ n ∈ π.Γ.N ∩ bd π.S, π'.borderPlus n = π.borderPlus n := by + intro n hn + have hn' : n ∈ Γ'.N := (hN'_bd.symm ▸ hn).1 + ext v + simp only [Portrayal.borderPlus, π', removeDiscPortrayal, mem_ofPred_eq, mem_inter_iff] + exact ⟨fun h => h.elim Or.inl (fun ⟨⟨h1, _⟩, h2⟩ => Or.inr ⟨h1, h2⟩), + fun h => h.elim Or.inl (fun ⟨h1, h2⟩ => Or.inr ⟨⟨h1, hn'⟩, h2⟩)⟩ + intro Θ hΘ + have hΘ_sub : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x, _, rfl⟩ + exact connectedComponentIn_subset _ _ + have hcell_iff : ∀ (c : Set π.S) (q : ℕ), c ∈ Γ'.C → (c ∩ Θ).Nonempty → + (π'.CellWarpLE c q ↔ π.CellWarpLE c q) := by + intro c q hc hne_Θ + rw [hC'] at hc + have hbd_c : (c ∩ bd π.S).Nonempty := hne_Θ.mono (inter_subset_inter_right c hΘ_sub) + have htilde_bd : tilde c ⊆ π.Γ.N ∩ bd π.S := by + obtain ⟨_, _, _, htilde_sub, _⟩ := π.Γ.border_cell_subset_cuff hc.1 hΘ hne_Θ + exact htilde_sub.trans (inter_subset_inter_right _ hΘ_sub) + change (∀ n₁ ∈ tilde c, ∀ n₂ ∈ tilde c, n₁ ≠ n₂ → + (π.borderSet n₁).ncard ≤ q ∧ (π.borderSet n₂).ncard ≤ q ∧ + ((π'.borderPlus n₁).ncard = q + 1 → (π'.borderPlus n₂).ncard = q + 1 → + Portrayal.LinkagePairs (cellG c).skeleton (π'.borderPlus n₁) (π'.borderPlus n₂) (q + 1) + (π.nodeVertex n₁) (π.nodeVertex n₂))) ↔ + π.CellWarpLE c q + dsimp only [cellG] + split_ifs with hcc' + · rw [hcc'] at hc hbd_c htilde_bd ⊢ + have hcard_inter : ((π.cellGraph c').vertexSet ∩ (π.areaGraph Δ).vertexSet).ncard ≤ 1 := by + have hsub_img : (π.cellGraph c').vertexSet ∩ (π.areaGraph Δ).vertexSet ⊆ + π.nodeVertex '' (discBd Δ ∩ π.Γ.N) := by + intro v ⟨hvc', hvΔ⟩ + have hv_inter : v ∈ (π.areaGraph Δ).vertexSet ∩ (π.cellsUnion I₂).vertexSet := + ⟨hvΔ, mem_iUnion₂.mpr ⟨c', ⟨hc, hc.1⟩, hvc'⟩⟩ + rcases hinter_sub hv_inter with ⟨n, ⟨⟨_, hnbd⟩, hdom⟩, rfl⟩ + exact ⟨n, ⟨hnbd, π.domγ_subset hdom⟩, rfl⟩ + have hfin_N : (discBd Δ ∩ π.Γ.N).Finite := π.Γ.finite_N.subset inter_subset_right + calc ((π.cellGraph c').vertexSet ∩ (π.areaGraph Δ).vertexSet).ncard + _ ≤ (π.nodeVertex '' (discBd Δ ∩ π.Γ.N)).ncard := + ncard_le_ncard hsub_img (hfin_N.image _) + _ ≤ (discBd Δ ∩ π.Γ.N).ncard := ncard_image_le hfin_N + _ ≤ 1 := hcard + constructor + · intro h n₁ hn₁ n₂ hn₂ hne + obtain ⟨h1, h2, h3⟩ := h n₁ hn₁ n₂ hn₂ hne + refine ⟨h1, h2, fun hb₁ hb₂ P hP => ?_⟩ + have hb₁' : (π'.borderPlus n₁).ncard = q + 1 := by + rwa [hborderPlus_eq n₁ (htilde_bd hn₁)] + have hb₂' : (π'.borderPlus n₂).ncard = q + 1 := by + rwa [hborderPlus_eq n₂ (htilde_bd hn₂)] + have hskel_le : (π.cellGraph c').skeleton ≤ + (π.cellGraph c' ∪ π.areaGraph Δ).skeleton := + fun x y ⟨hne, e, hx, hy⟩ => ⟨hne, e, Or.inl hx, Or.inl hy⟩ + let P' : Fin (q + 1) → + PathFromTo (π.cellGraph c' ∪ π.areaGraph Δ).skeleton + (π'.borderPlus n₁) (π'.borderPlus n₂) := fun i => + { first := (P i).first + last := (P i).last + walk := (P i).walk.map (SimpleGraph.Hom.ofLE hskel_le) + isPath := by + simpa [SimpleGraph.Walk.isPath_def, SimpleGraph.Walk.support_map] using + (P i).isPath.support_nodup + first_mem := by rw [hborderPlus_eq n₁ (htilde_bd hn₁)]; exact (P i).first_mem + last_mem := by rw [hborderPlus_eq n₂ (htilde_bd hn₂)]; exact (P i).last_mem } + have hP' : Pairwise fun i j => + Disjoint {z | z ∈ (P' i).walk.support} {z | z ∈ (P' j).walk.support} := by + intro i j hij + simpa [P', SimpleGraph.Walk.support_map] using hP hij + exact h3 hb₁' hb₂' P' hP' + · intro h n₁ hn₁ n₂ hn₂ hne + obtain ⟨h1, h2, h3⟩ := h n₁ hn₁ n₂ hn₂ hne + refine ⟨h1, h2, fun hb₁' hb₂' P hP => ?_⟩ + have hb₁ : (π.borderPlus n₁).ncard = q + 1 := by + rwa [← hborderPlus_eq n₁ (htilde_bd hn₁)] + have hb₂ : (π.borderPlus n₂).ncard = q + 1 := by + rwa [← hborderPlus_eq n₂ (htilde_bd hn₂)] + have hS₁ : π'.borderPlus n₁ ⊆ (π.cellGraph c').vertexSet := by + rw [hborderPlus_eq n₁ (htilde_bd hn₁)] + exact π.borderPlus_subset_cellGraph hc' hbd_c hn₁ + have hS₂ : π'.borderPlus n₂ ⊆ (π.cellGraph c').vertexSet := by + rw [hborderPlus_eq n₂ (htilde_bd hn₂)] + exact π.borderPlus_subset_cellGraph hc' hbd_c hn₂ + let Q : Fin (q + 1) → + PathFromTo (π.cellGraph c').skeleton (π.borderPlus n₁) (π.borderPlus n₂) := fun i => + let R := (restrictPathFromToLeft (π.cellGraph_le c' hc') hI₁_le hcard_inter + hS₁ hS₂ (P i)).1 + { first := R.first + last := R.last + walk := R.walk + isPath := R.isPath + first_mem := by rw [← hborderPlus_eq n₁ (htilde_bd hn₁)]; exact R.first_mem + last_mem := by rw [← hborderPlus_eq n₂ (htilde_bd hn₂)]; exact R.last_mem } + have hQ : Pairwise fun i j => + Disjoint {z | z ∈ (Q i).walk.support} {z | z ∈ (Q j).walk.support} := by + intro i j hij + have hsup_i := (restrictPathFromToLeft (π.cellGraph_le c' hc') hI₁_le hcard_inter + hS₁ hS₂ (P i)).2.2.2 + have hsup_j := (restrictPathFromToLeft (π.cellGraph_le c' hc') hI₁_le hcard_inter + hS₁ hS₂ (P j)).2.2.2 + refine Set.disjoint_left.mpr fun z hzi hzj => ?_ + exact Set.disjoint_left.mp (hP hij) ((hsup_i z).mp hzi) ((hsup_j z).mp hzj) + obtain ⟨i, hi3, hi4⟩ := h3 hb₁ hb₂ Q hQ + have hfi := (restrictPathFromToLeft (π.cellGraph_le c' hc') hI₁_le hcard_inter + hS₁ hS₂ (P i)).2.1 + have hli := (restrictPathFromToLeft (π.cellGraph_le c' hc') hI₁_le hcard_inter + hS₁ hS₂ (P i)).2.2.1 + exact ⟨i, hfi.symm.trans hi3, hli.symm.trans hi4⟩ + · exact cellWarpLE_iff_of_borderPlus_eq π (fun n hn => hborderPlus_eq n (htilde_bd hn)) + exact cuffWarp_eq_of_cellWarpLE_iff + (C' := Γ'.C) (C := π.Γ.C) (Θ := Θ) (P' := π'.CellWarpLE) (P := π.CellWarpLE) + (fun c hne_Θ => by + rw [hC'] + have hbd_c : (c ∩ bd π.S).Nonempty := hne_Θ.mono (inter_subset_inter_right c hΘ_sub) + exact ⟨fun hc => hc.1, fun hc => ⟨hc, hbd_cells c hc hbd_c⟩⟩) + hcell_iff + +private theorem removeDiscTruth + {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) + (Δ : Set π.S) + (c' : Set π.S) + (hc' : c' ∈ π.Γ.C) + (hdich : ∀ c ∈ π.Γ.C, c ⊆ Δ \ discBd Δ ∨ c ⊆ univ \ Δ) + (Γ' : Painting π.S) + (hN'_sub : Γ'.N ⊆ π.Γ.N \ (Δ \ discBd Δ)) + (hN'_bd : Γ'.N ∩ bd π.S = π.Γ.N ∩ bd π.S) + (hc'_mem : c' ∈ Γ'.C) + (hC' : Γ'.C = (discOutsideCells π Δ)) + (hdisj_I : Disjoint (discInsideCells π Δ) (discOutsideCells π Δ)) + (hI₁_le : π.areaGraph Δ ≤ G) + (hinter_sub_c' : (π.areaGraph Δ).vertexSet ∩ (π.cellsUnion (discOutsideCells π Δ)).vertexSet ⊆ + (π.cellGraph c').vertexSet) + (htilde_sub_N' : ∀ c ∈ Γ'.C, tilde c ⊆ Γ'.N) + (hbd_sub : Δ ∩ bd π.S ⊆ discBd Δ) + (hbd_cells : ∀ c ∈ π.Γ.C, (c ∩ bd π.S).Nonempty → c ⊆ univ \ Δ) : + let π' := removeDiscPortrayal π Δ c' hc' hdich Γ' hN'_sub hN'_bd hc'_mem hC' hdisj_I hI₁_le + hinter_sub_c' htilde_sub_N' + ¬(Δ \ discBd Δ ∩ π.Γ.U).Nonempty ∨ π'.IsTruer π := by + classical + intro π' + let I₁ := discInsideCells π Δ + by_cases hne_U : ((Δ \ discBd Δ) ∩ π.Γ.U).Nonempty + · right + by_cases hI₁_ne : I₁.Nonempty + · have hsub_τ : ∀ j : Fin 4, + {c ∈ Γ'.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - j.1} ⊆ + {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - j.1} := by + intro j c hc + rw [hC'] at hc + exact ⟨hc.1.1, hc.2⟩ + have hex_nat : ∃ k : ℕ, k < 4 ∧ ∃ c ∈ I₁, (tilde c).ncard = 3 - k := by + rcases hI₁_ne with ⟨c, hc⟩ + have hle3 : (tilde c).ncard ≤ 3 := π.Γ.ncard_tilde_cell_le hc.1 + exact ⟨3 - (tilde c).ncard, by omega, c, hc, by omega⟩ + let k₀ := Nat.find hex_nat + have hk₀_lt : k₀ < 4 := (Nat.find_spec hex_nat).1 + obtain ⟨c₀, hc₀, hc₀_card⟩ := (Nat.find_spec hex_nat).2 + refine ⟨⟨k₀, by omega⟩, fun i hi => ?_, ?_⟩ + · have hi_lt : i.1 < k₀ := hi + have hnot : ¬ (i.1 < 4 ∧ ∃ c ∈ I₁, (tilde c).ncard = 3 - i.1) := Nat.find_min hex_nat hi_lt + have hno_c : ¬ ∃ c ∈ I₁, (tilde c).ncard = 3 - i.1 := fun h => hnot ⟨by omega, h⟩ + have hset_eq : {c ∈ Γ'.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - i.1} = + {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - i.1} := by + refine Subset.antisymm (hsub_τ ⟨i.1, by omega⟩) ?_ + rintro c ⟨hc, hint, hcard_c⟩ + rw [hC'] + rcases hdich c hc with hc_in | hc_out + · exact False.elim (hno_c ⟨c, ⟨hc, hc_in.trans sdiff_subset⟩, hcard_c⟩) + · exact ⟨⟨hc, hc_out⟩, hint, hcard_c⟩ + have hi4 : i.1 < 4 := by omega + simp only [Portrayal.truth, π', removeDiscPortrayal, hi4, ↓reduceIte, hset_eq] + · have hc₀_int : ¬ (c₀ ∩ bd π.S).Nonempty := fun hbd => + Set.disjoint_left.mp hdisj_I hc₀ ⟨hc₀.1, hbd_cells c₀ hc₀.1 hbd⟩ + have hc₀_in_old : c₀ ∈ {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - k₀} := + ⟨hc₀.1, hc₀_int, hc₀_card⟩ + have hc₀_not_new : c₀ ∉ {c ∈ Γ'.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - k₀} + := by + rw [hC'] + intro h + exact Set.disjoint_left.mp hdisj_I hc₀ h.1 + have hssub : {c ∈ Γ'.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - k₀} ⊂ + {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - k₀} := + ⟨hsub_τ ⟨k₀, hk₀_lt⟩, fun h => hc₀_not_new (h hc₀_in_old)⟩ + have hfin_old : {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - k₀}.Finite := + π.Γ.finite_cells.subset fun _ h => h.1 + have hlt_ncard := ncard_lt_ncard hssub hfin_old + simp only [Portrayal.truth, π', removeDiscPortrayal, hk₀_lt, ↓reduceIte] + exact hlt_ncard + · have hC_same : Γ'.C = π.Γ.C := by + rw [hC'] + refine Subset.antisymm (fun _ h => h.1) fun c hc => ⟨hc, ?_⟩ + rcases hdich c hc with hc_in | hc_out + · exfalso; exact hI₁_ne ⟨c, hc, hc_in.trans sdiff_subset⟩ + · exact hc_out + rcases hne_U with ⟨n₀, hn₀_open, hn₀_U⟩ + have hn₀_N : n₀ ∈ π.Γ.N := by + by_contra hn₀_notN + have : n₀ ∈ ⋃₀ π.Γ.C := by rw [π.Γ.sUnion_cells]; exact ⟨hn₀_U, hn₀_notN⟩ + rcases this with ⟨c, hc, hnc⟩ + have hc_out : c ⊆ Set.univ \ Δ := by + have : c ∈ Γ'.C := hC_same.symm ▸ hc + rw [hC'] at this + exact this.2 + exact (hc_out hnc).2 hn₀_open.1 + have hn₀_not_bd : n₀ ∉ bd π.S := fun h => hn₀_open.2 (hbd_sub ⟨hn₀_open.1, h⟩) + have hn₀_not_N' : n₀ ∉ Γ'.N := fun h => (hN'_sub h).2 hn₀_open + refine ⟨⟨4, by decide⟩, fun i hi => ?_, ?_⟩ + · have hi4 : i.1 < 4 := hi + simp only [Portrayal.truth, π', removeDiscPortrayal, hi4, ↓reduceIte, hC_same] + · have hssub : Γ'.N \ bd π.S ⊂ π.Γ.N \ bd π.S := + ⟨sdiff_le_sdiff_right (hN'_sub.trans sdiff_subset), + fun h => hn₀_not_N' (h ⟨hn₀_N, hn₀_not_bd⟩).1⟩ + simp only [Portrayal.truth, π', removeDiscPortrayal] + exact ncard_lt_ncard hssub (π.Γ.finite_N.subset sdiff_subset) + · exact Or.inl hne_U + +/-- Existential form of **Graph Minors XVII, (7.1)** (page 178). + +"Let $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a $\mathcal{T}$-central portrayal of a +hypergraph $G$. Let $\Delta \subseteq \Sigma$ be a disc with $bd(\Delta)$ $\Gamma$-normal and +$|bd(\Delta) \cap N(\Gamma)| \le 1$, such that $\alpha(\Delta)$ is small. Let $c' \in C(\Gamma)$ +with $c' \subseteq \Sigma - \Delta$, chosen with $\tilde{c}' \cap bd(\Delta) \ne \emptyset$ if +possible. If $\tilde{c}' \cap bd(\Delta) \ne \emptyset$, let $\Gamma' = (U(\Gamma) \cap +\overline{\Sigma - \Delta}, N(\Gamma) \cap \overline{\Sigma - \Delta})$. If $\tilde{c}' \cap +bd(\Delta) = \emptyset$, let $\Gamma' = (U(\Gamma) - \Delta, N(\Gamma) - \Delta)$. Define +$$ \begin{aligned} \alpha'(c') &= \alpha(c') \cup \alpha(\Delta) \\ \alpha'(c) &= \alpha(c) \quad (c +\in C(\Gamma') - \{c'\}) \\ \gamma' &= \gamma \mid N(\Gamma'). \end{aligned} $$ +Then $\pi' = (\Sigma, \Gamma', \alpha', \beta, \gamma')$ is a $\mathcal{T}$-central portrayal of +$G$ resembling $\pi$." + +The Lean proof builds the removal portrayal. The existential conclusion records centrality, +resemblance and the original surface. It also records that the portrayal is truer when the +interior of the removed disc meets the drawing. -/ +theorem theorem_7_1_proof {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) (hcentral : π.IsCentral 𝒯) + {Δ : Set π.S} (hΔ : IsClosedDisc Δ) (hnorm : discBd Δ ∩ π.Γ.U ⊆ π.Γ.N) + (hcard : (discBd Δ ∩ π.Γ.N).ncard ≤ 1) + (hsmall : IsSmallWrt 𝒯 (π.areaGraph Δ)) + {c' : Set π.S} (hc' : c' ∈ π.Γ.C) (hc'_out : c' ⊆ Set.univ \ Δ) + (hchoice : (∃ c ∈ π.Γ.C, c ⊆ Set.univ \ Δ ∧ (tilde c ∩ discBd Δ).Nonempty) → + (tilde c' ∩ discBd Δ).Nonempty) : + ∃ π' : Portrayal G, + π'.S = π.S ∧ + π'.IsCentral 𝒯 ∧ + π'.Resembles π ∧ + ((¬ ((Δ \ discBd Δ) ∩ π.Γ.U).Nonempty) ∨ π'.IsTruer π) := by + classical + have hS : IsSurface π.S := π.isSurface + have : T2Space π.S := hS.2.1 + obtain ⟨hopen, _, hbd_sub, _, _⟩ := isOpen_and_disjoint_bd_of_isClosedDisc hS hΔ + obtain ⟨hdich, hbd_cells, hN_bd_cl⟩ := normal_disc_cell_dichotomy hS π.Γ hΔ hnorm + set Γ' : Painting π.S := π.Γ.removeDisc hS Δ hΔ hnorm + have hC' : Γ'.C = {c ∈ π.Γ.C | c ⊆ Set.univ \ Δ} := + π.Γ.removeDisc_C hS Δ hΔ hnorm + have hN'_sub : Γ'.N ⊆ π.Γ.N \ (Δ \ discBd Δ) := + π.Γ.removeDisc_N_subset hS Δ hΔ hnorm + have hN'_bd : Γ'.N ∩ bd π.S = π.Γ.N ∩ bd π.S := + π.Γ.removeDisc_N_inter_bd hS Δ hΔ hnorm + have hc'_mem : c' ∈ Γ'.C := by + rw [hC'] + exact ⟨hc', hc'_out⟩ + set I₁ : Set (Set π.S) := {c ∈ π.Γ.C | c ⊆ Δ} + set I₂ : Set (Set π.S) := {c ∈ π.Γ.C | c ⊆ Set.univ \ Δ} + have hpart : I₁ ∪ I₂ = π.Γ.C := by + ext c + simp only [I₁, I₂, mem_union, mem_sep_iff] + refine ⟨fun h => h.elim And.left And.left, fun hc => ?_⟩ + rcases hdich c hc with h | h + · exact Or.inl ⟨hc, h.trans sdiff_subset⟩ + · exact Or.inr ⟨hc, h⟩ + have hdisj_I : Disjoint I₁ I₂ := by + refine Set.disjoint_left.mpr fun c ⟨hc, hc₁⟩ ⟨_, hc₂⟩ => ?_ + obtain ⟨x, hxc⟩ := π.Γ.cell_nonempty hc + exact (hc₂ hxc).2 (hc₁ hxc) + have hI₁_eq : π.areaGraph Δ = π.cellsUnion I₁ := by + have h1 : π.areaGraph Δ ≤ G := hsmall.le_G h𝒯 + have h2 : π.cellsUnion I₁ ≤ G := π.cellsUnion_le I₁ + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq h1 h2 + · ext v; simp [Portrayal.areaGraph, Portrayal.cellsUnion, I₁] + · ext e; simp [Portrayal.areaGraph, Portrayal.cellsUnion, I₁] + have hI₁_le : π.areaGraph Δ ≤ G := hsmall.le_G h𝒯 + -- Key separation property from (2.1): any vertex in `V(α(Δ)) ∩ ⋃_{c ∈ I₂} V(α(c))` + -- lies in `γ(tilde c' ∩ discBd Δ ∩ domγ) ⊆ V(α(c'))` + have hinter_sub : (π.areaGraph Δ).vertexSet ∩ (π.cellsUnion I₂).vertexSet ⊆ + π.nodeVertex '' (tilde c' ∩ discBd Δ ∩ π.domγ) := by + have hv_inter := theorem_2_1_claim_3 π hpart hdisj_I + intro v hv + have hv' : v ∈ (π.cellsUnion I₁ ∩ π.cellsUnion I₂).vertexSet := by + change v ∈ (π.cellsUnion I₁).vertexSet ∩ (π.cellsUnion I₂).vertexSet + rwa [← hI₁_eq] + rcases hv_inter hv' with ⟨n, ⟨⟨hX₁, hX₂⟩, hdom⟩, rfl⟩ | hY + · rw [mem_iUnion₂] at hX₁ hX₂ + rcases hX₁ with ⟨c₁, hc₁, hnc₁⟩ + rcases hX₂ with ⟨c₂, hc₂, hnc₂⟩ + have hcl_Δ : closure Δ = Δ := (isClosed_of_isClosedDisc hΔ).closure_eq + have hnΔ : n ∈ Δ := hcl_Δ ▸ closure_mono hc₁.2 hnc₁.1 + have hcl := (closure_cell_inter_disc_of_subset_compl hS π.Γ hΔ hnorm hc₂.1 hc₂.2).2 + have hnbdΔ : n ∈ discBd Δ := by + have : n ∈ closure c₂ ∩ Δ := ⟨hnc₂.1, hnΔ⟩ + rw [hcl] at this + exact this.2 + have hex_touch : ∃ c ∈ π.Γ.C, c ⊆ Set.univ \ Δ ∧ (tilde c ∩ discBd Δ).Nonempty := + ⟨c₂, hc₂.1, hc₂.2, n, hnc₂, hnbdΔ⟩ + obtain ⟨n', hn'_t, hn'_bd⟩ := hchoice hex_touch + have hn_eq : n = n' := by + by_contra hne + have hpair : ({n, n'} : Set π.S) ⊆ discBd Δ ∩ π.Γ.N := by + rintro z (rfl | rfl) + · exact ⟨hnbdΔ, π.domγ_subset hdom⟩ + · exact ⟨hn'_bd, π.Γ.tilde_subset_N hc' hn'_t⟩ + have hfin : (discBd Δ ∩ π.Γ.N).Finite := π.Γ.finite_N.subset inter_subset_right + have h2 : 2 ≤ (discBd Δ ∩ π.Γ.N).ncard := by + rw [← ncard_pair hne] + exact ncard_le_ncard hpair hfin + omega + subst hn_eq + exact ⟨n, ⟨⟨hn'_t, hnbdΔ⟩, hdom⟩, rfl⟩ + · exfalso + rw [mem_iUnion₂] at hY + rcases hY with ⟨n, ⟨hY₁, _⟩, _⟩ + rw [mem_iUnion₂] at hY₁ + rcases hY₁ with ⟨c₁, ⟨hc₁, hbd₁⟩, _⟩ + exact Set.disjoint_left.mp hdisj_I hc₁ ⟨hc₁.1, hbd_cells c₁ hc₁.1 hbd₁⟩ + have hinter_sub_c' : (π.areaGraph Δ).vertexSet ∩ (π.cellsUnion I₂).vertexSet ⊆ + (π.cellGraph c').vertexSet := by + intro v hv + rcases hinter_sub hv with ⟨n, ⟨⟨hnt, _⟩, hdom⟩, rfl⟩ + exact π.p2 c' hc' n ⟨hnt, hdom⟩ + have htilde_sub_N' : ∀ c ∈ Γ'.C, tilde c ⊆ Γ'.N := + fun c hc => Γ'.tilde_subset_N hc + -- Define `π'` + let cellG : Set π.S → Hypergraph α β := fun c => + if c = c' then π.cellGraph c' ∪ π.areaGraph Δ else π.cellGraph c + let π' := removeDiscPortrayal π Δ c' hc' hdich Γ' hN'_sub hN'_bd hc'_mem hC' hdisj_I hI₁_le + hinter_sub_c' htilde_sub_N' + -- Check that `π'` is `𝒯`-central + have hcentral' : π'.IsCentral 𝒯 := by + intro c hc + change IsSmallWrt 𝒯 (cellG c) + rw [hC'] at hc + dsimp only [cellG] + split_ifs with hcc' + · obtain ⟨B₁, hB₁⟩ := hcentral c' hc' + have hord_B₁ : separationOrder (π.cellGraph c') B₁ < θ := h𝒯.order_lt hB₁ + have hatt_sub : attachments G (π.cellGraph c' ∪ π.areaGraph Δ) ⊆ + (π.cellGraph c').vertexSet ∩ B₁.vertexSet := by + rintro v ⟨hv_union, e, ⟨heG, he_not⟩, hinc⟩ + rcases π.p1_edge e heG with ⟨d, hd, hed⟩ + have hd_I₂ : d ∈ I₂ ∧ d ≠ c' := by + rcases hdich d hd with hd_in | hd_out + · exfalso + apply he_not + right + exact mem_iUnion₂.mpr ⟨d, ⟨⟨hd, hd_in.trans sdiff_subset⟩, hd⟩, hed⟩ + · refine ⟨⟨hd, hd_out⟩, fun h => he_not (Or.inl (h ▸ hed))⟩ + have hvd : v ∈ (π.cellGraph d).vertexSet := + (π.cellGraph d).vertex_mem_of_inc ((inc_iff_of_le (π.cellGraph_le d hd) hed).mpr hinc) + have hvc' : v ∈ (π.cellGraph c').vertexSet := by + rcases hv_union with hvc' | hvΔ + · exact hvc' + · exact hinter_sub_c' ⟨hvΔ, mem_iUnion₂.mpr ⟨d, ⟨hd_I₂.1, hd_I₂.1.1⟩, hvd⟩⟩ + have he_not_c' : e ∉ (π.cellGraph c').edgeSet := fun h => he_not (Or.inl h) + have hsep₁ := h𝒯.isSeparation hB₁ + have heB₁ : e ∈ B₁.edgeSet := by + have h_union : e ∈ (π.cellGraph c' ∪ B₁).edgeSet := by + rw [hsep₁.union_eq]; exact heG + exact h_union.resolve_left he_not_c' + exact ⟨hvc', B₁.vertex_mem_of_inc ((inc_iff_of_le hsep₁.right_le heB₁).mpr hinc)⟩ + have hfin_B₁ : ((π.cellGraph c').vertexSet ∩ B₁.vertexSet).Finite := + (π.cellGraph c').vertexSet_finite.subset inter_subset_left + have hatt_lt : (attachments G (π.cellGraph c' ∪ π.areaGraph Δ)).ncard < θ := + lt_of_le_of_lt (ncard_le_ncard hatt_sub hfin_B₁) hord_B₁ + exact IsSmallWrt.union h𝒯 (hcentral c' hc') hsmall hatt_lt + · exact hcentral c hc.1 + -- Check that `π'` has the same warp as `π` at every cuff `Θ` + have hwarp_eq := + removeDiscWarpAt π Δ c' hc' hdich Γ' hN'_sub hN'_bd hc'_mem hC' hdisj_I hI₁_le hinter_sub_c' + htilde_sub_N' hcard hbd_cells hinter_sub + have hresembles : π'.Resembles π := by + refine ⟨Homeomorph.refl π.S, fun Θ hΘ => ?_⟩ + have himg : (Homeomorph.refl π.S : π.S → π.S) '' Θ = Θ := image_id Θ + rw [himg] + exact hwarp_eq Θ hΘ + -- Check trueness when `((Δ \ discBd Δ) ∩ π.Γ.U).Nonempty` + refine ⟨π', rfl, hcentral', hresembles, ?_⟩ + exact removeDiscTruth π Δ c' hc' hdich Γ' hN'_sub hN'_bd hc'_mem hC' hdisj_I hI₁_le hinter_sub_c' + htilde_sub_N' hbd_sub hbd_cells + +end Theorem71 + +/-! ## 3. Replacing a Normal Disc with at Most Three Boundary Nodes ((7.2), Page 178) -/ + +section Theorem72 + +variable {S : Type} [TopologicalSpace S] + +/-- For a closed disc $\Delta \subseteq S$ in a Hausdorff space $S$ and any subset +$F \subseteq \operatorname{discBd} \Delta$, the difference $\Delta \setminus F$ is nonempty, +path-connected, and has closure $\overline{\Delta \setminus F} = \Delta$. -/ +theorem isClosedDisc_sdiff_subset_discBd [T2Space S] {Δ F : Set S} + (hΔ : IsClosedDisc Δ) (hF : F ⊆ discBd Δ) : + (Δ \ F).Nonempty ∧ IsPathConnected (Δ \ F) ∧ closure (Δ \ F) = Δ := by + exact hΔ.sdiff_of_inter_subset_discBd (inter_subset_left.trans hF) + +/-- The modified painting $\Gamma' = (U(\Gamma) \cup \Delta, N(\Gamma) \cap \overline{\Sigma +\setminus \Delta})$ +in Graph Minors XVII, (7.2) (page 178), replacing the interior of a $\Gamma$-normal closed disc +$\Delta$ with $|\operatorname{discBd} \Delta \cap N(\Gamma)| \le 3$ by a single internal cell +$c' = \Delta \setminus (\operatorname{discBd} \Delta \cap N(\Gamma))$. -/ +noncomputable def Painting.replaceDiscWithCells (hS : IsSurface S) (Γ : Painting S) (Δ : Set S) + (hΔ : IsClosedDisc Δ) (hnorm : discBd Δ ∩ Γ.U ⊆ Γ.N) + (hcard : (discBd Δ ∩ Γ.N).ncard ≤ 3) : + {Γ' : Painting S // Γ'.C = insert (Δ \ (discBd Δ ∩ Γ.N)) {c ∈ Γ.C | c ⊆ Set.univ \ Δ}} := by + classical + have : T2Space S := hS.2.1 + obtain ⟨hopen, hdisj_bd, hbd_sub, _, _⟩ := isOpen_and_disjoint_bd_of_isClosedDisc hS hΔ + obtain ⟨hdich, hbd_cells, hN_bd_cl⟩ := normal_disc_cell_dichotomy hS Γ hΔ hnorm + let U' : Set S := Γ.U ∪ Δ + let N' : Set S := Γ.N ∩ closure (Set.univ \ Δ) + let c' : Set S := Δ \ (discBd Δ ∩ Γ.N) + set I₂ : Set (Set S) := {c ∈ Γ.C | c ⊆ Set.univ \ Δ} + have hI₂_fin : I₂.Finite := Γ.finite_cells.subset fun _ h => h.1 + have hΔ_inter_N' : Δ ∩ N' = discBd Δ ∩ Γ.N := by + refine Subset.antisymm ?_ (fun x hx => ⟨discBd_subset Δ hx.1, hx.2, hN_bd_cl hx⟩) + rintro x ⟨hxΔ, hxN, hxcl⟩ + refine ⟨?_, hxN⟩ + by_contra hx_not_bd + have hx_open : x ∈ Δ \ discBd Δ := ⟨hxΔ, hx_not_bd⟩ + have hdisj : Disjoint (Δ \ discBd Δ) (Set.univ \ Δ) := + Set.disjoint_left.mpr fun y hy₁ hy₂ => hy₂.2 hy₁.1 + exact Set.disjoint_left.mp (hdisj.closure_right hopen) hx_open hxcl + have hc'_eq : c' = Δ \ N' := by + change Δ \ (discBd Δ ∩ Γ.N) = Δ \ N' + rw [← hΔ_inter_N'] + ext x; simp + have hΔ_bd_sub : Δ ∩ bd S ⊆ discBd Δ ∩ Γ.N := fun x ⟨hxΔ, hxbd⟩ => + ⟨hbd_sub ⟨hxΔ, hxbd⟩, hnorm ⟨hbd_sub ⟨hxΔ, hxbd⟩, Γ.bd_subset hxbd⟩⟩ + have hc'_disj_bd : Disjoint c' (bd S) := + Set.disjoint_left.mpr fun x ⟨hxΔ, hxnot⟩ hxbd => hxnot (hΔ_bd_sub ⟨hxΔ, hxbd⟩) + obtain ⟨hc'_ne, hc'_pc, hc'_cl⟩ := + isClosedDisc_sdiff_subset_discBd hΔ (inter_subset_left : discBd Δ ∩ Γ.N ⊆ discBd Δ) + have htilde_c' : tilde c' = discBd Δ ∩ Γ.N := by + change closure c' \ c' = _ + rw [hc'_cl] + change Δ \ (Δ \ (discBd Δ ∩ Γ.N)) = _ + rw [Set.sdiff_sdiff_right_self, inter_eq_right.mpr (inter_subset_left.trans (discBd_subset Δ))] + have hcov : ⋃₀ insert c' I₂ = U' \ N' := by + ext x + simp only [sUnion_insert, mem_union, mem_sUnion, mem_sdiff] + constructor + · rintro (hxc' | ⟨c, ⟨hc, hc_sub⟩, hxc⟩) + · rw [hc'_eq] at hxc' + exact ⟨Or.inr hxc'.1, hxc'.2⟩ + · refine ⟨Or.inl (Γ.cell_subset_U hc hxc), fun hxN' => ?_⟩ + exact (Γ.cell_subset_diff hc hxc).2 hxN'.1 + · rintro ⟨hxU | hxΔ, hxN'⟩ + · by_cases hxΔ : x ∈ Δ + · left + rw [hc'_eq] + exact ⟨hxΔ, hxN'⟩ + · right + have hx_compl : x ∈ Set.univ \ Δ := ⟨ trivial, hxΔ ⟩ + have hxN : x ∉ Γ.N := fun hxN => hxN' ⟨hxN, subset_closure hx_compl⟩ + have hx_sUnion : x ∈ ⋃₀ Γ.C := by rw [Γ.sUnion_cells]; exact ⟨hxU, hxN⟩ + rcases hx_sUnion with ⟨c, hc, hxc⟩ + rcases hdich c hc with hc_in | hc_out + · exact False.elim (hxΔ (hc_in hxc).1) + · exact ⟨c, ⟨hc, hc_out⟩, hxc⟩ + · left + rw [hc'_eq] + exact ⟨hxΔ, hxN'⟩ + have hC_eq : arcComponentsIn (U' \ N') = insert c' I₂ := by + apply arcComponentsIn_eq_of_finite_cover (hI₂_fin.insert c') hcov + · rintro c (rfl | hcI₂) + · exact hc'_ne + · exact Γ.cell_nonempty hcI₂.1 + · rintro c (rfl | hcI₂) + · exact hc'_pc + · exact Γ.cell_isPathConnected hcI₂.1 + · rintro c₁ (rfl | hc₁) c₂ (rfl | hc₂) hne + · exact (hne rfl).elim + · exact Set.disjoint_left.mpr fun x hxc' hxc₂ => (hc₂.2 hxc₂).2 hxc'.1 + · exact Set.disjoint_left.mpr fun x hxc₁ hxc' => (hc₁.2 hxc₁).2 hxc'.1 + · exact Γ.cell_disjoint hc₁.1 hc₂.1 hne + · rintro c (rfl | hcI₂) + · refine Subset.antisymm ?_ (fun x hxc => ⟨subset_closure hxc, + hcov ▸ mem_sUnion_of_mem hxc (mem_insert _ _)⟩) + rintro x ⟨hxcl, _, hxN'⟩ + rw [hc'_cl] at hxcl + rw [hc'_eq] + exact ⟨hxcl, hxN'⟩ + · refine Subset.antisymm ?_ (fun x hxc => ⟨subset_closure hxc, + hcov ▸ mem_sUnion_of_mem hxc (mem_insert_of_mem _ hcI₂)⟩) + rintro x ⟨hxcl, _, hxN'⟩ + have hcl_sub := (closure_cell_inter_disc_of_subset_compl hS Γ hΔ hnorm hcI₂.1 hcI₂.2).1 + have hxN : x ∉ Γ.N := fun hxN => hxN' ⟨hxN, hcl_sub hxcl⟩ + rw [← Γ.closure_cell_diff_N hcI₂.1] + exact ⟨hxcl, hxN⟩ + refine ⟨?_, ?_⟩ + · exact + { U := U' + N := N' + isClosed_U := Γ.isClosed_U.union hΔ.isCompact.isClosed + bd_subset := Γ.bd_subset.trans subset_union_left + N_subset := (inter_subset_left.trans Γ.N_subset).trans subset_union_left + finite_N := Γ.finite_N.subset inter_subset_left + finite_cells := hC_eq ▸ hI₂_fin.insert c' + cell_disc := fun c hc => by + rw [hC_eq] at hc + rcases hc with rfl | hcI₂ + · rw [hc'_cl, htilde_c'] + exact ⟨hΔ, inter_subset_left, Γ.finite_N.inter_of_right (discBd Δ), hcard⟩ + · exact Γ.cell_disc c hcI₂.1 + border_cell := fun c hc hbd => by + rw [hC_eq] at hc + rcases hc with rfl | hcI₂ + · exact False.elim (Set.not_nonempty_iff_eq_empty.mpr + (Set.disjoint_iff_inter_eq_empty.mp hc'_disj_bd) hbd) + · exact Γ.border_cell c hcI₂.1 hbd } + · exact hC_eq + +/-- The painting obtained by replacing a disc. -/ +noncomputable def Painting.replaceDisc (hS : IsSurface S) (Γ : Painting S) (Δ : Set S) + (hΔ : IsClosedDisc Δ) (hnorm : discBd Δ ∩ Γ.U ⊆ Γ.N) + (hcard : (discBd Δ ∩ Γ.N).ncard ≤ 3) : Painting S := + (Γ.replaceDiscWithCells hS Δ hΔ hnorm hcard).1 + +theorem Painting.replaceDisc_C (hS : IsSurface S) (Γ : Painting S) (Δ : Set S) + (hΔ : IsClosedDisc Δ) (hnorm : discBd Δ ∩ Γ.U ⊆ Γ.N) + (hcard : (discBd Δ ∩ Γ.N).ncard ≤ 3) : + (Γ.replaceDisc hS Δ hΔ hnorm hcard).C = + insert (Δ \ (discBd Δ ∩ Γ.N)) {c ∈ Γ.C | c ⊆ Set.univ \ Δ} := + (Γ.replaceDiscWithCells hS Δ hΔ hnorm hcard).2 + +/-- Given a subhypergraph $H \le G$ and a vertex subset $W \subseteq V(G)$, the minimal +subhypergraph $A \le G$ with $H \le A$ and $W \subseteq V(A)$ is $H \cup \text{discrete}(W)$, +having vertex set $V(H) \cup W$ and edge set $E(H)$. -/ +@[expose] +def addVerticesSubhypergraph {α : Type u} {β : Type v} (G H : Hypergraph α β) (W : Set α) + (_hH : H ≤ G) (hW : W ⊆ G.vertexSet) : Hypergraph α β := + H ∪ discreteSubhypergraph G W hW + +theorem addVerticesSubhypergraph_le {α : Type u} {β : Type v} {G H : Hypergraph α β} {W : Set α} + (hH : H ≤ G) (hW : W ⊆ G.vertexSet) : + addVerticesSubhypergraph G H W hH hW ≤ G := + union_le hH ⟨hW, empty_subset _, fun _ h => h.elim⟩ + +@[simp] +theorem addVerticesSubhypergraph_vertexSet {α : Type u} {β : Type v} {G H : Hypergraph α β} + {W : Set α} (_hH : H ≤ G) (hW : W ⊆ G.vertexSet) : + (addVerticesSubhypergraph G H W _hH hW).vertexSet = H.vertexSet ∪ W := rfl + +@[simp] +theorem addVerticesSubhypergraph_edgeSet {α : Type u} {β : Type v} {G H : Hypergraph α β} + {W : Set α} (_hH : H ≤ G) (hW : W ⊆ G.vertexSet) : + (addVerticesSubhypergraph G H W _hH hW).edgeSet = H.edgeSet := + union_empty H.edgeSet + +private def discBorderVertices {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Δ : Set π.S) : Set α := + π.nodeVertex '' (discBd Δ ∩ π.domγ) + +private def replacementDiscGraph {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Δ : Set π.S) (hle : π.areaGraph Δ ≤ G) + (hsub : discBorderVertices π Δ ⊆ G.vertexSet) : Hypergraph α β := + addVerticesSubhypergraph G (π.areaGraph Δ) (discBorderVertices π Δ) hle hsub + +private noncomputable abbrev replaceDiscPortrayal + {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) + (Δ : Set π.S) + (hnode : ∀ n ∈ discBd Δ ∩ π.domγ, ∃ d ∈ π.Γ.C, n ∈ tilde d) + (hdich : ∀ c ∈ π.Γ.C, c ⊆ Δ \ discBd Δ ∨ c ⊆ univ \ Δ) + (Γ' : Painting π.S) + (c' : Set π.S) + (hC' : Γ'.C = insert c' (discOutsideCells π Δ)) + (hc'_mem : c' ∈ Γ'.C) + (htilde_c' : tilde c' = discBd Δ ∩ π.Γ.N) + (hc'_not_bd : ¬(c' ∩ bd π.S).Nonempty) + (hc'_not_I₂ : c' ∉ (discOutsideCells π Δ)) + (hN'_sub : Γ'.N ⊆ π.Γ.N \ (Δ \ discBd Δ)) + (hN'_bd : Γ'.N ∩ bd π.S = π.Γ.N ∩ bd π.S) + (hdisj_I : Disjoint (discInsideCells π Δ) (discOutsideCells π Δ)) + (hI₁_le : π.areaGraph Δ ≤ G) + (hW_bd_sub : (discBorderVertices π Δ) ⊆ G.vertexSet) + (hA_le : (replacementDiscGraph π Δ hI₁_le hW_bd_sub) ≤ G) + (hA_inter_I₂ : (replacementDiscGraph π Δ hI₁_le hW_bd_sub).vertexSet ∩ (π.cellsUnion + (discOutsideCells π Δ)).vertexSet ⊆ (discBorderVertices π Δ)) + (htilde_sub_N' : ∀ c ∈ Γ'.C, tilde c ⊆ Γ'.N) + : Portrayal G := open Classical in + let I₂ := discOutsideCells π Δ + let W_bd := discBorderVertices π Δ + let A := replacementDiscGraph π Δ hI₁_le hW_bd_sub + let cellG : Set π.S → Hypergraph α β := fun c => + if c = c' then A else π.cellGraph c + have common_cell_membership : ∀ c ∈ I₂, ∀ d' ∈ Γ'.C, d' ≠ c → ∀ v ∈ (cellG d').vertexSet, + (∃ d₀ ∈ π.Γ.C, d₀ ≠ c ∧ v ∈ (π.cellGraph d₀).vertexSet) ∨ v ∈ W_bd := by + intro c hc_I₂ d' hd' hne v hvd' + dsimp only [cellG] at hvd' + split_ifs at hvd' with hd'_eq + · rcases hvd' with hvΔ | hvW + · rcases mem_iUnion₂.mp hvΔ with ⟨c₀, hc₀, hvc₀⟩ + have hc₀_ne : c₀ ≠ c := fun h => + Set.disjoint_left.mp hdisj_I hc₀.1 (h ▸ hc_I₂) + exact Or.inl ⟨c₀, hc₀.2, hc₀_ne, hvc₀⟩ + · exact Or.inr hvW + · have hd'_I₂ : d' ∈ I₂ := (hC' ▸ hd').resolve_left hd'_eq + exact Or.inl ⟨d', hd'_I₂.1, hne, hvd'⟩ + { S := π.S + top := π.top + isSurface := π.isSurface + connected := π.connected + Γ := Γ' + cellGraph := cellG + borderSet := π.borderSet + domγ := π.domγ ∩ Γ'.N + nodeVertex := π.nodeVertex + cellGraph_le := fun c hc => by + rw [hC'] at hc + dsimp only [cellG] + split_ifs with hcc' + · exact hA_le + · exact π.cellGraph_le c (hc.resolve_left hcc').1 + borderSet_subset := fun n hn => by + rw [hN'_bd] at hn + exact π.borderSet_subset n hn + domγ_subset := inter_subset_right + nodeVertex_mem := fun n hn => π.nodeVertex_mem n hn.1 + nodeVertex_injOn := π.nodeVertex_injOn.mono inter_subset_left + p1_vertex := fun v hv => by + rcases π.p1_vertex v hv with ⟨c, hc, hvc⟩ + rcases hdich c hc with hc_in | hc_out + · refine ⟨c', hc'_mem, ?_⟩ + change v ∈ (if c' = c' then A else π.cellGraph c').vertexSet + simp only [↓reduceIte, A, replacementDiscGraph, addVerticesSubhypergraph_vertexSet] + left + exact mem_iUnion₂.mpr ⟨c, ⟨⟨hc, hc_in.trans sdiff_subset⟩, hc⟩, hvc⟩ + · refine ⟨c, hC'.symm ▸ mem_insert_of_mem c' ⟨hc, hc_out⟩, ?_⟩ + have hne : c ≠ c' := fun h => hc'_not_I₂ (h ▸ ⟨hc, hc_out⟩) + dsimp only [cellG] + rw [ite_eq_right hne] + exact hvc + p1_edge := fun e he => by + rcases π.p1_edge e he with ⟨c, hc, hec⟩ + rcases hdich c hc with hc_in | hc_out + · refine ⟨c', hc'_mem, ?_⟩ + change e ∈ (if c' = c' then A else π.cellGraph c').edgeSet + simp only [↓reduceIte, A, replacementDiscGraph, addVerticesSubhypergraph_edgeSet] + exact mem_iUnion₂.mpr ⟨c, ⟨⟨hc, hc_in.trans sdiff_subset⟩, hc⟩, hec⟩ + · refine ⟨c, hC'.symm ▸ mem_insert_of_mem c' ⟨hc, hc_out⟩, ?_⟩ + have hne : c ≠ c' := fun h => hc'_not_I₂ (h ▸ ⟨hc, hc_out⟩) + dsimp only [cellG] + rw [ite_eq_right hne] + exact hec + p1_disjoint := fun c₁ hc₁ c₂ hc₂ hne => by + rw [hC'] at hc₁ hc₂ + dsimp only [cellG] + split_ifs with h1 h2 h2 + · exact False.elim (hne (h1.trans h2.symm)) + · dsimp only [A, replacementDiscGraph] + rw [addVerticesSubhypergraph_edgeSet] + have hc₂' : c₂ ∈ I₂ := hc₂.resolve_left h2 + rw [Set.disjoint_left] + intro e he₁ he₂ + rcases mem_iUnion₂.mp he₁ with ⟨c₀, hc₀, hec₀⟩ + have hc₀_ne : c₀ ≠ c₂ := fun h => + Set.disjoint_left.mp hdisj_I hc₀.1 (h ▸ hc₂') + exact Set.disjoint_left.mp (π.p1_disjoint c₀ hc₀.2 c₂ hc₂'.1 hc₀_ne) hec₀ he₂ + · dsimp only [A, replacementDiscGraph] + rw [addVerticesSubhypergraph_edgeSet] + have hc₁' : c₁ ∈ I₂ := hc₁.resolve_left h1 + rw [Set.disjoint_left] + intro e he₁ he₂ + rcases mem_iUnion₂.mp he₂ with ⟨c₀, hc₀, hec₀⟩ + have hc₁_ne : c₁ ≠ c₀ := fun h => + Set.disjoint_left.mp hdisj_I hc₀.1 (h ▸ hc₁') + exact Set.disjoint_left.mp (π.p1_disjoint c₁ hc₁'.1 c₀ hc₀.2 hc₁_ne) he₁ hec₀ + · exact π.p1_disjoint c₁ (hc₁.resolve_left h1).1 c₂ (hc₂.resolve_left h2).1 hne + p2 := fun c hc n hn => by + rw [hC'] at hc + dsimp only [cellG] + split_ifs with hcc' + · subst c + rw [htilde_c'] at hn + simp only [A, replacementDiscGraph, addVerticesSubhypergraph_vertexSet] + exact Or.inr ⟨n, ⟨hn.1.1, hn.2.1⟩, rfl⟩ + · exact π.p2 c (hc.resolve_left hcc').1 n ⟨hn.1, hn.2.1⟩ + p3_notMem := fun n hn => π.p3_notMem n ⟨hn.1.1, hn.2⟩ + p3_subset := fun c hc hbd n hnt v hv => by + rw [hC'] at hc + have hne : c ≠ c' := fun h => hc'_not_bd (h ▸ hbd) + dsimp only [cellG] + rw [ite_eq_right hne] + exact π.p3_subset c (hc.resolve_left hne).1 hbd n hnt hv + p4_disjoint := fun Θ₁ hΘ₁ Θ₂ hΘ₂ hne n₁ hn₁ n₂ hn₂ => + π.p4_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ hne n₁ ⟨(hN'_sub hn₁.1).1, hn₁.2⟩ n₂ ⟨(hN'_sub hn₂.1).1, hn₂.2⟩ + p4_notMem := fun Θ hΘ n₁ hn₁ n₂ hn₂ hnot => + π.p4_notMem Θ hΘ n₁ ⟨(hN'_sub hn₁.1).1, hn₁.2⟩ n₂ hn₂.1 hnot + p5 := fun c hc hint v hvc hex => by + rcases hex with ⟨d', hd', hne, hvd'⟩ + by_cases hcc' : c = c' + · subst c + have hd'_ne : d' ≠ c' := hne + have hd'_I₂ : d' ∈ I₂ := (hC' ▸ hd').resolve_left hd'_ne + dsimp only [cellG] at hvc hvd' + simp only [↓reduceIte] at hvc + rw [ite_eq_right hd'_ne] at hvd' + have hv₂ : v ∈ (π.cellsUnion I₂).vertexSet := + mem_iUnion₂.mpr ⟨d', ⟨hd'_I₂, hd'_I₂.1⟩, hvd'⟩ + rcases hA_inter_I₂ ⟨hvc, hv₂⟩ with ⟨n, ⟨hn_bd, hnγ⟩, rfl⟩ + have hn_tilde : n ∈ tilde c' := by + rw [htilde_c'] + exact ⟨hn_bd, π.domγ_subset hnγ⟩ + exact ⟨n, ⟨hn_tilde, hnγ, htilde_sub_N' c' hc hn_tilde⟩, rfl⟩ + · have hc_I₂ : c ∈ I₂ := (hC' ▸ hc).resolve_left hcc' + dsimp only [cellG] at hvc + rw [ite_eq_right hcc'] at hvc + have hv_or := common_cell_membership c hc_I₂ d' hd' hne v hvd' + rcases hv_or with hv_o | ⟨n, ⟨hn_bd, hnγ⟩, rfl⟩ + · rcases π.p5 c hc_I₂.1 hint v hvc hv_o with ⟨n, ⟨hn_t, hnγ⟩, rfl⟩ + exact ⟨n, ⟨hn_t, hnγ, htilde_sub_N' c hc hn_t⟩, rfl⟩ + · obtain ⟨d₀, hd₀, hnd₀⟩ := hnode n ⟨hn_bd, hnγ⟩ + by_cases hd₀_c : d₀ = c + · subst hd₀_c + exact ⟨n, ⟨hnd₀, hnγ, htilde_sub_N' d₀ hc hnd₀⟩, rfl⟩ + · have hvd₀ := π.p2 d₀ hd₀ n ⟨hnd₀, hnγ⟩ + rcases π.p5 c hc_I₂.1 hint (π.nodeVertex n) hvc ⟨d₀, hd₀, hd₀_c, hvd₀⟩ with + ⟨m, ⟨hm_t, hmγ⟩, hmv⟩ + exact ⟨m, ⟨hm_t, hmγ, htilde_sub_N' c hc hm_t⟩, hmv⟩ + p6 := fun c hc hbd v hvc hex => by + rcases hex with ⟨d', hd', hne, hvd'⟩ + have hne_c' : c ≠ c' := fun h => hc'_not_bd (h ▸ hbd) + have hc_I₂ : c ∈ I₂ := (hC' ▸ hc).resolve_left hne_c' + dsimp only [cellG] at hvc + rw [ite_eq_right hne_c'] at hvc + have hv_or := common_cell_membership c hc_I₂ d' hd' hne v hvd' + have hv_in : ∃ n ∈ tilde c, v ∈ π.borderSet n ∨ (n ∈ π.domγ ∧ v = π.nodeVertex n) := by + rcases hv_or with hv_o | ⟨n, ⟨hn_bd, hnγ⟩, rfl⟩ + · exact π.p6 c hc_I₂.1 hbd v hvc hv_o + · obtain ⟨d₀, hd₀, hnd₀⟩ := hnode n ⟨hn_bd, hnγ⟩ + by_cases hd₀_c : d₀ = c + · subst hd₀_c + exact ⟨n, hnd₀, Or.inr ⟨hnγ, rfl⟩⟩ + · have hvd₀ := π.p2 d₀ hd₀ n ⟨hnd₀, hnγ⟩ + exact π.p6 c hc_I₂.1 hbd (π.nodeVertex n) hvc ⟨d₀, hd₀, hd₀_c, hvd₀⟩ + rcases hv_in with ⟨n, hn_tilde, hvn_bs | ⟨hnγ, rfl⟩⟩ + · exact ⟨n, hn_tilde, Or.inl hvn_bs⟩ + · exact ⟨n, hn_tilde, Or.inr ⟨⟨hnγ, htilde_sub_N' c hc hn_tilde⟩, rfl⟩⟩ + p7 := p7_of_restricted_nodes π (fun _ hn => (hN'_sub hn).1) } + +private theorem replaceDiscWarpAt + {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) + (Δ : Set π.S) + (hnode : ∀ n ∈ discBd Δ ∩ π.domγ, ∃ d ∈ π.Γ.C, n ∈ tilde d) + (hdich : ∀ c ∈ π.Γ.C, c ⊆ Δ \ discBd Δ ∨ c ⊆ univ \ Δ) + (Γ' : Painting π.S) + (c' : Set π.S) + (hC' : Γ'.C = insert c' (discOutsideCells π Δ)) + (hc'_mem : c' ∈ Γ'.C) + (htilde_c' : tilde c' = discBd Δ ∩ π.Γ.N) + (hc'_not_bd : ¬(c' ∩ bd π.S).Nonempty) + (hc'_not_I₂ : c' ∉ (discOutsideCells π Δ)) + (hN'_sub : Γ'.N ⊆ π.Γ.N \ (Δ \ discBd Δ)) + (hN'_bd : Γ'.N ∩ bd π.S = π.Γ.N ∩ bd π.S) + (hdisj_I : Disjoint (discInsideCells π Δ) (discOutsideCells π Δ)) + (hI₁_le : π.areaGraph Δ ≤ G) + (hW_bd_sub : (discBorderVertices π Δ) ⊆ G.vertexSet) + (hA_le : (replacementDiscGraph π Δ hI₁_le hW_bd_sub) ≤ G) + (hA_inter_I₂ : (replacementDiscGraph π Δ hI₁_le hW_bd_sub).vertexSet ∩ (π.cellsUnion + (discOutsideCells π Δ)).vertexSet ⊆ (discBorderVertices π Δ)) + (htilde_sub_N' : ∀ c ∈ Γ'.C, tilde c ⊆ Γ'.N) + (hbd_cells : ∀ c ∈ π.Γ.C, (c ∩ bd π.S).Nonempty → c ⊆ univ \ Δ) : + let π' := replaceDiscPortrayal π Δ hnode hdich Γ' c' hC' hc'_mem htilde_c' hc'_not_bd hc'_not_I₂ + hN'_sub hN'_bd hdisj_I hI₁_le hW_bd_sub hA_le hA_inter_I₂ htilde_sub_N' + ∀ Θ ∈ cuffs π.S, π'.warpAt Θ = π.warpAt Θ := by + classical + intro π' + let I₂ := discOutsideCells π Δ + let A := replacementDiscGraph π Δ hI₁_le hW_bd_sub + let cellG : Set π.S → Hypergraph α β := fun c => + if c = c' then A else π.cellGraph c + have hborderPlus_eq : ∀ n ∈ π.Γ.N ∩ bd π.S, π'.borderPlus n = π.borderPlus n := by + intro n hn + have hn' : n ∈ Γ'.N := (hN'_bd.symm ▸ hn).1 + ext v + simp only [Portrayal.borderPlus, π', replaceDiscPortrayal, mem_inter_iff, mem_ofPred_eq] + exact ⟨fun h => h.elim Or.inl (fun ⟨⟨h1, _⟩, h2⟩ => Or.inr ⟨h1, h2⟩), + fun h => h.elim Or.inl (fun ⟨h1, h2⟩ => Or.inr ⟨⟨h1, hn'⟩, h2⟩)⟩ + intro Θ hΘ + have hΘ_sub : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x + have hcell_iff : ∀ (c : Set π.S) (q : ℕ), c ∈ Γ'.C → (c ∩ Θ).Nonempty → + (π'.CellWarpLE c q ↔ π.CellWarpLE c q) := by + intro c q hc hne_Θ + rw [hC'] at hc + have hne_c' : c ≠ c' := fun h => + hc'_not_bd (h ▸ hne_Θ.mono (inter_subset_inter_right _ hΘ_sub)) + have hc_I₂ : c ∈ I₂ := hc.resolve_left hne_c' + have hbd_c : (c ∩ bd π.S).Nonempty := hne_Θ.mono (inter_subset_inter_right _ hΘ_sub) + have htilde_bd : tilde c ⊆ π.Γ.N ∩ bd π.S := by + obtain ⟨u, w, _, htilde_uw, _, _, hu, hw⟩ := π.Γ.border_cell_exists_ends hc_I₂.1 hbd_c + rw [htilde_uw] + rintro x (rfl | rfl) <;> assumption + change (∀ n₁ ∈ tilde c, ∀ n₂ ∈ tilde c, n₁ ≠ n₂ → + (π.borderSet n₁).ncard ≤ q ∧ (π.borderSet n₂).ncard ≤ q ∧ + ((π'.borderPlus n₁).ncard = q + 1 → (π'.borderPlus n₂).ncard = q + 1 → + Portrayal.LinkagePairs (cellG c).skeleton (π'.borderPlus n₁) (π'.borderPlus n₂) + (q + 1) (π.nodeVertex n₁) (π.nodeVertex n₂))) ↔ + π.CellWarpLE c q + rw [show cellG c = π.cellGraph c from ite_eq_right hne_c'] + exact cellWarpLE_iff_of_borderPlus_eq π (fun n hn => hborderPlus_eq n (htilde_bd hn)) + exact cuffWarp_eq_of_cellWarpLE_iff + (C' := Γ'.C) (C := π.Γ.C) (Θ := Θ) (P' := π'.CellWarpLE) (P := π.CellWarpLE) + (fun c hne_Θ => by + rw [hC'] + have hbd_c : (c ∩ bd π.S).Nonempty := hne_Θ.mono (inter_subset_inter_right c hΘ_sub) + have hne_c' : c ≠ c' := fun h => hc'_not_bd (h ▸ hbd_c) + exact ⟨fun hc => (hc.resolve_left hne_c').1, + fun hc => mem_insert_of_mem c' ⟨hc, hbd_cells c hc hbd_c⟩⟩) + hcell_iff + +private theorem replaceDiscTruth + {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) + (Δ : Set π.S) + (hnode : ∀ n ∈ discBd Δ ∩ π.domγ, ∃ d ∈ π.Γ.C, n ∈ tilde d) + (hdich : ∀ c ∈ π.Γ.C, c ⊆ Δ \ discBd Δ ∨ c ⊆ univ \ Δ) + (Γ' : Painting π.S) + (c' : Set π.S) + (hC' : Γ'.C = insert c' (discOutsideCells π Δ)) + (hc'_mem : c' ∈ Γ'.C) + (htilde_c' : tilde c' = discBd Δ ∩ π.Γ.N) + (hc'_not_bd : ¬(c' ∩ bd π.S).Nonempty) + (hc'_not_I₂ : c' ∉ (discOutsideCells π Δ)) + (hN'_sub : Γ'.N ⊆ π.Γ.N \ (Δ \ discBd Δ)) + (hN'_bd : Γ'.N ∩ bd π.S = π.Γ.N ∩ bd π.S) + (hdisj_I : Disjoint (discInsideCells π Δ) (discOutsideCells π Δ)) + (hI₁_le : π.areaGraph Δ ≤ G) + (hW_bd_sub : (discBorderVertices π Δ) ⊆ G.vertexSet) + (hA_le : (replacementDiscGraph π Δ hI₁_le hW_bd_sub) ≤ G) + (hA_inter_I₂ : (replacementDiscGraph π Δ hI₁_le hW_bd_sub).vertexSet ∩ (π.cellsUnion + (discOutsideCells π Δ)).vertexSet ⊆ (discBorderVertices π Δ)) + (htilde_sub_N' : ∀ c ∈ Γ'.C, tilde c ⊆ Γ'.N) + (hbd_sub : Δ ∩ bd π.S ⊆ discBd Δ) + (hbd_cells : ∀ c ∈ π.Γ.C, (c ∩ bd π.S).Nonempty → c ⊆ univ \ Δ) + (c₀ : Set π.S) + (hc₀_C : c₀ ∈ π.Γ.C) + (hc₀_Δ : c₀ ⊆ Δ) + (hcard_le_c₀ : (discBd Δ ∩ π.Γ.N).ncard ≤ (tilde c₀).ncard) : + let π' := replaceDiscPortrayal π Δ hnode hdich Γ' c' hC' hc'_mem htilde_c' hc'_not_bd hc'_not_I₂ + hN'_sub hN'_bd hdisj_I hI₁_le hW_bd_sub hA_le hA_inter_I₂ htilde_sub_N' + π'.IsTruer π ∨ Δ ∩ π.Γ.N ⊆ discBd Δ ∧ ∃ c₀ ∈ π.Γ.C, (discInsideCells π Δ) = {c₀} := by + classical + intro π' + let I₁ := discInsideCells π Δ + let I₂ := discOutsideCells π Δ + let A_set : ℕ → Set (Set π.S) := fun i => {c ∈ I₁ | (tilde c).ncard = 3 - i} + let B_set : ℕ → Set (Set π.S) := fun i => + {c ∈ I₂ | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - i} + have hA_fin : ∀ i, (A_set i).Finite := fun i => + π.Γ.finite_cells.subset fun _ h => h.1.1 + have hB_fin : ∀ i, (B_set i).Finite := fun i => + π.Γ.finite_cells.subset fun _ h => h.1.1 + have hdisj_AB : ∀ i, Disjoint (A_set i) (B_set i) := fun i => + hdisj_I.mono (fun _ h => h.1) (fun _ h => h.1) + let t_old : ℕ → ℕ := fun n => (A_set n).ncard + (B_set n).ncard + let t_new : ℕ → ℕ := fun n => (if (tilde c').ncard = 3 - n then 1 else 0) + (B_set n).ncard + have hτ_old : ∀ n (hn4 : n < 4) (hn6 : n < 6), π.truth ⟨n, hn6⟩ = t_old n := by + intro n hn4 hn6 + simp only [Portrayal.truth, hn4, ↓reduceIte, t_old] + have hset_eq : {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - n} = + A_set n ∪ B_set n := by + ext c + simp only [A_set, B_set, mem_ofPred_eq, mem_union] + constructor + · rintro ⟨hc, hint, hcard_c⟩ + rcases hdich c hc with hc_in | hc_out + · exact Or.inl ⟨⟨hc, hc_in.trans sdiff_subset⟩, hcard_c⟩ + · exact Or.inr ⟨⟨hc, hc_out⟩, hint, hcard_c⟩ + · rintro (⟨hc₁, hcard_c⟩ | ⟨hc₂, hint, hcard_c⟩) + · have hint : ¬ (c ∩ bd π.S).Nonempty := fun hbd => + Set.disjoint_left.mp hdisj_I hc₁ ⟨hc₁.1, hbd_cells c hc₁.1 hbd⟩ + exact ⟨hc₁.1, hint, hcard_c⟩ + · exact ⟨hc₂.1, hint, hcard_c⟩ + rw [hset_eq, ncard_union_eq (hdisj_AB n) (hA_fin n) (hB_fin n)] + have hτ_new : ∀ n (hn4 : n < 4) (hn6 : n < 6), π'.truth ⟨n, hn6⟩ = t_new n := by + intro n hn4 hn6 + simp only [Portrayal.truth, π', replaceDiscPortrayal, hn4, ↓reduceIte, t_new] + split_ifs with hcard_c' + · have hset_eq : {c ∈ Γ'.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - n} = + insert c' (B_set n) := by + ext c + rw [mem_ofPred_eq, hC', mem_insert_iff, mem_insert_iff] + constructor + · rintro ⟨rfl | hc₂, hint, hcard_c⟩ + · exact Or.inl rfl + · exact Or.inr ⟨hc₂, hint, hcard_c⟩ + · rintro (rfl | ⟨hc₂, hint, hcard_c⟩) + · exact ⟨Or.inl rfl, hc'_not_bd, hcard_c'⟩ + · exact ⟨Or.inr hc₂, hint, hcard_c⟩ + have hc'_not_B : c' ∉ B_set n := fun h => hc'_not_I₂ h.1 + rw [hset_eq, ncard_insert_of_notMem hc'_not_B (hB_fin n), Nat.add_comm] + · have hset_eq : {c ∈ Γ'.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - n} = + B_set n := by + ext c + rw [mem_ofPred_eq, hC', mem_insert_iff] + constructor + · rintro ⟨rfl | hc₂, hint, hcard_c⟩ + · exact False.elim (hcard_c' hcard_c) + · exact ⟨hc₂, hint, hcard_c⟩ + · rintro ⟨hc₂, hint, hcard_c⟩ + exact ⟨Or.inr hc₂, hint, hcard_c⟩ + rw [hset_eq, Nat.zero_add] + have hc₀_le3 : (tilde c₀).ncard ≤ 3 := (π.Γ.cell_disc c₀ hc₀_C).2.2.2 + have hc'_le_c₀ : (tilde c').ncard ≤ (tilde c₀).ncard := by + rwa [htilde_c'] + set k₀ : ℕ := 3 - (tilde c₀).ncard + set k' : ℕ := 3 - (tilde c').ncard + have hk₀_lt4 : k₀ < 4 := by omega + have hk'_lt4 : k' < 4 := by omega + have hk₀_le_k' : k₀ ≤ k' := by omega + have hc₀_mem_Ak₀ : c₀ ∈ A_set k₀ := ⟨⟨hc₀_C, hc₀_Δ⟩, by omega⟩ + have hAk₀_pos : 1 ≤ (A_set k₀).ncard := by + have hne : (A_set k₀).Nonempty := ⟨c₀, hc₀_mem_Ak₀⟩ + exact (ncard_pos (hA_fin k₀)).mpr hne + by_cases hex_ne : ∃ n < 4, t_new n ≠ t_old n + · left + set m := Nat.find hex_ne + have hm_spec : m < 4 ∧ t_new m ≠ t_old m := Nat.find_spec hex_ne + obtain ⟨hm_lt4, hm_ne⟩ := hm_spec + have hm_min : ∀ j < m, j < 4 → t_new j = t_old j := by + intro j hj hj4 + by_contra hne + exact Nat.find_min hex_ne hj ⟨hj4, hne⟩ + refine ⟨⟨m, by omega⟩, fun i hi => ?_, ?_⟩ + · have hi_lt_m : i.1 < m := hi + have hi4 : i.1 < 4 := by omega + rw [hτ_new i.1 hi4 i.2, hτ_old i.1 hi4 i.2] + exact hm_min i.1 hi_lt_m hi4 + · rw [hτ_new m hm_lt4 (by omega), hτ_old m hm_lt4 (by omega)] + dsimp only [t_new, t_old] at hm_ne ⊢ + split_ifs at hm_ne ⊢ with hcard_m + · have hmk' : m = k' := by omega + have hk₀_eq_m : k₀ = m := by + by_contra hne_k₀ + have hk₀_lt_m : k₀ < m := by omega + have heq_k₀ := hm_min k₀ hk₀_lt_m hk₀_lt4 + dsimp only [t_new, t_old] at heq_k₀ + have hnot_k₀ : (tilde c').ncard ≠ 3 - k₀ := by omega + rw [ite_eq_right hnot_k₀] at heq_k₀ + omega + have hAm_pos : 1 ≤ (A_set m).ncard := hk₀_eq_m ▸ hAk₀_pos + have hBm : (B_set m).ncard = (B_set m).ncard := rfl + omega + · omega + · push Not at hex_ne + have hA_eq : ∀ n < 4, + (A_set n).ncard = if (tilde c').ncard = 3 - n then 1 else 0 := by + intro n hn4 + have heq := hex_ne n hn4 + dsimp only [t_new, t_old] at heq + omega + have hk₀_eq_k' : k₀ = k' := by + by_contra hne + have h1 := hA_eq k₀ hk₀_lt4 + have hnot : (tilde c').ncard ≠ 3 - k₀ := by omega + rw [ite_eq_right hnot] at h1 + omega + have hAk'_card : (A_set k').ncard = 1 := by + have h1 := hA_eq k' hk'_lt4 + have hpos : (tilde c').ncard = 3 - k' := by omega + rwa [ite_eq_left hpos] at h1 + have hI₁_eq_c₀ : I₁ = {c₀} := by + refine Subset.antisymm ?_ (singleton_subset_iff.mpr ⟨hc₀_C, hc₀_Δ⟩) + intro c hc₁ + have hc_le3 : (tilde c).ncard ≤ 3 := (π.Γ.cell_disc c hc₁.1).2.2.2 + set kc : ℕ := 3 - (tilde c).ncard + have hkc_lt4 : kc < 4 := by omega + have hc_Akc : c ∈ A_set kc := ⟨hc₁, by omega⟩ + have hkc_eq_k' : kc = k' := by + by_contra hne + have h1 := hA_eq kc hkc_lt4 + have hnot : (tilde c').ncard ≠ 3 - kc := by omega + rw [ite_eq_right hnot] at h1 + have hne_set : (A_set kc).Nonempty := ⟨c, hc_Akc⟩ + have hpos := (ncard_pos (hA_fin kc)).mpr hne_set + omega + have hc_Ak' : c ∈ A_set k' := hkc_eq_k' ▸ hc_Akc + have hc₀_Ak' : c₀ ∈ A_set k' := hk₀_eq_k' ▸ hc₀_mem_Ak₀ + obtain ⟨d, hd⟩ := ncard_eq_one.mp hAk'_card + rw [hd] at hc_Ak' hc₀_Ak' + rw [mem_singleton_iff.mp hc_Ak', mem_singleton_iff.mp hc₀_Ak'] + exact mem_singleton d + by_cases hne_N : ((Δ \ discBd Δ) ∩ π.Γ.N).Nonempty + · left + rcases hne_N with ⟨n₀, hn₀_open, hn₀_N⟩ + have hn₀_not_bd : n₀ ∉ bd π.S := fun h => hn₀_open.2 (hbd_sub ⟨hn₀_open.1, h⟩) + have hn₀_not_N' : n₀ ∉ Γ'.N := fun h => (hN'_sub h).2 hn₀_open + refine ⟨⟨4, by decide⟩, fun i hi => ?_, ?_⟩ + · have hi4 : i.1 < 4 := hi + rw [hτ_new i.1 hi4 i.2, hτ_old i.1 hi4 i.2] + exact hex_ne i.1 hi4 + · have hssub : Γ'.N \ bd π.S ⊂ π.Γ.N \ bd π.S := + ⟨sdiff_le_sdiff_right (hN'_sub.trans sdiff_subset), + fun h => hn₀_not_N' (h ⟨hn₀_N, hn₀_not_bd⟩).1⟩ + simp only [Portrayal.truth, π', replaceDiscPortrayal] + exact ncard_lt_ncard hssub (π.Γ.finite_N.subset sdiff_subset) + · right + refine ⟨?_, c₀, hc₀_C, hI₁_eq_c₀⟩ + rintro x ⟨hxΔ, hxN⟩ + by_contra hx_not_bd + exact hne_N ⟨x, ⟨hxΔ, hx_not_bd⟩, hxN⟩ + +/-- The disc replacement in Graph Minors XVII, (7.2) (page 178), with the same premises as +`theorem_7_2_proof`. The tangle has order greater than three and every marked boundary node of +the disc is incident with an original cell. The conclusion records that a cell of the replacement +portrayal contains the vertices of `α(Δ)` and the images of the marked boundary nodes, and that +the replacement preserves the stated disjointness property of the border sets. -/ +theorem theorem_7_2_cell {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (hθ : 3 < θ) (π : Portrayal G) (hcentral : π.IsCentral 𝒯) + {Δ : Set π.S} (hΔ : IsClosedDisc Δ) + (hnorm : discBd Δ ∩ π.Γ.U ⊆ π.Γ.N) + (hcard : (discBd Δ ∩ π.Γ.N).ncard ≤ 3) + (hnode : ∀ n ∈ discBd Δ ∩ π.domγ, ∃ d ∈ π.Γ.C, n ∈ tilde d) + (hsmall : IsSmallWrt 𝒯 (π.areaGraph Δ)) : + ∃ π' : Portrayal G, + π'.S = π.S ∧ + π'.IsCentral 𝒯 ∧ + π'.Resembles π ∧ + (∃ c ∈ π'.Γ.C, (π.areaGraph Δ).vertexSet ∪ π.nodeVertex '' (discBd Δ ∩ π.domγ) ⊆ + (π'.cellGraph c).vertexSet) ∧ + ((∀ n ∈ π.Γ.N ∩ bd π.S, Disjoint (π.borderSet n) (π.nodeVertex '' π.domγ)) → + ∀ n ∈ π'.Γ.N ∩ bd π'.S, Disjoint (π'.borderSet n) (π'.nodeVertex '' π'.domγ)) ∧ + ((∃ c₀ ∈ π.Γ.C, c₀ ⊆ Δ ∧ (discBd Δ ∩ π.Γ.N).ncard ≤ (tilde c₀).ncard) → + π'.IsTruer π ∨ + (Δ ∩ π.Γ.N ⊆ discBd Δ ∧ ∃ c₀ ∈ π.Γ.C, {c ∈ π.Γ.C | c ⊆ Δ} = {c₀})) := by + classical + have hS : IsSurface π.S := π.isSurface + have : T2Space π.S := hS.2.1 + obtain ⟨hopen, hdisj_bd, hbd_sub, _, _⟩ := isOpen_and_disjoint_bd_of_isClosedDisc hS hΔ + obtain ⟨hdich, hbd_cells, hN_bd_cl⟩ := normal_disc_cell_dichotomy hS π.Γ hΔ hnorm + let Γ' : Painting π.S := π.Γ.replaceDisc hS Δ hΔ hnorm hcard + let c' : Set π.S := Δ \ (discBd Δ ∩ π.Γ.N) + set I₁ : Set (Set π.S) := {c ∈ π.Γ.C | c ⊆ Δ} + set I₂ : Set (Set π.S) := {c ∈ π.Γ.C | c ⊆ Set.univ \ Δ} + have hC' : Γ'.C = insert c' I₂ := π.Γ.replaceDisc_C hS Δ hΔ hnorm hcard + have hc'_mem : c' ∈ Γ'.C := hC'.symm ▸ mem_insert c' I₂ + obtain ⟨hc'_ne, hc'_pc, hc'_cl⟩ := + isClosedDisc_sdiff_subset_discBd hΔ (inter_subset_left : discBd Δ ∩ π.Γ.N ⊆ discBd Δ) + have htilde_c' : tilde c' = discBd Δ ∩ π.Γ.N := by + change closure c' \ c' = _ + rw [hc'_cl] + change Δ \ (Δ \ (discBd Δ ∩ π.Γ.N)) = _ + rw [Set.sdiff_sdiff_right_self, inter_eq_right.mpr (inter_subset_left.trans (discBd_subset Δ))] + have hΔ_bd_sub : Δ ∩ bd π.S ⊆ discBd Δ ∩ π.Γ.N := fun x ⟨hxΔ, hxbd⟩ => + ⟨hbd_sub ⟨hxΔ, hxbd⟩, hnorm ⟨hbd_sub ⟨hxΔ, hxbd⟩, π.Γ.bd_subset hxbd⟩⟩ + have hc'_disj_bd : Disjoint c' (bd π.S) := + Set.disjoint_left.mpr fun x ⟨hxΔ, hxnot⟩ hxbd => hxnot (hΔ_bd_sub ⟨hxΔ, hxbd⟩) + have hc'_not_bd : ¬ (c' ∩ bd π.S).Nonempty := + Set.not_nonempty_iff_eq_empty.mpr (Set.disjoint_iff_inter_eq_empty.mp hc'_disj_bd) + have hc'_not_I₂ : c' ∉ I₂ := by + rintro ⟨_, hc'_out⟩ + obtain ⟨x, hx⟩ := hc'_ne + exact (hc'_out hx).2 hx.1 + have hN'_eq : Γ'.N = π.Γ.N ∩ closure (Set.univ \ Δ) := rfl + have hN'_sub : Γ'.N ⊆ π.Γ.N \ (Δ \ discBd Δ) := by + rintro x ⟨hxN, hxcl⟩ + refine ⟨hxN, fun hx_open => ?_⟩ + have hdisj : Disjoint (Δ \ discBd Δ) (Set.univ \ Δ) := + Set.disjoint_left.mpr fun y hy₁ hy₂ => hy₂.2 hy₁.1 + exact Set.disjoint_left.mp (hdisj.closure_right hopen) hx_open hxcl + have hN'_bd : Γ'.N ∩ bd π.S = π.Γ.N ∩ bd π.S := by + refine Subset.antisymm (inter_subset_inter_left _ inter_subset_left) ?_ + rintro x ⟨hxN, hxbd⟩ + refine ⟨⟨hxN, ?_⟩, hxbd⟩ + by_cases hxΔ : x ∈ Δ + · exact hN_bd_cl (hΔ_bd_sub ⟨hxΔ, hxbd⟩) + · exact subset_closure ⟨trivial, hxΔ⟩ + have hpart : I₁ ∪ I₂ = π.Γ.C := by + refine Subset.antisymm (union_subset (fun _ h => h.1) (fun _ h => h.1)) fun c hc => ?_ + rcases hdich c hc with hc_in | hc_out + · exact Or.inl ⟨hc, hc_in.trans sdiff_subset⟩ + · exact Or.inr ⟨hc, hc_out⟩ + have hdisj_I : Disjoint I₁ I₂ := by + rw [Set.disjoint_left] + intro c hc₁ hc₂ + obtain ⟨x, hx⟩ := π.Γ.cell_nonempty hc₁.1 + exact (hc₂.2 hx).2 (hc₁.2 hx) + have hI₁_eq : π.areaGraph Δ = π.cellsUnion I₁ := rfl + have hI₁_le : π.areaGraph Δ ≤ G := π.cellsUnion_le I₁ + let W_bd : Set α := π.nodeVertex '' (discBd Δ ∩ π.domγ) + have hW_bd_sub : W_bd ⊆ G.vertexSet := by + rintro _ ⟨n, ⟨_, hnγ⟩, rfl⟩ + exact π.nodeVertex_mem n hnγ + have hW_bd_card : W_bd.ncard ≤ 3 := by + have hsub : discBd Δ ∩ π.domγ ⊆ discBd Δ ∩ π.Γ.N := + inter_subset_inter_right _ π.domγ_subset + have hfin : (discBd Δ ∩ π.domγ).Finite := + (π.Γ.finite_N.inter_of_right (discBd Δ)).subset hsub + exact (ncard_image_le hfin).trans ((ncard_le_ncard hsub + (π.Γ.finite_N.inter_of_right (discBd Δ))).trans hcard) + have hinter_sub : (π.areaGraph Δ).vertexSet ∩ (π.cellsUnion I₂).vertexSet ⊆ W_bd := by + have hv_inter := theorem_2_1_claim_3 π hpart hdisj_I + intro v hv + rcases hv_inter hv with ⟨n, ⟨⟨hX₁, hX₂⟩, hdom⟩, rfl⟩ | hY + · rw [mem_iUnion₂] at hX₁ hX₂ + rcases hX₁ with ⟨c₁, hc₁, hnc₁⟩ + rcases hX₂ with ⟨c₂, hc₂, hnc₂⟩ + have hnΔ : n ∈ Δ := closure_minimal hc₁.2 hΔ.isCompact.isClosed hnc₁.1 + have hcl := (closure_cell_inter_disc_of_subset_compl hS π.Γ hΔ hnorm hc₂.1 hc₂.2).2 + have hnbdΔ : n ∈ discBd Δ := by + have : n ∈ closure c₂ ∩ Δ := ⟨hnc₂.1, hnΔ⟩ + rw [hcl] at this + exact this.2 + exact ⟨n, ⟨hnbdΔ, hdom⟩, rfl⟩ + · exfalso + rw [mem_iUnion₂] at hY + rcases hY with ⟨n, ⟨hY₁, _⟩, _⟩ + rw [mem_iUnion₂] at hY₁ + rcases hY₁ with ⟨c₁, ⟨hc₁, hbd₁⟩, _⟩ + exact Set.disjoint_left.mp hdisj_I hc₁ ⟨hc₁.1, hbd_cells c₁ hc₁.1 hbd₁⟩ + let A : Hypergraph α β := addVerticesSubhypergraph G (π.areaGraph Δ) W_bd hI₁_le hW_bd_sub + have hA_le : A ≤ G := addVerticesSubhypergraph_le hI₁_le hW_bd_sub + have hA_inter_I₂ : A.vertexSet ∩ (π.cellsUnion I₂).vertexSet ⊆ W_bd := by + rintro v ⟨hvΔ | hvW, hv₂⟩ + · exact hinter_sub ⟨hvΔ, hv₂⟩ + · exact hvW + have hA_small : IsSmallWrt 𝒯 A := by + have hdisc_small : IsSmallWrt 𝒯 (discreteSubhypergraph G W_bd hW_bd_sub) := + ⟨G, IsTangle.discrete_mem h𝒯 hW_bd_sub (by omega)⟩ + have hatt_sub : attachments G A ⊆ W_bd := by + rintro v ⟨hvA, e, ⟨heG, he_notΔ⟩, hinc⟩ + rw [addVerticesSubhypergraph_edgeSet] at he_notΔ + obtain ⟨c₂, hc₂, hec₂⟩ := π.p1_edge e heG + have hc₂_I₂ : c₂ ∈ I₂ := by + rcases hdich c₂ hc₂ with hc_in | hc_out + · exact False.elim (he_notΔ (mem_iUnion₂.mpr ⟨c₂, ⟨⟨hc₂, hc_in.trans sdiff_subset⟩, hc₂⟩, + hec₂⟩)) + · exact ⟨hc₂, hc_out⟩ + have hvc₂ : v ∈ (π.cellGraph c₂).vertexSet := by + have hends := (π.cellGraph_le c₂ hc₂).3 e hec₂ + exact (π.cellGraph c₂).vertex_mem_of_inc + (by change v ∈ (π.cellGraph c₂).ends e; rw [← hends]; exact hinc) + exact hA_inter_I₂ ⟨hvA, mem_iUnion₂.mpr ⟨c₂, ⟨hc₂_I₂, hc₂⟩, hvc₂⟩⟩ + have hfin_W : W_bd.Finite := G.vertexSet_finite.subset hW_bd_sub + have hatt_lt : (attachments G A).ncard < θ := + ((ncard_le_ncard hatt_sub hfin_W).trans hW_bd_card).trans_lt hθ + exact hsmall.union h𝒯 hdisc_small hatt_lt + have htilde_sub_N' : ∀ c ∈ Γ'.C, tilde c ⊆ Γ'.N := by + intro c hc + rw [hC'] at hc + rcases hc with rfl | ⟨hc, hc_out⟩ + · rw [htilde_c'] + exact fun x hx => ⟨hx.2, hN_bd_cl hx⟩ + · have hcl_sub := (closure_cell_inter_disc_of_subset_compl hS π.Γ hΔ hnorm hc hc_out).1 + exact fun x hx => ⟨π.Γ.tilde_subset_N hc hx, hcl_sub hx.1⟩ + let cellG : Set π.S → Hypergraph α β := fun c => + if c = c' then A else π.cellGraph c + let π' := replaceDiscPortrayal π Δ hnode hdich Γ' c' hC' hc'_mem htilde_c' hc'_not_bd hc'_not_I₂ + hN'_sub hN'_bd hdisj_I hI₁_le hW_bd_sub hA_le hA_inter_I₂ htilde_sub_N' + have hcentral' : π'.IsCentral 𝒯 := by + intro c hc + rw [hC'] at hc + change IsSmallWrt 𝒯 (cellG c) + dsimp only [cellG] + split_ifs with hcc' + · exact hA_small + · exact hcentral c (hc.resolve_left hcc').1 + have hwarp_eq := + replaceDiscWarpAt π Δ hnode hdich Γ' c' hC' hc'_mem htilde_c' hc'_not_bd hc'_not_I₂ hN'_sub + hN'_bd hdisj_I hI₁_le hW_bd_sub hA_le hA_inter_I₂ htilde_sub_N' hbd_cells + have hres : π'.Resembles π := by + refine ⟨Homeomorph.refl π.S, fun Θ hΘ => ?_⟩ + have himg : (Homeomorph.refl π.S : π.S → π.S) '' Θ = Θ := image_id Θ + rw [himg] + exact hwarp_eq Θ hΘ + refine ⟨π', rfl, hcentral', hres, ⟨c', hc'_mem, ?_⟩, ?_, fun ⟨c₀, hc₀_C, hc₀_Δ, + hcard_le_c₀⟩ => ?_⟩ + · intro v hv + have hA : cellG c' = A := ite_eq_left rfl + change v ∈ (cellG c').vertexSet + rw [hA] + exact hv + · rintro hd n ⟨hn, hnb⟩ + exact (hd n ⟨hN'_sub hn |>.1, hnb⟩).mono_right (image_mono inter_subset_left) + exact replaceDiscTruth π Δ hnode hdich Γ' c' hC' hc'_mem htilde_c' hc'_not_bd hc'_not_I₂ hN'_sub + hN'_bd hdisj_I hI₁_le hW_bd_sub hA_le hA_inter_I₂ htilde_sub_N' hbd_sub hbd_cells c₀ hc₀_C hc₀_Δ + hcard_le_c₀ + +end Theorem72 + +/-! ## 4. Normal $1$-Arc Disc Replacement ((7.3) and (7.4), Pages 178–181) -/ + +section Theorem73And74 + +/-- Existential form of **Graph Minors XVII, (7.2)** (page 178). + +"Let $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a $\mathcal{T}$-central portrayal of a +hypergraph $G$. Let $\Delta \subseteq \Sigma$ be a disc, with $bd(\Delta)$ $\Gamma$-normal and +$|bd(\Delta) \cap N(\Gamma)| \le 3$, such that $\alpha(\Delta)$ is small. Define $\Gamma' = +(U(\Gamma) \cup \Delta, N(\Gamma) \cap \overline{\Sigma - \Delta})$; thus $c' = \Delta - (bd(\Delta) +\cap N(\Gamma))$ is a cell of $\Gamma'$. Let $A \subseteq G$ be minimal such that $\alpha(\Delta) +\subseteq A$ and $\gamma(N(\Gamma) \cap bd(\Delta)) \subseteq V(A)$. Define +$$ \begin{aligned} \alpha'(c') &= A \\ \alpha'(c) &= \alpha(c) \quad (c \in C(\Gamma') - \{c'\}) \\ +\gamma' &= \gamma \mid N(\Gamma'). \end{aligned} $$ +Then $\pi' = (\Sigma, \Gamma', \alpha', \beta, \gamma')$ is a $\mathcal{T}$-central portrayal of +$G$ resembling $\pi$." + +The Lean construction requires $\operatorname{ord}(\mathcal{T}) > 3$ and that every marked +node on the disc boundary be incident with an original cell. The conclusion records centrality, +resemblance and the original surface for the existential portrayal. + +It also gives a trueness alternative when a cell $c_0 \in C(\Gamma)$ lies in $\Delta$ and +$|\operatorname{bd}(\Delta) \cap N(\Gamma)| \le |\tilde{c}_0|$. Either $\pi'$ is truer than +$\pi$ (`π'.IsTruer π`), or +$\Delta \cap N(\Gamma) \subseteq \operatorname{bd}(\Delta)$ and $\{c \in C(\Gamma) \mid c \subseteq +\Delta\}$ consists of a single original cell. -/ +theorem theorem_7_2_proof {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (hθ : 3 < θ) (π : Portrayal G) (hcentral : π.IsCentral 𝒯) + {Δ : Set π.S} (hΔ : IsClosedDisc Δ) + (hnorm : discBd Δ ∩ π.Γ.U ⊆ π.Γ.N) + (hcard : (discBd Δ ∩ π.Γ.N).ncard ≤ 3) + (hnode : ∀ n ∈ discBd Δ ∩ π.domγ, ∃ d ∈ π.Γ.C, n ∈ tilde d) + (hsmall : IsSmallWrt 𝒯 (π.areaGraph Δ)) : + ∃ π' : Portrayal G, + π'.S = π.S ∧ + π'.IsCentral 𝒯 ∧ + π'.Resembles π ∧ + ((∃ c₀ ∈ π.Γ.C, c₀ ⊆ Δ ∧ (discBd Δ ∩ π.Γ.N).ncard ≤ (tilde c₀).ncard) → + π'.IsTruer π ∨ + (Δ ∩ π.Γ.N ⊆ discBd Δ ∧ ∃ c₀ ∈ π.Γ.C, {c ∈ π.Γ.C | c ⊆ Δ} = {c₀})) := by + obtain ⟨π', h1, h2, h3, -, -, h4⟩ := theorem_7_2_cell h𝒯 hθ π hcentral hΔ hnorm hcard hnode hsmall + exact ⟨π', h1, h2, h3, h4⟩ + +/-- If $w$ is a path from $u$ to $v$ in $(H_1 \cup H_2).\text{skeleton}$ (where $H_1$ and $H_2$ are +edge-disjoint) such that no internal vertex $z \in w.\text{support} \setminus \{u, v\}$ belongs to +$V(H_1) \cap V(H_2)$, then $w$ lifts either to a walk in $H_1.\text{skeleton}$ or to a walk in +$H_2.\text{skeleton}$ with the same support. -/ +theorem walk_in_left_or_right_of_internal_disjoint {α : Type u} {β : Type v} + {H₁ H₂ : Hypergraph α β} (hdisjE : Disjoint H₁.edgeSet H₂.edgeSet) {u v : α} + (w : (H₁ ∪ H₂).skeleton.Walk u v) (hp : w.IsPath) + (hint : ∀ z ∈ w.support, z ≠ u → z ≠ v → z ∉ H₁.vertexSet ∩ H₂.vertexSet) : + (∃ w₁ : H₁.skeleton.Walk u v, w₁.support = w.support) ∨ + (∃ w₂ : H₂.skeleton.Walk u v, w₂.support = w.support) := by + have hstay : ∀ {K₁ K₂ : Hypergraph α β}, Disjoint K₁.edgeSet K₂.edgeSet → + ∀ {a b : α} (p : (K₁ ∪ K₂).skeleton.Walk a b), + p.IsPath → a ∈ K₁.vertexSet → + (∀ z ∈ p.support, z ≠ b → z ∉ K₁.vertexSet ∩ K₂.vertexSet) → + ∃ p₁ : K₁.skeleton.Walk a b, p₁.support = p.support := by + intro K₁ K₂ hdisjK a b p hp_p ha₁ hno + induction p with + | nil => exact ⟨.nil, rfl⟩ + | @cons a c b hadj tail ih => + have hp_tail : tail.IsPath := hp_p.of_cons + have ha_not_tail : a ∉ tail.support := + (SimpleGraph.Walk.cons_isPath_iff hadj tail).mp hp_p |>.2 + have ha_ne_b : a ≠ b := fun h => ha_not_tail (h ▸ tail.end_mem_support) + have ha_not_K₂ : a ∉ K₂.vertexSet := fun ha₂ => + hno a (SimpleGraph.Walk.start_mem_support _) ha_ne_b ⟨ha₁, ha₂⟩ + rcases hadj with ⟨hne, e, hinc_a, hinc_c⟩ + have hinc_a₁ : K₁.Inc e a := + hinc_a.resolve_right fun h => ha_not_K₂ (K₂.vertex_mem_of_inc h) + have he₁ : e ∈ K₁.edgeSet := K₁.edge_mem_of_inc hinc_a₁ + have hinc_c₁ : K₁.Inc e c := + hinc_c.resolve_right fun h => + Set.disjoint_left.mp hdisjK he₁ (K₂.edge_mem_of_inc h) + have hc₁ : c ∈ K₁.vertexSet := K₁.vertex_mem_of_inc hinc_c₁ + have hno_tail : ∀ z ∈ tail.support, z ≠ b → z ∉ K₁.vertexSet ∩ K₂.vertexSet := + fun z hz => hno z (List.mem_cons_of_mem a hz) + obtain ⟨tail₁, hsup⟩ := ih hp_tail hc₁ hno_tail + have hadj₁ : K₁.skeleton.Adj a c := ⟨hne, e, hinc_a₁, hinc_c₁⟩ + refine ⟨.cons hadj₁ tail₁, ?_⟩ + dsimp [SimpleGraph.Walk.support] + rw [hsup] + cases w with + | nil => exact Or.inl ⟨.nil, rfl⟩ + | @cons u c v hadj tail => + have hp_tail : tail.IsPath := hp.of_cons + have hu_not_tail : u ∉ tail.support := + (SimpleGraph.Walk.cons_isPath_iff hadj tail).mp hp |>.2 + rcases hadj with ⟨hne, e, hinc_u, hinc_c⟩ + rcases hinc_u with hinc_u₁ | hinc_u₂ + · left + have he₁ : e ∈ H₁.edgeSet := H₁.edge_mem_of_inc hinc_u₁ + have hinc_c₁ : H₁.Inc e c := + hinc_c.resolve_right fun h => + Set.disjoint_left.mp hdisjE he₁ (H₂.edge_mem_of_inc h) + have hc₁ : c ∈ H₁.vertexSet := H₁.vertex_mem_of_inc hinc_c₁ + have hno_tail : ∀ z ∈ tail.support, z ≠ v → z ∉ H₁.vertexSet ∩ H₂.vertexSet := + fun z hz hzv => hint z (List.mem_cons_of_mem u hz) (fun hzu => hu_not_tail (hzu ▸ hz)) hzv + obtain ⟨tail₁, hsup⟩ := hstay hdisjE tail hp_tail hc₁ hno_tail + have hadj₁ : H₁.skeleton.Adj u c := ⟨hne, e, hinc_u₁, hinc_c₁⟩ + refine ⟨.cons hadj₁ tail₁, ?_⟩ + dsimp [SimpleGraph.Walk.support] + rw [hsup] + · right + have he₂ : e ∈ H₂.edgeSet := H₂.edge_mem_of_inc hinc_u₂ + have hinc_c₂ : H₂.Inc e c := + hinc_c.resolve_left fun h => + Set.disjoint_left.mp hdisjE (H₁.edge_mem_of_inc h) he₂ + have hc₂ : c ∈ H₂.vertexSet := H₂.vertex_mem_of_inc hinc_c₂ + have hstay₂ : ∀ {a b : α} (p : (H₁ ∪ H₂).skeleton.Walk a b), + p.IsPath → a ∈ H₂.vertexSet → + (∀ z ∈ p.support, z ≠ b → z ∉ H₁.vertexSet ∩ H₂.vertexSet) → + ∃ p₂ : H₂.skeleton.Walk a b, p₂.support = p.support := by + intro a b p hp_p ha₂ hno + induction p with + | nil => exact ⟨.nil, rfl⟩ + | @cons a d b hadj' tail' ih => + have hp_tail' : tail'.IsPath := hp_p.of_cons + have ha_not_tail' : a ∉ tail'.support := + (SimpleGraph.Walk.cons_isPath_iff hadj' tail').mp hp_p |>.2 + have ha_ne_b : a ≠ b := fun h => ha_not_tail' (h ▸ tail'.end_mem_support) + have ha_not_H₁ : a ∉ H₁.vertexSet := fun ha₁ => + hno a (SimpleGraph.Walk.start_mem_support _) ha_ne_b ⟨ha₁, ha₂⟩ + rcases hadj' with ⟨hne', e', hinc_a, hinc_d⟩ + have hinc_a₂ : H₂.Inc e' a := + hinc_a.resolve_left fun h => ha_not_H₁ (H₁.vertex_mem_of_inc h) + have he'₂ : e' ∈ H₂.edgeSet := H₂.edge_mem_of_inc hinc_a₂ + have hinc_d₂ : H₂.Inc e' d := + hinc_d.resolve_left fun h => + Set.disjoint_left.mp hdisjE (H₁.edge_mem_of_inc h) he'₂ + have hd₂ : d ∈ H₂.vertexSet := H₂.vertex_mem_of_inc hinc_d₂ + obtain ⟨tail₂, hsup⟩ := ih hp_tail' hd₂ (fun z hz => hno z (List.mem_cons_of_mem a hz)) + have hadj₂ : H₂.skeleton.Adj a d := ⟨hne', e', hinc_a₂, hinc_d₂⟩ + refine ⟨.cons hadj₂ tail₂, ?_⟩ + dsimp [SimpleGraph.Walk.support] + rw [hsup] + have hno_tail : ∀ z ∈ tail.support, z ≠ v → z ∉ H₁.vertexSet ∩ H₂.vertexSet := + fun z hz hzv => hint z (List.mem_cons_of_mem u hz) (fun hzu => hu_not_tail (hzu ▸ hz)) hzv + obtain ⟨tail₂, hsup⟩ := hstay₂ tail hp_tail hc₂ hno_tail + have hadj₂ : H₂.skeleton.Adj u c := ⟨hne, e, hinc_u₂, hinc_c₂⟩ + refine ⟨.cons hadj₂ tail₂, ?_⟩ + dsimp [SimpleGraph.Walk.support] + rw [hsup] + +/-- If $w : H.\text{skeleton}.\text{Walk } u\; v$ is a walk between distinct vertices $u \ne v$, +then both $u$ and $v$ belong to $H.\text{vertexSet}$. -/ +theorem walk_endpoints_mem_vertexSet_of_ne {α : Type u} {β : Type v} + {H : Hypergraph α β} {u v : α} (w : H.skeleton.Walk u v) (hne : u ≠ v) : + u ∈ H.vertexSet ∧ v ∈ H.vertexSet := by + have hstart : ∀ {a b : α} (p : H.skeleton.Walk a b), a ≠ b → a ∈ H.vertexSet := by + intro a b p hab + cases p with + | nil => exact (hab rfl).elim + | cons hadj _ => + rcases hadj with ⟨_, e, hinc, _⟩ + exact H.vertex_mem_of_inc hinc + exact ⟨hstart w hne, hstart w.reverse hne.symm⟩ + +/-- Given a path `P : PathFromTo K B₁ B₂`, there exists a minimal subpath `Q : PathFromTo K B₁ B₂` +whose vertex support is a subset of `P.walk.support` such that no internal vertex of `Q` belongs to +`B₁ ∪ B₂`, and if `Q.first ≠ Q.last`, no vertex of `Q` belongs to `B₁ ∩ B₂`. -/ +theorem exists_minimal_subpath_from_to {α : Type u} {K : SimpleGraph α} {B₁ B₂ : Set α} + (P : PathFromTo K B₁ B₂) : + ∃ Q : PathFromTo K B₁ B₂, + {z | z ∈ Q.walk.support} ⊆ {z | z ∈ P.walk.support} ∧ + (∀ z ∈ Q.walk.support, z ≠ Q.first → z ≠ Q.last → z ∉ B₁ ∪ B₂) ∧ + (Q.first ≠ Q.last → ∀ z ∈ Q.walk.support, z ∉ B₁ ∩ B₂) := by + suffices hmain : ∀ n : ℕ, ∀ {u v : α} (w : K.Walk u v), w.length ≤ n → + w.IsPath → u ∈ B₁ → v ∈ B₂ → + ∃ Q : PathFromTo K B₁ B₂, + {z | z ∈ Q.walk.support} ⊆ {z | z ∈ w.support} ∧ + (∀ z ∈ Q.walk.support, z ≠ Q.first → z ≠ Q.last → z ∉ B₁ ∪ B₂) ∧ + (Q.first ≠ Q.last → ∀ z ∈ Q.walk.support, z ∉ B₁ ∩ B₂) by + exact hmain P.walk.length P.walk le_rfl P.isPath P.first_mem P.last_mem + intro n + induction n with + | zero => + intro u v w hlen hp hu hv + cases w with + | nil => + refine ⟨⟨u, u, .nil, SimpleGraph.Walk.IsPath.nil, hu, hv⟩, subset_rfl, ?_, ?_⟩ + · intro z hz hne _ + exact (hne (List.mem_singleton.mp hz)).elim + · intro hne; exact (hne rfl).elim + | cons _ _ => simp [SimpleGraph.Walk.length_cons] at hlen + | succ n ih => + intro u v w hlen hp hu hv + by_cases hex : ∃ z ∈ w.support, z ≠ u ∧ z ≠ v ∧ z ∈ B₁ ∪ B₂ + · obtain ⟨z, hz_sup, hzu, hzv, hzB⟩ := hex + obtain ⟨w₁, w₂, hp₁, hp₂, hw_eq⟩ := hp.mem_support_iff_exists_append.mp hz_sup + have hw₁_pos : 1 ≤ w₁.length := by + cases w₁ with + | nil => exact (hzu rfl).elim + | cons _ _ => simp [SimpleGraph.Walk.length_cons] + have hw₂_pos : 1 ≤ w₂.length := by + cases w₂ with + | nil => exact (hzv rfl).elim + | cons _ _ => simp [SimpleGraph.Walk.length_cons] + have hlen_eq : w.length = w₁.length + w₂.length := by + rw [hw_eq, SimpleGraph.Walk.length_append] + rcases hzB with hzB₁ | hzB₂ + · obtain ⟨Q, hQ_sub, hQ_int, hQ_inter⟩ := ih w₂ (by omega) hp₂ hzB₁ hv + refine ⟨Q, hQ_sub.trans ?_, hQ_int, hQ_inter⟩ + intro x hx + exact hw_eq ▸ SimpleGraph.Walk.support_subset_support_append_right w₁ w₂ hx + · obtain ⟨Q, hQ_sub, hQ_int, hQ_inter⟩ := ih w₁ (by omega) hp₁ hu hzB₂ + refine ⟨Q, hQ_sub.trans ?_, hQ_int, hQ_inter⟩ + intro x hx + exact hw_eq ▸ SimpleGraph.Walk.support_subset_support_append_left w₁ w₂ hx + · push Not at hex + by_cases hu₂ : u ∈ B₂ + · refine ⟨⟨u, u, .nil, SimpleGraph.Walk.IsPath.nil, hu, hu₂⟩, ?_, ?_, ?_⟩ + · intro x hx + exact (List.mem_singleton.mp hx) ▸ SimpleGraph.Walk.start_mem_support w + · intro z hz hne _ + exact (hne (List.mem_singleton.mp hz)).elim + · intro hne; exact (hne rfl).elim + · by_cases hv₁ : v ∈ B₁ + · refine ⟨⟨v, v, .nil, SimpleGraph.Walk.IsPath.nil, hv₁, hv⟩, ?_, ?_, ?_⟩ + · intro x hx + exact (List.mem_singleton.mp hx) ▸ SimpleGraph.Walk.end_mem_support w + · intro z hz hne _ + exact (hne (List.mem_singleton.mp hz)).elim + · intro hne; exact (hne rfl).elim + · refine ⟨⟨u, v, w, hp, hu, hv⟩, subset_rfl, hex, ?_⟩ + intro _ z hz ⟨hz₁, hz₂⟩ + by_cases hzu : z = u + · exact hu₂ (hzu ▸ hz₂) + · by_cases hzv : z = v + · exact hv₁ (hzv ▸ hz₁) + · exact hex z hz hzu hzv (Or.inl hz₁) + +/-- Pure surface-and-painting topological region-separation statement for the proof of (7.3) +(Graph Minors XVII, page 179): +given a painting $\Gamma$ in a surface $\Sigma$, a cuff $\Theta$ of $\Sigma$, distinct nodes +$n_1, n_2 \in N(\Gamma) \cap \Theta$, a $\Gamma$-normal $I$-arc $F \subseteq \Sigma$ with ends +$n_1, n_2$ and $F \cap N(\Gamma) = \{n_1, n_2\}$, a closed disc $\Delta \subseteq \Sigma$ with +$F \subseteq \operatorname{bd}(\Delta) \subseteq F \cup \Theta$, an assignment $e(c'') \subseteq +\tilde{c}''$ of size $0$, $2$, or $3$ for each internal cell $c'' \subseteq \Delta$ (representing +the drawing $H$ of $M \cap \Delta$ in $\Delta$), and a marking predicate $P_{\text{mark}}$ on nodes +that holds at $n_1$, fails at $n_2$, and is constant on each $e(c'')$: +letting $R$ be the region of $H$ in $\Delta$ whose closure includes $F$ and $m_1, \dots, m_k$ be +the nodes of $N(\Gamma) \cap I$ ($I = \Theta \cap \operatorname{bd}(\Delta)$) in $\bar{R}$ in order +along $I$, choosing $i$ maximum with $P_{\text{mark}}(m_i)$ gives consecutive nodes +$m_i, m_{i+1} \in N(\Gamma) \cap I$ and a border cell $c \subseteq \Delta$ with +$\tilde{c} = \{m_i, m_{i+1}\}$ whose boundary segment $S = \bar{c} \cap I$ splits $I$ into $I_1$ +(between $n_1$ and $m_i$) and $I_2$ (between $m_{i+1}$ and $n_2$) and separates the components of +$H$ in $\Delta$. -/ +@[expose] def NormalIArcDiscRegionStatement : Prop := + ∀ (S : Type) [TopologicalSpace S], IsSurface S → + ∀ (Γ : Painting S) (Θ : Set S) (n₁ n₂ : S) (F Δ : Set S) + (e : Set S → Set S) (P_mark : S → Prop), + Θ ∈ cuffs S → n₁ ∈ Γ.N ∩ Θ → n₂ ∈ Γ.N ∩ Θ → n₁ ≠ n₂ → + Γ.IsNormal F → IsLineWithEnds F n₁ n₂ → F ∩ bd S = {n₁, n₂} → F ∩ Γ.N = {n₁, n₂} → + IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ Θ → + (∀ d ∈ Γ.C, d ⊆ Δ → ¬ (d ∩ bd S).Nonempty → + e d ⊆ tilde d ∧ (e d = ∅ ∨ 2 ≤ (e d).ncard) ∧ + ∀ x ∈ e d, ∀ y ∈ e d, P_mark x → P_mark y) → + P_mark n₁ → ¬ P_mark n₂ → + ∃ (m₁ m₂ : S) (c I₁ I₂ N₁ N₂ : Set S), + m₁ ∈ Γ.N ∩ (Θ ∩ discBd Δ) ∧ m₂ ∈ Γ.N ∩ (Θ ∩ discBd Δ) ∧ m₁ ≠ m₂ ∧ + P_mark m₁ ∧ ¬ P_mark m₂ ∧ + c ∈ Γ.C ∧ c ⊆ Δ ∧ (c ∩ Θ).Nonempty ∧ tilde c = {m₁, m₂} ∧ + I₁ ⊆ Θ ∩ discBd Δ ∧ I₂ ⊆ Θ ∩ discBd Δ ∧ Disjoint I₁ I₂ ∧ + n₁ ∈ I₁ ∧ m₁ ∈ I₁ ∧ m₂ ∈ I₂ ∧ n₂ ∈ I₂ ∧ + N₁ ⊆ (Γ.N ∩ Δ) \ bd S ∧ N₂ ⊆ (Γ.N ∩ Δ) \ bd S ∧ Disjoint N₁ N₂ ∧ + (∀ n ∈ I₁ ∩ Γ.N, ∀ n' ∈ I₂ ∩ Γ.N, + (n ≠ n₁ → n ≠ m₁ → GM19.InOrderOn Θ n₁ n m₁ n') ∧ + (m₁ ≠ n₁ → n' ≠ n₂ → GM19.InOrderOn Θ n₁ m₁ n' n₂) ∧ + (n' ≠ m₂ → n' ≠ n₂ → GM19.InOrderOn Θ n m₂ n' n₂) ∧ + (n ≠ n₁ → m₂ ≠ n₂ → GM19.InOrderOn Θ n₁ n m₂ n₂)) ∧ + (∀ d ∈ Γ.C, d ⊆ Δ → (d ∩ bd S).Nonempty → d ≠ c → + tilde d ⊆ I₁ ∨ tilde d ⊆ I₂) ∧ + (∀ d ∈ Γ.C, d ⊆ Δ → ¬ (d ∩ bd S).Nonempty → + e d ⊆ N₁ ∪ I₁ ∨ e d ⊆ N₂ ∪ I₂) ∧ + (∃ c₁ ∈ Γ.C, c₁ ⊆ Δ ∧ (c₁ ∩ bd S).Nonempty ∧ n₁ ∈ tilde c₁) ∧ + (∃ c₂ ∈ Γ.C, c₂ ⊆ Δ ∧ (c₂ ∩ bd S).Nonempty ∧ n₂ ∈ tilde c₂) + +/-- Topological statement for Graph Minors XVII, (7.4) (pages 180–181): +Given a painting $\Gamma$ on a surface $S$, a $\Gamma$-normal $I$-arc $F$ with ends +$n_1, n_2 \in \operatorname{bd}(S)$ and $F \cap \Gamma.N = \{n_1, n_2\}$, and a closed disc +$\Delta \subseteq S$ with $F \subseteq \operatorname{bd}(\Delta) \subseteq F \cup +\operatorname{bd}(S)$, +replacing the interior of $\Delta$ by a single border cell $c' = \Delta \setminus \{n_1, n_2\}$ +gives a painting $\Gamma'$ on $S$ with $U(\Gamma') = U(\Gamma) \cup \Delta$, +$N(\Gamma') = N(\Gamma) \cap \overline{S \setminus \Delta} = (N(\Gamma) \setminus \Delta) \cup +\{n_1, n_2\}$, +and $C(\Gamma') = \{c'\} \cup \{c \in C(\Gamma) \mid c \subseteq S \setminus \Delta\}$. -/ +@[expose] def NormalIArcReplaceDiscPaintingStatement : Prop := + ∀ (S : Type) [TopologicalSpace S], IsSurface S → + ∀ (Γ : Painting S) (n₁ n₂ : S) (F Δ : Set S), + Γ.IsNormal F → IsLineWithEnds F n₁ n₂ → + F ∩ bd S = {n₁, n₂} → F ∩ Γ.N = {n₁, n₂} → + IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd S → + ∃ (Γ' : Painting S) (Θ F'' : Set S), + let c' := Δ \ {n₁, n₂} + let F' := discBd Δ ∩ Θ + Γ'.U = Γ.U ∪ Δ ∧ + Γ'.N = Γ.N ∩ closure (Δᶜ) ∧ + Γ'.N = (Γ.N \ Δ) ∪ {n₁, n₂} ∧ + Θ ∈ cuffs S ∧ + n₁ ∈ Γ.N ∩ Θ ∧ n₂ ∈ Γ.N ∩ Θ ∧ + discBd Δ ⊆ F ∪ Θ ∧ + Δ ∩ bd S = F' ∧ + IsLineWithEnds F' n₁ n₂ ∧ + F'' ⊆ Θ ∧ IsLineWithEnds F'' n₁ n₂ ∧ + F' ∪ F'' = Θ ∧ F' ∩ F'' = {n₁, n₂} ∧ + (∀ c ∈ Γ.C, c ⊆ Δ ∨ c ⊆ Δᶜ) ∧ + (∀ c ∈ Γ.C, c ⊆ Δᶜ → tilde c ⊆ Γ'.N) ∧ + c' ∈ Γ'.C ∧ (c' ∩ Θ).Nonempty ∧ tilde c' = {n₁, n₂} ∧ + Γ'.C = insert c' {c ∈ Γ.C | c ⊆ Δᶜ} ∧ + c' ∉ {c ∈ Γ.C | c ⊆ Δᶜ} ∧ + (∃ c₁ ∈ Γ.C, c₁ ⊆ Δ ∧ (c₁ ∩ bd S).Nonempty ∧ n₁ ∈ tilde c₁) ∧ + (∃ c₂ ∈ Γ.C, c₂ ⊆ Δ ∧ (c₂ ∩ bd S).Nonempty ∧ n₂ ∈ tilde c₂) + +end Theorem73And74 + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section7Proved.lean b/LeanPool/GraphMinor/GM17/Section7Proved.lean new file mode 100644 index 0000000000..183c3257d0 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section7Proved.lean @@ -0,0 +1,1747 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section7 +import LeanPool.GraphMinor.GM17.Section5Proved +import LeanPool.GraphMinor.GM17.Section6Proved + +public import LeanPool.GraphMinor.GM17.Section6 +public import LeanPool.GraphMinor.Surface.DiscsInSurface + +import LeanPool.GraphMinor.Surface.Cuffs + +import LeanPool.GraphMinor.GM17.ArcDisc + +import LeanPool.GraphMinor.GM17.MarkCross + +import LeanPool.GraphMinor.GM17.PasteCuff + +import LeanPool.GraphMinor.GM17.ReplaceDisc +import LeanPool.GraphMinor.GM17.CellLinkage + +/-! +# Graph Minors XVII: proved deductions of Section7 + +The portrayal deductions use the existing painting proofs. The definitions and +independent geometric lemmas are imported from `Section7`. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology Metric +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +/-! ## 1. Discs and Normal Boundaries in Paintings -/ + +section DiscNormalLemmas + +variable {S : Type} [TopologicalSpace S] + +end DiscNormalLemmas + +/-! ## 2. Removing a Disc with $\le 1$ Boundary Node: (7.1) (Page 178) -/ + +section Theorem71 + +variable {S : Type} [TopologicalSpace S] + +end Theorem71 + +/-! ## 3. Replacing a Normal Disc with at Most Three Boundary Nodes ((7.2), Page 178) -/ + +section Theorem72 + +variable {S : Type} [TopologicalSpace S] + +end Theorem72 + +/-! ## 4. Normal $1$-Arc Disc Replacement ((7.3) and (7.4), Pages 178–181) -/ + +section Theorem73And74 + +/-- If a map $f \colon \operatorname{Fin} k \to \alpha$ is injective and takes values in a finite +set $X$ with $X.\text{ncard} = k$, then every element of $X$ is in the range of $f$. -/ +private lemma mem_range_of_injective_of_ncard_eq {α : Type u} {k : ℕ} + {X : Set α} (hfin : X.Finite) (hcard : X.ncard = k) + {f : Fin k → α} (hmem : ∀ i, f i ∈ X) (hinj : Function.Injective f) + {x : α} (hx : x ∈ X) : + ∃ i, f i = x := by + have hsub : Set.range f ⊆ X := by rintro _ ⟨i, rfl⟩; exact hmem i + have hrange_card : (Set.range f).ncard = k := by + rw [ncard_range_of_injective hinj, Nat.card_eq_fintype_card, Fintype.card_fin] + have hEq : Set.range f = X := + eq_of_subset_of_ncard_le hsub (by rw [hrange_card, hcard]) hfin + rw [← hEq] at hx + exact hx + +/-- Every node in $\tilde{c}$ of a border cell $c \in \Gamma.C$ belongs to $\Gamma.N \cap +\operatorname{bd} S$. -/ +private lemma border_cell_tilde_subset_N_inter_bd {S : Type} [TopologicalSpace S] (Γ : Painting S) + {c : Set S} (hc : c ∈ Γ.C) (hbd : (c ∩ bd S).Nonempty) : + tilde c ⊆ Γ.N ∩ bd S := by + obtain ⟨u, v, _, htilde, _, _, hu, hv⟩ := Γ.border_cell_exists_ends hc hbd + rw [htilde] + rintro x (rfl | rfl) + · exact hu + · exact hv + +/-- For any internal node $n \in \Gamma.N \setminus \operatorname{bd} S$ with $n \in +\operatorname{dom}(\gamma)$, +$\gamma(n)$ does not belong to $\beta(m+)$ for any border node $m \in \Gamma.N \cap +\operatorname{bd} S$. -/ +private lemma nodeVertex_notMem_borderPlus_of_notMem_bd + {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) + {n m : π.S} (hn_not_bd : n ∉ bd π.S) (hn_dom : n ∈ π.domγ) + (hm_bd : m ∈ π.Γ.N ∩ bd π.S) : + π.nodeVertex n ∉ π.borderPlus m := by + let Θ' := connectedComponentIn (bd π.S) m + have hΘ' : Θ' ∈ cuffs π.S := ⟨m, hm_bd.2, rfl⟩ + have hΘ'_bd : Θ' ⊆ bd π.S := connectedComponentIn_subset (bd π.S) m + have hm_Θ' : m ∈ π.Γ.N ∩ Θ' := ⟨hm_bd.1, mem_connectedComponentIn hm_bd.2⟩ + have hn_not_Θ' : n ∉ Θ' := fun h => hn_not_bd (hΘ'_bd h) + rintro (hmem_bs | ⟨hm_dom, hEq⟩) + · exact π.p4_notMem Θ' hΘ' m hm_Θ' n hn_dom hn_not_Θ' hmem_bs + · have hnm : n = m := π.nodeVertex_injOn hn_dom hm_dom hEq + exact hn_not_bd (hnm ▸ hm_bd.2) + +/-- Every border node $n \in \Gamma.N \cap \operatorname{bd} S$ belongs to $\tilde{d}$ for some +border cell $d \in \Gamma.C$. -/ +private lemma exists_border_cell_of_mem_N_inter_bd + {S : Type} [TopologicalSpace S] (hS : IsSurface S) (Γ : Painting S) + {n : S} (hn : n ∈ Γ.N ∩ bd S) : + ∃ d ∈ Γ.C, (d ∩ bd S).Nonempty ∧ n ∈ tilde d := by + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + let Θ' := connectedComponentIn (bd S) n + have hΘ' : Θ' ∈ cuffs S := ⟨n, hn.2, rfl⟩ + have hΘ'_bd : Θ' ⊆ bd S := connectedComponentIn_subset (bd S) n + have hΘ'_arc : IsOArc Θ' := (GraphMinor.Surface.cuff_statement.{0} S hS).2.2 Θ' hΘ' + obtain ⟨E⟩ := Γ.exists_cuffEnumeration hΘ' hΘ'_arc + have hn_range : n ∈ Set.range E.node := by + rw [E.range_node]; exact ⟨hn.1, mem_connectedComponentIn hn.2⟩ + rcases hn_range with ⟨i, hi⟩ + have hc_range : E.cell i ∈ {d ∈ Γ.C | (d ∩ Θ').Nonempty} := by + rw [← E.range_cell]; exact mem_range_self i + exact ⟨E.cell i, hc_range.1, hc_range.2.mono (inter_subset_inter_right _ hΘ'_bd), + hi ▸ (E.cell_tilde i) ▸ mem_insert _ _⟩ + +private theorem active_cell_unique_path + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Δ : Set π.S} + {n₁ : π.S} + {n₂ : π.S} + {p : ℕ} + (P : Fin (p + 1) → PathFromTo (π.areaGraph Δ).skeleton (π.borderPlus n₁) (π.borderPlus n₂)) + (hP_disj : Pairwise fun i j => Disjoint {z | z ∈ (P i).walk.support} {z | z ∈ (P + j).walk.support}) : + ∀ {d : Set π.S}, d ∈ π.Γ.C → ∀ {l₁ l₂ : Fin (p + 1)}, (fun d l => 2 ≤ {z | z ∈ (P + l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d l₁ → (fun d l => 2 ≤ {z | + z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d l₂ → l₁ = l₂ := by + let activeFor := fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ + π.domγ)}.ncard + intro d hd l₁ l₂ h₁ h₂ + by_contra hne_l + let S₁ := {z ∈ (P l₁).walk.support | z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)} + let S₂ := {z ∈ (P l₂).walk.support | z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)} + have hdisj_S : Disjoint S₁ S₂ := + (hP_disj hne_l).mono (fun _ hz => hz.1) (fun _ hz => hz.1) + have hfin_img : (π.nodeVertex '' (tilde d ∩ π.domγ)).Finite := + ((π.Γ.finite_tilde_cell hd).inter_of_left _).image _ + have hsub_S : S₁ ∪ S₂ ⊆ π.nodeVertex '' (tilde d ∩ π.domγ) := by + rintro z (hz | hz) <;> exact hz.2 + have h1 : (S₁ ∪ S₂).ncard = S₁.ncard + S₂.ncard := + ncard_union_eq hdisj_S (hfin_img.subset fun _ hz => hz.2) (hfin_img.subset fun _ hz => hz.2) + have h2 : (S₁ ∪ S₂).ncard ≤ (π.nodeVertex '' (tilde d ∩ π.domγ)).ncard := + ncard_le_ncard hsub_S hfin_img + have h3 : (π.nodeVertex '' (tilde d ∩ π.domγ)).ncard ≤ (tilde d ∩ π.domγ).ncard := + ncard_image_le ((π.Γ.finite_tilde_cell hd).inter_of_left _) + have h4 : (tilde d ∩ π.domγ).ncard ≤ (tilde d).ncard := + ncard_le_ncard inter_subset_left (π.Γ.finite_tilde_cell hd) + have h5 : (tilde d).ncard ≤ 3 := π.Γ.ncard_tilde_cell_le hd + change 2 ≤ S₁.ncard at h₁ + change 2 ≤ S₂.ncard at h₂ + omega + +private theorem active_cell_marked_boundary + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Δ : Set π.S} + {n₁ : π.S} + {n₂ : π.S} + {p : ℕ} + (P : Fin (p + 1) → PathFromTo (π.areaGraph Δ).skeleton (π.borderPlus n₁) (π.borderPlus n₂)) + (hP_disj : Pairwise fun i j => Disjoint {z | z ∈ (P i).walk.support} {z | z ∈ (P + j).walk.support}) + (j₀ : Fin (p + 1)) + (hact_unique : ∀ {d : Set π.S}, d ∈ π.Γ.C → ∀ {l₁ l₂ : Fin (p + 1)}, (fun d l => 2 ≤ {z | z ∈ + (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d l₁ → (fun d l => 2 ≤ + {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d l₂ → l₁ = l₂) : + ∀ d ∈ π.Γ.C, d ⊆ Δ → ¬(d ∩ bd π.S).Nonempty → (fun d => {n | n ∈ tilde d ∩ π.domγ ∧ ∃ l, (fun + d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d l + ∧ π.nodeVertex n ∈ (P l).walk.support}) d ⊆ tilde d ∧ ((fun d => {n | n ∈ tilde d ∩ π.domγ ∧ + ∃ l, (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ + π.domγ)}.ncard) d l ∧ π.nodeVertex n ∈ (P l).walk.support}) d = ∅ ∨ 2 ≤ ((fun d => {n | n ∈ + tilde d ∩ π.domγ ∧ ∃ l, (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' + (tilde d ∩ π.domγ)}.ncard) d l ∧ π.nodeVertex n ∈ (P l).walk.support}) d).ncard) ∧ ∀ x ∈ + (fun d => {n | n ∈ tilde d ∩ π.domγ ∧ ∃ l, (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ + π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d l ∧ π.nodeVertex n ∈ (P l).walk.support}) d, ∀ + y ∈ (fun d => {n | n ∈ tilde d ∩ π.domγ ∧ ∃ l, (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ + z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d l ∧ π.nodeVertex n ∈ (P l).walk.support}) + d, (fun m => m ∈ π.domγ ∧ π.nodeVertex m ∈ (P j₀).walk.support) x → (fun m => m ∈ π.domγ ∧ + π.nodeVertex m ∈ (P j₀).walk.support) y := by + let activeFor := fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ + π.domγ)}.ncard + let e := fun d => {n | n ∈ tilde d ∩ π.domγ ∧ ∃ l, activeFor d l ∧ π.nodeVertex n ∈ (P + l).walk.support} + let P_mark := fun m => m ∈ π.domγ ∧ π.nodeVertex m ∈ (P j₀).walk.support + intro d hd _ _ + refine ⟨fun _ hn => hn.1.1, ?_, ?_⟩ + · by_cases hne_e : (e d).Nonempty + · right + rcases hne_e with ⟨n₀, _, l, hact_l, _⟩ + have hsub_img : {z ∈ (P l).walk.support | z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)} ⊆ + π.nodeVertex '' e d := by + rintro z ⟨hz_sup, n, hn_td, rfl⟩ + exact ⟨n, ⟨hn_td, l, hact_l, hz_sup⟩, rfl⟩ + have hfin_ed : (e d).Finite := (π.Γ.finite_tilde_cell hd).subset fun _ hn => hn.1.1 + have hle₁ := ncard_le_ncard hsub_img (hfin_ed.image _) + have hle₂ := ncard_image_le (f := π.nodeVertex) hfin_ed + change 2 ≤ ({z ∈ (P l).walk.support | z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}).ncard + at hact_l + change 2 ≤ (e d).ncard + exact hact_l.trans (hle₁.trans hle₂) + · exact Or.inl (not_nonempty_iff_eq_empty.mp hne_e) + · rintro x ⟨_, l₁, hact₁, hx_l₁⟩ y ⟨⟨_, hy_dom⟩, l₂, hact₂, hy_l₂⟩ ⟨_, hx_j₀⟩ + have hl₁_eq : l₁ = l₂ := hact_unique hd hact₁ hact₂ + have hl₁_j₀ : l₁ = j₀ := by + by_contra hne_l + exact Set.disjoint_left.mp (hP_disj hne_l) hx_l₁ hx_j₀ + exact ⟨hy_dom, hl₁_j₀ ▸ hl₁_eq ▸ hy_l₂⟩ + +private theorem disjoint_active_cell_sides + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} + {Δ : Set π.S} + {n₁ : π.S} + {n₂ : π.S} + {p : ℕ} + (hΘ_bd : Θ ⊆ bd π.S) + (P : Fin (p + 1) → PathFromTo (π.areaGraph Δ).skeleton (π.borderPlus n₁) (π.borderPlus n₂)) + (c : Set π.S) + (I₁ : Set π.S) + (I₂ : Set π.S) + (N₁ : Set π.S) + (N₂ : Set π.S) + (hI₁_sub : I₁ ⊆ Θ ∩ discBd Δ) + (hI₂_sub : I₂ ⊆ Θ ∩ discBd Δ) + (hdisj_I : Disjoint I₁ I₂) + (hN₁_sub : N₁ ⊆ (π.Γ.N ∩ Δ) \ bd π.S) + (hN₂_sub : N₂ ⊆ (π.Γ.N ∩ Δ) \ bd π.S) + (hdisj_N : Disjoint N₁ N₂) + (j : Fin (p + 1)) : + Disjoint ({d | d ∈ ({d | d ∈ π.Γ.C ∧ d ⊆ Δ}) ∧ ((d ∩ bd π.S).Nonempty ∧ d ≠ c ∧ tilde d ⊆ I₁ ∨ + ¬(d ∩ bd π.S).Nonempty ∧ (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' + (tilde d ∩ π.domγ)}.ncard) d j ∧ (fun d => {n | n ∈ tilde d ∩ π.domγ ∧ ∃ l, (fun d l => 2 ≤ + {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d l ∧ + π.nodeVertex n ∈ (P l).walk.support}) d ⊆ N₁ ∪ I₁)}) ({d | d ∈ ({d | d ∈ π.Γ.C ∧ d ⊆ Δ}) ∧ + ((d ∩ bd π.S).Nonempty ∧ d ≠ c ∧ tilde d ⊆ I₂ ∨ ¬(d ∩ bd π.S).Nonempty ∧ (fun d l => 2 ≤ {z + | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d j ∧ (fun d => {n + | n ∈ tilde d ∩ π.domγ ∧ ∃ l, (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex + '' (tilde d ∩ π.domγ)}.ncard) d l ∧ π.nodeVertex n ∈ (P l).walk.support}) d ⊆ N₂ ∪ I₂)}) := by + let activeFor := fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ + π.domγ)}.ncard + let e := fun d => {n | n ∈ tilde d ∩ π.domγ ∧ ∃ l, activeFor d l ∧ π.nodeVertex n ∈ (P + l).walk.support} + let I_Δ := {d | d ∈ π.Γ.C ∧ d ⊆ Δ} + let D₁ := {d | d ∈ I_Δ ∧ ((d ∩ bd π.S).Nonempty ∧ d ≠ c ∧ tilde d ⊆ I₁ ∨ ¬(d ∩ bd π.S).Nonempty + ∧ activeFor d j ∧ e d ⊆ N₁ ∪ I₁)} + let D₂ := {d | d ∈ I_Δ ∧ ((d ∩ bd π.S).Nonempty ∧ d ≠ c ∧ tilde d ⊆ I₂ ∨ ¬(d ∩ bd π.S).Nonempty + ∧ activeFor d j ∧ e d ⊆ N₂ ∪ I₂)} + rw [Set.disjoint_left] + rintro d ⟨hd_I, h₁⟩ ⟨_, h₂⟩ + rcases h₁ with ⟨hbd, _, ht₁⟩ | ⟨hint, hact, he₁⟩ + · rcases h₂ with ⟨_, _, ht₂⟩ | ⟨hint₂, _, _⟩ + · obtain ⟨u₀, _, _, htilde_d, _, _, _⟩ := π.Γ.border_cell_exists_ends hd_I.1 hbd + have hu₀ : u₀ ∈ tilde d := htilde_d ▸ mem_insert _ _ + exact Set.disjoint_left.mp hdisj_I (ht₁ hu₀) (ht₂ hu₀) + · exact hint₂ hbd + · rcases h₂ with ⟨hbd, _, _⟩ | ⟨_, _, he₂⟩ + · exact hint hbd + · have hsub_ed : {z ∈ (P j).walk.support | + z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)} ⊆ π.nodeVertex '' e d := by + rintro z ⟨hz_sup, n, hn_td, rfl⟩ + exact ⟨n, ⟨hn_td, j, hact, hz_sup⟩, rfl⟩ + have hfin_ed : (e d).Finite := (π.Γ.finite_tilde_cell hd_I.1).subset fun _ hn => hn.1.1 + have hcard_ed : 2 ≤ (e d).ncard := by + have hle₁ := ncard_le_ncard hsub_ed (hfin_ed.image _) + have hle₂ := ncard_image_le (f := π.nodeVertex) hfin_ed + change 2 ≤ ({z ∈ (P j).walk.support | + z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}).ncard at hact + omega + obtain ⟨n₀, hn₀⟩ : (e d).Nonempty := (ncard_pos hfin_ed).mp (by omega) + have hdisj_NI : Disjoint (N₁ ∪ I₁) (N₂ ∪ I₂) := by + refine Disjoint.union_left (Disjoint.union_right hdisj_N ?_) + (Disjoint.union_right ?_ hdisj_I) + · rw [Set.disjoint_left] + exact fun x hx₁ hx₂ => (hN₁_sub hx₁).2 (hΘ_bd (hI₂_sub hx₂).1) + · rw [Set.disjoint_left] + exact fun x hx₁ hx₂ => (hN₂_sub hx₂).2 (hΘ_bd (hI₁_sub hx₁).1) + exact Set.disjoint_left.mp hdisj_NI (he₁ hn₀) (he₂ hn₀) + +private theorem first_side_path_boundary + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} + {Δ : Set π.S} + {n₁ : π.S} + {n₂ : π.S} + {p : ℕ} + (hΘ_bd : Θ ⊆ bd π.S) + (P : Fin (p + 1) → PathFromTo (π.areaGraph Δ).skeleton (π.borderPlus n₁) (π.borderPlus n₂)) + (c : Set π.S) + (I₁ : Set π.S) + (I₂ : Set π.S) + (N₁ : Set π.S) + (N₂ : Set π.S) + (hc_C : c ∈ π.Γ.C) + (hI₂_sub : I₂ ⊆ Θ ∩ discBd Δ) + (hdisj_I : Disjoint I₁ I₂) + (hN₁_sub : N₁ ⊆ (π.Γ.N ∩ Δ) \ bd π.S) + (hdisj_N : Disjoint N₁ N₂) + (hc_bd : (c ∩ bd π.S).Nonempty) + (j : Fin (p + 1)) + (Q : PathFromTo (π.areaGraph Δ).skeleton (⋃ n ∈ I₁ ∩ π.Γ.N, π.borderPlus n) (⋃ n ∈ I₂ ∩ π.Γ.N, + π.borderPlus n)) + (hQ_sub : {z | z ∈ Q.walk.support} ⊆ {z | z ∈ (P j).walk.support}) + (hdisj_D₁_D₂ : Disjoint ({d | d ∈ ({d | d ∈ π.Γ.C ∧ d ⊆ Δ}) ∧ ((d ∩ bd π.S).Nonempty ∧ d ≠ c ∧ + tilde d ⊆ I₁ ∨ ¬(d ∩ bd π.S).Nonempty ∧ (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ + π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d j ∧ (fun d => {n | n ∈ tilde d ∩ π.domγ ∧ ∃ l, + (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) + d l ∧ π.nodeVertex n ∈ (P l).walk.support}) d ⊆ N₁ ∪ I₁)}) ({d | d ∈ ({d | d ∈ π.Γ.C ∧ d ⊆ + Δ}) ∧ ((d ∩ bd π.S).Nonempty ∧ d ≠ c ∧ tilde d ⊆ I₂ ∨ ¬(d ∩ bd π.S).Nonempty ∧ (fun d l => 2 + ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d j ∧ (fun d + => {n | n ∈ tilde d ∩ π.domγ ∧ ∃ l, (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ + π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d l ∧ π.nodeVertex n ∈ (P l).walk.support}) d ⊆ + N₂ ∪ I₂)})) + (hc_not_D₁ : c ∉ ({d | d ∈ ({d | d ∈ π.Γ.C ∧ d ⊆ Δ}) ∧ ((d ∩ bd π.S).Nonempty ∧ d ≠ c ∧ tilde + d ⊆ I₁ ∨ ¬(d ∩ bd π.S).Nonempty ∧ (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ + π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d j ∧ (fun d => {n | n ∈ tilde d ∩ π.domγ ∧ ∃ l, + (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) + d l ∧ π.nodeVertex n ∈ (P l).walk.support}) d ⊆ N₁ ∪ I₁)})) : + ∀ z ∈ Q.walk.support, z ∈ (π.cellsUnion ({d | d ∈ ({d | d ∈ π.Γ.C ∧ d ⊆ Δ}) ∧ ((d ∩ bd + π.S).Nonempty ∧ d ≠ c ∧ tilde d ⊆ I₁ ∨ ¬(d ∩ bd π.S).Nonempty ∧ (fun d l => 2 ≤ {z | z ∈ (P + l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d j ∧ (fun d => {n | n ∈ + tilde d ∩ π.domγ ∧ ∃ l, (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' + (tilde d ∩ π.domγ)}.ncard) d l ∧ π.nodeVertex n ∈ (P l).walk.support}) d ⊆ N₁ ∪ + I₁)})).vertexSet → z ∈ ((π.cellsUnion ({d | d ∈ ({d | d ∈ π.Γ.C ∧ d ⊆ Δ}) ∧ ((d ∩ bd + π.S).Nonempty ∧ d ≠ c ∧ tilde d ⊆ I₂ ∨ ¬(d ∩ bd π.S).Nonempty ∧ (fun d l => 2 ≤ {z | z ∈ (P + l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d j ∧ (fun d => {n | n ∈ + tilde d ∩ π.domγ ∧ ∃ l, (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' + (tilde d ∩ π.domγ)}.ncard) d l ∧ π.nodeVertex n ∈ (P l).walk.support}) d ⊆ N₂ ∪ I₂)})) ∪ + (π.cellGraph c)).vertexSet ∨ z ∈ (⋃ n ∈ I₂ ∩ π.Γ.N, π.borderPlus n) → z ∈ (⋃ n ∈ I₁ ∩ π.Γ.N, + π.borderPlus n) := by + let activeFor := fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ + π.domγ)}.ncard + let e := fun d => {n | n ∈ tilde d ∩ π.domγ ∧ ∃ l, activeFor d l ∧ π.nodeVertex n ∈ (P + l).walk.support} + let B₁ := ⋃ n ∈ I₁ ∩ π.Γ.N, π.borderPlus n + let B₂ := ⋃ n ∈ I₂ ∩ π.Γ.N, π.borderPlus n + let I_Δ := {d | d ∈ π.Γ.C ∧ d ⊆ Δ} + let D₁ := {d | d ∈ I_Δ ∧ ((d ∩ bd π.S).Nonempty ∧ d ≠ c ∧ tilde d ⊆ I₁ ∨ ¬(d ∩ bd π.S).Nonempty + ∧ activeFor d j ∧ e d ⊆ N₁ ∪ I₁)} + let D₂ := {d | d ∈ I_Δ ∧ ((d ∩ bd π.S).Nonempty ∧ d ≠ c ∧ tilde d ⊆ I₂ ∨ ¬(d ∩ bd π.S).Nonempty + ∧ activeFor d j ∧ e d ⊆ N₂ ∪ I₂)} + let H₁ := π.cellsUnion D₁ + let H₂ := π.cellsUnion D₂ + let Hc := π.cellGraph c + intro z hz_Q hz_H₁ hz_other + have hz_P : z ∈ (P j).walk.support := hQ_sub hz_Q + change z ∈ ⋃ d ∈ _, _ at hz_H₁ + rw [mem_iUnion₂] at hz_H₁ + rcases hz_H₁ with ⟨d₁, ⟨hd₁, hd₁_C⟩, hzd₁⟩ + -- Find a cell `d₂ ∈ π.Γ.C` with `d₂ ≠ d₁` and `z ∈ V(α(d₂))`. + have hex_d₂ : ∃ d₂ ∈ π.Γ.C, d₂ ≠ d₁ ∧ z ∈ (π.cellGraph d₂).vertexSet ∧ + (d₂ ∈ D₂ ∨ (d₂ ∩ bd π.S).Nonempty) := by + rcases hz_other with (hz_H₂ | hz_Hc) | hz_B₂ + · change z ∈ ⋃ d ∈ _, _ at hz_H₂ + rw [mem_iUnion₂] at hz_H₂ + rcases hz_H₂ with ⟨d₂, ⟨hd₂, hd₂_C⟩, hzd₂⟩ + exact ⟨d₂, hd₂_C, fun h => Set.disjoint_left.mp hdisj_D₁_D₂ hd₁ (h ▸ hd₂), + hzd₂, Or.inl hd₂⟩ + · exact ⟨c, hc_C, fun h => hc_not_D₁ (h ▸ hd₁), hz_Hc, Or.inr hc_bd⟩ + · rw [mem_iUnion₂] at hz_B₂ + rcases hz_B₂ with ⟨m', hm'_I₂, hzm'⟩ + have hm'_bd : m' ∈ π.Γ.N ∩ bd π.S := ⟨hm'_I₂.2, hΘ_bd (hI₂_sub hm'_I₂.1).1⟩ + obtain ⟨d₂, hd₂_C, hd₂_bd, hm'_d₂⟩ := + exists_border_cell_of_mem_N_inter_bd π.isSurface π.Γ hm'_bd + have hzd₂ : z ∈ (π.cellGraph d₂).vertexSet := + π.borderPlus_subset_cellGraph hd₂_C hd₂_bd hm'_d₂ hzm' + have hd₂_ne : d₂ ≠ d₁ := by + intro hEq + rcases hd₁.2 with ⟨_, _, ht₁⟩ | ⟨hint, _, _⟩ + · exact Set.disjoint_left.mp hdisj_I (ht₁ (hEq ▸ hm'_d₂)) hm'_I₂.1 + · exact hint (hEq ▸ hd₂_bd) + exact ⟨d₂, hd₂_C, hd₂_ne, hzd₂, Or.inr hd₂_bd⟩ + obtain ⟨d₂, hd₂_C, hd₂_ne, hzd₂, hd₂_kind⟩ := hex_d₂ + rcases hd₁.2 with ⟨hbd₁, _, ht₁⟩ | ⟨hint₁, hact₁, he₁⟩ + · obtain ⟨n, hn_t₁, hzn⟩ := π.p6_borderPlus hd₁_C hbd₁ hzd₁ ⟨d₂, hd₂_C, hd₂_ne, hzd₂⟩ + exact mem_biUnion ⟨ht₁ hn_t₁, π.Γ.tilde_subset_N hd₁_C hn_t₁⟩ hzn + · obtain ⟨n, ⟨hn_t₁, hn_dom⟩, rfl⟩ := + π.p5 d₁ hd₁_C hint₁ z hzd₁ ⟨d₂, hd₂_C, hd₂_ne, hzd₂⟩ + have hn_ed₁ : n ∈ e d₁ := ⟨⟨hn_t₁, hn_dom⟩, j, hact₁, hz_P⟩ + rcases he₁ hn_ed₁ with hn_N₁ | hn_I₁ + · exfalso + have hn_not_bd : n ∉ bd π.S := (hN₁_sub hn_N₁).2 + rcases hd₂_kind with hd₂_D₂ | hd₂_bd + · rcases hd₂_D₂.2 with ⟨hbd₂, _, _⟩ | ⟨hint₂, hact₂, he₂⟩ + · obtain ⟨m', hm'_t₂, hnm'⟩ := + π.p6_borderPlus hd₂_C hbd₂ hzd₂ ⟨d₁, hd₁_C, hd₂_ne.symm, hzd₁⟩ + have hm'_bd : m' ∈ π.Γ.N ∩ bd π.S := + border_cell_tilde_subset_N_inter_bd π.Γ hd₂_C hbd₂ hm'_t₂ + exact nodeVertex_notMem_borderPlus_of_notMem_bd π hn_not_bd hn_dom hm'_bd hnm' + · obtain ⟨n', ⟨hn'_t₂, hn'_dom⟩, hEq_nv⟩ := + π.p5 d₂ hd₂_C hint₂ (π.nodeVertex n) hzd₂ ⟨d₁, hd₁_C, hd₂_ne.symm, hzd₁⟩ + have hn_eq : n' = n := π.nodeVertex_injOn hn'_dom hn_dom hEq_nv + have hn_ed₂ : n ∈ e d₂ := ⟨⟨hn_eq ▸ hn'_t₂, hn_dom⟩, j, hact₂, hz_P⟩ + rcases he₂ hn_ed₂ with hn_N₂ | hn_I₂ + · exact Set.disjoint_left.mp hdisj_N hn_N₁ hn_N₂ + · exact hn_not_bd (hΘ_bd (hI₂_sub hn_I₂).1) + · obtain ⟨m', hm'_t₂, hnm'⟩ := + π.p6_borderPlus hd₂_C hd₂_bd hzd₂ ⟨d₁, hd₁_C, hd₂_ne.symm, hzd₁⟩ + have hm'_bd : m' ∈ π.Γ.N ∩ bd π.S := + border_cell_tilde_subset_N_inter_bd π.Γ hd₂_C hd₂_bd hm'_t₂ + exact nodeVertex_notMem_borderPlus_of_notMem_bd π hn_not_bd hn_dom hm'_bd hnm' + · exact mem_biUnion ⟨hn_I₁, π.Γ.tilde_subset_N hd₁_C hn_t₁⟩ (Or.inr ⟨hn_dom, rfl⟩) + +private theorem second_side_path_boundary + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} + {Δ : Set π.S} + {n₁ : π.S} + {n₂ : π.S} + {p : ℕ} + (hΘ_bd : Θ ⊆ bd π.S) + (P : Fin (p + 1) → PathFromTo (π.areaGraph Δ).skeleton (π.borderPlus n₁) (π.borderPlus n₂)) + (c : Set π.S) + (I₁ : Set π.S) + (I₂ : Set π.S) + (N₂ : Set π.S) + (hc_C : c ∈ π.Γ.C) + (hI₁_sub : I₁ ⊆ Θ ∩ discBd Δ) + (hdisj_I : Disjoint I₁ I₂) + (hN₂_sub : N₂ ⊆ (π.Γ.N ∩ Δ) \ bd π.S) + (hc_bd : (c ∩ bd π.S).Nonempty) + (j : Fin (p + 1)) + (Q : PathFromTo (π.areaGraph Δ).skeleton (⋃ n ∈ I₁ ∩ π.Γ.N, π.borderPlus n) (⋃ n ∈ I₂ ∩ π.Γ.N, + π.borderPlus n)) + (hQ_sub : {z | z ∈ Q.walk.support} ⊆ {z | z ∈ (P j).walk.support}) + (hc_not_D₂ : c ∉ ({d | d ∈ ({d | d ∈ π.Γ.C ∧ d ⊆ Δ}) ∧ ((d ∩ bd π.S).Nonempty ∧ d ≠ c ∧ tilde + d ⊆ I₂ ∨ ¬(d ∩ bd π.S).Nonempty ∧ (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ + π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d j ∧ (fun d => {n | n ∈ tilde d ∩ π.domγ ∧ ∃ l, + (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) + d l ∧ π.nodeVertex n ∈ (P l).walk.support}) d ⊆ N₂ ∪ I₂)})) : + ∀ z ∈ Q.walk.support, z ∈ (π.cellsUnion ({d | d ∈ ({d | d ∈ π.Γ.C ∧ d ⊆ Δ}) ∧ ((d ∩ bd + π.S).Nonempty ∧ d ≠ c ∧ tilde d ⊆ I₂ ∨ ¬(d ∩ bd π.S).Nonempty ∧ (fun d l => 2 ≤ {z | z ∈ (P + l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}.ncard) d j ∧ (fun d => {n | n ∈ + tilde d ∩ π.domγ ∧ ∃ l, (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' + (tilde d ∩ π.domγ)}.ncard) d l ∧ π.nodeVertex n ∈ (P l).walk.support}) d ⊆ N₂ ∪ + I₂)})).vertexSet → z ∈ (π.cellGraph c).vertexSet ∨ z ∈ (⋃ n ∈ I₁ ∩ π.Γ.N, π.borderPlus n) → + z ∈ (⋃ n ∈ I₂ ∩ π.Γ.N, π.borderPlus n) := by + let activeFor := fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ + π.domγ)}.ncard + let e := fun d => {n | n ∈ tilde d ∩ π.domγ ∧ ∃ l, activeFor d l ∧ π.nodeVertex n ∈ (P + l).walk.support} + let B₁ := ⋃ n ∈ I₁ ∩ π.Γ.N, π.borderPlus n + let B₂ := ⋃ n ∈ I₂ ∩ π.Γ.N, π.borderPlus n + let I_Δ := {d | d ∈ π.Γ.C ∧ d ⊆ Δ} + let D₂ := {d | d ∈ I_Δ ∧ ((d ∩ bd π.S).Nonempty ∧ d ≠ c ∧ tilde d ⊆ I₂ ∨ ¬(d ∩ bd π.S).Nonempty + ∧ activeFor d j ∧ e d ⊆ N₂ ∪ I₂)} + let H₂ := π.cellsUnion D₂ + let Hc := π.cellGraph c + intro z hz_Q hz_H₂ hz_other + have hz_P : z ∈ (P j).walk.support := hQ_sub hz_Q + change z ∈ ⋃ d ∈ _, _ at hz_H₂ + rw [mem_iUnion₂] at hz_H₂ + rcases hz_H₂ with ⟨d₂, ⟨hd₂, hd₂_C⟩, hzd₂⟩ + have hex_d₁ : ∃ d₁ ∈ π.Γ.C, d₁ ≠ d₂ ∧ z ∈ (π.cellGraph d₁).vertexSet ∧ + (d₁ ∩ bd π.S).Nonempty := by + rcases hz_other with hz_Hc | hz_B₁ + · exact ⟨c, hc_C, fun h => hc_not_D₂ (h ▸ hd₂), hz_Hc, hc_bd⟩ + · rw [mem_iUnion₂] at hz_B₁ + rcases hz_B₁ with ⟨m', hm'_I₁, hzm'⟩ + have hm'_bd : m' ∈ π.Γ.N ∩ bd π.S := ⟨hm'_I₁.2, hΘ_bd (hI₁_sub hm'_I₁.1).1⟩ + obtain ⟨d₁, hd₁_C, hd₁_bd, hm'_d₁⟩ := + exists_border_cell_of_mem_N_inter_bd π.isSurface π.Γ hm'_bd + have hzd₁ : z ∈ (π.cellGraph d₁).vertexSet := + π.borderPlus_subset_cellGraph hd₁_C hd₁_bd hm'_d₁ hzm' + have hd₁_ne : d₁ ≠ d₂ := by + intro hEq + rcases hd₂.2 with ⟨_, _, ht₂⟩ | ⟨hint, _, _⟩ + · exact Set.disjoint_left.mp hdisj_I hm'_I₁.1 (ht₂ (hEq ▸ hm'_d₁)) + · exact hint (hEq ▸ hd₁_bd) + exact ⟨d₁, hd₁_C, hd₁_ne, hzd₁, hd₁_bd⟩ + obtain ⟨d₁, hd₁_C, hd₁_ne, hzd₁, hd₁_bd⟩ := hex_d₁ + rcases hd₂.2 with ⟨hbd₂, _, ht₂⟩ | ⟨hint₂, hact₂, he₂⟩ + · obtain ⟨n, hn_t₂, hzn⟩ := π.p6_borderPlus hd₂_C hbd₂ hzd₂ ⟨d₁, hd₁_C, hd₁_ne, hzd₁⟩ + exact mem_biUnion ⟨ht₂ hn_t₂, π.Γ.tilde_subset_N hd₂_C hn_t₂⟩ hzn + · obtain ⟨n, ⟨hn_t₂, hn_dom⟩, rfl⟩ := + π.p5 d₂ hd₂_C hint₂ z hzd₂ ⟨d₁, hd₁_C, hd₁_ne, hzd₁⟩ + have hn_ed₂ : n ∈ e d₂ := ⟨⟨hn_t₂, hn_dom⟩, j, hact₂, hz_P⟩ + rcases he₂ hn_ed₂ with hn_N₂ | hn_I₂ + · exfalso + have hn_not_bd : n ∉ bd π.S := (hN₂_sub hn_N₂).2 + obtain ⟨m', hm'_t₁, hnm'⟩ := + π.p6_borderPlus hd₁_C hd₁_bd hzd₁ ⟨d₂, hd₂_C, hd₁_ne.symm, hzd₂⟩ + have hm'_bd : m' ∈ π.Γ.N ∩ bd π.S := + border_cell_tilde_subset_N_inter_bd π.Γ hd₁_C hd₁_bd hm'_t₁ + exact nodeVertex_notMem_borderPlus_of_notMem_bd π hn_not_bd hn_dom hm'_bd hnm' + · exact mem_biUnion ⟨hn_I₂, π.Γ.tilde_subset_N hd₂_C hn_t₂⟩ (Or.inr ⟨hn_dom, rfl⟩) + +private theorem cuff_node_border_count_le_warp + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} + (hΘ : Θ ∈ cuffs π.S) + (hΘ_bd : Θ ⊆ bd π.S) + (hΘ_arc : IsOArc Θ) : + ∀ {n : π.S}, n ∈ π.Γ.N ∩ Θ → (π.borderSet n).ncard ≤ π.warpAt Θ := by + intro n hn + obtain ⟨E⟩ := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + have hn_range : n ∈ Set.range E.node := by rw [E.range_node]; exact hn + rcases hn_range with ⟨i, rfl⟩ + have hc_range : E.cell i ∈ {d ∈ π.Γ.C | (d ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact mem_range_self i + have hbd_c : (E.cell i ∩ bd π.S).Nonempty := + hc_range.2.mono (inter_subset_inter_right _ hΘ_bd) + have hn_t : E.node i ∈ tilde (E.cell i) := by + rw [E.cell_tilde i]; exact mem_insert _ _ + exact (π.ncard_borderSet_le_cellWarp hc_range.1 hbd_c hn_t).trans + (π.cellWarp_le_warpAt hc_range.1 hc_range.2) + +private theorem subpath_enters_second_side + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Δ : Set π.S} + (B₁ : Set α) + (B₂ : Set α) + (Q : PathFromTo (π.areaGraph Δ).skeleton B₁ B₂) + (hst : ¬Q.first = Q.last) + (hQ_no_inter : ∀ z ∈ Q.walk.support, z ∉ B₁ ∩ B₂) + (H₁ H₂ Hc : Hypergraph α β) + (hdisjE_1_2c : Disjoint H₁.edgeSet (H₂ ∪ Hc).edgeSet) + (w₀ : (H₁ ∪ (H₂ ∪ Hc)).skeleton.Walk Q.first + Q.last) + (hw₀_sup : w₀.support = Q.walk.support) + (hw₀_path : w₀.IsPath) + (hH₁_boundary : ∀ z ∈ Q.walk.support, z ∈ H₁.vertexSet → z ∈ (H₂ + ∪ Hc).vertexSet ∨ z ∈ B₂ → z ∈ B₁) + (hint_w₀ : ∀ z ∈ w₀.support, z ≠ Q.first → z ≠ Q.last → z ∉ H₁.vertexSet ∩ + (H₂ ∪ Hc).vertexSet) : + ∃ w₂c : (H₂ ∪ Hc).skeleton.Walk Q.first Q.last, w₂c.support = Q.walk.support := by + rcases walk_in_left_or_right_of_internal_disjoint hdisjE_1_2c w₀ hw₀_path hint_w₀ with + ⟨w₁, hw₁_sup⟩ | ⟨w₂c, hw₂c_sup⟩ + · exfalso + have ht_H₁ : Q.last ∈ H₁.vertexSet := + (walk_endpoints_mem_vertexSet_of_ne w₁ hst).2 + have ht_B₁ : Q.last ∈ B₁ := + hH₁_boundary Q.last (SimpleGraph.Walk.end_mem_support Q.walk) ht_H₁ + (Or.inr Q.last_mem) + exact hQ_no_inter Q.last (SimpleGraph.Walk.end_mem_support Q.walk) ⟨ht_B₁, Q.last_mem⟩ + · exact ⟨w₂c, hw₂c_sup.trans hw₀_sup⟩ + +private theorem subpath_lies_in_terminal_cell + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Δ : Set π.S} + (B₁ : Set α) + (B₂ : Set α) + (Q : PathFromTo (π.areaGraph Δ).skeleton B₁ B₂) + (hst : ¬Q.first = Q.last) + (hQ_no_inter : ∀ z ∈ Q.walk.support, z ∉ B₁ ∩ B₂) + (H₂ Hc : Hypergraph α β) + (hdisjE_2_c : Disjoint H₂.edgeSet Hc.edgeSet) + (hH₂_boundary : ∀ z ∈ Q.walk.support, z ∈ H₂.vertexSet → z ∈ Hc.vertexSet ∨ z ∈ B₁ → z ∈ B₂) + (w₂c : (H₂ ∪ Hc).skeleton.Walk Q.first Q.last) + (hw₂c_sup : w₂c.support = Q.walk.support) + (hw₂c_path : w₂c.IsPath) + (hint_w₂c : ∀ z ∈ w₂c.support, z ≠ Q.first → z ≠ Q.last → z ∉ H₂.vertexSet ∩ + Hc.vertexSet) : + ∃ wc : Hc.skeleton.Walk Q.first Q.last, wc.support = Q.walk.support := by + rcases walk_in_left_or_right_of_internal_disjoint hdisjE_2_c w₂c hw₂c_path hint_w₂c with + ⟨w₂, hw₂_sup⟩ | ⟨wc, hwc_sup⟩ + · exfalso + have hs_H₂ : Q.first ∈ H₂.vertexSet := + (walk_endpoints_mem_vertexSet_of_ne w₂ hst).1 + have hs_B₂ : Q.first ∈ B₂ := + hH₂_boundary Q.first (SimpleGraph.Walk.start_mem_support Q.walk) hs_H₂ + (Or.inr Q.first_mem) + exact hQ_no_inter Q.first (SimpleGraph.Walk.start_mem_support Q.walk) ⟨Q.first_mem, hs_B₂⟩ + · exact ⟨wc, hwc_sup.trans hw₂c_sup⟩ + +/-- A linkage across the two sides of a partitioned disc restricts to the middle cell, +preserving containment in the support of each original path. -/ +theorem path_family_restricts_to_middle_cell + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} + {Δ : Set π.S} + {n₁ : π.S} + {n₂ : π.S} + {p : ℕ} + (hΘ : Θ ∈ cuffs π.S) + (hn₁ : n₁ ∈ π.Γ.N ∩ Θ) + (hn₂ : n₂ ∈ π.Γ.N ∩ Θ) + (hinter_sub : ∀ n ∈ π.Γ.N ∩ (Θ ∩ discBd Δ), + π.borderPlus n₁ ∩ π.borderPlus n₂ ⊆ π.borderPlus n) + (hΘ_bd : Θ ⊆ bd π.S) + (P : Fin (p + 1) → PathFromTo (π.areaGraph Δ).skeleton (π.borderPlus n₁) (π.borderPlus n₂)) + (m₁ : π.S) + (m₂ : π.S) + (c : Set π.S) + (I₁ : Set π.S) + (I₂ : Set π.S) + (N₁ : Set π.S) + (N₂ : Set π.S) + (hm₁_mem : m₁ ∈ π.Γ.N ∩ (Θ ∩ discBd Δ)) + (hm₂_mem : m₂ ∈ π.Γ.N ∩ (Θ ∩ discBd Δ)) + (hc_C : c ∈ π.Γ.C) + (htilde_c : tilde c = {m₁, m₂}) + (hI₁_sub : I₁ ⊆ Θ ∩ discBd Δ) + (hI₂_sub : I₂ ⊆ Θ ∩ discBd Δ) + (hdisj_I : Disjoint I₁ I₂) + (hm₁_I₁ : m₁ ∈ I₁) + (hm₂_I₂ : m₂ ∈ I₂) + (hN₁_sub : N₁ ⊆ (π.Γ.N ∩ Δ) \ bd π.S) + (hN₂_sub : N₂ ⊆ (π.Γ.N ∩ Δ) \ bd π.S) + (hdisj_N : Disjoint N₁ N₂) + (hord_I : ∀ n ∈ I₁ ∩ π.Γ.N, ∀ n' ∈ I₂ ∩ π.Γ.N, (n ≠ n₁ → n ≠ m₁ → GM19.InOrderOn Θ n₁ n m₁ n') + ∧ (m₁ ≠ n₁ → n' ≠ n₂ → GM19.InOrderOn Θ n₁ m₁ n' n₂) ∧ (n' ≠ m₂ → n' ≠ n₂ → GM19.InOrderOn Θ + n m₂ n' n₂) ∧ (n ≠ n₁ → m₂ ≠ n₂ → GM19.InOrderOn Θ n₁ n m₂ n₂)) + (c₁_end : Set π.S) + (hc₁_C : c₁_end ∈ π.Γ.C) + (hc₁_Δ : c₁_end ⊆ Δ) + (hc₁_bd : (c₁_end ∩ bd π.S).Nonempty) + (hn₁_c₁ : n₁ ∈ tilde c₁_end) + (c₂_end : Set π.S) + (hc₂_C : c₂_end ∈ π.Γ.C) + (hc₂_Δ : c₂_end ⊆ Δ) + (hc₂_bd : (c₂_end ∩ bd π.S).Nonempty) + (hn₂_c₂ : n₂ ∈ tilde c₂_end) + (hborder_split : ∀ d ∈ π.Γ.C, d ⊆ Δ → (d ∩ bd π.S).Nonempty → d ≠ c → tilde d ⊆ I₁ ∨ tilde d ⊆ + I₂) + (hint_split : ∀ d ∈ π.Γ.C, d ⊆ Δ → ¬(d ∩ bd π.S).Nonempty → (fun d => {n | n ∈ tilde d ∩ + π.domγ ∧ ∃ l, (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ + π.domγ)}.ncard) d l ∧ π.nodeVertex n ∈ (P l).walk.support}) d ⊆ N₁ ∪ I₁ ∨ (fun d => {n | n ∈ + tilde d ∩ π.domγ ∧ ∃ l, (fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' + (tilde d ∩ π.domγ)}.ncard) d l ∧ π.nodeVertex n ∈ (P l).walk.support}) d ⊆ N₂ ∪ I₂) + (hc_bd : (c ∩ bd π.S).Nonempty) + (hbp₁_sub_B₁ : π.borderPlus n₁ ⊆ (⋃ n ∈ I₁ ∩ π.Γ.N, π.borderPlus n)) + (hbp₂_sub_B₂ : π.borderPlus n₂ ⊆ (⋃ n ∈ I₂ ∩ π.Γ.N, π.borderPlus n)) + (hbp_m₁_sub_B₁ : π.borderPlus m₁ ⊆ (⋃ n ∈ I₁ ∩ π.Γ.N, π.borderPlus n)) + (hbp_m₂_sub_B₂ : π.borderPlus m₂ ⊆ (⋃ n ∈ I₂ ∩ π.Γ.N, π.borderPlus n)) : + ∀ j : Fin (p + 1), + ∃ Q' : PathFromTo (π.cellGraph c).skeleton (π.borderPlus m₁) (π.borderPlus m₂), + {z | z ∈ Q'.walk.support} ⊆ {z | z ∈ (P j).walk.support} ∧ + Q'.first ∈ ⋃ n ∈ I₁ ∩ π.Γ.N, π.borderPlus n ∧ + Q'.last ∈ ⋃ n ∈ I₂ ∩ π.Γ.N, π.borderPlus n := by + let activeFor := fun d l => 2 ≤ {z | z ∈ (P l).walk.support ∧ z ∈ π.nodeVertex '' (tilde d ∩ + π.domγ)}.ncard + let e := fun d => {n | n ∈ tilde d ∩ π.domγ ∧ ∃ l, activeFor d l ∧ π.nodeVertex n ∈ (P + l).walk.support} + let B₁ := ⋃ n ∈ I₁ ∩ π.Γ.N, π.borderPlus n + let B₂ := ⋃ n ∈ I₂ ∩ π.Γ.N, π.borderPlus n + intro j + let Pj_B : PathFromTo (π.areaGraph Δ).skeleton B₁ B₂ := + ⟨(P j).first, (P j).last, (P j).walk, (P j).isPath, + hbp₁_sub_B₁ (P j).first_mem, hbp₂_sub_B₂ (P j).last_mem⟩ + obtain ⟨Q, hQ_sub, hQ_int, hQ_inter⟩ := exists_minimal_subpath_from_to Pj_B + by_cases hst : Q.first = Q.last + · have hSingletonPath : + ∃ Q' : PathFromTo (π.cellGraph c).skeleton (π.borderPlus m₁) (π.borderPlus m₂), + {z | z ∈ Q'.walk.support} ⊆ {z | z ∈ (P j).walk.support} ∧ + Q'.first ∈ B₁ ∧ Q'.last ∈ B₂ := by + exact common_boundary_vertex_yields_trivial_path (α := α) (β := β) (G := G) π (Θ := Θ) (Δ + := Δ) (n₁ := n₁) (n₂ := n₂) (p := p) hΘ hn₁ hn₂ + hinter_sub P m₁ m₂ c I₁ I₂ hm₁_mem hm₂_mem + hI₁_sub hI₂_sub hord_I j Q hQ_sub hst + exact hSingletonPath + · -- Case 2: `s_j ≠ t_j` (page 180). + have hQ_no_inter : ∀ z ∈ Q.walk.support, z ∉ B₁ ∩ B₂ := hQ_inter hst + let I_Δ : Set (Set π.S) := {d ∈ π.Γ.C | d ⊆ Δ} + -- Every internal cell `d ∈ I_Δ` used by `P j` has `activeFor d j`. + have hcell_active : ∀ {d : Set π.S}, d ∈ I_Δ → ¬ (d ∩ bd π.S).Nonempty → + ∀ {x y : α}, x ∈ (P j).walk.support → y ∈ (P j).walk.support → x ≠ y → + ∀ {e₀ : β}, (π.cellGraph d).Inc e₀ x → (π.cellGraph d).Inc e₀ y → + activeFor d j := by + exact interior_cell_active_of_path_edge (α := α) (β := β) (G := G) π (Δ := Δ) (n₁ + := n₁) (n₂ := n₂) (p := p) P c₁_end hc₁_C hc₁_Δ hc₁_bd hn₁_c₁ c₂_end hc₂_C hc₂_Δ hc₂_bd + hn₂_c₂ j + -- Partition the active cells of `I_Δ` into `D₁`, `D₂`, and `{c}`. + let D₁ : Set (Set π.S) := + {d ∈ I_Δ | ((d ∩ bd π.S).Nonempty ∧ d ≠ c ∧ tilde d ⊆ I₁) ∨ + (¬ (d ∩ bd π.S).Nonempty ∧ activeFor d j ∧ e d ⊆ N₁ ∪ I₁)} + let D₂ : Set (Set π.S) := + {d ∈ I_Δ | ((d ∩ bd π.S).Nonempty ∧ d ≠ c ∧ tilde d ⊆ I₂) ∨ + (¬ (d ∩ bd π.S).Nonempty ∧ activeFor d j ∧ e d ⊆ N₂ ∪ I₂)} + let H₁ := π.cellsUnion D₁ + let H₂ := π.cellsUnion D₂ + let Hc := π.cellGraph c + have hD₁_sub : D₁ ⊆ π.Γ.C := fun _ hd => hd.1.1 + have hD₂_sub : D₂ ⊆ π.Γ.C := fun _ hd => hd.1.1 + have hdisj_D₁_D₂ : Disjoint D₁ D₂ := by + exact disjoint_active_cell_sides (α := α) (β := β) (G := G) π (Θ := Θ) (Δ := Δ) (n₁ := n₁) + (n₂ := n₂) (p := p) hΘ_bd P c I₁ I₂ N₁ N₂ hI₁_sub hI₂_sub hdisj_I hN₁_sub hN₂_sub + hdisj_N j + have hc_not_D₁ : c ∉ D₁ := by + rintro ⟨_, ⟨_, hne_c, _⟩ | ⟨hint, _, _⟩⟩ + · exact hne_c rfl + · exact hint hc_bd + have hc_not_D₂ : c ∉ D₂ := by + rintro ⟨_, ⟨_, hne_c, _⟩ | ⟨hint, _, _⟩⟩ + · exact hne_c rfl + · exact hint hc_bd + have hdisjE_1_2c : Disjoint H₁.edgeSet (H₂ ∪ Hc).edgeSet := by + rw [union_edgeSet] + refine Disjoint.union_right ?_ ?_ + · rw [Set.disjoint_left] + intro e₀ he₁ he₂ + change e₀ ∈ ⋃ d ∈ _, _ at he₁ he₂ + rw [mem_iUnion₂] at he₁ he₂ + rcases he₁ with ⟨d₁, ⟨hd₁, hd₁_C⟩, he₁⟩ + rcases he₂ with ⟨d₂, ⟨hd₂, hd₂_C⟩, he₂⟩ + exact Set.disjoint_left.mp + (π.p1_disjoint d₁ hd₁_C d₂ hd₂_C (fun h => Set.disjoint_left.mp hdisj_D₁_D₂ hd₁ + (h ▸ hd₂))) + he₁ he₂ + · rw [Set.disjoint_left] + intro e₀ he₁ hec + change e₀ ∈ ⋃ d ∈ _, _ at he₁ + rw [mem_iUnion₂] at he₁ + rcases he₁ with ⟨d₁, ⟨hd₁, hd₁_C⟩, he₁⟩ + exact Set.disjoint_left.mp + (π.p1_disjoint d₁ hd₁_C c hc_C (fun h => hc_not_D₁ (h ▸ hd₁))) he₁ hec + have hdisjE_2_c : Disjoint H₂.edgeSet Hc.edgeSet := by + rw [Set.disjoint_left] + intro e₀ he₂ hec + change e₀ ∈ ⋃ d ∈ _, _ at he₂ + rw [mem_iUnion₂] at he₂ + rcases he₂ with ⟨d₂, ⟨hd₂, hd₂_C⟩, he₂⟩ + exact Set.disjoint_left.mp + (π.p1_disjoint d₂ hd₂_C c hc_C (fun h => hc_not_D₂ (h ▸ hd₂))) he₂ hec + -- Lift `Q.walk` to `(H₁ ∪ (H₂ ∪ Hc)).skeleton`. + have hQ_lift_all : ∃ w₀ : (H₁ ∪ (H₂ ∪ Hc)).skeleton.Walk Q.first Q.last, + w₀.support = Q.walk.support := by + exact walk_lifts_to_three_areas π (fun d ↦ activeFor d j) e hborder_split hint_split + Q.walk hQ_sub hcell_active + obtain ⟨w₀, hw₀_sup⟩ := hQ_lift_all + have hw₀_path : w₀.IsPath := by + rw [SimpleGraph.Walk.isPath_def, hw₀_sup] + exact Q.isPath.support_nodup + -- Any vertex of `Q` in `V(H₁)` that also lies in `V(H₂ ∪ Hc) ∪ B₂` must lie in `B₁`. + have hH₁_boundary : ∀ z ∈ Q.walk.support, z ∈ H₁.vertexSet → + (z ∈ (H₂ ∪ Hc).vertexSet ∨ z ∈ B₂) → z ∈ B₁ := by + exact first_side_path_boundary (α := α) (β := β) (G := G) π (Θ := Θ) (Δ := Δ) (n₁ := n₁) + (n₂ := n₂) (p := p) hΘ_bd P c I₁ I₂ N₁ N₂ hc_C hI₂_sub hdisj_I hN₁_sub hdisj_N hc_bd j + Q hQ_sub hdisj_D₁_D₂ hc_not_D₁ + -- Similarly, any vertex of `Q` in `V(H₂)` that also lies in `V(Hc) ∪ B₁` must lie in `B₂`. + have hH₂_boundary : ∀ z ∈ Q.walk.support, z ∈ H₂.vertexSet → + (z ∈ Hc.vertexSet ∨ z ∈ B₁) → z ∈ B₂ := by + exact second_side_path_boundary (α := α) (β := β) (G := G) π (Θ := Θ) (Δ := Δ) (n₁ := n₁) + (n₂ := n₂) (p := p) hΘ_bd P c I₁ I₂ N₂ hc_C hI₁_sub hdisj_I hN₂_sub hc_bd j Q hQ_sub + hc_not_D₂ + -- Apply `walk_in_left_or_right_of_internal_disjoint` to `w₀` in `H₁ ∪ (H₂ ∪ Hc)`. + have hint_w₀ : ∀ z ∈ w₀.support, z ≠ Q.first → z ≠ Q.last → + z ∉ H₁.vertexSet ∩ (H₂ ∪ Hc).vertexSet := by + intro z hz hzf hzl ⟨hz₁, hz₂⟩ + exact hQ_int z (hw₀_sup ▸ hz) hzf hzl + (Or.inl (hH₁_boundary z (hw₀_sup ▸ hz) hz₁ (Or.inl hz₂))) + have hw_2c : ∃ w₂c : (H₂ ∪ Hc).skeleton.Walk Q.first Q.last, + w₂c.support = Q.walk.support := by + exact subpath_enters_second_side (α := α) (β := β) (G := G) π (Δ := Δ) B₁ B₂ Q hst + hQ_no_inter H₁ H₂ Hc hdisjE_1_2c w₀ hw₀_sup hw₀_path hH₁_boundary hint_w₀ + obtain ⟨w₂c, hw₂c_sup⟩ := hw_2c + have hw₂c_path : w₂c.IsPath := by + rw [SimpleGraph.Walk.isPath_def, hw₂c_sup] + exact Q.isPath.support_nodup + -- Apply `walk_in_left_or_right_of_internal_disjoint` to `w₂c` in `H₂ ∪ Hc`. + have hint_w₂c : ∀ z ∈ w₂c.support, z ≠ Q.first → z ≠ Q.last → + z ∉ H₂.vertexSet ∩ Hc.vertexSet := by + intro z hz hzf hzl ⟨hz₂, hzc⟩ + exact hQ_int z (hw₂c_sup ▸ hz) hzf hzl + (Or.inr (hH₂_boundary z (hw₂c_sup ▸ hz) hz₂ (Or.inl hzc))) + have hwc : ∃ wc : Hc.skeleton.Walk Q.first Q.last, wc.support = Q.walk.support := by + exact subpath_lies_in_terminal_cell (α := α) (β := β) (G := G) π (Δ := Δ) B₁ B₂ Q hst + hQ_no_inter H₂ Hc hdisjE_2_c hH₂_boundary w₂c hw₂c_sup hw₂c_path hint_w₂c + obtain ⟨wc, hwc_sup⟩ := hwc + have hwc_path : wc.IsPath := by + rw [SimpleGraph.Walk.isPath_def, hwc_sup] + exact Q.isPath.support_nodup + obtain ⟨hs_Hc, ht_Hc⟩ := walk_endpoints_mem_vertexSet_of_ne wc hst + -- Show `Q.first ∈ π.borderPlus m₁` and `Q.last ∈ π.borderPlus m₂`. + have hs_m₁ : Q.first ∈ π.borderPlus m₁ := by + have hs_B₁ := Q.first_mem + rw [mem_iUnion₂] at hs_B₁ + rcases hs_B₁ with ⟨n, hn_I₁, hsn⟩ + by_cases hnm₁ : n = m₁ + · exact hnm₁ ▸ hsn + · have hn_bd : n ∈ π.Γ.N ∩ bd π.S := ⟨hn_I₁.2, hΘ_bd (hI₁_sub hn_I₁.1).1⟩ + obtain ⟨d₁, hd₁_C, hd₁_bd, hn_d₁⟩ := + exists_border_cell_of_mem_N_inter_bd π.isSurface π.Γ hn_bd + have hsd₁ : Q.first ∈ (π.cellGraph d₁).vertexSet := + π.borderPlus_subset_cellGraph hd₁_C hd₁_bd hn_d₁ hsn + have hd₁_ne_c : d₁ ≠ c := by + intro hEq + have hn_tc : n ∈ ({m₁, m₂} : Set π.S) := htilde_c ▸ hEq ▸ hn_d₁ + rcases hn_tc with rfl | rfl + · exact hnm₁ rfl + · exact Set.disjoint_left.mp hdisj_I hn_I₁.1 hm₂_I₂ + obtain ⟨m', hm'_tc, hsm'⟩ := + π.p6_borderPlus hc_C hc_bd hs_Hc ⟨d₁, hd₁_C, hd₁_ne_c, hsd₁⟩ + rw [htilde_c] at hm'_tc + rcases hm'_tc with rfl | rfl + · exact hsm' + · exfalso + exact hQ_no_inter Q.first (SimpleGraph.Walk.start_mem_support Q.walk) + ⟨Q.first_mem, hbp_m₂_sub_B₂ hsm'⟩ + have ht_m₂ : Q.last ∈ π.borderPlus m₂ := by + have ht_B₂ := Q.last_mem + rw [mem_iUnion₂] at ht_B₂ + rcases ht_B₂ with ⟨n', hn'_I₂, htn'⟩ + by_cases hn'm₂ : n' = m₂ + · exact hn'm₂ ▸ htn' + · have hn'_bd : n' ∈ π.Γ.N ∩ bd π.S := ⟨hn'_I₂.2, hΘ_bd (hI₂_sub hn'_I₂.1).1⟩ + obtain ⟨d₂, hd₂_C, hd₂_bd, hn'_d₂⟩ := + exists_border_cell_of_mem_N_inter_bd π.isSurface π.Γ hn'_bd + have htd₂ : Q.last ∈ (π.cellGraph d₂).vertexSet := + π.borderPlus_subset_cellGraph hd₂_C hd₂_bd hn'_d₂ htn' + have hd₂_ne_c : d₂ ≠ c := by + intro hEq + have hn'_tc : n' ∈ ({m₁, m₂} : Set π.S) := htilde_c ▸ hEq ▸ hn'_d₂ + rcases hn'_tc with rfl | rfl + · exact Set.disjoint_left.mp hdisj_I hm₁_I₁ hn'_I₂.1 + · exact hn'm₂ rfl + obtain ⟨m', hm'_tc, htm'⟩ := + π.p6_borderPlus hc_C hc_bd ht_Hc ⟨d₂, hd₂_C, hd₂_ne_c, htd₂⟩ + rw [htilde_c] at hm'_tc + rcases hm'_tc with rfl | rfl + · exfalso + exact hQ_no_inter Q.last (SimpleGraph.Walk.end_mem_support Q.walk) + ⟨hbp_m₁_sub_B₁ htm', Q.last_mem⟩ + · exact htm' + refine ⟨⟨Q.first, Q.last, wc, hwc_path, hs_m₁, ht_m₂⟩, ?_, Q.first_mem, Q.last_mem⟩ + intro z hz + exact hQ_sub (hwc_sup ▸ hz) + +/-- The linkage-pair argument of XVII (7.3) applies with the overlap condition on the cuff nodes +and with a normal cut whose interior may meet painting nodes. -/ +theorem linkage_pairs_of_boundary_cut + {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) + {Θ F Δ : Set π.S} {n₁ n₂ : π.S} {p : ℕ} + (hΘ : Θ ∈ cuffs π.S) (hn₁ : n₁ ∈ π.Γ.N ∩ Θ) (hn₂ : n₂ ∈ π.Γ.N ∩ Θ) (hne : n₁ ≠ n₂) + (hnorm : π.Γ.IsNormal F) (hF : IsLineWithEnds F n₁ n₂) + (hFbd : F ∩ bd π.S = {n₁, n₂}) + (hΔ : IsClosedDisc Δ) (hF_bd : F ⊆ discBd Δ) (hbd_sub : discBd Δ ⊆ F ∪ Θ) + (hinter_sub : ∀ n ∈ π.Γ.N ∩ (Θ ∩ discBd Δ), + π.borderPlus n₁ ∩ π.borderPlus n₂ ⊆ π.borderPlus n) + (hwarp : π.warpAt Θ ≤ p) + (hcard₁ : (π.borderPlus n₁).ncard = p + 1) + (hcard₂ : (π.borderPlus n₂).ncard = p + 1) : + Portrayal.LinkagePairs (π.areaGraph Δ).skeleton + (π.borderPlus n₁) (π.borderPlus n₂) (p + 1) + (π.nodeVertex n₁) (π.nodeVertex n₂) := by + classical + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hΘ_arc : IsOArc Θ := (GraphMinor.Surface.cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + have hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S := ⟨hn₁.1, hΘ_bd hn₁.2⟩ + have hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S := ⟨hn₂.1, hΘ_bd hn₂.2⟩ + -- Since |β(n₁+)| = |β(n₂+)| = p + 1 and |β(n₁)|, |β(n₂)| ≤ p, we have n₁, n₂ ∈ dom(γ). + have hbs_le_warpAt : ∀ {n : π.S}, n ∈ π.Γ.N ∩ Θ → (π.borderSet n).ncard ≤ π.warpAt Θ := by + exact cuff_node_border_count_le_warp (α := α) (β := β) (G := G) π (Θ := Θ) hΘ hΘ_bd hΘ_arc + have hbs₁_le : (π.borderSet n₁).ncard ≤ p := (hbs_le_warpAt hn₁).trans hwarp + have hbs₂_le : (π.borderSet n₂).ncard ≤ p := (hbs_le_warpAt hn₂).trans hwarp + have hn₁_dom : n₁ ∈ π.domγ := by + by_contra hn₁_not + have hbp_eq : π.borderPlus n₁ = π.borderSet n₁ := by + ext v; simp [Portrayal.borderPlus, hn₁_not] + rw [hbp_eq] at hcard₁ + omega + have hn₂_dom : n₂ ∈ π.domγ := by + by_contra hn₂_not + have hbp_eq : π.borderPlus n₂ = π.borderSet n₂ := by + ext v; simp [Portrayal.borderPlus, hn₂_not] + rw [hbp_eq] at hcard₂ + omega + intro P hP_disj + have hinj_first : Function.Injective (fun j => (P j).first) := by + intro i j hij + change (P i).first = (P j).first at hij + by_contra hne_ij + have hi_mem : (P j).first ∈ {z | z ∈ (P i).walk.support} := + hij ▸ SimpleGraph.Walk.start_mem_support (P i).walk + exact Set.disjoint_left.mp (hP_disj hne_ij) hi_mem + (SimpleGraph.Walk.start_mem_support (P j).walk) + have hinj_last : Function.Injective (fun j => (P j).last) := by + intro i j hij + change (P i).last = (P j).last at hij + by_contra hne_ij + have hi_mem : (P j).last ∈ {z | z ∈ (P i).walk.support} := + hij ▸ SimpleGraph.Walk.end_mem_support (P i).walk + exact Set.disjoint_left.mp (hP_disj hne_ij) hi_mem + (SimpleGraph.Walk.end_mem_support (P j).walk) + obtain ⟨j₀, hj₀_first⟩ := mem_range_of_injective_of_ncard_eq + (π.borderPlus_finite hn₁_bd) hcard₁ (fun j => (P j).first_mem) hinj_first + (Or.inr ⟨hn₁_dom, rfl⟩) + refine ⟨j₀, hj₀_first, ?_⟩ + by_contra hj₀_last_ne + obtain ⟨j₂, hj₂_last⟩ := mem_range_of_injective_of_ncard_eq + (π.borderPlus_finite hn₂_bd) hcard₂ (fun j => (P j).last_mem) hinj_last + (Or.inr ⟨hn₂_dom, rfl⟩) + have hj₀_ne_j₂ : j₀ ≠ j₂ := fun h => hj₀_last_ne (h ▸ hj₂_last) + have hn₂_not_P₀ : π.nodeVertex n₂ ∉ (P j₀).walk.support := fun hmem => + Set.disjoint_left.mp (hP_disj hj₀_ne_j₂) hmem + (hj₂_last ▸ SimpleGraph.Walk.end_mem_support (P j₂).walk) + -- Define the active node set `e d` for each cell `d` and the marking predicate `P_mark`. + let activeFor (d : Set π.S) (l : Fin (p + 1)) : Prop := + 2 ≤ ({z ∈ (P l).walk.support | z ∈ π.nodeVertex '' (tilde d ∩ π.domγ)}).ncard + let e : Set π.S → Set π.S := fun d => + {n ∈ tilde d ∩ π.domγ | ∃ l : Fin (p + 1), + activeFor d l ∧ π.nodeVertex n ∈ (P l).walk.support} + let P_mark : π.S → Prop := fun m => + m ∈ π.domγ ∧ π.nodeVertex m ∈ (P j₀).walk.support + have hact_unique : ∀ {d : Set π.S}, d ∈ π.Γ.C → ∀ {l₁ l₂ : Fin (p + 1)}, + activeFor d l₁ → activeFor d l₂ → l₁ = l₂ := by + exact active_cell_unique_path (α := α) (β := β) (G := G) π (Δ := Δ) (n₁ := n₁) (n₂ := + n₂) (p := p) P hP_disj + have he_props : ∀ d ∈ π.Γ.C, d ⊆ Δ → ¬ (d ∩ bd π.S).Nonempty → + e d ⊆ tilde d ∧ (e d = ∅ ∨ 2 ≤ (e d).ncard) ∧ + ∀ x ∈ e d, ∀ y ∈ e d, P_mark x → P_mark y := by + exact active_cell_marked_boundary (α := α) (β := β) (G := G) π (Δ := Δ) (n₁ := n₁) + (n₂ := n₂) (p := p) P hP_disj j₀ hact_unique + have hP_n₁ : P_mark n₁ := + ⟨hn₁_dom, hj₀_first ▸ SimpleGraph.Walk.start_mem_support (P j₀).walk⟩ + have hP_n₂ : ¬ P_mark n₂ := fun h => hn₂_not_P₀ h.2 + obtain ⟨m₁, m₂, c, I₁, I₂, N₁, N₂, + hm₁_mem, hm₂_mem, hm_ne, hP_m₁, hP_m₂, + hc_C, hc_Δ, hc_Θ, htilde_c, + hI₁_sub, hI₂_sub, hdisj_I, + hn₁_I₁, hm₁_I₁, hm₂_I₂, hn₂_I₂, + hN₁_sub, hN₂_sub, hdisj_N, + hord_I, hborder_split, hint_split, + ⟨c₁_end, hc₁_C, hc₁_Δ, hc₁_bd, hn₁_c₁⟩, + ⟨c₂_end, hc₂_C, hc₂_Δ, hc₂_bd, hn₂_c₂⟩⟩ := + normalIArcDiscRegion_of_boundary π.S π.isSurface π.Γ Θ n₁ n₂ F Δ e P_mark + hΘ hn₁ hn₂ hne hnorm hF hFbd hΔ hF_bd hbd_sub he_props hP_n₁ hP_n₂ + have hc_bd : (c ∩ bd π.S).Nonempty := hc_Θ.mono (inter_subset_inter_right _ hΘ_bd) + let B₁ : Set α := ⋃ n ∈ I₁ ∩ π.Γ.N, π.borderPlus n + let B₂ : Set α := ⋃ n ∈ I₂ ∩ π.Γ.N, π.borderPlus n + have hbp₁_sub_B₁ : π.borderPlus n₁ ⊆ B₁ := + subset_biUnion_of_mem (x := n₁) ⟨hn₁_I₁, hn₁.1⟩ + have hbp₂_sub_B₂ : π.borderPlus n₂ ⊆ B₂ := + subset_biUnion_of_mem (x := n₂) ⟨hn₂_I₂, hn₂.1⟩ + have hbp_m₁_sub_B₁ : π.borderPlus m₁ ⊆ B₁ := + subset_biUnion_of_mem (x := m₁) ⟨hm₁_I₁, hm₁_mem.1⟩ + have hbp_m₂_sub_B₂ : π.borderPlus m₂ ⊆ B₂ := + subset_biUnion_of_mem (x := m₂) ⟨hm₂_I₂, hm₂_mem.1⟩ + -- For each `j`, choose a minimal subpath `Q_j` of `P_j` from `B₁` to `B₂`, and show it lifts + -- to a path in `(π.cellGraph c).skeleton` from `π.borderPlus m₁` to `π.borderPlus m₂`. + have hclaim : ∀ j : Fin (p + 1), + ∃ Q' : PathFromTo (π.cellGraph c).skeleton (π.borderPlus m₁) (π.borderPlus m₂), + {z | z ∈ Q'.walk.support} ⊆ {z | z ∈ (P j).walk.support} ∧ + Q'.first ∈ B₁ ∧ Q'.last ∈ B₂ := by + exact path_family_restricts_to_middle_cell π hΘ hn₁ hn₂ + hinter_sub hΘ_bd P m₁ m₂ c I₁ I₂ N₁ N₂ hm₁_mem hm₂_mem hc_C + htilde_c hI₁_sub hI₂_sub hdisj_I hm₁_I₁ hm₂_I₂ hN₁_sub hN₂_sub hdisj_N hord_I + c₁_end hc₁_C hc₁_Δ hc₁_bd hn₁_c₁ c₂_end hc₂_C hc₂_Δ hc₂_bd hn₂_c₂ hborder_split hint_split + hc_bd hbp₁_sub_B₁ hbp₂_sub_B₂ hbp_m₁_sub_B₁ hbp_m₂_sub_B₂ + -- Assemble the linkage `{Q'_0, ..., Q'_p}` in `α(c)` from `β(m₁+)` to `β(m₂+)` (page 180). + exact no_partial_middle_cell_linkage π (fun j ↦ {z | z ∈ (P j).walk.support}) hP_disj hwarp + ⟨hm₁_mem.1, hΘ_bd hm₁_mem.2.1⟩ ⟨hm₂_mem.1, hΘ_bd hm₂_mem.2.1⟩ hm_ne hc_C hc_Θ hc_bd + htilde_c hP_m₁.2 hP_m₂ (fun j ↦ (hclaim j).imp fun _ h ↦ h.1) + +/-- **Graph Minors XVII, (7.3)** (pages 178–179): +"Let $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a portrayal of a hypergraph $G$. Let +$n_1, n_2$ be distinct nodes bordering a cuff $\Theta$, and let $F \subseteq \Sigma$ be a +$\Gamma$-normal $I$-arc with ... ends $n_1, n_2$ and with $F \cap N(\Gamma) = \{n_1, n_2\}$. Let +$\Delta \subseteq \Sigma$ be a disc with $F \subseteq bd(\Delta) \subseteq F \cup \Theta$, +and for each $n \in N(\Gamma) \cap bd(\Delta)$ let +$\beta(n_1+) \cap \beta(n_2+) \subseteq \beta(n+)$. Let $\pi$ have warp $\le p$ at $\Theta$, and +let $|\beta(n_1+)| = |\beta(n_2+)| = p+1$. Then every linkage in $\alpha(\Delta)$ from +$\beta(n_1+)$ to $\beta(n_2+)$ pairs $\gamma(n_1)$ with $\gamma(n_2)$." + + Note: On page 179, the paper defines +$B_h = \bigcap (\beta(n+) : n \in I_h \cap N(\Gamma))$ ($h = 1, 2$), which is a typographical slip +for $B_h = \bigcup (\beta(n+) : n \in I_h \cap N(\Gamma))$, as the later uses of $B_1$ and $B_2$ +in the proof on pages 179 and 180 show. -/ +theorem theorem_7_3_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) + {Θ F Δ : Set π.S} {n₁ n₂ : π.S} {p : ℕ} + (hΘ : Θ ∈ cuffs π.S) (hn₁ : n₁ ∈ π.Γ.N ∩ Θ) (hn₂ : n₂ ∈ π.Γ.N ∩ Θ) (hne : n₁ ≠ n₂) + (hnorm : π.Γ.IsNormal F) (hF : IsLineWithEnds F n₁ n₂) + (hFbd : F ∩ bd π.S = {n₁, n₂}) (_hFN : F ∩ π.Γ.N = {n₁, n₂}) + (hΔ : IsClosedDisc Δ) (hF_bd : F ⊆ discBd Δ) (hbd_sub : discBd Δ ⊆ F ∪ Θ) + (hinter_sub : ∀ n ∈ π.Γ.N ∩ discBd Δ, + π.borderPlus n₁ ∩ π.borderPlus n₂ ⊆ π.borderPlus n) + (hwarp : π.warpAt Θ ≤ p) + (hcard₁ : (π.borderPlus n₁).ncard = p + 1) + (hcard₂ : (π.borderPlus n₂).ncard = p + 1) : + Portrayal.LinkagePairs (π.areaGraph Δ).skeleton + (π.borderPlus n₁) (π.borderPlus n₂) (p + 1) + (π.nodeVertex n₁) (π.nodeVertex n₂) := by + exact linkage_pairs_of_boundary_cut π hΘ hn₁ hn₂ hne hnorm hF hFbd hΔ hF_bd hbd_sub + (fun n hn => hinter_sub n ⟨hn.1, hn.2.2⟩) hwarp hcard₁ hcard₂ + +private lemma isTruer_of_le_of_lt {α : Type u} {β : Type v} {G : Hypergraph α β} + {π' π : Portrayal G} (hle : ∀ i : Fin 6, π'.truth i ≤ π.truth i) + (hex : ∃ k : Fin 6, π'.truth k < π.truth k) : + π'.IsTruer π := by + classical + have hex_nat : ∃ n, ∃ hn : n < 6, π'.truth ⟨n, hn⟩ < π.truth ⟨n, hn⟩ := by + rcases hex with ⟨⟨n, hn⟩, hlt⟩ + exact ⟨n, hn, hlt⟩ + let m := Nat.find hex_nat + obtain ⟨hm6, hm_lt⟩ := Nat.find_spec hex_nat + refine ⟨⟨m, hm6⟩, fun i hi => ?_, hm_lt⟩ + apply le_antisymm (hle i) + by_contra hlt + exact Nat.find_min hex_nat hi ⟨i.2, lt_of_not_ge hlt⟩ + +open Classical in +private noncomputable abbrev replaced_cuff_disc_portrayal + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Δ : Set π.S} + {n₁ : π.S} + {n₂ : π.S} + (Γ' : Painting π.S) + (hdich : ∀ c ∈ π.Γ.C, c ⊆ Δ ∨ c ⊆ Δᶜ) + (htilde_I₂ : ∀ c ∈ π.Γ.C, c ⊆ Δᶜ → tilde c ⊆ Γ'.N) + (hc'_mem : Δ \ {n₁, n₂} ∈ Γ'.C) + (hC' : Γ'.C = insert (Δ \ {n₁, n₂}) {c | c ∈ π.Γ.C ∧ c ⊆ Δᶜ}) + (hc'_not_I₂ : Δ \ {n₁, n₂} ∉ {c | c ∈ π.Γ.C ∧ c ⊆ Δᶜ}) + (hc'_bd : ((Δ \ {n₁, n₂}) ∩ bd π.S).Nonempty) + (hN'_sub : Γ'.N ⊆ π.Γ.N) + (hdisj_I : Disjoint {c ∈ π.Γ.C | c ⊆ Δ} {c ∈ π.Γ.C | c ⊆ Δᶜ}) + (hbp_c'_sub_Δ : ∀ {n : π.S}, n ∈ tilde (Δ \ {n₁, n₂}) → + π.borderPlus n ⊆ (π.areaGraph Δ).vertexSet) + (htilde_c'_N' : tilde (Δ \ {n₁, n₂}) ⊆ Γ'.N ∩ bd π.S) + (hinter_I₁_I₂ : (π.areaGraph Δ).vertexSet ∩ + (π.cellsUnion {c ∈ π.Γ.C | c ⊆ Δᶜ}).vertexSet ⊆ + ⋃ n ∈ tilde (Δ \ {n₁, n₂}), π.borderPlus n) : Portrayal G := + let c' := Δ \ {n₁, n₂} + let I₁ : Set (Set π.S) := {c ∈ π.Γ.C | c ⊆ Δ} + let I₂ : Set (Set π.S) := {c ∈ π.Γ.C | c ⊆ Δᶜ} + let cellG : Set π.S → Hypergraph α β := fun c => + if c = c' then π.areaGraph Δ else π.cellGraph c + { S := π.S + top := π.top + isSurface := π.isSurface + connected := π.connected + Γ := Γ' + cellGraph := cellG + borderSet := π.borderSet + domγ := π.domγ ∩ Γ'.N + nodeVertex := π.nodeVertex + cellGraph_le := fun c hc => by + rw [hC'] at hc + dsimp only [cellG] + split_ifs with hcc' + · exact π.cellsUnion_le I₁ + · exact π.cellGraph_le c (hc.resolve_left hcc').1 + borderSet_subset := fun n hn => π.borderSet_subset n ⟨hN'_sub hn.1, hn.2⟩ + domγ_subset := inter_subset_right + nodeVertex_mem := fun n hn => π.nodeVertex_mem n hn.1 + nodeVertex_injOn := π.nodeVertex_injOn.mono inter_subset_left + p1_vertex := fun v hv => by + rcases π.p1_vertex v hv with ⟨c, hc, hvc⟩ + rcases hdich c hc with hc_in | hc_out + · refine ⟨c', hc'_mem, ?_⟩ + change v ∈ (if c' = c' then π.areaGraph Δ else π.cellGraph c').vertexSet + simp only [↓reduceIte] + exact mem_biUnion ⟨⟨hc, hc_in⟩, hc⟩ hvc + · refine ⟨c, hC'.symm ▸ mem_insert_of_mem c' ⟨hc, hc_out⟩, ?_⟩ + have hne_c : c ≠ c' := by rintro rfl; exact hc'_not_I₂ ⟨hc, hc_out⟩ + dsimp only [cellG] + rw [ite_eq_right hne_c] + exact hvc + p1_edge := fun e he => by + rcases π.p1_edge e he with ⟨c, hc, hec⟩ + rcases hdich c hc with hc_in | hc_out + · refine ⟨c', hc'_mem, ?_⟩ + change e ∈ (if c' = c' then π.areaGraph Δ else π.cellGraph c').edgeSet + simp only [↓reduceIte] + exact mem_biUnion ⟨⟨hc, hc_in⟩, hc⟩ hec + · refine ⟨c, hC'.symm ▸ mem_insert_of_mem c' ⟨hc, hc_out⟩, ?_⟩ + have hne_c : c ≠ c' := by rintro rfl; exact hc'_not_I₂ ⟨hc, hc_out⟩ + dsimp only [cellG] + rw [ite_eq_right hne_c] + exact hec + p1_disjoint := fun c₁ hc₁ c₂ hc₂ hne_c => by + rw [hC'] at hc₁ hc₂ + dsimp only [cellG] + split_ifs with h1 h2 h2 + · exact False.elim (hne_c (h1.trans h2.symm)) + · have hc₂' : c₂ ∈ I₂ := hc₂.resolve_left h2 + rw [Set.disjoint_left] + intro e he₁ he₂ + change e ∈ ⋃ d ∈ _, _ at he₁ + rw [mem_iUnion₂] at he₁ + rcases he₁ with ⟨c₀, hc₀, hec₀⟩ + have hc₀_ne : c₀ ≠ c₂ := fun h => Set.disjoint_left.mp hdisj_I hc₀.1 (h ▸ hc₂') + exact Set.disjoint_left.mp (π.p1_disjoint c₀ hc₀.2 c₂ hc₂'.1 hc₀_ne) hec₀ he₂ + · have hc₁' : c₁ ∈ I₂ := hc₁.resolve_left h1 + rw [Set.disjoint_left] + intro e he₁ he₂ + change e ∈ ⋃ d ∈ _, _ at he₂ + rw [mem_iUnion₂] at he₂ + rcases he₂ with ⟨c₀, hc₀, hec₀⟩ + have hc₁_ne : c₁ ≠ c₀ := fun h => Set.disjoint_left.mp hdisj_I hc₀.1 (h ▸ hc₁') + exact Set.disjoint_left.mp (π.p1_disjoint c₁ hc₁'.1 c₀ hc₀.2 hc₁_ne) he₁ hec₀ + · exact π.p1_disjoint c₁ (hc₁.resolve_left h1).1 c₂ (hc₂.resolve_left h2).1 hne_c + p2 := fun c hc n hn => by + rw [hC'] at hc + dsimp only [cellG] + split_ifs with hcc' + · subst hcc' + exact hbp_c'_sub_Δ hn.1 (Or.inr ⟨hn.2.1, rfl⟩) + · exact π.p2 c (hc.resolve_left hcc').1 n ⟨hn.1, hn.2.1⟩ + p3_notMem := fun n hn => π.p3_notMem n ⟨hn.1.1, hn.2⟩ + p3_subset := fun c hc hbd n hnt v hv => by + rw [hC'] at hc + dsimp only [cellG] + split_ifs with hcc' + · subst hcc' + exact hbp_c'_sub_Δ hnt (Or.inl hv) + · exact π.p3_subset c (hc.resolve_left hcc').1 hbd n hnt hv + p4_disjoint := fun Θ₁ hΘ₁ Θ₂ hΘ₂ hne_Θ u₁ hu₁ u₂ hu₂ => + π.p4_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ hne_Θ u₁ ⟨hN'_sub hu₁.1, hu₁.2⟩ u₂ ⟨hN'_sub hu₂.1, hu₂.2⟩ + p4_notMem := fun Θ' hΘ' u₁ hu₁ u₂ hu₂ hnot => + π.p4_notMem Θ' hΘ' u₁ ⟨hN'_sub hu₁.1, hu₁.2⟩ u₂ hu₂.1 hnot + p5 := fun c hc hint v hvc hex => by + have hne_c : c ≠ c' := fun h => hint (h ▸ hc'_bd) + have hc_I₂ : c ∈ I₂ := (hC' ▸ hc).resolve_left hne_c + dsimp only [cellG] at hvc + rw [ite_eq_right hne_c] at hvc + rcases hex with ⟨d', hd', hd'_ne, hvd'⟩ + have hex_π : ∃ d₀ ∈ π.Γ.C, d₀ ≠ c ∧ v ∈ (π.cellGraph d₀).vertexSet := by + dsimp only [cellG] at hvd' + split_ifs at hvd' with hd'_eq + · change v ∈ ⋃ d₀ ∈ _, _ at hvd' + rw [mem_iUnion₂] at hvd' + rcases hvd' with ⟨d₀, hd₀, hvd₀⟩ + exact ⟨d₀, hd₀.2, fun h => Set.disjoint_left.mp hdisj_I hd₀.1 (h ▸ hc_I₂), hvd₀⟩ + · have hd'_I₂ : d' ∈ I₂ := (hC' ▸ hd').resolve_left hd'_eq + exact ⟨d', hd'_I₂.1, hd'_ne, hvd'⟩ + obtain ⟨n, ⟨hnt, hndom⟩, hnv⟩ := π.p5 c hc_I₂.1 hint v hvc hex_π + exact ⟨n, ⟨hnt, hndom, htilde_I₂ c hc_I₂.1 hc_I₂.2 hnt⟩, hnv⟩ + p6 := fun c hc hbd v hvc hex => by + rcases hex with ⟨d', hd', hd'_ne, hvd'⟩ + by_cases hcc' : c = c' + · subst hcc' + dsimp only [cellG] at hvc hvd' + simp only [↓reduceIte] at hvc + rw [ite_eq_right hd'_ne] at hvd' + have hd'_I₂ : d' ∈ I₂ := (hC' ▸ hd').resolve_left hd'_ne + have hv₂ : v ∈ (π.cellsUnion I₂).vertexSet := + mem_biUnion ⟨hd'_I₂, hd'_I₂.1⟩ hvd' + have hv_in := hinter_I₁_I₂ ⟨hvc, hv₂⟩ + rw [mem_iUnion₂] at hv_in + rcases hv_in with ⟨n, hnt, hvn⟩ + have hn_N' : n ∈ Γ'.N ∩ bd π.S := htilde_c'_N' hnt + refine ⟨n, hnt, ?_⟩ + rcases hvn with hv_bs | ⟨hn_dom, hnv⟩ + · exact Or.inl hv_bs + · exact Or.inr ⟨⟨hn_dom, hn_N'.1⟩, hnv⟩ + · have hc_I₂ : c ∈ I₂ := (hC' ▸ hc).resolve_left hcc' + dsimp only [cellG] at hvc hvd' + rw [ite_eq_right hcc'] at hvc + have hex_π : ∃ d₀ ∈ π.Γ.C, d₀ ≠ c ∧ v ∈ (π.cellGraph d₀).vertexSet := by + split_ifs at hvd' with hd'_eq + · change v ∈ ⋃ d₀ ∈ _, _ at hvd' + rw [mem_iUnion₂] at hvd' + rcases hvd' with ⟨d₀, hd₀, hvd₀⟩ + exact ⟨d₀, hd₀.2, fun h => Set.disjoint_left.mp hdisj_I hd₀.1 (h ▸ hc_I₂), hvd₀⟩ + · have hd'_I₂ : d' ∈ I₂ := (hC' ▸ hd').resolve_left hd'_eq + exact ⟨d', hd'_I₂.1, hd'_ne, hvd'⟩ + obtain ⟨n, hnt, hvn⟩ := π.p6 c hc_I₂.1 hbd v hvc hex_π + have hn_N' : n ∈ Γ'.N := htilde_I₂ c hc_I₂.1 hc_I₂.2 hnt + refine ⟨n, hnt, ?_⟩ + rcases hvn with hv_bs | ⟨hn_dom, hnv⟩ + · exact Or.inl hv_bs + · exact Or.inr ⟨⟨hn_dom, hn_N'⟩, hnv⟩ + p7 := fun Θ' hΘ' u₁ hu₁ u₂ hu₂ u₃ hu₃ u₄ hu₄ hord v hv₁ hv₃ => by + have hv₁' : v ∈ π.borderPlus u₁ := + hv₁.imp id (fun ⟨h, hv⟩ => ⟨h.1, hv⟩) + have hv₃' : v ∈ π.borderPlus u₃ := + hv₃.imp id (fun ⟨h, hv⟩ => ⟨h.1, hv⟩) + rcases π.p7 Θ' hΘ' u₁ ⟨hN'_sub hu₁.1, hu₁.2⟩ u₂ ⟨hN'_sub hu₂.1, hu₂.2⟩ + u₃ ⟨hN'_sub hu₃.1, hu₃.2⟩ u₄ ⟨hN'_sub hu₄.1, hu₄.2⟩ hord v hv₁' hv₃' with h₂ | h₄ + · exact Or.inl (h₂.imp id (fun ⟨h, hv⟩ => ⟨⟨h, hu₂.1⟩, hv⟩)) + · exact Or.inr (h₄.imp id (fun ⟨h, hv⟩ => ⟨⟨h, hu₄.1⟩, hv⟩)) } + +private theorem cuff_disc_area_links_ends + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {θ : ℕ} + {p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) + (hc : π.IsCentral 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) (hθ : 4 * p + 5 < θ) + {F : Set π.S} + {Δ : Set π.S} + {n₁ : π.S} + {n₂ : π.S} + (hnorm : π.Γ.IsNormal F) + (hF : IsLineWithEnds F n₁ n₂) + (hFbd : F ∩ bd π.S = {n₁, n₂}) + (hFN : F ∩ π.Γ.N = {n₁, n₂}) + (hΔ : IsClosedDisc Δ) + (hF_bd : F ⊆ discBd Δ) + (hbd_sub : discBd Δ ⊆ F ∪ bd π.S) + (hsmall : IsSmallWrt 𝒯 (π.areaGraph Δ)) + (hne : n₁ ≠ n₂) + (Θ : Set π.S) + (hΘ : Θ ∈ cuffs π.S) + (hbd_Θ : discBd Δ ⊆ F ∪ Θ) + (hΘ_bd : Θ ⊆ bd π.S) + (hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S) + (hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S) + (hbs_le_q : ∀ {n : π.S}, n ∈ π.Γ.N ∩ Θ → (π.borderSet n).ncard ≤ (π.warpAt Θ)) + (u₁ : π.S) + (u₂ : π.S) + (hu_ne : u₁ ≠ u₂) + (hu₁_pair : u₁ = n₁ ∨ u₁ = n₂) + (hu₂_pair : u₂ = n₁ ∨ u₂ = n₂) + (hu₁_Θ : u₁ ∈ π.Γ.N ∩ Θ) + (hu₂_Θ : u₂ ∈ π.Γ.N ∩ Θ) + (hu₁_bd : u₁ ∈ π.Γ.N ∩ bd π.S) + (hu₂_bd : u₂ ∈ π.Γ.N ∩ bd π.S) + (hcard₁ : (π.borderPlus u₁).ncard = (π.warpAt Θ) + 1) + (hcard₂ : (π.borderPlus u₂).ncard = (π.warpAt Θ) + 1) : + Portrayal.LinkagePairs (π.areaGraph Δ).skeleton (π.borderPlus u₁) (π.borderPlus u₂) ((π.warpAt + Θ) + 1) (π.nodeVertex u₁) (π.nodeVertex u₂) := by + let q := π.warpAt Θ + by_cases hq0 : q = 0 + · -- When `q = 0`, `borderSet u₁ = borderSet u₂ = ∅`, so any 1-linkage trivially pairs `γ(u₁)` + -- and `γ(u₂)`. + have hbs₁_le : (π.borderSet u₁).ncard ≤ 0 := hq0 ▸ hbs_le_q hu₁_Θ + have hbs₂_le : (π.borderSet u₂).ncard ≤ 0 := hq0 ▸ hbs_le_q hu₂_Θ + have hbs₁_emp : π.borderSet u₁ = ∅ := + (ncard_eq_zero (hs := π.borderSet_finite hu₁_bd)).mp (Nat.eq_zero_of_le_zero hbs₁_le) + have hbs₂_emp : π.borderSet u₂ = ∅ := + (ncard_eq_zero (hs := π.borderSet_finite hu₂_bd)).mp (Nat.eq_zero_of_le_zero hbs₂_le) + have hu₁_dom : u₁ ∈ π.domγ := by + by_contra hnot + have hbp_eq : π.borderPlus u₁ = π.borderSet u₁ := by + ext v; simp [Portrayal.borderPlus, hnot] + rw [hbp_eq, hbs₁_emp, ncard_empty] at hcard₁ + omega + have hu₂_dom : u₂ ∈ π.domγ := by + by_contra hnot + have hbp_eq : π.borderPlus u₂ = π.borderSet u₂ := by + ext v; simp [Portrayal.borderPlus, hnot] + rw [hbp_eq, hbs₂_emp, ncard_empty] at hcard₂ + omega + have hbp₁_eq : π.borderPlus u₁ = {π.nodeVertex u₁} := by + ext v; simp [Portrayal.borderPlus, hbs₁_emp, hu₁_dom] + have hbp₂_eq : π.borderPlus u₂ = {π.nodeVertex u₂} := by + ext v; simp [Portrayal.borderPlus, hbs₂_emp, hu₂_dom] + intro L _ + have hf0 : (L 0).first = π.nodeVertex u₁ := + mem_singleton_iff.mp (hbp₁_eq ▸ (L 0).first_mem) + have hl0 : (L 0).last = π.nodeVertex u₂ := + mem_singleton_iff.mp (hbp₂_eq ▸ (L 0).last_mem) + exact ⟨0, hf0, hl0⟩ + · -- When `1 ≤ q`, we have `1 ≤ q ≤ π.warp ≤ p`, so `(6.7)` and `(7.3)` apply. + have hq_le_warp : q ≤ π.warp := π.warpAt_le_warp hΘ + have hq_le_p : q ≤ p := hq_le_warp.trans hwarp + have hwarp_ge_1 : 1 ≤ π.warp := by omega + have hp_ge_1 : 1 ≤ p := by omega + have hθ_67 : (2 * p + 3) + max 3 (2 * p + 2) < θ := by omega + have hpair_eq : ({u₁, u₂} : Set π.S) = {n₁, n₂} := by + rcases hu₁_pair with h1 | h1 <;> rcases hu₂_pair with h2 | h2 + · exact False.elim (hu_ne (h1.trans h2.symm)) + · rw [h1, h2] + · rw [h1, h2]; exact pair_comm n₂ n₁ + · exact False.elim (hu_ne (h1.trans h2.symm)) + have hF_u : IsLineWithEnds F u₁ u₂ := by + rcases hu₁_pair with h1 | h1 <;> rcases hu₂_pair with h2 | h2 + · exact False.elim (hu_ne (h1.trans h2.symm)) + · rw [h1, h2]; exact hF + · rw [h1, h2]; exact isLineWithEnds_symm hF + · exact False.elim (hu_ne (h1.trans h2.symm)) + have hFbd_u : F ∩ bd π.S = {u₁, u₂} := hFbd.trans hpair_eq.symm + have hFN_u : F ∩ π.Γ.N = {u₁, u₂} := hFN.trans hpair_eq.symm + have hFγ_le : 2 * p + 1 ≤ 2 * p + 3 ∧ (F ∩ π.domγ).ncard ≤ (2 * p + 3) - 2 * p - 1 := by + refine ⟨by omega, ?_⟩ + have hsub_Fγ : F ∩ π.domγ ⊆ {n₁, n₂} := + (inter_subset_inter_right F π.domγ_subset).trans hFN.subset + have hfin_pair : ({n₁, n₂} : Set π.S).Finite := (finite_singleton n₂).insert n₁ + have hle2 : (F ∩ π.domγ).ncard ≤ 2 := + (ncard_le_ncard hsub_Fγ hfin_pair).trans (ncard_pair hne).le + omega + have hinter_bd : ∀ n ∈ π.Γ.N ∩ discBd Δ, + π.borderPlus u₁ ∩ π.borderPlus u₂ ⊆ π.borderPlus n := by + rintro n ⟨hnN, hnbd⟩ + have hnΔ : n ∈ Δ := discBd_subset Δ hnbd + have hn_bdS : n ∈ bd π.S := by + rcases hbd_Θ hnbd with hnF | hnΘ + · have hn_pair : n ∈ ({n₁, n₂} : Set π.S) := hFN ▸ ⟨hnF, hnN⟩ + rcases hn_pair with rfl | rfl <;> [exact hn₁_bd.2; exact hn₂_bd.2] + · exact hΘ_bd hnΘ + exact theorem_6_7_proof h𝒯 π hc hwarp hred hθ_67 + hnorm hF_u hFbd_u hFγ_le hΔ hF_bd hbd_sub hsmall + ⟨⟨hnN, hnΔ⟩, hn_bdS⟩ + exact theorem_7_3_proof π hΘ hu₁_Θ hu₂_Θ hu_ne hnorm hF_u hFbd_u hFN_u + hΔ hF_bd hbd_Θ hinter_bd le_rfl hcard₁ hcard₂ + +private theorem single_cell_in_disc_with_two_boundary_nodes + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Δ : Set π.S} + {n₁ : π.S} + {n₂ : π.S} + (Θ : Set π.S) + (hΔ_bd : Δ ∩ bd π.S = discBd Δ ∩ Θ) + (hF' : IsLineWithEnds (discBd Δ ∩ Θ) n₁ n₂) + (hdich : ∀ c ∈ π.Γ.C, c ⊆ Δ ∨ c ⊆ Δᶜ) + (hΘ_bd : Θ ⊆ bd π.S) + (hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S) + (hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S) + (hI₁_border : ∀ c ∈ ({c | c ∈ π.Γ.C ∧ c ⊆ Δ}), (c ∩ bd π.S).Nonempty) + (hΔ_N_pair : Δ ∩ π.Γ.N ⊆ {n₁, n₂}) : + ({c | c ∈ π.Γ.C ∧ c ⊆ Δ}).ncard = 1 := by + let F' := discBd Δ ∩ Θ + let I₁ := {c | c ∈ π.Γ.C ∧ c ⊆ Δ} + obtain ⟨⟨x₀, hx₀_F', hx₀_ne⟩, hL_pc⟩ := isPathConnected_diff_ends_of_isLineWithEnds hF' + have hL_sub : F' \ {n₁, n₂} ⊆ bd π.S \ π.Γ.N := by + rintro x ⟨hxF', hx_ne⟩ + have hxΔ : x ∈ Δ := discBd_subset Δ hxF'.1 + have hxbd : x ∈ bd π.S := hΘ_bd hxF'.2 + exact ⟨hxbd, fun hxN => hx_ne (hΔ_N_pair ⟨hxΔ, hxN⟩)⟩ + have hL_sub_U : F' \ {n₁, n₂} ⊆ π.Γ.U \ π.Γ.N := + hL_sub.trans (sdiff_subset_sdiff π.Γ.bd_subset Subset.rfl) + obtain ⟨c₀, ⟨hc₀_C, hx₀_c₀⟩, _⟩ := + π.Γ.exists_border_cell_of_mem_bd (hL_sub ⟨hx₀_F', hx₀_ne⟩) + have hc₀_Δ : c₀ ⊆ Δ := by + rcases hdich c₀ hc₀_C with hc₀_in | hc₀_out + · exact hc₀_in + · exact False.elim (hc₀_out hx₀_c₀ (discBd_subset Δ hx₀_F'.1)) + have hI₁_eq_singleton : I₁ = {c₀} := by + ext c + simp only [mem_singleton_iff] + refine ⟨fun hc => ?_, fun h => h ▸ ⟨hc₀_C, hc₀_Δ⟩⟩ + obtain ⟨y, hy_c, hy_bd⟩ := hI₁_border c hc + have hy_F' : y ∈ F' := by + change y ∈ discBd Δ ∩ Θ + rw [← hΔ_bd] + exact ⟨hc.2 hy_c, hy_bd⟩ + have hy_not_N : y ∉ π.Γ.N := (π.Γ.cell_subset_diff hc.1 hy_c).2 + have hy_ne : y ∉ ({n₁, n₂} : Set π.S) := by + rintro (rfl | rfl) + · exact hy_not_N hn₁_bd.1 + · exact hy_not_N hn₂_bd.1 + have hy_c₀ : y ∈ c₀ := + subset_arcComponent_of_isPathConnected hc₀_C hL_sub_U hL_pc + ⟨x₀, ⟨hx₀_F', hx₀_ne⟩, hx₀_c₀⟩ ⟨hy_F', hy_ne⟩ + exact π.Γ.cell_eq_of_mem hc.1 hc₀_C hy_c hy_c₀ + change I₁.ncard = 1 + rw [hI₁_eq_singleton, ncard_singleton] + +private theorem disc_has_no_internal_cells_or_new_nodes_of_count_eq + {S : Type} [TopologicalSpace S] (Γ Γ' : Painting S) {Δ : Set S} {n₁ n₂ : S} + (hC' : Γ'.C = insert (Δ \ {n₁, n₂}) {c ∈ Γ.C | c ⊆ Δᶜ}) + (hc'_bd : ((Δ \ {n₁, n₂}) ∩ bd S).Nonempty) + (hN'_eq : Γ'.N = Γ.N \ Δ ∪ {n₁, n₂}) + (hdisj_I : Disjoint {c ∈ Γ.C | c ⊆ Δ} {c ∈ Γ.C | c ⊆ Δᶜ}) + (hsub : ∀ i : Fin 6, i.1 < 4 → + {c ∈ Γ'.C | ¬(c ∩ bd S).Nonempty ∧ (tilde c).ncard = 3 - i.1} ⊆ + {c ∈ Γ.C | ¬(c ∩ bd S).Nonempty ∧ (tilde c).ncard = 3 - i.1}) + (hcells : ∀ i : Fin 6, i.1 < 4 → + {c ∈ Γ'.C | ¬(c ∩ bd S).Nonempty ∧ (tilde c).ncard = 3 - i.1}.ncard = + {c ∈ Γ.C | ¬(c ∩ bd S).Nonempty ∧ (tilde c).ncard = 3 - i.1}.ncard) + (hint_nodes : (Γ'.N \ bd S).ncard = (Γ.N \ bd S).ncard) + (hbd_nodes : (Γ'.N ∩ bd S).ncard = (Γ.N ∩ bd S).ncard) + (hN'_sub : Γ'.N ⊆ Γ.N) : + (∀ c ∈ {c ∈ Γ.C | c ⊆ Δ}, (c ∩ bd S).Nonempty) ∧ Δ ∩ Γ.N ⊆ {n₁, n₂} := by + constructor + · intro c ⟨hc, hcΔ⟩ + by_contra hint + have hcard_le := Γ.ncard_tilde_cell_le hc + let i : Fin 6 := ⟨3 - (tilde c).ncard, by omega⟩ + have hi : i.1 < 4 := by dsimp [i]; omega + have hEq := eq_of_subset_of_ncard_le (hsub i hi) (hcells i hi).ge + (Γ.finite_cells.subset fun _ h => h.1) + have hc_rhs : c ∈ {d ∈ Γ.C | ¬(d ∩ bd S).Nonempty ∧ (tilde d).ncard = 3 - i.1} := + ⟨hc, hint, by dsimp [i]; omega⟩ + have hc' := hEq.symm ▸ hc_rhs + have hne : c ≠ Δ \ {n₁, n₂} := fun h => hint (h ▸ hc'_bd) + exact Set.disjoint_left.mp hdisj_I ⟨hc, hcΔ⟩ ((hC' ▸ hc'.1).resolve_left hne) + · have hint_eq := eq_of_subset_of_ncard_le (sdiff_subset_sdiff hN'_sub Subset.rfl) hint_nodes.ge + (Γ.finite_N.subset sdiff_subset) + have hbd_eq := eq_of_subset_of_ncard_le (inter_subset_inter_left (bd S) hN'_sub) hbd_nodes.ge + (Γ.finite_N.subset inter_subset_left) + rintro x ⟨hxΔ, hxN⟩ + have hxN' : x ∈ Γ'.N := by + by_cases hx : x ∈ bd S + · exact (hbd_eq.symm ▸ (show x ∈ Γ.N ∩ bd S from ⟨hxN, hx⟩)).1 + · exact (hint_eq.symm ▸ (show x ∈ Γ.N \ bd S from ⟨hxN, hx⟩)).1 + rw [hN'_eq] at hxN' + rcases hxN' with ⟨_, hx⟩ | hx + · exact (hx hxΔ).elim + · exact hx + +private theorem cuff_disc_area_intersects_outer_cells_at_border + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Δ : Set π.S} + {n₁ : π.S} + {n₂ : π.S} + (hΔ : IsClosedDisc Δ) + [T2Space π.S] + (Γ' : Painting π.S) + (hN'_eq : Γ'.N = π.Γ.N \ Δ ∪ {n₁, n₂}) + (htilde_I₂ : ∀ c ∈ π.Γ.C, c ⊆ Δᶜ → tilde c ⊆ Γ'.N) + (htilde_c' : tilde (Δ \ {n₁, n₂}) = {n₁, n₂}) + (hpart : ({c | c ∈ π.Γ.C ∧ c ⊆ Δ}) ∪ ({c | c ∈ π.Γ.C ∧ c ⊆ Δᶜ}) = π.Γ.C) + (hdisj_I : Disjoint ({c | c ∈ π.Γ.C ∧ c ⊆ Δ}) ({c | c ∈ π.Γ.C ∧ c ⊆ Δᶜ})) : + (π.areaGraph Δ).vertexSet ∩ (π.cellsUnion ({c | c ∈ π.Γ.C ∧ c ⊆ Δᶜ})).vertexSet ⊆ ⋃ n ∈ tilde + (Δ \ {n₁, n₂}), π.borderPlus n := by + let c' := Δ \ {n₁, n₂} + let I₁ := {c | c ∈ π.Γ.C ∧ c ⊆ Δ} + let I₂ := {c | c ∈ π.Γ.C ∧ c ⊆ Δᶜ} + have hv_inter := theorem_2_1_claim_3 π hpart hdisj_I + have hX_inter : (⋃ c ∈ I₁, tilde c) ∩ (⋃ c ∈ I₂, tilde c) ⊆ tilde c' := by + rintro n ⟨hX₁, hX₂⟩ + rw [mem_iUnion₂] at hX₁ hX₂ + rcases hX₁ with ⟨c₁, hc₁, hnc₁⟩ + rcases hX₂ with ⟨c₂, hc₂, hnc₂⟩ + have hnΔ : n ∈ Δ := closure_minimal hc₁.2 (isClosed_of_isClosedDisc hΔ) hnc₁.1 + have hnN' : n ∈ Γ'.N := htilde_I₂ c₂ hc₂.1 hc₂.2 hnc₂ + rw [hN'_eq] at hnN' + rcases hnN' with ⟨_, hn_notΔ⟩ | hn_pair + · exact False.elim (hn_notΔ hnΔ) + · exact htilde_c'.symm ▸ hn_pair + intro v hv + rcases hv_inter hv with ⟨n, ⟨hX, hn_dom⟩, rfl⟩ | hY + · exact mem_biUnion (hX_inter hX) (Or.inr ⟨hn_dom, rfl⟩) + · rw [mem_iUnion₂] at hY + rcases hY with ⟨n, ⟨hY₁, hY₂⟩, hvn⟩ + have hnX₁ : n ∈ ⋃ c ∈ I₁, tilde c := by + rw [mem_iUnion₂] at hY₁ ⊢ + rcases hY₁ with ⟨c₁, ⟨hc₁, _⟩, hnc₁⟩ + exact ⟨c₁, hc₁, hnc₁⟩ + have hnX₂ : n ∈ ⋃ c ∈ I₂, tilde c := by + rw [mem_iUnion₂] at hY₂ ⊢ + rcases hY₂ with ⟨c₂, ⟨hc₂, _⟩, hnc₂⟩ + exact ⟨c₂, hc₂, hnc₂⟩ + exact mem_biUnion (hX_inter ⟨hnX₁, hnX₂⟩) (Or.inl hvn) + +private theorem cells_partitioned_by_disc + {S : Type} [TopologicalSpace S] (Γ : Painting S) {Δ : Set S} + (hdich : ∀ c ∈ Γ.C, c ⊆ Δ ∨ c ⊆ Δᶜ) : + {c ∈ Γ.C | c ⊆ Δ} ∪ {c ∈ Γ.C | c ⊆ Δᶜ} = Γ.C ∧ + Disjoint {c ∈ Γ.C | c ⊆ Δ} {c ∈ Γ.C | c ⊆ Δᶜ} := by + constructor + · refine Subset.antisymm (union_subset (fun _ h => h.1) (fun _ h => h.1)) fun c hc => ?_ + rcases hdich c hc with hc_in | hc_out + · exact Or.inl ⟨hc, hc_in⟩ + · exact Or.inr ⟨hc, hc_out⟩ + · rw [Set.disjoint_left] + intro c hc₁ hc₂ + obtain ⟨x, hx⟩ := Γ.cell_nonempty hc₁.1 + exact hc₂.2 hx (hc₁.2 hx) + +/-- Existential form of **Graph Minors XVII, (7.4)** (page 180). + +"Let $\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ be a $(2p+3)$-redundant $\mathcal{T}$-central +portrayal of a hypergraph $G$, with warp $\le p$, and let $ord(\mathcal{T}) > 4p+5$. Let $F +\subseteq \Sigma$ be a $\Gamma$-normal $I$-arc with $|F \cap N(\Gamma)| = 2$. Let $\Delta \subseteq +\Sigma$ be a disc with $F \subseteq bd(\Delta) \subseteq F \cup bd(\Sigma)$, such that +$\alpha(\Delta)$ is small. Define $\Gamma' = (U(\Gamma) \cup \Delta, N(\Gamma) \cap \overline{\Sigma +- \Delta})$ and let $c'$ be the cell $\Delta - (F \cap N(\Gamma))$. Define +$$ \begin{aligned} \alpha'(c') &= \alpha(\Delta) \\ \alpha'(c) &= \alpha(c) \quad (c \in C(\Gamma') +- \{c'\}) \\ \beta' &= \beta \mid (N(\Gamma') \cap bd(\Sigma)) \\ \gamma' &= \gamma \mid N(\Gamma'). +\end{aligned} $$ +Then $\pi' = (\Sigma, \Gamma', \alpha', \beta', \gamma')$ is a $\mathcal{T}$-central portrayal of +$G$ resembling $\pi$." + +The Lean proof constructs the disc replacement and the existential conclusion records centrality +and resemblance. It also records the alternative used in (8.3). Either $\pi'$ is truer than +$\pi$, or $\Delta \cap N(\Gamma) \subseteq F$ and $\Delta$ includes exactly one cell of $\Gamma$. -/ +theorem theorem_7_4_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) + (hc : π.IsCentral 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {F Δ : Set π.S} {n₁ n₂ : π.S} + (hnorm : π.Γ.IsNormal F) (hF : IsLineWithEnds F n₁ n₂) + (hFbd : F ∩ bd π.S = {n₁, n₂}) (hFN : F ∩ π.Γ.N = {n₁, n₂}) + (hΔ : IsClosedDisc Δ) (hF_bd : F ⊆ discBd Δ) (hbd_sub : discBd Δ ⊆ F ∪ bd π.S) + (hsmall : IsSmallWrt 𝒯 (π.areaGraph Δ)) : + ∃ π' : Portrayal G, + π'.IsCentral 𝒯 ∧ + π'.Resembles π ∧ + (π'.IsTruer π ∨ (Δ ∩ π.Γ.N ⊆ F ∧ {c ∈ π.Γ.C | c ⊆ Δ}.ncard = 1)) := by + classical + have : CompactSpace π.S := π.isSurface.1 + have : T2Space π.S := π.isSurface.2.1 + have hne : n₁ ≠ n₂ := ne_of_isLineWithEnds hF + obtain ⟨Γ', Θ, F'', + hU', hN'_cl, hN'_eq, hΘ, hn₁_Θ, hn₂_Θ, hbd_Θ, hΔ_bd, hF', hF''_line, hF''_boundary, + hF''_pair, _, hdich, htilde_I₂, + hc'_mem, hc'_Θ, htilde_c', hC', hc'_not_I₂, + ⟨c₁_end, hc₁_C, hc₁_Δ, hc₁_bd, hn₁_c₁⟩, + ⟨c₂_end, hc₂_C, hc₂_Δ, hc₂_bd, hn₂_c₂⟩⟩ := + GraphMinor.GM17.normalIArcReplaceDisc π.S π.isSurface π.Γ n₁ n₂ F Δ hnorm hF hFbd hFN hΔ hF_bd + hbd_sub + let c' := Δ \ {n₁, n₂} + let F' := discBd Δ ∩ Θ + let I₁ : Set (Set π.S) := {c ∈ π.Γ.C | c ⊆ Δ} + let I₂ : Set (Set π.S) := {c ∈ π.Γ.C | c ⊆ Δᶜ} + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hc'_bd : (c' ∩ bd π.S).Nonempty := hc'_Θ.mono (inter_subset_inter_right _ hΘ_bd) + have hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S := ⟨hn₁_Θ.1, hΘ_bd hn₁_Θ.2⟩ + have hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S := ⟨hn₂_Θ.1, hΘ_bd hn₂_Θ.2⟩ + have hN'_sub : Γ'.N ⊆ π.Γ.N := hN'_cl ▸ inter_subset_left + have hn₁_N' : n₁ ∈ Γ'.N ∩ bd π.S := ⟨hN'_eq ▸ Or.inr (mem_insert _ _), hn₁_bd.2⟩ + have hn₂_N' : n₂ ∈ Γ'.N ∩ bd π.S := ⟨hN'_eq ▸ Or.inr (mem_insert_of_mem _ rfl), hn₂_bd.2⟩ + obtain ⟨hpart, hdisj_I⟩ := cells_partitioned_by_disc π.Γ hdich + have hbp₁_sub_Δ : π.borderPlus n₁ ⊆ (π.areaGraph Δ).vertexSet := + (π.borderPlus_subset_cellGraph hc₁_C hc₁_bd hn₁_c₁).trans + (fun _ hv => mem_biUnion ⟨⟨hc₁_C, hc₁_Δ⟩, hc₁_C⟩ hv) + have hbp₂_sub_Δ : π.borderPlus n₂ ⊆ (π.areaGraph Δ).vertexSet := + (π.borderPlus_subset_cellGraph hc₂_C hc₂_bd hn₂_c₂).trans + (fun _ hv => mem_biUnion ⟨⟨hc₂_C, hc₂_Δ⟩, hc₂_C⟩ hv) + have hbp_c'_sub_Δ : ∀ {n : π.S}, n ∈ tilde c' → π.borderPlus n ⊆ (π.areaGraph Δ).vertexSet := by + intro n hn + change n ∈ tilde (Δ \ {n₁, n₂}) at hn + rw [htilde_c'] at hn + rcases hn with rfl | rfl + · exact hbp₁_sub_Δ + · exact hbp₂_sub_Δ + have htilde_c'_N' : tilde c' ⊆ Γ'.N ∩ bd π.S := by + intro x hx + change x ∈ tilde (Δ \ {n₁, n₂}) at hx + rw [htilde_c'] at hx + rcases hx with rfl | rfl + · exact hn₁_N' + · exact hn₂_N' + -- By `(2.1)` (`theorem_2_1_claim_3`), `V(α(Δ)) ∩ V(α(I₂)) ⊆ β(n₁+) ∪ β(n₂+)`. + have hinter_I₁_I₂ : (π.areaGraph Δ).vertexSet ∩ (π.cellsUnion I₂).vertexSet ⊆ + ⋃ n ∈ tilde c', π.borderPlus n := by + exact cuff_disc_area_intersects_outer_cells_at_border (α := α) (β := β) (G := G) π (Δ := Δ) + (n₁ := n₁) (n₂ := n₂) hΔ Γ' hN'_eq htilde_I₂ htilde_c' hpart hdisj_I + let cellG : Set π.S → Hypergraph α β := fun c => + if c = c' then π.areaGraph Δ else π.cellGraph c + let π' : Portrayal G := + replaced_cuff_disc_portrayal (α := α) (β := β) (G := G) π (Δ := Δ) (n₁ := n₁) (n₂ := n₂) Γ' + hdich htilde_I₂ hc'_mem hC' hc'_not_I₂ hc'_bd hN'_sub hdisj_I hbp_c'_sub_Δ + htilde_c'_N' hinter_I₁_I₂ + have hbp'_eq : ∀ {n : π.S}, n ∈ Γ'.N → π'.borderPlus n = π.borderPlus n := by + intro n hn + ext v + change (v ∈ π.borderSet n ∨ (n ∈ π.domγ ∩ Γ'.N ∧ v = π.nodeVertex n)) ↔ + (v ∈ π.borderSet n ∨ (n ∈ π.domγ ∧ v = π.nodeVertex n)) + exact or_congr_right ⟨fun ⟨h, hv⟩ => ⟨h.1, hv⟩, fun ⟨h, hv⟩ => ⟨⟨h, hn⟩, hv⟩⟩ + -- `π'` is `𝒯`-central. + have hπ'_central : π'.IsCentral 𝒯 := by + intro c hc_mem + rw [hC'] at hc_mem + change ∃ B, (cellG c, B) ∈ 𝒯 + dsimp only [cellG] + split_ifs with hcc' + · exact hsmall + · exact hc c (hc_mem.resolve_left hcc').1 + -- For every border cell `c ∈ I₂`, `π'.cellWarp c = π.cellWarp c`. + have hcw_I₂ : ∀ {c : Set π.S}, c ∈ I₂ → (c ∩ bd π.S).Nonempty → + π'.cellWarp c = π.cellWarp c := by + intro c hc_I₂ _ + have hne_c : c ≠ c' := by rintro rfl; exact hc'_not_I₂ hc_I₂ + have hcg : π'.cellGraph c = π.cellGraph c := by + change cellG c = π.cellGraph c + dsimp only [cellG] + exact ite_eq_right hne_c + have hnt_N' : ∀ {n : π.S}, n ∈ tilde c → n ∈ Γ'.N := + fun hn => htilde_I₂ c hc_I₂.1 hc_I₂.2 hn + have hiff : ∀ q : ℕ, π'.CellWarpLE c q ↔ π.CellWarpLE c q := by + intro q + simp only [Portrayal.CellWarpLE, hcg] + refine forall₂_congr fun u₁ hu₁ => forall₂_congr fun u₂ hu₂ => + forall_congr' fun _ => ?_ + rw [hbp'_eq (hnt_N' hu₁), hbp'_eq (hnt_N' hu₂)] + change sInf {p | π'.CellWarpLE c p} = sInf {p | π.CellWarpLE c p} + congr 1 + ext p + exact hiff p + -- Bound the warp of `c'` in `π'` by `q = π.warpAt Θ`. + let q := π.warpAt Θ + have hΘ_arc : IsOArc Θ := (GraphMinor.Surface.cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + have hbs_le_q : ∀ {n : π.S}, n ∈ π.Γ.N ∩ Θ → (π.borderSet n).ncard ≤ q := + fun hn => cuff_node_border_count_le_warp π hΘ hΘ_bd hΘ_arc hn + have hcw_c' : π'.cellWarp c' ≤ q := by + apply csInf_le (OrderBot.bddBelow _) + intro u₁ hu₁ u₂ hu₂ hu_ne + have hu₁_pair : u₁ = n₁ ∨ u₁ = n₂ := by + change u₁ ∈ tilde (Δ \ {n₁, n₂}) at hu₁ + rw [htilde_c'] at hu₁ + exact hu₁ + have hu₂_pair : u₂ = n₁ ∨ u₂ = n₂ := by + change u₂ ∈ tilde (Δ \ {n₁, n₂}) at hu₂ + rw [htilde_c'] at hu₂ + exact hu₂ + have hu₁_N' : u₁ ∈ Γ'.N := (htilde_c'_N' hu₁).1 + have hu₂_N' : u₂ ∈ Γ'.N := (htilde_c'_N' hu₂).1 + have hcg_c' : π'.cellGraph c' = π.areaGraph Δ := by + change cellG c' = π.areaGraph Δ + simp [cellG] + rw [hbp'_eq hu₁_N', hbp'_eq hu₂_N', hcg_c'] + clear hu₁ hu₂ hu₁_N' hu₂_N' + have hu₁_Θ : u₁ ∈ π.Γ.N ∩ Θ := by + rcases hu₁_pair with h | h <;> rw [h] <;> assumption + have hu₂_Θ : u₂ ∈ π.Γ.N ∩ Θ := by + rcases hu₂_pair with h | h <;> rw [h] <;> assumption + have hu₁_bd : u₁ ∈ π.Γ.N ∩ bd π.S := ⟨hu₁_Θ.1, hΘ_bd hu₁_Θ.2⟩ + have hu₂_bd : u₂ ∈ π.Γ.N ∩ bd π.S := ⟨hu₂_Θ.1, hΘ_bd hu₂_Θ.2⟩ + refine ⟨hbs_le_q hu₁_Θ, hbs_le_q hu₂_Θ, fun hcard₁ hcard₂ => ?_⟩ + have hcw_linkage : Portrayal.LinkagePairs (π.areaGraph Δ).skeleton (π.borderPlus u₁) + (π.borderPlus u₂) (q + 1) (π.nodeVertex u₁) (π.nodeVertex u₂) := by + exact cuff_disc_area_links_ends (α := α) (β := β) (G := G) (𝒯 := 𝒯) (θ := θ) (p := p) h𝒯 π + hc hred hwarp hθ (F := F) (Δ := Δ) (n₁ := n₁) (n₂ := n₂) hnorm hF hFbd hFN hΔ hF_bd hbd_sub + hsmall hne Θ hΘ hbd_Θ hΘ_bd hn₁_bd hn₂_bd hbs_le_q u₁ u₂ hu_ne hu₁_pair hu₂_pair hu₁_Θ + hu₂_Θ hu₁_bd hu₂_bd hcard₁ hcard₂ + exact hcw_linkage + -- Show `π'.warpAt Θ' ≤ π.warpAt Θ'` for every cuff `Θ' ∈ cuffs π.S`. + have hwarpAt_le : ∀ Θ' ∈ cuffs π.S, π'.warpAt Θ' ≤ π.warpAt Θ' := by + intro Θ' hΘ' + apply csSup_le' + rintro r ⟨c, hc_mem, hc_Θ', rfl⟩ + rw [hC'] at hc_mem + rcases hc_mem with rfl | hc_I₂ + · have hΘ'_eq : Θ' = Θ := + (Γ'.border_cell_subset_cuff hc'_mem hΘ hc'_Θ).2.2.2.2 Θ' hΘ' hc_Θ' + exact hΘ'_eq ▸ hcw_c' + · have hΘ'_bd : Θ' ⊆ bd π.S := by + rcases hΘ' with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hbd_c : (c ∩ bd π.S).Nonempty := hc_Θ'.mono (inter_subset_inter_right _ hΘ'_bd) + rw [hcw_I₂ hc_I₂ hbd_c] + exact π.cellWarp_le_warpAt hc_I₂.1 hc_Θ' + -- Since `π` is `0`-redundant, `π'` cannot be simpler than `π`, so `π'.Resembles π`. + have hzero_red : π.IsZeroRedundant 𝒯 := hred.isZeroRedundant h𝒯 + have hwarpAt_eq : ∀ Θ' ∈ cuffs π.S, π'.warpAt Θ' = π.warpAt Θ' := by + intro Θ' hΘ' + refine le_antisymm (hwarpAt_le Θ' hΘ') ?_ + by_contra hlt + have hlt' : π'.warpAt Θ' < π.warpAt Θ' := lt_of_not_ge hlt + have hsimpler : π'.IsSimpler π := by + right + refine ⟨Homeomorph.refl π.S, ?_, Θ', hΘ', ?_⟩ + · intro Θ'' hΘ'' + rw [Homeomorph.refl_apply, image_id] + exact hwarpAt_le Θ'' hΘ'' + · rw [Homeomorph.refl_apply, image_id] + exact hlt' + exact hzero_red π' hπ'_central hsimpler + have hπ'_resembles : π'.Resembles π := by + refine ⟨Homeomorph.refl π.S, fun Θ' hΘ' => ?_⟩ + rw [Homeomorph.refl_apply, image_id] + exact hwarpAt_eq Θ' hΘ' + refine ⟨π', hπ'_central, hπ'_resembles, ?_⟩ + -- Compare `π'.truth` and `π.truth`. + have htruth_sub_lt4 : ∀ i : Fin 6, i.1 < 4 → + {c ∈ Γ'.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - i.1} ⊆ + {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - i.1} := by + intro i _ c ⟨hc_mem, hint, hcard_c⟩ + have hne_c : c ≠ c' := fun h => hint (h ▸ hc'_bd) + exact ⟨((hC' ▸ hc_mem).resolve_left hne_c).1, hint, hcard_c⟩ + have htruth_le : ∀ i : Fin 6, π'.truth i ≤ π.truth i := by + intro i + simp only [Portrayal.truth] + split_ifs with h4 h5 + · exact ncard_le_ncard (htruth_sub_lt4 i h4) (π.Γ.finite_cells.subset fun _ h => h.1) + · exact ncard_le_ncard (sdiff_subset_sdiff hN'_sub Subset.rfl) (π.Γ.finite_N.subset + sdiff_subset) + · exact ncard_le_ncard (inter_subset_inter_left _ hN'_sub) (π.Γ.finite_N.subset + inter_subset_left) + by_cases hex_lt : ∃ k : Fin 6, π'.truth k < π.truth k + · exact Or.inl (isTruer_of_le_of_lt htruth_le hex_lt) + · right + have htruth_eq : ∀ i : Fin 6, π'.truth i = π.truth i := by + intro i + refine le_antisymm (htruth_le i) ?_ + by_contra hlt + exact hex_lt ⟨i, lt_of_not_ge hlt⟩ + -- Every cell `c ∈ I₁` must be a border cell. + obtain ⟨hI₁_border, hΔ_N_pair⟩ := + disc_has_no_internal_cells_or_new_nodes_of_count_eq π.Γ Γ' hC' hc'_bd hN'_eq hdisj_I + htruth_sub_lt4 + (fun i hi => by + have htr := htruth_eq i + simpa only [Portrayal.truth, hi, ↓reduceIte] using htr) + (by simpa [Portrayal.truth] using htruth_eq ⟨4, by decide⟩) + (by simpa [Portrayal.truth] using htruth_eq ⟨5, by decide⟩) hN'_sub + have hΔ_N_F : Δ ∩ π.Γ.N ⊆ F := hΔ_N_pair.trans (hFN ▸ inter_subset_left) + refine ⟨hΔ_N_F, ?_⟩ + -- Since `(F' \ {n₁, n₂})` is nonempty and path-connected in `bd S \ N`, `I₁` has a unique cell. + have hSingleBorderCell : I₁.ncard = 1 := by + exact single_cell_in_disc_with_two_boundary_nodes π Θ hΔ_bd hF' hdich hΘ_bd hn₁_bd hn₂_bd + hI₁_border hΔ_N_pair + exact hSingleBorderCell + +end Theorem73And74 + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section8.lean b/LeanPool/GraphMinor/GM17/Section8.lean new file mode 100644 index 0000000000..5d47244a71 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section8.lean @@ -0,0 +1,230 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section7 +public import LeanPool.GraphMinor.GM20.Cited + +import LeanPool.GraphMinor.Surface.Cuffs + +/-! +# Graph Minors XVII, Section 8: The Painting of a True Portrayal + +This file formalizes Section 8 (pages 181–183) of Robertson and Seymour, *Graph Minors. XVII. +Taming a Vortex*, J. Combin. Theory Ser. B 77 (1999), 162–210: + +- **(8.1)** (`theorem_8_1`, page 181): Every region of $\Gamma$ is an open disc. +- **(8.2)** (`theorem_8_2`, pages 181–182): The boundary of every region is an $O$-arc, and in + particular $|\tilde{c}| \ge 2$ for every cell $c \in C(\Gamma)$. +- **(8.3)** (`theorem_8_3` and `gm17_theorem_8_3`, page 182): For every $\Gamma$-normal $I$-arc + $F$ with $|F \cap N(\Gamma)| = 2$, there is a disc $\Delta \subseteq \Sigma$ with + $F \subseteq \operatorname{bd}(\Delta) \subseteq F \cup \operatorname{bd}(\Sigma)$ such that + $\Delta \cap N(\Gamma) \subseteq F$ and $\Delta$ includes exactly one cell of $\Gamma$. +- **(8.4)** (`theorem_8_4`, page 182): $\operatorname{dom}(\gamma) = N(\Gamma)$. +- **(8.5)** (`theorem_8_5` and `gm17_theorem_8_5`, page 182): For every $\Gamma$-normal $O$-arc + $F \subseteq \Sigma$ with $|F \cap N(\Gamma)| \le 3$, there is a disc $\Delta \subseteq \Sigma$ + with $F = \operatorname{bd}(\Delta)$ such that $\alpha(\Delta)$ is small, and either + (i) $\Delta \cap N(\Gamma) \subseteq F$ and $\Delta$ includes at most one cell of $\Gamma$, or + (ii) $|F \cap N(\Gamma)| = 3$ and $|\tilde{c}| = 2$ for every cell $c \subseteq \Delta$. +- **(8.6)** (`theorem_8_6`, page 182): If $c$ is an internal cell, then + $|\bar{c} \cap \operatorname{bd}(\Sigma)| \le 2$, and if equality holds then $|\tilde{c}| = 3$ + and the two members of $\bar{c} \cap \operatorname{bd}(\Sigma)$ are consecutive on a cuff. +- **(8.7)** (`theorem_8_7`, pages 182–183): For every node $n \in N(\Gamma)$ there are at least + two cells $c \in C^*(\Gamma)$ with $n \in \tilde{c}$, and if there are only two and + $|\tilde{c}| = 2$ for one of them, then $c$ is a border cell. +- **(8.8)** (`theorem_8_8`, page 183): If $c_1, c_2 \in C(\Gamma)$ are distinct cells with + $\tilde{c}_1 \subseteq \tilde{c}_2$, then $c_1$ is a border cell and $|\tilde{c}_2| = 3$. +The portrayal deductions that use painting results are proved in `Section8Proved`. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +/-! ## 1. Preliminary Lemmas for True Portrayals -/ + +/-- If $z_1 \le z_2$ and $\pi$ is $z_2$-redundant, then $\pi$ is $z_1$-redundant. -/ +theorem Portrayal.IsRedundant.mono {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ z₁ z₂ : ℕ} {π : Portrayal G} + (hred : π.IsRedundant 𝒯 θ z₂) (hle : z₁ ≤ z₂) : + π.IsRedundant 𝒯 θ z₁ := + ⟨ lt_of_le_of_lt hle hred.1, + fun Z hZ hZ_le => hred.2 Z hZ (hZ_le.trans hle) ⟩ + +/-- In a $\mathcal{T}$-central portrayal $\pi$ of $G$, if $\Delta \subseteq \Sigma$ is a +$\Gamma$-normal closed disc such that $\alpha(\Delta)$ is small relative to $\mathcal{T}$, then +there exists a cell $c' \in C(\Gamma)$ with $c' \subseteq \Sigma \setminus \Delta$, chosen so that +$\tilde{c}' \cap \operatorname{discBd} \Delta \ne \emptyset$ whenever such a cell exists. -/ +theorem Portrayal.exists_cell_outside_disc_of_small {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + {Δ : Set π.S} (hΔ : IsClosedDisc Δ) (hnorm : discBd Δ ∩ π.Γ.U ⊆ π.Γ.N) + (hsmall : IsSmallWrt 𝒯 (π.areaGraph Δ)) : + ∃ c' ∈ π.Γ.C, c' ⊆ Set.univ \ Δ ∧ + ((∃ c ∈ π.Γ.C, c ⊆ Set.univ \ Δ ∧ (tilde c ∩ discBd Δ).Nonempty) → + (tilde c' ∩ discBd Δ).Nonempty) := by + classical + obtain ⟨hdich, _, _⟩ := normal_disc_cell_dichotomy π.isSurface π.Γ hΔ hnorm + have hex_out : ∃ c₀ ∈ π.Γ.C, c₀ ⊆ Set.univ \ Δ := by + by_contra hall + push Not at hall + have hV_ne : (π.areaGraph Δ).vertexSet ≠ G.vertexSet := hsmall.vertexSet_ne h𝒯 + apply hV_ne + refine Subset.antisymm (π.cellsUnion_le _).vertexSet_subset ?_ + intro v hv + obtain ⟨c, hc, hvc⟩ := π.p1_vertex v hv + have hc_in : c ⊆ Δ := by + rcases hdich c hc with h | h + · exact h.trans sdiff_subset + · exact False.elim (hall c hc h) + exact mem_iUnion₂.mpr ⟨c, ⟨⟨hc, hc_in⟩, hc⟩, hvc⟩ + by_cases htouch : ∃ c ∈ π.Γ.C, c ⊆ Set.univ \ Δ ∧ (tilde c ∩ discBd Δ).Nonempty + · obtain ⟨c', hc', hc'_out, hc'_touch⟩ := htouch + exact ⟨c', hc', hc'_out, fun _ => hc'_touch⟩ + · obtain ⟨c₀, hc₀, hc₀_out⟩ := hex_out + exact ⟨c₀, hc₀, hc₀_out, fun h => False.elim (htouch h)⟩ + +/-- By (4.3) (`theorem_4_3_proof`), in any $\mathcal{T}$-central portrayal $\pi$ of warp $\le p$, +the +number of nodes in $\operatorname{dom}(\gamma)$ (and hence in $N(\Gamma)$) is at least +$\theta - 2p$. In particular, when $\theta > 4p + 5$, we have $|\operatorname{dom}(\gamma)| \ge 6$ +and $|N(\Gamma)| \ge 6$. -/ +theorem Portrayal.sub_two_mul_warp_le_ncard_domγ {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) (hcentral : π.IsCentral 𝒯) (hwarp : π.warp ≤ p) : + θ - 2 * p ≤ π.domγ.ncard ∧ θ - 2 * p ≤ π.Γ.N.ncard := by + have hfin_dom : π.domγ.Finite := π.Γ.finite_N.subset π.domγ_subset + have hle_N : π.domγ.ncard ≤ π.Γ.N.ncard := ncard_le_ncard π.domγ_subset π.Γ.finite_N + have hge : θ - 2 * p ≤ π.domγ.ncard := by + by_contra hlt + have hlt' : π.domγ.ncard < θ - 2 * p := lt_of_not_ge hlt + let W : Set α := π.nodeVertex '' π.domγ + have hW_sub : W ⊆ G.vertexSet := by + rintro _ ⟨n, hn, rfl⟩ + exact π.nodeVertex_mem n hn + have hW_fin : W.Finite := hfin_dom.image π.nodeVertex + have hW_le : W.ncard ≤ π.domγ.ncard := ncard_image_le hfin_dom + have hW_lt_θ : W.ncard < θ := by omega + let A : Hypergraph α β := discreteSubhypergraph G W hW_sub + have hA_small : IsSmallWrt 𝒯 A := ⟨G, IsTangle.discrete_mem h𝒯 hW_sub hW_lt_θ⟩ + have hatt_sub : attachments G A ⊆ W := fun _ hv => hv.1 + have hatt_lt : (attachments G A).ncard < θ - 2 * p := + (ncard_le_ncard hatt_sub hW_fin).trans_lt (hW_le.trans_lt hlt') + exact theorem_4_3_proof h𝒯 π hcentral hwarp + ⟨A, hA_small, hatt_lt, fun n hn => ⟨n, hn, rfl⟩⟩ + exact ⟨hge, hge.trans hle_N⟩ + +/-! ## 2. Every Region is an Open Disc with $O$-Arc Boundary: (8.1) and (8.2) (Pages 181–182) -/ + +/-- Topological statement for Graph Minors XVII, (8.1) (page 181): +In a connected surface $S$ with a painting $\Gamma$ having $\Gamma.U \ne \emptyset$, if every +$O$-arc $F \subseteq S$ disjoint from $\Gamma.U$ bounds a closed disc $\Delta \subseteq S$ with +$\operatorname{discBd} \Delta = F$ and $\Delta \cap \Gamma.U = \emptyset$, then every region +$r \in \Gamma.\text{regions}$ is an open disc. -/ +@[expose] def RegionOpenDiscCriterionStatement : Prop := + ∀ (S : Type) [TopologicalSpace S] [ConnectedSpace S], IsSurface S → + ∀ (Γ : Painting S), + Γ.U.Nonempty → + (∀ F : Set S, IsOArc F → Disjoint F Γ.U → + ∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F ∧ Disjoint Δ Γ.U) → + ∀ r ∈ Γ.regions, IsOpenDisc r + +/-- Topological statement for Graph Minors XVII, (8.2) (pages 181–182), and the normal-arc pushoff +constructions along region boundaries used in (8.4), (8.6), (8.7), and (8.8) (pages 182–183): +In a connected surface $S$ with a painting $\Gamma$ having $|\Gamma.N| \ge 6$ whose regions are +open discs, if every $\Gamma$-normal $O$-arc $F \subseteq S$ with $|F \cap \Gamma.N| \le 1$ bounds +a closed disc $\Delta \subseteq S$ with $\operatorname{discBd} \Delta = F$ and +$\Delta \cap \Gamma.U \subseteq F$, then: +1. The boundary $\overline{r} \setminus r$ of every region $r \in \Gamma.\text{regions}$ is an + $O$-arc; +2. Every cell $c \in \Gamma.C$ has $2 \le |\tilde{c}|$; +3. Every node $n \in \Gamma.N$ belongs to $\tilde{c}$ for some cell $c \in \Gamma.C$; +4. If a border node $n \in \Gamma.N \cap \operatorname{bd} S$ does not belong to $\tilde{c}$ for any + internal cell $c \in \Gamma.C$, pushing off the two incident border cells in the adjacent region + gives a $\Gamma$-normal $I$-arc $F$ with $|F \cap \Gamma.N| = 2$ that cannot bound a closed disc + $\Delta$ with $F \subseteq \operatorname{discBd} \Delta \subseteq F \cup \operatorname{bd} S$, + $\Delta \cap \Gamma.N \subseteq F$, and $\{c \in \Gamma.C \mid c \subseteq \Delta\}.\text{ncard} + = 1$; +5. For every internal cell $c \in \Gamma.C$, any two distinct nodes $n_1, n_2 \in \bar{c} \cap + \operatorname{bd} S$ + are joined by a $\Gamma$-normal $I$-arc $F$ with $F \cap \operatorname{bd} S = \{n_1, n_2\}$ and + $F \cap \Gamma.N = \{n_1, n_2\}$, and if $\tilde{c} \subseteq \operatorname{bd} S$, pushing off + $c$ + gives a $\Gamma$-normal $I$-arc with $|F \cap \Gamma.N| = 2$ that cannot bound a 1-cell normal + disc; +6. If two distinct border cells $c_1, c_2 \in \Gamma.C$ have $\tilde{c}_1 = \tilde{c}_2$, pushing + off + $c_1$ and $c_2$ into their adjacent regions gives a $\Gamma$-normal $O$-arc $F$ with + $|F \cap \Gamma.N| = 2$ that bounds no closed disc $\Delta$ with $\Delta \cap \Gamma.N \subseteq + F$; and +7. If an internal node $n \in \Gamma.N \setminus \operatorname{bd} S$ is incident with at most one + cell, or with two cells one of which has $|\tilde{c}_0| = 2$, encircling $n$ and its incident + cells + in the surrounding region(s) gives a $\Gamma$-normal $O$-arc $F$ with $|F \cap \Gamma.N| \le 3$ + such that any closed disc $\Delta$ bounded by $F$ either fails both alternatives of (8.5) or is + the + complementary disc covering $\Gamma.C \setminus \{c \in \Gamma.C \mid n \in \tilde{c}\}$. -/ +@[expose] def RegionBoundaryOArcCriterionStatement : Prop := + ∀ (S : Type) [TopologicalSpace S] [ConnectedSpace S], IsSurface S → + ∀ (Γ : Painting S), + 6 ≤ Γ.N.ncard → + (∀ r ∈ Γ.regions, IsOpenDisc r) → + (∀ F : Set S, IsOArc F → Γ.IsNormal F → (F ∩ Γ.N).ncard ≤ 1 → + ∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F ∧ Δ ∩ Γ.U ⊆ F) → + (∀ r ∈ Γ.regions, IsOArc (closure r \ r)) ∧ + (∀ c ∈ Γ.C, 2 ≤ (tilde c).ncard) ∧ + (∀ n ∈ Γ.N, ∃ c ∈ Γ.C, n ∈ tilde c) ∧ + (∀ n ∈ Γ.N ∩ bd S, (∀ c ∈ Γ.C, n ∈ tilde c → (c ∩ bd S).Nonempty) → + ∃ F : Set S, IsLine F ∧ Γ.IsNormal F ∧ F ∩ bd S = lineEnds F ∧ (F ∩ Γ.N).ncard = 2 ∧ + ∀ Δ : Set S, IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd S → + ¬ (Δ ∩ Γ.N ⊆ F ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard = 1)) ∧ + (∀ c ∈ Γ.C, ¬ (c ∩ bd S).Nonempty → + (∀ n₁ ∈ closure c ∩ bd S, ∀ n₂ ∈ closure c ∩ bd S, n₁ ≠ n₂ → + ∃ F : Set S, IsLineWithEnds F n₁ n₂ ∧ Γ.IsNormal F ∧ F ∩ bd S = lineEnds F ∧ + F ∩ bd S = {n₁, n₂} ∧ F ∩ Γ.N = {n₁, n₂} ∧ + ∀ Δ : Set S, IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd S → + (Δ ∩ (bd S \ {n₁, n₂})).Nonempty ∧ + ∀ c₀ ∈ Γ.C, (c₀ ∩ Δ).Nonempty → c₀ ⊆ Δ) ∧ + (tilde c ⊆ bd S → + ∃ F : Set S, IsLine F ∧ Γ.IsNormal F ∧ F ∩ bd S = lineEnds F ∧ (F ∩ Γ.N).ncard = 2 ∧ + ∀ Δ : Set S, IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd S → + ¬ (Δ ∩ Γ.N ⊆ F ∧ {d ∈ Γ.C | d ⊆ Δ}.ncard = 1))) ∧ + (∀ c₁ ∈ Γ.C, ∀ c₂ ∈ Γ.C, c₁ ≠ c₂ → + (c₁ ∩ bd S).Nonempty → (c₂ ∩ bd S).Nonempty → tilde c₁ = tilde c₂ → + ∃ F : Set S, IsOArc F ∧ Γ.IsNormal F ∧ (F ∩ Γ.N).ncard = 2 ∧ + ∀ Δ : Set S, IsClosedDisc Δ → discBd Δ = F → ¬ (Δ ∩ Γ.N ⊆ F)) ∧ + (∀ n ∈ Γ.N \ bd S, + ({c ∈ Γ.C | n ∈ tilde c}.ncard ≤ 1 ∨ + ({c ∈ Γ.C | n ∈ tilde c}.ncard = 2 ∧ + ∃ c₀ ∈ Γ.C, n ∈ tilde c₀ ∧ (tilde c₀).ncard = 2)) → + ∃ F : Set S, IsOArc F ∧ Γ.IsNormal F ∧ (F ∩ Γ.N).ncard ≤ 3 ∧ + ∀ Δ : Set S, IsClosedDisc Δ → discBd Δ = F → + ((Δ ∩ Γ.N ⊆ F ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard ≤ 1) ∨ + ((F ∩ Γ.N).ncard = 3 ∧ ∀ c ∈ Γ.C, c ⊆ Δ → (tilde c).ncard = 2)) → + ∃ d₁ ∈ Γ.C, ∃ d₂ ∈ Γ.C, Γ.C ⊆ {d₁, d₂} ∪ {c ∈ Γ.C | c ⊆ Δ}) + +/-- For any internal cell $c \in C(\Gamma)$ (`¬ (c ∩ bd S).Nonempty`), +$\bar{c} \cap \operatorname{bd} S = \tilde{c} \cap \operatorname{bd} S$. -/ +theorem Painting.closure_cell_inter_bd_eq_tilde_inter_bd {S : Type} [TopologicalSpace S] + {c : Set S} (hint : ¬ (c ∩ bd S).Nonempty) : + closure c ∩ bd S = tilde c ∩ bd S := by + ext x + simp only [tilde, mem_inter_iff, mem_sdiff] + exact ⟨fun ⟨hxcl, hxbd⟩ => ⟨⟨hxcl, fun hxc => hint ⟨x, hxc, hxbd⟩⟩, hxbd⟩, + fun ⟨⟨hxcl, _⟩, hxbd⟩ => ⟨hxcl, hxbd⟩⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section8Proved.lean b/LeanPool/GraphMinor/GM17/Section8Proved.lean new file mode 100644 index 0000000000..9033822f7e --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section8Proved.lean @@ -0,0 +1,1256 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section8 +import LeanPool.GraphMinor.GM17.Section5Proved +import LeanPool.GraphMinor.GM17.Section6Proved +import LeanPool.GraphMinor.GM17.Section7Proved + +public import LeanPool.GraphMinor.GM17.Section7 +public import LeanPool.GraphMinor.GM20.Cited + +import LeanPool.GraphMinor.Surface.Cuffs + +import LeanPool.GraphMinor.GM17.ArcDisc + +import LeanPool.GraphMinor.GM17.CutArcPaint + +import LeanPool.GraphMinor.GM17.MarkCross + +import LeanPool.GraphMinor.GM17.PasteCuff + +import LeanPool.GraphMinor.GM17.PushNode + +import LeanPool.GraphMinor.GM17.RegionBoundary + +import LeanPool.GraphMinor.GM17.RegionDisc + +import LeanPool.GraphMinor.GM17.ReplaceDisc + +/-! +# Graph Minors XVII: proved deductions of Section8 + +The portrayal deductions use the existing painting proofs. The definitions and +independent geometric lemmas are imported from `Section8`. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +/-! ## 1. Preliminary Lemmas for True Portrayals -/ + +/-- **Graph Minors XVII, (8.1)** (page 181): +"Every region of $\Gamma$ is an open disc." -/ +theorem theorem_8_1_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {r : Set π.S} (hr : r ∈ π.Γ.regions) : + IsOpenDisc r := by + have : ConnectedSpace π.S := π.connected + have hN_ge2 : 2 ≤ π.Γ.N.ncard := by + have hge := (π.sub_two_mul_warp_le_ncard_domγ h𝒯 htrue.1 hwarp).2 + omega + have hU_ne : π.Γ.U.Nonempty := + ((ncard_pos π.Γ.finite_N).mp (by omega)).mono π.Γ.N_subset + apply GraphMinor.GM17.regionOpenDiscCriterion π.S π.isSurface π.Γ hU_ne _ r hr + intro F hO hdisj + have hnorm : π.Γ.IsNormal F := by + intro x hx + exact False.elim (Set.disjoint_left.mp hdisj hx.1 hx.2) + have hFN_empty : F ∩ π.Γ.N = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro x ⟨hxF, hxN⟩ + exact Set.disjoint_left.mp hdisj hxF (π.Γ.N_subset hxN) + have hFγ_le : (F ∩ π.domγ).ncard ≤ 1 := by + have hsub : F ∩ π.domγ ⊆ F ∩ π.Γ.N := inter_subset_inter_right F π.domγ_subset + have hempty : F ∩ π.domγ = ∅ := eq_empty_of_subset hsub hFN_empty + rw [hempty, ncard_empty] + omega + have hred_1 : π.IsRedundant 𝒯 θ 1 := hred.mono (by omega) + have hθ_64 : 1 + max 3 (2 * p + 2) < θ := by omega + obtain ⟨Δ, hΔ, hbd, hsmall⟩ := + theorem_6_4_proof h𝒯 π htrue.1 hwarp hred_1 hθ_64 hO hnorm hFγ_le + have hcard : (discBd Δ ∩ π.Γ.N).ncard ≤ 1 := by + rw [hbd, hFN_empty, ncard_empty] + omega + have hnorm_bd : discBd Δ ∩ π.Γ.U ⊆ π.Γ.N := hbd ▸ hnorm + obtain ⟨c', hc', hc'_out, hchoice⟩ := + π.exists_cell_outside_disc_of_small h𝒯 hΔ hnorm_bd hsmall + obtain ⟨π', _, hπ'_central, hπ'_res, hnot_ne | htruer⟩ := + theorem_7_1_proof h𝒯 π htrue.1 hΔ hnorm_bd hcard hsmall hc' hc'_out hchoice + · refine ⟨Δ, hΔ, hbd, Set.disjoint_left.mpr fun x hxΔ hxU => ?_⟩ + by_cases hxF : x ∈ discBd Δ + · exact Set.disjoint_left.mp hdisj (hbd ▸ hxF) hxU + · exact hnot_ne ⟨x, ⟨hxΔ, hxF⟩, hxU⟩ + · exact False.elim (htrue.2.2 π' hπ'_central htruer hπ'_res) + +private theorem region_boundary_props + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) : + (∀ r ∈ π.Γ.regions, IsOArc (closure r \ r)) ∧ + (∀ c ∈ π.Γ.C, 2 ≤ (tilde c).ncard) ∧ + (∀ n ∈ π.Γ.N, ∃ c ∈ π.Γ.C, n ∈ tilde c) ∧ + (∀ n ∈ π.Γ.N ∩ bd π.S, (∀ c ∈ π.Γ.C, n ∈ tilde c → (c ∩ bd π.S).Nonempty) → + ∃ F : Set π.S, IsLine F ∧ π.Γ.IsNormal F ∧ F ∩ bd π.S = lineEnds F ∧ (F ∩ π.Γ.N).ncard = 2 ∧ + ∀ Δ : Set π.S, IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd π.S → + ¬ (Δ ∩ π.Γ.N ⊆ F ∧ {c ∈ π.Γ.C | c ⊆ Δ}.ncard = 1)) ∧ + (∀ c ∈ π.Γ.C, ¬ (c ∩ bd π.S).Nonempty → + (∀ n₁ ∈ closure c ∩ bd π.S, ∀ n₂ ∈ closure c ∩ bd π.S, n₁ ≠ n₂ → + ∃ F : Set π.S, IsLineWithEnds F n₁ n₂ ∧ π.Γ.IsNormal F ∧ F ∩ bd π.S = lineEnds F ∧ + F ∩ bd π.S = {n₁, n₂} ∧ F ∩ π.Γ.N = {n₁, n₂} ∧ + ∀ Δ : Set π.S, IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd π.S → + (Δ ∩ (bd π.S \ {n₁, n₂})).Nonempty ∧ + ∀ c₀ ∈ π.Γ.C, (c₀ ∩ Δ).Nonempty → c₀ ⊆ Δ) ∧ + (tilde c ⊆ bd π.S → + ∃ F : Set π.S, IsLine F ∧ π.Γ.IsNormal F ∧ F ∩ bd π.S = lineEnds F ∧ (F ∩ π.Γ.N).ncard = 2 ∧ + ∀ Δ : Set π.S, IsClosedDisc Δ → F ⊆ discBd Δ → discBd Δ ⊆ F ∪ bd π.S → + ¬ (Δ ∩ π.Γ.N ⊆ F ∧ {d ∈ π.Γ.C | d ⊆ Δ}.ncard = 1))) ∧ + (∀ c₁ ∈ π.Γ.C, ∀ c₂ ∈ π.Γ.C, c₁ ≠ c₂ → + (c₁ ∩ bd π.S).Nonempty → (c₂ ∩ bd π.S).Nonempty → tilde c₁ = tilde c₂ → + ∃ F : Set π.S, IsOArc F ∧ π.Γ.IsNormal F ∧ (F ∩ π.Γ.N).ncard = 2 ∧ + ∀ Δ : Set π.S, IsClosedDisc Δ → discBd Δ = F → ¬ (Δ ∩ π.Γ.N ⊆ F)) ∧ + (∀ n ∈ π.Γ.N \ bd π.S, + ({c ∈ π.Γ.C | n ∈ tilde c}.ncard ≤ 1 ∨ + ({c ∈ π.Γ.C | n ∈ tilde c}.ncard = 2 ∧ + ∃ c₀ ∈ π.Γ.C, n ∈ tilde c₀ ∧ (tilde c₀).ncard = 2)) → + ∃ F : Set π.S, IsOArc F ∧ π.Γ.IsNormal F ∧ (F ∩ π.Γ.N).ncard ≤ 3 ∧ + ∀ Δ : Set π.S, IsClosedDisc Δ → discBd Δ = F → + ((Δ ∩ π.Γ.N ⊆ F ∧ {c ∈ π.Γ.C | c ⊆ Δ}.ncard ≤ 1) ∨ + ((F ∩ π.Γ.N).ncard = 3 ∧ ∀ c ∈ π.Γ.C, c ⊆ Δ → (tilde c).ncard = 2)) → + ∃ d₁ ∈ π.Γ.C, ∃ d₂ ∈ π.Γ.C, π.Γ.C ⊆ {d₁, d₂} ∪ {c ∈ π.Γ.C | c ⊆ Δ}) := by + have : ConnectedSpace π.S := π.connected + have h81 : ∀ r ∈ π.Γ.regions, IsOpenDisc r := + fun r hr => theorem_8_1_proof h𝒯 π htrue hred hwarp hθ hr + have hN_ge6 : 6 ≤ π.Γ.N.ncard := by + have hge := (π.sub_two_mul_warp_le_ncard_domγ h𝒯 htrue.1 hwarp).2 + omega + apply GraphMinor.GM17.regionBoundaryOArcCriterion π.S π.isSurface π.Γ hN_ge6 h81 + intro F hO hnorm hcard + have hFγ_le : (F ∩ π.domγ).ncard ≤ 1 := by + have hsub : F ∩ π.domγ ⊆ F ∩ π.Γ.N := inter_subset_inter_right F π.domγ_subset + have hfin : (F ∩ π.Γ.N).Finite := π.Γ.finite_N.inter_of_right F + exact (ncard_le_ncard hsub hfin).trans hcard + have hred_1 : π.IsRedundant 𝒯 θ 1 := hred.mono (by omega) + have hθ_64 : 1 + max 3 (2 * p + 2) < θ := by omega + obtain ⟨Δ, hΔ, hbd, hsmall⟩ := + theorem_6_4_proof h𝒯 π htrue.1 hwarp hred_1 hθ_64 hO hnorm hFγ_le + have hcard_bd : (discBd Δ ∩ π.Γ.N).ncard ≤ 1 := hbd.symm ▸ hcard + have hnorm_bd : discBd Δ ∩ π.Γ.U ⊆ π.Γ.N := hbd ▸ hnorm + obtain ⟨c', hc', hc'_out, hchoice⟩ := + π.exists_cell_outside_disc_of_small h𝒯 hΔ hnorm_bd hsmall + obtain ⟨π', _, hπ'_central, hπ'_res, hnot_ne | htruer⟩ := + theorem_7_1_proof h𝒯 π htrue.1 hΔ hnorm_bd hcard_bd hsmall hc' hc'_out hchoice + · refine ⟨Δ, hΔ, hbd, fun x ⟨hxΔ, hxU⟩ => ?_⟩ + by_contra hxF + exact hnot_ne ⟨x, ⟨hxΔ, hbd.symm ▸ hxF⟩, hxU⟩ + · exact False.elim (htrue.2.2 π' hπ'_central htruer hπ'_res) + +/-- **Graph Minors XVII, (8.2)** (page 181): +"The boundary of every region is an $O$-arc, and in particular, $|\tilde{c}| \ge 2$ for every +cell $c$." -/ +theorem theorem_8_2_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) : + (∀ r ∈ π.Γ.regions, IsOArc (closure r \ r)) ∧ + (∀ c ∈ π.Γ.C, 2 ≤ (tilde c).ncard) ∧ + (∀ n ∈ π.Γ.N, ∃ c ∈ π.Γ.C, n ∈ tilde c) := by + obtain ⟨h1, h2, h3, -⟩ := + region_boundary_props h𝒯 π htrue hred hwarp hθ + exact ⟨h1, h2, h3⟩ + +/-! ## 3. Normal $I$-Arcs with Two Nodes: (8.3) (Page 182) -/ + +/-- **Graph Minors XVII, (8.3)** (page 182): +"For every $\Gamma$-normal $I$-arc $F$ with $|F \cap N(\Gamma)| = 2$, there is a disc +$\Delta \subseteq \Sigma$ with $F \subseteq \operatorname{bd}(\Delta) \subseteq F \cup +\operatorname{bd}(\Sigma)$ +such that $\Delta \cap N(\Gamma) \subseteq F$ and $\Delta$ includes exactly one cell of $\Gamma$." +-/ +theorem theorem_8_3_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {F : Set π.S} (hL : IsLine F) (hnorm : π.Γ.IsNormal F) + (hFbd_ends : F ∩ bd π.S = lineEnds F) + (hcard : (F ∩ π.Γ.N).ncard = 2) : + ∃ Δ : Set π.S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd π.S ∧ + Δ ∩ π.Γ.N ⊆ F ∧ {c ∈ π.Γ.C | c ⊆ Δ}.ncard = 1 := by + rcases hL with ⟨f⟩ + let n₁ : π.S := (f 0).1 + let n₂ : π.S := (f 1).1 + have hF : IsLineWithEnds F n₁ n₂ := ⟨f, rfl, rfl⟩ + have hne : n₁ ≠ n₂ := ne_of_isLineWithEnds hF + have hends_sub_bd : ({n₁, n₂} : Set π.S) ⊆ F ∩ bd π.S := by + rw [hFbd_ends] + exact (ends_subset_of_isLineWithEnds hF).2 + have hbd_sub_FN : F ∩ bd π.S ⊆ F ∩ π.Γ.N := + fun x ⟨hxF, hxbd⟩ => ⟨hxF, hnorm ⟨hxF, π.Γ.bd_subset hxbd⟩⟩ + have hFN_fin : (F ∩ π.Γ.N).Finite := π.Γ.finite_N.inter_of_right F + have hbd_fin : (F ∩ bd π.S).Finite := hFN_fin.subset hbd_sub_FN + have hpair_card : ({n₁, n₂} : Set π.S).ncard = 2 := ncard_pair hne + have hFN_eq : F ∩ π.Γ.N = {n₁, n₂} := by + symm + apply eq_of_subset_of_ncard_le (hends_sub_bd.trans hbd_sub_FN) _ hFN_fin + omega + have hFbd_eq : F ∩ bd π.S = {n₁, n₂} := by + symm + apply eq_of_subset_of_ncard_le hends_sub_bd _ hbd_fin + have hle := ncard_le_ncard hbd_sub_FN hFN_fin + omega + have hred_63 : π.IsRedundant 𝒯 θ (2 * p + 2) := hred.mono (by omega) + have hθ_63 : (2 * p + 2) + max 3 (2 * p + 2) < θ := by omega + have hFγ_63 : 2 * p ≤ 2 * p + 2 ∧ (F ∩ π.domγ).ncard ≤ (2 * p + 2) - 2 * p := by + refine ⟨by omega, ?_⟩ + have hsub : F ∩ π.domγ ⊆ F ∩ π.Γ.N := inter_subset_inter_right F π.domγ_subset + have hle := (ncard_le_ncard hsub hFN_fin).trans hcard.le + omega + obtain ⟨Δ, hΔ, hF_bd, hbd_sub, hsmall⟩ := + theorem_6_3_proof h𝒯 π htrue.1 hwarp hred_63 hθ_63 hnorm hF hFbd_eq hFγ_63 + obtain ⟨π', hπ'_central, hπ'_res, htruer | ⟨hΔ_N, hΔ_card⟩⟩ := + theorem_7_4_proof h𝒯 π htrue.1 hred hwarp hθ + hnorm hF hFbd_eq hFN_eq hΔ hF_bd hbd_sub hsmall + · exact False.elim (htrue.2.2 π' hπ'_central htruer hπ'_res) + · exact ⟨Δ, hΔ, hF_bd, hbd_sub, hΔ_N, hΔ_card⟩ + +/-- Proof of `GM20.GM17Theorem83Statement` in `GraphMinor/GM20/Cited.lean` (Graph Minors XVII, +(8.3), page 182). -/ +theorem gm17_theorem_8_3 + : + GM20.GM17Theorem83Statement.{u, v} := by + intro α β G 𝒯 θ p π hstand F hL hnorm hFbd hcard + exact theorem_8_3_proof + hstand.isTangle π hstand.isTrue hstand.isRedundant hstand.warp_le hstand.lt + hL hnorm hFbd hcard + +/-! ## 4. Every Node is in $\operatorname{dom}(\gamma)$: (8.4) (Page 182) -/ + +/-- If an internal node $n_0 \in N(\Gamma) \setminus \operatorname{bd}(\Sigma)$ with +$n_0 \notin \operatorname{dom}(\gamma)$ does not belong to $\tilde{c}$ for any cell +$c \in C(\Gamma)$, then removing $n_0$ from $U(\Gamma)$ and $N(\Gamma)$ yields a truer +$\mathcal{T}$-central portrayal of $G$ resembling $\pi$. -/ +private theorem exists_truer_of_isolated_internal_node + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (π : Portrayal G) (hcentral : π.IsCentral 𝒯) + {n₀ : π.S} (hn₀_N : n₀ ∈ π.Γ.N) (hn₀_not_bd : n₀ ∉ bd π.S) + (hn₀_not_dom : n₀ ∉ π.domγ) + (hn₀_no_cell : ∀ c ∈ π.Γ.C, n₀ ∉ tilde c) : + ∃ π' : Portrayal G, π'.IsCentral 𝒯 ∧ π'.Resembles π ∧ π'.IsTruer π := by + classical + have : T2Space π.S := π.isSurface.2.1 + have hn₀_not_cl : ∀ c ∈ π.Γ.C, n₀ ∉ closure c := by + intro c hc hn₀_cl + have hn₀_not_c : n₀ ∉ c := (π.Γ.cell_subset_diff hc · |>.2 hn₀_N) + exact hn₀_no_cell c hc ⟨hn₀_cl, hn₀_not_c⟩ + let U' : Set π.S := π.Γ.U \ {n₀} + let N' : Set π.S := π.Γ.N \ {n₀} + have hU'_eq : U' = N' ∪ ⋃ c ∈ π.Γ.C, closure c := by + ext x + simp only [U', N', mem_sdiff, mem_singleton_iff, mem_union, mem_iUnion] + constructor + · rintro ⟨hxU, hne⟩ + rw [π.Γ.U_eq_N_union_biUnion_closure] at hxU + rcases hxU with hxN | hcl + · exact Or.inl ⟨hxN, hne⟩ + · rw [mem_iUnion₂] at hcl + exact Or.inr hcl + · rintro (⟨hxN, hne⟩ | ⟨c, hc, hxcl⟩) + · exact ⟨π.Γ.N_subset hxN, hne⟩ + · exact ⟨π.Γ.closure_cell_subset_U hc hxcl, fun h => hn₀_not_cl c hc (h ▸ hxcl)⟩ + have hN'_fin : N'.Finite := π.Γ.finite_N.subset sdiff_subset + have hU'_closed : IsClosed U' := by + rw [hU'_eq] + exact hN'_fin.isClosed.union (π.Γ.finite_cells.isClosed_biUnion fun _ _ => isClosed_closure) + have hdiff_eq : U' \ N' = π.Γ.U \ π.Γ.N := by + ext x + simp only [U', N', mem_sdiff, mem_singleton_iff] + exact ⟨fun ⟨⟨hxU, hne⟩, hnotN⟩ => ⟨hxU, fun hxN => hnotN ⟨hxN, hne⟩⟩, + fun ⟨hxU, hxN⟩ => ⟨⟨hxU, fun h => hxN (h ▸ hn₀_N)⟩, fun ⟨h, _⟩ => hxN h⟩⟩ + have hC'_eq : arcComponentsIn (U' \ N') = π.Γ.C := by + rw [hdiff_eq]; rfl + have hN'_bd : N' ∩ bd π.S = π.Γ.N ∩ bd π.S := by + ext x + simp only [N', mem_inter_iff, mem_sdiff, mem_singleton_iff] + exact ⟨fun ⟨⟨hxN, _⟩, hxbd⟩ => ⟨hxN, hxbd⟩, + fun ⟨hxN, hxbd⟩ => ⟨⟨hxN, fun h => hn₀_not_bd (h ▸ hxbd)⟩, hxbd⟩⟩ + let Γ' : Painting π.S := + { U := U' + N := N' + isClosed_U := hU'_closed + finite_N := hN'_fin + N_subset := sdiff_subset_sdiff π.Γ.N_subset Subset.rfl + finite_cells := hC'_eq ▸ π.Γ.finite_cells + cell_disc := fun c hc => π.Γ.cell_disc c (by rwa [hdiff_eq] at hc) + bd_subset := fun x hxbd => ⟨π.Γ.bd_subset hxbd, fun h => hn₀_not_bd (h ▸ hxbd)⟩ + border_cell := fun c hc hbd => π.Γ.border_cell c (by rwa [hdiff_eq] at hc) hbd } + have hΓ'_C : Γ'.C = π.Γ.C := hC'_eq + let π' : Portrayal G := + { S := π.S + top := π.top + isSurface := π.isSurface + connected := π.connected + Γ := Γ' + cellGraph := π.cellGraph + borderSet := π.borderSet + domγ := π.domγ + nodeVertex := π.nodeVertex + cellGraph_le := fun c hc => π.cellGraph_le c (hΓ'_C ▸ hc) + borderSet_subset := fun n hn => π.borderSet_subset n (hN'_bd ▸ hn) + domγ_subset := fun n hn => ⟨π.domγ_subset hn, fun h => hn₀_not_dom (h ▸ hn)⟩ + nodeVertex_mem := π.nodeVertex_mem + nodeVertex_injOn := π.nodeVertex_injOn + p1_vertex := fun v hv => by + obtain ⟨c, hc, hvc⟩ := π.p1_vertex v hv + exact ⟨c, hΓ'_C.symm ▸ hc, hvc⟩ + p1_edge := fun e he => by + obtain ⟨c, hc, hec⟩ := π.p1_edge e he + exact ⟨c, hΓ'_C.symm ▸ hc, hec⟩ + p1_disjoint := fun c₁ hc₁ c₂ hc₂ hne => + π.p1_disjoint c₁ (hΓ'_C ▸ hc₁) c₂ (hΓ'_C ▸ hc₂) hne + p2 := fun c hc n hn => π.p2 c (hΓ'_C ▸ hc) n hn + p3_notMem := fun n hn => π.p3_notMem n ⟨hn.1, hn.2⟩ + p3_subset := fun c hc hbd n hn => π.p3_subset c (hΓ'_C ▸ hc) hbd n hn + p4_disjoint := fun Θ₁ hΘ₁ Θ₂ hΘ₂ hne n₁ hn₁ n₂ hn₂ => + π.p4_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ hne n₁ ⟨hn₁.1.1, hn₁.2⟩ n₂ ⟨hn₂.1.1, hn₂.2⟩ + p4_notMem := fun Θ hΘ n₁ hn₁ n₂ hn₂ hnot => + π.p4_notMem Θ hΘ n₁ ⟨hn₁.1.1, hn₁.2⟩ n₂ hn₂ hnot + p5 := fun c hc hint v hvc ⟨d, hd, hne, hvd⟩ => + π.p5 c (hΓ'_C ▸ hc) hint v hvc ⟨d, hΓ'_C ▸ hd, hne, hvd⟩ + p6 := fun c hc hbd v hvc ⟨d, hd, hne, hvd⟩ => + π.p6 c (hΓ'_C ▸ hc) hbd v hvc ⟨d, hΓ'_C ▸ hd, hne, hvd⟩ + p7 := fun Θ hΘ n₁ hn₁ n₂ hn₂ n₃ hn₃ n₄ hn₄ => + π.p7 Θ hΘ n₁ ⟨hn₁.1.1, hn₁.2⟩ n₂ ⟨hn₂.1.1, hn₂.2⟩ + n₃ ⟨hn₃.1.1, hn₃.2⟩ n₄ ⟨hn₄.1.1, hn₄.2⟩ } + have hπ'_central : π'.IsCentral 𝒯 := fun c hc => hcentral c (hΓ'_C ▸ hc) + have hπ'_res : π'.Resembles π := by + refine ⟨Homeomorph.refl π.S, fun Θ _ => ?_⟩ + rw [Homeomorph.refl_apply, image_id] + change sSup {p | ∃ c ∈ Γ'.C, (c ∩ Θ).Nonempty ∧ p = π'.cellWarp c} = + sSup {p | ∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ p = π.cellWarp c} + have hcw : ∀ c, π'.cellWarp c = π.cellWarp c := fun _ => rfl + simp only [hΓ'_C, hcw] + have hπ'_truer : π'.IsTruer π := by + refine ⟨⟨4, by omega⟩, fun i hi => ?_, ?_⟩ + · have hi4 : i.1 < 4 := hi + simp only [Portrayal.truth, π', hi4, ↓reduceIte, hΓ'_C] + · simp only [Portrayal.truth, π'] + have hssub : N' \ bd π.S ⊂ π.Γ.N \ bd π.S := + ⟨sdiff_subset_sdiff sdiff_subset Subset.rfl, + fun h => (h ⟨hn₀_N, hn₀_not_bd⟩).1.2 rfl⟩ + exact ncard_lt_ncard hssub (π.Γ.finite_N.subset sdiff_subset) + exact ⟨π', hπ'_central, hπ'_res, hπ'_truer⟩ + +/-- **Graph Minors XVII, (8.4)** (page 182): +"$\operatorname{dom}(\gamma) = N(\Gamma)$." -/ +theorem theorem_8_4_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) : + π.domγ = π.Γ.N := by + have : T2Space π.S := π.isSurface.2.1 + refine Subset.antisymm π.domγ_subset fun n hn_N => ?_ + by_contra hn_not_dom + -- If `n ∈ tilde c` for some internal cell `c`, shrinking `c` from `n` by `(5.2)` gives a truer + -- portrayal. + have hno_int : ∀ c ∈ π.Γ.C, n ∈ tilde c → (c ∩ bd π.S).Nonempty := by + intro c hc hn_tc + by_contra hint + obtain ⟨Δ, Γ', hsh, hπ'_central, hπ'_res, hπ'_truer⟩ := + theorem_5_2_proof π ⟨hc, hint⟩ hn_tc (fun hnγ => False.elim (hn_not_dom hnγ)) + exact htrue.2.2 (π.shrinkCell Γ' c n Δ hsh (fun hnγ => False.elim (hn_not_dom hnγ))) + (hπ'_central 𝒯 htrue.1) hπ'_truer hπ'_res + -- Hence `n` must be a border node (otherwise `n` is in no `tilde c`, giving a truer portrayal). + have hn_bd : n ∈ bd π.S := by + by_contra hn_not_bd + have hn_no_cell : ∀ c ∈ π.Γ.C, n ∉ tilde c := by + intro c hc hn_tc + have hbd_c := hno_int c hc hn_tc + obtain ⟨u, w, _, htilde_c, _, _, hu_bd, hw_bd⟩ := π.Γ.border_cell_exists_ends hc hbd_c + rcases (htilde_c ▸ hn_tc : n ∈ ({u, w} : Set π.S)) with rfl | rfl + · exact hn_not_bd hu_bd.2 + · exact hn_not_bd hw_bd.2 + obtain ⟨π', hπ'_central, hπ'_res, hπ'_truer⟩ := + exists_truer_of_isolated_internal_node π htrue.1 hn_N hn_not_bd hn_not_dom hn_no_cell + exact htrue.2.2 π' hπ'_central hπ'_truer hπ'_res + -- Pushing off the two border cells at `n` gives a normal `I`-arc violating `(8.3)`. + obtain ⟨-, -, -, hBdInt, -⟩ := + region_boundary_props h𝒯 π htrue hred hwarp hθ + obtain ⟨F, hL, hnorm, hFbd, hcard, hno_disc⟩ := hBdInt n ⟨hn_N, hn_bd⟩ hno_int + obtain ⟨Δ, hΔ, hF_bd, hbd_sub, hΔ_N, hΔ_card⟩ := + theorem_8_3_proof h𝒯 π htrue hred hwarp hθ hL hnorm hFbd hcard + exact hno_disc Δ hΔ hF_bd hbd_sub ⟨hΔ_N, hΔ_card⟩ + +/-! ## 5. Normal $O$-Arcs with at Most Three Nodes: (8.5) (Page 182) -/ + +/-- **Graph Minors XVII, (8.5)** (page 182): +"For every $\Gamma$-normal $O$-arc $F \subseteq \Sigma$ with $|F \cap N(\Gamma)| \le 3$, there is +a disc $\Delta \subseteq \Sigma$ with $F = \operatorname{bd}(\Delta)$ such that $\alpha(\Delta)$ is +small, and either +(i) $\Delta \cap N(\Gamma) \subseteq F$ and $\Delta$ includes at most one cell of $\Gamma$, or +(ii) $|F \cap N(\Gamma)| = 3$, and $|\tilde{c}| = 2$ for every cell $c \subseteq \Delta$." -/ +theorem theorem_8_5_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {F : Set π.S} (hO : IsOArc F) (hnorm : π.Γ.IsNormal F) + (hcard : (F ∩ π.Γ.N).ncard ≤ 3) : + ∃ Δ : Set π.S, IsClosedDisc Δ ∧ discBd Δ = F ∧ + IsSmallWrt 𝒯 (π.areaGraph Δ) ∧ + ((Δ ∩ π.Γ.N ⊆ F ∧ {c ∈ π.Γ.C | c ⊆ Δ}.ncard ≤ 1) ∨ + ((F ∩ π.Γ.N).ncard = 3 ∧ ∀ c ∈ π.Γ.C, c ⊆ Δ → (tilde c).ncard = 2)) := by + have : T2Space π.S := π.isSurface.2.1 + obtain ⟨_, h82_card, h82_node⟩ := + theorem_8_2_proof h𝒯 π htrue hred hwarp hθ + have hFN_fin : (F ∩ π.Γ.N).Finite := π.Γ.finite_N.inter_of_right F + have hFγ_le : (F ∩ π.domγ).ncard ≤ 2 * p + 3 := by + have hsub : F ∩ π.domγ ⊆ F ∩ π.Γ.N := inter_subset_inter_right F π.domγ_subset + have hle3 : (F ∩ π.domγ).ncard ≤ 3 := (ncard_le_ncard hsub hFN_fin).trans hcard + omega + have hp_pos : 1 ≤ p := π.one_le_warp.trans hwarp + have hθ_64 : (2 * p + 3) + max 3 (2 * p + 2) < θ := by omega + obtain ⟨Δ, hΔ, hbd, hsmall⟩ := + theorem_6_4_proof h𝒯 π htrue.1 hwarp hred hθ_64 hO hnorm hFγ_le + refine ⟨Δ, hΔ, hbd, hsmall, ?_⟩ + have hnorm_bd : discBd Δ ∩ π.Γ.U ⊆ π.Γ.N := hbd ▸ hnorm + obtain ⟨hdich, _, _⟩ := normal_disc_cell_dichotomy π.isSurface π.Γ hΔ hnorm_bd + by_cases hex_c : ({c ∈ π.Γ.C | c ⊆ Δ}).Nonempty + · by_cases hex_ge : ∃ c₀ ∈ π.Γ.C, c₀ ⊆ Δ ∧ (discBd Δ ∩ π.Γ.N).ncard ≤ (tilde c₀).ncard + · -- Apply `(7.2)` (`theorem_7_2_proof`): since `π` is true, `π'` cannot be truer, so (i) holds. + have hcard_bd : (discBd Δ ∩ π.Γ.N).ncard ≤ 3 := hbd.symm ▸ hcard + have hnode_bd : ∀ n ∈ discBd Δ ∩ π.domγ, ∃ d ∈ π.Γ.C, n ∈ tilde d := + fun n hn => h82_node n (π.domγ_subset hn.2) + obtain ⟨π', _, hπ'_central, hπ'_res, h72⟩ := + theorem_7_2_proof h𝒯 (by omega) π htrue.1 hΔ hnorm_bd hcard_bd hnode_bd hsmall + rcases h72 hex_ge with htruer | ⟨hΔ_N, c₀, _, hset_eq⟩ + · exact False.elim (htrue.2.2 π' hπ'_central htruer hπ'_res) + · left + refine ⟨hbd ▸ hΔ_N, ?_⟩ + rw [hset_eq, ncard_singleton] + · -- Every cell `c ⊆ Δ` has `2 ≤ (tilde c).ncard < (F ∩ π.Γ.N).ncard ≤ 3`, so (ii) holds. + right + push Not at hex_ge + rcases hex_c with ⟨c₁, hc₁_C, hc₁_Δ⟩ + have h2_c₁ : 2 ≤ (tilde c₁).ncard := h82_card c₁ hc₁_C + have hlt_c₁ : (tilde c₁).ncard < (F ∩ π.Γ.N).ncard := hbd ▸ hex_ge c₁ hc₁_C hc₁_Δ + have hFN_eq3 : (F ∩ π.Γ.N).ncard = 3 := by omega + refine ⟨hFN_eq3, fun c hc_C hc_Δ => ?_⟩ + have h2_c : 2 ≤ (tilde c).ncard := h82_card c hc_C + have hlt_c : (tilde c).ncard < (F ∩ π.Γ.N).ncard := hbd ▸ hex_ge c hc_C hc_Δ + omega + · -- When `{c ∈ π.Γ.C | c ⊆ Δ} = ∅`, (i) holds by `(8.2)`. + left + have hempty : {c ∈ π.Γ.C | c ⊆ Δ} = ∅ := not_nonempty_iff_eq_empty.mp hex_c + refine ⟨fun n ⟨hnΔ, hnN⟩ => ?_, by rw [hempty, ncard_empty]; omega⟩ + obtain ⟨c, hc_C, hn_tc⟩ := h82_node n hnN + have hc_out : c ⊆ Set.univ \ Δ := by + rcases hdich c hc_C with hc_in | hc_out + · exact False.elim (hex_c ⟨c, hc_C, hc_in.trans sdiff_subset⟩) + · exact hc_out + have hcl_inter := + (closure_cell_inter_disc_of_subset_compl π.isSurface π.Γ hΔ hnorm_bd hc_C hc_out).2 + have hn_mem : n ∈ closure c ∩ Δ := ⟨hn_tc.1, hnΔ⟩ + rw [hcl_inter] at hn_mem + exact hbd ▸ hn_mem.2 + +/-- Proof of `GM20.GM17Theorem85Statement` in `GraphMinor/GM20/Cited.lean` +(Graph Minors XVII, (8.5), page 182). -/ +theorem gm17_theorem_8_5 + : + GM20.GM17Theorem85Statement.{u, v} := by + intro α β G 𝒯 θ p π hstand F hO hnorm hcard + obtain ⟨Δ, hΔ, hbd, ⟨B, hAB⟩, hdisj_cases⟩ := + theorem_8_5_proof + hstand.isTangle π hstand.isTrue hstand.isRedundant hstand.warp_le hstand.lt + hO hnorm hcard + have hsub : {c ∈ π.Γ.C | c ⊆ Δ} ⊆ π.Γ.C := fun _ hc => hc.1 + refine ⟨Δ, hΔ, hbd, ⟨π.areaGraph Δ, B, hAB, ?_, ?_⟩, hdisj_cases⟩ + · change (⋃ c ∈ {c ∈ π.Γ.C | c ⊆ Δ} ∩ π.Γ.C, (π.cellGraph c).vertexSet) = + ⋃ c ∈ {c ∈ π.Γ.C | c ⊆ Δ}, (π.cellGraph c).vertexSet + rw [inter_eq_left.mpr hsub] + · change (⋃ c ∈ {c ∈ π.Γ.C | c ⊆ Δ} ∩ π.Γ.C, (π.cellGraph c).edgeSet) = + ⋃ c ∈ {c ∈ π.Γ.C | c ⊆ Δ}, (π.cellGraph c).edgeSet + rw [inter_eq_left.mpr hsub] + +/-! ## 6. Internal Cells Meeting the Boundary: (8.6) (Page 182) -/ + +/-- **Graph Minors XVII, (8.6)** (page 182): +"If $c$ is an internal cell, then $|\bar{c} \cap \operatorname{bd}(\Sigma)| \le 2$, and if equality +holds then $|\tilde{c}| = 3$ and the two members of $\bar{c} \cap \operatorname{bd}(\Sigma)$ are +consecutive." -/ +theorem theorem_8_6_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {c : Set π.S} (hc : c ∈ π.Γ.C) (hint : ¬ (c ∩ bd π.S).Nonempty) : + (closure c ∩ bd π.S).ncard ≤ 2 ∧ + ((closure c ∩ bd π.S).ncard = 2 → + (tilde c).ncard = 3 ∧ + ∀ n₁ ∈ closure c ∩ bd π.S, ∀ n₂ ∈ closure c ∩ bd π.S, n₁ ≠ n₂ → + ∃ c₀ ∈ π.Γ.C, (c₀ ∩ bd π.S).Nonempty ∧ tilde c₀ = {n₁, n₂}) := by + have : T2Space π.S := π.isSurface.2.1 + obtain ⟨-, h82_card, -, -, hIntArcs, -⟩ := + region_boundary_props h𝒯 π htrue hred hwarp hθ + obtain ⟨hI_pair, hI_viol⟩ := hIntArcs c hc hint + -- First show `¬ (tilde c ⊆ bd π.S)`, since otherwise pushing off `c` violates `(8.3)`. + have hnot_sub_bd : ¬ (tilde c ⊆ bd π.S) := by + intro hsub_bd + obtain ⟨F, hL, hnorm, hFbd, hcard, hno_disc⟩ := hI_viol hsub_bd + obtain ⟨Δ, hΔ, hF_bd, hbd_sub, hΔ_N, hΔ_card⟩ := + theorem_8_3_proof h𝒯 π htrue hred hwarp hθ hL hnorm hFbd hcard + exact hno_disc Δ hΔ hF_bd hbd_sub ⟨hΔ_N, hΔ_card⟩ + have hcl_eq : closure c ∩ bd π.S = tilde c ∩ bd π.S := + Painting.closure_cell_inter_bd_eq_tilde_inter_bd hint + have hcl_sub_tc : closure c ∩ bd π.S ⊆ tilde c := by + rw [hcl_eq]; exact inter_subset_left + have htc_fin : (tilde c).Finite := π.Γ.finite_tilde_cell hc + have htc_le3 : (tilde c).ncard ≤ 3 := π.Γ.ncard_tilde_cell_le hc + have htc_ge2 : 2 ≤ (tilde c).ncard := h82_card c hc + have hcl_le_tc : (closure c ∩ bd π.S).ncard ≤ (tilde c).ncard := + ncard_le_ncard hcl_sub_tc htc_fin + have hcl_lt_tc : (closure c ∩ bd π.S).ncard < (tilde c).ncard := by + by_contra hge + have heq : closure c ∩ bd π.S = tilde c := + eq_of_subset_of_ncard_le hcl_sub_tc (not_lt.mp hge) htc_fin + exact hnot_sub_bd (heq ▸ inter_subset_right) + refine ⟨by omega, fun hcl_eq2 => ⟨by omega, fun n₁ hn₁ n₂ hn₂ hne => ?_⟩⟩ + obtain ⟨F, hF_ends, hnorm, hFbd_ends, hFbd, hFN, hΔ_bd_ne⟩ := hI_pair n₁ hn₁ n₂ hn₂ hne + have hL : IsLine F := by rcases hF_ends with ⟨f, _, _⟩; exact ⟨f⟩ + have hcard : (F ∩ π.Γ.N).ncard = 2 := by + rw [hFN, ncard_pair hne] + obtain ⟨Δ, hΔ, hF_bd, hbd_sub, hΔ_N, _⟩ := + theorem_8_3_proof h𝒯 π htrue hred hwarp hθ + hL hnorm hFbd_ends hcard + obtain ⟨⟨x, hx_Δ, hx_bd, hx_ne_pair⟩, hΔ_dich⟩ := hΔ_bd_ne Δ hΔ hF_bd hbd_sub + have hx_not_N : x ∉ π.Γ.N := by + intro hx_N + have hx_FN : x ∈ F ∩ π.Γ.N := ⟨hΔ_N ⟨hx_Δ, hx_N⟩, hx_N⟩ + rw [hFN] at hx_FN + exact hx_ne_pair hx_FN + have hx_U : x ∈ π.Γ.U := π.Γ.bd_subset hx_bd + have hx_diff : x ∈ π.Γ.U \ π.Γ.N := ⟨hx_U, hx_not_N⟩ + rw [← π.Γ.sUnion_cells] at hx_diff + rcases mem_sUnion.mp hx_diff with ⟨c₀, hc₀_C, hx_c₀⟩ + have hc₀_bd : (c₀ ∩ bd π.S).Nonempty := ⟨x, hx_c₀, hx_bd⟩ + have hc₀_Δ : c₀ ⊆ Δ := hΔ_dich c₀ hc₀_C ⟨x, hx_c₀, hx_Δ⟩ + refine ⟨c₀, hc₀_C, hc₀_bd, ?_⟩ + have : T2Space π.S := π.isSurface.2.1 + have htc₀_sub : tilde c₀ ⊆ {n₁, n₂} := by + intro x hx_tc₀ + have hx_Δ : x ∈ Δ := (isClosed_of_isClosedDisc hΔ).closure_subset_iff.mpr hc₀_Δ hx_tc₀.1 + have hx_N : x ∈ π.Γ.N := π.Γ.tilde_subset_N hc₀_C hx_tc₀ + have hx_F : x ∈ F := hΔ_N ⟨hx_Δ, hx_N⟩ + have hx_FN : x ∈ F ∩ π.Γ.N := ⟨hx_F, hx_N⟩ + rwa [hFN] at hx_FN + obtain ⟨u, w, huw_ne, htilde_c₀, _, _, _, _⟩ := π.Γ.border_cell_exists_ends hc₀_C hc₀_bd + have htc₀_card : (tilde c₀).ncard = 2 := by rw [htilde_c₀, ncard_pair huw_ne] + have hpair_card : ({n₁, n₂} : Set π.S).ncard = 2 := ncard_pair hne + exact eq_of_subset_of_ncard_le htc₀_sub (by omega) (by simp) + +/-! ## 7. Inclusion of $\tilde{c}_1 \subseteq \tilde{c}_2$ for Distinct Cells: (8.8) (Page 183) -/ + +/-- Removing an internal cell $c_1 \in C(\Gamma)$ from $U(\Gamma)$ produces a painting +$\Gamma' = (U(\Gamma) \setminus c_1, N(\Gamma))$ with $C(\Gamma') = C(\Gamma) \setminus \{c_1\}$. +Graph Minors XVII, proof of (8.8) (page 183). -/ +private noncomputable def Painting.removeInternalCell {S : Type} [TopologicalSpace S] [T2Space S] + (Γ : Painting S) {c₁ : Set S} (hc₁ : c₁ ∈ Γ.C) (hint₁ : ¬ (c₁ ∩ bd S).Nonempty) : + Painting S := by + classical + let U' : Set S := Γ.U \ c₁ + let I : Set (Set S) := Γ.C \ {c₁} + have hI_fin : I.Finite := Γ.finite_cells.subset sdiff_subset + have hcl_sub : ∀ c ∈ I, closure c ⊆ U' := by + rintro c ⟨hc, hne⟩ x hxcl + refine ⟨Γ.closure_cell_subset_U hc hxcl, fun hxc₁ => ?_⟩ + by_cases hxc : x ∈ c + · exact Set.disjoint_left.mp (Γ.cell_disjoint hc hc₁ hne) hxc hxc₁ + · have hx_tc : x ∈ tilde c := ⟨hxcl, hxc⟩ + exact (Γ.cell_subset_diff hc₁ hxc₁).2 (Γ.tilde_subset_N hc hx_tc) + have hU'_eq : U' = Γ.N ∪ ⋃ c ∈ I, closure c := by + ext x + simp only [U', I, mem_sdiff, mem_union, mem_iUnion] + constructor + · rintro ⟨hxU, hx_not_c₁⟩ + rw [Γ.U_eq_N_union_biUnion_closure] at hxU + rcases hxU with hxN | hcl + · exact Or.inl hxN + · rw [mem_iUnion₂] at hcl + rcases hcl with ⟨c, hc, hxcl⟩ + by_cases hcc₁ : c = c₁ + · subst hcc₁ + exact Or.inl (Γ.tilde_subset_N hc₁ ⟨hxcl, hx_not_c₁⟩) + · exact Or.inr ⟨c, ⟨hc, hcc₁⟩, hxcl⟩ + · rintro (hxN | ⟨c, hcI, hxcl⟩) + · exact ⟨Γ.N_subset hxN, fun hxc₁ => (Γ.cell_subset_diff hc₁ hxc₁).2 hxN⟩ + · exact hcl_sub c hcI hxcl + have hU'_closed : IsClosed U' := by + rw [hU'_eq] + exact Γ.finite_N.isClosed.union (hI_fin.isClosed_biUnion fun _ _ => isClosed_closure) + have hcov : ⋃₀ I = U' \ Γ.N := by + ext x + constructor + · rintro ⟨c, ⟨hc, hne⟩, hxc⟩ + exact ⟨⟨Γ.cell_subset_U hc hxc, + Set.disjoint_left.mp (Γ.cell_disjoint hc hc₁ hne) hxc⟩, + (Γ.cell_subset_diff hc hxc).2⟩ + · rintro ⟨⟨hxU, hx_not_c₁⟩, hx_not_N⟩ + have hx_cells : x ∈ ⋃₀ Γ.C := Γ.sUnion_cells.symm ▸ ⟨hxU, hx_not_N⟩ + rcases hx_cells with ⟨c, hc, hxc⟩ + have hne : c ≠ c₁ := fun h => hx_not_c₁ (h ▸ hxc) + exact ⟨c, ⟨hc, hne⟩, hxc⟩ + have hC'_eq : arcComponentsIn (U' \ Γ.N) = I := by + apply arcComponentsIn_eq_of_finite_cover hI_fin hcov + · exact fun c hcI => Γ.cell_nonempty hcI.1 + · exact fun c hcI => Γ.cell_isPathConnected hcI.1 + · exact fun c hc c' hc' hne => Γ.cell_disjoint hc.1 hc'.1 hne + · intro c hcI + refine Subset.antisymm ?_ (fun x hxc => ⟨subset_closure hxc, hcov ▸ ⟨c, hcI, hxc⟩⟩) + rintro x ⟨hxcl, _, hx_not_N⟩ + rw [← Γ.closure_cell_diff_N hcI.1] + exact ⟨hxcl, hx_not_N⟩ + exact + { U := U' + N := Γ.N + isClosed_U := hU'_closed + finite_N := Γ.finite_N + N_subset := fun x hxN => ⟨Γ.N_subset hxN, fun hxc₁ => (Γ.cell_subset_diff hc₁ hxc₁).2 hxN⟩ + finite_cells := hC'_eq ▸ hI_fin + cell_disc := fun c hc => Γ.cell_disc c ((hC'_eq ▸ hc).1) + bd_subset := fun x hxbd => ⟨Γ.bd_subset hxbd, fun hxc₁ => hint₁ ⟨x, hxc₁, hxbd⟩⟩ + border_cell := fun c hc hbd => Γ.border_cell c ((hC'_eq ▸ hc).1) hbd } + +private theorem Painting.removeInternalCell_C {S : Type} [TopologicalSpace S] [T2Space S] + (Γ : Painting S) {c₁ : Set S} (hc₁ : c₁ ∈ Γ.C) (hint₁ : ¬ (c₁ ∩ bd S).Nonempty) : + (Γ.removeInternalCell hc₁ hint₁).C = Γ.C \ {c₁} := by + classical + let U' : Set S := Γ.U \ c₁ + let I : Set (Set S) := Γ.C \ {c₁} + have hI_fin : I.Finite := Γ.finite_cells.subset sdiff_subset + have hcov : ⋃₀ I = U' \ Γ.N := by + ext x + constructor + · rintro ⟨c, ⟨hc, hne⟩, hxc⟩ + exact ⟨⟨Γ.cell_subset_U hc hxc, + Set.disjoint_left.mp (Γ.cell_disjoint hc hc₁ hne) hxc⟩, + (Γ.cell_subset_diff hc hxc).2⟩ + · rintro ⟨⟨hxU, hx_not_c₁⟩, hx_not_N⟩ + have hx_cells : x ∈ ⋃₀ Γ.C := Γ.sUnion_cells.symm ▸ ⟨hxU, hx_not_N⟩ + rcases hx_cells with ⟨c, hc, hxc⟩ + have hne : c ≠ c₁ := fun h => hx_not_c₁ (h ▸ hxc) + exact ⟨c, ⟨hc, hne⟩, hxc⟩ + apply arcComponentsIn_eq_of_finite_cover hI_fin hcov + · exact fun c hcI => Γ.cell_nonempty hcI.1 + · exact fun c hcI => Γ.cell_isPathConnected hcI.1 + · exact fun c hc c' hc' hne => Γ.cell_disjoint hc.1 hc'.1 hne + · intro c hcI + refine Subset.antisymm ?_ (fun x hxc => ⟨subset_closure hxc, hcov ▸ ⟨c, hcI, hxc⟩⟩) + rintro x ⟨hxcl, _, hx_not_N⟩ + rw [← Γ.closure_cell_diff_N hcI.1] + exact ⟨hxcl, hx_not_N⟩ + +private theorem removing_internal_cell_makes_portrayal_truer + {α : Type u} {β : Type v} {G : Hypergraph α β} {π π' : Portrayal G} + {c₁ : Set π.S} (hc₁ : c₁ ∈ π.Γ.C) (hint₁ : ¬ (c₁ ∩ bd π.S).Nonempty) + (htruth : ∀ i : Fin 6, i.val < 4 → + π'.truth i = {c ∈ π.Γ.C \ {c₁} | + ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - i.val}.ncard) : + π'.IsTruer π := by + have hcard_le3 : (tilde c₁).ncard ≤ 3 := π.Γ.ncard_tilde_cell_le hc₁ + let k₀ : Fin 6 := ⟨3 - (tilde c₁).ncard, by omega⟩ + have hk₀_lt4 : k₀.1 < 4 := by dsimp [k₀]; omega + refine ⟨k₀, fun i hi => ?_, ?_⟩ + · have hi_lt : i.1 < 3 - (tilde c₁).ncard := hi + have hi4 : i.1 < 4 := by omega + rw [htruth i hi4] + simp only [Portrayal.truth, hi4, ↓reduceIte] + congr 1; ext d + simp only [mem_sep_iff, mem_sdiff, mem_singleton_iff] + exact ⟨fun ⟨⟨hd, _⟩, h⟩ => ⟨hd, h⟩, + fun ⟨hd, hint_d, hcard_d⟩ => ⟨⟨hd, fun hEq => by subst hEq; omega⟩, hint_d, hcard_d⟩⟩ + · rw [htruth k₀ hk₀_lt4] + simp only [Portrayal.truth, hk₀_lt4, ↓reduceIte] + have hssub : {c ∈ π.Γ.C \ {c₁} | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - k₀.1} ⊂ + {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - k₀.1} := by + refine ⟨fun d hd => ⟨hd.1.1, hd.2⟩, fun h => ?_⟩ + have hc₁_mem : c₁ ∈ {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - k₀.1} := + ⟨hc₁, hint₁, by dsimp [k₀]; omega⟩ + exact (h hc₁_mem).1.2 rfl + exact ncard_lt_ncard hssub (π.Γ.finite_cells.subset fun _ h => h.1) + +/-- If $c_1, c_2 \in C(\Gamma)$ are distinct internal cells with $\tilde{c}_1 \subseteq +\tilde{c}_2$, +merging $\alpha(c_1)$ into $\alpha(c_2)$ on the painting $\Gamma' = (U(\Gamma) \setminus c_1, +N(\Gamma))$ +produces a $\mathcal{T}$-central portrayal $\pi'$ of $G$ resembling $\pi$ and truer than $\pi$. +Graph Minors XVII, proof of (8.8) (page 183). -/ +private theorem exists_truer_of_internal_tilde_subset + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (hθ : 3 < θ) + (π : Portrayal G) (hcentral : π.IsCentral 𝒯) + {c₁ c₂ : Set π.S} (hc₁ : c₁ ∈ π.Γ.C) (hc₂ : c₂ ∈ π.Γ.C) (hne₁₂ : c₁ ≠ c₂) + (hint₁ : ¬ (c₁ ∩ bd π.S).Nonempty) (hint₂ : ¬ (c₂ ∩ bd π.S).Nonempty) + (htilde_sub : tilde c₁ ⊆ tilde c₂) : + ∃ π' : Portrayal G, π'.IsCentral 𝒯 ∧ π'.Resembles π ∧ π'.IsTruer π := by + classical + have : T2Space π.S := π.isSurface.2.1 + let Γ' : Painting π.S := π.Γ.removeInternalCell hc₁ hint₁ + have hC' : Γ'.C = π.Γ.C \ {c₁} := π.Γ.removeInternalCell_C hc₁ hint₁ + have hc₂_C' : c₂ ∈ Γ'.C := hC'.symm ▸ ⟨hc₂, hne₁₂.symm⟩ + let cellG : Set π.S → Hypergraph α β := fun c => + if c = c₂ then π.cellGraph c₁ ∪ π.cellGraph c₂ else π.cellGraph c + have hcellG_le : ∀ c ∈ Γ'.C, cellG c ≤ G := by + intro c hc + dsimp only [cellG] + split_ifs with hcc₂ + · exact union_le (π.cellGraph_le c₁ hc₁) (π.cellGraph_le c₂ hc₂) + · exact π.cellGraph_le c (hC' ▸ hc).1 + let π' : Portrayal G := + { S := π.S + top := π.top + isSurface := π.isSurface + connected := π.connected + Γ := Γ' + cellGraph := cellG + borderSet := π.borderSet + domγ := π.domγ + nodeVertex := π.nodeVertex + cellGraph_le := hcellG_le + borderSet_subset := π.borderSet_subset + domγ_subset := π.domγ_subset + nodeVertex_mem := π.nodeVertex_mem + nodeVertex_injOn := π.nodeVertex_injOn + p1_vertex := fun v hv => by + obtain ⟨c, hc, hvc⟩ := π.p1_vertex v hv + by_cases hcc₁ : c = c₁ + · subst hcc₁ + refine ⟨c₂, hc₂_C', ?_⟩ + dsimp only [cellG] + rw [ite_eq_left rfl] + exact Or.inl hvc + · refine ⟨c, hC'.symm ▸ ⟨hc, hcc₁⟩, ?_⟩ + dsimp only [cellG] + split_ifs with hcc₂ + · subst hcc₂; exact Or.inr hvc + · exact hvc + p1_edge := fun e he => by + obtain ⟨c, hc, hec⟩ := π.p1_edge e he + by_cases hcc₁ : c = c₁ + · subst hcc₁ + refine ⟨c₂, hc₂_C', ?_⟩ + dsimp only [cellG] + rw [ite_eq_left rfl] + exact Or.inl hec + · refine ⟨c, hC'.symm ▸ ⟨hc, hcc₁⟩, ?_⟩ + dsimp only [cellG] + split_ifs with hcc₂ + · subst hcc₂; exact Or.inr hec + · exact hec + p1_disjoint := fun d₁ hd₁ d₂ hd₂ hne => by + have hd₁_C : d₁ ∈ π.Γ.C \ {c₁} := hC' ▸ hd₁ + have hd₂_C : d₂ ∈ π.Γ.C \ {c₁} := hC' ▸ hd₂ + dsimp only [cellG] + by_cases h1 : d₁ = c₂ <;> by_cases h2 : d₂ = c₂ + · exact False.elim (hne (h1.trans h2.symm)) + · rw [ite_eq_left h1, ite_eq_right h2] + exact (π.p1_disjoint c₁ hc₁ d₂ hd₂_C.1 (Ne.symm hd₂_C.2)).union_left + (π.p1_disjoint c₂ hc₂ d₂ hd₂_C.1 (h1 ▸ hne)) + · rw [ite_eq_right h1, ite_eq_left h2] + exact (π.p1_disjoint d₁ hd₁_C.1 c₁ hc₁ hd₁_C.2).union_right + (π.p1_disjoint d₁ hd₁_C.1 c₂ hc₂ (h2 ▸ hne)) + · rw [ite_eq_right h1, ite_eq_right h2] + exact π.p1_disjoint d₁ hd₁_C.1 d₂ hd₂_C.1 hne + p2 := fun c hc n hn => by + have hc_C : c ∈ π.Γ.C := (hC' ▸ hc).1 + dsimp only [cellG] + split_ifs with hcc₂ + · exact Or.inr (π.p2 c₂ hc₂ n (hcc₂ ▸ hn)) + · exact π.p2 c hc_C n hn + p3_notMem := π.p3_notMem + p3_subset := fun c hc hbd n hn => by + have hc_C : c ∈ π.Γ.C := (hC' ▸ hc).1 + have hne_c₂ : c ≠ c₂ := fun h => hint₂ (h ▸ hbd) + dsimp only [cellG] + rw [ite_eq_right hne_c₂] + exact π.p3_subset c hc_C hbd n hn + p4_disjoint := π.p4_disjoint + p4_notMem := π.p4_notMem + p5 := fun c hc hint v hvc ⟨d, hd, hne, hvd⟩ => by + have hc_C : c ∈ π.Γ.C \ {c₁} := hC' ▸ hc + have hd_C : d ∈ π.Γ.C \ {c₁} := hC' ▸ hd + have hc_ne₁ : c₁ ≠ c := fun h => hc_C.2 (Set.mem_singleton_iff.mpr h.symm) + have hd_ne₁ : d ≠ c₁ := fun h => hd_C.2 (Set.mem_singleton_iff.mpr h) + dsimp only [cellG] at hvc hvd + by_cases hcc₂ : c = c₂ + · rw [ite_eq_left hcc₂] at hvc + have hdc₂ : d ≠ c₂ := hcc₂ ▸ hne + rw [ite_eq_right hdc₂] at hvd + rw [hcc₂] + rcases hvc with hvc₁ | hvc₂ + · obtain ⟨n, ⟨hn_tc₁, hn_dom⟩, rfl⟩ := + π.p5 c₁ hc₁ hint₁ v hvc₁ ⟨d, hd_C.1, hd_ne₁, hvd⟩ + exact ⟨n, ⟨htilde_sub hn_tc₁, hn_dom⟩, rfl⟩ + · exact π.p5 c₂ hc₂ hint₂ v hvc₂ ⟨d, hd_C.1, hdc₂, hvd⟩ + · rw [ite_eq_right hcc₂] at hvc + split_ifs at hvd with hdc₂ + · rcases hvd with hvc₁ | hvc₂ + · exact π.p5 c hc_C.1 hint v hvc ⟨c₁, hc₁, hc_ne₁, hvc₁⟩ + · exact π.p5 c hc_C.1 hint v hvc ⟨c₂, hc₂, Ne.symm hcc₂, hvc₂⟩ + · exact π.p5 c hc_C.1 hint v hvc ⟨d, hd_C.1, hne, hvd⟩ + p6 := fun c hc hbd v hvc ⟨d, hd, hne, hvd⟩ => by + have hc_C : c ∈ π.Γ.C \ {c₁} := hC' ▸ hc + have hd_C : d ∈ π.Γ.C \ {c₁} := hC' ▸ hd + have hc_ne₁ : c₁ ≠ c := fun h => hc_C.2 (Set.mem_singleton_iff.mpr h.symm) + have hcc₂ : c ≠ c₂ := fun h => hint₂ (h ▸ hbd) + dsimp only [cellG] at hvc hvd + rw [ite_eq_right hcc₂] at hvc + split_ifs at hvd with hdc₂ + · rcases hvd with hvc₁ | hvc₂ + · exact π.p6 c hc_C.1 hbd v hvc ⟨c₁, hc₁, hc_ne₁, hvc₁⟩ + · exact π.p6 c hc_C.1 hbd v hvc ⟨c₂, hc₂, Ne.symm hcc₂, hvc₂⟩ + · exact π.p6 c hc_C.1 hbd v hvc ⟨d, hd_C.1, hne, hvd⟩ + p7 := π.p7 } + have hπ'_central : π'.IsCentral 𝒯 := by + intro c hc + have hc_C : c ∈ π.Γ.C := (hC' ▸ hc).1 + change IsSmallWrt 𝒯 (cellG c) + dsimp only [cellG] + split_ifs with hcc₂ + · have hatt_sub : attachments G (π.cellGraph c₁ ∪ π.cellGraph c₂) ⊆ + π.nodeVertex '' (tilde c₂ ∩ π.domγ) := by + rintro v ⟨hv_union, e, ⟨heG, he_not⟩, hinc⟩ + obtain ⟨d, hd_C, hed⟩ := π.p1_edge e heG + have hd_ne₁ : d ≠ c₁ := fun h => he_not (Or.inl (h ▸ hed)) + have hd_ne₂ : d ≠ c₂ := fun h => he_not (Or.inr (h ▸ hed)) + have hvd : v ∈ (π.cellGraph d).vertexSet := by + have hends := (π.cellGraph_le d hd_C).3 e hed + exact (π.cellGraph d).vertex_mem_of_inc + (by change v ∈ (π.cellGraph d).ends e; rw [← hends]; exact hinc) + rcases hv_union with hvc₁ | hvc₂ + · obtain ⟨n, ⟨hn_tc₁, hn_dom⟩, rfl⟩ := + π.p5 c₁ hc₁ hint₁ v hvc₁ ⟨d, hd_C, hd_ne₁, hvd⟩ + exact ⟨n, ⟨htilde_sub hn_tc₁, hn_dom⟩, rfl⟩ + · exact π.p5 c₂ hc₂ hint₂ v hvc₂ ⟨d, hd_C, hd_ne₂, hvd⟩ + have hfin_tc₂ : (tilde c₂).Finite := π.Γ.finite_tilde_cell hc₂ + have hfin_dom : (tilde c₂ ∩ π.domγ).Finite := hfin_tc₂.inter_of_left _ + have hatt_lt : (attachments G (π.cellGraph c₁ ∪ π.cellGraph c₂)).ncard < θ := by + have hle1 := ncard_le_ncard hatt_sub (hfin_dom.image π.nodeVertex) + have hle2 := ncard_image_le (f := π.nodeVertex) hfin_dom + have hle3 : (tilde c₂ ∩ π.domγ).ncard ≤ (tilde c₂).ncard := + ncard_le_ncard inter_subset_left hfin_tc₂ + have hle4 : (tilde c₂).ncard ≤ 3 := π.Γ.ncard_tilde_cell_le hc₂ + omega + exact IsSmallWrt.union h𝒯 (hcentral c₁ hc₁) (hcentral c₂ hc₂) hatt_lt + · exact hcentral c hc_C + have hπ'_res : π'.Resembles π := by + refine ⟨Homeomorph.refl π.S, fun Θ hΘ => ?_⟩ + rw [Homeomorph.refl_apply, image_id] + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hcw_eq : ∀ c ∈ π.Γ.C, (c ∩ Θ).Nonempty → π'.cellWarp c = π.cellWarp c := by + intro c _ hcΘ + have hbd_c : (c ∩ bd π.S).Nonempty := hcΘ.mono (inter_subset_inter_right _ hΘ_bd) + have hcc₂ : c ≠ c₂ := fun h => hint₂ (h ▸ hbd_c) + change sInf {q | π'.CellWarpLE c q} = sInf {q | π.CellWarpLE c q} + congr 1; ext q + change (∀ n₁ ∈ tilde c, ∀ n₂ ∈ tilde c, n₁ ≠ n₂ → + (π.borderSet n₁).ncard ≤ q ∧ (π.borderSet n₂).ncard ≤ q ∧ + ((π.borderPlus n₁).ncard = q + 1 → (π.borderPlus n₂).ncard = q + 1 → + Portrayal.LinkagePairs (cellG c).skeleton (π.borderPlus n₁) (π.borderPlus n₂) + (q + 1) (π.nodeVertex n₁) (π.nodeVertex n₂))) ↔ _ + dsimp only [cellG] + rw [ite_eq_right hcc₂] + rfl + change sSup {p | ∃ c ∈ Γ'.C, (c ∩ Θ).Nonempty ∧ p = π'.cellWarp c} = + sSup {p | ∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ p = π.cellWarp c} + congr 1; ext q + constructor + · rintro ⟨c, hc', hcΘ, rfl⟩ + have hc_C : c ∈ π.Γ.C := (hC' ▸ hc').1 + exact ⟨c, hc_C, hcΘ, hcw_eq c hc_C hcΘ⟩ + · rintro ⟨c, hc_C, hcΘ, rfl⟩ + have hbd_c : (c ∩ bd π.S).Nonempty := hcΘ.mono (inter_subset_inter_right _ hΘ_bd) + have hcc₁ : c ≠ c₁ := fun h => hint₁ (h ▸ hbd_c) + exact ⟨c, hC'.symm ▸ ⟨hc_C, hcc₁⟩, hcΘ, (hcw_eq c hc_C hcΘ).symm⟩ + have hmerged_truer : π'.IsTruer π := by + refine removing_internal_cell_makes_portrayal_truer hc₁ hint₁ ?_ + intro i hi + simp only [Portrayal.truth, π', hi, ↓reduceIte, hC'] + exact ⟨π', hπ'_central, hπ'_res, hmerged_truer⟩ + +/-- **Graph Minors XVII, (8.8)** (page 183): +"If $c_1, c_2$ are distinct cells with $\tilde{c}_1 \subseteq \tilde{c}_2$, then $c_1$ is a +border cell, and $|\tilde{c}_2| = 3$." -/ +theorem theorem_8_8_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {c₁ c₂ : Set π.S} (hc₁ : c₁ ∈ π.Γ.C) (hc₂ : c₂ ∈ π.Γ.C) (hne : c₁ ≠ c₂) + (htilde_sub : tilde c₁ ⊆ tilde c₂) : + (c₁ ∩ bd π.S).Nonempty ∧ (tilde c₂).ncard = 3 := by + have : T2Space π.S := π.isSurface.2.1 + obtain ⟨-, h82_card, -, -, -, hBdInj, -⟩ := + region_boundary_props h𝒯 π htrue hred hwarp hθ + -- First show `c₁` is a border cell. + have hbd₁ : (c₁ ∩ bd π.S).Nonempty := by + by_contra hint₁ + -- If `c₂` is a border cell, `tilde c₁ = tilde c₂ ⊆ bd π.S` and `(tilde c₁).ncard = 2`, + -- violating `(8.6)`. + have hint₂ : ¬ (c₂ ∩ bd π.S).Nonempty := by + intro hbd₂ + obtain ⟨u, w, huw_ne, htilde_c₂, _, _, hu_bd, hw_bd⟩ := + π.Γ.border_cell_exists_ends hc₂ hbd₂ + have hcard₂ : (tilde c₂).ncard = 2 := by rw [htilde_c₂, ncard_pair huw_ne] + have hcard₁_ge2 : 2 ≤ (tilde c₁).ncard := h82_card c₁ hc₁ + have htc₁_eq : tilde c₁ = tilde c₂ := + eq_of_subset_of_ncard_le htilde_sub (by omega) (π.Γ.finite_tilde_cell hc₂) + have htc₁_bd : tilde c₁ ⊆ bd π.S := by + rw [htc₁_eq, htilde_c₂] + rintro x (rfl | rfl) <;> [exact hu_bd.2; exact hw_bd.2] + have hcl₁_bd : closure c₁ ∩ bd π.S = tilde c₁ := by + rw [Painting.closure_cell_inter_bd_eq_tilde_inter_bd hint₁] + exact inter_eq_left.mpr htc₁_bd + have hcl₁_card : (closure c₁ ∩ bd π.S).ncard = 2 := by + rw [hcl₁_bd, htc₁_eq, hcard₂] + have h86 := (theorem_8_6_proof + h𝒯 π htrue hred hwarp hθ hc₁ hint₁).2 hcl₁_card + have hcard₁_eq3 : (tilde c₁).ncard = 3 := h86.1 + rw [htc₁_eq, hcard₂] at hcard₁_eq3 + omega + -- Both `c₁` and `c₂` are internal cells, so merging `c₁` into `c₂` gives a truer portrayal. + obtain ⟨π', hπ'_central, hπ'_res, hπ'_truer⟩ := + exists_truer_of_internal_tilde_subset h𝒯 (by omega) π htrue.1 hc₁ hc₂ hne hint₁ hint₂ + htilde_sub + exact htrue.2.2 π' hπ'_central hπ'_truer hπ'_res + refine ⟨hbd₁, ?_⟩ + -- Since `c₁` is a border cell, `tilde c₁ = {n₁, n₂} ⊆ bd π.S`. + obtain ⟨n₁, n₂, hn_ne, htilde_c₁, _, _, hn₁_bd, hn₂_bd⟩ := + π.Γ.border_cell_exists_ends hc₁ hbd₁ + have hpair_bd : ({n₁, n₂} : Set π.S) ⊆ bd π.S := by + rintro x (rfl | rfl) <;> [exact hn₁_bd.2; exact hn₂_bd.2] + -- `c₂` cannot be a border cell, since otherwise `tilde c₁ = tilde c₂`, contradicting `(8.5)`. + have hint₂ : ¬ (c₂ ∩ bd π.S).Nonempty := by + intro hbd₂ + obtain ⟨u, w, huw_ne, htilde_c₂, _, _, _, _⟩ := π.Γ.border_cell_exists_ends hc₂ hbd₂ + have hcard₁ : (tilde c₁).ncard = 2 := by rw [htilde_c₁, ncard_pair hn_ne] + have hcard₂ : (tilde c₂).ncard = 2 := by rw [htilde_c₂, ncard_pair huw_ne] + have htc_eq : tilde c₁ = tilde c₂ := + eq_of_subset_of_ncard_le htilde_sub (by omega) (π.Γ.finite_tilde_cell hc₂) + obtain ⟨F, hO, hnorm, hcardF, hno_disc⟩ := hBdInj c₁ hc₁ c₂ hc₂ hne hbd₁ hbd₂ htc_eq + obtain ⟨Δ, hΔ, hbd, _, ⟨hΔ_N, _⟩ | ⟨hcard3, _⟩⟩ := + theorem_8_5_proof h𝒯 π htrue hred hwarp hθ hO hnorm (by omega) + · exact hno_disc Δ hΔ hbd hΔ_N + · omega + -- Since `c₂` is internal and `{n₁, n₂} ⊆ closure c₂ ∩ bd π.S`, `(8.6)` gives `(tilde c₂).ncard = + -- 3`. + have hpair_sub_cl₂ : ({n₁, n₂} : Set π.S) ⊆ closure c₂ ∩ bd π.S := by + rw [Painting.closure_cell_inter_bd_eq_tilde_inter_bd hint₂] + exact subset_inter (htilde_c₁ ▸ htilde_sub) hpair_bd + have hcl₂_fin : (closure c₂ ∩ bd π.S).Finite := by + rw [Painting.closure_cell_inter_bd_eq_tilde_inter_bd hint₂] + exact (π.Γ.finite_tilde_cell hc₂).inter_of_left _ + have hcl₂_ge2 : 2 ≤ (closure c₂ ∩ bd π.S).ncard := by + rw [← ncard_pair hn_ne] + exact ncard_le_ncard hpair_sub_cl₂ hcl₂_fin + have h86 := theorem_8_6_proof + h𝒯 π htrue hred hwarp hθ hc₂ hint₂ + have hcl₂_le2 : (closure c₂ ∩ bd π.S).ncard ≤ 2 := h86.1 + exact (h86.2 (le_antisymm hcl₂_le2 hcl₂_ge2)).1 + +/-- By (8.8), every internal cell $c \in C(\Gamma)$ belongs to $C^*(\Gamma)$. -/ +theorem internal_cell_mem_CStar + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {c : Set π.S} (hc : c ∈ π.Γ.C) (hint : ¬ (c ∩ bd π.S).Nonempty) : + c ∈ π.Γ.CStar := by + refine ⟨hc, ?_⟩ + rintro ⟨c', hc', hne, hsub⟩ + have h88 := theorem_8_8_proof + h𝒯 π htrue hred hwarp hθ hc hc' hne.symm hsub + exact hint h88.1 + +/-- By (8.8), for every cell $c \in C(\Gamma)$, there exists $c' \in C^*(\Gamma)$ with +$\tilde{c} \subseteq \tilde{c}'$. -/ +theorem exists_mem_CStar_tilde_subset + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {c : Set π.S} (hc : c ∈ π.Γ.C) : + ∃ c' ∈ π.Γ.CStar, tilde c ⊆ tilde c' := by + have : T2Space π.S := π.isSurface.2.1 + by_cases hc_star : c ∈ π.Γ.CStar + · exact ⟨c, hc_star, Subset.rfl⟩ + · have hex : ∃ c' ∈ π.Γ.C, c' ≠ c ∧ tilde c ⊆ tilde c' := by + by_contra hno + exact hc_star ⟨hc, hno⟩ + rcases hex with ⟨c', hc', hne, hsub⟩ + have h88 := theorem_8_8_proof + h𝒯 π htrue hred hwarp hθ hc hc' hne.symm hsub + have hint_c' : ¬ (c' ∩ bd π.S).Nonempty := by + intro hbd' + obtain ⟨u, w, huw_ne, htilde_c', _, _, _, _⟩ := π.Γ.border_cell_exists_ends hc' hbd' + have hcard2 : (tilde c').ncard = 2 := by rw [htilde_c', ncard_pair huw_ne] + have hcard3 := h88.2 + omega + exact ⟨c', internal_cell_mem_CStar h𝒯 π htrue hred hwarp hθ hc' hint_c', hsub⟩ + +/-! ## 8. Cells in $C^*(\Gamma)$ Incident with a Node: (8.7) (Pages 182–183) -/ + +/-- **Graph Minors XVII, (8.7)** (page 182): +"For every node $n$ there are at least two cells $c \in C^*(\Gamma)$ with $n \in \tilde{c}$, and +if there are only two and $|\tilde{c}| = 2$ for one of them, then $c$ is a border cell." -/ +theorem theorem_8_7_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {n : π.S} (hn : n ∈ π.Γ.N) : + 2 ≤ {c ∈ π.Γ.CStar | n ∈ tilde c}.ncard ∧ + ({c ∈ π.Γ.CStar | n ∈ tilde c}.ncard = 2 → + ∀ c ∈ π.Γ.CStar, n ∈ tilde c → (tilde c).ncard = 2 → (c ∩ bd π.S).Nonempty) := by + have : T2Space π.S := π.isSurface.2.1 + obtain ⟨-, -, -, -, -, -, hIntNode⟩ := + region_boundary_props h𝒯 π htrue hred hwarp hθ + have hfinite : π.Γ.CStar.Finite := π.Γ.finite_cells.subset fun _ h => h.1 + have hstar_fin : {c ∈ π.Γ.CStar | n ∈ tilde c}.Finite := hfinite.subset fun _ h => h.1 + by_cases hn_bd : n ∈ bd π.S + · -- Case 1: `n` is a border node on some cuff `Θ`. + let Θ := connectedComponentIn (bd π.S) n + have hΘ : Θ ∈ cuffs π.S := ⟨n, hn_bd, rfl⟩ + have hΘ_arc : IsOArc Θ := (GraphMinor.Surface.cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + set k := (π.Γ.N ∩ Θ).ncard + obtain ⟨E⟩ : Nonempty (π.Γ.CuffEnumeration Θ k) := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + have hn_Θ : n ∈ π.Γ.N ∩ Θ := ⟨hn, mem_connectedComponentIn hn_bd⟩ + rw [← E.range_node] at hn_Θ + rcases hn_Θ with ⟨i, hi_eq⟩ + rw [← hi_eq] at hstar_fin ⊢ + have hk : 2 ≤ k := E.two_le + have hk_pos : 0 < k := by omega + let j : Fin k := cyclicPred hk_pos i + have hij_ne : i ≠ j := by + intro hEq + have hval : i.1 = (i.1 + k - 1) % k := congrArg Fin.val hEq + have hi_lt : i.1 < k := i.2 + by_cases hi0 : i.1 = 0 + · rw [hi0, Nat.zero_add, Nat.mod_eq_of_lt (by omega)] at hval + omega + · have hmod : (i.1 + k - 1) % k = i.1 - 1 := by + rw [show i.1 + k - 1 = (i.1 - 1) + k by omega, Nat.add_mod_right, + Nat.mod_eq_of_lt (by omega)] + omega + let b₁ := E.cell i + let b₂ := E.cell j + have hb₁_ne_b₂ : b₁ ≠ b₂ := fun h => hij_ne (E.injective_cell h) + have hb₁_mem : b₁ ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact ⟨i, rfl⟩ + have hb₂_mem : b₂ ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := by + rw [← E.range_cell]; exact ⟨j, rfl⟩ + have hΘ_sub_bd : Θ ⊆ bd π.S := connectedComponentIn_subset (bd π.S) n + have hb₁_bd : (b₁ ∩ bd π.S).Nonempty := hb₁_mem.2.mono (inter_subset_inter_right _ hΘ_sub_bd) + have hb₂_bd : (b₂ ∩ bd π.S).Nonempty := hb₂_mem.2.mono (inter_subset_inter_right _ hΘ_sub_bd) + have hn_b₁ : E.node i ∈ tilde b₁ := by + rw [E.cell_tilde i]; exact Or.inl rfl + have hj_succ : (⟨(j.1 + 1) % k, Nat.mod_lt _ hk_pos⟩ : Fin k) = i := by + apply Fin.ext + dsimp [j, cyclicPred] + have hi_lt : i.1 < k := i.2 + by_cases hi0 : i.1 = 0 + · simp [hi0, Nat.sub_add_cancel hk_pos] + · have hmod : (i.1 + k - 1) % k = i.1 - 1 := by + rw [show i.1 + k - 1 = (i.1 - 1) + k by omega, Nat.add_mod_right, + Nat.mod_eq_of_lt (by omega)] + rw [hmod, Nat.sub_add_cancel (by omega), Nat.mod_eq_of_lt hi_lt] + have hn_b₂ : E.node i ∈ tilde b₂ := by + rw [E.cell_tilde j, hj_succ]; exact Or.inr rfl + obtain ⟨c₁, hc₁_star, hsub₁⟩ := + exists_mem_CStar_tilde_subset + h𝒯 π htrue hred hwarp hθ hb₁_mem.1 + obtain ⟨c₂, hc₂_star, hsub₂⟩ := + exists_mem_CStar_tilde_subset + h𝒯 π htrue hred hwarp hθ hb₂_mem.1 + have hc₁_ne_c₂ : c₁ ≠ c₂ := by + intro hEq + subst hEq + let i' : Fin k := ⟨(i.1 + 1) % k, Nat.mod_lt _ hk_pos⟩ + have hi'_ne_i : i' ≠ i := by + intro h + have hval : (i.1 + 1) % k = i.1 := congrArg Fin.val h + have hi_lt : i.1 < k := i.2 + by_cases hlast : i.1 + 1 = k + · rw [hlast, Nat.mod_self] at hval; omega + · rw [Nat.mod_eq_of_lt (by omega)] at hval; omega + have hi'_ne_j : i' ≠ j := by + intro h + have htb_eq : tilde b₁ = tilde b₂ := by + rw [E.cell_tilde i, E.cell_tilde j, hj_succ] + change ({E.node i, E.node i'} : Set π.S) = {E.node j, E.node i} + rw [h, Set.pair_comm] + have h88 := theorem_8_8_proof + h𝒯 π htrue hred hwarp hθ hb₁_mem.1 hb₂_mem.1 hb₁_ne_b₂ htb_eq.subset + obtain ⟨u, w, huw_ne, htilde_b₂, _, _, _, _⟩ := π.Γ.border_cell_exists_ends hb₂_mem.1 hb₂_bd + have hcard2 : (tilde b₂).ncard = 2 := by rw [htilde_b₂, ncard_pair huw_ne] + omega + have h3_sub_tc₁ : ({E.node i, E.node i', E.node j} : Set π.S) ⊆ tilde c₁ := by + rintro x (rfl | rfl | rfl) + · exact hsub₁ hn_b₁ + · exact hsub₁ (by rw [E.cell_tilde i]; exact Or.inr rfl) + · exact hsub₂ (by rw [E.cell_tilde j]; exact Or.inl rfl) + have h3_sub_bd : ({E.node i, E.node i', E.node j} : Set π.S) ⊆ bd π.S := by + have hnode_bd : ∀ m : Fin k, E.node m ∈ bd π.S := fun m => by + have hm : E.node m ∈ π.Γ.N ∩ Θ := E.range_node ▸ ⟨m, rfl⟩ + exact hΘ_sub_bd hm.2 + rintro x (rfl | rfl | rfl) <;> exact hnode_bd _ + have h3_card : ({E.node i, E.node i', E.node j} : Set π.S).ncard = 3 := by + rw [ncard_insert_of_notMem, ncard_pair ( E.injective_node.ne hi'_ne_j )] + simp only [mem_insert_iff, mem_singleton_iff, not_or] + exact ⟨E.injective_node.ne hi'_ne_i.symm, E.injective_node.ne hij_ne⟩ + have htc₁_ge3 : 3 ≤ (tilde c₁).ncard := by + rw [← h3_card] + exact ncard_le_ncard h3_sub_tc₁ (π.Γ.finite_tilde_cell hc₁_star.1) + have hint_c₁ : ¬ (c₁ ∩ bd π.S).Nonempty := by + intro hbd_c₁ + obtain ⟨u, w, huw_ne, htilde_c₁, _, _, _, _⟩ := π.Γ.border_cell_exists_ends hc₁_star.1 + hbd_c₁ + have hcard2 : (tilde c₁).ncard = 2 := by rw [htilde_c₁, ncard_pair huw_ne] + omega + have h3_sub_cl : ({E.node i, E.node i', E.node j} : Set π.S) ⊆ closure c₁ ∩ bd π.S := by + rw [Painting.closure_cell_inter_bd_eq_tilde_inter_bd hint_c₁] + exact subset_inter h3_sub_tc₁ h3_sub_bd + have hcl_fin : (closure c₁ ∩ bd π.S).Finite := by + rw [Painting.closure_cell_inter_bd_eq_tilde_inter_bd hint_c₁] + exact (π.Γ.finite_tilde_cell hc₁_star.1).inter_of_left _ + have hcl_ge3 : 3 ≤ (closure c₁ ∩ bd π.S).ncard := by + rw [← h3_card] + exact ncard_le_ncard h3_sub_cl hcl_fin + have hcl_le2 := (theorem_8_6_proof + h𝒯 π htrue hred hwarp hθ hc₁_star.1 hint_c₁).1 + omega + have hpair_sub : ({c₁, c₂} : Set (Set π.S)) ⊆ {c ∈ π.Γ.CStar | E.node i ∈ tilde c} := by + rintro c (rfl | rfl) + · exact ⟨hc₁_star, hsub₁ hn_b₁⟩ + · exact ⟨hc₂_star, hsub₂ hn_b₂⟩ + have hge2 : 2 ≤ {c ∈ π.Γ.CStar | E.node i ∈ tilde c}.ncard := by + rw [← ncard_pair hc₁_ne_c₂] + exact ncard_le_ncard hpair_sub hstar_fin + refine ⟨hge2, fun heq2 c hc_star hn_tc hcard_tc => ?_⟩ + have hset_eq : ({c₁, c₂} : Set (Set π.S)) = {d ∈ π.Γ.CStar | E.node i ∈ tilde d} := + eq_of_subset_of_ncard_le hpair_sub (by rw [heq2, ncard_pair hc₁_ne_c₂]) hstar_fin + have hc_mem : c ∈ ({c₁, c₂} : Set (Set π.S)) := hset_eq.symm ▸ ⟨hc_star, hn_tc⟩ + rcases hc_mem with rfl | rfl + · by_cases hcb₁ : c = b₁ + · exact hcb₁ ▸ hb₁_bd + · have h88 := theorem_8_8_proof + h𝒯 π htrue hred hwarp hθ hb₁_mem.1 hc_star.1 (Ne.symm hcb₁) hsub₁ + omega + · by_cases hcb₂ : c = b₂ + · exact hcb₂ ▸ hb₂_bd + · have h88 := theorem_8_8_proof + h𝒯 π htrue hred hwarp hθ hb₂_mem.1 hc_star.1 (Ne.symm hcb₂) hsub₂ + omega + · -- Case 2: `n` is an internal node (`n ∈ π.Γ.N \ bd π.S`). + have hset_eq : {c ∈ π.Γ.CStar | n ∈ tilde c} = {c ∈ π.Γ.C | n ∈ tilde c} := by + ext c + simp only [mem_sep_iff] + refine ⟨fun ⟨hc_star, hn_tc⟩ => ⟨hc_star.1, hn_tc⟩, fun ⟨hc_C, hn_tc⟩ => ⟨?_, hn_tc⟩⟩ + have hint_c : ¬ (c ∩ bd π.S).Nonempty := by + intro hbd_c + obtain ⟨u, w, _, htilde_c, _, _, hu_bd, hw_bd⟩ := π.Γ.border_cell_exists_ends hc_C hbd_c + rcases (htilde_c ▸ hn_tc : n ∈ ({u, w} : Set π.S)) with rfl | rfl + · exact hn_bd hu_bd.2 + · exact hn_bd hw_bd.2 + exact internal_cell_mem_CStar + h𝒯 π htrue hred hwarp hθ hc_C hint_c + rw [hset_eq] + have hcontra : ¬ ({c ∈ π.Γ.C | n ∈ tilde c}.ncard ≤ 1 ∨ + ({c ∈ π.Γ.C | n ∈ tilde c}.ncard = 2 ∧ + ∃ c₀ ∈ π.Γ.C, n ∈ tilde c₀ ∧ (tilde c₀).ncard = 2)) := by + intro hbad + obtain ⟨F, hO, hnorm, hcardF, hF_disc⟩ := hIntNode n ⟨hn, hn_bd⟩ hbad + obtain ⟨Δ, hΔ, hbd, ⟨B, hAB⟩, hcases⟩ := + theorem_8_5_proof h𝒯 π htrue hred hwarp hθ hO hnorm hcardF + obtain ⟨d₁, hd₁_C, d₂, hd₂_C, hC_cov⟩ := hF_disc Δ hΔ hbd hcases + obtain ⟨B₁, hB₁⟩ := htrue.1 d₁ hd₁_C + obtain ⟨B₂, hB₂⟩ := htrue.1 d₂ hd₂_C + apply h𝒯.axiom2 hB₁ hB₂ hAB + have hU_le : π.cellGraph d₁ ∪ π.cellGraph d₂ ∪ π.areaGraph Δ ≤ G := + union_le (union_le (π.cellGraph_le d₁ hd₁_C) (π.cellGraph_le d₂ hd₂_C)) + (π.cellsUnion_le _) + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq hU_le le_rfl + · refine Subset.antisymm hU_le.vertexSet_subset fun v hv => ?_ + obtain ⟨c, hc_C, hvc⟩ := π.p1_vertex v hv + rcases hC_cov hc_C with (rfl | rfl) | ⟨_, hc_Δ⟩ + · exact Or.inl (Or.inl hvc) + · exact Or.inl (Or.inr hvc) + · exact Or.inr (mem_iUnion₂.mpr ⟨c, ⟨⟨hc_C, hc_Δ⟩, hc_C⟩, hvc⟩) + · refine Subset.antisymm hU_le.edgeSet_subset fun e he => ?_ + obtain ⟨c, hc_C, hec⟩ := π.p1_edge e he + rcases hC_cov hc_C with (rfl | rfl) | ⟨_, hc_Δ⟩ + · exact Or.inl (Or.inl hec) + · exact Or.inl (Or.inr hec) + · exact Or.inr (mem_iUnion₂.mpr ⟨c, ⟨⟨hc_C, hc_Δ⟩, hc_C⟩, hec⟩) + refine ⟨by omega, fun heq2 c hc_C hn_tc hcard2 => ?_⟩ + exact False.elim (hcontra (Or.inr ⟨heq2, c, hc_C.1, hn_tc, hcard2⟩)) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section9.lean b/LeanPool/GraphMinor/GM17/Section9.lean new file mode 100644 index 0000000000..ae26742974 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section9.lean @@ -0,0 +1,78 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section8 +public import LeanPool.GraphMinor.Menger.Basic +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.GM17.PasteCuff +import LeanPool.GraphMinor.GM17.ArcDisc +import LeanPool.GraphMinor.GM17.MarkCross +import LeanPool.GraphMinor.GM17.ReplaceDisc +import LeanPool.GraphMinor.GM17.RegionDisc +import LeanPool.GraphMinor.GM17.CutArcPaint +import LeanPool.GraphMinor.GM17.PushNode + +/-! +# Graph Minors XVII, Section 9: Cell Connectivity in a True Portrayal + +This file formalizes Section 9 (pages 183–188) of Robertson and Seymour, *Graph Minors. XVII. +Taming a Vortex*, J. Combin. Theory Ser. B 77 (1999), 162–210. +The portrayal deductions that use painting results are proved in `Section9Proved`. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology Metric +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +local notation "𝕀" => unitInterval + +/-! ## 1. Internal Cell Connectivity: (9.1) (Page 183) -/ + +/-- A walk in `H.skeleton` from `G₁.vertexSet` to `G₂.vertexSet` for a separation `(G₁, G₂)` of `H` +meets `(G₁ ∩ G₂).vertexSet`. -/ +theorem walk_meets_separation {α : Type u} {β : Type v} {H G₁ G₂ : Hypergraph α β} + (hsep : H.IsSeparation G₁ G₂) {u₀ v₀ : α} (w : H.skeleton.Walk u₀ v₀) + (hu : u₀ ∈ G₁.vertexSet) (hv : v₀ ∈ G₂.vertexSet) : + ∃ z ∈ w.support, z ∈ (G₁ ∩ G₂).vertexSet := by + induction w with + | nil => + exact ⟨_, SimpleGraph.Walk.start_mem_support _, hu, hv⟩ + | @cons u u' v hadj w' ih => + by_cases hu' : u' ∈ G₁.vertexSet + · obtain ⟨z, hz_sup, hz_inter⟩ := ih hu' hv + exact ⟨z, SimpleGraph.Walk.support_cons hadj w' ▸ List.mem_cons_of_mem u hz_sup, hz_inter⟩ + · rcases hadj with ⟨_, e, heu, heu'⟩ + have heH : e ∈ H.edgeSet := H.edge_mem_of_inc heu + have he_union : e ∈ G₁.edgeSet ∪ G₂.edgeSet := by + have := congrArg (e ∈ ·.edgeSet) hsep.union_eq + exact this.mpr heH + rcases he_union with he₁ | he₂ + · exfalso + have hends := hsep.left_le.ends_eq e he₁ + have hu'_G₁ : G₁.Inc e u' := by + change u' ∈ G₁.ends e + rw [← hends] + exact heu' + exact hu' (G₁.vertex_mem_of_inc hu'_G₁) + · have hends := hsep.right_le.ends_eq e he₂ + have hu_G₂ : G₂.Inc e u := by + change u ∈ G₂.ends e + rw [← hends] + exact heu + exact ⟨u, SimpleGraph.Walk.start_mem_support _, hu, G₂.vertex_mem_of_inc hu_G₂⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section9Proved.lean b/LeanPool/GraphMinor/GM17/Section9Proved.lean new file mode 100644 index 0000000000..1ee7816081 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section9Proved.lean @@ -0,0 +1,2458 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section9 +import LeanPool.GraphMinor.GM17.Section5Proved +import LeanPool.GraphMinor.GM17.Section6Proved +import LeanPool.GraphMinor.GM17.Section7Proved +import LeanPool.GraphMinor.GM17.Section8Proved + +public import LeanPool.GraphMinor.GM17.Section8 +public import LeanPool.GraphMinor.Menger.Basic +import LeanPool.GraphMinor.Surface.DiscArcs +import LeanPool.GraphMinor.GM17.PasteCuff +import LeanPool.GraphMinor.GM17.ArcDisc +import LeanPool.GraphMinor.GM17.MarkCross +import LeanPool.GraphMinor.GM17.ReplaceDisc +import LeanPool.GraphMinor.GM17.RegionDisc +import LeanPool.GraphMinor.GM17.CutArcPaint +import LeanPool.GraphMinor.GM17.PushNode + +import LeanPool.GraphMinor.GM17.RegionBoundary + +/-! +# Graph Minors XVII: proved deductions of Section9 + +The portrayal deductions use the existing painting proofs. The definitions and +independent geometric lemmas are imported from `Section9`. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology Metric +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +local notation "𝕀" => unitInterval + +/-! ## 1. Internal Cell Connectivity: (9.1) (Page 183) -/ + +private theorem norm_convex_combo_eq {z w : ℂ} (hz : ‖z‖ = 1) (hw : ‖w‖ = 1) (u : ℝ) : + ‖(1 - (u : ℂ)) * z + (u : ℂ) * w‖ ^ 2 + u * (1 - u) * ‖z - w‖ ^ 2 = 1 := by + have h1 : ∀ a : ℂ, ‖a‖ ^ 2 = a.re ^ 2 + a.im ^ 2 := fun a => by + rw [← Complex.normSq_eq_norm_sq, Complex.normSq_apply] + ring + have hz2 : z.re ^ 2 + z.im ^ 2 = 1 := by rw [← h1 z, hz, one_pow] + have hw2 : w.re ^ 2 + w.im ^ 2 = 1 := by rw [← h1 w, hw, one_pow] + rw [h1, h1] + simp only [Complex.add_re, Complex.add_im, Complex.sub_re, Complex.sub_im, + Complex.mul_re, Complex.mul_im, Complex.one_re, Complex.one_im, + Complex.ofReal_re, Complex.ofReal_im] + linear_combination (1 - u) * hz2 + u * hw2 + +private theorem exists_chord_in_closedDisc {S : Type*} [TopologicalSpace S] [T2Space S] + {D : Set S} (hD : IsClosedDisc D) {s t : S} (hs : s ∈ discBd D) (ht : t ∈ discBd D) + (hst : s ≠ t) : + ∃ F : Set S, F ⊆ D ∧ IsLineWithEnds F s t ∧ F ∩ discBd D = {s, t} ∧ + IsConnected (F \ {t}) := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hs_D : s ∈ D := discBd_subset D hs + have ht_D : t ∈ D := discBd_subset D ht + have hzs : h s ∈ sphere (0 : ℂ) 1 := by rw [← c.bd]; exact mem_image_of_mem h hs + have hzt : h t ∈ sphere (0 : ℂ) 1 := by rw [← c.bd]; exact mem_image_of_mem h ht + have hzs_norm : ‖h s‖ = 1 := mem_sphere_zero_iff_norm.mp hzs + have hzt_norm : ‖h t‖ = 1 := mem_sphere_zero_iff_norm.mp hzt + have hz_ne : h s ≠ h t := fun hEq => hst (c.gh.injOn hs_D ht_D hEq) + let ℓ : 𝕀 → ℂ := fun u => (1 - (u : ℝ) : ℂ) * h s + (u : ℝ) * h t + have hℓ_cont : Continuous ℓ := + ((continuous_const.sub (Complex.continuous_ofReal.comp continuous_subtype_val)).mul + continuous_const).add + ((Complex.continuous_ofReal.comp continuous_subtype_val).mul continuous_const) + have hℓ_ball : ∀ u : 𝕀, ℓ u ∈ closedBall (0 : ℂ) 1 := fun u => by + rw [mem_closedBall_zero_iff] + have hid := norm_convex_combo_eq hzs_norm hzt_norm (u : ℝ) + have hnonneg : 0 ≤ (u : ℝ) * (1 - (u : ℝ)) * ‖h s - h t‖ ^ 2 := + mul_nonneg (mul_nonneg u.2.1 (sub_nonneg.mpr u.2.2)) (sq_nonneg _) + have hsq : ‖ℓ u‖ ^ 2 ≤ 1 ^ 2 := by dsimp [ℓ]; linarith + exact (abs_le_of_sq_le_sq' hsq zero_le_one).2 + have hℓ_sphere : ∀ u : 𝕀, ℓ u ∈ sphere (0 : ℂ) 1 → u = 0 ∨ u = 1 := fun u hu => by + have hn : ‖ℓ u‖ = 1 := mem_sphere_zero_iff_norm.mp hu + have hid := norm_convex_combo_eq hzs_norm hzt_norm (u : ℝ) + change ‖ℓ u‖ ^ 2 + (u : ℝ) * (1 - (u : ℝ)) * ‖h s - h t‖ ^ 2 = 1 at hid + rw [hn, one_pow] at hid + have hdiff_ne : ‖h s - h t‖ ≠ 0 := norm_ne_zero_iff.mpr (sub_ne_zero.mpr hz_ne) + have hmul : (u : ℝ) * (1 - (u : ℝ)) = 0 := by + have h0 : (u : ℝ) * (1 - (u : ℝ)) * ‖h s - h t‖ ^ 2 = 0 := by linarith + exact (mul_eq_zero.mp h0).resolve_right (pow_ne_zero 2 hdiff_ne) + rcases mul_eq_zero.mp hmul with hu0 | hu1 + · exact Or.inl (Subtype.ext hu0) + · have h1 : (u : ℝ) = 1 := by linarith + exact Or.inr (Subtype.ext h1) + have hℓ_inj : Function.Injective ℓ := fun u₁ u₂ hEq => by + have hsub : ((u₁ : ℝ) - (u₂ : ℝ) : ℂ) * (h t - h s) = 0 := by + calc ((u₁ : ℝ) - (u₂ : ℝ) : ℂ) * (h t - h s) + _ = ℓ u₁ - ℓ u₂ := by dsimp [ℓ]; ring + _ = 0 := sub_eq_zero.mpr hEq + have hdiff : h t - h s ≠ 0 := sub_ne_zero.mpr hz_ne.symm + have hu : ((u₁ : ℝ) - (u₂ : ℝ) : ℂ) = 0 := (mul_eq_zero.mp hsub).resolve_right hdiff + have hu' : (u₁ : ℝ) - (u₂ : ℝ) = 0 := Complex.ofReal_eq_zero.mp (by simpa using hu) + exact Subtype.ext (sub_eq_zero.mp hu') + let φ : 𝕀 → S := fun u => g (ℓ u) + have hφ_cont : Continuous φ := c.gc.comp_continuous hℓ_cont hℓ_ball + have hφ_inj : Function.Injective φ := fun u₁ u₂ hEq => + hℓ_inj (c.injOn (hℓ_ball u₁) (hℓ_ball u₂) hEq) + have hφ0 : φ 0 = s := by + change g (ℓ 0) = s + simp only [ℓ, Icc.coe_zero, Complex.ofReal_zero, sub_zero, one_mul, zero_mul, add_zero] + exact c.gh hs_D + have hφ1 : φ 1 = t := by + change g (ℓ 1) = t + simp only [ℓ, Icc.coe_one, Complex.ofReal_one, sub_self, zero_mul, one_mul, zero_add] + exact c.gh ht_D + set F := range φ + have hF_sub : F ⊆ D := by + rintro _ ⟨u, rfl⟩ + exact c.gm (hℓ_ball u) + let ev : 𝕀 ≃ₜ F := + Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofInjective φ hφ_inj) + hφ_cont.rangeFactorization + have hF_line : IsLineWithEnds F s t := ⟨ev, hφ0, hφ1⟩ + have hF_bd : F ∩ discBd D = {s, t} := by + refine Subset.antisymm ?_ ?_ + · rintro _ ⟨⟨u, rfl⟩, hbd⟩ + have hlu_sphere : ℓ u ∈ sphere (0 : ℂ) 1 := by + rw [← c.bd, ← c.hg (hℓ_ball u)] + exact mem_image_of_mem h hbd + rcases hℓ_sphere u hlu_sphere with rfl | rfl + · exact Or.inl hφ0 + · exact Or.inr hφ1 + · rintro x (rfl | rfl) + · exact ⟨⟨0, hφ0⟩, hs⟩ + · exact ⟨⟨1, hφ1⟩, ht⟩ + have hF_conn : IsConnected (F \ {t}) := by + have hEq : F \ {t} = φ '' {u : 𝕀 | (u : ℝ) < 1} := by + ext x + simp only [F, mem_sdiff, mem_range, mem_singleton_iff, mem_image, mem_ofPred_eq] + constructor + · rintro ⟨⟨u, rfl⟩, hne⟩ + have hu1 : u ≠ 1 := fun h => hne (h ▸ hφ1) + exact ⟨u, lt_of_le_of_ne u.2.2 (Subtype.ext_iff.not.mp hu1), rfl⟩ + · rintro ⟨u, hu, rfl⟩ + refine ⟨⟨u, rfl⟩, fun hEq => ?_⟩ + have hu1 : u = 1 := hφ_inj (hEq.trans hφ1.symm) + exact hu.ne (congrArg Subtype.val hu1) + rw [hEq] + have hpre : IsConnected {u : 𝕀 | (u : ℝ) < 1} := by + refine ⟨⟨0, by simp⟩, ?_⟩ + exact isPreconnected_iff_preconnectedSpace.mpr (Subtype.preconnectedSpace (by + have hconv : Convex ℝ (Ico (0 : ℝ) 1) := convex_Ico 0 1 + have hEq2 : {u : 𝕀 | (u : ℝ) < 1} = Subtype.val ⁻¹' Ico (0 : ℝ) 1 := by + ext u; simp [u.2.1] + rw [hEq2] + exact (IsInducing.subtypeVal.isPreconnected_image.mp (by + rw [Subtype.image_preimage_coe] + have hinter : (Icc (0 : ℝ) 1) ∩ Ico 0 1 = Ico 0 1 := + inter_eq_right.mpr Ico_subset_Icc_self + rw [hinter] + exact hconv.isPreconnected)))) + exact hpre.image φ hφ_cont.continuousOn + exact ⟨F, hF_sub, hF_line, hF_bd, hF_conn⟩ + +private theorem exists_two_discs_touching_at_point {S : Type*} [TopologicalSpace S] [T2Space S] + {D : Set S} (hD : IsClosedDisc D) {n₁ n₂ n₃ : S} + (hn₁ : n₁ ∈ discBd D) (hn₂ : n₂ ∈ discBd D) (hn₃ : n₃ ∈ discBd D) + (h12 : n₁ ≠ n₂) (h13 : n₁ ≠ n₃) (h23 : n₂ ≠ n₃) : + ∃ Δ₁ Δ₂ : Set S, IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ + Δ₁ ⊆ D ∧ Δ₂ ⊆ D ∧ + n₁ ∈ Δ₁ ∧ n₃ ∈ Δ₁ ∧ n₂ ∉ Δ₁ ∧ + n₂ ∈ Δ₂ ∧ n₃ ∈ Δ₂ ∧ n₁ ∉ Δ₂ ∧ + Δ₁ ∩ Δ₂ = {n₃} := by + obtain ⟨F₁, hF₁_sub, hF₁_line, hF₁_bd, hF₁_conn⟩ := + exists_chord_in_closedDisc hD hn₁ hn₃ h13 + obtain ⟨A₁, A₂, E₁, E₂, -, -, hE₁_disc, hE₂_disc, hE_union, hE_inter, hE₁_bd, hE₂_bd, -⟩ := + disc_iArc D F₁ n₁ n₃ hD hF₁_sub h13 hF₁_line hF₁_bd + have hn₁_F₁ : n₁ ∈ F₁ := by + have : n₁ ∈ F₁ ∩ discBd D := by rw [hF₁_bd]; exact Or.inl rfl + exact this.1 + have hn₃_F₁ : n₃ ∈ F₁ := by + have : n₃ ∈ F₁ ∩ discBd D := by rw [hF₁_bd]; exact Or.inr rfl + exact this.1 + have hn₂_not_F₁ : n₂ ∉ F₁ := by + intro hmem + have : n₂ ∈ F₁ ∩ discBd D := ⟨hmem, hn₂⟩ + rw [hF₁_bd] at this + rcases this with hEq | hEq + · exact h12 hEq.symm + · exact h23 hEq + have hn₂_D : n₂ ∈ E₁ ∪ E₂ := hE_union.symm ▸ discBd_subset D hn₂ + have hhalf : ∃ Δ₁ D' : Set S, IsClosedDisc Δ₁ ∧ IsClosedDisc D' ∧ + Δ₁ ⊆ D ∧ D' ⊆ D ∧ Δ₁ ∩ D' = F₁ ∧ F₁ ⊆ Δ₁ ∧ F₁ ⊆ discBd D' ∧ + n₂ ∉ Δ₁ ∧ n₂ ∈ discBd D' := by + rcases hn₂_D with hn₂_E₁ | hn₂_E₂ + · have hn₂_not_E₂ : n₂ ∉ E₂ := fun h => hn₂_not_F₁ (hE_inter ▸ ⟨hn₂_E₁, h⟩) + have hE₁_sub : E₁ ⊆ D := hE_union ▸ subset_union_left + have hE₂_sub : E₂ ⊆ D := hE_union ▸ subset_union_right + refine ⟨E₂, E₁, hE₂_disc, hE₁_disc, hE₂_sub, hE₁_sub, ?_, ?_, ?_, hn₂_not_E₂, ?_⟩ + · rw [Set.inter_comm, hE_inter] + · rw [← hE_inter]; exact inter_subset_right + · rw [hE₁_bd]; exact subset_union_right + · exact disc_inter_discBd_subset_discBd hD hE₁_disc hE₁_sub ⟨hn₂_E₁, hn₂⟩ + · have hn₂_not_E₁ : n₂ ∉ E₁ := fun h => hn₂_not_F₁ (hE_inter ▸ ⟨h, hn₂_E₂⟩) + have hE₁_sub : E₁ ⊆ D := hE_union ▸ subset_union_left + have hE₂_sub : E₂ ⊆ D := hE_union ▸ subset_union_right + refine ⟨E₁, E₂, hE₁_disc, hE₂_disc, hE₁_sub, hE₂_sub, hE_inter, ?_, ?_, hn₂_not_E₁, ?_⟩ + · rw [← hE_inter]; exact inter_subset_left + · rw [hE₂_bd]; exact subset_union_right + · exact disc_inter_discBd_subset_discBd hD hE₂_disc hE₂_sub ⟨hn₂_E₂, hn₂⟩ + obtain ⟨Δ₁, D', hΔ₁_disc, hD'_disc, hΔ₁_sub, hD'_sub, hΔ₁D'_inter, hF₁_Δ₁, + hF₁_bdD', hn₂_not_Δ₁, hn₂_bdD'⟩ := hhalf + have hn₃_bdD' : n₃ ∈ discBd D' := hF₁_bdD' hn₃_F₁ + obtain ⟨F₂, hF₂_sub, hF₂_line, hF₂_bd, -⟩ := + exists_chord_in_closedDisc hD'_disc hn₂_bdD' hn₃_bdD' h23 + obtain ⟨B₁, B₂, G₁, G₂, hB_ne, hB_comp, hG₁_disc, hG₂_disc, hG_union, hG_inter, + hG₁_bd, hG₂_bd, -⟩ := + disc_iArc D' F₂ n₂ n₃ hD'_disc hF₂_sub h23 hF₂_line hF₂_bd + have hn₂_F₂ : n₂ ∈ F₂ := by + have : n₂ ∈ F₂ ∩ discBd D' := by rw [hF₂_bd]; exact Or.inl rfl + exact this.1 + have hn₃_F₂ : n₃ ∈ F₂ := by + have : n₃ ∈ F₂ ∩ discBd D' := by rw [hF₂_bd]; exact Or.inr rfl + exact this.1 + have hF₁_sub_bdD' : F₁ \ {n₃} ⊆ discBd D' \ {n₂, n₃} := by + rintro x ⟨hxF₁, hxn₃⟩ + refine ⟨hF₁_bdD' hxF₁, ?_⟩ + rintro (rfl | rfl) + · exact hn₂_not_F₁ hxF₁ + · exact hxn₃ rfl + have hn₁_mem_diff : n₁ ∈ discBd D' \ {n₂, n₃} := hF₁_sub_bdD' ⟨hn₁_F₁, h13⟩ + have hcomp_mem : connectedComponentIn (discBd D' \ {n₂, n₃}) n₁ ∈ ({B₁, B₂} : Set (Set S)) := by + rw [← hB_comp] + exact ⟨n₁, hn₁_mem_diff, rfl⟩ + have hF₁_in_comp : F₁ \ {n₃} ⊆ connectedComponentIn (discBd D' \ {n₂, n₃}) n₁ := + hF₁_conn.isPreconnected.subset_connectedComponentIn ⟨hn₁_F₁, h13⟩ hF₁_sub_bdD' + have hB₁_mem : B₁ ∈ componentsIn (discBd D' \ {n₂, n₃}) := by rw [hB_comp]; exact Or.inl rfl + have hB₂_mem : B₂ ∈ componentsIn (discBd D' \ {n₂, n₃}) := by rw [hB_comp]; exact Or.inr rfl + have hB_disj : Disjoint B₁ B₂ := by + rcases hB₁_mem with ⟨x₁, hx₁, rfl⟩ + rcases hB₂_mem with ⟨x₂, hx₂, rfl⟩ + refine Set.disjoint_left.mpr fun z hz₁ hz₂ => hB_ne ?_ + rw [connectedComponentIn_eq hz₁, connectedComponentIn_eq hz₂] + have hchoose_G : ∃ B Δ₂ : Set S, IsClosedDisc Δ₂ ∧ Δ₂ ⊆ D' ∧ F₂ ⊆ Δ₂ ∧ + discBd Δ₂ = B ∪ F₂ ∧ Disjoint B (F₁ \ {n₃}) := by + rcases hcomp_mem with hEq | hEq + · refine ⟨B₂, G₂, hG₂_disc, hG_union ▸ subset_union_right, ?_, hG₂_bd, ?_⟩ + · rw [← hG_inter]; exact inter_subset_right + · exact hB_disj.symm.mono_right (hEq ▸ hF₁_in_comp) + · have hEq' : connectedComponentIn (discBd D' \ {n₂, n₃}) n₁ = B₂ := hEq + refine ⟨B₁, G₁, hG₁_disc, hG_union ▸ subset_union_left, ?_, hG₁_bd, ?_⟩ + · rw [← hG_inter]; exact inter_subset_left + · exact hB_disj.mono_right (hEq' ▸ hF₁_in_comp) + obtain ⟨B, Δ₂, hΔ₂_disc, hΔ₂_sub', hF₂_Δ₂, hΔ₂_bd, hB_disj_F₁⟩ := hchoose_G + have hΔ₂_sub : Δ₂ ⊆ D := hΔ₂_sub'.trans hD'_sub + have hinter : Δ₁ ∩ Δ₂ = {n₃} := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨hx₁, hx₂⟩ + have hxF₁ : x ∈ F₁ := by + rw [← hΔ₁D'_inter] + exact ⟨hx₁, hΔ₂_sub' hx₂⟩ + by_cases hxn₃ : x = n₃ + · exact hxn₃ + · exfalso + have hx_bdΔ₂ : x ∈ discBd Δ₂ := + disc_inter_discBd_subset_discBd hD'_disc hΔ₂_disc hΔ₂_sub' ⟨hx₂, hF₁_bdD' hxF₁⟩ + rw [hΔ₂_bd] at hx_bdΔ₂ + rcases hx_bdΔ₂ with hxB | hxF₂ + · exact Set.disjoint_left.mp hB_disj_F₁ hxB ⟨hxF₁, hxn₃⟩ + · have hx_bd : x ∈ F₂ ∩ discBd D' := ⟨hxF₂, hF₁_bdD' hxF₁⟩ + rw [hF₂_bd] at hx_bd + rcases hx_bd with rfl | rfl + · exact hn₂_not_F₁ hxF₁ + · exact hxn₃ rfl + · rintro x rfl + exact ⟨hF₁_Δ₁ hn₃_F₁, hF₂_Δ₂ hn₃_F₂⟩ + have hn₁_not_Δ₂ : n₁ ∉ Δ₂ := by + intro h + have : n₁ ∈ Δ₁ ∩ Δ₂ := ⟨hF₁_Δ₁ hn₁_F₁, h⟩ + rw [hinter] at this + exact h13 this + exact ⟨Δ₁, Δ₂, hΔ₁_disc, hΔ₂_disc, hΔ₁_sub, hΔ₂_sub, + hF₁_Δ₁ hn₁_F₁, hF₁_Δ₁ hn₃_F₁, hn₂_not_Δ₁, + hF₂_Δ₂ hn₂_F₂, hF₂_Δ₂ hn₃_F₂, hn₁_not_Δ₂, hinter⟩ + +private theorem exists_third_point_in_discBd {S : Type*} [TopologicalSpace S] + {D : Set S} (hD : IsClosedDisc D) (n₁ n₂ : S) : + ∃ n₃ ∈ discBd D, n₁ ≠ n₃ ∧ n₂ ≠ n₃ := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have h1_sp : (1 : ℂ) ∈ sphere (0 : ℂ) 1 := by simp + have hm1_sp : (-1 : ℂ) ∈ sphere (0 : ℂ) 1 := by simp + have hI_sp : Complex.I ∈ sphere (0 : ℂ) 1 := by simp + have h1_ball : (1 : ℂ) ∈ closedBall (0 : ℂ) 1 := sphere_subset_closedBall h1_sp + have hm1_ball : (-1 : ℂ) ∈ closedBall (0 : ℂ) 1 := sphere_subset_closedBall hm1_sp + have hI_ball : Complex.I ∈ closedBall (0 : ℂ) 1 := sphere_subset_closedBall hI_sp + have hg_bd : ∀ z ∈ sphere (0 : ℂ) 1, g z ∈ discBd D := by + intro z hz + have hzD : g z ∈ D := c.gm (sphere_subset_closedBall hz) + have hhz : h (g z) ∈ h '' discBd D := by + rw [c.bd, c.hg (sphere_subset_closedBall hz)] + exact hz + rcases hhz with ⟨x, hx_bd, hEq⟩ + rwa [c.gh.injOn hzD (discBd_subset D hx_bd) hEq.symm] + have hne_1_m1 : g 1 ≠ g (-1) := fun hEq => by + have : (1 : ℂ) = -1 := c.injOn h1_ball hm1_ball hEq + norm_num at this + have hne_1_I : g 1 ≠ g Complex.I := fun hEq => by + have : (1 : ℂ) = Complex.I := c.injOn h1_ball hI_ball hEq + have := congrArg Complex.im this + norm_num at this + have hne_m1_I : g (-1) ≠ g Complex.I := fun hEq => by + have : (-1 : ℂ) = Complex.I := c.injOn hm1_ball hI_ball hEq + have := congrArg Complex.im this + norm_num at this + by_cases h1 : n₁ ≠ g 1 ∧ n₂ ≠ g 1 + · exact ⟨g 1, hg_bd 1 h1_sp, h1.1, h1.2⟩ + by_cases hm1 : n₁ ≠ g (-1) ∧ n₂ ≠ g (-1) + · exact ⟨g (-1), hg_bd (-1) hm1_sp, hm1.1, hm1.2⟩ + refine ⟨g Complex.I, hg_bd Complex.I hI_sp, ?_, ?_⟩ + · intro hEq1 + rcases not_and_or.mp h1 with h1' | h1' <;> rcases not_and_or.mp hm1 with hm1' | hm1' + · push Not at h1' hm1'; exact hne_1_m1 (h1'.symm.trans hm1') + · push Not at h1'; exact hne_1_I (h1'.symm.trans hEq1) + · push Not at hm1'; exact hne_m1_I (hm1'.symm.trans hEq1) + · push Not at h1' hm1'; exact hne_1_m1 (h1'.symm.trans hm1') + · intro hEq2 + rcases not_and_or.mp h1 with h1' | h1' <;> rcases not_and_or.mp hm1 with hm1' | hm1' + · push Not at h1' hm1'; exact hne_1_m1 (h1'.symm.trans hm1') + · push Not at hm1'; exact hne_m1_I (hm1'.symm.trans hEq2) + · push Not at h1'; exact hne_1_I (h1'.symm.trans hEq2) + · push Not at h1' hm1'; exact hne_1_m1 (h1'.symm.trans hm1') + +private theorem exists_two_disjoint_discs {S : Type*} [TopologicalSpace S] [T2Space S] + {D : Set S} (hD : IsClosedDisc D) {n₁ n₂ : S} + (hn₁ : n₁ ∈ discBd D) (hn₂ : n₂ ∈ discBd D) (h12 : n₁ ≠ n₂) : + ∃ Δ₁ Δ₂ : Set S, IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ + Δ₁ ⊆ D ∧ Δ₂ ⊆ D ∧ + n₁ ∈ Δ₁ ∧ n₂ ∉ Δ₁ ∧ + n₂ ∈ Δ₂ ∧ n₁ ∉ Δ₂ ∧ + Δ₁ ∩ Δ₂ = ∅ := by + obtain ⟨p₃, hp₃, h13, h23⟩ := exists_third_point_in_discBd hD n₁ n₂ + obtain ⟨Δ₁, D', hΔ₁_disc, hD'_disc, hΔ₁_sub, hD'_sub, + hn₁_Δ₁, _, hn₂_not_Δ₁, hn₂_D', hp₃_D', hn₁_not_D', hinter1⟩ := + exists_two_discs_touching_at_point hD hn₁ hn₂ hp₃ h12 h13 h23 + have hn₂_bdD' : n₂ ∈ discBd D' := + disc_inter_discBd_subset_discBd hD hD'_disc hD'_sub ⟨hn₂_D', hn₂⟩ + have hp₃_bdD' : p₃ ∈ discBd D' := + disc_inter_discBd_subset_discBd hD hD'_disc hD'_sub ⟨hp₃_D', hp₃⟩ + obtain ⟨p₄, hp₄, h24, h34⟩ := exists_third_point_in_discBd hD'_disc n₂ p₃ + obtain ⟨Δ₂, _, hΔ₂_disc, _, hΔ₂_sub', _, + hn₂_Δ₂, _, hp₃_not_Δ₂, _, _, _, _⟩ := + exists_two_discs_touching_at_point hD'_disc hn₂_bdD' hp₃_bdD' hp₄ h23 h24 h34 + have hΔ₂_sub : Δ₂ ⊆ D := hΔ₂_sub'.trans hD'_sub + have hn₁_not_Δ₂ : n₁ ∉ Δ₂ := fun h => hn₁_not_D' (hΔ₂_sub' h) + have hinter : Δ₁ ∩ Δ₂ = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro x ⟨hx₁, hx₂⟩ + have hxp₃ : x ∈ Δ₁ ∩ D' := ⟨hx₁, hΔ₂_sub' hx₂⟩ + rw [hinter1] at hxp₃ + exact hp₃_not_Δ₂ (hxp₃ ▸ hx₂) + exact ⟨Δ₁, Δ₂, hΔ₁_disc, hΔ₂_disc, hΔ₁_sub, hΔ₂_sub, + hn₁_Δ₁, hn₂_not_Δ₁, hn₂_Δ₂, hn₁_not_Δ₂, hinter⟩ + +private noncomputable def splitInternalCellWithCells {S : Type} [TopologicalSpace S] [T2Space S] + (Γ : Painting S) {c₀ Δ₁ Δ₂ N' : Set S} (hc₀ : c₀ ∈ Γ.C) (hint₀ : ¬ (c₀ ∩ bd S).Nonempty) + (hΔ₁_disc : IsClosedDisc Δ₁) (hΔ₂_disc : IsClosedDisc Δ₂) + (hΔ₁_sub : Δ₁ ⊆ closure c₀) (hΔ₂_sub : Δ₂ ⊆ closure c₀) + (hN_sub : Γ.N ⊆ N') (hN'_fin : N'.Finite) (hN'_diff : N' \ Γ.N ⊆ Δ₁ ∩ Δ₂) + (hΔ_inter : Δ₁ ∩ Δ₂ ⊆ N') + (hΔ₁_bd : Δ₁ ∩ N' ⊆ discBd Δ₁) (hΔ₂_bd : Δ₂ ∩ N' ⊆ discBd Δ₂) + (hΔ₁_card : (Δ₁ ∩ N').ncard ≤ 3) (hΔ₂_card : (Δ₂ ∩ N').ncard ≤ 3) : + {Γ' : Painting S // Γ'.C = insert (Δ₁ \ N') (insert (Δ₂ \ N') (Γ.C \ {c₀}))} := by + classical + let c₁ : Set S := Δ₁ \ N' + let c₂ : Set S := Δ₂ \ N' + let U' : Set S := (Γ.U \ c₀) ∪ Δ₁ ∪ Δ₂ + let I₀ : Set (Set S) := Γ.C \ {c₀} + let I : Set (Set S) := insert c₁ (insert c₂ I₀) + have hI₀_fin : I₀.Finite := Γ.finite_cells.subset sdiff_subset + have hI_fin : I.Finite := (hI₀_fin.insert c₂).insert c₁ + have hc₁_sub_c₀ : c₁ ⊆ c₀ := by + rw [← Γ.closure_cell_diff_N hc₀] + exact fun x ⟨hx₁, hxN'⟩ => ⟨hΔ₁_sub hx₁, fun hxN => hxN' (hN_sub hxN)⟩ + have hc₂_sub_c₀ : c₂ ⊆ c₀ := by + rw [← Γ.closure_cell_diff_N hc₀] + exact fun x ⟨hx₂, hxN'⟩ => ⟨hΔ₂_sub hx₂, fun hxN => hxN' (hN_sub hxN)⟩ + have hc₁_diff_fin : (Δ₁ \ c₁).Finite := + hN'_fin.subset fun x hx => by by_contra hxN; exact hx.2 ⟨hx.1, hxN⟩ + have hc₂_diff_fin : (Δ₂ \ c₂).Finite := + hN'_fin.subset fun x hx => by by_contra hxN; exact hx.2 ⟨hx.1, hxN⟩ + have hc₁_pc : IsPathConnected c₁ := + isPathConnected_of_isClosedDisc_finite_diff hΔ₁_disc sdiff_subset hc₁_diff_fin + have hc₂_pc : IsPathConnected c₂ := + isPathConnected_of_isClosedDisc_finite_diff hΔ₂_disc sdiff_subset hc₂_diff_fin + have hcl_c₁ : closure c₁ = Δ₁ := + closure_eq_of_isClosedDisc_finite_diff hΔ₁_disc sdiff_subset hc₁_diff_fin + have hcl_c₂ : closure c₂ = Δ₂ := + closure_eq_of_isClosedDisc_finite_diff hΔ₂_disc sdiff_subset hc₂_diff_fin + have htc₁ : tilde c₁ = Δ₁ ∩ N' := + tilde_diff_eq_of_isClosedDisc_finite hΔ₁_disc hN'_fin + have htc₂ : tilde c₂ = Δ₂ ∩ N' := + tilde_diff_eq_of_isClosedDisc_finite hΔ₂_disc hN'_fin + have hc₁_disj_c₂ : Disjoint c₁ c₂ := by + refine Set.disjoint_left.mpr fun x ⟨hx₁, hxN⟩ ⟨hx₂, _⟩ => hxN (hΔ_inter ⟨hx₁, hx₂⟩) + have hcell_disj_N' : ∀ c ∈ I₀, ∀ x ∈ c, x ∉ N' := by + rintro c ⟨hc, hne⟩ x hxc hxN' + by_cases hxN : x ∈ Γ.N + · exact (Γ.cell_subset_diff hc hxc).2 hxN + · have hx_c₀ : x ∈ c₀ := by + rw [← Γ.closure_cell_diff_N hc₀] + exact ⟨hΔ₁_sub (hN'_diff ⟨hxN', hxN⟩).1, hxN⟩ + exact Set.disjoint_left.mp (Γ.cell_disjoint hc hc₀ hne) hxc hx_c₀ + have hcl_sub_I₀ : ∀ c ∈ I₀, closure c ⊆ Γ.U \ c₀ := by + rintro c ⟨hc, hne⟩ x hxcl + refine ⟨Γ.closure_cell_subset_U hc hxcl, fun hxc₀ => ?_⟩ + by_cases hxc : x ∈ c + · exact Set.disjoint_left.mp (Γ.cell_disjoint hc hc₀ hne) hxc hxc₀ + · exact (Γ.cell_subset_diff hc₀ hxc₀).2 (Γ.tilde_subset_N hc ⟨hxcl, hxc⟩) + have hU₀_eq : Γ.U \ c₀ = Γ.N ∪ ⋃ c ∈ I₀, closure c := by + ext x + simp only [I₀, mem_sdiff, mem_union, mem_iUnion] + constructor + · rintro ⟨hxU, hx_not_c₀⟩ + rw [Γ.U_eq_N_union_biUnion_closure] at hxU + rcases hxU with hxN | hcl + · exact Or.inl hxN + · rw [mem_iUnion₂] at hcl + rcases hcl with ⟨c, hc, hxcl⟩ + by_cases hcc₀ : c = c₀ + · subst hcc₀ + exact Or.inl (Γ.tilde_subset_N hc₀ ⟨hxcl, hx_not_c₀⟩) + · exact Or.inr ⟨c, ⟨hc, hcc₀⟩, hxcl⟩ + · rintro (hxN | ⟨c, hcI, hxcl⟩) + · exact ⟨Γ.N_subset hxN, fun hxc₀ => (Γ.cell_subset_diff hc₀ hxc₀).2 hxN⟩ + · exact hcl_sub_I₀ c hcI hxcl + have hU'_closed : IsClosed U' := by + have hU₀_cl : IsClosed (Γ.U \ c₀) := by + rw [hU₀_eq] + exact Γ.finite_N.isClosed.union (hI₀_fin.isClosed_biUnion fun _ _ => isClosed_closure) + exact (hU₀_cl.union (isClosed_of_isClosedDisc hΔ₁_disc)).union (isClosed_of_isClosedDisc + hΔ₂_disc) + have hcov : ⋃₀ I = U' \ N' := by + ext x + simp only [I, U', sUnion_insert, mem_union, mem_sUnion, mem_sdiff] + constructor + · rintro (hxc₁ | hxc₂ | ⟨c, ⟨hc, hne⟩, hxc⟩) + · exact ⟨Or.inl (Or.inr hxc₁.1), hxc₁.2⟩ + · exact ⟨Or.inr hxc₂.1, hxc₂.2⟩ + · exact ⟨Or.inl (Or.inl ⟨Γ.cell_subset_U hc hxc, + Set.disjoint_left.mp (Γ.cell_disjoint hc hc₀ hne) hxc⟩), + hcell_disj_N' c ⟨hc, hne⟩ x hxc⟩ + · rintro ⟨((⟨hxU, hx_not_c₀⟩ | hxΔ₁) | hxΔ₂), hx_not_N'⟩ + · have hx_not_N : x ∉ Γ.N := fun hxN => hx_not_N' (hN_sub hxN) + have hx_cells : x ∈ ⋃₀ Γ.C := Γ.sUnion_cells.symm ▸ ⟨hxU, hx_not_N⟩ + rcases hx_cells with ⟨c, hc, hxc⟩ + have hne : c ≠ c₀ := fun h => hx_not_c₀ (h ▸ hxc) + exact Or.inr (Or.inr ⟨c, ⟨hc, hne⟩, hxc⟩) + · exact Or.inl ⟨hxΔ₁, hx_not_N'⟩ + · exact Or.inr (Or.inl ⟨hxΔ₂, hx_not_N'⟩) + have hC'_eq : arcComponentsIn (U' \ N') = I := by + apply arcComponentsIn_eq_of_finite_cover hI_fin hcov + · rintro c (rfl | rfl | hcI) + · exact hc₁_pc.nonempty + · exact hc₂_pc.nonempty + · exact Γ.cell_nonempty hcI.1 + · rintro c (rfl | rfl | hcI) + · exact hc₁_pc + · exact hc₂_pc + · exact Γ.cell_isPathConnected hcI.1 + · rintro c (rfl | rfl | hcI) c' (rfl | rfl | hc'I) hne + · exact (hne rfl).elim + · exact hc₁_disj_c₂ + · exact (Γ.cell_disjoint hc'I.1 hc₀ hc'I.2).symm.mono_left hc₁_sub_c₀ + · exact hc₁_disj_c₂.symm + · exact (hne rfl).elim + · exact (Γ.cell_disjoint hc'I.1 hc₀ hc'I.2).symm.mono_left hc₂_sub_c₀ + · exact (Γ.cell_disjoint hcI.1 hc₀ hcI.2).mono_right hc₁_sub_c₀ + · exact (Γ.cell_disjoint hcI.1 hc₀ hcI.2).mono_right hc₂_sub_c₀ + · exact Γ.cell_disjoint hcI.1 hc'I.1 hne + · intro c hcI_all + refine Subset.antisymm ?_ (fun x hxc => ⟨subset_closure hxc, hcov ▸ ⟨c, hcI_all, hxc⟩⟩) + rintro x ⟨hxcl, hxUN⟩ + rcases hcI_all with rfl | rfl | hcI + · rw [hcl_c₁] at hxcl + exact ⟨hxcl, hxUN.2⟩ + · rw [hcl_c₂] at hxcl + exact ⟨hxcl, hxUN.2⟩ + · rw [← Γ.closure_cell_diff_N hcI.1] + exact ⟨hxcl, fun hxN => hxUN.2 (hN_sub hxN)⟩ + refine ⟨?_, ?_⟩ + · refine + { U := U' + N := N' + isClosed_U := hU'_closed + finite_N := hN'_fin + N_subset := fun x hxN' => by + by_cases hxN : x ∈ Γ.N + · exact Or.inl (Or.inl ⟨Γ.N_subset hxN, + fun hxc₀ => (Γ.cell_subset_diff hc₀ hxc₀).2 hxN⟩) + · exact Or.inl (Or.inr (hN'_diff ⟨hxN', hxN⟩).1) + finite_cells := hC'_eq ▸ hI_fin + cell_disc := ?_ + bd_subset := fun x hxbd => Or.inl (Or.inl ⟨Γ.bd_subset hxbd, + fun hxc₀ => hint₀ ⟨x, hxc₀, hxbd⟩⟩) + border_cell := ?_ } + · intro c hc + rw [hC'_eq] at hc + rcases hc with rfl | rfl | hcI + · rw [hcl_c₁, htc₁] + exact ⟨hΔ₁_disc, hΔ₁_bd, hN'_fin.inter_of_right Δ₁, hΔ₁_card⟩ + · rw [hcl_c₂, htc₂] + exact ⟨hΔ₂_disc, hΔ₂_bd, hN'_fin.inter_of_right Δ₂, hΔ₂_card⟩ + · exact Γ.cell_disc c hcI.1 + · intro c hc hbd + rw [hC'_eq] at hc + rcases hc with rfl | rfl | hcI + · exact False.elim (hint₀ (hbd.mono (inter_subset_inter_left _ hc₁_sub_c₀))) + · exact False.elim (hint₀ (hbd.mono (inter_subset_inter_left _ hc₂_sub_c₀))) + · exact Γ.border_cell c hcI.1 hbd + · exact hC'_eq + +private noncomputable def splitInternalCell {S : Type} [TopologicalSpace S] [T2Space S] + (Γ : Painting S) {c₀ Δ₁ Δ₂ N' : Set S} (hc₀ : c₀ ∈ Γ.C) (hint₀ : ¬ (c₀ ∩ bd S).Nonempty) + (hΔ₁_disc : IsClosedDisc Δ₁) (hΔ₂_disc : IsClosedDisc Δ₂) + (hΔ₁_sub : Δ₁ ⊆ closure c₀) (hΔ₂_sub : Δ₂ ⊆ closure c₀) + (hN_sub : Γ.N ⊆ N') (hN'_fin : N'.Finite) (hN'_diff : N' \ Γ.N ⊆ Δ₁ ∩ Δ₂) + (hΔ_inter : Δ₁ ∩ Δ₂ ⊆ N') + (hΔ₁_bd : Δ₁ ∩ N' ⊆ discBd Δ₁) (hΔ₂_bd : Δ₂ ∩ N' ⊆ discBd Δ₂) + (hΔ₁_card : (Δ₁ ∩ N').ncard ≤ 3) (hΔ₂_card : (Δ₂ ∩ N').ncard ≤ 3) : + Painting S := + (splitInternalCellWithCells Γ hc₀ hint₀ hΔ₁_disc hΔ₂_disc hΔ₁_sub hΔ₂_sub + hN_sub hN'_fin hN'_diff hΔ_inter hΔ₁_bd hΔ₂_bd hΔ₁_card hΔ₂_card).1 + +private theorem splitInternalCell_C {S : Type} [TopologicalSpace S] [T2Space S] + (Γ : Painting S) {c₀ Δ₁ Δ₂ N' : Set S} (hc₀ : c₀ ∈ Γ.C) (hint₀ : ¬ (c₀ ∩ bd S).Nonempty) + (hΔ₁_disc : IsClosedDisc Δ₁) (hΔ₂_disc : IsClosedDisc Δ₂) + (hΔ₁_sub : Δ₁ ⊆ closure c₀) (hΔ₂_sub : Δ₂ ⊆ closure c₀) + (hN_sub : Γ.N ⊆ N') (hN'_fin : N'.Finite) (hN'_diff : N' \ Γ.N ⊆ Δ₁ ∩ Δ₂) + (hΔ_inter : Δ₁ ∩ Δ₂ ⊆ N') + (hΔ₁_bd : Δ₁ ∩ N' ⊆ discBd Δ₁) (hΔ₂_bd : Δ₂ ∩ N' ⊆ discBd Δ₂) + (hΔ₁_card : (Δ₁ ∩ N').ncard ≤ 3) (hΔ₂_card : (Δ₂ ∩ N').ncard ≤ 3) : + (splitInternalCell Γ hc₀ hint₀ hΔ₁_disc hΔ₂_disc hΔ₁_sub hΔ₂_sub + hN_sub hN'_fin hN'_diff hΔ_inter hΔ₁_bd hΔ₂_bd hΔ₁_card hΔ₂_card).C = + insert (Δ₁ \ N') (insert (Δ₂ \ N') (Γ.C \ {c₀})) := + (splitInternalCellWithCells Γ hc₀ hint₀ hΔ₁_disc hΔ₂_disc hΔ₁_sub hΔ₂_sub + hN_sub hN'_fin hN'_diff hΔ_inter hΔ₁_bd hΔ₂_bd hΔ₁_card hΔ₂_card).2 + +private theorem exists_discs_for_splitInternalCell {S : Type} [TopologicalSpace S] [T2Space S] + (Γ : Painting S) {c₀ : Set S} (hc₀ : c₀ ∈ Γ.C) + (htc₀_ge2 : 2 ≤ (tilde c₀).ncard) + {n₁ n₂ : S} (hn₁ : n₁ ∈ tilde c₀) (hn₂ : n₂ ∈ tilde c₀) (hne : n₁ ≠ n₂) : + ∃ Δ₁ Δ₂ : Set S, IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ + Δ₁ ⊆ closure c₀ ∧ Δ₂ ⊆ closure c₀ ∧ + Δ₁ ∩ Δ₂ = tilde c₀ \ {n₁, n₂} ∧ + tilde (Δ₁ \ Γ.N) = tilde c₀ \ {n₂} ∧ + tilde (Δ₂ \ Γ.N) = tilde c₀ \ {n₁} := by + have hD : IsClosedDisc (closure c₀) := Γ.isClosedDisc_closure_cell hc₀ + have htc₀_bd : tilde c₀ ⊆ discBd (closure c₀) := (Γ.cell_disc c₀ hc₀).2.1 + have htc₀_fin : (tilde c₀).Finite := Γ.finite_tilde_cell hc₀ + have htc₀_le3 : (tilde c₀).ncard ≤ 3 := Γ.ncard_tilde_cell_le hc₀ + have htc_diff : ∀ Δ : Set S, IsClosedDisc Δ → Δ ⊆ closure c₀ → tilde (Δ \ Γ.N) = Δ ∩ tilde c₀ + := by + intro Δ hΔ hΔ_sub + rw [tilde_diff_eq_of_isClosedDisc_finite hΔ Γ.finite_N] + ext x + simp only [mem_inter_iff, tilde, mem_sdiff] + exact ⟨fun ⟨hxΔ, hxN⟩ => ⟨hxΔ, hΔ_sub hxΔ, fun hxc₀ => (Γ.cell_subset_diff hc₀ hxc₀).2 hxN⟩, + fun ⟨hxΔ, hxtc₀⟩ => ⟨hxΔ, Γ.tilde_subset_N hc₀ hxtc₀⟩⟩ + by_cases hex₃ : (tilde c₀ \ {n₁, n₂}).Nonempty + · obtain ⟨n₃, hn₃_tc, hn₃_not_pair⟩ := hex₃ + have h13 : n₁ ≠ n₃ := fun h => hn₃_not_pair (Or.inl h.symm) + have h23 : n₂ ≠ n₃ := fun h => hn₃_not_pair (Or.inr h.symm) + have hsub3 : ({n₁, n₂, n₃} : Set S) ⊆ tilde c₀ := by + rintro x (rfl | rfl | rfl) <;> assumption + have hcard3 : ({n₁, n₂, n₃} : Set S).ncard = 3 := by + rw [ncard_insert_of_notMem, ncard_pair h23] + rintro (rfl | rfl) + · exact hne rfl + · exact h13 rfl + have htc₀_eq : tilde c₀ = {n₁, n₂, n₃} := + (eq_of_subset_of_ncard_le hsub3 (by omega) htc₀_fin).symm + obtain ⟨Δ₁, Δ₂, hΔ₁_disc, hΔ₂_disc, hΔ₁_sub, hΔ₂_sub, + hn₁_Δ₁, hn₃_Δ₁, hn₂_not_Δ₁, hn₂_Δ₂, hn₃_Δ₂, hn₁_not_Δ₂, hinter⟩ := + exists_two_discs_touching_at_point hD (htc₀_bd hn₁) (htc₀_bd hn₂) (htc₀_bd hn₃_tc) hne h13 h23 + refine ⟨Δ₁, Δ₂, hΔ₁_disc, hΔ₂_disc, hΔ₁_sub, hΔ₂_sub, ?_, ?_, ?_⟩ + · rw [hinter, htc₀_eq] + ext x + simp only [mem_singleton_iff, mem_sdiff, mem_insert_iff] + constructor + · rintro rfl + refine ⟨Or.inr (Or.inr rfl), ?_⟩ + rintro (rfl | rfl) + · exact h13 rfl + · exact h23 rfl + · rintro ⟨rfl | rfl | rfl, hnot⟩ + · exact (hnot (Or.inl rfl)).elim + · exact (hnot (Or.inr rfl)).elim + · rfl + · rw [htc_diff Δ₁ hΔ₁_disc hΔ₁_sub, htc₀_eq] + ext x + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff, mem_sdiff] + constructor + · rintro ⟨hxΔ₁, rfl | rfl | rfl⟩ + · exact ⟨Or.inl rfl, hne⟩ + · exact (hn₂_not_Δ₁ hxΔ₁).elim + · exact ⟨Or.inr (Or.inr rfl), h23.symm⟩ + · rintro ⟨rfl | rfl | rfl, hnot⟩ + · exact ⟨hn₁_Δ₁, Or.inl rfl⟩ + · exact (hnot rfl).elim + · exact ⟨hn₃_Δ₁, Or.inr (Or.inr rfl)⟩ + · rw [htc_diff Δ₂ hΔ₂_disc hΔ₂_sub, htc₀_eq] + ext x + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff, mem_sdiff] + constructor + · rintro ⟨hxΔ₂, rfl | rfl | rfl⟩ + · exact (hn₁_not_Δ₂ hxΔ₂).elim + · exact ⟨Or.inr (Or.inl rfl), hne.symm⟩ + · exact ⟨Or.inr (Or.inr rfl), h13.symm⟩ + · rintro ⟨rfl | rfl | rfl, hnot⟩ + · exact (hnot rfl).elim + · exact ⟨hn₂_Δ₂, Or.inr (Or.inl rfl)⟩ + · exact ⟨hn₃_Δ₂, Or.inr (Or.inr rfl)⟩ + · have htc₀_diff_empty : tilde c₀ \ {n₁, n₂} = ∅ := not_nonempty_iff_eq_empty.mp hex₃ + have htc₀_eq : tilde c₀ = {n₁, n₂} := by + refine Subset.antisymm (sdiff_eq_empty.mp htc₀_diff_empty) ?_ + rintro x (rfl | rfl) <;> assumption + obtain ⟨Δ₁, Δ₂, hΔ₁_disc, hΔ₂_disc, hΔ₁_sub, hΔ₂_sub, + hn₁_Δ₁, hn₂_not_Δ₁, hn₂_Δ₂, hn₁_not_Δ₂, hinter⟩ := + exists_two_disjoint_discs hD (htc₀_bd hn₁) (htc₀_bd hn₂) hne + refine ⟨Δ₁, Δ₂, hΔ₁_disc, hΔ₂_disc, hΔ₁_sub, hΔ₂_sub, ?_, ?_, ?_⟩ + · rw [hinter, htc₀_diff_empty] + · rw [htc_diff Δ₁ hΔ₁_disc hΔ₁_sub, htc₀_eq] + ext x + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff, mem_sdiff] + constructor + · rintro ⟨hxΔ₁, rfl | rfl⟩ + · exact ⟨Or.inl rfl, hne⟩ + · exact (hn₂_not_Δ₁ hxΔ₁).elim + · rintro ⟨rfl | rfl, hnot⟩ + · exact ⟨hn₁_Δ₁, Or.inl rfl⟩ + · exact (hnot rfl).elim + · rw [htc_diff Δ₂ hΔ₂_disc hΔ₂_sub, htc₀_eq] + ext x + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff, mem_sdiff] + constructor + · rintro ⟨hxΔ₂, rfl | rfl⟩ + · exact (hn₁_not_Δ₂ hxΔ₂).elim + · exact ⟨Or.inr rfl, hne.symm⟩ + · rintro ⟨rfl | rfl, hnot⟩ + · exact (hnot rfl).elim + · exact ⟨hn₂_Δ₂, Or.inr rfl⟩ + +private theorem internal_cell_attachments_le_three {α : Type u} {β : Type v} + {G : Hypergraph α β} (π : Portrayal G) {c : Set π.S} + (hc : c ∈ π.Γ.C) (hint : ¬ (c ∩ bd π.S).Nonempty) : + (attachments G (π.cellGraph c)).ncard ≤ 3 := by + have : T2Space π.S := π.isSurface.2.1 + have hsub : attachments G (π.cellGraph c) ⊆ π.nodeVertex '' (tilde c ∩ π.domγ) := by + intro v hv + obtain ⟨hvc, hvother⟩ := π.attachments_cellGraph_subset_otherVertices hc hv + exact π.p5 c hc hint v hvc hvother + have hfinite := π.Γ.finite_tilde_cell hc + have hdomfin := hfinite.inter_of_left π.domγ + exact (ncard_le_ncard hsub (hdomfin.image _)).trans <| + (ncard_image_le hdomfin).trans <| + (ncard_le_ncard inter_subset_left hfinite).trans (π.Γ.ncard_tilde_cell_le hc) + +open Classical in +private noncomputable abbrev split_internal_cell_portrayal + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {c₀ : Set π.S} + (hc₀ : c₀ ∈ π.Γ.C) + (hint₀ : ¬(c₀ ∩ bd π.S).Nonempty) + (htc₀_ge2 : 2 ≤ (tilde c₀).ncard) + {n₁ : π.S} + {n₂ : π.S} + (hn₁ : n₁ ∈ tilde c₀) + (hn₂ : n₂ ∈ tilde c₀) + {A₁ : Hypergraph α β} + {A₂ : Hypergraph α β} + (hA₁_le : A₁ ≤ π.cellGraph c₀) + (hA₂_le : A₂ ≤ π.cellGraph c₀) + (hA_union_V : A₁.vertexSet ∪ A₂.vertexSet = (π.cellGraph c₀).vertexSet) + (hA_union_E : A₁.edgeSet ∪ A₂.edgeSet = (π.cellGraph c₀).edgeSet) + (hA_disj_E : Disjoint A₁.edgeSet A₂.edgeSet) + (hA₁_tc : ∀ n ∈ tilde c₀ \ {n₂}, π.nodeVertex n ∈ A₁.vertexSet) + (hA₂_tc : ∀ n ∈ tilde c₀ \ {n₁}, π.nodeVertex n ∈ A₂.vertexSet) + (hA_inter_V : A₁.vertexSet ∩ A₂.vertexSet ⊆ π.nodeVertex '' (tilde c₀ \ {n₁, n₂})) + (Δ₁ : Set π.S) + (Δ₂ : Set π.S) + (hΔ₁_sub : Δ₁ ⊆ closure c₀) + (hΔ₂_sub : Δ₂ ⊆ closure c₀) + (hΔ_inter : Δ₁ ∩ Δ₂ = tilde c₀ \ {n₁, n₂}) + (c₁ : Set π.S) + (c₂ : Set π.S) + (htc₂ : tilde c₂ = tilde c₀ \ {n₁}) + (htc₁ : tilde c₁ = tilde c₀ \ {n₂}) + (hΔ₁_N_eq : Δ₁ ∩ π.Γ.N = tilde c₀ \ {n₂}) + (hΔ₂_N_eq : Δ₂ ∩ π.Γ.N = tilde c₀ \ {n₁}) + (Γ' : Painting π.S) + (hΓN : Γ'.N = π.Γ.N) + (hC' : Γ'.C = insert c₁ (insert c₂ (π.Γ.C \ {c₀}))) + (hc₁_sub_c₀ : c₁ ⊆ c₀) + (hc₂_sub_c₀ : c₂ ⊆ c₀) + (hc₁_not_I₀ : ∀ d ∈ π.Γ.C \ {c₀}, d ≠ c₁) + (hc₂_not_I₀ : ∀ d ∈ π.Γ.C \ {c₀}, d ≠ c₂) + (hint₁ : ¬(c₁ ∩ bd π.S).Nonempty) + (hint₂ : ¬(c₂ ∩ bd π.S).Nonempty) + (hc₁_C' : c₁ ∈ Γ'.C) + (hc₂_C' : c₂ ∈ Γ'.C) + (cellG : Set π.S → Hypergraph α β) + (hcellG_c₁ : cellG c₁ = A₁) + (hcellG_c₂ : cellG c₂ = A₂) + (hcellG_other : ∀ d ∈ π.Γ.C \ {c₀}, cellG d = π.cellGraph d) + (hcellG_le : ∀ c ∈ Γ'.C, cellG c ≤ G) + (hp5_aux : ∀ c ∈ Γ'.C, ¬(c ∩ bd π.S).Nonempty → ∀ v ∈ (cellG c).vertexSet, (∃ d ∈ Γ'.C, d ≠ c + ∧ v ∈ (cellG d).vertexSet) → v ∈ π.nodeVertex '' (tilde c ∩ π.domγ)) : Portrayal G := + { S := π.S + top := π.top + isSurface := π.isSurface + connected := π.connected + Γ := Γ' + cellGraph := cellG + borderSet := π.borderSet + domγ := π.domγ + nodeVertex := π.nodeVertex + cellGraph_le := hcellG_le + borderSet_subset := fun n hn => π.borderSet_subset n (hΓN ▸ hn) + domγ_subset := hΓN.symm ▸ π.domγ_subset + nodeVertex_mem := π.nodeVertex_mem + nodeVertex_injOn := π.nodeVertex_injOn + p1_vertex := fun v hv => by + obtain ⟨c, hc, hvc⟩ := π.p1_vertex v hv + by_cases hcc₀ : c = c₀ + · subst hcc₀ + rw [← hA_union_V] at hvc + rcases hvc with hv₁ | hv₂ + · exact ⟨c₁, hc₁_C', hcellG_c₁.symm ▸ hv₁⟩ + · exact ⟨c₂, hc₂_C', hcellG_c₂.symm ▸ hv₂⟩ + · exact ⟨c, hC'.symm ▸ Or.inr (Or.inr ⟨hc, hcc₀⟩), + (hcellG_other c ⟨hc, hcc₀⟩).symm ▸ hvc⟩ + p1_edge := fun e he => by + obtain ⟨c, hc, hec⟩ := π.p1_edge e he + by_cases hcc₀ : c = c₀ + · subst hcc₀ + rw [← hA_union_E] at hec + rcases hec with he₁ | he₂ + · exact ⟨c₁, hc₁_C', hcellG_c₁.symm ▸ he₁⟩ + · exact ⟨c₂, hc₂_C', hcellG_c₂.symm ▸ he₂⟩ + · exact ⟨c, hC'.symm ▸ Or.inr (Or.inr ⟨hc, hcc₀⟩), + (hcellG_other c ⟨hc, hcc₀⟩).symm ▸ hec⟩ + p1_disjoint := fun d₁ hd₁ d₂ hd₂ hne => by + rw [hC'] at hd₁ hd₂ + rcases hd₁ with rfl | rfl | hd₁I <;> rcases hd₂ with rfl | rfl | hd₂I + · exact (hne rfl).elim + · rw [hcellG_c₁, hcellG_c₂]; exact hA_disj_E + · rw [hcellG_c₁, hcellG_other d₂ hd₂I] + exact (π.p1_disjoint c₀ hc₀ d₂ hd₂I.1 (Ne.symm hd₂I.2)).mono_left hA₁_le.2 + · rw [hcellG_c₂, hcellG_c₁]; exact hA_disj_E.symm + · exact (hne rfl).elim + · rw [hcellG_c₂, hcellG_other d₂ hd₂I] + exact (π.p1_disjoint c₀ hc₀ d₂ hd₂I.1 (Ne.symm hd₂I.2)).mono_left hA₂_le.2 + · rw [hcellG_other d₁ hd₁I, hcellG_c₁] + exact (π.p1_disjoint d₁ hd₁I.1 c₀ hc₀ hd₁I.2).mono_right hA₁_le.2 + · rw [hcellG_other d₁ hd₁I, hcellG_c₂] + exact (π.p1_disjoint d₁ hd₁I.1 c₀ hc₀ hd₁I.2).mono_right hA₂_le.2 + · rw [hcellG_other d₁ hd₁I, hcellG_other d₂ hd₂I] + exact π.p1_disjoint d₁ hd₁I.1 d₂ hd₂I.1 hne + p2 := fun c hc n hn => by + rw [hC'] at hc + rcases hc with rfl | rfl | hcI + · rw [hcellG_c₁] + exact hA₁_tc n (htc₁ ▸ hn.1) + · rw [hcellG_c₂] + exact hA₂_tc n (htc₂ ▸ hn.1) + · rw [hcellG_other c hcI] + exact π.p2 c hcI.1 n hn + p3_notMem := π.p3_notMem + p3_subset := fun c hc hbd n hn => by + rw [hC'] at hc + rcases hc with rfl | rfl | hcI + · exact (hint₁ hbd).elim + · exact (hint₂ hbd).elim + · rw [hcellG_other c hcI] + exact π.p3_subset c hcI.1 hbd n hn + p4_disjoint := fun Θ₁ hΘ₁ Θ₂ hΘ₂ hne m₁ hm₁ m₂ hm₂ => + π.p4_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ hne m₁ (hΓN ▸ hm₁) m₂ (hΓN ▸ hm₂) + p4_notMem := fun Θ hΘ m₁ hm₁ m₂ hm₂ hne => + π.p4_notMem Θ hΘ m₁ (hΓN ▸ hm₁) m₂ hm₂ hne + p5 := hp5_aux + p6 := fun c hc hbd v hvc ⟨d, hd, hne_dc, hvd⟩ => by + rw [hC'] at hc hd + rcases hc with rfl | rfl | hcI + · exact (hint₁ hbd).elim + · exact (hint₂ hbd).elim + · rw [hcellG_other c hcI] at hvc + rcases hd with rfl | rfl | hdI + · rw [hcellG_c₁] at hvd + exact π.p6 c hcI.1 hbd v hvc ⟨c₀, hc₀, Ne.symm hcI.2, hA₁_le.1 hvd⟩ + · rw [hcellG_c₂] at hvd + exact π.p6 c hcI.1 hbd v hvc ⟨c₀, hc₀, Ne.symm hcI.2, hA₂_le.1 hvd⟩ + · rw [hcellG_other d hdI] at hvd + exact π.p6 c hcI.1 hbd v hvc ⟨d, hdI.1, hne_dc, hvd⟩ + p7 := fun Θ hΘ m₁ hm₁ m₂ hm₂ m₃ hm₃ m₄ hm₄ hord w hw₁ hw₃ => + π.p7 Θ hΘ m₁ (hΓN ▸ hm₁) m₂ (hΓN ▸ hm₂) m₃ (hΓN ▸ hm₃) m₄ (hΓN ▸ hm₄) hord w hw₁ hw₃ } + +private theorem split_cell_shared_vertices_correspond_to_nodes + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + (hdom : π.domγ = π.Γ.N) + {c₀ : Set π.S} + (hc₀ : c₀ ∈ π.Γ.C) + (hint₀ : ¬(c₀ ∩ bd π.S).Nonempty) + {n₁ : π.S} + {n₂ : π.S} + {A₁ : Hypergraph α β} + {A₂ : Hypergraph α β} + (hA₁_le : A₁ ≤ π.cellGraph c₀) + (hA₂_le : A₂ ≤ π.cellGraph c₀) + (hA₁_not_n₂ : π.nodeVertex n₂ ∉ A₁.vertexSet) + (hA₂_not_n₁ : π.nodeVertex n₁ ∉ A₂.vertexSet) + (hA_inter_V : A₁.vertexSet ∩ A₂.vertexSet ⊆ π.nodeVertex '' (tilde c₀ \ {n₁, n₂})) + (c₁ : Set π.S) + (c₂ : Set π.S) + (htc₂ : tilde c₂ = tilde c₀ \ {n₁}) + (htc₁ : tilde c₁ = tilde c₀ \ {n₂}) + (Γ' : Painting π.S) + (hC' : Γ'.C = insert c₁ (insert c₂ (π.Γ.C \ {c₀}))) + (cellG : Set π.S → Hypergraph α β) + (hcellG_c₁ : cellG c₁ = A₁) + (hcellG_c₂ : cellG c₂ = A₂) + (hcellG_other : ∀ d ∈ π.Γ.C \ {c₀}, cellG d = π.cellGraph d) : + ∀ c ∈ Γ'.C, ¬(c ∩ bd π.S).Nonempty → ∀ v ∈ (cellG c).vertexSet, (∃ d ∈ Γ'.C, d ≠ c ∧ v ∈ + (cellG d).vertexSet) → v ∈ π.nodeVertex '' (tilde c ∩ π.domγ) := by + intro c hc hint v hvc ⟨d, hd, hne_dc, hvd⟩ + rw [hC'] at hc hd + rcases hc with hc_eq₁ | hc_eq₂ | hcI + · subst c + rw [hcellG_c₁] at hvc + change v ∈ π.nodeVertex '' (tilde c₁ ∩ π.domγ) + rw [htc₁, hdom, inter_eq_left.mpr (sdiff_subset.trans (π.Γ.tilde_subset_N hc₀))] + rcases hd with rfl | rfl | hdI + · exact (hne_dc rfl).elim + · rw [hcellG_c₂] at hvd + obtain ⟨n, ⟨hn_tc, hn_not_pair⟩, rfl⟩ := hA_inter_V ⟨hvc, hvd⟩ + exact ⟨n, ⟨hn_tc, fun h => hn_not_pair (Or.inr h)⟩, rfl⟩ + · rw [hcellG_other d hdI] at hvd + obtain ⟨n, ⟨hn_tc, _⟩, rfl⟩ := + π.p5 c₀ hc₀ hint₀ v (hA₁_le.1 hvc) ⟨d, hdI.1, hdI.2, hvd⟩ + have hnn₂ : n ≠ n₂ := fun h => hA₁_not_n₂ (h ▸ hvc) + exact ⟨n, ⟨hn_tc, hnn₂⟩, rfl⟩ + · subst c + rw [hcellG_c₂] at hvc + change v ∈ π.nodeVertex '' (tilde c₂ ∩ π.domγ) + rw [htc₂, hdom, inter_eq_left.mpr (sdiff_subset.trans (π.Γ.tilde_subset_N hc₀))] + rcases hd with rfl | rfl | hdI + · rw [hcellG_c₁] at hvd + obtain ⟨n, ⟨hn_tc, hn_not_pair⟩, rfl⟩ := hA_inter_V ⟨hvd, hvc⟩ + exact ⟨n, ⟨hn_tc, fun h => hn_not_pair (Or.inl h)⟩, rfl⟩ + · exact (hne_dc rfl).elim + · rw [hcellG_other d hdI] at hvd + obtain ⟨n, ⟨hn_tc, _⟩, rfl⟩ := + π.p5 c₀ hc₀ hint₀ v (hA₂_le.1 hvc) ⟨d, hdI.1, hdI.2, hvd⟩ + have hnn₁ : n ≠ n₁ := fun h => hA₂_not_n₁ (h ▸ hvc) + exact ⟨n, ⟨hn_tc, hnn₁⟩, rfl⟩ + · rw [hcellG_other c hcI] at hvc + rcases hd with rfl | rfl | hdI + · rw [hcellG_c₁] at hvd + exact π.p5 c hcI.1 hint v hvc ⟨c₀, hc₀, Ne.symm hcI.2, hA₁_le.1 hvd⟩ + · rw [hcellG_c₂] at hvd + exact π.p5 c hcI.1 hint v hvc ⟨c₀, hc₀, Ne.symm hcI.2, hA₂_le.1 hvd⟩ + · rw [hcellG_other d hdI] at hvd + exact π.p5 c hcI.1 hint v hvc ⟨d, hdI.1, hne_dc, hvd⟩ + +private theorem disc_inside_cell_has_its_nodes_on_boundary {S : Type} + [TopologicalSpace S] (Γ : Painting S) {c Δ : Set S} (hc : c ∈ Γ.C) + (hΔ : IsClosedDisc Δ) (hsub : Δ ⊆ closure c) (hN : Δ ∩ Γ.N ⊆ tilde c) : + Δ ∩ Γ.N ⊆ discBd Δ := by + intro x hx + exact disc_inter_discBd_subset_discBd (Γ.isClosedDisc_closure_cell hc) hΔ hsub + ⟨hx.1, (Γ.cell_disc c hc).2.1 (hN hx)⟩ + +private theorem exists_truer_of_splitInternalCell + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (hθ : 3 < θ) + (π : Portrayal G) (hcentral : π.IsCentral 𝒯) (hdom : π.domγ = π.Γ.N) + {c₀ : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) (hint₀ : ¬ (c₀ ∩ bd π.S).Nonempty) + (htc₀_ge2 : 2 ≤ (tilde c₀).ncard) + {n₁ n₂ : π.S} (hn₁ : n₁ ∈ tilde c₀) (hn₂ : n₂ ∈ tilde c₀) (hne : n₁ ≠ n₂) + {A₁ A₂ : Hypergraph α β} (hA₁_le : A₁ ≤ π.cellGraph c₀) (hA₂_le : A₂ ≤ π.cellGraph c₀) + (hA_union_V : A₁.vertexSet ∪ A₂.vertexSet = (π.cellGraph c₀).vertexSet) + (hA_union_E : A₁.edgeSet ∪ A₂.edgeSet = (π.cellGraph c₀).edgeSet) + (hA_disj_E : Disjoint A₁.edgeSet A₂.edgeSet) + (hA₁_tc : ∀ n ∈ tilde c₀ \ {n₂}, π.nodeVertex n ∈ A₁.vertexSet) + (hA₂_tc : ∀ n ∈ tilde c₀ \ {n₁}, π.nodeVertex n ∈ A₂.vertexSet) + (hA₁_not_n₂ : π.nodeVertex n₂ ∉ A₁.vertexSet) + (hA₂_not_n₁ : π.nodeVertex n₁ ∉ A₂.vertexSet) + (hA_inter_V : A₁.vertexSet ∩ A₂.vertexSet ⊆ π.nodeVertex '' (tilde c₀ \ {n₁, n₂})) : + ∃ π' : Portrayal G, π'.IsCentral 𝒯 ∧ π'.Resembles π ∧ π'.IsTruer π ∧ + ((tilde c₀).ncard = 3 → π'.truth 0 < π.truth 0 ∧ + ∀ w : Set π.S → ℕ, (∀ Θ ∈ cuffs π.S, π.warpAt Θ = w Θ) → + ∃ ψ : π'.S ≃ₜ π.S, ∀ Θ ∈ cuffs π'.S, π'.warpAt Θ = w (ψ '' Θ)) := by + classical + have : T2Space π.S := π.isSurface.2.1 + obtain ⟨Δ₁, Δ₂, hΔ₁_disc, hΔ₂_disc, hΔ₁_sub, hΔ₂_sub, hΔ_inter, htc₁, htc₂⟩ := + exists_discs_for_splitInternalCell π.Γ hc₀ htc₀_ge2 hn₁ hn₂ hne + have hΔ_inter_N : Δ₁ ∩ Δ₂ ⊆ π.Γ.N := by + rw [hΔ_inter] + exact sdiff_subset.trans (π.Γ.tilde_subset_N hc₀) + let c₁ : Set π.S := Δ₁ \ π.Γ.N + let c₂ : Set π.S := Δ₂ \ π.Γ.N + have hΔ₁_N_eq : Δ₁ ∩ π.Γ.N = tilde c₀ \ {n₂} := by + rw [← tilde_diff_eq_of_isClosedDisc_finite hΔ₁_disc π.Γ.finite_N, htc₁] + have hΔ₂_N_eq : Δ₂ ∩ π.Γ.N = tilde c₀ \ {n₁} := by + rw [← tilde_diff_eq_of_isClosedDisc_finite hΔ₂_disc π.Γ.finite_N, htc₂] + have hΔ₁_bd : Δ₁ ∩ π.Γ.N ⊆ discBd Δ₁ := + disc_inside_cell_has_its_nodes_on_boundary π.Γ hc₀ hΔ₁_disc hΔ₁_sub (hΔ₁_N_eq ▸ sdiff_subset) + have hΔ₂_bd : Δ₂ ∩ π.Γ.N ⊆ discBd Δ₂ := + disc_inside_cell_has_its_nodes_on_boundary π.Γ hc₀ hΔ₂_disc hΔ₂_sub (hΔ₂_N_eq ▸ sdiff_subset) + have hΔ₁_card : (Δ₁ ∩ π.Γ.N).ncard ≤ 3 := by + rw [hΔ₁_N_eq] + exact (ncard_le_ncard sdiff_subset (π.Γ.finite_tilde_cell hc₀)).trans + (π.Γ.ncard_tilde_cell_le hc₀) + have hΔ₂_card : (Δ₂ ∩ π.Γ.N).ncard ≤ 3 := by + rw [hΔ₂_N_eq] + exact (ncard_le_ncard sdiff_subset (π.Γ.finite_tilde_cell hc₀)).trans + (π.Γ.ncard_tilde_cell_le hc₀) + let Γ' : Painting π.S := + splitInternalCell π.Γ hc₀ hint₀ hΔ₁_disc hΔ₂_disc hΔ₁_sub hΔ₂_sub + Subset.rfl π.Γ.finite_N (by simp) hΔ_inter_N hΔ₁_bd hΔ₂_bd hΔ₁_card hΔ₂_card + have hC' : Γ'.C = insert c₁ (insert c₂ (π.Γ.C \ {c₀})) := + splitInternalCell_C π.Γ hc₀ hint₀ hΔ₁_disc hΔ₂_disc hΔ₁_sub hΔ₂_sub + Subset.rfl π.Γ.finite_N (by simp) hΔ_inter_N hΔ₁_bd hΔ₂_bd hΔ₁_card hΔ₂_card + have hc₁_sub_c₀ : c₁ ⊆ c₀ := by + rw [← π.Γ.closure_cell_diff_N hc₀] + exact sdiff_le_sdiff_right hΔ₁_sub + have hc₂_sub_c₀ : c₂ ⊆ c₀ := by + rw [← π.Γ.closure_cell_diff_N hc₀] + exact sdiff_le_sdiff_right hΔ₂_sub + have hc₁_ne : c₁.Nonempty := + (isPathConnected_of_isClosedDisc_finite_diff hΔ₁_disc sdiff_subset + (π.Γ.finite_N.subset fun x hx => by by_contra hxN; exact hx.2 ⟨hx.1, hxN⟩)).nonempty + have hc₂_ne : c₂.Nonempty := + (isPathConnected_of_isClosedDisc_finite_diff hΔ₂_disc sdiff_subset + (π.Γ.finite_N.subset fun x hx => by by_contra hxN; exact hx.2 ⟨hx.1, hxN⟩)).nonempty + have hc₁_disj_c₂ : Disjoint c₁ c₂ := + Set.disjoint_left.mpr fun x ⟨hx₁, hxN⟩ ⟨hx₂, _⟩ => hxN (hΔ_inter_N ⟨hx₁, hx₂⟩) + have hc₁_ne_c₂ : c₁ ≠ c₂ := by + rcases hc₁_ne with ⟨x, hx⟩ + exact fun h => Set.disjoint_left.mp hc₁_disj_c₂ hx (h ▸ hx) + have hc₁_not_I₀ : ∀ d ∈ π.Γ.C \ {c₀}, d ≠ c₁ := by + rintro d ⟨hd, hne₀⟩ rfl + rcases hc₁_ne with ⟨x, hx⟩ + exact Set.disjoint_left.mp (π.Γ.cell_disjoint hd hc₀ hne₀) hx (hc₁_sub_c₀ hx) + have hc₂_not_I₀ : ∀ d ∈ π.Γ.C \ {c₀}, d ≠ c₂ := by + rintro d ⟨hd, hne₀⟩ rfl + rcases hc₂_ne with ⟨x, hx⟩ + exact Set.disjoint_left.mp (π.Γ.cell_disjoint hd hc₀ hne₀) hx (hc₂_sub_c₀ hx) + have hint₁ : ¬ (c₁ ∩ bd π.S).Nonempty := + fun h => hint₀ (h.mono (inter_subset_inter_left _ hc₁_sub_c₀)) + have hint₂ : ¬ (c₂ ∩ bd π.S).Nonempty := + fun h => hint₀ (h.mono (inter_subset_inter_left _ hc₂_sub_c₀)) + have hc₁_C' : c₁ ∈ Γ'.C := hC'.symm ▸ Or.inl rfl + have hc₂_C' : c₂ ∈ Γ'.C := hC'.symm ▸ Or.inr (Or.inl rfl) + let cellG : Set π.S → Hypergraph α β := fun c => + if c = c₁ then A₁ else if c = c₂ then A₂ else π.cellGraph c + have hcellG_c₁ : cellG c₁ = A₁ := by simp [cellG] + have hcellG_c₂ : cellG c₂ = A₂ := by simp [cellG, hc₁_ne_c₂.symm] + have hcellG_other : ∀ d ∈ π.Γ.C \ {c₀}, cellG d = π.cellGraph d := fun d hd => by + simp [cellG, hc₁_not_I₀ d hd, hc₂_not_I₀ d hd] + have hcellG_le : ∀ c ∈ Γ'.C, cellG c ≤ G := by + intro c hc + rw [hC'] at hc + rcases hc with rfl | rfl | hd + · rw [hcellG_c₁]; exact hA₁_le.trans (π.cellGraph_le c₀ hc₀) + · rw [hcellG_c₂]; exact hA₂_le.trans (π.cellGraph_le c₀ hc₀) + · rw [hcellG_other c hd]; exact π.cellGraph_le c hd.1 + have hp5_aux : ∀ c ∈ Γ'.C, ¬ (c ∩ bd π.S).Nonempty → ∀ v ∈ (cellG c).vertexSet, + (∃ d ∈ Γ'.C, d ≠ c ∧ v ∈ (cellG d).vertexSet) → v ∈ π.nodeVertex '' (tilde c ∩ π.domγ) := by + exact split_cell_shared_vertices_correspond_to_nodes (α := α) (β := β) (G := G) π hdom (c₀ := + c₀) hc₀ hint₀ (n₁ := n₁) (n₂ := n₂) (A₁ := A₁) (A₂ := A₂) hA₁_le hA₂_le hA₁_not_n₂ + hA₂_not_n₁ hA_inter_V c₁ c₂ htc₂ htc₁ Γ' hC' cellG hcellG_c₁ hcellG_c₂ hcellG_other + let π' : Portrayal G := + split_internal_cell_portrayal (α := α) (β := β) (G := G) π (c₀ := c₀) hc₀ hint₀ htc₀_ge2 (n₁ + := n₁) (n₂ := n₂) hn₁ hn₂ (A₁ := A₁) (A₂ := A₂) hA₁_le hA₂_le hA_union_V hA_union_E + hA_disj_E hA₁_tc hA₂_tc hA_inter_V Δ₁ Δ₂ hΔ₁_sub hΔ₂_sub hΔ_inter c₁ c₂ htc₂ htc₁ hΔ₁_N_eq + hΔ₂_N_eq Γ' rfl hC' hc₁_sub_c₀ + hc₂_sub_c₀ hc₁_not_I₀ hc₂_not_I₀ hint₁ hint₂ hc₁_C' hc₂_C' cellG hcellG_c₁ hcellG_c₂ + hcellG_other hcellG_le hp5_aux + have hπ'_central : π'.IsCentral 𝒯 := by + intro c hc + change IsSmallWrt 𝒯 (cellG c) + have hcases : c ∈ insert c₁ (insert c₂ (π.Γ.C \ {c₀})) := hC' ▸ hc + rcases hcases with rfl | rfl | hcI + · have hatt_le := internal_cell_attachments_le_three π' hc₁_C' hint₁ + have hatt_lt : (attachments G (cellG c₁)).ncard < θ := hatt_le.trans_lt (by omega) + exact IsSmallWrt.mono h𝒯 (hcentral c₀ hc₀) (hcellG_c₁ ▸ hA₁_le) hatt_lt + · have hatt_le := internal_cell_attachments_le_three π' hc₂_C' hint₂ + have hatt_lt : (attachments G (cellG c₂)).ncard < θ := hatt_le.trans_lt (by omega) + exact IsSmallWrt.mono h𝒯 (hcentral c₀ hc₀) (hcellG_c₂ ▸ hA₂_le) hatt_lt + · rw [hcellG_other c hcI] + exact hcentral c hcI.1 + have hπ'_warpAt : ∀ Θ ∈ cuffs π.S, π'.warpAt Θ = π.warpAt Θ := by + intro Θ hΘ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hcw_eq : ∀ c ∈ π.Γ.C \ {c₀}, (c ∩ Θ).Nonempty → π'.cellWarp c = π.cellWarp c := by + intro c hcI _ + change sInf {q | π'.CellWarpLE c q} = sInf {q | π.CellWarpLE c q} + congr 1; ext q + change (∀ n₁ ∈ tilde c, ∀ n₂ ∈ tilde c, n₁ ≠ n₂ → + (π.borderSet n₁).ncard ≤ q ∧ (π.borderSet n₂).ncard ≤ q ∧ + ((π.borderPlus n₁).ncard = q + 1 → (π.borderPlus n₂).ncard = q + 1 → + Portrayal.LinkagePairs (cellG c).skeleton (π.borderPlus n₁) (π.borderPlus n₂) + (q + 1) (π.nodeVertex n₁) (π.nodeVertex n₂))) ↔ _ + rw [hcellG_other c hcI] + rfl + change sSup {p | ∃ c ∈ Γ'.C, (c ∩ Θ).Nonempty ∧ p = π'.cellWarp c} = + sSup {p | ∃ c ∈ π.Γ.C, (c ∩ Θ).Nonempty ∧ p = π.cellWarp c} + congr 1; ext q + constructor + · rintro ⟨c, hc', hcΘ, rfl⟩ + have hbd_c : (c ∩ bd π.S).Nonempty := hcΘ.mono (inter_subset_inter_right _ hΘ_bd) + rw [hC'] at hc' + rcases hc' with rfl | rfl | hcI + · exact (hint₁ hbd_c).elim + · exact (hint₂ hbd_c).elim + · exact ⟨c, hcI.1, hcΘ, hcw_eq c hcI hcΘ⟩ + · rintro ⟨c, hc_C, hcΘ, rfl⟩ + have hbd_c : (c ∩ bd π.S).Nonempty := hcΘ.mono (inter_subset_inter_right _ hΘ_bd) + have hcc₀ : c ≠ c₀ := fun h => hint₀ (h ▸ hbd_c) + exact ⟨c, hC'.symm ▸ Or.inr (Or.inr ⟨hc_C, hcc₀⟩), hcΘ, (hcw_eq c ⟨hc_C, hcc₀⟩ hcΘ).symm⟩ + have hπ'_res : π'.Resembles π := by + refine ⟨Homeomorph.refl π.S, fun Θ hΘ => ?_⟩ + rw [Homeomorph.refl_apply, image_id] + exact hπ'_warpAt Θ hΘ + have htc₀_le3 : (tilde c₀).ncard ≤ 3 := π.Γ.ncard_tilde_cell_le hc₀ + let k₀ : Fin 6 := ⟨3 - (tilde c₀).ncard, by omega⟩ + have hk₀_lt : π'.truth k₀ < π.truth k₀ := by + have htc₁_card : (tilde c₁).ncard = (tilde c₀).ncard - 1 := by + rw [show tilde c₁ = tilde c₀ \ {n₂} from htc₁, ncard_sdiff_singleton_of_mem hn₂] + have htc₂_card : (tilde c₂).ncard = (tilde c₀).ncard - 1 := by + rw [show tilde c₂ = tilde c₀ \ {n₁} from htc₂, ncard_sdiff_singleton_of_mem hn₁] + have hk₀_lt4 : k₀.1 < 4 := by dsimp [k₀]; omega + simp only [Portrayal.truth, π', hk₀_lt4, ↓reduceIte] + have hm_eq : 3 - k₀.1 = (tilde c₀).ncard := by dsimp [k₀]; omega + have hset_eq : + {c ∈ Γ'.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - k₀.1} = + {c ∈ π.Γ.C \ {c₀} | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - k₀.1} := by + rw [hC'] + ext d + simp only [mem_sep_iff, mem_insert_iff] + constructor + · rintro ⟨rfl | rfl | hdI, hint_d, hcard_d⟩ + · omega + · omega + · exact ⟨hdI, hint_d, hcard_d⟩ + · rintro ⟨hdI, hint_d, hcard_d⟩ + exact ⟨Or.inr (Or.inr hdI), hint_d, hcard_d⟩ + rw [hset_eq] + have hssub : {c ∈ π.Γ.C \ {c₀} | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - k₀.1} ⊂ + {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - k₀.1} := by + refine ⟨fun d hd => ⟨hd.1.1, hd.2⟩, fun h => ?_⟩ + have hc₀_mem : c₀ ∈ {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - k₀.1} := + ⟨hc₀, hint₀, hm_eq.symm⟩ + exact (h hc₀_mem).1.2 rfl + exact ncard_lt_ncard hssub (π.Γ.finite_cells.subset fun _ hd => hd.1) + have hπ'_truer : π'.IsTruer π := by + have htc₁_card : (tilde c₁).ncard = (tilde c₀).ncard - 1 := by + rw [show tilde c₁ = tilde c₀ \ {n₂} from htc₁, ncard_sdiff_singleton_of_mem hn₂] + have htc₂_card : (tilde c₂).ncard = (tilde c₀).ncard - 1 := by + rw [show tilde c₂ = tilde c₀ \ {n₁} from htc₂, ncard_sdiff_singleton_of_mem hn₁] + have hset_eq : ∀ m : ℕ, (tilde c₀).ncard ≤ m → + {c ∈ Γ'.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = m} = + {c ∈ π.Γ.C \ {c₀} | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = m} := by + intro m hm + rw [hC'] + ext d + simp only [mem_sep_iff, mem_insert_iff] + constructor + · rintro ⟨rfl | rfl | hdI, hint_d, hcard_d⟩ + · omega + · omega + · exact ⟨hdI, hint_d, hcard_d⟩ + · rintro ⟨hdI, hint_d, hcard_d⟩ + exact ⟨Or.inr (Or.inr hdI), hint_d, hcard_d⟩ + refine ⟨k₀, fun i hi => ?_, hk₀_lt⟩ + have hi_lt : i.1 < 3 - (tilde c₀).ncard := hi + have hi4 : i.1 < 4 := by omega + simp only [Portrayal.truth, π', hi4, ↓reduceIte] + rw [hset_eq (3 - i.1) (by omega)] + congr 1; ext d + simp only [mem_sep_iff, mem_sdiff, mem_singleton_iff] + exact ⟨fun ⟨⟨hd, _⟩, h⟩ => ⟨hd, h⟩, + fun ⟨hd, hint_d, hcard_d⟩ => ⟨⟨hd, fun hEq => by subst hEq; omega⟩, hint_d, hcard_d⟩⟩ + refine ⟨π', hπ'_central, hπ'_res, hπ'_truer, fun h3 => ⟨?_, fun w hw => ?_⟩⟩ + · have hk0 : k₀ = 0 := by ext; simp [k₀, h3] + exact hk0 ▸ hk₀_lt + · refine ⟨Homeomorph.refl π.S, fun Θ hΘ => ?_⟩ + rw [Homeomorph.refl_apply, image_id, hπ'_warpAt Θ hΘ, hw Θ hΘ] + +/-- **Graph Minors XVII, (9.1)** (page 183): +"Let $c_0$ be an internal cell, and let $v_1, v_2 \in \gamma(\tilde{c}_0)$. Then there is a path in +$\alpha(c_0)^*$ from $v_1$ to $v_2$ with no other vertex in $\gamma(\tilde{c}_0)$." -/ +theorem theorem_9_1_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {c₀ : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) (hint₀ : ¬ (c₀ ∩ bd π.S).Nonempty) + {n₁ n₂ : π.S} (hn₁ : n₁ ∈ tilde c₀) (hn₂ : n₂ ∈ tilde c₀) (hne : n₁ ≠ n₂) : + ∃ L : PathFromTo (π.cellGraph c₀).skeleton {π.nodeVertex n₁} {π.nodeVertex n₂}, + ∀ z ∈ L.walk.support, z ∈ π.nodeVertex '' tilde c₀ → + z = π.nodeVertex n₁ ∨ z = π.nodeVertex n₂ := by + classical + by_contra hno_path + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof + h𝒯 π htrue hred hwarp hθ + obtain ⟨_, h82_card, _⟩ := + theorem_8_2_proof h𝒯 π htrue hred hwarp hθ + have htc₀_ge2 : 2 ≤ (tilde c₀).ncard := h82_card c₀ hc₀ + have htc₀_dom : tilde c₀ ⊆ π.domγ := hdom ▸ π.Γ.tilde_subset_N hc₀ + set v₁ := π.nodeVertex n₁ + set v₂ := π.nodeVertex n₂ + have hv₁_mem : v₁ ∈ (π.cellGraph c₀).vertexSet := + π.p2 c₀ hc₀ n₁ ⟨hn₁, htc₀_dom hn₁⟩ + have hv₂_mem : v₂ ∈ (π.cellGraph c₀).vertexSet := + π.p2 c₀ hc₀ n₂ ⟨hn₂, htc₀_dom hn₂⟩ + let H₀ := π.cellGraph c₀ + let K : Set α := (π.nodeVertex '' tilde c₀) \ {v₁, v₂} + have hK_sub : K ⊆ H₀.vertexSet := by + rintro _ ⟨⟨n, hn_tc, rfl⟩, _⟩ + exact π.p2 c₀ hc₀ n ⟨hn_tc, htc₀_dom hn_tc⟩ + let X₁ : Set α := + {z ∈ H₀.vertexSet \ K | ∃ w : H₀.skeleton.Walk v₁ z, ∀ u ∈ w.support, u ∉ K} + have hv₁_not_K : v₁ ∉ K := fun h => h.2 (Or.inl rfl) + have hv₂_not_K : v₂ ∉ K := fun h => h.2 (Or.inr rfl) + have hv₁_X₁ : v₁ ∈ X₁ := by + refine ⟨⟨hv₁_mem, hv₁_not_K⟩, SimpleGraph.Walk.nil, ?_⟩ + intro u hu + simp only [SimpleGraph.Walk.support_nil, List.mem_singleton] at hu + subst hu + exact hv₁_not_K + have hv₂_not_X₁ : v₂ ∉ X₁ := by + rintro ⟨_, w, hw⟩ + apply hno_path + refine ⟨⟨v₁, v₂, w.toPath, w.toPath.2, rfl, rfl⟩, ?_⟩ + intro z hz hz_img + by_contra hnot + exact hw z (SimpleGraph.Walk.support_toPath_subset_support w hz) ⟨hz_img, hnot⟩ + have hedge_X₁ : ∀ e ∈ H₀.edgeSet, (∃ x ∈ X₁, H₀.Inc e x) → + ∀ y, H₀.Inc e y → y ∈ X₁ ∪ K := by + rintro e _ ⟨x, ⟨⟨hxV, hx_not_K⟩, w, hw⟩, hx_inc⟩ y hy_inc + have hyV : y ∈ H₀.vertexSet := H₀.vertex_mem_of_inc hy_inc + by_cases hyK : y ∈ K + · exact Or.inr hyK + · left + by_cases hyx : y = x + · subst hyx; exact ⟨⟨hxV, hx_not_K⟩, w, hw⟩ + · have hadj : H₀.skeleton.Adj x y := ⟨Ne.symm hyx, e, hx_inc, hy_inc⟩ + refine ⟨⟨hyV, hyK⟩, w.concat hadj, ?_⟩ + intro u hu + rw [SimpleGraph.Walk.support_concat, List.mem_append, List.mem_singleton] at hu + rcases hu with huw | rfl + · exact hw u huw + · exact hyK + let A₁ : Hypergraph α β := + { vertexSet := X₁ ∪ K + edgeSet := {e ∈ H₀.edgeSet | ∃ x ∈ X₁, H₀.Inc e x} + Inc := fun e y => (e ∈ H₀.edgeSet ∧ ∃ x ∈ X₁, H₀.Inc e x) ∧ H₀.Inc e y + vertex_mem_of_inc := fun e y ⟨⟨he, hx⟩, hy⟩ => hedge_X₁ e he hx y hy + edge_mem_of_inc := fun _ _ h => h.1 + vertexSet_finite := H₀.vertexSet_finite.subset (union_subset (fun _ hx => hx.1.1) hK_sub) + edgeSet_finite := H₀.edgeSet_finite.subset (sep_subset _ _) } + let A₂ : Hypergraph α β := + { vertexSet := H₀.vertexSet \ X₁ + edgeSet := {e ∈ H₀.edgeSet | ¬ ∃ x ∈ X₁, H₀.Inc e x} + Inc := fun e y => (e ∈ H₀.edgeSet ∧ ¬ ∃ x ∈ X₁, H₀.Inc e x) ∧ H₀.Inc e y + vertex_mem_of_inc := fun _ y ⟨⟨_, hnot⟩, hy⟩ => ⟨H₀.vertex_mem_of_inc hy, fun hyX₁ + => hnot ⟨y, hyX₁, hy⟩⟩ + edge_mem_of_inc := fun _ _ h => h.1 + vertexSet_finite := H₀.vertexSet_finite.subset sdiff_subset + edgeSet_finite := H₀.edgeSet_finite.subset (sep_subset _ _) } + have hA₁_le : A₁ ≤ H₀ := + ⟨union_subset (fun _ hx => hx.1.1) hK_sub, sep_subset _ _, fun e he => by + ext y; exact ⟨fun hy => ⟨he, hy⟩, fun hy => hy.2⟩⟩ + have hA₂_le : A₂ ≤ H₀ := + ⟨sdiff_subset, sep_subset _ _, fun e he => by + ext y; exact ⟨fun hy => ⟨he, hy⟩, fun hy => hy.2⟩⟩ + have hA_union_V : A₁.vertexSet ∪ A₂.vertexSet = H₀.vertexSet := by + refine Subset.antisymm (union_subset hA₁_le.1 hA₂_le.1) fun v hv => ?_ + by_cases hvX₁ : v ∈ X₁ + · exact Or.inl (Or.inl hvX₁) + · exact Or.inr ⟨hv, hvX₁⟩ + have hA_union_E : A₁.edgeSet ∪ A₂.edgeSet = H₀.edgeSet := by + ext e + simp only [A₁, A₂, mem_union, mem_sep_iff] + refine ⟨fun h => h.elim And.left And.left, fun he => ?_⟩ + by_cases h : ∃ x ∈ X₁, H₀.Inc e x + · exact Or.inl ⟨he, h⟩ + · exact Or.inr ⟨he, h⟩ + have hA_disj_E : Disjoint A₁.edgeSet A₂.edgeSet := + Set.disjoint_left.mpr fun _ he₁ he₂ => he₂.2 he₁.2 + have hA₁_tc : ∀ n ∈ tilde c₀ \ {n₂}, π.nodeVertex n ∈ A₁.vertexSet := by + rintro n ⟨hn_tc, hnn₂⟩ + by_cases hnn₁ : n = n₁ + · subst hnn₁; exact Or.inl hv₁_X₁ + · right + refine ⟨⟨n, hn_tc, rfl⟩, ?_⟩ + rintro (hEq | hEq) + · exact hnn₁ (π.nodeVertex_injOn (htc₀_dom hn_tc) (htc₀_dom hn₁) hEq) + · exact hnn₂ (π.nodeVertex_injOn (htc₀_dom hn_tc) (htc₀_dom hn₂) hEq) + have hA₂_tc : ∀ n ∈ tilde c₀ \ {n₁}, π.nodeVertex n ∈ A₂.vertexSet := by + rintro n ⟨hn_tc, hnn₁⟩ + by_cases hnn₂ : n = n₂ + · subst hnn₂; exact ⟨hv₂_mem, hv₂_not_X₁⟩ + · have hnK : π.nodeVertex n ∈ K := by + refine ⟨⟨n, hn_tc, rfl⟩, ?_⟩ + rintro (hEq | hEq) + · exact hnn₁ (π.nodeVertex_injOn (htc₀_dom hn_tc) (htc₀_dom hn₁) hEq) + · exact hnn₂ (π.nodeVertex_injOn (htc₀_dom hn_tc) (htc₀_dom hn₂) hEq) + exact ⟨hK_sub hnK, fun hX₁ => hX₁.1.2 hnK⟩ + have hA₁_not_n₂ : π.nodeVertex n₂ ∉ A₁.vertexSet := by + rintro (hX₁ | hK) + · exact hv₂_not_X₁ hX₁ + · exact hv₂_not_K hK + have hA₂_not_n₁ : π.nodeVertex n₁ ∉ A₂.vertexSet := fun h => h.2 hv₁_X₁ + have hA_inter_V : A₁.vertexSet ∩ A₂.vertexSet ⊆ π.nodeVertex '' (tilde c₀ \ {n₁, n₂}) := by + rintro z ⟨hX₁ | ⟨⟨n, hn_tc, rfl⟩, hnot_pair⟩, _, hnot_X₁⟩ + · exact (hnot_X₁ hX₁).elim + · refine ⟨n, ⟨hn_tc, ?_⟩, rfl⟩ + rintro (rfl | rfl) + · exact hnot_pair (Or.inl rfl) + · exact hnot_pair (Or.inr rfl) + obtain ⟨π', hπ'_central, hπ'_res, hπ'_truer, _⟩ := + exists_truer_of_splitInternalCell h𝒯 (by omega) π htrue.1 hdom hc₀ hint₀ htc₀_ge2 + hn₁ hn₂ hne hA₁_le hA₂_le hA_union_V hA_union_E hA_disj_E + hA₁_tc hA₂_tc hA₁_not_n₂ hA₂_not_n₁ hA_inter_V + exact htrue.2.2 π' hπ'_central hπ'_truer hπ'_res + +/-! ## 2. Three-Ended Internal Cell Separation: (9.2) (Page 184) -/ + +private theorem exists_subdisc_inter_discBd_eq_pair {S : Type*} [TopologicalSpace S] [T2Space S] + {D : Set S} (hD : IsClosedDisc D) {s t : S} + (hs : s ∈ discBd D) (ht : t ∈ discBd D) (hst : s ≠ t) : + ∃ Δ : Set S, IsClosedDisc Δ ∧ Δ ⊆ D ∧ s ∈ Δ ∧ t ∈ Δ ∧ Δ ∩ discBd D = {s, t} := by + obtain ⟨F₁, hF₁_sub, hF₁_line, hF₁_bd, _⟩ := + exists_chord_in_closedDisc hD hs ht hst + obtain ⟨B₁, B₂, G₁, G₂, _, hB_comp, hG₁_disc, _, hG_union, hG_inter, hG₁_bd, _, _⟩ := + disc_iArc D F₁ s t hD hF₁_sub hst hF₁_line hF₁_bd + have hG₁_sub : G₁ ⊆ D := hG_union ▸ subset_union_left + have hF₁_G₁ : F₁ ⊆ G₁ := hG_inter ▸ inter_subset_left + have hs_F₁ : s ∈ F₁ := by + have : s ∈ F₁ ∩ discBd D := by rw [hF₁_bd]; exact Or.inl rfl + exact this.1 + have ht_F₁ : t ∈ F₁ := by + have : t ∈ F₁ ∩ discBd D := by rw [hF₁_bd]; exact Or.inr rfl + exact this.1 + have hs_bdG₁ : s ∈ discBd G₁ := hG₁_bd ▸ Or.inr hs_F₁ + have ht_bdG₁ : t ∈ discBd G₁ := hG₁_bd ▸ Or.inr ht_F₁ + have hB₁_mem : B₁ ∈ componentsIn (discBd D \ {s, t}) := by rw [hB_comp]; exact Or.inl rfl + rcases hB₁_mem with ⟨x₁, hx₁_diff, hB₁_eq⟩ + have hB₁_sub_diff : B₁ ⊆ discBd G₁ \ {s, t} := by + intro x hxB₁ + have hx_bdD : x ∈ discBd D \ {s, t} := by + rw [← hB₁_eq] at hxB₁ + exact connectedComponentIn_subset (discBd D \ {s, t}) x₁ hxB₁ + exact ⟨hG₁_bd ▸ Or.inl hxB₁, hx_bdD.2⟩ + have hx₁_B₁ : x₁ ∈ B₁ := hB₁_eq ▸ mem_connectedComponentIn hx₁_diff + have hB₁_preconn : IsPreconnected B₁ := hB₁_eq ▸ isPreconnected_connectedComponentIn + obtain ⟨F₂, hF₂_sub, hF₂_line, hF₂_bd, _⟩ := + exists_chord_in_closedDisc hG₁_disc hs_bdG₁ ht_bdG₁ hst + obtain ⟨C₁, C₂, H₁, H₂, hC_ne, hC_comp, hH₁_disc, hH₂_disc, hH_union, hH_inter, + hH₁_bd, hH₂_bd, _⟩ := + disc_iArc G₁ F₂ s t hG₁_disc hF₂_sub hst hF₂_line hF₂_bd + have hs_F₂ : s ∈ F₂ := by + have : s ∈ F₂ ∩ discBd G₁ := by rw [hF₂_bd]; exact Or.inl rfl + exact this.1 + have ht_F₂ : t ∈ F₂ := by + have : t ∈ F₂ ∩ discBd G₁ := by rw [hF₂_bd]; exact Or.inr rfl + exact this.1 + have hx₁_diffG₁ : x₁ ∈ discBd G₁ \ {s, t} := hB₁_sub_diff hx₁_B₁ + have hcomp_mem : connectedComponentIn (discBd G₁ \ {s, t}) x₁ ∈ ({C₁, C₂} : Set (Set S)) := by + rw [← hC_comp] + exact ⟨x₁, hx₁_diffG₁, rfl⟩ + have hB₁_in_comp : B₁ ⊆ connectedComponentIn (discBd G₁ \ {s, t}) x₁ := + hB₁_preconn.subset_connectedComponentIn hx₁_B₁ hB₁_sub_diff + have hC₁_mem : C₁ ∈ componentsIn (discBd G₁ \ {s, t}) := by rw [hC_comp]; exact Or.inl rfl + have hC₂_mem : C₂ ∈ componentsIn (discBd G₁ \ {s, t}) := by rw [hC_comp]; exact Or.inr rfl + have hC_disj : Disjoint C₁ C₂ := by + rcases hC₁_mem with ⟨y₁, hy₁, rfl⟩ + rcases hC₂_mem with ⟨y₂, hy₂, rfl⟩ + refine Set.disjoint_left.mpr fun z hz₁ hz₂ => hC_ne ?_ + rw [connectedComponentIn_eq hz₁, connectedComponentIn_eq hz₂] + have hchoose_H : ∃ C Δ : Set S, IsClosedDisc Δ ∧ Δ ⊆ G₁ ∧ F₂ ⊆ Δ ∧ + discBd Δ = C ∪ F₂ ∧ Disjoint C B₁ := by + rcases hcomp_mem with hEq | hEq + · refine ⟨C₂, H₂, hH₂_disc, hH_union ▸ subset_union_right, ?_, hH₂_bd, ?_⟩ + · rw [← hH_inter]; exact inter_subset_right + · exact hC_disj.symm.mono_right (hEq ▸ hB₁_in_comp) + · have hEq' : connectedComponentIn (discBd G₁ \ {s, t}) x₁ = C₂ := hEq + refine ⟨C₁, H₁, hH₁_disc, hH_union ▸ subset_union_left, ?_, hH₁_bd, ?_⟩ + · rw [← hH_inter]; exact inter_subset_left + · exact hC_disj.mono_right (hEq' ▸ hB₁_in_comp) + obtain ⟨C, Δ, hΔ_disc, hΔ_sub_G₁, hF₂_Δ, hΔ_bd, hC_disj_B₁⟩ := hchoose_H + have hΔ_sub : Δ ⊆ D := hΔ_sub_G₁.trans hG₁_sub + refine ⟨Δ, hΔ_disc, hΔ_sub, hF₂_Δ hs_F₂, hF₂_Δ ht_F₂, Subset.antisymm ?_ ?_⟩ + · rintro x ⟨hxΔ, hx_bdD⟩ + have hx_bdG₁ : x ∈ discBd G₁ := + disc_inter_discBd_subset_discBd hD hG₁_disc hG₁_sub ⟨hΔ_sub_G₁ hxΔ, hx_bdD⟩ + have hx_bdΔ : x ∈ discBd Δ := + disc_inter_discBd_subset_discBd hD hΔ_disc hΔ_sub ⟨hxΔ, hx_bdD⟩ + rw [hΔ_bd] at hx_bdΔ + rcases hx_bdΔ with hxC | hxF₂ + · have hxF₁ : x ∈ F₁ := by + rw [hG₁_bd] at hx_bdG₁ + exact hx_bdG₁.resolve_left (Set.disjoint_left.mp hC_disj_B₁ hxC) + have : x ∈ F₁ ∩ discBd D := ⟨hxF₁, hx_bdD⟩ + rwa [hF₁_bd] at this + · have : x ∈ F₂ ∩ discBd G₁ := ⟨hxF₂, hx_bdG₁⟩ + rwa [hF₂_bd] at this + · rintro x (rfl | rfl) + · exact ⟨hF₂_Δ hs_F₂, hs⟩ + · exact ⟨hF₂_Δ ht_F₂, ht⟩ + +private theorem exists_discs_for_9_2 {S : Type} [TopologicalSpace S] [T2Space S] + (Γ : Painting S) {c₀ : Set S} (hc₀ : c₀ ∈ Γ.C) + {n₁ n₂ n₃ : S} (htc₀ : tilde c₀ = {n₁, n₂, n₃}) + (h12 : n₁ ≠ n₂) (h13 : n₁ ≠ n₃) (h23 : n₂ ≠ n₃) : + ∃ n₀ ∈ c₀, ∃ Δ₁ Δ₂ : Set S, + IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ + Δ₁ ⊆ closure c₀ ∧ Δ₂ ⊆ closure c₀ ∧ + Δ₁ ∩ Δ₂ = {n₀} ∧ + Δ₁ ∩ insert n₀ Γ.N = {n₀, n₁, n₃} ∧ + Δ₂ ∩ insert n₀ Γ.N = {n₀, n₂} ∧ + Δ₁ ∩ insert n₀ Γ.N ⊆ discBd Δ₁ ∧ + Δ₂ ∩ insert n₀ Γ.N ⊆ discBd Δ₂ := by + have hD : IsClosedDisc (closure c₀) := Γ.isClosedDisc_closure_cell hc₀ + have htc₀_bd : tilde c₀ ⊆ discBd (closure c₀) := (Γ.cell_disc c₀ hc₀).2.1 + have hn₁_tc : n₁ ∈ tilde c₀ := htc₀ ▸ Or.inl rfl + have hn₂_tc : n₂ ∈ tilde c₀ := htc₀ ▸ Or.inr (Or.inl rfl) + have hn₃_tc : n₃ ∈ tilde c₀ := htc₀ ▸ Or.inr (Or.inr rfl) + have hn₁_bd : n₁ ∈ discBd (closure c₀) := htc₀_bd hn₁_tc + have hn₂_bd : n₂ ∈ discBd (closure c₀) := htc₀_bd hn₂_tc + have hn₃_bd : n₃ ∈ discBd (closure c₀) := htc₀_bd hn₃_tc + obtain ⟨F₁, hF₁_sub, hF₁_line, hF₁_bd, _⟩ := + exists_chord_in_closedDisc hD hn₁_bd hn₃_bd h13 + obtain ⟨ev, hev0, hev1⟩ := hF₁_line + let u₀ : 𝕀 := ⟨1 / 2, by constructor <;> norm_num⟩ + let n₀ : S := (ev u₀).1 + have hn₀_F₁ : n₀ ∈ F₁ := (ev u₀).2 + have hn₀_ne_n₁ : n₀ ≠ n₁ := fun h => by + have hEq : ev u₀ = ev 0 := Subtype.ext (h.trans hev0.symm) + have hval := congrArg Subtype.val (ev.injective hEq) + norm_num [u₀] at hval + have hn₀_ne_n₃ : n₀ ≠ n₃ := fun h => by + have hEq : ev u₀ = ev 1 := Subtype.ext (h.trans hev1.symm) + have hval := congrArg Subtype.val (ev.injective hEq) + norm_num [u₀] at hval + have hn₀_not_bd : n₀ ∉ discBd (closure c₀) := by + intro hbd + have : n₀ ∈ F₁ ∩ discBd (closure c₀) := ⟨hn₀_F₁, hbd⟩ + rw [hF₁_bd] at this + rcases this with hEq | hEq + · exact hn₀_ne_n₁ hEq + · exact hn₀_ne_n₃ hEq + have hn₀_c₀ : n₀ ∈ c₀ := by + have hcl : n₀ ∈ closure c₀ := hF₁_sub hn₀_F₁ + by_contra hnot + exact hn₀_not_bd (htc₀_bd ⟨hcl, hnot⟩) + obtain ⟨A₁, A₂, E₁, E₂, _, _, hE₁_disc, hE₂_disc, hE_union, hE_inter, hE₁_bd, hE₂_bd, _⟩ := + disc_iArc (closure c₀) F₁ n₁ n₃ hD hF₁_sub h13 ⟨ev, hev0, hev1⟩ hF₁_bd + have hn₁_F₁ : n₁ ∈ F₁ := by + have : n₁ ∈ F₁ ∩ discBd (closure c₀) := by rw [hF₁_bd]; exact Or.inl rfl + exact this.1 + have hn₃_F₁ : n₃ ∈ F₁ := by + have : n₃ ∈ F₁ ∩ discBd (closure c₀) := by rw [hF₁_bd]; exact Or.inr rfl + exact this.1 + have hn₂_not_F₁ : n₂ ∉ F₁ := by + intro hmem + have : n₂ ∈ F₁ ∩ discBd (closure c₀) := ⟨hmem, hn₂_bd⟩ + rw [hF₁_bd] at this + rcases this with hEq | hEq + · exact h12 hEq.symm + · exact h23 hEq + have hn₂_D : n₂ ∈ E₁ ∪ E₂ := hE_union.symm ▸ discBd_subset (closure c₀) hn₂_bd + have hhalf : ∃ Δ₁ D' : Set S, IsClosedDisc Δ₁ ∧ IsClosedDisc D' ∧ + Δ₁ ⊆ closure c₀ ∧ D' ⊆ closure c₀ ∧ Δ₁ ∩ D' = F₁ ∧ + F₁ ⊆ discBd Δ₁ ∧ F₁ ⊆ discBd D' ∧ + n₂ ∉ Δ₁ ∧ n₂ ∈ discBd D' := by + rcases hn₂_D with hn₂_E₁ | hn₂_E₂ + · have hn₂_not_E₂ : n₂ ∉ E₂ := fun h => hn₂_not_F₁ (hE_inter ▸ ⟨hn₂_E₁, h⟩) + have hE₁_sub : E₁ ⊆ closure c₀ := hE_union ▸ subset_union_left + have hE₂_sub : E₂ ⊆ closure c₀ := hE_union ▸ subset_union_right + refine ⟨E₂, E₁, hE₂_disc, hE₁_disc, hE₂_sub, hE₁_sub, ?_, ?_, ?_, hn₂_not_E₂, ?_⟩ + · rw [Set.inter_comm, hE_inter] + · rw [hE₂_bd]; exact subset_union_right + · rw [hE₁_bd]; exact subset_union_right + · exact disc_inter_discBd_subset_discBd hD hE₁_disc hE₁_sub ⟨hn₂_E₁, hn₂_bd⟩ + · have hn₂_not_E₁ : n₂ ∉ E₁ := fun h => hn₂_not_F₁ (hE_inter ▸ ⟨h, hn₂_E₂⟩) + have hE₁_sub : E₁ ⊆ closure c₀ := hE_union ▸ subset_union_left + have hE₂_sub : E₂ ⊆ closure c₀ := hE_union ▸ subset_union_right + refine ⟨E₁, E₂, hE₁_disc, hE₂_disc, hE₁_sub, hE₂_sub, hE_inter, ?_, ?_, hn₂_not_E₁, ?_⟩ + · rw [hE₁_bd]; exact subset_union_right + · rw [hE₂_bd]; exact subset_union_right + · exact disc_inter_discBd_subset_discBd hD hE₂_disc hE₂_sub ⟨hn₂_E₂, hn₂_bd⟩ + obtain ⟨Δ₁, D', hΔ₁_disc, hD'_disc, hΔ₁_sub, hD'_sub, hΔ₁D'_inter, hF₁_bdΔ₁, + hF₁_bdD', hn₂_not_Δ₁, hn₂_bdD'⟩ := hhalf + have hF₁_Δ₁ : F₁ ⊆ Δ₁ := hF₁_bdΔ₁.trans (discBd_subset Δ₁) + have hn₀_bdD' : n₀ ∈ discBd D' := hF₁_bdD' hn₀_F₁ + have h20 : n₂ ≠ n₀ := fun h => hn₀_not_bd (h ▸ hn₂_bd) + obtain ⟨Δ₂, hΔ₂_disc, hΔ₂_sub', hn₂_Δ₂, hn₀_Δ₂, hΔ₂_bdD'_inter⟩ := + exists_subdisc_inter_discBd_eq_pair hD'_disc hn₂_bdD' hn₀_bdD' h20 + have hΔ₂_sub : Δ₂ ⊆ closure c₀ := hΔ₂_sub'.trans hD'_sub + have hinter : Δ₁ ∩ Δ₂ = {n₀} := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨hx₁, hx₂⟩ + have hxF₁ : x ∈ F₁ := hΔ₁D'_inter ▸ ⟨hx₁, hΔ₂_sub' hx₂⟩ + have hx_pair : x ∈ ({n₂, n₀} : Set S) := hΔ₂_bdD'_inter ▸ ⟨hx₂, hF₁_bdD' hxF₁⟩ + rcases hx_pair with rfl | rfl + · exact (hn₂_not_Δ₁ hx₁).elim + · rfl + · rintro x rfl + exact ⟨hF₁_Δ₁ hn₀_F₁, hn₀_Δ₂⟩ + have hcl_inter_N : closure c₀ ∩ Γ.N = {n₁, n₂, n₃} := by + rw [← htc₀] + ext x + simp only [mem_inter_iff, tilde, mem_sdiff] + exact ⟨fun ⟨hxcl, hxN⟩ => ⟨hxcl, fun hxc₀ => (Γ.cell_subset_diff hc₀ hxc₀).2 hxN⟩, + fun hxtc₀ => ⟨hxtc₀.1, Γ.tilde_subset_N hc₀ hxtc₀⟩⟩ + have hΔ₁_N' : Δ₁ ∩ insert n₀ Γ.N = {n₀, n₁, n₃} := by + ext x + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨hx₁, rfl | hxN⟩ + · exact Or.inl rfl + · have hx3 : x ∈ ({n₁, n₂, n₃} : Set S) := hcl_inter_N ▸ ⟨hΔ₁_sub hx₁, hxN⟩ + rcases hx3 with rfl | rfl | rfl + · exact Or.inr (Or.inl rfl) + · exact (hn₂_not_Δ₁ hx₁).elim + · exact Or.inr (Or.inr rfl) + · rintro (rfl | rfl | rfl) + · exact ⟨hF₁_Δ₁ hn₀_F₁, Or.inl rfl⟩ + · exact ⟨hF₁_Δ₁ hn₁_F₁, Or.inr (Γ.tilde_subset_N hc₀ hn₁_tc)⟩ + · exact ⟨hF₁_Δ₁ hn₃_F₁, Or.inr (Γ.tilde_subset_N hc₀ hn₃_tc)⟩ + have hΔ₂_N' : Δ₂ ∩ insert n₀ Γ.N = {n₀, n₂} := by + ext x + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨hx₂, hxn₀ | hxN⟩ + · exact Or.inl hxn₀ + · have hx3 : x ∈ ({n₁, n₂, n₃} : Set S) := hcl_inter_N ▸ ⟨hΔ₂_sub hx₂, hxN⟩ + rcases hx3 with hEq | hEq | hEq + · have : n₁ ∈ Δ₁ ∩ Δ₂ := ⟨hF₁_Δ₁ hn₁_F₁, hEq ▸ hx₂⟩ + rw [hinter] at this + exact (hn₀_ne_n₁ this.symm).elim + · exact Or.inr hEq + · have : n₃ ∈ Δ₁ ∩ Δ₂ := ⟨hF₁_Δ₁ hn₃_F₁, hEq ▸ hx₂⟩ + rw [hinter] at this + exact (hn₀_ne_n₃ this.symm).elim + · rintro (rfl | rfl) + · exact ⟨hn₀_Δ₂, Or.inl rfl⟩ + · exact ⟨hn₂_Δ₂, Or.inr (Γ.tilde_subset_N hc₀ hn₂_tc)⟩ + have hΔ₁_bdN' : Δ₁ ∩ insert n₀ Γ.N ⊆ discBd Δ₁ := by + rw [hΔ₁_N'] + rintro x (rfl | rfl | rfl) + · exact hF₁_bdΔ₁ hn₀_F₁ + · exact hF₁_bdΔ₁ hn₁_F₁ + · exact hF₁_bdΔ₁ hn₃_F₁ + have hΔ₂_bdN' : Δ₂ ∩ insert n₀ Γ.N ⊆ discBd Δ₂ := by + rw [hΔ₂_N'] + rintro x (rfl | rfl) + · exact disc_inter_discBd_subset_discBd hD'_disc hΔ₂_disc hΔ₂_sub' ⟨hn₀_Δ₂, hn₀_bdD'⟩ + · exact disc_inter_discBd_subset_discBd hD'_disc hΔ₂_disc hΔ₂_sub' ⟨hn₂_Δ₂, hn₂_bdD'⟩ + exact ⟨n₀, hn₀_c₀, Δ₁, Δ₂, hΔ₁_disc, hΔ₂_disc, hΔ₁_sub, hΔ₂_sub, hinter, + hΔ₁_N', hΔ₂_N', hΔ₁_bdN', hΔ₂_bdN'⟩ + +open Classical in +private noncomputable abbrev split_internal_cell_with_new_node_portrayal + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {c₀ : Set π.S} + (hc₀ : c₀ ∈ π.Γ.C) + (hint₀ : ¬(c₀ ∩ bd π.S).Nonempty) + {n₁ : π.S} + {n₂ : π.S} + {n₃ : π.S} + (htc₀ : tilde c₀ = {n₁, n₂, n₃}) + (hcard3 : (tilde c₀).ncard = 3) + {A₁ : Hypergraph α β} + {A₂ : Hypergraph α β} + {A₃ : Hypergraph α β} + {v : α} + (hA₁_le : A₁ ≤ π.cellGraph c₀) + (hA₂_le : A₂ ≤ π.cellGraph c₀) + (hA₃_le : A₃ ≤ π.cellGraph c₀) + (hv : v ∈ (π.cellGraph c₀).vertexSet) + (hn₁_A₁ : π.nodeVertex n₁ ∈ A₁.vertexSet) + (hn₂_A₂ : π.nodeVertex n₂ ∈ A₂.vertexSet) + (hn₃_A₃ : π.nodeVertex n₃ ∈ A₃.vertexSet) + (hA_union : A₁ ∪ A₂ ∪ A₃ = π.cellGraph c₀) + (hdom : π.domγ = π.Γ.N) + (hn₁_tc : n₁ ∈ tilde c₀) + (hn₂_tc : n₂ ∈ tilde c₀) + (hn₃_tc : n₃ ∈ tilde c₀) + (htc₀_dom : tilde c₀ ⊆ π.domγ) + (hA₁₃_le : A₁ ∪ A₃ ≤ π.cellGraph c₀) + (hA₂₃_le : A₂ ∪ A₃ ≤ π.cellGraph c₀) + (hsep_1_23 : (π.cellGraph c₀).IsSeparation A₁ (A₂ ∪ A₃)) + (hsep_13_2 : (π.cellGraph c₀).IsSeparation (A₁ ∪ A₃) A₂) + (hv_not_tc₀ : ∀ n ∈ tilde c₀, v ≠ π.nodeVertex n) + (hv_not_other : ∀ d ∈ π.Γ.C, d ≠ c₀ → v ∉ (π.cellGraph d).vertexSet) + (hv_not_nodeVertex : ∀ n ∈ π.Γ.N, v ≠ π.nodeVertex n) + (hv_not_borderSet : ∀ n ∈ π.Γ.N ∩ bd π.S, v ∉ π.borderSet n) + (n₀ : π.S) + (hn₀_c₀ : n₀ ∈ c₀) + (Δ₁ : Set π.S) + (Δ₂ : Set π.S) + (hΔ₁_sub : Δ₁ ⊆ closure c₀) + (hΔ₂_sub : Δ₂ ⊆ closure c₀) + (hΔ_inter : Δ₁ ∩ Δ₂ = {n₀}) + (hΔ₁_N' : Δ₁ ∩ insert n₀ π.Γ.N = {n₀, n₁, n₃}) + (hΔ₂_N' : Δ₂ ∩ insert n₀ π.Γ.N = {n₀, n₂}) + (hΔ₁_bdN' : Δ₁ ∩ insert n₀ π.Γ.N ⊆ discBd Δ₁) + (hΔ₂_bdN' : Δ₂ ∩ insert n₀ π.Γ.N ⊆ discBd Δ₂) + (hn₀_not_N : n₀ ∉ π.Γ.N) + (hn₀_not_bd : n₀ ∉ bd π.S) + (hn₀_not_tc₀ : n₀ ∉ tilde c₀) + (hn₀_ne_n₁ : n₀ ≠ n₁) + (hn₀_ne_n₂ : n₀ ≠ n₂) + (hn₀_ne_n₃ : n₀ ≠ n₃) + (N' : Set π.S) + (hN' : N' = insert n₀ π.Γ.N) + (hN_sub : π.Γ.N ⊆ N') + (hN'_fin : N'.Finite) + (hN'_diff : N' \ π.Γ.N ⊆ Δ₁ ∩ Δ₂) + (hΔ_inter_N' : Δ₁ ∩ Δ₂ ⊆ N') + (hΔ₁_card : (Δ₁ ∩ N').ncard = 3) + (hΔ₂_card : (Δ₂ ∩ N').ncard = 2) + (c₁ : Set π.S) + (c₂ : Set π.S) + (Γ₁ : Painting π.S) + (hΓN : Γ₁.N = N') + (hC₁ : Γ₁.C = insert c₁ (insert c₂ (π.Γ.C \ {c₀}))) + (htc₁ : tilde c₁ = {n₀, n₁, n₃}) + (htc₂ : tilde c₂ = {n₀, n₂}) + (hc₁_sub_c₀ : c₁ ⊆ c₀) + (hc₂_sub_c₀ : c₂ ⊆ c₀) + (hc₁_ne : c₁.Nonempty) + (hc₂_ne : c₂.Nonempty) + (hc₁_disj_c₂ : Disjoint c₁ c₂) + (hc₁_ne_c₂ : c₁ ≠ c₂) + (hc₁_not_I₀ : ∀ d ∈ π.Γ.C \ {c₀}, d ≠ c₁) + (hc₂_not_I₀ : ∀ d ∈ π.Γ.C \ {c₀}, d ≠ c₂) + (hint₁ : ¬(c₁ ∩ bd π.S).Nonempty) + (hint₂ : ¬(c₂ ∩ bd π.S).Nonempty) + (hc₁_C₁ : c₁ ∈ Γ₁.C) + (hc₂_C₁ : c₂ ∈ Γ₁.C) + (cellG₁ : Set π.S → Hypergraph α β) + (nodeV₁ : π.S → α) + (hcellG₁_c₁ : cellG₁ c₁ = A₁ ∪ A₃) + (hcellG₁_c₂ : cellG₁ c₂ = A₂) + (hcellG₁_other : ∀ d ∈ π.Γ.C \ {c₀}, cellG₁ d = π.cellGraph d) + (hnodeV₁_n₀ : nodeV₁ n₀ = v) + (hnodeV₁_other : ∀ n ∈ π.Γ.N, nodeV₁ n = π.nodeVertex n) + (hbd_N' : N' ∩ bd π.S = π.Γ.N ∩ bd π.S) + (hcellG₁_le : ∀ c ∈ Γ₁.C, cellG₁ c ≤ G) + (hv_mem_A₁ : v ∈ A₁.vertexSet) + (hv_mem_A₂ : v ∈ A₂.vertexSet) + (hp5_aux₁ : ∀ c ∈ Γ₁.C, ¬(c ∩ bd π.S).Nonempty → ∀ w ∈ (cellG₁ c).vertexSet, (∃ d ∈ Γ₁.C, d ≠ + c ∧ w ∈ (cellG₁ d).vertexSet) → w ∈ nodeV₁ '' (tilde c ∩ N')) + (hΘ_bd : ∀ Θ ∈ cuffs π.S, Θ ⊆ bd π.S) + (hN'_Θ : ∀ Θ ∈ cuffs π.S, N' ∩ Θ = π.Γ.N ∩ Θ) : Portrayal G := by + subst N' + let N' : Set π.S := insert n₀ π.Γ.N + exact { + S := π.S + top := π.top + isSurface := π.isSurface + connected := π.connected + Γ := Γ₁ + cellGraph := cellG₁ + borderSet := π.borderSet + domγ := N' + nodeVertex := nodeV₁ + cellGraph_le := hcellG₁_le + borderSet_subset := fun n hn => π.borderSet_subset n (hbd_N' ▸ hΓN ▸ hn) + domγ_subset := hΓN.symm ▸ Subset.rfl + nodeVertex_mem := fun n hn => by + rcases hn with rfl | hnN + · rw [hnodeV₁_n₀]; exact (π.cellGraph_le c₀ hc₀).1 hv + · rw [hnodeV₁_other n hnN]; exact π.nodeVertex_mem n (hdom ▸ hnN) + nodeVertex_injOn := fun x hx y hy hEq => by + rcases hx with rfl | hxN <;> rcases hy with rfl | hyN + · rfl + · rw [hnodeV₁_n₀, hnodeV₁_other y hyN] at hEq + exact (hv_not_nodeVertex y hyN hEq).elim + · rw [hnodeV₁_other x hxN, hnodeV₁_n₀] at hEq + exact (hv_not_nodeVertex x hxN hEq.symm).elim + · rw [hnodeV₁_other x hxN, hnodeV₁_other y hyN] at hEq + exact π.nodeVertex_injOn (hdom ▸ hxN) (hdom ▸ hyN) hEq + p1_vertex := fun w hw => by + obtain ⟨c, hc, hwc⟩ := π.p1_vertex w hw + by_cases hcc₀ : c = c₀ + · subst hcc₀ + have hwc_union : w ∈ (A₁ ∪ A₂ ∪ A₃).vertexSet := hA_union.symm ▸ hwc + rcases hwc_union with (hw₁ | hw₂) | hw₃ + · exact ⟨c₁, hc₁_C₁, hcellG₁_c₁.symm ▸ Or.inl hw₁⟩ + · exact ⟨c₂, hc₂_C₁, hcellG₁_c₂.symm ▸ hw₂⟩ + · exact ⟨c₁, hc₁_C₁, hcellG₁_c₁.symm ▸ Or.inr hw₃⟩ + · exact ⟨c, hC₁.symm ▸ Or.inr (Or.inr ⟨hc, hcc₀⟩), + (hcellG₁_other c ⟨hc, hcc₀⟩).symm ▸ hwc⟩ + p1_edge := fun e he => by + obtain ⟨c, hc, hec⟩ := π.p1_edge e he + by_cases hcc₀ : c = c₀ + · subst hcc₀ + have hec_union : e ∈ (A₁ ∪ A₂ ∪ A₃).edgeSet := hA_union.symm ▸ hec + rcases hec_union with (he₁ | he₂) | he₃ + · exact ⟨c₁, hc₁_C₁, hcellG₁_c₁.symm ▸ Or.inl he₁⟩ + · exact ⟨c₂, hc₂_C₁, hcellG₁_c₂.symm ▸ he₂⟩ + · exact ⟨c₁, hc₁_C₁, hcellG₁_c₁.symm ▸ Or.inr he₃⟩ + · exact ⟨c, hC₁.symm ▸ Or.inr (Or.inr ⟨hc, hcc₀⟩), + (hcellG₁_other c ⟨hc, hcc₀⟩).symm ▸ hec⟩ + p1_disjoint := fun d₁ hd₁ d₂ hd₂ hne => by + rw [hC₁] at hd₁ hd₂ + rcases hd₁ with rfl | rfl | hd₁I <;> rcases hd₂ with rfl | rfl | hd₂I + · exact (hne rfl).elim + · rw [hcellG₁_c₁, hcellG₁_c₂] + exact hsep_13_2.disjoint_edgeSet + · rw [hcellG₁_c₁, hcellG₁_other d₂ hd₂I] + exact (π.p1_disjoint c₀ hc₀ d₂ hd₂I.1 (Ne.symm hd₂I.2)).mono_left hA₁₃_le.2 + · rw [hcellG₁_c₂, hcellG₁_c₁] + exact hsep_13_2.disjoint_edgeSet.symm + · exact (hne rfl).elim + · rw [hcellG₁_c₂, hcellG₁_other d₂ hd₂I] + exact (π.p1_disjoint c₀ hc₀ d₂ hd₂I.1 (Ne.symm hd₂I.2)).mono_left hA₂_le.2 + · rw [hcellG₁_other d₁ hd₁I, hcellG₁_c₁] + exact (π.p1_disjoint d₁ hd₁I.1 c₀ hc₀ hd₁I.2).mono_right hA₁₃_le.2 + · rw [hcellG₁_other d₁ hd₁I, hcellG₁_c₂] + exact (π.p1_disjoint d₁ hd₁I.1 c₀ hc₀ hd₁I.2).mono_right hA₂_le.2 + · rw [hcellG₁_other d₁ hd₁I, hcellG₁_other d₂ hd₂I] + exact π.p1_disjoint d₁ hd₁I.1 d₂ hd₂I.1 hne + p2 := fun c hc n hn => by + rw [hC₁] at hc + rcases hc with rfl | rfl | hcI + · rw [hcellG₁_c₁] + have hntc₁ : n ∈ ({n₀, n₁, n₃} : Set π.S) := htc₁ ▸ hn.1 + rcases hntc₁ with hEq | hEq | hEq + · rw [hEq, hnodeV₁_n₀]; exact Or.inl hv_mem_A₁ + · rw [hEq, hnodeV₁_other n₁ (π.Γ.tilde_subset_N hc₀ hn₁_tc)]; exact Or.inl hn₁_A₁ + · rw [hEq, hnodeV₁_other n₃ (π.Γ.tilde_subset_N hc₀ hn₃_tc)]; exact Or.inr hn₃_A₃ + · rw [hcellG₁_c₂] + have hntc₂ : n ∈ ({n₀, n₂} : Set π.S) := htc₂ ▸ hn.1 + rcases hntc₂ with hEq | hEq + · rw [hEq, hnodeV₁_n₀]; exact hv_mem_A₂ + · rw [hEq, hnodeV₁_other n₂ (π.Γ.tilde_subset_N hc₀ hn₂_tc)]; exact hn₂_A₂ + · rw [hcellG₁_other c hcI] + have hnN : n ∈ π.Γ.N := π.Γ.tilde_subset_N hcI.1 hn.1 + rw [hnodeV₁_other n hnN] + exact π.p2 c hcI.1 n ⟨hn.1, hdom ▸ hnN⟩ + p3_notMem := fun n hn => by + have hn' : n ∈ π.Γ.N ∩ bd π.S := hbd_N' ▸ hn + rw [hnodeV₁_other n hn'.1] + exact π.p3_notMem n ⟨hdom ▸ hn'.1, hn'.2⟩ + p3_subset := fun c hc hbd n hn => by + rw [hC₁] at hc + rcases hc with rfl | rfl | hcI + · exact (hint₁ hbd).elim + · exact (hint₂ hbd).elim + · rw [hcellG₁_other c hcI] + exact π.p3_subset c hcI.1 hbd n hn + p4_disjoint := fun Θ₁ hΘ₁ Θ₂ hΘ₂ hne m₁ hm₁ m₂ hm₂ => + π.p4_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ hne m₁ (hN'_Θ Θ₁ hΘ₁ ▸ hΓN ▸ hm₁) m₂ (hN'_Θ Θ₂ hΘ₂ ▸ hΓN ▸ hm₂) + p4_notMem := fun Θ hΘ m₁ hm₁ m₂ hm₂ hnot => by + have hm₁' : m₁ ∈ π.Γ.N ∩ Θ := hN'_Θ Θ hΘ ▸ hΓN ▸ hm₁ + rcases hm₂ with hEq | hm₂N + · rw [hEq, hnodeV₁_n₀] + exact hv_not_borderSet m₁ ⟨hm₁'.1, hΘ_bd Θ hΘ hm₁'.2⟩ + · rw [hnodeV₁_other m₂ hm₂N] + exact π.p4_notMem Θ hΘ m₁ hm₁' m₂ (hdom ▸ hm₂N) hnot + p5 := hp5_aux₁ + p6 := fun c hc hbd w hwc ⟨d, hd, hne_dc, hwd⟩ => by + rw [hC₁] at hc hd + rcases hc with rfl | rfl | hcI + · exact (hint₁ hbd).elim + · exact (hint₂ hbd).elim + · rw [hcellG₁_other c hcI] at hwc + have hw_bp : ∃ n ∈ tilde c, w ∈ π.borderSet n ∨ (n ∈ π.domγ ∧ w = π.nodeVertex n) := by + rcases hd with rfl | rfl | hdI + · rw [hcellG₁_c₁] at hwd + exact π.p6 c hcI.1 hbd w hwc ⟨c₀, hc₀, Ne.symm hcI.2, hA₁₃_le.1 hwd⟩ + · rw [hcellG₁_c₂] at hwd + exact π.p6 c hcI.1 hbd w hwc ⟨c₀, hc₀, Ne.symm hcI.2, hA₂_le.1 hwd⟩ + · rw [hcellG₁_other d hdI] at hwd + exact π.p6 c hcI.1 hbd w hwc ⟨d, hdI.1, hne_dc, hwd⟩ + rcases hw_bp with ⟨n, hn_tc, hwn | ⟨hn_dom, hwn⟩⟩ + · exact ⟨n, hn_tc, Or.inl hwn⟩ + · have hnN : n ∈ π.Γ.N := hdom ▸ hn_dom + exact ⟨n, hn_tc, Or.inr ⟨Or.inr hnN, hwn.trans (hnodeV₁_other n hnN).symm⟩⟩ + p7 := fun Θ hΘ m₁ hm₁ m₂ hm₂ m₃ hm₃ m₄ hm₄ hord w hw₁ hw₃ => by + have hm₁' : m₁ ∈ π.Γ.N ∩ Θ := hN'_Θ Θ hΘ ▸ hΓN ▸ hm₁ + have hm₂' : m₂ ∈ π.Γ.N ∩ Θ := hN'_Θ Θ hΘ ▸ hΓN ▸ hm₂ + have hm₃' : m₃ ∈ π.Γ.N ∩ Θ := hN'_Θ Θ hΘ ▸ hΓN ▸ hm₃ + have hm₄' : m₄ ∈ π.Γ.N ∩ Θ := hN'_Θ Θ hΘ ▸ hΓN ▸ hm₄ + have hbp_iff : ∀ m ∈ π.Γ.N ∩ Θ, + (w ∈ π.borderSet m ∨ (m ∈ N' ∧ w = nodeV₁ m)) ↔ + (w ∈ π.borderSet m ∨ (m ∈ π.domγ ∧ w = π.nodeVertex m)) := by + rintro m ⟨hmN, _⟩ + have hmN' : m ∈ N' := Or.inr hmN + have hmdom : m ∈ π.domγ := hdom ▸ hmN + simp [hmN', hmdom, hnodeV₁_other m hmN] + have hw₁' := (hbp_iff m₁ hm₁').mp hw₁ + have hw₃' := (hbp_iff m₃ hm₃').mp hw₃ + rcases π.p7 Θ hΘ m₁ hm₁' m₂ hm₂' m₃ hm₃' m₄ hm₄' hord w hw₁' hw₃' with hw₂' | hw₄' + · exact Or.inl ((hbp_iff m₂ hm₂').mpr hw₂') + · exact Or.inr ((hbp_iff m₄ hm₄').mpr hw₄') } + +private theorem new_node_split_shared_vertices_correspond_to_nodes + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {c₀ : Set π.S} + (hc₀ : c₀ ∈ π.Γ.C) + (hint₀ : ¬(c₀ ∩ bd π.S).Nonempty) + {n₁ : π.S} + {n₂ : π.S} + {n₃ : π.S} + (htc₀ : tilde c₀ = {n₁, n₂, n₃}) + {A₁ : Hypergraph α β} + {A₂ : Hypergraph α β} + {A₃ : Hypergraph α β} + {v : α} + (hA₂_le : A₂ ≤ π.cellGraph c₀) + (hv : v ∈ (π.cellGraph c₀).vertexSet) + (hn₁_A₁ : π.nodeVertex n₁ ∈ A₁.vertexSet) + (hn₂_A₂ : π.nodeVertex n₂ ∈ A₂.vertexSet) + (hn₃_A₃ : π.nodeVertex n₃ ∈ A₃.vertexSet) + (hV12 : (A₁ ∩ A₂).vertexSet = {v}) + (hV13 : (A₁ ∩ A₃).vertexSet = {v}) + (hV23 : (A₂ ∩ A₃).vertexSet = {v}) + (hdom : π.domγ = π.Γ.N) + (hA₁₃_le : A₁ ∪ A₃ ≤ π.cellGraph c₀) + (hV_1_23 : (A₁ ∩ (A₂ ∪ A₃)).vertexSet = {v}) + (hV_13_2 : ((A₁ ∪ A₃) ∩ A₂).vertexSet = {v}) + (hv_ne_n₁ : v ≠ π.nodeVertex n₁) + (hv_ne_n₂ : v ≠ π.nodeVertex n₂) + (hv_ne_n₃ : v ≠ π.nodeVertex n₃) + (hv_not_tc₀ : ∀ n ∈ tilde c₀, v ≠ π.nodeVertex n) + (hv_not_other : ∀ d ∈ π.Γ.C, d ≠ c₀ → v ∉ (π.cellGraph d).vertexSet) + (hv_not_nodeVertex : ∀ n ∈ π.Γ.N, v ≠ π.nodeVertex n) + (hv_not_borderSet : ∀ n ∈ π.Γ.N ∩ bd π.S, v ∉ π.borderSet n) + (n₀ : π.S) + (c₁ : Set π.S) + (c₂ : Set π.S) + (Γ₁ : Painting π.S) + (hC₁ : Γ₁.C = insert c₁ (insert c₂ (π.Γ.C \ {c₀}))) + (htc₁ : tilde c₁ = {n₀, n₁, n₃}) + (htc₂ : tilde c₂ = {n₀, n₂}) + (cellG₁ : Set π.S → Hypergraph α β) + (nodeV₁ : π.S → α) + (hcellG₁_c₁ : cellG₁ c₁ = A₁ ∪ A₃) + (hcellG₁_c₂ : cellG₁ c₂ = A₂) + (hcellG₁_other : ∀ d ∈ π.Γ.C \ {c₀}, cellG₁ d = π.cellGraph d) + (hnodeV₁_n₀ : nodeV₁ n₀ = v) + (hnodeV₁_other : ∀ n ∈ π.Γ.N, nodeV₁ n = π.nodeVertex n) + (hv_mem_A₁ : v ∈ A₁.vertexSet) + (hv_mem_A₂ : v ∈ A₂.vertexSet) + (hv_mem_A₃ : v ∈ A₃.vertexSet) : + ∀ c ∈ Γ₁.C, ¬(c ∩ bd π.S).Nonempty → ∀ w ∈ (cellG₁ c).vertexSet, (∃ d ∈ Γ₁.C, d ≠ c ∧ w ∈ + (cellG₁ d).vertexSet) → w ∈ nodeV₁ '' (tilde c ∩ (insert n₀ π.Γ.N)) := by + let N' := insert n₀ π.Γ.N + intro c hc hint w hwc ⟨d, hd, hne_dc, hwd⟩ + rw [hC₁] at hc hd + rcases hc with rfl | rfl | hcI + · rw [hcellG₁_c₁] at hwc + rw [htc₁] + rcases hd with rfl | rfl | hdI + · exact (hne_dc rfl).elim + · rw [hcellG₁_c₂] at hwd + have hw_v : w = v := by + have : w ∈ ((A₁ ∪ A₃) ∩ A₂).vertexSet := ⟨hwc, hwd⟩ + rwa [hV_13_2, mem_singleton_iff] at this + subst hw_v + exact ⟨n₀, ⟨Or.inl rfl, Or.inl rfl⟩, hnodeV₁_n₀⟩ + · rw [hcellG₁_other d hdI] at hwd + obtain ⟨n, ⟨hn_tc₀, hn_dom⟩, hnw⟩ := + π.p5 c₀ hc₀ hint₀ w (hA₁₃_le.1 hwc) ⟨d, hdI.1, hdI.2, hwd⟩ + have hnN : n ∈ π.Γ.N := hdom ▸ hn_dom + rw [htc₀] at hn_tc₀ + rcases hn_tc₀ with hEq | hEq | hEq + · exact ⟨n, ⟨Or.inr (Or.inl hEq), Or.inr hnN⟩, (hnodeV₁_other n hnN).trans hnw⟩ + · exfalso + have : π.nodeVertex n₂ ∈ ((A₁ ∪ A₃) ∩ A₂).vertexSet := ⟨hEq ▸ hnw ▸ hwc, hn₂_A₂⟩ + rw [hV_13_2, mem_singleton_iff] at this + exact hv_ne_n₂ this.symm + · exact ⟨n, ⟨Or.inr (Or.inr hEq), Or.inr hnN⟩, (hnodeV₁_other n hnN).trans hnw⟩ + · rw [hcellG₁_c₂] at hwc + rw [htc₂] + rcases hd with rfl | rfl | hdI + · rw [hcellG₁_c₁] at hwd + have hw_v : w = v := by + have : w ∈ ((A₁ ∪ A₃) ∩ A₂).vertexSet := ⟨hwd, hwc⟩ + rwa [hV_13_2, mem_singleton_iff] at this + subst hw_v + exact ⟨n₀, ⟨Or.inl rfl, Or.inl rfl⟩, hnodeV₁_n₀⟩ + · exact (hne_dc rfl).elim + · rw [hcellG₁_other d hdI] at hwd + obtain ⟨n, ⟨hn_tc₀, hn_dom⟩, hnw⟩ := + π.p5 c₀ hc₀ hint₀ w (hA₂_le.1 hwc) ⟨d, hdI.1, hdI.2, hwd⟩ + have hnN : n ∈ π.Γ.N := hdom ▸ hn_dom + rw [htc₀] at hn_tc₀ + rcases hn_tc₀ with hEq | hEq | hEq + · exfalso + have : π.nodeVertex n₁ ∈ (A₁ ∩ A₂).vertexSet := ⟨hn₁_A₁, hEq ▸ hnw ▸ hwc⟩ + rw [hV12, mem_singleton_iff] at this + exact hv_ne_n₁ this.symm + · exact ⟨n, ⟨Or.inr hEq, Or.inr hnN⟩, (hnodeV₁_other n hnN).trans hnw⟩ + · exfalso + have : π.nodeVertex n₃ ∈ (A₂ ∩ A₃).vertexSet := ⟨hEq ▸ hnw ▸ hwc, hn₃_A₃⟩ + rw [hV23, mem_singleton_iff] at this + exact hv_ne_n₃ this.symm + · rw [hcellG₁_other c hcI] at hwc + have hsub : π.nodeVertex '' (tilde c ∩ π.domγ) ⊆ nodeV₁ '' (tilde c ∩ N') := by + rintro _ ⟨n, ⟨hn_tc, hn_dom⟩, rfl⟩ + have hnN : n ∈ π.Γ.N := hdom ▸ hn_dom + exact ⟨n, ⟨hn_tc, Or.inr hnN⟩, hnodeV₁_other n hnN⟩ + apply hsub + rcases hd with rfl | rfl | hdI + · rw [hcellG₁_c₁] at hwd + exact π.p5 c hcI.1 hint w hwc ⟨c₀, hc₀, Ne.symm hcI.2, hA₁₃_le.1 hwd⟩ + · rw [hcellG₁_c₂] at hwd + exact π.p5 c hcI.1 hint w hwc ⟨c₀, hc₀, Ne.symm hcI.2, hA₂_le.1 hwd⟩ + · rw [hcellG₁_other d hdI] at hwd + exact π.p5 c hcI.1 hint w hwc ⟨d, hdI.1, hne_dc, hwd⟩ + +private theorem first_piece_separates_from_the_other_pieces + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {c₀ : Set π.S} + {A₁ : Hypergraph α β} + {A₂ : Hypergraph α β} + {A₃ : Hypergraph α β} + (hA₁_le : A₁ ≤ π.cellGraph c₀) + (hA_union : A₁ ∪ A₂ ∪ A₃ = π.cellGraph c₀) + (hE12 : (A₁ ∩ A₂).edgeSet = ∅) + (hE13 : (A₁ ∩ A₃).edgeSet = ∅) + (hA₂₃_le : A₂ ∪ A₃ ≤ π.cellGraph c₀) : + (π.cellGraph c₀).IsSeparation A₁ (A₂ ∪ A₃) := by + refine ⟨hA₁_le, hA₂₃_le, ?_, ?_⟩ + · rw [← hA_union] + ext x + · change x ∈ A₁.vertexSet ∪ (A₂.vertexSet ∪ A₃.vertexSet) ↔ + x ∈ (A₁.vertexSet ∪ A₂.vertexSet) ∪ A₃.vertexSet + rw [Set.union_assoc] + · change x ∈ A₁.edgeSet ∪ (A₂.edgeSet ∪ A₃.edgeSet) ↔ + x ∈ (A₁.edgeSet ∪ A₂.edgeSet) ∪ A₃.edgeSet + rw [Set.union_assoc] + · change A₁.Inc _ _ ∨ (A₂.Inc _ _ ∨ A₃.Inc _ _) ↔ + (A₁.Inc _ _ ∨ A₂.Inc _ _) ∨ A₃.Inc _ _ + tauto + · change A₁.edgeSet ∩ (A₂.edgeSet ∪ A₃.edgeSet) = ∅ + rw [inter_union_distrib_left, show A₁.edgeSet ∩ A₂.edgeSet = ∅ from hE12, + show A₁.edgeSet ∩ A₃.edgeSet = ∅ from hE13, union_empty] + +private theorem middle_piece_separates_from_the_other_pieces + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {c₀ : Set π.S} + {A₁ : Hypergraph α β} + {A₂ : Hypergraph α β} + {A₃ : Hypergraph α β} + (hA₂_le : A₂ ≤ π.cellGraph c₀) + (hA_union : A₁ ∪ A₂ ∪ A₃ = π.cellGraph c₀) + (hE12 : (A₁ ∩ A₂).edgeSet = ∅) + (hE23 : (A₂ ∩ A₃).edgeSet = ∅) + (hA₁₃_le : A₁ ∪ A₃ ≤ π.cellGraph c₀) : + (π.cellGraph c₀).IsSeparation (A₁ ∪ A₃) A₂ := by + refine ⟨hA₁₃_le, hA₂_le, ?_, ?_⟩ + · rw [← hA_union] + ext x + · change x ∈ (A₁.vertexSet ∪ A₃.vertexSet) ∪ A₂.vertexSet ↔ + x ∈ (A₁.vertexSet ∪ A₂.vertexSet) ∪ A₃.vertexSet + rw [Set.union_right_comm] + · change x ∈ (A₁.edgeSet ∪ A₃.edgeSet) ∪ A₂.edgeSet ↔ + x ∈ (A₁.edgeSet ∪ A₂.edgeSet) ∪ A₃.edgeSet + rw [Set.union_right_comm] + · change (A₁.Inc _ _ ∨ A₃.Inc _ _) ∨ A₂.Inc _ _ ↔ + (A₁.Inc _ _ ∨ A₂.Inc _ _) ∨ A₃.Inc _ _ + tauto + · change (A₁.edgeSet ∪ A₃.edgeSet) ∩ A₂.edgeSet = ∅ + rw [union_inter_distrib_right, show A₁.edgeSet ∩ A₂.edgeSet = ∅ from hE12, + inter_comm A₃.edgeSet, show A₂.edgeSet ∩ A₃.edgeSet = ∅ from hE23, union_empty] + +private theorem internal_split_vertex_is_not_a_node_vertex + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {θ : ℕ} + {p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {c₀ : Set π.S} + {v : α} + (hdom : π.domγ = π.Γ.N) + (hv_not_tc₀ : ∀ n ∈ tilde c₀, v ≠ π.nodeVertex n) + (hv_not_other : ∀ d ∈ π.Γ.C, d ≠ c₀ → v ∉ (π.cellGraph d).vertexSet) : + ∀ n ∈ π.Γ.N, v ≠ π.nodeVertex n := by + intro n hn hEq + by_cases hn_tc₀ : n ∈ tilde c₀ + · exact hv_not_tc₀ n hn_tc₀ hEq + · have h87 := + (theorem_8_7_proof + h𝒯 π htrue hred hwarp hθ hn).1 + have hne_star : {c ∈ π.Γ.CStar | n ∈ tilde c}.Nonempty := + nonempty_of_ncard_ne_zero (by omega) + rcases hne_star with ⟨d, ⟨hd_C, _⟩, hn_td⟩ + have hd_ne : d ≠ c₀ := fun h => hn_tc₀ (h ▸ hn_td) + exact hv_not_other d hd_C hd_ne (hEq ▸ π.p2 d hd_C n ⟨hn_td, hdom ▸ hn⟩) + +private theorem internal_split_vertex_is_not_a_border_vertex + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {c₀ : Set π.S} + (hint₀ : ¬(c₀ ∩ bd π.S).Nonempty) + {v : α} + (hv_not_other : ∀ d ∈ π.Γ.C, d ≠ c₀ → v ∉ (π.cellGraph d).vertexSet) : + ∀ n ∈ π.Γ.N ∩ bd π.S, v ∉ π.borderSet n := by + rintro n ⟨hnN, hnbd⟩ hvb + let Θ := connectedComponentIn (bd π.S) n + have hΘ : Θ ∈ cuffs π.S := ⟨n, hnbd, rfl⟩ + have hΘ_arc : IsOArc Θ := (cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + set k := (π.Γ.N ∩ Θ).ncard + obtain ⟨E⟩ : Nonempty (π.Γ.CuffEnumeration Θ k) := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + have hn_Θ : n ∈ π.Γ.N ∩ Θ := ⟨hnN, mem_connectedComponentIn hnbd⟩ + rw [← E.range_node] at hn_Θ + rcases hn_Θ with ⟨i, hi_eq⟩ + let d := E.cell i + have hd_mem : d ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := E.range_cell ▸ ⟨i, rfl⟩ + have hΘ_sub_bd : Θ ⊆ bd π.S := connectedComponentIn_subset (bd π.S) n + have hd_bd : (d ∩ bd π.S).Nonempty := hd_mem.2.mono (inter_subset_inter_right _ hΘ_sub_bd) + have hn_td : n ∈ tilde d := by + rw [← hi_eq, E.cell_tilde i] + exact Or.inl rfl + have hd_ne : d ≠ c₀ := fun h => hint₀ (h ▸ hd_bd) + exact hv_not_other d hd_mem.1 hd_ne (π.p3_subset d hd_mem.1 hd_bd n hn_td hvb) + +private theorem distinct_of_three_node_cardinality {S : Type w} {C : Set S} + {n₁ n₂ n₃ : S} (htc₀ : C = {n₁, n₂, n₃}) (hcard3 : C.ncard = 3) : + n₁ ≠ n₂ ∧ n₁ ≠ n₃ ∧ n₂ ≠ n₃ := by + have hpair_le : ∀ a b : S, ({a, b} : Set S).ncard ≤ 2 := fun a b => by + have := ncard_insert_le a {b} + rw [ncard_singleton] at this + exact this + refine ⟨?_, ?_, ?_⟩ + · rintro rfl + have : C.ncard ≤ 2 := by + rw [htc₀, insert_idem] + exact hpair_le n₁ n₃ + omega + · rintro rfl + have : C.ncard ≤ 2 := by + rw [htc₀] + have hEq : ({n₁, n₂, n₁} : Set S) = {n₁, n₂} := by ext; simp [or_comm] + rw [hEq] + exact hpair_le n₁ n₂ + omega + · rintro rfl + have : C.ncard ≤ 2 := by + rw [htc₀] + have hEq : ({n₁, n₂, n₂} : Set S) = {n₁, n₂} := by ext; simp + rw [hEq] + exact hpair_le n₁ n₂ + omega + +private theorem split_vertex_is_not_third_node + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) (hwarp : π.warp ≤ p) (hθ : 4 * p + 5 < θ) + {c₀ : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) (hint₀ : ¬ (c₀ ∩ bd π.S).Nonempty) + (htc₀_dom : tilde c₀ ⊆ π.domγ) + {n₁ n₂ n₃ : π.S} (hn₁ : n₁ ∈ tilde c₀) (hn₂ : n₂ ∈ tilde c₀) (hn₃ : n₃ ∈ tilde c₀) + (h12 : n₁ ≠ n₂) (h31 : n₃ ≠ n₁) (h32 : n₃ ≠ n₂) + {A B : Hypergraph α β} {v : α} (hsep : (π.cellGraph c₀).IsSeparation A B) + (hinter : (A ∩ B).vertexSet = {v}) + (hfirst : π.nodeVertex n₁ ∈ A.vertexSet) (hlast : π.nodeVertex n₂ ∈ B.vertexSet) : + v ≠ π.nodeVertex n₃ := by + intro heq + obtain ⟨L, hL⟩ := theorem_9_1_proof h𝒯 π htrue hred hwarp hθ hc₀ hint₀ hn₁ hn₂ h12 + have hf : L.first ∈ A.vertexSet := (mem_singleton_iff.mp L.first_mem).symm ▸ hfirst + have hl : L.last ∈ B.vertexSet := (mem_singleton_iff.mp L.last_mem).symm ▸ hlast + obtain ⟨z, hz_sup, hz_inter⟩ := walk_meets_separation hsep L.walk hf hl + rw [hinter, mem_singleton_iff] at hz_inter + subst hz_inter + rcases hL z hz_sup ⟨n₃, hn₃, heq.symm⟩ with h1 | h2 + · exact h31 (π.nodeVertex_injOn (htc₀_dom hn₃) (htc₀_dom hn₁) (heq.symm.trans h1)) + · exact h32 (π.nodeVertex_injOn (htc₀_dom hn₃) (htc₀_dom hn₂) (heq.symm.trans h2)) + +private theorem cell_warp_eq_of_preserved_nodes + {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) (c : Set π.S) + (A : Hypergraph α β) (hA : A = π.cellGraph c) + (borderPlus : π.S → Set α) (nodeVertex : π.S → α) (warp : ℕ) + (hwarp : warp = sInf {q | ∀ n₁ ∈ tilde c, ∀ n₂ ∈ tilde c, n₁ ≠ n₂ → + (π.borderSet n₁).ncard ≤ q ∧ (π.borderSet n₂).ncard ≤ q ∧ + ((borderPlus n₁).ncard = q + 1 → (borderPlus n₂).ncard = q + 1 → + Portrayal.LinkagePairs A.skeleton (borderPlus n₁) (borderPlus n₂) (q + 1) + (nodeVertex n₁) (nodeVertex n₂))}) + (hborder : ∀ n ∈ tilde c, borderPlus n = π.borderPlus n) + (hnode : ∀ n ∈ tilde c, nodeVertex n = π.nodeVertex n) : + warp = π.cellWarp c := by + rw [hwarp, Portrayal.cellWarp, hA] + congr 1 + ext q + simp only [mem_ofPred_eq, Portrayal.CellWarpLE] + constructor <;> intro h n₁ hn₁ n₂ hn₂ hne + · simpa only [hborder n₁ hn₁, hborder n₂ hn₂, hnode n₁ hn₁, hnode n₂ hn₂] + using h n₁ hn₁ n₂ hn₂ hne + · simp only [hborder n₁ hn₁, hborder n₂ hn₂, hnode n₁ hn₁, hnode n₂ hn₂] + exact h n₁ hn₁ n₂ hn₂ hne + +private theorem cuff_warp_eq_after_internal_cell_split + {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) (Γ₁ : Painting π.S) + {c₀ c₁ c₂ : Set π.S} (hC : Γ₁.C = insert c₁ (insert c₂ (π.Γ.C \ {c₀}))) + (hint₀ : ¬ (c₀ ∩ bd π.S).Nonempty) (hint₁ : ¬ (c₁ ∩ bd π.S).Nonempty) + (hint₂ : ¬ (c₂ ∩ bd π.S).Nonempty) (Θ : Set π.S) (hΘ : Θ ⊆ bd π.S) + (cellWarp : Set π.S → ℕ) (warp : ℕ) + (hwarp : warp = sSup {p | ∃ c ∈ Γ₁.C, (c ∩ Θ).Nonempty ∧ p = cellWarp c}) + (hcellWarp : ∀ c ∈ π.Γ.C \ {c₀}, cellWarp c = π.cellWarp c) : + warp = π.warpAt Θ := by + rw [hwarp, Portrayal.warpAt] + congr 1 + ext q + constructor + · rintro ⟨c, hc', hcΘ, rfl⟩ + have hbd_c := hcΘ.mono (inter_subset_inter_right _ hΘ) + rw [hC] at hc' + rcases hc' with rfl | rfl | hcI + · exact (hint₁ hbd_c).elim + · exact (hint₂ hbd_c).elim + · exact ⟨c, hcI.1, hcΘ, hcellWarp c hcI⟩ + · rintro ⟨c, hc, hcΘ, rfl⟩ + have hne : c ≠ c₀ := fun h => hint₀ (h ▸ hcΘ.mono (inter_subset_inter_right _ hΘ)) + exact ⟨c, hC.symm ▸ Or.inr (Or.inr ⟨hc, hne⟩), hcΘ, (hcellWarp c ⟨hc, hne⟩).symm⟩ + +private theorem replacement_internal_cell_geometry + {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) + {c₀ Δ N : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) (hint₀ : ¬ (c₀ ∩ bd π.S).Nonempty) + (hΔ : IsClosedDisc Δ) (hΔ_sub : Δ ⊆ closure c₀) + (hN_sub : π.Γ.N ⊆ N) (hN_fin : N.Finite) : + Δ \ N ⊆ c₀ ∧ (Δ \ N).Nonempty ∧ + (∀ d ∈ π.Γ.C \ {c₀}, d ≠ Δ \ N) ∧ ¬ ((Δ \ N) ∩ bd π.S).Nonempty := by + have hsub : Δ \ N ⊆ c₀ := by + rw [← π.Γ.closure_cell_diff_N hc₀] + exact fun x ⟨hxΔ, hxN⟩ => ⟨hΔ_sub hxΔ, fun hx => hxN (hN_sub hx)⟩ + have hne := (isPathConnected_of_isClosedDisc_finite_diff hΔ sdiff_subset + (hN_fin.subset fun x hx => by by_contra hxN; exact hx.2 ⟨hx.1, hxN⟩)).nonempty + refine ⟨hsub, hne, ?_, fun h => hint₀ (h.mono (inter_subset_inter_left _ hsub))⟩ + rintro d ⟨hd, hne₀⟩ rfl + rcases hne with ⟨x, hx⟩ + exact Set.disjoint_left.mp (π.Γ.cell_disjoint hd hc₀ hne₀) hx (hsub hx) + +private theorem internal_split_preserves_truth_at_zero + {α : Type u} {β : Type v} {G : Hypergraph α β} (π π₁ : Portrayal G) + {c₀ c₁ c₂ : Set π.S} (Γ₁ : Painting π.S) + (hc₀ : c₀ ∈ π.Γ.C) (hint₀ : ¬ (c₀ ∩ bd π.S).Nonempty) + (hcard3 : (tilde c₀).ncard = 3) + (hC₁ : Γ₁.C = insert c₁ (insert c₂ (π.Γ.C \ {c₀}))) + (hc₁_not_I₀ : ∀ d ∈ π.Γ.C \ {c₀}, d ≠ c₁) + (hint₁ : ¬ (c₁ ∩ bd π.S).Nonempty) + (htc₁_card : (tilde c₁).ncard = 3) (htc₂_card : (tilde c₂).ncard = 2) + (htruth : π₁.truth 0 = {c ∈ Γ₁.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3}.ncard) : + π₁.truth 0 = π.truth 0 := by + let S₀ : Set (Set π.S) := {c ∈ π.Γ.C \ {c₀} | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3} + have hS₀_fin : S₀.Finite := π.Γ.finite_cells.subset fun _ hd => hd.1.1 + have h1 : {c ∈ Γ₁.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3} = insert c₁ S₀ := by + rw [hC₁] + ext d + simp only [S₀, mem_sep_iff, mem_insert_iff] + constructor + · rintro ⟨rfl | rfl | hdI, hint_d, hcard_d⟩ + · exact Or.inl rfl + · omega + · exact Or.inr ⟨hdI, hint_d, hcard_d⟩ + · rintro (rfl | ⟨hdI, hint_d, hcard_d⟩) + · exact ⟨Or.inl rfl, hint₁, htc₁_card⟩ + · exact ⟨Or.inr (Or.inr hdI), hint_d, hcard_d⟩ + have h2 : {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3} = insert c₀ S₀ := by + ext d + simp only [S₀, mem_sep_iff, mem_insert_iff, mem_sdiff, mem_singleton_iff] + constructor + · rintro ⟨hd, hint_d, hcard_d⟩ + by_cases h : d = c₀ + · exact Or.inl h + · exact Or.inr ⟨⟨hd, h⟩, hint_d, hcard_d⟩ + · rintro (rfl | ⟨⟨hd, _⟩, hint_d, hcard_d⟩) + · exact ⟨hc₀, hint₀, hcard3⟩ + · exact ⟨hd, hint_d, hcard_d⟩ + have hc₁_not_S₀ : c₁ ∉ S₀ := fun h => hc₁_not_I₀ c₁ h.1 rfl + have hc₀_not_S₀ : c₀ ∉ S₀ := fun h => h.1.2 rfl + rw [htruth, show π.truth 0 = + {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3}.ncard from rfl] + rw [h1, h2, ncard_insert_of_notMem hc₁_not_S₀ hS₀_fin, ncard_insert_of_notMem hc₀_not_S₀ + hS₀_fin] + +private theorem second_split_contradicts_truth + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (hθ : 3 < θ) + (π π₁ : Portrayal G) (htrue : π.IsTrue 𝒯) (hπ₁_central : π₁.IsCentral 𝒯) + (hdom₁ : π₁.domγ = π₁.Γ.N) + (e : π₁.S ≃ₜ π.S) + (hπ₁_warpAt : ∀ Θ ∈ cuffs π₁.S, π₁.warpAt Θ = π.warpAt (e '' Θ)) + (hπ₁_truth0 : π₁.truth 0 = π.truth 0) + {c₁ : Set π₁.S} (hc₁_C₁ : c₁ ∈ π₁.Γ.C) + (hint₁ : ¬ (c₁ ∩ bd π₁.S).Nonempty) (htc₁_card : (tilde c₁).ncard = 3) + {n₀ n₁ n₃ : π₁.S} (htc₁ : tilde c₁ = {n₀, n₁, n₃}) + (hn₀_ne_n₁ : n₀ ≠ n₁) (hn₀_ne_n₃ : n₀ ≠ n₃) (h13 : n₁ ≠ n₃) + {A₁ A₃ B : Hypergraph α β} (hA₁_le : A₁ ≤ B) (hA₃_le : A₃ ≤ B) + (hcellG₁_c₁ : π₁.cellGraph c₁ = A₁ ∪ A₃) (hE13 : (A₁ ∩ A₃).edgeSet = ∅) + {v a₁ a₃ : α} (hV13 : (A₁ ∩ A₃).vertexSet = {v}) + (hv_mem_A₁ : v ∈ A₁.vertexSet) (hv_mem_A₃ : v ∈ A₃.vertexSet) + (hn₁_A₁ : a₁ ∈ A₁.vertexSet) (hn₃_A₃ : a₃ ∈ A₃.vertexSet) + (hv_ne_n₁ : v ≠ a₁) (hv_ne_n₃ : v ≠ a₃) + (hnodeV₁_n₀ : π₁.nodeVertex n₀ = v) + (hnodeV₁_n₁ : π₁.nodeVertex n₁ = a₁) + (hnodeV₁_n₃ : π₁.nodeVertex n₃ = a₃) : + False := by + have hn₁_tc₁ : n₁ ∈ tilde c₁ := htc₁ ▸ Or.inr (Or.inl rfl) + have hn₃_tc₁ : n₃ ∈ tilde c₁ := htc₁ ▸ Or.inr (Or.inr rfl) + have hA₁_le₁ : A₁ ≤ π₁.cellGraph c₁ := by + rw [hcellG₁_c₁] + refine ⟨subset_union_left, subset_union_left, fun e he => ?_⟩ + ext x + exact ⟨fun hx => hx.elim id (fun hx₃ => (hA₁_le.3 e he ▸ (hA₃_le.3 e + (A₃.edge_mem_of_inc hx₃)).symm ▸ hx₃)), + fun hx => Or.inl hx⟩ + have hA₃_le₁ : A₃ ≤ π₁.cellGraph c₁ := by + rw [hcellG₁_c₁] + refine ⟨subset_union_right, subset_union_right, fun e he => ?_⟩ + ext x + exact ⟨fun hx => hx.elim (fun hx₁ => (hA₃_le.3 e he ▸ (hA₁_le.3 e + (A₁.edge_mem_of_inc hx₁)).symm ▸ hx₁)) id, + fun hx => Or.inr hx⟩ + have hA₁₃_union_V : A₁.vertexSet ∪ A₃.vertexSet = (π₁.cellGraph c₁).vertexSet := by + rw [hcellG₁_c₁]; rfl + have hA₁₃_union_E : A₁.edgeSet ∪ A₃.edgeSet = (π₁.cellGraph c₁).edgeSet := by + rw [hcellG₁_c₁]; rfl + have hA₁₃_disj_E : Disjoint A₁.edgeSet A₃.edgeSet := + Set.disjoint_iff_inter_eq_empty.mpr hE13 + have hA₁_tc₁ : ∀ n ∈ tilde c₁ \ {n₃}, π₁.nodeVertex n ∈ A₁.vertexSet := by + rw [htc₁] + rintro n ⟨hEq | hEq | hEq, hnot⟩ + · rw [hEq, hnodeV₁_n₀]; exact hv_mem_A₁ + · rw [hEq, hnodeV₁_n₁]; exact hn₁_A₁ + · exact (hnot hEq).elim + have hA₃_tc₁ : ∀ n ∈ tilde c₁ \ {n₁}, π₁.nodeVertex n ∈ A₃.vertexSet := by + rw [htc₁] + rintro n ⟨hEq | hEq | hEq, hnot⟩ + · rw [hEq, hnodeV₁_n₀]; exact hv_mem_A₃ + · exact (hnot hEq).elim + · rw [hEq, hnodeV₁_n₃]; exact hn₃_A₃ + have hA₁_not_n₃ : π₁.nodeVertex n₃ ∉ A₁.vertexSet := by + rw [hnodeV₁_n₃] + intro hmem + have : a₃ ∈ (A₁ ∩ A₃).vertexSet := ⟨hmem, hn₃_A₃⟩ + rw [hV13, mem_singleton_iff] at this + exact hv_ne_n₃ this.symm + have hA₃_not_n₁ : π₁.nodeVertex n₁ ∉ A₃.vertexSet := by + rw [hnodeV₁_n₁] + intro hmem + have : a₁ ∈ (A₁ ∩ A₃).vertexSet := ⟨hn₁_A₁, hmem⟩ + rw [hV13, mem_singleton_iff] at this + exact hv_ne_n₁ this.symm + have hA₁₃_inter_V : A₁.vertexSet ∩ A₃.vertexSet ⊆ π₁.nodeVertex '' (tilde c₁ \ {n₁, n₃}) := by + intro w hw + have hw_v : w = v := by + have : w ∈ (A₁ ∩ A₃).vertexSet := hw + rwa [hV13, mem_singleton_iff] at this + subst hw_v + refine ⟨n₀, ⟨htc₁ ▸ Or.inl rfl, ?_⟩, hnodeV₁_n₀⟩ + rintro (hEq | hEq) + · exact hn₀_ne_n₁ hEq + · exact hn₀_ne_n₃ hEq + obtain ⟨π', hπ'_central, _, _, hπ'_3⟩ := + exists_truer_of_splitInternalCell h𝒯 (by omega) π₁ hπ₁_central hdom₁ hc₁_C₁ hint₁ + (by omega) hn₁_tc₁ hn₃_tc₁ h13 hA₁_le₁ hA₃_le₁ hA₁₃_union_V hA₁₃_union_E hA₁₃_disj_E + hA₁_tc₁ hA₃_tc₁ hA₁_not_n₃ hA₃_not_n₁ hA₁₃_inter_V + have hπ'_truer : π'.IsTruer π := by + refine ⟨0, fun i hi => (Nat.not_lt_zero i.1 hi).elim, ?_⟩ + exact (hπ'_3 htc₁_card).1.trans_eq hπ₁_truth0 + obtain ⟨ψ, hψ⟩ := (hπ'_3 htc₁_card).2 (fun Θ => π.warpAt (e '' Θ)) hπ₁_warpAt + have hπ'_res : π'.Resembles π := by + refine ⟨ψ.trans e, fun Θ hΘ => ?_⟩ + rw [hψ Θ hΘ] + change π.warpAt (e '' (ψ '' Θ)) = π.warpAt ((e ∘ ψ) '' Θ) + rw [image_comp] + exact htrue.2.2 π' hπ'_central hπ'_truer hπ'_res + +/-- **Graph Minors XVII, (9.2)** (page 184): +"Let $c_0$ be an internal cell with $|\tilde{c}_0| = 3$, and $\tilde{c}_0 = \{n_1, n_2, n_3\}$. Then +there +do not exist subhypergraphs $A_1, A_2, A_3 \subseteq \alpha(c_0)$ and $v \in V(\alpha(c_0))$ such +that +$\gamma(n_i) \in V(A_i)$ $(i = 1, 2, 3)$, $A_1 \cup A_2 \cup A_3 = \alpha(c_0)$, and for $1 \le i < +j \le 3$, +$E(A_i \cap A_j) = \emptyset$ and $V(A_i \cap A_j) = \{v\}$." -/ +theorem theorem_9_2_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {c₀ : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) (hint₀ : ¬ (c₀ ∩ bd π.S).Nonempty) + {n₁ n₂ n₃ : π.S} (htc₀ : tilde c₀ = {n₁, n₂, n₃}) (hcard3 : (tilde c₀).ncard = 3) + {A₁ A₂ A₃ : Hypergraph α β} {v : α} + (hA₁_le : A₁ ≤ π.cellGraph c₀) (hA₂_le : A₂ ≤ π.cellGraph c₀) (hA₃_le : A₃ ≤ π.cellGraph c₀) + (hv : v ∈ (π.cellGraph c₀).vertexSet) + (hn₁_A₁ : π.nodeVertex n₁ ∈ A₁.vertexSet) + (hn₂_A₂ : π.nodeVertex n₂ ∈ A₂.vertexSet) + (hn₃_A₃ : π.nodeVertex n₃ ∈ A₃.vertexSet) + (hA_union : A₁ ∪ A₂ ∪ A₃ = π.cellGraph c₀) + (hE12 : (A₁ ∩ A₂).edgeSet = ∅) (hE13 : (A₁ ∩ A₃).edgeSet = ∅) (hE23 : (A₂ ∩ A₃).edgeSet = ∅) + (hV12 : (A₁ ∩ A₂).vertexSet = {v}) (hV13 : (A₁ ∩ A₃).vertexSet = {v}) + (hV23 : (A₂ ∩ A₃).vertexSet = {v}) : + False := by + classical + have : T2Space π.S := π.isSurface.2.1 + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof + h𝒯 π htrue hred hwarp hθ + have hn₁_tc : n₁ ∈ tilde c₀ := htc₀ ▸ Or.inl rfl + have hn₂_tc : n₂ ∈ tilde c₀ := htc₀ ▸ Or.inr (Or.inl rfl) + have hn₃_tc : n₃ ∈ tilde c₀ := htc₀ ▸ Or.inr (Or.inr rfl) + have htc₀_dom : tilde c₀ ⊆ π.domγ := hdom ▸ π.Γ.tilde_subset_N hc₀ + obtain ⟨h12, h13, h23⟩ := distinct_of_three_node_cardinality htc₀ hcard3 + have hA₁₃_le := union_le hA₁_le hA₃_le + have hA₂₃_le := union_le hA₂_le hA₃_le + have hsep_1_23 : (π.cellGraph c₀).IsSeparation A₁ (A₂ ∪ A₃) := by + exact first_piece_separates_from_the_other_pieces (α := α) (β := β) (G := G) π (c₀ := c₀) (A₁ + := A₁) (A₂ := A₂) (A₃ := A₃) hA₁_le hA_union hE12 hE13 hA₂₃_le + have hsep_13_2 : (π.cellGraph c₀).IsSeparation (A₁ ∪ A₃) A₂ := by + exact middle_piece_separates_from_the_other_pieces (α := α) (β := β) (G := G) π (c₀ := c₀) (A₁ + := A₁) (A₂ := A₂) (A₃ := A₃) hA₂_le hA_union hE12 hE23 hA₁₃_le + have hV_1_23 : (A₁ ∩ (A₂ ∪ A₃)).vertexSet = {v} := by + change A₁.vertexSet ∩ (A₂.vertexSet ∪ A₃.vertexSet) = {v} + rw [inter_union_distrib_left, show A₁.vertexSet ∩ A₂.vertexSet = {v} from hV12, + show A₁.vertexSet ∩ A₃.vertexSet = {v} from hV13, Set.union_self] + have hV_13_2 : ((A₁ ∪ A₃) ∩ A₂).vertexSet = {v} := by + change (A₁.vertexSet ∪ A₃.vertexSet) ∩ A₂.vertexSet = {v} + rw [union_inter_distrib_right, show A₁.vertexSet ∩ A₂.vertexSet = {v} from hV12, + inter_comm A₃.vertexSet, show A₂.vertexSet ∩ A₃.vertexSet = {v} from hV23, Set.union_self] + have hv_ne_n₁ := split_vertex_is_not_third_node h𝒯 π htrue hred hwarp hθ hc₀ hint₀ + htc₀_dom hn₃_tc hn₂_tc hn₁_tc h23.symm h13 h12 hsep_13_2 hV_13_2 (Or.inr hn₃_A₃) hn₂_A₂ + have hv_ne_n₂ := split_vertex_is_not_third_node h𝒯 π htrue hred hwarp hθ hc₀ hint₀ + htc₀_dom hn₁_tc hn₃_tc hn₂_tc h13 h12.symm h23 hsep_1_23 hV_1_23 hn₁_A₁ (Or.inr hn₃_A₃) + have hv_ne_n₃ := split_vertex_is_not_third_node h𝒯 π htrue hred hwarp hθ hc₀ hint₀ + htc₀_dom hn₁_tc hn₂_tc hn₃_tc h12 h13.symm h23.symm hsep_1_23 hV_1_23 hn₁_A₁ (Or.inl hn₂_A₂) + have hv_not_tc₀ : ∀ n ∈ tilde c₀, v ≠ π.nodeVertex n := by + rw [htc₀] + rintro n (rfl | rfl | rfl) + · exact hv_ne_n₁ + · exact hv_ne_n₂ + · exact hv_ne_n₃ + have hv_not_other : ∀ d ∈ π.Γ.C, d ≠ c₀ → v ∉ (π.cellGraph d).vertexSet := by + intro d hd hne hvd + obtain ⟨n, ⟨hn_tc, _⟩, hEq⟩ := π.p5 c₀ hc₀ hint₀ v hv ⟨d, hd, hne, hvd⟩ + exact hv_not_tc₀ n hn_tc hEq.symm + have hv_not_nodeVertex : ∀ n ∈ π.Γ.N, v ≠ π.nodeVertex n := by + exact internal_split_vertex_is_not_a_node_vertex (α := α) (β := β) (G := G) (𝒯 := 𝒯) (θ := θ) + (p := p) h𝒯 π htrue hred hwarp hθ (c₀ := c₀) (v := v) hdom hv_not_tc₀ hv_not_other + have hv_not_borderSet : ∀ n ∈ π.Γ.N ∩ bd π.S, v ∉ π.borderSet n := by + exact internal_split_vertex_is_not_a_border_vertex (α := α) (β := β) (G := G) π (c₀ := c₀) + hint₀ (v := v) hv_not_other + obtain ⟨n₀, hn₀_c₀, Δ₁, Δ₂, hΔ₁_disc, hΔ₂_disc, hΔ₁_sub, hΔ₂_sub, hΔ_inter, + hΔ₁_N', hΔ₂_N', hΔ₁_bdN', hΔ₂_bdN'⟩ := + exists_discs_for_9_2 π.Γ hc₀ htc₀ h12 h13 h23 + have hn₀_not_N : n₀ ∉ π.Γ.N := (π.Γ.cell_subset_diff hc₀ hn₀_c₀).2 + have hn₀_not_bd : n₀ ∉ bd π.S := fun hbd => hint₀ ⟨n₀, hn₀_c₀, hbd⟩ + have hn₀_not_tc₀ : n₀ ∉ tilde c₀ := fun h => hn₀_not_N (π.Γ.tilde_subset_N hc₀ h) + have hn₀_ne_n₁ : n₀ ≠ n₁ := fun h => hn₀_not_tc₀ (h ▸ hn₁_tc) + have hn₀_ne_n₂ : n₀ ≠ n₂ := fun h => hn₀_not_tc₀ (h ▸ hn₂_tc) + have hn₀_ne_n₃ : n₀ ≠ n₃ := fun h => hn₀_not_tc₀ (h ▸ hn₃_tc) + let N' : Set π.S := insert n₀ π.Γ.N + have hN_sub : π.Γ.N ⊆ N' := subset_insert n₀ π.Γ.N + have hN'_fin : N'.Finite := π.Γ.finite_N.insert n₀ + have hN'_diff : N' \ π.Γ.N ⊆ Δ₁ ∩ Δ₂ := by + rw [hΔ_inter] + rintro x ⟨rfl | hxN, hx_not_N⟩ + · rfl + · exact (hx_not_N hxN).elim + have hΔ_inter_N' : Δ₁ ∩ Δ₂ ⊆ N' := by + rw [hΔ_inter] + rintro x rfl + exact Or.inl rfl + have hΔ₁_card : (Δ₁ ∩ N').ncard = 3 := by + rw [hΔ₁_N', ncard_insert_of_notMem, ncard_pair h13] + rintro (rfl | rfl) + · exact hn₀_ne_n₁ rfl + · exact hn₀_ne_n₃ rfl + have hΔ₂_card : (Δ₂ ∩ N').ncard = 2 := by + rw [hΔ₂_N', ncard_pair hn₀_ne_n₂] + let c₁ : Set π.S := Δ₁ \ N' + let c₂ : Set π.S := Δ₂ \ N' + let Γ₁ : Painting π.S := + splitInternalCell π.Γ hc₀ hint₀ hΔ₁_disc hΔ₂_disc hΔ₁_sub hΔ₂_sub + hN_sub hN'_fin hN'_diff hΔ_inter_N' hΔ₁_bdN' hΔ₂_bdN' hΔ₁_card.le (by omega) + have hC₁ : Γ₁.C = insert c₁ (insert c₂ (π.Γ.C \ {c₀})) := + splitInternalCell_C π.Γ hc₀ hint₀ hΔ₁_disc hΔ₂_disc hΔ₁_sub hΔ₂_sub + hN_sub hN'_fin hN'_diff hΔ_inter_N' hΔ₁_bdN' hΔ₂_bdN' hΔ₁_card.le (by omega) + have htc₁ : tilde c₁ = {n₀, n₁, n₃} := by + rw [tilde_diff_eq_of_isClosedDisc_finite hΔ₁_disc hN'_fin, hΔ₁_N'] + have htc₂ : tilde c₂ = {n₀, n₂} := by + rw [tilde_diff_eq_of_isClosedDisc_finite hΔ₂_disc hN'_fin, hΔ₂_N'] + obtain ⟨hc₁_sub_c₀, hc₁_ne, hc₁_not_I₀, hint₁⟩ := + replacement_internal_cell_geometry π hc₀ hint₀ hΔ₁_disc hΔ₁_sub hN_sub hN'_fin + obtain ⟨hc₂_sub_c₀, hc₂_ne, hc₂_not_I₀, hint₂⟩ := + replacement_internal_cell_geometry π hc₀ hint₀ hΔ₂_disc hΔ₂_sub hN_sub hN'_fin + have hc₁_disj_c₂ : Disjoint c₁ c₂ := + Set.disjoint_left.mpr fun x ⟨hx₁, hxN⟩ ⟨hx₂, _⟩ => hxN (hΔ_inter_N' ⟨hx₁, hx₂⟩) + have hc₁_ne_c₂ : c₁ ≠ c₂ := by + rcases hc₁_ne with ⟨x, hx⟩ + exact fun h => Set.disjoint_left.mp hc₁_disj_c₂ hx (h ▸ hx) + have hc₁_C₁ : c₁ ∈ Γ₁.C := hC₁.symm ▸ Or.inl rfl + have hc₂_C₁ : c₂ ∈ Γ₁.C := hC₁.symm ▸ Or.inr (Or.inl rfl) + let cellG₁ : Set π.S → Hypergraph α β := fun c => + if c = c₁ then A₁ ∪ A₃ else if c = c₂ then A₂ else π.cellGraph c + let nodeV₁ : π.S → α := fun n => if n = n₀ then v else π.nodeVertex n + have hcellG₁_c₁ : cellG₁ c₁ = A₁ ∪ A₃ := by simp [cellG₁] + have hcellG₁_c₂ : cellG₁ c₂ = A₂ := by simp [cellG₁, hc₁_ne_c₂.symm] + have hcellG₁_other : ∀ d ∈ π.Γ.C \ {c₀}, cellG₁ d = π.cellGraph d := fun d hd => by + have h₁ : d ≠ c₁ := hc₁_not_I₀ d hd + have h₂ : d ≠ c₂ := hc₂_not_I₀ d hd + simp only [cellG₁, ite_eq_right h₁, ite_eq_right h₂] + have hnodeV₁_n₀ : nodeV₁ n₀ = v := by simp [nodeV₁] + have hnodeV₁_other : ∀ n ∈ π.Γ.N, nodeV₁ n = π.nodeVertex n := fun n hn => by + have hne : n ≠ n₀ := fun h => hn₀_not_N (h ▸ hn) + simp [nodeV₁, hne] + have hbd_N' : N' ∩ bd π.S = π.Γ.N ∩ bd π.S := insert_inter_of_notMem hn₀_not_bd + have hcellG₁_le : ∀ c ∈ Γ₁.C, cellG₁ c ≤ G := by + intro c hc + rw [hC₁] at hc + rcases hc with rfl | rfl | hd + · rw [hcellG₁_c₁]; exact hA₁₃_le.trans (π.cellGraph_le c₀ hc₀) + · rw [hcellG₁_c₂]; exact hA₂_le.trans (π.cellGraph_le c₀ hc₀) + · rw [hcellG₁_other c hd]; exact π.cellGraph_le c hd.1 + have hv12 : v ∈ (A₁ ∩ A₂).vertexSet := hV12.symm ▸ rfl + have hv13 : v ∈ (A₁ ∩ A₃).vertexSet := hV13.symm ▸ rfl + have hv_mem_A₁ := hv12.1 + have hv_mem_A₂ := hv12.2 + have hv_mem_A₃ := hv13.2 + have hp5_aux₁ : ∀ c ∈ Γ₁.C, ¬ (c ∩ bd π.S).Nonempty → ∀ w ∈ (cellG₁ c).vertexSet, + (∃ d ∈ Γ₁.C, d ≠ c ∧ w ∈ (cellG₁ d).vertexSet) → w ∈ nodeV₁ '' (tilde c ∩ N') := by + exact new_node_split_shared_vertices_correspond_to_nodes (α := α) (β := β) (G := G) π (c₀ := + c₀) hc₀ hint₀ (n₁ := n₁) (n₂ := n₂) (n₃ := n₃) htc₀ (A₁ := A₁) (A₂ := A₂) (A₃ := A₃) (v := + v) hA₂_le hv hn₁_A₁ hn₂_A₂ hn₃_A₃ hV12 hV13 hV23 hdom hA₁₃_le hV_1_23 hV_13_2 hv_ne_n₁ + hv_ne_n₂ hv_ne_n₃ hv_not_tc₀ hv_not_other hv_not_nodeVertex hv_not_borderSet n₀ c₁ c₂ Γ₁ hC₁ + htc₁ htc₂ cellG₁ nodeV₁ hcellG₁_c₁ hcellG₁_c₂ hcellG₁_other hnodeV₁_n₀ hnodeV₁_other + hv_mem_A₁ hv_mem_A₂ hv_mem_A₃ + have hΘ_bd : ∀ Θ ∈ cuffs π.S, Θ ⊆ bd π.S := by + rintro Θ ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hN'_Θ : ∀ Θ ∈ cuffs π.S, N' ∩ Θ = π.Γ.N ∩ Θ := fun Θ hΘ => + insert_inter_of_notMem (fun hn => hn₀_not_bd (hΘ_bd Θ hΘ hn)) + let π₁ : Portrayal G := + split_internal_cell_with_new_node_portrayal (α := α) (β := β) (G := G) π (c₀ + := c₀) hc₀ hint₀ (n₁ := n₁) (n₂ := n₂) (n₃ := n₃) htc₀ hcard3 (A₁ := A₁) (A₂ := A₂) (A₃ := + A₃) (v := v) hA₁_le hA₂_le hA₃_le hv hn₁_A₁ hn₂_A₂ hn₃_A₃ hA_union hdom hn₁_tc hn₂_tc hn₃_tc + htc₀_dom hA₁₃_le hA₂₃_le hsep_1_23 hsep_13_2 hv_not_tc₀ hv_not_other hv_not_nodeVertex + hv_not_borderSet n₀ hn₀_c₀ Δ₁ Δ₂ hΔ₁_sub hΔ₂_sub hΔ_inter hΔ₁_N' hΔ₂_N' + hΔ₁_bdN' hΔ₂_bdN' hn₀_not_N hn₀_not_bd hn₀_not_tc₀ hn₀_ne_n₁ hn₀_ne_n₂ hn₀_ne_n₃ N' rfl hN_sub + hN'_fin hN'_diff hΔ_inter_N' hΔ₁_card hΔ₂_card c₁ c₂ Γ₁ rfl hC₁ htc₁ htc₂ hc₁_sub_c₀ + hc₂_sub_c₀ + hc₁_ne hc₂_ne hc₁_disj_c₂ hc₁_ne_c₂ hc₁_not_I₀ hc₂_not_I₀ hint₁ hint₂ hc₁_C₁ hc₂_C₁ cellG₁ + nodeV₁ hcellG₁_c₁ hcellG₁_c₂ hcellG₁_other hnodeV₁_n₀ hnodeV₁_other hbd_N' hcellG₁_le + hv_mem_A₁ hv_mem_A₂ hp5_aux₁ hΘ_bd hN'_Θ + have hπ₁_central : π₁.IsCentral 𝒯 := by + intro c hc + change IsSmallWrt 𝒯 (cellG₁ c) + have hcases : c ∈ insert c₁ (insert c₂ (π.Γ.C \ {c₀})) := hC₁ ▸ hc + rcases hcases with rfl | rfl | hcI + · have hatt_le := internal_cell_attachments_le_three π₁ hc₁_C₁ hint₁ + have hatt_lt : (attachments G (cellG₁ c₁)).ncard < θ := hatt_le.trans_lt (by omega) + exact IsSmallWrt.mono h𝒯 (htrue.1 c₀ hc₀) (hcellG₁_c₁ ▸ hA₁₃_le) hatt_lt + · have hatt_le := internal_cell_attachments_le_three π₁ hc₂_C₁ hint₂ + have hatt_lt : (attachments G (cellG₁ c₂)).ncard < θ := hatt_le.trans_lt (by omega) + exact IsSmallWrt.mono h𝒯 (htrue.1 c₀ hc₀) (hcellG₁_c₂ ▸ hA₂_le) hatt_lt + · rw [hcellG₁_other c hcI] + exact htrue.1 c hcI.1 + have hπ₁_warpAt : ∀ Θ ∈ cuffs π.S, π₁.warpAt Θ = π.warpAt Θ := by + intro Θ hΘ + refine cuff_warp_eq_after_internal_cell_split π Γ₁ hC₁ hint₀ hint₁ hint₂ Θ (hΘ_bd Θ hΘ) + π₁.cellWarp (π₁.warpAt Θ) rfl ?_ + intro c hcI + refine cell_warp_eq_of_preserved_nodes π c (cellG₁ c) (hcellG₁_other c hcI) + π₁.borderPlus nodeV₁ (π₁.cellWarp c) rfl ?_ ?_ + · intro n hn_tc + have hnN : n ∈ π.Γ.N := π.Γ.tilde_subset_N hcI.1 hn_tc + have hnN' : n ∈ N' := Or.inr hnN + have hndom : n ∈ π.domγ := hdom ▸ hnN + ext w + change (w ∈ π.borderSet n ∨ (n ∈ N' ∧ w = nodeV₁ n)) ↔ + (w ∈ π.borderSet n ∨ (n ∈ π.domγ ∧ w = π.nodeVertex n)) + simp only [hnN', hndom, hnodeV₁_other n hnN] + · exact fun n hn => hnodeV₁_other n (π.Γ.tilde_subset_N hcI.1 hn) + have htc₁_card : (tilde c₁).ncard = 3 := by + rw [show tilde c₁ = Δ₁ ∩ N' from tilde_diff_eq_of_isClosedDisc_finite hΔ₁_disc hN'_fin, + hΔ₁_card] + have htc₂_card : (tilde c₂).ncard = 2 := by + rw [show tilde c₂ = Δ₂ ∩ N' from tilde_diff_eq_of_isClosedDisc_finite hΔ₂_disc hN'_fin, + hΔ₂_card] + have hπ₁_truth0 : π₁.truth 0 = π.truth 0 := + internal_split_preserves_truth_at_zero π π₁ Γ₁ hc₀ hint₀ hcard3 hC₁ hc₁_not_I₀ hint₁ + htc₁_card htc₂_card rfl + exact second_split_contradicts_truth h𝒯 (by omega) π π₁ htrue hπ₁_central rfl + (Homeomorph.refl π.S) (fun Θ hΘ => by + change π₁.warpAt Θ = π.warpAt (id '' Θ) + simpa only [image_id] using hπ₁_warpAt Θ hΘ) + hπ₁_truth0 hc₁_C₁ hint₁ htc₁_card htc₁ hn₀_ne_n₁ hn₀_ne_n₃ h13 + hA₁_le hA₃_le hcellG₁_c₁ hE13 hV13 hv_mem_A₁ hv_mem_A₃ hn₁_A₁ hn₃_A₃ hv_ne_n₁ hv_ne_n₃ + hnodeV₁_n₀ (hnodeV₁_other n₁ (π.Γ.tilde_subset_N hc₀ hn₁_tc)) + (hnodeV₁_other n₃ (π.Γ.tilde_subset_N hc₀ hn₃_tc)) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section9b.lean b/LeanPool/GraphMinor/GM17/Section9b.lean new file mode 100644 index 0000000000..eff1fd9507 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section9b.lean @@ -0,0 +1,2017 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section9 +public import LeanPool.GraphMinor.GM17.ArcDisc + +/-! +# Graph Minors XVII, Section 9 (continued): Linkages in a True Portrayal + +This file formalizes (9.3) through (9.8) of Robertson and Seymour, +*Graph Minors. XVII. Taming a Vortex*, J. Combin. Theory Ser. B 77 (1999), 162–210 +(pages 184–188). +The portrayal deductions that use painting results are proved in `Section9bProved`. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology Metric +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +local notation "𝕀" => unitInterval + +@[expose] public section + +/-- There are `q` mutually vertex-disjoint paths in `H.skeleton` from `X` to `Y` avoiding `W`. -/ +def HasDisjointPathsAvoiding {α : Type u} {β : Type v} (H : Hypergraph α β) + (X Y W : Set α) (q : ℕ) : Prop := + ∃ L : Fin q → PathFromTo H.skeleton X Y, + (Pairwise fun i j ↦ Disjoint {z | z ∈ (L i).walk.support} {z | z ∈ (L j).walk.support}) ∧ + ∀ i, Disjoint {z | z ∈ (L i).walk.support} W + +end + +theorem hasDisjointPathsAvoiding_iff_forall_isSeparation + {α : Type u} {β : Type v} (H : Hypergraph α β) {X Y W : Set α} + (hX : X ⊆ H.vertexSet) (hY : Y ⊆ H.vertexSet) (hW : W ⊆ H.vertexSet) (q : ℕ) : + HasDisjointPathsAvoiding H X Y W q ↔ + ∀ G₁ G₂ : Hypergraph α β, H.IsSeparation G₁ G₂ → + X ∪ W ⊆ G₁.vertexSet → Y ∪ W ⊆ G₂.vertexSet → + q ≤ ((G₁ ∩ G₂).vertexSet \ W).ncard := by + classical + have hW_fin : W.Finite := H.vertexSet_finite.subset hW + constructor + · rintro ⟨L, hdisj, havoid⟩ G₁ G₂ hsep hXW hYW + have hhit : ∀ i : Fin q, ∃ z ∈ (L i).walk.support, z ∈ (G₁ ∩ G₂).vertexSet \ W := by + intro i + obtain ⟨z, hz_sup, hz_inter⟩ := + walk_meets_separation hsep (L i).walk (hXW (Or.inl (L i).first_mem)) (hYW (Or.inl + (L i).last_mem)) + exact ⟨z, hz_sup, hz_inter, Set.disjoint_left.mp (havoid i) hz_sup⟩ + choose f hf_sup hf_mem using hhit + have hfin_diff : ((G₁ ∩ G₂).vertexSet \ W).Finite := + (G₁ ∩ G₂).vertexSet_finite.subset sdiff_subset + have hinj : Function.Injective f := by + intro i j hij + by_contra hne + exact Set.disjoint_left.mp (hdisj hne) (hf_sup i) (hij ▸ hf_sup j) + have hcard_range : (range f).ncard = q := by + rw [ncard_range_of_injective hinj, Nat.card_eq_fintype_card, Fintype.card_fin] + have hsub : range f ⊆ (G₁ ∩ G₂).vertexSet \ W := by + rintro _ ⟨i, rfl⟩ + exact hf_mem i + exact hcard_range ▸ ncard_le_ncard hsub hfin_diff + · intro hsep_all + have hmenger : HasDisjointPaths H.skeleton (X ∪ W) (Y ∪ W) (q + W.ncard) := by + rw [← GraphMinor.menger H (X ∪ W) (Y ∪ W) (union_subset hX hW) (union_subset hY hW) + (q + W.ncard)] + intro G₁ G₂ hsep hXW hYW + have hle := hsep_all G₁ G₂ hsep hXW hYW + have hW_sub : W ⊆ (G₁ ∩ G₂).vertexSet := + fun w hw => ⟨hXW (Or.inr hw), hYW (Or.inr hw)⟩ + have hfin_inter : (G₁ ∩ G₂).vertexSet.Finite := (G₁ ∩ G₂).vertexSet_finite + have heq := ncard_sdiff_add_ncard_of_subset hW_sub hfin_inter + change q + W.ncard ≤ (G₁ ∩ G₂).vertexSet.ncard + omega + rcases hmenger with ⟨P, hP_disj⟩ + let Bhit : Set (Fin (q + W.ncard)) := + {k | ∃ w ∈ W, w ∈ (P k).walk.support} + let Bmiss : Set (Fin (q + W.ncard)) := + {k | Disjoint {z | z ∈ (P k).walk.support} W} + have hBhit_le : Bhit.ncard ≤ W.ncard := by + have hex : ∀ k : Bhit, ∃ w ∈ W, w ∈ (P k.1).walk.support := fun k => k.2 + choose g hg_W hg_sup using hex + have hinj : Function.Injective g := by + intro k₁ k₂ hEq + ext1 + by_contra hne + exact Set.disjoint_left.mp (hP_disj hne) (hg_sup k₁) (hEq ▸ hg_sup k₂) + have hrange : (range g).ncard ≤ W.ncard := + ncard_le_ncard (by rintro _ ⟨k, rfl⟩; exact hg_W k) hW_fin + rw [ncard_range_of_injective hinj, Nat.card_coe_set_eq] at hrange + exact hrange + have hcompl : Bmiss = Bhitᶜ := by + ext k + simp only [Bmiss, Bhit, mem_compl_iff, mem_ofPred_eq, Set.disjoint_left, not_exists, not_and] + exact ⟨fun h w hw hsup => h hsup hw, fun h w hsup hw => h w hw hsup⟩ + have hBmiss_ge : q ≤ Bmiss.ncard := by + have hadd := ncard_add_ncard_compl Bhit + rw [← hcompl, Nat.card_eq_fintype_card, Fintype.card_fin] at hadd + omega + obtain ⟨S₀, hS₀_sub, hS₀_card⟩ := exists_subset_card_eq hBmiss_ge + have hS₀_fin : Fintype S₀ := Fintype.ofFinite S₀ + have hcard_S₀ : Fintype.card S₀ = q := by + rw [← Nat.card_eq_fintype_card, Nat.card_coe_set_eq, hS₀_card] + let e' : Fin q ≃ S₀ := (Fintype.equivFinOfCardEq hcard_S₀).symm + refine ⟨fun i => + let k := (e' i).1 + have hk : Disjoint {z | z ∈ (P k).walk.support} W := hS₀_sub (e' i).2 + { first := (P k).first + last := (P k).last + walk := (P k).walk + isPath := (P k).isPath + first_mem := (P k).first_mem.resolve_right + (Set.disjoint_left.mp hk (SimpleGraph.Walk.start_mem_support _)) + last_mem := (P k).last_mem.resolve_right + (Set.disjoint_left.mp hk (SimpleGraph.Walk.end_mem_support _)) }, + fun i j hne => hP_disj (fun hEq => hne (e'.injective (Subtype.ext hEq))), + fun i => hS₀_sub (e' i).2⟩ + +/-- **(9.5)** (Graph Minors XVII, Section 9, page 186): +"Let $H$ be a graph, let $A, B \subseteq V(H)$, and let $X \subseteq A$ and $Y \subseteq B$ +with $|X| = |Y| = q$. Suppose that there is a linkage in $H \setminus (A - X)$ from $X$ to a +$q$-subset of $B$, and there is a linkage in $H \setminus (B - Y)$ from a $q$-subset of $A$ +to $Y$. Then either there is a linkage in $H \setminus ((A - X) \cup (B - Y))$ from $X$ to +$Y$, or there are $q + 1$ mutually vertex-disjoint paths in $H$ from $A$ to $B$." -/ +theorem theorem_9_5_proof {α : Type u} {β : Type v} (H : Hypergraph α β) {A B X Y : Set α} {q : ℕ} + (hA : A ⊆ H.vertexSet) (hB : B ⊆ H.vertexSet) (hXA : X ⊆ A) (hYB : Y ⊆ B) + (hXB : HasDisjointPathsAvoiding H X B (A \ X) q) + (hAY : HasDisjointPathsAvoiding H A Y (B \ Y) q) : + HasDisjointPathsAvoiding H X Y ((A \ X) ∪ (B \ Y)) q ∨ + HasDisjointPaths H.skeleton A B (q + 1) := by + classical + by_contra! hnot + rcases hnot with ⟨hno_XY, hno_AB⟩ + have hX : X ⊆ H.vertexSet := hXA.trans hA + have hY : Y ⊆ H.vertexSet := hYB.trans hB + have hWA : A \ X ⊆ H.vertexSet := sdiff_subset.trans hA + have hWB : B \ Y ⊆ H.vertexSet := sdiff_subset.trans hB + have hW : (A \ X) ∪ (B \ Y) ⊆ H.vertexSet := union_subset hWA hWB + rw [hasDisjointPathsAvoiding_iff_forall_isSeparation H hX hY hW q] at hno_XY + push Not at hno_XY + obtain ⟨C₁, C₂, hsepC, hXC₁, hYC₂, hltC⟩ := hno_XY + rw [← GraphMinor.menger H A B hA hB (q + 1)] at hno_AB + push Not at hno_AB + obtain ⟨D₁, D₂, hsepD, hAD₁, hBD₂, hltD⟩ := hno_AB + have hA_C₁ : A ⊆ C₁.vertexSet := by + intro a ha + by_cases haX : a ∈ X + · exact hXC₁ (Or.inl haX) + · exact hXC₁ (Or.inr (Or.inl ⟨ha, haX⟩)) + have hB_C₂ : B ⊆ C₂.vertexSet := by + intro b hb + by_cases hbY : b ∈ Y + · exact hYC₂ (Or.inl hbY) + · exact hYC₂ (Or.inr (Or.inr ⟨hb, hbY⟩)) + have hWB_C₁ : B \ Y ⊆ C₁.vertexSet := fun z hz => hXC₁ (Or.inr (Or.inr hz)) + have hWA_C₂ : A \ X ⊆ C₂.vertexSet := fun z hz => hYC₂ (Or.inr (Or.inl hz)) + have hsep1 : H.IsSeparation (C₁ ∩ D₁) (C₂ ∪ D₂) := + (hsepC.symm.union_inter hsepD.symm).symm + have hsep2 : H.IsSeparation (C₁ ∪ D₁) (C₂ ∩ D₂) := + hsepC.union_inter hsepD + have hq1 : q ≤ (((C₁ ∩ D₁) ∩ (C₂ ∪ D₂)).vertexSet \ (A \ X)).ncard := by + have h1 := (hasDisjointPathsAvoiding_iff_forall_isSeparation H hX hB hWA q).mp hXB + refine h1 (C₁ ∩ D₁) (C₂ ∪ D₂) hsep1 ?_ ?_ + · exact union_subset (hXA.trans (subset_inter hA_C₁ hAD₁)) (sdiff_subset.trans + (subset_inter hA_C₁ hAD₁)) + · exact union_subset (hB_C₂.trans subset_union_left) (hWA_C₂.trans subset_union_left) + have hq2 : q ≤ (((C₁ ∪ D₁) ∩ (C₂ ∩ D₂)).vertexSet \ (B \ Y)).ncard := by + have h2 := (hasDisjointPathsAvoiding_iff_forall_isSeparation H hA hY hWB q).mp hAY + refine h2 (C₁ ∪ D₁) (C₂ ∩ D₂) hsep2 ?_ ?_ + · exact union_subset (hA_C₁.trans subset_union_left) (hWB_C₁.trans subset_union_left) + · exact union_subset (hYB.trans (subset_inter hB_C₂ hBD₂)) (sdiff_subset.trans + (subset_inter hB_C₂ hBD₂)) + let U₁ := ((C₁ ∩ D₁) ∩ (C₂ ∪ D₂)).vertexSet \ (A \ X) + let U₂ := ((C₁ ∪ D₁) ∩ (C₂ ∩ D₂)).vertexSet \ (B \ Y) + let SC := (C₁ ∩ C₂).vertexSet \ ((A \ X) ∪ (B \ Y)) + let SD := (D₁ ∩ D₂).vertexSet + have hWA_D₁ : A \ X ⊆ D₁.vertexSet := sdiff_subset.trans hAD₁ + have hWB_D₂ : B \ Y ⊆ D₂.vertexSet := sdiff_subset.trans hBD₂ + have h_union : U₁ ∪ U₂ ⊆ SC ∪ SD := by + rintro z (⟨⟨⟨hzC₁, hzD₁⟩, hzC₂D₂⟩, hzWA⟩ | ⟨⟨hzC₁D₁, ⟨hzC₂, hzD₂⟩⟩, hzWB⟩) + · by_cases hzD₂ : z ∈ D₂.vertexSet + · exact Or.inr ⟨hzD₁, hzD₂⟩ + · have hzC₂ : z ∈ C₂.vertexSet := hzC₂D₂.resolve_right hzD₂ + have hzWB : z ∉ B \ Y := fun h => hzD₂ (hWB_D₂ h) + exact Or.inl ⟨⟨hzC₁, hzC₂⟩, not_or.mpr ⟨hzWA, hzWB⟩⟩ + · by_cases hzD₁ : z ∈ D₁.vertexSet + · exact Or.inr ⟨hzD₁, hzD₂⟩ + · have hzC₁ : z ∈ C₁.vertexSet := hzC₁D₁.resolve_right hzD₁ + have hzWA : z ∉ A \ X := fun h => hzD₁ (hWA_D₁ h) + exact Or.inl ⟨⟨hzC₁, hzC₂⟩, not_or.mpr ⟨hzWA, hzWB⟩⟩ + have h_inter : U₁ ∩ U₂ ⊆ SC ∩ SD := by + rintro z ⟨⟨⟨⟨hzC₁, hzD₁⟩, _⟩, hzWA⟩, ⟨⟨_, ⟨hzC₂, hzD₂⟩⟩, hzWB⟩⟩ + exact ⟨⟨⟨hzC₁, hzC₂⟩, not_or.mpr ⟨hzWA, hzWB⟩⟩, ⟨hzD₁, hzD₂⟩⟩ + have hSC_fin : SC.Finite := (C₁ ∩ C₂).vertexSet_finite.subset sdiff_subset + have hSD_fin : SD.Finite := (D₁ ∩ D₂).vertexSet_finite + have hU₁_fin : U₁.Finite := ((C₁ ∩ D₁) ∩ (C₂ ∪ D₂)).vertexSet_finite.subset sdiff_subset + have hU₂_fin : U₂.Finite := ((C₁ ∪ D₁) ∩ (C₂ ∩ D₂)).vertexSet_finite.subset sdiff_subset + have hsum_U := ncard_union_add_ncard_inter U₁ U₂ hU₁_fin hU₂_fin + have hsum_S := ncard_union_add_ncard_inter SC SD hSC_fin hSD_fin + have hle_union : (U₁ ∪ U₂).ncard ≤ (SC ∪ SD).ncard := ncard_le_ncard h_union + (hSC_fin.union hSD_fin) + have hle_inter : (U₁ ∩ U₂).ncard ≤ (SC ∩ SD).ncard := ncard_le_ncard h_inter + (hSC_fin.inter_of_left SD) + change SC.ncard < q at hltC + change SD.ncard < q + 1 at hltD + change q ≤ U₁.ncard at hq1 + change q ≤ U₂.ncard at hq2 + omega + +theorem subset_closure_diff_ends_of_isLineWithEnds {S : Type*} [TopologicalSpace S] + {L : Set S} {u v : S} (hL : IsLineWithEnds L u v) : + L ⊆ closure (L \ {u, v}) := + hL.subset_closure_interior + +theorem closure_border_cell_subset_cuffPoint_Icc {S : Type} [TopologicalSpace S] [T2Space S] + (Γ : Painting S) {Θ c₀ : Set S} (hΘ : Θ ∈ cuffs S) (hc₀ : c₀ ∈ Γ.C) + (hc₀_Θ : (c₀ ∩ Θ).Nonempty) (f : Circle ≃ₜ Θ) {a b : ℝ} + (hab : a < b) (hba : b < a + 2 * Real.pi) + (haN : GM19.cuffPoint f a ∈ Γ.N) (hbN : GM19.cuffPoint f b ∈ Γ.N) + {t₀ : ℝ} (ht₀ : t₀ ∈ Ioo a b) (ht₀_cl : GM19.cuffPoint f t₀ ∈ closure c₀) : + closure c₀ ∩ Θ ⊆ GM19.cuffPoint f '' Icc a b := by + let A : Set S := GM19.cuffPoint f '' Icc a b + let B : Set S := GM19.cuffPoint f '' Icc b (a + 2 * Real.pi) + have hA_cl : IsClosed A := (isCompact_Icc.image (cuffPoint_continuous f)).isClosed + have hB_cl : IsClosed B := (isCompact_Icc.image (cuffPoint_continuous f)).isClosed + have hAB_eq : A ∪ B = Θ := by + refine Subset.antisymm ?_ ?_ + · rintro _ (⟨t, _, rfl⟩ | ⟨t, _, rfl⟩) <;> exact cuffPoint_mem f t + · intro y hy + obtain ⟨t, ht, rfl⟩ := exists_cuffPoint_mem_Ico f a hy + rcases le_total t b with hle | hle + · exact Or.inl ⟨t, ⟨ht.1, hle⟩, rfl⟩ + · exact Or.inr ⟨t, ⟨hle, ht.2.le⟩, rfl⟩ + have hnot_B : ∀ t ∈ Ioo a b, GM19.cuffPoint f t ∉ B := by + rintro t ⟨hat, htb⟩ ⟨t', ⟨hbt', ht'a⟩, hEq⟩ + rcases lt_or_eq_of_le ht'a with hlt | rfl + · have hEq_t := + cuffPoint_injOn_Ico f a ⟨hat.le, htb.trans hba⟩ ⟨hab.le.trans hbt', hlt⟩ hEq.symm + linarith + · rw [cuffPoint_add_two_pi] at hEq + have hEq_t := cuffPoint_injOn_Ico f a ⟨hat.le, htb.trans hba⟩ ⟨le_rfl, by linarith⟩ hEq.symm + linarith + have hAB_inter : A ∩ B ⊆ Γ.N := by + rintro x ⟨⟨t, ⟨hat, htb⟩, rfl⟩, hxB⟩ + rcases eq_or_lt_of_le hat with rfl | hat' + · exact haN + · rcases eq_or_lt_of_le htb with rfl | htb' + · exact hbN + · exact (hnot_B t ⟨hat', htb'⟩ hxB).elim + have hsub_cuff := Γ.border_cell_subset_cuff hc₀ hΘ hc₀_Θ + have hbd : (c₀ ∩ bd S).Nonempty := hsub_cuff.2.1 ▸ hc₀_Θ + obtain ⟨u, v, _, _, hL, hdiff, _, _⟩ := Γ.border_cell_exists_ends hc₀ hbd + have hcl_sub_cl : closure c₀ ∩ Θ ⊆ closure (c₀ ∩ Θ) := by + rw [← hsub_cuff.2.2.1, ← hsub_cuff.2.1, hdiff] + exact subset_closure_diff_ends_of_isLineWithEnds hL + have hc₀_sub : c₀ ∩ Θ ⊆ A ∪ B := hAB_eq ▸ inter_subset_right + have hc₀_disj : Disjoint (c₀ ∩ Θ) (A ∩ B) := + Set.disjoint_left.mpr fun x ⟨hxc, _⟩ hxAB => (Γ.cell_subset_diff hc₀ hxc).2 (hAB_inter hxAB) + have hc₀_pre : IsPreconnected (c₀ ∩ Θ) := + (Γ.isPathConnected_cell_inter_cuff hc₀ hΘ hc₀_Θ).isConnected.isPreconnected + have hc₀_A_or_B : c₀ ∩ Θ ⊆ A ∨ c₀ ∩ Θ ⊆ B := by + rw [isPreconnected_closed_iff] at hc₀_pre + by_cases hA : c₀ ∩ Θ ⊆ A + · exact Or.inl hA + · right + by_contra hB + obtain ⟨x₁, hx₁c, hx₁A⟩ := not_subset.mp hA + obtain ⟨x₂, hx₂c, hx₂B⟩ := not_subset.mp hB + have hx₁B : x₁ ∈ B := (hc₀_sub hx₁c).resolve_left hx₁A + have hx₂A : x₂ ∈ A := (hc₀_sub hx₂c).resolve_right hx₂B + obtain ⟨z, hzc, hzA, hzB⟩ := hc₀_pre A B hA_cl hB_cl hc₀_sub ⟨x₂, hx₂c, hx₂A⟩ ⟨x₁, hx₁c, hx₁B⟩ + exact Set.disjoint_left.mp hc₀_disj hzc ⟨hzA, hzB⟩ + rcases hc₀_A_or_B with hc₀A | hc₀B + · exact hcl_sub_cl.trans (hA_cl.closure_subset_iff.mpr hc₀A) + · exfalso + have ht₀_mem : GM19.cuffPoint f t₀ ∈ closure c₀ ∩ Θ := ⟨ht₀_cl, cuffPoint_mem f t₀⟩ + exact hnot_B t₀ ht₀ (hcl_sub_cl.trans (hB_cl.closure_subset_iff.mpr hc₀B) ht₀_mem) + +theorem inOrderOn_of_mem_closure_border_cell_left {S : Type} [TopologicalSpace S] [T2Space S] + (Γ : Painting S) {Θ c₀ : Set S} (hΘ : Θ ∈ cuffs S) (hc₀ : c₀ ∈ Γ.C) + (hc₀_Θ : (c₀ ∩ Θ).Nonempty) {m₁ m₂ m₃ m₄ : S} + (h12 : m₁ ≠ m₂) (h23 : m₂ ≠ m₃) (h34 : m₃ ≠ m₄) (h41 : m₄ ≠ m₁) + (hm₂N : m₂ ∈ Γ.N) (hm₄N : m₄ ∈ Γ.N) + (hm₁_cl : m₁ ∈ closure c₀) (hord : GM19.InOrderOn Θ m₁ m₂ m₃ m₄) + {u : S} (hu : u ∈ closure c₀ ∩ Θ) : + GM19.InOrderOn Θ u m₂ m₃ m₄ := by + obtain ⟨f, t₁, t₂, t₃, t₄, ht12, ht23, ht34, ht41, rfl, rfl, rfl, rfl⟩ := hord + have hlt12 : t₁ < t₂ := lt_of_le_of_ne ht12 fun h => h12 (by rw [h]) + have hlt23 : t₂ < t₃ := lt_of_le_of_ne ht23 fun h => h23 (by rw [h]) + have hlt34 : t₃ < t₄ := lt_of_le_of_ne ht34 fun h => h34 (by rw [h]) + have hlt41 : t₄ < t₁ + 2 * Real.pi := lt_of_le_of_ne ht41 fun h => + h41 (by rw [h, cuffPoint_add_two_pi]) + have haN : GM19.cuffPoint f (t₄ - 2 * Real.pi) ∈ Γ.N := by + rw [cuffPoint_sub_two_pi]; exact hm₄N + have hcl := closure_border_cell_subset_cuffPoint_Icc Γ hΘ hc₀ hc₀_Θ f + (a := t₄ - 2 * Real.pi) (b := t₂) (by linarith) (by linarith) haN hm₂N + (t₀ := t₁) ⟨by linarith, hlt12⟩ hm₁_cl hu + rcases hcl with ⟨tu, ⟨htu1, htu2⟩, rfl⟩ + exact ⟨f, tu, t₂, t₃, t₄, htu2, ht23, ht34, by linarith, rfl, rfl, rfl, rfl⟩ + +theorem inOrderOn_of_mem_closure_border_cell_mid {S : Type} [TopologicalSpace S] [T2Space S] + (Γ : Painting S) {Θ c₀ : Set S} (hΘ : Θ ∈ cuffs S) (hc₀ : c₀ ∈ Γ.C) + (hc₀_Θ : (c₀ ∩ Θ).Nonempty) {m₁ m₂ m₃ m₄ : S} + (h12 : m₁ ≠ m₂) (h23 : m₂ ≠ m₃) (h34 : m₃ ≠ m₄) (h41 : m₄ ≠ m₁) + (hm₁N : m₁ ∈ Γ.N) (hm₃N : m₃ ∈ Γ.N) + (hm₂_cl : m₂ ∈ closure c₀) (hord : GM19.InOrderOn Θ m₁ m₂ m₃ m₄) + {u : S} (hu : u ∈ closure c₀ ∩ Θ) : + GM19.InOrderOn Θ m₁ u m₃ m₄ := by + obtain ⟨f, t₁, t₂, t₃, t₄, ht12, ht23, ht34, ht41, rfl, rfl, rfl, rfl⟩ := hord + have hlt12 : t₁ < t₂ := lt_of_le_of_ne ht12 fun h => h12 (by rw [h]) + have hlt23 : t₂ < t₃ := lt_of_le_of_ne ht23 fun h => h23 (by rw [h]) + have hlt34 : t₃ < t₄ := lt_of_le_of_ne ht34 fun h => h34 (by rw [h]) + have hlt41 : t₄ < t₁ + 2 * Real.pi := lt_of_le_of_ne ht41 fun h => + h41 (by rw [h, cuffPoint_add_two_pi]) + have hcl := closure_border_cell_subset_cuffPoint_Icc Γ hΘ hc₀ hc₀_Θ f + (a := t₁) (b := t₃) (by linarith) (by linarith) hm₁N hm₃N + (t₀ := t₂) ⟨hlt12, hlt23⟩ hm₂_cl hu + rcases hcl with ⟨tu, ⟨htu1, htu2⟩, rfl⟩ + exact ⟨f, t₁, tu, t₃, t₄, htu1, htu2, ht34, ht41, rfl, rfl, rfl, rfl⟩ + +@[expose] public section + +open Classical in +/-- A painting obtained by moving a border node along its cuff and replacing two incident cells. -/ +def IsIndentedBorderPainting {S : Type} [TopologicalSpace S] + (Γ : Painting S) (Θ c₀ : Set S) (n₁ n₂ n_star : S) (R : Set (Set S)) (Γ' : Painting S) : Prop := + ∃ (n_star' : S) (c₁ c₂ : Set S) (cellMap : Set S → Set S), + n_star' ∈ c₀ ∩ Θ ∧ + Γ'.N = (Γ.N \ {n_star}) ∪ {n_star'} ∧ + c₁ ∈ Γ'.C ∧ c₂ ∈ Γ'.C ∧ c₁ ≠ c₂ ∧ + (c₁ ∩ Θ).Nonempty ∧ (c₂ ∩ Θ).Nonempty ∧ + tilde c₁ = {n₁, n_star'} ∧ tilde c₂ = {n₂, n_star'} ∧ + Set.BijOn cellMap (Γ'.C \ {c₁, c₂}) (Γ.C \ R) ∧ + (∀ d ∈ Γ'.C \ {c₁, c₂}, ∀ Θ' ∈ cuffs S, ((d ∩ Θ').Nonempty ↔ ((cellMap d) ∩ Θ').Nonempty)) ∧ + (∀ d ∈ Γ'.C \ {c₁, c₂}, ((d ∩ bd S).Nonempty ↔ ((cellMap d) ∩ bd S).Nonempty)) ∧ + (∀ d ∈ Γ'.C \ {c₁, c₂}, + tilde d = (fun x => if x = n_star then n_star' else x) '' tilde (cellMap d)) + +end + +@[expose] public section + +/-- The border-indentation statement of Graph Minors XVII, (9.6). -/ +def IndentedBorderPaintingStatement : Prop := + ∀ (S : Type) [TopologicalSpace S] [ConnectedSpace S], IsSurface S → + ∀ (Γ : Painting S), + 6 ≤ Γ.N.ncard → + (∀ r ∈ Γ.regions, IsOpenDisc r) → + (∀ r ∈ Γ.regions, IsOArc (closure r \ r)) → + (∀ c ∈ Γ.C, 2 ≤ (tilde c).ncard) → + (∀ F : Set S, IsLine F → Γ.IsNormal F → F ∩ bd S = lineEnds F → (F ∩ Γ.N).ncard = 2 → + ∃ Δ : Set S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd S ∧ + Δ ∩ Γ.N ⊆ F ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard = 1) → + (∀ c₁ ∈ Γ.C, ∀ c₂ ∈ Γ.C, c₁ ≠ c₂ → tilde c₁ ⊆ tilde c₂ → + (c₁ ∩ bd S).Nonempty ∧ (tilde c₂).ncard = 3) → + ∀ Θ ∈ cuffs S, ∀ c₀ ∈ Γ.C, (c₀ ∩ Θ).Nonempty → + ∀ n₁ n₂ : S, n₁ ≠ n₂ → tilde c₀ = {n₁, n₂} → + ((¬ ∃ c ∈ Γ.C, ¬ (c ∩ bd S).Nonempty ∧ tilde c₀ ⊆ tilde c) → + ∃ n₀ ∈ Γ.N \ bd S, ∃ Γ' : Painting S, + IsIndentedBorderPainting Γ Θ c₀ n₁ n₂ n₀ {c₀} Γ') ∧ + (∀ c₃ ∈ Γ.C, ¬ (c₃ ∩ bd S).Nonempty → ∀ n₃ ∈ Γ.N \ bd S, + tilde c₃ = {n₁, n₂, n₃} → + ∃ Γ' : Painting S, IsIndentedBorderPainting Γ Θ c₀ n₁ n₂ n₃ {c₀, c₃} Γ') + +end + +theorem border_cell_vertex_mem_borderPlus_of_mem_other + {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) + {c₀ : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) (hbd₀ : (c₀ ∩ bd π.S).Nonempty) + {n₁ n₂ : π.S} (htc₀ : tilde c₀ = {n₁, n₂}) + {w : α} (hw₀ : w ∈ (π.cellGraph c₀).vertexSet) + {d : Set π.S} (hd : d ∈ π.Γ.C) (hne : d ≠ c₀) (hwd : w ∈ (π.cellGraph d).vertexSet) : + w ∈ π.borderPlus n₁ ∪ π.borderPlus n₂ := by + obtain ⟨n, hn_tc, hwn⟩ := π.p6 c₀ hc₀ hbd₀ w hw₀ ⟨d, hd, hne, hwd⟩ + rw [htc₀] at hn_tc + rcases hn_tc with rfl | rfl + · exact Or.inl hwn + · exact Or.inr hwn + +theorem border_cell_vertex_inter_borderPlus_subset + {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) + {c₀ : Set π.S} (hc₀ : c₀ ∈ π.Γ.C) (hbd₀ : (c₀ ∩ bd π.S).Nonempty) + {n₁ n₂ : π.S} (htc₀ : tilde c₀ = {n₁, n₂}) + {m : π.S} (hm : m ∈ π.Γ.N ∩ bd π.S) + {w : α} (hw₀ : w ∈ (π.cellGraph c₀).vertexSet) (hwm : w ∈ π.borderPlus m) : + w ∈ π.borderPlus n₁ ∪ π.borderPlus n₂ := by + let Θ' := connectedComponentIn (bd π.S) m + have hΘ' : Θ' ∈ cuffs π.S := ⟨m, hm.2, rfl⟩ + have hΘ'_arc : IsOArc Θ' := (cuff_statement.{0} π.S π.isSurface).2.2 Θ' hΘ' + have hΘ'_bd : Θ' ⊆ bd π.S := connectedComponentIn_subset (bd π.S) m + obtain ⟨E⟩ := π.Γ.exists_cuffEnumeration hΘ' hΘ'_arc + have hm_Θ' : m ∈ π.Γ.N ∩ Θ' := ⟨hm.1, mem_connectedComponentIn hm.2⟩ + rw [← E.range_node] at hm_Θ' + rcases hm_Θ' with ⟨i, hi_eq⟩ + let d := E.cell i + have hd_mem : d ∈ {c ∈ π.Γ.C | (c ∩ Θ').Nonempty} := E.range_cell ▸ ⟨i, rfl⟩ + have hd_bd : (d ∩ bd π.S).Nonempty := hd_mem.2.mono (inter_subset_inter_right _ hΘ'_bd) + have hm_td : m ∈ tilde d := by rw [← hi_eq, E.cell_tilde i]; exact Or.inl rfl + by_cases hdc₀ : d = c₀ + · subst hdc₀ + rw [htc₀] at hm_td + rcases hm_td with rfl | rfl + · exact Or.inl hwm + · exact Or.inr hwm + · have hwd : w ∈ (π.cellGraph d).vertexSet := + π.borderPlus_subset_cellGraph hd_mem.1 hd_bd hm_td hwm + exact border_cell_vertex_mem_borderPlus_of_mem_other π hc₀ hbd₀ htc₀ hw₀ hd_mem.1 hdc₀ hwd + +theorem nodeVertex_notMem_border_cellGraph_of_notMem_cuff + {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) + (hdom : π.domγ = π.Γ.N) + (hnode_cell : ∀ n ∈ π.Γ.N, ∃ d ∈ π.Γ.C, n ∈ tilde d) + {Θ c₀ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (hc₀ : c₀ ∈ π.Γ.C) (hc₀_Θ : (c₀ ∩ Θ).Nonempty) + {n₁ n₂ : π.S} (htc₀ : tilde c₀ = {n₁, n₂}) + {m : π.S} (hmN : m ∈ π.Γ.N) (hm_not_Θ : m ∉ Θ) : + π.nodeVertex m ∉ (π.cellGraph c₀).vertexSet := by + intro hmem + have hsub_cuff := π.Γ.border_cell_subset_cuff hc₀ hΘ hc₀_Θ + have hbd₀ : (c₀ ∩ bd π.S).Nonempty := hsub_cuff.2.1 ▸ hc₀_Θ + have hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ := hsub_cuff.2.2.2.1 (htc₀ ▸ Or.inl rfl) + have hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ := hsub_cuff.2.2.2.1 (htc₀ ▸ Or.inr rfl) + obtain ⟨d, hd, hm_td⟩ := hnode_cell m hmN + have hdc₀ : d ≠ c₀ := fun h => hm_not_Θ (hsub_cuff.2.2.2.1 (h ▸ hm_td)).2 + have hmd : π.nodeVertex m ∈ (π.cellGraph d).vertexSet := π.p2 d hd m ⟨hm_td, hdom ▸ hmN⟩ + have hbp := border_cell_vertex_mem_borderPlus_of_mem_other π hc₀ hbd₀ htc₀ hmem hd hdc₀ hmd + rcases hbp with h1 | h2 + · rcases h1 with hbs | ⟨_, hEq⟩ + · exact π.p4_notMem Θ hΘ n₁ hn₁_Θ m (hdom ▸ hmN) hm_not_Θ hbs + · exact hm_not_Θ (π.nodeVertex_injOn (hdom ▸ hmN) (hdom ▸ hn₁_Θ.1) hEq ▸ hn₁_Θ.2) + · rcases h2 with hbs | ⟨_, hEq⟩ + · exact π.p4_notMem Θ hΘ n₂ hn₂_Θ m (hdom ▸ hmN) hm_not_Θ hbs + · exact hm_not_Θ (π.nodeVertex_injOn (hdom ▸ hmN) (hdom ▸ hn₂_Θ.1) hEq ▸ hn₂_Θ.2) + +theorem tilde_border_cell_subset_bd {S : Type} [TopologicalSpace S] (Γ : Painting S) + {c : Set S} (hc : c ∈ Γ.C) (hbd : (c ∩ bd S).Nonempty) : + tilde c ⊆ bd S := by + obtain ⟨u, v, _, htc, _, _, hu, hv⟩ := Γ.border_cell_exists_ends hc hbd + rw [htc] + rintro x (rfl | rfl) + · exact hu.2 + · exact hv.2 + +theorem internal_nodeVertex_mem_cellGraph_iff + {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) + (hdom : π.domγ = π.Γ.N) + (hnode_cell : ∀ n ∈ π.Γ.N, ∃ d ∈ π.Γ.C, n ∈ tilde d) + {n_star : π.S} (hn_star : n_star ∈ π.Γ.N \ bd π.S) + {c : Set π.S} (hc : c ∈ π.Γ.C) : + π.nodeVertex n_star ∈ (π.cellGraph c).vertexSet ↔ n_star ∈ tilde c := by + constructor + · intro hmem + obtain ⟨c_star, hc_star, hn_tc_star⟩ := hnode_cell n_star hn_star.1 + have hmem_star : π.nodeVertex n_star ∈ (π.cellGraph c_star).vertexSet := + π.p2 c_star hc_star n_star ⟨hn_tc_star, hdom ▸ hn_star.1⟩ + by_cases hcc : c = c_star + · exact hcc ▸ hn_tc_star + · by_cases hbd : (c ∩ bd π.S).Nonempty + · exfalso + obtain ⟨m, hm_tc, hbp⟩ := π.p6 c hc hbd (π.nodeVertex n_star) hmem ⟨c_star, hc_star, + Ne.symm hcc, hmem_star⟩ + have hmN : m ∈ π.Γ.N := π.Γ.tilde_subset_N hc hm_tc + have hmbd : m ∈ bd π.S := tilde_border_cell_subset_bd π.Γ hc hbd hm_tc + let Θ' := connectedComponentIn (bd π.S) m + have hΘ' : Θ' ∈ cuffs π.S := ⟨m, hmbd, rfl⟩ + have hm_Θ' : m ∈ π.Γ.N ∩ Θ' := ⟨hmN, mem_connectedComponentIn hmbd⟩ + have hn_not_Θ' : n_star ∉ Θ' := fun h => hn_star.2 (connectedComponentIn_subset + (bd π.S) m h) + rcases hbp with hbs | ⟨_, hEq⟩ + · exact π.p4_notMem Θ' hΘ' m hm_Θ' n_star (hdom ▸ hn_star.1) hn_not_Θ' hbs + · exact hn_star.2 (π.nodeVertex_injOn (hdom ▸ hn_star.1) (hdom ▸ hmN) hEq ▸ hmbd) + · obtain ⟨m, ⟨hm_tc, hm_dom⟩, hEq⟩ := + π.p5 c hc hbd (π.nodeVertex n_star) hmem ⟨c_star, hc_star, Ne.symm hcc, hmem_star⟩ + exact π.nodeVertex_injOn (hdom ▸ hn_star.1) hm_dom hEq.symm ▸ hm_tc + · intro hn_tc + exact π.p2 c hc n_star ⟨hn_tc, hdom ▸ hn_star.1⟩ + +theorem isTruer_of_le_lt {α : Type u} {β : Type v} {G₁ G₂ : Hypergraph α β} + {π₁ : Portrayal G₁} {π₂ : Portrayal G₂} {k₀ : Fin 6} + (hle : ∀ i : Fin 6, i ≤ k₀ → π₁.truth i ≤ π₂.truth i) + (hlt : π₁.truth k₀ < π₂.truth k₀) : + π₁.IsTruer π₂ := by + classical + let P : ℕ → Prop := fun n => ∃ h : n < 6, π₁.truth ⟨n, h⟩ < π₂.truth ⟨n, h⟩ + have hex : ∃ n, P n := ⟨k₀.1, k₀.2, hlt⟩ + let n := Nat.find hex + obtain ⟨hn6, hn_lt⟩ := Nat.find_spec hex + have hn_le : n ≤ k₀.1 := Nat.find_min' hex ⟨k₀.2, hlt⟩ + refine ⟨⟨n, hn6⟩, fun i hi => ?_, hn_lt⟩ + have hi_not : ¬ P i.1 := Nat.find_min hex hi + have hi_le : π₁.truth i ≤ π₂.truth i := hle i (Fin.le_iff_val_le_val.mpr (hi.le.trans hn_le)) + exact le_antisymm hi_le (not_lt.mp fun h => hi_not ⟨i.2, h⟩) + +theorem linkagePairs_symm {α : Type u} (K : SimpleGraph α) (X Y : Set α) (k : ℕ) (x y : α) + (h : Portrayal.LinkagePairs K X Y k x y) : + Portrayal.LinkagePairs K Y X k y x := by + intro P hdisj + let P' : Fin k → PathFromTo K X Y := fun i => + { first := (P i).last + last := (P i).first + walk := (P i).walk.reverse + isPath := (P i).isPath.reverse + first_mem := (P i).last_mem + last_mem := (P i).first_mem } + have hdisj' : Pairwise fun i j => + Disjoint {z | z ∈ (P' i).walk.support} {z | z ∈ (P' j).walk.support} := by + intro i j hij + refine Set.disjoint_left.mpr fun z hzi hzj => ?_ + change z ∈ (P i).walk.reverse.support at hzi + change z ∈ (P j).walk.reverse.support at hzj + rw [SimpleGraph.Walk.support_reverse, List.mem_reverse] at hzi hzj + exact Set.disjoint_left.mp (hdisj hij) hzi hzj + obtain ⟨i, hf, hl⟩ := h P' hdisj' + exact ⟨i, hl, hf⟩ + +open Classical in +private noncomputable abbrev indentNodeMap {X : Type} (old new : X) (x : X) : X := + if x = old then new else x + +open Classical in +private noncomputable abbrev indentBorderSet {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (A₁ A₂ : Hypergraph α β) (old new n : π.S) : Set α := + if n = new then (A₁.vertexSet ∩ A₂.vertexSet) \ {π.nodeVertex old} + else π.borderSet n + +private noncomputable abbrev indentBorderPlus {α : Type u} {β : Type v} {G : Hypergraph α β} + (π : Portrayal G) (Γ' : Painting π.S) (A₁ A₂ : Hypergraph α β) + (old new : π.S) (nodeInv : π.S → π.S) (n : π.S) : Set α := + {w | w ∈ indentBorderSet π A₁ A₂ old new n ∨ (n ∈ Γ'.N ∧ w = π.nodeVertex (nodeInv n))} + +open Classical in +private noncomputable abbrev indented_cuff_portrayal + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + (hdom : π.domγ = π.Γ.N) + (hnode_cell : ∀ n ∈ π.Γ.N, ∃ d ∈ π.Γ.C, n ∈ tilde d) + {Θ : Set π.S} + {c₀ : Set π.S} + (hΘ : Θ ∈ cuffs π.S) + (hc₀ : c₀ ∈ π.Γ.C) + (hc₀_Θ : (c₀ ∩ Θ).Nonempty) + {n₁ : π.S} + {n₂ : π.S} + {n_star : π.S} + (hne : n₁ ≠ n₂) + (htc₀ : tilde c₀ = {n₁, n₂}) + (hn_star : n_star ∈ π.Γ.N \ bd π.S) + {R : Set (Set π.S)} + (hc₀_R : c₀ ∈ R) + (hR_cases : ∀ c ∈ R, c = c₀ ∨ ¬(c ∩ bd π.S).Nonempty ∧ tilde c = {n₁, n₂, n_star}) + {Γ' : Painting π.S} + {A₁' : Hypergraph α β} + {A₂' : Hypergraph α β} + (hA₁'_le : A₁' ≤ G) + (hA₂'_le : A₂' ≤ G) + (hV_union : (π.cellsUnion R).vertexSet ⊆ A₁'.vertexSet ∪ A₂'.vertexSet) + (hV_sub : A₁'.vertexSet ∪ A₂'.vertexSet ⊆ (π.cellsUnion R).vertexSet ∪ {π.nodeVertex n_star}) + (hE_union : A₁'.edgeSet ∪ A₂'.edgeSet = (π.cellsUnion R).edgeSet) + (hE_disj : Disjoint A₁'.edgeSet A₂'.edgeSet) + (hbp₁ : π.borderPlus n₁ ⊆ A₁'.vertexSet) + (hbp₂ : π.borderPlus n₂ ⊆ A₂'.vertexSet) + (hn_star_mem : π.nodeVertex n_star ∈ A₁'.vertexSet ∩ A₂'.vertexSet) + (hbs_sub : (A₁'.vertexSet ∩ A₂'.vertexSet) \ {π.nodeVertex n_star} ⊆ (π.cellGraph + c₀).vertexSet) + (hbs₁_le : (π.borderSet n₁).ncard ≤ π.warpAt Θ) + (hbs₂_le : (π.borderSet n₂).ncard ≤ π.warpAt Θ) + (hbs_star_le : ((A₁'.vertexSet ∩ A₂'.vertexSet) \ {π.nodeVertex n_star}).ncard ≤ π.warpAt Θ) + (hlp₁ : (π.borderPlus n₁).ncard = π.warpAt Θ + 1 → (A₁'.vertexSet ∩ A₂'.vertexSet).ncard = + π.warpAt Θ + 1 → Portrayal.LinkagePairs A₁'.skeleton (π.borderPlus n₁) (A₁'.vertexSet ∩ + A₂'.vertexSet) (π.warpAt Θ + 1) (π.nodeVertex n₁) (π.nodeVertex n_star)) + (hlp₂ : (π.borderPlus n₂).ncard = π.warpAt Θ + 1 → (A₁'.vertexSet ∩ A₂'.vertexSet).ncard = + π.warpAt Θ + 1 → Portrayal.LinkagePairs A₂'.skeleton (π.borderPlus n₂) (A₁'.vertexSet ∩ + A₂'.vertexSet) (π.warpAt Θ + 1) (π.nodeVertex n₂) (π.nodeVertex n_star)) + [T2Space π.S] + (n_star' : π.S) + (c₁ : Set π.S) + (c₂ : Set π.S) + (cellMap : Set π.S → Set π.S) + (hn_star'_mem : n_star' ∈ c₀ ∩ Θ) + (hN' : Γ'.N = π.Γ.N \ {n_star} ∪ {n_star'}) + (hc₁_C' : c₁ ∈ Γ'.C) + (hc₂_C' : c₂ ∈ Γ'.C) + (hc₁₂_ne : c₁ ≠ c₂) + (hc₁_Θ : (c₁ ∩ Θ).Nonempty) + (hc₂_Θ : (c₂ ∩ Θ).Nonempty) + (htc₁ : tilde c₁ = {n₁, n_star'}) + (htc₂ : tilde c₂ = {n₂, n_star'}) + (hbij : BijOn cellMap (Γ'.C \ {c₁, c₂}) (π.Γ.C \ R)) + (hΘ_iff : ∀ d ∈ Γ'.C \ {c₁, c₂}, ∀ Θ' ∈ cuffs π.S, (d ∩ Θ').Nonempty ↔ (cellMap d ∩ + Θ').Nonempty) + (hbd_iff : ∀ d ∈ Γ'.C \ {c₁, c₂}, (d ∩ bd π.S).Nonempty ↔ (cellMap d ∩ bd π.S).Nonempty) + (htilde_map : ∀ d ∈ Γ'.C \ {c₁, c₂}, tilde d = (fun x => if x = n_star then n_star' else x) '' + tilde (cellMap d)) + (hΘ_bd : Θ ⊆ bd π.S) + (hsub_cuff₀ : closure c₀ ∩ bd π.S ⊆ Θ ∧ c₀ ∩ bd π.S = c₀ ∩ Θ ∧ closure c₀ ∩ bd π.S = closure + c₀ ∩ Θ ∧ tilde c₀ ⊆ π.Γ.N ∩ Θ ∧ ∀ Θ' ∈ cuffs π.S, (c₀ ∩ Θ').Nonempty → Θ' = Θ) + (hbd₀ : (c₀ ∩ bd π.S).Nonempty) + (hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ) + (hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ) + (hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S) + (hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S) + (hn_star'_bd : n_star' ∈ bd π.S) + (hn_star'_not_N : n_star' ∉ π.Γ.N) + (hn_star'_ne_star : n_star' ≠ n_star) + (hn₁_ne_star : n₁ ≠ n_star) + (hn₂_ne_star : n₂ ≠ n_star) + (hn₁_ne_star' : n₁ ≠ n_star') + (hn₂_ne_star' : n₂ ≠ n_star') + (hn_star'_N' : n_star' ∈ Γ'.N) + (hn₁_N' : n₁ ∈ Γ'.N) + (hn₂_N' : n₂ ∈ Γ'.N) + (hnodeMap_inv : ∀ x ∈ π.Γ.N, (indentNodeMap n_star' n_star) ((indentNodeMap n_star n_star') + x) = x) + (hnodeMap_injOn : InjOn (indentNodeMap n_star n_star') π.Γ.N) + (hnodeInv_mem : ∀ n ∈ Γ'.N, (indentNodeMap n_star' n_star) n ∈ π.Γ.N) + (hnodeInv_injOn : InjOn (indentNodeMap n_star' n_star) Γ'.N) + (cellG' : Set π.S → Hypergraph α β) + (hcellG'_c₁ : cellG' c₁ = A₁') + (hcellG'_c₂ : cellG' c₂ = A₂') + (hcellG'_other : ∀ d ∈ Γ'.C \ {c₁, c₂}, cellG' d = π.cellGraph (cellMap d)) + (hcellMap_mem : ∀ d ∈ Γ'.C \ {c₁, c₂}, cellMap d ∈ π.Γ.C \ R) + (hnodeV'_star' : (π.nodeVertex ∘ (indentNodeMap n_star' n_star)) n_star' = π.nodeVertex + n_star) + (hnodeV'_other : ∀ (n : π.S), n ≠ n_star' → (π.nodeVertex ∘ (indentNodeMap n_star' n_star)) + n = π.nodeVertex n) + (hnodeV'_map : ∀ x ∈ π.Γ.N, (π.nodeVertex ∘ (indentNodeMap n_star' n_star)) ((indentNodeMap + n_star n_star') x) = π.nodeVertex x) + (hbp'_star' : (indentBorderPlus π Γ' A₁' A₂' n_star n_star' (indentNodeMap n_star' n_star)) + n_star' = A₁'.vertexSet ∩ A₂'.vertexSet) + (hbp'_other : ∀ n ∈ π.Γ.N, n ≠ n_star → (indentBorderPlus π Γ' A₁' A₂' n_star n_star' + (indentNodeMap n_star' n_star)) n = π.borderPlus n) + (hbp'_other_bd : ∀ n ∈ π.Γ.N, n ∈ bd π.S → (indentBorderPlus π Γ' A₁' A₂' n_star n_star' + (indentNodeMap n_star' n_star)) n = π.borderPlus n) + (hborder_not_star : ∀ d ∈ Γ'.C \ {c₁, c₂}, (d ∩ bd π.S).Nonempty → n_star ∉ tilde (cellMap d) + ∧ tilde d = tilde (cellMap d) ∧ n_star' ∉ tilde d) : Portrayal G := + let nodeMap := indentNodeMap n_star n_star' + let nodeInv := indentNodeMap n_star' n_star + let borderS' := indentBorderSet π A₁' A₂' n_star n_star' + let nodeV' := π.nodeVertex ∘ nodeInv + let bp' := indentBorderPlus π Γ' A₁' A₂' n_star n_star' nodeInv + have hnodeV'_star' : nodeV' n_star' = π.nodeVertex n_star := hnodeV'_star' + have hnodeV'_other : ∀ n ≠ n_star', nodeV' n = π.nodeVertex n := hnodeV'_other + have hnodeV'_map : ∀ x ∈ π.Γ.N, nodeV' (nodeMap x) = π.nodeVertex x := hnodeV'_map + have hbp'_star' : bp' n_star' = A₁'.vertexSet ∩ A₂'.vertexSet := hbp'_star' + have hbp'_other : ∀ n ∈ π.Γ.N, n ≠ n_star → bp' n = π.borderPlus n := hbp'_other + have hbp'_other_bd : ∀ n ∈ π.Γ.N, n ∈ bd π.S → bp' n = π.borderPlus n := hbp'_other_bd + { S := π.S + isSurface := π.isSurface + connected := π.connected + Γ := Γ' + cellGraph := cellG' + borderSet := borderS' + domγ := Γ'.N + nodeVertex := nodeV' + cellGraph_le := by + intro d hd + by_cases hd₁ : d = c₁ + · subst hd₁; rw [hcellG'_c₁]; exact hA₁'_le + · by_cases hd₂ : d = c₂ + · subst hd₂; rw [hcellG'_c₂]; exact hA₂'_le + · have hd_diff : d ∈ Γ'.C \ {c₁, c₂} := ⟨hd, by rintro (rfl | rfl) <;> contradiction⟩ + rw [hcellG'_other d hd_diff] + exact π.cellGraph_le (cellMap d) (hcellMap_mem d hd_diff).1 + borderSet_subset := by + intro n hn + dsimp [borderS', indentBorderSet] + split_ifs with h + · exact sdiff_subset.trans (inter_subset_left.trans hA₁'_le.1) + · have hn_N : n ∈ π.Γ.N := by + have := hn.1 + rw [hN'] at this + rcases this with ⟨hnN, _⟩ | hn_eq + · exact hnN + · exact (h hn_eq).elim + exact π.borderSet_subset n ⟨hn_N, hn.2⟩ + domγ_subset := Subset.rfl + nodeVertex_mem := fun n hn => π.nodeVertex_mem (nodeInv n) (hdom ▸ hnodeInv_mem n hn) + nodeVertex_injOn := by + intro x hx y hy hEq + exact hnodeInv_injOn hx hy + (π.nodeVertex_injOn (hdom ▸ hnodeInv_mem x hx) (hdom ▸ hnodeInv_mem y hy) hEq) + p1_vertex := by + intro v hv + obtain ⟨c, hc, hvc⟩ := π.p1_vertex v hv + by_cases hcR : c ∈ R + · have hv_cu : v ∈ (π.cellsUnion R).vertexSet := + mem_iUnion₂.mpr ⟨c, ⟨hcR, hc⟩, hvc⟩ + rcases hV_union hv_cu with hv₁ | hv₂ + · exact ⟨c₁, hc₁_C', hcellG'_c₁.symm ▸ hv₁⟩ + · exact ⟨c₂, hc₂_C', hcellG'_c₂.symm ▸ hv₂⟩ + · obtain ⟨d, hd_diff, hd_eq⟩ := hbij.surjOn ⟨hc, hcR⟩ + exact ⟨d, hd_diff.1, by rw [hcellG'_other d hd_diff, hd_eq]; exact hvc⟩ + p1_edge := by + intro e he + obtain ⟨c, hc, hec⟩ := π.p1_edge e he + by_cases hcR : c ∈ R + · have he_cu : e ∈ (π.cellsUnion R).edgeSet := + mem_iUnion₂.mpr ⟨c, ⟨hcR, hc⟩, hec⟩ + rw [← hE_union] at he_cu + rcases he_cu with he₁ | he₂ + · exact ⟨c₁, hc₁_C', hcellG'_c₁.symm ▸ he₁⟩ + · exact ⟨c₂, hc₂_C', hcellG'_c₂.symm ▸ he₂⟩ + · obtain ⟨d, hd_diff, hd_eq⟩ := hbij.surjOn ⟨hc, hcR⟩ + exact ⟨d, hd_diff.1, by rw [hcellG'_other d hd_diff, hd_eq]; exact hec⟩ + p1_disjoint := by + intro d₁ hd₁ d₂ hd₂ hne_d + have hdisj_R : ∀ i_e ∈ (π.cellsUnion R).edgeSet, ∀ d ∈ Γ'.C \ {c₁, c₂}, + i_e ∉ (cellG' d).edgeSet := by + intro e he d hd_diff hed + rw [hcellG'_other d hd_diff] at hed + rcases mem_iUnion₂.mp he with ⟨c, ⟨hcR, hcC⟩, hec⟩ + have hcd_ne : c ≠ cellMap d := fun h => (hcellMap_mem d hd_diff).2 (h ▸ hcR) + exact Set.disjoint_left.mp (π.p1_disjoint c hcC (cellMap d) + (hcellMap_mem d hd_diff).1 hcd_ne) hec hed + by_cases hd₁_pair : d₁ = c₁ ∨ d₁ = c₂ <;> by_cases hd₂_pair : d₂ = c₁ ∨ d₂ = c₂ + · rcases hd₁_pair with rfl | rfl <;> rcases hd₂_pair with rfl | rfl + · exact (hne_d rfl).elim + · rw [hcellG'_c₁, hcellG'_c₂]; exact hE_disj + · rw [hcellG'_c₂, hcellG'_c₁]; exact hE_disj.symm + · exact (hne_d rfl).elim + · have hd₂_diff : d₂ ∈ Γ'.C \ {c₁, c₂} := ⟨hd₂, hd₂_pair⟩ + refine Set.disjoint_left.mpr fun e he₁ he₂ => hdisj_R e ?_ d₂ hd₂_diff he₂ + rw [← hE_union] + rcases hd₁_pair with rfl | rfl + · exact Or.inl (hcellG'_c₁ ▸ he₁) + · exact Or.inr (hcellG'_c₂ ▸ he₁) + · have hd₁_diff : d₁ ∈ Γ'.C \ {c₁, c₂} := ⟨hd₁, hd₁_pair⟩ + refine Set.disjoint_left.mpr fun e he₁ he₂ => hdisj_R e ?_ d₁ hd₁_diff he₁ + rw [← hE_union] + rcases hd₂_pair with rfl | rfl + · exact Or.inl (hcellG'_c₁ ▸ he₂) + · exact Or.inr (hcellG'_c₂ ▸ he₂) + · have hd₁_diff : d₁ ∈ Γ'.C \ {c₁, c₂} := ⟨hd₁, hd₁_pair⟩ + have hd₂_diff : d₂ ∈ Γ'.C \ {c₁, c₂} := ⟨hd₂, hd₂_pair⟩ + rw [hcellG'_other d₁ hd₁_diff, hcellG'_other d₂ hd₂_diff] + exact π.p1_disjoint (cellMap d₁) (hcellMap_mem d₁ hd₁_diff).1 + (cellMap d₂) (hcellMap_mem d₂ hd₂_diff).1 + (fun h => hne_d (hbij.injOn hd₁_diff hd₂_diff h)) + p2 := by + intro d hd n ⟨hn_td, _⟩ + by_cases hd₁ : d = c₁ + · rw [hd₁, hcellG'_c₁] + rw [hd₁, htc₁] at hn_td + rcases hn_td with hn_eq | hn_eq + · rw [hn_eq, hnodeV'_other n₁ hn₁_ne_star'] + exact hbp₁ (Or.inr ⟨hdom ▸ hn₁_Θ.1, rfl⟩) + · rw [mem_singleton_iff.mp hn_eq, hnodeV'_star'] + exact hn_star_mem.1 + · by_cases hd₂ : d = c₂ + · rw [hd₂, hcellG'_c₂] + rw [hd₂, htc₂] at hn_td + rcases hn_td with hn_eq | hn_eq + · rw [hn_eq, hnodeV'_other n₂ hn₂_ne_star'] + exact hbp₂ (Or.inr ⟨hdom ▸ hn₂_Θ.1, rfl⟩) + · rw [mem_singleton_iff.mp hn_eq, hnodeV'_star'] + exact hn_star_mem.2 + · have hd_diff : d ∈ Γ'.C \ {c₁, c₂} := + ⟨hd, by simp [hd₁, hd₂]⟩ + rw [hcellG'_other d hd_diff] + rw [htilde_map d hd_diff] at hn_td + rcases hn_td with ⟨x, hx_tc, rfl⟩ + have hxN : x ∈ π.Γ.N := π.Γ.tilde_subset_N (hcellMap_mem d hd_diff).1 hx_tc + rw [hnodeV'_map x hxN] + exact π.p2 (cellMap d) (hcellMap_mem d hd_diff).1 x ⟨hx_tc, hdom ▸ hxN⟩ + p3_notMem := by + intro n hn + dsimp [borderS', indentBorderSet] + split_ifs with h + · rw [h, hnodeV'_star'] + exact fun hmem => hmem.2 rfl + · have hn_N : n ∈ π.Γ.N := by + have := hn.1 + rw [hN'] at this + rcases this with ⟨hnN, _⟩ | hn_eq + · exact hnN + · exact (h (mem_singleton_iff.mp hn_eq)).elim + rw [hnodeV'_other n h] + exact π.p3_notMem n ⟨hdom ▸ hn_N, hn.2⟩ + p3_subset := by + intro d hd hbd_d n hn_td + by_cases hd₁ : d = c₁ + · rw [hd₁, hcellG'_c₁] + rw [hd₁, htc₁] at hn_td + rcases hn_td with hn_eq | hn_eq + · rw [hn_eq]; dsimp [borderS', indentBorderSet] + simp only [hn₁_ne_star', ↓reduceIte] + exact fun _ h => hbp₁ (Or.inl h) + · rw [mem_singleton_iff.mp hn_eq]; dsimp [borderS', indentBorderSet] + simp only [↓reduceIte] + exact sdiff_subset.trans inter_subset_left + · by_cases hd₂ : d = c₂ + · rw [hd₂, hcellG'_c₂] + rw [hd₂, htc₂] at hn_td + rcases hn_td with hn_eq | hn_eq + · rw [hn_eq]; dsimp [borderS', indentBorderSet] + simp only [hn₂_ne_star', ↓reduceIte] + exact fun _ h => hbp₂ (Or.inl h) + · rw [mem_singleton_iff.mp hn_eq]; dsimp [borderS', indentBorderSet] + simp only [↓reduceIte] + exact sdiff_subset.trans inter_subset_right + · have hd_diff : d ∈ Γ'.C \ {c₁, c₂} := + ⟨hd, by simp [hd₁, hd₂]⟩ + obtain ⟨_, htd_eq, hnot_s'⟩ := hborder_not_star d hd_diff hbd_d + have hn_ne_s' : n ≠ n_star' := fun h => hnot_s' (h ▸ hn_td) + rw [hcellG'_other d hd_diff] + dsimp [borderS', indentBorderSet] + simp only [hn_ne_s', ↓reduceIte] + exact π.p3_subset (cellMap d) (hcellMap_mem d hd_diff).1 + ((hbd_iff d hd_diff).mp hbd_d) n (htd_eq ▸ hn_td) + p4_disjoint := by + intro Θ₁ hΘ₁ Θ₂ hΘ₂ hΘ_ne m₁ hm₁ m₂ hm₂ + have hΘ₁_bd : Θ₁ ⊆ bd π.S := by + rcases hΘ₁ with ⟨x, _, rfl⟩ + exact connectedComponentIn_subset _ x + have hΘ₂_bd : Θ₂ ⊆ bd π.S := by + rcases hΘ₂ with ⟨x, _, rfl⟩ + exact connectedComponentIn_subset _ x + have hΘ_disj : Disjoint Θ₁ Θ₂ := by + rcases hΘ₁ with ⟨x₁, _, rfl⟩; rcases hΘ₂ with ⟨x₂, _, rfl⟩ + exact Set.disjoint_left.mpr fun z hz₁ hz₂ => hΘ_ne + ((connectedComponentIn_eq hz₁).trans (connectedComponentIn_eq hz₂).symm) + refine Set.disjoint_left.mpr fun w hw₁ hw₂ => ?_ + dsimp [borderS', indentBorderSet] at hw₁ hw₂ + split_ifs at hw₁ with hm₁_s <;> split_ifs at hw₂ with hm₂_s + · rw [hm₁_s] at hm₁; rw [hm₂_s] at hm₂ + exact (Set.disjoint_left.mp hΘ_disj hm₁.2 hm₂.2).elim + · have hΘ₁_eq : Θ₁ = Θ := by + rcases hΘ₁ with ⟨x₁, _, rfl⟩; rcases hΘ with ⟨x₀, _, rfl⟩ + exact (connectedComponentIn_eq (hm₁_s ▸ hm₁.2)).trans (connectedComponentIn_eq + hn_star'_mem.2).symm + have hm₂_N : m₂ ∈ π.Γ.N := by + have := hm₂.1; rw [hN'] at this + exact (this.resolve_right hm₂_s).1 + have hw_c₀ : w ∈ (π.cellGraph c₀).vertexSet := hbs_sub hw₁ + have hbp_u := border_cell_vertex_inter_borderPlus_subset π hc₀ hbd₀ htc₀ + ⟨hm₂_N, hΘ₂_bd hm₂.2⟩ hw_c₀ (Or.inl hw₂) + rcases hbp_u with (hw_n₁ | ⟨_, hEq⟩) | (hw_n₂ | ⟨_, hEq⟩) + · exact Set.disjoint_left.mp (π.p4_disjoint Θ hΘ Θ₂ hΘ₂ (hΘ₁_eq ▸ hΘ_ne) n₁ hn₁_Θ m₂ + ⟨hm₂_N, hm₂.2⟩) hw_n₁ hw₂ + · have hn₁_not_Θ₂ : n₁ ∉ Θ₂ := Set.disjoint_left.mp (hΘ₁_eq ▸ hΘ_disj) hn₁_Θ.2 + exact π.p4_notMem Θ₂ hΘ₂ m₂ ⟨hm₂_N, hm₂.2⟩ n₁ (hdom ▸ hn₁_Θ.1) hn₁_not_Θ₂ (hEq ▸ hw₂) + · exact Set.disjoint_left.mp (π.p4_disjoint Θ hΘ Θ₂ hΘ₂ (hΘ₁_eq ▸ hΘ_ne) n₂ hn₂_Θ m₂ + ⟨hm₂_N, hm₂.2⟩) hw_n₂ hw₂ + · have hn₂_not_Θ₂ : n₂ ∉ Θ₂ := Set.disjoint_left.mp (hΘ₁_eq ▸ hΘ_disj) hn₂_Θ.2 + exact π.p4_notMem Θ₂ hΘ₂ m₂ ⟨hm₂_N, hm₂.2⟩ n₂ (hdom ▸ hn₂_Θ.1) hn₂_not_Θ₂ (hEq ▸ hw₂) + · have hΘ₂_eq : Θ₂ = Θ := by + rcases hΘ₂ with ⟨x₂, _, rfl⟩; rcases hΘ with ⟨x₀, _, rfl⟩ + exact (connectedComponentIn_eq (hm₂_s ▸ hm₂.2)).trans (connectedComponentIn_eq + hn_star'_mem.2).symm + have hm₁_N : m₁ ∈ π.Γ.N := by + have := hm₁.1; rw [hN'] at this + exact (this.resolve_right hm₁_s).1 + have hw_c₀ : w ∈ (π.cellGraph c₀).vertexSet := hbs_sub hw₂ + have hbp_u := border_cell_vertex_inter_borderPlus_subset π hc₀ hbd₀ htc₀ + ⟨hm₁_N, hΘ₁_bd hm₁.2⟩ hw_c₀ (Or.inl hw₁) + rcases hbp_u with (hw_n₁ | ⟨_, hEq⟩) | (hw_n₂ | ⟨_, hEq⟩) + · exact Set.disjoint_left.mp (π.p4_disjoint Θ₁ hΘ₁ Θ hΘ (hΘ₂_eq ▸ hΘ_ne) m₁ ⟨hm₁_N, + hm₁.2⟩ n₁ hn₁_Θ) hw₁ hw_n₁ + · have hn₁_not_Θ₁ : n₁ ∉ Θ₁ := Set.disjoint_right.mp (hΘ₂_eq ▸ hΘ_disj) hn₁_Θ.2 + exact π.p4_notMem Θ₁ hΘ₁ m₁ ⟨hm₁_N, hm₁.2⟩ n₁ (hdom ▸ hn₁_Θ.1) hn₁_not_Θ₁ (hEq ▸ hw₁) + · exact Set.disjoint_left.mp (π.p4_disjoint Θ₁ hΘ₁ Θ hΘ (hΘ₂_eq ▸ hΘ_ne) m₁ ⟨hm₁_N, + hm₁.2⟩ n₂ hn₂_Θ) hw₁ hw_n₂ + · have hn₂_not_Θ₁ : n₂ ∉ Θ₁ := Set.disjoint_right.mp (hΘ₂_eq ▸ hΘ_disj) hn₂_Θ.2 + exact π.p4_notMem Θ₁ hΘ₁ m₁ ⟨hm₁_N, hm₁.2⟩ n₂ (hdom ▸ hn₂_Θ.1) hn₂_not_Θ₁ (hEq ▸ hw₁) + · have hm₁_N : m₁ ∈ π.Γ.N := by + have := hm₁.1; rw [hN'] at this; exact (this.resolve_right hm₁_s).1 + have hm₂_N : m₂ ∈ π.Γ.N := by + have := hm₂.1; rw [hN'] at this; exact (this.resolve_right hm₂_s).1 + exact Set.disjoint_left.mp + (π.p4_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ hΘ_ne m₁ ⟨hm₁_N, hm₁.2⟩ m₂ ⟨hm₂_N, hm₂.2⟩) hw₁ hw₂ + p4_notMem := by + intro Θ₁ hΘ₁ m₁ hm₁ m₂ hm₂ hm₂_not_Θ₁ hmem + have hΘ₁_bd : Θ₁ ⊆ bd π.S := by + rcases hΘ₁ with ⟨x, _, rfl⟩ + exact connectedComponentIn_subset _ x + dsimp [borderS', indentBorderSet] at hmem + split_ifs at hmem with hm₁_s + · have hΘ₁_eq : Θ₁ = Θ := by + rcases hΘ₁ with ⟨x₁, _, rfl⟩; rcases hΘ with ⟨x₀, _, rfl⟩ + exact (connectedComponentIn_eq (hm₁_s ▸ hm₁.2)).trans (connectedComponentIn_eq + hn_star'_mem.2).symm + have hm₂_ne_s' : m₂ ≠ n_star' := fun h => hm₂_not_Θ₁ (h ▸ hm₁_s ▸ hm₁.2) + have hm₂_N : m₂ ∈ π.Γ.N := by + rw [hN'] at hm₂; exact (hm₂.resolve_right hm₂_ne_s').1 + rw [hnodeV'_other m₂ hm₂_ne_s'] at hmem + exact nodeVertex_notMem_border_cellGraph_of_notMem_cuff π hdom hnode_cell + hΘ hc₀ hc₀_Θ htc₀ hm₂_N (hΘ₁_eq ▸ hm₂_not_Θ₁) (hbs_sub hmem) + · have hm₁_N : m₁ ∈ π.Γ.N := by + have := hm₁.1; rw [hN'] at this; exact (this.resolve_right hm₁_s).1 + have hm₂_inv_N : nodeInv m₂ ∈ π.Γ.N := hnodeInv_mem m₂ hm₂ + have hm₂_inv_not_Θ₁ : nodeInv m₂ ∉ Θ₁ := by + dsimp [nodeInv, indentNodeMap] + split_ifs with h + · exact fun hΘ₁_s => hn_star.2 (hΘ₁_bd hΘ₁_s) + · exact hm₂_not_Θ₁ + exact π.p4_notMem Θ₁ hΘ₁ m₁ ⟨hm₁_N, hm₁.2⟩ (nodeInv m₂) (hdom ▸ hm₂_inv_N) hm₂_inv_not_Θ₁ + hmem + p5 := by + intro d hd hint_d w hw ⟨d', hd', hne_d, hw'⟩ + have hbd₁ : (c₁ ∩ bd π.S).Nonempty := hc₁_Θ.mono (inter_subset_inter_right _ hΘ_bd) + have hbd₂ : (c₂ ∩ bd π.S).Nonempty := hc₂_Θ.mono (inter_subset_inter_right _ hΘ_bd) + have hd_diff : d ∈ Γ'.C \ {c₁, c₂} := + ⟨hd, by rintro (rfl | rfl) <;> [exact hint_d hbd₁; exact hint_d hbd₂]⟩ + let c := cellMap d + have hc_mem : c ∈ π.Γ.C \ R := hcellMap_mem d hd_diff + have hint_c : ¬ (c ∩ bd π.S).Nonempty := fun h => hint_d ((hbd_iff d hd_diff).mpr h) + rw [hcellG'_other d hd_diff] at hw + have hw_from_other : (∃ c' ∈ π.Γ.C, c' ≠ c ∧ w ∈ (π.cellGraph c').vertexSet) ∨ + w = π.nodeVertex n_star := by + by_cases hd'_pair : d' = c₁ ∨ d' = c₂ + · have hw_u : w ∈ A₁'.vertexSet ∪ A₂'.vertexSet := by + rcases hd'_pair with rfl | rfl + · exact Or.inl (hcellG'_c₁ ▸ hw') + · exact Or.inr (hcellG'_c₂ ▸ hw') + rcases hV_sub hw_u with hw_cu | hw_star + · rcases mem_iUnion₂.mp hw_cu with ⟨c_r, ⟨hc_rR, hc_rC⟩, hwc_r⟩ + exact Or.inl ⟨c_r, hc_rC, fun h => hc_mem.2 (h ▸ hc_rR), hwc_r⟩ + · exact Or.inr (mem_singleton_iff.mp hw_star) + · have hd'_diff : d' ∈ Γ'.C \ {c₁, c₂} := ⟨hd', hd'_pair⟩ + rw [hcellG'_other d' hd'_diff] at hw' + exact Or.inl ⟨cellMap d', (hcellMap_mem d' hd'_diff).1, + fun h => hne_d (hbij.injOn hd'_diff hd_diff h), hw'⟩ + rcases hw_from_other with hex_c' | rfl + · obtain ⟨x, ⟨hx_tc, hx_dom⟩, rfl⟩ := π.p5 c hc_mem.1 hint_c w hw hex_c' + have hxN : x ∈ π.Γ.N := hdom ▸ hx_dom + have hx_td : nodeMap x ∈ tilde d := by + rw [htilde_map d hd_diff] + exact ⟨x, hx_tc, rfl⟩ + have hx_N' : nodeMap x ∈ Γ'.N := Γ'.tilde_subset_N hd hx_td + exact ⟨nodeMap x, ⟨hx_td, hx_N'⟩, hnodeV'_map x hxN⟩ + · have hn_tc : n_star ∈ tilde c := + (internal_nodeVertex_mem_cellGraph_iff π hdom hnode_cell hn_star hc_mem.1).mp hw + have hn'_td : n_star' ∈ tilde d := by + rw [htilde_map d hd_diff] + exact ⟨n_star, hn_tc, by simp⟩ + exact ⟨n_star', ⟨hn'_td, hn_star'_N'⟩, hnodeV'_star'⟩ + p6 := by + intro d hd hbd_d w hw ⟨d', hd', hne_d, hw'⟩ + have hw_R_case : ∀ x ∈ (π.cellsUnion R).vertexSet ∪ {π.nodeVertex n_star}, + (∃ c' ∈ π.Γ.C \ R, x ∈ (π.cellGraph c').vertexSet) → + x ∈ π.borderPlus n₁ ∪ π.borderPlus n₂ ∪ {π.nodeVertex n_star} := by + rintro x (hx_cu | hx_s) ⟨c', hc'_mem, hxc'⟩ + · rcases mem_iUnion₂.mp hx_cu with ⟨c_r, ⟨hc_rR, hc_rC⟩, hxc_r⟩ + have hne_c : c' ≠ c_r := fun h => hc'_mem.2 (h ▸ hc_rR) + rcases hR_cases c_r hc_rR with rfl | ⟨hint_r, htc_r⟩ + · exact Or.inl (border_cell_vertex_mem_borderPlus_of_mem_other π hc₀ hbd₀ htc₀ + hxc_r hc'_mem.1 hne_c hxc') + · obtain ⟨m, ⟨hm_tc, hm_dom⟩, rfl⟩ := + π.p5 c_r hc_rC hint_r x hxc_r ⟨c', hc'_mem.1, hne_c, hxc'⟩ + rw [htc_r] at hm_tc + rcases hm_tc with rfl | rfl | rfl + · exact Or.inl (Or.inl (Or.inr ⟨hm_dom, rfl⟩)) + · exact Or.inl (Or.inr (Or.inr ⟨hm_dom, rfl⟩)) + · exact Or.inr rfl + · exact Or.inr hx_s + by_cases hd₁ : d = c₁ + · rw [hd₁] at hw hne_d ⊢ + rw [hcellG'_c₁] at hw + have hw_cases : w ∈ π.borderPlus n₁ ∨ w ∈ A₁'.vertexSet ∩ A₂'.vertexSet := by + by_cases hd'₂ : d' = c₂ + · rw [hd'₂, hcellG'_c₂] at hw' + exact Or.inr ⟨hw, hw'⟩ + · have hd'_diff : d' ∈ Γ'.C \ {c₁, c₂} := + ⟨hd', by rintro (hd1 | hd2) <;> [exact hne_d hd1; exact hd'₂ hd2]⟩ + rw [hcellG'_other d' hd'_diff] at hw' + rcases hw_R_case w (hV_sub (Or.inl hw)) ⟨cellMap d', hcellMap_mem d' hd'_diff, hw'⟩ + with + (hw_n₁ | hw_n₂) | hw_s + · exact Or.inl hw_n₁ + · exact Or.inr ⟨hw, hbp₂ hw_n₂⟩ + · rw [mem_singleton_iff.mp hw_s] + exact Or.inr hn_star_mem + rcases hw_cases with hw_n₁ | hw_inter + · refine ⟨n₁, htc₁ ▸ Or.inl rfl, ?_⟩ + change w ∈ bp' n₁ + rw [hbp'_other_bd n₁ hn₁_bd.1 hn₁_bd.2] + exact hw_n₁ + · refine ⟨n_star', htc₁ ▸ Or.inr rfl, ?_⟩ + change w ∈ bp' n_star' + rw [hbp'_star'] + exact hw_inter + · by_cases hd₂ : d = c₂ + · rw [hd₂] at hw hne_d ⊢ + rw [hcellG'_c₂] at hw + have hw_cases : w ∈ π.borderPlus n₂ ∨ w ∈ A₁'.vertexSet ∩ A₂'.vertexSet := by + by_cases hd'₁ : d' = c₁ + · rw [hd'₁, hcellG'_c₁] at hw' + exact Or.inr ⟨hw', hw⟩ + · have hd'_diff : d' ∈ Γ'.C \ {c₁, c₂} := + ⟨hd', by rintro (hd1 | hd2) <;> [exact hd'₁ hd1; exact hne_d hd2]⟩ + rw [hcellG'_other d' hd'_diff] at hw' + rcases hw_R_case w (hV_sub (Or.inr hw)) ⟨cellMap d', hcellMap_mem d' hd'_diff, hw'⟩ + with + (hw_n₁ | hw_n₂) | hw_s + · exact Or.inr ⟨hbp₁ hw_n₁, hw⟩ + · exact Or.inl hw_n₂ + · rw [mem_singleton_iff.mp hw_s] + exact Or.inr hn_star_mem + rcases hw_cases with hw_n₂ | hw_inter + · refine ⟨n₂, htc₂ ▸ Or.inl rfl, ?_⟩ + change w ∈ bp' n₂ + rw [hbp'_other_bd n₂ hn₂_bd.1 hn₂_bd.2] + exact hw_n₂ + · refine ⟨n_star', htc₂ ▸ Or.inr rfl, ?_⟩ + change w ∈ bp' n_star' + rw [hbp'_star'] + exact hw_inter + · have hd_diff : d ∈ Γ'.C \ {c₁, c₂} := + ⟨hd, by simp [hd₁, hd₂]⟩ + obtain ⟨hnot_s, htd_eq, _⟩ := hborder_not_star d hd_diff hbd_d + let c := cellMap d + have hc_mem : c ∈ π.Γ.C \ R := hcellMap_mem d hd_diff + have hbd_c : (c ∩ bd π.S).Nonempty := (hbd_iff d hd_diff).mp hbd_d + rw [hcellG'_other d hd_diff] at hw + have hex_c' : ∃ c' ∈ π.Γ.C, c' ≠ c ∧ w ∈ (π.cellGraph c').vertexSet := by + by_cases hd'_pair : d' = c₁ ∨ d' = c₂ + · have hw_u : w ∈ A₁'.vertexSet ∪ A₂'.vertexSet := by + rcases hd'_pair with rfl | rfl + · exact Or.inl (hcellG'_c₁ ▸ hw') + · exact Or.inr (hcellG'_c₂ ▸ hw') + rcases hV_sub hw_u with hw_cu | hw_s + · rcases mem_iUnion₂.mp hw_cu with ⟨c_r, ⟨hc_rR, hc_rC⟩, hwc_r⟩ + exact ⟨c_r, hc_rC, fun h => hc_mem.2 (h ▸ hc_rR), hwc_r⟩ + · exfalso + rw [mem_singleton_iff] at hw_s + exact hnot_s ((internal_nodeVertex_mem_cellGraph_iff π hdom hnode_cell hn_star + hc_mem.1).mp (hw_s ▸ hw)) + · have hd'_diff : d' ∈ Γ'.C \ {c₁, c₂} := ⟨hd', hd'_pair⟩ + rw [hcellG'_other d' hd'_diff] at hw' + exact ⟨cellMap d', (hcellMap_mem d' hd'_diff).1, + fun h => hne_d (hbij.injOn hd'_diff hd_diff h), hw'⟩ + obtain ⟨m, hm_tc, hbp_m⟩ := π.p6 c hc_mem.1 hbd_c w hw hex_c' + have hmN : m ∈ π.Γ.N := π.Γ.tilde_subset_N hc_mem.1 hm_tc + have hmbd : m ∈ bd π.S := tilde_border_cell_subset_bd π.Γ hc_mem.1 hbd_c hm_tc + refine ⟨m, htd_eq ▸ hm_tc, ?_⟩ + change w ∈ bp' m + rw [hbp'_other_bd m hmN hmbd] + exact hbp_m + p7 := by + intro Θ₁ hΘ₁ m₁ hm₁ m₂ hm₂ m₃ hm₃ m₄ hm₄ hord w hw₁ hw₃ + have hΘ₁_bd : Θ₁ ⊆ bd π.S := by + rcases hΘ₁ with ⟨x, _, rfl⟩ + exact connectedComponentIn_subset _ x + have hp7_aux : ∀ a b c d_n : π.S, + a ∈ Γ'.N ∩ Θ₁ → b ∈ Γ'.N ∩ Θ₁ → c ∈ Γ'.N ∩ Θ₁ → d_n ∈ Γ'.N ∩ Θ₁ → + a ≠ b → b ≠ c → c ≠ d_n → d_n ≠ a → + GM19.InOrderOn Θ₁ a b c d_n → + (a = n_star' ∨ b = n_star' ∨ (a ≠ n_star' ∧ b ≠ n_star' ∧ c ≠ n_star' ∧ d_n ≠ n_star')) + → + w ∈ bp' a → w ∈ bp' c → + w ∈ bp' b ∨ w ∈ bp' d_n := by + intro a b c d_n ha hb hc hd_n hab hbc hcd hda hord' hcases hwa hwc + have hN_of_ne : ∀ x ∈ Γ'.N ∩ Θ₁, x ≠ n_star' → x ∈ π.Γ.N ∩ Θ₁ := by + intro x hx hx_ne + have := hx.1; rw [hN'] at this + exact ⟨(this.resolve_right hx_ne).1, hx.2⟩ + rcases hcases with ha_eq | hb_eq | ⟨ha_ne, hb_ne, hc_ne, hd_ne⟩ + · have hΘ₁_eq : Θ₁ = Θ := by + rcases hΘ₁ with ⟨x₁, _, rfl⟩; rcases hΘ with ⟨x₀, _, rfl⟩ + exact (connectedComponentIn_eq (ha_eq ▸ ha.2)).trans (connectedComponentIn_eq + hn_star'_mem.2).symm + rw [ha_eq] at hab hda hord' hwa + rw [hΘ₁_eq] at hb hc hd_n hord' hN_of_ne + have hb_ne : b ≠ n_star' := Ne.symm hab + have hd_ne : d_n ≠ n_star' := hda + have hc_ne : c ≠ n_star' := fun h => by + rcases eq_of_inOrder (h ▸ hord') with rfl | rfl <;> contradiction + have hb_Θ := hN_of_ne b hb hb_ne + have hc_Θ := hN_of_ne c hc hc_ne + have hd_Θ := hN_of_ne d_n hd_n hd_ne + rw [hbp'_other_bd b hb_Θ.1 (hΘ_bd hb_Θ.2), hbp'_other_bd d_n hd_Θ.1 (hΘ_bd hd_Θ.2)] + rw [hbp'_other_bd c hc_Θ.1 (hΘ_bd hc_Θ.2)] at hwc + have hw_ne_star : w ≠ π.nodeVertex n_star := by + rintro rfl + have hc_bd : c ∈ bd π.S := hΘ_bd hc_Θ.2 + have hn_star_not_Θ : n_star ∉ Θ := fun h => hn_star.2 (hΘ_bd h) + rcases hwc with hbs_c | ⟨_, hEq⟩ + · exact π.p4_notMem Θ hΘ c hc_Θ n_star (hdom ▸ hn_star.1) hn_star_not_Θ hbs_c + · exact hn_star.2 (π.nodeVertex_injOn (hdom ▸ hn_star.1) (hdom ▸ hc_Θ.1) hEq ▸ hc_bd) + have hw_bs : w ∈ (A₁'.vertexSet ∩ A₂'.vertexSet) \ {π.nodeVertex n_star} := by + rw [hbp'_star'] at hwa + exact ⟨hwa, hw_ne_star⟩ + have hw_c₀ : w ∈ (π.cellGraph c₀).vertexSet := hbs_sub hw_bs + have hbp_u := border_cell_vertex_inter_borderPlus_subset π hc₀ hbd₀ htc₀ + ⟨hc_Θ.1, hΘ_bd hc_Θ.2⟩ hw_c₀ hwc + have hn_star'_cl : n_star' ∈ closure c₀ := subset_closure hn_star'_mem.1 + rcases hbp_u with hw_n₁ | hw_n₂ + · have hn₁_cl : n₁ ∈ closure c₀ ∩ Θ := ⟨(htc₀ ▸ Or.inl rfl : n₁ ∈ tilde c₀).1, hn₁_Θ.2⟩ + have hord₁ := inOrderOn_of_mem_closure_border_cell_left π.Γ hΘ hc₀ hc₀_Θ + hab hbc hcd hda hb_Θ.1 hd_Θ.1 hn_star'_cl hord' hn₁_cl + exact π.p7 Θ hΘ n₁ hn₁_Θ b hb_Θ c hc_Θ d_n hd_Θ hord₁ w hw_n₁ hwc + · have hn₂_cl : n₂ ∈ closure c₀ ∩ Θ := ⟨(htc₀ ▸ Or.inr rfl : n₂ ∈ tilde c₀).1, hn₂_Θ.2⟩ + have hord₂ := inOrderOn_of_mem_closure_border_cell_left π.Γ hΘ hc₀ hc₀_Θ + hab hbc hcd hda hb_Θ.1 hd_Θ.1 hn_star'_cl hord' hn₂_cl + exact π.p7 Θ hΘ n₂ hn₂_Θ b hb_Θ c hc_Θ d_n hd_Θ hord₂ w hw_n₂ hwc + · have hΘ₁_eq : Θ₁ = Θ := by + rcases hΘ₁ with ⟨x₁, _, rfl⟩; rcases hΘ with ⟨x₀, _, rfl⟩ + exact (connectedComponentIn_eq (hb_eq ▸ hb.2)).trans (connectedComponentIn_eq + hn_star'_mem.2).symm + rw [hb_eq] at hab hbc hord' ⊢ + rw [hΘ₁_eq] at ha hc hd_n hord' hN_of_ne + have ha_ne : a ≠ n_star' := hab + have hc_ne : c ≠ n_star' := Ne.symm hbc + have hd_ne : d_n ≠ n_star' := fun h => by + rcases eq_of_inOrder (h ▸ inOrderOn_cyclic hord') with rfl | rfl <;> contradiction + have ha_Θ := hN_of_ne a ha ha_ne + have hc_Θ := hN_of_ne c hc hc_ne + have hd_Θ := hN_of_ne d_n hd_n hd_ne + rw [hbp'_star', hbp'_other_bd d_n hd_Θ.1 (hΘ_bd hd_Θ.2)] + rw [hbp'_other_bd a ha_Θ.1 (hΘ_bd ha_Θ.2)] at hwa + rw [hbp'_other_bd c hc_Θ.1 (hΘ_bd hc_Θ.2)] at hwc + have hn_star'_cl : n_star' ∈ closure c₀ := subset_closure hn_star'_mem.1 + have hn₁_cl : n₁ ∈ closure c₀ ∩ Θ := ⟨(htc₀ ▸ Or.inl rfl : n₁ ∈ tilde c₀).1, hn₁_Θ.2⟩ + have hn₂_cl : n₂ ∈ closure c₀ ∩ Θ := ⟨(htc₀ ▸ Or.inr rfl : n₂ ∈ tilde c₀).1, hn₂_Θ.2⟩ + have hord₁ := inOrderOn_of_mem_closure_border_cell_mid π.Γ hΘ hc₀ hc₀_Θ + hab hbc hcd hda ha_Θ.1 hc_Θ.1 hn_star'_cl hord' hn₁_cl + have hord₂ := inOrderOn_of_mem_closure_border_cell_mid π.Γ hΘ hc₀ hc₀_Θ + hab hbc hcd hda ha_Θ.1 hc_Θ.1 hn_star'_cl hord' hn₂_cl + have hp₁ := π.p7 Θ hΘ a ha_Θ n₁ hn₁_Θ c hc_Θ d_n hd_Θ hord₁ w hwa hwc + have hp₂ := π.p7 Θ hΘ a ha_Θ n₂ hn₂_Θ c hc_Θ d_n hd_Θ hord₂ w hwa hwc + rcases hp₁ with hw_n₁ | hw_d + · rcases hp₂ with hw_n₂ | hw_d + · exact Or.inl ⟨hbp₁ hw_n₁, hbp₂ hw_n₂⟩ + · exact Or.inr hw_d + · exact Or.inr hw_d + · have ha_Θ := hN_of_ne a ha ha_ne + have hb_Θ := hN_of_ne b hb hb_ne + have hc_Θ := hN_of_ne c hc hc_ne + have hd_Θ := hN_of_ne d_n hd_n hd_ne + rw [hbp'_other_bd b hb_Θ.1 (hΘ₁_bd hb_Θ.2), hbp'_other_bd d_n hd_Θ.1 (hΘ₁_bd hd_Θ.2)] + rw [hbp'_other_bd a ha_Θ.1 (hΘ₁_bd ha_Θ.2)] at hwa + rw [hbp'_other_bd c hc_Θ.1 (hΘ₁_bd hc_Θ.2)] at hwc + exact π.p7 Θ₁ hΘ₁ a ha_Θ b hb_Θ c hc_Θ d_n hd_Θ hord' w hwa hwc + by_cases h12 : m₁ = m₂ + · exact Or.inl (h12 ▸ hw₁) + by_cases h23 : m₂ = m₃ + · exact Or.inl (h23.symm ▸ hw₃) + by_cases h34 : m₃ = m₄ + · exact Or.inr (h34 ▸ hw₃) + by_cases h41 : m₄ = m₁ + · exact Or.inr (h41.symm ▸ hw₁) + by_cases hm₁_s : m₁ = n_star' + · exact hp7_aux m₁ m₂ m₃ m₄ hm₁ hm₂ hm₃ hm₄ h12 h23 h34 h41 hord (Or.inl hm₁_s) hw₁ hw₃ + by_cases hm₂_s : m₂ = n_star' + · exact hp7_aux m₁ m₂ m₃ m₄ hm₁ hm₂ hm₃ hm₄ h12 h23 h34 h41 hord (Or.inr + (Or.inl hm₂_s)) hw₁ hw₃ + by_cases hm₃_s : m₃ = n_star' + · exact (hp7_aux m₃ m₄ m₁ m₂ hm₃ hm₄ hm₁ hm₂ h34 h41 h12 h23 + (inOrderOn_cyclic2 hord) (Or.inl hm₃_s) hw₃ hw₁).symm + by_cases hm₄_s : m₄ = n_star' + · exact (hp7_aux m₃ m₄ m₁ m₂ hm₃ hm₄ hm₁ hm₂ h34 h41 h12 h23 + (inOrderOn_cyclic2 hord) (Or.inr (Or.inl hm₄_s)) hw₃ hw₁).symm + exact hp7_aux m₁ m₂ m₃ m₄ hm₁ hm₂ hm₃ hm₄ h12 h23 h34 h41 hord + (Or.inr (Or.inr ⟨hm₁_s, hm₂_s, hm₃_s, hm₄_s⟩)) hw₁ hw₃ } + +/-- A bound on both borders and the required linkage bound the warp of a two-ended cell. -/ +theorem Portrayal.cellWarp_le_of_two_ends {α β : Type*} {G : Hypergraph α β} + (π : Portrayal G) {c : Set π.S} {n m : π.S} {p : ℕ} (ht : tilde c = {n, m}) + (hn : (π.borderSet n).ncard ≤ p) (hm : (π.borderSet m).ncard ≤ p) + (hlink : (π.borderPlus n).ncard = p + 1 → (π.borderPlus m).ncard = p + 1 → + Portrayal.LinkagePairs (π.cellGraph c).skeleton (π.borderPlus n) (π.borderPlus m) + (p + 1) (π.nodeVertex n) (π.nodeVertex m)) : + π.cellWarp c ≤ p := by + apply csInf_le (OrderBot.bddBelow _) + intro u hu v hv huv + change u ∈ tilde c at hu + change v ∈ tilde c at hv + simp only [ht, mem_insert_iff, mem_singleton_iff] at hu hv + rcases hu with rfl | rfl <;> rcases hv with rfl | rfl + · exact (huv rfl).elim + · exact ⟨hn, hm, hlink⟩ + · exact ⟨hm, hn, fun h1 h2 => linkagePairs_symm _ _ _ _ _ _ (hlink h2 h1)⟩ + · exact (huv rfl).elim + +private theorem isTruer_of_fewer_internal_nodes {α β : Type*} {G : Hypergraph α β} + (π' π : Portrayal G) + (hcells : ∀ i : Fin 6, i.1 < 4 → π'.truth i ≤ π.truth i) + (hnodes : (π'.Γ.N \ bd π'.S).ncard < (π.Γ.N \ bd π.S).ncard) : + π'.IsTruer π := by + let k : Fin 6 := ⟨4, by decide⟩ + apply isTruer_of_le_lt (k₀ := k) + · intro i hi + rcases lt_or_eq_of_le hi with hlt | rfl + · exact hcells i hlt + · simpa only [Portrayal.truth, k, Nat.not_lt.mpr (le_refl 4), ↓reduceIte] using hnodes.le + · simpa only [Portrayal.truth, k, Nat.not_lt.mpr (le_refl 4), ↓reduceIte] using hnodes + +private theorem resembling_of_central_warp_le {α β : Type*} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {π' π : Portrayal G} + (hπ : π.IsZeroRedundant 𝒯) (hπ' : π'.IsCentral 𝒯) + (ψ : π'.S ≃ₜ π.S) + (hwarp : ∀ Θ ∈ cuffs π'.S, π'.warpAt Θ ≤ π.warpAt (ψ '' Θ)) : + π'.Resembles π := by + refine ⟨ψ, fun Θ hΘ => le_antisymm (hwarp Θ hΘ) ?_⟩ + by_contra hlt + exact hπ π' hπ' (Or.inr ⟨ψ, hwarp, Θ, hΘ, lt_of_not_ge hlt⟩) + +open Classical in +private theorem unmodified_border_cell_has_same_ends + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {n_star : π.S} + (hn_star : n_star ∈ π.Γ.N \ bd π.S) + {R : Set (Set π.S)} + {Γ' : Painting π.S} + (n_star' : π.S) + (c₁ : Set π.S) + (c₂ : Set π.S) + (cellMap : Set π.S → Set π.S) + (hbd_iff : ∀ d ∈ Γ'.C \ {c₁, c₂}, (d ∩ bd π.S).Nonempty ↔ (cellMap d ∩ bd π.S).Nonempty) + (htilde_map : ∀ d ∈ Γ'.C \ {c₁, c₂}, tilde d = (fun x => if x = n_star then n_star' else x) '' + tilde (cellMap d)) + (hn_star'_not_N : n_star' ∉ π.Γ.N) + (hcellMap_mem : ∀ d ∈ Γ'.C \ {c₁, c₂}, cellMap d ∈ π.Γ.C \ R) : + ∀ d ∈ Γ'.C \ {c₁, c₂}, (d ∩ bd π.S).Nonempty → n_star ∉ tilde (cellMap d) ∧ tilde d = tilde + (cellMap d) ∧ n_star' ∉ tilde d := by + intro d hd hbd_d + have hc_mem := (hcellMap_mem d hd).1 + have hbd_c : (cellMap d ∩ bd π.S).Nonempty := (hbd_iff d hd).mp hbd_d + have hsub_bd := tilde_border_cell_subset_bd π.Γ hc_mem hbd_c + have hnot_s : n_star ∉ tilde (cellMap d) := fun h => hn_star.2 (hsub_bd h) + have htd_eq : tilde d = tilde (cellMap d) := by + rw [htilde_map d hd] + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + have hy_ne : y ≠ n_star := fun h => hnot_s (h ▸ hy) + simpa [hy_ne] using hy + · intro hx + have hx_ne : x ≠ n_star := fun h => hnot_s (h ▸ hx) + exact ⟨x, hx, by simp [hx_ne]⟩ + refine ⟨hnot_s, htd_eq, ?_⟩ + rw [htd_eq] + exact fun h => hn_star'_not_N (π.Γ.tilde_subset_N hc_mem h) + +open Classical in +private theorem indent_node_inverse_injective + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {n_star : π.S} + {Γ' : Painting π.S} + (n_star' : π.S) + (hN' : Γ'.N = π.Γ.N \ {n_star} ∪ {n_star'}) + (hn_star'_not_N : n_star' ∉ π.Γ.N) : + InjOn (fun n => if n = n_star' then n_star else n) Γ'.N := by + let nodeInv := fun n => if n = n_star' then n_star else n + intro x hx y hy hEq + rw [hN'] at hx hy + dsimp [nodeInv] at hEq + rcases hx with ⟨hxN, hx_ne⟩ | hx_eq <;> rcases hy with ⟨hyN, hy_ne⟩ | hy_eq + · have hx' : x ≠ n_star' := fun h => hn_star'_not_N (h ▸ hxN) + have hy' : y ≠ n_star' := fun h => hn_star'_not_N (h ▸ hyN) + simpa [hx', hy'] using hEq + · have hx' : x ≠ n_star' := fun h => hn_star'_not_N (h ▸ hxN) + have hy' : y = n_star' := mem_singleton_iff.mp hy_eq + simp only [hx', hy', ↓reduceIte] at hEq + exact (hx_ne hEq).elim + · have hx' : x = n_star' := mem_singleton_iff.mp hx_eq + have hy' : y ≠ n_star' := fun h => hn_star'_not_N (h ▸ hyN) + simp only [hx', hy', ↓reduceIte] at hEq + exact (hy_ne hEq.symm).elim + · exact (mem_singleton_iff.mp hx_eq).trans (mem_singleton_iff.mp hy_eq).symm + +private theorem central_of_replacing_two_cells {α β : Type*} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {π : Portrayal G} (π' : Portrayal G) + (c₁ c₂ : Set π'.S) + (h₁ : ∃ B, (π'.cellGraph c₁, B) ∈ 𝒯) (h₂ : ∃ B, (π'.cellGraph c₂, B) ∈ 𝒯) + (hπ : π.IsCentral 𝒯) (cellMap : Set π'.S → Set π.S) + (hmem : ∀ d ∈ π'.Γ.C \ {c₁, c₂}, cellMap d ∈ π.Γ.C) + (hgraph : ∀ d ∈ π'.Γ.C \ {c₁, c₂}, π'.cellGraph d = π.cellGraph (cellMap d)) : + π'.IsCentral 𝒯 := by + intro d hd + rcases eq_or_ne d c₁ with rfl | hne₁ + · exact h₁ + rcases eq_or_ne d c₂ with rfl | hne₂ + · exact h₂ + have hdiff : d ∈ π'.Γ.C \ {c₁, c₂} := ⟨hd, by simp [hne₁, hne₂]⟩ + rw [hgraph d hdiff] + exact hπ (cellMap d) (hmem d hdiff) + +private theorem ncard_internal_cells_le_of_map {S : Type} [TopologicalSpace S] + (Γ' Γ : Painting S) (c₁ c₂ : Set S) (cellMap : Set S → Set S) (nodeMap : S → S) (k : ℕ) + (hbd₁ : (c₁ ∩ bd S).Nonempty) (hbd₂ : (c₂ ∩ bd S).Nonempty) + (hinjCell : InjOn cellMap (Γ'.C \ {c₁, c₂})) + (hcellMap_mem : ∀ d ∈ Γ'.C \ {c₁, c₂}, cellMap d ∈ Γ.C) + (hbd_iff : ∀ d ∈ Γ'.C \ {c₁, c₂}, (d ∩ bd S).Nonempty ↔ (cellMap d ∩ bd S).Nonempty) + (htilde_map : ∀ d ∈ Γ'.C \ {c₁, c₂}, tilde d = nodeMap '' tilde (cellMap d)) + (hnodeMap_injOn : InjOn nodeMap Γ.N) : + {d ∈ Γ'.C | ¬ (d ∩ bd S).Nonempty ∧ (tilde d).ncard = k}.ncard ≤ + {d ∈ Γ.C | ¬ (d ∩ bd S).Nonempty ∧ (tilde d).ncard = k}.ncard := by + have hmaps : MapsTo cellMap + {d ∈ Γ'.C | ¬ (d ∩ bd S).Nonempty ∧ (tilde d).ncard = k} + {c ∈ Γ.C | ¬ (c ∩ bd S).Nonempty ∧ (tilde c).ncard = k} := by + rintro d ⟨hd_C', hint_d, hcard_d⟩ + have hd_diff : d ∈ Γ'.C \ {c₁, c₂} := + ⟨hd_C', by rintro (rfl | rfl) <;> [exact hint_d hbd₁; exact hint_d hbd₂]⟩ + have hc_mem := hcellMap_mem d hd_diff + have hint_c : ¬ (cellMap d ∩ bd S).Nonempty := + fun h => hint_d ((hbd_iff d hd_diff).mpr h) + have hcard_c : (tilde (cellMap d)).ncard = k := by + rw [← hcard_d, htilde_map d hd_diff] + exact (hnodeMap_injOn.mono (Γ.tilde_subset_N hc_mem)).ncard_image.symm + exact ⟨hc_mem, hint_c, hcard_c⟩ + have hinj : InjOn cellMap {d ∈ Γ'.C | ¬ (d ∩ bd S).Nonempty ∧ (tilde d).ncard = k} + := by + refine hinjCell.mono fun d ⟨hd_C', hint_d, _⟩ => ?_ + exact ⟨hd_C', by rintro (rfl | rfl) <;> [exact hint_d hbd₁; exact hint_d hbd₂]⟩ + rw [← hinj.ncard_image] + exact ncard_le_ncard hmaps.image_subset (Γ.finite_cells.subset fun _ h => h.1) + +open Classical in +private theorem indent_node_map_and_inverse {S : Type*} (A B : Set S) (x y : S) + (hx : x ∈ A) (hy : y ∉ A) (hB : B = A \ {x} ∪ {y}) : + let replace := fun z : S => if z = x then y else z + let restore := fun z : S => if z = y then x else z + (∀ z ∈ A, restore (replace z) = z) ∧ InjOn replace A ∧ MapsTo restore B A := by + intro replace restore + have hleft : ∀ z ∈ A, restore (replace z) = z := by + intro z hz + by_cases h : z = x + · simp [replace, restore, h] + · have hzy : z ≠ y := fun he => hy (he ▸ hz) + simp [replace, restore, h, hzy] + refine ⟨hleft, fun u hu v hv h => ?_, fun z hz => ?_⟩ + · rw [← hleft u hu, ← hleft v hv, h] + · rw [hB] at hz + rcases hz with ⟨hzA, _⟩ | hz + · have hzy : z ≠ y := fun he => hy (he ▸ hzA) + simpa [restore, hzy] using hzA + · simpa [restore, mem_singleton_iff.mp hz] using hx + +theorem not_indentedPortrayal + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (π : Portrayal G) (htrue : π.IsTrue 𝒯) + (hdom : π.domγ = π.Γ.N) + (hnode_cell : ∀ n ∈ π.Γ.N, ∃ d ∈ π.Γ.C, n ∈ tilde d) + {Θ c₀ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (hc₀ : c₀ ∈ π.Γ.C) (hc₀_Θ : (c₀ ∩ Θ).Nonempty) + {n₁ n₂ n_star : π.S} (hne : n₁ ≠ n₂) (htc₀ : tilde c₀ = {n₁, n₂}) + (hn_star : n_star ∈ π.Γ.N \ bd π.S) + {R : Set (Set π.S)} (hc₀_R : c₀ ∈ R) (_hR_sub : R ⊆ π.Γ.C) + (hR_cases : ∀ c ∈ R, c = c₀ ∨ (¬ (c ∩ bd π.S).Nonempty ∧ tilde c = {n₁, n₂, n_star})) + {Γ' : Painting π.S} (hind : IsIndentedBorderPainting π.Γ Θ c₀ n₁ n₂ n_star R Γ') + {A₁' A₂' : Hypergraph α β} (hA₁'_le : A₁' ≤ G) (hA₂'_le : A₂' ≤ G) + (hV_union : (π.cellsUnion R).vertexSet ⊆ A₁'.vertexSet ∪ A₂'.vertexSet) + (hV_sub : A₁'.vertexSet ∪ A₂'.vertexSet ⊆ (π.cellsUnion R).vertexSet ∪ {π.nodeVertex n_star}) + (hE_union : A₁'.edgeSet ∪ A₂'.edgeSet = (π.cellsUnion R).edgeSet) + (hE_disj : Disjoint A₁'.edgeSet A₂'.edgeSet) + (hbp₁ : π.borderPlus n₁ ⊆ A₁'.vertexSet) + (hbp₂ : π.borderPlus n₂ ⊆ A₂'.vertexSet) + (hn_star_mem : π.nodeVertex n_star ∈ A₁'.vertexSet ∩ A₂'.vertexSet) + (hbs_sub : (A₁'.vertexSet ∩ A₂'.vertexSet) \ {π.nodeVertex n_star} ⊆ (π.cellGraph c₀).vertexSet) + (hsmall₁ : ∃ B, (A₁', B) ∈ 𝒯) + (hsmall₂ : ∃ B, (A₂', B) ∈ 𝒯) + (hbs₁_le : (π.borderSet n₁).ncard ≤ π.warpAt Θ) + (hbs₂_le : (π.borderSet n₂).ncard ≤ π.warpAt Θ) + (hbs_star_le : ((A₁'.vertexSet ∩ A₂'.vertexSet) \ {π.nodeVertex n_star}).ncard ≤ π.warpAt Θ) + (hlp₁ : (π.borderPlus n₁).ncard = π.warpAt Θ + 1 → + (A₁'.vertexSet ∩ A₂'.vertexSet).ncard = π.warpAt Θ + 1 → + Portrayal.LinkagePairs A₁'.skeleton (π.borderPlus n₁) (A₁'.vertexSet ∩ A₂'.vertexSet) + (π.warpAt Θ + 1) (π.nodeVertex n₁) (π.nodeVertex n_star)) + (hlp₂ : (π.borderPlus n₂).ncard = π.warpAt Θ + 1 → + (A₁'.vertexSet ∩ A₂'.vertexSet).ncard = π.warpAt Θ + 1 → + Portrayal.LinkagePairs A₂'.skeleton (π.borderPlus n₂) (A₁'.vertexSet ∩ A₂'.vertexSet) + (π.warpAt Θ + 1) (π.nodeVertex n₂) (π.nodeVertex n_star)) : + False := by + classical + have : T2Space π.S := π.isSurface.2.1 + obtain ⟨n_star', c₁, c₂, cellMap, hn_star'_mem, hN', hc₁_C', hc₂_C', hc₁₂_ne, + hc₁_Θ, hc₂_Θ, htc₁, htc₂, hbij, hΘ_iff, hbd_iff, htilde_map⟩ := hind + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hsub_cuff₀ := π.Γ.border_cell_subset_cuff hc₀ hΘ hc₀_Θ + have hbd₀ : (c₀ ∩ bd π.S).Nonempty := hsub_cuff₀.2.1 ▸ hc₀_Θ + have hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ := hsub_cuff₀.2.2.2.1 (htc₀ ▸ Or.inl rfl) + have hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ := hsub_cuff₀.2.2.2.1 (htc₀ ▸ Or.inr rfl) + have hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S := ⟨hn₁_Θ.1, hΘ_bd hn₁_Θ.2⟩ + have hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S := ⟨hn₂_Θ.1, hΘ_bd hn₂_Θ.2⟩ + have hn_star'_bd : n_star' ∈ bd π.S := hΘ_bd hn_star'_mem.2 + have hn_star'_not_N : n_star' ∉ π.Γ.N := (π.Γ.cell_subset_diff hc₀ hn_star'_mem.1).2 + have hn_star'_ne_star : n_star' ≠ n_star := fun h => hn_star.2 (h ▸ hn_star'_bd) + have hn₁_ne_star : n₁ ≠ n_star := fun h => hn_star.2 (h ▸ hn₁_bd.2) + have hn₂_ne_star : n₂ ≠ n_star := fun h => hn_star.2 (h ▸ hn₂_bd.2) + have hn₁_ne_star' : n₁ ≠ n_star' := fun h => hn_star'_not_N (h ▸ hn₁_Θ.1) + have hn₂_ne_star' : n₂ ≠ n_star' := fun h => hn_star'_not_N (h ▸ hn₂_Θ.1) + have hn_star'_N' : n_star' ∈ Γ'.N := hN' ▸ Or.inr rfl + have hn₁_N' : n₁ ∈ Γ'.N := hN' ▸ Or.inl ⟨hn₁_Θ.1, hn₁_ne_star⟩ + have hn₂_N' : n₂ ∈ Γ'.N := hN' ▸ Or.inl ⟨hn₂_Θ.1, hn₂_ne_star⟩ + let nodeMap : π.S → π.S := fun x => if x = n_star then n_star' else x + let nodeInv : π.S → π.S := fun n => if n = n_star' then n_star else n + obtain ⟨hnodeMap_inv, hnodeMap_injOn, hnodeInv_mem⟩ := + indent_node_map_and_inverse π.Γ.N Γ'.N n_star n_star' hn_star.1 hn_star'_not_N hN' + have hnodeInv_injOn : InjOn nodeInv Γ'.N := by + exact indent_node_inverse_injective (α := α) (β := β) (G := G) π (n_star := n_star) (Γ' := Γ') + n_star' hN' hn_star'_not_N + let cellG' : Set π.S → Hypergraph α β := fun d => + if d = c₁ then A₁' else if d = c₂ then A₂' else π.cellGraph (cellMap d) + let borderS' : π.S → Set α := fun n => + if n = n_star' then (A₁'.vertexSet ∩ A₂'.vertexSet) \ {π.nodeVertex n_star} + else π.borderSet n + let nodeV' : π.S → α := fun n => π.nodeVertex (nodeInv n) + let bp' : π.S → Set α := fun n => {w | w ∈ borderS' n ∨ (n ∈ Γ'.N ∧ w = nodeV' n)} + have hcellG'_c₁ : cellG' c₁ = A₁' := by simp [cellG'] + have hcellG'_c₂ : cellG' c₂ = A₂' := by simp [cellG', hc₁₂_ne.symm] + have hcellG'_other : ∀ d ∈ Γ'.C \ {c₁, c₂}, cellG' d = π.cellGraph (cellMap d) := by + rintro d ⟨_, hnot⟩ + have hd₁ : d ≠ c₁ := fun h => hnot (Or.inl h) + have hd₂ : d ≠ c₂ := fun h => hnot (Or.inr h) + simp [cellG', hd₁, hd₂] + have hcellMap_mem : ∀ d ∈ Γ'.C \ {c₁, c₂}, cellMap d ∈ π.Γ.C \ R := + fun d hd => hbij.mapsTo hd + have hnodeV'_star' : nodeV' n_star' = π.nodeVertex n_star := by simp [nodeV', nodeInv] + have hnodeV'_other : ∀ n ≠ n_star', nodeV' n = π.nodeVertex n := by + intro n hn; simp [nodeV', nodeInv, hn] + have hnodeV'_map : ∀ x ∈ π.Γ.N, nodeV' (nodeMap x) = π.nodeVertex x := by + intro x hx + change π.nodeVertex (nodeInv (nodeMap x)) = π.nodeVertex x + exact congrArg π.nodeVertex (hnodeMap_inv x hx) + have hbp'_star' : bp' n_star' = A₁'.vertexSet ∩ A₂'.vertexSet := by + ext w + simp only [bp', borderS', ite_true, mem_ofPred_eq, mem_sdiff, mem_inter_iff, mem_singleton_iff, + hn_star'_N', true_and, hnodeV'_star'] + exact ⟨fun h => h.elim And.left (fun hEq => hEq ▸ hn_star_mem), + fun hw => by + by_cases h : w = π.nodeVertex n_star + · exact Or.inr h + · exact Or.inl ⟨hw, h⟩⟩ + have hbp'_other : ∀ n ∈ π.Γ.N, n ≠ n_star → bp' n = π.borderPlus n := by + intro n hnN hns + have hn' : n ≠ n_star' := fun h => hn_star'_not_N (h ▸ hnN) + have hnN' : n ∈ Γ'.N := hN' ▸ Or.inl ⟨hnN, hns⟩ + have hndom : n ∈ π.domγ := hdom ▸ hnN + ext w + simp [bp', borderS', hn', hnN', hnodeV'_other n hn', Portrayal.borderPlus, hndom] + have hbp'_other_bd : ∀ n ∈ π.Γ.N, n ∈ bd π.S → bp' n = π.borderPlus n := + fun n hnN hnbd => hbp'_other n hnN (fun h => hn_star.2 (h ▸ hnbd)) + have hborder_not_star : ∀ d ∈ Γ'.C \ {c₁, c₂}, (d ∩ bd π.S).Nonempty → + n_star ∉ tilde (cellMap d) ∧ tilde d = tilde (cellMap d) ∧ n_star' ∉ tilde d := by + exact unmodified_border_cell_has_same_ends (α := α) (β := β) (G := G) π (n_star := n_star) + hn_star (R := R) (Γ' := Γ') n_star' c₁ c₂ cellMap hbd_iff htilde_map hn_star'_not_N + hcellMap_mem + let π' : Portrayal G := + indented_cuff_portrayal (α := α) (β := β) (G := G) π hdom hnode_cell (Θ := Θ) (c₀ := c₀) hΘ + hc₀ hc₀_Θ (n₁ := n₁) (n₂ := n₂) (n_star := n_star) hne htc₀ hn_star (R := R) hc₀_R hR_cases + (Γ' := Γ') (A₁' := A₁') (A₂' := A₂') hA₁'_le hA₂'_le hV_union hV_sub hE_union hE_disj hbp₁ + hbp₂ hn_star_mem hbs_sub hbs₁_le hbs₂_le hbs_star_le hlp₁ hlp₂ n_star' c₁ c₂ cellMap + hn_star'_mem hN' hc₁_C' hc₂_C' hc₁₂_ne hc₁_Θ hc₂_Θ htc₁ htc₂ hbij hΘ_iff hbd_iff htilde_map + hΘ_bd hsub_cuff₀ hbd₀ hn₁_Θ hn₂_Θ hn₁_bd hn₂_bd hn_star'_bd hn_star'_not_N hn_star'_ne_star + hn₁_ne_star hn₂_ne_star hn₁_ne_star' hn₂_ne_star' hn_star'_N' hn₁_N' hn₂_N' + hnodeMap_inv hnodeMap_injOn hnodeInv_mem hnodeInv_injOn cellG' + hcellG'_c₁ hcellG'_c₂ hcellG'_other hcellMap_mem hnodeV'_star' hnodeV'_other hnodeV'_map + hbp'_star' hbp'_other hbp'_other_bd hborder_not_star + have hπ'_central : π'.IsCentral 𝒯 := by + apply central_of_replacing_two_cells π' c₁ c₂ _ _ htrue.1 cellMap + (fun d hd => (hcellMap_mem d hd).1) hcellG'_other + · change ∃ B, (cellG' c₁, B) ∈ 𝒯 + rwa [hcellG'_c₁] + · change ∃ B, (cellG' c₂, B) ∈ 𝒯 + rwa [hcellG'_c₂] + have hbp'_eq_star' : π'.borderPlus n_star' = A₁'.vertexSet ∩ A₂'.vertexSet := hbp'_star' + have hbp'_eq_other_bd : ∀ n ∈ π.Γ.N, n ∈ bd π.S → π'.borderPlus n = π.borderPlus n + := hbp'_other_bd + have hbs'_star' : π'.borderSet n_star' = (A₁'.vertexSet ∩ A₂'.vertexSet) \ {π.nodeVertex n_star} + := by + change borderS' n_star' = _; simp [borderS'] + have hbs'_other : ∀ n ∈ π.Γ.N, π'.borderSet n = π.borderSet n := by + intro n hnN + have hn' : n ≠ n_star' := fun h => hn_star'_not_N (h ▸ hnN) + change borderS' n = _; simp [borderS', hn'] + have hcw_c₁ : π'.cellWarp c₁ ≤ π.warpAt Θ := by + apply Portrayal.cellWarp_le_of_two_ends π' htc₁ + · rw [hbs'_other n₁ hn₁_Θ.1] + exact hbs₁_le + · rw [hbs'_star'] + exact hbs_star_le + · rw [show π'.cellGraph c₁ = A₁' from hcellG'_c₁, + hbp'_eq_other_bd n₁ hn₁_bd.1 hn₁_bd.2, hbp'_eq_star', + show π'.nodeVertex n₁ = π.nodeVertex n₁ from hnodeV'_other n₁ hn₁_ne_star', + show π'.nodeVertex n_star' = π.nodeVertex n_star from hnodeV'_star'] + exact hlp₁ + have hcw_c₂ : π'.cellWarp c₂ ≤ π.warpAt Θ := by + apply Portrayal.cellWarp_le_of_two_ends π' htc₂ + · rw [hbs'_other n₂ hn₂_Θ.1] + exact hbs₂_le + · rw [hbs'_star'] + exact hbs_star_le + · rw [show π'.cellGraph c₂ = A₂' from hcellG'_c₂, + hbp'_eq_other_bd n₂ hn₂_bd.1 hn₂_bd.2, hbp'_eq_star', + show π'.nodeVertex n₂ = π.nodeVertex n₂ from hnodeV'_other n₂ hn₂_ne_star', + show π'.nodeVertex n_star' = π.nodeVertex n_star from hnodeV'_star'] + exact hlp₂ + have hcw_other : ∀ d ∈ Γ'.C \ {c₁, c₂}, (d ∩ bd π.S).Nonempty → + π'.cellWarp d = π.cellWarp (cellMap d) := by + intro d hd_diff hbd_d + obtain ⟨_, htd_eq, _⟩ := hborder_not_star d hd_diff hbd_d + have hc_mem := (hcellMap_mem d hd_diff).1 + have hbd_c : (cellMap d ∩ bd π.S).Nonempty := (hbd_iff d hd_diff).mp hbd_d + have hsub_bd := tilde_border_cell_subset_bd π.Γ hc_mem hbd_c + have hcg : π'.cellGraph d = π.cellGraph (cellMap d) := hcellG'_other d hd_diff + change sInf {p | π'.CellWarpLE d p} = sInf {p | π.CellWarpLE (cellMap d) p} + congr 1; ext q' + simp only [Portrayal.CellWarpLE, htd_eq, hcg] + refine forall₂_congr fun u₁ hu₁ => forall₂_congr fun u₂ hu₂ => forall_congr' fun _ => ?_ + have hu₁N : u₁ ∈ π.Γ.N := π.Γ.tilde_subset_N hc_mem hu₁ + have hu₂N : u₂ ∈ π.Γ.N := π.Γ.tilde_subset_N hc_mem hu₂ + have hu₁_ne : u₁ ≠ n_star' := fun h => hn_star'_not_N (h ▸ hu₁N) + have hu₂_ne : u₂ ≠ n_star' := fun h => hn_star'_not_N (h ▸ hu₂N) + have hnv₁ : π'.nodeVertex u₁ = π.nodeVertex u₁ := hnodeV'_other u₁ hu₁_ne + have hnv₂ : π'.nodeVertex u₂ = π.nodeVertex u₂ := hnodeV'_other u₂ hu₂_ne + rw [hbs'_other u₁ hu₁N, hbs'_other u₂ hu₂N, + hbp'_eq_other_bd u₁ hu₁N (hsub_bd hu₁), hbp'_eq_other_bd u₂ hu₂N (hsub_bd hu₂), hnv₁, hnv₂] + have hwarpAt_le : ∀ Θ' ∈ cuffs π.S, π'.warpAt Θ' ≤ π.warpAt Θ' := by + intro Θ' hΘ' + apply csSup_le' + rintro r ⟨d, hd_C', hd_Θ', rfl⟩ + by_cases hd₁ : d = c₁ + · rw [hd₁] at hd_Θ' ⊢ + have hΘ'_eq : Θ' = Θ := + (Γ'.border_cell_subset_cuff hc₁_C' hΘ hc₁_Θ).2.2.2.2 Θ' hΘ' hd_Θ' + exact hΘ'_eq ▸ hcw_c₁ + · by_cases hd₂ : d = c₂ + · rw [hd₂] at hd_Θ' ⊢ + have hΘ'_eq : Θ' = Θ := + (Γ'.border_cell_subset_cuff hc₂_C' hΘ hc₂_Θ).2.2.2.2 Θ' hΘ' hd_Θ' + exact hΘ'_eq ▸ hcw_c₂ + · have hd_diff : d ∈ Γ'.C \ {c₁, c₂} := ⟨hd_C', by simp [hd₁, hd₂]⟩ + have hΘ'_bd : Θ' ⊆ bd π.S := by + rcases hΘ' with ⟨x, _, rfl⟩ + exact connectedComponentIn_subset _ x + have hbd_d : (d ∩ bd π.S).Nonempty := hd_Θ'.mono (inter_subset_inter_right _ hΘ'_bd) + rw [hcw_other d hd_diff hbd_d] + exact π.cellWarp_le_warpAt (hcellMap_mem d hd_diff).1 ((hΘ_iff d hd_diff Θ' hΘ').mp hd_Θ') + have hπ'_res : π'.Resembles π := by + apply resembling_of_central_warp_le htrue.2.1 hπ'_central (Homeomorph.refl π.S) + intro Θ' hΘ' + rw [Homeomorph.refl_apply, image_id] + exact hwarpAt_le Θ' hΘ' + have hπ'_truer : π'.IsTruer π := by + apply isTruer_of_fewer_internal_nodes π' π + · intro i hi + simp only [Portrayal.truth, hi, ↓reduceIte] + change {d ∈ Γ'.C | ¬ (d ∩ bd π.S).Nonempty ∧ (tilde d).ncard = 3 - i.1}.ncard ≤ + {c ∈ π.Γ.C | ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 - i.1}.ncard + exact ncard_internal_cells_le_of_map Γ' π.Γ c₁ c₂ cellMap nodeMap (3 - i.1) + (hc₁_Θ.mono (inter_subset_inter_right _ hΘ_bd)) + (hc₂_Θ.mono (inter_subset_inter_right _ hΘ_bd)) hbij.injOn + (fun d hd => (hcellMap_mem d hd).1) hbd_iff htilde_map hnodeMap_injOn + · change (Γ'.N \ bd π.S).ncard < (π.Γ.N \ bd π.S).ncard + have hsub : Γ'.N \ bd π.S ⊆ (π.Γ.N \ bd π.S) \ {n_star} := by + rintro x ⟨hxN', hxbd⟩ + rw [hN'] at hxN' + rcases hxN' with ⟨hxN, hx_ne⟩ | rfl + · exact ⟨⟨hxN, hxbd⟩, hx_ne⟩ + · exact (hxbd hn_star'_bd).elim + have hle := ncard_le_ncard hsub ((π.Γ.finite_N.subset sdiff_subset).subset sdiff_subset) + have hlt := ncard_sdiff_singleton_lt_of_mem hn_star (π.Γ.finite_N.subset sdiff_subset) + omega + exact htrue.2.2 π' hπ'_central hπ'_truer hπ'_res + +@[expose] public section + +/-- The subhypergraph on the given vertices with no edges. -/ +def edgelessSubhypergraph {α : Type u} {β : Type v} (G : Hypergraph α β) (S : Set α) + (hS : S ⊆ G.vertexSet) : Hypergraph α β where + vertexSet := S + edgeSet := ∅ + Inc _ _ := False + vertex_mem_of_inc _ _ h := h.elim + edge_mem_of_inc _ _ h := h.elim + vertexSet_finite := G.vertexSet_finite.subset hS + edgeSet_finite := Set.finite_empty + +end + +theorem edgelessSubhypergraph_le {α : Type u} {β : Type v} (G : Hypergraph α β) (S : Set α) + (hS : S ⊆ G.vertexSet) : edgelessSubhypergraph G S hS ≤ G := + ⟨hS, empty_subset _, fun _ he => he.elim⟩ + +@[expose] public section + +/-- Adjoin an isolated vertex to a subhypergraph. -/ +def addVertexSubhypergraph {α : Type u} {β : Type v} (A : Hypergraph α β) (x : α) : + Hypergraph α β where + vertexSet := A.vertexSet ∪ {x} + edgeSet := A.edgeSet + Inc := A.Inc + vertex_mem_of_inc _ _ h := Or.inl (A.vertex_mem_of_inc h) + edge_mem_of_inc _ _ h := A.edge_mem_of_inc h + vertexSet_finite := A.vertexSet_finite.union (Set.finite_singleton x) + edgeSet_finite := A.edgeSet_finite + +end + +theorem addVertexSubhypergraph_le {α : Type u} {β : Type v} {G A : Hypergraph α β} {x : α} + (hA : A ≤ G) (hx : x ∈ G.vertexSet) : addVertexSubhypergraph A x ≤ G := + ⟨union_subset hA.1 (singleton_subset_iff.mpr hx), hA.2, hA.3⟩ + +theorem first_eq_last_of_mem_walk_not_mem_vertexSet {α : Type u} {β : Type v} + (A : Hypergraph α β) {x u v : α} (hx : x ∉ A.vertexSet) + (w : A.skeleton.Walk u v) (hmem : x ∈ w.support) : + u = x ∧ v = x := by + induction w with + | @nil a => + rw [SimpleGraph.Walk.support_nil] at hmem + have hEq : x = a := List.mem_singleton.mp hmem + exact ⟨hEq.symm, hEq.symm⟩ + | @cons a b c hab w' ih => + rcases hab with ⟨_, e, ha, hb⟩ + rcases List.mem_cons.mp hmem with rfl | hmem' + · exact (hx (A.vertex_mem_of_inc ha)).elim + · obtain ⟨rfl, rfl⟩ := ih hmem' + exact (hx (A.vertex_mem_of_inc hb)).elim + +theorem injective_first_of_disjoint_paths {α : Type u} {K : SimpleGraph α} {X Y : Set α} {k : ℕ} + (P : Fin k → PathFromTo K X Y) + (hdisj : Pairwise fun i j ↦ Disjoint {z | z ∈ (P i).walk.support} {z | z ∈ + (P j).walk.support}) : + Function.Injective (fun i : Fin k ↦ (P i).first) := by + intro i j hEq + by_contra hij + have hi : (P i).first ∈ (P i).walk.support := (P i).walk.start_mem_support + have hj : (P i).first ∈ (P j).walk.support := by + change (fun m => (P m).first) i ∈ (P j).walk.support + rw [hEq] + exact (P j).walk.start_mem_support + exact Set.disjoint_left.mp (hdisj hij) hi hj + +theorem injective_last_of_disjoint_paths {α : Type u} {K : SimpleGraph α} {X Y : Set α} {k : ℕ} + (P : Fin k → PathFromTo K X Y) + (hdisj : Pairwise fun i j ↦ Disjoint {z | z ∈ (P i).walk.support} {z | z ∈ + (P j).walk.support}) : + Function.Injective (fun i : Fin k ↦ (P i).last) := by + intro i j hEq + by_contra hij + have hi : (P i).last ∈ (P i).walk.support := (P i).walk.end_mem_support + have hj : (P i).last ∈ (P j).walk.support := by + change (fun m => (P m).last) i ∈ (P j).walk.support + rw [hEq] + exact (P j).walk.end_mem_support + exact Set.disjoint_left.mp (hdisj hij) hi hj + +theorem le_ncard_of_disjoint_paths_first {α : Type u} {K : SimpleGraph α} {X Y : Set α} {k : ℕ} + (hX_fin : X.Finite) (P : Fin k → PathFromTo K X Y) + (hdisj : Pairwise fun i j ↦ Disjoint {z | z ∈ (P i).walk.support} {z | z ∈ + (P j).walk.support}) : + k ≤ X.ncard := by + have hsub : range (fun i : Fin k ↦ (P i).first) ⊆ X := by + rintro _ ⟨i, rfl⟩; exact (P i).first_mem + have hcard : (range (fun i : Fin k ↦ (P i).first)).ncard = k := by + rw [ncard_range_of_injective (injective_first_of_disjoint_paths P hdisj), + Nat.card_eq_fintype_card, Fintype.card_fin] + rw [← hcard] + exact ncard_le_ncard hsub hX_fin + +theorem le_ncard_of_disjoint_paths_last {α : Type u} {K : SimpleGraph α} {X Y : Set α} {k : ℕ} + (hY_fin : Y.Finite) (P : Fin k → PathFromTo K X Y) + (hdisj : Pairwise fun i j ↦ Disjoint {z | z ∈ (P i).walk.support} {z | z ∈ + (P j).walk.support}) : + k ≤ Y.ncard := by + have hsub : range (fun i : Fin k ↦ (P i).last) ⊆ Y := by + rintro _ ⟨i, rfl⟩; exact (P i).last_mem + have hcard : (range (fun i : Fin k ↦ (P i).last)).ncard = k := by + rw [ncard_range_of_injective (injective_last_of_disjoint_paths P hdisj), + Nat.card_eq_fintype_card, Fintype.card_fin] + rw [← hcard] + exact ncard_le_ncard hsub hY_fin + +theorem exists_first_eq_of_ncard_le {α : Type u} {K : SimpleGraph α} {X Y : Set α} {k : ℕ} + (hX_fin : X.Finite) (hcard : X.ncard ≤ k) + (P : Fin k → PathFromTo K X Y) + (hdisj : Pairwise fun i j ↦ Disjoint {z | z ∈ (P i).walk.support} {z | z ∈ (P j).walk.support}) + {x : α} (hx : x ∈ X) : + ∃ i : Fin k, (P i).first = x := by + have hsub : range (fun i : Fin k ↦ (P i).first) ⊆ X := by + rintro _ ⟨i, rfl⟩; exact (P i).first_mem + have hr_card : (range (fun i : Fin k ↦ (P i).first)).ncard = k := by + rw [ncard_range_of_injective (injective_first_of_disjoint_paths P hdisj), + Nat.card_eq_fintype_card, Fintype.card_fin] + have hEq : range (fun i : Fin k ↦ (P i).first) = X := + eq_of_subset_of_ncard_le hsub (by omega) hX_fin + have hx' : x ∈ range (fun i : Fin k ↦ (P i).first) := by rwa [hEq] + exact hx' + +theorem exists_last_eq_of_ncard_le {α : Type u} {K : SimpleGraph α} {X Y : Set α} {k : ℕ} + (hY_fin : Y.Finite) (hcard : Y.ncard ≤ k) + (P : Fin k → PathFromTo K X Y) + (hdisj : Pairwise fun i j ↦ Disjoint {z | z ∈ (P i).walk.support} {z | z ∈ (P j).walk.support}) + {y : α} (hy : y ∈ Y) : + ∃ i : Fin k, (P i).last = y := by + have hsub : range (fun i : Fin k ↦ (P i).last) ⊆ Y := by + rintro _ ⟨i, rfl⟩; exact (P i).last_mem + have hr_card : (range (fun i : Fin k ↦ (P i).last)).ncard = k := by + rw [ncard_range_of_injective (injective_last_of_disjoint_paths P hdisj), + Nat.card_eq_fintype_card, Fintype.card_fin] + have hEq : range (fun i : Fin k ↦ (P i).last) = Y := + eq_of_subset_of_ncard_le hsub (by omega) hY_fin + have hy' : y ∈ range (fun i : Fin k ↦ (P i).last) := by rwa [hEq] + exact hy' + +theorem ncard_borderPlus_le_warpAt_succ + {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) + {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) {n : π.S} (hn : n ∈ π.Γ.N ∩ Θ) : + (π.borderPlus n).ncard ≤ π.warpAt Θ + 1 := by + have hΘ_arc : IsOArc Θ := (cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hbs_le : (π.borderSet n).ncard ≤ π.warpAt Θ := π.ncard_borderSet_le_warpAt hΘ hΘ_arc hn + have hbp_le : (π.borderPlus n).ncard ≤ (π.borderSet n).ncard + 1 := + π.ncard_borderPlus_le ⟨hn.1, hΘ_bd hn.2⟩ + omega + +theorem cyclicDist_succ_pred_le {k : ℕ} (hk : 2 ≤ k) {i m : Fin k} (hm : m ≠ i) : + let hk_pos : 0 < k := by omega + let i_next : Fin k := ⟨(i.1 + 1) % k, Nat.mod_lt _ hk_pos⟩ + let i_prev : Fin k := cyclicPred hk_pos i + cyclicDist i i_next + cyclicDist i_next m + cyclicDist m i_prev ≤ k := by + intro hk_pos i_next i_prev + have hm_val : m.1 ≠ i.1 := fun h => hm (Fin.ext h) + have hi_lt : i.1 < k := i.2 + have hm_lt : m.1 < k := m.2 + have hnext_val : i_next.1 = if i.1 + 1 < k then i.1 + 1 else 0 := by + dsimp [i_next] + split_ifs with h + · exact Nat.mod_eq_of_lt h + · have : i.1 + 1 = k := by omega + rw [this, Nat.mod_self] + have hprev_val : i_prev.1 = if i.1 = 0 then k - 1 else i.1 - 1 := by + dsimp [i_prev, cyclicPred] + split_ifs with h + · rw [h, Nat.zero_add, Nat.mod_eq_of_lt (by omega)] + · have h1 : i.1 + k - 1 = (i.1 - 1) + k := by omega + rw [h1, Nat.add_mod_right, Nat.mod_eq_of_lt (by omega)] + rw [cyclicDist_eq_ite, cyclicDist_eq_ite, cyclicDist_eq_ite] + revert hnext_val hprev_val + split_ifs <;> intro hnext_val hprev_val <;> omega + +theorem exists_other_border_cell_of_mem_tilde + {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) + {Θ c₀ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (hc₀ : c₀ ∈ π.Γ.C) (hc₀_Θ : (c₀ ∩ Θ).Nonempty) + {n₁ n₂ : π.S} (hne₁₂ : n₁ ≠ n₂) (htc₀ : tilde c₀ = {n₁, n₂}) : + ∃ c₁ ∈ π.Γ.C, (c₁ ∩ Θ).Nonempty ∧ c₁ ≠ c₀ ∧ + ∃ n₃ : π.S, n₁ ≠ n₃ ∧ tilde c₁ = {n₁, n₃} ∧ + (∀ d ∈ π.Γ.C, (d ∩ bd π.S).Nonempty → (n₁ ∈ tilde d ↔ d = c₀ ∨ d = c₁)) ∧ + (∀ m ∈ π.Γ.N ∩ Θ, m ≠ n₁ → + ∀ v ∈ π.borderPlus n₁, v ∈ π.borderPlus m → + v ∈ π.borderPlus n₂ ∨ v ∈ π.borderPlus n₃) := by + have hΘ_arc : IsOArc Θ := (cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + have hsub_cuff₀ := π.Γ.border_cell_subset_cuff hc₀ hΘ hc₀_Θ + have hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ := hsub_cuff₀.2.2.2.1 (htc₀ ▸ Or.inl rfl) + set k := (π.Γ.N ∩ Θ).ncard + obtain ⟨E⟩ : Nonempty (π.Γ.CuffEnumeration Θ k) := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + have hk_ge2 : 2 ≤ k := E.two_le + have hk_pos : 0 < k := by omega + have hn₁_range : n₁ ∈ range E.node := E.range_node ▸ hn₁_Θ + rcases hn₁_range with ⟨i, hi_eq⟩ + let i_next : Fin k := ⟨(i.1 + 1) % k, Nat.mod_lt _ hk_pos⟩ + let i_prev : Fin k := cyclicPred hk_pos i + have hi_ne_next : i ≠ i_next := by + intro hEq + have hval : i.1 = (i.1 + 1) % k := congrArg Fin.val hEq + have hi_lt : i.1 < k := i.2 + by_cases hlast : i.1 + 1 = k + · rw [hlast, Nat.mod_self] at hval; omega + · rw [Nat.mod_eq_of_lt (by omega)] at hval; omega + have hi_ne_prev : i ≠ i_prev := by + intro hEq + have hval : i.1 = (i.1 + k - 1) % k := congrArg Fin.val hEq + have hi_lt : i.1 < k := i.2 + by_cases hi0 : i.1 = 0 + · rw [hi0, Nat.zero_add, Nat.mod_eq_of_lt (by omega)] at hval; omega + · have hmod : (i.1 + k - 1) % k = i.1 - 1 := by + rw [show i.1 + k - 1 = (i.1 - 1) + k by omega, Nat.add_mod_right, + Nat.mod_eq_of_lt (by omega)] + omega + have hprev_succ : (⟨(i_prev.1 + 1) % k, Nat.mod_lt _ hk_pos⟩ : Fin k) = i := by + apply Fin.ext + dsimp [i_prev, cyclicPred] + have hi_lt : i.1 < k := i.2 + by_cases hi0 : i.1 = 0 + · simp [hi0, Nat.sub_add_cancel hk_pos] + · have hmod : (i.1 + k - 1) % k = i.1 - 1 := by + rw [show i.1 + k - 1 = (i.1 - 1) + k by omega, Nat.add_mod_right, + Nat.mod_eq_of_lt (by omega)] + rw [hmod, Nat.sub_add_cancel (by omega), Nat.mod_eq_of_lt hi_lt] + have hcell_tilde_i : tilde (E.cell i) = {n₁, E.node i_next} := by + rw [E.cell_tilde i, hi_eq] + have hcell_tilde_prev : tilde (E.cell i_prev) = {n₁, E.node i_prev} := by + rw [E.cell_tilde i_prev, hprev_succ, hi_eq, Set.pair_comm] + have hmem_tilde_iff : ∀ j : Fin k, n₁ ∈ tilde (E.cell j) ↔ j = i ∨ j = i_prev := by + intro j + rw [E.cell_tilde j, ← hi_eq] + simp only [mem_insert_iff, mem_singleton_iff, E.injective_node.eq_iff] + refine ⟨fun h => ?_, fun h => ?_⟩ + · rcases h with rfl | hEq + · exact Or.inl rfl + · right + apply Fin.ext + dsimp [i_prev, cyclicPred] + have hi_lt : i.1 < k := i.2 + have hj_lt : j.1 < k := j.2 + have hval : (j.1 + 1) % k = i.1 := congrArg Fin.val hEq.symm + by_cases hj_last : j.1 + 1 = k + · rw [hj_last, Nat.mod_self] at hval + rw [← hval, Nat.zero_add, Nat.mod_eq_of_lt (by omega)] + omega + · rw [Nat.mod_eq_of_lt (by omega)] at hval + have h1 : i.1 + k - 1 = j.1 + k := by omega + rw [h1, Nat.add_mod_right, Nat.mod_eq_of_lt hj_lt] + · rcases h with rfl | rfl + · exact Or.inl rfl + · exact Or.inr hprev_succ.symm + have hd_iff : ∀ d ∈ π.Γ.C, (d ∩ bd π.S).Nonempty → + (n₁ ∈ tilde d ↔ d = E.cell i ∨ d = E.cell i_prev) := by + intro d hd hbd_d + constructor + · intro hn₁_td + rcases hbd_d with ⟨x, hxd, hxbd⟩ + let Θ' := connectedComponentIn (bd π.S) x + have hΘ' : Θ' ∈ cuffs π.S := ⟨x, hxbd, rfl⟩ + have hd_Θ' : (d ∩ Θ').Nonempty := ⟨x, hxd, mem_connectedComponentIn hxbd⟩ + have hn₁_Θ' : n₁ ∈ π.Γ.N ∩ Θ' := + (π.Γ.border_cell_subset_cuff hd hΘ' hd_Θ').2.2.2.1 hn₁_td + have hΘ'_eq : Θ' = Θ := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact (connectedComponentIn_eq hn₁_Θ'.2).trans (connectedComponentIn_eq hn₁_Θ.2).symm + have hd_mem : d ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := ⟨hd, hΘ'_eq ▸ hd_Θ'⟩ + rw [← E.range_cell] at hd_mem + rcases hd_mem with ⟨j, rfl⟩ + rcases (hmem_tilde_iff j).mp hn₁_td with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + · rintro (rfl | rfl) + · rw [hcell_tilde_i]; exact Or.inl rfl + · rw [hcell_tilde_prev]; exact Or.inl rfl + have hneighbors : ∀ m ∈ π.Γ.N ∩ Θ, m ≠ n₁ → + ∀ v ∈ π.borderPlus n₁, v ∈ π.borderPlus m → + v ∈ π.borderPlus (E.node i_next) ∨ v ∈ π.borderPlus (E.node i_prev) := by + intro m hm hm_ne v hv₁ hvm + have hm_range : m ∈ range E.node := E.range_node ▸ hm + rcases hm_range with ⟨jm, rfl⟩ + have hjm_ne : jm ≠ i := fun h => hm_ne (h ▸ hi_eq) + rw [← hi_eq] at hv₁ + exact π.p7_of_cyclicDist E (cyclicDist_succ_pred_le hk_ge2 hjm_ne) hv₁ hvm + have hbd₀ : (c₀ ∩ bd π.S).Nonempty := hsub_cuff₀.2.1 ▸ hc₀_Θ + have hn₁_tc₀ : n₁ ∈ tilde c₀ := htc₀ ▸ Or.inl rfl + rcases (hd_iff c₀ hc₀ hbd₀).mp hn₁_tc₀ with hc₀_eq | hc₀_eq + · have hn₂_eq : n₂ = E.node i_next := by + have hpair : ({n₁, n₂} : Set π.S) = {n₁, E.node i_next} := + htc₀.symm.trans (hc₀_eq ▸ hcell_tilde_i) + have hmem : n₂ ∈ ({n₁, E.node i_next} : Set π.S) := hpair ▸ Or.inr rfl + exact hmem.resolve_left hne₁₂.symm + have hc₁_mem : E.cell i_prev ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := + E.range_cell ▸ ⟨i_prev, rfl⟩ + refine ⟨E.cell i_prev, hc₁_mem.1, hc₁_mem.2, ?_, E.node i_prev, ?_, hcell_tilde_prev, ?_, ?_⟩ + · rw [hc₀_eq] + exact E.injective_cell.ne hi_ne_prev.symm + · rw [← hi_eq] + exact E.injective_node.ne hi_ne_prev + · intro d hd hbd_d + rw [hd_iff d hd hbd_d, hc₀_eq] + · intro m hm hm_ne v hv₁ hvm + rw [hn₂_eq] + exact hneighbors m hm hm_ne v hv₁ hvm + · have hn₂_eq : n₂ = E.node i_prev := by + have hpair : ({n₁, n₂} : Set π.S) = {n₁, E.node i_prev} := + htc₀.symm.trans (hc₀_eq ▸ hcell_tilde_prev) + have hmem : n₂ ∈ ({n₁, E.node i_prev} : Set π.S) := hpair ▸ Or.inr rfl + exact hmem.resolve_left hne₁₂.symm + have hc₁_mem : E.cell i ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := + E.range_cell ▸ ⟨i, rfl⟩ + refine ⟨E.cell i, hc₁_mem.1, hc₁_mem.2, ?_, E.node i_next, ?_, hcell_tilde_i, ?_, ?_⟩ + · rw [hc₀_eq] + exact E.injective_cell.ne hi_ne_prev + · rw [← hi_eq] + exact E.injective_node.ne hi_ne_next + · intro d hd hbd_d + rw [hd_iff d hd hbd_d, hc₀_eq, or_comm] + · intro m hm hm_ne v hv₁ hvm + rw [hn₂_eq, or_comm] + exact hneighbors m hm hm_ne v hv₁ hvm + +theorem extract_linkage_from_plus_linkage + {α : Type u} {β : Type v} {G : Hypergraph α β} (π : Portrayal G) + (hdom : π.domγ = π.Γ.N) + {Θ c₀ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (hc₀ : c₀ ∈ π.Γ.C) (hc₀_Θ : (c₀ ∩ Θ).Nonempty) + {n₁ n₂ : π.S} (hn₁_tc : n₁ ∈ tilde c₀) (hn₂_tc : n₂ ∈ tilde c₀) (hne : n₁ ≠ n₂) + (hbs₁_eq : (π.borderSet n₁).ncard = π.warpAt Θ) + (hbs₂_eq : (π.borderSet n₂).ncard = π.warpAt Θ) + (hpaths : HasDisjointPaths (π.cellGraph c₀).skeleton (π.borderPlus n₁) (π.borderPlus n₂) + (π.warpAt Θ + 1)) : + ∃ L : Fin (π.warpAt Θ) → + PathFromTo (π.cellGraph c₀).skeleton (π.borderSet n₁) (π.borderSet n₂), + (Pairwise fun i j ↦ Disjoint {z | z ∈ (L i).walk.support} {z | z ∈ (L j).walk.support}) ∧ + (∀ i, π.nodeVertex n₁ ∉ (L i).walk.support ∧ π.nodeVertex n₂ ∉ (L i).walk.support) ∧ + ∃ L₀ : PathFromTo (π.cellGraph c₀).skeleton {π.nodeVertex n₁} {π.nodeVertex n₂}, + ∀ i, Disjoint {z | z ∈ L₀.walk.support} {z | z ∈ (L i).walk.support} := by + have hsub_cuff₀ := π.Γ.border_cell_subset_cuff hc₀ hΘ hc₀_Θ + have hbd₀ : (c₀ ∩ bd π.S).Nonempty := hsub_cuff₀.2.1 ▸ hc₀_Θ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ := hsub_cuff₀.2.2.2.1 hn₁_tc + have hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ := hsub_cuff₀.2.2.2.1 hn₂_tc + have hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S := ⟨hn₁_Θ.1, hΘ_bd hn₁_Θ.2⟩ + have hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S := ⟨hn₂_Θ.1, hΘ_bd hn₂_Θ.2⟩ + have hbp₁_eq : π.borderPlus n₁ = insert (π.nodeVertex n₁) (π.borderSet n₁) := by + ext x + simp [Portrayal.borderPlus, hdom ▸ hn₁_Θ.1, or_comm] + have hbp₂_eq : π.borderPlus n₂ = insert (π.nodeVertex n₂) (π.borderSet n₂) := by + ext x + simp [Portrayal.borderPlus, hdom ▸ hn₂_Θ.1, or_comm] + have hbs₁_fin : (π.borderSet n₁).Finite := + (π.cellGraph c₀).vertexSet_finite.subset (π.p3_subset c₀ hc₀ hbd₀ n₁ hn₁_tc) + have hbs₂_fin : (π.borderSet n₂).Finite := + (π.cellGraph c₀).vertexSet_finite.subset (π.p3_subset c₀ hc₀ hbd₀ n₂ hn₂_tc) + have hbp₁_card : (π.borderPlus n₁).ncard = π.warpAt Θ + 1 := by + rw [hbp₁_eq, ncard_insert_of_notMem (π.p3_notMem n₁ ⟨hdom ▸ hn₁_bd.1, hn₁_bd.2⟩) hbs₁_fin, + hbs₁_eq] + have hbp₂_card : (π.borderPlus n₂).ncard = π.warpAt Θ + 1 := by + rw [hbp₂_eq, ncard_insert_of_notMem (π.p3_notMem n₂ ⟨hdom ▸ hn₂_bd.1, hn₂_bd.2⟩) hbs₂_fin, + hbs₂_eq] + have hcw₀ : π.CellWarpLE c₀ (π.warpAt Θ) := + (π.cellWarp_le_iff hc₀ hbd₀).mp (π.cellWarp_le_warpAt hc₀ hc₀_Θ) + have hlp := (hcw₀ n₁ hn₁_tc n₂ hn₂_tc hne).2.2 hbp₁_card hbp₂_card + rcases hpaths with ⟨P, hdisj⟩ + obtain ⟨i₀, hi₀_first, hi₀_last⟩ := hlp P hdisj + let L₀ : PathFromTo (π.cellGraph c₀).skeleton {π.nodeVertex n₁} {π.nodeVertex n₂} := + { first := (P i₀).first + last := (P i₀).last + walk := (P i₀).walk + isPath := (P i₀).isPath + first_mem := hi₀_first + last_mem := hi₀_last } + let emb : Fin (π.warpAt Θ) ↪ Fin (π.warpAt Θ + 1) := i₀.succAboveEmb + have hemb_ne : ∀ j : Fin (π.warpAt Θ), emb j ≠ i₀ := fun j => Fin.succAbove_ne i₀ j + have hfirst_bs₁ : ∀ j : Fin (π.warpAt Θ), (P (emb j)).first ∈ π.borderSet n₁ := by + intro j + rcases (P (emb j)).first_mem with hbs | ⟨_, hEq⟩ + · exact hbs + · exfalso + exact hemb_ne j (injective_first_of_disjoint_paths P hdisj (hEq.trans hi₀_first.symm)) + have hlast_bs₂ : ∀ j : Fin (π.warpAt Θ), (P (emb j)).last ∈ π.borderSet n₂ := by + intro j + rcases (P (emb j)).last_mem with hbs | ⟨_, hEq⟩ + · exact hbs + · exfalso + exact hemb_ne j (injective_last_of_disjoint_paths P hdisj (hEq.trans hi₀_last.symm)) + let L : Fin (π.warpAt Θ) → + PathFromTo (π.cellGraph c₀).skeleton (π.borderSet n₁) (π.borderSet n₂) := fun j => + { first := (P (emb j)).first + last := (P (emb j)).last + walk := (P (emb j)).walk + isPath := (P (emb j)).isPath + first_mem := hfirst_bs₁ j + last_mem := hlast_bs₂ j } + have hL_disj : Pairwise fun i j ↦ Disjoint {z | z ∈ (L i).walk.support} {z | z ∈ + (L j).walk.support} := by + intro i j hij + exact hdisj (emb.injective.ne hij) + have hL₀_disj : ∀ j : Fin (π.warpAt Θ), + Disjoint {z | z ∈ L₀.walk.support} {z | z ∈ (L j).walk.support} := + fun j => hdisj (hemb_ne j).symm + have hL_avoid : ∀ j : Fin (π.warpAt Θ), + π.nodeVertex n₁ ∉ (L j).walk.support ∧ π.nodeVertex n₂ ∉ (L j).walk.support := by + intro j + have hn₁_L₀ : π.nodeVertex n₁ ∈ L₀.walk.support := by + change π.nodeVertex n₁ ∈ (P i₀).walk.support + rw [← hi₀_first] + exact (P i₀).walk.start_mem_support + have hn₂_L₀ : π.nodeVertex n₂ ∈ L₀.walk.support := by + change π.nodeVertex n₂ ∈ (P i₀).walk.support + rw [← hi₀_last] + exact (P i₀).walk.end_mem_support + exact ⟨Set.disjoint_left.mp (hL₀_disj j) hn₁_L₀, Set.disjoint_left.mp (hL₀_disj j) hn₂_L₀⟩ + exact ⟨L, hL_disj, hL_avoid, L₀, hL₀_disj⟩ + +theorem hasDisjointPathsAvoiding_symm {α : Type u} {β : Type v} (H : Hypergraph α β) + (X Y W : Set α) (q : ℕ) (h : HasDisjointPathsAvoiding H X Y W q) : + HasDisjointPathsAvoiding H Y X W q := by + rcases h with ⟨L, hdisj, havoid⟩ + let L' : Fin q → PathFromTo H.skeleton Y X := fun i => + { first := (L i).last + last := (L i).first + walk := (L i).walk.reverse + isPath := (L i).isPath.reverse + first_mem := (L i).last_mem + last_mem := (L i).first_mem } + have hsup : ∀ i, {z | z ∈ (L' i).walk.support} = {z | z ∈ (L i).walk.support} := by + intro i; ext z + change z ∈ (L i).walk.reverse.support ↔ z ∈ (L i).walk.support + rw [SimpleGraph.Walk.support_reverse, List.mem_reverse] + refine ⟨L', fun i j hij => ?_, fun i => ?_⟩ + · dsimp only; rw [hsup i, hsup j]; exact hdisj hij + · rw [hsup i]; exact havoid i + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Section9bProved.lean b/LeanPool/GraphMinor/GM17/Section9bProved.lean new file mode 100644 index 0000000000..385e5077e2 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Section9bProved.lean @@ -0,0 +1,2150 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Section9b +import LeanPool.GraphMinor.GM17.Section5Proved +import LeanPool.GraphMinor.GM17.Section6Proved +import LeanPool.GraphMinor.GM17.Section7Proved +import LeanPool.GraphMinor.GM17.Section8Proved +import LeanPool.GraphMinor.GM17.Section9Proved + +public import LeanPool.GraphMinor.GM17.Section9 +public import LeanPool.GraphMinor.GM17.ArcDisc +import LeanPool.GraphMinor.GM17.PasteCuff +import LeanPool.GraphMinor.GM17.MarkCross +import LeanPool.GraphMinor.GM17.ReplaceDisc +import LeanPool.GraphMinor.GM17.RegionDisc +import LeanPool.GraphMinor.GM17.CutArcPaint +import LeanPool.GraphMinor.GM17.PushNode + +import LeanPool.GraphMinor.GM17.IndentMain + +import LeanPool.GraphMinor.GM17.RegionBoundary + +/-! +# Graph Minors XVII: proved deductions of Section9b + +The portrayal deductions use the existing painting proofs. The definitions and +independent geometric lemmas are imported from `Section9b`. +-/ + +public section + +namespace GraphMinor.GM17 + +open Set Function Topology Metric +open GraphMinor.Surface +open GraphMinor.GM10 +open GraphMinor.Hypergraph + +universe u v + +local notation "𝕀" => unitInterval + +theorem indentedBorderPainting_props + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {Θ c₀ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (hc₀ : c₀ ∈ π.Γ.C) (hc₀_Θ : (c₀ ∩ Θ).Nonempty) + {n₁ n₂ : π.S} (hne : n₁ ≠ n₂) (htc₀ : tilde c₀ = {n₁, n₂}) : + ((¬ ∃ c ∈ π.Γ.C, ¬ (c ∩ bd π.S).Nonempty ∧ tilde c₀ ⊆ tilde c) → + ∃ n₀ ∈ π.Γ.N \ bd π.S, ∃ Γ' : Painting π.S, + IsIndentedBorderPainting π.Γ Θ c₀ n₁ n₂ n₀ {c₀} Γ') ∧ + (∀ c₃ ∈ π.Γ.C, ¬ (c₃ ∩ bd π.S).Nonempty → ∀ n₃ ∈ π.Γ.N \ bd π.S, + tilde c₃ = {n₁, n₂, n₃} → + ∃ Γ' : Painting π.S, IsIndentedBorderPainting π.Γ Θ c₀ n₁ n₂ n₃ {c₀, c₃} Γ') := by + have : ConnectedSpace π.S := π.connected + have hN_ge6 : 6 ≤ π.Γ.N.ncard := by + have hge := (π.sub_two_mul_warp_le_ncard_domγ h𝒯 htrue.1 hwarp).2 + omega + have h81 : ∀ r ∈ π.Γ.regions, IsOpenDisc r := + fun r hr => theorem_8_1_proof + h𝒯 π htrue hred hwarp hθ hr + obtain ⟨h82_1, h82_2, _⟩ := + theorem_8_2_proof + h𝒯 π htrue hred hwarp hθ + have h83 := fun (F : Set π.S) hL hnorm hFbd hcard => + theorem_8_3_proof h𝒯 π htrue hred hwarp hθ (F := F) hL hnorm hFbd hcard + have h88 := fun (c₁ : Set π.S) hc₁ (c₂ : Set π.S) hc₂ hne_c hsub => + theorem_8_8_proof + h𝒯 π htrue hred hwarp hθ (c₁ := c₁) (c₂ := c₂) hc₁ hc₂ hne_c hsub + exact GraphMinor.GM17.indentedBorderPainting π.S π.isSurface π.Γ hN_ge6 h81 h82_1 h82_2 h83 h88 Θ + hΘ c₀ hc₀ hc₀_Θ n₁ n₂ hne htc₀ + +private theorem decreased_warp_second_linkage + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} + {c₀ : Set π.S} + {n₂ : π.S} + (hbp₂_sub : π.borderPlus n₂ ⊆ (π.cellGraph c₀).vertexSet) + (A₁ : Hypergraph α β) + (A₂ : Hypergraph α β) + (hsep : (π.cellGraph c₀).IsSeparation A₁ A₂) + (n₀ : π.S) + (hn₀_not_c₀ : π.nodeVertex n₀ ∉ (π.cellGraph c₀).vertexSet) + (A₁' : Hypergraph α β) + (hn₀_mem_inter : π.nodeVertex n₀ ∈ A₁'.vertexSet ∩ (addVertexSubhypergraph A₂ (π.nodeVertex + n₀)).vertexSet) + (hinter_fin' : (A₁'.vertexSet ∩ (addVertexSubhypergraph A₂ (π.nodeVertex + n₀)).vertexSet).Finite) : + (π.borderPlus n₂).ncard = π.warpAt Θ + 1 → (A₁'.vertexSet ∩ (addVertexSubhypergraph A₂ + (π.nodeVertex n₀)).vertexSet).ncard = π.warpAt Θ + 1 → Portrayal.LinkagePairs + (addVertexSubhypergraph A₂ (π.nodeVertex n₀)).skeleton (π.borderPlus n₂) (A₁'.vertexSet ∩ + (addVertexSubhypergraph A₂ (π.nodeVertex n₀)).vertexSet) (π.warpAt Θ + 1) (π.nodeVertex n₂) + (π.nodeVertex n₀) := by + let A₂' := addVertexSubhypergraph A₂ (π.nodeVertex n₀) + intro _ hcard₂ P hdisj + obtain ⟨i₀, hi₀_last⟩ := exists_last_eq_of_ncard_le hinter_fin' hcard₂.le P hdisj + hn₀_mem_inter + have hn₀_not_A₂ : π.nodeVertex n₀ ∉ A₂.vertexSet := + fun h => hn₀_not_c₀ (hsep.right_le.1 h) + have hn₀_sup : π.nodeVertex n₀ ∈ (P i₀).walk.support := + (congrArg (fun z => z ∈ (P i₀).walk.support) hi₀_last).mp (P i₀).walk.end_mem_support + obtain ⟨hfirst, _⟩ := + first_eq_last_of_mem_walk_not_mem_vertexSet A₂ hn₀_not_A₂ (P i₀).walk hn₀_sup + exfalso + apply hn₀_not_c₀ + apply hbp₂_sub + rw [← hfirst] + exact (P i₀).first_mem + +private theorem edgeless_linkage_side_is_small + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (π : Portrayal G) + {c₀ : Set π.S} + (A₁ : Hypergraph α β) + (A₂ : Hypergraph α β) + (hsep : (π.cellGraph c₀).IsSeparation A₁ A₂) + (n₀ : π.S) + (hsmall_aux : ∀ A ≤ π.cellGraph c₀, (∀ x ∈ A.vertexSet, (∃ e ∈ (π.cellGraph c₀).edgeSet \ + A.edgeSet, (π.cellGraph c₀).Inc e x) → x ∈ A₁.vertexSet ∩ A₂.vertexSet) → ∃ B, + (addVertexSubhypergraph A (π.nodeVertex n₀), B) ∈ 𝒯) : + ∃ B, (addVertexSubhypergraph A₁ (π.nodeVertex n₀), B) ∈ 𝒯 := by + refine hsmall_aux A₁ hsep.left_le fun x hx₁ ⟨e, ⟨he₀, he_not₁⟩, hinc₀⟩ => ⟨hx₁, ?_⟩ + have he₂ : e ∈ A₂.edgeSet := (hsep.edgeSet_union ▸ he₀).resolve_left he_not₁ + have hinc₂ : A₂.Inc e x := (inc_iff_of_le hsep.right_le he₂).2 hinc₀ + exact A₂.vertex_mem_of_inc hinc₂ + +private theorem indented_cell_union_is_small + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (π : Portrayal G) + {c₀ : Set π.S} + (A₁ : Hypergraph α β) + (A₂ : Hypergraph α β) + (hsep : (π.cellGraph c₀).IsSeparation A₁ A₂) + (n₀ : π.S) + (hsmall_aux : ∀ A ≤ π.cellGraph c₀, (∀ x ∈ A.vertexSet, (∃ e ∈ (π.cellGraph c₀).edgeSet \ + A.edgeSet, (π.cellGraph c₀).Inc e x) → x ∈ A₁.vertexSet ∩ A₂.vertexSet) → ∃ B, + (addVertexSubhypergraph A (π.nodeVertex n₀), B) ∈ 𝒯) : + ∃ B, ((addVertexSubhypergraph A₂ (π.nodeVertex n₀)), B) ∈ 𝒯 := by + let A₂' := addVertexSubhypergraph A₂ (π.nodeVertex n₀) + refine hsmall_aux A₂ hsep.right_le fun x hx₂ ⟨e, ⟨he₀, he_not₂⟩, hinc₀⟩ => ⟨?_, hx₂⟩ + have he₁ : e ∈ A₁.edgeSet := (hsep.edgeSet_union ▸ he₀).resolve_right he_not₂ + have hinc₁ : A₁.Inc e x := (inc_iff_of_le hsep.left_le he₁).2 hinc₀ + exact A₁.vertex_mem_of_inc hinc₁ + +private theorem cell_linkage_from_warp + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {θ : ℕ} + {p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {Θ : Set π.S} + {c₀ : Set π.S} + (hΘ : Θ ∈ cuffs π.S) + (hc₀ : c₀ ∈ π.Γ.C) + (hc₀_Θ : (c₀ ∩ Θ).Nonempty) + {n₁ : π.S} + {n₂ : π.S} + (hn₁_tc : n₁ ∈ tilde c₀) + (hn₂_tc : n₂ ∈ tilde c₀) + (hne : n₁ ≠ n₂) + (hno_int : ¬∃ c ∈ π.Γ.C, ¬(c ∩ bd π.S).Nonempty ∧ tilde c₀ ⊆ tilde c) + (hdom : π.domγ = π.Γ.N) + (hnode_cell : ∀ n ∈ π.Γ.N, ∃ c ∈ π.Γ.C, n ∈ tilde c) + (hbd₀ : (c₀ ∩ bd π.S).Nonempty) + (htc₀ : tilde c₀ = {n₁, n₂}) + (hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ) + (hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ) + (hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S) + (hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S) + (hbp₁_sub : π.borderPlus n₁ ⊆ (π.cellGraph c₀).vertexSet) + (hbp₂_sub : π.borderPlus n₂ ⊆ (π.cellGraph c₀).vertexSet) + (hbs₁_le : (π.borderSet n₁).ncard ≤ π.warpAt Θ) + (hbs₂_le : (π.borderSet n₂).ncard ≤ π.warpAt Θ) + (hlinkage : (π.borderPlus n₁).ncard = π.warpAt Θ + 1 → (π.borderPlus n₂).ncard = π.warpAt Θ + + 1 → Portrayal.LinkagePairs (π.cellGraph c₀).skeleton (π.borderPlus n₁) (π.borderPlus n₂) + (π.warpAt Θ + 1) (π.nodeVertex n₁) (π.nodeVertex n₂)) : + HasDisjointPaths (π.cellGraph c₀).skeleton (π.borderPlus n₁) (π.borderPlus n₂) (π.warpAt Θ + + 1) := by + rw [← GraphMinor.menger (π.cellGraph c₀) (π.borderPlus n₁) (π.borderPlus n₂) hbp₁_sub hbp₂_sub + (π.warpAt Θ + 1)] + intro A₁ A₂ hsep hbp₁ hbp₂ + by_contra hlt + push Not at hlt + have hsep_le : (A₁.vertexSet ∩ A₂.vertexSet).ncard ≤ π.warpAt Θ := + Nat.lt_succ_iff.mp hlt + obtain ⟨n₀, hn₀, Γ', hind⟩ := + (indentedBorderPainting_props h𝒯 π htrue hred hwarp hθ + hΘ hc₀ hc₀_Θ hne htc₀).1 hno_int + obtain ⟨c_star, hc_star, hn₀_tc_star⟩ := hnode_cell n₀ hn₀.1 + have hn₀_in_c_star : π.nodeVertex n₀ ∈ (π.cellGraph c_star).vertexSet := + π.p2 c_star hc_star n₀ ⟨hn₀_tc_star, hdom ▸ hn₀.1⟩ + have hn₀_in_G : π.nodeVertex n₀ ∈ G.vertexSet := + (π.cellGraph_le c_star hc_star).1 hn₀_in_c_star + have hn₀_not_c₀ : π.nodeVertex n₀ ∉ (π.cellGraph c₀).vertexSet := by + rw [internal_nodeVertex_mem_cellGraph_iff π hdom hnode_cell hn₀ hc₀, htc₀] + rintro (rfl | rfl) + · exact hn₀.2 hn₁_bd.2 + · exact hn₀.2 hn₂_bd.2 + let A₁' := addVertexSubhypergraph A₁ (π.nodeVertex n₀) + let A₂' := addVertexSubhypergraph A₂ (π.nodeVertex n₀) + have hA₁_le_G : A₁ ≤ G := hsep.left_le.trans (π.cellGraph_le c₀ hc₀) + have hA₂_le_G : A₂ ≤ G := hsep.right_le.trans (π.cellGraph_le c₀ hc₀) + have hA₁'_le : A₁' ≤ G := addVertexSubhypergraph_le hA₁_le_G hn₀_in_G + have hA₂'_le : A₂' ≤ G := addVertexSubhypergraph_le hA₂_le_G hn₀_in_G + have hcells_c₀_V : (π.cellsUnion {c₀}).vertexSet = (π.cellGraph c₀).vertexSet := by + ext x + simp only [Portrayal.cellsUnion, mem_iUnion, mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨c, ⟨hcEq, _⟩, hx⟩ => hcEq ▸ hx, fun hx => ⟨c₀, ⟨rfl, hc₀⟩, hx⟩⟩ + have hcells_c₀_E : (π.cellsUnion {c₀}).edgeSet = (π.cellGraph c₀).edgeSet := by + ext e + simp only [Portrayal.cellsUnion, mem_iUnion, mem_inter_iff, mem_singleton_iff] + exact ⟨fun ⟨c, ⟨hcEq, _⟩, he⟩ => hcEq ▸ he, fun he => ⟨c₀, ⟨rfl, hc₀⟩, he⟩⟩ + have hV_union : (π.cellsUnion {c₀}).vertexSet ⊆ A₁'.vertexSet ∪ A₂'.vertexSet := by + rw [hcells_c₀_V, ← hsep.vertexSet_union] + rintro x (hx₁ | hx₂) + · exact Or.inl (Or.inl hx₁) + · exact Or.inr (Or.inl hx₂) + have hV_sub : A₁'.vertexSet ∪ A₂'.vertexSet ⊆ + (π.cellsUnion {c₀}).vertexSet ∪ {π.nodeVertex n₀} := by + rw [hcells_c₀_V] + rintro x ((hx₁ | rfl) | (hx₂ | rfl)) + · exact Or.inl (hsep.left_le.1 hx₁) + · exact Or.inr rfl + · exact Or.inl (hsep.right_le.1 hx₂) + · exact Or.inr rfl + have hE_union : A₁'.edgeSet ∪ A₂'.edgeSet = (π.cellsUnion {c₀}).edgeSet := by + rw [hcells_c₀_E] + exact hsep.edgeSet_union + have hE_disj : Disjoint A₁'.edgeSet A₂'.edgeSet := + Set.disjoint_iff_inter_eq_empty.mpr hsep.edgeSet_inter_eq + have hbp₁' : π.borderPlus n₁ ⊆ A₁'.vertexSet := fun x hx => Or.inl (hbp₁ hx) + have hbp₂' : π.borderPlus n₂ ⊆ A₂'.vertexSet := fun x hx => Or.inl (hbp₂ hx) + have hn₀_mem_inter : π.nodeVertex n₀ ∈ A₁'.vertexSet ∩ A₂'.vertexSet := + ⟨Or.inr rfl, Or.inr rfl⟩ + have hinter_sdiff : (A₁'.vertexSet ∩ A₂'.vertexSet) \ {π.nodeVertex n₀} = + A₁.vertexSet ∩ A₂.vertexSet := by + ext x + simp only [A₁', A₂', addVertexSubhypergraph, mem_sdiff, mem_inter_iff, mem_union, + mem_singleton_iff] + constructor + · rintro ⟨⟨hx₁ | hEq₁, hx₂ | hEq₂⟩, hne₀⟩ + · exact ⟨hx₁, hx₂⟩ + · exact (hne₀ hEq₂).elim + · exact (hne₀ hEq₁).elim + · exact (hne₀ hEq₁).elim + · rintro ⟨hx₁, hx₂⟩ + exact ⟨⟨Or.inl hx₁, Or.inl hx₂⟩, fun hEq => hn₀_not_c₀ (hEq ▸ hsep.left_le.1 hx₁)⟩ + have hbs_sub : (A₁'.vertexSet ∩ A₂'.vertexSet) \ {π.nodeVertex n₀} ⊆ + (π.cellGraph c₀).vertexSet := by + rw [hinter_sdiff] + exact inter_subset_left.trans hsep.left_le.1 + have hbs_star_le : ((A₁'.vertexSet ∩ A₂'.vertexSet) \ {π.nodeVertex n₀}).ncard ≤ + π.warpAt Θ := by + rw [hinter_sdiff] + exact hsep_le + have hsmall_aux : ∀ A : Hypergraph α β, A ≤ π.cellGraph c₀ → + (∀ x ∈ A.vertexSet, (∃ e ∈ (π.cellGraph c₀).edgeSet \ A.edgeSet, + (π.cellGraph c₀).Inc e x) → x ∈ A₁.vertexSet ∩ A₂.vertexSet) → + ∃ B, (addVertexSubhypergraph A (π.nodeVertex n₀), B) ∈ 𝒯 := by + intro A hA_le hA_sep + let A' := addVertexSubhypergraph A (π.nodeVertex n₀) + have hle_union : A' ≤ π.cellGraph c₀ ∪ π.cellGraph c_star := by + refine ⟨?_, hA_le.2.trans subset_union_left, fun e he => ?_⟩ + · rintro x (hxA | rfl) + · exact Or.inl (hA_le.1 hxA) + · exact Or.inr hn₀_in_c_star + · ext x + change (π.cellGraph c₀).Inc e x ∨ (π.cellGraph c_star).Inc e x ↔ A.Inc e x + have he₀ : e ∈ (π.cellGraph c₀).edgeSet := hA_le.2 he + have hinc₀ : (π.cellGraph c₀).Inc e x ↔ A.Inc e x := by + have := congrArg (x ∈ ·) (hA_le.3 e he) + exact this.to_iff + refine ⟨fun h => h.elim hinc₀.mp (fun h_star => ?_), fun h => Or.inl (hinc₀.mpr h)⟩ + have he_star : e ∈ (π.cellGraph c_star).edgeSet := + (π.cellGraph c_star).edge_mem_of_inc h_star + have hc₀_ne_star : c₀ ≠ c_star := fun hEq => + hn₀_not_c₀ (hEq ▸ hn₀_in_c_star) + exact (Set.disjoint_left.mp (π.p1_disjoint c₀ hc₀ c_star hc_star hc₀_ne_star) + he₀ he_star).elim + have hatt_sub : attachments G A' ⊆ + (π.borderPlus n₁ ∪ π.borderPlus n₂) ∪ (A₁.vertexSet ∩ A₂.vertexSet) ∪ + {π.nodeVertex n₀} := by + rintro x ⟨hxA | rfl, e, ⟨heG, he_not_A⟩, hinc⟩ + · by_cases he₀ : e ∈ (π.cellGraph c₀).edgeSet + · have hinc₀ : (π.cellGraph c₀).Inc e x := + (inc_iff_of_le (π.cellGraph_le c₀ hc₀) he₀).2 hinc + exact Or.inl (Or.inr (hA_sep x hxA ⟨e, ⟨he₀, he_not_A⟩, hinc₀⟩)) + · have hx_att₀ : x ∈ attachments G (π.cellGraph c₀) := + ⟨hA_le.1 hxA, e, ⟨heG, he₀⟩, hinc⟩ + have hx_ov := π.attachments_cellGraph_subset_otherVertices hc₀ hx_att₀ + rcases hx_ov.2 with ⟨d, hd, hdc₀, hxd⟩ + exact Or.inl (Or.inl (border_cell_vertex_mem_borderPlus_of_mem_other π + hc₀ hbd₀ htc₀ hx_ov.1 hd hdc₀ hxd)) + · exact Or.inr rfl + have hbp₁_fin : (π.borderPlus n₁).Finite := + (π.cellGraph c₀).vertexSet_finite.subset hbp₁_sub + have hbp₂_fin : (π.borderPlus n₂).Finite := + (π.cellGraph c₀).vertexSet_finite.subset hbp₂_sub + have hinter_fin : (A₁.vertexSet ∩ A₂.vertexSet).Finite := + A₁.vertexSet_finite.subset inter_subset_left + have hfin_rhs : (((π.borderPlus n₁ ∪ π.borderPlus n₂) ∪ + (A₁.vertexSet ∩ A₂.vertexSet)) ∪ {π.nodeVertex n₀}).Finite := + ((hbp₁_fin.union hbp₂_fin).union hinter_fin).union (finite_singleton _) + have hcard_att : (attachments G A').ncard < θ := by + have h1 := ncard_le_ncard hatt_sub hfin_rhs + have h2 := ncard_union_le ((π.borderPlus n₁ ∪ π.borderPlus n₂) ∪ + (A₁.vertexSet ∩ A₂.vertexSet)) {π.nodeVertex n₀} + have h3 := ncard_union_le (π.borderPlus n₁ ∪ π.borderPlus n₂) + (A₁.vertexSet ∩ A₂.vertexSet) + have h4 := ncard_union_le (π.borderPlus n₁) (π.borderPlus n₂) + have h5 := ncard_singleton (π.nodeVertex n₀) + have hbp₁_c := ncard_borderPlus_le_warpAt_succ π hΘ hn₁_Θ + have hbp₂_c := ncard_borderPlus_le_warpAt_succ π hΘ hn₂_Θ + have hw_le : π.warpAt Θ ≤ p := (π.warpAt_le_warp hΘ).trans hwarp + omega + exact theorem_4_1_ii h𝒯 (htrue.1 c₀ hc₀) (htrue.1 c_star hc_star) hle_union hcard_att + have hsmall₁ : ∃ B, (A₁', B) ∈ 𝒯 := by + exact edgeless_linkage_side_is_small (α := α) (β := β) (G := G) (𝒯 := 𝒯) π (c₀ := c₀) A₁ A₂ + hsep n₀ hsmall_aux + have hsmall₂ : ∃ B, (A₂', B) ∈ 𝒯 := by + exact indented_cell_union_is_small (α := α) (β := β) (G := G) (𝒯 := 𝒯) π (c₀ := c₀) A₁ A₂ hsep + n₀ hsmall_aux + have hinter_fin' : (A₁'.vertexSet ∩ A₂'.vertexSet).Finite := + A₁'.vertexSet_finite.subset inter_subset_left + have hlp₁ : (π.borderPlus n₁).ncard = π.warpAt Θ + 1 → + (A₁'.vertexSet ∩ A₂'.vertexSet).ncard = π.warpAt Θ + 1 → + Portrayal.LinkagePairs A₁'.skeleton (π.borderPlus n₁) (A₁'.vertexSet ∩ A₂'.vertexSet) + (π.warpAt Θ + 1) (π.nodeVertex n₁) (π.nodeVertex n₀) := by + intro _ hcard₂ P hdisj + obtain ⟨i₀, hi₀_last⟩ := exists_last_eq_of_ncard_le hinter_fin' hcard₂.le P hdisj + hn₀_mem_inter + have hn₀_not_A₁ : π.nodeVertex n₀ ∉ A₁.vertexSet := + fun h => hn₀_not_c₀ (hsep.left_le.1 h) + have hn₀_sup : π.nodeVertex n₀ ∈ (P i₀).walk.support := + hi₀_last ▸ (P i₀).walk.end_mem_support + obtain ⟨hfirst, _⟩ := + first_eq_last_of_mem_walk_not_mem_vertexSet A₁ hn₀_not_A₁ (P i₀).walk hn₀_sup + exfalso + exact hn₀_not_c₀ (hbp₁_sub (hfirst ▸ (P i₀).first_mem)) + have hlp₂ : (π.borderPlus n₂).ncard = π.warpAt Θ + 1 → + (A₁'.vertexSet ∩ A₂'.vertexSet).ncard = π.warpAt Θ + 1 → + Portrayal.LinkagePairs A₂'.skeleton (π.borderPlus n₂) (A₁'.vertexSet ∩ A₂'.vertexSet) + (π.warpAt Θ + 1) (π.nodeVertex n₂) (π.nodeVertex n₀) := by + exact decreased_warp_second_linkage (α := α) (β := β) (G := G) π (Θ := Θ) (c₀ := c₀) (n₂ := + n₂) hbp₂_sub A₁ A₂ hsep n₀ hn₀_not_c₀ A₁' hn₀_mem_inter hinter_fin' + exact not_indentedPortrayal π htrue hdom hnode_cell hΘ hc₀ hc₀_Θ hne htc₀ hn₀ + (mem_singleton c₀) (singleton_subset_iff.mpr hc₀) (fun c hc => Or.inl hc) hind + hA₁'_le hA₂'_le hV_union hV_sub hE_union hE_disj hbp₁' hbp₂' hn₀_mem_inter + hbs_sub hsmall₁ hsmall₂ hbs₁_le hbs₂_le hbs_star_le hlp₁ hlp₂ + +/-- **Graph Minors XVII, (9.3)** (page 184): +"Let $c_0$ be a cell bordering a cuff $\Theta$ with $\tilde{c}_0 = \{n_1, n_2\}$, and let +$\pi$ have warp $q$ at $\Theta$. Suppose that there is no internal cell $c$ with +$\tilde{c}_0 \subseteq \tilde{c}$. Then there are $q + 1$ mutually vertex-disjoint paths of +$\alpha(c_0)$ from $\beta(n_1 +)$ to $\beta(n_2 +)$, and in particular $|\beta(n_i)| = q$ +$(i = 1, 2)$." -/ +theorem theorem_9_3_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {Θ c₀ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (hc₀ : c₀ ∈ π.Γ.C) (hc₀_Θ : (c₀ ∩ Θ).Nonempty) + {n₁ n₂ : π.S} (hn₁_tc : n₁ ∈ tilde c₀) (hn₂_tc : n₂ ∈ tilde c₀) (hne : n₁ ≠ n₂) + (hno_int : ¬ ∃ c ∈ π.Γ.C, ¬ (c ∩ bd π.S).Nonempty ∧ tilde c₀ ⊆ tilde c) : + HasDisjointPaths (π.cellGraph c₀).skeleton (π.borderPlus n₁) (π.borderPlus n₂) + (π.warpAt Θ + 1) ∧ + (π.borderSet n₁).ncard = π.warpAt Θ ∧ + (π.borderSet n₂).ncard = π.warpAt Θ := by + have : T2Space π.S := π.isSurface.2.1 + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof + h𝒯 π htrue hred hwarp hθ + obtain ⟨_, _, hnode_cell⟩ := + theorem_8_2_proof + h𝒯 π htrue hred hwarp hθ + have hsub_cuff₀ := π.Γ.border_cell_subset_cuff hc₀ hΘ hc₀_Θ + have hbd₀ : (c₀ ∩ bd π.S).Nonempty := hsub_cuff₀.2.1 ▸ hc₀_Θ + obtain ⟨u₀, v₀, huv_ne, htc₀_uv, hL₀, hL₀_int, _, _⟩ := π.Γ.border_cell_exists_ends hc₀ hbd₀ + have htc₀ : tilde c₀ = {n₁, n₂} := by + refine (eq_of_subset_of_ncard_le ?_ ?_ (π.Γ.finite_tilde_cell hc₀)).symm + · rintro x (rfl | rfl) <;> assumption + · rw [htc₀_uv, ncard_pair huv_ne, ncard_pair hne] + have hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ := hsub_cuff₀.2.2.2.1 hn₁_tc + have hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ := hsub_cuff₀.2.2.2.1 hn₂_tc + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S := ⟨hn₁_Θ.1, hΘ_bd hn₁_Θ.2⟩ + have hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S := ⟨hn₂_Θ.1, hΘ_bd hn₂_Θ.2⟩ + have hbp₁_sub : π.borderPlus n₁ ⊆ (π.cellGraph c₀).vertexSet := + π.borderPlus_subset_cellGraph hc₀ hbd₀ hn₁_tc + have hbp₂_sub : π.borderPlus n₂ ⊆ (π.cellGraph c₀).vertexSet := + π.borderPlus_subset_cellGraph hc₀ hbd₀ hn₂_tc + have hcw₀ : π.CellWarpLE c₀ (π.warpAt Θ) := + (π.cellWarp_le_iff hc₀ hbd₀).mp (π.cellWarp_le_warpAt hc₀ hc₀_Θ) + obtain ⟨hbs₁_le, hbs₂_le, hlinkage⟩ := hcw₀ n₁ hn₁_tc n₂ hn₂_tc hne + have hpaths : HasDisjointPaths (π.cellGraph c₀).skeleton (π.borderPlus n₁) (π.borderPlus n₂) + (π.warpAt Θ + 1) := by + exact cell_linkage_from_warp (α := α) (β := β) (G := G) (𝒯 := 𝒯) (θ := θ) (p := p) h𝒯 π htrue + hred hwarp hθ (Θ := Θ) (c₀ := c₀) hΘ hc₀ hc₀_Θ (n₁ := n₁) (n₂ := n₂) hn₁_tc hn₂_tc hne + hno_int hdom hnode_cell hbd₀ htc₀ hn₁_Θ hn₂_Θ hn₁_bd hn₂_bd hbp₁_sub hbp₂_sub hbs₁_le + hbs₂_le hlinkage + refine ⟨hpaths, ?_, ?_⟩ + · rcases hpaths with ⟨P, hdisj⟩ + have hbp₁_fin : (π.borderPlus n₁).Finite := + (π.cellGraph c₀).vertexSet_finite.subset hbp₁_sub + have hge := le_ncard_of_disjoint_paths_first hbp₁_fin P hdisj + have hle := π.ncard_borderPlus_le hn₁_bd + omega + · rcases hpaths with ⟨P, hdisj⟩ + have hbp₂_fin : (π.borderPlus n₂).Finite := + (π.cellGraph c₀).vertexSet_finite.subset hbp₂_sub + have hge := le_ncard_of_disjoint_paths_last hbp₂_fin P hdisj + have hle := π.ncard_borderPlus_le hn₂_bd + omega + +private theorem linkage_crosses_to_third_node + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} + {n₁ : π.S} + (hn₁ : n₁ ∈ π.Γ.N ∩ Θ) + (hdom : π.domγ = π.Γ.N) + (c₀ : Set π.S) + (n₂ : π.S) + (hc₀ : c₀ ∈ π.Γ.C) + (hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ) + (c₃ : Set π.S) + (hc₃ : c₃ ∈ π.Γ.C) + (hint₃ : ¬(c₃ ∩ bd π.S).Nonempty) + (hc₀_ne_c₃ : c₀ ≠ c₃) + (n₃ : π.S) + (hn₁_ne_n₃ : n₁ ≠ n₃) + (htc₃ : tilde c₃ = {n₁, n₂, n₃}) + (hn₃_N : n₃ ∈ π.Γ.N) + (hbp₂_sub_c₀ : π.borderPlus n₂ ⊆ (π.cellGraph c₀).vertexSet) + (hn₃_in_c₃ : π.nodeVertex n₃ ∈ (π.cellGraph c₃).vertexSet) + (hn₃_not_c₀ : π.nodeVertex n₃ ∉ (π.cellGraph c₀).vertexSet) + (hA₂'_eq : (π.cellsUnion {c₀, c₃}) = π.cellGraph c₀ ∪ π.cellGraph c₃) + (A₁' : Hypergraph α β) + (hinter_eq : A₁'.vertexSet ∩ (π.cellsUnion {c₀, c₃}).vertexSet = π.borderPlus n₁ ∪ + {π.nodeVertex n₃}) + (hn₃_mem_inter : π.nodeVertex n₃ ∈ A₁'.vertexSet ∩ (π.cellsUnion {c₀, c₃}).vertexSet) + (hbp₂_fin : (π.borderPlus n₂).Finite) + (hinter_fin' : (A₁'.vertexSet ∩ (π.cellsUnion {c₀, c₃}).vertexSet).Finite) : + (π.borderPlus n₂).ncard = π.warpAt Θ + 1 → (A₁'.vertexSet ∩ (π.cellsUnion {c₀, + c₃}).vertexSet).ncard = π.warpAt Θ + 1 → Portrayal.LinkagePairs (π.cellsUnion {c₀, + c₃}).skeleton (π.borderPlus n₂) (A₁'.vertexSet ∩ (π.cellsUnion {c₀, c₃}).vertexSet) + (π.warpAt Θ + 1) (π.nodeVertex n₂) (π.nodeVertex n₃) := by + let A₂' := π.cellsUnion {c₀, c₃} + intro hbp₂_eq hcard₂ P hdisj + have hn₁_mem_inter : π.nodeVertex n₁ ∈ A₁'.vertexSet ∩ A₂'.vertexSet := + hinter_eq ▸ Or.inl (Or.inr ⟨hdom ▸ hn₁.1, rfl⟩) + have hn₂_mem_bp₂ : π.nodeVertex n₂ ∈ π.borderPlus n₂ := + Or.inr ⟨hdom ▸ hn₂_Θ.1, rfl⟩ + obtain ⟨i₀, hi₀_last⟩ := exists_last_eq_of_ncard_le hinter_fin' hcard₂.le P hdisj hn₃_mem_inter + obtain ⟨i₁, hi₁_last⟩ := exists_last_eq_of_ncard_le hinter_fin' hcard₂.le P hdisj hn₁_mem_inter + obtain ⟨i₂, hi₂_first⟩ := exists_first_eq_of_ncard_le hbp₂_fin hbp₂_eq.le P hdisj hn₂_mem_bp₂ + have hi₀_ne_i₁ : i₀ ≠ i₁ := by + intro hEq + have hv_eq : π.nodeVertex n₃ = π.nodeVertex n₁ := + hi₀_last.symm.trans (hEq ▸ hi₁_last) + exact hn₁_ne_n₃ (π.nodeVertex_injOn (hdom ▸ hn₁.1) (hdom ▸ hn₃_N) hv_eq.symm) + refine ⟨i₀, ?_, hi₀_last⟩ + by_contra hfirst_ne + have hi₀_ne_i₂ : i₀ ≠ i₂ := fun hEq => hfirst_ne (hEq ▸ hi₂_first) + have hsep_A₂' : A₂'.IsSeparation (π.cellGraph c₀) (π.cellGraph c₃) := by + have hle₀ : π.cellGraph c₀ ≤ A₂' := by + change _ ≤ π.cellsUnion {c₀, c₃} + rw [hA₂'_eq] + refine ⟨subset_union_left, subset_union_left, fun e he => ?_⟩ + ext x + exact ⟨fun hx => hx.elim id (fun hx₃ => (Set.disjoint_left.mp + (π.p1_disjoint c₀ hc₀ c₃ hc₃ hc₀_ne_c₃) he + ((π.cellGraph c₃).edge_mem_of_inc hx₃)).elim), + fun hx => Or.inl hx⟩ + have hle₃ : π.cellGraph c₃ ≤ A₂' := by + change _ ≤ π.cellsUnion {c₀, c₃} + rw [hA₂'_eq] + refine ⟨subset_union_right, subset_union_right, fun e he => ?_⟩ + ext x + exact ⟨fun hx => hx.elim (fun hx₀ => (Set.disjoint_left.mp + (π.p1_disjoint c₀ hc₀ c₃ hc₃ hc₀_ne_c₃) + ((π.cellGraph c₀).edge_mem_of_inc hx₀) he).elim) id, + fun hx => Or.inr hx⟩ + exact ⟨hle₀, hle₃, hA₂'_eq.symm, + Set.disjoint_iff_inter_eq_empty.mp (π.p1_disjoint c₀ hc₀ c₃ hc₃ hc₀_ne_c₃)⟩ + have hfirst_c₀ : (P i₀).first ∈ (π.cellGraph c₀).vertexSet := + hbp₂_sub_c₀ (P i₀).first_mem + have hlast_c₃ : (P i₀).last ∈ (π.cellGraph c₃).vertexSet := + hi₀_last ▸ hn₃_in_c₃ + obtain ⟨z, hz_sup, hz_c₀, hz_c₃⟩ := + walk_meets_separation hsep_A₂' (P i₀).walk hfirst_c₀ hlast_c₃ + obtain ⟨m, ⟨hm_tc₃, _⟩, rfl⟩ := + π.p5 c₃ hc₃ hint₃ z hz_c₃ ⟨c₀, hc₀, hc₀_ne_c₃, hz_c₀⟩ + rw [htc₃] at hm_tc₃ + rcases hm_tc₃ with hEq | hEq | hEq + · rw [hEq] at hz_sup + have hz_i₁ : π.nodeVertex n₁ ∈ (P i₁).walk.support := + hi₁_last ▸ (P i₁).walk.end_mem_support + exact Set.disjoint_left.mp (hdisj hi₀_ne_i₁) hz_sup hz_i₁ + · rw [hEq] at hz_sup + have hz_i₂ : π.nodeVertex n₂ ∈ (P i₂).walk.support := + hi₂_first ▸ (P i₂).walk.start_mem_support + exact Set.disjoint_left.mp (hdisj hi₀_ne_i₂) hz_sup hz_i₂ + · rw [hEq] at hz_c₀ + exact hn₃_not_c₀ hz_c₀ + +private theorem third_node_of_indented_cell_is_internal + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {θ : ℕ} + {p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) + (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {Θ : Set π.S} + {n₁ : π.S} + (hn₁ : n₁ ∈ π.Γ.N ∩ Θ) + (hbs₁_le : (π.borderSet n₁).ncard ≤ π.warpAt Θ) + (hlt_bs₁ : (π.borderSet n₁).ncard < π.warpAt Θ) + (k : ℕ) + (E : π.Γ.CuffEnumeration Θ k) + (idx : Fin k) + (hidx_eq : E.node idx = n₁) + (c₀ : Set π.S) + (n₂ : π.S) + (htc₀ : tilde c₀ = {n₁, n₂}) + (hne₁₂ : n₁ ≠ n₂) + (hn₁_tc₀ : n₁ ∈ tilde c₀) + (hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S) + (hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S) + (c₃ : Set π.S) + (hc₃ : c₃ ∈ π.Γ.C) + (hint₃ : ¬(c₃ ∩ bd π.S).Nonempty) + (hcard₃ : (tilde c₃).ncard = 3) + (htc₃_fin : (tilde c₃).Finite) + (n₃ : π.S) + (hn₃_tc₃ : n₃ ∈ tilde c₃) + (hn₃_not_pair : ¬n₃ = n₁ ∧ ¬n₃ = n₂) + (hn₁_ne_n₃ : n₁ ≠ n₃) + (hn₂_ne_n₃ : n₂ ≠ n₃) + (htc₃ : tilde c₃ = {n₁, n₂, n₃}) + (hn₃_N : n₃ ∈ π.Γ.N) : + n₃ ∉ bd π.S := by + intro hn₃_bd + have hsub_cl : ({n₁, n₂, n₃} : Set π.S) ⊆ closure c₃ ∩ bd π.S := by + rw [Painting.closure_cell_inter_bd_eq_tilde_inter_bd hint₃, htc₃] + rintro x (rfl | rfl | rfl) + · exact ⟨Or.inl rfl, hn₁_bd.2⟩ + · exact ⟨Or.inr (Or.inl rfl), hn₂_bd.2⟩ + · exact ⟨Or.inr (Or.inr rfl), hn₃_bd⟩ + have hcl_fin : (closure c₃ ∩ bd π.S).Finite := by + rw [Painting.closure_cell_inter_bd_eq_tilde_inter_bd hint₃] + exact htc₃_fin.inter_of_left _ + have h3_card : ({n₁, n₂, n₃} : Set π.S).ncard = 3 := by rw [← htc₃, hcard₃] + have hge3 : 3 ≤ (closure c₃ ∩ bd π.S).ncard := by + rw [← h3_card] + exact ncard_le_ncard hsub_cl hcl_fin + have hle2 := (theorem_8_6_proof h𝒯 π htrue hred hwarp hθ hc₃ hint₃).1 + omega + +private theorem two_cell_union_eq + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + (c₀ : Set π.S) + (hc₀ : c₀ ∈ π.Γ.C) + (c₃ : Set π.S) + (hc₃ : c₃ ∈ π.Γ.C) + (hA₂'_le : (π.cellsUnion {c₀, c₃}) ≤ G) : + (π.cellsUnion {c₀, c₃}) = π.cellGraph c₀ ∪ π.cellGraph c₃ := by + let A₂' := π.cellsUnion {c₀, c₃} + apply eq_of_le_of_vertexSet_eq_of_edgeSet_eq hA₂'_le + (union_le (π.cellGraph_le c₀ hc₀) (π.cellGraph_le c₃ hc₃)) + · ext v + simp only [Portrayal.cellsUnion, union_vertexSet, mem_union, mem_iUnion, + mem_inter_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨c, ⟨hEq | hEq, _⟩, hv⟩ + · exact Or.inl (hEq ▸ hv) + · exact Or.inr (hEq ▸ hv) + · rintro (hv | hv) + · exact ⟨c₀, ⟨Or.inl rfl, hc₀⟩, hv⟩ + · exact ⟨c₃, ⟨Or.inr rfl, hc₃⟩, hv⟩ + · ext e + simp only [Portrayal.cellsUnion, union_edgeSet, mem_union, mem_iUnion, + mem_inter_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨c, ⟨hEq | hEq, _⟩, he⟩ + · exact Or.inl (hEq ▸ he) + · exact Or.inr (hEq ▸ he) + · rintro (he | he) + · exact ⟨c₀, ⟨Or.inl rfl, hc₀⟩, he⟩ + · exact ⟨c₃, ⟨Or.inr rfl, hc₃⟩, he⟩ + +private theorem three_node_cell_has_node_outside_pair + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {n₁ : π.S} + (n₂ : π.S) + (hne₁₂ : n₁ ≠ n₂) + (c₃ : Set π.S) + (hcard₃ : (tilde c₃).ncard = 3) : + (tilde c₃ \ {n₁, n₂}).Nonempty := by + by_contra hempty + have hsub : tilde c₃ ⊆ {n₁, n₂} := sdiff_eq_empty.mp (not_nonempty_iff_eq_empty.mp hempty) + have hle := ncard_le_ncard hsub (finite_singleton n₂ |>.insert n₁) + rw [ncard_pair hne₁₂] at hle + omega + +private theorem three_node_cell_nodes_eq_insert + {α β : Type*} {G : Hypergraph α β} (π : Portrayal G) + {c₀ c₃ : Set π.S} {n₁ n₂ n₃ : π.S} + (hne₁₂ : n₁ ≠ n₂) (hn₁_ne_n₃ : n₁ ≠ n₃) (hn₂_ne_n₃ : n₂ ≠ n₃) + (hn₁_tc₀ : n₁ ∈ tilde c₀) (hn₂_tc₀ : n₂ ∈ tilde c₀) + (htc₀_sub₃ : tilde c₀ ⊆ tilde c₃) (hn₃_tc₃ : n₃ ∈ tilde c₃) + (hcard₃ : (tilde c₃).ncard = 3) (htc₃_fin : (tilde c₃).Finite) : + tilde c₃ = {n₁, n₂, n₃} := by + have hsub : ({n₁, n₂, n₃} : Set π.S) ⊆ tilde c₃ := by + rintro x (rfl | rfl | rfl) + · exact htc₀_sub₃ hn₁_tc₀ + · exact htc₀_sub₃ hn₂_tc₀ + · exact hn₃_tc₃ + have h3_card : ({n₁, n₂, n₃} : Set π.S).ncard = 3 := by + rw [ncard_insert_of_notMem, ncard_pair hn₂_ne_n₃] + simp only [mem_insert_iff, mem_singleton_iff, not_or] + exact ⟨hne₁₂, hn₁_ne_n₃⟩ + exact (eq_of_subset_of_ncard_le hsub (by omega) htc₃_fin).symm + +private theorem enlarged_cell_contains_border_and_third_node + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {n₁ : π.S} + (c₀ : Set π.S) + (c₃ : Set π.S) + (n₃ : π.S) + (hbp₁_sub_c₀ : π.borderPlus n₁ ⊆ (π.cellGraph c₀).vertexSet) + (hn₃_in_c₃ : π.nodeVertex n₃ ∈ (π.cellGraph c₃).vertexSet) + (A₂' : Hypergraph α β) + (hA₂'_eq : A₂' = π.cellGraph c₀ ∪ π.cellGraph c₃) : + π.borderPlus n₁ ∪ {π.nodeVertex n₃} ⊆ A₂'.vertexSet := by + rw [hA₂'_eq] + rintro x (hx₁ | rfl) + · exact Or.inl (hbp₁_sub_c₀ hx₁) + · exact Or.inr hn₃_in_c₃ + +/-- **Graph Minors XVII, (9.4)** (page 185): +"Let $\pi$ have warp $q$ at a cuff $\Theta$; then $|\beta(n)| = q$ for all +$n \in N(\Gamma) \cap \Theta$." +Note: in the printed proof on page 185, the displayed definitions of +$\alpha'(c_1)$ and $\alpha'(c_2)$ are swapped relative to $\tilde{c}_1 = \{n_1, n_3\}$, +$\tilde{c}_2 = \{n_2, n_3\}$ and the verification on page 186; we assign the edgeless hypergraph +on $\beta(n_1+) \cup \{\gamma(n_3)\}$ to $c_1$ and $\alpha(c_0) \cup \alpha(c_3)$ to $c_2$, matching +the verification on page 186. -/ +theorem theorem_9_4_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {Θ : Set π.S} (hΘ : Θ ∈ cuffs π.S) {n₁ : π.S} (hn₁ : n₁ ∈ π.Γ.N ∩ Θ) : + (π.borderSet n₁).ncard = π.warpAt Θ := by + have : T2Space π.S := π.isSurface.2.1 + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof + h𝒯 π htrue hred hwarp hθ + obtain ⟨_, _, hnode_cell⟩ := + theorem_8_2_proof + h𝒯 π htrue hred hwarp hθ + have hΘ_arc : IsOArc Θ := (cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hbs₁_le : (π.borderSet n₁).ncard ≤ π.warpAt Θ := + π.ncard_borderSet_le_warpAt hΘ hΘ_arc hn₁ + refine le_antisymm hbs₁_le ?_ + by_contra hlt_bs₁ + push Not at hlt_bs₁ + set k := (π.Γ.N ∩ Θ).ncard + obtain ⟨E⟩ : Nonempty (π.Γ.CuffEnumeration Θ k) := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + have hn₁_range : n₁ ∈ range E.node := E.range_node ▸ hn₁ + rcases hn₁_range with ⟨idx, hidx_eq⟩ + have hk_ge2 : 2 ≤ k := E.two_le + have hk_pos : 0 < k := by omega + let idx' : Fin k := ⟨(idx.1 + 1) % k, Nat.mod_lt _ hk_pos⟩ + have hidx_ne : idx ≠ idx' := by + intro hEq + have hval : idx.1 = (idx.1 + 1) % k := congrArg Fin.val hEq + have hi_lt : idx.1 < k := idx.2 + by_cases hlast : idx.1 + 1 = k + · rw [hlast, Nat.mod_self] at hval; omega + · rw [Nat.mod_eq_of_lt (by omega)] at hval; omega + let c₀ := E.cell idx + let n₂ := E.node idx' + have hc₀_mem : c₀ ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := E.range_cell ▸ ⟨idx, rfl⟩ + have hc₀ : c₀ ∈ π.Γ.C := hc₀_mem.1 + have hc₀_Θ : (c₀ ∩ Θ).Nonempty := hc₀_mem.2 + have hbd₀ : (c₀ ∩ bd π.S).Nonempty := hc₀_Θ.mono (inter_subset_inter_right _ hΘ_bd) + have htc₀ : tilde c₀ = {n₁, n₂} := by + change tilde (E.cell idx) = {n₁, E.node idx'} + rw [E.cell_tilde idx, hidx_eq] + have hne₁₂ : n₁ ≠ n₂ := by + rw [← hidx_eq] + exact E.injective_node.ne hidx_ne + have hn₁_tc₀ : n₁ ∈ tilde c₀ := htc₀ ▸ Or.inl rfl + have hn₂_tc₀ : n₂ ∈ tilde c₀ := htc₀ ▸ Or.inr rfl + have hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ := E.range_node ▸ ⟨idx', rfl⟩ + have hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S := ⟨hn₁.1, hΘ_bd hn₁.2⟩ + have hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S := ⟨hn₂_Θ.1, hΘ_bd hn₂_Θ.2⟩ + have hbs₂_le : (π.borderSet n₂).ncard ≤ π.warpAt Θ := + π.ncard_borderSet_le_warpAt hΘ hΘ_arc hn₂_Θ + have hex_c₃ : ∃ c ∈ π.Γ.C, ¬ (c ∩ bd π.S).Nonempty ∧ tilde c₀ ⊆ tilde c := by + by_contra hno_int + have h93 := (theorem_9_3_proof h𝒯 π htrue hred hwarp hθ + hΘ hc₀ hc₀_Θ hn₁_tc₀ hn₂_tc₀ hne₁₂ hno_int).2.1 + omega + rcases hex_c₃ with ⟨c₃, hc₃, hint₃, htc₀_sub₃⟩ + have hc₀_ne_c₃ : c₀ ≠ c₃ := fun h => hint₃ (h ▸ hbd₀) + have hcard₃ : (tilde c₃).ncard = 3 := + (theorem_8_8_proof + h𝒯 π htrue hred hwarp hθ hc₀ hc₃ hc₀_ne_c₃ htc₀_sub₃).2 + have htc₃_fin : (tilde c₃).Finite := π.Γ.finite_tilde_cell hc₃ + obtain ⟨n₃, hn₃_tc₃, hn₃_not_pair⟩ := + three_node_cell_has_node_outside_pair π n₂ hne₁₂ c₃ hcard₃ + simp only [mem_insert_iff, mem_singleton_iff, not_or] at hn₃_not_pair + have hn₁_ne_n₃ : n₁ ≠ n₃ := Ne.symm hn₃_not_pair.1 + have hn₂_ne_n₃ : n₂ ≠ n₃ := Ne.symm hn₃_not_pair.2 + have htc₃ : tilde c₃ = {n₁, n₂, n₃} := + three_node_cell_nodes_eq_insert π hne₁₂ hn₁_ne_n₃ hn₂_ne_n₃ hn₁_tc₀ hn₂_tc₀ + htc₀_sub₃ hn₃_tc₃ hcard₃ htc₃_fin + have hn₃_N : n₃ ∈ π.Γ.N := π.Γ.tilde_subset_N hc₃ hn₃_tc₃ + have hn₃_not_bd : n₃ ∉ bd π.S := by + exact third_node_of_indented_cell_is_internal (α := α) (β := β) (G := G) (𝒯 := 𝒯) (θ := θ) (p + := p) h𝒯 π htrue hred hwarp hθ (Θ := Θ) (n₁ := n₁) hn₁ hbs₁_le hlt_bs₁ k E idx hidx_eq + c₀ n₂ htc₀ hne₁₂ hn₁_tc₀ hn₁_bd hn₂_bd c₃ hc₃ hint₃ hcard₃ htc₃_fin n₃ hn₃_tc₃ + hn₃_not_pair hn₁_ne_n₃ hn₂_ne_n₃ htc₃ hn₃_N + have hn₃ : n₃ ∈ π.Γ.N \ bd π.S := ⟨hn₃_N, hn₃_not_bd⟩ + obtain ⟨Γ', hind⟩ := + (indentedBorderPainting_props h𝒯 π htrue hred hwarp hθ + hΘ hc₀ hc₀_Θ hne₁₂ htc₀).2 c₃ hc₃ hint₃ n₃ hn₃ htc₃ + have hbp₁_sub_c₀ : π.borderPlus n₁ ⊆ (π.cellGraph c₀).vertexSet := + π.borderPlus_subset_cellGraph hc₀ hbd₀ hn₁_tc₀ + have hbp₂_sub_c₀ : π.borderPlus n₂ ⊆ (π.cellGraph c₀).vertexSet := + π.borderPlus_subset_cellGraph hc₀ hbd₀ hn₂_tc₀ + have hn₃_in_c₃ : π.nodeVertex n₃ ∈ (π.cellGraph c₃).vertexSet := + π.p2 c₃ hc₃ n₃ ⟨hn₃_tc₃, hdom ▸ hn₃_N⟩ + have hn₃_not_c₀ : π.nodeVertex n₃ ∉ (π.cellGraph c₀).vertexSet := by + rw [internal_nodeVertex_mem_cellGraph_iff π hdom hnode_cell hn₃ hc₀, htc₀] + rintro (hEq | hEq) + · exact hn₁_ne_n₃ hEq.symm + · exact hn₂_ne_n₃ hEq.symm + let A₂' := π.cellsUnion {c₀, c₃} + have hA₂'_le : A₂' ≤ G := π.cellsUnion_le {c₀, c₃} + have hA₂'_eq : A₂' = π.cellGraph c₀ ∪ π.cellGraph c₃ := by + exact two_cell_union_eq (α := α) (β := β) (G := G) π c₀ hc₀ c₃ hc₃ hA₂'_le + have hbp₁_n₃_sub_A₂' : π.borderPlus n₁ ∪ {π.nodeVertex n₃} ⊆ A₂'.vertexSet := by + exact enlarged_cell_contains_border_and_third_node (α := α) (β := β) (G := G) π (n₁ := n₁) c₀ + c₃ n₃ hbp₁_sub_c₀ hn₃_in_c₃ A₂' hA₂'_eq + have hbp₁_n₃_sub_G : π.borderPlus n₁ ∪ {π.nodeVertex n₃} ⊆ G.vertexSet := + hbp₁_n₃_sub_A₂'.trans hA₂'_le.1 + let A₁' := edgelessSubhypergraph G (π.borderPlus n₁ ∪ {π.nodeVertex n₃}) hbp₁_n₃_sub_G + have hA₁'_le : A₁' ≤ G := edgelessSubhypergraph_le G _ hbp₁_n₃_sub_G + have hV_union : (π.cellsUnion {c₀, c₃}).vertexSet ⊆ A₁'.vertexSet ∪ A₂'.vertexSet := + subset_union_right + have hV_sub : A₁'.vertexSet ∪ A₂'.vertexSet ⊆ + (π.cellsUnion {c₀, c₃}).vertexSet ∪ {π.nodeVertex n₃} := + (union_subset hbp₁_n₃_sub_A₂' Subset.rfl).trans subset_union_left + have hE_union : A₁'.edgeSet ∪ A₂'.edgeSet = (π.cellsUnion {c₀, c₃}).edgeSet := + empty_union _ + have hE_disj : Disjoint A₁'.edgeSet A₂'.edgeSet := disjoint_bot_left + have hbp₁' : π.borderPlus n₁ ⊆ A₁'.vertexSet := subset_union_left + have hbp₂' : π.borderPlus n₂ ⊆ A₂'.vertexSet := by + rw [hA₂'_eq] + exact fun x hx => Or.inl (hbp₂_sub_c₀ hx) + have hinter_eq : A₁'.vertexSet ∩ A₂'.vertexSet = π.borderPlus n₁ ∪ {π.nodeVertex n₃} := + inter_eq_left.mpr hbp₁_n₃_sub_A₂' + have hn₃_mem_inter : π.nodeVertex n₃ ∈ A₁'.vertexSet ∩ A₂'.vertexSet := + hinter_eq ▸ Or.inr rfl + have hinter_sdiff : (A₁'.vertexSet ∩ A₂'.vertexSet) \ {π.nodeVertex n₃} = π.borderPlus n₁ := by + rw [hinter_eq, union_sdiff_distrib, sdiff_self, union_empty] + exact sdiff_eq_self_iff_disjoint.mpr (disjoint_singleton_left.mpr + (fun hm => hn₃_not_c₀ (hbp₁_sub_c₀ hm))) + have hbs_sub : (A₁'.vertexSet ∩ A₂'.vertexSet) \ {π.nodeVertex n₃} ⊆ + (π.cellGraph c₀).vertexSet := + hinter_sdiff ▸ hbp₁_sub_c₀ + have hbp₁_le_q : (π.borderPlus n₁).ncard ≤ π.warpAt Θ := by + have hle := π.ncard_borderPlus_le hn₁_bd + omega + have hbs_star_le : ((A₁'.vertexSet ∩ A₂'.vertexSet) \ {π.nodeVertex n₃}).ncard ≤ π.warpAt Θ := + hinter_sdiff ▸ hbp₁_le_q + have hw_le : π.warpAt Θ ≤ p := (π.warpAt_le_warp hΘ).trans hwarp + have hbp₁_fin : (π.borderPlus n₁).Finite := + (π.cellGraph c₀).vertexSet_finite.subset hbp₁_sub_c₀ + have hbp₂_fin : (π.borderPlus n₂).Finite := + (π.cellGraph c₀).vertexSet_finite.subset hbp₂_sub_c₀ + have hsmall₁ : ∃ B, (A₁', B) ∈ 𝒯 := by + have hA₁'_le_union : A₁' ≤ π.cellGraph c₀ ∪ π.cellGraph c₃ := by + rw [← hA₂'_eq] + exact ⟨hbp₁_n₃_sub_A₂', empty_subset _, fun _ he => he.elim⟩ + have hatt_sub : attachments G A₁' ⊆ π.borderPlus n₁ ∪ {π.nodeVertex n₃} := + attachments_subset_vertexSet + have hfin₁ : (π.borderPlus n₁ ∪ {π.nodeVertex n₃}).Finite := + hbp₁_fin.union (finite_singleton _) + have hatt_lt : (attachments G A₁').ncard < θ := by + have h1 := ncard_le_ncard hatt_sub hfin₁ + have h2 := ncard_union_le (π.borderPlus n₁) {π.nodeVertex n₃} + have h3 := ncard_singleton (π.nodeVertex n₃) + omega + exact theorem_4_1_ii h𝒯 (htrue.1 c₀ hc₀) (htrue.1 c₃ hc₃) hA₁'_le_union hatt_lt + have hsmall₂ : ∃ B, (A₂', B) ∈ 𝒯 := by + rw [hA₂'_eq] + have hatt_sub : attachments G (π.cellGraph c₀ ∪ π.cellGraph c₃) ⊆ + (π.borderPlus n₁ ∪ π.borderPlus n₂) ∪ {π.nodeVertex n₃} := by + refine attachments_union_subset.trans ?_ + rintro x (hx₀ | hx₃) + · have hx_ov := π.attachments_cellGraph_subset_otherVertices hc₀ hx₀ + rcases hx_ov.2 with ⟨d, hd, hdc₀, hxd⟩ + exact Or.inl (border_cell_vertex_mem_borderPlus_of_mem_other π hc₀ hbd₀ htc₀ + hx_ov.1 hd hdc₀ hxd) + · have hx_ov := π.attachments_cellGraph_subset_otherVertices hc₃ hx₃ + obtain ⟨m, ⟨hm_tc₃, _⟩, rfl⟩ := π.p5 c₃ hc₃ hint₃ x hx_ov.1 hx_ov.2 + rw [htc₃] at hm_tc₃ + rcases hm_tc₃ with rfl | rfl | rfl + · exact Or.inl (Or.inl (Or.inr ⟨hdom ▸ hn₁.1, rfl⟩)) + · exact Or.inl (Or.inr (Or.inr ⟨hdom ▸ hn₂_Θ.1, rfl⟩)) + · exact Or.inr rfl + have hfin₂ : ((π.borderPlus n₁ ∪ π.borderPlus n₂) ∪ {π.nodeVertex n₃}).Finite := + (hbp₁_fin.union hbp₂_fin).union (finite_singleton _) + have hatt_lt : (attachments G (π.cellGraph c₀ ∪ π.cellGraph c₃)).ncard < θ := by + have h1 := ncard_le_ncard hatt_sub hfin₂ + have h2 := ncard_union_le (π.borderPlus n₁ ∪ π.borderPlus n₂) {π.nodeVertex n₃} + have h3 := ncard_union_le (π.borderPlus n₁) (π.borderPlus n₂) + have h4 := ncard_singleton (π.nodeVertex n₃) + have hbp₂_c := ncard_borderPlus_le_warpAt_succ π hΘ hn₂_Θ + omega + exact theorem_4_1_ii h𝒯 (htrue.1 c₀ hc₀) (htrue.1 c₃ hc₃) le_rfl hatt_lt + have hlp₁ : (π.borderPlus n₁).ncard = π.warpAt Θ + 1 → + (A₁'.vertexSet ∩ A₂'.vertexSet).ncard = π.warpAt Θ + 1 → + Portrayal.LinkagePairs A₁'.skeleton (π.borderPlus n₁) (A₁'.vertexSet ∩ A₂'.vertexSet) + (π.warpAt Θ + 1) (π.nodeVertex n₁) (π.nodeVertex n₃) := by + intro hbp₁_eq + omega + have hinter_fin' : (A₁'.vertexSet ∩ A₂'.vertexSet).Finite := + A₁'.vertexSet_finite.subset inter_subset_left + have hlp₂_bridge : (π.borderPlus n₂).ncard = π.warpAt Θ + 1 → + (A₁'.vertexSet ∩ A₂'.vertexSet).ncard = π.warpAt Θ + 1 → + Portrayal.LinkagePairs A₂'.skeleton (π.borderPlus n₂) (A₁'.vertexSet ∩ A₂'.vertexSet) + (π.warpAt Θ + 1) (π.nodeVertex n₂) (π.nodeVertex n₃) := by + exact linkage_crosses_to_third_node (α := α) (β := β) (G := G) π (Θ := Θ) (n₁ := n₁) hn₁ hdom + c₀ n₂ hc₀ hn₂_Θ c₃ hc₃ hint₃ hc₀_ne_c₃ n₃ hn₁_ne_n₃ htc₃ hn₃_N hbp₂_sub_c₀ hn₃_in_c₃ + hn₃_not_c₀ hA₂'_eq A₁' hinter_eq hn₃_mem_inter hbp₂_fin hinter_fin' + have hR_sub : ({c₀, c₃} : Set (Set π.S)) ⊆ π.Γ.C := by + rintro c (rfl | rfl) <;> assumption + have hR_cases : ∀ c ∈ ({c₀, c₃} : Set (Set π.S)), + c = c₀ ∨ (¬ (c ∩ bd π.S).Nonempty ∧ tilde c = {n₁, n₂, n₃}) := by + rintro c (rfl | rfl) + · exact Or.inl rfl + · exact Or.inr ⟨hint₃, htc₃⟩ + exact not_indentedPortrayal π htrue hdom hnode_cell hΘ hc₀ hc₀_Θ hne₁₂ htc₀ hn₃ + (Or.inl rfl) hR_sub hR_cases hind hA₁'_le hA₂'_le hV_union hV_sub hE_union hE_disj + hbp₁' hbp₂' hn₃_mem_inter hbs_sub hsmall₁ hsmall₂ hbs₁_le hbs₂_le hbs_star_le hlp₁ hlp₂_bridge + +private theorem other_cell_vertices_on_boundary + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} + {c₀ : Set π.S} + (hΘ : Θ ∈ cuffs π.S) + (hc₀ : c₀ ∈ π.Γ.C) + (hc₀_Θ : (c₀ ∩ Θ).Nonempty) + {n₁ : π.S} + {n₂ : π.S} + (hn₁_tc : n₁ ∈ tilde c₀) + (hne : n₁ ≠ n₂) + (hdom : π.domγ = π.Γ.N) + (hsub_cuff₀ : closure c₀ ∩ bd π.S ⊆ Θ ∧ c₀ ∩ bd π.S = c₀ ∩ Θ ∧ closure c₀ ∩ bd π.S = closure + c₀ ∩ Θ ∧ tilde c₀ ⊆ π.Γ.N ∩ Θ ∧ ∀ Θ' ∈ cuffs π.S, (c₀ ∩ Θ').Nonempty → Θ' = Θ) + (hbd₀ : (c₀ ∩ bd π.S).Nonempty) + (htc₀ : tilde c₀ = {n₁, n₂}) + (hΘ_bd : Θ ⊆ bd π.S) + (hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ) + (hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ) + (hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S) + (hbs₁_sub : π.borderSet n₁ ⊆ (π.cellGraph c₀).vertexSet) + (hn₁_in_c₀ : π.nodeVertex n₁ ∈ (π.cellGraph c₀).vertexSet) + (A₁ : Hypergraph α β) + (A₂ : Hypergraph α β) + (hA₁_sub : π.borderSet n₁ ∪ {π.nodeVertex n₁} ⊆ A₁.vertexSet) + (hA₂_sub : π.borderPlus n₂ ∪ {π.nodeVertex n₁} ⊆ A₂.vertexSet) + (hlt_q : ((A₁ ∩ A₂).vertexSet \ {π.nodeVertex n₁}).ncard < π.warpAt Θ) + (hbp₁_A₁ : π.borderPlus n₁ ⊆ A₁.vertexSet) + (hn₁_mem_inter : π.nodeVertex n₁ ∈ A₁.vertexSet ∩ A₂.vertexSet) + (c₁ : Set π.S) + (hc₁_Θ : (c₁ ∩ Θ).Nonempty) + (n₃ : π.S) + (hne₁₃ : n₁ ≠ n₃) + (htc₁ : tilde c₁ = {n₁, n₃}) + (hd_iff : ∀ d ∈ π.Γ.C, (d ∩ bd π.S).Nonempty → (n₁ ∈ tilde d ↔ d = c₀ ∨ d = c₁)) + (hneighbors : ∀ m ∈ π.Γ.N ∩ Θ, m ≠ n₁ → ∀ v ∈ π.borderPlus n₁, v ∈ π.borderPlus m → v ∈ + π.borderPlus n₂ ∨ v ∈ π.borderPlus n₃) + (hsub_cuff₁ : closure c₁ ∩ bd π.S ⊆ Θ ∧ c₁ ∩ bd π.S = c₁ ∩ Θ ∧ closure c₁ ∩ bd π.S = closure + c₁ ∩ Θ ∧ tilde c₁ ⊆ π.Γ.N ∩ Θ ∧ ∀ Θ' ∈ cuffs π.S, (c₁ ∩ Θ').Nonempty → Θ' = Θ) + (hn₁_tc₁ : n₁ ∈ tilde c₁) + (hn₃_Θ : n₃ ∈ π.Γ.N ∩ Θ) + (bs' : π.S → Set α) + (bp' : π.S → Set α) + (hbs'_n₁ : bs' n₁ = (A₁.vertexSet ∩ A₂.vertexSet) \ {π.nodeVertex n₁}) + (hbs'_other : ∀ (n : π.S), n ≠ n₁ → bs' n = π.borderSet n) + (hbp'_n₁ : bp' n₁ = A₁.vertexSet ∩ A₂.vertexSet) + (hbp'_other : ∀ (n : π.S), n ≠ n₁ → bp' n = π.borderPlus n) : + ∀ w ∈ (π.cellGraph c₀).vertexSet, ∀ d ∈ π.Γ.C \ {c₀, c₁}, w ∈ (π.cellGraph d).vertexSet → w ∈ + bp' n₁ ∨ w ∈ π.borderPlus n₂ ∨ w ∈ π.borderPlus n₃ := by + rintro w hw₀ d ⟨hd, hd_not⟩ hwd + have hd_ne_c₀ : d ≠ c₀ := fun h => hd_not (Or.inl h) + have hd_ne_c₁ : d ≠ c₁ := fun h => hd_not (Or.inr h) + rcases border_cell_vertex_mem_borderPlus_of_mem_other π hc₀ hbd₀ htc₀ hw₀ hd hd_ne_c₀ hwd with + hw_n₁ | hw_n₂ + · by_cases hbd_d : (d ∩ bd π.S).Nonempty + · obtain ⟨m, hm_td, hwm⟩ := π.p6 d hd hbd_d w hwd ⟨c₀, hc₀, hd_ne_c₀.symm, hw₀⟩ + have hm_ne_n₁ : m ≠ n₁ := fun h => + hd_not ((hd_iff d hd hbd_d).mp (h ▸ hm_td)) + have hmN : m ∈ π.Γ.N := π.Γ.tilde_subset_N hd hm_td + have hmbd : m ∈ bd π.S := tilde_border_cell_subset_bd π.Γ hd hbd_d hm_td + let Θ' := connectedComponentIn (bd π.S) m + have hΘ' : Θ' ∈ cuffs π.S := ⟨m, hmbd, rfl⟩ + have hm_Θ' : m ∈ π.Γ.N ∩ Θ' := ⟨hmN, mem_connectedComponentIn hmbd⟩ + have hΘ'_eq : Θ' = Θ := by + by_contra hne_Θ + rcases hw_n₁ with hbs₁ | ⟨_, rfl⟩ + · rcases hwm with hbs_m | ⟨_, rfl⟩ + · exact Set.disjoint_left.mp + (π.p4_disjoint Θ hΘ Θ' hΘ' (Ne.symm hne_Θ) n₁ hn₁_Θ m hm_Θ') hbs₁ hbs_m + · have hm_not_Θ : m ∉ Θ := by + intro hm_in_Θ + rcases hΘ with ⟨x₀, _, rfl⟩ + exact hne_Θ ((connectedComponentIn_eq hm_Θ'.2).trans + (connectedComponentIn_eq hm_in_Θ).symm) + exact π.p4_notMem Θ hΘ n₁ hn₁_Θ m (hdom ▸ hmN) hm_not_Θ hbs₁ + · rcases hwm with hbs_m | ⟨_, hEq⟩ + · have hn₁_not_Θ' : n₁ ∉ Θ' := by + intro hn₁_in_Θ' + rcases hΘ with ⟨x₀, _, rfl⟩ + exact hne_Θ ((connectedComponentIn_eq hn₁_in_Θ').trans + (connectedComponentIn_eq hn₁_Θ.2).symm) + exact π.p4_notMem Θ' hΘ' m hm_Θ' n₁ (hdom ▸ hn₁_Θ.1) hn₁_not_Θ' hbs_m + · exact hm_ne_n₁ (π.nodeVertex_injOn (hdom ▸ hmN) (hdom ▸ hn₁_Θ.1) hEq.symm) + have hm_Θ : m ∈ π.Γ.N ∩ Θ := hΘ'_eq ▸ hm_Θ' + rcases hneighbors m hm_Θ hm_ne_n₁ w hw_n₁ hwm with hw_n₂ | hw_n₃ + · exact Or.inr (Or.inl hw_n₂) + · exact Or.inr (Or.inr hw_n₃) + · obtain ⟨m, ⟨hm_td, hm_dom⟩, rfl⟩ := + π.p5 d hd hbd_d w hwd ⟨c₀, hc₀, hd_ne_c₀.symm, hw₀⟩ + by_cases hm_n₁ : m = n₁ + · subst hm_n₁ + exact Or.inl (hbp'_n₁ ▸ hn₁_mem_inter) + · have hm_Θ_mem : m ∈ Θ := by + by_contra hm_not_Θ + rcases hw_n₁ with hbs₁ | ⟨_, hEq⟩ + · exact π.p4_notMem Θ hΘ n₁ hn₁_Θ m hm_dom hm_not_Θ hbs₁ + · exact hm_n₁ (π.nodeVertex_injOn hm_dom (hdom ▸ hn₁_Θ.1) hEq) + have hm_Θ : m ∈ π.Γ.N ∩ Θ := ⟨hdom ▸ hm_dom, hm_Θ_mem⟩ + have hwm : π.nodeVertex m ∈ π.borderPlus m := Or.inr ⟨hm_dom, rfl⟩ + rcases hneighbors m hm_Θ hm_n₁ (π.nodeVertex m) hw_n₁ hwm with hw_n₂ | hw_n₃ + · exact Or.inr (Or.inl hw_n₂) + · exact Or.inr (Or.inr hw_n₃) + · exact Or.inr (Or.inl hw_n₂) + +open Classical in +private noncomputable abbrev split_adjacent_border_cells_portrayal + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} + {c₀ : Set π.S} + (hΘ : Θ ∈ cuffs π.S) + (hc₀ : c₀ ∈ π.Γ.C) + (hc₀_Θ : (c₀ ∩ Θ).Nonempty) + {n₁ : π.S} + {n₂ : π.S} + (hn₁_tc : n₁ ∈ tilde c₀) + (hn₂_tc : n₂ ∈ tilde c₀) + (hne : n₁ ≠ n₂) + [T2Space π.S] + (hdom : π.domγ = π.Γ.N) + (hnode_cell : ∀ n ∈ π.Γ.N, ∃ c ∈ π.Γ.C, n ∈ tilde c) + (hsub_cuff₀ : closure c₀ ∩ bd π.S ⊆ Θ ∧ c₀ ∩ bd π.S = c₀ ∩ Θ ∧ closure c₀ ∩ bd π.S = closure + c₀ ∩ Θ ∧ tilde c₀ ⊆ π.Γ.N ∩ Θ ∧ ∀ Θ' ∈ cuffs π.S, (c₀ ∩ Θ').Nonempty → Θ' = Θ) + (hbd₀ : (c₀ ∩ bd π.S).Nonempty) + (u₀ : π.S) + (v₀ : π.S) + (htc₀_uv : tilde c₀ = {u₀, v₀}) + (hL₀ : IsLineWithEnds (closure c₀ ∩ bd π.S) u₀ v₀) + (hL₀_int : c₀ ∩ bd π.S = (closure c₀ ∩ bd π.S) \ {u₀, v₀}) + (htc₀ : tilde c₀ = {n₁, n₂}) + (hΘ_bd : Θ ⊆ bd π.S) + (hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ) + (hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ) + (hbs₁_sub : π.borderSet n₁ ⊆ (π.cellGraph c₀).vertexSet) + (hbp₂_sub : π.borderPlus n₂ ⊆ (π.cellGraph c₀).vertexSet) + (hn₁_in_c₀ : π.nodeVertex n₁ ∈ (π.cellGraph c₀).vertexSet) + (A₁ : Hypergraph α β) + (A₂ : Hypergraph α β) + (hsep : (π.cellGraph c₀).IsSeparation A₁ A₂) + (hlt_q : ((A₁ ∩ A₂).vertexSet \ {π.nodeVertex n₁}).ncard < π.warpAt Θ) + (hbp₁_A₁ : π.borderPlus n₁ ⊆ A₁.vertexSet) + (hbp₂_A₂ : π.borderPlus n₂ ⊆ A₂.vertexSet) + (hn₁_mem_inter : π.nodeVertex n₁ ∈ A₁.vertexSet ∩ A₂.vertexSet) + (c₁ : Set π.S) + (hc₁ : c₁ ∈ π.Γ.C) + (hc₁_Θ : (c₁ ∩ Θ).Nonempty) + (hc₁_ne_c₀ : c₁ ≠ c₀) + (n₃ : π.S) + (hne₁₃ : n₁ ≠ n₃) + (htc₁ : tilde c₁ = {n₁, n₃}) + (hd_iff : ∀ d ∈ π.Γ.C, (d ∩ bd π.S).Nonempty → (n₁ ∈ tilde d ↔ d = c₀ ∨ d = c₁)) + (hneighbors : ∀ m ∈ π.Γ.N ∩ Θ, m ≠ n₁ → ∀ v ∈ π.borderPlus n₁, v ∈ π.borderPlus m → v ∈ + π.borderPlus n₂ ∨ v ∈ π.borderPlus n₃) + (hsub_cuff₁ : closure c₁ ∩ bd π.S ⊆ Θ ∧ c₁ ∩ bd π.S = c₁ ∩ Θ ∧ closure c₁ ∩ bd π.S = closure + c₁ ∩ Θ ∧ tilde c₁ ⊆ π.Γ.N ∩ Θ ∧ ∀ Θ' ∈ cuffs π.S, (c₁ ∩ Θ').Nonempty → Θ' = Θ) + (hbd₁ : (c₁ ∩ bd π.S).Nonempty) + (hn₁_tc₁ : n₁ ∈ tilde c₁) + (hn₃_tc₁ : n₃ ∈ tilde c₁) + (hn₃_Θ : n₃ ∈ π.Γ.N ∩ Θ) + (cellG' : Set π.S → Hypergraph α β) + (bs' : π.S → Set α) + (bp' : π.S → Set α) + (hbp_def : bp' = fun n => {v | v ∈ bs' n ∨ n ∈ π.domγ ∧ v = π.nodeVertex n}) + (hcellG'_c₀ : cellG' c₀ = A₂) + (hcellG'_c₁ : cellG' c₁ = A₁ ∪ π.cellGraph c₁) + (hcellG'_other : ∀ c ∈ π.Γ.C \ {c₀, c₁}, cellG' c = π.cellGraph c) + (hbs'_n₁ : bs' n₁ = (A₁.vertexSet ∩ A₂.vertexSet) \ {π.nodeVertex n₁}) + (hbs'_other : ∀ (n : π.S), n ≠ n₁ → bs' n = π.borderSet n) + (hbp'_n₁ : bp' n₁ = A₁.vertexSet ∩ A₂.vertexSet) + (hbp'_other : ∀ (n : π.S), n ≠ n₁ → bp' n = π.borderPlus n) + (hA₁_le_G : A₁ ≤ G) + (hcellG'_le : ∀ c ∈ π.Γ.C, cellG' c ≤ G) + (hw_c₀_other : ∀ w ∈ (π.cellGraph c₀).vertexSet, ∀ d ∈ π.Γ.C \ {c₀, c₁}, w ∈ (π.cellGraph + d).vertexSet → w ∈ bp' n₁ ∨ w ∈ π.borderPlus n₂ ∨ w ∈ π.borderPlus n₃) + (h_inOrder_eq : ∀ {Θ₁ : Set π.S} {a b d_n : π.S}, a ≠ b → d_n ≠ a → GM19.InOrderOn Θ₁ a b a + d_n → False) : Portrayal G := + { S := π.S + top := π.top + isSurface := π.isSurface + connected := π.connected + Γ := π.Γ + cellGraph := cellG' + cellGraph_le := hcellG'_le + borderSet := bs' + borderSet_subset := fun n hn => by + by_cases hn_n₁ : n = n₁ + · rw [hn_n₁, hbs'_n₁] + exact sdiff_subset.trans (inter_subset_left.trans hA₁_le_G.1) + · rw [hbs'_other n hn_n₁] + exact π.borderSet_subset n hn + domγ := π.domγ + domγ_subset := π.domγ_subset + nodeVertex := π.nodeVertex + nodeVertex_mem := π.nodeVertex_mem + nodeVertex_injOn := π.nodeVertex_injOn + p1_vertex := fun v hv => by + obtain ⟨c, hc, hvc⟩ := π.p1_vertex v hv + by_cases hc_c₀ : c = c₀ + · rw [hc_c₀, ← hsep.vertexSet_union] at hvc + rcases hvc with hv₁ | hv₂ + · exact ⟨c₁, hc₁, hcellG'_c₁ ▸ Or.inl hv₁⟩ + · exact ⟨c₀, hc₀, hcellG'_c₀ ▸ hv₂⟩ + · by_cases hc_c₁ : c = c₁ + · exact ⟨c₁, hc₁, hcellG'_c₁ ▸ Or.inr (hc_c₁ ▸ hvc)⟩ + · refine ⟨c, hc, ?_⟩ + rw [hcellG'_other c ⟨hc, by rintro (rfl | rfl) <;> contradiction⟩] + exact hvc + p1_edge := fun e he => by + obtain ⟨c, hc, hec⟩ := π.p1_edge e he + by_cases hc_c₀ : c = c₀ + · rw [hc_c₀, ← hsep.edgeSet_union] at hec + rcases hec with he₁ | he₂ + · exact ⟨c₁, hc₁, hcellG'_c₁ ▸ Or.inl he₁⟩ + · exact ⟨c₀, hc₀, hcellG'_c₀ ▸ he₂⟩ + · by_cases hc_c₁ : c = c₁ + · exact ⟨c₁, hc₁, hcellG'_c₁ ▸ Or.inr (hc_c₁ ▸ hec)⟩ + · refine ⟨c, hc, ?_⟩ + rw [hcellG'_other c ⟨hc, by rintro (rfl | rfl) <;> contradiction⟩] + exact hec + p1_disjoint := fun d₁ hd₁ d₂ hd₂ hne_d => by + have hsub_E : ∀ d ∈ π.Γ.C, (cellG' d).edgeSet ⊆ + if d = c₀ then A₂.edgeSet else if d = c₁ then A₁.edgeSet ∪ (π.cellGraph c₁).edgeSet + else (π.cellGraph d).edgeSet := by + intro d hd + by_cases hd₀ : d = c₀ + · simp [hd₀, hcellG'_c₀] + · by_cases hd₁' : d = c₁ + · simp [hd₁', hc₁_ne_c₀, hcellG'_c₁] + · simp [hd₀, hd₁', hcellG'_other d ⟨hd, by rintro (rfl | rfl) <;> contradiction⟩] + refine Set.disjoint_left.mpr fun e he₁ he₂ => ?_ + have h1 := hsub_E d₁ hd₁ he₁ + have h2 := hsub_E d₂ hd₂ he₂ + revert h1 h2 + split_ifs <;> intro h1 h2 + · exact hne_d (by subst_vars; rfl) + · rcases h2 with h2A₁ | h2c₁ + · exact Set.disjoint_left.mp + (Set.disjoint_iff_inter_eq_empty.mpr hsep.edgeSet_inter_eq) h2A₁ h1 + · exact Set.disjoint_left.mp + (π.p1_disjoint c₀ hc₀ c₁ hc₁ hc₁_ne_c₀.symm) (hsep.right_le.2 h1) h2c₁ + · exact Set.disjoint_left.mp + (π.p1_disjoint c₀ hc₀ d₂ hd₂ (by subst_vars; exact Ne.symm ‹_›)) + (hsep.right_le.2 h1) h2 + · rcases h1 with h1A₁ | h1c₁ + · exact Set.disjoint_left.mp + (Set.disjoint_iff_inter_eq_empty.mpr hsep.edgeSet_inter_eq) h1A₁ h2 + · exact Set.disjoint_left.mp + (π.p1_disjoint c₁ hc₁ c₀ hc₀ hc₁_ne_c₀) h1c₁ (hsep.right_le.2 h2) + · exact hne_d (by subst_vars; rfl) + · rcases h1 with h1A₁ | h1c₁ + · exact Set.disjoint_left.mp + (π.p1_disjoint c₀ hc₀ d₂ hd₂ (by subst_vars; exact Ne.symm ‹_›)) + (hsep.left_le.2 h1A₁) h2 + · exact Set.disjoint_left.mp + (π.p1_disjoint c₁ hc₁ d₂ hd₂ (by subst_vars; exact Ne.symm ‹_›)) + h1c₁ h2 + · exact Set.disjoint_left.mp + (π.p1_disjoint d₁ hd₁ c₀ hc₀ (by subst_vars; assumption)) + h1 (hsep.right_le.2 h2) + · rcases h2 with h2A₁ | h2c₁ + · exact Set.disjoint_left.mp + (π.p1_disjoint d₁ hd₁ c₀ hc₀ (by subst_vars; assumption)) + h1 (hsep.left_le.2 h2A₁) + · exact Set.disjoint_left.mp + (π.p1_disjoint d₁ hd₁ c₁ hc₁ (by subst_vars; assumption)) + h1 h2c₁ + · exact Set.disjoint_left.mp (π.p1_disjoint d₁ hd₁ d₂ hd₂ hne_d) h1 h2 + p2 := fun c hc n hn => by + by_cases hc_c₀ : c = c₀ + · rw [hc_c₀] at hn ⊢ + rw [hcellG'_c₀] + have hntc₀ : n ∈ ({n₁, n₂} : Set π.S) := htc₀ ▸ hn.1 + rcases hntc₀ with hEq | hEq + · rw [hEq]; exact hn₁_mem_inter.2 + · rw [hEq]; exact hbp₂_A₂ (Or.inr ⟨hEq ▸ hn.2, rfl⟩) + · by_cases hc_c₁ : c = c₁ + · rw [hc_c₁] at hn ⊢ + rw [hcellG'_c₁] + exact Or.inr (π.p2 c₁ hc₁ n hn) + · rw [hcellG'_other c ⟨hc, by rintro (h | h) <;> [exact hc_c₀ h; exact hc_c₁ h]⟩] + exact π.p2 c hc n hn + p3_notMem := fun n hn => by + by_cases hn_n₁ : n = n₁ + · rw [hn_n₁, hbs'_n₁] + exact fun h => h.2 rfl + · rw [hbs'_other n hn_n₁] + exact π.p3_notMem n hn + p3_subset := fun c hc hbd_c n hn_tc => by + by_cases hc_c₀ : c = c₀ + · rw [hc_c₀] at hn_tc ⊢ + rw [hcellG'_c₀] + have hntc₀ : n ∈ ({n₁, n₂} : Set π.S) := htc₀ ▸ hn_tc + rcases hntc₀ with hEq | hEq + · rw [hEq, hbs'_n₁]; exact sdiff_subset.trans inter_subset_right + · rw [hEq, hbs'_other n₂ hne.symm] + exact fun x hx => hbp₂_A₂ (Or.inl hx) + · by_cases hc_c₁ : c = c₁ + · rw [hc_c₁] at hn_tc ⊢ + rw [hcellG'_c₁] + by_cases hn_n₁ : n = n₁ + · rw [hn_n₁, hbs'_n₁] + exact (sdiff_subset.trans inter_subset_left).trans subset_union_left + · rw [hbs'_other n hn_n₁] + exact (π.p3_subset c₁ hc₁ hbd₁ n hn_tc).trans subset_union_right + · have hc_diff : c ∈ π.Γ.C \ {c₀, c₁} := + ⟨hc, by rintro (h | h) <;> [exact hc_c₀ h; exact hc_c₁ h]⟩ + have hn_ne_n₁ : n ≠ n₁ := fun h => + hc_diff.2 ((hd_iff c hc hbd_c).mp (h ▸ hn_tc)) + rw [hcellG'_other c hc_diff, hbs'_other n hn_ne_n₁] + exact π.p3_subset c hc hbd_c n hn_tc + p4_disjoint := fun Θ₁ hΘ₁ Θ₂ hΘ₂ hne_Θ m₁ hm₁ m₂ hm₂ => by + have hsub_bs : ∀ m ∈ π.Γ.N ∩ bd π.S, + bs' m ⊆ if m = n₁ then (π.cellGraph c₀).vertexSet else π.borderSet m := by + intro m _ + by_cases hm_n₁ : m = n₁ + · simp only [hm_n₁, ↓reduceIte, hbs'_n₁] + exact sdiff_subset.trans (inter_subset_left.trans hsep.left_le.1) + · simp [hm_n₁, hbs'_other m hm_n₁] + refine Set.disjoint_left.mpr fun w hw₁ hw₂ => ?_ + by_cases hm₁_n₁ : m₁ = n₁ + · have hΘ₁_eq : Θ₁ = Θ := by + rcases hΘ₁ with ⟨x₁, _, rfl⟩; rcases hΘ with ⟨x₀, _, rfl⟩ + exact (connectedComponentIn_eq (hm₁_n₁ ▸ hm₁.2)).trans + (connectedComponentIn_eq hn₁_Θ.2).symm + have hm₂_ne_n₁ : m₂ ≠ n₁ := fun h => + hne_Θ (hΘ₁_eq.trans (by + rcases hΘ₂ with ⟨x₂, _, rfl⟩; rcases hΘ with ⟨x₀, _, rfl⟩ + exact (connectedComponentIn_eq hn₁_Θ.2).trans + (connectedComponentIn_eq (h ▸ hm₂.2)).symm)) + rw [hm₁_n₁, hbs'_n₁] at hw₁ + rw [hbs'_other m₂ hm₂_ne_n₁] at hw₂ + have hw_c₀ : w ∈ (π.cellGraph c₀).vertexSet := hsep.left_le.1 hw₁.1.1 + have hΘ₂_bd : Θ₂ ⊆ bd π.S := by + rcases hΘ₂ with ⟨x₂, _, rfl⟩; exact connectedComponentIn_subset _ x₂ + have hbp := border_cell_vertex_inter_borderPlus_subset π hc₀ hbd₀ htc₀ + ⟨hm₂.1, hΘ₂_bd hm₂.2⟩ hw_c₀ (Or.inl hw₂) + rcases hbp with (hbs₁ | ⟨_, hEq⟩) | (hbs₂ | ⟨_, hEq⟩) + · exact Set.disjoint_left.mp + (π.p4_disjoint Θ hΘ Θ₂ hΘ₂ (hΘ₁_eq ▸ hne_Θ) n₁ hn₁_Θ m₂ hm₂) hbs₁ hw₂ + · have hn₁_not_Θ₂ : n₁ ∉ Θ₂ := fun h => + hne_Θ (hΘ₁_eq.trans (by + rcases hΘ₂ with ⟨x₂, _, rfl⟩; rcases hΘ with ⟨x₀, _, rfl⟩ + exact (connectedComponentIn_eq hn₁_Θ.2).trans + (connectedComponentIn_eq h).symm)) + exact π.p4_notMem Θ₂ hΘ₂ m₂ hm₂ n₁ (hdom ▸ hn₁_Θ.1) hn₁_not_Θ₂ (hEq ▸ hw₂) + · exact Set.disjoint_left.mp + (π.p4_disjoint Θ hΘ Θ₂ hΘ₂ (hΘ₁_eq ▸ hne_Θ) n₂ hn₂_Θ m₂ hm₂) hbs₂ hw₂ + · have hn₂_not_Θ₂ : n₂ ∉ Θ₂ := fun h => + hne_Θ (hΘ₁_eq.trans (by + rcases hΘ₂ with ⟨x₂, _, rfl⟩; rcases hΘ with ⟨x₀, _, rfl⟩ + exact (connectedComponentIn_eq hn₂_Θ.2).trans + (connectedComponentIn_eq h).symm)) + exact π.p4_notMem Θ₂ hΘ₂ m₂ hm₂ n₂ (hdom ▸ hn₂_Θ.1) hn₂_not_Θ₂ (hEq ▸ hw₂) + · by_cases hm₂_n₁ : m₂ = n₁ + · have hΘ₂_eq : Θ₂ = Θ := by + rcases hΘ₂ with ⟨x₂, _, rfl⟩; rcases hΘ with ⟨x₀, _, rfl⟩ + exact (connectedComponentIn_eq (hm₂_n₁ ▸ hm₂.2)).trans + (connectedComponentIn_eq hn₁_Θ.2).symm + rw [hbs'_other m₁ hm₁_n₁] at hw₁ + rw [hm₂_n₁, hbs'_n₁] at hw₂ + have hw_c₀ : w ∈ (π.cellGraph c₀).vertexSet := hsep.left_le.1 hw₂.1.1 + have hΘ₁_bd : Θ₁ ⊆ bd π.S := by + rcases hΘ₁ with ⟨x₁, _, rfl⟩; exact connectedComponentIn_subset _ x₁ + have hbp := border_cell_vertex_inter_borderPlus_subset π hc₀ hbd₀ htc₀ + ⟨hm₁.1, hΘ₁_bd hm₁.2⟩ hw_c₀ (Or.inl hw₁) + rcases hbp with (hbs₁ | ⟨_, hEq⟩) | (hbs₂ | ⟨_, hEq⟩) + · exact Set.disjoint_left.mp + (π.p4_disjoint Θ₁ hΘ₁ Θ hΘ (hΘ₂_eq ▸ hne_Θ) m₁ hm₁ n₁ hn₁_Θ) hw₁ hbs₁ + · have hn₁_not_Θ₁ : n₁ ∉ Θ₁ := fun h => + hne_Θ (by + rcases hΘ₁ with ⟨x₁, _, rfl⟩; rcases hΘ with ⟨x₀, _, rfl⟩ + exact ((connectedComponentIn_eq h).trans + (connectedComponentIn_eq hn₁_Θ.2).symm).trans hΘ₂_eq.symm) + exact π.p4_notMem Θ₁ hΘ₁ m₁ hm₁ n₁ (hdom ▸ hn₁_Θ.1) hn₁_not_Θ₁ (hEq ▸ hw₁) + · exact Set.disjoint_left.mp + (π.p4_disjoint Θ₁ hΘ₁ Θ hΘ (hΘ₂_eq ▸ hne_Θ) m₁ hm₁ n₂ hn₂_Θ) hw₁ hbs₂ + · have hn₂_not_Θ₁ : n₂ ∉ Θ₁ := fun h => + hne_Θ (by + rcases hΘ₁ with ⟨x₁, _, rfl⟩; rcases hΘ with ⟨x₀, _, rfl⟩ + exact ((connectedComponentIn_eq h).trans + (connectedComponentIn_eq hn₂_Θ.2).symm).trans hΘ₂_eq.symm) + exact π.p4_notMem Θ₁ hΘ₁ m₁ hm₁ n₂ (hdom ▸ hn₂_Θ.1) hn₂_not_Θ₁ (hEq ▸ hw₁) + · rw [hbs'_other m₁ hm₁_n₁] at hw₁ + rw [hbs'_other m₂ hm₂_n₁] at hw₂ + exact Set.disjoint_left.mp (π.p4_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ hne_Θ m₁ hm₁ m₂ hm₂) hw₁ hw₂ + p4_notMem := fun Θ₁ hΘ₁ m₁ hm₁ m₂ hm₂ hnot => by + by_cases hm₁_n₁ : m₁ = n₁ + · have hΘ₁_eq : Θ₁ = Θ := by + rcases hΘ₁ with ⟨x₁, _, rfl⟩; rcases hΘ with ⟨x₀, _, rfl⟩ + exact (connectedComponentIn_eq (hm₁_n₁ ▸ hm₁.2)).trans + (connectedComponentIn_eq hn₁_Θ.2).symm + rw [hm₁_n₁, hbs'_n₁] + intro hmem + exact nodeVertex_notMem_border_cellGraph_of_notMem_cuff π hdom hnode_cell + hΘ hc₀ hc₀_Θ htc₀ (hdom ▸ hm₂) (hΘ₁_eq ▸ hnot) (hsep.left_le.1 hmem.1.1) + · rw [hbs'_other m₁ hm₁_n₁] + exact π.p4_notMem Θ₁ hΘ₁ m₁ hm₁ m₂ hm₂ hnot + p5 := fun d hd hint_d w hwd ⟨d', hd', hne_d, hwd'⟩ => by + have hd_diff : d ∈ π.Γ.C \ {c₀, c₁} := + ⟨hd, by rintro (rfl | rfl) <;> [exact hint_d hbd₀; exact hint_d hbd₁]⟩ + rw [hcellG'_other d hd_diff] at hwd + have hex_c' : ∃ c' ∈ π.Γ.C, c' ≠ d ∧ w ∈ (π.cellGraph c').vertexSet := by + by_cases hd'_c₀ : d' = c₀ + · rw [hd'_c₀, hcellG'_c₀] at hwd' + exact ⟨c₀, hc₀, Ne.symm ( fun h => hd_diff.2 (Or.inl h) ), hsep.right_le.1 hwd'⟩ + · by_cases hd'_c₁ : d' = c₁ + · rw [hd'_c₁, hcellG'_c₁] at hwd' + rcases hwd' with hwA₁ | hwc₁ + · exact ⟨c₀, hc₀, Ne.symm (fun h => hd_diff.2 (Or.inl h)), hsep.left_le.1 hwA₁⟩ + · exact ⟨c₁, hc₁, Ne.symm (fun h => hd_diff.2 (Or.inr h)), hwc₁⟩ + · have hd'_diff : d' ∈ π.Γ.C \ {c₀, c₁} := + ⟨hd', by rintro (rfl | rfl) <;> contradiction⟩ + rw [hcellG'_other d' hd'_diff] at hwd' + exact ⟨d', hd', hne_d, hwd'⟩ + exact π.p5 d hd hint_d w hwd hex_c' + p6 := fun d hd hbd_d w hwd ⟨d', hd', hne_d, hwd'⟩ => by + change ∃ n ∈ tilde d, w ∈ {v | v ∈ bs' n ∨ n ∈ π.domγ ∧ v = π.nodeVertex n} + simp_rw [← congrFun hbp_def] + by_cases hd_c₀ : d = c₀ + · rw [hd_c₀] at hwd hne_d ⊢ + rw [hcellG'_c₀] at hwd + have hw_c₀ : w ∈ (π.cellGraph c₀).vertexSet := hsep.right_le.1 hwd + have hw_cases : w ∈ bp' n₁ ∨ w ∈ π.borderPlus n₂ := by + by_cases hd'_c₁ : d' = c₁ + · rw [hd'_c₁, hcellG'_c₁] at hwd' + rcases hwd' with hwA₁ | hwc₁ + · exact Or.inl (hbp'_n₁ ▸ ⟨hwA₁, hwd⟩) + · rcases border_cell_vertex_mem_borderPlus_of_mem_other π hc₀ hbd₀ htc₀ + hw_c₀ hc₁ hc₁_ne_c₀ hwc₁ with hw_n₁ | hw_n₂ + · exact Or.inl (hbp'_n₁ ▸ ⟨hbp₁_A₁ hw_n₁, hwd⟩) + · exact Or.inr hw_n₂ + · have hd'_diff : d' ∈ π.Γ.C \ {c₀, c₁} := + ⟨hd', by rintro (h | h) <;> [exact hne_d h; exact hd'_c₁ h]⟩ + rw [hcellG'_other d' hd'_diff] at hwd' + rcases border_cell_vertex_mem_borderPlus_of_mem_other π hc₀ hbd₀ htc₀ + hw_c₀ hd' hne_d hwd' with hw_n₁ | hw_n₂ + · exact Or.inl (hbp'_n₁ ▸ ⟨hbp₁_A₁ hw_n₁, hwd⟩) + · exact Or.inr hw_n₂ + rcases hw_cases with hw₁ | hw₂ + · exact ⟨n₁, htc₀ ▸ Or.inl rfl, hw₁⟩ + · exact ⟨n₂, htc₀ ▸ Or.inr rfl, (hbp'_other n₂ hne.symm) ▸ hw₂⟩ + · by_cases hd_c₁ : d = c₁ + · rw [hd_c₁] at hwd hne_d ⊢ + rw [hcellG'_c₁] at hwd + have hw_cases : w ∈ bp' n₁ ∨ w ∈ π.borderPlus n₃ := by + by_cases hd'_c₀ : d' = c₀ + · rw [hd'_c₀, hcellG'_c₀] at hwd' + rcases hwd with hwA₁ | hwc₁ + · exact Or.inl (hbp'_n₁ ▸ ⟨hwA₁, hwd'⟩) + · rcases border_cell_vertex_mem_borderPlus_of_mem_other π hc₁ hbd₁ htc₁ + hwc₁ hc₀ hc₁_ne_c₀.symm (hsep.right_le.1 hwd') with hw_n₁ | hw_n₃ + · exact Or.inl (hbp'_n₁ ▸ ⟨hbp₁_A₁ hw_n₁, hwd'⟩) + · exact Or.inr hw_n₃ + · have hd'_diff : d' ∈ π.Γ.C \ {c₀, c₁} := + ⟨hd', by rintro (h | h) <;> [exact hd'_c₀ h; exact hne_d h]⟩ + rw [hcellG'_other d' hd'_diff] at hwd' + rcases hwd with hwA₁ | hwc₁ + · rcases hw_c₀_other w (hsep.left_le.1 hwA₁) d' hd'_diff hwd' with + hw₁ | hw_n₂ | hw_n₃ + · exact Or.inl hw₁ + · exact Or.inl (hbp'_n₁ ▸ ⟨hwA₁, hbp₂_A₂ hw_n₂⟩) + · exact Or.inr hw_n₃ + · rcases border_cell_vertex_mem_borderPlus_of_mem_other π hc₁ hbd₁ htc₁ + hwc₁ hd' hne_d hwd' with hw_n₁ | hw_n₃ + · rcases hw_c₀_other w (hsep.left_le.1 (hbp₁_A₁ hw_n₁)) d' hd'_diff hwd' with + hw₁ | hw_n₂ | hw_n₃ + · exact Or.inl hw₁ + · exact Or.inl (hbp'_n₁ ▸ ⟨hbp₁_A₁ hw_n₁, hbp₂_A₂ hw_n₂⟩) + · exact Or.inr hw_n₃ + · exact Or.inr hw_n₃ + rcases hw_cases with hw₁ | hw₃ + · exact ⟨n₁, htc₁ ▸ Or.inl rfl, hw₁⟩ + · exact ⟨n₃, htc₁ ▸ Or.inr rfl, (hbp'_other n₃ hne₁₃.symm) ▸ hw₃⟩ + · have hd_diff : d ∈ π.Γ.C \ {c₀, c₁} := + ⟨hd, by rintro (rfl | rfl) <;> contradiction⟩ + rw [hcellG'_other d hd_diff] at hwd + have hex_c' : ∃ c' ∈ π.Γ.C, c' ≠ d ∧ w ∈ (π.cellGraph c').vertexSet := by + by_cases hd'_c₀ : d' = c₀ + · rw [hd'_c₀, hcellG'_c₀] at hwd' + exact ⟨c₀, hc₀, Ne.symm hd_c₀, hsep.right_le.1 hwd'⟩ + · by_cases hd'_c₁ : d' = c₁ + · rw [hd'_c₁, hcellG'_c₁] at hwd' + rcases hwd' with hwA₁ | hwc₁ + · exact ⟨c₀, hc₀, Ne.symm hd_c₀, hsep.left_le.1 hwA₁⟩ + · exact ⟨c₁, hc₁, Ne.symm hd_c₁, hwc₁⟩ + · have hd'_diff : d' ∈ π.Γ.C \ {c₀, c₁} := + ⟨hd', by rintro (rfl | rfl) <;> contradiction⟩ + rw [hcellG'_other d' hd'_diff] at hwd' + exact ⟨d', hd', hne_d, hwd'⟩ + obtain ⟨m, hm_td, hwm⟩ := π.p6 d hd hbd_d w hwd hex_c' + have hm_ne_n₁ : m ≠ n₁ := fun h => + hd_diff.2 ((hd_iff d hd hbd_d).mp (h ▸ hm_td)) + exact ⟨m, hm_td, (hbp'_other m hm_ne_n₁) ▸ hwm⟩ + p7 := by + intro Θ₁ hΘ₁ m₁ hm₁ m₂ hm₂ m₃ hm₃ m₄ hm₄ hord w hw₁ hw₃ + change w ∈ {v | v ∈ bs' m₂ ∨ m₂ ∈ π.domγ ∧ v = π.nodeVertex m₂} ∨ + w ∈ {v | v ∈ bs' m₄ ∨ m₄ ∈ π.domγ ∧ v = π.nodeVertex m₄} + have hleft : w ∈ bp' m₁ := (congrFun hbp_def m₁).symm ▸ hw₁ + have hright : w ∈ bp' m₃ := (congrFun hbp_def m₃).symm ▸ hw₃ + simp_rw [← congrFun hbp_def] + have hp7_aux : ∀ a b c d_n : π.S, + a ∈ π.Γ.N ∩ Θ₁ → b ∈ π.Γ.N ∩ Θ₁ → c ∈ π.Γ.N ∩ Θ₁ → d_n ∈ π.Γ.N ∩ Θ₁ → + a ≠ b → b ≠ c → c ≠ d_n → d_n ≠ a → + GM19.InOrderOn Θ₁ a b c d_n → + (a = n₁ ∨ b = n₁ ∨ (a ≠ n₁ ∧ b ≠ n₁ ∧ c ≠ n₁ ∧ d_n ≠ n₁)) → + w ∈ bp' a → w ∈ bp' c → + w ∈ bp' b ∨ w ∈ bp' d_n := by + intro a b c d_n ha hb hc hd_n hab hbc hcd hda hord' hcases hwa hwc + rcases hcases with ha_eq | hb_eq | ⟨ha_ne, hb_ne, hc_ne, hd_ne⟩ + · have hΘ₁_eq : Θ₁ = Θ := by + rcases hΘ₁ with ⟨x₁, _, rfl⟩; rcases hΘ with ⟨x₀, _, rfl⟩ + exact (connectedComponentIn_eq (ha_eq ▸ ha.2)).trans + (connectedComponentIn_eq hn₁_Θ.2).symm + rw [ha_eq] at hab hda hord' hwa + rw [hΘ₁_eq] at hb hc hd_n hord' + have hb_ne : b ≠ n₁ := Ne.symm hab + have hd_ne : d_n ≠ n₁ := hda + have hc_ne : c ≠ n₁ := fun h => h_inOrder_eq hab hda (h ▸ hord') + rw [hbp'_other b hb_ne, hbp'_other d_n hd_ne] + rw [hbp'_other c hc_ne] at hwc + rw [hbp'_n₁] at hwa + have hw_c₀ : w ∈ (π.cellGraph c₀).vertexSet := hsep.left_le.1 hwa.1 + have hbp_u := border_cell_vertex_inter_borderPlus_subset π hc₀ hbd₀ htc₀ + ⟨hc.1, hΘ_bd hc.2⟩ hw_c₀ hwc + have hn₁_cl : n₁ ∈ closure c₀ := (htc₀ ▸ Or.inl rfl : n₁ ∈ tilde c₀).1 + rcases hbp_u with hw_n₁ | hw_n₂ + · exact π.p7 Θ hΘ n₁ hn₁_Θ b hb c hc d_n hd_n hord' w hw_n₁ hwc + · have hn₂_cl : n₂ ∈ closure c₀ ∩ Θ := ⟨(htc₀ ▸ Or.inr rfl : n₂ ∈ tilde c₀).1, hn₂_Θ.2⟩ + have hord₂ := inOrderOn_of_mem_closure_border_cell_left π.Γ hΘ hc₀ hc₀_Θ + hab hbc hcd hda hb.1 hd_n.1 hn₁_cl hord' hn₂_cl + exact π.p7 Θ hΘ n₂ hn₂_Θ b hb c hc d_n hd_n hord₂ w hw_n₂ hwc + · have hΘ₁_eq : Θ₁ = Θ := by + rcases hΘ₁ with ⟨x₁, _, rfl⟩; rcases hΘ with ⟨x₀, _, rfl⟩ + exact (connectedComponentIn_eq (hb_eq ▸ hb.2)).trans + (connectedComponentIn_eq hn₁_Θ.2).symm + rw [hb_eq] at hab hbc hord' ⊢ + rw [hΘ₁_eq] at ha hc hd_n hord' + have ha_ne : a ≠ n₁ := hab + have hc_ne : c ≠ n₁ := Ne.symm hbc + have hd_ne : d_n ≠ n₁ := fun h => + h_inOrder_eq hbc ha_ne (h ▸ inOrderOn_cyclic hord') + rw [hbp'_n₁, hbp'_other d_n hd_ne] + rw [hbp'_other a ha_ne] at hwa + rw [hbp'_other c hc_ne] at hwc + have hn₁_cl : n₁ ∈ closure c₀ := (htc₀ ▸ Or.inl rfl : n₁ ∈ tilde c₀).1 + have hn₂_cl : n₂ ∈ closure c₀ ∩ Θ := ⟨(htc₀ ▸ Or.inr rfl : n₂ ∈ tilde c₀).1, hn₂_Θ.2⟩ + have hord₂ := inOrderOn_of_mem_closure_border_cell_mid π.Γ hΘ hc₀ hc₀_Θ + hab hbc hcd hda ha.1 hc.1 hn₁_cl hord' hn₂_cl + have hp₁ := π.p7 Θ hΘ a ha n₁ hn₁_Θ c hc d_n hd_n hord' w hwa hwc + have hp₂ := π.p7 Θ hΘ a ha n₂ hn₂_Θ c hc d_n hd_n hord₂ w hwa hwc + rcases hp₁ with hw_n₁ | hw_d + · rcases hp₂ with hw_n₂ | hw_d + · exact Or.inl ⟨hbp₁_A₁ hw_n₁, hbp₂_A₂ hw_n₂⟩ + · exact Or.inr hw_d + · exact Or.inr hw_d + · rw [hbp'_other b hb_ne, hbp'_other d_n hd_ne] + rw [hbp'_other a ha_ne] at hwa + rw [hbp'_other c hc_ne] at hwc + exact π.p7 Θ₁ hΘ₁ a ha b hb c hc d_n hd_n hord' w hwa hwc + by_cases h12 : m₁ = m₂ + · exact Or.inl (h12 ▸ hleft) + by_cases h23 : m₂ = m₃ + · exact Or.inl (h23.symm ▸ hright) + by_cases h34 : m₃ = m₄ + · exact Or.inr (h34 ▸ hright) + by_cases h41 : m₄ = m₁ + · exact Or.inr (h41.symm ▸ hleft) + by_cases hm₁_n₁ : m₁ = n₁ + · exact hp7_aux m₁ m₂ m₃ m₄ hm₁ hm₂ hm₃ hm₄ h12 h23 h34 h41 hord (Or.inl hm₁_n₁) hleft hright + by_cases hm₂_n₁ : m₂ = n₁ + · exact hp7_aux m₁ m₂ m₃ m₄ hm₁ hm₂ hm₃ hm₄ h12 h23 h34 h41 hord + (Or.inr (Or.inl hm₂_n₁)) hleft hright + by_cases hm₃_n₁ : m₃ = n₁ + · exact (hp7_aux m₃ m₄ m₁ m₂ hm₃ hm₄ hm₁ hm₂ h34 h41 h12 h23 + (inOrderOn_cyclic2 hord) (Or.inl hm₃_n₁) hright hleft).symm + by_cases hm₄_n₁ : m₄ = n₁ + · exact (hp7_aux m₃ m₄ m₁ m₂ hm₃ hm₄ hm₁ hm₂ h34 h41 h12 h23 + (inOrderOn_cyclic2 hord) (Or.inr (Or.inl hm₄_n₁)) hright hleft).symm + exact hp7_aux m₁ m₂ m₃ m₄ hm₁ hm₂ hm₃ hm₄ h12 h23 h34 h41 hord + (Or.inr (Or.inr ⟨hm₁_n₁, hm₂_n₁, hm₃_n₁, hm₄_n₁⟩)) hleft hright } + +private theorem merged_border_cell_graphs_are_small + {α β : Type*} {G : Hypergraph α β} (π : Portrayal G) + {Θ c₀ c₁ : Set π.S} (hΘ : Θ ∈ cuffs π.S) + (hc₀ : c₀ ∈ π.Γ.C) (hc₁ : c₁ ∈ π.Γ.C) + (hbd₀ : (c₀ ∩ bd π.S).Nonempty) (hbd₁ : (c₁ ∩ bd π.S).Nonempty) + {n₁ n₂ n₃ : π.S} (htc₀ : tilde c₀ = {n₁, n₂}) (htc₁ : tilde c₁ = {n₁, n₃}) + (hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ) (hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ) (hn₃_Θ : n₃ ∈ π.Γ.N ∩ Θ) + {A₁ A₂ : Hypergraph α β} (hsep : (π.cellGraph c₀).IsSeparation A₁ A₂) + (hA₁_le_G : A₁ ≤ G) + {cellG' : Set π.S → Hypergraph α β} + (hcellG'_c₀ : cellG' c₀ = A₂) (hcellG'_c₁ : cellG' c₁ = A₁ ∪ π.cellGraph c₁) + (hcellG'_other : ∀ c ∈ π.Γ.C \ {c₀, c₁}, cellG' c = π.cellGraph c) + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (htrue : π.IsTrue 𝒯) (hθ : 4 * p + 5 < θ) + (hbp₁_fin : (π.borderPlus n₁).Finite) (hbp₂_fin : (π.borderPlus n₂).Finite) + (hbp₃_fin : (π.borderPlus n₃).Finite) + (hinter_fin : (A₁.vertexSet ∩ A₂.vertexSet).Finite) + (hinter_le_q : (A₁.vertexSet ∩ A₂.vertexSet).ncard ≤ π.warpAt Θ) + (hw_le : π.warpAt Θ ≤ p) : + ∀ c ∈ π.Γ.C, ∃ B, (cellG' c, B) ∈ 𝒯 := by + intro c hc + by_cases hc_c₀ : c = c₀ + · rw [hc_c₀] + rw [hcellG'_c₀] + have hatt_sub : attachments G A₂ ⊆ + (π.borderPlus n₁ ∪ π.borderPlus n₂) ∪ (A₁.vertexSet ∩ A₂.vertexSet) := by + rintro x ⟨hx₂, e, ⟨heG, he_not₂⟩, hinc⟩ + by_cases he₀ : e ∈ (π.cellGraph c₀).edgeSet + · have he₁ : e ∈ A₁.edgeSet := (hsep.edgeSet_union ▸ he₀).resolve_right he_not₂ + have hinc₀ : (π.cellGraph c₀).Inc e x := + (inc_iff_of_le (π.cellGraph_le c₀ hc₀) he₀).2 hinc + have hinc₁ : A₁.Inc e x := (inc_iff_of_le hsep.left_le he₁).2 hinc₀ + exact Or.inr ⟨A₁.vertex_mem_of_inc hinc₁, hx₂⟩ + · have hx_att₀ : x ∈ attachments G (π.cellGraph c₀) := + ⟨hsep.right_le.1 hx₂, e, ⟨heG, he₀⟩, hinc⟩ + have hx_ov := π.attachments_cellGraph_subset_otherVertices hc₀ hx_att₀ + rcases hx_ov.2 with ⟨d, hd, hdc₀, hxd⟩ + exact Or.inl (border_cell_vertex_mem_borderPlus_of_mem_other π hc₀ hbd₀ htc₀ + hx_ov.1 hd hdc₀ hxd) + have hfin_rhs : ((π.borderPlus n₁ ∪ π.borderPlus n₂) ∪ (A₁.vertexSet ∩ A₂.vertexSet)).Finite + := + (hbp₁_fin.union hbp₂_fin).union hinter_fin + have hatt_lt : (attachments G A₂).ncard < θ := by + have h1 := ncard_le_ncard hatt_sub hfin_rhs + have h2 := ncard_union_le (π.borderPlus n₁ ∪ π.borderPlus n₂) (A₁.vertexSet ∩ A₂.vertexSet) + have h3 := ncard_union_le (π.borderPlus n₁) (π.borderPlus n₂) + have hbp₁_c := ncard_borderPlus_le_warpAt_succ π hΘ hn₁_Θ + have hbp₂_c := ncard_borderPlus_le_warpAt_succ π hΘ hn₂_Θ + omega + exact IsSmallWrt.mono h𝒯 (htrue.1 c₀ hc₀) hsep.right_le hatt_lt + · by_cases hc_c₁ : c = c₁ + · rw [hc_c₁] + rw [hcellG'_c₁] + have hatt_sub : attachments G (A₁ ∪ π.cellGraph c₁) ⊆ + ((π.borderPlus n₁ ∪ π.borderPlus n₂) ∪ π.borderPlus n₃) ∪ + (A₁.vertexSet ∩ A₂.vertexSet) := by + refine attachments_union_subset.trans ?_ + rintro x (hxA₁ | hxc₁) + · rcases hxA₁ with ⟨hx₁, e, ⟨heG, he_not₁⟩, hinc⟩ + by_cases he₀ : e ∈ (π.cellGraph c₀).edgeSet + · have he₂ : e ∈ A₂.edgeSet := (hsep.edgeSet_union ▸ he₀).resolve_left he_not₁ + have hinc₀ : (π.cellGraph c₀).Inc e x := + (inc_iff_of_le (π.cellGraph_le c₀ hc₀) he₀).2 hinc + have hinc₂ : A₂.Inc e x := (inc_iff_of_le hsep.right_le he₂).2 hinc₀ + exact Or.inr ⟨hx₁, A₂.vertex_mem_of_inc hinc₂⟩ + · have hx_att₀ : x ∈ attachments G (π.cellGraph c₀) := + ⟨hsep.left_le.1 hx₁, e, ⟨heG, he₀⟩, hinc⟩ + have hx_ov := π.attachments_cellGraph_subset_otherVertices hc₀ hx_att₀ + rcases hx_ov.2 with ⟨d, hd, hdc₀, hxd⟩ + exact Or.inl (Or.inl (border_cell_vertex_mem_borderPlus_of_mem_other π hc₀ hbd₀ htc₀ + hx_ov.1 hd hdc₀ hxd)) + · have hx_ov := π.attachments_cellGraph_subset_otherVertices hc₁ hxc₁ + rcases hx_ov.2 with ⟨d, hd, hdc₁, hxd⟩ + rcases border_cell_vertex_mem_borderPlus_of_mem_other π hc₁ hbd₁ htc₁ + hx_ov.1 hd hdc₁ hxd with hx_n₁ | hx_n₃ + · exact Or.inl (Or.inl (Or.inl hx_n₁)) + · exact Or.inl (Or.inr hx_n₃) + have hfin_rhs : (((π.borderPlus n₁ ∪ π.borderPlus n₂) ∪ π.borderPlus n₃) ∪ + (A₁.vertexSet ∩ A₂.vertexSet)).Finite := + ((hbp₁_fin.union hbp₂_fin).union hbp₃_fin).union hinter_fin + have hatt_lt : (attachments G (A₁ ∪ π.cellGraph c₁)).ncard < θ := by + have h1 := ncard_le_ncard hatt_sub hfin_rhs + have h2 := ncard_union_le ((π.borderPlus n₁ ∪ π.borderPlus n₂) ∪ π.borderPlus n₃) + (A₁.vertexSet ∩ A₂.vertexSet) + have h3 := ncard_union_le (π.borderPlus n₁ ∪ π.borderPlus n₂) (π.borderPlus n₃) + have h4 := ncard_union_le (π.borderPlus n₁) (π.borderPlus n₂) + have hbp₁_c := ncard_borderPlus_le_warpAt_succ π hΘ hn₁_Θ + have hbp₂_c := ncard_borderPlus_le_warpAt_succ π hΘ hn₂_Θ + have hbp₃_c := ncard_borderPlus_le_warpAt_succ π hΘ hn₃_Θ + omega + have hle_union : A₁ ∪ π.cellGraph c₁ ≤ π.cellGraph c₀ ∪ π.cellGraph c₁ := + (le_iff_of_le (union_le hA₁_le_G (π.cellGraph_le c₁ hc₁)) + (union_le (π.cellGraph_le c₀ hc₀) (π.cellGraph_le c₁ hc₁))).mpr + ⟨union_subset_union_left _ hsep.left_le.1, union_subset_union_left _ hsep.left_le.2⟩ + exact theorem_4_1_ii h𝒯 (htrue.1 c₀ hc₀) (htrue.1 c₁ hc₁) hle_union hatt_lt + · rw [hcellG'_other c ⟨hc, by rintro (h | h) <;> [exact hc_c₀ h; exact hc_c₁ h]⟩] + exact htrue.1 c hc + +private theorem cellWarp_le_of_small_borderPlus + {α β : Type*} {G : Hypergraph α β} (π : Portrayal G) {c : Set π.S} + {n₁ n₂ : π.S} (htc : tilde c = {n₁, n₂}) {p : ℕ} + (hbs₁ : (π.borderSet n₁).ncard ≤ p) (hbs₂ : (π.borderSet n₂).ncard ≤ p) + (hbp₁ : (π.borderPlus n₁).ncard ≤ p) : π.cellWarp c ≤ p := + π.cellWarp_le_of_two_ends htc hbs₁ hbs₂ + (fun h _ => (Nat.not_succ_le_self _ (h ▸ hbp₁)).elim) + +private theorem cellWarp_le_warpAt_of_two_changed_cells + {α β : Type*} {G : Hypergraph α β} (π : Portrayal G) {Θ c₀ c₁ : Set π.S} + {newWarp : Set π.S → ℕ} + (hcuff₀ : ∀ Θ' ∈ cuffs π.S, (c₀ ∩ Θ').Nonempty → Θ' = Θ) + (hcuff₁ : ∀ Θ' ∈ cuffs π.S, (c₁ ∩ Θ').Nonempty → Θ' = Θ) + (hcw'_c₀ : newWarp c₀ ≤ π.warpAt Θ) (hcw'_c₁ : newWarp c₁ ≤ π.warpAt Θ) + (hcw'_other : ∀ d ∈ π.Γ.C \ {c₀, c₁}, (d ∩ bd π.S).Nonempty → + newWarp d = π.cellWarp d) : + ∀ Θ' ∈ cuffs π.S, ∀ d ∈ π.Γ.C, (d ∩ Θ').Nonempty → newWarp d ≤ π.warpAt Θ' := by + intro Θ' hΘ' + have hΘ'_bd : Θ' ⊆ bd π.S := by + rcases hΘ' with ⟨x', _, rfl⟩; exact connectedComponentIn_subset _ x' + intro d hd hd_Θ' + by_cases hd_c₀ : d = c₀ + · rw [hd_c₀] at hd_Θ' ⊢ + have hΘ'_eq : Θ' = Θ := hcuff₀ Θ' hΘ' hd_Θ' + rw [hΘ'_eq]; exact hcw'_c₀ + · by_cases hd_c₁ : d = c₁ + · rw [hd_c₁] at hd_Θ' ⊢ + have hΘ'_eq : Θ' = Θ := hcuff₁ Θ' hΘ' hd_Θ' + rw [hΘ'_eq]; exact hcw'_c₁ + · have hd_diff : d ∈ π.Γ.C \ {c₀, c₁} := + ⟨hd, by rintro (h | h) <;> [exact hd_c₀ h; exact hd_c₁ h]⟩ + have hbd_d : (d ∩ bd π.S).Nonempty := hd_Θ'.mono (inter_subset_inter_right _ hΘ'_bd) + rw [hcw'_other d hd_diff hbd_d] + exact π.cellWarp_le_warpAt hd hd_Θ' + +private theorem reassigned_cell_graphs_le + {α β : Type*} {G : Hypergraph α β} (π : Portrayal G) + {c₀ c₁ : Set π.S} (hc₁ : c₁ ∈ π.Γ.C) {A₁ A₂ : Hypergraph α β} + {cellG' : Set π.S → Hypergraph α β} (hcellG'_c₀ : cellG' c₀ = A₂) + (hcellG'_c₁ : cellG' c₁ = A₁ ∪ π.cellGraph c₁) + (hcellG'_other : ∀ c ∈ π.Γ.C \ {c₀, c₁}, cellG' c = π.cellGraph c) + (hA₁_le_G : A₁ ≤ G) (hA₂_le_G : A₂ ≤ G) : + ∀ c ∈ π.Γ.C, cellG' c ≤ G := by + intro c hc + by_cases hc_c₀ : c = c₀ + · rw [hc_c₀, hcellG'_c₀]; exact hA₂_le_G + · by_cases hc_c₁ : c = c₁ + · rw [hc_c₁, hcellG'_c₁]; exact union_le hA₁_le_G (π.cellGraph_le c₁ hc₁) + · rw [hcellG'_other c ⟨hc, by rintro (rfl | rfl) <;> contradiction⟩] + exact π.cellGraph_le c hc + +private theorem repeated_node_not_in_order + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) : + ∀ {Θ₁ : Set π.S} {a b d_n : π.S}, a ≠ b → d_n ≠ a → GM19.InOrderOn Θ₁ a b a d_n → False := by + intro Θ₁ a b d_n hab hda hord + obtain ⟨f, t₁, t₂, t₃, t₄, ht12, ht23, ht34, ht41, h1, h2, h3, h4⟩ := hord + have hlt12 : t₁ < t₂ := lt_of_le_of_ne ht12 fun h => hab (h1.symm.trans (h ▸ h2)) + have hlt41 : t₄ < t₁ + 2 * Real.pi := lt_of_le_of_ne ht41 fun h => + hda (h4.symm.trans ((h ▸ cuffPoint_add_two_pi f t₁).trans h1)) + have h13 : GM19.cuffPoint f t₁ = GM19.cuffPoint f t₃ := h1.trans h3.symm + have hEq := cuffPoint_injOn_Ico f t₁ ⟨le_rfl, by linarith⟩ ⟨by linarith, by linarith⟩ h13 + linarith + +private theorem separator_size_le_warp + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} + {n₁ : π.S} + (A₁ : Hypergraph α β) + (A₂ : Hypergraph α β) + (hlt_q : ((A₁ ∩ A₂).vertexSet \ {π.nodeVertex n₁}).ncard < π.warpAt Θ) + (hinter_fin : (A₁.vertexSet ∩ A₂.vertexSet).Finite) : + (A₁.vertexSet ∩ A₂.vertexSet).ncard ≤ π.warpAt Θ := by + have hsub : A₁.vertexSet ∩ A₂.vertexSet ⊆ + insert (π.nodeVertex n₁) ((A₁ ∩ A₂).vertexSet \ {π.nodeVertex n₁}) := by + intro x hx + by_cases hEq : x = π.nodeVertex n₁ + · exact Or.inl hEq + · exact Or.inr ⟨hx, hEq⟩ + have hfin_diff : ((A₁ ∩ A₂).vertexSet \ {π.nodeVertex n₁}).Finite := + hinter_fin.subset sdiff_subset + have h1 := ncard_le_ncard hsub (hfin_diff.insert _) + have h2 := ncard_insert_le (π.nodeVertex n₁) ((A₁ ∩ A₂).vertexSet \ {π.nodeVertex n₁}) + omega + +private theorem split_border_plus_eq_separator + {α : Type u} + {β : Type v} + {G : Hypergraph α β} + (π : Portrayal G) + {Θ : Set π.S} + {n₁ : π.S} + (hdom : π.domγ = π.Γ.N) + (hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ) + (A₁ : Hypergraph α β) + (A₂ : Hypergraph α β) + (hn₁_mem_inter : π.nodeVertex n₁ ∈ A₁.vertexSet ∩ A₂.vertexSet) + (bs' : π.S → Set α) + (hbs'_n₁ : bs' n₁ = (A₁.vertexSet ∩ A₂.vertexSet) \ {π.nodeVertex n₁}) : + (fun n => {v | v ∈ bs' n ∨ n ∈ π.domγ ∧ v = π.nodeVertex n}) n₁ = A₁.vertexSet ∩ A₂.vertexSet + := by + ext x + simp only [hbs'_n₁, mem_ofPred_eq, mem_sdiff, mem_inter_iff, mem_singleton_iff, + hdom ▸ hn₁_Θ.1, true_and] + constructor + · rintro (⟨hx, _⟩ | rfl) + · exact hx + · exact hn₁_mem_inter + · intro hx + by_cases hEq : x = π.nodeVertex n₁ + · exact Or.inr hEq + · exact Or.inl ⟨hx, hEq⟩ + +theorem claim_9_6 + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {Θ c₀ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (hc₀ : c₀ ∈ π.Γ.C) (hc₀_Θ : (c₀ ∩ Θ).Nonempty) + {n₁ n₂ : π.S} (hn₁_tc : n₁ ∈ tilde c₀) (hn₂_tc : n₂ ∈ tilde c₀) (hne : n₁ ≠ n₂) : + HasDisjointPathsAvoiding (π.cellGraph c₀) (π.borderSet n₁) (π.borderPlus n₂) + {π.nodeVertex n₁} (π.warpAt Θ) := by + classical + have : T2Space π.S := π.isSurface.2.1 + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof + h𝒯 π htrue hred hwarp hθ + obtain ⟨_, _, hnode_cell⟩ := + theorem_8_2_proof + h𝒯 π htrue hred hwarp hθ + have hsub_cuff₀ := π.Γ.border_cell_subset_cuff hc₀ hΘ hc₀_Θ + have hbd₀ : (c₀ ∩ bd π.S).Nonempty := hsub_cuff₀.2.1 ▸ hc₀_Θ + obtain ⟨u₀, v₀, huv_ne, htc₀_uv, hL₀, hL₀_int, _, _⟩ := π.Γ.border_cell_exists_ends hc₀ hbd₀ + have htc₀ : tilde c₀ = {n₁, n₂} := by + refine (eq_of_subset_of_ncard_le ?_ ?_ (π.Γ.finite_tilde_cell hc₀)).symm + · rintro x (rfl | rfl) <;> assumption + · rw [htc₀_uv, ncard_pair huv_ne, ncard_pair hne] + have hΘ_bd : Θ ⊆ bd π.S := + let ⟨x, _, heq⟩ := hΘ + heq ▸ connectedComponentIn_subset (bd π.S) x + have hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ := hsub_cuff₀.2.2.2.1 hn₁_tc + have hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ := hsub_cuff₀.2.2.2.1 hn₂_tc + have hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S := ⟨hn₁_Θ.1, hΘ_bd hn₁_Θ.2⟩ + have hbs₁_sub : π.borderSet n₁ ⊆ (π.cellGraph c₀).vertexSet := + π.p3_subset c₀ hc₀ hbd₀ n₁ hn₁_tc + have hbp₂_sub : π.borderPlus n₂ ⊆ (π.cellGraph c₀).vertexSet := + π.borderPlus_subset_cellGraph hc₀ hbd₀ hn₂_tc + have hn₁_in_c₀ : π.nodeVertex n₁ ∈ (π.cellGraph c₀).vertexSet := + π.p2 c₀ hc₀ n₁ ⟨hn₁_tc, hdom ▸ hn₁_Θ.1⟩ + rw [hasDisjointPathsAvoiding_iff_forall_isSeparation (π.cellGraph c₀) + hbs₁_sub hbp₂_sub (singleton_subset_iff.mpr hn₁_in_c₀) (π.warpAt Θ)] + intro A₁ A₂ hsep hA₁_sub hA₂_sub + by_contra hlt_q + push Not at hlt_q + have hbp₁_A₁ : π.borderPlus n₁ ⊆ A₁.vertexSet := by + rintro x (hx | ⟨_, rfl⟩) + · exact hA₁_sub (Or.inl hx) + · exact hA₁_sub (Or.inr rfl) + have hbp₂_A₂ : π.borderPlus n₂ ⊆ A₂.vertexSet := + fun x hx => hA₂_sub (Or.inl hx) + have hn₁_mem_inter : π.nodeVertex n₁ ∈ A₁.vertexSet ∩ A₂.vertexSet := + ⟨hA₁_sub (Or.inr rfl), hA₂_sub (Or.inr rfl)⟩ + obtain ⟨c₁, hc₁, hc₁_Θ, hc₁_ne_c₀, n₃, hne₁₃, htc₁, hd_iff, hneighbors⟩ := + exists_other_border_cell_of_mem_tilde π hΘ hc₀ hc₀_Θ hne htc₀ + have hsub_cuff₁ := π.Γ.border_cell_subset_cuff hc₁ hΘ hc₁_Θ + have hbd₁ : (c₁ ∩ bd π.S).Nonempty := hsub_cuff₁.2.1 ▸ hc₁_Θ + have hn₁_tc₁ : n₁ ∈ tilde c₁ := htc₁ ▸ Or.inl rfl + have hn₃_tc₁ : n₃ ∈ tilde c₁ := htc₁ ▸ Or.inr rfl + have hn₃_Θ : n₃ ∈ π.Γ.N ∩ Θ := hsub_cuff₁.2.2.2.1 hn₃_tc₁ + let cellG' : Set π.S → Hypergraph α β := fun c => + if c = c₀ then A₂ else if c = c₁ then A₁ ∪ π.cellGraph c₁ else π.cellGraph c + let bs' : π.S → Set α := fun n => + if n = n₁ then (A₁.vertexSet ∩ A₂.vertexSet) \ {π.nodeVertex n₁} else π.borderSet n + let bp' : π.S → Set α := fun n => + {v | v ∈ bs' n ∨ (n ∈ π.domγ ∧ v = π.nodeVertex n)} + have hbp_def : bp' = fun n => {v | v ∈ bs' n ∨ n ∈ π.domγ ∧ v = π.nodeVertex n} := rfl + have hcellG'_c₀ : cellG' c₀ = A₂ := by simp [cellG'] + have hcellG'_c₁ : cellG' c₁ = A₁ ∪ π.cellGraph c₁ := by simp [cellG', hc₁_ne_c₀] + have hcellG'_other : ∀ c ∈ π.Γ.C \ {c₀, c₁}, cellG' c = π.cellGraph c := by + rintro c ⟨_, hc_not⟩ + have hc₀' : c ≠ c₀ := fun h => hc_not (Or.inl h) + have hc₁' : c ≠ c₁ := fun h => hc_not (Or.inr h) + simp [cellG', hc₀', hc₁'] + have hbs'_n₁ : bs' n₁ = (A₁.vertexSet ∩ A₂.vertexSet) \ {π.nodeVertex n₁} := by simp [bs'] + have hbs'_other : ∀ n ≠ n₁, bs' n = π.borderSet n := fun n hn => by simp [bs', hn] + have hbp'_n₁ : bp' n₁ = A₁.vertexSet ∩ A₂.vertexSet := + split_border_plus_eq_separator π hdom hn₁_Θ A₁ A₂ hn₁_mem_inter bs' hbs'_n₁ + have hbp'_other : ∀ n ≠ n₁, bp' n = π.borderPlus n := + fun n hn => by simp [bp', Portrayal.borderPlus, hbs'_other n hn] + have hA₁_le_G : A₁ ≤ G := hsep.left_le.trans (π.cellGraph_le c₀ hc₀) + have hA₂_le_G : A₂ ≤ G := hsep.right_le.trans (π.cellGraph_le c₀ hc₀) + have hcellG'_le : ∀ c ∈ π.Γ.C, cellG' c ≤ G := + reassigned_cell_graphs_le π hc₁ hcellG'_c₀ hcellG'_c₁ hcellG'_other hA₁_le_G hA₂_le_G + have hw_c₀_other : ∀ w ∈ (π.cellGraph c₀).vertexSet, + ∀ d ∈ π.Γ.C \ {c₀, c₁}, w ∈ (π.cellGraph d).vertexSet → + w ∈ bp' n₁ ∨ w ∈ π.borderPlus n₂ ∨ w ∈ π.borderPlus n₃ := by + exact other_cell_vertices_on_boundary (α := α) (β := β) (G := G) π (Θ := Θ) (c₀ := c₀) hΘ hc₀ + hc₀_Θ (n₁ := n₁) (n₂ := n₂) hn₁_tc hne hdom hsub_cuff₀ hbd₀ htc₀ hΘ_bd hn₁_Θ hn₂_Θ hn₁_bd + hbs₁_sub hn₁_in_c₀ A₁ A₂ hA₁_sub hA₂_sub hlt_q hbp₁_A₁ hn₁_mem_inter c₁ hc₁_Θ n₃ hne₁₃ htc₁ + hd_iff hneighbors hsub_cuff₁ hn₁_tc₁ hn₃_Θ bs' bp' hbs'_n₁ hbs'_other hbp'_n₁ hbp'_other + have h_inOrder_eq := @repeated_node_not_in_order α β G π + let π' : Portrayal G := + split_adjacent_border_cells_portrayal (α := α) (β := β) (G := G) π (Θ := Θ) (c₀ := c₀) hΘ hc₀ + hc₀_Θ (n₁ := n₁) (n₂ := n₂) hn₁_tc hn₂_tc hne hdom hnode_cell hsub_cuff₀ hbd₀ u₀ v₀ htc₀_uv + hL₀ hL₀_int htc₀ hΘ_bd hn₁_Θ hn₂_Θ hbs₁_sub hbp₂_sub hn₁_in_c₀ A₁ A₂ hsep hlt_q hbp₁_A₁ + hbp₂_A₂ hn₁_mem_inter c₁ hc₁ hc₁_Θ hc₁_ne_c₀ n₃ hne₁₃ htc₁ hd_iff hneighbors hsub_cuff₁ hbd₁ + hn₁_tc₁ hn₃_tc₁ hn₃_Θ cellG' bs' bp' hbp_def hcellG'_c₀ hcellG'_c₁ hcellG'_other hbs'_n₁ + hbs'_other + hbp'_n₁ hbp'_other hA₁_le_G hcellG'_le hw_c₀_other h_inOrder_eq + have hbp₁_fin : (π.borderPlus n₁).Finite := + (π.cellGraph c₀).vertexSet_finite.subset (π.borderPlus_subset_cellGraph hc₀ hbd₀ hn₁_tc) + have hbp₂_fin : (π.borderPlus n₂).Finite := + (π.cellGraph c₀).vertexSet_finite.subset hbp₂_sub + have hbp₃_fin : (π.borderPlus n₃).Finite := + (π.cellGraph c₁).vertexSet_finite.subset (π.borderPlus_subset_cellGraph hc₁ hbd₁ hn₃_tc₁) + have hinter_fin : (A₁.vertexSet ∩ A₂.vertexSet).Finite := + A₁.vertexSet_finite.subset inter_subset_left + have hinter_le_q : (A₁.vertexSet ∩ A₂.vertexSet).ncard ≤ π.warpAt Θ := by + exact separator_size_le_warp π A₁ A₂ hlt_q hinter_fin + have hw_le : π.warpAt Θ ≤ p := (π.warpAt_le_warp hΘ).trans hwarp + have hπ'_central : π'.IsCentral 𝒯 := by + exact merged_border_cell_graphs_are_small π hΘ hc₀ hc₁ hbd₀ hbd₁ htc₀ htc₁ hn₁_Θ hn₂_Θ hn₃_Θ + hsep hA₁_le_G hcellG'_c₀ hcellG'_c₁ hcellG'_other h𝒯 htrue hθ hbp₁_fin hbp₂_fin hbp₃_fin + hinter_fin hinter_le_q hw_le + have hΘ_arc : IsOArc Θ := (cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + have hbs₂_le : (π.borderSet n₂).ncard ≤ π.warpAt Θ := + π.ncard_borderSet_le_warpAt hΘ hΘ_arc hn₂_Θ + have hbs₃_le : (π.borderSet n₃).ncard ≤ π.warpAt Θ := + π.ncard_borderSet_le_warpAt hΘ hΘ_arc hn₃_Θ + have hbs'₁_le : (bs' n₁).ncard ≤ π.warpAt Θ := by + rw [hbs'_n₁] + change ((A₁.vertexSet ∩ A₂.vertexSet) \ {π.nodeVertex n₁}).ncard < π.warpAt Θ at hlt_q + omega + have hbp'₁_le : (bp' n₁).ncard ≤ π.warpAt Θ := by + rw [hbp'_n₁]; exact hinter_le_q + have hcw'_c₀ : π'.cellWarp c₀ ≤ π.warpAt Θ := by + exact cellWarp_le_of_small_borderPlus π' htc₀ hbs'₁_le + (show (bs' n₂).ncard ≤ π.warpAt Θ by rwa [hbs'_other n₂ hne.symm]) + hbp'₁_le + have hcw'_c₁ : π'.cellWarp c₁ ≤ π.warpAt Θ := by + exact cellWarp_le_of_small_borderPlus π' htc₁ hbs'₁_le + (show (bs' n₃).ncard ≤ π.warpAt Θ by rwa [hbs'_other n₃ hne₁₃.symm]) + hbp'₁_le + have hcw'_other : ∀ d ∈ π.Γ.C \ {c₀, c₁}, (d ∩ bd π.S).Nonempty → + π'.cellWarp d = π.cellWarp d := by + rintro d ⟨hd, hd_not_cells⟩ hbd_d + change sInf {p | π'.CellWarpLE d p} = sInf {p | π.CellWarpLE d p} + congr 1; ext q + change (∀ u₁ ∈ tilde d, ∀ u₂ ∈ tilde d, u₁ ≠ u₂ → _) ↔ + (∀ u₁ ∈ tilde d, ∀ u₂ ∈ tilde d, u₁ ≠ u₂ → _) + refine forall₂_congr fun u₁ hu₁ => forall₂_congr fun u₂ hu₂ => imp_congr_right fun _ => ?_ + have hu₁_ne : u₁ ≠ n₁ := fun h => hd_not_cells ((hd_iff d hd hbd_d).mp (h ▸ hu₁)) + have hu₂_ne : u₂ ≠ n₁ := fun h => hd_not_cells ((hd_iff d hd hbd_d).mp (h ▸ hu₂)) + change ((bs' u₁).ncard ≤ q ∧ (bs' u₂).ncard ≤ q ∧ + ((bp' u₁).ncard = q + 1 → (bp' u₂).ncard = q + 1 → + Portrayal.LinkagePairs (cellG' d).skeleton (bp' u₁) (bp' u₂) (q + 1) + (π.nodeVertex u₁) (π.nodeVertex u₂))) ↔ _ + have hbp₁ : bp' u₁ = π.borderPlus u₁ := hbp'_other u₁ hu₁_ne + have hbp₂ : bp' u₂ = π.borderPlus u₂ := hbp'_other u₂ hu₂_ne + rw [hbp₁, hbp₂, hbs'_other u₁ hu₁_ne, hbs'_other u₂ hu₂_ne, hcellG'_other d ⟨hd, hd_not_cells⟩] + have hwarpAt_le : ∀ Θ' ∈ cuffs π.S, π'.warpAt Θ' ≤ π.warpAt Θ' := by + intro Θ' hΘ' + rw [π'.warpAt_le_iff] + exact cellWarp_le_warpAt_of_two_changed_cells π hsub_cuff₀.2.2.2.2 hsub_cuff₁.2.2.2.2 + hcw'_c₀ hcw'_c₁ hcw'_other Θ' hΘ' + have hwarpAt_eq : ∀ Θ' ∈ cuffs π.S, π'.warpAt Θ' = π.warpAt Θ' := by + intro Θ' hΘ' + refine le_antisymm (hwarpAt_le Θ' hΘ') ?_ + by_contra hlt + have hsimpler : π'.IsSimpler π := by + right + refine ⟨Homeomorph.refl π.S, ?_, Θ', hΘ', ?_⟩ + · intro Θ'' hΘ'' + rw [Homeomorph.refl_apply, image_id] + exact hwarpAt_le Θ'' hΘ'' + · rw [Homeomorph.refl_apply, image_id] + exact lt_of_not_ge hlt + exact htrue.2.1 π' hπ'_central hsimpler + have hwarp'_eq : π'.warp = π.warp := by + change (if (cuffs π.S).Nonempty then max 1 (sSup {p | ∃ Θ' ∈ cuffs π.S, p + = π'.warpAt Θ'}) else 1) = + (if (cuffs π.S).Nonempty then max 1 (sSup {p | ∃ Θ' ∈ cuffs π.S, p = π.warpAt Θ'}) else 1) + congr 2; congr 1; ext q + exact exists_congr fun Θ' => and_congr_right fun hΘ' => by rw [hwarpAt_eq Θ' hΘ'] + have hsimpler_iff : ∀ {G' : Hypergraph α β} (π'' : Portrayal G'), + π''.IsSimpler π' ↔ π''.IsSimpler π := by + intro G' π'' + change ((IsSimplerThan π''.S π.S ∧ π''.warp ≤ π'.warp) ∨ + ∃ ψ : π''.S ≃ₜ π.S, (∀ Θ' ∈ cuffs π''.S, π''.warpAt Θ' ≤ π'.warpAt (ψ '' Θ')) ∧ + ∃ Θ' ∈ cuffs π''.S, π''.warpAt Θ' < π'.warpAt (ψ '' Θ')) ↔ + ((IsSimplerThan π''.S π.S ∧ π''.warp ≤ π.warp) ∨ + ∃ ψ : π''.S ≃ₜ π.S, (∀ Θ' ∈ cuffs π''.S, π''.warpAt Θ' ≤ π.warpAt (ψ '' Θ')) ∧ + ∃ Θ' ∈ cuffs π''.S, π''.warpAt Θ' < π.warpAt (ψ '' Θ')) + rw [hwarp'_eq] + refine or_congr Iff.rfl (exists_congr fun ψ => ?_) + have hψ_cuff : ∀ Θ' ∈ cuffs π''.S, ψ '' Θ' ∈ cuffs π.S := + fun Θ' hΘ' => image_cuff_mem_cuffs ψ hΘ' + refine and_congr (forall₂_congr fun Θ' hΘ' => ?_) + (exists_congr fun Θ' => and_congr_right fun hΘ' => ?_) + · rw [hwarpAt_eq (ψ '' Θ') (hψ_cuff Θ' hΘ')] + · rw [hwarpAt_eq (ψ '' Θ') (hψ_cuff Θ' hΘ')] + have htruer_iff : ∀ π'' : Portrayal G, π''.IsTruer π' ↔ π''.IsTruer π := fun _ => Iff.rfl + have hres_iff : ∀ π'' : Portrayal G, π''.Resembles π' ↔ π''.Resembles π := by + intro π'' + refine exists_congr fun ψ => forall₂_congr fun Θ' hΘ' => ?_ + rw [hwarpAt_eq (ψ '' Θ') (image_cuff_mem_cuffs ψ hΘ')] + have hπ'_true : π'.IsTrue 𝒯 := + ⟨hπ'_central, + fun π'' hcent hsimp => htrue.2.1 π'' hcent ((hsimpler_iff π'').mp hsimp), + fun π'' hcent htr hres => + htrue.2.2 π'' hcent ((htruer_iff π'').mp htr) ((hres_iff π'').mp hres)⟩ + have hπ'_red : π'.IsRedundant 𝒯 θ (2 * p + 3) := + ⟨hred.1, fun Z hZ hZ_le π'' hcent hsimp => + hred.2 Z hZ hZ_le π'' hcent ((hsimpler_iff π'').mp hsimp)⟩ + have hπ'_warp : π'.warp ≤ p := hwarp'_eq ▸ hwarp + have h94 := theorem_9_4_proof h𝒯 π' hπ'_true hπ'_red hπ'_warp hθ hΘ hn₁_Θ + change (bs' n₁).ncard = π'.warpAt Θ at h94 + rw [hbs'_n₁, hwarpAt_eq Θ hΘ] at h94 + exact hlt_q.ne h94 + +/-- **Graph Minors XVII, (9.6)** (page 186): +"Let $c_0$ be a cell bordering a cuff $\Theta$ with $\tilde{c}_0 = \{n_1, n_2\}$, and let $\pi$ +have warp $q$ at $\Theta$. Then there are $q$ mutually vertex-disjoint paths of $\alpha(c_0)^*$ +from $\beta(n_1)$ to $\beta(n_2)$, each containing neither $\gamma(n_1)$ nor $\gamma(n_2)$." -/ +theorem theorem_9_6_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {Θ c₀ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (hc₀ : c₀ ∈ π.Γ.C) (hc₀_Θ : (c₀ ∩ Θ).Nonempty) + {n₁ n₂ : π.S} (hn₁_tc : n₁ ∈ tilde c₀) (hn₂_tc : n₂ ∈ tilde c₀) (hne : n₁ ≠ n₂) : + ∃ L : Fin (π.warpAt Θ) → + PathFromTo (π.cellGraph c₀).skeleton (π.borderSet n₁) (π.borderSet n₂), + (Pairwise fun i j ↦ Disjoint {z | z ∈ (L i).walk.support} {z | z ∈ (L j).walk.support}) ∧ + ∀ i, π.nodeVertex n₁ ∉ (L i).walk.support ∧ π.nodeVertex n₂ ∉ (L i).walk.support := by + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof + h𝒯 π htrue hred hwarp hθ + have hsub_cuff₀ := π.Γ.border_cell_subset_cuff hc₀ hΘ hc₀_Θ + have hbd₀ : (c₀ ∩ bd π.S).Nonempty := hsub_cuff₀.2.1 ▸ hc₀_Θ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ := hsub_cuff₀.2.2.2.1 hn₁_tc + have hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ := hsub_cuff₀.2.2.2.1 hn₂_tc + have hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S := ⟨hn₁_Θ.1, hΘ_bd hn₁_Θ.2⟩ + have hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S := ⟨hn₂_Θ.1, hΘ_bd hn₂_Θ.2⟩ + have hbs₁_eq : (π.borderSet n₁).ncard = π.warpAt Θ := + theorem_9_4_proof h𝒯 π htrue hred hwarp hθ hΘ hn₁_Θ + have hbs₂_eq : (π.borderSet n₂).ncard = π.warpAt Θ := + theorem_9_4_proof h𝒯 π htrue hred hwarp hθ hΘ hn₂_Θ + have hbp₁_sub : π.borderPlus n₁ ⊆ (π.cellGraph c₀).vertexSet := + π.borderPlus_subset_cellGraph hc₀ hbd₀ hn₁_tc + have hbp₂_sub : π.borderPlus n₂ ⊆ (π.cellGraph c₀).vertexSet := + π.borderPlus_subset_cellGraph hc₀ hbd₀ hn₂_tc + have hbs₁_sub_bp₁ : π.borderSet n₁ ⊆ π.borderPlus n₁ := fun _ h => Or.inl h + have hbs₂_sub_bp₂ : π.borderSet n₂ ⊆ π.borderPlus n₂ := fun _ h => Or.inl h + have hdiff₁ : π.borderPlus n₁ \ π.borderSet n₁ = {π.nodeVertex n₁} := by + ext x + simp only [Portrayal.borderPlus, mem_sdiff, mem_ofPred_eq, mem_singleton_iff, + hdom ▸ hn₁_Θ.1, true_and] + exact ⟨fun ⟨hx, hnot⟩ => hx.elim (fun h => (hnot h).elim) id, + fun hEq => ⟨Or.inr hEq, hEq ▸ π.p3_notMem n₁ ⟨hdom ▸ hn₁_bd.1, hn₁_bd.2⟩⟩⟩ + have hdiff₂ : π.borderPlus n₂ \ π.borderSet n₂ = {π.nodeVertex n₂} := by + ext x + simp only [Portrayal.borderPlus, mem_sdiff, mem_ofPred_eq, mem_singleton_iff, + hdom ▸ hn₂_Θ.1, true_and] + exact ⟨fun ⟨hx, hnot⟩ => hx.elim (fun h => (hnot h).elim) id, + fun hEq => ⟨Or.inr hEq, hEq ▸ π.p3_notMem n₂ ⟨hdom ▸ hn₂_bd.1, hn₂_bd.2⟩⟩⟩ + have hc₁ : HasDisjointPathsAvoiding (π.cellGraph c₀) (π.borderSet n₁) (π.borderPlus n₂) + (π.borderPlus n₁ \ π.borderSet n₁) (π.warpAt Θ) := by + rw [hdiff₁] + exact claim_9_6 h𝒯 π htrue hred hwarp hθ hΘ hc₀ hc₀_Θ hn₁_tc hn₂_tc hne + have hc₂ : HasDisjointPathsAvoiding (π.cellGraph c₀) (π.borderPlus n₁) (π.borderSet n₂) + (π.borderPlus n₂ \ π.borderSet n₂) (π.warpAt Θ) := by + rw [hdiff₂] + exact hasDisjointPathsAvoiding_symm (π.cellGraph c₀) (π.borderSet n₂) (π.borderPlus n₁) + {π.nodeVertex n₂} (π.warpAt Θ) + (claim_9_6 h𝒯 π htrue hred hwarp hθ hΘ hc₀ hc₀_Θ hn₂_tc hn₁_tc hne.symm) + rcases theorem_9_5_proof (π.cellGraph c₀) hbp₁_sub hbp₂_sub hbs₁_sub_bp₁ hbs₂_sub_bp₂ + hc₁ hc₂ with ⟨L, hdisj, havoid⟩ | hpaths + · rw [hdiff₁, hdiff₂] at havoid + refine ⟨L, hdisj, fun i => ?_⟩ + exact ⟨fun h1 => Set.disjoint_left.mp (havoid i) h1 (Or.inl rfl), + fun h2 => Set.disjoint_left.mp (havoid i) h2 (Or.inr rfl)⟩ + · obtain ⟨L, hL_disj, hL_avoid, _⟩ := + extract_linkage_from_plus_linkage π hdom hΘ hc₀ hc₀_Θ hn₁_tc hn₂_tc hne + hbs₁_eq hbs₂_eq hpaths + exact ⟨L, hL_disj, hL_avoid⟩ + +/-- **Graph Minors XVII, (9.7)** (page 187): +"For every border node $n$, $\beta(n) \cap \gamma(N(\Gamma)) = \emptyset$." -/ +theorem theorem_9_7_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {n : π.S} (hn : n ∈ π.Γ.N ∩ bd π.S) : + Disjoint (π.borderSet n) (π.nodeVertex '' π.Γ.N) := by + have : T2Space π.S := π.isSurface.2.1 + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof + h𝒯 π htrue hred hwarp hθ + refine Set.disjoint_left.mpr ?_ + rintro v hvn ⟨n', hn'_N, rfl⟩ + let Θ := connectedComponentIn (bd π.S) n + have hΘ : Θ ∈ cuffs π.S := ⟨n, hn.2, rfl⟩ + have hΘ_arc : IsOArc Θ := (cuff_statement.{0} π.S π.isSurface).2.2 Θ hΘ + have hΘ_bd : Θ ⊆ bd π.S := connectedComponentIn_subset (bd π.S) n + have hn_Θ : n ∈ π.Γ.N ∩ Θ := ⟨hn.1, mem_connectedComponentIn hn.2⟩ + have hn'_in_Θ : n' ∈ Θ := by + by_contra hn'_not_Θ + exact π.p4_notMem Θ hΘ n hn_Θ n' (hdom ▸ hn'_N) hn'_not_Θ hvn + have hn'_Θ : n' ∈ π.Γ.N ∩ Θ := ⟨hn'_N, hn'_in_Θ⟩ + have hn'_bd : n' ∈ π.Γ.N ∩ bd π.S := ⟨hn'_N, hΘ_bd hn'_in_Θ⟩ + have hn_ne_n' : n ≠ n' := by + rintro rfl + exact π.p3_notMem n ⟨hdom ▸ hn.1, hn.2⟩ hvn + set k := (π.Γ.N ∩ Θ).ncard + obtain ⟨E⟩ : Nonempty (π.Γ.CuffEnumeration Θ k) := π.Γ.exists_cuffEnumeration hΘ hΘ_arc + have hk_ge2 : 2 ≤ k := E.two_le + have hk_pos : 0 < k := by omega + have hn'_range : n' ∈ range E.node := E.range_node ▸ hn'_Θ + rcases hn'_range with ⟨idx, hidx_eq⟩ + let idx' : Fin k := ⟨(idx.1 + 1) % k, Nat.mod_lt _ hk_pos⟩ + have hidx_ne : idx ≠ idx' := by + intro hEq + have hval : idx.1 = (idx.1 + 1) % k := congrArg Fin.val hEq + have hi_lt : idx.1 < k := idx.2 + by_cases hlast : idx.1 + 1 = k + · rw [hlast, Nat.mod_self] at hval; omega + · rw [Nat.mod_eq_of_lt (by omega)] at hval; omega + let c₀ := E.cell idx + let n₂ := E.node idx' + have hc₀_mem : c₀ ∈ {c ∈ π.Γ.C | (c ∩ Θ).Nonempty} := E.range_cell ▸ ⟨idx, rfl⟩ + have hc₀ : c₀ ∈ π.Γ.C := hc₀_mem.1 + have hc₀_Θ : (c₀ ∩ Θ).Nonempty := hc₀_mem.2 + have htc₀ : tilde c₀ = {n', n₂} := by + change tilde (E.cell idx) = {n', E.node idx'} + rw [E.cell_tilde idx, hidx_eq] + have hne_n'₂ : n' ≠ n₂ := by + rw [← hidx_eq] + exact E.injective_node.ne hidx_ne + obtain ⟨c₁, hc₁, hc₁_Θ, _, n₃, hne_n'₃, htc₁, _, hneighbors⟩ := + exists_other_border_cell_of_mem_tilde π hΘ hc₀ hc₀_Θ hne_n'₂ htc₀ + have hv_bp_n' : π.nodeVertex n' ∈ π.borderPlus n' := Or.inr ⟨hdom ▸ hn'_N, rfl⟩ + have hv_bp_n : π.nodeVertex n' ∈ π.borderPlus n := Or.inl hvn + have hcell_contra : ∀ (d : Set π.S) (u : π.S), + d ∈ π.Γ.C → (d ∩ Θ).Nonempty → n' ≠ u → tilde d = {n', u} → + π.nodeVertex n' ∈ π.borderPlus u → False := by + intro d u hd hd_Θ hne_u htd hv_u + have hu_Θ : u ∈ π.Γ.N ∩ Θ := + (π.Γ.border_cell_subset_cuff hd hΘ hd_Θ).2.2.2.1 (htd ▸ Or.inr rfl) + have hbd_d : (d ∩ bd π.S).Nonempty := hd_Θ.mono (inter_subset_inter_right _ hΘ_bd) + have hv_bs_u : π.nodeVertex n' ∈ π.borderSet u := by + rcases hv_u with hbs | ⟨_, hEq⟩ + · exact hbs + · exfalso + exact hne_u (π.nodeVertex_injOn (hdom ▸ hn'_N) (hdom ▸ hu_Θ.1) hEq) + have hbs_u_eq : (π.borderSet u).ncard = π.warpAt Θ := + theorem_9_4_proof h𝒯 π htrue hred hwarp hθ hΘ hu_Θ + have hbs_u_fin : (π.borderSet u).Finite := + (π.cellGraph d).vertexSet_finite.subset (π.p3_subset d hd hbd_d u (htd ▸ Or.inr rfl)) + obtain ⟨L, hL_disj, hL_avoid⟩ := + theorem_9_6_proof h𝒯 π htrue hred hwarp hθ hΘ hd hd_Θ + (htd ▸ Or.inl rfl) (htd ▸ Or.inr rfl) hne_u + obtain ⟨j, hj_last⟩ := exists_last_eq_of_ncard_le hbs_u_fin hbs_u_eq.le L hL_disj hv_bs_u + have hv_sup : π.nodeVertex n' ∈ (L j).walk.support := by + rw [← hj_last] + exact (L j).walk.end_mem_support + exact (hL_avoid j).1 hv_sup + rcases hneighbors n hn_Θ hn_ne_n' (π.nodeVertex n') hv_bp_n' hv_bp_n with hv₂ | hv₃ + · exact hcell_contra c₀ n₂ hc₀ hc₀_Θ hne_n'₂ htc₀ hv₂ + · exact hcell_contra c₁ n₃ hc₁ hc₁_Θ hne_n'₃ htc₁ hv₃ + +/-- **Graph Minors XVII, (9.8)** (pages 187–188): +"Let $c_0$ be a border cell with $c_0 = \{n_1, n_2\}$. Then +(i) $|\beta(n_1)| = |\beta(n_2)| = q$ and +$\beta(n_1) \cap \gamma(N(\Gamma)), \beta(n_2) \cap \gamma(N(\Gamma)) = \emptyset$; ... +(ii) there is a linkage $\{P_1, \dots, P_q\}$ in $\alpha(c_0) \setminus \{\gamma(n_1), +\gamma(n_2)\}$ +from $\beta(n_1)$ to $\beta(n_2)$ such that either there is a path $P_0$ such that +$\{P_0, P_1, \dots, P_q\}$ is a linkage in $\alpha(c_0)$ from $\beta(n_1 +)$ to $\beta(n_2 +)$, +or there is an internal cell $c$ with $|\tilde{c}| = 3$ and $\tilde{c}_0 \subseteq \tilde{c}$." +(The paper writes $c_0 = \{n_1, n_2\}$ for $\tilde{c}_0 = \{n_1, n_2\}$.) -/ +theorem theorem_9_8_proof + {α : Type u} {β : Type v} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + (h𝒯 : IsTangle G θ 𝒯) (π : Portrayal G) + (htrue : π.IsTrue 𝒯) + (hred : π.IsRedundant 𝒯 θ (2 * p + 3)) + (hwarp : π.warp ≤ p) + (hθ : 4 * p + 5 < θ) + {Θ c₀ : Set π.S} (hΘ : Θ ∈ cuffs π.S) (hc₀ : c₀ ∈ π.Γ.C) (hc₀_Θ : (c₀ ∩ Θ).Nonempty) + {n₁ n₂ : π.S} (hn₁_tc : n₁ ∈ tilde c₀) (hn₂_tc : n₂ ∈ tilde c₀) (hne : n₁ ≠ n₂) : + (π.borderSet n₁).ncard = π.warpAt Θ ∧ + (π.borderSet n₂).ncard = π.warpAt Θ ∧ + Disjoint (π.borderSet n₁) (π.nodeVertex '' π.Γ.N) ∧ + Disjoint (π.borderSet n₂) (π.nodeVertex '' π.Γ.N) ∧ + ∃ L : Fin (π.warpAt Θ) → + PathFromTo (π.cellGraph c₀).skeleton (π.borderSet n₁) (π.borderSet n₂), + (Pairwise fun i j ↦ Disjoint {z | z ∈ (L i).walk.support} {z | z ∈ (L j).walk.support}) ∧ + (∀ i, π.nodeVertex n₁ ∉ (L i).walk.support ∧ π.nodeVertex n₂ ∉ (L i).walk.support) ∧ + ((∃ L₀ : PathFromTo (π.cellGraph c₀).skeleton {π.nodeVertex n₁} {π.nodeVertex n₂}, + ∀ i, Disjoint {z | z ∈ L₀.walk.support} {z | z ∈ (L i).walk.support}) ∨ + ∃ c ∈ π.Γ.C, ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 ∧ tilde c₀ ⊆ tilde c) := by + have hdom : π.domγ = π.Γ.N := + theorem_8_4_proof + h𝒯 π htrue hred hwarp hθ + have hsub_cuff₀ := π.Γ.border_cell_subset_cuff hc₀ hΘ hc₀_Θ + have hbd₀ : (c₀ ∩ bd π.S).Nonempty := hsub_cuff₀.2.1 ▸ hc₀_Θ + have hΘ_bd : Θ ⊆ bd π.S := by + rcases hΘ with ⟨x₀, _, rfl⟩ + exact connectedComponentIn_subset (bd π.S) x₀ + have hn₁_Θ : n₁ ∈ π.Γ.N ∩ Θ := hsub_cuff₀.2.2.2.1 hn₁_tc + have hn₂_Θ : n₂ ∈ π.Γ.N ∩ Θ := hsub_cuff₀.2.2.2.1 hn₂_tc + have hn₁_bd : n₁ ∈ π.Γ.N ∩ bd π.S := ⟨hn₁_Θ.1, hΘ_bd hn₁_Θ.2⟩ + have hn₂_bd : n₂ ∈ π.Γ.N ∩ bd π.S := ⟨hn₂_Θ.1, hΘ_bd hn₂_Θ.2⟩ + have hbs₁_eq : (π.borderSet n₁).ncard = π.warpAt Θ := + theorem_9_4_proof h𝒯 π htrue hred hwarp hθ hΘ hn₁_Θ + have hbs₂_eq : (π.borderSet n₂).ncard = π.warpAt Θ := + theorem_9_4_proof h𝒯 π htrue hred hwarp hθ hΘ hn₂_Θ + have hdisj₁ : Disjoint (π.borderSet n₁) (π.nodeVertex '' π.Γ.N) := + theorem_9_7_proof h𝒯 π htrue hred hwarp hθ hn₁_bd + have hdisj₂ : Disjoint (π.borderSet n₂) (π.nodeVertex '' π.Γ.N) := + theorem_9_7_proof h𝒯 π htrue hred hwarp hθ hn₂_bd + refine ⟨hbs₁_eq, hbs₂_eq, hdisj₁, hdisj₂, ?_⟩ + by_cases hex : ∃ c ∈ π.Γ.C, ¬ (c ∩ bd π.S).Nonempty ∧ tilde c₀ ⊆ tilde c + · rcases hex with ⟨c, hc, hint_c, hsub⟩ + have hc₀_ne_c : c₀ ≠ c := fun h => hint_c (h ▸ hbd₀) + have hcard3 : (tilde c).ncard = 3 := + (theorem_8_8_proof + h𝒯 π htrue hred hwarp hθ hc₀ hc hc₀_ne_c hsub).2 + obtain ⟨L, hL_disj, hL_avoid⟩ := + theorem_9_6_proof h𝒯 π htrue hred hwarp hθ hΘ hc₀ hc₀_Θ hn₁_tc hn₂_tc hne + exact ⟨L, hL_disj, hL_avoid, Or.inr ⟨c, hc, hint_c, hcard3, hsub⟩⟩ + · obtain ⟨hpaths, _, _⟩ := + theorem_9_3_proof h𝒯 π htrue hred hwarp hθ hΘ hc₀ hc₀_Θ hn₁_tc hn₂_tc hne hex + obtain ⟨L, hL_disj, hL_avoid, L₀, hL₀_disj⟩ := + extract_linkage_from_plus_linkage π hdom hΘ hc₀ hc₀_Θ hn₁_tc hn₂_tc hne + hbs₁_eq hbs₂_eq hpaths + exact ⟨L, hL_disj, hL_avoid, Or.inl ⟨L₀, hL₀_disj⟩⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Sector.lean b/LeanPool/GraphMinor/GM17/Sector.lean new file mode 100644 index 0000000000..210d3b7dde --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Sector.lean @@ -0,0 +1,322 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.BorderCells + +/-! +# Sectors of a region + +Two sides of a region at a node lie on the boundary of a closed disc that meets the paint only in +these two sides (`sector`). We push both sides into the region as strips and join the +strips by a line in the region. This gives a loop through one node, which bounds a disc by the +hypothesis on normal `O`-arcs of `RegionBoundaryOArcCriterionStatement`. If the two sides +also share their far end, a second loop at that end fills the rest of the region. These discs join +the two cells at a node in (8.7) of Graph Minors XVII (page 183), and the two border +cells at a node in (8.4) (page 182). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +/-- A disc that has a point off a second disc and misses the boundary of the second disc away from a +part `P` of its own boundary meets the second disc only in `P`. -/ +theorem disc_off [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) {St Δ P : Set S} + (hSt : IsClosedDisc St) (hP : P ⊆ discBd St) (hΔ : IsClosedDisc Δ) + (hd : ∀ z ∈ St, z ∉ P → z ∉ discBd Δ) + {w : S} (hw : w ∈ St) (hwP : w ∉ P) (hwΔ : w ∉ Δ) : + St ∩ Δ ⊆ P := by + have hY := Painting.isPreconnected_disc_diff hSt hP + have hdis : Disjoint (St \ P) (discBd Δ) := disjoint_left.mpr fun z hz => hd z hz.1 hz.2 + rcases hΔ.side hman hY hdis with h | h + · exact absurd (h ⟨hw, hwP⟩).1 hwΔ + · rintro z ⟨hz, hz'⟩ + by_contra hn + exact disjoint_left.mp h ⟨hz, hn⟩ hz' + +namespace Painting + +variable {Γ : Painting S} [T2Space S] + +omit [TopologicalSpace S] [T2Space S] in +omit [TopologicalSpace S] [T2Space S] in +private theorem subset_union_sdiff_of_inter_subset {A B C P Q : Set S} + (hA : A ⊆ B ∪ C) (hAQ : A ∩ Q ⊆ P) : A ⊆ (B ∪ C) \ (Q \ P) := + fun _ hx => ⟨hA hx, fun h => h.2 (hAQ ⟨hx, h.1⟩)⟩ + +private theorem filled_sector_meets_disc_in_joining_arc + {S : Type} + [TopologicalSpace S] + {Γ : Painting S} + [T2Space S] + {a : S} + {b₁ : S} + (hman : ∀ (x : S), IsManifoldPoint x) + (haN : a ∈ Γ.N) + (St₁ : Set S) + (γ₁ : Set S) + (hγ₁ : IsLineWithEnds γ₁ a b₁) + (St₂ : Set S) + (γ₂ : Set S) + (A₁ : Set S) + (x : S) + (y : S) + (β : Set S) + (hβ : IsLineWithEnds β y x) + (A' : Set S) + (R₁ : Set S) + (R₂ : Set S) + (hi'₁ : A₁ ∩ R₁ = {x}) + (hi'₂ : A' ∩ R₂ = {y}) + (hγ₁St : γ₁ ⊆ St₁) + (hγ₂St : γ₂ ⊆ St₂) + (Δ : Set S) + (hΔ : IsClosedDisc Δ) + (hA₁Δ : A₁ ⊆ discBd Δ) + (hβΔ : β ⊆ discBd Δ) + (haA₁ : a ∈ A₁) + (hS₁Δ : St₁ ∩ Δ ⊆ A₁) + (hS₂Δ : St₂ ∩ Δ ⊆ A') + (hR₁γ : R₁ ⊆ γ₁) + (hR₂γ : R₂ ⊆ γ₂) + (Δ₂ : Set S) + (hΔ₂ : IsClosedDisc Δ₂) + (hbΔ₂ : discBd Δ₂ = R₁ ∪ (R₂ ∪ β)) + (hΔ₂U : ∀ x ∈ Γ.U, x ≠ b₁ → x ∉ Δ₂) + (hβΔ₂ : β ⊆ discBd Δ₂) + (hhaβ : a ∉ β) : + Δ ∩ Δ₂ = β := by + apply subset_antisymm + · refine disc_off hman hΔ hβΔ hΔ₂ ?_ (discBd_subset Δ (hA₁Δ haA₁)) hhaβ + (hΔ₂U _ (Γ.N_subset haN) hγ₁.ne') + intro z hz hzβ h + rcases (hbΔ₂ ▸ h : z ∈ R₁ ∪ (R₂ ∪ β)) with h | h | h + · have h3 : z ∈ St₁ ∩ Δ := ⟨hγ₁St (hR₁γ h), hz⟩ + exact hzβ ((hi'₁.le ⟨hS₁Δ h3, h⟩ : z = x) ▸ hβ.right_mem) + · have h3 : z ∈ St₂ ∩ Δ := ⟨hγ₂St (hR₂γ h), hz⟩ + exact hzβ ((hi'₂.le ⟨hS₂Δ h3, h⟩ : z = y) ▸ hβ.left_mem) + · exact hzβ h + · exact fun z hz => ⟨discBd_subset Δ (hβΔ hz), discBd_subset Δ₂ (hβΔ₂ hz)⟩ + +/-- Two sides of a region at a node lie on the boundary of a closed disc that meets the paint only +in these sides. -/ +theorem sector [ConnectedSpace S] (hS : IsSurface S) (hΓ : Γ.Tame) {c₁ c₂ L₁ L₂ r : Set S} {a b₁ b₂ + : S} (hr : r ∈ Γ.regions) (h₁ : Γ.IsSide c₁ L₁ a b₁) (h₂ : Γ.IsSide c₂ L₂ a b₂) + (hcl₁ : L₁ ⊆ closure r) + (hcl₂ : L₂ ⊆ closure r) + (hi : L₁ ∩ L₂ ⊆ {a, b₂}) : ∃ Y, IsClosedDisc Y ∧ L₁ ⊆ discBd Y ∧ L₂ ⊆ discBd Y + ∧ Y ∩ Γ.U ⊆ L₁ ∪ L₂ := by + have hcS : CompactSpace S := hS.1 + have hman := hS.2.2 + have hU₁ := h₁.1.subset_U + have hU₂ := h₂.1.subset_U + have hNr : ∀ {z}, z ∈ Γ.N → z ∉ r := fun {z} hz h => region_subset hr h (Γ.N_subset hz) + have hdr : ∀ {L : Set S}, L ⊆ Γ.U → Disjoint L r := fun {L} hL => disjoint_left.mpr fun x hx hx' + => region_subset hr hx' (hL hx) + have haN := h₁.1.left_mem_N + have hb₁N := h₁.1.right_mem_N + have hb₂N := h₂.1.right_mem_N + obtain ⟨St₁, γ₁, hSt₁, hγ₁, hb₁, hi₁, -, -, hU'₁, hr₁, -⟩ := side_strip' hS hΓ hr h₁ hcl₁ + (isClosed_empty (X := S)) (by simp) + have hAL₂ : St₁ ∩ L₂ ⊆ {a, b₂} := fun z hz => hi ⟨hU'₁ ⟨hz.1, hU₂ hz.2⟩, hz.2⟩ + obtain ⟨St₂, γ₂, hSt₂, hγ₂, hb₂, hi₂, -, hin, hU'₂, hr₂, -⟩ := side_strip' hS hΓ hr h₂ hcl₂ + hSt₁.isClosed hAL₂ + obtain ⟨A₁, A₂, x, y, β, hA₁, hA₂, hiA, hxr, hA₁s, hβ, hβr, hβA, hyγ, hβ₂, hβ₁, ⟨A', R₁, R₂, hA', + hA's, rfl, hR₁, hR₂, hu₁, hi'₁, hu₂, hi'₂⟩, hA₁r, hA₂r⟩ := + exists_loop hS hΓ hr haN hb₁N hb₂N hSt₁ hSt₂ hγ₁ hγ₂ hb₁ hb₂ hr₁ hr₂ + (hdr hU₁) (hdr hU₂) hi₁ hi₂ hin + have hγ₁St : γ₁ ⊆ St₁ := (hb₁ ▸ subset_union_right).trans (discBd_subset St₁) + have hγ₂St : γ₂ ⊆ St₂ := (hb₂ ▸ subset_union_right).trans (discBd_subset St₂) + have hF : IsOArc (A₁ ∪ (A' ∪ β)) := oArc_of_lines hA₁ hA₂ hiA + obtain ⟨Δ, hΔ, hbΔ, hΔU⟩ := curve_disc hΓ hr haN hF (fun z hz hne => hz.elim (fun h + => hA₁r z h hne) (fun h => hA₂r z h hne)) + have hA₁Δ : A₁ ⊆ discBd Δ := hbΔ ▸ subset_union_left + have hA'Δ : A' ⊆ discBd Δ := by rw [hbΔ]; exact fun z hz => .inr (.inl hz) + have hβΔ : β ⊆ discBd Δ := by rw [hbΔ]; exact fun z hz => .inr (.inr hz) + obtain ⟨w₁, hw₁, hw₁a, hw₁b, -⟩ := exists_inner h₁.1.2.1 (finite_empty (α := S)) + obtain ⟨w₂, hw₂, hw₂a, hw₂b, -⟩ := exists_inner h₂.1.2.1 (finite_empty (α := S)) + have hL₁St : L₁ ⊆ St₁ := (hb₁ ▸ subset_union_left).trans (discBd_subset St₁) + have hL₂St : L₂ ⊆ St₂ := (hb₂ ▸ subset_union_left).trans (discBd_subset St₂) + have hw₁γ : w₁ ∉ γ₁ := fun h => (hi₁.le ⟨hw₁, h⟩).elim hw₁a hw₁b + have hw₂γ : w₂ ∉ γ₂ := fun h => (hi₂.le ⟨hw₂, h⟩).elim hw₂a hw₂b + have hb₂A₁ : b₂ ∉ A₁ := fun h => hNr hb₂N (hA₁r _ h hγ₂.ne'.symm) + have hb₂A' : b₂ ∉ A' := fun h => hNr hb₂N (hA₂r _ (.inl h) hγ₂.ne'.symm) + have haA' : a ∈ A' := hA'.left_mem + have haA₁ : a ∈ A₁ := hA₁.left_mem + have hxA₁ : x ∈ A₁ := hA₁.right_mem + have hyA' : y ∈ A' := hA'.right_mem + have hS₁Δ : St₁ ∩ Δ ⊆ A₁ := by + refine disc_off hman hSt₁ (hA₁s.trans (hb₁ ▸ subset_union_right)) hΔ (fun z hz hzA h => ?_) + (hL₁St hw₁) (fun h => hw₁γ (hA₁s h)) (hΔU _ (hU₁ hw₁) hw₁a) + rcases (hbΔ ▸ h : z ∈ A₁ ∪ (A' ∪ β)) with h | h | h + · exact hzA h + · rcases hin ⟨hγ₂St (hA's h), hz⟩ with rfl | rfl + · exact hzA haA₁ + · exact hb₂A' h + · exact hzA ((hβ₁.le ⟨h, hz⟩ : z = x) ▸ hxA₁) + have hS₂Δ : St₂ ∩ Δ ⊆ A' := by + refine disc_off hman hSt₂ (hA's.trans (hb₂ ▸ subset_union_right)) hΔ (fun z hz hzA h => ?_) + (hL₂St hw₂) (fun h => hw₂γ (hA's h)) (hΔU _ (hU₂ hw₂) hw₂a) + rcases (hbΔ ▸ h : z ∈ A₁ ∪ (A' ∪ β)) with h | h | h + · rcases hin ⟨hz, hγ₁St (hA₁s h)⟩ with rfl | rfl + · exact hzA haA' + · exact hb₂A₁ h + · exact hzA h + · exact hzA ((hβ₂.le ⟨h, hz⟩ : z = y) ▸ hyA') + by_cases hbb : b₁ = b₂ + · subst hbb + have hR₁γ : R₁ ⊆ γ₁ := fun z hz => hu₁ ▸ Or.inr hz + have hR₂γ : R₂ ⊆ γ₂ := fun z hz => hu₂ ▸ Or.inr hz + have haR₁ : a ∉ R₁ := fun h => hNr haN ((hi'₁.le ⟨haA₁, h⟩ : a = x) ▸ hxr) + have haR₂ : a ∉ R₂ := fun h => hNr haN ((hi'₂.le ⟨haA', h⟩ : a = y) ▸ hβr hβ.left_mem) + have hRβ : R₂ ∩ β = {y} := by + apply subset_antisymm + · rintro z ⟨h1, h2⟩ + exact hβ₂.le ⟨h2, hγ₂St (hR₂γ h1)⟩ + · rintro _ rfl + exact ⟨hR₂.left_mem, hβ.left_mem⟩ + have hB := hR₂.symm.union hβ hRβ + have hF₂ : IsOArc (R₁ ∪ (R₂ ∪ β)) := by + refine oArc_of_lines hR₁.symm hB ?_ + apply subset_antisymm + · rintro z ⟨h1, h2 | h2⟩ + · rcases hin ⟨hγ₂St (hR₂γ h2), hγ₁St (hR₁γ h1)⟩ with rfl | rfl + · exact absurd h1 haR₁ + · exact .inl rfl + · exact .inr (hβ₁.le ⟨h2, hγ₁St (hR₁γ h1)⟩) + · rintro z (rfl | rfl) + · exact ⟨hR₁.right_mem, .inl hR₂.right_mem⟩ + · exact ⟨hR₁.left_mem, .inr hβ.right_mem⟩ + obtain ⟨Δ₂, hΔ₂, hbΔ₂, hΔ₂U⟩ := curve_disc hΓ hr hb₁N hF₂ (fun z hz hne => by + rcases hz with h | h | h + · refine hr₁ ⟨hγ₁St (hR₁γ h), fun hL => ?_⟩ + rcases hi₁.le ⟨hL, hR₁γ h⟩ with e | e + · exact haR₁ (e ▸ h) + · exact hne e + · refine hr₂ ⟨hγ₂St (hR₂γ h), fun hL => ?_⟩ + rcases hi₂.le ⟨hL, hR₂γ h⟩ with e | e + · exact haR₂ (e ▸ h) + · exact hne e + · exact hβr h) + have hβΔ₂ : β ⊆ discBd Δ₂ := hbΔ₂ ▸ subset_union_right.trans subset_union_right + have hm := filled_sector_meets_disc_in_joining_arc hman haN St₁ γ₁ hγ₁ St₂ γ₂ A₁ x y β hβ A' + R₁ R₂ hi'₁ hi'₂ hγ₁St hγ₂St Δ hΔ hA₁Δ hβΔ haA₁ hS₁Δ hS₂Δ hR₁γ hR₂γ Δ₂ hΔ₂ hbΔ₂ hΔ₂U + hβΔ₂ (fun h => hNr haN (hβr h)) + obtain ⟨hD, hbD⟩ := disc_union _ _ _ _ _ hΔ hΔ₂ hβ hm hβΔ hβΔ₂ + have hγ₁D : γ₁ ⊆ discBd (Δ ∪ Δ₂) := by + rw [hbD] + exact subset_union_sdiff_of_inter_subset + (hu₁ ▸ union_subset_union hA₁Δ (hbΔ₂ ▸ subset_union_left)) + (fun z hz => Or.inr (hβ₁.le ⟨hz.2, hγ₁St hz.1⟩)) + have hγ₂D : γ₂ ⊆ discBd (Δ ∪ Δ₂) := by + rw [hbD] + exact subset_union_sdiff_of_inter_subset (hu₂ ▸ union_subset_union hA'Δ + (hbΔ₂ ▸ subset_union_left.trans subset_union_right)) + (fun z hz => Or.inl (hβ₂.le ⟨hz.2, hγ₂St hz.1⟩)) + have hS₁Δ₂ : St₁ ∩ Δ₂ ⊆ R₁ := by + have hsub : R₁ ⊆ discBd St₁ := by rw [hb₁, ← hu₁]; exact fun z hz => .inr (.inr hz) + refine disc_off hman hSt₁ hsub hΔ₂ (fun z hz hzR h => ?_) (hL₁St hw₁) (fun h => hw₁γ + (hR₁γ h)) (hΔ₂U _ (hU₁ hw₁) hw₁b) + rcases (hbΔ₂ ▸ h : z ∈ R₁ ∪ (R₂ ∪ β)) with h | h | h + · exact hzR h + · rcases hin ⟨hγ₂St (hR₂γ h), hz⟩ with rfl | rfl + · exact haR₂ h + · exact hzR hR₁.right_mem + · exact hzR ((hβ₁.le ⟨h, hz⟩ : z = x) ▸ hR₁.left_mem) + have hS₂Δ₂ : St₂ ∩ Δ₂ ⊆ R₂ := by + have hsub : R₂ ⊆ discBd St₂ := by rw [hb₂, ← hu₂]; exact fun z hz => .inr (.inr hz) + refine disc_off hman hSt₂ hsub hΔ₂ (fun z hz hzR h => ?_) (hL₂St hw₂) (fun h => hw₂γ + (hR₂γ h)) (hΔ₂U _ (hU₂ hw₂) hw₂b) + rcases (hbΔ₂ ▸ h : z ∈ R₁ ∪ (R₂ ∪ β)) with h | h | h + · rcases hin ⟨hz, hγ₁St (hR₁γ h)⟩ with rfl | rfl + · exact haR₁ h + · exact hzR hR₂.right_mem + · exact hzR h + · exact hzR ((hβ₂.le ⟨h, hz⟩ : z = y) ▸ hR₂.left_mem) + have hm₁ : St₁ ∩ (Δ ∪ Δ₂) = γ₁ := by + apply subset_antisymm + · rintro z ⟨hz, h | h⟩ + · exact hA₁s (hS₁Δ ⟨hz, h⟩) + · exact hR₁γ (hS₁Δ₂ ⟨hz, h⟩) + · exact fun z hz => ⟨hγ₁St hz, discBd_subset _ (hγ₁D hz)⟩ + obtain ⟨hY₁, hbY₁⟩ := disc_union _ _ _ _ _ hSt₁ hD hγ₁ hm₁ (hb₁ ▸ subset_union_right) hγ₁D + have hm₂ : (St₁ ∪ (Δ ∪ Δ₂)) ∩ St₂ = γ₂ := by + apply subset_antisymm + · rintro z ⟨h | h | h, hz⟩ + · rcases hin ⟨hz, h⟩ with rfl | rfl + · exact hγ₂.left_mem + · exact hγ₂.right_mem + · exact hA's (hS₂Δ ⟨hz, h⟩) + · exact hR₂γ (hS₂Δ₂ ⟨hz, h⟩) + · exact fun z hz => ⟨.inr (discBd_subset _ (hγ₂D hz)), hγ₂St hz⟩ + have hγ₂Y : γ₂ ⊆ discBd (St₁ ∪ (Δ ∪ Δ₂)) := hbY₁ ▸ + subset_union_sdiff_of_inter_subset (hγ₂D.trans subset_union_right) + (fun _ hz => hin ⟨hγ₂St hz.1, hγ₁St hz.2⟩) + obtain ⟨hY, hbY⟩ := disc_union _ _ _ _ _ hY₁ hSt₂ hγ₂ hm₂ hγ₂Y (hb₂ ▸ subset_union_right) + refine ⟨_, hY, fun z hz => ?_, fun z hz => ?_, ?_⟩ + · rw [hbY, hbY₁] + exact ⟨.inl ⟨.inl (hb₁ ▸ .inl hz), fun h => h.2 (hi₁.le ⟨hz, h.1⟩)⟩, + fun h => h.2 (hin ⟨hγ₂St h.1, hL₁St hz⟩)⟩ + · rw [hbY] + exact ⟨.inr (hb₂ ▸ .inl hz), fun h => h.2 (hi₂.le ⟨hz, h.1⟩)⟩ + · rintro z ⟨(h | h | h) | h, hzU⟩ + · exact .inl (hU'₁ ⟨h, hzU⟩) + · by_contra hn + refine hΔU z hzU (fun e => hn (.inl (e ▸ h₁.1.2.1.left_mem))) h + · by_contra hn + refine hΔ₂U z hzU (fun e => hn (.inl (e ▸ h₁.1.2.1.right_mem))) h + · exact .inr (hU'₂ ⟨h, hzU⟩) + · have hb₂St : b₂ ∉ St₁ := fun h => by + have h3 := hU'₁ ⟨h, Γ.N_subset hb₂N⟩ + rcases h₁.1.2.2.2.le ⟨h3, hb₂N⟩ with e | e + · exact hγ₂.ne'.symm e + · exact hbb e.symm + have hin' : ∀ {z}, z ∈ St₂ → z ∈ St₁ → z = a := fun {z} h h' => by + rcases hin ⟨h, h'⟩ with e | e + · exact e + · exact absurd (e ▸ h') hb₂St + have hm₁ : St₁ ∩ Δ = A₁ := subset_antisymm hS₁Δ fun z hz => ⟨hγ₁St (hA₁s hz), discBd_subset _ + (hA₁Δ hz)⟩ + obtain ⟨hY₁, hbY₁⟩ := disc_union _ _ _ _ _ hSt₁ hΔ hA₁ hm₁ (hA₁s.trans + (hb₁ ▸ subset_union_right)) hA₁Δ + have hm₂ : (St₁ ∪ Δ) ∩ St₂ = A' := by + apply subset_antisymm + · rintro z ⟨h | h, hz⟩ + · exact hin' hz h ▸ haA' + · exact hS₂Δ ⟨hz, h⟩ + · exact fun z hz => ⟨.inr (discBd_subset _ (hA'Δ hz)), hγ₂St (hA's hz)⟩ + have hA'Y : A' ⊆ discBd (St₁ ∪ Δ) := fun z hz => by + rw [hbY₁] + exact ⟨.inr (hA'Δ hz), fun h => h.2 (hiA.le ⟨h.1, .inl hz⟩)⟩ + obtain ⟨hY, hbY⟩ := disc_union _ _ _ _ _ hY₁ hSt₂ hA' hm₂ hA'Y (hA's.trans + (hb₂ ▸ subset_union_right)) + have hoff : ∀ {L z}, L ⊆ Γ.U → z ∈ L → z ∈ A₁ ∪ A' → z = a := fun {L z} hLU hz h => by + by_contra hn + refine disjoint_left.mp (hdr hLU) hz ?_ + exact h.elim (fun h => hA₁r z h hn) (fun h => hA₂r z (.inl h) hn) + refine ⟨_, hY, fun z hz => ?_, fun z hz => ?_, ?_⟩ + · rw [hbY, hbY₁] + exact ⟨.inl ⟨.inl (hb₁ ▸ .inl hz), fun h => h.2 (.inl (hoff hU₁ hz (.inl h.1)))⟩, + fun h => h.2 (.inl (hoff hU₁ hz (.inr h.1)))⟩ + · rw [hbY] + exact ⟨.inr (hb₂ ▸ .inl hz), fun h => h.2 (.inl (hoff hU₂ hz (.inr h.1)))⟩ + · rintro z ⟨(h | h) | h, hzU⟩ + · exact .inl (hU'₁ ⟨h, hzU⟩) + · by_contra hn + exact hΔU z hzU (fun e => hn (.inl (e ▸ h₁.1.2.1.left_mem))) h + · exact .inr (hU'₂ ⟨h, hzU⟩) + +end Painting + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Sides.lean b/LeanPool/GraphMinor/GM17/Sides.lean new file mode 100644 index 0000000000..f4b556c981 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Sides.lean @@ -0,0 +1,222 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.RegionTools + +/-! +# Sides of cells + +A side of a cell of a painting is a line of the boundary of the closure of the cell between two +consecutive nodes, off the boundary of the surface. Here we prove the plain +facts about sides: a point of the boundary of a cell off the nodes and off the boundary of the +surface lies on a side (`exists_side`), two sides with a common point off the +nodes are equal (`IsGap.unique`), and there are finitely many sides (`finite_gaps`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +namespace Painting + +/-- A line of the boundary of a cell between two consecutive nodes. -/ +def IsGap (Γ : Painting S) (c L : Set S) (u v : S) : Prop := + c ∈ Γ.C ∧ IsLineWithEnds L u v ∧ L ⊆ discBd (closure c) ∧ L ∩ Γ.N = {u, v} + +/-- A side of a cell: a line of its boundary between two consecutive nodes that meets the boundary +of the surface at most in its ends. -/ +def IsSide (Γ : Painting S) (c L : Set S) (u v : S) : Prop := + Γ.IsGap c L u v ∧ Disjoint (L \ {u, v}) (bd S) + +variable {Γ : Painting S} [T2Space S] + +omit [T2Space S] in +theorem IsGap.symm {c L : Set S} {u v : S} (h : Γ.IsGap c L u v) : Γ.IsGap c L v u := + ⟨h.1, h.2.1.symm, h.2.2.1, by rw [pair_comm]; exact h.2.2.2⟩ + +omit [T2Space S] in +theorem IsSide.symm {c L : Set S} {u v : S} (h : Γ.IsSide c L u v) : Γ.IsSide c L v u := + ⟨h.1.symm, by rw [pair_comm]; exact h.2⟩ + +omit [T2Space S] in +theorem IsGap.subset_closure {c L : Set S} {u v : S} (h : Γ.IsGap c L u v) : L ⊆ closure c := + h.2.2.1.trans (discBd_subset _) + +omit [T2Space S] in +theorem IsGap.subset_U {c L : Set S} {u v : S} (h : Γ.IsGap c L u v) : L ⊆ Γ.U := by + refine h.subset_closure.trans (closure_minimal (Γ.cell_subset_U h.1) Γ.isClosed_U) + +omit [T2Space S] in +theorem IsGap.left_mem_N {c L : Set S} {u v : S} (h : Γ.IsGap c L u v) : u ∈ Γ.N := + (h.2.2.2.ge (mem_insert _ _)).2 + +omit [T2Space S] in +theorem IsGap.right_mem_N {c L : Set S} {u v : S} (h : Γ.IsGap c L u v) : v ∈ Γ.N := + (h.2.2.2.ge (mem_insert_of_mem _ rfl)).2 + +omit [T2Space S] in +theorem IsGap.not_mem_N {c L : Set S} {u v x : S} (h : Γ.IsGap c L u v) (hx : x ∈ L) (hu : x ≠ u) + (hv : x ≠ v) : x ∉ Γ.N := fun hN => by + rcases (h.2.2.2.le ⟨hx, hN⟩ : x ∈ ({u, v} : Set S)) with h1 | h1 + · exact hu h1 + · exact hv h1 + +omit [T2Space S] in +theorem IsGap.mem_cell {c L : Set S} {u v x : S} (h : Γ.IsGap c L u v) (hx : x ∈ L) (hu : x ≠ u) + (hv : x ≠ v) : x ∈ c := + closure_eq_cell h.1 (h.subset_closure hx) (h.not_mem_N hx hu hv) + +/-- A gap is determined by a point on it off the nodes. -/ +theorem IsGap.subset_of_mem {c d L L' : Set S} {u v u' v' z : S} (h : Γ.IsGap c L u v) + (h' : Γ.IsGap d L' u' v') (hz : z ∈ L) (hz' : z ∈ L') (hzN : z ∉ Γ.N) : L' ⊆ L := by + obtain rfl : d = c := by + by_contra hne + exact hzN (closure_inter_closure h'.1 h.1 hne ⟨h'.subset_closure hz', h.subset_closure hz⟩) + obtain ⟨B, hB, hun, hin⟩ := oarc_split (Γ.isClosedDisc_closure_cell h.1).isOArc_discBd h.2.1 + h.2.2.1 + have hne : ∀ {x}, x ∈ L' \ {u', v'} → x ∉ ({u, v} : Set S) := fun {x} hx hm => by + have h1 : x ∈ Γ.N := by + rcases hm with rfl | rfl + · exact h.left_mem_N + · exact h.right_mem_N + exact h'.not_mem_N hx.1 (fun e => hx.2 (.inl e)) (fun e => hx.2 (.inr e)) h1 + have hcov : L' \ {u', v'} ⊆ L ∪ B := fun x hx => hun ▸ h'.2.2.1 hx.1 + have hzi : z ∈ L' \ {u', v'} := ⟨hz', by + rintro (rfl | rfl) + · exact hzN h'.left_mem_N + · exact hzN h'.right_mem_N⟩ + have hsub : L' \ {u', v'} ⊆ L := by + have hcl := isPreconnected_closed_iff.mp h'.2.1.isPreconnected_diff L B + h.2.1.isCompact.isClosed hB.isCompact.isClosed hcov + intro x hx + by_contra hxL + have hxB : x ∈ B := (hcov hx).resolve_left hxL + obtain ⟨y, hy, hy1, hy2⟩ := hcl ⟨z, hzi, hz⟩ ⟨x, hx, hxB⟩ + exact hne hy (hin ▸ ⟨hy1, hy2⟩) + exact h'.2.1.subset_closure_diff.trans (closure_minimal hsub h.2.1.isCompact.isClosed) + +/-- Two gaps with a common point off the nodes are equal. -/ +theorem IsGap.unique {c d L L' : Set S} {u v u' v' z : S} (h : Γ.IsGap c L u v) + (h' : Γ.IsGap d L' u' v') (hz : z ∈ L) (hz' : z ∈ L') (hzN : z ∉ Γ.N) : c = d ∧ L = L' := by + refine ⟨?_, subset_antisymm (h'.subset_of_mem h hz' hz hzN) (h.subset_of_mem h' hz hz' hzN)⟩ + by_contra hne + exact hzN (closure_inter_closure h.1 h'.1 hne ⟨h.subset_closure hz, h'.subset_closure hz'⟩) + +/-- The gaps of a cell with two nodes cover the boundary of the cell, and there are finitely many. +-/ +theorem exists_gaps {c : Set S} {x y : S} (hc : c ∈ Γ.C) (hx : x ∈ tilde c) (hy : y ∈ tilde c) + (hxy : x ≠ y) : + ∃ 𝓕 : Set (Set S), 𝓕.Finite ∧ (∀ F ∈ 𝓕, ∃ u v, Γ.IsGap c F u v) ∧ ⋃₀ 𝓕 = discBd (closure c) + := by + obtain ⟨𝓕, hf, h, hu⟩ := exists_gaps_oarc (Γ.isClosedDisc_closure_cell hc).isOArc_discBd + (Γ.finite_tilde_cell hc) (Γ.tilde_subset_discBd hc) hx hy hxy + refine ⟨𝓕, hf, fun F hF => ?_, hu⟩ + obtain ⟨a, -, b, -, h1, h2, h3⟩ := h F hF + refine ⟨a, b, hc, h1, h2, ?_⟩ + rw [← h3, ← Γ.closure_cell_inter_N hc] + ext z + exact ⟨fun h => ⟨h.1, discBd_subset _ (h2 h.1), h.2⟩, fun h => ⟨h.1, h.2.2⟩⟩ + +omit [T2Space S] in +theorem exists_inner {L : Set S} {u v : S} (hL : IsLineWithEnds L u v) {A : Set S} + (hA : A.Finite) : ∃ z ∈ L, z ≠ u ∧ z ≠ v ∧ z ∉ A := by + obtain ⟨a, ha, rfl, rfl, rfl⟩ := hL.exists_arc + have hinf : (Ioo (0 : ℝ) 1).Infinite := Set.Ioo_infinite zero_lt_one + have hinj : InjOn (fun t : ℝ => a (Set.projIcc 0 1 zero_le_one t)) (Ioo 0 1) := fun s hs t ht he + => by + have h1 := ha.2 he + have h2 := congrArg Subtype.val h1 + rwa [Set.projIcc_of_mem _ (Ioo_subset_Icc_self hs), Set.projIcc_of_mem _ + (Ioo_subset_Icc_self ht)] at h2 + have h3 := (hinf.image hinj).sdiff (hA.union (toFinite {a 0, a 1})) + obtain ⟨_, ⟨t, ht, rfl⟩, hn⟩ := h3.nonempty + exact ⟨_, mem_range_self _, fun h => hn (.inr (.inl h)), fun h => hn (.inr (.inr h)), + fun h => hn (.inl h)⟩ + +/-- There are finitely many gaps of all cells. -/ +theorem finite_gaps : {L | ∃ c u v, Γ.IsGap c L u v}.Finite := by + classical + have h1 : ∀ c ∈ Γ.C, {L | ∃ u v, Γ.IsGap c L u v}.Finite := fun c hc => by + by_cases hne : ∃ x ∈ tilde c, ∃ y ∈ tilde c, x ≠ y + · obtain ⟨x, hx, y, hy, hxy⟩ := hne + obtain ⟨𝓕, hf, h, hu⟩ := exists_gaps hc hx hy hxy + refine hf.subset ?_ + rintro L ⟨u, v, hL⟩ + obtain ⟨z, hz, hzu, hzv, hzN⟩ := exists_inner hL.2.1 Γ.finite_N + obtain ⟨F, hF, hzF⟩ := (hu ▸ hL.2.2.1 hz : z ∈ ⋃₀ 𝓕) + obtain ⟨u', v', hF'⟩ := h F hF + obtain ⟨-, rfl⟩ := hL.unique hF' hz hzF hzN + exact hF + · apply Set.Finite.subset finite_empty + rintro L ⟨u, v, hL⟩ + have hu : u ∈ tilde c := by + rw [← Γ.closure_cell_inter_N hc] + exact ⟨hL.subset_closure hL.2.1.left_mem, hL.left_mem_N⟩ + have hv : v ∈ tilde c := by + rw [← Γ.closure_cell_inter_N hc] + exact ⟨hL.subset_closure hL.2.1.right_mem, hL.right_mem_N⟩ + exact (hne ⟨u, hu, v, hv, hL.2.1.ne'⟩).elim + refine (Γ.finite_cells.biUnion h1).subset ?_ + rintro L ⟨c, u, v, hL⟩ + exact mem_iUnion₂.mpr ⟨c, hL.1, u, v, hL⟩ + +/-- A point of the boundary of a cell off the nodes and off the boundary of the surface lies on a +side, if the cell has two nodes. -/ +theorem exists_side (hS : IsSurface S) {c : Set S} {y : S} (hc : c ∈ Γ.C) + (h2 : ∃ a ∈ tilde c, ∃ b ∈ tilde c, a ≠ b) (hy : y ∈ discBd (closure c)) + (hyN : y ∉ Γ.N) (hyb : y ∉ bd S) : + ∃ L u v, Γ.IsSide c L u v ∧ y ∈ L ∧ y ≠ u ∧ y ≠ v := by + by_cases hbd : (c ∩ bd S).Nonempty + · obtain ⟨u, v, -, ht, hB, -, -, -⟩ := Γ.border_cell_exists_ends hc hbd + have hdisc := Γ.isClosedDisc_closure_cell hc + have hBs : closure c ∩ bd S ⊆ discBd (closure c) := fun x hx => by + by_contra hn + exact hx.2 (isInteriorPoint_of_mem_discInt hS.2.2 hdisc ⟨hx.1, hn⟩) + obtain ⟨B', hB', hun, hin⟩ := oarc_split hdisc.isOArc_discBd hB hBs + have hyB' : y ∈ B' := (hun ▸ hy : y ∈ _ ∪ B').resolve_left fun (h : y ∈ closure c ∩ bd S) + => hyb h.2 + have hB'c : B' ⊆ closure c := (hun ▸ subset_union_right : B' ⊆ _).trans (discBd_subset _) + refine ⟨B', u, v, ⟨⟨hc, hB', hun ▸ subset_union_right, ?_⟩, ?_⟩, hyB', ?_, ?_⟩ + · rw [← ht, ← Γ.closure_cell_inter_N hc] + apply subset_antisymm + · exact fun z hz => ⟨hB'c hz.1, hz.2⟩ + · intro z hz + have h1 : z ∈ tilde c := by + rw [← Γ.closure_cell_inter_N hc] + exact hz + rw [ht] at h1 + rcases h1 with rfl | rfl + · exact ⟨hB'.left_mem, hz.2⟩ + · exact ⟨hB'.right_mem, hz.2⟩ + · refine disjoint_left.mpr fun x hx hxb => hx.2 ?_ + have h1 : x ∈ (closure c ∩ bd S) ∩ B' := ⟨⟨hB'c hx.1, hxb⟩, hx.1⟩ + rwa [hin] at h1 + · rintro rfl + exact hyN (Γ.tilde_subset_N hc (ht ▸ .inl rfl)) + · rintro rfl + exact hyN (Γ.tilde_subset_N hc (ht ▸ .inr rfl)) + · obtain ⟨a, ha, b, hb, hab⟩ := h2 + obtain ⟨𝓕, -, h, hu⟩ := exists_gaps hc ha hb hab + obtain ⟨F, hF, hyF⟩ := (hu ▸ hy : y ∈ ⋃₀ 𝓕) + obtain ⟨u, v, hF'⟩ := h F hF + refine ⟨F, u, v, ⟨hF', disjoint_left.mpr fun x hx hxb => ?_⟩, hyF, ?_, ?_⟩ + · exact hbd ⟨x, hF'.mem_cell hx.1 (fun e => hx.2 (.inl e)) (fun e => hx.2 (.inr e)), hxb⟩ + · rintro rfl + exact hyN hF'.left_mem_N + · rintro rfl + exact hyN hF'.right_mem_N + +end Painting + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Strip.lean b/LeanPool/GraphMinor/GM17/Strip.lean new file mode 100644 index 0000000000..0b17b460a2 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Strip.lean @@ -0,0 +1,310 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Bigon +public import LeanPool.GraphMinor.Surface.DiscRemove + +/-! +# A thin strip along a side of a cell + +We use the disc on the far side of a side of a cell. In a closed surface we remove the inside of the +closure of the cell, and we take a thin disc along the side with `exists_wedge` +(`exists_strip`). This pushes a side of a cell off the cell: the proofs of (8.2) to (8.8) of Graph +Minors XVII (pages 181 to 183) use it. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +/-- A closed disc is a neighbourhood of the inner points of the line in which it meets the boundary +of the surface. -/ +theorem disc_nhds {Y : Type} [TopologicalSpace Y] (hY : IsSurface Y) {D K : Set Y} {u v x : Y} + (hD : IsClosedDisc D) (hK : IsLineWithEnds K u v) (hKD : K ⊆ discBd D) + (hDb : D ∩ bd Y = K) (hx : x ∈ K) + (hxu : x ≠ u) (hxv : x ≠ v) : D ∈ 𝓝 x := by + have ht2 : T2Space Y := hY.2.1 + have hxb : x ∈ bd Y := (hDb ▸ hx : x ∈ D ∩ bd Y).2 + have hC : connectedComponentIn (bd Y) x ∈ cuffs Y := ⟨x, hxb, rfl⟩ + set C := connectedComponentIn (bd Y) x with hCdef + have hKb : K ⊆ bd Y := hDb ▸ inter_subset_right + have hKC : K ⊆ C := (isPreconnected_line hK).subset_connectedComponentIn hx hKb + have hCb : C ⊆ bd Y := connectedComponentIn_subset _ _ + obtain ⟨T, tT, ι, E, hT, hι, hE, hun, hmeet, hbdE, hbdT⟩ := paste_disc.{0} Y C hY hC + have ht2T : T2Space T := hT.2.1 + have hDC : D ∩ C = K := subset_antisymm (fun y hy => hDb ▸ ⟨hy.1, hCb hy.2⟩) (subset_inter + (hKD.trans (discBd_subset D)) hKC) + have hD' : IsClosedDisc (ι '' D) := by + obtain ⟨φ⟩ := hD + exact ⟨φ.trans (hι.isEmbedding.homeomorphImage D)⟩ + have hbD' : discBd (ι '' D) = ι '' discBd D := by + have h := image_bd_homeomorph (hι.isEmbedding.homeomorphImage D) + rw [discBd, discBd, ← h, image_image, image_image] + rfl + have hl : IsLineWithEnds (ι '' K) (ι u) (ι v) := hK.map_of_embedding hι.isEmbedding + have hin : ι '' D ∩ E = ι '' K := by + apply subset_antisymm + · rintro _ ⟨⟨y, hy, rfl⟩, hyE⟩ + obtain ⟨z, hz, he⟩ := (hmeet ▸ ⟨⟨y, rfl⟩, hyE⟩ : ι y ∈ ι '' C) + obtain rfl := hι.injective he + exact ⟨z, hDC ▸ ⟨hy, hz⟩, rfl⟩ + · rintro _ ⟨y, hy, rfl⟩ + exact ⟨mem_image_of_mem _ (discBd_subset D (hKD hy)), discBd_subset E + (hbdE ▸ mem_image_of_mem _ (hKC hy))⟩ + obtain ⟨h1, h2⟩ := disc_union _ _ _ _ _ hD' hE hl hin (hbD' ▸ image_mono hKD) + (hbdE ▸ image_mono hKC) + have hopen := h1.isOpen_discInt hT.2.2 + have hxint : ι x ∈ discInt (ι '' D ∪ E) := by + refine ⟨.inl (mem_image_of_mem _ (discBd_subset D (hKD hx))), fun hmem => ?_⟩ + rw [h2] at hmem + refine hmem.2 ⟨mem_image_of_mem _ hx, ?_⟩ + rintro (h | h) + · exact hxu (hι.injective h) + · exact hxv (hι.injective h) + have hOC : IsOArc C := (cuff_statement.{0} Y hY).2.2 C hC + obtain ⟨L', hL', hu', hi'⟩ := oarc_split hOC hK hKC + have hxL' : x ∉ L' := fun h => by + rcases (hi' ▸ ⟨hx, h⟩ : x ∈ ({u, v} : Set Y)) with h | h + · exact hxu h + · exact hxv h + have hO : ι ⁻¹' discInt (ι '' D ∪ E) ∩ L'ᶜ ∈ 𝓝 x := + ((hopen.preimage hι.continuous).inter hL'.isCompact.isClosed.isOpen_compl).mem_nhds ⟨hxint, + hxL'⟩ + refine Filter.mem_of_superset hO fun y hy => ?_ + rcases hy.1.1 with ⟨z, hz, he⟩ | hE' + · exact hι.injective he ▸ hz + · obtain ⟨z, hz, he⟩ := (hmeet ▸ ⟨⟨y, rfl⟩, hE'⟩ : ι y ∈ ι '' C) + obtain rfl := hι.injective he + have h3 : z ∈ K ∪ L' := hu'.symm ▸ hz + exact discBd_subset D (hKD (h3.resolve_right hy.2)) + + +theorem closure_eq_cell {Γ : Painting S} {c : Set S} (hc : c ∈ Γ.C) {x : S} + (hx : x ∈ closure c) (hn : x ∉ Γ.N) : x ∈ c := by + by_contra h + exact hn (Γ.tilde_subset_N hc ⟨hx, h⟩) + +theorem closure_inter_closure {Γ : Painting S} {c d : Set S} (hc : c ∈ Γ.C) + (hd : d ∈ Γ.C) (hne : c ≠ d) : closure c ∩ closure d ⊆ Γ.N := by + rintro x ⟨h1, h2⟩ + by_contra hn + exact hne (arcComponentsIn_eq_of_mem hc hd (closure_eq_cell hc h1 hn) (closure_eq_cell hd h2 hn)) + +/-- A thin disc along a line of the boundary of a disc in a closed surface, off a closed set that +meets the line at most in its ends. -/ +theorem disc_strip {T : Type} [TopologicalSpace T] (hT : IsClosedSurface T) {B L Z : Set T} {u v : + T} (hB : IsClosedDisc B) (hL : IsLineWithEnds L u v) (hLb : L ⊆ discBd B) (hZ : IsClosed Z) + (hZL : Z ∩ L ⊆ {u, v}) : + ∃ St γ, IsClosedDisc St ∧ IsLineWithEnds γ u v ∧ discBd St = L ∪ γ ∧ L ∩ γ = {u, v} ∧ St ∩ B + = L ∧ St ∩ Z ⊆ {u, v} ∧ ∀ x ∈ L, x ≠ u → x ≠ v → B ∪ St ∈ 𝓝 x := by + classical + have hcT : CompactSpace T := hT.1 + have ht2T : T2Space T := hT.2.1 + have hTs : IsSurface T := ⟨hT.1, hT.2.1, fun x => (hT.2.2 x).isManifoldPoint⟩ + have hLcl : L ⊆ B := hLb.trans (discBd_subset _) + have hint : ∀ x ∈ discBd B, IsInteriorPoint x := fun x _ => hT.2.2 x + obtain ⟨hcl, hY, hbdY⟩ := remove_disc hTs hB hint + have hv : IsClosedEmbedding (Subtype.val : ↥(discInt B)ᶜ → T) := hcl.isClosedEmbedding_subtypeVal + have hrv : range (Subtype.val : ↥(discInt B)ᶜ → T) = (discInt B)ᶜ := Subtype.range_val + have hsv : ∀ {P : Set T}, P ⊆ discBd B → P ⊆ range (Subtype.val : ↥(discInt B)ᶜ → T) + := fun {P} hP x hx => by + rw [hrv] + exact fun h => h.2 (hP hx) + obtain ⟨u', v', hu', hv', hK⟩ := hL.pull hv.isEmbedding (hsv hLb) + have hKb : (Subtype.val ⁻¹' L : Set ↥(discInt B)ᶜ) ⊆ bd _ := fun y hy => hbdY ▸ Or.inr (hLb hy) + have hZK : (Subtype.val ⁻¹' Z : Set ↥(discInt B)ᶜ) ∩ Subtype.val ⁻¹' L ⊆ {u', v'} := by + rintro y ⟨hy, hyL⟩ + rcases hZL ⟨hy, hyL⟩ with h | h + · exact .inl (Subtype.ext (h.trans hu'.symm)) + · exact .inr (Subtype.ext (h.trans hv'.symm)) + obtain ⟨D, hD, hKD, hDZ, hDb⟩ := exists_wedge hY hK hKb (hZ.preimage continuous_subtype_val) hZK + have hDt : IsClosedDisc (Subtype.val '' D) := image_emb_disc hv.isEmbedding hD + have hDtb : discBd (Subtype.val '' D) = Subtype.val '' discBd D := discBd_image hv.isEmbedding D + have hDB : Subtype.val '' D ∩ B = L := by + apply subset_antisymm + · rintro _ ⟨⟨y, hy, rfl⟩, hyB⟩ + have h1 : y.1 ∈ discBd B := by + by_contra h + exact y.2 ⟨hyB, h⟩ + have h2 : y ∈ bd _ := hbdY ▸ Or.inr h1 + exact (hDb ▸ ⟨hy, h2⟩ : y ∈ Subtype.val ⁻¹' L) + · intro x hx + obtain ⟨y, hy⟩ := hsv hLb hx + have hyL : y ∈ Subtype.val ⁻¹' L := by rwa [mem_preimage, hy] + exact ⟨⟨y, discBd_subset D (hKD hyL), hy⟩, hLcl hx⟩ + obtain ⟨K', hK', hun, hin⟩ := oarc_split hD.isOArc_discBd hK hKD + have hK'D : K' ⊆ D := (hun ▸ subset_union_right).trans (discBd_subset D) + have hl' := hK'.map_of_embedding hv.isEmbedding + rw [hu', hv'] at hl' + have hjK : Subtype.val '' (Subtype.val ⁻¹' L : Set ↥(discInt B)ᶜ) = L + := image_preimage_eq_of_subset (hsv hLb) + refine ⟨_, _, hDt, hl', ?_, ?_, hDB, ?_, ?_⟩ + · rw [hDtb, ← hun, image_union, hjK] + · apply subset_antisymm + · rintro _ ⟨hx, y, hy, rfl⟩ + have h1 : y ∈ (Subtype.val ⁻¹' L : Set ↥(discInt B)ᶜ) ∩ K' := ⟨hx, hy⟩ + rw [hin] at h1 + rcases h1 with rfl | rfl + · exact .inl hu' + · exact .inr hv' + · rintro x (rfl | rfl) + · exact ⟨hL.left_mem, hl'.left_mem⟩ + · exact ⟨hL.right_mem, hl'.right_mem⟩ + · rintro _ ⟨⟨y, hy, rfl⟩, hz⟩ + rcases hDZ ⟨hy, hz⟩ with rfl | rfl + · exact .inl hu' + · exact .inr hv' + · intro x hx hxu hxv + have hul : L ⊆ discBd (Subtype.val '' D) := by + rw [hDtb] + refine fun y hy => ?_ + obtain ⟨y', hy', rfl⟩ := (hjK ▸ hy : y ∈ Subtype.val '' _) + exact mem_image_of_mem _ (hKD hy') + obtain ⟨h1, h2⟩ := disc_union _ _ _ _ _ hB hDt hL (by rw [inter_comm]; exact hDB) hLb hul + have hop := h1.isOpen_discInt (fun y => (hT.2.2 y).isManifoldPoint) + have hxint : x ∈ discInt (B ∪ Subtype.val '' D) := by + refine ⟨.inl (hLcl hx), fun hmem => ?_⟩ + rw [h2] at hmem + refine hmem.2 ⟨hx, ?_⟩ + rintro (h | h) + · exact hxu h + · exact hxv h + exact Filter.mem_of_superset (hop.mem_nhds hxint) fun y hy => hy.1 + +/-- A thin disc along a line on the boundary of a disc, which meets the boundary of the surface only +in the ends of the line. -/ +theorem strip_along [CompactSpace S] [T2Space S] [ConnectedSpace S] (hS : IsSurface S) {E L A : Set + S} {u v : S} (hE : IsClosedDisc E) (hL : IsLineWithEnds L u v) + (hLb : L ⊆ discBd E) (hLbd : ∀ x ∈ L, x ≠ u → x ≠ v → x ∉ bd S) (hA : IsClosed A) + (hAL : A ∩ L ⊆ {u, v}) : + ∃ St γ, IsClosedDisc St ∧ IsLineWithEnds γ u v ∧ discBd St = L ∪ γ ∧ L ∩ γ = {u, v} ∧ St ∩ E + = L ∧ St ∩ A ⊆ {u, v} ∧ St ∩ bd S ⊆ {u, v} ∧ + ∀ x ∈ L, x ≠ u → x ≠ v → E ∪ St ∈ 𝓝 x := by + classical + obtain ⟨T, tT, j, cap, hT, hTc, hj, hcap, hcov⟩ := exists_cap_discs _ S hS rfl + have ht2T : T2Space T := hT.2.1 + have hB : IsClosedDisc (j '' E) := image_emb_disc hj.isEmbedding hE + have hbB : discBd (j '' E) = j '' discBd E := discBd_image hj.isEmbedding _ + have hfinC := (cuff_statement.{0} S hS).2.1 + let Z : Set T := j '' A ∪ ⋃ C ∈ cuffs S, cap C + have hZc : IsClosed Z := (hj.isClosedMap _ hA).union (hfinC.isClosed_biUnion fun C hC => + (hcap C hC).1.isClosed) + have hbC : ∀ {C : Set S}, C ∈ cuffs S → C ⊆ bd S := fun {C} hC => by + obtain ⟨x, -, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + have hmem : ∀ {x C}, C ∈ cuffs S → j x ∈ cap C → x ∈ bd S := fun {x C} hC hw => by + obtain ⟨y, hy, he⟩ := ((hcap C hC).2.2 ▸ ⟨⟨x, rfl⟩, hw⟩ : j x ∈ j '' C) + obtain rfl := hj.injective he + exact hbC hC hy + have hbdcap : ∀ {x}, x ∈ bd S → j x ∈ ⋃ C ∈ cuffs S, cap C := fun {x} hx => by + let C : Set S := connectedComponentIn (bd S) x + have hC : C ∈ cuffs S := ⟨x, hx, rfl⟩ + refine mem_iUnion₂.mpr ⟨C, hC, ?_⟩ + have h3 : j x ∈ j '' C := ⟨x, mem_connectedComponentIn hx, rfl⟩ + rw [← (hcap C hC).2.1] at h3 + exact discBd_subset _ h3 + have hZends : Z ∩ j '' L ⊆ {j u, j v} := by + rintro _ ⟨hZx, x, hx, rfl⟩ + by_contra hcon + have hcu : x ≠ u := fun h => hcon (.inl (congrArg j h)) + have hcv : x ≠ v := fun h => hcon (.inr (congrArg j h)) + rcases hZx with ⟨y, hy, he⟩ | hxc + · obtain rfl := hj.injective he + exact (hAL ⟨hy, hx⟩).elim hcu hcv + · obtain ⟨C, hC, hw⟩ := mem_iUnion₂.mp hxc + exact hLbd x hx hcu hcv (hmem hC hw) + have hl : IsLineWithEnds (j '' L) (j u) (j v) := hL.map_of_embedding hj.isEmbedding + have hjLb : j '' L ⊆ discBd (j '' E) := hbB ▸ image_mono hLb + obtain ⟨D, γ, hDt, hγ, hDtb, hin, hDB, hDZ', hnb⟩ := disc_strip hT hB hl hjLb hZc hZends + have hDr : D ⊆ range j := by + intro z hz + rcases (hcov ▸ mem_univ z : z ∈ range j ∪ ⋃ C ∈ cuffs S, cap C) with h | h + · exact h + · rcases hDZ' ⟨hz, .inr h⟩ with h1 | h1 + · rw [h1] + exact mem_range_self _ + · rw [h1] + exact mem_range_self _ + obtain ⟨hSt, hStb⟩ := isClosedDisc_preimage hj hDt hDr + have hγD : γ ⊆ D := (hDtb ▸ subset_union_right).trans (discBd_subset D) + obtain ⟨u₁, v₁, hu₁, hv₁, hγ'⟩ := hγ.pull hj.isEmbedding (hγD.trans hDr) + obtain rfl : u₁ = u := hj.injective hu₁ + obtain rfl : v₁ = v := hj.injective hv₁ + refine ⟨_, _, hSt, hγ', ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [hStb, hDtb, preimage_union, preimage_image_eq _ hj.injective] + · have h1 : j ⁻¹' (j '' L ∩ γ) = L ∩ j ⁻¹' γ := by + rw [preimage_inter, preimage_image_eq _ hj.injective] + rw [← h1, hin] + ext x + simp only [mem_preimage, mem_insert_iff, mem_singleton_iff, hj.injective.eq_iff] + · have h1 : j ⁻¹' (D ∩ j '' E) = j ⁻¹' D ∩ E := by + rw [preimage_inter, preimage_image_eq _ hj.injective] + rw [← h1, hDB, preimage_image_eq _ hj.injective] + · rintro x ⟨hx, hxA⟩ + rcases hDZ' ⟨hx, .inl ⟨x, hxA, rfl⟩⟩ with h | h + · exact .inl (hj.injective h) + · exact .inr (hj.injective h) + · rintro x ⟨hx, hxb⟩ + rcases hDZ' ⟨hx, .inr (hbdcap hxb)⟩ with h | h + · exact .inl (hj.injective h) + · exact .inr (hj.injective h) + · intro x hx hxu hxv + have h1 := hnb (j x) (mem_image_of_mem _ hx) (fun h => hxu (hj.injective h)) (fun h => hxv + (hj.injective h)) + refine Filter.mem_of_superset (hj.continuous.continuousAt h1) fun y hy => ?_ + rcases hy with h | h + · exact .inl (hj.injective.mem_set_image.mp h) + · exact .inr h + +/-- A thin disc on the far side of a side of a cell. -/ +theorem exists_strip [CompactSpace S] [T2Space S] [ConnectedSpace S] (hS : IsSurface S) {Γ : + Painting S} {c L A : Set S} {u v : S} (hc : c ∈ Γ.C) (hL : IsLineWithEnds L u v) + (hLb : L ⊆ discBd (closure c)) (hLbd : ∀ x ∈ L, x ≠ u → x ≠ v → x ∉ bd S) (hLN : ∀ x ∈ L, x ≠ u + → x ≠ v → x ∉ Γ.N) (hA : IsClosed A) (hAL : A ∩ L ⊆ {u, v}) : + ∃ St γ, IsClosedDisc St ∧ IsLineWithEnds γ u v ∧ discBd St = L ∪ γ ∧ L ∩ γ = {u, v} + ∧ St ∩ closure c = L ∧ St ∩ A ⊆ {u, v} ∧ St ∩ Γ.U ⊆ L ∧ + ∀ x ∈ L, x ≠ u → x ≠ v → closure c ∪ St ∈ 𝓝 x := by + obtain ⟨hdisc, -, -, -⟩ := Γ.cell_disc c hc + let obstacle : Set S := A ∪ Γ.N ∪ ⋃ d ∈ Γ.C \ {c}, closure d + have hclosed : IsClosed obstacle := (hA.union Γ.finite_N.isClosed).union + ((Γ.finite_cells.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure) + have hLcl : L ⊆ closure c := hLb.trans (discBd_subset _) + have hends : obstacle ∩ L ⊆ {u, v} := by + rintro x ⟨hx, hLx⟩ + by_contra hxEnds + have hxu : x ≠ u := fun h => hxEnds (.inl h) + have hxv : x ≠ v := fun h => hxEnds (.inr h) + rcases hx with (hxA | hxN) | hxCells + · exact hxEnds (hAL ⟨hxA, hLx⟩) + · exact hLN x hLx hxu hxv hxN + · obtain ⟨d, hd, hxd⟩ := mem_iUnion₂.mp hxCells + have hdc : d ≠ c := hd.2 + exact hLN x hLx hxu hxv (closure_inter_closure hc hd.1 hdc.symm ⟨hLcl hLx, hxd⟩) + obtain ⟨St, γ, hSt, hγ, hbd, hinter, hStc, hStObstacle, _, hnb⟩ := + strip_along hS hdisc hL hLb hLbd hclosed hends + refine ⟨St, γ, hSt, hγ, hbd, hinter, hStc, fun _ hx => ?_, ?_, hnb⟩ + · exact hStObstacle ⟨hx.1, Or.inl (Or.inl hx.2)⟩ + · rintro x ⟨hxSt, hxU⟩ + have obstacle_mem_imp_mem_line : x ∈ obstacle → x ∈ L := fun hx => by + rcases hStObstacle ⟨hxSt, hx⟩ with h | h + · exact h.symm ▸ hL.left_mem + · exact h.symm ▸ hL.right_mem + by_cases hxN : x ∈ Γ.N + · exact obstacle_mem_imp_mem_line (Or.inl (Or.inr hxN)) + obtain ⟨d, hd, hxd⟩ := exists_mem_arcComponentsIn (F := Γ.U \ Γ.N) (x := x) ⟨hxU, hxN⟩ + by_cases hdc : d = c + · exact hStc ▸ ⟨hxSt, hdc ▸ subset_closure hxd⟩ + · exact obstacle_mem_imp_mem_line (Or.inr (mem_iUnion₂.mpr ⟨d, ⟨hd, hdc⟩, subset_closure hxd⟩)) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Subdivide.lean b/LeanPool/GraphMinor/GM17/Subdivide.lean new file mode 100644 index 0000000000..cce54ea58c --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Subdivide.lean @@ -0,0 +1,324 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM17.Defs + +/-! +# From hypergraphs to graphs, and the double subdivision + +XVII (13.1) rests on XVI (3.1), which is on graphs in the sense of `Graph`, with minors whose edges +are edges of the graph. The minors of XVII are minors of the simple graph `G*`. If `H` has loops or +parallel edges, then an `H`-minor of `G` need not give one of `G*`. So we apply (3.1) to the graph +`subdiv H a b`, in which every edge of `H` is subdivided twice. This graph is simple, +a minor of it gives an `H`-minor of `G*` (`controlsMinor_of_subdiv`), and a drawing of `H` gives a +drawing of it (in `SubdivideDraw`). + +`toGraph` turns a hypergraph that is a graph into a `Graph`, with the same vertices, edges and +incidences (`ofGraph_toGraph`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface Graph + +universe u v + +variable {α : Type u} {β : Type v} + +theorem exists_ends {G : Hypergraph α β} (hG : G.IsGraph) {e : β} (he : e ∈ G.edgeSet) : ∃ x y, + G.ends e = {x, y} := by + obtain ⟨hne, hc⟩ := hG e he + have hfin : (G.ends e).Finite := G.vertexSet_finite.subset fun v hv => G.vertex_mem_of_inc hv + have hpos : 0 < (G.ends e).ncard := (Set.ncard_pos hfin).mpr hne + have hcases : (G.ends e).ncard = 1 ∨ (G.ends e).ncard = 2 := by omega + rcases hcases with h | h + · obtain ⟨x, hx⟩ := Set.ncard_eq_one.mp h + exact ⟨x, x, by simp [hx]⟩ + · obtain ⟨x, y, -, hx⟩ := Set.ncard_eq_two.mp h + exact ⟨x, y, hx⟩ + +/-- A hypergraph that is a graph, as a `Graph`. -/ +def toGraph (G : Hypergraph α β) (hG : G.IsGraph) : Graph α β where + vertexSet := G.vertexSet + IsLink e x y := e ∈ G.edgeSet ∧ x ∈ G.ends e ∧ y ∈ G.ends e ∧ G.ends e ⊆ {x, y} + edgeSet := G.edgeSet + isLink_symm := fun e _ => ⟨fun x y h => ⟨h.1, h.2.2.1, h.2.1, fun z hz => by + rcases h.2.2.2 hz with h | h + · exact Or.inr h + · exact Or.inl h⟩⟩ + eq_or_eq_of_isLink_of_isLink := fun e x y v w h h' => by + rcases h'.2.2.2 h.2.1 with h | h + · exact Or.inl h + · exact Or.inr h + edge_mem_iff_exists_isLink := fun e => by + constructor + · intro he + obtain ⟨x, y, hxy⟩ := exists_ends hG he + refine ⟨x, y, he, ?_, ?_, ?_⟩ + · rw [hxy]; exact Or.inl rfl + · rw [hxy]; exact Or.inr rfl + · rw [hxy] + · rintro ⟨x, y, h⟩ + exact h.1 + left_mem_of_isLink := fun e x y h => G.vertex_mem_of_inc h.2.1 + +theorem ofGraph_toGraph (G : Hypergraph α β) (hG : G.IsGraph) (hV : V(toGraph G hG).Finite) + (hE : E(toGraph G hG).Finite) : + Hypergraph.ofGraph (toGraph G hG) hV hE = G := by + refine Hypergraph.ext rfl rfl ?_ + funext e v + apply propext + constructor + · rintro ⟨y, h⟩ + exact h.2.1 + · intro h + obtain ⟨x, y, hxy⟩ := exists_ends hG (G.edge_mem_of_inc h) + have hv : v ∈ G.ends e := h + have hx : x ∈ G.ends e := by rw [hxy]; exact Or.inl rfl + have hy : y ∈ G.ends e := by rw [hxy]; exact Or.inr rfl + rw [hxy] at hv + rcases hv with rfl | rfl + · exact ⟨y, G.edge_mem_of_inc h, hx, hy, hxy.le⟩ + · refine ⟨x, G.edge_mem_of_inc h, hy, hx, ?_⟩ + rw [hxy, Set.pair_comm] + +variable {α' β' : Type} (H : Hypergraph α' β') (a b : ↥H.edgeSet → α') + +/-- The vertices of the double subdivision: those of `H`, and two for each edge. -/ +abbrev SV := α' ⊕ (↥H.edgeSet × Bool) + +/-- The edges of the double subdivision: three for each edge of `H`. -/ +abbrev SE := ↥H.edgeSet × Fin 3 + +/-- The ends of an edge of the double subdivision. -/ +def lnk : SE H → SV H × SV H + | (e, 0) => (.inl (a e), .inr (e, false)) + | (e, 1) => (.inr (e, false), .inr (e, true)) + | (e, 2) => (.inr (e, true), .inl (b e)) + +/-- The double subdivision of `H`. -/ +def subdiv (ha : ∀ e, a e ∈ H.vertexSet) (hb : ∀ e, b e ∈ H.vertexSet) : Graph (SV H) (SE H) where + vertexSet := Sum.inl '' H.vertexSet ∪ range Sum.inr + IsLink f x y := lnk H a b f = (x, y) ∨ lnk H a b f = (y, x) + edgeSet := univ + isLink_symm := fun e _ => ⟨fun x y h => h.symm⟩ + eq_or_eq_of_isLink_of_isLink := fun f x y v w h h' => by + rcases h with h | h <;> rcases h' with h' | h' <;> rw [h] at h' <;> simp only [Prod.mk.injEq] + at h' <;> simp [h'.1, h'.2] + edge_mem_iff_exists_isLink := fun f => ⟨fun _ => ⟨_, _, Or.inl rfl⟩, fun _ => mem_univ _⟩ + left_mem_of_isLink := fun f x y h => by + obtain ⟨e, i⟩ := f + fin_cases i <;> simp only [lnk, Prod.mk.injEq] at h <;> rcases h with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + <;> simp [ha, hb] + +/-- The vertex of `H` that a vertex of the double subdivision goes to under the contraction. The +middle edges are not contracted. -/ +def own : SV H → α' + | .inl v => v + | .inr (e, false) => a e + | .inr (e, true) => b e + +variable {H a b} + +theorem subdiv_inl {ha : ∀ e, a e ∈ H.vertexSet} {hb : ∀ e, b e ∈ H.vertexSet} {v : α'} + (hv : v ∈ H.vertexSet) : (Sum.inl v : SV H) ∈ V(subdiv H a b ha hb) := + Or.inl (mem_image_of_mem _ hv) + +theorem subdiv_inr {ha : ∀ e, a e ∈ H.vertexSet} {hb : ∀ e, b e ∈ H.vertexSet} + (x : ↥H.edgeSet × Bool) : (Sum.inr x : SV H) ∈ V(subdiv H a b ha hb) := + Or.inr (mem_range_self x) + +/-- A minor of the double subdivision gives a minor of `H` in the simple graph of `G`. -/ +theorem controlsMinor_of_subdiv [Nonempty α] (hH : H.IsGraph) (hab : ∀ e : ↥H.edgeSet, H.ends e.1 + = {a e, b e}) (ha : ∀ e, a e ∈ H.vertexSet) (hb : ∀ e, b e ∈ H.vertexSet) + {G : Graph α β} (hV : V(G).Finite) (hE : E(G).Finite) {T : Set (Hypergraph α β × Hypergraph α + β)} + (h : GM16.ControlsMinor G (subdiv H a b ha hb) T) : ControlsMinor + (Hypergraph.ofGraph G hV hE) T H := by + classical + obtain ⟨αv, αe, h1, h2, h3, -, -, h6⟩ := h + set L := subdiv H a b ha hb with hL + let K := Hypergraph.ofGraph G hV hE + have piece : ∀ {w w' : SV H}, w ∈ V(L) → w' ∈ V(L) → ∀ {x : α}, x ∈ V(αv w) → x ∈ V(αv w') → w + = w' := fun {w w'} hw hw' {x} hx hx' => by + by_contra hne + exact Set.disjoint_left.mp (h2 w hw w' hw' hne) hx hx' + have link : ∀ (f : SE H), (lnk H a b f).1 ≠ (lnk H a b f).2 → (lnk H a b f).1 ∈ V(L) → + (lnk H a b f).2 ∈ V(L) → + ∃ x ∈ V(αv (lnk H a b f).1), ∃ y ∈ V(αv (lnk H a b f).2), G.IsLink (αe f) x y + := fun f hne hu hw => + (h3 f (mem_univ f) _ hu _ hw hne (Or.inl rfl)).2 + have hmid : ∀ e : ↥H.edgeSet, ∃ x ∈ V(αv (.inr (e, false))), ∃ y ∈ V(αv (.inr + (e, true))), G.IsLink (αe (e, 1)) x y := fun e => + link (e, 1) (by simp [lnk]) (subdiv_inr _) (subdiv_inr _) + choose p hp q hq hpq using hmid + have hleft : ∀ e : ↥H.edgeSet, ∃ x ∈ V(αv (.inl (a e))), ∃ y ∈ V(αv (.inr (e, false))), G.IsLink + (αe (e, 0)) x y := fun e => + link (e, 0) (by simp [lnk]) (subdiv_inl (ha e)) (subdiv_inr _) + have hright : ∀ e : ↥H.edgeSet, ∃ x ∈ V(αv (.inr (e, true))), ∃ y ∈ V(αv (.inl (b e))), G.IsLink + (αe (e, 2)) x y := fun e => + link (e, 2) (by simp [lnk]) (subdiv_inr _) (subdiv_inl (hb e)) + let av : α' → Set α := fun v => {x | ∃ w ∈ V(L), own H a b w = v ∧ x ∈ V(αv w)} + let o : α := Classical.arbitrary α + let ae : β' → Sym2 α := fun e => if he : e ∈ H.edgeSet then s(p ⟨e, he⟩, q ⟨e, he⟩) else s(o, o) + have hae : ∀ e : ↥H.edgeSet, ae e.1 = s(p e, q e) := fun e => by simp [ae, e.2] + let ae' : α' → Set (Sym2 α) := fun v => {z | z ∈ K.skeleton.edgeSet ∧ (∀ u ∈ z, u ∈ av v) + ∧ ∀ e ∈ H.edgeSet, z ≠ ae e} + have hadj : ∀ {f : β} {x y : α}, G.IsLink f x y → x ≠ y → s(x, y) ∈ K.skeleton.edgeSet + := fun {f x y} hl hne => by + rw [SimpleGraph.mem_edgeSet] + exact ⟨hne, f, hl.inc_left, hl.inc_right⟩ + have hsame : ∀ {w : SV H}, w ∈ V(L) → ∀ {x y : α}, x ∈ V(αv w) → y ∈ V(αv w) + → ∀ e ∈ H.edgeSet, s(x, y) ≠ ae e := by + intro w hw x y hx hy e he heq + rw [show ae e = s(p ⟨e, he⟩, q ⟨e, he⟩) from hae ⟨e, he⟩, Sym2.eq_iff] at heq + have h4 : w = .inr (⟨e, he⟩, false) := by + rcases heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact piece hw (subdiv_inr _) hx (hp _) + · exact piece hw (subdiv_inr _) hy (hp _) + have h5 : w = .inr (⟨e, he⟩, true) := by + rcases heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact piece hw (subdiv_inr _) hy (hq _) + · exact piece hw (subdiv_inr _) hx (hq _) + rw [h4] at h5 + simp at h5 + have hmemav : ∀ {w : SV H}, w ∈ V(L) → ∀ {x : α}, x ∈ V(αv w) → x ∈ av (own H a b w) + := fun {w} hw {x} hx => ⟨w, hw, rfl, hx⟩ + have hbr : ∀ {v : α'}, v ∈ H.vertexSet → ∀ {w : SV H}, w ∈ V(L) → own H a b w = v + → ∀ {x y : α}, x ∈ V(αv w) → y ∈ V(αv w) → + Relation.ReflTransGen (fun c d ↦ s(c, d) ∈ ae' v) x y := by + intro v _ w hw hown x y hx hy + have hconn := ((h1 w hw).2.2.2 x hx y hy) + clear hy + induction hconn with + | refl => exact .refl + | tail hp₁ hst ih => + rename_i c d + obtain ⟨g, hg⟩ := hst + have hc : c ∈ V(αv w) := hg.left_mem + have hd : d ∈ V(αv w) := hg.right_mem + by_cases hcd : c = d + · exact hcd ▸ ih + · refine ih.tail ⟨hadj ((h1 w hw).1.isLink_mono hg) hcd, ?_, hsame hw hc hd⟩ + intro u hu + rw [Sym2.mem_iff] at hu + rcases hu with rfl | rfl + · exact hown ▸ hmemav hw hc + · exact hown ▸ hmemav hw hd + have hcross : ∀ {v : α'} {x y : α}, x ∈ V(αv (.inl v)) → v ∈ H.vertexSet → + (∃ w ∈ V(L), w ≠ .inl v ∧ own H a b w = v ∧ y ∈ V(αv w)) → ∀ {f : β}, G.IsLink f x y → + s(x, y) ∈ ae' v := by + rintro v x y hx hv ⟨w, hw, hne, hown, hy⟩ f hl + have hxy : x ≠ y := fun he => hne (piece hw (subdiv_inl hv) hy (he ▸ hx)) + refine ⟨hadj hl hxy, ?_, fun e he heq => ?_⟩ + · intro u hu + rw [Sym2.mem_iff] at hu + rcases hu with rfl | rfl + · exact ⟨.inl v, subdiv_inl hv, rfl, hx⟩ + · exact hown ▸ hmemav hw hy + · rw [show ae e = s(p ⟨e, he⟩, q ⟨e, he⟩) from hae ⟨e, he⟩, Sym2.eq_iff] at heq + rcases heq with ⟨rfl, -⟩ | ⟨rfl, -⟩ + · exact absurd (piece (subdiv_inl hv) (subdiv_inr _) hx (hp _)) (by simp) + · exact absurd (piece (subdiv_inl hv) (subdiv_inr _) hx (hq _)) (by simp) + have hsymm : ∀ v {x y : α}, Relation.ReflTransGen (fun c d ↦ s(c, d) ∈ ae' v) x y + → Relation.ReflTransGen (fun c d ↦ s(c, d) ∈ ae' v) y x := fun v {x y} h => by + have : Std.Symm (fun c d ↦ s(c, d) ∈ ae' v) := ⟨fun c d h => by + show s(d, c) ∈ ae' v + rw [Sym2.eq_swap] + exact h⟩ + exact Relation.ReflTransGen.stdSymm.symm x y h + have hbase : ∀ {v : α'}, v ∈ H.vertexSet → ∀ {b₀ : α}, b₀ ∈ V(αv (.inl v)) + → ∀ x ∈ av v, Relation.ReflTransGen (fun c d ↦ s(c, d) ∈ ae' v) x b₀ := by + rintro v hv b₀ hb₀ x ⟨w, hw, hown, hx⟩ + rcases w with v' | ⟨e, _ | _⟩ + · obtain rfl : v' = v := hown + exact hbr hv hw rfl hx hb₀ + · have hown' : a e = v := hown + obtain ⟨c, hc, d, hd, hl⟩ := hleft e + rw [hown'] at hc + have h4 : s(c, d) ∈ ae' v := hcross hc hv ⟨_, subdiv_inr _, by simp, hown, hd⟩ hl + exact ((hbr hv hw hown hx hd).trans (hsymm v (.single h4))).trans (hbr hv + (subdiv_inl hv) rfl hc hb₀) + · have hown' : b e = v := hown + obtain ⟨c, hc, d, hd, hl⟩ := hright e + rw [hown'] at hd + have h4 : s(d, c) ∈ ae' v := hcross hd hv ⟨_, subdiv_inr _, by simp, hown, hc⟩ hl.symm + exact ((hbr hv hw hown hx hc).trans (hsymm v (.single h4))).trans (hbr hv + (subdiv_inl hv) rfl hd hb₀) + have hend : ∀ {e : β'} (he : e ∈ H.edgeSet), p ⟨e, he⟩ ∈ av (a ⟨e, he⟩) ∧ q ⟨e, he⟩ ∈ av + (b ⟨e, he⟩) := fun {e} he => + ⟨hmemav (subdiv_inr (_, false)) (hp _), hmemav (subdiv_inr (_, true)) (hq _)⟩ + refine ⟨hH, av, ae', ae, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro v hv + have hw := subdiv_inl (ha := ha) (hb := hb) hv + obtain ⟨b₀, hb₀⟩ := (h1 _ hw).2.1 + refine ⟨⟨b₀, _, hw, rfl, hb₀⟩, ?_, fun z hz => hz.1, fun x y hz => ⟨hz.2.1 _ + (Sym2.mem_mk_left x y), hz.2.1 _ (Sym2.mem_mk_right x y)⟩, fun x hx y hy => ?_⟩ + · rintro x ⟨w, hw', -, hx⟩ + exact (h1 w hw').1.vertexSet_mono hx + · exact (hbase hv hb₀ x hx).trans (hsymm v (hbase hv hb₀ y hy)) + · intro u _ v _ hne + refine Set.disjoint_left.mpr ?_ + rintro x ⟨w, hw, rfl, hx⟩ ⟨w', hw', rfl, hx'⟩ + exact hne (by rw [piece hw hw' hx hx']) + · intro e he + rw [show ae e = s(p ⟨e, he⟩, q ⟨e, he⟩) from hae ⟨e, he⟩] + refine hadj (hpq ⟨e, he⟩) fun heq => ?_ + have := piece (subdiv_inr _) (subdiv_inr _) (hp ⟨e, he⟩) (heq ▸ hq ⟨e, he⟩) + simp at this + · intro e he f hf heq + have h4 : s(p ⟨e, he⟩, q ⟨e, he⟩) = s(p ⟨f, hf⟩, q ⟨f, hf⟩) := by + rw [← hae ⟨e, he⟩, ← hae ⟨f, hf⟩] + exact heq + rw [Sym2.eq_iff] at h4 + rcases h4 with ⟨h5, -⟩ | ⟨h5, -⟩ + · have := piece (subdiv_inr _) (subdiv_inr _) (hp ⟨e, he⟩) (h5 ▸ hp ⟨f, hf⟩) + simpa using this + · have := piece (subdiv_inr _) (subdiv_inr _) (hp ⟨e, he⟩) (h5 ▸ hq ⟨f, hf⟩) + simp at this + · intro e he u v huv hu hv + have hu' : u ∈ H.ends e := hu + have hv' : v ∈ H.ends e := hv + rw [hab ⟨e, he⟩] at hu' hv' + obtain ⟨hp₁, hq₁⟩ := hend he + rw [show ae e = s(p ⟨e, he⟩, q ⟨e, he⟩) from hae ⟨e, he⟩] + rcases hu' with rfl | rfl <;> rcases hv' with rfl | rfl + · exact absurd rfl huv + · exact ⟨_, hp₁, _, hq₁, rfl⟩ + · exact ⟨_, hq₁, _, hp₁, Sym2.eq_swap⟩ + · exact absurd rfl huv + · intro e he v hv + have h4 := hab ⟨e, he⟩ + rw [show H.ends (⟨e, he⟩ : ↥H.edgeSet) = {v} from hv] at h4 + have ha' : a ⟨e, he⟩ = v := by + have : a ⟨e, he⟩ ∈ ({v} : Set α') := by rw [h4]; exact Or.inl rfl + exact this + have hb' : b ⟨e, he⟩ = v := by + have : b ⟨e, he⟩ ∈ ({v} : Set α') := by rw [h4]; exact Or.inr rfl + exact this + obtain ⟨hp₁, hq₁⟩ := hend he + rw [ha'] at hp₁ + rw [hb'] at hq₁ + refine ⟨_, hp₁, _, hq₁, hae ⟨e, he⟩, fun hz => hz.2.2 e he rfl⟩ + · intro A B hAB hord v hv hsub + have hw := subdiv_inl (ha := ha) (hb := hb) hv + have hfinL : V(L).Finite := by + refine (H.vertexSet_finite.image _).union ?_ + have : Finite ↥H.edgeSet := H.edgeSet_finite.to_subtype + exact Set.finite_range _ + have hle : H.vertexSet.ncard ≤ V(L).ncard := by + rw [← Set.ncard_image_of_injective _ Sum.inl_injective] + exact Set.ncard_le_ncard subset_union_left hfinL + exact h6 hAB (hord.trans_le hle) _ hw fun x hx => hsub ⟨_, hw, rfl, hx⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/SubdivideDraw.lean b/LeanPool/GraphMinor/GM17/SubdivideDraw.lean new file mode 100644 index 0000000000..57fda6eeda --- /dev/null +++ b/LeanPool/GraphMinor/GM17/SubdivideDraw.lean @@ -0,0 +1,452 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Subdivide +public import LeanPool.GraphMinor.GM17.AngleOrder +public import LeanPool.GraphMinor.Surface.ArcTools + +/-! +# A drawing of `H` gives a drawing of its double subdivision + +We cut each edge of a drawing of `H` at the points with parameters `1/3` and `2/3` +(`canBeDrawnIn_subdiv`). +-/ + +@[expose] public noncomputable section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface Graph unitInterval + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +/-- A path that is one to one, except that its two ends may agree. -/ +def IsEdgePath (c : I → S) : Prop := Continuous c ∧ ∀ s t, c s = c t → s = t ∨ (s = 0 ∧ t = 1) ∨ (s + = 1 ∧ t = 0) + +omit [T2Space S] in +theorem exists_path_of_line {L : Set S} {u v : S} (h : IsLineWithEnds L u v) : ∃ c : I + → S, IsEdgePath c ∧ c 0 = u ∧ c 1 = v ∧ range c = L := by + obtain ⟨f, h0, h1⟩ := h + refine ⟨fun t => (f t).1, ⟨continuous_subtype_val.comp f.continuous, + fun s t he => Or.inl (f.injective (Subtype.ext he))⟩, h0, h1, ?_⟩ + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (f t).2 + · intro hx + exact ⟨f.symm ⟨x, hx⟩, by simp⟩ + +omit [T2Space S] in +theorem exists_path_of_oArc {L : Set S} {u : S} (h : IsOArc L) (hu : u ∈ L) : ∃ c : I + → S, IsEdgePath c ∧ c 0 = u ∧ c 1 = u ∧ range c = L := by + obtain ⟨g⟩ := h + have hpi := Real.pi_pos + let w₀ : Circle := g.symm ⟨u, hu⟩ + have hval : (g w₀).1 = u := by simp [w₀] + refine ⟨fun t => (g (w₀ * Circle.exp (2 * Real.pi * t.1))).1, ⟨?_, fun s t he => ?_⟩, ?_, ?_, ?_⟩ + · refine continuous_subtype_val.comp (g.continuous.comp ?_) + exact continuous_const.mul (Circle.exp.continuous.comp (by fun_prop)) + · have h1 := g.injective (Subtype.ext he) + have h2 := mul_left_cancel h1 + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h2 + have h3 : (s.1 : ℝ) - t.1 = m := by + have : 2 * Real.pi * ((s.1 : ℝ) - t.1 - m) = 0 := by linear_combination hm + have h4 := (mul_eq_zero.mp this).resolve_left (by positivity) + linarith + have hs := s.2 + have ht := t.2 + have h5 : (m : ℝ) ≤ 1 := by linarith [hs.2, ht.1] + have h6 : (-1 : ℝ) ≤ m := by linarith [hs.1, ht.2] + have h7 : m ≤ 1 := by exact_mod_cast h5 + have h8 : -1 ≤ m := by exact_mod_cast h6 + have hcases : m = -1 ∨ m = 0 ∨ m = 1 := by omega + rcases hcases with rfl | rfl | rfl + · right; left + push_cast at h3 + exact ⟨Subtype.ext (show (s.1 : ℝ) = 0 by linarith [hs.1, ht.2]), + Subtype.ext (show (t.1 : ℝ) = 1 by linarith [hs.1, ht.2])⟩ + · left + push_cast at h3 + exact Subtype.ext (by linarith) + · right; right + push_cast at h3 + exact ⟨Subtype.ext (show (s.1 : ℝ) = 1 by linarith [hs.2, ht.1]), + Subtype.ext (show (t.1 : ℝ) = 0 by linarith [hs.2, ht.1])⟩ + · simp [hval] + · have : Circle.exp (2 * Real.pi) = 1 := Circle.exp_two_pi + simp [this, hval] + · ext x + constructor + · rintro ⟨t, rfl⟩ + exact (g _).2 + · intro hx + obtain ⟨θ, hθ, he⟩ := exists_angle_mem 0 (w₀⁻¹ * g.symm ⟨x, hx⟩) + have h1 : 0 ≤ θ / (2 * Real.pi) := div_nonneg hθ.1 (by positivity) + have h2 : θ / (2 * Real.pi) ≤ 1 := by + rw [div_le_one (by positivity)] + linarith [hθ.2] + refine ⟨⟨θ / (2 * Real.pi), h1, h2⟩, ?_⟩ + change (g (w₀ * Circle.exp (2 * Real.pi * (θ / (2 * Real.pi))))).1 = x + rw [show 2 * Real.pi * (θ / (2 * Real.pi)) = θ by field_simp, he, mul_inv_cancel_left, + g.apply_symm_apply] + +/-- A piece of the unit interval. -/ +def pc (x y : ℝ) : Set I := {t | x ≤ t.1 ∧ t.1 ≤ y} + +theorem IsEdgePath.line {c : I → S} (hc : IsEdgePath c) {x y : I} (hxy : x.1 < y.1) (hne : ¬ (x = 0 + ∧ y = 1)) : IsLineWithEnds (c '' pc x.1 y.1) (c x) (c y) := by + have hx := x.2 + have hy := y.2 + let φ : I → I := fun t => ⟨x.1 + t.1 * (y.1 - x.1), by nlinarith [t.2.1, t.2.2, hx.1], by + nlinarith [t.2.1, t.2.2, hy.2]⟩ + let e : I → S := fun t => c (φ t) + have hφ : Continuous φ := by + refine Continuous.subtype_mk ?_ _ + fun_prop + have hec : Continuous e := hc.1.comp hφ + have hφi : Function.Injective φ := fun s t he => by + have h1 : x.1 + s.1 * (y.1 - x.1) = x.1 + t.1 * (y.1 - x.1) := congrArg Subtype.val he + have h2 : (s.1 - t.1) * (y.1 - x.1) = 0 := by linarith + have h3 := (mul_eq_zero.mp h2).resolve_right (by linarith) + exact Subtype.ext (by linarith) + have hbd : ∀ t, x.1 ≤ (φ t).1 ∧ (φ t).1 ≤ y.1 := fun t => by + change x.1 ≤ x.1 + t.1 * (y.1 - x.1) ∧ x.1 + t.1 * (y.1 - x.1) ≤ y.1 + constructor <;> nlinarith [t.2.1, t.2.2] + have hei : Function.Injective e := fun s t he => by + rcases hc.2 _ _ he with h | ⟨h1, h2⟩ | ⟨h1, h2⟩ + · exact hφi h + · exfalso + apply hne + have h3 := hbd s + have h4 := hbd t + rw [h1] at h3 + rw [h2] at h4 + exact ⟨Subtype.ext (le_antisymm h3.1 hx.1), Subtype.ext (le_antisymm hy.2 h4.2)⟩ + · exfalso + apply hne + have h3 := hbd s + have h4 := hbd t + rw [h1] at h3 + rw [h2] at h4 + exact ⟨Subtype.ext (le_antisymm h4.1 hx.1), Subtype.ext (le_antisymm hy.2 h3.2)⟩ + have hr : range e = c '' pc x.1 y.1 := by + ext z + constructor + · rintro ⟨t, rfl⟩ + exact ⟨φ t, hbd t, rfl⟩ + · rintro ⟨t, ⟨h1, h2⟩, rfl⟩ + have hd : 0 < y.1 - x.1 := by linarith + refine ⟨⟨(t.1 - x.1) / (y.1 - x.1), div_nonneg (by linarith) hd.le, ?_⟩, ?_⟩ + · rw [div_le_one hd] + linarith + change c (φ _) = c t + congr 1 + apply Subtype.ext + change x.1 + (t.1 - x.1) / (y.1 - x.1) * (y.1 - x.1) = t.1 + field_simp + ring + have hem := hec.isClosedEmbedding hei + refine ⟨hem.isEmbedding.toHomeomorph.trans (Homeomorph.setCongr hr), ?_, ?_⟩ + · change e 0 = c x + change c (φ 0) = c x + congr 1 + apply Subtype.ext + simp [φ] + · change e 1 = c y + change c (φ 1) = c y + congr 1 + apply Subtype.ext + simp [φ] + +/-- The point of the path at one third. -/ +def t₁ : I := ⟨1 / 3, by norm_num, by norm_num⟩ + +/-- The point of the path at two thirds. -/ +def t₂ : I := ⟨2 / 3, by norm_num, by norm_num⟩ + +/-- The two ends of the `i`-th piece of the path. -/ +def pts : Fin 3 → I × I + | 0 => (0, t₁) + | 1 => (t₁, t₂) + | 2 => (t₂, 1) + +theorem t₁_ne_zero : t₁ ≠ 0 := fun h => by + have := congrArg Subtype.val h + norm_num [t₁] at this + +theorem t₁_ne_one : t₁ ≠ 1 := fun h => by + have := congrArg Subtype.val h + norm_num [t₁] at this + +theorem t₂_ne_zero : t₂ ≠ 0 := fun h => by + have := congrArg Subtype.val h + norm_num [t₂] at this + +theorem t₂_ne_one : t₂ ≠ 1 := fun h => by + have := congrArg Subtype.val h + norm_num [t₂] at this + +theorem t₁_ne_t₂ : t₁ ≠ t₂ := fun h => by + have := congrArg Subtype.val h + norm_num [t₁, t₂] at this + +/-- The piece of the unit interval with index `i`. -/ +abbrev piece (i : Fin 3) : Set I := pc (pts i).1.1 (pts i).2.1 + +theorem mem_piece_of_ne {i j : Fin 3} (hij : i ≠ j) {t : I} (hi : t ∈ piece i) + (hj : t ∈ piece j) : t = t₁ ∨ t = t₂ := by + obtain ⟨h1, h2⟩ := hi + obtain ⟨h3, h4⟩ := hj + have hz : ((0 : I) : ℝ) = 0 := rfl + have ho : ((1 : I) : ℝ) = 1 := rfl + have ht1 : (t₁ : ℝ) = 1 / 3 := rfl + have ht2 : (t₂ : ℝ) = 2 / 3 := rfl + fin_cases i <;> fin_cases j <;> simp only [pts, hz, ho, ht1, ht2] at h1 h2 h3 h4 + · exact absurd rfl hij + · exact Or.inl (Subtype.ext (le_antisymm (by rw [ht1]; exact h2) (by rw [ht1]; exact h3))) + · linarith + · exact Or.inl (Subtype.ext (le_antisymm (by rw [ht1]; exact h4) (by rw [ht1]; exact h1))) + · exact absurd rfl hij + · exact Or.inr (Subtype.ext (le_antisymm (by rw [ht2]; exact h2) (by rw [ht2]; exact h3))) + · linarith + · exact Or.inr (Subtype.ext (le_antisymm (by rw [ht2]; exact h4) (by rw [ht2]; exact h1))) + · exact absurd rfl hij + +theorem piece_of_zero {i : Fin 3} (h : (0 : I) ∈ piece i) : i = 0 := by + obtain ⟨h1, -⟩ := h + have hz : ((0 : I) : ℝ) = 0 := rfl + have ht1 : (t₁ : ℝ) = 1 / 3 := rfl + have ht2 : (t₂ : ℝ) = 2 / 3 := rfl + fin_cases i + · rfl + · simp only [pts, hz, ht1] at h1 + linarith + · simp only [pts, hz, ht2] at h1 + linarith + +theorem piece_of_one {i : Fin 3} (h : (1 : I) ∈ piece i) : i = 2 := by + obtain ⟨-, h1⟩ := h + have ho : ((1 : I) : ℝ) = 1 := rfl + have ht1 : (t₁ : ℝ) = 1 / 3 := rfl + have ht2 : (t₂ : ℝ) = 2 / 3 := rfl + fin_cases i + · simp only [pts, ho, ht1] at h1 + linarith + · simp only [pts, ho, ht2] at h1 + linarith + · rfl + +theorem piece_of_t₁ {i : Fin 3} (h : t₁ ∈ piece i) : i = 0 ∨ i = 1 := by + obtain ⟨h1, -⟩ := h + have ht1 : (t₁ : ℝ) = 1 / 3 := rfl + have ht2 : (t₂ : ℝ) = 2 / 3 := rfl + fin_cases i + · exact Or.inl rfl + · exact Or.inr rfl + · simp only [pts, ht1, ht2] at h1 + linarith + +theorem piece_of_t₂ {i : Fin 3} (h : t₂ ∈ piece i) : i = 1 ∨ i = 2 := by + obtain ⟨-, h1⟩ := h + have ho : ((0 : I) : ℝ) = 0 := rfl + have ht1 : (t₁ : ℝ) = 1 / 3 := rfl + have ht2 : (t₂ : ℝ) = 2 / 3 := rfl + fin_cases i + · simp only [pts, ht1, ht2] at h1 + linarith + · exact Or.inl rfl + · exact Or.inr rfl + +variable {α' β' : Type} {H : Hypergraph α' β'} {a b : ↥H.edgeSet → α'} + +/-- A drawing of `H` gives a drawing of its double subdivision. We cut each edge at the points at +one third and two thirds of its path. -/ +theorem canBeDrawnIn_subdiv (hab : ∀ e : ↥H.edgeSet, H.ends e.1 = {a e, b e}) + (ha : ∀ e, a e ∈ H.vertexSet) (hb : ∀ e, b e ∈ H.vertexSet) (h : CanBeDrawn S H) : + GM16.CanBeDrawnIn S (subdiv H a b ha hb) := by + classical + obtain ⟨ν, F, h1, h2, h3, h4, h5⟩ := h + have hpath : ∀ e : ↥H.edgeSet, ∃ c : I → S, IsEdgePath c ∧ c 0 = ν (a e) ∧ c 1 = ν (b e) + ∧ range c = F e.1 := by + intro e + have hia : H.Inc e.1 (a e) := by + change a e ∈ H.ends e.1 + rw [hab] + exact Or.inl rfl + have hib : H.Inc e.1 (b e) := by + change b e ∈ H.ends e.1 + rw [hab] + exact Or.inr rfl + by_cases hne : a e = b e + · have hend : H.ends e.1 = {a e} := by rw [hab, ← hne]; simp + obtain ⟨ho, hm⟩ := h3 e.1 e.2 _ hend + obtain ⟨c, hc, h0, h1', hr⟩ := exists_path_of_oArc ho hm + exact ⟨c, hc, h0, by rw [h1', hne], hr⟩ + · exact exists_path_of_line (h2 e.1 e.2 _ _ hia hib hne) + choose c hc hc0 hc1 hcr using hpath + have hmemF : ∀ e t, c e t ∈ F e.1 := fun e t => hcr e ▸ mem_range_self t + have hint : ∀ e t, t ≠ 0 → t ≠ 1 → ∀ v ∈ H.vertexSet, c e t ≠ ν v := by + intro e t ht0 ht1 v hv he + have hi : v ∈ H.ends e.1 := h5 e.1 e.2 v hv (he ▸ hmemF e t) + rw [hab] at hi + rcases hi with rfl | rfl + · rcases (hc e).2 t 0 (he.trans (hc0 e).symm) with h' | ⟨h', -⟩ | ⟨h', -⟩ + · exact ht0 h' + · exact ht0 h' + · exact ht1 h' + · rcases (hc e).2 t 1 (he.trans (hc1 e).symm) with h' | ⟨h', -⟩ | ⟨h', -⟩ + · exact ht1 h' + · exact ht0 h' + · exact ht1 h' + have hcross : ∀ {e e' : ↥H.edgeSet}, e ≠ e' → ∀ {t t'}, c e t = c e' t' + → ∃ v ∈ H.vertexSet, c e t = ν v := by + intro e e' hne t t' he + obtain ⟨v, hv, hx⟩ := h4 e.1 e.2 e'.1 e'.2 (fun h => hne (Subtype.ext h)) ⟨hmemF e t, he ▸ + hmemF e' t'⟩ + exact ⟨v, hv, hx.symm⟩ + let ν' : SV H → S := fun w => match w with + | .inl v => ν v + | .inr (e, false) => c e t₁ + | .inr (e, true) => c e t₂ + let F' : SE H → Set S := fun f => c f.1 '' piece f.2 + have hends : ∀ f : SE H, ν' (lnk H a b f).1 = c f.1 (pts f.2).1 ∧ ν' (lnk H a b f).2 = c f.1 + (pts f.2).2 := by + rintro ⟨e, i⟩ + fin_cases i + · exact ⟨(hc0 e).symm, rfl⟩ + · exact ⟨rfl, rfl⟩ + · exact ⟨rfl, (hc1 e).symm⟩ + have hline : ∀ f : SE H, IsLineWithEnds (F' f) (ν' (lnk H a b f).1) (ν' (lnk H a b f).2) := by + intro f + rw [(hends f).1, (hends f).2] + obtain ⟨e, i⟩ := f + have hz : ((0 : I) : ℝ) = 0 := rfl + have ho : ((1 : I) : ℝ) = 1 := rfl + have ht1 : (t₁ : ℝ) = 1 / 3 := rfl + have ht2 : (t₂ : ℝ) = 2 / 3 := rfl + fin_cases i + · exact (hc e).line (by change ((0 : I) : ℝ) < t₁; rw [hz, ht1]; norm_num) fun h + => t₁_ne_one h.2 + · exact (hc e).line (by change (t₁ : ℝ) < t₂; rw [ht1, ht2]; norm_num) fun h => t₁_ne_zero h.1 + · exact (hc e).line (by change (t₂ : ℝ) < ((1 : I) : ℝ); rw [ho, ht2]; norm_num) fun h + => t₂_ne_zero h.1 + have hlnk : ∀ f : SE H, (lnk H a b f).1 ≠ (lnk H a b f).2 := by + rintro ⟨e, i⟩ + fin_cases i <;> simp [lnk] + have hmem : ∀ f : SE H, (lnk H a b f).1 ∈ V(subdiv H a b ha hb) ∧ (lnk H a b f).2 ∈ V(subdiv H a + b ha hb) := by + rintro ⟨e, i⟩ + fin_cases i + · exact ⟨subdiv_inl (ha e), subdiv_inr _⟩ + · exact ⟨subdiv_inr _, subdiv_inr _⟩ + · exact ⟨subdiv_inr _, subdiv_inl (hb e)⟩ + have hincl : ∀ (f : SE H), (subdiv H a b ha hb).Inc f (lnk H a b f).1 := fun f => ⟨_, Or.inl rfl⟩ + have hincr : ∀ (f : SE H), (subdiv H a b ha hb).Inc f (lnk H a b f).2 := fun f => ⟨_, Or.inr rfl⟩ + have htstar : ∀ (e : ↥H.edgeSet) (t t' : I), t ≠ 0 → t ≠ 1 → c e t = c e t' → t = t' := by + intro e t t' h0 h1' he + rcases (hc e).2 _ _ he with h' | ⟨h', -⟩ | ⟨h', -⟩ + · exact h' + · exact absurd h' h0 + · exact absurd h' h1' + refine ⟨ν', F', ?_, ?_, ?_, ?_, ?_⟩ + · rintro (u | ⟨e, _ | _⟩) hu (w | ⟨e', _ | _⟩) hw he + · have hu' : u ∈ H.vertexSet := by simpa [subdiv] using hu + have hw' : w ∈ H.vertexSet := by simpa [subdiv] using hw + rw [h1 hu' hw' he] + · have hu' : u ∈ H.vertexSet := by simpa [subdiv] using hu + exact absurd he.symm (hint e' _ t₁_ne_zero t₁_ne_one u hu') + · have hu' : u ∈ H.vertexSet := by simpa [subdiv] using hu + exact absurd he.symm (hint e' _ t₂_ne_zero t₂_ne_one u hu') + · have hw' : w ∈ H.vertexSet := by simpa [subdiv] using hw + exact absurd he (hint e _ t₁_ne_zero t₁_ne_one w hw') + · by_cases hee : e = e' + · rw [hee] + · obtain ⟨v, hv, hx⟩ := hcross hee he + exact absurd hx (hint e _ t₁_ne_zero t₁_ne_one v hv) + · by_cases hee : e = e' + · subst hee + exact absurd (htstar e _ _ t₁_ne_zero t₁_ne_one he) t₁_ne_t₂ + · obtain ⟨v, hv, hx⟩ := hcross hee he + exact absurd hx (hint e _ t₁_ne_zero t₁_ne_one v hv) + · have hw' : w ∈ H.vertexSet := by simpa [subdiv] using hw + exact absurd he (hint e _ t₂_ne_zero t₂_ne_one w hw') + · by_cases hee : e = e' + · subst hee + exact absurd (htstar e _ _ t₂_ne_zero t₂_ne_one he).symm t₁_ne_t₂ + · obtain ⟨v, hv, hx⟩ := hcross hee he + exact absurd hx (hint e _ t₂_ne_zero t₂_ne_one v hv) + · by_cases hee : e = e' + · rw [hee] + · obtain ⟨v, hv, hx⟩ := hcross hee he + exact absurd hx (hint e _ t₂_ne_zero t₂_ne_one v hv) + · intro f _ u v hl _ + rcases hl with hl | hl + · have := hline f + rw [hl] at this + exact this + · have hl' : IsLineWithEnds (F' f) (ν' v) (ν' u) := by + have := hline f + rwa [hl] at this + exact hl'.symm + · intro f _ v hl + have hl' : (subdiv H a b ha hb).IsLink f v v := hl + rcases hl' with hl' | hl' <;> · have := hlnk f; rw [hl'] at this; exact absurd rfl this + · rintro ⟨e, i⟩ _ ⟨e', j⟩ _ hne x ⟨⟨t, ht, rfl⟩, ⟨t', ht', he⟩⟩ + by_cases hee : e = e' + · subst hee + have hij : i ≠ j := fun h => hne (by rw [h]) + rcases (hc e).2 _ _ he with h' | ⟨-, h'⟩ | ⟨-, h'⟩ + · subst h' + rcases mem_piece_of_ne hij ht ht' with rfl | rfl + · exact ⟨_, subdiv_inr (e, false), rfl⟩ + · exact ⟨_, subdiv_inr (e, true), rfl⟩ + · subst h' + exact ⟨_, subdiv_inl (hb e), (hc1 e).symm⟩ + · subst h' + exact ⟨_, subdiv_inl (ha e), (hc0 e).symm⟩ + · obtain ⟨v, hv, hx⟩ := hcross (Ne.symm hee) he + exact ⟨_, subdiv_inl hv, by rw [← he, hx]⟩ + · rintro ⟨e, i⟩ _ w hw ⟨t, ht, he⟩ + rcases w with v | ⟨e', _ | _⟩ + · have hv : v ∈ H.vertexSet := by simpa [subdiv] using hw + by_cases ht0 : t = 0 + · subst ht0 + obtain rfl := piece_of_zero ht + have : v = a e := h1 hv (ha e) (he.symm.trans (hc0 e)) + rw [this] + exact hincl (e, 0) + · by_cases ht1 : t = 1 + · subst ht1 + obtain rfl := piece_of_one ht + have : v = b e := h1 hv (hb e) (he.symm.trans (hc1 e)) + rw [this] + exact hincr (e, 2) + · exact absurd he (hint e t ht0 ht1 v hv) + · by_cases hee : e' = e + · subst hee + have : t₁ = t := htstar e' _ _ t₁_ne_zero t₁_ne_one he.symm + subst this + rcases piece_of_t₁ ht with rfl | rfl + · exact hincr (e', 0) + · exact hincl (e', 1) + · obtain ⟨v, hv, hx⟩ := hcross hee he.symm + exact absurd hx (hint e' _ t₁_ne_zero t₁_ne_one v hv) + · by_cases hee : e' = e + · subst hee + have : t₂ = t := htstar e' _ _ t₂_ne_zero t₂_ne_one he.symm + subst this + rcases piece_of_t₂ ht with rfl | rfl + · exact hincr (e', 1) + · exact hincl (e', 2) + · obtain ⟨v, hv, hx⟩ := hcross hee he.symm + exact absurd hx (hint e' _ t₂_ne_zero t₂_ne_one v hv) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/Theta.lean b/LeanPool/GraphMinor/GM17/Theta.lean new file mode 100644 index 0000000000..7951e1d747 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/Theta.lean @@ -0,0 +1,297 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.CellNodes +public import LeanPool.GraphMinor.Surface.ArcInPath + +/-! +# Three lines between two points + +Assume three lines join two points and the union of any two of them bounds a disc that misses the +third line. Then the three discs cover the surface +(`theta_cover`). This is how we show that the frontier of a region passes through a node at most +once. We also collect small tools on lines used there. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology Metric GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- Near a point of the boundary of a disc, the disc without that point is connected. -/ +theorem disc_punct {D V : Set S} {x : S} (hD : IsClosedDisc D) (hx : x ∈ discBd D) (hV : V ∈ 𝓝 x) : + ∃ C W, IsPreconnected C ∧ C ⊆ D ∧ C ⊆ V ∧ x ∉ C ∧ W ∈ 𝓝 x ∧ (D ∩ W) \ {x} ⊆ C := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hxD := discBd_subset D hx + have hw : ‖h x‖ = 1 := by + have h1 : h x ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem _ hx + simpa using h1 + have hwm : h x ∈ closedBall (0 : ℂ) 1 := c.hm hxD + have hgw : g (h x) = x := c.gh hxD + have h1 : g ⁻¹' V ∈ 𝓝[closedBall (0 : ℂ) 1] (h x) := (c.gc _ hwm) (by rw [hgw]; exact hV) + obtain ⟨ε, hε, hsub⟩ := Metric.mem_nhdsWithin_iff.mp h1 + obtain ⟨u, hu, he⟩ := (_root_.continuousOn_iff'.mp c.hc) (ball (h x) ε) isOpen_ball + refine ⟨g '' ((closedBall 0 1 ∩ ball (h x) ε) \ {h x}), u, (isPreconnected_ball_diff hw ε).image + _ (c.gc.mono fun z hz => hz.1.1), ?_, ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact c.gm hz.1.1 + · rintro _ ⟨z, hz, rfl⟩ + exact hsub ⟨hz.1.2, hz.1.1⟩ + · rintro ⟨z, hz, he'⟩ + apply hz.2 + rw [← c.hg hz.1.1, he'] + rfl + · refine hu.mem_nhds ?_ + have h2 : x ∈ h ⁻¹' ball (h x) ε ∩ D := ⟨mem_ball_self hε, hxD⟩ + rw [he] at h2 + exact h2.1 + · rintro y ⟨⟨hyD, hyu⟩, hyx⟩ + have h2 : y ∈ h ⁻¹' ball (h x) ε ∩ D := by + rw [he] + exact ⟨hyu, hyD⟩ + refine ⟨h y, ⟨⟨c.hm hyD, h2.1⟩, fun he' => hyx ?_⟩, c.gh hyD⟩ + rw [← c.gh hyD, he', hgw] + rfl + +/-- A line in a path connected set that joins two closed sets and meets them only in its ends. -/ +theorem exists_bridge {r X Y : Set S} {x₀ y₀ : S} (hr : IsPathConnected r) (hX : IsClosed X) + (hY : IsClosed Y) (hx₀ : x₀ ∈ X) (hx₀r : x₀ ∈ r) (hy₀ : y₀ ∈ Y) (hy₀r : y₀ ∈ r) + (hd : ∀ z ∈ r, z ∈ X → z ∉ Y) : ∃ β x y, IsLineWithEnds β x y ∧ β ⊆ r ∧ x ∈ X ∧ y ∈ Y ∧ β ∩ X + = {x} ∧ β ∩ Y = {y} := by + obtain ⟨γ, hγ⟩ := (hr.joinedIn x₀ hx₀r y₀ hy₀r) + have hne : γ 0 ≠ γ 1 := by + rw [γ.source, γ.target] + rintro rfl + exact hd _ hx₀r hx₀ hy₀ + obtain ⟨e, hec, hei, he0, he1, her⟩ := exists_arc_of_path γ.continuous hne + have her' : ∀ t, e t ∈ r := fun t => by + obtain ⟨s, hs⟩ := her (mem_range_self t) + exact hs ▸ hγ s + have hT₁ : IsCompact (e ⁻¹' X) := (hX.preimage hec).isCompact + obtain ⟨t₁, ht₁, hmax⟩ := + hT₁.exists_isGreatest ⟨0, by rw [mem_preimage, he0, γ.source]; exact hx₀⟩ + have hT₂ : IsCompact (e ⁻¹' Y ∩ Ici t₁) := ((hY.preimage hec).inter isClosed_Ici).isCompact + obtain ⟨t₂, ⟨ht₂, ht₁₂⟩, hmin⟩ := + hT₂.exists_isLeast ⟨1, by + rw [mem_inter_iff, mem_preimage, he1, γ.target] + exact ⟨hy₀, unitInterval.le_one _⟩⟩ + have hlt : t₁ < t₂ := lt_of_le_of_ne ht₁₂ fun h => hd _ (her' t₁) ht₁ (h ▸ ht₂) + refine ⟨e '' Icc t₁ t₂, e t₁, e t₂, isLine_piece ⟨hec, hei⟩ hlt, ?_, ht₁, ht₂, ?_, ?_⟩ + · rintro _ ⟨t, -, rfl⟩ + exact her' t + · apply subset_antisymm + · rintro _ ⟨⟨t, ht, rfl⟩, hX'⟩ + rw [show t = t₁ from le_antisymm (hmax hX') ht.1] + rfl + · rintro _ rfl + exact ⟨⟨t₁, ⟨le_rfl, ht₁₂⟩, rfl⟩, ht₁⟩ + · apply subset_antisymm + · rintro _ ⟨⟨t, ht, rfl⟩, hY'⟩ + rw [show t = t₂ from le_antisymm ht.2 (hmin ⟨hY', ht.1⟩)] + rfl + · rintro _ rfl + exact ⟨⟨t₂, ⟨ht₁₂, le_rfl⟩, rfl⟩, ht₂⟩ + +/-- The piece of a line from one end up to a point other than this end. -/ +theorem sub_line {L : Set S} {u v x : S} (hL : IsLineWithEnds L u v) (hx : x ∈ L) + (hxu : x ≠ u) : ∃ L₁, IsLineWithEnds L₁ u x ∧ L₁ ⊆ L ∧ (x ≠ v → v ∉ L₁) := by + by_cases hxv : x = v + · subst hxv + exact ⟨L, hL, subset_rfl, fun h => absurd rfl h⟩ + · obtain ⟨L₁, L₂, h1, h2, hu, hi⟩ := hL.split hx hxu hxv + refine ⟨L₁, h1, hu ▸ subset_union_left, fun _ hv => hxv ?_⟩ + have h3 : v ∈ L₁ ∩ L₂ := ⟨hv, h2.right_mem⟩ + rw [hi] at h3 + exact h3.symm + +/-- Splitting an `O`-arc made of two lines at another point, keeping each line near the first end. +-/ +theorem split_oarc {A₁ A₂ : Set S} {a x q : S} (h₁ : IsLineWithEnds A₁ a x) + (h₂ : IsLineWithEnds A₂ a x) (hi : A₁ ∩ A₂ = {a, x}) (hq : q ∈ A₁ ∪ A₂) (hqa : q ≠ a) : + ∃ P₁ P₂, IsLineWithEnds P₁ a q ∧ IsLineWithEnds P₂ a q ∧ P₁ ∪ P₂ = A₁ ∪ A₂ ∧ P₁ ∩ P₂ = {a, q} + ∧ a ∉ closure (P₁ \ A₁) ∧ a ∉ closure (P₂ \ A₂) := by + have hstep : ∀ {A B : Set S}, IsLineWithEnds A a x → IsLineWithEnds B a x → A ∩ B = {a, x} + → q ∈ B → q ≠ x → + ∃ P₁ P₂, IsLineWithEnds P₁ a q ∧ IsLineWithEnds P₂ a q ∧ P₁ ∪ P₂ = A ∪ B ∧ P₁ ∩ P₂ = {a, q} + ∧ a ∉ closure (P₁ \ A) ∧ a ∉ closure (P₂ \ B) := fun {A B} hA hB hAB hqB hqx => by + obtain ⟨B₁, B₂, h1, h2, hu, hi'⟩ := hB.split hqB hqa hqx + have hB₁ : B₁ ⊆ B := hu ▸ subset_union_left + have hB₂ : B₂ ⊆ B := hu ▸ subset_union_right + have hsub : A ∩ B₂ = {x} := by + apply subset_antisymm + · rintro z ⟨hz, hz'⟩ + rcases (hAB ▸ ⟨hz, hB₂ hz'⟩ : z ∈ ({a, x} : Set S)) with rfl | rfl + · exfalso + have h3 : z ∈ B₁ ∩ B₂ := ⟨h1.left_mem, hz'⟩ + rw [hi'] at h3 + exact hqa h3.symm + · rfl + · rintro _ rfl + exact ⟨hA.right_mem, h2.right_mem⟩ + have hl : IsLineWithEnds (A ∪ B₂) a q := hA.union h2.symm hsub + have hC : a ∉ B₂ := fun h => by + have h3 : a ∈ B₁ ∩ B₂ := ⟨h1.left_mem, h⟩ + rw [hi'] at h3 + exact hqa h3.symm + refine ⟨A ∪ B₂, B₁, hl, h1, ?_, ?_, ?_, ?_⟩ + · rw [union_assoc, union_comm B₂, hu] + · apply subset_antisymm + · rintro z ⟨h3 | h3, hz⟩ + · rcases (hAB ▸ ⟨h3, hB₁ hz⟩ : z ∈ ({a, x} : Set S)) with rfl | rfl + · exact .inl rfl + · exfalso + have h4 : z ∈ B₁ ∩ B₂ := ⟨hz, h2.right_mem⟩ + rw [hi'] at h4 + exact hqx h4.symm + · exact .inr (hi' ▸ ⟨hz, h3⟩) + · rintro z (rfl | rfl) + · exact ⟨.inl hA.left_mem, h1.left_mem⟩ + · exact ⟨.inr h2.left_mem, h1.right_mem⟩ + · have h3 : (A ∪ B₂) \ A ⊆ B₂ := fun z hz => hz.1.resolve_left hz.2 + exact fun h => hC (h2.isCompact.isClosed.closure_subset_iff.mpr h3 h) + · have h3 : B₁ \ B = ∅ := Set.sdiff_eq_empty.mpr hB₁ + rw [h3, closure_empty] + exact notMem_empty _ + by_cases hqx : q = x + · subst hqx + exact ⟨A₁, A₂, h₁, h₂, rfl, hi, by simp, by simp⟩ + rcases hq with h | h + · obtain ⟨P₁, P₂, h1, h2, h3, h4, h5, h6⟩ := hstep h₂ h₁ (by rw [inter_comm]; exact hi) h hqx + exact ⟨P₂, P₁, h2, h1, by rw [union_comm, h3, union_comm], by rw [inter_comm, h4], h6, h5⟩ + · exact hstep h₁ h₂ hi h hqx + +/-- If three lines join two points and the union of any two bounds a disc that misses the third +line, then the discs cover the surface. -/ +theorem theta_cover [ConnectedSpace S] (hS : IsSurface S) {P₁ P₂ P₃ Δ₁ Δ₂ Δ₃ : Set S} {a q : S} + (h₁ : IsLineWithEnds P₁ a q) (h₂ : IsLineWithEnds P₂ a q) (h₃ : IsLineWithEnds P₃ a q) + (h₁₂ : P₁ ∩ P₂ = {a, q}) (h₂₃ : P₂ ∩ P₃ = {a, q}) (hd₃ : IsClosedDisc Δ₃) + (hd₁ : IsClosedDisc Δ₁) (hd₂ : IsClosedDisc Δ₂) (hb₃ : discBd Δ₃ = P₁ ∪ P₂) + (hb₁ : discBd Δ₁ = P₂ ∪ P₃) (hb₂ : discBd Δ₂ = P₁ ∪ P₃) + (hn₃ : Disjoint (P₃ \ {a, q}) Δ₃) (hn₁ : Disjoint (P₁ \ {a, q}) Δ₁) (hn₂ : Disjoint + (P₂ \ {a, q}) Δ₂) : Δ₃ ∪ Δ₁ ∪ Δ₂ = univ := by + have hman := hS.2.2 + have hinner : ∀ {P : Set S} , IsLineWithEnds P a q → ∃ z ∈ P, z ≠ a ∧ z ≠ q := fun hP => by + obtain ⟨z, hz, h1, h2, -⟩ := Painting.exists_inner hP (finite_empty (α := S)) + exact ⟨z, hz, h1, h2⟩ + have hint : Disjoint (discInt Δ₁) (P₁ ∪ P₂) := by + refine disjoint_left.mpr fun x hx hm => ?_ + rcases hm with h | h + · by_cases hx' : x ∈ ({a, q} : Set S) + · apply hx.2 + rw [hb₁] + rcases hx' with rfl | rfl + · exact .inl h₂.left_mem + · exact .inl h₂.right_mem + · exact disjoint_left.mp hn₁ ⟨h, hx'⟩ hx.1 + · exact hx.2 (hb₁ ▸ .inl h) + have hdj : Disjoint (discInt Δ₁) Δ₃ := by + rcases hd₃.side hman hd₁.isPreconnected_discInt (by rw [hb₃]; exact hint) with h | h + · exfalso + obtain ⟨z, hz, h1, h2⟩ := hinner h₃ + have h4 : z ∈ Δ₃ := closure_minimal (h.trans (discInt_subset _)) hd₃.isClosed + (hd₁.subset_closure_discInt (discBd_subset _ (hb₁ ▸ .inr hz))) + exact disjoint_left.mp hn₃ ⟨hz, by rintro (e | e); exacts [h1 e, h2 e]⟩ h4 + · exact h + have hin : Δ₃ ∩ Δ₁ = P₂ := by + apply subset_antisymm + · rintro x ⟨hx, hx'⟩ + have hb : x ∈ discBd Δ₁ := by + by_contra hn + exact disjoint_left.mp hdj ⟨hx', hn⟩ hx + rw [hb₁] at hb + rcases hb with h | h + · exact h + · by_contra hn + have hne : x ∉ ({a, q} : Set S) := by + rintro (rfl | rfl) + · exact hn h₂.left_mem + · exact hn h₂.right_mem + exact disjoint_left.mp hn₃ ⟨h, hne⟩ hx + · exact fun x hx => ⟨discBd_subset _ (hb₃ ▸ .inr hx), discBd_subset _ (hb₁ ▸ .inl hx)⟩ + obtain ⟨hE, hEb⟩ := disc_union _ _ _ _ _ hd₃ hd₁ h₂ hin (hb₃ ▸ subset_union_right) + (hb₁ ▸ subset_union_left) + have hEb' : discBd (Δ₃ ∪ Δ₁) = discBd Δ₂ := by + rw [hEb, hb₃, hb₁, hb₂] + ext x + constructor + · rintro ⟨(h | h) | (h | h), hn⟩ + · exact .inl h + · have h7 : x ∈ ({a, q} : Set S) := by + by_contra h7 + exact hn ⟨h, h7⟩ + rcases h7 with rfl | rfl + · exact .inl h₁.left_mem + · exact .inl h₁.right_mem + · have h7 : x ∈ ({a, q} : Set S) := by + by_contra h7 + exact hn ⟨h, h7⟩ + rcases h7 with rfl | rfl + · exact .inl h₁.left_mem + · exact .inl h₁.right_mem + · exact .inr h + · rintro (h | h) + · refine ⟨.inl (.inl h), fun hm => hm.2 ?_⟩ + have h3 : x ∈ P₁ ∩ P₂ := ⟨h, hm.1⟩ + rwa [h₁₂] at h3 + · refine ⟨.inr (.inr h), fun hm => hm.2 ?_⟩ + have h3 : x ∈ P₂ ∩ P₃ := ⟨hm.1, h⟩ + rwa [h₂₃] at h3 + rcases two_discs hS hE hd₂ hEb' with he | ⟨hcov, -⟩ + · exfalso + obtain ⟨z, hz, h1, h2⟩ := hinner h₂ + have h4 : z ∈ Δ₂ := he ▸ .inl (discBd_subset _ (hb₃ ▸ .inr hz)) + exact disjoint_left.mp hn₂ ⟨hz, by rintro (e | e); exacts [h1 e, h2 e]⟩ h4 + · exact hcov + +/-- A line that starts inside a strip near its end is off a disc whose boundary stays off the strip +near this end, if the side of the strip is off the disc. -/ +theorem third_off {St L P Δ F : Set S} {a b q : S} (hman : ∀ x : S, IsManifoldPoint x) + (hSt : IsClosedDisc St) (hL : IsLineWithEnds L a b) (hLb : L ⊆ discBd St) + (hΔ : IsClosedDisc Δ) (hb : discBd Δ = F) + (hLΔ : ∀ x ∈ L, x ≠ a → x ∉ Δ) (hP : IsLineWithEnds P a q) (hPF : Disjoint (P \ {a, q}) F) + (hgerm : a ∉ closure (P \ St)) (hFa : a ∉ closure ((F ∩ St) \ {a})) : + Disjoint (P \ {a, q}) Δ := by + have hV : (closure ((F ∩ St) \ {a}) ∪ closure (P \ St))ᶜ ∈ 𝓝 a := + (isClosed_closure.union isClosed_closure).isOpen_compl.mem_nhds (by + rintro (h | h) + · exact hFa h + · exact hgerm h) + obtain ⟨C, W, hC, hCD, hCV, haC, hW, hsub⟩ := disc_punct hSt (hLb hL.left_mem) hV + have hCF : Disjoint C (discBd Δ) := by + rw [hb] + refine disjoint_left.mpr fun x hx hxF => ?_ + have hxa : x ≠ a := fun e => haC (e ▸ hx) + exact hCV hx (.inl (subset_closure ⟨⟨hxF, hCD hx⟩, hxa⟩)) + have hCΔ : Disjoint C Δ := by + rcases hΔ.side hman hC hCF with h | h + · exfalso + have hcl : a ∈ closure (L \ {a, b}) := hL.subset_closure_diff hL.left_mem + obtain ⟨z, hzW, hz⟩ := mem_closure_iff_nhds.mp hcl _ hW + have hza : z ≠ a := fun e => hz.2 (.inl e) + have hzC := hsub ⟨⟨discBd_subset _ (hLb hz.1), hzW⟩, hza⟩ + exact hLΔ z hz.1 hza (h hzC).1 + · exact h + have hcl : a ∈ closure (P \ {a, q}) := hP.subset_closure_diff hP.left_mem + obtain ⟨z, hzW, hz⟩ := mem_closure_iff_nhds.mp hcl _ (Filter.inter_mem hW hV) + have hzSt : z ∈ St := by + by_contra hn + exact hzW.2 (.inr (subset_closure ⟨hz.1, hn⟩)) + have hza : z ≠ a := fun e => hz.2 (.inl e) + have hzC := hsub ⟨⟨hzSt, hzW.1⟩, hza⟩ + have hpart : IsPreconnected (P \ {a, q}) := hP.isPreconnected_diff + rcases hΔ.side hman hpart (by rw [hb]; exact hPF) with h | h + · exact absurd (h hz).1 (disjoint_left.mp hCΔ hzC) + · exact h + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/ThreeNodeReplace.lean b/LeanPool/GraphMinor/GM17/ThreeNodeReplace.lean new file mode 100644 index 0000000000..6e2ad734e5 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/ThreeNodeReplace.lean @@ -0,0 +1,544 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.ReplaceDisc +public import LeanPool.GraphMinor.GM17.Section11 +public import LeanPool.GraphMinor.Surface.Fan +public import LeanPool.GraphMinor.GM19.Section6Cuff +public import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# Replacing a disc by two cells + +We prove `ThreeNodeIArcReplaceDiscPaintingStatement`, the step of the proof of (11.3) of Graph +Minors +XVII, page 193. The part of a painting inside a disc `Δ` cut off by an `I`-arc `F` with three nodes +is +replaced by an internal cell with the three nodes and a border cell. We cut `Δ` along two chords +from +`n₁` to `n₂` into three discs, and keep the outer two. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +theorem line_inner_nonempty {P : Set S} {a b : S} (hP : IsLineWithEnds P a b) : + (P \ {a, b}).Nonempty := by + by_contra h + have h3 := hP.subset_closure_diff hP.left_mem + rw [not_nonempty_iff_eq_empty.mp h, closure_empty] at h3 + exact h3 + +/-- `P` without its ends is a component of the boundary without two points. -/ +theorem inner_mem_comps {Y P Q : Set S} {a b : S} (hP : IsLineWithEnds P a b) + (hQ : IsLineWithEnds Q a b) + (hU : Y = (P ∪ Q) \ {a, b}) (hI : P ∩ Q = {a, b}) : P \ {a, b} ∈ componentsIn Y := by + obtain ⟨x, hx⟩ := line_inner_nonempty hP + have hsub : P \ {a, b} ⊆ Y := by + rw [hU] + exact fun z hz => ⟨.inl hz.1, hz.2⟩ + have hpc : IsPreconnected (P \ {a, b}) := + (GM11.isPathConnected_sdiff_pair hP).isConnected.isPreconnected + refine ⟨x, hsub hx, Subset.antisymm ?_ (hpc.subset_connectedComponentIn hx hsub)⟩ + set A := connectedComponentIn Y x with hA + have hAY : A ⊆ Y := connectedComponentIn_subset _ _ + have hxA : x ∈ A := mem_connectedComponentIn (hsub hx) + have hcP : IsClosed P := (GM19.isClosed_of_cuffLine hP) + have hcQ : IsClosed Q := (GM19.isClosed_of_cuffLine hQ) + have hcov : A ⊆ P ∪ Q := fun z hz => by + have := hAY hz + rw [hU] at this + exact this.1 + have hno : ¬ (A ∩ Q).Nonempty := fun hm => by + obtain ⟨z, hzA, hz⟩ := (isPreconnected_closed_iff.mp isPreconnected_connectedComponentIn) P Q + hcP hcQ hcov + ⟨x, hxA, hx.1⟩ hm + have h3 := hAY hzA + rw [hU] at h3 + exact h3.2 (hI ▸ hz) + intro z hz + have h3 := hAY hz + rw [hU] at h3 + rcases h3.1 with h | h + · exact ⟨h, h3.2⟩ + · exact absurd ⟨z, hz, h⟩ hno + +/-- A chord cuts a disc with boundary `P ∪ Q` into a disc along `P` and a disc along `Q`. -/ +theorem split_disc {D P Q : Set S} {a b : S} (hD : IsClosedDisc D) (hP : IsLineWithEnds P a b) + (hQ : IsLineWithEnds Q a b) (hab : a ≠ b) (hU : P ∪ Q = discBd D) (hI : P ∩ Q = {a, b}) : + ∃ L Δ₁ Δ₂, IsLineWithEnds L a b ∧ L ∩ discBd D = {a, b} ∧ L ⊆ D ∧ IsClosedDisc Δ₁ + ∧ IsClosedDisc Δ₂ ∧ + Δ₁ ∪ Δ₂ = D ∧ Δ₁ ∩ Δ₂ = L ∧ discBd Δ₁ = P ∪ L ∧ discBd Δ₂ = Q ∪ L := by + obtain ⟨L, hL, hLD, hLb⟩ := Surface.exists_chord hD (hU ▸ .inl hP.left_mem) + (hU ▸ .inl hP.right_mem) hab + obtain ⟨A₁, A₂, Δ₁, Δ₂, hne, hc, hd₁, hd₂, hu, hi, hb₁, hb₂, -⟩ := + Surface.disc_iArc D L a b hD hLD hab hL hLb + have hY : discBd D \ {a, b} = (P ∪ Q) \ {a, b} := by rw [hU] + have hmP : P \ {a, b} ∈ componentsIn (discBd D \ {a, b}) := inner_mem_comps hP hQ hY hI + have hmQ : Q \ {a, b} ∈ componentsIn (discBd D \ {a, b}) := + inner_mem_comps hQ hP (by rw [hY, union_comm]) (by rw [inter_comm, hI]) + rw [hc] at hmP hmQ + have hdis : P \ {a, b} ≠ Q \ {a, b} := fun h => by + obtain ⟨x, hx⟩ := line_inner_nonempty hP + exact hx.2 (hI ▸ ⟨hx.1, (h ▸ hx : x ∈ Q \ {a, b}).1⟩) + have hfill : ∀ {R : Set S}, IsLineWithEnds R a b → (R \ {a, b}) ∪ L = R ∪ L := fun {R} hR => by + ext x + constructor + · rintro (h | h) + · exact .inl h.1 + · exact .inr h + · rintro (h | h) + · by_cases hx : x ∈ ({a, b} : Set S) + · rcases hx with rfl | rfl + · exact .inr hL.left_mem + · exact .inr hL.right_mem + · exact .inl ⟨h, hx⟩ + · exact .inr h + rcases hmP with hp | hp <;> rcases hmQ with hq | hq + · exact absurd (hp.trans hq.symm) hdis + · refine ⟨L, Δ₁, Δ₂, hL, hLb, hLD, hd₁, hd₂, hu, hi, ?_, ?_⟩ + · rw [hb₁, ← hp, hfill hP] + · rw [hb₂, ← hq, hfill hQ] + · refine ⟨L, Δ₂, Δ₁, hL, hLb, hLD, hd₂, hd₁, by rw [union_comm, hu], by rw [inter_comm, hi], + ?_, ?_⟩ + · rw [hb₂, ← hp, hfill hP] + · rw [hb₁, ← hq, hfill hQ] + · exact absurd (hp.trans hq.symm) hdis + +private theorem replacement_discs_intersect_at_arc_ends + (S : Type) + [TopologicalSpace S] + (n₁ : S) + (n₂ : S) + (F : Set S) + (I : Set S) + (L₁ : Set S) + (Δ₁ : Set S) + (M : Set S) + (hL₁ : IsLineWithEnds L₁ n₁ n₂) + (hi₁ : Δ₁ ∩ M = L₁) + (hb₁ : discBd Δ₁ = F ∪ L₁) + (hbM : discBd M = I ∪ L₁) + (L₂ : Set S) + (Δ₂ : Set S) + (M' : Set S) + (hL₂ : IsLineWithEnds L₂ n₁ n₂) + (hL₂b : L₂ ∩ discBd M = {n₁, n₂}) + (hi₂ : Δ₂ ∩ M' = L₂) + (hb₂ : discBd Δ₂ = I ∪ L₂) + (hsub₂ : Δ₂ ⊆ M) + (hL₁M' : L₁ ⊆ M') : + Δ₁ ∩ Δ₂ = {n₁, n₂} := by + refine Subset.antisymm ?_ ?_ + · rintro x ⟨hx₁, hx₂⟩ + have hxL₁ : x ∈ L₁ := hi₁ ▸ ⟨hx₁, hsub₂ hx₂⟩ + have hxL₂ : x ∈ L₂ := hi₂ ▸ ⟨hx₂, hL₁M' hxL₁⟩ + exact hL₂b ▸ ⟨hxL₂, hbM ▸ .inr hxL₁⟩ + · rintro x (rfl | rfl) + · exact ⟨discBd_subset _ (hb₁ ▸ .inr hL₁.left_mem), discBd_subset _ (hb₂ ▸ .inr hL₂.left_mem)⟩ + · exact ⟨discBd_subset _ (hb₁ ▸ .inr hL₁.right_mem), discBd_subset _ + (hb₂ ▸ .inr hL₂.right_mem)⟩ + +private theorem first_replacement_cell_nodes + (S : Type) + [TopologicalSpace S] + (n₁ : S) + (n₂ : S) + (n₃ : S) + (Δ₁ : Set S) + (Δ₂ : Set S) + (hn₃Δ₁ : n₃ ∈ discBd Δ₁) + (hn₁Δ₁ : n₁ ∈ discBd Δ₁) + (hn₂Δ₁ : n₂ ∈ discBd Δ₁) + (hcl₁ : closure (Δ₁ \ {n₁, n₂, n₃}) = Δ₁) + (hcl₂ : closure (Δ₂ \ {n₁, n₂}) = Δ₂) : + tilde (Δ₁ \ {n₁, n₂, n₃}) = {n₁, n₂, n₃} := by + let c₁ := Δ₁ \ {n₁, n₂, n₃} + let c₂ := Δ₂ \ {n₁, n₂} + rw [tilde, hcl₁] + ext x + constructor + · rintro ⟨h3, h4⟩ + exact by_contra fun h => h4 ⟨h3, h⟩ + · intro h3 + refine ⟨?_, fun h => h.2 h3⟩ + rcases h3 with rfl | rfl | rfl + · exact discBd_subset _ hn₁Δ₁ + · exact discBd_subset _ hn₂Δ₁ + · exact discBd_subset _ hn₃Δ₁ + +private theorem second_replacement_cell_nodes + (S : Type) + [TopologicalSpace S] + (n₁ : S) + (n₂ : S) + (n₃ : S) + (Δ₁ : Set S) + (Δ₂ : Set S) + (hn₁Δ₂ : n₁ ∈ discBd Δ₂) + (hn₂Δ₂ : n₂ ∈ discBd Δ₂) + (hcl₂ : closure (Δ₂ \ {n₁, n₂}) = Δ₂) + (ht₁ : tilde (Δ₁ \ {n₁, n₂, n₃}) = {n₁, n₂, n₃}) : + tilde (Δ₂ \ {n₁, n₂}) = {n₁, n₂} := by + let c₁ := Δ₁ \ {n₁, n₂, n₃} + let c₂ := Δ₂ \ {n₁, n₂} + rw [tilde, hcl₂] + ext x + constructor + · rintro ⟨h3, h4⟩ + exact by_contra fun h => h4 ⟨h3, h⟩ + · intro h3 + refine ⟨?_, fun h => h.2 h3⟩ + rcases h3 with rfl | rfl + · exact discBd_subset _ hn₁Δ₂ + · exact discBd_subset _ hn₂Δ₂ + +private theorem replacement_painting_cell_partition + (S : Type) + [TopologicalSpace S] + (Γ : Painting S) + (n₁ : S) + (n₂ : S) + (n₃ : S) + (F : Set S) + (Δ : Set S) + (h1 : F ⊆ discBd Δ) + (hside : ∀ c ∈ Γ.C, c ⊆ Δ ∨ c ⊆ Δᶜ) + (hnF : ∀ {x : S}, x ∈ ({n₁, n₂, n₃} : Set S) → x ∈ F ∧ x ∈ Γ.N) + (Δ₁ : Set S) + (M : Set S) + (hd₁ : IsClosedDisc Δ₁) + (Δ₂ : Set S) + (hd₂ : IsClosedDisc Δ₂) + (hsub₁ : Δ₁ ⊆ Δ) + (hsubM : M ⊆ Δ) + (hsub₂ : Δ₂ ⊆ M) + (hn₃out : n₃ ∉ Δ₂) + (hcl₁ : closure (Δ₁ \ {n₁, n₂, n₃}) = Δ₁) + (hcl₂ : closure (Δ₂ \ {n₁, n₂}) = Δ₂) + (hc₁Δ : (Δ₁ \ {n₁, n₂, n₃}) ⊆ Δ) + (hc₂Δ : (Δ₂ \ {n₁, n₂}) ⊆ Δ) + (hne₁ : (Δ₁ \ {n₁, n₂, n₃}).Nonempty) + (hne₂ : (Δ₂ \ {n₁, n₂}).Nonempty) + (hdisj12 : Disjoint (Δ₁ \ {n₁, n₂, n₃}) (Δ₂ \ {n₁, n₂})) + (hKfin : {c | c ∈ Γ.C ∧ c ⊆ Δᶜ}.Finite) + (hN'U : ∀ x ∈ Γ.N, x ∈ closure Δᶜ → x ∈ (Γ.N \ Δ ∪ {n₁, n₂, n₃})) + (hdisjN : ∀ x ∈ Δ, x ∈ (Γ.N \ Δ ∪ {n₁, n₂, n₃}) → x ∈ ({n₁, n₂, n₃} : Set S)) : + arcComponentsIn ((Γ.U \ Δ ∪ Δ₁ ∪ Δ₂) \ (Γ.N \ Δ ∪ {n₁, n₂, n₃})) = (insert (Δ₁ \ {n₁, n₂, n₃}) + (insert (Δ₂ \ {n₁, n₂}) {c | c ∈ Γ.C ∧ c ⊆ Δᶜ})) := by + let c₁ := Δ₁ \ {n₁, n₂, n₃} + let c₂ := Δ₂ \ {n₁, n₂} + let N' := Γ.N \ Δ ∪ {n₁, n₂, n₃} + let J := insert c₁ (insert c₂ {c | c ∈ Γ.C ∧ c ⊆ Δᶜ}) + refine arcComponentsIn_eq_of_finite_cover ((hKfin.insert _).insert _) ?_ ?_ ?_ ?_ ?_ + · ext x + constructor + · rintro ⟨d, (rfl | rfl | ⟨hd, hdc⟩), hx⟩ + · exact ⟨.inl (.inr hx.1), fun h => hx.2 (hdisjN x (hc₁Δ hx) h)⟩ + · refine ⟨.inr hx.1, fun h => ?_⟩ + rcases hdisjN x (hc₂Δ hx) h with h3 | h3 | h3 + · exact hx.2 (.inl h3) + · exact hx.2 (.inr h3) + · exact hn₃out (h3 ▸ hx.1) + · have hm := arcComponentsIn_subset hd hx + refine ⟨.inl (.inl ⟨hm.1, hdc hx⟩), ?_⟩ + rintro (h | h) + · exact hm.2 h.1 + · exact hdc hx (discBd_subset _ (h1 (hnF h).1)) + · rintro ⟨(⟨(⟨hx, hxΔ⟩ | hx)⟩ | hx), hxN⟩ + · have hxN' : x ∉ Γ.N := fun h3 => hxN (.inl ⟨h3, hxΔ⟩) + obtain ⟨c, hc, hxc⟩ := exists_mem_arcComponentsIn (show x ∈ Γ.U \ Γ.N from ⟨hx, hxN'⟩) + exact ⟨c, .inr (.inr ⟨hc, (hside c hc).resolve_left fun h3 => hxΔ (h3 hxc)⟩), hxc⟩ + · exact ⟨c₁, .inl rfl, hx, fun h3 => hxN (.inr h3)⟩ + · refine ⟨c₂, .inr (.inl rfl), hx, fun h3 => hxN (.inr ?_)⟩ + rcases h3 with h3 | h3 + · exact .inl h3 + · exact .inr (.inl h3) + · rintro d (rfl | rfl | ⟨hd, -⟩) + · exact hne₁ + · exact hne₂ + · exact arcComponentsIn_nonempty hd + · rintro d (rfl | rfl | ⟨hd, -⟩) + · exact isPathConnected_of_isClosedDisc_finite_diff hd₁ sdiff_subset + (((finite_singleton _).insert _ |>.insert _).subset fun x hx => by + by_contra h + exact hx.2 ⟨hx.1, h⟩) + · exact isPathConnected_of_isClosedDisc_finite_diff hd₂ sdiff_subset + (((finite_singleton _).insert _).subset fun x hx => by + by_contra h + exact hx.2 ⟨hx.1, h⟩) + · exact arcComponentsIn_isPathConnected hd + · rintro d (rfl | rfl | ⟨hd, hdc⟩) d' (rfl | rfl | ⟨hd', hdc'⟩) hne + · exact absurd rfl hne + · exact hdisj12 + · exact disjoint_left.mpr fun x hx hx' => hdc' hx' (hc₁Δ hx) + · exact hdisj12.symm + · exact absurd rfl hne + · exact disjoint_left.mpr fun x hx hx' => hdc' hx' (hc₂Δ hx) + · exact disjoint_left.mpr fun x hx hx' => hdc hx (hc₁Δ hx') + · exact disjoint_left.mpr fun x hx hx' => hdc hx (hc₂Δ hx') + · exact arcComponentsIn_disjoint hd hd' hne + · rintro d (rfl | rfl | ⟨hd, hdc⟩) + · rw [hcl₁] + ext x + constructor + · rintro ⟨hx, -, hxN⟩ + exact ⟨hx, fun h3 => hxN (.inr h3)⟩ + · intro hx + exact ⟨hx.1, .inl (.inr hx.1), fun h3 => hx.2 (hdisjN x (hsub₁ hx.1) h3)⟩ + · rw [hcl₂] + ext x + constructor + · rintro ⟨hx, -, hxN⟩ + refine ⟨hx, fun h3 => hxN (.inr ?_)⟩ + rcases h3 with h3 | h3 + · exact .inl h3 + · exact .inr (.inl h3) + · intro hx + refine ⟨hx.1, .inr hx.1, fun h3 => ?_⟩ + rcases hdisjN x (hsub₂.trans hsubM hx.1) h3 with h3 | h3 | h3 + · exact hx.2 (.inl h3) + · exact hx.2 (.inr h3) + · exact hn₃out (h3 ▸ hx.1) + · ext x + constructor + · rintro ⟨hx, -, hxN⟩ + by_contra h + have hxt : x ∈ tilde d := ⟨hx, h⟩ + exact hxN (hN'U x (Γ.tilde_subset_N hd hxt) (closure_mono hdc hx)) + · intro hx + have hm := arcComponentsIn_subset hd hx + refine ⟨subset_closure hx, .inl (.inl ⟨hm.1, hdc hx⟩), ?_⟩ + rintro (h | h) + · exact hm.2 h.1 + · exact hdc hx (discBd_subset _ (h1 (hnF h).1)) + +private theorem replace_disc_in_union_eq_closed_complement + {S : Type} [TopologicalSpace S] {U Δ A B : Set S} + (h : ∀ x ∈ U, x ∈ closure Δᶜ → x ∈ Δ → x ∈ A) : + (U \ Δ) ∪ A ∪ B = (U ∩ closure Δᶜ) ∪ A ∪ B := by + apply subset_antisymm + · exact union_subset_union_left _ (union_subset_union_left _ + (fun _ hx => ⟨hx.1, subset_closure hx.2⟩)) + · rintro x ((⟨hx, hxc⟩ | hx) | hx) + · by_cases hΔ : x ∈ Δ + · exact .inl (.inr (h x hx hxc hΔ)) + · exact .inl (.inl ⟨hx, hΔ⟩) + · exact .inl (.inr hx) + · exact .inr hx + +omit [TopologicalSpace S] in +private theorem third_node_distinct_of_ncard_three {n₁ n₂ n₃ : S} (hne₁₂ : n₁ ≠ n₂) + (hcard : ({n₁, n₂, n₃} : Set S).ncard = 3) : n₃ ≠ n₁ ∧ n₃ ≠ n₂ := by + constructor + · rintro rfl + have : ({n₃, n₂, n₃} : Set S) = {n₃, n₂} := by ext; simp; tauto + rw [this, ncard_pair hne₁₂] at hcard + omega + · rintro rfl + have : ({n₁, n₃, n₃} : Set S) = {n₁, n₃} := by ext; simp + rw [this, ncard_pair hne₁₂] at hcard + omega + +/-- **The step of the proof of (11.3) of Graph Minors XVII**, page 193. -/ +theorem threeNodeIArcReplaceDisc : ThreeNodeIArcReplaceDiscPaintingStatement := by + unfold ThreeNodeIArcReplaceDiscPaintingStatement + intro S _ hS Γ n₁ n₂ n₃ F Δ hnorm hF hb hFN hcard hΔ h1 h2 + have ht2 : T2Space S := hS.2.1 + obtain ⟨I, I', Θ, hΘ, hI, hI', hu', hi', hu, hi, hmeet, hnb⟩ := arc_disc_data hS hF hb hΔ h1 h2 + have hne₁₂ : n₁ ≠ n₂ := hF.ne' + have hn₃ : n₃ ≠ n₁ ∧ n₃ ≠ n₂ := + third_node_distinct_of_ncard_three hne₁₂ (hFN ▸ hcard) + have hbdΔ : discBd Δ ⊆ Δ := discBd_subset Δ + have hIΘ : I ⊆ Θ := fun z hz => hu' ▸ .inl hz + have hΘb : Θ ⊆ bd S := by + obtain ⟨x, -, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + have hside : ∀ c ∈ Γ.C, c ⊆ Δ ∨ c ⊆ Δᶜ := fun c hc => cell_side hc hnorm hΔ hnb + have hFΔ : F ⊆ closure Δᶜ := by + have h3 : F \ {n₁, n₂} ⊆ closure Δᶜ := fun x hx => by + refine mem_closure_compl (h1 hx.1) ?_ + by_contra hn + exact hx.2 (hb ▸ ⟨hx.1, hn⟩) + exact (hF.subset_closure_diff).trans (closure_minimal h3 isClosed_closure) + have hnF : ∀ {x}, x ∈ ({n₁, n₂, n₃} : Set S) → x ∈ F ∧ x ∈ Γ.N := fun hx => hFN.symm.subset hx + have hclosN : ∀ x ∈ Γ.U, x ∈ closure Δᶜ → x ∈ Δ → x ∈ ({n₁, n₂, n₃} : Set S) := by + intro x hxU hxc hxΔ + by_cases hxF : x ∈ F + · exact hFN ▸ ⟨hxF, hnorm ⟨hxF, hxU⟩⟩ + · obtain ⟨y, hy, hy'⟩ := mem_closure_iff_nhds.mp hxc _ (hnb x ⟨hxΔ, hxF⟩) + exact absurd hy hy' + -- Cut `Δ` along two chords. + obtain ⟨L₁, Δ₁, M, hL₁, hL₁b, hL₁D, hd₁, hdM, hu₁, hi₁, hb₁, hbM⟩ := split_disc hΔ hF hI hne₁₂ hu + hi + have hL₁I : I ∩ L₁ = {n₁, n₂} := by + refine Subset.antisymm (fun x hx => hL₁b ▸ ⟨hx.2, hu ▸ .inr hx.1⟩) ?_ + rintro x (rfl | rfl) + · exact ⟨hI.left_mem, hL₁.left_mem⟩ + · exact ⟨hI.right_mem, hL₁.right_mem⟩ + obtain ⟨L₂, Δ₂, M', hL₂, hL₂b, hL₂D, hd₂, hdM', hu₂, hi₂, hb₂, hbM'⟩ := + split_disc hdM hI hL₁ hne₁₂ hbM.symm hL₁I + have hsub₁ : Δ₁ ⊆ Δ := hu₁ ▸ subset_union_left + have hsubM : M ⊆ Δ := hu₁ ▸ subset_union_right + have hsub₂ : Δ₂ ⊆ M := hu₂ ▸ subset_union_left + have hFΔ₁ : F ⊆ discBd Δ₁ := hb₁ ▸ subset_union_left + have hIΔ₂ : I ⊆ discBd Δ₂ := hb₂ ▸ subset_union_left + have hL₁M' : L₁ ⊆ M' := fun x hx => discBd_subset M' (hbM' ▸ .inl hx) + have hinter : Δ₁ ∩ Δ₂ = {n₁, n₂} := by + exact replacement_discs_intersect_at_arc_ends S n₁ n₂ F I L₁ Δ₁ M hL₁ hi₁ hb₁ hbM L₂ Δ₂ M' hL₂ + hL₂b hi₂ hb₂ hsub₂ hL₁M' + have hn₃Δ₁ : n₃ ∈ discBd Δ₁ := hFΔ₁ (hnF (.inr (.inr rfl))).1 + have hn₁Δ₁ : n₁ ∈ discBd Δ₁ := hFΔ₁ hF.left_mem + have hn₂Δ₁ : n₂ ∈ discBd Δ₁ := hFΔ₁ hF.right_mem + have hn₁Δ₂ : n₁ ∈ discBd Δ₂ := hIΔ₂ hI.left_mem + have hn₂Δ₂ : n₂ ∈ discBd Δ₂ := hIΔ₂ hI.right_mem + have hn₃out : n₃ ∉ Δ₂ := fun h => by + have h3 : n₃ ∈ Δ₁ ∩ Δ₂ := ⟨discBd_subset _ hn₃Δ₁, h⟩ + rw [hinter] at h3 + rcases h3 with h3 | h3 + · exact hn₃.1 h3 + · exact hn₃.2 h3 + let c₁ : Set S := Δ₁ \ {n₁, n₂, n₃} + let c₂ : Set S := Δ₂ \ {n₁, n₂} + let N' : Set S := (Γ.N \ Δ) ∪ {n₁, n₂, n₃} + obtain ⟨hne₁, -, hcl₁⟩ := hd₁.sdiff_of_inter_subset_discBd + (inter_subset_left.trans (insert_subset hn₁Δ₁ (pair_subset hn₂Δ₁ hn₃Δ₁))) + obtain ⟨hne₂, -, hcl₂⟩ := hd₂.sdiff_of_inter_subset_discBd + (inter_subset_left.trans (pair_subset hn₁Δ₂ hn₂Δ₂)) + have ht₁ : tilde c₁ = {n₁, n₂, n₃} := by + exact first_replacement_cell_nodes S n₁ n₂ n₃ Δ₁ Δ₂ hn₃Δ₁ hn₁Δ₁ hn₂Δ₁ hcl₁ hcl₂ + have ht₂ : tilde c₂ = {n₁, n₂} := by + exact second_replacement_cell_nodes S n₁ n₂ n₃ Δ₁ Δ₂ hn₁Δ₂ hn₂Δ₂ hcl₂ ht₁ + have hc₁Δ : c₁ ⊆ Δ := sdiff_subset.trans hsub₁ + have hc₂Δ : c₂ ⊆ Δ := sdiff_subset.trans (hsub₂.trans hsubM) + have hdisj12 : Disjoint c₁ c₂ := disjoint_left.mpr fun x hx hx' => by + have h3 : x ∈ Δ₁ ∩ Δ₂ := ⟨hx.1, hx'.1⟩ + rw [hinter] at h3 + exact hx'.2 h3 + have hne12 : c₁ ≠ c₂ := fun h => by + obtain ⟨x, hx⟩ := hne₁ + exact disjoint_left.mp hdisj12 hx (h ▸ hx) + have hKfin : {c ∈ Γ.C | c ⊆ Δᶜ}.Finite := Γ.finite_cells.subset fun c hc => hc.1 + let J : Set (Set S) := insert c₁ (insert c₂ {c ∈ Γ.C | c ⊆ Δᶜ}) + have hN'U : ∀ x ∈ Γ.N, x ∈ closure Δᶜ → x ∈ N' := fun x hx hxc => by + by_cases h : x ∈ Δ + · exact .inr (hclosN x (Γ.N_subset hx) hxc h) + · exact .inl ⟨hx, h⟩ + have hdisjN : ∀ x ∈ Δ, x ∈ N' → x ∈ ({n₁, n₂, n₃} : Set S) := by + rintro x hx (h | h) + · exact absurd hx h.2 + · exact h + have hJ : arcComponentsIn (((Γ.U \ Δ) ∪ Δ₁ ∪ Δ₂) \ N') = J := by + exact replacement_painting_cell_partition S Γ n₁ n₂ n₃ F Δ h1 hside hnF Δ₁ M hd₁ Δ₂ hd₂ hsub₁ + hsubM hsub₂ hn₃out hcl₁ hcl₂ hc₁Δ hc₂Δ hne₁ hne₂ hdisj12 hKfin hN'U hdisjN + have hIsub : Δ ∩ bd S ⊆ Δ₂ := by + rw [hmeet] + exact hIΔ₂.trans (discBd_subset _) + have hU₂ : (Γ.U \ Δ) ∪ Δ₁ ∪ Δ₂ = (Γ.U ∩ closure Δᶜ) ∪ Δ₁ ∪ Δ₂ := + replace_disc_in_union_eq_closed_complement fun x hx hxc h => by + apply discBd_subset Δ₁ + rcases hclosN x hx hxc h with rfl | rfl | rfl + · exact hn₁Δ₁ + · exact hn₂Δ₁ + · exact hn₃Δ₁ + let Γ' : Painting S := + { U := (Γ.U \ Δ) ∪ Δ₁ ∪ Δ₂ + N := N' + isClosed_U := by + rw [hU₂] + exact ((Γ.isClosed_U.inter isClosed_closure).union hd₁.isClosed).union hd₂.isClosed + N_subset := by + rintro x (⟨hx, h⟩ | hx) + · exact .inl (.inl ⟨Γ.N_subset hx, h⟩) + · refine .inl (.inr ?_) + rcases hx with rfl | rfl | rfl + · exact discBd_subset _ hn₁Δ₁ + · exact discBd_subset _ hn₂Δ₁ + · exact discBd_subset _ hn₃Δ₁ + finite_N := (Γ.finite_N.subset sdiff_subset).union (by simp) + finite_cells := by + rw [hJ] + exact (hKfin.insert _).insert _ + cell_disc := by + rw [hJ] + rintro d (rfl | rfl | ⟨hd, -⟩) + · rw [hcl₁, ht₁] + refine ⟨hd₁, ?_, by simp, ?_⟩ + · rintro x (rfl | rfl | rfl) + · exact hn₁Δ₁ + · exact hn₂Δ₁ + · exact hn₃Δ₁ + · have h' := ncard_pair hn₃.2.symm + have h'' := ncard_insert_le n₁ ({n₂, n₃} : Set S) + omega + · rw [hcl₂, ht₂] + refine ⟨hd₂, ?_, by simp, ?_⟩ + · rintro x (rfl | rfl) + · exact hn₁Δ₂ + · exact hn₂Δ₂ + · rw [ncard_pair hne₁₂] + omega + · exact Γ.cell_disc d hd + bd_subset := fun x hx => by + by_cases h : x ∈ Δ + · exact .inr (hIsub ⟨h, hx⟩) + · exact .inl (.inl ⟨Γ.bd_subset hx, h⟩) + border_cell := by + rw [hJ] + rintro d (rfl | rfl | ⟨hd, -⟩) h + · exfalso + obtain ⟨x, hx, hxb⟩ := h + have h3 : x ∈ Δ₁ ∩ Δ₂ := ⟨hx.1, hIsub ⟨hc₁Δ hx, hxb⟩⟩ + rw [hinter] at h3 + rcases h3 with h3 | h3 + · exact hx.2 (.inl h3) + · exact hx.2 (.inr (.inl h3)) + · have hcb : Δ₂ ∩ bd S = I := by + refine Subset.antisymm (fun x hx => ?_) fun x hx => ?_ + · exact hmeet ▸ ⟨hsubM (hsub₂ hx.1), hx.2⟩ + · exact ⟨discBd_subset _ (hIΔ₂ hx), hΘb (hIΘ hx)⟩ + rw [hcl₂, ht₂, hcb, lineEnds_eq hI, ncard_pair hne₁₂] + exact ⟨rfl, by simp, ⟨hI.choose⟩, rfl⟩ + · exact Γ.border_cell d hd h } + have hΓC : Γ'.C = J := hJ + have hnotK : ∀ {c : Set S}, c ⊆ Δ → c.Nonempty → c ∉ {c ∈ Γ.C | c ⊆ Δᶜ} := by + rintro c hc ⟨x, hx⟩ ⟨-, h⟩ + exact h hx (hc hx) + have hz₂ : (c₂ ∩ Θ).Nonempty := by + obtain ⟨z, hz⟩ := line_inner_nonempty hI + exact ⟨z, ⟨discBd_subset _ (hIΔ₂ hz.1), hz.2⟩, hIΘ hz.1⟩ + refine ⟨Γ', Θ, c₁, c₂, rfl, ?_, hΘ, ⟨(hnF (.inl rfl)).2, hIΘ hI.left_mem⟩, + ⟨(hnF (.inr (.inl rfl))).2, hIΘ hI.right_mem⟩, ?_, hside, ?_, ?_, ?_, ht₁, ?_, hz₂, ht₂, hne12, + hnotK hc₁Δ hne₁, hnotK hc₂Δ hne₂, hΓC⟩ + · rintro x (h | h) + · exact h.1 + · exact (hnF h).2 + · rw [← hu] + exact union_subset_union_right _ hIΘ + · intro c hc hcΔ x hx + exact hN'U x (Γ.tilde_subset_N hc hx) (closure_mono hcΔ hx.1) + · rw [hΓC] + exact .inl rfl + · rintro ⟨x, hx, hxb⟩ + have h3 : x ∈ Δ₁ ∩ Δ₂ := ⟨hx.1, hIsub ⟨hc₁Δ hx, hxb⟩⟩ + rw [hinter] at h3 + rcases h3 with h3 | h3 + · exact hx.2 (.inl h3) + · exact hx.2 (.inr (.inl h3)) + · rw [hΓC] + exact .inr (.inl rfl) + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/VortexAxioms.lean b/LeanPool/GraphMinor/GM17/VortexAxioms.lean new file mode 100644 index 0000000000..38bbec594b --- /dev/null +++ b/LeanPool/GraphMinor/GM17/VortexAxioms.lean @@ -0,0 +1,242 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.VortexCells + +/-! +# The axioms of the portrayal in XVII (13.1) + +Fourth step of the proof of XVII (13.1), pages 203-204. We define `nv`, the vertex of a node, and +`bt`, the set `β(n)`. Then we prove (P2)-(P7) for the cells of `VortexCells`, +as statements on the index set `Idx`. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface GM09 GM14 GM16 Graph + +universe u v + +variable {α : Type u} [Nonempty α] {β : Type v} {S : Type} [TopologicalSpace S] [T2Space S] {G : + Graph α β} {Seg : Set (Society α β)} {D : Society α β → Set S} {ν : α → S} {ρ : ℕ} + {V : ∀ m : Maj Seg, VortexCut m.1 (D m.1) ν ρ} + +/-- The vertex of a node. -/ +noncomputable def nv (Seg : Set (Society α β)) (ν : α → S) (x : S) : α := Function.invFunOn ν + (segregationVertices Seg) x + +/-- The set `β(n)`: for the node of `t i` with `i` not first, the vertices shared by `X (i - 1)` and +`X i`, other than `t i`. -/ +def bt (V : ∀ m : Maj Seg, VortexCut m.1 (D m.1) ν ρ) (x : S) : Set α := + {v | ∃ (m : Maj Seg) (i j : Fin (V m).k), x = ν ((V m).t i) ∧ j.1 + 1 = i.1 ∧ v ∈ V((V m).X j) + ∧ v ∈ V((V m).X i) ∧ v ≠ (V m).t i} + +omit [T2Space S] in +theorem nv_eq (harr : IsProperArrangement Seg D ν) {v : α} (hv : v ∈ segregationVertices Seg) : nv + Seg ν (ν v) = v := + harr.1.injOn_pts.leftInvOn_invFunOn hv + +variable (harr : IsProperArrangement Seg D ν) +include harr + +omit [T2Space S] in +theorem nv_t (m : Maj Seg) (i : Fin (V m).k) : nv Seg ν (ν ((V m).t i)) = (V m).t i := + nv_eq harr (bar_sub_verts m.2.1 (t_mem_bar m i)) + +omit [Nonempty α] in +theorem node_unique {m m' : Maj Seg} {i : Fin (V m).k} {i' : Fin (V m').k} (h : ν ((V m).t i) = ν + ((V m').t i')) : (⟨m, i⟩ : Σ m : Maj Seg, Fin (V m).k) = ⟨m', i'⟩ := by + have h1 : m = m' := by + by_contra hne + have h2 := pt_mem_disc harr m.2.1 (t_mem_bar (V := V) m i) + have h3 := pt_mem_disc harr m'.2.1 (t_mem_bar (V := V) m' i') + rw [← h] at h3 + exact Set.disjoint_left.mp (disjoint_disc harr hne) h2 h3 + subst h1 + have h2 := harr.1.injOn_pts (bar_sub_verts m.2.1 (t_mem_bar m i)) (bar_sub_verts m.2.1 + (t_mem_bar m i')) h + rw [(V m).dec.injective_t h2] + +theorem nv_mem_gr (i : Idx V) {n : S} (hn : n ∈ Nd Seg ν ∩ Ds V i) : nv Seg ν n ∈ + (gr V i).vertexSet := by + rcases i with a | ⟨m, a⟩ + · have h : n ∈ Nd Seg ν ∩ D a.1 := hn + rw [Nd_inter_inl harr] at h + obtain ⟨v, hv, rfl⟩ := h + rw [nv_eq harr (bar_sub_verts a.2.1 hv)] + exact a.1.bar_subset hv + · have h : n ∈ Nd Seg ν ∩ (V m).L a := hn + rw [Nd_inter_inr harr] at h + rcases h with rfl | rfl + · rw [nv_t harr] + exact Or.inl ((V m).dec.mem_vertexSet a) + · rw [nv_t harr] + exact Or.inr rfl + +omit [Nonempty α] in +/-- (P3), second part. -/ +theorem bt_sub_gr {m : Maj Seg} {a : Fin (V m).k} {n : S} (hn : n ∈ Nd Seg ν ∩ + (V m).L a) : bt V n ⊆ (gr V (.inr ⟨m, a⟩)).vertexSet := by + rw [Nd_inter_inr harr] at hn + rintro v ⟨m', i, j, h1, h2, h3, h4, h5⟩ + have hle : (V m).k = (V m).k := rfl + rcases hn with rfl | rfl + · obtain ⟨rfl, hi⟩ := Sigma.mk.inj_iff.mp (node_unique harr h1) + obtain rfl := eq_of_heq hi + exact Or.inl h4 + · obtain ⟨rfl, hi⟩ := Sigma.mk.inj_iff.mp (node_unique harr h1) + obtain rfl := eq_of_heq hi + have h6 := (V m).hnx a + have h7 := a.2 + by_cases hc : a.1 + 1 < (V m).k + · rw [Nat.mod_eq_of_lt hc] at h6 + have : j = a := Fin.ext (by omega) + subst this + exact Or.inl h3 + · have : a.1 + 1 = (V m).k := by omega + rw [this, Nat.mod_self] at h6 + omega + +omit [T2Space S] in +/-- (P3), first part. -/ +theorem nv_notMem_bt {n : S} (_ : n ∈ Nd Seg ν) : nv Seg ν n ∉ bt V n := by + rintro ⟨m, i, j, h1, -, -, -, h5⟩ + apply h5 + rw [h1, nv_t harr] + +omit [Nonempty α] [T2Space S] harr in +theorem bt_mem_graph {n : S} {v : α} (hv : v ∈ bt V n) : ∃ (m : Maj Seg) (i : Fin (V m).k), n = ν + ((V m).t i) ∧ v ∈ V(m.1.G) := by + obtain ⟨m, i, j, h1, -, -, h4, -⟩ := hv + exact ⟨m, i, h1, ((V m).dec.le_G i).vertexSet_mono h4⟩ + +variable (hseg : IsGraphSegregation G Seg) +include hseg + +omit [Nonempty α] in +/-- (P4), first part. -/ +theorem bt_disjoint {m₁ m₂ : Maj Seg} (hm : m₁ ≠ m₂) {n₁ n₂ : S} (h₁ : n₁ ∈ D m₁.1) + (h₂ : n₂ ∈ D m₂.1) : Disjoint (bt V n₁) (bt V n₂) := by + refine Set.disjoint_left.mpr fun v hv hv' => ?_ + obtain ⟨m, i, rfl, hg⟩ := bt_mem_graph hv + obtain ⟨m', i', rfl, hg'⟩ := bt_mem_graph hv' + have e1 : m = m₁ := by + by_contra hne + exact Set.disjoint_left.mp (disjoint_disc harr hne) (pt_mem_disc harr m.2.1 (t_mem_bar (V + := V) m i)) h₁ + have e2 : m' = m₂ := by + by_contra hne + exact Set.disjoint_left.mp (disjoint_disc harr hne) (pt_mem_disc harr m'.2.1 (t_mem_bar (V + := V) m' i')) h₂ + subst e1 e2 + have hne : m.1 ≠ m'.1 := fun h => hm (Subtype.ext h) + obtain ⟨h3, h4⟩ := hseg.vertex_inter_subset _ m.2.1 _ m'.2.1 hne ⟨hg, hg'⟩ + exact Set.disjoint_left.mp (disjoint_disc harr hm) (pt_mem_disc harr m.2.1 h3) + (pt_mem_disc harr m'.2.1 h4) + +/-- (P4), second part. -/ +theorem nv_notMem_bt_of_off {m : Maj Seg} {n₁ n₂ : S} (h₁ : n₁ ∈ D m.1) (h₂ : n₂ ∈ Nd Seg ν) + (hoff : n₂ ∉ discBd (V m).P) : nv Seg ν n₂ ∉ bt V n₁ := by + intro hv + obtain ⟨m', i, rfl, hg⟩ := bt_mem_graph hv + have e1 : m' = m := by + by_contra hne + exact Set.disjoint_left.mp (disjoint_disc harr hne) (pt_mem_disc harr m'.2.1 (t_mem_bar (V + := V) m' i)) h₁ + subst e1 + obtain ⟨w, hw, rfl⟩ := h₂ + rw [nv_eq harr hw] at hg + obtain ⟨j, rfl⟩ := exists_t_eq (V := V) (mem_bar_of_mem_graph hseg m'.2.1 hw hg) + exact hoff (pt_mem_discBd_P m' j) + +/-- (P5). -/ +theorem p5_aux (a : Mnr Seg) {v : α} (hv : v ∈ (gr V (.inl a)).vertexSet) {j : Idx V} + (hj : j ≠ .inl a) (hvj : v ∈ (gr V j).vertexSet) : + ν v ∈ Nd Seg ν ∩ D a.1 ∧ nv Seg ν (ν v) = v := by + have hne : soc V (.inl a) ≠ soc V j := by + rcases j with b | ⟨m, b⟩ + · exact fun h => hj (congrArg Sum.inl (Subtype.ext h)).symm + · exact soc_ne_of_mnr_maj a m + have h := mem_bar_of_ne hseg hne hv hvj + exact ⟨⟨pt_mem_Nd a.2.1 h, pt_mem_disc harr a.2.1 h⟩, nv_eq harr (bar_sub_verts a.2.1 h)⟩ + +/-- (P6). -/ +theorem p6_aux {m : Maj Seg} {a : Fin (V m).k} {v : α} (hv : v ∈ (gr V + (.inr ⟨m, a⟩)).vertexSet) {j : Idx V} (hj : j ≠ .inr ⟨m, a⟩) (hvj : v ∈ (gr V j).vertexSet) : + ∃ n ∈ Nd Seg ν ∩ (V m).L a, v ∈ bt V n ∨ (n ∈ Nd Seg ν ∧ v = nv Seg ν n) := by + have hA : ν ((V m).t a) ∈ Nd Seg ν ∩ (V m).L a := by + rw [Nd_inter_inr harr] + exact Or.inl rfl + have hB : ν ((V m).t ((V m).nx a)) ∈ Nd Seg ν ∩ (V m).L a := by + rw [Nd_inter_inr harr] + exact Or.inr rfl + by_cases h1 : v = (V m).t ((V m).nx a) + · exact ⟨_, hB, Or.inr ⟨hB.1, by rw [nv_t harr, h1]⟩⟩ + by_cases h2 : v = (V m).t a + · exact ⟨_, hA, Or.inr ⟨hA.1, by rw [nv_t harr, h2]⟩⟩ + have hva : v ∈ V((V m).X a) := by + rcases hv with h | h + · exact h + · exact absurd h h1 + have key : ∃ e, e ≠ a ∧ v ∈ V((V m).X e) := by + have outer : soc V (.inr ⟨m, a⟩) ≠ soc V j → ∃ e, e ≠ a ∧ v ∈ V((V m).X e) := fun hne => by + obtain ⟨e, rfl⟩ := exists_t_eq (V := V) (mem_bar_of_ne hseg hne hv hvj) + exact ⟨e, fun he => h2 (by rw [he]), (V m).dec.mem_vertexSet e⟩ + by_cases hso : soc V (.inr ⟨m, a⟩) = soc V j + · rcases j with b | ⟨m', b⟩ + · exact absurd hso.symm (soc_ne_of_mnr_maj b m) + · obtain rfl : m = m' := Subtype.ext hso + have hab : b ≠ a := fun h => hj (h ▸ rfl) + rcases hvj with h | h + · exact ⟨b, hab, h⟩ + · have h' : v = (V m).t ((V m).nx b) := h + exact ⟨(V m).nx b, fun he => h2 (by rw [h', he]), h' ▸ (V m).dec.mem_vertexSet _⟩ + · exact outer hso + obtain ⟨e, hne, hve⟩ := key + rcases lt_or_gt_of_ne hne with hlt | hlt + · have h0 : a.1 ≠ 0 := by + have : e.1 < a.1 := + hlt + omega + let j₀ : Fin (V m).k := ⟨a.1 - 1, by omega⟩ + have hj₀ : v ∈ V((V m).X j₀) := (V m).mem_between (a := e) (c := a) + (Fin.le_def.mpr (by have : e.1 < a.1 := hlt; simp only [j₀]; omega)) + (Fin.le_def.mpr (by simp only [j₀]; omega)) hve hva + exact ⟨_, hA, Or.inl ⟨m, a, j₀, rfl, by simp only [j₀]; omega, hj₀, hva, h2⟩⟩ + · have hc : a.1 + 1 < (V m).k := by + have : a.1 < e.1 := hlt + have := e.2 + omega + have hnxe : ((V m).nx a).1 = a.1 + 1 := by + rw [(V m).hnx, Nat.mod_eq_of_lt hc] + have hvn : v ∈ V((V m).X ((V m).nx a)) := (V m).mem_between (a := a) (c := e) + (Fin.le_def.mpr (by omega)) (Fin.le_def.mpr (by have : a.1 < e.1 := hlt; omega)) hva hve + exact ⟨_, hB, Or.inl ⟨m, (V m).nx a, a, rfl, hnxe.symm, hva, hvn, h1⟩⟩ + +omit hseg in +omit [Nonempty α] in +theorem ncard_bt_le (n : S) : (bt V n).ncard ≤ ρ := by + by_cases he : (bt V n).Nonempty + · obtain ⟨v₀, m, i, j, rfl, h2, -, -, -⟩ := he + have hsub : bt V (ν ((V m).t i)) ⊆ V((V m).X j) ∩ V((V m).X i) := by + rintro v ⟨m', i', j', h1, h3, h4, h5, -⟩ + obtain ⟨rfl, hi⟩ := Sigma.mk.inj_iff.mp (node_unique harr h1) + obtain rfl := eq_of_heq hi + have : j' = j := Fin.ext (by omega) + subst this + exact ⟨h4, h5⟩ + exact (Set.ncard_le_ncard hsub (((V m).finite_V j).subset inter_subset_left)).trans + ((V m).small j i (Fin.lt_def.mpr (by omega))) + · rw [not_nonempty_iff_eq_empty.mp he] + simp + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/VortexCells.lean b/LeanPool/GraphMinor/GM17/VortexCells.lean new file mode 100644 index 0000000000..8dfbf74735 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/VortexCells.lean @@ -0,0 +1,176 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.VortexPaint + +/-! +# The cell graphs of the portrayal in XVII (13.1) + +Third step of the proof of XVII (13.1), page 203. For a small society, the cell graph is the graph +of the society. For a lune it is a piece `X i` of the linear +decomposition, with the next vertex added (`gr`). We also define the map from nodes to vertices +(`nv`), and the sets `β(n)` (`bt`). The sets `β(n)` differ from those +of the paper at the first node of each cuff: we take `β` empty there, in place of `V(κ(n_k) ∩ +κ(n_1))`. Since the `κ(n_i)` come from a linear decomposition, +this is enough, and it makes the axioms easier to check. + +Then we prove the parts of (P1)-(P7) that are about graphs, one lemma for each. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface GM09 GM14 GM16 Graph + +universe u v + +variable {α : Type u} {β : Type v} {S : Type} [TopologicalSpace S] [T2Space S] {G : Graph α β} {Seg + : Set (Society α β)} {D : Society α β → Set S} {ν : α → S} {ρ : ℕ} + {V : ∀ m : Maj Seg, VortexCut m.1 (D m.1) ν ρ} + +omit [T2Space S] in +theorem VortexCut.finite_V {s : Society α β} {E : Set S} (W : VortexCut s E ν ρ) + (i : Fin W.k) : V(W.X i).Finite := + s.finite_V.subset (W.dec.le_G i).vertexSet_mono + +omit [T2Space S] in +theorem VortexCut.finite_E {s : Society α β} {E : Set S} (W : VortexCut s E ν ρ) + (i : Fin W.k) : E(W.X i).Finite := + s.finite_E.subset (W.dec.le_G i).edgeSet_mono + +omit [T2Space S] in +theorem VortexCut.mem_between {s : Society α β} {E : Set S} (W : VortexCut s E ν ρ) {a b c : Fin + W.k} (hab : a ≤ b) (hbc : b ≤ c) {v : α} (ha : v ∈ V(W.X a)) + (hc : v ∈ V(W.X c)) : v ∈ V(W.X b) := by + have hle := (W.dec.inter_le a b c hab hbc).vertexSet_mono + apply hle + simp only [subgraphInter] + exact ⟨ha, hc⟩ + +variable (V) in +/-- The graphs of the cells. -/ +def gr : Idx V → Hypergraph α β + | .inl a => Hypergraph.ofGraph a.1.G a.1.finite_V a.1.finite_E + | .inr x => addVertex (Hypergraph.ofGraph ((V x.1).X x.2) ((V x.1).finite_V _) + ((V x.1).finite_E _)) ((V x.1).t ((V x.1).nx x.2)) + +omit [T2Space S] in +theorem gr_inr_vertex (m : Maj Seg) (i : Fin (V m).k) : (gr V (.inr ⟨m, i⟩)).vertexSet + = V((V m).X i) ∪ {(V m).t ((V m).nx i)} := rfl + +omit [T2Space S] in +theorem gr_inr_edge (m : Maj Seg) (i : Fin (V m).k) : (gr V (.inr ⟨m, i⟩)).edgeSet = E((V m).X i) + := rfl + +omit [T2Space S] in +theorem gr_vertex_sub (i : Idx V) : (gr V i).vertexSet ⊆ V((soc V i).G) := by + rcases i with a | ⟨m, a⟩ + · exact subset_rfl + · rw [gr_inr_vertex] + refine union_subset ((V m).dec.le_G a).vertexSet_mono ?_ + rintro _ rfl + exact m.1.bar_subset (t_mem_bar m _) + +omit [T2Space S] in +theorem gr_edge_sub (i : Idx V) : (gr V i).edgeSet ⊆ E((soc V i).G) := by + rcases i with a | ⟨m, a⟩ + · exact subset_rfl + · exact ((V m).dec.le_G a).edgeSet_mono + +variable (hseg : IsGraphSegregation G Seg) (hGV : V(G).Finite) (hGE : E(G).Finite) + +theorem ofGraph_le {A B : Graph α β} (h : A ≤ B) (hA : V(A).Finite) (hA' : E(A).Finite) + (hB : V(B).Finite) (hB' : E(B).Finite) : + Hypergraph.ofGraph A hA hA' ≤ Hypergraph.ofGraph B hB hB' := by + refine ⟨h.vertexSet_mono, h.edgeSet_mono, fun e he => ?_⟩ + ext v + simp only [Hypergraph.ends, Hypergraph.ofGraph, mem_ofPred_eq, Graph.Inc, h.isLink_eqOn he] + +theorem exists_vertex_of_union {H : Graph α β} {P : Set (Graph α β)} (h : subgraphSUnion H P + = H) {v : α} (hv : v ∈ V(H)) : ∃ A ∈ P, v ∈ V(A) := by + have h1 : v ∈ V(subgraphSUnion H P) := h.symm ▸ hv + simpa [subgraphSUnion] using h1 + +theorem exists_edge_of_union {H : Graph α β} {P : Set (Graph α β)} (h : subgraphSUnion H P + = H) {e : β} (he : e ∈ E(H)) : ∃ A ∈ P, e ∈ E(A) := by + have h1 : e ∈ E(subgraphSUnion H P) := h.symm ▸ he + simp only [subgraphSUnion] at h1 + simpa only [mem_iUnion, exists_prop] using h1.2 + +include hseg + +omit [T2Space S] in +theorem gr_le (i : Idx V) : gr V i ≤ Hypergraph.ofGraph G hGV hGE := by + rcases i with a | ⟨m, a⟩ + · exact ofGraph_le (hseg.le _ a.2.1) _ _ _ _ + · have h := ofGraph_le (((V m).dec.le_G a).trans (hseg.le _ m.2.1)) + ((V m).finite_V a) ((V m).finite_E a) hGV hGE + refine ⟨?_, ?_, fun e he => h.ends_eq e he⟩ + · exact (gr_vertex_sub (.inr ⟨m, a⟩)).trans (hseg.le _ m.2.1).vertexSet_mono + · exact h.edgeSet_subset + +omit [T2Space S] in +theorem cover_vertex {v : α} (hv : v ∈ V(G)) : ∃ i, v ∈ (gr V i).vertexSet := by + obtain ⟨_, ⟨s, hs, rfl⟩, hvs⟩ := exists_vertex_of_union hseg.union_eq hv + by_cases h3 : 3 < s.Ω.bar.ncard + · let m : Maj Seg := ⟨s, hs, h3⟩ + obtain ⟨_, ⟨j, rfl⟩, hj⟩ := exists_vertex_of_union (V m).dec.union_eq hvs + exact ⟨.inr ⟨m, j⟩, Or.inl hj⟩ + · exact ⟨.inl ⟨s, hs, h3⟩, hvs⟩ + +omit [T2Space S] in +theorem cover_edge {e : β} (he : e ∈ E(G)) : ∃ i, e ∈ (gr V i).edgeSet := by + obtain ⟨_, ⟨s, hs, rfl⟩, hes⟩ := exists_edge_of_union hseg.union_eq he + by_cases h3 : 3 < s.Ω.bar.ncard + · let m : Maj Seg := ⟨s, hs, h3⟩ + obtain ⟨_, ⟨j, rfl⟩, hj⟩ := exists_edge_of_union (V m).dec.union_eq hes + exact ⟨.inr ⟨m, j⟩, hj⟩ + · exact ⟨.inl ⟨s, hs, h3⟩, hes⟩ + +variable (harr : IsProperArrangement Seg D ν) +include harr + +omit [T2Space S] harr in +theorem gr_edge_disjoint {i j : Idx V} (hij : i ≠ j) : Disjoint (gr V i).edgeSet (gr V j).edgeSet + := by + by_cases hs : soc V i = soc V j + · rcases i with a | ⟨m, a⟩ <;> rcases j with b | ⟨m', b⟩ + · exact absurd (congrArg Sum.inl (Subtype.ext hs)) hij + · exact absurd hs (soc_ne_of_mnr_maj a m') + · exact absurd hs.symm (soc_ne_of_mnr_maj b m) + · obtain rfl : m = m' := Subtype.ext hs + have hab : a ≠ b := fun h => hij (h ▸ rfl) + rw [gr_inr_edge, gr_inr_edge] + rcases lt_or_gt_of_ne hab with h | h + · exact (V m).dec.edge_disjoint _ _ h + · exact ((V m).dec.edge_disjoint _ _ h).symm + · exact (hseg.edge_disjoint _ (soc_mem V i) _ (soc_mem V j) hs).mono + (gr_edge_sub i) (gr_edge_sub j) + +omit [TopologicalSpace S] [T2Space S] harr in +/-- A vertex of a society that lies in a vertex of the arrangement belongs to the cyclic order of +that society. -/ +theorem mem_bar_of_mem_graph {s : Society α β} (hs : s ∈ Seg) {v : α} + (hv : v ∈ segregationVertices Seg) (hg : v ∈ V(s.G)) : v ∈ s.Ω.bar := by + obtain ⟨s', hs', hv'⟩ : ∃ s' ∈ Seg, v ∈ s'.Ω.bar := by simpa [segregationVertices] using hv + by_cases he : s' = s + · exact he ▸ hv' + · exact (hseg.vertex_inter_subset s' hs' s hs he ⟨s'.bar_subset hv', hg⟩).2 + +omit harr in +omit [T2Space S] in +/-- A vertex in two different societies belongs to the cyclic order of both. -/ +theorem mem_bar_of_ne {i j : Idx V} (hs : soc V i ≠ soc V j) {v : α} (hi : v ∈ (gr V i).vertexSet) + (hj : v ∈ (gr V j).vertexSet) : v ∈ (soc V i).Ω.bar := + (hseg.vertex_inter_subset _ (soc_mem V i) _ (soc_mem V j) hs ⟨gr_vertex_sub i hi, gr_vertex_sub j + hj⟩).1 + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/VortexCut.lean b/LeanPool/GraphMinor/GM17/VortexCut.lean new file mode 100644 index 0000000000..ebab44c3ed --- /dev/null +++ b/LeanPool/GraphMinor/GM17/VortexCut.lean @@ -0,0 +1,351 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM16.Section3 +public import LeanPool.GraphMinor.GM14.DiscSlope +public import LeanPool.GraphMinor.GM09.Section8 +public import LeanPool.GraphMinor.GM17.AngleOrder +public import LeanPool.GraphMinor.GM17.PaintDiscs +public import LeanPool.GraphMinor.GM17.CycleOrder + +/-! +# The polygons and lunes of a segregation + +This is the first step of the proof of XVII (13.1), page 202. We start from a segregation of a graph +with a proper arrangement in a closed surface. Each +society with more than three vertices is a vortex. It has a linear decomposition by XVI, and its +disc holds a polygon with one lune for each side +(`exists_vortexCut`, data in `VortexCut`). + +The discs of the small societies and the lunes are the closed discs of a painting of the surface +with the polygons removed. Here we collect the facts on these +discs in the closed surface: they are indexed by `Idx`, the discs are `Ds`, and they meet only in +the points of the arrangement. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface GM09 GM14 GM16 Graph + +universe u v + +variable {α : Type u} {β : Type v} {S : Type} [TopologicalSpace S] + +/-- The data of one vortex: a linear decomposition, and a polygon with its lunes in the disc `E`. -/ +structure VortexCut (s : Society α β) (E : Set S) (ν : α → S) (ρ : ℕ) where + /-- The number of vertices of the society. -/ + k : ℕ + four : 4 ≤ k + /-- The next index. -/ + nx : Fin k → Fin k + hnx : ∀ i, (nx i).1 = (i.1 + 1) % k + /-- A clockwise enumeration of the society. -/ + t : Fin k → α + /-- The linear decomposition. -/ + X : Fin k → Graph α β + dec : s.IsLinearDecomposition t X + small : ∀ i i', i < i' → (V(X i) ∩ V(X i')).ncard ≤ ρ + /-- The polygon. -/ + P : Set S + /-- The lunes. -/ + L : Fin k → Set S + /-- The sides of the polygon. -/ + F : Fin k → Set S + disc_P : IsClosedDisc P + P_sub : P ⊆ E + bd_P : discBd P = ⋃ i, F i + disc_L : ∀ i, IsClosedDisc (L i) + L_sub : ∀ i, L i ⊆ E + L_inter : ∀ i, L i ∩ P = F i + F_sub : ∀ i, F i ⊆ discBd (L i) + F_line : ∀ i, IsLineWithEnds (F i) (ν (t i)) (ν (t (nx i))) + lune_inter : ∀ i j, i ≠ j → L i ∩ L j ⊆ range fun i => ν (t i) + node_mem : ∀ i j, ν (t j) ∈ L i ↔ j = i ∨ j = nx i + +theorem IsLineWithEnds.left_mem {T : Type*} [TopologicalSpace T] {L : Set T} {u v : T} + (h : IsLineWithEnds L u v) : u ∈ L := by + obtain ⟨f, h0, -⟩ := h + exact h0 ▸ (f 0).2 + +theorem IsLineWithEnds.right_mem {T : Type*} [TopologicalSpace T] {L : Set T} {u v : T} + (h : IsLineWithEnds L u v) : v ∈ L := by + obtain ⟨f, -, h1⟩ := h + exact h1 ▸ (f 1).2 + +section + +variable [T2Space S] {G : Graph α β} {Seg : Set (Society α β)} {D : Society α β → Set S} {ν : α + → S} {ρ : ℕ} + +/-- A vortex of a proper arrangement has a linear decomposition, and a polygon with lunes in its +disc. -/ +theorem exists_vortexCut (hS : IsClosedSurface S) (harr : IsProperArrangement Seg D ν) {s : Society + α β} (hs : s ∈ Seg) + (h3 : 3 < s.Ω.bar.ncard) (hv : IsRhoVortex s ρ) : Nonempty (VortexCut s (D s) ν ρ) := by + have hne : s.Ω.bar.Nonempty := by + rw [← Set.ncard_pos s.Ω.finite_bar] + omega + obtain ⟨t, ht, hr, hcw⟩ := s.Ω.exists_clockwise_enumeration hne + have hk0 : 0 < s.Ω.bar.ncard := by omega + obtain ⟨X, hX, hsm⟩ := exists_isLinearDecomposition_of_isRhoVortex (by omega) hv ht hr hcw + have hdisc := (harr.1.isClosedDisc s hs).1 + obtain ⟨-, φ₀, hφ⟩ := harr.1.natural_order s hs + have heq : subBd (D s) = discBd (D s) := IsClosedDisc.subBd_eq_discBd hS hdisc + have hinj : InjOn ν s.Ω.bar := harr.1.injOn_pts.mono (subset_biUnion_of_mem (u + := fun s : Society α β => s.Ω.bar) hs) + obtain ⟨θ, hθ, hl, hval⟩ := exists_angles hk0 hcw hinj hφ + let nx : Fin s.Ω.bar.ncard → Fin s.Ω.bar.ncard := fun i => ⟨(i.1 + 1) % s.Ω.bar.ncard, Nat.mod_lt + _ hk0⟩ + let φ : Circle ≃ₜ discBd (D s) := φ₀.trans (Homeomorph.setCongr heq) + obtain ⟨P, L, F, h1, h2, h3', h4, h5, h6, h7⟩ := exists_polygon_in_disc hdisc φ + (by omega) θ hθ hl nx (fun _ => rfl) (fun i => ν (t i)) (fun i => hval i) + exact ⟨{ k := s.Ω.bar.ncard + four := by omega + nx := nx + hnx := fun _ => rfl + t := t + X := X + dec := hX + small := hsm + P := P + L := L + F := F + disc_P := h1 + P_sub := h2 + bd_P := h3' + disc_L := fun i => (h5 i).1 + L_sub := fun i => (h5 i).2.1 + L_inter := fun i => (h5 i).2.2.1 + F_sub := fun i => (h5 i).2.2.2.1 + F_line := fun i => (h5 i).2.2.2.2 + lune_inter := h6 + node_mem := h7 }⟩ + +/-- The vortices of `Seg`. -/ +abbrev Maj (Seg : Set (Society α β)) := ↥{s ∈ Seg | 3 < s.Ω.bar.ncard} + +/-- The small societies of `Seg`. -/ +abbrev Mnr (Seg : Set (Society α β)) := ↥{s ∈ Seg | ¬ 3 < s.Ω.bar.ncard} + +variable (V : ∀ m : Maj Seg, VortexCut m.1 (D m.1) ν ρ) + +/-- The index set of the discs of the painting: the small societies, and the lunes. -/ +abbrev Idx := Mnr Seg ⊕ Σ m : Maj Seg, Fin (V m).k + +/-- The society that a disc belongs to. -/ +def soc : Idx V → Society α β + | .inl s => s.1 + | .inr x => x.1.1 + +/-- The discs of the painting. -/ +def Ds : Idx V → Set S + | .inl s => D s.1 + | .inr x => (V x.1).L x.2 + +/-- The vertices of the arrangement, as points of the surface. -/ +def Nd (Seg : Set (Society α β)) (ν : α → S) : Set S := ν '' segregationVertices Seg + +omit [T2Space S] in +theorem soc_mem (i : Idx V) : soc V i ∈ Seg := by + rcases i with s | x + · exact s.2.1 + · exact x.1.2.1 + +omit [T2Space S] in +theorem Ds_sub (i : Idx V) : Ds V i ⊆ D (soc V i) := by + rcases i with s | x + · exact subset_rfl + · exact (V x.1).L_sub x.2 + +theorem bar_sub_verts {s : Society α β} (hs : s ∈ Seg) : s.Ω.bar ⊆ segregationVertices Seg + := subset_biUnion_of_mem (u := fun s : Society α β => s.Ω.bar) hs + +variable {V} +variable (harr : IsProperArrangement Seg D ν) +include harr + +/-- If the point of a vertex of the arrangement lies in the disc of `s`, then the vertex belongs to +`s`. -/ +theorem mem_bar_of_mem_disc {s : Society α β} (hs : s ∈ Seg) {v : α} (hv : v ∈ segregationVertices + Seg) (h : ν v ∈ D s) : v ∈ s.Ω.bar := by + obtain ⟨s', hs', hv'⟩ : ∃ s' ∈ Seg, v ∈ s'.Ω.bar := by simpa [segregationVertices] using hv + by_cases he : s' = s + · exact he ▸ hv' + have hp : ν v ∈ subBd (D s') := (harr.1.isClosedDisc s' hs').2 v hv' + have hmem : ν v ∈ D s' := by + have := hp.1 + rwa [(harr.1.isClosedDisc s' hs').1.isClosed.closure_eq] at this + obtain ⟨w, hw, hwe⟩ := harr.1.inter_discs s hs s' hs' (Ne.symm he) ⟨h, hmem⟩ + exact (harr.1.injOn_pts (bar_sub_verts hs hw.1) hv hwe) ▸ hw.1 + +theorem pt_mem_disc {s : Society α β} (hs : s ∈ Seg) {v : α} (hv : v ∈ s.Ω.bar) : ν v ∈ D s := by + have hp : ν v ∈ subBd (D s) := (harr.1.isClosedDisc s hs).2 v hv + have := hp.1 + rwa [(harr.1.isClosedDisc s hs).1.isClosed.closure_eq] at this + +omit [TopologicalSpace S] [T2Space S] harr in +theorem soc_ne_of_mnr_maj (a : Mnr Seg) (m : Maj Seg) : a.1 ≠ m.1 := fun h => a.2.2 (h ▸ m.2.2) + +omit harr in +omit [T2Space S] in +theorem t_mem_bar (m : Maj Seg) (j : Fin (V m).k) : (V m).t j ∈ m.1.Ω.bar := by + rw [← (V m).dec.range_t] + exact mem_range_self j + +omit harr in +omit [T2Space S] in +theorem exists_t_eq {m : Maj Seg} {v : α} (hv : v ∈ m.1.Ω.bar) : ∃ j, (V m).t j = v := by + rw [← (V m).dec.range_t] at hv + exact hv + +omit [TopologicalSpace S] [T2Space S] harr in +theorem pt_mem_Nd {s : Society α β} (hs : s ∈ Seg) {v : α} (hv : v ∈ s.Ω.bar) : ν v ∈ Nd Seg ν := + mem_image_of_mem _ (bar_sub_verts hs hv) + +omit [T2Space S] in +theorem inter_sub_Nd {i j : Idx V} (hij : i ≠ j) : Ds V i ∩ Ds V j ⊆ Nd Seg ν := by + by_cases hs : soc V i = soc V j + · rcases i with a | ⟨m, a⟩ <;> rcases j with b | ⟨m', b⟩ + · exact absurd (congrArg Sum.inl (Subtype.ext hs)) hij + · exact absurd hs (soc_ne_of_mnr_maj a m') + · exact absurd hs.symm (soc_ne_of_mnr_maj b m) + · obtain rfl : m = m' := Subtype.ext hs + have hab : a ≠ b := fun h => hij (h ▸ rfl) + rintro x hx + obtain ⟨e, rfl⟩ := (V m).lune_inter a b hab hx + exact pt_mem_Nd m.2.1 (t_mem_bar m e) + · rintro x ⟨hx, hx'⟩ + obtain ⟨w, hw, rfl⟩ := harr.1.inter_discs _ (soc_mem V i) _ (soc_mem V j) hs ⟨Ds_sub V i hx, + Ds_sub V j hx'⟩ + exact pt_mem_Nd (soc_mem V i) hw.1 + +theorem Nd_inter_inl (a : Mnr Seg) : Nd Seg ν ∩ D a.1 = ν '' a.1.Ω.bar := by + ext x + constructor + · rintro ⟨⟨v, hv, rfl⟩, h⟩ + exact ⟨v, mem_bar_of_mem_disc harr a.2.1 hv h, rfl⟩ + · rintro ⟨v, hv, rfl⟩ + exact ⟨pt_mem_Nd a.2.1 hv, pt_mem_disc harr a.2.1 hv⟩ + +theorem Nd_inter_inr (m : Maj Seg) (i : Fin (V m).k) : + Nd Seg ν ∩ (V m).L i = {ν ((V m).t i), ν ((V m).t ((V m).nx i))} := by + ext x + constructor + · rintro ⟨⟨v, hv, rfl⟩, h⟩ + obtain ⟨j, rfl⟩ := exists_t_eq (V := V) (mem_bar_of_mem_disc harr m.2.1 hv ((V m).L_sub i h)) + rcases ((V m).node_mem i j).mp h with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + · rintro (rfl | rfl) + · exact ⟨pt_mem_Nd m.2.1 (t_mem_bar m _), ((V m).node_mem i i).mpr (Or.inl rfl)⟩ + · exact ⟨pt_mem_Nd m.2.1 (t_mem_bar m _), ((V m).node_mem i _).mpr (Or.inr rfl)⟩ + +omit [T2Space S] in +theorem Ds_disc (i : Idx V) : IsClosedDisc (Ds V i) := by + rcases i with a | ⟨m, a⟩ + · exact (harr.1.isClosedDisc _ a.2.1).1 + · exact (V m).disc_L a + +theorem Nd_sub_discBd (hS : IsClosedSurface S) (i : Idx V) : Nd Seg ν ∩ Ds V i ⊆ discBd (Ds V i) + := by + rcases i with a | ⟨m, a⟩ + · change Nd Seg ν ∩ D a.1 ⊆ discBd (D a.1) + rw [Nd_inter_inl harr] + rintro _ ⟨v, hv, rfl⟩ + rw [← IsClosedDisc.subBd_eq_discBd hS (harr.1.isClosedDisc _ a.2.1).1] + exact (harr.1.isClosedDisc _ a.2.1).2 v hv + · change Nd Seg ν ∩ (V m).L a ⊆ discBd ((V m).L a) + rw [Nd_inter_inr harr] + rintro x (rfl | rfl) + · exact (V m).F_sub a ((V m).F_line a).left_mem + · exact (V m).F_sub a ((V m).F_line a).right_mem + +theorem Nd_sub_Ds : Nd Seg ν ⊆ ⋃ i, Ds V i := by + rintro _ ⟨v, hv, rfl⟩ + obtain ⟨s, hs, hv'⟩ : ∃ s ∈ Seg, v ∈ s.Ω.bar := by simpa [segregationVertices] using hv + by_cases h3 : 3 < s.Ω.bar.ncard + · let m : Maj Seg := ⟨s, hs, h3⟩ + obtain ⟨j, rfl⟩ := exists_t_eq (V := V) (m := m) hv' + exact mem_iUnion.2 ⟨.inr ⟨m, j⟩, ((V m).node_mem j j).mpr (Or.inl rfl)⟩ + · exact mem_iUnion.2 ⟨.inl ⟨s, hs, h3⟩, pt_mem_disc harr hs hv'⟩ + +omit [T2Space S] harr in +theorem pt_mem_discBd_P (m : Maj Seg) (j : Fin (V m).k) : ν ((V m).t j) ∈ discBd (V m).P := by + rw [(V m).bd_P] + exact mem_iUnion.2 ⟨j, ((V m).F_line j).left_mem⟩ + +omit [T2Space S] in +theorem disjoint_disc {m m' : Maj Seg} (h : m ≠ m') : Disjoint (D m.1) (D m'.1) := + harr.2 m.2.1 m'.2.1 (fun he => h (Subtype.ext he)) m.2.2 m'.2.2 + +omit [T2Space S] in +theorem disjoint_P {m m' : Maj Seg} (h : m ≠ m') : Disjoint (V m).P (V m').P := + (disjoint_disc harr h).mono (V m).P_sub (V m').P_sub + +omit [T2Space S] in +/-- A small disc meets the disc of a vortex only in points of that vortex. -/ +theorem mnr_inter_maj (a : Mnr Seg) (m : Maj Seg) : D a.1 ∩ D m.1 ⊆ ν '' m.1.Ω.bar := by + rintro x hx + obtain ⟨w, hw, rfl⟩ := harr.1.inter_discs _ a.2.1 _ m.2.1 (soc_ne_of_mnr_maj a m) hx + exact ⟨w, hw.2, rfl⟩ + +/-- The surface with the polygons removed. -/ +def Cut (V : ∀ m : Maj Seg, VortexCut m.1 (D m.1) ν ρ) : Set S := (⋃ m, discInt (V m).P)ᶜ + +omit [T2Space S] in +theorem Ds_sub_Cut (i : Idx V) : Ds V i ⊆ Cut V := by + intro z hz hu + obtain ⟨m, hzP, hzn⟩ := mem_iUnion.1 hu + rcases i with a | ⟨m', a⟩ + · obtain ⟨v, hv, rfl⟩ := mnr_inter_maj harr a m ⟨hz, (V m).P_sub hzP⟩ + obtain ⟨j, rfl⟩ := exists_t_eq (V := V) hv + exact hzn (pt_mem_discBd_P m j) + · by_cases hm : m' = m + · subst hm + have : z ∈ (V m').F a := by + rw [← (V m').L_inter a] + exact ⟨hz, hzP⟩ + exact hzn (by rw [(V m').bd_P]; exact mem_iUnion.2 ⟨a, this⟩) + · exact Set.disjoint_left.mp (disjoint_disc harr hm) ((V m').L_sub a hz) ((V m).P_sub hzP) + +omit [T2Space S] in +/-- A small disc meets the boundary of the cut surface only in points of the arrangement. -/ +theorem mnr_inter_bd (a : Mnr Seg) : D a.1 ∩ ⋃ m, discBd (V m).P ⊆ Nd Seg ν := by + rintro x ⟨hx, hx'⟩ + obtain ⟨m, hm⟩ := mem_iUnion.1 hx' + obtain ⟨v, hv, rfl⟩ := mnr_inter_maj harr a m ⟨hx, (V m).P_sub (discBd_subset _ hm)⟩ + exact pt_mem_Nd m.2.1 hv + +omit [T2Space S] in +/-- A lune meets the boundary of the cut surface in its side. -/ +theorem lune_inter_bd (m : Maj Seg) (i : Fin (V m).k) : (V m).L i ∩ ⋃ m', discBd (V m').P = + (V m).F i := by + ext x + constructor + · rintro ⟨hx, hx'⟩ + obtain ⟨m', hm⟩ := mem_iUnion.1 hx' + by_cases he : m = m' + · subst he + rw [← (V m).L_inter i] + exact ⟨hx, discBd_subset _ hm⟩ + · exact absurd ((V m').P_sub (discBd_subset _ hm)) (Set.disjoint_left.mp + (disjoint_disc harr he) ((V m).L_sub i hx)) + · intro hx + refine ⟨?_, mem_iUnion.2 ⟨m, ?_⟩⟩ + · rw [← (V m).L_inter i] at hx + exact hx.1 + · rw [(V m).bd_P] + exact mem_iUnion.2 ⟨i, hx⟩ + +end + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/VortexPaint.lean b/LeanPool/GraphMinor/GM17/VortexPaint.lean new file mode 100644 index 0000000000..9e86f07a86 --- /dev/null +++ b/LeanPool/GraphMinor/GM17/VortexPaint.lean @@ -0,0 +1,182 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.VortexCut + +/-! +# The painting of the cut surface + +Second step of the proof of XVII (13.1), page 203. We remove the polygons from the surface +(`cut_surface`). The discs of the small societies and the lunes, +as subsets of the cut surface, are closed discs that meet only at points of the arrangement, so they +make a painting (`exists_cut_painting`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface GM09 GM14 GM16 Graph + +universe u v + +variable {α : Type u} {β : Type v} {S : Type} [TopologicalSpace S] [T2Space S] {G : Graph α β} {Seg + : Set (Society α β)} {D : Society α β → Set S} {ν : α → S} {ρ : ℕ} + {V : ∀ m : Maj Seg, VortexCut m.1 (D m.1) ν ρ} + +omit [T2Space S] in +theorem VortexCut.nx_ne {s : Society α β} {E : Set S} (W : VortexCut s E ν ρ) + (i : Fin W.k) : W.nx i ≠ i := by + intro h + have h1 := W.hnx i + rw [h] at h1 + have h2 := W.four + have h3 := i.2 + by_cases hc : i.1 + 1 < W.k + · rw [Nat.mod_eq_of_lt hc] at h1 + omega + · have : i.1 + 1 = W.k := by omega + rw [this, Nat.mod_self] at h1 + omega + +variable (harr : IsProperArrangement Seg D ν) (hS : IsClosedSurface S) (hfin : Seg.Finite) +include harr hS hfin + +omit [TopologicalSpace S] [T2Space S] harr hS in +theorem finite_Maj : Finite (Maj Seg) := (hfin.subset (sep_subset _ _)).to_subtype + +omit [TopologicalSpace S] [T2Space S] harr hS in +theorem finite_Mnr : Finite (Mnr Seg) := (hfin.subset (sep_subset _ _)).to_subtype + +omit [T2Space S] harr hS in +theorem finite_Idx : Finite (Idx V) := by + have := finite_Maj hfin + have := finite_Mnr hfin + infer_instance + +omit [T2Space S] in +/-- The surface with the polygons removed. -/ +theorem cut_surface [ConnectedSpace S] : + IsClosed (Cut V) ∧ IsSurface ↥(Cut V) ∧ bd ↥(Cut V) = Subtype.val ⁻¹' (⋃ m, discBd (V m).P) + ∧ ConnectedSpace ↥(Cut V) ∧ + cuffs ↥(Cut V) = range fun m => (Subtype.val ⁻¹' discBd (V m).P : Set ↥(Cut V)) := by + have := finite_Maj hfin + exact remove_discs ⟨hS.1, hS.2.1, fun x => (hS.2.2 x).isManifoldPoint⟩ hS.2.2 (fun m => + (V m).disc_P) fun m m' h => disjoint_P harr h + +/-- A disc of the painting, in the cut surface. -/ +def dT (V : ∀ m : Maj Seg, VortexCut m.1 (D m.1) ν ρ) (i : Idx V) : Set ↥(Cut V) + := Subtype.val ⁻¹' Ds V i + +/-- The nodes of the painting. -/ +def NT (V : ∀ m : Maj Seg, VortexCut m.1 (D m.1) ν ρ) : Set ↥(Cut V) := Subtype.val ⁻¹' Nd Seg ν + +theorem dT_disc [ConnectedSpace S] (i : Idx V) : IsClosedDisc (dT V i) ∧ discBd (dT V i) + = Subtype.val ⁻¹' discBd (Ds V i) := by + obtain ⟨h1, h2, -, h4, -⟩ := cut_surface (V := V) harr hS hfin + have : CompactSpace ↥(Cut V) := h2.1 + obtain ⟨z, hz⟩ := (IsOArc.isConnected' (Ds_disc harr i).isOArc_discBd).nonempty + have : Nonempty ↥(Cut V) := ⟨⟨z, Ds_sub_Cut harr i (discBd_subset _ hz)⟩⟩ + exact isClosedDisc_preimage h1.isClosedEmbedding_subtypeVal (Ds_disc harr i) (by + rw [Subtype.range_coe] + exact Ds_sub_Cut harr i) + +omit [TopologicalSpace S] [T2Space S] harr hS in +theorem finite_Nd : (Nd Seg ν).Finite := by + refine Set.Finite.image _ ?_ + exact hfin.biUnion fun s _ => s.Ω.finite_bar + +omit [T2Space S] harr hS hfin in +theorem NT_inter (i : Idx V) : NT V ∩ dT V i = Subtype.val ⁻¹' (Nd Seg ν ∩ Ds V i) := rfl + +omit [T2Space S] harr hS in +theorem ncard_NT_le (i : Idx V) : (NT V ∩ dT V i).ncard ≤ (Nd Seg ν ∩ Ds V i).ncard := by + have hf := (finite_Nd (ν := ν) hfin).subset (inter_subset_left (t := Ds V i)) + rw [NT_inter] + exact Set.ncard_le_ncard_of_injOn Subtype.val (fun x hx => hx) Subtype.val_injective.injOn hf + +omit hS hfin in +omit [T2Space S] in +theorem pt_ne_next (m : Maj Seg) (i : Fin (V m).k) : ν ((V m).t i) ≠ ν ((V m).t ((V m).nx i)) + := fun he => by + have h1 := harr.1.injOn_pts (bar_sub_verts m.2.1 (t_mem_bar m i)) (bar_sub_verts m.2.1 + (t_mem_bar m _)) he + exact (V m).nx_ne i ((V m).dec.injective_t h1).symm + +theorem lune_ends [ConnectedSpace S] (m : Maj Seg) (i : Fin (V m).k) : + ∃ u v : ↥(Cut V), u ≠ v ∧ u.1 = ν ((V m).t i) ∧ v.1 = ν ((V m).t ((V m).nx i)) ∧ NT V ∩ dT V + (.inr ⟨m, i⟩) = {u, v} ∧ + dT V (.inr ⟨m, i⟩) ∩ bd ↥(Cut V) = Subtype.val ⁻¹' (V m).F i ∧ IsLineWithEnds + (Subtype.val ⁻¹' (V m).F i : Set ↥(Cut V)) u v := by + obtain ⟨-, -, h3, -, -⟩ := cut_surface (V := V) harr hS hfin + have hsub : (V m).F i ⊆ range (Subtype.val : ↥(Cut V) → S) := by + rw [Subtype.range_coe] + refine Subset.trans ?_ (Ds_sub_Cut harr (.inr ⟨m, i⟩)) + change (V m).F i ⊆ (V m).L i + rw [← (V m).L_inter i] + exact inter_subset_left + obtain ⟨u, v, hu, hv, hl⟩ := IsLineWithEnds.pull IsEmbedding.subtypeVal ((V m).F_line i) hsub + have hne : u ≠ v := fun h => pt_ne_next harr m i (by rw [← hu, ← hv, h]) + refine ⟨u, v, hne, hu, hv, ?_, ?_, hl⟩ + · rw [NT_inter] + change _ ⁻¹' (Nd Seg ν ∩ (V m).L i) = _ + rw [Nd_inter_inr harr] + ext x + simp only [mem_preimage, mem_insert_iff, mem_singleton_iff, ← hu, ← hv, Subtype.val_inj] + · rw [h3, ← lune_inter_bd harr m i] + rfl + +theorem exists_cut_painting [ConnectedSpace S] : + ∃ Γ : Painting ↥(Cut V), Γ.U = (⋃ i, dT V i) ∧ Γ.N = NT V ∧ Γ.C = range (fun i + => dT V i \ NT V) ∧ + ∀ i, closure (dT V i \ NT V) = dT V i ∧ tilde (dT V i \ NT V) = NT V ∩ dT V i := by + have := finite_Idx (V := V) hfin + obtain ⟨-, h2, h3, -, -⟩ := cut_surface (V := V) harr hS hfin + have : T2Space ↥(Cut V) := h2.2.1 + refine exists_painting_of_discs (fun i => (dT_disc harr hS hfin i).1) ?_ ?_ ?_ ?_ ?_ ?_ ?_ + · exact (finite_Nd (ν := ν) hfin).preimage Subtype.val_injective.injOn + · intro i x hx + rw [(dT_disc harr hS hfin i).2] + exact Nd_sub_discBd harr hS i hx + · intro i j hij x hx + exact inter_sub_Nd harr hij hx + · intro x hx + obtain ⟨i, hi⟩ := mem_iUnion.1 (Nd_sub_Ds (V := V) harr hx) + exact mem_iUnion.2 ⟨i, hi⟩ + · intro i + refine (ncard_NT_le hfin i).trans ?_ + rcases i with a | ⟨m, a⟩ + · change (Nd Seg ν ∩ D a.1).ncard ≤ 3 + rw [Nd_inter_inl harr] + exact (Set.ncard_image_le a.1.Ω.finite_bar).trans (not_lt.mp a.2.2) + · change (Nd Seg ν ∩ (V m).L a).ncard ≤ 3 + rw [Nd_inter_inr harr] + exact (Set.ncard_insert_le _ _).trans (by simp) + · intro x hx + rw [h3] at hx + obtain ⟨m, hm⟩ := mem_iUnion.1 hx + rw [(V m).bd_P] at hm + obtain ⟨j, hj⟩ := mem_iUnion.1 hm + refine mem_iUnion.2 ⟨.inr ⟨m, j⟩, ?_⟩ + change x.1 ∈ (V m).L j + rw [← (V m).L_inter j] at hj + exact hj.1 + · rintro (a | ⟨m, a⟩) ⟨x, hx, hb⟩ + · rw [h3] at hb + exact absurd (mnr_inter_bd harr a ⟨hx.1, hb⟩) hx.2 + · obtain ⟨u, v, hne, -, -, h4, h5, hl⟩ := lune_ends harr hS hfin m a + refine ⟨by rw [h4, Set.ncard_pair hne], ?_, ?_⟩ + · rw [h5] + obtain ⟨f, -, -⟩ := hl + exact ⟨f⟩ + · rw [h5, h4] + exact lineEnds_eq hl + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM17/VortexPortrayal.lean b/LeanPool/GraphMinor/GM17/VortexPortrayal.lean new file mode 100644 index 0000000000..d7fd81a7ba --- /dev/null +++ b/LeanPool/GraphMinor/GM17/VortexPortrayal.lean @@ -0,0 +1,310 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.VortexAxioms + +/-! +# The portrayal in XVII (13.1) + +Last step of the construction in the proof of XVII (13.1), pages 203-204. From a segregation with a +proper arrangement in a closed surface we get a portrayal of the graph in the surface +with the polygons removed (`exists_portrayal_of_arrangement`). Its warp is at most `ρ + 1`, it has +at most `κ` cuffs, and each cell graph lies in a society of the segregation. +-/ + +@[expose] public section + +namespace GraphMinor.GM17 + +open Set Topology GraphMinor.Surface GM09 GM14 GM15 GM16 Graph + +universe u v + +variable {α : Type u} [Nonempty α] {β : Type v} {S : Type} [TopologicalSpace S] [T2Space S] {G : + Graph α β} {Seg : Set (Society α β)} {D : Society α β → Set S} {ν : α → S} {ρ : ℕ} + {V : ∀ m : Maj Seg, VortexCut m.1 (D m.1) ν ρ} + +theorem IsLineWithEnds.isPreconnected {T : Type*} [TopologicalSpace T] {L : Set T} {u v : T} + (h : IsLineWithEnds L u v) : IsPreconnected L := + GraphMinor.Surface.IsLineWithEnds.isPreconnected h + +variable (harr : IsProperArrangement Seg D ν) (hS : IsClosedSurface S) (hfin : Seg.Finite) +include harr hS hfin + +/-- (P7). -/ +theorem p7_aux [ConnectedSpace S] (m : Maj Seg) {n₁ n₂ n₃ n₄ : ↥(Cut V)} {Θ : Set ↥(Cut V)} (hΘ : Θ + = Subtype.val ⁻¹' discBd (V m).P) + (h₁ : n₁ ∈ NT V ∩ Θ) (h₂ : n₂ ∈ NT V ∩ Θ) (h₃ : n₃ ∈ NT V ∩ Θ) (h₄ : n₄ ∈ NT V ∩ Θ) + (ho : GM19.InOrderOn Θ n₁ n₂ n₃ n₄) {v : α} + (hv₁ : v ∈ bt V n₁.1 ∨ (n₁ ∈ NT V ∧ v = nv Seg ν n₁.1)) (hv₃ : v ∈ bt V n₃.1 ∨ (n₃ ∈ NT V ∧ v + = nv Seg ν n₃.1)) : + (v ∈ bt V n₂.1 ∨ (n₂ ∈ NT V ∧ v = nv Seg ν n₂.1)) ∨ (v ∈ bt V n₄.1 ∨ (n₄ ∈ NT V ∧ v + = nv Seg ν n₄.1)) := by + obtain ⟨-, h2, -, -, -⟩ := cut_surface (V := V) harr hS hfin + have : T2Space ↥(Cut V) := h2.2.1 + have hLm : ∀ j, ν ((V m).t j) ∈ (V m).L j := fun j => ((V m).node_mem j j).mpr (Or.inl rfl) + let nd : Fin (V m).k → ↥(Cut V) := fun j => ⟨ν ((V m).t j), Ds_sub_Cut harr (.inr ⟨m, j⟩) (hLm j)⟩ + have hnd : ∀ n ∈ NT V ∩ Θ, ∃ j, nd j = n := by + rintro n ⟨hn, hb⟩ + obtain ⟨w, hw, he⟩ := hn + rw [hΘ] at hb + have hb' : ν w ∈ discBd (V m).P := by + rw [he] + exact hb + obtain ⟨j, rfl⟩ := exists_t_eq (V := V) (mem_bar_of_mem_disc harr m.2.1 hw ((V m).P_sub + (discBd_subset _ hb'))) + exact ⟨j, Subtype.ext he⟩ + obtain ⟨a, rfl⟩ := hnd _ h₁ + obtain ⟨b, rfl⟩ := hnd _ h₂ + obtain ⟨c, rfl⟩ := hnd _ h₃ + obtain ⟨d, rfl⟩ := hnd _ h₄ + have hinj : Function.Injective nd := fun x y he => by + have := congrArg Subtype.val he + have h3 := harr.1.injOn_pts (bar_sub_verts m.2.1 (t_mem_bar m x)) (bar_sub_verts m.2.1 + (t_mem_bar m y)) this + exact (V m).dec.injective_t h3 + let I : Set (Fin (V m).k) := {j | v ∈ bt V (nd j).1 ∨ (nd j ∈ NT V ∧ v = nv Seg ν (nd j).1)} + have hmem : ∀ j ∈ I, v ∈ V((V m).X j) := by + rintro j (⟨m', i, j', h1, -, -, h4, -⟩ | ⟨-, h1⟩) + · obtain ⟨rfl, hi⟩ := Sigma.mk.inj_iff.mp (node_unique harr h1) + obtain rfl := eq_of_heq hi + exact h4 + · have : v = (V m).t j := by rw [h1]; exact nv_t harr m j + rw [this] + exact (V m).dec.mem_vertexSet j + have hI : ∀ x y z, x < y → y < z → x ∈ I → z ∈ I → y ∈ I := fun x y z hxy hyz hx hz => by + have h0 : x.1 < y.1 := hxy + let y' : Fin (V m).k := ⟨y.1 - 1, by omega⟩ + have hv' := (V m).mem_between (a := x) (b := y') (c := z) + (Fin.le_def.mpr (by simp only [y']; omega)) + (Fin.le_def.mpr (by have : y.1 < z.1 := hyz; simp only [y']; omega)) + (hmem x hx) (hmem z hz) + have hvy := (V m).mem_between (a := x) (b := y) (c := z) hxy.le hyz.le (hmem x hx) (hmem z hz) + by_cases he : v = (V m).t y + · exact Or.inr ⟨pt_mem_Nd m.2.1 (t_mem_bar m y), by rw [he]; exact (nv_t harr m y).symm⟩ + · exact Or.inl ⟨m, y, y', rfl, by simp only [y']; omega, hv', hvy, he⟩ + have hF : ∀ i, IsPreconnected (Subtype.val ⁻¹' (V m).F i : Set ↥(Cut V)) ∧ (Subtype.val ⁻¹' + (V m).F i : Set ↥(Cut V)) ⊆ Θ ∧ nd i ∈ (Subtype.val ⁻¹' (V m).F i : Set ↥(Cut V)) ∧ + nd ((V m).nx i) ∈ (Subtype.val ⁻¹' (V m).F i : Set ↥(Cut V)) ∧ ∀ j, nd j ∈ (Subtype.val ⁻¹' + (V m).F i : Set ↥(Cut V)) → j = i ∨ j = (V m).nx i := fun i => by + obtain ⟨u, w, -, -, -, -, -, hl⟩ := lune_ends (V := V) harr hS hfin m i + refine ⟨IsLineWithEnds.isPreconnected hl, ?_, ((V m).F_line i).left_mem, + ((V m).F_line i).right_mem, fun j hj => ?_⟩ + · rw [hΘ] + intro x hx + change x.1 ∈ discBd (V m).P + rw [(V m).bd_P] + exact mem_iUnion.2 ⟨i, hx⟩ + · apply ((V m).node_mem i j).mp + have h3 : ν ((V m).t j) ∈ (V m).F i := hj + rw [← (V m).L_inter i] at h3 + exact h3.1 + exact mem_of_inOrderOn hinj (V m).hnx hF hI ho hv₁ hv₃ + +omit harr hS hfin [Nonempty α] [TopologicalSpace S] [T2Space S] in +theorem Portrayal.warp_le_of_cellWarpLE {H : Hypergraph α β} (π : Portrayal H) {p : ℕ} (hp : 1 ≤ p) + (h : ∀ c ∈ π.Γ.C, π.CellWarpLE c p) : π.warp ≤ p := by + classical + unfold Portrayal.warp + split_ifs + · refine max_le hp (csSup_le' ?_) + rintro _ ⟨Θ, -, rfl⟩ + refine csSup_le' ?_ + rintro _ ⟨c, hc, -, rfl⟩ + exact Nat.sInf_le (h c hc) + · exact hp + +omit harr hS hfin + +/-- **The portrayal of a proper arrangement.** A segregation of type `(ρ, κ)` with a proper +arrangement in a connected closed surface gives a portrayal of the graph in the surface with +the polygons removed. This is the construction in the proof of XVII (13.1), pages 202-204. -/ +theorem exists_portrayal_of_arrangement [ConnectedSpace S] (hS : IsClosedSurface S) + (hV : V(G).Finite) (hE : E(G).Finite) {κ : ℕ} (hseg : GM16.IsSegregationOfType G ρ κ Seg) + (harr : IsProperArrangement Seg D ν) : + ∃ π : Portrayal (Hypergraph.ofGraph G hV hE), (∃ j : π.S → S, IsEmbedding j) ∧ π.warp ≤ ρ + 1 ∧ + (cuffs π.S).encard ≤ κ ∧ + ∀ c ∈ π.Γ.C, ∃ s ∈ Seg, SubhypergraphInGraph (π.cellGraph c) s.G := by + classical + have hsg := hseg.isSegregation + have hfin := hsg.finite + have hex : ∀ m : Maj Seg, Nonempty (VortexCut m.1 (D m.1) ν ρ) := fun m + => exists_vortexCut hS harr m.2.1 m.2.2 (hseg.is_rho_vortex m.2.1 m.2.2) + let V : ∀ m : Maj Seg, VortexCut m.1 (D m.1) ν ρ := fun m => Classical.choice (hex m) + obtain ⟨hcl, hsurf, hbd, hcon, hcuffs⟩ := cut_surface (V := V) harr hS hfin + obtain ⟨Γ, hU, hN, hC, hct⟩ := exists_cut_painting (V := V) harr hS hfin + have : T2Space ↥(Cut V) := hsurf.2.1 + let cl : Idx V → Set ↥(Cut V) := fun i => dT V i \ NT V + have hcC : ∀ i, cl i ∈ Γ.C := fun i => hC ▸ mem_range_self i + have hcinj : Function.Injective cl := fun i j he => by + by_contra hij + obtain ⟨x, hx⟩ := arcComponentsIn_nonempty (hcC i) + have h1 : x ∈ dT V j := (he ▸ hx : x ∈ cl j).1 + exact hx.2 (inter_sub_Nd harr hij ⟨hx.1, h1⟩) + let cg : Set ↥(Cut V) → Hypergraph α β := Function.extend cl (gr V) (fun _ => ⊥) + have hcg : ∀ i, cg (cl i) = gr V i := fun i => hcinj.extend_apply _ _ i + have htl : ∀ i, tilde (cl i) = NT V ∩ dT V i := fun i => (hct i).2 + have hbL : ∀ a, ¬ (cl (.inl a) ∩ bd ↥(Cut V)).Nonempty := by + rintro a ⟨x, hx, hb⟩ + rw [hbd] at hb + exact hx.2 (mnr_inter_bd harr a ⟨hx.1, hb⟩) + have hbR : ∀ m a, (cl (.inr ⟨m, a⟩) ∩ bd ↥(Cut V)).Nonempty := by + intro m a + obtain ⟨u, w, hne, -, -, h4, h5, f, h0, h1⟩ := lune_ends (V := V) harr hS hfin m a + let t : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have ht0 : (f t).1 ≠ u := fun he => by + have h3 : f t = f 0 := Subtype.ext (he.trans h0.symm) + have := congrArg Subtype.val (f.injective h3) + norm_num [t] at this + have ht1 : (f t).1 ≠ w := fun he => by + have h3 : f t = f 1 := Subtype.ext (he.trans h1.symm) + have := congrArg Subtype.val (f.injective h3) + norm_num [t] at this + have hm : (f t).1 ∈ dT V (.inr ⟨m, a⟩) ∩ bd ↥(Cut V) := by + rw [h5] + exact (f t).2 + refine ⟨(f t).1, ⟨hm.1, fun hn => ?_⟩, hm.2⟩ + have : (f t).1 ∈ NT V ∩ dT V (.inr ⟨m, a⟩) := ⟨hn, hm.1⟩ + rw [h4] at this + rcases this with h | h + · exact ht0 h + · exact ht1 h + have hNmem : ∀ n : ↥(Cut V), n ∈ NT V → n.1 ∈ Nd Seg ν := fun _ h => h + have hcuffm : ∀ Θ ∈ cuffs ↥(Cut V), ∃ m, Θ = Subtype.val ⁻¹' discBd (V m).P := fun Θ hΘ => by + rw [hcuffs] at hΘ + obtain ⟨m, rfl⟩ := hΘ + exact ⟨m, rfl⟩ + have hbtV : ∀ x, bt V x ⊆ V(G) := fun x v hv => by + obtain ⟨m, -, -, hg⟩ := bt_mem_graph hv + exact (hsg.le _ m.2.1).vertexSet_mono hg + let π : Portrayal (Hypergraph.ofGraph G hV hE) := + { S := ↥(Cut V) + isSurface := hsurf + connected := hcon + Γ := Γ + cellGraph := cg + borderSet := fun x => bt V x.1 + domγ := NT V + nodeVertex := fun x => nv Seg ν x.1 + cellGraph_le := fun c hc => by + obtain ⟨i, rfl⟩ := hC ▸ hc + change cg (cl i) ≤ _ + rw [hcg] + exact gr_le hsg hV hE i + borderSet_subset := fun n _ => hbtV n.1 + domγ_subset := hN.ge + nodeVertex_mem := fun n hn => by + obtain ⟨w, hw, he⟩ := hNmem n hn + change nv Seg ν n.1 ∈ V(G) + rw [← he, nv_eq harr hw] + obtain ⟨s, hs, hv'⟩ : ∃ s ∈ Seg, w ∈ s.Ω.bar := by simpa [segregationVertices] using hw + exact (hsg.le _ hs).vertexSet_mono (s.bar_subset hv') + nodeVertex_injOn := fun x hx y hy he => by + obtain ⟨w, hw, he₁⟩ := hNmem x hx + obtain ⟨w', hw', he₂⟩ := hNmem y hy + have h' : nv Seg ν x.1 = nv Seg ν y.1 := he + rw [← he₁, ← he₂, nv_eq harr hw, nv_eq harr hw'] at h' + exact Subtype.ext (by rw [← he₁, ← he₂, h']) + p1_vertex := fun v hv => by + obtain ⟨i, hi⟩ := cover_vertex (V := V) hsg hv + exact ⟨cl i, hcC i, by rw [hcg]; exact hi⟩ + p1_edge := fun e he => by + obtain ⟨i, hi⟩ := cover_edge (V := V) hsg he + exact ⟨cl i, hcC i, by rw [hcg]; exact hi⟩ + p1_disjoint := fun c hc c' hc' hne => by + obtain ⟨i, rfl⟩ := hC ▸ hc + obtain ⟨j, rfl⟩ := hC ▸ hc' + change Disjoint (cg (cl i)).edgeSet (cg (cl j)).edgeSet + rw [hcg, hcg] + exact gr_edge_disjoint hsg (fun h => hne (h ▸ rfl)) + p2 := fun c hc n hn => by + obtain ⟨i, rfl⟩ := hC ▸ hc + change nv Seg ν n.1 ∈ (cg (cl i)).vertexSet + rw [hcg] + have h1 : n ∈ NT V ∩ dT V i := htl i ▸ hn.1 + exact nv_mem_gr harr i h1 + p3_notMem := fun n hn => nv_notMem_bt harr hn.1 + p3_subset := fun c hc hb n hn => by + obtain ⟨i, rfl⟩ := hC ▸ hc + rcases i with a | ⟨m, a⟩ + · exact absurd hb (hbL a) + · change bt V n.1 ⊆ (cg (cl _)).vertexSet + rw [hcg] + have h1 : n ∈ NT V ∩ dT V (.inr ⟨m, a⟩) := htl _ ▸ hn + exact bt_sub_gr harr h1 + p4_disjoint := fun Θ₁ hΘ₁ Θ₂ hΘ₂ hne n₁ hn₁ n₂ hn₂ => by + obtain ⟨m₁, rfl⟩ := hcuffm Θ₁ hΘ₁ + obtain ⟨m₂, rfl⟩ := hcuffm Θ₂ hΘ₂ + have hm : m₁ ≠ m₂ := fun h => hne (h ▸ rfl) + exact bt_disjoint harr hsg hm ((V m₁).P_sub (discBd_subset _ hn₁.2)) ((V m₂).P_sub + (discBd_subset _ hn₂.2)) + p4_notMem := fun Θ hΘ n₁ hn₁ n₂ hn₂ hoff => by + obtain ⟨m, rfl⟩ := hcuffm Θ hΘ + exact nv_notMem_bt_of_off harr hsg ((V m).P_sub (discBd_subset _ hn₁.2)) hn₂ hoff + p5 := fun c hc hb v hv ho => by + obtain ⟨i, rfl⟩ := hC ▸ hc + rcases i with a | ⟨m, a⟩ + · obtain ⟨c', hc', hne, hvc⟩ := ho + obtain ⟨j, rfl⟩ := hC ▸ hc' + have hv₁ : v ∈ (gr V (.inl a)).vertexSet := hcg (.inl a) ▸ hv + have hv₂ : v ∈ (gr V j).vertexSet := hcg j ▸ hvc + obtain ⟨h1, h2⟩ := p5_aux harr hsg a hv₁ (fun h => hne (h ▸ rfl)) hv₂ + have hmem : ν v ∈ Cut V := Ds_sub_Cut harr (.inl a) h1.2 + refine ⟨⟨ν v, hmem⟩, ⟨?_, h1.1⟩, h2⟩ + rw [htl] + exact ⟨h1.1, h1.2⟩ + · exact absurd (hbR m a) hb + p6 := fun c hc hb v hv ho => by + obtain ⟨i, rfl⟩ := hC ▸ hc + rcases i with a | ⟨m, a⟩ + · exact absurd hb (hbL a) + · obtain ⟨c', hc', hne, hvc⟩ := ho + obtain ⟨j, rfl⟩ := hC ▸ hc' + have hv₁ : v ∈ (gr V (.inr ⟨m, a⟩)).vertexSet := hcg _ ▸ hv + have hv₂ : v ∈ (gr V j).vertexSet := hcg j ▸ hvc + obtain ⟨n, hn, h1⟩ := p6_aux harr hsg hv₁ (fun h => hne (h ▸ rfl)) hv₂ + have hmem : n ∈ Cut V := Ds_sub_Cut harr (.inr ⟨m, a⟩) hn.2 + refine ⟨⟨n, hmem⟩, ?_, h1⟩ + rw [htl] + exact hn + p7 := fun Θ hΘ n₁ hn₁ n₂ hn₂ n₃ hn₃ n₄ hn₄ ho v hv₁ hv₃ => by + obtain ⟨m, rfl⟩ := hcuffm Θ hΘ + rw [hN] at hn₁ hn₂ hn₃ hn₄ + exact p7_aux harr hS hfin m rfl hn₁ hn₂ hn₃ hn₄ ho hv₁ hv₃ } + refine ⟨π, ⟨Subtype.val, IsEmbedding.subtypeVal⟩, ?_, ?_, ?_⟩ + · refine Portrayal.warp_le_of_cellWarpLE π (by omega) fun c _ n₁ _ n₂ _ _ => ?_ + have hle : ∀ n : ↥(Cut V), (bt V n.1).ncard ≤ ρ := fun n => ncard_bt_le harr n.1 + have hplus : ∀ n : ↥(Cut V), (π.borderPlus n).ncard ≤ ρ + 1 := fun n => by + have hsub : π.borderPlus n ⊆ insert (nv Seg ν n.1) (bt V n.1) := by + rintro v (hv | ⟨-, hv⟩) + · exact Or.inr hv + · exact Or.inl hv + have hfinb : (bt V n.1).Finite := hV.subset (hbtV n.1) + exact (Set.ncard_le_ncard hsub (hfinb.insert _)).trans ((Set.ncard_insert_le _ _).trans + (by have := hle n; omega)) + refine ⟨(hle n₁).trans (by omega), (hle n₂).trans (by omega), fun h => ?_⟩ + have := hplus n₁ + omega + · have := finite_Maj hfin + change (cuffs ↥(Cut V)).encard ≤ κ + rw [hcuffs, ← image_univ] + refine (Set.encard_image_le _ _).trans ?_ + rw [Set.encard_univ, ENat.card_coe_set_eq] + have hf : {s ∈ Seg | 3 < s.Ω.bar.ncard}.Finite := hfin.subset (sep_subset _ _) + rw [← hf.cast_ncard_eq] + exact_mod_cast hseg.vortex_count_le + · intro c hc + obtain ⟨i, rfl⟩ := hC ▸ hc + refine ⟨soc V i, soc_mem V i, ?_⟩ + change SubhypergraphInGraph (cg (cl i)) _ + rw [hcg] + exact ⟨gr_vertex_sub i, gr_edge_sub i⟩ + +end GraphMinor.GM17 diff --git a/LeanPool/GraphMinor/GM18/Cited.lean b/LeanPool/GraphMinor/GM18/Cited.lean new file mode 100644 index 0000000000..d153971486 --- /dev/null +++ b/LeanPool/GraphMinor/GM18/Cited.lean @@ -0,0 +1,119 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Higman +public import LeanPool.GraphMinor.GM04.Patchwork.Defs +public import LeanPool.GraphMinor.GM04.Patchwork.Menger +public import LeanPool.GraphMinor.GM04.TreeDecomposition +public import LeanPool.GraphMinor.GM10.Defs2 +public import LeanPool.GraphMinor.GM10.Statements + +/-! +# Results from Graph Minors IV and X cited in Graph Minors XVIII + +This file states as `Prop`s the results from *Graph Minors IV. Tree-width and well-quasi-ordering* +(JCTB 48 (1990) 227–254) and *Graph Minors X. Obstructions to tree-decomposition* (JCTB 52 (1991) +153–190) that are cited in *Graph Minors XVIII. Tree-decompositions and well-quasi-ordering* +(JCTB 89 (2003) 77–108). `GraphMinor/GM18/Proved.lean` proves each of them: + +* `GM04Theorem91Statement`: Graph Minors IV, (9.1) (page 252), well-quasi-ordering of robust + `Ω`-patchworks of bounded tree-width under simulation. +* `GM10.Theorem52Statement` (re-exported from `GraphMinor.GM10.Statements`): Graph Minors X, (5.2) + (page 169), `θ(G) ≤ ω(G) + 1 ≤ (3/2) θ(G)`. +* `GM10Theorem83Statement`: Graph Minors X, (8.3) (page 175), transfer of a tangle across a titanic + separation. +* `GM10Theorem92Statement`: Graph Minors X, (9.2) (page 178), existence of a tie-breaker in every + hypergraph. +* `GM10Theorem102Statement`: Graph Minors X, (10.2) (page 181), the `(𝒯₁, 𝒯₂)`-distinction is + doubly `λ`-robust. +* `GM10Theorem103Statement`: Graph Minors X, (10.3) (page 181), existence of a standard + tree-decomposition relative to mutually distinguishable tangles. +-/ + +@[expose] public section + +namespace GraphMinor.GM18 + +universe u v w + +/-- Statement of Graph Minors IV, (9.1) (page 252): +"Let $n \ge 0$, let $\Omega$ be a well-quasi-order, and let $P_i = (G_i, \mu_i, \Delta_i, +\phi_i)$ $(i = 1, 2, \dots)$ be a countable sequence of robust $\Omega$-patchworks, where +each $G_i$ has tree-width $\le n$. Then there exist $i' > i \ge 1$ such that there is a +realizable expansion of $P_i$ in $P_{i'}$." -/ +def GM04Theorem91Statement : Prop := + ∀ {Ω : Type w} [Preorder Ω] {α : Type u} {β : Type v} (n : ℕ) + (P : ℕ → GM04.Patchwork Ω α β), + WellQuasiOrderedLE Ω → + (∀ i, (P i).IsRobust) → + (∀ i, GM04.TreeWidthLE (P i).G n) → + ∃ i i', i < i' ∧ GM04.Simulated (P i) (P i') + +/-- Statement of Graph Minors X, (8.3) (page 175): +"Let $(C, D)$ be a separation of a hypergraph $G$, and let $(C', D)$ be a titanic separation +of a hypergraph $G'$, with $V(C \cap D) = V(C' \cap D)$. Let $\mathscr{T}$ be a tangle in +$G$ of order $\theta \ge 2$ with $(C, D) \in \mathscr{T}$. Let $\mathscr{T}'$ be the set of +all separations $(A', B')$ of $G'$ of order $< \theta$ such that there exists $(A, B) \in +\mathscr{T}$ with $E(A \cap D) = E(A' \cap D)$. Then $\mathscr{T}'$ is a tangle in $G'$ of +order $\theta$." -/ +def GM10Theorem83Statement : Prop := + ∀ {α : Type u} {β : Type v} (G G' C C' D : Hypergraph α β) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (θ : ℕ), + G.IsSeparation C D → + GM10.IsTitanic G' C' D → + (C ∩ D).vertexSet = (C' ∩ D).vertexSet → + GM10.IsTangle G θ 𝒯 → + 2 ≤ θ → + (C, D) ∈ 𝒯 → + GM10.IsTangle G' θ (GM10.titanicTransferredTangle G' D 𝒯 θ) + +/-- Statement of Graph Minors X, (9.2) (page 178): +"In every hypergraph there is a tie-breaker." -/ +def GM10Theorem92Statement : Prop := + ∀ {α : Type u} {β : Type v} (G : Hypergraph α β), + ∃ (Λ : Type) (_ : LinearOrder Λ) (lam : Hypergraph α β × Hypergraph α β → Λ), + GM10.IsTieBreaker G lam + +/-- Statement of Graph Minors X, (10.2) (page 181): +"If $\mathscr{T}_1, \mathscr{T}_2$ are distinguishable tangles in $G$, the $(\mathscr{T}_1, +\mathscr{T}_2)$-distinction is doubly $\lambda$-robust." -/ +def GM10Theorem102Statement : Prop := + ∀ {α : Type u} {β : Type v} {Λ : Type w} [LinearOrder Λ] + (G : Hypergraph α β) (lam : Hypergraph α β × Hypergraph α β → Λ) + (θ₁ θ₂ : ℕ) (𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)) + (A B : Hypergraph α β), + GM10.IsTieBreaker G lam → + GM10.IsTangle G θ₁ 𝒯₁ → + GM10.IsTangle G θ₂ 𝒯₂ → + GM10.IsDistinction lam 𝒯₁ 𝒯₂ A B → + GM10.IsDoublyLambdaRobust G lam A B + +/-- Statement of Graph Minors X, (10.3) (page 181): +"Let $\mathscr{T}_1, \dots, \mathscr{T}_n$ be mutually distinguishable tangles in a +hypergraph $G$ with $n \ge 1$, and let $\lambda$ be a tie-breaker. Then there is a +tree-decomposition $(T, \tau)$ of $G$, where $V(T) = \{t_1, \dots, t_n\}$, with the +following properties:* (i) *For every $e \in E(T)$ and for $1 \le i \le n$, if $T_1, T_2$ +are the components of $T \setminus e$ and $t_i \in V(T_1)$ then* $$ \left( \bigcup_{t \in +V(T_1)} \tau(t), \bigcup_{t \in V(T_2)} \tau(t) \right) \notin \mathscr{T}_i. $$ (ii) *For +all $i \ne j$ with $1 \le i, j \le n$, let $e$ be the edge of the path of $T$ between $t_i$ +and $t_j$ making separations of smallest $\lambda$-order; then these separations are the +$(\mathscr{T}_i, \mathscr{T}_j)$- and $(\mathscr{T}_j, \mathscr{T}_i)$-distinctions." -/ +def GM10Theorem103Statement : Prop := + ∀ {α : Type u} {β : Type v} {Λ : Type w} [LinearOrder Λ] {n : ℕ} + (G : Hypergraph α β) (lam : Hypergraph α β × Hypergraph α β → Λ) + (θ : Fin n → ℕ) (𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)), + 1 ≤ n → + GM10.IsTieBreaker G lam → + (∀ i : Fin n, GM10.IsTangle G (θ i) (𝒯 i)) → + (∀ i j : Fin n, i ≠ j → GM10.AreDistinguishable (𝒯 i) (𝒯 j)) → + ∃ (T : SimpleGraph (Fin n)) (τ : Fin n → Hypergraph α β), + GM10.IsStandardTreeDecomposition G lam 𝒯 T τ + +end GraphMinor.GM18 diff --git a/LeanPool/GraphMinor/GM18/Defs.lean b/LeanPool/GraphMinor/GM18/Defs.lean new file mode 100644 index 0000000000..a11799029a --- /dev/null +++ b/LeanPool/GraphMinor/GM18/Defs.lean @@ -0,0 +1,818 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Axioms +public import LeanPool.GraphMinor.GM04.Higman +public import LeanPool.GraphMinor.GM04.Patchwork.Defs +public import LeanPool.GraphMinor.GM10.Defs2 +public import Mathlib.Data.Rat.Defs +public import Mathlib.Order.Hom.Basic +public import Mathlib.Order.WithBot +import LeanPool.GraphMinor.GM04.Decomposition.Basic + +/-! +# Definitions for Graph Minors XVIII: Tree-decompositions and well-quasi-ordering + +This file formalizes the definitions of Sections 2–7 of Robertson and Seymour, +*Graph Minors. XVIII. Tree-decompositions and well-quasi-ordering*, J. Combin. Theory Ser. B 89 +(2003) 77–108. + +Where Graph Minors XVIII reuses a notion from Graph Minors IV or Graph Minors X with the same +meaning, we use the interface definition directly (`Hypergraph`, `RootedHypergraph`, +`GM10.IsTreeDecomposition`, `GM10.IsTangle`, `GM10.IsLocation`, `GM10.locationCore`, +`GM10.IsTieBreaker`, `GM10.IsDistinction`, `GM10.IsRobust`, `GM10.IsTitanic`, `GM04.Patch`, +`GM04.Patchwork`, `GM04.RootedTree`, etc.). + +Where Graph Minors XVIII introduces a new notion or uses a term in a sense different from +Graph Minors IV or X, it is defined in the `GraphMinor.GM18` namespace: +* Section 2 (pages 78–82): `vertexLocation`, `IsProper`, `IsStandardDecomposition`, `IsRotund` + (unrooted rotund tree-decompositions, distinct from `GM04.IsRotund`). +* Section 3 (pages 82–84): `IsLinkedTo` (a separation linked to a tangle, distinct from + `GM04.IsLinked`), `locationOrder`, `locationHeart`, `locationTreeWidth`. +* Section 4 (pages 85–89): `Isolates` (`θ`-isolation of a tangle by a location), + `IsLocationEnlargement`, `IsLocationEnlargementByTreeWidth` (enlargement of locations, distinct + from `GM10.IsEnlargement` of designs). +* Section 5 (pages 89–100): `UnlabeledPatchwork`, `PartialPatchwork`, `PartialPatchwork.domφ`, + `PartialPatchwork.IsTotal`, `ConnectedIn`, `IsFeasibleGrouping`, `feasibleGroupings` (`gr(P)`), + `IsComplemented`, `complement` (`G \ A`), `IsRootedLocation`, `rootedLocationToLocation` (`ℒ⁻`), + `rootedLocationCore` (`M(G, ℒ)`), `IsPatchworkHeart`, `HasPatchworkHeart`, `IsPartialPlace`, + `IsOmegaPlace`, `IsPlaceHeart`, `HasPlaceHeart`, `HasPatchworkTreeWidthLE`, + `IsPlaceEnlargementByTreeWidth`. +* Section 6 (pages 100–107): `DisjointUnionPreorder`, `IsCompletion`, `WellBehaved`, `IsRootless`, + `IsRooting`, `IsPlaceEnlargementByClass`, `enlargementClass`, `arborescenceUnderlying`, + `IsRootedDecomposition`, `rootedDecompRootSide` (`τ × (T, f)`), `IsPiece`. +* Section 7 (pages 107–108): `IsLambdaLinkedTo` (`λ`-linked to a tangle `𝒯`). +-/ + +@[expose] public section + +namespace GraphMinor.GM18 + +open Hypergraph SimpleGraph + +universe u v w + +variable {α : Type u} {β : Type v} {Ω : Type w} {ι : Type*} + +/-! ## Section 2: Hypergraphs, Tree-Decompositions and Tangles -/ + +/-- The location of a vertex `t₀ ∈ V(T)` in a tree-decomposition `(T, τ)` of a hypergraph `G` +(Graph Minors XVIII, Section 2, (2.4), page 80): +"**2.4.** *Let $(T, \tau)$ be a tree-decomposition of a hypergraph $G$, let $t_0 \in V(T)$ and let +$e_1, \dots, e_k$ be the edges of $T$ incident with $t_0$. For $1 \le i \le k$ let the components +of $T \setminus e_i$ be $T_i, T'_i$, where $t_0 \in V(T'_i)$. Then* +$$\{(\tau \times T_i, \tau \times T'_i): 1 \le i \le k\}$$ +*is a location.* We call this the *location of $t_0$ in $(T, \tau)$*." -/ +def vertexLocation [Fintype ι] (T : SimpleGraph ι) (τ : ι → Hypergraph α β) (t₀ : ι) : + Set (Hypergraph α β × Hypergraph α β) := + {p | ∃ u : ι, T.Adj t₀ u ∧ + p = (GM10.treeDecompSide T τ s(u, t₀) u, GM10.treeDecompSide T τ s(u, t₀) t₀)} + +/-- A tree-decomposition `(T, τ)` of a hypergraph `G` is proper +(Graph Minors XVIII, Section 2, page 80): +"We say $(T, \tau)$ is *proper* if no edge of $T$ makes a separation $(A, B)$ with $B = G$." -/ +def IsProper [Fintype ι] (G : Hypergraph α β) (T : SimpleGraph ι) + (τ : ι → Hypergraph α β) : Prop := + ∀ ⦃e : Sym2 ι⦄, e ∈ T.edgeSet → ∀ ⦃A B : Hypergraph α β⦄, + GM10.MakesSeparation T τ e A B → B ≠ G + +/-- A standard decomposition `(T, τ)` of `G` relative to distinct tangles `𝒯₁, …, 𝒯ₙ` of the same +order `θ` (Graph Minors XVIII, Section 2, (2.6), page 81): +"Let $\mathscr{T}_1, \dots, \mathscr{T}_n$ be distinct tangles of order $\theta$ in a +hypergraph $G$ with $n \ge 1$, and let $\lambda$ be a tie-breaker. Then there is a +tree-decomposition $(T, \tau)$ of $G$ where $V(T) = \{t_1, \dots, t_n\}$, with the following +properties:* 1. *if $e \in E(T)$ and $T_1, T_2$ are the components of $T \setminus e$ and $1 +\le i \le n$ and $t_i \in V(T_2)$ then $(\tau \times T_1, \tau \times T_2) \in +\mathscr{T}_i$,* 2. *for $1 \le i < j \le n$, let $e$ be the edge of the path of $T$ between +$t_i, t_j$ making separations of minimum $\lambda$-order; then these separations are the +$(\mathscr{T}_i, \mathscr{T}_j)$- and $(\mathscr{T}_j, \mathscr{T}_i)$-distinctions.* We +call $(T, \tau)$ a *standard decomposition* of $G$ relative to $\mathscr{T}_1, \dots, +\mathscr{T}_n$ in which $t_i$ represents $\mathscr{T}_i$ for $i = 1, \dots, n$." -/ +structure IsStandardDecomposition {n : ℕ} {Λ : Type*} [LinearOrder Λ] + (G : Hypergraph α β) (lam : Hypergraph α β × Hypergraph α β → Λ) + (𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)) + (T : SimpleGraph (Fin n)) (τ : Fin n → Hypergraph α β) : Prop where + /-- `(T, τ)` is a tree-decomposition of `G`. -/ + isTreeDecomposition : GM10.IsTreeDecomposition G T τ + /-- (2.6.1) If `e = s(u, v) ∈ E(T)` and `i` lies in the component of `T \ e` containing `v`, then + `(τ × T_u, τ × T_v) ∈ 𝒯 i`. -/ + side_mem_tangle : ∀ (i u v : Fin n), T.Adj u v → + (T.deleteEdges {s(u, v)}).Reachable v i → + (GM10.treeDecompSide T τ s(u, v) u, GM10.treeDecompSide T τ s(u, v) v) ∈ 𝒯 i + /-- (2.6.2) For `i ≠ j`, the edge on the path in `T` between `i` and `j` making separations of + minimum `λ`-order makes the `(𝒯 i, 𝒯 j)`- and `(𝒯 j, 𝒯 i)`-distinctions. -/ + path_min_isDistinction : ∀ ⦃i j : Fin n⦄, i ≠ j → + ∃ e ∈ T.edgeSet, + (∀ p : T.Walk i j, p.IsPath → e ∈ p.edges) ∧ + (∀ e' ∈ T.edgeSet, (∀ p : T.Walk i j, p.IsPath → e' ∈ p.edges) → + ∀ A B A' B', GM10.MakesSeparation T τ e A B → GM10.MakesSeparation T τ e' A' B' → + lam (A, B) ≤ lam (A', B')) ∧ + ∃ A B, GM10.MakesSeparation T τ e A B ∧ + GM10.IsDistinction lam (𝒯 i) (𝒯 j) A B ∧ GM10.IsDistinction lam (𝒯 j) (𝒯 i) B A + +/-- An unrooted tree-decomposition `(T, τ)` of a hypergraph `G` is rotund in the sense of +Graph Minors XVIII (Section 2, page 81; contrast with `GM04.IsRotund` for rooted trees, which +Section 6, page 102 relates to this notion): +"A tree-decomposition $(T, \tau)$ of a hypergraph $G$ is *rotund* if for every two edges +$f_1, f_2 \in E(T)$, making separations $(A_1, B_1)$ and $(A_2, B_2)$ of the same order $k$, +where $B_2 \subseteq A_1$ and $B_1 \subseteq A_2$, the following holds: if there is a +separation $(H_1, H_2)$ of $G$ with $B_1 \subseteq H_1$ and $B_2 \subseteq H_2$ of order $< +k$, then some edge of $F$ makes a separation of order $< k$, where $F$ is the path of $T$ +with first and last edges $f_1, f_2$." + +In a tree `T`, a simple path `p : T.Walk t₁ t₂` (`p.IsPath`) has first edge `f₁` and last edge `f₂` +if and only if `t₁ ∈ f₁`, `t₂ ∈ f₂`, `f₁ ∈ p.edges`, and `f₂ ∈ p.edges`. -/ +def IsRotund [Fintype ι] (G : Hypergraph α β) (T : SimpleGraph ι) + (τ : ι → Hypergraph α β) : Prop := + ∀ ⦃t₁ t₂ : ι⦄ (p : T.Walk t₁ t₂), p.IsPath → + ∀ ⦃f₁ f₂ : Sym2 ι⦄, t₁ ∈ f₁ → t₂ ∈ f₂ → f₁ ∈ p.edges → f₂ ∈ p.edges → + ∀ ⦃A₁ B₁ A₂ B₂ : Hypergraph α β⦄, + GM10.MakesSeparation T τ f₁ A₁ B₁ → + GM10.MakesSeparation T τ f₂ A₂ B₂ → + B₂ ≤ A₁ → B₁ ≤ A₂ → + separationOrder A₁ B₁ = separationOrder A₂ B₂ → + (∃ H₁ H₂ : Hypergraph α β, G.IsSeparation H₁ H₂ ∧ B₁ ≤ H₁ ∧ B₂ ≤ H₂ ∧ + separationOrder H₁ H₂ < separationOrder A₁ B₁) → + ∃ e ∈ p.edges, ∃ C D : Hypergraph α β, + GM10.MakesSeparation T τ e C D ∧ separationOrder C D < separationOrder A₁ B₁ + +/-! ## Section 3: Tree-Width of a Location -/ + +/-- A separation `(A, B) ∈ 𝒯` is linked to a tangle `𝒯` +(Graph Minors XVIII, Section 3, page 82; distinct from `GM04.IsLinked` for edge sets in rooted +tree-decompositions): +"If $\mathscr{T}$ is a tangle in a hypergraph $G$, we say that $(A, B) \in \mathscr{T}$ is +*linked to* $\mathscr{T}$ if there is no $(A', B') \in \mathscr{T}$ of smaller order with +$A \subseteq A'$ and $B' \subseteq B$." -/ +def IsLinkedTo (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (A B : Hypergraph α β) : Prop := + (A, B) ∈ 𝒯 ∧ ∀ ⦃A' B' : Hypergraph α β⦄, (A', B') ∈ 𝒯 → + A ≤ A' → B' ≤ B → separationOrder A B ≤ separationOrder A' B' + +/-- The order of a location `ℒ` in a hypergraph `G` (Graph Minors XVIII, Section 3, page 83): +"Let $\mathscr{L}$ be a location in $G$. The *order* of $\mathscr{L}$ is the maximum order of +the members of $\mathscr{L}$ (or $0$ if $\mathscr{L} = \emptyset$)." -/ +noncomputable def locationOrder (ℒ : Set (Hypergraph α β × Hypergraph α β)) : ℕ := + sSup ((fun p : Hypergraph α β × Hypergraph α β ↦ separationOrder p.1 p.2) '' ℒ) + +/-- The heart `H` of a location `ℒ` in a hypergraph `G` (Graph Minors XVIII, Section 3, page 83): +"For each $(A, B) \in \mathscr{L}$ let $e(A, B)$ be a new element, and let $H$ be the +hypergraph with $$V(H) = V(M(G, \mathscr{L})),$$ $$E(H) = E(M(G, \mathscr{L})) \cup \{e(A, +B) \colon (A, B) \in \mathscr{L}\},$$ where for $e \in E(M(\mathscr{L}))$ its ends are as in +$G$, and for $(A, B) \in \mathscr{L}$ the ends of $e(A, B)$ are the elements of $V(A \cap +B)$. This is a hypergraph by 2.3.2, and we call it the *heart* of $\mathscr{L}$." + +Here the edge type of the heart is `β ⊕ (Hypergraph α β × Hypergraph α β)`, with `Sum.inl e` +for `e ∈ E(M(G, ℒ))` and `Sum.inr (A, B)` for `(A, B) ∈ ℒ`. To ensure that `locationHeart G ℒ` is a +well-defined finite hypergraph for any set `ℒ` without requiring `IsLocation G ℒ` as a dependent +argument, new edges are restricted to separations `(A, B) ∈ ℒ` of `G` satisfying +`V(A ∩ B) ⊆ V(M(G, ℒ))` (which holds for all `(A, B) ∈ ℒ` whenever `IsLocation G ℒ`, by 2.3.2). -/ +def locationHeart (G : Hypergraph α β) (ℒ : Set (Hypergraph α β × Hypergraph α β)) : + Hypergraph α (β ⊕ (Hypergraph α β × Hypergraph α β)) where + vertexSet := (GM10.locationCore G ℒ).vertexSet + edgeSet := (Sum.inl '' (GM10.locationCore G ℒ).edgeSet) ∪ + (Sum.inr '' {p ∈ ℒ | G.IsSeparation p.1 p.2 ∧ + (p.1 ∩ p.2).vertexSet ⊆ (GM10.locationCore G ℒ).vertexSet}) + Inc e v := + match e with + | Sum.inl e₀ => (GM10.locationCore G ℒ).Inc e₀ v + | Sum.inr p => p ∈ ℒ ∧ G.IsSeparation p.1 p.2 ∧ + (p.1 ∩ p.2).vertexSet ⊆ (GM10.locationCore G ℒ).vertexSet ∧ v ∈ (p.1 ∩ p.2).vertexSet + vertex_mem_of_inc e v h := by + cases e with + | inl e₀ => exact (GM10.locationCore G ℒ).vertex_mem_of_inc h + | inr p => exact h.2.2.1 h.2.2.2 + edge_mem_of_inc e v h := by + cases e with + | inl e₀ => exact Or.inl ⟨e₀, (GM10.locationCore G ℒ).edge_mem_of_inc h, rfl⟩ + | inr p => exact Or.inr ⟨p, ⟨h.1, h.2.1, h.2.2.1⟩, rfl⟩ + vertexSet_finite := (GM10.locationCore G ℒ).vertexSet_finite + edgeSet_finite := by + refine Set.Finite.union ((GM10.locationCore G ℒ).edgeSet_finite.image Sum.inl) ?_ + refine Set.Finite.image Sum.inr ?_ + have hsub_fin : {H : Hypergraph α β | H ≤ G}.Finite := by + let f : Hypergraph α β → Set α × Set β := fun H ↦ (H.vertexSet, H.edgeSet) + have hinj : Set.InjOn f {H : Hypergraph α β | H ≤ G} := by + rintro H₁ h₁ H₂ h₂ hfeq + have hV : H₁.vertexSet = H₂.vertexSet := congrArg Prod.fst hfeq + have hE : H₁.edgeSet = H₂.edgeSet := congrArg Prod.snd hfeq + apply Hypergraph.ext hV hE + ext e v + constructor <;> intro hinc + · have he₁ : e ∈ H₁.edgeSet := H₁.edge_mem_of_inc hinc + have he₂ : e ∈ H₂.edgeSet := hE ▸ he₁ + have hG : G.Inc e v := (Set.ext_iff.mp (h₁.ends_eq e he₁) v).mpr hinc + exact (Set.ext_iff.mp (h₂.ends_eq e he₂) v).mp hG + · have he₂ : e ∈ H₂.edgeSet := H₂.edge_mem_of_inc hinc + have he₁ : e ∈ H₁.edgeSet := hE.symm ▸ he₂ + have hG : G.Inc e v := (Set.ext_iff.mp (h₂.ends_eq e he₂) v).mpr hinc + exact (Set.ext_iff.mp (h₁.ends_eq e he₁) v).mp hG + have hprod_fin : (G.vertexSet.powerset ×ˢ G.edgeSet.powerset).Finite := + G.vertexSet_finite.powerset.prod G.edgeSet_finite.powerset + have himg_sub : f '' {H : Hypergraph α β | H ≤ G} ⊆ + G.vertexSet.powerset ×ˢ G.edgeSet.powerset := by + rintro _ ⟨H, hH, rfl⟩ + exact ⟨hH.vertexSet_subset, hH.edgeSet_subset⟩ + exact Set.Finite.of_finite_image (hprod_fin.subset himg_sub) hinj + refine (hsub_fin.prod hsub_fin).subset ?_ + rintro ⟨A, B⟩ ⟨_, hsep, _⟩ + exact ⟨hsep.left_le, hsep.right_le⟩ + +/-- The tree-width of a location `ℒ` in a hypergraph `G` (Graph Minors XVIII, Section 3, page 83): +"We define the *tree-width* of $\mathscr{L}$ to be the tree-width of $H$ ... ." -/ +noncomputable def locationTreeWidth (G : Hypergraph α β) + (ℒ : Set (Hypergraph α β × Hypergraph α β)) : ℤ := + GM10.treeWidth (locationHeart G ℒ) + +/-! ## Section 4: Isolating Locations -/ + +/-- A location `ℒ` in `G` `θ`-isolates a tangle `𝒯` with respect to a tie-breaker `λ` +(Graph Minors XVIII, Section 4, page 85): +"Let $\mathcal{T}$ be a tangle in a hypergraph $G$, and let $\lambda$ be a tie-breaker in +$G$. A location $\mathcal{L}$ is said to $\theta$-isolate $\mathcal{T}$ if $\mathcal{L} +\subseteq \mathcal{T}$ and has order $<\theta$, and for every $(C, D) \in \mathcal{L}$ and +every tangle $\mathcal{T}'$ in $G$ of order $\ge \theta$ with $(D, C) \in \mathcal{T}'$, if +$(A, B)$ is the $(\mathcal{T}, \mathcal{T}')$-distinction then $A \subseteq C$ and $D +\subseteq B$." -/ +structure Isolates {Λ : Type*} [LE Λ] (G : Hypergraph α β) + (lam : Hypergraph α β × Hypergraph α β → Λ) (θ : ℕ) + (𝒯 ℒ : Set (Hypergraph α β × Hypergraph α β)) : Prop where + /-- `ℒ` is a location in `G`. -/ + isLocation : GM10.IsLocation G ℒ + /-- `ℒ ⊆ 𝒯`. -/ + subset : ℒ ⊆ 𝒯 + /-- `ℒ` has order `< θ` (so `1 ≤ θ` and every `(C, D) ∈ ℒ` has order `< θ`). -/ + locationOrder_lt : locationOrder ℒ < θ + /-- Every `(C, D) ∈ ℒ` has order `< θ`. -/ + order_lt : ∀ ⦃C D : Hypergraph α β⦄, (C, D) ∈ ℒ → separationOrder C D < θ + /-- For every `(C, D) ∈ ℒ` and every tangle `𝒯'` of order `≥ θ` with `(D, C) ∈ 𝒯'`, the + `(𝒯, 𝒯')`-distinction `(A, B)` satisfies `A ⊆ C` and `D ⊆ B`. -/ + distinction_le : ∀ ⦃C D : Hypergraph α β⦄, (C, D) ∈ ℒ → + ∀ ⦃θ' : ℕ⦄ ⦃𝒯' : Set (Hypergraph α β × Hypergraph α β)⦄, + GM10.IsTangle G θ' 𝒯' → θ ≤ θ' → (D, C) ∈ 𝒯' → + ∀ ⦃A B : Hypergraph α β⦄, GM10.IsDistinction lam 𝒯 𝒯' A B → + A ≤ C ∧ D ≤ B + +/-- A location `ℒ*` is an enlargement of a location `ℒ` in `G` via a partition `part` indexed by +`p ∈ ℒ` (Graph Minors XVIII, Section 4, pages 86–87; distinct from `GM10.IsEnlargement` of +designs): +"Let $\mathcal{L}, \mathcal{L}^*$ be locations in a hypergraph $G$, and let $\mathcal{L} = +\{(C_1, D_1), \dots, (C_k, D_k)\}$. We say that $\mathcal{L}^*$ is an *enlargement* of +$\mathcal{L}$ if there exist $\mathcal{L}_1, \dots, \mathcal{L}_k \subseteq \mathcal{L}^*$, +mutually disjoint (possibly empty) and with union $\mathcal{L}^*$, such that for $1 \le h +\le k$, every ... $(A, B) \in \mathcal{L}_h$ satisfies $A \subseteq C_h$ and $D_h \subseteq B$." -/ +structure IsLocationEnlargementVia (G : Hypergraph α β) + (ℒ ℒ_star : Set (Hypergraph α β × Hypergraph α β)) + (part : Hypergraph α β × Hypergraph α β → Set (Hypergraph α β × Hypergraph α β)) : Prop where + /-- `ℒ` is a location in `G`. -/ + isLocation_left : GM10.IsLocation G ℒ + /-- `ℒ*` is a location in `G`. -/ + isLocation_right : GM10.IsLocation G ℒ_star + /-- Each `part p` (`p ∈ ℒ`) is a subset of `ℒ*`. -/ + part_subset : ∀ ⦃p⦄, p ∈ ℒ → part p ⊆ ℒ_star + /-- The sets `part p` (`p ∈ ℒ`) are mutually disjoint. -/ + part_disjoint : ∀ ⦃p₁⦄, p₁ ∈ ℒ → ∀ ⦃p₂⦄, p₂ ∈ ℒ → p₁ ≠ p₂ → Disjoint (part p₁) (part p₂) + /-- The union of `part p` over `p ∈ ℒ` equals `ℒ*`. -/ + biUnion_eq : (⋃ p ∈ ℒ, part p) = ℒ_star + /-- For each `p = (C_h, D_h) ∈ ℒ` and `(A, B) ∈ part p`, `A ⊆ C_h` and `D_h ⊆ B`. -/ + le_of_mem_part : ∀ ⦃p⦄, p ∈ ℒ → ∀ ⦃q⦄, q ∈ part p → q.1 ≤ p.1 ∧ p.2 ≤ q.2 + +/-- A location `ℒ*` is an enlargement of a location `ℒ` in `G` +(Graph Minors XVIII, Section 4, pages 86–87). -/ +def IsLocationEnlargement (G : Hypergraph α β) + (ℒ ℒ_star : Set (Hypergraph α β × Hypergraph α β)) : Prop := + ∃ part, IsLocationEnlargementVia G ℒ ℒ_star part + +/-- A location `ℒ*` is an enlargement of a location `ℒ` in `G` by tree-width `≤ w` +(Graph Minors XVIII, Section 4, page 87): +"If in addition $w \ge 0$ and $\mathcal{L}_h \cup \{(D_h, C_h)\}$ has tree-width $\le w$ for +$1 \le h \le k$, we say that $\mathcal{L}^*$ is an *enlargement of $\mathcal{L}$ by +tree-width $\le w$." +Here `w : ℚ` allows both rational bounds such as `(9 / 4 : ℚ) * θ` in (4.3) and integer bounds +`(w : ℚ)` in (4.4), (5.5), and (6.7). -/ +def IsLocationEnlargementByTreeWidth (G : Hypergraph α β) + (ℒ ℒ_star : Set (Hypergraph α β × Hypergraph α β)) (w : ℚ) : Prop := + 0 ≤ w ∧ ∃ part, IsLocationEnlargementVia G ℒ ℒ_star part ∧ + ∀ ⦃p⦄, p ∈ ℒ → (locationTreeWidth G (part p ∪ {(p.2, p.1)}) : ℚ) ≤ w + +/-! ## Section 5: Patchworks -/ + +/-- A patchwork `P = (G, μ, Δ)` without edge labels (Graph Minors XVIII, Section 5, pages 89–90), +represented as a `GM04.Patchwork Unit α β`. -/ +abbrev UnlabeledPatchwork (α : Type u) (β : Type v) := GM04.Patchwork Unit α β + +/-- A partial `Ω`-patchwork `P = (G, μ, Δ, φ)` (Graph Minors XVIII, Section 5, page 90): +"If $\Omega$ is a quasi-order, a *partial $\Omega$-patchwork* is a quadruple $(G, \mu, +\Delta, \phi)$, where $(G, \mu, \Delta)$ is a patchwork and $\phi$ is a function from a +subset $dom(\phi)$ of $E(G)$ into $E(\Omega)$. It is an *$\Omega$-patchwork* if $dom(\phi) = +E(G)$. It is *robust* if $(G, \mu, \Delta)$ is robust." + +Represented as `GM04.Patchwork (WithBot Ω) α β`, where `P.φ e = ⊥` for `e ∉ dom(φ)` and +`P.φ e = ↑(φ(e))` for `e ∈ dom(φ)`. Under the standard `Preorder (WithBot Ω)`, the condition +`∀ e ∈ E(G), P.φ e ≤ P'.φ (ηe e)` in `GM04.IsExpansion` is equivalent to: for every +`e ∈ dom(φ)`, `ηe e ∈ dom(φ')` and `φ(e) ≤ φ'(ηe e)` (Section 5, page 90). -/ +abbrev PartialPatchwork (Ω : Type w) (α : Type u) (β : Type v) := + GM04.Patchwork (WithBot Ω) α β + +/-- The domain `dom(φ) ⊆ E(G)` of a partial `Ω`-patchwork `P` +(Graph Minors XVIII, Section 5, page 90). -/ +def PartialPatchwork.domφ (P : PartialPatchwork Ω α β) : Set β := + {e ∈ P.G.edgeSet | P.φ e ≠ ⊥} + +/-- A partial `Ω`-patchwork `P` is a (total) `Ω`-patchwork if `dom(φ) = E(G)` +(Graph Minors XVIII, Section 5, page 90). -/ +def PartialPatchwork.IsTotal (P : PartialPatchwork Ω α β) : Prop := + ∀ e ∈ P.G.edgeSet, P.φ e ≠ ⊥ + +/-- Embeds a total `Ω`-patchwork `P : GM04.Patchwork Ω α β` as a `PartialPatchwork Ω α β` with +`dom(φ) = E(G)`. -/ +def PartialPatchwork.ofPatchwork (P : GM04.Patchwork Ω α β) : PartialPatchwork Ω α β where + G := P.G + dom := P.dom + μ := P.μ + Δ := P.Δ + φ e := (P.φ e : WithBot Ω) + dom_subset := P.dom_subset + μ_nodup := P.μ_nodup + μ_set := P.μ_set + Δ_verts := P.Δ_verts + Δ_free := P.Δ_free + +/-- Forgets the edge-labelling `φ` of a patchwork `P : GM04.Patchwork Ω α β`, yielding the +underlying unlabeled patchwork `(G, μ, Δ) : UnlabeledPatchwork α β`. -/ +def _root_.GraphMinor.GM04.Patchwork.toUnlabeled (P : GM04.Patchwork Ω α β) : + UnlabeledPatchwork α β where + G := P.G + dom := P.dom + μ := P.μ + Δ := P.Δ + φ _ := () + dom_subset := P.dom_subset + μ_nodup := P.μ_nodup + μ_set := P.μ_set + Δ_verts := P.Δ_verts + Δ_free := P.Δ_free + +/-- Two vertices `x, y` of a subgraph `H` are connected in `H` if they belong to the same +component of `H` (Graph Minors XVIII, Section 5, page 91): +"Two vertices of a graph $H$ are *connected in $H$* if they belong to the same component of $H$." -/ +def ConnectedIn (H : (⊤ : SimpleGraph α).Subgraph) (x y : α) : Prop := + ∃ D, GM04.IsComponent H D ∧ x ∈ D.verts ∧ y ∈ D.verts + +/-- A grouping `K` is feasible in a patchwork `P` (Graph Minors XVIII, Section 5, page 92): +"Let $P = (G, \mu, \Delta)$ be a patchwork. A grouping $K$ is *feasible* in $P$ if $V(K) = +\bar{\pi}(G)$ and there is a realization $H$ of $P$ such that for distinct $x, y \in V(K)$, +$x$ and $y$ are connected in $H$ if and only if they are adjacent in $K$. A grouping is +*feasible* in a partial $\Omega$-patchwork $(G, \mu, \Delta, \phi)$ if it is feasible in +$(G, \mu, \Delta)$." -/ +def IsFeasibleGrouping (P : GM04.Patchwork Ω α β) (K : (⊤ : SimpleGraph α).Subgraph) : Prop := + GM04.IsGrouping P.G.rootSet K ∧ K.verts = P.G.rootSet ∧ + ∃ H, P.IsRealization H ∧ ∀ x ∈ P.G.rootSet, ∀ y ∈ P.G.rootSet, x ≠ y → + (ConnectedIn H x y ↔ K.Adj x y) + +/-- The patch `gr(P)` of all groupings feasible in `P`, with vertex set `πBar(G)` +(Graph Minors XVIII, Section 5, page 92): +"The set of all groupings feasible in $P$ will be denoted by $gr(P)$." -/ +def feasibleGroupings (P : GM04.Patchwork Ω α β) : GM04.Patch α where + verts := P.G.rootSet + groupings := {K | IsFeasibleGrouping P K} + isGrouping _ hK := hK.1 + verts_eq _ hK := hK.2.1 + +/-- A rooted subhypergraph `A ⊆ G` is complemented in `G` +(Graph Minors XVIII, Section 5, page 92): +"Let $G$ be a rooted hypergraph. We say that $A \subseteq G$ is *complemented* if +$\bar{\pi}(A)$ contains every vertex $v \in V(A)$ such that either $v \in \bar{\pi}(G)$ or +some edge $e \in E(G) \setminus E(A)$ is incident with $v$." -/ +structure IsComplemented (G A : RootedHypergraph α β) : Prop where + /-- `A ⊆ G` (`A⁻ ⊆ G⁻`). -/ + le : A.toHypergraph ≤ G.toHypergraph + /-- Every `v ∈ V(A) ∩ πBar(G)` belongs to `πBar(A)`. -/ + roots_mem : ∀ ⦃v : α⦄, v ∈ A.vertexSet → v ∈ G.rootSet → v ∈ A.rootSet + /-- Every `v ∈ V(A)` incident in `G` with an edge `e ∈ E(G) \ E(A)` belongs to `πBar(A)`. -/ + inc_diff_mem : ∀ ⦃v : α⦄ ⦃e : β⦄, v ∈ A.vertexSet → e ∈ G.edgeSet \ A.edgeSet → + G.Inc e v → v ∈ A.rootSet + +/-- The complementary rooted hypergraph `G \ A` for a complemented rooted subhypergraph `A ⊆ G` +(Graph Minors XVIII, Section 5, pages 92–93): +"If $A$ is complemented, we define $G \setminus A \subseteq G$ to be the rooted hypergraph with +$$ +\begin{aligned} +V(G \setminus A) &= (V(G) \setminus V(A)) \cup \bar{\pi}(A), \\ +E(G \setminus A) &= E(G) \setminus E(A), \\ +\pi(G \setminus A) &= \pi(G). +\end{aligned} +$$" -/ +def complement (G A : RootedHypergraph α β) (hA : IsComplemented G A) : RootedHypergraph α β where + toHypergraph := + { vertexSet := (G.vertexSet \ A.vertexSet) ∪ A.rootSet + edgeSet := G.edgeSet \ A.edgeSet + Inc e v := e ∈ G.edgeSet \ A.edgeSet ∧ G.Inc e v + vertex_mem_of_inc e v h := by + by_cases hvA : v ∈ A.vertexSet + · exact Or.inr (hA.inc_diff_mem hvA h.1 h.2) + · exact Or.inl ⟨G.vertex_mem_of_inc h.2, hvA⟩ + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := (G.vertexSet_finite.sdiff).union + (A.vertexSet_finite.subset A.roots_subset) + edgeSet_finite := G.edgeSet_finite.sdiff } + roots := G.roots + roots_nodup := G.roots_nodup + roots_subset v hv := by + by_cases hvA : v ∈ A.vertexSet + · exact Or.inr (hA.roots_mem hvA hv) + · exact Or.inl ⟨G.roots_subset v hv, hvA⟩ + +/-- The underlying hypergraph `(G \ A)⁻` of the complement `G \ A`, defined unconditionally for any +rooted hypergraphs `G, A` (when `IsComplemented G A`, this equals `(complement G A +hA).toHypergraph`). -/ +def complementHypergraph (G A : RootedHypergraph α β) : Hypergraph α β where + vertexSet := (G.vertexSet \ A.vertexSet) ∪ (G.vertexSet ∩ A.rootSet) + edgeSet := G.edgeSet \ A.edgeSet + Inc e v := e ∈ G.edgeSet \ A.edgeSet ∧ G.Inc e v ∧ + v ∈ (G.vertexSet \ A.vertexSet) ∪ (G.vertexSet ∩ A.rootSet) + vertex_mem_of_inc _ _ h := h.2.2 + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := (G.vertexSet_finite.sdiff).union (G.vertexSet_finite.inter_of_left _) + edgeSet_finite := G.edgeSet_finite.sdiff + +/-- A rooted location `ℒ` in a rooted hypergraph `G` (Graph Minors XVIII, Section 5, page 93): +"A *rooted location* $\mathscr{L}$ in a rooted hypergraph $G$ is a set $\mathscr{L}$ of +complemented rooted hypergraphs $A$ with $A \subseteq G$ such that $A_1 \subseteq G +\setminus A_2$ for all distinct $A_1, A_2 \in \mathscr{L}$." -/ +structure IsRootedLocation (G : RootedHypergraph α β) + (ℒ : Set (RootedHypergraph α β)) : Prop where + /-- Every `A ∈ ℒ` is complemented in `G`. -/ + isComplemented : ∀ ⦃A : RootedHypergraph α β⦄, A ∈ ℒ → IsComplemented G A + /-- For distinct `A₁, A₂ ∈ ℒ`, `A₁ ⊆ G \ A₂`. -/ + le_complement : ∀ ⦃A₁ : RootedHypergraph α β⦄, A₁ ∈ ℒ → + ∀ ⦃A₂ : RootedHypergraph α β⦄ (hA₂ : A₂ ∈ ℒ), A₁ ≠ A₂ → + A₁.toHypergraph ≤ (complement G A₂ (isComplemented hA₂)).toHypergraph + +/-- The unrooted location `ℒ⁻ = {(A⁻, (G \ A)⁻) : A ∈ ℒ}` in `G⁻` associated to a rooted location +`ℒ` in `G` (Graph Minors XVIII, Section 5, page 93): +"If $\mathscr{L}$ is a rooted location in $G$ then $\{(A^-, (G \setminus A)^-) \colon A \in +\mathscr{L}\}$ is a location in $G^-$ which we denote by $\mathscr{L}^-$." -/ +def rootedLocationToLocation (G : RootedHypergraph α β) (ℒ : Set (RootedHypergraph α β)) : + Set (Hypergraph α β × Hypergraph α β) := + (fun A : RootedHypergraph α β ↦ (A.toHypergraph, complementHypergraph G A)) '' ℒ + +/-- The hypergraph `M(G, ℒ) = M(G⁻, ℒ⁻)` for a rooted location `ℒ` in `G` +(Graph Minors XVIII, Section 5, page 93): +"We define `M(G, ℒ) = M(G⁻, ℒ⁻)`." -/ +def rootedLocationCore (G : RootedHypergraph α β) (ℒ : Set (RootedHypergraph α β)) : + Hypergraph α β := + GM10.locationCore G.toHypergraph (rootedLocationToLocation G ℒ) + +/-- A partial `Ω`-place `(P, ℒ)` (Graph Minors XVIII, Section 5, page 94): +"Now let $P = (G, \mu, \Delta, \phi)$ be a partial $\Omega$-patchwork, and let $\mathscr{L}$ +be a rooted location in $G$. We call $(P, \mathscr{L})$ a *partial $\Omega$-place*." -/ +def IsPartialPlace (P : PartialPatchwork Ω α β) (ℒ : Set (RootedHypergraph α β)) : Prop := + IsRootedLocation P.G ℒ + +/-- An `Ω`-place `(P, ℒ)` (Graph Minors XVIII, Section 5, page 94): +"If $dom(\phi) = E(G)$ we call $(P, \mathscr{L})$ an *$\Omega$-place*." -/ +def IsOmegaPlace (P : PartialPatchwork Ω α β) (ℒ : Set (RootedHypergraph α β)) : Prop := + P.IsTotal ∧ IsRootedLocation P.G ℒ + +/-- `P'` is the heart `P | ℒ` of a patchwork or partial `Ω`-patchwork `(P, ℒ)` using new elements +`e : RootedHypergraph α β → β` (Graph Minors XVIII, Section 5, pages 93–94): +"Let $P = (G, \mu, \Delta)$ be a patchwork and let $\mathscr{L}$ be a rooted location in $G$. For +each $A \in \mathscr{L}$ let $e(A)$ be a new element, and let $G'$ be the rooted hypergraph with +$$\begin{aligned} +V(G') &= V(M(G, \mathscr{L})), \\ +E(G') &= E(M(G, \mathscr{L})) \cup \{e(A) \colon A \in \mathscr{L}\}, \\ +\pi(G') &= \pi(G), +\end{aligned}$$ +where for $e \in E(M(G, \mathscr{L}))$ its ends are as in $G^-$, and for $A \in \mathscr{L}$ the +ends of $e(A)$ are the vertices in $\bar{\pi}(A)$. We define the *heart* $P | \mathscr{L}$ of +$(P, \mathscr{L})$ to be the patchwork $(G', \mu', \Delta')$ such that $\mu'(e(A)) = \pi(A)$ and +$\Delta'(e(A)) = gr(P | A)$ for all $A \in \mathscr{L}$ and $\mu'(e) \equiv \mu(e)$ and +$\Delta'(e) = \Delta(e)$ for all $e \in E(M(G, \mathscr{L}))$." +"For $e \in E(M(G, \mathscr{L})) \cap dom(\phi)$ let $\phi'(e) = \phi(e)$, and let $(G', +\mu', \Delta')$ be the heart of $((G, \mu, \Delta), \mathscr{L})$; then $(G', \mu', \Delta', +\phi')$ is a partial $\Omega$-patchwork which we call the *heart* (again denoted by $P | +\mathscr{L}$) of $(P, \mathscr{L})$." -/ +structure IsPlaceHeart (P : PartialPatchwork Ω α β) (ℒ : Set (RootedHypergraph α β)) + (newEdge : RootedHypergraph α β → β) (P' : PartialPatchwork Ω α β) : Prop where + /-- `ℒ` is a rooted location in `P.G`. -/ + isRootedLocation : IsRootedLocation P.G ℒ + /-- The new elements `newEdge A` (`A ∈ ℒ`) are distinct. -/ + injOn_newEdge : Set.InjOn newEdge ℒ + /-- None of the new elements `newEdge A` (`A ∈ ℒ`) belongs to `E(M(G, ℒ))`. -/ + newEdge_notMem_core : ∀ ⦃A⦄, A ∈ ℒ → newEdge A ∉ (rootedLocationCore P.G ℒ).edgeSet + /-- `V(G') = V(M(G, ℒ))`. -/ + vertexSet_eq : P'.G.vertexSet = (rootedLocationCore P.G ℒ).vertexSet + /-- `E(G') = E(M(G, ℒ)) ∪ {e(A) : A ∈ ℒ}`. -/ + edgeSet_eq : P'.G.edgeSet = (rootedLocationCore P.G ℒ).edgeSet ∪ (newEdge '' ℒ) + /-- `π(G') = π(G)`. -/ + roots_eq : P'.G.roots = P.G.roots + /-- For `f ∈ E(M(G, ℒ))`, the ends of `f` in `G'` are as in `G`. -/ + ends_core : ∀ ⦃f⦄, f ∈ (rootedLocationCore P.G ℒ).edgeSet → P'.G.ends f = P.G.ends f + /-- For `A ∈ ℒ`, the ends of `e(A)` in `G'` are `πBar(A)`. -/ + ends_newEdge : ∀ ⦃A⦄, A ∈ ℒ → P'.G.ends (newEdge A) = A.rootSet + /-- `dom(μ') = (E(M(G, ℒ)) ∩ dom(μ)) ∪ {e(A) : A ∈ ℒ}`. -/ + dom_eq : P'.dom = ((rootedLocationCore P.G ℒ).edgeSet ∩ P.dom) ∪ (newEdge '' ℒ) + /-- For `f ∈ E(M(G, ℒ)) ∩ dom(μ)`, `μ'(f) = μ(f)`. -/ + μ_core : ∀ ⦃f⦄, f ∈ (rootedLocationCore P.G ℒ).edgeSet ∩ P.dom → P'.μ f = P.μ f + /-- For `A ∈ ℒ`, `μ'(e(A)) = π(A)`. -/ + μ_newEdge : ∀ ⦃A⦄, A ∈ ℒ → P'.μ (newEdge A) = A.roots + /-- For `f ∈ E(M(G, ℒ))`, `Δ'(f) = Δ(f)`. -/ + Δ_core : ∀ ⦃f⦄, f ∈ (rootedLocationCore P.G ℒ).edgeSet → P'.Δ f = P.Δ f + /-- For `A ∈ ℒ`, `Δ'(e(A)) = gr(P | A)`. -/ + Δ_newEdge : ∀ ⦃A⦄, A ∈ ℒ → + P'.Δ (newEdge A) = feasibleGroupings (P.restrict A) + /-- For `f ∈ E(M(G, ℒ))`, `φ'(f) ≡ φ(f)`. -/ + φ_core : ∀ ⦃f⦄, f ∈ (rootedLocationCore P.G ℒ).edgeSet → P'.φ f = P.φ f + /-- For `A ∈ ℒ`, `e(A) ∉ dom(φ')` (`φ'(e(A)) = ⊥`). -/ + φ_newEdge : ∀ ⦃A⦄, A ∈ ℒ → P'.φ (newEdge A) = ⊥ + +/-- `P'` is a heart of the partial `Ω`-place `(P, ℒ)` (for some choice of new elements `e(A)`). -/ +def HasPlaceHeart (P : PartialPatchwork Ω α β) (ℒ : Set (RootedHypergraph α β)) + (P' : PartialPatchwork Ω α β) : Prop := + ∃ newEdge : RootedHypergraph α β → β, IsPlaceHeart P ℒ newEdge P' + +/-- `P'` is the heart `P | ℒ` of an unlabeled patchwork `P = (G, μ, Δ)` and rooted location `ℒ` +using new elements `newEdge` (Graph Minors XVIII, Section 5, page 93). -/ +structure IsPatchworkHeart (P : UnlabeledPatchwork α β) (ℒ : Set (RootedHypergraph α β)) + (newEdge : RootedHypergraph α β → β) (P' : UnlabeledPatchwork α β) : Prop where + /-- `ℒ` is a rooted location in `P.G`. -/ + isRootedLocation : IsRootedLocation P.G ℒ + /-- The new elements `newEdge A` (`A ∈ ℒ`) are distinct. -/ + injOn_newEdge : Set.InjOn newEdge ℒ + /-- None of the new elements `newEdge A` (`A ∈ ℒ`) belongs to `E(M(G, ℒ))`. -/ + newEdge_notMem_core : ∀ ⦃A⦄, A ∈ ℒ → newEdge A ∉ (rootedLocationCore P.G ℒ).edgeSet + /-- `V(G') = V(M(G, ℒ))`. -/ + vertexSet_eq : P'.G.vertexSet = (rootedLocationCore P.G ℒ).vertexSet + /-- `E(G') = E(M(G, ℒ)) ∪ {e(A) : A ∈ ℒ}`. -/ + edgeSet_eq : P'.G.edgeSet = (rootedLocationCore P.G ℒ).edgeSet ∪ (newEdge '' ℒ) + /-- `π(G') = π(G)`. -/ + roots_eq : P'.G.roots = P.G.roots + /-- For `f ∈ E(M(G, ℒ))`, the ends of `f` in `G'` are as in `G`. -/ + ends_core : ∀ ⦃f⦄, f ∈ (rootedLocationCore P.G ℒ).edgeSet → P'.G.ends f = P.G.ends f + /-- For `A ∈ ℒ`, the ends of `e(A)` in `G'` are `πBar(A)`. -/ + ends_newEdge : ∀ ⦃A⦄, A ∈ ℒ → P'.G.ends (newEdge A) = A.rootSet + /-- `dom(μ') = (E(M(G, ℒ)) ∩ dom(μ)) ∪ {e(A) : A ∈ ℒ}`. -/ + dom_eq : P'.dom = ((rootedLocationCore P.G ℒ).edgeSet ∩ P.dom) ∪ (newEdge '' ℒ) + /-- For `f ∈ E(M(G, ℒ)) ∩ dom(μ)`, `μ'(f) = μ(f)`. -/ + μ_core : ∀ ⦃f⦄, f ∈ (rootedLocationCore P.G ℒ).edgeSet ∩ P.dom → P'.μ f = P.μ f + /-- For `A ∈ ℒ`, `μ'(e(A)) = π(A)`. -/ + μ_newEdge : ∀ ⦃A⦄, A ∈ ℒ → P'.μ (newEdge A) = A.roots + /-- For `f ∈ E(M(G, ℒ))`, `Δ'(f) = Δ(f)`. -/ + Δ_core : ∀ ⦃f⦄, f ∈ (rootedLocationCore P.G ℒ).edgeSet → P'.Δ f = P.Δ f + /-- For `A ∈ ℒ`, `Δ'(e(A)) = gr(P | A)`. -/ + Δ_newEdge : ∀ ⦃A⦄, A ∈ ℒ → + P'.Δ (newEdge A) = feasibleGroupings (P.restrict A) + +/-- `P'` is a heart of the unlabeled patchwork `P` and rooted location `ℒ`. -/ +def HasPatchworkHeart (P : UnlabeledPatchwork α β) (ℒ : Set (RootedHypergraph α β)) + (P' : UnlabeledPatchwork α β) : Prop := + ∃ newEdge : RootedHypergraph α β → β, IsPatchworkHeart P ℒ newEdge P' + +/-- A partial `Ω`-patchwork `P = (G, μ, Δ, φ)` has tree-width `≤ w` (where `w ≥ 0`) +(Graph Minors XVIII, Section 5, page 95): +"A partial $\Omega$-patchwork $(G, \mu, \Delta, \phi)$ has *tree-width* $\le w$, where $w \ge +0$, if there is a tree-decomposition $(T, \tau)$ of $G^-$ of width $\le w$ such that +$\bar{\pi}(G) \subseteq V(\tau(t))$ for some $t \in V(T)$." -/ +def HasPatchworkTreeWidthLE (P : GM04.Patchwork Ω α β) (w : ℕ) : Prop := + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α β) (t₀ : ι), + GM10.IsTreeDecomposition P.G.toHypergraph T τ ∧ + GM10.treeDecompWidth τ ≤ (w : ℤ) ∧ + P.G.rootSet ⊆ (τ t₀).vertexSet + +/-- A partial `Ω`-patchwork `P` is an enlargement of `P'` (`= P | ℒ`) by tree-width `≤ w` +(Graph Minors XVIII, Section 5, page 95): +"If $(P, \mathscr{L})$ is a partial $\Omega$-place, and $P|A$ has tree-width $\le w$ for all +$A \in \mathscr{L}$, we say that $P$ is an *enlargement* of $P|\mathscr{L}$ by tree-width +$\le w$." -/ +def IsPlaceEnlargementByTreeWidth (w : ℕ) (P' P : PartialPatchwork Ω α β) : Prop := + ∃ ℒ : Set (RootedHypergraph α β), + IsRootedLocation P.G ℒ ∧ + HasPlaceHeart P ℒ P' ∧ + ∀ A ∈ ℒ, HasPatchworkTreeWidthLE (P.restrict A) w + +/-! ## Section 6: Well-Behavedness -/ + +/-- The disjoint union quasi-order `Ω₁ ∪ Ω₂` on `Ω₁ ⊕ Ω₂` +(Graph Minors XVIII, Section 5, page 90): +"If $\Omega_1, \Omega_2$ are quasi-orders with $E(\Omega_1) \cap E(\Omega_2) = \emptyset$ we +denote by $\Omega_1 \cup \Omega_2$ the quasi-order $\Omega$ with $E(\Omega) = E(\Omega_1) +\cup E(\Omega_2)$ in which $x \le y$ if and only if for some $i \in \{1, 2\}$, $x, y \in +E(\Omega_i)$ and $x \le y$ in $\Omega_i$." -/ +inductive DisjointUnionLE {Ω₁ Ω₂ : Type*} [LE Ω₁] [LE Ω₂] : Ω₁ ⊕ Ω₂ → Ω₁ ⊕ Ω₂ → Prop + | inl {x y : Ω₁} : x ≤ y → DisjointUnionLE (Sum.inl x) (Sum.inl y) + | inr {x y : Ω₂} : x ≤ y → DisjointUnionLE (Sum.inr x) (Sum.inr y) + +/-- Type alias for `Ω₁ ⊕ Ω₂` equipped with the disjoint union quasi-order `Ω₁ ∪ Ω₂`. -/ +def DisjointUnionQuasiOrder (Ω₁ Ω₂ : Type*) := Ω₁ ⊕ Ω₂ + +instance {Ω₁ Ω₂ : Type*} [Preorder Ω₁] [Preorder Ω₂] : + Preorder (DisjointUnionQuasiOrder Ω₁ Ω₂) where + le := DisjointUnionLE + le_refl x := by + cases x with + | inl a => exact DisjointUnionLE.inl (le_refl a) + | inr b => exact DisjointUnionLE.inr (le_refl b) + le_trans x y z hxy hyz := by + cases hxy with + | inl h₁ => + cases hyz with + | inl h₂ => exact DisjointUnionLE.inl (le_trans h₁ h₂) + | inr h₁ => + cases hyz with + | inr h₂ => exact DisjointUnionLE.inr (le_trans h₁ h₂) + +/-- If `Ω₁` and `Ω₂` are well-quasi-orders, then their disjoint union `DisjointUnionQuasiOrder Ω₁ +Ω₂` +is a well-quasi-order. -/ +theorem wellQuasiOrderedLE_disjointUnion {Ω₁ Ω₂ : Type*} [Preorder Ω₁] [Preorder Ω₂] + (h₁ : WellQuasiOrderedLE Ω₁) (h₂ : WellQuasiOrderedLE Ω₂) : + WellQuasiOrderedLE (DisjointUnionQuasiOrder Ω₁ Ω₂) := by + refine ⟨fun f ↦ ?_⟩ + let S₁ : Set ℕ := {n | ∃ a : Ω₁, f n = Sum.inl a} + let S₂ : Set ℕ := {n | ∃ b : Ω₂, f n = Sum.inr b} + have huniv : (Set.univ : Set ℕ) ⊆ S₁ ∪ S₂ := by + intro n _ + rcases hfn : f n with a | b + · exact Or.inl ⟨a, hfn⟩ + · exact Or.inr ⟨b, hfn⟩ + have hinf : (S₁ ∪ S₂).Infinite := Set.infinite_univ.mono huniv + rcases Set.infinite_union.1 hinf with hS₁ | hS₂ + · have : Infinite S₁ := hS₁.to_subtype + let e := Nat.Subtype.orderIsoOfNat S₁ + choose g hg using fun k : ℕ ↦ (e k).2 + obtain ⟨m, n, hmn, hle⟩ := h₁.wqo g + refine ⟨(e m).1, (e n).1, e.strictMono hmn, ?_⟩ + change DisjointUnionLE (f (e m).1) (f (e n).1) + rw [hg m, hg n] + exact DisjointUnionLE.inl hle + · have : Infinite S₂ := hS₂.to_subtype + let e := Nat.Subtype.orderIsoOfNat S₂ + choose g hg using fun k : ℕ ↦ (e k).2 + obtain ⟨m, n, hmn, hle⟩ := h₂.wqo g + refine ⟨(e m).1, (e n).1, e.strictMono hmn, ?_⟩ + change DisjointUnionLE (f (e m).1) (f (e n).1) + rw [hg m, hg n] + exact DisjointUnionLE.inr hle + +/-- An `Ω'`-completion of a partial `Ω`-patchwork `P` along an order-embedding `ι : Ω ↪o Ω'` +(Graph Minors XVIII, Section 6, page 100): +"Let $P = (G, \mu, \Delta, \phi)$ be a partial $\Omega$-patchwork, and let $\Omega'$ be a +quasi-order with $\Omega \subseteq \Omega'$. By an $\Omega'$-completion of $P$ we mean an +$\Omega'$-patchwork $(G, \mu, \Delta, \phi')$ such that $\phi'(e) = \phi(e)$ for each $e \in +dom(\phi)$." -/ +structure IsCompletion {Ω' : Type*} [Preorder Ω] [Preorder Ω'] (ι : Ω ↪o Ω') + (P : PartialPatchwork Ω α β) (Q : GM04.Patchwork Ω' α β) : Prop where + /-- `Q` has the same underlying rooted hypergraph `G` as `P`. -/ + G_eq : Q.G = P.G + /-- `Q` has the same `dom(μ)` as `P`. -/ + dom_eq : Q.dom = P.dom + /-- `Q` has the same march function `μ` on `dom(μ)` as `P`. -/ + μ_eq : ∀ ⦃e⦄, e ∈ P.dom → Q.μ e = P.μ e + /-- `Q` has the same patch function `Δ` on `E(G)` as `P`. -/ + Δ_eq : ∀ ⦃e⦄, e ∈ P.G.edgeSet → Q.Δ e = P.Δ e + /-- For `e ∈ dom(φ)` with `φ(e) = ω`, `φ'(e) = ι(ω)`. -/ + φ_eq : ∀ ⦃e⦄, e ∈ P.G.edgeSet → ∀ ⦃ω : Ω⦄, P.φ e = (ω : WithBot Ω) → Q.φ e = ι ω + +/-- A class `𝒞` of partial `Ω`-patchworks is well-behaved +(Graph Minors XVIII, Section 6, page 100): +"If $\Omega$ is a well-quasi-order, a class $\mathcal{C}$ of partial $\Omega$-patchworks is +*well-behaved* if for every well-quasi-order $\Omega'$ with $\Omega \subseteq \Omega'$ and +every countable sequence $P_i'$ ($i = 1, 2, \dots$) of $\Omega'$-completions of members of +$\mathcal{C}$ there exist $j > i \ge 1$ such that $P_i'$ is simulated in $P_j'$." + +Here `Ω'` ranges over `Type (max w (max u v))`, which is closed under forming patchworks +`GM04.Patchwork Ω' α β` and disjoint unions `DisjointUnionQuasiOrder`, as used in (6.1) and (6.3). +-/ +def WellBehaved [Preorder Ω] (𝒞 : Set (PartialPatchwork Ω α β)) : Prop := + ∀ (Ω' : Type (max w (max u v))) [Preorder Ω'] (ι : Ω ↪o Ω'), + WellQuasiOrderedLE Ω' → + ∀ (Q : ℕ → GM04.Patchwork Ω' α β), + (∀ i, ∃ P ∈ 𝒞, IsCompletion ι P (Q i)) → + ∃ i j, i < j ∧ GM04.Simulated (Q i) (Q j) + +/-- A patchwork or partial `Ω`-patchwork `P = (G, μ, Δ, φ)` is rootless if `πBar(G) = ∅` +(Graph Minors XVIII, Section 6, page 100): +"A partial $\Omega$-patchwork $P = (G, \mu, \Delta, \phi)$ is *rootless* if $\bar{\pi}(G) = +\emptyset$." -/ +def IsRootless (P : GM04.Patchwork Ω α β) : Prop := + P.G.rootSet = ∅ + +/-- A partial `Ω`-patchwork `P'` is a rooting of a rootless partial `Ω`-patchwork `P` +(Graph Minors XVIII, Section 6, page 100): +"Let $P = (G, \mu, \Delta, \phi)$ be a rootless partial $\Omega$-patchwork, let $e \in +dom(\mu) \setminus dom(\phi)$, and let $P' = (G', \mu', \Delta', \phi')$ be the partial +$\Omega$-patchwork with $G'^- = G^- \setminus e$, $\pi(G') = \mu(e)$, and $P' = P|G'$. We +call $P'$ a *rooting* of $P$." -/ +def IsRooting (P P' : PartialPatchwork Ω α β) : Prop := + IsRootless P ∧ + ∃ e ∈ P.dom, P.φ e = ⊥ ∧ + P'.G.toHypergraph ≤ P.G.toHypergraph ∧ + P'.G.toHypergraph = P.G.toHypergraph.deleteEdges {e} ∧ + P'.G.roots = P.μ e ∧ + P' = P.restrict P'.G + +/-- A partial `Ω`-patchwork `P` is an enlargement of `P'` (`= P | ℒ`) by a class `𝒞` of partial +`Ω`-patchworks (Graph Minors XVIII, Section 6, page 101): +"Let $\mathcal{C}$ be a class of partial $\Omega$-patchworks, and let $(P, \mathcal{L})$ be a +partial $\Omega$-place. If $P|A \in \mathcal{C}$ for all $A \in \mathcal{L}$ we say that $P$ +is an *enlargement of* $P|\mathcal{L}$ *by* $\mathcal{C}$." -/ +def IsPlaceEnlargementByClass (𝒞 : Set (PartialPatchwork Ω α β)) + (P' P : PartialPatchwork Ω α β) : Prop := + ∃ ℒ : Set (RootedHypergraph α β), + IsRootedLocation P.G ℒ ∧ + HasPlaceHeart P ℒ P' ∧ + ∀ A ∈ ℒ, P.restrict A ∈ 𝒞 + +/-- The class of all enlargements of members of `𝒞₁` by `𝒞₂` +(Graph Minors XVIII, Section 6, (6.3), page 101). -/ +def enlargementClass (𝒞₁ 𝒞₂ : Set (PartialPatchwork Ω α β)) : + Set (PartialPatchwork Ω α β) := + {P | ∃ P' ∈ 𝒞₁, IsPlaceEnlargementByClass 𝒞₂ P' P} + +open Classical in +/-- The underlying undirected graph `T⁻` of an arborescence `T : GM04.RootedTree ι` +(Graph Minors XVIII, Section 6, page 102): +"An *arborescence* is a directed graph $T$, whose underlying graph is a tree (denoted by +$T^-$), such that every vertex is the head of at most one edge." -/ +noncomputable def arborescenceUnderlying (T : GM04.RootedTree ι) : SimpleGraph ι where + Adj u v := (u ∈ T.edges ∧ T.parent u = v) ∨ (v ∈ T.edges ∧ T.parent v = u) + symm := ⟨fun _ _ h ↦ Or.symm h⟩ + loopless := ⟨fun v h ↦ by + rcases h with ⟨hv, hp⟩ | ⟨hv, hp⟩ <;> exact T.parent_ne_self hv hp⟩ + +/-- A rooted decomposition `(T, τ)` of a partial `Ω`-patchwork `P = (G, μ, Δ, φ)` +(Graph Minors XVIII, Section 6, page 102): +"Let $P = (G, \mu, \Delta, \phi)$ be a partial $\Omega$-patchwork. A *rooted decomposition* +of $P$ is a pair $(T, \tau)$, where * $T$ is an arborescence, and for each $t \in V(T)$, +$\tau(t) \subseteq G$ is a rooted hypergraph, * $(T^-, \tau^-)$ is a tree-decomposition of +$G^-$, where $\tau^-(t) = \tau(t)^-$ for each $t \in V(T)$, * $\pi(\tau(o(T))) = \pi(G)$, * +for every subarborescence $S$ of $T$, let $\tau \times S$ denote the rooted hypergraph $H$ +with $H^- = \tau^- \times S^-$ and $\pi(H) = \pi(\tau(o(S)))$; then for every edge $f \in +E(T)$ with head $t$, $$ \bar{\pi}(\tau(t)) = V(\tau \times T^f) \cap V(\tau \times T_f), $$ +* for every directed path $F$ of $T$ with first edge $f_1$ and last edge $f_2$ such that +$f_1, f_2$ make separations under $(T^-, \tau^-)$ of the same order and no edge of $F$ makes +a separation of smaller order, $P|\tau \times T^{f_2}$ is simulated in $P|\tau \times +T^{f_1}$." -/ +structure IsRootedDecomposition [Preorder Ω] (P : GM04.Patchwork Ω α β) + (T : GM04.RootedTree ι) (τ : ι → RootedHypergraph α β) : Prop where + /-- `(T, τ)` is a rooted tree-decomposition of `G = ‖P‖` (capturing the first four conditions, by + `GM04.IsTreeDecomposition.subtreeAt_inter_rootSide_eq`). -/ + isTreeDecomposition : GM04.IsTreeDecomposition P.G T τ + /-- `E(T)` is linked in `(T, τ)` with respect to simulation of restrictions of `P`. -/ + isLinked : GM04.IsLinked + (fun H₁ H₂ ↦ GM04.Simulated (P.restrict H₁) (P.restrict H₂)) + T τ (T.edges : Set ι) + +/-- The rooted hypergraph `τ × (T, f) = ((τ × T_f)⁻, π(τ × T^f))` for an edge `f ∈ E(T)` of a +rooted decomposition `(T, τ)` (Graph Minors XVIII, Section 6, page 102): +"If $(T, \tau)$ is a rooted decomposition of a partial $\Omega$-patchwork $(G, \mu, \Delta, +\phi)$ and $f \in E(T)$, we define $\tau \times (T, f)$ to be the rooted hypergraph $((\tau +\times T_f)^-, \pi(\tau \times T^f))$." -/ +noncomputable def rootedDecompRootSide {G : RootedHypergraph α β} {T : GM04.RootedTree ι} + {τ : ι → RootedHypergraph α β} (h : GM04.IsTreeDecomposition G T τ) + {f : ι} (hf : f ∈ T.edges) : RootedHypergraph α β where + toHypergraph := (GM04.cross τ (T.rootSide f) T.root).toHypergraph + roots := (GM04.cross τ (T.subtreeAt f) f).roots + roots_nodup := (GM04.cross τ (T.subtreeAt f) f).roots_nodup + roots_subset v hv := by + have hsep := h.isSeparation_edge hf + have hv_rootSet : v ∈ (GM04.cross τ (T.subtreeAt f) f).rootSet := hv + rw [hsep.rootSet_left] at hv_rootSet + exact hv_rootSet.2 + +/-- `Q` is a piece of a rootless `Ω`-patchwork `P` at `t₀ ∈ V(T)` under a tree-decomposition +`(T, τ)` of `G⁻` (Graph Minors XVIII, Section 6, page 104): +"Let $P = (G, \mu, \Delta, \phi)$ be a rootless $\Omega$-patchwork, and let $(T, \tau)$ be a +tree-decomposition of $G^-$. If $(P, \mathcal{L})$ is an $\Omega$-place such that +$\mathcal{L}^-$ is the location of $t_0$ in $(T, \tau)$ for some $t_0 \in V(T)$, we call the +heart of $(P, \mathcal{L})$ a *piece of* $P$ (*at* $t_0$, *under* $(T, \tau)$)." -/ +def IsPiece [Fintype ι] (P : PartialPatchwork Ω α β) + (T : SimpleGraph ι) (τ : ι → Hypergraph α β) (t₀ : ι) + (Q : PartialPatchwork Ω α β) : Prop := + ∃ ℒ : Set (RootedHypergraph α β), + IsOmegaPlace P ℒ ∧ + rootedLocationToLocation P.G ℒ = vertexLocation T τ t₀ ∧ + HasPlaceHeart P ℒ Q + +/-! ## Section 7: More on Isolation -/ + +/-- A separation `(A, B) ∈ 𝒯` is `λ`-linked to a tangle `𝒯` +(Graph Minors XVIII, Section 7, page 107): +"Let $\lambda$ be a tie-breaker in a hypergraph $G$, let $\mathscr{T}$ be a tangle in $G$, +and let $(A, B) \in \mathscr{T}$. We say that $(A, B)$ is $\lambda$-*linked to* +$\mathscr{T}$ if there is no $(A', B') \in \mathscr{T}$ with smaller $\lambda$-order with $A +\subseteq A'$ and $B' \subseteq B$." -/ +def IsLambdaLinkedTo {Λ : Type*} [LE Λ] + (lam : Hypergraph α β × Hypergraph α β → Λ) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (A B : Hypergraph α β) : Prop := + (A, B) ∈ 𝒯 ∧ ∀ ⦃A' B' : Hypergraph α β⦄, (A', B') ∈ 𝒯 → + A ≤ A' → B' ≤ B → lam (A, B) ≤ lam (A', B') + +end GraphMinor.GM18 diff --git a/LeanPool/GraphMinor/GM18/Proved.lean b/LeanPool/GraphMinor/GM18/Proved.lean new file mode 100644 index 0000000000..d9af91e0f2 --- /dev/null +++ b/LeanPool/GraphMinor/GM18/Proved.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM18.Cited +public import LeanPool.GraphMinor.GM04.Main +public import LeanPool.GraphMinor.GM10.Section8 +public import LeanPool.GraphMinor.GM10.Section9 +public import LeanPool.GraphMinor.GM10.Section10 +public import LeanPool.GraphMinor.GM10.TreeWidth + +/-! +# The results that Graph Minors XVIII cites, proved + +Each statement of `GraphMinor/GM18/Cited.lean` is proved here from the proofs of Graph Minors IV and +X, +so that the sections of Graph Minors XVIII take no hypotheses. +-/ + +@[expose] public section + +namespace GraphMinor.GM18 + +open GraphMinor + +universe u v w + +/-- Graph Minors IV, (9.1) (page 252). -/ +theorem gm04Theorem91 : GM04Theorem91Statement.{u, v, w} := + fun n P hΩ hrob htw ↦ + GM04.theorem_9_1_proof.{u, v, w, 0, 0} (GM04.theorem_5_3_proof GM04.lemma_2_2 + (GM04.thomas_5_1)) menger + GM04.higman_8_3 hΩ n P hrob htw + +/-- Graph Minors X, (5.2) (page 169). -/ +theorem gm10Theorem52 : GM10.Theorem52Statement.{u, v} := GM10.theorem_5_2_statement + +/-- Graph Minors X, (8.3) (page 175). -/ +theorem gm10Theorem83 : GM10Theorem83Statement.{u, v} := + fun _ _ _ _ _ _ _ hCD hC'D hV h𝒯 hθ hmem ↦ + GM10.theorem_8_3_proof hCD hC'D hV hθ h𝒯 hmem + +/-- Graph Minors X, (9.2) (page 178). -/ +theorem gm10Theorem92 : GM10Theorem92Statement.{u, v} := fun G ↦ + let ⟨lam, hlam⟩ := GM10.theorem_9_2_proof G + ⟨_, inferInstance, lam, hlam⟩ + +/-- Graph Minors X, (10.2) (page 181). -/ +theorem gm10Theorem102 : GM10Theorem102Statement.{u, v, w} := + fun G lam θ₁ θ₂ 𝒯₁ 𝒯₂ A B hTB h₁ h₂ hdist ↦ + GM10.theorem_10_2_proof G lam θ₁ θ₂ 𝒯₁ 𝒯₂ A B hTB h₁ h₂ hdist + +/-- Graph Minors X, (10.3) (page 181). -/ +theorem gm10Theorem103 : GM10Theorem103Statement.{u, v, w} := + fun G lam θ 𝒯 hn hTB h𝒯 hdist ↦ GM10.theorem_10_3_proof G lam θ 𝒯 hn hTB h𝒯 hdist + +end GraphMinor.GM18 diff --git a/LeanPool/GraphMinor/GM18/Section2.lean b/LeanPool/GraphMinor/GM18/Section2.lean new file mode 100644 index 0000000000..c662779375 --- /dev/null +++ b/LeanPool/GraphMinor/GM18/Section2.lean @@ -0,0 +1,884 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Section11 +public import LeanPool.GraphMinor.GM18.Proved +public import LeanPool.GraphMinor.GM18.Defs +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.Thomas.Basic + +/-! +# Graph Minors XVIII, Section 2: Hypergraphs, Tangles and Tree-Decompositions + +This file formalizes Section 2 (pages 78–82) of Robertson and Seymour, +*Graph Minors. XVIII. Tree-decompositions and well-quasi-ordering*, J. Combin. Theory Ser. B 89 +(2003) 77–108: + +* `theorem_2_1` (2.1, page 79): lifting a tangle from a subhypergraph `G' ≤ G` to `G`. +* `theorem_2_2` (2.2, page 79): a hypergraph with no tangle of order `≥ θ` (`θ ≥ 1`) has + tree-width `≤ (3/2) θ`. +* `theorem_2_3` (2.3, page 80): basic properties of a location `ℒ` and `M(G, ℒ)`. +* `theorem_2_4` (2.4, page 80): the location of a vertex `t₀` in a tree-decomposition `(T, τ)` is a + location in `G`. +* `theorem_2_5` (2.5, page 80): if `ℒ` is the location of `t` in `(T, τ)`, then + `τ(t) = M(G, ℒ)`. +* `theorem_2_6` (2.6, page 81): existence of a standard decomposition relative to distinct tangles + `𝒯₁, …, 𝒯ₙ` of order `θ`. +* `theorem_2_7` (2.7, page 81): every standard decomposition is proper and rotund, and every + separation made by an edge is robust. +-/ + +public section + +namespace GraphMinor.GM18 + +open Hypergraph SimpleGraph + +universe u v w + +variable {α : Type u} {β : Type v} {ι : Type*} + +/-! ## Helper lemmas on subhypergraphs, intersections, and `biUnion` -/ + +theorem subhypergraphs_finite (G : Hypergraph α β) : + {H : Hypergraph α β | H ≤ G}.Finite := by + let f : Hypergraph α β → Set α × Set β := fun H ↦ (H.vertexSet, H.edgeSet) + have hinj : Set.InjOn f {H : Hypergraph α β | H ≤ G} := by + rintro H₁ h₁ H₂ h₂ hfeq + exact GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq h₁ h₂ + (congrArg Prod.fst hfeq) (congrArg Prod.snd hfeq) + have hprod_fin : (G.vertexSet.powerset ×ˢ G.edgeSet.powerset).Finite := + G.vertexSet_finite.powerset.prod G.edgeSet_finite.powerset + have himg_sub : f '' {H : Hypergraph α β | H ≤ G} ⊆ + G.vertexSet.powerset ×ˢ G.edgeSet.powerset := by + rintro _ ⟨H, hH, rfl⟩ + exact ⟨hH.vertexSet_subset, hH.edgeSet_subset⟩ + exact Set.Finite.of_finite_image (hprod_fin.subset himg_sub) hinj + +theorem separations_finite (G : Hypergraph α β) : + {p : Hypergraph α β × Hypergraph α β | G.IsSeparation p.1 p.2}.Finite := by + refine ((subhypergraphs_finite G).prod (subhypergraphs_finite G)).subset ?_ + rintro ⟨A, B⟩ hsep + exact ⟨hsep.left_le, hsep.right_le⟩ + +theorem inter_self_of_le {G' G : Hypergraph α β} (h : G' ≤ G) : G ∩ G' = G' := + GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq (GM10.inter_le_right le_rfl h) le_rfl + (Set.inter_eq_right.2 h.vertexSet_subset) (Set.inter_eq_right.2 h.edgeSet_subset) + +theorem isSeparation_inter_of_le {G G' A B : Hypergraph α β} + (hG' : G' ≤ G) (hsep : G.IsSeparation A B) : + G'.IsSeparation (A ∩ G') (B ∩ G') := by + have hAG' : A ∩ G' ≤ G' := GM10.inter_le_right hsep.left_le hG' + have hBG' : B ∩ G' ≤ G' := GM10.inter_le_right hsep.right_le hG' + rw [GM10.isSeparation_iff_of_le hAG' hBG'] + refine ⟨?_, ?_, ?_⟩ + · ext v + simp only [GM10.inter_vertexSet, Set.mem_union, Set.mem_inter_iff] + rw [← or_and_right, ← Set.mem_union, hsep.vertexSet_union] + exact ⟨fun h ↦ h.2, fun hv ↦ ⟨hG'.vertexSet_subset hv, hv⟩⟩ + · ext e + simp only [GM10.inter_edgeSet, Set.mem_union, Set.mem_inter_iff] + rw [← or_and_right, ← Set.mem_union, hsep.edgeSet_union] + exact ⟨fun h ↦ h.2, fun he ↦ ⟨hG'.edgeSet_subset he, he⟩⟩ + · ext e + simp only [GM10.inter_edgeSet, Set.mem_inter_iff, Set.mem_empty_iff_false, iff_false] + rintro ⟨⟨heA, _⟩, ⟨heB, _⟩⟩ + exact hsep.notMem_edgeSet_right heA heB + +theorem separationOrder_inter_le {G' A B : Hypergraph α β} : + separationOrder (A ∩ G') (B ∩ G') ≤ separationOrder A B := by + refine Set.ncard_le_ncard ?_ (A ∩ B).vertexSet_finite + intro v hv + exact ⟨hv.1.1, hv.2.1⟩ + +theorem biUnion_le {s : Finset ι} {τ : ι → Hypergraph α β} {G : Hypergraph α β} + (hτ : ∀ t ∈ s, τ t ≤ G) : + Hypergraph.biUnion s τ ≤ G where + vertexSet_subset := by + intro v hv + simp only [biUnion, Set.mem_iUnion] at hv + rcases hv with ⟨t, ht, hvt⟩ + exact (hτ t ht).vertexSet_subset hvt + edgeSet_subset := by + intro e he + simp only [biUnion, Set.mem_iUnion] at he + rcases he with ⟨t, ht, het⟩ + exact (hτ t ht).edgeSet_subset het + ends_eq e he := by + simp only [biUnion, Set.mem_iUnion] at he + rcases he with ⟨t₀, ht₀, het₀⟩ + ext v + simp only [ends, biUnion, Set.mem_ofPred_eq] + constructor + · intro hv + exact ⟨t₀, ht₀, (GM10.inc_iff_of_le (hτ t₀ ht₀) het₀).2 hv⟩ + · rintro ⟨t, ht, hinc⟩ + exact GM10.inc_of_le (hτ t ht) hinc + +theorem le_biUnion_of_mem {s : Finset ι} {τ : ι → Hypergraph α β} {G : Hypergraph α β} + (hτ : ∀ t ∈ s, τ t ≤ G) {t₀ : ι} (ht₀ : t₀ ∈ s) : + τ t₀ ≤ Hypergraph.biUnion s τ := by + rw [GM10.le_iff_of_le (hτ t₀ ht₀) (biUnion_le hτ)] + refine ⟨fun v hv ↦ ?_, fun e he ↦ ?_⟩ + · exact Set.mem_iUnion₂.2 ⟨t₀, ht₀, hv⟩ + · exact Set.mem_iUnion₂.2 ⟨t₀, ht₀, he⟩ + +theorem biUnion_mono {s₁ s₂ : Finset ι} {τ : ι → Hypergraph α β} {G : Hypergraph α β} + (hτ : ∀ t ∈ s₂, τ t ≤ G) (hsub : s₁ ⊆ s₂) : + Hypergraph.biUnion s₁ τ ≤ Hypergraph.biUnion s₂ τ := by + rw [GM10.le_iff_of_le (biUnion_le fun t ht ↦ hτ t (hsub ht)) (biUnion_le hτ)] + refine ⟨?_, ?_⟩ + · intro v hv + simp only [biUnion, Set.mem_iUnion] at hv ⊢ + rcases hv with ⟨t, ht, hvt⟩ + exact ⟨t, hsub ht, hvt⟩ + · intro e he + simp only [biUnion, Set.mem_iUnion] at he ⊢ + rcases he with ⟨t, ht, het⟩ + exact ⟨t, hsub ht, het⟩ + +/-! ## (2.1) and (2.2) -/ + +/-- **Graph Minors XVIII, (2.1)** (page 79): +"Let $G$ be a hypergraph, let $G' \subseteq G$, and let $\mathcal{T}'$ be a tangle in $G'$ of +order $\theta$. Let $\mathcal{T}$ be the set of all separations $(A, B)$ of $G$ of order +$<\theta$ such that $(A \cap G', B \cap G') \in \mathcal{T}'$. Then $\mathcal{T}$ is a +tangle in $G$ of order $\theta$." -/ +theorem theorem_2_1_proof {G G' : Hypergraph α β} (hG' : G' ≤ G) {θ : ℕ} + {𝒯' : Set (Hypergraph α β × Hypergraph α β)} (h𝒯' : GM10.IsTangle G' θ 𝒯') : + GM10.IsTangle G θ + {p | G.IsSeparation p.1 p.2 ∧ separationOrder p.1 p.2 < θ ∧ + (p.1 ∩ G', p.2 ∩ G') ∈ 𝒯'} where + one_le := h𝒯'.one_le + isSeparation _ _ h := h.1 + order_lt _ _ h := h.2.1 + axiom1 A B hsep hord := by + have hsep' : G'.IsSeparation (A ∩ G') (B ∩ G') := isSeparation_inter_of_le hG' hsep + have hord' : separationOrder (A ∩ G') (B ∩ G') < θ := + separationOrder_inter_le.trans_lt hord + rcases h𝒯'.axiom1 hsep' hord' with h1 | h2 + · exact Or.inl ⟨hsep, hord, h1⟩ + · exact Or.inr ⟨hsep.symm, by rwa [GM10.separationOrder_comm], h2⟩ + axiom2 A₁ B₁ A₂ B₂ A₃ B₃ h₁ h₂ h₃ hU := by + apply h𝒯'.axiom2 h₁.2.2 h₂.2.2 h₃.2.2 + have hle1 : (A₁ ∩ G') ∪ (A₂ ∩ G') ∪ (A₃ ∩ G') ≤ G' := + GM10.union_le (GM10.union_le (GM10.inter_le_right h₁.1.left_le hG') + (GM10.inter_le_right h₂.1.left_le hG')) + (GM10.inter_le_right h₃.1.left_le hG') + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle1 le_rfl ?_ ?_ + · have hVG : (A₁ ∪ A₂ ∪ A₃).vertexSet = G.vertexSet := congrArg Hypergraph.vertexSet hU + ext v + simp only [GM10.union_vertexSet, GM10.inter_vertexSet, Set.mem_union, Set.mem_inter_iff] + constructor + · rintro ((⟨_, hv⟩ | ⟨_, hv⟩) | ⟨_, hv⟩) <;> exact hv + · intro hvG' + have hvG : v ∈ (A₁ ∪ A₂ ∪ A₃).vertexSet := hVG.symm ▸ hG'.vertexSet_subset hvG' + rcases hvG with (hv₁ | hv₂) | hv₃ + · exact Or.inl (Or.inl ⟨hv₁, hvG'⟩) + · exact Or.inl (Or.inr ⟨hv₂, hvG'⟩) + · exact Or.inr ⟨hv₃, hvG'⟩ + · have hEG : (A₁ ∪ A₂ ∪ A₃).edgeSet = G.edgeSet := congrArg Hypergraph.edgeSet hU + ext e + simp only [GM10.union_edgeSet, GM10.inter_edgeSet, Set.mem_union, Set.mem_inter_iff] + constructor + · rintro ((⟨_, he⟩ | ⟨_, he⟩) | ⟨_, he⟩) <;> exact he + · intro heG' + have heG : e ∈ (A₁ ∪ A₂ ∪ A₃).edgeSet := hEG.symm ▸ hG'.edgeSet_subset heG' + rcases heG with (he₁ | he₂) | he₃ + · exact Or.inl (Or.inl ⟨he₁, heG'⟩) + · exact Or.inl (Or.inr ⟨he₂, heG'⟩) + · exact Or.inr ⟨he₃, heG'⟩ + axiom3 A B h hVA := by + apply h𝒯'.axiom3 h.2.2 + change A.vertexSet ∩ G'.vertexSet = G'.vertexSet + rw [hVA, Set.inter_eq_right.2 hG'.vertexSet_subset] + +/-- **Graph Minors XVIII, (2.2)** (page 79): +"**2.2.** *Let $G$ be a hypergraph with no tangle of order $\ge \theta$, where $\theta \ge 1$. +Then $G$ has tree-width $\le \frac{3}{2}\theta$.*" -/ +theorem theorem_2_2_proof + (G : Hypergraph α β) {θ : ℕ} (hθ : 1 ≤ θ) + (hno : ∀ ⦃θ' : ℕ⦄ ⦃𝒯 : Set (Hypergraph α β × Hypergraph α β)⦄, + GM10.IsTangle G θ' 𝒯 → θ' < θ) : + 2 * GM10.treeWidth G ≤ 3 * (θ : ℤ) := by + have htn_lt : GM10.tangleNumber G < θ := by + unfold GM10.tangleNumber + rcases Set.eq_empty_or_nonempty {θ' : ℕ | ∃ 𝒯, GM10.IsTangle G θ' 𝒯} with hemp | hne + · simp [hemp] + omega + · obtain ⟨𝒯, h𝒯⟩ := Nat.sSup_mem hne (GM10.bddAbove_tangle_orders G) + exact hno h𝒯 + have h52_right : 2 * GM10.treeWidthPlusOne G ≤ 3 * GM10.tangleNumber G := (gm10Theorem52 G).2 + unfold GM10.treeWidth + omega + +/-! ## (2.3): Properties of Locations -/ + +theorem locationCore_le {G : Hypergraph α β} {ℒ : Set (Hypergraph α β × Hypergraph α β)} + (hℒ : GM10.IsLocation G ℒ) : + GM10.locationCore G ℒ ≤ G where + vertexSet_subset _ h := h.1 + edgeSet_subset _ h := h.1 + ends_eq e he := by + ext v + change G.Inc e v ↔ + G.Inc e v ∧ (∀ p ∈ ℒ, v ∈ p.2.vertexSet) ∧ (∀ p ∈ ℒ, e ∈ p.2.edgeSet) + refine ⟨fun h ↦ ⟨h, fun p hp ↦ ?_, he.2⟩, fun h ↦ h.1⟩ + exact p.2.vertex_mem_of_inc + ((GM10.inc_iff_of_le (hℒ.isSeparation hp).right_le (he.2 p hp)).2 h) + +theorem locationCore_le_right {G : Hypergraph α β} {ℒ : Set (Hypergraph α β × Hypergraph α β)} + (hℒ : GM10.IsLocation G ℒ) {p : Hypergraph α β × Hypergraph α β} (hp : p ∈ ℒ) : + GM10.locationCore G ℒ ≤ p.2 := + (GM10.le_iff_of_le (locationCore_le hℒ) (hℒ.isSeparation hp).right_le).2 + ⟨fun _ hv ↦ hv.2 p hp, fun _ he ↦ he.2 p hp⟩ + +/-- **Graph Minors XVIII, (2.3.1)** (page 80): +"**2.3.** *Let $\mathcal{L} = \{(A_1, B_1), \dots, (A_n, B_n)\}$ be a location in a hypergraph $G$. +Then* +1. *$A_1, \dots, A_n, M(G, \mathcal{L})$ are mutually edge-disjoint, and have union $G$,*" -/ +theorem theorem_2_3_1 {G : Hypergraph α β} {ℒ : Set (Hypergraph α β × Hypergraph α β)} + (hℒ : GM10.IsLocation G ℒ) : + (∀ ⦃p₁⦄, p₁ ∈ ℒ → ∀ ⦃p₂⦄, p₂ ∈ ℒ → p₁ ≠ p₂ → Disjoint p₁.1.edgeSet p₂.1.edgeSet) ∧ + (∀ ⦃p⦄, p ∈ ℒ → Disjoint p.1.edgeSet (GM10.locationCore G ℒ).edgeSet) ∧ + GM10.locationCore G ℒ ∪ Hypergraph.biUnion hℒ.finite.toFinset Prod.fst = G := by + refine ⟨?_, ?_, ?_⟩ + · intro p₁ hp₁ p₂ hp₂ hne + have hle : p₁.1.edgeSet ⊆ p₂.2.edgeSet := (hℒ.left_le_right hp₁ hp₂ hne).edgeSet_subset + exact Disjoint.mono_left hle (hℒ.isSeparation hp₂).disjoint_edgeSet.symm + · intro p hp + have hle : (GM10.locationCore G ℒ).edgeSet ⊆ p.2.edgeSet := fun _ he ↦ he.2 p hp + exact Disjoint.mono_right hle (hℒ.isSeparation hp).disjoint_edgeSet + · have hle_union : GM10.locationCore G ℒ ∪ Hypergraph.biUnion hℒ.finite.toFinset Prod.fst ≤ G := + GM10.union_le (locationCore_le hℒ) + (biUnion_le fun p hp ↦ (hℒ.isSeparation (hℒ.finite.mem_toFinset.1 hp)).left_le) + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle_union le_rfl ?_ ?_ + · ext v + constructor + · exact fun hv ↦ hle_union.vertexSet_subset hv + · intro hvG + simp only [GM10.union_vertexSet, GM10.locationCore, biUnion, Set.mem_union, + Set.mem_sep_iff, Set.mem_iUnion, Set.Finite.mem_toFinset] + by_cases hall : ∀ p ∈ ℒ, v ∈ p.2.vertexSet + · exact Or.inl ⟨hvG, hall⟩ + · push Not at hall + rcases hall with ⟨p, hp, hnot⟩ + have hvAB : v ∈ p.1.vertexSet ∪ p.2.vertexSet := by + rwa [(hℒ.isSeparation hp).vertexSet_union] + exact Or.inr ⟨p, hp, hvAB.resolve_right hnot⟩ + · ext e + constructor + · exact fun he ↦ hle_union.edgeSet_subset he + · intro heG + simp only [GM10.union_edgeSet, GM10.locationCore, biUnion, Set.mem_union, + Set.mem_sep_iff, Set.mem_iUnion, Set.Finite.mem_toFinset] + by_cases hall : ∀ p ∈ ℒ, e ∈ p.2.edgeSet + · exact Or.inl ⟨heG, hall⟩ + · push Not at hall + rcases hall with ⟨p, hp, hnot⟩ + have heAB : e ∈ p.1.edgeSet ∪ p.2.edgeSet := by + rwa [(hℒ.isSeparation hp).edgeSet_union] + exact Or.inr ⟨p, hp, heAB.resolve_right hnot⟩ + +/-- **Graph Minors XVIII, (2.3.3)** (page 80): +"for $1 \le i < j \le n$, $A_i \cap A_j \subseteq M(G, \mathcal{L})$, and* $$V(A_i \cap A_j) += V(A_i \cap B_i) \cap V(A_j \cap B_j) \cap V(M(G, \mathcal{L})).$$" -/ +theorem theorem_2_3_3 {G : Hypergraph α β} {ℒ : Set (Hypergraph α β × Hypergraph α β)} + (hℒ : GM10.IsLocation G ℒ) {p₁ p₂ : Hypergraph α β × Hypergraph α β} + (hp₁ : p₁ ∈ ℒ) (hp₂ : p₂ ∈ ℒ) (hne : p₁ ≠ p₂) : + p₁.1 ∩ p₂.1 ≤ GM10.locationCore G ℒ ∧ + (p₁.1 ∩ p₂.1).vertexSet = + (p₁.1 ∩ p₁.2).vertexSet ∩ (p₂.1 ∩ p₂.2).vertexSet ∩ + (GM10.locationCore G ℒ).vertexSet := by + have hsep₁ := hℒ.isSeparation hp₁ + have hsep₂ := hℒ.isSeparation hp₂ + have hdisjE := (theorem_2_3_1 hℒ).1 hp₁ hp₂ hne + have hE_empty : (p₁.1 ∩ p₂.1).edgeSet = ∅ := Set.disjoint_iff_inter_eq_empty.1 hdisjE + have hle_core : p₁.1 ∩ p₂.1 ≤ GM10.locationCore G ℒ := by + rw [GM10.le_iff_of_le (GM10.inter_le hsep₁.left_le hsep₂.left_le) (locationCore_le hℒ)] + refine ⟨?_, ?_⟩ + · intro v ⟨hv₁, hv₂⟩ + refine ⟨hsep₁.left_le.vertexSet_subset hv₁, fun q hq ↦ ?_⟩ + by_cases hqp₁ : q = p₁ + · subst hqp₁ + exact (hℒ.left_le_right hp₂ hp₁ hne.symm).vertexSet_subset hv₂ + · exact (hℒ.left_le_right hp₁ hq (Ne.symm hqp₁)).vertexSet_subset hv₁ + · rw [hE_empty] + exact Set.empty_subset _ + refine ⟨hle_core, ?_⟩ + ext v + simp only [GM10.inter_vertexSet, Set.mem_inter_iff] + constructor + · rintro ⟨hv₁, hv₂⟩ + have hv_core : v ∈ (GM10.locationCore G ℒ).vertexSet := hle_core.vertexSet_subset ⟨hv₁, hv₂⟩ + exact ⟨⟨⟨hv₁, hv_core.2 p₁ hp₁⟩, ⟨hv₂, hv_core.2 p₂ hp₂⟩⟩, hv_core⟩ + · rintro ⟨⟨⟨hv₁, _⟩, ⟨hv₂, _⟩⟩, _⟩ + exact ⟨hv₁, hv₂⟩ + +open Classical in +/-- **Graph Minors XVIII, (2.3.2)** (page 80): +"for $1 \le i \le n$, $B_i = M(G, \mathcal{L}) \cup \bigcup(A_j: 1 \le j \le n, j \ne i)$, +and $A_i \cap M(G, \mathcal{L}) = A_i \cap B_i$" -/ +theorem theorem_2_3_2 {G : Hypergraph α β} {ℒ : Set (Hypergraph α β × Hypergraph α β)} + (hℒ : GM10.IsLocation G ℒ) {p : Hypergraph α β × Hypergraph α β} (hp : p ∈ ℒ) : + p.2 = GM10.locationCore G ℒ ∪ + Hypergraph.biUnion (hℒ.finite.toFinset.filter (· ≠ p)) Prod.fst ∧ + p.1 ∩ GM10.locationCore G ℒ = p.1 ∩ p.2 := by + have hsep := hℒ.isSeparation hp + have hle_rhs : GM10.locationCore G ℒ ∪ + Hypergraph.biUnion (hℒ.finite.toFinset.filter (· ≠ p)) Prod.fst ≤ p.2 := by + have hbi_le : Hypergraph.biUnion (hℒ.finite.toFinset.filter (· ≠ p)) Prod.fst ≤ p.2 := by + refine biUnion_le fun q hq ↦ ?_ + rw [Finset.mem_filter, Set.Finite.mem_toFinset] at hq + exact hℒ.left_le_right hq.1 hp hq.2 + exact GM10.union_le (locationCore_le_right hℒ hp) hbi_le + have hB_eq : p.2 = GM10.locationCore G ℒ ∪ + Hypergraph.biUnion (hℒ.finite.toFinset.filter (· ≠ p)) Prod.fst := by + refine (GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (hle_rhs.trans hsep.right_le) hsep.right_le ?_ ?_).symm + · ext v + constructor + · exact fun hv ↦ hle_rhs.vertexSet_subset hv + · intro hvp + have hvG : v ∈ G.vertexSet := hsep.right_le.vertexSet_subset hvp + by_cases hall : ∀ q ∈ ℒ, v ∈ q.2.vertexSet + · exact Or.inl ⟨hvG, hall⟩ + · push Not at hall + rcases hall with ⟨q, hq, hnot⟩ + have hqp : q ≠ p := fun heq ↦ hnot (heq ▸ hvp) + have hvAB : v ∈ q.1.vertexSet ∪ q.2.vertexSet := by + rwa [(hℒ.isSeparation hq).vertexSet_union] + refine Or.inr (Set.mem_iUnion₂.2 ⟨q, ?_, hvAB.resolve_right hnot⟩) + exact Finset.mem_filter.2 ⟨hℒ.finite.mem_toFinset.2 hq, hqp⟩ + · ext e + constructor + · exact fun he ↦ hle_rhs.edgeSet_subset he + · intro hep + have heG : e ∈ G.edgeSet := hsep.right_le.edgeSet_subset hep + by_cases hall : ∀ q ∈ ℒ, e ∈ q.2.edgeSet + · exact Or.inl ⟨heG, hall⟩ + · push Not at hall + rcases hall with ⟨q, hq, hnot⟩ + have hqp : q ≠ p := fun heq ↦ hnot (heq ▸ hep) + have heAB : e ∈ q.1.edgeSet ∪ q.2.edgeSet := by + rwa [(hℒ.isSeparation hq).edgeSet_union] + refine Or.inr (Set.mem_iUnion₂.2 ⟨q, ?_, heAB.resolve_right hnot⟩) + exact Finset.mem_filter.2 ⟨hℒ.finite.mem_toFinset.2 hq, hqp⟩ + refine ⟨hB_eq, ?_⟩ + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (GM10.inter_le hsep.left_le (locationCore_le hℒ)) + (GM10.inter_le hsep.left_le hsep.right_le) ?_ ?_ + · ext v + simp only [GM10.inter_vertexSet, GM10.locationCore, Set.mem_inter_iff, Set.mem_sep_iff] + constructor + · rintro ⟨hv₁, _, hall⟩ + exact ⟨hv₁, hall p hp⟩ + · rintro ⟨hv₁, hv₂⟩ + refine ⟨hv₁, hsep.left_le.vertexSet_subset hv₁, fun q hq ↦ ?_⟩ + by_cases hqp : q = p + · exact hqp ▸ hv₂ + · exact (hℒ.left_le_right hp hq (Ne.symm hqp)).vertexSet_subset hv₁ + · have hdisj := (theorem_2_3_1 hℒ).2.1 hp + rw [GM10.inter_edgeSet, Set.disjoint_iff_inter_eq_empty.1 hdisj, hsep.edgeSet_inter_eq] + +open Classical in +/-- **Graph Minors XVIII, (2.3)** (page 80): +Combined statement of (2.3.1), (2.3.2), and (2.3.3). -/ +theorem theorem_2_3_proof {G : Hypergraph α β} {ℒ : Set (Hypergraph α β × Hypergraph α β)} + (hℒ : GM10.IsLocation G ℒ) : + ((∀ ⦃p₁⦄, p₁ ∈ ℒ → ∀ ⦃p₂⦄, p₂ ∈ ℒ → p₁ ≠ p₂ → Disjoint p₁.1.edgeSet p₂.1.edgeSet) ∧ + (∀ ⦃p⦄, p ∈ ℒ → Disjoint p.1.edgeSet (GM10.locationCore G ℒ).edgeSet) ∧ + GM10.locationCore G ℒ ∪ Hypergraph.biUnion hℒ.finite.toFinset Prod.fst = G) ∧ + (∀ ⦃p⦄, p ∈ ℒ → + p.2 = GM10.locationCore G ℒ ∪ + Hypergraph.biUnion (hℒ.finite.toFinset.filter (· ≠ p)) Prod.fst ∧ + p.1 ∩ GM10.locationCore G ℒ = p.1 ∩ p.2) ∧ + (∀ ⦃p₁⦄, p₁ ∈ ℒ → ∀ ⦃p₂⦄, p₂ ∈ ℒ → p₁ ≠ p₂ → + p₁.1 ∩ p₂.1 ≤ GM10.locationCore G ℒ ∧ + (p₁.1 ∩ p₂.1).vertexSet = + (p₁.1 ∩ p₁.2).vertexSet ∩ (p₂.1 ∩ p₂.2).vertexSet ∩ + (GM10.locationCore G ℒ).vertexSet) := + ⟨theorem_2_3_1 hℒ, fun _ hp ↦ theorem_2_3_2 hℒ hp, + fun _ hp₁ _ hp₂ hne ↦ theorem_2_3_3 hℒ hp₁ hp₂ hne⟩ + +/-! ## Tree-Decomposition Separations and (2.4), (2.5) -/ + +/-- In a tree `T`, for an edge `s(t₁, t₂)` (`T.Adj t₁ t₂`), a vertex `s` is reachable from `t₁` in +`T \ s(t₁, t₂)` if and only if `t₁` lies on the path in `T` between `s` and `t₂`. -/ +theorem reachable_deleteEdges_iff_onTreePath {T : SimpleGraph ι} (hT : T.IsTree) + {t₁ t₂ : ι} (hadj : T.Adj t₁ t₂) (s : ι) : + (T.deleteEdges {s(t₁, t₂)}).Reachable t₁ s ↔ GM10.OnTreePath T s t₂ t₁ := by + classical + have he_self : Thomas.OnTreePathEdge T t₁ t₂ t₁ t₂ := by + rw [Thomas.onTreePathEdge_iff_mem_treePath hT] + refine ⟨hadj, ?_⟩ + rw [← Thomas.eq_treePath hT hadj.toWalk hadj.isPath_toWalk] + simp + have hnot_t₁_t₂ : ¬ (T.deleteEdges {s(t₁, t₂)}).Reachable t₁ t₂ := + (Thomas.onTreePathEdge_iff_not_reachable_deleteEdges.1 he_self).2 + constructor + · intro hreach + rcases Thomas.onTreePathEdge_left_or_right s he_self with hleft | hright + · exfalso + have hnot_t₁_s : ¬ (T.deleteEdges {s(t₁, t₂)}).Reachable t₁ s := + (Thomas.onTreePathEdge_iff_not_reachable_deleteEdges.1 hleft).2 + exact hnot_t₁_s hreach + · exact hright.onTreePath_left + · intro hs + change Thomas.OnTreePath T s t₂ t₁ at hs + rw [Thomas.onTreePath_iff_exists_append hT] at hs + obtain ⟨p, q, hp, hq, hpq⟩ := hs + have hnot_edge : s(t₁, t₂) ∉ p.edges := by + intro he_mem + have ht₂_p : t₂ ∈ p.support := p.snd_mem_support_of_mem_edges he_mem + have ht₂_q : t₂ ∈ q.support := q.end_mem_support + exact hpq.ne_of_mem_support_of_append hadj.symm.ne ht₂_p ht₂_q rfl + rw [reachable_comm, reachable_deleteEdges_iff_exists_walk] + exact ⟨p, by simpa using hnot_edge⟩ + +theorem reachable_deleteEdges_dichotomy {T : SimpleGraph ι} (hT : T.IsTree) + {t₁ t₂ : ι} (hadj : T.Adj t₁ t₂) (s : ι) : + ((T.deleteEdges {s(t₁, t₂)}).Reachable t₁ s ∧ + ¬ (T.deleteEdges {s(t₁, t₂)}).Reachable t₂ s) ∨ + ((T.deleteEdges {s(t₁, t₂)}).Reachable t₂ s ∧ + ¬ (T.deleteEdges {s(t₁, t₂)}).Reachable t₁ s) := by + have h₁ := reachable_deleteEdges_iff_onTreePath hT hadj s + have h₂ := reachable_deleteEdges_iff_onTreePath hT hadj.symm s + rw [Sym2.eq_swap] at h₂ + rw [h₁, h₂] + exact Thomas.onTreePath_adj_dichotomy hT hadj s + +theorem treeDecompSide_le [Fintype ι] {G : Hypergraph α β} {T : SimpleGraph ι} + {τ : ι → Hypergraph α β} (hD : GM10.IsTreeDecomposition G T τ) (e : Sym2 ι) (u : ι) : + GM10.treeDecompSide T τ e u ≤ G := + biUnion_le fun t _ ↦ hD.le t + +theorem isSeparation_treeDecompSide [Fintype ι] {G : Hypergraph α β} {T : SimpleGraph ι} + {τ : ι → Hypergraph α β} (hD : GM10.IsTreeDecomposition G T τ) + {u v : ι} (hadj : T.Adj u v) : + G.IsSeparation (GM10.treeDecompSide T τ s(u, v) u) (GM10.treeDecompSide T τ s(u, v) v) ∧ + (GM10.treeDecompSide T τ s(u, v) u ∩ GM10.treeDecompSide T τ s(u, v) v).vertexSet = + (τ u ∩ τ v).vertexSet := by + classical + have hle_u := treeDecompSide_le hD s(u, v) u + have hle_v := treeDecompSide_le hD s(u, v) v + have hsep : G.IsSeparation (GM10.treeDecompSide T τ s(u, v) u) + (GM10.treeDecompSide T τ s(u, v) v) := by + rw [GM10.isSeparation_iff_of_le hle_u hle_v] + refine ⟨?_, ?_, ?_⟩ + · have hVG : (Hypergraph.biUnion Finset.univ τ).vertexSet = G.vertexSet := + congrArg Hypergraph.vertexSet hD.biUnion_eq + ext x + constructor + · exact fun hx ↦ Set.union_subset hle_u.vertexSet_subset hle_v.vertexSet_subset hx + · intro hxG + simp only [GM10.treeDecompSide, biUnion, Set.mem_union, Set.mem_iUnion, Finset.mem_filter, + Finset.mem_univ, true_and] + rw [← hVG, biUnion, Set.mem_iUnion₂] at hxG + rcases hxG with ⟨s, _, hxs⟩ + rcases reachable_deleteEdges_dichotomy hD.isTree hadj s with ⟨h1, _⟩ | ⟨h2, _⟩ + · exact Or.inl ⟨s, h1, hxs⟩ + · exact Or.inr ⟨s, h2, hxs⟩ + · have hEG : (Hypergraph.biUnion Finset.univ τ).edgeSet = G.edgeSet := + congrArg Hypergraph.edgeSet hD.biUnion_eq + ext f + constructor + · exact fun hf ↦ Set.union_subset hle_u.edgeSet_subset hle_v.edgeSet_subset hf + · intro hfG + simp only [GM10.treeDecompSide, biUnion, Set.mem_union, Set.mem_iUnion, Finset.mem_filter, + Finset.mem_univ, true_and] + rw [← hEG, biUnion, Set.mem_iUnion₂] at hfG + rcases hfG with ⟨s, _, hfs⟩ + rcases reachable_deleteEdges_dichotomy hD.isTree hadj s with ⟨h1, _⟩ | ⟨h2, _⟩ + · exact Or.inl ⟨s, h1, hfs⟩ + · exact Or.inr ⟨s, h2, hfs⟩ + · ext f + simp only [GM10.treeDecompSide, biUnion, Set.mem_inter_iff, Set.mem_iUnion, + Finset.mem_filter, Finset.mem_univ, true_and, Set.mem_empty_iff_false, iff_false] + rintro ⟨⟨s₁, hs₁, hf₁⟩, ⟨s₂, hs₂, hf₂⟩⟩ + have hne : s₁ ≠ s₂ := by + rintro rfl + rcases reachable_deleteEdges_dichotomy hD.isTree hadj s₁ with ⟨_, hnot⟩ | ⟨_, hnot⟩ + · exact hnot hs₂ + · exact hnot hs₁ + exact Set.notMem_empty f (hD.edgeSet_inter_eq hne ▸ ⟨hf₁, hf₂⟩) + refine ⟨hsep, ?_⟩ + ext x + simp only [GM10.inter_vertexSet, GM10.treeDecompSide, biUnion, Set.mem_inter_iff, + Set.mem_iUnion, Finset.mem_filter, Finset.mem_univ, true_and] + constructor + · rintro ⟨⟨s₁, hs₁, hx₁⟩, ⟨s₂, hs₂, hx₂⟩⟩ + have hon₁ : Thomas.OnTreePath T s₁ v u := + (reachable_deleteEdges_iff_onTreePath hD.isTree hadj s₁).1 hs₁ + have hon₂ : Thomas.OnTreePath T s₂ u v := by + have h := reachable_deleteEdges_iff_onTreePath hD.isTree hadj.symm s₂ + rw [Sym2.eq_swap] at h + exact h.1 hs₂ + have ⟨hu_on, hv_on⟩ := Thomas.onTreePath_of_sides hD.isTree hadj hon₁ hon₂ + exact ⟨(hD.inter_le hu_on).vertexSet_subset ⟨hx₁, hx₂⟩, + (hD.inter_le hv_on).vertexSet_subset ⟨hx₁, hx₂⟩⟩ + · rintro ⟨hxu, hxv⟩ + exact ⟨⟨u, Reachable.refl u, hxu⟩, ⟨v, Reachable.refl v, hxv⟩⟩ + +theorem isSeparation_of_makesSeparation [Fintype ι] {G : Hypergraph α β} {T : SimpleGraph ι} + {τ : ι → Hypergraph α β} (hD : GM10.IsTreeDecomposition G T τ) + {e : Sym2 ι} {A B : Hypergraph α β} (hm : GM10.MakesSeparation T τ e A B) : + G.IsSeparation A B := by + rcases hm with ⟨u, v, hadj, _, rfl, rfl⟩ + exact (isSeparation_treeDecompSide hD hadj).1 + +/-- **Graph Minors XVIII, (2.4)** (page 80): +"**2.4.** *Let $(T, \tau)$ be a tree-decomposition of a hypergraph $G$, let $t_0 \in V(T)$ and let +$e_1, \dots, e_k$ be the edges of $T$ incident with $t_0$. For $1 \le i \le k$ let the components +of $T \setminus e_i$ be $T_i, T'_i$, where $t_0 \in V(T'_i)$. Then* +$$\{(\tau \times T_i, \tau \times T'_i): 1 \le i \le k\}$$ +*is a location.*" -/ +theorem theorem_2_4_proof [Fintype ι] {G : Hypergraph α β} {T : SimpleGraph ι} + {τ : ι → Hypergraph α β} (hD : GM10.IsTreeDecomposition G T τ) (t₀ : ι) : + GM10.IsLocation G (vertexLocation T τ t₀) where + isSeparation := by + rintro p ⟨u, hadj, rfl⟩ + exact (isSeparation_treeDecompSide hD hadj.symm).1 + left_le_right := by + classical + rintro p₁ ⟨u₁, hadj₁, rfl⟩ p₂ ⟨u₂, hadj₂, rfl⟩ hne + have hu_ne : u₁ ≠ u₂ := fun h ↦ hne (by subst h; rfl) + refine biUnion_mono (fun t _ ↦ hD.le t) fun s hs ↦ ?_ + rw [Finset.mem_filter] at hs ⊢ + refine ⟨Finset.mem_univ s, ?_⟩ + have hon₁ : Thomas.OnTreePath T s t₀ u₁ := + (reachable_deleteEdges_iff_onTreePath hD.isTree hadj₁.symm s).1 hs.2 + have h := reachable_deleteEdges_iff_onTreePath hD.isTree hadj₂ s + rw [Sym2.eq_swap] at h + rw [h] + rcases Thomas.onTreePath_adj_dichotomy hD.isTree hadj₂.symm s with ⟨hon₂, _⟩ | ⟨hon₂, _⟩ + · exfalso + rcases (Thomas.onTreePath_split_iff hD.isTree hon₁).1 hon₂ with h_left | h_right + · have hon_u₂_u₁ : Thomas.OnTreePath T s t₀ u₁ := hon₁ + rcases (Thomas.onTreePath_split_iff hD.isTree hon₂).1 hon_u₂_u₁ with h_l2 | h_r2 + · exact hu_ne (Thomas.onTreePath_antisymm hD.isTree h_left h_l2).symm + · have hp : (Thomas.treePath hD.isTree u₂ t₀) = hadj₂.symm.toWalk := + (Thomas.eq_treePath hD.isTree hadj₂.symm.toWalk hadj₂.symm.isPath_toWalk).symm + have hmem := (Thomas.onTreePath_iff_mem_treePath hD.isTree).1 h_r2 + rw [hp, Walk.support_cons, Walk.support_nil, List.mem_cons, List.mem_singleton] at hmem + rcases hmem with rfl | rfl + · exact hu_ne rfl + · exact hadj₁.ne rfl + · have hp : (Thomas.treePath hD.isTree u₁ t₀) = hadj₁.symm.toWalk := + (Thomas.eq_treePath hD.isTree hadj₁.symm.toWalk hadj₁.symm.isPath_toWalk).symm + have hmem := (Thomas.onTreePath_iff_mem_treePath hD.isTree).1 h_right + rw [hp, Walk.support_cons, Walk.support_nil, List.mem_cons, List.mem_singleton] at hmem + rcases hmem with rfl | rfl + · exact hu_ne rfl + · exact hadj₂.ne rfl + · exact hon₂ + +/-- **Graph Minors XVIII, (2.5)** (page 80): +"Let $(T, \tau)$ be a tree-decomposition of a hypergraph $G$, and let $t \in V(T)$. Let +$\mathcal{L}$ be the location of $t$ in $(T, \tau)$; then $\tau(t) = M(G, \mathcal{L})$." -/ +theorem theorem_2_5_proof [Fintype ι] {G : Hypergraph α β} {T : SimpleGraph ι} + {τ : ι → Hypergraph α β} (hD : GM10.IsTreeDecomposition G T τ) (t₀ : ι) : + τ t₀ = GM10.locationCore G (vertexLocation T τ t₀) := by + classical + have hℒ := theorem_2_4_proof hD t₀ + have hle_core : τ t₀ ≤ GM10.locationCore G (vertexLocation T τ t₀) := by + rw [GM10.le_iff_of_le (hD.le t₀) (locationCore_le hℒ)] + have ht₀_mem : ∀ p ∈ vertexLocation T τ t₀, τ t₀ ≤ p.2 := by + rintro p ⟨u, _, rfl⟩ + refine le_biUnion_of_mem (fun s _ ↦ hD.le s) ?_ + rw [Finset.mem_filter] + exact ⟨Finset.mem_univ t₀, Reachable.refl t₀⟩ + exact ⟨fun v hv ↦ ⟨(hD.le t₀).vertexSet_subset hv, fun p hp ↦ (ht₀_mem p hp).vertexSet_subset + hv⟩, + fun e he ↦ ⟨(hD.le t₀).edgeSet_subset he, fun p hp ↦ (ht₀_mem p hp).edgeSet_subset he⟩⟩ + have step_neighbor : ∀ {t' : ι}, t' ≠ t₀ → + ∃ u : ι, T.Adj t₀ u ∧ (T.deleteEdges {s(u, t₀)}).Reachable u t' := by + intro t' hne + obtain ⟨u, t'', he_edge, heq_t₀, hne_t₀⟩ := + Thomas.exists_onTreePathEdge_of_prop hD.isTree (· = t₀) rfl hne + subst heq_t₀ + refine ⟨t'', he_edge.1, ?_⟩ + rw [reachable_deleteEdges_iff_onTreePath hD.isTree he_edge.1.symm t'] + rcases he_edge.orient hD.isTree with ⟨_, h2, _, _⟩ | ⟨h1, _, _, _⟩ + · exact Thomas.onTreePath_symm h2 + · exfalso + rw [Thomas.onTreePath_self] at h1 + exact hne_t₀ h1 + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq (hD.le t₀) (locationCore_le hℒ) ?_ ?_ + · ext v + constructor + · exact fun hv ↦ hle_core.vertexSet_subset hv + · rintro ⟨hvG, hall⟩ + by_contra hnot + have hVG : (Hypergraph.biUnion Finset.univ τ).vertexSet = G.vertexSet := + congrArg Hypergraph.vertexSet hD.biUnion_eq + rw [← hVG, biUnion, Set.mem_iUnion₂] at hvG + rcases hvG with ⟨t', _, hvt'⟩ + have ht'_ne : t' ≠ t₀ := fun heq ↦ hnot (heq ▸ hvt') + obtain ⟨u, hadj, hreach⟩ := step_neighbor ht'_ne + let A := GM10.treeDecompSide T τ s(u, t₀) u + let B := GM10.treeDecompSide T τ s(u, t₀) t₀ + have hp_mem : (A, B) ∈ vertexLocation T τ t₀ := ⟨u, hadj, rfl⟩ + have hvB : v ∈ B.vertexSet := hall (A, B) hp_mem + have hvA : v ∈ A.vertexSet := by + refine (le_biUnion_of_mem (fun s _ ↦ hD.le s) ?_).vertexSet_subset hvt' + rw [Finset.mem_filter] + exact ⟨Finset.mem_univ t', hreach⟩ + have hAB_eq := (isSeparation_treeDecompSide hD hadj.symm).2 + have hv_inter : v ∈ (τ u ∩ τ t₀).vertexSet := hAB_eq ▸ ⟨hvA, hvB⟩ + exact hnot hv_inter.2 + · ext e + constructor + · exact fun he ↦ hle_core.edgeSet_subset he + · rintro ⟨heG, hall⟩ + by_contra hnot + have hEG : (Hypergraph.biUnion Finset.univ τ).edgeSet = G.edgeSet := + congrArg Hypergraph.edgeSet hD.biUnion_eq + rw [← hEG, biUnion, Set.mem_iUnion₂] at heG + rcases heG with ⟨t', _, het'⟩ + have ht'_ne : t' ≠ t₀ := fun heq ↦ hnot (heq ▸ het') + obtain ⟨u, hadj, hreach⟩ := step_neighbor ht'_ne + let A := GM10.treeDecompSide T τ s(u, t₀) u + let B := GM10.treeDecompSide T τ s(u, t₀) t₀ + have hp_mem : (A, B) ∈ vertexLocation T τ t₀ := ⟨u, hadj, rfl⟩ + have heB : e ∈ B.edgeSet := hall (A, B) hp_mem + have heA : e ∈ A.edgeSet := by + refine (le_biUnion_of_mem (fun s _ ↦ hD.le s) ?_).edgeSet_subset het' + rw [Finset.mem_filter] + exact ⟨Finset.mem_univ t', hreach⟩ + have hsep := (isSeparation_treeDecompSide hD hadj.symm).1 + exact hsep.notMem_edgeSet_right heA heB + +/-! ## (2.6) and (2.7): Standard Decompositions -/ + +/-- Distinct tangles of the same order `θ` in `G` are distinguishable. -/ +theorem areDistinguishable_of_ne_of_same_order {G : Hypergraph α β} {θ : ℕ} + {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} + (h₁ : GM10.IsTangle G θ 𝒯₁) (h₂ : GM10.IsTangle G θ 𝒯₂) (hne : 𝒯₁ ≠ 𝒯₂) : + GM10.AreDistinguishable 𝒯₁ 𝒯₂ := by + rintro (hsub | hsub) + · apply hne (Set.Subset.antisymm hsub ?_) + rintro ⟨A, B⟩ hAB₂ + rcases h₁.axiom1 (h₂.isSeparation hAB₂) (h₂.order_lt hAB₂) with hAB₁ | hBA₁ + · exact hAB₁ + · exact (GM10.theorem_2_1_proof h₂ hAB₂ (hsub hBA₁)).elim + · apply hne (Set.Subset.antisymm ?_ hsub) + rintro ⟨A, B⟩ hAB₁ + rcases h₂.axiom1 (h₁.isSeparation hAB₁) (h₁.order_lt hAB₁) with hAB₂ | hBA₂ + · exact hAB₂ + · exact (GM10.theorem_2_1_proof h₁ hAB₁ (hsub hBA₂)).elim + +theorem treeDecompSide_symm_edge [Fintype ι] (T : SimpleGraph ι) (τ : ι → Hypergraph α β) + (u v : ι) : + GM10.treeDecompSide T τ s(v, u) = GM10.treeDecompSide T τ s(u, v) := by + rw [Sym2.eq_swap] + +theorem makesSeparation_adj_iff [Fintype ι] {T : SimpleGraph ι} + (τ : ι → Hypergraph α β) {u v : ι} (hadj : T.Adj u v) (A B : Hypergraph α β) : + GM10.MakesSeparation T τ s(u, v) A B ↔ + (A = GM10.treeDecompSide T τ s(u, v) u ∧ B = GM10.treeDecompSide T τ s(u, v) v) ∨ + (A = GM10.treeDecompSide T τ s(u, v) v ∧ B = GM10.treeDecompSide T τ s(u, v) u) := by + constructor + · rintro ⟨u', v', _, heq, rfl, rfl⟩ + rw [Sym2.eq_iff] at heq + rcases heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl ⟨rfl, rfl⟩ + · rw [Sym2.eq_swap] + exact Or.inr ⟨rfl, rfl⟩ + · rintro (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) + · exact ⟨u, v, hadj, rfl, rfl, rfl⟩ + · refine ⟨v, u, hadj.symm, Sym2.eq_swap, ?_, ?_⟩ <;> rw [Sym2.eq_swap] + +/-- **Graph Minors XVIII, (2.6)** (page 81): +"Let $\mathscr{T}_1, \dots, \mathscr{T}_n$ be distinct tangles of order $\theta$ in a +hypergraph $G$ with $n \ge 1$, and let $\lambda$ be a tie-breaker. Then there is a +tree-decomposition $(T, \tau)$ of $G$ where $V(T) = \{t_1, \dots, t_n\}$, with the following +properties:* 1. *if $e \in E(T)$ and $T_1, T_2$ are the components of $T \setminus e$ and $1 +\le i \le n$ and $t_i \in V(T_2)$ then $(\tau \times T_1, \tau \times T_2) \in +\mathscr{T}_i$,* 2. *for $1 \le i < j \le n$, let $e$ be the edge of the path of $T$ between +$t_i, t_j$ making separations of minimum $\lambda$-order; then these separations are the +$(\mathscr{T}_i, \mathscr{T}_j)$- and $(\mathscr{T}_j, \mathscr{T}_i)$-distinctions." -/ +theorem theorem_2_6_proof {Λ : Type w} [LinearOrder Λ] {n : ℕ} + (G : Hypergraph α β) (lam : Hypergraph α β × Hypergraph α β → Λ) + (θ : ℕ) (𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)) + (hn : 1 ≤ n) (hlam : GM10.IsTieBreaker G lam) + (h𝒯 : ∀ i : Fin n, GM10.IsTangle G θ (𝒯 i)) + (hdist : Function.Injective 𝒯) : + ∃ (T : SimpleGraph (Fin n)) (τ : Fin n → Hypergraph α β), + IsStandardDecomposition G lam 𝒯 T τ := by + have hmut : ∀ i j : Fin n, i ≠ j → GM10.AreDistinguishable (𝒯 i) (𝒯 j) := fun i j hij ↦ + areDistinguishable_of_ne_of_same_order (h𝒯 i) (h𝒯 j) (hdist.ne hij) + obtain ⟨T, τ, hstd⟩ := gm10Theorem103 G lam (fun _ ↦ θ) 𝒯 hn hlam h𝒯 hmut + refine ⟨T, τ, ⟨hstd.isTreeDecomposition, ?_, hstd.path_min_isDistinction⟩⟩ + intro i u v hadj hreach + obtain ⟨e, _, he_path, _, A, B, hmAB, hdist_uv, _⟩ := hstd.path_min_isDistinction hadj.ne + have he_eq : e = s(u, v) := by + have hmem := he_path hadj.toWalk hadj.isPath_toWalk + simpa using hmem + subst he_eq + have hord_AB : separationOrder A B < θ := (h𝒯 u).order_lt hdist_uv.1.1 + have hord_uv : separationOrder (GM10.treeDecompSide T τ s(u, v) u) + (GM10.treeDecompSide T τ s(u, v) v) < θ := by + rcases (makesSeparation_adj_iff τ hadj A B).1 hmAB with + ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hord_AB + · rwa [GM10.separationOrder_comm] + have hsep_uv := (isSeparation_treeDecompSide hstd.isTreeDecomposition hadj).1 + have hnot_swap : + (GM10.treeDecompSide T τ s(u, v) v, GM10.treeDecompSide T τ s(u, v) u) ∉ 𝒯 i := by + have hhome := hstd.isHome i hadj.symm + rw [Sym2.eq_swap] at hhome + exact hhome hreach + exact ((h𝒯 i).axiom1 hsep_uv hord_uv).resolve_right hnot_swap + +theorem isSeparation_left_split {G A B C D : Hypergraph α β} + (hAB : G.IsSeparation A B) (hCD : A.IsSeparation C D) : + G.IsSeparation C (B ∪ D) := + GM10.isSeparation_of_isSeparation_left hAB hCD + +/-- Any `λ`-robust separation in `G` (for a tie-breaker `λ`) is robust. -/ +theorem isRobust_of_isLambdaRobust {Λ : Type w} [LinearOrder Λ] + {G A B : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + (hlam : GM10.IsTieBreaker G lam) (hrob : GM10.IsLambdaRobust G lam A B) : + GM10.IsRobust G A B := by + refine ⟨hrob.1, fun C D hCD ↦ ?_⟩ + have hsep₁ : G.IsSeparation C (B ∪ D) := isSeparation_left_split hrob.1 hCD + have hsep₂ : G.IsSeparation D (B ∪ C) := isSeparation_left_split hrob.1 hCD.symm + rcases hrob.2 hCD with hle₁ | hle₂ + · left + by_contra! hlt + exact not_lt_of_ge hle₁ (hlam.axiom3 hsep₁ hrob.1 hlt) + · right + by_contra! hlt + exact not_lt_of_ge hle₂ (hlam.axiom3 hsep₂ hrob.1 hlt) + +/-- **Graph Minors XVIII, (2.7)** (page 81): +"Let $\mathscr{T}_1, \dots, \mathscr{T}_n$ be distinct tangles of order $\theta$ in a +hypergraph $G$ with $n \ge 1$, and let $\lambda$ be a tie-breaker. Let $(T, \tau)$ be as in +2.6. Then $(T, \tau)$ is proper and rotund, and every separation made by an edge of $T$ +under $(T, \tau)$ is robust." -/ +theorem theorem_2_7_proof {Λ : Type w} [LinearOrder Λ] {n : ℕ} + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : ℕ} {𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)} + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (hlam : GM10.IsTieBreaker G lam) + (h𝒯 : ∀ i : Fin n, GM10.IsTangle G θ (𝒯 i)) + (hstd : IsStandardDecomposition G lam 𝒯 T τ) : + IsProper G T τ ∧ + IsRotund G T τ ∧ + (∀ ⦃e : Sym2 (Fin n)⦄, e ∈ T.edgeSet → ∀ ⦃A B : Hypergraph α β⦄, + GM10.MakesSeparation T τ e A B → GM10.IsRobust G A B) := by + have hD := hstd.isTreeDecomposition + have edge_isDistinction : ∀ ⦃e : Sym2 (Fin n)⦄, e ∈ T.edgeSet → ∀ ⦃A B : Hypergraph α β⦄, + GM10.MakesSeparation T τ e A B → + ∃ i j : Fin n, i ≠ j ∧ GM10.IsDistinction lam (𝒯 i) (𝒯 j) A B ∧ + GM10.IsDistinction lam (𝒯 j) (𝒯 i) B A := by + rintro e _ A B ⟨u, v, hadj, rfl, rfl, rfl⟩ + obtain ⟨e', _, he'_path, _, A', B', hmA'B', hdist₁, hdist₂⟩ := + hstd.path_min_isDistinction hadj.ne + have he'_eq : e' = s(u, v) := by + have hmem := he'_path hadj.toWalk hadj.isPath_toWalk + simpa using hmem + subst he'_eq + rcases (makesSeparation_adj_iff τ hadj A' B').1 hmA'B' with + ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨u, v, hadj.ne, hdist₁, hdist₂⟩ + · exact ⟨v, u, hadj.symm.ne, hdist₂, hdist₁⟩ + have hproper : IsProper G T τ := by + intro e he A B hm hBG + obtain ⟨i, j, _, _, hdist_ji⟩ := edge_isDistinction he hm + exact (h𝒯 j).axiom3 hdist_ji.1.1 (congrArg Hypergraph.vertexSet hBG) + have hrobust : ∀ ⦃e : Sym2 (Fin n)⦄, e ∈ T.edgeSet → ∀ ⦃A B : Hypergraph α β⦄, + GM10.MakesSeparation T τ e A B → GM10.IsRobust G A B := by + intro e he A B hm + obtain ⟨i, j, _, hdist_ij, _⟩ := edge_isDistinction he hm + have hdoubly := gm10Theorem102 G lam θ θ (𝒯 i) (𝒯 j) A B hlam (h𝒯 i) (h𝒯 j) hdist_ij + exact isRobust_of_isLambdaRobust hlam hdoubly.1 + refine ⟨hproper, ?_, hrobust⟩ + intro t₁ t₂ p hp f₁ f₂ _ _ hf₁_p hf₂_p A₁ B₁ A₂ B₂ hm₁ hm₂ hB₂_A₁ hB₁_A₂ hord_eq + ⟨H₁, H₂, hsepH, hB₁_H₁, hB₂_H₂, hordH⟩ + have edge_mem_t₁_or_t₂ : ∀ ⦃f : Sym2 (Fin n)⦄, f ∈ p.edges → ∀ ⦃A B : Hypergraph α β⦄, + GM10.MakesSeparation T τ f A B → (A, B) ∈ 𝒯 t₁ ∨ (A, B) ∈ 𝒯 t₂ := by + rintro f hf_p A B ⟨u, v, hadj, rfl, rfl, rfl⟩ + have hon_edge : Thomas.OnTreePathEdge T t₁ t₂ u v := + (Thomas.onTreePathEdge_iff_mem_treePath hD.isTree).2 + ⟨hadj, Thomas.eq_treePath hD.isTree p hp ▸ hf_p⟩ + have hnot_t₁_t₂ : ¬ (T.deleteEdges {s(u, v)}).Reachable t₁ t₂ := + (Thomas.onTreePathEdge_iff_not_reachable_deleteEdges.1 hon_edge).2 + rcases reachable_deleteEdges_dichotomy hD.isTree hadj t₁ with ⟨ht₁_u, _⟩ | ⟨ht₁_v, _⟩ + · right + rcases reachable_deleteEdges_dichotomy hD.isTree hadj t₂ with ⟨ht₂_u, _⟩ | ⟨ht₂_v, _⟩ + · exact (hnot_t₁_t₂ (ht₁_u.symm.trans ht₂_u)).elim + · exact hstd.side_mem_tangle t₂ u v hadj ht₂_v + · left + exact hstd.side_mem_tangle t₁ u v hadj ht₁_v + have hsep₁ := isSeparation_of_makesSeparation hD hm₁ + have hsep₂ := isSeparation_of_makesSeparation hD hm₂ + have hA₁_A₂_eq_G : A₁ ∪ A₂ = G := by + have hle : A₁ ∪ A₂ ≤ G := GM10.union_le hsep₁.left_le hsep₂.left_le + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle le_rfl + (Set.Subset.antisymm hle.vertexSet_subset + (hsep₁.vertexSet_union ▸ Set.union_subset_union_right _ hB₁_A₂.vertexSet_subset)) + (Set.Subset.antisymm hle.edgeSet_subset + (hsep₁.edgeSet_union ▸ Set.union_subset_union_right _ hB₁_A₂.edgeSet_subset)) + have hnot_same : ∀ i : Fin n, ¬ ((A₁, B₁) ∈ 𝒯 i ∧ (A₂, B₂) ∈ 𝒯 i) := by + rintro i ⟨h₁, h₂⟩ + apply (h𝒯 i).axiom2 h₁ h₂ h₂ + rw [GM10.union_assoc, GM10.union_self, hA₁_A₂_eq_G] + have hex_ij : ∃ i j : Fin n, (i = t₁ ∧ j = t₂ ∨ i = t₂ ∧ j = t₁) ∧ + (A₁, B₁) ∈ 𝒯 i ∧ (A₂, B₂) ∈ 𝒯 j := by + rcases edge_mem_t₁_or_t₂ hf₁_p hm₁ with h₁ | h₁ <;> + rcases edge_mem_t₁_or_t₂ hf₂_p hm₂ with h₂ | h₂ + · exact (hnot_same t₁ ⟨h₁, h₂⟩).elim + · exact ⟨t₁, t₂, Or.inl ⟨rfl, rfl⟩, h₁, h₂⟩ + · exact ⟨t₂, t₁, Or.inr ⟨rfl, rfl⟩, h₁, h₂⟩ + · exact (hnot_same t₂ ⟨h₁, h₂⟩).elim + obtain ⟨i, j, hij_cases, h₁_i, h₂_j⟩ := hex_ij + have hij_ne : i ≠ j := fun heq ↦ hnot_same i ⟨h₁_i, heq ▸ h₂_j⟩ + have hord₁_lt_θ : separationOrder A₁ B₁ < θ := (h𝒯 i).order_lt h₁_i + have hordH_lt_θ : separationOrder H₁ H₂ < θ := hordH.trans hord₁_lt_θ + have hA₁_H₁_eq_G : A₁ ∪ H₁ = G := by + have hle : A₁ ∪ H₁ ≤ G := GM10.union_le hsep₁.left_le hsepH.left_le + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle le_rfl + (Set.Subset.antisymm hle.vertexSet_subset + (hsep₁.vertexSet_union ▸ Set.union_subset_union_right _ hB₁_H₁.vertexSet_subset)) + (Set.Subset.antisymm hle.edgeSet_subset + (hsep₁.edgeSet_union ▸ Set.union_subset_union_right _ hB₁_H₁.edgeSet_subset)) + have hA₂_H₂_eq_G : A₂ ∪ H₂ = G := by + have hle : A₂ ∪ H₂ ≤ G := GM10.union_le hsep₂.left_le hsepH.right_le + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle le_rfl + (Set.Subset.antisymm hle.vertexSet_subset + (hsep₂.vertexSet_union ▸ Set.union_subset_union_right _ hB₂_H₂.vertexSet_subset)) + (Set.Subset.antisymm hle.edgeSet_subset + (hsep₂.edgeSet_union ▸ Set.union_subset_union_right _ hB₂_H₂.edgeSet_subset)) + have hH₁_not_i : (H₁, H₂) ∉ 𝒯 i := fun hm ↦ by + apply (h𝒯 i).axiom2 h₁_i hm hm + rw [GM10.union_assoc, GM10.union_self, hA₁_H₁_eq_G] + have hH₂_i : (H₂, H₁) ∈ 𝒯 i := ((h𝒯 i).axiom1 hsepH hordH_lt_θ).resolve_left hH₁_not_i + have hH₂_not_j : (H₂, H₁) ∉ 𝒯 j := fun hm ↦ by + apply (h𝒯 j).axiom2 h₂_j hm hm + rw [GM10.union_assoc, GM10.union_self, hA₂_H₂_eq_G] + have hH₁_j : (H₁, H₂) ∈ 𝒯 j := ((h𝒯 j).axiom1 hsepH hordH_lt_θ).resolve_right hH₂_not_j + have hH_dist : GM10.Distinguishes (𝒯 i) (𝒯 j) H₂ H₁ := ⟨hH₂_i, hH₁_j⟩ + obtain ⟨e, he_T, he_path, _, C, D, hmCD, hdist_CD, _⟩ := hstd.path_min_isDistinction hij_ne + have he_p : e ∈ p.edges := by + rcases hij_cases with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact he_path p hp + · have hrev := he_path p.reverse hp.reverse + rwa [Walk.edges_reverse, List.mem_reverse] at hrev + have hlam_le : lam (C, D) ≤ lam (H₂, H₁) := hdist_CD.2 hH_dist + have hsepCD := isSeparation_of_makesSeparation hD hmCD + have hord_CD_le : separationOrder C D ≤ separationOrder H₂ H₁ := by + by_contra! hlt + exact not_lt_of_ge hlam_le (hlam.axiom3 hsepH.symm hsepCD hlt) + rw [GM10.separationOrder_comm H₂ H₁] at hord_CD_le + exact ⟨e, he_p, C, D, hmCD, hord_CD_le.trans_lt hordH⟩ + +end GraphMinor.GM18 diff --git a/LeanPool/GraphMinor/GM18/Section3.lean b/LeanPool/GraphMinor/GM18/Section3.lean new file mode 100644 index 0000000000..1e0cab91a9 --- /dev/null +++ b/LeanPool/GraphMinor/GM18/Section3.lean @@ -0,0 +1,1097 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM18.Section2 +import LeanPool.GraphMinor.GM10.TangleLemmas +import Mathlib.Algebra.Order.BigOperators.Group.Finset + +/-! +# Graph Minors XVIII, Section 3: Tree-Width of a Location + +This file formalizes Section 3 (pages 82–84) of Robertson and Seymour, +*Graph Minors. XVIII. Tree-decompositions and well-quasi-ordering*, J. Combin. Theory Ser. B 89 +(2003) 77–108: + +* `theorem_3_1` (3.1, page 82): invariance of titanicity of `(A, B)` under replacing `B` by `B'` + with `V(A ∩ B) = V(A ∩ B')` (or `A ∩ B = A ∩ B'`). +* `theorem_3_2` (3.2, page 82): transfer of a tangle across a titanic separation (from Graph + Minors X, (8.3)). +* `theorem_3_3` (3.3, page 82): if `(B, A) ∈ 𝒯` is linked to a tangle `𝒯` of order `≥ θ` and has + order `≤ (3/4) θ`, then `(A, B)` is titanic. +* `theorem_3_4` (3.4, page 84): if `ℒ` is a location of titanic separations in `G` of order `< θ` + (`θ ≥ 2`), then either `ℒ ⊆ 𝒯` for some tangle `𝒯` in `G` of order `θ`, or `ℒ` has tree-width + `≤ (3/2) θ`. +-/ + +public section + +namespace GraphMinor.GM18 + +open Hypergraph SimpleGraph + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ## Basic properties of `locationOrder` -/ + +theorem separationOrder_le_locationOrder {G : Hypergraph α β} + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hℒ : GM10.IsLocation G ℒ) + {p : Hypergraph α β × Hypergraph α β} (hp : p ∈ ℒ) : + separationOrder p.1 p.2 ≤ locationOrder ℒ := by + unfold locationOrder + exact le_csSup (hℒ.finite.image _).bddAbove ⟨p, hp, rfl⟩ + +theorem separationOrder_lt_of_locationOrder_lt {G : Hypergraph α β} + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hℒ : GM10.IsLocation G ℒ) + {θ : ℕ} (hord : locationOrder ℒ < θ) + {p : Hypergraph α β × Hypergraph α β} (hp : p ∈ ℒ) : + separationOrder p.1 p.2 < θ := + (separationOrder_le_locationOrder hℒ hp).trans_lt hord + +theorem locationOrder_lt_iff {G : Hypergraph α β} + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hℒ : GM10.IsLocation G ℒ) + {θ : ℕ} (hθ : 1 ≤ θ) : + locationOrder ℒ < θ ↔ ∀ ⦃p⦄, p ∈ ℒ → separationOrder p.1 p.2 < θ := by + refine ⟨fun h p hp ↦ separationOrder_lt_of_locationOrder_lt hℒ h hp, fun h ↦ ?_⟩ + unfold locationOrder + rcases Set.eq_empty_or_nonempty ℒ with rfl | hne + · simp + omega + · have himg_ne : ((fun p : Hypergraph α β × Hypergraph α β ↦ separationOrder p.1 p.2) '' + ℒ).Nonempty := + hne.image _ + obtain ⟨p, hp, hmax⟩ := Nat.sSup_mem himg_ne (hℒ.finite.image _).bddAbove + rw [← hmax] + exact h hp + +/-! ## (3.1) and (3.2) -/ + +/-- Version of **Graph Minors XVIII, (3.1)** (page 82) assuming only `V(A ∩ B) = V(A ∩ B')`: +if `(A, B)` is a separation of `G` and `(A, B')` is a separation of `G'` with +`V(A ∩ B) = V(A ∩ B')`, then `(A, B)` is titanic in `G` if and only if `(A, B')` is titanic in +`G'`. -/ +theorem isTitanic_iff_of_vertexSet_inter_eq {G G' A B B' : Hypergraph α β} + (hAB : G.IsSeparation A B) (hAB' : G'.IsSeparation A B') + (hV : (A ∩ B).vertexSet = (A ∩ B').vertexSet) : + GM10.IsTitanic G A B ↔ GM10.IsTitanic G' A B' := by + have sub_inter_eq : ∀ {H : Hypergraph α β}, H ≤ A → + (H ∩ B).vertexSet = (H ∩ B').vertexSet := by + intro H hH + have h1 : (H ∩ B).vertexSet = H.vertexSet ∩ (A ∩ B).vertexSet := by + ext v + simp only [GM10.inter_vertexSet, Set.mem_inter_iff] + exact ⟨fun ⟨hvH, hvB⟩ ↦ ⟨hvH, hH.vertexSet_subset hvH, hvB⟩, + fun ⟨hvH, _, hvB⟩ ↦ ⟨hvH, hvB⟩⟩ + have h2 : (H ∩ B').vertexSet = H.vertexSet ∩ (A ∩ B').vertexSet := by + ext v + simp only [GM10.inter_vertexSet, Set.mem_inter_iff] + exact ⟨fun ⟨hvH, hvB'⟩ ↦ ⟨hvH, hH.vertexSet_subset hvH, hvB'⟩, + fun ⟨hvH, _, hvB'⟩ ↦ ⟨hvH, hvB'⟩⟩ + rw [h1, hV, ← h2] + constructor + · intro h + refine ⟨hAB', fun X Y Z hX hY hZ hU hdXY hdYZ hdXZ ↦ ?_⟩ + rw [← sub_inter_eq (GM10.union_le hX hY), ← sub_inter_eq (GM10.union_le hY hZ), + ← sub_inter_eq (GM10.union_le hZ hX)] + exact h.2 hX hY hZ hU hdXY hdYZ hdXZ + · intro h + refine ⟨hAB, fun X Y Z hX hY hZ hU hdXY hdYZ hdXZ ↦ ?_⟩ + rw [sub_inter_eq (GM10.union_le hX hY), sub_inter_eq (GM10.union_le hY hZ), + sub_inter_eq (GM10.union_le hZ hX)] + exact h.2 hX hY hZ hU hdXY hdYZ hdXZ + +/-- **Graph Minors XVIII, (3.1)** (page 82): +"Let $(A, B)$ be a separation of a hypergraph $G$, and let $(A, B')$ be a separation of a +hypergraph $G'$, with $A \cap B = A \cap B'$. Then $(A, B)$ is titanic if and only if $(A, +B')$ is titanic." -/ +theorem theorem_3_1_proof {G G' A B B' : Hypergraph α β} + (hAB : G.IsSeparation A B) (hAB' : G'.IsSeparation A B') + (hinter : A ∩ B = A ∩ B') : + GM10.IsTitanic G A B ↔ GM10.IsTitanic G' A B' := + isTitanic_iff_of_vertexSet_inter_eq hAB hAB' (congrArg Hypergraph.vertexSet hinter) + +/-- **Graph Minors XVIII, (3.2)** (page 82): +"Let $(C, D)$ be a separation of a hypergraph $G$, and let $(C', D)$ be a titanic separation +of a hypergraph $G'$, with $V(C \cap D) = V(C' \cap D)$. Let $\mathscr{T}$ be a tangle in +$G$ of order $\theta \ge 2$ with $(C, D) \in \mathscr{T}$. Let $\mathscr{T}'$ be the set of +all separations $(A', B')$ of $G'$ of order $< \theta$ such that there exists $(A, B) \in +\mathscr{T}$ with $E(A \cap D) = E(A' \cap D)$. Then $\mathscr{T}'$ is a tangle in $G'$ of +order $\theta$." -/ +theorem theorem_3_2_proof + {G G' C C' D : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + (hCD : G.IsSeparation C D) + (hC'D : GM10.IsTitanic G' C' D) + (hV : (C ∩ D).vertexSet = (C' ∩ D).vertexSet) + (h𝒯 : GM10.IsTangle G θ 𝒯) + (hθ : 2 ≤ θ) + (hmem : (C, D) ∈ 𝒯) : + GM10.IsTangle G' θ (GM10.titanicTransferredTangle G' D 𝒯 θ) := + gm10Theorem83 G G' C C' D 𝒯 θ hCD hC'D hV h𝒯 hθ hmem + +/-! ## (3.3): Linked Separations of Order `≤ (3/4) θ` are Titanic -/ + +private theorem separation_of_triple_union {G A B X₁ X₂ X₃ : Hypergraph α β} + (hAB : G.IsSeparation A B) + (hX₁ : X₁ ≤ A) (hX₂ : X₂ ≤ A) (hX₃ : X₃ ≤ A) + (hU : X₁ ∪ X₂ ∪ X₃ = A) + (hd12 : Disjoint X₁.edgeSet X₂.edgeSet) + (hd13 : Disjoint X₁.edgeSet X₃.edgeSet) : + A.IsSeparation X₁ (X₂ ∪ X₃) ∧ + G.IsSeparation X₁ (B ∪ (X₂ ∪ X₃)) ∧ + G.IsSeparation (X₁ ∪ B) (X₂ ∪ X₃) := by + have hsepA : A.IsSeparation X₁ (X₂ ∪ X₃) := by + rw [GM10.isSeparation_iff_of_le hX₁ (GM10.union_le hX₂ hX₃)] + refine ⟨?_, ?_, ?_⟩ + · rw [← GM10.union_vertexSet, ← GM10.union_assoc, hU] + · rw [← GM10.union_edgeSet, ← GM10.union_assoc, hU] + · rw [GM10.union_edgeSet, ← Set.disjoint_iff_inter_eq_empty] + exact hd12.union_right hd13 + have hsepG₁ : G.IsSeparation X₁ (B ∪ (X₂ ∪ X₃)) := + isSeparation_left_split hAB hsepA + have hsepG₂ : G.IsSeparation (X₁ ∪ B) (X₂ ∪ X₃) := by + have h := (isSeparation_left_split hAB hsepA.symm).symm + rwa [GM10.union_comm B X₁] at h + exact ⟨hsepA, hsepG₁, hsepG₂⟩ + +private theorem finset_card_triple_bound [DecidableEq α] (W₁ W₂ W₃ : Finset α) : + 2 * ((W₂ ∪ W₃) \ W₁).card + ((W₂ ∪ W₃) ∩ W₁).card + + (2 * ((W₃ ∪ W₁) \ W₂).card + ((W₃ ∪ W₁) ∩ W₂).card) + + (2 * ((W₁ ∪ W₂) \ W₃).card + ((W₁ ∪ W₂) ∩ W₃).card) ≤ + 4 * (W₁ ∪ W₂ ∪ W₃).card := by + let S := W₁ ∪ W₂ ∪ W₃ + have hsub : ∀ A : Finset α, A ⊆ S → A.card = ∑ x ∈ S, if x ∈ A then 1 else 0 := by + intro A hA + rw [Finset.sum_boole, Nat.cast_id, Finset.filter_mem_eq_inter, + Finset.inter_eq_right.2 hA] + have hs1 : (W₂ ∪ W₃) \ W₁ ⊆ S := + Finset.sdiff_subset.trans (Finset.union_subset + (Finset.subset_union_right.trans Finset.subset_union_left) Finset.subset_union_right) + have hi1 : (W₂ ∪ W₃) ∩ W₁ ⊆ S := + Finset.inter_subset_right.trans + (Finset.subset_union_left.trans Finset.subset_union_left) + have hs2 : (W₃ ∪ W₁) \ W₂ ⊆ S := + Finset.sdiff_subset.trans (Finset.union_subset Finset.subset_union_right + (Finset.subset_union_left.trans Finset.subset_union_left)) + have hi2 : (W₃ ∪ W₁) ∩ W₂ ⊆ S := + Finset.inter_subset_right.trans + (Finset.subset_union_right.trans Finset.subset_union_left) + have hs3 : (W₁ ∪ W₂) \ W₃ ⊆ S := + Finset.sdiff_subset.trans Finset.subset_union_left + have hi3 : (W₁ ∪ W₂) ∩ W₃ ⊆ S := + Finset.inter_subset_right.trans Finset.subset_union_right + rw [hsub _ hs1, hsub _ hi1, hsub _ hs2, hsub _ hi2, hsub _ hs3, hsub _ hi3, + hsub S Finset.Subset.rfl] + simp only [Finset.mul_sum, ← Finset.sum_add_distrib] + refine Finset.sum_le_sum fun x _ ↦ ?_ + simp only [Finset.mem_sdiff, Finset.mem_union, Finset.mem_inter] + by_cases h1 : x ∈ W₁ <;> by_cases h2 : x ∈ W₂ <;> by_cases h3 : x ∈ W₃ <;> simp [S, h1, h2, h3] + +/-- **Graph Minors XVIII, (3.3)** (page 82): +"**3.3.** *Let $\mathscr{T}$ be a tangle of order $\ge \theta$ in a hypergraph $G$ and let +$(B, A) \in \mathscr{T}$ be linked to $\mathscr{T}$ and have order $\le \frac{3}{4}\theta$. +Then $(A, B)$ is titanic.*" + +This is the case where the tangle has order exactly `θ`. The printed form, with a tangle of order +`≥ θ`, is `GM18.theorem_3_3`. -/ +theorem theorem_3_3_proof {G A B : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : GM10.IsTangle G θ 𝒯) + (hlink : IsLinkedTo 𝒯 B A) + (hord : 4 * separationOrder B A ≤ 3 * θ) : + GM10.IsTitanic G A B := by + classical + have hBA : (B, A) ∈ 𝒯 := hlink.1 + have hsepAB : G.IsSeparation A B := (h𝒯.isSeparation hBA).symm + refine ⟨hsepAB, fun X₁ X₂ X₃ hX₁ hX₂ hX₃ hU hd12 hd23 hd13 ↦ ?_⟩ + by_contra! hnot + rcases hnot with ⟨hlt3, hlt1, hlt2⟩ + -- For any cyclic permutation (Y₁, Y₂, Y₃) of (X₁, X₂, X₃) satisfying + -- `|((Y₂ ∪ Y₃) ∩ Y₁).vertexSet| < |((Y₂ ∪ Y₃) ∩ B).vertexSet|`, + -- we show `(Y₁, B ∪ (Y₂ ∪ Y₃)) ∈ 𝒯` and then `θ < 2 * |((Y₂ ∪ Y₃) ∩ B) \ (Y₁ ∩ B)| + |((Y₂ ∪ Y₃) + -- ∩ B) ∩ (Y₁ ∩ B)|`. + have step_in_tangle : ∀ {Y₁ Y₂ Y₃ : Hypergraph α β}, + Y₁ ≤ A → Y₂ ≤ A → Y₃ ≤ A → Y₁ ∪ Y₂ ∪ Y₃ = A → + Disjoint Y₁.edgeSet Y₂.edgeSet → + Disjoint Y₁.edgeSet Y₃.edgeSet → + ((Y₂ ∪ Y₃) ∩ Y₁).vertexSet.ncard < ((Y₂ ∪ Y₃) ∩ B).vertexSet.ncard → + (Y₁, B ∪ (Y₂ ∪ Y₃)) ∈ 𝒯 := by + intro Y₁ Y₂ Y₃ hY₁ hY₂ hY₃ hUY hd1 hd3 hltY + have ⟨_, hsepG₁, _⟩ := separation_of_triple_union hsepAB hY₁ hY₂ hY₃ hUY hd1 hd3 + by_contra hnot_mem + have hord_ge : separationOrder B A ≤ separationOrder Y₁ (B ∪ (Y₂ ∪ Y₃)) := by + by_cases hlt_θ : separationOrder Y₁ (B ∪ (Y₂ ∪ Y₃)) < θ + · have hswap : (B ∪ (Y₂ ∪ Y₃), Y₁) ∈ 𝒯 := + (h𝒯.axiom1 hsepG₁ hlt_θ).resolve_left hnot_mem + have hB_le : B ≤ B ∪ (Y₂ ∪ Y₃) := + GM10.le_union_left hsepAB.right_le + ((GM10.union_le hY₂ hY₃).trans hsepAB.left_le) + have hle := hlink.2 hswap hB_le hY₁ + rwa [GM10.separationOrder_comm _ Y₁] at hle + · exact (h𝒯.order_lt hBA).le.trans (not_lt.1 hlt_θ) + -- Now compare `separationOrder Y₁ (B ∪ (Y₂ ∪ Y₃))` and `separationOrder B A`: + have hsub1 : (Y₁ ∩ (B ∪ (Y₂ ∪ Y₃))).vertexSet ⊆ + ((Y₂ ∪ Y₃) ∩ Y₁).vertexSet ∪ ((Y₁ ∩ B).vertexSet \ ((Y₂ ∪ Y₃) ∩ B).vertexSet) := by + intro v ⟨hv₁, hvB23⟩ + simp only [GM10.union_vertexSet, Set.mem_union] at hvB23 + rcases hvB23 with hvB | hv23 + · by_cases hv23' : v ∈ (Y₂ ∪ Y₃).vertexSet + · exact Or.inl ⟨hv23', hv₁⟩ + · exact Or.inr ⟨⟨hv₁, hvB⟩, fun h ↦ hv23' h.1⟩ + · exact Or.inl ⟨hv23, hv₁⟩ + have hfin1 : ((Y₂ ∪ Y₃) ∩ Y₁).vertexSet.Finite := ((Y₂ ∪ Y₃) ∩ Y₁).vertexSet_finite + have hfin2 : ((Y₁ ∩ B).vertexSet \ ((Y₂ ∪ Y₃) ∩ B).vertexSet).Finite := + (Y₁ ∩ B).vertexSet_finite.sdiff + have hcard_upper : separationOrder Y₁ (B ∪ (Y₂ ∪ Y₃)) ≤ + ((Y₂ ∪ Y₃) ∩ Y₁).vertexSet.ncard + + ((Y₁ ∩ B).vertexSet \ ((Y₂ ∪ Y₃) ∩ B).vertexSet).ncard := + (Set.ncard_le_ncard hsub1 (hfin1.union hfin2)).trans (Set.ncard_union_le _ _) + have hAB_eq : (B ∩ A).vertexSet = + ((Y₂ ∪ Y₃) ∩ B).vertexSet ∪ ((Y₁ ∩ B).vertexSet \ ((Y₂ ∪ Y₃) ∩ B).vertexSet) := by + have hVA : A.vertexSet = (Y₁ ∪ (Y₂ ∪ Y₃)).vertexSet := by + rw [← GM10.union_assoc, hUY] + ext v + simp only [GM10.inter_vertexSet, GM10.union_vertexSet, Set.mem_inter_iff, Set.mem_union, + Set.mem_sdiff] + rw [hVA] + simp only [GM10.union_vertexSet, Set.mem_union] + tauto + have hdisj_W : Disjoint ((Y₂ ∪ Y₃) ∩ B).vertexSet + ((Y₁ ∩ B).vertexSet \ ((Y₂ ∪ Y₃) ∩ B).vertexSet) := + disjoint_sdiff_self_right + have hcard_AB : separationOrder B A = + ((Y₂ ∪ Y₃) ∩ B).vertexSet.ncard + + ((Y₁ ∩ B).vertexSet \ ((Y₂ ∪ Y₃) ∩ B).vertexSet).ncard := by + unfold separationOrder + rw [hAB_eq, Set.ncard_union_eq hdisj_W ((Y₂ ∪ Y₃) ∩ B).vertexSet_finite hfin2] + omega + have hU231 : X₂ ∪ X₃ ∪ X₁ = A := by + rw [GM10.union_assoc, GM10.union_comm X₃ X₁, ← GM10.union_assoc, + GM10.union_comm X₂ X₁, hU] + have hU312 : X₃ ∪ X₁ ∪ X₂ = A := by + rw [GM10.union_comm (X₃ ∪ X₁) X₂, ← GM10.union_assoc, hU231] + have hm1 : (X₁, B ∪ (X₂ ∪ X₃)) ∈ 𝒯 := + step_in_tangle hX₁ hX₂ hX₃ hU hd12 hd13 hlt1 + have hm2 : (X₂, B ∪ (X₃ ∪ X₁)) ∈ 𝒯 := + step_in_tangle hX₂ hX₃ hX₁ hU231 hd23 hd12.symm hlt2 + have hm3 : (X₃, B ∪ (X₁ ∪ X₂)) ∈ 𝒯 := + step_in_tangle hX₃ hX₁ hX₂ hU312 hd13.symm hd23.symm hlt3 + -- Next, for each cyclic permutation, `θ ≤ separationOrder (Y₁ ∪ B) (Y₂ ∪ Y₃)` + have step_theta_lt : ∀ {Y₁ Y₂ Y₃ : Hypergraph α β}, + Y₁ ≤ A → Y₂ ≤ A → Y₃ ≤ A → Y₁ ∪ Y₂ ∪ Y₃ = A → + Disjoint Y₁.edgeSet Y₂.edgeSet → + Disjoint Y₁.edgeSet Y₃.edgeSet → + (Y₁, B ∪ (Y₂ ∪ Y₃)) ∈ 𝒯 → + (Y₂, B ∪ (Y₃ ∪ Y₁)) ∈ 𝒯 → + (Y₃, B ∪ (Y₁ ∪ Y₂)) ∈ 𝒯 → + ((Y₂ ∪ Y₃) ∩ Y₁).vertexSet.ncard < ((Y₂ ∪ Y₃) ∩ B).vertexSet.ncard → + θ < 2 * (((Y₂ ∪ Y₃) ∩ B).vertexSet \ (Y₁ ∩ B).vertexSet).ncard + + (((Y₂ ∪ Y₃) ∩ B).vertexSet ∩ (Y₁ ∩ B).vertexSet).ncard := by + intro Y₁ Y₂ Y₃ hY₁ hY₂ hY₃ hUY hd1 hd3 hY1_T hY2_T hY3_T hltY + have ⟨_, _, hsepG₂⟩ := separation_of_triple_union hsepAB hY₁ hY₂ hY₃ hUY hd1 hd3 + have hnot1 : (Y₁ ∪ B, Y₂ ∪ Y₃) ∉ 𝒯 := by + intro hm + apply h𝒯.axiom2 hm hY2_T hY3_T + have hle : Y₁ ∪ B ∪ Y₂ ∪ Y₃ ≤ G := + GM10.union_le + (GM10.union_le (GM10.union_le (hY₁.trans hsepAB.left_le) hsepAB.right_le) + (hY₂.trans hsepAB.left_le)) + (hY₃.trans hsepAB.left_le) + have h_eq : Y₁ ∪ B ∪ Y₂ ∪ Y₃ = (Y₁ ∪ Y₂ ∪ Y₃) ∪ B := by + ext <;> simp [Set.union_comm, Set.union_left_comm, or_assoc, or_comm] + rw [h_eq, hUY, hsepAB.union_eq] + have hnot2 : (Y₂ ∪ Y₃, Y₁ ∪ B) ∉ 𝒯 := by + intro hm + apply h𝒯.axiom2 hm hY1_T hBA + have h_eq : (Y₂ ∪ Y₃) ∪ Y₁ ∪ B = (Y₁ ∪ Y₂ ∪ Y₃) ∪ B := by + ext <;> simp [Set.union_comm, Set.union_left_comm, or_assoc, or_comm] + rw [h_eq, hUY, hsepAB.union_eq] + have hge_θ : θ ≤ separationOrder (Y₁ ∪ B) (Y₂ ∪ Y₃) := by + by_contra! hlt_θ + exact (h𝒯.axiom1 hsepG₂ hlt_θ).elim hnot1 hnot2 + have hsub2 : ((Y₁ ∪ B) ∩ (Y₂ ∪ Y₃)).vertexSet ⊆ + ((Y₂ ∪ Y₃) ∩ Y₁).vertexSet ∪ (((Y₂ ∪ Y₃) ∩ B).vertexSet \ (Y₁ ∩ B).vertexSet) := by + intro v ⟨hv1B, hv23⟩ + simp only [GM10.union_vertexSet, Set.mem_union] at hv1B + rcases hv1B with hv1 | hvB + · exact Or.inl ⟨hv23, hv1⟩ + · by_cases hv1 : v ∈ Y₁.vertexSet + · exact Or.inl ⟨hv23, hv1⟩ + · exact Or.inr ⟨⟨hv23, hvB⟩, fun h ↦ hv1 h.1⟩ + have hfinA : ((Y₂ ∪ Y₃) ∩ Y₁).vertexSet.Finite := ((Y₂ ∪ Y₃) ∩ Y₁).vertexSet_finite + have hfinB : (((Y₂ ∪ Y₃) ∩ B).vertexSet \ (Y₁ ∩ B).vertexSet).Finite := + ((Y₂ ∪ Y₃) ∩ B).vertexSet_finite.sdiff + have hcard_sep : separationOrder (Y₁ ∪ B) (Y₂ ∪ Y₃) ≤ + ((Y₂ ∪ Y₃) ∩ Y₁).vertexSet.ncard + + (((Y₂ ∪ Y₃) ∩ B).vertexSet \ (Y₁ ∩ B).vertexSet).ncard := + (Set.ncard_le_ncard hsub2 (hfinA.union hfinB)).trans (Set.ncard_union_le _ _) + have hsplit : ((Y₂ ∪ Y₃) ∩ B).vertexSet.ncard = + (((Y₂ ∪ Y₃) ∩ B).vertexSet \ (Y₁ ∩ B).vertexSet).ncard + + (((Y₂ ∪ Y₃) ∩ B).vertexSet ∩ (Y₁ ∩ B).vertexSet).ncard := by + have hdisj_si : Disjoint (((Y₂ ∪ Y₃) ∩ B).vertexSet \ (Y₁ ∩ B).vertexSet) + (((Y₂ ∪ Y₃) ∩ B).vertexSet ∩ (Y₁ ∩ B).vertexSet) := + Set.disjoint_iff.2 fun v ⟨⟨_, hnot⟩, ⟨_, hin⟩⟩ ↦ hnot hin + rw [← Set.ncard_union_eq hdisj_si hfinB + (((Y₂ ∪ Y₃) ∩ B).vertexSet_finite.inter_of_left _), + Set.sdiff_union_inter] + omega + have hb1 := step_theta_lt hX₁ hX₂ hX₃ hU hd12 hd13 hm1 hm2 hm3 hlt1 + have hb2 := step_theta_lt hX₂ hX₃ hX₁ hU231 hd23 hd12.symm hm2 hm3 hm1 hlt2 + have hb3 := step_theta_lt hX₃ hX₁ hX₂ hU312 hd13.symm hd23.symm hm3 hm1 hm2 hlt3 + -- Convert the sets `(Xᵢ ∩ B).vertexSet` to `Finset α` and apply `finset_card_triple_bound` + let fW₁ := (X₁ ∩ B).vertexSet_finite.toFinset + let fW₂ := (X₂ ∩ B).vertexSet_finite.toFinset + let fW₃ := (X₃ ∩ B).vertexSet_finite.toFinset + have toFinset_union_inter : ∀ {Y₂ Y₃ : Hypergraph α β}, + ((Y₂ ∪ Y₃) ∩ B).vertexSet = (Y₂ ∩ B).vertexSet ∪ (Y₃ ∩ B).vertexSet := by + intro Y₂ Y₃ + ext v + simp only [GM10.inter_vertexSet, GM10.union_vertexSet, Set.mem_inter_iff, Set.mem_union] + exact or_and_right + have ncard_sdiff_eq : ∀ {Y₁ Y₂ Y₃ : Hypergraph α β} (f1 f2 f3 : Finset α), + (f1 : Set α) = (Y₁ ∩ B).vertexSet → + (f2 : Set α) = (Y₂ ∩ B).vertexSet → + (f3 : Set α) = (Y₃ ∩ B).vertexSet → + (((Y₂ ∪ Y₃) ∩ B).vertexSet \ (Y₁ ∩ B).vertexSet).ncard = ((f2 ∪ f3) \ f1).card ∧ + (((Y₂ ∪ Y₃) ∩ B).vertexSet ∩ (Y₁ ∩ B).vertexSet).ncard = ((f2 ∩ f1) ∪ (f3 ∩ f1)).card := by + intro Y₁ Y₂ Y₃ f1 f2 f3 hf1 hf2 hf3 + rw [toFinset_union_inter, ← hf1, ← hf2, ← hf3] + constructor + · rw [← Finset.coe_union, ← Finset.coe_sdiff, Set.ncard_coe_finset] + · rw [← Finset.coe_union, ← Finset.coe_inter, Set.ncard_coe_finset, + Finset.union_inter_distrib_right] + have ⟨hs1_eq, hi1_eq⟩ := ncard_sdiff_eq fW₁ fW₂ fW₃ + (Set.Finite.coe_toFinset _) (Set.Finite.coe_toFinset _) (Set.Finite.coe_toFinset _) + have ⟨hs2_eq, hi2_eq⟩ := ncard_sdiff_eq fW₂ fW₃ fW₁ + (Set.Finite.coe_toFinset _) (Set.Finite.coe_toFinset _) (Set.Finite.coe_toFinset _) + have ⟨hs3_eq, hi3_eq⟩ := ncard_sdiff_eq fW₃ fW₁ fW₂ + (Set.Finite.coe_toFinset _) (Set.Finite.coe_toFinset _) (Set.Finite.coe_toFinset _) + rw [ ← Finset.union_inter_distrib_right] at hi1_eq hi2_eq hi3_eq + have hfin_bound := finset_card_triple_bound fW₁ fW₂ fW₃ + have hW_union_eq : (fW₁ ∪ fW₂ ∪ fW₃).card = separationOrder B A := by + have hset : ((fW₁ ∪ fW₂ ∪ fW₃ : Finset α) : Set α) = (B ∩ A).vertexSet := by + rw [Finset.coe_union, Finset.coe_union, Set.Finite.coe_toFinset, + Set.Finite.coe_toFinset, Set.Finite.coe_toFinset] + have hVA : A.vertexSet = (X₁ ∪ X₂ ∪ X₃).vertexSet := hU.symm ▸ rfl + ext v + simp only [GM10.inter_vertexSet, Set.mem_union, Set.mem_inter_iff, hVA, + GM10.union_vertexSet] + tauto + unfold separationOrder + rw [← hset, Set.ncard_coe_finset] + omega + +/-! ## (3.4): Titanic Locations and Tree-Width -/ + +@[expose] public section + +/-- Embeds a `Hypergraph α β` into `Hypergraph α (β ⊕ γ)` via `Sum.inl`. -/ +def mapInl (γ : Type*) (G : Hypergraph α β) : Hypergraph α (β ⊕ γ) where + vertexSet := G.vertexSet + edgeSet := Sum.inl '' G.edgeSet + Inc e v := + match e with + | Sum.inl e₀ => G.Inc e₀ v + | Sum.inr _ => False + vertex_mem_of_inc e v h := by + cases e with + | inl e₀ => exact G.vertex_mem_of_inc h + | inr _ => exact h.elim + edge_mem_of_inc e v h := by + cases e with + | inl e₀ => exact ⟨e₀, G.edge_mem_of_inc h, rfl⟩ + | inr _ => exact h.elim + vertexSet_finite := G.vertexSet_finite + edgeSet_finite := G.edgeSet_finite.image Sum.inl + +end + +/-- Pulls back a `Hypergraph α (β ⊕ γ)` along `Sum.inl`. -/ +def comapInl {γ : Type*} (H : Hypergraph α (β ⊕ γ)) : Hypergraph α β where + vertexSet := H.vertexSet + edgeSet := Sum.inl ⁻¹' H.edgeSet + Inc e v := H.Inc (Sum.inl e) v + vertex_mem_of_inc _ _ h := H.vertex_mem_of_inc h + edge_mem_of_inc _ _ h := H.edge_mem_of_inc h + vertexSet_finite := H.vertexSet_finite + edgeSet_finite := H.edgeSet_finite.preimage Sum.inl_injective.injOn + +@[simp] +theorem comapInl_mapInl (γ : Type*) (G : Hypergraph α β) : + comapInl (mapInl γ G) = G := by + ext v e + · rfl + · simp [comapInl, mapInl] + · rfl + +theorem mapInl_comapInl_of_le {γ : Type*} {G : Hypergraph α β} + {H : Hypergraph α (β ⊕ γ)} (h : H ≤ mapInl γ G) : + mapInl γ (comapInl H) = H := by + have hle : mapInl γ (comapInl H) ≤ mapInl γ G := by + refine ⟨h.vertexSet_subset, ?_, ?_⟩ + · rintro _ ⟨e, he, rfl⟩ + exact h.edgeSet_subset he + · rintro _ ⟨e, he, rfl⟩ + exact h.ends_eq (Sum.inl e) he + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle h rfl ?_ + ext x + cases x with + | inl e => simp [mapInl, comapInl] + | inr c => + simp only [mapInl, Set.mem_image, reduceCtorEq, and_false, exists_false, false_iff] + intro hc + rcases h.edgeSet_subset hc with ⟨e, _, hce⟩ + cases hce + +theorem mapInl_mono (γ : Type*) {H₁ H₂ : Hypergraph α β} (h : H₁ ≤ H₂) : + mapInl γ H₁ ≤ mapInl γ H₂ where + vertexSet_subset := h.vertexSet_subset + edgeSet_subset := Set.image_mono h.edgeSet_subset + ends_eq e he := by + rcases he with ⟨e₀, he₀, rfl⟩ + exact h.ends_eq e₀ he₀ + +theorem mapInl_union (γ : Type*) (H₁ H₂ : Hypergraph α β) : + mapInl γ (H₁ ∪ H₂) = mapInl γ H₁ ∪ mapInl γ H₂ := by + ext v e + · rfl + · simp [mapInl, Set.image_union] + · cases v <;> simp [mapInl] + +@[simp] +theorem comapInl_union {γ : Type*} (H₁ H₂ : Hypergraph α (β ⊕ γ)) : + comapInl (H₁ ∪ H₂) = comapInl H₁ ∪ comapInl H₂ := by + ext <;> rfl + +theorem mapInl_inter (γ : Type*) (H₁ H₂ : Hypergraph α β) : + mapInl γ (H₁ ∩ H₂) = mapInl γ H₁ ∩ mapInl γ H₂ := by + ext v e + · rfl + · simp [mapInl, Set.image_inter Sum.inl_injective] + · cases v <;> simp [mapInl] + +/-- The subhypergraph `C_i` of `locationHeart G ℒ` for `p = (A_i, B_i) ∈ ℒ`, with vertex set +`V(A_i ∩ B_i)` and single edge `Sum.inr p` (Graph Minors XVIII, Section 3, proof of (3.4), +page 84). -/ +def locationHeartEdge (p : Hypergraph α β × Hypergraph α β) : + Hypergraph α (β ⊕ (Hypergraph α β × Hypergraph α β)) where + vertexSet := (p.1 ∩ p.2).vertexSet + edgeSet := {Sum.inr p} + Inc e v := e = Sum.inr p ∧ v ∈ (p.1 ∩ p.2).vertexSet + vertex_mem_of_inc _ _ h := h.2 + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := (p.1 ∩ p.2).vertexSet_finite + edgeSet_finite := Set.finite_singleton _ + +/-- The ambient hypergraph containing both `mapInl _ G` and `locationHeart G ℒ`. -/ +def locationAmbient (G : Hypergraph α β) + (ℒ : Set (Hypergraph α β × Hypergraph α β)) : + Hypergraph α (β ⊕ (Hypergraph α β × Hypergraph α β)) := + mapInl (Hypergraph α β × Hypergraph α β) G ∪ locationHeart G ℒ + +theorem mapInl_le_locationAmbient {G H : Hypergraph α β} + (ℒ : Set (Hypergraph α β × Hypergraph α β)) (hH : H ≤ G) : + mapInl (Hypergraph α β × Hypergraph α β) H ≤ locationAmbient G ℒ where + vertexSet_subset := hH.vertexSet_subset.trans Set.subset_union_left + edgeSet_subset := (Set.image_mono hH.edgeSet_subset).trans Set.subset_union_left + ends_eq e he := by + rcases he with ⟨e₀, he₀, rfl⟩ + ext v + change (G.Inc e₀ v ∨ (GM10.locationCore G ℒ).Inc e₀ v) ↔ H.Inc e₀ v + have hcore_imp : (GM10.locationCore G ℒ).Inc e₀ v → G.Inc e₀ v := fun hc ↦ hc.1 + rw [or_iff_left_of_imp hcore_imp] + exact Set.ext_iff.1 (hH.ends_eq e₀ he₀) v + +theorem locationHeartEdge_le_locationAmbient {G : Hypergraph α β} + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hℒ : GM10.IsLocation G ℒ) + {p : Hypergraph α β × Hypergraph α β} (hp : p ∈ ℒ) : + locationHeartEdge p ≤ locationAmbient G ℒ where + vertexSet_subset := by + have hsub : (p.1 ∩ p.2).vertexSet ⊆ G.vertexSet := + Set.inter_subset_left.trans (hℒ.isSeparation hp).left_le.vertexSet_subset + exact hsub.trans Set.subset_union_left + edgeSet_subset := by + rintro _ rfl + refine Or.inr (Or.inr ⟨p, ⟨hp, hℒ.isSeparation hp, ?_⟩, rfl⟩) + rw [← (theorem_2_3_2 hℒ hp).2] + exact Set.inter_subset_right + ends_eq e he := by + rcases Set.mem_singleton_iff.1 he with rfl + ext v + have hsub : (p.1 ∩ p.2).vertexSet ⊆ (GM10.locationCore G ℒ).vertexSet := by + rw [← (theorem_2_3_2 hℒ hp).2] + exact Set.inter_subset_right + change (False ∨ (p ∈ ℒ ∧ G.IsSeparation p.1 p.2 ∧ + (p.1 ∩ p.2).vertexSet ⊆ (GM10.locationCore G ℒ).vertexSet ∧ + v ∈ (p.1 ∩ p.2).vertexSet)) ↔ + (Sum.inr p = Sum.inr p ∧ v ∈ (p.1 ∩ p.2).vertexSet) + exact ⟨fun h ↦ ⟨rfl, (h.resolve_left id).2.2.2⟩, + fun h ↦ Or.inr ⟨hp, hℒ.isSeparation hp, hsub, h.2⟩⟩ + +open Classical in +/-- The intermediate hypergraph `H_S` in the proof of (3.4) (page 84): for `S ⊆ ℒ`, the elements +of `S` have `A_p` (via `mapInl`) and the elements of `ℒ \ S` have `C_p` (`locationHeartEdge p`). -/ +noncomputable def locationStepHypergraph (G : Hypergraph α β) + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hℒ : GM10.IsLocation G ℒ) + (S : Finset (Hypergraph α β × Hypergraph α β)) : + Hypergraph α (β ⊕ (Hypergraph α β × Hypergraph α β)) := + mapInl _ (GM10.locationCore G ℒ) ∪ + Hypergraph.biUnion S (fun p ↦ mapInl _ p.1) ∪ + Hypergraph.biUnion (hℒ.finite.toFinset \ S) locationHeartEdge + +open Classical in +/-- The side hypergraph `B_{p, S}` in the proof of (3.4) (page 84). -/ +noncomputable def locationStepSide (G : Hypergraph α β) + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hℒ : GM10.IsLocation G ℒ) + (S : Finset (Hypergraph α β × Hypergraph α β)) + (p : Hypergraph α β × Hypergraph α β) : + Hypergraph α (β ⊕ (Hypergraph α β × Hypergraph α β)) := + mapInl _ (GM10.locationCore G ℒ) ∪ + Hypergraph.biUnion (S.erase p) (fun q ↦ mapInl _ q.1) ∪ + Hypergraph.biUnion ((hℒ.finite.toFinset \ S).erase p) locationHeartEdge + +open Classical in +theorem locationStepHypergraph_le_ambient {G : Hypergraph α β} + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hℒ : GM10.IsLocation G ℒ) + {S : Finset (Hypergraph α β × Hypergraph α β)} (hS : S ⊆ hℒ.finite.toFinset) : + locationStepHypergraph G hℒ S ≤ locationAmbient G ℒ := by + refine GM10.union_le (GM10.union_le (mapInl_le_locationAmbient ℒ (locationCore_le hℒ)) ?_) ?_ + · refine biUnion_le fun q hq ↦ ?_ + have hq_mem : q ∈ ℒ := hℒ.finite.mem_toFinset.1 (hS hq) + exact mapInl_le_locationAmbient ℒ (hℒ.isSeparation hq_mem).left_le + · refine biUnion_le fun q hq ↦ ?_ + have hq_mem : q ∈ ℒ := hℒ.finite.mem_toFinset.1 (Finset.sdiff_subset hq) + exact locationHeartEdge_le_locationAmbient hℒ hq_mem + +open Classical in +theorem locationStepSide_le_ambient {G : Hypergraph α β} + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hℒ : GM10.IsLocation G ℒ) + {S : Finset (Hypergraph α β × Hypergraph α β)} (hS : S ⊆ hℒ.finite.toFinset) + (p : Hypergraph α β × Hypergraph α β) : + locationStepSide G hℒ S p ≤ locationAmbient G ℒ := by + refine GM10.union_le (GM10.union_le (mapInl_le_locationAmbient ℒ (locationCore_le hℒ)) ?_) ?_ + · refine biUnion_le fun q hq ↦ ?_ + have hq_mem : q ∈ ℒ := hℒ.finite.mem_toFinset.1 (hS (Finset.mem_of_mem_erase hq)) + exact mapInl_le_locationAmbient ℒ (hℒ.isSeparation hq_mem).left_le + · refine biUnion_le fun q hq ↦ ?_ + have hq_mem : q ∈ ℒ := hℒ.finite.mem_toFinset.1 (Finset.sdiff_subset + (Finset.mem_of_mem_erase hq)) + exact locationHeartEdge_le_locationAmbient hℒ hq_mem + +open Classical in +theorem locationStepHypergraph_empty {G : Hypergraph α β} + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hℒ : GM10.IsLocation G ℒ) : + locationStepHypergraph G hℒ ∅ = locationHeart G ℒ := by + have h1 : locationStepHypergraph G hℒ ∅ ≤ locationAmbient G ℒ := + locationStepHypergraph_le_ambient hℒ (Finset.empty_subset _) + have h2 : locationHeart G ℒ ≤ locationAmbient G ℒ := by + refine ⟨Set.subset_union_right, Set.subset_union_right, fun e he ↦ ?_⟩ + ext v + cases e with + | inl e₀ => + change (G.Inc e₀ v ∨ (GM10.locationCore G ℒ).Inc e₀ v) ↔ + (GM10.locationCore G ℒ).Inc e₀ v + rcases he with ⟨e₁, he₁, heq⟩ | ⟨p, _, heq⟩ + · cases heq + exact ⟨fun h ↦ h.elim + (fun hG ↦ (GM10.inc_iff_of_le (locationCore_le hℒ) he₁).2 hG) id, Or.inr⟩ + · cases heq + | inr p => + change (False ∨ (locationHeart G ℒ).Inc (Sum.inr p) v) ↔ + (locationHeart G ℒ).Inc (Sum.inr p) v + exact or_iff_right False.elim + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq h1 h2 ?_ ?_ + · ext v + simp only [locationStepHypergraph, GM10.union_vertexSet, mapInl, biUnion, + Finset.notMem_empty, Set.iUnion_of_empty, Set.iUnion_empty, Set.union_empty, + Finset.sdiff_empty, Set.mem_union, Set.mem_iUnion, Set.Finite.mem_toFinset, + locationHeartEdge, locationHeart] + refine or_iff_left_of_imp ?_ + rintro ⟨p, hp, hvp⟩ + have hsub : (p.1 ∩ p.2).vertexSet ⊆ (GM10.locationCore G ℒ).vertexSet := by + rw [← (theorem_2_3_2 hℒ hp).2] + exact Set.inter_subset_right + exact hsub hvp + · ext e + cases e with + | inl e₀ => + simp [locationStepHypergraph, mapInl, biUnion, locationHeartEdge, locationHeart] + | inr p => + simp only [locationStepHypergraph, GM10.union_edgeSet, mapInl, biUnion, + Finset.notMem_empty, Set.iUnion_of_empty, Set.iUnion_empty, Set.union_empty, + Finset.sdiff_empty, Set.mem_union, Set.mem_image, reduceCtorEq, and_false, + exists_false, Set.mem_iUnion, Set.Finite.mem_toFinset, locationHeartEdge, + Set.mem_singleton_iff, Sum.inr.injEq, false_or, locationHeart, + Set.mem_sep_iff] + constructor + · rintro ⟨q, hq, hpq⟩ + exact hpq ▸ ⟨q, ⟨hq, hℒ.isSeparation hq, by + rw [← (theorem_2_3_2 hℒ hq).2] + exact Set.inter_subset_right⟩, rfl⟩ + · rintro ⟨q, ⟨hq, _, _⟩, hqp⟩ + exact hqp ▸ ⟨q, hq, rfl⟩ + +open Classical in +theorem locationStepHypergraph_full {G : Hypergraph α β} + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hℒ : GM10.IsLocation G ℒ) : + locationStepHypergraph G hℒ hℒ.finite.toFinset = + mapInl (Hypergraph α β × Hypergraph α β) G := by + have h1 : locationStepHypergraph G hℒ hℒ.finite.toFinset ≤ locationAmbient G ℒ := + locationStepHypergraph_le_ambient hℒ Finset.Subset.rfl + have h2 : mapInl _ G ≤ locationAmbient G ℒ := mapInl_le_locationAmbient ℒ le_rfl + have hU := (theorem_2_3_1 hℒ).2.2 + have hVG : (GM10.locationCore G ℒ ∪ Hypergraph.biUnion hℒ.finite.toFinset Prod.fst).vertexSet = + G.vertexSet := congrArg Hypergraph.vertexSet hU + have hEG : (GM10.locationCore G ℒ ∪ Hypergraph.biUnion hℒ.finite.toFinset Prod.fst).edgeSet = + G.edgeSet := congrArg Hypergraph.edgeSet hU + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq h1 h2 ?_ ?_ + · change (locationStepHypergraph G hℒ hℒ.finite.toFinset).vertexSet = G.vertexSet + rw [← hVG] + ext v + simp [locationStepHypergraph, mapInl, biUnion] + · ext e + cases e with + | inl e₀ => + simp only [locationStepHypergraph, GM10.union_edgeSet, mapInl, biUnion, + Finset.sdiff_self, Finset.notMem_empty, Set.iUnion_of_empty, Set.iUnion_empty, + Set.union_empty, Set.mem_union, Set.mem_image, Sum.inl.injEq, exists_eq_right, + Set.mem_iUnion] + rw [← hEG] + simp [biUnion] + | inr p => + simp [locationStepHypergraph, mapInl, biUnion] + +open Classical in +theorem locationStepSide_insert_self {G : Hypergraph α β} + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hℒ : GM10.IsLocation G ℒ) + {S : Finset (Hypergraph α β × Hypergraph α β)} + {p : Hypergraph α β × Hypergraph α β} (hpS : p ∉ S) : + locationStepSide G hℒ (insert p S) p = locationStepSide G hℒ S p := by + unfold locationStepSide + rw [Finset.erase_insert hpS, Finset.erase_eq_of_notMem hpS] + have hsdiff : hℒ.finite.toFinset \ insert p S = (hℒ.finite.toFinset \ S).erase p := by + ext q + simp only [Finset.mem_sdiff, Finset.mem_insert, not_or, Finset.mem_erase] + tauto + rw [hsdiff, Finset.erase_idem] + +open Classical in +theorem locationStepSide_full {G : Hypergraph α β} + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hℒ : GM10.IsLocation G ℒ) + {p : Hypergraph α β × Hypergraph α β} (hp : p ∈ ℒ) : + locationStepSide G hℒ hℒ.finite.toFinset p = + mapInl (Hypergraph α β × Hypergraph α β) p.2 := by + have h1 : locationStepSide G hℒ hℒ.finite.toFinset p ≤ locationAmbient G ℒ := + locationStepSide_le_ambient hℒ Finset.Subset.rfl p + have h2 : mapInl _ p.2 ≤ locationAmbient G ℒ := + mapInl_le_locationAmbient ℒ (hℒ.isSeparation hp).right_le + have hB := (theorem_2_3_2 hℒ hp).1 + have hVB : p.2.vertexSet = (GM10.locationCore G ℒ ∪ + Hypergraph.biUnion (hℒ.finite.toFinset.filter (· ≠ p)) Prod.fst).vertexSet := + congrArg Hypergraph.vertexSet hB + have hEB : p.2.edgeSet = (GM10.locationCore G ℒ ∪ + Hypergraph.biUnion (hℒ.finite.toFinset.filter (· ≠ p)) Prod.fst).edgeSet := + congrArg Hypergraph.edgeSet hB + have herase : hℒ.finite.toFinset.erase p = hℒ.finite.toFinset.filter (· ≠ p) := + Finset.filter_ne' hℒ.finite.toFinset p |>.symm + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq h1 h2 ?_ ?_ + · change (locationStepSide G hℒ hℒ.finite.toFinset p).vertexSet = p.2.vertexSet + rw [hVB, ← herase] + ext v + simp [locationStepSide, mapInl, biUnion] + · ext e + cases e with + | inl e₀ => + simp only [locationStepSide, GM10.union_edgeSet, mapInl, biUnion, + Finset.sdiff_self, Finset.erase_empty, Finset.notMem_empty, Set.iUnion_of_empty, + Set.iUnion_empty, Set.union_empty, Set.mem_union, Set.mem_image, Sum.inl.injEq, + exists_eq_right, Set.mem_iUnion, herase] + rw [hEB] + simp [biUnion] + | inr q => + simp [locationStepSide, mapInl, biUnion] + +open Classical in +theorem isSeparation_locationStep_of_mem {G : Hypergraph α β} + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hℒ : GM10.IsLocation G ℒ) + {S : Finset (Hypergraph α β × Hypergraph α β)} (hS : S ⊆ hℒ.finite.toFinset) + {p : Hypergraph α β × Hypergraph α β} (hpS : p ∈ S) : + (locationStepHypergraph G hℒ S).IsSeparation + (mapInl _ p.1) (locationStepSide G hℒ S p) ∧ + (mapInl (Hypergraph α β × Hypergraph α β) p.1 ∩ locationStepSide G hℒ S p).vertexSet = + (p.1 ∩ p.2).vertexSet := by + have hp : p ∈ ℒ := hℒ.finite.mem_toFinset.1 (hS hpS) + have hHp_amb := mapInl_le_locationAmbient ℒ (hℒ.isSeparation hp).left_le + have hSide_amb := locationStepSide_le_ambient hℒ hS p + have hStep_amb := locationStepHypergraph_le_ambient hℒ hS + have hp_not_sdiff : p ∉ hℒ.finite.toFinset \ S := fun h ↦ (Finset.mem_sdiff.1 h).2 hpS + have herase_sdiff : (hℒ.finite.toFinset \ S).erase p = hℒ.finite.toFinset \ S := + Finset.erase_eq_of_notMem hp_not_sdiff + have hV_union : (mapInl (Hypergraph α β × Hypergraph α β) p.1).vertexSet ∪ + (locationStepSide G hℒ S p).vertexSet = + (locationStepHypergraph G hℒ S).vertexSet := by + ext v + simp only [locationStepSide, locationStepHypergraph, GM10.union_vertexSet, mapInl, biUnion, + herase_sdiff, Set.mem_union, Set.mem_iUnion, Finset.mem_erase] + constructor + · rintro (hvp | (hvc | ⟨q, ⟨hq_ne, hqS⟩, hvq⟩) | hrest) + · exact Or.inl (Or.inr ⟨p, hpS, hvp⟩) + · exact Or.inl (Or.inl hvc) + · exact Or.inl (Or.inr ⟨q, hqS, hvq⟩) + · exact Or.inr hrest + · rintro ((hvc | ⟨q, hqS, hvq⟩) | hrest) + · exact Or.inr (Or.inl (Or.inl hvc)) + · by_cases hqp : q = p + · exact Or.inl (hqp ▸ hvq) + · exact Or.inr (Or.inl (Or.inr ⟨q, ⟨hqp, hqS⟩, hvq⟩)) + · exact Or.inr (Or.inr hrest) + have hE_union : (mapInl (Hypergraph α β × Hypergraph α β) p.1).edgeSet ∪ + (locationStepSide G hℒ S p).edgeSet = + (locationStepHypergraph G hℒ S).edgeSet := by + ext e + simp only [locationStepSide, locationStepHypergraph, GM10.union_edgeSet, biUnion, + herase_sdiff, Set.mem_union, Set.mem_iUnion, Finset.mem_erase] + constructor + · rintro (hep | (hec | ⟨q, ⟨hq_ne, hqS⟩, heq⟩) | hrest) + · exact Or.inl (Or.inr ⟨p, hpS, hep⟩) + · exact Or.inl (Or.inl hec) + · exact Or.inl (Or.inr ⟨q, hqS, heq⟩) + · exact Or.inr hrest + · rintro ((hec | ⟨q, hqS, heq⟩) | hrest) + · exact Or.inr (Or.inl (Or.inl hec)) + · by_cases hqp : q = p + · exact Or.inl (hqp ▸ heq) + · exact Or.inr (Or.inl (Or.inr ⟨q, ⟨hqp, hqS⟩, heq⟩)) + · exact Or.inr (Or.inr hrest) + have hle_left : mapInl _ p.1 ≤ locationStepHypergraph G hℒ S := + (GM10.le_iff_of_le hHp_amb hStep_amb).2 + ⟨hV_union ▸ Set.subset_union_left, hE_union ▸ Set.subset_union_left⟩ + have hle_right : locationStepSide G hℒ S p ≤ locationStepHypergraph G hℒ S := + (GM10.le_iff_of_le hSide_amb hStep_amb).2 + ⟨hV_union ▸ Set.subset_union_right, hE_union ▸ Set.subset_union_right⟩ + have hE_inter : (mapInl (Hypergraph α β × Hypergraph α β) p.1).edgeSet ∩ + (locationStepSide G hℒ S p).edgeSet = ∅ := by + ext e + simp only [locationStepSide, GM10.union_edgeSet, mapInl, biUnion, locationHeartEdge, + Set.mem_inter_iff, Set.mem_image, Set.mem_union, Set.mem_iUnion, Finset.mem_erase, + Set.mem_singleton_iff, Set.mem_empty_iff_false, iff_false] + rintro ⟨⟨e₀, he₀, rfl⟩, (⟨_, hec, heq⟩ | ⟨q, ⟨hq_ne, hqS⟩, _, heq_mem, heq⟩) | ⟨q, _, heq⟩⟩ + · cases heq + exact Set.disjoint_left.1 ((theorem_2_3_1 hℒ).2.1 hp) he₀ hec + · cases heq + have hq_ℒ : q ∈ ℒ := hℒ.finite.mem_toFinset.1 (hS hqS) + exact Set.disjoint_left.1 ((theorem_2_3_1 hℒ).1 hp hq_ℒ (Ne.symm hq_ne)) he₀ heq_mem + · cases heq + have hsep : (locationStepHypergraph G hℒ S).IsSeparation + (mapInl _ p.1) (locationStepSide G hℒ S p) := + (GM10.isSeparation_iff_of_le hle_left hle_right).2 ⟨hV_union, hE_union, hE_inter⟩ + refine ⟨hsep, ?_⟩ + ext v + simp only [GM10.inter_vertexSet, locationStepSide, GM10.union_vertexSet, mapInl, biUnion, + locationHeartEdge, Set.mem_inter_iff, Set.mem_union, Set.mem_iUnion, Finset.mem_erase] + constructor + · rintro ⟨hvp₁, (hvc | ⟨q, ⟨hq_ne, hqS⟩, hvq⟩) | ⟨q, ⟨_, hq_sdiff⟩, hvq⟩⟩ + · have hv_inter : v ∈ (p.1 ∩ GM10.locationCore G ℒ).vertexSet := ⟨hvp₁, hvc⟩ + rw [(theorem_2_3_2 hℒ hp).2] at hv_inter + exact hv_inter + · have hq_ℒ : q ∈ ℒ := hℒ.finite.mem_toFinset.1 (hS hqS) + have hv_core : v ∈ (GM10.locationCore G ℒ).vertexSet := + (theorem_2_3_3 hℒ hp hq_ℒ (Ne.symm hq_ne)).1.vertexSet_subset ⟨hvp₁, hvq⟩ + have hv_inter : v ∈ (p.1 ∩ GM10.locationCore G ℒ).vertexSet := ⟨hvp₁, hv_core⟩ + rw [(theorem_2_3_2 hℒ hp).2] at hv_inter + exact hv_inter + · have hq_ℒ : q ∈ ℒ := hℒ.finite.mem_toFinset.1 (Finset.sdiff_subset hq_sdiff) + have hv_core : v ∈ (GM10.locationCore G ℒ).vertexSet := by + have h := (theorem_2_3_2 hℒ hq_ℒ).2 + have hsub : (q.1 ∩ q.2).vertexSet ⊆ (GM10.locationCore G ℒ).vertexSet := by + rw [← h] + exact Set.inter_subset_right + exact hsub hvq + have hv_inter : v ∈ (p.1 ∩ GM10.locationCore G ℒ).vertexSet := ⟨hvp₁, hv_core⟩ + rw [(theorem_2_3_2 hℒ hp).2] at hv_inter + exact hv_inter + · intro hv_inter + have hv_core : v ∈ (p.1 ∩ GM10.locationCore G ℒ).vertexSet := by + rwa [(theorem_2_3_2 hℒ hp).2] + exact ⟨hv_inter.1, Or.inl (Or.inl hv_core.2)⟩ + +open Classical in +theorem isSeparation_locationStep_of_notMem {G : Hypergraph α β} + {ℒ : Set (Hypergraph α β × Hypergraph α β)} (hℒ : GM10.IsLocation G ℒ) + {S : Finset (Hypergraph α β × Hypergraph α β)} (hS : S ⊆ hℒ.finite.toFinset) + {p : Hypergraph α β × Hypergraph α β} (hp : p ∈ ℒ) (hpS : p ∉ S) : + (locationStepHypergraph G hℒ S).IsSeparation + (locationHeartEdge p) (locationStepSide G hℒ S p) ∧ + (locationHeartEdge p ∩ locationStepSide G hℒ S p).vertexSet = + (p.1 ∩ p.2).vertexSet ∧ + (locationStepSide G hℒ S p).vertexSet = + (locationStepHypergraph G hℒ S).vertexSet := by + have hp_sdiff : p ∈ hℒ.finite.toFinset \ S := + Finset.mem_sdiff.2 ⟨hℒ.finite.mem_toFinset.2 hp, hpS⟩ + have hCp_amb := locationHeartEdge_le_locationAmbient hℒ hp + have hSide_amb := locationStepSide_le_ambient hℒ hS p + have hStep_amb := locationStepHypergraph_le_ambient hℒ hS + have herase_S : S.erase p = S := Finset.erase_eq_of_notMem hpS + have hsub_core : (p.1 ∩ p.2).vertexSet ⊆ (GM10.locationCore G ℒ).vertexSet := by + rw [← (theorem_2_3_2 hℒ hp).2] + exact Set.inter_subset_right + have hV_side_eq : (locationStepSide G hℒ S p).vertexSet = + (locationStepHypergraph G hℒ S).vertexSet := by + ext v + simp only [locationStepSide, locationStepHypergraph, GM10.union_vertexSet, mapInl, biUnion, + herase_S, Set.mem_union, Set.mem_iUnion, Finset.mem_erase, locationHeartEdge] + constructor + · rintro (hleft | ⟨q, ⟨_, hq_sdiff⟩, hvq⟩) + · exact Or.inl hleft + · exact Or.inr ⟨q, hq_sdiff, hvq⟩ + · rintro (hleft | ⟨q, hq_sdiff, hvq⟩) + · exact Or.inl hleft + · by_cases hqp : q = p + · subst hqp + exact Or.inl (Or.inl (hsub_core hvq)) + · exact Or.inr ⟨q, ⟨hqp, hq_sdiff⟩, hvq⟩ + have hV_union : (locationHeartEdge p).vertexSet ∪ + (locationStepSide G hℒ S p).vertexSet = + (locationStepHypergraph G hℒ S).vertexSet := by + rw [hV_side_eq, Set.union_eq_right] + exact fun v hv ↦ Or.inl (Or.inl (hsub_core hv)) + have hE_union : (locationHeartEdge p).edgeSet ∪ + (locationStepSide G hℒ S p).edgeSet = + (locationStepHypergraph G hℒ S).edgeSet := by + ext e + simp only [locationStepSide, locationStepHypergraph, GM10.union_edgeSet, biUnion, + herase_S, Set.mem_union, Set.mem_iUnion, Finset.mem_erase, locationHeartEdge, + Set.mem_singleton_iff] + constructor + · rintro (rfl | hleft | ⟨q, ⟨_, hq_sdiff⟩, rfl⟩) + · exact Or.inr ⟨p, hp_sdiff, rfl⟩ + · exact Or.inl hleft + · exact Or.inr ⟨q, hq_sdiff, rfl⟩ + · rintro (hleft | ⟨q, hq_sdiff, rfl⟩) + · exact Or.inr (Or.inl hleft) + · by_cases hqp : q = p + · exact Or.inl (hqp ▸ rfl) + · exact Or.inr (Or.inr ⟨q, ⟨hqp, hq_sdiff⟩, rfl⟩) + have hle_left : locationHeartEdge p ≤ locationStepHypergraph G hℒ S := + (GM10.le_iff_of_le hCp_amb hStep_amb).2 + ⟨hV_union ▸ Set.subset_union_left, hE_union ▸ Set.subset_union_left⟩ + have hle_right : locationStepSide G hℒ S p ≤ locationStepHypergraph G hℒ S := + (GM10.le_iff_of_le hSide_amb hStep_amb).2 + ⟨hV_union ▸ Set.subset_union_right, hE_union ▸ Set.subset_union_right⟩ + have hE_inter : (locationHeartEdge p).edgeSet ∩ + (locationStepSide G hℒ S p).edgeSet = ∅ := by + ext e + simp only [locationStepSide, GM10.union_edgeSet, mapInl, biUnion, locationHeartEdge, + Set.mem_inter_iff, Set.mem_singleton_iff, Set.mem_union, Set.mem_image, + Set.mem_iUnion, Finset.mem_erase, Set.mem_empty_iff_false, iff_false] + rintro ⟨rfl, (⟨_, _, heq⟩ | ⟨_, _, _, _, heq⟩) | ⟨q, ⟨hq_ne, _⟩, heq⟩⟩ + · cases heq + · cases heq + · exact hq_ne (Sum.inr.inj heq).symm + have hsep : (locationStepHypergraph G hℒ S).IsSeparation + (locationHeartEdge p) (locationStepSide G hℒ S p) := + (GM10.isSeparation_iff_of_le hle_left hle_right).2 ⟨hV_union, hE_union, hE_inter⟩ + have hV_inter : (locationHeartEdge p ∩ locationStepSide G hℒ S p).vertexSet = + (p.1 ∩ p.2).vertexSet := by + change (p.1 ∩ p.2).vertexSet ∩ (locationStepSide G hℒ S p).vertexSet = (p.1 ∩ p.2).vertexSet + exact Set.inter_eq_left.2 fun v hv ↦ Or.inl (Or.inl (hsub_core hv)) + exact ⟨hsep, hV_inter, hV_side_eq⟩ + +open Classical in +/-- **Claim (1)** in the proof of Graph Minors XVIII, (3.4) (page 84): +For every `S ⊆ ℒ`, if `locationHeart G ℒ` has a tangle `𝒯₀` of order `θ ≥ 2`, then there is a +tangle `𝒯_S` in `locationStepHypergraph G hℒ S` of order `θ` such that +`(mapInl _ p.1, locationStepSide G hℒ S p) ∈ 𝒯_S` for all `p ∈ S`. -/ +theorem lemma_3_4_claim_1 + {G : Hypergraph α β} {ℒ : Set (Hypergraph α β × Hypergraph α β)} + (hℒ : GM10.IsLocation G ℒ) + (htitanic : ∀ ⦃p⦄, p ∈ ℒ → GM10.IsTitanic G p.1 p.2) + {θ : ℕ} (hθ : 2 ≤ θ) (hord : locationOrder ℒ < θ) + {𝒯₀ : Set (Hypergraph α (β ⊕ (Hypergraph α β × Hypergraph α β)) × + Hypergraph α (β ⊕ (Hypergraph α β × Hypergraph α β)))} + (h𝒯₀ : GM10.IsTangle (locationHeart G ℒ) θ 𝒯₀) + (S : Finset (Hypergraph α β × Hypergraph α β)) (hS : S ⊆ hℒ.finite.toFinset) : + ∃ 𝒯_S, GM10.IsTangle (locationStepHypergraph G hℒ S) θ 𝒯_S ∧ + ∀ p ∈ S, (mapInl _ p.1, locationStepSide G hℒ S p) ∈ 𝒯_S := by + induction S using Finset.induction_on with + | empty => + refine ⟨𝒯₀, ?_, fun _ h ↦ (Finset.notMem_empty _ h).elim⟩ + rwa [locationStepHypergraph_empty hℒ] + | @insert p S hpS ih => + have hS_sub : S ⊆ hℒ.finite.toFinset := (Finset.subset_insert p S).trans hS + have hp_ℒ : p ∈ ℒ := hℒ.finite.mem_toFinset.1 (hS (Finset.mem_insert_self p S)) + obtain ⟨𝒯_S, h𝒯_S, hmem_S⟩ := ih hS_sub + let D := locationStepSide G hℒ S p + have hd_eq : locationStepSide G hℒ (insert p S) p = D := + locationStepSide_insert_self hℒ hpS + have ⟨hsep_Cp, hV_Cp, hVD_eq⟩ := isSeparation_locationStep_of_notMem hℒ hS_sub hp_ℒ hpS + have hord_p : separationOrder p.1 p.2 < θ := + separationOrder_lt_of_locationOrder_lt hℒ hord hp_ℒ + have hord_Cp : separationOrder (locationHeartEdge p) D < θ := by + unfold separationOrder + rwa [hV_Cp] + have hDCp_not : (D, locationHeartEdge p) ∉ 𝒯_S := fun hm ↦ + h𝒯_S.axiom3 hm hVD_eq + have hCpD_mem : (locationHeartEdge p, D) ∈ 𝒯_S := + (h𝒯_S.axiom1 hsep_Cp hord_Cp).resolve_right hDCp_not + have ⟨hsep_Ap_ins, hV_Ap_ins⟩ := + isSeparation_locationStep_of_mem hℒ hS (Finset.mem_insert_self p S) + rw [hd_eq] at hsep_Ap_ins hV_Ap_ins + -- Show `GM10.IsTitanic (locationStepHypergraph G hℒ (insert p S)) (mapInl _ p.1) D` by (3.1) + have htit_p : GM10.IsTitanic G p.1 p.2 := htitanic hp_ℒ + have htit_Ap : GM10.IsTitanic (locationStepHypergraph G hℒ (insert p S)) (mapInl _ p.1) D := by + refine ⟨hsep_Ap_ins, fun X Y Z hX hY hZ hU hdXY hdYZ hdXZ ↦ ?_⟩ + have hX' : comapInl X ≤ p.1 := by + refine ⟨hX.vertexSet_subset, fun e he ↦ ?_, fun e he ↦ ?_⟩ + · rcases hX.edgeSet_subset he with ⟨e', he', heq⟩ + cases heq + exact he' + · exact hX.ends_eq (Sum.inl e) he + have hY' : comapInl Y ≤ p.1 := by + refine ⟨hY.vertexSet_subset, fun e he ↦ ?_, fun e he ↦ ?_⟩ + · rcases hY.edgeSet_subset he with ⟨e', he', heq⟩ + cases heq + exact he' + · exact hY.ends_eq (Sum.inl e) he + have hZ' : comapInl Z ≤ p.1 := by + refine ⟨hZ.vertexSet_subset, fun e he ↦ ?_, fun e he ↦ ?_⟩ + · rcases hZ.edgeSet_subset he with ⟨e', he', heq⟩ + cases heq + exact he' + · exact hZ.ends_eq (Sum.inl e) he + have hU' : comapInl X ∪ comapInl Y ∪ comapInl Z = p.1 := by + have h := congrArg comapInl hU + rwa [comapInl_union, comapInl_union, comapInl_mapInl] at h + have hdXY' : Disjoint (comapInl X).edgeSet (comapInl Y).edgeSet := + Set.disjoint_iff.2 fun e ⟨hx, hy⟩ ↦ Set.disjoint_iff.1 hdXY ⟨hx, hy⟩ + have hdYZ' : Disjoint (comapInl Y).edgeSet (comapInl Z).edgeSet := + Set.disjoint_iff.2 fun e ⟨hy, hz⟩ ↦ Set.disjoint_iff.1 hdYZ ⟨hy, hz⟩ + have hdXZ' : Disjoint (comapInl X).edgeSet (comapInl Z).edgeSet := + Set.disjoint_iff.2 fun e ⟨hx, hz⟩ ↦ Set.disjoint_iff.1 hdXZ ⟨hx, hz⟩ + have v_inter_eq : ∀ {H : Hypergraph α (β ⊕ (Hypergraph α β × Hypergraph α β))}, + H ≤ mapInl _ p.1 → + (H ∩ D).vertexSet = ((comapInl H) ∩ p.2).vertexSet := by + intro H hH + ext v + simp only [GM10.inter_vertexSet, Set.mem_inter_iff] + constructor + · rintro ⟨hvH, hvD⟩ + have hv_p1D : v ∈ (mapInl _ p.1 ∩ D).vertexSet := ⟨hH.vertexSet_subset hvH, hvD⟩ + rw [hV_Ap_ins] at hv_p1D + exact ⟨hvH, hv_p1D.2⟩ + · rintro ⟨hvH, hvp2⟩ + have hv_p12 : v ∈ (p.1 ∩ p.2).vertexSet := ⟨hH.vertexSet_subset hvH, hvp2⟩ + rw [← hV_Ap_ins] at hv_p12 + exact ⟨hvH, hv_p12.2⟩ + have h1 := v_inter_eq (GM10.union_le hX hY) + have h2 := v_inter_eq (GM10.union_le hY hZ) + have h3 := v_inter_eq (GM10.union_le hZ hX) + rw [comapInl_union] at h1 h2 h3 + rw [h1, h2, h3] + exact htit_p.2 hX' hY' hZ' hU' hdXY' hdYZ' hdXZ' + have hV_eq_CD : (locationHeartEdge p ∩ D).vertexSet = (mapInl _ p.1 ∩ D).vertexSet := by + rw [hV_Cp, hV_Ap_ins] + let 𝒯_ins := GM10.titanicTransferredTangle + (locationStepHypergraph G hℒ (insert p S)) D 𝒯_S θ + have h𝒯_ins : GM10.IsTangle (locationStepHypergraph G hℒ (insert p S)) θ 𝒯_ins := + theorem_3_2_proof hsep_Cp htit_Ap hV_eq_CD h𝒯_S hθ hCpD_mem + refine ⟨𝒯_ins, h𝒯_ins, fun q hq ↦ ?_⟩ + have ⟨hsep_Aq_ins, hV_Aq_ins⟩ := isSeparation_locationStep_of_mem hℒ hS hq + have hq_ℒ : q ∈ ℒ := hℒ.finite.mem_toFinset.1 (hS hq) + have hord_Aq_ins : separationOrder (mapInl _ q.1) + (locationStepSide G hℒ (insert p S) q) < θ := by + unfold separationOrder + rw [hV_Aq_ins] + exact separationOrder_lt_of_locationOrder_lt hℒ hord hq_ℒ + rcases Finset.mem_insert.1 hq with rfl | hqS + · refine ⟨hsep_Aq_ins, hord_Aq_ins, (locationHeartEdge q, D), hCpD_mem, ?_⟩ + rw [hsep_Cp.edgeSet_inter_eq, ← hd_eq, hsep_Aq_ins.edgeSet_inter_eq] + · exact ⟨hsep_Aq_ins, hord_Aq_ins, (mapInl _ q.1, locationStepSide G hℒ S q), + hmem_S q hqS, rfl⟩ + +/-- Pulls back a tangle on `mapInl γ G` to a tangle on `G`. -/ +theorem isTangle_comapInl {γ : Type*} {G : Hypergraph α β} {θ : ℕ} + {𝒯' : Set (Hypergraph α (β ⊕ γ) × Hypergraph α (β ⊕ γ))} + (h𝒯' : GM10.IsTangle (mapInl γ G) θ 𝒯') : + GM10.IsTangle G θ + {p | (mapInl γ p.1, mapInl γ p.2) ∈ 𝒯'} where + one_le := h𝒯'.one_le + isSeparation A B h := by + have hsep' := h𝒯'.isSeparation h + have hA : A ≤ G := by + refine ⟨hsep'.left_le.vertexSet_subset, ?_, ?_⟩ + · intro e he + rcases hsep'.left_le.edgeSet_subset ⟨e, he, rfl⟩ with ⟨e', he', heq⟩ + cases heq + exact he' + · intro e he + exact hsep'.left_le.ends_eq (Sum.inl e) ⟨e, he, rfl⟩ + have hB : B ≤ G := by + refine ⟨hsep'.right_le.vertexSet_subset, ?_, ?_⟩ + · intro e he + rcases hsep'.right_le.edgeSet_subset ⟨e, he, rfl⟩ with ⟨e', he', heq⟩ + cases heq + exact he' + · intro e he + exact hsep'.right_le.ends_eq (Sum.inl e) ⟨e, he, rfl⟩ + rw [GM10.isSeparation_iff_of_le hA hB] + refine ⟨hsep'.vertexSet_union, ?_, ?_⟩ + · have hE := congrArg (Set.preimage Sum.inl) hsep'.edgeSet_union + simpa [mapInl, Set.preimage_image_eq _ Sum.inl_injective] using hE + · have hI := congrArg (Set.preimage Sum.inl) hsep'.edgeSet_inter_eq + simpa [mapInl, Set.preimage_image_eq _ Sum.inl_injective] using hI + order_lt A B h := h𝒯'.order_lt h + axiom1 A B hsep hord := by + have hsep' : (mapInl γ G).IsSeparation (mapInl γ A) (mapInl γ B) := by + rw [GM10.isSeparation_iff_of_le (mapInl_mono γ hsep.left_le) (mapInl_mono γ hsep.right_le)] + refine ⟨hsep.vertexSet_union, ?_, ?_⟩ + · simp [mapInl, ← Set.image_union, hsep.edgeSet_union] + · have hE : A.edgeSet ∩ B.edgeSet = ∅ := hsep.edgeSet_inter_eq + change Sum.inl '' A.edgeSet ∩ Sum.inl '' B.edgeSet = ∅ + rw [← Set.image_inter Sum.inl_injective, hE, Set.image_empty] + exact h𝒯'.axiom1 hsep' hord + axiom2 A₁ B₁ A₂ B₂ A₃ B₃ h₁ h₂ h₃ hU := by + apply h𝒯'.axiom2 h₁ h₂ h₃ + rw [← mapInl_union, ← mapInl_union, hU] + axiom3 A B h hVA := h𝒯'.axiom3 h hVA + +/-- **Graph Minors XVIII, (3.4)** (page 84): +"**3.4.** *Let $\mathscr{L}$ be a location in a hypergraph $G$, such that each +$(A, B) \in \mathscr{L}$ is titanic, and $\mathscr{L}$ has order $< \theta$, where $\theta \ge 2$. +Then either there is a tangle $\mathscr{T}$ in $G$ of order $\theta$ with +$\mathscr{L} \subseteq \mathscr{T}$, or $\mathscr{L}$ has tree-width $\le \frac{3}{2}\theta$.*" -/ +theorem theorem_3_4_proof + {G : Hypergraph α β} {ℒ : Set (Hypergraph α β × Hypergraph α β)} + (hℒ : GM10.IsLocation G ℒ) + (htitanic : ∀ ⦃p⦄, p ∈ ℒ → GM10.IsTitanic G p.1 p.2) + {θ : ℕ} (hθ : 2 ≤ θ) (hord : locationOrder ℒ < θ) : + (∃ 𝒯, GM10.IsTangle G θ 𝒯 ∧ ℒ ⊆ 𝒯) ∨ + 2 * locationTreeWidth G ℒ ≤ 3 * (θ : ℤ) := by + classical + by_cases hex_H : ∃ 𝒯₀, GM10.IsTangle (locationHeart G ℒ) θ 𝒯₀ + · left + obtain ⟨𝒯₀, h𝒯₀⟩ := hex_H + obtain ⟨𝒯_full, h𝒯_full, hmem_full⟩ := + lemma_3_4_claim_1 hℒ htitanic hθ hord h𝒯₀ hℒ.finite.toFinset Finset.Subset.rfl + rw [locationStepHypergraph_full hℒ] at h𝒯_full + refine ⟨{p | (mapInl _ p.1, mapInl _ p.2) ∈ 𝒯_full}, isTangle_comapInl h𝒯_full, ?_⟩ + intro p hp + have h := hmem_full p (hℒ.finite.mem_toFinset.2 hp) + rwa [locationStepSide_full hℒ hp] at h + · right + have hno : ∀ ⦃θ' : ℕ⦄ ⦃𝒯₀ : Set _⦄, + GM10.IsTangle (locationHeart G ℒ) θ' 𝒯₀ → θ' < θ := by + intro θ' 𝒯₀ h𝒯₀ + by_contra! hle + exact hex_H ⟨GM10.truncation 𝒯₀ θ, h𝒯₀.truncation (by omega) hle⟩ + exact theorem_2_2_proof (locationHeart G ℒ) (by omega) hno + +end GraphMinor.GM18 diff --git a/LeanPool/GraphMinor/GM18/Section4.lean b/LeanPool/GraphMinor/GM18/Section4.lean new file mode 100644 index 0000000000..22c7944b45 --- /dev/null +++ b/LeanPool/GraphMinor/GM18/Section4.lean @@ -0,0 +1,1583 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.TangleLemmas +public import LeanPool.GraphMinor.GM18.Section3 +public import LeanPool.GraphMinor.Thomas.Basic +import Mathlib.Data.Finset.Max +import Mathlib.Algebra.Order.Field.Rat + +/-! +# Graph Minors XVIII, Section 4: Isolating Locations + +This file formalizes Section 4 of Robertson and Seymour, *Graph Minors. XVIII. Tree-decompositions +and well-quasi-ordering*, J. Combin. Theory Ser. B 89 (2003) 77–108 (pages 85–89): +- `theorem_4_1`: Saks's lemma on partitioning a tree `T` with linearly ordered edges into vertex- + disjoint subtrees `T_t` (`t ∈ I`). +- `theorem_4_2`: Given distinct tangles `𝒯_j` (`j ∈ J`) of order `θ` and `θ`-isolating locations + `ℒ_j ⊆ 𝒯_j`, there exists `I ⊆ J` such that for every `j ∈ J` there is a unique `i ∈ I` with + `ℒ_i ⊆ 𝒯_j` (with Claims (1)–(4): `lemma_4_2_claim_1` through `lemma_4_2_claim_4`). +- `theorem_4_3`: In a standard tree-decomposition relative to `𝒯₁, …, 𝒯ₙ` of order `θ ≥ 2`, where + each `ℒᵢ ⊆ 𝒯ᵢ` is a `θ`-isolating location of order `≤ (3/4) θ` and every tangle of order `θ` + includes a unique `ℒᵢ`, the location of `tᵢ` is an enlargement of `ℒᵢ` by tree-width + `≤ (9/4) θ` (with Claims (1)–(4): `lemma_4_3_claim_1` through `lemma_4_3_claim_4`). +- `theorem_4_4`: The main structure theorem of Section 4, producing a proper, rotund, robust + tree-decomposition `(T, τ)` of `G` whose vertex locations are enlargements of isolating locations + `ℒ(𝒯)` by tree-width `≤ 3 θ + 1`. +-/ + +public section + +namespace GraphMinor.GM18 + +open Hypergraph SimpleGraph + +universe u v w + +variable {α : Type u} {β : Type v} {ι : Type*} + +/-! ## (4.1): Saks's Lemma on Subtrees of a Tree -/ + +/-- A subset `S : Set ι` of vertices of a tree `T` is a subtree (connected in the induced subgraph): +for any `u, v ∈ S`, every vertex on the path in `T` between `u` and `v` belongs to `S`. -/ +def IsTreeConvex (T : SimpleGraph ι) (S : Set ι) : Prop := + ∀ ⦃u v : ι⦄, u ∈ S → v ∈ S → ∀ ⦃x : ι⦄, Thomas.OnTreePath T u v x → x ∈ S + +private theorem eq_singleton_of_no_internal_edge {T : SimpleGraph ι} (hT : T.IsTree) + {U : Set ι} (hU : IsTreeConvex T U) {t : ι} (ht : t ∈ U) + (hno : ∀ ⦃u v : ι⦄, u ∈ U → v ∈ U → ¬ T.Adj u v) : U = {t} := by + ext x + simp only [Set.mem_singleton_iff] + refine ⟨fun hx => ?_, fun he => he ▸ ht⟩ + by_contra hne + obtain ⟨u, v, he, hu, _⟩ := Thomas.exists_onTreePathEdge_of_prop hT (· = t) rfl hne + subst hu + exact hno ht (hU ht hx he.onTreePath_right) he.1 + +private theorem partition_of_singleton {U : Set ι} {t : ι} {sub : ι → Set ι} + (hU : U = {t}) (hsub : sub t ⊆ U) (ht : t ∈ sub t) : + ∃ I ⊆ U, (∀ i ∈ I, ∀ j ∈ I, i ≠ j → Disjoint (sub i) (sub j)) ∧ + (⋃ i ∈ I, sub i) = U := by + subst U + refine ⟨{t}, Set.Subset.rfl, ?_, ?_⟩ + · intro i hi j hj hne + exact (hne ((Set.mem_singleton_iff.1 hi).trans (Set.mem_singleton_iff.1 hj).symm)).elim + · ext x + simp only [Set.mem_iUnion, Set.mem_singleton_iff, exists_prop, exists_eq_left] + exact ⟨fun hx => hsub hx, fun hx => hx.symm ▸ ht⟩ + +private theorem partition_of_crossing_member {I U V : Set ι} {sub : ι → Set ι} + {boundary r : ι} (hb : boundary ∈ U) (hsub : ∀ i ∈ I, sub i ⊆ U ∪ V) + (hdisj : ∀ i ∈ I, ∀ j ∈ I, i ≠ j → Disjoint (sub i ∩ U) (sub j ∩ U)) + (hcover : (⋃ i ∈ I, sub i ∩ U) = U) + (hcross : ∀ i ∈ I, ¬ sub i ⊆ U → boundary ∈ sub i ∧ V ⊆ sub i) + (hr : r ∈ I) (hnot : ¬ sub r ⊆ U) : + (∀ i ∈ I, ∀ j ∈ I, i ≠ j → Disjoint (sub i) (sub j)) ∧ + (⋃ i ∈ I, sub i) = U ∪ V := by + refine ⟨?_, Set.Subset.antisymm (Set.iUnion₂_subset hsub) ?_⟩ + · intro i hi j hj hne + refine Set.disjoint_left.2 fun x hx hy => ?_ + by_cases hxU : x ∈ U + · exact Set.disjoint_left.1 (hdisj i hi j hj hne) ⟨hx, hxU⟩ ⟨hy, hxU⟩ + · have hbi := (hcross i hi (fun hs => hxU (hs hx))).1 + have hbj := (hcross j hj (fun hs => hxU (hs hy))).1 + exact Set.disjoint_left.1 (hdisj i hi j hj hne) ⟨hbi, hb⟩ ⟨hbj, hb⟩ + · refine Set.union_subset ?_ ((hcross r hr hnot).2.trans (Set.subset_biUnion_of_mem hr)) + rw [← hcover] + exact Set.biUnion_mono subset_rfl fun i _ => Set.inter_subset_left + +private theorem isTreeConvex_side {T : SimpleGraph ι} (hT : T.IsTree) + {U : Set ι} (hU_conv : IsTreeConvex T U) {a b : ι} (hadj : T.Adj a b) : + IsTreeConvex T {x ∈ U | Thomas.OnTreePath T x b a} := by + intro x y ⟨hxU, hx⟩ ⟨hyU, hy⟩ z hz + refine ⟨hU_conv hxU hyU hz, ?_⟩ + change GM10.OnTreePath T x b a at hx + change GM10.OnTreePath T y b a at hy + change GM10.OnTreePath T z b a + rw [← reachable_deleteEdges_iff_onTreePath hT hadj] at hx hy ⊢ + have hzy : (T.deleteEdges {s(a, b)}).Reachable z y := by + rw [reachable_deleteEdges_iff_exists_walk] + have hp_isPath := Thomas.treePath_isPath hT x y + have hz_mem : z ∈ (Thomas.treePath hT x y).support := + (Thomas.onTreePath_iff_mem_treePath hT).1 hz + have hnot_ab : s(a, b) ∉ (Thomas.treePath hT x y).edges := by + intro hab + have he_xy : Thomas.OnTreePathEdge T x y a b := + (Thomas.onTreePathEdge_iff_mem_treePath hT).2 ⟨hadj, hab⟩ + have hnot_reach := (Thomas.onTreePathEdge_iff_not_reachable_deleteEdges.1 he_xy).2 + exact hnot_reach (hx.symm.trans hy) + obtain ⟨p₁, p₂, _, _, heq⟩ := hp_isPath.mem_support_iff_exists_append.1 hz_mem + refine ⟨p₂, fun hmem ↦ hnot_ab ?_⟩ + rw [heq, Walk.edges_append, List.mem_append] + exact Or.inr hmem + exact hy.trans hzy.symm + +/-- **Graph Minors XVIII, (4.1)** (page 85, M. Saks): +"Let $T$ be a tree and let $\le$ be some linear order on $E(T)$. For each $t \in V(T)$, let +$T_t$ be a subtree of $T$ such that* - *$t \in V(T_t)$,* - *if $e \in E(T)$ has one end in +$V(T_t)$ and the other end in $V(T) \setminus V(T_t)$ and $f$ is an edge of the path of $T$ +with first vertex $t$ and last edge $e$, then $e \le f$.* *Then there exists $I \subseteq +V(T)$ such that the sets $V(T_t)$ ($t \in I$) form a partition of $V(T)$." + +We prove this for any tree-convex subset `U ⊆ V(T)` by strong induction on `|U|`, taking `U = +Set.univ` +to obtain (4.1). -/ +private theorem saks_lemma_aux [Finite ι] {T : SimpleGraph ι} (hT : T.IsTree) + {Λ : Type*} [LinearOrder Λ] (μ : Sym2 ι → Λ) + (he_inj : ∀ ⦃e₁ e₂ : Sym2 ι⦄, e₁ ∈ T.edgeSet → e₂ ∈ T.edgeSet → μ e₁ = μ e₂ → e₁ = e₂) + (U : Set ι) (hU_ne : U.Nonempty) (hU_conv : IsTreeConvex T U) + (sub : ι → Set ι) + (hsub_U : ∀ t ∈ U, sub t ⊆ U) + (ht_mem : ∀ t ∈ U, t ∈ sub t) + (hsub_conv : ∀ t ∈ U, IsTreeConvex T (sub t)) + (hsub_ord : ∀ t ∈ U, ∀ u ∈ sub t, ∀ v ∈ U \ sub t, T.Adj u v → + ∀ x y : ι, Thomas.OnTreePathEdge T t v x y → μ s(u, v) ≤ μ s(x, y)) : + ∃ I ⊆ U, (∀ i ∈ I, ∀ j ∈ I, i ≠ j → Disjoint (sub i) (sub j)) ∧ + (⋃ i ∈ I, sub i) = U := by + classical + let fintypeVertices := Fintype.ofFinite ι + revert U sub + suffices hmain : ∀ n : ℕ, ∀ U : Set ι, U.ncard = n → U.Nonempty → IsTreeConvex T U → + ∀ sub : ι → Set ι, + (∀ t ∈ U, sub t ⊆ U) → + (∀ t ∈ U, t ∈ sub t) → + (∀ t ∈ U, IsTreeConvex T (sub t)) → + (∀ t ∈ U, ∀ u ∈ sub t, ∀ v ∈ U \ sub t, T.Adj u v → + ∀ x y : ι, Thomas.OnTreePathEdge T t v x y → μ s(u, v) ≤ μ s(x, y)) → + ∃ I ⊆ U, (∀ i ∈ I, ∀ j ∈ I, i ≠ j → Disjoint (sub i) (sub j)) ∧ + (⋃ i ∈ I, sub i) = U by + intro U hU_ne hU_conv sub hsub_U ht_mem hsub_conv hsub_ord + exact hmain U.ncard U rfl hU_ne hU_conv sub hsub_U ht_mem hsub_conv hsub_ord + intro n + induction n using Nat.strong_induction_on with + | _ n ih => + intro U hcard hU_ne hU_conv sub hsub_U ht_mem hsub_conv hsub_ord + let E_U : Finset (Sym2 ι) := + Finset.univ.filter fun e ↦ e ∈ T.edgeSet ∧ ∀ x ∈ e, x ∈ U + by_cases hE_empty : E_U = ∅ + · -- No edges in `U`: since `U` is tree-convex and nonempty, `U` has a single vertex `t₀`. + obtain ⟨t₀, ht₀⟩ := hU_ne + have hU_eq : U = {t₀} := eq_singleton_of_no_internal_edge hT hU_conv ht₀ (by + intro u v hu hv hadj + exact Finset.notMem_empty s(u, v) (hE_empty ▸ Finset.mem_filter.2 + ⟨Finset.mem_univ _, T.mem_edgeSet.2 hadj, fun z hz => by + rcases Sym2.mem_iff.1 hz with rfl | rfl + · exact hu + · exact hv⟩)) + exact partition_of_singleton hU_eq (hsub_U t₀ ht₀) (ht_mem t₀ ht₀) + · -- Choose `f ∈ E_U` minimizing `μ f` + have hE_ne : E_U.Nonempty := Finset.nonempty_iff_ne_empty.2 hE_empty + obtain ⟨f, hf_mem, hf_min⟩ := E_U.exists_min_image μ hE_ne + have hf_filter := (Finset.mem_filter.1 hf_mem).2 + rcases f with ⟨u₁, u₂⟩ + have hadj_f : T.Adj u₁ u₂ := T.mem_edgeSet.1 hf_filter.1 + have hu₁_U : u₁ ∈ U := hf_filter.2 u₁ (Sym2.mem_mk_left u₁ u₂) + have hu₂_U : u₂ ∈ U := hf_filter.2 u₂ (Sym2.mem_mk_right u₁ u₂) + let U₁ : Set ι := {x ∈ U | Thomas.OnTreePath T x u₂ u₁} + let U₂ : Set ι := {x ∈ U | Thomas.OnTreePath T x u₁ u₂} + have hu₁_U₁ : u₁ ∈ U₁ := ⟨hu₁_U, Thomas.onTreePath_left T u₁ u₂⟩ + have hu₂_U₂ : u₂ ∈ U₂ := ⟨hu₂_U, Thomas.onTreePath_left T u₂ u₁⟩ + have hu₁_not_U₂ : u₁ ∉ U₂ := fun h ↦ + hadj_f.ne (Thomas.onTreePath_self T u₁ u₂ |>.1 h.2).symm + have hu₂_not_U₁ : u₂ ∉ U₁ := fun h ↦ + hadj_f.ne (Thomas.onTreePath_self T u₂ u₁ |>.1 h.2) + have hU₁_sub : U₁ ⊆ U := fun _ h ↦ h.1 + have hU₂_sub : U₂ ⊆ U := fun _ h ↦ h.1 + have hU_union : U₁ ∪ U₂ = U := by + ext x + refine ⟨fun h ↦ h.elim (fun h1 ↦ h1.1) (fun h2 ↦ h2.1), fun hx ↦ ?_⟩ + rcases Thomas.onTreePath_adj_dichotomy hT hadj_f x with ⟨h1, _⟩ | ⟨h2, _⟩ + · exact Or.inl ⟨hx, h1⟩ + · exact Or.inr ⟨hx, h2⟩ + have hU_disj : Disjoint U₁ U₂ := by + rw [Set.disjoint_iff] + rintro x ⟨⟨_, h1⟩, ⟨_, h2⟩⟩ + exact (Thomas.onTreePath_adj_dichotomy hT hadj_f x).elim + (fun h ↦ h.2 h2) (fun h ↦ h.2 h1) + have hcard₁ : U₁.ncard < n := by + rw [← hcard] + exact Set.ncard_lt_ncard ⟨hU₁_sub, fun h ↦ hu₂_not_U₁ (h hu₂_U)⟩ (Set.toFinite U) + have hcard₂ : U₂.ncard < n := by + rw [← hcard] + exact Set.ncard_lt_ncard ⟨hU₂_sub, fun h ↦ hu₁_not_U₂ (h hu₁_U)⟩ (Set.toFinite U) + have hU₁_conv : IsTreeConvex T U₁ := isTreeConvex_side hT hU_conv hadj_f + have hU₂_conv : IsTreeConvex T U₂ := isTreeConvex_side hT hU_conv hadj_f.symm + let sub₁ : ι → Set ι := fun t ↦ sub t ∩ U₁ + let sub₂ : ι → Set ι := fun t ↦ sub t ∩ U₂ + have side_ord : ∀ {a b : ι} (hadj : T.Adj a b), + let Ua := {x ∈ U | Thomas.OnTreePath T x b a} + ∀ t ∈ Ua, ∀ u ∈ sub t ∩ Ua, ∀ v ∈ Ua \ (sub t ∩ Ua), T.Adj u v → + ∀ x y : ι, Thomas.OnTreePathEdge T t v x y → μ s(u, v) ≤ μ s(x, y) := by + intro a b hadj Ua t ht u ⟨hu_sub, _⟩ v ⟨hv_Ua, hv_not⟩ hadj_uv x y hxy + exact hsub_ord t ht.1 u hu_sub v ⟨hv_Ua.1, fun hv_sub ↦ hv_not ⟨hv_sub, hv_Ua⟩⟩ + hadj_uv x y hxy + obtain ⟨I₁, hI₁_U₁, hI₁_disj, hI₁_union⟩ := + ih U₁.ncard hcard₁ U₁ rfl ⟨u₁, hu₁_U₁⟩ hU₁_conv sub₁ + (fun _ _ ↦ Set.inter_subset_right) + (fun t ht ↦ ⟨ht_mem t ht.1, ht⟩) + (fun t ht x y hx hy z hz ↦ ⟨hsub_conv t ht.1 hx.1 hy.1 hz, hU₁_conv hx.2 hy.2 hz⟩) + (side_ord hadj_f) + obtain ⟨I₂, hI₂_U₂, hI₂_disj, hI₂_union⟩ := + ih U₂.ncard hcard₂ U₂ rfl ⟨u₂, hu₂_U₂⟩ hU₂_conv sub₂ + (fun _ _ ↦ Set.inter_subset_right) + (fun t ht ↦ ⟨ht_mem t ht.1, ht⟩) + (fun t ht x y hx hy z hz ↦ ⟨hsub_conv t ht.1 hx.1 hy.1 hz, hU₂_conv hx.2 hy.2 hz⟩) + (side_ord hadj_f.symm) + -- Key helper: if `s ∈ Ua` and `sub s` is not contained in `Ua`, then `a ∈ sub s`, `b ∈ sub + -- s`, + -- and `Ub ⊆ sub s`. + have cross_helper : ∀ {a b : ι} (hadj : T.Adj a b) (heq_f : s(a, b) = s(u₁, u₂)) + (hb_U : b ∈ U), + let Ua := {x ∈ U | Thomas.OnTreePath T x b a} + let Ub := {x ∈ U | Thomas.OnTreePath T x a b} + ∀ s ∈ Ua, ¬ (sub s ⊆ Ua) → a ∈ sub s ∧ b ∈ sub s ∧ Ub ⊆ sub s := by + intro a b hadj heq_f hb_U Ua Ub s hs hnot_sub + have hUa_Ub : Ua ∪ Ub = U := by + rcases Sym2.eq_iff.1 heq_f with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hU_union + · rw [Set.union_comm] + exact hU_union + obtain ⟨w, hw_sub, hw_not_Ua⟩ := Set.not_subset.1 hnot_sub + have hw_U : w ∈ U := hsub_U s hs.1 hw_sub + have hw_Ub : w ∈ Ub := (hUa_Ub ▸ hw_U).resolve_left hw_not_Ua + have ⟨ha_on, hb_on⟩ := Thomas.onTreePath_of_sides hT hadj hs.2 hw_Ub.2 + have ha_sub : a ∈ sub s := hsub_conv s hs.1 (ht_mem s hs.1) hw_sub ha_on + have hb_sub : b ∈ sub s := hsub_conv s hs.1 (ht_mem s hs.1) hw_sub hb_on + refine ⟨ha_sub, hb_sub, fun z hz ↦ ?_⟩ + by_contra hz_not + obtain ⟨u, v, huv_edge, hu_in, hv_not⟩ := + Thomas.exists_onTreePathEdge_of_prop hT (· ∈ sub s) hb_sub hz_not + have hb_Ub : b ∈ Ub := ⟨hb_U, Thomas.onTreePath_left T b a⟩ + have hu_Ub : u ∈ Ub := isTreeConvex_side hT hU_conv hadj.symm hb_Ub hz + huv_edge.onTreePath_left + have hv_Ub : v ∈ Ub := isTreeConvex_side hT hU_conv hadj.symm hb_Ub hz + huv_edge.onTreePath_right + have hab_sv : Thomas.OnTreePathEdge T s v a b := by + rw [Thomas.onTreePathEdge_iff_not_reachable_deleteEdges] + refine ⟨hadj, fun hreach ↦ ?_⟩ + have hsa : (T.deleteEdges {s(a, b)}).Reachable a s := + (reachable_deleteEdges_iff_onTreePath hT hadj s).2 hs.2 + have hvb : (T.deleteEdges {s(a, b)}).Reachable b v := by + have h := (reachable_deleteEdges_iff_onTreePath hT hadj.symm v).2 hv_Ub.2 + rwa [Sym2.eq_swap] at h + have he_ab : Thomas.OnTreePathEdge T a b a b := by + rw [Thomas.onTreePathEdge_iff_mem_treePath hT] + refine ⟨hadj, ?_⟩ + rw [← Thomas.eq_treePath hT hadj.toWalk hadj.isPath_toWalk] + simp + exact (Thomas.onTreePathEdge_iff_not_reachable_deleteEdges.1 he_ab).2 + (hsa.trans (hreach.trans hvb.symm)) + have hle_μ : μ s(u, v) ≤ μ s(a, b) := + hsub_ord s hs.1 u hu_in v ⟨hv_Ub.1, hv_not⟩ huv_edge.1 a b hab_sv + have huv_EU : s(u, v) ∈ E_U := by + rw [Finset.mem_filter] + refine ⟨Finset.mem_univ _, T.mem_edgeSet.2 huv_edge.1, fun x hx ↦ ?_⟩ + rcases Sym2.mem_iff.1 hx with rfl | rfl + · exact hu_Ub.1 + · exact hv_Ub.1 + have hmin_uv : μ s(u₁, u₂) ≤ μ s(u, v) := hf_min s(u, v) huv_EU + rw [← heq_f] at hmin_uv + have heq_μ : μ s(u, v) = μ s(a, b) := le_antisymm hle_μ hmin_uv + have heq_e : s(u, v) = s(a, b) := + he_inj (T.mem_edgeSet.2 huv_edge.1) (T.mem_edgeSet.2 hadj) heq_μ + have ha_not_Ub : a ∉ Ub := fun h ↦ + hadj.ne (Thomas.onTreePath_self T a b |>.1 h.2).symm + rcases Sym2.eq_iff.1 heq_e with ⟨rfl, _⟩ | ⟨_, rfl⟩ + · exact ha_not_Ub hu_Ub + · exact ha_not_Ub hv_Ub + by_cases h1 : ∀ t ∈ I₁, sub t ⊆ U₁ + · by_cases h2 : ∀ t ∈ I₂, sub t ⊆ U₂ + · -- Both `I₁` and `I₂` have `sub t = subᵢ t`; take `I = I₁ ∪ I₂`. + refine ⟨I₁ ∪ I₂, Set.union_subset (hI₁_U₁.trans hU₁_sub) (hI₂_U₂.trans hU₂_sub), ?_, ?_⟩ + · intro i hi j hj hne + rcases hi with hi₁ | hi₂ <;> rcases hj with hj₁ | hj₂ + · have hi_eq : sub₁ i = sub i := Set.inter_eq_left.2 (h1 i hi₁) + have hj_eq : sub₁ j = sub j := Set.inter_eq_left.2 (h1 j hj₁) + rw [← hi_eq, ← hj_eq] + exact hI₁_disj i hi₁ j hj₁ hne + · exact Disjoint.mono (h1 i hi₁) (h2 j hj₂) hU_disj + · exact Disjoint.mono (h2 i hi₂) (h1 j hj₁) hU_disj.symm + · have hi_eq : sub₂ i = sub i := Set.inter_eq_left.2 (h2 i hi₂) + have hj_eq : sub₂ j = sub j := Set.inter_eq_left.2 (h2 j hj₂) + rw [← hi_eq, ← hj_eq] + exact hI₂_disj i hi₂ j hj₂ hne + · rw [Set.biUnion_union] + have hU₁_eq : (⋃ i ∈ I₁, sub i) = U₁ := by + rw [← hI₁_union] + exact Set.iUnion₂_congr fun i hi ↦ (Set.inter_eq_left.2 (h1 i hi)).symm + have hU₂_eq : (⋃ i ∈ I₂, sub i) = U₂ := by + rw [← hI₂_union] + exact Set.iUnion₂_congr fun i hi ↦ (Set.inter_eq_left.2 (h2 i hi)).symm + rw [hU₁_eq, hU₂_eq, hU_union] + · push Not at h2 + obtain ⟨s, hs, hnot⟩ := h2 + refine ⟨I₂, hI₂_U₂.trans hU₂_sub, ?_⟩ + rw [← hU_union, Set.union_comm] + exact partition_of_crossing_member hu₂_U₂ + (fun t ht => by + rw [Set.union_comm, hU_union] + exact hsub_U t (hI₂_U₂.trans hU₂_sub ht)) + hI₂_disj hI₂_union (fun t ht hnot => by + obtain ⟨ha, _, hcover⟩ := + cross_helper hadj_f.symm Sym2.eq_swap hu₁_U t (hI₂_U₂ ht) hnot + exact ⟨ha, hcover⟩) hs hnot + · push Not at h1 + obtain ⟨s, hs, hnot⟩ := h1 + refine ⟨I₁, hI₁_U₁.trans hU₁_sub, ?_⟩ + rw [← hU_union] + exact partition_of_crossing_member hu₁_U₁ + (fun t ht => hU_union ▸ hsub_U t (hI₁_U₁.trans hU₁_sub ht)) + hI₁_disj hI₁_union (fun t ht hnot => by + obtain ⟨ha, _, hcover⟩ := cross_helper hadj_f rfl hu₂_U t (hI₁_U₁ ht) hnot + exact ⟨ha, hcover⟩) hs hnot + +/-- **Graph Minors XVIII, (4.1)** (page 85, M. Saks): +"Let $T$ be a tree and let $\le$ be some linear order on $E(T)$. For each $t \in V(T)$, let +$T_t$ be a subtree of $T$ such that* - *$t \in V(T_t)$,* - *if $e \in E(T)$ has one end in +$V(T_t)$ and the other end in $V(T) \setminus V(T_t)$ and $f$ is an edge of the path of $T$ +with first vertex $t$ and last edge $e$, then $e \le f$.* *Then there exists $I \subseteq +V(T)$ such that the sets $V(T_t)$ ($t \in I$) form a partition of $V(T)$." -/ +theorem theorem_4_1_proof [Finite ι] [Nonempty ι] {T : SimpleGraph ι} (hT : T.IsTree) + {Λ : Type*} [LinearOrder Λ] (μ : Sym2 ι → Λ) + (he_inj : ∀ ⦃e₁ e₂ : Sym2 ι⦄, e₁ ∈ T.edgeSet → e₂ ∈ T.edgeSet → μ e₁ = μ e₂ → e₁ = e₂) + (sub : ι → Set ι) + (ht_mem : ∀ t : ι, t ∈ sub t) + (hsub_conv : ∀ t : ι, IsTreeConvex T (sub t)) + (hsub_ord : ∀ (t u v : ι), u ∈ sub t → v ∉ sub t → T.Adj u v → + ∀ x y : ι, Thomas.OnTreePathEdge T t v x y → μ s(u, v) ≤ μ s(x, y)) : + ∃ I : Set ι, (∀ i ∈ I, ∀ j ∈ I, i ≠ j → Disjoint (sub i) (sub j)) ∧ + (⋃ i ∈ I, sub i) = Set.univ := by + obtain ⟨I, _, hdisj, hunion⟩ := + saks_lemma_aux hT μ he_inj Set.univ Set.univ_nonempty (fun _ _ _ _ _ _ ↦ Set.mem_univ _) + sub (fun _ _ _ _ ↦ Set.mem_univ _) (fun t _ ↦ ht_mem t) (fun t _ ↦ hsub_conv t) + (fun t _ u hu v hv ↦ hsub_ord t u v hu hv.2) + exact ⟨I, hdisj, hunion⟩ + +/-! ## (4.2): Selecting a Basis of Isolating Locations -/ + +/-- For an edge `s(u, v)` of a standard decomposition `(T, τ)`, the separation +`(treeDecompSide T τ s(u, v) v, treeDecompSide T τ s(u, v) u)` is the `(𝒯 u, 𝒯 v)`-distinction. -/ +theorem isDistinction_treeDecompSide_of_adj {Λ : Type w} [LinearOrder Λ] {n : ℕ} + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : ℕ} {𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)} + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (h𝒯 : ∀ i : Fin n, GM10.IsTangle G θ (𝒯 i)) + (hstd : IsStandardDecomposition G lam 𝒯 T τ) + {u v : Fin n} (hadj : T.Adj u v) : + GM10.IsDistinction lam (𝒯 u) (𝒯 v) + (GM10.treeDecompSide T τ s(u, v) v) (GM10.treeDecompSide T τ s(u, v) u) := by + obtain ⟨e, _, he_path, _, A, B, hmAB, hdist_uv, _⟩ := hstd.path_min_isDistinction hadj.ne + have he_eq : e = s(u, v) := by + have hmem := he_path hadj.toWalk hadj.isPath_toWalk + simpa using hmem + subst he_eq + rcases (makesSeparation_adj_iff τ hadj A B).1 hmAB with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exfalso + have hu_in : (GM10.treeDecompSide T τ s(u, v) v, GM10.treeDecompSide T τ s(u, v) u) ∈ 𝒯 u := by + have h := hstd.side_mem_tangle u v u hadj.symm (Reachable.refl u) + rwa [Sym2.eq_swap] at h + exact GM10.theorem_2_1_proof (h𝒯 u) hdist_uv.1.1 hu_in + · exact hdist_uv + +/-- For any two separations `(A, B)` and `(A', B')` made by the same edge `e` under `(T, τ)`, +`lam (A, B) = lam (A', B')`. -/ +theorem lam_eq_of_makesSeparation {Λ : Type w} [LinearOrder Λ] [Fintype ι] + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} + (hD : GM10.IsTreeDecomposition G T τ) (hlam : GM10.IsTieBreaker G lam) + {e : Sym2 ι} {A B A' B' : Hypergraph α β} + (hm : GM10.MakesSeparation T τ e A B) (hm' : GM10.MakesSeparation T τ e A' B') : + lam (A, B) = lam (A', B') := by + have hsep := isSeparation_of_makesSeparation hD hm + have hsep' := isSeparation_of_makesSeparation hD hm' + rcases hm with ⟨u, v, hadj, rfl, rfl, rfl⟩ + rw [(hlam.axiom1 hsep hsep')] + rcases (makesSeparation_adj_iff τ hadj A' B').1 hm' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl ⟨rfl, rfl⟩ + · exact Or.inr ⟨rfl, rfl⟩ + +/-- **Claim (1)** in the proof of Graph Minors XVIII, (4.2) (pages 85–86): +If `e, e' ∈ E(T)` are distinct and make separations `(A, B), (A', B')` of `G`, then +`(A, B), (B, A) ≠ (A', B'), (B', A')`. -/ +theorem lemma_4_2_claim_1 {Λ : Type w} [LinearOrder Λ] {n : ℕ} + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : ℕ} {𝒯 : Fin n → Set (Hypergraph α β × Hypergraph α β)} + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (h𝒯 : ∀ i : Fin n, GM10.IsTangle G θ (𝒯 i)) + (hstd : IsStandardDecomposition G lam 𝒯 T τ) + {e e' : Sym2 (Fin n)} (hne : e ≠ e') + {A B A' B' : Hypergraph α β} + (hm : GM10.MakesSeparation T τ e A B) + (hm' : GM10.MakesSeparation T τ e' A' B') : + (A, B) ≠ (A', B') ∧ (B, A) ≠ (A', B') := by + have hD := hstd.isTreeDecomposition + rcases hm with ⟨i, j, hadj, rfl, rfl, rfl⟩ + rcases hm' with ⟨u, v, hadj', rfl, rfl, rfl⟩ + have hdist_ij := isDistinction_treeDecompSide_of_adj h𝒯 hstd hadj + have hdist_ji : GM10.IsDistinction lam (𝒯 j) (𝒯 i) + (GM10.treeDecompSide T τ s(i, j) i) (GM10.treeDecompSide T τ s(i, j) j) := by + have h := isDistinction_treeDecompSide_of_adj h𝒯 hstd hadj.symm + rwa [Sym2.eq_swap] at h + have hnot_i : (GM10.treeDecompSide T τ s(i, j) i, GM10.treeDecompSide T τ s(i, j) j) ∉ 𝒯 i := + GM10.theorem_2_1_proof (h𝒯 i) hdist_ij.1.1 + have hnot_j : (GM10.treeDecompSide T τ s(i, j) j, GM10.treeDecompSide T τ s(i, j) i) ∉ 𝒯 j := + GM10.theorem_2_1_proof (h𝒯 j) hdist_ji.1.1 + -- Since `s(i, j) ≠ s(u, v)`, `i` and `j` are adjacent in `T \ s(u, v)`, hence in the same + -- component of `T \ s(u, v)`. + have hadj_del : (T.deleteEdges {s(u, v)}).Adj i j := by + rw [deleteEdges_adj, Set.mem_singleton_iff] + exact ⟨hadj, hne⟩ + have hboth : + ((GM10.treeDecompSide T τ s(u, v) u, GM10.treeDecompSide T τ s(u, v) v) ∈ 𝒯 i ∧ + (GM10.treeDecompSide T τ s(u, v) u, GM10.treeDecompSide T τ s(u, v) v) ∈ 𝒯 j) ∨ + ((GM10.treeDecompSide T τ s(u, v) v, GM10.treeDecompSide T τ s(u, v) u) ∈ 𝒯 i ∧ + (GM10.treeDecompSide T τ s(u, v) v, GM10.treeDecompSide T τ s(u, v) u) ∈ 𝒯 j) := by + rcases reachable_deleteEdges_dichotomy hD.isTree hadj' i with ⟨hi_u, _⟩ | ⟨hi_v, _⟩ + · right + have hj_u : (T.deleteEdges {s(u, v)}).Reachable u j := hi_u.trans hadj_del.reachable + have h1 := hstd.side_mem_tangle i v u hadj'.symm (by rwa [Sym2.eq_swap]) + have h2 := hstd.side_mem_tangle j v u hadj'.symm (by rwa [Sym2.eq_swap]) + rw [Sym2.eq_swap] at h1 h2 + exact ⟨h1, h2⟩ + · left + have hj_v : (T.deleteEdges {s(u, v)}).Reachable v j := hi_v.trans hadj_del.reachable + exact ⟨hstd.side_mem_tangle i u v hadj' hi_v, hstd.side_mem_tangle j u v hadj' hj_v⟩ + rcases hboth with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · refine ⟨fun heq ↦ hnot_i (heq.symm ▸ h1), fun heq ↦ hnot_j (heq.symm ▸ h2)⟩ + · refine ⟨fun heq ↦ hnot_j ?_, fun heq ↦ hnot_i ?_⟩ + · rcases Prod.ext_iff.1 heq with ⟨hA, hB⟩ + change (GM10.treeDecompSide T τ s(i, j) i = GM10.treeDecompSide T τ s(u, v) u) at hA + change (GM10.treeDecompSide T τ s(i, j) j = GM10.treeDecompSide T τ s(u, v) v) at hB + rw [hB, hA] + exact h2 + · rcases Prod.ext_iff.1 heq with ⟨hA, hB⟩ + change (GM10.treeDecompSide T τ s(i, j) j = GM10.treeDecompSide T τ s(u, v) u) at hA + change (GM10.treeDecompSide T τ s(i, j) i = GM10.treeDecompSide T τ s(u, v) v) at hB + rw [hB, hA] + exact h1 + +/-- **Claim (2)** in the proof of Graph Minors XVIII, (4.2) (page 86): +Let `t_i ∈ V(S_h)` be adjacent in `T` to `t_j ∈ V(T) \ V(S_h)`, and let `(A, B)` be the +`(𝒯_h, 𝒯_j)`-distinction; then `(A, B) ∈ 𝒯_k` for every `t_k ∈ V(T_h)`, and `(A, B)` is the +`(𝒯_i, 𝒯_j)`-distinction. -/ +theorem lemma_4_2_claim_2 {Λ : Type w} [LinearOrder Λ] {n : ℕ} + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : ℕ} {𝒯 L : Fin n → Set (Hypergraph α β × Hypergraph α β)} + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (hlam : GM10.IsTieBreaker G lam) + (h𝒯 : ∀ i : Fin n, GM10.IsTangle G θ (𝒯 i)) + (hiso : ∀ i : Fin n, Isolates G lam θ (𝒯 i) (L i)) + (hstd : IsStandardDecomposition G lam 𝒯 T τ) + {h i j : Fin n} + (hi_Th : L h ⊆ 𝒯 i) (hj_not_Th : ¬ L h ⊆ 𝒯 j) + (hi_on_hj : Thomas.OnTreePath T h j i) + (hadj : T.Adj i j) + {A B : Hypergraph α β} (hdist_hj : GM10.IsDistinction lam (𝒯 h) (𝒯 j) A B) : + (∀ k : Fin n, L h ⊆ 𝒯 k → (A, B) ∈ 𝒯 k) ∧ + GM10.IsDistinction lam (𝒯 i) (𝒯 j) A B := by + have hD := hstd.isTreeDecomposition + obtain ⟨⟨C, D⟩, hCD_Lh, hCD_not_j⟩ := Set.not_subset.1 hj_not_Th + have hsep_CD : G.IsSeparation C D := (hiso h).isLocation.isSeparation hCD_Lh + have hord_CD : separationOrder C D < θ := (hiso h).order_lt hCD_Lh + have hDC_j : (D, C) ∈ 𝒯 j := ((h𝒯 j).axiom1 hsep_CD hord_CD).resolve_left hCD_not_j + have ⟨hA_le_C, hD_le_B⟩ := (hiso h).distinction_le hCD_Lh (h𝒯 j) le_rfl hDC_j hdist_hj + have hsep_AB : G.IsSeparation A B := (h𝒯 h).isSeparation hdist_hj.1.1 + have hord_AB : separationOrder A B < θ := (h𝒯 h).order_lt hdist_hj.1.1 + have hB_C_eq_G : B ∪ C = G := by + have hle : B ∪ C ≤ G := GM10.union_le hsep_AB.right_le hsep_CD.left_le + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle le_rfl + (Set.Subset.antisymm hle.vertexSet_subset + (hsep_CD.symm.vertexSet_union ▸ Set.union_subset_union_left _ hD_le_B.vertexSet_subset)) + (Set.Subset.antisymm hle.edgeSet_subset + (hsep_CD.symm.edgeSet_union ▸ Set.union_subset_union_left _ hD_le_B.edgeSet_subset)) + have hall_k : ∀ k : Fin n, L h ⊆ 𝒯 k → (A, B) ∈ 𝒯 k := by + intro k hk_Th + have hCD_k : (C, D) ∈ 𝒯 k := hk_Th hCD_Lh + have hBA_not_k : (B, A) ∉ 𝒯 k := fun hm ↦ by + apply (h𝒯 k).axiom2 hm hCD_k hCD_k + rw [GM10.union_assoc, GM10.union_self, hB_C_eq_G] + exact ((h𝒯 k).axiom1 hsep_AB hord_AB).resolve_right hBA_not_k + refine ⟨hall_k, ?_⟩ + have hAB_i : (A, B) ∈ 𝒯 i := hall_k i hi_Th + have hAB_dist_ij : GM10.Distinguishes (𝒯 i) (𝒯 j) A B := ⟨hAB_i, hdist_hj.1.2⟩ + let A' := GM10.treeDecompSide T τ s(i, j) j + let B' := GM10.treeDecompSide T τ s(i, j) i + have hdist_ij : GM10.IsDistinction lam (𝒯 i) (𝒯 j) A' B' := + isDistinction_treeDecompSide_of_adj h𝒯 hstd hadj + have hlam_1 : lam (A', B') ≤ lam (A, B) := hdist_ij.2 hAB_dist_ij + -- Since `i` lies on `h T j` and `T.Adj i j`, `h` is reachable from `i` in `T \ s(i, j)`. + have hh_reach_i : (T.deleteEdges {s(i, j)}).Reachable i h := by + rw [reachable_deleteEdges_iff_onTreePath hD.isTree hadj] + exact hi_on_hj + have hA'B'_h : (A', B') ∈ 𝒯 h := by + have hm := hstd.side_mem_tangle h j i hadj.symm (by rwa [Sym2.eq_swap]) + rwa [Sym2.eq_swap] at hm + have hA'B'_dist_hj : GM10.Distinguishes (𝒯 h) (𝒯 j) A' B' := ⟨hA'B'_h, hdist_ij.1.2⟩ + have hlam_2 : lam (A, B) ≤ lam (A', B') := hdist_hj.2 hA'B'_dist_hj + have hlam_eq : lam (A, B) = lam (A', B') := le_antisymm hlam_2 hlam_1 + have hsep_A'B' : G.IsSeparation A' B' := (h𝒯 i).isSeparation hdist_ij.1.1 + rcases (hlam.axiom1 hsep_AB hsep_A'B').1 hlam_eq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hdist_ij + · exact (GM10.theorem_2_1_proof (h𝒯 j) hdist_hj.1.2 hdist_ij.1.2).elim + +/-- **Claim (3)** in the proof of Graph Minors XVIII, (4.2) (page 86): +`T_h = {i : L h ⊆ 𝒯 i}` is a subtree of `T` (`IsTreeConvex T {i | L h ⊆ 𝒯 i}`). -/ +theorem lemma_4_2_claim_3 {Λ : Type w} [LinearOrder Λ] {n : ℕ} + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : ℕ} {𝒯 L : Fin n → Set (Hypergraph α β × Hypergraph α β)} + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (hlam : GM10.IsTieBreaker G lam) + (h𝒯 : ∀ i : Fin n, GM10.IsTangle G θ (𝒯 i)) + (hiso : ∀ i : Fin n, Isolates G lam θ (𝒯 i) (L i)) + (hstd : IsStandardDecomposition G lam 𝒯 T τ) + (h : Fin n) : + IsTreeConvex T {i : Fin n | L h ⊆ 𝒯 i} := by + have hD := hstd.isTreeDecomposition + let Th : Set (Fin n) := {i : Fin n | L h ⊆ 𝒯 i} + let Sh : Set (Fin n) := {k : Fin n | ∀ x : Fin n, Thomas.OnTreePath T h k x → x ∈ Th} + have hh_Sh : h ∈ Sh := by + intro x hx + have hxh : x = h := (Thomas.onTreePath_self T h x).1 hx + exact hxh ▸ (hiso h).subset + -- Show `Th ⊆ Sh`, hence `Sh = Th` and `Th` is tree-convex. + have hTh_sub_Sh : ∀ k : Fin n, k ∉ Sh → k ∉ Th := by + intro k hk_not_Sh hk_Th + obtain ⟨i, j, hij_edge, hi_Sh, hj_not_Sh⟩ := + Thomas.exists_onTreePathEdge_of_prop hD.isTree (· ∈ Sh) hh_Sh hk_not_Sh + have hi_Th : L h ⊆ 𝒯 i := hi_Sh i (Thomas.onTreePath_right T h i) + have ⟨hi_on_hj, hj_on_ik, _, _⟩ : + Thomas.OnTreePath T h j i ∧ Thomas.OnTreePath T i k j ∧ + ¬ Thomas.OnTreePath T h i j ∧ ¬ Thomas.OnTreePath T j k i := by + rcases hij_edge.orient hD.isTree with h1 | ⟨h1, _, _, _⟩ + · exact h1 + · exact (hj_not_Sh fun x hx ↦ hi_Sh x (Thomas.onTreePath_trans_left hD.isTree h1 hx)).elim + have hj_not_Th : ¬ L h ⊆ 𝒯 j := by + intro hj_Th + apply hj_not_Sh + intro x hx + rcases (Thomas.onTreePath_split_iff hD.isTree hi_on_hj).1 hx with hx_hi | hx_ij + · exact hi_Sh x hx_hi + · have hp : Thomas.treePath hD.isTree i j = hij_edge.1.toWalk := + (Thomas.eq_treePath hD.isTree hij_edge.1.toWalk hij_edge.1.isPath_toWalk).symm + have hmem := (Thomas.onTreePath_iff_mem_treePath hD.isTree).1 hx_ij + rw [hp, Walk.support_cons, Walk.support_nil, List.mem_cons, List.mem_singleton] at hmem + rcases hmem with rfl | rfl + · exact hi_Th + · exact hj_Th + have hhj_ne : h ≠ j := fun heq ↦ hj_not_Th (heq ▸ (hiso h).subset) + obtain ⟨e₀, _, _, _, A₀, B₀, _, hdist_hj, _⟩ := hstd.path_min_isDistinction hhj_ne + have ⟨hall_k, hdist_ij⟩ := + lemma_4_2_claim_2 hlam h𝒯 hiso hstd hi_Th hj_not_Th hi_on_hj hij_edge.1 hdist_hj + have hAB_k : (A₀, B₀) ∈ 𝒯 k := hall_k k hk_Th + -- On the other hand, `(A₀, B₀)` is the `(𝒯_i, 𝒯_j)`-distinction, so `(A₀, B₀)` is + -- `(treeDecompSide T τ s(i, j) j, treeDecompSide T τ s(i, j) i)` and `k` is on the `j`-side! + have hdist_ij' := isDistinction_treeDecompSide_of_adj h𝒯 hstd hij_edge.1 + have hlam_eq : lam (A₀, B₀) = + lam (GM10.treeDecompSide T τ s(i, j) j, GM10.treeDecompSide T τ s(i, j) i) := + le_antisymm (hdist_ij.2 hdist_ij'.1) (hdist_ij'.2 hdist_ij.1) + have hsep_AB₀ := (h𝒯 i).isSeparation hdist_ij.1.1 + have hsep_ij := (h𝒯 i).isSeparation hdist_ij'.1.1 + have heq_AB₀ : A₀ = GM10.treeDecompSide T τ s(i, j) j ∧ + B₀ = GM10.treeDecompSide T τ s(i, j) i := by + rcases (hlam.axiom1 hsep_AB₀ hsep_ij).1 hlam_eq with h1 | ⟨rfl, rfl⟩ + · exact h1 + · exact (GM10.theorem_2_1_proof (h𝒯 j) hdist_ij.1.2 hdist_ij'.1.2).elim + have hk_reach_j : (T.deleteEdges {s(i, j)}).Reachable j k := by + have h := reachable_deleteEdges_iff_onTreePath hD.isTree hij_edge.1.symm k + rw [Sym2.eq_swap] at h + exact h.2 (Thomas.onTreePath_symm hj_on_ik) + have hBA_k : (B₀, A₀) ∈ 𝒯 k := by + rw [heq_AB₀.1, heq_AB₀.2] + exact hstd.side_mem_tangle k i j hij_edge.1 hk_reach_j + exact GM10.theorem_2_1_proof (h𝒯 k) hAB_k hBA_k + intro u v hu hv x hx + have hu_Sh : u ∈ Sh := by + by_contra hu_not + exact hTh_sub_Sh u hu_not hu + have hv_Sh : v ∈ Sh := by + by_contra hv_not + exact hTh_sub_Sh v hv_not hv + rcases Thomas.onTreePath_left_or_right hD.isTree h hx with hx_uh | hx_hv + · exact hu_Sh x (Thomas.onTreePath_symm hx_uh) + · exact hv_Sh x hx_hv + +/-- **Claim (4)** in the proof of Graph Minors XVIII, (4.2) (page 86): +For each `e ∈ E(T)` with ends `t_i, t_j`, let `μ(e)` be the `λ`-order of the `(𝒯_i, +𝒯_j)`-distinction. +If `e ∈ E(T)` has one end `t_i ∈ V(T_h)` and the other `t_j ∈ V(T) \ V(T_h)`, and `f` is an edge of +the path of `T` between `t_h` and `t_j`, then `μ(e) ≤ μ(f)` (with strict inequality unless `e = f`). +-/ +theorem lemma_4_2_claim_4 {Λ : Type w} [LinearOrder Λ] {n : ℕ} + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : ℕ} {𝒯 L : Fin n → Set (Hypergraph α β × Hypergraph α β)} + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (hlam : GM10.IsTieBreaker G lam) + (h𝒯 : ∀ i : Fin n, GM10.IsTangle G θ (𝒯 i)) + (hiso : ∀ i : Fin n, Isolates G lam θ (𝒯 i) (L i)) + (hstd : IsStandardDecomposition G lam 𝒯 T τ) + (h i j : Fin n) (hi_Th : L h ⊆ 𝒯 i) (hj_not_Th : ¬ L h ⊆ 𝒯 j) (hadj : T.Adj i j) + (x y : Fin n) (hf_path : Thomas.OnTreePathEdge T h j x y) : + lam (GM10.treeDecompSide T τ s(i, j) j, GM10.treeDecompSide T τ s(i, j) i) ≤ + lam (GM10.treeDecompSide T τ s(x, y) x, GM10.treeDecompSide T τ s(x, y) y) := by + have hD := hstd.isTreeDecomposition + have hconv := lemma_4_2_claim_3 hlam h𝒯 hiso hstd h + have hi_on_hj : Thomas.OnTreePath T h j i := by + rcases Thomas.onTreePath_adj_dichotomy hD.isTree hadj h with ⟨hon, _⟩ | ⟨hon, _⟩ + · exact hon + · exfalso + exact hj_not_Th (hconv (hiso h).subset hi_Th hon) + have hhj_ne : h ≠ j := fun heq ↦ hj_not_Th (heq ▸ (hiso h).subset) + obtain ⟨e₀, he₀_T, he₀_path, he₀_min, A₀, B₀, hm₀, hdist_hj, _⟩ := + hstd.path_min_isDistinction hhj_ne + have ⟨_, hdist_ij⟩ := + lemma_4_2_claim_2 hlam h𝒯 hiso hstd hi_Th hj_not_Th hi_on_hj hadj hdist_hj + have hdist_ij' := isDistinction_treeDecompSide_of_adj h𝒯 hstd hadj + have hlam_eq : lam (GM10.treeDecompSide T τ s(i, j) j, GM10.treeDecompSide T τ s(i, j) i) = + lam (A₀, B₀) := + le_antisymm (hdist_ij'.2 hdist_ij.1) (hdist_ij.2 hdist_ij'.1) + rw [hlam_eq] + exact he₀_min s(x, y) (T.mem_edgeSet.2 hf_path.1) hf_path.2 A₀ B₀ + (GM10.treeDecompSide T τ s(x, y) x) (GM10.treeDecompSide T τ s(x, y) y) hm₀ + ⟨x, y, hf_path.1, rfl, rfl, rfl⟩ + +/-- **Graph Minors XVIII, (4.2)** (page 85): +"Let $\mathcal{T}_j$ ($j \in J$) be distinct tangles of order $\theta$ in a hypergraph $G$, +let $\lambda$ be a tie-breaker in $G$, and for each $j \in J$ let $\mathcal{L}_j \subseteq +\mathcal{T}_j$ be a location which $\theta$-isolates $\mathcal{T}_j$ with respect to +$\lambda$. Then there exists $I \subseteq J$ such that for every $j \in J$ there is a unique +$i \in I$ with $\mathcal{L}_i \subseteq \mathcal{T}_j$." -/ +theorem theorem_4_2_proof {Λ : Type w} [LinearOrder Λ] {n : ℕ} + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : ℕ} {𝒯 L : Fin n → Set (Hypergraph α β × Hypergraph α β)} + (hlam : GM10.IsTieBreaker G lam) + (h𝒯 : ∀ i : Fin n, GM10.IsTangle G θ (𝒯 i)) + (hdist : Function.Injective 𝒯) + (hiso : ∀ i : Fin n, Isolates G lam θ (𝒯 i) (L i)) : + ∃ I : Set (Fin n), ∀ j : Fin n, ∃! i : Fin n, i ∈ I ∧ L i ⊆ 𝒯 j := by + classical + rcases Nat.eq_zero_or_pos n with rfl | hn + · exact ⟨∅, fun j ↦ j.elim0⟩ + · have : Nonempty (Fin n) := ⟨⟨0, hn⟩⟩ + obtain ⟨T, τ, hstd⟩ := theorem_2_6_proof G lam θ 𝒯 hn hlam h𝒯 hdist + have hD := hstd.isTreeDecomposition + let μ : Sym2 (Fin n) → Λ := fun e ↦ + if he : ∃ u v : Fin n, T.Adj u v ∧ e = s(u, v) then + let u := he.choose + let v := he.choose_spec.choose + lam (GM10.treeDecompSide T τ s(u, v) u, GM10.treeDecompSide T τ s(u, v) v) + else + lam (G, G) + have hμ_adj : ∀ {u v : Fin n}, T.Adj u v → + μ s(u, v) = lam (GM10.treeDecompSide T τ s(u, v) u, GM10.treeDecompSide T τ s(u, v) v) := by + intro u v hadj + have hex : ∃ u' v' : Fin n, T.Adj u' v' ∧ s(u, v) = s(u', v') := ⟨u, v, hadj, rfl⟩ + have hμ_def : μ s(u, v) = + lam (GM10.treeDecompSide T τ s(hex.choose, hex.choose_spec.choose) hex.choose, + GM10.treeDecompSide T τ s(hex.choose, hex.choose_spec.choose) hex.choose_spec.choose) + := by + dsimp only [μ] + split_ifs + rfl + rw [hμ_def] + exact lam_eq_of_makesSeparation hD hlam + ⟨hex.choose, hex.choose_spec.choose, hex.choose_spec.choose_spec.1, + hex.choose_spec.choose_spec.2, rfl, rfl⟩ + ⟨u, v, hadj, rfl, rfl, rfl⟩ + have hμ_symm : ∀ {u v : Fin n}, T.Adj u v → + lam (GM10.treeDecompSide T τ s(u, v) v, GM10.treeDecompSide T τ s(u, v) u) = + lam (GM10.treeDecompSide T τ s(u, v) u, GM10.treeDecompSide T τ s(u, v) v) := by + intro u v hadj + exact lam_eq_of_makesSeparation hD hlam + (makesSeparation_adj_iff τ hadj _ _ |>.2 (Or.inr ⟨rfl, rfl⟩)) + (makesSeparation_adj_iff τ hadj _ _ |>.2 (Or.inl ⟨rfl, rfl⟩)) + have he_inj : ∀ ⦃e₁ e₂ : Sym2 (Fin n)⦄, + e₁ ∈ T.edgeSet → e₂ ∈ T.edgeSet → μ e₁ = μ e₂ → e₁ = e₂ := by + intro e₁ e₂ he₁ he₂ hμ_eq + rcases e₁ with ⟨u₁, v₁⟩ + rcases e₂ with ⟨u₂, v₂⟩ + have hadj₁ : T.Adj u₁ v₁ := T.mem_edgeSet.1 he₁ + have hadj₂ : T.Adj u₂ v₂ := T.mem_edgeSet.1 he₂ + rw [hμ_adj hadj₁, hμ_adj hadj₂] at hμ_eq + have hsep₁ := (isSeparation_treeDecompSide hD hadj₁).1 + have hsep₂ := (isSeparation_treeDecompSide hD hadj₂).1 + by_contra hne + have ⟨hne1, hne2⟩ := lemma_4_2_claim_1 h𝒯 hstd hne + ⟨u₁, v₁, hadj₁, rfl, rfl, rfl⟩ ⟨u₂, v₂, hadj₂, rfl, rfl, rfl⟩ + rcases (hlam.axiom1 hsep₁ hsep₂).1 hμ_eq with ⟨hA, hB⟩ | ⟨hA, hB⟩ + · exact hne1 (Prod.ext hA hB) + · exact hne2 (Prod.ext hB hA) + let sub : Fin n → Set (Fin n) := fun h ↦ {i : Fin n | L h ⊆ 𝒯 i} + obtain ⟨I, hdisj, hunion⟩ := theorem_4_1_proof hD.isTree μ he_inj sub + (fun h ↦ (hiso h).subset) + (lemma_4_2_claim_3 hlam h𝒯 hiso hstd) + (fun h i j hi hj hadj x y hf ↦ by + rw [hμ_adj hadj, ← hμ_symm hadj, hμ_adj hf.1] + exact lemma_4_2_claim_4 hlam h𝒯 hiso hstd h i j hi hj hadj x y hf) + refine ⟨I, fun j ↦ ?_⟩ + have hj_mem : j ∈ ⋃ i ∈ I, sub i := hunion.symm ▸ Set.mem_univ j + rw [Set.mem_iUnion₂] at hj_mem + obtain ⟨i, hi_I, hj_sub⟩ := hj_mem + refine ⟨i, ⟨hi_I, hj_sub⟩, fun i' ⟨hi'_I, hj_sub'⟩ ↦ ?_⟩ + by_contra hne + exact Set.disjoint_left.1 (hdisj i' hi'_I i hi_I hne) hj_sub' hj_sub + +/-! ## (4.3): Enlargement of Isolating Locations in a Standard Decomposition -/ + +/-- **Claim (1)** in the proof of Graph Minors XVIII, (4.3) (page 87): +If `(A, B) ∈ vertexLocation T τ i`, then `(A, B)` has order `≤ (3/4) θ` and there exists +`(C_h, D_h) ∈ L i` such that `A ≤ C_h` and `D_h ≤ B`. -/ +theorem lemma_4_3_claim_1 {Λ : Type w} [LinearOrder Λ] {n : ℕ} + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : ℕ} {𝒯 L : Fin n → Set (Hypergraph α β × Hypergraph α β)} + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (hlam : GM10.IsTieBreaker G lam) + (h𝒯 : ∀ i : Fin n, GM10.IsTangle G θ (𝒯 i)) + (hiso : ∀ i : Fin n, Isolates G lam θ (𝒯 i) (L i)) + (hord_L : ∀ i : Fin n, 4 * locationOrder (L i) ≤ 3 * θ) + (huniq : ∀ 𝒯' : Set (Hypergraph α β × Hypergraph α β), + GM10.IsTangle G θ 𝒯' → ∃! i : Fin n, L i ⊆ 𝒯') + (hstd : IsStandardDecomposition G lam 𝒯 T τ) + (i : Fin n) {A B : Hypergraph α β} + (hAB : (A, B) ∈ vertexLocation T τ i) : + 4 * separationOrder A B ≤ 3 * θ ∧ + ∃ p ∈ L i, A ≤ p.1 ∧ p.2 ≤ B := by + have hD := hstd.isTreeDecomposition + obtain ⟨j, hadj, heq_AB⟩ := hAB + have hA_eq : A = GM10.treeDecompSide T τ s(j, i) j := congrArg Prod.fst heq_AB + have hB_eq : B = GM10.treeDecompSide T τ s(j, i) i := congrArg Prod.snd heq_AB + have hdist_ij : GM10.IsDistinction lam (𝒯 i) (𝒯 j) A B := by + rw [hA_eq, hB_eq, Sym2.eq_swap] + exact isDistinction_treeDecompSide_of_adj h𝒯 hstd hadj + have hij_ne : i ≠ j := hadj.ne + have hLi_not_Tj : ¬ L i ⊆ 𝒯 j := by + intro hsub + have h_eq := (huniq (𝒯 j) (h𝒯 j)).unique hsub (hiso j).subset + exact hij_ne h_eq + obtain ⟨⟨C, D⟩, hCD_Li, hCD_not_j⟩ := Set.not_subset.1 hLi_not_Tj + have hsep_CD := (hiso i).isLocation.isSeparation hCD_Li + have hord_CD_lt : separationOrder C D < θ := (hiso i).order_lt hCD_Li + have hDC_j : (D, C) ∈ 𝒯 j := ((h𝒯 j).axiom1 hsep_CD hord_CD_lt).resolve_left hCD_not_j + have ⟨hA_le_C, hD_le_B⟩ := (hiso i).distinction_le hCD_Li (h𝒯 j) le_rfl hDC_j hdist_ij + have hCD_dist : GM10.Distinguishes (𝒯 i) (𝒯 j) C D := ⟨(hiso i).subset hCD_Li, hDC_j⟩ + have hlam_le : lam (A, B) ≤ lam (C, D) := hdist_ij.2 hCD_dist + have hsep_AB := (h𝒯 i).isSeparation hdist_ij.1.1 + have hord_AB_le_CD : separationOrder A B ≤ separationOrder C D := by + by_contra! hlt + exact not_lt_of_ge hlam_le (hlam.axiom3 hsep_CD hsep_AB hlt) + have hord_CD_le_loc : separationOrder C D ≤ locationOrder (L i) := + separationOrder_le_locationOrder (hiso i).isLocation hCD_Li + have hord_bound : 4 * separationOrder A B ≤ 3 * θ := by + have := hord_L i + omega + exact ⟨hord_bound, ⟨(C, D), hCD_Li, hA_le_C, hD_le_B⟩⟩ + +/-- **Claim (2)** in the proof of Graph Minors XVIII, (4.3) (page 87): +Each member `(A, B)` of `vertexLocation T τ i` is titanic in `G`. -/ +theorem lemma_4_3_claim_2 {Λ : Type w} [LinearOrder Λ] {n : ℕ} + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : ℕ} {𝒯 L : Fin n → Set (Hypergraph α β × Hypergraph α β)} + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (hlam : GM10.IsTieBreaker G lam) + (h𝒯 : ∀ i : Fin n, GM10.IsTangle G θ (𝒯 i)) + (hiso : ∀ i : Fin n, Isolates G lam θ (𝒯 i) (L i)) + (hord_L : ∀ i : Fin n, 4 * locationOrder (L i) ≤ 3 * θ) + (huniq : ∀ 𝒯' : Set (Hypergraph α β × Hypergraph α β), + GM10.IsTangle G θ 𝒯' → ∃! i : Fin n, L i ⊆ 𝒯') + (hstd : IsStandardDecomposition G lam 𝒯 T τ) + (i : Fin n) {A B : Hypergraph α β} + (hAB : (A, B) ∈ vertexLocation T τ i) : + GM10.IsTitanic G A B := by + have ⟨hord_AB, _⟩ := lemma_4_3_claim_1 hlam h𝒯 hiso hord_L huniq hstd i hAB + obtain ⟨j, hadj, heq_AB⟩ := hAB + have hA_eq : A = GM10.treeDecompSide T τ s(j, i) j := congrArg Prod.fst heq_AB + have hB_eq : B = GM10.treeDecompSide T τ s(j, i) i := congrArg Prod.snd heq_AB + have hdist_ij : GM10.IsDistinction lam (𝒯 i) (𝒯 j) A B := by + rw [hA_eq, hB_eq, Sym2.eq_swap] + exact isDistinction_treeDecompSide_of_adj h𝒯 hstd hadj + have hsep_AB := (h𝒯 i).isSeparation hdist_ij.1.1 + -- Show `(B, A)` is linked to `𝒯 j`. + have hlink : IsLinkedTo (𝒯 j) B A := by + refine ⟨hdist_ij.1.2, fun B' A' hB'A'_j hB_le_B' hA'_le_A ↦ ?_⟩ + by_contra! hlt + have hsep_B'A' := (h𝒯 j).isSeparation hB'A'_j + have hord_B'A'_lt : separationOrder B' A' < θ := (h𝒯 j).order_lt hB'A'_j + have hord_A'B'_lt : separationOrder A' B' < θ := by + rwa [GM10.separationOrder_comm] + have hA'B'_i : (A', B') ∈ 𝒯 i := + GM10.theorem_2_9_proof (h𝒯 i) hdist_ij.1.1 hsep_B'A'.symm hord_A'B'_lt + (Or.inr (Or.inl hA'_le_A.vertexSet_subset)) + have hdist_A'B' : GM10.Distinguishes (𝒯 i) (𝒯 j) A' B' := ⟨hA'B'_i, hB'A'_j⟩ + have hlam_le : lam (A, B) ≤ lam (A', B') := hdist_ij.2 hdist_A'B' + have hlt_A'B' : separationOrder A' B' < separationOrder A B := by + rwa [GM10.separationOrder_comm A' B', GM10.separationOrder_comm A B] + exact not_lt_of_ge hlam_le (hlam.axiom3 hsep_B'A'.symm hsep_AB hlt_A'B') + have hord_BA : 4 * separationOrder B A ≤ 3 * θ := by + rwa [GM10.separationOrder_comm] + exact theorem_3_3_proof (h𝒯 j) hlink hord_BA + +/-- **Claim (3)** in the proof of Graph Minors XVIII, (4.3) (pages 87–88): +Let `part` be a partition of `ℒ* = vertexLocation T τ i` indexed by `p ∈ L i` such that every +`(A, B) ∈ part p` satisfies `A ≤ p.1` and `p.2 ≤ B`. Then for each `p = (C_h, D_h) ∈ L i`, there is +no tangle `𝒯` of order `θ` in `G` with `part p ∪ {(D_h, C_h)} ⊆ 𝒯`. -/ +theorem lemma_4_3_claim_3 {Λ : Type w} [LinearOrder Λ] {n : ℕ} + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : ℕ} {𝒯 L : Fin n → Set (Hypergraph α β × Hypergraph α β)} + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (h𝒯 : ∀ i : Fin n, GM10.IsTangle G θ (𝒯 i)) + (hiso : ∀ i : Fin n, Isolates G lam θ (𝒯 i) (L i)) + (huniq : ∀ 𝒯' : Set (Hypergraph α β × Hypergraph α β), + GM10.IsTangle G θ 𝒯' → ∃! i : Fin n, L i ⊆ 𝒯') + (hstd : IsStandardDecomposition G lam 𝒯 T τ) + (i : Fin n) + {part : Hypergraph α β × Hypergraph α β → Set (Hypergraph α β × Hypergraph α β)} + (henl : IsLocationEnlargementVia G (L i) (vertexLocation T τ i) part) + {p : Hypergraph α β × Hypergraph α β} (hp : p ∈ L i) + {𝒯' : Set (Hypergraph α β × Hypergraph α β)} (h𝒯' : GM10.IsTangle G θ 𝒯') : + ¬ (part p ∪ {(p.2, p.1)} ⊆ 𝒯') := by + have hD := hstd.isTreeDecomposition + intro hsub_T' + have hDC_T' : (p.2, p.1) ∈ 𝒯' := hsub_T' (Or.inr (Set.mem_singleton _)) + have hpart_T' : part p ⊆ 𝒯' := Set.Subset.trans Set.subset_union_left hsub_T' + obtain ⟨j, ⟨hj_sub, _⟩⟩ := huniq 𝒯' h𝒯' + have hij_ne : i ≠ j := by + rintro rfl + have hCD_T' : (p.1, p.2) ∈ 𝒯' := hj_sub hp + exact GM10.theorem_2_1_proof h𝒯' hCD_T' hDC_T' + obtain ⟨e₀, he₀_T, he₀_path, _, A₀, B₀, hm₀, hdist_ij, hdist_ji⟩ := + hstd.path_min_isDistinction hij_ne + -- Since `i ≠ j`, `L j` is not a subset of `𝒯 i`. + have hLj_not_Ti : ¬ L j ⊆ 𝒯 i := by + intro hsub + exact hij_ne ((huniq (𝒯 i) (h𝒯 i)).unique (hiso i).subset hsub) + obtain ⟨⟨C, D⟩, hCD_Lj, hCD_not_i⟩ := Set.not_subset.1 hLj_not_Ti + have hsep_CD := (hiso j).isLocation.isSeparation hCD_Lj + have hord_CD : separationOrder C D < θ := (hiso j).order_lt hCD_Lj + have hDC_i : (D, C) ∈ 𝒯 i := ((h𝒯 i).axiom1 hsep_CD hord_CD).resolve_left hCD_not_i + -- Since `(B₀, A₀)` is the `(𝒯_j, 𝒯_i)`-distinction and `L j` `θ`-isolates `𝒯_j`, `D ≤ A₀`. + have ⟨_, hD_le_A₀⟩ := (hiso j).distinction_le hCD_Lj (h𝒯 i) le_rfl hDC_i hdist_ji + have hCD_T' : (C, D) ∈ 𝒯' := hj_sub hCD_Lj + have hsep_B₀A₀ := (h𝒯 j).isSeparation hdist_ji.1.1 + have hord_B₀A₀ : separationOrder B₀ A₀ < θ := (h𝒯 j).order_lt hdist_ji.1.1 + have hB₀A₀_T' : (B₀, A₀) ∈ 𝒯' := + GM10.theorem_2_9_proof h𝒯' hCD_T' hsep_B₀A₀ hord_B₀A₀ + (Or.inl hD_le_A₀.vertexSet_subset) + -- Let `j'` be the first neighbor of `i` on the path from `i` to `j` in `T`. + obtain ⟨i₀, j', hij'_edge, hi₀_eq, hj'_ne_i⟩ := + Thomas.exists_onTreePathEdge_of_prop hD.isTree (i = ·) rfl hij_ne + subst i₀ + have hadj_ij' : T.Adj i j' := hij'_edge.1 + let A' := GM10.treeDecompSide T τ s(j', i) j' + let B' := GM10.treeDecompSide T τ s(j', i) i + have hA'B'_loc : (A', B') ∈ vertexLocation T τ i := ⟨j', hadj_ij', rfl⟩ + -- Show `B' ≤ B₀`: the edge `e₀` lies on the path `i T j`. + rcases hm₀ with ⟨u, v, hadj_uv, rfl, hA₀_def, hB₀_def⟩ + have he₀_edge : Thomas.OnTreePathEdge T i j u v := ⟨hadj_uv, he₀_path⟩ + -- In `T`, `i` is reachable from `v` in `T \ s(u, v)` (since `(A₀, B₀) ∈ 𝒯 i`). + have hi_reach_v : (T.deleteEdges {s(u, v)}).Reachable v i := by + rcases reachable_deleteEdges_dichotomy hD.isTree hadj_uv i with ⟨hi_u, _⟩ | ⟨hi_v, _⟩ + · exfalso + have hBA_i : (B₀, A₀) ∈ 𝒯 i := by + rw [hA₀_def, hB₀_def] + have hm := hstd.side_mem_tangle i v u hadj_uv.symm (by rwa [Sym2.eq_swap]) + rwa [Sym2.eq_swap] at hm + exact GM10.theorem_2_1_proof (h𝒯 i) hdist_ij.1.1 hBA_i + · exact hi_v + have hi_on_v : Thomas.OnTreePath T i u v := + (reachable_deleteEdges_iff_onTreePath hD.isTree hadj_uv.symm i).1 + (by rwa [Sym2.eq_swap] at hi_reach_v) + have hu_ne_i : u ≠ i := by + rintro rfl + exact hadj_uv.ne ((Thomas.onTreePath_self T u v).1 hi_on_v).symm + -- Also `j` is on the `j'`-side of `s(i, j')`: + have hj_on_j' : Thomas.OnTreePath T j i j' := by + rcases hij'_edge.orient hD.isTree with ⟨_, h2, _, _⟩ | ⟨h1, _, _, _⟩ + · exact Thomas.onTreePath_symm h2 + · exact (hj'_ne_i ((Thomas.onTreePath_self T i j').1 h1).symm).elim + have hu_on_j' : Thomas.OnTreePath T u i j' := by + rcases Thomas.onTreePath_adj_dichotomy hD.isTree hadj_ij' u with ⟨hu_i, _⟩ | ⟨hu_j', _⟩ + · exfalso + have hu_ji := (Thomas.onTreePath_of_sides hD.isTree hadj_ij' hu_i hj_on_j').1 + exact hu_ne_i (Thomas.onTreePath_antisymm hD.isTree + (Thomas.onTreePath_symm he₀_edge.onTreePath_left) (Thomas.onTreePath_symm hu_ji)) + · exact hu_j' + have hB'_le_B₀ : B' ≤ B₀ := by + classical + dsimp only [B', GM10.treeDecompSide] + rw [hB₀_def] + dsimp only [GM10.treeDecompSide] + refine biUnion_mono (fun s _ ↦ hD.le s) fun s hs ↦ ?_ + rw [Finset.mem_filter] at hs ⊢ + refine ⟨Finset.mem_univ s, ?_⟩ + rw [Sym2.eq_swap, reachable_deleteEdges_iff_onTreePath hD.isTree hadj_uv.symm] + have hs_on : Thomas.OnTreePath T s j' i := + (reachable_deleteEdges_iff_onTreePath hD.isTree hadj_ij' s).1 + (by have hs2 := hs.2; rwa [Sym2.eq_swap] at hs2) + rcases Thomas.onTreePath_adj_dichotomy hD.isTree hadj_uv.symm s with ⟨hs_v, _⟩ | ⟨hs_u, _⟩ + · exact hs_v + · exfalso + have h_si_u := (Thomas.onTreePath_of_sides hD.isTree hadj_uv hs_u hi_on_v).1 + have h_su_i := (Thomas.onTreePath_of_sides hD.isTree hadj_ij' hs_on hu_on_j').1 + exact hu_ne_i (Thomas.onTreePath_antisymm hD.isTree h_si_u h_su_i) + have hsep_A'B' := (isSeparation_treeDecompSide hD hadj_ij'.symm).1 + have hdist_ij' : GM10.IsDistinction lam (𝒯 i) (𝒯 j') A' B' := by + dsimp [A', B'] + rw [Sym2.eq_swap] + exact isDistinction_treeDecompSide_of_adj h𝒯 hstd hadj_ij' + have hord_B'A' : separationOrder B' A' < θ := by + rw [GM10.separationOrder_comm] + exact (h𝒯 i).order_lt hdist_ij'.1.1 + have hB'A'_T' : (B', A') ∈ 𝒯' := + GM10.theorem_2_9_proof h𝒯' hB₀A₀_T' hsep_A'B'.symm hord_B'A' + (Or.inr (Or.inl hB'_le_B₀.vertexSet_subset)) + -- Now choose `q ∈ L i` such that `(A', B') ∈ part q`. + have hA'B'_in_union : (A', B') ∈ ⋃ q ∈ L i, part q := henl.biUnion_eq.symm ▸ hA'B'_loc + rw [Set.mem_iUnion₂] at hA'B'_in_union + obtain ⟨q, hq_Li, hA'B'_part_q⟩ := hA'B'_in_union + have ⟨hA'_le_q1, hq2_le_B'⟩ := henl.le_of_mem_part hq_Li hA'B'_part_q + have hsep_q := (hiso i).isLocation.isSeparation hq_Li + have hord_q : separationOrder q.1 q.2 < θ := (hiso i).order_lt hq_Li + have hB'_q1_eq_G : B' ∪ q.1 = G := by + have hle : B' ∪ q.1 ≤ G := GM10.union_le hsep_A'B'.right_le hsep_q.left_le + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle le_rfl + (Set.Subset.antisymm hle.vertexSet_subset + (hsep_A'B'.symm.vertexSet_union ▸ + Set.union_subset_union_right _ hA'_le_q1.vertexSet_subset)) + (Set.Subset.antisymm hle.edgeSet_subset + (hsep_A'B'.symm.edgeSet_union ▸ + Set.union_subset_union_right _ hA'_le_q1.edgeSet_subset)) + have hq12_not_T' : (q.1, q.2) ∉ 𝒯' := fun hm ↦ by + apply h𝒯'.axiom2 hB'A'_T' hm hm + rw [GM10.union_assoc, GM10.union_self, hB'_q1_eq_G] + have hq21_T' : (q.2, q.1) ∈ 𝒯' := (h𝒯'.axiom1 hsep_q hord_q).resolve_left hq12_not_T' + have hqp_eq : q = p := by + by_contra hne + have hq1_le_p2 : q.1 ≤ p.2 := (hiso i).isLocation.left_le_right hq_Li hp hne + have hq2_p2_eq_G : q.2 ∪ p.2 = G := by + have hle : q.2 ∪ p.2 ≤ G := + GM10.union_le hsep_q.right_le ((hiso i).isLocation.isSeparation hp).right_le + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle le_rfl + (Set.Subset.antisymm hle.vertexSet_subset + (hsep_q.symm.vertexSet_union ▸ + Set.union_subset_union_right _ hq1_le_p2.vertexSet_subset)) + (Set.Subset.antisymm hle.edgeSet_subset + (hsep_q.symm.edgeSet_union ▸ + Set.union_subset_union_right _ hq1_le_p2.edgeSet_subset)) + apply h𝒯'.axiom2 hq21_T' hDC_T' hDC_T' + rw [GM10.union_assoc, GM10.union_self, hq2_p2_eq_G] + subst hqp_eq + have hA'B'_T' : (A', B') ∈ 𝒯' := hpart_T' hA'B'_part_q + exact GM10.theorem_2_1_proof h𝒯' hA'B'_T' hB'A'_T' + +/-- **Claim (4)** in the proof of Graph Minors XVIII, (4.3) (page 88): +Let `ℒ' = {(A, B ∩ C_h) : (A, B) ∈ part p}` for `p = (C_h, D_h) ∈ L i`. There is no tangle in +`C_h` of order `θ` including `ℒ'`. -/ +theorem lemma_4_3_claim_4 {Λ : Type w} [LinearOrder Λ] {n : ℕ} + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : ℕ} {𝒯 L : Fin n → Set (Hypergraph α β × Hypergraph α β)} + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (h𝒯 : ∀ i : Fin n, GM10.IsTangle G θ (𝒯 i)) + (hiso : ∀ i : Fin n, Isolates G lam θ (𝒯 i) (L i)) + (huniq : ∀ 𝒯' : Set (Hypergraph α β × Hypergraph α β), + GM10.IsTangle G θ 𝒯' → ∃! i : Fin n, L i ⊆ 𝒯') + (hstd : IsStandardDecomposition G lam 𝒯 T τ) + (i : Fin n) + {part : Hypergraph α β × Hypergraph α β → Set (Hypergraph α β × Hypergraph α β)} + (henl : IsLocationEnlargementVia G (L i) (vertexLocation T τ i) part) + {p : Hypergraph α β × Hypergraph α β} (hp : p ∈ L i) + {𝒯' : Set (Hypergraph α β × Hypergraph α β)} (h𝒯' : GM10.IsTangle p.1 θ 𝒯') : + ¬ ((fun q ↦ (q.1, q.2 ∩ p.1)) '' part p ⊆ 𝒯') := by + intro hsub_T' + have hsep_p := (hiso i).isLocation.isSeparation hp + have hord_p : separationOrder p.1 p.2 < θ := (hiso i).order_lt hp + let 𝒯_G : Set (Hypergraph α β × Hypergraph α β) := + {q | G.IsSeparation q.1 q.2 ∧ separationOrder q.1 q.2 < θ ∧ + (q.1 ∩ p.1, q.2 ∩ p.1) ∈ 𝒯'} + have h𝒯_G : GM10.IsTangle G θ 𝒯_G := theorem_2_1_proof hsep_p.left_le h𝒯' + refine lemma_4_3_claim_3 h𝒯 hiso huniq hstd i henl hp h𝒯_G ?_ + rintro q (hq_part | hq_eq) + · have hq_loc : q ∈ vertexLocation T τ i := henl.part_subset hp hq_part + obtain ⟨j, hadj, heq_q⟩ := hq_loc + have hq_sep : G.IsSeparation q.1 q.2 := by + rw [congrArg Prod.fst heq_q, congrArg Prod.snd heq_q] + exact (isSeparation_treeDecompSide hstd.isTreeDecomposition hadj.symm).1 + have hq_ord : separationOrder q.1 q.2 < θ := by + rw [congrArg Prod.fst heq_q, congrArg Prod.snd heq_q, Sym2.eq_swap] + exact (h𝒯 i).order_lt (isDistinction_treeDecompSide_of_adj h𝒯 hstd hadj).1.1 + have ⟨hq1_le_p1, _⟩ := henl.le_of_mem_part hp hq_part + have hq1_inter : q.1 ∩ p.1 = q.1 := by + rw [GM10.inter_comm, inter_self_of_le hq1_le_p1] + refine ⟨hq_sep, hq_ord, ?_⟩ + rw [hq1_inter] + exact hsub_T' ⟨q, hq_part, rfl⟩ + · rw [Set.mem_singleton_iff] at hq_eq + subst hq_eq + have hsep_DC : G.IsSeparation p.2 p.1 := hsep_p.symm + have hord_DC : separationOrder p.2 p.1 < θ := by + rwa [GM10.separationOrder_comm] + refine ⟨hsep_DC, hord_DC, ?_⟩ + have hsep_inter : p.1.IsSeparation (p.2 ∩ p.1) (p.1 ∩ p.1) := + isSeparation_inter_of_le hsep_p.left_le hsep_DC + have hord_inter : separationOrder (p.2 ∩ p.1) (p.1 ∩ p.1) < θ := + separationOrder_inter_le.trans_lt hord_DC + have hnot_swap : (p.1 ∩ p.1, p.2 ∩ p.1) ∉ 𝒯' := fun hm ↦ + h𝒯'.axiom3 hm (by rw [GM10.inter_self]) + exact (h𝒯'.axiom1 hsep_inter hord_inter).resolve_right hnot_swap + +private theorem isLocation_inter_part {G : Hypergraph α β} + {ℒ ℒ_star : Set (Hypergraph α β × Hypergraph α β)} + {part : Hypergraph α β × Hypergraph α β → Set (Hypergraph α β × Hypergraph α β)} + (henl : IsLocationEnlargementVia G ℒ ℒ_star part) + {p : Hypergraph α β × Hypergraph α β} (hp : p ∈ ℒ) : + GM10.IsLocation p.1 ((fun q ↦ (q.1, q.2 ∩ p.1)) '' part p) ∧ + (∀ ⦃q⦄, q ∈ part p → (q.1 ∩ (q.2 ∩ p.1)) = q.1 ∩ q.2) ∧ + locationOrder ((fun q ↦ (q.1, q.2 ∩ p.1)) '' part p) ≤ locationOrder ℒ_star := by + have hsep_p := henl.isLocation_left.isSeparation hp + have hinter_eq : ∀ ⦃q⦄, q ∈ part p → (q.1 ∩ (q.2 ∩ p.1)) = q.1 ∩ q.2 := by + intro q hq + have hq1_le_p1 := (henl.le_of_mem_part hp hq).1 + rw [← GM10.inter_assoc, GM10.inter_comm q.1 q.2, GM10.inter_assoc, + GM10.inter_comm q.1 p.1, inter_self_of_le hq1_le_p1, GM10.inter_comm] + have hloc : GM10.IsLocation p.1 ((fun q ↦ (q.1, q.2 ∩ p.1)) '' part p) := by + refine ⟨?_, ?_⟩ + · rintro _ ⟨q, hq, rfl⟩ + have hq_sep := henl.isLocation_right.isSeparation (henl.part_subset hp hq) + have hq1_le_p1 := (henl.le_of_mem_part hp hq).1 + have hq1_inter : q.1 ∩ p.1 = q.1 := by + rw [GM10.inter_comm, inter_self_of_le hq1_le_p1] + simpa [hq1_inter] using isSeparation_inter_of_le hsep_p.left_le hq_sep + · rintro _ ⟨q₁, hq₁, rfl⟩ _ ⟨q₂, hq₂, rfl⟩ hne + have hq_ne : q₁ ≠ q₂ := + fun heq ↦ hne (congrArg (fun q : Hypergraph α β × Hypergraph α β ↦ (q.1, q.2 ∩ p.1)) heq) + have hq₁_le_q₂ := henl.isLocation_right.left_le_right + (henl.part_subset hp hq₁) (henl.part_subset hp hq₂) hq_ne + have hq₁_le_p1 := (henl.le_of_mem_part hp hq₁).1 + have hq₂_p1_le : q₂.2 ∩ p.1 ≤ G := + GM10.inter_le (henl.isLocation_right.isSeparation (henl.part_subset hp hq₂)).right_le + hsep_p.left_le + rw [GM10.le_iff_of_le (henl.isLocation_right.isSeparation (henl.part_subset hp hq₁)).left_le + hq₂_p1_le] + exact ⟨Set.subset_inter hq₁_le_q₂.vertexSet_subset hq₁_le_p1.vertexSet_subset, + Set.subset_inter hq₁_le_q₂.edgeSet_subset hq₁_le_p1.edgeSet_subset⟩ + refine ⟨hloc, hinter_eq, ?_⟩ + unfold locationOrder + by_cases hne : (((fun p ↦ separationOrder p.1 p.2) '' ((fun q ↦ (q.1, q.2 ∩ p.1)) '' part + p))).Nonempty + · refine csSup_le hne ?_ + rintro _ ⟨_, ⟨q, hq, rfl⟩, rfl⟩ + have hord_eq : separationOrder q.1 (q.2 ∩ p.1) = separationOrder q.1 q.2 := + congrArg (fun H : Hypergraph α β ↦ H.vertexSet.ncard) (hinter_eq hq) + dsimp only + rw [hord_eq] + exact separationOrder_le_locationOrder henl.isLocation_right (henl.part_subset hp hq) + · rw [Set.not_nonempty_iff_eq_empty.1 hne, csSup_empty] + exact Nat.zero_le _ + +private theorem isLocation_part_union_swap {G : Hypergraph α β} + {ℒ ℒ_star : Set (Hypergraph α β × Hypergraph α β)} + {part : Hypergraph α β × Hypergraph α β → Set (Hypergraph α β × Hypergraph α β)} + (henl : IsLocationEnlargementVia G ℒ ℒ_star part) + {p : Hypergraph α β × Hypergraph α β} (hp : p ∈ ℒ) : + GM10.IsLocation G (part p ∪ {(p.2, p.1)}) := by + have hsep_p := henl.isLocation_left.isSeparation hp + refine ⟨?_, ?_⟩ + · rintro q (hq | hq) + · exact henl.isLocation_right.isSeparation (henl.part_subset hp hq) + · rw [Set.mem_singleton_iff] at hq + subst hq + exact hsep_p.symm + · rintro q₁ (hq₁ | hq₁) q₂ (hq₂ | hq₂) hne + · exact henl.isLocation_right.left_le_right + (henl.part_subset hp hq₁) (henl.part_subset hp hq₂) hne + · rw [Set.mem_singleton_iff] at hq₂ + subst hq₂ + exact (henl.le_of_mem_part hp hq₁).1 + · rw [Set.mem_singleton_iff] at hq₁ + subst hq₁ + exact (henl.le_of_mem_part hp hq₂).2 + · rw [Set.mem_singleton_iff] at hq₁ hq₂ + exact (hne (hq₁.trans hq₂.symm)).elim + +private theorem locationCore_part_union_swap {G : Hypergraph α β} + {ℒ ℒ_star : Set (Hypergraph α β × Hypergraph α β)} + {part : Hypergraph α β × Hypergraph α β → Set (Hypergraph α β × Hypergraph α β)} + (henl : IsLocationEnlargementVia G ℒ ℒ_star part) + {p : Hypergraph α β × Hypergraph α β} (hp : p ∈ ℒ) : + GM10.locationCore G (part p ∪ {(p.2, p.1)}) = + GM10.locationCore p.1 ((fun q ↦ (q.1, q.2 ∩ p.1)) '' part p) := by + have hsep_p := henl.isLocation_left.isSeparation hp + have hloc₁ := isLocation_part_union_swap henl hp + have hloc₂ := (isLocation_inter_part henl hp).1 + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq (locationCore_le hloc₁) + ((locationCore_le hloc₂).trans hsep_p.left_le) ?_ ?_ + · ext v + simp only [GM10.locationCore, Set.mem_sep_iff, Set.mem_union, + Set.mem_singleton_iff, Set.mem_image] + constructor + · rintro ⟨_, hq⟩ + refine ⟨hq (p.2, p.1) (Or.inr rfl), ?_⟩ + rintro _ ⟨q, hq_mem, rfl⟩ + exact ⟨hq q (Or.inl hq_mem), hq (p.2, p.1) (Or.inr rfl)⟩ + · rintro ⟨hvp₁, hq⟩ + refine ⟨hsep_p.left_le.vertexSet_subset hvp₁, ?_⟩ + rintro q (hq_mem | rfl) + · exact (hq (q.1, q.2 ∩ p.1) ⟨q, hq_mem, rfl⟩).1 + · exact hvp₁ + · ext e + simp only [GM10.locationCore, Set.mem_sep_iff, Set.mem_union, + Set.mem_singleton_iff, Set.mem_image] + constructor + · rintro ⟨_, hq⟩ + refine ⟨hq (p.2, p.1) (Or.inr rfl), ?_⟩ + rintro _ ⟨q, hq_mem, rfl⟩ + exact ⟨hq q (Or.inl hq_mem), hq (p.2, p.1) (Or.inr rfl)⟩ + · rintro ⟨hep₁, hq⟩ + refine ⟨hsep_p.left_le.edgeSet_subset hep₁, ?_⟩ + rintro q (hq_mem | rfl) + · exact (hq (q.1, q.2 ∩ p.1) ⟨q, hq_mem, rfl⟩).1 + · exact hep₁ + +private theorem locationTreeWidth_part_union_swap_le {G : Hypergraph α β} + {ℒ ℒ_star : Set (Hypergraph α β × Hypergraph α β)} + {part : Hypergraph α β × Hypergraph α β → Set (Hypergraph α β × Hypergraph α β)} + (henl : IsLocationEnlargementVia G ℒ ℒ_star part) + {p : Hypergraph α β × Hypergraph α β} (hp : p ∈ ℒ) : + locationTreeWidth G (part p ∪ {(p.2, p.1)}) ≤ + locationTreeWidth p.1 ((fun q ↦ (q.1, q.2 ∩ p.1)) '' part p) + + (separationOrder p.1 p.2 : ℤ) := by + classical + let ℒ₁ := part p ∪ {(p.2, p.1)} + let ℒ₂ := (fun q ↦ (q.1, q.2 ∩ p.1)) '' part p + let H₁ := locationHeart G ℒ₁ + let H₂ := locationHeart p.1 ℒ₂ + have hloc₁ : GM10.IsLocation G ℒ₁ := isLocation_part_union_swap henl hp + have ⟨hloc₂, hinter_eq, _⟩ := isLocation_inter_part henl hp + have hcore_eq : GM10.locationCore G ℒ₁ = GM10.locationCore p.1 ℒ₂ := + locationCore_part_union_swap henl hp + have hVH : H₁.vertexSet = H₂.vertexSet := by + change (GM10.locationCore G ℒ₁).vertexSet = (GM10.locationCore p.1 ℒ₂).vertexSet + rw [hcore_eq] + have hsep_p := henl.isLocation_left.isSeparation hp + -- `V(p.1 ∩ p.2) ⊆ H₁.vertexSet` since `(p.2, p.1) ∈ ℒ₁`. + have hZ_sub : (p.1 ∩ p.2).vertexSet ⊆ H₁.vertexSet := by + change (p.1 ∩ p.2).vertexSet ⊆ (GM10.locationCore G ℒ₁).vertexSet + rw [GM10.inter_comm, ← (theorem_2_3_2 hloc₁ (Or.inr (Set.mem_singleton _))).2] + exact Set.inter_subset_right + -- Take a tree-decomposition `(T', τ')` of `H₂` attaining `treeWidthPlusOne H₂`. + have hex_D₂ : {w : ℕ | ∃ (γ : Type) (_ : Fintype γ) (T' : SimpleGraph γ) + (τ' : γ → Hypergraph α (β ⊕ (Hypergraph α β × Hypergraph α β))), + GM10.IsTreeDecomposition H₂ T' τ' ∧ GM10.treeDecompWidthPlusOne τ' = w}.Nonempty := by + refine ⟨GM10.treeDecompWidthPlusOne (fun _ : Unit ↦ H₂), Unit, inferInstance, ⊥, + fun _ ↦ H₂, ?_, rfl⟩ + refine ⟨⟨⟨fun _ _ ↦ Reachable.refl _⟩, fun u p hp ↦ ?_⟩, fun _ ↦ le_rfl, ?_, + fun u v hne ↦ (hne (Subsingleton.elim u v)).elim, fun _ _ _ _ ↦ GM10.inter_le le_rfl le_rfl⟩ + · cases p with + | nil => exact (Walk.not_isCycle_nil hp).elim + | cons h _ => exact h.elim + · refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq (biUnion_le fun _ _ ↦ le_rfl) le_rfl ?_ ?_ + · ext v; simp [biUnion] + · ext e; simp [biUnion] + obtain ⟨γ, hfin_γ, T', τ', hD', hw'⟩ := Nat.sInf_mem hex_D₂ + let _ : Fintype γ := hfin_γ + have hγ_ne : Nonempty γ := hD'.isTree.connected.nonempty + let t₀ : γ := Classical.arbitrary γ + let Z : Set α := (p.1 ∩ p.2).vertexSet + -- Define bags `τ₁ t` of `H₁` by adding `Z` to every bag and `Sum.inr (p.2, p.1)` to `τ₁ t₀` + -- (if `(p.2, p.1) ∉ part p`). + let edgeCond : γ → β ⊕ (Hypergraph α β × Hypergraph α β) → Prop := fun t e ↦ + match e with + | Sum.inl b => Sum.inl b ∈ (τ' t).edgeSet + | Sum.inr q => + if q ∈ part p then Sum.inr (q.1, q.2 ∩ p.1) ∈ (τ' t).edgeSet + else q = (p.2, p.1) ∧ t = t₀ + let τ₁ : γ → Hypergraph α (β ⊕ (Hypergraph α β × Hypergraph α β)) := fun t ↦ + { vertexSet := (τ' t).vertexSet ∪ Z + edgeSet := {e ∈ H₁.edgeSet | edgeCond t e} + Inc e v := e ∈ {e ∈ H₁.edgeSet | edgeCond t e} ∧ H₁.Inc e v + vertex_mem_of_inc e v h := by + rcases h with ⟨⟨he_H₁, he_cond⟩, hinc⟩ + cases e with + | inl b => + left + have hinc₂ : H₂.Inc (Sum.inl b) v := by + change (GM10.locationCore p.1 ℒ₂).Inc b v + rw [← hcore_eq] + exact hinc + exact (τ' t).vertex_mem_of_inc + ((GM10.inc_iff_of_le (hD'.le t) he_cond).2 hinc₂) + | inr q => + dsimp only [edgeCond] at he_cond + split_ifs at he_cond with hq_part + · left + have hq_mem₂ : (q.1, q.2 ∩ p.1) ∈ ℒ₂ := ⟨q, hq_part, rfl⟩ + have hsep₂ := hloc₂.isSeparation hq_mem₂ + have hsub₂ : ((q.1, q.2 ∩ p.1).1 ∩ (q.1, q.2 ∩ p.1).2).vertexSet ⊆ + (GM10.locationCore p.1 ℒ₂).vertexSet := by + rw [← (theorem_2_3_2 hloc₂ hq_mem₂).2] + exact Set.inter_subset_right + have hinc₂ : H₂.Inc (Sum.inr (q.1, q.2 ∩ p.1)) v := by + refine ⟨hq_mem₂, hsep₂, hsub₂, ?_⟩ + dsimp only + rw [hinter_eq hq_part] + exact hinc.2.2.2 + exact (τ' t).vertex_mem_of_inc + ((GM10.inc_iff_of_le (hD'.le t) he_cond).2 hinc₂) + · right + rcases he_cond with ⟨rfl, rfl⟩ + have hv : v ∈ (p.2 ∩ p.1).vertexSet := hinc.2.2.2 + rwa [GM10.inter_comm] at hv + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := (τ' t).vertexSet_finite.union (p.1 ∩ p.2).vertexSet_finite + edgeSet_finite := H₁.edgeSet_finite.subset fun _ h ↦ h.1 } + have hle_τ₁ : ∀ t : γ, τ₁ t ≤ H₁ := fun t ↦ + ⟨Set.union_subset ((hD'.le t).vertexSet_subset.trans hVH.symm.subset) hZ_sub, + fun _ h ↦ h.1, fun e he ↦ Set.ext fun v ↦ ⟨fun h ↦ ⟨he, h⟩, fun h ↦ h.2⟩⟩ + have hdisj_τ₁ : ∀ ⦃t t' : γ⦄, t ≠ t' → (τ₁ t ∩ τ₁ t').edgeSet = ∅ := by + intro t t' hne + ext e + simp only [GM10.inter_edgeSet, τ₁, Set.mem_inter_iff, Set.mem_sep_iff, + Set.mem_empty_iff_false, iff_false] + rintro ⟨⟨_, hc₁⟩, ⟨_, hc₂⟩⟩ + cases e with + | inl b => + have hmem : Sum.inl b ∈ (τ' t ∩ τ' t').edgeSet := ⟨hc₁, hc₂⟩ + rw [hD'.edgeSet_inter_eq hne] at hmem + exact hmem + | inr q => + dsimp only [edgeCond] at hc₁ hc₂ + split_ifs at hc₁ hc₂ with hq_part + · have hmem : Sum.inr (q.1, q.2 ∩ p.1) ∈ (τ' t ∩ τ' t').edgeSet := ⟨hc₁, hc₂⟩ + rw [hD'.edgeSet_inter_eq hne] at hmem + exact hmem + · exact hne (hc₁.2.trans hc₂.2.symm) + have hD₁ : GM10.IsTreeDecomposition H₁ T' τ₁ := by + refine ⟨hD'.isTree, hle_τ₁, ?_, hdisj_τ₁, fun t₁ t₂ t₃ hon ↦ ?_⟩ + · refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (biUnion_le fun t _ ↦ hle_τ₁ t) le_rfl ?_ ?_ + · ext v + simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, exists_true_left, τ₁, Set.mem_union] + constructor + · rintro ⟨t, hvt | hvZ⟩ + · exact hVH.symm ▸ (hD'.le t).vertexSet_subset hvt + · exact hZ_sub hvZ + · intro hv₁ + have hv₂ : v ∈ (Hypergraph.biUnion Finset.univ τ').vertexSet := by + rw [hD'.biUnion_eq, ← hVH] + exact hv₁ + simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, exists_true_left] at hv₂ + rcases hv₂ with ⟨t, hvt⟩ + exact ⟨t, Or.inl hvt⟩ + · ext e + simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, exists_true_left, τ₁, Set.mem_sep_iff] + constructor + · rintro ⟨_, he₁, _⟩ + exact he₁ + · intro he₁ + rcases he₁ with ⟨b, hb, rfl⟩ | ⟨q, ⟨hq_mem, hq_sep, hq_sub⟩, rfl⟩ + · have hb₂ : Sum.inl b ∈ (Hypergraph.biUnion Finset.univ τ').edgeSet := by + rw [hD'.biUnion_eq] + exact Or.inl ⟨b, hcore_eq ▸ hb, rfl⟩ + simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, exists_true_left] at hb₂ + rcases hb₂ with ⟨t, hbt⟩ + exact ⟨t, ⟨Or.inl ⟨b, hb, rfl⟩, hbt⟩⟩ + · by_cases hq_part : q ∈ part p + · have hq_mem₂ : (q.1, q.2 ∩ p.1) ∈ ℒ₂ := ⟨q, hq_part, rfl⟩ + have hsub₂ : ((q.1, q.2 ∩ p.1).1 ∩ (q.1, q.2 ∩ p.1).2).vertexSet ⊆ + (GM10.locationCore p.1 ℒ₂).vertexSet := by + rw [← (theorem_2_3_2 hloc₂ hq_mem₂).2] + exact Set.inter_subset_right + have hq₂ : Sum.inr (q.1, q.2 ∩ p.1) ∈ + (Hypergraph.biUnion Finset.univ τ').edgeSet := by + rw [hD'.biUnion_eq] + exact Or.inr ⟨(q.1, q.2 ∩ p.1), + ⟨hq_mem₂, hloc₂.isSeparation hq_mem₂, hsub₂⟩, rfl⟩ + simp only [biUnion, Set.mem_iUnion, Finset.mem_univ, exists_true_left] at hq₂ + rcases hq₂ with ⟨t, hqt⟩ + refine ⟨t, ⟨Or.inr ⟨q, ⟨hq_mem, hq_sep, hq_sub⟩, rfl⟩, ?_⟩⟩ + dsimp only [edgeCond] + split_ifs + exact hqt + · have hq_eq : q = (p.2, p.1) := by + rcases hq_mem with h1 | h2 + · exact (hq_part h1).elim + · exact Set.mem_singleton_iff.1 h2 + refine ⟨t₀, ⟨Or.inr ⟨q, ⟨hq_mem, hq_sep, hq_sub⟩, rfl⟩, ?_⟩⟩ + dsimp only [edgeCond] + split_ifs + exact ⟨hq_eq, rfl⟩ + · rw [GM10.le_iff_of_le (GM10.inter_le (hle_τ₁ t₁) (hle_τ₁ t₃)) (hle_τ₁ t₂)] + refine ⟨?_, ?_⟩ + · intro v ⟨hv₁, hv₃⟩ + rcases hv₁ with hv₁ | hvZ + · rcases hv₃ with hv₃ | hvZ + · exact Or.inl ((hD'.inter_le hon).vertexSet_subset ⟨hv₁, hv₃⟩) + · exact Or.inr hvZ + · exact Or.inr hvZ + · by_cases hne : t₁ = t₃ + · subst hne + have ht₂_eq : t₂ = t₁ := (Thomas.onTreePath_self T' t₁ t₂).1 hon + subst ht₂_eq + rw [GM10.inter_self] + · rw [hdisj_τ₁ hne] + exact Set.empty_subset _ + have htw₁_le : GM10.treeWidthPlusOne H₁ ≤ GM10.treeDecompWidthPlusOne τ₁ := + GM10.treeWidthPlusOne_le_of_isTreeDecomposition hD₁ + have hwidth_le : GM10.treeDecompWidthPlusOne τ₁ ≤ + GM10.treeDecompWidthPlusOne τ' + separationOrder p.1 p.2 := by + unfold GM10.treeDecompWidthPlusOne + refine csSup_le (Set.range_nonempty _) ?_ + rintro _ ⟨t, rfl⟩ + have hcard_union : ((τ' t).vertexSet ∪ Z).ncard ≤ + (τ' t).vertexSet.ncard + Z.ncard := + Set.ncard_union_le (τ' t).vertexSet Z + have h_le_t : (τ' t).vertexSet.ncard ≤ + sSup (Set.range fun u : γ ↦ (τ' u).vertexSet.ncard) := + le_csSup (Set.finite_range _).bddAbove ⟨t, rfl⟩ + exact hcard_union.trans (Nat.add_le_add_right h_le_t _) + have hplus_le : GM10.treeWidthPlusOne H₁ ≤ + GM10.treeWidthPlusOne H₂ + separationOrder p.1 p.2 := by + have hw'_eq : GM10.treeDecompWidthPlusOne τ' = GM10.treeWidthPlusOne H₂ := hw' + rw [← hw'_eq] + exact htw₁_le.trans hwidth_le + unfold locationTreeWidth GM10.treeWidth + change (GM10.treeWidthPlusOne H₁ : ℤ) - 1 ≤ + (GM10.treeWidthPlusOne H₂ : ℤ) - 1 + (separationOrder p.1 p.2 : ℤ) + omega + +/-- **Graph Minors XVIII, (4.3)** (page 87): +"4.3. *Let $\lambda$ be a tie-breaker in a hypergraph $G$, let $\theta \ge 2$, and let +$\mathcal{T}_1, \dots, \mathcal{T}_n$ be distinct tangles in $G$, each of order $\theta$, where +$n \ge 1$. For $1 \le i \le n$ let $\mathcal{L}_i \subseteq \mathcal{T}_i$ be a location of order +$\le \frac{3}{4}\theta$ which $\theta$-isolates $\mathcal{T}_i$; and suppose that for every tangle +$\mathcal{T}$ in $G$ of order $\theta$, there is a unique $i$ with $1 \le i \le n$ such that +$\mathcal{L}_i \subseteq \mathcal{T}$. Let $(T, \tau)$ be a standard tree-decomposition of $G$ +relative to $\mathcal{T}_1, \dots, \mathcal{T}_n$, where $V(T) = \{t_1, \dots, t_n\}$ and $t_i$ +represents $\mathcal{T}_i$ for $1 \le i \le n$. Then for $1 \le i \le n$, the location of $t_i$ in +$(T, \tau)$ is an enlargement of $\mathcal{L}_i$ by tree-width $\le \frac{9}{4}\theta$.*" -/ +theorem theorem_4_3_proof {Λ : Type w} [LinearOrder Λ] {n : ℕ} + {G : Hypergraph α β} {lam : Hypergraph α β × Hypergraph α β → Λ} + {θ : ℕ} (hθ : 2 ≤ θ) + {𝒯 L : Fin n → Set (Hypergraph α β × Hypergraph α β)} + {T : SimpleGraph (Fin n)} {τ : Fin n → Hypergraph α β} + (hlam : GM10.IsTieBreaker G lam) + (h𝒯 : ∀ i : Fin n, GM10.IsTangle G θ (𝒯 i)) + (hiso : ∀ i : Fin n, Isolates G lam θ (𝒯 i) (L i)) + (hord_L : ∀ i : Fin n, 4 * locationOrder (L i) ≤ 3 * θ) + (huniq : ∀ 𝒯' : Set (Hypergraph α β × Hypergraph α β), + GM10.IsTangle G θ 𝒯' → ∃! i : Fin n, L i ⊆ 𝒯') + (hstd : IsStandardDecomposition G lam 𝒯 T τ) + (i : Fin n) : + IsLocationEnlargementByTreeWidth G (L i) (vertexLocation T τ i) ((9 / 4 : ℚ) * θ) := by + classical + have hD := hstd.isTreeDecomposition + have hloc_star : GM10.IsLocation G (vertexLocation T τ i) := theorem_2_4_proof hD i + -- Use Claim (1) to assign each `q ∈ vertexLocation T τ i` to a unique `p ∈ L i`. + have hex_p : ∀ q, ∃ p, q ∈ vertexLocation T τ i → p ∈ L i ∧ q.1 ≤ p.1 ∧ p.2 ≤ q.2 := by + intro q + by_cases hq : q ∈ vertexLocation T τ i + · obtain ⟨p, hp, h1, h2⟩ := (lemma_4_3_claim_1 hlam h𝒯 hiso hord_L huniq hstd i hq).2 + exact ⟨p, fun _ ↦ ⟨hp, h1, h2⟩⟩ + · exact ⟨(G, G), fun h ↦ (hq h).elim⟩ + let pick : Hypergraph α β × Hypergraph α β → Hypergraph α β × Hypergraph α β := + fun q ↦ (hex_p q).choose + let part : Hypergraph α β × Hypergraph α β → Set (Hypergraph α β × Hypergraph α β) := + fun p ↦ {q ∈ vertexLocation T τ i | pick q = p} + have henl : IsLocationEnlargementVia G (L i) (vertexLocation T τ i) part := by + refine ⟨(hiso i).isLocation, hloc_star, fun p _ q hq ↦ hq.1, + fun p₁ _ p₂ _ hne ↦ Set.disjoint_left.2 fun q hq₁ hq₂ ↦ hne (hq₁.2.symm.trans hq₂.2), + ?_, fun p _ q ⟨hq_loc, hq_pick⟩ ↦ ?_⟩ + · ext q + simp only [Set.mem_iUnion, part, Set.mem_sep_iff] + exact ⟨fun ⟨_, _, hq, _⟩ ↦ hq, fun hq ↦ ⟨pick q, ((hex_p q).choose_spec hq).1, hq, rfl⟩⟩ + · subst hq_pick + exact ((hex_p q).choose_spec hq_loc).2 + have hnonneg : (0 : ℚ) ≤ (9 / 4 : ℚ) * θ := by + rw [div_mul_eq_mul_div, le_div_iff₀ (by decide : (0 : ℚ) < 4), zero_mul] + exact_mod_cast Nat.zero_le (9 * θ) + refine ⟨hnonneg, part, henl, fun p hp ↦ ?_⟩ + let ℒ' := (fun q ↦ (q.1, q.2 ∩ p.1)) '' part p + have ⟨hloc', hinter_eq, hord'_le⟩ := isLocation_inter_part henl hp + have hord_star_lt : locationOrder (vertexLocation T τ i) < θ := by + rw [locationOrder_lt_iff hloc_star (by omega)] + intro q hq + have h4 := (lemma_4_3_claim_1 hlam h𝒯 hiso hord_L huniq hstd i hq).1 + omega + have hord'_lt : locationOrder ℒ' < θ := hord'_le.trans_lt hord_star_lt + have htitanic' : ∀ ⦃r⦄, r ∈ ℒ' → GM10.IsTitanic p.1 r.1 r.2 := by + rintro _ ⟨q, hq_part, rfl⟩ + have hq_tit : GM10.IsTitanic G q.1 q.2 := + lemma_4_3_claim_2 hlam h𝒯 hiso hord_L huniq hstd i (henl.part_subset hp hq_part) + have hsep' : p.1.IsSeparation q.1 (q.2 ∩ p.1) := + hloc'.isSeparation (p := (q.1, q.2 ∩ p.1)) ⟨q, hq_part, rfl⟩ + exact (theorem_3_1_proof hq_tit.1 hsep' (hinter_eq hq_part).symm).1 hq_tit + have h34 := theorem_3_4_proof hloc' htitanic' hθ hord'_lt + rcases h34 with ⟨𝒯', h𝒯', hsub'⟩ | htw'_bound + · exact (lemma_4_3_claim_4 h𝒯 hiso huniq hstd i henl hp h𝒯' hsub').elim + · have htw_le := locationTreeWidth_part_union_swap_le henl hp + have hp_ord_le : 4 * separationOrder p.1 p.2 ≤ 3 * θ := by + have h1 := separationOrder_le_locationOrder (hiso i).isLocation hp + have h2 := hord_L i + omega + have htw_int : locationTreeWidth G (part p ∪ {(p.2, p.1)}) * 4 ≤ 9 * (θ : ℤ) := by + omega + have htw_rat : (locationTreeWidth G (part p ∪ {(p.2, p.1)}) : ℚ) * 4 ≤ 9 * (θ : ℚ) := by + exact_mod_cast htw_int + rw [div_mul_eq_mul_div, le_div_iff₀ (by decide : (0 : ℚ) < 4)] + exact htw_rat + +/-! ## (4.4): Main Structure Theorem of Section 4 -/ + +private theorem tangles_finite (G : Hypergraph α β) (θ : ℕ) : + {𝒯 : Set (Hypergraph α β × Hypergraph α β) | GM10.IsTangle G θ 𝒯}.Finite := by + refine ((separations_finite G).powerset).subset fun 𝒯 h𝒯 p hp ↦ h𝒯.isSeparation hp + +private theorem isTangle_truncate {G : Hypergraph α β} {θ θ' : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : GM10.IsTangle G θ 𝒯) (hθ' : 1 ≤ θ') (hle : θ' ≤ θ) : + GM10.IsTangle G θ' {p ∈ 𝒯 | separationOrder p.1 p.2 < θ'} where + one_le := hθ' + isSeparation _ _ h := h𝒯.isSeparation h.1 + order_lt _ _ h := h.2 + axiom1 A B hsep hord := by + rcases h𝒯.axiom1 hsep (hord.trans_le hle) with h1 | h2 + · exact Or.inl ⟨h1, hord⟩ + · exact Or.inr ⟨h2, by rwa [GM10.separationOrder_comm]⟩ + axiom2 _ _ _ _ _ _ h1 h2 h3 := h𝒯.axiom2 h1.1 h2.1 h3.1 + axiom3 _ _ h := h𝒯.axiom3 h.1 + +private theorem isolates_mono {Λ : Type*} [LE Λ] {G : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} {θ θ' : ℕ} + {𝒯 ℒ : Set (Hypergraph α β × Hypergraph α β)} + (hiso : Isolates G lam θ 𝒯 ℒ) (hle : θ ≤ θ') : + Isolates G lam θ' 𝒯 ℒ where + isLocation := hiso.isLocation + subset := hiso.subset + locationOrder_lt := hiso.locationOrder_lt.trans_le hle + order_lt _ _ h := (hiso.order_lt h).trans_le hle + distinction_le _ _ hCD _ _ h𝒯' hle' hDC _ _ hdist := + hiso.distinction_le hCD h𝒯' (hle.trans hle') hDC hdist + +/-- **Graph Minors XVIII, (4.4)** (page 88): +"4.4. *Let $\lambda$ be a tie-breaker in a hypergraph $G$, and let $\theta \ge 1$ be an integer. +For each tangle $\mathcal{T}$ in $G$ of order $\ge \theta$ let +$\mathcal{L}(\mathcal{T}) \subseteq \mathcal{T}$ be a location which $\theta$-isolates +$\mathcal{T}$, and let $G$ have a tangle of order $\ge \frac{4}{3}\theta$. Then there is a +tree-decomposition $(T, \tau)$ of $G$ with the following properties:* +- *(T, \tau) is proper and rotund,* +- *for each $e \in E(T)$, the separations made by $e$ under $(T, \tau)$ are robust,* +- *for each $t \in V(T)$, let $\mathcal{L}$ be the location of $t$ in $(T, \tau)$; then there is a + tangle $\mathcal{T}$ in $G$ of order $\ge \frac{4}{3}\theta$ with + $\mathcal{L} \subseteq \mathcal{T}$, such that $\mathcal{L}$ is an enlargement of + $\mathcal{L}(\mathcal{T})$ by tree-width $\le 3\theta + 1$.*" -/ +theorem theorem_4_4_proof {Λ : Type w} [LinearOrder Λ] + (G : Hypergraph α β) (lam : Hypergraph α β × Hypergraph α β → Λ) + (hlam : GM10.IsTieBreaker G lam) + (θ : ℕ) (hθ : 1 ≤ θ) + (L : Set (Hypergraph α β × Hypergraph α β) → Set (Hypergraph α β × Hypergraph α β)) + (hiso : ∀ ⦃θ' : ℕ⦄ ⦃𝒯 : Set (Hypergraph α β × Hypergraph α β)⦄, + θ ≤ θ' → GM10.IsTangle G θ' 𝒯 → Isolates G lam θ 𝒯 (L 𝒯)) + (hex_tangle : ∃ (θ₀ : ℕ) (𝒯₀ : Set (Hypergraph α β × Hypergraph α β)), + 4 * θ ≤ 3 * θ₀ ∧ GM10.IsTangle G θ₀ 𝒯₀) : + ∃ (n : ℕ) (T : SimpleGraph (Fin n)) (τ : Fin n → Hypergraph α β), + 1 ≤ n ∧ + GM10.IsTreeDecomposition G T τ ∧ + IsProper G T τ ∧ + IsRotund G T τ ∧ + (∀ ⦃e : Sym2 (Fin n)⦄, e ∈ T.edgeSet → ∀ ⦃A B : Hypergraph α β⦄, + GM10.MakesSeparation T τ e A B → GM10.IsRobust G A B) ∧ + (∀ i : Fin n, ∃ (θ' : ℕ) (𝒯 : Set (Hypergraph α β × Hypergraph α β)), + 4 * θ ≤ 3 * θ' ∧ + GM10.IsTangle G θ' 𝒯 ∧ + vertexLocation T τ i ⊆ 𝒯 ∧ + IsLocationEnlargementByTreeWidth G (L 𝒯) (vertexLocation T τ i) (3 * θ + 1)) := by + classical + -- Let `θ'` be the least integer with `3 * θ' ≥ 4 * θ`, namely `(4 * θ + 2) / 3`. + let θ' : ℕ := (4 * θ + 2) / 3 + have hθ'_ge : 4 * θ ≤ 3 * θ' := by omega + have hθ'_le : 3 * θ' ≤ 4 * θ + 2 := by omega + have hθ'_two : 2 ≤ θ' := by omega + have hθ_le_θ' : θ ≤ θ' := by omega + -- Construct a tangle of order `θ'` in `G` by truncating `𝒯₀`. + obtain ⟨θ₀, 𝒯₀, hθ₀_ge, h𝒯₀⟩ := hex_tangle + have hθ'_le_θ₀ : θ' ≤ θ₀ := by omega + let 𝒯₁ := {p ∈ 𝒯₀ | separationOrder p.1 p.2 < θ'} + have h𝒯₁ : GM10.IsTangle G θ' 𝒯₁ := isTangle_truncate h𝒯₀ (by omega) hθ'_le_θ₀ + -- Enumerate all tangles of order `θ'` in `G`. + let S := {𝒯 : Set (Hypergraph α β × Hypergraph α β) | GM10.IsTangle G θ' 𝒯} + have hS_fin : S.Finite := tangles_finite G θ' + let S_fin := hS_fin.toFinset + let m := Fintype.card S_fin + have hm_pos : 1 ≤ m := Fintype.card_pos_iff.2 ⟨⟨𝒯₁, hS_fin.mem_toFinset.2 h𝒯₁⟩⟩ + let eS : Fin m ≃ S_fin := (Fintype.equivFin S_fin).symm + let 𝒯_all : Fin m → Set (Hypergraph α β × Hypergraph α β) := fun j ↦ (eS j).1 + have h𝒯_all : ∀ j : Fin m, GM10.IsTangle G θ' (𝒯_all j) := + fun j ↦ (hS_fin.mem_toFinset.1 (eS j).2) + have hinj_all : Function.Injective 𝒯_all := + fun j₁ j₂ heq ↦ eS.injective (Subtype.ext heq) + have hiso_all : ∀ j : Fin m, Isolates G lam θ' (𝒯_all j) (L (𝒯_all j)) := + fun j ↦ isolates_mono (hiso hθ_le_θ' (h𝒯_all j)) hθ_le_θ' + -- Apply (4.2) to obtain `I ⊆ Fin m`. + obtain ⟨I, hI_uniq⟩ := theorem_4_2_proof hlam h𝒯_all hinj_all hiso_all + let I_fin := I.toFinset + let n := Fintype.card I_fin + have hn_pos : 1 ≤ n := by + obtain ⟨j₀, _⟩ := eS.surjective ⟨𝒯₁, hS_fin.mem_toFinset.2 h𝒯₁⟩ + obtain ⟨i₀, ⟨hi₀_I, _⟩, _⟩ := hI_uniq j₀ + exact Fintype.card_pos_iff.2 ⟨⟨i₀, Set.mem_toFinset.2 hi₀_I⟩⟩ + let eI : Fin n ≃ I_fin := (Fintype.equivFin I_fin).symm + let 𝒯_sub : Fin n → Set (Hypergraph α β × Hypergraph α β) := fun i ↦ 𝒯_all (eI i).1 + have h𝒯_sub : ∀ i : Fin n, GM10.IsTangle G θ' (𝒯_sub i) := fun i ↦ h𝒯_all (eI i).1 + have hinj_sub : Function.Injective 𝒯_sub := + fun i₁ i₂ heq ↦ eI.injective (Subtype.ext (hinj_all heq)) + have hiso_sub : ∀ i : Fin n, Isolates G lam θ' (𝒯_sub i) (L (𝒯_sub i)) := + fun i ↦ hiso_all (eI i).1 + have hord_L_sub : ∀ i : Fin n, 4 * locationOrder (L (𝒯_sub i)) ≤ 3 * θ' := by + intro i + have hlt : locationOrder (L (𝒯_sub i)) < θ := + (hiso hθ_le_θ' (h𝒯_sub i)).locationOrder_lt + omega + have huniq_sub : ∀ 𝒯' : Set (Hypergraph α β × Hypergraph α β), + GM10.IsTangle G θ' 𝒯' → ∃! i : Fin n, L (𝒯_sub i) ⊆ 𝒯' := by + intro 𝒯' h𝒯' + obtain ⟨j, hj⟩ := eS.surjective ⟨𝒯', hS_fin.mem_toFinset.2 h𝒯'⟩ + have hj_eq : 𝒯_all j = 𝒯' := congrArg Subtype.val hj + rw [← hj_eq] + obtain ⟨i_m, ⟨hi_I, hi_sub⟩, hi_uniq⟩ := hI_uniq j + obtain ⟨i, hi_eq⟩ := eI.surjective ⟨i_m, Set.mem_toFinset.2 hi_I⟩ + have hi_val : (eI i).1 = i_m := congrArg Subtype.val hi_eq + refine ⟨i, ?_, fun i' hi'_sub ↦ ?_⟩ + · dsimp only [𝒯_sub] + rwa [hi_val] + · have hi'_I : (eI i').1 ∈ I := Set.mem_toFinset.1 (eI i').2 + have heq_m : (eI i').1 = i_m := hi_uniq (eI i').1 ⟨hi'_I, hi'_sub⟩ + exact eI.injective (Subtype.ext (heq_m.trans hi_val.symm)) + -- Apply (2.6) and (2.7) to get a standard decomposition `(T, τ)` relative to `𝒯_sub`. + obtain ⟨T, τ, hstd⟩ := theorem_2_6_proof G lam θ' 𝒯_sub hn_pos hlam h𝒯_sub hinj_sub + have ⟨hproper, hrotund, hrobust⟩ := theorem_2_7_proof hlam h𝒯_sub hstd + refine ⟨n, T, τ, hn_pos, hstd.isTreeDecomposition, hproper, hrotund, hrobust, fun i ↦ ?_⟩ + have henl_i := theorem_4_3_proof hθ'_two hlam h𝒯_sub hiso_sub hord_L_sub huniq_sub hstd i + rcases henl_i with ⟨_, part, henl, htw_part⟩ + refine ⟨θ', 𝒯_sub i, hθ'_ge, h𝒯_sub i, ?_, ?_⟩ + · rintro _ ⟨j, hadj, rfl⟩ + rw [Sym2.eq_swap] + exact (isDistinction_treeDecompSide_of_adj h𝒯_sub hstd hadj).1.1 + · have hnonneg : (0 : ℚ) ≤ 3 * (θ : ℚ) + 1 := by + exact_mod_cast Nat.zero_le (3 * θ + 1) + refine ⟨hnonneg, part, henl, fun p hp ↦ ?_⟩ + have h_rat := htw_part hp + -- Convert `(locationTreeWidth ... : ℚ) ≤ (9 / 4 : ℚ) * θ'` to integer arithmetic. + have h_mul : (locationTreeWidth G (part p ∪ {(p.2, p.1)}) : ℚ) * 4 ≤ + 9 * (θ' : ℚ) := by + rwa [div_mul_eq_mul_div, le_div_iff₀ (by decide : (0 : ℚ) < 4)] at h_rat + have h_int : locationTreeWidth G (part p ∪ {(p.2, p.1)}) * 4 ≤ 9 * (θ' : ℤ) := by + exact_mod_cast h_mul + have h_le : locationTreeWidth G (part p ∪ {(p.2, p.1)}) ≤ 3 * (θ : ℤ) + 1 := by omega + exact_mod_cast h_le + +end GraphMinor.GM18 diff --git a/LeanPool/GraphMinor/GM18/Section5.lean b/LeanPool/GraphMinor/GM18/Section5.lean new file mode 100644 index 0000000000..5a5bbe856d --- /dev/null +++ b/LeanPool/GraphMinor/GM18/Section5.lean @@ -0,0 +1,1423 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM18.Section5Part1 +public import LeanPool.GraphMinor.GM18.Section5Part2 +import LeanPool.GraphMinor.GM04.Patchwork.Expansion +import LeanPool.GraphMinor.GM04.Patchwork.Stars + +/-! +# Graph Minors XVIII, Section 5 (continued): Theorems (5.6) and (5.7) + +This file completes the formalization of Section 5 ("Patchworks and places", pages 91–100) of +Robertson and Seymour, *Graph Minors. XVIII. Tree-decompositions and well-quasi-ordering*, +J. Combin. Theory Ser. B 89 (2003), 77–108: + +- `theorem_5_6` (5.6, page 98): gluing realizable expansions of partial `Ω`-patchworks across + separations `(A₁, B₁)` and `(A₂, B₂)`. +- `theorem_5_7_proof` (5.7, pages 99–100): simulation between partial `Ω`-patchworks `P₁, P₂` from a + realizable expansion between the hearts `Q₁, Q₂` of places `(P₁, ℒ₁), (P₂, ℒ₂)` that maps new + edges to new edges and simulates the corresponding restrictions `P₁ | A₁` in `P₂ | A₂`. +-/ + +public section + +namespace GraphMinor.GM18 + +open SimpleGraph Hypergraph + +universe u v w + +variable {α β Ω : Type*} + +/-! ## Theorem (5.6): Gluing realizable expansions of partial patchworks -/ + +/-- **Graph Minors XVIII, (5.6)** (page 98): +"**5.6.** *Let $P_1, P_2$ be partial $\Omega$-patchworks, and let $(A_1, B_1)$, $(A_2, B_2)$ be +separations of $\|P_1\|, \|P_2\|$ respectively. Let $\eta'$ be a realizable expansion of $P_1|A_1$ +in $P_2|A_2$ (whence $|\bar{\pi}(A_1)| = |\bar{\pi}(A_2)| = k$, say) and let $\eta''$ be a +realizable expansion of $P_1|B_1$ in $P_2|B_2$ such that for $1 \le i \le k$, $\eta''(v)$ contains +the $i$th term of $\pi(A_2)$, where $v$ is the $i$th term of $\pi(A_1)$. Define $\eta$ by:* +$$ +\eta(v) = \begin{cases} +\eta'(v), & v \in V(A_1) \setminus V(B_1), \\ +\eta''(v), & v \in V(B_1) \setminus V(A_1), \\ +\eta'(v) \cup \eta''(v), & v \in V(A_1 \cap B_1), +\end{cases} +$$ +$$ +\eta(e) = \begin{cases} +\eta'(e), & e \in E(A_1), \\ +\eta''(e), & e \in E(B_1). +\end{cases} +$$ +*Then $\eta$ is a realizable expansion of $P_1$ in $P_2$.*" + +In our representation `PartialPatchwork Ω α β = GM04.Patchwork (WithBot Ω) α β`, the adjoined +minimum element `* = ⊥` of the paper's proof is already built into `WithBot Ω`, so (5.6) follows +directly from `GM04.theorem_8_1_proof`. -/ +theorem theorem_5_6_proof [Preorder Ω] {α₁ β₁ α₂ β₂ : Type*} + {P₁ : PartialPatchwork Ω α₁ β₁} {P₂ : PartialPatchwork Ω α₂ β₂} + {A₁ B₁ : RootedHypergraph α₁ β₁} {A₂ B₂ : RootedHypergraph α₂ β₂} + (hsep₁ : P₁.G.IsSeparation A₁ B₁) (hsep₂ : P₂.G.IsSeparation A₂ B₂) + {η'v η''v : α₁ → Set α₂} {η'e η''e : β₁ → β₂} + (hη' : GM04.IsRealizableExpansion (P₁.restrict A₁) (P₂.restrict A₂) η'v η'e) + (hη'' : GM04.IsRealizableExpansion (P₁.restrict B₁) (P₂.restrict B₂) η''v η''e) + (hroots_mem : ∀ (i : ℕ) (hi₁ : i < A₁.roots.length) (hi₂ : i < A₂.roots.length), + A₂.roots[i] ∈ η''v A₁.roots[i]) : + GM04.IsRealizableExpansion P₁ P₂ + (GM04.glueVertex A₁ B₁ η'v η''v) (GM04.glueEdge A₁ η'e η''e) := + GM04.theorem_8_1_proof hsep₁ hsep₂ hη' hη'' hroots_mem + +/-! ## Helper lemmas for the proof of (5.7) -/ + +private theorem getElem_congr_list {l₁ l₂ : List α} (h : l₁ = l₂) (i : ℕ) (hi₁ : i < l₁.length) : + l₁[i] = l₂[i]'(h ▸ hi₁) := by + subst h; rfl + +private theorem realizationOf_congr {G₁ G₂ : Hypergraph α β} + (hV : G₁.vertexSet = G₂.vertexSet) (hE : G₁.edgeSet = G₂.edgeSet) + (δ : β → (⊤ : SimpleGraph α).Subgraph) : + GM04.realizationOf G₁ δ = GM04.realizationOf G₂ δ := by + ext u v + · simp [GM04.realizationOf, hV, hE] + · simp [GM04.realizationOf, hE] + +/-- A bijection `π : β₁ → β₂` between the edge sets of two patchworks `P₁, P₂` on the same vertex +type `α` that preserves vertices, roots, incidences, `dom`, `μ`, `Δ`, and satisfies +`P₁.φ e ≤ P₂.φ (π e)` induces a realizable expansion `(fun v ↦ {v}, π)` of `P₁` in `P₂`. -/ +theorem isRealizableExpansion_of_edge_bij [Preorder Ω] {β₁ β₂ : Type*} + (P₁ : GM04.Patchwork Ω α β₁) (P₂ : GM04.Patchwork Ω α β₂) + (π : β₁ → β₂) + (hV : P₁.G.vertexSet = P₂.G.vertexSet) + (hroots : P₁.G.roots = P₂.G.roots) + (hE : π '' P₁.G.edgeSet = P₂.G.edgeSet) + (hinj : Set.InjOn π P₁.G.edgeSet) + (hends : ∀ e ∈ P₁.G.edgeSet, P₁.G.ends e = P₂.G.ends (π e)) + (hdom : ∀ e ∈ P₁.G.edgeSet, e ∈ P₁.dom ↔ π e ∈ P₂.dom) + (hμ : ∀ e ∈ P₁.dom, P₁.μ e = P₂.μ (π e)) + (hΔ : ∀ e ∈ P₁.dom, P₁.Δ e = P₂.Δ (π e)) + (hφ : ∀ e ∈ P₁.G.edgeSet, P₁.φ e ≤ P₂.φ (π e)) : + GM04.IsRealizableExpansion P₁ P₂ (fun v ↦ {v}) π := by + have hexp : GM04.IsExpansion P₁ P₂ (fun v ↦ {v}) π := + { vertex_nonempty := fun v _ ↦ Set.singleton_nonempty v + vertex_subset := fun _ hv _ h ↦ h.symm ▸ (hV ▸ hv) + edge_mem := fun e he ↦ hE ▸ ⟨e, he, rfl⟩ + vertex_disjoint := fun _ _ _ _ hne ↦ Set.disjoint_singleton.2 hne + edge_injOn := hinj + mem_dom_iff := hdom + ends_nonempty := fun e he _ v hinc ↦ + ⟨v, rfl, (hends e he ▸ hinc : v ∈ P₂.G.ends (π e))⟩ + μ_length := fun e hd ↦ congrArg List.length (hμ e hd) + μ_mem := fun e hd i hi _ ↦ by + rw [← getElem_congr_list (hμ e hd) i hi] + rfl + roots_length := congrArg List.length hroots + roots_mem := fun i hi _ ↦ by + rw [← getElem_congr_list hroots i hi] + rfl + maps_Δ := fun e hd δ hδ ↦ by + have he : e ∈ P₁.G.edgeSet := P₁.dom_subset hd + have hverts : δ.verts ⊆ {x | x ∈ P₁.μ e} := by + rw [((P₁.Δ e).verts_eq δ hδ).trans (P₁.Δ_verts e he), P₁.μ_set e hd] + change GM04.marchMapSubgraph (P₁.μ e) (P₂.μ (π e)) δ ∈ (P₂.Δ (π e)).groupings + rw [← hμ e hd, ← hΔ e hd, GM04.marchMapSubgraph_id hverts] + exact hδ + φ_le := hφ } + obtain ⟨H, ⟨δ, hδ, hH⟩, hcomp⟩ := (GM04.IsRealizableExpansion.id P₂).2 + have himg : π '' P₁.G.edgeSet = id '' P₂.G.edgeSet := hE.trans (Set.image_id P₂.G.edgeSet).symm + refine ⟨hexp, H, ⟨⟨δ, ?_, ?_⟩, fun v hv ↦ hcomp v (hV ▸ hv)⟩⟩ + · rw [himg]; exact hδ + · rw [himg]; exact hH + +/-- A subset of a rooted location in `G` is again a rooted location in `G`. -/ +theorem IsRootedLocation.mono {G : RootedHypergraph α β} + {ℒ ℒ' : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) (hsub : ℒ' ⊆ ℒ) : + IsRootedLocation G ℒ' where + isComplemented _ hA := hℒ.isComplemented (hsub hA) + le_complement _ h₁ _ h₂ hne := hℒ.le_complement (hsub h₁) (hsub h₂) hne + +/-- The core of an empty rooted location in `G` is `G.toHypergraph`. -/ +theorem rootedLocationCore_empty (G : RootedHypergraph α β) : + rootedLocationCore G ∅ = G.toHypergraph := by + have hℒ : IsRootedLocation G ∅ := + ⟨fun _ h ↦ h.elim, fun _ h ↦ h.elim⟩ + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq (locationCore_le hℒ.isLocation) le_rfl ?_ ?_ + · ext v + rw [mem_rootedLocationCore_vertexSet_iff hℒ] + exact ⟨fun h ↦ h.1, fun hv ↦ ⟨hv, fun _ h ↦ h.elim⟩⟩ + · ext e + rw [mem_rootedLocationCore_edgeSet_iff] + exact ⟨fun h ↦ h.1, fun he ↦ ⟨he, fun _ h ↦ h.elim⟩⟩ + +/-- A heart of `(P, ∅)` is equivalent to `P`. -/ +theorem IsPlaceHeart.equiv_of_empty {P Q : PartialPatchwork Ω α β} + {newEdge : RootedHypergraph α β → β} + (hQ : IsPlaceHeart P ∅ newEdge Q) : + PatchworkEquiv Q P where + G_eq := by + refine RootedHypergraph.ext ?_ hQ.roots_eq + have hcore := rootedLocationCore_empty P.G + refine hypergraph_ext_of_ends_eq ?_ ?_ ?_ + · rw [hQ.vertexSet_eq, hcore] + · rw [hQ.edgeSet_eq, hcore, Set.image_empty, Set.union_empty] + · intro e he + rw [hQ.edgeSet_eq, Set.image_empty, Set.union_empty] at he + exact hQ.ends_core he + dom_eq := by + rw [hQ.dom_eq, rootedLocationCore_empty, Set.image_empty, Set.union_empty] + exact Set.inter_eq_self_of_subset_right P.dom_subset + μ_eq e he := by + rw [hQ.dom_eq, Set.image_empty, Set.union_empty] at he + exact hQ.μ_core he + Δ_eq e he := by + rw [hQ.edgeSet_eq, Set.image_empty, Set.union_empty] at he + exact hQ.Δ_core he + φ_eq e he := by + rw [hQ.edgeSet_eq, Set.image_empty, Set.union_empty] at he + exact hQ.φ_core he + +/-- Given a rooted location `ℒ` in `P.G`, a member `A₀ ∈ ℒ`, and a heart `Q'` of `(P, ℒ \ {A₀})` +using `newEdge`, `A₀` is a complemented rooted subhypergraph of `Q'.G`. -/ +theorem isComplemented_heart_diff {P Q' : PartialPatchwork Ω α β} + {ℒ : Set (RootedHypergraph α β)} {A₀ : RootedHypergraph α β} + {newEdge : RootedHypergraph α β → β} + (hℒ : IsRootedLocation P.G ℒ) (hA₀ : A₀ ∈ ℒ) + (hQ' : IsPlaceHeart P (ℒ \ {A₀}) newEdge Q') : + IsComplemented Q'.G A₀ := by + have hℒ' := hQ'.isRootedLocation + have hA₀_comp := hℒ.isComplemented hA₀ + have hA₀_core_V : A₀.vertexSet ⊆ (rootedLocationCore P.G (ℒ \ {A₀})).vertexSet := by + intro v hv + rw [mem_rootedLocationCore_vertexSet_iff hℒ'] + refine ⟨hA₀_comp.le.vertexSet_subset hv, fun A hA hvA ↦ ?_⟩ + have hne : A₀ ≠ A := fun hEq ↦ hA.2 (Set.mem_singleton_iff.2 hEq.symm) + have hle := hℒ.le_complement hA₀ hA.1 hne + exact (hle.vertexSet_subset hv).resolve_left fun h ↦ h.2 hvA + have hA₀_core_E : A₀.edgeSet ⊆ (rootedLocationCore P.G (ℒ \ {A₀})).edgeSet := by + intro e he + rw [mem_rootedLocationCore_edgeSet_iff] + refine ⟨hA₀_comp.le.edgeSet_subset he, fun A hA ↦ ?_⟩ + have hne : A₀ ≠ A := fun hEq ↦ hA.2 (Set.mem_singleton_iff.2 hEq.symm) + exact ((hℒ.le_complement hA₀ hA.1 hne).edgeSet_subset he).2 + have hle : A₀.toHypergraph ≤ Q'.G.toHypergraph := + { vertexSet_subset := by + rw [hQ'.vertexSet_eq] + exact hA₀_core_V + edgeSet_subset := by + rw [hQ'.edgeSet_eq] + exact fun e he ↦ Or.inl (hA₀_core_E he) + ends_eq := fun e he ↦ by + rw [hQ'.ends_core (hA₀_core_E he)] + exact hA₀_comp.le.ends_eq e he } + refine ⟨hle, ?_, ?_⟩ + · intro v hvA₀ hv_root + change v ∈ Q'.G.roots at hv_root + rw [hQ'.roots_eq] at hv_root + exact hA₀_comp.roots_mem hvA₀ hv_root + · intro v e hvA₀ he_diff hinc + have he_Q' := he_diff.1 + rw [hQ'.edgeSet_eq] at he_Q' + rcases he_Q' with he_core | ⟨A, hA, rfl⟩ + · have heG : e ∈ P.G.edgeSet := (mem_rootedLocationCore_edgeSet_iff.1 he_core).1 + have hincG : P.G.Inc e v := by + change v ∈ P.G.ends e + rw [← hQ'.ends_core he_core] + exact hinc + exact hA₀_comp.inc_diff_mem hvA₀ ⟨heG, he_diff.2⟩ hincG + · have hvA : v ∈ A.rootSet := by + rw [← hQ'.ends_newEdge hA] + exact hinc + have hvA_V : v ∈ A.vertexSet := A.roots_subset v hvA + have hne : A ≠ A₀ := fun hEq ↦ hA.2 (Set.mem_singleton_iff.2 hEq) + have hle_comp := hℒ.le_complement hA.1 hA₀ hne + exact (hle_comp.vertexSet_subset hvA_V).resolve_left fun h ↦ h.2 hvA₀ + +/-- In the setup of `isComplemented_heart_diff`, `Q'.restrict A₀` is equivalent to `P.restrict A₀`. +-/ +theorem restrict_left_equiv_of_heart_diff {P Q' : PartialPatchwork Ω α β} + {ℒ : Set (RootedHypergraph α β)} {A₀ : RootedHypergraph α β} + {newEdge : RootedHypergraph α β → β} + (hℒ : IsRootedLocation P.G ℒ) (hA₀ : A₀ ∈ ℒ) + (hfresh : ∀ ⦃A⦄, A ∈ ℒ → newEdge A ∉ P.G.edgeSet) + (hQ' : IsPlaceHeart P (ℒ \ {A₀}) newEdge Q') : + PatchworkEquiv (Q'.restrict A₀) (P.restrict A₀) := by + have hcomp := isComplemented_heart_diff hℒ hA₀ hQ' + have hle_Q' : A₀.toHypergraph ≤ Q'.G.toHypergraph := hcomp.le + have hle_P : A₀.toHypergraph ≤ P.G.toHypergraph := (hℒ.isComplemented hA₀).le + have hA₀_core_E : A₀.edgeSet ⊆ (rootedLocationCore P.G (ℒ \ {A₀})).edgeSet := by + intro e he + rw [mem_rootedLocationCore_edgeSet_iff] + refine ⟨hle_P.edgeSet_subset he, fun A hA ↦ ?_⟩ + have hne : A₀ ≠ A := fun hEq ↦ hA.2 (Set.mem_singleton_iff.2 hEq.symm) + exact ((hℒ.le_complement hA₀ hA.1 hne).edgeSet_subset he).2 + refine + { G_eq := rfl + dom_eq := by + rw [Q'.restrict_dom hle_Q', P.restrict_dom hle_P, hQ'.dom_eq] + ext e + simp only [Set.mem_inter_iff, Set.mem_union, Set.mem_image] + refine ⟨?_, fun ⟨hd, heA₀⟩ ↦ ⟨Or.inl ⟨hA₀_core_E heA₀, hd⟩, heA₀⟩⟩ + rintro ⟨⟨_, hd⟩ | ⟨A, hA, rfl⟩, heA₀⟩ + · exact ⟨hd, heA₀⟩ + · exact (hfresh hA.1 (hle_P.edgeSet_subset heA₀)).elim + μ_eq := fun e he ↦ by + rw [Q'.restrict_dom hle_Q'] at he + exact hQ'.μ_core ⟨hA₀_core_E he.2, by + rw [hQ'.dom_eq] at he + rcases he.1 with ⟨_, hd⟩ | ⟨A, hA, rfl⟩ + · exact hd + · exact (hfresh hA.1 (hle_P.edgeSet_subset he.2)).elim⟩ + Δ_eq := fun e he ↦ by + rw [Q'.restrict_Δ hle_Q' he, P.restrict_Δ hle_P he, hQ'.Δ_core (hA₀_core_E he)] + φ_eq := fun e he ↦ hQ'.φ_core (hA₀_core_E he) } + +/-- In the setup of `isComplemented_heart_diff`, let `B₀ = complement Q'.G A₀ hcomp`. Then +`B₀.vertexSet = Q.G.vertexSet`, `B₀.edgeSet = Q.G.edgeSet \ {newEdge A₀}`, `B₀.roots = Q.G.roots`, +`B₀.toHypergraph ≤ Q.G.toHypergraph`, and `PatchworkEquiv (Q.restrict B₀) (Q'.restrict B₀)` +(claim `Q_i \ e_i(A_i) = Q_i' | B_i` on page 99). -/ +theorem complement_heart_diff_props {P Q Q' : PartialPatchwork Ω α β} + {ℒ : Set (RootedHypergraph α β)} {A₀ : RootedHypergraph α β} + {newEdge : RootedHypergraph α β → β} + (hQ : IsPlaceHeart P ℒ newEdge Q) (hA₀ : A₀ ∈ ℒ) + (hfresh : ∀ ⦃A⦄, A ∈ ℒ → newEdge A ∉ P.G.edgeSet) + (hQ' : IsPlaceHeart P (ℒ \ {A₀}) newEdge Q') : + let B₀ := complement Q'.G A₀ (isComplemented_heart_diff hQ.isRootedLocation hA₀ hQ') + B₀.vertexSet = Q.G.vertexSet ∧ + B₀.edgeSet = Q.G.edgeSet \ {newEdge A₀} ∧ + B₀.roots = Q.G.roots ∧ + B₀.toHypergraph ≤ Q.G.toHypergraph ∧ + PatchworkEquiv (Q.restrict B₀) (Q'.restrict B₀) := by + intro B₀ + have hℒ := hQ.isRootedLocation + have hℒ' := hQ'.isRootedLocation + have hcomp := isComplemented_heart_diff hℒ hA₀ hQ' + have hle_B₀_Q' : B₀.toHypergraph ≤ Q'.G.toHypergraph := + hcomp.isSeparation.isSeparation.right_le + have hV_eq : B₀.vertexSet = Q.G.vertexSet := by + rw [hQ.vertexSet_eq] + change (Q'.G.vertexSet \ A₀.vertexSet) ∪ A₀.rootSet = + (rootedLocationCore P.G ℒ).vertexSet + rw [hQ'.vertexSet_eq] + ext v + simp only [Set.mem_union, Set.mem_sdiff] + rw [mem_rootedLocationCore_vertexSet_iff hℒ', mem_rootedLocationCore_vertexSet_iff hℒ] + constructor + · rintro (⟨⟨hvG, hall'⟩, hnotA₀⟩ | hv_root₀) + · refine ⟨hvG, fun A hA hvA ↦ ?_⟩ + by_cases hEq : A = A₀ + · subst hEq; exact (hnotA₀ hvA).elim + · exact hall' A ⟨hA, hEq⟩ hvA + · have hvA₀ : v ∈ A₀.vertexSet := A₀.roots_subset v hv_root₀ + have hvG : v ∈ P.G.vertexSet := (hℒ.isComplemented hA₀).le.vertexSet_subset hvA₀ + refine ⟨hvG, fun A hA hvA ↦ ?_⟩ + by_cases hEq : A = A₀ + · subst hEq; exact hv_root₀ + · have hle := hℒ.le_complement hA₀ hA (Ne.symm hEq) + exact (hle.vertexSet_subset hvA₀).resolve_left fun h ↦ h.2 hvA + · rintro ⟨hvG, hall⟩ + by_cases hvA₀ : v ∈ A₀.vertexSet + · exact Or.inr (hall A₀ hA₀ hvA₀) + · exact Or.inl ⟨⟨hvG, fun A hA ↦ hall A hA.1⟩, hvA₀⟩ + have hE_eq : B₀.edgeSet = Q.G.edgeSet \ {newEdge A₀} := by + change Q'.G.edgeSet \ A₀.edgeSet = Q.G.edgeSet \ {newEdge A₀} + rw [hQ'.edgeSet_eq, hQ.edgeSet_eq] + ext e + simp only [Set.mem_sdiff, Set.mem_union, Set.mem_image, Set.mem_singleton_iff] + rw [mem_rootedLocationCore_edgeSet_iff, mem_rootedLocationCore_edgeSet_iff] + constructor + · rintro ⟨⟨heG, hall'⟩ | ⟨A, ⟨hA, hneA⟩, rfl⟩, hnotA₀⟩ + · refine ⟨Or.inl ⟨heG, fun A hA ↦ ?_⟩, fun hEq ↦ hfresh hA₀ (hEq ▸ heG)⟩ + by_cases hEq : A = A₀ + · subst hEq; exact hnotA₀ + · exact hall' A ⟨hA, hEq⟩ + · exact ⟨Or.inr ⟨A, hA, rfl⟩, fun hEq ↦ hneA (hQ.injOn_newEdge hA hA₀ hEq)⟩ + · rintro ⟨⟨heG, hall⟩ | ⟨A, hA, rfl⟩, hne_e₀⟩ + · exact ⟨Or.inl ⟨heG, fun A hA' ↦ hall A hA'.1⟩, hall A₀ hA₀⟩ + · have hneA : A ≠ A₀ := fun hEq ↦ hne_e₀ (congrArg newEdge hEq) + exact ⟨Or.inr ⟨A, ⟨hA, hneA⟩, rfl⟩, + fun heA₀ ↦ hfresh hA ((hℒ.isComplemented hA₀).le.edgeSet_subset heA₀)⟩ + have hroots_eq : B₀.roots = Q.G.roots := + hQ'.roots_eq.trans hQ.roots_eq.symm + have hcore_sub : (rootedLocationCore P.G ℒ).edgeSet ⊆ + (rootedLocationCore P.G (ℒ \ {A₀})).edgeSet := by + intro e he + rw [mem_rootedLocationCore_edgeSet_iff] at he ⊢ + exact ⟨he.1, fun A hA ↦ he.2 A hA.1⟩ + have hle_B₀_Q : B₀.toHypergraph ≤ Q.G.toHypergraph := + { vertexSet_subset := hV_eq.le + edgeSet_subset := hE_eq.le.trans Set.sdiff_subset + ends_eq := fun e he ↦ by + rw [← hle_B₀_Q'.ends_eq e he] + have he_Q : e ∈ Q.G.edgeSet ∧ e ≠ newEdge A₀ := by simpa [hE_eq] using he + rcases (hQ.edgeSet_eq ▸ he_Q.1) with he_core | ⟨A, hA, rfl⟩ + · rw [hQ.ends_core he_core, hQ'.ends_core (hcore_sub he_core)] + · have hneA : A ≠ A₀ := fun hEq ↦ he_Q.2 (congrArg newEdge hEq) + rw [hQ.ends_newEdge hA, hQ'.ends_newEdge ⟨hA, hneA⟩] } + refine ⟨hV_eq, hE_eq, hroots_eq, hle_B₀_Q, ?_⟩ + refine + { G_eq := rfl + dom_eq := by + rw [Q.restrict_dom hle_B₀_Q, Q'.restrict_dom hle_B₀_Q', hQ.dom_eq, hQ'.dom_eq] + ext e + simp only [Set.mem_inter_iff] + refine and_congr_left fun heB₀ ↦ ?_ + have he_Q : e ∈ Q.G.edgeSet ∧ e ≠ newEdge A₀ := by simpa [hE_eq] using heB₀ + simp only [Set.mem_union, Set.mem_inter_iff, Set.mem_image, Set.mem_sdiff, + Set.mem_singleton_iff] + constructor + · rintro (⟨he_core, hd⟩ | ⟨A, hA, rfl⟩) + · exact Or.inl ⟨hcore_sub he_core, hd⟩ + · have hneA : A ≠ A₀ := fun hEq ↦ he_Q.2 (congrArg newEdge hEq) + exact Or.inr ⟨A, ⟨hA, hneA⟩, rfl⟩ + · rintro (⟨_, hd⟩ | ⟨A, ⟨hA, _⟩, rfl⟩) + · rcases (hQ.edgeSet_eq ▸ he_Q.1) with he_core | ⟨A, hA, rfl⟩ + · exact Or.inl ⟨he_core, hd⟩ + · exact Or.inr ⟨A, hA, rfl⟩ + · exact Or.inr ⟨A, hA, rfl⟩ + μ_eq := fun e he ↦ by + rw [Q.restrict_dom hle_B₀_Q] at he + have he_Q : e ∈ Q.G.edgeSet ∧ e ≠ newEdge A₀ := by simpa [hE_eq] using he.2 + have hdom := he.1 + rw [hQ.dom_eq] at hdom + change Q.μ e = Q'.μ e + rcases hdom with ⟨he_core, hd⟩ | ⟨A, hA, rfl⟩ + · rw [hQ.μ_core ⟨he_core, hd⟩, hQ'.μ_core ⟨hcore_sub he_core, hd⟩] + · have hneA : A ≠ A₀ := fun hEq ↦ he_Q.2 (congrArg newEdge hEq) + rw [hQ.μ_newEdge hA, hQ'.μ_newEdge ⟨hA, hneA⟩] + Δ_eq := fun e heB₀ ↦ by + rw [Q.restrict_Δ hle_B₀_Q heB₀, Q'.restrict_Δ hle_B₀_Q' heB₀] + have he_Q : e ∈ Q.G.edgeSet ∧ e ≠ newEdge A₀ := by simpa [hE_eq] using heB₀ + rcases (hQ.edgeSet_eq ▸ he_Q.1) with he_core | ⟨A, hA, rfl⟩ + · rw [hQ.Δ_core he_core, hQ'.Δ_core (hcore_sub he_core)] + · have hneA : A ≠ A₀ := fun hEq ↦ he_Q.2 (congrArg newEdge hEq) + rw [hQ.Δ_newEdge hA, hQ'.Δ_newEdge ⟨hA, hneA⟩] + φ_eq := fun e heB₀ ↦ by + have he_Q : e ∈ Q.G.edgeSet ∧ e ≠ newEdge A₀ := by simpa [hE_eq] using heB₀ + change Q.φ e = Q'.φ e + rcases (hQ.edgeSet_eq ▸ he_Q.1) with he_core | ⟨A, hA, rfl⟩ + · rw [hQ.φ_core he_core, hQ'.φ_core (hcore_sub he_core)] + · have hneA : A ≠ A₀ := fun hEq ↦ he_Q.2 (congrArg newEdge hEq) + rw [hQ.φ_newEdge hA, hQ'.φ_newEdge ⟨hA, hneA⟩] } + +open Classical in +/-- Rooted hypergraph with a single edge `e₀` and vertex set and ends equal to `{v | v ∈ r}` +(used in Case 1 of (5.7), page 99). -/ +@[expose] noncomputable def singleEdgeRootedHypergraph (e₀ : β) (r : List α) (hr : r.Nodup) : + RootedHypergraph α β where + toHypergraph := + { vertexSet := {v | v ∈ r} + edgeSet := {e₀} + Inc e v := e = e₀ ∧ v ∈ r + vertex_mem_of_inc _ _ h := h.2 + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := r.toFinset.finite_toSet.subset fun _ h ↦ List.mem_toFinset.2 h + edgeSet_finite := Set.finite_singleton e₀ } + roots := r + roots_nodup := hr + roots_subset _ hv := hv + +/-- In Case 1 of (5.7), `(K, B₂)` is a separation of `Q₂.G`, where +`K = singleEdgeRootedHypergraph (newEdge₂ A₂) A₂.roots A₂.roots_nodup` and +`B₂ = complement Q₂'.G A₂ ...`. -/ +theorem isSeparation_singleEdge_complement_of_heart_diff {P₂ Q₂ Q₂' : PartialPatchwork Ω α β} + {ℒ₂ : Set (RootedHypergraph α β)} {A₂ : RootedHypergraph α β} + {newEdge₂ : RootedHypergraph α β → β} + (hQ₂ : IsPlaceHeart P₂ ℒ₂ newEdge₂ Q₂) (hA₂ : A₂ ∈ ℒ₂) + (hfresh₂ : ∀ ⦃A⦄, A ∈ ℒ₂ → newEdge₂ A ∉ P₂.G.edgeSet) + (hQ₂' : IsPlaceHeart P₂ (ℒ₂ \ {A₂}) newEdge₂ Q₂') : + Q₂.G.IsSeparation + (singleEdgeRootedHypergraph (newEdge₂ A₂) A₂.roots A₂.roots_nodup) + (complement Q₂'.G A₂ (isComplemented_heart_diff hQ₂.isRootedLocation hA₂ hQ₂')) := by + let K := singleEdgeRootedHypergraph (newEdge₂ A₂) A₂.roots A₂.roots_nodup + let B₂ := complement Q₂'.G A₂ (isComplemented_heart_diff hQ₂.isRootedLocation hA₂ hQ₂') + obtain ⟨hV_eq, hE_eq, hroots_eq, hle_B₂, _⟩ := + complement_heart_diff_props hQ₂ hA₂ hfresh₂ hQ₂' + have he₂_mem : newEdge₂ A₂ ∈ Q₂.G.edgeSet := by + rw [hQ₂.edgeSet_eq] + exact Or.inr ⟨A₂, hA₂, rfl⟩ + have hends_e₂ : Q₂.G.ends (newEdge₂ A₂) = A₂.rootSet := hQ₂.ends_newEdge hA₂ + have hroot_sub : A₂.rootSet ⊆ Q₂.G.vertexSet := by + rw [hQ₂.vertexSet_eq] + exact mem_rootSet_subset_rootedLocationCore hQ₂.isRootedLocation hA₂ + have hle_K : K.toHypergraph ≤ Q₂.G.toHypergraph := + { vertexSet_subset := hroot_sub + edgeSet_subset := Set.singleton_subset_iff.2 he₂_mem + ends_eq := fun e he ↦ by + have he_eq : e = newEdge₂ A₂ := Set.mem_singleton_iff.1 he + subst he_eq + rw [hends_e₂] + ext v + exact ⟨fun hv ↦ ⟨rfl, hv⟩, fun h ↦ h.2⟩ } + refine + { isSeparation := + { left_le := hle_K + right_le := hle_B₂ + union_eq := by + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (GM10.union_le hle_K hle_B₂) le_rfl ?_ ?_ + · change A₂.rootSet ∪ B₂.vertexSet = Q₂.G.vertexSet + rw [hV_eq] + exact Set.union_eq_self_of_subset_left hroot_sub + · change ({newEdge₂ A₂} : Set β) ∪ B₂.edgeSet = Q₂.G.edgeSet + rw [hE_eq] + exact Set.union_sdiff_cancel (Set.singleton_subset_iff.2 he₂_mem) + edgeSet_inter_eq := by + change ({newEdge₂ A₂} : Set β) ∩ B₂.edgeSet = ∅ + rw [hE_eq] + ext e + simp } + roots_right := hroots_eq + rootSet_left := by + change A₂.rootSet = A₂.rootSet ∩ B₂.vertexSet + rw [hV_eq] + exact (Set.inter_eq_self_of_subset_left hroot_sub).symm } + +/-- In Case 2 of (5.7), if `(ηv, ηe)` is a realizable expansion of `Q₁` in `Q₂` with +`ηe (newEdge₁ A₁) = newEdge₂ A₂`, then `(ηv, ηe)` is also a realizable expansion of +`Q₁.restrict B₁` in `Q₂.restrict B₂`. -/ +theorem isRealizableExpansion_restrict_complement_of_heart_diff [Preorder Ω] + {α₁ β₁ α₂ β₂ : Type*} + {P₁ Q₁ Q₁' : PartialPatchwork Ω α₁ β₁} + {P₂ Q₂ Q₂' : PartialPatchwork Ω α₂ β₂} + {ℒ₁ : Set (RootedHypergraph α₁ β₁)} {ℒ₂ : Set (RootedHypergraph α₂ β₂)} + {A₁ : RootedHypergraph α₁ β₁} {A₂ : RootedHypergraph α₂ β₂} + {newEdge₁ : RootedHypergraph α₁ β₁ → β₁} {newEdge₂ : RootedHypergraph α₂ β₂ → β₂} + (hQ₁ : IsPlaceHeart P₁ ℒ₁ newEdge₁ Q₁) (hA₁ : A₁ ∈ ℒ₁) + (hfresh₁ : ∀ ⦃A⦄, A ∈ ℒ₁ → newEdge₁ A ∉ P₁.G.edgeSet) + (hQ₁' : IsPlaceHeart P₁ (ℒ₁ \ {A₁}) newEdge₁ Q₁') + (hQ₂ : IsPlaceHeart P₂ ℒ₂ newEdge₂ Q₂) (hA₂ : A₂ ∈ ℒ₂) + (hfresh₂ : ∀ ⦃A⦄, A ∈ ℒ₂ → newEdge₂ A ∉ P₂.G.edgeSet) + (hQ₂' : IsPlaceHeart P₂ (ℒ₂ \ {A₂}) newEdge₂ Q₂') + {ηv : α₁ → Set α₂} {ηe : β₁ → β₂} + (hη : GM04.IsRealizableExpansion Q₁ Q₂ ηv ηe) + (he_map : ηe (newEdge₁ A₁) = newEdge₂ A₂) : + let B₁ := complement Q₁'.G A₁ (isComplemented_heart_diff hQ₁.isRootedLocation hA₁ hQ₁') + let B₂ := complement Q₂'.G A₂ (isComplemented_heart_diff hQ₂.isRootedLocation hA₂ hQ₂') + GM04.IsRealizableExpansion (Q₁.restrict B₁) (Q₂.restrict B₂) ηv ηe := by + intro B₁ B₂ + obtain ⟨hV₁, hE₁, hroots₁, hle₁, _⟩ := complement_heart_diff_props hQ₁ hA₁ hfresh₁ hQ₁' + obtain ⟨hV₂, hE₂, hroots₂, hle₂, _⟩ := complement_heart_diff_props hQ₂ hA₂ hfresh₂ hQ₂' + obtain ⟨hexp, H, ⟨⟨δ, hδ, hH⟩, hcomp⟩⟩ := hη + have he₁_mem : newEdge₁ A₁ ∈ Q₁.G.edgeSet := by + rw [hQ₁.edgeSet_eq]; exact Or.inr ⟨A₁, hA₁, rfl⟩ + have hmap_B₁ : ∀ e ∈ B₁.edgeSet, ηe e ∈ B₂.edgeSet := by + intro e he + rw [hE₁] at he + rw [hE₂] + refine ⟨hexp.edge_mem e he.1, fun hEq ↦ he.2 ?_⟩ + exact hexp.edge_injOn he.1 he₁_mem (hEq.trans he_map.symm) + have hexp_B : GM04.IsExpansion (Q₁.restrict B₁) (Q₂.restrict B₂) ηv ηe := + { vertex_nonempty := fun v hv ↦ hexp.vertex_nonempty v (hV₁ ▸ hv) + vertex_subset := fun v hv ↦ hV₂.symm ▸ hexp.vertex_subset v (hV₁ ▸ hv) + edge_mem := hmap_B₁ + vertex_disjoint := fun v₁ hv₁ v₂ hv₂ hne ↦ + hexp.vertex_disjoint v₁ (hV₁ ▸ hv₁) v₂ (hV₁ ▸ hv₂) hne + edge_injOn := hexp.edge_injOn.mono hle₁.edgeSet_subset + mem_dom_iff := fun e he ↦ by + rw [Q₁.restrict_dom hle₁, Q₂.restrict_dom hle₂] + have heQ₁ : e ∈ Q₁.G.edgeSet := hle₁.edgeSet_subset he + have heB₂ : ηe e ∈ B₂.edgeSet := hmap_B₁ e he + exact ⟨fun h ↦ ⟨(hexp.mem_dom_iff e heQ₁).1 h.1, heB₂⟩, + fun h ↦ ⟨(hexp.mem_dom_iff e heQ₁).2 h.1, he⟩⟩ + ends_nonempty := fun e he hnd v hinc ↦ by + have heQ₁ : e ∈ Q₁.G.edgeSet := hle₁.edgeSet_subset he + have hndQ₁ : e ∉ Q₁.dom := fun hd ↦ hnd ((Q₁.restrict_dom hle₁).symm ▸ ⟨hd, he⟩) + have hincQ₁ : Q₁.G.Inc e v := GM10.inc_of_le hle₁ hinc + obtain ⟨v', hv', hincQ₂⟩ := hexp.ends_nonempty e heQ₁ hndQ₁ v hincQ₁ + have hincB₂ : B₂.Inc (ηe e) v' := by + change v' ∈ B₂.ends (ηe e) + rw [← hle₂.ends_eq (ηe e) (hmap_B₁ e he)] + exact hincQ₂ + exact ⟨v', hv', hincB₂⟩ + μ_length := fun e he ↦ by + rw [Q₁.restrict_dom hle₁] at he + exact hexp.μ_length e he.1 + μ_mem := fun e he i hi hi' ↦ by + rw [Q₁.restrict_dom hle₁] at he + exact hexp.μ_mem e he.1 i hi hi' + roots_length := by + change B₁.roots.length = B₂.roots.length + rw [hroots₁, hroots₂] + exact hexp.roots_length + roots_mem := fun i hi hi' ↦ by + change B₂.roots[i] ∈ ηv B₁.roots[i] + rw [getElem_congr_list hroots₂ i hi', getElem_congr_list hroots₁ i hi] + exact hexp.roots_mem i (hroots₁ ▸ hi) (hroots₂ ▸ hi') + maps_Δ := fun e he ↦ by + rw [Q₁.restrict_dom hle₁] at he + have heB₂ : ηe e ∈ B₂.edgeSet := hmap_B₁ e he.2 + change Set.MapsTo (GM04.marchMapSubgraph (Q₁.μ e) (Q₂.μ (ηe e))) + ((Q₁.restrict B₁).Δ e).groupings ((Q₂.restrict B₂).Δ (ηe e)).groupings + rw [Q₁.restrict_Δ hle₁ he.2, Q₂.restrict_Δ hle₂ heB₂] + exact hexp.maps_Δ e he.1 + φ_le := fun e he ↦ hexp.φ_le e (hle₁.edgeSet_subset he) } + have hdel_edgeSet : + ((Q₂.restrict B₂).deleteEdges (ηe '' B₁.edgeSet)).G.edgeSet = + (Q₂.deleteEdges (ηe '' Q₁.G.edgeSet)).G.edgeSet := by + change B₂.edgeSet \ (ηe '' B₁.edgeSet) = Q₂.G.edgeSet \ (ηe '' Q₁.G.edgeSet) + rw [hE₁, hE₂] + ext e' + simp only [Set.mem_sdiff, Set.mem_singleton_iff, Set.mem_image] + constructor + · rintro ⟨⟨he'Q₂, hne_e₂⟩, hnot_img⟩ + refine ⟨he'Q₂, ?_⟩ + rintro ⟨e, heQ₁, rfl⟩ + by_cases hEq : e = newEdge₁ A₁ + · subst hEq; exact hne_e₂ he_map + · exact hnot_img ⟨e, ⟨heQ₁, hEq⟩, rfl⟩ + · rintro ⟨he'Q₂, hnot_img⟩ + refine ⟨⟨he'Q₂, ?_⟩, ?_⟩ + · rintro rfl + exact hnot_img ⟨newEdge₁ A₁, he₁_mem, he_map⟩ + · rintro ⟨e, ⟨heQ₁, _⟩, rfl⟩ + exact hnot_img ⟨e, heQ₁, rfl⟩ + refine ⟨hexp_B, H, ⟨⟨δ, fun e' he' ↦ ?_, ?_⟩, fun v hv ↦ hcomp v (hV₁ ▸ hv)⟩⟩ + · have he'B₂ : e' ∈ B₂.edgeSet := he'.1 + have he'_del : e' ∈ (Q₂.deleteEdges (ηe '' Q₁.G.edgeSet)).G.edgeSet := + hdel_edgeSet ▸ he' + change δ e' ∈ (Q₂.restrict B₂).Δ e' + rw [Q₂.restrict_Δ hle₂ he'B₂] + exact hδ e' he'_del + · rw [hH] + exact realizationOf_congr + (G₁ := (Q₂.deleteEdges (ηe '' Q₁.G.edgeSet)).G.toHypergraph) + (G₂ := ((Q₂.restrict B₂).deleteEdges (ηe '' B₁.edgeSet)).G.toHypergraph) + hV₂.symm hdel_edgeSet.symm δ + +private theorem roots_mem_of_placeHeart_expansion [Preorder Ω] + {P₁ Q₁ : PartialPatchwork Ω α₁ β₁} {P₂ Q₂ : PartialPatchwork Ω α₂ β₂} + {ℒ₁ : Set (RootedHypergraph α₁ β₁)} {ℒ₂ : Set (RootedHypergraph α₂ β₂)} + {newEdge₁ : RootedHypergraph α₁ β₁ → β₁} {newEdge₂ : RootedHypergraph α₂ β₂ → β₂} + (hQ₁ : IsPlaceHeart P₁ ℒ₁ newEdge₁ Q₁) (hQ₂ : IsPlaceHeart P₂ ℒ₂ newEdge₂ Q₂) + {A₁ : RootedHypergraph α₁ β₁} {A₂ : RootedHypergraph α₂ β₂} + (hA₁ : A₁ ∈ ℒ₁) (hA₂ : A₂ ∈ ℒ₂) + {ηv : α₁ → Set α₂} {ηe : β₁ → β₂} + (hη : GM04.IsRealizableExpansion Q₁ Q₂ ηv ηe) + (he₀_eq : ηe (newEdge₁ A₁) = newEdge₂ A₂) : + ∀ (i : ℕ) (hi₁ : i < A₁.roots.length) (hi₂ : i < A₂.roots.length), + A₂.roots[i] ∈ ηv A₁.roots[i] := by + intro i hi₁ hi₂ + have he₁_dom : newEdge₁ A₁ ∈ Q₁.dom := by + rw [hQ₁.dom_eq]; exact Or.inr ⟨A₁, hA₁, rfl⟩ + have hμ₁ : Q₁.μ (newEdge₁ A₁) = A₁.roots := hQ₁.μ_newEdge hA₁ + have hμ₂ : Q₂.μ (newEdge₂ A₂) = A₂.roots := hQ₂.μ_newEdge hA₂ + have hi₁' : i < (Q₁.μ (newEdge₁ A₁)).length := hμ₁.symm ▸ hi₁ + have hi₂' : i < (Q₂.μ (ηe (newEdge₁ A₁))).length := by + rw [he₀_eq, hμ₂]; exact hi₂ + have hmem := hη.1.μ_mem (newEdge₁ A₁) he₁_dom i hi₁' hi₂' + simpa [he₀_eq, hμ₁, hμ₂] using hmem + +private theorem simulated_of_empty_placeHeart [Preorder Ω] + {P₁ Q₁ : PartialPatchwork Ω α₁ β₁} {P₂ Q₂ : PartialPatchwork Ω α₂ β₂} + {ℒ₁ : Set (RootedHypergraph α₁ β₁)} {ℒ₂ : Set (RootedHypergraph α₂ β₂)} + {newEdge₁ : RootedHypergraph α₁ β₁ → β₁} {newEdge₂ : RootedHypergraph α₂ β₂ → β₂} + (hQ₁ : IsPlaceHeart P₁ ℒ₁ newEdge₁ Q₁) (hQ₂ : IsPlaceHeart P₂ ℒ₂ newEdge₂ Q₂) + (hcard : ℒ₂.ncard = 0) + {ηv : α₁ → Set α₂} {ηe : β₁ → β₂} + (hη : GM04.IsRealizableExpansion Q₁ Q₂ ηv ηe) + (hsim : ∀ ⦃A₁ : RootedHypergraph α₁ β₁⦄, A₁ ∈ ℒ₁ → + ∃ A₂ ∈ ℒ₂, ηe (newEdge₁ A₁) = newEdge₂ A₂ ∧ + GM04.Simulated (P₁.restrict A₁) (P₂.restrict A₂)) : + GM04.Simulated P₁ P₂ := by + have hℒ₂_empty : ℒ₂ = ∅ := + (Set.ncard_eq_zero hQ₂.isRootedLocation.finite).1 hcard + subst hℒ₂_empty + have hℒ₁_empty : ℒ₁ = ∅ := by + ext A₁ + simp only [Set.mem_empty_iff_false, iff_false] + intro hA₁ + obtain ⟨_, h, _⟩ := hsim hA₁ + exact h + subst hℒ₁_empty + exact ⟨ηv, ηe, + PatchworkEquiv.isRealizableExpansion_congr hQ₁.equiv_of_empty hQ₂.equiv_of_empty hη⟩ + +/-- Version of `(5.7)` under the freshness condition `∀ A ∈ ℒ_i, newEdge_i A ∉ P_i.G.edgeSet`, +proved by induction on `|ℒ₂|` following pages 99–100. -/ +theorem theorem_5_7_of_notMem_edgeSet [Preorder Ω] {α₁ β₁ α₂ β₂ : Type*} + {P₁ Q₁ : PartialPatchwork Ω α₁ β₁} {P₂ Q₂ : PartialPatchwork Ω α₂ β₂} + {ℒ₁ : Set (RootedHypergraph α₁ β₁)} {ℒ₂ : Set (RootedHypergraph α₂ β₂)} + {newEdge₁ : RootedHypergraph α₁ β₁ → β₁} {newEdge₂ : RootedHypergraph α₂ β₂ → β₂} + (hQ₁ : IsPlaceHeart P₁ ℒ₁ newEdge₁ Q₁) + (hQ₂ : IsPlaceHeart P₂ ℒ₂ newEdge₂ Q₂) + (hfresh₁ : ∀ ⦃A₁⦄, A₁ ∈ ℒ₁ → newEdge₁ A₁ ∉ P₁.G.edgeSet) + (hfresh₂ : ∀ ⦃A₂⦄, A₂ ∈ ℒ₂ → newEdge₂ A₂ ∉ P₂.G.edgeSet) + {ηv : α₁ → Set α₂} {ηe : β₁ → β₂} + (hη : GM04.IsRealizableExpansion Q₁ Q₂ ηv ηe) + (hpre : ∀ ⦃e : β₁⦄ ⦃A₂ : RootedHypergraph α₂ β₂⦄, + e ∈ Q₁.G.edgeSet → A₂ ∈ ℒ₂ → ηe e = newEdge₂ A₂ → ∃ A₁ ∈ ℒ₁, e = newEdge₁ A₁) + (hsim : ∀ ⦃A₁ : RootedHypergraph α₁ β₁⦄, A₁ ∈ ℒ₁ → + ∃ A₂ ∈ ℒ₂, ηe (newEdge₁ A₁) = newEdge₂ A₂ ∧ + GM04.Simulated (P₁.restrict A₁) (P₂.restrict A₂)) : + GM04.Simulated P₁ P₂ := by + classical + suffices hind : ∀ (n : ℕ) + {P₁ Q₁ : PartialPatchwork Ω α₁ β₁} {P₂ Q₂ : PartialPatchwork Ω α₂ β₂} + {ℒ₁ : Set (RootedHypergraph α₁ β₁)} {ℒ₂ : Set (RootedHypergraph α₂ β₂)} + (hcard : ℒ₂.ncard = n) + (hQ₁ : IsPlaceHeart P₁ ℒ₁ newEdge₁ Q₁) + (hQ₂ : IsPlaceHeart P₂ ℒ₂ newEdge₂ Q₂) + (hfresh₁ : ∀ ⦃A₁⦄, A₁ ∈ ℒ₁ → newEdge₁ A₁ ∉ P₁.G.edgeSet) + (hfresh₂ : ∀ ⦃A₂⦄, A₂ ∈ ℒ₂ → newEdge₂ A₂ ∉ P₂.G.edgeSet) + {ηv : α₁ → Set α₂} {ηe : β₁ → β₂} + (hη : GM04.IsRealizableExpansion Q₁ Q₂ ηv ηe) + (hpre : ∀ ⦃e : β₁⦄ ⦃A₂ : RootedHypergraph α₂ β₂⦄, + e ∈ Q₁.G.edgeSet → A₂ ∈ ℒ₂ → ηe e = newEdge₂ A₂ → ∃ A₁ ∈ ℒ₁, e = newEdge₁ A₁) + (hsim : ∀ ⦃A₁ : RootedHypergraph α₁ β₁⦄, A₁ ∈ ℒ₁ → + ∃ A₂ ∈ ℒ₂, ηe (newEdge₁ A₁) = newEdge₂ A₂ ∧ + GM04.Simulated (P₁.restrict A₁) (P₂.restrict A₂)), + GM04.Simulated P₁ P₂ by + exact hind ℒ₂.ncard rfl hQ₁ hQ₂ hfresh₁ hfresh₂ hη hpre hsim + intro n + induction n with + | zero => + intro P₁ Q₁ P₂ Q₂ ℒ₁ ℒ₂ hcard hQ₁ hQ₂ _ _ ηv ηe hη _ hsim + exact simulated_of_empty_placeHeart hQ₁ hQ₂ hcard hη hsim + | succ m ih => + intro P₁ Q₁ P₂ Q₂ ℒ₁ ℒ₂ hcard hQ₁ hQ₂ hfresh₁ hfresh₂ ηv ηe hη hpre hsim + have hℒ₂_nonempty : ℒ₂.Nonempty := + (Set.ncard_pos hQ₂.isRootedLocation.finite).1 (by omega) + obtain ⟨A₂, hA₂⟩ := hℒ₂_nonempty + let ℒ₂' : Set (RootedHypergraph α₂ β₂) := ℒ₂ \ {A₂} + have hcard' : ℒ₂'.ncard = m := by + have hdiff : ℒ₂'.ncard = ℒ₂.ncard - 1 := Set.ncard_sdiff_singleton_of_mem hA₂ + omega + have hℒ₂' : IsRootedLocation P₂.G ℒ₂' := + hQ₂.isRootedLocation.mono Set.sdiff_subset + have hinj₂' : Set.InjOn newEdge₂ ℒ₂' := + hQ₂.injOn_newEdge.mono Set.sdiff_subset + have hfresh₂' : ∀ ⦃A⦄, A ∈ ℒ₂' → newEdge₂ A ∉ P₂.G.edgeSet := + fun _ hA ↦ hfresh₂ hA.1 + have hnotMem₂' : ∀ ⦃A⦄, A ∈ ℒ₂' → newEdge₂ A ∉ (rootedLocationCore P₂.G ℒ₂').edgeSet := + fun _ hA hc ↦ hfresh₂' hA (mem_rootedLocationCore_edgeSet_iff.1 hc).1 + let Q₂' := mkPlaceHeart P₂ hℒ₂' newEdge₂ hinj₂' hnotMem₂' + have hQ₂' : IsPlaceHeart P₂ ℒ₂' newEdge₂ Q₂' := + isPlaceHeart_mkPlaceHeart P₂ hℒ₂' newEdge₂ hinj₂' hnotMem₂' + have hcomp₂ := isComplemented_heart_diff hQ₂.isRootedLocation hA₂ hQ₂' + let B₂ := complement Q₂'.G A₂ hcomp₂ + obtain ⟨hV₂, hE₂, hroots₂, hle_B₂, hequiv_B₂⟩ := + complement_heart_diff_props hQ₂ hA₂ hfresh₂ hQ₂' + have hequiv_A₂ := restrict_left_equiv_of_heart_diff hQ₂.isRootedLocation hA₂ hfresh₂ hQ₂' + by_cases hhit : ∃ e ∈ Q₁.G.edgeSet, ηe e = newEdge₂ A₂ + · -- Case 2: `newEdge₂ A₂ = ηe (newEdge₁ A₁)` for some `A₁ ∈ ℒ₁`. + rcases hhit with ⟨e₀, he₀, he₀_eq⟩ + obtain ⟨A₁, hA₁, rfl⟩ := hpre he₀ hA₂ he₀_eq + obtain ⟨A₂_star, hA₂_star, hA₂_star_eq, hsim_A₁⟩ := hsim hA₁ + have hA₂_eq : A₂_star = A₂ := + hQ₂.injOn_newEdge hA₂_star hA₂ (hA₂_star_eq.symm.trans he₀_eq) + subst A₂_star + let ℒ₁' : Set (RootedHypergraph α₁ β₁) := ℒ₁ \ {A₁} + have hℒ₁' : IsRootedLocation P₁.G ℒ₁' := + hQ₁.isRootedLocation.mono Set.sdiff_subset + have hinj₁' : Set.InjOn newEdge₁ ℒ₁' := + hQ₁.injOn_newEdge.mono Set.sdiff_subset + have hfresh₁' : ∀ ⦃A⦄, A ∈ ℒ₁' → newEdge₁ A ∉ P₁.G.edgeSet := + fun _ hA ↦ hfresh₁ hA.1 + have hnotMem₁' : ∀ ⦃A⦄, A ∈ ℒ₁' → newEdge₁ A ∉ (rootedLocationCore P₁.G ℒ₁').edgeSet := + fun _ hA hc ↦ hfresh₁' hA (mem_rootedLocationCore_edgeSet_iff.1 hc).1 + let Q₁' := mkPlaceHeart P₁ hℒ₁' newEdge₁ hinj₁' hnotMem₁' + have hQ₁' : IsPlaceHeart P₁ ℒ₁' newEdge₁ Q₁' := + isPlaceHeart_mkPlaceHeart P₁ hℒ₁' newEdge₁ hinj₁' hnotMem₁' + have hcomp₁ := isComplemented_heart_diff hQ₁.isRootedLocation hA₁ hQ₁' + let B₁ := complement Q₁'.G A₁ hcomp₁ + obtain ⟨_, hE₁, _, _, hequiv_B₁⟩ := + complement_heart_diff_props hQ₁ hA₁ hfresh₁ hQ₁' + have hequiv_A₁ := restrict_left_equiv_of_heart_diff hQ₁.isRootedLocation hA₁ hfresh₁ hQ₁' + obtain ⟨η'v, η'e, hη'_P⟩ := hsim_A₁ + have hη' : GM04.IsRealizableExpansion (Q₁'.restrict A₁) (Q₂'.restrict A₂) η'v η'e := + PatchworkEquiv.isRealizableExpansion_congr hequiv_A₁.symm hequiv_A₂.symm hη'_P + have hη''_Q : GM04.IsRealizableExpansion (Q₁.restrict B₁) (Q₂.restrict B₂) ηv ηe := + isRealizableExpansion_restrict_complement_of_heart_diff + hQ₁ hA₁ hfresh₁ hQ₁' hQ₂ hA₂ hfresh₂ hQ₂' hη he₀_eq + have hη'' : GM04.IsRealizableExpansion (Q₁'.restrict B₁) (Q₂'.restrict B₂) ηv ηe := + PatchworkEquiv.isRealizableExpansion_congr hequiv_B₁ hequiv_B₂ hη''_Q + have hroots_mem := roots_mem_of_placeHeart_expansion hQ₁ hQ₂ hA₁ hA₂ hη he₀_eq + have hη₀ := theorem_5_6_proof hcomp₁.isSeparation hcomp₂.isSeparation hη' hη'' hroots_mem + refine ih hcard' hQ₁' hQ₂' hfresh₁' hfresh₂' hη₀ ?_ ?_ + · intro e A₂' he_Q₁' hA₂' hEq_e + by_cases he_A₁ : e ∈ A₁.edgeSet + · exfalso + have hglue : GM04.glueEdge A₁ η'e ηe e = η'e e := GM04.glueEdge_of_mem_left he_A₁ + have he'_A₂ : η'e e ∈ A₂.edgeSet := hη'.1.edge_mem e he_A₁ + rw [hglue] at hEq_e + rw [hEq_e] at he'_A₂ + exact hfresh₂' hA₂' ((hQ₂.isRootedLocation.isComplemented hA₂).le.edgeSet_subset he'_A₂) + · have hglue : GM04.glueEdge A₁ η'e ηe e = ηe e := GM04.glueEdge_of_notMem_left he_A₁ + rw [hglue] at hEq_e + have he_B₁ : e ∈ B₁.edgeSet := ⟨he_Q₁', he_A₁⟩ + have he_Q₁ : e ∈ Q₁.G.edgeSet ∧ e ≠ newEdge₁ A₁ := by + simpa using (hE₁ ▸ he_B₁ : e ∈ Q₁.G.edgeSet \ {newEdge₁ A₁}) + obtain ⟨A₁', hA₁', rfl⟩ := hpre he_Q₁.1 hA₂'.1 hEq_e + have hne_A₁' : A₁' ≠ A₁ := fun hEq ↦ he_Q₁.2 (congrArg newEdge₁ hEq) + exact ⟨A₁', ⟨hA₁', hne_A₁'⟩, rfl⟩ + · intro A₁' hA₁' + have hnot_A₁ : newEdge₁ A₁' ∉ A₁.edgeSet := fun heA₁ ↦ + hfresh₁' hA₁' ((hQ₁.isRootedLocation.isComplemented hA₁).le.edgeSet_subset heA₁) + have hglue : GM04.glueEdge A₁ η'e ηe (newEdge₁ A₁') = ηe (newEdge₁ A₁') := + GM04.glueEdge_of_notMem_left hnot_A₁ + obtain ⟨A₂', hA₂', hEq_e₂, hsim_A₁'⟩ := hsim hA₁'.1 + have hne_A₂' : A₂' ≠ A₂ := by + rintro rfl + have he₁'_Q₁ : newEdge₁ A₁' ∈ Q₁.G.edgeSet := by + rw [hQ₁.edgeSet_eq]; exact Or.inr ⟨A₁', hA₁'.1, rfl⟩ + have he₁_Q₁ : newEdge₁ A₁ ∈ Q₁.G.edgeSet := by + rw [hQ₁.edgeSet_eq]; exact Or.inr ⟨A₁, hA₁, rfl⟩ + have hEq_new : newEdge₁ A₁' = newEdge₁ A₁ := + hη.1.edge_injOn he₁'_Q₁ he₁_Q₁ (hEq_e₂.trans he₀_eq.symm) + exact hA₁'.2 (Set.mem_singleton_iff.2 (hQ₁.injOn_newEdge hA₁'.1 hA₁ hEq_new)) + exact ⟨A₂', ⟨hA₂', hne_A₂'⟩, hglue.trans hEq_e₂, hsim_A₁'⟩ + · -- Case 1: `∀ e ∈ Q₁.G.edgeSet, ηe e ≠ newEdge₂ A₂`. + push Not at hhit + let K := singleEdgeRootedHypergraph (newEdge₂ A₂) A₂.roots A₂.roots_nodup + have hsep_K : Q₂.G.IsSeparation K B₂ := + isSeparation_singleEdge_complement_of_heart_diff hQ₂ hA₂ hfresh₂ hQ₂' + have hsep'_A₂ : Q₂'.G.IsSeparation A₂ B₂ := hcomp₂.isSeparation + have hle_B₂_Q₂' : B₂.toHypergraph ≤ Q₂'.G.toHypergraph := + hsep'_A₂.isSeparation.right_le + have hB₂_dom : ∀ e ∈ B₂.edgeSet, e ∈ Q₂.dom ↔ e ∈ Q₂'.dom := by + intro e heB₂ + have hEq := congrArg (e ∈ ·) hequiv_B₂.dom_eq + rw [Q₂.restrict_dom hle_B₂, Q₂'.restrict_dom hle_B₂_Q₂'] at hEq + exact ⟨fun h ↦ (hEq.mp ⟨h, heB₂⟩).1, fun h ↦ (hEq.mpr ⟨h, heB₂⟩).1⟩ + have hB₂_μ : ∀ e ∈ B₂.edgeSet, e ∈ Q₂.dom → Q₂.μ e = Q₂'.μ e := by + intro e heB₂ hd + have he'd : e ∈ (Q₂.restrict B₂).dom := by + rw [Q₂.restrict_dom hle_B₂] + exact ⟨hd, heB₂⟩ + exact hequiv_B₂.μ_eq he'd + have hB₂_Δ : ∀ e ∈ B₂.edgeSet, Q₂.Δ e = Q₂'.Δ e := by + intro e heB₂ + have h := hequiv_B₂.Δ_eq heB₂ + rwa [Q₂.restrict_Δ hle_B₂ heB₂, Q₂'.restrict_Δ hle_B₂_Q₂' heB₂] at h + have hB₂_φ : ∀ e ∈ B₂.edgeSet, Q₂.φ e ≤ Q₂'.φ e := + fun _ heB₂ ↦ (hequiv_B₂.φ_eq heB₂).le + have hfeas_sub : + (feasibleGroupings (Q₂.restrict K)).groupings ⊆ + (feasibleGroupings (Q₂'.restrict A₂)).groupings := by + have hle_K : K.toHypergraph ≤ Q₂.G.toHypergraph := + hsep_K.isSeparation.left_le + have hfeas_K : + (feasibleGroupings (Q₂.restrict K)).groupings = + (Q₂.Δ (newEdge₂ A₂)).groupings := by + ext δ + have hiff := isFeasibleGrouping_singleEdge_iff + (P' := Q₂.restrict K) (e₀ := newEdge₂ A₂) + rfl rfl + (by + ext v + exact ⟨fun h ↦ h.2, fun hv ↦ ⟨rfl, hv⟩⟩) + δ + change IsFeasibleGrouping (Q₂.restrict K) δ ↔ δ ∈ Q₂.Δ (newEdge₂ A₂) + rw [hiff] + have heK : newEdge₂ A₂ ∈ K.edgeSet := Set.mem_singleton _ + change δ ∈ (Q₂.restrict K).Δ (newEdge₂ A₂) ↔ δ ∈ Q₂.Δ (newEdge₂ A₂) + rw [Q₂.restrict_Δ hle_K heK] + have hΔ_eq : + (Q₂.Δ (newEdge₂ A₂)).groupings = + (feasibleGroupings (P₂.restrict A₂)).groupings := + congrArg GM04.Patch.groupings (hQ₂.Δ_newEdge hA₂) + have hequiv_gr : + (feasibleGroupings (P₂.restrict A₂)).groupings = + (feasibleGroupings (Q₂'.restrict A₂)).groupings := + congrArg GM04.Patch.groupings hequiv_A₂.symm.feasibleGroupings_eq + rw [hfeas_K, hΔ_eq, hequiv_gr] + have hη_edge_B₂ : ∀ e ∈ Q₁.G.edgeSet, ηe e ∈ B₂.edgeSet := by + intro e he + rw [hE₂] + exact ⟨hη.1.edge_mem e he, hhit e he⟩ + have hη_vert_B₂ : ∀ v ∈ Q₁.G.vertexSet, (ηv v ∩ B₂.vertexSet).Nonempty := by + intro v hv + rw [hV₂, Set.inter_eq_self_of_subset_left (hη.1.vertex_subset v hv)] + exact hη.1.vertex_nonempty v hv + obtain ⟨η₀v, hη₀, _⟩ := + theorem_5_3_proof hsep_K hsep'_A₂ rfl hB₂_dom hB₂_μ hB₂_Δ hB₂_φ hfeas_sub + hη hη_edge_B₂ hη_vert_B₂ + refine ih hcard' hQ₁ hQ₂' hfresh₁ hfresh₂' hη₀ ?_ ?_ + · intro e A₂' he hA₂' hEq_e + exact hpre he hA₂'.1 hEq_e + · intro A₁ hA₁ + obtain ⟨A₂', hA₂', hEq_e₂, hsim_A₁⟩ := hsim hA₁ + have hne_A₂' : A₂' ≠ A₂ := by + rintro rfl + have he₁_Q₁ : newEdge₁ A₁ ∈ Q₁.G.edgeSet := by + rw [hQ₁.edgeSet_eq]; exact Or.inr ⟨A₁, hA₁, rfl⟩ + exact hhit (newEdge₁ A₁) he₁_Q₁ hEq_e₂ + exact ⟨A₂', ⟨hA₂', hne_A₂'⟩, hEq_e₂, hsim_A₁⟩ + +/-- Injectivity of `mapInlRooted γ`. -/ +theorem mapInlRooted_injective (γ : Type*) : + Function.Injective (mapInlRooted γ : RootedHypergraph α β → RootedHypergraph α (β ⊕ γ)) := by + intro A B hEq + refine RootedHypergraph.ext ?_ (congrArg (fun G : RootedHypergraph α (β ⊕ γ) ↦ G.roots) hEq) + refine Hypergraph.ext + (congrArg (fun G : RootedHypergraph α (β ⊕ γ) ↦ G.vertexSet) hEq) ?_ ?_ + · ext e + have hE := congrArg (fun G : RootedHypergraph α (β ⊕ γ) ↦ Sum.inl e ∈ G.edgeSet) hEq + simpa [mapInlRooted, mapInlH, mapInl] using hE + · funext e v + have hI := congrArg (fun G : RootedHypergraph α (β ⊕ γ) ↦ G.Inc (Sum.inl e) v) hEq + simpa [mapInlRooted, mapInlH, mapInl] using hI + +/-- `mapInlRooted γ` maps a rooted location in `G` to a rooted location in `mapInlRooted γ G`. -/ +theorem isRootedLocation_mapInl (γ : Type*) {G : RootedHypergraph α β} + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) : + IsRootedLocation (mapInlRooted γ G) (mapInlRooted γ '' ℒ) := by + have hcomp_mapInl : ∀ {A : RootedHypergraph α β}, + IsComplemented G A → IsComplemented (mapInlRooted γ G) (mapInlRooted γ A) := by + intro A hcomp + refine + { le := + { vertexSet_subset := hcomp.le.vertexSet_subset + edgeSet_subset := Set.image_mono hcomp.le.edgeSet_subset + ends_eq := by + rintro _ ⟨e, he, rfl⟩ + exact hcomp.le.ends_eq e he } + roots_mem := hcomp.roots_mem + inc_diff_mem := by + rintro v _ hvA ⟨⟨e, heG, rfl⟩, hnotA⟩ hinc + have henotA : e ∉ A.edgeSet := fun heA ↦ hnotA ⟨e, heA, rfl⟩ + exact hcomp.inc_diff_mem hvA ⟨heG, henotA⟩ hinc } + refine + { isComplemented := by + rintro _ ⟨A, hA, rfl⟩ + exact hcomp_mapInl (hℒ.isComplemented hA) + le_complement := by + rintro _ ⟨A₁, h₁, rfl⟩ _ ⟨A₂, h₂, rfl⟩ hne + have hne_A : A₁ ≠ A₂ := fun hEq ↦ hne (congrArg (mapInlRooted γ) hEq) + have hle := hℒ.le_complement h₁ h₂ hne_A + refine + { vertexSet_subset := hle.vertexSet_subset + edgeSet_subset := by + rintro _ ⟨e, he₁, rfl⟩ + have he_comp := hle.edgeSet_subset he₁ + exact ⟨⟨e, he_comp.1, rfl⟩, fun ⟨e', he₂, hEq⟩ ↦ + he_comp.2 (Sum.inl.inj hEq ▸ he₂)⟩ + ends_eq := by + rintro _ ⟨e, he₁, rfl⟩ + have he_comp := hle.edgeSet_subset he₁ + have he_comp_inl : + Sum.inl e ∈ (mapInlRooted γ G).edgeSet \ (mapInlRooted γ A₂).edgeSet := + ⟨⟨e, he_comp.1, rfl⟩, fun ⟨_, he₂, hEq⟩ ↦ + he_comp.2 (Sum.inl.inj hEq ▸ he₂)⟩ + have hends := hle.ends_eq e he₁ + ext v + have hv : v ∈ (complement G A₂ (hℒ.isComplemented h₂)).ends e ↔ v ∈ A₁.ends e := + Set.ext_iff.1 hends v + exact ⟨fun ⟨_, hinc⟩ ↦ hv.1 ⟨he_comp, hinc⟩, + fun hinc₁ ↦ ⟨he_comp_inl, (hv.2 hinc₁).2⟩⟩ } } + +/-- The vertex set and edge set of `rootedLocationCore (mapInlRooted γ G) (mapInlRooted γ '' ℒ)`. -/ +theorem rootedLocationCore_mapInl_sets (γ : Type*) {G : RootedHypergraph α β} + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) : + (rootedLocationCore (mapInlRooted γ G) (mapInlRooted γ '' ℒ)).vertexSet = + (rootedLocationCore G ℒ).vertexSet ∧ + (rootedLocationCore (mapInlRooted γ G) (mapInlRooted γ '' ℒ)).edgeSet = + Sum.inl '' (rootedLocationCore G ℒ).edgeSet := by + have hℒ_plus := isRootedLocation_mapInl γ hℒ + refine ⟨?_, ?_⟩ + · ext v + rw [mem_rootedLocationCore_vertexSet_iff hℒ_plus, mem_rootedLocationCore_vertexSet_iff hℒ] + simp only [mapInlRooted, mapInlH, mapInl, Set.forall_mem_image] + rfl + · ext x + rw [mem_rootedLocationCore_edgeSet_iff] + simp only [mapInlRooted, mapInlH, mapInl, Set.mem_image] + constructor + · rintro ⟨⟨e, heG, rfl⟩, hall⟩ + refine ⟨e, ?_, rfl⟩ + rw [mem_rootedLocationCore_edgeSet_iff] + exact ⟨heG, fun A hA heA ↦ hall (mapInlRooted γ A) ⟨A, hA, rfl⟩ ⟨e, heA, rfl⟩⟩ + · rintro ⟨e, he_core, rfl⟩ + rw [mem_rootedLocationCore_edgeSet_iff] at he_core + refine ⟨⟨e, he_core.1, rfl⟩, ?_⟩ + rintro _ ⟨A, hA, rfl⟩ ⟨e', he'A, hEq⟩ + cases Sum.inl.inj hEq + exact he_core.2 A hA he'A + +/-- `feasibleGroupings` is preserved under `mapInlPatchwork` and `mapInlRooted`. -/ +theorem feasibleGroupings_restrict_mapInl (γ : Type*) (d : β) (P : PartialPatchwork Ω α β) + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation P.G ℒ) + {A : RootedHypergraph α β} (hA : A ∈ ℒ) : + feasibleGroupings ((mapInlPatchwork γ P).restrict (mapInlRooted γ A)) = + feasibleGroupings (P.restrict A) := by + have hleA : A.toHypergraph ≤ P.G.toHypergraph := (hℒ.isComplemented hA).le + have hleA_plus : (mapInlRooted γ A).toHypergraph ≤ (mapInlPatchwork γ P).G.toHypergraph := + ((isRootedLocation_mapInl γ hℒ).isComplemented ⟨A, hA, rfl⟩).le + exact feasibleGroupings_eq_of_edge_bij + ((mapInlPatchwork γ P).restrict (mapInlRooted γ A)).toUnlabeled + (P.restrict A).toUnlabeled + (Sum.elim id (fun _ ↦ d)) + rfl rfl + (by + ext e + simp only [Set.mem_image, mapInlRooted, mapInlH, mapInl] + exact ⟨fun ⟨_, ⟨e', he', rfl⟩, hEq⟩ ↦ hEq ▸ he', fun he ↦ ⟨Sum.inl e, ⟨e, he, rfl⟩, rfl⟩⟩) + (by rintro _ ⟨e₁, _, rfl⟩ _ ⟨e₂, _, rfl⟩ hEq; exact congrArg Sum.inl hEq) + (by + rintro _ ⟨e, heA, rfl⟩ + have heA_plus : Sum.inl e ∈ (mapInlRooted γ A).edgeSet := ⟨e, heA, rfl⟩ + change (P.restrict A).Δ e = ((mapInlPatchwork γ P).restrict (mapInlRooted γ A)).Δ (Sum.inl e) + rw [P.restrict_Δ hleA heA, (mapInlPatchwork γ P).restrict_Δ hleA_plus heA_plus] + rfl) + +private theorem placeHeart_expansion_to_original [Preorder Ω] {α β : Type*} + {P Q : PartialPatchwork Ω α β} {ℒ : Set (RootedHypergraph α β)} + {newEdge : RootedHypergraph α β → β} (hQ : IsPlaceHeart P ℒ newEdge Q) + {Q_plus : PartialPatchwork Ω α (β ⊕ RootedHypergraph α β)} + {newEdge_plus : RootedHypergraph α (β ⊕ RootedHypergraph α β) → + β ⊕ RootedHypergraph α β} + (hQ_plus : IsPlaceHeart (mapInlPatchwork (RootedHypergraph α β) P) + (mapInlRooted (RootedHypergraph α β) '' ℒ) newEdge_plus Q_plus) + (hnewEdge_eq : ∀ {A : RootedHypergraph α β}, A ∈ ℒ → + newEdge_plus (mapInlRooted (RootedHypergraph α β) A) = Sum.inr A) + : + let γ := RootedHypergraph α β + let π : β ⊕ γ → β := Sum.elim id newEdge + GM04.IsRealizableExpansion Q_plus Q (fun v ↦ {v}) π := by + classical + intro γ π + let P_plus := mapInlPatchwork γ P + let ℒ_plus := mapInlRooted γ '' ℒ + let d : β := newEdge P.G + have hcoreV : (rootedLocationCore P_plus.G ℒ_plus).vertexSet = + (rootedLocationCore P.G ℒ).vertexSet := + (rootedLocationCore_mapInl_sets γ hQ.isRootedLocation).1 + have hcoreE : (rootedLocationCore P_plus.G ℒ_plus).edgeSet = + Sum.inl '' (rootedLocationCore P.G ℒ).edgeSet := + (rootedLocationCore_mapInl_sets γ hQ.isRootedLocation).2 + refine isRealizableExpansion_of_edge_bij Q_plus Q π + (by rw [hQ_plus.vertexSet_eq, hQ.vertexSet_eq, hcoreV]) + (by rw [hQ_plus.roots_eq, hQ.roots_eq]; rfl) + ?_ ?_ ?_ ?_ ?_ ?_ ?_ + · rw [hQ_plus.edgeSet_eq, hQ.edgeSet_eq, hcoreE] + ext e + simp only [Set.mem_image, Set.mem_union] + constructor + · rintro ⟨x, ⟨e', he', rfl⟩ | ⟨_, ⟨A, hA, rfl⟩, rfl⟩, rfl⟩ + · exact Or.inl he' + · rw [hnewEdge_eq hA]; exact Or.inr ⟨A, hA, rfl⟩ + · rintro (he | ⟨A, hA, rfl⟩) + · exact ⟨Sum.inl e, Or.inl ⟨e, he, rfl⟩, rfl⟩ + · exact ⟨Sum.inr A, Or.inr ⟨mapInlRooted γ A, ⟨A, hA, rfl⟩, hnewEdge_eq hA⟩, rfl⟩ + · intro x₁ hx₁ x₂ hx₂ hEq + rw [hQ_plus.edgeSet_eq, hcoreE] at hx₁ hx₂ + rcases hx₁ with ⟨e₁, he₁, rfl⟩ | ⟨_, ⟨A₁, hA₁, rfl⟩, rfl⟩ <;> + rcases hx₂ with ⟨e₂, he₂, rfl⟩ | ⟨_, ⟨A₂, hA₂, rfl⟩, rfl⟩ + · exact congrArg Sum.inl hEq + · rw [hnewEdge_eq hA₂] at hEq + change e₁ = newEdge A₂ at hEq + exact (hQ.newEdge_notMem_core hA₂ (hEq ▸ he₁)).elim + · rw [hnewEdge_eq hA₁] at hEq + change newEdge A₁ = e₂ at hEq + exact (hQ.newEdge_notMem_core hA₁ (hEq.symm ▸ he₂)).elim + · rw [hnewEdge_eq hA₁, hnewEdge_eq hA₂] at hEq ⊢ + exact congrArg Sum.inr (hQ.injOn_newEdge hA₁ hA₂ hEq) + · intro x hx + rw [hQ_plus.edgeSet_eq, hcoreE] at hx + rcases hx with ⟨e, he, rfl⟩ | ⟨_, ⟨A, hA, rfl⟩, rfl⟩ + · have he_plus : Sum.inl e ∈ (rootedLocationCore P_plus.G ℒ_plus).edgeSet := + hcoreE ▸ ⟨e, he, rfl⟩ + dsimp only [π, Sum.elim_inl, id_eq] + rw [hQ_plus.ends_core he_plus, hQ.ends_core he] + rfl + · have h₁ := hQ_plus.ends_newEdge ⟨A, hA, rfl⟩ + rw [hnewEdge_eq hA] at h₁ ⊢ + dsimp only [π, Sum.elim_inr] + rw [h₁, hQ.ends_newEdge hA] + rfl + · intro x hx + rw [hQ_plus.edgeSet_eq, hcoreE] at hx + rw [hQ_plus.dom_eq, hQ.dom_eq, hcoreE] + rcases hx with ⟨e, he, rfl⟩ | ⟨_, ⟨A, hA, rfl⟩, rfl⟩ + · simp only [π, Sum.elim_inl, Set.mem_union, Set.mem_inter_iff, Set.mem_image] + constructor + · rintro (⟨_, ⟨_, hd, hEq⟩⟩ | ⟨_, ⟨A, hA, rfl⟩, hEq⟩) + · cases Sum.inl.inj hEq; exact Or.inl ⟨he, hd⟩ + · rw [hnewEdge_eq hA] at hEq; exact nomatch hEq + · rintro (⟨_, hd⟩ | ⟨A, hA, hEq⟩) + · exact Or.inl ⟨⟨e, he, rfl⟩, ⟨e, hd, rfl⟩⟩ + · exact (hQ.newEdge_notMem_core hA (hEq ▸ he)).elim + · rw [hnewEdge_eq hA] + simp only [π, Sum.elim_inr, Set.mem_union, Set.mem_image] + exact ⟨fun _ ↦ Or.inr ⟨A, hA, rfl⟩, + fun _ ↦ Or.inr ⟨mapInlRooted γ A, ⟨A, hA, rfl⟩, hnewEdge_eq hA⟩⟩ + · intro x hx + rw [hQ_plus.dom_eq, hcoreE] at hx + rcases hx with ⟨⟨e, he, rfl⟩, ⟨_, hd, hEq⟩⟩ | ⟨_, ⟨A, hA, rfl⟩, rfl⟩ + · cases Sum.inl.inj hEq + have he_plus : Sum.inl e ∈ (rootedLocationCore P_plus.G ℒ_plus).edgeSet := + hcoreE ▸ ⟨e, he, rfl⟩ + dsimp only [π, Sum.elim_inl, id_eq] + rw [hQ_plus.μ_core ⟨he_plus, ⟨e, hd, rfl⟩⟩, hQ.μ_core ⟨he, hd⟩] + rfl + · have h₁ := hQ_plus.μ_newEdge ⟨A, hA, rfl⟩ + rw [hnewEdge_eq hA] at h₁ ⊢ + dsimp only [π, Sum.elim_inr] + rw [h₁, hQ.μ_newEdge hA] + rfl + · intro x hx + rw [hQ_plus.dom_eq, hcoreE] at hx + rcases hx with ⟨⟨e, he, rfl⟩, ⟨_, hd, hEq⟩⟩ | ⟨_, ⟨A, hA, rfl⟩, rfl⟩ + · cases Sum.inl.inj hEq + have he_plus : Sum.inl e ∈ (rootedLocationCore P_plus.G ℒ_plus).edgeSet := + hcoreE ▸ ⟨e, he, rfl⟩ + dsimp only [π, Sum.elim_inl, id_eq] + rw [hQ_plus.Δ_core he_plus, hQ.Δ_core he] + rfl + · have h₁ := hQ_plus.Δ_newEdge ⟨A, hA, rfl⟩ + rw [hnewEdge_eq hA] at h₁ ⊢ + dsimp only [π, Sum.elim_inr] + rw [h₁, hQ.Δ_newEdge hA] + exact feasibleGroupings_restrict_mapInl γ d P hQ.isRootedLocation hA + · intro x hx + rw [hQ_plus.edgeSet_eq, hcoreE] at hx + rcases hx with ⟨e, he, rfl⟩ | ⟨_, ⟨A, hA, rfl⟩, rfl⟩ + · have he_plus : Sum.inl e ∈ (rootedLocationCore P_plus.G ℒ_plus).edgeSet := + hcoreE ▸ ⟨e, he, rfl⟩ + dsimp only [π, Sum.elim_inl, id_eq] + rw [hQ_plus.φ_core he_plus, hQ.φ_core he] + exact le_rfl + · have h₁ := hQ_plus.φ_newEdge ⟨A, hA, rfl⟩ + rw [hnewEdge_eq hA] at h₁ ⊢ + rw [h₁] + exact bot_le + +private theorem placeHeart_expansion_from_original [Preorder Ω] {α β : Type*} + {P Q : PartialPatchwork Ω α β} {ℒ : Set (RootedHypergraph α β)} + {newEdge : RootedHypergraph α β → β} (hQ : IsPlaceHeart P ℒ newEdge Q) + {Q_plus : PartialPatchwork Ω α (β ⊕ RootedHypergraph α β)} + {newEdge_plus : RootedHypergraph α (β ⊕ RootedHypergraph α β) → + β ⊕ RootedHypergraph α β} + (hQ_plus : IsPlaceHeart (mapInlPatchwork (RootedHypergraph α β) P) + (mapInlRooted (RootedHypergraph α β) '' ℒ) newEdge_plus Q_plus) + (hnewEdge_eq : ∀ {A : RootedHypergraph α β}, A ∈ ℒ → + newEdge_plus (mapInlRooted (RootedHypergraph α β) A) = Sum.inr A) + {ι : β → β ⊕ RootedHypergraph α β} + (hι_core : ∀ {e}, e ∈ (rootedLocationCore P.G ℒ).edgeSet → ι e = Sum.inl e) + (hι_new : ∀ {A}, A ∈ ℒ → ι (newEdge A) = Sum.inr A) : + GM04.IsRealizableExpansion Q Q_plus (fun v ↦ {v}) ι := by + classical + let γ := RootedHypergraph α β + let P_plus := mapInlPatchwork γ P + let ℒ_plus := mapInlRooted γ '' ℒ + let d : β := newEdge P.G + have hcoreV : (rootedLocationCore P_plus.G ℒ_plus).vertexSet = + (rootedLocationCore P.G ℒ).vertexSet := + (rootedLocationCore_mapInl_sets γ hQ.isRootedLocation).1 + have hcoreE : (rootedLocationCore P_plus.G ℒ_plus).edgeSet = + Sum.inl '' (rootedLocationCore P.G ℒ).edgeSet := + (rootedLocationCore_mapInl_sets γ hQ.isRootedLocation).2 + refine isRealizableExpansion_of_edge_bij Q Q_plus ι + (by rw [hQ.vertexSet_eq, hQ_plus.vertexSet_eq, hcoreV]) + (by rw [hQ.roots_eq, hQ_plus.roots_eq]; rfl) + ?_ ?_ ?_ ?_ ?_ ?_ ?_ + · rw [hQ.edgeSet_eq, hQ_plus.edgeSet_eq, hcoreE] + ext x + simp only [Set.mem_image, Set.mem_union] + constructor + · rintro ⟨e, he | ⟨A, hA, rfl⟩, rfl⟩ + · rw [hι_core he]; exact Or.inl ⟨e, he, rfl⟩ + · rw [hι_new hA] + exact Or.inr ⟨mapInlRooted γ A, ⟨A, hA, rfl⟩, hnewEdge_eq hA⟩ + · rintro (⟨e, he, rfl⟩ | ⟨_, ⟨A, hA, rfl⟩, rfl⟩) + · exact ⟨e, Or.inl he, hι_core he⟩ + · rw [hnewEdge_eq hA] + exact ⟨newEdge A, Or.inr ⟨A, hA, rfl⟩, hι_new hA⟩ + · intro e₁ he₁ e₂ he₂ hEq + rw [hQ.edgeSet_eq] at he₁ he₂ + rcases he₁ with he₁ | ⟨A₁, hA₁, rfl⟩ <;> rcases he₂ with he₂ | ⟨A₂, hA₂, rfl⟩ + · rw [hι_core he₁, hι_core he₂] at hEq; exact Sum.inl.inj hEq + · rw [hι_core he₁, hι_new hA₂] at hEq; exact nomatch hEq + · rw [hι_new hA₁, hι_core he₂] at hEq; exact nomatch hEq + · rw [hι_new hA₁, hι_new hA₂] at hEq + exact congrArg newEdge (Sum.inr.inj hEq) + · intro e he + rw [hQ.edgeSet_eq] at he + rcases he with he | ⟨A, hA, rfl⟩ + · rw [hι_core he] + have he_plus : Sum.inl e ∈ (rootedLocationCore P_plus.G ℒ_plus).edgeSet := + hcoreE ▸ ⟨e, he, rfl⟩ + rw [hQ.ends_core he, hQ_plus.ends_core he_plus] + rfl + · rw [hι_new hA, hQ.ends_newEdge hA] + have h₂ := hQ_plus.ends_newEdge ⟨A, hA, rfl⟩ + rw [hnewEdge_eq hA] at h₂ + rw [h₂] + rfl + · intro e he + rw [hQ.edgeSet_eq] at he + rw [hQ.dom_eq, hQ_plus.dom_eq, hcoreE] + rcases he with he | ⟨A, hA, rfl⟩ + · rw [hι_core he] + simp only [Set.mem_union, Set.mem_inter_iff, Set.mem_image] + constructor + · rintro (⟨_, hd⟩ | ⟨A, hA, hEq⟩) + · exact Or.inl ⟨⟨e, he, rfl⟩, ⟨e, hd, rfl⟩⟩ + · exact (hQ.newEdge_notMem_core hA (hEq ▸ he)).elim + · rintro (⟨_, ⟨_, hd, hEq⟩⟩ | ⟨_, ⟨A, hA, rfl⟩, hEq⟩) + · cases Sum.inl.inj hEq; exact Or.inl ⟨he, hd⟩ + · rw [hnewEdge_eq hA] at hEq; exact nomatch hEq + · rw [hι_new hA] + simp only [Set.mem_union, Set.mem_image] + exact ⟨fun _ ↦ Or.inr ⟨mapInlRooted γ A, ⟨A, hA, rfl⟩, hnewEdge_eq hA⟩, + fun _ ↦ Or.inr ⟨A, hA, rfl⟩⟩ + · intro e hd + rw [hQ.dom_eq] at hd + rcases hd with ⟨he, hd⟩ | ⟨A, hA, rfl⟩ + · rw [hι_core he] + have he_plus : Sum.inl e ∈ (rootedLocationCore P_plus.G ℒ_plus).edgeSet := + hcoreE ▸ ⟨e, he, rfl⟩ + rw [hQ.μ_core ⟨he, hd⟩, hQ_plus.μ_core ⟨he_plus, ⟨e, hd, rfl⟩⟩] + rfl + · rw [hι_new hA, hQ.μ_newEdge hA] + have h₂ := hQ_plus.μ_newEdge ⟨A, hA, rfl⟩ + rw [hnewEdge_eq hA] at h₂ + rw [h₂] + rfl + · intro e hd + rw [hQ.dom_eq] at hd + rcases hd with ⟨he, hd⟩ | ⟨A, hA, rfl⟩ + · rw [hι_core he] + have he_plus : Sum.inl e ∈ (rootedLocationCore P_plus.G ℒ_plus).edgeSet := + hcoreE ▸ ⟨e, he, rfl⟩ + rw [hQ.Δ_core he, hQ_plus.Δ_core he_plus] + rfl + · rw [hι_new hA, hQ.Δ_newEdge hA] + have h₂ := hQ_plus.Δ_newEdge ⟨A, hA, rfl⟩ + rw [hnewEdge_eq hA] at h₂ + rw [h₂] + exact (feasibleGroupings_restrict_mapInl γ d P hQ.isRootedLocation hA).symm + · intro e he + rw [hQ.edgeSet_eq] at he + rcases he with he | ⟨A, hA, rfl⟩ + · rw [hι_core he] + have he_plus : Sum.inl e ∈ (rootedLocationCore P_plus.G ℒ_plus).edgeSet := + hcoreE ▸ ⟨e, he, rfl⟩ + rw [hQ.φ_core he, hQ_plus.φ_core he_plus] + exact le_rfl + · rw [hι_new hA, hQ.φ_newEdge hA] + exact bot_le + +/-- **Graph Minors XVIII, (5.7)** (page 99): +"For $i = 1, 2$ let $(P_i, \mathcal{L}_i)$ be an $\Omega$-place with heart $Q_i$, using new +elements $e_i(A)$ ($A \in \mathcal{L}_i$). Suppose that $\eta$ is a realizable expansion of +$Q_1$ in $Q_2$ such that* - *if $e \in E(Q_1)$ and $\eta(e) = e_2(A_2)$ for some $A_2 \in +\mathcal{L}_2$ then $e = e_1(A_1)$ for some $A_1 \in \mathcal{L}_1$,* - *for each $A_1 \in +\mathcal{L}_1$ there exists $A_2 \in \mathcal{L}_2$ such that $\eta(e_1(A_1)) = e_2(A_2)$ +and $P_1|A_1$ is simulated in $P_2|A_2$.* *Then $P_1$ is simulated in $P_2$." + +The Lean version accepts partial `Ω`-places. The input patchworks and their hearts may have +unlabelled edges, with their labels represented by the bottom element of `WithBot Ω`. -/ +theorem theorem_5_7_proof [Preorder Ω] {α₁ β₁ α₂ β₂ : Type*} + {P₁ Q₁ : PartialPatchwork Ω α₁ β₁} {P₂ Q₂ : PartialPatchwork Ω α₂ β₂} + {ℒ₁ : Set (RootedHypergraph α₁ β₁)} {ℒ₂ : Set (RootedHypergraph α₂ β₂)} + {newEdge₁ : RootedHypergraph α₁ β₁ → β₁} {newEdge₂ : RootedHypergraph α₂ β₂ → β₂} + (hQ₁ : IsPlaceHeart P₁ ℒ₁ newEdge₁ Q₁) + (hQ₂ : IsPlaceHeart P₂ ℒ₂ newEdge₂ Q₂) + {ηv : α₁ → Set α₂} {ηe : β₁ → β₂} + (hη : GM04.IsRealizableExpansion Q₁ Q₂ ηv ηe) + (hpre : ∀ ⦃e : β₁⦄ ⦃A₂ : RootedHypergraph α₂ β₂⦄, + e ∈ Q₁.G.edgeSet → A₂ ∈ ℒ₂ → ηe e = newEdge₂ A₂ → ∃ A₁ ∈ ℒ₁, e = newEdge₁ A₁) + (hsim : ∀ ⦃A₁ : RootedHypergraph α₁ β₁⦄, A₁ ∈ ℒ₁ → + ∃ A₂ ∈ ℒ₂, ηe (newEdge₁ A₁) = newEdge₂ A₂ ∧ + GM04.Simulated (P₁.restrict A₁) (P₂.restrict A₂)) : + GM04.Simulated P₁ P₂ := by + classical + -- Note that `β₁` and `β₂` are inhabited by `newEdge₁ P₁.G` and `newEdge₂ P₂.G`. + let d₁ : β₁ := newEdge₁ P₁.G + let d₂ : β₂ := newEdge₂ P₂.G + let γ₁ := RootedHypergraph α₁ β₁ + let γ₂ := RootedHypergraph α₂ β₂ + let P₁_plus := mapInlPatchwork γ₁ P₁ + let P₂_plus := mapInlPatchwork γ₂ P₂ + let ℒ₁_plus := mapInlRooted γ₁ '' ℒ₁ + let ℒ₂_plus := mapInlRooted γ₂ '' ℒ₂ + let newEdge₁_plus : RootedHypergraph α₁ (β₁ ⊕ γ₁) → β₁ ⊕ γ₁ := fun B ↦ + if h : ∃ A ∈ ℒ₁, mapInlRooted γ₁ A = B then Sum.inr h.choose else Sum.inr P₁.G + let newEdge₂_plus : RootedHypergraph α₂ (β₂ ⊕ γ₂) → β₂ ⊕ γ₂ := fun B ↦ + if h : ∃ A ∈ ℒ₂, mapInlRooted γ₂ A = B then Sum.inr h.choose else Sum.inr P₂.G + have hnewEdge₁_eq : ∀ {A : RootedHypergraph α₁ β₁}, A ∈ ℒ₁ → + newEdge₁_plus (mapInlRooted γ₁ A) = Sum.inr A := by + intro A hA + have hex : ∃ A' ∈ ℒ₁, mapInlRooted γ₁ A' = mapInlRooted γ₁ A := ⟨A, hA, rfl⟩ + simp only [newEdge₁_plus, hex, ↓reduceDIte] + exact congrArg Sum.inr (mapInlRooted_injective γ₁ hex.choose_spec.2) + have hnewEdge₂_eq : ∀ {A : RootedHypergraph α₂ β₂}, A ∈ ℒ₂ → + newEdge₂_plus (mapInlRooted γ₂ A) = Sum.inr A := by + intro A hA + have hex : ∃ A' ∈ ℒ₂, mapInlRooted γ₂ A' = mapInlRooted γ₂ A := ⟨A, hA, rfl⟩ + simp only [newEdge₂_plus, hex, ↓reduceDIte] + exact congrArg Sum.inr (mapInlRooted_injective γ₂ hex.choose_spec.2) + have hℒ₁_plus : IsRootedLocation P₁_plus.G ℒ₁_plus := + isRootedLocation_mapInl γ₁ hQ₁.isRootedLocation + have hℒ₂_plus : IsRootedLocation P₂_plus.G ℒ₂_plus := + isRootedLocation_mapInl γ₂ hQ₂.isRootedLocation + have hinj₁_plus : Set.InjOn newEdge₁_plus ℒ₁_plus := by + rintro _ ⟨A, hA, rfl⟩ _ ⟨B, hB, rfl⟩ hEq + rw [hnewEdge₁_eq hA, hnewEdge₁_eq hB] at hEq + exact congrArg (mapInlRooted γ₁) (Sum.inr.inj hEq) + have hinj₂_plus : Set.InjOn newEdge₂_plus ℒ₂_plus := by + rintro _ ⟨A, hA, rfl⟩ _ ⟨B, hB, rfl⟩ hEq + rw [hnewEdge₂_eq hA, hnewEdge₂_eq hB] at hEq + exact congrArg (mapInlRooted γ₂) (Sum.inr.inj hEq) + have hfresh₁_plus : ∀ ⦃B⦄, B ∈ ℒ₁_plus → newEdge₁_plus B ∉ P₁_plus.G.edgeSet := by + rintro _ ⟨A, hA, rfl⟩ + rw [hnewEdge₁_eq hA] + rintro ⟨e, _, hEq⟩ + exact nomatch hEq + have hfresh₂_plus : ∀ ⦃B⦄, B ∈ ℒ₂_plus → newEdge₂_plus B ∉ P₂_plus.G.edgeSet := by + rintro _ ⟨A, hA, rfl⟩ + rw [hnewEdge₂_eq hA] + rintro ⟨e, _, hEq⟩ + exact nomatch hEq + have hnotMem₁_plus : ∀ ⦃B⦄, B ∈ ℒ₁_plus → + newEdge₁_plus B ∉ (rootedLocationCore P₁_plus.G ℒ₁_plus).edgeSet := + fun _ hB hc ↦ hfresh₁_plus hB (mem_rootedLocationCore_edgeSet_iff.1 hc).1 + have hnotMem₂_plus : ∀ ⦃B⦄, B ∈ ℒ₂_plus → + newEdge₂_plus B ∉ (rootedLocationCore P₂_plus.G ℒ₂_plus).edgeSet := + fun _ hB hc ↦ hfresh₂_plus hB (mem_rootedLocationCore_edgeSet_iff.1 hc).1 + let Q₁_plus := mkPlaceHeart P₁_plus hℒ₁_plus newEdge₁_plus hinj₁_plus hnotMem₁_plus + let Q₂_plus := mkPlaceHeart P₂_plus hℒ₂_plus newEdge₂_plus hinj₂_plus hnotMem₂_plus + have hQ₁_plus : IsPlaceHeart P₁_plus ℒ₁_plus newEdge₁_plus Q₁_plus := + isPlaceHeart_mkPlaceHeart P₁_plus hℒ₁_plus newEdge₁_plus hinj₁_plus hnotMem₁_plus + have hQ₂_plus : IsPlaceHeart P₂_plus ℒ₂_plus newEdge₂_plus Q₂_plus := + isPlaceHeart_mkPlaceHeart P₂_plus hℒ₂_plus newEdge₂_plus hinj₂_plus hnotMem₂_plus + let π₁ : β₁ ⊕ γ₁ → β₁ := Sum.elim id newEdge₁ + let ι₂ : β₂ → β₂ ⊕ γ₂ := fun e ↦ + if h : ∃ A ∈ ℒ₂, newEdge₂ A = e then Sum.inr h.choose else Sum.inl e + have hι₂_core : ∀ {e}, e ∈ (rootedLocationCore P₂.G ℒ₂).edgeSet → ι₂ e = Sum.inl e := by + intro e he + have hnot : ¬ ∃ A ∈ ℒ₂, newEdge₂ A = e := by + rintro ⟨A, hA, rfl⟩; exact hQ₂.newEdge_notMem_core hA he + simp only [ι₂, hnot, ↓reduceDIte] + have hι₂_new : ∀ {A}, A ∈ ℒ₂ → ι₂ (newEdge₂ A) = Sum.inr A := by + intro A hA + have hex : ∃ A' ∈ ℒ₂, newEdge₂ A' = newEdge₂ A := ⟨A, hA, rfl⟩ + simp only [ι₂, hex, ↓reduceDIte] + exact congrArg Sum.inr (hQ₂.injOn_newEdge hex.choose_spec.1 hA hex.choose_spec.2) + have hη_Q₁_plus := placeHeart_expansion_to_original hQ₁ hQ₁_plus hnewEdge₁_eq + have hη_Q₂_plus := placeHeart_expansion_from_original hQ₂ hQ₂_plus hnewEdge₂_eq + hι₂_core hι₂_new + -- Compose `Q₁_plus → Q₁ → Q₂ → Q₂_plus`. + have hη_plus := (hη_Q₁_plus.comp hη).comp hη_Q₂_plus + have hsim_plus : ∀ ⦃B₁⦄, B₁ ∈ ℒ₁_plus → + ∃ B₂ ∈ ℒ₂_plus, + GM04.compEdge (GM04.compEdge π₁ ηe) ι₂ (newEdge₁_plus B₁) = newEdge₂_plus B₂ ∧ + GM04.Simulated (P₁_plus.restrict B₁) (P₂_plus.restrict B₂) := by + rintro _ ⟨A₁, hA₁, rfl⟩ + obtain ⟨A₂, hA₂, hEq_e, hsim_A₁⟩ := hsim hA₁ + refine ⟨mapInlRooted γ₂ A₂, ⟨A₂, hA₂, rfl⟩, ?_, ?_⟩ + · rw [hnewEdge₁_eq hA₁, hnewEdge₂_eq hA₂] + simp only [GM04.compEdge_apply, π₁, Sum.elim_inr] + rw [hEq_e, hι₂_new hA₂] + · have hle₁ : A₁.toHypergraph ≤ P₁.G.toHypergraph := (hQ₁.isRootedLocation.isComplemented + hA₁).le + have hle₁_plus : (mapInlRooted γ₁ A₁).toHypergraph ≤ P₁_plus.G.toHypergraph := + (hℒ₁_plus.isComplemented ⟨A₁, hA₁, rfl⟩).le + have hle₂ : A₂.toHypergraph ≤ P₂.G.toHypergraph := (hQ₂.isRootedLocation.isComplemented + hA₂).le + have hle₂_plus : (mapInlRooted γ₂ A₂).toHypergraph ≤ P₂_plus.G.toHypergraph := + (hℒ₂_plus.isComplemented ⟨A₂, hA₂, rfl⟩).le + have hsim₁ : GM04.Simulated (P₁_plus.restrict (mapInlRooted γ₁ A₁)) (P₁.restrict A₁) := by + refine ⟨fun v ↦ {v}, Sum.elim id (fun _ ↦ d₁), + isRealizableExpansion_of_edge_bij + (P₁_plus.restrict (mapInlRooted γ₁ A₁)) (P₁.restrict A₁) + (Sum.elim id (fun _ ↦ d₁)) rfl rfl ?_ ?_ ?_ ?_ ?_ ?_ ?_⟩ + · ext e + simp only [Set.mem_image, mapInlRooted, mapInlH, mapInl] + exact ⟨fun ⟨_, ⟨e', he', rfl⟩, hEq⟩ ↦ hEq ▸ he', fun he ↦ ⟨Sum.inl e, ⟨e, he, rfl⟩, rfl⟩⟩ + · rintro _ ⟨e₁, _, rfl⟩ _ ⟨e₂, _, rfl⟩ hEq; exact congrArg Sum.inl hEq + · rintro _ ⟨e, _, rfl⟩; rfl + · rintro _ ⟨e, heA₁, rfl⟩ + rw [P₁_plus.restrict_dom hle₁_plus, P₁.restrict_dom hle₁] + simp only [P₁_plus, mapInlPatchwork, mapInlRooted, mapInlH, mapInl, Set.mem_inter_iff, + Set.mem_image, Sum.inl.injEq, exists_eq_right, Sum.elim_inl, id_eq] + · intro x hx + rw [P₁_plus.restrict_dom hle₁_plus] at hx + rcases hx with ⟨⟨e, _, rfl⟩, _⟩ + rfl + · intro x hx + rw [P₁_plus.restrict_dom hle₁_plus] at hx + rcases hx with ⟨⟨e, _, rfl⟩, ⟨_, heA₁, hEq⟩⟩ + cases Sum.inl.inj hEq + have heA₁_in : Sum.inl e ∈ (mapInlRooted γ₁ A₁).edgeSet := ⟨e, heA₁, rfl⟩ + change (P₁_plus.restrict (mapInlRooted γ₁ A₁)).Δ (Sum.inl e) = (P₁.restrict A₁).Δ e + rw [P₁_plus.restrict_Δ hle₁_plus heA₁_in, P₁.restrict_Δ hle₁ heA₁] + rfl + · rintro _ ⟨e, _, rfl⟩; exact le_rfl + have hsim₂ : GM04.Simulated (P₂.restrict A₂) (P₂_plus.restrict (mapInlRooted γ₂ A₂)) := by + refine ⟨fun v ↦ {v}, Sum.inl, + isRealizableExpansion_of_edge_bij + (P₂.restrict A₂) (P₂_plus.restrict (mapInlRooted γ₂ A₂)) + Sum.inl rfl rfl rfl (fun _ _ _ _ h ↦ Sum.inl.inj h) (fun _ _ ↦ rfl) + (fun e _ ↦ by + rw [P₂.restrict_dom hle₂, P₂_plus.restrict_dom hle₂_plus] + simp only [P₂_plus, mapInlPatchwork, mapInlRooted, mapInlH, mapInl, Set.mem_inter_iff, + Set.mem_image, Sum.inl.injEq, exists_eq_right]) + (fun _ _ ↦ rfl) + (fun e hd ↦ by + rw [P₂.restrict_dom hle₂] at hd + have heA₂_plus : Sum.inl e ∈ (mapInlRooted γ₂ A₂).edgeSet := ⟨e, hd.2, rfl⟩ + rw [P₂.restrict_Δ hle₂ hd.2, P₂_plus.restrict_Δ hle₂_plus heA₂_plus] + rfl) + (fun _ _ ↦ le_rfl)⟩ + exact (hsim₁.trans hsim_A₁).trans hsim₂ + have hpre_plus : ∀ ⦃x : β₁ ⊕ γ₁⦄ ⦃B₂ : RootedHypergraph α₂ (β₂ ⊕ γ₂)⦄, + x ∈ Q₁_plus.G.edgeSet → B₂ ∈ ℒ₂_plus → + GM04.compEdge (GM04.compEdge π₁ ηe) ι₂ x = newEdge₂_plus B₂ → + ∃ B₁ ∈ ℒ₁_plus, x = newEdge₁_plus B₁ := by + rintro x _ hx ⟨A₂, hA₂, rfl⟩ hEq + rw [hnewEdge₂_eq hA₂] at hEq + simp only [GM04.compEdge_apply] at hEq + have hπ₁_mem : π₁ x ∈ Q₁.G.edgeSet := hη_Q₁_plus.1.edge_mem x hx + have hηe_mem : ηe (π₁ x) ∈ Q₂.G.edgeSet := hη.1.edge_mem (π₁ x) hπ₁_mem + have hηe_eq : ηe (π₁ x) = newEdge₂ A₂ := by + rw [hQ₂.edgeSet_eq] at hηe_mem + rcases hηe_mem with he_core | ⟨A₂', hA₂', hEq'⟩ + · rw [hι₂_core he_core] at hEq + exact nomatch hEq + · rw [← hEq', hι₂_new hA₂'] at hEq + exact hEq'.symm.trans (congrArg newEdge₂ (Sum.inr.inj hEq)) + obtain ⟨A₁, hA₁, hπ₁_eq⟩ := hpre hπ₁_mem hA₂ hηe_eq + refine ⟨mapInlRooted γ₁ A₁, ⟨A₁, hA₁, rfl⟩, ?_⟩ + rw [hnewEdge₁_eq hA₁] + have he₁_plus : Sum.inr A₁ ∈ Q₁_plus.G.edgeSet := by + rw [hQ₁_plus.edgeSet_eq] + exact Or.inr ⟨mapInlRooted γ₁ A₁, ⟨A₁, hA₁, rfl⟩, hnewEdge₁_eq hA₁⟩ + exact hη_Q₁_plus.1.edge_injOn hx he₁_plus hπ₁_eq + have hsim_P_plus : GM04.Simulated P₁_plus P₂_plus := + theorem_5_7_of_notMem_edgeSet hQ₁_plus hQ₂_plus hfresh₁_plus hfresh₂_plus + hη_plus hpre_plus hsim_plus + have hsim_P₁ : GM04.Simulated P₁ P₁_plus := + ⟨fun v ↦ {v}, Sum.inl, + isRealizableExpansion_of_edge_bij P₁ P₁_plus Sum.inl rfl rfl rfl + (fun _ _ _ _ h ↦ Sum.inl.inj h) (fun _ _ ↦ rfl) + (fun e _ ↦ ⟨fun hd ↦ ⟨e, hd, rfl⟩, fun ⟨_, hd, hEq⟩ ↦ Sum.inl.inj hEq ▸ hd⟩) + (fun _ _ ↦ rfl) (fun _ _ ↦ rfl) (fun _ _ ↦ le_rfl)⟩ + have hsim_P₂ : GM04.Simulated P₂_plus P₂ := by + refine ⟨fun v ↦ {v}, Sum.elim id (fun _ ↦ d₂), + isRealizableExpansion_of_edge_bij P₂_plus P₂ (Sum.elim id (fun _ ↦ d₂)) rfl rfl ?_ ?_ + ?_ ?_ ?_ ?_ ?_⟩ + · ext e + simp only [Set.mem_image, P₂_plus, mapInlPatchwork, mapInlRooted, mapInlH, mapInl] + exact ⟨fun ⟨_, ⟨e', he', rfl⟩, hEq⟩ ↦ hEq ▸ he', fun he ↦ ⟨Sum.inl e, ⟨e, he, rfl⟩, rfl⟩⟩ + · rintro _ ⟨e₁, _, rfl⟩ _ ⟨e₂, _, rfl⟩ hEq; exact congrArg Sum.inl hEq + · rintro _ ⟨e, _, rfl⟩; rfl + · rintro _ ⟨e, _, rfl⟩ + simp only [P₂_plus, mapInlPatchwork, Set.mem_image, Sum.inl.injEq, exists_eq_right, + Sum.elim_inl, id_eq] + · rintro _ ⟨e, _, rfl⟩; rfl + · rintro _ ⟨e, _, rfl⟩; rfl + · rintro _ ⟨e, _, rfl⟩; exact le_rfl + exact (hsim_P₁.trans hsim_P_plus).trans hsim_P₂ + +end GraphMinor.GM18 +end diff --git a/LeanPool/GraphMinor/GM18/Section5Part1.lean b/LeanPool/GraphMinor/GM18/Section5Part1.lean new file mode 100644 index 0000000000..2e5449b11a --- /dev/null +++ b/LeanPool/GraphMinor/GM18/Section5Part1.lean @@ -0,0 +1,1633 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Patchwork.Stars +public import LeanPool.GraphMinor.GM18.Section4 +import LeanPool.GraphMinor.GM04.Patchwork.Menger + +/-! +# Graph Minors XVIII, Section 5 (Part 1): Patchworks, Feasible Groupings, and Hearts + +This file formalizes the first part of Section 5 (pages 89–95) of Robertson and Seymour, +*Graph Minors. XVIII. Tree-decompositions and well-quasi-ordering*, J. Combin. Theory Ser. B 89 +(2003) 77–108: + +* `theorem_5_1_proof` (5.1, page 91, with Claim (1) `lemma_5_1_claim_1`): gluing realizations + across a common separation `(Gᵢ', G₀)` preserves connectivity on `V(G₀)` when connectivity on + `πBar(G₁') = πBar(G₂')` agrees and the patches on `G₀` agree. +* `theorem_5_2_proof` (5.2, page 92): inclusion of feasible groupings and agreement on the patches + of `G₀` transport realizations while preserving connectivity on `V(G₀)`. +* `theorem_5_3_proof` (5.3, page 92): a realizable labelled expansion into `P₁` with edge images + in `G₀` and vertex images meeting `V(G₀)` gives an expansion into `P₂` with the same edge + map and the same intersection with `V(G₀)`. The shared edge labels satisfy a pointwise bound. +* `theorem_5_4` (5.4, page 93, with Claim (1) `lemma_5_4_claim_1`): for a patchwork `P`, rooted + location `ℒ`, and heart `P' = P | ℒ`, + `V(G) \ πBar(G) = (V(G') \ πBar(G')) ∪ ⋃_{A ∈ ℒ} (V(A) \ πBar(A))` and `gr(P) = gr(P')`. +-/ + +public section + +namespace GraphMinor.GM18 + +open Hypergraph SimpleGraph + +universe u v w + +variable {α : Type u} {β : Type v} {Ω : Type w} + +/-! ## Basic equivalences for `ConnectedIn` and `GM04.sameComponent` -/ + +theorem connectedIn_iff {K : (⊤ : SimpleGraph α).Subgraph} {p q : α} : + ConnectedIn K p q ↔ + ∃ (hp : p ∈ K.verts) (hq : q ∈ K.verts), K.coe.Reachable ⟨p, hp⟩ ⟨q, hq⟩ := by + constructor + · rintro ⟨D, hD, hp, hq⟩ + obtain ⟨x, rfl⟩ := hD + rw [GM04.component_verts, GM04.mem_componentVerts_iff] at hp hq + exact ⟨hp.1, hq.1, hp.2.symm.trans hq.2⟩ + · rintro ⟨hp, hq, hr⟩ + refine ⟨GM04.component K ⟨p, hp⟩, ⟨⟨p, hp⟩, rfl⟩, + GM04.self_mem_componentVerts K ⟨p, hp⟩, ?_⟩ + rw [GM04.component_verts, GM04.mem_componentVerts_iff] + exact ⟨hq, hr⟩ + +theorem connectedIn_iff_sameComponent {H : (⊤ : SimpleGraph α).Subgraph} {x y : α} : + ConnectedIn H x y ↔ GM04.sameComponent H x y := + connectedIn_iff.trans GM04.sameComponent_iff.symm + +theorem ConnectedIn.refl {H : (⊤ : SimpleGraph α).Subgraph} {x : α} (hx : x ∈ H.verts) : + ConnectedIn H x x := + connectedIn_iff.2 ⟨hx, hx, Reachable.refl (⟨x, hx⟩ : H.verts)⟩ + +theorem ConnectedIn.symm {H : (⊤ : SimpleGraph α).Subgraph} {x y : α} + (h : ConnectedIn H x y) : ConnectedIn H y x := + connectedIn_iff_sameComponent.2 (GM04.sameComponent.symm (connectedIn_iff_sameComponent.1 h)) + +theorem ConnectedIn.trans {H : (⊤ : SimpleGraph α).Subgraph} {x y z : α} + (hxy : ConnectedIn H x y) (hyz : ConnectedIn H y z) : ConnectedIn H x z := + connectedIn_iff_sameComponent.2 + (GM04.sameComponent.trans (connectedIn_iff_sameComponent.1 hxy) + (connectedIn_iff_sameComponent.1 hyz)) + +theorem ConnectedIn.mono {H₁ H₂ : (⊤ : SimpleGraph α).Subgraph} (hle : H₁ ≤ H₂) {x y : α} + (h : ConnectedIn H₁ x y) : ConnectedIn H₂ x y := + connectedIn_iff_sameComponent.2 + (GM04.sameComponent.mono hle (connectedIn_iff_sameComponent.1 h)) + +theorem connectedIn_of_adj {H : (⊤ : SimpleGraph α).Subgraph} {x y : α} (h : H.Adj x y) : + ConnectedIn H x y := + connectedIn_iff_sameComponent.2 (GM04.sameComponent_of_adj h) + +theorem ConnectedIn.verts_left {H : (⊤ : SimpleGraph α).Subgraph} {x y : α} + (h : ConnectedIn H x y) : x ∈ H.verts := + (connectedIn_iff.1 h).1 + +theorem ConnectedIn.verts_right {H : (⊤ : SimpleGraph α).Subgraph} {x y : α} + (h : ConnectedIn H x y) : y ∈ H.verts := + (connectedIn_iff.1 h).2.1 + +theorem rootSet_subset (G : RootedHypergraph α β) : G.rootSet ⊆ G.vertexSet := + fun v hv ↦ G.roots_subset v hv + +/-! ## Realizations and separations -/ + +private theorem emptySubgraph_sup_emptySubgraph (X Y : Set α) : + GM04.emptySubgraph X ⊔ GM04.emptySubgraph Y = GM04.emptySubgraph (X ∪ Y) := by + ext v w + · rfl + · simp [GM04.emptySubgraph] + +/-- If `(G', G₀)` is a separation of `P.G`, then the union `H₀ ⊔ H'` of a realization `H₀` of +`P | G₀` and a realization `H'` of `P | G'` is a realization of `P`. -/ +theorem isRealization_sup_of_isSeparation {P : GM04.Patchwork Ω α β} + {G' G₀ : RootedHypergraph α β} (hsep : P.G.IsSeparation G' G₀) + {H₀ H' : (⊤ : SimpleGraph α).Subgraph} + (hH₀ : (P.restrict G₀).IsRealization H₀) + (hH' : (P.restrict G').IsRealization H') : + P.IsRealization (H₀ ⊔ H') := by + classical + obtain ⟨δ₀, hδ₀, rfl⟩ := hH₀ + obtain ⟨δ', hδ', rfl⟩ := hH' + have hle' := hsep.isSeparation.left_le + have hle₀ := hsep.isSeparation.right_le + have hdisjE := GM04.isSeparation_disjoint_edgeSet hsep.isSeparation + let δ : β → (⊤ : SimpleGraph α).Subgraph := + fun e ↦ if e ∈ G'.edgeSet then δ' e else δ₀ e + have he_or : ∀ e ∈ P.G.edgeSet, e ∈ G'.edgeSet ∨ (e ∈ G₀.edgeSet ∧ e ∉ G'.edgeSet) := by + intro e he + by_cases he' : e ∈ G'.edgeSet + · exact Or.inl he' + · rw [← GM04.isSeparation_edgeSet_union hsep.isSeparation] at he + rcases he with he'_abs | he₀ + · exact (he' he'_abs).elim + · exact Or.inr ⟨he₀, he'⟩ + refine ⟨δ, fun e he ↦ ?_, ?_⟩ + · rcases he_or e he with he' | ⟨he₀, hne'⟩ + · simp only [δ, he', ↓reduceIte] + have hmem := hδ' e he' + change δ' e ∈ (P.restrict G').Δ e at hmem + rwa [P.restrict_Δ hle' he'] at hmem + · simp only [δ, hne', ↓reduceIte] + have hmem := hδ₀ e he₀ + change δ₀ e ∈ (P.restrict G₀).Δ e at hmem + rwa [P.restrict_Δ hle₀ he₀] at hmem + · change (GM04.emptySubgraph G₀.vertexSet ⊔ ⨆ e ∈ G₀.edgeSet, δ₀ e) ⊔ + (GM04.emptySubgraph G'.vertexSet ⊔ ⨆ e ∈ G'.edgeSet, δ' e) = + GM04.emptySubgraph P.G.vertexSet ⊔ ⨆ e ∈ P.G.edgeSet, δ e + rw [sup_sup_sup_comm, emptySubgraph_sup_emptySubgraph, Set.union_comm G₀.vertexSet, + GM04.isSeparation_vertexSet_union hsep.isSeparation] + congr 1 + apply le_antisymm + · refine sup_le (iSup₂_le fun e he₀ ↦ ?_) (iSup₂_le fun e he' ↦ ?_) + · have hne' : e ∉ G'.edgeSet := fun h ↦ Set.disjoint_left.1 hdisjE h he₀ + have hδ_eq : δ₀ e = δ e := by simp [δ, hne'] + rw [hδ_eq] + exact le_biSup δ (hle₀.edgeSet_subset he₀) + · have hδ_eq : δ' e = δ e := by simp [δ, he'] + rw [hδ_eq] + exact le_biSup δ (hle'.edgeSet_subset he') + · refine iSup₂_le fun e he ↦ ?_ + rcases he_or e he with he' | ⟨he₀, hne'⟩ + · have hδ_eq : δ e = δ' e := by simp [δ, he'] + rw [hδ_eq] + exact le_sup_of_le_right (le_biSup δ' he') + · have hδ_eq : δ e = δ₀ e := by simp [δ, hne'] + rw [hδ_eq] + exact le_sup_of_le_left (le_biSup δ₀ he₀) + +/-- Conversely, every realization `H` of `P` splits across a separation `(G', G₀)` of `P.G` as +`H = H₀ ⊔ H'` where `H₀` is a realization of `P | G₀` and `H'` is a realization of `P | G'`. -/ +theorem exists_isRealization_split_of_isSeparation {P : GM04.Patchwork Ω α β} + {G' G₀ : RootedHypergraph α β} (hsep : P.G.IsSeparation G' G₀) + {H : (⊤ : SimpleGraph α).Subgraph} (hH : P.IsRealization H) : + ∃ H₀ H' : (⊤ : SimpleGraph α).Subgraph, + (P.restrict G₀).IsRealization H₀ ∧ + (P.restrict G').IsRealization H' ∧ + H = H₀ ⊔ H' := by + obtain ⟨δ, hδ, rfl⟩ := hH + have hle' := hsep.isSeparation.left_le + have hle₀ := hsep.isSeparation.right_le + let H₀ := GM04.realizationOf G₀.toHypergraph δ + let H' := GM04.realizationOf G'.toHypergraph δ + have hH₀ : (P.restrict G₀).IsRealization H₀ := by + refine ⟨δ, fun e he ↦ ?_, rfl⟩ + change δ e ∈ ((P.restrict G₀).Δ e).groupings + rw [P.restrict_Δ hle₀ he] + exact hδ e (hle₀.edgeSet_subset he) + have hH' : (P.restrict G').IsRealization H' := by + refine ⟨δ, fun e he ↦ ?_, rfl⟩ + change δ e ∈ ((P.restrict G').Δ e).groupings + rw [P.restrict_Δ hle' he] + exact hδ e (hle'.edgeSet_subset he) + refine ⟨H₀, H', hH₀, hH', ?_⟩ + change GM04.emptySubgraph P.G.vertexSet ⊔ (⨆ e ∈ P.G.edgeSet, δ e) = + (GM04.emptySubgraph G₀.vertexSet ⊔ ⨆ e ∈ G₀.edgeSet, δ e) ⊔ + (GM04.emptySubgraph G'.vertexSet ⊔ ⨆ e ∈ G'.edgeSet, δ e) + rw [sup_sup_sup_comm, emptySubgraph_sup_emptySubgraph, Set.union_comm G₀.vertexSet, + GM04.isSeparation_vertexSet_union hsep.isSeparation] + congr 1 + apply le_antisymm + · refine iSup₂_le fun e he ↦ ?_ + rw [← GM04.isSeparation_edgeSet_union hsep.isSeparation] at he + rcases he with he' | he₀ + · exact le_sup_of_le_right (le_biSup δ he') + · exact le_sup_of_le_left (le_biSup δ he₀) + · exact sup_le + (iSup₂_le fun e he₀ ↦ le_biSup δ (hle₀.edgeSet_subset he₀)) + (iSup₂_le fun e he' ↦ le_biSup δ (hle'.edgeSet_subset he')) + +/-! ## (5.1), (5.2), and (5.3) -/ + +/-- **Claim (1)** in the proof of Graph Minors XVIII, (5.1) (page 91): +Any walk in `H₀ ⊔ H₁'` between two vertices `x, y ∈ V(G₀)` connects `x` and `y` in `H₀ ⊔ H₂'`, +provided `H₁'` and `H₂'` induce the same connectivity on `πBar(G₁') = πBar(G₂')`. +We prove this by induction on the walk in `H₀ ⊔ H₁'`: each maximal segment outside `E(H₀)` starts +and ends in `V(G₀) ∩ V(G₁') = πBar(G₁')` and lies in `H₁'`. -/ +theorem lemma_5_1_claim_1 {P₁ P₂ : GM04.Patchwork Ω α β} + {G₁' G₂' G₀ : RootedHypergraph α β} + (hsep₁ : P₁.G.IsSeparation G₁' G₀) + {H₀ H₁' H₂' : (⊤ : SimpleGraph α).Subgraph} + (hH₀ : (P₁.restrict G₀).IsRealization H₀) + (hH₁' : (P₁.restrict G₁').IsRealization H₁') + (hH₂' : (P₂.restrict G₂').IsRealization H₂') + (hconn' : ∀ x ∈ G₁'.rootSet, ∀ y ∈ G₁'.rootSet, + ConnectedIn H₁' x y ↔ ConnectedIn H₂' x y) + {x y : α} (hx : x ∈ G₀.vertexSet) (hy : y ∈ G₀.vertexSet) + (hxy : ConnectedIn (H₀ ⊔ H₁') x y) : + ConnectedIn (H₀ ⊔ H₂') x y := by + have hV₀ : H₀.verts = G₀.vertexSet := hH₀.verts_eq + have hV₁' : H₁'.verts = G₁'.vertexSet := hH₁'.verts_eq + have hV₂' : H₂'.verts = G₂'.vertexSet := hH₂'.verts_eq + have hH₂_verts : (H₀ ⊔ H₂').verts = G₀.vertexSet ∪ G₂'.vertexSet := by + change H₀.verts ∪ H₂'.verts = _ + rw [hV₀, hV₂'] + obtain ⟨hx₁, hy₁, ⟨w⟩⟩ := connectedIn_iff.1 hxy + -- Generalize to any walk `w` in `(H₀ ⊔ H₁').coe` ending at `y ∈ V(G₀)` from any `u`: + -- if `u ∈ V(G₀)`, then `ConnectedIn (H₀ ⊔ H₂') u y`; if `u ∈ V(G₁')`, and `z ∈ V(G₀) ∩ V(G₁')` + -- is connected to `u` in `H₁'`, then `ConnectedIn (H₀ ⊔ H₂') z y`. + suffices hwalk : ∀ (u v : (H₀ ⊔ H₁').verts) (p : (H₀ ⊔ H₁').coe.Walk u v), + v.1 ∈ G₀.vertexSet → + (u.1 ∈ G₀.vertexSet → ConnectedIn (H₀ ⊔ H₂') u.1 v.1) ∧ + (∀ z ∈ G₁'.rootSet, ConnectedIn H₁' z u.1 → ConnectedIn (H₀ ⊔ H₂') z v.1) from + (hwalk ⟨x, hx₁⟩ ⟨y, hy₁⟩ w hy).1 hx + intro u v p + induction p with + | @nil a => + intro ha₀ + have ha_H₂ : a.1 ∈ (H₀ ⊔ H₂').verts := hH₂_verts.symm ▸ Or.inl ha₀ + refine ⟨fun _ ↦ ConnectedIn.refl ha_H₂, fun z hz hzu ↦ ?_⟩ + have ha₁' : a.1 ∈ G₁'.vertexSet := hV₁' ▸ hzu.verts_right + have ha_root : a.1 ∈ G₁'.rootSet := by + rw [hsep₁.rootSet_left] + exact ⟨ha₁', ha₀⟩ + exact ((hconn' z hz a.1 ha_root).1 hzu).mono le_sup_right + | @cons a b c hab q ih => + intro hc₀ + have ⟨ih_G₀, ih_root⟩ := ih hc₀ + have hab' : H₀.Adj a.1 b.1 ∨ H₁'.Adj a.1 b.1 := Subgraph.sup_adj.1 hab + rcases hab' with hab₀ | hab₁' + · -- The step from `a` to `b` is an edge of `H₀`, so both `a` and `b` lie in `V(G₀)`. + have ha₀ : a.1 ∈ G₀.vertexSet := hV₀ ▸ H₀.edge_vert hab₀ + have hb₀ : b.1 ∈ G₀.vertexSet := hV₀ ▸ H₀.edge_vert hab₀.symm + have hab_H₂ : ConnectedIn (H₀ ⊔ H₂') a.1 b.1 := + (connectedIn_of_adj hab₀).mono le_sup_left + have hbc_H₂ : ConnectedIn (H₀ ⊔ H₂') b.1 c.1 := ih_G₀ hb₀ + have hac_H₂ : ConnectedIn (H₀ ⊔ H₂') a.1 c.1 := hab_H₂.trans hbc_H₂ + refine ⟨fun _ ↦ hac_H₂, fun z hz hza ↦ ?_⟩ + have ha₁' : a.1 ∈ G₁'.vertexSet := hV₁' ▸ hza.verts_right + have ha_root : a.1 ∈ G₁'.rootSet := by + rw [hsep₁.rootSet_left] + exact ⟨ha₁', ha₀⟩ + have hza_H₂ : ConnectedIn (H₀ ⊔ H₂') z a.1 := + ((hconn' z hz a.1 ha_root).1 hza).mono le_sup_right + exact hza_H₂.trans hac_H₂ + · -- The step from `a` to `b` is an edge of `H₁'`. + have ha₁' : a.1 ∈ G₁'.vertexSet := hV₁' ▸ H₁'.edge_vert hab₁' + have hab_conn : ConnectedIn H₁' a.1 b.1 := connectedIn_of_adj hab₁' + refine ⟨fun ha₀ ↦ ?_, fun z hz hza ↦ ih_root z hz (hza.trans hab_conn)⟩ + have ha_root : a.1 ∈ G₁'.rootSet := by + rw [hsep₁.rootSet_left] + exact ⟨ha₁', ha₀⟩ + exact ih_root a.1 ha_root hab_conn + +/-- **Graph Minors XVIII, (5.1)** (page 91): +"For $i = 1, 2$ let $P_i = (G_i, \mu_i, \Delta_i)$ be a patchwork, and let $(G_i', G_0)$ be a +separation of $G_i$. Let $\pi(G_1') = \pi(G_2')$, and let $P_1|G_0 = P_2|G_0$. For $i = 1, +2$ let $H_i'$ be a realization of $P_i|G_i'$, such that for $x, y \in \bar{\pi}(G_1') = +\bar{\pi}(G_2')$, $x$ and $y$ are connected in $H_1'$ if and only if they are connected in +$H_2'$. Let $H_0$ be a realization of $P_1|G_0 = P_2|G_0$, and let $H_i = H_0 \cup H_i'$ ($i += 1, 2$). Then for $i = 1, 2, H_i$ is a realization of $P_i$, and for $x, y \in V(G_0)$, $x$ +and $y$ are connected in $H_1$ if and only if they are connected in $H_2$." + +The Lean version assumes equality of the patches `Δ e` on each edge of the common piece `G₀`. +The printed statement assumes equality of the entire restricted patchworks there. -/ +theorem theorem_5_1_proof {P₁ P₂ : GM04.Patchwork Ω α β} + {G₁' G₂' G₀ : RootedHypergraph α β} + (hsep₁ : P₁.G.IsSeparation G₁' G₀) + (hsep₂ : P₂.G.IsSeparation G₂' G₀) + (hroots : G₁'.roots = G₂'.roots) + (hG₀ : ∀ e ∈ G₀.edgeSet, (P₁.restrict G₀).Δ e = (P₂.restrict G₀).Δ e) + {H₀ H₁' H₂' : (⊤ : SimpleGraph α).Subgraph} + (hH₀ : (P₁.restrict G₀).IsRealization H₀) + (hH₁' : (P₁.restrict G₁').IsRealization H₁') + (hH₂' : (P₂.restrict G₂').IsRealization H₂') + (hconn' : ∀ x ∈ G₁'.rootSet, ∀ y ∈ G₁'.rootSet, + ConnectedIn H₁' x y ↔ ConnectedIn H₂' x y) : + P₁.IsRealization (H₀ ⊔ H₁') ∧ + P₂.IsRealization (H₀ ⊔ H₂') ∧ + ∀ x ∈ G₀.vertexSet, ∀ y ∈ G₀.vertexSet, + ConnectedIn (H₀ ⊔ H₁') x y ↔ ConnectedIn (H₀ ⊔ H₂') x y := by + have hrootSet : G₁'.rootSet = G₂'.rootSet := by + ext v + simp [RootedHypergraph.rootSet, hroots] + have hH₀₂ : (P₂.restrict G₀).IsRealization H₀ := by + obtain ⟨δ₀, hδ₀, rfl⟩ := hH₀ + refine ⟨δ₀, fun e he ↦ ?_, rfl⟩ + change δ₀ e ∈ ((P₂.restrict G₀).Δ e).groupings + rw [← hG₀ e he] + exact hδ₀ e he + refine ⟨isRealization_sup_of_isSeparation hsep₁ hH₀ hH₁', + isRealization_sup_of_isSeparation hsep₂ hH₀₂ hH₂', + fun x hx y hy ↦ ⟨lemma_5_1_claim_1 hsep₁ hH₀ hH₁' hH₂' hconn' hx hy, + lemma_5_1_claim_1 hsep₂ hH₀₂ hH₂' hH₁' + (fun a ha b hb ↦ (hconn' a (hrootSet.symm ▸ ha) b (hrootSet.symm ▸ hb)).symm) hx hy⟩⟩ + +/-- From any realization `H` of `P`, the induced connectivity on `πBar(G)` is a feasible grouping in +`P`. -/ +theorem exists_isFeasibleGrouping_of_isRealization {P : GM04.Patchwork Ω α β} + {H : (⊤ : SimpleGraph α).Subgraph} (hH : P.IsRealization H) : + ∃ K ∈ feasibleGroupings P, + ∀ x ∈ P.G.rootSet, ∀ y ∈ P.G.rootSet, x ≠ y → (ConnectedIn H x y ↔ K.Adj x y) := by + let K : (⊤ : SimpleGraph α).Subgraph := + { verts := P.G.rootSet + Adj x y := x ∈ P.G.rootSet ∧ y ∈ P.G.rootSet ∧ x ≠ y ∧ ConnectedIn H x y + adj_sub h := h.2.2.1 + edge_vert h := h.1 + symm := ⟨fun _ _ ⟨hx, hy, hne, hconn⟩ ↦ ⟨hy, hx, hne.symm, hconn.symm⟩⟩ } + have hgrp : GM04.IsGrouping P.G.rootSet K := by + rw [GM04.isGrouping_iff] + refine ⟨subset_rfl, fun a b c hac ⟨ha, _, _, hab⟩ ⟨_, hc, _, hbc⟩ ↦ + ⟨ha, hc, hac, hab.trans hbc⟩⟩ + have hfeas : IsFeasibleGrouping P K := + ⟨hgrp, rfl, H, hH, fun x hx y hy hne ↦ ⟨fun h ↦ ⟨hx, hy, hne, h⟩, fun h ↦ h.2.2.2⟩⟩ + exact ⟨K, hfeas, fun x hx y hy hne ↦ ⟨fun h ↦ ⟨hx, hy, hne, h⟩, fun h ↦ h.2.2.2⟩⟩ + +/-- **Graph Minors XVIII, (5.2)** (page 92): +"For $i = 1, 2$ let $P_i = (G_i, \mu_i, \Delta_i)$ be a patchwork, and let $(G_i', G_0)$ be a +separation of $G_i$, such that $\pi(G_1') = \pi(G_2')$, $P_1|G_0 = P_2|G_0$, and +$gr(P_1|G_1') \subseteq gr(P_2|G_2')$. Then for every realization $H_1$ of $P_1$ there is a +realization $H_2$ of $P_2$ such that for $x, y \in V(G_0)$, $x$ and $y$ are connected in +$H_1$ if and only if they are connected in $H_2$." + +As in the Lean version of (5.1), the common-piece hypothesis compares the patches `Δ e` on +each edge of `G₀`. -/ +theorem theorem_5_2_proof {P₁ P₂ : GM04.Patchwork Ω α β} + {G₁' G₂' G₀ : RootedHypergraph α β} + (hsep₁ : P₁.G.IsSeparation G₁' G₀) + (hsep₂ : P₂.G.IsSeparation G₂' G₀) + (hroots : G₁'.roots = G₂'.roots) + (hG₀ : ∀ e ∈ G₀.edgeSet, (P₁.restrict G₀).Δ e = (P₂.restrict G₀).Δ e) + (hgr : (feasibleGroupings (P₁.restrict G₁')).groupings ⊆ + (feasibleGroupings (P₂.restrict G₂')).groupings) + {H₁ : (⊤ : SimpleGraph α).Subgraph} (hH₁ : P₁.IsRealization H₁) : + ∃ H₂ : (⊤ : SimpleGraph α).Subgraph, + P₂.IsRealization H₂ ∧ + ∀ x ∈ G₀.vertexSet, ∀ y ∈ G₀.vertexSet, + ConnectedIn H₁ x y ↔ ConnectedIn H₂ x y := by + obtain ⟨H₀, H₁', hH₀, hH₁', rfl⟩ := exists_isRealization_split_of_isSeparation hsep₁ hH₁ + obtain ⟨K, hK₁, hK_adj⟩ := exists_isFeasibleGrouping_of_isRealization hH₁' + have hK₂ : IsFeasibleGrouping (P₂.restrict G₂') K := hgr hK₁ + obtain ⟨_, _, H₂', hH₂', hH₂'_adj⟩ := hK₂ + have hrootSet : G₁'.rootSet = G₂'.rootSet := by + ext v + simp [RootedHypergraph.rootSet, hroots] + have hconn' : ∀ x ∈ G₁'.rootSet, ∀ y ∈ G₁'.rootSet, + ConnectedIn H₁' x y ↔ ConnectedIn H₂' x y := by + intro x hx y hy + by_cases hne : x = y + · subst hne + have hx₁ : x ∈ H₁'.verts := + hH₁'.verts_eq.symm ▸ rootSet_subset G₁' hx + have hx₂ : x ∈ H₂'.verts := + hH₂'.verts_eq.symm ▸ rootSet_subset G₂' (hrootSet ▸ hx) + exact ⟨fun _ ↦ ConnectedIn.refl hx₂, fun _ ↦ ConnectedIn.refl hx₁⟩ + · exact (hK_adj x hx y hy hne).trans + (hH₂'_adj x (hrootSet ▸ hx) y (hrootSet ▸ hy) hne).symm + have ⟨_, hH₂, hconn⟩ := theorem_5_1_proof hsep₁ hsep₂ hroots hG₀ hH₀ hH₁' hH₂' hconn' + exact ⟨H₀ ⊔ H₂', hH₂, hconn⟩ + +private theorem separation_delete_right_edges {P : GM04.Patchwork Ω α β} + {L R : RootedHypergraph α β} (hsep : P.G.IsSeparation L R) + {F : Set β} (hF_sub : F ⊆ R.edgeSet) : + (P.deleteEdges F).G.IsSeparation L (R.deleteEdges F) := by + have hL := hsep.isSeparation.left_le + have hR := hsep.isSeparation.right_le + have hdisjoint := GM04.isSeparation_disjoint_edgeSet hsep.isSeparation + refine ⟨⟨⟨hL.vertexSet_subset, ?_, ?_⟩, + ⟨hR.vertexSet_subset, Set.sdiff_subset_sdiff hR.edgeSet_subset subset_rfl, ?_⟩, + ?_, ?_⟩, hsep.roots_right, hsep.rootSet_left⟩ + · intro e he + exact ⟨hL.edgeSet_subset he, fun hF ↦ Set.disjoint_left.1 hdisjoint he (hF_sub hF)⟩ + · intro e he + ext v + change (P.G.Inc e v ∧ e ∉ F) ↔ L.Inc e v + have hneF : e ∉ F := fun hF ↦ Set.disjoint_left.1 hdisjoint he (hF_sub hF) + exact ⟨fun h ↦ (GM10.inc_iff_of_le hL he).2 h.1, + fun h ↦ ⟨(GM10.inc_iff_of_le hL he).1 h, hneF⟩⟩ + · intro e he + ext v + change (P.G.Inc e v ∧ e ∉ F) ↔ (R.Inc e v ∧ e ∉ F) + exact and_congr_left fun _ ↦ (GM10.inc_iff_of_le hR he.1).symm + · apply Hypergraph.ext (GM04.isSeparation_vertexSet_union hsep.isSeparation) + · ext e + change e ∈ L.edgeSet ∨ (e ∈ R.edgeSet ∧ e ∉ F) ↔ e ∈ P.G.edgeSet ∧ e ∉ F + rw [← GM04.isSeparation_edgeSet_union hsep.isSeparation] + simp only [Set.mem_union] + constructor + · rintro (he₁' | ⟨he₀, hneF⟩) + · exact ⟨Or.inl he₁', fun hF ↦ Set.disjoint_left.1 hdisjoint he₁' (hF_sub hF)⟩ + · exact ⟨Or.inr he₀, hneF⟩ + · rintro ⟨he₁' | he₀, hneF⟩ + · exact Or.inl he₁' + · exact Or.inr ⟨he₀, hneF⟩ + · ext e v + change (L.Inc e v ∨ (R.Inc e v ∧ e ∉ F)) ↔ (P.G.Inc e v ∧ e ∉ F) + constructor + · rintro (h₁ | ⟨h₀, hneF⟩) + · have he₁' : e ∈ L.edgeSet := L.edge_mem_of_inc h₁ + exact ⟨GM10.inc_of_le hL h₁, + fun hF ↦ Set.disjoint_left.1 hdisjoint he₁' (hF_sub hF)⟩ + · exact ⟨GM10.inc_of_le hR h₀, hneF⟩ + · rintro ⟨hP, hneF⟩ + have he : e ∈ L.edgeSet ∪ R.edgeSet := by + rw [GM04.isSeparation_edgeSet_union hsep.isSeparation] + exact P.G.edge_mem_of_inc hP + rcases he with he₁' | he₀ + · exact Or.inl ((GM10.inc_iff_of_le hL he₁').2 hP) + · exact Or.inr ⟨(GM10.inc_iff_of_le hR he₀).2 hP, hneF⟩ + · ext e + change e ∈ L.edgeSet ∧ (e ∈ R.edgeSet ∧ e ∉ F) ↔ False + simp only [iff_false, not_and] + intro he₁' he₀ _ + exact Set.disjoint_left.1 hdisjoint he₁' he₀ + +/-- **Graph Minors XVIII, (5.3)** (page 92): +"For $i = 1, 2$ let $P_i = (G_i, \mu_i, \Delta_i)$ be a patchwork, and let $(G_i', G_0)$ be a +separation of $G_i$, such that $\pi(G_1') = \pi(G_2')$, $P_1|G_0 = P_2|G_0$, and +$gr(P_1|G_1') \subseteq gr(P_2|G_2')$. Let $\eta_1$ be a realizable expansion of some +patchwork $P = (G, \mu, \Delta)$ in $P_1$ such that $\eta_1(e) \in E(G_0)$ for every $e \in +E(G)$ and $\eta_1(v) \cap V(G_0) \ne \emptyset$ for each $v \in V(G)$. Then there is a +realizable expansion $\eta_2$ of $P$ in $P_2$ such that $\eta_2(e) = \eta_1(e)$ for each $e +\in E(G)$, and $\eta_2(v) \cap V(G_0) = \eta_1(v) \cap V(G_0)$ for each $v \in V(G)$." + +The Lean version permits labels from a preorder. On the common piece `G₀`, the marked-edge +domains agree, the markings `μ` agree at each marked edge, and the patches `Δ` agree at each +edge. For each edge of `G₀`, the label in `P₁` is bounded above by the label in `P₂`. -/ +theorem theorem_5_3_proof [Preorder Ω] {α₀ β₀ : Type*} + {P : GM04.Patchwork Ω α₀ β₀} {P₁ P₂ : GM04.Patchwork Ω α β} + {G₁' G₂' G₀ : RootedHypergraph α β} + (hsep₁ : P₁.G.IsSeparation G₁' G₀) + (hsep₂ : P₂.G.IsSeparation G₂' G₀) + (hroots : G₁'.roots = G₂'.roots) + (hG₀_dom : ∀ e ∈ G₀.edgeSet, e ∈ P₁.dom ↔ e ∈ P₂.dom) + (hG₀_μ : ∀ e ∈ G₀.edgeSet, e ∈ P₁.dom → P₁.μ e = P₂.μ e) + (hG₀_Δ : ∀ e ∈ G₀.edgeSet, P₁.Δ e = P₂.Δ e) + (hG₀_φ : ∀ e ∈ G₀.edgeSet, P₁.φ e ≤ P₂.φ e) + (hgr : (feasibleGroupings (P₁.restrict G₁')).groupings ⊆ + (feasibleGroupings (P₂.restrict G₂')).groupings) + {η₁v : α₀ → Set α} {η₁e : β₀ → β} + (hη₁ : GM04.IsRealizableExpansion P P₁ η₁v η₁e) + (he_G₀ : ∀ e ∈ P.G.edgeSet, η₁e e ∈ G₀.edgeSet) + (hv_G₀ : ∀ v ∈ P.G.vertexSet, (η₁v v ∩ G₀.vertexSet).Nonempty) : + ∃ η₂v : α₀ → Set α, + GM04.IsRealizableExpansion P P₂ η₂v η₁e ∧ + ∀ v ∈ P.G.vertexSet, η₂v v ∩ G₀.vertexSet = η₁v v ∩ G₀.vertexSet := by + classical + obtain ⟨hexp₁, H₁, hreal₁, hcomp₁⟩ := hη₁ + have hle₀₁ := hsep₁.isSeparation.right_le + have hle₀₂ := hsep₂.isSeparation.right_le + have hle₁' := hsep₁.isSeparation.left_le + have hle₂' := hsep₂.isSeparation.left_le + let F : Set β := η₁e '' P.G.edgeSet + have hF_sub : F ⊆ G₀.edgeSet := by + rintro _ ⟨e, he, rfl⟩ + exact he_G₀ e he + let G₀_del : RootedHypergraph α β := G₀.deleteEdges F + have hsep₁_del : (P₁.deleteEdges F).G.IsSeparation G₁' G₀_del := + separation_delete_right_edges hsep₁ hF_sub + have hsep₂_del : (P₂.deleteEdges F).G.IsSeparation G₂' G₀_del := + separation_delete_right_edges hsep₂ hF_sub + have hG₀_del_Δ : ∀ e ∈ G₀_del.edgeSet, + ((P₁.deleteEdges F).restrict G₀_del).Δ e = ((P₂.deleteEdges F).restrict G₀_del).Δ e := by + intro e he + rw [(P₁.deleteEdges F).restrict_Δ hsep₁_del.isSeparation.right_le he, + (P₂.deleteEdges F).restrict_Δ hsep₂_del.isSeparation.right_le he] + exact hG₀_Δ e he.1 + have hgr_del : + (feasibleGroupings ((P₁.deleteEdges F).restrict G₁')).groupings ⊆ + (feasibleGroupings ((P₂.deleteEdges F).restrict G₂')).groupings := by + have hreal_iff : ∀ (P' : GM04.Patchwork Ω α β) (G' : RootedHypergraph α β) + (hle' : G'.toHypergraph ≤ P'.G.toHypergraph) + (hle'_del : G'.toHypergraph ≤ (P'.deleteEdges F).G.toHypergraph) + (H : (⊤ : SimpleGraph α).Subgraph), + ((P'.deleteEdges F).restrict G').IsRealization H ↔ (P'.restrict G').IsRealization H := by + intro P' G' hle' hle'_del H + refine ⟨fun ⟨δ, hδ, hH⟩ ↦ ⟨δ, fun e he ↦ ?_, hH⟩, + fun ⟨δ, hδ, hH⟩ ↦ ⟨δ, fun e he ↦ ?_, hH⟩⟩ + · have h := hδ e he + change δ e ∈ ((P'.deleteEdges F).restrict G').Δ e at h + rw [(P'.deleteEdges F).restrict_Δ hle'_del he] at h + change δ e ∈ (P'.restrict G').Δ e + rw [P'.restrict_Δ hle' he] + exact h + · have h := hδ e he + change δ e ∈ (P'.restrict G').Δ e at h + rw [P'.restrict_Δ hle' he] at h + change δ e ∈ ((P'.deleteEdges F).restrict G').Δ e + rw [(P'.deleteEdges F).restrict_Δ hle'_del he] + exact h + intro K hK + rcases hK with ⟨hgrp, hverts, H, hH, hconn⟩ + have hK₁ : IsFeasibleGrouping (P₁.restrict G₁') K := + ⟨hgrp, hverts, H, (hreal_iff P₁ G₁' hle₁' hsep₁_del.isSeparation.left_le H).1 hH, hconn⟩ + obtain ⟨hgrp₂, hverts₂, H₂', hH₂', hconn₂'⟩ := hgr hK₁ + exact ⟨hgrp₂, hverts₂, H₂', + (hreal_iff P₂ G₂' hle₂' hsep₂_del.isSeparation.left_le H₂').2 hH₂', hconn₂'⟩ + -- Apply (5.2) to `P₁ \ F` and `P₂ \ F` to get a realization `H₂` of `P₂ \ F`. + obtain ⟨H₂, hH₂, hconn_G₀⟩ := + theorem_5_2_proof hsep₁_del hsep₂_del hroots hG₀_del_Δ hgr_del hreal₁ + have hH₁_verts : H₁.verts = P₁.G.vertexSet := hreal₁.verts_eq + have hH₂_verts : H₂.verts = P₂.G.vertexSet := hH₂.verts_eq + -- For each `v ∈ V(G)`, choose a witness `w₀(v) ∈ η₁(v) ∩ V(G₀)` and define `η₂(v)` as the + -- vertex set of the component of `H₂` containing `w₀(v)`. + let η₂v : α₀ → Set α := fun v ↦ + if hv : v ∈ P.G.vertexSet then + let w₀ := (hv_G₀ v hv).choose + have hw₀_G₀ : w₀ ∈ G₀.vertexSet := (hv_G₀ v hv).choose_spec.2 + have hw₀_H₂ : w₀ ∈ H₂.verts := hH₂_verts.symm ▸ hle₀₂.vertexSet_subset hw₀_G₀ + (GM04.component H₂ ⟨w₀, hw₀_H₂⟩).verts + else ∅ + have hη₂_comp : ∀ v ∈ P.G.vertexSet, + (∃ D, GM04.IsComponent H₂ D ∧ D.verts = η₂v v) ∧ + η₂v v ∩ G₀.vertexSet = η₁v v ∩ G₀.vertexSet := by + intro v hv + let w₀ := (hv_G₀ v hv).choose + have hw₀_η₁ : w₀ ∈ η₁v v := (hv_G₀ v hv).choose_spec.1 + have hw₀_G₀ : w₀ ∈ G₀.vertexSet := (hv_G₀ v hv).choose_spec.2 + have hw₀_H₂ : w₀ ∈ H₂.verts := hH₂_verts.symm ▸ hle₀₂.vertexSet_subset hw₀_G₀ + have hη₂_eq : η₂v v = (GM04.component H₂ ⟨w₀, hw₀_H₂⟩).verts := by + simp only [η₂v, hv, ↓reduceDIte] + rfl + obtain ⟨D₁, hD₁, hD₁_verts⟩ := hcomp₁ v hv + refine ⟨⟨GM04.component H₂ ⟨w₀, hw₀_H₂⟩, ⟨⟨w₀, hw₀_H₂⟩, rfl⟩, hη₂_eq.symm⟩, ?_⟩ + rw [hη₂_eq] + ext x + simp only [Set.mem_inter_iff, GM04.component_verts, GM04.mem_componentVerts_iff] + constructor + · rintro ⟨⟨hx_H₂, hreach₂⟩, hx_G₀⟩ + have hconn₂ : ConnectedIn H₂ w₀ x := + connectedIn_iff.2 ⟨hw₀_H₂, hx_H₂, hreach₂⟩ + have hconn₁ : ConnectedIn H₁ w₀ x := (hconn_G₀ w₀ hw₀_G₀ x hx_G₀).2 hconn₂ + obtain ⟨D₁', hD₁', hw₀_D₁', hx_D₁'⟩ := hconn₁ + have hD_eq : D₁' = D₁ := hD₁'.eq_of_mem hD₁ hw₀_D₁' (hD₁_verts ▸ hw₀_η₁) + exact ⟨hD₁_verts ▸ hD_eq ▸ hx_D₁', hx_G₀⟩ + · rintro ⟨hx_η₁, hx_G₀⟩ + have hconn₁ : ConnectedIn H₁ w₀ x := + ⟨D₁, hD₁, hD₁_verts.symm ▸ hw₀_η₁, hD₁_verts.symm ▸ hx_η₁⟩ + have hconn₂ : ConnectedIn H₂ w₀ x := (hconn_G₀ w₀ hw₀_G₀ x hx_G₀).1 hconn₁ + obtain ⟨_, hx_H₂, hreach₂⟩ := connectedIn_iff.1 hconn₂ + exact ⟨⟨hx_H₂, hreach₂⟩, hx_G₀⟩ + refine ⟨η₂v, ⟨?_, H₂, hH₂, fun v hv ↦ (hη₂_comp v hv).1⟩, fun v hv ↦ (hη₂_comp v hv).2⟩ + refine + { vertex_nonempty := fun v hv ↦ by + obtain ⟨D, hD, hD_eq⟩ := (hη₂_comp v hv).1 + exact hD_eq ▸ hD.verts_nonempty + vertex_subset := fun v hv ↦ by + obtain ⟨D, hD, hD_eq⟩ := (hη₂_comp v hv).1 + rw [← hD_eq, ← hH₂_verts] + exact hD.le.1 + edge_mem := fun e he ↦ hle₀₂.edgeSet_subset (he_G₀ e he) + vertex_disjoint := fun v₁ hv₁ v₂ hv₂ hne ↦ by + obtain ⟨D₁, hD₁, hD₁_eq⟩ := (hη₂_comp v₁ hv₁).1 + obtain ⟨D₂, hD₂, hD₂_eq⟩ := (hη₂_comp v₂ hv₂).1 + rw [← hD₁_eq, ← hD₂_eq] + refine hD₁.disjoint_verts_of_ne hD₂ fun hEq ↦ ?_ + obtain ⟨w, hw₁, hw₀⟩ := hv_G₀ v₁ hv₁ + have hw_D₁ : w ∈ D₁.verts ∩ G₀.vertexSet := by + rw [hD₁_eq, (hη₂_comp v₁ hv₁).2] + exact ⟨hw₁, hw₀⟩ + have hw_D₂ : w ∈ η₂v v₂ ∩ G₀.vertexSet := by + rw [← hD₂_eq, ← hEq] + exact hw_D₁ + rw [(hη₂_comp v₂ hv₂).2] at hw_D₂ + exact Set.disjoint_left.1 (hexp₁.vertex_disjoint v₁ hv₁ v₂ hv₂ hne) hw₁ hw_D₂.1 + edge_injOn := hexp₁.edge_injOn + mem_dom_iff := fun e he ↦ + (hexp₁.mem_dom_iff e he).trans (hG₀_dom (η₁e e) (he_G₀ e he)) + ends_nonempty := fun e he hnd v hinc ↦ by + obtain ⟨v', hv', hinc₁⟩ := hexp₁.ends_nonempty e he hnd v hinc + have he₀ : η₁e e ∈ G₀.edgeSet := he_G₀ e he + have hinc₀ : G₀.Inc (η₁e e) v' := (GM10.inc_iff_of_le hle₀₁ he₀).2 hinc₁ + have hv'_G₀ : v' ∈ G₀.vertexSet := G₀.vertex_mem_of_inc hinc₀ + have hv'_η₂ : v' ∈ η₂v v ∩ G₀.vertexSet := by + rw [(hη₂_comp v (P.G.vertex_mem_of_inc hinc)).2] + exact ⟨hv', hv'_G₀⟩ + exact ⟨v', hv'_η₂.1, GM10.inc_of_le hle₀₂ hinc₀⟩ + μ_length := fun e he ↦ by + have heE : e ∈ P.G.edgeSet := P.dom_subset he + have he₀ : η₁e e ∈ G₀.edgeSet := he_G₀ e heE + have he₁_dom : η₁e e ∈ P₁.dom := (hexp₁.mem_dom_iff e heE).1 he + rw [← hG₀_μ (η₁e e) he₀ he₁_dom] + exact hexp₁.μ_length e he + μ_mem := fun e he i hi hi₂ ↦ by + have heE : e ∈ P.G.edgeSet := P.dom_subset he + have he₀ : η₁e e ∈ G₀.edgeSet := he_G₀ e heE + have he₁_dom : η₁e e ∈ P₁.dom := (hexp₁.mem_dom_iff e heE).1 he + have hi₁ : i < (P₁.μ (η₁e e)).length := (hG₀_μ (η₁e e) he₀ he₁_dom).symm ▸ hi₂ + have hmem₁ : (P₁.μ (η₁e e))[i] ∈ η₁v (P.μ e)[i] := hexp₁.μ_mem e he i hi hi₁ + have hv'_inc₁ : P₁.G.Inc (η₁e e) (P₁.μ (η₁e e))[i] := by + change (P₁.μ (η₁e e))[i] ∈ P₁.G.ends (η₁e e) + rw [← P₁.μ_set (η₁e e) he₁_dom] + exact List.getElem_mem hi₁ + have hv'_G₀ : (P₁.μ (η₁e e))[i] ∈ G₀.vertexSet := + G₀.vertex_mem_of_inc ((GM10.inc_iff_of_le hle₀₁ he₀).2 hv'_inc₁) + have hv_V : (P.μ e)[i] ∈ P.G.vertexSet := by + apply P.G.vertex_mem_of_inc + change (P.μ e)[i] ∈ P.G.ends e + rw [← P.μ_set e he] + exact List.getElem_mem hi + have hmem₂ : (P₁.μ (η₁e e))[i] ∈ η₂v (P.μ e)[i] ∩ G₀.vertexSet := by + rw [(hη₂_comp (P.μ e)[i] hv_V).2] + exact ⟨hmem₁, hv'_G₀⟩ + have hEq : (P₂.μ (η₁e e))[i] = (P₁.μ (η₁e e))[i] := by + simp [hG₀_μ (η₁e e) he₀ he₁_dom] + rw [hEq] + exact hmem₂.1 + roots_length := by + rw [hexp₁.roots_length, ← hsep₁.roots_right, hsep₂.roots_right] + roots_mem := fun i hi hi₂ ↦ by + have hroots₁₂ : P₁.G.roots = P₂.G.roots := + hsep₁.roots_right.symm.trans hsep₂.roots_right + have hi₁ : i < P₁.G.roots.length := hroots₁₂.symm ▸ hi₂ + have hmem₁ : P₁.G.roots[i] ∈ η₁v P.G.roots[i] := hexp₁.roots_mem i hi hi₁ + have hv'_G₀ : P₁.G.roots[i] ∈ G₀.vertexSet := by + have hmem_root : P₁.G.roots[i] ∈ G₀.rootSet := by + change P₁.G.roots[i] ∈ G₀.roots + rw [hsep₁.roots_right] + exact List.getElem_mem hi₁ + exact G₀.roots_subset _ hmem_root + have hv_V : P.G.roots[i] ∈ P.G.vertexSet := P.G.roots_subset _ (List.getElem_mem hi) + have hmem₂ : P₁.G.roots[i] ∈ η₂v P.G.roots[i] ∩ G₀.vertexSet := by + rw [(hη₂_comp P.G.roots[i] hv_V).2] + exact ⟨hmem₁, hv'_G₀⟩ + have hEq : P₂.G.roots[i] = P₁.G.roots[i] := by simp [hroots₁₂] + rw [hEq] + exact hmem₂.1 + maps_Δ := fun e he ↦ by + have heE : e ∈ P.G.edgeSet := P.dom_subset he + have he₀ : η₁e e ∈ G₀.edgeSet := he_G₀ e heE + have he₁_dom : η₁e e ∈ P₁.dom := (hexp₁.mem_dom_iff e heE).1 he + rw [← hG₀_μ (η₁e e) he₀ he₁_dom, ← hG₀_Δ (η₁e e) he₀] + exact hexp₁.maps_Δ e he + φ_le := fun e he ↦ (hexp₁.φ_le e he).trans (hG₀_φ (η₁e e) (he_G₀ e he)) } + +/-! ## Complemented subhypergraphs, rooted locations, and (5.4) -/ + +theorem complementHypergraph_eq_of_isComplemented {G A : RootedHypergraph α β} + (hA : IsComplemented G A) : + complementHypergraph G A = (complement G A hA).toHypergraph := by + have hroot_sub : A.rootSet ⊆ G.vertexSet := + (rootSet_subset A).trans hA.le.vertexSet_subset + ext v e + · simp [complementHypergraph, complement, Set.inter_eq_right.2 hroot_sub] + · rfl + · simp only [complementHypergraph, complement] + refine ⟨fun h ↦ ⟨h.1, h.2.1⟩, fun h ↦ ⟨h.1, h.2, ?_⟩⟩ + rw [Set.inter_eq_right.2 hroot_sub] + exact (complement G A hA).vertex_mem_of_inc h + +/-- If `A ⊆ G` is complemented in `G`, then `(A, G \ A)` is a separation of `G` +(Graph Minors XVIII, Section 5, page 93). -/ +theorem IsComplemented.isSeparation {G A : RootedHypergraph α β} + (hA : IsComplemented G A) : + G.IsSeparation A (complement G A hA) where + isSeparation := + { left_le := hA.le + right_le := + { vertexSet_subset := + Set.union_subset Set.sdiff_subset ((rootSet_subset A).trans hA.le.vertexSet_subset) + edgeSet_subset := Set.sdiff_subset + ends_eq := fun e he ↦ Set.ext fun v ↦ ⟨fun h ↦ ⟨he, h⟩, fun h ↦ h.2⟩ } + union_eq := by + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (GM10.union_le hA.le + ⟨Set.union_subset Set.sdiff_subset ((rootSet_subset A).trans hA.le.vertexSet_subset), + Set.sdiff_subset, fun e he ↦ Set.ext fun v ↦ ⟨fun h ↦ ⟨he, h⟩, fun h ↦ h.2⟩⟩) + le_rfl ?_ (Set.union_sdiff_cancel hA.le.edgeSet_subset) + ext v + simp only [GM10.union_vertexSet, complement, Set.mem_union, Set.mem_sdiff] + exact ⟨fun h ↦ h.elim (fun hvA ↦ hA.le.vertexSet_subset hvA) + (fun h2 ↦ h2.elim (fun h1 ↦ h1.1) (fun hr ↦ hA.le.vertexSet_subset + (A.roots_subset v hr))), + fun hvG ↦ by + by_cases hvA : v ∈ A.vertexSet + · exact Or.inl hvA + · exact Or.inr (Or.inl ⟨hvG, hvA⟩)⟩ + edgeSet_inter_eq := Set.inter_sdiff_self A.edgeSet G.edgeSet } + roots_right := rfl + rootSet_left := by + ext v + simp only [GM10.inter_vertexSet, complement, Set.mem_inter_iff, Set.mem_union, Set.mem_sdiff] + exact ⟨fun hr ↦ ⟨A.roots_subset v hr, Or.inr hr⟩, + fun ⟨hvA, h⟩ ↦ h.elim (fun hnot ↦ (hnot.2 hvA).elim) id⟩ + +/-- If `ℒ` is a rooted location in `G`, then `ℒ⁻` (`rootedLocationToLocation G ℒ`) is a location in +`G⁻` (Graph Minors XVIII, Section 5, page 93). -/ +theorem IsRootedLocation.isLocation {G : RootedHypergraph α β} + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) : + GM10.IsLocation G.toHypergraph (rootedLocationToLocation G ℒ) where + isSeparation := by + rintro _ ⟨A, hA, rfl⟩ + dsimp only + rw [complementHypergraph_eq_of_isComplemented (hℒ.isComplemented hA)] + exact (hℒ.isComplemented hA).isSeparation.isSeparation + left_le_right := by + rintro _ ⟨A₁, hA₁, rfl⟩ _ ⟨A₂, hA₂, rfl⟩ hne + have hA_ne : A₁ ≠ A₂ := fun hEq ↦ hne (by subst hEq; rfl) + dsimp only + rw [complementHypergraph_eq_of_isComplemented (hℒ.isComplemented hA₂)] + exact hℒ.le_complement hA₁ hA₂ hA_ne + +/-- Every rooted location `ℒ` in `G` is finite. -/ +theorem IsRootedLocation.finite {G : RootedHypergraph α β} + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) : + ℒ.Finite := by + classical + let f : RootedHypergraph α β → Hypergraph α β × List α := fun A ↦ (A.toHypergraph, A.roots) + have hinj : Set.InjOn f ℒ := by + rintro ⟨H₁, r₁, _, _⟩ _ ⟨H₂, r₂, _, _⟩ _ hEq + have hH : H₁ = H₂ := congrArg Prod.fst hEq + have hr : r₁ = r₂ := congrArg Prod.snd hEq + subst hH hr + rfl + have hnodup_fin : {l : List α | l.Nodup ∧ {x | x ∈ l} ⊆ G.vertexSet}.Finite := by + let _ : Fintype G.vertexSet := G.vertexSet_finite.fintype + have hlen_le : ∀ l : List α, l.Nodup → {x | x ∈ l} ⊆ G.vertexSet → + l.length ≤ Fintype.card G.vertexSet := by + intro l hnodup hsub + let emb : Fin l.length ↪ G.vertexSet := + ⟨fun i ↦ ⟨l[i.1], hsub (List.getElem_mem i.2)⟩, + fun i j hij ↦ Fin.ext ((hnodup.getElem_inj_iff).1 (congrArg Subtype.val hij))⟩ + have hle := Fintype.card_le_of_embedding emb + rwa [Fintype.card_fin] at hle + let g : {l : List α // l.Nodup ∧ {x | x ∈ l} ⊆ G.vertexSet} → + Fin (Fintype.card G.vertexSet) → Option G.vertexSet := + fun ⟨l, _, hsub⟩ i ↦ + if hi : i.1 < l.length then some ⟨l[i.1], hsub (List.getElem_mem hi)⟩ else none + have hg_inj : Function.Injective g := by + rintro ⟨l₁, hnodup₁, hsub₁⟩ ⟨l₂, hnodup₂, hsub₂⟩ hEq + have hlen₁ := hlen_le l₁ hnodup₁ hsub₁ + have hlen₂ := hlen_le l₂ hnodup₂ hsub₂ + have hlen : l₁.length = l₂.length := by + by_contra hne + rcases lt_or_gt_of_ne hne with hlt | hgt + · have hfi := congrFun hEq ⟨l₁.length, lt_of_lt_of_le hlt hlen₂⟩ + simp only [g, lt_irrefl, ↓reduceDIte, hlt] at hfi + cases hfi + · have hfi := congrFun hEq ⟨l₂.length, lt_of_lt_of_le hgt hlen₁⟩ + simp only [g, lt_irrefl, ↓reduceDIte, hgt] at hfi + cases hfi + apply Subtype.ext + refine List.ext_getElem hlen fun i hi₁ hi₂ ↦ ?_ + have hfi := congrFun hEq ⟨i, lt_of_lt_of_le hi₁ hlen₁⟩ + simp only [g, hi₁, hi₂, ↓reduceDIte, Option.some.injEq, Subtype.mk.injEq] at hfi + exact hfi + exact Set.finite_coe_iff.1 (Finite.of_injective g hg_inj) + have himg_sub : f '' ℒ ⊆ + {H : Hypergraph α β | H ≤ G.toHypergraph} ×ˢ + {l : List α | l.Nodup ∧ {x | x ∈ l} ⊆ G.vertexSet} := by + rintro _ ⟨A, hA, rfl⟩ + have hcomp := hℒ.isComplemented hA + exact ⟨hcomp.le, A.roots_nodup, (rootSet_subset A).trans hcomp.le.vertexSet_subset⟩ + exact Set.Finite.of_finite_image + (((subhypergraphs_finite G.toHypergraph).prod hnodup_fin).subset himg_sub) hinj + +theorem mem_rootedLocationCore_vertexSet_iff {G : RootedHypergraph α β} + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) {v : α} : + v ∈ (rootedLocationCore G ℒ).vertexSet ↔ + v ∈ G.vertexSet ∧ ∀ A ∈ ℒ, v ∈ A.vertexSet → v ∈ A.rootSet := by + simp only [rootedLocationCore, GM10.locationCore, rootedLocationToLocation, Set.mem_sep_iff, + Set.forall_mem_image] + refine and_congr_right fun hvG ↦ forall₂_congr fun A hA ↦ ?_ + rw [complementHypergraph_eq_of_isComplemented (hℒ.isComplemented hA)] + simp only [complement, Set.mem_union, Set.mem_sdiff] + exact ⟨fun h hvA ↦ h.resolve_left (fun h1 ↦ h1.2 hvA), + fun h ↦ by by_cases hvA : v ∈ A.vertexSet <;> [exact Or.inr (h hvA); exact Or.inl ⟨hvG, hvA⟩]⟩ + +theorem mem_rootedLocationCore_edgeSet_iff {G : RootedHypergraph α β} + {ℒ : Set (RootedHypergraph α β)} {e : β} : + e ∈ (rootedLocationCore G ℒ).edgeSet ↔ + e ∈ G.edgeSet ∧ ∀ A ∈ ℒ, e ∉ A.edgeSet := by + simp only [rootedLocationCore, GM10.locationCore, rootedLocationToLocation, Set.mem_sep_iff, + Set.forall_mem_image, complementHypergraph, Set.mem_sdiff] + exact ⟨fun ⟨heG, hall⟩ ↦ ⟨heG, fun A hA ↦ (hall hA).2⟩, + fun ⟨heG, hall⟩ ↦ ⟨heG, fun _ hA ↦ ⟨heG, hall _ hA⟩⟩⟩ + +theorem rootSet_subset_rootedLocationCore {G : RootedHypergraph α β} + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) : + G.rootSet ⊆ (rootedLocationCore G ℒ).vertexSet := by + intro v hv + rw [mem_rootedLocationCore_vertexSet_iff hℒ] + exact ⟨G.roots_subset v hv, fun A hA hvA ↦ (hℒ.isComplemented hA).roots_mem hvA hv⟩ + +theorem mem_rootSet_subset_rootedLocationCore {G : RootedHypergraph α β} + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) + {A₀ : RootedHypergraph α β} (hA₀ : A₀ ∈ ℒ) : + A₀.rootSet ⊆ (rootedLocationCore G ℒ).vertexSet := by + intro v hv + rw [mem_rootedLocationCore_vertexSet_iff hℒ] + refine ⟨(hℒ.isComplemented hA₀).le.vertexSet_subset (A₀.roots_subset v hv), fun A hA hvA ↦ ?_⟩ + by_cases hEq : A₀ = A + · subst hEq + exact hv + · have hle_comp := hℒ.le_complement hA₀ hA hEq + have hv_comp := hle_comp.vertexSet_subset (A₀.roots_subset v hv) + exact hv_comp.resolve_left fun h1 ↦ h1.2 hvA + +/-- First assertion of **Graph Minors XVIII, (5.4)** (page 93): +`V(G) \ πBar(G) = (V(G') \ πBar(G')) ∪ ⋃_{A ∈ ℒ} (V(A) \ πBar(A))`. -/ +theorem theorem_5_4_vertexSet {P P' : UnlabeledPatchwork α β} + {ℒ : Set (RootedHypergraph α β)} {newEdge : RootedHypergraph α β → β} + (hheart : IsPatchworkHeart P ℒ newEdge P') : + P.G.vertexSet \ P.G.rootSet = + (P'.G.vertexSet \ P'.G.rootSet) ∪ ⋃ A ∈ ℒ, (A.vertexSet \ A.rootSet) := by + have hℒ := hheart.isRootedLocation + have hrootSet_eq : P'.G.rootSet = P.G.rootSet := by + ext v + simp [RootedHypergraph.rootSet, hheart.roots_eq] + rw [hheart.vertexSet_eq, hrootSet_eq] + ext v + simp only [Set.mem_sdiff, Set.mem_union, Set.mem_iUnion, + mem_rootedLocationCore_vertexSet_iff hℒ] + constructor + · rintro ⟨hvG, hnot_root⟩ + by_cases hall : ∀ A ∈ ℒ, v ∈ A.vertexSet → v ∈ A.rootSet + · exact Or.inl ⟨⟨hvG, hall⟩, hnot_root⟩ + · push Not at hall + rcases hall with ⟨A, hA, hvA, hnot_A⟩ + exact Or.inr ⟨A, hA, hvA, hnot_A⟩ + · rintro (⟨⟨hvG, _⟩, hnot_root⟩ | ⟨A, hA, hvA, hnot_A⟩) + · exact ⟨hvG, hnot_root⟩ + · have hcomp := hℒ.isComplemented hA + exact ⟨hcomp.le.vertexSet_subset hvA, fun hv_root ↦ hnot_A (hcomp.roots_mem hvA hv_root)⟩ + +/-- For a patchwork `P'` whose underlying rooted hypergraph has a single edge `e₀` with +ends `V(P'.G) = πBar(P'.G)`, a grouping `K` is feasible in `P'` if and only if `K ∈ Δ'(e₀)`. -/ +theorem isFeasibleGrouping_singleEdge_iff {P' : GM04.Patchwork Ω α β} {e₀ : β} + (hE : P'.G.edgeSet = {e₀}) (hV : P'.G.vertexSet = P'.G.rootSet) + (hends : P'.G.ends e₀ = P'.G.rootSet) + (K : (⊤ : SimpleGraph α).Subgraph) : + IsFeasibleGrouping P' K ↔ K ∈ P'.Δ e₀ := by + have he₀ : e₀ ∈ P'.G.edgeSet := hE ▸ Set.mem_singleton e₀ + have hΔ_verts : (P'.Δ e₀).verts = P'.G.rootSet := + (P'.Δ_verts e₀ he₀).trans hends + have hreal_eq : ∀ δ : β → (⊤ : SimpleGraph α).Subgraph, + δ e₀ ∈ P'.Δ e₀ → GM04.realizationOf P'.G.toHypergraph δ = δ e₀ := by + intro δ hδ + have hδ_verts : (δ e₀).verts = P'.G.vertexSet := by + rw [((P'.Δ e₀).verts_eq (δ e₀) hδ).trans hΔ_verts, hV] + ext u v + · simp [GM04.realizationOf, hE, hδ_verts] + · simp [GM04.realizationOf, hE] + constructor + · rintro ⟨hgrp, hK_verts, H, ⟨δ, hδ, rfl⟩, hconn⟩ + have hδ_e₀ : δ e₀ ∈ P'.Δ e₀ := hδ e₀ he₀ + rw [hreal_eq δ hδ_e₀] at hconn + have hδ_grp : GM04.IsGrouping P'.G.rootSet (δ e₀) := + hΔ_verts ▸ (P'.Δ e₀).isGrouping (δ e₀) hδ_e₀ + have hδ_verts : (δ e₀).verts = P'.G.rootSet := + ((P'.Δ e₀).verts_eq (δ e₀) hδ_e₀).trans hΔ_verts + have hK_eq : K = δ e₀ := by + ext u v + · rw [hK_verts, hδ_verts] + · by_cases hne : u = v + · subst hne + exact ⟨fun h ↦ False.elim (K.loopless.irrefl u h), + fun h ↦ False.elim ((δ e₀).loopless.irrefl u h)⟩ + · constructor + · intro huv + have hu : u ∈ P'.G.rootSet := hK_verts ▸ K.edge_vert huv + have hv : v ∈ P'.G.rootSet := hK_verts ▸ K.edge_vert huv.symm + have hsc : GM04.sameComponent (δ e₀) u v := + connectedIn_iff_sameComponent.1 ((hconn u hu v hv hne).2 huv) + exact (GM04.sameComponent_iff_adj_of_isGrouping hδ_grp hne).1 hsc + · intro huv + have hu : u ∈ P'.G.rootSet := hδ_verts ▸ (δ e₀).edge_vert huv + have hv : v ∈ P'.G.rootSet := hδ_verts ▸ (δ e₀).edge_vert huv.symm + exact (hconn u hu v hv hne).1 (connectedIn_of_adj huv) + rwa [hK_eq] + · intro hK + have hgrp : GM04.IsGrouping P'.G.rootSet K := hΔ_verts ▸ (P'.Δ e₀).isGrouping K hK + have hK_verts : K.verts = P'.G.rootSet := ((P'.Δ e₀).verts_eq K hK).trans hΔ_verts + refine ⟨hgrp, hK_verts, K, ⟨fun _ ↦ K, fun e he ↦ ?_, (hreal_eq (fun _ ↦ K) hK).symm⟩, + fun x _ y _ hne ↦ connectedIn_iff_sameComponent.trans + (GM04.sameComponent_iff_adj_of_isGrouping hgrp hne)⟩ + rw [hE, Set.mem_singleton_iff] at he + rwa [he] + +/-! ### Intermediate patchworks `P_S` for the proof of (5.4) + +Following the proof of `theorem_3_4_proof` in `Section3.lean`, we work in `β ⊕ RootedHypergraph α β` +so +that `Sum.inl e` (`e ∈ E(G)`) and `Sum.inr A` (`A ∈ ℒ`) are disjoint by construction, and then push +forward to `P'` along the edge bijection `Sum.inl e ↦ e`, `Sum.inr A ↦ newEdge A`. -/ + +/-- The left edge-label inclusion used for patchworks. -/ +abbrev mapInlH (γ : Type*) (G : Hypergraph α β) : Hypergraph α (β ⊕ γ) := mapInl γ G + +/-- Maps a `RootedHypergraph α β` to `RootedHypergraph α (β ⊕ γ)` via `mapInlH γ`. -/ +@[expose] def mapInlRooted (γ : Type*) (G : RootedHypergraph α β) : RootedHypergraph α (β ⊕ γ) where + toHypergraph := mapInlH γ G.toHypergraph + roots := G.roots + roots_nodup := G.roots_nodup + roots_subset := G.roots_subset + +/-- Maps a `GM04.Patchwork Ω α β` to `GM04.Patchwork Ω α (β ⊕ γ)` via `Sum.inl`. -/ +@[expose] def mapInlPatchwork (γ : Type*) (P : GM04.Patchwork Ω α β) [Inhabited Ω] : + GM04.Patchwork Ω α (β ⊕ γ) where + G := mapInlRooted γ P.G + dom := Sum.inl '' P.dom + μ e := match e with + | Sum.inl e₀ => P.μ e₀ + | Sum.inr _ => [] + Δ e := match e with + | Sum.inl e₀ => P.Δ e₀ + | Sum.inr _ => GM04.freePatch ∅ + φ e := match e with + | Sum.inl e₀ => P.φ e₀ + | Sum.inr _ => default + dom_subset := Set.image_mono P.dom_subset + μ_nodup := by + rintro _ ⟨e₀, he₀, rfl⟩ + exact P.μ_nodup e₀ he₀ + μ_set := by + rintro _ ⟨e₀, he₀, rfl⟩ + exact P.μ_set e₀ he₀ + Δ_verts := by + rintro _ ⟨e₀, he₀, rfl⟩ + exact P.Δ_verts e₀ he₀ + Δ_free := by + rintro _ ⟨e₀, he₀, rfl⟩ hnd + exact P.Δ_free e₀ he₀ fun hd ↦ hnd ⟨e₀, hd, rfl⟩ + +/-- The single-edge rooted hypergraph `A'_j` in `β ⊕ RootedHypergraph α β` on `πBar(A)` with edge +`Sum.inr A` and roots `π(A)` (Graph Minors XVIII, Section 5, proof of (5.4), page 94). -/ +@[expose] def placeNewEdgeSum (A : RootedHypergraph α β) : + RootedHypergraph α (β ⊕ RootedHypergraph α β) where + toHypergraph := + { vertexSet := A.rootSet + edgeSet := {Sum.inr A} + Inc e v := e = Sum.inr A ∧ v ∈ A.rootSet + vertex_mem_of_inc _ _ h := h.2 + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := A.vertexSet_finite.subset (rootSet_subset A) + edgeSet_finite := Set.finite_singleton _ } + roots := A.roots + roots_nodup := A.roots_nodup + roots_subset _ h := h + +/-- The ambient hypergraph in `β ⊕ RootedHypergraph α β` for a rooted location `ℒ` in `G`. -/ +@[expose] def placeSumAmbient (G : RootedHypergraph α β) {ℒ : Set (RootedHypergraph α β)} + (hℒ : IsRootedLocation G ℒ) : + Hypergraph α (β ⊕ RootedHypergraph α β) where + vertexSet := G.vertexSet + edgeSet := (Sum.inl '' G.edgeSet) ∪ (Sum.inr '' ℒ) + Inc e v := match e with + | Sum.inl e₀ => G.Inc e₀ v + | Sum.inr A => A ∈ ℒ ∧ v ∈ A.rootSet + vertex_mem_of_inc e v h := by + cases e with + | inl e₀ => exact G.vertex_mem_of_inc h + | inr A => exact (hℒ.isComplemented h.1).le.vertexSet_subset (A.roots_subset v h.2) + edge_mem_of_inc e v h := by + cases e with + | inl e₀ => exact Or.inl ⟨e₀, G.edge_mem_of_inc h, rfl⟩ + | inr A => exact Or.inr ⟨A, h.1, rfl⟩ + vertexSet_finite := G.vertexSet_finite + edgeSet_finite := (G.edgeSet_finite.image Sum.inl).union (hℒ.finite.image Sum.inr) + +theorem mapInlH_le_placeSumAmbient {G : RootedHypergraph α β} + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) + {H : Hypergraph α β} (hH : H ≤ G.toHypergraph) : + mapInlH (RootedHypergraph α β) H ≤ placeSumAmbient G hℒ where + vertexSet_subset := hH.vertexSet_subset + edgeSet_subset := (Set.image_mono hH.edgeSet_subset).trans Set.subset_union_left + ends_eq e he := by + rcases he with ⟨e₀, he₀, rfl⟩ + exact hH.ends_eq e₀ he₀ + +theorem placeNewEdgeSum_le_placeSumAmbient {G : RootedHypergraph α β} + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) + {A : RootedHypergraph α β} (hA : A ∈ ℒ) : + (placeNewEdgeSum A).toHypergraph ≤ placeSumAmbient G hℒ where + vertexSet_subset := (rootSet_subset A).trans (hℒ.isComplemented hA).le.vertexSet_subset + edgeSet_subset := by + rintro _ rfl + exact Or.inr ⟨A, hA, rfl⟩ + ends_eq e he := by + rcases Set.mem_singleton_iff.1 he with rfl + ext v + change (A ∈ ℒ ∧ v ∈ A.rootSet) ↔ (Sum.inr A = Sum.inr A ∧ v ∈ A.rootSet) + exact ⟨fun h ↦ ⟨rfl, h.2⟩, fun h ↦ ⟨hA, h.2⟩⟩ + +open Classical in +/-- The intermediate rooted hypergraph `G_S` in `β ⊕ RootedHypergraph α β` in the proof of (5.4) +(page 94), where `S ⊆ ℒ` is the set of members of `ℒ` that have not yet been replaced by new +edges (so `S = ∅` corresponds to the heart `P | ℒ` and `S = ℒ` corresponds to `P`). -/ +@[expose] noncomputable def placeSumStepHypergraph (G : RootedHypergraph α β) + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) + (S : Finset (RootedHypergraph α β)) : + RootedHypergraph α (β ⊕ RootedHypergraph α β) where + toHypergraph := + mapInlH _ (rootedLocationCore G ℒ) ∪ + Hypergraph.biUnion S (fun A ↦ mapInlH _ A.toHypergraph) ∪ + Hypergraph.biUnion (hℒ.finite.toFinset \ S) (fun A ↦ (placeNewEdgeSum A).toHypergraph) + roots := G.roots + roots_nodup := G.roots_nodup + roots_subset _ hv := Or.inl (Or.inl (rootSet_subset_rootedLocationCore hℒ hv)) + +open Classical in +/-- The side rooted hypergraph `B` in `β ⊕ RootedHypergraph α β` in the proof of (5.4) (page 94). -/ +@[expose] noncomputable def placeSumStepSide (G : RootedHypergraph α β) + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) + (S : Finset (RootedHypergraph α β)) (A₀ : RootedHypergraph α β) : + RootedHypergraph α (β ⊕ RootedHypergraph α β) where + toHypergraph := + mapInlH _ (rootedLocationCore G ℒ) ∪ + Hypergraph.biUnion (S.erase A₀) (fun A ↦ mapInlH _ A.toHypergraph) ∪ + Hypergraph.biUnion ((hℒ.finite.toFinset \ S).erase A₀) + (fun A ↦ (placeNewEdgeSum A).toHypergraph) + roots := G.roots + roots_nodup := G.roots_nodup + roots_subset _ hv := Or.inl (Or.inl (rootSet_subset_rootedLocationCore hℒ hv)) + +open Classical in +theorem placeSumStepHypergraph_le_ambient {G : RootedHypergraph α β} + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) + {S : Finset (RootedHypergraph α β)} (hS : S ⊆ hℒ.finite.toFinset) : + (placeSumStepHypergraph G hℒ S).toHypergraph ≤ placeSumAmbient G hℒ := by + refine GM10.union_le + (GM10.union_le (mapInlH_le_placeSumAmbient hℒ (locationCore_le hℒ.isLocation)) ?_) ?_ + · refine biUnion_le fun A hA ↦ ?_ + have hA_ℒ : A ∈ ℒ := hℒ.finite.mem_toFinset.1 (hS hA) + exact mapInlH_le_placeSumAmbient hℒ (hℒ.isComplemented hA_ℒ).le + · refine biUnion_le fun A hA ↦ ?_ + have hA_ℒ : A ∈ ℒ := hℒ.finite.mem_toFinset.1 (Finset.sdiff_subset hA) + exact placeNewEdgeSum_le_placeSumAmbient hℒ hA_ℒ + +open Classical in +theorem placeSumStepSide_le_ambient {G : RootedHypergraph α β} + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) + {S : Finset (RootedHypergraph α β)} (hS : S ⊆ hℒ.finite.toFinset) + (A₀ : RootedHypergraph α β) : + (placeSumStepSide G hℒ S A₀).toHypergraph ≤ placeSumAmbient G hℒ := by + refine GM10.union_le + (GM10.union_le (mapInlH_le_placeSumAmbient hℒ (locationCore_le hℒ.isLocation)) ?_) ?_ + · refine biUnion_le fun A hA ↦ ?_ + have hA_ℒ : A ∈ ℒ := hℒ.finite.mem_toFinset.1 (hS (Finset.mem_of_mem_erase hA)) + exact mapInlH_le_placeSumAmbient hℒ (hℒ.isComplemented hA_ℒ).le + · refine biUnion_le fun A hA ↦ ?_ + have hA_ℒ : A ∈ ℒ := + hℒ.finite.mem_toFinset.1 (Finset.sdiff_subset (Finset.mem_of_mem_erase hA)) + exact placeNewEdgeSum_le_placeSumAmbient hℒ hA_ℒ + +open Classical in +/-- The intermediate patchwork `P_S` in `β ⊕ RootedHypergraph α β` in the proof of (5.4) (page 94). +-/ +@[expose] noncomputable def placeSumStepPatchwork (P : UnlabeledPatchwork α β) + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation P.G ℒ) + (S : Finset (RootedHypergraph α β)) (hS : S ⊆ hℒ.finite.toFinset) : + UnlabeledPatchwork α (β ⊕ RootedHypergraph α β) where + G := placeSumStepHypergraph P.G hℒ S + dom := ((Sum.inl '' P.dom) ∩ (placeSumStepHypergraph P.G hℒ S).edgeSet) ∪ + (Sum.inr '' ((hℒ.finite.toFinset \ S : Finset (RootedHypergraph α β)) : Set _)) + μ e := match e with + | Sum.inl e₀ => P.μ e₀ + | Sum.inr A => A.roots + Δ e := match e with + | Sum.inl e₀ => P.Δ e₀ + | Sum.inr A => feasibleGroupings (P.restrict A) + φ _ := () + dom_subset := by + rintro e (⟨_, he⟩ | ⟨A, hA, rfl⟩) + · exact he + · refine Or.inr ?_ + simp only [biUnion, Set.mem_iUnion, placeNewEdgeSum, Set.mem_singleton_iff] + exact ⟨A, hA, rfl⟩ + μ_nodup := by + rintro e (⟨⟨e₀, he₀, rfl⟩, _⟩ | ⟨A, _, rfl⟩) + · exact P.μ_nodup e₀ he₀ + · exact A.roots_nodup + μ_set := by + have hle_amb := placeSumStepHypergraph_le_ambient hℒ hS + rintro e (⟨⟨e₀, he₀, rfl⟩, he_edge⟩ | ⟨A, hA_sdiff, rfl⟩) + · rw [P.μ_set e₀ he₀] + have hends := hle_amb.ends_eq (Sum.inl e₀) he_edge + exact hends + · have he_edge : Sum.inr A ∈ (placeSumStepHypergraph P.G hℒ S).edgeSet := by + refine Or.inr ?_ + simp only [biUnion, Set.mem_iUnion, placeNewEdgeSum, Set.mem_singleton_iff] + exact ⟨A, hA_sdiff, rfl⟩ + have hends := hle_amb.ends_eq (Sum.inr A) he_edge + have hA_ℒ : A ∈ ℒ := hℒ.finite.mem_toFinset.1 (Finset.sdiff_subset hA_sdiff) + rw [← hends] + ext v + change v ∈ A.rootSet ↔ (A ∈ ℒ ∧ v ∈ A.rootSet) + exact ⟨fun hv ↦ ⟨hA_ℒ, hv⟩, fun h ↦ h.2⟩ + Δ_verts := by + have hle_amb := placeSumStepHypergraph_le_ambient hℒ hS + intro e he_edge + have hends := hle_amb.ends_eq e he_edge + cases e with + | inl e₀ => + have he₀_G : e₀ ∈ P.G.edgeSet := by + rcases hle_amb.edgeSet_subset he_edge with ⟨e₁, he₁, hEq⟩ | ⟨_, _, hEq⟩ + · cases hEq + exact he₁ + · cases hEq + exact (P.Δ_verts e₀ he₀_G).trans hends + | inr A => + have hA_ℒ : A ∈ ℒ := by + rcases hle_amb.edgeSet_subset he_edge with ⟨_, _, hEq⟩ | ⟨A', hA', hEq⟩ + · cases hEq + · cases hEq + exact hA' + rw [← hends] + ext v + change v ∈ A.rootSet ↔ (A ∈ ℒ ∧ v ∈ A.rootSet) + exact ⟨fun hv ↦ ⟨hA_ℒ, hv⟩, fun h ↦ h.2⟩ + Δ_free := by + have hle_amb := placeSumStepHypergraph_le_ambient hℒ hS + intro e he_edge hnot_dom + cases e with + | inl e₀ => + have he₀_G : e₀ ∈ P.G.edgeSet := by + rcases hle_amb.edgeSet_subset he_edge with ⟨e₁, he₁, hEq⟩ | ⟨_, _, hEq⟩ + · cases hEq + exact he₁ + · cases hEq + have hnot_dom₀ : e₀ ∉ P.dom := fun hd ↦ hnot_dom (Or.inl ⟨⟨e₀, hd, rfl⟩, he_edge⟩) + exact P.Δ_free e₀ he₀_G hnot_dom₀ + | inr A => + exfalso + rcases he_edge with (he_core | he_S) | he_sdiff + · rcases he_core with ⟨_, _, hEq⟩ + cases hEq + · simp only [biUnion, Set.mem_iUnion, mapInlH, mapInl, Set.mem_image, reduceCtorEq, and_false, + exists_false] at he_S + · simp only [biUnion, Set.mem_iUnion, placeNewEdgeSum, Set.mem_singleton_iff, + Sum.inr.injEq] at he_sdiff + rcases he_sdiff with ⟨A', hA', hEq⟩ + subst hEq + exact hnot_dom (Or.inr ⟨A, hA', rfl⟩) + +@[simp] theorem placeSumStepPatchwork_G (P : UnlabeledPatchwork α β) + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation P.G ℒ) + (S : Finset (RootedHypergraph α β)) (hS : S ⊆ hℒ.finite.toFinset) : + (placeSumStepPatchwork P hℒ S hS).G = placeSumStepHypergraph P.G hℒ S := rfl + +@[simp] theorem placeSumStepPatchwork_Δ_inl (P : UnlabeledPatchwork α β) + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation P.G ℒ) + (S : Finset (RootedHypergraph α β)) (hS : S ⊆ hℒ.finite.toFinset) (e₀ : β) : + (placeSumStepPatchwork P hℒ S hS).Δ (Sum.inl e₀) = P.Δ e₀ := rfl + +@[simp] theorem placeSumStepPatchwork_Δ_inr (P : UnlabeledPatchwork α β) + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation P.G ℒ) + (S : Finset (RootedHypergraph α β)) (hS : S ⊆ hℒ.finite.toFinset) + (A : RootedHypergraph α β) : + (placeSumStepPatchwork P hℒ S hS).Δ (Sum.inr A) = feasibleGroupings (P.restrict A) := rfl + +open Classical in +/-- `GM04.IsRealization` is invariant under an edge bijection preserving vertices and patches. -/ +theorem isRealization_iff_of_edge_bij {Ω₁ Ω₂ : Type*} + {β₁ β₂ : Type*} (P₁ : GM04.Patchwork Ω₁ α β₁) (P₂ : GM04.Patchwork Ω₂ α β₂) + (f : β₁ → β₂) + (hV : P₁.G.vertexSet = P₂.G.vertexSet) + (hE : f '' P₁.G.edgeSet = P₂.G.edgeSet) + (hinj : Set.InjOn f P₁.G.edgeSet) + (hΔ : ∀ e ∈ P₁.G.edgeSet, P₂.Δ (f e) = P₁.Δ e) + (H : (⊤ : SimpleGraph α).Subgraph) : + P₁.IsRealization H ↔ P₂.IsRealization H := by + constructor + · rintro ⟨δ₁, hδ₁, rfl⟩ + let δ₂ : β₂ → (⊤ : SimpleGraph α).Subgraph := fun e₂ ↦ + if h : ∃ e₁ ∈ P₁.G.edgeSet, f e₁ = e₂ then δ₁ h.choose else ⊥ + have hδ₂_eq : ∀ e₁ ∈ P₁.G.edgeSet, δ₂ (f e₁) = δ₁ e₁ := by + intro e₁ he₁ + have hex : ∃ e' ∈ P₁.G.edgeSet, f e' = f e₁ := ⟨e₁, he₁, rfl⟩ + have hdif : δ₂ (f e₁) = δ₁ hex.choose := by simp only [δ₂, hex, ↓reduceDIte] + rw [hdif] + exact congrArg δ₁ (hinj hex.choose_spec.1 he₁ hex.choose_spec.2) + have hδ₂ : ∀ e₂ ∈ P₂.G.edgeSet, δ₂ e₂ ∈ P₂.Δ e₂ := by + intro e₂ he₂ + rw [← hE] at he₂ + rcases he₂ with ⟨e₁, he₁, rfl⟩ + rw [hδ₂_eq e₁ he₁, hΔ e₁ he₁] + exact hδ₁ e₁ he₁ + have hreal₁ : P₁.IsRealization (GM04.realizationOf P₁.G.toHypergraph δ₁) := ⟨δ₁, hδ₁, rfl⟩ + have hreal₂ : P₂.IsRealization (GM04.realizationOf P₂.G.toHypergraph δ₂) := ⟨δ₂, hδ₂, rfl⟩ + refine ⟨δ₂, hδ₂, ?_⟩ + ext u v + · rw [hreal₁.verts_eq, hreal₂.verts_eq, hV] + · simp only [GM04.realizationOf_adj, ← hE, Set.mem_image, exists_exists_and_eq_and] + exact exists_congr fun e₁ ↦ and_congr_right fun he₁ ↦ by rw [hδ₂_eq e₁ he₁] + · rintro ⟨δ₂, hδ₂, rfl⟩ + let δ₁ : β₁ → (⊤ : SimpleGraph α).Subgraph := fun e₁ ↦ δ₂ (f e₁) + have hδ₁ : ∀ e₁ ∈ P₁.G.edgeSet, δ₁ e₁ ∈ P₁.Δ e₁ := by + intro e₁ he₁ + have hfe₁ : f e₁ ∈ P₂.G.edgeSet := hE ▸ ⟨e₁, he₁, rfl⟩ + rw [← hΔ e₁ he₁] + exact hδ₂ (f e₁) hfe₁ + have hreal₁ : P₁.IsRealization (GM04.realizationOf P₁.G.toHypergraph δ₁) := ⟨δ₁, hδ₁, rfl⟩ + have hreal₂ : P₂.IsRealization (GM04.realizationOf P₂.G.toHypergraph δ₂) := ⟨δ₂, hδ₂, rfl⟩ + refine ⟨δ₁, hδ₁, ?_⟩ + ext u v + · rw [hreal₂.verts_eq, hreal₁.verts_eq, hV] + · simp only [GM04.realizationOf_adj, ← hE, Set.mem_image, exists_exists_and_eq_and, δ₁] + +/-- `feasibleGroupings` is invariant under an edge bijection preserving vertices, roots, and +patches. -/ +theorem feasibleGroupings_eq_of_edge_bij {Ω₁ Ω₂ : Type*} + {β₁ β₂ : Type*} (P₁ : GM04.Patchwork Ω₁ α β₁) (P₂ : GM04.Patchwork Ω₂ α β₂) + (f : β₁ → β₂) + (hV : P₁.G.vertexSet = P₂.G.vertexSet) + (hR : P₁.G.rootSet = P₂.G.rootSet) + (hE : f '' P₁.G.edgeSet = P₂.G.edgeSet) + (hinj : Set.InjOn f P₁.G.edgeSet) + (hΔ : ∀ e ∈ P₁.G.edgeSet, P₂.Δ (f e) = P₁.Δ e) : + feasibleGroupings P₁ = feasibleGroupings P₂ := by + refine GM04.Patch.ext hR (Set.ext fun K ↦ ?_) + change IsFeasibleGrouping P₁ K ↔ IsFeasibleGrouping P₂ K + simp only [IsFeasibleGrouping, hR] + refine and_congr_right fun _ ↦ and_congr_right fun _ ↦ exists_congr fun H ↦ + and_congr_left fun _ ↦ ?_ + exact isRealization_iff_of_edge_bij P₁ P₂ f hV hE hinj hΔ H + +/-- Corollary of `(5.2)`: if `(G₁', G₀)` and `(G₂', G₀)` are separations of `P₁.G` and `P₂.G` with +`π(G₁') = π(G₂')`, `P₁` and `P₂` having identical patches on `E(G₀)`, and +`gr(P₁ | G₁') = gr(P₂ | G₂')`, then `gr(P₁) = gr(P₂)`. -/ +theorem feasibleGroupings_eq_of_theorem_5_2 {P₁ P₂ : GM04.Patchwork Ω α β} + {G₁' G₂' G₀ : RootedHypergraph α β} + (hsep₁ : P₁.G.IsSeparation G₁' G₀) + (hsep₂ : P₂.G.IsSeparation G₂' G₀) + (hroots : G₁'.roots = G₂'.roots) + (hG₀_Δ : ∀ e ∈ G₀.edgeSet, P₁.Δ e = P₂.Δ e) + (hgr : feasibleGroupings (P₁.restrict G₁') = feasibleGroupings (P₂.restrict G₂')) : + feasibleGroupings P₁ = feasibleGroupings P₂ := by + have hG₀ : ∀ e ∈ G₀.edgeSet, (P₁.restrict G₀).Δ e = (P₂.restrict G₀).Δ e := by + intro e he + rw [P₁.restrict_Δ hsep₁.isSeparation.right_le he, P₂.restrict_Δ hsep₂.isSeparation.right_le he] + exact hG₀_Δ e he + have hR₁ : G₀.rootSet = P₁.G.rootSet := by + ext v + simp [RootedHypergraph.rootSet, hsep₁.roots_right] + have hR₂ : G₀.rootSet = P₂.G.rootSet := by + ext v + simp [RootedHypergraph.rootSet, hsep₂.roots_right] + have hR : P₁.G.rootSet = P₂.G.rootSet := hR₁.symm.trans hR₂ + refine GM04.Patch.ext hR (Set.ext fun K ↦ ?_) + change IsFeasibleGrouping P₁ K ↔ IsFeasibleGrouping P₂ K + constructor + · rintro ⟨hgrp, hK_verts, H₁, hH₁, hconn₁⟩ + obtain ⟨H₂, hH₂, hconn_G₀⟩ := theorem_5_2_proof hsep₁ hsep₂ hroots hG₀ (by rw [hgr]) hH₁ + refine ⟨hR ▸ hgrp, hK_verts.trans hR, H₂, hH₂, ?_⟩ + intro x hx y hy hne + have hx₀ : x ∈ G₀.vertexSet := rootSet_subset G₀ (hR₂.symm ▸ hx) + have hy₀ : y ∈ G₀.vertexSet := rootSet_subset G₀ (hR₂.symm ▸ hy) + exact (hconn_G₀ x hx₀ y hy₀).symm.trans (hconn₁ x (hR.symm ▸ hx) y (hR.symm ▸ hy) hne) + · rintro ⟨hgrp, hK_verts, H₂, hH₂, hconn₂⟩ + have hG₀' : ∀ e ∈ G₀.edgeSet, (P₂.restrict G₀).Δ e = (P₁.restrict G₀).Δ e := + fun e he ↦ (hG₀ e he).symm + obtain ⟨H₁, hH₁, hconn_G₀⟩ := theorem_5_2_proof hsep₂ hsep₁ hroots.symm hG₀' (by rw [hgr]) hH₂ + refine ⟨hR.symm ▸ hgrp, hK_verts.trans hR.symm, H₁, hH₁, ?_⟩ + intro x hx y hy hne + have hx₀ : x ∈ G₀.vertexSet := rootSet_subset G₀ (hR₁.symm ▸ hx) + have hy₀ : y ∈ G₀.vertexSet := rootSet_subset G₀ (hR₁.symm ▸ hy) + exact (hconn_G₀ x hx₀ y hy₀).symm.trans (hconn₂ x (hR ▸ hx) y (hR ▸ hy) hne) + +private theorem biUnion_insert {ι γ : Type*} [DecidableEq ι] (a : ι) (s : Finset ι) + (f : ι → Hypergraph α γ) : + biUnion (insert a s) f = f a ∪ biUnion s f := by + ext v e + · simp [biUnion] + · simp [biUnion] + · simp [biUnion] + +open Classical in +theorem isSeparation_placeSumStep_insert (P : UnlabeledPatchwork α β) + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation P.G ℒ) + {S : Finset (RootedHypergraph α β)} {A₀ : RootedHypergraph α β} + (hS : insert A₀ S ⊆ hℒ.finite.toFinset) (hnotMem : A₀ ∉ S) : + (placeSumStepPatchwork P hℒ (insert A₀ S) hS).G.IsSeparation + (mapInlRooted (RootedHypergraph α β) A₀) + (placeSumStepSide P.G hℒ S A₀) := by + have hS' : S ⊆ hℒ.finite.toFinset := (Finset.subset_insert A₀ S).trans hS + have hA₀_fin : A₀ ∈ hℒ.finite.toFinset := hS (Finset.mem_insert_self A₀ S) + have hA₀_ℒ : A₀ ∈ ℒ := hℒ.finite.mem_toFinset.1 hA₀_fin + have hle_amb_B := placeSumStepSide_le_ambient hℒ hS' A₀ + have hle_amb_A : (mapInlRooted (RootedHypergraph α β) A₀).toHypergraph ≤ + placeSumAmbient P.G hℒ := + mapInlH_le_placeSumAmbient hℒ (hℒ.isComplemented hA₀_ℒ).le + have hSdiff_insert : hℒ.finite.toFinset \ insert A₀ S = (hℒ.finite.toFinset \ S).erase A₀ := by + ext B + simp only [Finset.mem_sdiff, Finset.mem_insert, not_or, Finset.mem_erase] + tauto + have hunion_eq : + (mapInlRooted (RootedHypergraph α β) A₀).toHypergraph ∪ + (placeSumStepSide P.G hℒ S A₀).toHypergraph = + (placeSumStepHypergraph P.G hℒ (insert A₀ S)).toHypergraph := by + change mapInlH _ A₀.toHypergraph ∪ + ((mapInlH _ (rootedLocationCore P.G ℒ) ∪ + biUnion (S.erase A₀) (fun A ↦ mapInlH _ A.toHypergraph)) ∪ + biUnion ((hℒ.finite.toFinset \ S).erase A₀) (fun A ↦ (placeNewEdgeSum A).toHypergraph)) = + (mapInlH _ (rootedLocationCore P.G ℒ) ∪ + biUnion (insert A₀ S) (fun A ↦ mapInlH _ A.toHypergraph)) ∪ + biUnion (hℒ.finite.toFinset \ insert A₀ S) (fun A ↦ (placeNewEdgeSum A).toHypergraph) + rw [Finset.erase_eq_of_notMem hnotMem, hSdiff_insert, biUnion_insert] + simp only [← GM10.union_assoc, + GM10.union_comm (mapInlH _ A₀.toHypergraph) (mapInlH _ (rootedLocationCore P.G ℒ))] + have hA_le : (mapInlRooted (RootedHypergraph α β) A₀).toHypergraph ≤ + (placeSumStepHypergraph P.G hℒ (insert A₀ S)).toHypergraph := + hunion_eq ▸ GM10.le_union_left hle_amb_A hle_amb_B + have hB_le : (placeSumStepSide P.G hℒ S A₀).toHypergraph ≤ + (placeSumStepHypergraph P.G hℒ (insert A₀ S)).toHypergraph := + hunion_eq ▸ GM10.le_union_right hle_amb_A hle_amb_B + have hdisjE : Disjoint (mapInlRooted (RootedHypergraph α β) A₀).edgeSet + (placeSumStepSide P.G hℒ S A₀).edgeSet := by + rw [Set.disjoint_left] + rintro _ ⟨e₀, he₀, rfl⟩ ((⟨e₁, he₁, hEq⟩ | he_S) | he_sdiff) + · cases hEq + exact (mem_rootedLocationCore_edgeSet_iff.1 he₁).2 A₀ hA₀_ℒ he₀ + · simp only [biUnion, Set.mem_iUnion, mapInlH, mapInl, Set.mem_image] at he_S + rcases he_S with ⟨A, hA_erase, e₁, he₁, hEq⟩ + cases hEq + have hA_ℒ : A ∈ ℒ := hℒ.finite.mem_toFinset.1 (hS' (Finset.mem_of_mem_erase hA_erase)) + have hne : A ≠ A₀ := Finset.ne_of_mem_erase hA_erase + have hle_comp := hℒ.le_complement hA_ℒ hA₀_ℒ hne + exact (hle_comp.edgeSet_subset he₁).2 he₀ + · simp only [biUnion, Set.mem_iUnion, placeNewEdgeSum, Set.mem_singleton_iff, + reduceCtorEq, exists_false] at he_sdiff + have hroot_core : A₀.rootSet ⊆ (rootedLocationCore P.G ℒ).vertexSet := + mem_rootSet_subset_rootedLocationCore hℒ hA₀_ℒ + have hcore_B : (rootedLocationCore P.G ℒ).vertexSet ⊆ + (placeSumStepSide P.G hℒ S A₀).vertexSet := fun _ hv ↦ Or.inl (Or.inl hv) + refine ⟨⟨hA_le, hB_le, hunion_eq, Set.disjoint_iff_inter_eq_empty.1 hdisjE⟩, rfl, ?_⟩ + ext v + change v ∈ A₀.rootSet ↔ v ∈ A₀.vertexSet ∧ v ∈ (placeSumStepSide P.G hℒ S A₀).vertexSet + constructor + · intro hv + exact ⟨A₀.roots_subset v hv, hcore_B (hroot_core hv)⟩ + · rintro ⟨hvA₀, (hv_core | hv_S) | hv_sdiff⟩ + · exact ((mem_rootedLocationCore_vertexSet_iff hℒ).1 hv_core).2 A₀ hA₀_ℒ hvA₀ + · simp only [biUnion, Set.mem_iUnion] at hv_S + rcases hv_S with ⟨A, hA_erase, hvA⟩ + have hA_ℒ : A ∈ ℒ := hℒ.finite.mem_toFinset.1 (hS' (Finset.mem_of_mem_erase hA_erase)) + have hne : A ≠ A₀ := Finset.ne_of_mem_erase hA_erase + have hle_comp := hℒ.le_complement hA_ℒ hA₀_ℒ hne + exact (hle_comp.vertexSet_subset hvA).resolve_left fun h1 ↦ h1.2 hvA₀ + · simp only [biUnion, Set.mem_iUnion] at hv_sdiff + rcases hv_sdiff with ⟨A, hA_erase, hvA_root⟩ + have hA_ℒ : A ∈ ℒ := + hℒ.finite.mem_toFinset.1 (Finset.sdiff_subset (Finset.mem_of_mem_erase hA_erase)) + have hne : A ≠ A₀ := Finset.ne_of_mem_erase hA_erase + have hle_comp := hℒ.le_complement hA_ℒ hA₀_ℒ hne + exact (hle_comp.vertexSet_subset (A.roots_subset v hvA_root)).resolve_left fun h1 ↦ h1.2 hvA₀ + +open Classical in +theorem isSeparation_placeSumStep_sdiff (P : UnlabeledPatchwork α β) + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation P.G ℒ) + {S : Finset (RootedHypergraph α β)} {A₀ : RootedHypergraph α β} + (hS : insert A₀ S ⊆ hℒ.finite.toFinset) (hnotMem : A₀ ∉ S) : + have hS' : S ⊆ hℒ.finite.toFinset := (Finset.subset_insert A₀ S).trans hS + (placeSumStepPatchwork P hℒ S hS').G.IsSeparation + (placeNewEdgeSum A₀) + (placeSumStepSide P.G hℒ S A₀) := by + intro hS' + have hA₀_fin : A₀ ∈ hℒ.finite.toFinset := hS (Finset.mem_insert_self A₀ S) + have hA₀_ℒ : A₀ ∈ ℒ := hℒ.finite.mem_toFinset.1 hA₀_fin + have hA₀_sdiff : A₀ ∈ hℒ.finite.toFinset \ S := Finset.mem_sdiff.2 ⟨hA₀_fin, hnotMem⟩ + have hle_amb_B := placeSumStepSide_le_ambient hℒ hS' A₀ + have hle_amb_A : (placeNewEdgeSum A₀).toHypergraph ≤ placeSumAmbient P.G hℒ := + placeNewEdgeSum_le_placeSumAmbient hℒ hA₀_ℒ + have hInsert_erase : insert A₀ ((hℒ.finite.toFinset \ S).erase A₀) = hℒ.finite.toFinset \ S := + Finset.insert_erase hA₀_sdiff + have hunion_eq : + (placeNewEdgeSum A₀).toHypergraph ∪ + (placeSumStepSide P.G hℒ S A₀).toHypergraph = + (placeSumStepHypergraph P.G hℒ S).toHypergraph := by + change (placeNewEdgeSum A₀).toHypergraph ∪ + ((mapInlH _ (rootedLocationCore P.G ℒ) ∪ + biUnion (S.erase A₀) (fun A ↦ mapInlH _ A.toHypergraph)) ∪ + biUnion ((hℒ.finite.toFinset \ S).erase A₀) (fun A ↦ (placeNewEdgeSum A).toHypergraph)) = + (mapInlH _ (rootedLocationCore P.G ℒ) ∪ + biUnion S (fun A ↦ mapInlH _ A.toHypergraph)) ∪ + biUnion (hℒ.finite.toFinset \ S) (fun A ↦ (placeNewEdgeSum A).toHypergraph) + conv_rhs => rw [← hInsert_erase, biUnion_insert] + rw [Finset.erase_eq_of_notMem hnotMem, ← GM10.union_assoc, + GM10.union_comm (placeNewEdgeSum A₀).toHypergraph, GM10.union_assoc] + have hA_le : (placeNewEdgeSum A₀).toHypergraph ≤ + (placeSumStepHypergraph P.G hℒ S).toHypergraph := + hunion_eq ▸ GM10.le_union_left hle_amb_A hle_amb_B + have hB_le : (placeSumStepSide P.G hℒ S A₀).toHypergraph ≤ + (placeSumStepHypergraph P.G hℒ S).toHypergraph := + hunion_eq ▸ GM10.le_union_right hle_amb_A hle_amb_B + have hdisjE : Disjoint (placeNewEdgeSum A₀).edgeSet + (placeSumStepSide P.G hℒ S A₀).edgeSet := by + rw [Set.disjoint_left] + rintro _ rfl ((⟨_, _, hEq⟩ | he_S) | he_sdiff) + · cases hEq + · simp only [biUnion, Set.mem_iUnion, mapInlH, mapInl, Set.mem_image, reduceCtorEq, and_false, + exists_false] at he_S + · simp only [biUnion, Set.mem_iUnion, placeNewEdgeSum, Set.mem_singleton_iff, + Sum.inr.injEq] at he_sdiff + rcases he_sdiff with ⟨A, hA_erase, rfl⟩ + exact Finset.ne_of_mem_erase hA_erase rfl + have hroot_core : A₀.rootSet ⊆ (rootedLocationCore P.G ℒ).vertexSet := + mem_rootSet_subset_rootedLocationCore hℒ hA₀_ℒ + have hcore_B : (rootedLocationCore P.G ℒ).vertexSet ⊆ + (placeSumStepSide P.G hℒ S A₀).vertexSet := fun _ hv ↦ Or.inl (Or.inl hv) + refine ⟨⟨hA_le, hB_le, hunion_eq, Set.disjoint_iff_inter_eq_empty.1 hdisjE⟩, rfl, ?_⟩ + ext v + change v ∈ A₀.rootSet ↔ v ∈ A₀.rootSet ∧ v ∈ (placeSumStepSide P.G hℒ S A₀).vertexSet + exact ⟨fun hv ↦ ⟨hv, hcore_B (hroot_core hv)⟩, fun h ↦ h.1⟩ + +open Classical in +/-- Claim (1) in the proof of (5.4) (Graph Minors XVIII, Section 5, page 94): +`gr(P₁ | A_j) = gr(P₂ | A'_j)`, where `A_j` is `mapInlRooted _ A₀` in `P_{insert A₀ S}` and `A'_j` +is +`placeNewEdgeSum A₀` in `P_S`. -/ +theorem lemma_5_4_claim_1 (P : UnlabeledPatchwork α β) + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation P.G ℒ) + {S : Finset (RootedHypergraph α β)} {A₀ : RootedHypergraph α β} + (hS : insert A₀ S ⊆ hℒ.finite.toFinset) + (hS' : S ⊆ hℒ.finite.toFinset) + (hnotMem : A₀ ∉ S) : + feasibleGroupings + ((placeSumStepPatchwork P hℒ (insert A₀ S) hS).restrict (mapInlRooted _ A₀)) = + feasibleGroupings + ((placeSumStepPatchwork P hℒ S hS').restrict (placeNewEdgeSum A₀)) := by + have hA₀_fin : A₀ ∈ hℒ.finite.toFinset := hS (Finset.mem_insert_self A₀ S) + have hA₀_ℒ : A₀ ∈ ℒ := hℒ.finite.mem_toFinset.1 hA₀_fin + have hsep_ins := isSeparation_placeSumStep_insert P hℒ hS hnotMem + have hsep_sd := isSeparation_placeSumStep_sdiff P hℒ hS hnotMem + have h₁ : feasibleGroupings (P.restrict A₀) = + feasibleGroupings + ((placeSumStepPatchwork P hℒ (insert A₀ S) hS).restrict (mapInlRooted _ A₀)) := by + refine feasibleGroupings_eq_of_edge_bij (P.restrict A₀) + ((placeSumStepPatchwork P hℒ (insert A₀ S) hS).restrict (mapInlRooted _ A₀)) + Sum.inl rfl rfl rfl Sum.inl_injective.injOn ?_ + intro e he + rw [(placeSumStepPatchwork P hℒ (insert A₀ S) hS).restrict_Δ hsep_ins.isSeparation.left_le + ⟨e, he, rfl⟩, P.restrict_Δ (hℒ.isComplemented hA₀_ℒ).le he] + rfl + have h₂ : feasibleGroupings + ((placeSumStepPatchwork P hℒ S hS').restrict (placeNewEdgeSum A₀)) = + feasibleGroupings (P.restrict A₀) := by + have hV : ((placeSumStepPatchwork P hℒ S hS').restrict (placeNewEdgeSum A₀)).G.vertexSet = + ((placeSumStepPatchwork P hℒ S hS').restrict (placeNewEdgeSum A₀)).G.rootSet := rfl + have hE : ((placeSumStepPatchwork P hℒ S hS').restrict (placeNewEdgeSum A₀)).G.edgeSet = + {Sum.inr A₀} := rfl + have hends : ((placeSumStepPatchwork P hℒ S hS').restrict (placeNewEdgeSum A₀)).G.ends + (Sum.inr A₀) = + ((placeSumStepPatchwork P hℒ S hS').restrict (placeNewEdgeSum A₀)).G.rootSet := by + ext v + change Sum.inr A₀ = Sum.inr A₀ ∧ v ∈ A₀.rootSet ↔ v ∈ A₀.rootSet + exact ⟨fun h ↦ h.2, fun h ↦ ⟨rfl, h⟩⟩ + refine GM04.Patch.ext rfl (Set.ext fun K ↦ ?_) + change IsFeasibleGrouping + ((placeSumStepPatchwork P hℒ S hS').restrict (placeNewEdgeSum A₀)) K ↔ + K ∈ feasibleGroupings (P.restrict A₀) + rw [isFeasibleGrouping_singleEdge_iff hE hV hends K] + change K ∈ (((placeSumStepPatchwork P hℒ S hS').restrict (placeNewEdgeSum A₀)).Δ + (Sum.inr A₀)).groupings ↔ K ∈ (feasibleGroupings (P.restrict A₀)).groupings + rw [(placeSumStepPatchwork P hℒ S hS').restrict_Δ hsep_sd.isSeparation.left_le + (Set.mem_singleton _)] + rfl + rw [← h₁, h₂] + +open Classical in +/-- By induction on `S ⊆ ℒ`, `feasibleGroupings (placeSumStepPatchwork P hℒ S hS)` equals +`feasibleGroupings (placeSumStepPatchwork P hℒ ∅ _)` (proof of (5.4), page 94). -/ +theorem feasibleGroupings_placeSumStepPatchwork (P : UnlabeledPatchwork α β) + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation P.G ℒ) + (S : Finset (RootedHypergraph α β)) (hS : S ⊆ hℒ.finite.toFinset) : + feasibleGroupings (placeSumStepPatchwork P hℒ S hS) = + feasibleGroupings (placeSumStepPatchwork P hℒ ∅ (Finset.empty_subset _)) := by + induction S using Finset.induction_on with + | empty => rfl + | @insert A₀ S hnotMem ih => + have hS' : S ⊆ hℒ.finite.toFinset := (Finset.subset_insert A₀ S).trans hS + rw [← ih hS'] + refine feasibleGroupings_eq_of_theorem_5_2 + (isSeparation_placeSumStep_insert P hℒ hS hnotMem) + (isSeparation_placeSumStep_sdiff P hℒ hS hnotMem) + rfl (fun _ _ ↦ rfl) (lemma_5_4_claim_1 P hℒ hS hS' hnotMem) + +/-- **Graph Minors XVIII, (5.4)** (page 93): +"**5.4.** *Let $P = (G, \mu, \Delta)$ be a patchwork, let $\mathscr{L}$ be a rooted location in +$G$, and let $P' = (G', \mu', \Delta')$ be the heart of $(P, \mathscr{L})$. Then* +$$V(G) \setminus \bar{\pi}(G) = (V(G') \setminus \bar{\pi}(G')) \cup \bigcup_{A \in \mathscr{L}} +(V(A) \setminus \bar{\pi}(A)),$$ +*and $gr(P) = gr(P')$.*" -/ +theorem theorem_5_4_proof {P P' : UnlabeledPatchwork α β} + {ℒ : Set (RootedHypergraph α β)} {newEdge : RootedHypergraph α β → β} + (hP' : IsPatchworkHeart P ℒ newEdge P') : + P.G.vertexSet \ P.G.rootSet = + (P'.G.vertexSet \ P'.G.rootSet) ∪ (⋃ A ∈ ℒ, A.vertexSet \ A.rootSet) ∧ + feasibleGroupings P = feasibleGroupings P' := by + classical + have hℒ := hP'.isRootedLocation + refine ⟨theorem_5_4_vertexSet hP', ?_⟩ + have h_top : feasibleGroupings P = + feasibleGroupings (placeSumStepPatchwork P hℒ hℒ.finite.toFinset Finset.Subset.rfl) := by + refine feasibleGroupings_eq_of_edge_bij P + (placeSumStepPatchwork P hℒ hℒ.finite.toFinset Finset.Subset.rfl) + Sum.inl ?_ rfl ?_ Sum.inl_injective.injOn (fun _ _ ↦ rfl) + · rw [placeSumStepPatchwork_G] + ext v + change v ∈ P.G.vertexSet ↔ + (v ∈ (rootedLocationCore P.G ℒ).vertexSet ∨ + v ∈ (biUnion hℒ.finite.toFinset + (fun A : RootedHypergraph α β ↦ mapInlH _ A.toHypergraph)).vertexSet) ∨ + v ∈ (biUnion (hℒ.finite.toFinset \ hℒ.finite.toFinset) + (fun A : RootedHypergraph α β ↦ (placeNewEdgeSum A).toHypergraph)).vertexSet + simp only [Finset.sdiff_self, biUnion, Finset.notMem_empty, Set.iUnion_of_empty, + Set.iUnion_empty, Set.mem_empty_iff_false, or_false, Set.mem_iUnion, + Set.Finite.mem_toFinset, mapInlH, mapInl] + constructor + · intro hv + by_cases hcore : v ∈ (rootedLocationCore P.G ℒ).vertexSet + · exact Or.inl hcore + · rw [mem_rootedLocationCore_vertexSet_iff hℒ, not_and, not_forall] at hcore + rcases hcore hv with ⟨A, hA⟩ + rw [Classical.not_imp] at hA + rcases hA with ⟨hA_ℒ, hA_imp⟩ + rw [Classical.not_imp] at hA_imp + exact Or.inr ⟨A, hA_ℒ, hA_imp.1⟩ + · rintro (hcore | ⟨A, hA, hvA⟩) + · exact ((mem_rootedLocationCore_vertexSet_iff hℒ).1 hcore).1 + · exact (hℒ.isComplemented hA).le.vertexSet_subset hvA + · rw [placeSumStepPatchwork_G] + ext e + change e ∈ Sum.inl '' P.G.edgeSet ↔ + (e ∈ Sum.inl '' (rootedLocationCore P.G ℒ).edgeSet ∨ + e ∈ (biUnion hℒ.finite.toFinset + (fun A : RootedHypergraph α β ↦ mapInlH _ A.toHypergraph)).edgeSet) ∨ + e ∈ (biUnion (hℒ.finite.toFinset \ hℒ.finite.toFinset) + (fun A : RootedHypergraph α β ↦ (placeNewEdgeSum A).toHypergraph)).edgeSet + simp only [Finset.sdiff_self, biUnion, Finset.notMem_empty, Set.iUnion_of_empty, + Set.iUnion_empty, Set.mem_empty_iff_false, or_false, Set.mem_iUnion, + Set.Finite.mem_toFinset, mapInlH, mapInl, Set.mem_image] + constructor + · rintro ⟨e₀, he₀, rfl⟩ + by_cases hcore : e₀ ∈ (rootedLocationCore P.G ℒ).edgeSet + · exact Or.inl ⟨e₀, hcore, rfl⟩ + · rw [mem_rootedLocationCore_edgeSet_iff, not_and, not_forall] at hcore + rcases hcore he₀ with ⟨A, hA⟩ + rw [Classical.not_imp, not_not] at hA + exact Or.inr ⟨A, hA.1, e₀, hA.2, rfl⟩ + · rintro (⟨e₀, hcore, rfl⟩ | ⟨A, hA, e₀, heA, rfl⟩) + · exact ⟨e₀, (mem_rootedLocationCore_edgeSet_iff.1 hcore).1, rfl⟩ + · exact ⟨e₀, (hℒ.isComplemented hA).le.edgeSet_subset heA, rfl⟩ + have hE_bot : (placeSumStepHypergraph P.G hℒ ∅).edgeSet = + (Sum.inl '' (rootedLocationCore P.G ℒ).edgeSet) ∪ (Sum.inr '' ℒ) := by + ext e + change (e ∈ Sum.inl '' (rootedLocationCore P.G ℒ).edgeSet ∨ + e ∈ (biUnion ∅ + (fun A : RootedHypergraph α β ↦ mapInlH _ A.toHypergraph)).edgeSet) ∨ + e ∈ (biUnion (hℒ.finite.toFinset \ ∅) + (fun A : RootedHypergraph α β ↦ (placeNewEdgeSum A).toHypergraph)).edgeSet ↔ + e ∈ (Sum.inl '' (rootedLocationCore P.G ℒ).edgeSet) ∪ (Sum.inr '' ℒ) + simp only [Finset.sdiff_empty, biUnion, Finset.notMem_empty, Set.iUnion_of_empty, + Set.iUnion_empty, Set.mem_empty_iff_false, or_false, Set.mem_union, Set.mem_iUnion, + Set.Finite.mem_toFinset, placeNewEdgeSum, Set.mem_singleton_iff, Set.mem_image] + exact or_congr_right ⟨fun ⟨A, hA, hEq⟩ ↦ ⟨A, hA, hEq.symm⟩, + fun ⟨A, hA, hEq⟩ ↦ ⟨A, hA, hEq.symm⟩⟩ + have h_bot : feasibleGroupings (placeSumStepPatchwork P hℒ ∅ (Finset.empty_subset _)) = + feasibleGroupings P' := by + refine feasibleGroupings_eq_of_edge_bij + (placeSumStepPatchwork P hℒ ∅ (Finset.empty_subset _)) P' + (Sum.elim id newEdge) ?_ ?_ ?_ ?_ ?_ + · rw [placeSumStepPatchwork_G, hP'.vertexSet_eq] + ext v + change (v ∈ (rootedLocationCore P.G ℒ).vertexSet ∨ + v ∈ (biUnion ∅ + (fun A : RootedHypergraph α β ↦ mapInlH _ A.toHypergraph)).vertexSet) ∨ + v ∈ (biUnion (hℒ.finite.toFinset \ ∅) + (fun A : RootedHypergraph α β ↦ (placeNewEdgeSum A).toHypergraph)).vertexSet ↔ + v ∈ (rootedLocationCore P.G ℒ).vertexSet + simp only [Finset.sdiff_empty, biUnion, Finset.notMem_empty, Set.iUnion_of_empty, + Set.iUnion_empty, Set.mem_empty_iff_false, or_false, Set.mem_iUnion, + Set.Finite.mem_toFinset, placeNewEdgeSum] + refine ⟨?_, fun hv ↦ Or.inl hv⟩ + rintro (hv | ⟨A, hA, hvA⟩) + · exact hv + · exact mem_rootSet_subset_rootedLocationCore hℒ hA hvA + · rw [placeSumStepPatchwork_G] + ext v + change v ∈ P.G.roots ↔ v ∈ P'.G.roots + rw [hP'.roots_eq] + · rw [placeSumStepPatchwork_G, hE_bot, hP'.edgeSet_eq, Set.image_union, + ← Set.image_comp, ← Set.image_comp] + change id '' (rootedLocationCore P.G ℒ).edgeSet ∪ newEdge '' ℒ = _ + rw [Set.image_id] + · rw [placeSumStepPatchwork_G, hE_bot] + rintro x (⟨e₁, he₁, rfl⟩ | ⟨A₁, hA₁, rfl⟩) y (⟨e₂, he₂, rfl⟩ | ⟨A₂, hA₂, rfl⟩) hEq + · exact congrArg Sum.inl hEq + · exfalso + change e₁ = newEdge A₂ at hEq + exact hP'.newEdge_notMem_core hA₂ (hEq ▸ he₁) + · exfalso + change newEdge A₁ = e₂ at hEq + exact hP'.newEdge_notMem_core hA₁ (hEq.symm ▸ he₂) + · exact congrArg Sum.inr (hP'.injOn_newEdge hA₁ hA₂ hEq) + · rw [placeSumStepPatchwork_G] + intro x hx + rw [hE_bot] at hx + rcases hx with ⟨e₀, he₀, rfl⟩ | ⟨A, hA, rfl⟩ + · rw [placeSumStepPatchwork_Δ_inl] + exact hP'.Δ_core he₀ + · rw [placeSumStepPatchwork_Δ_inr] + exact hP'.Δ_newEdge hA + rw [h_top, feasibleGroupings_placeSumStepPatchwork P hℒ hℒ.finite.toFinset Finset.Subset.rfl, + h_bot] + +end GraphMinor.GM18 +end diff --git a/LeanPool/GraphMinor/GM18/Section5Part2.lean b/LeanPool/GraphMinor/GM18/Section5Part2.lean new file mode 100644 index 0000000000..a59c5b9b96 --- /dev/null +++ b/LeanPool/GraphMinor/GM18/Section5Part2.lean @@ -0,0 +1,1484 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM18.Section5Part1 + +/-! +# Graph Minors XVIII, Section 5 (Part 2): Place Hearts and Enlargements by Tree-Width (5.5) + +This file formalizes the partial-label form of (5.5) (pages 95–98) of Robertson and Seymour, +*Graph Minors. XVIII. Tree-decompositions and well-quasi-ordering*, J. Combin. Theory Ser. B 89 +(2003) 77–108, together with its six claims `lemma_5_5_claim_1`–`lemma_5_5_claim_6` and general +constructions for hearts of partial `Ω`-places (`mkPlaceHeart`). +-/ + +public section + +namespace GraphMinor.GM18 + +open Hypergraph SimpleGraph + +universe u v w + +variable {α : Type u} {β : Type v} {Ω : Type w} + +/-! ## General construction and equivalence of place hearts -/ + +/-- From any `IsPlaceHeart P ℒ newEdge P'`, the underlying unlabeled patchworks satisfy +`IsPatchworkHeart P.toUnlabeled ℒ newEdge P'.toUnlabeled`. -/ +theorem IsPlaceHeart.toIsPatchworkHeart {P P' : PartialPatchwork Ω α β} + {ℒ : Set (RootedHypergraph α β)} {newEdge : RootedHypergraph α β → β} + (h : IsPlaceHeart P ℒ newEdge P') : + IsPatchworkHeart P.toUnlabeled ℒ newEdge P'.toUnlabeled where + isRootedLocation := h.isRootedLocation + injOn_newEdge := h.injOn_newEdge + newEdge_notMem_core := h.newEdge_notMem_core + vertexSet_eq := h.vertexSet_eq + edgeSet_eq := h.edgeSet_eq + roots_eq := h.roots_eq + ends_core := h.ends_core + ends_newEdge := h.ends_newEdge + dom_eq := h.dom_eq + μ_core := h.μ_core + μ_newEdge := h.μ_newEdge + Δ_core := h.Δ_core + Δ_newEdge := h.Δ_newEdge + +/-- `feasibleGroupings P.toUnlabeled = feasibleGroupings P`. -/ +@[simp] theorem feasibleGroupings_toUnlabeled (P : GM04.Patchwork Ω α β) : + feasibleGroupings P.toUnlabeled = feasibleGroupings P := rfl + +/-- Version of `theorem_5_4_proof` for `IsPlaceHeart` on `PartialPatchwork`. -/ +theorem theorem_5_4_place {P P' : PartialPatchwork Ω α β} + {ℒ : Set (RootedHypergraph α β)} {newEdge : RootedHypergraph α β → β} + (hP' : IsPlaceHeart P ℒ newEdge P') : + P.G.vertexSet \ P.G.rootSet = + (P'.G.vertexSet \ P'.G.rootSet) ∪ (⋃ A ∈ ℒ, A.vertexSet \ A.rootSet) ∧ + feasibleGroupings P = feasibleGroupings P' := + theorem_5_4_proof hP'.toIsPatchworkHeart + +/-- Extensionality for `RootedHypergraph`: two rooted hypergraphs with the same `toHypergraph` and +`roots` are equal. -/ +theorem RootedHypergraph.ext_iff {G₁ G₂ : RootedHypergraph α β} : + G₁ = G₂ ↔ G₁.toHypergraph = G₂.toHypergraph ∧ G₁.roots = G₂.roots := by + cases G₁ + cases G₂ + simp + +theorem RootedHypergraph.ext {G₁ G₂ : RootedHypergraph α β} + (hH : G₁.toHypergraph = G₂.toHypergraph) (hr : G₁.roots = G₂.roots) : + G₁ = G₂ := + RootedHypergraph.ext_iff.2 ⟨hH, hr⟩ + +/-- Two hypergraphs with the same `vertexSet`, `edgeSet`, and `ends` on `edgeSet` are equal. -/ +theorem hypergraph_ext_of_ends_eq {H₁ H₂ : Hypergraph α β} + (hV : H₁.vertexSet = H₂.vertexSet) (hE : H₁.edgeSet = H₂.edgeSet) + (hends : ∀ e ∈ H₁.edgeSet, H₁.ends e = H₂.ends e) : + H₁ = H₂ := by + apply Hypergraph.ext hV hE + ext e v + constructor + · intro hinc + have he : e ∈ H₁.edgeSet := H₁.edge_mem_of_inc hinc + change v ∈ H₂.ends e + rw [← hends e he] + exact hinc + · intro hinc + have he : e ∈ H₁.edgeSet := hE.symm ▸ H₂.edge_mem_of_inc hinc + change v ∈ H₁.ends e + rw [hends e he] + exact hinc + +/-- Equivalence of `Ω`-patchworks in the sense of the paper (`G₁ = G₂`, `dom(μ₁) = dom(μ₂)`, +`μ₁(e) = μ₂(e)` for `e ∈ dom(μ₁)`, `Δ₁(e) = Δ₂(e)` and `φ₁(e) = φ₂(e)` for `e ∈ E(G₁)`). -/ +structure PatchworkEquiv (P₁ P₂ : GM04.Patchwork Ω α β) : Prop where + G_eq : P₁.G = P₂.G + dom_eq : P₁.dom = P₂.dom + μ_eq : ∀ ⦃e⦄, e ∈ P₁.dom → P₁.μ e = P₂.μ e + Δ_eq : ∀ ⦃e⦄, e ∈ P₁.G.edgeSet → P₁.Δ e = P₂.Δ e + φ_eq : ∀ ⦃e⦄, e ∈ P₁.G.edgeSet → P₁.φ e = P₂.φ e + +theorem PatchworkEquiv.refl (P : GM04.Patchwork Ω α β) : PatchworkEquiv P P where + G_eq := rfl + dom_eq := rfl + μ_eq _ _ := rfl + Δ_eq _ _ := rfl + φ_eq _ _ := rfl + +theorem PatchworkEquiv.symm {P₁ P₂ : GM04.Patchwork Ω α β} (h : PatchworkEquiv P₁ P₂) : + PatchworkEquiv P₂ P₁ where + G_eq := h.G_eq.symm + dom_eq := h.dom_eq.symm + μ_eq _ he := (h.μ_eq (h.dom_eq.symm ▸ he)).symm + Δ_eq _ he := (h.Δ_eq (h.G_eq.symm ▸ he)).symm + φ_eq _ he := (h.φ_eq (h.G_eq.symm ▸ he)).symm + +theorem PatchworkEquiv.trans {P₁ P₂ P₃ : GM04.Patchwork Ω α β} + (h₁₂ : PatchworkEquiv P₁ P₂) (h₂₃ : PatchworkEquiv P₂ P₃) : + PatchworkEquiv P₁ P₃ where + G_eq := h₁₂.G_eq.trans h₂₃.G_eq + dom_eq := h₁₂.dom_eq.trans h₂₃.dom_eq + μ_eq _ he := (h₁₂.μ_eq he).trans (h₂₃.μ_eq (h₁₂.dom_eq ▸ he)) + Δ_eq _ he := (h₁₂.Δ_eq he).trans (h₂₃.Δ_eq (h₁₂.G_eq ▸ he)) + φ_eq _ he := (h₁₂.φ_eq he).trans (h₂₃.φ_eq (h₁₂.G_eq ▸ he)) + +theorem PatchworkEquiv.feasibleGroupings_eq {P₁ P₂ : GM04.Patchwork Ω α β} + (h : PatchworkEquiv P₁ P₂) : + feasibleGroupings P₁ = feasibleGroupings P₂ := by + let _ : Preorder Unit := inferInstance + exact feasibleGroupings_eq_of_edge_bij P₁.toUnlabeled P₂.toUnlabeled id + (congrArg (fun G : RootedHypergraph α β ↦ G.vertexSet) h.G_eq) + (congrArg RootedHypergraph.rootSet h.G_eq) + (by rw [Set.image_id]; exact congrArg (fun G : RootedHypergraph α β ↦ G.edgeSet) h.G_eq) + Function.injective_id.injOn + (fun _ he ↦ (h.Δ_eq he).symm) + +theorem PatchworkEquiv.isExpansion_congr [Preorder Ω] {α' β' : Type*} + {P₁ P₂ : GM04.Patchwork Ω α β} {P'₁ P'₂ : GM04.Patchwork Ω α' β'} + {ηv : α → Set α'} {ηe : β → β'} + (hP : PatchworkEquiv P₁ P₂) (hP' : PatchworkEquiv P'₁ P'₂) + (h : GM04.IsExpansion P₁ P'₁ ηv ηe) : + GM04.IsExpansion P₂ P'₂ ηv ηe where + vertex_nonempty v hv := h.vertex_nonempty v (hP.G_eq.symm ▸ hv) + vertex_subset v hv := hP'.G_eq ▸ h.vertex_subset v (hP.G_eq.symm ▸ hv) + edge_mem e he := hP'.G_eq ▸ h.edge_mem e (hP.G_eq.symm ▸ he) + vertex_disjoint v₁ hv₁ v₂ hv₂ hne := + h.vertex_disjoint v₁ (hP.G_eq.symm ▸ hv₁) v₂ (hP.G_eq.symm ▸ hv₂) hne + edge_injOn := hP.G_eq ▸ h.edge_injOn + mem_dom_iff e he := by + rw [← hP.dom_eq, ← hP'.dom_eq] + exact h.mem_dom_iff e (hP.G_eq.symm ▸ he) + ends_nonempty e he hnd v hinc := by + have he₁ : e ∈ P₁.G.edgeSet := hP.G_eq.symm ▸ he + have hnd₁ : e ∉ P₁.dom := hP.dom_eq.symm ▸ hnd + have hinc₁ : P₁.G.Inc e v := hP.G_eq.symm ▸ hinc + obtain ⟨v', hv', hinc'⟩ := h.ends_nonempty e he₁ hnd₁ v hinc₁ + exact ⟨v', hv', hP'.G_eq ▸ hinc'⟩ + μ_length e he := by + have he₁ : e ∈ P₁.dom := hP.dom_eq.symm ▸ he + have heE₁ : e ∈ P₁.G.edgeSet := P₁.dom_subset he₁ + have he'₁ : ηe e ∈ P'₁.dom := (h.mem_dom_iff e heE₁).1 he₁ + rw [← hP.μ_eq he₁, ← hP'.μ_eq he'₁] + exact h.μ_length e he₁ + μ_mem e he i hi hi' := by + have he₁ : e ∈ P₁.dom := hP.dom_eq.symm ▸ he + have heE₁ : e ∈ P₁.G.edgeSet := P₁.dom_subset he₁ + have he'₁ : ηe e ∈ P'₁.dom := (h.mem_dom_iff e heE₁).1 he₁ + have hi₁ : i < (P₁.μ e).length := (hP.μ_eq he₁).symm ▸ hi + have hi'₁ : i < (P'₁.μ (ηe e)).length := (hP'.μ_eq he'₁).symm ▸ hi' + have hmem := h.μ_mem e he₁ i hi₁ hi'₁ + simpa [hP.μ_eq he₁, hP'.μ_eq he'₁] using hmem + roots_length := by + rw [← hP.G_eq, ← hP'.G_eq] + exact h.roots_length + roots_mem i hi hi' := by + have hi₁ : i < P₁.G.roots.length := hP.G_eq.symm ▸ hi + have hi'₁ : i < P'₁.G.roots.length := hP'.G_eq.symm ▸ hi' + have hmem := h.roots_mem i hi₁ hi'₁ + simpa [hP.G_eq, hP'.G_eq] using hmem + maps_Δ e he := by + have he₁ : e ∈ P₁.dom := hP.dom_eq.symm ▸ he + have heE₁ : e ∈ P₁.G.edgeSet := P₁.dom_subset he₁ + have he'₁ : ηe e ∈ P'₁.dom := (h.mem_dom_iff e heE₁).1 he₁ + have he'E₁ : ηe e ∈ P'₁.G.edgeSet := h.edge_mem e heE₁ + rw [← hP.μ_eq he₁, ← hP'.μ_eq he'₁, ← hP.Δ_eq heE₁, ← hP'.Δ_eq he'E₁] + exact h.maps_Δ e he₁ + φ_le e he := by + have heE₁ : e ∈ P₁.G.edgeSet := hP.G_eq.symm ▸ he + have he'E₁ : ηe e ∈ P'₁.G.edgeSet := h.edge_mem e heE₁ + rw [← hP.φ_eq heE₁, ← hP'.φ_eq he'E₁] + exact h.φ_le e heE₁ + +theorem PatchworkEquiv.isRealizableExpansion_congr [Preorder Ω] {α' β' : Type*} + {P₁ P₂ : GM04.Patchwork Ω α β} {P'₁ P'₂ : GM04.Patchwork Ω α' β'} + {ηv : α → Set α'} {ηe : β → β'} + (hP : PatchworkEquiv P₁ P₂) (hP' : PatchworkEquiv P'₁ P'₂) + (h : GM04.IsRealizableExpansion P₁ P'₁ ηv ηe) : + GM04.IsRealizableExpansion P₂ P'₂ ηv ηe := by + obtain ⟨hexp, H, ⟨⟨δ, hδ, hH⟩, hcomp⟩⟩ := h + refine ⟨PatchworkEquiv.isExpansion_congr hP hP' hexp, H, + ⟨⟨δ, fun e he ↦ ?_, ?_⟩, fun v hv ↦ hcomp v (hP.G_eq.symm ▸ hv)⟩⟩ + · have he₁ : e ∈ (P'₁.deleteEdges (ηe '' P₁.G.edgeSet)).G.edgeSet := by + simpa [GM04.Patchwork.deleteEdges, RootedHypergraph.deleteEdges, Hypergraph.deleteEdges, + hP.G_eq, hP'.G_eq] using he + have hmem := hδ e he₁ + change δ e ∈ P'₂.Δ e + rw [← hP'.Δ_eq he₁.1] + exact hmem + · simpa [GM04.Patchwork.deleteEdges, RootedHypergraph.deleteEdges, Hypergraph.deleteEdges, + hP.G_eq, hP'.G_eq] using hH + +open Classical in +/-- The underlying rooted hypergraph `G'` of the heart `P | ℒ` using `newEdge`. -/ +@[expose] noncomputable def mkPlaceHeartHypergraph (G : RootedHypergraph α β) + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) + (newEdge : RootedHypergraph α β → β) : + RootedHypergraph α β where + toHypergraph := + { vertexSet := (rootedLocationCore G ℒ).vertexSet + edgeSet := (rootedLocationCore G ℒ).edgeSet ∪ (newEdge '' ℒ) + Inc e v := + (e ∈ (rootedLocationCore G ℒ).edgeSet ∧ G.Inc e v) ∨ + (∃ A ∈ ℒ, newEdge A = e ∧ v ∈ A.rootSet) + vertex_mem_of_inc e v h := by + rcases h with ⟨he, hinc⟩ | ⟨A, hA, _, hv⟩ + · have hle : rootedLocationCore G ℒ ≤ G.toHypergraph := locationCore_le hℒ.isLocation + have hv_ends : v ∈ (rootedLocationCore G ℒ).ends e := by + rw [← hle.ends_eq e he] + exact hinc + exact (rootedLocationCore G ℒ).vertex_mem_of_inc hv_ends + · exact mem_rootSet_subset_rootedLocationCore hℒ hA hv + edge_mem_of_inc _ _ h := by + rcases h with ⟨he, _⟩ | ⟨A, hA, rfl, _⟩ + · exact Or.inl he + · exact Or.inr ⟨A, hA, rfl⟩ + vertexSet_finite := (rootedLocationCore G ℒ).vertexSet_finite + edgeSet_finite := + (rootedLocationCore G ℒ).edgeSet_finite.union (hℒ.finite.image newEdge) } + roots := G.roots + roots_nodup := G.roots_nodup + roots_subset _ hv := rootSet_subset_rootedLocationCore hℒ hv + +open Classical in +/-- Explicit construction of the heart `P | ℒ` of a partial `Ω`-place `(P, ℒ)` using new elements +`newEdge` (Graph Minors XVIII, Section 5, pages 93–94). -/ +@[expose] noncomputable def mkPlaceHeart (P : PartialPatchwork Ω α β) + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation P.G ℒ) + (newEdge : RootedHypergraph α β → β) + (hinj : Set.InjOn newEdge ℒ) + (hnotMem : ∀ ⦃A⦄, A ∈ ℒ → newEdge A ∉ (rootedLocationCore P.G ℒ).edgeSet) : + PartialPatchwork Ω α β where + G := mkPlaceHeartHypergraph P.G hℒ newEdge + dom := ((rootedLocationCore P.G ℒ).edgeSet ∩ P.dom) ∪ (newEdge '' ℒ) + μ e := if h : ∃ A ∈ ℒ, newEdge A = e then h.choose.roots else P.μ e + Δ e := if h : ∃ A ∈ ℒ, newEdge A = e then feasibleGroupings (P.restrict h.choose) else P.Δ e + φ e := if _ : ∃ A ∈ ℒ, newEdge A = e then ⊥ else P.φ e + dom_subset := by + rintro e (⟨he, _⟩ | ⟨A, hA, rfl⟩) + · exact Or.inl he + · exact Or.inr ⟨A, hA, rfl⟩ + μ_nodup := by + intro e he + by_cases hex : ∃ A ∈ ℒ, newEdge A = e + · simp only [hex, ↓reduceDIte] + exact hex.choose.roots_nodup + · simp only [hex, ↓reduceDIte] + rcases he with ⟨_, hd⟩ | ⟨A, hA, rfl⟩ + · exact P.μ_nodup e hd + · exact (hex ⟨A, hA, rfl⟩).elim + μ_set := by + intro e he + by_cases hex : ∃ A ∈ ℒ, newEdge A = e + · simp only [hex, ↓reduceDIte] + rcases hex with ⟨A, hA, rfl⟩ + have hex' : ∃ A' ∈ ℒ, newEdge A' = newEdge A := ⟨A, hA, rfl⟩ + have hchoose : hex'.choose = A := hinj hex'.choose_spec.1 hA hex'.choose_spec.2 + rw [hchoose] + ext v + change v ∈ A.rootSet ↔ + (newEdge A ∈ (rootedLocationCore P.G ℒ).edgeSet ∧ P.G.Inc (newEdge A) v) ∨ + (∃ A' ∈ ℒ, newEdge A' = newEdge A ∧ v ∈ A'.rootSet) + constructor + · intro hv + exact Or.inr ⟨A, hA, rfl, hv⟩ + · rintro (⟨hcore, _⟩ | ⟨A', hA', hEq, hv⟩) + · exact (hnotMem hA hcore).elim + · rwa [← hinj hA' hA hEq] + · simp only [hex, ↓reduceDIte] + rcases he with ⟨hcore, hd⟩ | ⟨A, hA, rfl⟩ + · rw [P.μ_set e hd] + ext v + change P.G.Inc e v ↔ + (e ∈ (rootedLocationCore P.G ℒ).edgeSet ∧ P.G.Inc e v) ∨ + (∃ A ∈ ℒ, newEdge A = e ∧ v ∈ A.rootSet) + exact ⟨fun hinc ↦ Or.inl ⟨hcore, hinc⟩, + fun h ↦ h.elim (fun h1 ↦ h1.2) + (fun ⟨A, hA, hEq, _⟩ ↦ (hex ⟨A, hA, hEq⟩).elim)⟩ + · exact (hex ⟨A, hA, rfl⟩).elim + Δ_verts := by + intro e he + by_cases hex : ∃ A ∈ ℒ, newEdge A = e + · simp only [hex, ↓reduceDIte] + rcases hex with ⟨A, hA, rfl⟩ + have hex' : ∃ A' ∈ ℒ, newEdge A' = newEdge A := ⟨A, hA, rfl⟩ + have hchoose : hex'.choose = A := hinj hex'.choose_spec.1 hA hex'.choose_spec.2 + rw [hchoose] + ext v + change v ∈ A.rootSet ↔ + (newEdge A ∈ (rootedLocationCore P.G ℒ).edgeSet ∧ P.G.Inc (newEdge A) v) ∨ + (∃ A' ∈ ℒ, newEdge A' = newEdge A ∧ v ∈ A'.rootSet) + exact ⟨fun hv ↦ Or.inr ⟨A, hA, rfl, hv⟩, + fun h ↦ h.elim (fun ⟨hc, _⟩ ↦ (hnotMem hA hc).elim) + (fun ⟨A', hA', hEq, hv⟩ ↦ hinj hA' hA hEq ▸ hv)⟩ + · simp only [hex, ↓reduceDIte] + rcases he with hcore | ⟨A, hA, rfl⟩ + · have heG : e ∈ P.G.edgeSet := (mem_rootedLocationCore_edgeSet_iff.1 hcore).1 + rw [P.Δ_verts e heG] + ext v + change P.G.Inc e v ↔ + (e ∈ (rootedLocationCore P.G ℒ).edgeSet ∧ P.G.Inc e v) ∨ + (∃ A ∈ ℒ, newEdge A = e ∧ v ∈ A.rootSet) + exact ⟨fun hinc ↦ Or.inl ⟨hcore, hinc⟩, + fun h ↦ h.elim (fun h1 ↦ h1.2) + (fun ⟨A, hA, hEq, _⟩ ↦ (hex ⟨A, hA, hEq⟩).elim)⟩ + · exact (hex ⟨A, hA, rfl⟩).elim + Δ_free := by + intro e he hnd + by_cases hex : ∃ A ∈ ℒ, newEdge A = e + · rcases hex with ⟨A, hA, rfl⟩ + exact (hnd (Or.inr ⟨A, hA, rfl⟩)).elim + · simp only [hex, ↓reduceDIte] + rcases he with hcore | ⟨A, hA, rfl⟩ + · have heG : e ∈ P.G.edgeSet := (mem_rootedLocationCore_edgeSet_iff.1 hcore).1 + have hndP : e ∉ P.dom := fun hd ↦ hnd (Or.inl ⟨hcore, hd⟩) + exact P.Δ_free e heG hndP + · exact (hex ⟨A, hA, rfl⟩).elim + +open Classical in +/-- `mkPlaceHeart P hℒ newEdge hinj hnotMem` satisfies `IsPlaceHeart P ℒ newEdge`. -/ +theorem isPlaceHeart_mkPlaceHeart (P : PartialPatchwork Ω α β) + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation P.G ℒ) + (newEdge : RootedHypergraph α β → β) + (hinj : Set.InjOn newEdge ℒ) + (hnotMem : ∀ ⦃A⦄, A ∈ ℒ → newEdge A ∉ (rootedLocationCore P.G ℒ).edgeSet) : + IsPlaceHeart P ℒ newEdge (mkPlaceHeart P hℒ newEdge hinj hnotMem) where + isRootedLocation := hℒ + injOn_newEdge := hinj + newEdge_notMem_core := hnotMem + vertexSet_eq := rfl + edgeSet_eq := rfl + roots_eq := rfl + ends_core f hf := by + ext v + change (f ∈ (rootedLocationCore P.G ℒ).edgeSet ∧ P.G.Inc f v) ∨ + (∃ A ∈ ℒ, newEdge A = f ∧ v ∈ A.rootSet) ↔ P.G.Inc f v + refine ⟨?_, fun hinc ↦ Or.inl ⟨hf, hinc⟩⟩ + rintro (⟨_, hinc⟩ | ⟨A, hA, rfl, _⟩) + · exact hinc + · exact (hnotMem hA hf).elim + ends_newEdge A hA := by + ext v + change (newEdge A ∈ (rootedLocationCore P.G ℒ).edgeSet ∧ P.G.Inc (newEdge A) v) ∨ + (∃ A' ∈ ℒ, newEdge A' = newEdge A ∧ v ∈ A'.rootSet) ↔ v ∈ A.rootSet + refine ⟨?_, fun hv ↦ Or.inr ⟨A, hA, rfl, hv⟩⟩ + rintro (⟨hc, _⟩ | ⟨A', hA', hEq, hv⟩) + · exact (hnotMem hA hc).elim + · rwa [← hinj hA' hA hEq] + dom_eq := rfl + μ_core f hf := by + have hnot : ¬ ∃ A ∈ ℒ, newEdge A = f := by + rintro ⟨A, hA, rfl⟩ + exact hnotMem hA hf.1 + change (if h : ∃ A ∈ ℒ, newEdge A = f then h.choose.roots else P.μ f) = P.μ f + simp only [hnot, ↓reduceDIte] + μ_newEdge A hA := by + have hex : ∃ A' ∈ ℒ, newEdge A' = newEdge A := ⟨A, hA, rfl⟩ + change (if h : ∃ A' ∈ ℒ, newEdge A' = newEdge A then h.choose.roots else P.μ (newEdge A)) = + A.roots + simp only [hex, ↓reduceDIte] + exact congrArg RootedHypergraph.roots (hinj hex.choose_spec.1 hA hex.choose_spec.2) + Δ_core f hf := by + have hnot : ¬ ∃ A ∈ ℒ, newEdge A = f := by + rintro ⟨A, hA, rfl⟩ + exact hnotMem hA hf + change (if h : ∃ A ∈ ℒ, newEdge A = f then feasibleGroupings (P.restrict h.choose) else P.Δ f) = + P.Δ f + simp only [hnot, ↓reduceDIte] + Δ_newEdge A hA := by + have hex : ∃ A' ∈ ℒ, newEdge A' = newEdge A := ⟨A, hA, rfl⟩ + change (if h : ∃ A' ∈ ℒ, newEdge A' = newEdge A then + feasibleGroupings (P.restrict h.choose) else P.Δ (newEdge A)) = + feasibleGroupings (P.restrict A) + simp only [hex, ↓reduceDIte] + rw [hinj hex.choose_spec.1 hA hex.choose_spec.2] + φ_core f hf := by + have hnot : ¬ ∃ A ∈ ℒ, newEdge A = f := by + rintro ⟨A, hA, rfl⟩ + exact hnotMem hA hf + change (if _ : ∃ A ∈ ℒ, newEdge A = f then ⊥ else P.φ f) = P.φ f + simp only [hnot, ↓reduceDIte] + φ_newEdge A hA := by + have hex : ∃ A' ∈ ℒ, newEdge A' = newEdge A := ⟨A, hA, rfl⟩ + change (if _ : ∃ A' ∈ ℒ, newEdge A' = newEdge A then ⊥ else P.φ (newEdge A)) = ⊥ + simp only [hex, ↓reduceDIte] + +/-- Any two hearts `P₁', P₂'` of `(P, ℒ)` using the same `newEdge` satisfy `PatchworkEquiv P₁' P₂'`. +-/ +theorem IsPlaceHeart.equiv {P P₁' P₂' : PartialPatchwork Ω α β} + {ℒ : Set (RootedHypergraph α β)} {newEdge : RootedHypergraph α β → β} + (h₁ : IsPlaceHeart P ℒ newEdge P₁') (h₂ : IsPlaceHeart P ℒ newEdge P₂') : + PatchworkEquiv P₁' P₂' where + G_eq := by + refine RootedHypergraph.ext ?_ (h₁.roots_eq.trans h₂.roots_eq.symm) + refine hypergraph_ext_of_ends_eq (h₁.vertexSet_eq.trans h₂.vertexSet_eq.symm) + (h₁.edgeSet_eq.trans h₂.edgeSet_eq.symm) fun e he ↦ ?_ + rw [h₁.edgeSet_eq] at he + rcases he with hf | ⟨A, hA, rfl⟩ + · rw [h₁.ends_core hf, h₂.ends_core hf] + · rw [h₁.ends_newEdge hA, h₂.ends_newEdge hA] + dom_eq := h₁.dom_eq.trans h₂.dom_eq.symm + μ_eq e he := by + rw [h₁.dom_eq] at he + rcases he with hf | ⟨A, hA, rfl⟩ + · rw [h₁.μ_core hf, h₂.μ_core hf] + · rw [h₁.μ_newEdge hA, h₂.μ_newEdge hA] + Δ_eq e he := by + rw [h₁.edgeSet_eq] at he + rcases he with hf | ⟨A, hA, rfl⟩ + · rw [h₁.Δ_core hf, h₂.Δ_core hf] + · rw [h₁.Δ_newEdge hA, h₂.Δ_newEdge hA] + φ_eq e he := by + rw [h₁.edgeSet_eq] at he + rcases he with hf | ⟨A, hA, rfl⟩ + · rw [h₁.φ_core hf, h₂.φ_core hf] + · rw [h₁.φ_newEdge hA, h₂.φ_newEdge hA] + +/-! ## Tree-width transfer for Claim (1) of (5.5) -/ + +/-- Every hypergraph `H` has a tree-decomposition `(T, τ)` attaining `treeWidthPlusOne H`. -/ +theorem exists_isTreeDecomposition_treeDecompWidthPlusOne_eq {γ : Type*} (H : Hypergraph α γ) : + ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) (τ : ι → Hypergraph α γ), + GM10.IsTreeDecomposition H T τ ∧ + GM10.treeDecompWidthPlusOne τ = GM10.treeWidthPlusOne H := by + have hex : {w : ℕ | ∃ (ι : Type) (_ : Fintype ι) (T : SimpleGraph ι) + (τ : ι → Hypergraph α γ), + GM10.IsTreeDecomposition H T τ ∧ GM10.treeDecompWidthPlusOne τ = w}.Nonempty := by + refine ⟨GM10.treeDecompWidthPlusOne (fun _ : Unit ↦ H), Unit, inferInstance, ⊥, + fun _ ↦ H, ?_, rfl⟩ + refine ⟨⟨⟨fun _ _ ↦ Reachable.refl _⟩, fun _ p hp ↦ ?_⟩, fun _ ↦ le_rfl, ?_, + fun u v hne ↦ (hne (Subsingleton.elim u v)).elim, fun _ _ _ _ ↦ GM10.inter_le le_rfl le_rfl⟩ + · cases p with + | nil => exact (Walk.not_isCycle_nil hp).elim + | cons h _ => exact h.elim + · refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq (biUnion_le fun _ _ ↦ le_rfl) le_rfl ?_ ?_ + · ext v; simp [biUnion] + · ext e; simp [biUnion] + exact Nat.sInf_mem hex + +/-- If `V(P₀.G) ⊆ V(H)`, every edge of `P₀.G` has the same ends as some edge of `H`, some edge of +`H` has ends containing `πBar(P₀.G)`, and `treeWidth H ≤ w`, then `P₀` has patchwork tree-width `≤ +w` +(used in Claim (1) of (5.5), pages 95–96). -/ +theorem hasPatchworkTreeWidthLE_of_ends_subset {γ : Type*} + (P₀ : GM04.Patchwork Ω α β) (H : Hypergraph α γ) (w : ℕ) + (hV : P₀.G.vertexSet ⊆ H.vertexSet) + (hends : ∀ e ∈ P₀.G.edgeSet, ∃ e' ∈ H.edgeSet, P₀.G.ends e = H.ends e') + (hroot_edge : ∃ e₀ ∈ H.edgeSet, P₀.G.rootSet ⊆ H.ends e₀) + (htw : GM10.treeWidth H ≤ (w : ℤ)) : + HasPatchworkTreeWidthLE P₀ w := by + classical + obtain ⟨ι, hfin_ι, T, τ, hD, hw⟩ := exists_isTreeDecomposition_treeDecompWidthPlusOne_eq H + let _ : Fintype ι := hfin_ι + have hex_edge_node : ∀ e' ∈ H.edgeSet, ∃ t : ι, e' ∈ (τ t).edgeSet := by + intro e' he' + rw [← hD.biUnion_eq] at he' + simp only [biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion] at he' + exact he' + obtain ⟨e₀, he₀, hroot_sub⟩ := hroot_edge + obtain ⟨t₀, ht₀_mem⟩ := hex_edge_node e₀ he₀ + have hroot_t₀ : P₀.G.rootSet ⊆ (τ t₀).vertexSet := by + intro v hv + have hv_H : v ∈ H.ends e₀ := hroot_sub hv + rw [(hD.le t₀).ends_eq e₀ ht₀_mem] at hv_H + exact (τ t₀).vertex_mem_of_inc hv_H + have hex_node : ∀ e ∈ P₀.G.edgeSet, ∃ t : ι, P₀.G.ends e ⊆ (τ t).vertexSet := by + intro e he + obtain ⟨e', he', hends_eq⟩ := hends e he + obtain ⟨t, ht_mem⟩ := hex_edge_node e' he' + refine ⟨t, fun v hv ↦ ?_⟩ + have hv_H : v ∈ H.ends e' := hends_eq ▸ hv + rw [(hD.le t).ends_eq e' ht_mem] at hv_H + exact (τ t).vertex_mem_of_inc hv_H + let nodeOf : β → ι := fun e ↦ + if he : e ∈ P₀.G.edgeSet then (hex_node e he).choose else t₀ + have hnodeOf_sub : ∀ e (he : e ∈ P₀.G.edgeSet), P₀.G.ends e ⊆ (τ (nodeOf e)).vertexSet := by + intro e he + simp only [nodeOf, he, ↓reduceDIte] + exact (hex_node e he).choose_spec + let τ' : ι → Hypergraph α β := fun t ↦ + { vertexSet := (τ t).vertexSet ∩ P₀.G.vertexSet + edgeSet := {e ∈ P₀.G.edgeSet | nodeOf e = t} + Inc e v := e ∈ P₀.G.edgeSet ∧ nodeOf e = t ∧ P₀.G.Inc e v + vertex_mem_of_inc e v h := + ⟨h.2.1 ▸ hnodeOf_sub e h.1 h.2.2, P₀.G.vertex_mem_of_inc h.2.2⟩ + edge_mem_of_inc _ _ h := ⟨h.1, h.2.1⟩ + vertexSet_finite := ((τ t).vertexSet_finite).inter_of_left _ + edgeSet_finite := P₀.G.edgeSet_finite.sep _ } + have hle' : ∀ t, τ' t ≤ P₀.G.toHypergraph := fun t ↦ + { vertexSet_subset := Set.inter_subset_right + edgeSet_subset := fun _ h ↦ h.1 + ends_eq := fun e he ↦ Set.ext fun v ↦ ⟨fun h ↦ ⟨he.1, he.2, h⟩, fun h ↦ h.2.2⟩ } + have hD' : GM10.IsTreeDecomposition P₀.G.toHypergraph T τ' := + { isTree := hD.isTree + le := hle' + biUnion_eq := by + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (biUnion_le fun t _ ↦ hle' t) le_rfl ?_ ?_ + · ext v + simp only [biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion, τ', + Set.mem_inter_iff] + refine ⟨fun ⟨_, _, hv⟩ ↦ hv, fun hv ↦ ?_⟩ + have hvH : v ∈ H.vertexSet := hV hv + rw [← hD.biUnion_eq] at hvH + simp only [biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion] at hvH + obtain ⟨t, ht⟩ := hvH + exact ⟨t, ht, hv⟩ + · ext e + simp only [biUnion, Finset.mem_univ, Set.iUnion_true, Set.mem_iUnion, τ', + Set.mem_sep_iff, exists_eq_right'] + edgeSet_inter_eq := fun t₁ t₂ hne ↦ by + ext e + simp only [Set.mem_empty_iff_false, iff_false] + rintro ⟨⟨_, rfl⟩, ⟨_, hEq⟩⟩ + exact hne hEq + inter_le := fun t₁ t₂ t₃ hpath ↦ by + have hinter := hD.inter_le hpath + refine (GM10.le_iff_of_le (GM10.inter_le (hle' t₁) (hle' t₃)) (hle' t₂)).2 ⟨?_, ?_⟩ + · intro v ⟨⟨hv₁, hvP⟩, ⟨hv₃, _⟩⟩ + exact ⟨hinter.vertexSet_subset ⟨hv₁, hv₃⟩, hvP⟩ + · rintro e ⟨⟨he, rfl⟩, ⟨_, hEq⟩⟩ + cases hEq + have ht₂ : t₂ ∈ (Walk.nil : T.Walk (nodeOf e) (nodeOf e)).support := + hpath Walk.nil Walk.IsPath.nil + simp only [Walk.support_nil, List.mem_singleton] at ht₂ + exact ⟨he, ht₂.symm⟩ } + have : Nonempty ι := ⟨t₀⟩ + have hw'_le : GM10.treeDecompWidthPlusOne τ' ≤ GM10.treeDecompWidthPlusOne τ := by + unfold GM10.treeDecompWidthPlusOne + refine csSup_le (Set.range_nonempty _) ?_ + rintro _ ⟨t, rfl⟩ + refine le_trans (Set.ncard_le_ncard Set.inter_subset_left (τ t).vertexSet_finite) ?_ + exact le_csSup (Set.toFinite _).bddAbove ⟨t, rfl⟩ + have htw'_le : GM10.treeDecompWidth τ' ≤ (w : ℤ) := by + unfold GM10.treeDecompWidth + unfold GM10.treeWidth at htw + have h₁ : (GM10.treeDecompWidthPlusOne τ' : ℤ) ≤ (GM10.treeWidthPlusOne H : ℤ) := by + rw [← hw] + exact Nat.cast_le.2 hw'_le + omega + exact ⟨ι, hfin_ι, T, τ', t₀, hD', htw'_le, fun v hv ↦ ⟨hroot_t₀ hv, P₀.G.roots_subset v hv⟩⟩ + +/-! ## Proof of (5.5) and Claims (1)–(6) -/ + +/-- If `C₁, C₂ ∈ ℒ` are distinct members of a rooted location `ℒ` in `G` with the same underlying +hypergraph `C₁.toHypergraph = C₂.toHypergraph`, then `C₁.edgeSet = ∅` and +`C₁.vertexSet = C₁.rootSet`. -/ +theorem eq_rootSet_of_toHypergraph_eq_of_ne {G : RootedHypergraph α β} + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation G ℒ) + {C₁ C₂ : RootedHypergraph α β} (h₁ : C₁ ∈ ℒ) (h₂ : C₂ ∈ ℒ) (hne : C₁ ≠ C₂) + (hH : C₁.toHypergraph = C₂.toHypergraph) : + C₁.edgeSet = ∅ ∧ C₁.vertexSet = C₁.rootSet := by + have hle := hℒ.le_complement h₂ h₁ hne.symm + rw [← hH] at hle + have hE : C₁.edgeSet = ∅ := by + ext e + simp only [Set.mem_empty_iff_false, iff_false] + intro he + exact (hle.edgeSet_subset he).2 he + have hV : C₁.vertexSet = C₁.rootSet := by + apply Set.Subset.antisymm _ (rootSet_subset C₁) + intro v hv + exact (hle.vertexSet_subset hv).resolve_left fun h ↦ h.2 hv + exact ⟨hE, hV⟩ + +/-- Setup and preliminary properties for the proof of (5.5) (Graph Minors XVIII, Section 5, +page 95): given a partition `partR : RootedHypergraph α β → Set (RootedHypergraph α β)` of `ℒ_star` +indexed by `C ∈ ℒ` such that for every `C ∈ ℒ` and `A ∈ partR C`, `A⁻ ⊆ C⁻` and +`(G \ C)⁻ ⊆ (G \ A)⁻`, each `A ∈ partR C` is complemented in `C` and `partR C` is a rooted +location in `C`. -/ +theorem isComplemented_of_mem_partR {G : RootedHypergraph α β} + {ℒ ℒ_star : Set (RootedHypergraph α β)} + (hℒ : IsRootedLocation G ℒ) (hℒ_star : IsRootedLocation G ℒ_star) + {partR : RootedHypergraph α β → Set (RootedHypergraph α β)} + (hpart_sub : ∀ ⦃C⦄, C ∈ ℒ → partR C ⊆ ℒ_star) + (hpart_le : ∀ ⦃C⦄, C ∈ ℒ → ∀ ⦃A⦄, A ∈ partR C → + A.toHypergraph ≤ C.toHypergraph ∧ + complementHypergraph G C ≤ complementHypergraph G A) + {C : RootedHypergraph α β} (hC : C ∈ ℒ) {A : RootedHypergraph α β} (hA : A ∈ partR C) : + IsComplemented C A where + le := (hpart_le hC hA).1 + roots_mem v hvA hvC_root := by + have hvG : v ∈ G.vertexSet := (hℒ.isComplemented hC).le.vertexSet_subset + (C.roots_subset v hvC_root) + have hv_compC : v ∈ (complementHypergraph G C).vertexSet := Or.inr ⟨hvG, hvC_root⟩ + have hv_compA : v ∈ (complementHypergraph G A).vertexSet := + (hpart_le hC hA).2.vertexSet_subset hv_compC + exact (hv_compA.resolve_left fun h ↦ h.2 hvA).2 + inc_diff_mem v e hvA he hinc := by + have hA_star : A ∈ ℒ_star := hpart_sub hC hA + have heG : e ∈ G.edgeSet \ A.edgeSet := + ⟨(hℒ.isComplemented hC).le.edgeSet_subset he.1, he.2⟩ + have hincG : G.Inc e v := GM10.inc_of_le (hℒ.isComplemented hC).le hinc + exact (hℒ_star.isComplemented hA_star).inc_diff_mem hvA heG hincG + +theorem isRootedLocation_partR {G : RootedHypergraph α β} + {ℒ ℒ_star : Set (RootedHypergraph α β)} + (hℒ : IsRootedLocation G ℒ) (hℒ_star : IsRootedLocation G ℒ_star) + {partR : RootedHypergraph α β → Set (RootedHypergraph α β)} + (hpart_sub : ∀ ⦃C⦄, C ∈ ℒ → partR C ⊆ ℒ_star) + (hpart_le : ∀ ⦃C⦄, C ∈ ℒ → ∀ ⦃A⦄, A ∈ partR C → + A.toHypergraph ≤ C.toHypergraph ∧ + complementHypergraph G C ≤ complementHypergraph G A) + {C : RootedHypergraph α β} (hC : C ∈ ℒ) : + IsRootedLocation C (partR C) where + isComplemented _ hA := isComplemented_of_mem_partR hℒ hℒ_star hpart_sub hpart_le hC hA + le_complement A₁ hA₁ A₂ hA₂ hne := by + have hcompC₂ := isComplemented_of_mem_partR hℒ hℒ_star hpart_sub hpart_le hC hA₂ + have hA₁_C : A₁.toHypergraph ≤ C.toHypergraph := (hpart_le hC hA₁).1 + have hle_G := hℒ_star.le_complement (hpart_sub hC hA₁) (hpart_sub hC hA₂) hne + refine (GM10.le_iff_of_le (hA₁_C.trans (hℒ.isComplemented hC).le) + (hcompC₂.isSeparation.isSeparation.right_le.trans (hℒ.isComplemented hC).le)).2 ⟨?_, ?_⟩ + · intro v hv + have hvC : v ∈ C.vertexSet := hA₁_C.vertexSet_subset hv + rcases hle_G.vertexSet_subset hv with ⟨_, hnotA₂⟩ | hr₂ + · exact Or.inl ⟨hvC, hnotA₂⟩ + · exact Or.inr hr₂ + · intro e he + exact ⟨hA₁_C.edgeSet_subset he, (hle_G.edgeSet_subset he).2⟩ + +/-- For each `C ∈ ℒ`, `M(C, ℒ_C) ⊆ M(G, ℒ*)` (first part of Claim (2) of (5.5), page 96). -/ +theorem rootedLocationCore_partR_le {G : RootedHypergraph α β} + {ℒ ℒ_star : Set (RootedHypergraph α β)} + (hℒ : IsRootedLocation G ℒ) (hℒ_star : IsRootedLocation G ℒ_star) + {partR : RootedHypergraph α β → Set (RootedHypergraph α β)} + (hpart_sub : ∀ ⦃C⦄, C ∈ ℒ → partR C ⊆ ℒ_star) + (hpart_union : (⋃ C ∈ ℒ, partR C) = ℒ_star) + (hpart_le : ∀ ⦃C⦄, C ∈ ℒ → ∀ ⦃A⦄, A ∈ partR C → + A.toHypergraph ≤ C.toHypergraph ∧ + complementHypergraph G C ≤ complementHypergraph G A) + {C : RootedHypergraph α β} (hC : C ∈ ℒ) : + rootedLocationCore C (partR C) ≤ rootedLocationCore G ℒ_star := by + have hℒ_C := isRootedLocation_partR hℒ hℒ_star hpart_sub hpart_le hC + have hle_C : rootedLocationCore C (partR C) ≤ G.toHypergraph := + (locationCore_le hℒ_C.isLocation).trans (hℒ.isComplemented hC).le + have hle_star : rootedLocationCore G ℒ_star ≤ G.toHypergraph := + locationCore_le hℒ_star.isLocation + refine (GM10.le_iff_of_le hle_C hle_star).2 ⟨?_, ?_⟩ + · intro v hv + rw [mem_rootedLocationCore_vertexSet_iff hℒ_C] at hv + rw [mem_rootedLocationCore_vertexSet_iff hℒ_star] + refine ⟨(hℒ.isComplemented hC).le.vertexSet_subset hv.1, fun A hA hvA ↦ ?_⟩ + rw [← hpart_union, Set.mem_iUnion₂] at hA + rcases hA with ⟨C', hC', hA_C'⟩ + by_cases hEq : C' = C + · subst hEq + exact hv.2 A hA_C' hvA + · have hC_le_compC' := hℒ.le_complement hC hC' (Ne.symm hEq) + rw [← complementHypergraph_eq_of_isComplemented (hℒ.isComplemented hC')] at hC_le_compC' + have hC_le_compA : C.toHypergraph ≤ complementHypergraph G A := + hC_le_compC'.trans (hpart_le hC' hA_C').2 + exact ((hC_le_compA.vertexSet_subset hv.1).resolve_left fun h ↦ h.2 hvA).2 + · intro e he + rw [mem_rootedLocationCore_edgeSet_iff] at he ⊢ + refine ⟨(hℒ.isComplemented hC).le.edgeSet_subset he.1, fun A hA heA ↦ ?_⟩ + rw [← hpart_union, Set.mem_iUnion₂] at hA + rcases hA with ⟨C', hC', hA_C'⟩ + by_cases hEq : C' = C + · subst hEq + exact he.2 A hA_C' heA + · have hA_C'le : A.toHypergraph ≤ (complement G C (hℒ.isComplemented hC)).toHypergraph := + (hpart_le hC' hA_C').1.trans (hℒ.le_complement hC' hC hEq) + exact (hA_C'le.edgeSet_subset heA).2 he.1 + +/-- **Claim (1)** in the proof of Graph Minors XVIII, (5.5) (pages 95–96): +Each `P_i` (a heart of `(P | C_i, ℒ_i)` using `newEdge_star`) has patchwork tree-width `≤ w`. -/ +theorem lemma_5_5_claim_1 {P : PartialPatchwork Ω α β} + {ℒ ℒ_star : Set (RootedHypergraph α β)} {w : ℕ} + (hℒ : IsRootedLocation P.G ℒ) (hℒ_star : IsRootedLocation P.G ℒ_star) + {newEdge_star : RootedHypergraph α β → β} + {part_loc : Hypergraph α β × Hypergraph α β → Set (Hypergraph α β × Hypergraph α β)} + (hvia : IsLocationEnlargementVia P.G.toHypergraph + (rootedLocationToLocation P.G ℒ) (rootedLocationToLocation P.G ℒ_star) part_loc) + (htw : ∀ ⦃p⦄, p ∈ rootedLocationToLocation P.G ℒ → + (locationTreeWidth P.G.toHypergraph (part_loc p ∪ {(p.2, p.1)}) : ℚ) ≤ (w : ℚ)) + {partR : RootedHypergraph α β → Set (RootedHypergraph α β)} + (hpart_sub : ∀ ⦃C⦄, C ∈ ℒ → partR C ⊆ ℒ_star) + (hpart_le : ∀ ⦃C⦄, C ∈ ℒ → ∀ ⦃A⦄, A ∈ partR C → + A.toHypergraph ≤ C.toHypergraph ∧ + complementHypergraph P.G C ≤ complementHypergraph P.G A) + (hpart_case : ∀ ⦃C⦄, C ∈ ℒ → + rootedLocationToLocation P.G (partR C) = + part_loc (C.toHypergraph, complementHypergraph P.G C) ∨ + (partR C = ∅ ∧ C.edgeSet = ∅ ∧ C.vertexSet = C.rootSet)) + {C : RootedHypergraph α β} (hC : C ∈ ℒ) + {Q_C : PartialPatchwork Ω α β} + (hQ_C : IsPlaceHeart (P.restrict C) (partR C) newEdge_star Q_C) : + HasPatchworkTreeWidthLE Q_C w := by + let G := P.G + let D := complementHypergraph G C + let p : Hypergraph α β × Hypergraph α β := (C.toHypergraph, D) + have hp_mem : p ∈ rootedLocationToLocation G ℒ := ⟨C, hC, rfl⟩ + let ℳ : Set (Hypergraph α β × Hypergraph α β) := part_loc p ∪ {(D, C.toHypergraph)} + let H := locationHeart G.toHypergraph ℳ + have htw_H : GM10.treeWidth H ≤ (w : ℤ) := by + have hq := htw hp_mem + exact_mod_cast hq + have hsep_CD : G.toHypergraph.IsSeparation C.toHypergraph D := by + dsimp only [D] + rw [complementHypergraph_eq_of_isComplemented (hℒ.isComplemented hC)] + exact (hℒ.isComplemented hC).isSeparation.isSeparation + have hloc_ℳ : GM10.IsLocation G.toHypergraph ℳ := + { isSeparation := by + rintro q (hq | rfl) + · exact hvia.isLocation_right.isSeparation (hvia.part_subset hp_mem hq) + · exact hsep_CD.symm + left_le_right := by + rintro q₁ (hq₁ | rfl) q₂ (hq₂ | rfl) hne + · exact hvia.isLocation_right.left_le_right + (hvia.part_subset hp_mem hq₁) (hvia.part_subset hp_mem hq₂) hne + · exact (hvia.le_of_mem_part hp_mem hq₁).1 + · exact (hvia.le_of_mem_part hp_mem hq₂).2 + · exact (hne rfl).elim } + have hDC_mem : (D, C.toHypergraph) ∈ ℳ := Or.inr (Set.mem_singleton _) + have hDC_sub : (D ∩ C.toHypergraph).vertexSet ⊆ (GM10.locationCore G.toHypergraph ℳ).vertexSet + := by + rw [← (theorem_2_3_2 hloc_ℳ hDC_mem).2] + exact Set.inter_subset_right + have hrootC_eq : C.rootSet = (D ∩ C.toHypergraph).vertexSet := by + ext v + dsimp only [D] + rw [complementHypergraph_eq_of_isComplemented (hℒ.isComplemented hC), GM10.inter_comm] + change v ∈ C.rootSet ↔ + v ∈ (C.toHypergraph ∩ (complement G C (hℒ.isComplemented hC)).toHypergraph).vertexSet + rw [← (hℒ.isComplemented hC).isSeparation.rootSet_left] + have hroot_edge : ∃ e₀ ∈ H.edgeSet, Q_C.G.rootSet ⊆ H.ends e₀ := by + refine ⟨Sum.inr (D, C.toHypergraph), + Or.inr ⟨(D, C.toHypergraph), ⟨hDC_mem, hsep_CD.symm, hDC_sub⟩, rfl⟩, ?_⟩ + intro v hv + have hvC : v ∈ C.rootSet := by + change v ∈ Q_C.G.roots at hv + rw [hQ_C.roots_eq] at hv + exact hv + exact ⟨hDC_mem, hsep_CD.symm, hDC_sub, hrootC_eq ▸ hvC⟩ + have hℒ_C := isRootedLocation_partR hℒ hℒ_star hpart_sub hpart_le hC + refine hasPatchworkTreeWidthLE_of_ends_subset Q_C H w ?_ ?_ hroot_edge htw_H + · -- `Q_C.G.vertexSet ⊆ H.vertexSet` + rw [hQ_C.vertexSet_eq] + change (rootedLocationCore C (partR C)).vertexSet ⊆ + (GM10.locationCore G.toHypergraph ℳ).vertexSet + rcases hpart_case hC with hpart_eq | ⟨_, _, hV_eq⟩ + · intro v hv + rw [mem_rootedLocationCore_vertexSet_iff hℒ_C] at hv + refine ⟨(hℒ.isComplemented hC).le.vertexSet_subset hv.1, ?_⟩ + rintro q (hq | rfl) + · rw [← hpart_eq] at hq + rcases hq with ⟨A, hA, rfl⟩ + dsimp only + rw [complementHypergraph_eq_of_isComplemented (hℒ_star.isComplemented (hpart_sub hC hA))] + by_cases hvA : v ∈ A.vertexSet + · exact Or.inr (hv.2 A hA hvA) + · exact Or.inl ⟨(hℒ.isComplemented hC).le.vertexSet_subset hv.1, hvA⟩ + · exact hv.1 + · intro v hv + rw [mem_rootedLocationCore_vertexSet_iff hℒ_C] at hv + have hv_root : v ∈ C.rootSet := hV_eq ▸ hv.1 + exact hDC_sub (hrootC_eq ▸ hv_root) + · -- Every edge of `Q_C.G` has the same ends as some edge of `H`. + intro e he + rw [hQ_C.edgeSet_eq] at he + change e ∈ (rootedLocationCore C (partR C)).edgeSet ∪ (newEdge_star '' partR C) at he + rcases hpart_case hC with hpart_eq | ⟨hpart_empty, hE_empty, _⟩ + · rcases he with he_core | ⟨A, hA, rfl⟩ + · have he_H_core : e ∈ (GM10.locationCore G.toHypergraph ℳ).edgeSet := by + rw [mem_rootedLocationCore_edgeSet_iff] at he_core + refine ⟨(hℒ.isComplemented hC).le.edgeSet_subset he_core.1, ?_⟩ + rintro q (hq | rfl) + · rw [← hpart_eq] at hq + rcases hq with ⟨A, hA, rfl⟩ + exact ⟨(hℒ.isComplemented hC).le.edgeSet_subset he_core.1, he_core.2 A hA⟩ + · exact he_core.1 + refine ⟨Sum.inl e, Or.inl ⟨e, he_H_core, rfl⟩, ?_⟩ + rw [hQ_C.ends_core he_core] + have heC : e ∈ C.edgeSet := (mem_rootedLocationCore_edgeSet_iff.1 he_core).1 + have hle_ℳ : GM10.locationCore G.toHypergraph ℳ ≤ G.toHypergraph := locationCore_le hloc_ℳ + exact ((hℒ.isComplemented hC).le.ends_eq e heC).symm.trans (hle_ℳ.ends_eq e he_H_core) + · let qA : Hypergraph α β × Hypergraph α β := (A.toHypergraph, complementHypergraph G A) + have hqA_mem : qA ∈ ℳ := by + left; rw [← hpart_eq]; exact ⟨A, hA, rfl⟩ + have hsepA : G.toHypergraph.IsSeparation qA.1 qA.2 := hloc_ℳ.isSeparation hqA_mem + have hsubA : (qA.1 ∩ qA.2).vertexSet ⊆ (GM10.locationCore G.toHypergraph ℳ).vertexSet := by + rw [← (theorem_2_3_2 hloc_ℳ hqA_mem).2] + exact Set.inter_subset_right + have hrootA_eq : A.rootSet = (qA.1 ∩ qA.2).vertexSet := by + ext v + dsimp only [qA] + rw [complementHypergraph_eq_of_isComplemented (hℒ_star.isComplemented (hpart_sub hC hA))] + change v ∈ A.rootSet ↔ + v ∈ (A.toHypergraph ∩ (complement G A (hℒ_star.isComplemented + (hpart_sub hC hA))).toHypergraph).vertexSet + rw [← (hℒ_star.isComplemented (hpart_sub hC hA)).isSeparation.rootSet_left] + refine ⟨Sum.inr qA, Or.inr ⟨qA, ⟨hqA_mem, hsepA, hsubA⟩, rfl⟩, ?_⟩ + rw [hQ_C.ends_newEdge hA] + ext v + change v ∈ A.rootSet ↔ + qA ∈ ℳ ∧ G.toHypergraph.IsSeparation qA.1 qA.2 ∧ + (qA.1 ∩ qA.2).vertexSet ⊆ (GM10.locationCore G.toHypergraph ℳ).vertexSet ∧ + v ∈ (qA.1 ∩ qA.2).vertexSet + exact ⟨fun hv ↦ ⟨hqA_mem, hsepA, hsubA, hrootA_eq ▸ hv⟩, + fun h ↦ hrootA_eq.symm ▸ h.2.2.2⟩ + · rw [hpart_empty] at he + rcases he with he_core | ⟨_, h, _⟩ + · exfalso + have heC := (mem_rootedLocationCore_edgeSet_iff.1 he_core).1 + rw [hE_empty] at heC + exact heC + · exact h.elim + +/-- **Claim (2)** in the proof of Graph Minors XVIII, (5.5) (page 96): +For each `C ∈ ℒ`, `G_C = mkPlaceHeartHypergraph C hℒ_C newEdge_star` is a complemented rooted +subhypergraph of `P_star.G`. -/ +theorem lemma_5_5_claim_2 {P P_star : PartialPatchwork Ω α β} + {ℒ ℒ_star : Set (RootedHypergraph α β)} + (hℒ : IsRootedLocation P.G ℒ) + {newEdge_star : RootedHypergraph α β → β} + (hP_star : IsPlaceHeart P ℒ_star newEdge_star P_star) + {partR : RootedHypergraph α β → Set (RootedHypergraph α β)} + (hpart_sub : ∀ ⦃C⦄, C ∈ ℒ → partR C ⊆ ℒ_star) + (hpart_union : (⋃ C ∈ ℒ, partR C) = ℒ_star) + (hpart_le : ∀ ⦃C⦄, C ∈ ℒ → ∀ ⦃A⦄, A ∈ partR C → + A.toHypergraph ≤ C.toHypergraph ∧ + complementHypergraph P.G C ≤ complementHypergraph P.G A) + {C : RootedHypergraph α β} (hC : C ∈ ℒ) : + IsComplemented P_star.G + (mkPlaceHeartHypergraph C + (isRootedLocation_partR hℒ hP_star.isRootedLocation hpart_sub hpart_le hC) + newEdge_star) := by + let G := P.G + have hℒ_star := hP_star.isRootedLocation + have hℒ_C := isRootedLocation_partR hℒ hℒ_star hpart_sub hpart_le hC + let G_C := mkPlaceHeartHypergraph C hℒ_C newEdge_star + have hcore_le := rootedLocationCore_partR_le hℒ hℒ_star hpart_sub hpart_union hpart_le hC + have hnotMem_C : ∀ ⦃A⦄, A ∈ partR C → newEdge_star A ∉ (rootedLocationCore C (partR C)).edgeSet := + fun _ hA hc ↦ hP_star.newEdge_notMem_core (hpart_sub hC hA) (hcore_le.edgeSet_subset hc) + have hinj_C : Set.InjOn newEdge_star (partR C) := + hP_star.injOn_newEdge.mono (hpart_sub hC) + have hQ_C := isPlaceHeart_mkPlaceHeart (P.restrict C) hℒ_C newEdge_star hinj_C hnotMem_C + have hG_C_le : G_C.toHypergraph ≤ P_star.G.toHypergraph := + { vertexSet_subset := by + rw [hP_star.vertexSet_eq] + exact hcore_le.vertexSet_subset + edgeSet_subset := by + rw [hP_star.edgeSet_eq] + exact Set.union_subset_union hcore_le.edgeSet_subset (Set.image_mono (hpart_sub hC)) + ends_eq := fun e he ↦ by + rcases he with he_core | ⟨A, hA, rfl⟩ + · have he_star_core := hcore_le.edgeSet_subset he_core + have heC : e ∈ C.edgeSet := (mem_rootedLocationCore_edgeSet_iff.1 he_core).1 + rw [hP_star.ends_core he_star_core] + exact ((hℒ.isComplemented hC).le.ends_eq e heC).trans (hQ_C.ends_core he_core).symm + · rw [hP_star.ends_newEdge (hpart_sub hC hA)] + exact (hQ_C.ends_newEdge hA).symm } + have hrootSet_star : P_star.G.rootSet = G.rootSet := by + ext v + change v ∈ P_star.G.roots ↔ v ∈ G.roots + rw [hP_star.roots_eq] + refine ⟨hG_C_le, ?_, ?_⟩ + · intro v hvG_C hv_root + rw [hrootSet_star] at hv_root + have hvC : v ∈ C.vertexSet := (mem_rootedLocationCore_vertexSet_iff hℒ_C).1 hvG_C |>.1 + exact (hℒ.isComplemented hC).roots_mem hvC hv_root + · intro v e hvG_C he_diff hinc_star + have hvC : v ∈ C.vertexSet := (mem_rootedLocationCore_vertexSet_iff hℒ_C).1 hvG_C |>.1 + have he_star := he_diff.1 + rw [hP_star.edgeSet_eq] at he_star + rcases he_star with he_core_star | ⟨A, hA_star, rfl⟩ + · have he_not_C : e ∉ C.edgeSet := by + intro heC + apply he_diff.2 + left + rw [mem_rootedLocationCore_edgeSet_iff] + refine ⟨heC, fun A hA ↦ ?_⟩ + exact (mem_rootedLocationCore_edgeSet_iff.1 he_core_star).2 A (hpart_sub hC hA) + have heG : e ∈ G.edgeSet := (mem_rootedLocationCore_edgeSet_iff.1 he_core_star).1 + have hincG : G.Inc e v := by + change v ∈ G.ends e + rw [← hP_star.ends_core he_core_star] + exact hinc_star + exact (hℒ.isComplemented hC).inc_diff_mem hvC ⟨heG, he_not_C⟩ hincG + · have hA_not_C : A ∉ partR C := fun hA_C ↦ he_diff.2 (Or.inr ⟨A, hA_C, rfl⟩) + have hA_union : A ∈ ⋃ C' ∈ ℒ, partR C' := hpart_union.symm ▸ hA_star + rw [Set.mem_iUnion₂] at hA_union + rcases hA_union with ⟨C', hC', hA_C'⟩ + have hne : C' ≠ C := fun hEq ↦ hA_not_C (hEq ▸ hA_C') + have hv_A : v ∈ A.rootSet := by + rw [← hP_star.ends_newEdge hA_star] + exact hinc_star + have hvC' : v ∈ C'.vertexSet := + (hpart_le hC' hA_C').1.vertexSet_subset (A.roots_subset v hv_A) + have hle_comp := hℒ.le_complement hC' hC hne + exact (hle_comp.vertexSet_subset hvC').resolve_left fun h ↦ h.2 hvC + +/-- **Claim (3)** in the proof of Graph Minors XVIII, (5.5) (page 96): +For each `C ∈ ℒ`, `P_star | G_C` is a heart of `(P | C, ℒ_C)` using `newEdge_star` +(`IsPlaceHeart (P.restrict C) (partR C) newEdge_star (P_star.restrict G_C)`). -/ +theorem lemma_5_5_claim_3 {P P_star : PartialPatchwork Ω α β} + {ℒ ℒ_star : Set (RootedHypergraph α β)} + (hℒ : IsRootedLocation P.G ℒ) + {newEdge_star : RootedHypergraph α β → β} + (hP_star : IsPlaceHeart P ℒ_star newEdge_star P_star) + {partR : RootedHypergraph α β → Set (RootedHypergraph α β)} + (hpart_sub : ∀ ⦃C⦄, C ∈ ℒ → partR C ⊆ ℒ_star) + (hpart_union : (⋃ C ∈ ℒ, partR C) = ℒ_star) + (hpart_le : ∀ ⦃C⦄, C ∈ ℒ → ∀ ⦃A⦄, A ∈ partR C → + A.toHypergraph ≤ C.toHypergraph ∧ + complementHypergraph P.G C ≤ complementHypergraph P.G A) + {C : RootedHypergraph α β} (hC : C ∈ ℒ) : + let hℒ_C := isRootedLocation_partR hℒ hP_star.isRootedLocation hpart_sub hpart_le hC + let G_C := mkPlaceHeartHypergraph C hℒ_C newEdge_star + IsPlaceHeart (P.restrict C) (partR C) newEdge_star (P_star.restrict G_C) := by + intro hℒ_C G_C + have hℒ_star := hP_star.isRootedLocation + have hcore_le := rootedLocationCore_partR_le hℒ hℒ_star hpart_sub hpart_union hpart_le hC + have hnotMem_C : ∀ ⦃A⦄, A ∈ partR C → newEdge_star A ∉ (rootedLocationCore C (partR C)).edgeSet := + fun _ hA hc ↦ hP_star.newEdge_notMem_core (hpart_sub hC hA) (hcore_le.edgeSet_subset hc) + have hinj_C : Set.InjOn newEdge_star (partR C) := + hP_star.injOn_newEdge.mono (hpart_sub hC) + have hQ_C := isPlaceHeart_mkPlaceHeart (P.restrict C) hℒ_C newEdge_star hinj_C hnotMem_C + have hcomp_GC := lemma_5_5_claim_2 hℒ hP_star hpart_sub hpart_union hpart_le hC + have hle_GC : G_C.toHypergraph ≤ P_star.G.toHypergraph := hcomp_GC.le + have hle_C : C.toHypergraph ≤ P.G.toHypergraph := (hℒ.isComplemented hC).le + refine + { isRootedLocation := hℒ_C + injOn_newEdge := hinj_C + newEdge_notMem_core := hnotMem_C + vertexSet_eq := rfl + edgeSet_eq := rfl + roots_eq := rfl + ends_core := hQ_C.ends_core + ends_newEdge := hQ_C.ends_newEdge + dom_eq := by + rw [P_star.restrict_dom hle_GC, hP_star.dom_eq, P.restrict_dom hle_C] + change (((rootedLocationCore P.G ℒ_star).edgeSet ∩ P.dom) ∪ (newEdge_star '' ℒ_star)) ∩ + ((rootedLocationCore C (partR C)).edgeSet ∪ (newEdge_star '' partR C)) = + ((rootedLocationCore C (partR C)).edgeSet ∩ (P.dom ∩ C.edgeSet)) ∪ + (newEdge_star '' partR C) + ext e + simp only [Set.mem_inter_iff, Set.mem_union, Set.mem_image] + constructor + · rintro ⟨⟨he_core_star, hd⟩ | ⟨A, hA_star, rfl⟩, he_core_C | ⟨A', hA'_C, hEq⟩⟩ + · exact Or.inl ⟨he_core_C, hd, (mem_rootedLocationCore_edgeSet_iff.1 he_core_C).1⟩ + · exact Or.inr ⟨A', hA'_C, hEq⟩ + · exact (hP_star.newEdge_notMem_core hA_star (hcore_le.edgeSet_subset he_core_C)).elim + · exact Or.inr ⟨A', hA'_C, hEq⟩ + · rintro (⟨he_core_C, hd, _⟩ | ⟨A, hA_C, rfl⟩) + · exact ⟨Or.inl ⟨hcore_le.edgeSet_subset he_core_C, hd⟩, Or.inl he_core_C⟩ + · exact ⟨Or.inr ⟨A, hpart_sub hC hA_C, rfl⟩, Or.inr ⟨A, hA_C, rfl⟩⟩ + μ_core := fun f hf ↦ by + rw [P.restrict_dom hle_C] at hf + exact hP_star.μ_core ⟨hcore_le.edgeSet_subset hf.1, hf.2.1⟩ + μ_newEdge := fun A hA ↦ hP_star.μ_newEdge (hpart_sub hC hA) + Δ_core := fun f hf ↦ by + have hf_GC : f ∈ G_C.edgeSet := Or.inl hf + have hf_C : f ∈ C.edgeSet := (mem_rootedLocationCore_edgeSet_iff.1 hf).1 + rw [P_star.restrict_Δ hle_GC hf_GC, hP_star.Δ_core (hcore_le.edgeSet_subset hf), + P.restrict_Δ hle_C hf_C] + Δ_newEdge := fun A hA ↦ by + have hA_GC : newEdge_star A ∈ G_C.edgeSet := Or.inr ⟨A, hA, rfl⟩ + have hA_C : A.toHypergraph ≤ C.toHypergraph := (hpart_le hC hA).1 + rw [P_star.restrict_Δ hle_GC hA_GC, hP_star.Δ_newEdge (hpart_sub hC hA)] + have hagrees := P.agrees_restrict_restrict hle_C hA_C + have hequiv : PatchworkEquiv ((P.restrict C).restrict A) (P.restrict A) := + ⟨hagrees.G_eq, hagrees.dom_eq, + fun e he ↦ hagrees.μ_eq e (((P.restrict C).restrict A).dom_subset he), + fun e he ↦ hagrees.Δ_eq e he, + fun e he ↦ hagrees.φ_eq e he⟩ + exact hequiv.feasibleGroupings_eq.symm + φ_core := fun f hf ↦ hP_star.φ_core (hcore_le.edgeSet_subset hf) + φ_newEdge := fun A hA ↦ hP_star.φ_newEdge (hpart_sub hC hA) } + +/-- **Claim (4)** in the proof of Graph Minors XVIII, (5.5) (pages 96–97): +The rooted subhypergraphs `G_C` (`C ∈ ℒ`) are all distinct (`Set.InjOn`), and +`ℒ' = {G_C : C ∈ ℒ}` is a rooted location in `P_star.G`. -/ +theorem lemma_5_5_claim_4 {P P_star : PartialPatchwork Ω α β} + {ℒ ℒ_star : Set (RootedHypergraph α β)} + (hℒ : IsRootedLocation P.G ℒ) + {newEdge_star : RootedHypergraph α β → β} + (hP_star : IsPlaceHeart P ℒ_star newEdge_star P_star) + {partR : RootedHypergraph α β → Set (RootedHypergraph α β)} + (hpart_sub : ∀ ⦃C⦄, C ∈ ℒ → partR C ⊆ ℒ_star) + (hpart_disj : ∀ ⦃C₁⦄, C₁ ∈ ℒ → ∀ ⦃C₂⦄, C₂ ∈ ℒ → C₁ ≠ C₂ → + Disjoint (partR C₁) (partR C₂)) + (hpart_union : (⋃ C ∈ ℒ, partR C) = ℒ_star) + (hpart_le : ∀ ⦃C⦄, C ∈ ℒ → ∀ ⦃A⦄, A ∈ partR C → + A.toHypergraph ≤ C.toHypergraph ∧ + complementHypergraph P.G C ≤ complementHypergraph P.G A) + (G_of : RootedHypergraph α β → RootedHypergraph α β) + (hG_of : ∀ ⦃C⦄ (hC : C ∈ ℒ), + G_of C = + mkPlaceHeartHypergraph C + (isRootedLocation_partR hℒ hP_star.isRootedLocation hpart_sub hpart_le hC) + newEdge_star) : + Set.InjOn G_of ℒ ∧ IsRootedLocation P_star.G (G_of '' ℒ) := by + have hℒ_star := hP_star.isRootedLocation + have hcomp_of : ∀ ⦃C⦄, C ∈ ℒ → IsComplemented P_star.G (G_of C) := by + intro C hC + rw [hG_of hC] + exact lemma_5_5_claim_2 hℒ hP_star hpart_sub hpart_union hpart_le hC + have hle_comp_of : ∀ ⦃C₁⦄ (h₁ : C₁ ∈ ℒ) ⦃C₂⦄ (h₂ : C₂ ∈ ℒ), C₁ ≠ C₂ → + (G_of C₁).toHypergraph ≤ (complement P_star.G (G_of C₂) (hcomp_of h₂)).toHypergraph := by + intro C₁ h₁ C₂ h₂ hne + have hℒ_C₁ := isRootedLocation_partR hℒ hℒ_star hpart_sub hpart_le h₁ + have hℒ_C₂ := isRootedLocation_partR hℒ hℒ_star hpart_sub hpart_le h₂ + have hcore₁_le := rootedLocationCore_partR_le hℒ hℒ_star hpart_sub hpart_union hpart_le h₁ + have hcore₂_le := rootedLocationCore_partR_le hℒ hℒ_star hpart_sub hpart_union hpart_le h₂ + refine (GM10.le_iff_of_le (hcomp_of h₁).le + (hcomp_of h₂).isSeparation.isSeparation.right_le).2 ⟨?_, ?_⟩ + · intro v hv₁ + have hv_star : v ∈ P_star.G.vertexSet := (hcomp_of h₁).le.vertexSet_subset hv₁ + by_cases hv₂ : v ∈ (G_of C₂).vertexSet + · right + rw [hG_of h₁] at hv₁ + rw [hG_of h₂] at hv₂ ⊢ + have hvC₁ : v ∈ C₁.vertexSet := (mem_rootedLocationCore_vertexSet_iff hℒ_C₁).1 hv₁ |>.1 + have hvC₂ : v ∈ C₂.vertexSet := (mem_rootedLocationCore_vertexSet_iff hℒ_C₂).1 hv₂ |>.1 + have hle_C := hℒ.le_complement h₁ h₂ hne + exact (hle_C.vertexSet_subset hvC₁).resolve_left fun h ↦ h.2 hvC₂ + · exact Or.inl ⟨hv_star, hv₂⟩ + · intro e he₁ + have he_star : e ∈ P_star.G.edgeSet := (hcomp_of h₁).le.edgeSet_subset he₁ + refine ⟨he_star, fun he₂ ↦ ?_⟩ + rw [hG_of h₁] at he₁ + rw [hG_of h₂] at he₂ + rcases he₁ with he_core₁ | ⟨A₁, hA₁, rfl⟩ <;> rcases he₂ with he_core₂ | ⟨A₂, hA₂, hEq⟩ + · have heC₁ := (mem_rootedLocationCore_edgeSet_iff.1 he_core₁).1 + have heC₂ := (mem_rootedLocationCore_edgeSet_iff.1 he_core₂).1 + exact ((hℒ.le_complement h₁ h₂ hne).edgeSet_subset heC₁).2 heC₂ + · exact hP_star.newEdge_notMem_core (hpart_sub h₂ hA₂) + (hEq ▸ hcore₁_le.edgeSet_subset he_core₁) + · exact hP_star.newEdge_notMem_core (hpart_sub h₁ hA₁) + (hcore₂_le.edgeSet_subset he_core₂) + · have hA_eq := hP_star.injOn_newEdge (hpart_sub h₂ hA₂) (hpart_sub h₁ hA₁) hEq + exact Set.disjoint_left.1 (hpart_disj h₁ h₂ hne) hA₁ (hA_eq ▸ hA₂) + have hinj_G : Set.InjOn G_of ℒ := by + intro C₁ h₁ C₂ h₂ hEq + by_contra hne + have hle := hle_comp_of h₁ h₂ hne + have hE_empty : (G_of C₁).edgeSet = ∅ := by + ext e + simp only [Set.mem_empty_iff_false, iff_false] + intro he₁ + have he₂ : e ∈ (G_of C₂).edgeSet := hEq ▸ he₁ + exact (hle.edgeSet_subset he₁).2 he₂ + have h_eq_C : ∀ {C : RootedHypergraph α β} (hC : C ∈ ℒ), + (G_of C).edgeSet = ∅ → G_of C = C := by + intro C hC hE + rw [hG_of hC] at hE ⊢ + have hℒ_C := isRootedLocation_partR hℒ hℒ_star hpart_sub hpart_le hC + have hpart_empty : partR C = ∅ := by + ext A + simp only [Set.mem_empty_iff_false, iff_false] + intro hA + have hmem : newEdge_star A ∈ (mkPlaceHeartHypergraph C hℒ_C newEdge_star).edgeSet := + Or.inr ⟨A, hA, rfl⟩ + rw [hE] at hmem + exact hmem + have hEC_empty : C.edgeSet = ∅ := by + ext e + simp only [Set.mem_empty_iff_false, iff_false] + intro heC + have hmem : e ∈ (mkPlaceHeartHypergraph C hℒ_C newEdge_star).edgeSet := by + left + rw [mem_rootedLocationCore_edgeSet_iff, hpart_empty] + exact ⟨heC, fun _ h ↦ h.elim⟩ + rw [hE] at hmem + exact hmem + refine RootedHypergraph.ext ?_ rfl + refine hypergraph_ext_of_ends_eq ?_ ?_ ?_ + · ext v + change v ∈ (rootedLocationCore C (partR C)).vertexSet ↔ v ∈ C.vertexSet + rw [mem_rootedLocationCore_vertexSet_iff hℒ_C, hpart_empty] + exact ⟨fun h ↦ h.1, fun hv ↦ ⟨hv, fun _ h ↦ h.elim⟩⟩ + · rw [hE, hEC_empty] + · intro e he + rw [hE] at he + exact he.elim + have hG₁_C₁ : G_of C₁ = C₁ := h_eq_C h₁ hE_empty + have hG₂_C₂ : G_of C₂ = C₂ := h_eq_C h₂ (hEq ▸ hE_empty) + exact hne (hG₁_C₁.symm.trans (hEq.trans hG₂_C₂)) + refine ⟨hinj_G, ?_⟩ + refine + { isComplemented := by + rintro _ ⟨C, hC, rfl⟩ + exact hcomp_of hC + le_complement := by + rintro _ ⟨C₁, h₁, rfl⟩ _ ⟨C₂, h₂, rfl⟩ hne + exact hle_comp_of h₁ h₂ fun hEq ↦ hne (congrArg G_of hEq) } + +/-- **Claim (5)** in the proof of Graph Minors XVIII, (5.5) (page 97): +`M(G, ℒ) = M(G*, ℒ')`, where `ℒ' = {G_C : C ∈ ℒ}`. -/ +theorem lemma_5_5_claim_5 {P P_star : PartialPatchwork Ω α β} + {ℒ ℒ_star : Set (RootedHypergraph α β)} + (hℒ : IsRootedLocation P.G ℒ) + {newEdge_star : RootedHypergraph α β → β} + (hP_star : IsPlaceHeart P ℒ_star newEdge_star P_star) + {partR : RootedHypergraph α β → Set (RootedHypergraph α β)} + (hpart_sub : ∀ ⦃C⦄, C ∈ ℒ → partR C ⊆ ℒ_star) + (hpart_disj : ∀ ⦃C₁⦄, C₁ ∈ ℒ → ∀ ⦃C₂⦄, C₂ ∈ ℒ → C₁ ≠ C₂ → + Disjoint (partR C₁) (partR C₂)) + (hpart_union : (⋃ C ∈ ℒ, partR C) = ℒ_star) + (hpart_le : ∀ ⦃C⦄, C ∈ ℒ → ∀ ⦃A⦄, A ∈ partR C → + A.toHypergraph ≤ C.toHypergraph ∧ + complementHypergraph P.G C ≤ complementHypergraph P.G A) + (G_of : RootedHypergraph α β → RootedHypergraph α β) + (hG_of : ∀ ⦃C⦄ (hC : C ∈ ℒ), + G_of C = + mkPlaceHeartHypergraph C + (isRootedLocation_partR hℒ hP_star.isRootedLocation hpart_sub hpart_le hC) + newEdge_star) : + rootedLocationCore P.G ℒ = rootedLocationCore P_star.G (G_of '' ℒ) := by + let G := P.G + have hℒ_star := hP_star.isRootedLocation + let ℒ' := G_of '' ℒ + have hℒ' : IsRootedLocation P_star.G ℒ' := + (lemma_5_5_claim_4 hℒ hP_star hpart_sub hpart_disj hpart_union hpart_le G_of hG_of).2 + have hle₁ : rootedLocationCore G ℒ ≤ G.toHypergraph := locationCore_le hℒ.isLocation + have hle_star : rootedLocationCore P_star.G ℒ' ≤ P_star.G.toHypergraph := + locationCore_le hℒ'.isLocation + -- Every edge of `rootedLocationCore P_star.G ℒ'` lies in `rootedLocationCore G ℒ_star`. + have he_in_core_star : ∀ e ∈ (rootedLocationCore P_star.G ℒ').edgeSet, + e ∈ (rootedLocationCore G ℒ_star).edgeSet := by + intro e he + rw [mem_rootedLocationCore_edgeSet_iff] at he + have he_star := he.1 + rw [hP_star.edgeSet_eq] at he_star + rcases he_star with he_core | ⟨A, hA_star, rfl⟩ + · exact he_core + · exfalso + have hA_union : A ∈ ⋃ C ∈ ℒ, partR C := hpart_union.symm ▸ hA_star + rw [Set.mem_iUnion₂] at hA_union + rcases hA_union with ⟨C, hC, hA_C⟩ + refine he.2 (G_of C) ⟨C, hC, rfl⟩ ?_ + rw [hG_of hC] + exact Or.inr ⟨A, hA_C, rfl⟩ + have hle₂ : rootedLocationCore P_star.G ℒ' ≤ G.toHypergraph := + { vertexSet_subset := by + refine hle_star.vertexSet_subset.trans ?_ + rw [hP_star.vertexSet_eq] + exact (locationCore_le hℒ_star.isLocation).vertexSet_subset + edgeSet_subset := fun e he ↦ + (locationCore_le hℒ_star.isLocation).edgeSet_subset (he_in_core_star e he) + ends_eq := fun e he ↦ + (hP_star.ends_core (he_in_core_star e he)).symm.trans (hle_star.ends_eq e he) } + -- Use `theorem_5_4_vertexSet` on `(P.restrict C, partR C)` for each `C ∈ ℒ`. + have h54_C : ∀ {C} (hC : C ∈ ℒ), + C.vertexSet \ C.rootSet = + ((G_of C).vertexSet \ (G_of C).rootSet) ∪ ⋃ A ∈ partR C, (A.vertexSet \ A.rootSet) := by + intro C hC + have hclaim3 := lemma_5_5_claim_3 hℒ hP_star hpart_sub hpart_union hpart_le hC + have h54 := (theorem_5_4_place hclaim3).1 + simpa [← hG_of hC] using h54 + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle₁ hle₂ ?_ ?_ + · ext v + rw [mem_rootedLocationCore_vertexSet_iff hℒ, mem_rootedLocationCore_vertexSet_iff hℒ', + hP_star.vertexSet_eq, mem_rootedLocationCore_vertexSet_iff hℒ_star] + simp only [ℒ', Set.forall_mem_image] + have hnot_diff : ∀ {B : RootedHypergraph α β}, + (v ∈ B.vertexSet → v ∈ B.rootSet) ↔ v ∉ B.vertexSet \ B.rootSet := by + intro B + simp only [Set.mem_sdiff, not_and, not_not] + simp only [hnot_diff] + rw [and_assoc] + refine and_congr_right fun _ ↦ ?_ + constructor + · intro hC + refine ⟨fun A hA hvA ↦ ?_, fun {C} hc hvc ↦ ?_⟩ + · have hA_union : A ∈ ⋃ C ∈ ℒ, partR C := hpart_union.symm ▸ hA + rw [Set.mem_iUnion₂] at hA_union + rcases hA_union with ⟨C, hc, hA_C⟩ + apply hC C hc + rw [h54_C hc] + exact Or.inr (Set.mem_biUnion hA_C hvA) + · apply hC C hc + rw [h54_C hc] + exact Or.inl hvc + · rintro ⟨hA_all, hGC_all⟩ C hc hvc + rw [h54_C hc] at hvc + rcases hvc with hvGC | hv_union + · exact hGC_all hc hvGC + · rw [Set.mem_iUnion₂] at hv_union + rcases hv_union with ⟨A, hA_C, hvA⟩ + exact hA_all A (hpart_sub hc hA_C) hvA + · ext e + rw [mem_rootedLocationCore_edgeSet_iff, mem_rootedLocationCore_edgeSet_iff] + constructor + · rintro ⟨heG, hallC⟩ + have he_core_star : e ∈ (rootedLocationCore G ℒ_star).edgeSet := by + rw [mem_rootedLocationCore_edgeSet_iff] + refine ⟨heG, fun A hA heA ↦ ?_⟩ + have hA_union : A ∈ ⋃ C ∈ ℒ, partR C := hpart_union.symm ▸ hA + rw [Set.mem_iUnion₂] at hA_union + rcases hA_union with ⟨C, hC, hA_C⟩ + exact hallC C hC ((hpart_le hC hA_C).1.edgeSet_subset heA) + refine ⟨hP_star.edgeSet_eq ▸ Or.inl he_core_star, ?_⟩ + rintro _ ⟨C, hC, rfl⟩ heGC + rw [hG_of hC] at heGC + rcases heGC with he_coreC | ⟨A, hA_C, rfl⟩ + · exact hallC C hC (mem_rootedLocationCore_edgeSet_iff.1 he_coreC).1 + · exact hP_star.newEdge_notMem_core (hpart_sub hC hA_C) he_core_star + · intro h + have he_core_star : e ∈ (rootedLocationCore G ℒ_star).edgeSet := + he_in_core_star e (mem_rootedLocationCore_edgeSet_iff.2 h) + have heG : e ∈ G.edgeSet := (mem_rootedLocationCore_edgeSet_iff.1 he_core_star).1 + refine ⟨heG, fun C hC heC ↦ ?_⟩ + apply h.2 (G_of C) ⟨C, hC, rfl⟩ + rw [hG_of hC] + left + rw [mem_rootedLocationCore_edgeSet_iff] + exact ⟨heC, fun A hA_C ↦ + (mem_rootedLocationCore_edgeSet_iff.1 he_core_star).2 A (hpart_sub hC hA_C)⟩ + +/-- **Claim (6)** in the proof of Graph Minors XVIII, (5.5) (pages 97–98): +The heart `P'` of `(P, ℒ)` is also a heart of `(P*, ℒ')` (`HasPlaceHeart P_star ℒ' P'`). -/ +theorem lemma_5_5_claim_6 {P P' P_star : PartialPatchwork Ω α β} + {ℒ ℒ_star : Set (RootedHypergraph α β)} + {newEdge newEdge_star : RootedHypergraph α β → β} + (hP' : IsPlaceHeart P ℒ newEdge P') + (hP_star : IsPlaceHeart P ℒ_star newEdge_star P_star) + {partR : RootedHypergraph α β → Set (RootedHypergraph α β)} + (hpart_sub : ∀ ⦃C⦄, C ∈ ℒ → partR C ⊆ ℒ_star) + (hpart_disj : ∀ ⦃C₁⦄, C₁ ∈ ℒ → ∀ ⦃C₂⦄, C₂ ∈ ℒ → C₁ ≠ C₂ → + Disjoint (partR C₁) (partR C₂)) + (hpart_union : (⋃ C ∈ ℒ, partR C) = ℒ_star) + (hpart_le : ∀ ⦃C⦄, C ∈ ℒ → ∀ ⦃A⦄, A ∈ partR C → + A.toHypergraph ≤ C.toHypergraph ∧ + complementHypergraph P.G C ≤ complementHypergraph P.G A) + (G_of : RootedHypergraph α β → RootedHypergraph α β) + (hG_of : ∀ ⦃C⦄ (hC : C ∈ ℒ), + G_of C = + mkPlaceHeartHypergraph C + (isRootedLocation_partR hP'.isRootedLocation hP_star.isRootedLocation hpart_sub hpart_le + hC) + newEdge_star) : + HasPlaceHeart P_star (G_of '' ℒ) P' := by + classical + have hℒ := hP'.isRootedLocation + have hℒ_star := hP_star.isRootedLocation + obtain ⟨hinj_G, hℒ'⟩ := + lemma_5_5_claim_4 hℒ hP_star hpart_sub hpart_disj hpart_union hpart_le G_of hG_of + have hcore_eq : rootedLocationCore P.G ℒ = rootedLocationCore P_star.G (G_of '' ℒ) := + lemma_5_5_claim_5 hℒ hP_star hpart_sub hpart_disj hpart_union hpart_le G_of hG_of + -- Every edge in `rootedLocationCore P.G ℒ` also belongs to `rootedLocationCore P.G ℒ_star`. + have hcore_sub_star : + (rootedLocationCore P.G ℒ).edgeSet ⊆ (rootedLocationCore P.G ℒ_star).edgeSet := by + intro e he + rw [mem_rootedLocationCore_edgeSet_iff] at he ⊢ + refine ⟨he.1, fun A hA heA ↦ ?_⟩ + have hA_union : A ∈ ⋃ C ∈ ℒ, partR C := hpart_union.symm ▸ hA + rw [Set.mem_iUnion₂] at hA_union + rcases hA_union with ⟨C, hC, hA_C⟩ + exact he.2 C hC ((hpart_le hC hA_C).1.edgeSet_subset heA) + let newEdge' : RootedHypergraph α β → β := fun B ↦ + if h : ∃ C ∈ ℒ, G_of C = B then newEdge h.choose else newEdge B + have hnewEdge'_eq : ∀ ⦃C⦄, C ∈ ℒ → newEdge' (G_of C) = newEdge C := by + intro C hC + have hex : ∃ C' ∈ ℒ, G_of C' = G_of C := ⟨C, hC, rfl⟩ + simp only [newEdge', hex, ↓reduceDIte] + exact congrArg newEdge (hinj_G hex.choose_spec.1 hC hex.choose_spec.2) + have himg_eq : newEdge' '' (G_of '' ℒ) = newEdge '' ℒ := by + ext e + simp only [Set.mem_image] + constructor + · rintro ⟨_, ⟨C, hC, rfl⟩, rfl⟩ + exact ⟨C, hC, (hnewEdge'_eq hC).symm⟩ + · rintro ⟨C, hC, rfl⟩ + exact ⟨G_of C, ⟨C, hC, rfl⟩, hnewEdge'_eq hC⟩ + refine ⟨newEdge', ?_⟩ + refine + { isRootedLocation := hℒ' + injOn_newEdge := by + rintro _ ⟨C₁, h₁, rfl⟩ _ ⟨C₂, h₂, rfl⟩ hEq + rw [hnewEdge'_eq h₁, hnewEdge'_eq h₂] at hEq + exact congrArg G_of (hP'.injOn_newEdge h₁ h₂ hEq) + newEdge_notMem_core := by + rintro _ ⟨C, hC, rfl⟩ + rw [← hcore_eq, hnewEdge'_eq hC] + exact hP'.newEdge_notMem_core hC + vertexSet_eq := hP'.vertexSet_eq.trans (congrArg Hypergraph.vertexSet hcore_eq) + edgeSet_eq := by + rw [hP'.edgeSet_eq, hcore_eq, himg_eq] + roots_eq := hP'.roots_eq.trans hP_star.roots_eq.symm + ends_core := fun f hf ↦ by + rw [← hcore_eq] at hf + rw [hP'.ends_core hf, hP_star.ends_core (hcore_sub_star hf)] + ends_newEdge := by + rintro _ ⟨C, hC, rfl⟩ + rw [hnewEdge'_eq hC, hP'.ends_newEdge hC, hG_of hC] + rfl + dom_eq := by + rw [hP'.dom_eq, ← hcore_eq, himg_eq] + congr 1 + ext e + simp only [Set.mem_inter_iff] + refine and_congr_right fun he ↦ ?_ + rw [hP_star.dom_eq] + simp only [Set.mem_union, Set.mem_inter_iff, Set.mem_image] + exact ⟨fun hd ↦ Or.inl ⟨hcore_sub_star he, hd⟩, + fun h ↦ h.elim (fun h1 ↦ h1.2) + (fun ⟨A, hA, hEq⟩ ↦ (hP_star.newEdge_notMem_core hA (hEq ▸ hcore_sub_star he)).elim)⟩ + μ_core := fun f hf ↦ by + rw [← hcore_eq] at hf + have hf_core := hf.1 + have hf_dom_star := hf.2 + rw [hP_star.dom_eq] at hf_dom_star + rcases hf_dom_star with ⟨hf_star_core, hf_dom⟩ | ⟨A, hA, rfl⟩ + · rw [hP'.μ_core ⟨hf_core, hf_dom⟩, hP_star.μ_core ⟨hf_star_core, hf_dom⟩] + · exact (hP_star.newEdge_notMem_core hA (hcore_sub_star hf_core)).elim + μ_newEdge := by + rintro _ ⟨C, hC, rfl⟩ + rw [hnewEdge'_eq hC, hP'.μ_newEdge hC, hG_of hC] + rfl + Δ_core := fun f hf ↦ by + rw [← hcore_eq] at hf + rw [hP'.Δ_core hf, hP_star.Δ_core (hcore_sub_star hf)] + Δ_newEdge := by + rintro _ ⟨C, hC, rfl⟩ + rw [hnewEdge'_eq hC, hP'.Δ_newEdge hC, hG_of hC] + have hclaim3 := lemma_5_5_claim_3 hℒ hP_star hpart_sub hpart_union hpart_le hC + exact (theorem_5_4_place hclaim3).2 + φ_core := fun f hf ↦ by + rw [← hcore_eq] at hf + rw [hP'.φ_core hf, hP_star.φ_core (hcore_sub_star hf)] + φ_newEdge := by + rintro _ ⟨C, hC, rfl⟩ + rw [hnewEdge'_eq hC, hP'.φ_newEdge hC] } + +/-- **Graph Minors XVIII, (5.5)** (page 95): +"Let $P = (G, \mu, \Delta, \phi)$ be an $\Omega$-patchwork, let $w \ge 0$, and let +$\mathscr{L}, \mathscr{L}^*$ be rooted locations in $G$, such that $\mathscr{L}^{*-}$ is an +enlargement of $\mathscr{L}^-$ by tree-width $\le w$. Then $P | \mathscr{L}^*$ is an +enlargement of $P | \mathscr{L}$ by tree-width $\le w$." + +The Lean version starts with a partial `Ω`-patchwork. The input and the two hearts may contain +unlabelled edges, represented by the bottom element of `WithBot Ω`. -/ +theorem theorem_5_5_proof {P P' P_star : PartialPatchwork Ω α β} + {ℒ ℒ_star : Set (RootedHypergraph α β)} {w : ℕ} + (hP' : HasPlaceHeart P ℒ P') + (hP_star : HasPlaceHeart P ℒ_star P_star) + (henl : IsLocationEnlargementByTreeWidth P.G.toHypergraph + (rootedLocationToLocation P.G ℒ) (rootedLocationToLocation P.G ℒ_star) (w : ℚ)) : + IsPlaceEnlargementByTreeWidth w P' P_star := by + classical + obtain ⟨newEdge, hheart⟩ := hP' + obtain ⟨newEdge_star, hheart_star⟩ := hP_star + obtain ⟨_, part_loc, hvia, htw⟩ := henl + let G := P.G + have hℒ := hheart.isRootedLocation + have hℒ_star := hheart_star.isRootedLocation + let toLoc : RootedHypergraph α β → Hypergraph α β × Hypergraph α β := + fun A ↦ (A.toHypergraph, complementHypergraph G A) + -- For each `p ∈ rootedLocationToLocation G ℒ`, choose a representative `rep p ∈ ℒ` with + -- `toLoc (rep p) = p`. + let rep : Hypergraph α β × Hypergraph α β → RootedHypergraph α β := fun p ↦ + if hp : ∃ C ∈ ℒ, toLoc C = p then hp.choose else G + have hrep_spec : ∀ {C : RootedHypergraph α β}, C ∈ ℒ → + rep (toLoc C) ∈ ℒ ∧ toLoc (rep (toLoc C)) = toLoc C := by + intro C hC + have hex : ∃ C' ∈ ℒ, toLoc C' = toLoc C := ⟨C, hC, rfl⟩ + simp only [rep, hex, ↓reduceDIte] + exact hex.choose_spec + let partR : RootedHypergraph α β → Set (RootedHypergraph α β) := fun C ↦ + if C = rep (toLoc C) then {A ∈ ℒ_star | toLoc A ∈ part_loc (toLoc C)} else ∅ + have hpart_sub : ∀ ⦃C⦄, C ∈ ℒ → partR C ⊆ ℒ_star := by + intro C _ A hA + dsimp only [partR] at hA + split_ifs at hA + · exact hA.1 + · exact hA.elim + have hpart_disj : ∀ ⦃C₁⦄, C₁ ∈ ℒ → ∀ ⦃C₂⦄, C₂ ∈ ℒ → C₁ ≠ C₂ → + Disjoint (partR C₁) (partR C₂) := by + intro C₁ h₁ C₂ h₂ hne + rw [Set.disjoint_left] + intro A hA₁ hA₂ + dsimp only [partR] at hA₁ hA₂ + split_ifs at hA₁ with hrep₁ <;> split_ifs at hA₂ with hrep₂ + · have hp_ne : toLoc C₁ ≠ toLoc C₂ := by + intro hp_eq + apply hne + rw [hrep₁, hrep₂, hp_eq] + exact Set.disjoint_left.1 + (hvia.part_disjoint ⟨C₁, h₁, rfl⟩ ⟨C₂, h₂, rfl⟩ hp_ne) hA₁.2 hA₂.2 + · exact hA₂ + · exact hA₁ + · exact hA₁ + have hpart_union : (⋃ C ∈ ℒ, partR C) = ℒ_star := by + apply Set.Subset.antisymm + · exact Set.iUnion₂_subset fun C hC ↦ hpart_sub hC + · intro A hA + have hlocA : toLoc A ∈ rootedLocationToLocation G ℒ_star := ⟨A, hA, rfl⟩ + rw [← hvia.biUnion_eq, Set.mem_iUnion₂] at hlocA + rcases hlocA with ⟨p, ⟨C₀, hC₀, rfl⟩, hA_part⟩ + let C := rep (toLoc C₀) + have ⟨hC_ℒ, hC_eq⟩ := hrep_spec hC₀ + have hC_rep : C = rep (toLoc C) := by + dsimp only [C] + rw [hC_eq] + refine Set.mem_iUnion₂.2 ⟨C, hC_ℒ, ?_⟩ + dsimp only [partR] + split_ifs + exact ⟨hA, hC_eq ▸ hA_part⟩ + have hpart_le : ∀ ⦃C⦄, C ∈ ℒ → ∀ ⦃A⦄, A ∈ partR C → + A.toHypergraph ≤ C.toHypergraph ∧ + complementHypergraph G C ≤ complementHypergraph G A := by + intro C hC A hA + dsimp only [partR] at hA + split_ifs at hA with hrep + · exact hvia.le_of_mem_part ⟨C, hC, rfl⟩ hA.2 + · exact hA.elim + have hpart_case : ∀ ⦃C⦄, C ∈ ℒ → + rootedLocationToLocation G (partR C) = + part_loc (C.toHypergraph, complementHypergraph G C) ∨ + (partR C = ∅ ∧ C.edgeSet = ∅ ∧ C.vertexSet = C.rootSet) := by + intro C hC + by_cases hrep : C = rep (toLoc C) + · left + have hpartR_eq : partR C = {A ∈ ℒ_star | toLoc A ∈ part_loc (toLoc C)} := by + dsimp only [partR] + split_ifs + rfl + ext q + simp only [rootedLocationToLocation, hpartR_eq, Set.mem_image, Set.mem_sep_iff] + constructor + · rintro ⟨A, ⟨_, hq⟩, rfl⟩ + exact hq + · intro hq + have hq_star := hvia.part_subset ⟨C, hC, rfl⟩ hq + rcases hq_star with ⟨A, hA_star, rfl⟩ + exact ⟨A, ⟨hA_star, hq⟩, rfl⟩ + · right + have hempty : partR C = ∅ := by simp [partR, hrep] + have ⟨hrep_ℒ, hrep_eq⟩ := hrep_spec hC + have hH_eq : C.toHypergraph = (rep (toLoc C)).toHypergraph := + (congrArg Prod.fst hrep_eq).symm + obtain ⟨hE, hV⟩ := eq_rootSet_of_toHypergraph_eq_of_ne hℒ hC hrep_ℒ hrep hH_eq + exact ⟨hempty, hE, hV⟩ + let G_of : RootedHypergraph α β → RootedHypergraph α β := fun C ↦ + if hC : C ∈ ℒ then + mkPlaceHeartHypergraph C (isRootedLocation_partR hℒ hℒ_star hpart_sub hpart_le hC) + newEdge_star + else G + have hG_of : ∀ ⦃C⦄ (hC : C ∈ ℒ), + G_of C = + mkPlaceHeartHypergraph C + (isRootedLocation_partR hℒ hℒ_star hpart_sub hpart_le hC) + newEdge_star := by + intro C hC + simp only [G_of, hC, ↓reduceDIte] + obtain ⟨_, hℒ'⟩ := + lemma_5_5_claim_4 hℒ hheart_star hpart_sub hpart_disj hpart_union hpart_le G_of hG_of + have hheart' := + lemma_5_5_claim_6 hheart hheart_star hpart_sub hpart_disj hpart_union hpart_le G_of hG_of + refine ⟨G_of '' ℒ, hℒ', hheart', ?_⟩ + rintro _ ⟨C, hC, rfl⟩ + rw [hG_of hC] + have hclaim3 := lemma_5_5_claim_3 hℒ hheart_star hpart_sub hpart_union hpart_le hC + exact lemma_5_5_claim_1 hℒ hℒ_star hvia htw hpart_sub hpart_le hpart_case hC hclaim3 + +end GraphMinor.GM18 +end diff --git a/LeanPool/GraphMinor/GM18/Section6.lean b/LeanPool/GraphMinor/GM18/Section6.lean new file mode 100644 index 0000000000..19096acff2 --- /dev/null +++ b/LeanPool/GraphMinor/GM18/Section6.lean @@ -0,0 +1,544 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM18.Section6Stars +import LeanPool.GraphMinor.GM04.Patchwork.Menger +import LeanPool.GraphMinor.GM18.Section4 +import LeanPool.GraphMinor.GM18.Section5 +import LeanPool.GraphMinor.Thomas.RootedTree + +/-! +# Graph Minors XVIII, Section 6: Well-Quasi-Ordering (Main Theorem 6.7) + +This file completes Section 6 of Robertson and Seymour, +*Graph Minors. XVIII. Tree-decompositions and well-quasi-ordering*, J. Combin. Theory Ser. B 89 +(2003) 77–108, by proving the main theorem (6.7) (pages 106–107) and re-exporting (6.1)–(6.6) +from `Section6Part1` and `Section6Part2`: + +* `lemma_6_7_claim_1` (6.7, claim (1), page 106): `𝒞* = enlargementClass 𝒞 𝒞'` is well-behaved, + where `𝒞'` is the class of robust partial `Ω`-patchworks of tree-width `≤ 3θ + 1`. +* `lemma_6_7_claim_2` (6.7, claim (2), page 106): for `P ∈ 𝒟` such that `G⁻` has a tangle of order + `≥ (4/3) θ`, applying (4.4) yields a proper, rotund tree-decomposition `(T, τ)` of `G⁻` whose edge + separations are robust and whose vertex locations are enlargements of isolating places with hearts + in `𝒞` by tree-width `≤ 3θ + 1`. +* `lemma_6_7_claim_3` (6.7, claim (3), pages 106–107): every piece of `P` at `t` under `(T, τ)` is + robust and belongs to `𝒞*`. +* `lemma_6_7_claim_4` (6.7, claim (4), page 107): for every `P ∈ 𝒟'`, there is a rotund, proper + tree-decomposition `(T, τ)` of `G⁻` such that all pieces of `P` under `(T, τ)` belong to `𝒞*`. +* `theorem_6_7_proof` (6.7, pages 106–107): the class `𝒟` of rootless, robust `Ω`-patchworks whose + tangles of order `≥ θ` are `θ`-isolated by `Ω`-places with hearts in `𝒞` is well-quasi-ordered by + simulation. The ambient class `𝒞` is well-behaved. +-/ + +public section + +namespace GraphMinor.GM18 + +open Hypergraph SimpleGraph + +universe u v w w' + +variable {α : Type u} {β : Type v} {Ω : Type w} + +/-! ## Helper lemmas for Claim (3) and Theorem (6.7) -/ + +/-- The class `𝒞'` of all robust partial `Ω`-patchworks of patchwork tree-width `≤ w` +(Graph Minors XVIII, proof of (6.7), page 106). -/ +def robustBoundedTWClass (Ω : Type w) (α : Type u) (β : Type v) (w : ℕ) : + Set (PartialPatchwork Ω α β) := + {Q | Q.IsRobust ∧ HasPatchworkTreeWidthLE Q w} + +/-- **Graph Minors XVIII, (6.7), Claim (1)** (page 106): +"`𝒞*` is well-behaved." -/ +theorem lemma_6_7_claim_1 + [Preorder Ω] {𝒞 : Set (PartialPatchwork Ω α β)} (h𝒞 : WellBehaved 𝒞) (θ : ℕ) : + WellBehaved (enlargementClass 𝒞 (robustBoundedTWClass Ω α β (3 * θ + 1))) := + theorem_6_3_proof h𝒞 (theorem_6_2_proof (3 * θ + 1)) + +/-- **Graph Minors XVIII, (6.7), Claim (2)** (page 106): +"There is a tree-decomposition $(T, \tau)$ of $G^-$ such that* *(a) $(T, \tau)$ is proper and +rotund,* *(b) for each $e \in E(T)$, the separations made by $e$ under $(T, \tau)$ are +robust, and* *(c) for each $t \in V(T)$, if $\mathscr{L}_t$ is the location of $t$ in $(T, +\tau)$, then there is an $\Omega$-place $(P, \mathscr{L})$ with heart in $\mathscr{C}$, such +that $\mathscr{L}_t$ is an enlargement of $\mathscr{L}^-$ by tree-width $\le 3\theta + 1$." -/ +theorem lemma_6_7_claim_2 {Λ : Type w'} [LinearOrder Λ] + {𝒞 : Set (PartialPatchwork Ω α β)} {θ : ℕ} (hθ : 1 ≤ θ) + {P : GM04.Patchwork Ω α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} (hlam : GM10.IsTieBreaker P.G.toHypergraph lam) + (hex_tangle : ∃ (θ₀ : ℕ) (𝒯₀ : Set (Hypergraph α β × Hypergraph α β)), + 4 * θ ≤ 3 * θ₀ ∧ GM10.IsTangle P.G.toHypergraph θ₀ 𝒯₀) + (hiso : ∀ ⦃θ' : ℕ⦄ ⦃𝒯 : Set (Hypergraph α β × Hypergraph α β)⦄, + θ ≤ θ' → GM10.IsTangle P.G.toHypergraph θ' 𝒯 → + ∃ (ℒ : Set (RootedHypergraph α β)) (P' : PartialPatchwork Ω α β), + IsOmegaPlace (toPartialPatchwork P) ℒ ∧ + HasPlaceHeart (toPartialPatchwork P) ℒ P' ∧ + P' ∈ 𝒞 ∧ + Isolates P.G.toHypergraph lam θ 𝒯 (rootedLocationToLocation P.G ℒ)) : + ∃ (n : ℕ) (T : SimpleGraph (Fin n)) (τ : Fin n → Hypergraph α β), + 1 ≤ n ∧ + GM10.IsTreeDecomposition P.G.toHypergraph T τ ∧ + IsProper P.G.toHypergraph T τ ∧ + IsRotund P.G.toHypergraph T τ ∧ + (∀ ⦃e : Sym2 (Fin n)⦄, e ∈ T.edgeSet → ∀ ⦃A B : Hypergraph α β⦄, + GM10.MakesSeparation T τ e A B → GM10.IsRobust P.G.toHypergraph A B) ∧ + (∀ t : Fin n, ∃ (ℒ : Set (RootedHypergraph α β)) (P' : PartialPatchwork Ω α β), + IsOmegaPlace (toPartialPatchwork P) ℒ ∧ + HasPlaceHeart (toPartialPatchwork P) ℒ P' ∧ + P' ∈ 𝒞 ∧ + IsLocationEnlargementByTreeWidth P.G.toHypergraph + (rootedLocationToLocation P.G ℒ) (vertexLocation T τ t) (3 * θ + 1)) := by + classical + let G := P.G.toHypergraph + let choosePlace : Set (Hypergraph α β × Hypergraph α β) → + Set (RootedHypergraph α β) × PartialPatchwork Ω α β := fun 𝒯 ↦ + if h : ∃ θ' : ℕ, θ ≤ θ' ∧ GM10.IsTangle G θ' 𝒯 then + let hex := hiso h.choose_spec.1 h.choose_spec.2 + (hex.choose, hex.choose_spec.choose) + else + (∅, toPartialPatchwork P) + have hchoose_spec : ∀ {θ' : ℕ} {𝒯 : Set (Hypergraph α β × Hypergraph α β)}, + θ ≤ θ' → GM10.IsTangle G θ' 𝒯 → + IsOmegaPlace (toPartialPatchwork P) (choosePlace 𝒯).1 ∧ + HasPlaceHeart (toPartialPatchwork P) (choosePlace 𝒯).1 (choosePlace 𝒯).2 ∧ + (choosePlace 𝒯).2 ∈ 𝒞 ∧ + Isolates G lam θ 𝒯 (rootedLocationToLocation P.G (choosePlace 𝒯).1) := by + intro θ' 𝒯 hle h𝒯 + have hex : ∃ θ₁ : ℕ, θ ≤ θ₁ ∧ GM10.IsTangle G θ₁ 𝒯 := ⟨θ', hle, h𝒯⟩ + dsimp only [choosePlace] + rw [dite_eq_left hex] + exact (hiso hex.choose_spec.1 hex.choose_spec.2).choose_spec.choose_spec + let L : Set (Hypergraph α β × Hypergraph α β) → Set (Hypergraph α β × Hypergraph α β) := + fun 𝒯 ↦ rootedLocationToLocation P.G (choosePlace 𝒯).1 + have hiso_L : ∀ ⦃θ' : ℕ⦄ ⦃𝒯 : Set (Hypergraph α β × Hypergraph α β)⦄, + θ ≤ θ' → GM10.IsTangle G θ' 𝒯 → Isolates G lam θ 𝒯 (L 𝒯) := + fun _ _ hle h𝒯 ↦ (hchoose_spec hle h𝒯).2.2.2 + obtain ⟨n, T, τ, hn, htd, hprop, hrot, hrob, hloc⟩ := + theorem_4_4_proof G lam hlam θ hθ L hiso_L hex_tangle + refine ⟨n, T, τ, hn, htd, hprop, hrot, hrob, fun t ↦ ?_⟩ + obtain ⟨θ', 𝒯, hθ'_ge, h𝒯, _, henl⟩ := hloc t + have hθ_le : θ ≤ θ' := by omega + have hspec := hchoose_spec hθ_le h𝒯 + exact ⟨(choosePlace 𝒯).1, (choosePlace 𝒯).2, hspec.1, hspec.2.1, hspec.2.2.1, henl⟩ + +/-- Separation order inequality in Claim (3) of (6.7) (page 107): +If `(A, B)` is a separation of `G`, `(C₁, C₂)` is a separation of `A`, `Y ⊆ V(A ∩ B) ∩ V(C₂)`, +and `|V(A ∩ B)| ≤ |V(C₁ ∩ (B ∪ C₂))|`, then `|Y| ≤ |V(C₁ ∩ C₂)|`. -/ +private theorem ncard_le_separationOrder_of_le_union {A B C₁ C₂ : Hypergraph α β} + (hCD : A.IsSeparation C₁ C₂) {Y : Set α} + (hY_AB : Y ⊆ (A ∩ B).vertexSet) (hY_C₂ : Y ⊆ C₂.vertexSet) + (hord : separationOrder A B ≤ separationOrder C₁ (B ∪ C₂)) : + Y.ncard ≤ separationOrder C₁ C₂ := by + have hsub : (C₁ ∩ (B ∪ C₂)).vertexSet ⊆ + (C₁ ∩ C₂).vertexSet ∪ ((A ∩ B).vertexSet \ Y) := by + intro v ⟨hvC₁, hvBC₂⟩ + by_cases hvC₂ : v ∈ C₂.vertexSet + · exact Or.inl ⟨hvC₁, hvC₂⟩ + · refine Or.inr ⟨⟨hCD.left_le.vertexSet_subset hvC₁, hvBC₂.resolve_right hvC₂⟩, ?_⟩ + intro hvY + exact hvC₂ (hY_C₂ hvY) + have hfin_union : ((C₁ ∩ C₂).vertexSet ∪ ((A ∩ B).vertexSet \ Y)).Finite := + (C₁ ∩ C₂).vertexSet_finite.union ((A ∩ B).vertexSet_finite.sdiff) + have hcard_le : separationOrder C₁ (B ∪ C₂) ≤ + separationOrder C₁ C₂ + ((A ∩ B).vertexSet \ Y).ncard := + (Set.ncard_le_ncard hsub hfin_union).trans (Set.ncard_union_le _ _) + have hY_fin : Y.Finite := (A ∩ B).vertexSet_finite.subset hY_AB + have hdiff_eq : ((A ∩ B).vertexSet \ Y).ncard = + separationOrder A B - Y.ncard := + Set.ncard_sdiff hY_AB hY_fin + have hY_le_AB : Y.ncard ≤ separationOrder A B := + Set.ncard_le_ncard hY_AB (A ∩ B).vertexSet_finite + omega + +/-- Counting argument in Claim (3) of (6.7) (page 107): +If `X₁, X₂ ⊆ V` are disjoint with `|X₁| = |X₂|`, `k = |V \ X₁|`, and `H` is a subgraph with `k` +distinct components `D i` (`i : Fin k`), each meeting both `V \ X₁` and `V \ X₂`, then the +grouping `K` on `V` induced by connectivity in `H` is a pairing in `V` that pairs `X₁, X₂`. -/ +private theorem isPairing_and_pairs_of_components {V X₁ X₂ : Set α} (hV : V.Finite) + (hX₁ : X₁ ⊆ V) (hX₂ : X₂ ⊆ V) (hcard : X₁.ncard = X₂.ncard) (hdisj : Disjoint X₁ X₂) + {H K : (⊤ : SimpleGraph α).Subgraph} (hK_verts : K.verts = V) + (hK_adj : ∀ u ∈ V, ∀ v ∈ V, u ≠ v → (ConnectedIn H u v ↔ K.Adj u v)) + {k : ℕ} (hk : k = (V \ X₁).ncard) + {D : Fin k → (⊤ : SimpleGraph α).Subgraph} (hD_inj : Function.Injective D) + (hD : ∀ i : Fin k, GM04.IsComponent H (D i) ∧ + ((D i).verts ∩ (V \ X₁)).Nonempty ∧ ((D i).verts ∩ (V \ X₂)).Nonempty) : + GM04.IsPairing V K ∧ GM04.Pairs V K X₁ X₂ := by + classical + let Y₁ := V \ X₁ + let Y₂ := V \ X₂ + have hY₁_fin : Y₁.Finite := hV.sdiff + have hY₂_fin : Y₂.Finite := hV.sdiff + have hk₂ : k = Y₂.ncard := by + rw [hk, Set.ncard_sdiff hX₁ (hV.subset hX₁), Set.ncard_sdiff hX₂ (hV.subset hX₂), hcard] + have hY_union : Y₁ ∪ Y₂ = V := by + ext v + simp only [Y₁, Y₂, Set.mem_union, Set.mem_sdiff] + constructor + · rintro (⟨hv, _⟩ | ⟨hv, _⟩) <;> exact hv + · intro hv + by_cases hv₁ : v ∈ X₁ + · exact Or.inr ⟨hv, Set.disjoint_left.1 hdisj hv₁⟩ + · exact Or.inl ⟨hv, hv₁⟩ + have hD_disj : ∀ {i j : Fin k}, i ≠ j → Disjoint (D i).verts (D j).verts := + fun hij ↦ (hD _).1.disjoint_verts_of_ne (hD _).1 (fun hEq ↦ hij (hD_inj hEq)) + choose y₁ hy₁_D hy₁_Y₁ using fun i : Fin k ↦ (hD i).2.1 + choose y₂ hy₂_D hy₂_Y₂ using fun i : Fin k ↦ (hD i).2.2 + have hy₁_inj : Function.Injective y₁ := by + intro i j hEq + by_contra hne + exact Set.disjoint_left.1 (hD_disj hne) (hy₁_D i) (hEq ▸ hy₁_D j) + have hy₂_inj : Function.Injective y₂ := by + intro i j hEq + by_contra hne + exact Set.disjoint_left.1 (hD_disj hne) (hy₂_D i) (hEq ▸ hy₂_D j) + have hrange₁ : Set.range y₁ = Y₁ := by + refine Set.eq_of_subset_of_ncard_le ?_ ?_ hY₁_fin + · rintro _ ⟨i, rfl⟩; exact hy₁_Y₁ i + · rw [Set.ncard_range_of_injective hy₁_inj, Nat.card_fin, ← hk] + have hrange₂ : Set.range y₂ = Y₂ := by + refine Set.eq_of_subset_of_ncard_le ?_ ?_ hY₂_fin + · rintro _ ⟨i, rfl⟩; exact hy₂_Y₂ i + · rw [Set.ncard_range_of_injective hy₂_inj, Nat.card_fin, ← hk₂] + have hinter₁ : ∀ (i : Fin k) {x : α}, x ∈ (D i).verts → x ∈ Y₁ → x = y₁ i := by + intro i x hxD hxY₁ + rw [← hrange₁] at hxY₁ + obtain ⟨j, rfl⟩ := hxY₁ + by_cases hij : j = i + · subst hij; rfl + · exact (Set.disjoint_left.1 (hD_disj hij) (hy₁_D j) hxD).elim + have hinter₂ : ∀ (i : Fin k) {x : α}, x ∈ (D i).verts → x ∈ Y₂ → x = y₂ i := by + intro i x hxD hxY₂ + rw [← hrange₂] at hxY₂ + obtain ⟨j, rfl⟩ := hxY₂ + by_cases hij : j = i + · subst hij; rfl + · exact (Set.disjoint_left.1 (hD_disj hij) (hy₂_D j) hxD).elim + have hinter_V : ∀ (i : Fin k) {x : α}, x ∈ (D i).verts → x ∈ V → x = y₁ i ∨ x = y₂ i := by + intro i x hxD hxV + rw [← hY_union] at hxV + rcases hxV with hx₁ | hx₂ + · exact Or.inl (hinter₁ i hxD hx₁) + · exact Or.inr (hinter₂ i hxD hx₂) + have hex_comp : ∀ u ∈ V, ∃ i : Fin k, u ∈ (D i).verts := by + intro u hu + rw [← hY_union, ← hrange₁, ← hrange₂] at hu + rcases hu with ⟨i, rfl⟩ | ⟨i, rfl⟩ + · exact ⟨i, hy₁_D i⟩ + · exact ⟨i, hy₂_D i⟩ + have hcomp_of_adj : ∀ {u v : α} (i : Fin k), u ∈ (D i).verts → K.Adj u v → v ∈ (D i).verts := by + intro u v i huD huv + have huV : u ∈ V := hK_verts ▸ K.edge_vert huv + have hvV : v ∈ V := hK_verts ▸ K.edge_vert huv.symm + have hconn : ConnectedIn H u v := (hK_adj u huV v hvV huv.ne).2 huv + obtain ⟨C, hC, huC, hvC⟩ := hconn + have hCD : C = D i := hC.eq_of_mem (hD i).1 huC huD + exact hCD ▸ hvC + have hpair : GM04.IsPairing V K := by + rw [GM04.isPairing_iff hV] + refine ⟨hK_verts.le, fun a b c hab hac ↦ ?_⟩ + have haV : a ∈ V := hK_verts ▸ K.edge_vert hab + have hbV : b ∈ V := hK_verts ▸ K.edge_vert hab.symm + have hcV : c ∈ V := hK_verts ▸ K.edge_vert hac.symm + obtain ⟨i, haD⟩ := hex_comp a haV + have hbD : b ∈ (D i).verts := hcomp_of_adj i haD hab + have hcD : c ∈ (D i).verts := hcomp_of_adj i haD hac + rcases hinter_V i haD haV with rfl | rfl <;> + rcases hinter_V i hbD hbV with h1 | h1 <;> + rcases hinter_V i hcD hcV with h2 | h2 + · exact (hab.ne h1.symm).elim + · exact (hab.ne h1.symm).elim + · exact (hac.ne h2.symm).elim + · exact h1.trans h2.symm + · exact h1.trans h2.symm + · exact (hac.ne h2.symm).elim + · exact (hab.ne h1.symm).elim + · exact (hab.ne h1.symm).elim + refine ⟨hpair, ?_⟩ + rw [GM04.pairs_iff_of_isPairing hV hpair] + refine ⟨hX₁, hX₂, hdisj, fun u v huv ↦ ?_, fun v hv ↦ ?_⟩ + · have huV : u ∈ V := hK_verts ▸ K.edge_vert huv + have hvV : v ∈ V := hK_verts ▸ K.edge_vert huv.symm + obtain ⟨i, huD⟩ := hex_comp u huV + have hvD : v ∈ (D i).verts := hcomp_of_adj i huD huv + have hy₁_in_X₂ : y₁ i ≠ y₂ i → y₁ i ∈ X₂ := by + intro hne + have hy₁_V : y₁ i ∈ V := (hy₁_Y₁ i).1 + by_contra hnot + exact hne (hinter₂ i (hy₁_D i) ⟨hy₁_V, hnot⟩) + have hy₂_in_X₁ : y₁ i ≠ y₂ i → y₂ i ∈ X₁ := by + intro hne + have hy₂_V : y₂ i ∈ V := (hy₂_Y₂ i).1 + by_contra hnot + exact hne (hinter₁ i (hy₂_D i) ⟨hy₂_V, hnot⟩).symm + rcases hinter_V i huD huV with rfl | rfl <;> + rcases hinter_V i hvD hvV with h1 | h1 + · exact (huv.ne h1.symm).elim + · subst h1 + exact Or.inr ⟨hy₁_in_X₂ huv.ne, hy₂_in_X₁ huv.ne⟩ + · subst h1 + exact Or.inl ⟨hy₂_in_X₁ huv.ne.symm, hy₁_in_X₂ huv.ne.symm⟩ + · exact (huv.ne h1.symm).elim + · rcases hv with hv₁ | hv₂ + · have hv_Y₂ : v ∈ Y₂ := ⟨hX₁ hv₁, Set.disjoint_left.1 hdisj hv₁⟩ + rw [← hrange₂] at hv_Y₂ + obtain ⟨i, rfl⟩ := hv_Y₂ + have hne : y₂ i ≠ y₁ i := fun hEq ↦ (hy₁_Y₁ i).2 (hEq ▸ hv₁) + have hconn : ConnectedIn H (y₂ i) (y₁ i) := ⟨D i, (hD i).1, hy₂_D i, hy₁_D i⟩ + exact ⟨y₁ i, (hK_adj (y₂ i) (hX₁ hv₁) (y₁ i) (hy₁_Y₁ i).1 hne).1 hconn⟩ + · have hv_Y₁ : v ∈ Y₁ := ⟨hX₂ hv₂, Set.disjoint_right.1 hdisj hv₂⟩ + rw [← hrange₁] at hv_Y₁ + obtain ⟨i, rfl⟩ := hv_Y₁ + have hne : y₁ i ≠ y₂ i := fun hEq ↦ (hy₂_Y₂ i).2 (hEq ▸ hv₂) + have hconn : ConnectedIn H (y₁ i) (y₂ i) := ⟨D i, (hD i).1, hy₁_D i, hy₂_D i⟩ + exact ⟨y₂ i, (hK_adj (y₁ i) (hX₂ hv₂) (y₂ i) (hy₂_Y₂ i).1 hne).1 hconn⟩ + +/-- **Graph Minors XVIII, (6.7), Claim (3)** (pages 106–107): +"Let $(T, \tau)$ be as in (2) and let $t \in V(T)$. Then every piece of $P$ at $t$ under $(T, +\tau)$ is in $\mathscr{C}^*$." -/ +theorem lemma_6_7_claim_3 + {ι : Type*} [Fintype ι] + {𝒞 : Set (PartialPatchwork Ω α β)} {θ : ℕ} + {P : GM04.Patchwork Ω α β} (_hrootless : IsRootless P) (hrob : P.IsRobust) + {T : SimpleGraph ι} {τ : ι → Hypergraph α β} + (hrobust : ∀ ⦃e : Sym2 ι⦄, e ∈ T.edgeSet → ∀ ⦃A B : Hypergraph α β⦄, + GM10.MakesSeparation T τ e A B → GM10.IsRobust P.G.toHypergraph A B) + {t : ι} + {ℒ : Set (RootedHypergraph α β)} {P' : PartialPatchwork Ω α β} + (hP'_heart : HasPlaceHeart (toPartialPatchwork P) ℒ P') (hP'_mem : P' ∈ 𝒞) + (henl : IsLocationEnlargementByTreeWidth P.G.toHypergraph + (rootedLocationToLocation P.G ℒ) (vertexLocation T τ t) (3 * θ + 1)) + {Q : PartialPatchwork Ω α β} (hQ_piece : IsPiece (toPartialPatchwork P) T τ t Q) : + Q ∈ enlargementClass 𝒞 (robustBoundedTWClass Ω α β (3 * θ + 1)) := by + classical + obtain ⟨ℒ_star, _, hℒ_star_eq, hQ_heart⟩ := hQ_piece + rw [← hℒ_star_eq] at henl + have henl_cast : IsLocationEnlargementByTreeWidth (toPartialPatchwork P).G.toHypergraph + (rootedLocationToLocation (toPartialPatchwork P).G ℒ) + (rootedLocationToLocation (toPartialPatchwork P).G ℒ_star) ((3 * θ + 1 : ℕ) : ℚ) := by + push_cast + exact henl + have henl_Q : IsPlaceEnlargementByTreeWidth (3 * θ + 1) P' Q := + theorem_5_5_proof hP'_heart hQ_heart henl_cast + obtain ⟨ℒ_Q, hℒ_Q, hheart_Q, htw_Q⟩ := henl_Q + -- Prove that `Q` is robust (`Q.IsRobust`). + have hQ_rob : Q.IsRobust := by + obtain ⟨newEdge_star, hQ_place⟩ := hQ_heart + have hℒ_star := hQ_place.isRootedLocation + intro e he + rw [hQ_place.edgeSet_eq] at he + rcases he with he_core | ⟨A, hA_star, rfl⟩ + · rw [hQ_place.Δ_core he_core] + exact hrob e ((mem_rootedLocationCore_edgeSet_iff.1 he_core).1) + · rw [hQ_place.Δ_newEdge hA_star] + let P_A := (toPartialPatchwork P).restrict A + have hcompA : IsComplemented P.G A := hℒ_star.isComplemented hA_star + let B := (complement P.G A hcompA).toHypergraph + have hB_eq : complementHypergraph P.G A = B := + complementHypergraph_eq_of_isComplemented hcompA + have hAB_loc : (A.toHypergraph, B) ∈ vertexLocation T τ t := by + rw [← hB_eq, ← hℒ_star_eq] + exact ⟨A, hA_star, rfl⟩ + obtain ⟨s, hadj, hAB_eq⟩ := hAB_loc + have hm_AB : GM10.MakesSeparation T τ s(s, t) A.toHypergraph B := + ⟨s, t, hadj.symm, rfl, congrArg Prod.fst hAB_eq, congrArg Prod.snd hAB_eq⟩ + have hrob_AB : GM10.IsRobust P.G.toHypergraph A.toHypergraph B := + hrobust (T.mem_edgeSet.2 hadj.symm) hm_AB + have hrootA_eq : A.rootSet = (A.toHypergraph ∩ B).vertexSet := + hcompA.isSeparation.rootSet_left + have hrob_PA : P_A.IsRobust := by + have hrob_part : (toPartialPatchwork P).IsRobust := hrob + exact isRobust_restrict hrob_part hcompA.le + refine ⟨A.rootSet_finite, ?_⟩ + intro X₁ hX₁ X₂ hX₂ hcard hdisj + change X₁ ⊆ A.rootSet at hX₁ + change X₂ ⊆ A.rootSet at hX₂ + let Y₁ := A.rootSet \ X₁ + let Y₂ := A.rootSet \ X₂ + let k := Y₁.ncard + have hY₁_sub_A : Y₁ ⊆ P_A.G.vertexSet := Set.sdiff_subset.trans A.roots_subset + have hY₂_sub_A : Y₂ ⊆ P_A.G.vertexSet := Set.sdiff_subset.trans A.roots_subset + have hV_fin : A.rootSet.Finite := A.rootSet_finite + have hk₂ : Y₂.ncard = k := by + change (A.rootSet \ X₂).ncard = (A.rootSet \ X₁).ncard + rw [Set.ncard_sdiff hX₂ (hV_fin.subset hX₂), + Set.ncard_sdiff hX₁ (hV_fin.subset hX₁), hcard] + have hcond1 : GM04.Theorem61Cond1 P_A Y₁ Y₂ k := by + rw [GM04.theorem_6_1_i_iff_disjointPaths menger hY₁_sub_A hY₂_sub_A k, + ← menger P_A.G.toHypergraph Y₁ Y₂ hY₁_sub_A hY₂_sub_A k] + intro H₁ H₂ hsepH hY₁_H₁ hY₂_H₂ + have hY₁_AB : Y₁ ⊆ (A.toHypergraph ∩ B).vertexSet := + hrootA_eq ▸ Set.sdiff_subset + have hY₂_AB : Y₂ ⊆ (A.toHypergraph ∩ B).vertexSet := + hrootA_eq ▸ Set.sdiff_subset + rcases hrob_AB.2 hsepH with hord₁ | hord₂ + · rw [← hk₂] + exact ncard_le_separationOrder_of_le_union hsepH hY₂_AB hY₂_H₂ hord₁ + · rw [GM10.separationOrder_comm H₁ H₂] + exact ncard_le_separationOrder_of_le_union hsepH.symm hY₁_AB hY₁_H₁ hord₂ + have hcond2 : GM04.Theorem61Cond2 P_A Y₁ Y₂ k := + ((GM04.theorem_6_1_proof menger hrob_PA hY₁_sub_A hY₂_sub_A k).1).1 hcond1 + obtain ⟨H, D, hH, hD_inj, hD⟩ := hcond2 + obtain ⟨K, hK_feas, hK_adj⟩ := exists_isFeasibleGrouping_of_isRealization hH + have ⟨hK_pair, hK_pairs⟩ := + isPairing_and_pairs_of_components hV_fin hX₁ hX₂ hcard hdisj hK_feas.2.1 hK_adj rfl + hD_inj hD + exact ⟨K, hK_feas, hK_pair, hK_pairs⟩ + refine ⟨P', hP'_mem, ℒ_Q, hℒ_Q, hheart_Q, fun A hA ↦ ?_⟩ + exact ⟨isRobust_restrict hQ_rob (hℒ_Q.isComplemented hA).le, htw_Q A hA⟩ + +/-- **Graph Minors XVIII, (6.7), Claim (4)** (page 107): +"For all $P = (G, \mu, \Delta, \phi) \in \mathscr{D}'$, there is a rotund, proper +tree-decomposition $(T, \tau)$ of $G^-$ such that all pieces of $P$ under $(T, \tau)$ belong +to $\mathscr{C}^*$." -/ +theorem lemma_6_7_claim_4 {Λ : Type w'} [LinearOrder Λ] + {𝒞 : Set (PartialPatchwork Ω α β)} {θ : ℕ} (hθ : 1 ≤ θ) + {P : GM04.Patchwork Ω α β} (hrootless : IsRootless P) (hrob : P.IsRobust) + {lam : Hypergraph α β × Hypergraph α β → Λ} (hlam : GM10.IsTieBreaker P.G.toHypergraph lam) + (hex_tangle : ∃ (θ₀ : ℕ) (𝒯₀ : Set (Hypergraph α β × Hypergraph α β)), + 4 * θ ≤ 3 * θ₀ ∧ GM10.IsTangle P.G.toHypergraph θ₀ 𝒯₀) + (hiso : ∀ ⦃θ' : ℕ⦄ ⦃𝒯 : Set (Hypergraph α β × Hypergraph α β)⦄, + θ ≤ θ' → GM10.IsTangle P.G.toHypergraph θ' 𝒯 → + ∃ (ℒ : Set (RootedHypergraph α β)) (P' : PartialPatchwork Ω α β), + IsOmegaPlace (toPartialPatchwork P) ℒ ∧ + HasPlaceHeart (toPartialPatchwork P) ℒ P' ∧ + P' ∈ 𝒞 ∧ + Isolates P.G.toHypergraph lam θ 𝒯 (rootedLocationToLocation P.G ℒ)) : + ∃ (n : ℕ) (T : SimpleGraph (Fin n)) (τ : Fin n → Hypergraph α β), + 1 ≤ n ∧ + GM10.IsTreeDecomposition P.G.toHypergraph T τ ∧ + IsProper P.G.toHypergraph T τ ∧ + IsRotund P.G.toHypergraph T τ ∧ + (∀ t : Fin n, ∀ Q : PartialPatchwork Ω α β, + IsPiece (toPartialPatchwork P) T τ t Q → + Q ∈ enlargementClass 𝒞 (robustBoundedTWClass Ω α β (3 * θ + 1))) := by + obtain ⟨n, T, τ, hn, htd, hprop, hrot, hrobust, hloc⟩ := + lemma_6_7_claim_2 hθ hlam hex_tangle hiso + refine ⟨n, T, τ, hn, htd, hprop, hrot, fun t Q hQ ↦ ?_⟩ + obtain ⟨ℒ, P', _, hP'_heart, hP'_mem, henl⟩ := hloc t + exact lemma_6_7_claim_3 hrootless hrob hrobust hP'_heart hP'_mem henl hQ + +private theorem exists_strictMono_of_infinite {I : Set ℕ} (hI : I.Infinite) : + ∃ sub : ℕ → ℕ, StrictMono sub ∧ ∀ m, sub m ∈ I := by + obtain ⟨i₀, hi₀⟩ := hI.nonempty + have hex : ∀ k : ℕ, ∃ m ∈ I, k < m := by + intro k + obtain ⟨m, hm, hgt⟩ := (hI.sdiff (Set.finite_le_nat k)).nonempty + exact ⟨m, hm, not_le.1 hgt⟩ + choose next hnext_I hnext_gt using hex + let sub : ℕ → ℕ := fun r ↦ Nat.rec i₀ (fun _ prev ↦ next prev) r + refine ⟨sub, strictMono_nat_of_lt_succ fun r ↦ hnext_gt (sub r), fun r ↦ ?_⟩ + cases r with + | zero => exact hi₀ + | succ r => exact hnext_I (sub r) + +/-- **Graph Minors XVIII, (6.7)** (pages 106–107): +"**6.7.** *Let $\Omega$ be a well-quasi-order, let $\mathscr{C}$ be a well-behaved class of +rootless partial $\Omega$-patchworks, and let $\theta \ge 1$ be an integer. Let $\mathscr{D}$ be a +class of rootless, robust $\Omega$-patchworks and suppose that for each $P \in \mathscr{D}$ there +is a tie-breaker $\lambda$ in $\|P\|^-$ such that for every tangle $\mathscr{T}$ in $G^-$ of order +$\ge \theta$, there is an $\Omega$-place $(P, \mathscr{L})$ with heart in $\mathscr{C}$ such that +$\mathscr{L}^-$ $\theta$-isolates $\mathscr{T}$. Then $\mathscr{D}$ is well-quasi-ordered by +simulation.*" + +The Lean version allows any well-behaved ambient class `𝒞` containing the specified hearts. +The input class `𝒟` still consists of rootless, robust patchworks. An infinite ambient edge type +supplies fresh edge labels. -/ +theorem theorem_6_7_proof [Infinite β] [Preorder Ω] + (hΩ : WellQuasiOrderedLE Ω) + {𝒞 : Set (PartialPatchwork Ω α β)} (h𝒞 : WellBehaved 𝒞) + {θ : ℕ} (hθ : 1 ≤ θ) + {𝒟 : Set (GM04.Patchwork Ω α β)} + (h𝒟 : ∀ ⦃P : GM04.Patchwork Ω α β⦄, P ∈ 𝒟 → + IsRootless P ∧ P.IsRobust ∧ + ∃ (Λ : Type w') (_ : LinearOrder Λ) (lam : Hypergraph α β × Hypergraph α β → Λ), + GM10.IsTieBreaker P.G.toHypergraph lam ∧ + ∀ ⦃θ' : ℕ⦄ ⦃𝒯 : Set (Hypergraph α β × Hypergraph α β)⦄, + θ ≤ θ' → GM10.IsTangle P.G.toHypergraph θ' 𝒯 → + ∃ (ℒ : Set (RootedHypergraph α β)) (P' : PartialPatchwork Ω α β), + IsOmegaPlace (toPartialPatchwork P) ℒ ∧ + HasPlaceHeart (toPartialPatchwork P) ℒ P' ∧ + P' ∈ 𝒞 ∧ + Isolates P.G.toHypergraph lam θ 𝒯 (rootedLocationToLocation P.G ℒ)) : + ∀ P : ℕ → GM04.Patchwork Ω α β, (∀ i, P i ∈ 𝒟) → + ∃ i j, i < j ∧ GM04.Simulated (P i) (P j) := by + classical + intro P hP + let HasLargeTangle : GM04.Patchwork Ω α β → Prop := fun Q ↦ + ∃ (θ₀ : ℕ) (𝒯₀ : Set (Hypergraph α β × Hypergraph α β)), + 4 * θ ≤ 3 * θ₀ ∧ GM10.IsTangle Q.G.toHypergraph θ₀ 𝒯₀ + let I₁ : Set ℕ := {i | HasLargeTangle (P i)} + let I₂ : Set ℕ := {i | ¬ HasLargeTangle (P i)} + have hI_union : I₁ ∪ I₂ = Set.univ := by + ext i + simp [I₁, I₂, em] + have hI_inf : I₁.Infinite ∨ I₂.Infinite := + Set.infinite_union.1 (hI_union.symm ▸ Set.infinite_univ) + rcases hI_inf with hI₁ | hI₂ + · -- Case 1: Infinitely many `P i` belong to `𝒟'` (`HasLargeTangle (P i)`). + obtain ⟨sub, hsub_mono, hsub_mem⟩ := exists_strictMono_of_infinite hI₁ + let P_sub : ℕ → GM04.Patchwork Ω α β := fun m ↦ P (sub m) + have h𝒞_star : WellBehaved (enlargementClass 𝒞 (robustBoundedTWClass Ω α β (3 * θ + 1))) := + lemma_6_7_claim_1 h𝒞 θ + have hex_decomp : ∀ m : ℕ, + ∃ (n : ℕ) (S : SimpleGraph (Fin n)) (σ : Fin n → Hypergraph α β), + 1 ≤ n ∧ + GM10.IsTreeDecomposition (P_sub m).G.toHypergraph S σ ∧ + IsProper (P_sub m).G.toHypergraph S σ ∧ + IsRotund (P_sub m).G.toHypergraph S σ ∧ + (∀ t : Fin n, ∀ Q : PartialPatchwork Ω α β, + IsPiece (toPartialPatchwork (P_sub m)) S σ t Q → + Q ∈ enlargementClass 𝒞 (robustBoundedTWClass Ω α β (3 * θ + 1))) := by + intro m + obtain ⟨hrootless_m, hrob_m, Λ, hlin, lam, hlam, hiso⟩ := h𝒟 (hP (sub m)) + let _ : LinearOrder Λ := hlin + exact lemma_6_7_claim_4 hθ hrootless_m hrob_m hlam (hsub_mem m) hiso + choose n S σ _ htd hprop hrot hpieces using hex_decomp + have hrootless_sub : ∀ m, IsRootless (P_sub m) := fun m ↦ (h𝒟 (hP (sub m))).1 + have hrob_sub : ∀ m, (P_sub m).IsRobust := fun m ↦ (h𝒟 (hP (sub m))).2.1 + obtain ⟨m₁, m₂, hm₁₂, hsim⟩ := + theorem_6_6_proof hΩ h𝒞_star P_sub hrootless_sub hrob_sub S σ htd hrot hprop hpieces + exact ⟨sub m₁, sub m₂, hsub_mono hm₁₂, hsim⟩ + · -- Case 2: Infinitely many `P i` belong to `𝒟 \ 𝒟'` (`¬ HasLargeTangle (P i)`). + obtain ⟨sub, hsub_mono, hsub_mem⟩ := exists_strictMono_of_infinite hI₂ + let P_sub : ℕ → GM04.Patchwork Ω α β := fun m ↦ P (sub m) + have h𝒞' : WellBehaved (robustBoundedTWClass Ω α β (3 * θ + 1)) := + theorem_6_2_proof (3 * θ + 1) + have hsub_in_𝒞' : toPartialPatchwork '' Set.range P_sub ⊆ + robustBoundedTWClass Ω α β (3 * θ + 1) := by + rintro _ ⟨_, ⟨m, rfl⟩, rfl⟩ + obtain ⟨hrootless_m, hrob_m, _⟩ := h𝒟 (hP (sub m)) + refine ⟨hrob_m, ?_⟩ + let θ₁ : ℕ := (4 * θ + 2) / 3 + have hθ₁_pos : 1 ≤ θ₁ := by omega + have hno : ∀ ⦃θ' : ℕ⦄ ⦃𝒯 : Set (Hypergraph α β × Hypergraph α β)⦄, + GM10.IsTangle (P_sub m).G.toHypergraph θ' 𝒯 → θ' < θ₁ := by + intro θ' 𝒯 h𝒯 + by_contra hge + have h4 : 4 * θ ≤ 3 * θ' := by omega + exact hsub_mem m ⟨θ', 𝒯, h4, h𝒯⟩ + have htw_22 := theorem_2_2_proof (P_sub m).G.toHypergraph hθ₁_pos hno + have htw_le : GM10.treeWidth (P_sub m).G.toHypergraph ≤ (3 * θ + 1 : ℤ) := by omega + obtain ⟨ι, hfin_ι, K, τ_K, hD_K, hw_K⟩ := + exists_isTreeDecomposition_treeDecompWidthPlusOne_eq (P_sub m).G.toHypergraph + let _ : Fintype ι := hfin_ι + obtain ⟨t₀⟩ := hD_K.isTree.connected.nonempty + refine ⟨ι, hfin_ι, K, τ_K, t₀, hD_K, ?_, ?_⟩ + · unfold GM10.treeDecompWidth + rw [hw_K] + exact htw_le + · change (P_sub m).G.rootSet ⊆ (τ_K t₀).vertexSet + rw [hrootless_m] + exact Set.empty_subset _ + have h_wqo := + (wellBehaved_image_toPartialPatchwork_iff hΩ (Set.range P_sub)).1 (h𝒞'.mono hsub_in_𝒞') + obtain ⟨m₁, m₂, hm₁₂, hsim⟩ := h_wqo P_sub (fun m ↦ ⟨m, rfl⟩) + exact ⟨sub m₁, sub m₂, hsub_mono hm₁₂, hsim⟩ + +end GraphMinor.GM18 +end diff --git a/LeanPool/GraphMinor/GM18/Section6Part1.lean b/LeanPool/GraphMinor/GM18/Section6Part1.lean new file mode 100644 index 0000000000..14371077ff --- /dev/null +++ b/LeanPool/GraphMinor/GM18/Section6Part1.lean @@ -0,0 +1,2132 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.Decomposition.Rotund +public import LeanPool.GraphMinor.GM04.Patchwork.Stars +public import LeanPool.GraphMinor.GM18.Section5 +import LeanPool.GraphMinor.GM04.Patchwork.Menger +import LeanPool.GraphMinor.Thomas.RootedTree + +/-! +# Graph Minors XVIII, Section 6 (Part 1): Well-Behavedness and Rooted Decompositions + +This file formalizes (6.1)–(6.5) of Section 6 (pages 100–104) of Robertson and Seymour, +*Graph Minors. XVIII. Tree-decompositions and well-quasi-ordering*, J. Combin. Theory Ser. B 89 +(2003), 77–108: + +- `theorem_6_1` (6.1, page 100): the class of all rootings of rootless members of a well-behaved + class is well-behaved. +- `theorem_6_2` (6.2, page 101): the class of all robust partial `Ω`-patchworks of tree-width `≤ w` + is well-behaved (assuming Graph Minors IV, (9.1)). +- `theorem_6_3` (6.3, page 101): if `𝒞₁, 𝒞₂` are well-behaved classes of partial `Ω`-patchworks, + then `enlargementClass 𝒞₁ 𝒞₂` is well-behaved. +- `theorem_6_4` (6.4, page 102): every rotund tree-decomposition `(S, σ)` of `‖P‖⁻` for a rootless + robust `Ω`-patchwork `P` lifts to a rooted decomposition `(T, τ)` of `P` on any arborescence `T` + with `T⁻ = S`. +- `theorem_6_5_1`, `theorem_6_5_2`, `theorem_6_5_3`, and `theorem_6_5` (6.5, page 103, with Claims + (1)–(3) `lemma_6_5_claim_1`–`lemma_6_5_claim_3`): structural properties of subtrees, root sides, + and child locations in a rooted decomposition of a rootless `Ω`-patchwork. +-/ + +public section + +namespace GraphMinor.GM18 + +open SimpleGraph Hypergraph + +universe u v w + +variable {α : Type u} {β : Type v} {Ω : Type w} + +/-! ## Disjoint unions of well-quasi-orders and basic properties of `WellBehaved` -/ + +/-- The left injection `Sum.inl` as an order embedding into `DisjointUnionQuasiOrder Ω₁ Ω₂`. -/ +@[expose] def DisjointUnionQuasiOrder.inlEmb (Ω₁ Ω₂ : Type*) [Preorder Ω₁] [Preorder Ω₂] : + Ω₁ ↪o DisjointUnionQuasiOrder Ω₁ Ω₂ where + toFun := Sum.inl + inj' _ _ h := Sum.inl.inj h + map_rel_iff' := by + intro a b + constructor + · intro h + cases h with + | inl hab => exact hab + · exact DisjointUnionLE.inl + +/-- The right injection `Sum.inr` as an order embedding into `DisjointUnionQuasiOrder Ω₁ Ω₂`. -/ +@[expose] def DisjointUnionQuasiOrder.inrEmb (Ω₁ Ω₂ : Type*) [Preorder Ω₁] [Preorder Ω₂] : + Ω₂ ↪o DisjointUnionQuasiOrder Ω₁ Ω₂ where + toFun := Sum.inr + inj' _ _ h := Sum.inr.inj h + map_rel_iff' := by + intro a b + constructor + · intro h + cases h with + | inr hab => exact hab + · exact DisjointUnionLE.inr + +/-- A subset of a well-behaved class is well-behaved. -/ +theorem WellBehaved.mono [Preorder Ω] {𝒞₁ 𝒞₂ : Set (PartialPatchwork Ω α β)} + (hsub : 𝒞₁ ⊆ 𝒞₂) (h₂ : WellBehaved 𝒞₂) : WellBehaved 𝒞₁ := + fun Ω' _ ι hΩ' Q hQ ↦ + h₂ Ω' ι hΩ' Q fun i ↦ + let ⟨P, hP, hcomp⟩ := hQ i + ⟨P, hsub hP, hcomp⟩ + +/-- The union of two well-behaved classes is well-behaved (Graph Minors XVIII, page 105). -/ +theorem WellBehaved.union [Preorder Ω] {𝒞₁ 𝒞₂ : Set (PartialPatchwork Ω α β)} + (h₁ : WellBehaved 𝒞₁) (h₂ : WellBehaved 𝒞₂) : WellBehaved (𝒞₁ ∪ 𝒞₂) := by + intro Ω' _ ι hΩ' Q hQ + let S₁ : Set ℕ := {n | ∃ P ∈ 𝒞₁, IsCompletion ι P (Q n)} + let S₂ : Set ℕ := {n | ∃ P ∈ 𝒞₂, IsCompletion ι P (Q n)} + have huniv : (Set.univ : Set ℕ) ⊆ S₁ ∪ S₂ := by + intro n _ + obtain ⟨P, hP₁ | hP₂, hcomp⟩ := hQ n + · exact Or.inl ⟨P, hP₁, hcomp⟩ + · exact Or.inr ⟨P, hP₂, hcomp⟩ + rcases Set.infinite_union.1 (Set.infinite_univ.mono huniv) with hS₁ | hS₂ + · have : Infinite S₁ := hS₁.to_subtype + let e := Nat.Subtype.orderIsoOfNat S₁ + obtain ⟨m, n, hmn, hsim⟩ := h₁ Ω' ι hΩ' (fun k ↦ Q (e k).1) (fun k ↦ (e k).2) + exact ⟨(e m).1, (e n).1, e.strictMono hmn, hsim⟩ + · have : Infinite S₂ := hS₂.to_subtype + let e := Nat.Subtype.orderIsoOfNat S₂ + obtain ⟨m, n, hmn, hsim⟩ := h₂ Ω' ι hΩ' (fun k ↦ Q (e k).1) (fun k ↦ (e k).2) + exact ⟨(e m).1, (e n).1, e.strictMono hmn, hsim⟩ + +/-- Restricting a completion `Q` of `P` to `A ≤ P.G` yields a completion `Q | A` of `P | A`. -/ +theorem IsCompletion.restrict {Ω' : Type*} [Preorder Ω] [Preorder Ω'] {ι : Ω ↪o Ω'} + {P : PartialPatchwork Ω α β} {Q : GM04.Patchwork Ω' α β} (h : IsCompletion ι P Q) + {A : RootedHypergraph α β} (hA : A.toHypergraph ≤ P.G.toHypergraph) : + IsCompletion ι (P.restrict A) (Q.restrict A) where + G_eq := rfl + dom_eq := by + have hA_Q : A.toHypergraph ≤ Q.G.toHypergraph := h.G_eq.symm ▸ hA + rw [Q.restrict_dom hA_Q, P.restrict_dom hA, h.dom_eq] + μ_eq e he := by + rw [P.restrict_dom hA] at he + exact h.μ_eq he.1 + Δ_eq e he := by + have hA_Q : A.toHypergraph ≤ Q.G.toHypergraph := h.G_eq.symm ▸ hA + rw [Q.restrict_Δ hA_Q he, P.restrict_Δ hA he] + exact h.Δ_eq (hA.edgeSet_subset he) + φ_eq e he ω hφ := + h.φ_eq (hA.edgeSet_subset he) hφ + +/-! ## Theorem (6.1): Rootings of rootless members of a well-behaved class -/ + +/-- **Graph Minors XVIII, (6.1)** (page 100): +"Let $\Omega$ be a well-quasi-order, and let $\mathcal{C}$ be a well-behaved class of partial +$\Omega$-patchworks. Let $\mathcal{C}'$ be the class of all rootings of rootless members of +$\mathcal{C}$. Then $\mathcal{C}'$ is well-behaved." -/ +theorem theorem_6_1_proof [Preorder Ω] {𝒞 : Set (PartialPatchwork Ω α β)} (h𝒞 : WellBehaved 𝒞) : + WellBehaved {P' : PartialPatchwork Ω α β | ∃ P ∈ 𝒞, IsRooting P P'} := by + classical + intro Ω' _ ι hΩ' Q' hQ' + let UnitType := PUnit.{max w (max u v) + 1} + have hUnit_wqo : WellQuasiOrderedLE UnitType := Finite.to_wellQuasiOrderedLE + let Ω'' := DisjointUnionQuasiOrder Ω' UnitType + have hΩ''_wqo : WellQuasiOrderedLE Ω'' := wellQuasiOrderedLE_disjointUnion hΩ' hUnit_wqo + let inlEmb := DisjointUnionQuasiOrder.inlEmb Ω' UnitType + let ι'' : Ω ↪o Ω'' := ι.trans inlEmb + choose P' hP'_mem hcomp' using hQ' + choose P hP_mem hrooting using hP'_mem + choose hrootless e he_dom he_φ hle hdel hroots hrestr using hrooting + let Q : ℕ → GM04.Patchwork Ω'' α β := fun i ↦ + { G := (P i).G + dom := (P i).dom + μ := (P i).μ + Δ := (P i).Δ + φ := fun x ↦ if x = e i then Sum.inr PUnit.unit else Sum.inl ((Q' i).φ x) + dom_subset := (P i).dom_subset + μ_nodup := (P i).μ_nodup + μ_set := (P i).μ_set + Δ_verts := (P i).Δ_verts + Δ_free := (P i).Δ_free } + have hQ_comp : ∀ i, ∃ P₀ ∈ 𝒞, IsCompletion ι'' P₀ (Q i) := by + intro i + refine ⟨P i, hP_mem i, ⟨rfl, rfl, fun _ _ ↦ rfl, fun _ _ ↦ rfl, ?_⟩⟩ + intro x hx ω hx_φ + have hx_ne : x ≠ e i := by + rintro rfl + rw [he_φ i] at hx_φ + exact WithBot.coe_ne_bot hx_φ.symm + have hx_P' : x ∈ (P' i).G.edgeSet := by + rw [hdel i] + exact ⟨hx, hx_ne⟩ + have hx_φ' : (P' i).φ x = (ω : WithBot Ω) := by + rw [hrestr i] + exact hx_φ + have hQ'_φ : (Q' i).φ x = ι ω := (hcomp' i).φ_eq hx_P' hx_φ' + change (if x = e i then Sum.inr PUnit.unit else Sum.inl ((Q' i).φ x)) = Sum.inl (ι ω) + rw [ite_eq_right hx_ne, hQ'_φ] + obtain ⟨i, j, hij, ηv, ηe, hexp, H, hH_real, hH_comp⟩ := h𝒞 Ω'' ι'' hΩ''_wqo Q hQ_comp + have hei_edge : e i ∈ (Q i).G.edgeSet := (P i).dom_subset (he_dom i) + have hη_ei_eq : ηe (e i) = e j := by + have hφ_le := hexp.φ_le (e i) hei_edge + change DisjointUnionLE (if e i = e i then Sum.inr PUnit.unit else Sum.inl ((Q' i).φ (e i))) + (if ηe (e i) = e j then Sum.inr PUnit.unit else Sum.inl ((Q' j).φ (ηe (e i)))) at hφ_le + rw [ite_eq_left rfl] at hφ_le + by_cases hEq : ηe (e i) = e j + · exact hEq + · rw [ite_eq_right hEq] at hφ_le + nomatch hφ_le + have hV_eq : ∀ k, (Q' k).G.vertexSet = (Q k).G.vertexSet := by + intro k + rw [(hcomp' k).G_eq] + change (P' k).G.toHypergraph.vertexSet = (P k).G.vertexSet + rw [hdel k] + rfl + have hE_eq : ∀ k, (Q' k).G.edgeSet = (Q k).G.edgeSet \ {e k} := by + intro k + rw [(hcomp' k).G_eq] + change (P' k).G.toHypergraph.edgeSet = (P k).G.edgeSet \ {e k} + rw [hdel k] + rfl + have hdom_eq : ∀ k, (Q' k).dom = (Q k).dom ∩ (Q' k).G.edgeSet := by + intro k + rw [(hcomp' k).dom_eq, (hcomp' k).G_eq, hrestr k, (P k).restrict_dom (hle k)] + rfl + have hends_eq : ∀ k x, x ∈ (Q' k).G.edgeSet → (Q' k).G.ends x = (Q k).G.ends x := by + intro k x hx + rw [(hcomp' k).G_eq] at hx ⊢ + exact ((hle k).ends_eq x hx).symm + have hμ_eq : ∀ k x, x ∈ (Q' k).dom → (Q' k).μ x = (Q k).μ x := by + intro k x hx + rw [(hcomp' k).dom_eq] at hx + rw [(hcomp' k).μ_eq hx, hrestr k] + rfl + have hΔ_eq : ∀ k x, x ∈ (Q' k).G.edgeSet → (Q' k).Δ x = (Q k).Δ x := by + intro k x hx + rw [(hcomp' k).G_eq] at hx + rw [(hcomp' k).Δ_eq hx, hrestr k, (P k).restrict_Δ (hle k) hx] + have hηe_maps : ∀ x ∈ (Q' i).G.edgeSet, ηe x ∈ (Q' j).G.edgeSet := by + intro x hx + rw [hE_eq i] at hx + rw [hE_eq j] + refine ⟨hexp.edge_mem x hx.1, ?_⟩ + intro hEq + exact hx.2 (hexp.edge_injOn hx.1 hei_edge (hEq.trans hη_ei_eq.symm)) + refine ⟨i, j, hij, ηv, ηe, ?_, H, ?_⟩ + · refine + { vertex_nonempty := fun v hv ↦ hexp.vertex_nonempty v (hV_eq i ▸ hv) + vertex_subset := fun v hv ↦ hV_eq j ▸ hexp.vertex_subset v (hV_eq i ▸ hv) + edge_mem := hηe_maps + vertex_disjoint := fun v₁ hv₁ v₂ hv₂ hne ↦ + hexp.vertex_disjoint v₁ (hV_eq i ▸ hv₁) v₂ (hV_eq i ▸ hv₂) hne + edge_injOn := fun x₁ hx₁ x₂ hx₂ ↦ + hexp.edge_injOn ((hE_eq i ▸ hx₁).1) ((hE_eq i ▸ hx₂).1) + mem_dom_iff := fun x hx ↦ by + have hx_Qi : x ∈ (Q i).G.edgeSet := (hE_eq i ▸ hx).1 + have hηx_Q'j : ηe x ∈ (Q' j).G.edgeSet := hηe_maps x hx + rw [hdom_eq i, hdom_eq j] + exact ⟨fun ⟨hd, _⟩ ↦ ⟨(hexp.mem_dom_iff x hx_Qi).1 hd, hηx_Q'j⟩, + fun ⟨hd', _⟩ ↦ ⟨(hexp.mem_dom_iff x hx_Qi).2 hd', hx⟩⟩ + ends_nonempty := fun x hx hnd v hinc ↦ by + have hx_Qi : x ∈ (Q i).G.edgeSet := (hE_eq i ▸ hx).1 + have hnd_Qi : x ∉ (Q i).dom := fun hd ↦ hnd ((hdom_eq i).symm ▸ ⟨hd, hx⟩) + have hinc_Qi : (Q i).G.Inc x v := by + change v ∈ (Q i).G.ends x + rw [← hends_eq i x hx] + exact hinc + obtain ⟨v', hv', hinc'⟩ := hexp.ends_nonempty x hx_Qi hnd_Qi v hinc_Qi + refine ⟨v', hv', ?_⟩ + change v' ∈ (Q' j).G.ends (ηe x) + rw [hends_eq j (ηe x) (hηe_maps x hx)] + exact hinc' + μ_length := fun x hx ↦ by + have hx_E : x ∈ (Q' i).G.edgeSet := (Q' i).dom_subset hx + have hx_Qi_dom : x ∈ (Q i).dom := ((hdom_eq i) ▸ hx).1 + have hηx_dom : ηe x ∈ (Q' j).dom := by + rw [hdom_eq j] + exact ⟨(hexp.mem_dom_iff x ((hE_eq i ▸ hx_E).1)).1 hx_Qi_dom, hηe_maps x hx_E⟩ + rw [hμ_eq i x hx, hμ_eq j (ηe x) hηx_dom] + exact hexp.μ_length x hx_Qi_dom + μ_mem := fun x hx k hk hk' ↦ by + have hx_E : x ∈ (Q' i).G.edgeSet := (Q' i).dom_subset hx + have hx_Qi_dom : x ∈ (Q i).dom := ((hdom_eq i) ▸ hx).1 + have hηx_dom : ηe x ∈ (Q' j).dom := by + rw [hdom_eq j] + exact ⟨(hexp.mem_dom_iff x ((hE_eq i ▸ hx_E).1)).1 hx_Qi_dom, hηe_maps x hx_E⟩ + have hk₁ : k < ((Q i).μ x).length := (hμ_eq i x hx) ▸ hk + have hk₂ : k < ((Q j).μ (ηe x)).length := (hμ_eq j (ηe x) hηx_dom) ▸ hk' + have hmem := hexp.μ_mem x hx_Qi_dom k hk₁ hk₂ + simpa [hμ_eq i x hx, hμ_eq j (ηe x) hηx_dom] using hmem + roots_length := by + rw [(hcomp' i).G_eq, (hcomp' j).G_eq, hroots i, hroots j, ← hη_ei_eq] + exact hexp.μ_length (e i) (he_dom i) + roots_mem := fun k hk hk' ↦ by + have hri : (Q' i).G.roots = (Q i).μ (e i) := by + rw [(hcomp' i).G_eq, hroots i] + have hrj : (Q' j).G.roots = (Q j).μ (ηe (e i)) := by + rw [(hcomp' j).G_eq, hroots j, hη_ei_eq] + have hk₁ : k < ((Q i).μ (e i)).length := hri ▸ hk + have hk₂ : k < ((Q j).μ (ηe (e i))).length := hrj ▸ hk' + have hmem := hexp.μ_mem (e i) (he_dom i) k hk₁ hk₂ + simpa [hri, hrj] using hmem + maps_Δ := fun x hx ↦ by + have hx_E : x ∈ (Q' i).G.edgeSet := (Q' i).dom_subset hx + have hx_Qi_dom : x ∈ (Q i).dom := ((hdom_eq i) ▸ hx).1 + have hηx_E : ηe x ∈ (Q' j).G.edgeSet := hηe_maps x hx_E + have hηx_dom : ηe x ∈ (Q' j).dom := by + rw [hdom_eq j] + exact ⟨(hexp.mem_dom_iff x ((hE_eq i ▸ hx_E).1)).1 hx_Qi_dom, hηx_E⟩ + rw [hμ_eq i x hx, hμ_eq j (ηe x) hηx_dom, hΔ_eq i x hx_E, hΔ_eq j (ηe x) hηx_E] + exact hexp.maps_Δ x hx_Qi_dom + φ_le := fun x hx ↦ by + have hx_Qi : x ∈ (Q i).G.edgeSet := (hE_eq i ▸ hx).1 + have hx_ne : x ≠ e i := (hE_eq i ▸ hx).2 + have hηx_ne : ηe x ≠ e j := (hE_eq j ▸ hηe_maps x hx).2 + have hφ_le := hexp.φ_le x hx_Qi + change DisjointUnionLE (if x = e i then Sum.inr PUnit.unit else Sum.inl ((Q' i).φ x)) + (if ηe x = e j then Sum.inr PUnit.unit else Sum.inl ((Q' j).φ (ηe x))) at hφ_le + rw [ite_eq_right hx_ne, ite_eq_right hηx_ne] at hφ_le + cases hφ_le with + | inl hle_φ => exact hle_φ } + · refine ⟨?_, fun v hv ↦ hH_comp v (hV_eq i ▸ hv)⟩ + obtain ⟨δ, hδ, hH_eq⟩ := hH_real + have hdiff_eq : (Q' j).G.edgeSet \ (ηe '' (Q' i).G.edgeSet) = + (Q j).G.edgeSet \ (ηe '' (Q i).G.edgeSet) := by + rw [hE_eq i, hE_eq j] + ext y + simp only [Set.mem_sdiff, Set.mem_singleton_iff, Set.mem_image] + constructor + · rintro ⟨⟨hy_Qj, hy_ne_ej⟩, hnot⟩ + refine ⟨hy_Qj, ?_⟩ + rintro ⟨x, hx_Qi, rfl⟩ + by_cases hx_ei : x = e i + · subst hx_ei; exact hy_ne_ej hη_ei_eq + · exact hnot ⟨x, ⟨hx_Qi, hx_ei⟩, rfl⟩ + · rintro ⟨hy_Qj, hnot⟩ + refine ⟨⟨hy_Qj, ?_⟩, ?_⟩ + · rintro rfl + exact hnot ⟨e i, hei_edge, hη_ei_eq⟩ + · rintro ⟨x, ⟨hx_Qi, _⟩, rfl⟩ + exact hnot ⟨x, hx_Qi, rfl⟩ + refine ⟨δ, fun y hy ↦ ?_, ?_⟩ + · have hy_Q'j : y ∈ (Q' j).G.edgeSet := hy.1 + have hy_diff : y ∈ (Q j).G.edgeSet \ (ηe '' (Q i).G.edgeSet) := hdiff_eq ▸ hy + change δ y ∈ (Q' j).Δ y + rw [hΔ_eq j y hy_Q'j] + exact hδ y hy_diff + · rw [hH_eq] + change GM04.emptySubgraph (Q j).G.vertexSet ⊔ + (⨆ y ∈ (Q j).G.edgeSet \ (ηe '' (Q i).G.edgeSet), δ y) = + GM04.emptySubgraph (Q' j).G.vertexSet ⊔ + (⨆ y ∈ (Q' j).G.edgeSet \ (ηe '' (Q' i).G.edgeSet), δ y) + rw [hV_eq j, hdiff_eq] + +/-! ## Theorem (6.2): Robust partial patchworks of bounded tree-width -/ + +/-- If a patchwork `P` has `HasPatchworkTreeWidthLE P w`, then its underlying rooted hypergraph +`P.G` satisfies `GM04.TreeWidthLE P.G w`. -/ +theorem treeWidthLE_of_hasPatchworkTreeWidthLE {P : GM04.Patchwork Ω α β} {w : ℕ} + (htw : HasPatchworkTreeWidthLE P w) : GM04.TreeWidthLE P.G w := by + classical + obtain ⟨ι, hfin, T, τ, t₀, htd, hw, hroots_sub⟩ := htw + let : Fintype ι := hfin + let m := Fintype.card ι + have hm : 0 < m := Fintype.card_pos_iff.2 ⟨t₀⟩ + let e₀ : ι ≃ Fin m := Fintype.equivFin ι + let zeroFin : Fin m := ⟨0, hm⟩ + let e : ι ≃ Fin m := e₀.trans (Equiv.swap (e₀ t₀) zeroFin) + have he_t₀ : e t₀ = zeroFin := by + simp [e, Equiv.swap_apply_left] + have he_symm_zero : e.symm zeroFin = t₀ := + e.symm_apply_eq.2 he_t₀.symm + let K : SimpleGraph (Fin m) := T.map e.toEmbedding + have htd_K : GM10.IsTreeDecomposition P.G.toHypergraph K (τ ∘ e.symm) := htd.relabel e + have hK : K.IsTree := htd_K.isTree + let T_r : GM04.RootedTree ℕ := Thomas.rootedTreeOfIsTree hK + let bagRoots : ℕ → List α := fun n ↦ + if hn : n < m then + if n = 0 then P.G.roots + else + (((τ (e.symm ⟨n, hn⟩)).vertexSet_finite.subset Set.inter_subset_left : + ((τ (e.symm ⟨n, hn⟩)).vertexSet ∩ + (τ (e.symm (Thomas.parentFin hK ⟨n, hn⟩))).vertexSet).Finite)).toFinset.toList + else [] + let τ_r : ℕ → RootedHypergraph α β := fun n ↦ + if hn : n < m then + { toHypergraph := τ (e.symm ⟨n, hn⟩) + roots := bagRoots n + roots_nodup := by + dsimp only [bagRoots] + rw [dite_eq_left hn] + split_ifs with h0 + · exact P.G.roots_nodup + · exact Finset.nodup_toList _ + roots_subset := by + intro v hv + dsimp only [bagRoots] at hv + rw [dite_eq_left hn] at hv + split_ifs at hv with h0 + · subst h0 + have hEq : (⟨0, hn⟩ : Fin m) = zeroFin := rfl + rw [hEq, he_symm_zero] + exact hroots_sub hv + · rw [Finset.mem_toList, Set.Finite.mem_toFinset] at hv + exact hv.1 } + else + { toHypergraph := + { vertexSet := ∅ + edgeSet := ∅ + Inc := fun _ _ ↦ False + vertex_mem_of_inc := fun _ _ h ↦ h.elim + edge_mem_of_inc := fun _ _ h ↦ h.elim + vertexSet_finite := Set.finite_empty + edgeSet_finite := Set.finite_empty } + roots := [] + roots_nodup := List.nodup_nil + roots_subset := fun _ h ↦ (List.not_mem_nil h).elim } + have hτ_r_toH : ∀ {n : ℕ} (hn : n < m), (τ_r n).toHypergraph = τ (e.symm ⟨n, hn⟩) := by + intro n hn + dsimp only [τ_r] + rw [dite_eq_left hn] + have hτ_r_roots : ∀ {n : ℕ} (hn : n < m), (τ_r n).roots = bagRoots n := by + intro n hn + dsimp only [τ_r] + split_ifs + rfl + have hverts_eq : T_r.verts = Finset.range m := rfl + refine ⟨T_r, τ_r, ?_, ?_⟩ + · refine + { le := fun n hn ↦ by + have hn_lt : n < m := Finset.mem_range.1 hn + rw [hτ_r_toH hn_lt] + exact htd_K.le ⟨n, hn_lt⟩ + biUnion_eq := by + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (biUnion_le fun n hn ↦ by + have hn_lt : n < m := Finset.mem_range.1 hn + rw [hτ_r_toH hn_lt] + exact htd_K.le ⟨n, hn_lt⟩) + le_rfl ?_ ?_ + · rw [hverts_eq, ← htd_K.biUnion_eq] + ext x + simp only [Hypergraph.biUnion, Set.mem_iUnion, Finset.mem_range, Finset.mem_univ, + exists_prop, true_and, Function.comp_apply] + exact ⟨fun ⟨n, hn, hx⟩ ↦ ⟨⟨n, hn⟩, by rwa [← hτ_r_toH hn]⟩, + fun ⟨t, hx⟩ ↦ ⟨t.1, t.2, by rw [hτ_r_toH t.2]; exact hx⟩⟩ + · rw [hverts_eq, ← htd_K.biUnion_eq] + ext x + simp only [Hypergraph.biUnion, Set.mem_iUnion, Finset.mem_range, Finset.mem_univ, + exists_prop, true_and, Function.comp_apply] + exact ⟨fun ⟨n, hn, hx⟩ ↦ ⟨⟨n, hn⟩, by rwa [← hτ_r_toH hn]⟩, + fun ⟨t, hx⟩ ↦ ⟨t.1, t.2, by rw [hτ_r_toH t.2]; exact hx⟩⟩ + edgeSet_inter_eq := fun n₁ hn₁ n₂ hn₂ hne ↦ by + have h₁ : n₁ < m := Finset.mem_range.1 hn₁ + have h₂ : n₂ < m := Finset.mem_range.1 hn₂ + rw [hτ_r_toH h₁, hτ_r_toH h₂] + exact htd_K.edgeSet_inter_eq (fun hEq ↦ hne (congrArg Fin.val hEq)) + inter_le := fun n₁ hn₁ n₂ hn₂ n₃ hn₃ hon ↦ by + have h₁ : n₁ < m := Finset.mem_range.1 hn₁ + have h₂ : n₂ < m := Finset.mem_range.1 hn₂ + have h₃ : n₃ < m := Finset.mem_range.1 hn₃ + rw [hτ_r_toH h₁, hτ_r_toH h₂, hτ_r_toH h₃] + exact htd_K.inter_le + ((Thomas.onPath_rootedTreeOfIsTree_iff hK ⟨n₁, hn₁⟩ ⟨n₃, hn₃⟩ ⟨n₂, hn₂⟩).1 hon) + roots_root := by + change (τ_r 0).roots = P.G.roots + rw [hτ_r_roots hm] + dsimp only [bagRoots] + rw [dite_eq_left hm, ite_eq_left rfl] + rootSet_edge := fun f hf ↦ by + have hf_verts : f ∈ T_r.verts := Thomas.mem_verts_of_mem_edges T_r hf + have hf_ne_0 : f ≠ 0 := Thomas.ne_root_of_mem_edges T_r hf + have hf_lt : f < m := Finset.mem_range.1 hf_verts + have hpar_lt : T_r.parent f < m := + Finset.mem_range.1 (T_r.parent_mem f hf_verts) + have hpar_eq : (⟨T_r.parent f, hpar_lt⟩ : Fin m) = Thomas.parentFin hK ⟨f, hf_lt⟩ := by + ext + change (if hn : f < m then (Thomas.parentFin hK ⟨f, hn⟩).val else 0) = _ + rw [dite_eq_left hf_lt] + rw [hτ_r_toH hf_lt, hτ_r_toH hpar_lt, hpar_eq] + change {v | v ∈ (τ_r f).roots} = _ + rw [hτ_r_roots hf_lt] + dsimp only [bagRoots] + rw [dite_eq_left hf_lt, ite_eq_right hf_ne_0] + ext v + simp only [Set.mem_ofPred_eq, Finset.mem_toList, Set.Finite.mem_toFinset, + Hypergraph.inter_vertexSet] } + · intro n hn + have hn_lt : n < m := Finset.mem_range.1 hn + change (τ_r n).toHypergraph.vertexSet.ncard ≤ w + 1 + rw [hτ_r_toH hn_lt] + have hle_t : (τ (e.symm ⟨n, hn_lt⟩)).vertexSet.ncard ≤ GM10.treeDecompWidthPlusOne τ := + le_csSup (Set.finite_range _).bddAbove ⟨e.symm ⟨n, hn_lt⟩, rfl⟩ + change (GM10.treeDecompWidthPlusOne τ : ℤ) - 1 ≤ (w : ℤ) at hw + omega + +/-- **Graph Minors XVIII, (6.2)** (page 101): +"If $\Omega$ is a well-quasi-order and $w \ge 0$, the class of all robust partial +$\Omega$-patchworks of tree-width $\le w$ is well-behaved." -/ +theorem theorem_6_2_proof + [Preorder Ω] (w : ℕ) : + WellBehaved {P : PartialPatchwork Ω α β | P.IsRobust ∧ HasPatchworkTreeWidthLE P w} := by + intro Ω' _ ι hΩ' Q hQ + apply gm04Theorem91 w Q hΩ' + · intro i + obtain ⟨P, ⟨hrob, _⟩, hcomp⟩ := hQ i + intro e he + rw [hcomp.G_eq] at he + rw [hcomp.Δ_eq he] + exact hrob e he + · intro i + obtain ⟨P, ⟨_, htw⟩, hcomp⟩ := hQ i + rw [hcomp.G_eq] + exact treeWidthLE_of_hasPatchworkTreeWidthLE htw + +/-! ## Theorem (6.3): Enlargements of well-behaved classes -/ + +/-- Viewing an `Ω'`-patchwork `P` as a partial `Ω'`-patchwork with total label function. -/ +@[expose] def toPartialPatchwork {Ω' : Type*} (P : GM04.Patchwork Ω' α β) : PartialPatchwork Ω' α β + where + G := P.G + dom := P.dom + μ := P.μ + Δ := P.Δ + φ e := (P.φ e : WithBot Ω') + dom_subset := P.dom_subset + μ_nodup := P.μ_nodup + μ_set := P.μ_set + Δ_verts := P.Δ_verts + Δ_free := P.Δ_free + +/-- Simulation of `P₁` in `P₂` is equivalent to simulation of `toPartialPatchwork P₁` in +`toPartialPatchwork P₂`. -/ +theorem simulated_toPartialPatchwork_iff {Ω' : Type*} [Preorder Ω'] + {P₁ P₂ : GM04.Patchwork Ω' α β} : + GM04.Simulated (toPartialPatchwork P₁) (toPartialPatchwork P₂) ↔ GM04.Simulated P₁ P₂ := by + refine ⟨fun ⟨ηv, ηe, hexp, hreal⟩ ↦ ⟨ηv, ηe, ⟨?_, hreal⟩⟩, + fun ⟨ηv, ηe, hexp, hreal⟩ ↦ ⟨ηv, ηe, ⟨?_, hreal⟩⟩⟩ + · refine + { vertex_nonempty := hexp.vertex_nonempty + vertex_subset := hexp.vertex_subset + edge_mem := hexp.edge_mem + vertex_disjoint := hexp.vertex_disjoint + edge_injOn := hexp.edge_injOn + mem_dom_iff := hexp.mem_dom_iff + ends_nonempty := hexp.ends_nonempty + μ_length := hexp.μ_length + μ_mem := hexp.μ_mem + roots_length := hexp.roots_length + roots_mem := hexp.roots_mem + maps_Δ := hexp.maps_Δ + φ_le := fun e he ↦ WithBot.coe_le_coe.1 (hexp.φ_le e he) } + · refine + { vertex_nonempty := hexp.vertex_nonempty + vertex_subset := hexp.vertex_subset + edge_mem := hexp.edge_mem + vertex_disjoint := hexp.vertex_disjoint + edge_injOn := hexp.edge_injOn + mem_dom_iff := hexp.mem_dom_iff + ends_nonempty := hexp.ends_nonempty + μ_length := hexp.μ_length + μ_mem := hexp.μ_mem + roots_length := hexp.roots_length + roots_mem := hexp.roots_mem + maps_Δ := hexp.maps_Δ + φ_le := fun e he ↦ WithBot.coe_le_coe.2 (hexp.φ_le e he) } + +open Classical in +private noncomputable def completionHeart {Ω' : Type*} + (P₁ : GM04.Patchwork Ω' α β) (P₃ : PartialPatchwork Ω α β) + (ℒ : Set (RootedHypergraph α β)) : PartialPatchwork Ω' α β := + { G := P₃.G + dom := P₃.dom + μ := P₃.μ + Δ := P₃.Δ + φ := fun e ↦ + if e ∈ (rootedLocationCore P₁.G ℒ).edgeSet then (P₁.φ e : WithBot Ω') else ⊥ + dom_subset := P₃.dom_subset + μ_nodup := P₃.μ_nodup + μ_set := P₃.μ_set + Δ_verts := P₃.Δ_verts + Δ_free := P₃.Δ_free } + +private theorem isPlaceHeart_completionHeart {Ω' : Type*} [Preorder Ω] [Preorder Ω'] + {ι : Ω ↪o Ω'} {P₁ : GM04.Patchwork Ω' α β} {P₂ P₃ : PartialPatchwork Ω α β} + {ℒ : Set (RootedHypergraph α β)} {newEdge : RootedHypergraph α β → β} + (hcomp : IsCompletion ι P₂ P₁) (hℒ : IsRootedLocation P₂.G ℒ) + (hheart : IsPlaceHeart P₂ ℒ newEdge P₃) : + IsPlaceHeart (toPartialPatchwork P₁) ℒ newEdge (completionHeart P₁ P₃ ℒ) := by + classical + have hG_eq : P₁.G = P₂.G := hcomp.G_eq + refine + { isRootedLocation := hG_eq ▸ hℒ + injOn_newEdge := hheart.injOn_newEdge + newEdge_notMem_core := hG_eq ▸ hheart.newEdge_notMem_core + vertexSet_eq := hG_eq ▸ hheart.vertexSet_eq + edgeSet_eq := hG_eq ▸ hheart.edgeSet_eq + roots_eq := hG_eq ▸ hheart.roots_eq + ends_core := hG_eq ▸ hheart.ends_core + ends_newEdge := hheart.ends_newEdge + dom_eq := by + change P₃.dom = + (rootedLocationCore P₁.G ℒ).edgeSet ∩ P₁.dom ∪ newEdge '' ℒ + rw [hG_eq, hheart.dom_eq, hcomp.dom_eq] + μ_core := fun e he ↦ by + change e ∈ (rootedLocationCore P₁.G ℒ).edgeSet ∩ P₁.dom at he + rw [hG_eq] at he + have he₂ : e ∈ (rootedLocationCore P₂.G ℒ).edgeSet ∩ P₂.dom := + ⟨he.1, hcomp.dom_eq ▸ he.2⟩ + change P₃.μ e = P₁.μ e + rw [hheart.μ_core he₂] + exact (hcomp.μ_eq he₂.2).symm + μ_newEdge := hheart.μ_newEdge + Δ_core := fun e he ↦ by + change e ∈ (rootedLocationCore P₁.G ℒ).edgeSet at he + rw [hG_eq] at he + have he_P₂ : e ∈ P₂.G.edgeSet := (mem_rootedLocationCore_edgeSet_iff.1 he).1 + change P₃.Δ e = P₁.Δ e + rw [hheart.Δ_core he] + exact (hcomp.Δ_eq he_P₂).symm + Δ_newEdge := fun A hA ↦ by + change P₃.Δ (newEdge A) = _ + rw [hheart.Δ_newEdge hA] + have hle_A : A.toHypergraph ≤ P₂.G.toHypergraph := ((hℒ).isComplemented hA).le + have hle_A₁ : A.toHypergraph ≤ P₁.G.toHypergraph := hG_eq ▸ hle_A + have hreal_iff : ∀ H₀, (P₂.restrict A).IsRealization H₀ ↔ + ((toPartialPatchwork P₁).restrict A).IsRealization H₀ := by + intro H₀ + refine ⟨fun ⟨δ₀, hδ₀, hH₀⟩ ↦ ⟨δ₀, fun e he ↦ ?_, hH₀⟩, + fun ⟨δ₀, hδ₀, hH₀⟩ ↦ ⟨δ₀, fun e he ↦ ?_, hH₀⟩⟩ + · have h := hδ₀ e he + change δ₀ e ∈ (P₂.restrict A).Δ e at h + rw [P₂.restrict_Δ hle_A he] at h + change δ₀ e ∈ ((toPartialPatchwork P₁).restrict A).Δ e + rw [(toPartialPatchwork P₁).restrict_Δ hle_A₁ he] + change δ₀ e ∈ P₁.Δ e + rw [hcomp.Δ_eq (hle_A.edgeSet_subset he)] + exact h + · have h := hδ₀ e he + change δ₀ e ∈ ((toPartialPatchwork P₁).restrict A).Δ e at h + rw [(toPartialPatchwork P₁).restrict_Δ hle_A₁ he] at h + change δ₀ e ∈ P₁.Δ e at h + rw [hcomp.Δ_eq (hle_A.edgeSet_subset he)] at h + change δ₀ e ∈ (P₂.restrict A).Δ e + rw [P₂.restrict_Δ hle_A he] + exact h + have hfg_eq : {δ | IsFeasibleGrouping (P₂.restrict A) δ} = + {δ | IsFeasibleGrouping ((toPartialPatchwork P₁).restrict A) δ} := by + ext δ + exact ⟨fun ⟨hgrp, hv, H₀, hH₀, hc⟩ ↦ ⟨hgrp, hv, H₀, (hreal_iff H₀).1 hH₀, hc⟩, + fun ⟨hgrp, hv, H₀, hH₀, hc⟩ ↦ ⟨hgrp, hv, H₀, (hreal_iff H₀).2 hH₀, hc⟩⟩ + exact GM04.Patch.ext rfl hfg_eq + φ_core := fun e he ↦ ite_eq_left he + φ_newEdge := fun A hA ↦ by + have hnot : newEdge A ∉ (rootedLocationCore P₁.G ℒ).edgeSet := by + rw [hcomp.G_eq] + exact hheart.newEdge_notMem_core hA + exact ite_eq_right hnot } + +/-- **Graph Minors XVIII, (6.3)** (page 101): +"Let $\Omega$ be a well-quasi-order, and let $\mathcal{C}_1, \mathcal{C}_2$ be well-behaved +classes of partial $\Omega$-patchworks. Then the class of all enlargements of members of +$\mathcal{C}_1$ by $\mathcal{C}_2$ is well-behaved." -/ +theorem theorem_6_3_proof [Preorder Ω] {𝒞₁ 𝒞₂ : Set (PartialPatchwork Ω α β)} + (h𝒞₁ : WellBehaved 𝒞₁) (h𝒞₂ : WellBehaved 𝒞₂) : + WellBehaved (enlargementClass 𝒞₁ 𝒞₂) := by + classical + intro Ω' _ ι hΩ' P₁ hP₁ + -- `Ω''` is the subtype of `Ω'`-completions of members of `𝒞₂`, ordered by simulation. + let Ω'' := {R : GM04.Patchwork Ω' α β // ∃ P ∈ 𝒞₂, IsCompletion ι P R} + let : Preorder Ω'' := + { le := fun R₁ R₂ ↦ GM04.Simulated R₁.1 R₂.1 + le_refl := fun R ↦ GM04.Simulated.refl R.1 + le_trans := fun _ _ _ h₁₂ h₂₃ ↦ h₁₂.trans h₂₃ } + have hΩ''_wqo : WellQuasiOrderedLE Ω'' := + ⟨fun f ↦ h𝒞₂ Ω' ι hΩ' (fun i ↦ (f i).1) (fun i ↦ (f i).2)⟩ + let Ω_star := DisjointUnionQuasiOrder Ω' Ω'' + have hΩ_star_wqo : WellQuasiOrderedLE Ω_star := wellQuasiOrderedLE_disjointUnion hΩ' hΩ''_wqo + let inlEmb := DisjointUnionQuasiOrder.inlEmb Ω' Ω'' + let ι_star : Ω ↪o Ω_star := ι.trans inlEmb + -- Unpack `P₂ i ∈ enlargementClass 𝒞₁ 𝒞₂`, `P₃ i ∈ 𝒞₁`, `ℒ i`, `newEdge i`. + choose P₂ hP₂_enl hcomp₁ using hP₁ + choose P₃ hP₃_mem ℒ hℒ hheart₃_has hA_mem using hP₂_enl + choose newEdge hheart₃ using hheart₃_has + -- For each `i` and `A ∈ ℒ i`, `(P₁ i).restrict A` is an `Ω'`-completion of `(P₂ i).restrict A ∈ + -- 𝒞₂`. + have hcomp_restrict : ∀ i ⦃A : RootedHypergraph α β⦄, A ∈ ℒ i → + ∃ P ∈ 𝒞₂, IsCompletion ι P ((P₁ i).restrict A) := by + intro i A hA + exact ⟨(P₂ i).restrict A, hA_mem i A hA, + (hcomp₁ i).restrict ((hℒ i).isComplemented hA).le⟩ + -- Construct `enc (P₁ i) = P₄ i : GM04.Patchwork Ω_star α β`. + let P₄ : ℕ → GM04.Patchwork Ω_star α β := fun i ↦ + { G := (P₃ i).G + dom := (P₃ i).dom + μ := (P₃ i).μ + Δ := (P₃ i).Δ + φ := fun e ↦ + if h : ∃ A ∈ ℒ i, newEdge i A = e then + Sum.inr ⟨(P₁ i).restrict h.choose, hcomp_restrict i h.choose_spec.1⟩ + else + Sum.inl ((P₁ i).φ e) + dom_subset := (P₃ i).dom_subset + μ_nodup := (P₃ i).μ_nodup + μ_set := (P₃ i).μ_set + Δ_verts := (P₃ i).Δ_verts + Δ_free := (P₃ i).Δ_free } + -- `P₄ i` is an `Ω_star`-completion of `P₃ i ∈ 𝒞₁`. + have hP₄_comp : ∀ i, ∃ P₀ ∈ 𝒞₁, IsCompletion ι_star P₀ (P₄ i) := by + intro i + refine ⟨P₃ i, hP₃_mem i, ⟨rfl, rfl, fun _ _ ↦ rfl, fun _ _ ↦ rfl, ?_⟩⟩ + intro e he ω hφ₃ + have hnot_new : ¬ ∃ A ∈ ℒ i, newEdge i A = e := by + rintro ⟨A, hA, rfl⟩ + rw [(hheart₃ i).φ_newEdge hA] at hφ₃ + exact WithBot.coe_ne_bot hφ₃.symm + have he_core : e ∈ (rootedLocationCore (P₂ i).G (ℒ i)).edgeSet := by + rw [(hheart₃ i).edgeSet_eq] at he + rcases he with he_c | ⟨A, hA, rfl⟩ + · exact he_c + · exact (hnot_new ⟨A, hA, rfl⟩).elim + have he_P₂ : e ∈ (P₂ i).G.edgeSet := (mem_rootedLocationCore_edgeSet_iff.1 he_core).1 + have hφ₂ : (P₂ i).φ e = (ω : WithBot Ω) := by + rw [← (hheart₃ i).φ_core he_core, hφ₃] + have hφ₁ : (P₁ i).φ e = ι ω := (hcomp₁ i).φ_eq he_P₂ hφ₂ + change (if h : ∃ A ∈ ℒ i, newEdge i A = e then _ else Sum.inl ((P₁ i).φ e)) = Sum.inl (ι ω) + rw [dite_eq_right hnot_new, hφ₁] + -- Since `𝒞₁` is well-behaved, `P₄ i` is simulated in `P₄ j` for some `i < j`. + obtain ⟨i, j, hij, ηv, ηe, hexp, H, hH_real, hH_comp⟩ := + h𝒞₁ Ω_star ι_star hΩ_star_wqo P₄ hP₄_comp + refine ⟨i, j, hij, ?_⟩ + let Q : ℕ → PartialPatchwork Ω' α β := fun k ↦ completionHeart (P₁ k) (P₃ k) (ℒ k) + have hQ_heart (k : ℕ) : IsPlaceHeart (toPartialPatchwork (P₁ k)) (ℒ k) (newEdge k) (Q k) := + isPlaceHeart_completionHeart (hcomp₁ k) (hℒ k) (hheart₃ k) + -- Verify that `(ηv, ηe)` is a realizable expansion of `Q i` in `Q j` satisfying + -- `theorem_5_7_proof`. + have hη_Q : GM04.IsRealizableExpansion (Q i) (Q j) ηv ηe := by + refine ⟨?_, H, hH_real, hH_comp⟩ + refine + { vertex_nonempty := hexp.vertex_nonempty + vertex_subset := hexp.vertex_subset + edge_mem := hexp.edge_mem + vertex_disjoint := hexp.vertex_disjoint + edge_injOn := hexp.edge_injOn + mem_dom_iff := hexp.mem_dom_iff + ends_nonempty := hexp.ends_nonempty + μ_length := hexp.μ_length + μ_mem := hexp.μ_mem + roots_length := hexp.roots_length + roots_mem := hexp.roots_mem + maps_Δ := hexp.maps_Δ + φ_le := fun e he ↦ by + by_cases he_core : e ∈ (rootedLocationCore (P₁ i).G (ℒ i)).edgeSet + · have hnot_new_i : ¬ ∃ A ∈ ℒ i, newEdge i A = e := by + rintro ⟨A, hA, rfl⟩ + exact (hQ_heart i).newEdge_notMem_core hA he_core + have hφ_le := hexp.φ_le e he + change DisjointUnionLE + (if h : ∃ A ∈ ℒ i, newEdge i A = e then _ else Sum.inl ((P₁ i).φ e)) + (if h : ∃ A ∈ ℒ j, newEdge j A = ηe e then _ else Sum.inl ((P₁ j).φ (ηe e))) at hφ_le + rw [dite_eq_right hnot_new_i] at hφ_le + by_cases hnew_j : ∃ A ∈ ℒ j, newEdge j A = ηe e + · rw [dite_eq_left hnew_j] at hφ_le + nomatch hφ_le + · rw [dite_eq_right hnew_j] at hφ_le + have hηe_edge : ηe e ∈ (Q j).G.edgeSet := hexp.edge_mem e he + rw [(hQ_heart j).edgeSet_eq] at hηe_edge + have hηe_core : ηe e ∈ (rootedLocationCore (P₁ j).G (ℒ j)).edgeSet := by + rcases hηe_edge with hc | ⟨A', hA', hEq⟩ + · exact hc + · exact (hnew_j ⟨A', hA', hEq⟩).elim + rw [(hQ_heart i).φ_core he_core, (hQ_heart j).φ_core hηe_core] + cases hφ_le with + | inl hle_φ => exact WithBot.coe_le_coe.2 hle_φ + · change (if e ∈ (rootedLocationCore (P₁ i).G (ℒ i)).edgeSet then _ else ⊥) ≤ _ + rw [ite_eq_right he_core] + exact bot_le } + have hpre : ∀ ⦃e : β⦄ ⦃A₂ : RootedHypergraph α β⦄, + e ∈ (Q i).G.edgeSet → A₂ ∈ ℒ j → ηe e = newEdge j A₂ → ∃ A₁ ∈ ℒ i, e = newEdge i A₁ := by + intro e A₂ he hA₂ hηe_eq + have hφ_le := hexp.φ_le e he + have hex_j : ∃ A ∈ ℒ j, newEdge j A = ηe e := ⟨A₂, hA₂, hηe_eq.symm⟩ + change DisjointUnionLE + (if h : ∃ A ∈ ℒ i, newEdge i A = e then _ else Sum.inl ((P₁ i).φ e)) + (if h : ∃ A ∈ ℒ j, newEdge j A = ηe e then _ else Sum.inl ((P₁ j).φ (ηe e))) at hφ_le + rw [dite_eq_left hex_j] at hφ_le + by_cases hex_i : ∃ A ∈ ℒ i, newEdge i A = e + · obtain ⟨A₁, hA₁, hEq₁⟩ := hex_i + exact ⟨A₁, hA₁, hEq₁.symm⟩ + · rw [dite_eq_right hex_i] at hφ_le + nomatch hφ_le + have hsim : ∀ ⦃A₁ : RootedHypergraph α β⦄, A₁ ∈ ℒ i → + ∃ A₂ ∈ ℒ j, ηe (newEdge i A₁) = newEdge j A₂ ∧ + GM04.Simulated ((toPartialPatchwork (P₁ i)).restrict A₁) + ((toPartialPatchwork (P₁ j)).restrict A₂) := by + intro A₁ hA₁ + have he₁ : newEdge i A₁ ∈ (Q i).G.edgeSet := by + rw [(hQ_heart i).edgeSet_eq] + exact Or.inr ⟨A₁, hA₁, rfl⟩ + have hex_i : ∃ A ∈ ℒ i, newEdge i A = newEdge i A₁ := ⟨A₁, hA₁, rfl⟩ + have hchoose_i : hex_i.choose = A₁ := + (hQ_heart i).injOn_newEdge hex_i.choose_spec.1 hA₁ hex_i.choose_spec.2 + have hφ_le := hexp.φ_le (newEdge i A₁) he₁ + change DisjointUnionLE + (if h : ∃ A ∈ ℒ i, newEdge i A = newEdge i A₁ then _ else _) + (if h : ∃ A ∈ ℒ j, newEdge j A = ηe (newEdge i A₁) then _ else _) at hφ_le + rw [dite_eq_left hex_i] at hφ_le + by_cases hex_j : ∃ A ∈ ℒ j, newEdge j A = ηe (newEdge i A₁) + · rw [dite_eq_left hex_j] at hφ_le + let A₂ := hex_j.choose + have hA₂ : A₂ ∈ ℒ j := hex_j.choose_spec.1 + have hEq₂ : newEdge j A₂ = ηe (newEdge i A₁) := hex_j.choose_spec.2 + cases hφ_le with + | inr hsim_sub => + change GM04.Simulated ((P₁ i).restrict hex_i.choose) ((P₁ j).restrict A₂) at hsim_sub + rw [hchoose_i] at hsim_sub + refine ⟨A₂, hA₂, hEq₂.symm, ?_⟩ + exact simulated_toPartialPatchwork_iff.2 hsim_sub + · rw [dite_eq_right hex_j] at hφ_le + nomatch hφ_le + have hsim_part := theorem_5_7_proof (hQ_heart i) (hQ_heart j) hη_Q hpre hsim + exact simulated_toPartialPatchwork_iff.1 hsim_part + +/-! ## Theorem (6.4): Lifting rotund tree-decompositions to rooted decompositions -/ + +/-- Restricting a robust patchwork `P` to `G' ≤ P.G` yields a robust patchwork `P | G'`. -/ +theorem isRobust_restrict {P : GM04.Patchwork Ω α β} (hrob : P.IsRobust) + {G' : RootedHypergraph α β} (hle : G'.toHypergraph ≤ P.G.toHypergraph) : + (P.restrict G').IsRobust := by + intro e he + rw [P.restrict_Δ hle he] + exact hrob e (hle.edgeSet_subset he) + +private theorem routes_between_root_sets + {P : GM04.Patchwork Ω α β} {G G₁ G₂ : RootedHypergraph α β} + (hsep : G.IsSeparation G₁ G₂) + (hno_sep : ¬ ∃ H₁ H₂ : RootedHypergraph α β, G.IsSeparation H₁ H₂ ∧ + G₁.toHypergraph ≤ H₁.toHypergraph ∧ + separationOrder H₁.toHypergraph H₂.toHypergraph < G.roots.length) : + GM04.Theorem61Cond1 (P.restrict G₂) G₁.rootSet G₂.rootSet G.roots.length := by + classical + let k := G.roots.length + let X₁ := G₁.rootSet + let X₂ := G₂.rootSet + have hle₁ := hsep.isSeparation.left_le + have hle₂ := hsep.isSeparation.right_le + have hX₁_eq : X₁ = (G₁.toHypergraph ∩ G₂.toHypergraph).vertexSet := hsep.rootSet_left + have hX₂_roots := hsep.roots_right + intro J₁ J₂ hsepJ hX₁J₁ hX₂J₂ + by_contra! hlt + let K₁_H := G₁.toHypergraph ∪ J₁ + let K₂_H := J₂ + have hK₁_le : K₁_H ≤ G.toHypergraph := + union_le hle₁ (hsepJ.left_le.trans hle₂) + have hK₂_le : K₂_H ≤ G.toHypergraph := hsepJ.right_le.trans hle₂ + have hK_union : K₁_H ∪ K₂_H = G.toHypergraph := by + have hsepJ_union : J₁ ∪ J₂ = G₂.toHypergraph := hsepJ.union_eq + rw [GM10.union_assoc, hsepJ_union, hsep.isSeparation.union_eq] + have hK_edge : (K₁_H ∩ K₂_H).edgeSet = ∅ := by + ext e + simp only [K₁_H, K₂_H, inter_edgeSet, union_edgeSet, Set.mem_inter_iff, + Set.mem_union, Set.mem_empty_iff_false, iff_false, not_and] + rintro (he₁ | heJ₁) heJ₂ + · have heG₂ : e ∈ G₂.edgeSet := hsepJ.right_le.edgeSet_subset heJ₂ + have he_inter : e ∈ (G₁.toHypergraph ∩ G₂.toHypergraph).edgeSet := ⟨he₁, heG₂⟩ + rw [hsep.isSeparation.edgeSet_inter_eq] at he_inter + exact he_inter + · have he_inter : e ∈ (J₁ ∩ J₂).edgeSet := ⟨heJ₁, heJ₂⟩ + rw [hsepJ.edgeSet_inter_eq] at he_inter + exact he_inter + have hK_inter_V : (K₁_H ∩ K₂_H).vertexSet = (J₁ ∩ J₂).vertexSet := by + ext v + simp only [K₁_H, K₂_H, inter_vertexSet, union_vertexSet, Set.mem_inter_iff, + Set.mem_union] + constructor + · rintro ⟨hv₁ | hvJ₁, hvJ₂⟩ + · have hvG₂ : v ∈ G₂.vertexSet := hsepJ.right_le.vertexSet_subset hvJ₂ + have hvX₁ : v ∈ X₁ := hX₁_eq.symm ▸ ⟨hv₁, hvG₂⟩ + exact ⟨hX₁J₁ hvX₁, hvJ₂⟩ + · exact ⟨hvJ₁, hvJ₂⟩ + · exact fun ⟨hvJ₁, hvJ₂⟩ ↦ ⟨Or.inr hvJ₁, hvJ₂⟩ + let r₁ := (K₁_H.vertexSet_finite.subset Set.inter_subset_left : + (K₁_H ∩ K₂_H).vertexSet.Finite).toFinset.toList + let H₁ : RootedHypergraph α β := + { toHypergraph := K₁_H + roots := r₁ + roots_nodup := Finset.nodup_toList _ + roots_subset := fun v hv ↦ by + rw [Finset.mem_toList, Set.Finite.mem_toFinset] at hv + exact hv.1 } + let H₂ : RootedHypergraph α β := + { toHypergraph := K₂_H + roots := G.roots + roots_nodup := G.roots_nodup + roots_subset := fun v hv ↦ hX₂J₂ (show v ∈ G₂.roots from hX₂_roots.symm ▸ hv) } + have hsepH : G.IsSeparation H₁ H₂ := + { isSeparation := ⟨hK₁_le, hK₂_le, hK_union, hK_edge⟩ + roots_right := rfl + rootSet_left := by + ext v + simp only [H₁, r₁, RootedHypergraph.rootSet, Set.mem_ofPred_eq, Finset.mem_toList, + Set.Finite.mem_toFinset] + rfl } + have hordH : separationOrder H₁.toHypergraph H₂.toHypergraph < k := by + change (K₁_H ∩ K₂_H).vertexSet.ncard < k + rw [hK_inter_V] + exact hlt + exact hno_sep ⟨H₁, H₂, hsepH, le_union_left hle₁ (hsepJ.left_le.trans hle₂), hordH⟩ + +private theorem match_components_to_roots + {G G₂ : RootedHypergraph α β} (hX₂_roots : G₂.roots = G.roots) + {D : Fin G.roots.length → (⊤ : SimpleGraph α).Subgraph} + (hX₂ : ∀ i, ((D i).verts ∩ G₂.rootSet).Nonempty) + (hD_disj : ∀ {i j}, i ≠ j → Disjoint (D i).verts (D j).verts) : + ∃ τ : Fin G.roots.length ≃ Fin G.roots.length, + ∀ j : Fin G.roots.length, G.roots[j.1] ∈ (D (τ j)).verts := by + let k := G.roots.length + let X₂ := G₂.rootSet + -- Each component `D i` contains a vertex of `X₂ = {v | v ∈ G.roots}`; since `G.roots` is nodup of + -- length `k`, every `G.roots[j]` belongs to a unique `D i`. + have hX₂_eq : X₂ = G.rootSet := by + change {v | v ∈ G₂.roots} = {v | v ∈ G.roots} + rw [hX₂_roots] + choose x₂ hx₂_D hx₂_X₂ using fun i : Fin k ↦ hX₂ i + have hx₂_mem_roots : ∀ i : Fin k, ∃ j : Fin k, G.roots[j.1] = x₂ i := by + intro i + have hmem : x₂ i ∈ G.roots := by + change x₂ i ∈ G.rootSet + rw [← hX₂_eq] + exact hx₂_X₂ i + obtain ⟨j, hj, hEq⟩ := List.getElem_of_mem hmem + exact ⟨⟨j, hj⟩, hEq⟩ + choose idx hidx using hx₂_mem_roots + have hidx_inj : Function.Injective idx := by + intro i₁ i₂ hEq + by_contra hne + have hval : x₂ i₁ = x₂ i₂ := by + rw [← hidx i₁, ← hidx i₂, hEq] + exact Set.disjoint_left.1 (hD_disj hne) (hx₂_D i₁) (hval ▸ hx₂_D i₂) + let σ : Fin k ≃ Fin k := + Equiv.ofBijective idx ((Fintype.bijective_iff_injective_and_card idx).2 ⟨hidx_inj, rfl⟩) + refine ⟨σ.symm, fun j ↦ ?_⟩ + have hj_eq : idx (σ.symm j) = j := σ.apply_symm_apply j + have h1 := hidx (σ.symm j) + rw [hj_eq] at h1 + rw [h1] + exact hx₂_D (σ.symm j) + +private theorem isRealization_join_separation + {P : GM04.Patchwork Ω α β} {G G₁ G₂ H_root : RootedHypergraph α β} + {H_sub : (⊤ : SimpleGraph α).Subgraph} + (hG : G.toHypergraph ≤ P.G.toHypergraph) (hsep : G.IsSeparation G₁ G₂) + (hroot : H_root.toHypergraph = G₁.toHypergraph) + (hH_sub : (P.restrict G₂).IsRealization H_sub) : + ((P.restrict G).deleteEdges (id '' H_root.edgeSet)).IsRealization + (GM04.emptySubgraph G₁.vertexSet ⊔ H_sub) := by + have hle₂ := hsep.isSeparation.right_le + obtain ⟨δ₂, hδ₂, hH_sub_eq⟩ := hH_sub + have hroot_edges : H_root.edgeSet = G₁.edgeSet := congrArg Hypergraph.edgeSet hroot + have hdiff_eq : G.edgeSet \ (id '' H_root.edgeSet) = G₂.edgeSet := by + rw [Set.image_id, hroot_edges] + ext e + simp only [Set.mem_sdiff] + constructor + · rintro ⟨heG, he₁⟩ + rw [← hsep.isSeparation.union_eq, union_edgeSet] at heG + rcases heG with h | h + · exact (he₁ h).elim + · exact h + · intro he₂ + refine ⟨hle₂.edgeSet_subset he₂, fun he₁ ↦ ?_⟩ + have he_inter : e ∈ (G₁.toHypergraph ∩ G₂.toHypergraph).edgeSet := ⟨he₁, he₂⟩ + rw [hsep.isSeparation.edgeSet_inter_eq] at he_inter + exact he_inter + refine ⟨δ₂, fun e he ↦ ?_, ?_⟩ + · have he₂ : e ∈ G₂.edgeSet := hdiff_eq ▸ he + have h := hδ₂ e he₂ + change δ₂ e ∈ (P.restrict G₂).Δ e at h + rw [P.restrict_Δ (hle₂.trans hG) he₂] at h + change δ₂ e ∈ (P.restrict G).Δ e + rw [P.restrict_Δ hG (hle₂.edgeSet_subset he₂)] + exact h + · change GM04.emptySubgraph G₁.vertexSet ⊔ H_sub = + GM04.emptySubgraph G.vertexSet ⊔ ⨆ e ∈ G.edgeSet \ (id '' H_root.edgeSet), δ₂ e + rw [hH_sub_eq, hdiff_eq] + change GM04.emptySubgraph G₁.vertexSet ⊔ + (GM04.emptySubgraph G₂.vertexSet ⊔ ⨆ e ∈ G₂.edgeSet, δ₂ e) = _ + have hempty_sup : GM04.emptySubgraph G₁.vertexSet ⊔ GM04.emptySubgraph G₂.vertexSet = + GM04.emptySubgraph G.vertexSet := by + ext u v + · change u ∈ G₁.vertexSet ∪ G₂.vertexSet ↔ u ∈ G.vertexSet + rw [GM04.isSeparation_vertexSet_union hsep.isSeparation] + · simp [Subgraph.sup_adj] + rw [← sup_assoc, hempty_sup] + +/-- Verification of Graph Minors IV, Axiom 3 (`GM04.Axiom3`) for subhypergraphs of a robust +patchwork `P` (Graph Minors IV, Section 9, pages 251–252). -/ +theorem axiom3_of_isRobust + [Preorder Ω] + {P : GM04.Patchwork Ω α β} (hrob : P.IsRobust) : + GM04.Axiom3 {H : RootedHypergraph α β | H.toHypergraph ≤ P.G.toHypergraph} + (fun H₁ H₂ ↦ GM04.Simulated (P.restrict H₁) (P.restrict H₂)) := by + classical + intro G hG G₁ G₂ hsep hord hno_sep + let k := G.roots.length + let X₁ := G₁.rootSet + let X₂ := G₂.rootSet + have hle₁ : G₁.toHypergraph ≤ G.toHypergraph := hsep.isSeparation.left_le + have hle₂ : G₂.toHypergraph ≤ G.toHypergraph := hsep.isSeparation.right_le + have hX₁_eq : X₁ = (G₁.toHypergraph ∩ G₂.toHypergraph).vertexSet := hsep.rootSet_left + have hX₂_roots : G₂.roots = G.roots := hsep.roots_right + have hX₁_sub : X₁ ⊆ G₂.vertexSet := by + rw [hX₁_eq]; exact Set.inter_subset_right + have hX₂_sub : X₂ ⊆ G₂.vertexSet := G₂.roots_subset + have hX₁_card : X₁.ncard = k := by + rw [hX₁_eq]; exact hord + have hrob₂ : (P.restrict G₂).IsRobust := isRobust_restrict hrob (hle₂.trans hG) + have hcond1 : GM04.Theorem61Cond1 (P.restrict G₂) X₁ X₂ k := + routes_between_root_sets hsep hno_sep + -- Apply GM04 (6.1) to obtain a realization `H_sub` of `P | G₂` with `k` components joining `X₁` + -- and `X₂`. + have hcond2 : GM04.Theorem61Cond2 (P.restrict G₂) X₁ X₂ k := + ((GM04.theorem_6_1_proof menger hrob₂ hX₁_sub hX₂_sub k).1).1 hcond1 + obtain ⟨H_sub, D, hH_sub, hD_inj, hD⟩ := hcond2 + have hD_disj : ∀ {i j : Fin k}, i ≠ j → Disjoint (D i).verts (D j).verts := by + intro i j hij + exact (hD i).1.disjoint_verts_of_ne (hD j).1 (fun hEq ↦ hij (hD_inj hEq)) + obtain ⟨τ, hD'_root⟩ := match_components_to_roots (D := D) hX₂_roots + (fun i ↦ (hD i).2.2) hD_disj + let D' : Fin k → (⊤ : SimpleGraph α).Subgraph := fun j ↦ D (τ j) + have hD'_comp (j : Fin k) : GM04.IsComponent H_sub (D' j) := (hD (τ j)).1 + have hD'_disj : ∀ {j₁ j₂ : Fin k}, j₁ ≠ j₂ → Disjoint (D' j₁).verts (D' j₂).verts := + fun hij ↦ hD_disj (τ.injective.ne hij) + -- Choose `v_j ∈ (D' j).verts ∩ X₁` for each `j : Fin k`. + choose v₁ hv₁_D' hv₁_X₁ using fun j : Fin k ↦ (hD (τ j)).2.1 + have hv₁_inj : Function.Injective v₁ := by + intro j₁ j₂ hEq + by_contra hne + exact Set.disjoint_left.1 (hD'_disj hne) (hv₁_D' j₁) (hEq ▸ hv₁_D' j₂) + let π₁ : List α := List.ofFn v₁ + have hπ₁_len : π₁.length = k := List.length_ofFn + have hπ₁_nodup : π₁.Nodup := List.nodup_ofFn.2 hv₁_inj + have hπ₁_sub : {v | v ∈ π₁} ⊆ X₁ := by + intro v hv + change v ∈ List.ofFn v₁ at hv + rw [List.mem_ofFn] at hv + obtain ⟨j, rfl⟩ := hv + exact hv₁_X₁ j + have hπ₁_set : {v | v ∈ π₁} = X₁ := by + refine Set.eq_of_subset_of_ncard_le hπ₁_sub ?_ G₁.rootSet_finite + have hcard_range : (Set.range v₁).ncard = k := by + rw [Set.ncard_range_of_injective hv₁_inj, Nat.card_fin] + have hset_eq : {v | v ∈ π₁} = Set.range v₁ := by + ext v; simp [π₁, List.mem_ofFn] + rw [hset_eq, hcard_range, hX₁_card] + let H_root : RootedHypergraph α β := + { toHypergraph := G₁.toHypergraph + roots := π₁ + roots_nodup := hπ₁_nodup + roots_subset := fun v hv ↦ by + have hvX₁ : v ∈ X₁ := hπ₁_set ▸ (show v ∈ {x | x ∈ π₁} from hv) + exact G₁.roots_subset v hvX₁ } + refine ⟨H_root, rfl, hπ₁_set, ?_⟩ + -- Define the expansion `(ηv, id)` of `P | H_root` in `P | G` as in GM IV Section 9 (page 252). + let ηv : α → Set α := fun v ↦ + if h : ∃ j : Fin k, v₁ j = v then (D' h.choose).verts else {v} + have hηv_of_v₁ : ∀ j : Fin k, ηv (v₁ j) = (D' j).verts := by + intro j + have hex : ∃ j' : Fin k, v₁ j' = v₁ j := ⟨j, rfl⟩ + have hchoose : hex.choose = j := hv₁_inj hex.choose_spec + simp only [ηv, dite_eq_left hex, hchoose] + have hv_mem_ηv : ∀ v ∈ G₁.vertexSet, v ∈ ηv v := by + intro v hv + by_cases hex : ∃ j : Fin k, v₁ j = v + · obtain ⟨j, rfl⟩ := hex + rw [hηv_of_v₁ j] + exact hv₁_D' j + · simp only [ηv, dite_eq_right hex, Set.mem_singleton_iff] + have hH_sub_verts : H_sub.verts = G₂.vertexSet := hH_sub.verts_eq + have hD'_sub_G₂ : ∀ j : Fin k, (D' j).verts ⊆ G₂.vertexSet := by + intro j + rw [← hH_sub_verts] + exact (hD'_comp j).le.1 + -- Every component `D' j` meets `G₁.vertexSet` only at `{v₁ j}`! + -- Because `X₁ = G₁.vertexSet ∩ G₂.vertexSet = Set.range v₁`, and `v₁` is injective with `v₁ j' ∈ + -- D' j'`. + have hD'_inter_G₁ : ∀ (j : Fin k) {x : α}, x ∈ (D' j).verts → x ∈ G₁.vertexSet → x = v₁ j := by + intro j x hxD hxG₁ + have hxG₂ : x ∈ G₂.vertexSet := hD'_sub_G₂ j hxD + have hxX₁ : x ∈ X₁ := hX₁_eq.symm ▸ ⟨hxG₁, hxG₂⟩ + rw [← hπ₁_set] at hxX₁ + change x ∈ List.ofFn v₁ at hxX₁ + rw [List.mem_ofFn] at hxX₁ + obtain ⟨j', rfl⟩ := hxX₁ + by_cases hjj' : j' = j + · subst hjj'; rfl + · exact (Set.disjoint_left.1 (hD'_disj hjj') (hv₁_D' j') hxD).elim + have hle_H_root : H_root.toHypergraph ≤ P.G.toHypergraph := hle₁.trans hG + have hexp : GM04.IsExpansion (P.restrict H_root) (P.restrict G) ηv id := + { vertex_nonempty := fun v hv ↦ ⟨v, hv_mem_ηv v hv⟩ + vertex_subset := fun v hv x hx ↦ by + by_cases hex : ∃ j : Fin k, v₁ j = v + · obtain ⟨j, rfl⟩ := hex + rw [hηv_of_v₁ j] at hx + exact hle₂.vertexSet_subset (hD'_sub_G₂ j hx) + · simp only [ηv, dite_eq_right hex, Set.mem_singleton_iff] at hx + subst hx + exact hle₁.vertexSet_subset hv + edge_mem := fun e he ↦ hle₁.edgeSet_subset he + vertex_disjoint := fun u₁ hu₁ u₂ hu₂ hne ↦ by + rw [Set.disjoint_left] + intro x hx₁ hx₂ + by_cases hex₁ : ∃ j : Fin k, v₁ j = u₁ <;> by_cases hex₂ : ∃ j : Fin k, v₁ j = u₂ + · obtain ⟨j₁, rfl⟩ := hex₁ + obtain ⟨j₂, rfl⟩ := hex₂ + rw [hηv_of_v₁ j₁] at hx₁ + rw [hηv_of_v₁ j₂] at hx₂ + have hj_ne : j₁ ≠ j₂ := fun hEq ↦ hne (congrArg v₁ hEq) + exact Set.disjoint_left.1 (hD'_disj hj_ne) hx₁ hx₂ + · obtain ⟨j₁, rfl⟩ := hex₁ + rw [hηv_of_v₁ j₁] at hx₁ + simp only [ηv, dite_eq_right hex₂, Set.mem_singleton_iff] at hx₂ + subst hx₂ + exact hne (hD'_inter_G₁ j₁ hx₁ hu₂).symm + · obtain ⟨j₂, rfl⟩ := hex₂ + rw [hηv_of_v₁ j₂] at hx₂ + simp only [ηv, dite_eq_right hex₁, Set.mem_singleton_iff] at hx₁ + subst hx₁ + exact hne (hD'_inter_G₁ j₂ hx₂ hu₁) + · simp only [ηv, dite_eq_right hex₁, dite_eq_right hex₂, Set.mem_singleton_iff] at hx₁ hx₂ + exact hne (hx₁.symm.trans hx₂) + edge_injOn := fun _ _ _ _ h ↦ h + mem_dom_iff := fun e he ↦ by + rw [P.restrict_dom hle_H_root, P.restrict_dom hG] + exact ⟨fun ⟨hd, _⟩ ↦ ⟨hd, hle₁.edgeSet_subset he⟩, fun ⟨hd, _⟩ ↦ ⟨hd, he⟩⟩ + ends_nonempty := fun e he _ v hinc ↦ by + have hv : v ∈ G₁.vertexSet := G₁.vertex_mem_of_inc hinc + refine ⟨v, hv_mem_ηv v hv, ?_⟩ + exact inc_of_le hle₁ hinc + μ_length := fun _ _ ↦ rfl + μ_mem := fun e he i hi _ ↦ by + rw [P.restrict_dom hle_H_root] at he + change i < (P.μ e).length at hi + have he₁ : e ∈ G₁.edgeSet := he.2 + have hv_inc : G₁.Inc e (P.μ e)[i] := by + change (P.μ e)[i] ∈ G₁.ends e + rw [← (hle₁.trans hG).ends_eq e he₁, ← P.μ_set e he.1] + exact List.getElem_mem hi + exact hv_mem_ηv (P.μ e)[i] (G₁.vertex_mem_of_inc hv_inc) + roots_length := hπ₁_len + roots_mem := fun i hi hi' ↦ by + let j : Fin k := ⟨i, hi'⟩ + change i < (List.ofFn v₁).length at hi + change G.roots[i] ∈ ηv (List.ofFn v₁)[i] + rw [List.getElem_ofFn, hηv_of_v₁ j] + exact hD'_root j + maps_Δ := fun e he δ hδ ↦ by + rw [P.restrict_dom hle_H_root] at he + change δ ∈ (P.restrict H_root).Δ e at hδ + rw [P.restrict_Δ hle_H_root he.2] at hδ + change GM04.marchMapSubgraph (P.μ e) (P.μ e) δ ∈ (P.restrict G).Δ e + rw [P.restrict_Δ hG (hle₁.edgeSet_subset he.2)] + have hverts : δ.verts ⊆ {x | x ∈ P.μ e} := by + rw [((P.Δ e).verts_eq δ hδ).trans (P.Δ_verts e ((hle₁.trans hG).edgeSet_subset he.2)), + P.μ_set e he.1] + rwa [GM04.marchMapSubgraph_id hverts] + φ_le := fun _ _ ↦ le_rfl } + -- Construct the realizing subgraph `H_real = emptySubgraph G₁.vertexSet ⊔ H_sub`. + let H_real := GM04.emptySubgraph G₁.vertexSet ⊔ H_sub + refine ⟨ηv, id, hexp, H_real, ?_, ?_⟩ + · exact isRealization_join_separation hG hsep rfl hH_sub + · intro v hv + have hH_real_verts : H_real.verts = G.vertexSet := by + change G₁.vertexSet ∪ H_sub.verts = G.vertexSet + rw [hH_sub_verts, GM04.isSeparation_vertexSet_union hsep.isSeparation] + have hsub_verts : ηv v ⊆ H_real.verts := by + rw [hH_real_verts] + exact hexp.vertex_subset v hv + rw [GM04.exists_isComponent_verts_eq_iff (hexp.vertex_nonempty v hv) hsub_verts] + by_cases hex : ∃ j : Fin k, v₁ j = v + · obtain ⟨j, rfl⟩ := hex + rw [hηv_of_v₁ j] + have hD'_sub_H : (D' j).verts ⊆ H_sub.verts := (hD'_comp j).le.1 + obtain ⟨hclosed, hconn⟩ := + (GM04.exists_isComponent_verts_eq_iff (hD'_comp j).verts_nonempty hD'_sub_H).1 + ⟨D' j, hD'_comp j, rfl⟩ + refine ⟨fun a ha b hab ↦ ?_, fun a ha b hb ↦ (hconn a ha b hb).mono le_sup_right⟩ + rcases Subgraph.sup_adj.1 hab with hab₁ | hab₂ + · exact False.elim hab₁ + · exact hclosed a ha b hab₂ + · have hηv_eq : ηv v = {v} := by simp only [ηv, dite_eq_right hex] + rw [hηv_eq] + have hv_not_G₂ : v ∉ G₂.vertexSet := by + intro hv₂ + have hvX₁ : v ∈ X₁ := hX₁_eq.symm ▸ ⟨hv, hv₂⟩ + rw [← hπ₁_set] at hvX₁ + change v ∈ List.ofFn v₁ at hvX₁ + rw [List.mem_ofFn] at hvX₁ + exact hex hvX₁ + refine ⟨fun a ha b hab ↦ ?_, ?_⟩ + · rw [Set.mem_singleton_iff] at ha + subst ha + rcases Subgraph.sup_adj.1 hab with hab₁ | hab₂ + · exact False.elim hab₁ + · exact (hv_not_G₂ (hH_sub_verts ▸ H_sub.edge_vert hab₂)).elim + · rintro a rfl b rfl + exact GM04.sameComponent_iff.2 ⟨hH_real_verts.symm ▸ hle₁.vertexSet_subset hv, + hH_real_verts.symm ▸ hle₁.vertexSet_subset hv, Reachable.refl _⟩ + +/-- In an arborescence `T` with `T.verts = Finset.univ`, removing an edge `e_f = s(f, T.parent f)` +(`f ∈ T.edges`) from `S = arborescenceUnderlying T` disconnects `S` into `T.subtreeAt f` (the +component of `f`) and `T.rootSide f` (the component of `T.parent f`). -/ +theorem reachable_deleteEdges_arborescenceUnderlying_iff {ι : Type*} [Fintype ι] + (T : GM04.RootedTree ι) (hT_verts : T.verts = Finset.univ) {f : ι} (hf : f ∈ T.edges) (t : ι) : + ((arborescenceUnderlying T).deleteEdges {s(f, T.parent f)}).Reachable f t ↔ + t ∈ T.subtreeAt f := by + classical + let G' := (arborescenceUnderlying T).deleteEdges {s(f, T.parent f)} + have hf_ne_root : f ≠ T.root := T.ne_root_of_mem_edges hf + have hadj_sub : ∀ {u v : ι}, G'.Adj u v → (u ∈ T.subtreeAt f ↔ v ∈ T.subtreeAt f) := by + intro u v hadj_G' + rw [SimpleGraph.deleteEdges_adj, Set.mem_singleton_iff] at hadj_G' + rcases hadj_G' with ⟨hadj, hne_e⟩ + rw [T.mem_subtreeAt, T.mem_subtreeAt] + rcases hadj with ⟨hu, rfl⟩ | ⟨hv, rfl⟩ + · refine ⟨fun ⟨_, n, hn⟩ ↦ ?_, fun ⟨_, n, hn⟩ ↦ ⟨hT_verts ▸ Finset.mem_univ u, n + 1, ?_⟩⟩ + · rcases n with _ | n + · exfalso + subst hn + exact hne_e rfl + · rw [Function.iterate_succ_apply] at hn + exact ⟨hT_verts ▸ Finset.mem_univ _, n, hn⟩ + · rw [Function.iterate_succ_apply, hn] + · refine ⟨fun ⟨_, n, hn⟩ ↦ ⟨hT_verts ▸ Finset.mem_univ v, n + 1, ?_⟩, fun ⟨_, n, hn⟩ ↦ ?_⟩ + · rw [Function.iterate_succ_apply, hn] + · rcases n with _ | n + · exfalso + subst hn + exact hne_e Sym2.eq_swap + · rw [Function.iterate_succ_apply] at hn + exact ⟨hT_verts ▸ Finset.mem_univ _, n, hn⟩ + constructor + · rintro ⟨w⟩ + suffices ∀ {a b : ι} (w : G'.Walk a b), a ∈ T.subtreeAt f → b ∈ T.subtreeAt f from + this w (T.self_mem_subtreeAt (hT_verts ▸ Finset.mem_univ f)) + intro a b w ha + induction w with + | nil => exact ha + | @cons u v z hadj _ ih => exact ih ((hadj_sub hadj).1 ha) + · intro ht + rw [T.mem_subtreeAt] at ht + obtain ⟨_, n, hn⟩ := ht + suffices ∀ (k : ℕ) (x : ι), T.parent^[k] x = f → G'.Reachable f x from this n t hn + intro k + induction k with + | zero => + intro x hx + rw [Function.iterate_zero_apply] at hx + exact hx ▸ Reachable.refl x + | succ k ih => + intro x hx + rw [Function.iterate_succ_apply] at hx + have hreach_par := ih (T.parent x) hx + have hx_ne_root : x ≠ T.root := by + intro hxr + rw [hxr, T.parent_root, T.iterate_parent_root k] at hx + exact hf_ne_root hx.symm + have hx_edges : x ∈ T.edges := + T.mem_edges_iff.2 ⟨hT_verts ▸ Finset.mem_univ x, hx_ne_root⟩ + have hx_ne_f : x ≠ f := by + intro hxf + rw [hxf] at hx + have h1 : T.parent^[k + 1] f = f := by rw [Function.iterate_succ_apply, hx] + exact Thomas.not_iterate_succ_eq_self T (hT_verts ▸ Finset.mem_univ f) hf_ne_root k h1 + have hadj : G'.Adj x (T.parent x) := by + rw [SimpleGraph.deleteEdges_adj, Set.mem_singleton_iff, Sym2.eq_iff] + refine ⟨Or.inl ⟨hx_edges, rfl⟩, ?_⟩ + rintro (⟨hEq₁, _⟩ | ⟨hEq₁, hEq₂⟩) + · exact hx_ne_f hEq₁ + · exact T.not_reaches_parent hf ⟨hT_verts ▸ Finset.mem_univ _, 1, + by rw [Function.iterate_one, ← hEq₁, hEq₂]⟩ + exact hreach_par.trans (Adj.reachable hadj.symm) + +theorem reachable_parent_deleteEdges_arborescenceUnderlying_iff {ι : Type*} [Fintype ι] + (T : GM04.RootedTree ι) (hT_verts : T.verts = Finset.univ) {f : ι} (hf : f ∈ T.edges) (t : ι) : + ((arborescenceUnderlying T).deleteEdges {s(f, T.parent f)}).Reachable (T.parent f) t ↔ + t ∈ T.rootSide f := by + classical + let G' := (arborescenceUnderlying T).deleteEdges {s(f, T.parent f)} + have hf_ne_root : f ≠ T.root := T.ne_root_of_mem_edges hf + have hpar_not_sub : T.parent f ∉ T.subtreeAt f := by + rw [T.mem_subtreeAt] + exact T.not_reaches_parent hf + have hreach_root : ∀ x : ι, x ∉ T.subtreeAt f → G'.Reachable T.root x := by + intro x hx_not + obtain ⟨n, hn⟩ := T.exists_iterate_eq_root x (hT_verts ▸ Finset.mem_univ x) + induction n generalizing x with + | zero => + change x = T.root at hn + subst hn + exact Reachable.refl T.root + | succ n ih => + by_cases hx_root : x = T.root + · subst hx_root; exact Reachable.refl T.root + · rw [Function.iterate_succ_apply] at hn + have hx_edges : x ∈ T.edges := + T.mem_edges_iff.2 ⟨hT_verts ▸ Finset.mem_univ x, hx_root⟩ + have hx_ne_f : x ≠ f := by + rintro rfl + exact hx_not (T.self_mem_subtreeAt (hT_verts ▸ Finset.mem_univ x)) + have hpar_not : T.parent x ∉ T.subtreeAt f := by + rw [T.mem_subtreeAt] + rintro ⟨_, k, hk⟩ + apply hx_not + rw [T.mem_subtreeAt] + exact ⟨hT_verts ▸ Finset.mem_univ x, k + 1, + by rw [Function.iterate_succ_apply, hk]⟩ + have hadj : G'.Adj x (T.parent x) := by + rw [SimpleGraph.deleteEdges_adj, Set.mem_singleton_iff, Sym2.eq_iff] + refine ⟨Or.inl ⟨hx_edges, rfl⟩, ?_⟩ + rintro (⟨hEq₁, _⟩ | ⟨hEq₁, hEq₂⟩) + · exact hx_ne_f hEq₁ + · subst hEq₁ + exact hx_not (T.mem_subtreeAt.2 ⟨hT_verts ▸ Finset.mem_univ _, 1, + by rw [Function.iterate_one, hEq₂]⟩) + exact (ih (T.parent x) hpar_not hn).trans (Adj.reachable hadj.symm) + rw [T.mem_rootSide, ← T.mem_subtreeAt, hT_verts] + simp only [Finset.mem_univ, true_and] + constructor + · intro hreach ht_sub + have hrf : G'.Reachable f t := + (reachable_deleteEdges_arborescenceUnderlying_iff T hT_verts hf t).2 ht_sub + have hf_par : G'.Reachable f (T.parent f) := hrf.trans hreach.symm + exact hpar_not_sub + ((reachable_deleteEdges_arborescenceUnderlying_iff T hT_verts hf (T.parent f)).1 hf_par) + · intro ht_not + exact (hreach_root (T.parent f) hpar_not_sub).symm.trans (hreach_root t ht_not) + +private theorem rooted_decomposition_isRotund {ι : Type*} [Fintype ι] + {G : RootedHypergraph α β} {S : SimpleGraph ι} {σ : ι → Hypergraph α β} + {T : GM04.RootedTree ι} {σ_plus : ι → RootedHypergraph α β} + (hT_verts : T.verts = Finset.univ) (hT_S : arborescenceUnderlying T = S) + (hrot : IsRotund G.toHypergraph S σ) + (htd_plus : GM04.IsTreeDecomposition G T σ_plus) + (hsubtree_eq_side : ∀ {g : ι} (_ : g ∈ T.edges), + (GM04.cross σ_plus (T.subtreeAt g) g).toHypergraph = + GM10.treeDecompSide S σ s(g, T.parent g) g) + (hrootSide_eq_side : ∀ {g : ι} (_ : g ∈ T.edges), + (GM04.cross σ_plus (T.rootSide g) T.root).toHypergraph = + GM10.treeDecompSide S σ s(g, T.parent g) (T.parent g)) + (hmakes_edge : ∀ {g : ι} (_ : g ∈ T.edges), + GM10.MakesSeparation S σ s(g, T.parent g) + (GM04.cross σ_plus (T.subtreeAt g) g).toHypergraph + (GM04.cross σ_plus (T.rootSide g) T.root).toHypergraph) : + GM04.IsRotund T σ_plus (T.edges : Set ι) := by + classical + have hcross_verts := htd_plus.cross_verts_eq + intro f₁ hf₁ f₂ hf₂ hreach hord hmin ⟨H₁, H₂, hsepH, hle₁, hle₂, hord_lt⟩ + rw [hcross_verts] at hsepH + let iso : Thomas.toSimpleGraph T ≃g S := + { toFun := fun u ↦ u.1 + invFun := fun x ↦ ⟨x, hT_verts ▸ Finset.mem_univ x⟩ + left_inv := fun _ ↦ Subtype.ext rfl + right_inv := fun _ ↦ rfl + map_rel_iff' := by + intro u v + rw [← hT_S] + simp only [Thomas.toSimpleGraph, arborescenceUnderlying, Equiv.coe_fn_mk, + T.mem_edges_iff, u.2, v.2, true_and] } + let u₁ : T.verts := ⟨f₁, T.edges_subset_verts hf₁⟩ + let u₂ : T.verts := ⟨T.parent f₂, T.parent_mem f₂ (T.edges_subset_verts hf₂)⟩ + let p_T := Thomas.treePath (Thomas.toSimpleGraph_isTree T) u₁ u₂ + have hp_T_path : p_T.IsPath := Thomas.treePath_isPath (Thomas.toSimpleGraph_isTree T) u₁ u₂ + let p : S.Walk f₁ (T.parent f₂) := p_T.map iso.toHom + have hp_path : p.IsPath := hp_T_path.map iso.injective + -- Every vertex `w` on `p_T` satisfies `T.Reaches w.1 f₁` and `T.Reaches (T.parent f₂) w.1`. + have hp_T_support : ∀ w : T.verts, w ∈ p_T.support ↔ + T.Reaches w.1 f₁ ∧ T.Reaches (T.parent f₂) w.1 := by + intro w + rw [← Thomas.onTreePath_iff_mem_treePath (Thomas.toSimpleGraph_isTree T), + Thomas.onTreePath_toSimpleGraph_iff T u₁ u₂ w] + constructor + · intro hon + have hf₂_par : T.Reaches (T.parent f₂) f₂ := ⟨T.edges_subset_verts hf₂, 1, rfl⟩ + have hpar_f₁ : T.Reaches (T.parent f₂) f₁ := T.reaches_trans hf₂_par hreach + rcases hon.1 with hwf₁ | hwf₂ + · exact ⟨hwf₁, hon.2 (T.parent f₂) hpar_f₁ (T.reaches_refl u₂.2)⟩ + · have h_eq : w.1 = T.parent f₂ := + T.reaches_antisymm hwf₂ (hon.2 (T.parent f₂) hpar_f₁ (T.reaches_refl u₂.2)) + rw [h_eq] + exact ⟨hpar_f₁, T.reaches_refl u₂.2⟩ + · rintro ⟨hwf₁, hpar_w⟩ + refine ⟨Or.inl hwf₁, fun x hx₁ hx₂ ↦ ?_⟩ + exact T.reaches_trans hx₂ hpar_w + have hK_tree := Thomas.toSimpleGraph_isTree T + have hf₁_in_p : s(f₁, T.parent f₁) ∈ p.edges := by + let u₁_par : T.verts := ⟨T.parent f₁, T.parent_mem f₁ u₁.2⟩ + have hadj₁ : (Thomas.toSimpleGraph T).Adj u₁_par u₁ := + Or.inr ⟨T.ne_root_of_mem_edges hf₁, rfl⟩ + have hpar₁_mem : u₁_par ∈ p_T.support := by + rw [hp_T_support] + refine ⟨⟨u₁.2, 1, rfl⟩, ?_⟩ + obtain ⟨_, n, hn⟩ := hreach + exact ⟨T.parent_mem f₁ u₁.2, n, by rw [← Function.iterate_succ_apply, + Function.iterate_succ_apply', hn]⟩ + have hpar₁_on : Thomas.OnTreePath (Thomas.toSimpleGraph T) u₂ u₁ u₁_par := + Thomas.onTreePath_symm ((Thomas.onTreePath_iff_mem_treePath hK_tree).2 hpar₁_mem) + have he_self : Thomas.OnTreePathEdge (Thomas.toSimpleGraph T) u₁_par u₁ u₁_par u₁ := by + rw [Thomas.onTreePathEdge_iff_mem_treePath hK_tree] + refine ⟨hadj₁, ?_⟩ + rw [← Thomas.eq_treePath hK_tree hadj₁.toWalk hadj₁.isPath_toWalk] + simp + have he_T : Thomas.OnTreePathEdge (Thomas.toSimpleGraph T) u₁ u₂ u₁ u₁_par := + Thomas.onTreePathEdge_swap + (Thomas.onTreePathEdge_symm_endpoints + (Thomas.onTreePathEdge_of_onTreePath_right hK_tree hpar₁_on he_self)) + have he_mem := ((Thomas.onTreePathEdge_iff_mem_treePath hK_tree).1 he_T).2 + rw [Walk.edges_map, List.mem_map] + exact ⟨s(u₁, u₁_par), he_mem, rfl⟩ + have hf₂_in_p : s(f₂, T.parent f₂) ∈ p.edges := by + let v₂ : T.verts := ⟨f₂, T.edges_subset_verts hf₂⟩ + have hadj₂ : (Thomas.toSimpleGraph T).Adj v₂ u₂ := + Or.inl ⟨T.ne_root_of_mem_edges hf₂, rfl⟩ + have hf₂_mem : v₂ ∈ p_T.support := by + rw [hp_T_support] + exact ⟨hreach, ⟨T.edges_subset_verts hf₂, 1, rfl⟩⟩ + have hf₂_on : Thomas.OnTreePath (Thomas.toSimpleGraph T) u₁ u₂ v₂ := + (Thomas.onTreePath_iff_mem_treePath hK_tree).2 hf₂_mem + have he_self : Thomas.OnTreePathEdge (Thomas.toSimpleGraph T) v₂ u₂ v₂ u₂ := by + rw [Thomas.onTreePathEdge_iff_mem_treePath hK_tree] + refine ⟨hadj₂, ?_⟩ + rw [← Thomas.eq_treePath hK_tree hadj₂.toWalk hadj₂.isPath_toWalk] + simp + have he_T : Thomas.OnTreePathEdge (Thomas.toSimpleGraph T) u₁ u₂ v₂ u₂ := + Thomas.onTreePathEdge_of_onTreePath_right hK_tree hf₂_on he_self + have he_mem := ((Thomas.onTreePathEdge_iff_mem_treePath hK_tree).1 he_T).2 + rw [Walk.edges_map, List.mem_map] + exact ⟨s(v₂, u₂), he_mem, rfl⟩ + have hmakes₁_symm : GM10.MakesSeparation S σ s(f₁, T.parent f₁) + (GM04.cross σ_plus (T.rootSide f₁) T.root).toHypergraph + (GM04.cross σ_plus (T.subtreeAt f₁) f₁).toHypergraph := by + have hadj₁ : S.Adj f₁ (T.parent f₁) := by + rw [← hT_S]; exact Or.inl ⟨hf₁, rfl⟩ + exact ⟨T.parent f₁, f₁, hadj₁.symm, Sym2.eq_swap, + by rw [Sym2.eq_swap]; exact hrootSide_eq_side hf₁, + by rw [Sym2.eq_swap]; exact hsubtree_eq_side hf₁⟩ + have hmakes₂ : GM10.MakesSeparation S σ s(f₂, T.parent f₂) + (GM04.cross σ_plus (T.subtreeAt f₂) f₂).toHypergraph + (GM04.cross σ_plus (T.rootSide f₂) T.root).toHypergraph := + hmakes_edge hf₂ + have hsub₁₂ : (GM04.cross σ_plus (T.subtreeAt f₁) f₁).toHypergraph ≤ + (GM04.cross σ_plus (T.subtreeAt f₂) f₂).toHypergraph := + htd_plus.cross_le_cross (T.subtreeAt_mono hreach) (T.subtreeAt_subset_verts f₂) + (T.self_mem_subtreeAt u₁.2) (T.self_mem_subtreeAt (T.edges_subset_verts hf₂)) + have hroot₂₁ : (GM04.cross σ_plus (T.rootSide f₂) T.root).toHypergraph ≤ + (GM04.cross σ_plus (T.rootSide f₁) T.root).toHypergraph := by + have hsub_root : T.rootSide f₂ ⊆ T.rootSide f₁ := by + intro x hx + rw [T.mem_rootSide] at hx ⊢ + exact ⟨hx.1, fun h₁ ↦ hx.2 (T.reaches_trans hreach h₁)⟩ + exact htd_plus.cross_le_cross hsub_root (T.rootSide_subset_verts f₁) + (T.root_mem_rootSide hf₂) (T.root_mem_rootSide hf₁) + have hord₁₂ : separationOrder + (GM04.cross σ_plus (T.rootSide f₁) T.root).toHypergraph + (GM04.cross σ_plus (T.subtreeAt f₁) f₁).toHypergraph = + separationOrder + (GM04.cross σ_plus (T.subtreeAt f₂) f₂).toHypergraph + (GM04.cross σ_plus (T.rootSide f₂) T.root).toHypergraph := by + rw [separationOrder_comm] + exact hord + have hord_H_lt : separationOrder H₁ H₂ < + separationOrder (GM04.cross σ_plus (T.rootSide f₁) T.root).toHypergraph + (GM04.cross σ_plus (T.subtreeAt f₁) f₁).toHypergraph := by + rw [separationOrder_comm (GM04.cross σ_plus (T.rootSide f₁) T.root).toHypergraph] + exact hord_lt + obtain ⟨e, he_p, C, D, hmakes_e, hord_e_lt⟩ := + hrot p hp_path (Sym2.mem_mk_left _ _) (Sym2.mem_mk_right _ _) hf₁_in_p hf₂_in_p + hmakes₁_symm hmakes₂ hroot₂₁ hsub₁₂ hord₁₂ + ⟨H₁, H₂, hsepH, hle₁, hle₂, hord_H_lt⟩ + rw [Walk.edges_map, List.mem_map] at he_p + obtain ⟨e_T, he_T_mem, rfl⟩ := he_p + induction e_T using Sym2.ind with + | _ s s' => + have he_T : Thomas.OnTreePathEdge (Thomas.toSimpleGraph T) u₁ u₂ s s' := + (Thomas.onTreePathEdge_iff_mem_treePath hK_tree).2 + ⟨p_T.adj_of_mem_edges he_T_mem, he_T_mem⟩ + obtain ⟨g, hg_edges, _, h_orient⟩ := Thomas.exists_onPathEdge_of_onTreePathEdge T he_T + have hs_in : s ∈ p_T.support := Walk.fst_mem_support_of_mem_edges p_T he_T_mem + have hs'_in : s' ∈ p_T.support := Walk.snd_mem_support_of_mem_edges p_T he_T_mem + rw [hp_T_support] at hs_in hs'_in + have hg_reaches : T.Reaches g.1 f₁ ∧ T.Reaches (T.parent f₂) (T.parent g.1) := by + rcases h_orient with ⟨hs_eq, hs'_par⟩ | ⟨hs'_eq, hs_par⟩ + · have hs'_val : s'.1 = T.parent g.1 := congrArg Subtype.val hs'_par + rw [hs_eq] at hs_in + rw [hs'_val] at hs'_in + exact ⟨hs_in.1, hs'_in.2⟩ + · have hs_val : s.1 = T.parent g.1 := congrArg Subtype.val hs_par + rw [hs'_eq] at hs'_in + rw [hs_val] at hs_in + exact ⟨hs'_in.1, hs_in.2⟩ + have hf₂_g : T.Reaches f₂ g.1 := by + rcases T.reaches_total_of_reaches hreach hg_reaches.1 with h1 | h2 + · exact h1 + · by_cases hgf₂ : g.1 = f₂ + · subst hgf₂; exact T.reaches_refl g.2 + · exfalso + have h3 := T.reaches_parent_of_reaches_of_ne h2 hgf₂ + exact T.not_reaches_parent hg_edges (T.reaches_trans h3 hg_reaches.2) + have hg_pathEdges : g.1 ∈ T.pathEdges f₂ f₁ ∩ (T.edges : Set ι) := + ⟨⟨hf₂_g, hg_reaches.1⟩, hg_edges⟩ + have h_e_eq : (Sym2.map iso.toHom s(s, s')) = s(g.1, T.parent g.1) := by + rcases h_orient with ⟨hs_eq, hs'_par⟩ | ⟨hs'_eq, hs_par⟩ + · change s(s.1, s'.1) = s(g.1, T.parent g.1) + rw [congrArg Subtype.val hs_eq, congrArg Subtype.val hs'_par] + rfl + · change s(s.1, s'.1) = s(g.1, T.parent g.1) + rw [congrArg Subtype.val hs'_eq, congrArg Subtype.val hs_par, Sym2.eq_swap] + rfl + rw [h_e_eq] at hmakes_e + have hord_g_eq : separationOrder C D = GM04.edgeOrder T σ_plus g.1 := by + obtain ⟨u, v, _, he_uv, rfl, rfl⟩ := hmakes_e + rcases Sym2.eq_iff.1 he_uv with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rw [← hsubtree_eq_side hg_edges, ← hrootSide_eq_side hg_edges] + rfl + · rw [Sym2.eq_swap, separationOrder_comm, ← hsubtree_eq_side hg_edges, + ← hrootSide_eq_side hg_edges] + rfl + have hord_f₁_eq : separationOrder + (GM04.cross σ_plus (T.rootSide f₁) T.root).toHypergraph + (GM04.cross σ_plus (T.subtreeAt f₁) f₁).toHypergraph = + GM04.edgeOrder T σ_plus f₁ := by + rw [separationOrder_comm] + rfl + rw [hord_g_eq, hord_f₁_eq] at hord_e_lt + exact not_lt.2 (hmin g.1 hg_pathEdges) hord_e_lt + +/-- **Graph Minors XVIII, (6.4)** (page 102): +"Let $P = (G, \mu, \Delta, \phi)$ be a rootless, robust $\Omega$-patchwork, and let $(S, +\sigma)$ be a rotund tree-decomposition of $G^-$. Let $T$ be an arborescence with $T^- = S$. +Then there is a rooted decomposition $(T, \tau)$ of $P$ such that $\tau(t)^- = \sigma(t)$ +for each $t \in V(T)$." -/ +theorem theorem_6_4_proof + [Preorder Ω] {ι : Type*} [Fintype ι] + {P : GM04.Patchwork Ω α β} (hrootless : IsRootless P) (hrob : P.IsRobust) + {S : SimpleGraph ι} {σ : ι → Hypergraph α β} + (htd : GM10.IsTreeDecomposition P.G.toHypergraph S σ) + (hrot : IsRotund P.G.toHypergraph S σ) + (T : GM04.RootedTree ι) (hT_verts : T.verts = Finset.univ) + (hT_S : arborescenceUnderlying T = S) : + ∃ τ : ι → RootedHypergraph α β, + IsRootedDecomposition P T τ ∧ ∀ t, (τ t).toHypergraph = σ t := by + classical + have hG_roots_nil : P.G.roots = [] := by + rw [List.eq_nil_iff_forall_not_mem] + intro v hv + have hv_set : v ∈ P.G.rootSet := hv + rw [hrootless] at hv_set + exact hv_set + -- Construct `σ⁺ : ι → RootedHypergraph α β` as in the proof of (6.4) (page 102). + let σ_plus : ι → RootedHypergraph α β := fun t ↦ + { toHypergraph := σ t + roots := + if t = T.root then [] + else + (((σ t).vertexSet_finite.subset Set.inter_subset_left : + ((σ t).vertexSet ∩ (σ (T.parent t)).vertexSet).Finite)).toFinset.toList + roots_nodup := by + split_ifs + · exact List.nodup_nil + · exact Finset.nodup_toList _ + roots_subset := by + intro v hv + split_ifs at hv + · exact (List.not_mem_nil hv).elim + · rw [Finset.mem_toList, Set.Finite.mem_toFinset] at hv + exact hv.1 } + have hσ_plus_toH : ∀ t, (σ_plus t).toHypergraph = σ t := fun _ ↦ rfl + -- `(T, σ⁺)` is a `GM04.IsTreeDecomposition` of `P.G`. + have htd_plus : GM04.IsTreeDecomposition P.G T σ_plus := + { le := fun t _ ↦ htd.le t + biUnion_eq := by + rw [hT_verts] + exact htd.biUnion_eq + edgeSet_inter_eq := fun _ _ _ _ hne ↦ htd.edgeSet_inter_eq hne + inter_le := fun t₁ ht₁ t₂ ht₂ t₃ ht₃ hon ↦ by + refine htd.inter_le fun w hw_path ↦ ?_ + let iso : Thomas.toSimpleGraph T ≃g S := + { toFun := fun u ↦ u.1 + invFun := fun x ↦ ⟨x, hT_verts ▸ Finset.mem_univ x⟩ + left_inv := fun _ ↦ Subtype.ext rfl + right_inv := fun _ ↦ rfl + map_rel_iff' := by + intro u v + rw [← hT_S] + simp only [Thomas.toSimpleGraph, arborescenceUnderlying, Equiv.coe_fn_mk, + T.mem_edges_iff, u.2, v.2, true_and] } + let u₁ : T.verts := ⟨t₁, ht₁⟩ + let u₂ : T.verts := ⟨t₂, ht₂⟩ + let u₃ : T.verts := ⟨t₃, ht₃⟩ + have hon_T : Thomas.OnTreePath (Thomas.toSimpleGraph T) u₁ u₃ u₂ := + (Thomas.onTreePath_toSimpleGraph_iff T u₁ u₃ u₂).2 hon + let w_T : (Thomas.toSimpleGraph T).Walk u₁ u₃ := w.map iso.symm.toHom + have hw_T_path : w_T.IsPath := hw_path.map iso.symm.injective + have hu₂_in : u₂ ∈ (w.map iso.symm.toHom).support := hon_T w_T hw_T_path + rw [Walk.support_map, List.mem_map] at hu₂_in + obtain ⟨x, hx, hx_eq⟩ := hu₂_in + have hx_val : x = t₂ := congrArg Subtype.val hx_eq + exact hx_val ▸ hx + roots_root := by + change (if T.root = T.root then [] else _) = P.G.roots + rw [ite_eq_left rfl, hG_roots_nil] + rootSet_edge := fun f hf ↦ by + have hf_ne : f ≠ T.root := T.ne_root_of_mem_edges hf + change {v | v ∈ (if f = T.root then [] else _)} = _ + rw [ite_eq_right hf_ne] + ext v + simp only [Set.mem_ofPred_eq, Finset.mem_toList, Set.Finite.mem_toFinset, + inter_vertexSet] + rfl } + have hcross_verts : GM04.cross σ_plus T.verts T.root = P.G := + htd_plus.cross_verts_eq + -- Relate `cross σ⁺ (T.subtreeAt g) g` and `cross σ⁺ (T.rootSide g) T.root` to + -- `GM10.treeDecompSide S σ`. + have hsubtree_eq_side : ∀ {g : ι} (hg : g ∈ T.edges), + (GM04.cross σ_plus (T.subtreeAt g) g).toHypergraph = + GM10.treeDecompSide S σ s(g, T.parent g) g := by + intro g hg + have hg_sub : g ∈ T.subtreeAt g := T.self_mem_subtreeAt (hT_verts ▸ Finset.mem_univ g) + have hins : insert g (T.subtreeAt g) = T.subtreeAt g := Finset.insert_eq_of_mem hg_sub + have hreach_eq : ∀ t : ι, + (S.deleteEdges {s(g, T.parent g)}).Reachable g t ↔ t ∈ T.subtreeAt g := by + intro t + rw [← hT_S] + exact reachable_deleteEdges_arborescenceUnderlying_iff T hT_verts hg t + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (biUnion_le fun t _ ↦ htd.le t) + (biUnion_le fun t _ ↦ htd.le t) ?_ ?_ + · change (⋃ t ∈ insert g (T.subtreeAt g), (σ t).vertexSet) = _ + rw [hins] + ext v + simp only [GM10.treeDecompSide, biUnion, Set.mem_iUnion, Finset.mem_filter, + Finset.mem_univ, true_and, hreach_eq] + · change (⋃ t ∈ insert g (T.subtreeAt g), (σ t).edgeSet) = _ + rw [hins] + ext e + simp only [GM10.treeDecompSide, biUnion, Set.mem_iUnion, Finset.mem_filter, + Finset.mem_univ, true_and, hreach_eq] + have hrootSide_eq_side : ∀ {g : ι} (hg : g ∈ T.edges), + (GM04.cross σ_plus (T.rootSide g) T.root).toHypergraph = + GM10.treeDecompSide S σ s(g, T.parent g) (T.parent g) := by + intro g hg + have hroot_mem : T.root ∈ T.rootSide g := T.root_mem_rootSide hg + have hins : insert T.root (T.rootSide g) = T.rootSide g := Finset.insert_eq_of_mem hroot_mem + have hreach_eq : ∀ t : ι, + (S.deleteEdges {s(g, T.parent g)}).Reachable (T.parent g) t ↔ t ∈ T.rootSide g := by + intro t + rw [← hT_S] + exact reachable_parent_deleteEdges_arborescenceUnderlying_iff T hT_verts hg t + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (biUnion_le fun t _ ↦ htd.le t) + (biUnion_le fun t _ ↦ htd.le t) ?_ ?_ + · change (⋃ t ∈ insert T.root (T.rootSide g), (σ t).vertexSet) = _ + rw [hins] + ext v + simp only [GM10.treeDecompSide, biUnion, Set.mem_iUnion, Finset.mem_filter, + Finset.mem_univ, true_and, hreach_eq] + · change (⋃ t ∈ insert T.root (T.rootSide g), (σ t).edgeSet) = _ + rw [hins] + ext e + simp only [GM10.treeDecompSide, biUnion, Set.mem_iUnion, Finset.mem_filter, + Finset.mem_univ, true_and, hreach_eq] + have hmakes_edge : ∀ {g : ι} (hg : g ∈ T.edges), + GM10.MakesSeparation S σ s(g, T.parent g) + (GM04.cross σ_plus (T.subtreeAt g) g).toHypergraph + (GM04.cross σ_plus (T.rootSide g) T.root).toHypergraph := by + intro g hg + have hadj : S.Adj g (T.parent g) := by + rw [← hT_S] + exact Or.inl ⟨hg, rfl⟩ + exact ⟨g, T.parent g, hadj, rfl, hsubtree_eq_side hg, hrootSide_eq_side hg⟩ + have hrot_plus : GM04.IsRotund T σ_plus (T.edges : Set ι) := + rooted_decomposition_isRotund hT_verts hT_S hrot htd_plus + hsubtree_eq_side hrootSide_eq_side hmakes_edge + -- Apply GM04 (4.1) to `(T, σ⁺)`. + let R : Set (RootedHypergraph α β) := {H | H.toHypergraph ≤ P.G.toHypergraph} + let sim : RootedHypergraph α β → RootedHypergraph α β → Prop := + fun H₁ H₂ ↦ GM04.Simulated (P.restrict H₁) (P.restrict H₂) + have hA1 : GM04.Axiom1 R := fun G hG H hH ↦ hH.trans hG + have hA2 : GM04.Axiom2 R sim := + ⟨fun G _ ↦ GM04.Simulated.refl _, fun _ _ _ _ _ _ h₁₂ h₂₃ ↦ h₁₂.trans h₂₃⟩ + have hA3 : GM04.Axiom3 R sim := axiom3_of_isRobust hrob + have htd_cross : GM04.IsTreeDecomposition (GM04.cross σ_plus T.verts T.root) T σ_plus := by + rwa [hcross_verts] + have hR_cross : GM04.cross σ_plus T.verts T.root ∈ R := by + change (GM04.cross σ_plus T.verts T.root).toHypergraph ≤ P.G.toHypergraph + rw [hcross_verts] + obtain ⟨τ, htd_τ, hτ_toH, hlinked_τ⟩ := + GM04.theorem_4_1_proof hA1 hA2 hA3 T σ_plus htd_cross hR_cross (T.edges : Set ι) + subset_rfl hrot_plus + rw [hcross_verts] at htd_τ + refine ⟨τ, ⟨htd_τ, hlinked_τ⟩, fun t ↦ ?_⟩ + exact hτ_toH t (hT_verts ▸ Finset.mem_univ t) + +/-! ## Theorem (6.5): Subtrees, root sides, and child locations in rooted decompositions -/ + +/-- Every left side `A` of a rooted separation `(A, B)` of `G` (`G.IsSeparation A B`) is +complemented in `G`. -/ +theorem isComplemented_of_isSeparation {G A B : RootedHypergraph α β} + (hsep : G.IsSeparation A B) : IsComplemented G A where + le := hsep.isSeparation.left_le + roots_mem v hvA hvG := by + rw [hsep.rootSet_left] + have hvB_root : v ∈ B.rootSet := by + change v ∈ B.roots + rw [hsep.roots_right] + exact hvG + exact ⟨hvA, B.roots_subset v hvB_root⟩ + inc_diff_mem v e hvA he hinc := by + rw [hsep.rootSet_left] + have he_union : e ∈ A.edgeSet ∪ B.edgeSet := by + rw [← union_edgeSet, hsep.isSeparation.union_eq] + exact he.1 + have heB : e ∈ B.edgeSet := he_union.resolve_left he.2 + have hincB : B.Inc e v := (inc_iff_of_le hsep.isSeparation.right_le heB v).1 hinc + exact ⟨hvA, B.vertex_mem_of_inc hincB⟩ + +/-- If `G.IsSeparation A B`, then `complement G A` equals `B`. -/ +theorem complement_eq_of_isSeparation {G A B : RootedHypergraph α β} + (hsep : G.IsSeparation A B) : + complement G A (isComplemented_of_isSeparation hsep) = B := by + have hcomp := isComplemented_of_isSeparation hsep + refine RootedHypergraph.ext ?_ hsep.roots_right.symm + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + hcomp.isSeparation.isSeparation.right_le hsep.isSeparation.right_le ?_ ?_ + · change (G.vertexSet \ A.vertexSet) ∪ A.rootSet = B.vertexSet + rw [hsep.rootSet_left] + ext v + simp only [Set.mem_union, Set.mem_sdiff, inter_vertexSet, Set.mem_inter_iff] + constructor + · rintro (⟨hvG, hvA⟩ | ⟨_, hvB⟩) + · rw [← hsep.isSeparation.union_eq, union_vertexSet] at hvG + exact hvG.resolve_left hvA + · exact hvB + · intro hvB + by_cases hvA : v ∈ A.vertexSet + · exact Or.inr ⟨hvA, hvB⟩ + · exact Or.inl ⟨hsep.isSeparation.right_le.vertexSet_subset hvB, hvA⟩ + · change G.edgeSet \ A.edgeSet = B.edgeSet + ext e + simp only [Set.mem_sdiff] + constructor + · rintro ⟨heG, heA⟩ + rw [← hsep.isSeparation.union_eq, union_edgeSet] at heG + exact heG.resolve_left heA + · intro heB + refine ⟨hsep.isSeparation.right_le.edgeSet_subset heB, fun heA ↦ ?_⟩ + have he_inter : e ∈ (A.toHypergraph ∩ B.toHypergraph).edgeSet := ⟨heA, heB⟩ + rw [hsep.isSeparation.edgeSet_inter_eq] at he_inter + exact he_inter + +/-- **Graph Minors XVIII, (6.5.1)** (page 103): +"Let $(T, \tau)$ be a rooted decomposition of a rootless $\Omega$-patchwork $P = (G, \mu, +\Delta, \phi)$.* 1. *If $f \in E(T)$, then $\tau \times T^f$ is complemented in $G$, and $G +\setminus \tau \times T^f = \tau \times T_f$." -/ +theorem theorem_6_5_1 [Preorder Ω] {ι : Type*} {P : GM04.Patchwork Ω α β} + {T : GM04.RootedTree ι} {τ : ι → RootedHypergraph α β} + (hdec : IsRootedDecomposition P T τ) {f : ι} (hf : f ∈ T.edges) : + ∃ hcomp : IsComplemented P.G (GM04.cross τ (T.subtreeAt f) f), + complement P.G (GM04.cross τ (T.subtreeAt f) f) hcomp = + GM04.cross τ (T.rootSide f) T.root := by + have hsep := hdec.isTreeDecomposition.isSeparation_edge hf + exact ⟨isComplemented_of_isSeparation hsep, complement_eq_of_isSeparation hsep⟩ + +/-- **Graph Minors XVIII, (6.5.2)** (page 103): +"2. *If $f \in E(T)$ then $\tau \times (T, f)$ is complemented in $G$ and +$G \setminus \tau \times (T, f)$ is the rooted hypergraph $H$ with $H^- = (\tau \times T^f)^-$ and +$\bar{\pi}(H) = \emptyset$.*" -/ +theorem theorem_6_5_2 [Preorder Ω] {ι : Type*} {P : GM04.Patchwork Ω α β} + (hrootless : IsRootless P) + {T : GM04.RootedTree ι} {τ : ι → RootedHypergraph α β} + (hdec : IsRootedDecomposition P T τ) {f : ι} (hf : f ∈ T.edges) : + ∃ hcomp : IsComplemented P.G (rootedDecompRootSide hdec.isTreeDecomposition hf), + (complement P.G (rootedDecompRootSide hdec.isTreeDecomposition hf) hcomp).toHypergraph = + (GM04.cross τ (T.subtreeAt f) f).toHypergraph ∧ + (complement P.G (rootedDecompRootSide hdec.isTreeDecomposition hf) hcomp).rootSet = ∅ := by + have hsep_edge := hdec.isTreeDecomposition.isSeparation_edge hf + let G₀ := rootedDecompRootSide hdec.isTreeDecomposition hf + let H : RootedHypergraph α β := + { toHypergraph := (GM04.cross τ (T.subtreeAt f) f).toHypergraph + roots := P.G.roots + roots_nodup := P.G.roots_nodup + roots_subset := fun v hv ↦ by + have hv_set : v ∈ P.G.rootSet := hv + rw [hrootless] at hv_set + exact hv_set.elim } + have hsep_G₀ : P.G.IsSeparation G₀ H := + { isSeparation := hsep_edge.isSeparation.symm + roots_right := rfl + rootSet_left := by + change (GM04.cross τ (T.subtreeAt f) f).rootSet = + ((GM04.cross τ (T.rootSide f) T.root).toHypergraph ∩ + (GM04.cross τ (T.subtreeAt f) f).toHypergraph).vertexSet + rw [hsep_edge.rootSet_left] + exact Set.inter_comm _ _ } + refine ⟨isComplemented_of_isSeparation hsep_G₀, ?_, ?_⟩ + · rw [complement_eq_of_isSeparation hsep_G₀] + · rw [complement_eq_of_isSeparation hsep_G₀] + exact hrootless + +/-- **Graph Minors XVIII, (6.5), Claim (1)** (page 103): +"If $f \in E(T)$ has tail $t$ then $\tau \times T^f$ is complemented in $\tau \times T^t$, +and* $$ (\tau \times T^t \setminus \tau \times T^f)^- = (\tau \times T_f)^- \cap (\tau +\times T^t)^-." -/ +theorem lemma_6_5_claim_1 {ι : Type*} {G : RootedHypergraph α β} + {T : GM04.RootedTree ι} {τ : ι → RootedHypergraph α β} + (htd : GM04.IsTreeDecomposition G T τ) {f t : ι} (hf : f ∈ T.edges) (ht : t ∈ T.verts) + (hpar : T.parent f = t) : + ∃ hcomp : IsComplemented (GM04.cross τ (T.subtreeAt t) t) (GM04.cross τ (T.subtreeAt f) f), + (complement (GM04.cross τ (T.subtreeAt t) t) (GM04.cross τ (T.subtreeAt f) f) + hcomp).toHypergraph = + (GM04.cross τ (T.rootSide f) T.root).toHypergraph ∩ + (GM04.cross τ (T.subtreeAt t) t).toHypergraph := by + have hsep_edge := htd.isSeparation_edge hf + have hfv : f ∈ T.verts := T.edges_subset_verts hf + have htf : T.Reaches t f := hpar ▸ T.reaches_parent hfv + have hsub_ft : T.subtreeAt f ⊆ T.subtreeAt t := T.subtreeAt_mono htf + have hle_ft : (GM04.cross τ (T.subtreeAt f) f).toHypergraph ≤ + (GM04.cross τ (T.subtreeAt t) t).toHypergraph := + htd.cross_le_cross hsub_ft (T.subtreeAt_subset_verts t) + (T.self_mem_subtreeAt hfv) (T.self_mem_subtreeAt ht) + have ht_rootSide : t ∈ T.rootSide f := hpar ▸ T.parent_mem_rootSide hf + have hle_t_rootSide : (τ t).toHypergraph ≤ + (GM04.cross τ (T.rootSide f) T.root).toHypergraph := + htd.le_cross (T.rootSide_subset_verts f) (T.root_mem_rootSide hf) ht_rootSide + let B_H := (GM04.cross τ (T.rootSide f) T.root).toHypergraph ∩ + (GM04.cross τ (T.subtreeAt t) t).toHypergraph + have hB_le_t : B_H ≤ (GM04.cross τ (T.subtreeAt t) t).toHypergraph := + inter_le_right hsep_edge.isSeparation.right_le + (htd.cross_le (T.subtreeAt_subset_verts t) (T.self_mem_subtreeAt ht)) + have hroots_in_B : ∀ v ∈ (GM04.cross τ (T.subtreeAt t) t).roots, v ∈ B_H.vertexSet := by + intro v hv + have hv_t : v ∈ (τ t).vertexSet := (τ t).roots_subset v hv + refine ⟨hle_t_rootSide.vertexSet_subset hv_t, ?_⟩ + exact (htd.le_cross (T.subtreeAt_subset_verts t) (T.self_mem_subtreeAt ht) + (T.self_mem_subtreeAt ht)).vertexSet_subset hv_t + let B : RootedHypergraph α β := + { toHypergraph := B_H + roots := (GM04.cross τ (T.subtreeAt t) t).roots + roots_nodup := (GM04.cross τ (T.subtreeAt t) t).roots_nodup + roots_subset := hroots_in_B } + have hsep_t : (GM04.cross τ (T.subtreeAt t) t).IsSeparation + (GM04.cross τ (T.subtreeAt f) f) B := by + refine ⟨⟨hle_ft, hB_le_t, ?_, ?_⟩, rfl, ?_⟩ + · refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (union_le hle_ft hB_le_t) le_rfl ?_ ?_ + · ext v + simp only [B, B_H, union_vertexSet, inter_vertexSet, Set.mem_union, + Set.mem_inter_iff] + refine ⟨fun h ↦ h.elim (fun hv ↦ hle_ft.vertexSet_subset hv) And.right, fun hvt ↦ ?_⟩ + by_cases hvf : v ∈ (GM04.cross τ (T.subtreeAt f) f).vertexSet + · exact Or.inl hvf + · have hvG : v ∈ G.vertexSet := + (htd.cross_le (T.subtreeAt_subset_verts t) (T.self_mem_subtreeAt ht)).vertexSet_subset + hvt + rw [← hsep_edge.isSeparation.union_eq, union_vertexSet] at hvG + exact Or.inr ⟨hvG.resolve_left hvf, hvt⟩ + · ext e + simp only [B, B_H, union_edgeSet, inter_edgeSet, Set.mem_union, + Set.mem_inter_iff] + refine ⟨fun h ↦ h.elim (fun he ↦ hle_ft.edgeSet_subset he) And.right, fun het ↦ ?_⟩ + by_cases hef : e ∈ (GM04.cross τ (T.subtreeAt f) f).edgeSet + · exact Or.inl hef + · have heG : e ∈ G.edgeSet := + (htd.cross_le (T.subtreeAt_subset_verts t) (T.self_mem_subtreeAt ht)).edgeSet_subset het + rw [← hsep_edge.isSeparation.union_eq, union_edgeSet] at heG + exact Or.inr ⟨heG.resolve_left hef, het⟩ + · ext e + simp only [B, B_H, inter_edgeSet, Set.mem_inter_iff, Set.mem_empty_iff_false, + iff_false, not_and] + intro hef her _ + have he_inter : e ∈ ((GM04.cross τ (T.subtreeAt f) f).toHypergraph ∩ + (GM04.cross τ (T.rootSide f) T.root).toHypergraph).edgeSet := ⟨hef, her⟩ + rw [hsep_edge.isSeparation.edgeSet_inter_eq] at he_inter + exact he_inter + · rw [hsep_edge.rootSet_left] + ext v + simp only [B, B_H, inter_vertexSet, Set.mem_inter_iff] + exact ⟨fun ⟨hvf, hvr⟩ ↦ ⟨hvf, hvr, hle_ft.vertexSet_subset hvf⟩, + fun ⟨hvf, hvr, _⟩ ↦ ⟨hvf, hvr⟩⟩ + refine ⟨isComplemented_of_isSeparation hsep_t, ?_⟩ + rw [complement_eq_of_isSeparation hsep_t] + +/-- **Graph Minors XVIII, (6.5), Claim (2)** (pages 103–104): +"If distinct $f_1, f_2 \in E(T)$ have a common tail $t$, then $\tau \times T^{f_1} \subseteq +\tau \times T^t \setminus \tau \times T^{f_2}$." -/ +theorem lemma_6_5_claim_2 {ι : Type*} {G : RootedHypergraph α β} + {T : GM04.RootedTree ι} {τ : ι → RootedHypergraph α β} + (htd : GM04.IsTreeDecomposition G T τ) {f₁ f₂ t : ι} + (hf₁ : f₁ ∈ T.edges) (hf₂ : f₂ ∈ T.edges) (ht : t ∈ T.verts) + (hpar₁ : T.parent f₁ = t) (hpar₂ : T.parent f₂ = t) (hne : f₁ ≠ f₂) : + (GM04.cross τ (T.subtreeAt f₁) f₁).toHypergraph ≤ + (complement (GM04.cross τ (T.subtreeAt t) t) (GM04.cross τ (T.subtreeAt f₂) f₂) + (lemma_6_5_claim_1 htd hf₂ ht hpar₂).choose).toHypergraph := by + rw [(lemma_6_5_claim_1 htd hf₂ ht hpar₂).choose_spec] + have hf₁c : f₁ ∈ T.children t := T.mem_children_iff.2 ⟨hf₁, hpar₁⟩ + have hf₂c : f₂ ∈ T.children t := T.mem_children_iff.2 ⟨hf₂, hpar₂⟩ + have hdisj := T.disjoint_subtreeAt_of_mem_children hf₁c hf₂c hne + have hsub_root₂ : T.subtreeAt f₁ ⊆ T.rootSide f₂ := by + intro x hx + rw [T.mem_rootSide] + exact ⟨T.subtreeAt_subset_verts f₁ hx, + fun h₂ ↦ Finset.disjoint_left.1 hdisj hx (T.mem_subtreeAt.2 h₂)⟩ + have hsub_t : T.subtreeAt f₁ ⊆ T.subtreeAt t := + T.subtreeAt_mono (hpar₁ ▸ T.reaches_parent (T.edges_subset_verts hf₁)) + have hle_root₂ : (GM04.cross τ (T.subtreeAt f₁) f₁).toHypergraph ≤ + (GM04.cross τ (T.rootSide f₂) T.root).toHypergraph := + htd.cross_le_cross hsub_root₂ (T.rootSide_subset_verts f₂) + (T.self_mem_subtreeAt (T.edges_subset_verts hf₁)) (T.root_mem_rootSide hf₂) + have hle_t : (GM04.cross τ (T.subtreeAt f₁) f₁).toHypergraph ≤ + (GM04.cross τ (T.subtreeAt t) t).toHypergraph := + htd.cross_le_cross hsub_t (T.subtreeAt_subset_verts t) + (T.self_mem_subtreeAt (T.edges_subset_verts hf₁)) (T.self_mem_subtreeAt ht) + exact le_inter hle_root₂ hle_t + +/-- **Graph Minors XVIII, (6.5), Claim (3)** (page 104): +"(3) *If $f_0, f_1 \in E(T)$ and the head of $f_0$ equals the tail of $f_1$, let +$G_0 = \tau \times (T, f)$; then $\tau \times T^{f_1} \subseteq G \setminus G_0$ and +$G_0 \subseteq G \setminus \tau \times T^{f_1}$.*" +(Note: the paper writes $\tau \times (T, f)$ as a typo for $\tau \times (T, f_0)$.) -/ +theorem lemma_6_5_claim_3 [Preorder Ω] {ι : Type*} {P : GM04.Patchwork Ω α β} + (hrootless : IsRootless P) + {T : GM04.RootedTree ι} {τ : ι → RootedHypergraph α β} + (hdec : IsRootedDecomposition P T τ) {f₀ f₁ : ι} + (hf₀ : f₀ ∈ T.edges) (hf₁ : f₁ ∈ T.edges) (hpar : T.parent f₁ = f₀) : + (GM04.cross τ (T.subtreeAt f₁) f₁).toHypergraph ≤ + (complement P.G (rootedDecompRootSide hdec.isTreeDecomposition hf₀) + (theorem_6_5_2 hrootless hdec hf₀).choose).toHypergraph ∧ + (rootedDecompRootSide hdec.isTreeDecomposition hf₀).toHypergraph ≤ + (complement P.G (GM04.cross τ (T.subtreeAt f₁) f₁) + (theorem_6_5_1 hdec hf₁).choose).toHypergraph := by + have htd := hdec.isTreeDecomposition + have hf₀_f₁ : T.Reaches f₀ f₁ := hpar ▸ T.reaches_parent (T.edges_subset_verts hf₁) + refine ⟨?_, ?_⟩ + · rw [(theorem_6_5_2 hrootless hdec hf₀).choose_spec.1] + exact htd.cross_le_cross (T.subtreeAt_mono hf₀_f₁) (T.subtreeAt_subset_verts f₀) + (T.self_mem_subtreeAt (T.edges_subset_verts hf₁)) + (T.self_mem_subtreeAt (T.edges_subset_verts hf₀)) + · rw [(theorem_6_5_1 hdec hf₁).choose_spec] + change (GM04.cross τ (T.rootSide f₀) T.root).toHypergraph ≤ + (GM04.cross τ (T.rootSide f₁) T.root).toHypergraph + have hsub_root : T.rootSide f₀ ⊆ T.rootSide f₁ := by + intro x hx + rw [T.mem_rootSide] at hx ⊢ + exact ⟨hx.1, fun h₁ ↦ hx.2 (T.reaches_trans hf₀_f₁ h₁)⟩ + exact htd.cross_le_cross hsub_root (T.rootSide_subset_verts f₁) + (T.root_mem_rootSide hf₀) (T.root_mem_rootSide hf₁) + +/-- The core `M(G, ℒ)` of a rooted location `ℒ` in `G` is a subhypergraph of `G⁻`. -/ +theorem rootedLocationCore_le {G : RootedHypergraph α β} {ℒ : Set (RootedHypergraph α β)} + (hℒ : IsRootedLocation G ℒ) : + rootedLocationCore G ℒ ≤ G.toHypergraph := + locationCore_le hℒ.isLocation + +/-- For any vertex `t ∈ V(T)` in a rooted decomposition `(T, τ)`, the set of child subtrees +`ℒ = {τ × T^f : f ∈ T.children t}` is a rooted location in `τ × T^t`, with +`M(τ × T^t, ℒ) = τ(t)⁻`. -/ +theorem isRootedLocation_children {ι : Type*} {G : RootedHypergraph α β} + {T : GM04.RootedTree ι} {τ : ι → RootedHypergraph α β} + (htd : GM04.IsTreeDecomposition G T τ) {t : ι} (ht : t ∈ T.verts) : + let ℒ : Set (RootedHypergraph α β) := + {A | ∃ f ∈ T.children t, A = GM04.cross τ (T.subtreeAt f) f} + IsRootedLocation (GM04.cross τ (T.subtreeAt t) t) ℒ ∧ + rootedLocationCore (GM04.cross τ (T.subtreeAt t) t) ℒ = (τ t).toHypergraph := by + classical + intro ℒ + have hℒ_loc : IsRootedLocation (GM04.cross τ (T.subtreeAt t) t) ℒ := + { isComplemented := by + rintro _ ⟨f, hfc, rfl⟩ + obtain ⟨hfe, hpar⟩ := T.mem_children_iff.1 hfc + exact (lemma_6_5_claim_1 htd hfe ht hpar).choose + le_complement := by + rintro _ ⟨f₁, hf₁c, rfl⟩ _ ⟨f₂, hf₂c, rfl⟩ hne_A + have hne_f : f₁ ≠ f₂ := fun hEq ↦ hne_A (by subst hEq; rfl) + obtain ⟨hf₁e, hpar₁⟩ := T.mem_children_iff.1 hf₁c + obtain ⟨hf₂e, hpar₂⟩ := T.mem_children_iff.1 hf₂c + exact lemma_6_5_claim_2 htd hf₁e hf₂e ht hpar₁ hpar₂ hne_f } + refine ⟨hℒ_loc, ?_⟩ + have hle_t : (τ t).toHypergraph ≤ (GM04.cross τ (T.subtreeAt t) t).toHypergraph := + htd.le_cross (T.subtreeAt_subset_verts t) (T.self_mem_subtreeAt ht) (T.self_mem_subtreeAt ht) + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + ((rootedLocationCore_le hℒ_loc).trans + (htd.cross_le (T.subtreeAt_subset_verts t) (T.self_mem_subtreeAt ht))) + (htd.le t ht) ?_ ?_ + · ext v + rw [mem_rootedLocationCore_vertexSet_iff hℒ_loc] + constructor + · rintro ⟨hvt, hv_all⟩ + rw [GM04.cross_toHypergraph_of_mem τ (T.self_mem_subtreeAt ht), + biUnion_vertexSet, Set.mem_iUnion₂] at hvt + obtain ⟨u, hu, hvu⟩ := hvt + rcases (T.mem_subtreeAt_iff_eq_or_exists_children ht).1 hu with rfl | ⟨f, hfc, huf⟩ + · exact hvu + · obtain ⟨hfe, hpar⟩ := T.mem_children_iff.1 hfc + have hvf : v ∈ (GM04.cross τ (T.subtreeAt f) f).vertexSet := + (htd.le_cross (T.subtreeAt_subset_verts f) + (T.self_mem_subtreeAt (T.edges_subset_verts hfe)) huf).vertexSet_subset hvu + have hv_root := hv_all (GM04.cross τ (T.subtreeAt f) f) ⟨f, hfc, rfl⟩ hvf + rw [(htd.isSeparation_edge hfe).rootSet_left, htd.subtreeAt_inter_rootSide_eq hfe, + hpar] at hv_root + exact hv_root.2 + · intro hvt + refine ⟨hle_t.vertexSet_subset hvt, ?_⟩ + rintro _ ⟨f, hfc, rfl⟩ hvf + obtain ⟨hfe, hpar⟩ := T.mem_children_iff.1 hfc + rw [(htd.isSeparation_edge hfe).rootSet_left, htd.subtreeAt_inter_rootSide_eq hfe, hpar] + have ht_root : t ∈ T.rootSide f := hpar ▸ T.parent_mem_rootSide hfe + have hv_inter : v ∈ ((GM04.cross τ (T.subtreeAt f) f).toHypergraph ∩ + (GM04.cross τ (T.rootSide f) T.root).toHypergraph).vertexSet := + ⟨hvf, (htd.le_cross (T.rootSide_subset_verts f) (T.root_mem_rootSide hfe) + ht_root).vertexSet_subset hvt⟩ + rwa [htd.subtreeAt_inter_rootSide_eq hfe, hpar] at hv_inter + · ext e + rw [mem_rootedLocationCore_edgeSet_iff] + constructor + · rintro ⟨het, he_all⟩ + rw [GM04.cross_toHypergraph_of_mem τ (T.self_mem_subtreeAt ht), + biUnion_edgeSet, Set.mem_iUnion₂] at het + obtain ⟨u, hu, heu⟩ := het + rcases (T.mem_subtreeAt_iff_eq_or_exists_children ht).1 hu with rfl | ⟨f, hfc, huf⟩ + · exact heu + · obtain ⟨hfe, _⟩ := T.mem_children_iff.1 hfc + have hef : e ∈ (GM04.cross τ (T.subtreeAt f) f).edgeSet := + (htd.le_cross (T.subtreeAt_subset_verts f) + (T.self_mem_subtreeAt (T.edges_subset_verts hfe)) huf).edgeSet_subset heu + exact (he_all (GM04.cross τ (T.subtreeAt f) f) ⟨f, hfc, rfl⟩ hef).elim + · intro het + refine ⟨hle_t.edgeSet_subset het, ?_⟩ + rintro _ ⟨f, hfc, rfl⟩ hef + obtain ⟨hfe, hpar⟩ := T.mem_children_iff.1 hfc + have ht_root : t ∈ T.rootSide f := hpar ▸ T.parent_mem_rootSide hfe + have her : e ∈ (GM04.cross τ (T.rootSide f) T.root).edgeSet := + (htd.le_cross (T.rootSide_subset_verts f) (T.root_mem_rootSide hfe) ht_root).edgeSet_subset + het + have he_inter : e ∈ ((GM04.cross τ (T.subtreeAt f) f).toHypergraph ∩ + (GM04.cross τ (T.rootSide f) T.root).toHypergraph).edgeSet := ⟨hef, her⟩ + rw [(htd.isSeparation_edge hfe).isSeparation.edgeSet_inter_eq] at he_inter + exact he_inter + +/-- **Graph Minors XVIII, (6.5.3)** (page 103): +"If $f_0 \in E(T)$ has head $t$ and $f_1, \dots, f_n$ are the edges of $T$ with tail $t$, +then* $$ \mathcal{L} = \{\tau \times T^{f_1}, \dots, \tau \times T^{f_n}\} $$ *is a rooted +location in $\tau \times T^t$ and $\mathcal{L}^* = \mathcal{L} \cup \{\tau \times (T, +f_0)\}$ is a rooted location in $G$ and $M(\tau \times T^t, \mathcal{L}) = M(G, +\mathcal{L}^*)$." +(In `GM04.RootedTree`, an edge `f₀ ∈ T.edges` has head `f₀`.) -/ +theorem theorem_6_5_3 [Preorder Ω] {ι : Type*} {P : GM04.Patchwork Ω α β} + (hrootless : IsRootless P) + {T : GM04.RootedTree ι} {τ : ι → RootedHypergraph α β} + (hdec : IsRootedDecomposition P T τ) {f₀ : ι} (hf₀ : f₀ ∈ T.edges) : + let ℒ : Set (RootedHypergraph α β) := + {A | ∃ f ∈ T.children f₀, A = GM04.cross τ (T.subtreeAt f) f} + let ℒ_star : Set (RootedHypergraph α β) := + insert (rootedDecompRootSide hdec.isTreeDecomposition hf₀) ℒ + IsRootedLocation (GM04.cross τ (T.subtreeAt f₀) f₀) ℒ ∧ + IsRootedLocation P.G ℒ_star ∧ + rootedLocationCore (GM04.cross τ (T.subtreeAt f₀) f₀) ℒ = + rootedLocationCore P.G ℒ_star := by + classical + intro ℒ ℒ_star + have htd := hdec.isTreeDecomposition + have hf₀v : f₀ ∈ T.verts := T.edges_subset_verts hf₀ + obtain ⟨hℒ_loc, _⟩ := isRootedLocation_children htd hf₀v + have hℒ_star_loc : IsRootedLocation P.G ℒ_star := + { isComplemented := by + rintro A (rfl | ⟨f, hfc, rfl⟩) + · exact (theorem_6_5_2 hrootless hdec hf₀).choose + · exact (theorem_6_5_1 hdec (T.children_subset_edges f₀ hfc)).choose + le_complement := by + rintro A₁ (rfl | ⟨f₁, hf₁c, rfl⟩) A₂ (rfl | ⟨f₂, hf₂c, rfl⟩) hne + · exact (hne rfl).elim + · obtain ⟨hf₂e, hpar₂⟩ := T.mem_children_iff.1 hf₂c + exact (lemma_6_5_claim_3 hrootless hdec hf₀ hf₂e hpar₂).2 + · obtain ⟨hf₁e, hpar₁⟩ := T.mem_children_iff.1 hf₁c + exact (lemma_6_5_claim_3 hrootless hdec hf₀ hf₁e hpar₁).1 + · obtain ⟨hf₁e, _⟩ := T.mem_children_iff.1 hf₁c + obtain ⟨hf₂e, _⟩ := T.mem_children_iff.1 hf₂c + have hne_f : f₁ ≠ f₂ := fun hEq ↦ hne (by subst hEq; rfl) + rw [(theorem_6_5_1 hdec hf₂e).choose_spec] + have hdisj := T.disjoint_subtreeAt_of_mem_children hf₁c hf₂c hne_f + have hsub_root₂ : T.subtreeAt f₁ ⊆ T.rootSide f₂ := by + intro x hx + rw [T.mem_rootSide] + exact ⟨T.subtreeAt_subset_verts f₁ hx, + fun h₂ ↦ Finset.disjoint_left.1 hdisj hx (T.mem_subtreeAt.2 h₂)⟩ + exact htd.cross_le_cross hsub_root₂ (T.rootSide_subset_verts f₂) + (T.self_mem_subtreeAt (T.edges_subset_verts hf₁e)) (T.root_mem_rootSide hf₂e) } + refine ⟨hℒ_loc, hℒ_star_loc, ?_⟩ + have hsep₀ := htd.isSeparation_edge hf₀ + refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + ((rootedLocationCore_le hℒ_loc).trans + (htd.cross_le (T.subtreeAt_subset_verts f₀) (T.self_mem_subtreeAt hf₀v))) + (rootedLocationCore_le hℒ_star_loc) ?_ ?_ + · ext v + rw [mem_rootedLocationCore_vertexSet_iff hℒ_loc, + mem_rootedLocationCore_vertexSet_iff hℒ_star_loc] + constructor + · rintro ⟨hvf₀, hv_all⟩ + refine ⟨hsep₀.isSeparation.left_le.vertexSet_subset hvf₀, ?_⟩ + rintro A (rfl | hA) hvA + · change v ∈ (GM04.cross τ (T.subtreeAt f₀) f₀).rootSet + rw [hsep₀.rootSet_left] + exact ⟨hvf₀, hvA⟩ + · exact hv_all A hA hvA + · rintro ⟨hvG, hv_all⟩ + refine ⟨?_, fun A hA hvA ↦ hv_all A (Or.inr hA) hvA⟩ + rw [← hsep₀.isSeparation.union_eq, union_vertexSet] at hvG + rcases hvG with hvf₀ | hv_root + · exact hvf₀ + · have h := hv_all (rootedDecompRootSide htd hf₀) (Or.inl rfl) hv_root + exact (GM04.cross τ (T.subtreeAt f₀) f₀).roots_subset v h + · ext e + rw [mem_rootedLocationCore_edgeSet_iff, mem_rootedLocationCore_edgeSet_iff] + constructor + · rintro ⟨hef₀, he_all⟩ + refine ⟨hsep₀.isSeparation.left_le.edgeSet_subset hef₀, ?_⟩ + rintro A (rfl | hA) heA + · have he_inter : e ∈ ((GM04.cross τ (T.subtreeAt f₀) f₀).toHypergraph ∩ + (GM04.cross τ (T.rootSide f₀) T.root).toHypergraph).edgeSet := ⟨hef₀, heA⟩ + rw [hsep₀.isSeparation.edgeSet_inter_eq] at he_inter + exact he_inter + · exact he_all A hA heA + · rintro ⟨heG, he_all⟩ + refine ⟨?_, fun A hA ↦ he_all A (Or.inr hA)⟩ + rw [← hsep₀.isSeparation.union_eq, union_edgeSet] at heG + exact heG.resolve_right (he_all (rootedDecompRootSide htd hf₀) (Or.inl rfl)) + +/-- **Graph Minors XVIII, (6.5)** (combined statement, page 103). -/ +theorem theorem_6_5_proof [Preorder Ω] {ι : Type*} {P : GM04.Patchwork Ω α β} + (hrootless : IsRootless P) + {T : GM04.RootedTree ι} {τ : ι → RootedHypergraph α β} + (hdec : IsRootedDecomposition P T τ) {f : ι} (hf : f ∈ T.edges) : + (∃ hcomp : IsComplemented P.G (GM04.cross τ (T.subtreeAt f) f), + complement P.G (GM04.cross τ (T.subtreeAt f) f) hcomp = + GM04.cross τ (T.rootSide f) T.root) ∧ + (∃ hcomp : IsComplemented P.G (rootedDecompRootSide hdec.isTreeDecomposition hf), + (complement P.G (rootedDecompRootSide hdec.isTreeDecomposition hf) hcomp).toHypergraph = + (GM04.cross τ (T.subtreeAt f) f).toHypergraph ∧ + (complement P.G (rootedDecompRootSide hdec.isTreeDecomposition hf) hcomp).rootSet = ∅) ∧ + (let ℒ : Set (RootedHypergraph α β) := + {A | ∃ g ∈ T.children f, A = GM04.cross τ (T.subtreeAt g) g} + let ℒ_star : Set (RootedHypergraph α β) := + insert (rootedDecompRootSide hdec.isTreeDecomposition hf) ℒ + IsRootedLocation (GM04.cross τ (T.subtreeAt f) f) ℒ ∧ + IsRootedLocation P.G ℒ_star ∧ + rootedLocationCore (GM04.cross τ (T.subtreeAt f) f) ℒ = + rootedLocationCore P.G ℒ_star) := + ⟨theorem_6_5_1 hdec hf, theorem_6_5_2 hrootless hdec hf, theorem_6_5_3 hrootless hdec hf⟩ + +end GraphMinor.GM18 +end diff --git a/LeanPool/GraphMinor/GM18/Section6Part2.lean b/LeanPool/GraphMinor/GM18/Section6Part2.lean new file mode 100644 index 0000000000..03c88940b0 --- /dev/null +++ b/LeanPool/GraphMinor/GM18/Section6Part2.lean @@ -0,0 +1,932 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM18.Section6Part1 + +/-! +# Graph Minors XVIII, Section 6 (Part 2): Well-Quasi-Ordering of Rootless Patchworks (6.6) + +This file formalizes (6.6) (pages 104–106) of Robertson and Seymour, +*Graph Minors. XVIII. Tree-decompositions and well-quasi-ordering*, J. Combin. Theory Ser. B 89 +(2003), 77–108, together with its two claims `lemma_6_6_claim_1` and `lemma_6_6_claim_2`: + +- `lemma_6_6_claim_1` (Claim (1), page 105): for every `t ∈ V(T)` in a rooted decomposition `(T, τ)` + of `P` whose underlying tree-decomposition `(S, σ)` is proper and whose pieces all belong to `𝒞`, + the subtree patchwork `P | (τ × T^t)` belongs to `enlargementClass (rootingClosure 𝒞) 𝒞_t`. +- `lemma_6_6_claim_2` (Claim (2), page 105): if the subtree patchworks at the out-neighbours of `X` + are well-quasi-ordered by simulation, then so are the subtree patchworks at `X`. +- `sigmaTree`: the arborescences `Tᵢ` side by side in `Σ k, ι k`, as the tree `M` of the paper. + +The rest of the proof of (6.6), through Graph Minors IV, (3.3), is in `Section6Stars.lean`. +-/ + +public section + +namespace GraphMinor.GM18 + +open SimpleGraph Hypergraph + +universe u v w + +variable {α : Type u} {β : Type v} {Ω : Type w} + +/-! ## Rooting closure, existence of fresh hearts, and bounded root lengths -/ + +/-- The union `𝒞* = 𝒞 ∪ 𝒞'` of a class `𝒞` of partial `Ω`-patchworks with the class `𝒞'` of all +rootings of rootless members of `𝒞` (Graph Minors XVIII, proof of (6.6), page 105). -/ +@[expose] def rootingClosure (𝒞 : Set (PartialPatchwork Ω α β)) : Set (PartialPatchwork Ω α β) := + 𝒞 ∪ {P' : PartialPatchwork Ω α β | ∃ P ∈ 𝒞, IsRooting P P'} + +/-- If `𝒞` is well-behaved, then `rootingClosure 𝒞` is well-behaved (by (6.1), page 105). -/ +theorem wellBehaved_rootingClosure [Preorder Ω] {𝒞 : Set (PartialPatchwork Ω α β)} + (h𝒞 : WellBehaved 𝒞) : WellBehaved (rootingClosure 𝒞) := + h𝒞.union (theorem_6_1_proof h𝒞) + +/-- When `β` is infinite, every rooted location `ℒ` in `P.G` has a fresh edge assignment +`newEdge : RootedHypergraph α β → β` injective on `ℒ` with `newEdge A ∉ P.G.edgeSet` for all +`A ∈ ℒ`, and hence a heart `Q` satisfying `IsPlaceHeart P ℒ newEdge Q`. -/ +theorem exists_fresh_isPlaceHeart [Infinite β] (P : PartialPatchwork Ω α β) + {ℒ : Set (RootedHypergraph α β)} (hℒ : IsRootedLocation P.G ℒ) : + ∃ (newEdge : RootedHypergraph α β → β) (Q : PartialPatchwork Ω α β), + IsPlaceHeart P ℒ newEdge Q ∧ ∀ ⦃A⦄, A ∈ ℒ → newEdge A ∉ P.G.edgeSet := by + classical + have hcompl_inf : ((P.G.edgeSet)ᶜ : Set β).Infinite := by + rw [Set.compl_eq_univ_sdiff] + exact Set.infinite_univ.sdiff P.G.edgeSet_finite + let _ : Infinite ((P.G.edgeSet)ᶜ : Set β) := hcompl_inf.to_subtype + let _ : Fintype ℒ := hℒ.finite.fintype + let eℒ : ℒ ≃ Fin (Fintype.card ℒ) := Fintype.equivFin ℒ + let emb : ℕ ↪ ((P.G.edgeSet)ᶜ : Set β) := Infinite.natEmbedding ((P.G.edgeSet)ᶜ : Set β) + let d₀ : β := (emb 0).1 + let newEdge : RootedHypergraph α β → β := fun A ↦ + if hA : A ∈ ℒ then (emb (eℒ ⟨A, hA⟩).1).1 else d₀ + have hinj : Set.InjOn newEdge ℒ := by + intro A₁ hA₁ A₂ hA₂ hEq + dsimp only [newEdge] at hEq + rw [dite_eq_left hA₁, dite_eq_left hA₂] at hEq + have hemb_eq : emb (eℒ ⟨A₁, hA₁⟩).1 = emb (eℒ ⟨A₂, hA₂⟩).1 := Subtype.ext hEq + have hfin_eq : eℒ ⟨A₁, hA₁⟩ = eℒ ⟨A₂, hA₂⟩ := Fin.ext (emb.injective hemb_eq) + exact congrArg Subtype.val (eℒ.injective hfin_eq) + have hfresh : ∀ ⦃A⦄, A ∈ ℒ → newEdge A ∉ P.G.edgeSet := by + intro A hA + dsimp only [newEdge] + rw [dite_eq_left hA] + exact (emb (eℒ ⟨A, hA⟩).1).2 + have hnotMem : ∀ ⦃A⦄, A ∈ ℒ → newEdge A ∉ (rootedLocationCore P.G ℒ).edgeSet := + fun _ hA hc ↦ hfresh hA (mem_rootedLocationCore_edgeSet_iff.1 hc).1 + exact ⟨newEdge, mkPlaceHeart P hℒ newEdge hinj hnotMem, + isPlaceHeart_mkPlaceHeart P hℒ newEdge hinj hnotMem, hfresh⟩ + +/-- In any well-behaved class `𝒞*` of partial `Ω`-patchworks (where `Ω` is well-quasi-ordered), +there is an integer `k ≥ 0` such that `|πBar(P)| ≤ k` for all `P ∈ 𝒞*` +(Graph Minors XVIII, proof of (6.6), page 106: "since $\mathscr{C}$ is well-behaved, there exists +$k \ge 0$ such that $|\bar{\pi}(G)| \le k$ for every $(G, \mu, \Delta, \phi) \in \mathscr{C}$", +applied to `𝒞* = rootingClosure 𝒞`). -/ +theorem WellBehaved.exists_roots_length_le [Preorder Ω] (hΩ : WellQuasiOrderedLE Ω) + {𝒞_star : Set (PartialPatchwork Ω α β)} (h𝒞_star : WellBehaved 𝒞_star) : + ∃ k : ℕ, ∀ P ∈ 𝒞_star, P.G.roots.length ≤ k := by + classical + by_contra! h_unbdd + choose P_of hP_of_mem hP_of_gt using h_unbdd + let idx_P : ℕ → PartialPatchwork Ω α β := + fun m ↦ Nat.rec (P_of 0) (fun _ prev ↦ P_of prev.G.roots.length) m + have hidx_mem : ∀ m, idx_P m ∈ 𝒞_star := by + intro m + cases m with + | zero => exact hP_of_mem 0 + | succ n => exact hP_of_mem (idx_P n).G.roots.length + have hidx_strictMono : StrictMono (fun m ↦ (idx_P m).G.roots.length) := + strictMono_nat_of_lt_succ fun m ↦ hP_of_gt (idx_P m).G.roots.length + let UnitType := PUnit.{max w (max u v) + 1} + have hUnit_wqo : WellQuasiOrderedLE UnitType := Finite.to_wellQuasiOrderedLE + let Ω' : Type (max w (max u v)) := DisjointUnionQuasiOrder Ω UnitType + have hΩ'_wqo : WellQuasiOrderedLE Ω' := wellQuasiOrderedLE_disjointUnion hΩ hUnit_wqo + let ι : Ω ↪o Ω' := DisjointUnionQuasiOrder.inlEmb Ω UnitType + let Q : ℕ → GM04.Patchwork Ω' α β := fun m ↦ + { G := (idx_P m).G + dom := (idx_P m).dom + μ := (idx_P m).μ + Δ := (idx_P m).Δ + φ := fun e ↦ + match (idx_P m).φ e with + | (ω : Ω) => Sum.inl ω + | ⊥ => Sum.inr PUnit.unit + dom_subset := (idx_P m).dom_subset + μ_nodup := (idx_P m).μ_nodup + μ_set := (idx_P m).μ_set + Δ_verts := (idx_P m).Δ_verts + Δ_free := (idx_P m).Δ_free } + have hQ_comp : ∀ m, ∃ P ∈ 𝒞_star, IsCompletion ι P (Q m) := by + intro m + refine ⟨idx_P m, hidx_mem m, ⟨rfl, rfl, fun _ _ ↦ rfl, fun _ _ ↦ rfl, ?_⟩⟩ + intro e _ ω hφ + change (match (idx_P m).φ e with | (ω' : Ω) => Sum.inl ω' | ⊥ => Sum.inr PUnit.unit) = Sum.inl ω + rw [hφ] + obtain ⟨i, j, hij, _, _, hexp, _⟩ := h𝒞_star Ω' ι hΩ'_wqo Q hQ_comp + have hlen_eq : (idx_P i).G.roots.length = (idx_P j).G.roots.length := hexp.roots_length + exact ne_of_lt (hidx_strictMono hij) hlen_eq + +/-! ## Claim (1) of (6.6): Subtree patchworks as enlargements -/ + +/-- Restricting `toPartialPatchwork P` to `G'` is definitionally `toPartialPatchwork (P.restrict +G')`. -/ +theorem toPartialPatchwork_restrict (P : GM04.Patchwork Ω α β) (G' : RootedHypergraph α β) : + (toPartialPatchwork P).restrict G' = toPartialPatchwork (P.restrict G') := rfl + +/-- If `G₁ ≤ G₂ ≤ P.G`, then `(P.restrict G₂).restrict G₁` is equivalent (`PatchworkEquiv`) to +`P.restrict G₁`. -/ +theorem Patchwork.restrict_restrict_equiv {P : GM04.Patchwork Ω α β} + {G₁ G₂ : RootedHypergraph α β} + (h₂ : G₂.toHypergraph ≤ P.G.toHypergraph) + (h₁ : G₁.toHypergraph ≤ G₂.toHypergraph) : + PatchworkEquiv ((P.restrict G₂).restrict G₁) (P.restrict G₁) where + G_eq := rfl + dom_eq := by + rw [(P.restrict G₂).restrict_dom h₁, P.restrict_dom h₂, P.restrict_dom (h₁.trans h₂), + Set.inter_assoc, Set.inter_eq_right.mpr h₁.edgeSet_subset] + μ_eq _ _ := rfl + Δ_eq e he := by + rw [(P.restrict G₂).restrict_Δ h₁ he, P.restrict_Δ h₂ (h₁.edgeSet_subset he), + P.restrict_Δ (h₁.trans h₂) he] + φ_eq _ _ := rfl + +/-- Closure of a class `𝒞` of partial `Ω`-patchworks under `PatchworkEquiv`. -/ +@[expose] def equivClosure (𝒞 : Set (PartialPatchwork Ω α β)) : Set (PartialPatchwork Ω α β) := + {Q | ∃ P ∈ 𝒞, PatchworkEquiv Q P} + +theorem IsCompletion.congr_left {Ω' : Type*} [Preorder Ω] [Preorder Ω'] + {ι : Ω ↪o Ω'} {P₁ P₂ : PartialPatchwork Ω α β} {Q : GM04.Patchwork Ω' α β} + (hP : PatchworkEquiv P₁ P₂) (h : IsCompletion ι P₁ Q) : + IsCompletion ι P₂ Q where + G_eq := h.G_eq.trans hP.G_eq + dom_eq := h.dom_eq.trans hP.dom_eq + μ_eq _ he := (h.μ_eq (hP.dom_eq.symm ▸ he)).trans (hP.μ_eq (hP.dom_eq.symm ▸ he)) + Δ_eq _ he := (h.Δ_eq (hP.G_eq.symm ▸ he)).trans (hP.Δ_eq (hP.G_eq.symm ▸ he)) + φ_eq _ he _ hω := h.φ_eq (hP.G_eq.symm ▸ he) ((hP.φ_eq (hP.G_eq.symm ▸ he)).trans hω) + +theorem wellBehaved_equivClosure [Preorder Ω] {𝒞 : Set (PartialPatchwork Ω α β)} + (h𝒞 : WellBehaved 𝒞) : WellBehaved (equivClosure 𝒞) := by + intro Ω' _ ι hΩ' Q hQ + refine h𝒞 Ω' ι hΩ' Q fun i ↦ ?_ + obtain ⟨P', ⟨P, hP_mem, hP_equiv⟩, hcomp⟩ := hQ i + exact ⟨P, hP_mem, hcomp.congr_left hP_equiv⟩ + +/-- If `P₁` and `P₂` are equivalent (`PatchworkEquiv P₁ P₂`) and `IsPlaceHeart P₁ ℒ newEdge Q`, +then `IsPlaceHeart P₂ ℒ newEdge Q`. -/ +theorem IsPlaceHeart.congr_left {P₁ P₂ Q : PartialPatchwork Ω α β} + {ℒ : Set (RootedHypergraph α β)} {newEdge : RootedHypergraph α β → β} + (hP : PatchworkEquiv P₁ P₂) (hQ : IsPlaceHeart P₁ ℒ newEdge Q) : + IsPlaceHeart P₂ ℒ newEdge Q where + isRootedLocation := hP.G_eq ▸ hQ.isRootedLocation + injOn_newEdge := hQ.injOn_newEdge + newEdge_notMem_core := hP.G_eq ▸ hQ.newEdge_notMem_core + vertexSet_eq := hP.G_eq ▸ hQ.vertexSet_eq + edgeSet_eq := hP.G_eq ▸ hQ.edgeSet_eq + roots_eq := hP.G_eq ▸ hQ.roots_eq + ends_core := hP.G_eq ▸ hQ.ends_core + ends_newEdge := hQ.ends_newEdge + dom_eq := by + rw [← hP.G_eq, ← hP.dom_eq] + exact hQ.dom_eq + μ_core f hf := by + rw [← hP.G_eq, ← hP.dom_eq] at hf + rw [hQ.μ_core hf, hP.μ_eq hf.2] + μ_newEdge := hQ.μ_newEdge + Δ_core f hf := by + rw [← hP.G_eq] at hf + have hfE : f ∈ P₁.G.edgeSet := (mem_rootedLocationCore_edgeSet_iff.1 hf).1 + rw [hQ.Δ_core hf, hP.Δ_eq hfE] + Δ_newEdge A hA := by + rw [hQ.Δ_newEdge hA] + have hle₁ : A.toHypergraph ≤ P₁.G.toHypergraph := (hQ.isRootedLocation.isComplemented hA).le + have hle₂ : A.toHypergraph ≤ P₂.G.toHypergraph := hP.G_eq ▸ hle₁ + have hfg : PatchworkEquiv (P₁.restrict A) (P₂.restrict A) := + { G_eq := rfl + dom_eq := by rw [P₁.restrict_dom hle₁, P₂.restrict_dom hle₂, hP.dom_eq] + μ_eq := fun e he ↦ by + rw [P₁.restrict_dom hle₁] at he + exact hP.μ_eq he.1 + Δ_eq := fun e he ↦ by + rw [P₁.restrict_Δ hle₁ he, P₂.restrict_Δ hle₂ he] + exact hP.Δ_eq (hle₁.edgeSet_subset he) + φ_eq := fun e he ↦ hP.φ_eq (hle₁.edgeSet_subset he) } + exact hfg.feasibleGroupings_eq + φ_core f hf := by + rw [← hP.G_eq] at hf + have hfE : f ∈ P₁.G.edgeSet := (mem_rootedLocationCore_edgeSet_iff.1 hf).1 + rw [hQ.φ_core hf, hP.φ_eq hfE] + φ_newEdge := hQ.φ_newEdge + +/-- `P.restrict P.G` is equivalent (`PatchworkEquiv`) to `P`. -/ +theorem patchworkEquiv_restrict_self (P : GM04.Patchwork Ω α β) : + PatchworkEquiv (P.restrict P.G) P where + G_eq := rfl + dom_eq := by rw [P.restrict_dom le_rfl, Set.inter_eq_left.mpr P.dom_subset] + μ_eq _ _ := rfl + Δ_eq _ he := P.restrict_Δ le_rfl he + φ_eq _ _ := rfl + +/-- In an arborescence `T` with `T.verts = Finset.univ` and `S = arborescenceUnderlying T`, where +`(T, τ)` is a `GM04.IsTreeDecomposition` of `G` and `σ t = (τ t).toHypergraph`, for every +`g ∈ T.edges`, `(GM04.cross τ (T.subtreeAt g) g).toHypergraph = GM10.treeDecompSide S σ s(g, +T.parent g) g` +and `(GM04.cross τ (T.rootSide g) T.root).toHypergraph = GM10.treeDecompSide S σ s(g, T.parent g) +(T.parent g)`. -/ +private theorem cross_subtreeAt_and_rootSide_eq_treeDecompSide {ι : Type*} [Fintype ι] + {G : RootedHypergraph α β} {T : GM04.RootedTree ι} {τ : ι → RootedHypergraph α β} + (htd : GM04.IsTreeDecomposition G T τ) (hT_verts : T.verts = Finset.univ) + {S : SimpleGraph ι} {σ : ι → Hypergraph α β} + (hT_S : arborescenceUnderlying T = S) (hσ : ∀ t, (τ t).toHypergraph = σ t) + {g : ι} (hg : g ∈ T.edges) : + (GM04.cross τ (T.subtreeAt g) g).toHypergraph = + GM10.treeDecompSide S σ s(g, T.parent g) g ∧ + (GM04.cross τ (T.rootSide g) T.root).toHypergraph = + GM10.treeDecompSide S σ s(g, T.parent g) (T.parent g) := by + classical + have hg_sub : g ∈ T.subtreeAt g := T.self_mem_subtreeAt (hT_verts ▸ Finset.mem_univ g) + have hroot_mem : T.root ∈ T.rootSide g := T.root_mem_rootSide hg + have hreach_sub : ∀ t : ι, + (S.deleteEdges {s(g, T.parent g)}).Reachable g t ↔ t ∈ T.subtreeAt g := by + intro t + rw [← hT_S] + exact reachable_deleteEdges_arborescenceUnderlying_iff T hT_verts hg t + have hreach_rootSide : ∀ t : ι, + (S.deleteEdges {s(g, T.parent g)}).Reachable (T.parent g) t ↔ t ∈ T.rootSide g := by + intro t + rw [← hT_S] + exact reachable_parent_deleteEdges_arborescenceUnderlying_iff T hT_verts hg t + have hle_σ : ∀ t : ι, σ t ≤ G.toHypergraph := + fun t ↦ hσ t ▸ htd.le t (hT_verts ▸ Finset.mem_univ t) + refine ⟨?_, ?_⟩ + · refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (htd.cross_le (T.subtreeAt_subset_verts g) hg_sub) + (biUnion_le fun t _ ↦ hle_σ t) ?_ ?_ + · rw [GM04.cross_toHypergraph_of_mem τ hg_sub] + ext v + simp only [GM10.treeDecompSide, biUnion_vertexSet, Set.mem_iUnion, Finset.mem_filter, + Finset.mem_univ, true_and, hreach_sub, hσ] + · rw [GM04.cross_toHypergraph_of_mem τ hg_sub] + ext e + simp only [GM10.treeDecompSide, biUnion_edgeSet, Set.mem_iUnion, Finset.mem_filter, + Finset.mem_univ, true_and, hreach_sub, hσ] + · refine GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (htd.cross_le (T.rootSide_subset_verts g) hroot_mem) + (biUnion_le fun t _ ↦ hle_σ t) ?_ ?_ + · rw [GM04.cross_toHypergraph_of_mem τ hroot_mem] + ext v + simp only [GM10.treeDecompSide, biUnion_vertexSet, Set.mem_iUnion, Finset.mem_filter, + Finset.mem_univ, true_and, hreach_rootSide, hσ] + · rw [GM04.cross_toHypergraph_of_mem τ hroot_mem] + ext e + simp only [GM10.treeDecompSide, biUnion_edgeSet, Set.mem_iUnion, Finset.mem_filter, + Finset.mem_univ, true_and, hreach_rootSide, hσ] + +/-- Every edge `x` of `S = arborescenceUnderlying T` (where `T.verts = Finset.univ`) incident with +`t` +is either `s(y, t)` for some `y ∈ T.children t` or (when `t ≠ T.root`) `s(t, T.parent t)`. -/ +private theorem vertexLocation_eq_children_or_parent {ι : Type*} [Fintype ι] [Preorder Ω] + {P : GM04.Patchwork Ω α β} (hrootless : IsRootless P) + {T : GM04.RootedTree ι} {τ : ι → RootedHypergraph α β} + (hdec : IsRootedDecomposition P T τ) (hT_verts : T.verts = Finset.univ) + {S : SimpleGraph ι} {σ : ι → Hypergraph α β} + (hT_S : arborescenceUnderlying T = S) (hσ : ∀ u, (τ u).toHypergraph = σ u) (t : ι) : + let ℒ : Set (RootedHypergraph α β) := + {A | ∃ y ∈ T.children t, A = GM04.cross τ (T.subtreeAt y) y} + ((∀ ht : t ∈ T.edges, + rootedLocationToLocation P.G + (insert (rootedDecompRootSide hdec.isTreeDecomposition ht) ℒ) = + vertexLocation S σ t) ∧ + (t ∉ T.edges → + rootedLocationToLocation P.G ℒ = vertexLocation S σ t)) := by + classical + intro ℒ + have hℒ_toLoc : ∀ y ∈ T.children t, + let A := GM04.cross τ (T.subtreeAt y) y + (A.toHypergraph, complementHypergraph P.G A) = + (GM10.treeDecompSide S σ s(y, t) y, GM10.treeDecompSide S σ s(y, t) t) := by + intro y hy A + obtain ⟨hye, hpar_y⟩ := T.mem_children_iff.1 hy + obtain ⟨hcomp_y, hcomp_y_eq⟩ := theorem_6_5_1 hdec hye + have ⟨hsub_y, hroot_y⟩ := + cross_subtreeAt_and_rootSide_eq_treeDecompSide hdec.isTreeDecomposition hT_verts hT_S hσ hye + rw [complementHypergraph_eq_of_isComplemented hcomp_y, hcomp_y_eq, hsub_y, hroot_y, hpar_y] + refine ⟨fun ht ↦ ?_, fun ht ↦ ?_⟩ + · let G₀ := rootedDecompRootSide hdec.isTreeDecomposition ht + have hG₀_toLoc : (G₀.toHypergraph, complementHypergraph P.G G₀) = + (GM10.treeDecompSide S σ s(T.parent t, t) (T.parent t), + GM10.treeDecompSide S σ s(T.parent t, t) t) := by + obtain ⟨hcomp_t, hcomp_t_eq, _⟩ := theorem_6_5_2 hrootless hdec ht + have ⟨hsub_t, hroot_t⟩ := + cross_subtreeAt_and_rootSide_eq_treeDecompSide hdec.isTreeDecomposition hT_verts hT_S hσ ht + rw [complementHypergraph_eq_of_isComplemented hcomp_t, hcomp_t_eq] + change ((GM04.cross τ (T.rootSide t) T.root).toHypergraph, + (GM04.cross τ (T.subtreeAt t) t).toHypergraph) = _ + rw [hsub_t, hroot_t, Sym2.eq_swap] + ext p + simp only [rootedLocationToLocation, Set.mem_image, Set.mem_insert_iff, vertexLocation, + Set.mem_ofPred_eq] + constructor + · rintro ⟨A, rfl | ⟨y, hy, rfl⟩, rfl⟩ + · rw [hG₀_toLoc] + refine ⟨T.parent t, ?_, rfl⟩ + rw [← hT_S] + exact Or.inl ⟨ht, rfl⟩ + · rw [hℒ_toLoc y hy] + obtain ⟨hye, hpar_y⟩ := T.mem_children_iff.1 hy + refine ⟨y, ?_, rfl⟩ + rw [← hT_S] + exact Or.inr ⟨hye, hpar_y⟩ + · rintro ⟨u, hadj, rfl⟩ + rw [← hT_S] at hadj + rcases hadj with ⟨_, rfl⟩ | ⟨hue, hpar_u⟩ + · exact ⟨G₀, Or.inl rfl, hG₀_toLoc⟩ + · have huc : u ∈ T.children t := T.mem_children_iff.2 ⟨hue, hpar_u⟩ + exact ⟨GM04.cross τ (T.subtreeAt u) u, Or.inr ⟨u, huc, rfl⟩, hℒ_toLoc u huc⟩ + · ext p + simp only [rootedLocationToLocation, Set.mem_image, vertexLocation, Set.mem_ofPred_eq] + constructor + · rintro ⟨A, ⟨y, hy, rfl⟩, rfl⟩ + rw [hℒ_toLoc y hy] + obtain ⟨hye, hpar_y⟩ := T.mem_children_iff.1 hy + refine ⟨y, ?_, rfl⟩ + rw [← hT_S] + exact Or.inr ⟨hye, hpar_y⟩ + · rintro ⟨u, hadj, rfl⟩ + rw [← hT_S] at hadj + rcases hadj with ⟨hte, _⟩ | ⟨hue, hpar_u⟩ + · exact (ht hte).elim + · have huc : u ∈ T.children t := T.mem_children_iff.2 ⟨hue, hpar_u⟩ + exact ⟨GM04.cross τ (T.subtreeAt u) u, ⟨u, huc, rfl⟩, hℒ_toLoc u huc⟩ + +private theorem cross_child_le_cross_parent + {ι : Type*} {T : GM04.RootedTree ι} {τ : ι → RootedHypergraph α β} + {G : RootedHypergraph α β} (htd : GM04.IsTreeDecomposition G T τ) + {t y : ι} (htv : t ∈ T.verts) (hye : y ∈ T.edges) (hpar_y : T.parent y = t) : + (GM04.cross τ (T.subtreeAt y) y).toHypergraph ≤ + (GM04.cross τ (T.subtreeAt t) t).toHypergraph := + htd.cross_le_cross + (T.subtreeAt_mono (hpar_y ▸ T.reaches_parent (T.edges_subset_verts hye))) + (T.subtreeAt_subset_verts t) + (T.self_mem_subtreeAt (T.edges_subset_verts hye)) + (T.self_mem_subtreeAt htv) + +/-- **Claim (1)** in the proof of Graph Minors XVIII, (6.6) (page 105): +"(1) *Let $t \in V(T)$ and let $N(t)$ be the set of all $y \in V(T)$ such that there is an edge of +$T$ with head $y$ and tail $t$. Then $P|\tau \times T^t$ is an enlargement of a member of +$\mathscr{C}^*$ by the set of $\Omega$-patchworks +$\mathscr{C}_t = \{P|\tau \times T^y \colon y \in N(t)\}$.*" -/ +theorem lemma_6_6_claim_1 [Infinite β] [Preorder Ω] {ι : Type*} [Fintype ι] + {𝒞 : Set (PartialPatchwork Ω α β)} + {P : GM04.Patchwork Ω α β} (hrootless : IsRootless P) + {S : SimpleGraph ι} {σ : ι → Hypergraph α β} + (hprop : IsProper P.G.toHypergraph S σ) + {T : GM04.RootedTree ι} (hT_verts : T.verts = Finset.univ) + (hT_S : arborescenceUnderlying T = S) + {τ : ι → RootedHypergraph α β} + (hdec : IsRootedDecomposition P T τ) + (hσ : ∀ u, (τ u).toHypergraph = σ u) + (hpieces : ∀ u (Q : PartialPatchwork Ω α β), + IsPiece (toPartialPatchwork P) S σ u Q → Q ∈ 𝒞) + (t : ι) : + let 𝒞_t : Set (PartialPatchwork Ω α β) := + {Q | ∃ y ∈ T.children t, + PatchworkEquiv Q (toPartialPatchwork (P.restrict (GM04.cross τ (T.subtreeAt y) y)))} + toPartialPatchwork (P.restrict (GM04.cross τ (T.subtreeAt t) t)) ∈ + enlargementClass (rootingClosure 𝒞) 𝒞_t := by + classical + intro 𝒞_t + let P_part := toPartialPatchwork P + have hP_part_total : P_part.IsTotal := fun e _ ↦ WithBot.coe_ne_bot + have htv : t ∈ T.verts := hT_verts ▸ Finset.mem_univ t + let B_H := GM04.cross τ (T.subtreeAt t) t + have hle_B : B_H.toHypergraph ≤ P.G.toHypergraph := + hdec.isTreeDecomposition.cross_le (T.subtreeAt_subset_verts t) (T.self_mem_subtreeAt htv) + let B := P_part.restrict B_H + let ℒ : Set (RootedHypergraph α β) := + {A | ∃ y ∈ T.children t, A = GM04.cross τ (T.subtreeAt y) y} + have hB_restrict_mem : ∀ A ∈ ℒ, B.restrict A ∈ 𝒞_t := by + rintro _ ⟨y, hy, rfl⟩ + obtain ⟨hye, hpar_y⟩ := T.mem_children_iff.1 hy + exact ⟨y, hy, Patchwork.restrict_restrict_equiv hle_B + (cross_child_le_cross_parent hdec.isTreeDecomposition htv hye hpar_y)⟩ + by_cases ht_edge : t ∈ T.edges + · -- Case 2: `t ∈ T.edges` (`t ≠ T.root`). + let G₀ := rootedDecompRootSide hdec.isTreeDecomposition ht_edge + let ℒ_star : Set (RootedHypergraph α β) := insert G₀ ℒ + obtain ⟨hℒ_B, hℒ_star, hcore_eq⟩ := theorem_6_5_3 hrootless hdec ht_edge + -- Show `G₀ ∉ ℒ` using `hprop : IsProper P.G.toHypergraph S σ`. + have hG₀_notMem_ℒ : G₀ ∉ ℒ := by + rintro ⟨y, hy, hEq⟩ + obtain ⟨hye, hpar_y⟩ := T.mem_children_iff.1 hy + have hclaim3 := (lemma_6_5_claim_3 hrootless hdec ht_edge hye hpar_y).2 + change G₀.toHypergraph ≤ _ at hclaim3 + rw [hEq, (theorem_6_5_1 hdec hye).choose_spec] at hclaim3 + have hsep_y := (hdec.isTreeDecomposition.isSeparation_edge hye).isSeparation + have hunion_eq : (GM04.cross τ (T.rootSide y) T.root).toHypergraph = P.G.toHypergraph := by + refine (GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hsep_y.right_le + (GM10.union_le hsep_y.left_le hsep_y.right_le) + (Set.union_eq_right.mpr hclaim3.vertexSet_subset).symm + (Set.union_eq_right.mpr hclaim3.edgeSet_subset).symm).trans hsep_y.union_eq + have ⟨hsub_y, hroot_y⟩ := + cross_subtreeAt_and_rootSide_eq_treeDecompSide hdec.isTreeDecomposition hT_verts hT_S hσ hye + have hadj_y : S.Adj y (T.parent y) := by + rw [← hT_S]; exact Or.inl ⟨hye, rfl⟩ + have hmakes_y : GM10.MakesSeparation S σ s(y, T.parent y) + (GM04.cross τ (T.subtreeAt y) y).toHypergraph + (GM04.cross τ (T.rootSide y) T.root).toHypergraph := + ⟨y, T.parent y, hadj_y, rfl, hsub_y, hroot_y⟩ + exact (hprop (S.mem_edgeSet.2 hadj_y) hmakes_y) hunion_eq + -- Choose a fresh heart `Q_star` of `(P_part, ℒ_star)`. + obtain ⟨newEdge, Q_star, hQ_star, _⟩ := exists_fresh_isPlaceHeart P_part hℒ_star + -- `Q_star` is a piece of `P_part` at `t` under `(S, σ)`, hence `Q_star ∈ 𝒞`. + have hloc_eq : rootedLocationToLocation P_part.G ℒ_star = vertexLocation S σ t := + (vertexLocation_eq_children_or_parent hrootless hdec hT_verts hT_S hσ t).1 ht_edge + have hQ_star_piece : IsPiece P_part S σ t Q_star := + ⟨ℒ_star, ⟨hP_part_total, hℒ_star⟩, hloc_eq, ⟨newEdge, hQ_star⟩⟩ + have hQ_star_mem : Q_star ∈ 𝒞 := hpieces t Q_star hQ_star_piece + -- Define `Q_mk = mkPlaceHeart B hℒ_B newEdge hinj_B hnotMem_B`, `G_Q = Q_mk.G`, and `Q = + -- Q_star.restrict G_Q`. + let e₀ := newEdge G₀ + have he₀_dom : e₀ ∈ Q_star.dom := by + rw [hQ_star.dom_eq] + exact Or.inr ⟨G₀, Or.inl rfl, rfl⟩ + have he₀_φ : Q_star.φ e₀ = ⊥ := hQ_star.φ_newEdge (Or.inl rfl) + have hQ_star_rootless : IsRootless Q_star := by + change Q_star.G.rootSet = ∅ + rw [RootedHypergraph.rootSet, hQ_star.roots_eq] + exact hrootless + have hinj_B : Set.InjOn newEdge ℒ := hQ_star.injOn_newEdge.mono (Set.subset_insert G₀ ℒ) + have hnotMem_B : ∀ ⦃A⦄, A ∈ ℒ → newEdge A ∉ (rootedLocationCore B.G ℒ).edgeSet := by + intro A hA + rw [show B.G = B_H from rfl, hcore_eq] + exact hQ_star.newEdge_notMem_core (Or.inr hA) + have hQ_mk := isPlaceHeart_mkPlaceHeart B hℒ_B newEdge hinj_B hnotMem_B + let G_Q := (mkPlaceHeart B hℒ_B newEdge hinj_B hnotMem_B).G + have hG_Q_V : G_Q.vertexSet = Q_star.G.vertexSet := by + change (mkPlaceHeart B hℒ_B newEdge hinj_B hnotMem_B).G.vertexSet = Q_star.G.vertexSet + rw [hQ_mk.vertexSet_eq, hQ_star.vertexSet_eq] + exact congrArg Hypergraph.vertexSet hcore_eq + have hG_Q_E : G_Q.edgeSet = Q_star.G.edgeSet \ {e₀} := by + change (mkPlaceHeart B hℒ_B newEdge hinj_B hnotMem_B).G.edgeSet = + Q_star.G.edgeSet \ {newEdge G₀} + rw [hQ_mk.edgeSet_eq, hQ_star.edgeSet_eq, show B.G = B_H from rfl, hcore_eq] + ext e + simp only [Set.mem_sdiff, Set.mem_union, Set.mem_image, Set.mem_insert_iff, + Set.mem_singleton_iff] + constructor + · rintro (hc | ⟨A, hA, rfl⟩) + · refine ⟨Or.inl hc, fun hEq ↦ ?_⟩ + rw [hEq] at hc + exact hQ_star.newEdge_notMem_core (Or.inl rfl) hc + · refine ⟨Or.inr ⟨A, Or.inr hA, rfl⟩, fun hEq ↦ ?_⟩ + have hAG₀ : A = G₀ := hQ_star.injOn_newEdge (Or.inr hA) (Or.inl rfl) hEq + rw [hAG₀] at hA + exact hG₀_notMem_ℒ hA + · rintro ⟨hc | ⟨A, rfl | hA, rfl⟩, hne_e₀⟩ + · exact Or.inl hc + · exact (hne_e₀ rfl).elim + · exact Or.inr ⟨A, hA, rfl⟩ + have hG_Q_ends : ∀ e ∈ G_Q.edgeSet, G_Q.ends e = Q_star.G.ends e := by + intro e he + change e ∈ (mkPlaceHeart B hℒ_B newEdge hinj_B hnotMem_B).G.edgeSet at he + rw [hQ_mk.edgeSet_eq, show B.G = B_H from rfl] at he + rcases he with hc | ⟨A, hA, rfl⟩ + · have hc_star : e ∈ (rootedLocationCore P_part.G ℒ_star).edgeSet := hcore_eq ▸ hc + rw [hQ_mk.ends_core hc, hQ_star.ends_core hc_star] + have he_B : e ∈ B_H.edgeSet := (mem_rootedLocationCore_edgeSet_iff.1 hc).1 + exact (hle_B.ends_eq e he_B).symm + · rw [hQ_mk.ends_newEdge hA, hQ_star.ends_newEdge (Or.inr hA)] + have hG_Q_le : G_Q.toHypergraph ≤ Q_star.G.toHypergraph := + { vertexSet_subset := hG_Q_V.le + edgeSet_subset := hG_Q_E.le.trans Set.sdiff_subset + ends_eq := fun e he ↦ (hG_Q_ends e he).symm } + have hdel_le : Q_star.G.toHypergraph.deleteEdges {e₀} ≤ Q_star.G.toHypergraph := + { vertexSet_subset := le_rfl + edgeSet_subset := Set.sdiff_subset + ends_eq := fun e he ↦ Set.ext fun v ↦ ⟨fun h ↦ ⟨h, he.2⟩, fun h ↦ h.1⟩ } + have hG_Q_del : G_Q.toHypergraph = Q_star.G.toHypergraph.deleteEdges {e₀} := + GM10.eq_of_le_of_vertexSet_eq_of_edgeSet_eq hG_Q_le hdel_le hG_Q_V hG_Q_E + have hG_Q_roots : G_Q.roots = Q_star.μ e₀ := by + change (mkPlaceHeart B hℒ_B newEdge hinj_B hnotMem_B).G.roots = Q_star.μ e₀ + rw [hQ_mk.roots_eq, hQ_star.μ_newEdge (Or.inl rfl)] + rfl + let Q := Q_star.restrict G_Q + have hQ_rooting : IsRooting Q_star Q := + ⟨hQ_star_rootless, e₀, he₀_dom, he₀_φ, hG_Q_le, hG_Q_del, hG_Q_roots, rfl⟩ + have hQ_mem : Q ∈ rootingClosure 𝒞 := Or.inr ⟨Q_star, hQ_star_mem, hQ_rooting⟩ + -- Now verify `IsPlaceHeart B ℒ newEdge Q`. + have hQ_heart : IsPlaceHeart B ℒ newEdge Q := + { isRootedLocation := hℒ_B + injOn_newEdge := hinj_B + newEdge_notMem_core := hnotMem_B + vertexSet_eq := rfl + edgeSet_eq := rfl + roots_eq := rfl + ends_core := hQ_mk.ends_core + ends_newEdge := hQ_mk.ends_newEdge + dom_eq := by + change Q.dom = (rootedLocationCore B.G ℒ).edgeSet ∩ (P_part.restrict B_H).dom ∪ newEdge + '' ℒ + rw [Q_star.restrict_dom hG_Q_le, hQ_star.dom_eq, hG_Q_E, hQ_star.edgeSet_eq, + show B.G = B_H from rfl, hcore_eq, P_part.restrict_dom hle_B] + ext e + simp only [Set.mem_union, Set.mem_inter_iff, Set.mem_image, Set.mem_insert_iff, + Set.mem_sdiff, Set.mem_singleton_iff, e₀] + constructor + · rintro ⟨⟨hc, hd⟩ | ⟨A, rfl | hA, rfl⟩, _, hne_e₀⟩ + · have he_B : e ∈ B_H.edgeSet := + (mem_rootedLocationCore_edgeSet_iff.1 (hcore_eq.symm ▸ hc)).1 + exact Or.inl ⟨hc, hd, he_B⟩ + · exact (hne_e₀ rfl).elim + · exact Or.inr ⟨A, hA, rfl⟩ + · rintro (⟨hc, hd, _⟩ | ⟨A, hA, rfl⟩) + · refine ⟨Or.inl ⟨hc, hd⟩, Or.inl hc, fun hEq ↦ ?_⟩ + rw [hEq] at hc + exact hQ_star.newEdge_notMem_core (Or.inl rfl) hc + · refine ⟨Or.inr ⟨A, Or.inr hA, rfl⟩, Or.inr ⟨A, Or.inr hA, rfl⟩, fun hEq ↦ ?_⟩ + have hAG₀ : A = G₀ := hQ_star.injOn_newEdge (Or.inr hA) (Or.inl rfl) hEq + rw [hAG₀] at hA + exact hG₀_notMem_ℒ hA + μ_core := fun f hf ↦ by + change f ∈ (rootedLocationCore B.G ℒ).edgeSet ∩ (P_part.restrict B_H).dom at hf + have hf_star : f ∈ (rootedLocationCore P_part.G ℒ_star).edgeSet ∩ P_part.dom := by + rw [show B.G = B_H from rfl, hcore_eq, P_part.restrict_dom hle_B] at hf + exact ⟨hf.1, hf.2.1⟩ + exact hQ_star.μ_core hf_star + μ_newEdge := fun A hA ↦ hQ_star.μ_newEdge (Or.inr hA) + Δ_core := fun f hf ↦ by + have hf_G_Q : f ∈ G_Q.edgeSet := Or.inl hf + have hf_star : f ∈ (rootedLocationCore P_part.G ℒ_star).edgeSet := + hcore_eq ▸ hf + have hf_B : f ∈ B_H.edgeSet := (mem_rootedLocationCore_edgeSet_iff.1 hf).1 + change Q.Δ f = (P_part.restrict B_H).Δ f + rw [Q_star.restrict_Δ hG_Q_le hf_G_Q, hQ_star.Δ_core hf_star, + P_part.restrict_Δ hle_B hf_B] + Δ_newEdge := fun A hA ↦ by + have hA_G_Q : newEdge A ∈ G_Q.edgeSet := Or.inr ⟨A, hA, rfl⟩ + have hle_A_B : A.toHypergraph ≤ B_H.toHypergraph := (hℒ_B.isComplemented hA).le + rw [Q_star.restrict_Δ hG_Q_le hA_G_Q, hQ_star.Δ_newEdge (Or.inr hA)] + exact (Patchwork.restrict_restrict_equiv hle_B hle_A_B).symm.feasibleGroupings_eq + φ_core := fun f hf ↦ by + have hf_star : f ∈ (rootedLocationCore P_part.G ℒ_star).edgeSet := hcore_eq ▸ hf + exact hQ_star.φ_core hf_star + φ_newEdge := fun A hA ↦ hQ_star.φ_newEdge (Or.inr hA) } + exact ⟨Q, hQ_mem, ℒ, hℒ_B, ⟨newEdge, hQ_heart⟩, hB_restrict_mem⟩ + · -- Case 1: `t ∉ T.edges`, so `t = T.root` and `B_H = P.G`. + have ht_root : t = T.root := by + by_contra hne + exact ht_edge (T.mem_edges_iff.2 ⟨htv, hne⟩) + subst ht_root + have hB_H_eq : B_H = P.G := by + dsimp only [B_H] + rw [GM04.cross_subtreeAt_root, hdec.isTreeDecomposition.cross_verts_eq] + obtain ⟨hℒ_B, _⟩ := isRootedLocation_children hdec.isTreeDecomposition htv + have hℒ_P : IsRootedLocation P_part.G ℒ := by + change IsRootedLocation P.G ℒ + rw [← hB_H_eq] + exact hℒ_B + obtain ⟨newEdge, Q, hQ, _⟩ := exists_fresh_isPlaceHeart P_part hℒ_P + have hloc_eq : rootedLocationToLocation P_part.G ℒ = vertexLocation S σ T.root := + (vertexLocation_eq_children_or_parent hrootless hdec hT_verts hT_S hσ T.root).2 ht_edge + have hQ_piece : IsPiece P_part S σ T.root Q := + ⟨ℒ, ⟨hP_part_total, hℒ_P⟩, hloc_eq, ⟨newEdge, hQ⟩⟩ + have hQ_mem : Q ∈ rootingClosure 𝒞 := Or.inl (hpieces T.root Q hQ_piece) + have hB_equiv : PatchworkEquiv P_part B := by + change PatchworkEquiv P_part (P_part.restrict B_H) + rw [hB_H_eq] + exact (patchworkEquiv_restrict_self P_part).symm + exact ⟨Q, hQ_mem, ℒ, hℒ_B, ⟨newEdge, hQ.congr_left hB_equiv⟩, hB_restrict_mem⟩ + +/-! ## Claim (2) of (6.6) and proof of Theorem (6.6) -/ + +/-- A class `W : Set (GM04.Patchwork Ω α β)` of total `Ω`-patchworks (where `Ω` is +well-quasi-ordered) +is well-quasi-ordered by `GM04.Simulated` if and only if its image `toPartialPatchwork '' W` is +well-behaved. -/ +theorem wellBehaved_image_toPartialPatchwork_iff [Preorder Ω] (hΩ : WellQuasiOrderedLE Ω) + (W : Set (GM04.Patchwork Ω α β)) : + WellBehaved (toPartialPatchwork '' W) ↔ + ∀ x : ℕ → GM04.Patchwork Ω α β, (∀ n, x n ∈ W) → + ∃ i j, i < j ∧ GM04.Simulated (x i) (x j) := by + classical + constructor + · intro hWB x hx + let UnitType := PUnit.{max w (max u v) + 1} + have hUnit_wqo : WellQuasiOrderedLE UnitType := Finite.to_wellQuasiOrderedLE + let Ω' : Type (max w (max u v)) := DisjointUnionQuasiOrder Ω UnitType + have hΩ'_wqo : WellQuasiOrderedLE Ω' := wellQuasiOrderedLE_disjointUnion hΩ hUnit_wqo + let ι : Ω ↪o Ω' := DisjointUnionQuasiOrder.inlEmb Ω UnitType + let Q : ℕ → GM04.Patchwork Ω' α β := fun n ↦ + { G := (x n).G + dom := (x n).dom + μ := (x n).μ + Δ := (x n).Δ + φ := fun e ↦ Sum.inl ((x n).φ e) + dom_subset := (x n).dom_subset + μ_nodup := (x n).μ_nodup + μ_set := (x n).μ_set + Δ_verts := (x n).Δ_verts + Δ_free := (x n).Δ_free } + have hQ_comp : ∀ n, ∃ P ∈ toPartialPatchwork '' W, IsCompletion ι P (Q n) := by + intro n + refine ⟨toPartialPatchwork (x n), ⟨x n, hx n, rfl⟩, + ⟨rfl, rfl, fun _ _ ↦ rfl, fun _ _ ↦ rfl, ?_⟩⟩ + intro e _ ω hφ + change Sum.inl ((x n).φ e) = Sum.inl ω + exact congrArg Sum.inl (WithBot.coe_inj.1 hφ) + obtain ⟨i, j, hij, ηv, ηe, hexp, hreal⟩ := hWB Ω' ι hΩ'_wqo Q hQ_comp + refine ⟨i, j, hij, ηv, ηe, ?_, hreal⟩ + refine + { vertex_nonempty := hexp.vertex_nonempty + vertex_subset := hexp.vertex_subset + edge_mem := hexp.edge_mem + vertex_disjoint := hexp.vertex_disjoint + edge_injOn := hexp.edge_injOn + mem_dom_iff := hexp.mem_dom_iff + ends_nonempty := hexp.ends_nonempty + μ_length := hexp.μ_length + μ_mem := hexp.μ_mem + roots_length := hexp.roots_length + roots_mem := hexp.roots_mem + maps_Δ := hexp.maps_Δ + φ_le := fun e he ↦ (ι.map_rel_iff).1 (hexp.φ_le e he) } + · intro hwqo Ω' _ ι _ Q hQ + choose P hP_mem hcomp using hQ + choose R hR_W hR_eq using hP_mem + obtain ⟨i, j, hij, ηv, ηe, hexp, H, ⟨δ, hδ, hH⟩, hcomp_H⟩ := hwqo R hR_W + have hG_i : (Q i).G = (R i).G := (hcomp i).G_eq.trans (congrArg GM04.Patchwork.G (hR_eq i).symm) + have hG_j : (Q j).G = (R j).G := (hcomp j).G_eq.trans (congrArg GM04.Patchwork.G (hR_eq j).symm) + have hdom_i : (Q i).dom = (R i).dom := + (hcomp i).dom_eq.trans (congrArg GM04.Patchwork.dom (hR_eq i).symm) + have hdom_j : (Q j).dom = (R j).dom := + (hcomp j).dom_eq.trans (congrArg GM04.Patchwork.dom (hR_eq j).symm) + have hμ_i : ∀ e ∈ (R i).dom, (Q i).μ e = (R i).μ e := fun e he ↦ by + have h := (hcomp i).μ_eq (by rw [← hR_eq i]; exact he) + rw [← hR_eq i] at h + exact h + have hμ_j : ∀ e ∈ (R j).dom, (Q j).μ e = (R j).μ e := fun e he ↦ by + have h := (hcomp j).μ_eq (by rw [← hR_eq j]; exact he) + rw [← hR_eq j] at h + exact h + have hΔ_i : ∀ e ∈ (R i).G.edgeSet, (Q i).Δ e = (R i).Δ e := fun e he ↦ by + have h := (hcomp i).Δ_eq (by rw [← hR_eq i]; exact he) + rw [← hR_eq i] at h + exact h + have hΔ_j : ∀ e ∈ (R j).G.edgeSet, (Q j).Δ e = (R j).Δ e := fun e he ↦ by + have h := (hcomp j).Δ_eq (by rw [← hR_eq j]; exact he) + rw [← hR_eq j] at h + exact h + have hφ_i : ∀ e ∈ (R i).G.edgeSet, (Q i).φ e = ι ((R i).φ e) := fun e he ↦ + (hcomp i).φ_eq (by rw [← hR_eq i]; exact he) (by rw [← hR_eq i]; rfl) + have hφ_j : ∀ e ∈ (R j).G.edgeSet, (Q j).φ e = ι ((R j).φ e) := fun e he ↦ + (hcomp j).φ_eq (by rw [← hR_eq j]; exact he) (by rw [← hR_eq j]; rfl) + refine ⟨i, j, hij, ηv, ηe, ?_, H, ⟨⟨δ, fun e he ↦ ?_, ?_⟩, fun v hv ↦ hcomp_H v (hG_i ▸ hv)⟩⟩ + · refine + { vertex_nonempty := fun v hv ↦ hexp.vertex_nonempty v (hG_i ▸ hv) + vertex_subset := fun v hv ↦ hG_j.symm ▸ hexp.vertex_subset v (hG_i ▸ hv) + edge_mem := fun e he ↦ hG_j.symm ▸ hexp.edge_mem e (hG_i ▸ he) + vertex_disjoint := fun v₁ hv₁ v₂ hv₂ hne ↦ + hexp.vertex_disjoint v₁ (hG_i ▸ hv₁) v₂ (hG_i ▸ hv₂) hne + edge_injOn := hG_i.symm ▸ hexp.edge_injOn + mem_dom_iff := fun e he ↦ by + rw [hdom_i, hdom_j] + exact hexp.mem_dom_iff e (hG_i ▸ he) + ends_nonempty := fun e he hnd v hinc ↦ by + have he' : e ∈ (R i).G.edgeSet := hG_i ▸ he + have hnd' : e ∉ (R i).dom := hdom_i ▸ hnd + have hinc' : (R i).G.Inc e v := hG_i ▸ hinc + obtain ⟨v', hv', hinc_j⟩ := hexp.ends_nonempty e he' hnd' v hinc' + exact ⟨v', hv', hG_j.symm ▸ hinc_j⟩ + μ_length := fun e he ↦ by + have he' : e ∈ (R i).dom := hdom_i ▸ he + have heE' : e ∈ (R i).G.edgeSet := (R i).dom_subset he' + have hηe' : ηe e ∈ (R j).dom := (hexp.mem_dom_iff e heE').1 he' + rw [hμ_i e he', hμ_j (ηe e) hηe'] + exact hexp.μ_length e he' + μ_mem := fun e he k hk hk' ↦ by + have he' : e ∈ (R i).dom := hdom_i ▸ he + have heE' : e ∈ (R i).G.edgeSet := (R i).dom_subset he' + have hηe' : ηe e ∈ (R j).dom := (hexp.mem_dom_iff e heE').1 he' + have hk₁ : k < ((R i).μ e).length := (hμ_i e he') ▸ hk + have hk₂ : k < ((R j).μ (ηe e)).length := (hμ_j (ηe e) hηe') ▸ hk' + have hmem := hexp.μ_mem e he' k hk₁ hk₂ + simpa [hμ_i e he', hμ_j (ηe e) hηe'] using hmem + roots_length := by + rw [hG_i, hG_j] + exact hexp.roots_length + roots_mem := fun k hk hk' ↦ by + have hk₁ : k < (R i).G.roots.length := hG_i ▸ hk + have hk₂ : k < (R j).G.roots.length := hG_j ▸ hk' + have hmem := hexp.roots_mem k hk₁ hk₂ + simpa [hG_i, hG_j] using hmem + maps_Δ := fun e he ↦ by + have he' : e ∈ (R i).dom := hdom_i ▸ he + have heE' : e ∈ (R i).G.edgeSet := (R i).dom_subset he' + have hηe' : ηe e ∈ (R j).dom := (hexp.mem_dom_iff e heE').1 he' + have hηeE' : ηe e ∈ (R j).G.edgeSet := hexp.edge_mem e heE' + rw [hμ_i e he', hμ_j (ηe e) hηe', hΔ_i e heE', hΔ_j (ηe e) hηeE'] + exact hexp.maps_Δ e he' + φ_le := fun e he ↦ by + have heE' : e ∈ (R i).G.edgeSet := hG_i ▸ he + have hηeE' : ηe e ∈ (R j).G.edgeSet := hexp.edge_mem e heE' + rw [hφ_i e heE', hφ_j (ηe e) hηeE'] + exact ι.monotone (hexp.φ_le e heE') } + · have he_R : e ∈ ((R j).deleteEdges (ηe '' (R i).G.edgeSet)).G.edgeSet := by + simpa [GM04.Patchwork.deleteEdges, RootedHypergraph.deleteEdges, Hypergraph.deleteEdges, + hG_i, hG_j] using he + change δ e ∈ (Q j).Δ e + rw [hΔ_j e he_R.1] + exact hδ e he_R + · simpa [GM04.Patchwork.deleteEdges, RootedHypergraph.deleteEdges, Hypergraph.deleteEdges, + hG_i, hG_j] using hH + +/-- Disjoint copy of `T i` in `Σ k : ℕ, ι k` with first coordinate `i`. -/ +noncomputable def sigmaTree {ι : ℕ → Type*} (T : ∀ i : ℕ, GM04.RootedTree (ι i)) (i : ℕ) : + GM04.RootedTree (Σ k : ℕ, ι k) where + verts := (T i).verts.map ⟨Sigma.mk i, sigma_mk_injective⟩ + root := ⟨i, (T i).root⟩ + parent p := ⟨p.1, (T p.1).parent p.2⟩ + root_mem := Finset.mem_map_of_mem _ (T i).root_mem + parent_mem p hp := by + obtain ⟨v, hv, rfl⟩ := Finset.mem_map.mp hp + exact Finset.mem_map_of_mem _ ((T i).parent_mem v hv) + parent_root := Sigma.ext rfl (heq_of_eq (T i).parent_root) + exists_iterate_eq_root p hp := by + obtain ⟨v, hv, rfl⟩ := Finset.mem_map.mp hp + obtain ⟨n, hn⟩ := (T i).exists_iterate_eq_root v hv + refine ⟨n, ?_⟩ + have hiter : ∀ (m : ℕ) (w : ι i), + ((fun q : Σ k : ℕ, ι k ↦ (⟨q.1, (T q.1).parent q.2⟩ : Σ k : ℕ, ι k))^[m] ⟨i, w⟩) = + ⟨i, (T i).parent^[m] w⟩ := by + intro m + induction m with + | zero => intro _; rfl + | succ m ih => + intro w + rw [Function.iterate_succ_apply, Function.iterate_succ_apply, ih] + change (fun q : Σ k : ℕ, ι k ↦ (⟨q.1, (T q.1).parent q.2⟩ : Σ k : ℕ, ι k))^[n] ⟨i, v⟩ = + ⟨i, (T i).root⟩ + rw [hiter, hn] + +theorem sigmaTree_verts {ι : ℕ → Type*} (T : ∀ i : ℕ, GM04.RootedTree (ι i)) (i : ℕ) : + (sigmaTree T i).verts = (T i).verts.map ⟨Sigma.mk i, sigma_mk_injective⟩ := by + rfl + +theorem sigmaTree_root {ι : ℕ → Type*} (T : ∀ i : ℕ, GM04.RootedTree (ι i)) (i : ℕ) : + (sigmaTree T i).root = ⟨i, (T i).root⟩ := by + rfl + +theorem sigmaTree_parent_mk {ι : ℕ → Type*} (T : ∀ i : ℕ, GM04.RootedTree (ι i)) (i : ℕ) + (t : ι i) : (sigmaTree T i).parent ⟨i, t⟩ = ⟨i, (T i).parent t⟩ := by + rfl + +theorem sigmaTree_parent_iterate {ι : ℕ → Type*} (T : ∀ i : ℕ, GM04.RootedTree (ι i)) + (m : ℕ) (p : Σ k : ℕ, ι k) : + ((fun q : Σ k : ℕ, ι k ↦ (⟨q.1, (T q.1).parent q.2⟩ : Σ k : ℕ, ι k))^[m] p) = + ⟨p.1, (T p.1).parent^[m] p.2⟩ := by + induction m generalizing p with + | zero => rfl + | succ m ih => + rw [Function.iterate_succ_apply, Function.iterate_succ_apply, ih] + +@[simp] +theorem mem_sigmaTree_verts {ι : ℕ → Type*} (T : ∀ i : ℕ, GM04.RootedTree (ι i)) + (i : ℕ) (p : Σ k : ℕ, ι k) : + p ∈ (sigmaTree T i).verts ↔ ∃ (h : p.1 = i), h ▸ p.2 ∈ (T i).verts := by + rcases p with ⟨j, v⟩ + simp only [sigmaTree, Finset.mem_map, Function.Embedding.coeFn_mk, Sigma.mk.inj_iff] + constructor + · rintro ⟨w, hw, rfl, hEq⟩ + cases hEq + exact ⟨rfl, hw⟩ + · rintro ⟨rfl, hv⟩ + exact ⟨v, hv, rfl, HEq.rfl⟩ + +theorem mem_sigmaTree_verts_mk {ι : ℕ → Type*} (T : ∀ i : ℕ, GM04.RootedTree (ι i)) + (i : ℕ) (v : ι i) : + (⟨i, v⟩ : Σ k : ℕ, ι k) ∈ (sigmaTree T i).verts ↔ v ∈ (T i).verts := by + rw [mem_sigmaTree_verts] + exact ⟨fun ⟨_, hv⟩ ↦ hv, fun hv ↦ ⟨rfl, hv⟩⟩ + +theorem mem_sigmaTree_edges_mk {ι : ℕ → Type*} (T : ∀ i : ℕ, GM04.RootedTree (ι i)) + (i : ℕ) (v : ι i) : + (⟨i, v⟩ : Σ k : ℕ, ι k) ∈ (sigmaTree T i).edges ↔ v ∈ (T i).edges := by + rw [GM04.RootedTree.mem_edges_iff, mem_sigmaTree_verts_mk, GM04.RootedTree.mem_edges_iff] + simp only [sigmaTree, ne_eq, Sigma.mk.inj_iff, true_and, heq_eq_eq] + +theorem sigmaTree_reaches_mk_iff {ι : ℕ → Type*} (T : ∀ i : ℕ, GM04.RootedTree (ι i)) + (i : ℕ) (u v : ι i) : + (sigmaTree T i).Reaches ⟨i, u⟩ ⟨i, v⟩ ↔ (T i).Reaches u v := by + refine ⟨?_, ?_⟩ + · rintro ⟨hv, n, hn⟩ + rw [mem_sigmaTree_verts_mk] at hv + change (fun q : Σ k : ℕ, ι k ↦ (⟨q.1, (T q.1).parent q.2⟩ : Σ k : ℕ, ι k))^[n] ⟨i, v⟩ + = ⟨i, u⟩ at hn + rw [sigmaTree_parent_iterate, Sigma.mk.inj_iff, heq_eq_eq] at hn + exact ⟨hv, n, hn.2⟩ + · rintro ⟨hv, n, hn⟩ + refine ⟨(mem_sigmaTree_verts_mk T i v).2 hv, n, ?_⟩ + change (fun q : Σ k : ℕ, ι k ↦ (⟨q.1, (T q.1).parent q.2⟩ : Σ k : ℕ, ι k))^[n] ⟨i, v⟩ = ⟨i, u⟩ + rw [sigmaTree_parent_iterate, hn] + +theorem sigmaTree_precedes_mk_iff {ι : ℕ → Type*} (T : ∀ i : ℕ, GM04.RootedTree (ι i)) + (φ : ∀ i, ι i → ℕ) (i : ℕ) (v w : ι i) : + (sigmaTree T i).Precedes (fun p ↦ φ p.1 p.2) ⟨i, v⟩ ⟨i, w⟩ ↔ + (T i).Precedes (φ i) v w := by + simp only [GM04.RootedTree.Precedes, sigmaTree_reaches_mk_iff] + refine and_congr ?_ (and_congr_right fun _ ↦ and_congr_right fun _ ↦ ⟨?_, ?_⟩) + · simp [sigmaTree] + · intro h g hgv hvg hgw + exact h ⟨i, g⟩ (fun hEq ↦ hgv (sigma_mk_injective hEq)) + ((sigmaTree_reaches_mk_iff T i v g).2 hvg) + ((sigmaTree_reaches_mk_iff T i g w).2 hgw) + · intro h ⟨j, g⟩ hjg hvg hgw + have hj : j = i := ((mem_sigmaTree_verts T i ⟨j, g⟩).1 hvg.1).1 + subst hj + rw [sigmaTree_reaches_mk_iff] at hvg hgw + exact h g (fun hEq ↦ hjg (congrArg (Sigma.mk j) hEq)) hvg hgw + +/-- For `p : Σ k : ℕ, ι k`, the subtree patchwork `(P p.1).restrict (GM04.cross (τ p.1) ((T +p.1).subtreeAt p.2) p.2)`. -/ +noncomputable def sigmaSubtreePatchwork {ι : ℕ → Type*} (P : ℕ → GM04.Patchwork Ω α β) + (T : ∀ i : ℕ, GM04.RootedTree (ι i)) (τ : ∀ i : ℕ, ι i → RootedHypergraph α β) + (p : Σ k : ℕ, ι k) : GM04.Patchwork Ω α β := + (P p.1).restrict (GM04.cross (τ p.1) ((T p.1).subtreeAt p.2) p.2) + +/-- The set of out-neighbours in `⋃_i T_i` of vertices in `X : Set (Σ k : ℕ, ι k)` +(Graph Minors XVIII, proof of (6.6), Claim (2), page 105). -/ +def sigmaOutNeighbours {ι : ℕ → Type*} (T : ∀ i : ℕ, GM04.RootedTree (ι i)) + (X : Set (Σ k : ℕ, ι k)) : Set (Σ k : ℕ, ι k) := + {y | ∃ i, y ∈ (sigmaTree T i).edges ∧ (sigmaTree T i).parent y ∈ X} + +theorem sigmaSubtreePatchwork_mk {ι : ℕ → Type*} (P : ℕ → GM04.Patchwork Ω α β) + (T : ∀ i : ℕ, GM04.RootedTree (ι i)) (τ : ∀ i : ℕ, ι i → RootedHypergraph α β) (i : ℕ) + (t : ι i) : + sigmaSubtreePatchwork P T τ ⟨i, t⟩ = (P i).restrict (GM04.cross (τ i) ((T i).subtreeAt t) t) + := by + rfl + +theorem mem_sigmaOutNeighbours {ι : ℕ → Type*} (T : ∀ i : ℕ, GM04.RootedTree (ι i)) + (X : Set (Σ k : ℕ, ι k)) (y : Σ k : ℕ, ι k) : + y ∈ sigmaOutNeighbours T X ↔ ∃ i, y ∈ (sigmaTree T i).edges ∧ (sigmaTree T i).parent y ∈ X := + Iff.rfl + +/-- **Claim (2)** in the proof of Graph Minors XVIII, (6.6) (page 105): +"(2) *If $X \subseteq V(M)$ and $B(N(X))$ is well-quasi-ordered by simulation, then so is +$B(X)$.*" -/ +theorem lemma_6_6_claim_2 [Infinite β] [Preorder Ω] (hΩ : WellQuasiOrderedLE Ω) + {ι : ℕ → Type*} [∀ i, Fintype (ι i)] + {𝒞 : Set (PartialPatchwork Ω α β)} (h𝒞 : WellBehaved 𝒞) + {P : ℕ → GM04.Patchwork Ω α β} (hrootless : ∀ i, IsRootless (P i)) + {S : ∀ i, SimpleGraph (ι i)} {σ : ∀ i, ι i → Hypergraph α β} + (hprop : ∀ i, IsProper (P i).G.toHypergraph (S i) (σ i)) + {T : ∀ i, GM04.RootedTree (ι i)} (hT_verts : ∀ i, (T i).verts = Finset.univ) + (hT_S : ∀ i, arborescenceUnderlying (T i) = S i) + {τ : ∀ i, ι i → RootedHypergraph α β} + (hdec : ∀ i, IsRootedDecomposition (P i) (T i) (τ i)) + (hσ : ∀ i u, (τ i u).toHypergraph = σ i u) + (hpieces : ∀ i u (Q : PartialPatchwork Ω α β), + IsPiece (toPartialPatchwork (P i)) (S i) (σ i) u Q → Q ∈ 𝒞) + {X : Set (Σ k : ℕ, ι k)} + (hY_wqo : ∀ y : ℕ → GM04.Patchwork Ω α β, + (∀ n, y n ∈ sigmaSubtreePatchwork P T τ '' sigmaOutNeighbours T X) → + ∃ i j, i < j ∧ GM04.Simulated (y i) (y j)) : + ∀ x : ℕ → GM04.Patchwork Ω α β, + (∀ n, x n ∈ sigmaSubtreePatchwork P T τ '' X) → + ∃ i j, i < j ∧ GM04.Simulated (x i) (x j) := by + have hY_wb : WellBehaved + (equivClosure (toPartialPatchwork '' (sigmaSubtreePatchwork P T τ '' sigmaOutNeighbours T + X))) := + wellBehaved_equivClosure ((wellBehaved_image_toPartialPatchwork_iff hΩ _).2 hY_wqo) + have h_enl_wb : WellBehaved + (enlargementClass (rootingClosure 𝒞) + (equivClosure (toPartialPatchwork '' (sigmaSubtreePatchwork P T τ '' sigmaOutNeighbours T + X)))) := + theorem_6_3_proof (wellBehaved_rootingClosure h𝒞) hY_wb + have hX_sub : toPartialPatchwork '' (sigmaSubtreePatchwork P T τ '' X) ⊆ + enlargementClass (rootingClosure 𝒞) + (equivClosure (toPartialPatchwork '' (sigmaSubtreePatchwork P T τ '' sigmaOutNeighbours T + X))) := by + rintro _ ⟨_, ⟨⟨i, t⟩, hxt, rfl⟩, rfl⟩ + have hclaim1 := + lemma_6_6_claim_1 (hrootless i) (hprop i) (hT_verts i) (hT_S i) (hdec i) (hσ i) (hpieces i) t + obtain ⟨Q, hQ_mem, ℒ, hℒ, hheart, hA_mem⟩ := hclaim1 + refine ⟨Q, hQ_mem, ℒ, hℒ, hheart, fun A hA ↦ ?_⟩ + obtain ⟨y, hy, hEq⟩ := hA_mem A hA + obtain ⟨hye, hpar_y⟩ := (T i).mem_children_iff.1 hy + refine ⟨toPartialPatchwork (sigmaSubtreePatchwork P T τ ⟨i, y⟩), + ⟨sigmaSubtreePatchwork P T τ ⟨i, y⟩, ⟨⟨i, y⟩, ?_, rfl⟩, rfl⟩, hEq⟩ + refine ⟨i, (mem_sigmaTree_edges_mk T i y).2 hye, ?_⟩ + change (⟨i, (T i).parent y⟩ : Σ k : ℕ, ι k) ∈ X + rwa [hpar_y] + exact (wellBehaved_image_toPartialPatchwork_iff hΩ _).1 (h_enl_wb.mono hX_sub) + +end GraphMinor.GM18 +end diff --git a/LeanPool/GraphMinor/GM18/Section6Stars.lean b/LeanPool/GraphMinor/GM18/Section6Stars.lean new file mode 100644 index 0000000000..23ef17221d --- /dev/null +++ b/LeanPool/GraphMinor/GM18/Section6Stars.lean @@ -0,0 +1,655 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM18.Section6Part2 +public import LeanPool.GraphMinor.GM04.NumberedDecomposition +public import LeanPool.GraphMinor.GM04.Patchwork.VerifyAxioms +import LeanPool.GraphMinor.Thomas.RootedTree + +/-! +# Graph Minors XVIII, (6.6): the stars of the arborescences and Graph Minors IV, (3.3) + +The last step of the proof of (6.6) (pages 105–106) packs the stars of the arborescences `Tᵢ` into a +set `𝒮` of star-decompositions, checks that `𝒮` is good in the sense of Graph Minors IV, Section 3, +and applies IV (3.3). The class `ℛ` and the simulation relation are those of IV, Section 9: the +rooted hypergraphs `G ⊆ ‖Pᵢ‖`, with `G` simulated in `G'` when `Pᵢ | G` is simulated in +`Pⱼ | G'`. As the paper says, "we may assume" that the `Pᵢ` are mutually disjoint. In the Lean the +`Pᵢ` share one edge type, so we tag the edges of `Pᵢ` with `i` (`GM04.tagEdgePatchwork`); the +arborescences `Tᵢ` live in different types, so we put them side by side in `Σ k, ι k` +(`sigmaTree`). + +* `simulated_of_edgeRename`: renaming the edges of a patchwork gives a patchwork that it is + simulated in. +* `isTreeDecomposition_sigmaTag`: a tree-decomposition stays one after the tagging. +* `patchworkSim_cross_iff`: the simulation of IV, Section 9 between tagged subtree hypergraphs is + simulation of the restrictions of the untagged patchworks. +* `theorem_6_6_of_rootedDecomposition`: the proof of (6.6) after its first paragraph, by IV (3.3). +* `theorem_6_6_proof`: (6.6) for a well-behaved ambient class containing the pieces. +-/ + +public section + +namespace GraphMinor.GM18 + +open SimpleGraph Hypergraph + +universe u v w + +variable {α : Type u} {β : Type v} {Ω : Type w} + +/-! ## Renaming the edges of a patchwork -/ + +/-- If `P'` is `P` with its edges renamed by `f`, then `P` is simulated in `P'`: each vertex goes +to itself and each edge `e` to `f e`. The realization is the edgeless graph on `V(G)`. -/ +theorem simulated_of_edgeRename [Preorder Ω] {β' : Type*} (P : GM04.Patchwork Ω α β) + (P' : GM04.Patchwork Ω α β') (f : β → β') + (hV : P'.G.vertexSet = P.G.vertexSet) (hroots : P'.G.roots = P.G.roots) + (hE : f '' P.G.edgeSet = P'.G.edgeSet) (hinj : Set.InjOn f P.G.edgeSet) + (hinc : ∀ e ∈ P.G.edgeSet, ∀ x, P'.G.Inc (f e) x ↔ P.G.Inc e x) + (hdom : ∀ e ∈ P.G.edgeSet, e ∈ P.dom ↔ f e ∈ P'.dom) + (hμ : ∀ e ∈ P.dom, P'.μ (f e) = P.μ e) (hΔ : ∀ e ∈ P.dom, P'.Δ (f e) = P.Δ e) + (hφ : ∀ e ∈ P.G.edgeSet, P'.φ (f e) = P.φ e) : + GM04.Simulated P P' := by + classical + have hexp : GM04.IsExpansion P P' (fun x ↦ {x}) f := + { vertex_nonempty := fun x _ ↦ Set.singleton_nonempty x + vertex_subset := fun x hx y hy ↦ by + rw [Set.mem_singleton_iff.1 hy, hV] + exact hx + edge_mem := fun e he ↦ hE ▸ Set.mem_image_of_mem f he + vertex_disjoint := fun _ _ _ _ hne ↦ Set.disjoint_singleton.mpr hne + edge_injOn := hinj + mem_dom_iff := hdom + ends_nonempty := fun e he _ x hx ↦ ⟨x, rfl, (hinc e he x).2 hx⟩ + μ_length := fun e he ↦ by rw [hμ e he] + μ_mem := fun e he i hi hi' ↦ by + simp only [Set.mem_singleton_iff] + simp only [hμ e he] + roots_length := by rw [hroots] + roots_mem := fun i hi hi' ↦ by + simp only [Set.mem_singleton_iff] + simp only [hroots] + maps_Δ := fun e he δ hδ ↦ by + have heE : e ∈ P.G.edgeSet := P.dom_subset he + have hverts : δ.verts ⊆ {x | x ∈ P.μ e} := by + rw [((P.Δ e).verts_eq δ hδ).trans (P.Δ_verts e heE), P.μ_set e he] + rw [hμ e he, hΔ e he, GM04.marchMapSubgraph_id hverts] + exact hδ + φ_le := fun e he ↦ (hφ e he).symm ▸ le_rfl } + have hdel : (P'.deleteEdges (f '' P.G.edgeSet)).G.edgeSet = ∅ := by + change P'.G.edgeSet \ f '' P.G.edgeSet = ∅ + rw [hE, Set.sdiff_self] + refine ⟨fun x ↦ {x}, f, hexp, GM04.emptySubgraph P'.G.vertexSet, ?_, fun x hx ↦ ?_⟩ + · refine ⟨fun _ ↦ GM04.emptySubgraph ∅, fun e he ↦ ?_, ?_⟩ + · rw [hdel] at he + exact he.elim + · ext a b + · simp only [GM04.realizationOf, Subgraph.verts_sup, Subgraph.verts_iSup, + GM04.emptySubgraph_verts, hdel, Set.mem_empty_iff_false, Set.iUnion_of_empty, + Set.iUnion_empty, Set.union_empty] + rfl + · simp only [GM04.not_emptySubgraph_adj, GM04.realizationOf_adj, false_iff, not_exists, + hdel, Set.mem_empty_iff_false, false_and, not_false_eq_true, implies_true] + · have hx' : x ∈ P'.G.vertexSet := hV ▸ hx + let y : (GM04.emptySubgraph P'.G.vertexSet).verts := ⟨x, hx'⟩ + refine ⟨GM04.component (GM04.emptySubgraph P'.G.vertexSet) y, ⟨y, rfl⟩, ?_⟩ + ext w + simp only [GM04.component_verts, GM04.mem_componentVerts_iff, + GM04.emptySubgraph_verts, Set.mem_singleton_iff] + refine ⟨?_, fun hEq ↦ hEq ▸ ⟨hx', Reachable.refl y⟩⟩ + rintro ⟨hw, hr⟩ + suffices ∀ z : (GM04.emptySubgraph P'.G.vertexSet).verts, + (GM04.emptySubgraph P'.G.vertexSet).coe.Reachable y z → z.1 = y.1 from + this ⟨w, hw⟩ hr + intro z hz + rw [reachable_iff_reflTransGen] at hz + induction hz with + | refl => rfl + | @tail _ _ _ hab => exact False.elim hab + +/-- Patchworks that agree are simulated in each other. -/ +theorem simulated_of_agrees [Preorder Ω] {P₁ P₂ : GM04.Patchwork Ω α β} (h : P₁.Agrees P₂) : + GM04.Simulated P₁ P₂ := by + obtain ⟨ηv, ηe, hη⟩ := GM04.Simulated.refl P₁ + exact ⟨ηv, ηe, hη.congr (GM04.Patchwork.Agrees.rfl P₁) h⟩ + +/-! ## Tagging the edges -/ + +theorem tagEdgeHypergraph_le {G H : Hypergraph α β} (h : G ≤ H) (i : ℕ) : + GM04.tagEdgeHypergraph i G ≤ GM04.tagEdgeHypergraph i H := by + refine ⟨h.vertexSet_subset, Set.image_mono h.edgeSet_subset, ?_⟩ + rintro _ ⟨e, he, rfl⟩ + rw [GM04.tagEdgeHypergraph_ends, GM04.tagEdgeHypergraph_ends] + exact h.ends_eq e he + +theorem tagEdgeHypergraph_biUnion {ι : Type*} (s : Finset ι) (G : ι → Hypergraph α β) (i : ℕ) : + GM04.tagEdgeHypergraph i (Hypergraph.biUnion s G) = + Hypergraph.biUnion s fun t ↦ GM04.tagEdgeHypergraph i (G t) := by + ext + · simp [GM04.tagEdgeHypergraph, Hypergraph.biUnion] + · simp only [GM04.tagEdgeHypergraph, Hypergraph.biUnion, Set.image_iUnion₂] + · simp only [GM04.tagEdgeHypergraph, Hypergraph.biUnion] + exact ⟨fun ⟨h₁, t, ht, h⟩ ↦ ⟨t, ht, h₁, h⟩, fun ⟨t, ht, h₁, h⟩ ↦ ⟨h₁, t, ht, h⟩⟩ + +/-- `P | G` is simulated in `P' | G'`, where `P'` and `G'` are `P` and `G` with their edges tagged +`i`. -/ +theorem simulated_restrict_tag [Preorder Ω] (P : GM04.Patchwork Ω α β) {G : RootedHypergraph α β} + (hG : G.toHypergraph ≤ P.G.toHypergraph) (i : ℕ) : + GM04.Simulated (P.restrict G) + ((GM04.tagEdgePatchwork i P).restrict (GM04.tagEdgeRooted i G)) := by + have hG' : (GM04.tagEdgeRooted i G).toHypergraph ≤ (GM04.tagEdgePatchwork i P).G.toHypergraph := + tagEdgeHypergraph_le hG i + refine simulated_of_edgeRename _ _ (Prod.mk i) rfl rfl rfl (Prod.mk_right_injective i).injOn + (fun e _ x ↦ ⟨fun h ↦ h.2, fun h ↦ ⟨rfl, h⟩⟩) (fun e he ↦ ?_) (fun _ _ ↦ rfl) + (fun e he ↦ ?_) (fun _ _ ↦ rfl) + · rw [GM04.Patchwork.restrict_dom hG, GM04.Patchwork.restrict_dom hG'] + simp [GM04.tagEdgePatchwork, GM04.tagEdgeRooted, GM04.tagEdgeHypergraph] + · have he' : e ∈ G.edgeSet := ((GM04.Patchwork.restrict_dom hG ▸ he) : e ∈ P.dom ∩ _).2 + rw [GM04.Patchwork.restrict_Δ hG he', GM04.Patchwork.restrict_Δ hG' ⟨e, he', rfl⟩] + rfl + +/-- `P' | G'` is simulated in `P | G`, where `P'` and `G'` are `P` and `G` with their edges tagged +`i`. -/ +theorem simulated_tag_restrict [Preorder Ω] (P : GM04.Patchwork Ω α β) {G : RootedHypergraph α β} + (hG : G.toHypergraph ≤ P.G.toHypergraph) (i : ℕ) : + GM04.Simulated ((GM04.tagEdgePatchwork i P).restrict (GM04.tagEdgeRooted i G)) + (P.restrict G) := by + have hG' : (GM04.tagEdgeRooted i G).toHypergraph ≤ (GM04.tagEdgePatchwork i P).G.toHypergraph := + tagEdgeHypergraph_le hG i + refine simulated_of_edgeRename _ _ Prod.snd rfl rfl ?_ ?_ ?_ ?_ ?_ ?_ ?_ + · change Prod.snd '' (Prod.mk i '' G.edgeSet) = G.edgeSet + rw [Set.image_image] + exact Set.image_id' G.edgeSet + · rintro _ ⟨e₁, _, rfl⟩ _ ⟨e₂, _, rfl⟩ h + exact congrArg (Prod.mk i) h + · rintro _ ⟨e, _, rfl⟩ x + exact ⟨fun h ↦ ⟨rfl, h⟩, fun h ↦ h.2⟩ + · rintro _ ⟨e, he, rfl⟩ + rw [GM04.Patchwork.restrict_dom hG, GM04.Patchwork.restrict_dom hG'] + simp [GM04.tagEdgePatchwork, GM04.tagEdgeRooted, GM04.tagEdgeHypergraph] + · intro _ _ + rfl + · intro p hp + rw [GM04.Patchwork.restrict_dom hG'] at hp + obtain ⟨-, ⟨e, he, rfl⟩⟩ := hp + rw [GM04.Patchwork.restrict_Δ hG he, GM04.Patchwork.restrict_Δ hG' ⟨e, he, rfl⟩] + rfl + · intro _ _ + rfl + +/-- The simulation of Graph Minors IV, Section 9 (`GM04.patchworkSim`) for the tagged patchworks, +between tagged subhypergraphs, is simulation of the restrictions of the untagged patchworks. -/ +theorem patchworkSim_tag_iff [Preorder Ω] (P : ℕ → GM04.Patchwork Ω α β) {i j : ℕ} + {G H : RootedHypergraph α β} (hG : G.toHypergraph ≤ (P i).G.toHypergraph) + (hH : H.toHypergraph ≤ (P j).G.toHypergraph) : + GM04.patchworkSim (fun k ↦ GM04.tagEdgePatchwork k (P k)) (GM04.tagEdgeRooted i G) + (GM04.tagEdgeRooted j H) ↔ + GM04.Simulated ((P i).restrict G) ((P j).restrict H) := by + have hd := GM04.tagEdgePatchwork_disjoint P + have hAG := GM04.inducedPatchwork_agrees hd (i := i) (G := GM04.tagEdgeRooted i G) + (tagEdgeHypergraph_le hG i) + have hAH := GM04.inducedPatchwork_agrees hd (i := j) (G := GM04.tagEdgeRooted j H) + (tagEdgeHypergraph_le hH j) + constructor + · intro h + exact ((simulated_restrict_tag (P i) hG i).trans (simulated_of_agrees hAG.symm)).trans + (h.trans ((simulated_of_agrees hAH).trans (simulated_tag_restrict (P j) hH j))) + · intro h + exact ((simulated_of_agrees hAG).trans (simulated_tag_restrict (P i) hG i)).trans + (h.trans ((simulated_restrict_tag (P j) hH j).trans (simulated_of_agrees hAH.symm))) + +/-- Tagging the edges of the bags keeps a tree-decomposition. -/ +theorem isTreeDecomposition_tag {ι : Type*} {G : RootedHypergraph α β} {T : GM04.RootedTree ι} + {τ : ι → RootedHypergraph α β} (htd : GM04.IsTreeDecomposition G T τ) (i : ℕ) : + GM04.IsTreeDecomposition (GM04.tagEdgeRooted i G) T fun t ↦ GM04.tagEdgeRooted i (τ t) := by + refine ⟨fun t ht ↦ tagEdgeHypergraph_le (htd.le t ht) i, ?_, ?_, ?_, htd.roots_root, + htd.rootSet_edge⟩ + · change Hypergraph.biUnion T.verts (fun t ↦ GM04.tagEdgeHypergraph i (τ t).toHypergraph) = + GM04.tagEdgeHypergraph i G.toHypergraph + rw [← tagEdgeHypergraph_biUnion, htd.biUnion_eq] + · intro t₁ ht₁ t₂ ht₂ hne + rw [Set.eq_empty_iff_forall_notMem] + rintro _ ⟨⟨e₁, he₁, rfl⟩, ⟨e₂, he₂, hEq⟩⟩ + obtain rfl : e₁ = e₂ := congrArg Prod.snd hEq.symm + have he_inter : e₁ ∈ ((τ t₁).toHypergraph ∩ (τ t₂).toHypergraph).edgeSet := ⟨he₁, he₂⟩ + rw [htd.edgeSet_inter_eq t₁ ht₁ t₂ ht₂ hne] at he_inter + exact he_inter + · intro t₁ ht₁ t₂ ht₂ t₃ ht₃ hpath + have hle := htd.inter_le t₁ ht₁ t₂ ht₂ t₃ ht₃ hpath + refine ⟨hle.vertexSet_subset, ?_, ?_⟩ + · rintro _ ⟨⟨e₁, he₁, rfl⟩, ⟨e₃, he₃, hEq⟩⟩ + obtain rfl : e₁ = e₃ := congrArg Prod.snd hEq.symm + exact ⟨e₁, hle.edgeSet_subset ⟨he₁, he₃⟩, rfl⟩ + · rintro _ ⟨⟨e₁, he₁, rfl⟩, ⟨e₃, he₃, hEq⟩⟩ + obtain rfl : e₁ = e₃ := congrArg Prod.snd hEq.symm + ext v + have hends := congrArg (v ∈ ·) (hle.ends_eq e₁ ⟨he₁, he₃⟩) + dsimp only [Hypergraph.ends, Inter.inter, GM04.tagEdgeRooted, GM04.tagEdgeHypergraph] + at hends ⊢ + rw [Set.mem_ofPred_eq, Set.mem_ofPred_eq] at hends ⊢ + exact ⟨fun h ↦ ⟨⟨rfl, (hends.mp h.2).1⟩, ⟨rfl, (hends.mp h.2).2⟩⟩, + fun ⟨h₁, h₃⟩ ↦ ⟨rfl, hends.mpr ⟨h₁.2, h₃.2⟩⟩⟩ + +/-! ## The disjoint union of the arborescences -/ + +section Sigma + +variable {ι : ℕ → Type*} (T : ∀ i, GM04.RootedTree (ι i)) + +theorem exists_eq_of_mem_sigmaTree_verts {i : ℕ} {p : Σ k, ι k} + (hp : p ∈ (sigmaTree T i).verts) : ∃ t ∈ (T i).verts, p = ⟨i, t⟩ := by + obtain ⟨j, t⟩ := p + obtain ⟨rfl, ht⟩ := (mem_sigmaTree_verts T i ⟨j, t⟩).1 hp + exact ⟨t, ht, rfl⟩ + +theorem subtreeAt_sigmaTree (i : ℕ) (t : ι i) : + (sigmaTree T i).subtreeAt ⟨i, t⟩ = + ((T i).subtreeAt t).map ⟨Sigma.mk i, sigma_mk_injective⟩ := by + ext p + rw [GM04.RootedTree.mem_subtreeAt, Finset.mem_map] + constructor + · intro hr + obtain ⟨u, -, rfl⟩ := exists_eq_of_mem_sigmaTree_verts T hr.1 + exact ⟨u, GM04.RootedTree.mem_subtreeAt _ |>.2 ((sigmaTree_reaches_mk_iff T i t u).1 hr), rfl⟩ + · rintro ⟨u, hu, rfl⟩ + exact (sigmaTree_reaches_mk_iff T i t u).2 ((GM04.RootedTree.mem_subtreeAt _).1 hu) + +theorem biUnion_map_sigma {γ : Type*} (i : ℕ) (s : Finset (ι i)) + (G : (Σ k, ι k) → Hypergraph α γ) : + Hypergraph.biUnion (s.map ⟨Sigma.mk i, sigma_mk_injective⟩) G = + Hypergraph.biUnion s fun t ↦ G ⟨i, t⟩ := by + ext <;> simp [Hypergraph.biUnion] + +theorem onPath_sigmaTree {i : ℕ} {a b c : ι i} + (h : (sigmaTree T i).OnPath ⟨i, a⟩ ⟨i, b⟩ ⟨i, c⟩) : (T i).OnPath a b c := by + obtain ⟨h₁, h₂⟩ := h + refine ⟨?_, fun x hxa hxb ↦ ?_⟩ + · rcases h₁ with h | h + · exact Or.inl ((sigmaTree_reaches_mk_iff T i c a).1 h) + · exact Or.inr ((sigmaTree_reaches_mk_iff T i c b).1 h) + · exact (sigmaTree_reaches_mk_iff T i x c).1 + (h₂ ⟨i, x⟩ ((sigmaTree_reaches_mk_iff T i x a).2 hxa) ((sigmaTree_reaches_mk_iff T i x b).2 + hxb)) + +/-- A tree-decomposition with tree `Tᵢ` is one with tree `sigmaTree T i`, when the bag of `⟨i, t⟩` +is the bag of `t`. -/ +theorem isTreeDecomposition_sigmaTree {γ : Type*} {G : RootedHypergraph α γ} {i : ℕ} + {τ : ι i → RootedHypergraph α γ} {τ' : (Σ k, ι k) → RootedHypergraph α γ} + (hτ : ∀ t, τ' ⟨i, t⟩ = τ t) (h : GM04.IsTreeDecomposition G (T i) τ) : + GM04.IsTreeDecomposition G (sigmaTree T i) τ' where + le p hp := by + obtain ⟨t, ht, rfl⟩ := exists_eq_of_mem_sigmaTree_verts T hp + rw [hτ] + exact h.le t ht + biUnion_eq := by + rw [sigmaTree_verts, biUnion_map_sigma] + simp only [hτ] + exact h.biUnion_eq + edgeSet_inter_eq p₁ hp₁ p₂ hp₂ hne := by + obtain ⟨t₁, ht₁, rfl⟩ := exists_eq_of_mem_sigmaTree_verts T hp₁ + obtain ⟨t₂, ht₂, rfl⟩ := exists_eq_of_mem_sigmaTree_verts T hp₂ + rw [hτ, hτ] + exact h.edgeSet_inter_eq t₁ ht₁ t₂ ht₂ fun h ↦ hne (h ▸ rfl) + inter_le p₁ hp₁ p₂ hp₂ p₃ hp₃ hpath := by + obtain ⟨t₁, ht₁, rfl⟩ := exists_eq_of_mem_sigmaTree_verts T hp₁ + obtain ⟨t₂, ht₂, rfl⟩ := exists_eq_of_mem_sigmaTree_verts T hp₂ + obtain ⟨t₃, ht₃, rfl⟩ := exists_eq_of_mem_sigmaTree_verts T hp₃ + rw [hτ, hτ, hτ] + exact h.inter_le t₁ ht₁ t₂ ht₂ t₃ ht₃ (onPath_sigmaTree T hpath) + roots_root := by + rw [sigmaTree_root, hτ] + exact h.roots_root + rootSet_edge p hp := by + obtain ⟨t, -, rfl⟩ := exists_eq_of_mem_sigmaTree_verts T ((sigmaTree T i).edges_subset_verts hp) + rw [sigmaTree_parent_mk, hτ, hτ] + exact h.rootSet_edge t ((mem_sigmaTree_edges_mk T i t).1 hp) + +/-- The bags of the tagged decompositions: the bag of `⟨k, t⟩` is `τ k t` with its edges tagged +`k`. -/ +noncomputable def tagBags (τ : ∀ i, ι i → RootedHypergraph α β) (p : Σ k, ι k) : + RootedHypergraph α (ℕ × β) := + GM04.tagEdgeRooted p.1 (τ p.1 p.2) + +theorem cross_tagBags (τ : ∀ i, ι i → RootedHypergraph α β) (i : ℕ) {S : Finset (ι i)} {r : ι i} + (hr : r ∈ S) : + GM04.cross (tagBags τ) (S.map ⟨Sigma.mk i, sigma_mk_injective⟩) ⟨i, r⟩ = + GM04.tagEdgeRooted i (GM04.cross (τ i) S r) := by + refine RootedHypergraph.ext ?_ rfl + have hr' : (⟨i, r⟩ : Σ k, ι k) ∈ S.map ⟨Sigma.mk i, sigma_mk_injective⟩ := + Finset.mem_map_of_mem _ hr + rw [GM04.cross_toHypergraph_of_mem _ hr', biUnion_map_sigma] + change _ = GM04.tagEdgeHypergraph i (GM04.cross (τ i) S r).toHypergraph + rw [GM04.cross_toHypergraph_of_mem _ hr, tagEdgeHypergraph_biUnion] + rfl + +end Sigma + +/-! ## The proof of (6.6) -/ + +/-- The proof of **Graph Minors XVIII, (6.6)** (pages 105–106) after its first paragraph, which +gives +the rooted decompositions `(Tᵢ, τᵢ)` by (6.4). As in the paper: let `ℛ` be the class of rooted +hypergraphs `G ⊆ ‖Pᵢ‖` with the simulation of Graph Minors IV, Section 9; let `𝒮` be the set of the +stars of the `Tᵢ`, with `σ(s) = τᵢ(s)` and `σ(t) = τᵢ × Tᵢᵗ`; check that `𝒮` is good, the third +condition being Claim (2) (`lemma_6_6_claim_2`) "in different language"; and apply Graph Minors IV, +(3.3). The `Pᵢ` are made disjoint by tagging their edges, and the `Tᵢ` are put side by side in +`Σ k, ι k`. -/ +theorem theorem_6_6_of_rootedDecomposition [Infinite β] [Preorder Ω] (hΩ : WellQuasiOrderedLE Ω) + {ι : ℕ → Type*} [∀ i, Fintype (ι i)] + {𝒞 : Set (PartialPatchwork Ω α β)} (h𝒞 : WellBehaved 𝒞) + (P : ℕ → GM04.Patchwork Ω α β) (hrootless : ∀ i, IsRootless (P i)) + (S : ∀ i, SimpleGraph (ι i)) (σ : ∀ i, ι i → Hypergraph α β) + (hprop : ∀ i, IsProper (P i).G.toHypergraph (S i) (σ i)) + (hpieces : ∀ i u (Q : PartialPatchwork Ω α β), + IsPiece (toPartialPatchwork (P i)) (S i) (σ i) u Q → Q ∈ 𝒞) + (T : ∀ i, GM04.RootedTree (ι i)) (hT_verts : ∀ i, (T i).verts = Finset.univ) + (hT_S : ∀ i, arborescenceUnderlying (T i) = S i) + (τ : ∀ i, ι i → RootedHypergraph α β) + (hdec : ∀ i, IsRootedDecomposition (P i) (T i) (τ i)) + (hσ : ∀ i u, (τ i u).toHypergraph = σ i u) : + ∃ i j, i < j ∧ GM04.Simulated (P i) (P j) := by + classical + have hmem : ∀ i (t : ι i), t ∈ (T i).verts := fun i t ↦ hT_verts i ▸ Finset.mem_univ t + -- Every march `π(τᵢ(t))` has length at most `k`, since the pieces are in `𝒞`. + obtain ⟨k, hk_roots⟩ := (wellBehaved_rootingClosure h𝒞).exists_roots_length_le hΩ + have hroots_le : ∀ i t, (τ i t).roots.length ≤ k := by + intro i t + by_cases ht : t = (T i).root + · subst ht + rw [(hdec i).isTreeDecomposition.roots_root, ← RootedHypergraph.ncard_rootSet, hrootless i, + Set.ncard_empty] + exact Nat.zero_le k + · obtain ⟨Q, hQ_mem, ℒ, _, ⟨_, hheart⟩, _⟩ := + lemma_6_6_claim_1 (hrootless i) (hprop i) (hT_verts i) (hT_S i) (hdec i) (hσ i) + (hpieces i) t + have hroots_eq : (GM04.cross (τ i) ((T i).subtreeAt t) t).roots = Q.G.roots := + hheart.roots_eq.symm + calc (τ i t).roots.length = (GM04.cross (τ i) ((T i).subtreeAt t) t).roots.length := rfl + _ = Q.G.roots.length := by rw [hroots_eq] + _ ≤ k := hk_roots Q hQ_mem + -- The tagged patchworks, the trees side by side, and the tagged bags. + let P' : ℕ → GM04.Patchwork Ω α (ℕ × β) := fun j ↦ GM04.tagEdgePatchwork j (P j) + let T' : ℕ → GM04.RootedTree (Σ k, ι k) := sigmaTree T + let τ' : (Σ k, ι k) → RootedHypergraph α (ℕ × β) := tagBags τ + have hT'dec : ∀ i, GM04.IsTreeDecomposition (P' i).G (T' i) τ' := fun i ↦ + isTreeDecomposition_sigmaTree T (fun _ ↦ rfl) + (isTreeDecomposition_tag (hdec i).isTreeDecomposition i) + have hcross : ∀ i t, GM04.cross τ' ((T' i).subtreeAt ⟨i, t⟩) ⟨i, t⟩ = + GM04.tagEdgeRooted i (GM04.cross (τ i) ((T i).subtreeAt t) t) := by + intro i t + rw [subtreeAt_sigmaTree] + exact cross_tagBags τ i ((T i).self_mem_subtreeAt (hmem i t)) + have hle : ∀ i t, (GM04.cross (τ i) ((T i).subtreeAt t) t).toHypergraph ≤ + (P i).G.toHypergraph := fun i t ↦ + (hdec i).isTreeDecomposition.cross_le ((T i).subtreeAt_subset_verts t) + ((T i).self_mem_subtreeAt (hmem i t)) + -- Simulation in `ℛ` between subtree hypergraphs is simulation of the subtree patchworks. + have hK : ∀ (i : ℕ) (t : ι i) (j : ℕ) (u : ι j), + GM04.patchworkSim P' (GM04.cross τ' ((T' i).subtreeAt ⟨i, t⟩) ⟨i, t⟩) + (GM04.cross τ' ((T' j).subtreeAt ⟨j, u⟩) ⟨j, u⟩) ↔ + GM04.Simulated (sigmaSubtreePatchwork P T τ ⟨i, t⟩) (sigmaSubtreePatchwork P T τ ⟨j, u⟩) + := by + intro i t j u + rw [hcross, hcross, sigmaSubtreePatchwork_mk, sigmaSubtreePatchwork_mk] + exact patchworkSim_tag_iff P (hle i t) (hle j u) + have hord : ∀ i t, t ∈ (T i).edges → + GM04.edgeOrder (T' i) τ' ⟨i, t⟩ = GM04.edgeOrder (T i) (τ i) t := by + intro i t ht + rw [(hT'dec i).edgeOrder_eq_length_roots ((mem_sigmaTree_edges_mk T i t).2 ht), + (hdec i).isTreeDecomposition.edgeOrder_eq_length_roots ht] + rfl + -- The set `𝒮` of the stars of the trees. + let 𝒮 : Set (GM04.RootedTree (Σ k, ι k) × ((Σ k, ι k) → RootedHypergraph α (ℕ × β))) := + {x | ∃ (i : ℕ) (t : ι i), x = ((T' i).starAt ⟨i, t⟩, GM04.branching (T' i) τ' ⟨i, t⟩)} + have hgood : GM04.IsGood (GM04.patchworkClass P') (GM04.patchworkSim P') 𝒮 := by + refine ⟨?_, ?_, ⟨k, ?_⟩, ?_⟩ + · rintro _ ⟨i, t, rfl⟩ + exact (hT'dec i).isStarDecomposition_branching ((mem_sigmaTree_verts_mk T i t).2 (hmem i t)) + · rintro _ ⟨i, t, rfl⟩ + have hs := (mem_sigmaTree_verts_mk T i t).2 (hmem i t) + refine ⟨i, ?_⟩ + change (GM04.cross (GM04.branching (T' i) τ' ⟨i, t⟩) ((T' i).starAt ⟨i, t⟩).verts + ((T' i).starAt ⟨i, t⟩).root).toHypergraph ≤ _ + rw [GM04.cross_branching_eq _ _ hs] + exact (hT'dec i).cross_le ((T' i).subtreeAt_subset_verts _) ((T' i).self_mem_subtreeAt hs) + · rintro _ ⟨i, t, rfl⟩ + refine Finset.sup_le fun p hp ↦ ?_ + dsimp only at hp ⊢ + rcases (T' i).mem_starAt_verts.mp hp with rfl | hpc + · rw [GM04.branching_self] + exact hroots_le i t + · rw [GM04.branching_of_mem_children _ _ hpc] + obtain ⟨u, -, rfl⟩ := + exists_eq_of_mem_sigmaTree_verts T ((T' i).children_subset_verts _ hpc) + exact hroots_le i u + · intro x hx hwell + choose i t hxeq using hx + let X : Set (Σ k, ι k) := Set.range fun n ↦ (⟨i n, t n⟩ : Σ k, ι k) + -- The tips of the stars are well-simulated, so `B(N(X))` is well-quasi-ordered. + have hY_wqo : ∀ y : ℕ → GM04.Patchwork Ω α β, + (∀ m, y m ∈ sigmaSubtreePatchwork P T τ '' sigmaOutNeighbours T X) → + ∃ a b, a < b ∧ GM04.Simulated (y a) (y b) := by + intro y hy + choose q hq hqy using hy + have hq' : ∀ m, ∃ n u, q m = ⟨i n, u⟩ ∧ u ∈ (T (i n)).children (t n) := by + intro m + obtain ⟨j, hqe, n, hn⟩ := (mem_sigmaOutNeighbours T X (q m)).1 (hq m) + obtain ⟨u, -, hu⟩ := + exists_eq_of_mem_sigmaTree_verts T ((sigmaTree T j).edges_subset_verts hqe) + rw [hu, sigmaTree_parent_mk] at hn + obtain ⟨rfl, hpar⟩ := Sigma.mk.inj_iff.1 hn + refine ⟨n, u, hu, (T (i n)).mem_children_iff.2 + ⟨(mem_sigmaTree_edges_mk T (i n) u).1 (hu ▸ hqe), eq_of_heq hpar.symm⟩⟩ + choose n u hqu hu using hq' + obtain ⟨a, b, hab, hsim⟩ := hwell + (fun m ↦ GM04.cross τ' ((T' (i (n m))).subtreeAt ⟨i (n m), u m⟩) ⟨i (n m), u m⟩) + (fun m ↦ by + refine Set.mem_iUnion.2 ⟨n m, ⟨⟨i (n m), u m⟩, ?_, ?_⟩⟩ <;> rw [hxeq (n m)] + · rw [GM04.RootedTree.starAt_edges] + exact (T' (i (n m))).mem_children_iff.2 + ⟨(mem_sigmaTree_edges_mk T _ _).2 ((T (i (n m))).mem_children_iff.1 (hu m)).1, + by rw [sigmaTree_parent_mk, ((T (i (n m))).mem_children_iff.1 (hu m)).2]⟩ + · refine (GM04.branching_of_ne _ _ ?_).symm + intro hEq + have hut : u m = t (n m) := eq_of_heq (Sigma.mk.inj_iff.1 hEq).2 + exact (T (i (n m))).self_notMem_children (t (n m)) (hut ▸ hu m)) + refine ⟨a, b, hab, ?_⟩ + rw [← hqy a, ← hqy b, hqu a, hqu b] + exact (hK _ _ _ _).1 hsim + obtain ⟨a, b, hab, hsim⟩ := + lemma_6_6_claim_2 hΩ h𝒞 hrootless hprop hT_verts hT_S hdec hσ hpieces hY_wqo + (fun m ↦ sigmaSubtreePatchwork P T τ ⟨i m, t m⟩) (fun m ↦ ⟨_, ⟨m, rfl⟩, rfl⟩) + refine ⟨a, b, hab, ?_⟩ + rw [hxeq a, hxeq b] + dsimp only + rw [GM04.cross_branching_eq _ _ ((mem_sigmaTree_verts_mk T _ _).2 (hmem _ _)), + GM04.cross_branching_eq _ _ ((mem_sigmaTree_verts_mk T _ _).2 (hmem _ _))] + exact (hK _ _ _ _).2 hsim + -- `E(Tᵢ)` is linked, since `(Tᵢ, τᵢ)` is a rooted decomposition. + have hlinked : ∀ i, GM04.IsLinked (GM04.patchworkSim P') (T' i) τ' ((T' i).edges : Set _) := by + intro i f₁ hf₁ f₂ hf₂ hreach hordeq hmin + obtain ⟨a, -, rfl⟩ := exists_eq_of_mem_sigmaTree_verts T ((T' i).edges_subset_verts hf₁) + obtain ⟨b, -, rfl⟩ := exists_eq_of_mem_sigmaTree_verts T ((T' i).edges_subset_verts hf₂) + have ha : a ∈ (T i).edges := (mem_sigmaTree_edges_mk T i a).1 hf₁ + have hb : b ∈ (T i).edges := (mem_sigmaTree_edges_mk T i b).1 hf₂ + rw [hord i a ha, hord i b hb] at hordeq + refine (hK i a i b).2 ?_ + rw [sigmaSubtreePatchwork_mk, sigmaSubtreePatchwork_mk] + refine (hdec i).isLinked a ha b hb ((sigmaTree_reaches_mk_iff T i b a).1 hreach) hordeq ?_ + rintro g ⟨⟨hbg, hga⟩, hg⟩ + have hge : g ∈ (T i).edges := hg + have h := hmin ⟨i, g⟩ ⟨⟨(sigmaTree_reaches_mk_iff T i b g).2 hbg, + (sigmaTree_reaches_mk_iff T i g a).2 hga⟩, (mem_sigmaTree_edges_mk T i g).2 hge⟩ + rwa [hord i a ha, hord i g hge] at h + -- Apply Graph Minors IV, (3.3). + obtain ⟨a, b, hab, hsim⟩ := GM04.theorem_3_3_proved (GM04.axiom1_patchwork P') + (GM04.axiom2_patchwork P') 𝒮 hgood T' (fun _ ↦ τ') + (fun i ↦ by rw [(hT'dec i).cross_verts_eq]; exact hT'dec i) hlinked + (fun i s hs ↦ by + obtain ⟨t, -, rfl⟩ := exists_eq_of_mem_sigmaTree_verts T hs + exact ⟨i, t, rfl⟩) + refine ⟨a, b, hab, ?_⟩ + rw [← GM04.cross_subtreeAt_root, ← GM04.cross_subtreeAt_root] at hsim + simp only [T', sigmaTree_root] at hsim + have h := (hK a (T a).root b (T b).root).1 hsim + rw [sigmaSubtreePatchwork_mk, sigmaSubtreePatchwork_mk, GM04.cross_subtreeAt_root, + GM04.cross_subtreeAt_root, (hdec a).isTreeDecomposition.cross_verts_eq, + (hdec b).isTreeDecomposition.cross_verts_eq] at h + exact ((simulated_of_agrees (GM04.Patchwork.agrees_restrict_self (P a)).symm).trans h).trans + (simulated_of_agrees (GM04.Patchwork.agrees_restrict_self (P b))) + +private noncomputable def treeRootOfIsTree {ι : Type*} {K : SimpleGraph ι} + (hK : K.IsTree) : ι := + hK.connected.nonempty.some + +private noncomputable def parentOfIsTree {ι : Type*} [DecidableEq ι] {K : SimpleGraph ι} + (hK : K.IsTree) (u : ι) : ι := + if u = treeRootOfIsTree hK then treeRootOfIsTree hK + else (Thomas.treePath hK u (treeRootOfIsTree hK)).getVert 1 + +private theorem treePath_eq_cons_parentOfIsTree {ι : Type*} [DecidableEq ι] {K : SimpleGraph ι} + (hK : K.IsTree) {u : ι} (hu : u ≠ treeRootOfIsTree hK) : + ∃ (hadj : K.Adj u (parentOfIsTree hK u)), + Thomas.treePath hK u (treeRootOfIsTree hK) = + Walk.cons hadj (Thomas.treePath hK (parentOfIsTree hK u) (treeRootOfIsTree hK)) := by + generalize hp : Thomas.treePath hK u (treeRootOfIsTree hK) = p + cases p with + | nil => exact (hu rfl).elim + | @cons _ v _ hadj q => + have hpar : parentOfIsTree hK u = v := by + unfold parentOfIsTree + rw [ite_eq_right hu, hp, Walk.getVert_cons_succ, Walk.getVert_zero] + subst hpar + refine ⟨hadj, ?_⟩ + have hpath : (Walk.cons hadj q).IsPath := + hp ▸ Thomas.treePath_isPath hK u (treeRootOfIsTree hK) + have hq_path : q.IsPath := hpath.of_cons + rw [Thomas.eq_treePath hK q hq_path] + +private theorem treeDist_parentOfIsTree {ι : Type*} [DecidableEq ι] {K : SimpleGraph ι} + (hK : K.IsTree) {u : ι} (hu : u ≠ treeRootOfIsTree hK) : + Thomas.treeDist hK (parentOfIsTree hK u) (treeRootOfIsTree hK) + 1 = + Thomas.treeDist hK u (treeRootOfIsTree hK) := by + obtain ⟨hadj, heq⟩ := treePath_eq_cons_parentOfIsTree hK hu + unfold Thomas.treeDist + rw [heq, Walk.length_cons] + +private theorem iterate_parentOfIsTree_treeDist {ι : Type*} [DecidableEq ι] {K : SimpleGraph ι} + (hK : K.IsTree) (u : ι) : + (parentOfIsTree hK)^[Thomas.treeDist hK u (treeRootOfIsTree hK)] u = + treeRootOfIsTree hK := by + generalize hd : Thomas.treeDist hK u (treeRootOfIsTree hK) = d + induction d generalizing u with + | zero => + by_contra hne + exact absurd hd (ne_of_gt (Thomas.treeDist_pos_of_ne hK hne)) + | succ d ih => + have hu : u ≠ treeRootOfIsTree hK := by + rintro rfl + rw [Thomas.treeDist_self] at hd + exact Nat.noConfusion hd + have hpar_d : Thomas.treeDist hK (parentOfIsTree hK u) (treeRootOfIsTree hK) = d := by + have := treeDist_parentOfIsTree hK hu + omega + rw [Function.iterate_succ_apply] + exact ih (parentOfIsTree hK u) hpar_d + +private theorem parentOfIsTree_eq_of_not_onTreePath {ι : Type*} [DecidableEq ι] {K : SimpleGraph ι} + (hK : K.IsTree) {u v : ι} + (hadj : K.Adj u v) (hnot : ¬ Thomas.OnTreePath K v (treeRootOfIsTree hK) u) : + u ≠ treeRootOfIsTree hK ∧ parentOfIsTree hK u = v := by + have hu_not_supp : u ∉ (Thomas.treePath hK v (treeRootOfIsTree hK)).support := by + rwa [← Thomas.onTreePath_iff_mem_treePath hK] + have hpath : (Walk.cons hadj (Thomas.treePath hK v (treeRootOfIsTree hK))).IsPath := by + rw [Walk.cons_isPath_iff] + exact ⟨Thomas.treePath_isPath hK v (treeRootOfIsTree hK), hu_not_supp⟩ + have heq := Thomas.eq_treePath hK _ hpath + have hu_ne : u ≠ treeRootOfIsTree hK := by + rintro rfl + exact hnot (Thomas.onTreePath_right K v (treeRootOfIsTree hK)) + refine ⟨hu_ne, ?_⟩ + unfold parentOfIsTree + rw [ite_eq_right hu_ne, ← heq, Walk.getVert_cons_succ, Walk.getVert_zero] + +private theorem adj_iff_parentOfIsTree {ι : Type*} [DecidableEq ι] {K : SimpleGraph ι} + (hK : K.IsTree) (u v : ι) : + K.Adj u v ↔ + (u ≠ treeRootOfIsTree hK ∧ parentOfIsTree hK u = v) ∨ + (v ≠ treeRootOfIsTree hK ∧ parentOfIsTree hK v = u) := by + constructor + · intro hadj + by_cases hnot : ¬ Thomas.OnTreePath K v (treeRootOfIsTree hK) u + · exact Or.inl (parentOfIsTree_eq_of_not_onTreePath hK hadj hnot) + · push Not at hnot + have hnot' : ¬ Thomas.OnTreePath K u (treeRootOfIsTree hK) v := by + intro hv + exact hadj.ne (Thomas.onTreePath_antisymm hK + (Thomas.onTreePath_symm hnot) (Thomas.onTreePath_symm hv)) + exact Or.inr (parentOfIsTree_eq_of_not_onTreePath hK hadj.symm hnot') + · rintro (⟨hu, rfl⟩ | ⟨hv, rfl⟩) + · obtain ⟨hadj, _⟩ := treePath_eq_cons_parentOfIsTree hK hu + exact hadj + · obtain ⟨hadj, _⟩ := treePath_eq_cons_parentOfIsTree hK hv + exact hadj.symm + +private noncomputable def rootedTreeOfIsTreeFintype {ι : Type*} [Fintype ι] [DecidableEq ι] + {K : SimpleGraph ι} (hK : K.IsTree) : GM04.RootedTree ι where + verts := Finset.univ + root := treeRootOfIsTree hK + parent := parentOfIsTree hK + root_mem := Finset.mem_univ _ + parent_mem _ _ := Finset.mem_univ _ + parent_root := by + change (if treeRootOfIsTree hK = treeRootOfIsTree hK then _ else _) = _ + rw [ite_eq_left rfl] + exists_iterate_eq_root u _ := + ⟨Thomas.treeDist hK u (treeRootOfIsTree hK), iterate_parentOfIsTree_treeDist hK u⟩ + +private theorem arborescenceUnderlying_rootedTreeOfIsTreeFintype + {ι : Type*} [Fintype ι] [DecidableEq ι] {K : SimpleGraph ι} (hK : K.IsTree) : + arborescenceUnderlying (rootedTreeOfIsTreeFintype hK) = K := by + ext u v + rw [adj_iff_parentOfIsTree hK] + simp [arborescenceUnderlying, rootedTreeOfIsTreeFintype] + +/-- **Graph Minors XVIII, (6.6)** (page 104): +"**6.6.** *Let $\Omega$ be a well-quasi-order, and let $\mathcal{C}$ be a well-behaved class of +rootless partial $\Omega$-patchworks. Let $\mathcal{C}'$ be the class of all rootless, robust +$\Omega$-patchworks $P$ such that there is a rotund, proper tree-decomposition of $\|P\|$ under +which all pieces of $P$ belong to $\mathcal{C}$. Then $\mathcal{C}'$ is well-quasi-ordered by +simulation.*" + +The Lean version allows any well-behaved ambient class `𝒞` containing the pieces of the rootless +input patchworks. It uses an infinite ambient edge type to supply fresh edge labels. -/ +theorem theorem_6_6_proof [Infinite β] [Preorder Ω] (hΩ : WellQuasiOrderedLE Ω) + {ι : ℕ → Type*} [∀ i, Fintype (ι i)] + {𝒞 : Set (PartialPatchwork Ω α β)} (h𝒞 : WellBehaved 𝒞) + (P : ℕ → GM04.Patchwork Ω α β) (hrootless : ∀ i, IsRootless (P i)) + (hrob : ∀ i, (P i).IsRobust) + (S : ∀ i, SimpleGraph (ι i)) (σ : ∀ i, ι i → Hypergraph α β) + (htd : ∀ i, GM10.IsTreeDecomposition (P i).G.toHypergraph (S i) (σ i)) + (hrot : ∀ i, IsRotund (P i).G.toHypergraph (S i) (σ i)) + (hprop : ∀ i, IsProper (P i).G.toHypergraph (S i) (σ i)) + (hpieces : ∀ i u (Q : PartialPatchwork Ω α β), + IsPiece (toPartialPatchwork (P i)) (S i) (σ i) u Q → Q ∈ 𝒞) : + ∃ i j, i < j ∧ GM04.Simulated (P i) (P j) := by + classical + let T : ∀ i, GM04.RootedTree (ι i) := fun i ↦ rootedTreeOfIsTreeFintype (htd i).isTree + have hT_verts : ∀ i, (T i).verts = Finset.univ := fun _ ↦ rfl + have hT_S : ∀ i, arborescenceUnderlying (T i) = S i := + fun i ↦ arborescenceUnderlying_rootedTreeOfIsTreeFintype (htd i).isTree + have hex_rooted : ∀ i, ∃ τ : ι i → RootedHypergraph α β, + IsRootedDecomposition (P i) (T i) τ ∧ ∀ u, (τ u).toHypergraph = σ i u := + fun i ↦ theorem_6_4_proof (hrootless i) (hrob i) (htd i) (hrot i) (T i) (hT_verts i) (hT_S i) + choose τ hdec hσ using hex_rooted + exact theorem_6_6_of_rootedDecomposition hΩ h𝒞 P hrootless S σ hprop hpieces + T hT_verts hT_S τ hdec hσ + +end GraphMinor.GM18 diff --git a/LeanPool/GraphMinor/GM18/Section7.lean b/LeanPool/GraphMinor/GM18/Section7.lean new file mode 100644 index 0000000000..e453b8a370 --- /dev/null +++ b/LeanPool/GraphMinor/GM18/Section7.lean @@ -0,0 +1,155 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM18.Defs +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM18.Section3 + +/-! +# Graph Minors XVIII, Section 7: More on Isolation + +This file formalizes Section 7 (pages 107–108) of Robertson and Seymour, +*Graph Minors. XVIII. Tree-decompositions and well-quasi-ordering*, J. Combin. Theory Ser. B 89 +(2003) 77–108: + +* `lemma_7_1_claim_1` (7.1, claim (1), page 108): `(A ∪ C, B ∩ D)` has `λ`-order at least that of + `(C, D)`. +* `lemma_7_1_claim_2` (7.1, claim (2), page 108): `(A ∩ C, B ∪ D)` has `λ`-order at least that of + `(A, B)`. +* `theorem_7_1` (7.1, pages 107–108): if `𝒯` is a tangle of order `≥ θ ≥ 1` in a hypergraph `G` + with a tie-breaker `λ`, and `ℒ ⊆ 𝒯` is a location of order `< θ` every member of which is + `λ`-linked to `𝒯`, then `ℒ` `θ`-isolates `𝒯`. +-/ + +public section + +namespace GraphMinor.GM18 + +open Hypergraph + +universe u v w + +variable {α : Type u} {β : Type v} {Λ : Type w} [LinearOrder Λ] + +/-- **Graph Minors XVIII, (7.1), Claim (1)** (page 108): +"$(A \cup C, B \cap D)$ has $\lambda$-order at least that of $(C, D)$." -/ +theorem lemma_7_1_claim_1 {G : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} (hlam : GM10.IsTieBreaker G lam) + {θ_𝒯 : ℕ} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : GM10.IsTangle G θ_𝒯 𝒯) + {A B C D : Hypergraph α β} (hAB_𝒯 : (A, B) ∈ 𝒯) + (hlink : IsLambdaLinkedTo lam 𝒯 C D) : + lam (C, D) ≤ lam (A ∪ C, B ∩ D) := by + by_contra! hlt + have hCD_𝒯 : (C, D) ∈ 𝒯 := hlink.1 + have hsepAB : G.IsSeparation A B := h𝒯.isSeparation hAB_𝒯 + have hsepCD : G.IsSeparation C D := h𝒯.isSeparation hCD_𝒯 + have hsep_union : G.IsSeparation (A ∪ C) (B ∩ D) := hsepAB.union_inter hsepCD + have hC_le : C ≤ A ∪ C := GM10.le_union_right hsepAB.left_le hsepCD.left_le + have hBD_le : B ∩ D ≤ D := GM10.inter_le_right hsepAB.right_le hsepCD.right_le + have hnot_𝒯 : (A ∪ C, B ∩ D) ∉ 𝒯 := fun hm ↦ + not_lt_of_ge (hlink.2 hm hC_le hBD_le) hlt + have hord_le : separationOrder (A ∪ C) (B ∩ D) ≤ separationOrder C D := by + by_contra! hord_gt + exact not_lt_of_gt hlt (hlam.axiom3 hsepCD hsep_union hord_gt) + have hord_lt : separationOrder (A ∪ C) (B ∩ D) < θ_𝒯 := + hord_le.trans_lt (h𝒯.order_lt hCD_𝒯) + have hswap_𝒯 : (B ∩ D, A ∪ C) ∈ 𝒯 := + (h𝒯.axiom1 hsep_union hord_lt).resolve_left hnot_𝒯 + apply h𝒯.axiom2 hswap_𝒯 hAB_𝒯 hCD_𝒯 + rw [GM10.union_assoc, GM10.union_comm (B ∩ D) (A ∪ C), hsep_union.union_eq] + +/-- **Graph Minors XVIII, (7.1), Claim (2)** (page 108): +"$(A \cap C, B \cup D)$ has $\lambda$-order at least that of $(A, B)$." -/ +theorem lemma_7_1_claim_2 {G : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} (hlam : GM10.IsTieBreaker G lam) + {θ_𝒯 θ' : ℕ} {𝒯 𝒯' : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : GM10.IsTangle G θ_𝒯 𝒯) (h𝒯' : GM10.IsTangle G θ' 𝒯') + {A B C D : Hypergraph α β} (hCD_𝒯 : (C, D) ∈ 𝒯) (hDC_𝒯' : (D, C) ∈ 𝒯') + (hdist : GM10.IsDistinction lam 𝒯 𝒯' A B) : + lam (A, B) ≤ lam (A ∩ C, B ∪ D) := by + by_contra! hlt + have hAB_𝒯 : (A, B) ∈ 𝒯 := hdist.1.1 + have hBA_𝒯' : (B, A) ∈ 𝒯' := hdist.1.2 + have hsepAB : G.IsSeparation A B := h𝒯.isSeparation hAB_𝒯 + have hsepCD : G.IsSeparation C D := h𝒯.isSeparation hCD_𝒯 + have hsep_inter : G.IsSeparation (A ∩ C) (B ∪ D) := + (hsepAB.symm.union_inter hsepCD.symm).symm + have hord_le : separationOrder (A ∩ C) (B ∪ D) ≤ separationOrder A B := by + by_contra! hord_gt + exact not_lt_of_gt hlt (hlam.axiom3 hsepAB hsep_inter hord_gt) + have hord_lt_𝒯 : separationOrder (A ∩ C) (B ∪ D) < θ_𝒯 := + hord_le.trans_lt (h𝒯.order_lt hAB_𝒯) + have hord_lt_𝒯' : separationOrder (A ∩ C) (B ∪ D) < θ' := by + have hord_BA : separationOrder A B < θ' := by + rw [GM10.separationOrder_comm] + exact h𝒯'.order_lt hBA_𝒯' + exact hord_le.trans_lt hord_BA + have hAC_𝒯 : (A ∩ C, B ∪ D) ∈ 𝒯 := + GM10.theorem_2_9_proof h𝒯 hAB_𝒯 hsep_inter hord_lt_𝒯 (Or.inr (Or.inl Set.inter_subset_left)) + have hAC_not_𝒯' : (A ∩ C, B ∪ D) ∉ 𝒯' := by + intro hm + apply h𝒯'.axiom2 hBA_𝒯' hDC_𝒯' hm + exact hsep_inter.symm.union_eq + have hBD_𝒯' : (B ∪ D, A ∩ C) ∈ 𝒯' := + (h𝒯'.axiom1 hsep_inter hord_lt_𝒯').resolve_left hAC_not_𝒯' + have hdist_AC : GM10.Distinguishes 𝒯 𝒯' (A ∩ C) (B ∪ D) := ⟨hAC_𝒯, hBD_𝒯'⟩ + exact not_lt_of_ge (hdist.2 hdist_AC) hlt + +/-- **Graph Minors XVIII, (7.1)** (pages 107–108): +"Let $\mathscr{T}$ be a tangle of order $\ge \theta \ge 1$ in a hypergraph $G$ with a +tie-breaker $\lambda$, and let $\mathscr{L} \subseteq \mathscr{T}$ be a location of order $< +\theta$, every member of which is $\lambda$-linked to $\mathscr{T}$. Then $\mathscr{L}$ +$\theta$-isolates $\mathscr{T}$." -/ +theorem theorem_7_1_proof {G : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} (hlam : GM10.IsTieBreaker G lam) + {θ θ_𝒯 : ℕ} {𝒯 ℒ : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯 : GM10.IsTangle G θ_𝒯 𝒯) (_hθ_le : θ ≤ θ_𝒯) + (hℒ : GM10.IsLocation G ℒ) (hℒ_sub : ℒ ⊆ 𝒯) + (hord : locationOrder ℒ < θ) + (hlink : ∀ ⦃C D : Hypergraph α β⦄, (C, D) ∈ ℒ → IsLambdaLinkedTo lam 𝒯 C D) : + Isolates G lam θ 𝒯 ℒ where + isLocation := hℒ + subset := hℒ_sub + locationOrder_lt := hord + order_lt _ _ hp := separationOrder_lt_of_locationOrder_lt hℒ hord hp + distinction_le C D hCD_ℒ θ' 𝒯' h𝒯' hθ_le' hDC_𝒯' A B hdist := by + have hAB_𝒯 : (A, B) ∈ 𝒯 := hdist.1.1 + have hBA_𝒯' : (B, A) ∈ 𝒯' := hdist.1.2 + have hCD_𝒯 : (C, D) ∈ 𝒯 := hℒ_sub hCD_ℒ + have hsepAB : G.IsSeparation A B := h𝒯.isSeparation hAB_𝒯 + have hsepCD : G.IsSeparation C D := h𝒯.isSeparation hCD_𝒯 + have hsep_union : G.IsSeparation (A ∪ C) (B ∩ D) := hsepAB.union_inter hsepCD + have hclaim1 : lam (C, D) ≤ lam (A ∪ C, B ∩ D) := + lemma_7_1_claim_1 hlam h𝒯 hAB_𝒯 (hlink hCD_ℒ) + have hclaim2 : lam (A, B) ≤ lam (A ∩ C, B ∪ D) := + lemma_7_1_claim_2 hlam h𝒯 h𝒯' hCD_𝒯 hDC_𝒯' hdist + have hax2 := hlam.axiom2 hsepCD hsepAB + rw [GM10.union_comm C A, GM10.inter_comm D B, + GM10.inter_comm C A, GM10.union_comm D B] at hax2 + have hle_CD : lam (A ∪ C, B ∩ D) ≤ lam (C, D) := + hax2.resolve_right (not_lt_of_ge hclaim2) + have hlam_eq : lam (A ∪ C, B ∩ D) = lam (C, D) := le_antisymm hle_CD hclaim1 + rcases (hlam.axiom1 hsep_union hsepCD).1 hlam_eq with ⟨hAC, hBD⟩ | ⟨hAD, hBC⟩ + · exact ⟨hAC ▸ GM10.le_union_left hsepAB.left_le hsepCD.left_le, + hBD.symm ▸ GM10.inter_le_left hsepAB.right_le hsepCD.right_le⟩ + · exfalso + have hord_CD_lt : separationOrder C D < θ' := + (separationOrder_lt_of_locationOrder_lt hℒ hord hCD_ℒ).trans_le hθ_le' + have hsep_swap : G.IsSeparation (B ∩ D) (A ∪ C) := hsep_union.symm + have hord_swap_lt : separationOrder (B ∩ D) (A ∪ C) < θ' := by + rw [hBC, hAD] + exact hord_CD_lt + have hswap_𝒯' : (B ∩ D, A ∪ C) ∈ 𝒯' := + GM10.theorem_2_9_proof h𝒯' hBA_𝒯' hsep_swap hord_swap_lt + (Or.inr (Or.inl Set.inter_subset_left)) + rw [hBC, hAD] at hswap_𝒯' + exact GM10.theorem_2_1_proof h𝒯' hDC_𝒯' hswap_𝒯' + +end GraphMinor.GM18 diff --git a/LeanPool/GraphMinor/GM19/ArcDirection.lean b/LeanPool/GraphMinor/GM19/ArcDirection.lean new file mode 100644 index 0000000000..878c296cd3 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/ArcDirection.lean @@ -0,0 +1,187 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.CuffPieces + +/-! +# Directions along a cuff + +A side of a frame on a cuff, and a border edge inside it, are both open arcs of the cuff. If we read +both +in the same sense, then the direction of the edge agrees with the direction of the side, in the +sense of +`DirAgrees`. This file proves that, for either sense, and that an arc inside an arc can be shifted +by a +multiple of `2π` to have its angles between those of the larger arc. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] [T2Space S] {Θ : Set S} (f : Circle ≃ₜ Θ) + +omit [T2Space S] in +/-- If an open arc lies in an open arc whose two ends are not on it, then a shift by a multiple of +`2π` puts +the angles of the first between those of the second. -/ +theorem exists_shift {a b a' b' : ℝ} (hab : a < b) (hab' : a' < b') (hub : b < a + 2 * Real.pi) + (hsub : arcOf f a' b' ⊆ arcOf f a b) : + ∃ m : ℤ, a ≤ a' + m * (2 * Real.pi) ∧ b' + m * (2 * Real.pi) ≤ b := by + have hpi := Real.pi_pos + have hmid : cuffPoint f ((a' + b') / 2) ∈ arcOf f a b := + hsub ⟨_, ⟨by linarith, by linarith⟩, rfl⟩ + obtain ⟨s, hs, hse⟩ := hmid + obtain ⟨m, hm⟩ := cuffPoint_eq f hse + have hnot : ∀ {r : ℝ}, r ∈ Ioo a' b' → ∀ k : ℤ, r + k * (2 * Real.pi) ≠ a ∧ + r + k * (2 * Real.pi) ≠ b := by + intro r hr k + have hrm : cuffPoint f r ∈ arcOf f a b := hsub ⟨r, hr, rfl⟩ + obtain ⟨q, hq, hqe⟩ := hrm + have hpt : ∀ c, r + k * (2 * Real.pi) = c → cuffPoint f q = cuffPoint f c := by + intro c hc + rw [hqe, ← hc, cuffPoint_shift] + have hi := fun c (hc : c ∈ Ico a (a + 2 * Real.pi)) (he : cuffPoint f q = cuffPoint f c) ↦ + cuffPoint_injOn f le_rfl ⟨hq.1.le, by linarith [hq.2]⟩ hc he + refine ⟨fun h ↦ ?_, fun h ↦ ?_⟩ + · have := hi a ⟨le_rfl, by linarith⟩ (hpt a h) + linarith [hq.1] + · have := hi b ⟨hab.le, hub⟩ (hpt b h) + linarith [hq.2] + refine ⟨m, ?_, ?_⟩ + · by_contra hn + push Not at hn + refine (hnot (r := a - m * (2 * Real.pi)) ⟨by linarith, by linarith [hs.1]⟩ m).1 (by ring) + · by_contra hn + push Not at hn + refine (hnot (r := b - m * (2 * Real.pi)) ⟨by linarith [hs.2], by linarith⟩ m).2 (by ring) + +/-- A continuous reading of the interval `[a, b]` by the unit interval gives a homeomorphism onto +the +closed arc. -/ +theorem exists_homeo_arc {a b : ℝ} (hab : a < b) (hub : b < a + 2 * Real.pi) {m : unitInterval → ℝ} + (hm : Continuous m) (hbij : BijOn m univ (Icc a b)) : + ∃ g : unitInterval ≃ₜ closure (arcOf f a b), ∀ t, (g t).1 = cuffPoint f (m t) := by + have hcl := closure_arcOf f hab + have hmem : ∀ t, cuffPoint f (m t) ∈ closure (arcOf f a b) := fun t ↦ by + rw [hcl] + exact mem_image_of_mem _ (hbij.mapsTo (mem_univ t)) + let ι : unitInterval → closure (arcOf f a b) := fun t ↦ ⟨cuffPoint f (m t), hmem t⟩ + have hc : Continuous ι := ((continuous_cuffPoint f).comp hm).subtype_mk _ + have hb : Function.Bijective ι := by + constructor + · intro s t hst + have h : (ι s).1 = (ι t).1 := by rw [hst] + exact hbij.injOn (mem_univ _) (mem_univ _) (cuffPoint_injOn_Icc f hub + (hbij.mapsTo (mem_univ s)) (hbij.mapsTo (mem_univ t)) h) + · rintro ⟨y, hy⟩ + rw [hcl] at hy + obtain ⟨c, hc', rfl⟩ := hy + obtain ⟨t, -, rfl⟩ := hbij.surjOn hc' + exact ⟨t, rfl⟩ + exact ⟨Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective ι hb) hc, fun _ ↦ rfl⟩ + +omit [T2Space S] in +theorem arcOf_mono {a b a' b' : ℝ} (h₁ : a ≤ a') (h₂ : b' ≤ b) : arcOf f a' b' ⊆ arcOf f a b := + image_mono (Ioo_subset_Ioo h₁ h₂) + +/-- Reading the cuff forward: the direction of a sub-arc agrees with that of the arc. -/ +theorem dirAgrees_forward {a b a' b' : ℝ} (hub : b < a + 2 * Real.pi) (h₁ : a ≤ a') (h₂ : a' < b') + (h₃ : b' ≤ b) : + DirAgrees (arcOf f a b) [cuffPoint f a, cuffPoint f b] (arcOf f a' b') + [cuffPoint f a', cuffPoint f b'] := by + have hab : a < b := by linarith + have hl : 0 < b - a := by linarith + let m : unitInterval → ℝ := fun t ↦ a + t * (b - a) + have hm : Continuous m := by fun_prop + have hbij : BijOn m univ (Icc a b) := by + refine ⟨fun t _ ↦ ?_, fun s _ t _ h ↦ ?_, fun c hc ↦ ?_⟩ + · have h0 := t.2.1 + have h1 := t.2.2 + exact ⟨by nlinarith, by nlinarith⟩ + · have h' : (s : ℝ) * (b - a) = t * (b - a) := by + have : a + (s : ℝ) * (b - a) = a + t * (b - a) := h + linarith + exact Subtype.ext (mul_right_cancel₀ hl.ne' h') + · refine ⟨⟨(c - a) / (b - a), div_nonneg (by linarith [hc.1]) hl.le, + (div_le_one hl).mpr (by linarith [hc.2])⟩, mem_univ _, ?_⟩ + change a + (c - a) / (b - a) * (b - a) = c + field_simp + ring + obtain ⟨g, hg⟩ := exists_homeo_arc f hab hub hm hbij + have hval : ∀ x (hx : x ∈ Icc a b), ∃ t : unitInterval, m t = x := fun x hx ↦ by + obtain ⟨t, -, ht⟩ := hbij.surjOn hx + exact ⟨t, ht⟩ + obtain ⟨t₁, ht₁⟩ := hval a' ⟨h₁, by linarith⟩ + obtain ⟨t₂, ht₂⟩ := hval b' ⟨by linarith, h₃⟩ + refine ⟨g, t₁, t₂, ?_, arcOf_mono f h₁ h₃, ?_, ?_, ?_, ?_⟩ + · have hlt : m t₁ < m t₂ := by rw [ht₁, ht₂]; exact h₂ + have : (t₁ : ℝ) < t₂ := by + by_contra hn + have hle : (t₂ : ℝ) ≤ t₁ := not_lt.mp hn + have : (t₂ : ℝ) * (b - a) ≤ t₁ * (b - a) := mul_le_mul_of_nonneg_right hle hl.le + change a + (t₁ : ℝ) * (b - a) < a + t₂ * (b - a) at hlt + linarith + exact this + · simp only [List.head?_cons, hg] + simp [m] + · simp only [List.getLast?_cons_cons, List.getLast?_singleton, hg] + simp [m] + · simp only [List.head?_cons, hg, ht₁] + · simp only [List.getLast?_cons_cons, List.getLast?_singleton, hg, ht₂] + +/-- Reading the cuff backward: the direction of a sub-arc agrees with that of the arc. -/ +theorem dirAgrees_backward {a b a' b' : ℝ} (hub : b < a + 2 * Real.pi) (h₁ : a ≤ a') (h₂ : a' < b') + (h₃ : b' ≤ b) : + DirAgrees (arcOf f a b) [cuffPoint f b, cuffPoint f a] (arcOf f a' b') + [cuffPoint f b', cuffPoint f a'] := by + have hab : a < b := by linarith + have hl : 0 < b - a := by linarith + let m : unitInterval → ℝ := fun t ↦ b - t * (b - a) + have hm : Continuous m := by fun_prop + have hbij : BijOn m univ (Icc a b) := by + refine ⟨fun t _ ↦ ?_, fun s _ t _ h ↦ ?_, fun c hc ↦ ?_⟩ + · have h0 := t.2.1 + have h1 := t.2.2 + exact ⟨by nlinarith, by nlinarith⟩ + · have h' : (s : ℝ) * (b - a) = t * (b - a) := by + have : b - (s : ℝ) * (b - a) = b - t * (b - a) := h + linarith + exact Subtype.ext (mul_right_cancel₀ hl.ne' h') + · refine ⟨⟨(b - c) / (b - a), div_nonneg (by linarith [hc.2]) hl.le, + (div_le_one hl).mpr (by linarith [hc.1])⟩, mem_univ _, ?_⟩ + change b - (b - c) / (b - a) * (b - a) = c + field_simp + ring + obtain ⟨g, hg⟩ := exists_homeo_arc f hab hub hm hbij + have hval : ∀ x (hx : x ∈ Icc a b), ∃ t : unitInterval, m t = x := fun x hx ↦ by + obtain ⟨t, -, ht⟩ := hbij.surjOn hx + exact ⟨t, ht⟩ + obtain ⟨t₁, ht₁⟩ := hval b' ⟨by linarith, h₃⟩ + obtain ⟨t₂, ht₂⟩ := hval a' ⟨h₁, by linarith⟩ + refine ⟨g, t₁, t₂, ?_, arcOf_mono f h₁ h₃, ?_, ?_, ?_, ?_⟩ + · have hlt : m t₂ < m t₁ := by rw [ht₁, ht₂]; exact h₂ + have : (t₁ : ℝ) < t₂ := by + by_contra hn + have hle : (t₂ : ℝ) ≤ t₁ := not_lt.mp hn + have : (t₂ : ℝ) * (b - a) ≤ t₁ * (b - a) := mul_le_mul_of_nonneg_right hle hl.le + change b - (t₂ : ℝ) * (b - a) < b - t₁ * (b - a) at hlt + linarith + exact this + · simp only [List.head?_cons, hg] + simp [m] + · simp only [List.getLast?_cons_cons, List.getLast?_singleton, hg] + simp [m] + · simp only [List.head?_cons, hg, ht₁] + · simp only [List.getLast?_cons_cons, List.getLast?_singleton, hg, ht₂] + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/BiteArc.lean b/LeanPool/GraphMinor/GM19/BiteArc.lean new file mode 100644 index 0000000000..93ca985a9a --- /dev/null +++ b/LeanPool/GraphMinor/GM19/BiteArc.lean @@ -0,0 +1,584 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FreeData +public import LeanPool.GraphMinor.GM19.CuffAngle +import LeanPool.GraphMinor.GM19.Section6Cuff + +/-! +# The shape of a bite + +A bite `F` at a pole `r*` runs through `r*` along two spokes `β`, a chord of the cuff disc `E`. One +side of the chord lies in `ins(F)` and the other +misses it, apart from vertices of `F` on the cuff (`exists_bite_shape`). So `I(F)` is the arc of the +cuff on the first side (`IsBiteShape.biteArc_eq`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +/-- A line in an `O`-arc that holds the two ends of a line `L₁` of that `O`-arc is `L₁`, or it holds +all of the `O`-arc off `L₁`. -/ +theorem line_of_oArc {T : Type} [TopologicalSpace T] [T2Space T] {c L₁ I : Set T} {a b : T} + (hc : IsOArc c) (hl : IsLineWithEnds L₁ a b) (hLc : L₁ ⊆ c) + {u v : T} (hI : IsLineWithEnds I u v) (hIc : I ⊆ c) (huv : ({u, v} : Set T) = {a, b}) : I = L₁ + ∨ c \ L₁ ⊆ I := by + have ha : a ∈ I := by + have : a ∈ ({u, v} : Set T) := huv ▸ mem_insert _ _ + rcases this with rfl | h + · exact (ends_of_line hI).1 + · exact (mem_singleton_iff.1 h) ▸ (ends_of_line hI).2.1 + have hb : b ∈ I := by + have : b ∈ ({u, v} : Set T) := huv ▸ mem_insert_of_mem _ rfl + rcases this with rfl | h + · exact (ends_of_line hI).1 + · exact (mem_singleton_iff.1 h) ▸ (ends_of_line hI).2.1 + obtain ⟨f, h0, hpi, himg⟩ := exists_angle_of_line hc hl hLc + have hpos := Real.pi_pos + have hcover : c ⊆ cuffPoint f '' Icc 0 Real.pi ∪ cuffPoint f '' Icc Real.pi (0 + 2 * Real.pi) + := fun z hz ↦ by + obtain ⟨t, ht, rfl⟩ := exists_cuffAngle_eq f 0 hz + by_cases h : t ≤ Real.pi + · exact Or.inl ⟨t, ⟨ht.1, h⟩, rfl⟩ + · exact Or.inr ⟨t, ⟨(not_le.1 h).le, ht.2.le⟩, rfl⟩ + rcases arc_of_preconnected f (isPreconnected_of_line hI) hIc (x₁ := 0) (x₂ := Real.pi) hpos.le + (by linarith) (by rwa [h0]) (by rwa [hpi]) with h | h + · left + have hsub : L₁ ⊆ I := by + rw [← himg] + rintro _ ⟨t, ht, rfl⟩ + exact h t ht + obtain ⟨g, g0, g1⟩ := hI + apply Subset.antisymm _ hsub + -- The line `L₁` holds both ends of `I`, so its preimage is all of `[0, 1]`. + have hconn : IsPreconnected (g ⁻¹' (Subtype.val ⁻¹' L₁)) := by + have hL' : IsPreconnected (Subtype.val ⁻¹' L₁ : Set I) := by + refine Topology.IsInducing.subtypeVal.isPreconnected_image.1 ?_ + rw [Subtype.image_preimage_coe] + have : I ∩ L₁ = L₁ := inter_eq_right.2 hsub + rw [this] + exact isPreconnected_of_line hl + have := hL'.image g.symm g.symm.continuous.continuousOn + rwa [Homeomorph.image_symm] at this + have hconv := (isPreconnected_iff_ordConnected.1 hconn) + have hu : u ∈ L₁ := by + have : u ∈ ({a, b} : Set T) := huv ▸ mem_insert _ _ + rcases this with rfl | h' + · exact (ends_of_line hl).1 + · exact (mem_singleton_iff.1 h') ▸ (ends_of_line hl).2.1 + have hv : v ∈ L₁ := by + have : v ∈ ({a, b} : Set T) := huv ▸ mem_insert_of_mem _ rfl + rcases this with rfl | h' + · exact (ends_of_line hl).1 + · exact (mem_singleton_iff.1 h') ▸ (ends_of_line hl).2.1 + intro z hz + have h₀ : (0 : unitInterval) ∈ g ⁻¹' (Subtype.val ⁻¹' L₁) := by + change (g 0).1 ∈ L₁ + rw [g0] + exact hu + have h₁ : (1 : unitInterval) ∈ g ⁻¹' (Subtype.val ⁻¹' L₁) := by + change (g 1).1 ∈ L₁ + rw [g1] + exact hv + have hm := hconv.out h₀ h₁ (show g.symm ⟨z, hz⟩ ∈ Icc 0 1 from ⟨bot_le, le_top⟩) + simpa using hm + · right + rintro z ⟨hzc, hzL⟩ + rcases hcover hzc with h' | ⟨t, ht, rfl⟩ + · exact absurd (himg ▸ h') hzL + · exact h t ht + +namespace TangleDatum + +variable {D : TangleDatum cap χ} + +/-- The shape of a bite `F` at `r`. Here `β` is the path of `F` through `r`, `L` is the rest of `F`, +and `E` is the closed cuff disc. `Di` and `Do` are the two +sides of `β` in `E`, with cuff arcs `A` and `A'`, and `Di` lies inside `F`. -/ +structure IsBiteShape (D : TangleDatum cap χ) (r : Shat) (Θ : Set S) (F : Drawing Shat) (v₁ v₂ : S) + (Β L A A' Di Do : Set Shat) : Prop where + circuit : F.IsCircuitOf D.rad.G + lt : F.E.ncard < 2 * D.rep + pole : r ∈ D.rad.poles + cuff : Θ ∈ cuffs S + reg : D.rad.regionOf r = cap.cuffDisc Θ + r_mem : r ∈ F.V + r_Β : r ∈ Β + v₁_mem : v₁ ∈ D.P.Γ.V + v₂_mem : v₂ ∈ D.P.Γ.V + v₁_cuff : v₁ ∈ Θ + v₂_cuff : v₂ ∈ Θ + ne : v₁ ≠ v₂ + line : IsLineWithEnds Β (cap.emb v₁) (cap.emb v₂) + Β_F : Β ⊆ F.U + Β_E : Β ⊆ closure (cap.cuffDisc Θ) + meet : Β ∩ cap.emb '' Θ = {cap.emb v₁, cap.emb v₂} + F_disc : ∀ x ∈ F.U, x ∈ cap.cuffDisc Θ → x ∈ Β + nbrs : {x | ∃ e ∈ F.E, closure e ∩ F.V = {r, x}} = {cap.emb v₁, cap.emb v₂} + L_line : IsLineWithEnds L (cap.emb v₁) (cap.emb v₂) + F_eq : F.U = Β ∪ L + Β_L : Β ∩ L = {cap.emb v₁, cap.emb v₂} + L_range : L ⊆ range cap.emb + di : IsClosedDisc Di + do_ : IsClosedDisc Do + union : Di ∪ Do = closure (cap.cuffDisc Θ) + inter : Di ∩ Do = Β + bd_i : discBd Di = A ∪ Β + bd_o : discBd Do = A' ∪ Β + A_sub : A ⊆ cap.emb '' Θ \ {cap.emb v₁, cap.emb v₂} + A'_sub : A' ⊆ cap.emb '' Θ \ {cap.emb v₁, cap.emb v₂} + cover : cap.emb '' Θ \ {cap.emb v₁, cap.emb v₂} ⊆ A ∪ A' + A'_conn : IsPreconnected A' + in_ins : discInt Di ⊆ discInt (D.ins F) + out_ins : Disjoint (discInt Do) (D.ins F) + in_E : discInt Di ⊆ discInt (closure (cap.cuffDisc Θ)) \ Β + +variable (hS : IsSurface S) (h3 : D.P.Γ.IsInternallyThreeConnected) +include hS h3 + +/-- **Every bite that meets no other pole has its shape.** -/ +theorem exists_bite_shape {r : Shat} {F : Drawing Shat} (hFc : F.IsCircuitOf D.rad.G) + (hlt : F.E.ncard < 2 * D.rep) (hr : r ∈ D.rad.poles) {Θ : Set S} + (hΘ : Θ ∈ cuffs S) (hreg : D.rad.regionOf r = cap.cuffDisc Θ) (hrF : r ∈ F.V) + (hone : ∀ p ∈ D.rad.poles, p ∈ F.V → p = r) : + ∃ v₁ v₂ Β L A A' Di Do, D.IsBiteShape r Θ F v₁ v₂ Β L A A' Di Do := by + classical + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have : ConnectedSpace Shat := cap.connected + have hi := D.ins_spec hFc hlt + have hdisc := hi.2.2.1 + have hbd : discBd (D.ins F) = F.U := hi.2.2.2.1 + have hE := cap.cuffDisc_closedDisc Θ hΘ + have hrd : r ∈ cap.cuffDisc Θ := hreg ▸ (D.rad.regionOf_mem hr.1).2 + have hcover := U_subset_of_one_pole hFc.1 hreg hrd hone + obtain ⟨e₁, e₂, v₁, v₂, he₁, he₂, hv₁, hv₂, hne, hs₁, hs₂, hedges⟩ := D.rad.circuit_edges hS h3 + hFc hrF hr.1 + obtain ⟨hd₁, hvΘ₁⟩ := D.rad.pole_edge (hFc.1.2 he₁) hr hΘ hreg hs₁ + obtain ⟨hd₂, hvΘ₂⟩ := D.rad.pole_edge (hFc.1.2 he₂) hr hΘ hreg hs₂ + set G := D.rad.G with hG + have hrnr := D.pole_notMem_range hr + have hvG : ∀ {v}, v ∈ D.P.Γ.V → cap.emb v ∈ G.V := fun hv ↦ D.rad.isPreRadial.2.1 + (mem_image_of_mem _ hv) + have hvp : ∀ {v}, v ∈ D.P.Γ.V → cap.emb v ≠ r := fun hv h ↦ hr.1.2 (h ▸ mem_image_of_mem _ hv) + have hsne : cap.emb v₁ ≠ cap.emb v₂ := fun h ↦ hne (cap.isEmbedding.injective h) + have hclE : ∀ {e x}, e ∈ G.E → closure e ∩ G.V = {x, r} → closure e ⊆ closure (cap.cuffDisc Θ) + := fun he hs ↦ + closure_mono (hreg ▸ D.rad.edge_subset_region he hr.1 (by rw [hs])) + set Β : Set Shat := closure e₁ ∪ closure e₂ with hΒ + have hm₁ : cap.emb v₁ ∈ closure e₁ := (hs₁ ▸ mem_insert _ _ : cap.emb v₁ ∈ closure e₁ ∩ G.V).1 + have hm₂ : cap.emb v₂ ∈ closure e₂ := (hs₂ ▸ mem_insert _ _ : cap.emb v₂ ∈ closure e₂ ∩ G.V).1 + have hr₁ : r ∈ closure e₁ := (hs₁ ▸ mem_insert_of_mem _ rfl : r ∈ closure e₁ ∩ G.V).1 + have hr₂ : r ∈ closure e₂ := (hs₂ ▸ mem_insert_of_mem _ rfl : r ∈ closure e₂ ∩ G.V).1 + have hΒF : Β ⊆ F.U := union_subset (F.closure_subset_U he₁) (F.closure_subset_U he₂) + have hΒline : IsLineWithEnds Β (cap.emb v₁) (cap.emb v₂) := by + have hl₁ : G.toGraph.IsLink e₁ (cap.emb v₁) r := ⟨hFc.1.2 he₁, hvG hv₁, hr.1.1, hs₁⟩ + have hl₂ : G.toGraph.IsLink e₂ r (cap.emb v₂) := ⟨hFc.1.2 he₂, hr.1.1, hvG hv₂, by rw [hs₂, + pair_comm]⟩ + let W : GraphWalk G.toGraph (cap.emb v₁) (cap.emb v₂) := .cons hl₁ (.cons hl₂ (.nil (hvG hv₂))) + have hWs : W.IsSimple := by + simp [GraphWalk.IsSimple, W, GraphWalk.support, hvp hv₁, hsne, (hvp hv₂).symm] + have := walk_isLine G W hWs hsne + have heq : ({x | x ∈ W.support} ∪ ⋃ e ∈ {e | e ∈ W.edges}, closure e) = Β := by + apply Subset.antisymm + · rintro x (hx | hx) + · simp only [W, GraphWalk.support, mem_ofPred_eq, List.mem_cons, List.not_mem_nil, + or_false] at hx + rcases hx with rfl | rfl | rfl + · exact Or.inl hm₁ + · exact Or.inl hr₁ + · exact Or.inr hm₂ + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.1 hx + simp only [W, GraphWalk.edges, mem_ofPred_eq, List.mem_cons, List.not_mem_nil, or_false] + at hf + rcases hf with rfl | rfl + · exact Or.inl hxf + · exact Or.inr hxf + · rintro x (h | h) + · exact Or.inr (mem_biUnion (by simp [W, GraphWalk.edges]) h) + · exact Or.inr (mem_biUnion (by simp [W, GraphWalk.edges]) h) + rwa [heq] at this + have hΒr : ∀ {x}, x ∈ Β → x ∈ range cap.emb → x = cap.emb v₁ ∨ x = cap.emb v₂ := by + have key : ∀ {e : Set Shat} {v : S} {x}, e ∈ G.E → closure e ∩ G.V = {cap.emb v, r} + → Disjoint e (range cap.emb) → x ∈ closure e → + x ∈ range cap.emb → x = cap.emb v := by + intro e v x he hs hdj hx hxr + by_cases hxe : x ∈ e + · exact absurd hxr (disjoint_left.1 hdj hxe) + · have hxG : x ∈ G.V := by + by_contra hn + have : x ∈ closure e \ G.V := ⟨hx, hn⟩ + rw [G.closure_diff_V he] at this + exact hxe this + have hm : x ∈ ({cap.emb v, r} : Set Shat) := hs ▸ ⟨hx, hxG⟩ + rcases hm with h | h + · exact h + · exact absurd (h ▸ hxr) hrnr + rintro x (h | h) hxr + · exact Or.inl (key (hFc.1.2 he₁) hs₁ hd₁ h hxr) + · exact Or.inr (key (hFc.1.2 he₂) hs₂ hd₂ h hxr) + obtain ⟨u, w, h2a, hru, hu0, hu1, hun⟩ := exists_arcs_of_line (IsCircuit.isOArc_U hFc.2) hΒline + hΒF + set L : Set Shat := range w with hL + have hLline : IsLineWithEnds L (cap.emb v₁) (cap.emb v₂) := by + have := h2a.arc_right.isLineWithEnds + rwa [h2a.zero, h2a.one, hu0, hu1] at this + have hΒL : Β ∩ L = {cap.emb v₁, cap.emb v₂} := by + have := h2a.inter + rwa [hru, hu0, hu1] at this + have hFL : F.U = Β ∪ L := by rw [← hun, hru] + have hFcd : ∀ x ∈ F.U, x ∈ cap.cuffDisc Θ → x ∈ Β := by + intro x hxF hxd + have hxr : x ∉ range cap.emb := cap.notMem_range hΘ hxd + by_cases hxV : x ∈ F.V + · have hxh : x ∉ D.P.Γ.hatV cap := fun ⟨v, _, hv⟩ ↦ hxr ⟨v, hv⟩ + have hw : x ∈ D.rad.Rstar := ⟨hFc.1.1 hxV, hxh⟩ + by_cases hp : x ∈ D.rad.poles + · rw [hone x hp hxV] + exact Or.inl hr₁ + · exact absurd (D.rad.region_subset_range hw hp (D.rad.regionOf_mem hw).2) hxr + · obtain ⟨f, hf, hxf⟩ := F.exists_edge_of_mem hxF hxV + obtain ⟨v, -, w', hw', hset⟩ := D.rad.edge_ends (hFc.1.2 hf) + have hwm : w' ∈ closure f ∩ G.V := by rw [hset]; exact Or.inr rfl + have hwF : w' ∈ F.V := mem_V_of_mem_U hFc.1 (F.closure_subset_U hf hwm.1) hwm.2 + by_cases hp : w' ∈ D.rad.poles + · have hwr := hone w' hp hwF + rw [hwr] at hwm + rcases hedges f hf hwm.1 with rfl | rfl + · exact Or.inl (subset_closure hxf) + · exact Or.inr (subset_closure hxf) + · exact absurd (D.rad.edge_subset_range (hFc.1.2 hf) hw' hp hset hxf) hxr + have hLr : L ⊆ range cap.emb := fun x hx ↦ by + have hxF : x ∈ F.U := hFL ▸ Or.inr hx + rcases hcover hxF with h | h + · exact h + · have : x ∈ Β ∩ L := ⟨hFcd x hxF h, hx⟩ + rw [hΒL] at this + rcases this with h' | h' + · exact ⟨_, h'.symm⟩ + · exact ⟨_, (mem_singleton_iff.1 h').symm⟩ + have hEb : discBd (closure (cap.cuffDisc Θ)) = cap.emb '' Θ := cap.cuffDisc_bd Θ hΘ + have hdE : cap.cuffDisc Θ = discInt (closure (cap.cuffDisc Θ)) := cap.cuffDisc_eq_discInt hΘ + have hΒE : Β ⊆ closure (cap.cuffDisc Θ) := union_subset (hclE (hFc.1.2 he₁) hs₁) (hclE + (hFc.1.2 he₂) hs₂) + have hmeet : Β ∩ cap.emb '' Θ = {cap.emb v₁, cap.emb v₂} := by + apply Subset.antisymm + · rintro x ⟨hx, y, -, rfl⟩ + exact hΒr hx (mem_range_self y) + · rintro _ (rfl | h) + · exact ⟨Or.inl hm₁, mem_image_of_mem _ hvΘ₁⟩ + · rw [mem_singleton_iff.1 h] + exact ⟨Or.inr hm₂, mem_image_of_mem _ hvΘ₂⟩ + have hoff : discInt (closure (cap.cuffDisc Θ)) ∩ discBd (D.ins F) ⊆ Β := by + rw [← hdE, hbd] + exact fun x hx ↦ hFcd x hx.2 hx.1 + have hnbrs : {x | ∃ e ∈ F.E, closure e ∩ F.V = {r, x}} = {cap.emb v₁, cap.emb v₂} := by + have hinter : ∀ {e x}, e ∈ F.E → closure e ∩ G.V = {x, r} → closure e ∩ F.V = {r, x} + := fun {e x} he hs ↦ by + rw [hFc.1.closure_inter_V he, hs, pair_comm] + apply Subset.antisymm + · rintro x ⟨e, he, hs⟩ + have hre : r ∈ closure e := (hs ▸ mem_insert _ _ : r ∈ closure e ∩ F.V).1 + rcases hedges e he hre with rfl | rfl + · rw [hinter he hs₁] at hs + have hne' := hvp hv₁ + have := (Set.pair_eq_pair_iff.1 hs) + rcases this with ⟨-, h⟩ | ⟨-, h⟩ + · exact Or.inl h.symm + · exact absurd h hne' + · rw [hinter he hs₂] at hs + have hne' := hvp hv₂ + have := (Set.pair_eq_pair_iff.1 hs) + rcases this with ⟨-, h⟩ | ⟨-, h⟩ + · exact Or.inr h.symm + · exact absurd h hne' + · rintro x (rfl | h) + · exact ⟨e₁, he₁, hinter he₁ hs₁⟩ + · rw [mem_singleton_iff.1 h] + exact ⟨e₂, he₂, hinter he₂ hs₂⟩ + obtain ⟨A, A', Di, Do, hD, hD', hun', hint, hbd', hbd'', hAs, hAs', hcov, hApc, hin, hout, hi₁, + -, -⟩ := + exists_chord_side hT hdisc hE hsne hΒline (hbd ▸ hΒF) hΒE (by rw [hEb]; exact hmeet) hoff + rw [hEb] at hAs hAs' hcov + exact ⟨v₁, v₂, Β, L, A, A', Di, Do, hFc, hlt, hr, hΘ, hreg, hrF, Or.inl hr₁, hv₁, hv₂, hvΘ₁, + hvΘ₂, hne, hΒline, hΒF, hΒE, hmeet, hFcd, hnbrs, hLline, + hFL, hΒL, hLr, hD, hD', hun', hint, hbd', hbd'', hAs, hAs', hcov, hApc, hin, hout, hi₁⟩ + +omit hS h3 in +omit [T2Space S] in +/-- The inner arc lies inside `F`. -/ +theorem IsBiteShape.A_ins {r Θ F v₁ v₂ Β L A A' Di Do} (h : D.IsBiteShape r Θ F v₁ v₂ Β L A A' Di + Do) : A ⊆ D.ins F := by + have : ConnectedSpace Shat := cap.connected + have hT := cap.isClosedSurface + have hi := D.ins_spec h.circuit h.lt + have hDΔ : Di ⊆ D.ins F := by + rw [← closure_discInt h.di] + exact closure_minimal (h.in_ins.trans (discInt_subset _)) hi.2.2.1.isClosed + exact fun x hx ↦ hDΔ (Surface.discBd_subset _ (h.bd_i ▸ Or.inl hx)) + +omit hS h3 in +omit [T2Space S] in +/-- A point of the outer arc inside `F` lies on `F`. -/ +theorem IsBiteShape.A'_inter {r Θ F v₁ v₂ Β L A A' Di Do} (h : D.IsBiteShape r Θ F v₁ v₂ Β L A A' + Di Do) {x : Shat} (hx : x ∈ A') (hxi : x ∈ D.ins F) : x ∈ F.U := by + have : ConnectedSpace Shat := cap.connected + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have hi := D.ins_spec h.circuit h.lt + by_contra hn + have hxint : x ∈ discInt (D.ins F) := ⟨hxi, fun hb ↦ hn (hi.2.2.2.1 ▸ hb)⟩ + have hxcl : x ∈ closure (discInt Do) := (closure_discInt h.do_).symm ▸ Surface.discBd_subset _ + (h.bd_o ▸ Or.inl hx) + obtain ⟨w, hwi, hw⟩ := _root_.mem_closure_iff.1 hxcl _ (hi.2.2.1.isOpen_discInt hman) hxint + exact disjoint_left.1 h.out_ins hw (discInt_subset _ hwi) + +omit hS h3 in +/-- A line of infinitely many points. -/ +theorem infinite_of_line {T : Type} [TopologicalSpace T] {L : Set T} {a b : T} + (hl : IsLineWithEnds L a b) : L.Infinite := by + obtain ⟨f, -, -⟩ := hl + have : Infinite unitInterval := (Set.Icc_infinite (zero_lt_one' ℝ)).to_subtype + exact Set.infinite_coe_iff.1 (Infinite.of_injective _ f.injective) + +omit hS h3 in +/-- The part of the boundary of a disc off a line in that boundary, with the two ends, is a line. -/ +theorem line_of_discBd {T : Type} [TopologicalSpace T] [T2Space T] {Di A Β : Set T} {s t : T} + (hD : IsClosedDisc Di) (hbd : discBd Di = A ∪ Β) (hl : IsLineWithEnds Β s t) + (hdis : Disjoint A Β) (_hst : s ≠ t) : IsLineWithEnds (A ∪ {s, t}) s t := by + have hO : IsOArc (discBd Di) := hD.isOArc_discBd + obtain ⟨u, v, h2, hru, hu0, hu1, hun⟩ := exists_arcs_of_line hO hl (hbd ▸ subset_union_right) + have hline : IsLineWithEnds (range v) s t := by + have := h2.arc_right.isLineWithEnds + rwa [h2.zero, h2.one, hu0, hu1] at this + have hint : Β ∩ range v = {s, t} := by + have := h2.inter + rwa [hru, hu0, hu1] at this + have heq : A ∪ {s, t} = range v := by + apply Subset.antisymm + · rintro x (hx | hx) + · have : x ∈ range u ∪ range v := by + rw [hun, hbd] + exact Or.inl hx + rcases this with h | h + · exact absurd (hru ▸ h) (disjoint_left.1 hdis hx) + · exact h + · rw [← hint] at hx + exact hx.2 + · intro x hx + have hxO : x ∈ A ∪ Β := by + rw [← hbd, ← hun] + exact Or.inr hx + rcases hxO with h | h + · exact Or.inl h + · exact Or.inr (hint ▸ ⟨h, hx⟩) + rwa [heq] + +omit hS h3 in +omit [T2Space S] in +/-- **`I(F)` is the arc of the cuff on the inner side of the chord.** -/ +theorem IsBiteShape.biteArc_eq {r Θ F v₁ v₂ Β L A A' Di Do} + (h : D.IsBiteShape r Θ F v₁ v₂ Β L A A' Di Do) : + D.biteArc r F = A ∪ {cap.emb v₁, cap.emb v₂} := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hne : cap.emb v₁ ≠ cap.emb v₂ := fun he ↦ h.ne (cap.isEmbedding.injective he) + have hΒΘ : ∀ {B}, B ⊆ cap.emb '' Θ \ {cap.emb v₁, cap.emb v₂} → Disjoint B Β + := fun hB ↦ disjoint_left.2 fun x hx hxΒ ↦ + (hB hx).2 (h.meet ▸ ⟨hxΒ, (hB hx).1⟩) + have hlA := line_of_discBd h.di h.bd_i h.line (hΒΘ h.A_sub) hne + have hlA' := line_of_discBd h.do_ h.bd_o h.line (hΒΘ h.A'_sub) hne + have hE := cap.cuffDisc_closedDisc Θ h.cuff + have hO : IsOArc (cap.emb '' Θ) := cap.cuffDisc_bd Θ h.cuff ▸ hE.isOArc_discBd + have hs : cap.emb v₁ ∈ cap.emb '' Θ := mem_image_of_mem _ h.v₁_cuff + have ht : cap.emb v₂ ∈ cap.emb '' Θ := mem_image_of_mem _ h.v₂_cuff + have hAc : A ∪ {cap.emb v₁, cap.emb v₂} ⊆ cap.emb '' Θ := union_subset (fun x hx ↦ + (h.A_sub hx).1) (by + rintro x (rfl | hx) + · exact hs + · exact (mem_singleton_iff.1 hx) ▸ ht) + have hins : ∀ {x}, x ∈ F.U → x ∈ D.ins F := fun hx ↦ D.U_subset_ins h.circuit h.lt hx + have hAi : A ∪ {cap.emb v₁, cap.emb v₂} ⊆ D.ins F := union_subset h.A_ins (by + have hb₁ : cap.emb v₁ ∈ Β := (h.meet ▸ mem_insert _ _ : cap.emb v₁ ∈ Β ∩ cap.emb '' Θ).1 + have hb₂ : cap.emb v₂ ∈ Β := (h.meet ▸ mem_insert_of_mem _ rfl : cap.emb v₂ ∈ Β ∩ cap.emb '' + Θ).1 + rintro x (rfl | hx) + · exact hins (h.Β_F hb₁) + · exact (mem_singleton_iff.1 hx) ▸ hins (h.Β_F hb₂)) + have hcl : closure (D.rad.regionOf r) \ D.rad.regionOf r = cap.emb '' Θ := by + rw [h.reg, cap.closure_cuffDisc h.cuff] + ext x + constructor + · rintro ⟨hx | hx, hn⟩ + · exact absurd hx hn + · exact hx + · rintro ⟨y, hy, rfl⟩ + exact ⟨Or.inr (mem_image_of_mem _ hy), fun hd ↦ cap.notMem_range h.cuff hd (mem_range_self y)⟩ + have hmem : D.IsBiteArc r F (A ∪ {cap.emb v₁, cap.emb v₂}) := by + refine ⟨fun x hx ↦ ⟨hAi hx, hcl ▸ hAc hx⟩, cap.emb v₁, cap.emb v₂, h.nbrs, Or.inr ⟨hne, hlA⟩⟩ + have huniq : ∀ I, D.IsBiteArc r F I → I = A ∪ {cap.emb v₁, cap.emb v₂} := by + rintro I ⟨hsub, u, v, hset, hcase⟩ + rw [h.nbrs] at hset + have hIc : I ⊆ cap.emb '' Θ := fun x hx ↦ hcl ▸ (hsub hx).2 + rcases hcase with ⟨rfl, -⟩ | ⟨-, hI⟩ + · exfalso + have h₁ : cap.emb v₁ ∈ ({u, u} : Set Shat) := hset ▸ mem_insert _ _ + have h₂ : cap.emb v₂ ∈ ({u, u} : Set Shat) := hset ▸ mem_insert_of_mem _ rfl + simp only [pair_eq_singleton, mem_singleton_iff] at h₁ h₂ + exact hne (h₁.trans h₂.symm) + · rcases line_of_oArc hO hlA hAc hI hIc hset.symm with h' | h' + · exact h' + · exfalso + have hsubA : cap.emb '' Θ \ (A ∪ {cap.emb v₁, cap.emb v₂}) ⊆ F.V := by + rintro x ⟨hxΘ, hxn⟩ + have hxI := h' ⟨hxΘ, hxn⟩ + have hxst : x ∉ ({cap.emb v₁, cap.emb v₂} : Set Shat) := fun he ↦ hxn (Or.inr he) + rcases h.cover ⟨hxΘ, hxst⟩ with h₁ | h₁ + · exact absurd (Or.inl h₁) hxn + · obtain ⟨y, hy, rfl⟩ := hxΘ + have hyF := h.A'_inter h₁ (hsub hxI).1 + exact (D.rad.bd_point h.circuit.1 (cuff_subset_bd ⟨Θ, h.cuff⟩ hy) hyF).2.1 + refine (infinite_of_line hlA').mono ?_ (F.finite_V.union (toFinite {cap.emb v₁, + cap.emb v₂})) + rintro x (hx | hx) + · by_cases hxA : x ∈ A + · exfalso + have h₁ : x ∈ Di := Surface.discBd_subset _ (h.bd_i ▸ Or.inl hxA) + have h₂ : x ∈ Do := Surface.discBd_subset _ (h.bd_o ▸ Or.inl hx) + exact disjoint_left.1 (hΒΘ h.A_sub) hxA (h.inter ▸ ⟨h₁, h₂⟩) + · exact Or.inl (hsubA ⟨(h.A'_sub hx).1, fun hc ↦ hc.elim hxA (h.A'_sub hx).2⟩) + · exact Or.inr hx + apply Subset.antisymm + · rintro x ⟨I, hI, hx⟩ + exact huniq I hI ▸ hx + · exact fun x hx ↦ ⟨_, hmem, hx⟩ + +omit hS h3 in +omit [T2Space S] in +/-- An edge of `Γ` on the cuff inside `F` lies on the arc `I(F)`. -/ +theorem IsBiteShape.edge_subset {r Θ F v₁ v₂ Β L A A' Di Do} + (h : D.IsBiteShape r Θ F v₁ v₂ Β L A A' Di Do) {e : Set S} (he : e ∈ D.P.Γ.E) (heΘ : e ⊆ Θ) + (hi : cap.emb '' e ⊆ D.ins F) : cap.emb '' e ⊆ D.biteArc r F := by + rw [h.biteArc_eq] + rintro _ ⟨x, hx, rfl⟩ + have hoff : cap.emb x ∉ F.U := disjoint_left.1 (disc_edge_disjoint D.rad h.circuit.1 he) + (mem_image_of_mem _ hx) + have hst : cap.emb x ∉ ({cap.emb v₁, cap.emb v₂} : Set Shat) := fun hm ↦ hoff (h.Β_F + (h.meet ▸ hm : cap.emb x ∈ Β ∩ cap.emb '' Θ).1) + rcases h.cover ⟨mem_image_of_mem _ (heΘ hx), hst⟩ with h₁ | h₁ + · exact Or.inl h₁ + · exact absurd (h.A'_inter h₁ (hi (mem_image_of_mem _ hx))) hoff + +omit hS h3 in +omit [T2Space S] in +/-- The arc `I(F)` lies inside `F` and on the cuff. -/ +theorem IsBiteShape.biteArc_subset {r Θ F v₁ v₂ Β L A A' Di Do} + (h : D.IsBiteShape r Θ F v₁ v₂ Β L A A' Di Do) : + D.biteArc r F ⊆ D.ins F ∩ cap.emb '' Θ := by + have : ConnectedSpace Shat := cap.connected + rw [h.biteArc_eq] + have hb₁ : cap.emb v₁ ∈ Β := (h.meet ▸ mem_insert _ _ : cap.emb v₁ ∈ Β ∩ cap.emb '' Θ).1 + have hb₂ : cap.emb v₂ ∈ Β := (h.meet ▸ mem_insert_of_mem _ rfl : cap.emb v₂ ∈ Β ∩ cap.emb '' Θ).1 + rintro x (hx | rfl | hx) + · exact ⟨h.A_ins hx, (h.A_sub hx).1⟩ + · exact ⟨D.U_subset_ins h.circuit h.lt (h.Β_F hb₁), mem_image_of_mem _ h.v₁_cuff⟩ + · rw [mem_singleton_iff.1 hx] + exact ⟨D.U_subset_ins h.circuit h.lt (h.Β_F hb₂), mem_image_of_mem _ h.v₂_cuff⟩ + +omit hS h3 in +omit [T2Space S] in +/-- The arc `I(F)` read in `Σ` is connected. -/ +theorem IsBiteShape.isPreconnected_biteArc {r Θ F v₁ v₂ Β L A A' Di Do} + (h : D.IsBiteShape r Θ F v₁ v₂ Β L A A' Di Do) : + IsPreconnected (cap.emb ⁻¹' D.biteArc r F) := by + have hne : cap.emb v₁ ≠ cap.emb v₂ := fun he ↦ h.ne (cap.isEmbedding.injective he) + have hdis : Disjoint A Β := disjoint_left.2 fun x hx hxΒ ↦ (h.A_sub hx).2 (h.meet ▸ ⟨hxΒ, + (h.A_sub hx).1⟩) + have hl := line_of_discBd h.di h.bd_i h.line hdis hne + rw [← h.biteArc_eq] at hl + rw [← cap.isEmbedding.isInducing.isPreconnected_image, image_preimage_eq_of_subset fun x hx ↦ by + obtain ⟨y, -, rfl⟩ := (h.biteArc_subset hx).2 + exact mem_range_self y] + exact isPreconnected_of_line hl + +omit hS h3 in +omit [T2Space S] in +/-- The arc `I(F)` is a line. -/ +theorem IsBiteShape.isLine_biteArc {r Θ F v₁ v₂ Β L A A' Di Do} + (h : D.IsBiteShape r Θ F v₁ v₂ Β L A A' Di Do) : + IsLineWithEnds (D.biteArc r F) (cap.emb v₁) (cap.emb v₂) := by + have hne : cap.emb v₁ ≠ cap.emb v₂ := fun he ↦ h.ne (cap.isEmbedding.injective he) + have hdis : Disjoint A Β := disjoint_left.2 fun x hx hxΒ ↦ (h.A_sub hx).2 (h.meet ▸ ⟨hxΒ, + (h.A_sub hx).1⟩) + rw [h.biteArc_eq] + exact line_of_discBd h.di h.bd_i h.line hdis hne + +omit hS h3 in +omit [T2Space S] in +/-- A point of the cuff inside `F` is on the arc `I(F)` or is a vertex of `F`. -/ +theorem IsBiteShape.mem_biteArc_or {r Θ F v₁ v₂ Β L A A' Di Do} + (h : D.IsBiteShape r Θ F v₁ v₂ Β L A A' Di Do) {x : Shat} (hxΘ : x ∈ cap.emb '' Θ) + (hxi : x ∈ D.ins F) : + x ∈ D.biteArc r F ∨ x ∈ F.V ∧ x ∈ A' := by + rw [h.biteArc_eq] + by_cases hst : x ∈ ({cap.emb v₁, cap.emb v₂} : Set Shat) + · exact Or.inl (Or.inr hst) + rcases h.cover ⟨hxΘ, hst⟩ with h₁ | h₁ + · exact Or.inl (Or.inl h₁) + · right + obtain ⟨y, hy, rfl⟩ := hxΘ + exact ⟨(D.rad.bd_point h.circuit.1 (cuff_subset_bd ⟨Θ, h.cuff⟩ hy) (h.A'_inter h₁ hxi)).2.1, h₁⟩ + +omit hS h3 in +/-- A line is the closure of what is left after we take away finitely many points. -/ +theorem line_subset_closure_diff {T : Type} [TopologicalSpace T] {L Z : Set T} {a b : + T} (hl : IsLineWithEnds L a b) (hZ : Z.Finite) : L ⊆ closure (L \ Z) := by + obtain ⟨f, -, -⟩ := hl + let g : unitInterval → T := fun t ↦ (f t : T) + have hZ' : (g ⁻¹' Z).Finite := hZ.preimage fun x _ y _ he ↦ f.injective (Subtype.ext he) + have hd := dense_univ.sdiff_finite hZ' + have hc : Continuous g := continuous_subtype_val.comp f.continuous + intro x hx + obtain ⟨t, ht⟩ := f.surjective ⟨x, hx⟩ + have hx' : x = g t := by simp [g, ht] + rw [hx'] + refine map_mem_closure hc (hd t) ?_ + rintro s ⟨-, hs⟩ + exact ⟨(f s).2, hs⟩ + +omit hS h3 in +omit [T2Space S] in +/-- **A bite inside another has its arc inside the arc of the other.** -/ +theorem IsBiteShape.biteArc_mono {r Θ F₁ F₂ v₁ v₂ Β L A A' Di Do w₁ w₂ Β' L' B + B' Ei Eo} (h₁ : D.IsBiteShape r Θ F₁ v₁ v₂ Β L A A' Di Do) + (h₂ : D.IsBiteShape r Θ F₂ w₁ w₂ Β' L' B B' Ei Eo) (hsub : D.ins F₁ ⊆ D.ins F₂) : D.biteArc r + F₁ ⊆ D.biteArc r F₂ := by + have hT₂ : IsClosed (D.biteArc r F₂) := isClosed_of_cuffLine (h₂.isLine_biteArc) + refine (line_subset_closure_diff (h₁.isLine_biteArc) F₂.finite_V).trans + (closure_minimal ?_ hT₂) + rintro x ⟨hx, hxV⟩ + have hm := h₁.biteArc_subset hx + rcases h₂.mem_biteArc_or hm.2 (hsub hm.1) with h' | h' + · exact h' + · exact absurd h'.1 hxV + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CapExists.lean b/LeanPool/GraphMinor/GM19/CapExists.lean new file mode 100644 index 0000000000..e4c53ace7f --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CapExists.lean @@ -0,0 +1,257 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.RadialExists +public import LeanPool.GraphMinor.Surface.PasteDisc + +/-! +# The capped surface exists + +Graph Minors XIX, Section 2 (page 327): "The surface obtained from $\Sigma$ by “pasting” a disc onto +each +cuff we denote by $\hat{\Sigma}$." We paste the discs one cuff at a time, using +`Surface.paste_disc`, and show +that the result is an `IsCappedSurface`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface + +universe u + +variable {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] + +theorem image_connectedComponentIn_of_isEmbedding {ι : S → T} (hι : IsEmbedding ι) {F : Set S} + {y : S} (hy : y ∈ F) : ι '' connectedComponentIn F y = connectedComponentIn (ι '' F) (ι y) := by + apply Subset.antisymm + · refine (isPreconnected_connectedComponentIn.image ι hι.continuous.continuousOn + |>.subset_connectedComponentIn (mem_image_of_mem _ (mem_connectedComponentIn hy)) + (image_mono (connectedComponentIn_subset _ _))) + · set D := connectedComponentIn (ι '' F) (ι y) with hD + have hDsub : D ⊆ ι '' F := connectedComponentIn_subset _ _ + have hDr : ι '' (ι ⁻¹' D) = D := + image_preimage_eq_of_subset (hDsub.trans (image_subset_range _ _)) + have hpre : IsPreconnected (ι ⁻¹' D) := by + rw [← hι.isInducing.isPreconnected_image, hDr] + exact isPreconnected_connectedComponentIn + have hsub : ι ⁻¹' D ⊆ F := fun x hx ↦ by + obtain ⟨z, hz, hzx⟩ := hDsub hx + exact hι.injective hzx ▸ hz + have hyD : y ∈ ι ⁻¹' D := mem_connectedComponentIn (mem_image_of_mem _ hy) + rw [← hDr] + exact image_mono (hpre.subset_connectedComponentIn hyD hsub) + +theorem connectedComponentIn_bd_diff {C : Set S} (hC : C ∈ cuffs S) {y : S} (hy : y ∈ bd S \ C) : + connectedComponentIn (bd S \ C) y = connectedComponentIn (bd S) y := by + obtain ⟨z, hz, rfl⟩ := hC + apply Subset.antisymm (connectedComponentIn_mono _ sdiff_subset) + refine isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn hy.1) fun w hw ↦ ⟨connectedComponentIn_subset _ _ hw, fun hw' ↦ ?_⟩ + apply hy.2 + rw [(connectedComponentIn_eq hw').trans (connectedComponentIn_eq hw).symm] + exact mem_connectedComponentIn hy.1 + +/-- The cuffs after pasting a disc onto the cuff `C`. -/ +theorem cuffs_paste {C : Set S} (hC : C ∈ cuffs S) {ι : S → T} (hι : IsEmbedding ι) + (hbd : bd T = ι '' (bd S \ C)) : cuffs T = (fun Θ ↦ ι '' Θ) '' (cuffs S \ {C}) := by + ext D + constructor + · rintro ⟨x, hx, rfl⟩ + rw [hbd] at hx ⊢ + obtain ⟨y, hy, rfl⟩ := hx + refine ⟨connectedComponentIn (bd S) y, ⟨⟨y, hy.1, rfl⟩, fun h ↦ ?_⟩, ?_⟩ + · exact hy.2 (by rw [← mem_singleton_iff.1 h]; exact mem_connectedComponentIn hy.1) + · change ι '' _ = _ + rw [← connectedComponentIn_bd_diff hC hy, image_connectedComponentIn_of_isEmbedding hι hy] + · rintro ⟨_, ⟨⟨y, hy, rfl⟩, hne⟩, rfl⟩ + have hyC : y ∉ C := fun h ↦ hne (by + obtain ⟨z, hz, rfl⟩ := hC + exact mem_singleton_iff.2 (connectedComponentIn_eq h).symm) + refine ⟨ι y, hbd ▸ mem_image_of_mem _ ⟨hy, hyC⟩, ?_⟩ + change connectedComponentIn (bd T) (ι y) = ι '' _ + have hyd : y ∈ bd S \ C := ⟨hy, hyC⟩ + rw [hbd, ← connectedComponentIn_bd_diff hC hyd, image_connectedComponentIn_of_isEmbedding hι + hyd] + +theorem cuffs_disjoint {Θ₁ Θ₂ : Set S} (h₁ : Θ₁ ∈ cuffs S) (h₂ : Θ₂ ∈ cuffs S) (hne : Θ₁ ≠ Θ₂) : + Disjoint Θ₁ Θ₂ := by + obtain ⟨a, -, rfl⟩ := h₁ + obtain ⟨b, -, rfl⟩ := h₂ + refine disjoint_left.2 fun x ha hb ↦ hne ?_ + exact (connectedComponentIn_eq ha).trans (connectedComponentIn_eq hb).symm + +/-- One step: a capping of the surface with the cuff `C` filled is a capping of the surface. -/ +theorem nonempty_capped_of_paste {Shat : Type u} [TopologicalSpace Shat] + (hT : IsSurface T) {C : Set S} (hC : C ∈ cuffs S) {ι : S → T} (hι : IsClosedEmbedding ι) + {Δ : Set T} (hΔ : IsClosedDisc Δ) (hcov : range ι ∪ Δ = univ) (hinter : range ι ∩ Δ = ι '' C) + (hΔb : discBd Δ = ι '' C) (hbd : bd T = ι '' (bd S \ C)) (cap' : IsCappedSurface T Shat) : + Nonempty (IsCappedSurface S Shat) := by + classical + have hsurf := cap'.isSurface + have : T2Space Shat := hsurf.2.1 + have : T2Space T := hT.2.1 + have : CompactSpace T := hT.1 + set j := cap'.emb with hj + have hjc : IsClosedEmbedding j := + IsClosedEmbedding.of_continuous_injective_isClosedMap cap'.isEmbedding.continuous + cap'.isEmbedding.injective cap'.isEmbedding.continuous.isClosedMap + have hcuffs := cuffs_paste hC hι.isEmbedding hbd + have hmem : ∀ Θ ∈ cuffs S, Θ ≠ C → ι '' Θ ∈ cuffs T := fun Θ hΘ hne ↦ by + rw [hcuffs] + exact ⟨Θ, ⟨hΘ, hne⟩, rfl⟩ + have hcl : closure (j '' discInt Δ) = j '' Δ := by + rw [hjc.closure_image_eq] + congr 1 + exact Subset.antisymm (closure_minimal (discInt_subset _) hΔ.isClosed) hΔ.subset_closure_discInt + have hcap : ∀ Θ' ∈ cuffs T, ∀ x ∈ cap'.cuffDisc Θ', x ∉ range j := fun Θ' hΘ' x hx hr ↦ by + have : x ∈ (range cap'.emb)ᶜ := by + rw [cap'.compl_eq] + exact mem_iUnion₂.2 ⟨Θ', hΘ', hx⟩ + exact this hr + have hdiscint : ∀ z ∈ discInt Δ, z ∉ range ι := fun z hz hr ↦ + hz.2 (hΔb ▸ (hinter ▸ ⟨hr, hz.1⟩)) + have hdisj : ∀ Θ ∈ cuffs S, Θ ≠ C → + Disjoint (j '' Δ) (closure (cap'.cuffDisc (ι '' Θ))) := fun Θ hΘ hne ↦ by + refine disjoint_left.2 ?_ + rintro _ ⟨z, hz, rfl⟩ hcl' + rw [cap'.closure_cuffDisc (hmem Θ hΘ hne)] at hcl' + rcases hcl' with h | ⟨w, ⟨y, hy, rfl⟩, hw⟩ + · exact hcap _ (hmem Θ hΘ hne) _ h (mem_range_self z) + · obtain rfl := hjc.injective hw + have : ι y ∈ ι '' C := hinter ▸ ⟨mem_range_self y, hz⟩ + obtain ⟨y', hy', hyy⟩ := this + obtain rfl := hι.injective hyy + exact disjoint_left.1 (cuffs_disjoint hΘ hC hne) hy hy' + refine ⟨{ isSurface := cap'.isSurface, connected := cap'.connected, bd_empty := cap'.bd_empty + emb := j ∘ ι + isEmbedding := cap'.isEmbedding.comp hι.isEmbedding + cuffDisc := fun Θ ↦ if Θ = C then j '' discInt Δ else cap'.cuffDisc (ι '' Θ) + cuffDisc_closedDisc := ?_, cuffDisc_bd := ?_, cuffDisc_disjoint := ?_, + compl_eq := ?_ }⟩ + · intro Θ hΘ + by_cases he : Θ = C + · simp only [he, ite_true] + rw [hcl] + exact (isClosedDisc_image hΔ cap'.isEmbedding).1 + · simp only [he, ite_false] + exact cap'.cuffDisc_closedDisc _ (hmem Θ hΘ he) + · intro Θ hΘ + by_cases he : Θ = C + · simp only [he, ite_true] + rw [hcl, (isClosedDisc_image hΔ cap'.isEmbedding).2, hΔb, image_image] + rfl + · simp only [he, ite_false] + rw [cap'.cuffDisc_bd _ (hmem Θ hΘ he), image_image] + rfl + · intro Θ₁ hΘ₁ Θ₂ hΘ₂ hne + by_cases h₁ : Θ₁ = C + · have h₂ : Θ₂ ≠ C := fun h ↦ hne (h₁.trans h.symm) + simp only [h₁, h₂, ite_true, ite_false] + rw [hcl] + exact hdisj Θ₂ hΘ₂ h₂ + · by_cases h₂ : Θ₂ = C + · simp only [h₁, h₂, ite_true, ite_false] + rw [hcl] + exact (hdisj Θ₁ hΘ₁ h₁).symm + · simp only [h₁, h₂, ite_false] + exact cap'.cuffDisc_disjoint _ (hmem Θ₁ hΘ₁ h₁) _ (hmem Θ₂ hΘ₂ h₂) + fun h ↦ hne (image_injective.2 hι.injective h) + · ext w + simp only [mem_compl_iff, mem_iUnion₂, exists_prop] + constructor + · intro hw + by_cases hwr : w ∈ range j + · obtain ⟨z, rfl⟩ := hwr + have hzr : z ∉ range ι := fun ⟨y, hy⟩ ↦ hw ⟨y, by simp [hy]⟩ + have hzΔ : z ∈ Δ := by + have : z ∈ range ι ∪ Δ := hcov ▸ mem_univ z + exact this.resolve_left hzr + refine ⟨C, hC, ?_⟩ + rw [ite_eq_left rfl] + refine mem_image_of_mem _ ⟨hzΔ, fun hb ↦ hzr ?_⟩ + rw [hΔb] at hb + obtain ⟨y, -, rfl⟩ := hb + exact mem_range_self y + · have hmem' : w ∈ ⋃ Θ ∈ cuffs T, cap'.cuffDisc Θ := by + rw [← cap'.compl_eq] + exact hwr + obtain ⟨Θ', hΘ', hwΘ⟩ := mem_iUnion₂.1 hmem' + rw [hcuffs] at hΘ' + obtain ⟨Θ, ⟨hΘ, hne⟩, rfl⟩ := hΘ' + refine ⟨Θ, hΘ, ?_⟩ + rw [ite_eq_right (show Θ ≠ C from hne)] + exact hwΘ + · rintro ⟨Θ, hΘ, hw⟩ ⟨y, rfl⟩ + by_cases he : Θ = C + · rw [ite_eq_left he] at hw + obtain ⟨z, hz, hzy⟩ := hw + obtain rfl := hjc.injective hzy + exact hdiscint _ hz (mem_range_self y) + · rw [ite_eq_right he] at hw + exact hcap _ (hmem Θ hΘ he) _ hw (mem_range_self _) + +/-- **Every connected surface has a capped surface** (Graph Minors XIX, Section 2, page 327). -/ +theorem exists_cappedSurface : ∀ (n : ℕ) (S : Type u) [TopologicalSpace S], IsSurface S → + ConnectedSpace S → (cuffs S).ncard = n → + ∃ (Shat : Type u) (_ : TopologicalSpace Shat), Nonempty (IsCappedSurface S Shat) := by + intro n + induction n with + | zero => + intro S _ hS hconn hn + obtain ⟨-, hfin, -⟩ := cuff_statement.{u} S hS + have hempty : cuffs S = ∅ := (ncard_eq_zero hfin).1 hn + have hbd : bd S = ∅ := by + refine eq_empty_of_forall_notMem fun y hy ↦ ?_ + have : connectedComponentIn (bd S) y ∈ cuffs S := ⟨y, hy, rfl⟩ + rw [hempty] at this + exact this + refine ⟨S, inferInstance, ⟨{ isSurface := hS, connected := hconn, bd_empty := hbd, emb := id + isEmbedding := IsEmbedding.id, cuffDisc := fun _ ↦ ∅ + cuffDisc_closedDisc := ?_, cuffDisc_bd := ?_ + cuffDisc_disjoint := ?_, compl_eq := ?_ }⟩⟩ + · intro Θ hΘ + rw [hempty] at hΘ + exact absurd hΘ (notMem_empty _) + · intro Θ hΘ + rw [hempty] at hΘ + exact absurd hΘ (notMem_empty _) + · intro Θ hΘ + rw [hempty] at hΘ + exact absurd hΘ (notMem_empty _) + · simp + | succ n ih => + intro S _ hS hconn hn + obtain ⟨-, hfin, -⟩ := cuff_statement.{u} S hS + have hne : (cuffs S).Nonempty := by + rw [← ncard_pos hfin, hn] + omega + obtain ⟨C, hC⟩ := hne + obtain ⟨T, _, ι, Δ, hT, hι, hΔ, hcov, hinter, hΔb, hbd⟩ := paste_disc.{u} S C hS hC + have : T2Space T := hT.2.1 + have hTconn : ConnectedSpace T := by + refine connectedSpace_iff_univ.2 ?_ + rw [← hcov] + have h₁ : IsConnected (range ι) := isConnected_range hι.continuous + have h₂ : IsConnected Δ := (IsClosedDisc.isPathConnected hΔ).isConnected + refine h₁.union ?_ h₂ + obtain ⟨c, hc, rfl⟩ := id hC + exact ⟨ι c, hinter ▸ mem_image_of_mem _ (mem_connectedComponentIn hc)⟩ + have hcount : (cuffs T).ncard = n := by + rw [cuffs_paste hC hι.isEmbedding hbd, + ncard_image_of_injective _ (image_injective.2 hι.injective), ncard_sdiff_singleton_of_mem + hC, hn] + rfl + obtain ⟨Shat, _, ⟨cap'⟩⟩ := ih T hT hTconn hcount + exact ⟨Shat, inferInstance, nonempty_capped_of_paste hT hC hι hΔ hcov hinter hΔb hbd cap'⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CapModel.lean b/LeanPool/GraphMinor/GM19/CapModel.lean new file mode 100644 index 0000000000..42773ade30 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CapModel.lean @@ -0,0 +1,549 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.CapUnique +public import LeanPool.GraphMinor.GM19.CapExists +public import LeanPool.GraphMinor.GM19.Conditional2 +public import LeanPool.GraphMinor.GM20.Draw10 + +/-! +# Filling a cuff of a model surface + +The surface `Σ(a, b, c + 1)` is `Σ(a, b, c)` with one more open disc removed. So a capping of `Σ(a, +b, c)` is a +capping of `Σ(a, b, c + 1)`, and by induction `Σ(a, b, 0)` caps every `Σ(a, b, c)` (`capModel`). An +orientation of +`Σ(a, b, c)` restricts to `Σ(a, b, c + 1)` (`modelOrientation`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM20.Draw + +theorem base_succ {n : ℕ} : modelBase (n + 1) ⊆ modelBase n := + fun _ hp i hi x hx ↦ hp i (by omega) x hx + +theorem three_le_dist_centre {i j : ℕ} (h : i ≠ j) : 3 ≤ dist (modelCentre i) (modelCentre j) := by + have h₁ := norm_sq (modelCentre i - modelCentre j) + rw [dist_eq_norm] + have h₂ : (1 : ℝ) ≤ ((i : ℝ) - j) ^ 2 := by + have : ((i : ℤ) - j) ≠ 0 := by omega + have h₃ : (1 : ℤ) ≤ ((i : ℤ) - j) ^ 2 := Int.add_one_le_iff.2 (sq_pos_iff.2 this) + exact_mod_cast h₃ + have h₄ : ‖modelCentre i - modelCentre j‖ ^ 2 = 9 * ((i : ℝ) - j) ^ 2 := by + rw [h₁] + simp [modelCentre] + ring + have h₅ : 0 ≤ ‖modelCentre i - modelCentre j‖ := norm_nonneg _ + nlinarith + +/-- A point on one of the first `n` circles is far from the `n`th centre. -/ +theorem mem_base_succ {n i : ℕ} (hi : i < n) {u : EuclideanPlane} (hu : ‖u‖ + = 1) {p : OnePoint EuclideanPlane} + (hp : p ∈ modelBase n) (he : p = ((modelCentre i + u : EuclideanPlane) : OnePoint + EuclideanPlane)) : + p ∈ modelBase (n + 1) := by + intro j hj x hx + rcases Nat.lt_succ_iff_lt_or_eq.1 hj with hj | rfl + · exact hp j hj x hx + · obtain rfl : modelCentre i + u = x := OnePoint.coe_injective (he.symm.trans hx) + have h₁ := three_le_dist_centre hi.ne + have h₂ : dist (modelCentre i) (modelCentre j) ≤ dist (modelCentre i) (modelCentre i + u) + + dist (modelCentre i + u) (modelCentre j) := dist_triangle _ _ _ + have h₃ : dist (modelCentre i) (modelCentre i + u) = 1 := by + rw [dist_eq_norm] + simpa using hu + linarith + +theorem mem_base_succ' {n i : ℕ} (hi : i < n) {u : EuclideanPlane} (hu : ‖u‖ + = 1) {p : OnePoint EuclideanPlane} + (hp : p ∈ modelBase n) (he : p = ((modelCentre i - u : EuclideanPlane) : OnePoint + EuclideanPlane)) : + p ∈ modelBase (n + 1) := + mem_base_succ hi (u := -u) (by simpa using hu) hp (by rw [he, sub_eq_add_neg]) + +theorem norm_modelMirror (u : EuclideanPlane) : ‖modelMirror u‖ = ‖u‖ := by + have h₁ := norm_sq (modelMirror u) + have h₂ := norm_sq u + have h₃ : ‖modelMirror u‖ ^ 2 = ‖u‖ ^ 2 := by + rw [h₁, h₂] + simp [modelMirror] + exact (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).1 h₃ + +variable (a b c : ℕ) + +/-- The map `Σ(a, b, c + 1) → Σ(a, b, c)` that forgets that the last open disc was removed. -/ +noncomputable def plug : SurfaceModel a b (c + 1) → SurfaceModel a b c := + Quot.map (fun p : modelBase (2 * a + b + (c + 1)) ↦ (⟨p.1, base_succ p.2⟩ : modelBase + (2 * a + b + c))) + fun p q h ↦ by + cases h with + | handle i hi u hu _ _ hp hq => exact ModelGlue.handle i hi u hu _ _ hp hq + | crosscap i hi u hu _ _ hp hq => exact ModelGlue.crosscap i hi u hu _ _ hp hq + +/-- A left inverse of `plug`. -/ +noncomputable def unplug : SurfaceModel a b c → Option (SurfaceModel a b (c + 1)) := + open Classical in + Quot.lift (fun p : modelBase (2 * a + b + c) ↦ if h : p.1 ∈ modelBase (2 * a + b + (c + 1)) then + some (Quot.mk _ ⟨p.1, h⟩) else none) fun p q h ↦ by + cases h with + | handle i hi u hu _ _ hp hq => + have h₁ : p.1 ∈ modelBase (2 * a + b + (c + 1)) := mem_base_succ (n := 2 * a + b + c) + (by omega) hu p.2 hp + have h₂ : q.1 ∈ modelBase (2 * a + b + (c + 1)) := + mem_base_succ (n := 2 * a + b + c) (by omega) (by rwa [norm_modelMirror]) q.2 hq + simp only [h₁, h₂, dite_true] + exact congrArg some (Quot.sound (ModelGlue.handle i hi u hu _ _ hp hq)) + | crosscap i hi u hu _ _ hp hq => + have h₁ : p.1 ∈ modelBase (2 * a + b + (c + 1)) := mem_base_succ (n := 2 * a + b + c) + (by omega) hu p.2 hp + have h₂ : q.1 ∈ modelBase (2 * a + b + (c + 1)) := mem_base_succ' (n := 2 * a + b + c) + (by omega) hu q.2 hq + simp only [h₁, h₂, dite_true] + exact congrArg some (Quot.sound (ModelGlue.crosscap i hi u hu _ _ hp hq)) + +theorem unplug_plug (x : SurfaceModel a b (c + 1)) : unplug a b c (plug a b c x) = some x := by + classical + induction x using Quot.ind with + | mk p => + exact dite_eq_left p.2 + +theorem plug_injective : Function.Injective (plug a b c) := fun x y h ↦ by + have := congrArg (unplug a b c) h + rw [unplug_plug, unplug_plug] at this + exact Option.some.inj this + +theorem continuous_plug : Continuous (plug a b c) := + continuous_quot_lift _ (continuous_quot_mk.comp (Continuous.subtype_mk continuous_subtype_val _)) + +variable {a b c} + +theorem ok_of_succ {z : ℝ × ℝ} (h : Ok a b (c + 1) z) : Ok a b c z := fun i hi ↦ h i (by omega) + +theorem plug_qq {z : ℝ × ℝ} (h : Ok a b (c + 1) z) : plug a b c (qq a b (c + 1) z) = qq a b c z + := by + rw [qq_of_ok h, qq_of_ok (ok_of_succ h)] + rfl + +theorem interior_iff_of_openEmbedding {X Y : Type} [TopologicalSpace X] [TopologicalSpace Y] {f : X + → Y} + (hf : IsOpenEmbedding f) (x : X) : IsInteriorPoint (f x) ↔ IsInteriorPoint x := by + constructor + · intro h + obtain ⟨U, hU, hx, hsub, ⟨e⟩⟩ := h.exists_subset hf.isOpen_range ⟨x, rfl⟩ + exact ⟨f ⁻¹' U, hU.preimage hf.continuous, hx, + ⟨(hf.isEmbedding.homeomorphImage _).trans + ((Homeomorph.setCongr (image_preimage_eq_of_subset hsub)).trans e)⟩⟩ + · rintro ⟨U, hU, hx, ⟨e⟩⟩ + exact ⟨f '' U, hf.isOpenMap _ hU, mem_image_of_mem _ hx, ⟨(hf.isEmbedding.homeomorphImage + U).symm.trans e⟩⟩ + +variable (a b c) + +/-- The index of the circle that `plug` fills. -/ +abbrev lastHole : ℕ := 2 * a + b + c + +variable {a b c} + +theorem ok_near {ζ : ℂ} (h : ‖ζ - cz (lastHole a b c)‖ < 2) : Ok a b c (cp ζ) := fun i hi ↦ by + rw [← nsq] + exact (sq_of_one_lt (one_lt_far (by unfold lastHole at *; omega) h)).le + +theorem ok_near' {ζ : ℂ} (h₁ : 1 ≤ ‖ζ - cz (lastHole a b c)‖) (h : ‖ζ - cz (lastHole a b c)‖ < 2) : + Ok a b (c + 1) (cp ζ) := fun i hi ↦ by + rw [← nsq] + by_cases he : i = lastHole a b c + · subst he + nlinarith + · exact (sq_of_one_lt (one_lt_far he h)).le + +theorem free_last {ζ : ℂ} (h : ‖ζ - cz (lastHole a b c)‖ < 2) : Free a b (cp ζ) := + free_near (I := lastHole a b c) (by unfold lastHole; omega) h + +theorem plug_qq_near {ζ : ℂ} (h₁ : 1 ≤ ‖ζ - cz (lastHole a b c)‖) (h : ‖ζ - cz + (lastHole a b c)‖ < 2) : + plug a b c (qq a b (c + 1) (cp ζ)) = qq a b c (cp ζ) := plug_qq (ok_near' h₁ h) + +theorem pl_cp_mk (v : EuclideanPlane) : pl (cp ⟨v 0, v 1⟩) = v := by + ext j + fin_cases j <;> simp [pl, cp] + +theorem norm_sub_cz (ζ : ℂ) (i : ℕ) : ‖ζ - cz i‖ = dist (pl (cp ζ)) (modelCentre i) := by + have h := dist_centre_sq (cp ζ) i + rw [← nsq] at h + exact ((sq_eq_sq₀ dist_nonneg (norm_nonneg _)).1 h).symm + +/-- The closed disc that fills the last circle. -/ +noncomputable def fillDisc (a b c : ℕ) : Set (SurfaceModel a b c) := + (fun ζ ↦ qq a b c (cp ζ)) '' closedBall (cz (lastHole a b c)) 1 + +/-- The last circle in `Σ(a, b, c + 1)`. -/ +noncomputable def lastCuff (a b c : ℕ) : Set (SurfaceModel a b (c + 1)) := + (fun ζ ↦ qq a b (c + 1) (cp ζ)) '' sphere (cz (lastHole a b c)) 1 + +theorem image_lastCuff : plug a b c '' lastCuff a b c = + (fun ζ ↦ qq a b c (cp ζ)) '' sphere (cz (lastHole a b c)) 1 := by + unfold lastCuff + rw [image_image] + refine image_congr fun ζ hζ ↦ ?_ + have : ‖ζ - cz (lastHole a b c)‖ = 1 := by simpa [dist_eq_norm] using hζ + exact plug_qq_near this.ge (by linarith) + +theorem fillDisc_facts [T2Space (SurfaceModel a b c)] : IsClosedDisc (fillDisc a b c) ∧ + discBd (fillDisc a b c) = (fun ζ ↦ qq a b c (cp ζ)) '' sphere (cz (lastHole a b c)) 1 := by + have hn : ∀ u : ClosedUnitDisc, ‖complexPlane.symm u.1‖ ≤ 1 := fun u ↦ by + rw [LinearIsometryEquiv.norm_map] + exact mem_closedBall_zero_iff.1 u.2 + have hn' : ∀ u : ClosedUnitDisc, ‖(cz (lastHole a b c) + complexPlane.symm u.1) - cz + (lastHole a b c)‖ < 2 := + fun u ↦ by + rw [add_sub_cancel_left] + linarith [hn u] + let G : ClosedUnitDisc → SurfaceModel a b c := fun u ↦ qq a b c (cp (cz + (lastHole a b c) + complexPlane.symm u.1)) + have hc : Continuous G := continuousOn_qq.comp_continuous + (continuous_cp.comp (continuous_const.add (complexPlane.symm.continuous.comp + continuous_subtype_val))) + fun u ↦ ok_near (hn' u) + have hi : Function.Injective G := fun u v h ↦ by + have h₁ := cp_injective (eq_of_free (ok_near (hn' u)) (free_last (hn' u)) (ok_near (hn' v)) + (free_last (hn' v)) h) + exact Subtype.ext (complexPlane.symm.injective (add_left_cancel h₁)) + have : CompactSpace ClosedUnitDisc := isCompact_iff_compactSpace.1 (isCompact_closedBall 0 1) + have he : IsEmbedding G := (hc.isClosedEmbedding hi).isEmbedding + have hr : range G = fillDisc a b c := by + ext x + constructor + · rintro ⟨u, rfl⟩ + refine ⟨_, ?_, rfl⟩ + rw [mem_closedBall, dist_eq_norm, add_sub_cancel_left] + exact hn u + · rintro ⟨ζ, hζ, rfl⟩ + have h₁ : ‖complexPlane (ζ - cz (lastHole a b c))‖ ≤ 1 := by + rw [LinearIsometryEquiv.norm_map] + simpa [dist_eq_norm] using hζ + refine ⟨⟨_, mem_closedBall_zero_iff.2 h₁⟩, ?_⟩ + simp [G] + let φ : ClosedUnitDisc ≃ₜ fillDisc a b c := he.toHomeomorph.trans (Homeomorph.setCongr hr) + refine ⟨⟨φ⟩, ?_⟩ + rw [disc_boundary (fillDisc a b c) φ] + ext x + constructor + · rintro ⟨u, hu, rfl⟩ + refine ⟨cz (lastHole a b c) + complexPlane.symm u.1, ?_, rfl⟩ + rw [mem_sphere, dist_eq_norm, add_sub_cancel_left, LinearIsometryEquiv.norm_map] + exact mem_sphere_zero_iff_norm.1 hu + · rintro ⟨ζ, hζ, rfl⟩ + have h₁ : ‖complexPlane (ζ - cz (lastHole a b c))‖ = 1 := by + rw [LinearIsometryEquiv.norm_map] + simpa [dist_eq_norm] using hζ + refine ⟨⟨_, mem_closedBall_zero_iff.2 h₁.le⟩, mem_sphere_zero_iff_norm.2 h₁, ?_⟩ + change G ⟨_, _⟩ = _ + simp [G] + +theorem range_union_fillDisc : range (plug a b c) ∪ fillDisc a b c = univ := by + classical + refine eq_univ_of_forall fun x ↦ ?_ + induction x using Quot.ind with + | mk p => + by_cases h : p.1 ∈ modelBase (2 * a + b + (c + 1)) + · exact Or.inl ⟨Quot.mk _ ⟨p.1, h⟩, rfl⟩ + · right + change ¬ ∀ i < 2 * a + b + (c + 1), ∀ x : EuclideanPlane, p.1 = x → 1 ≤ dist x + (modelCentre i) at h + push Not at h + obtain ⟨i, hi, v, hv, hlt⟩ := h + have hin : i = lastHole a b c := by + by_contra hne + have := p.2 i (by unfold lastHole at *; omega) v hv + linarith + subst hin + have h₁ : ‖(⟨v 0, v 1⟩ : ℂ) - cz (lastHole a b c)‖ < 1 := by + rw [norm_sub_cz, pl_cp_mk] + exact hlt + refine ⟨⟨v 0, v 1⟩, ?_, ?_⟩ + · rw [mem_closedBall, dist_eq_norm] + exact h₁.le + · have hok := ok_near (a := a) (b := b) (c := c) (ζ := ⟨v 0, v 1⟩) (by linarith) + change qq a b c _ = _ + rw [qq_of_ok hok] + refine congrArg _ (Subtype.ext ?_) + change ((pl (cp ⟨v 0, v 1⟩) : EuclideanPlane) : OnePoint EuclideanPlane) = p.1 + rw [pl_cp_mk, hv] + +theorem eq_one_of_mem_range {ζ : ℂ} (h : ‖ζ - cz (lastHole a b c)‖ ≤ 1) + (hr : qq a b c (cp ζ) ∈ range (plug a b c)) : ‖ζ - cz (lastHole a b c)‖ = 1 := by + refine le_antisymm h ?_ + obtain ⟨x, hx⟩ := hr + induction x using Quot.ind with + | mk p => + have h₂ : ‖ζ - cz (lastHole a b c)‖ < 2 := by linarith + have h₃ := base_eq (ok_near h₂) (free_last h₂) hx + change p.1 = _ at h₃ + have h₄ := p.2 (lastHole a b c) (by unfold lastHole; omega) _ h₃ + rw [norm_sub_cz] + exact h₄ + +theorem range_inter_fillDisc : + range (plug a b c) ∩ fillDisc a b c = plug a b c '' lastCuff a b c := by + rw [image_lastCuff] + apply Subset.antisymm + · rintro x ⟨hr, ζ, hζ, rfl⟩ + have h₁ : ‖ζ - cz (lastHole a b c)‖ ≤ 1 := by simpa [dist_eq_norm] using hζ + refine ⟨ζ, ?_, rfl⟩ + rw [mem_sphere, dist_eq_norm] + exact eq_one_of_mem_range h₁ hr + · rintro x ⟨ζ, hζ, rfl⟩ + have h₁ : ‖ζ - cz (lastHole a b c)‖ = 1 := by simpa [dist_eq_norm] using hζ + exact ⟨⟨_, plug_qq_near h₁.ge (by linarith)⟩, ζ, sphere_subset_closedBall hζ, rfl⟩ + +theorem qq_interior {ζ : ℂ} (h : ‖ζ - cz (lastHole a b c)‖ < 2) : IsInteriorPoint (qq a b c (cp ζ)) + := by + have hmem : ∀ ζ ∈ ball (cz (lastHole a b c)) 2, ‖ζ - cz (lastHole a b c)‖ < 2 := fun ζ hζ ↦ by + simpa [dist_eq_norm] using hζ + have hj := isOpenEmbedding_chart (a := a) (b := b) (c := c) (B := ball (cz + (lastHole a b c)) 2) isOpen_ball + fun ζ hζ _ ↦ free_last (hmem ζ hζ) + have hW : chartDom a b c (ball (cz (lastHole a b c)) 2) = ball (cz (lastHole a b c)) 2 := + inter_eq_left.2 fun ζ hζ ↦ ok_near (hmem ζ hζ) + have he : Nonempty (chartDom a b c (ball (cz (lastHole a b c)) 2) ≃ₜ OpenUnitDisc) := + ⟨(Homeomorph.setCongr hW).trans (ballHomeo _ two_pos)⟩ + have hw : ζ ∈ chartDom a b c (ball (cz (lastHole a b c)) 2) := + ⟨by simpa [dist_eq_norm] using h, ok_near h⟩ + exact interior_of_chart hj he ⟨ζ, hw⟩ + +theorem qq_mem_bd_circle {ζ₀ : ℂ} (h : ‖ζ₀ - cz (lastHole a b c)‖ = 1) : + qq a b (c + 1) (cp ζ₀) ∈ bd (SurfaceModel a b (c + 1)) := by + set d := ζ₀ - cz (lastHole a b c) with hd + have hB : ∀ ζ ∈ ball ζ₀ (1 / 2), ‖ζ - cz (lastHole a b c)‖ < 2 := fun ζ hζ ↦ by + have h₁ : ‖ζ - ζ₀‖ < 1 / 2 := by simpa [dist_eq_norm] using hζ + have h₂ : ζ - cz (lastHole a b c) = (ζ - ζ₀) + d := by rw [hd]; ring + rw [h₂] + linarith [norm_add_le (ζ - ζ₀) d] + have hj := isOpenEmbedding_chart (a := a) (b := b) (c := c + 1) (B := ball ζ₀ (1 / 2)) isOpen_ball + fun ζ hζ _ ↦ free_last (hB ζ hζ) + have hw : ζ₀ ∈ chartDom a b (c + 1) (ball ζ₀ (1 / 2)) := + ⟨mem_ball_self (by norm_num), ok_near' h.ge (by linarith)⟩ + refine not_interior_of_chart hj ⟨_, hw⟩ fun hint ↦ ?_ + obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.mp (mem_interior_iff_mem_nhds.mp hint) + set t : ℝ := min ε 1 / 2 with ht + have ht₀ : 0 < t := by positivity + have ht₁ : t ≤ 1 / 2 := by + have := min_le_right ε 1 + rw [ht] + linarith + have ht₂ : t < ε := by + have := min_le_left ε 1 + rw [ht] + linarith [lt_min hε one_pos] + have hmem : ζ₀ - (t : ℂ) * d ∈ ball ζ₀ ε := by + rw [mem_ball, dist_eq_norm, sub_sub_cancel_left, norm_neg, norm_mul, h, mul_one, + Complex.norm_real, + Real.norm_eq_abs, abs_of_pos ht₀] + exact ht₂ + have hok := (hball hmem).2 (lastHole a b c) (by unfold lastHole; omega) + change 1 ≤ ((cp _).1 - 3 * (lastHole a b c : ℝ)) ^ 2 + (cp _).2 ^ 2 at hok + rw [← nsq] at hok + have h₂ : ζ₀ - (t : ℂ) * d - cz (lastHole a b c) = ((1 - t : ℝ) : ℂ) * d := by + rw [hd] + push_cast + ring + rw [h₂, norm_mul, h, mul_one, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (by linarith)] at hok + nlinarith + +theorem isClosedEmbedding_plug : IsClosedEmbedding (plug a b c) := by + have : T2Space (SurfaceModel a b c) := (presents_ew a b c).1 + have : CompactSpace (SurfaceModel a b (c + 1)) := (isSurface_model a b (c + 1)).1.1 + exact (continuous_plug a b c).isClosedEmbedding (plug_injective a b c) + +theorem isClosed_lastCuff [T2Space (SurfaceModel a b (c + 1))] : IsClosed (lastCuff a b c) := by + have hcont : ContinuousOn (fun ζ ↦ qq a b (c + 1) (cp ζ)) (sphere (cz (lastHole a b c)) 1) := + continuousOn_qq.comp continuous_cp.continuousOn fun ζ hζ ↦ by + have h₁ : ‖ζ - cz (lastHole a b c)‖ = 1 := by simpa [dist_eq_norm] using hζ + exact ok_near' h₁.ge (by linarith) + exact ((isCompact_sphere _ _).image_of_continuousOn hcont).isClosed + +/-- Off the last cuff, `plug` keeps both interior points and boundary points. -/ +theorem mem_bd_plug_iff [T2Space (SurfaceModel a b c)] [T2Space (SurfaceModel a b (c + 1))] + {s : SurfaceModel a b (c + 1)} (hs : s ∉ lastCuff a b c) : + plug a b c s ∈ bd (SurfaceModel a b c) ↔ s ∈ bd (SurfaceModel a b (c + 1)) := by + have hO : IsOpen (lastCuff a b c)ᶜ := isClosed_lastCuff.isOpen_compl + have hd := (fillDisc_facts (a := a) (b := b) (c := c)).1 + have hr : range (plug a b c ∘ ((↑) : ((lastCuff a b c)ᶜ : Set (SurfaceModel a b (c + 1))) + → SurfaceModel a b (c + 1))) = (fillDisc a b c)ᶜ := by + ext x + constructor + · rintro ⟨⟨y, hy⟩, rfl⟩ hx + have h₁ : plug a b c y ∈ plug a b c '' lastCuff a b c := by + rw [← range_inter_fillDisc] + exact ⟨mem_range_self y, hx⟩ + obtain ⟨z, hz, he⟩ := h₁ + exact hy (plug_injective a b c he ▸ hz) + · intro hx + obtain ⟨y, rfl⟩ : x ∈ range (plug a b c) := (range_union_fillDisc (a := a) (b := b) (c + := c) ▸ mem_univ x : + x ∈ range (plug a b c) ∪ fillDisc a b c).resolve_right hx + refine ⟨⟨y, fun hy ↦ hx ?_⟩, rfl⟩ + have : plug a b c y ∈ plug a b c '' lastCuff a b c := mem_image_of_mem _ hy + rw [← range_inter_fillDisc] at this + exact this.2 + have hf : IsOpenEmbedding (plug a b c ∘ ((↑) : ((lastCuff a b c)ᶜ : Set (SurfaceModel a b + (c + 1))) → SurfaceModel a b (c + 1))) := + ⟨isClosedEmbedding_plug.isEmbedding.comp IsEmbedding.subtypeVal, hr ▸ hd.isClosed.isOpen_compl⟩ + have h₁ := interior_iff_of_openEmbedding hf ⟨s, hs⟩ + have h₂ := interior_iff_of_openEmbedding hO.isOpenEmbedding_subtypeVal ⟨s, hs⟩ + exact not_congr (h₁.trans h₂.symm) + +theorem disjoint_fillDisc_bd : Disjoint (fillDisc a b c) (bd (SurfaceModel a b c)) := by + refine disjoint_left.2 ?_ + rintro _ ⟨ζ, hζ, rfl⟩ hb + have h₁ : ‖ζ - cz (lastHole a b c)‖ ≤ 1 := by simpa [dist_eq_norm] using hζ + exact hb (qq_interior (by linarith)) + +theorem bd_plug [T2Space (SurfaceModel a b c)] [T2Space (SurfaceModel a b (c + 1))] : + bd (SurfaceModel a b c) = plug a b c '' (bd (SurfaceModel a b (c + 1)) \ lastCuff a b c) := by + apply Subset.antisymm + · intro x hx + have hxd : x ∉ fillDisc a b c := fun h ↦ disjoint_left.1 disjoint_fillDisc_bd h hx + obtain ⟨y, rfl⟩ : x ∈ range (plug a b c) := (range_union_fillDisc (a := a) (b := b) (c + := c) ▸ mem_univ x : + x ∈ range (plug a b c) ∪ fillDisc a b c).resolve_right hxd + have hy : y ∉ lastCuff a b c := fun hy ↦ hxd (by + have : plug a b c y ∈ plug a b c '' lastCuff a b c := mem_image_of_mem _ hy + rw [← range_inter_fillDisc] at this + exact this.2) + exact ⟨y, ⟨(mem_bd_plug_iff hy).1 hx, hy⟩, rfl⟩ + · rintro _ ⟨y, ⟨hy, hyC⟩, rfl⟩ + exact (mem_bd_plug_iff hyC).2 hy + +theorem lastCuff_subset_bd : lastCuff a b c ⊆ bd (SurfaceModel a b (c + 1)) := by + rintro _ ⟨ζ, hζ, rfl⟩ + exact qq_mem_bd_circle (by simpa [dist_eq_norm] using hζ) + +theorem lastCuff_mem_cuffs [T2Space (SurfaceModel a b c)] [T2Space (SurfaceModel a b (c + 1))] : + lastCuff a b c ∈ cuffs (SurfaceModel a b (c + 1)) := by + have hζ₀ : cz (lastHole a b c) + 1 ∈ sphere (cz (lastHole a b c)) 1 := by simp + set y₀ := qq a b (c + 1) (cp (cz (lastHole a b c) + 1)) with hy₀ + have hmem : y₀ ∈ lastCuff a b c := ⟨_, hζ₀, rfl⟩ + have hcont : ContinuousOn (fun ζ ↦ qq a b (c + 1) (cp ζ)) (sphere (cz (lastHole a b c)) 1) := + continuousOn_qq.comp continuous_cp.continuousOn fun ζ hζ ↦ by + have h₁ : ‖ζ - cz (lastHole a b c)‖ = 1 := by simpa [dist_eq_norm] using hζ + exact ok_near' h₁.ge (by linarith) + have hconn : IsPreconnected (lastCuff a b c) := + (isPreconnected_sphere (by rw [Complex.rank_real_complex]; norm_num) _ _).image _ hcont + refine ⟨y₀, lastCuff_subset_bd hmem, Subset.antisymm ?_ ?_⟩ + · have hZ : IsPreconnected (connectedComponentIn (bd (SurfaceModel a b (c + 1))) y₀) := + isPreconnected_connectedComponentIn + have hsub := connectedComponentIn_subset (bd (SurfaceModel a b (c + 1))) y₀ + have hcl : IsClosed (bd (SurfaceModel a b (c + 1)) \ lastCuff a b c) := by + have : bd (SurfaceModel a b (c + 1)) \ lastCuff a b c = plug a b c ⁻¹' bd + (SurfaceModel a b c) := by + rw [bd_plug (a := a) (b := b) (c := c), preimage_image_eq _ (plug_injective a b c)] + rw [this] + exact (isClosed_bd _).preimage (continuous_plug a b c) + intro z hz + by_contra hzC + obtain ⟨w, -, hw₁, hw₂⟩ := isPreconnected_closed_iff.1 hZ _ _ isClosed_lastCuff hcl + (fun u hu ↦ by + by_cases h : u ∈ lastCuff a b c + · exact Or.inl h + · exact Or.inr ⟨hsub hu, h⟩) + ⟨y₀, mem_connectedComponentIn (lastCuff_subset_bd hmem), hmem⟩ ⟨z, hz, hsub hz, hzC⟩ + exact hw₂.2 hw₁ + · exact hconn.subset_connectedComponentIn hmem lastCuff_subset_bd + +theorem bd_model_zero : bd (SurfaceModel a b 0) = ∅ := by + obtain ⟨ht, f, hf⟩ := presents_ew a b 0 + have hn := ncard_cuffs hf + have hfin := (cuff_statement _ (isSurface_model a b 0).1).2.1 + have he : cuffs (SurfaceModel a b 0) = ∅ := (ncard_eq_zero hfin).1 hn + refine eq_empty_of_forall_notMem fun x hx ↦ ?_ + have : connectedComponentIn (bd (SurfaceModel a b 0)) x ∈ cuffs (SurfaceModel a b 0) + := ⟨x, hx, rfl⟩ + rw [he] at this + exact this + +/-- `Σ(a, b, 0)` is a capping of every `Σ(a, b, c)`. -/ +theorem nonempty_capped_model (a b c : ℕ) : Nonempty (IsCappedSurface (SurfaceModel a b c) + (SurfaceModel a b 0)) := by + induction c with + | zero => + have he : cuffs (SurfaceModel a b 0) = ∅ := by + refine eq_empty_of_forall_notMem ?_ + rintro _ ⟨x, hx, -⟩ + rw [bd_model_zero] at hx + exact hx + exact ⟨{ isSurface := (isSurface_model a b 0).1 + connected := (isSurface_model a b 0).2 + bd_empty := bd_model_zero + emb := id + isEmbedding := IsEmbedding.id + cuffDisc := fun _ ↦ ∅ + cuffDisc_closedDisc := fun Θ hΘ ↦ by simp [he] at hΘ + cuffDisc_bd := fun Θ hΘ ↦ by simp [he] at hΘ + cuffDisc_disjoint := fun Θ hΘ ↦ by simp [he] at hΘ + compl_eq := by simp [he] }⟩ + | succ c ih => + obtain ⟨cap⟩ := ih + have : T2Space (SurfaceModel a b c) := (presents_ew a b c).1 + have : T2Space (SurfaceModel a b (c + 1)) := (presents_ew a b (c + 1)).1 + have hd := fillDisc_facts (a := a) (b := b) (c := c) + exact nonempty_capped_of_paste (isSurface_model a b c).1 + lastCuff_mem_cuffs + isClosedEmbedding_plug hd.1 range_union_fillDisc range_inter_fillDisc + (by rw [hd.2, image_lastCuff]) bd_plug cap + +/-- A capping of `Σ(a, b, c)` is `Σ(a, b, 0)`. -/ +theorem capModel : CapModelStatement := by + intro a b c Shat _ cap + obtain ⟨cap'⟩ := nonempty_capped_model a b c + have : T2Space (SurfaceModel a b c) := (presents_ew a b c).1 + exact cap.nonempty_homeomorph (isSurface_model a b c).1 cap' + +/-- An orientation moves back along an embedding. -/ +theorem isOrientable_of_embedding {X X' : Type} [TopologicalSpace X] [TopologicalSpace X'] {ι : X + → X'} + (hι : IsEmbedding ι) (hO : IsOrientableSurface X') : IsOrientableSurface X := by + obtain ⟨ω⟩ := hO + have hmem : ∀ {Δ : Set X} {a : X}, IsClosedDisc Δ → a ∈ discBd Δ → ι a ∈ discBd (ι '' Δ) + := fun {Δ a} hΔ ha ↦ + (isClosedDisc_image hΔ hι).2 ▸ mem_image_of_mem _ ha + refine ⟨⟨fun Δ a b c ↦ ω.pos (ι '' Δ) (ι a) (ι b) (ι c), fun Δ hΔ ↦ ?_, + fun Δ₁ Δ₂ h₁ h₂ hsub a b c ha hb hc hab hbc hac ↦ ?_⟩⟩ + · have hd := isClosedDisc_image hΔ hι + obtain ⟨φ, hc, hi, hr, hp⟩ := ω.isDirection (ι '' Δ) hd.1 + have hl : ∀ z, ∃ x, x ∈ discBd Δ ∧ ι x = φ z := fun z ↦ by + have : φ z ∈ ι '' discBd Δ := hd.2 ▸ hr ▸ mem_range_self z + exact this + choose g hg hg' using hl + have heq : ι ∘ g = φ := funext hg' + refine ⟨g, hι.continuous_iff.2 (heq ▸ hc), fun z w h ↦ hi (by rw [← hg', ← hg', h]), ?_, + fun a b c hab hbc hac ↦ ?_⟩ + · apply Subset.antisymm + · rintro _ ⟨z, rfl⟩ + exact hg z + · intro x hx + have : ι x ∈ range φ := hr ▸ hd.2 ▸ mem_image_of_mem _ hx + obtain ⟨z, hz⟩ := this + exact ⟨z, hι.injective ((hg' z).trans hz)⟩ + · simp only [hg'] + exact hp a b c hab hbc hac + · exact ω.agree _ _ (isClosedDisc_image h₁ hι).1 (isClosedDisc_image h₂ hι).1 + (image_mono hsub) _ _ _ + ⟨hmem h₁ ha.1, hmem h₂ ha.2⟩ ⟨hmem h₁ hb.1, hmem h₂ hb.2⟩ ⟨hmem h₁ hc.1, hmem h₂ hc.2⟩ + (fun e ↦ hab (hι.injective e)) (fun e ↦ hbc (hι.injective e)) (fun e ↦ hac (hι.injective e)) + +theorem modelOrientation : ModelOrientationStatement := fun _ _ _ ↦ + isOrientable_of_embedding isClosedEmbedding_plug.isEmbedding + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CapOrient.lean b/LeanPool/GraphMinor/GM19/CapOrient.lean new file mode 100644 index 0000000000..026d687b60 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CapOrient.lean @@ -0,0 +1,116 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.DiscRealize +public import LeanPool.GraphMinor.GM19.CutFragment + +/-! +# Orienting the capped surface + +The hypothesis of Graph Minors XIX, (15.2) gives an orientation of `Σ`. Steps (2) and (3) of its +proof work on the closed surface `Σ̂`, so we carry the orientation over (`exists_cap_orientation`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + +/-- The left inverse of the embedding of `Σ` into `Σ̂`. -/ +noncomputable def capBack [Nonempty S] (cap : IsCappedSurface S Shat) : Shat → S + := Function.invFun cap.emb + +omit [T2Space S] [T2Space Shat] in +theorem capBack_emb [Nonempty S] (cap : IsCappedSurface S Shat) (x : S) : capBack cap (cap.emb x) + = x := + Function.leftInverse_invFun cap.isEmbedding.injective x + +omit [T2Space S] [T2Space Shat] in +theorem continuousOn_capBack [Nonempty S] (cap : IsCappedSurface S Shat) : ContinuousOn + (capBack cap) (range cap.emb) := by + rw [continuousOn_iff_continuous_domRestrict] + have h : Continuous fun x : range cap.emb => cap.isEmbedding.toHomeomorph.symm x + := cap.isEmbedding.toHomeomorph.symm.continuous + convert h using 2 with x + obtain ⟨_, ⟨y, rfl⟩⟩ := x + change capBack cap (cap.emb y) = _ + rw [capBack_emb] + exact (cap.isEmbedding.toHomeomorph.symm_apply_apply y).symm + +/-- **An orientation of `Σ` extends to `Σ̂`.** On each disc of `Σ` the extension agrees with the +given orientation. -/ +theorem exists_cap_orientation [Nonempty S] (hS : IsSurface S) (cap : IsCappedSurface S Shat) + (o : SurfaceOrientation S) : + ∃ ω : SurfaceOrientation Shat, ∀ Δ, IsClosedDisc Δ → Δ ⊆ range cap.emb → SameOn ω.pos (pullPos + (capBack cap) o.pos) Δ := by + have hT := cap.isClosedSurface + have := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + let 𝓙 : Set (Set Shat) := {Δ | Δ ⊆ range cap.emb} + have hJ : IsPartialOrientation 𝓙 (pullPos (capBack cap) o.pos) := (o.isPartial univ).pull fun Δ + hΔ => + ⟨(continuousOn_capBack cap).mono hΔ, fun x hx y hy he => by + obtain ⟨x, rfl⟩ := hΔ hx + obtain ⟨y, rfl⟩ := hΔ hy + rw [capBack_emb, capBack_emb] at he + rw [he], mem_univ _⟩ + have hhered : ∀ Δ ∈ 𝓙, ∀ Δ' ⊆ Δ, Δ' ∈ 𝓙 := fun Δ hΔ Δ' hs => hs.trans hΔ + let G : Set Shat := (⋃ Θ ∈ cuffs S, closure (cap.cuffDisc Θ))ᶜ + obtain ⟨hGo, hGc⟩ := cap.isPreconnected_compl (cuff_statement S hS).2.1 subset_rfl + have hGJ : {Δ | Δ ⊆ G} ⊆ 𝓙 := fun Δ hΔ x hx => by + by_contra hn + have hn' : x ∈ (range cap.emb)ᶜ := hn + rw [cap.compl_eq] at hn' + obtain ⟨Θ, hΘ⟩ := mem_iUnion.mp hn' + obtain ⟨hΘ', hxΘ⟩ := mem_iUnion.mp hΘ + exact hΔ hx (mem_biUnion hΘ' (subset_closure hxΘ)) + have hint : ∀ x ∈ G, IsInteriorPoint x := fun x _ => hT.2.2 x + obtain ⟨e, P, hP, hs, ht, -⟩ := exists_cap_chart hS cap + obtain ⟨ω₂⟩ := isOrientable_of_inside hT hP e hs ht (o.isPartial _) + obtain ⟨x₀, hx₀⟩ : G.Nonempty := by + have : Finite {Θ : Set S // Θ ∈ cuffs S} := (cuff_statement S hS).2.1 + obtain ⟨x, hx⟩ := nonempty_compl_iUnion hT (D := fun Θ : {Θ : Set S // Θ ∈ cuffs S} => closure + (cap.cuffDisc Θ.1)) (fun Θ => cap.cuffDisc_closedDisc Θ.1 Θ.2) + (fun Θ Θ' h => cap.cuffDisc_disjoint _ Θ.2 _ Θ'.2 fun he => h (Subtype.ext he)) + refine ⟨x, fun hu => hx ?_⟩ + obtain ⟨Θ, hΘ⟩ := mem_iUnion.mp hu + obtain ⟨hΘ', hxΘ⟩ := mem_iUnion.mp hΘ + exact mem_iUnion.mpr ⟨⟨Θ, hΘ'⟩, hxΘ⟩ + obtain ⟨E, hE, -, hEs⟩ := exists_small_disc (hint x₀ hx₀) hGo hx₀ + have hdir₂ := (ω₂.isPartial 𝓙).dir E (hGJ hEs) hE + have hdirJ := hJ.dir E (hGJ hEs) hE + obtain ⟨pos₁, hpos₁, hE₁⟩ : ∃ pos₁, IsPartialOrientation univ pos₁ ∧ SameOn pos₁ (pullPos + (capBack cap) o.pos) E := by + by_cases hs : SameOn ω₂.pos (pullPos (capBack cap) o.pos) E + · exact ⟨ω₂.pos, ω₂.isPartial univ, hs⟩ + · exact ⟨revPos ω₂.pos, (ω₂.isPartial univ).rev, sameOn_rev_left (sameOn_of_notSame hdir₂ hdirJ + hs)⟩ + refine ⟨orientationOfPartial hpos₁, fun Δ hΔ hsub a b c ha hb hc hab hbc hac => ?_⟩ + have hP' : IsPartialOrientation 𝓙 pos₁ := hpos₁.mono (subset_univ _) + obtain ⟨y, hyΔ⟩ := hΔ.nonempty_discInt + have hyG : ∀ y ∈ discInt Δ, y ∈ G := fun y hy hu => by + obtain ⟨Θ, hΘ⟩ := mem_iUnion.mp hu + obtain ⟨hΘ', hyΘ⟩ := mem_iUnion.mp hΘ + obtain ⟨z, hz1, hz2⟩ := mem_closure_iff.mp hyΘ _ (hΔ.isOpen_discInt hman) hy + have : z ∈ (range cap.emb)ᶜ := by + rw [cap.compl_eq] + exact mem_biUnion hΘ' hz2 + exact this (hsub (discInt_subset _ hz1)) + obtain ⟨D, hD, -, hDs⟩ := exists_small_disc (hint y (hyG y hyΔ)) (hΔ.isOpen_discInt hman) hyΔ + have hDG : D ⊆ G := hDs.trans hyG + have hG : SameOn pos₁ (pullPos (capBack cap) o.pos) D := + (sameOn_const hman hGo hGc hint (hP'.mono hGJ) (hJ.mono hGJ) hE hD hEs hDG).1 hE₁ + exact (sameOn_of_subset hman hhered hP' hJ hsub hD hΔ (hDs.trans (discInt_subset Δ))).1 hG a b c + ha hb hc hab hbc hac + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CapUnique.lean b/LeanPool/GraphMinor/GM19/CapUnique.lean new file mode 100644 index 0000000000..ce331a6e3b --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CapUnique.lean @@ -0,0 +1,258 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Perimeter +public import LeanPool.GraphMinor.GM19.RadialExists + +/-! +# Two cappings of a surface are homeomorphic + +A homeomorphism between the boundaries of two closed discs extends to the discs. So the identity of +`Σ` extends over +the pasted discs of any two cappings. The paper speaks of "the" surface `Σ̂` (Section 2, page 327), +and this is why. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface + +variable {A B : Type} [TopologicalSpace A] [TopologicalSpace B] + +/-- A homeomorphism of the boundaries of two closed discs extends to the discs. -/ +theorem exists_disc_ext {D₁ : Set A} {D₂ : Set B} (h₁ : IsClosedDisc D₁) (h₂ : IsClosedDisc D₂) + (e : discBd D₁ ≃ₜ discBd D₂) : + ∃ G : A → B, ContinuousOn G D₁ ∧ BijOn G D₁ D₂ ∧ ∀ x : discBd D₁, G x.1 = (e x).1 := by + classical + obtain ⟨p₁, g₁, c₁⟩ := h₁.exists_isChart + obtain ⟨p₂, g₂, c₂⟩ := h₂.exists_isChart + have hs₁ : ∀ {z : ℂ}, z ∈ sphere (0 : ℂ) 1 → g₁ z ∈ discBd D₁ := fun hz ↦ c₁.g_sphere ▸ + mem_image_of_mem g₁ hz + have hs₂ : ∀ {z : ℂ}, z ∈ sphere (0 : ℂ) 1 → g₂ z ∈ discBd D₂ := fun hz ↦ c₂.g_sphere ▸ + mem_image_of_mem g₂ hz + have hsb₁ : ∀ {x}, x ∈ discBd D₁ → p₁ x ∈ sphere (0 : ℂ) 1 := fun hx ↦ c₁.bd ▸ mem_image_of_mem + p₁ hx + have hsb₂ : ∀ {x}, x ∈ discBd D₂ → p₂ x ∈ sphere (0 : ℂ) 1 := fun hx ↦ c₂.bd ▸ mem_image_of_mem + p₂ hx + have hsubb₁ : discBd D₁ ⊆ D₁ := discBd_subset _ + have hsubb₂ : discBd D₂ ⊆ D₂ := discBd_subset _ + let E : ℂ → ℂ := fun z ↦ if hz : z ∈ sphere (0 : ℂ) 1 then p₂ (e ⟨g₁ z, hs₁ hz⟩).1 else 0 + let E' : ℂ → ℂ := fun z ↦ if hz : z ∈ sphere (0 : ℂ) 1 then p₁ (e.symm ⟨g₂ z, hs₂ hz⟩).1 else 0 + have hE : ∀ {z} (hz : z ∈ sphere (0 : ℂ) 1), E z = p₂ (e ⟨g₁ z, hs₁ hz⟩).1 + := fun hz ↦ dite_eq_left hz + have hE' : ∀ {z} (hz : z ∈ sphere (0 : ℂ) 1), E' z = p₁ (e.symm ⟨g₂ z, hs₂ hz⟩).1 + := fun hz ↦ dite_eq_left hz + have hEs : ∀ {z}, z ∈ sphere (0 : ℂ) 1 → E z ∈ sphere (0 : ℂ) 1 := fun hz ↦ by + rw [hE hz] + exact hsb₂ (e _).2 + have hEs' : ∀ {z}, z ∈ sphere (0 : ℂ) 1 → E' z ∈ sphere (0 : ℂ) 1 := fun hz ↦ by + rw [hE' hz] + exact hsb₁ (e.symm _).2 + have hsph : sphere (0 : ℂ) 1 ⊆ closedBall 0 1 := sphere_subset_closedBall + have hm : BdMatch (sphere (0 : ℂ) 1) (sphere (0 : ℂ) 1) E E' := by + refine ⟨fun z hz ↦ hEs hz, fun z hz ↦ hEs' hz, fun z hz ↦ ?_, fun z hz ↦ ?_, ?_, ?_⟩ + · rw [hE' (hEs hz)] + have : (⟨g₂ (E z), hs₂ (hEs hz)⟩ : discBd D₂) = e ⟨g₁ z, hs₁ hz⟩ := by + apply Subtype.ext + change g₂ (E z) = _ + rw [hE hz] + exact c₂.gh (hsubb₂ (e _).2) + rw [this, e.symm_apply_apply] + exact c₁.hg (hsph hz) + · rw [hE (hEs' hz)] + have : (⟨g₁ (E' z), hs₁ (hEs' hz)⟩ : discBd D₁) = e.symm ⟨g₂ z, hs₂ hz⟩ := by + apply Subtype.ext + change g₁ (E' z) = _ + rw [hE' hz] + exact c₁.gh (hsubb₁ (e.symm _).2) + rw [this, e.apply_symm_apply] + exact c₂.hg (hsph hz) + · rw [continuousOn_iff_continuous_domRestrict] + have h₃ : Continuous fun z : sphere (0 : ℂ) 1 ↦ (⟨g₁ z.1, hs₁ z.2⟩ : discBd D₁) := + ((c₁.gc.mono hsph).comp_continuous continuous_subtype_val fun z ↦ z.2).subtype_mk _ + have h₄ : Continuous fun z : sphere (0 : ℂ) 1 ↦ (e ⟨g₁ z.1, hs₁ z.2⟩).1 := + continuous_subtype_val.comp (e.continuous.comp h₃) + have h₅ : Continuous fun z : sphere (0 : ℂ) 1 ↦ p₂ (e ⟨g₁ z.1, hs₁ z.2⟩).1 := + (c₂.hc.mono hsubb₂).comp_continuous h₄ fun z ↦ (e _).2 + exact h₅.congr fun z ↦ (hE z.2).symm + · rw [continuousOn_iff_continuous_domRestrict] + have h₃ : Continuous fun z : sphere (0 : ℂ) 1 ↦ (⟨g₂ z.1, hs₂ z.2⟩ : discBd D₂) := + ((c₂.gc.mono hsph).comp_continuous continuous_subtype_val fun z ↦ z.2).subtype_mk _ + have h₄ : Continuous fun z : sphere (0 : ℂ) 1 ↦ (e.symm ⟨g₂ z.1, hs₂ z.2⟩).1 := + continuous_subtype_val.comp (e.symm.continuous.comp h₃) + have h₅ : Continuous fun z : sphere (0 : ℂ) 1 ↦ p₁ (e.symm ⟨g₂ z.1, hs₂ z.2⟩).1 := + (c₁.hc.mono hsubb₁).comp_continuous h₄ fun z ↦ (e.symm _).2 + exact h₅.congr fun z ↦ (hE' z.2).symm + obtain ⟨ψ, hψc, hψb, hψe⟩ := exists_extension oArc_sphere oArc_sphere hm + rw [closedInner_sphere] at hψc hψb + refine ⟨g₂ ∘ ψ ∘ p₁, c₂.gc.comp (hψc.comp c₁.hc c₁.hm) (hψb.mapsTo.comp c₁.hm), ?_, fun x ↦ ?_⟩ + · refine ⟨fun x hx ↦ c₂.gm (hψb.mapsTo (c₁.hm hx)), fun x hx y hy h ↦ ?_, fun y hy ↦ ?_⟩ + · have h₃ := c₂.hg.injOn (hψb.mapsTo (c₁.hm hx)) (hψb.mapsTo (c₁.hm hy)) h + have h₄ := hψb.injOn (c₁.hm hx) (c₁.hm hy) h₃ + rw [← c₁.gh hx, ← c₁.gh hy, h₄] + · obtain ⟨w, hw, hwe⟩ := hψb.surjOn (c₂.hm hy) + refine ⟨g₁ w, c₁.gm hw, ?_⟩ + simp only [Function.comp_apply, c₁.hg hw, hwe] + exact c₂.gh hy + · have hx := x.2 + simp only [Function.comp_apply] + rw [hψe (hsb₁ hx), hE (hsb₁ hx)] + have : (⟨g₁ (p₁ x.1), hs₁ (hsb₁ hx)⟩ : discBd D₁) = x := Subtype.ext (c₁.gh (hsubb₁ hx)) + rw [this] + exact c₂.gh (hsubb₂ (e x).2) + +variable {S T₁ T₂ : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace T₁] [TopologicalSpace + T₂] + +omit [T2Space S] in +/-- A capping of a surface is unique up to homeomorphism. We extend the identity of `Σ` over each +pasted disc. -/ +theorem IsCappedSurface.nonempty_homeomorph (hS : IsSurface S) (cap₁ : IsCappedSurface S T₁) + (cap₂ : IsCappedSurface S T₂) : Nonempty (T₁ ≃ₜ T₂) := by + classical + have hs₁ := cap₁.isSurface + have hs₂ := cap₂.isSurface + have : T2Space T₁ := hs₁.2.1 + have : T2Space T₂ := hs₂.2.1 + have : CompactSpace T₁ := hs₁.1 + have : CompactSpace S := hS.1 + have hc₁ := cap₁.isClosedEmbedding hS + have hc₂ := cap₂.isClosedEmbedding hS + have hdisc : ∀ Θ ∈ cuffs S, ∃ G : T₁ → T₂, ContinuousOn G (closure (cap₁.cuffDisc Θ)) ∧ + BijOn G (closure (cap₁.cuffDisc Θ)) (closure (cap₂.cuffDisc Θ)) ∧ ∀ y ∈ Θ, G (cap₁.emb y) + = cap₂.emb y := by + intro Θ hΘ + have hb₁ := cap₁.cuffDisc_bd Θ hΘ + have hb₂ := cap₂.cuffDisc_bd Θ hΘ + let e₁ : Θ ≃ₜ discBd (closure (cap₁.cuffDisc Θ)) := + (cap₁.isEmbedding.homeomorphImage Θ).trans (Homeomorph.setCongr hb₁.symm) + let e₂ : Θ ≃ₜ discBd (closure (cap₂.cuffDisc Θ)) := + (cap₂.isEmbedding.homeomorphImage Θ).trans (Homeomorph.setCongr hb₂.symm) + obtain ⟨G, hG, hb, he⟩ := exists_disc_ext (cap₁.cuffDisc_closedDisc Θ hΘ) + (cap₂.cuffDisc_closedDisc Θ hΘ) + (e₁.symm.trans e₂) + refine ⟨G, hG, hb, fun y hy ↦ ?_⟩ + have := he (e₁ ⟨y, hy⟩) + simp only [Homeomorph.trans_apply, Homeomorph.symm_apply_apply] at this + exact this + have : Nonempty T₂ := cap₂.connected.toNonempty + choose! G hGc hGb hGe using hdisc + have hfin : (cuffs S).Finite := (cuff_statement S hS).2.1 + have hd₁ : ∀ x, x ∉ range cap₁.emb → ∃ Θ ∈ cuffs S, x ∈ cap₁.cuffDisc Θ := fun x hx ↦ by + have : x ∈ (range cap₁.emb)ᶜ := hx + rw [cap₁.compl_eq] at this + simpa using this + have hd₂ : ∀ x, x ∉ range cap₂.emb → ∃ Θ ∈ cuffs S, x ∈ cap₂.cuffDisc Θ := fun x hx ↦ by + have : x ∈ (range cap₂.emb)ᶜ := hx + rw [cap₂.compl_eq] at this + simpa using this + let H : T₁ → T₂ := fun x ↦ if h : x ∈ range cap₁.emb then cap₂.emb h.choose else + if h' : ∃ Θ ∈ cuffs S, x ∈ cap₁.cuffDisc Θ then G h'.choose x else Classical.arbitrary T₂ + have hH₁ : ∀ y, H (cap₁.emb y) = cap₂.emb y := fun y ↦ by + have h : cap₁.emb y ∈ range cap₁.emb := mem_range_self y + change dite _ _ _ = _ + rw [dite_eq_left h, cap₁.isEmbedding.injective h.choose_spec] + have hH₂ : ∀ Θ ∈ cuffs S, ∀ x ∈ closure (cap₁.cuffDisc Θ), H x = G Θ x := by + intro Θ hΘ x hx + rw [cap₁.closure_cuffDisc hΘ] at hx + rcases hx with hx | ⟨y, hy, rfl⟩ + · have hr := cap₁.notMem_range hΘ hx + have h' : ∃ Θ ∈ cuffs S, x ∈ cap₁.cuffDisc Θ := ⟨Θ, hΘ, hx⟩ + change dite _ _ _ = _ + rw [dite_eq_right hr, dite_eq_left h'] + have hch := h'.choose_spec + have he : h'.choose = Θ := by + by_contra hne + exact disjoint_left.1 (cap₁.cuffDisc_disjoint _ hch.1 _ hΘ hne) (subset_closure hch.2) + (subset_closure hx) + rw [he] + · rw [hH₁, hGe Θ hΘ y hy] + have hsub₁ : ∀ {Θ}, Θ ∈ cuffs S → cap₁.emb '' Θ ⊆ closure (cap₁.cuffDisc Θ) := fun {Θ} hΘ ↦ by + rw [cap₁.closure_cuffDisc hΘ] + exact subset_union_right + have hrange₂ : ∀ {Θ}, Θ ∈ cuffs S → ∀ y, cap₂.emb y ∈ closure (cap₂.cuffDisc Θ) → y ∈ Θ + := fun {Θ} hΘ y hy ↦ by + rw [cap₂.closure_cuffDisc hΘ] at hy + rcases hy with hy | ⟨z, hz, he⟩ + · exact absurd (mem_range_self y) (cap₂.notMem_range hΘ hy) + · exact cap₂.isEmbedding.injective he ▸ hz + have hcont : Continuous H := by + have : Finite (cuffs S) := hfin + let f : Option (cuffs S) → Set T₁ := fun o ↦ o.elim (range cap₁.emb) fun Θ ↦ closure + (cap₁.cuffDisc Θ.1) + refine LocallyFinite.continuous (f := f) (locallyFinite_of_finite f) ?_ ?_ ?_ + · refine eq_univ_of_forall fun x ↦ ?_ + by_cases hx : x ∈ range cap₁.emb + · exact mem_iUnion.2 ⟨none, hx⟩ + · obtain ⟨Θ, hΘ, h⟩ := hd₁ x hx + exact mem_iUnion.2 ⟨some ⟨Θ, hΘ⟩, subset_closure h⟩ + · rintro (_ | Θ) + · exact hc₁.isClosed_range + · exact isClosed_closure + · rintro (_ | Θ) + · change ContinuousOn H (range cap₁.emb) + rw [continuousOn_iff_continuous_domRestrict] + have : (range cap₁.emb).domRestrict H = cap₂.emb ∘ cap₁.isEmbedding.toHomeomorph.symm := by + funext z + obtain ⟨z, y, rfl⟩ := z + have h₁ : cap₁.isEmbedding.toHomeomorph.symm ⟨_, mem_range_self y⟩ = y := + cap₁.isEmbedding.toHomeomorph.symm_apply_apply y + change H (cap₁.emb y) = cap₂.emb (cap₁.isEmbedding.toHomeomorph.symm ⟨_, mem_range_self + y⟩) + rw [h₁, hH₁] + rw [this] + exact cap₂.isEmbedding.continuous.comp (Homeomorph.continuous _) + · exact (hGc Θ.1 Θ.2).congr (hH₂ Θ.1 Θ.2) + have hinj : Function.Injective H := by + have key : ∀ y x, x ∉ range cap₁.emb → H (cap₁.emb y) ≠ H x := fun y x hx he ↦ by + obtain ⟨Θ, hΘ, h⟩ := hd₁ x hx + have hxc := subset_closure h + rw [hH₁, hH₂ Θ hΘ x hxc] at he + have hm := (hGb Θ hΘ).mapsTo hxc + rw [← he] at hm + have hy := hrange₂ hΘ y hm + have := (hGb Θ hΘ).injOn (hsub₁ hΘ (mem_image_of_mem _ hy)) hxc (by rw [hGe Θ hΘ y hy, he]) + exact hx (this ▸ mem_range_self y) + intro x x' he + by_cases hx : x ∈ range cap₁.emb + · obtain ⟨y, rfl⟩ := hx + by_cases hx' : x' ∈ range cap₁.emb + · obtain ⟨y', rfl⟩ := hx' + rw [hH₁, hH₁] at he + rw [cap₂.isEmbedding.injective he] + · exact absurd he (key y x' hx') + · by_cases hx' : x' ∈ range cap₁.emb + · obtain ⟨y', rfl⟩ := hx' + exact absurd he.symm (key y' x hx) + · obtain ⟨Θ, hΘ, h⟩ := hd₁ x hx + obtain ⟨Θ', hΘ', h'⟩ := hd₁ x' hx' + have hc := subset_closure h + have hc' := subset_closure h' + rw [hH₂ Θ hΘ x hc, hH₂ Θ' hΘ' x' hc'] at he + by_cases hne : Θ = Θ' + · subst hne + exact (hGb Θ hΘ).injOn hc hc' he + · have h₁ := (hGb Θ hΘ).mapsTo hc + rw [he] at h₁ + exact absurd ((hGb Θ' hΘ').mapsTo hc') (disjoint_left.1 (cap₂.cuffDisc_disjoint _ hΘ _ + hΘ' hne) h₁) + have hsurj : Function.Surjective H := by + intro y + by_cases hy : y ∈ range cap₂.emb + · obtain ⟨z, rfl⟩ := hy + exact ⟨_, hH₁ z⟩ + · obtain ⟨Θ, hΘ, h⟩ := hd₂ y hy + obtain ⟨x, hx, rfl⟩ := (hGb Θ hΘ).surjOn (subset_closure h) + exact ⟨x, hH₂ Θ hΘ x hx⟩ + exact ⟨hcont.homeoOfEquivCompactToT2 (f := Equiv.ofBijective H ⟨hinj, hsurj⟩)⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CellFlat.lean b/LeanPool/GraphMinor/GM19/CellFlat.lean new file mode 100644 index 0000000000..747689f8e1 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CellFlat.lean @@ -0,0 +1,363 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.FlatCover +public import LeanPool.GraphMinor.Surface.ArcDisc + +/-! +# Adding cells to a flat set + +A set is flat if paths in it with the same ends are homotopic. Graph Minors XI shows that the +regions of a drawing, with a small +open set around each vertex of a small set, form a flat set, when the short circuits of its radial +drawing are null-homotopic. +The skeleton of a painting has more regions than the painting has: each disc edge adds a cell. We +have no radial circuits around +these cells. So we add the cells afterwards. + +Let `Z` be a flat open set and let `c` be a cell. If two points of `Z` in `c` are always joined by a +path in `Z` and a path in `c` +of the same class, then `Z ∪ c` is flat (`flat_union_of_common`). To arrange this we shrink the sets +around the vertices, so that +each looks like a corner of the cell (`IsCone`). The result used later is `exists_flat_with_cells`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM11 + +variable {T : Type} [TopologicalSpace T] + +/-- Two flat open sets, the second one path-connected, have a flat union if paths in the two sets +agree between common points. -/ +theorem flat_union_of_common {Z c : Set T} (hZo : IsOpen Z) (hco : IsOpen c) (hZ : Flat Z) + (hc : Flat c) (hcp : IsPathConnected c) + (hpair : ∀ x ∈ Z ∩ c, ∀ y ∈ Z ∩ c, ∃ f : Cl x y, Arw Z f ∧ Arw c f) : Flat (Z ∪ c) := by + classical + have hclose : ∀ {a x y : T} {g₁ : Cl a x} {g₂ : Cl x y}, x ∈ Z ∩ c → y ∈ Z ∩ c → Arw Z g₁ + → Arw c g₂ → Arw Z (g₁.trans g₂) := by + intro a x y g₁ g₂ hx hy h₁ h₂ + obtain ⟨f, hfZ, hfc⟩ := hpair x hx y hy + rw [hc.eq h₂ hfc] + exact h₁.trans hfZ + have key : ∀ (a e : T) (p : Path a e), (∀ u, p u ∈ Z ∪ c) → a ∈ Z → e ∈ Z → Arw Z (Cl.mk p) := by + intro a e p hp ha he + let Q : ∀ d : T, Cl a d → Prop := fun d g => (d ∈ Z ∧ Arw Z g) ∨ + (d ∈ c ∧ ∃ x, x ∈ Z ∩ c ∧ ∃ (g₁ : Cl a x) (g₂ : Cl x d), Arw Z g₁ ∧ Arw c g₂ ∧ g + = g₁.trans g₂) + have hQ : Q e (Cl.mk p) := by + refine cl_induction (𝒞 := {Z, c}) ?_ p ?_ Q (.inl ⟨ha, arw_refl ha⟩) ?_ + · rintro O (rfl | rfl) + · exact hZo + · exact hco + · intro u + rcases hp u with h | h + · exact ⟨Z, .inl rfl, h⟩ + · exact ⟨c, .inr rfl, h⟩ + · rintro y d g r O (rfl | rfl) hr h + · have hyO : y ∈ O := by simpa using hr 0 + have hdO : d ∈ O := by simpa using hr 1 + rcases h with ⟨-, hg⟩ | ⟨hyc, x, hx, g₁, g₂, h₁, h₂, rfl⟩ + · exact .inl ⟨hdO, hg.trans (Arw.of_path r hr)⟩ + · exact .inl ⟨hdO, (hclose hx ⟨hyO, hyc⟩ h₁ h₂).trans (Arw.of_path r hr)⟩ + · have hyO : y ∈ O := by simpa using hr 0 + have hdO : d ∈ O := by simpa using hr 1 + rcases h with ⟨hyZ, hg⟩ | ⟨-, x, hx, g₁, g₂, h₁, h₂, rfl⟩ + · exact .inr ⟨hdO, y, ⟨hyZ, hyO⟩, g, Cl.mk r, hg, Arw.of_path r hr, rfl⟩ + · refine .inr ⟨hdO, x, hx, g₁, g₂.trans (Cl.mk r), h₁, h₂.trans (Arw.of_path r hr), ?_⟩ + rw [cl_assoc] + rcases hQ with ⟨-, h⟩ | ⟨hec, x, hx, g₁, g₂, h₁, h₂, h⟩ + · exact h + · rw [h] + exact hclose hx ⟨he, hec⟩ h₁ h₂ + intro a b p q hp hq + by_cases hne : (Z ∩ c).Nonempty + · obtain ⟨w, hw⟩ := hne + have hstart : ∀ x ∈ Z ∪ c, ∃ (z : T) (α : Cl z x), z ∈ Z ∧ Arw (Z ∪ c) α := fun x hx => by + by_cases hxZ : x ∈ Z + · exact ⟨x, Cl.rf x, hxZ, arw_refl (.inl hxZ)⟩ + · have hj := hcp.joinedIn w hw.2 x (hx.resolve_left hxZ) + exact ⟨w, Cl.mk hj.somePath, hw.1, hj.somePath, fun u => .inr (hj.somePath_mem u), rfl⟩ + obtain ⟨z₀, α, hz₀, hα⟩ := hstart a (by simpa using hp 0) + obtain ⟨z₁, β, hz₁, hβ⟩ := hstart b (by simpa using hp 1) + have hk : ∀ f : Cl z₀ z₁, Arw (Z ∪ c) f → Arw Z f := by + rintro _ ⟨r, hr, rfl⟩ + exact key _ _ r hr hz₀ hz₁ + have e : α.trans ((Cl.mk p).trans β.symm) = α.trans ((Cl.mk q).trans β.symm) := + hZ.eq (hk _ (hα.trans ((Arw.of_path p hp).trans hβ.symm))) (hk _ (hα.trans + ((Arw.of_path q hq).trans hβ.symm))) + exact Path.Homotopic.Quotient.eq.mp (cl_cancel α β.symm e) + · have hd : Z ∩ c ⊆ ∅ := fun x hx => hne ⟨x, hx⟩ + have hdisj : Disjoint Z c := disjoint_iff_inter_eq_empty.mpr (subset_empty_iff.mp hd) + have hr : ∀ r : Path a b, (∀ u, r u ∈ Z ∪ c) → (a ∈ Z → ∀ u, r u ∈ Z) ∧ (a ∈ c → ∀ u, r u ∈ c) + := fun r hr => by + have hpre : IsPreconnected (range r) := isPreconnected_range r.continuous + have hsub : range r ⊆ Z ∪ c := by + rintro _ ⟨u, rfl⟩ + exact hr u + have h0 : a ∈ range r := ⟨0, by simp⟩ + refine ⟨fun ha u => ?_, fun ha u => ?_⟩ + · exact hpre.subset_left_of_subset_union hZo hco hdisj hsub ⟨a, h0, ha⟩ ⟨u, rfl⟩ + · exact hpre.subset_right_of_subset_union hZo hco hdisj hsub ⟨a, h0, ha⟩ ⟨u, rfl⟩ + rcases (by simpa using hp 0 : a ∈ Z ∪ c) with ha | ha + · exact hZ p q ((hr p hp).1 ha) ((hr q hq).1 ha) + · exact hc p q ((hr p hp).2 ha) ((hr q hq).2 ha) + +/-- A finite disjoint family of cells can be added to a flat open set. -/ +theorem flat_union_finite {ι : Type*} {I : Set ι} (hI : I.Finite) {Z : Set T} (c : ι → Set T) + (hZo : IsOpen Z) (hZ : Flat Z) + (hco : ∀ i ∈ I, IsOpen (c i)) (hc : ∀ i ∈ I, Flat (c i)) (hcp : ∀ i ∈ I, IsPathConnected (c i)) + (hdisj : ∀ i ∈ I, ∀ j ∈ I, i ≠ j → Disjoint (c i) (c j)) + (hpair : ∀ i ∈ I, ∀ x ∈ Z ∩ c i, ∀ y ∈ Z ∩ c i, ∃ f : Cl x y, Arw Z f ∧ Arw (c i) f) : Flat + (Z ∪ ⋃ i ∈ I, c i) := by + classical + induction I, hI using Set.Finite.induction_on with + | empty => simpa using hZ + | @insert a I ha hI ih => + have hI' := ih (fun i hi => hco i (.inr hi)) (fun i hi => hc i (.inr hi)) (fun i hi => hcp i + (.inr hi)) + (fun i hi j hj => hdisj i (.inr hi) j (.inr hj)) (fun i hi => hpair i (.inr hi)) + have e : Z ∪ ⋃ i ∈ insert a I, c i = (Z ∪ ⋃ i ∈ I, c i) ∪ c a := by + rw [biUnion_insert] + ext x + simp only [mem_union] + tauto + rw [e] + have hmeet : ∀ x ∈ (Z ∪ ⋃ i ∈ I, c i) ∩ c a, x ∈ Z := fun x hx => by + rcases hx.1 with h | h + · exact h + · obtain ⟨i, hi, hxi⟩ := mem_iUnion₂.mp h + have hne : a ≠ i := fun h' => ha (h' ▸ hi) + exact absurd hxi (disjoint_left.mp (hdisj a (.inl rfl) i (.inr hi) hne) hx.2) + refine flat_union_of_common (hZo.union (isOpen_biUnion fun i hi => hco i (.inr hi))) (hco a + (.inl rfl)) hI' (hc a (.inl rfl)) + (hcp a (.inl rfl)) fun x hx y hy => ?_ + obtain ⟨f, h₁, h₂⟩ := hpair a (.inl rfl) x ⟨hmeet x hx, hx.2⟩ y ⟨hmeet y hy, hy.2⟩ + exact ⟨f, h₁.mono subset_union_left, h₂⟩ + +/-- The set `N` looks like a corner of the disc `Δ` at the point `s`. -/ +structure IsCone (Δ : Set T) (s : T) (N : Set T) : Prop where + to_point : ∀ x ∈ N ∩ Δ, ∃ f : Cl s x, Arw (N ∩ Δ) f + in_cell : ∀ x ∈ (N ∩ Δ) ∩ discInt Δ, ∀ y ∈ (N ∩ Δ) ∩ discInt Δ, ∃ f : Cl x y, Arw + ((N ∩ Δ) ∩ discInt Δ) f + +theorem IsCone.congr {Δ N N' : Set T} {s : T} (h : IsCone Δ s N) (e : N ∩ Δ + = N' ∩ Δ) : IsCone Δ s N' := by + refine ⟨fun x hx => ?_, fun x hx y hy => ?_⟩ + · simp only [← e] at hx ⊢ + exact h.to_point x hx + · simp only [← e] at hx hy ⊢ + exact h.in_cell x hx y hy + +/-- Each point on the boundary of a closed disc has small neighbourhoods that are corners of the +disc. -/ +theorem exists_cone {Δ W : Set T} {s : T} (hΔ : IsClosedDisc Δ) (hs : s ∈ discBd Δ) (hW : IsOpen W) + (hsW : s ∈ W) : + ∃ N, IsOpen N ∧ s ∈ N ∧ N ⊆ W ∧ IsCone Δ s N := by + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + have hsΔ : s ∈ Δ := Surface.discBd_subset _ hs + have hp : h s ∈ sphere (0 : ℂ) 1 := by + rw [← c.bd] + exact mem_image_of_mem _ hs + have hpB : h s ∈ closedBall (0 : ℂ) 1 := sphere_subset_closedBall hp + have hgp : g (h s) = s := c.gh hsΔ + obtain ⟨Y, hY, hYe⟩ := continuousOn_iff'.mp c.gc W hW + have hpY : h s ∈ Y := by + have : h s ∈ g ⁻¹' W ∩ closedBall 0 1 := ⟨by change g _ ∈ W; rwa [hgp], hpB⟩ + rw [hYe] at this + exact this.1 + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hY _ hpY + obtain ⟨O', hO', hOe⟩ := continuousOn_iff'.mp c.hc _ (isOpen_ball (x := h s) (ε := ε)) + have hN : ∀ x, x ∈ (O' ∩ W) ∩ Δ ↔ x ∈ Δ ∧ h x ∈ ball (h s) ε := fun x => by + constructor + · rintro ⟨⟨h₁, -⟩, h₃⟩ + have : x ∈ O' ∩ Δ := ⟨h₁, h₃⟩ + rw [← hOe] at this + exact ⟨h₃, this.1⟩ + · rintro ⟨h₁, h₂⟩ + have h₃ : x ∈ h ⁻¹' ball (h s) ε ∩ Δ := ⟨h₂, h₁⟩ + rw [hOe] at h₃ + have h₄ : h x ∈ Y ∩ closedBall 0 1 := ⟨hball h₂, c.hm h₁⟩ + rw [← hYe] at h₄ + have h₅ : g (h x) ∈ W := h₄.1 + rw [c.gh h₁] at h₅ + exact ⟨⟨h₃.1, h₅⟩, h₁⟩ + have hpath : ∀ K : Set ℂ, K ⊆ closedBall 0 1 → Convex ℝ K → ∀ u ∈ K, ∀ v ∈ K, ∃ p : Path (g u) + (g v), ∀ t, p t ∈ g '' K := by + intro K hK hconv u hu v hv + have hj := (hconv.isPathConnected ⟨u, hu⟩).joinedIn u hu v hv + refine ⟨⟨⟨fun t => g (hj.somePath t), c.gc.comp_continuous hj.somePath.continuous fun t => hK + (hj.somePath_mem t)⟩, by simp, by simp⟩, fun t => ?_⟩ + exact ⟨_, hj.somePath_mem t, rfl⟩ + have himg : ∀ K : Set ℂ, K ⊆ closedBall 0 1 → K ⊆ ball (h s) ε → g '' K ⊆ (O' ∩ W) ∩ Δ := by + rintro K hK hb _ ⟨z, hz, rfl⟩ + refine (hN _).mpr ⟨c.gm (hK hz), ?_⟩ + rw [c.hg (hK hz)] + exact hb hz + refine ⟨O' ∩ W, hO'.inter hW, ⟨?_, hsW⟩, inter_subset_right, ?_, ?_⟩ + · have : s ∈ h ⁻¹' ball (h s) ε ∩ Δ := ⟨mem_ball_self hε, hsΔ⟩ + rw [hOe] at this + exact this.1 + · intro x hx + obtain ⟨hxΔ, hxb⟩ := (hN x).mp hx + obtain ⟨p, hp'⟩ := hpath (closedBall 0 1 ∩ ball (h s) ε) inter_subset_left + ((convex_closedBall _ _).inter (convex_ball _ _)) _ + ⟨hpB, mem_ball_self hε⟩ _ ⟨c.hm hxΔ, hxb⟩ + refine ⟨_, p.cast hgp.symm (c.gh hxΔ).symm, fun t => ?_, rfl⟩ + exact himg _ inter_subset_left inter_subset_right (hp' t) + · intro x hx y hy + have hk : ∀ w ∈ ((O' ∩ W) ∩ Δ) ∩ discInt Δ, h w ∈ ball (0 : ℂ) 1 ∩ ball (h s) ε := fun w hw + => by + obtain ⟨hwΔ, hwb⟩ := (hN w).mp hw.1 + have h₂ := hw.2 + rw [c.discInt_eq] at h₂ + obtain ⟨z, hz, rfl⟩ := h₂ + refine ⟨?_, hwb⟩ + rwa [c.hg (ball_subset_closedBall hz)] + have hsub : ball (0 : ℂ) 1 ∩ ball (h s) ε ⊆ closedBall 0 1 := inter_subset_left.trans + ball_subset_closedBall + obtain ⟨p, hp'⟩ := hpath _ hsub ((convex_ball _ _).inter (convex_ball _ _)) _ (hk x hx) _ + (hk y hy) + refine ⟨_, p.cast (c.gh hx.1.2).symm (c.gh hy.1.2).symm, fun t => ?_, rfl⟩ + refine ⟨himg _ hsub inter_subset_right (hp' t), ?_⟩ + change p t ∈ discInt Δ + rw [c.discInt_eq] + obtain ⟨z, hz, hzt⟩ := hp' t + exact ⟨z, hz.1, hzt⟩ + +/-- Points of `Z` in a cell have a common class, if `Z` meets the cell only in corners and two +corners are joined by a class in +`Z` and in the closed cell. -/ +theorem cell_pair {Z Δ : Set T} {S₀ : Set T} {D : T → Set T} (hΔ : IsClosedDisc Δ) + (hcp : IsPathConnected (discInt Δ)) + (hDZ : ∀ s ∈ S₀, D s ⊆ Z) (hcone : ∀ s ∈ S₀, s ∈ Δ → IsCone Δ s (D s)) + (hmeet : ∀ x ∈ Z ∩ discInt Δ, ∃ s ∈ S₀, s ∈ Δ ∧ x ∈ D s) + (hg : ∀ a ∈ S₀, ∀ b ∈ S₀, a ∈ Δ → b ∈ Δ → a ≠ b → ∃ g : Cl a b, Arw Z g ∧ Arw Δ g) : + ∀ x ∈ Z ∩ discInt Δ, ∀ y ∈ Z ∩ discInt Δ, ∃ f : Cl x y, Arw Z f ∧ Arw (discInt Δ) f := by + intro x hx y hy + have hfl : Flat Δ := IsSimplyConnectedSet.flat (IsClosedDisc.isSimplyConnectedSet hΔ) + have hI : discInt Δ ⊆ Δ := sdiff_subset + obtain ⟨a, ha, haΔ, hxa⟩ := hmeet x hx + obtain ⟨b, hb, hbΔ, hyb⟩ := hmeet y hy + by_cases hab : a = b + · subst hab + obtain ⟨f, hf⟩ := (hcone a ha haΔ).in_cell x ⟨⟨hxa, hI hx.2⟩, hx.2⟩ y ⟨⟨hyb, hI hy.2⟩, hy.2⟩ + exact ⟨f, hf.mono fun z hz => hDZ a ha hz.1.1, hf.mono fun z hz => hz.2⟩ + · obtain ⟨g, hgZ, hgΔ⟩ := hg a ha b hb haΔ hbΔ hab + obtain ⟨f₁, hf₁⟩ := (hcone a ha haΔ).to_point x ⟨hxa, hI hx.2⟩ + obtain ⟨f₂, hf₂⟩ := (hcone b hb hbΔ).to_point y ⟨hyb, hI hy.2⟩ + have hj := hcp.joinedIn x hx.2 y hy.2 + have hc : Arw (discInt Δ) (Cl.mk hj.somePath) := Arw.of_path _ hj.somePath_mem + refine ⟨Cl.mk hj.somePath, ?_, hc⟩ + have e : Cl.mk hj.somePath = f₁.symm.trans (g.trans f₂) := + hfl.eq (hc.mono hI) ((hf₁.mono inter_subset_right).symm.trans (hgΔ.trans + (hf₂.mono inter_subset_right))) + rw [e] + exact (hf₁.mono fun z hz => hDZ a ha hz.1).symm.trans (hgZ.trans (hf₂.mono fun z hz + => hDZ b hb hz.1)) + +/-- **Adding cells to a flat set.** Let `R` be an open set that misses the cells of a finite family, +and let `S₀` be a set of corners. +Suppose `R`, with a small open set around each point of `S₀`, is flat. Suppose that two corners of a +cell are joined by a class that +has a path in `R` and a path in the closed cell. Then after we shrink the small open sets, the cells +can be added. -/ +theorem exists_flat_with_cells (hT : IsClosedSurface T) {𝒟 : Set (Set T)} (h𝒟 : 𝒟.Finite) + (hd : ∀ Δ ∈ 𝒟, IsClosedDisc Δ) {V₀ : Set T} + (hV₀ : V₀.Finite) (hmeet : ∀ Δ ∈ 𝒟, ∀ Δ' ∈ 𝒟, Δ ≠ Δ' → Δ ∩ Δ' ⊆ V₀) + (hint : ∀ Δ ∈ 𝒟, ∀ Δ' ∈ 𝒟, Δ ≠ Δ' → Disjoint (discInt Δ) (discInt Δ')) {S₀ : Set T} + (hbd : ∀ Δ ∈ 𝒟, ∀ s ∈ S₀, s ∈ Δ → s ∈ discBd Δ) {R : Set T} (hR : IsOpen R) + (hRc : ∀ Δ ∈ 𝒟, Disjoint R (discInt Δ)) + {D : T → Set T} (hDo : ∀ s ∈ S₀, IsOpen (D s)) (hsD : ∀ s ∈ S₀, s ∈ D s) (hfl : Flat + (R ∪ ⋃ s ∈ S₀, D s)) + (hg : ∀ Δ ∈ 𝒟, ∀ a ∈ S₀, ∀ b ∈ S₀, a ∈ Δ → b ∈ Δ → a ≠ b → ∃ g : Cl a b, Arw (R ∪ {a, b}) g + ∧ Arw Δ g) : + ∃ D' : T → Set T, (∀ s ∈ S₀, IsOpen (D' s)) ∧ (∀ s ∈ S₀, s ∈ D' s) ∧ + Flat ((R ∪ ⋃ s ∈ S₀, D' s) ∪ ⋃ Δ ∈ 𝒟, discInt Δ) := by + classical + have : T2Space T := hT.2.1 + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + have hcl : ∀ Δ ∈ 𝒟, IsClosed Δ := fun Δ hΔ => (IsClosedDisc.isCompact (hd Δ hΔ)).isClosed + let G : T → Set T := fun s => D s \ ((V₀ \ {s}) ∪ ⋃ Δ ∈ {Δ ∈ 𝒟 | s ∉ Δ}, Δ) + have hGo : ∀ s ∈ S₀, IsOpen (G s) := fun s hs => (hDo s hs).sdiff + ((hV₀.subset sdiff_subset).isClosed.union ((h𝒟.subset (sep_subset _ _)).isClosed_biUnion fun Δ + hΔ => hcl Δ hΔ.1)) + have hsG : ∀ s ∈ S₀, s ∈ G s := fun s hs => ⟨hsD s hs, by + rintro (h | h) + · exact h.2 rfl + · obtain ⟨Δ, hΔ, hsΔ⟩ := mem_iUnion₂.mp h + exact hΔ.2 hsΔ⟩ + have hN : ∀ Δ ∈ 𝒟, ∀ s ∈ S₀, s ∈ Δ → ∃ N, IsOpen N ∧ s ∈ N ∧ N ⊆ G s ∧ IsCone Δ s N + := fun Δ hΔ s hs hsΔ => + exists_cone (hd Δ hΔ) (hbd Δ hΔ s hs hsΔ) (hGo s hs) (hsG s hs) + choose! N hNo hsN hNG hNc using hN + let D' : T → Set T := fun s => G s \ ⋃ Δ ∈ {Δ ∈ 𝒟 | s ∈ Δ}, (Δ \ N Δ s) + have hD'o : ∀ s ∈ S₀, IsOpen (D' s) := fun s hs => (hGo s hs).sdiff + ((h𝒟.subset (sep_subset _ _)).isClosed_biUnion fun Δ hΔ => (hcl Δ hΔ.1).sdiff + (hNo Δ hΔ.1 s hs hΔ.2)) + have hsD' : ∀ s ∈ S₀, s ∈ D' s := fun s hs => ⟨hsG s hs, fun h => by + obtain ⟨Δ, hΔ, hsΔ⟩ := mem_iUnion₂.mp h + exact hsΔ.2 (hsN Δ hΔ.1 s hs hΔ.2)⟩ + have hD'D : ∀ s ∈ S₀, D' s ⊆ D s := fun s _ x hx => hx.1.1 + have hcone : ∀ s ∈ S₀, ∀ Δ ∈ 𝒟, s ∈ Δ → IsCone Δ s (D' s) := fun s hs Δ hΔ hsΔ => by + refine (hNc Δ hΔ s hs hsΔ).congr (Subset.antisymm ?_ ?_) + · rintro x ⟨hxN, hxΔ⟩ + refine ⟨⟨hNG Δ hΔ s hs hsΔ hxN, fun h => ?_⟩, hxΔ⟩ + obtain ⟨Δ', hΔ', hxΔ'⟩ := mem_iUnion₂.mp h + by_cases he : Δ = Δ' + · subst he + exact hxΔ'.2 hxN + · have hxV : x ∈ V₀ := hmeet Δ hΔ Δ' hΔ'.1 he ⟨hxΔ, hxΔ'.1⟩ + have hxs : x = s := by + by_contra hne + exact (hNG Δ hΔ s hs hsΔ hxN).2 (.inl ⟨hxV, hne⟩) + subst hxs + exact hxΔ'.2 (hsN Δ' hΔ'.1 x hs hΔ'.2) + · rintro x ⟨hx, hxΔ⟩ + refine ⟨?_, hxΔ⟩ + by_contra hn + exact hx.2 (mem_iUnion₂.mpr ⟨Δ, ⟨hΔ, hsΔ⟩, hxΔ, hn⟩) + have hZo : IsOpen (R ∪ ⋃ s ∈ S₀, D' s) := hR.union (isOpen_biUnion hD'o) + have hZ : Flat (R ∪ ⋃ s ∈ S₀, D' s) := hfl.mono (union_subset_union_right _ + (biUnion_mono Subset.rfl hD'D)) + have hsub : ∀ s ∈ S₀, D' s ⊆ R ∪ ⋃ s ∈ S₀, D' s := fun s hs x hx => .inr + (mem_iUnion₂.mpr ⟨s, hs, hx⟩) + refine ⟨D', hD'o, hsD', flat_union_finite h𝒟 discInt hZo hZ (fun Δ hΔ => + (hd Δ hΔ).isOpen_discInt hman) + (fun Δ hΔ => (IsSimplyConnectedSet.flat (IsClosedDisc.isSimplyConnectedSet + (hd Δ hΔ))).mono sdiff_subset) + (fun Δ hΔ => ?_) hint fun Δ hΔ => ?_⟩ + · obtain ⟨h, g, c⟩ := (hd Δ hΔ).exists_isChart + rw [c.discInt_eq] + exact ((convex_ball (0 : ℂ) 1).isPathConnected ⟨0, by simp⟩).image' + (c.gc.mono ball_subset_closedBall) + · refine cell_pair (D := D') (S₀ := S₀) (hd Δ hΔ) ?_ hsub (fun s hs hsΔ + => hcone s hs Δ hΔ hsΔ) ?_ ?_ + · obtain ⟨h, g, c⟩ := (hd Δ hΔ).exists_isChart + rw [c.discInt_eq] + exact ((convex_ball (0 : ℂ) 1).isPathConnected ⟨0, by simp⟩).image' + (c.gc.mono ball_subset_closedBall) + · rintro x ⟨hxZ | hxZ, hxc⟩ + · exact absurd hxc (disjoint_left.mp (hRc Δ hΔ) hxZ) + · obtain ⟨s, hs, hxs⟩ := mem_iUnion₂.mp hxZ + refine ⟨s, hs, ?_, hxs⟩ + by_contra hsΔ + exact hxs.1.2 (.inr (mem_iUnion₂.mpr ⟨Δ, ⟨hΔ, hsΔ⟩, hxc.1⟩)) + · intro a ha b hb haΔ hbΔ hab + obtain ⟨g, hgR, hgΔ⟩ := hg Δ hΔ a ha b hb haΔ hbΔ hab + refine ⟨g, hgR.mono ?_, hgΔ⟩ + rintro x (hx | rfl | rfl) + · exact .inl hx + · exact hsub _ ha (hsD' _ ha) + · exact hsub _ hb (hsD' _ hb) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CircleLift.lean b/LeanPool/GraphMinor/GM19/CircleLift.lean new file mode 100644 index 0000000000..71c22184c6 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CircleLift.lean @@ -0,0 +1,390 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.MoveCuff +public import LeanPool.GraphMinor.Surface.DiscGrow +public import LeanPool.GraphMinor.Surface.CircleOrder +public import Mathlib.Topology.Homotopy.Lifting +public import Mathlib.Analysis.SpecialFunctions.Complex.Circle +public import Mathlib.AlgebraicTopology.FundamentalGroupoid.SimplyConnected +public import Mathlib.Topology.Homotopy.Contractible +public import Mathlib.Analysis.Convex.Contractible +import Mathlib.Topology.Order.IntermediateValue + +/-! +# Lifting homeomorphisms of the circle + +Every homeomorphism of the circle lifts to a continuous monotone map of the real line, since the map +`exp` +from the line to the circle is a covering map. From this we get that orientation preserving +homeomorphisms +are closed under inverse and under conjugation. We also build the homeomorphism that moves a given +arc of the circle onto the upper half circle. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.CircleOrder + +local notation "𝕀" => unitInterval + +theorem exists_circle_lift_map (f : C(ℝ, Circle)) : ∃ L : ℝ → ℝ, Continuous L ∧ + ∀ t, Circle.exp (L t) = f t := by + obtain ⟨z, hz⟩ : ∃ z : ℝ, Circle.exp z = f 0 := ⟨Complex.arg (f 0), Circle.exp_arg _⟩ + obtain ⟨F, ⟨-, hF⟩, -⟩ := Circle.isCoveringMap_exp.existsUnique_continuousMap_lifts f 0 z hz + exact ⟨F, F.continuous, fun t ↦ congrFun hF t⟩ + +/-- A continuous real function with values in the multiples of `c` on an interval is constant. -/ +theorem eq_of_multiples {g : ℝ → ℝ} {c a b : ℝ} (hc : 0 < c) (hab : a ≤ b) (hg : ContinuousOn g + (Icc a b)) + (hm : ∀ t ∈ Icc a b, ∃ m : ℤ, g t = m * c) : g b = g a := by + obtain ⟨m, hma⟩ := hm a (left_mem_Icc.mpr hab) + obtain ⟨n, hnb⟩ := hm b (right_mem_Icc.mpr hab) + have key : ∀ k : ℤ, ¬ ((k + 1 / 2 : ℝ) * c ∈ uIcc (g a) (g b)) := by + intro k hk + obtain ⟨t, ht, he⟩ := intermediate_value_uIcc (uIcc_of_le hab ▸ hg) hk + rw [uIcc_of_le hab] at ht + obtain ⟨l, hl⟩ := hm t ht + rw [hl] at he + have h1 : (l : ℝ) = k + 1 / 2 := mul_right_cancel₀ hc.ne' he + have h2 : (2 * l : ℤ) = 2 * k + 1 := by exact_mod_cast (by linarith : (2 * l : ℝ) = 2 * k + 1) + omega + by_contra hne + have hmn : m ≠ n := fun h ↦ hne (by rw [hma, hnb, h]) + rcases lt_or_gt_of_ne hmn with h | h + · refine key m ?_ + rw [hma, hnb, uIcc_of_le (by gcongr)] + have h1 : (m + 1 : ℝ) ≤ n := by exact_mod_cast h + constructor + · nlinarith + · nlinarith + · refine key n ?_ + rw [hma, hnb, uIcc_of_ge (by gcongr)] + have h1 : (n + 1 : ℝ) ≤ m := by exact_mod_cast h + constructor + · nlinarith + · nlinarith + +theorem exp_add_two_pi (t : ℝ) : Circle.exp (t + 2 * Real.pi) = Circle.exp t := by + rw [Circle.exp_add, Circle.exp_two_pi, mul_one] + +/-- Two continuous lifts of the same map differ by a constant. -/ +theorem lift_diff_const {L M : ℝ → ℝ} (hL : Continuous L) (hM : Continuous M) + (h : ∀ t, Circle.exp (L t) = Circle.exp (M t)) (s t : ℝ) : L s - M s = L t - M t := by + have hpi := Real.pi_pos + have hm : ∀ t, ∃ m : ℤ, L t - M t = m * (2 * Real.pi) := fun t ↦ by + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp (h t) + exact ⟨m, by rw [hm]; ring⟩ + have hmm : ∀ s t, s ≤ t → L t - M t = L s - M s := fun s t hst ↦ + eq_of_multiples (by positivity) hst (hL.sub hM).continuousOn fun t _ ↦ hm t + rcases le_total s t with h | h + · exact (hmm s t h).symm + · exact hmm t s h + +/-- Every homeomorphism of the circle lifts to a continuous strictly monotone map of the line. -/ +theorem exists_circle_lift (τ : Circle ≃ₜ Circle) : + ∃ L : ℝ → ℝ, Continuous L ∧ (StrictMono L ∨ StrictAnti L) ∧ + ∀ t, τ (Circle.exp t) = Circle.exp (L t) := by + have hpi := Real.pi_pos + obtain ⟨L, hLc, hL⟩ := exists_circle_lift_map + ⟨fun t ↦ τ (Circle.exp t), τ.continuous.comp Circle.exp.continuous⟩ + have hL' : ∀ t, τ (Circle.exp t) = Circle.exp (L t) := fun t ↦ (hL t).symm + have hper : ∀ s t, L (s + 2 * Real.pi) - L s = L (t + 2 * Real.pi) - L t := fun s t ↦ by + have := lift_diff_const (L := fun t ↦ L (t + 2 * Real.pi)) (M := L) + (hLc.comp (continuous_id.add continuous_const)) hLc (fun t ↦ by + rw [← hL', ← hL', exp_add_two_pi]) s t + exact this + obtain ⟨d, hd⟩ : ∃ d : ℤ, L (0 + 2 * Real.pi) = L 0 + d * (2 * Real.pi) := by + have h : Circle.exp (L (0 + 2 * Real.pi)) = Circle.exp (L 0) := by + rw [← hL', ← hL', exp_add_two_pi] + exact Circle.exp_eq_exp.mp h + have hstep : ∀ t, L (t + 2 * Real.pi) = L t + d * (2 * Real.pi) := fun t ↦ by + have := hper t 0 + rw [hd] at this + linarith + have hd0 : d ≠ 0 := by + rintro rfl + let D : ℝ → ℝ := fun θ ↦ L θ - L (θ + Real.pi) + have hD : Continuous D := by fun_prop + have h2 : D Real.pi = - D 0 := by + have h3 := hstep 0 + simp only [Int.cast_zero, zero_mul, add_zero, zero_add] at h3 + have h4 : Real.pi + Real.pi = 2 * Real.pi := by ring + simp only [D, h4, h3, zero_add] + ring + obtain ⟨θ, hθ⟩ : ∃ θ, D θ = 0 := by + rcases le_total (D 0) 0 with h | h + · obtain ⟨θ, -, hθ⟩ := intermediate_value_Icc hpi.le hD.continuousOn + (show (0 : ℝ) ∈ Icc (D 0) (D Real.pi) from ⟨h, by rw [h2]; linarith⟩) + exact ⟨θ, hθ⟩ + · obtain ⟨θ, -, hθ⟩ := intermediate_value_Icc' hpi.le hD.continuousOn + (show (0 : ℝ) ∈ Icc (D Real.pi) (D 0) from ⟨by rw [h2]; linarith, h⟩) + exact ⟨θ, hθ⟩ + have h5 : L θ = L (θ + Real.pi) := sub_eq_zero.mp hθ + have h6 : Circle.exp θ = Circle.exp (θ + Real.pi) := τ.injective (by rw [hL', hL', h5]) + have h7 : Circle.exp Real.pi = 1 := by + have := mul_left_cancel (a := Circle.exp θ) (b := 1) (c := Circle.exp Real.pi) (by + rw [mul_one, ← Circle.exp_add]; exact h6) + exact this.symm + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp (h7.trans Circle.exp_zero.symm) + have h8 : (1 : ℝ) = m * 2 := by + have : Real.pi * 1 = Real.pi * (m * 2) := by linarith + exact mul_left_cancel₀ hpi.ne' this + have h9 : (1 : ℤ) = m * 2 := by exact_mod_cast h8 + omega + have hmul : ∀ (k : ℤ) t, L (t + k * (2 * Real.pi)) = L t + k * d * (2 * Real.pi) := by + intro k + induction k using Int.induction_on with + | zero => simp + | succ i ih => + intro t + have h1 := hstep (t + i * (2 * Real.pi)) + have h2 := ih t + push_cast at h2 ⊢ + rw [show t + (i + 1) * (2 * Real.pi) = t + i * (2 * Real.pi) + 2 * Real.pi by ring, h1, h2] + ring + | pred i ih => + intro t + have := hstep (t + (-(i : ℝ) - 1) * (2 * Real.pi)) + push_cast + rw [show t + (-(i : ℝ) - 1) * (2 * Real.pi) + 2 * Real.pi = t + (-(i : ℝ)) * + (2 * Real.pi) by ring] at this + have h2 := ih t + push_cast at h2 + linarith + have hinj : Function.Injective L := fun s t he ↦ by + have h1 : Circle.exp s = Circle.exp t := τ.injective (by rw [hL', hL', he]) + obtain ⟨k, hk⟩ := Circle.exp_eq_exp.mp h1 + have h2 := hmul k t + rw [← hk, he] at h2 + have h3 : (k : ℝ) * d * (2 * Real.pi) = 0 := by linarith + have h4 : (k : ℝ) * d = 0 := by + rcases mul_eq_zero.mp h3 with h | h + · exact h + · exact absurd h (by positivity) + have h5 : (k : ℝ) = 0 := by + rcases mul_eq_zero.mp h4 with h | h + · exact h + · exact absurd (by exact_mod_cast h) hd0 + rw [hk, h5] + ring + exact ⟨L, hLc, hLc.strictMono_of_inj hinj, hL'⟩ + +/-- A lift of the identity is a translation, so it is increasing. -/ +theorem strictMono_of_lift_id {F : ℝ → ℝ} (hF : Continuous F) + (h : ∀ t, Circle.exp (F t) = Circle.exp t) : StrictMono F := by + intro s t hst + have := lift_diff_const hF continuous_id h s t + simp only [id] at this + linarith + +theorem preserves_symm {ψ : Circle ≃ₜ Circle} (hψ : PreservesCircleOrientation ψ) : + PreservesCircleOrientation ψ.symm := by + obtain ⟨l, hlc, hlm, hl⟩ := hψ + obtain ⟨M, hMc, hM, hMe⟩ := exists_circle_lift ψ.symm + have hcomp : StrictMono (M ∘ l) := strictMono_of_lift_id (hMc.comp hlc) fun t ↦ by + rw [Function.comp, ← hMe, ← hl] + simp + rcases hM with hM | hM + · exact ⟨M, hMc, hM, hMe⟩ + · exact absurd (hcomp (zero_lt_one)) (not_lt.mpr (hM.comp_strictMono hlm zero_lt_one).le) + +theorem preserves_conj (τ : Circle ≃ₜ Circle) {ψ : Circle ≃ₜ Circle} + (hψ : PreservesCircleOrientation ψ) : + PreservesCircleOrientation (τ.trans (ψ.trans τ.symm)) := by + obtain ⟨l, hlc, hlm, hl⟩ := hψ + obtain ⟨L, hLc, hL, hLe⟩ := exists_circle_lift τ + obtain ⟨M, hMc, hM, hMe⟩ := exists_circle_lift τ.symm + have hcomp : StrictMono (M ∘ L) := strictMono_of_lift_id (hMc.comp hLc) fun t ↦ by + rw [Function.comp, ← hMe, ← hLe] + simp + refine ⟨M ∘ l ∘ L, hMc.comp (hlc.comp hLc), ?_, fun t ↦ ?_⟩ + · rcases hL with hL | hL <;> rcases hM with hM | hM + · exact hM.comp (hlm.comp hL) + · exact absurd (hcomp zero_lt_one) (not_lt.mpr (hM.comp_strictMono hL zero_lt_one).le) + · exact absurd (hcomp zero_lt_one) (not_lt.mpr (hM.comp_strictAnti hL zero_lt_one).le) + · exact hM.comp (hlm.comp_strictAnti hL) + · simp only [Homeomorph.trans_apply, Function.comp] + rw [hLe, hl, hMe] + +/-- Two pairs of arcs that each cover the circle: there is a homeomorphism of the circle that takes +one +pair to the other. -/ +theorem exists_glue {a b a' b' : 𝕀 → Circle} (h : IsTwoArcs a b) (h' : IsTwoArcs a' b') + (hu : range a ∪ range b = univ) (hu' : range a' ∪ range b' = univ) : + ∃ ψ : Circle ≃ₜ Circle, ∀ r, ψ (a r) = a' r ∧ ψ (b r) = b' r := by + have key : ∀ {a b a' b' : 𝕀 → Circle}, IsTwoArcs a b → IsTwoArcs a' b' → + ∀ x y, Sum.elim a b x = Sum.elim a b y → Sum.elim a' b' x = Sum.elim a' b' y := by + intro a b a' b' h h' x y he + rcases x with s | s <;> rcases y with t | t <;> simp only [Sum.elim_inl, Sum.elim_inr] at he ⊢ + · rw [h.arc_left.2 he] + · rcases h.meet s t he with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact h'.zero.symm + · exact h'.one.symm + · rcases h.meet t s he.symm with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact h'.zero + · exact h'.one + · rw [h.arc_right.2 he] + have hq : ∀ {a b : 𝕀 → Circle}, IsTwoArcs a b → range a ∪ range b = univ → + Topology.IsQuotientMap (Sum.elim a b) ∧ Function.Surjective (Sum.elim a b) := by + intro a b h hu + have hc : Continuous (Sum.elim a b) := h.arc_left.1.sumElim h.arc_right.1 + have hs : Function.Surjective (Sum.elim a b) := fun z ↦ by + have : z ∈ range a ∪ range b := hu ▸ mem_univ z + rcases this with ⟨r, rfl⟩ | ⟨r, rfl⟩ + · exact ⟨Sum.inl r, rfl⟩ + · exact ⟨Sum.inr r, rfl⟩ + exact ⟨hc.isClosedMap.isQuotientMap hc hs, hs⟩ + obtain ⟨hQ, hS⟩ := hq h hu + obtain ⟨hQ', hS'⟩ := hq h' hu' + let f : Circle → Circle := fun z ↦ Sum.elim a' b' (Function.surjInv hS z) + let f' : Circle → Circle := fun z ↦ Sum.elim a b (Function.surjInv hS' z) + have hf : ∀ x, f (Sum.elim a b x) = Sum.elim a' b' x := fun x ↦ + key h h' _ _ (Function.surjInv_eq hS _) + have hf' : ∀ x, f' (Sum.elim a' b' x) = Sum.elim a b x := fun x ↦ + key h' h _ _ (Function.surjInv_eq hS' _) + have hfc : Continuous f := by + rw [hQ.continuous_iff] + have : f ∘ Sum.elim a b = Sum.elim a' b' := funext hf + rw [this] + exact h'.arc_left.1.sumElim h'.arc_right.1 + have hfc' : Continuous f' := by + rw [hQ'.continuous_iff] + have : f' ∘ Sum.elim a' b' = Sum.elim a b := funext hf' + rw [this] + exact h.arc_left.1.sumElim h.arc_right.1 + refine ⟨⟨⟨f, f', fun z ↦ ?_, fun z ↦ ?_⟩, hfc, hfc'⟩, fun r ↦ ⟨hf (Sum.inl r), hf (Sum.inr r)⟩⟩ + · obtain ⟨x, rfl⟩ := hS z + rw [hf, hf'] + · obtain ⟨x, rfl⟩ := hS' z + rw [hf', hf] + +/-- The arc from `u` of length `θ` moves onto the upper half circle, by an orientation preserving +homeomorphism. -/ +theorem exists_circle_move (u : Circle) {θ : ℝ} (hθ : θ ∈ Ioo 0 (2 * Real.pi)) : + ∃ ψ : Circle ≃ₜ Circle, PreservesCircleOrientation ψ ∧ + ∀ s ∈ Icc 0 θ, ψ (u * Circle.exp s) = Circle.exp (Real.pi * (s / θ)) := by + have hpi := Real.pi_pos + obtain ⟨a, b, hab, ha, hb, hun⟩ := circle_two_arcs' u hθ + obtain ⟨a', b', hab', ha', hb', hun'⟩ := circle_two_arcs' 1 + (show Real.pi ∈ Ioo 0 (2 * Real.pi) from ⟨hpi, by linarith⟩) + obtain ⟨ψ, hψ⟩ := exists_glue hab hab' hun hun' + have hs : ∀ s ∈ Icc 0 θ, ψ (u * Circle.exp s) = Circle.exp (Real.pi * (s / θ)) := fun s hs ↦ by + have hr : s / θ ∈ Icc (0 : ℝ) 1 := ⟨div_nonneg hs.1 hθ.1.le, (div_le_one hθ.1).mpr hs.2⟩ + have h1 := (hψ ⟨s / θ, hr⟩).1 + rw [ha, ha'] at h1 + simp only [one_mul] at h1 + rw [show s / θ * θ = s from div_mul_cancel₀ _ hθ.1.ne'] at h1 + rw [h1, mul_comm] + refine ⟨ψ, ?_, hs⟩ + obtain ⟨L, hLc, hL, hLe⟩ := exists_circle_lift ψ + rcases hL with hL | hL + · exact ⟨L, hLc, hL, hLe⟩ + · exfalso + let α : ℝ := Complex.arg u + have hα : u = Circle.exp α := (Circle.exp_arg u).symm + have hconst := fun t (ht : t ∈ Icc 0 θ) ↦ hs t ht + have hg : (fun s ↦ L (α + s) - Real.pi * (s / θ)) θ = (fun s ↦ L (α + s) - Real.pi * (s / θ)) 0 + := by + have hcont : Continuous fun s ↦ L (α + s) - Real.pi * (s / θ) := by + have : Continuous fun s ↦ L (α + s) := hLc.comp (continuous_const.add continuous_id) + fun_prop + refine eq_of_multiples (c := 2 * Real.pi) (by positivity) hθ.1.le hcont.continuousOn fun t ht + ↦ ?_ + have h1 := hs t ht + rw [hα, ← Circle.exp_add, hLe] at h1 + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h1 + exact ⟨m, by rw [hm]; ring⟩ + simp only [add_zero, zero_div, mul_zero, sub_zero] at hg + have h2 : L (α + θ) < L α := hL (by linarith [hθ.1]) + have h3 : Real.pi * (θ / θ) = Real.pi := by rw [div_self hθ.1.ne', mul_one] + rw [h3] at hg + linarith + +/-- A homeomorphism of the circle with an increasing lift keeps the cyclic order. -/ +theorem CircleCyclic.map_increasing_lift {τ : Circle ≃ₜ Circle} {L : ℝ → ℝ} (hc : Continuous L) + (hm : StrictMono L) + (hl : ∀ t, τ (Circle.exp t) = Circle.exp (L t)) {a b c : Circle} (h : CircleCyclic a b c) : + CircleCyclic (τ a) (τ b) (τ c) := by + obtain ⟨s, t, hs, hst, ht, rfl, rfl⟩ := h + obtain ⟨α, rfl⟩ := CircleOrder.exists_angle_of_circle a + have hpi := Real.pi_pos + have hsmall : L (α + t) < L α + 2 * Real.pi := by + by_contra hn + push Not at hn + have hle : L α ≤ L (α + t) := (hm (by linarith : α < α + t)).le + obtain ⟨y, hy, hLy⟩ := intermediate_value_Icc (by linarith : α ≤ α + t) hc.continuousOn + (show L α + 2 * Real.pi ∈ Icc (L α) (L (α + t)) from ⟨by linarith, hn⟩) + have h1 : Circle.exp y = Circle.exp α := τ.injective (by + rw [hl, hl, hLy, Circle.exp_add, Circle.exp_two_pi, mul_one]) + have h2 : α < y := by + rcases hy.1.eq_or_lt with h | h + · rw [← h] at hLy + linarith + · exact h + have h3 : Circle.exp (y - α) = Circle.exp 0 := by + rw [Circle.exp_sub, h1, Circle.exp_zero] + simp + obtain ⟨m, hm'⟩ := Circle.exp_eq_exp.1 h3 + have h4 : y - α < 2 * Real.pi := by linarith [hy.2] + have h5 : (m : ℝ) * (2 * Real.pi) = y - α := by linarith + have h6 : (0 : ℝ) < m := by + by_contra hn' + push Not at hn' + nlinarith + have h7 : (m : ℝ) < 1 := by nlinarith + have h8 : (0 : ℤ) < m := by exact_mod_cast h6 + have h9 : m < (1 : ℤ) := by exact_mod_cast h7 + omega + have h1 : L α < L (α + s) := hm (by linarith) + have h2 : L (α + s) < L (α + t) := hm (by linarith) + refine ⟨L (α + s) - L α, L (α + t) - L α, by linarith, by linarith, by linarith, ?_, ?_⟩ + · rw [← Circle.exp_add, hl, hl, ← Circle.exp_add] + congr 1 + ring + · rw [← Circle.exp_add, hl, hl, ← Circle.exp_add] + congr 1 + ring + +/-- A homeomorphism of the circle with a decreasing lift reverses the cyclic order. -/ +theorem CircleCyclic.map_decreasing_lift {τ : Circle ≃ₜ Circle} {L : ℝ → ℝ} (hc : Continuous L) + (hm : StrictAnti L) + (hl : ∀ t, τ (Circle.exp t) = Circle.exp (L t)) {a b c : Circle} (h : CircleCyclic a b c) : + CircleCyclic (τ a) (τ c) (τ b) := by + let τ' : Circle ≃ₜ Circle := (Homeomorph.inv Circle).trans τ + have hl' : ∀ t, τ' (Circle.exp t) = Circle.exp (L (-t)) := fun t ↦ by + change τ (Circle.exp t)⁻¹ = _ + rw [← Circle.exp_neg, hl] + have := CircleCyclic.map_increasing_lift (τ := τ') (L := fun t ↦ L (-t)) + (by fun_prop) (fun _ _ h ↦ hm (neg_lt_neg h)) hl' (CircleOrder.circleCyclic_inv h) + simpa [τ'] using this + +/-- A circle homeomorphism either preserves every cyclic order or reverses every cyclic order. -/ +theorem circleCyclic_homeomorph (τ : Circle ≃ₜ Circle) : + (∀ a b c : Circle, a ≠ b → b ≠ c → a ≠ c → (CircleCyclic a b c ↔ CircleCyclic (τ a) (τ b) + (τ c))) ∨ + (∀ a b c : Circle, a ≠ b → b ≠ c → a ≠ c → (CircleCyclic a b c ↔ CircleCyclic (τ a) (τ c) + (τ b))) := by + obtain ⟨L, hc, hm, hl⟩ := exists_circle_lift τ + rcases hm with hm | hm + · refine Or.inl fun a b c hab hbc hac ↦ ⟨CircleCyclic.map_increasing_lift hc hm hl, fun h ↦ ?_⟩ + rcases circleCyclic_or hab hac hbc with h' | h' + · exact h' + · exact (CircleOrder.not_circleCyclic_both h + (CircleCyclic.map_increasing_lift hc hm hl h')).elim + · refine Or.inr fun a b c hab hbc hac ↦ ⟨CircleCyclic.map_decreasing_lift hc hm hl, fun h ↦ ?_⟩ + rcases circleCyclic_or hab hac hbc with h' | h' + · exact h' + · exact (CircleOrder.not_circleCyclic_both h + (CircleCyclic.map_decreasing_lift hc hm hl h')).elim + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CircleOrder.lean b/LeanPool/GraphMinor/GM19/CircleOrder.lean new file mode 100644 index 0000000000..3ca167e7a4 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CircleOrder.lean @@ -0,0 +1,251 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section4b +public import LeanPool.GraphMinor.Surface.DiscTwist +public import LeanPool.GraphMinor.GM19.FragmentDirection + +/-! +# Cyclic order on the circle + +Points of the circle with angles in a window of length less than one turn have the cyclic order of +their angles (`circleCyclic_ee_iff`). Finitely many such points can be moved to any points with the +same cyclic order by a homeomorphism of the circle that keeps the direction +(`exists_circle_interp`). We use this in step (2) of the proof of Graph Minors XIX, (15.2), page +381, to carry the ends of the +edges of `Γ` to the marks of the model. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Filter GraphMinor.Surface + +theorem circleCyclic_ee {x y z : ℝ} (hxy : x < y) (hyz : y < z) (hzx : z < x + 1) : CircleCyclic + (ee x) (ee y) (ee z) := by + have hpi := Real.pi_pos + refine ⟨2 * Real.pi * (y - x), 2 * Real.pi * (z - x), by nlinarith [sub_pos.mpr hxy], + by nlinarith, by nlinarith, ?_, ?_⟩ + · rw [ee, ee, ← Circle.exp_add] + congr 1 + ring + · rw [ee, ee, ← Circle.exp_add] + congr 1 + ring + +theorem CircleCyclic.rotate {a b c : Circle} (h : CircleCyclic a b c) : CircleCyclic b c a := by + obtain ⟨s, t, hs, hst, ht, rfl, rfl⟩ := h + refine ⟨t - s, 2 * Real.pi - s, by linarith, by linarith, by linarith, ?_, ?_⟩ + · rw [mul_assoc, ← Circle.exp_add] + congr 2 + ring + · rw [mul_assoc, ← Circle.exp_add, add_sub_cancel, Circle.exp_two_pi, mul_one] + +theorem circleCyclic_mul_iff (g : Circle) {a b c : Circle} : CircleCyclic (g * a) (g * b) + (g * c) ↔ CircleCyclic a b c := by + constructor + · rintro ⟨s, t, hs, hst, ht, h1, h2⟩ + rw [mul_assoc] at h1 h2 + exact ⟨s, t, hs, hst, ht, mul_left_cancel h1, mul_left_cancel h2⟩ + · rintro ⟨s, t, hs, hst, ht, rfl, rfl⟩ + exact ⟨s, t, hs, hst, ht, by rw [mul_assoc], by rw [mul_assoc]⟩ + +/-- The three rotations of a strict order. -/ +def CycOrder (x y z : ℝ) : Prop := (x < y ∧ y < z) ∨ (y < z ∧ z < x) ∨ (z < x ∧ x < y) + +/-- In a window shorter than one turn, the cyclic order of points is the order of their angles. -/ +theorem circleCyclic_ee_iff {x y z : ℝ} (h1 : x < y + 1) (h2 : y < x + 1) (h3 : y < z + 1) + (h4 : z < y + 1) (h5 : x < z + 1) (h6 : z < x + 1) (hxy : x ≠ y) (hyz : y ≠ z) (hxz : x ≠ z) : + CircleCyclic (ee x) (ee y) (ee z) ↔ CycOrder x y z := by + constructor + · intro h + rcases lt_or_gt_of_ne hxy with a | a <;> rcases lt_or_gt_of_ne hyz with b | b + <;> rcases lt_or_gt_of_ne hxz with c | c + · exact Or.inl ⟨a, b⟩ + · exact absurd (a.trans b) c.not_gt + · exact (not_circleCyclic_both h (circleCyclic_ee c b h2)).elim + · exact Or.inr (Or.inr ⟨c, a⟩) + · exact (not_circleCyclic_both h (circleCyclic_ee a c h4).rotate).elim + · exact Or.inr (Or.inl ⟨b, c⟩) + · exact absurd (b.trans a) c.not_gt + · exact (not_circleCyclic_both h (circleCyclic_ee b a h5).rotate.rotate).elim + · rintro (⟨a, b⟩ | ⟨a, b⟩ | ⟨a, b⟩) + · exact circleCyclic_ee a b h6 + · exact (circleCyclic_ee a b h1).rotate.rotate + · exact (circleCyclic_ee a b h3).rotate + +/-- A strictly increasing map on a finite subset of the line extends to a strictly increasing map of +the line. -/ +theorem exists_strictMono_interp (X : Finset ℝ) (hX : X.Nonempty) (f : ℝ → ℝ) + (hf : StrictMonoOn f X) : ∃ τ : ℝ → ℝ, Continuous τ ∧ StrictMono τ ∧ ∀ x ∈ X, τ x = f x := by + classical + let X' := {x // x ∈ X} + obtain ⟨ε, hε0, hε1, hε⟩ : ∃ ε : ℝ, 0 < ε ∧ ε < 1 ∧ ∀ x ∈ X, ∀ y ∈ X, x < y + → f x - ε * x < f y - ε * y := by + have e : ∀ᶠ ε : ℝ in 𝓝[>] 0, ∀ x : X', ∀ y : X', x.1 < y.1 → f x.1 - ε * x.1 < f y.1 - ε * y.1 + := by + refine eventually_all.mpr fun x => eventually_all.mpr fun y => ?_ + by_cases hxy : x.1 < y.1 + · have hc : Continuous fun ε : ℝ => (f y.1 - ε * y.1) - (f x.1 - ε * x.1) := by fun_prop + have h0 : 0 < (fun ε : ℝ => (f y.1 - ε * y.1) - (f x.1 - ε * x.1)) 0 := by + have := hf x.2 y.2 hxy + simp only + linarith + have := (hc.tendsto 0).eventually (lt_mem_nhds h0) + exact (this.filter_mono nhdsWithin_le_nhds).mono fun ε h _ => by linarith + · exact Eventually.of_forall fun ε h => absurd h hxy + obtain ⟨ε, h1, h2⟩ := (e.and (Ioo_mem_nhdsGT (zero_lt_one' ℝ))).exists + exact ⟨ε, h2.1, h2.2, fun x hx y hy hxy => h1 ⟨x, hx⟩ ⟨y, hy⟩ hxy⟩ + let f' : ℝ → ℝ := fun x => (f x - ε * x) / (1 - ε) + have hp : 0 < 1 - ε := by linarith + have hf' : ∀ x ∈ X, ∀ y ∈ X, x < y → f' x < f' y := fun x hx y hy hxy => div_lt_div_of_pos_right + (hε x hx y hy hxy) hp + obtain ⟨L, hL⟩ : ∃ L : ℝ, 0 ≤ L ∧ ∀ x ∈ X, ∀ y ∈ X, y < x → f' x + L * (y - x) ≤ f' y := by + have e : ∀ᶠ L : ℝ in atTop, ∀ x : X', ∀ y : X', y.1 < x.1 → f' x.1 + L * (y.1 - x.1) ≤ f' y.1 + := by + refine eventually_all.mpr fun x => eventually_all.mpr fun y => ?_ + by_cases hxy : y.1 < x.1 + · filter_upwards [eventually_ge_atTop ((f' x.1 - f' y.1) / (x.1 - y.1))] with L hL _ + have hd : 0 < x.1 - y.1 := sub_pos.mpr hxy + rw [div_le_iff₀ hd] at hL + nlinarith + · exact Eventually.of_forall fun L h => absurd h hxy + obtain ⟨L, h1, h2⟩ := (e.and (eventually_ge_atTop 0)).exists + exact ⟨L, h2, fun x hx y hy hxy => h1 ⟨x, hx⟩ ⟨y, hy⟩ hxy⟩ + obtain ⟨hL0, hL⟩ := hL + let G : ℝ → ℝ := fun t => X.sup' hX fun x => min (f' x) (f' x + L * (t - x)) + have hGc : Continuous G := Continuous.finset_sup'_apply hX fun x _ => by fun_prop + have hGm : Monotone G := fun s t hst => Finset.sup'_mono_fun fun x _ => min_le_min le_rfl + (by nlinarith [mul_le_mul_of_nonneg_left hst hL0]) + have hGx : ∀ x ∈ X, G x = f' x := fun y hy => by + refine le_antisymm (Finset.sup'_le _ _ fun x hx => ?_) ?_ + · rcases lt_trichotomy x y with h | h | h + · exact (min_le_left _ _).trans (hf' x hx y hy h).le + · rw [h] + exact min_le_left _ _ + · exact (min_le_right _ _).trans (hL x hx y hy h) + · refine le_trans (le_of_eq ?_) (Finset.le_sup' (fun x => min (f' x) (f' x + L * (y - x))) hy) + simp + refine ⟨fun t => (1 - ε) * G t + ε * t, by fun_prop, fun s t hst => ?_, fun x hx => ?_⟩ + · have := mul_le_mul_of_nonneg_left (hGm hst.le) hp.le + have h2 := mul_lt_mul_of_pos_left hst hε0 + change (1 - ε) * G s + ε * s < (1 - ε) * G t + ε * t + linarith + · change (1 - ε) * G x + ε * x = f x + rw [hGx x hx] + simp only [f'] + field_simp + ring + +/-- **Moving finitely many points of the circle.** Points with angles `a` in a window shorter than +one turn move to points `t` with the same cyclic order, by a homeomorphism that keeps the direction. +-/ +theorem exists_circle_interp {Y : Type} [Finite Y] (a : Y → ℝ) (ha : Function.Injective a) + (hw : ∀ x y, a x < a y + 1) (t : Y → Circle) (ht : Function.Injective t) + (hc : ∀ x y z, x ≠ y → y ≠ z → x ≠ z → (CircleCyclic (t x) (t y) (t z) ↔ CycOrder (a x) (a y) + (a z))) : + ∃ τ : Circle ≃ₜ Circle, PreservesCircleOrientation τ ∧ ∀ y, τ (ee (a y)) = t y := by + classical + have := Fintype.ofFinite Y + by_cases hY : IsEmpty Y + · exact ⟨Homeomorph.refl _, ⟨id, continuous_id, strictMono_id, fun _ => rfl⟩, fun y => hY.elim y⟩ + rw [not_isEmpty_iff] at hY + obtain ⟨y₀, hy₀⟩ := Finite.exists_min a + have hB : ∀ y, ∃ B : ℝ, 0 ≤ B ∧ B < 1 ∧ (y = y₀ → B = 0) ∧ (y ≠ y₀ → B ≠ 0) ∧ t y = t y₀ * ee B + := by + intro y + by_cases hy : y = y₀ + · subst hy + exact ⟨0, le_rfl, one_pos, fun _ => rfl, fun h => absurd rfl h, by simp [ee]⟩ + · have hne : (t y₀)⁻¹ * t y ≠ 1 := fun h => hy (ht ((inv_mul_eq_one.mp h).symm)) + obtain ⟨s, hs0, hs1, hs⟩ := exists_angle hne + have hpi := Real.pi_pos + refine ⟨s / (2 * Real.pi), by positivity, by rw [div_lt_one (by positivity)]; exact hs1, fun + h => absurd h hy, fun _ => by positivity, ?_⟩ + rw [ee, mul_div_cancel₀ _ (by positivity), ← hs, mul_inv_cancel_left] + choose B hB0 hB1 hBy hBn hBt using hB + let A : Y → ℝ := fun y => a y - a y₀ + have hA0 : ∀ y, 0 ≤ A y := fun y => sub_nonneg.mpr (hy₀ y) + have hA1 : ∀ y, A y < 1 := fun y => by + have := hw y y₀ + simp only [A] + linarith + have hAi : Function.Injective A := fun x y h => ha (by simpa [A] using h) + have hAy : ∀ y, y ≠ y₀ → 0 < A y := fun y hy => lt_of_le_of_ne (hA0 y) fun h => hy (hAi + (by simp [A, ← h])) + have hBp : ∀ y, y ≠ y₀ → 0 < B y := fun y hy => lt_of_le_of_ne (hB0 y) (hBn y hy).symm + have hkey : ∀ x y, A x < A y → B x < B y := by + intro x y hxy + have hy : y ≠ y₀ := fun h => by + have := hA0 x + simp only [h, A, sub_self] at hxy + linarith + by_cases hx : x = y₀ + · rw [hBy x hx] + exact hBp y hy + have hne : x ≠ y := fun h => by rw [h] at hxy; exact lt_irrefl _ hxy + have h1 : CircleCyclic (t y₀) (t x) (t y) := (hc y₀ x y (Ne.symm hx) hne (Ne.symm hy)).mpr + (Or.inl ⟨by simpa [A] using hAy x hx, by simpa [A] using hxy⟩) + rw [hBt x, hBt y] at h1 + have h1' : CircleCyclic (t y₀ * ee 0) (t y₀ * ee (B x)) (t y₀ * ee (B y)) := by + simpa [ee] using h1 + rw [circleCyclic_mul_iff, circleCyclic_ee_iff (by linarith [hBp x hx]) (by linarith [hB1 x]) + (by linarith [hBp y hy, hB1 x]) (by linarith [hBp x hx, hB1 y]) (by linarith [hBp y hy]) + (by linarith [hB1 y]) + (hBp x hx).ne (fun h => hne (ht (by rw [hBt x, hBt y, h]))) (hBp y hy).ne] at h1' + rcases h1' with ⟨_, h⟩ | ⟨h, h'⟩ | ⟨h, h'⟩ + · exact h + · exact absurd h' (not_lt.mpr (hB0 _)) + · exact absurd h (not_lt.mpr (hB0 _)) + let f : ℝ → ℝ := fun x => if h : ∃ y, A y = x then B h.choose else 1 + have hfA : ∀ y, f (A y) = B y := fun y => by + have h : ∃ y', A y' = A y := ⟨y, rfl⟩ + simp only [f, dite_eq_left h] + rw [hAi h.choose_spec] + have hf1 : f 1 = 1 := by + have h : ¬ ∃ y, A y = 1 := fun ⟨y, hy⟩ => (hA1 y).ne hy + simp only [f, dite_eq_right h] + let X : Finset ℝ := insert 1 (Finset.univ.image A) + have hX : ∀ x ∈ X, x = 1 ∨ ∃ y, x = A y := fun x hx => by + rcases Finset.mem_insert.mp hx with h | h + · exact Or.inl h + · obtain ⟨y, -, rfl⟩ := Finset.mem_image.mp h + exact Or.inr ⟨y, rfl⟩ + have hmono : StrictMonoOn f X := by + intro p hp q hq hpq + rcases hX p hp with rfl | ⟨x, rfl⟩ <;> rcases hX q hq with rfl | ⟨y, rfl⟩ + · exact absurd hpq (lt_irrefl _) + · exact absurd hpq (not_lt.mpr (hA1 y).le) + · rw [hfA, hf1] + exact hB1 x + · rw [hfA, hfA] + exact hkey x y hpq + obtain ⟨σ, hσc, hσm, hσ⟩ := exists_strictMono_interp X ⟨1, Finset.mem_insert_self _ _⟩ f hmono + have hσA : ∀ y, σ (A y) = B y := fun y => by + rw [hσ _ (Finset.mem_insert_of_mem (Finset.mem_image_of_mem A (Finset.mem_univ y))), hfA] + have hσ0 : σ 0 = 0 := by + have := hσA y₀ + simpa [A, hBy y₀ rfl] using this + have hσ1 : σ 1 = 1 := by rw [hσ 1 (Finset.mem_insert_self _ _), hf1] + obtain ⟨h, hh, he⟩ := exists_circle_homeo (τ := σ) hσc.continuousOn (hσm.strictMonoOn _) + (by rw [hσ0, hσ1, zero_add]) + refine ⟨(Homeomorph.mulLeft (ee (a y₀))⁻¹).trans (h.trans (Homeomorph.mulLeft (t y₀))), + PreservesCircleOrientation.comp (PreservesCircleOrientation.comp + (preservesCircleOrientation_mul _) hh) (preservesCircleOrientation_mul _), fun y => ?_⟩ + change t y₀ * h ((ee (a y₀))⁻¹ * ee (a y)) = t y + have h1 : (ee (a y₀))⁻¹ * ee (a y) = ee (A y) := by + rw [inv_mul_eq_iff_eq_mul, ee, ee, ee, ← Circle.exp_add] + congr 1 + simp only [A] + ring + rw [h1, he _ ⟨hA0 y, (hA1 y).le⟩, hσA, ← hBt] + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Cited.lean b/LeanPool/GraphMinor/GM19/Cited.lean new file mode 100644 index 0000000000..dd89454258 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Cited.lean @@ -0,0 +1,147 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.GM10.Defs2 +public import LeanPool.GraphMinor.GM11.Cited +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM14.Cited +public import LeanPool.GraphMinor.GM15.Cited +public import LeanPool.GraphMinor.GM16.Cited +public import LeanPool.GraphMinor.GM17.Defs2 + +/-! +# Cited Theorems from Earlier Papers Used in Graph Minors XIX + +This file collects the numbered theorems of earlier papers that N. Robertson and P. D. Seymour, +*Graph Minors. XIX. Well-quasi-ordering on a surface*, J. Combin. Theory Ser. B **90** (2004), +325–385, cites. Each one keeps the objects of its own paper, and each one is proved in another +file. + +Each item gives the pages of XIX that cite the result. + +Stated elsewhere, and reached through the imports: +- `GM14.GM07Theorem42Statement` (VII (4.2), XIX page 345), `GM14.GM07Theorem119Statement` + (VII (11.9), XIX page 345), `GM11.GM07Theorem1110Statement` (VII (11.10), XIX page 338). +- `GM14.GM11Theorem63Statement` (XI (6.3), XIX page 379, proved as `GM11.theorem_6_3_proof`), + `GM14.GM11Theorem810Statement` (XI (8.10), XIX page 345), `GM14.GM11Theorem812Statement` (XI + (8.12), XIX pages 345 and 346). +- `GM15.GM11Theorem91Statement` packages metric facts, including XI (9.1) as used on XIX page 344. +- `GM16.GM14Theorem92Statement` (XIV (9.2), which XIX generalizes on page 344). +- XI (4.3) is proved: `GM11.theorem_4_3_i`, `GM11.theorem_4_3_ii`, `GM11.theorem_4_3_iii`. +- XIV (5.2) is proved: `GM14.theorem_5_2_proof` (XIX pages 345 and 363). + +Stated here: +- `GM11Theorem85Statement` (XI (8.5), XIX pages 344 and 345), `GM11Theorem92Statement` (XI (9.2), + XIX pages 344, 345 and 355), proved as `GM11.gm19_theorem_8_5` and `GM11.gm19_theorem_9_2`. +- `GM12Theorem32Statement` (XII (3.2), XIX page 383). +- `GM17Theorem141Statement` (XVII (14.1), XIX page 383). + +- `GM07.GM07Theorem92Statement` (VII (9.2), XIX page 341) is stated in VII's words in + `GraphMinor/GM07/Defs.lean`. XIX quotes it as (6.4), and `GM19.theorem_6_4_proof` proves that + form. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology Graph +open GraphMinor.Surface GraphMinor.Hypergraph +open GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM12 GraphMinor.GM14 + +universe u + +export GraphMinor.GM07 (GM07Theorem92Statement) +export GraphMinor.GM11 (GM07Theorem1110Statement) +export GraphMinor.GM14 + (GM07Theorem42Statement GM07Theorem119Statement + GM11Theorem63Statement GM11Theorem810Statement GM11Theorem812Statement) +export GraphMinor.GM15 (GM11Theorem91Statement) +export GraphMinor.GM16 (GM14Theorem92Statement) + +/-- **Graph Minors XI, (8.5)** (page 97): +"(8.5) *Let $W$ be a closed walk in $\Gamma$ of length $< 2\theta$. Then $\mathrm{ins}(W)$ is +a restraint and $l(\mathrm{ins}(W)) \le l(W)$." -/ +def GM11Theorem85Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ (Γ : Surface.Drawing S) (two_theta : ℕ) (ins : Surface.Drawing S → Set S), + IsSlope Γ two_theta ins → + ∀ (u : S) (W : GraphWalk Γ.toGraph u u), + W.length < two_theta → + IsRestraint Γ ins two_theta (insWalk ins Γ W) ∧ + perimeterWalkLength Γ (insWalk ins Γ W) ≤ W.length + +/-- **Graph Minors XI, (9.2)** (page 105): +"(9.2) *Let $a, b \in A(\Gamma)$ and let $Y$ be a restraint with $a, b \subseteq Y$. Then +there is a tie $X$ with $a, b \subseteq X \subseteq Y$ and $l(X) \le l(Y)$." -/ +def GM11Theorem92Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ (Γ : Surface.Drawing S) (two_theta : ℕ) (ins : Surface.Drawing S → Set S), + IsSlope Γ two_theta ins → + ∀ (a b Y : Set S), + a ∈ Γ.A → b ∈ Γ.A → IsRestraint Γ ins two_theta Y → a ⊆ Y → b ⊆ Y → + ∃ X : Set S, + IsTie Γ ins two_theta X ∧ a ⊆ X ∧ b ⊆ X ∧ X ⊆ Y ∧ + perimeterWalkLength Γ X ≤ perimeterWalkLength Γ Y + +/-- **Graph Minors XII, (3.2)** (page 246): +"(3.2) *For every connected surface $\Sigma$ and all integers $t \ge 0$ and $z \ge 0$, there exists +an integer $\theta \ge 1$ such that the following is true. Let $\Delta_1, \dots, \Delta_t$ be +mutually disjoint closed discs in $\Sigma$, and let $\Gamma$ be a $2$-cell drawing in $\Sigma$ such +that $U(\Gamma) \cap \Delta_i = V(\Gamma) \cap \text{bd}(\Delta_i)$ for $1 \le i \le t$. Let +$|Z| \le z$, where* +$$Z = \bigcup_{1 \le i \le t} V(\Gamma) \cap \text{bd}(\Delta_i),$$ +*and let $(Z_j \colon 1 \le j \le p)$ be a partition of $Z$ satisfying the topological feasibility +condition above. Let $\mathscr{T}$ be a respectful tangle of order $\ge \theta$ in $\Gamma$, with +metric $d$, such that* +(i) *$d(r_i, r_j) \ge \theta$ for $1 \le i < j \le t$, where $r_i$ is the region of $\Gamma$ +meeting $\Delta_i$ for $1 \le i \le t$, and* +(ii) *$V(\Gamma) \cap \text{bd}(\Delta_i)$ is free for $1 \le i \le t$.* +Then (*) holds." -/ +def GM12Theorem32Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], + IsClosedSurface S → ConnectedSpace S → + ∀ (t z : ℕ), + ∃ θ : ℕ, 1 ≤ θ ∧ + ∀ (Δ : Fin t → Set S) (Γ : Surface.Drawing S) + (ord : ℕ) (T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (d : Set S → Set S → ℕ) (p : ℕ) (Zs : Fin p → Set S), + (∀ i : Fin t, IsClosedDisc (Δ i) ∧ Γ.U ∩ Δ i = Γ.V ∩ subBd (Δ i)) → + (∀ i j : Fin t, i ≠ j → Disjoint (Δ i) (Δ j)) → + (⋃ i : Fin t, Γ.V ∩ subBd (Δ i)).ncard ≤ z → + (⋃ j : Fin p, Zs j) = (⋃ i : Fin t, Γ.V ∩ subBd (Δ i)) → + (∀ j₁ j₂ : Fin p, j₁ ≠ j₂ → Disjoint (Zs j₁) (Zs j₂)) → + IsTopologicallyFeasible Δ Zs → + θ ≤ ord → HasTangleMetric Γ ord T d → + (∀ i j : Fin t, i ≠ j → + ∀ rᵢ ∈ Γ.R, (rᵢ ∩ Δ i).Nonempty → + ∀ rⱼ ∈ Γ.R, (rⱼ ∩ Δ j).Nonempty → + θ ≤ d rᵢ rⱼ) → + (∀ i : Fin t, IsFreeSet Γ.toHypergraph T ord (Γ.V ∩ subBd (Δ i))) → + HasConnectingSubdrawings Γ (⋃ i : Fin t, Γ.V ∩ subBd (Δ i)) Zs + +/-- **Graph Minors XVII, (14.1)** (page 207): +"(14.1) *Let $\mathscr{T}$ be a tangle of order $\theta$ in a hypergraph $G$. Let $\theta^* +\ge 1$ with $\theta^* < 2/3\theta + 1$, and let $\mathscr{T}^*$ be the set of all +separations $(A', B')$ of $G^*$ of order $< \theta^*$ such that there exists $(A, B) \in +\mathscr{T}$ with $V(A) = V(A')$ and $V(B) = V(B')$. Then $\mathscr{T}^*$ is a tangle in +$G^*$ of order $\theta^*$." +Here `G*` is the 1-skeleton of `G`, `GM17.oneSkeletonHypergraph`, and `T*` is +`GM17.oneSkeletonTangle`. -/ +def GM17Theorem141Statement : Prop := + ∀ (V E : Type u) (G : Hypergraph V E) (θ θstar : ℕ) + (T : Set (Hypergraph V E × Hypergraph V E)), + 1 ≤ θstar → 3 * θstar < 2 * θ + 3 → GM10.IsTangle G θ T → + GM10.IsTangle (GM17.oneSkeletonHypergraph G) θstar (GM17.oneSkeletonTangle G T θstar) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Conditional.lean b/LeanPool/GraphMinor/GM19/Conditional.lean new file mode 100644 index 0000000000..d466d65ce2 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Conditional.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.GM19.Defs2 + +/-! +# Statements of Graph Minors XIX, stated before their proofs + +Each statement here is a named `Prop`. A theorem that uses one of them takes it as a hypothesis, and +the statement itself is proved in another file. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +universe u w + +/-- **Graph Minors XIX, (6.4)** (page 341): +"For every surface $\Sigma$ with $bd(\Sigma) = \emptyset$, not a sphere, and every drawing +$H$ in $\Sigma$, there is a number $k$ such that for every drawing $G$ in $\Sigma$ with +$rep(G)\ge k$ there is an enlargement of $H$ in $G$." The paper quotes this as Theorem 9.2 of Graph +Minors VII. `GM19.theorem_6_4_proof` proves it. -/ +def Theorem64Statement : Prop := + ∀ (S : Type u) [TopologicalSpace S], IsSurface S → ConnectedSpace S → bd S = ∅ → ¬ IsSphere S → + ∀ H : Drawing S, H.IsGM19Drawing → ∃ k : ℕ, ∀ G : Drawing S, G.IsGM19Drawing → + (k : ℕ∞) ≤ G.rep → ∃ (σv : S → Drawing S) (σe : Set S → Set S), IsEnlargement H G σv σe + +/-- **Graph Minors VII, (5.1)** (page 230): +"If $\Sigma$ is connected and $X \subseteq \Sigma$ is solid and $X \ne \Sigma$, then $X$ is +planar if and only if every $O$-arc included in $X$ is null-homotopic." `GM07.gm07_planar_iff` +proves it. -/ +def GM07PlanarIffStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], IsSurface S → ConnectedSpace S → + ∀ X : Set S, GM11.IsSolid X → X ≠ univ → + (GM11.IsPlanar X ↔ ∀ F : Set S, IsOArc F → F ⊆ X → IsNullHomotopicOArc F) + +/-- Graph Minors VII, Section 5 (page 230), on `α(G)`: "(It is easy to see that the minimum exists +provided that $\Sigma \not\cong \Sigma(0, 0, c)$ for $c = 0$, $1$, or $2$.)" We need this for a +surface without boundary that is not a sphere. -/ +def GM07AlphaExistsStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S] [T1Space S], IsSurface S → ConnectedSpace S → bd S = ∅ → + ¬ IsSphere S → ∀ G : Drawing S, ∃ X : Set S, GM07.IsAlphaCandidate G X + +/-- **Graph Minors XIX, (4.1)** (page 333): +"If $\chi$ satisfies $\mathbf{S}_1$--$\mathbf{S}_4$ then it is not orientedly bad." The paper proves +this in Section 15. +It is a hypothesis of `GM19.theorem_3_1_proof`, and Section 15 proves it. We ask for +infinitely many labels, since the proof makes new colour schemes over the same type `β`. This loses +nothing, because `GM19.theorem_3_1_proof` first moves the labels to an infinite type. -/ +def Theorem41Statement : Prop := + ∀ (S Shat : Type u) [TopologicalSpace S] [TopologicalSpace Shat] (β : Type w) [Infinite β] + (cap : IsCappedSurface S Shat) (χ : ColourScheme S β), + ConditionS1.{u, w} Shat → ConditionS2 χ cap → ConditionS3 χ cap → ConditionS4 χ → + ¬ χ.IsOrientedlyBad + +/-- **Graph Minors XIX, (5.5)** (page 338): +"Let $\chi$ satisfy* **S**$_1$, **S**$_3$, *and let* $(\Gamma_i, \phi_i)$ $(i = 1, 2, \dots)$ +*be a similarly oriented bad sequence for $\chi$. Then for all $n \ge 0$ there exists $h \ge +1$ such that $rep(\Gamma_i) > n$ for all $i \ge h$." The value of `rep(Γ_i)` is read from any radial +drawing of `Γ_i`. The proof cuts the surface +along a feature, so it needs (5.2) and (5.3). + +The Lean form uses an infinite ambient label type `β` as in (4.1). The scheme's colour sets +can still be finite. -/ +def Theorem55Statement : Prop := + ∀ (S Shat : Type u) [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + (β : Type w) [Infinite β] (cap : IsCappedSurface S Shat) (χ : ColourScheme S β), + ConditionS1.{u, w} Shat → ConditionS3 χ cap → + ∀ P : ℕ → ColouredPainting χ, IsBadSequence χ P → IsSimilarlyOriented χ P → + ∀ (rad : ∀ i, RadialDrawing cap (P i).Γ) (n : ℕ), ∃ h, ∀ i ≥ h, (n : ℕ∞) < Painting.rep (rad i) + +/-- **Graph Minors XIX, (6.2)** (pages 339–340): +"For any surface $\Sigma$ there is a number $n$ with the following property. Let $\Phi$ be a +frame in $\Sigma$, and let $\Gamma_1, \Gamma_2$ be paintings in $\Sigma$ fitting $\Phi$, +with $rep(\Gamma_1) \ge n$. Let $\sigma$ be an* ... *inflation of $\Gamma_1$ in $\Gamma_2$ +respecting $\Phi$. Then there is a linear inflation $\sigma'$ of $\Gamma_1$ in $\Gamma_2$ +respecting $\Phi$, such that $\sigma(e) = \sigma'(e)$ for all $e \in E(\Gamma_1)$, and +$\sigma(v) \subseteq \sigma'(v)$ for all $v \in V(\Gamma_1)$." -/ +def Theorem62Statement : Prop := + ∀ (S Shat : Type u) [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + (cap : IsCappedSurface S Shat), IsSurface S → ∃ n : ℕ, ∀ (Φ : Frame S) (Γ₁ Γ₂ : Painting S) + (rad : RadialDrawing cap Γ₁), Γ₁.Fits Φ → Γ₂.Fits Φ → (n : ℕ∞) ≤ Painting.rep rad → + ∀ σv σe, IsInflation Γ₁ Γ₂ σv σe → RespectsFrame Φ Γ₁ σe → + ∃ σv', IsLinearInflation Γ₁ Γ₂ σv' σe ∧ ∀ v ∈ Γ₁.V, σv v ⊆ σv' v + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Conditional2.lean b/LeanPool/GraphMinor/GM19/Conditional2.lean new file mode 100644 index 0000000000..2115b7c0cd --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Conditional2.lean @@ -0,0 +1,315 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section9e +public import LeanPool.GraphMinor.GM19.Section10b +public import LeanPool.GraphMinor.GM19.CutTwo + +/-! +# Numbered results of Sections 5, 10, 11, 14 and 15 of Graph Minors XIX, stated before their proofs + +Each statement here is a named `Prop`. The proof of (4.1) takes it as a hypothesis, and the +statement itself is proved in another file. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} + +/-- The standing assumption of Sections 10 and 11 of Graph Minors XIX (page 353): "{S}$ is a +similarly oriented set of $\chi$-coloured paintings, such that if $(\Gamma, \phi) +\in \mathscr{S}$ and $\alpha$ is a $\Phi_\chi$-preserving homeomorphism of $\Sigma_\chi$, +then $\mathscr{S}$ contains the image of $(\Gamma, \phi)$ under $\alpha$". -/ +structure IsPaintingClass (χ : ColourScheme S α) (𝒮 : Set (ColouredPainting χ)) : Prop where + similarly_oriented : ¬ IsOrientableSurface S ∨ ∃ ω : SurfaceOrientation S, ∀ P ∈ 𝒮, ∀ e ∈ P.Γ.E, + (tilde e).ncard = 3 → ∀ a b c : S, P.Γ.γ e = [a, b, c] → ω.pos (closure e) a b c + image_mem : ∀ P ∈ 𝒮, ∀ (f : S ≃ₜ S) (P' : ColouredPainting χ), IsFramePreservingHomeo χ.Φ f → + IsColouredImage f P P' → P' ∈ 𝒮 + +/-- `ω` lists the labels of the edges of `P` bordering `side`, in order: "let the edges of +$\Gamma_0$ bordering $S$ be $f_1, \dots, f_k$, in order" (Graph Minors XIX, (15.2)). There is at +least one such edge, +since a painting that fits a frame includes the boundary, and the labels lie in `Ω_χ(S)`, because +`P` +is a `χ`-coloured painting. -/ +def IsBorderLabels {χ : ColourScheme S α} (P : ColouredPainting χ) (side : Set S) (ω : List α) : + Prop := + ω ≠ [] ∧ (∀ x ∈ ω, x ∈ (χ.ΩS side).E) ∧ ∃ (c : Set S) (f : Fin ω.length → Set S) (u₀ u₁ : S), + c ∈ cuffs S ∧ side ⊆ c ∧ TangleDatum.BordersInOrder χ P.Γ side c f u₀ u₁ ∧ + (∀ e ∈ P.Γ.E, e ⊆ side → ∃ i, f i = e) ∧ ∀ i, ω[i.val] = P.φ (f i) + +/-- **Graph Minors XIX, (5.2)** (page 335): "For every surface $\Sigma$, every frame $\Phi$ in +$\Sigma$ and every integer $n \ge 0$, +there are only finitely many equivalence classes of features in $\Phi$ with size $\le n$." -/ +def Theorem52Statement : Prop := + ∀ (S : Type) [TopologicalSpace S] [T2Space S], IsSurface S → ConnectedSpace S → ∀ (Φ : Frame S) + (n : ℕ), + ∃ 𝓕 : Set (Drawing S), 𝓕.Finite ∧ ∀ K : Drawing S, IsFeature Φ K → K.V.ncard + K.E.ncard ≤ n → + ∃ K₀ ∈ 𝓕, FeatureEquiv Φ K₀ K + +/-- The orientation of `Σ` lifts to each fragment: the proof of (5.4) says that the paintings of the +fragment are similarly oriented, "for if $\Sigma_{\chi'}$ is orientable then so is $\Sigma_\chi$". +Here `ψ` is one to +one on `Σ₁` off its boundary, so the fragment takes its orientation from `Σ`, and the lift agrees +with the orientation of `Σ` on each closed disc on which `ψ` is one to one. -/ +def FragmentOrientationStatement : Prop := + ∀ (S S₁ : Type) [TopologicalSpace S] [T2Space S] [TopologicalSpace S₁] [T2Space S₁] + (K : Drawing S) + (ψ : S₁ → S), IsSurface S → ConnectedSpace S → IsCuttingFragment S K S₁ ψ → + ∀ ω : SurfaceOrientation S, ∃ ω₁ : SurfaceOrientation S₁, ∀ Δ : Set S₁, IsClosedDisc Δ → + InjOn ψ Δ → ∀ a b c : S₁, a ∈ discBd Δ → b ∈ discBd Δ → c ∈ discBd Δ → a ≠ b → b ≠ c → a ≠ c → + (ω₁.pos Δ a b c ↔ ω.pos (ψ '' Δ) (ψ a) (ψ b) (ψ c)) + +/-- Each capping of `Σ(a, b, c)` is `Σ(a, b, 0)`. -/ +def CapModelStatement : Prop := + ∀ (a b c : ℕ) (Shat : Type) [TopologicalSpace Shat], IsCappedSurface (SurfaceModel a b c) Shat → + Nonempty (Shat ≃ₜ SurfaceModel a b 0) + +/-- If `Σ(a, b, c)` is orientable then so is `Σ(a, b, c + 1)`, which is a part of it. -/ +def ModelOrientationStatement : Prop := + ∀ a b c : ℕ, IsOrientableSurface (SurfaceModel a b c) → IsOrientableSurface (SurfaceModel a b + (c + 1)) + +/-- **Graph Minors XIX, (5.4)** (page 337): "Let $\chi$ satisfy* **S**$_3$, *and let $(\Gamma_i, +\phi_i)$ $(i = 1, 2, \dots)$ be a +similarly oriented bad sequence for $\chi$. Then for all $n \ge 0$, there exists $h \ge 0$ +such that $dist(\Gamma_i) > n$ for all $i \ge h$." + +The Lean form uses an infinite ambient label type `β` as in (4.1). The scheme's colour sets +can still be finite. -/ +def Theorem54Statement : Prop := + ∀ (S Shat : Type) [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + (β : Type w) [Infinite β] (cap : IsCappedSurface S Shat) (χ : ColourScheme S β), + ConditionS3 χ cap → ∀ P : ℕ → ColouredPainting χ, IsBadSequence χ P → IsSimilarlyOriented χ P → + ∀ (rad : ∀ i, RadialDrawing cap (P i).Γ) (n : ℕ), ∃ h, ∀ i ≥ h, (n : ℕ∞) < Painting.dist (rad i) + +/-- **Graph Minors XIX, (10.3)** (page 355): "Let $\chi$ satisfy $\mathbf{S}_1$, and let $n \ge 1$ +be an integer. Then there is a +well-behaved set $\mathscr{C}_1(n)$ of $\chi$-places with the following property. Let +$(\Gamma, \phi, \lambda, \mathscr{T}) \in \mathscr{D}$ satisfy $rep(\Gamma), +ord(\mathscr{T}) \ge n > rep(\mathscr{T})$, and $dist(\Gamma) \ge \frac{1}{2}n + 1$. Then +there is a rooted location $\mathscr{L}$ which $n$-isolates $\mathscr{T}$ and for which +$(\Gamma, \phi, \mathscr{L}) \in \mathscr{C}_1(n)$." + +The Lean form uses an infinite ambient label type `β` as in (4.1). The scheme's colour sets +can still be finite. -/ +def Theorem103Statement : Prop := + ∀ (S Shat : Type) [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + (β : Type w) [Infinite β] (cap : IsCappedSurface S Shat) + (χ : ColourScheme S β) (hd : χ.IsDisjoint) + (𝒮 : Set (ColouredPainting χ)), IsPaintingClass χ 𝒮 → ConditionS1.{0, w} Shat → ∀ n : ℕ, 1 ≤ n → + ∃ 𝒞 : Set (Place χ), IsWellBehavedPlaces 𝒞 ∧ ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → + (n : ℕ∞) ≤ Painting.rep D.rad → n ≤ D.ord → D.rep < n → + ((n + 2 : ℕ) : ℕ∞) ≤ 2 * Painting.dist D.rad → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb n D.ord D.𝒯 ∧ (⟨hd, D.P, L⟩ : Place χ) ∈ 𝒞 + +/-- **Graph Minors XIX, (10.4)** (page 356): "Let $\chi$ satisfy $\mathbf{S}_3$, and let $n \ge 1$ +be an integer. Then there is a +well-behaved set $\mathscr{C}_2(n)$ of $\chi$-places with the following property. Let +$(\Gamma, \phi, \lambda, \mathscr{T}) \in \mathscr{D}$ be $n$-flawed in distance. Then there +is a rooted location $\mathscr{L}$ which $(n + 1)$-isolates $\mathscr{T}$ and for which +$(\Gamma, \phi, \mathscr{L}) \in \mathscr{C}_2(n)$." + +The Lean form uses an infinite ambient label type `β` as in (4.1). The scheme's colour sets +can still be finite. -/ +def Theorem104Statement : Prop := + ∀ (S Shat : Type) [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + (β : Type w) [Infinite β] (cap : IsCappedSurface S Shat) + (χ : ColourScheme S β) (hd : χ.IsDisjoint) + (𝒮 : Set (ColouredPainting χ)), IsPaintingClass χ 𝒮 → ConditionS3 χ cap → ∀ n : ℕ, 1 ≤ n → + ∃ 𝒞 : Set (Place χ), IsWellBehavedPlaces 𝒞 ∧ ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → + D.IsFlawedInDistance n → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb (n + 1) D.ord D.𝒯 ∧ (⟨hd, D.P, L⟩ : Place χ) ∈ 𝒞 + +/-- Corrected form of **Graph Minors XIX, (10.5)** (page 357). The statement adds $\mathbf{S}_3$ +for the fragment with fewer cuffs. The printed statement reads: +"Let $\chi$ satisfy $\mathbf{S}_4$, and let $n \ge 0$ +be an integer. Then there is a +well-behaved set $\mathscr{C}_3(n)$ of $\chi$-places with the following property. Let +$(\Gamma, \phi, \lambda, \mathscr{T}) \in \mathscr{D}$ be $n$-flawed in freedom. Then there +is a rooted location $\mathscr{L}$ which $(n + 1)$-isolates $\mathscr{T}$ and for which +$(\Gamma, \phi, \mathscr{L}) \in \mathscr{C}_3(n)$." + +The Lean form uses an infinite ambient label type `β` as in (4.1). The scheme's colour sets +can still be finite. -/ +def Theorem105Statement : Prop := + ∀ (S Shat : Type) [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + (β : Type w) [Infinite β] (cap : IsCappedSurface S Shat) + (χ : ColourScheme S β) (hd : χ.IsDisjoint) + (𝒮 : Set (ColouredPainting χ)), IsPaintingClass χ 𝒮 → ConditionS3 χ cap → ConditionS4 χ + → ∀ n : ℕ, + ∃ 𝒞 : Set (Place χ), IsWellBehavedPlaces 𝒞 ∧ ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → + D.IsFlawedInFreedom n → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb (n + 1) D.ord D.𝒯 ∧ (⟨hd, D.P, L⟩ : Place χ) ∈ 𝒞 + +/-- **Graph Minors XIX, (11.1)** (page 358): "Let $\chi$ satisfy $S_4$, let $S$ be a long side of +$\Phi_\chi$, let $\omega_1, \dots, +\omega_m \in E(\Omega_\chi(S))$ with $m \ge 1$, and let $n \ge 4$. Then there is a +well-behaved set $\mathscr{C}_4(S, (\omega_1, \dots, \omega_m), n)$ of $\chi$-places with +the following property. Let $(\Gamma, \phi, \lambda, \mathscr{T}) \in \mathscr{D}$ be $(n, +(\omega_1, \dots, \omega_m))$-flawed on $S$. Then there is a rooted location $\mathscr{L}$ +which $(m + 1)n$-isolates $\mathscr{T}$, and for which $(\Gamma, \phi, \mathscr{L}) \in +\mathscr{C}_4(S, (\omega_1, \dots, \omega_m), n)$." + +The Lean form uses an infinite ambient label type `β` as in (4.1). The scheme's colour sets +can still be finite. -/ +def Theorem111Statement : Prop := + ∀ (S Shat : Type) [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + (β : Type w) [Infinite β] (cap : IsCappedSurface S Shat) + (χ : ColourScheme S β) (hd : χ.IsDisjoint) + (𝒮 : Set (ColouredPainting χ)), IsPaintingClass χ 𝒮 → ConditionS4 χ → + ∀ side ∈ χ.Φ.longSides, ∀ ω : List β, ω ≠ [] → (∀ x ∈ ω, x ∈ (χ.ΩS side).E) → ∀ n : ℕ, 4 ≤ n → + ∃ 𝒞 : Set (Place χ), IsWellBehavedPlaces 𝒞 ∧ ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → + D.IsFlawedOnSide side n ω → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb ((ω.length + 1) * n) D.ord D.𝒯 ∧ + (⟨hd, D.P, L⟩ : Place χ) ∈ 𝒞 + +/-- **Graph Minors XIX, (14.1)** (page 375): "Let $\chi, \mathscr{S}, \mathscr{D}$ be as in Section +10, and let $\chi$ satisfy +$\mathbf{S_2}$; let $\omega_0 \in E(\Omega_\chi(2)) \cup E(\Omega_\chi(3))$, and let $m \ge +1, n \ge 4$. Then there is a well-behaved set $\mathscr{C}_5(m, n, \omega_0)$ of $\chi$-places +with the following property. Let $(\Gamma, \phi, \lambda, \mathscr{T}) \in \mathscr{D}$ be +$(m, n, \omega_0)$-flawed internally. Then there is a rooted location $\mathscr{L}$ which +$(4n \cdot 5^{2m} + 3)$-isolates $\mathscr{T}$, and for which $(\Gamma, \phi, \mathscr{L}) +\in \mathscr{C}_5(m, n, \omega_0)$." +The printed `q_0` in the family of places is a misprint for `ω₀`. + +The Lean form uses an infinite ambient label type `β` as in (4.1). The scheme's colour sets +can still be finite. -/ +def Theorem141Statement : Prop := + ∀ (S Shat : Type) [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + (β : Type w) [Infinite β] (cap : IsCappedSurface S Shat) + (χ : ColourScheme S β) (hd : χ.IsDisjoint) + (𝒮 : Set (ColouredPainting χ)), IsPaintingClass χ 𝒮 → ConditionS2 χ cap → + ∀ (k : ℕ) (ω₀ : β), (k = 2 ∧ ω₀ ∈ χ.Ω2.E) ∨ (k = 3 ∧ ω₀ ∈ χ.Ω3.E) → ∀ m n : ℕ, 1 ≤ m → 4 ≤ n → + ∃ 𝒞 : Set (Place χ), IsWellBehavedPlaces 𝒞 ∧ ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → + D.IsFlawedInternally m n k ω₀ → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb (4 * n * 5 ^ (2 * m) + 3) D.ord D.𝒯 ∧ + (⟨hd, D.P, L⟩ : Place χ) ∈ 𝒞 + +/-- **Graph Minors XIX, (15.2)** (page 380): "15.2. *Let $\chi$ be a colour scheme, and let +$(\Gamma_0, \phi_0)$ be a $\chi$-coloured painting. Then there exist $n \ge 0$ with the following +property. Let $(\Gamma, \phi)$ be a $\chi$-coloured painting, such that $(\Gamma_0, \phi_0)$ and +$(\Gamma, \phi)$ are similarly oriented, and there is no inflation of $(\Gamma_0, \phi_0)$ in +$(\Gamma, \phi)$. Let $\mathscr{T}$ be a tangle in $\Gamma$ with metric $d$, with +$\text{rep}(\mathscr{T}) > \frac{3}{2}n$. Then either*" one of four outcomes holds. The proof of +(4.1) asks for `n` even and +at least `8` ("Choose $n \ge 4$ and even such that 15.2 holds"), and then uses (11.1) with `½n ≥ 4`. +The +proof of (15.2) allows this, since it only asks that `n` is large. -/ +def Theorem152Statement : Prop := + ∀ (S Shat : Type) [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + (β : Type w) (cap : IsCappedSurface S Shat) (χ : ColourScheme S β) (P₀ : ColouredPainting χ), + ∃ n : ℕ, 8 ≤ n ∧ Even n ∧ ∃ ω : Set S → List β, + (∀ side ∈ χ.Φ.longSides, IsBorderLabels P₀ side (ω side)) ∧ ∀ D : TangleDatum cap χ, + (¬ IsOrientableSurface S ∨ ∃ o : SurfaceOrientation S, ∀ P ∈ ({P₀, D.P} : Set _), ∀ e ∈ P.Γ.E, + (tilde e).ncard = 3 → ∀ a b c : S, P.Γ.γ e = [a, b, c] → o.pos (closure e) a b c) → + (¬ ∃ σv σe, IsColouredInflation χ P₀ D.P σv σe) → 3 * n < 2 * D.rep → + (∃ r₁ ∈ D.rad.poles, ∃ r₂ ∈ D.rad.poles, r₁ ≠ r₂ ∧ D.vDist r₁ r₂ ≤ n) ∨ + (∃ F : Drawing Shat, F.IsCircuitOf D.rad.G ∧ F.E.ncard ≤ 2 * n ∧ + ((∃ side ∈ χ.Φ.longSides, cap.emb '' side ⊆ D.ins F) ∨ + F.E.ncard < 2 * ((cap.emb '' χ.Φ.V) ∩ D.ins F).ncard)) ∨ + (∃ side ∈ χ.Φ.longSides, D.NoSideMatch side (n / 2) (ω side)) ∨ + (∃ f ∈ P₀.Γ.E, Painting.IsInternal f ∧ D.NoInternalMatch P₀.Γ.E.ncard n (tilde f).ncard + (P₀.φ f)) + +/-- How a feature `K` sits in an `O`-arc `F` of `Σ̂`. Either `F` is `K`, and `K` meets `bd(Σ)` in at +most one point, or `K` is a +line with both ends on one cuff, and the rest of `F` lies in the disc pasted onto that cuff. These +are the two cases of +"either $|U(F) \cap bd(\Sigma_\chi)| \le 1$ and $U(F) \subseteq \Sigma_\chi$, or $|U(F) \cap +bd(\Sigma_\chi)| = 2$ and $U(F) \not\subseteq \Sigma_\chi$" (page 354). -/ +def IsCutFormOf (cap : IsCappedSurface S Shat) (K : Drawing S) (F : Set Shat) : Prop := + (F = cap.emb '' K.U ∧ IsOArc K.U ∧ (K.U ∩ bd S).Subsingleton) ∨ + ∃ s t Θ, Θ ∈ cuffs S ∧ s ≠ t ∧ s ∈ Θ ∧ t ∈ Θ ∧ K.U ∩ bd S = {s, t} ∧ IsLineWithEnds K.U s t ∧ + cap.emb '' K.U ⊆ F ∧ F \ cap.emb '' K.U ⊆ cap.cuffDisc Θ + +/-- The feature `K` of the proof of (5.5) lies in a non-null-homotopic `O`-arc `F` of `Σ̂` (Graph +Minors XIX, page 339: +"`U(F)` is non-null-homotopic in `Σ̂`"). -/ +def IsCutForm (cap : IsCappedSurface S Shat) (K : Drawing S) : Prop := + ∃ F : Set Shat, IsOArc F ∧ ¬ IsNullHomotopicOArc F ∧ IsCutFormOf cap K F + +/-- The step of the proof of (5.5) (page 339): "For each fragment $\Sigma_1$ say, $\hat{\Sigma}_1$ +is simpler than $\hat{\Sigma}_\chi$ because $U(F)$ is non-null-homotopic in $\hat{\Sigma}$". -/ +def CutSimplerStatement : Prop := + ∀ (S Shat : Type) [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + (cap : IsCappedSurface S Shat) (K : Drawing S), IsSurface S → + (∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} ∧ IsLineWithEnds + (closure e) u v) → + (K.V ⊆ ⋃ e ∈ arcComponentsIn (K.U \ K.V), closure e) → K.U ∩ bd S ⊆ K.V → IsCutForm cap K → + ∃ (Y : Type) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S), IsSurface Y ∧ IsCutMap ψ K.U + ∧ HasSheets ψ K ∧ + ∀ (y : Y) (Shat₁ : Type) [TopologicalSpace Shat₁], IsCappedSurface + (connectedComponent y) Shat₁ → + IsSimplerThan Shat₁ Shat + +/-- The step of the proof of (10.2) (page 354): "let $\Sigma'$ be the fragment with $\psi(\Sigma') +\subseteq \Sigma_2$", where `Σ₂` is a disc of `Σ̂` +bounded by `F`, and "`Σ̂_{χ'}` is a sphere". -/ +def DiscSideStatement : Prop := + ∀ (S Shat : Type) [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + (cap : IsCappedSurface S Shat) (K : Drawing S) (F Δ : Set Shat), IsSurface S + → IsCutFormOf cap K F → IsClosedDisc Δ → + discBd Δ = F → ∀ (Y : Type) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S), IsSurface Y + → IsCutMap ψ K.U → + ∃ y : Y, ψ '' connectedComponent y = cap.emb ⁻¹' Δ ∧ ∀ (Shat₁ : Type) [TopologicalSpace Shat₁], + IsCappedSurface (connectedComponent y) Shat₁ → Nonempty (Shat₁ ≃ₜ SurfaceModel 0 0 0) + +/-- The shape of a distance flaw, read on `Σ̂`. The set `𝓓` holds the discs `ins(C)`, for the +circuits `C` of `F`. There are +three shapes, the three bullets on pages 355 and 356: one circuit, with two poles in its disc; a +path from a cuff to a circuit, +with one pole in the disc and the cuff outside; and two circuits with a path between them, with one +pole in each disc. -/ +def IsOuterShape (cap : IsCappedSurface S Shat) (K : Drawing S) (𝓓 : Set (Set Shat)) : Prop := + (∃ Δ, 𝓓 = {Δ} ∧ IsClosedDisc Δ ∧ IsCutFormOf cap K (discBd Δ) ∧ ∃ Θ₁ ∈ cuffs S, ∃ Θ₂ ∈ cuffs S, + Θ₁ ≠ Θ₂ ∧ + (cap.cuffDisc Θ₁ ∩ Δ).Nonempty ∧ (cap.cuffDisc Θ₂ ∩ Δ).Nonempty) ∨ + (∃ (Δ : Set Shat) (L : Set S) (s u : S) (Θ Θ' : Set S), 𝓓 = {Δ} ∧ IsClosedDisc Δ + ∧ discBd Δ ⊆ range cap.emb ∧ Θ ∈ cuffs S ∧ + Θ' ∈ cuffs S ∧ Θ ≠ Θ' ∧ s ∈ Θ ∧ ((L = {u} ∧ s = u) ∨ IsLineWithEnds L s u) ∧ + cap.emb '' K.U = discBd Δ ∪ cap.emb '' L ∧ cap.emb '' L ∩ Δ = {cap.emb u} ∧ L ∩ bd S ⊆ {s} ∧ + discBd Δ ∩ cap.emb '' bd S ⊆ {cap.emb u} ∧ Disjoint (cap.cuffDisc Θ) Δ ∧ + (cap.cuffDisc Θ' ∩ Δ).Nonempty) ∨ + (∃ (Δ₁ Δ₂ : Set Shat) (L : Set S) (a b : S) (Θ₁ Θ₂ : Set S), 𝓓 = {Δ₁, Δ₂} ∧ Δ₁ ≠ Δ₂ + ∧ IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ + discBd Δ₁ ⊆ range cap.emb ∧ discBd Δ₂ ⊆ range cap.emb ∧ ((L = {a} ∧ a = b) + ∨ IsLineWithEnds L a b) ∧ + cap.emb '' K.U = discBd Δ₁ ∪ discBd Δ₂ ∪ cap.emb '' L ∧ cap.emb '' L ∩ Δ₁ = {cap.emb a} + ∧ cap.emb '' L ∩ Δ₂ = {cap.emb b} ∧ + Disjoint (cap.emb '' bd S) (discBd Δ₁ ∪ cap.emb '' L) ∧ (discBd Δ₂ ∩ cap.emb '' bd + S).Subsingleton ∧ Δ₁ ∩ Δ₂ ⊆ {cap.emb a} ∧ + Θ₁ ∈ cuffs S ∧ Θ₂ ∈ cuffs S ∧ Θ₁ ≠ Θ₂ ∧ (cap.cuffDisc Θ₁ ∩ Δ₁).Nonempty ∧ + (cap.cuffDisc Θ₂ ∩ Δ₂).Nonempty) + +/-- The steps of the proof of (10.4) (page 357): "let $\Sigma'$ be the fragment with $\psi(\Sigma') +\subseteq \Sigma_0$", "`Σ̂_{χ'} ≅ Σ̂_χ`", +"`c(Σ_{χ'}) < c(Σ_χ)`", and "if $\Sigma_{\chi'}$ is orientable then so is $\Sigma_\chi$". -/ +def OuterSideStatement : Prop := + ∀ (S Shat : Type) [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + (cap : IsCappedSurface S Shat) (K : Drawing S) (𝓓 : Set (Set Shat)), IsSurface S + → IsOuterShape cap K 𝓓 → + ∀ (Y : Type) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S), IsSurface Y → IsCutMap ψ K.U + → + ∃ y : Y, ψ '' connectedComponent y = ⋂ Δ ∈ 𝓓, cap.emb ⁻¹' closure Δᶜ ∧ + (∀ (Shat₁ : Type) [TopologicalSpace Shat₁], IsCappedSurface (connectedComponent y) Shat₁ + → Nonempty (Shat₁ ≃ₜ Shat)) ∧ + numCuffs (connectedComponent y) < numCuffs S ∧ + (IsOrientableSurface (connectedComponent y) → IsOrientableSurface S) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Conditional3.lean b/LeanPool/GraphMinor/GM19/Conditional3.lean new file mode 100644 index 0000000000..d383f16397 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Conditional3.lean @@ -0,0 +1,55 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section15p + +/-! +# Graph Minors XIX, (15.2): the topological step + +Steps (2) and (3) of the proof of (15.2) move the edges `β(e)` onto the edges of `Γ₀` by a +homeomorphism of the surface, and pull back a star at each vertex of `Γ₀`. What the rest of the +proof uses is the topological feasibility condition of (3.2) of +Graph Minors XII for the discs of `exists_discFamily`. We state just that here, and we prove it in +`Feasibility.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe w + +/-- **Steps (2) and (3) of the proof of (15.2).** The discs on the cuffs and on the internal edges +allow disjoint closed discs, one for each vertex `v` of `Γ₀`, that meet the discs of the family just +in the ends that correspond to `v`. + +Here the disc of an edge of size 3 lies in the closed disc of the edge, and the disc of a cuff lies +in the disc pasted onto the cuff. That fixes the cyclic order of the ends around each disc. The +hypothesis on orientations is the one in (15.2). -/ +def Theorem152FeasibilityStatement : Prop := + ∀ (S Shat : Type) [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + (β : Type w) (cap : IsCappedSurface S Shat) (χ : ColourScheme S β) (P₀ : ColouredPainting χ) + (D : TangleDatum cap χ) (n : ℕ) (b : Set S → Set S), + (¬ IsOrientableSurface S ∨ ∃ o : SurfaceOrientation S, ∀ P ∈ ({P₀, D.P} : Set _), ∀ e ∈ P.Γ.E, + (tilde e).ncard = 3 → ∀ a b c : S, P.Γ.γ e = [a, b, c] → o.pos (closure e) a b c) → + D.IsMatchSetting P₀ n b → + ∀ Δ : TangleDatum.DiscIndex S P₀ → Set Shat, (∀ i, IsClosedDisc (Δ i)) → + (∀ i, TangleDatum.discEnds cap b P₀ i ⊆ discBd (Δ i)) → (∀ i j, i ≠ j → Disjoint (Δ i) (Δ j)) + → + (∀ Θ : {Θ : Set S // Θ ∈ cuffs S}, Δ (.inl Θ) ⊆ closure (cap.cuffDisc Θ.1)) → + (∀ e : {e : Set S // e ∈ P₀.Γ.E ∧ Painting.IsInternal e}, (tilde (b e.1)).ncard = 3 → Δ + (.inr e) ⊆ cap.emb '' closure (b e.1)) → + ∃ Dv : S → Set Shat, (∀ v ∈ P₀.Γ.V, IsClosedDisc (Dv v)) ∧ (∀ v ∈ P₀.Γ.V, ∀ v' ∈ P₀.Γ.V, v ≠ + v' → Disjoint (Dv v) (Dv v')) ∧ + ∀ v ∈ P₀.Γ.V, Dv v ∩ ⋃ i, Δ i = TangleDatum.endClass cap P₀ D.P b v + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CuffAngle.lean b/LeanPool/GraphMinor/GM19/CuffAngle.lean new file mode 100644 index 0000000000..a3b15dd077 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CuffAngle.lean @@ -0,0 +1,370 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Defs3 +public import LeanPool.GraphMinor.Surface.PushOff + +/-! +# Angles on a cuff + +To speak of the order of edges around a cuff we read the cuff through the angle map `cuffPoint f` +for a homeomorphism `f` from the circle. +`exists_angle_of_line` picks `f` so that a given line in the cuff has the angles from `0` to `π`. +The result on connected sets is +`arc_of_preconnected`: a connected subset of the cuff holds one of the two arcs between two of its +points. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface Real + +variable {T : Type*} [TopologicalSpace T] + +theorem continuous_cuffAngle {c : Set T} (f : Circle ≃ₜ c) : Continuous (cuffPoint f) := + continuous_subtype_val.comp (f.continuous.comp Circle.exp.continuous) + +theorem cuffAngle_mem {c : Set T} (f : Circle ≃ₜ c) (t : ℝ) : cuffPoint f t ∈ c := (f _).2 + +theorem cuffAngle_add_two_pi {c : Set T} (f : Circle ≃ₜ c) (t : ℝ) : cuffPoint f (t + 2 * π) + = cuffPoint f t := by + unfold cuffPoint + rw [Circle.periodic_exp t] + +theorem cuffAngle_sub_two_pi {c : Set T} (f : Circle ≃ₜ c) (t : ℝ) : cuffPoint f (t - 2 * π) + = cuffPoint f t := by + rw [← cuffAngle_add_two_pi f (t - 2 * π), sub_add_cancel] + +/-- Two angles of one point differ by a multiple of `2π`. -/ +theorem cuffAngle_eq_iff {c : Set T} (f : Circle ≃ₜ c) {x y : ℝ} : cuffPoint f x + = cuffPoint f y ↔ ∃ m : ℤ, x = y + m * (2 * π) := by + rw [← Circle.exp_eq_exp] + exact ⟨fun h ↦ f.injective (Subtype.ext h), fun h ↦ by unfold cuffPoint; rw [h]⟩ + +theorem cuffAngle_injOn {c : Set T} (f : Circle ≃ₜ c) {a x y : ℝ} (hx : x ∈ Ico a (a + 2 * π)) + (hy : y ∈ Ico a (a + 2 * π)) + (h : cuffPoint f x = cuffPoint f y) : x = y := by + obtain ⟨m, hm⟩ := (cuffAngle_eq_iff f).1 h + have hpi := Real.pi_pos + have h₁ : (m : ℝ) * (2 * π) < 2 * π := by linarith [hx.1, hx.2, hy.1, hy.2] + have h₂ : -(2 * π) < (m : ℝ) * (2 * π) := by linarith [hx.1, hx.2, hy.1, hy.2] + have h₃ : (m : ℝ) < 1 := by nlinarith + have h₄ : (-1 : ℝ) < m := by nlinarith + have h₅ : m = 0 := by + have : m < 1 := by exact_mod_cast h₃ + have : -1 < m := by exact_mod_cast h₄ + omega + rw [hm, h₅] + simp + +theorem exists_cuffAngle_eq {c : Set T} (f : Circle ≃ₜ c) (a : ℝ) {z : T} + (hz : z ∈ c) : ∃ t ∈ Ico a (a + 2 * π), cuffPoint f t = z := by + obtain ⟨w, hw⟩ := f.surjective ⟨z, hz⟩ + obtain ⟨t, rfl⟩ := Circle.exp_surjective w + have hpi := Real.pi_pos + obtain ⟨n, hn⟩ := existsUnique_add_zsmul_mem_Ico (mul_pos two_pos hpi) t a |>.exists + refine ⟨t + n • (2 * π), by simpa using hn, ?_⟩ + have : cuffPoint f (t + n • (2 * π)) = cuffPoint f t := (cuffAngle_eq_iff f).2 ⟨n, by simp⟩ + rw [this] + unfold cuffPoint + rw [hw] + +/-- **A connected subset of a cuff holds one of the two arcs between two of its points.** -/ +theorem arc_of_preconnected [T2Space T] {c J : Set T} (f : Circle ≃ₜ c) (hJ : IsPreconnected J) + (hJc : J ⊆ c) {x₁ x₂ : ℝ} (h₁₂ : x₁ ≤ x₂) (h₂₁ : x₂ ≤ x₁ + 2 * π) + (h₁ : cuffPoint f x₁ ∈ J) (h₂ : cuffPoint f x₂ ∈ J) : + (∀ y ∈ Icc x₁ x₂, cuffPoint f y ∈ J) ∨ ∀ y ∈ Icc x₂ (x₁ + 2 * π), cuffPoint f y ∈ J := by + by_contra hno + push Not at hno + obtain ⟨⟨y, hy, hyJ⟩, y', hy', hyJ'⟩ := hno + have hg := continuous_cuffAngle f + have hy₁ : x₁ < y := lt_of_le_of_ne hy.1 (by rintro rfl; exact hyJ h₁) + have hy₂ : y < x₂ := lt_of_le_of_ne hy.2 (by rintro rfl; exact hyJ h₂) + have hy'₁ : x₂ < y' := lt_of_le_of_ne hy'.1 (by rintro rfl; exact hyJ' h₂) + have hy'₂ : y' < x₁ + 2 * π := lt_of_le_of_ne hy'.2 (by + rintro rfl + rw [cuffAngle_add_two_pi] at hyJ' + exact hyJ' h₁) + set C₁ := cuffPoint f '' Icc y y' with hC₁ + set C₂ := cuffPoint f '' Icc y' (y + 2 * π) with hC₂ + have hcl₁ : IsClosed C₁ := (isCompact_Icc.image hg).isClosed + have hcl₂ : IsClosed C₂ := (isCompact_Icc.image hg).isClosed + have hsame : ∀ {z}, z ∈ Icc y y' → ∀ {z'}, z' ∈ Icc y' (y + 2 * π) → cuffPoint f z + = cuffPoint f z' → cuffPoint f z ∉ J := by + intro z hz z' hz' he hzJ + by_cases hzy : z = y + · exact hyJ (hzy ▸ hzJ) + by_cases hzy' : z = y' + · exact hyJ' (hzy' ▸ hzJ) + have hzo : z ∈ Ico y (y + 2 * π) := ⟨hz.1, by linarith [hz.2]⟩ + by_cases hz'e : z' = y + 2 * π + · rw [hz'e, cuffAngle_add_two_pi] at he + exact hzy (cuffAngle_injOn f hzo ⟨le_rfl, by linarith [Real.pi_pos]⟩ he) + · have hz'o : z' ∈ Ico y (y + 2 * π) := ⟨by linarith [hz'.1, hz.1, hz.2], lt_of_le_of_ne hz'.2 + hz'e⟩ + have := cuffAngle_injOn f hzo hz'o he + exact hzy' (le_antisymm hz.2 (this ▸ hz'.1)) + have hcov : J ⊆ C₁ ∪ C₂ := fun z hz ↦ by + obtain ⟨t, ht, rfl⟩ := exists_cuffAngle_eq f y (hJc hz) + by_cases hle : t ≤ y' + · exact Or.inl ⟨t, ⟨ht.1, hle⟩, rfl⟩ + · exact Or.inr ⟨t, ⟨(not_le.1 hle).le, ht.2.le⟩, rfl⟩ + have hsplit : J ⊆ C₁ ∨ J ⊆ C₂ := by + have hdis : Disjoint (J ∩ C₁) (J ∩ C₂) := disjoint_left.2 fun z hz hz' ↦ by + obtain ⟨t, ht, rfl⟩ := hz.2 + obtain ⟨t', ht', he⟩ := hz'.2 + exact hsame ht ht' he.symm hz.1 + have h := (isPreconnected_iff_subset_of_disjoint_closed.1 hJ) C₁ C₂ hcl₁ hcl₂ hcov (by + rw [Set.eq_empty_iff_forall_notMem] + rintro z ⟨hzJ, hz₁, hz₂⟩ + exact disjoint_left.1 hdis ⟨hzJ, hz₁⟩ ⟨hzJ, hz₂⟩) + exact h + rcases hsplit with h | h + · obtain ⟨t, ht, he⟩ := h h₁ + have hto : t ∈ Ico y (y + 2 * π) := ⟨ht.1, by linarith [ht.2]⟩ + have hx : x₁ + 2 * π ∈ Ico y (y + 2 * π) := ⟨by linarith [Real.pi_pos], by linarith⟩ + rw [← cuffAngle_add_two_pi f x₁] at he + have := cuffAngle_injOn f hto hx he + linarith [ht.2] + · obtain ⟨t, ht, he⟩ := h h₂ + have hto : t ∈ Ico y' (y' + 2 * π) := by + by_cases hte : t = y + 2 * π + · exfalso + rw [hte, cuffAngle_add_two_pi] at he + have := cuffAngle_injOn f (a := y) ⟨le_rfl, by linarith [Real.pi_pos]⟩ ⟨hy₂.le, by + linarith⟩ he + linarith + · exact ⟨ht.1, by linarith [ht.2]⟩ + have hx : x₂ + 2 * π ∈ Ico y' (y' + 2 * π) := ⟨by linarith, by linarith⟩ + rw [← cuffAngle_add_two_pi f x₂] at he + have := cuffAngle_injOn f hto hx he + linarith [ht.2] + +private theorem continuous_paired_cuff_arcs {u v : unitInterval → T} + (hu : Continuous u) (hv : Continuous v) (hends : u 1 = v 1) : + let cl₁ : ℝ → unitInterval := fun t ↦ Set.projIcc 0 1 zero_le_one (t / π) + let cl₂ : ℝ → unitInterval := fun t ↦ Set.projIcc 0 1 zero_le_one (2 - t / π) + Continuous (fun t ↦ if t ≤ π then u (cl₁ t) else v (cl₂ t)) := by + intro cl₁ cl₂ + have hpi' := Real.pi_ne_zero + have hcl₁ : Continuous cl₁ := continuous_projIcc.comp (continuous_id.div_const _) + have hcl₂ : Continuous cl₂ := continuous_projIcc.comp (continuous_const.sub + (continuous_id.div_const _)) + refine Continuous.if_le (hu.comp hcl₁) (hv.comp hcl₂) continuous_id + continuous_const ?_ + rintro x rfl + have h₁ : cl₁ π = 1 := by simp [cl₁, hpi'] + have h₂ : cl₂ π = 1 := by + have : (2 : ℝ) - π / π = 1 := by rw [div_self hpi']; norm_num + simp only [cl₂, this] + simp + change u (cl₁ π) = v (cl₂ π) + rw [h₁, h₂, hends] + +/-- **A homeomorphism from the circle that gives a line in `c` the angles from `0` to `π`.** -/ +theorem exists_angle_of_line [T2Space T] {c L : Set T} {a b : T} (hc : IsOArc c) + (hl : IsLineWithEnds L a b) (hLc : L ⊆ c) : + ∃ f : Circle ≃ₜ c, cuffPoint f 0 = a ∧ cuffPoint f π = b ∧ cuffPoint f '' Icc 0 π = L := by + classical + obtain ⟨u, v, h2, hru, hu0, hu1, hun⟩ := exists_arcs_of_line hc hl hLc + have hpi := Real.pi_pos + have hpi' : π ≠ 0 := hpi.ne' + let cl₁ : ℝ → unitInterval := fun t ↦ Set.projIcc 0 1 zero_le_one (t / π) + let cl₂ : ℝ → unitInterval := fun t ↦ Set.projIcc 0 1 zero_le_one (2 - t / π) + let p : ℝ → T := fun t ↦ if t ≤ π then u (cl₁ t) else v (cl₂ t) + have hpc : Continuous p := continuous_paired_cuff_arcs h2.arc_left.1 h2.arc_right.1 h2.one.symm + have hp₁ : ∀ t (ht : t ∈ Icc 0 π), p t = u ⟨t / π, div_nonneg ht.1 hpi.le, + (div_le_one hpi).2 ht.2⟩ := by + intro t ht + have : p t = u (cl₁ t) := ite_eq_left ht.2 + rw [this] + congr 1 + exact Set.projIcc_of_mem _ ⟨div_nonneg ht.1 hpi.le, (div_le_one hpi).2 ht.2⟩ + have hp₂ : ∀ t (ht : t ∈ Ioc π (2 * π)), p t = v ⟨2 - t / π, by + have : t / π ≤ 2 := (div_le_iff₀ hpi).2 ht.2 + linarith, by + have : 1 ≤ t / π := (one_le_div hpi).2 ht.1.le + linarith⟩ := by + intro t ht + have : p t = v (cl₂ t) := ite_eq_right (not_le.2 ht.1) + rw [this] + congr 1 + refine Set.projIcc_of_mem _ ⟨?_, ?_⟩ + · have : t / π ≤ 2 := (div_le_iff₀ hpi).2 ht.2 + linarith + · have : 1 ≤ t / π := (one_le_div hpi).2 ht.1.le + linarith + have hp0 : p 0 = a := by + rw [hp₁ 0 ⟨le_rfl, hpi.le⟩, ← hu0] + congr 1 + ext + simp + have hppi : p π = b := by + rw [hp₁ π ⟨hpi.le, le_rfl⟩, ← hu1] + congr 1 + ext + simp [hpi'] + have hp2 : p (2 * π) = a := by + rw [hp₂ (2 * π) ⟨by linarith, le_rfl⟩, ← hu0, ← h2.zero] + congr 1 + ext + simp [hpi'] + have hmem : ∀ t ∈ Icc 0 (2 * π), p t ∈ c := fun t ht ↦ by + rw [← hun] + by_cases h : t ≤ π + · rw [hp₁ t ⟨ht.1, h⟩] + exact Or.inl (mem_range_self _) + · rw [hp₂ t ⟨not_le.1 h, ht.2⟩] + exact Or.inr (mem_range_self _) + -- `p` is one to one on `[0, 2π)`. + have hinj : ∀ {s t}, s ∈ Ico 0 (2 * π) → t ∈ Ico 0 (2 * π) → p s = p t → s = t := by + have key₁ : ∀ {s t}, s ∈ Icc 0 π → t ∈ Icc 0 π → p s = p t → s = t := fun {s t} hs ht h ↦ by + rw [hp₁ s hs, hp₁ t ht] at h + have := Subtype.ext_iff.1 (h2.arc_left.2 h) + field_simp at this + exact this + have key₂ : ∀ {s t}, s ∈ Ioc π (2 * π) → t ∈ Ioc π (2 * π) → p s = p t → s = t + := fun {s t} hs ht h ↦ by + rw [hp₂ s hs, hp₂ t ht] at h + have := Subtype.ext_iff.1 (h2.arc_right.2 h) + have h' : s / π = t / π := by + simp only at this + linarith + field_simp at h' + exact h' + have key₃ : ∀ {s t}, s ∈ Icc 0 π → t ∈ Ioo π (2 * π) → p s ≠ p t := fun {s t} hs ht h ↦ by + rw [hp₁ s hs, hp₂ t ⟨ht.1, ht.2.le⟩] at h + have hlt₁ : 1 < t / π := (one_lt_div hpi).2 ht.1 + have hlt₂ : t / π < 2 := (div_lt_iff₀ hpi).2 ht.2 + rcases h2.meet _ _ h with ⟨-, h'⟩ | ⟨-, h'⟩ + · have := Subtype.ext_iff.1 h' + simp only [Set.Icc.coe_zero] at this + linarith + · have := Subtype.ext_iff.1 h' + simp only [Set.Icc.coe_one] at this + linarith + intro s t hs ht h + by_cases h₁ : s ≤ π + · by_cases h₂ : t ≤ π + · exact key₁ ⟨hs.1, h₁⟩ ⟨ht.1, h₂⟩ h + · exact absurd h (key₃ ⟨hs.1, h₁⟩ ⟨not_le.1 h₂, ht.2⟩) + · by_cases h₂ : t ≤ π + · exact absurd h.symm (key₃ ⟨ht.1, h₂⟩ ⟨not_le.1 h₁, hs.2⟩) + · exact key₂ ⟨not_le.1 h₁, hs.2.le⟩ ⟨not_le.1 h₂, ht.2.le⟩ h + -- The circle as a quotient of `[0, 2π]`. + let q : Icc 0 (2 * π) → Circle := fun t ↦ Circle.exp t.1 + have hqc : Continuous q := Circle.exp.continuous.comp continuous_subtype_val + have hqs : Function.Surjective q := fun z ↦ by + obtain ⟨t, rfl⟩ := Circle.exp_surjective z + obtain ⟨n, hn⟩ := (existsUnique_add_zsmul_mem_Ico (mul_pos two_pos hpi) t 0).exists + rw [zero_add] at hn + refine ⟨⟨t + n • (2 * π), hn.1, hn.2.le⟩, ?_⟩ + exact Circle.exp_eq_exp.2 ⟨n, by simp⟩ + have : CompactSpace (Icc (0 : ℝ) (2 * π)) := isCompact_iff_compactSpace.1 isCompact_Icc + let qc : C(Icc (0 : ℝ) (2 * π), Circle) := ⟨q, hqc⟩ + have hq : Topology.IsQuotientMap qc := hqc.isClosedMap.isQuotientMap hqc hqs + have hpq : ∀ s t : Icc 0 (2 * π), q s = q t → p s.1 = p t.1 := fun s t h ↦ by + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.1 h + have hs := s.2 + have ht := t.2 + have h₁ : (m : ℝ) * (2 * π) ≤ 2 * π := by linarith [hs.1, hs.2, ht.1, ht.2] + have h₂ : -(2 * π) ≤ (m : ℝ) * (2 * π) := by linarith [hs.1, hs.2, ht.1, ht.2] + have h₃ : (m : ℝ) ≤ 1 := by nlinarith + have h₄ : (-1 : ℝ) ≤ m := by nlinarith + have h₃' : m ≤ 1 := by exact_mod_cast h₃ + have h₄' : -1 ≤ m := by exact_mod_cast h₄ + obtain rfl | rfl | rfl : m = -1 ∨ m = 0 ∨ m = 1 := by omega + · have hs0 : s.1 = 0 := by push_cast at hm; linarith [hs.1, ht.2] + have ht1 : t.1 = 2 * π := by push_cast at hm; linarith [hs.1, ht.2] + rw [hs0, ht1, hp0, hp2] + · congr 1 + simpa using hm + · have hs1 : s.1 = 2 * π := by push_cast at hm; linarith [hs.2, ht.1] + have ht0 : t.1 = 0 := by push_cast at hm; linarith [hs.2, ht.1] + rw [hs1, ht0, hp0, hp2] + let Gc : C(Icc (0 : ℝ) (2 * π), c) := ⟨fun t ↦ ⟨p t.1, hmem t.1 t.2⟩, by + exact (hpc.comp continuous_subtype_val).subtype_mk _⟩ + have hfac : Function.FactorsThrough Gc qc := fun s t h ↦ Subtype.ext (hpq s t h) + let G : C(Circle, c) := hq.lift Gc hfac + have hG : ∀ t : Icc (0 : ℝ) (2 * π), G (q t) = ⟨p t.1, hmem t.1 t.2⟩ := fun t ↦ by + have := DFunLike.congr_fun (hq.lift_comp Gc hfac) t + exact this + have hGb : Function.Bijective G := by + constructor + · intro x y hxy + obtain ⟨s', hs'⟩ := Circle.exp_surjective x + obtain ⟨n, hn⟩ := (existsUnique_add_zsmul_mem_Ico (mul_pos two_pos hpi) s' 0).exists + rw [zero_add] at hn + obtain ⟨t', ht'⟩ := Circle.exp_surjective y + obtain ⟨n', hn'⟩ := (existsUnique_add_zsmul_mem_Ico (mul_pos two_pos hpi) t' 0).exists + rw [zero_add] at hn' + have hx : x = q ⟨_, hn.1, hn.2.le⟩ := by + rw [← hs'] + exact Circle.exp_eq_exp.2 ⟨-n, by simp⟩ + have hy : y = q ⟨_, hn'.1, hn'.2.le⟩ := by + rw [← ht'] + exact Circle.exp_eq_exp.2 ⟨-n', by simp⟩ + rw [hx, hy] at hxy ⊢ + rw [hG, hG] at hxy + have := hinj hn hn' (Subtype.ext_iff.1 hxy) + exact congrArg Circle.exp this + · rintro ⟨z, hz⟩ + rw [← hun] at hz + have hsur₁ : ∀ r : unitInterval, ∃ t : Icc (0 : ℝ) (2 * π), p t.1 = u r := fun r ↦ by + have hm : r.1 * π ∈ Icc 0 π := ⟨mul_nonneg r.2.1 hpi.le, by nlinarith [r.2.2]⟩ + refine ⟨⟨r.1 * π, hm.1, by linarith [hm.2]⟩, ?_⟩ + rw [hp₁ _ hm] + congr 1 + ext + simp [hpi'] + have hsur₂ : ∀ r : unitInterval, ∃ t : Icc (0 : ℝ) (2 * π), p t.1 = v r := fun r ↦ by + rcases eq_or_lt_of_le r.2.2 with h | h + · have hr : r = 1 := Subtype.ext h + obtain ⟨t, ht⟩ := hsur₁ 1 + exact ⟨t, by rw [hr, ht, h2.one]⟩ + · have hm : (2 - r.1) * π ∈ Ioc π (2 * π) := ⟨by nlinarith, by nlinarith [r.2.1]⟩ + refine ⟨⟨(2 - r.1) * π, by linarith [hm.1], hm.2⟩, ?_⟩ + rw [hp₂ _ hm] + congr 1 + ext + simp [hpi'] + rcases hz with ⟨r, rfl⟩ | ⟨r, rfl⟩ + · obtain ⟨t, ht⟩ := hsur₁ r + exact ⟨q t, by rw [hG]; exact Subtype.ext ht⟩ + · obtain ⟨t, ht⟩ := hsur₂ r + exact ⟨q t, by rw [hG]; exact Subtype.ext ht⟩ + have : CompactSpace c := by + obtain ⟨f₀⟩ := hc + exact f₀.surjective.compactSpace f₀.continuous + let f : Circle ≃ₜ c := Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective G hGb) + G.continuous + have hf : ∀ t ∈ Icc 0 (2 * π), cuffPoint f t = p t := fun t ht ↦ by + have := hG ⟨t, ht⟩ + exact congrArg Subtype.val this + refine ⟨f, ?_, ?_, ?_⟩ + · rw [hf 0 ⟨le_rfl, by linarith⟩, hp0] + · rw [hf π ⟨hpi.le, by linarith⟩, hppi] + · rw [← hru] + ext z + constructor + · rintro ⟨t, ht, rfl⟩ + rw [hf t ⟨ht.1, by linarith [ht.2]⟩, hp₁ t ht] + exact mem_range_self _ + · rintro ⟨r, rfl⟩ + have hm : r.1 * π ∈ Icc 0 π := ⟨mul_nonneg r.2.1 hpi.le, by nlinarith [r.2.2]⟩ + refine ⟨_, hm, ?_⟩ + rw [hf _ ⟨hm.1, by linarith [hm.2]⟩, hp₁ _ hm] + congr 1 + ext + simp [hpi'] + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CuffOrder.lean b/LeanPool/GraphMinor/GM19/CuffOrder.lean new file mode 100644 index 0000000000..302259a520 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CuffOrder.lean @@ -0,0 +1,364 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.SideEnds +public import LeanPool.GraphMinor.GM19.CapOrient + +/-! +# The order of the ends around a cuff + +The pad of a cuff `Θ` is the disc pasted onto it. We rotate a chart of the pad so that a vertex of +the frame sits at the point `1` of the circle, and read each side by an interval of `[0, 1]` +(`exists_side_lift`). Different sides have intervals that do not overlap, and along one side the +vertices come in the order of the ends (`IsMatchSetting.lineCoord_endVertex_le`). So the order data +of the pad +hold for any parametrization of the disc of the cuff that has the cyclic order of the chart +(`exists_cuff_padOrder`). This is the part of step (2) of the proof of Graph Minors XIX, (15.2), +page 381, about +border edges. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Metric Topology GraphMinor.Surface GraphMinor.GM11 + +universe w + +local notation "𝕀" => unitInterval + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +/-- Rotate a chart of a disc. -/ +theorem chart_rotate {T : Type} [TopologicalSpace T] {C : Set T} {c : T → ℂ} {g : ℂ → T} + (h : IsChart C c g) (u : Circle) : + IsChart C (fun x => (u : ℂ)⁻¹ * c x) (fun z => g ((u : ℂ) * z)) := by + have hu : (u : ℂ) ≠ 0 := Circle.coe_ne_zero u + have hn : ∀ z : ℂ, ‖(u : ℂ) * z‖ = ‖z‖ := fun z => by rw [norm_mul, Circle.norm_coe, one_mul] + have hn' (z : ℂ) : ‖(u : ℂ)⁻¹ * z‖ = ‖z‖ := by + rw [norm_mul, norm_inv, Circle.norm_coe, inv_one, one_mul] + refine ⟨continuousOn_const.mul h.hc, h.gc.comp (continuousOn_const.mul continuousOn_id) fun z hz + => ?_, fun x hx => ?_, fun z hz => h.gm ?_, fun x hx => ?_, fun z hz => ?_, ?_⟩ + · simpa [hn] using hz + · have := h.hm hx + simpa [hn'] using this + · simpa [hn] using hz + · show g ((u : ℂ) * ((u : ℂ)⁻¹ * c x)) = x + rw [mul_inv_cancel_left₀ hu] + exact h.gh hx + · have hz' : (u : ℂ) * z ∈ closedBall (0 : ℂ) 1 := by simpa [hn] using hz + change (u : ℂ)⁻¹ * c (g ((u : ℂ) * z)) = z + rw [h.hg hz', inv_mul_cancel_left₀ hu] + · ext z + constructor + · rintro ⟨x, hx, rfl⟩ + have : c x ∈ sphere (0 : ℂ) 1 := by rw [← h.bd]; exact mem_image_of_mem c hx + have h1 : ‖c x‖ = 1 := by simpa using this + simp [h1] + · intro hz + have hz1 : ‖z‖ = 1 := by simpa using hz + have : (u : ℂ) * z ∈ c '' discBd C := by + rw [h.bd] + simp [hz1] + obtain ⟨x, hx, he⟩ := this + refine ⟨x, hx, ?_⟩ + change (u : ℂ)⁻¹ * c x = z + rw [he, inv_mul_cancel_left₀ hu] + +/-- The point of the circle at a point of the plane off `0`. -/ +noncomputable def toCircle (z : ℂ) : Circle := open Classical in if h : z = 0 then 1 else unitOf z h + +theorem coe_toCircle {z : ℂ} (hz : ‖z‖ = 1) : (toCircle z : ℂ) = z := by + have h0 : z ≠ 0 := fun h => by simp [h] at hz + rw [toCircle, dite_eq_right h0, coe_unitOf, hz] + simp + +theorem continuousOn_toCircle : ContinuousOn toCircle {z | z ≠ 0} := by + rw [continuousOn_iff_continuous_domRestrict] + have : ({z : ℂ | z ≠ 0}).domRestrict toCircle = fun z : {z : ℂ // z ≠ 0} => unitOf z.1 z.2 := by + funext z + change toCircle z.1 = _ + rw [toCircle, dite_eq_right z.2] + rw [this] + exact continuous_unitOf + +theorem Frame.exists_vertex_of_side (hS : IsSurface S) {Φ : Frame S} {s Θ : Set S} + (hs : s ∈ Φ.sides) (hΘ : Θ ∈ cuffs S) (hsΘ : s ⊆ Θ) : ∃ n ∈ Φ.V, n ∈ Θ := by + by_contra hno + push Not at hno + have hO : IsOArc Θ := (cuff_statement S hS).2.2 _ hΘ + have hcl : IsClosed Θ := hO.isCompact.isClosed + have hpc : IsPathConnected Θ := by + obtain ⟨f⟩ := hO + have : Θ = range fun w : Circle => (f w).1 := by + ext x + exact ⟨fun hx => ⟨f.symm ⟨x, hx⟩, by simp⟩, fun ⟨w, hw⟩ => hw ▸ (f w).2⟩ + rw [this] + exact isPathConnected_range (continuous_subtype_val.comp f.continuous) + have hsub : Θ ⊆ bd S \ Φ.V := fun x hx => ⟨cuff_subset_bd ⟨Θ, hΘ⟩ hx, fun hv => hno x hv hx⟩ + have he : Θ = s := hs.2.2.2 Θ hsub hpc hsΘ + have ht : tilde s = ∅ := by + rw [tilde, ← he, hcl.closure_eq, sdiff_self] + have h2 := (Φ.side_shape s hs).1 + rw [ht, ncard_empty] at h2 + omega + +/-- A side of a cuff, read by an interval of `[0, 1]`. -/ +theorem Frame.exists_side_pos (Φ : Frame S) {s Θ : Set S} (hs : s ∈ Φ.sides) + (hsΘ : closure s ⊆ Θ) {κ : S → Circle} (hκc : ContinuousOn κ Θ) (hκi : InjOn κ Θ) + (hκ1 : ∀ x ∈ s, κ x ≠ 1) : + ∃ (u w : S) (σ : 𝕀 ≃ₜ closure s) (l : ℝ → ℝ), Φ.γ s = [u, w] ∧ (σ 0).1 = u ∧ (σ 1).1 = w + ∧ ContinuousOn l (Icc 0 1) ∧ (StrictMonoOn l (Icc 0 1) ∨ StrictAntiOn l (Icc 0 1)) ∧ + (∀ t ∈ Icc (0 : ℝ) 1, l t ∈ Icc (0 : ℝ) 1 ∧ ee (l t) = κ (linePoint σ t)) ∧ ∀ t ∈ Ioo + (0 : ℝ) 1, linePoint σ t ∈ s := by + obtain ⟨u, w, hγ, f, h0, h1⟩ := Φ.exists_march hs + have hset : tilde s = {u, w} := by + rw [← Φ.γ_set s hs, hγ] + ext x + simp + have hint : ∀ t ∈ Ioo (0 : ℝ) 1, linePoint f t ∈ s := fun t ht => by + by_contra hn + have hx : linePoint f t ∈ tilde s := ⟨linePoint_mem f t, hn⟩ + rw [hset] at hx + have hl : t ∈ Icc (0 : ℝ) 1 := ⟨ht.1.le, ht.2.le⟩ + rcases hx with hx | hx + · have h2 : linePoint f t = linePoint f 0 := by + rw [hx, ← h0] + simp [linePoint] + have := injOn_linePoint f hl (left_mem_Icc.mpr zero_le_one) h2 + linarith [ht.1] + · have h2 : linePoint f t = linePoint f 1 := by + rw [show linePoint f t = w from hx, ← h1] + simp [linePoint] + have := injOn_linePoint f hl (right_mem_Icc.mpr zero_le_one) h2 + linarith [ht.2] + have hc : ContinuousOn (fun t => κ (linePoint f t)) (Icc 0 1) := hκc.comp + (continuous_linePoint f).continuousOn fun t _ => hsΘ (linePoint_mem f t) + have hi : InjOn (fun t => κ (linePoint f t)) (Icc 0 1) := fun a ha b hb he + => injOn_linePoint f ha hb (hκi (hsΘ (linePoint_mem f a)) (hsΘ (linePoint_mem f b)) he) + obtain ⟨l, hl1, hl2, hl3⟩ := exists_side_lift hc hi fun t ht => hκ1 _ (hint t ht) + exact ⟨u, w, f, l, hγ, h0, h1, hl1, hl2, hl3, hint⟩ + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {P₀ : ColouredPainting χ} {n : ℕ} {b : Set S → Set S} + +/-- **The order data of a cuff.** After a rotation of the chart, the order data of the pad of `Θ` +hold for each parametrization `q` whose cyclic order on the ends is the cyclic order of the chart. +-/ +theorem IsMatchSetting.exists_cuff_padOrder [Nonempty S] (hM : D.IsMatchSetting P₀ n b) + (hS : IsSurface S) {Θ : Set S} (hΘ : Θ ∈ cuffs S) {c : Shat → ℂ} {g : ℂ → Shat} (hch : IsChart + (closure (cap.cuffDisc Θ)) c g) : + ∃ (c' : Shat → ℂ) (g' : ℂ → Shat), IsChart (closure (cap.cuffDisc Θ)) c' g' ∧ ∀ q : Circle + → Shat, Function.Injective q → cap.emb '' cuffEnds P₀ b Θ ⊆ range q → + (∀ a a' a'', q a ∈ cap.emb '' cuffEnds P₀ b Θ → q a' ∈ cap.emb '' cuffEnds P₀ b Θ + → q a'' ∈ cap.emb '' cuffEnds P₀ b Θ → a ≠ a' → a' ≠ a'' → a ≠ a'' → + (CircleCyclic a a' a'' ↔ CircleCyclic (toCircle (c' (q a))) (toCircle (c' (q a'))) + (toCircle (c' (q a''))))) → + ∃ A U : Shat → ℝ, PadOrder q g' (cap.emb '' cuffEnds P₀ b Θ) (fun x => cap.emb + (endVertex P₀ D.P b (capBack cap x))) A U := by + classical + let Y := cuffEnds P₀ b Θ + by_cases hY : Y.Nonempty + swap + · refine ⟨c, g, hch, fun q _ _ _ => ⟨0, 0, ?_⟩⟩ + have hE : ∀ x, x ∉ cap.emb '' cuffEnds P₀ b Θ := by + rintro _ ⟨y, hy, rfl⟩ + exact hY ⟨y, hy⟩ + exact ⟨(hM.finite_cuffEnds Θ).image _, fun x hx => absurd hx (hE x), fun x hx => absurd hx + (hE x), fun x hx => absurd hx (hE x), fun x hx => absurd hx (hE x), fun x hx => absurd hx + (hE x), + fun x hx => absurd hx (hE x), fun a _ _ ha => absurd ha (hE _)⟩ + obtain ⟨y₀, e₀, he₀, heΘ, hy₀⟩ := hY + obtain ⟨s₀, hs₀, hs₀Θ, -⟩ := exists_side_of_cuffEnds hS hM.edge hΘ he₀ heΘ + obtain ⟨n₀, hn₀, hn₀Θ⟩ := Frame.exists_vertex_of_side hS hs₀ hΘ hs₀Θ + have hcl : IsClosed Θ := ((cuff_statement S hS).2.2 _ hΘ).isCompact.isClosed + have hCbd : discBd (closure (cap.cuffDisc Θ)) = cap.emb '' Θ := cap.cuffDisc_bd Θ hΘ + have hΘC : ∀ x ∈ Θ, cap.emb x ∈ discBd (closure (cap.cuffDisc Θ)) := by + intro x hx + rw [hCbd] + exact mem_image_of_mem _ hx + have hnorm : ∀ (c₁ : Shat → ℂ) (g₁ : ℂ → Shat), IsChart (closure (cap.cuffDisc Θ)) c₁ g₁ + → ∀ x ∈ Θ, ‖c₁ (cap.emb x)‖ = 1 := fun c₁ g₁ h₁ x hx => by + have : c₁ (cap.emb x) ∈ sphere (0 : ℂ) 1 := by rw [← h₁.bd]; exact mem_image_of_mem _ (hΘC x hx) + simpa using this + let u : Circle := toCircle (c (cap.emb n₀)) + have hu : (u : ℂ) = c (cap.emb n₀) := coe_toCircle (hnorm _ _ hch n₀ hn₀Θ) + have hch' := chart_rotate hch u + refine ⟨_, _, hch', fun q hqinj hsub hcyc => ?_⟩ + let c' : Shat → ℂ := fun x => (u : ℂ)⁻¹ * c x + let g' : ℂ → Shat := fun z => g ((u : ℂ) * z) + have hch'' : IsChart (closure (cap.cuffDisc Θ)) c' g' := hch' + let κ : S → Circle := fun x => toCircle (c' (cap.emb x)) + have hκe : ∀ x ∈ Θ, (κ x : ℂ) = c' (cap.emb x) := fun x hx => coe_toCircle (hnorm _ _ hch'' x hx) + have hΘS : ∀ x ∈ Θ, cap.emb x ∈ closure (cap.cuffDisc Θ) := fun x hx => Surface.discBd_subset _ + (hΘC x hx) + have hκc : ContinuousOn κ Θ := by + refine continuousOn_toCircle.comp (hch''.hc.comp cap.isEmbedding.continuous.continuousOn hΘS) + fun x hx => ?_ + have := hnorm _ _ hch'' x hx + intro h0 + rw [show c' (cap.emb x) = 0 from h0] at this + simp at this + have hκi : InjOn κ Θ := fun x hx y hy he => by + have h1 : c' (cap.emb x) = c' (cap.emb y) := by rw [← hκe x hx, ← hκe y hy, he] + have h2 : cap.emb x = cap.emb y := by rw [← hch''.gh (hΘS x hx), ← hch''.gh (hΘS y hy), h1] + exact cap.isEmbedding.injective h2 + have hκn : κ n₀ = 1 := by + apply Circle.ext + rw [hκe n₀ hn₀Θ] + change (u : ℂ)⁻¹ * c (cap.emb n₀) = _ + rw [← hu, inv_mul_cancel₀ (Circle.coe_ne_zero u)] + rfl + let Sd := {s : Set S // s ∈ χ.Φ.sides ∧ s ⊆ Θ} + have hsd : ∀ s : Sd, _ := fun s : Sd => χ.Φ.exists_side_pos s.2.1 (closure_minimal s.2.2 hcl) hκc + hκi fun x hx he => (s.2.1.2.1 hx).2 ((hκi (s.2.2 hx) hn₀Θ (he.trans hκn.symm)) ▸ hn₀) + choose uu ww σ l hγ h0 h1 hlc hlm hl hint using hsd + let pos : Sd → S → ℝ := fun s x => l s (lineCoord (σ s) x) + have hpos : ∀ (s : Sd), ∀ x ∈ closure s.1, pos s x ∈ Icc (0 : ℝ) 1 ∧ ee (pos s x) = κ x + := fun s x hx => by + have := hl s _ (lineCoord_mem (σ s) x) + rwa [linePoint_coord (σ s) hx] at this + have hend : ∀ y : {y // y ∈ Y}, ∃ s : Sd, ∃ e ∈ P₀.Γ.E, e ⊆ s.1 ∧ b e ⊆ s.1 ∧ + (s.1 ∉ χ.Φ.longSides → b e = s.1) ∧ y.1 ∈ tilde (b e) := fun y => by + obtain ⟨e, he, heΘ, hy⟩ := y.2 + obtain ⟨s, hs, hsΘ, h1, h2, h3⟩ := exists_side_of_cuffEnds hS hM.edge hΘ he heΘ + exact ⟨⟨s, hs, hsΘ⟩, e, he, h1, h2, h3, hy⟩ + choose sd ed hed hes hbs hsh hyt using hend + have hyc : ∀ y : {y // y ∈ Y}, y.1 ∈ closure (sd y).1 := fun y => closure_mono (hbs y) (hyt y).1 + have hvc : ∀ y : {y // y ∈ Y}, endVertex P₀ D.P b y.1 ∈ closure (sd y).1 := fun y => by + obtain ⟨v, hv, hv'⟩ := exists_isEndOf hM.edge (hed y) (hyt y) + rw [hM.endVertex_eq hS hv'] + exact closure_mono (hes y) hv.1 + let A₀ : S → ℝ := fun y => if h : y ∈ Y then pos (sd ⟨y, h⟩) y else 0 + let U₀ : S → ℝ := fun y => if h : y ∈ Y then pos (sd ⟨y, h⟩) (endVertex P₀ D.P b y) else 0 + have hA₀ : ∀ y : {y // y ∈ Y}, A₀ y.1 = pos (sd y) y.1 := fun y => dite_eq_left y.2 + have hU₀ : ∀ y : {y // y ∈ Y}, U₀ y.1 = pos (sd y) (endVertex P₀ D.P b y.1) := fun y + => dite_eq_left y.2 + have hee : ∀ y : {y // y ∈ Y}, ee (A₀ y.1) = κ y.1 := by + intro y + rw [hA₀] + exact (hpos _ _ (hyc y)).2 + have hYΘ : ∀ y ∈ Y, y ∈ Θ := fun y hy => (hM.cuffEnds_subset hS hΘ hy).1 + have hinj : ∀ y y' : {y // y ∈ Y}, A₀ y.1 = A₀ y'.1 → y.1 = y'.1 := fun y y' he => hκi + (hYΘ _ y.2) (hYΘ _ y'.2) (by rw [← hee, ← hee, he]) + have hwin : ∀ y y' : {y // y ∈ Y}, y.1 ≠ y'.1 → A₀ y.1 < A₀ y'.1 + 1 := fun y y' hne => by + by_contra hn + have h1' : A₀ y.1 ∈ Icc (0 : ℝ) 1 := by rw [hA₀]; exact (hpos _ _ (hyc y)).1 + have h2' : A₀ y'.1 ∈ Icc (0 : ℝ) 1 := by rw [hA₀]; exact (hpos _ _ (hyc y')).1 + have e1 : A₀ y.1 = 1 := le_antisymm h1'.2 (by linarith [h2'.1]) + have e2 : A₀ y'.1 = 0 := le_antisymm (by linarith [h1'.2]) h2'.1 + refine hne (hκi (hYΘ _ y.2) (hYΘ _ y'.2) ?_) + rw [← hee, ← hee, e1, e2] + simp [ee] + have hback : ∀ {y}, capBack cap (cap.emb y) = y := fun {y} => capBack_emb cap y + refine ⟨fun x => A₀ (capBack cap x), fun x => U₀ (capBack cap x), + (hM.finite_cuffEnds Θ).image _, hsub, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨y, hy, rfl⟩ + show A₀ (capBack cap (cap.emb y)) ∈ _ + rw [hback, hA₀ ⟨y, hy⟩] + exact (hpos _ _ (hyc ⟨y, hy⟩)).1 + · rintro _ ⟨y, hy, rfl⟩ + show U₀ (capBack cap (cap.emb y)) ∈ _ + rw [hback, hU₀ ⟨y, hy⟩] + exact (hpos _ _ (hvc ⟨y, hy⟩)).1 + · rintro _ ⟨y, hy, rfl⟩ + change g' (ee (U₀ (capBack cap (cap.emb y)))) = cap.emb (endVertex P₀ D.P b (capBack cap + (cap.emb y))) + rw [hback, hU₀ ⟨y, hy⟩, (hpos _ _ (hvc ⟨y, hy⟩)).2] + have hv := hvc ⟨y, hy⟩ + have hvΘ : endVertex P₀ D.P b y ∈ Θ := closure_minimal (sd ⟨y, hy⟩).2.2 hcl hv + rw [hκe _ hvΘ] + exact hch''.gh (hΘS _ hvΘ) + · rintro _ ⟨y, hy, rfl⟩ _ ⟨y', hy', rfl⟩ hlt + show U₀ (capBack cap (cap.emb y)) ≤ U₀ (capBack cap (cap.emb y')) + change A₀ (capBack cap (cap.emb y)) < A₀ (capBack cap (cap.emb y')) at hlt + rw [hback, hback] at hlt ⊢ + let Y₁ : {y // y ∈ Y} := ⟨y, hy⟩ + let Y₂ : {y // y ∈ Y} := ⟨y', hy'⟩ + rw [hA₀ Y₁, hA₀ Y₂] at hlt + rw [hU₀ Y₁, hU₀ Y₂] + by_cases hss : sd Y₁ = sd Y₂ + · have e₂ := hes Y₂ + have b₂ := hbs Y₂ + have s₂ := hsh Y₂ + have u₂ := hvc Y₂ + have y₂ := hyc Y₂ + rw [← hss] at e₂ b₂ s₂ u₂ y₂ + rw [show pos (sd Y₂) y' = pos (sd Y₁) y' by rw [hss]] at hlt + rw [show pos (sd Y₂) (endVertex P₀ D.P b y') = + pos (sd Y₁) (endVertex P₀ D.P b y') by rw [hss]] + set s := sd Y₁ + have hc1 := lineCoord_mem (σ s) y + have hc2 := lineCoord_mem (σ s) y' + have hc3 := lineCoord_mem (σ s) (endVertex P₀ D.P b y) + have hc4 := lineCoord_mem (σ s) (endVertex P₀ D.P b y') + have key : ∀ {x x' : {y // y ∈ Y}}, (x = Y₁ ∧ x' = Y₂ ∨ x = Y₂ ∧ x' = Y₁) → lineCoord + (σ s) x.1 < lineCoord (σ s) x'.1 → lineCoord (σ s) (endVertex P₀ D.P b x.1) ≤ lineCoord + (σ s) (endVertex P₀ D.P b x'.1) := by + rintro x x' (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) h + · exact hM.lineCoord_endVertex_le hS s.2.1 (hγ s) (σ s) (h0 s) (h1 s) hΘ s.2.2 (hed _) + (hed _) (hes _) e₂ (hbs _) b₂ (hsh _) s₂ (hyt _) (hyt _) h + · exact hM.lineCoord_endVertex_le hS s.2.1 (hγ s) (σ s) (h0 s) (h1 s) hΘ s.2.2 (hed _) + (hed _) e₂ (hes _) b₂ (hbs _) s₂ (hsh _) (hyt _) (hyt _) h + rcases hlm s with hm | hm + · have h3 : lineCoord (σ s) y < lineCoord (σ s) y' := (hm.lt_iff_lt hc1 hc2).mp hlt + exact hm.monotoneOn hc3 hc4 (key (Or.inl ⟨rfl, rfl⟩) h3) + · have h3 : lineCoord (σ s) y' < lineCoord (σ s) y := (hm.lt_iff_gt hc1 hc2).mp hlt + exact hm.antitoneOn hc4 hc3 (key (Or.inr ⟨rfl, rfl⟩) h3) + · by_contra hn + refine false_of_overlap (hlc (sd Y₁)) (hlc (sd Y₂)) (hlm _) (hlm _) (fun t ht => + (hl _ t ht).2) (fun t ht => (hl _ t ht).2) (fun t ht t' ht' he => ?_) (lineCoord_mem _ _) + (lineCoord_mem _ _) + (lineCoord_mem _ _) (lineCoord_mem _ _) hlt (not_le.mp hn) + have h1' := hint (sd Y₁) t ht + have h2' := hint (sd Y₂) t' ht' + have heq := hκi ((sd Y₁).2.2 h1') ((sd Y₂).2.2 h2') he + rw [heq] at h1' + exact hss (Subtype.ext (arcComponent_eq (sd Y₁).2.1 (sd Y₂).2.1 h1' h2')) + · rintro _ ⟨y, hy, rfl⟩ _ ⟨y', hy', rfl⟩ he + have he' : A₀ y = A₀ y' := by + have : A₀ (capBack cap (cap.emb y)) = A₀ (capBack cap (cap.emb y')) := he + rwa [hback, hback] at this + rw [show y = y' from hinj ⟨y, hy⟩ ⟨y', hy'⟩ he'] + · intro a a' a'' ha ha' ha'' h1' h2' h3' + rw [hcyc a a' a'' ha ha' ha'' h1' h2' h3'] + obtain ⟨y, hy, hye⟩ := ha + obtain ⟨y', hy', hye'⟩ := ha' + obtain ⟨y'', hy'', hye''⟩ := ha'' + have hne : ∀ {p p' : Circle} {r r' : S}, cap.emb r = q p → cap.emb r' = q p' → p ≠ p' → r ≠ r' + := fun e1 e2 hp h => hp (hqinj (by rw [← e1, ← e2, h])) + have n1 := hne hye hye' h1' + have n2 := hne hye' hye'' h2' + have n3 := hne hye hye'' h3' + have hval : ∀ {p : Circle} {r : S} (hr : r ∈ Y), cap.emb r = q p → A₀ (capBack cap (q p)) + = A₀ r ∧ toCircle (c' (q p)) = ee (A₀ r) := fun {p r} hr he => by + rw [← he, hback] + exact ⟨rfl, (hee ⟨r, hr⟩).symm⟩ + obtain ⟨v1, w1⟩ := hval hy hye + obtain ⟨v2, w2⟩ := hval hy' hye' + obtain ⟨v3, w3⟩ := hval hy'' hye'' + rw [w1, w2, w3] + change _ ↔ CycOrder (A₀ (capBack cap (q a))) (A₀ (capBack cap (q a'))) (A₀ (capBack cap + (q a''))) + rw [v1, v2, v3] + let Y₁ : {y // y ∈ Y} := ⟨y, hy⟩ + let Y₂ : {y // y ∈ Y} := ⟨y', hy'⟩ + let Y₃ : {y // y ∈ Y} := ⟨y'', hy''⟩ + exact circleCyclic_ee_iff (hwin Y₁ Y₂ n1) (hwin Y₂ Y₁ n1.symm) (hwin Y₂ Y₃ n2) + (hwin Y₃ Y₂ n2.symm) (hwin Y₁ Y₃ n3) (hwin Y₃ Y₁ n3.symm) (fun h => n1 (hinj Y₁ Y₂ h)) (fun h + => n2 (hinj Y₂ Y₃ h)) + (fun h => n3 (hinj Y₁ Y₃ h)) + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CuffPieces.lean b/LeanPool/GraphMinor/GM19/CuffPieces.lean new file mode 100644 index 0000000000..17ed81457b --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CuffPieces.lean @@ -0,0 +1,280 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FrameExists +public import LeanPool.GraphMinor.GM19.FrameMove +public import LeanPool.GraphMinor.Surface.Classification + +/-! +# Cutting the boundary at a finite set + +When we cut a surface, the new boundary carries a finite set `N` of vertices. If every cuff has at +least +two points of `N`, then `bd(Σ) \ N` has finitely many arc-wise components, and each is an open arc +of a +cuff with two different ends in `N`. This is what makes the boundary of a fragment into the border +edges of a painting. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +section OneCuff + +variable {Θ : Set S} (f : Circle ≃ₜ Θ) {N : Set S} + +omit [T2Space S] in +theorem finite_angles (hN : N.Finite) (a : ℝ) : + ({t | t ∈ Ico a (a + 2 * Real.pi) ∧ cuffPoint f t ∈ N}).Finite := by + refine Set.Finite.of_injOn (f := cuffPoint f) (t := N) (fun t ht ↦ ht.2) ?_ hN + exact fun s hs t ht h ↦ cuffPoint_injOn f le_rfl hs.1 ht.1 h + +omit [T2Space S] in +theorem finite_angles' (hN : N.Finite) (a : ℝ) : + ({t | t ∈ Ioc a (a + 2 * Real.pi) ∧ cuffPoint f t ∈ N}).Finite := by + have hpi := Real.pi_pos + refine Set.Finite.of_injOn (f := cuffPoint f) (t := N) (fun t ht ↦ ht.2) ?_ hN + intro s hs t ht h + obtain ⟨m, hm⟩ := cuffPoint_eq f h + have h0 : m = 0 := by + by_contra hne + rcases lt_or_gt_of_ne hne with h1 | h1 + · have h2 : (m : ℝ) ≤ -1 := by exact_mod_cast (by omega : m ≤ -1) + nlinarith [hs.1.1, hs.1.2, ht.1.1, ht.1.2] + · have h2 : (1 : ℝ) ≤ m := by exact_mod_cast (by omega : 1 ≤ m) + nlinarith [hs.1.1, hs.1.2, ht.1.1, ht.1.2] + rw [hm, h0] + simp + +omit [T2Space S] in +/-- A point of a cuff off `N` lies on an open arc that misses `N` and has two ends in `N`, as long +as the +cuff has two points of `N`. The ends are the last point of `N` before the point and the first one +after +it. The arc is not the whole circle, because `N` has a second point. -/ +theorem exists_arc_of_two (hN : N.Finite) {p q : S} (hp : p ∈ N ∩ Θ) (hq : q ∈ N ∩ Θ) (hpq : p ≠ q) + {x : S} (hx : x ∈ Θ \ N) : + ∃ a b : ℝ, a < b ∧ b < a + 2 * Real.pi ∧ x ∈ arcOf f a b ∧ Disjoint (arcOf f a b) N ∧ + cuffPoint f a ∈ N ∧ cuffPoint f b ∈ N := by + have hpi := Real.pi_pos + obtain ⟨t, -, ht⟩ := exists_angle_in f 0 ⟨x, hx.1⟩ + change cuffPoint f t = x at ht + have htN : cuffPoint f t ∉ N := ht ▸ hx.2 + have hA := finite_angles f hN (t - 2 * Real.pi) + have hB := finite_angles' f hN t + obtain ⟨s₀, hs₀, hs₀p⟩ := exists_angle_in f (t - 2 * Real.pi) ⟨p, hp.2⟩ + change cuffPoint f s₀ = p at hs₀p + obtain ⟨s₁, hs₁, hs₁p⟩ := exists_angle_in f t ⟨p, hp.2⟩ + change cuffPoint f s₁ = p at hs₁p + have hs₁t : s₁ ≠ t := fun h ↦ htN (h ▸ (hs₁p ▸ hp.1)) + obtain ⟨a, ha, hamax⟩ := hA.exists_le_maximal (a := s₀) ⟨hs₀, hs₀p ▸ hp.1⟩ + obtain ⟨b, hb, hbmin⟩ := hB.exists_le_minimal (a := s₁) + ⟨⟨lt_of_le_of_ne hs₁.1 hs₁t.symm, hs₁.2.le⟩, hs₁p ▸ hp.1⟩ + have haI := hamax.prop.1 + have hbI := hbmin.prop.1 + have haN := hamax.prop.2 + have hbN := hbmin.prop.2 + have hat : a < t := lt_of_le_of_ne (by linarith [haI.2]) fun h ↦ htN (h ▸ haN) + have htb : t < b := hbI.1 + have hAno : ∀ s, a < s → s < t → cuffPoint f s ∉ N := fun s h₁ h₂ hsN ↦ + absurd (hamax.le_of_ge (y := s) ⟨⟨by linarith [haI.1], by linarith⟩, hsN⟩ h₁.le) (not_le.mpr h₁) + have hBno : ∀ s, t < s → s < b → cuffPoint f s ∉ N := fun s h₁ h₂ hsN ↦ + absurd (hbmin.le_of_le (y := s) ⟨⟨h₁, by linarith [hbI.2]⟩, hsN⟩ h₂.le) (not_le.mpr h₂) + -- A point of `N` other than the left end gives `b < a + 2π`. + have hub : b < a + 2 * Real.pi := by + have hr : ∃ r ∈ N ∩ Θ, r ≠ cuffPoint f a := by + by_cases h : p = cuffPoint f a + · exact ⟨q, hq, fun h' ↦ hpq (h.trans h'.symm)⟩ + · exact ⟨p, hp, h⟩ + obtain ⟨r, hr, hra⟩ := hr + obtain ⟨s, hs, hsr⟩ := exists_angle_in f a ⟨r, hr.2⟩ + change cuffPoint f s = r at hsr + have hsa : a < s := lt_of_le_of_ne hs.1 fun h ↦ hra (hsr ▸ h ▸ rfl) + have hsN : cuffPoint f s ∈ N := hsr ▸ hr.1 + rcases lt_trichotomy s t with h | h | h + · exact absurd hsN (hAno s hsa h) + · exact absurd hsN (h ▸ htN) + · by_contra hge + exact hBno s h (by linarith [hs.2, not_lt.mp hge]) hsN + refine ⟨a, b, by linarith, hub, ⟨t, ⟨hat, htb⟩, ht⟩, disjoint_left.mpr ?_, haN, hbN⟩ + rintro _ ⟨s, hs, rfl⟩ hsN + rcases lt_trichotomy s t with h | h | h + · exact hAno s hs.1 h hsN + · exact htN (h ▸ hsN) + · exact hBno s h hs.2 hsN + +omit [T2Space S] in +theorem cuffPoint_shift (a : ℝ) (m : ℤ) : cuffPoint f (a + m * (2 * Real.pi)) = cuffPoint f a := by + have h : Circle.exp (a + m * (2 * Real.pi)) = Circle.exp a := Circle.exp_eq_exp.mpr ⟨m, rfl⟩ + simp only [cuffPoint, h] + +omit [T2Space S] in +theorem arcOf_shift (a b : ℝ) (m : ℤ) : + arcOf f (a + m * (2 * Real.pi)) (b + m * (2 * Real.pi)) = arcOf f a b := by + ext x + constructor + · rintro ⟨t, ht, rfl⟩ + refine ⟨t - m * (2 * Real.pi), ⟨by linarith [ht.1], by linarith [ht.2]⟩, ?_⟩ + have h := cuffPoint_shift f (t - m * (2 * Real.pi)) m + rw [sub_add_cancel] at h + exact h.symm + · rintro ⟨t, ht, rfl⟩ + exact ⟨t + m * (2 * Real.pi), ⟨by linarith [ht.1], by linarith [ht.2]⟩, cuffPoint_shift f t m⟩ + +omit [T2Space S] in +/-- Two arcs that miss `N` and have the same left end in `N` and right ends in `N` are equal. -/ +theorem arcOf_eq_of_left {a b a' b' : ℝ} (hab : a < b) (hab' : a' < b') + (hd : Disjoint (arcOf f a b) N) (hd' : Disjoint (arcOf f a' b') N) + (hb : cuffPoint f b ∈ N) (hb' : cuffPoint f b' ∈ N) (h : cuffPoint f a = cuffPoint f a') : + arcOf f a b = arcOf f a' b' := by + obtain ⟨m, hm⟩ := cuffPoint_eq f h + subst hm + have hshift := arcOf_shift f a' (b - m * (2 * Real.pi)) m + rw [sub_add_cancel] at hshift + rw [hshift] at hd ⊢ + have hcp : cuffPoint f (b - m * (2 * Real.pi)) = cuffPoint f b := by + have h := cuffPoint_shift f (b - m * (2 * Real.pi)) m + rwa [sub_add_cancel, eq_comm] at h + have hab₂ : a' < b - m * (2 * Real.pi) := by linarith + rcases lt_trichotomy (b - m * (2 * Real.pi)) b' with h₁ | h₁ | h₁ + · exact absurd (hcp ▸ hb) (disjoint_left.mp hd' ⟨_, ⟨hab₂, h₁⟩, rfl⟩) + · rw [h₁] + · exact absurd hb' (disjoint_left.mp hd ⟨_, ⟨hab', h₁⟩, rfl⟩) + +end OneCuff + +section Pieces + +variable (hS : IsSurface S) (par : ∀ C : cuffs S, Circle ≃ₜ C.1) {N : Set S} + +include hS in +/-- The points of `bd(Σ)` outside the cuff `C` form a closed set. -/ +theorem isClosed_bd_sdiff (C : cuffs S) : IsClosed (bd S \ C.1) := by + have hfin : (cuffs S).Finite := (cuff_statement S hS).2.1 + have h : bd S \ C.1 = ⋃ D ∈ cuffs S \ {C.1}, D := by + ext x + constructor + · rintro ⟨hx, hxC⟩ + rw [← sUnion_cuffs] at hx + obtain ⟨D, hD, hxD⟩ := hx + exact mem_biUnion (show D ∈ cuffs S \ {C.1} from ⟨hD, fun h ↦ hxC (h ▸ hxD)⟩) hxD + · intro hx + obtain ⟨D, hD, hxD⟩ := mem_iUnion₂.mp hx + refine ⟨sUnion_cuffs (S := S) ▸ ⟨D, hD.1, hxD⟩, fun hxC ↦ ?_⟩ + exact disjoint_left.mp (Surface.cuffs_disjoint hD.1 C.2 hD.2) hxD hxC + rw [h] + refine (hfin.subset sdiff_subset).isClosed_biUnion fun D hD ↦ ?_ + exact isClosed_cuff hS ⟨D, hD.1⟩ + +include hS in +/-- Each arc-wise component of `bd(Σ) \ N` is an open arc of a cuff, with two ends in `N`. -/ +theorem exists_arc_of_mem (hN : N.Finite) + (h2 : ∀ C : cuffs S, ∃ p ∈ N ∩ C.1, ∃ q ∈ N ∩ C.1, p ≠ q) {e : Set S} + (he : e ∈ arcComponentsIn (bd S \ N)) : + ∃ (C : cuffs S) (a b : ℝ), a < b ∧ b < a + 2 * Real.pi ∧ e = arcOf (par C) a b ∧ + Disjoint e N ∧ cuffPoint (par C) a ∈ N ∧ cuffPoint (par C) b ∈ N := by + have hpi := Real.pi_pos + obtain ⟨x, hx⟩ := he.1 + have hxb := he.2.1 hx + obtain ⟨C, hC, hxC⟩ := sUnion_cuffs (S := S) ▸ hxb.1 + let C' : cuffs S := ⟨C, hC⟩ + obtain ⟨p, hp, q, hq, hpq⟩ := h2 C' + obtain ⟨a, b, hab, hub, hxA, hdis, ha, hb⟩ := exists_arc_of_two (par C') hN hp hq hpq + (x := x) ⟨hxC, hxb.2⟩ + have hsub : arcOf (par C') a b ⊆ bd S \ N := fun y hy ↦ + ⟨cuff_subset_bd C' (arcOf_subset _ _ _ hy), disjoint_left.mp hdis hy⟩ + -- `e` lies in the closed arc, since the rest of `bd(Σ)` meets it only in its ends. + let X : Set S := cuffPoint (par C') '' Icc a b + let Y : Set S := cuffPoint (par C') '' Icc b (a + 2 * Real.pi) ∪ (bd S \ C) + have hXc : IsClosed X := (isCompact_Icc.image (continuous_cuffPoint _)).isClosed + have hYc : IsClosed Y := ((isCompact_Icc.image (continuous_cuffPoint _)).isClosed).union + (isClosed_bd_sdiff hS C') + have hcov : e ⊆ X ∪ Y := by + intro y hy + have hyb := (he.2.1 hy).1 + by_cases hyC : y ∈ C + · obtain ⟨t, ht, hty⟩ := exists_angle_in (par C') a ⟨y, hyC⟩ + change cuffPoint (par C') t = y at hty + by_cases htb : t ≤ b + · exact Or.inl ⟨t, ⟨ht.1, htb⟩, hty⟩ + · exact Or.inr (Or.inl ⟨t, ⟨(not_le.mp htb).le, ht.2.le⟩, hty⟩) + · exact Or.inr (Or.inr ⟨hyb, hyC⟩) + have hxX : x ∈ X := by + obtain ⟨t, ht, rfl⟩ := hxA + exact ⟨t, ⟨ht.1.le, ht.2.le⟩, rfl⟩ + have hsubX : e ⊆ X := by + by_contra hne + obtain ⟨y, hy, hyX⟩ := not_subset.mp hne + obtain ⟨z, hz, hzX, hzY⟩ := isPreconnected_closed_iff.mp he.2.2.1.isConnected.isPreconnected + X Y hXc hYc hcov ⟨x, hx, hxX⟩ ⟨y, hy, (hcov hy).resolve_left hyX⟩ + have hzN : z ∉ N := (he.2.1 hz).2 + obtain ⟨t, ht, rfl⟩ := hzX + rcases hzY with ⟨s, hs, hst⟩ | ⟨-, hn⟩ + · have hta : t ≠ a := fun h ↦ hzN (h ▸ ha) + have htb : t ≠ b := fun h ↦ hzN (h ▸ hb) + have hsa : s ≠ a + 2 * Real.pi := fun h ↦ hzN (by + rw [← hst, h, cuffPoint_add_two_pi]; exact ha) + have hsb : s ≠ b := fun h ↦ hzN (by rw [← hst, h]; exact hb) + have := cuffPoint_injOn (par C') (a := a) (b := a + 2 * Real.pi) le_rfl + ⟨ht.1, by linarith [ht.2]⟩ ⟨by linarith [hs.1], lt_of_le_of_ne hs.2 hsa⟩ hst.symm + have h₃ : t < b := lt_of_le_of_ne ht.2 htb + have h₄ : b < s := lt_of_le_of_ne hs.1 hsb.symm + linarith + · exact hn (cuffPoint_mem (par C') t) + have hsubA : e ⊆ arcOf (par C') a b := by + intro y hy + obtain ⟨t, ht, rfl⟩ := hsubX hy + have hyN := (he.2.1 hy).2 + exact ⟨t, ⟨lt_of_le_of_ne ht.1 fun h ↦ hyN (h ▸ ha), lt_of_le_of_ne ht.2 fun h ↦ hyN (h ▸ hb)⟩, + rfl⟩ + have heq : e = arcOf (par C') a b := + (he.2.2.2 _ hsub (isPathConnected_arcOf _ hab) hsubA).symm + exact ⟨C', a, b, hab, hub, heq, heq ▸ hdis, ha, hb⟩ + +include hS in +/-- The boundary minus `N` has finitely many arc-wise components, since an arc is determined by its +left +end. -/ +theorem finite_arcComponentsIn_bd (hN : N.Finite) + (h2 : ∀ C : cuffs S, ∃ p ∈ N ∩ C.1, ∃ q ∈ N ∩ C.1, p ≠ q) : + (arcComponentsIn (bd S \ N)).Finite := by + have par : ∀ C : cuffs S, Circle ≃ₜ C.1 := fun C ↦ ((cuff_statement S hS).2.2 C.1 C.2).some + have hex := fun e : arcComponentsIn (bd S \ N) ↦ exists_arc_of_mem hS par hN h2 e.2 + choose C a b hab hub heq hdis ha hb using hex + have : Finite N := hN.to_subtype + have key : ∀ (C₁ C₂ : cuffs S) (a₁ b₁ a₂ b₂ : ℝ), C₁ = C₂ → a₁ < b₁ → a₂ < b₂ → + Disjoint (arcOf (par C₁) a₁ b₁) N → Disjoint (arcOf (par C₂) a₂ b₂) N → + cuffPoint (par C₁) b₁ ∈ N → cuffPoint (par C₂) b₂ ∈ N → + cuffPoint (par C₁) a₁ = cuffPoint (par C₂) a₂ → + arcOf (par C₁) a₁ b₁ = arcOf (par C₂) a₂ b₂ := by + rintro C₁ _ a₁ b₁ a₂ b₂ rfl h₁ h₂ d₁ d₂ e₁ e₂ h + exact arcOf_eq_of_left _ h₁ h₂ d₁ d₂ e₁ e₂ h + have hinj : Function.Injective fun e : arcComponentsIn (bd S \ N) ↦ + (⟨cuffPoint (par (C e)) (a e), ha e⟩ : N) := by + intro e e' h + have h' : cuffPoint (par (C e)) (a e) = cuffPoint (par (C e')) (a e') := congrArg Subtype.val h + have hC : C e = C e' := by + by_contra hne + exact disjoint_left.mp (cuffs_disjoint' hne) (cuffPoint_mem _ _) + (h' ▸ cuffPoint_mem (par (C e')) (a e')) + refine Subtype.ext ?_ + rw [heq e, heq e'] + exact key _ _ _ _ _ _ hC (hab e) (hab e') (heq e ▸ hdis e) (heq e' ▸ hdis e') (hb e) (hb e') h' + have := Finite.of_injective _ hinj + exact Set.toFinite _ + +end Pieces + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CutDrawing.lean b/LeanPool/GraphMinor/GM19/CutDrawing.lean new file mode 100644 index 0000000000..081e7683de --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CutDrawing.lean @@ -0,0 +1,225 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutArc +public import LeanPool.GraphMinor.Surface.CutChain +public import LeanPool.GraphMinor.Surface.CutEdges +public import LeanPool.GraphMinor.Surface.InvarianceOfDomain + +/-! +# Cutting along several edges of a word + +`WordEdges.cut_space` cuts along a set `D` of edges and asks that at most two ends of edges of `D` +meet at a +vertex off the boundary, and only one on the boundary. XIX needs more. It cuts along an `O`-arc that +meets a +cuff in one point, and along circuits joined by a path. Here three points of the cut surface lie +over a +vertex. The word is the same, so `WordEdges.cut_edges` drops the condition. It keeps it only where +it is +needed, which is to tell the two lifts of an edge apart at the ends of that edge. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Function GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {W : ℕ → List Letter} {f : ℕ × ℂ + → S} {V : Set S} + {E : Set (Set S)} {A : Set S → unitInterval → S} {lab : Set S → ℕ} + +/-- The endpoint condition for the two lifts of an edge. -/ +abbrev EndFine (A : Set S → unitInterval → S) (D : Set (Set S)) (e : Set S) (τ : Bool) : Prop := + CutEndCondition A D e τ + +/-- Two lifts of an edge, with distinct endpoints when the endpoint condition holds. -/ +abbrev IsEdgeLift {Y : Type u} [TopologicalSpace Y] (ψ : Y → S) (a : ℝ → S) (hend : Bool → Prop) + (r r' : ℝ → Y) : Prop := + IsCutEdgeLift ψ a hend r r' + +/-- The cut surface over the union of a set `D` of edges of a word. Each edge has two lifts. -/ +theorem WordEdges.cut_edges (h : WordEdges W f V E A lab) {D : Set (Set S)} (hD : D ⊆ E) + (hsd : ∀ e ∈ D, ∃ (i p j q : ℕ) (e₁ e₂ : Bool), EdgeSides W (lab e) i p j q e₁ e₂) + {Y : Type u} [TopologicalSpace Y] [T2Space Y] {g : ℕ × ℂ → Y} (hg : Presents (cutW W + (lab '' D)) g) : + ∃ ψ : Y → S, Continuous ψ ∧ Function.Surjective ψ ∧ InjOn ψ (ψ ⁻¹' (⋃₀ D)ᶜ) ∧ IsSurface Y ∧ + (∀ a ∈ Dsk W, ψ (g a) = f a) ∧ (∀ z : Y, ∃ a ∈ Dsk W, g a = z) ∧ + ∀ e ∈ D, ∃ r r', IsEdgeLift ψ (extI (A e)) (EndFine A D e) r r' := + h.lift_cut_edges hD hsd hg + +omit [T2Space S] in +/-- A map into a surface, injective on a neighbourhood of an interior point, maps that neighbourhood +to a +neighbourhood of the image, by invariance of domain. The image point may be on the boundary at the +start, +and the lemma then says that it is not. -/ +theorem image_mem_nhds_of_injOn {Y : Type*} [TopologicalSpace Y] {ψ : Y → S} {z : Y} + (hz : IsInteriorPoint z) + (hm : IsManifoldPoint (ψ z)) (hψ : Continuous ψ) {U : Set Y} (hU : IsOpen U) (hzU : z ∈ U) + (hinj : InjOn ψ U) : + ψ '' U ∈ 𝓝 (ψ z) := by + obtain ⟨C, O, hC, -, hzC, ⟨c⟩⟩ := hm + obtain ⟨U', hU', hzU', hsub, ⟨e⟩⟩ := hz.exists_subset (hU.inter (hC.preimage hψ)) ⟨hzU, hzC⟩ + have : Nonempty Y := ⟨z⟩ + have : Nonempty S := ⟨ψ z⟩ + have : Nonempty (EuclideanHalfSpace 2) := ⟨(c ⟨ψ z, hzC⟩).1⟩ + obtain ⟨b⟩ := exists_homeomorph_ball (0 : ℂ) one_pos + obtain ⟨a, a', h1, h2, h3, h4, h5, h6⟩ := exists_functions_of_homeomorph (b.trans e.symm) + obtain ⟨k, k', h1', h2', h3', h4', h5', h6'⟩ := exists_functions_of_homeomorph c + let j : S → ℂ := fun x ↦ complexPlane.symm (k x).1 + have hjc : ContinuousOn j C := complexPlane.symm.continuous.comp_continuousOn + (continuous_subtype_val.comp_continuousOn h1') + have hji : InjOn j C := fun x hx y hy he ↦ + h5'.injOn hx hy (Subtype.ext (complexPlane.symm.injective he)) + have hGc : ContinuousOn (j ∘ ψ ∘ a) (Metric.ball (0 : ℂ) 1) := + hjc.comp (hψ.comp_continuousOn h1) fun w hw ↦ (hsub (h3 hw)).2 + have hGi : InjOn (j ∘ ψ ∘ a) (Metric.ball (0 : ℂ) 1) := fun w hw w' hw' he ↦ + h5.injOn hw hw' (hinj (hsub (h3 hw)).1 (hsub (h3 hw')).1 + (hji (hsub (h3 hw)).2 (hsub (h3 hw')).2 he)) + have hopen := isOpen_image_of_injOn Metric.isOpen_ball hGc hGi + have hO : IsOpen (C ∩ j ⁻¹' ((j ∘ ψ ∘ a) '' Metric.ball (0 : ℂ) 1)) := + hjc.isOpen_inter_preimage hC hopen + refine Filter.mem_of_superset (hO.mem_nhds ⟨hzC, a' z, h4 hzU', ?_⟩) ?_ + · change j (ψ (a (a' z))) = j (ψ z) + rw [h6 hzU'] + · rintro y ⟨hyC, w, hw, he⟩ + exact ⟨a w, (hsub (h3 hw)).1, hji (hsub (h3 hw)).2 hyC he⟩ + +omit [T2Space S] in +/-- A point of `V` on an edge has finitely many points of the polygons over it, which are corners. +-/ +theorem WordEdges.subset_range_spe (h : WordEdges W f V E A lab) {a : ℕ × ℂ} (ha : a ∈ Dsk W) + (hV : f a ∈ V) + (hE : f a ∈ ⋃₀ E) : a ∈ range (spe W) := by + obtain ⟨p, e', e, he, u, hu, h1, h2, h3⟩ := h.exists_side ha hE + have hp : p < (W a.1).length := by + by_contra hn + rw [List.getElem?_eq_none (not_lt.mp hn)] at h1 + simp at h1 + have hu01 : u = 0 ∨ u = 1 := by + by_contra hn + push Not at hn + have hI : u ∈ Ioo (0 : ℝ) 1 := ⟨lt_of_le_of_ne hu.1 (Ne.symm hn.1), lt_of_le_of_ne hu.2 hn.2⟩ + exact h.extI_notMem he (ofs_Ioo e' hI) (h3 ▸ hV) + rcases hu01 with rfl | rfl + · exact ⟨⟨(a.1, p, false), hp⟩, by simpa [spe, eo] using h2.symm⟩ + · exact ⟨⟨(a.1, p, true), hp⟩, by simpa [spe, eo] using h2.symm⟩ + +omit [T2Space S] in +/-- A point of an edge is a point of the open edge or an end. -/ +theorem WordEdges.exists_param (h : WordEdges W f V E A lab) {e : Set S} (he : e ∈ E) {x : S} + (hx : x ∈ e) : + ∃ t ∈ Icc (0 : ℝ) 1, extI (A e) t = x ∧ (t ∈ Ioo (0 : ℝ) 1 ∨ ∃ τ, eo τ = t) := by + have hr : extI (A e) '' Icc 0 1 = e := by rw [image_extI, (h.arc e he).2.1] + obtain ⟨t, ht, rfl⟩ := hr.symm ▸ hx + refine ⟨t, ht, rfl, ?_⟩ + by_cases h0 : t = 0 + · exact .inr ⟨false, by simp [eo, h0]⟩ + by_cases h1 : t = 1 + · exact .inr ⟨true, by simp [eo, h1]⟩ + exact .inl ⟨lt_of_le_of_ne ht.1 (Ne.symm h0), lt_of_le_of_ne ht.2 h1⟩ + +/-- **Cutting along a set of edges.** No condition at the vertices is needed. The fibres are finite, +and the +whole lift of the edges lies in the boundary. Off the ends, by invariance of domain, an interior +point over a +vertex would have a neighbourhood mapped onto a neighbourhood of that vertex, but the edge at the +vertex comes +near it, and only boundary points lie over the open edge. -/ +theorem WordEdges.exists_cut (h : WordEdges W f V E A lab) (hS : IsSurface S) (hne : + (Dsk W).Nonempty) + {D : Set (Set S)} (hD : D ⊆ E) (hmid : ∀ e ∈ D, edgeMid A e ∉ bd S) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S), IsSurface Y ∧ Continuous ψ + ∧ + Function.Surjective ψ ∧ InjOn ψ (ψ ⁻¹' (⋃₀ D)ᶜ) ∧ (∀ x, (ψ ⁻¹' {x}).Finite) ∧ ψ ⁻¹' + (⋃₀ D) ⊆ bd Y ∧ + ∀ e ∈ D, ∃ r r', IsEdgeLift ψ (extI (A e)) (EndFine A D e) r r' := by + classical + have hsd : ∀ e ∈ D, ∃ (i p j q : ℕ) (e₁ e₂ : Bool), EdgeSides W (lab e) i p j q e₁ e₂ + := fun e he ↦ by + obtain ⟨i, p, j, q, e₁, e₂, h1, h2, h3⟩ := h.exists_sides (hD he) (hmid e he) + exact ⟨i, p, j, q, e₁, e₂, h1, h2, h3⟩ + obtain ⟨Y, tY, t2, g, hg⟩ := exists_cut_presented.{u} (W := cutW W (lab '' D)) (finW_cut h.fin) + (isPaired_cut h.paired) (by rw [dsk_cut]; exact hne) + obtain ⟨ψ, h1, h2, h3, h4, hψ, hrep, hlift⟩ := WordEdges.cut_edges h hD hsd hg + have : Finite (SE W) := finite_se h.fin + have hfinV : ∀ v ∈ V ∩ ⋃₀ E, (ψ ⁻¹' {v}).Finite := fun v hv ↦ by + refine ((finite_range (spe W)).image g).subset ?_ + intro z hz + obtain ⟨a, ha, rfl⟩ := hrep z + have hfa : f a = v := by rw [← hψ a ha]; exact hz + exact ⟨a, WordEdges.subset_range_spe h ha (hfa ▸ hv.1) (hfa ▸ hv.2), rfl⟩ + have hfin : ∀ x, (ψ ⁻¹' {x}).Finite := fun x ↦ by + by_cases hx : x ∈ ⋃₀ D + · obtain ⟨e, he, hxe⟩ := hx + by_cases hxV : x ∈ V + · exact hfinV x ⟨hxV, e, hD he, hxe⟩ + obtain ⟨t, ht, rfl, hc⟩ := WordEdges.exists_param h (hD he) hxe + obtain ⟨r, r', -, -, -, -, hf⟩ := hlift e he + have hI : t ∈ Ioo (0 : ℝ) 1 := hc.resolve_right (by + rintro ⟨τ, rfl⟩ + exact hxV (h.extI_mem_V (hD he) τ)) + refine (Set.toFinite {r t, r' t}).subset fun z hz ↦ ?_ + exact (hf t ht (.inl hI)).2 z hz + · have hoff : ∀ {z}, z ∈ ψ ⁻¹' {x} → z ∈ ψ ⁻¹' (⋃₀ D)ᶜ := fun {z} hz ↦ by + change ψ z ∉ ⋃₀ D + rw [show ψ z = x from hz] + exact hx + exact Set.Subsingleton.finite fun z hz z' hz' ↦ h3 (hoff hz) (hoff hz') (hz.trans hz'.symm) + refine ⟨Y, tY, t2, ψ, h4, h1, h2, h3, hfin, ?_, hlift⟩ + rintro z ⟨e, he, hze⟩ + by_contra hz + have hzi : IsInteriorPoint z := not_not.mp hz + have hend : ∀ {w t e'}, e' ∈ D → t ∈ Ioo (0 : ℝ) 1 → ψ w = extI (A e') t → w ∈ bd Y + := fun {w t e'} he' ht hw ↦ by + obtain ⟨r, r', -, -, -, hb, hf⟩ := hlift e' he' + have hI := Ioo_subset_Icc_self ht + rcases (hf t hI (.inl ht)).2 w hw with rfl | rfl + · exact (hb t hI).1 + · exact (hb t hI).2 + obtain ⟨t, ht, hte, hc⟩ := WordEdges.exists_param h (hD he) hze + obtain ⟨τ, rfl⟩ : ∃ τ, eo τ = t := hc.resolve_left fun hI ↦ hz (hend he hI hte.symm) + let P : Set Y := ψ ⁻¹' (V ∩ ⋃₀ E) + have hP : P.Finite := by + have : P = ⋃ v ∈ V ∩ ⋃₀ E, ψ ⁻¹' {v} := by + ext w + simp [P] + rw [this] + exact (h.graph.fin.subset inter_subset_left).biUnion fun v _ ↦ hfin v + let U : Set Y := (bd Y)ᶜ ∩ (P \ {z})ᶜ + have hUo : IsOpen U := (isClosed_bd Y).isOpen_compl.inter (hP.subset + sdiff_subset).isClosed.isOpen_compl + have hzU : z ∈ U := ⟨hz, fun hc ↦ hc.2 rfl⟩ + have key : ∀ w ∈ U, ψ w ∈ ⋃₀ D → w = z := by + rintro w hw ⟨e', he', hwe⟩ + obtain ⟨t', ht', hte', hc'⟩ := WordEdges.exists_param h (hD he') hwe + obtain ⟨τ', rfl⟩ : ∃ τ', eo τ' = t' := hc'.resolve_left fun hI ↦ hw.1 (hend he' hI hte'.symm) + by_contra hne' + exact hw.2 ⟨⟨hte' ▸ h.extI_mem_V (hD he') τ', e', hD he', hwe⟩, hne'⟩ + have hinj : InjOn ψ U := by + intro a ha b hb hab + by_cases hD' : ψ a ∈ ⋃₀ D + · rw [key a ha hD', key b hb (hab ▸ hD')] + · exact h3 hD' (show ψ b ∉ ⋃₀ D from hab ▸ hD') hab + have hN := image_mem_nhds_of_injOn hzi (hS.2.2 (ψ z)) h1 hUo hzU hinj + have hN' : extI (A e) ⁻¹' (ψ '' U) ∈ 𝓝 (eo τ) := + (continuous_extI (h.arc e (hD he)).1.1).continuousAt.preimage_mem_nhds (hte ▸ hN) + have hcl : eo τ ∈ closure (Ioo (0 : ℝ) 1) := by + rw [closure_Ioo (zero_ne_one' ℝ)] + exact eo_mem τ + obtain ⟨t', ht'N, ht'I⟩ := mem_closure_iff_nhds.mp hcl _ hN' + obtain ⟨w, hw, he'⟩ := ht'N + exact hw.1 (hend he ht'I he') + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CutDrawing2.lean b/LeanPool/GraphMinor/GM19/CutDrawing2.lean new file mode 100644 index 0000000000..12042ffdbd --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CutDrawing2.lean @@ -0,0 +1,304 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.CutDrawing +public import LeanPool.GraphMinor.Surface.CutGraph + +/-! +# A graph in a surface, and a dissection that holds it + +To cut along a set of lines we must see them as edges of a word. So we put the lines in a graph with +the cuffs +(`exists_graph_of_lines`), and extend that graph to a dissection (`exists_dissection_lines`). The +second step +is `exists_dissection_with`, for several lines in place of one. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Function GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- What we need of the sets we cut along: they are `O`-arcs, with the cuffs among them, and lines +with both +ends on the `O`-arcs. -/ +structure IsCutFrame (S : Type u) [TopologicalSpace S] (𝓐 𝓛 : Set (Set S)) : Prop where + finite_arcs : 𝓐.Finite + finite_lines : 𝓛.Finite + isOArc : ∀ C ∈ 𝓐, IsOArc C + cuffs_subset : cuffs S ⊆ 𝓐 + line : ∀ L ∈ 𝓛, ∃ s t, s ≠ t ∧ IsLineWithEnds L s t ∧ s ∈ ⋃₀ 𝓐 ∧ t ∈ ⋃₀ 𝓐 + +omit [T2Space S] in +/-- `exists_dissection_with`, with several lines. -/ +theorem exists_dissection_lines (hS : IsSurface S) [ConnectedSpace S] {V₀ : Set S} {E₀ 𝓐 𝓛 : Set + (Set S)} + (hg : IsGraph V₀ E₀) (hV₀ : V₀ ⊆ ⋃₀ E₀) (hF : IsCutFrame S 𝓐 𝓛) (hc : ⋃₀ E₀ = ⋃₀ 𝓐 ∪ ⋃₀ 𝓛) : + ∃ (V : Set S) (E 𝓕 : Set (Set S)), IsDissection V E 𝓕 ∧ V₀ ⊆ V ∧ ⋃₀ E₀ ⊆ gr V E := + exists_dissection_with_lines hS hg hV₀ hF.finite_arcs hF.finite_lines hF.isOArc + hF.cuffs_subset hF.line hc + +/-- A graph containing the cuffs and a finite family of lines, with a uniform bound on its +edge count and the added edges lying in the boundary. -/ +theorem exists_counted_line_graph (hS : IsSurface S) : + ∃ B : ℕ, ∀ {N : Set S} {𝓔 : Set (Set S)}, N.Finite → 𝓔.Finite → + (∀ L ∈ 𝓔, ∃ u v, u ≠ v ∧ IsLineWithEnds L u v ∧ L ∩ N = {u, v}) → + (∀ L ∈ 𝓔, ∀ L' ∈ 𝓔, L ≠ L' → L ∩ L' ⊆ N) → (∀ L ∈ 𝓔, L ∩ bd S ⊆ N) → N ⊆ bd S ∪ ⋃₀ 𝓔 → + ∃ (V : Set S) (E : Set (Set S)), N ⊆ V ∧ IsGraph V E ∧ V ⊆ ⋃₀ E ∧ ⋃₀ E = bd S ∪ ⋃₀ 𝓔 ∧ 𝓔 ⊆ E ∧ + E.ncard ≤ B + N.ncard + 𝓔.ncard ∧ (∀ e ∈ E, e ∉ 𝓔 → e ⊆ bd S) ∧ ∀ x ∈ bd S, ∃ e ∈ E, e ∉ 𝓔 + ∧ x ∈ e := by + classical + obtain ⟨V₁, E₁, hg, hV, hgr⟩ := exists_cuff_graph hS + refine ⟨E₁.ncard, ?_⟩ + intro N 𝓔 hN h𝓔 hline hdisj hbd hNs + have hgr1 : gr V₁ E₁ = bd S := by + rw [← hgr] + exact union_eq_right.mpr hV + have hpts : ∀ M : Set S, M.Finite → ∃ E', IsGraph (M ∪ V₁) E' ∧ gr (M ∪ V₁) E' = M ∪ bd S + ∧ bd S ⊆ ⋃₀ E' ∧ + E'.ncard ≤ E₁.ncard + M.ncard ∧ ∀ f ∈ E', f ⊆ bd S := by + intro M hM + induction M, hM using Set.Finite.induction_on with + | empty => + refine ⟨E₁, by simpa using hg, by simpa using hgr1, hgr.ge, by simp, fun f hf ↦ ?_⟩ + rw [← hgr] + exact subset_sUnion_of_mem hf + | @insert x M hx hfin ih => + obtain ⟨E', h1, h2, h3, h3', h3''⟩ := ih + obtain ⟨E'', h4, h5, h6, h7, h8⟩ := h1.add_point_counted x + refine ⟨E'', by rwa [insert_union], ?_, h3.trans h6, ?_, fun f hf ↦ ?_⟩ + · rw [insert_union, h5, h2, insert_union] + · rw [ncard_insert_of_notMem hx hfin] + omega + · obtain ⟨e, he, hfe⟩ := h8 f hf + exact hfe.trans (h3'' e he) + obtain ⟨E₂, hg2, hgr2, hbdE, hcard2, hE₂bd⟩ := hpts N hN + have hE₂ : ⋃₀ E₂ ⊆ N ∪ bd S := hgr2 ▸ subset_union_right + have harcs : ∀ 𝓔' : Set (Set S), 𝓔'.Finite → 𝓔' ⊆ 𝓔 → + IsGraph (N ∪ V₁) (𝓔' ∪ E₂) ∧ gr (N ∪ V₁) (𝓔' ∪ E₂) = (N ∪ bd S) ∪ ⋃₀ 𝓔' := by + intro 𝓔' h𝓔' + induction 𝓔', h𝓔' using Set.Finite.induction_on with + | empty => + intro _ + simpa [hgr2] using hg2 + | @insert L 𝓔' hL hfin ih => + intro hsub + obtain ⟨h1, h2⟩ := ih ((subset_insert _ _).trans hsub) + have hLm : L ∈ 𝓔 := hsub (mem_insert _ _) + obtain ⟨u, v, huv, hl, hi⟩ := hline L hLm + have hu : u ∈ L ∩ N := hi ▸ mem_insert _ _ + have hv : v ∈ L ∩ N := hi ▸ mem_insert_of_mem _ rfl + have hcap : L ∩ gr (N ∪ V₁) (𝓔' ∪ E₂) = {u, v} := by + rw [h2] + apply subset_antisymm + · rintro x ⟨hxL, (hx | hx) | ⟨L', hL', hx⟩⟩ + · exact hi ▸ ⟨hxL, hx⟩ + · exact hi ▸ ⟨hxL, hbd L hLm ⟨hxL, hx⟩⟩ + · exact hi ▸ ⟨hxL, hdisj L hLm L' (hsub (.inr hL')) (fun he => hL (he ▸ hL')) ⟨hxL, hx⟩⟩ + · rintro x (rfl | rfl) + · exact ⟨hu.1, .inl (.inl hu.2)⟩ + · exact ⟨hv.1, .inl (.inl hv.2)⟩ + obtain ⟨h3, h4⟩ := h1.add_arc huv hl (.inl hu.2) (.inl hv.2) hcap + rw [insert_union] + refine ⟨h3, ?_⟩ + rw [h4, h2, sUnion_insert, union_comm L, union_assoc] + obtain ⟨hg3, hgr3⟩ := harcs 𝓔 h𝓔 subset_rfl + have hU : ⋃₀ (𝓔 ∪ E₂) = bd S ∪ ⋃₀ 𝓔 := by + rw [sUnion_union] + apply subset_antisymm + · refine union_subset subset_union_right fun x hx ↦ ?_ + rcases hE₂ hx with h | h + · exact hNs h + · exact .inl h + · exact union_subset (hbdE.trans subset_union_right) subset_union_left + refine ⟨N ∪ V₁, 𝓔 ∪ E₂, subset_union_left, hg3, ?_, hU, subset_union_left, ?_, ?_, ?_⟩ + · rw [hU] + refine union_subset hNs ?_ + exact (hgr ▸ hV).trans subset_union_left + · have := ncard_union_le 𝓔 E₂ + omega + · rintro e (he | he) hne + · exact absurd he hne + · exact hE₂bd e he + · intro x hx + obtain ⟨e, he, hxe⟩ := hbdE hx + refine ⟨e, .inr he, fun hin ↦ ?_, hxe⟩ + obtain ⟨u, v, huv, hl, hi⟩ := hline e hin + obtain ⟨a, ha, rfl, rfl, rfl⟩ := hl.exists_arc + have h12 : (1 / 2 : ℝ) ∈ Icc (0 : ℝ) 1 := by norm_num + have hm : a ⟨1 / 2, h12⟩ ∈ range a ∩ N := ⟨⟨_, rfl⟩, hbd _ hin ⟨⟨_, rfl⟩, hE₂bd _ he ⟨_, rfl⟩⟩⟩ + rw [hi] at hm + rcases hm with h1 | h1 + · have : (1 / 2 : ℝ) = 0 := congrArg Subtype.val (ha.2 h1) + norm_num at this + · have : (1 / 2 : ℝ) = 1 := congrArg Subtype.val (ha.2 h1) + norm_num at this + +/-- The cuffs, a finite set `N` of points on the lines, and lines that meet only in `N`, make up a +graph. -/ +theorem exists_graph_of_lines (hS : IsSurface S) {N : Set S} {𝓔 : Set (Set S)} (hN : N.Finite) + (h𝓔 : 𝓔.Finite) + (hline : ∀ L ∈ 𝓔, ∃ u v, u ≠ v ∧ IsLineWithEnds L u v ∧ L ∩ N = {u, v}) + (hdisj : ∀ L ∈ 𝓔, ∀ L' ∈ 𝓔, L ≠ L' → L ∩ L' ⊆ N) (hbd : ∀ L ∈ 𝓔, L ∩ bd S ⊆ N) + (hNs : N ⊆ bd S ∪ ⋃₀ 𝓔) : + ∃ (V : Set S) (E : Set (Set S)), N ⊆ V ∧ IsGraph V E ∧ V ⊆ ⋃₀ E ∧ ⋃₀ E = bd S ∪ ⋃₀ 𝓔 ∧ 𝓔 ⊆ E + := by + obtain ⟨_, h⟩ := exists_counted_line_graph hS + obtain ⟨V, E, hNV, hg, hV, hU, hE, _, _, _⟩ := h hN h𝓔 hline hdisj hbd hNs + exact ⟨V, E, hNV, hg, hV, hU, hE⟩ + +variable {W : ℕ → List Letter} {f : ℕ × ℂ → S} {V : Set S} {E : Set (Set S)} {A : Set S + → unitInterval → S} + {lab : Set S → ℕ} {D : Set (Set S)} {Y : Type u} [TopologicalSpace Y] [T2Space Y] {ψ : Y → S} + +/-- A part of an edge with lifts, with ends where the lifts are apart, has a pair of lifts. -/ +theorem liftPair_of_piece (h : WordEdges W f V E A lab) {e : Set S} (he : e ∈ E) {hend : Bool + → Prop} + {r r' : ℝ → Y} (hL : IsEdgeLift ψ (extI (A e)) hend r r') {ι : ℝ → S} {c d : ℝ} (hcd : c < d) + (hι : ContinuousOn ι (Icc c d)) (hinj : InjOn ι (Icc c d)) (hsub : ι '' Icc c d ⊆ e) + (hfine : ∀ x ∈ Icc c d, ∀ τ, ι x = extI (A e) (eo τ) → hend τ) : + ∃ X X', LiftPair ψ (ι '' Icc c d) (ι c) (ι d) X X' := by + obtain ⟨hrc, hrc', hr, -, hf⟩ := hL + have ha := h.arc e he + have hec := continuous_extI ha.1.1 + have hei := extI_injOn ha.1.2 + have hre : extI (A e) '' Icc 0 1 = e := by rw [image_extI, ha.2.1] + obtain ⟨ρ, hρ, hl⟩ := exists_inv_of_compactOn (isCompact_Icc (a := (0 : ℝ)) (b + := 1)) hec.continuousOn hei + have hθ : ∀ x ∈ Icc c d, ρ (ι x) ∈ Icc (0 : ℝ) 1 ∧ extI (A e) (ρ (ι x)) = ι x := fun x hx ↦ by + have hm : ι x ∈ extI (A e) '' Icc 0 1 := by + rw [hre] + exact hsub (mem_image_of_mem ι hx) + obtain ⟨s, hs, hse⟩ := hm + rw [← hse, hl hs] + exact ⟨hs, rfl⟩ + have hδ : 0 < d - c := sub_pos.mpr hcd + let u : ℝ → ℝ := fun s ↦ c + s * (d - c) + have huc : Continuous u := by fun_prop + have huI : ∀ s ∈ Icc (0 : ℝ) 1, u s ∈ Icc c d := fun s hs ↦ + ⟨by nlinarith [hs.1], by nlinarith [hs.2]⟩ + have huo : ∀ x ∈ Icc c d, (x - c) / (d - c) ∈ Icc (0 : ℝ) 1 ∧ u ((x - c) / (d - c)) = x + := fun x hx ↦ by + refine ⟨⟨div_nonneg (by linarith [hx.1]) hδ.le, ?_⟩, ?_⟩ + · rw [div_le_one hδ] + linarith [hx.2] + · simp only [u] + field_simp + ring + have hb : ContinuousOn (fun s ↦ ρ (ι (u s))) (Icc 0 1) := by + refine hρ.comp (hι.comp huc.continuousOn huI) fun s hs ↦ ?_ + rw [hre] + exact hsub (mem_image_of_mem ι (huI s hs)) + have himg : (fun s ↦ ι (u s)) '' Icc 0 1 = ι '' Icc c d := by + ext z + constructor + · rintro ⟨s, hs, rfl⟩ + exact mem_image_of_mem ι (huI s hs) + · rintro ⟨x, hx, rfl⟩ + exact ⟨_, (huo x hx).1, by simp only [(huo x hx).2]⟩ + have hfineθ : ∀ s ∈ Icc (0 : ℝ) 1, ρ (ι (u s)) ∈ Ioo (0 : ℝ) 1 ∨ ∃ τ, eo τ = ρ (ι (u s)) ∧ hend τ + := fun s hs ↦ by + obtain ⟨h1, h2⟩ := hθ _ (huI s hs) + by_cases h0 : ρ (ι (u s)) = 0 + · refine .inr ⟨false, by simp [eo, h0], hfine _ (huI s hs) false ?_⟩ + rw [← h2, h0] + simp [eo] + by_cases h3 : ρ (ι (u s)) = 1 + · refine .inr ⟨true, by simp [eo, h3], hfine _ (huI s hs) true ?_⟩ + rw [← h2, h3] + simp [eo] + exact .inl ⟨lt_of_le_of_ne h1.1 (Ne.symm h0), lt_of_le_of_ne h1.2 h3⟩ + have hpair := liftPair_of_maps (ψ := ψ) (a := fun s ↦ ι (u s)) (r := fun s ↦ r (ρ (ι (u s)))) + (r' := fun s ↦ r' (ρ (ι (u s)))) + (hrc.comp hb fun s hs ↦ (hθ _ (huI s hs)).1) (hrc'.comp hb fun s hs ↦ (hθ _ (huI s hs)).1) + (fun s hs ↦ by + rw [(hr _ (hθ _ (huI s hs)).1).1, (hθ _ (huI s hs)).2]) + (fun s hs ↦ by + rw [(hr _ (hθ _ (huI s hs)).1).2, (hθ _ (huI s hs)).2]) + (fun s hs s' hs' he' ↦ by + have := hinj (huI s hs) (huI s' hs') he' + have h5 : (s - s') * (d - c) = 0 := by + simp only [u] at this + linear_combination this + rcases mul_eq_zero.mp h5 with h6 | h6 + · linarith + · linarith) + (fun s hs ↦ (hf _ (hθ _ (huI s hs)).1 (hfineθ s hs)).1) + (by + rintro z ⟨s, hs, hz⟩ + have hzt : ψ z = extI (A e) (ρ (ι (u s))) := by rw [(hθ _ (huI s hs)).2]; exact hz.symm + rcases (hf _ (hθ _ (huI s hs)).1 (hfineθ s hs)).2 z hzt with rfl | rfl + · exact .inl ⟨s, hs, rfl⟩ + · exact .inr ⟨s, hs, rfl⟩) + rw [himg] at hpair + have e0 : u 0 = c := by simp [u] + have e1 : u 1 = d := by simp [u] + simp only [e0, e1] at hpair + exact ⟨_, _, hpair⟩ + +omit [T2Space S] in +/-- At a vertex inside a chain of edges that holds all the edges of `D` ending there, the edges of +`D` look +like a line. -/ +theorem endFine_of_chain {ι : ℝ → S} {m : ℕ} {t : ℕ → ℝ} {ss : ℕ → Set S} {ε : ℕ → Bool} + (hex : ∀ p < m, ∀ τ, extI (A (ss p)) (eo τ) = ι (t (chainAt ε p τ))) + (hinj : ∀ k ≤ m, ∀ k' ≤ m, ι (t k) = ι (t k') → k = k') (hsne : ∀ p < m, ∀ q < m, p ≠ q + → ss p ≠ ss q) + (hmem : ∀ p < m, ss p ∈ D) {p : ℕ} (hp : p < m) {τ : Bool} (h0 : 0 < chainAt ε p τ) + (h1 : chainAt ε p τ < m) + (hb : ι (t (chainAt ε p τ)) ∉ bd S) + (hall : ∀ e'' ∈ D, ∀ τ'', extI (A e'') (eo τ'') = ι (t (chainAt ε p τ)) → ∃ q < m, e'' = ss q) : + EndFine A D (ss p) τ := by + have hat : ∀ {q τ'}, q < m → chainAt ε q τ' ≤ m := fun {q τ'} hq ↦ by + unfold chainAt + split_ifs <;> omega + obtain ⟨k, hk⟩ : ∃ k, chainAt ε p τ = k := ⟨_, rfl⟩ + have hsplit := chainAt_split hk + rw [hk] at h0 h1 hb hall + have hup : chainAt ε k (!ε k) = k := by + unfold chainAt + cases ε k <;> simp + have hdn : chainAt ε (k - 1) (ε (k - 1)) = k := by + unfold chainAt + simp + omega + refine .inl ?_ + have hval : extI (A (ss p)) (eo τ) = ι (t k) := hk ▸ hex p hp τ + have huniq : ∀ e'' ∈ D, ∀ τ'', extI (A e'') (eo τ'') = extI (A (ss p)) (eo τ) → + (e'' = ss k ∧ τ'' = !ε k) ∨ (e'' = ss (k - 1) ∧ τ'' = ε (k - 1)) := by + intro e'' he'' τ'' he + obtain ⟨q, hq, rfl⟩ := hall e'' he'' τ'' (he.trans hval) + have h3 := hinj _ (hat hq) k h1.le (by rw [← hex q hq τ'', he, hval]) + rcases chainAt_split h3 with ⟨rfl, rfl⟩ | ⟨h5, rfl⟩ + · exact .inl ⟨rfl, rfl⟩ + · obtain rfl : q = k - 1 := by omega + exact .inr ⟨rfl, rfl⟩ + rcases hsplit with ⟨hpk, rfl⟩ | ⟨hpk, rfl⟩ + · subst hpk + refine ⟨ss (p - 1), hmem _ (by omega), ε (p - 1), hsne _ (by omega) _ hp (by omega), ?_, ?_, ?_⟩ + · rw [hval, hex _ (by omega), hdn] + · rw [hval] + exact hb + · intro e'' he'' τ'' he + exact huniq e'' he'' τ'' he + · obtain rfl : p = k - 1 := by omega + refine ⟨ss k, hmem _ h1, !ε k, hsne _ h1 _ hp (by omega), ?_, ?_, ?_⟩ + · rw [hval, hex _ h1, hup] + · rw [hval] + exact hb + · intro e'' he'' τ'' he + exact (huniq e'' he'' τ'' he).symm + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CutDrawing3.lean b/LeanPool/GraphMinor/GM19/CutDrawing3.lean new file mode 100644 index 0000000000..91cf3ee56a --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CutDrawing3.lean @@ -0,0 +1,309 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.CutDrawing2 + +/-! +# Cutting a surface along lines + +`exists_cut_lines` cuts a connected surface along a finite set of lines that meet only at a finite +set `N` of +points. Over each point of a line off `N` there are two points of the cut surface, and every compact +part of +the line off `N` lies in a part with two lifts. This is all that XIX needs about the cuts of Section +5 and +Sections 10, 11 and 14. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Function GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + {W : ℕ → List Letter} {f : ℕ × ℂ → S} {V : Set S} {E : Set (Set S)} {A : Set S → unitInterval → S} + {lab : Set S → ℕ} + +/-- A line in the graph of a word, with ends at vertices, is a chain of edges. -/ +theorem exists_chain_of_line (hw : WordEdges W f V E A lab) {L : Set S} {u v : S} (hne : u ≠ v) + (hl : IsLineWithEnds L u v) (hu : u ∈ V) (hv : v ∈ V) (hLg : L ⊆ gr V E) : + ∃ (ι : ℝ → S) (m : ℕ) (t : ℕ → ℝ) (ss : ℕ → Set S) (ε : ℕ → Bool), Continuous ι ∧ InjOn ι + (Icc 0 1) ∧ + ι '' Icc 0 1 = L ∧ ι 0 = u ∧ ι 1 = v ∧ 0 < m ∧ t 0 = 0 ∧ t m = 1 ∧ (∀ p < m, t p < t (p + 1)) + ∧ + (∀ x ∈ Icc (0 : ℝ) 1, ι x ∈ V → ∃ p ≤ m, x = t p) ∧ + (∀ p < m, ss p ∈ E ∧ ι '' Icc (t p) (t (p + 1)) = ss p ∧ + ∀ τ, extI (A (ss p)) (eo τ) = ι (t (chainAt ε p τ))) ∧ + (∀ p < m, ∀ q < m, p ≠ q → ss p ≠ ss q) ∧ ⋃₀ (ss '' Iio m) = L := by + obtain ⟨a, ha, rfl, rfl, rfl⟩ := hl.exists_arc + have hιc := continuous_extI ha.1 + have hinj := extI_injOn ha.2 + have hval0 : extI a 0 = a 0 := extI_coe a 0 + have hval1 : extI a 1 = a 1 := extI_coe a 1 + have himg : extI a '' Icc 0 1 = range a := image_extI a + obtain ⟨m, τ, ss, ε, hm, ht0, htm, hlt, hV, hch, hsne⟩ := exists_chain hw.graph A hw.arc hιc + (hinj.mono Ico_subset_Icc_self) (hinj.mono Ioc_subset_Icc_self) (himg ▸ hLg) + (by rw [hval0]; exact hu) (by rw [hval1]; exact hv) + (.inl (by rw [hval0, hval1]; exact hne)) + refine ⟨extI a, m, τ, ss, ε, hιc, hinj, himg, hval0, hval1, hm, ht0, htm, hlt, hV, + fun p hp ↦ ⟨(hch p hp).1, (hch p hp).2.1, fun σ ↦ chain_hex (hch p hp).2.2.1 + (hch p hp).2.2.2 σ⟩, hsne, ?_⟩ + rw [sUnion_image_Icc_chain (extI a) hm hlt (fun p hp => (hch p hp).2.1), ht0, htm, himg] + +/-- A compact part of an open interval lies in a smaller closed interval, which we may ask to hold a +finite +set too. -/ +theorem exists_Icc_of_compact {Q : Set ℝ} (hQ : IsCompact Q) (hsub : Q ⊆ Ioo 0 1) : + ∃ a b, 0 < a ∧ a < b ∧ b < 1 ∧ Q ⊆ Ioo a b := by + have hQ' : IsCompact (insert (1 / 2 : ℝ) Q) := hQ.insert _ + have hsub' : insert (1 / 2 : ℝ) Q ⊆ Ioo 0 1 := insert_subset (by norm_num) hsub + obtain ⟨x, hx, hxm⟩ := hQ'.exists_isMinOn (insert_nonempty _ _) continuous_id.continuousOn + obtain ⟨y, hy, hym⟩ := hQ'.exists_isMaxOn (insert_nonempty _ _) continuous_id.continuousOn + have h1 := hsub' hx + have h2 := hsub' hy + have h3 : x ≤ 1 / 2 := hxm (mem_insert _ _) + have h4 : 1 / 2 ≤ y := hym (mem_insert _ _) + refine ⟨x / 2, (y + 1) / 2, by linarith [h1.1], by linarith [h1.1], by linarith [h2.2], + fun z hz ↦ ?_⟩ + have h5 : x ≤ z := hxm (mem_insert_of_mem _ hz) + have h6 : z ≤ y := hym (mem_insert_of_mem _ hz) + exact ⟨by linarith [h1.1], by linarith [h2.2]⟩ + +omit [TopologicalSpace S] [T2Space S] in +private theorem chainParameter_injective {ι : ℝ → S} {t : ℕ → ℝ} {m : ℕ} + (hlt : ∀ p < m, t p < t (p + 1)) (hτI : ∀ k ≤ m, t k ∈ Icc (0 : ℝ) 1) + (hinj : InjOn ι (Icc (0 : ℝ) 1)) : + ∀ k ≤ m, ∀ k' ≤ m, ι (t k) = ι (t k') → k = k' := by + intro k hk k' hk' he + have heq := hinj (hτI k hk) (hτI k' hk') he + rcases lt_trichotomy k k' with hlt' | heq' | hgt + · exact absurd heq (chain_mono hlt hlt' hk').ne + · exact heq' + · exact absurd heq (chain_mono hlt hgt hk).ne' + +/-- **Cutting along lines.** The lines `𝓔` meet each other and the boundary only in the finite set +`N`. The +map `ψ` is one to one off the lines and has finite fibres, and the lift of the lines lies in the +boundary. Each +compact part `Q` of a line off `N` lies in a part `L'` of that line with two lifts. -/ +theorem exists_cut_lines (hS : IsSurface S) [ConnectedSpace S] {N : Set S} {𝓔 𝓐 𝓛 : Set (Set S)} + (hN : N.Finite) + (h𝓔 : 𝓔.Finite) (hline : ∀ L ∈ 𝓔, ∃ u v, u ≠ v ∧ IsLineWithEnds L u v ∧ L ∩ N = {u, v}) + (hdisj : ∀ L ∈ 𝓔, ∀ L' ∈ 𝓔, L ≠ L' → L ∩ L' ⊆ N) (hbd : ∀ L ∈ 𝓔, L ∩ bd S ⊆ N) (hNs : N ⊆ ⋃₀ 𝓔) + (hF : IsCutFrame S 𝓐 𝓛) (hc : bd S ∪ ⋃₀ 𝓔 = ⋃₀ 𝓐 ∪ ⋃₀ 𝓛) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S), IsSurface Y ∧ Continuous ψ + ∧ + Function.Surjective ψ ∧ InjOn ψ (ψ ⁻¹' (⋃₀ 𝓔)ᶜ) ∧ (∀ x, (ψ ⁻¹' {x}).Finite) ∧ ψ ⁻¹' + (⋃₀ 𝓔) ⊆ bd Y ∧ + ∀ L ∈ 𝓔, ∀ Q ⊆ L \ N, IsCompact Q → ∃ L' ⊆ L, Q ⊆ L' ∧ ∃ u v X X', LiftPair ψ L' u v X X' + := by + classical + obtain ⟨V₀, E₀, hNV, hg, hV₀, hU, h𝓔E⟩ := exists_graph_of_lines hS hN h𝓔 hline hdisj hbd + (hNs.trans subset_union_right) + obtain ⟨V, E, 𝓕, hd, hVV, hEE⟩ := exists_dissection_lines hS hg hV₀ hF (hU.trans hc) + obtain ⟨W, f, A, lab, hw, hdn⟩ := exists_word_edges hS hd + have hLg : ∀ L ∈ 𝓔, L ⊆ gr V E := fun L hL ↦ + (subset_sUnion_of_mem (h𝓔E hL)).trans hEE + have hchain : ∀ L ∈ 𝓔, ∃ u v, u ≠ v ∧ IsLineWithEnds L u v ∧ L ∩ N = {u, v} ∧ u ∈ V ∧ v ∈ V + := fun L hL ↦ by + obtain ⟨u, v, huv, hl, hi⟩ := hline L hL + have hu : u ∈ L ∩ N := hi ▸ mem_insert _ _ + have hv : v ∈ L ∩ N := hi ▸ mem_insert_of_mem _ rfl + exact ⟨u, v, huv, hl, hi, hVV (hNV hu.2), hVV (hNV hv.2)⟩ + let D : Set (Set S) := {e ∈ E | ∃ L ∈ 𝓔, e ⊆ L} + have hDE : D ⊆ E := fun e he ↦ he.1 + have hmemD : ∀ L ∈ 𝓔, ∀ x ∈ L, ∃ e ∈ D, x ∈ e ∧ e ⊆ L := fun L hL x hx ↦ by + obtain ⟨u, v, huv, hl, -, hu, hv⟩ := hchain L hL + obtain ⟨ι, m, t, ss, ε, -, -, himg, -, -, -, -, -, -, -, hch, -, hun⟩ := + exists_chain_of_line hw huv hl hu hv (hLg L hL) + obtain ⟨_, ⟨p, hp, rfl⟩, hxp⟩ := hun.symm ▸ hx + have hsub : ss p ⊆ L := fun z hz ↦ hun ▸ ⟨ss p, ⟨p, hp, rfl⟩, hz⟩ + exact ⟨ss p, ⟨(hch p hp).1, L, hL, hsub⟩, hxp, hsub⟩ + have hUD : ⋃₀ D = ⋃₀ 𝓔 := by + apply subset_antisymm + · rintro x ⟨e, ⟨-, L, hL, heL⟩, hx⟩ + exact ⟨L, hL, heL hx⟩ + · rintro x ⟨L, hL, hx⟩ + obtain ⟨e, he, hxe, -⟩ := hmemD L hL x hx + exact ⟨e, he, hxe⟩ + have hmid : ∀ e ∈ D, edgeMid A e ∉ bd S := by + rintro e ⟨heE, L, hL, heL⟩ hb + have hmem : edgeMid A e ∈ L ∩ bd S := ⟨heL (hw.extI_mem heE _), hb⟩ + exact hw.extI_notMem heE (show (1 / 2 : ℝ) ∈ Ioo (0 : ℝ) 1 by norm_num) (hVV (hNV + (hbd L hL hmem))) + obtain ⟨Y, tY, t2, ψ, h1, h2, h3, h4, h5, h6, hlift⟩ := WordEdges.exists_cut hw hS hdn hDE hmid + rw [hUD] at h4 h6 + refine ⟨Y, tY, t2, ψ, h1, h2, h3, h4, h5, h6, ?_⟩ + intro L hL Q hQ hQc + obtain ⟨u, v, huv, hl, hi, hu, hv⟩ := hchain L hL + obtain ⟨ι, m, t, ss, ε, hιc, hinj, himg, h0, h1', hm, ht0, htm, hlt, hV, hch, hsne, hun⟩ := + exists_chain_of_line hw huv hl hu hv (hLg L hL) + -- the parameter set of `Q` + have hQcl : IsClosed Q := hQc.isClosed + let Q' : Set ℝ := Icc 0 1 ∩ ι ⁻¹' Q + have hQ'c : IsCompact Q' := isCompact_Icc.inter_right (hQcl.preimage hιc) + have hQ'I : Q' ⊆ Ioo 0 1 := by + rintro x ⟨hx, hxQ⟩ + have hoff := (hQ hxQ).2 + refine ⟨lt_of_le_of_ne hx.1 fun h ↦ hoff ?_, lt_of_le_of_ne hx.2 fun h ↦ hoff ?_⟩ + · rw [← h, h0] + exact (show u ∈ L ∩ N from hi ▸ mem_insert _ _).2 + · rw [h, h1'] + exact (show v ∈ L ∩ N from hi ▸ mem_insert_of_mem _ rfl).2 + have hτI : ∀ k ≤ m, t k ∈ Icc (0 : ℝ) 1 := fun k hk => + ⟨ht0 ▸ chain_mono' hlt (Nat.zero_le k) hk, htm ▸ chain_mono' hlt hk le_rfl⟩ + have hin : ∀ k, 0 < k → k < m → t k ∈ Ioo (0 : ℝ) 1 := fun k h0' hk ↦ + ⟨ht0 ▸ chain_mono hlt h0' hk.le, htm ▸ chain_mono hlt hk le_rfl⟩ + let Tf : Set ℝ := t '' {k | 0 < k ∧ k < m} + have hfinite : {k | 0 < k ∧ k < m}.Finite := + (Set.finite_Iio m).subset fun _ hk => hk.2 + have hTf : Tf.Finite := hfinite.image t + obtain ⟨a, b, ha0, hab, hb1, hsubab⟩ := exists_Icc_of_compact (hQ'c.union hTf.isCompact) + (union_subset hQ'I (by rintro _ ⟨k, hk, rfl⟩; exact hin k hk.1 hk.2)) + have hta : ∀ k, 0 < k → k < m → a < t k ∧ t k < b := fun k h0' hk ↦ + hsubab (.inr ⟨k, ⟨h0', hk⟩, rfl⟩) + have hm0 : m ≠ 0 := hm.ne' + let ι' : ℝ → S := fun x ↦ ι (x + a) + let T : ℕ → ℝ := fun k ↦ if k = 0 then 0 else if k = m then b - a else t k - a + have hT0 : T 0 = 0 := by simp [T] + have hTm : T m = b - a := by simp [T, hm0] + have hTin : ∀ k, 0 < k → k < m → T k = t k - a := fun k h0' hk ↦ by + simp [T, h0'.ne', hk.ne] + have hlow : ∀ p < m, t p ≤ T p + a := fun p hp ↦ by + rcases Nat.eq_zero_or_pos p with rfl | h + · rw [hT0, ht0] + linarith + · rw [hTin p h hp] + linarith + have hhigh : ∀ p < m, T (p + 1) + a ≤ t (p + 1) := fun p hp ↦ by + rcases eq_or_lt_of_le (Nat.succ_le_of_lt hp) with h | h + · have e : p + 1 = m := h + rw [e, hTm, htm] + linarith + · rw [hTin (p + 1) (by omega) h] + linarith + have hlt' : ∀ p < m, T p < T (p + 1) := fun p hp ↦ by + rcases Nat.eq_zero_or_pos p with rfl | h0' + · rcases eq_or_lt_of_le (Nat.succ_le_of_lt hp) with h | h + · have e : 0 + 1 = m := h + rw [e, hT0, hTm] + linarith + · rw [hT0, hTin (0 + 1) (by omega) h] + linarith [(hta (0 + 1) (by omega) h).1] + · rcases eq_or_lt_of_le (Nat.succ_le_of_lt hp) with h | h + · have e : p + 1 = m := h + rw [e, hTm, hTin p h0' hp] + linarith [(hta p h0' hp).2] + · rw [hTin p h0' hp, hTin (p + 1) (by omega) h] + linarith [hlt p hp] + have hTI : ∀ k ≤ m, T k + a ∈ Icc a b := fun k hk ↦ by + rcases Nat.eq_zero_or_pos k with rfl | h0' + · rw [hT0] + constructor <;> linarith + rcases eq_or_lt_of_le hk with rfl | h + · rw [hTm] + constructor <;> linarith + · rw [hTin k h0' h] + have := hta k h0' h + constructor <;> linarith + have habI : Icc a b ⊆ Icc (0 : ℝ) 1 := Icc_subset_Icc ha0.le hb1.le + have hx01 : ∀ {x}, x ∈ Icc (0 : ℝ) (T m) → x + a ∈ Icc a b := fun {x} hx ↦ by + rw [hTm] at hx + constructor <;> linarith [hx.1, hx.2] + have hι'inj : InjOn ι' (Icc 0 (T m)) := fun x hx y hy he ↦ by + have := hinj (habI (hx01 hx)) (habI (hx01 hy)) he + linarith + have hι'c : Continuous ι' := by fun_prop + have hinjk := chainParameter_injective hlt hτI hinj + have hssL : ∀ p < m, ss p ⊆ L := fun p hp z hz ↦ hun ▸ ⟨ss p, ⟨p, hp, rfl⟩, hz⟩ + have hssD : ∀ p < m, ss p ∈ D := fun p hp ↦ ⟨(hch p hp).1, L, hL, hssL p hp⟩ + have hoffN : ∀ k, 0 < k → k < m → ι (t k) ∉ N := fun k h0' hk hmem ↦ by + have hmemL : ι (t k) ∈ L := himg ▸ mem_image_of_mem ι (hτI k hk.le) + have hI := hin k h0' hk + have : ι (t k) ∈ ({u, v} : Set S) := hi ▸ ⟨hmemL, hmem⟩ + rcases this with h5 | h5 + · have := hinj (hτI k hk.le) ⟨le_rfl, zero_le_one⟩ (h5.trans h0.symm) + linarith [hI.1] + · have := hinj (hτI k hk.le) ⟨zero_le_one, le_rfl⟩ (h5.trans h1'.symm) + linarith [hI.2] + have hlift' : ∀ p < m, ∃ X X', LiftPair ψ (ι' '' Icc (T p) (T (p + 1))) (ι' (T p)) (ι' (T + (p + 1))) X X' := by + intro p hp + obtain ⟨r, r', hr⟩ := hlift (ss p) (hssD p hp) + have hrange : ∀ x ∈ Icc (T p) (T (p + 1)), x + a ∈ Icc (t p) (t (p + 1)) := fun x hx ↦ + ⟨(hlow p hp).trans (by linarith [hx.1]), le_trans (by linarith [hx.2]) (hhigh p hp)⟩ + refine liftPair_of_piece hw (hch p hp).1 hr (hlt' p hp) hι'c.continuousOn ?_ ?_ ?_ + · intro x hx y hy he + have hI : ∀ {z}, z ∈ Icc (T p) (T (p + 1)) → z + a ∈ Icc (0 : ℝ) 1 := fun {z} hz ↦ + ⟨(hτI p hp.le).1.trans (hrange z hz).1, (hrange z hz).2.trans (hτI (p + 1) hp).2⟩ + have := hinj (hI hx) (hI hy) he + linarith + · rintro _ ⟨x, hx, rfl⟩ + rw [← (hch p hp).2.1] + exact mem_image_of_mem ι (hrange x hx) + · intro x hx τ he + have hex := (hch p hp).2.2 τ + obtain ⟨k, hk⟩ : ∃ k, chainAt ε p τ = k := ⟨_, rfl⟩ + have hkm : k ≤ m := by + rw [← hk] + unfold chainAt + split_ifs <;> omega + have hxI : x + a ∈ Icc a b := by + have hle1 := hTI p hp.le + have hle2 := hTI (p + 1) hp + exact ⟨hle1.1.trans (by linarith [hx.1]), le_trans (by linarith [hx.2]) hle2.2⟩ + have h5 : x + a = t k := hinj (habI hxI) (hτI k hkm) (by + change ι' x = _ + rw [he, hex, hk]) + have hk0 : 0 < k := by + rcases Nat.eq_zero_or_pos k with rfl | h + · rw [ht0] at h5 + linarith [hxI.1] + · exact h + have hkm' : k < m := by + rcases eq_or_lt_of_le hkm with rfl | h + · rw [htm] at h5 + linarith [hxI.2] + · exact h + refine endFine_of_chain (fun q hq σ ↦ (hch q hq).2.2 σ) hinjk hsne hssD hp (by rwa [hk]) + (by rwa [hk]) + ?_ ?_ + · rw [hk] + intro hb' + have hmemL : ι (t k) ∈ L := himg ▸ mem_image_of_mem ι (hτI k hkm) + exact hoffN k hk0 hkm' (hbd L hL ⟨hmemL, hb'⟩) + · rw [hk] + rintro e'' ⟨he''E, L'', hL'', heL⟩ τ'' hend + have hwL : ι (t k) ∈ L := himg ▸ mem_image_of_mem ι (hτI k hkm) + have hwe : ι (t k) ∈ e'' := hend ▸ hw.extI_mem he''E _ + obtain rfl : L'' = L := by + by_contra hne + exact hoffN k hk0 hkm' (hdisj L hL L'' hL'' (Ne.symm hne) ⟨hwL, heL hwe⟩) + have hmidm : extI (A e'') (1 / 2) ∈ L'' := heL (hw.extI_mem he''E _) + obtain ⟨_, ⟨q, hq, rfl⟩, hxq⟩ := hun.symm ▸ hmidm + refine ⟨q, hq, ?_⟩ + by_contra hne + exact hw.extI_notMem he''E (show (1 / 2 : ℝ) ∈ Ioo (0 : ℝ) 1 by norm_num) + (hw.graph.disj e'' he''E (ss q) (hch q hq).1 hne ⟨hw.extI_mem he''E _, hxq⟩) + obtain ⟨X, X', hX⟩ := chain_fold (ψ := ψ) (ι := ι') (t := T) + (ss := fun p ↦ ι' '' Icc (T p) (T (p + 1))) hlt' hT0 (fun _ _ ↦ rfl) hlift' hm le_rfl hι'inj + refine ⟨ι' '' Icc 0 (T m), ?_, ?_, _, _, X, X', hX⟩ + · rintro _ ⟨x, hx, rfl⟩ + exact himg ▸ mem_image_of_mem ι (habI (hx01 hx)) + · intro z hz + obtain ⟨x, hx, rfl⟩ : z ∈ ι '' Icc 0 1 := himg ▸ (hQ hz).1 + have hx' : x ∈ Ioo a b := hsubab (.inl ⟨hx, hz⟩) + refine ⟨x - a, ⟨by linarith [hx'.1], by rw [hTm]; linarith [hx'.2]⟩, ?_⟩ + simp [ι'] + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CutFragment.lean b/LeanPool/GraphMinor/GM19/CutFragment.lean new file mode 100644 index 0000000000..8bcd3803e1 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CutFragment.lean @@ -0,0 +1,292 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.PullLift +public import LeanPool.GraphMinor.GM19.CapExists +public import LeanPool.GraphMinor.GM19.DiscSides +public import LeanPool.GraphMinor.GM19.RadialExists + +/-! +# A component of a cut surface is a fragment + +Cutting a surface along a closed set `F` gives a surface `Y` and a map `ψ`. We show that each +component of +`Y` is a fragment in the sense of `IsCuttingFragment`. The point that takes some work is that the +interior +of a connected surface is connected (`isConnected_interior`), which we get by removing the capping +discs +from the capped surface one at a time. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +section Interior + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + +omit [T2Space S] in +/-- Removing finitely many of the capping discs leaves a connected open set. -/ +theorem IsCappedSurface.isPreconnected_compl (cap : IsCappedSurface S Shat) {𝓒 : Set (Set S)} + (h𝓒 : 𝓒.Finite) (hsub : 𝓒 ⊆ cuffs S) : + IsOpen (⋃ Θ ∈ 𝓒, closure (cap.cuffDisc Θ))ᶜ ∧ + IsPreconnected (⋃ Θ ∈ 𝓒, closure (cap.cuffDisc Θ))ᶜ := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + induction 𝓒, h𝓒 using Set.Finite.induction_on with + | empty => simpa using isPreconnected_univ + | @insert Θ 𝓒 hΘ hfin ih => + obtain ⟨ih₁, ih₂⟩ := ih (fun x hx ↦ hsub (mem_insert_of_mem _ hx)) + have hΘc : Θ ∈ cuffs S := hsub (mem_insert _ _) + have heq : (⋃ Θ' ∈ insert Θ 𝓒, closure (cap.cuffDisc Θ'))ᶜ = + (⋃ Θ' ∈ 𝓒, closure (cap.cuffDisc Θ'))ᶜ \ closure (cap.cuffDisc Θ) := by + rw [biUnion_insert] + ext x + simp only [mem_compl_iff, mem_union, not_or, mem_sdiff] + tauto + rw [heq] + refine ⟨ih₁.sdiff isClosed_closure, isPreconnected_sdiff_disc hT ih₁ ih₂ + (cap.cuffDisc_closedDisc Θ hΘc) ?_⟩ + intro x hx hxU + obtain ⟨Θ', hΘ', hxΘ'⟩ := mem_iUnion₂.mp hxU + have hne : Θ ≠ Θ' := fun h ↦ hΘ (h ▸ hΘ') + exact disjoint_left.mp (cap.cuffDisc_disjoint Θ hΘc Θ' (hsub (mem_insert_of_mem _ hΘ')) hne) hx + hxΘ' + +omit [T2Space S] [T2Space Shat] in +/-- The complement of the capping discs is the image of the interior. -/ +theorem IsCappedSurface.compl_eq_image (cap : IsCappedSurface S Shat) : + (⋃ Θ ∈ cuffs S, closure (cap.cuffDisc Θ))ᶜ = cap.emb '' (bd S)ᶜ := by + ext y + constructor + · intro hy + have hyr : y ∈ range cap.emb := by + by_contra hn + have hn' : y ∈ (range cap.emb)ᶜ := hn + rw [cap.compl_eq] at hn' + obtain ⟨Θ, hΘ, hyΘ⟩ := mem_iUnion₂.mp hn' + exact hy (mem_biUnion hΘ (subset_closure hyΘ)) + obtain ⟨x, rfl⟩ := hyr + refine ⟨x, fun hxb ↦ ?_, rfl⟩ + rw [← sUnion_cuffs] at hxb + obtain ⟨Θ, hΘ, hxΘ⟩ := hxb + refine hy (mem_biUnion hΘ ?_) + rw [cap.closure_cuffDisc hΘ] + exact Or.inr (mem_image_of_mem _ hxΘ) + · rintro ⟨x, hx, rfl⟩ hy + obtain ⟨Θ, hΘ, hyΘ⟩ := mem_iUnion₂.mp hy + rw [cap.closure_cuffDisc hΘ] at hyΘ + rcases hyΘ with hy | ⟨z, hz, hzx⟩ + · have : cap.emb x ∈ (range cap.emb)ᶜ := by + rw [cap.compl_eq] + exact mem_biUnion hΘ hy + exact this (mem_range_self x) + · have := cap.isEmbedding.injective hzx + exact hx (this ▸ sUnion_cuffs (S := S) ▸ ⟨Θ, hΘ, hz⟩) + +omit [T2Space S] in +/-- A connected surface has an interior point. If it has a cuff, then a closed disc slightly larger +than +the capping disc has a boundary point outside all capping discs. -/ +theorem nonempty_interior (hS : IsSurface S) [ConnectedSpace S] : (bd S)ᶜ.Nonempty := by + by_cases hbd : (cuffs S).Nonempty + · obtain ⟨Shat, _, ⟨cap⟩⟩ := exists_cappedSurface _ S hS inferInstance rfl + have : T2Space Shat := cap.isSurface.2.1 + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + obtain ⟨Θ, hΘ⟩ := hbd + have hfin : (cuffs S).Finite := (cuff_statement S hS).2.1 + set Δ := closure (cap.cuffDisc Θ) with hΔdef + have hΔ : IsClosedDisc Δ := cap.cuffDisc_closedDisc Θ hΘ + set W : Set Shat := (⋃ Θ' ∈ cuffs S \ {Θ}, closure (cap.cuffDisc Θ'))ᶜ with hW + have hWo : IsOpen W := ((hfin.subset sdiff_subset).isClosed_biUnion fun _ _ ↦ + isClosed_closure).isOpen_compl + have hsubW : Δ ⊆ W := by + intro x hx hxU + obtain ⟨Θ', hΘ', hxΘ'⟩ := mem_iUnion₂.mp hxU + exact disjoint_left.mp (cap.cuffDisc_disjoint Θ hΘ Θ' hΘ'.1 (Ne.symm hΘ'.2)) hx hxΘ' + obtain ⟨Δ', hΔ', hin, hsub⟩ := Surface.exists_disc_around hman hΔ (fun x _ ↦ hT.2.2 x) hWo + ((Surface.discBd_subset _).trans hsubW) + obtain ⟨p⟩ := hΔ'.isOArc_discBd + have hy := (p 1).2 + set y := (p 1).1 + have hyΔ : y ∉ Δ := fun h ↦ (hin h).2 hy + have hyW : y ∈ W := (hsub (Surface.discBd_subset _ hy)).elim (fun h ↦ absurd h hyΔ) id + have hyG : y ∈ (⋃ Θ ∈ cuffs S, closure (cap.cuffDisc Θ))ᶜ := by + intro hyU + obtain ⟨Θ', hΘ', hyΘ'⟩ := mem_iUnion₂.mp hyU + by_cases h : Θ' = Θ + · exact hyΔ (by rw [hΔdef, ← h]; exact hyΘ') + · exact hyW (mem_biUnion (show Θ' ∈ cuffs S \ {Θ} from ⟨hΘ', h⟩) hyΘ') + rw [cap.compl_eq_image] at hyG + obtain ⟨x, hx, -⟩ := hyG + exact ⟨x, hx⟩ + · obtain ⟨x⟩ : Nonempty S := inferInstance + refine ⟨x, fun hx ↦ hbd ?_⟩ + rw [← sUnion_cuffs] at hx + obtain ⟨Θ, hΘ, -⟩ := hx + exact ⟨Θ, hΘ⟩ + +omit [T2Space S] in +/-- **The interior of a connected surface is connected.** -/ +theorem isConnected_interior (hS : IsSurface S) [ConnectedSpace S] : IsConnected (bd S)ᶜ := by + obtain ⟨Shat, _, ⟨cap⟩⟩ := exists_cappedSurface _ S hS inferInstance rfl + have : T2Space Shat := cap.isSurface.2.1 + have h := (cap.isPreconnected_compl (cuff_statement S hS).2.1 subset_rfl).2 + rw [cap.compl_eq_image, cap.isEmbedding.isInducing.isPreconnected_image] at h + exact ⟨nonempty_interior hS, h⟩ + +end Interior + +section Component + +variable {S Y : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Y] [T2Space Y] + {ψ : Y → S} {F : Set S} + +omit [T2Space Y] in +/-- An interior point off the preimage of `F` maps to an interior point, since `ψ` is a +homeomorphism off +`F`. -/ +theorem bd_of_bd_cutMap [CompactSpace Y] (hψ : IsCutMap ψ F) (hF : IsClosed F) {z : Y} + (hz : z ∈ bd Y) (hzF : ψ z ∉ F) : ψ z ∈ bd S := by + intro hi + apply hz + obtain ⟨h1, h2, h3, -, -⟩ := hψ + obtain ⟨U, hU, hx, hsub, ⟨e⟩⟩ := hi.exists_subset hF.isOpen_compl hzF + have hcl : IsClosedMap ψ := h1.isClosedMap + have hbij : Function.Bijective (U.restrictPreimage ψ) := by + constructor + · rintro ⟨a, ha⟩ ⟨b, hb⟩ he + have he' : ψ a = ψ b := congrArg Subtype.val he + exact Subtype.ext (h3 (fun h => hsub ha h) (fun h => hsub hb h) he') + · rintro ⟨w, hw⟩ + obtain ⟨y, rfl⟩ := h2 w + exact ⟨⟨y, hw⟩, rfl⟩ + have hh : IsHomeomorph (U.restrictPreimage ψ) := + isHomeomorph_iff_continuous_isClosedMap_bijective.mpr ⟨h1.restrictPreimage, + hcl.restrictPreimage U, hbij⟩ + exact ⟨ψ ⁻¹' U, hU.preimage h1, hx, ⟨hh.homeomorph.trans e⟩⟩ + +omit [T2Space Y] in +theorem isInteriorPoint_image [CompactSpace Y] (hψ : IsCutMap ψ F) (hF : IsClosed F) {z : Y} + (hz : IsInteriorPoint z) (hzF : ψ z ∉ F) : IsInteriorPoint (ψ z) := by + obtain ⟨U, hU, hx, hsub, ⟨e⟩⟩ := hz.exists_subset (hF.isOpen_compl.preimage hψ.1) hzF + have hV : IsOpen (ψ '' U) := isOpen_image_of_isCutMap hψ hsub hU + have hpre : ψ ⁻¹' (ψ '' U) = U := by + ext y + constructor + · rintro ⟨u, hu, huy⟩ + by_cases hyF : ψ y ∈ F + · exact absurd (huy ▸ hyF) (hsub hu) + · exact hψ.2.2.1 (hsub hu) hyF huy ▸ hu + · exact fun hy ↦ mem_image_of_mem ψ hy + have hbij : Function.Bijective ((ψ '' U).restrictPreimage ψ) := by + constructor + · rintro ⟨a, ha⟩ ⟨b, hb⟩ he + have he' : ψ a = ψ b := congrArg Subtype.val he + have ha' : a ∈ U := hpre ▸ ha + have hb' : b ∈ U := hpre ▸ hb + exact Subtype.ext (hψ.2.2.1 (hsub ha') (hsub hb') he') + · rintro ⟨_, a, ha, rfl⟩ + exact ⟨⟨a, mem_image_of_mem ψ ha⟩, rfl⟩ + have hh : IsHomeomorph ((ψ '' U).restrictPreimage ψ) := + isHomeomorph_iff_continuous_isClosedMap_bijective.mpr + ⟨hψ.1.restrictPreimage, (isClosedMap_of_isCutMap hψ).restrictPreimage _, hbij⟩ + exact ⟨ψ '' U, hV, mem_image_of_mem ψ hx, + ⟨hh.homeomorph.symm.trans ((Homeomorph.setCongr hpre).trans e)⟩⟩ + +omit [T2Space Y] in +/-- **A component of a cut surface is a fragment.** -/ +theorem isCuttingFragment_of_cut (_hS : IsSurface S) (hY : IsSurface Y) + (hψ : IsCutMap ψ F) {K : Drawing S} + (hK : K.U = F) (y : Y) : + IsCuttingFragment S K (connectedComponent y) (fun x ↦ ψ x.1) := by + have hF : IsClosed F := hK ▸ K.isClosed_U + have : CompactSpace Y := hY.1 + have : LocallyConnectedSpace Y := IsSurface.locallyConnected hY + have hWo : IsOpen (connectedComponent y) := isOpen_connectedComponent + have hWc : IsClopen (connectedComponent y) := ⟨isClosed_connectedComponent, hWo⟩ + have hbdW : ∀ {x : connectedComponent y}, x ∈ bd (connectedComponent y) ↔ x.1 ∈ bd Y := + mem_bd_sub hWo + have hoff : ∀ {x : Y}, x ∉ bd Y → ψ x ∉ F := fun hx hxF ↦ hx (hψ.2.2.2.2 hxF) + have hint : ∀ {x : Y}, x ∉ bd Y → ψ x ∉ bd S := by + intro x hx + have hxi : IsInteriorPoint x := by + by_contra hn + exact hx hn + exact fun hb ↦ hb (isInteriorPoint_image hψ hF hxi (hoff hx)) + have hbdmap : ∀ {x : Y}, x ∈ bd Y → ψ x ∈ bd S ∪ K.U := by + intro x hx + by_cases hxF : ψ x ∈ F + · exact Or.inr (hK ▸ hxF) + · exact Or.inl (bd_of_bd_cutMap hψ hF hx hxF) + have hconn : ConnectedSpace (connectedComponent y) := + isConnected_iff_connectedSpace.mp isConnected_connectedComponent + have hsurf : IsSurface (connectedComponent y) := isSurface_sub hY hWc + have hdis : Disjoint ((fun x : connectedComponent y ↦ ψ x.1) '' (bd (connectedComponent y))ᶜ) + (bd S ∪ K.U) := by + refine disjoint_left.mpr ?_ + rintro _ ⟨x, hx, rfl⟩ (hb | hKU) + · exact hint (fun h ↦ hx (hbdW.mpr h)) hb + · exact hoff (fun h ↦ hx (hbdW.mpr h)) (hK ▸ hKU) + have hcont : Continuous fun x : connectedComponent y ↦ ψ x.1 := + hψ.1.comp continuous_subtype_val + refine ⟨hsurf, hconn, hcont, ?_, ?_, hdis, ?_, ?_⟩ + · intro a ha b hb hab + exact Subtype.ext (hψ.2.2.1 (hoff fun h ↦ ha (hbdW.mpr h)) (hoff fun h ↦ hb (hbdW.mpr h)) hab) + · intro v + have hfin : (ψ ⁻¹' {v}).Finite := hψ.2.2.2.1 v + exact Set.Finite.of_finite_image (f := Subtype.val) (hfin.subset (by + rintro _ ⟨x, hx, rfl⟩ + exact hx)) Subtype.val_injective.injOn + · rintro _ ⟨x, hx, rfl⟩ + exact hbdmap (hbdW.mp hx) + · -- The image of the interior is connected, and it is open and closed in the complement. + set R := (fun x : connectedComponent y ↦ ψ x.1) '' (bd (connectedComponent y))ᶜ with hRdef + obtain ⟨z, hz⟩ := nonempty_interior hsurf + have hzZ : ψ z.1 ∈ (bd S ∪ K.U)ᶜ := fun h ↦ + disjoint_left.mp hdis (mem_image_of_mem _ hz) h + have hRc : IsPreconnected R := (isConnected_interior hsurf).isPreconnected.image _ + hcont.continuousOn + have hRsub : R ⊆ (bd S ∪ K.U)ᶜ := fun x hx h ↦ disjoint_left.mp hdis hx h + have hRo : IsOpen R := by + have hset : R = ψ '' (Subtype.val '' (bd (connectedComponent y))ᶜ) := by + rw [hRdef, image_image] + rw [hset] + refine isOpen_image_of_isCutMap hψ ?_ ?_ + · rintro _ ⟨x, hx, rfl⟩ + exact hoff fun h ↦ hx (hbdW.mpr h) + · exact hWo.isOpenMap_subtype_val _ (cuff_statement _ hsurf).1.isOpen_compl + have hRcl : closure R ∩ (bd S ∪ K.U)ᶜ ⊆ R := by + rintro w ⟨hw, hwZ⟩ + have himg : IsClosed (ψ '' connectedComponent y) := + isClosedMap_of_isCutMap hψ _ isClosed_connectedComponent + have hRW : R ⊆ ψ '' connectedComponent y := by + rintro _ ⟨x, -, rfl⟩ + exact mem_image_of_mem ψ x.2 + obtain ⟨a, ha, rfl⟩ := closure_minimal hRW himg hw + exact ⟨⟨a, ha⟩, fun hb ↦ hwZ (hbdmap (hbdW.mp hb)), rfl⟩ + refine ⟨ψ z.1, hzZ, ?_⟩ + apply Subset.antisymm + · have hcomp := isPreconnected_connectedComponentIn (F := (bd S ∪ K.U)ᶜ) (x := ψ z.1) + refine hcomp.subset_left_of_subset_union hRo isClosed_closure.isOpen_compl + (disjoint_left.mpr fun w hw hn ↦ hn (subset_closure hw)) (fun x hx ↦ ?_) + ⟨ψ z.1, mem_connectedComponentIn hzZ, mem_image_of_mem _ hz⟩ + by_cases hxc : x ∈ closure R + · exact Or.inl (hRcl ⟨hxc, connectedComponentIn_subset _ _ hx⟩) + · exact Or.inr hxc + · exact hRc.subset_connectedComponentIn (mem_image_of_mem _ hz) hRsub + +end Component + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CutMap.lean b/LeanPool/GraphMinor/GM19/CutMap.lean new file mode 100644 index 0000000000..171669c97e --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CutMap.lean @@ -0,0 +1,102 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.TopologyStatements + +/-! +# The map of a cutting + +Sections 5, 10, 11 and 14 of Graph Minors XIX cut a surface along an arc `F` and pull a painting +back +along the associated surjection `ψ`. This file has the facts about `ψ` that do not depend on the +painting. On compact Hausdorff spaces `ψ` is a closed map. It is a homeomorphism off `F` +(`isOpen_image_of_isCutMap`, `isPreconnected_preimage_of_isCutMap`). A set `A` off `F` that is +connected near a point `v` of +`F` comes to `v` from one side only, so the closure of its lift has one point over `v` +(`eq_of_mem_closure_preimage_of_isCutMap`). This last fact is why an edge of a painting lifts to an +edge. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S' S : Type u} [TopologicalSpace S'] [TopologicalSpace S] [CompactSpace S'] [T2Space S] + {ψ : S' → S} {F : Set S} + +/-- A map that undoes a cut along `F`. It is one to one off `F`, and over `F` it has finite fibres, +and the +lift of `F` lies in the boundary. Unlike `IsCutting`, it allows more than two points over a point of +`F`, which +happens at a vertex of `F` of degree three, or where `F` touches the boundary. -/ +def IsCutMap {S' S : Type u} [TopologicalSpace S'] [TopologicalSpace S] (ψ : S' → S) + (F : Set S) : Prop := + Continuous ψ ∧ Function.Surjective ψ ∧ InjOn ψ (ψ ⁻¹' Fᶜ) ∧ (∀ x, (ψ ⁻¹' {x}).Finite) + ∧ ψ ⁻¹' F ⊆ bd S' + +omit [CompactSpace S'] [T2Space S] in +theorem IsCutting.isCutMap (h : IsCutting ψ F) : IsCutMap ψ F := by + refine ⟨h.1, h.2.1, h.2.2.1, fun x ↦ ?_, h.2.2.2.2⟩ + by_cases hx : x ∈ F + · exact finite_of_ncard_ne_zero (by rw [h.2.2.2.1 x hx]; norm_num) + · refine Set.Subsingleton.finite fun a ha b hb ↦ ?_ + exact h.2.2.1 (show ψ a ∈ Fᶜ by rw [ha]; exact hx) (show ψ b ∈ Fᶜ by rw [hb]; exact hx) + (ha.trans hb.symm) + +/-- A cutting map is a closed map, since `S'` is compact and `S` is Hausdorff. -/ +theorem isClosedMap_of_isCutMap (h : IsCutMap ψ F) : IsClosedMap ψ := + h.1.isClosedMap + +omit [CompactSpace S'] [T2Space S] in +/-- Over a set off `F`, the preimage and the image of a part of it determine each other. -/ +theorem image_compl_of_isCutMap (h : IsCutMap ψ F) {W : Set S'} (hW : W ⊆ ψ ⁻¹' Fᶜ) : + ψ '' Wᶜ = (ψ '' W)ᶜ := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ ⟨u, hu, hxu⟩ + have hyF : ψ x ∉ F := hxu ▸ hW hu + exact hx (h.2.2.1 hyF (hW hu) hxu.symm ▸ hu) + · intro hy + obtain ⟨x, rfl⟩ := h.2.1 y + exact ⟨x, fun hx ↦ hy (mem_image_of_mem ψ hx), rfl⟩ + +/-- `ψ` maps open sets off `F` to open sets. -/ +theorem isOpen_image_of_isCutMap (h : IsCutMap ψ F) {W : Set S'} (hW : W ⊆ ψ ⁻¹' Fᶜ) + (hWo : IsOpen W) : IsOpen (ψ '' W) := by + rw [← isClosed_compl_iff, ← image_compl_of_isCutMap h hW] + exact isClosedMap_of_isCutMap h _ hWo.isClosed_compl + +/-- The lift of a preconnected set off the closed set `F` is preconnected, since `ψ` is a +homeomorphism +off `F`. -/ +theorem isPreconnected_preimage_of_isCutMap (h : IsCutMap ψ F) (hF : IsClosed F) {A : Set S} + (hA : A ⊆ Fᶜ) (hAc : IsPreconnected A) : IsPreconnected (ψ ⁻¹' A) := by + have hoffo : IsOpen (ψ ⁻¹' Fᶜ) := hF.isOpen_compl.preimage h.1 + intro U V hU hV hcov hUn hVn + have hU' := isOpen_image_of_isCutMap h (W := U ∩ ψ ⁻¹' Fᶜ) inter_subset_right (hU.inter hoffo) + have hV' := isOpen_image_of_isCutMap h (W := V ∩ ψ ⁻¹' Fᶜ) inter_subset_right (hV.inter hoffo) + have hcov' : A ⊆ ψ '' (U ∩ ψ ⁻¹' Fᶜ) ∪ ψ '' (V ∩ ψ ⁻¹' Fᶜ) := by + intro y hy + obtain ⟨x, rfl⟩ := h.2.1 y + rcases hcov hy with hx | hx + · exact Or.inl ⟨x, ⟨hx, hA hy⟩, rfl⟩ + · exact Or.inr ⟨x, ⟨hx, hA hy⟩, rfl⟩ + obtain ⟨u, huP, huU⟩ := hUn + obtain ⟨v, hvP, hvV⟩ := hVn + obtain ⟨y, hyA, ⟨a, ⟨haU, hao⟩, rfl⟩, ⟨b, ⟨hbV, hbo⟩, hba⟩⟩ := hAc _ _ hU' hV' hcov' + ⟨ψ u, huP, u, ⟨huU, hA huP⟩, rfl⟩ ⟨ψ v, hvP, v, ⟨hvV, hA hvP⟩, rfl⟩ + have hab : b = a := h.2.2.1 hbo hao hba + exact ⟨a, hyA, haU, hab ▸ hbV⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/CutTwo.lean b/LeanPool/GraphMinor/GM19/CutTwo.lean new file mode 100644 index 0000000000..9a77ac314d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/CutTwo.lean @@ -0,0 +1,410 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.CutFragment +public import LeanPool.GraphMinor.GM19.PullPainting +public import LeanPool.GraphMinor.GM19.Section5a +public import LeanPool.GraphMinor.GM19.Section5c +public import LeanPool.GraphMinor.GM19.CutDrawing3 +public import LeanPool.GraphMinor.GM11.OArcCircuit +public import LeanPool.GraphMinor.GM11.Ties +public import LeanPool.GraphMinor.Surface.CutIArc +public import LeanPool.GraphMinor.Surface.CutOArc + +/-! +# Each cuff of a fragment has two vertices + +The pull-back of a painting needs that each cuff of the fragment has two points of `ψ⁻¹(V(Γ) ∪ +V(K))` +(`PullData.two`). Take a cuff with at most one such point. Off that point `ψ` is one to one, and it +maps the +rest of the cuff into one open edge of `K` or into `bd(Σ)`. So `ψ` embeds the cuff in a line, which +cannot be, +or onto a cuff of `Σ`, which has two vertices of `Γ`. The cut along `K` is `exists_cut_drawing`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S Y : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Y] [T2Space Y] + {ψ : Y → S} {F : Set S} + +/-- Over one edge of `K`, a compact connected set of the cut surface lies on one sheet. -/ +def HasSheets (ψ : Y → S) (K : Drawing S) : Prop := + ∀ e ∈ arcComponentsIn (K.U \ K.V), ∀ J : Set Y, IsCompact J → IsPreconnected J → ψ '' J ⊆ e + → InjOn ψ J + +/-- An `O`-arc with one point off a closed set lies in that closed set. -/ +theorem subset_of_sdiff_singleton {Z B : Set S} (hZ : IsOArc Z) (hB : IsClosed B) {w : S} + (h : Z \ {w} ⊆ B) : + Z ⊆ B := by + intro x hx + by_contra hxB + obtain rfl : x = w := by + by_contra hne + exact hxB (h ⟨hx, hne⟩) + obtain ⟨y, hy, hyx⟩ := hZ.exists_ne x + obtain ⟨z, -, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp hZ.isPreconnected B {x} hB + isClosed_singleton + (fun u hu ↦ by + by_cases hux : u = x + · exact Or.inr hux + · exact Or.inl (h ⟨hu, hux⟩)) + ⟨y, hy, h ⟨hy, hyx⟩⟩ ⟨x, hx, rfl⟩ + exact hxB (show x ∈ B from (show z = x from hz₂) ▸ hz₁) + +theorem isPathConnected_of_line {T : Type*} [TopologicalSpace T] {L : Set T} {u v : T} + (h : IsLineWithEnds L u v) : IsPathConnected L := by + obtain ⟨a, ha, rfl, -, -⟩ := h.exists_arc + exact isPathConnected_range ha.1 + +/-- **Two vertices on each cuff.** Let `ψ` be one to one off `U(K)`, map the boundary into `bd(Σ) ∪ +U(K)` and +have sheets over the edges of `K`. If each cuff of `Σ` has two points of `A`, and `A` holds `V(K)` +and +`U(K) ∩ bd(Σ)`, then each cuff of `S₁` has two points over `A`. -/ +theorem two_of_sheets {S₁ : Type} [TopologicalSpace S₁] [T2Space S₁] {ψ : S₁ + → S} {K : Drawing S} {A : Set S} + (hS : IsSurface S) (hS₁ : IsSurface S₁) (hc : Continuous ψ) (hinj : InjOn ψ (ψ ⁻¹' K.Uᶜ)) + (hmaps : ψ '' bd S₁ ⊆ bd S ∪ K.U) (hsheet : HasSheets ψ K) + (hlines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, IsLineWithEnds (closure e) u v) + (hKbd : K.U ∩ bd S ⊆ K.V) (hKA : K.V ⊆ A) + (hA : ∀ C : cuffs S, ∃ p ∈ A ∩ C.1, ∃ q ∈ A ∩ C.1, p ≠ q) (C : cuffs S₁) : + ∃ p ∈ ψ ⁻¹' A ∩ C.1, ∃ q ∈ ψ ⁻¹' A ∩ C.1, p ≠ q := by + classical + by_contra hnc + have hno : ∀ p, ψ p ∈ A → p ∈ C.1 → ∀ q, ψ q ∈ A → q ∈ C.1 → p ≠ q → False := + fun p hp hpC q hq hqC hne ↦ hnc ⟨p, ⟨hp, hpC⟩, q, ⟨hq, hqC⟩, hne⟩ + have hOC : IsOArc C.1 := (cuff_statement S₁ hS₁).2.2 C.1 C.2 + have : Nonempty S₁ := by + obtain ⟨a, -, -, -, -, -, -, -, -⟩ := hOC.exists_three + exact ⟨a⟩ + have hCb : C.1 ⊆ bd S₁ := cuff_subset_bd C + have hbd : IsClosed (bd S) := (cuff_statement S hS).1 + let O : Set S₁ := C.1 \ ψ ⁻¹' A + have hO : ∀ x ∈ O, ψ x ∈ (bd S ∪ K.U) \ A := fun x hx ↦ ⟨hmaps (mem_image_of_mem ψ + (hCb hx.1)), hx.2⟩ + -- any two points of `O` lie on a path in `O` + have hJ : ∀ x ∈ O, ∀ y ∈ O, ∃ J ⊆ O, x ∈ J ∧ y ∈ J ∧ IsCompact J ∧ IsPathConnected J := by + intro x hx y hy + by_cases hxy : x = y + · subst hxy + exact ⟨{x}, singleton_subset_iff.mpr hx, rfl, rfl, isCompact_singleton, + isPathConnected_singleton x⟩ + obtain ⟨L₁, L₂, h₁, h₂, hun, hin⟩ := hOC.lines hx.1 hy.1 hxy + have hsubC₁ : L₁ ⊆ C.1 := hun ▸ subset_union_left + have hsubC₂ : L₂ ⊆ C.1 := hun ▸ subset_union_right + by_cases hL : L₁ ⊆ O + · exact ⟨L₁, hL, h₁.left_mem, h₁.right_mem, h₁.isCompact, isPathConnected_of_line h₁⟩ + obtain ⟨p, hp₁, hpO⟩ := not_subset.mp hL + have hpA : p ∈ ψ ⁻¹' A ∩ C.1 := by + by_contra hn + exact hpO ⟨hsubC₁ hp₁, fun hpa ↦ hn ⟨hpa, hsubC₁ hp₁⟩⟩ + refine ⟨L₂, ?_, h₂.left_mem, h₂.right_mem, h₂.isCompact, isPathConnected_of_line h₂⟩ + intro q hq + refine ⟨hsubC₂ hq, fun hqA ↦ ?_⟩ + have hpq : p = q := by + by_contra hne + exact hno p hpA.1 hpA.2 q hqA (hsubC₂ hq) hne + subst hpq + have : p ∈ L₁ ∩ L₂ := ⟨hp₁, hq⟩ + rw [hin] at this + rcases this with rfl | rfl + · exact hx.2 hqA + · exact hy.2 hqA + -- a path in `O` stays on `bd(Σ)` or stays on one edge of `K` + have hside : ∀ J ⊆ O, IsPathConnected J → ψ '' J ⊆ bd S ∨ ∃ e ∈ arcComponentsIn + (K.U \ K.V), ψ '' J ⊆ e := by + intro J hJO hJc + have hIc : IsPathConnected (ψ '' J) := hJc.image hc + obtain ⟨_, w, hw, rfl⟩ := hIc.nonempty + have hcov : ψ '' J ⊆ bd S ∪ K.U := by + rintro _ ⟨x, hx, rfl⟩ + exact (hO x (hJO hx)).1 + by_cases hb : ψ '' J ⊆ bd S + · exact Or.inl hb + have hKsub : ψ '' J ⊆ K.U := by + obtain ⟨_, ⟨u, hu, rfl⟩, hub⟩ := not_subset.mp hb + by_contra hk + obtain ⟨_, ⟨v, hv, rfl⟩, hvk⟩ := not_subset.mp hk + obtain ⟨z, ⟨x, hx, rfl⟩, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp + hIc.isConnected.isPreconnected + (bd S) K.U hbd K.isClosed_U hcov + ⟨ψ v, mem_image_of_mem ψ hv, (hcov (mem_image_of_mem ψ hv)).resolve_right hvk⟩ + ⟨ψ u, mem_image_of_mem ψ hu, (hcov (mem_image_of_mem ψ hu)).resolve_left hub⟩ + exact (hO x (hJO hx)).2 (hKA (hKbd ⟨hz₂, hz₁⟩)) + refine Or.inr ?_ + obtain ⟨e, he, hsub⟩ := exists_arcComp_superset hIc (F := K.U \ K.V) (by + rintro _ ⟨x, hx, rfl⟩ + exact ⟨hKsub (mem_image_of_mem ψ hx), fun hv ↦ (hO x (hJO hx)).2 (hKA hv)⟩) + exact ⟨e, he, hsub⟩ + have hinjO : InjOn ψ O := by + intro x hx y hy he + obtain ⟨J, hJO, hxJ, hyJ, hJc, hJp⟩ := hJ x hx y hy + rcases hside J hJO hJp with hb | ⟨e, he', hsub⟩ + · have hoff : ∀ {z}, z ∈ J → z ∈ ψ ⁻¹' K.Uᶜ := fun {z} hz hk ↦ + (hO z (hJO hz)).2 (hKA (hKbd ⟨hk, hb (mem_image_of_mem ψ hz)⟩)) + exact hinj (hoff hxJ) (hoff hyJ) he + · exact hsheet e he' J hJc hJp.isConnected.isPreconnected hsub hxJ hyJ he + have hinjC : InjOn ψ C.1 := by + intro x hx y hy he + by_cases hxA : ψ x ∈ A + · by_contra hne + exact hno x hxA hx y (he ▸ hxA) hy hne + · exact hinjO ⟨hx, hxA⟩ ⟨hy, fun h ↦ hxA (he ▸ h)⟩ he + obtain ⟨ρ, hρ, hl⟩ := exists_inv_of_compactOn hOC.isCompact hc.continuousOn hinjC + have hZ : IsOArc (ψ '' C.1) := hOC.image hc.continuousOn hρ fun x hx ↦ hl hx + -- the part of `C` off `A` misses at most one point + obtain ⟨x₀, hx₀⟩ : O.Nonempty := by + obtain ⟨a, b, d, ha, hb, hd, hab, had, hbd'⟩ := hOC.exists_three + by_contra hemp + have hall : ∀ {z}, z ∈ C.1 → ψ z ∈ A := fun {z} hz ↦ by + by_contra hn + exact hemp ⟨z, hz, hn⟩ + exact hno a (hall ha) ha b (hall hb) hb hab + have hmiss : ∃ w, ψ '' C.1 \ {w} ⊆ ψ '' O := by + by_cases hP : ∃ p ∈ C.1, ψ p ∈ A + · obtain ⟨p, hp, hpA⟩ := hP + refine ⟨ψ p, ?_⟩ + rintro _ ⟨⟨x, hx, rfl⟩, hne⟩ + refine ⟨x, ⟨hx, fun hxA ↦ hne ?_⟩, rfl⟩ + have : x = p := by + by_contra hn + exact hno x hxA hx p hpA hp hn + rw [this] + rfl + · push Not at hP + refine ⟨ψ x₀, ?_⟩ + rintro _ ⟨⟨x, hx, rfl⟩, -⟩ + exact ⟨x, ⟨hx, hP x hx⟩, rfl⟩ + obtain ⟨w, hw⟩ := hmiss + -- all of `O` is on one side + have hallside : ψ '' O ⊆ bd S ∨ ∃ e ∈ arcComponentsIn (K.U \ K.V), ψ '' O ⊆ e := by + by_cases hb0 : ψ x₀ ∈ bd S + · refine Or.inl ?_ + rintro _ ⟨y, hy, rfl⟩ + obtain ⟨J, hJO, hxJ, hyJ, -, hJp⟩ := hJ x₀ hx₀ y hy + rcases hside J hJO hJp with hb | ⟨e, he, hsub⟩ + · exact hb (mem_image_of_mem ψ hyJ) + · exact absurd (hKbd ⟨he.2.1 (hsub (mem_image_of_mem ψ hxJ)) |>.1, hb0⟩) + (he.2.1 (hsub (mem_image_of_mem ψ hxJ))).2 + · have hK0 : ψ x₀ ∈ K.U \ K.V := + ⟨(hO x₀ hx₀).1.resolve_left hb0, fun hv ↦ (hO x₀ hx₀).2 (hKA hv)⟩ + obtain ⟨e, he, hxe⟩ : ∃ e ∈ arcComponentsIn (K.U \ K.V), ψ x₀ ∈ e := + ⟨_, Surface.mem_arcComponentsIn_of_mem hK0, mem_pathComponentIn_self hK0⟩ + refine Or.inr ⟨e, he, ?_⟩ + rintro _ ⟨y, hy, rfl⟩ + obtain ⟨J, hJO, hxJ, hyJ, -, hJp⟩ := hJ x₀ hx₀ y hy + rcases hside J hJO hJp with hb | ⟨e', he', hsub⟩ + · exact absurd (hb (mem_image_of_mem ψ hxJ)) hb0 + · obtain rfl : e = e' := arcComp_eq_of_mem he he' hxe (hsub (mem_image_of_mem ψ hxJ)) + exact hsub (mem_image_of_mem ψ hyJ) + rcases hallside with hb | ⟨e, he, hsub⟩ + · have hZb : ψ '' C.1 ⊆ bd S := subset_of_sdiff_singleton hZ hbd (hw.trans hb) + have hZc : IsPreconnected (ψ '' C.1) := hZ.isPreconnected + obtain ⟨z, hz⟩ : (ψ '' C.1).Nonempty := ⟨ψ x₀, mem_image_of_mem ψ hx₀.1⟩ + let Θ : cuffs S := ⟨connectedComponentIn (bd S) z, z, hZb hz, rfl⟩ + have hsubΘ : ψ '' C.1 ⊆ Θ.1 := hZc.subset_connectedComponentIn hz hZb + have hΘ : ψ '' C.1 = Θ.1 := GM11.eq_of_oArc_subset hZ ((cuff_statement S hS).2.2 Θ.1 Θ.2) hsubΘ + obtain ⟨p, hp, q, hq, hpq⟩ := hA Θ + obtain ⟨p', hp', rfl⟩ : p ∈ ψ '' C.1 := hΘ ▸ hp.2 + obtain ⟨q', hq', rfl⟩ : q ∈ ψ '' C.1 := hΘ ▸ hq.2 + exact hno p' hp.1 hp' q' hq.1 hq' fun h ↦ hpq (h ▸ rfl) + · obtain ⟨u, v, hL⟩ := hlines e he + have hZL : ψ '' C.1 ⊆ closure e := + subset_of_sdiff_singleton hZ isClosed_closure (hw.trans (hsub.trans subset_closure)) + exact GM11.not_isOArc_of_subset_line ⟨hL.choose⟩ hZ hZL + +/-- Each cuff of `Σ` has two vertices of a frame: a side lies on the cuff, and it has two ends. -/ +theorem Frame.two_on_cuff (hS : IsSurface S) (Φ : Frame S) (C : cuffs S) : + ∃ p ∈ Φ.V ∩ C.1, ∃ q ∈ Φ.V ∩ C.1, p ≠ q := by + have hbd : IsClosed (bd S) := (cuff_statement S hS).1 + obtain ⟨e, he, heC⟩ := exists_side_on_cuff hbd Φ C (cuffPar hS C) + have htV : tilde e ⊆ Φ.V := (Φ.toPainting hbd).tilde_subset_V he + have htC : tilde e ⊆ C.1 := fun x hx ↦ closure_minimal heC (isClosed_cuff hS C) hx.1 + obtain ⟨p, q, hpq, heq⟩ := Set.ncard_eq_two.mp (Φ.side_shape e he).1 + have hp : p ∈ tilde e := heq ▸ mem_insert _ _ + have hq : q ∈ tilde e := heq ▸ mem_insert_of_mem _ rfl + exact ⟨p, ⟨htV hp, htC hp⟩, q, ⟨htV hq, htC hq⟩, hpq⟩ + +/-- An edge of a drawing with two ends is its closure without the ends. -/ +theorem closure_sdiff_subset {K : Drawing S} {e : Set S} (he : e ∈ arcComponentsIn + (K.U \ K.V)) {u v : S} + (hcap : closure e ∩ K.V = {u, v}) (hL : IsLineWithEnds (closure e) u v) : closure e \ K.V ⊆ e + := by + have hsubU : closure e ⊆ K.U := closure_minimal (he.2.1.trans sdiff_subset) K.isClosed_U + have hoff : closure e \ {u, v} ⊆ K.U \ K.V := fun x hx ↦ + ⟨hsubU hx.1, fun hv ↦ hx.2 (hcap ▸ ⟨hx.1, hv⟩)⟩ + have hsub : e ⊆ closure e \ {u, v} := fun x hx ↦ ⟨subset_closure hx, fun hxc ↦ + (he.2.1 hx).2 ((hcap ▸ hxc : x ∈ closure e ∩ K.V).2)⟩ + have heq : closure e \ {u, v} = e := he.2.2.2 _ hoff (GM20.line_facts hL).2.1 hsub + rintro x ⟨hx, hxV⟩ + rw [← heq] + exact ⟨hx, fun hxc ↦ hxV ((hcap ▸ hxc : x ∈ closure e ∩ K.V).2)⟩ + +/-- **Cutting along a drawing.** The edges of `K` are lines, the drawing meets the boundary only in +vertices, +and no vertex is isolated. The sets `𝓐`, `𝓛` say how `K` and the cuffs are built from `O`-arcs and +lines. -/ +theorem exists_cut_drawing (hS : IsSurface S) [ConnectedSpace S] {K : Drawing S} {𝓐 𝓛 : Set (Set S)} + (hlines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} ∧ + IsLineWithEnds (closure e) u v) + (hKbd : K.U ∩ bd S ⊆ K.V) (hKne : K.V ⊆ ⋃ e ∈ arcComponentsIn (K.U \ K.V), closure e) + (hF : IsCutFrame S 𝓐 𝓛) (hc : bd S ∪ K.U = ⋃₀ 𝓐 ∪ ⋃₀ 𝓛) : + ∃ (Y : Type) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S), IsSurface Y ∧ IsCutMap ψ K.U + ∧ + HasSheets ψ K := by + classical + let 𝓔 : Set (Set S) := closure '' arcComponentsIn (K.U \ K.V) + have hsubU : ∀ e ∈ arcComponentsIn (K.U \ K.V), closure e ⊆ K.U := fun e he ↦ + closure_minimal (he.2.1.trans sdiff_subset) K.isClosed_U + have hUeq : ⋃₀ 𝓔 = K.U := by + apply subset_antisymm + · rintro x ⟨_, ⟨e, he, rfl⟩, hx⟩ + exact hsubU e he hx + · intro x hx + by_cases hxV : x ∈ K.V + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp (hKne hxV) + exact ⟨_, ⟨e, he, rfl⟩, hxe⟩ + · have hm : x ∈ K.U \ K.V := ⟨hx, hxV⟩ + exact ⟨_, ⟨_, Surface.mem_arcComponentsIn_of_mem hm, rfl⟩, + subset_closure (mem_pathComponentIn_self hm)⟩ + have hNs : K.V ⊆ ⋃₀ 𝓔 := hUeq ▸ K.V_subset_U + obtain ⟨Y, tY, t2, ψ, h1, h2, h3, h4, h5, h6, hlift⟩ := exists_cut_lines hS K.finite_V + (K.finite_edges.image _) + (by + rintro _ ⟨e, he, rfl⟩ + obtain ⟨u, v, huv, hcap, hL⟩ := hlines e he + exact ⟨u, v, huv, hL, hcap⟩) + (by + rintro _ ⟨e, he, rfl⟩ _ ⟨e', he', rfl⟩ hne x ⟨hx, hx'⟩ + by_contra hxV + obtain ⟨u, v, -, hcap, hL⟩ := hlines e he + obtain ⟨u', v', -, hcap', hL'⟩ := hlines e' he' + have h₁ := closure_sdiff_subset he hcap hL ⟨hx, hxV⟩ + have h₂ := closure_sdiff_subset he' hcap' hL' ⟨hx', hxV⟩ + exact hne (congrArg closure (arcComp_eq_of_mem he he' h₁ h₂))) + (by + rintro _ ⟨e, he, rfl⟩ x ⟨hx, hb⟩ + exact hKbd ⟨hsubU e he hx, hb⟩) + hNs hF (by rw [hUeq]; exact hc) + rw [hUeq] at h4 h6 + have : CompactSpace Y := h1.1 + refine ⟨Y, tY, t2, ψ, h1, ⟨h2, h3, h4, h5, h6⟩, ?_⟩ + intro e he J hJc hJp hsub + obtain ⟨u, v, -, hcap, hL⟩ := hlines e he + have hQ : ψ '' J ⊆ closure e \ K.V := fun x hx ↦ + ⟨subset_closure (hsub hx), fun hv ↦ (he.2.1 (hsub hx)).2 hv⟩ + obtain ⟨L', -, hQL, -, -, X, X', x0, x1, y0, y1, hX, hX', hdis, hun, hbX, hbX', -⟩ := + hlift _ ⟨e, he, rfl⟩ _ hQ (hJc.image h2) + have hJsub : J ⊆ X ∪ X' := fun z hz ↦ hun ▸ hQL (mem_image_of_mem ψ hz) + by_cases hJX : J ⊆ X + · exact hbX.injOn.mono hJX + by_cases hJX' : J ⊆ X' + · exact hbX'.injOn.mono hJX' + exfalso + obtain ⟨a, ha, haX⟩ := not_subset.mp hJX + obtain ⟨b, hb, hbX''⟩ := not_subset.mp hJX' + obtain ⟨z, -, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp hJp X X' hX.isCompact.isClosed + hX'.isCompact.isClosed + hJsub ⟨b, hb, (hJsub hb).resolve_right hbX''⟩ ⟨a, ha, (hJsub ha).resolve_left haX⟩ + exact disjoint_left.mp hdis hz₁ hz₂ + +/-- On each cuff of a fragment of a cut, two points lie over `A`, if `A` holds `V(K)` and two points +of each cuff of +`Σ`. -/ +theorem two_of_cut (hS : IsSurface S) {Y : Type} [TopologicalSpace Y] [T2Space Y] {ψ : Y + → S} {K : Drawing S} + {A : Set S} (hY : IsSurface Y) (hψ : IsCutMap ψ K.U) (hsheet : HasSheets ψ K) + (hlines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} ∧ + IsLineWithEnds (closure e) u v) + (hKbd : K.U ∩ bd S ⊆ K.V) (hKA : K.V ⊆ A) (hA : ∀ C : cuffs S, ∃ p ∈ A ∩ C.1, ∃ q ∈ A ∩ C.1, p + ≠ q) (y : Y) + (C : cuffs (connectedComponent y)) : + ∃ p ∈ (fun x : connectedComponent y ↦ ψ x.1) ⁻¹' A ∩ C.1, + ∃ q ∈ (fun x : connectedComponent y ↦ ψ x.1) ⁻¹' A ∩ C.1, p ≠ q := by + have hfrag := isCuttingFragment_of_cut hS hY hψ (K := K) rfl y + refine two_of_sheets hS hfrag.isSurface hfrag.continuous_ψ ?_ hfrag.maps_bd ?_ ?_ hKbd hKA hA C + · intro a ha b hb hab + exact Subtype.ext (hψ.2.2.1 ha hb hab) + · intro e he J hJc hJp hsub a ha b hb hab + refine Subtype.ext (hsheet e he (Subtype.val '' J) (hJc.image continuous_subtype_val) + (hJp.image _ continuous_subtype_val.continuousOn) ?_ (mem_image_of_mem _ ha) + (mem_image_of_mem _ hb) hab) + rintro _ ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + exact hsub (mem_image_of_mem _ hx) + · intro e he + obtain ⟨u, v, -, -, hL⟩ := hlines e he + exact ⟨u, v, hL⟩ + +/-- **`PullData` at a cut.** Cut a connected surface along a drawing `K` that meets `Γ` only in +common +vertices. Each component of the cut surface carries the data for the pull-back of `Γ`. The condition +`two` +holds by `two_of_sheets`, and the cuffs of `Σ` have two vertices of `Γ` because `Γ` fits a frame. -/ +theorem exists_pullData (hS : IsSurface S) [ConnectedSpace S] {Φ : Frame S} {Γ : Painting S} + (hfit : Γ.Fits Φ) + {K : Drawing S} {𝓐 𝓛 : Set (Set S)} (hinter : Γ.U ∩ K.U ⊆ Γ.V ∩ K.V) + (hlines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} ∧ + IsLineWithEnds (closure e) u v) + (hKne : K.V ⊆ ⋃ e ∈ arcComponentsIn (K.U \ K.V), closure e) (hF : IsCutFrame S 𝓐 𝓛) + (hc : bd S ∪ K.U = ⋃₀ 𝓐 ∪ ⋃₀ 𝓛) : + ∃ (Y : Type) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S), IsSurface Y ∧ IsCutMap ψ K.U + ∧ + HasSheets ψ K ∧ ∀ y : Y, PullData Γ K (fun x : connectedComponent y ↦ ψ x.1) := by + have hKbd : K.U ∩ bd S ⊆ K.V := fun x hx ↦ (hinter ⟨Γ.bd_subset hx.2, hx.1⟩).2 + obtain ⟨Y, tY, t2, ψ, hY, hψ, hsheet⟩ := exists_cut_drawing hS hlines hKbd hKne hF hc + refine ⟨Y, tY, t2, ψ, hY, hψ, hsheet, fun y ↦ ?_⟩ + have hfrag := isCuttingFragment_of_cut hS hY hψ (K := K) rfl y + refine ⟨hS, hfrag, hinter, fun C ↦ ?_⟩ + refine two_of_cut hS hY hψ hsheet hlines hKbd subset_union_right ?_ y C + intro C' + obtain ⟨p, hp, q, hq, hpq⟩ := Frame.two_on_cuff hS Φ C' + exact ⟨p, ⟨Or.inl (hfit.V_subset hp.1), hp.2⟩, q, ⟨Or.inl (hfit.V_subset hq.1), hq.2⟩, hpq⟩ + +omit [T2Space S] in +/-- The cuffs, some `O`-arcs, and lines with ends on these, make a frame for a cut. An `O`-arc may +touch a +cuff, or another `O`-arc. -/ +theorem isCutFrame_of (hS : IsSurface S) {𝓞 𝓛 : Set (Set S)} (h𝓞 : 𝓞.Finite) (h𝓛 : 𝓛.Finite) + (hO : ∀ C ∈ 𝓞, IsOArc C) + (hL : ∀ L ∈ 𝓛, ∃ s t, s ≠ t ∧ IsLineWithEnds L s t ∧ s ∈ bd S ∪ ⋃₀ 𝓞 ∧ t ∈ bd S ∪ ⋃₀ 𝓞) : + IsCutFrame S (cuffs S ∪ 𝓞) 𝓛 := by + have hc := cuff_statement S hS + refine ⟨hc.2.1.union h𝓞, h𝓛, ?_, subset_union_left, ?_⟩ + · rintro C (hC | hC) + · exact hc.2.2 C hC + · exact hO C hC + · intro L hLm + rw [sUnion_union, sUnion_cuffs] + exact hL L hLm + +/-- `exists_pullData` when `K` is a union of `O`-arcs and of lines with ends on these or on the +cuffs. This +covers each cut of XIX, for instance one `O`-arc that meets a cuff in one point. -/ +theorem exists_pullData_of_shape (hS : IsSurface S) [ConnectedSpace S] {Φ : Frame S} {Γ : Painting + S} + (hfit : Γ.Fits Φ) {K : Drawing S} {𝓞 𝓛 : Set (Set S)} (hinter : Γ.U ∩ K.U ⊆ Γ.V ∩ K.V) + (hlines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} ∧ + IsLineWithEnds (closure e) u v) + (hKne : K.V ⊆ ⋃ e ∈ arcComponentsIn (K.U \ K.V), closure e) (h𝓞 : 𝓞.Finite) (h𝓛 : 𝓛.Finite) + (hO : ∀ C ∈ 𝓞, IsOArc C) + (hL : ∀ L ∈ 𝓛, ∃ s t, s ≠ t ∧ IsLineWithEnds L s t ∧ s ∈ bd S ∪ ⋃₀ 𝓞 ∧ t ∈ bd S ∪ ⋃₀ 𝓞) + (hU : K.U = ⋃₀ 𝓞 ∪ ⋃₀ 𝓛) : + ∃ (Y : Type) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S), IsSurface Y ∧ IsCutMap ψ K.U + ∧ + HasSheets ψ K ∧ ∀ y : Y, PullData Γ K (fun x : connectedComponent y ↦ ψ x.1) := + exists_pullData hS hfit hinter hlines hKne (isCutFrame_of hS h𝓞 h𝓛 hO hL) (by + rw [hU, sUnion_union, sUnion_cuffs, union_assoc]) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Defs.lean b/LeanPool/GraphMinor/GM19/Defs.lean new file mode 100644 index 0000000000..cef8039518 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Defs.lean @@ -0,0 +1,160 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import Mathlib.Combinatorics.SimpleGraph.Connectivity.Connected + +/-! +# Definitions for Graph Minors XIX: Well-quasi-ordering on a surface + +This file formalizes the definitions that the statement of (2.1) of N. Robertson and +P. D. Seymour, *Graph Minors. XIX. Well-quasi-ordering on a surface*, J. Combin. Theory Ser. B 90 +(2004) 325–385, needs, from Section 2 (pages 327–328): paintings (`Painting`, a triple +`(U, V, γ)`), the 1-skeleton (`Painting.skAdj`), inflations (`IsInflation`), linear inflations +(`IsLinearInflation`) and internally 3-connected paintings (`Painting.IsInternallyThreeConnected`). + +It also defines orientations of a cuff and the order of points on a cuff, which Graph Minors XVII, +XIX and XX all use: an orientation is a homeomorphism from the unit circle, and "in order" and +"immediately precedes" are read through such a homeomorphism (`cuffPoint`, `InOrderOn`, +`ImmediatelyPrecedes`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-! ### Order on a cuff -/ + +/-- The point of angle `t` under a parametrization `f` of an `O`-arc `Θ` by the circle. -/ +noncomputable def cuffPoint {Θ : Set S} (f : Circle ≃ₜ Θ) (t : ℝ) : S := + (f (Circle.exp t)).1 + +/-- `n₁, n₂, n₃, n₄` occur in order on the `O`-arc `Θ` (Graph Minors XVII, Section 2, page 166: +"here and later in the paper, refers to the order of occurrence around the cuff"): for +some parametrization of `Θ` by the circle they have angles `t₁ ≤ t₂ ≤ t₃ ≤ t₄ ≤ t₁ + 2π`. -/ +def InOrderOn (Θ : Set S) (n₁ n₂ n₃ n₄ : S) : Prop := + ∃ (f : Circle ≃ₜ Θ) (t₁ t₂ t₃ t₄ : ℝ), t₁ ≤ t₂ ∧ t₂ ≤ t₃ ∧ t₃ ≤ t₄ ∧ t₄ ≤ t₁ + 2 * Real.pi ∧ + cuffPoint f t₁ = n₁ ∧ cuffPoint f t₂ = n₂ ∧ cuffPoint f t₃ = n₃ ∧ cuffPoint f t₄ = n₄ + +/-- Under the orientation of `Θ` given by `f`, the point `n` immediately precedes the open segment +`A` of `Θ` (Graph Minors XIX, Section 2, page 328; Graph Minors XX, Section 8, page 348): `A` is the +set of points of angles strictly between `t₀` and `t₁`, where `n` has angle `t₀`. -/ +def ImmediatelyPrecedes {Θ : Set S} (f : Circle ≃ₜ Θ) (n : S) (A : Set S) : Prop := + ∃ t₀ t₁ : ℝ, t₀ < t₁ ∧ t₁ ≤ t₀ + 2 * Real.pi ∧ cuffPoint f t₀ = n ∧ + A = cuffPoint f '' Ioo t₀ t₁ + +/-! ### Paintings -/ + +/-- A painting in a surface (Graph Minors XIX, Section 2, page 327): "A *painting* $\Gamma$ in +$\Sigma$ is a triple $(U, V, \gamma)$, where $U \subseteq \Sigma$ is closed and $V \subseteq U$ is +finite, such that +- $bd(\Sigma) \subseteq U$, and $U \setminus V$ has only finitely many arc-wise connected + components, called *edges*, +- for each edge $e$, either $|\tilde{e}| = 2$ and $\bar{e}$ is a line with ends the two members of + $\tilde{e}$, or $|\tilde{e}| = 3$ and $\bar{e}$ is a disc with $\tilde{e} \subseteq bd(\bar{e})$, +- $\gamma$ is a function assigning to each edge $e$ a march $\gamma(e)$ with + $\bar{\gamma}(e) = \tilde{e}$; we call the $i$th term of $\gamma(e)$ the $i$th *end* of $e$, and + the first and last terms of $\gamma(e)$ are the *tail* and *head* of $e$, +- every edge $e$ with $e \cap bd(\Sigma) \ne \emptyset$ satisfies $|\tilde{e}| = 2$ and + $e \subseteq bd(\Sigma)$." -/ +structure Painting (S : Type u) [TopologicalSpace S] where + /-- The set `U(Γ)`. -/ + U : Set S + /-- The set `V(Γ)` of vertices. -/ + V : Set S + /-- The march `γ(e)` of an edge `e`. -/ + γ : Set S → List S + isClosed_U : IsClosed U + V_subset : V ⊆ U + finite_V : V.Finite + bd_subset : bd S ⊆ U + finite_edges : (arcComponentsIn (U \ V)).Finite + edge_shape : ∀ e ∈ arcComponentsIn (U \ V), + ((tilde e).ncard = 2 ∧ (tilde e).Finite ∧ IsLine (closure e) ∧ lineEnds (closure e) = tilde e) ∨ + ((tilde e).ncard = 3 ∧ (tilde e).Finite ∧ IsClosedDisc (closure e) ∧ + tilde e ⊆ discBd (closure e)) + γ_nodup : ∀ e ∈ arcComponentsIn (U \ V), (γ e).Nodup + γ_set : ∀ e ∈ arcComponentsIn (U \ V), {v | v ∈ γ e} = tilde e + border_edge : ∀ e ∈ arcComponentsIn (U \ V), (e ∩ bd S).Nonempty → + (tilde e).ncard = 2 ∧ e ⊆ bd S + +namespace Painting + +/-- The set `E(Γ)` of edges. -/ +def E (Γ : Painting S) : Set (Set S) := arcComponentsIn (Γ.U \ Γ.V) + +/-- `e` is a border edge if `e ∩ bd(Σ) ≠ ∅` (Graph Minors XIX, Section 2, page 327). -/ +def IsBorder (e : Set S) : Prop := (e ∩ bd S).Nonempty + +/-- Two vertices are adjacent in the 1-skeleton `sk(Γ)` when they are distinct and are ends of a +common edge (Graph Minors XIX, Section 2, page 327). For a subdrawing `σ(v)` that is induced, only +its vertex set matters, so the skeleton is recorded as a simple graph. -/ +def skAdj (Γ : Painting S) : SimpleGraph S where + Adj x y := x ≠ y ∧ x ∈ Γ.V ∧ y ∈ Γ.V ∧ ∃ e ∈ Γ.E, x ∈ tilde e ∧ y ∈ tilde e + symm := ⟨fun _ _ ⟨h, hx, hy, e, he, hxe, hye⟩ ↦ ⟨h.symm, hy, hx, e, he, hye, hxe⟩⟩ + loopless := ⟨fun _ h ↦ h.1 rfl⟩ + +/-- `Γ` is internally 3-connected (Graph Minors XIX, Section 2, page 328): "$E(\Gamma) \ne +\emptyset$ and every $\Gamma$-normal $O$-arc $F \subseteq \Sigma$ with $$|F +\cap V(\Gamma)| + |F \cap bd(\Sigma)| \le 2$$ bounds a disc $\Delta \subseteq \Sigma$ with +$\Delta \cap V(\Gamma) \subseteq F$." -/ +def IsInternallyThreeConnected (Γ : Painting S) : Prop := + Γ.E.Nonempty ∧ ∀ F : Set S, IsOArc F → F ∩ Γ.U ⊆ Γ.V → (F ∩ bd S).Finite → + (F ∩ Γ.V).ncard + (F ∩ bd S).ncard ≤ 2 → + ∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F ∧ Δ ∩ Γ.V ⊆ F + +end Painting + +/-- An inflation of `Γ` in `Γ'` (Graph Minors XIX, Section 2, page 328): "a function $\sigma$ with +domain $V(\Gamma) \cup E(\Gamma)$, satisfying +- $\sigma(e) \in E(\Gamma')$ and has the same size as $e$, for each $e \in E(\Gamma)$, and if + $e_1, e_2 \in E(\Gamma)$ are distinct then $\sigma(e_1) \ne \sigma(e_2)$, +- $\sigma(v)$ is a non-null connected induced subdrawing of $sk(\Gamma')$, for each + $v \in V(\Gamma)$; and if $v_1, v_2 \in V(\Gamma)$ are distinct then $\sigma(v_1), \sigma(v_2)$ + are disjoint, +- for each $e \in E(\Gamma)$ and $1 \le i \le |\tilde{e}|$, if $v$ is the $i$th end of $e$ then + $\sigma(v)$ contains the $i$th end of $\sigma(e)$." +An induced subdrawing is given by its vertex set `σv v`. -/ +structure IsInflation (Γ Γ' : Painting S) (σv : S → Set S) (σe : Set S → Set S) : Prop where + edge_mem : ∀ e ∈ Γ.E, σe e ∈ Γ'.E + edge_size : ∀ e ∈ Γ.E, (tilde (σe e)).ncard = (tilde e).ncard + edge_injOn : InjOn σe Γ.E + vertex_nonempty : ∀ v ∈ Γ.V, (σv v).Nonempty + vertex_subset : ∀ v ∈ Γ.V, σv v ⊆ Γ'.V + vertex_connected : ∀ v ∈ Γ.V, (Γ'.skAdj.induce (σv v)).Preconnected + vertex_disjoint : ∀ v₁ ∈ Γ.V, ∀ v₂ ∈ Γ.V, v₁ ≠ v₂ → Disjoint (σv v₁) (σv v₂) + ends : ∀ e ∈ Γ.E, ∀ (i : ℕ) (hi : i < (Γ.γ e).length) (hi' : i < (Γ'.γ (σe e)).length), + (Γ'.γ (σe e))[i] ∈ σv (Γ.γ e)[i] + +/-- An inflation is linear (Graph Minors XIX, Section 2, page 328): "An inflation $\sigma$ of +$\Gamma$ in $\Gamma'$ is *linear* if +- for each $e \in E(\Gamma)$ and for each cuff $\Theta$, $e$ borders $\Theta$ if and only if + $\sigma(e)$ borders $\Theta$ (and so $e$ is internal if and only if $\sigma(e)$ is internal), +- for each border edge $e'$ of $\Gamma'$, if $e' \notin \sigma(E(\Gamma))$ then $e'$ is an edge of + $\sigma(v)$ for some $v \in V(\Gamma)$, +- for each $e \in E(\Gamma)$ bordering a cuff $\Theta$, if we orient $\Theta$ such that the tail of + $e$ immediately precedes $e$ under this orientation, then the tail of $\sigma(e)$ immediately + precedes $\sigma(e)$ under the same orientation of $\Theta$." -/ +structure IsLinearInflation (Γ Γ' : Painting S) (σv : S → Set S) (σe : Set S → Set S) : Prop + extends IsInflation Γ Γ' σv σe where + borders_iff : ∀ e ∈ Γ.E, ∀ Θ ∈ cuffs S, (e ∩ Θ).Nonempty ↔ (σe e ∩ Θ).Nonempty + border_edge : ∀ e' ∈ Γ'.E, Painting.IsBorder e' → e' ∉ σe '' Γ.E → + ∃ v ∈ Γ.V, tilde e' ⊆ σv v + orientation : ∀ e ∈ Γ.E, ∀ Θ ∈ cuffs S, (e ∩ Θ).Nonempty → ∀ f : Circle ≃ₜ Θ, + ∀ n n', (Γ.γ e).head? = some n → (Γ'.γ (σe e)).head? = some n' → + ImmediatelyPrecedes f n e → ImmediatelyPrecedes f n' (σe e) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Defs2.lean b/LeanPool/GraphMinor/GM19/Defs2.lean new file mode 100644 index 0000000000..6bec924f16 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Defs2.lean @@ -0,0 +1,1159 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CircleOrder + +public import LeanPool.GraphMinor.GM19.Defs +public import LeanPool.GraphMinor.GM11.Defs +public import LeanPool.GraphMinor.GM10.Defs2 +public import LeanPool.GraphMinor.GM18.Defs +public import LeanPool.GraphMinor.Surface.TopologyStatements +public import Mathlib.Order.Prod.Lex.Basic + +/-! +# Definitions for Graph Minors XIX (Sections 2–8) + +This file formalizes the definitions from Sections 2–8 (pages 327–350) of N. Robertson and +P. D. Seymour, *Graph Minors. XIX. Well-quasi-ordering on a surface*, J. Combin. Theory Ser. B 90 +(2004) 325–385: + +- Section 2: drawings (`Drawing`, an abbreviation for `Surface.Drawing`, with +`Drawing.IsGM19Drawing` + for the loopless and boundary-respecting conditions of XIX), regions (`Drawing.regions`, + `Painting.regions`), internal edges (`Painting.IsInternal`), `Γ`-normal sets (`Painting.IsNormal`, + `Drawing.IsNormal`), and the bridge from `GM19.Painting` to `Surface.Painting` and + `GM11.PaintingOrDrawing` (`Painting.toSurfacePainting`, `Painting.toPaintingOrDrawing`). +- Section 3: frames (`Frame`), fitting a frame (`Painting.Fits`), respecting a frame + (`RespectsFrame`), quasi-orders and well-quasi-orders (`QuasiOrder`, `QuasiOrder.IsWQO`, and the + bridge to `[Preorder Ω]` and `WellQuasiOrderedLE`), colour schemes (`ColourScheme`), + `χ`-coloured paintings (`ColouredPainting`), and inflations of `χ`-coloured paintings + (`IsColouredInflation`, `IsColouredLinearInflation`). +- Section 4: bad sequences (`IsBadSequence`, `ColourScheme.IsBad`), capped surfaces + (`IsCappedSurface`), surface orientations and similarly oriented sequences + (`SurfaceOrientation`, `IsOrientableSurface`, `IsSimilarlyOriented`, + `ColourScheme.IsOrientedlyBad`), sub-ideals of quasi-orders (`QuasiOrder.IsSubIdeal`, + `QuasiOrder.IsStrictSubIdeal`), refinements (`ColourScheme.IsRefinement`), and the induction + hypotheses `S₁`–`S₄` (`ConditionS1`, `ConditionS2`, `ConditionS3`, `ConditionS4`). +- Section 5: `Φ`-preserving homeomorphisms (`IsFramePreservingHomeo`), features (`IsFeature`, + `FeatureEquiv`), cutting along a feature (`IsCuttingFragment`), 2-cell paintings + (`Painting.IsTwoCell`), radial drawings (`IsPreRadial`, `RadialDrawing`, with + `RadialDrawing.isRadialDrawing` proving `GM11.PaintingOrDrawing.IsRadialDrawing`), `R*`, the + poles and the atom of a vertex (`RadialDrawing.Rstar`, `RadialDrawing.poles`, + `RadialDrawing.atomOf`), `dist(Γ)` (`Painting.dist`), and `rep(Γ)` (`Painting.rep`). +- Section 6: `rep(G)` for drawings (`Drawing.rep`), isomorphism of drawings +(`Drawing.IsIsomorphic`), + enlargements of drawings (`IsEnlargement`), and blocks (`Drawing.IsBlock`). +- Section 7: the hypergraph of a painting (`Painting.toHypergraph`) and its restriction + (`Painting.restrict`), using the shared `Hypergraph S (Set S)`, `Hypergraph.IsSeparation`, and + `GM10.IsTangle`; `rep(𝒯)` (`tangleRep`), `ins(F)` and `out(F)` (`IsInsOf`, `IsOutOf`), atoms + (`Painting.atoms`), `ins(W)` (`ClosedWalkIns`), and the tangle metric `d` (`tangleMetric`). +- Section 8: splitting an edge of `Γ*` (`RadialDrawing.Splits`), tie-breakers (`TieBreaker`), the + `λ`-order (`TieBreaker.lambdaOrder`), `𝒯`-enclaves (`IsEnclaveAround`, `IsEnclave`), `λ`-linked + circuits (`IsLambdaLinkedCircuit`), arms (`Arm`), rooted locations (`RootedLocation`), and + `θ`-isolation (`RootedLocation.Isolates`). Distinctions and `λ`-linked separations are those of + Graph Minors X and XVIII, `GM10.IsDistinction` and `GM18.IsLambdaLinkedTo`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface GraphMinor.Hypergraph GraphMinor.GM11 + +universe u w + +variable {S : Type u} [TopologicalSpace S] + +/-! ### Section 2: Drawings, regions, and normal subsets -/ + +/-- A drawing `G` in a surface `Σ` in Graph Minors XIX is a `Surface.Drawing S`. The two extra +conditions required in Graph Minors XIX, Section 2 (page 327) (no loops and each edge contained in +`bd(Σ)` or disjoint from `bd(Σ)`) are expressed by the predicate `Surface.Drawing.IsGM19Drawing`. -/ +abbrev Drawing (S : Type u) [TopologicalSpace S] := Surface.Drawing S + +namespace Drawing + +/-- The two extra conditions on a drawing `G` in a surface `Σ` from Graph Minors XIX, Section 2 +(page 327): "A *drawing* $G$ in $\Sigma$ is a pair $(U, V)$, where $U \subseteq \Sigma$ is closed +and $V \subseteq U$ is finite, such that +- $U \setminus V$ has only finitely many arc-wise connected components, called *edges*, +- for each edge $e$, $|\tilde{e}| = 2$, and $\bar{e}$ is a line with ends the two members of + $\tilde{e}$, +- for each edge $e$, either $e \subseteq bd(\Sigma)$ or $e \cap bd(\Sigma) = \emptyset$." -/ +structure IsGM19Drawing (G : Drawing S) : Prop where + no_loops : ∀ e ∈ G.E, (tilde e).ncard = 2 ∧ (tilde e).Finite ∧ + IsLine (closure e) ∧ lineEnds (closure e) = tilde e + border_or_disjoint : ∀ e ∈ G.E, e ⊆ bd S ∨ Disjoint e (bd S) + +/-- The regions of `G` in `Σ` are the connected components of `Σ \ U(G)` (Graph Minors XIX, +Section 2, page 327: "The components of $\Sigma \setminus U(G)$ are called the *regions* of $G$ in +$\Sigma$"). -/ +noncomputable def regions (G : Drawing S) : Set (Set S) := componentsIn G.Uᶜ + +/-- The size of a drawing `G` is `|V(G)| + |E(G)|` (Graph Minors XIX, Section 5, page 335: +"The *size* of a drawing $G$ is $|V(G)| + |E(G)|$"). -/ +noncomputable def size (G : Drawing S) : ℕ := G.V.ncard + G.E.ncard + +/-- A subset `X ⊆ Σ` is `G`-normal if `X ∩ U(G) ⊆ V(G)` (Graph Minors XIX, Section 2, page 328: +"A subset $X \subseteq \Sigma$ is *$\Gamma$-normal* if $X \cap U(\Gamma) \subseteq V(\Gamma)$"). -/ +def IsNormal (G : Drawing S) (X : Set S) : Prop := X ∩ G.U ⊆ G.V + +/-- The 1-skeleton simple graph of a drawing `G`. -/ +def adj (G : Drawing S) : SimpleGraph S where + Adj x y := x ≠ y ∧ x ∈ G.V ∧ y ∈ G.V ∧ ∃ e ∈ G.E, x ∈ tilde e ∧ y ∈ tilde e + symm := ⟨fun _ _ ⟨h, hx, hy, e, he, hxe, hye⟩ ↦ ⟨h.symm, hy, hx, e, he, hye, hxe⟩⟩ + loopless := ⟨fun _ h ↦ h.1 rfl⟩ + +/-- A drawing `C` is a circuit of `G` if `C` is a subdrawing of `G` and a circuit in the sense of +Graph Minors XI, Section 4 (page 79). -/ +def IsCircuitOf (C G : Drawing S) : Prop := + C.IsSubdrawing G ∧ C.IsCircuit + +/-- A drawing `P` is a path of `G` between `u` and `v` if `P` is a subdrawing of `G` and a path in +the sense of Graph Minors XI, Section 4 (page 79). A path may have one vertex, and then `u = v`. -/ +def IsPathOf (P G : Drawing S) (u v : S) : Prop := + P.IsSubdrawing G ∧ P.IsPathBetween u v + +end Drawing + +export Drawing (IsGM19Drawing IsCircuitOf IsPathOf) + +namespace Surface.Drawing + +export GM19.Drawing (IsGM19Drawing regions size adj IsCircuitOf IsPathOf) + +end Surface.Drawing + +namespace Painting + +/-- The regions of a painting `Γ` in `Σ` are the connected components of `Σ \ U(Γ)` (Graph Minors +XIX, Section 2, page 327: "the connected components of $\Sigma \setminus U$ are the *regions* of +$\Gamma$"). -/ +noncomputable def regions (Γ : Painting S) : Set (Set S) := componentsIn Γ.Uᶜ + +/-- An edge `e` is internal if `e ∩ bd(Σ) = ∅` (Graph Minors XIX, Section 2, page 327: "an edge $e$ +is a *border edge* if $e \cap bd(\Sigma) \ne \emptyset$, and otherwise is +*internal"). -/ +def IsInternal (e : Set S) : Prop := Disjoint e (bd S) + +/-- A subset `X ⊆ Σ` is `Γ`-normal if `X ∩ U(Γ) ⊆ V(Γ)` (Graph Minors XIX, Section 2, page 328: +"A subset $X \subseteq \Sigma$ is *$\Gamma$-normal* if $X \cap U(\Gamma) \subseteq V(\Gamma)$"). -/ +def IsNormal (Γ : Painting S) (X : Set S) : Prop := X ∩ Γ.U ⊆ Γ.V + +/-- The point set `U(sk(Γ))` of the 1-skeleton drawing `sk(Γ)` (Graph Minors XIX, Section 2, +page 327). -/ +def skU (Γ : Painting S) : Set S := + Γ.V ∪ (⋃ e ∈ {e ∈ Γ.E | (tilde e).ncard = 2}, e) ∪ + (⋃ e ∈ {e ∈ Γ.E | (tilde e).ncard = 3}, discBd (closure e)) + +/-- Conversion from `GM19.Painting` to `Surface.Painting` when every edge of `Γ` has closure a +closed disc with `closure e ∩ V(Γ) ⊆ subBd (closure e)` (for instance, when every edge of `Γ` has +size 3, or after 2-ended line edges are thickened into closed discs). +Note on the difference between `GM19.Painting` (Graph Minors XIX, Section 2, page 327) and +`Surface.Painting` (Graph Minors XI, Section 3, page 75): in Graph Minors XI, every cell `e` has +closure `ē` a closed disc (even when `|eTilde| = 2`), whereas in Graph Minors XIX, an edge `e` with +`|eTilde| = 2` has closure `ē` a line (`[0, 1]`-arc) and an edge `e` with `|eTilde| = 3` has closure +`ē` a +closed disc. -/ +def toSurfacePainting (Γ : Painting S) + (hdisc : ∀ e ∈ Γ.E, IsClosedDisc (closure e) ∧ closure e ∩ Γ.V ⊆ subBd (closure e)) : + Surface.Painting S where + U := Γ.U + V := Γ.V + V_subset_U := Γ.V_subset + finite_V := Γ.finite_V + finite_edges := Γ.finite_edges + edge_cond := hdisc + +/-- Conversion from `GM19.Painting` to `GM11.PaintingOrDrawing` via `Painting.toSurfacePainting`. -/ +def toPaintingOrDrawing (Γ : Painting S) + (hdisc : ∀ e ∈ Γ.E, IsClosedDisc (closure e) ∧ closure e ∩ Γ.V ⊆ subBd (closure e)) : + PaintingOrDrawing S := + PaintingOrDrawing.painting (Γ.toSurfacePainting hdisc) + +/-- The hypergraph `(V(Γ), E(Γ))` of a painting `Γ` (Graph Minors XIX, Section 7, page 344: +"If $\Gamma$ is a painting then $(V(\Gamma), E(\Gamma))$ (with the natural incidence +relation) is a hypergraph, and to avoid proliferating notation we shall also call this +hypergraph $\Gamma$"). -/ +def toHypergraph (Γ : Painting S) : Hypergraph S (Set S) where + vertexSet := Γ.V + edgeSet := Γ.E + Inc e v := e ∈ Γ.E ∧ v ∈ Γ.V ∧ v ∈ tilde e + vertex_mem_of_inc _ _ h := h.2.1 + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := Γ.finite_V + edgeSet_finite := Γ.finite_edges + +/-- The restriction `Γ ∩ Δ` of a painting `Γ` to a subset `Δ ⊆ Σ`, as a subhypergraph of +`Γ.toHypergraph` (Graph Minors XIX, Section 7, page 344). -/ +def restrict (Γ : Painting S) (Δ : Set S) : Hypergraph S (Set S) where + vertexSet := Γ.V ∩ Δ + edgeSet := {e ∈ Γ.E | e ⊆ Δ ∧ tilde e ∩ Γ.V ⊆ Δ} + Inc e v := (e ∈ Γ.E ∧ e ⊆ Δ ∧ tilde e ∩ Γ.V ⊆ Δ) ∧ v ∈ Γ.V ∧ v ∈ tilde e + vertex_mem_of_inc _ _ h := ⟨h.2.1, h.1.2.2 ⟨h.2.2, h.2.1⟩⟩ + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := Γ.finite_V.subset inter_subset_left + edgeSet_finite := Γ.finite_edges.subset fun _ he ↦ he.1 + +theorem restrict_le (Γ : Painting S) (Δ : Set S) : Γ.restrict Δ ≤ Γ.toHypergraph where + vertexSet_subset := inter_subset_left + edgeSet_subset _ he := he.1 + ends_eq _ he := by + ext v + simp only [Hypergraph.ends, restrict, toHypergraph] + exact ⟨fun h ↦ ⟨he, h.2.1, h.2.2⟩, fun h ↦ ⟨he.1, h.2.1, h.2.2⟩⟩ + +end Painting + +/-! ### Section 3: Frames and colour schemes -/ + +/-- The direction of an edge `e ⊆ s` defined by `γe` agrees with the direction of `s` defined by +`γs` (Graph Minors XIX, Section 3, page 329: "the tail of $e$ precedes its head as $S$ is traversed +from its tail in $\Phi$ to its head +(that is, briefly, the direction of $e$ defined by $\gamma_\Gamma(e)$ agrees with the +direction of $S$ in $\Phi$)"). -/ +def DirAgrees (s : Set S) (γs : List S) (e : Set S) (γe : List S) : Prop := + ∃ (f : Icc (0 : ℝ) 1 ≃ₜ closure s) (t₁ t₂ : Icc (0 : ℝ) 1), + t₁ < t₂ ∧ e ⊆ s ∧ + γs.head? = some (f ⟨0, left_mem_Icc.mpr zero_le_one⟩).1 ∧ + γs.getLast? = some (f ⟨1, right_mem_Icc.mpr zero_le_one⟩).1 ∧ + γe.head? = some (f t₁).1 ∧ + γe.getLast? = some (f t₂).1 + +/-- A frame `Φ` in `Σ` (Graph Minors XIX, Section 3, page 329): "A *frame $\Phi$ in $\Sigma$* +consists of a directed drawing in $\Sigma$ (which we also +denote by $\Phi$) with $U(\Phi)=bd(\Sigma)$, together with a designation of each edge of +$\Phi$ as *long* or *short*, such that no two long edges have a common end. We call the +edges of $\Phi$ the *sides* of the frame." -/ +structure Frame (S : Type u) [TopologicalSpace S] where + /-- The vertex set `V(Φ) ⊆ bd(Σ)`. -/ + V : Set S + /-- The direction march `γ(S)` of each side `S` of `Φ`. -/ + γ : Set S → List S + /-- Predicate designating whether a side `S` is long (short otherwise). -/ + isLong : Set S → Prop + V_subset : V ⊆ bd S + finite_V : V.Finite + finite_sides : (arcComponentsIn (bd S \ V)).Finite + side_shape : ∀ s ∈ arcComponentsIn (bd S \ V), + (tilde s).ncard = 2 ∧ (tilde s).Finite ∧ IsLine (closure s) ∧ lineEnds (closure s) = tilde s + γ_nodup : ∀ s ∈ arcComponentsIn (bd S \ V), (γ s).Nodup + γ_set : ∀ s ∈ arcComponentsIn (bd S \ V), {v | v ∈ γ s} = tilde s + long_disjoint : ∀ s₁ ∈ arcComponentsIn (bd S \ V), ∀ s₂ ∈ arcComponentsIn (bd S \ V), + s₁ ≠ s₂ → isLong s₁ → isLong s₂ → Disjoint (tilde s₁) (tilde s₂) + +namespace Frame + +/-- The set `E(Φ)` of sides of a frame `Φ` (Graph Minors XIX, Section 3, page 329). -/ +def sides (Φ : Frame S) : Set (Set S) := arcComponentsIn (bd S \ Φ.V) + +/-- The set of long sides of a frame `Φ` (Graph Minors XIX, Section 3, page 329). -/ +def longSides (Φ : Frame S) : Set (Set S) := {s ∈ Φ.sides | Φ.isLong s} + +/-- The set of short sides of a frame `Φ` (Graph Minors XIX, Section 3, page 329). -/ +def shortSides (Φ : Frame S) : Set (Set S) := {s ∈ Φ.sides | ¬ Φ.isLong s} + +end Frame + +/-- A painting `Γ` in `Σ` fits a frame `Φ` (Graph Minors XIX, Section 3, page 329): +"A *painting $\Gamma$ in $\Sigma$* is said to *fit a frame $\Phi$* if +- $V(\Phi)\subseteq V(\Gamma)$, +- each short side of $\Phi$ is an edge of $\Gamma$, +- for every border edge $e$ of $\Gamma$, if $S$ is the side of $\Phi$ with $e\subseteq S$ then the + tail of $e$ precedes its head as $S$ is traversed from its tail in $\Phi$ to its head (that is, + briefly, the direction of $e$ defined by $\gamma_\Gamma(e)$ agrees with the direction of $S$ in + $\Phi$), +- $\Gamma$ is internally 3-connected, +- if $e\in E(\Gamma)$ and $|\tilde{e}|=3$ and $r$ is a region of $\Gamma$ in $\Sigma$ with + $|\bar{r}\cap V(\Gamma)|\ge 3$, then $\bar{f}\cap bd(\Sigma)\ne \emptyset$ for every component + $f$ of $e\cap \bar{r}$." -/ +structure Painting.Fits (Γ : Painting S) (Φ : Frame S) : Prop where + V_subset : Φ.V ⊆ Γ.V + short_sides : Φ.shortSides ⊆ Γ.E + border_dir : ∀ e ∈ Γ.E, Painting.IsBorder e → ∀ s ∈ Φ.sides, e ⊆ s → + DirAgrees s (Φ.γ s) e (Γ.γ e) + internally_three_connected : Γ.IsInternallyThreeConnected + size_three_region : ∀ e ∈ Γ.E, (tilde e).ncard = 3 → ∀ r ∈ Γ.regions, + 3 ≤ (closure r ∩ Γ.V).ncard → ∀ f ∈ componentsIn (e ∩ closure r), + (closure f ∩ bd S).Nonempty + +/-- A border edge `e` of `Γ` borders a side `S` of `Φ` if `e ⊆ S` (Graph Minors XIX, Section 3, +page 329: "If $e$ is a border edge of $\Gamma$ and $S$ is a side of $\Phi$ with $e\subseteq S$, we +say +that $e$ *borders $S$"). -/ +def BordersSide (e s : Set S) : Prop := Painting.IsBorder e ∧ e ⊆ s + +/-- An inflation `σ` of `Γ` in `Γ'` respects a frame `Φ` (Graph Minors XIX, Section 3, page 329): +"we say that $\sigma$ *respects $\Phi$* if for every border edge $e$ of $\Gamma$, $\sigma(e)$ +is a border edge and $e$ and $\sigma(e)$ border the same side of $\Phi$." -/ +def RespectsFrame (Φ : Frame S) (Γ : Painting S) (σe : Set S → Set S) : Prop := + ∀ e ∈ Γ.E, Painting.IsBorder e → + Painting.IsBorder (σe e) ∧ ∀ s ∈ Φ.sides, e ⊆ s ↔ σe e ⊆ s + +/-- A quasi-order `Ω` with element set `E(Ω)` and reflexive, transitive relation `≤` (Graph Minors +XIX, Section 2, page 328: "A *quasi-order* $\Omega$ consists of a set $E(\Omega)$ and a reflexive, +transitive relation +$\le$"). -/ +structure QuasiOrder (α : Type w) where + /-- The element set `E(Ω)`. -/ + E : Set α + /-- The quasi-order relation `≤`. -/ + le : α → α → Prop + refl : ∀ x ∈ E, le x x + trans : ∀ x ∈ E, ∀ y ∈ E, ∀ z ∈ E, le x y → le y z → le x z + +namespace QuasiOrder + +variable {α : Type w} + +/-- A quasi-order `Ω` is a well-quasi-order if for every countable sequence `ω_i` of elements of +`E(Ω)` there exist `j > i` such that `ω_i ≤ ω_j` (Graph Minors XIX, Section 2, page 328: "It is a +*well-quasi-order* if for every countable sequence $\omega_i$ ($i = 1, 2, \dots$) of +elements of $E(\Omega)$ there exist $j > i \ge 1$ such that $\omega_i \le \omega_j$"). -/ +def IsWQO (Ω : QuasiOrder α) : Prop := + ∀ f : ℕ → α, (∀ i, f i ∈ Ω.E) → ∃ i j, i < j ∧ Ω.le (f i) (f j) + +/-- The `QuasiOrder` on a type `α` equipped with a `[Preorder α]` and element set `Set.univ`. -/ +def ofPreorder (α : Type w) [Preorder α] : QuasiOrder α where + E := univ + le := (· ≤ ·) + refl x _ := le_refl x + trans _ _ _ _ _ _ h₁ h₂ := le_trans h₁ h₂ + +/-- `ofPreorder α` is a well-quasi-order in the sense of `QuasiOrder.IsWQO` if and only if +`WellQuasiOrderedLE α` holds. -/ +theorem isWQO_ofPreorder_iff (α : Type w) [Preorder α] : + (ofPreorder α).IsWQO ↔ WellQuasiOrderedLE α := by + constructor + · intro h + refine ⟨fun f ↦ h f (fun _ ↦ mem_univ _)⟩ + · intro h f _ + exact h.wqo f + +/-- The `Preorder` on the subtype `↑Ω.E` induced by a `QuasiOrder α`. -/ +@[instance_reducible] +def toSubtypePreorder (Ω : QuasiOrder α) : Preorder Ω.E where + le x y := Ω.le x.1 y.1 + le_refl x := Ω.refl x.1 x.2 + le_trans x y z h₁ h₂ := Ω.trans x.1 x.2 y.1 y.2 z.1 z.2 h₁ h₂ + +/-- A `QuasiOrder` `Ω` satisfies `Ω.IsWQO` if and only if the induced preorder on `↑Ω.E` satisfies +`WellQuasiOrderedLE`. -/ +theorem isWQO_iff_wellQuasiOrderedLE (Ω : QuasiOrder α) : + Ω.IsWQO ↔ @WellQuasiOrderedLE Ω.E Ω.toSubtypePreorder.toLE := by + let _ : Preorder Ω.E := Ω.toSubtypePreorder + constructor + · intro h + refine ⟨fun f ↦ ?_⟩ + obtain ⟨i, j, hij, hle⟩ := h (fun n ↦ (f n).1) (fun n ↦ (f n).2) + exact ⟨i, j, hij, hle⟩ + · intro h f hf + obtain ⟨i, j, hij, hle⟩ := h.wqo (fun n ↦ ⟨f n, hf n⟩) + exact ⟨i, j, hij, hle⟩ + +/-- `Ω' ≼ Ω` for quasi-orders `Ω, Ω'` (Graph Minors XIX, Section 4, page 332): +"If $\Omega,\Omega'$ are quasi-orders we write $\Omega'\preceq \Omega$ if +- $E(\Omega')\subseteq E(\Omega)$, +- for each $x'\in E(\Omega')$ and $x\in E(\Omega)$, if $x\le x'$ in $\Omega$ then + $x\in E(\Omega')$, and +- for $x_1,x_2\in E(\Omega')$, $x_1\le x_2$ in $\Omega'$ if and only if $x_1\le x_2$ in + $\Omega$." -/ +structure IsSubIdeal (Ω' Ω : QuasiOrder α) : Prop where + E_subset : Ω'.E ⊆ Ω.E + downward_closed : ∀ x' ∈ Ω'.E, ∀ x ∈ Ω.E, Ω.le x x' → x ∈ Ω'.E + le_iff : ∀ x₁ ∈ Ω'.E, ∀ x₂ ∈ Ω'.E, Ω'.le x₁ x₂ ↔ Ω.le x₁ x₂ + +/-- `Ω' ≺ Ω` if `Ω' ≼ Ω` and `Ω' ≠ Ω` (Graph Minors XIX, Section 4, page 332: +"We write $\Omega'\prec \Omega$ if $\Omega'\preceq \Omega$ and $\Omega'\ne \Omega$"). -/ +def IsStrictSubIdeal (Ω' Ω : QuasiOrder α) : Prop := + IsSubIdeal Ω' Ω ∧ Ω'.E ≠ Ω.E + +end QuasiOrder + +/-- A colour scheme `χ` on a surface `S` with label carrier `α` (Graph Minors XIX, Section 3, +page 329): "A *colour scheme $\chi$* consists of a surface $\Sigma_\chi$, a frame $\Phi_\chi$ in +$\Sigma_\chi$, two well-quasi-orders $\Omega_\chi(2)$ and $\Omega_\chi(3)$, and a +well-quasi-order $\Omega_\chi(S)$ for each side $S$ of $\Phi_\chi$, such that +$E(\Omega_\chi(S))=\{S\}$ for every short side $S$." -/ +structure ColourScheme (S : Type u) [TopologicalSpace S] (α : Type w) where + isSurface : IsSurface S + connected : ConnectedSpace S + /-- The frame `Φ_χ` in `Σ_χ`. -/ + Φ : Frame S + /-- The well-quasi-order `Ω_χ(2)`. -/ + Ω2 : QuasiOrder α + /-- The well-quasi-order `Ω_χ(3)`. -/ + Ω3 : QuasiOrder α + /-- The well-quasi-order `Ω_χ(S)` for each side `S` of `Φ_χ`. -/ + ΩS : Set S → QuasiOrder α + /-- The representative element for each short side `S` of `Φ_χ`. -/ + shortElem : Set S → α + isWQO_2 : Ω2.IsWQO + isWQO_3 : Ω3.IsWQO + isWQO_S : ∀ s ∈ Φ.sides, (ΩS s).IsWQO + short_singleton : ∀ s ∈ Φ.shortSides, (ΩS s).E = {shortElem s} + +/-- A `χ`-coloured painting `(Γ, φ)` (Graph Minors XIX, Section 3, page 329): +"If $\chi$ is a colour scheme, a *$\chi$-coloured painting* is a pair $(\Gamma,\phi)$, where +- $\Gamma$ is a painting in $\Sigma_\chi$ fitting the frame $\Phi_\chi$, +- $\phi$ is a function with domain $E(\Gamma)$, such that if $e\in E(\Gamma)$ is internal then + $\phi(e)\in \Omega_\chi(|\tilde{e}|)$, and if $e$ borders a side $S$ then + $\phi(e)\in \Omega_\chi(S)$." -/ +structure ColouredPainting {α : Type w} (χ : ColourScheme S α) where + /-- The underlying painting `Γ`. -/ + Γ : Painting S + /-- The edge-labelling function `φ`. -/ + φ : Set S → α + fits : Γ.Fits χ.Φ + internal_2_mem : ∀ e ∈ Γ.E, Painting.IsInternal e → (tilde e).ncard = 2 → φ e ∈ χ.Ω2.E + internal_3_mem : ∀ e ∈ Γ.E, Painting.IsInternal e → (tilde e).ncard = 3 → φ e ∈ χ.Ω3.E + border_mem : ∀ e ∈ Γ.E, ∀ s ∈ χ.Φ.sides, BordersSide e s → φ e ∈ (χ.ΩS s).E + +/-- An inflation of `(Γ, φ)` in `(Γ', φ')` for `χ`-coloured paintings (Graph Minors XIX, +Section 3, page 330): "If $(\Gamma,\phi),(\Gamma',\phi')$ are $\chi$-coloured paintings, an +*inflation of $(\Gamma,\phi)$ in $(\Gamma',\phi')$* is an inflation $\sigma$ of $\Gamma$ in +$\Gamma'$ respecting $\Phi_\chi$, such that $\phi\le \phi'\circ \sigma$ (with the natural +meaning); and *linear inflations* are defined similarly." -/ +structure IsColouredInflation {α : Type w} (χ : ColourScheme S α) + (P P' : ColouredPainting χ) (σv : S → Set S) (σe : Set S → Set S) : Prop where + isInflation : IsInflation P.Γ P'.Γ σv σe + respects : RespectsFrame χ.Φ P.Γ σe + le_internal_2 : ∀ e ∈ P.Γ.E, Painting.IsInternal e → (tilde e).ncard = 2 → + χ.Ω2.le (P.φ e) (P'.φ (σe e)) + le_internal_3 : ∀ e ∈ P.Γ.E, Painting.IsInternal e → (tilde e).ncard = 3 → + χ.Ω3.le (P.φ e) (P'.φ (σe e)) + le_border : ∀ e ∈ P.Γ.E, ∀ s ∈ χ.Φ.sides, BordersSide e s → + (χ.ΩS s).le (P.φ e) (P'.φ (σe e)) + +/-- A linear inflation of `(Γ, φ)` in `(Γ', φ')` for `χ`-coloured paintings (Graph Minors XIX, +Section 3, page 330). -/ +structure IsColouredLinearInflation {α : Type w} (χ : ColourScheme S α) + (P P' : ColouredPainting χ) (σv : S → Set S) (σe : Set S → Set S) : Prop + extends IsColouredInflation χ P P' σv σe where + isLinear : IsLinearInflation P.Γ P'.Γ σv σe + +/-! ### Section 4: The induction -/ + +/-- A bad sequence for a colour scheme `χ` (Graph Minors XIX, Section 4, page 332): +"A bad sequence for a colour scheme $\chi$ is a countable sequence $(\Gamma_i,\phi_i)$ +$(i=1,2,\dots)$ of $\chi$-coloured paintings, such that for all $j>i\ge 1$ there is no +linear inflation of $(\Gamma_i,\phi_i)$ in $(\Gamma_j,\phi_j)$." -/ +def IsBadSequence {α : Type w} (χ : ColourScheme S α) (P : ℕ → ColouredPainting χ) : Prop := + ∀ i j, i < j → ¬ ∃ σv σe, IsColouredLinearInflation χ (P i) (P j) σv σe + +/-- A colour scheme `χ` is bad if there is a bad sequence for it (Graph Minors XIX, Section 4, +page 332: "We say that a colour scheme is bad if there is a bad sequence for it"). -/ +def ColourScheme.IsBad {α : Type w} (χ : ColourScheme S α) : Prop := + ∃ P : ℕ → ColouredPainting χ, IsBadSequence χ P + +/-- `Shat` is the capped surface `Σ̂` obtained from `S` by pasting a closed disc onto each cuff of +`S` (Graph Minors XIX, Section 2, page 327: The surface obtained from $\Sigma$ by "pasting" a disc +onto each cuff we denote by $\hat{\Sigma}$). -/ +structure IsCappedSurface (S : Type u) [TopologicalSpace S] + (Shat : Type u) [TopologicalSpace Shat] where + isSurface : IsSurface Shat + connected : ConnectedSpace Shat + bd_empty : bd Shat = ∅ + /-- The embedding of `S` into `Shat`. -/ + emb : S → Shat + isEmbedding : Topology.IsEmbedding emb + /-- For each cuff `Θ` of `S`, the pasted open disc `r(Θ)` in `Shat \ emb(S)`. -/ + cuffDisc : Set S → Set Shat + cuffDisc_closedDisc : ∀ Θ ∈ cuffs S, IsClosedDisc (closure (cuffDisc Θ)) + cuffDisc_bd : ∀ Θ ∈ cuffs S, discBd (closure (cuffDisc Θ)) = emb '' Θ + cuffDisc_disjoint : ∀ Θ₁ ∈ cuffs S, ∀ Θ₂ ∈ cuffs S, Θ₁ ≠ Θ₂ → + Disjoint (closure (cuffDisc Θ₁)) (closure (cuffDisc Θ₂)) + compl_eq : (range emb)ᶜ = ⋃ Θ ∈ cuffs S, cuffDisc Θ + +/-- The positive cyclic order of three points of the circle: going around from `a` in the positive +direction, we reach `b` before `c`, and both before coming back to `a`. -/ +abbrev CircleCyclic (a b c : Circle) : Prop := CircleOrder.CircleCyclic a b c + +/-- An orientation `ω` of a surface `S` (Graph Minors XIX, Section 4, page 332). The paper uses +orientations as usual. An orientation assigns to each closed disc `Δ ⊆ S` a cyclic order of +`bd(Δ)`, that is, one of the two directions of this `O`-arc, and these must agree: if +`Δ₁ ⊆ Δ₂`, then the two cyclic orders agree on each triple of common boundary points. + +A Möbius band has no orientation. To compare a closed disc `D` with a closed disc `Δ` that includes +it in its interior, thicken `D` along three disjoint arcs to `bd(Δ)`. The result is a closed disc +`D' ⊆ Δ` that has three boundary points in common with `Δ` and three with `D`. So any two closed +discs that overlap are compared, and going around the core of the band reverses the direction. -/ +structure SurfaceOrientation (S : Type u) [TopologicalSpace S] where + /-- `pos Δ a b c` says that `a, b, c ∈ bd(Δ)` occur in this cyclic order under `ω`. -/ + pos : Set S → S → S → S → Prop + /-- The relation on `bd(Δ)` is a direction of the `O`-arc `bd(Δ)`. -/ + isDirection : ∀ Δ : Set S, IsClosedDisc Δ → ∃ φ : Circle → S, + Continuous φ ∧ Function.Injective φ ∧ range φ = discBd Δ ∧ + ∀ a b c : Circle, a ≠ b → b ≠ c → a ≠ c → (pos Δ (φ a) (φ b) (φ c) ↔ CircleCyclic a b c) + /-- Nested discs have the same direction on common boundary points. -/ + agree : ∀ Δ₁ Δ₂ : Set S, IsClosedDisc Δ₁ → IsClosedDisc Δ₂ → Δ₁ ⊆ Δ₂ → ∀ a b c : S, + a ∈ discBd Δ₁ ∩ discBd Δ₂ → b ∈ discBd Δ₁ ∩ discBd Δ₂ → c ∈ discBd Δ₁ ∩ discBd Δ₂ → + a ≠ b → b ≠ c → a ≠ c → (pos Δ₁ a b c ↔ pos Δ₂ a b c) + +/-- `f` preserves the orientation `ω`: it carries the cyclic order of each closed disc to the cyclic +order of its image. -/ +def SurfaceOrientation.IsPreservedBy (ω : SurfaceOrientation S) (f : S ≃ₜ S) : Prop := + ∀ Δ : Set S, IsClosedDisc Δ → ∀ a b c : S, a ∈ discBd Δ → b ∈ discBd Δ → c ∈ discBd Δ → + a ≠ b → b ≠ c → a ≠ c → (ω.pos (f '' Δ) (f a) (f b) (f c) ↔ ω.pos Δ a b c) + +/-- A surface `S` is orientable if it has an orientation (Graph Minors XIX, Section 4, page 332). -/ +def IsOrientableSurface (S : Type u) [TopologicalSpace S] : Prop := + Nonempty (SurfaceOrientation S) + +/-- A family of `χ`-coloured paintings is similarly oriented (Graph Minors XIX, Section 4, +page 332): "A set $\{(\Gamma_i,\phi_i):i\in I\}$ of $\chi$-coloured paintings is said to be +*similarly oriented* if either $\Sigma_\chi$ is not orientable, or there is an orientation $\omega$ +of $\Sigma_\chi$ such that for all $i\in I$ and every $e\in E(\Gamma_i)$ with $|\tilde{e}|=3$, the +orientations of $e$ given by $\omega$ and given by the cyclic order of the terms of +$\gamma_{\Gamma_i}(e)$ coincide." The orientation of `e` given by `ω` is +the cyclic order of `bd(ē)`. -/ +def IsSimilarlyOriented {α : Type w} (χ : ColourScheme S α) + (P : ℕ → ColouredPainting χ) : Prop := + ¬ IsOrientableSurface S ∨ + ∃ ω : SurfaceOrientation S, + ∀ i, ∀ e ∈ (P i).Γ.E, (tilde e).ncard = 3 → ∀ a b c : S, (P i).Γ.γ e = [a, b, c] → + ω.pos (closure e) a b c + +/-- A colour scheme `χ` is orientedly bad if there is a similarly oriented bad sequence for it +(Graph Minors XIX, Section 4, page 332: "A colour scheme $\chi$ is *orientedly bad* if there is a +similarly oriented bad sequence for +it"). -/ +def ColourScheme.IsOrientedlyBad {α : Type w} (χ : ColourScheme S α) : Prop := + ∃ P : ℕ → ColouredPainting χ, IsBadSequence χ P ∧ IsSimilarlyOriented χ P + +/-- The number of cuffs `c(Σ)` of a surface `Σ` (Graph Minors XIX, Section 4, page 332: +"We denote the number of cuffs of a surface $\Sigma$ by $c(\Sigma)$"). -/ +noncomputable def numCuffs (S : Type u) [TopologicalSpace S] : ℕ := (cuffs S).ncard + +/-- `χ'` is a refinement of `χ` via embedding `f` (Graph Minors XIX, Section 4, page 332): +"We say that $\chi'$ is a *refinement* of $\chi$ if $\Sigma_{\chi'}\cong \Sigma_\chi$, +$\Omega_{\chi'}(k) = \Omega_\chi(k)$ $(k = 2,3)$, and there is a function $f$ from the set of long +sides of $\Phi_{\chi'}$ to the set of long sides of $\Phi_\chi$, such that +- $\Omega_{\chi'}(R)\preceq \Omega_\chi(f(R))$ for each long side $R$ of $\Phi_{\chi'}$, +- if $R_1,R_2$ are distinct long sides of $\Phi_{\chi'}$ with $f(R_1) = f(R_2)$ then + $\Omega_{\chi'}(R_1)\prec \Omega_\chi(f(R_1))$, +- if for each long side $S$ of $\Phi_\chi$ there is a long side $R$ of $\Phi_{\chi'}$ with + $f(R) = S$ and $\Omega_{\chi'}(R) = \Omega_\chi(S)$, then $\Phi_{\chi'}$ has fewer short sides + then $\Phi_\chi$. +In this case, we call $f$ an *embedding* of $\chi'$ in $\chi$." -/ +def ColourScheme.IsRefinement {S₁ S₂ : Type u} [TopologicalSpace S₁] [TopologicalSpace S₂] + {α : Type w} (χ' : ColourScheme S₁ α) (χ : ColourScheme S₂ α) : Prop := + Nonempty (S₁ ≃ₜ S₂) ∧ χ'.Ω2 = χ.Ω2 ∧ χ'.Ω3 = χ.Ω3 ∧ + ∃ f : Set S₁ → Set S₂, + MapsTo f χ'.Φ.longSides χ.Φ.longSides ∧ + (∀ R ∈ χ'.Φ.longSides, (χ'.ΩS R).IsSubIdeal (χ.ΩS (f R))) ∧ + (∀ R₁ ∈ χ'.Φ.longSides, ∀ R₂ ∈ χ'.Φ.longSides, R₁ ≠ R₂ → f R₁ = f R₂ → + (χ'.ΩS R₁).IsStrictSubIdeal (χ.ΩS (f R₁))) ∧ + ((∀ s ∈ χ.Φ.longSides, ∃ R ∈ χ'.Φ.longSides, f R = s ∧ (χ'.ΩS R).E = (χ.ΩS s).E) → + χ'.Φ.shortSides.ncard < χ.Φ.shortSides.ncard) + +/-- Statement `S₁` (Graph Minors XIX, Section 4, page 332): +"$\mathbf{S}_1$ *There is no bad colour scheme $\chi'$ with $\hat{\Sigma}_{\chi'}$ simpler than +$\hat{\Sigma}_\chi$.*" +`Shat` is `Σ̂_χ`. "Simpler" is `Surface.IsSimplerThan` for surfaces without boundary (Graph Minors +XVII, Section 1, page 164). With no cuffs it reads as follows: the Euler genus `2a + b` grows, and +an orientable surface comes only from an orientable one. These are the surfaces obtained "by adding +at least one handle or crosscap". The surface `Σ_{χ'}` and its labels are quantified over all +types, since the paper puts no bound on them. -/ +def ConditionS1 (Shat : Type u) [TopologicalSpace Shat] : Prop := + ∀ (S' Shat' : Type u) [TopologicalSpace S'] [TopologicalSpace Shat'] (β : Type w) + (χ' : ColourScheme S' β), Nonempty (IsCappedSurface S' Shat') → + IsSimplerThan Shat' Shat → ¬ χ'.IsBad + +/-- Statement `S₂` (Graph Minors XIX, Section 4, page 332): +"$\mathbf{S}_2$ *There is no orientedly bad colour scheme $\chi'$ with +$\hat{\Sigma}_{\chi'}\cong \hat{\Sigma}_\chi$ such that +$\Omega_{\chi'}(3)\preceq \Omega_\chi(3)$ and $\Omega_{\chi'}(2)\preceq \Omega_\chi(2)$ where at +least one of the inclusions is strict.*" -/ +def ConditionS2 {Shat : Type u} [TopologicalSpace Shat] {α : Type w} (χ : ColourScheme S α) + (_ : IsCappedSurface S Shat) : Prop := + ∀ (S' Shat' : Type u) [TopologicalSpace S'] [TopologicalSpace Shat'] + (χ' : ColourScheme S' α), Nonempty (IsCappedSurface S' Shat') → Nonempty (Shat' ≃ₜ Shat) → + χ'.Ω3.IsSubIdeal χ.Ω3 → χ'.Ω2.IsSubIdeal χ.Ω2 → + (χ'.Ω3.IsStrictSubIdeal χ.Ω3 ∨ χ'.Ω2.IsStrictSubIdeal χ.Ω2) → + ¬ χ'.IsOrientedlyBad + +/-- Statement `S₃` (Graph Minors XIX, Section 4, page 332): +"$\mathbf{S}_3$ *There is no orientedly bad colour scheme $\chi'$ with +$\hat{\Sigma}_{\chi'}\cong \hat{\Sigma}_\chi$, $\Omega_{\chi'}(k) = \Omega_\chi(k)$ +$(k = 2,3)$, and $c(\Sigma_{\chi'}) < c(\Sigma_\chi)$.*" -/ +def ConditionS3 {Shat : Type u} [TopologicalSpace Shat] {α : Type w} (χ : ColourScheme S α) + (_ : IsCappedSurface S Shat) : Prop := + ∀ (S' Shat' : Type u) [TopologicalSpace S'] [TopologicalSpace Shat'] + (χ' : ColourScheme S' α), Nonempty (IsCappedSurface S' Shat') → Nonempty (Shat' ≃ₜ Shat) → + χ'.Ω2 = χ.Ω2 → χ'.Ω3 = χ.Ω3 → numCuffs S' < numCuffs S → + ¬ χ'.IsOrientedlyBad + +/-- Statement `S₄` (Graph Minors XIX, Section 4, page 332): +"{S}_4$ *There is no orientedly bad colour scheme which is a refinement of $\chi$." -/ +def ConditionS4 {α : Type w} (χ : ColourScheme S α) : Prop := + ∀ (S' : Type u) [TopologicalSpace S'] (χ' : ColourScheme S' α), + χ'.IsRefinement χ → ¬ χ'.IsOrientedlyBad + +/-! ### Section 5: Surface homeomorphisms, features, fragments, and radial drawings -/ + +/-- A homeomorphism `α : Σ ≃ₜ Σ` is `Φ`-preserving (Graph Minors XIX, Section 5, page 335): +"A homeomorphism $\alpha \colon \Sigma \to \Sigma$ is $\Phi$-*preserving* if * $\alpha(v) = +v$ for all $v \in V(\Phi)$, and $\alpha(S) = S$ for all $S \in E(\Phi)$ (and hence $\alpha$ +preserves the direction of each side, and maps each cuff onto itself in an +orientation-preserving way) * if $\Sigma$ is orientable then $\alpha$ preserves the +orientation of $\Sigma$." -/ +structure IsFramePreservingHomeo (Φ : Frame S) (f : S ≃ₜ S) : Prop where + fix_V : ∀ v ∈ Φ.V, f v = v + preserve_sides : ∀ s ∈ Φ.sides, f '' s = s + preserves_orientation : ∀ ω : SurfaceOrientation S, ω.IsPreservedBy f + +/-- A drawing `K` in `Σ` is a feature in `Φ` (Graph Minors XIX, Section 5, page 335): +"A drawing $K$ in $\Sigma$ is a *feature* (in $\Phi$) if $K$ has no border edges and no +isolated vertices, and $U(K) \cap S = \emptyset$ for every short side $S$ of $\Phi$." -/ +structure IsFeature (Φ : Frame S) (K : Drawing S) : Prop where + no_border_edges : ∀ e ∈ K.E, Disjoint e (bd S) + no_isolated_vertices : ∀ v ∈ K.V, ∃ e ∈ K.E, v ∈ tilde e + disjoint_short_sides : ∀ s ∈ Φ.shortSides, Disjoint K.U s + +/-- Two features `K₁, K₂` in `Φ` are equivalent if there is a `Φ`-preserving homeomorphism mapping +`K₁` to `K₂` (Graph Minors XIX, Section 5, page 335: "Two features $K_1, K_2$ are *equivalent* if +there is a $\Phi$-preserving homeomorphism +$\alpha$ of $\Sigma$ such that $\alpha$ maps $K_1$ to $K_2$"). -/ +def FeatureEquiv (Φ : Frame S) (K₁ K₂ : Drawing S) : Prop := + ∃ f : S ≃ₜ S, IsFramePreservingHomeo Φ f ∧ f '' K₁.U = K₂.U ∧ f '' K₁.V = K₂.V + +/-- A fragment `Σ₁` of `Σ` after cutting along `U(K)` with associated surjection `ψ : Σ₁ → Σ` +(Graph Minors XIX, Section 5, page 335): "If we cut $\Sigma$ along $U(K)$ we obtain one or several +components $\Sigma_1, \dots, +\Sigma_k$ say, which we call *fragments* of $\Sigma$ after cutting along $U(K)$. There is a +natural surjection of $\psi \colon \Sigma_1 \cup \cdots \cup \Sigma_k \to \Sigma$, which we +shall call the *associated surjection*." The interior of `Σ₁` is a component of `Σ \ (bd(Σ) ∪ +U(K))`, and `ψ` runs each point of +`bd(Σ₁)` along `bd(Σ) ∪ U(K)`. Finite fibres stop `ψ` from collapsing an arc of `bd(Σ₁)` to a point, +which would give a surface that is not the result of cutting. -/ +structure IsCuttingFragment (S : Type u) [TopologicalSpace S] (K : Drawing S) + (S₁ : Type u) [TopologicalSpace S₁] (ψ : S₁ → S) : Prop where + isSurface : IsSurface S₁ + connected : ConnectedSpace S₁ + continuous_ψ : Continuous ψ + injOn_interior : InjOn ψ (bd S₁)ᶜ + finite_fibres : ∀ x : S, (ψ ⁻¹' {x}).Finite + maps_interior_disjoint : Disjoint (ψ '' (bd S₁)ᶜ) (bd S ∪ K.U) + maps_bd : ψ '' (bd S₁) ⊆ bd S ∪ K.U + interior_component : ψ '' (bd S₁)ᶜ ∈ componentsIn (bd S ∪ K.U)ᶜ + +/-- A painting `Γ` in `Σ` is 2-cell if every region of `Γ` in `Σ` is homeomorphic to an open disc +(Graph Minors XIX, Section 5, page 337: "A painting $\Gamma$ in a surface $\Sigma$ is 2-cell if +every region of $\Gamma$ in $\Sigma$ +is homeomorphic to an open disc"). -/ +def Painting.IsTwoCell (Γ : Painting S) : Prop := + ∀ r ∈ Γ.regions, Nonempty (r ≃ₜ Metric.ball (0 : EuclideanSpace ℝ (Fin 2)) 1) + +/-- The set `U(Γ)` as a subset of `Σ̂`. -/ +def Painting.hatU {Shat : Type u} [TopologicalSpace Shat] (cap : IsCappedSurface S Shat) + (Γ : Painting S) : Set Shat := + cap.emb '' Γ.U + +/-- The set `V(Γ)` as a subset of `Σ̂`. -/ +def Painting.hatV {Shat : Type u} [TopologicalSpace Shat] (cap : IsCappedSurface S Shat) + (Γ : Painting S) : Set Shat := + cap.emb '' Γ.V + +/-- The regions of `Γ` in `Σ̂`: the components of `Σ̂ \ U(Γ)` (Graph Minors XIX, Section 5, +page 337). -/ +noncomputable def Painting.hatRegions {Shat : Type u} [TopologicalSpace Shat] + (cap : IsCappedSurface S Shat) + (Γ : Painting S) : Set (Set Shat) := + componentsIn (Γ.hatU cap)ᶜ + +/-- Conditions (i)–(iv) of the definition of a radial drawing in Graph Minors XI, Section 3 +(page 75), for the point set `U` and the vertex set `V`. For a painting or a drawing `P` of +Graph Minors XI with `U(P) = U` and `V(P) = V` this is `PaintingOrDrawing.IsPreRadialDrawing` +(`isPreRadial_iff`). The definition never looks at the shape of an edge. -/ +def IsPreRadial {Shat : Type u} [TopologicalSpace Shat] (U V : Set Shat) (G : Drawing Shat) : + Prop := + GM11.IsPreRadialOn U V (componentsIn Uᶜ) G + +/-- A radial drawing `Γ*` in `Σ̂` of a painting `Γ` (Graph Minors XIX, Section 5, page 337): +"A drawing $\Gamma^*$ in $\hat{\Sigma}$ is a *radial drawing* of $\Gamma$ if it satisfies the four +conditions following, where $R^*$ denotes the set of vertices of $\Gamma^*$ that are not in +$V(\Gamma)$: +- $U(\Gamma) \cap U(\Gamma^*) = V(\Gamma) \subseteq V(\Gamma^*)$, +- every region of $\Gamma$ in $\hat{\Sigma}$ contains a unique vertex of $\Gamma^*$, +- $\Gamma^*$ is bipartite, and $(V(\Gamma), R^*)$ is a bipartition of it, +- for every $v \in V(\Gamma)$, the edges of $\Gamma$ and of $\Gamma^*$ incident with $v$ alternate + in their cyclic order around $v$." + +We use the wording of Graph Minors XI, Section 3 (page 75), where the last condition is given +without a cyclic order. Two edges of `Γ*` at `v` that lie in the same corner of a region `r` at `v` +go to the same vertex `r*`, and they bound a disc in `r ∪ {v}`, so `IsPreRadial` allows at most one +edge of `Γ*` in each corner. Maximality gives at least one. Together this is "alternate". + +A painting of Graph Minors XIX may have both line edges and disc edges, and such a painting is +neither a `Surface.Painting` (all closures are discs) nor a `Surface.Drawing` (no closure is a +disc), so `PaintingOrDrawing.IsRadialDrawing` cannot be applied to it directly. We therefore state +XI's conditions for the sets `U(Γ), V(Γ)`, and `RadialDrawing.isRadialDrawing` shows that this is +`PaintingOrDrawing.IsRadialDrawing` for every painting or drawing of XI with these sets. -/ +structure RadialDrawing {Shat : Type u} [TopologicalSpace Shat] + (cap : IsCappedSurface S Shat) (Γ : Painting S) where + /-- The drawing `Γ*` in `Σ̂`. -/ + G : Drawing Shat + /-- The first four conditions. -/ + isPreRadial : IsPreRadial (Γ.hatU cap) (Γ.hatV cap) G + /-- `Γ*` is maximal subject to the first four conditions. -/ + maximal : ∀ G' : Drawing Shat, IsPreRadial (Γ.hatU cap) (Γ.hatV cap) G' → + G.IsSubdrawing G' → G'.IsSubdrawing G + +namespace RadialDrawing + +variable {Shat : Type u} [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} + +/-- `R*`, the set of vertices of `Γ*` that are not in `V(Γ)` (Graph Minors XIX, Section 5, +page 337). -/ +def Rstar (rad : RadialDrawing cap Γ) : Set Shat := rad.G.V \ Γ.hatV cap + +/-- The region of `Γ` in `Σ̂` that contains the point `x`, so that `regionOf r*` is `r`. -/ +noncomputable def regionOf (_ : RadialDrawing cap Γ) (x : Shat) : Set Shat := + connectedComponentIn (Γ.hatU cap)ᶜ x + +/-- The poles (Graph Minors XIX, Section 5, page 337): "if $r \nsubseteq \Sigma$ (and hence $r$ is +a component of $\hat{\Sigma} \setminus \Sigma$) we call $r^*$ a *pole*." -/ +def poles (rad : RadialDrawing cap Γ) : Set Shat := + {w ∈ rad.Rstar | ¬ rad.regionOf w ⊆ range cap.emb} + +/-- The atom of `Γ` belonging to a vertex `x` of `Γ*`: `{x}` for `x ∈ V(Γ)`, and the region `r` for +`x = r*`. Graph Minors XIX, Section 7, page 344, writes `d(r₁*, r₂*)` for the distance between +the atoms `r₁, r₂`, since `r*` lies in `r` and atoms are disjoint. -/ +noncomputable def atomOf (rad : RadialDrawing cap Γ) (x : Shat) : Set Shat := + open Classical in if x ∈ Γ.hatV cap then {x} else rad.regionOf x + +/-- `Γ*` is a radial drawing of each painting or drawing of Graph Minors XI with the same sets. -/ +theorem isRadialDrawing (rad : RadialDrawing cap Γ) {P : PaintingOrDrawing Shat} + (hU : P.U = Γ.hatU cap) (hV : P.V = Γ.hatV cap) (h2 : P.IsTwoCell) : + P.IsRadialDrawing rad.G := by + have hR : P.R = componentsIn (Γ.hatU cap)ᶜ := by + rw [← hU, compl_eq_univ_sdiff] + cases P <;> rfl + have key : ∀ G' : Drawing Shat, P.IsPreRadialDrawing G' ↔ + IsPreRadial (Γ.hatU cap) (Γ.hatV cap) G' := by + intro G' + simp only [PaintingOrDrawing.IsPreRadialDrawing, IsPreRadial, hU, hV, hR] + exact ⟨h2, (key _).2 rad.isPreRadial, fun G' hG' h ↦ rad.maximal G' ((key _).1 hG') h⟩ + +end RadialDrawing + +/-- `dist(Γ)` for an internally 3-connected painting `Γ` with radial drawing `Γ*` (Graph Minors XIX, +Section 5, page 337: "we define $dist(\Gamma)$ to be the minimum of $\frac{1}{2}|E(F)|$, taken over +all paths $F$ +of $\Gamma^*$ with ends distinct poles. (If $c(\Sigma) \le 1$ we set $dist(\Gamma) = +\infty$.)"). The infimum of the empty +set in `ℕ∞` is `∞`. Such a path has even length because `Γ*` is bipartite. -/ +noncomputable def Painting.dist {Shat : Type u} [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} (rad : RadialDrawing cap Γ) : ℕ∞ := + sInf {n : ℕ∞ | ∃ (F : Drawing Shat) (p₁ p₂ : Shat), + p₁ ∈ rad.poles ∧ p₂ ∈ rad.poles ∧ p₁ ≠ p₂ ∧ + F.IsPathOf rad.G p₁ p₂ ∧ n = (F.E.ncard / 2 : ℕ)} + +/-- `rep(Γ)` for a 2-cell painting `Γ` with radial drawing `Γ*` (Graph Minors XIX, Section 5, +page 338: "If $\hat{\Sigma}$ is not a sphere, we define $rep(\Gamma)$ to be the minimum of +$\frac{1}{2}|E(F)|$ over all non-null-homotopic circuits $F$ of $\Gamma^*$. (This exists, by +Theorem 11.10 of [2].) If $\hat{\Sigma}$ is a sphere we set $rep(\Gamma) = \infty$."). On a sphere +every `O`-arc is null-homotopic, so the set below is empty and its infimum in `ℕ∞` is `∞`. -/ +noncomputable def Painting.rep {Shat : Type u} [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} (rad : RadialDrawing cap Γ) : ℕ∞ := + sInf {n : ℕ∞ | ∃ F : Drawing Shat, + F.IsCircuitOf rad.G ∧ ¬ IsNullHomotopicOArc F.U ∧ n = (F.E.ncard / 2 : ℕ)} + +/-! ### Section 6: Inflations and linear inflations -/ + +/-- `rep(G)` for a drawing `G` in a surface `Σ` (Graph Minors XIX, Section 6, page 340: +"If $G$ is a drawing in a surface $\Sigma$, not a sphere, we define $rep(G)$ to be the +minimum of $|F \cap V(G)|$, taken over all non-null-homotopic $G$-normal $O$-arcs $F$ in +$\Sigma$. If $\Sigma$ is a sphere, we set $rep(G) = \infty$."). -/ +noncomputable def Drawing.rep (G : Drawing S) : ℕ∞ := + sInf {n : ℕ∞ | ∃ F : Set S, + IsOArc F ∧ G.IsNormal F ∧ ¬ IsNullHomotopicOArc F ∧ n = ((F ∩ G.V).ncard : ℕ)} + +/-- Two drawings `G, G'` are isomorphic (Graph Minors XIX, Section 6, page 340: +"If $G, G'$ are drawings in $\Sigma, \Sigma'$ respectively we say that $G, G'$ are +*isomorphic* if there is a bijection $\beta : V(G) \cup E(G) \to V(G') \cup E(G')$, mapping +vertices to vertices and edges to edges and preserving incidence"). -/ +def Drawing.IsIsomorphic {S₁ S₂ : Type u} [TopologicalSpace S₁] [TopologicalSpace S₂] + (G : Drawing S₁) (G' : Drawing S₂) : Prop := + ∃ (βv : S₁ → S₂) (βe : Set S₁ → Set S₂), + BijOn βv G.V G'.V ∧ BijOn βe G.E G'.E ∧ + ∀ v ∈ G.V, ∀ e ∈ G.E, v ∈ tilde e ↔ βv v ∈ tilde (βe e) + +/-- An enlargement of a drawing `G` in a drawing `G'` (Graph Minors XIX, Section 6, page 340): +"An *enlargement* of $G$ in $G'$ is a function $\sigma$ with domain $V(G) \cup E(G)$, such +that - for each $e \in E(G)$, $\sigma(e) \in E(G')$, and if $e_1, e_2 \in E(G)$ are distinct +then $\sigma(e_1) \ne \sigma(e_2)$, - for each $v \in V(G)$, $\sigma(v)$ is a non-null +connected subdrawing of $G'$, and if $v_1, v_2 \in V(G)$ are distinct then $\sigma(v_1), +\sigma(v_2)$ are disjoint, - for each $e \in E(G)$ and $v \in V(G)$, $\sigma(v)$ contains an +end of $\sigma(e)$ if and only if $v$ is an end of $e$." -/ +structure IsEnlargement {S₁ S₂ : Type u} [TopologicalSpace S₁] [TopologicalSpace S₂] + (G : Drawing S₁) (G' : Drawing S₂) (σv : S₁ → Drawing S₂) (σe : Set S₁ → Set S₂) : Prop where + edge_mem : ∀ e ∈ G.E, σe e ∈ G'.E + edge_injOn : InjOn σe G.E + vertex_subdrawing : ∀ v ∈ G.V, (σv v).IsSubdrawing G' + vertex_nonempty : ∀ v ∈ G.V, ((σv v).V).Nonempty + vertex_connected : ∀ v ∈ G.V, ((σv v).adj.induce (σv v).V).Preconnected + vertex_disjoint : ∀ v₁ ∈ G.V, ∀ v₂ ∈ G.V, v₁ ≠ v₂ → Disjoint (σv v₁).V (σv v₂).V + ends_iff : ∀ e ∈ G.E, ∀ v ∈ G.V, ((σv v).V ∩ tilde (σe e)).Nonempty ↔ v ∈ tilde e + +/-- A drawing `G` in `Σ` is a block if `G` is non-null and connected, and `G \ v` is connected for +every vertex `v ∈ V(G)` (Graph Minors XIX, Section 6, page 341: "A drawing $G$ in $\Sigma$ is a +*block* if $G$ is non-null and connected, and $G\setminus v$ +is connected for every vertex $v\in V(G)$"). -/ +structure Drawing.IsBlock (G : Drawing S) : Prop where + nonempty_V : G.V.Nonempty + connected : (G.adj.induce G.V).Preconnected + biconnected : ∀ v ∈ G.V, (G.adj.induce (G.V \ {v})).Preconnected + +export Drawing (IsBlock) + +namespace Surface.Drawing + +export GM19.Drawing (rep IsIsomorphic IsBlock) + +end Surface.Drawing + +/-! ### Section 7: Tangles -/ + +/-- `rep(𝒯)` for a tangle `𝒯` of order `ord` in `Γ.toHypergraph` (Graph Minors XIX, Section 7, +page 344: +"We define $rep(\mathscr{T})$ to be the maximum $k\le ord(\mathscr{T})$ such that for every circuit +$F$ of $\Gamma^*$ with $\frac{1}{2}|E(F)| 0$ be some real number, and for each +$v \in V(\Gamma)$ let $\lambda(v) > 0$ be some real number, such that all the $\lambda(e)$’s and +$\lambda(v)$’s are ... rationally independent; that is, +$$\sum (\alpha(e)\lambda(e) : e \in E(\Gamma^*)) = \sum (\beta(v)\lambda(v) : v \in V(\Gamma))$$ +for rationals $\alpha(e), \beta(v)$ only if each $\alpha(e) = 0$ and each $\beta(v) = 0$. Moreover, +let $\lambda(e) < \lambda(f)$ for all $e, f \in E(\Gamma^*)$ such that +$e \subseteq \hat{\Sigma} \setminus \Sigma$ and $f \subseteq \Sigma$. We call $\lambda$ a +tie-breaker in $\Gamma$." -/ +structure TieBreaker {Shat : Type u} [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} (rad : RadialDrawing cap Γ) where + /-- Weight `λ(e) > 0` for `e ∈ E(Γ*)`. -/ + wtE : Set Shat → ℝ + /-- Weight `λ(v) > 0` for `v ∈ V(Γ)`. -/ + wtV : S → ℝ + wtE_pos : ∀ e ∈ rad.G.E, 0 < wtE e + wtV_pos : ∀ v ∈ Γ.V, 0 < wtV v + rationally_independent : ∀ (α : Set Shat → ℚ) (β : S → ℚ), + ∑ᶠ e ∈ rad.G.E, (α e : ℝ) * wtE e = ∑ᶠ v ∈ Γ.V, (β v : ℝ) * wtV v → + (∀ e ∈ rad.G.E, α e = 0) ∧ (∀ v ∈ Γ.V, β v = 0) + cuff_lt_internal : ∀ e ∈ rad.G.E, ∀ f ∈ rad.G.E, + Disjoint e (range cap.emb) → f ⊆ range cap.emb → wtE e < wtE f + +namespace TieBreaker + +variable {Shat : Type u} [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {rad : RadialDrawing cap Γ} + +/-- The first component `N₁ = |V(A ∩ B)|` of the `λ`-order of a separation `(A, B)`. -/ +noncomputable def N1 (_ : TieBreaker rad) (sep : Hypergraph S (Set S) × Hypergraph S (Set S)) : + ℕ := + separationOrder sep.1 sep.2 + +/-- The second component `N₂ = ∑ (λ(e) : e is split by (A, B))` of the `λ`-order. -/ +noncomputable def N2 (tb : TieBreaker rad) (sep : Hypergraph S (Set S) × Hypergraph S (Set S)) : + ℝ := + ∑ᶠ e ∈ {e ∈ rad.G.E | rad.Splits sep.1 sep.2 e}, tb.wtE e + +/-- The third component `N₃ = ∑ (λ(v) : v ∈ V(A ∩ B))` of the `λ`-order. -/ +noncomputable def N3 (tb : TieBreaker rad) (sep : Hypergraph S (Set S) × Hypergraph S (Set S)) : + ℝ := + ∑ᶠ v ∈ (sep.1 ∩ sep.2).vertexSet, tb.wtV v + +/-- The `λ`-order `(N₁, N₂, N₃)` of a separation `(A, B)`, in the lexicographic order (Graph Minors +XIX, Section 8, page 347: "we say that $(A, B)$ has smaller $\lambda$-order than $(A', B')$ if +either $N_1 < N_1'$, or +$N_1 = N_1'$ and $N_2 < N_2'$, or $N_1 = N_1'$ and $N_2 = N_2'$ and $N_3 < N_3'$"). Its values +lie in a linear order, so `GM10.IsTieBreaker`, `GM10.IsDistinction`, `GM18.IsLambdaLinkedTo`, and +`GM18.Isolates` apply to it directly. -/ +noncomputable def lambdaOrder (tb : TieBreaker rad) + (sep : Hypergraph S (Set S) × Hypergraph S (Set S)) : ℕ ×ₗ ℝ ×ₗ ℝ := + toLex (tb.N1 sep, toLex (tb.N2 sep, tb.N3 sep)) + +/-- `λ(K) = ∑_{e ∈ E(K)} λ(e)` for a subdrawing `K` of `Γ*` (Graph Minors XIX, Section 8, +page 348: "If $K$ is a subgraph of $\Gamma^*$, $\lambda(K)$ denotes $\sum_{e \in E(K)} +\lambda(e)$"). -/ +noncomputable def weightSub (tb : TieBreaker rad) (K : Drawing Shat) : ℝ := + ∑ᶠ e ∈ K.E, tb.wtE e + +end TieBreaker + +/-- A circuit `F` of `Γ*` is a `𝒯`-enclave around `𝒯'` (Graph Minors XIX, Section 8, page 348: +"Given a tangle $\mathscr{T}$ in $\Gamma$, a circuit $F$ of $\Gamma^*$ is a +$\mathscr{T}$-enclave if $\frac{1}{2}|E(F)| < rep(\mathscr{T})$, and there is a tangle +$\mathscr{T}'$ in $\Gamma$ for which $(\Gamma \cap ins(F), \Gamma \cap out(F))$ is the +$(\mathscr{T}, \mathscr{T}')$-distinction. We also call $F$ a $\mathscr{T}$-enclave around +$\mathscr{T}'$"). The distinction is that of Graph Minors X, +`GM10.IsDistinction`, for the `λ`-order of `TieBreaker.lambdaOrder`. -/ +def IsEnclaveAround {Shat : Type u} [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {rad : RadialDrawing cap Γ} + (tb : TieBreaker rad) (ord ord' : ℕ) + (𝒯 𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (F : Drawing Shat) : Prop := + GM10.IsTangle Γ.toHypergraph ord' 𝒯' ∧ + F.IsCircuitOf rad.G ∧ F.E.ncard < 2 * tangleRep rad ord 𝒯 ∧ + ∃ Δ : Set Shat, + IsInsOf rad ord 𝒯 F Δ ∧ + GM10.IsDistinction tb.lambdaOrder 𝒯 𝒯' + (Γ.restrict (cap.emb ⁻¹' Δ)) (Γ.restrict (cap.emb ⁻¹' closure Δᶜ)) + +/-- A circuit `F` of `Γ*` is a `𝒯`-enclave if it is a `𝒯`-enclave around some tangle `𝒯'` +(Graph Minors XIX, Section 8, page 348). -/ +def IsEnclave {Shat : Type u} [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {rad : RadialDrawing cap Γ} + (tb : TieBreaker rad) (ord : ℕ) + (𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (F : Drawing Shat) : Prop := + ∃ (ord' : ℕ) (𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))), + IsEnclaveAround tb ord ord' 𝒯 𝒯' F + +/-- `Σ₁, Σ₂` are the closures of the two components of `Σ̂ \ U(F)` (Graph Minors XIX, Section 8, +page 349, and Section 10, page 353). A subset whose complement is not exactly two components has no +such pair. -/ +def IsSidesOf {Shat : Type u} [TopologicalSpace Shat] (F : Drawing Shat) (S₁ S₂ : Set Shat) : Prop + := + ∃ C₁ C₂ : Set Shat, C₁ ≠ C₂ ∧ componentsIn F.Uᶜ = {C₁, C₂} ∧ + S₁ = closure C₁ ∧ S₂ = closure C₂ + +/-- A circuit `F` of `Γ*` is `λ`-linked to `𝒯` (Graph Minors XIX, Section 8, page 349: +"If $F$ is a circuit of $\Gamma^*$ with $\frac{1}{2} |E(F)| < \min(ord(\mathscr{T}), rep(\Gamma))$, +let $\Sigma_1, \Sigma_2$ be the closures of the two components of $\hat{\Sigma} \setminus U(F)$; +then $\mathscr{T}$ contains one of $(\Gamma \cap \Sigma_1, \Gamma \cap \Sigma_2)$, +$(\Gamma \cap \Sigma_2, \Gamma \cap \Sigma_1)$, and if that separation is $\lambda$-linked to +$\mathscr{T}$ we say that $F$ is $\lambda$-*linked (to* $\mathscr{T}$*)*"). The separation is +`λ`-linked in the sense of Graph Minors XVIII, +`GM18.IsLambdaLinkedTo`, which the paper repeats word for word. -/ +def IsLambdaLinkedCircuit {Shat : Type u} [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {rad : RadialDrawing cap Γ} + (tb : TieBreaker rad) (ord : ℕ) + (𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (F : Drawing Shat) : Prop := + F.IsCircuitOf rad.G ∧ (F.E.ncard : ℕ∞) < 2 * min (ord : ℕ∞) (Painting.rep rad) ∧ + ∃ S₁ S₂ : Set Shat, IsSidesOf F S₁ S₂ ∧ + GM18.IsLambdaLinkedTo tb.lambdaOrder 𝒯 + (Γ.restrict (cap.emb ⁻¹' S₁)) (Γ.restrict (cap.emb ⁻¹' S₂)) + +/-- An arm `A` of a painting `Γ` (Graph Minors XIX, Section 8, page 350: +"An *arm* $A$ of a painting $\Gamma$ is a pair $(A^-, \pi(A))$, where $A^-$ is a +subhypergraph of $\Gamma$ and $\pi(A)$ is a march in $V(A^-)$, with the property that there +exists $B \subseteq \Gamma$ such that $(A^-, B)$ is a separation of $\Gamma$ and $V(A^- \cap +B) = \bar{\pi}(A)$"). -/ +structure Arm (Γ : Painting S) where + /-- The subhypergraph `A⁻` of `Γ`. -/ + minus : Hypergraph S (Set S) + /-- The complement `Aᶜ` of `A`. -/ + compl : Hypergraph S (Set S) + /-- `(A⁻, Aᶜ)` is a separation of `Γ.toHypergraph`. -/ + isSeparation : Γ.toHypergraph.IsSeparation minus compl + /-- The boundary march `π(A)`. -/ + π : List S + π_nodup : π.Nodup + π_set : {v | v ∈ π} = (minus ∩ compl).vertexSet + +namespace Arm + +variable {Γ : Painting S} + +/-- The underlying separation `(A⁻, Aᶜ)` of `Γ.toHypergraph`. -/ +def sep (A : Arm Γ) : Hypergraph S (Set S) × Hypergraph S (Set S) := (A.minus, A.compl) + +/-- The vertex set `V(A) = V(A⁻)` of an arm `A`. -/ +def V (A : Arm Γ) : Set S := A.minus.vertexSet + +/-- The edge set `E(A) = E(A⁻)` of an arm `A`. -/ +def E (A : Arm Γ) : Set (Set S) := A.minus.edgeSet + +/-- The order `|πBar(A)|` of an arm `A` (Graph Minors XIX, Section 8, page 350). -/ +noncomputable def order (A : Arm Γ) : ℕ := separationOrder A.minus A.compl + +/-- The arm `A = (A⁻, π(A))` viewed as a shared `RootedHypergraph S (Set S)`. -/ +def toRootedHypergraph (A : Arm Γ) : RootedHypergraph S (Set S) where + toHypergraph := A.minus + roots := A.π + roots_nodup := A.π_nodup + roots_subset v hv := by + have hmem : v ∈ (A.minus ∩ A.compl).vertexSet := by + rw [← A.π_set] + exact hv + exact hmem.1 + +/-- An arm `A` is `λ`-linked to `𝒯` if `(A⁻, Aᶜ)` is `λ`-linked to `𝒯` (Graph Minors XIX, +Section 8, page 350). -/ +def IsLambdaLinked {Shat : Type u} [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} {rad : RadialDrawing cap Γ} + (tb : TieBreaker rad) (𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (A : Arm Γ) : Prop := + GM18.IsLambdaLinkedTo tb.lambdaOrder 𝒯 A.minus A.compl + +end Arm + +/-- A rooted location `ℒ` in a painting `Γ` (Graph Minors XIX, Section 8, page 350: +"A *rooted location* in $\Gamma$ is a set $\mathscr{L}$ of arms, such that that if +$A_1, A_2 \in \mathscr{L}$ with $A^-_1 \ne A^-_2$ then $A^-_1 \subseteq A^c_2$"). The condition +here is for distinct arms, as in Graph Minors XVIII, Section 5, +page 93, whose theorems (9.2) applies: two arms with the same `A⁻` and different marches do not give +a rooted location there. -/ +structure RootedLocation (Γ : Painting S) where + /-- The set of arms in `ℒ`. -/ + arms : Set (Arm Γ) + finite_arms : arms.Finite + disjoint_arms : ∀ A₁ ∈ arms, ∀ A₂ ∈ arms, A₁ ≠ A₂ → A₁.minus ≤ A₂.compl + +namespace RootedLocation + +variable {Γ : Painting S} + +/-- The order `ord(ℒ)` of a rooted location `ℒ` (Graph Minors XIX, Section 8, page 350: +"Its *order* $ord(\mathscr{L})$ is the maximum order of its members (or zero, if $\mathscr{L} += \emptyset$)"). -/ +noncomputable def ord (L : RootedLocation Γ) : ℕ := + sSup (Arm.order '' L.arms) + +/-- The set of separations `ℒ⁻ = {(A⁻, Aᶜ) : A ∈ ℒ}` (Graph Minors XIX, Section 8, page 350). -/ +def seps (L : RootedLocation Γ) : Set (Hypergraph S (Set S) × Hypergraph S (Set S)) := + Arm.sep '' L.arms + +/-- A rooted location `ℒ` with `ℒ⁻ ⊆ 𝒯` is `λ`-linked to `𝒯` if each of its members is `λ`-linked +to `𝒯` (Graph Minors XIX, Section 8, page 350). -/ +def IsLambdaLinked {Shat : Type u} [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} {rad : RadialDrawing cap Γ} + (tb : TieBreaker rad) (𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (L : RootedLocation Γ) : Prop := + L.seps ⊆ 𝒯 ∧ ∀ A ∈ L.arms, A.IsLambdaLinked tb 𝒯 + +/-- A rooted location `ℒ` `θ`-isolates a tangle `𝒯` (Graph Minors XIX, Section 8, page 350: +"A rooted location $\mathscr{L}$ *$\theta$-isolates* a tangle $\mathscr{T}$ if $\mathscr{L}^- +\subseteq \mathscr{T}, ord(\mathscr{L}) < \theta \le ord(\mathscr{T})$, and for every $A \in +\mathscr{L}$ and for every tangle $\mathscr{T}'$ of order $\ge \theta$ with $(A^c, A^-) \in +\mathscr{T}'$, the $(\mathscr{T}, \mathscr{T}')$-distinction $(C, D)$ satisfies $C \subseteq +A^-$ and $A^c \subseteq D$"). -/ +structure Isolates {Shat : Type u} [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} {rad : RadialDrawing cap Γ} + (tb : TieBreaker rad) (L : RootedLocation Γ) (θ ord : ℕ) + (𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) : Prop where + seps_subset : L.seps ⊆ 𝒯 + ord_lt : L.ord < θ + le_ord : θ ≤ ord + distinction_le : ∀ A ∈ L.arms, ∀ (ord' : ℕ) + (𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))), + GM10.IsTangle Γ.toHypergraph ord' 𝒯' → θ ≤ ord' → A.sep.swap ∈ 𝒯' → + ∀ C D : Hypergraph S (Set S), + GM10.IsDistinction tb.lambdaOrder 𝒯 𝒯' C D → C ≤ A.minus ∧ A.compl ≤ D + +end RootedLocation + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Defs3.lean b/LeanPool/GraphMinor/GM19/Defs3.lean new file mode 100644 index 0000000000..9c6fb85719 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Defs3.lean @@ -0,0 +1,685 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Defs2 +public import LeanPool.GraphMinor.Surface.TopologyStatements + +/-! +# Definitions for Graph Minors XIX, Sections 9–14 + +This file formalizes the remaining definitions of N. Robertson and P. D. Seymour, +*Graph Minors. XIX. Well-quasi-ordering on a surface*, J. Combin. Theory Ser. B **90** (2004), +325–385, Sections 9–14: + +- **Section 9 (pages 351–353):** Disjoint colour schemes (`ColourScheme.IsDisjoint`, + `ColourScheme.unionWQO`), inflations of subhypergraphs (`IsSubInflationIn`), + $M(\Gamma, \mathscr{L})$ (`RootedLocation.M`), outlines (`IsOutline`), $\chi$-places (`Place`), + and well-behaved sets of $\chi$-places (`IsWellBehavedPlaces`). +- **Section 10 (pages 353–357):** Tangle flaws: representativeness flaws (`IsRepFlaw`), distance + flaws (`IsFlawedInDistance`), and freedom flaws (`IsFlawedInFreedom`). +- **Section 11 (pages 357–361):** Border label flaws: bites at a pole $r^*$ (`IsBiteAt`), their + arcs (`IsBiteArc`, `biteArc`), the + border distance $l(e_1, e_2)$ (`borderEdgeDist`), $(n, (\omega_1, \dots, \omega_m))$-flaws on a + long side $S$ (`IsFlawedOnSide`), feasts (`IsFeast`), disjoint feasts (`IsDisjointFeast`), and + $((\omega_1, \dots, \omega_m), S)$-flaws (`IsSideLabelFlaw`). +- **Section 12 (pages 362–365):** Internal label flaws: $(m, n, \omega_0)$-internal flaws + (`IsFlawedInternally`), wheels (`IsWheel`), $W$-hubs of radius $\rho$ (`IsWheelHubOfRadius`), + wheel radius (`wheelRadius`), and wheel covers (`IsWheelCover`). +- **Section 13 (pages 366–375):** Spokes of a wheel (`IsSpoke`), inner ends of spokes, optimal + $W$-hubs (`IsOptimalWheelHub`), boundary sector discs $\Delta_v$ and boundary sector circuits + $D_v$ (`IsBoundarySector`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology +open GraphMinor.Surface GraphMinor.Hypergraph + +universe u w + +variable {S : Type u} [TopologicalSpace S] {α : Type w} + +/-! ## Section 9: Disjoint colour schemes, outlines, and places -/ + +open Classical in +/-- A colour scheme `χ` is *disjoint* if `Ω_χ(3)`, `Ω_χ(2)` and all the `Ω_χ(S)`'s (over all sides +`S` of `Φ_χ`) have mutually disjoint element sets (Graph Minors XIX, Section 9, page 351: +"A colour scheme $\chi$ is *disjoint* if $\Omega_{\chi}(3)$, $\Omega_{\chi}(2)$ and all the +$\Omega_{\chi}(S)$'s (over all sides $S$ of $\Phi_{\chi}$) have mutually disjoint element +sets, and if $\chi$ is disjoint we denote the union of these well-quasi-orders by +$\Omega_{\chi}$"). -/ +structure ColourScheme.IsDisjoint (χ : ColourScheme S α) : Prop where + disj_2_3 : Disjoint χ.Ω2.E χ.Ω3.E + disj_2_S : ∀ s ∈ χ.Φ.sides, Disjoint χ.Ω2.E (χ.ΩS s).E + disj_3_S : ∀ s ∈ χ.Φ.sides, Disjoint χ.Ω3.E (χ.ΩS s).E + disj_S_S : ∀ s₁ ∈ χ.Φ.sides, ∀ s₂ ∈ χ.Φ.sides, s₁ ≠ s₂ → Disjoint (χ.ΩS s₁).E (χ.ΩS s₂).E + +open Classical in +/-- The union quasi-order `Ω_χ` of `Ω_χ(2)`, `Ω_χ(3)`, and `Ω_χ(S)` over all sides `S` of `Φ_χ` +(Graph Minors XIX, Section 9, page 351: +"If $\Omega_1, \ldots, \Omega_k$ are well-quasi-orders with $E(\Omega_1), \ldots, +E(\Omega_k)$ mutually disjoint, we define their union to be the well-quasi-order $\Omega$ +with $E(\Omega) = E(\Omega_1) \cup \cdots \cup E(\Omega_k)$, in which $x \le y$ if and only +if $x, y \in E(\Omega_i)$ for some $i$ and $x \le y$ in $\Omega_i$"). -/ +def ColourScheme.unionWQO {χ : ColourScheme S α} (hdisj : χ.IsDisjoint) : QuasiOrder α where + E := χ.Ω2.E ∪ χ.Ω3.E ∪ ⋃ s ∈ χ.Φ.sides, (χ.ΩS s).E + le x y := + (x ∈ χ.Ω2.E ∧ y ∈ χ.Ω2.E ∧ χ.Ω2.le x y) ∨ + (x ∈ χ.Ω3.E ∧ y ∈ χ.Ω3.E ∧ χ.Ω3.le x y) ∨ + (∃ s ∈ χ.Φ.sides, x ∈ (χ.ΩS s).E ∧ y ∈ (χ.ΩS s).E ∧ (χ.ΩS s).le x y) + refl x hx := by + rcases hx with (hx2 | hx3) | hxS + · exact Or.inl ⟨hx2, hx2, χ.Ω2.refl x hx2⟩ + · exact Or.inr (Or.inl ⟨hx3, hx3, χ.Ω3.refl x hx3⟩) + · rcases mem_iUnion₂.mp hxS with ⟨s, hs, hxs⟩ + exact Or.inr (Or.inr ⟨s, hs, hxs, hxs, (χ.ΩS s).refl x hxs⟩) + trans x _ y _ z _ hxy hyz := by + rcases hxy with ⟨hx2, hy2, h1⟩ | ⟨hx3, hy3, h1⟩ | ⟨s, hs, hxs, hys, h1⟩ + · rcases hyz with ⟨_, hz2, h2⟩ | ⟨hy3, _, _⟩ | ⟨s, hs, hys, _, _⟩ + · exact Or.inl ⟨hx2, hz2, χ.Ω2.trans x hx2 y hy2 z hz2 h1 h2⟩ + · exact False.elim (hdisj.disj_2_3.le_bot ⟨hy2, hy3⟩) + · exact False.elim ((hdisj.disj_2_S s hs).le_bot ⟨hy2, hys⟩) + · rcases hyz with ⟨hy2, _, _⟩ | ⟨_, hz3, h2⟩ | ⟨s, hs, hys, _, _⟩ + · exact False.elim (hdisj.disj_2_3.le_bot ⟨hy2, hy3⟩) + · exact Or.inr (Or.inl ⟨hx3, hz3, χ.Ω3.trans x hx3 y hy3 z hz3 h1 h2⟩) + · exact False.elim ((hdisj.disj_3_S s hs).le_bot ⟨hy3, hys⟩) + · rcases hyz with ⟨hy2, _, _⟩ | ⟨hy3, _, _⟩ | ⟨s', hs', hys', hzs', h2⟩ + · exact False.elim ((hdisj.disj_2_S s hs).le_bot ⟨hy2, hys⟩) + · exact False.elim ((hdisj.disj_3_S s hs).le_bot ⟨hy3, hys⟩) + · by_cases hss : s = s' + · subst hss + exact Or.inr (Or.inr ⟨s, hs, hxs, hzs', (χ.ΩS s).trans x hxs y hys z hzs' h1 h2⟩) + · exact False.elim ((hdisj.disj_S_S s hs s' hs' hss).le_bot ⟨hys, hys'⟩) + +open Classical in +/-- Relation `x ≤ y` in `Ω_χ` (without requiring the disjointness proof in the type). -/ +def ColourScheme.unionLE (χ : ColourScheme S α) (x y : α) : Prop := + (x ∈ χ.Ω2.E ∧ y ∈ χ.Ω2.E ∧ χ.Ω2.le x y) ∨ + (x ∈ χ.Ω3.E ∧ y ∈ χ.Ω3.E ∧ χ.Ω3.le x y) ∨ + (∃ s ∈ χ.Φ.sides, x ∈ (χ.ΩS s).E ∧ y ∈ (χ.ΩS s).E ∧ (χ.ΩS s).le x y) + +open Classical in +/-- An inflation of a subhypergraph `H ⊆ Γ` in a painting `Γ'` (Graph Minors XIX, Section 9, +page 351: +"If $\Gamma, \Gamma'$ are paintings in $\Sigma$, and $H \subseteq \Gamma$ is a subhypergraph, +an *inflation* of $H$ in $\Gamma'$ is a function $\sigma$ with domain $V(H) \cup E(H)$ +satisfying the three conditions of the definition of inflation in Section 2 with $\Gamma$ +replaced by $H$"). -/ +structure IsSubInflationIn (Γ : Painting S) (H : Hypergraph S (Set S)) (Γ' : Painting S) + (σv : S → Set S) (σe : Set S → Set S) : Prop where + H_le : H ≤ Γ.toHypergraph + edge_mem : ∀ e ∈ H.edgeSet, σe e ∈ Γ'.E + edge_size : ∀ e ∈ H.edgeSet, (tilde (σe e)).ncard = (tilde e).ncard + edge_injOn : InjOn σe H.edgeSet + vertex_nonempty : ∀ v ∈ H.vertexSet, (σv v).Nonempty + vertex_subset : ∀ v ∈ H.vertexSet, σv v ⊆ Γ'.V + vertex_connected : ∀ v ∈ H.vertexSet, (Γ'.skAdj.induce (σv v)).Preconnected + vertex_disjoint : ∀ v₁ ∈ H.vertexSet, ∀ v₂ ∈ H.vertexSet, v₁ ≠ v₂ → Disjoint (σv v₁) (σv v₂) + ends : ∀ e ∈ H.edgeSet, ∀ (i : ℕ) (hi : i < (Γ.γ e).length) (hi' : i < (Γ'.γ (σe e)).length), + (Γ'.γ (σe e))[i] ∈ σv (Γ.γ e)[i] + +open Classical in +/-- The complementary subhypergraph `M(Γ, ℒ) = Γ ∩ ⋂ (Aᶜ : A ∈ ℒ)` of a rooted location `ℒ` in a +painting `Γ` (Graph Minors XIX, Section 9, page 351: +"If $\mathscr{L}$ is a rooted location in $\Gamma$ we define $M(\Gamma, \mathscr{L})$ to be +$$\Gamma \cap \bigcap (A^c : A \in \mathscr{L})"). -/ +def RootedLocation.M {Γ : Painting S} (L : RootedLocation Γ) : Hypergraph S (Set S) where + vertexSet := {v ∈ Γ.V | ∀ A ∈ L.arms, v ∈ A.compl.vertexSet} + edgeSet := {e ∈ Γ.E | ∀ A ∈ L.arms, e ∈ A.compl.edgeSet} + Inc e v := (e ∈ Γ.E ∧ ∀ A ∈ L.arms, e ∈ A.compl.edgeSet) ∧ v ∈ Γ.V ∧ v ∈ tilde e + vertex_mem_of_inc e v h := ⟨h.2.1, fun A hA ↦ by + have heA : e ∈ A.compl.edgeSet := h.1.2 A hA + have hends : A.compl.ends e = Γ.toHypergraph.ends e := (A.isSeparation.right_le.ends_eq e + heA).symm + have hv_end : v ∈ A.compl.ends e := by + rw [hends] + exact ⟨h.1.1, h.2.1, h.2.2⟩ + exact A.compl.vertex_mem_of_inc hv_end⟩ + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := Γ.finite_V.subset fun _ hv ↦ hv.1 + edgeSet_finite := Γ.finite_edges.subset fun _ he ↦ he.1 + +open Classical in +theorem RootedLocation.M_le {Γ : Painting S} (L : RootedLocation Γ) : + L.M ≤ Γ.toHypergraph where + vertexSet_subset _ hv := hv.1 + edgeSet_subset _ he := he.1 + ends_eq _ he := by + ext v + simp only [Hypergraph.ends, RootedLocation.M, Painting.toHypergraph] + exact ⟨fun h ↦ ⟨he, h.2.1, h.2.2⟩, fun h ↦ ⟨he.1, h.2.1, h.2.2⟩⟩ + +open Classical in +/-- A `χ`-place `(Γ, φ, ℒ)` consists of a `χ`-coloured painting `(Γ, φ)` together with a rooted +location `ℒ` in `Γ` (Graph Minors XIX, Section 9, page 352: +"If $\chi$ is disjoint, $(\Gamma, \phi)$ is a $\chi$-coloured painting, and $\mathscr{L}$ is +a rooted location in $\Gamma$, we call $(\Gamma, \phi, \mathscr{L})$ a $\chi$-*place"). -/ +structure Place (χ : ColourScheme S α) where + /-- `χ` is disjoint. -/ + disjoint : χ.IsDisjoint + /-- The underlying `χ`-coloured painting `(Γ, φ)`. -/ + P : ColouredPainting χ + /-- The rooted location `ℒ` in `Γ`. -/ + L : RootedLocation P.Γ + +open Classical in +/-- An outline `τ : ℒ → ℒ'` of a `χ`-place `(Γ, φ, ℒ)` in `(Γ', φ', ℒ')` (Graph Minors XIX, +Section 9, page 351: +"A function $\tau \colon \mathscr{L} \to \mathscr{L}'$ is an *outline* of $(\Gamma, \phi, +\mathscr{L})$ in $(\Gamma', \phi', \mathscr{L}')$ if there is an inflation $\sigma$ of +$M(\Gamma, \mathscr{L})$ in $\Gamma'$, such that • $\sigma(e) \in E(M(\Gamma', +\mathscr{L}'))$ for each $e \in E(M(\Gamma, \mathscr{L}))$, • for each $A \in \mathscr{L}$, +$|\bar{\pi}(\tau(A))| = |\bar{\pi}(A)|$, and if $A_1, A_2 \in \mathscr{L}$ are distinct then +$\tau(A_1) \ne \tau(A_2)$, • for each $A \in \mathscr{L}$ and $1 \le i \le |\bar{\pi}(A)|$, +if $v$ is the $i$th term of $\pi(A)$ then $\sigma(v)$ contains the $i$th term of +$\pi(\tau(A))$, • for each $A \in \mathscr{L}$ and $v \in V(M(\Gamma, \mathscr{L}))$, +$|V(\sigma(v)) \cap V(\tau(A))| \le 1$, • for each $e \in E(M(\Gamma, \mathscr{L}))$, +$\phi(e) \le \phi'(\sigma(e))$ in $\Omega_{\chi}$"). -/ +def IsOutline {χ : ColourScheme S α} (X Y : Place χ) + (τ : Arm X.P.Γ → Arm Y.P.Γ) : Prop := + (∀ A ∈ X.L.arms, τ A ∈ Y.L.arms) ∧ + InjOn τ X.L.arms ∧ + ∃ (σv : S → Set S) (σe : Set S → Set S), + IsSubInflationIn X.P.Γ X.L.M Y.P.Γ σv σe ∧ + (∀ e ∈ X.L.M.edgeSet, σe e ∈ Y.L.M.edgeSet) ∧ + (∀ A ∈ X.L.arms, (τ A).π.length = A.π.length ∧ + ∀ (i : ℕ) (hi : i < A.π.length) (hi' : i < (τ A).π.length), + (τ A).π[i] ∈ σv (A.π[i])) ∧ + (∀ A ∈ X.L.arms, ∀ v ∈ X.L.M.vertexSet, (σv v ∩ (τ A).V).ncard ≤ 1) ∧ + (∀ e ∈ X.L.M.edgeSet, χ.unionLE (X.P.φ e) (Y.P.φ (σe e))) + +open Classical in +/-- A set `P` of `χ`-places is *well-behaved* (Graph Minors XIX, Section 9, page 352: +"A set $\mathscr{P}$ of $\chi$-places is *well-behaved* if for every well-quasi-order +$\Omega$ and every countable sequence $(\Gamma_i, \phi_i, \mathscr{L}_i)$ ($i = 1, 2, +\ldots$) of members of $\mathscr{P}$, and for all functions $\xi_i \colon \mathscr{L}_i \to +E(\Omega)$, there exist $j > i \ge 1$ and an outline $\tau$ of $(\Gamma_i, \phi_i, +\mathscr{L}_i)$ in $(\Gamma_j, \phi_j, \mathscr{L}_j)$ such that $\xi_i(A) \le +\xi_j(\tau(A))$ for all $A \in \mathscr{L}_i$"). -/ +def IsWellBehavedPlaces {χ : ColourScheme S α} (P_set : Set (Place χ)) : Prop := + ∀ {β : Type (max u w)} (Ω : QuasiOrder β), Ω.IsWQO → + ∀ (seq : ℕ → Place χ), (∀ i, seq i ∈ P_set) → + ∀ (ξ : ∀ i, Arm (seq i).P.Γ → β), + (∀ i, ∀ A ∈ (seq i).L.arms, ξ i A ∈ Ω.E) → + ∃ i j, i < j ∧ ∃ τ : Arm (seq i).P.Γ → Arm (seq j).P.Γ, + IsOutline (seq i) (seq j) τ ∧ + ∀ A ∈ (seq i).L.arms, Ω.le (ξ i A) (ξ j (τ A)) + +open Classical in +/-- Two `χ`-places `X` and `Y` are related by a `Φ_χ`-preserving homeomorphism `f : S ≃ₜ S` +(Graph Minors XIX, Section 9, page 353: +"We define the image of a $\chi$-place under a $\Phi_\chi$-preserving homeomorphism in the +natural way"). -/ +def IsPlaceHomeoImage {χ : ColourScheme S α} (X Y : Place χ) (f : S ≃ₜ S) : Prop := + IsFramePreservingHomeo χ.Φ f ∧ + f '' X.P.Γ.U = Y.P.Γ.U ∧ + f '' X.P.Γ.V = Y.P.Γ.V ∧ + (∀ e ∈ X.P.Γ.E, Y.P.Γ.γ (f '' e) = (X.P.Γ.γ e).map f ∧ Y.P.φ (f '' e) = X.P.φ e) ∧ + ∃ g : Arm X.P.Γ → Arm Y.P.Γ, + BijOn g X.L.arms Y.L.arms ∧ + ∀ A ∈ X.L.arms, + (g A).minus.vertexSet = f '' A.minus.vertexSet ∧ + (g A).minus.edgeSet = (fun e => f '' e) '' A.minus.edgeSet ∧ + (g A).compl.vertexSet = f '' A.compl.vertexSet ∧ + (g A).compl.edgeSet = (fun e => f '' e) '' A.compl.edgeSet ∧ + (g A).π = A.π.map f + +/-! ## Section 10: Tangle flaws -/ + +open Classical in +/-- A datum `(Γ, φ, λ, 𝒯) ∈ 𝒟` as in Section 10 (Graph Minors XIX, Section 10, page 353: +"Let $\mathscr{D}$ be the set of all quadruples $(\Gamma, \phi, \lambda, \mathscr{T})$ such +that $(\Gamma, \phi) \in \mathscr{S}$, $\lambda$ is a tie-breaker in $\Gamma$, and +$\mathscr{T}$ is a tangle in $\Gamma$"). -/ +structure TangleDatum {Shat : Type u} [TopologicalSpace Shat] + (cap : IsCappedSurface S Shat) (χ : ColourScheme S α) where + /-- The `χ`-coloured painting `(Γ, φ)`. -/ + P : ColouredPainting χ + /-- The radial drawing `Γ*` of `Γ` in `Σ̂_χ`. -/ + rad : RadialDrawing cap P.Γ + /-- The tie-breaker `λ` in `Γ`. -/ + tb : TieBreaker rad + /-- The order `ord(𝒯)` of the tangle `𝒯`. -/ + ord : ℕ + /-- The set of separations in the tangle `𝒯`. -/ + 𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S)) + /-- `𝒯` is a tangle of order `ord` in `Γ.toHypergraph`. -/ + isTangle : GM10.IsTangle P.Γ.toHypergraph ord 𝒯 + +namespace TangleDatum + +variable {Shat : Type u} [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +open Classical in +/-- The painting `Γ` of a `TangleDatum`. -/ +def Γ (D : TangleDatum cap χ) : Painting S := D.P.Γ + +open Classical in +/-- The representativeness `rep(𝒯)` of the tangle in `D`. -/ +noncomputable def rep (D : TangleDatum cap χ) : ℕ := + tangleRep D.rad D.ord D.𝒯 + +open Classical in +/-- The metric `d` of `𝒯` on `A(Γ)`. -/ +noncomputable def dist (D : TangleDatum cap χ) (a b : Set Shat) : ℕ := + tangleMetric D.rad D.ord D.𝒯 a b + +open Classical in +/-- The metric `d(x, y)` between vertices of `Γ*`, each read as its atom. -/ +noncomputable def vDist (D : TangleDatum cap χ) (x y : Shat) : ℕ := + D.dist (D.rad.atomOf x) (D.rad.atomOf y) + +open Classical in +/-- The metric `d(e, x)` between an edge `e ∈ E(Γ)` and a vertex `x ∈ V(Γ*)`. -/ +noncomputable def edgeVertDist (D : TangleDatum cap χ) (e : Set S) (x : Shat) : ℕ := + D.dist (cap.emb '' e) (D.rad.atomOf x) + +open Classical in +/-- The metric `d(e₁, e₂)` between two edges `e₁, e₂ ∈ E(Γ)`. -/ +noncomputable def edgeDist (D : TangleDatum cap χ) (e₁ e₂ : Set S) : ℕ := + D.dist (cap.emb '' e₁) (cap.emb '' e₂) + +open Classical in +/-- The inside `ins(F)` of a circuit `F` of `Γ*` with respect to `𝒯`. -/ +noncomputable def ins (D : TangleDatum cap χ) (F : Drawing Shat) : Set Shat := + if h : ∃ Δ : Set Shat, IsInsOf D.rad D.ord D.𝒯 F Δ then Classical.choose h else ∅ + +open Classical in +/-- A circuit `F` of `Γ*` is a *representativeness flaw* for `(Γ, φ, λ, 𝒯)` (Graph Minors XIX, +Section 10, page 353: +"Let $(\Gamma, \phi, \lambda, \mathscr{T}) \in \mathscr{D}$, such that +$rep(\Gamma), ord(\mathscr{T}) > rep(\mathscr{T})$. Then $\hat{\Sigma}_\chi$ is not a sphere, and +there is a circuit $F$ of $\Gamma^*$ with $\frac{1}{2}|E(F)| \le rep(\mathscr{T})$ such that +$\Sigma_1$ is not a disc, where $\Sigma_1, \Sigma_2$ are the closures of the two components of +$\hat{\Sigma}_\chi \setminus U(F)$ and $(\Gamma \cap \Sigma_1, \Gamma \cap \Sigma_2) \in +\mathscr{T}$. (It follows that $\frac{1}{2}|E(F)| = rep(\mathscr{T})$ for every such $F$.) Let us +choose such a circuit $F$ with $\lambda(F)$ minimal. We call $F$ a *representativeness flaw* for +$(\Gamma, \phi, \lambda, \mathscr{T})$"). -/ +structure IsRepFlaw (D : TangleDatum cap χ) (F : Drawing Shat) : Prop where + lt_rep_Γ : (D.rep : ℕ∞) < Painting.rep D.rad + lt_ord_T : D.rep < D.ord + not_sphere : ¬ IsSphere Shat + is_circuit : F.IsCircuitOf D.rad.G + card_le : F.E.ncard ≤ 2 * D.rep + has_non_disc : ∃ S₁ S₂ : Set Shat, IsSidesOf F S₁ S₂ ∧ ¬ IsClosedDisc S₁ ∧ + (D.Γ.restrict (cap.emb ⁻¹' S₁), D.Γ.restrict (cap.emb ⁻¹' S₂)) ∈ D.𝒯 + minimal_weight : ∀ F' : Drawing Shat, F'.IsCircuitOf D.rad.G → + F'.E.ncard ≤ 2 * D.rep → + (∃ S₁' S₂' : Set Shat, IsSidesOf F' S₁' S₂' ∧ ¬ IsClosedDisc S₁' ∧ + (D.Γ.restrict (cap.emb ⁻¹' S₁'), D.Γ.restrict (cap.emb ⁻¹' S₂')) ∈ D.𝒯) → + D.tb.weightSub F ≤ D.tb.weightSub F' + +open Classical in +/-- A datum `(Γ, φ, λ, 𝒯) ∈ 𝒟` is *$n$-flawed in distance* (Graph Minors XIX, Section 10, page 355: +"More precisely, for $n \ge 1$ an integer, let us say that $(\Gamma, \phi, \lambda, +\mathscr{T}) \in \mathscr{D}$ is *$n$-flawed in distance* if $rep(\mathscr{T}) > n$, and +$dist(\Gamma) > \frac{1}{2}n + 1$, and there are distinct poles $r_1^*, r_2^*$ with +$d(r_1^*, r_2^*) \le n$"). -/ +def IsFlawedInDistance (D : TangleDatum cap χ) (n : ℕ) : Prop := + n < D.rep ∧ + ((n + 2 : ℕ) : ℕ∞) < 2 * Painting.dist D.rad ∧ + ∃ r₁ ∈ D.rad.poles, ∃ r₂ ∈ D.rad.poles, r₁ ≠ r₂ ∧ D.vDist r₁ r₂ ≤ n + +open Classical in +/-- A datum `(Γ, φ, λ, 𝒯) ∈ 𝒟` is *$n$-flawed in freedom* (Graph Minors XIX, Section 10, page 357: +"We say that $(\Gamma, \phi, \lambda, \mathscr{T}) \in \mathscr{D}$ is *$n$-flawed in +freedom* if $rep(\mathscr{T}) > n$, and $d(r^*_1, r^*_2) > n$ for every two distinct poles +$r^*_1, r^*_2$, and there is a circuit $F$ of $\Gamma^*$ with $\frac{1}{2}|E(F)| \le n$ such +that $ins(F)$ includes a long side of $\Phi_\chi$ or more than $\frac{1}{2}|E(F)|$ vertices +of $\Phi_\chi$"). -/ +def IsFlawedInFreedom (D : TangleDatum cap χ) (n : ℕ) : Prop := + n < D.rep ∧ + (∀ r₁ ∈ D.rad.poles, ∀ r₂ ∈ D.rad.poles, r₁ ≠ r₂ → n < D.vDist r₁ r₂) ∧ + ∃ F : Drawing Shat, F.IsCircuitOf D.rad.G ∧ F.E.ncard ≤ 2 * n ∧ + ((∃ side ∈ χ.Φ.longSides, cap.emb '' side ⊆ D.ins F) ∨ + F.E.ncard < 2 * ((cap.emb '' χ.Φ.V) ∩ D.ins F).ncard) + +/-! ## Section 11: Border label flaws -/ + +open Classical in +/-- A circuit `F` of `Γ*` is a *bite at `r*`* if `½|E(F)| < rep(𝒯)` and `r* ∈ V(F)` (Graph Minors +XIX, Section 11, page 357: +"By a *bite at $r^*$* we mean a circuit $F$ of $\Gamma^*$ with $\frac{1}{2}|E(F)| < +rep(\mathscr{T})$, such that $r^* \in V(F)$"). -/ +structure IsBiteAt (D : TangleDatum cap χ) (rstar : Shat) (F : Drawing Shat) : Prop where + pole_mem : rstar ∈ D.rad.poles + is_circuit : F.IsCircuitOf D.rad.G + card_lt : F.E.ncard < 2 * D.rep + rstar_mem : rstar ∈ F.V + +open Classical in +/-- The border distance `l(e₁, e₂)` between two edges `e₁, e₂ ∈ E(Γ)` bordering the same cuff +(Graph Minors XIX, Section 11, page 357: +"If $e_1, e_2$ are edges of $\Gamma$ bordering $\bar{r}\setminus r$, we define $l(e_1, e_2)$ +to be the minimum of $\frac{1}{2}|E(F)|$ over all bites $F$ at $r^*$ with $e_1, e_2 +\subseteq ins(F)$, if there is such a bite, and otherwise $l(e_1, e_2) = rep(\mathscr{T})$"). -/ +noncomputable def borderEdgeDist (D : TangleDatum cap χ) (rstar : Shat) (e₁ e₂ : Set S) : ℕ := + if _h : ∃ F : Drawing Shat, D.IsBiteAt rstar F ∧ + cap.emb '' e₁ ⊆ D.ins F ∧ cap.emb '' e₂ ⊆ D.ins F then + sInf {k : ℕ | ∃ F : Drawing Shat, D.IsBiteAt rstar F ∧ + cap.emb '' e₁ ⊆ D.ins F ∧ cap.emb '' e₂ ⊆ D.ins F ∧ F.E.ncard = 2 * k} + else + D.rep + +open Classical in +/-- The edges `e₁, …, eₘ` lie on `side` in order: they are distinct, and each comes before the next +on the cuff `c`, reading `side` from its tail `u₀` to its head `u₁`. -/ +def BordersInOrder (χ : ColourScheme S α) (Γ : Painting S) (side c : Set S) {m : ℕ} + (e : Fin m → Set S) (u₀ u₁ : S) : Prop := + (χ.Φ.γ side).head? = some u₀ ∧ (χ.Φ.γ side).getLast? = some u₁ ∧ Function.Injective e ∧ + (∀ i : Fin m, e i ∈ Γ.E ∧ e i ⊆ side) ∧ + ∀ i j : Fin m, i < j → ∀ x ∈ e i, ∀ y ∈ e j, InOrderOn c u₀ x y u₁ + +open Classical in +/-- The last condition in the definition of "flawed on `S`": "there do not exist distinct edges +$e_1, \dots, e_m \in E(\Gamma)$ bordering $S$ in order, +such that $\phi(e_i) \ge \omega_i$ ($1 \le i \le m$), and $l(e_i, e_j) > n$ ($1 \le i < j +\le m$) and $l(e_i, s) > n$ ($1 \le i \le m$) for every short side $s$ bordering the same +cuff as $S$" (Graph Minors XIX, Section 11, page 358). -/ +def NoSideMatch (D : TangleDatum cap χ) (side : Set S) (n : ℕ) (ω : List α) : Prop := + ∀ rstar ∈ D.rad.poles, ∀ c ∈ cuffs S, rstar ∈ cap.cuffDisc c → side ⊆ c → + ¬ ∃ (e : Fin ω.length → Set S) (u₀ u₁ : S), BordersInOrder χ D.Γ side c e u₀ u₁ ∧ + (∀ (i : Fin ω.length), (χ.ΩS side).le (ω[i.val]) (D.P.φ (e i))) ∧ + (∀ i j : Fin ω.length, i < j → n < D.borderEdgeDist rstar (e i) (e j)) ∧ + (∀ i : Fin ω.length, ∀ s ∈ χ.Φ.shortSides, s ⊆ c → n < D.borderEdgeDist rstar (e i) s) + +open Classical in +/-- A datum `(Γ, φ, λ, 𝒯) ∈ 𝒟` is *`(n, (ω₁, …, ωₘ))`-flawed on `S`* (Graph Minors XIX, +Section 11, pages 357–358: +"Let $S$ be a long side of $\Phi_\chi$, let $m \ge 1$, let $\omega_1, \dots, \omega_m$ be a +sequence of elements of $\Omega_\chi(S)$, and let $n \ge 4$. We say that $(\Gamma, \phi, +\lambda, \mathscr{T}) \in \mathscr{D}$ is $(n, (\omega_1, \dots, \omega_m))$-*flawed on $S$* +if - $rep(\mathscr{T}) \ge 2(m + 1)n + 8$, and $dist(\Gamma) \ge \frac{1}{2}(m + 1)n + 1$, - +$(\Gamma, \phi, \lambda, \mathscr{T})$ is not $(m + 1)n$-flawed in distance, - $(\Gamma, +\phi, \lambda, \mathscr{T})$ is not $(m + 1)n$-flawed in freedom, and ... - there do not exist +distinct edges $e_1, \dots, e_m \in E(\Gamma)$ bordering $S$ in order, such that $\phi(e_i) +\ge \omega_i$ ($1 \le i \le m$), and $l(e_i, e_j) > n$ ($1 \le i < j \le m$) and $l(e_i, s) +> n$ ($1 \le i \le m$) for every short side $s$ bordering the same cuff as $S$"). The bound on +> `dist(Γ)` is strict here. +With equality, "not `(m + 1)n`-flawed in distance" says nothing, since being flawed asks for +`dist(Γ) > ½(m + 1)n + 1`, while the proof of (11.2) needs that poles are far apart. The proof of +(4.1) has the strict bound. -/ +def IsFlawedOnSide (D : TangleDatum cap χ) (side : Set S) (n : ℕ) + (ω : List α) : Prop := + let m := ω.length + 2 * (m + 1) * n + 8 ≤ D.rep ∧ + (((m + 1) * n + 2 : ℕ) : ℕ∞) < 2 * Painting.dist D.rad ∧ + ¬ D.IsFlawedInDistance ((m + 1) * n) ∧ + ¬ D.IsFlawedInFreedom ((m + 1) * n) ∧ + D.NoSideMatch side n ω + +open Classical in +/-- `I` is an arc in `ins(F) ∩ (rBar \ r)` joining the two neighbours in `F` of `r*`. When the +circuit +`F` has length two the two neighbours coincide, and the arc is that one vertex. -/ +def IsBiteArc (D : TangleDatum cap χ) (rstar : Shat) (F : Drawing Shat) (I : Set Shat) : Prop := + I ⊆ D.ins F ∩ (closure (D.rad.regionOf rstar) \ D.rad.regionOf rstar) ∧ + ∃ u v : Shat, {x | ∃ e ∈ F.E, closure e ∩ F.V = {rstar, x}} = {u, v} ∧ + ((u = v ∧ I = {u}) ∨ (u ≠ v ∧ IsLineWithEnds I u v)) + +open Classical in +/-- The I-arc `I(F) ⊆ ins(F) ∩ (rBar \ r)` of a bite `F` at `r*` joining the two neighbours in `F` +of +`r*` (Graph Minors XIX, Section 11, page 358: +"If $F$ is a bite at $r^*$, we define $I(F)$ to be the I-arc in $ins(F) \cap (\bar{r} +\setminus r)$ joining the two neighbours in $F$ of $r"). The two arcs of the cuff between these +neighbours lie on different +sides of `F`, so this arc is unique, and the union below is that arc. -/ +def biteArc (D : TangleDatum cap χ) (rstar : Shat) (F : Drawing Shat) : Set Shat := + ⋃₀ {I | D.IsBiteArc rstar F I} + +open Classical in +/-- The union `I(ℱ) = ⋃ (I(F) : F ∈ ℱ)` of the bite arcs of a set `ℱ` of bites (Graph Minors XIX, +Section 11, page 358: +"If $\mathscr{F}$ is a set of bites at $r^*$, we define $I(\mathscr{F}) = \bigcup(I(F) : F +\in \mathscr{F})$"). -/ +def feastArcUnion (D : TangleDatum cap χ) (rstar : Shat) (ℱ : Set (Drawing Shat)) : Set Shat := + ⋃ F ∈ ℱ, D.biteArc rstar F + +open Classical in +/-- The order `∑ (½|E(F)| : F ∈ ℱ)` of a finite set `ℱ` of bites at `r*` (Graph Minors XIX, +Section 11, page 358: +"The order of a set $\mathscr{F}$ of bites at $r^*$ is $\Sigma(\frac{1}{2}|E(F)| : F \in +\mathscr{F})$"). -/ +noncomputable def feastOrder (ℱ : Set (Drawing Shat)) : ℕ := + if h : ℱ.Finite then ∑ F ∈ h.toFinset, F.E.ncard / 2 else 0 + +open Classical in +/-- A set `ℱ` of bites at `r*` is a *feast* for `(S, (ω₁, …, ωₘ))` (Graph Minors XIX, Section 11, +page 358: +"A set $\mathscr{F}$ of bites at $r^*$ is a *feast* if +- $|\mathscr{F}| \le m + 1$, +- $I(\mathscr{F})$ includes the short sides of $\Phi_\chi$ with an end in common with $S$, and +- for each component $X$ of $S \setminus I(\mathscr{F})$ there exists $h$ with $1 \le h \le m$ such + that $\phi(e) \not\ge \omega_h$ for all $e \in E(\Gamma)$ with $e \subseteq X$"). -/ +structure IsFeast (D : TangleDatum cap χ) (rstar : Shat) (side : Set S) + (ω : List α) (ℱ : Set (Drawing Shat)) : Prop where + finite_bites : ℱ.Finite + all_bites : ∀ F ∈ ℱ, D.IsBiteAt rstar F + card_le : ℱ.ncard ≤ ω.length + 1 + includes_short_sides : ∀ s ∈ χ.Φ.shortSides, (closure s ∩ closure side).Nonempty → + cap.emb '' s ⊆ D.feastArcUnion rstar ℱ + component_omits : ∀ X ∈ componentsIn (side \ cap.emb ⁻¹' D.feastArcUnion rstar ℱ), + ∃ (h : ℕ) (hh : h < ω.length), ∀ e ∈ D.Γ.E, e ⊆ X → ¬ (χ.ΩS side).le (ω[h]) (D.P.φ e) + +open Classical in +/-- A feast `ℱ` is *disjoint* (Graph Minors XIX, Section 11, page 360: +"A feast $\mathscr{F}$ is *disjoint* if $I(F) = ins(F) \cap (\bar{r} \setminus r)$ for each +$F \in \mathscr{F}$, and $ins(F) \cap ins(F') = \{r^*\}$ for all distinct $F, F' \in +\mathscr{F}$"). -/ +structure IsDisjointFeast (D : TangleDatum cap χ) (rstar : Shat) (side : Set S) + (ω : List α) (ℱ : Set (Drawing Shat)) : Prop extends + D.IsFeast rstar side ω ℱ where + arc_eq : ∀ F ∈ ℱ, D.biteArc rstar F = + D.ins F ∩ (closure (D.rad.regionOf rstar) \ D.rad.regionOf rstar) + ins_inter : ∀ F ∈ ℱ, ∀ F' ∈ ℱ, F ≠ F' → D.ins F ∩ D.ins F' = {rstar} + +open Classical in +/-- A disjoint feast `ℱ` of order `≤ (m + 1)n` whose members are `λ`-linked to `𝒯` is an +*`((ω₁, …, ωₘ), S)`-flaw* for `(Γ, φ, λ, 𝒯)` (Graph Minors XIX, Section 11, page 361: +"If $(\Gamma, \phi, \lambda, \mathcal{T}) \in \mathcal{D}$ is $(n, (\omega_1, \ldots, +\omega_m))$-flawed on $S$, it follows from 11.2, 11.3, 11.4 that there is a disjoint feast +$\mathcal{F}$ of order $\le (m+1)n$, such that each of its members is $\lambda$-linked to +$\mathcal{T}$. We call $\mathcal{F}$ an $((\omega_1, \ldots, \omega_m), S)$-flaw for +$(\Gamma, \phi, \lambda, \mathcal{T})$"). -/ +structure IsSideLabelFlaw (D : TangleDatum cap χ) (rstar : Shat) (side : Set S) (n : ℕ) + (ω : List α) (ℱ : Set (Drawing Shat)) : Prop extends + D.IsDisjointFeast rstar side ω ℱ where + order_le : feastOrder ℱ ≤ (ω.length + 1) * n + all_linked : ∀ F ∈ ℱ, IsLambdaLinkedCircuit D.tb D.ord D.𝒯 F + +/-! ## Section 12: Internal label flaws and wheels -/ + +open Classical in +/-- `x ≤ y` in `Ω_χ(k)`, for `k = 2, 3`. -/ +def sizeLE (χ : ColourScheme S α) (k : ℕ) (x y : α) : Prop := + (k = 2 ∧ χ.Ω2.le x y) ∨ (k = 3 ∧ χ.Ω3.le x y) + +open Classical in +/-- The last condition in the definition of "flawed internally": there do not exist edges +`e₁, …, eₘ` of `Γ` such that `φ(eᵢ) ≥ ω₀`, `d(eᵢ, eⱼ) > n` and `d(eᵢ, r*) > n` for every pole `r*`. +The paper's `ω₀` lies in `Ω_χ(k)`, for `k = 2` or `3`, in a disjoint colour scheme. So the edges +`eᵢ` are internal of size `k`, and we say so, since we allow a colour scheme that is not disjoint. +-/ +def NoInternalMatch (D : TangleDatum cap χ) (m n k : ℕ) (ω₀ : α) : Prop := + ¬ ∃ e : Fin m → Set S, + (∀ i : Fin m, e i ∈ D.Γ.E ∧ Painting.IsInternal (e i) ∧ (tilde (e i)).ncard = k ∧ + sizeLE χ k ω₀ (D.P.φ (e i))) ∧ + (∀ i j : Fin m, i < j → n < D.edgeDist (e i) (e j)) ∧ + (∀ i : Fin m, ∀ rstar ∈ D.rad.poles, n < D.edgeVertDist (e i) rstar) + +open Classical in +/-- A datum `(Γ, φ, λ, 𝒯) ∈ 𝒟` is *`(m, n, ω₀)`-flawed internally* (Graph Minors XIX, Section 12, +page 362: +"Let $\chi, \mathcal{S}, \mathcal{D}$ be as in Section 10, let $\omega_0 \in +E(\Omega_\chi(2)) \cup E(\Omega_\chi(3))$, and let $m \ge 1, n \ge 4$. We say that $(\Gamma, +\phi, \lambda, \mathcal{T}) \in \mathcal{D}$ is $(m, n, \omega_0)$-flawed internally if * +$rep(\mathcal{T}) \ge 5^{2m+2}n$, and $dist(\Gamma) \ge \frac{1}{2} 5^{2m+2}n + 1$, * +$(\Gamma, \phi, \lambda, \mathcal{T})$ is not $5^{2m+2}n$-flawed in distance, * there do not +exist edges $e_1, \ldots, e_m$ of $\Gamma$ such that $\phi(e_i) \ge \omega_0$ $(1 \le i \le +m)$, $d(e_i, e_j) > n$ $(1 \le i < j \le m)$, and $d(e_i, r^*) > n$ $(1 \le i \le m)$ for +every pole $r^*$, where $d$ is the metric of $\mathcal{T}$"). Here `k` is `2` or `3`, and `ω₀ ∈ +E(Ω_χ(k))`. The first bullet is strict +here. With equality, "not `5^{2m+2}n`-flawed in distance" says nothing, since being flawed asks +for `rep(𝒯) > n` and `dist(Γ) > ½n + 1`, while the proof of (12.3) needs that poles are far apart. +The proof of (4.1) has the strict inequalities. -/ +def IsFlawedInternally (D : TangleDatum cap χ) (m n : ℕ) (k : ℕ) (ω₀ : α) : Prop := + 5 ^ (2 * m + 2) * n < D.rep ∧ + ((5 ^ (2 * m + 2) * n + 2 : ℕ) : ℕ∞) < 2 * Painting.dist D.rad ∧ + ¬ D.IsFlawedInDistance (5 ^ (2 * m + 2) * n) ∧ + D.NoInternalMatch m n k ω₀ + +open Classical in +/-- A closed disc `W ⊆ Σ̂` is a *wheel* and a subdrawing `H ⊆ Γ*` is a *`W`-hub of radius `ρ`* +(Graph Minors XIX, Section 12, page 362: +"Let $W \subseteq \hat{\Sigma}$ be a closed disc with $bd(W) \subseteq U(\Gamma^*)$, let $H$ be a +subdrawing of $\Gamma^*$ with $U(H) \subseteq W \setminus bd(W)$, and let $\rho \ge 1$ be an +integer with $rep(\mathcal{T}) \ge 2\rho + 3$. We say that $W$ is a *wheel*, and $H$ is a *$W$-hub +of radius $\rho$*, if: +* $W$ includes $ins(F)$ for every circuit $F$ of $\Gamma^*$ with $|E(F)| \le 4\rho + 4$ and + $U(F) \subseteq W$, +* $W$ contains every vertex of $\Gamma^*$ adjacent in $\Gamma^*$ to two members of + $V(\Gamma) \cap bd(W)$, and $W$ includes every edge of $\Gamma^*$ with both ends in $bd(W)$, +* either $|V(H)| = 1$ or $H$ is a $\mathcal{T}$-enclave with $|E(H)| \le 4\rho + 4$; if + $|V(H)| = 1$, then there is no $\mathcal{T}$-enclave $H'$ with $|E(H')| \le 4\rho + 4$ and + $V(H) \subseteq ins(H') \setminus U(H')$; and if $H$ is a $\mathcal{T}$-enclave, then there is no + $\mathcal{T}$-enclave $H' \ne H$ with $|E(H')| \le 4\rho + 4$ and $U(H) \subseteq ins(H')$, +* $W$ contains every vertex of $\Gamma$ joined to $V(H)$ by a path in $\Gamma^*$ of $\le \rho$ + edges, and +* for every $v \in V(\Gamma) \cap bd(W)$ there is a path of $\Gamma^*$ from $v$ to $V(H)$ with + $\le \rho$ edges, and no such path with $\le \rho - 2$ edges"). -/ +structure IsWheelHubOfRadius (D : TangleDatum cap χ) (W : Set Shat) (H : Drawing Shat) + (ρ : ℕ) : Prop where + pos_ρ : 1 ≤ ρ + rep_ge : 2 * ρ + 3 ≤ D.rep + is_disc : IsClosedDisc W + bd_sub : discBd W ⊆ D.rad.G.U + H_sub : H.IsSubdrawing D.rad.G + H_in_int : H.U ⊆ W \ discBd W + ins_sub : ∀ F : Drawing Shat, F.IsCircuitOf D.rad.G → F.E.ncard ≤ 4 * ρ + 4 → + F.U ⊆ W → D.ins F ⊆ W + two_nbrs_in_W : ∀ x ∈ D.rad.G.V, + ∀ v₁ ∈ (cap.emb '' D.Γ.V) ∩ discBd W, ∀ v₂ ∈ (cap.emb '' D.Γ.V) ∩ discBd W, + v₁ ≠ v₂ → + (∃ e₁ ∈ D.rad.G.E, tilde e₁ = {x, v₁}) → + (∃ e₂ ∈ D.rad.G.E, tilde e₂ = {x, v₂}) → + x ∈ W + chord_in_W : ∀ e ∈ D.rad.G.E, tilde e ⊆ discBd W → e ⊆ W + hub_cond : + ((H.V.ncard = 1 ∧ H.E = ∅ ∧ + ∀ H' : Drawing Shat, IsEnclave D.tb D.ord D.𝒯 H' → H'.E.ncard ≤ 4 * ρ + 4 → + ¬ (H.V ⊆ D.ins H' \ H'.U)) ∨ + (IsEnclave D.tb D.ord D.𝒯 H ∧ H.E.ncard ≤ 4 * ρ + 4 ∧ + ∀ H' : Drawing Shat, IsEnclave D.tb D.ord D.𝒯 H' → H' ≠ H → H'.E.ncard ≤ 4 * ρ + 4 → + ¬ (H.U ⊆ D.ins H'))) + close_in_W : ∀ v ∈ cap.emb '' D.Γ.V, + (∃ P : Drawing Shat, ∃ h ∈ H.V, P.IsPathOf D.rad.G v h ∧ P.E.ncard ≤ ρ) → v ∈ W + bd_dist : ∀ v ∈ (cap.emb '' D.Γ.V) ∩ discBd W, + (∃ P : Drawing Shat, ∃ h ∈ H.V, P.IsPathOf D.rad.G v h ∧ P.E.ncard ≤ ρ) ∧ + ¬ (∃ P : Drawing Shat, ∃ h ∈ H.V, P.IsPathOf D.rad.G v h ∧ P.E.ncard + 2 ≤ ρ) + +open Classical in +/-- A closed disc `W ⊆ Σ̂` is a *wheel* if there exist a `W`-hub `H` and radius `ρ` (Graph Minors +XIX, Section 12, page 362). -/ +def IsWheel (D : TangleDatum cap χ) (W : Set Shat) : Prop := + ∃ (H : Drawing Shat) (ρ : ℕ), D.IsWheelHubOfRadius W H ρ + +open Classical in +/-- The *radius* of a wheel `W` is the minimum radius of all `W`-hubs (Graph Minors XIX, +Section 12, page 362: +"The *radius* of a wheel $W$ is the minimum radius of all $W$-hubs"). -/ +noncomputable def wheelRadius (D : TangleDatum cap χ) (W : Set Shat) : ℕ := + sInf {ρ : ℕ | ∃ H : Drawing Shat, D.IsWheelHubOfRadius W H ρ} + +open Classical in +/-- A set `𝒲` of wheels is a *cover* for `(Γ, φ, λ, 𝒯)` with respect to `ω₀` (Graph Minors XIX, +Section 12, page 364: +"A set $\mathcal{W}$ of wheels is a *cover* (for $(\Gamma, \phi, \lambda, \mathcal{T})$) if * +the members of $\mathcal{W}$ are mutually disjoint, * $bd(W) \subseteq \Sigma_\chi \setminus +bd(\Sigma_\chi)$ for each $W \in \mathcal{W}$, * for each pole $r^*$ there exists $W \in +\mathcal{W}$ with $r^* \in W$ and hence with $r \subseteq W$, * for every $e \in Z$ there +exists $W \in \mathcal{W}$ with $e \subseteq W$, * for each $W \in \mathcal{W}$, $(W +\setminus bd(W)) \cap V(\Gamma) \ne \emptyset$"). -/ +structure IsWheelCover (D : TangleDatum cap χ) (ω₀ : α) + (𝒲 : Set (Set Shat)) : Prop where + finite_wheels : 𝒲.Finite + all_wheels : ∀ W ∈ 𝒲, D.IsWheel W + pairwise_disjoint : 𝒲.PairwiseDisjoint id + bd_in_interior : ∀ W ∈ 𝒲, discBd W ⊆ cap.emb '' (univ \ bd S) + poles_covered : ∀ rstar ∈ D.rad.poles, ∃ W ∈ 𝒲, rstar ∈ W + Z_covered : ∀ e ∈ D.Γ.E, χ.unionLE ω₀ (D.P.φ e) → + ∃ W ∈ 𝒲, cap.emb '' e ⊆ W + interior_vertex : ∀ W ∈ 𝒲, ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty + +/-! ## Section 13: Spokes of a wheel and optimal hubs -/ + +open Classical in +/-- A path `P` of `Γ*` is a *spoke* of `(W, H)` from `v ∈ V(Γ) ∩ bd(W)` to `h ∈ V(H)` (Graph +Minors XIX, Section 13, page 366: +"By a *spoke* of $W$ we mean a path $P$ of $\Gamma^*$ from some $v \in V(\Gamma) \cap bd(W)$ +to some $h \in V(H)$, such that • there is no path of $\Gamma^*$ from $v$ to $V(H)$ with +fewer than $|E(P)|$ edges, and • there is no path $P'$ of $\Gamma^*$ from $v$ to $V(H)$ with +$|E(P)|$ edges and with $\lambda(P') < \lambda(P)$"). -/ +structure IsSpoke (D : TangleDatum cap χ) (W : Set Shat) (H : Drawing Shat) + (v h : Shat) (P : Drawing Shat) : Prop where + v_mem : v ∈ (cap.emb '' D.Γ.V) ∩ discBd W + h_mem : h ∈ H.V + is_path : P.IsPathOf D.rad.G v h + min_length : ∀ (P' : Drawing Shat), ∀ h' ∈ H.V, P'.IsPathOf D.rad.G v h' → + P.E.ncard ≤ P'.E.ncard + min_weight : ∀ (P' : Drawing Shat), ∀ h' ∈ H.V, P'.IsPathOf D.rad.G v h' → + P'.E.ncard = P.E.ncard → D.tb.weightSub P ≤ D.tb.weightSub P' + +open Classical in +/-- A `W`-hub `H` is *optimal* (Graph Minors XIX, Section 13, page 367: +"A $W$-hub $H$ is said to be *optimal* if • $H$ has the same radius as $W$, that is, $H$ has +radius minimum over all $W$-hubs, and • either $|V(H)| = 1$, or there is no 1-vertex $W$-hub +with the same radius as $W$"). -/ +structure IsOptimalWheelHub (D : TangleDatum cap χ) (W : Set Shat) (H : Drawing Shat) + (ρ : ℕ) : Prop extends D.IsWheelHubOfRadius W H ρ where + ρ_eq_radius : ρ = D.wheelRadius W + one_vertex_priority : H.V.ncard = 1 ∨ + ¬ ∃ H' : Drawing Shat, D.IsWheelHubOfRadius W H' ρ ∧ H'.V.ncard = 1 + +open Classical in +/-- The boundary sector disc `Δ_v ⊆ W` and circuit `D_v` for `v ∈ R* ∩ bd(W)` (Graph Minors XIX, +Section 13, page 368: +"Let $v \in R^* \cap bd(W)$, with neighbours $v_1, v_2$ in $\Gamma^* \cap bd(W)$. Let $f_i$ +be the edge of $\Gamma^* \cap bd(W)$ with ends $v, v_i$ ($i = 1, 2$). If $S_{v_1}$ meets +$S_{v_2}$ we define $\Delta_v$ to be the disc in $W$ bounded by the closure of $$(U(S_{v_1} +\cup S_{v_2}) \setminus U(S_{v_1} \cap S_{v_2})) \cup f_1 \cup f_2.$$ If $S_{v_1}$ does not +meet $S_{v_2}$, let their inner ends be $h_1, h_2$ respectively, let $P$ be the path of $H$ +joining $h_1, h_2$ such that the disc in $W$ bounded by $$U(S_{v_1} \cup S_{v_2} \cup P) +\cup \bar{f}_1 \cup \bar{f}_2$$ does not include $ins(H)$, and let $\Delta_v$ be this disc. +In either case, let $D_v$ be the circuit of $\Gamma^*$ with $U(D_v) = bd(\Delta_v)$"). -/ +structure IsBoundarySector (D : TangleDatum cap χ) (W : Set Shat) (H : Drawing Shat) + (rstar : Shat) (Δv : Set Shat) (Dv : Drawing Shat) : Prop where + rstar_mem : rstar ∈ D.rad.Rstar ∩ discBd W + Δv_sub : Δv ⊆ W + is_disc : IsClosedDisc Δv + Dv_circuit : Dv.IsCircuitOf D.rad.G + Dv_U : Dv.U = discBd Δv + sector_spec : ∃ (v₁ v₂ h₁ h₂ : Shat) (f₁ f₂ : Set Shat) (S₁ S₂ : Drawing Shat), + v₁ ≠ v₂ ∧ + f₁ ∈ D.rad.G.E ∧ f₁ ⊆ discBd W ∧ tilde f₁ = {rstar, v₁} ∧ + f₂ ∈ D.rad.G.E ∧ f₂ ⊆ discBd W ∧ tilde f₂ = {rstar, v₂} ∧ + D.IsSpoke W H v₁ h₁ S₁ ∧ D.IsSpoke W H v₂ h₂ S₂ ∧ + (((S₁.V ∩ S₂.V).Nonempty ∧ + discBd Δv = closure (((S₁.U ∪ S₂.U) \ (S₁.U ∩ S₂.U)) ∪ f₁ ∪ f₂)) ∨ + (Disjoint S₁.V S₂.V ∧ ∃ P : Drawing Shat, P.IsPathOf H h₁ h₂ ∧ + discBd Δv = S₁.U ∪ S₂.U ∪ P.U ∪ closure f₁ ∪ closure f₂ ∧ + ¬ (D.ins H ⊆ Δv))) + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/DiscRealize.lean b/LeanPool/GraphMinor/GM19/DiscRealize.lean new file mode 100644 index 0000000000..f5faafbfd1 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/DiscRealize.lean @@ -0,0 +1,349 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.PadFlower + +/-! +# Discs through prescribed ends + +This is the frame of steps (2) and (3) of the proof of Graph Minors XIX, (15.2), pages 381 and 382, +on a closed connected surface, without any painting. We are given disjoint closed discs `Δ i`, a +finite set +`V`, and pads `C i` that meet only in `V`, with `V` on the boundary of each pad. Each `Δ i` has a +finite set `Y i` of ends on its boundary, and each end has a vertex in `V`, on the boundary of `C +i`. + +The model is made of small discs `E v` around the vertices and a flower `M i` in each pad, by +`exists_pad_flower`. Step (2) is `exists_marked_match`: a homeomorphism `α` carries `M i` to `Δ i` +and the peaks +to the ends. Step (3) pulls the model back: the discs `α '' E v` meet `⋃ Δ i` in exactly the ends +(`exists_realizing_discs`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Metric Topology Filter GraphMinor.Surface + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +theorem planePos_iff {Δ : Set ℂ} (hΔ : IsClosedDisc Δ) {φ : Circle → ℂ} (hφ : IsPosParam Δ φ) + (a b c : Circle) : planePos Δ (φ a) (φ b) (φ c) ↔ CircleCyclic a b c := + ⟨fun ⟨_φ', _, _, _, hφ', ha, hb, hc, hcy⟩ => order_of_nested hΔ hΔ subset_rfl hφ' hφ hcy ha hb hc, + fun h => ⟨φ, a, b, c, hφ, rfl, rfl, rfl, h⟩⟩ + +theorem circleCyclic_preserves {τ : Circle ≃ₜ Circle} (hτ : PreservesCircleOrientation τ) + (a b c : Circle) : CircleCyclic (τ a) (τ b) (τ c) ↔ CircleCyclic a b c := by + constructor + · intro h + obtain ⟨l, hl, hm, he⟩ := preserves_symm hτ + have := circleCyclic_map_mono hl hm he h + simpa using this + · obtain ⟨l, hl, hm, he⟩ := hτ + exact circleCyclic_map_mono hl hm he + +/-- `exists_marked_match` for any finite index type. -/ +theorem exists_marked_match' [ConnectedSpace T] (hT : IsClosedSurface T) {ι : Type} [Finite ι] {A + A' : ι → Set T} (hA : ∀ i, IsClosedDisc (A i)) (hA' : ∀ i, IsClosedDisc (A' i)) + (hAA : Pairwise fun i j => Disjoint (A i) (A j)) (hAA' : Pairwise fun i j => Disjoint (A' i) + (A' j)) {p p' : ι → Circle → T} (hp : ∀ i, IsBdParam (A i) (p i)) (hp' : ∀ i, IsBdParam + (A' i) (p' i)) + (H : ¬ IsOrientableSurface T ∨ ∃ ω : SurfaceOrientation T, ∀ i a b c, a ≠ b → b ≠ c → a ≠ c → + (ω.pos (A i) (p i a) (p i b) (p i c) ↔ ω.pos (A' i) (p' i a) (p' i b) (p' i c))) : + ∃ e : T ≃ₜ T, (∀ i, e '' A i = A' i) ∧ ∀ i w, e (p i w) = p' i w := by + obtain ⟨n, ⟨f⟩⟩ := Finite.exists_equiv_fin ι + have hinj : ∀ {i j : Fin n}, i ≠ j → f.symm i ≠ f.symm j := fun h he => h (f.symm.injective he) + obtain ⟨e, h1, h2⟩ := exists_marked_match hT (A := fun i => A (f.symm i)) (A' := fun i => A' + (f.symm i)) (p := fun i => p (f.symm i)) (p' := fun i => p' (f.symm i)) (fun i => hA _) (fun i + => hA' _) + (fun i j h => hAA (hinj h)) (fun i j h => hAA' (hinj h)) (fun i => hp _) (fun i => hp' _) + (H.imp id fun ⟨ω, hω⟩ => ⟨ω, fun i => hω _⟩) + refine ⟨e, fun i => ?_, fun i w => ?_⟩ + · simpa using h1 (f i) + · simpa using h2 (f i) w + +private theorem prescribed_points_respect_the_orientation + {T : Type} + [TopologicalSpace T] + {ι : Type} + {Δ : ι → Set T} + {C : ι → Set T} + {c : ι → T → ℂ} + {g : ι → ℂ → T} + (hch : ∀ (i : ι), IsChart (C i) (c i) (g i)) + {q : ι → Circle → T} + (H : ¬IsOrientableSurface T ∨ ∃ ω : SurfaceOrientation T, ∀ (i : ι), ∃ ϖ : Set T → T → T → T + → Prop, (ϖ = ω.pos ∨ ϖ = revPos ω.pos) ∧ (∀ (D : + Set T), IsClosedDisc D → D ⊆ C i → SameOn ϖ (pullPos (c i) planePos) D) ∧ ∀ (a b d : + Circle), a ≠ b → b ≠ d → a ≠ d → (ϖ (Δ i) (q i a) (q i b) (q i d) ↔ CircleCyclic a b d)) + (ρ : ι → Circle → ℝ) + (τ : ι → Circle ≃ₜ Circle) + (hτ : ∀ (i : ι), PreservesCircleOrientation (τ i)) + (St : ι → Set ℂ) + (hStC : ∀ (i : ι), St i ⊆ closedBall 0 1) + (hStd : ∀ (i : ι), IsClosedDisc (St i)) + (hSp : ∀ (i : ι), IsPosParam (St i) fun w => (ρ i w : ℂ) * w) + (M : ι → Set T) + (hM : ∀ i, M i = g i '' St i) + (hMd : ∀ (i : ι), IsClosedDisc (M i)) + (p : ι → Circle → T) + (hpg : ∀ i w, p i w = g i ((ρ i w : ℂ) * w)) + (hpS : ∀ (i : ι) (w : Circle), (ρ i w : ℂ) * w ∈ St i) + (hpM : ∀ (i : ι), IsBdParam (M i) (p i)) + (hMC : ∀ (i : ι), M i ⊆ discInt (C i)) + (p' : ι → Circle → T) + (hp'q : ∀ i w, p' i w = q i (τ i w)) : + ¬IsOrientableSurface T ∨ ∃ ω : SurfaceOrientation T, ∀ (i : ι) (a b d : Circle), a ≠ b → b ≠ d + → a ≠ d → (ω.pos (M i) + (p i a) (p i b) (p i d) ↔ ω.pos (Δ i) (p' i a) (p' i b) (p' i d)) := by + refine H.imp id fun ⟨ω, hω⟩ => ⟨ω, fun i => ?_⟩ + obtain ⟨ϖ, hϖ, h1, h2⟩ := hω i + have key : ∀ a b d, a ≠ b → b ≠ d → a ≠ d → (ϖ (M i) (p i a) (p i b) (p i d) ↔ ϖ (Δ i) (p' i a) + (p' i b) (p' i d)) := fun a b d hab hbd had => by + have hmem : ∀ w, p i w ∈ discBd (M i) := fun w => by rw [← (hpM i).2.2]; exact mem_range_self w + have hsub : M i ⊆ C i := fun x hx => discInt_subset _ (hMC i hx) + have h3 := h1 (M i) (hMd i) hsub _ _ _ (hmem a) (hmem b) (hmem d) (fun h => hab + ((hpM i).2.1 h)) (fun h => hbd ((hpM i).2.1 h)) (fun h => had ((hpM i).2.1 h)) + have hcM : c i '' M i = St i := by + rw [hM i] + ext z + constructor + · rintro ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + rw [(hch i).hg (hStC i hx)] + exact hx + · exact fun hz => ⟨g i z, mem_image_of_mem _ hz, (hch i).hg (hStC i hz)⟩ + have hcp : ∀ w, c i (p i w) = (ρ i w : ℂ) * w := fun w => + (congrArg (c i) (hpg i w)).trans ((hch i).hg (hStC i (hpS i w))) + have h4 : pullPos (c i) planePos (M i) (p i a) (p i b) (p i d) ↔ CircleCyclic a b d := by + change planePos (c i '' M i) (c i (p i a)) (c i (p i b)) (c i (p i d)) ↔ _ + rw [hcM, hcp, hcp, hcp] + exact planePos_iff (hStd i) (hSp i) a b d + have hτne : ∀ {x y : Circle}, x ≠ y → τ i x ≠ τ i y := fun h he => h ((τ i).injective he) + rw [h3, h4, ← circleCyclic_preserves (hτ i), hp'q, hp'q, hp'q] + exact (h2 _ _ _ (hτne hab) (hτne hbd) (hτne had)).symm + rcases hϖ with rfl | rfl + · exact key + · exact fun a b d hab hbd had => key a d b had hbd.symm hab + +/-- **Discs through prescribed ends.** See the top of this file. In the orientable case an +orientation `ω`, or its reverse `ϖ i`, must agree with the chart on the pad `C i` and with the +parametrization `q i` on `Δ i`. -/ +theorem exists_realizing_discs [ConnectedSpace T] (hT : IsClosedSurface T) {ι : Type} [Finite ι] {Δ + C : ι → Set T} {c : ι → T → ℂ} {g : ι → ℂ → T} (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hΔΔ : Pairwise fun i j => Disjoint (Δ i) (Δ j)) (hC : ∀ i, IsClosedDisc (C i)) + (hch : ∀ i, IsChart (C i) (c i) (g i)) {V : Set T} (hV : V.Finite) (hCC : ∀ i j, i ≠ j + → C i ∩ C j ⊆ V) + (hVC : ∀ i, V ∩ C i ⊆ discBd (C i)) {Y : ι → Set T} {φ : ι → T → T} {q : ι → Circle + → T} {A U : ι → T → ℝ} (hφ : ∀ i, ∀ y ∈ Y i, φ i y ∈ V ∩ C i) (hq : ∀ i, IsBdParam (Δ i) + (q i)) + (hO : ∀ i, PadOrder (q i) (g i) (Y i) (φ i) (A i) (U i)) + (H : ¬ IsOrientableSurface T ∨ ∃ ω : SurfaceOrientation T, ∀ i, ∃ ϖ : Set T → T → T → T → Prop, + (ϖ = ω.pos ∨ ϖ = revPos ω.pos) ∧ (∀ D, IsClosedDisc D → D ⊆ C i → SameOn ϖ (pullPos + (c i) planePos) D) ∧ + ∀ a b d, a ≠ b → b ≠ d → a ≠ d → (ϖ (Δ i) (q i a) (q i b) (q i d) ↔ CircleCyclic a b d)) : + ∃ D : T → Set T, (∀ v ∈ V, IsClosedDisc (D v)) ∧ (∀ v ∈ V, ∀ v' ∈ V, v ≠ v' → Disjoint (D v) + (D v')) ∧ ∀ v ∈ V, D v ∩ ⋃ i, Δ i = ⋃ i, {y ∈ Y i | φ i y = v} := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + have hci : ∀ i, InjOn (c i) (C i) := fun i x hx y hy h => by rw [← (hch i).gh hx, ← + (hch i).gh hy, h] + have hgi : ∀ i, InjOn (g i) (closedBall 0 1) := fun i x hx y hy h => by rw [← (hch i).hg hx, ← + (hch i).hg hy, h] + have hunit : ∀ i, ∀ v ∈ V ∩ C i, ‖c i v‖ = 1 := fun i v hv => by + have : c i v ∈ sphere (0 : ℂ) 1 := by + rw [← (hch i).bd] + exact mem_image_of_mem _ (hVC i hv) + simpa using this + obtain ⟨s, hs0, hs1, hsep⟩ : ∃ s : ℝ, 0 < s ∧ s < 1 / 4 ∧ ∀ i, ∀ v ∈ V ∩ C i, ∀ v' ∈ V ∩ C i, v ≠ + v' → 4 * s ≤ ‖c i v - c i v'‖ := by + have : Finite V := hV.to_subtype + have e : ∀ᶠ s : ℝ in 𝓝[>] 0, ∀ i, ∀ v : V, ∀ v' : V, v.1 ∈ C i → v'.1 ∈ C i → v ≠ v' → 4 * s + ≤ ‖c i v.1 - c i v'.1‖ := by + refine eventually_all.mpr fun i => eventually_all.mpr fun v => eventually_all.mpr fun v' => ?_ + by_cases h : v.1 ∈ C i ∧ v'.1 ∈ C i ∧ v ≠ v' + · obtain ⟨h1, h2, h3⟩ := h + have hp : 0 < ‖c i v.1 - c i v'.1‖ := norm_pos_iff.mpr (sub_ne_zero.mpr fun he => h3 + (Subtype.ext (hci i h1 h2 he))) + have hc : Continuous fun s : ℝ => 4 * s := by fun_prop + have h0 : (fun s : ℝ => 4 * s) 0 < ‖c i v.1 - c i v'.1‖ := by simpa using hp + have := (hc.tendsto 0).eventually (gt_mem_nhds h0) + exact (this.filter_mono nhdsWithin_le_nhds).mono fun s hs _ _ _ => hs.le + · exact Eventually.of_forall fun s h1 h2 h3 => absurd ⟨h1, h2, h3⟩ h + obtain ⟨s, h1, h2⟩ := (e.and (Ioo_mem_nhdsGT (by norm_num : (0 : ℝ) < 1 / 4))).exists + exact ⟨s, h2.1, h2.2, fun i v hv v' hv' hne => h1 i ⟨v, hv.1⟩ ⟨v', + hv'.1⟩ hv.2 hv'.2 fun h => hne (congrArg Subtype.val h)⟩ + obtain ⟨W, hW, hWd⟩ := hV.t2_separation + have hdisc : ∀ v, ∃ E : Set T, IsClosedDisc E ∧ v ∈ discInt E ∧ E ⊆ W v ∧ ∀ x ∈ E, ∀ i, x ∈ C i + → v ∈ C i ∧ ‖c i x - c i v‖ < s := by + intro v + have hev : ∀ᶠ x in 𝓝 v, ∀ i, x ∈ C i → v ∈ C i ∧ ‖c i x - c i v‖ < s := by + refine eventually_all.mpr fun i => ?_ + by_cases hv : v ∈ C i + · have h1 := (hch i).hc v hv + have h2 := (Metric.tendsto_nhds.mp h1 s hs0) + refine (eventually_nhdsWithin_iff.mp h2).mono fun x hx hxC => ⟨hv, ?_⟩ + have := hx hxC + rwa [dist_eq_norm] at this + · exact Filter.mem_of_superset ((hC i).isClosed.isOpen_compl.mem_nhds hv) fun x hx hxC + => absurd hxC hx + obtain ⟨E, hE, hvE, hEs⟩ := exists_small_disc (hT.2.2 v) (isOpen_interior.inter + (hW v).2) ⟨mem_interior_iff_mem_nhds.mpr hev, (hW v).1⟩ + exact ⟨E, hE, hvE, fun x hx => (hEs hx).2, fun x hx => interior_subset (hEs hx).1⟩ + choose E hE hvE hEW hEC using hdisc + have hEd : ∀ v ∈ V, ∀ v' ∈ V, v ≠ v' → Disjoint (E v) (E v') := fun v hv v' hv' hne => + (hWd hv hv' hne).mono (hEW v) (hEW v') + let X : Set T := ⋃ v ∈ V, E v + have hXc : IsClosed X := hV.isClosed_biUnion fun v _ => (hE v).isClosed + have hmemX : ∀ {x}, x ∈ X → ∃ v ∈ V, x ∈ E v := fun {x} hx => by simpa [X] using hx + have hfar : ∀ i, ∀ x ∈ C i ∩ X, 1 / 2 < ‖c i x‖ := fun i x hx => by + obtain ⟨v, hv, hxv⟩ := hmemX hx.2 + obtain ⟨h1, h2⟩ := hEC v x hxv i hx.1 + have h3 := hunit i v ⟨hv, h1⟩ + have h4 := norm_sub_norm_le (c i v) (c i x) + rw [norm_sub_rev, h3] at h4 + linarith + have hnear : ∀ i, ∀ y ∈ Y i, ∀ᶠ z in 𝓝 (ee (U i y) : ℂ), z ∈ closedBall (0 : ℂ) 1 → g i z ∈ X + := fun i y hy => by + have hb : (ee (U i y) : ℂ) ∈ closedBall (0 : ℂ) 1 := by simp + have h1 := (hch i).gc _ hb + obtain ⟨hv, -⟩ := hφ i y hy + rw [ContinuousWithinAt, (hO i).g_U y hy] at h1 + have h2 := h1.eventually (((hE (φ i y)).isOpen_discInt hman).mem_nhds (hvE (φ i y))) + refine (eventually_nhdsWithin_iff.mp h2).mono fun z hz hzb => ?_ + exact mem_biUnion hv (discInt_subset _ (hz hzb)) + have hpad := fun i => exists_pad_flower (hC i).isCompact (hch i) (hO i) hXc (hfar i) (hnear i) hs0 + choose ρ hρc hρ u hu1 hu2 hu3 τ hτ hτq using hpad + have hρp : ∀ i x, 0 < ρ i x := fun i x => (hρ i x).1 + let St : ι → Set ℂ := fun i => starDisc (hρc i) (hρp i) + have hStB : ∀ i, St i ⊆ ball 0 1 := fun i => starDisc_subset_ball fun x => (hρ i x).2 + have hStC : ∀ i, St i ⊆ closedBall 0 1 := fun i => (hStB i).trans ball_subset_closedBall + have hStd : ∀ i, IsClosedDisc (St i) := fun i => isClosedDisc_starDisc _ _ + have hSp : ∀ i, IsPosParam (St i) fun w => (ρ i w : ℂ) * w := fun i => isPosParam_star _ _ + let M : ι → Set T := fun i => g i '' St i + have hMim := fun i => isClosedDisc_image_injOn (hStd i) ((hch i).gc.mono (hStC i)) ((hgi i).mono + (hStC i)) + have hMd : ∀ i, IsClosedDisc (M i) := fun i => (hMim i).1 + let p : ι → Circle → T := fun i w => g i ((ρ i w : ℂ) * w) + have hpS : ∀ i w, (ρ i w : ℂ) * w ∈ St i := fun i w => by + apply discBd_subset _ + rw [← (hSp i).2.2.1] + exact mem_range_self w + have hpM : ∀ i, IsBdParam (M i) (p i) := fun i => by + refine ⟨(hch i).gc.comp_continuous (hSp i).1 fun w => hStC i (hpS i w), + fun a b h => (hSp i).2.1 (hgi i (hStC i (hpS i a)) (hStC i (hpS i b)) h), ?_⟩ + have : p i = g i ∘ fun w => (ρ i w : ℂ) * w := rfl + rw [this, range_comp, (hSp i).2.2.1, (hMim i).2] + have hMC : ∀ i, M i ⊆ discInt (C i) := fun i => by + rw [(hch i).discInt_eq] + exact image_mono (hStB i) + have hMM : Pairwise fun i j => Disjoint (M i) (M j) := fun i j hij => by + refine Set.disjoint_left.mpr fun x hi hj => ?_ + have hxi := hMC i hi + have hxj := hMC j hj + have hxV := hCC i j hij ⟨discInt_subset _ hxi, discInt_subset _ hxj⟩ + exact hxi.2 (hVC i ⟨hxV, discInt_subset _ hxi⟩) + let p' : ι → Circle → T := fun i w => q i (τ i w) + have hp' : ∀ i, IsBdParam (Δ i) (p' i) := fun i => by + refine ⟨(hq i).1.comp (τ i).continuous, fun a b h => (τ i).injective ((hq i).2.1 h), ?_⟩ + have : p' i = q i ∘ τ i := rfl + rw [this, range_comp, (τ i).range_coe, image_univ, (hq i).2.2] + have hH : ¬ IsOrientableSurface T ∨ ∃ ω : SurfaceOrientation T, ∀ i a b d, a ≠ b → b ≠ d → a ≠ d + → (ω.pos (M i) (p i a) (p i b) (p i d) ↔ ω.pos (Δ i) (p' i a) (p' i b) (p' i d)) := by + exact prescribed_points_respect_the_orientation (T := T) (ι := ι) (Δ := Δ) (C := C) (c := c) + (g := g) hch (q := q) H ρ τ hτ St hStC hStd hSp M (fun _ => rfl) hMd p (fun _ _ => rfl) + hpS hpM hMC p' (fun _ _ => rfl) + obtain ⟨α, hα, hαw⟩ := exists_marked_match' hT hMd hΔ hMM hΔΔ hpM hp' hH + have hαY : ∀ i (y : {y // y ∈ Y i}), α (p i (u i y)) = y.1 := fun i y => by + rw [hαw] + exact hτq i y + have hclaim : ∀ i (y : {y // y ∈ Y i}), ∀ v ∈ V, p i (u i y) ∈ E v → v = φ i y.1 + := fun i y v hv hx => by + have hxC : p i (u i y) ∈ C i := (hch i).gm (hStC i (hpS i _)) + obtain ⟨h1, h2⟩ := hEC v _ hx i hxC + have hcp : c i (p i (u i y)) = (ρ i (u i y) : ℂ) * u i y := (hch i).hg (hStC i (hpS i _)) + rw [hcp] at h2 + by_contra hne + have hyV := hφ i y.1 y.2 + have h3 := hsep i v ⟨hv, h1⟩ _ hyV hne + have hcy : c i (φ i y.1) = ee (U i y.1) := by + rw [← (hO i).g_U y.1 y.2] + exact (hch i).hg (by simp) + rw [hcy] at h3 + have h4 := hu1 i y + have hr := hρ i (u i y) + have hnv := hunit i v ⟨hv, h1⟩ + have hn1 : ‖(ρ i (u i y) : ℂ) * u i y‖ = ρ i (u i y) := by + rw [norm_mul, Complex.norm_real, Circle.norm_coe, mul_one, Real.norm_of_nonneg hr.1.le] + have h5 : 1 - ρ i (u i y) < s := by + have := norm_sub_norm_le (c i v) ((ρ i (u i y) : ℂ) * u i y) + rw [hnv, hn1, norm_sub_rev] at this + linarith + have h6 : ‖(u i y : ℂ) - (ρ i (u i y) : ℂ) * u i y‖ = 1 - ρ i (u i y) := by + have : (u i y : ℂ) - (ρ i (u i y) : ℂ) * u i y = ((1 - ρ i (u i y) : ℝ) : ℂ) * u i y := by + push_cast + ring + rw [this, norm_mul, Complex.norm_real, Circle.norm_coe, mul_one, + Real.norm_of_nonneg (by linarith [hr.2])] + have h7 : c i v - ee (U i y.1) = ((u i y : ℂ) - ee (U i y.1)) - ((u i y : ℂ) - (ρ i + (u i y) : ℂ) * u i y) - ((ρ i (u i y) : ℂ) * u i y - c i v) := by ring + rw [h7] at h3 + have h8 := norm_sub_le (((u i y : ℂ) - ee (U i y.1)) - ((u i y : ℂ) - (ρ i + (u i y) : ℂ) * u i y)) ((ρ i (u i y) : ℂ) * u i y - c i v) + have h9 := norm_sub_le ((u i y : ℂ) - ee (U i y.1)) ((u i y : ℂ) - (ρ i (u i y) : ℂ) * u i y) + linarith + refine ⟨fun v => α '' E v, fun v _ => (image_disc α (hE v)).1, fun v hv v' hv' hne => + (Set.disjoint_image_iff α.injective).mpr (hEd v hv v' hv' hne), fun v hv => ?_⟩ + ext x + simp only [mem_inter_iff, mem_iUnion, mem_ofPred_eq] + constructor + · rintro ⟨⟨z, hz, rfl⟩, i, hi⟩ + rw [← hα i] at hi + obtain ⟨z', hz', hzz⟩ := hi + obtain rfl := α.injective hzz + obtain ⟨w, hw, rfl⟩ := hz' + have hw' : w ∈ closedBall (0 : ℂ) 1 := hStC i hw + have hgC : g i w ∈ C i := (hch i).gm hw' + have hmF : w ∈ c i '' (C i ∩ X) := ⟨g i w, ⟨hgC, mem_biUnion hv hz⟩, (hch i).hg hw'⟩ + have hw0 : w ≠ 0 := fun h => by + have := hfar i (g i w) ⟨hgC, mem_biUnion hv hz⟩ + rw [(hch i).hg hw', h, norm_zero] at this + linarith + obtain ⟨y, hy⟩ := hu3 i w hw0 hmF ((mem_starDisc hw0).mp hw) + have hgp : g i w = p i (u i y) := by rw [hy] + refine ⟨i, ?_⟩ + rw [hgp, hαY i y] + refine ⟨y.2, ?_⟩ + rw [hgp] at hz + exact (hclaim i y v hv hz).symm + · rintro ⟨i, hy, rfl⟩ + let y' : {y // y ∈ Y i} := ⟨x, hy⟩ + have hmem : p i (u i y') ∈ X := by + obtain ⟨z, hz, hzc⟩ := hu2 i y' + have hgz : z = p i (u i y') := by + change z = g i _ + rw [← hzc, (hch i).gh hz.1] + rw [← hgz] + exact hz.2 + obtain ⟨v', hv', hxv⟩ := hmemX hmem + have hvv := hclaim i y' v' hv' hxv + refine ⟨⟨p i (u i y'), ?_, hαY i y'⟩, i, ?_⟩ + · rw [show φ i x = v' from hvv.symm] + exact hxv + · have h1 : p i (u i y') ∈ M i := by + apply discBd_subset _ + rw [← (hpM i).2.2] + exact mem_range_self _ + have h2 := hαY i y' + have h3 : x = α (p i (u i y')) := h2.symm + rw [h3, ← hα i] + exact mem_image_of_mem _ h1 + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/DiscSide.lean b/LeanPool/GraphMinor/GM19/DiscSide.lean new file mode 100644 index 0000000000..f7ff4a9687 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/DiscSide.lean @@ -0,0 +1,214 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5e + +/-! +# The outside of a disc near a point of its boundary + +Let `Δ` be a closed disc in a surface and let `y` be a point of its boundary that lies off the +boundary of the +surface. Near `y` the complement of `Δ` is connected. The disc itself may touch the boundary of the +surface +elsewhere, so we pass to a small part of `Δ` near `y`, and use a collar around that part. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface + +/-- In the plane, the outside of the unit circle is connected near a point of the circle. Small +polar rectangles +give the connected sets. -/ +theorem outside_near {w : ℂ} (hw : ‖w‖ = 1) : + ∀ W ∈ 𝓝 w, ∃ B ⊆ {u : ℂ | 1 < ‖u‖} ∩ W, IsPreconnected B ∧ + ∃ W' ∈ 𝓝 w, {u : ℂ | 1 < ‖u‖} ∩ W' ⊆ B := by + intro W hW + have hw0 : w ≠ 0 := by + intro h + simp [h] at hw + let P : ℝ × ℝ → ℂ := fun p ↦ (p.1 : ℂ) * w * Complex.exp (p.2 * Complex.I) + have hPc : Continuous P := by fun_prop + have hP0 : P (1, 0) = w := by simp [P] + have hpre : P ⁻¹' W ∈ 𝓝 ((1 : ℝ), (0 : ℝ)) := hPc.continuousAt.preimage_mem_nhds (by rwa [hP0]) + obtain ⟨ε, hε, hsub⟩ := Metric.mem_nhds_iff.mp hpre + have hrect : ∀ r t : ℝ, |r - 1| < ε → |t| < ε → P (r, t) ∈ W := by + intro r t hr ht + apply hsub + rw [Metric.mem_ball, Prod.dist_eq] + simpa [Real.dist_eq] using And.intro hr ht + refine ⟨P '' (Ioo 1 (1 + ε) ×ˢ Ioo (-ε) ε), ?_, ?_, ?_⟩ + · rintro _ ⟨⟨r, t⟩, ⟨hr, ht⟩, rfl⟩ + refine ⟨?_, hrect r t ?_ ?_⟩ + · have hr0 : 0 ≤ r := by linarith [hr.1] + have : ‖P (r, t)‖ = r := by + simp only [P, norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg hr0, hw, + Complex.norm_exp_ofReal_mul_I, mul_one] + change 1 < ‖P (r, t)‖ + rw [this] + exact hr.1 + · rw [abs_lt] + constructor <;> linarith [hr.1, hr.2] + · rw [abs_lt] + exact ⟨ht.1, ht.2⟩ + · exact ((convex_Ioo _ _).prod (convex_Ioo _ _)).isPreconnected.image _ hPc.continuousOn + · let Q : ℂ → ℝ × ℝ := fun u ↦ (‖u‖, Complex.arg (u / w)) + have hdiv : w / w = 1 := div_self hw0 + have hQ : ContinuousAt Q w := by + refine continuous_norm.continuousAt.prodMk ?_ + have hA : ContinuousAt Complex.arg (w / w) := by + rw [hdiv] + exact Complex.continuousAt_arg (by simp) + exact ContinuousAt.comp (f := fun u : ℂ ↦ u / w) hA (by fun_prop) + have hQw : Q w = (1, 0) := by simp [Q, hw, hdiv] + refine ⟨Q ⁻¹' (Ioo (1 - ε) (1 + ε) ×ˢ Ioo (-ε) ε), hQ.preimage_mem_nhds ?_, ?_⟩ + · rw [hQw] + exact (isOpen_Ioo.prod isOpen_Ioo).mem_nhds ⟨⟨by linarith, by linarith⟩, ⟨by linarith, hε⟩⟩ + · rintro u ⟨hu, hu'⟩ + refine ⟨(‖u‖, Complex.arg (u / w)), ⟨⟨hu, hu'.1.2⟩, hu'.2⟩, ?_⟩ + have h := Complex.norm_mul_exp_arg_mul_I (u / w) + have hn : ‖u / w‖ = ‖u‖ := by simp [hw] + rw [hn] at h + change (‖u‖ : ℂ) * w * Complex.exp (Complex.arg (u / w) * Complex.I) = u + calc (‖u‖ : ℂ) * w * Complex.exp (Complex.arg (u / w) * Complex.I) + = w * ((‖u‖ : ℂ) * Complex.exp (Complex.arg (u / w) * Complex.I)) := by ring + _ = u := by rw [h]; field_simp + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +/-- **The outside of a disc near a boundary point.** The point `y` of the boundary of `Δ` lies off +`bd(Σ)`. Then +`Σ \ Δ` is connected near `y`, and `y` is a limit of it. -/ +theorem isConnectedNear_compl_disc (hS : IsSurface S) {Δ : Set S} (hΔ : IsClosedDisc Δ) {y : S} + (hy : y ∈ discBd Δ) (hi : y ∉ bd S) : IsConnectedNear Δᶜ y ∧ y ∈ closure Δᶜ := by + have hman : ∀ x : S, IsManifoldPoint x := hS.2.2 + have hbdc : IsClosed (bd S) := (cuff_statement S hS).1 + have hnotnhds : ∀ {E : Set S}, E ⊆ Δ → E ∉ 𝓝 y := fun hE hn ↦ + hi (mem_bd_of_disc (Filter.mem_of_superset hn hE) hy) + refine ⟨?_, ?_⟩ + swap + · rw [closure_compl] + exact fun h ↦ hnotnhds subset_rfl (mem_interior_iff_mem_nhds.mp h) + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + have hyΔ : y ∈ Δ := discBd_subset Δ hy + have hgy : g (h y) = y := c.gh hyΔ + have hz : h y ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem h hy + set z := h y with hzdef + have hzn : ‖z‖ = 1 := by simpa using hz + have hzc : z ∈ closedBall (0 : ℂ) 1 := sphere_subset_closedBall hz + have hgpre : g ⁻¹' (bd S)ᶜ ∈ 𝓝[closedBall 0 1] z := + (c.gc z hzc).preimage_mem_nhdsWithin (hbdc.isOpen_compl.mem_nhds (by rwa [hgy])) + obtain ⟨ε, hε, hsub⟩ := Metric.mem_nhdsWithin_iff.mp hgpre + let Z : Set ℂ := closedBall 0 1 ∩ closedBall z (ε / 2) + have hZsub : Z ⊆ closedBall 0 1 := inter_subset_left + have hZint : (interior Z).Nonempty := by + let t : ℝ := min (ε / 4) (1 / 2) + have ht0 : 0 < t := lt_min (by linarith) (by norm_num) + have ht1 : t ≤ ε / 4 := min_le_left _ _ + have ht2 : t ≤ 1 / 2 := min_le_right _ _ + let p : ℂ := ((1 - t : ℝ) : ℂ) * z + refine ⟨p, mem_interior.mpr ⟨ball p (t / 2), ?_, isOpen_ball, mem_ball_self (by linarith)⟩⟩ + intro u hu + have hu' : ‖u - p‖ < t / 2 := by simpa [dist_eq_norm] using hu + have hp : ‖p‖ = 1 - t := by + simp only [p, norm_mul, hzn, mul_one, Complex.norm_real, Real.norm_eq_abs] + exact abs_of_nonneg (by linarith) + have hpz : ‖p - z‖ = t := by + have : p - z = -((t : ℝ) : ℂ) * z := by + simp only [p] + push_cast + ring + rw [this, norm_mul, norm_neg, hzn, mul_one, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos ht0] + constructor + · rw [mem_closedBall, dist_zero_right] + calc ‖u‖ = ‖(u - p) + p‖ := by rw [sub_add_cancel] + _ ≤ ‖u - p‖ + ‖p‖ := norm_add_le _ _ + _ ≤ 1 := by linarith + · rw [mem_closedBall, dist_eq_norm] + calc ‖u - z‖ = ‖(u - p) + (p - z)‖ := by rw [sub_add_sub_cancel] + _ ≤ ‖u - p‖ + ‖p - z‖ := norm_add_le _ _ + _ ≤ ε / 2 := by linarith + have hZd := isClosedDisc_of_convex ((convex_closedBall _ _).inter (convex_closedBall _ _)) hZint + (isBounded_closedBall.subset hZsub) (isClosed_closedBall.inter isClosed_closedBall) + have hΔ₀ : IsClosedDisc (g '' Z) := (c.disc_g hZsub hZd.1).1 + have hΔ₀sub : g '' Z ⊆ Δ := image_subset_iff.mpr fun u hu ↦ c.gm (hZsub hu) + have hΔ₀int : g '' Z ⊆ (bd S)ᶜ := by + rintro _ ⟨u, hu, rfl⟩ + refine hsub ⟨?_, hu.1⟩ + exact closedBall_subset_ball (half_lt_self hε) hu.2 + have hyZ : y ∈ g '' Z := ⟨z, ⟨hzc, mem_closedBall_self (by linarith)⟩, hgy⟩ + have hybd : y ∈ discBd (g '' Z) := by + by_contra hn + exact hnotnhds hΔ₀sub (Filter.mem_of_superset + ((hΔ₀.isOpen_discInt hman).mem_nhds ⟨hyZ, hn⟩) sdiff_subset) + obtain ⟨E, hE, hin, -⟩ := Surface.exists_disc_around hman hΔ₀ + (fun x hx ↦ not_not.mp (hΔ₀int (discBd_subset _ hx))) isOpen_univ (subset_univ _) + obtain ⟨p⟩ := hΔ₀.isOArc_discBd + obtain ⟨cc, c', hcc, hc', hccm, hc'm, hl, hr, himg, -, hcirc⟩ := exists_disc_collar hΔ₀ hE hin p + let w : Circle := p.symm ⟨y, hybd⟩ + have hccw : cc w = y := by rw [hcirc]; simp [w] + have hwn : ‖(w : ℂ)‖ = 1 := by simp + have hw2 : (w : ℂ) ∈ ball (0 : ℂ) 2 := by simp [hwn] + have hcw : (w : ℂ) ∈ closedBall (0 : ℂ) 2 := ball_subset_closedBall hw2 + have hc'y : c' y = w := by rw [← hccw]; exact hl hcw + -- points of `Δ` near `y` are in the small part + let K₀ : Set S := g '' (closedBall 0 1 \ ball z (ε / 2)) + have hK₀c : IsClosed K₀ := (((isCompact_closedBall (0 : ℂ) 1).inter_right + isOpen_ball.isClosed_compl).image_of_continuousOn + (c.gc.mono inter_subset_left)).isClosed + have hyK₀ : y ∉ K₀ := by + rintro ⟨u, hu, hgu⟩ + have : u = z := by rw [hzdef, ← hgu]; exact (c.hg hu.1).symm + exact hu.2 (this ▸ mem_ball_self (by linarith)) + have hΔK₀ : ∀ x ∈ Δ, x ∉ K₀ → x ∈ g '' Z := by + intro x hx hxn + have hxm := c.hm hx + by_cases hb : h x ∈ ball z (ε / 2) + · exact ⟨h x, ⟨hxm, ball_subset_closedBall hb⟩, c.gh hx⟩ + · exact absurd ⟨h x, ⟨hxm, hb⟩, c.gh hx⟩ hxn + intro W hW + have hW₀ : W ∩ K₀ᶜ ∈ 𝓝 y := Filter.inter_mem hW (hK₀c.isOpen_compl.mem_nhds hyK₀) + have hcat : ContinuousAt cc w := hcc.continuousAt + (Filter.mem_of_superset (isOpen_ball.mem_nhds hw2) ball_subset_closedBall) + have hW₂ : cc ⁻¹' (W ∩ K₀ᶜ) ∩ closedBall 0 2 ∈ 𝓝 (w : ℂ) := Filter.inter_mem + (hcat.preimage_mem_nhds (by rwa [hccw])) + (Filter.mem_of_superset (isOpen_ball.mem_nhds hw2) ball_subset_closedBall) + obtain ⟨B, hBs, hBc, W', hW', hW'B⟩ := outside_near hwn _ hW₂ + have hdE : IsOpen (discInt E) := hE.isOpen_discInt hman + have hyE : y ∈ discInt E := hin hyZ + have hc'at : ContinuousAt c' y := hc'.continuousAt + (Filter.mem_of_superset (hdE.mem_nhds hyE) sdiff_subset) + refine ⟨cc '' B, ?_, hBc.image _ (hcc.mono fun u hu ↦ (hBs hu).2.2), discInt E ∩ c' ⁻¹' W', + Filter.inter_mem (hdE.mem_nhds hyE) (hc'at.preimage_mem_nhds (by rwa [hc'y])), ?_⟩ + · rintro _ ⟨u, hu, rfl⟩ + obtain ⟨hu₁, ⟨hu₂, hu₃⟩, hu₄⟩ := hBs hu + refine ⟨fun hmem ↦ ?_, hu₂⟩ + obtain ⟨v, hv, hve⟩ := himg.symm ▸ hΔK₀ _ hmem hu₃ + have hv2 : v ∈ closedBall (0 : ℂ) 2 := closedBall_subset_closedBall (by norm_num) hv + have : v = u := by rw [← hl hv2, ← hl hu₄, hve] + rw [mem_closedBall, dist_zero_right, this] at hv + exact absurd hu₁ (not_lt.mpr hv) + · rintro x ⟨hxΔ, hxE, hxW⟩ + have hxE' : x ∈ E := hxE.1 + have hu := hc'm hxE' + refine ⟨c' x, hW'B ⟨?_, hxW⟩, hr hxE'⟩ + by_contra hnl + have hu1 : c' x ∈ closedBall (0 : ℂ) 1 := by + rw [mem_closedBall, dist_zero_right] + exact not_lt.mp hnl + have : x ∈ g '' Z := by + rw [← himg, ← hr hxE'] + exact mem_image_of_mem cc hu1 + exact hxΔ (hΔ₀sub this) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/DiscSides.lean b/LeanPool/GraphMinor/GM19/DiscSides.lean new file mode 100644 index 0000000000..a2714f3958 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/DiscSides.lean @@ -0,0 +1,174 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section8f +import LeanPool.GraphMinor.Surface.Collar +import Mathlib.Analysis.Normed.Module.Connected +import Mathlib.LinearAlgebra.Complex.FiniteDimensional + +/-! +# The two sides of a closed disc + +In a closed connected surface, the complement of a closed disc is connected +(`isPreconnected_compl_disc`). So the complement of an `O`-arc that bounds a closed disc has exactly +two components, and a second closed disc with the same boundary is the closure of the complement of +the first (`discInt_eq_compl`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface + +variable {T : Type} [TopologicalSpace T] [T2Space T] [ConnectedSpace T] + +theorem isPreconnected_annulus : IsPreconnected {z : ℂ | 1 < ‖z‖ ∧ ‖z‖ < 2} := by + have hs : IsPreconnected (sphere (0 : ℂ) 1) := + isPreconnected_sphere (by simp [Complex.rank_real_complex]) 0 1 + have h := (isPreconnected_Ioo (a := (1 : ℝ)) (b := 2)).prod hs + have hc : Continuous fun x : ℝ × ℂ ↦ (x.1 : ℂ) * x.2 := by fun_prop + convert h.image _ hc.continuousOn using 1 + ext z + constructor + · rintro ⟨h₁, h₂⟩ + have hz : ‖z‖ ≠ 0 := by linarith + refine ⟨(‖z‖, z / ‖z‖), ⟨⟨h₁, h₂⟩, ?_⟩, ?_⟩ + · simp [hz] + · have : (‖z‖ : ℂ) ≠ 0 := by exact_mod_cast hz + field_simp + · rintro ⟨⟨r, w⟩, ⟨⟨h₁, h₂⟩, hw⟩, rfl⟩ + have h₁' : 1 < r := h₁ + have h₂' : r < 2 := h₂ + have hw' : ‖w‖ = 1 := by simpa using hw + have hr : ‖(r : ℂ)‖ = r := by + rw [Complex.norm_real, Real.norm_of_nonneg (by linarith)] + change 1 < ‖(r : ℂ) * w‖ ∧ ‖(r : ℂ) * w‖ < 2 + rw [norm_mul, hr, hw', mul_one] + exact ⟨h₁', h₂'⟩ + +omit [ConnectedSpace T] in +/-- **Removing a closed disc from a connected open set leaves a connected set.** Take a larger +closed +disc around the disc, inside the open set `G`. A component of `G \ Δ` that misses the open annulus +between the two discs would be open and closed in `G`. So every component contains the annulus. -/ +theorem isPreconnected_sdiff_disc (hT : IsClosedSurface T) {G Δ : Set T} (hG : IsOpen G) + (hGc : IsPreconnected G) (hΔ : IsClosedDisc Δ) (hΔG : Δ ⊆ G) : IsPreconnected (G \ Δ) := by + have hman : ∀ x : T, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hlc : LocallyConnectedSpace T := GM11.IsClosedSurface.locallyConnectedSpace hT + obtain ⟨Δ', hΔ', hin, hΔ'G⟩ := Surface.exists_disc_around hman hΔ (fun x _ ↦ hT.2.2 x) hG + ((Surface.discBd_subset _).trans hΔG) + obtain ⟨p⟩ := hΔ.isOArc_discBd + obtain ⟨c, c', hc, -, hmap₀, hmap', hinv, hrinv, hball, hsph, -⟩ := exists_disc_collar hΔ hΔ' hin + p + let N : Set T := c '' {z : ℂ | 1 < ‖z‖ ∧ ‖z‖ < 2} + have hsubA : {z : ℂ | 1 < ‖z‖ ∧ ‖z‖ < 2} ⊆ closedBall 0 2 := fun z hz ↦ by + simpa using hz.2.le + have hNc : IsPreconnected N := isPreconnected_annulus.image _ (hc.mono hsubA) + have hNΔ : N ⊆ G \ Δ := by + rintro _ ⟨z, hz, rfl⟩ + refine ⟨?_, fun hzΔ ↦ ?_⟩ + · have := hΔ'G (hmap₀ (hsubA hz)) + exact this.elim (fun h ↦ hΔG h) id + rw [← hball] at hzΔ + obtain ⟨y, hy, hyz⟩ := hzΔ + have hyb : y ∈ closedBall (0 : ℂ) 2 := closedBall_subset_closedBall (by norm_num) hy + have : y = z := by + have := congrArg c' hyz + rwa [hinv hyb, hinv (hsubA hz)] at this + have hy' : ‖y‖ ≤ 1 := by simpa using hy + rw [this] at hy' + linarith [hz.1] + have hmemN : ∀ y ∈ discInt Δ', y ∉ Δ → y ∈ N := by + intro y hy hyΔ + have hyD : y ∈ c '' closedBall 0 2 := ⟨c' y, hmap' hy.1, hrinv hy.1⟩ + obtain ⟨z, hz, rfl⟩ := hyD + have h₂ : ‖z‖ ≤ 2 := by simpa using hz + refine ⟨z, ⟨?_, lt_of_le_of_ne h₂ fun h ↦ hy.2 ?_⟩, rfl⟩ + · by_contra hn + exact hyΔ (hball ▸ mem_image_of_mem _ (by simpa using not_lt.mp hn)) + · rw [← hsph] + exact mem_image_of_mem _ (by simpa using h) + have hopen : IsOpen (G \ Δ) := hG.sdiff hΔ.isClosed + have hbdint : discBd Δ ⊆ discInt Δ' := fun x hx ↦ hin (Surface.discBd_subset _ hx) + have key : ∀ y ∈ G \ Δ, (connectedComponentIn (G \ Δ) y ∩ N).Nonempty := by + intro y hy + by_contra hn + set C := connectedComponentIn (G \ Δ) y with hC + have hCo : IsOpen C := hopen.connectedComponentIn + have hCne : C.Nonempty := ⟨y, mem_connectedComponentIn hy⟩ + have hCsub : C ⊆ G \ Δ := connectedComponentIn_subset _ _ + have hclosed : closure C ∩ G ⊆ C := by + rintro x ⟨hx, hxG⟩ + by_cases hxΔ : x ∈ Δ + · exfalso + by_cases hxb : x ∈ discBd Δ + · obtain ⟨z, hzO, hzC⟩ := mem_closure_iff.mp hx _ (hΔ'.isOpen_discInt hman) (hbdint hxb) + exact hn ⟨z, hzC, hmemN z hzO (hCsub hzC).2⟩ + · obtain ⟨z, hzO, hzC⟩ := mem_closure_iff.mp hx _ (hΔ.isOpen_discInt hman) ⟨hxΔ, hxb⟩ + exact (hCsub hzC).2 hzO.1 + · have hxm : x ∈ G \ Δ := ⟨hxG, hxΔ⟩ + obtain ⟨z, hzx, hzC⟩ := mem_closure_iff.mp hx _ (hopen.connectedComponentIn (x := x)) + (mem_connectedComponentIn hxm) + have hsame : C = connectedComponentIn (G \ Δ) x := by + rw [hC, connectedComponentIn_eq hzC, connectedComponentIn_eq hzx] + rw [hsame] + exact mem_connectedComponentIn hxm + have hGC : G ⊆ C := by + refine hGc.subset_left_of_subset_union hCo isClosed_closure.isOpen_compl + (disjoint_left.mpr fun w hw hn ↦ hn (subset_closure hw)) (fun x hx ↦ ?_) + ⟨y, hy.1, mem_connectedComponentIn hy⟩ + by_cases hxc : x ∈ closure C + · exact Or.inl (hclosed ⟨hxc, hx⟩) + · exact Or.inr hxc + obtain ⟨d, hd⟩ := hΔ.nonempty_discInt + exact (hCsub (hGC (hΔG hd.1))).2 hd.1 + by_cases hemp : G \ Δ = ∅ + · rw [hemp] + exact isPreconnected_empty + obtain ⟨y, hy⟩ := nonempty_iff_ne_empty.mpr hemp + have hall : G \ Δ ⊆ connectedComponentIn (G \ Δ) y := by + intro z hz + obtain ⟨t₁, ht₁, ht₁N⟩ := key y hy + obtain ⟨t₂, ht₂, ht₂N⟩ := key z hz + have ht : t₂ ∈ connectedComponentIn (G \ Δ) t₁ := hNc.subset_connectedComponentIn ht₁N hNΔ ht₂N + rw [connectedComponentIn_eq ht₁, connectedComponentIn_eq ht] + rw [← connectedComponentIn_eq ht₂] + exact mem_connectedComponentIn hz + rw [Subset.antisymm hall (connectedComponentIn_subset _ _)] + exact isPreconnected_connectedComponentIn + +/-- **The complement of a closed disc in a closed connected surface is connected.** -/ +theorem isPreconnected_compl_disc (hT : IsClosedSurface T) {Δ : Set T} (hΔ : IsClosedDisc Δ) : + IsPreconnected Δᶜ := by + have h := isPreconnected_sdiff_disc hT isOpen_univ isPreconnected_univ hΔ (subset_univ _) + rwa [← compl_eq_univ_sdiff] at h + +/-- A second closed disc with the same boundary fills the complement of the first. -/ +theorem discInt_eq_compl (hT : IsClosedSurface T) {Δ Δ₂ : Set T} (hΔ : IsClosedDisc Δ) + (hΔ₂ : IsClosedDisc Δ₂) (hbd : discBd Δ = discBd Δ₂) (hne : Δ ≠ Δ₂) : + discInt Δ₂ = Δᶜ := by + have hman : ∀ x : T, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hdis := discInt_disjoint hT hΔ hΔ₂ hbd hne + have hsub : discInt Δ₂ ⊆ Δᶜ := by + intro x hx hxΔ + by_cases hxb : x ∈ discBd Δ + · exact hx.2 (hbd ▸ hxb) + · exact disjoint_left.mp hdis ⟨hxΔ, hxb⟩ hx + refine Subset.antisymm hsub ?_ + obtain ⟨y, hy⟩ := hΔ₂.nonempty_discInt + refine (isPreconnected_compl_disc hT hΔ).subset_left_of_subset_union (hΔ₂.isOpen_discInt hman) + hΔ₂.isClosed.isOpen_compl (disjoint_left.mpr fun w hw hn ↦ hn hw.1) (fun x hx ↦ ?_) + ⟨y, hsub hy, hy⟩ + by_cases hxΔ : x ∈ Δ₂ + · exact Or.inl ⟨hxΔ, fun hb ↦ hx (Surface.discBd_subset _ (hbd.symm ▸ hb))⟩ + · exact Or.inr hxΔ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/DiscTouch.lean b/LeanPool/GraphMinor/GM19/DiscTouch.lean new file mode 100644 index 0000000000..47907f5141 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/DiscTouch.lean @@ -0,0 +1,140 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FragmentCollapse +public import LeanPool.GraphMinor.Surface.ArcDisc +public import Mathlib.Analysis.Convex.StrictConvexSpace +public import Mathlib.Analysis.InnerProductSpace.Convex +public import Mathlib.Analysis.Complex.Basic +public import Mathlib.Analysis.Convex.Join + +/-! +# A smaller disc that touches the boundary in given points + +Let `D` be a closed disc and let `N` be a finite nonempty subset of its boundary. Then `D` holds a +closed disc that meets the boundary of `D` exactly in `N`. In the unit disc we take the convex hull +of `N` and a smaller disc. The +hull meets the unit circle only in `N`, since a segment between two points of the closed unit disc +lies in the open disc except at its ends. + +The proof of (15.2) applies this to the disc of a cuff and to the disc of an edge of size 3. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface + +/-- The convex hull of a nonempty finite set of the plane and a compact convex nonempty set is +compact. -/ +theorem isCompact_convexHull_union {A B : Set ℂ} (hA : A.Finite) (hAn : A.Nonempty) + (hB : IsCompact B) (hBc : Convex ℝ B) (hBn : B.Nonempty) : IsCompact (convexHull ℝ (A ∪ B)) := by + rw [convexHull_union (hAn) hBn, hBc.convexHull_eq] + have hA' : IsCompact (convexHull ℝ A) := hA.isCompact_convexHull (𝕜 := ℝ) + have himg : convexJoin ℝ (convexHull ℝ A) B = (fun p : ℂ × ℂ × ℝ => + (1 - p.2.2) • p.1 + p.2.2 • p.2.1) '' (convexHull ℝ A ×ˢ B ×ˢ Icc 0 1) := by + ext x + rw [mem_convexJoin] + constructor + · rintro ⟨a, ha, b, hb, hx⟩ + rw [segment_eq_image] at hx + obtain ⟨t, ht, rfl⟩ := hx + exact ⟨(a, b, t), ⟨ha, hb, ht⟩, rfl⟩ + · rintro ⟨⟨a, b, t⟩, ⟨ha, hb, ht⟩, rfl⟩ + refine ⟨a, ha, b, hb, ?_⟩ + rw [segment_eq_image] + exact ⟨t, ht, rfl⟩ + rw [himg] + exact (hA'.prod (hB.prod isCompact_Icc)).image (by fun_prop) + +/-- The open unit disc with a set of points of the unit circle is convex. -/ +theorem convex_ball_union_of_subset_sphere {N : Set ℂ} (hN : N ⊆ sphere 0 1) : Convex ℝ (ball + (0 : ℂ) 1 ∪ N) := by + have hstrict : StrictConvex ℝ (closedBall (0 : ℂ) 1) := strictConvex_closedBall ℝ 0 1 + have hint : interior (closedBall (0 : ℂ) 1) = ball 0 1 := interior_closedBall _ one_ne_zero + have hsub : ball (0 : ℂ) 1 ∪ N ⊆ closedBall 0 1 := union_subset ball_subset_closedBall + (hN.trans sphere_subset_closedBall) + intro x hx y hy a b ha hb hab + rcases ha.eq_or_lt with rfl | ha' + · have : b = 1 := by linarith + subst this + simpa using hy + rcases hb.eq_or_lt with rfl | hb' + · have : a = 1 := by linarith + subst this + simpa using hx + by_cases hxy : x = y + · subst hxy + have : a • x + b • x = x := by rw [← add_smul, hab, one_smul] + rwa [this] + · exact .inl (hint ▸ hstrict (hsub hx) (hsub hy) hxy ha' hb' hab) + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +/-- **A disc that touches the boundary of a closed disc in a given finite set.** -/ +theorem IsClosedDisc.exists_touching {D : Set S} (hD : IsClosedDisc D) {N : Set S} + (hN : N ⊆ discBd D) (hfin : N.Finite) (hne : N.Nonempty) : + ∃ D', IsClosedDisc D' ∧ D' ⊆ D ∧ D' ∩ discBd D = N ∧ N ⊆ discBd D' := by + classical + obtain ⟨h, g, c⟩ := hD.exists_isChart + set N₀ := h '' N with hN₀ + have hNs : N₀ ⊆ sphere 0 1 := fun x hx => by + obtain ⟨y, hy, rfl⟩ := hx + exact c.bd ▸ mem_image_of_mem h (hN hy) + set K := convexHull ℝ (N₀ ∪ closedBall (0 : ℂ) (1 / 2)) with hK + have hKcpt : IsCompact K := isCompact_convexHull_union (hfin.image h) (hne.image h) + (isCompact_closedBall _ _) (convex_closedBall _ _) ⟨0, by simp⟩ + have hKcl : IsClosed K := hKcpt.isClosed + have hKc : Convex ℝ K := convex_convexHull _ _ + have hsmall : ball (0 : ℂ) (1 / 2) ⊆ K := ball_subset_closedBall.trans (subset_union_right.trans + (subset_convexHull _ _)) + have hKQ : K ⊆ ball 0 1 ∪ N₀ := convexHull_min (union_subset subset_union_right (fun x hx => .inl + (closedBall_subset_ball (by norm_num) hx))) (convex_ball_union_of_subset_sphere hNs) + have hKb : K ⊆ closedBall 0 1 := hKQ.trans (union_subset ball_subset_closedBall + (hNs.trans sphere_subset_closedBall)) + have hint : (interior K).Nonempty := by + refine ⟨0, interior_mono hsmall ?_⟩ + rw [isOpen_ball.interior_eq] + simp + obtain ⟨hKd, hKf⟩ := isClosedDisc_of_convex hKc hint (isBounded_closedBall.subset hKb) hKcl + have hgi : InjOn g K := fun x hx y hy he => by + have h₁ := c.hg (hKb hx) + have h₂ := c.hg (hKb hy) + rw [← h₁, ← h₂] + exact congrArg h he + obtain ⟨hd', hb'⟩ := isClosedDisc_image_injOn hKd (c.gc.mono hKb) hgi + rw [hKf] at hb' + have hmemK : ∀ n ∈ N, h n ∈ K := fun n hn => subset_convexHull _ _ (.inl (mem_image_of_mem _ hn)) + have hgh : ∀ n ∈ N, g (h n) = n := fun n hn => c.gh (Surface.discBd_subset _ (hN hn)) + refine ⟨g '' K, hd', ?_, ?_, ?_⟩ + · rintro _ ⟨y, hy, rfl⟩ + exact c.gm (hKb hy) + · ext x + constructor + · rintro ⟨⟨y, hy, rfl⟩, hb⟩ + have h₁ : h (g y) ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem h hb + rw [c.hg (hKb hy)] at h₁ + rcases hKQ hy with hy' | ⟨n, hn, rfl⟩ + · exact absurd h₁ (fun h' => (ne_of_lt (mem_ball_zero_iff.mp hy')) + (mem_sphere_zero_iff_norm.mp h')) + · rwa [hgh n hn] + · intro hx + exact ⟨⟨h x, hmemK x hx, hgh x hx⟩, hN hx⟩ + · intro n hn + rw [hb', ← hgh n hn] + refine mem_image_of_mem _ ⟨subset_closure (hmemK n hn), fun hi => ?_⟩ + have h₁ : h n ∈ ball (0 : ℂ) 1 := by + have := interior_mono hKb hi + rwa [interior_closedBall _ one_ne_zero] at this + have h₂ : h n ∈ sphere (0 : ℂ) 1 := hNs (mem_image_of_mem _ hn) + exact (ne_of_lt (mem_ball_zero_iff.mp h₁)) (mem_sphere_zero_iff_norm.mp h₂) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Feasibility.lean b/LeanPool/GraphMinor/GM19/Feasibility.lean new file mode 100644 index 0000000000..8e6978752b --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Feasibility.lean @@ -0,0 +1,698 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.PadData +public import LeanPool.GraphMinor.GM19.Conditional3 + +/-! +# Graph Minors XIX, (15.2): the topological step + +We prove `Theorem152FeasibilityStatement`, which is steps (2) and (3) of the proof of (15.2), pages +381 and 382. The model has a pad for each disc of the family: the disc pasted on a cuff, the closed +disc +of an edge of size 3, and a thin disc around an edge of size 2 (`exists_pads`). The pads meet only +in `V(Γ₀)`. The order data of the pads hold because of the order along the sides, and because of the +hypothesis +on orientations for edges of size 3. Then `exists_realizing_discs` gives the homeomorphism `α` of +step (2) and pulls back the discs of step (3). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Metric Topology GraphMinor.Surface GraphMinor.GM11 + +universe w + +local notation "𝕀" => unitInterval + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +omit [T2Space S] in +/-- A line edge, with the two ends written as its march. -/ +theorem Painting.exists_march (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) (h2 : (tilde e).ncard + = 2) : ∃ u w, Γ.γ e = [u, w] ∧ IsLineWithEnds (closure e) u w := by + obtain ⟨f, hne, hset⟩ := Γ.exists_line he h2 + rcases list_pair (Γ.γ_nodup e he) (by rw [Γ.γ_set e he, hset]) hne with h | h + · exact ⟨_, _, h, f, rfl, rfl⟩ + · exact ⟨_, _, h, (Surface.IsLineWithEnds.symm (L := closure e) ⟨f, rfl, rfl⟩)⟩ + +omit [T2Space S] [T2Space Shat] in +theorem isLineWithEnds_emb (cap : IsCappedSurface S Shat) {L : Set S} {u w : S} + (h : IsLineWithEnds L u w) : IsLineWithEnds (cap.emb '' L) (cap.emb u) (cap.emb w) := by + obtain ⟨f, h0, h1⟩ := h + refine ⟨f.trans (cap.isEmbedding.homeomorphImage L), ?_, ?_⟩ + · change cap.emb (f 0).1 = _ + rw [h0] + · change cap.emb (f 1).1 = _ + rw [h1] + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {P₀ : ColouredPainting χ} {n : ℕ} {b : Set S → Set S} + +/-- The closed set of each disc of the family, in the model `Γ₀`. -/ +def padBase (cap : IsCappedSurface S Shat) (P₀ : ColouredPainting χ) : DiscIndex S P₀ → Set Shat + | .inl Θ => closure (cap.cuffDisc Θ.1) + | .inr e => cap.emb '' closure e.1 + +omit [T2Space S] in +theorem closure_inter_closure (Γ : Painting S) {e e' : Set S} (he : e ∈ Γ.E) (he' : e' ∈ Γ.E) + (hne : e ≠ e') : closure e ∩ closure e' ⊆ Γ.V := by + rintro z ⟨hz, hz'⟩ + by_cases h₁ : z ∈ e + · by_cases h₂ : z ∈ e' + · exact absurd (arcComponent_eq he he' h₁ h₂) hne + · exact Γ.tilde_subset_V he' ⟨hz', h₂⟩ + · exact Γ.tilde_subset_V he ⟨hz, h₁⟩ + +omit [T2Space Shat] in +omit [T2Space S] in +theorem padBase_inter {i j : DiscIndex S P₀} (hne : i ≠ j) : padBase cap P₀ i ∩ + padBase cap P₀ j ⊆ cap.emb '' P₀.Γ.V := by + have key : ∀ (Θ : {Θ : Set S // Θ ∈ cuffs S}) (e : {e : Set S // e ∈ P₀.Γ.E + ∧ Painting.IsInternal e}), + closure (cap.cuffDisc Θ.1) ∩ cap.emb '' closure e.1 ⊆ cap.emb '' P₀.Γ.V := by + rintro Θ e x ⟨hx, z, hz, rfl⟩ + rw [cap.closure_cuffDisc Θ.2] at hx + rcases hx with h | ⟨y, hy, hyz⟩ + · exact absurd (mem_range_self z) (cap.notMem_range Θ.2 h) + · obtain rfl := cap.isEmbedding.injective hyz + have hnz : y ∉ e.1 := fun h' => Set.disjoint_left.mp e.2.2 h' (cuff_subset_bd ⟨Θ.1, Θ.2⟩ hy) + exact mem_image_of_mem _ (P₀.Γ.tilde_subset_V e.2.1 ⟨hz, hnz⟩) + rcases i with Θ | e <;> rcases j with Θ' | e' + · intro x hx + have hd := cap.cuffDisc_disjoint Θ.1 Θ.2 Θ'.1 Θ'.2 fun h => hne (congrArg Sum.inl + (Subtype.ext h)) + exact absurd hx.2 (Set.disjoint_left.mp hd hx.1) + · exact key Θ e' + · intro x hx + exact key Θ' e ⟨hx.2, hx.1⟩ + · rintro _ ⟨⟨z, hz, rfl⟩, z', hz', he⟩ + obtain rfl := cap.isEmbedding.injective he + exact mem_image_of_mem _ (closure_inter_closure P₀.Γ e.2.1 e'.2.1 (fun h => hne + (congrArg Sum.inr (Subtype.ext h))) ⟨hz, hz'⟩) + +omit [T2Space S] in +theorem isClosed_padBase (hS : IsSurface S) (i : DiscIndex S P₀) : IsClosed (padBase cap P₀ i) := by + rcases i with Θ | e + · exact isClosed_closure + · have := hS.1 + exact (isClosed_closure.isCompact.image cap.isEmbedding.continuous).isClosed + +omit [T2Space S] [T2Space Shat] in +theorem discBd_emb (cap : IsCappedSurface S Shat) {X : Set S} (hX : IsClosedDisc X) : IsClosedDisc + (cap.emb '' X) ∧ discBd (cap.emb '' X) = cap.emb '' discBd X := + isClosedDisc_image hX cap.isEmbedding + +omit [T2Space S] in +/-- **The pads.** -/ +theorem exists_pads (hS : IsSurface S) (P₀ : ColouredPainting χ) (cap : IsCappedSurface S Shat) : + ∃ C : DiscIndex S P₀ → Set Shat, (∀ i, IsClosedDisc (C i)) ∧ (∀ i j, i ≠ j + → C i ∩ C j ⊆ cap.emb '' P₀.Γ.V) ∧ (∀ i, cap.emb '' P₀.Γ.V ∩ C i ⊆ discBd (C i)) ∧ + (∀ Θ, C (.inl Θ) = closure (cap.cuffDisc Θ.1)) ∧ (∀ e, (tilde e.1).ncard = 3 → C (.inr e) + = cap.emb '' closure e.1) ∧ ∀ e, cap.emb '' closure e.1 ⊆ C (.inr e) := by + classical + have hT := cap.isClosedSurface + have := finite_discIndex hS P₀ + have hS₀ : Nonempty S := by + have := χ.connected + infer_instance + let L : Set (DiscIndex S P₀) := {i | ∃ e, i = .inr e ∧ (tilde e.1).ncard = 2} + have hVc : IsClosed (cap.emb '' P₀.Γ.V) := (P₀.Γ.finite_V.image _).isClosed + have hline : ∀ i, ∃ u w : Shat, i ∈ L → IsLineWithEnds (padBase cap P₀ i) u w + ∧ padBase cap P₀ i ∩ cap.emb '' P₀.Γ.V = {u, w} := by + intro i + by_cases hi : i ∈ L + · obtain ⟨e, rfl, h2⟩ := hi + obtain ⟨u, w, hγ, hl⟩ := Painting.exists_march P₀.Γ e.2.1 h2 + refine ⟨cap.emb u, cap.emb w, fun _ => ⟨isLineWithEnds_emb cap hl, ?_⟩⟩ + have hset : tilde e.1 = {u, w} := by + rw [← P₀.Γ.γ_set e.1 e.2.1, hγ] + ext x + simp + change cap.emb '' closure e.1 ∩ cap.emb '' P₀.Γ.V = _ + rw [← image_inter cap.isEmbedding.injective, ← image_pair, ← hset] + congr 1 + apply Subset.antisymm + · rintro x ⟨h1, h2⟩ + exact ⟨h1, fun h => P₀.Γ.disjoint_V e.2.1 h h2⟩ + · exact fun x hx => ⟨hx.1, P₀.Γ.tilde_subset_V e.2.1 hx⟩ + · exact ⟨cap.emb (Classical.arbitrary _), cap.emb (Classical.arbitrary _), fun h => absurd h hi⟩ + choose u w hl using hline + obtain ⟨C, -, h2, h3, h4⟩ := exists_thin_family hT (isClosed_padBase hS) hVc (fun i j h + => padBase_inter h) (L := L) (fun i hi => (hl i hi).1) fun i hi => (hl i hi).2 + have hinl : ∀ Θ, (Sum.inl Θ : DiscIndex S P₀) ∉ L := fun Θ ⟨e, he, _⟩ => by cases he + have hthree : ∀ e : {e : Set S // e ∈ P₀.Γ.E ∧ Painting.IsInternal e}, (tilde e.1).ncard = 3 → + (Sum.inr e : DiscIndex S P₀) ∉ L := fun e h3' ⟨e', he, h2'⟩ => by + have : e = e' := Sum.inr.inj he + rw [this] at h3' + omega + have hC₀ : ∀ Θ, C (.inl Θ) = closure (cap.cuffDisc Θ.1) := fun Θ => h3 _ (hinl Θ) + have hC₃ : ∀ e, (tilde e.1).ncard = 3 → C (.inr e) = cap.emb '' closure e.1 := fun e h => h3 _ + (hthree e h) + have hdisc₃ : ∀ e : {e : Set S // e ∈ P₀.Γ.E ∧ Painting.IsInternal e}, (tilde e.1).ncard = 3 + → IsClosedDisc (closure e.1) ∧ tilde e.1 ⊆ discBd (closure e.1) := fun e h => by + rcases P₀.Γ.edge_shape e.1 e.2.1 with h' | h' + · have := h'.1 + omega + · exact ⟨h'.2.2.1, h'.2.2.2⟩ + refine ⟨C, ?_, h2, ?_, hC₀, hC₃, fun e => ?_⟩ + · rintro (Θ | e) + · rw [hC₀] + exact cap.cuffDisc_closedDisc Θ.1 Θ.2 + · rcases P₀.Γ.size_cases e.2.1 with h | h + · exact (h4 _ ⟨e, rfl, h⟩).1 + · rw [hC₃ e h] + exact (discBd_emb cap (hdisc₃ e h).1).1 + · rintro (Θ | e) + · rw [hC₀] + rintro x ⟨⟨v, hv, rfl⟩, hx⟩ + rw [cap.closure_cuffDisc Θ.2] at hx + rcases hx with h | h + · exact absurd (mem_range_self v) (cap.notMem_range Θ.2 h) + · rw [cap.cuffDisc_bd Θ.1 Θ.2] + exact h + · rcases P₀.Γ.size_cases e.2.1 with h | h + · obtain ⟨-, h5, h6, -⟩ := h4 _ ⟨e, rfl, h⟩ + intro x hx + apply h6 + rw [← h5] + exact ⟨hx.2, hx.1⟩ + · rw [hC₃ e h, (discBd_emb cap (hdisc₃ e h).1).2] + rintro _ ⟨⟨v, hv, rfl⟩, ⟨z, hz, he⟩⟩ + obtain rfl := cap.isEmbedding.injective he + exact mem_image_of_mem _ ((hdisc₃ e h).2 ⟨hz, fun h' => P₀.Γ.disjoint_V e.2.1 h' hv⟩) + · rcases P₀.Γ.size_cases e.2.1 with h | h + · exact (h4 _ ⟨e, rfl, h⟩).2.2.2 + · rw [hC₃ e h] + +/-- The vertex of an end, in `Σ̂`. -/ +noncomputable def endMap [Nonempty S] (cap : IsCappedSurface S Shat) (P₀ P : ColouredPainting χ) + (b : Set S → Set S) (x : Shat) : Shat := + cap.emb (endVertex P₀ P b (capBack cap x)) + +omit [T2Space S] [T2Space Shat] in +theorem endMap_emb [Nonempty S] (P₀ P : ColouredPainting χ) (b : Set S → Set S) + (x : S) : endMap cap P₀ P b (cap.emb x) = cap.emb (endVertex P₀ P b x) := by + rw [endMap, capBack_emb] + +/-- The ends of a border edge, or the vertices of its image, in terms of marches. -/ +theorem IsMatchSetting.endVertex_getElem (hM : D.IsMatchSetting P₀ n b) + (hS : IsSurface S) {e : Set S} (he : e ∈ P₀.Γ.E) {i : ℕ} (hi : i < (P₀.Γ.γ e).length) (hi' : i < + (D.P.Γ.γ (b e)).length) : + endVertex P₀ D.P b (D.P.Γ.γ (b e))[i] = (P₀.Γ.γ e)[i] := + hM.endVertex_eq hS ⟨e, he, i, hi, hi', rfl, rfl⟩ + +/-- **The data of a cuff.** -/ +theorem IsMatchSetting.exists_cuff_data [Nonempty S] (hM : D.IsMatchSetting P₀ n b) + (hS : IsSurface S) {Θ : Set S} (hΘ : Θ ∈ cuffs S) {Δ : Set Shat} (hΔ : IsClosedDisc Δ) + (hsub : Δ ⊆ closure (cap.cuffDisc Θ)) + (hY : cap.emb '' cuffEnds P₀ b Θ ⊆ discBd Δ) {𝓖 : Set (Set Shat)} {ϖ₀ : Set Shat → Shat → Shat + → Shat → Prop} (hpart : IsPartialOrientation 𝓖 ϖ₀) (hh : ∀ Δ ∈ 𝓖, ∀ Δ' ⊆ Δ, Δ' ∈ 𝓖) + (hC : closure (cap.cuffDisc Θ) ∈ 𝓖) : + ∃ (c : Shat → ℂ) (g : ℂ → Shat) (q : Circle → Shat) (A U : Shat → ℝ) (ϖ : Set Shat → Shat + → Shat → Shat → Prop), (ϖ = ϖ₀ ∨ ϖ = revPos ϖ₀) ∧ IsChart (closure (cap.cuffDisc Θ)) c g + ∧ IsBdParam Δ q ∧ + PadOrder q g (cap.emb '' cuffEnds P₀ b Θ) (endMap cap P₀ D.P b) A U ∧ (∀ E, IsClosedDisc E + → E ⊆ closure (cap.cuffDisc Θ) → SameOn ϖ (pullPos c planePos) E) ∧ + ∀ a a' a'', a ≠ a' → a' ≠ a'' → a ≠ a'' → (ϖ Δ (q a) (q a') (q a'') ↔ CircleCyclic a a' a'') + := by + have hT := cap.isClosedSurface + have hCd := cap.cuffDisc_closedDisc Θ hΘ + obtain ⟨c₀, g₀, hch₀⟩ := hCd.exists_isChart + obtain ⟨c, g, hch, hP⟩ := hM.exists_cuff_padOrder hS hΘ hch₀ + obtain ⟨ϖ, h1, h2, h3⟩ := exists_chart_sign hT hpart hh hC hCd hch + have hΔG : Δ ∈ 𝓖 := hh _ hC Δ hsub + obtain ⟨q, hqc, hqi, hqr, hq⟩ := h2.dir Δ hΔG hΔ + have hYC : cap.emb '' cuffEnds P₀ b Θ ⊆ discBd (closure (cap.cuffDisc Θ)) := by + rw [cap.cuffDisc_bd Θ hΘ] + exact image_mono fun y hy => (hM.cuffEnds_subset hS hΘ hy).1 + have hbd : ∀ {a}, q a ∈ cap.emb '' cuffEnds P₀ b Θ → q a ∈ discBd Δ ∩ discBd (closure + (cap.cuffDisc Θ)) := fun {a} ha => ⟨hY ha, hYC ha⟩ + obtain ⟨A, U, hO⟩ := hP q hqi (by rw [hqr]; exact hY) fun a a' a'' ha ha' ha'' n1 n2 n3 => by + have m1 : q a ≠ q a' := fun h => n1 (hqi h) + have m2 : q a' ≠ q a'' := fun h => n2 (hqi h) + have m3 : q a ≠ q a'' := fun h => n3 (hqi h) + exact (hq a a' a'' n1 n2 n3).symm.trans ((h2.agree Δ hΔG _ hC hΔ hCd hsub _ _ _ (hbd ha) + (hbd ha') (hbd ha'') m1 m2 m3).trans + ((h3 _ hCd (Subset.refl _) _ _ _ (hbd ha).2 (hbd ha').2 (hbd ha'').2 m1 m2 m3).trans + (chart_cyc hch (hbd ha).2 (hbd ha').2 (hbd ha'').2))) + exact ⟨c, g, q, A, U, ϖ, h1, hch, ⟨hqc, hqi, hqr⟩, hO, h3, hq⟩ + +/-- **The data of an edge of size 2.** -/ +theorem IsMatchSetting.exists_two_data [Nonempty S] (hM : D.IsMatchSetting P₀ n b) + (hS : IsSurface S) {e : Set S} (he : e ∈ P₀.Γ.E) (h2 : (tilde e).ncard + = 2) {C Δ : Set Shat} {c : Shat → ℂ} {g : ℂ → Shat} + (hch : IsChart C c g) (hV : cap.emb '' tilde e ⊆ discBd C) {q : Circle → Shat} + (hq : IsBdParam Δ q) (hY : cap.emb '' tilde (b e) ⊆ discBd Δ) : + ∃ A U : Shat → ℝ, PadOrder q g (cap.emb '' tilde (b e)) (endMap cap P₀ D.P b) A U := by + have hbe := hM.edge.mem e he + obtain ⟨v₀, v₁, hl⟩ := List.length_eq_two.mp ((P₀.Γ.length_γ_eq he).trans h2) + obtain ⟨y₀, y₁, hl'⟩ := List.length_eq_two.mp ((D.P.Γ.length_γ_eq hbe).trans + ((hM.edge.size e he).trans h2)) + have hnv : v₀ ≠ v₁ := by + have := P₀.Γ.γ_nodup e he + rw [hl] at this + simpa using this + have hset : tilde (b e) = {y₀, y₁} := by + rw [← D.P.Γ.γ_set _ hbe, hl'] + ext x + simp + have hsetv : tilde e = {v₀, v₁} := by + rw [← P₀.Γ.γ_set _ he, hl] + ext x + simp + have hmem : ∀ y ∈ tilde (b e), ∃ a, q a = cap.emb y := fun y hy => by + have : cap.emb y ∈ range q := by rw [hq.2.2]; exact hY (mem_image_of_mem _ hy) + exact this + obtain ⟨a₀, ha₀⟩ := hmem y₀ (by rw [hset]; simp) + obtain ⟨a₁, ha₁⟩ := hmem y₁ (by rw [hset]; simp) + have e₀ : endMap cap P₀ D.P b (q a₀) = cap.emb v₀ := by + rw [ha₀, endMap_emb] + have := hM.endVertex_getElem hS he (i := 0) (by simp [hl]) (by simp [hl']) + simpa [hl, hl'] using congrArg cap.emb this + have e₁ : endMap cap P₀ D.P b (q a₁) = cap.emb v₁ := by + rw [ha₁, endMap_emb] + have := hM.endVertex_getElem hS he (i := 1) (by simp [hl]) (by simp [hl']) + simpa [hl, hl'] using congrArg cap.emb this + have hsetq : cap.emb '' tilde (b e) = {q a₀, q a₁} := by rw [hset, image_pair, ha₀, ha₁] + rw [hsetq] + refine padOrder_of_pair hch hq.2.1 ?_ ?_ + · rintro y (rfl | rfl) + · rw [e₀] + exact hV (mem_image_of_mem _ (by rw [hsetv]; simp)) + · rw [e₁] + exact hV (mem_image_of_mem _ (by rw [hsetv]; simp)) + · rw [e₀, e₁] + exact fun h => hnv (cap.isEmbedding.injective h) + +/-- **The data of an edge of size 3**, once the two triples are compared. -/ +theorem IsMatchSetting.exists_three_data [Nonempty S] (hM : D.IsMatchSetting P₀ n b) + (hS : IsSurface S) {e : Set S} (he : e ∈ P₀.Γ.E) {C Δ : Set Shat} {c : Shat → ℂ} {g : ℂ → Shat} + (hch : IsChart C c g) + {v₀ v₁ v₂ y₀ y₁ y₂ : S} (hl : P₀.Γ.γ e = [v₀, v₁, v₂]) (hl' : D.P.Γ.γ (b e) = [y₀, y₁, y₂]) + (hV : cap.emb '' tilde e ⊆ discBd C) {q : Circle → Shat} (hq : IsBdParam Δ q) + (hY : cap.emb '' tilde (b e) ⊆ discBd Δ) + (hcheck : ∀ a₀ a₁ a₂, q a₀ = cap.emb y₀ → q a₁ = cap.emb y₁ → q a₂ = cap.emb y₂ → + (CircleCyclic a₀ a₁ a₂ ↔ CircleCyclic (toCircle (c (cap.emb v₀))) (toCircle (c (cap.emb v₁))) + (toCircle (c (cap.emb v₂))))) : + ∃ A U : Shat → ℝ, PadOrder q g (cap.emb '' tilde (b e)) (endMap cap P₀ D.P b) A U := by + have hbe := hM.edge.mem e he + have hnv := P₀.Γ.γ_nodup e he + have hny := D.P.Γ.γ_nodup _ hbe + rw [hl] at hnv + rw [hl'] at hny + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or, List.nodup_nil, + not_false_eq_true, and_true] at hnv hny + obtain ⟨⟨n01, n02⟩, n12⟩ := hnv + obtain ⟨⟨m01, m02⟩, m12⟩ := hny + have hset : tilde (b e) = {y₀, y₁, y₂} := by + rw [← D.P.Γ.γ_set _ hbe, hl'] + ext x + simp + have hsetv : tilde e = {v₀, v₁, v₂} := by + rw [← P₀.Γ.γ_set _ he, hl] + ext x + simp + have hmem : ∀ y ∈ tilde (b e), ∃ a, q a = cap.emb y := fun y hy => by + have : cap.emb y ∈ range q := by rw [hq.2.2]; exact hY (mem_image_of_mem _ hy) + exact this + obtain ⟨a₀, ha₀⟩ := hmem y₀ (by rw [hset]; simp) + obtain ⟨a₁, ha₁⟩ := hmem y₁ (by rw [hset]; simp) + obtain ⟨a₂, ha₂⟩ := hmem y₂ (by rw [hset]; simp) + have hend : ∀ (i : ℕ) (hi : i < (P₀.Γ.γ e).length) (hi' : i < (D.P.Γ.γ + (b e)).length), endMap cap P₀ D.P b (cap.emb (D.P.Γ.γ (b e))[i]) = cap.emb (P₀.Γ.γ e)[i] + := fun i hi hi' => by + rw [endMap_emb, hM.endVertex_getElem hS he hi hi'] + have e₀ : endMap cap P₀ D.P b (q a₀) = cap.emb v₀ := by + have := hend 0 (by simp [hl]) (by simp [hl']) + simpa [hl, hl', ha₀] using this + have e₁ : endMap cap P₀ D.P b (q a₁) = cap.emb v₁ := by + have := hend 1 (by simp [hl]) (by simp [hl']) + simpa [hl, hl', ha₁] using this + have e₂ : endMap cap P₀ D.P b (q a₂) = cap.emb v₂ := by + have := hend 2 (by simp [hl]) (by simp [hl']) + simpa [hl, hl', ha₂] using this + have hemb := cap.isEmbedding.injective + have hsetq : cap.emb '' tilde (b e) = {q a₀, q a₁, q a₂} := by + rw [hset, image_insert_eq, image_pair, ha₀, ha₁, ha₂] + rw [hsetq] + have hne : ∀ {x y : S} {p p' : Circle}, q p = cap.emb x → q p' = cap.emb y → x ≠ y → p ≠ p' + := fun e1 e2 h he => h (hemb (by rw [← e1, ← e2, he])) + refine padOrder_of_triple hch hq.2.1 (hne ha₀ ha₁ m01) (hne ha₁ ha₂ m12) + (hne ha₀ ha₂ m02) ?_ ?_ ?_ ?_ ?_ + · rintro y (rfl | rfl | rfl) + · rw [e₀] + exact hV (mem_image_of_mem _ (by rw [hsetv]; simp)) + · rw [e₁] + exact hV (mem_image_of_mem _ (by rw [hsetv]; simp)) + · rw [e₂] + exact hV (mem_image_of_mem _ (by rw [hsetv]; simp)) + · rw [e₀, e₁] + exact fun h => n01 (hemb h) + · rw [e₁, e₂] + exact fun h => n12 (hemb h) + · rw [e₀, e₂] + exact fun h => n02 (hemb h) + · rw [e₀, e₁, e₂] + exact hcheck a₀ a₁ a₂ ha₀ ha₁ ha₂ + +omit [T2Space S] in +theorem edge_disc (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) (h3 : (tilde e).ncard + = 3) : IsClosedDisc (closure e) ∧ tilde e ⊆ discBd (closure e) := by + rcases Γ.edge_shape e he with h' | h' + · have := h'.1 + omega + · exact ⟨h'.2.2.1, h'.2.2.2⟩ + +omit [T2Space S] [T2Space Shat] in +/-- A triple that is positive for an orientation of `Σ` is positive for the orientation carried to +`Σ̂`. -/ +theorem pos_emb [Nonempty S] {o : SurfaceOrientation S} {ω : SurfaceOrientation Shat} + (hω : ∀ Δ, IsClosedDisc Δ → Δ ⊆ range cap.emb → SameOn ω.pos (pullPos + (capBack cap) o.pos) Δ) {X : Set S} (hX : IsClosedDisc X) {x y z : S} (hx : x ∈ discBd X) + (hy : y ∈ discBd X) (hz : z ∈ discBd X) (n1 : x ≠ y) + (n2 : y ≠ z) (n3 : x ≠ z) (h : o.pos X x y z) : ω.pos (cap.emb '' X) (cap.emb x) (cap.emb y) + (cap.emb z) := by + have hbd := (discBd_emb cap hX).2 + have hinj := cap.isEmbedding.injective + have hmem {w : S} (hw : w ∈ discBd X) : cap.emb w ∈ discBd (cap.emb '' X) := by + rw [hbd] + exact mem_image_of_mem _ hw + have hs := hω _ (discBd_emb cap hX).1 (image_subset_range _ _) (cap.emb x) (cap.emb y) + (cap.emb z) (hmem hx) (hmem hy) (hmem hz) (fun e => n1 (hinj e)) (fun e => n2 (hinj e)) + (fun e => n3 (hinj e)) + refine hs.2 ?_ + change o.pos (capBack cap '' (cap.emb '' X)) (capBack cap (cap.emb x)) (capBack cap (cap.emb y)) + (capBack cap (cap.emb z)) + have him : capBack cap '' (cap.emb '' X) = X := by + rw [image_image] + simp [capBack_emb] + rw [him, capBack_emb, capBack_emb, capBack_emb] + exact h + +/-- **The data of an edge when `Σ` is oriented.** The hypothesis on orientations compares the disc +of `β(e)` with the disc of `e`. -/ +theorem IsMatchSetting.exists_edge_data_oriented [Nonempty S] (hM : D.IsMatchSetting P₀ n b) + (hS : IsSurface S) {o : SurfaceOrientation S} {ω : SurfaceOrientation Shat} + (ho : ∀ P ∈ ({P₀, D.P} : Set _), ∀ e ∈ P.Γ.E, (tilde e).ncard = 3 → ∀ a b c : S, P.Γ.γ e + = [a, b, c] → o.pos (closure e) a b c) + (hω : ∀ Δ, IsClosedDisc Δ → Δ ⊆ range cap.emb → SameOn ω.pos (pullPos + (capBack cap) o.pos) Δ) {e : Set S} (he : e ∈ P₀.Γ.E) {C Δ : Set Shat} (hCd : IsClosedDisc C) + (hV : cap.emb '' tilde e ⊆ discBd C) + (hC3 : (tilde e).ncard = 3 → C = cap.emb '' closure e) (hΔ : IsClosedDisc Δ) + (hY : cap.emb '' tilde (b e) ⊆ discBd Δ) (hsub : (tilde (b e)).ncard = 3 + → Δ ⊆ cap.emb '' closure (b e)) : + ∃ (c : Shat → ℂ) (g : ℂ → Shat) (q : Circle → Shat) (A U : Shat → ℝ) (ϖ : Set Shat → Shat + → Shat → Shat → Prop), (ϖ = ω.pos ∨ ϖ = revPos ω.pos) ∧ IsChart C c g ∧ IsBdParam Δ q ∧ + PadOrder q g (cap.emb '' tilde (b e)) (endMap cap P₀ D.P b) A U ∧ (∀ E, IsClosedDisc E + → E ⊆ C → SameOn ϖ (pullPos c planePos) E) ∧ + ∀ a a' a'', a ≠ a' → a' ≠ a'' → a ≠ a'' → (ϖ Δ (q a) (q a') (q a'') ↔ CircleCyclic a a' a'') + := by + have hT := cap.isClosedSurface + obtain ⟨c, g, hch⟩ := hCd.exists_isChart + have hω₀ := ω.isPartial univ + obtain ⟨ϖ, h1, h2, h3⟩ := exists_chart_sign hT hω₀ (fun _ _ _ _ => mem_univ _) + (mem_univ C) hCd hch + obtain ⟨q, hqc, hqi, hqr, hq⟩ := h2.dir Δ (mem_univ _) hΔ + have hqp : IsBdParam Δ q := ⟨hqc, hqi, hqr⟩ + suffices h : ∃ A U : Shat → ℝ, PadOrder q g (cap.emb '' tilde (b e)) (endMap cap P₀ D.P b) A U by + obtain ⟨A, U, hO⟩ := h + exact ⟨c, g, q, A, U, ϖ, h1, hch, hqp, hO, h3, hq⟩ + rcases P₀.Γ.size_cases he with h2' | h3' + · exact hM.exists_two_data hS he h2' hch hV hqp hY + have hbe := hM.edge.mem e he + have hbs : (tilde (b e)).ncard = 3 := (hM.edge.size e he).trans h3' + obtain ⟨v₀, v₁, v₂, hl⟩ := List.length_eq_three.mp ((P₀.Γ.length_γ_eq he).trans h3') + obtain ⟨y₀, y₁, y₂, hl'⟩ := List.length_eq_three.mp ((D.P.Γ.length_γ_eq hbe).trans hbs) + refine hM.exists_three_data hS he hch hl hl' hV hqp hY fun a₀ a₁ a₂ e₀ e₁ e₂ => ?_ + have hnv := P₀.Γ.γ_nodup e he + have hny := D.P.Γ.γ_nodup _ hbe + rw [hl] at hnv + rw [hl'] at hny + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or, List.nodup_nil, + not_false_eq_true, and_true] at hnv hny + obtain ⟨⟨n01, n02⟩, n12⟩ := hnv + obtain ⟨⟨m01, m02⟩, m12⟩ := hny + have hemb := cap.isEmbedding.injective + have dt : tilde (b e) = {y₀, y₁, y₂} := by + rw [← D.P.Γ.γ_set _ hbe, hl'] + ext x + simp + have dv : tilde e = {v₀, v₁, v₂} := by + rw [← P₀.Γ.γ_set _ he, hl] + ext x + simp + obtain ⟨hFd, hFt⟩ := edge_disc D.P.Γ hbe hbs + obtain ⟨hEd, hEt⟩ := edge_disc P₀.Γ he h3' + have hy₀ : y₀ ∈ discBd (closure (b e)) := hFt (by rw [dt]; simp) + have hy₁ : y₁ ∈ discBd (closure (b e)) := hFt (by rw [dt]; simp) + have hy₂ : y₂ ∈ discBd (closure (b e)) := hFt (by rw [dt]; simp) + have hv₀ : v₀ ∈ discBd (closure e) := hEt (by rw [dv]; simp) + have hv₁ : v₁ ∈ discBd (closure e) := hEt (by rw [dv]; simp) + have hv₂ : v₂ ∈ discBd (closure e) := hEt (by rw [dv]; simp) + have hmemP : P₀ ∈ ({P₀, D.P} : Set _) := by simp + have hmemD : D.P ∈ ({P₀, D.P} : Set _) := by simp + have posF := pos_emb hω hFd hy₀ hy₁ hy₂ m01 m12 m02 (ho D.P hmemD _ hbe hbs _ _ _ hl') + have posC := pos_emb hω hEd hv₀ hv₁ hv₂ n01 n12 n02 (ho P₀ hmemP _ he h3' _ _ _ hl) + have hF := discBd_emb cap hFd + have hE := discBd_emb cap hEd + have bdF {y} (h : y ∈ discBd (closure (b e))) : + cap.emb y ∈ discBd (cap.emb '' closure (b e)) := by + rw [hF.2] + exact mem_image_of_mem _ h + have bdE {y} (h : y ∈ discBd (closure e)) : + cap.emb y ∈ discBd (cap.emb '' closure e) := by + rw [hE.2] + exact mem_image_of_mem _ h + have ne : ∀ {x y : S}, x ≠ y → cap.emb x ≠ cap.emb y := fun h h' => h (hemb h') + have hsw : ∀ X : Set Shat, IsClosedDisc X → ∀ {x y z}, x ∈ discBd X → y ∈ discBd X → z ∈ discBd X + → x ≠ y → y ≠ z → x ≠ z → ω.pos X x y z → ¬ ω.pos X x z y := fun X hX {x y z} hx hy hz n1 n2 n3 + h => + ((hω₀.dir X (mem_univ _) hX).swap hx hy hz n1 n2 n3).1 h + have hbridge : ϖ (cap.emb '' closure (b e)) (cap.emb y₀) (cap.emb y₁) (cap.emb y₂) ↔ ϖ + (cap.emb '' closure e) (cap.emb v₀) (cap.emb v₁) (cap.emb v₂) := by + rcases h1 with rfl | rfl + · exact iff_of_true posF posC + · exact iff_of_false (hsw _ hF.1 (bdF hy₀) (bdF hy₁) (bdF hy₂) (ne m01) (ne m12) (ne m02) posF) + (hsw _ hE.1 (bdE hv₀) (bdE hv₁) (bdE hv₂) (ne n01) (ne n12) (ne n02) posC) + have hna : a₀ ≠ a₁ ∧ a₁ ≠ a₂ ∧ a₀ ≠ a₂ := by + refine ⟨fun h => m01 (hemb ?_), fun h => m12 (hemb ?_), fun h => m02 (hemb ?_)⟩ + · rw [← e₀, ← e₁, h] + · rw [← e₁, ← e₂, h] + · rw [← e₀, ← e₂, h] + have hCe := hC3 h3' + subst hCe + have hbdΔ : ∀ {y}, y ∈ tilde (b e) → cap.emb y ∈ discBd Δ := fun h => hY (mem_image_of_mem _ h) + have t₀ : y₀ ∈ tilde (b e) := by rw [dt]; simp + have t₁ : y₁ ∈ tilde (b e) := by rw [dt]; simp + have t₂ : y₂ ∈ tilde (b e) := by rw [dt]; simp + have step := h2.agree Δ (mem_univ _) _ (mem_univ _) hΔ hF.1 (hsub hbs) _ _ _ ⟨hbdΔ t₀, bdF hy₀⟩ + ⟨hbdΔ t₁, bdF hy₁⟩ ⟨hbdΔ t₂, bdF hy₂⟩ (ne m01) (ne m12) (ne m02) + have h0 := hq a₀ a₁ a₂ hna.1 hna.2.1 hna.2.2 + rw [e₀, e₁, e₂] at h0 + exact h0.symm.trans (step.trans (hbridge.trans ((h3 _ hCd (Subset.refl _) _ _ _ (bdE hv₀) + (bdE hv₁) (bdE hv₂) (ne n01) (ne n12) (ne n02)).trans (chart_cyc hch (bdE hv₀) (bdE hv₁) + (bdE hv₂))))) + +/-- **The data of an edge with no orientation to respect.** With three ends, we choose the direction +of the parameter of `Δ` so that it agrees with the chart. -/ +theorem IsMatchSetting.exists_edge_data_free [Nonempty S] (hM : D.IsMatchSetting P₀ n b) + (hS : IsSurface S) {e : Set S} (he : e ∈ P₀.Γ.E) {C Δ : Set Shat} (hCd : IsClosedDisc C) + (hV : cap.emb '' tilde e ⊆ discBd C) + (hΔ : IsClosedDisc Δ) (hY : cap.emb '' tilde (b e) ⊆ discBd Δ) : + ∃ (c : Shat → ℂ) (g : ℂ → Shat) (q : Circle → Shat) (A U : Shat → ℝ), IsChart C c g + ∧ IsBdParam Δ q ∧ PadOrder q g (cap.emb '' tilde (b e)) (endMap cap P₀ D.P b) A U := by + obtain ⟨c, g, hch⟩ := hCd.exists_isChart + obtain ⟨pos, hp⟩ := exists_local_orientation hΔ + have hmemΔ : Δ ∈ {X | X ⊆ Δ} := Subset.refl Δ + have hdir := hp.dir Δ hmemΔ hΔ + obtain ⟨qp, hcp, hip, hrp, hp₁⟩ := hdir + obtain ⟨qm, hcm, him, hrm, hm₁⟩ := hp.rev.dir Δ hmemΔ hΔ + have hdir := hp.dir Δ hmemΔ hΔ + have hqp : IsBdParam Δ qp := ⟨hcp, hip, hrp⟩ + have hqm : IsBdParam Δ qm := ⟨hcm, him, hrm⟩ + rcases P₀.Γ.size_cases he with h2' | h3' + · obtain ⟨A, U, hO⟩ := hM.exists_two_data hS he h2' hch hV hqp hY + exact ⟨c, g, qp, A, U, hch, hqp, hO⟩ + have hbe := hM.edge.mem e he + have hbs : (tilde (b e)).ncard = 3 := (hM.edge.size e he).trans h3' + obtain ⟨v₀, v₁, v₂, hl⟩ := List.length_eq_three.mp ((P₀.Γ.length_γ_eq he).trans h3') + obtain ⟨y₀, y₁, y₂, hl'⟩ := List.length_eq_three.mp ((D.P.Γ.length_γ_eq hbe).trans hbs) + have hny := D.P.Γ.γ_nodup _ hbe + rw [hl'] at hny + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or, List.nodup_nil, + not_false_eq_true, and_true] at hny + obtain ⟨⟨m01, m02⟩, m12⟩ := hny + have hemb := cap.isEmbedding.injective + have dt : tilde (b e) = {y₀, y₁, y₂} := by + rw [← D.P.Γ.γ_set _ hbe, hl'] + ext x + simp + have t₀ : y₀ ∈ tilde (b e) := by rw [dt]; simp + have t₁ : y₁ ∈ tilde (b e) := by rw [dt]; simp + have t₂ : y₂ ∈ tilde (b e) := by rw [dt]; simp + have ne : ∀ {x y : S}, x ≠ y → cap.emb x ≠ cap.emb y := fun h h' => h (hemb h') + have hna : ∀ {p : Circle → Shat} {a₀ a₁ a₂ : Circle}, p a₀ = cap.emb y₀ → p a₁ = cap.emb y₁ + → p a₂ = cap.emb y₂ → a₀ ≠ a₁ ∧ a₁ ≠ a₂ ∧ a₀ ≠ a₂ := fun {p a₀ a₁ a₂} e₀ e₁ e₂ => by + refine ⟨fun h => m01 (hemb ?_), fun h => m12 (hemb ?_), fun h => m02 (hemb ?_)⟩ + · rw [← e₀, ← e₁, h] + · rw [← e₁, ← e₂, h] + · rw [← e₀, ← e₂, h] + have hbdΔ : ∀ {y}, y ∈ tilde (b e) → cap.emb y ∈ discBd Δ := fun h => hY (mem_image_of_mem _ h) + by_cases hd : pos Δ (cap.emb y₀) (cap.emb y₁) (cap.emb y₂) ↔ CircleCyclic (toCircle (c + (cap.emb v₀))) (toCircle (c (cap.emb v₁))) (toCircle (c (cap.emb v₂))) + · obtain ⟨A, U, hO⟩ := hM.exists_three_data hS he hch hl hl' hV hqp hY fun a₀ a₁ a₂ e₀ e₁ e₂ => by + obtain ⟨n1, n2, n3⟩ := hna e₀ e₁ e₂ + have h0 := hp₁ a₀ a₁ a₂ n1 n2 n3 + rw [e₀, e₁, e₂] at h0 + exact h0.symm.trans hd + exact ⟨c, g, qp, A, U, hch, hqp, hO⟩ + · obtain ⟨A, U, hO⟩ := hM.exists_three_data hS he hch hl hl' hV hqm hY fun a₀ a₁ a₂ e₀ e₁ e₂ => by + obtain ⟨n1, n2, n3⟩ := hna e₀ e₁ e₂ + have h0 := hm₁ a₀ a₁ a₂ n1 n2 n3 + rw [e₀, e₁, e₂] at h0 + have hs := hdir.swap (hbdΔ t₀) (hbdΔ t₂) (hbdΔ t₁) (ne m02) (ne fun h => m12 h.symm) (ne m01) + have h0' : pos Δ (cap.emb y₀) (cap.emb y₂) (cap.emb y₁) ↔ CircleCyclic a₀ a₁ a₂ := h0 + rw [← h0', hs] + tauto + exact ⟨c, g, qm, A, U, hch, hqm, hO⟩ + +theorem IsMatchSetting.endVertex_mem (hM : D.IsMatchSetting P₀ n b) (hS : IsSurface S) {e : Set S} + (he : e ∈ P₀.Γ.E) {x : S} (hx : x ∈ tilde (b e)) : endVertex P₀ D.P b x ∈ tilde e := by + obtain ⟨v, hv, h⟩ := exists_isEndOf hM.edge he hx + rwa [hM.endVertex_eq hS h] + +/-- **The last step.** The discs given by `exists_realizing_discs` are the discs we want, because +the end classes are the sets of ends sent to one vertex. -/ +theorem IsMatchSetting.finish_feasibility [Nonempty S] (hM : D.IsMatchSetting P₀ n b) + (hS : IsSurface S) {Δ C : DiscIndex S P₀ → Set Shat} (hΔ : ∀ i, IsClosedDisc (Δ i)) + (hΔΔ : ∀ i j, i ≠ j → Disjoint (Δ i) (Δ j)) + (hC : ∀ i, IsClosedDisc (C i)) (hCC : ∀ i j, i ≠ j → C i ∩ C j ⊆ cap.emb '' P₀.Γ.V) + (hVC : ∀ i, cap.emb '' P₀.Γ.V ∩ C i ⊆ discBd (C i)) (hC₀ : ∀ Θ, C (.inl Θ) = closure + (cap.cuffDisc Θ.1)) + (hsub : ∀ e, cap.emb '' closure e.1 ⊆ C (.inr e)) {c : DiscIndex S P₀ → Shat + → ℂ} {g : DiscIndex S P₀ → ℂ → Shat} {q : DiscIndex S P₀ → Circle + → Shat} {A U : DiscIndex S P₀ → Shat → ℝ} (hch : ∀ i, IsChart (C i) (c i) (g i)) + (hq : ∀ i, IsBdParam (Δ i) (q i)) (hO : ∀ i, PadOrder (q i) (g i) (discEnds cap b P₀ i) + (endMap cap P₀ D.P b) (A i) (U i)) + (H : ¬ IsOrientableSurface Shat ∨ ∃ ω : SurfaceOrientation Shat, ∀ i, ∃ ϖ, (ϖ = ω.pos ∨ ϖ + = revPos ω.pos) ∧ (∀ E, IsClosedDisc E → E ⊆ C i → SameOn ϖ (pullPos (c i) planePos) E) ∧ + ∀ a a' a'', a ≠ a' → a' ≠ a'' → a ≠ a'' → (ϖ (Δ i) (q i a) (q i a') + (q i a'') ↔ CircleCyclic a a' a'')) : + ∃ Dv : S → Set Shat, (∀ v ∈ P₀.Γ.V, IsClosedDisc (Dv v)) ∧ (∀ v ∈ P₀.Γ.V, ∀ v' ∈ P₀.Γ.V, v ≠ v' + → Disjoint (Dv v) (Dv v')) ∧ ∀ v ∈ P₀.Γ.V, Dv v ∩ ⋃ i, Δ i = endClass cap P₀ D.P b v := by + have hT := cap.isClosedSurface + have hconn : ConnectedSpace Shat := cap.connected + have := finite_discIndex hS P₀ + have hemb := cap.isEmbedding.injective + have hφ : ∀ i, ∀ y ∈ discEnds cap b P₀ i, endMap cap P₀ D.P b y ∈ cap.emb '' P₀.Γ.V ∩ C i := by + rintro (Θ | e) + · rintro _ ⟨x, ⟨e, he, heΘ, hx⟩, rfl⟩ + have hm := hM.endVertex_mem hS he hx + rw [endMap_emb, hC₀ Θ] + refine ⟨mem_image_of_mem _ (P₀.Γ.tilde_subset_V he hm), ?_⟩ + have hΘc : IsClosed Θ.1 := (IsOArc.isCompact ((cuff_statement S hS).2.2 Θ.1 Θ.2)).isClosed + rw [cap.closure_cuffDisc Θ.2] + exact Or.inr (mem_image_of_mem _ (closure_minimal heΘ hΘc hm.1)) + · rintro _ ⟨x, hx, rfl⟩ + have hm := hM.endVertex_mem hS e.2.1 hx + rw [endMap_emb] + exact ⟨mem_image_of_mem _ (P₀.Γ.tilde_subset_V e.2.1 hm), hsub e (mem_image_of_mem _ hm.1)⟩ + obtain ⟨D', h1, h2, h3⟩ := exists_realizing_discs hT hΔ (fun i j h => hΔΔ i j h) hC hch + (P₀.Γ.finite_V.image _) hCC hVC hφ hq hO H + refine ⟨fun v => D' (cap.emb v), fun v hv => h1 _ (mem_image_of_mem _ hv), fun v hv v' hv' hne + => h2 _ (mem_image_of_mem _ hv) _ (mem_image_of_mem _ hv') fun h => hne (hemb h), fun v hv + => ?_⟩ + rw [h3 _ (mem_image_of_mem _ hv)] + ext y + simp only [mem_iUnion, mem_ofPred_eq] + constructor + · rintro ⟨i, hy, hyv⟩ + have hall : ∃ e ∈ P₀.Γ.E, ∃ x ∈ tilde (b e), y = cap.emb x := by + rcases i with Θ | e + · obtain ⟨x, ⟨e, he, -, hx⟩, rfl⟩ := hy + exact ⟨e, he, x, hx, rfl⟩ + · obtain ⟨x, hx, rfl⟩ := hy + exact ⟨e.1, e.2.1, x, hx, rfl⟩ + obtain ⟨e, he, x, hx, rfl⟩ := hall + rw [endMap_emb] at hyv + obtain ⟨v', -, h⟩ := exists_isEndOf hM.edge he hx + have hvv : v' = v := by + rw [← hM.endVertex_eq hS h] + exact hemb hyv + subst hvv + exact ⟨x, h, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + have hend := hM.endVertex_eq hS hx + obtain ⟨e, he, i, hi, hi', -, h2'⟩ := hx + have hxt : x ∈ tilde (b e) := by + rw [← D.P.Γ.γ_set _ (hM.edge.mem e he), mem_ofPred_eq, ← h2'] + exact List.getElem_mem _ + rw [show endMap cap P₀ D.P b (cap.emb x) = cap.emb v by rw [endMap_emb, hend]] + by_cases hB : Painting.IsBorder e + · obtain ⟨s, -, Θ, hΘ, hsΘ, hes, -⟩ := hM.exists_cuff_of_border hS he hB + have heΘ : e ⊆ Θ := hes.trans hsΘ + exact ⟨.inl ⟨Θ, hΘ⟩, ⟨x, ⟨e, he, heΘ, hxt⟩, rfl⟩, rfl⟩ + · exact ⟨.inr ⟨e, he, isInternal_iff_not_border.2 hB⟩, ⟨x, hxt, rfl⟩, rfl⟩ + +end TangleDatum + +/-- **Steps (2) and (3) of the proof of Graph Minors XIX, (15.2)**, pages 381 and 382. -/ +theorem theorem152Feasibility : Theorem152FeasibilityStatement.{w} := by + intro S Shat _ _ _ _ β cap χ P₀ D n b horient hM Δ hΔ hends hdis hcuff hedge + have hS := χ.isSurface + have hS₀ : Nonempty S := by + have := χ.connected + infer_instance + obtain ⟨C, hC, hCC, hVC, hC₀, hC₃, hsub⟩ := TangleDatum.exists_pads hS P₀ cap + have hV : ∀ e : {e : Set S // e ∈ P₀.Γ.E ∧ Painting.IsInternal e}, cap.emb '' tilde e.1 ⊆ discBd + (C (.inr e)) := fun e => by + rintro _ ⟨x, hx, rfl⟩ + exact hVC _ ⟨mem_image_of_mem _ (P₀.Γ.tilde_subset_V e.2.1 hx), + hsub e (mem_image_of_mem _ hx.1)⟩ + by_cases hor : IsOrientableSurface Shat + · obtain ⟨o, ho⟩ := horient.resolve_left (not_not.2 (isOrientable_of_embedding cap.isEmbedding + hor)) + obtain ⟨ω, hω⟩ := exists_cap_orientation hS cap o + have key : ∀ i, ∃ (c : Shat → ℂ) (g : ℂ → Shat) (q : Circle → Shat) (A U : Shat → ℝ) + (ϖ : Set Shat → Shat → Shat → Shat → Prop), (ϖ = ω.pos ∨ ϖ = revPos ω.pos) ∧ IsChart + (C i) c g ∧ IsBdParam (Δ i) q ∧ + PadOrder q g (TangleDatum.discEnds cap b P₀ i) (TangleDatum.endMap cap P₀ D.P b) A U ∧ + (∀ E, IsClosedDisc E → E ⊆ C i → SameOn ϖ (pullPos c planePos) E) ∧ + ∀ a a' a'', a ≠ a' → a' ≠ a'' → a ≠ a'' → (ϖ (Δ i) (q a) (q a') + (q a'') ↔ CircleCyclic a a' a'') := by + rintro (Θ | e) + · rw [hC₀ Θ] + exact hM.exists_cuff_data hS Θ.2 (hΔ _) (hcuff Θ) (hends (.inl Θ)) (ω.isPartial univ) + (fun _ _ _ _ => mem_univ _) (mem_univ _) + · exact hM.exists_edge_data_oriented hS ho hω e.2.1 (hC _) (hV e) (hC₃ e) (hΔ _) (hends + (.inr e)) (hedge e) + choose c g q A U ϖ h1 h2 h3 h4 h5 h6 using key + exact hM.finish_feasibility hS hΔ hdis hC hCC hVC hC₀ hsub h2 h3 h4 (Or.inr ⟨ω, + fun i => ⟨ϖ i, h1 i, h5 i, h6 i⟩⟩) + · have key : ∀ i, ∃ (c : Shat → ℂ) (g : ℂ → Shat) (q : Circle → Shat) (A U : Shat → ℝ), IsChart + (C i) c g ∧ IsBdParam (Δ i) q ∧ + PadOrder q g (TangleDatum.discEnds cap b P₀ i) (TangleDatum.endMap cap P₀ D.P b) A U := by + rintro (Θ | e) + · rw [hC₀ Θ] + have hF := cap.cuffDisc_closedDisc Θ.1 Θ.2 + obtain ⟨pos, hp⟩ := exists_local_orientation hF + obtain ⟨c, g, q, A, U, -, -, h2, h3, h4, -, -⟩ := hM.exists_cuff_data hS Θ.2 (hΔ _) + (hcuff Θ) (hends (.inl Θ)) hp (fun _ h _ hs => hs.trans h) (Subset.refl _) + exact ⟨c, g, q, A, U, h2, h3, h4⟩ + · exact hM.exists_edge_data_free hS e.2.1 (hC _) (hV e) (hΔ _) (hends (.inr e)) + choose c g q A U h2 h3 h4 using key + exact hM.finish_feasibility hS hΔ hdis hC hCC hVC hC₀ hsub h2 h3 h4 (Or.inl hor) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FeatureAccess.lean b/LeanPool/GraphMinor/GM19/FeatureAccess.lean new file mode 100644 index 0000000000..942957a05e --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FeatureAccess.lean @@ -0,0 +1,470 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FeatureCode +public import Mathlib.Analysis.Complex.CoveringMap + +/-! +# The free end of an arc in a disc can be reached + +An arc in the closed unit disc goes from the centre to the boundary, and is otherwise in the open +disc. We find a second arc from the +centre to the boundary that meets the first only at the centre. The map `z ↦ z²` unfolds the first +arc: its preimage is a chord of the +disc through the centre, invariant under `z ↦ -z`. A chord of one of the two half discs, from the +centre to the boundary, goes down to +the second arc, because `z ↦ z²` is one to one on an open half disc (`exists_access`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Function Metric GraphMinor.Surface + +local notation "𝕀" => unitInterval + +/-- An arc from the centre has a continuous square root. -/ +theorem exists_sqrt_path {b : 𝕀 → ℂ} (hc : Continuous b) (h0 : b 0 = 0) (hne : ∀ t, t ≠ 0 + → b t ≠ 0) : + ∃ r : 𝕀 → ℂ, Continuous r ∧ r 0 = 0 ∧ ∀ t, r t ^ 2 = b t := by + classical + let u : ℝ → 𝕀 := fun t ↦ ⟨Real.exp (-|t|), (Real.exp_pos _).le, Real.exp_le_one_iff.mpr (by simp)⟩ + have hu : Continuous u := by + refine Continuous.subtype_mk ?_ _ + fun_prop + have hu0 : ∀ t, u t ≠ 0 := fun t he ↦ (Real.exp_pos (-|t|)).ne' (congrArg Subtype.val he) + let p : C(ℝ, {z : ℂ // z ≠ 0}) := ⟨fun t ↦ ⟨b (u t), hne _ (hu0 t)⟩, (hc.comp hu).subtype_mk _⟩ + obtain ⟨w, hw⟩ : ∃ w : ℂ, Complex.exp w = b (u 0) := ⟨Complex.log (b (u 0)), Complex.exp_log + (hne _ (hu0 0))⟩ + obtain ⟨F, ⟨-, hF⟩, -⟩ := Complex.isCoveringMap_exp.existsUnique_continuousMap_lifts p 0 w + (Subtype.ext hw) + have hF' : ∀ t, Complex.exp (F t) = b (u t) := fun t ↦ congrArg Subtype.val (congrFun hF t) + have hlog : ∀ s : 𝕀, s ≠ 0 → u (-Real.log s) = s := fun s hs ↦ by + have hs0 : (0 : ℝ) < s := lt_of_le_of_ne s.2.1 (fun h ↦ hs (Subtype.ext h.symm)) + apply Subtype.ext + have h₁ : Real.log s ≤ 0 := Real.log_nonpos s.2.1 s.2.2 + simp only [u, abs_neg, abs_of_nonpos h₁, neg_neg, Real.exp_log hs0] + let r : 𝕀 → ℂ := fun s ↦ if s = 0 then 0 else Complex.exp (F (-Real.log s) / 2) + have hr2 : ∀ s, r s ^ 2 = b s := fun s ↦ by + by_cases hs : s = 0 + · simp [r, hs, h0] + · simp only [r, hs, ite_false] + have h := hF' (-Real.log s) + rw [hlog s hs] at h + rw [← Complex.exp_nat_mul, ← h] + congr 1 + push_cast + ring + have hnorm : ∀ s, ‖r s‖ = √‖b s‖ := fun s ↦ by + rw [← hr2, norm_pow, Real.sqrt_sq (norm_nonneg _)] + refine ⟨r, ?_, by simp [r], hr2⟩ + rw [continuous_iff_continuousAt] + intro s + by_cases hs : s = 0 + · subst hs + have h₁ : Filter.Tendsto (fun x ↦ ‖r x‖) (𝓝 0) (𝓝 0) := by + have h₂ : Continuous fun x ↦ √‖b x‖ := by fun_prop + have h₃ := h₂.tendsto 0 + simp only [h0, norm_zero, Real.sqrt_zero] at h₃ + exact h₃.congr fun x ↦ (hnorm x).symm + have h₄ : r 0 = 0 := by simp [r] + rw [ContinuousAt, h₄] + exact tendsto_zero_iff_norm_tendsto_zero.mpr h₁ + · have hs0 : (s : ℝ) ≠ 0 := fun h ↦ hs (Subtype.ext h) + have hc₁ : ContinuousAt (fun x : 𝕀 ↦ Complex.exp (F (-Real.log x) / 2)) s := by + have h₁ : ContinuousAt (fun x : 𝕀 ↦ Real.log x) s := (Real.continuousAt_log hs0).comp + continuous_subtype_val.continuousAt + have h₂ : ContinuousAt (fun x : 𝕀 ↦ F (-Real.log x)) s := F.continuous.continuousAt.comp + h₁.neg + exact Complex.continuous_exp.continuousAt.comp (h₂.div_const 2) + refine hc₁.congr ?_ + have h₁ : ∀ᶠ x in 𝓝 s, x ≠ 0 := isOpen_ne.mem_nhds hs + filter_upwards [h₁] with x hx + simp [r, hx] + +/-- A point of the unit circle other than `p` and `-p` has nonzero height over the line through `p`. +-/ +theorem im_div_ne {p z : ℂ} (hp : ‖p‖ = 1) (hz : ‖z‖ = 1) (h1 : z ≠ p) (h2 : z ≠ -p) : + (z / p).im ≠ 0 := by + intro h + have hp0 : p ≠ 0 := fun h' ↦ by simp [h'] at hp + have hn : ‖z / p‖ = 1 := by rw [norm_div, hz, hp, div_one] + obtain ⟨x, hx⟩ : ∃ x : ℝ, z / p = x := ⟨(z / p).re, Complex.ext (by simp) (by simpa using h)⟩ + rw [hx, Complex.norm_real, Real.norm_eq_abs] at hn + rcases abs_eq (zero_le_one) |>.mp hn with rfl | rfl + · apply h1 + field_simp at hx + simpa using hx + · apply h2 + field_simp at hx + simpa using hx + +private theorem component_ne_neg + (r : 𝕀 → ℂ) + (L : Set ℂ) + (A₁ : Set ℂ) + (A₂ : Set ℂ) + (Δ₁ : Set ℂ) + (Δ₂ : Set ℂ) + (hc : componentsIn (sphere 0 1 \ {r 1, -r 1}) = {A₁, A₂}) + (hi : Δ₁ ∩ Δ₂ = L) + (y : ℂ) + (hyA₁ : y ∈ A₁) + (hA₁sub : A₁ ⊆ sphere 0 1 \ {r 1, -r 1}) + (hA₁Δ : A₁ ⊆ Δ₁ \ L) + (hA₂Δ : A₂ ⊆ Δ₂) + (hnotneg : ∀ z ∈ A₁, -z ∉ A₁) + (p₀ : ℂ) + (hp₀e : connectedComponentIn (closedBall 0 1 \ L) p₀ = Δ₁ \ L) + (hnegL : ∀ z ∈ L, -z ∈ L) + (hΔsub : Δ₁ ⊆ closedBall 0 1) : + ∀ z ∈ Δ₁ \ L, -z ∉ Δ₁ \ L := by + intro z hz hz' + have hpre : IsPreconnected ((fun w : ℂ ↦ -w) '' (Δ₁ \ L)) := by + have h' : IsPreconnected (Δ₁ \ L) := hp₀e ▸ isPreconnected_connectedComponentIn + exact h'.image _ continuous_neg.continuousOn + have hsub : (fun w : ℂ ↦ -w) '' (Δ₁ \ L) ⊆ closedBall 0 1 \ L := by + rintro _ ⟨w, hw, rfl⟩ + refine ⟨by simpa using hΔsub hw.1, fun hL' ↦ hw.2 (by simpa using hnegL _ hL')⟩ + have hin' : (fun w : ℂ ↦ -w) '' (Δ₁ \ L) ⊆ Δ₁ \ L := by + have h' := hpre.subset_connectedComponentIn (x := -z) ⟨z, hz, rfl⟩ hsub + have hne' : connectedComponentIn (closedBall (0 : ℂ) 1 \ L) (-z) = Δ₁ \ L := by + rw [← hp₀e] + exact (connectedComponentIn_eq (by rw [hp₀e]; exact hz')).symm + rwa [hne'] at h' + have hm := hin' (mem_image_of_mem _ (hA₁Δ hyA₁)) + have hys := hA₁sub hyA₁ + have hmS : -y ∈ sphere (0 : ℂ) 1 \ {r 1, -r 1} := by + refine ⟨by simpa using hys.1, ?_⟩ + rintro (h' | h') + · exact hys.2 (.inr (by rw [← h', neg_neg]; rfl)) + · exact hys.2 (.inl (neg_injective h')) + have hcov : connectedComponentIn (sphere (0 : ℂ) 1 \ {r 1, -r 1}) (-y) ∈ ({A₁, A₂} : Set + (Set ℂ)) := + hc ▸ ⟨-y, hmS, rfl⟩ + have hmem := mem_connectedComponentIn hmS + rcases hcov with h' | h' + · exact hnotneg y hyA₁ (h' ▸ hmem) + · have : -y ∈ Δ₁ ∩ Δ₂ := ⟨hm.1, hA₂Δ (h' ▸ hmem)⟩ + rw [hi] at this + exact hm.2 this + +private theorem opposite_arc_inter + {a : 𝕀 → ℂ} + (ha : IsArcMap a) + (r : 𝕀 → ℂ) + (hr0 : r 0 = 0) + (hr2 : ∀ (t : 𝕀), r t ^ 2 = a t) : + (range r ∩ range fun t => -r t) = {0} := by + ext z + constructor + · rintro ⟨⟨t, rfl⟩, u, hu⟩ + have hu' : r u ^ 2 = r t ^ 2 := by + have : -r u = r t := hu + rw [← this] + ring + rw [hr2, hr2] at hu' + have htu := ha.2 hu' + rw [htu] at hu + have hz : r t = 0 := by + have : -r t = r t := hu + have h2 : (2 : ℂ) * r t = 0 := by linear_combination -this + simpa using h2 + exact hz + · rintro rfl + exact ⟨⟨0, hr0⟩, 0, by simp [hr0]⟩ + +private theorem quadratic_chord_injective + {a : 𝕀 → ℂ} + (hne0 : ∀ (t : 𝕀), t ≠ 0 → a t ≠ 0) + (L : Set ℂ) + (Δ₁ : Set ℂ) + (hinjΔ : ∀ z ∈ Δ₁ \ L, ∀ w ∈ Δ₁ \ L, z ^ 2 = w ^ 2 → z = w) + (h₁ : ℂ → ℂ) + (g₁ : ℂ → ℂ) + (c : IsChart Δ₁ h₁ g₁) + (s : 𝕀) + (hs0 : s ≠ 0) + (seg : 𝕀 → ℂ) + (hsegm : ∀ (u : 𝕀), seg u ∈ closedBall 0 1) + (hseginj : Injective seg) + (hz : ∀ (u : 𝕀), u ≠ 0 → u ≠ 1 → g₁ (seg u) ∈ Δ₁ \ L) + (hoff : ∀ (t : 𝕀), t ≠ 0 → t ≠ 1 → (fun u => g₁ (seg u) ^ 2) t ∉ range a) + (hq0 : (fun u => g₁ (seg u) ^ 2) 0 = 0) + (hq1 : (fun u => g₁ (seg u) ^ 2) 1 = a s) + (hends : ∀ (t : 𝕀), t = 0 ∨ t = 1 ∨ t ≠ 0 ∧ t ≠ 1) + (hendr : ∀ (t : 𝕀), t = 0 ∨ t = 1 → (fun u => g₁ (seg u) ^ 2) t ∈ range a) : + Injective (fun u => g₁ (seg u) ^ 2) := by + let q := fun u => g₁ (seg u) ^ 2 + intro u v huv + rcases hends u with hu | hu | hu <;> rcases hends v with hv | hv | hv + · rw [hu, hv] + · exfalso + rw [hu, hv, hq0, hq1] at huv + exact hne0 s hs0 huv.symm + · exact absurd (huv ▸ hendr u (.inl hu)) (hoff v hv.1 hv.2) + · exfalso + rw [hu, hv, hq0, hq1] at huv + exact hne0 s hs0 huv + · rw [hu, hv] + · exact absurd (huv ▸ hendr u (.inr hu)) (hoff v hv.1 hv.2) + · exact absurd (huv.symm ▸ hendr v (.inl hv)) (hoff u hu.1 hu.2) + · exact absurd (huv.symm ▸ hendr v (.inr hv)) (hoff u hu.1 hu.2) + · have := hinjΔ _ (hz u hu.1 hu.2) _ (hz v hv.1 hv.2) huv + have h2 : seg u = seg v := by + rw [← c.hg (hsegm u), ← c.hg (hsegm v), this] + exact hseginj h2 + +private theorem chord_square_image_avoids_cut_arc + {a : 𝕀 → ℂ} + (r : 𝕀 → ℂ) + (hr2 : ∀ (t : 𝕀), r t ^ 2 = a t) + (Δ₁ : Set ℂ) + (g₁ : ℂ → ℂ) + (seg : 𝕀 → ℂ) + (hz : ∀ (u : 𝕀), u ≠ 0 → u ≠ 1 → g₁ (seg u) ∈ Δ₁ \ (range r ∪ range (fun t => -r t))) : + ∀ (t : 𝕀), t ≠ 0 → t ≠ 1 → g₁ (seg t) ^ 2 ∉ range a := by + rintro t ht0 ht1 ⟨u, hu⟩ + have h2 : r u ^ 2 = g₁ (seg t) ^ 2 := by rw [hr2]; exact hu + obtain ⟨hzΔ, hzL⟩ := hz t ht0 ht1 + rcases sq_eq_sq_iff_eq_or_eq_neg.mp h2 with h3 | h3 + · exact hzL (h3 ▸ .inl ⟨u, rfl⟩) + · exact hzL (.inr ⟨u, by simp only; rw [h3, neg_neg]⟩) + +private theorem preconnected_circle_side_excludes_antipodes + (r : 𝕀 → ℂ) + (hr1 : ‖r 1‖ = 1) + (A₁ : Set ℂ) + (hA₁sub : A₁ ⊆ sphere 0 1 \ {r 1, -r 1}) + (hA₁pre : IsPreconnected A₁) : + ∀ z ∈ A₁, -z ∉ A₁ := by + intro z hz hz' + obtain ⟨hzs, hzn⟩ := hA₁sub hz + have hz1 : ‖z‖ = 1 := mem_sphere_zero_iff_norm.mp hzs + have hf : ContinuousOn (fun w : ℂ ↦ (w / r 1).im) A₁ := by fun_prop + have hv : ∀ w ∈ A₁, (w / r 1).im ≠ 0 := fun w hw ↦ by + obtain ⟨hws, hwn⟩ := hA₁sub hw + exact im_div_ne hr1 (mem_sphere_zero_iff_norm.mp hws) (fun h' ↦ hwn (.inl h')) (fun h' ↦ hwn + (.inr h')) + have h3 : ((-z) / r 1).im = -(z / r 1).im := by + rw [neg_div, Complex.neg_im] + have h0' := hv z hz + rcases lt_or_gt_of_ne h0' with h4 | h4 + · obtain ⟨w, hw, hw0⟩ := hA₁pre.intermediate_value hz hz' hf + (show (0 : ℝ) ∈ Icc _ _ from ⟨h4.le, by rw [h3]; linarith⟩) + exact hv w hw hw0 + · obtain ⟨w, hw, hw0⟩ := hA₁pre.intermediate_value hz' hz hf + (show (0 : ℝ) ∈ Icc _ _ from ⟨by rw [h3]; linarith, h4.le⟩) + exact hv w hw hw0 + +/-- **The second side of an arc from the centre.** The arc `a` goes from the centre of the unit disc +to the circle. Near the centre +there is a second arc from the centre to a point of `a`, otherwise off `a`. -/ +theorem exists_chord {a : 𝕀 → ℂ} (ha : IsArcMap a) (h0 : a 0 = 0) (h1 : ‖a 1‖ = 1) + (hlt : ∀ t, t ≠ 1 → ‖a t‖ < 1) + {ε : ℝ} (hε : 0 < ε) : + ∃ s : 𝕀, s ≠ 0 ∧ s ≠ 1 ∧ ∃ q : 𝕀 → ℂ, IsArcMap q ∧ q 0 = 0 ∧ q 1 = a s ∧ range q ⊆ ball 0 ε ∧ + ∀ t, t ≠ 0 → t ≠ 1 → q t ∉ range a := by + classical + have hne0 : ∀ t, t ≠ 0 → a t ≠ 0 := fun t ht he ↦ ht (ha.2 (he.trans h0.symm)) + obtain ⟨r, hrc, hr0, hr2⟩ := exists_sqrt_path ha.1 h0 hne0 + have hsq : ∀ t, ‖r t‖ ^ 2 = ‖a t‖ := fun t ↦ by rw [← hr2, norm_pow] + have hrinj : Injective r := fun t u h ↦ ha.2 (by rw [← hr2, ← hr2, h]) + have hr : IsArcMap r := ⟨hrc, hrinj⟩ + have hn : IsArcMap fun t ↦ -r t := ⟨hrc.neg, fun t u h ↦ hrinj (neg_injective h)⟩ + have hr1 : ‖r 1‖ = 1 := by + have h' := hsq 1 + rw [h1] at h' + nlinarith [norm_nonneg (r 1)] + have hrne : ∀ t, t ≠ 1 → ‖r t‖ < 1 := fun t ht ↦ by + have h' := hsq t + have h'' := hlt t ht + nlinarith [norm_nonneg (r t)] + have hile : ∀ t, ‖r t‖ ≤ 1 := fun t ↦ by + by_cases ht : t = 1 + · rw [ht, hr1] + · exact (hrne t ht).le + have hin : range r ∩ range (fun t ↦ -r t) = {0} := by + exact opposite_arc_inter (a := a) ha r hr0 hr2 + let L : Set ℂ := range r ∪ range fun t ↦ -r t + have hl1 := hr.isLineWithEnds + have hl2 := hn.isLineWithEnds + simp only [hr0, neg_zero] at hl1 hl2 + have hL : IsLineWithEnds L (r 1) (-r 1) := hl1.symm.union hl2 hin + have hLball : L ⊆ closedBall 0 1 := by + rintro _ (⟨t, rfl⟩ | ⟨t, rfl⟩) + · exact mem_closedBall_zero_iff.mpr (hile t) + · exact mem_closedBall_zero_iff.mpr (by simpa using hile t) + have hne : r 1 ≠ -r 1 := fun h' ↦ by + have : r 1 = 0 := by + have h2 : (2 : ℂ) * r 1 = 0 := by linear_combination h' + simpa using h2 + rw [this] at hr1 + simp at hr1 + obtain ⟨hD, hbdD⟩ := isClosedDisc_closedBall + have hmeet : L ∩ discBd (closedBall (0 : ℂ) 1) = {r 1, -r 1} := by + rw [hbdD] + ext z + constructor + · rintro ⟨⟨t, rfl⟩ | ⟨t, rfl⟩, hz⟩ + · have ht : t = 1 := by + by_contra ht + exact (hrne t ht).ne (mem_sphere_zero_iff_norm.mp hz) + exact .inl (by rw [ht]) + · have ht : t = 1 := by + by_contra ht + exact (hrne t ht).ne (by simpa using mem_sphere_zero_iff_norm.mp hz) + exact .inr (by simp [ht]) + · rintro (rfl | rfl) + · exact ⟨hL.left_mem, mem_sphere_zero_iff_norm.mpr hr1⟩ + · exact ⟨hL.right_mem, mem_sphere_zero_iff_norm.mpr (by simpa using hr1)⟩ + obtain ⟨A₁, A₂, Δ₁, Δ₂, hA, hc, d1, -, hu, hi, b1, b2, hc2⟩ := disc_iArc _ L _ _ hD hLball hne hL + hmeet + rw [hbdD] at hc + have hsubL : L ⊆ Δ₁ := fun z hz ↦ by + have : z ∈ Δ₁ ∩ Δ₂ := hi.symm ▸ hz + exact this.1 + have hLbd : L ⊆ discBd Δ₁ := b1 ▸ subset_union_right + have hA₁ : A₁ ∈ componentsIn (sphere (0 : ℂ) 1 \ {r 1, -r 1}) := hc ▸ .inl rfl + have hA₂ : A₂ ∈ componentsIn (sphere (0 : ℂ) 1 \ {r 1, -r 1}) := hc ▸ .inr rfl + obtain ⟨y, hy, hyA⟩ : ∃ y ∈ sphere (0 : ℂ) 1 \ {r 1, -r 1}, connectedComponentIn (sphere + (0 : ℂ) 1 \ {r 1, -r 1}) y = A₁ := hA₁ + have hyA₁ : y ∈ A₁ := hyA ▸ mem_connectedComponentIn hy + have hA₁sub : A₁ ⊆ sphere (0 : ℂ) 1 \ {r 1, -r 1} := hyA ▸ connectedComponentIn_subset _ _ + have hA₁pre : IsPreconnected A₁ := hyA ▸ isPreconnected_connectedComponentIn + have hA₁Δ : A₁ ⊆ Δ₁ \ L := fun z hz ↦ by + have hzs := hA₁sub hz + have hb : discBd Δ₁ ⊆ Δ₁ := Subtype.coe_image_subset _ _ + refine ⟨hb (by rw [b1]; exact .inl hz), fun hzL ↦ hzs.2 ?_⟩ + rw [← hmeet, hbdD] + exact ⟨hzL, hzs.1⟩ + have hA₂Δ : A₂ ⊆ Δ₂ := (b2 ▸ subset_union_left : A₂ ⊆ discBd Δ₂).trans + (Subtype.coe_image_subset _ _) + have hr1n : ‖r 1‖ = 1 := hr1 + have hnotneg : ∀ z ∈ A₁, -z ∉ A₁ := by + exact preconnected_circle_side_excludes_antipodes r hr1 A₁ hA₁sub hA₁pre + have hcomp : Δ₁ \ L ∈ componentsIn (closedBall (0 : ℂ) 1 \ L) := hc2 ▸ .inl rfl + obtain ⟨p₀, hp₀, hp₀e⟩ : ∃ p ∈ closedBall (0 : ℂ) 1 \ L, connectedComponentIn (closedBall + (0 : ℂ) 1 \ L) p = Δ₁ \ L := hcomp + have hnegL : ∀ z, z ∈ L → -z ∈ L := by + rintro _ (⟨t, rfl⟩ | ⟨t, rfl⟩) + · exact .inr ⟨t, rfl⟩ + · exact .inl ⟨t, by simp⟩ + have hΔsub : Δ₁ ⊆ closedBall 0 1 := hu ▸ subset_union_left + have hkey : ∀ z ∈ Δ₁ \ L, -z ∉ Δ₁ \ L := by + exact component_ne_neg r L A₁ A₂ Δ₁ Δ₂ hc hi y hyA₁ hA₁sub hA₁Δ hA₂Δ hnotneg p₀ hp₀e hnegL + hΔsub + have hinjΔ : ∀ z ∈ Δ₁ \ L, ∀ w ∈ Δ₁ \ L, z ^ 2 = w ^ 2 → z = w := by + intro z hz w hw h' + rcases sq_eq_sq_iff_eq_or_eq_neg.mp h' with h2 | h2 + · exact h2 + · exact absurd (h2 ▸ hz) (hkey w hw) + obtain ⟨h₁, g₁, c⟩ := d1.exists_isChart + have h0L : (0 : ℂ) ∈ L := .inl ⟨0, hr0⟩ + have h0Δ : (0 : ℂ) ∈ Δ₁ := hsubL h0L + have hsph : ∀ z ∈ L, ‖h₁ z‖ = 1 := fun z hz ↦ by + have : h₁ z ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem _ (hLbd hz) + exact mem_sphere_zero_iff_norm.mp this + have hgP : g₁ (h₁ 0) = 0 := c.gh h0Δ + have hPm : h₁ 0 ∈ closedBall (0 : ℂ) 1 := c.hm h0Δ + obtain ⟨δ, hδ, hg⟩ := Metric.continuousOn_iff.mp c.gc _ hPm (√ε) (Real.sqrt_pos.mpr hε) + have hφ : Continuous fun t ↦ h₁ (r t) := c.hc.comp_continuous hrc fun t ↦ hsubL (.inl ⟨t, rfl⟩) + obtain ⟨ρ, hρ, hφρ⟩ := Metric.continuous_iff.mp hφ 0 δ hδ + have hsv : 0 < min (ρ / 2) (1 / 2) := lt_min (by positivity) (by norm_num) + have hsv2 : min (ρ / 2) (1 / 2) ≤ 1 / 2 := min_le_right _ _ + let s : 𝕀 := ⟨min (ρ / 2) (1 / 2), hsv.le, by linarith⟩ + have hs0 : s ≠ 0 := fun h' ↦ hsv.ne' (congrArg Subtype.val h') + have hs1 : s ≠ 1 := fun h' ↦ by + have : min (ρ / 2) (1 / 2) = 1 := congrArg Subtype.val h' + linarith + have hsρ : dist s 0 < ρ := by + rw [Subtype.dist_eq, Real.dist_eq] + have : ((s : ℝ) - ((0 : 𝕀) : ℝ)) = min (ρ / 2) (1 / 2) := by simp [s] + rw [this, abs_of_pos hsv] + linarith [min_le_left (ρ / 2) (1 / 2 : ℝ)] + have hy₁ := hφρ s hsρ + rw [hr0] at hy₁ + let y₁ := h₁ (r s) + have hrsL : r s ∈ L := .inl ⟨s, rfl⟩ + have hrs0 : r s ≠ 0 := fun h' ↦ hs0 (hrinj (h'.trans hr0.symm)) + have hne₁ : h₁ 0 ≠ y₁ := fun h' ↦ hrs0 ((c.gh (hsubL hrsL)).symm.trans + ((congrArg g₁ h'.symm).trans hgP)) + have hy₁m : y₁ ∈ closedBall (0 : ℂ) 1 := c.hm (hsubL hrsL) + let seg : 𝕀 → ℂ := fun u ↦ (1 - (u : ℝ)) • h₁ 0 + (u : ℝ) • y₁ + have hsegc : Continuous seg := by + simp only [seg] + fun_prop + have hconv := convex_closedBall (0 : ℂ) 1 + have hsegm : ∀ u, seg u ∈ closedBall (0 : ℂ) 1 := fun u ↦ + hconv hPm hy₁m (by linarith [u.2.2]) u.2.1 (by ring) + have hsegd : ∀ u, dist (seg u) (h₁ 0) < δ := fun u ↦ by + have e : seg u - h₁ 0 = (u : ℝ) • (y₁ - h₁ 0) := by + simp only [seg, smul_sub, sub_smul, one_smul] + abel + rw [dist_eq_norm, e, norm_smul, Real.norm_eq_abs, abs_of_nonneg u.2.1] + have hu1 : (u : ℝ) ≤ 1 := u.2.2 + have hy' : ‖y₁ - h₁ 0‖ < δ := by simpa [dist_eq_norm] using hy₁ + nlinarith [norm_nonneg (y₁ - h₁ 0)] + have hsegin : ∀ u : 𝕀, u ≠ 0 → u ≠ 1 → seg u ∈ ball (0 : ℂ) 1 := fun u hu0 hu1 ↦ by + have hu0' : (0 : ℝ) < u := lt_of_le_of_ne u.2.1 (fun h' ↦ hu0 (Subtype.ext h'.symm)) + have hu1' : (u : ℝ) < 1 := lt_of_le_of_ne u.2.2 (fun h' ↦ hu1 (Subtype.ext h')) + have := (strictConvex_closedBall ℝ (E := ℂ) 0 1) hPm hy₁m hne₁ (a := 1 - (u : ℝ)) (b := u) + (by linarith) hu0' (by ring) + rwa [interior_closedBall _ one_ne_zero] at this + have hseginj : Injective seg := fun u v h' ↦ by + have e : ((u : ℝ) - v) • (y₁ - h₁ 0) = 0 := by + have : seg u - seg v = 0 := sub_eq_zero.mpr h' + simp only [seg, smul_sub, sub_smul, one_smul] at this ⊢ + linear_combination this + rcases smul_eq_zero.mp e with h2 | h2 + · exact Subtype.ext (sub_eq_zero.mp h2) + · exact absurd (sub_eq_zero.mp h2).symm hne₁ + let q : 𝕀 → ℂ := fun u ↦ g₁ (seg u) ^ 2 + have hz : ∀ u : 𝕀, u ≠ 0 → u ≠ 1 → g₁ (seg u) ∈ Δ₁ \ L := fun u hu0 hu1 ↦ by + refine ⟨c.gm (hsegm u), fun hL' ↦ ?_⟩ + have h2 := hsph _ hL' + rw [c.hg (hsegm u)] at h2 + exact (mem_ball_zero_iff.mp (hsegin u hu0 hu1)).ne h2 + have hoff : ∀ t, t ≠ 0 → t ≠ 1 → q t ∉ range a := by + exact chord_square_image_avoids_cut_arc (a := a) r hr2 Δ₁ g₁ seg hz + have hseg0 : seg 0 = h₁ 0 := by simp [seg] + have hseg1 : seg 1 = y₁ := by simp [seg] + have hq0 : q 0 = 0 := by simp [q, hseg0, hgP] + have hq1 : q 1 = a s := by + simp only [q, hseg1, y₁] + rw [c.gh (hsubL hrsL), hr2] + have hends : ∀ t : 𝕀, t = 0 ∨ t = 1 ∨ (t ≠ 0 ∧ t ≠ 1) := fun t ↦ by + by_cases h' : t = 0 + · exact .inl h' + · by_cases h'' : t = 1 + · exact .inr (.inl h'') + · exact .inr (.inr ⟨h', h''⟩) + have hendr : ∀ t : 𝕀, (t = 0 ∨ t = 1) → q t ∈ range a := by + rintro _ (rfl | rfl) + · exact ⟨0, h0.trans hq0.symm⟩ + · exact ⟨s, hq1.symm⟩ + have hqinj : Injective q := by + exact quadratic_chord_injective (a := a) hne0 L Δ₁ hinjΔ h₁ g₁ c s hs0 seg hsegm hseginj hz + hoff hq0 hq1 hends hendr + have hqc : Continuous q := by + have : Continuous fun u ↦ g₁ (seg u) := c.gc.comp_continuous hsegc hsegm + exact this.pow 2 + refine ⟨s, hs0, hs1, q, ⟨hqc, hqinj⟩, hq0, hq1, ?_, hoff⟩ + rintro _ ⟨u, rfl⟩ + have h2 := hg _ (hsegm u) (hsegd u) + rw [hgP, dist_zero_right] at h2 + have h3 : ‖q u‖ = ‖g₁ (seg u)‖ ^ 2 := norm_pow _ _ + have h4 : ‖g₁ (seg u)‖ ^ 2 < ε := by + have := Real.lt_sqrt (norm_nonneg _) |>.mp h2 + exact this + exact mem_ball_zero_iff.mpr (h3 ▸ h4) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FeatureCode.lean b/LeanPool/GraphMinor/GM19/FeatureCode.lean new file mode 100644 index 0000000000..6023a77524 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FeatureCode.lean @@ -0,0 +1,511 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FeatureGenus +public import Mathlib.Data.Set.Finite.List + +/-! +# The code of a family of lines + +Cut a surface along a family of lines. Each component of the cut surface has a form (`PieceForm`): +its numbers `a` and `b` and the +list of arcs of each cuff. The set of these forms is the code of the family (`HasCode`). Two +families with the same code differ by a +homeomorphism of the surface (`homeo_of_code`). There are finitely many codes for families with a +given index set +(`finite_codes`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Function GraphMinor.Surface + +universe u + +local notation "𝕀" => unitInterval + +variable {I : Type} + +/-- The arcs on the boundary of the cut surface: two for each line off the boundary, and one for +each line in the boundary. -/ +abbrev ArcIx (inner : I → Prop) : Type := {s : I × Bool // inner s.1 ∨ s.2 = false} + +/-- The arc with a given index. -/ +def liftArc {Y : Type*} {inner : I → Prop} (ξ η : I → ℝ → Y) (s : ArcIx inner) : ℝ → Y + := if s.1.2 then η s.1.1 else ξ s.1.1 + +section form + +variable {Y : Type*} [TopologicalSpace Y] {J : Type*} + +/-- The form of a part `W` of `Y` with arcs `γ`: the word of `W` with its free sides running through +the arcs in the order of `Ls`. -/ +def PieceForm (γ : J → ℝ → Y) (W : Set Y) (a b : ℕ) (Ls : List (List (J × Bool))) : Prop := + ∃ f : ℕ × ℂ → W, Presents (sW (ew a b Ls.length)) f ∧ + (∀ i < Ls.length, ∀ (p : ℕ) (s : J) (e : Bool), (Ls.getD i [])[p]? = some (s, e) → ∀ u ∈ Icc + (0 : ℝ) 1, (holeP a b Ls.length f i (pos (Ls.getD i []).length p u)).1 = γ s (ofs e u)) ∧ + ∀ s, γ s 0 ∈ W ↔ ∃ i < Ls.length, ∃ (p : ℕ) (e : Bool), (Ls.getD i [])[p]? = some (s, e) + +/-- Two parts with the same form are homeomorphic, by a map that keeps the arcs. -/ +theorem homeo_of_pieceForm [T2Space Y] {Y' : Type*} [TopologicalSpace Y'] [T2Space Y'] {γ : J → ℝ + → Y} {γ' : J → ℝ → Y'} {W : Set Y} {W' : Set Y'} {a b : ℕ} + {Ls : List (List (J × Bool))} (h : PieceForm γ W a b Ls) (h' : PieceForm γ' W' a b Ls) : + ∃ e : W ≃ₜ W', ∀ s, γ s 0 ∈ W → ∀ u ∈ Icc (0 : ℝ) 1, ∀ x : W, x.1 = γ s u → (e x).1 = γ' s u + := by + obtain ⟨f, h₁, h₂, h₃⟩ := h + obtain ⟨f', h₁', h₂', h₃'⟩ := h' + obtain ⟨e, he⟩ := presents_homeo (finW_sW _) h₁ h₁' + refine ⟨e, fun s hs u hu x hx ↦ ?_⟩ + obtain ⟨i, hi, p, b', hg⟩ := (h₃ s).mp hs + have hv := ofs_mem (e := b') hu + have e₁ := h₂ i hi p s b' hg _ hv + have e₂ := h₂' i hi p s b' hg _ hv + rw [ofs_ofs] at e₁ e₂ + have e₃ : x = holeP a b Ls.length f i (pos (Ls.getD i []).length p (ofs b' u)) := Subtype.ext + (hx.trans e₁.symm) + rw [e₃, ← e₂] + exact congrArg Subtype.val (he _ ⟨(ew_mem_dsk _ _ _).1, (norm_per _ _).le⟩) + +variable [T2Space Y] + +/-- **Each component has a form.** -/ +theorem exists_pieceForm [Finite J] {γ : J → ℝ → Y} (hS : IsSurface Y) + (hγ : BoundaryArcs γ) {W : Set Y} (hW : IsClopen W) (hc : IsConnected W) : + ∃ (a b : ℕ) (Ls : List (List (J × Bool))), PieceForm γ W a b Ls ∧ Ls.length ≤ Nat.card J + ∧ ∀ l ∈ Ls, l.length ≤ Nat.card J := by + classical + have hSW : IsSurface W := isSurface_sub hS hW + have : ConnectedSpace W := isConnected_iff_connectedSpace.mp hc + obtain ⟨a, b, c, ⟨e⟩⟩ := classification W hSW inferInstance + have h01 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hin : ∀ s, γ s 0 ∈ W → ∀ u ∈ Icc (0 : ℝ) 1, γ s u ∈ W := fun s hs u hu ↦ + (isPreconnected_Icc.image _ (hγ.cont s)).subset_isClopen hW ⟨_, mem_image_of_mem _ h01, hs⟩ + (mem_image_of_mem _ hu) + have hin' : ∀ s, ∀ u ∈ Icc (0 : ℝ) 1, γ s u ∈ W → γ s 0 ∈ W := fun s u hu hs ↦ + (isPreconnected_Icc.image _ (hγ.cont s)).subset_isClopen hW ⟨_, mem_image_of_mem _ hu, hs⟩ + (mem_image_of_mem _ h01) + let J' := {s : J // γ s 0 ∈ W} + let γ' : J' → ℝ → W := fun s u ↦ if h : γ s.1 u ∈ W then ⟨_, h⟩ else ⟨_, s.2⟩ + have hγ' : ∀ (s : J'), ∀ u ∈ Icc (0 : ℝ) 1, (γ' s u).1 = γ s.1 u := fun s u hu ↦ by + simp only [γ', hin s.1 s.2 u hu, dite_eq_left] + have hB : BoundaryArcs γ' := by + refine ⟨fun s ↦ ?_, fun s u hu v hv he ↦ ?_, fun s u hu ↦ ?_, fun s s' u hu v hv he ↦ ?_, + fun y hy ↦ ?_⟩ + · rw [IsInducing.subtypeVal.continuousOn_iff] + exact (hγ.cont s.1).congr fun u hu ↦ hγ' s u hu + · refine hγ.inj s.1 hu hv ?_ + rw [← hγ' s u hu, ← hγ' s v hv, he] + · refine (mem_bd_sub hW.isOpen).mpr ?_ + rw [hγ' s u hu] + exact hγ.bd s.1 u hu + · have hu' : u ∈ Icc (0 : ℝ) 1 := ⟨hu.1.le, hu.2.le⟩ + have hv' : v ∈ Icc (0 : ℝ) 1 := ⟨hv.1.le, hv.2.le⟩ + obtain ⟨h₁, h₂⟩ := hγ.disj s.1 s'.1 u hu v hv (by rw [← hγ' s u hu', ← hγ' s' v hv', he]) + exact ⟨Subtype.ext h₁, h₂⟩ + · obtain ⟨s, u, hu, hsu⟩ := hγ.cover y.1 ((mem_bd_sub hW.isOpen).mp hy) + have hs : γ s 0 ∈ W := hin' s u hu (hsu ▸ y.2) + exact ⟨⟨s, hs⟩, u, hu, Subtype.ext ((hγ' ⟨s, hs⟩ u hu).trans hsu)⟩ + obtain ⟨f, L, hF, hc₁, hc₂⟩ := exists_form hSW e hB + let L' : ℕ → List (J × Bool) := fun i ↦ (L i).map fun x ↦ (x.1.1, x.2) + let Ls := (List.range c).map L' + have hlen : Ls.length = c := by simp [Ls] + have hget : ∀ i < c, Ls.getD i [] = L' i := fun i hi ↦ by + simp [Ls, List.getD_eq_getElem?_getD, List.getElem?_map, List.getElem?_range hi] + have hcard : Nat.card J' ≤ Nat.card J := Nat.card_le_card_of_injective _ Subtype.val_injective + have hmap : ∀ i p s e, (L' i)[p]? = some (s, e) → ∃ hs : γ s 0 ∈ W, (L i)[p]? = some + ((⟨s, hs⟩ : J'), e) := fun i p s e h ↦ by + rw [List.getElem?_map] at h + obtain ⟨x, hx, he⟩ := Option.map_eq_some_iff.mp h + obtain ⟨rfl, rfl⟩ := Prod.mk.inj he + exact ⟨x.1.2, hx⟩ + refine ⟨a, b, Ls, ⟨f, hlen.symm ▸ hF.pres, fun i hi p s e' hg u hu ↦ ?_, fun s ↦ ⟨fun hs ↦ ?_, + ?_⟩⟩, hlen.trans_le (hc₁.trans hcard), fun l hl ↦ ?_⟩ + · rw [hlen] at hi ⊢ + rw [hget i hi] at hg ⊢ + obtain ⟨hs, hg'⟩ := hmap i p s e' hg + have h₁ := hF.side i hi p ⟨s, hs⟩ e' hg' u hu + have h₂ : (L' i).length = (L i).length := by simp [L'] + rw [h₂, h₁] + exact hγ' _ _ (ofs_mem hu) + · obtain ⟨i, hi, p, e', hg⟩ := hF.all ⟨s, hs⟩ + refine ⟨i, by rwa [hlen], p, e', ?_⟩ + rw [hget i hi, List.getElem?_map, hg] + rfl + · rintro ⟨i, hi, p, e', hg⟩ + rw [hlen] at hi + rw [hget i hi] at hg + exact (hmap i p s e' hg).1 + · obtain ⟨i, hi, rfl⟩ := List.mem_map.mp hl + have h₁ : i < c := by simpa using hi + have h₂ : (L' i).length = (L i).length := by simp [L'] + rw [h₂] + exact (hc₂ i h₁).trans hcard + +end form + + +section cut + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {inner : I → Prop} {b : I → 𝕀 → S} + +omit [TopologicalSpace S] [T2Space S] in +theorem liftArc_psi {Y : Type u} {ψ : Y → S} {ξ η : I → ℝ → Y} (hξ : ∀ i, ∀ u ∈ Icc (0 : ℝ) 1, ψ + (ξ i u) = extI (b i) u) (hη : ∀ i, ∀ u ∈ Icc (0 : ℝ) 1, ψ (η i u) = extI (b i) u) + (s : ArcIx inner) {u : ℝ} (hu : u ∈ Icc (0 : ℝ) 1) : ψ (liftArc ξ η s u) = extI (b s.1.1) u + := by + unfold liftArc + split_ifs + · exact hη _ u hu + · exact hξ _ u hu + +omit [T2Space S] in +/-- The lifts of a family of lines are arcs on the boundary of the cut surface. -/ +theorem boundaryArcs_of_cut {Y : Type u} [TopologicalSpace Y] {ψ : Y → S} {ξ η : I → ℝ → Y} + (hb : IsLineFamily b inner) (hc : AbstractCut b inner ψ ξ η) : + BoundaryArcs (liftArc ξ η : ArcIx inner → ℝ → Y) := by + have hp := fun (s : ArcIx inner) {u : ℝ} (hu : u ∈ Icc (0 : ℝ) 1) ↦ liftArc_psi hc.hξ hc.hη s hu + refine ⟨fun s ↦ ?_, fun s u hu v hv he ↦ ?_, fun s u hu ↦ ?_, fun s s' u hu v hv he ↦ ?_, + fun y hy ↦ ?_⟩ + · unfold liftArc + split_ifs + · exact hc.cη _ + · exact hc.cξ _ + · have h₁ : extI (b s.1.1) u = extI (b s.1.1) v := by rw [← hp s hu, ← hp s hv, he] + exact extI_injOn (hb.arc _).2 hu hv h₁ + · unfold liftArc + split_ifs + · exact hc.bdη _ u hu + · exact hc.bdξ _ u hu + · have hu' : u ∈ Icc (0 : ℝ) 1 := ⟨hu.1.le, hu.2.le⟩ + have hv' : v ∈ Icc (0 : ℝ) 1 := ⟨hv.1.le, hv.2.le⟩ + have h₁ : extI (b s.1.1) u = extI (b s'.1.1) v := by rw [← hp s hu', ← hp s' hv', he] + rcases hb.meet _ _ u v hu' hv' h₁ with ⟨h₂, rfl⟩ | ⟨h₂, -⟩ + · refine ⟨?_, rfl⟩ + obtain ⟨⟨i, t⟩, hs⟩ := s + obtain ⟨⟨j, t'⟩, hs'⟩ := s' + simp only at h₂ + subst h₂ + refine Subtype.ext (Prod.ext rfl ?_) + simp only + by_contra hne + have hin : inner i := by + rcases hs with h₄ | h₄ + · exact h₄ + · rcases hs' with h₅ | h₅ + · exact h₅ + · exact absurd (h₄.trans h₅.symm) hne + have h₃ := hc.ne i hin u hu + cases t <;> cases t' <;> simp_all [liftArc] + · rcases h₂ with rfl | rfl + · exact absurd hu.1 (lt_irrefl _) + · exact absurd hu.2 (lt_irrefl _) + · obtain ⟨i, u, hu, h₁ | h₁⟩ := hc.cover y hy + · exact ⟨⟨(i, false), .inr rfl⟩, u, hu, by simp [liftArc, h₁]⟩ + · by_cases hi : inner i + · exact ⟨⟨(i, true), .inl hi⟩, u, hu, by simp [liftArc, h₁]⟩ + · exact ⟨⟨(i, false), .inr rfl⟩, u, hu, by simp [liftArc, h₁, hc.eqb i hi u hu]⟩ + +omit [T2Space S] in +/-- Two points over one point of `S` are equal, or both on the boundary of the cut surface. -/ +theorem fib_bd {Y : Type u} [TopologicalSpace Y] {ψ : Y → S} {ξ η : I → ℝ → Y} + (hc : AbstractCut b inner ψ ξ η) {y y' : Y} (h : ψ y = ψ y') : + y = y' ∨ (y ∈ bd Y ∧ y' ∈ bd Y) := by + have key : ∀ y y', Relation.EqvGen (fun p q ↦ ∃ i, ∃ u ∈ Icc (0 : ℝ) 1, p = ξ i u ∧ q + = η i u) y y' → y = y' ∨ (y ∈ bd Y ∧ y' ∈ bd Y) := by + intro y y' hr + induction hr with + | rel y y' h => + obtain ⟨i, u, hu, rfl, rfl⟩ := h + exact .inr ⟨hc.bdξ i u hu, hc.bdη i u hu⟩ + | refl _ => exact .inl rfl + | symm _ _ _ ih => exact ih.elim (fun h ↦ .inl h.symm) fun h ↦ .inr h.symm + | trans x y z _ _ h₁ h₂ => + rcases h₁ with rfl | h₁ + · exact h₂ + · rcases h₂ with rfl | h₂ + · exact .inr h₁ + · exact .inr ⟨h₁.1, h₂.2⟩ + exact key _ _ (hc.fib y y' h) + +/-- The form data of one component. -/ +abbrev PieceCode (inner : I → Prop) : Type := ℕ × ℕ × List (List (ArcIx inner × Bool)) + +/-- The set `κ` is the code of the family `b` of lines. -/ +def HasCode (b : I → 𝕀 → S) (inner : I → Prop) (κ : Set (PieceCode inner)) : Prop := + ∃ (Y : Type u) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S) (ξ η : I → ℝ + → Y), IsSurface Y ∧ AbstractCut b inner ψ ξ η ∧ + (∀ x : Y, ∃ k ∈ κ, PieceForm (liftArc ξ η : ArcIx inner → ℝ → Y) (connectedComponent x) k.1 + k.2.1 k.2.2) ∧ + (∀ k ∈ κ, ∃ x : Y, PieceForm (liftArc ξ η : ArcIx inner → ℝ → Y) (connectedComponent x) k.1 + k.2.1 k.2.2) ∧ + ∀ x : Y, ∃ s : ArcIx inner, liftArc ξ η s 0 ∈ connectedComponent x + +/-- A homeomorphism of the cut surfaces that keeps the lifts passes to the surface. -/ +theorem homeo_of_lifts {b b' : I → 𝕀 → S} {Y Y' : Type u} [TopologicalSpace Y] [TopologicalSpace + Y'] [CompactSpace Y] [CompactSpace Y'] {ψ : Y → S} {ψ' : Y' → S} {ξ η : I → ℝ → Y} + {ξ' η' : I → ℝ → Y'} (hc : AbstractCut b inner ψ ξ η) (hc' : AbstractCut b' inner ψ' ξ' η') + (G : Y ≃ₜ Y') (hξ : ∀ i, ∀ u ∈ Icc (0 : ℝ) 1, G (ξ i u) = ξ' i u) + (hη : ∀ i, ∀ u ∈ Icc (0 : ℝ) 1, G (η i u) = η' i u) : ∃ e : S ≃ₜ S, ∀ i, ∀ u ∈ Icc (0 : ℝ) 1, e + (extI (b i) u) = extI (b' i) u := by + have hξ' : ∀ i, ∀ u ∈ Icc (0 : ℝ) 1, G.symm (ξ' i u) = ξ i u := fun i u hu ↦ by rw [← hξ i u hu, + G.symm_apply_apply] + have hη' : ∀ i, ∀ u ∈ Icc (0 : ℝ) 1, G.symm (η' i u) = η i u := fun i u hu ↦ by rw [← hη i u hu, + G.symm_apply_apply] + have key : ∀ {Z Z' : Type u} [TopologicalSpace Z] [TopologicalSpace Z'] [CompactSpace Z] {p : Z + → S} {p' : Z' → S} {x y : I → ℝ → Z} {x' y' : I → ℝ → Z'} {c c' : I → 𝕀 → S} + (hC : AbstractCut c inner p x y) (hC' : AbstractCut c' inner p' x' y') (K : Z ≃ₜ Z'), + (∀ i, ∀ u ∈ Icc (0 : ℝ) 1, K (x i u) = x' i u) → + (∀ i, ∀ u ∈ Icc (0 : ℝ) 1, K (y i u) = y' i u) → + ∃ E : S → S, Continuous E ∧ ∀ z, E (p z) = p' (K z) := by + intro Z Z' _ _ _ p p' x y x' y' c c' hC hC' K hx hy + have hq : IsQuotientMap p := hC.cont.isClosedMap.isQuotientMap hC.cont hC.surj + choose r hr using hC.surj + have hfib : ∀ z z', Relation.EqvGen (fun a d ↦ ∃ i, ∃ u ∈ Icc (0 : ℝ) 1, a = x i u ∧ d + = y i u) z z' → p' (K z) = p' (K z') := by + intro z z' he + induction he with + | rel z z' h => + obtain ⟨i, u, hu, rfl, rfl⟩ := h + rw [hx i u hu, hy i u hu, hC'.hξ i u hu, hC'.hη i u hu] + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h₁ h₂ => exact h₁.trans h₂ + have hE : ∀ z, p' (K (r (p z))) = p' (K z) := fun z ↦ hfib _ _ (hC.fib _ _ (hr _)) + refine ⟨fun s ↦ p' (K (r s)), ?_, hE⟩ + rw [hq.continuous_iff] + have e₁ : (fun s ↦ p' (K (r s))) ∘ p = p' ∘ K := funext hE + rw [e₁] + exact hC'.cont.comp K.continuous + obtain ⟨E, hE₁, hE₂⟩ := key hc hc' G hξ hη + obtain ⟨E', hE₁', hE₂'⟩ := key hc' hc G.symm hξ' hη' + have hl : ∀ s, E' (E s) = s := fun s ↦ by + obtain ⟨z, rfl⟩ := hc.surj s + rw [hE₂, hE₂', G.symm_apply_apply] + have hr : ∀ s, E (E' s) = s := fun s ↦ by + obtain ⟨z, rfl⟩ := hc'.surj s + rw [hE₂', hE₂, G.apply_symm_apply] + refine ⟨⟨⟨E, E', hl, hr⟩, hE₁, hE₁'⟩, fun i u hu ↦ ?_⟩ + change E (extI (b i) u) = _ + rw [← hc.hξ i u hu, hE₂, hξ i u hu, hc'.hξ i u hu] + +/-- **Two families with the same code differ by a homeomorphism.** -/ +theorem homeo_of_code {b b' : I → 𝕀 → S} {κ : Set (PieceCode inner)} (hb : IsLineFamily b inner) + (hb' : IsLineFamily b' inner) (h : HasCode b inner κ) (h' : HasCode b' inner κ) : + ∃ e : S ≃ₜ S, ∀ i, ∀ u ∈ Icc (0 : ℝ) 1, e (extI (b i) u) = extI (b' i) u := by + classical + obtain ⟨Y, _, _, ψ, ξ, η, hY, hc, h₁, h₂, h₃⟩ := h + obtain ⟨Y', _, _, ψ', ξ', η', hY', hc', h₁', h₂', h₃'⟩ := h' + have := hY.1 + have := hY'.1 + have := hY.locallyConnected + have := hY'.locallyConnected + set γ : ArcIx inner → ℝ → Y := liftArc ξ η with hγ + set γ' : ArcIx inner → ℝ → Y' := liftArc ξ' η' with hγ' + have hA := boundaryArcs_of_cut hb hc + have hA' := boundaryArcs_of_cut hb' hc' + have h01 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have harc : ∀ {Z : Type u} [TopologicalSpace Z] {g : ArcIx inner → ℝ → Z}, BoundaryArcs g → ∀ s + (x : Z), ∀ u ∈ Icc (0 : ℝ) 1, g s u ∈ connectedComponent x → g s 0 ∈ connectedComponent x := by + intro Z _ g hg s x u hu hx + rw [connectedComponent_eq hx] at ⊢ + exact (isPreconnected_Icc.image _ (hg.cont s)).subset_connectedComponent + (mem_image_of_mem _ hu) (mem_image_of_mem _ h01) + have hmatch : ∀ x : Y, ∃ (x' : Y') (e : connectedComponent x ≃ₜ connectedComponent x'), + (∀ s, γ s 0 ∈ connectedComponent x ↔ γ' s 0 ∈ connectedComponent x') ∧ + ∀ s, γ s 0 ∈ connectedComponent x → ∀ u ∈ Icc (0 : ℝ) 1, ∀ z : connectedComponent x, z.1 + = γ s u → (e z).1 = γ' s u := fun x ↦ by + obtain ⟨k, hk, hf⟩ := h₁ x + obtain ⟨x', hf'⟩ := h₂' k hk + obtain ⟨e, he⟩ := homeo_of_pieceForm hf hf' + refine ⟨x', e, fun s ↦ ?_, he⟩ + obtain ⟨-, -, -, h₄⟩ := hf + obtain ⟨-, -, -, h₅⟩ := hf' + rw [h₄ s, h₅ s] + have hmatch' : ∀ x' : Y', ∃ x : Y, ∀ s, γ s 0 ∈ connectedComponent x ↔ γ' s 0 ∈ + connectedComponent x' := fun x' ↦ by + obtain ⟨k, hk, hf'⟩ := h₁' x' + obtain ⟨x, hf⟩ := h₂ k hk + refine ⟨x, fun s ↦ ?_⟩ + obtain ⟨-, -, -, h₄⟩ := hf + obtain ⟨-, -, -, h₅⟩ := hf' + rw [h₄ s, h₅ s] + choose T E hT hE using hmatch + let rp : Y → Y := fun x ↦ @Classical.epsilon Y ⟨x⟩ (· ∈ connectedComponent x) + have hrp : ∀ x, rp x ∈ connectedComponent x := fun x ↦ @Classical.epsilon_spec Y + (· ∈ connectedComponent x) ⟨x, mem_connectedComponent⟩ + have hrpc : ∀ {x z : Y}, connectedComponent x = connectedComponent z → rp x = rp z + := fun {x z} he ↦ by + simp only [rp] + rw [he] + have hcp : ∀ x, connectedComponent (rp x) = connectedComponent x := fun x ↦ + (connectedComponent_eq (hrp x)).symm + have hmem : ∀ x, x ∈ connectedComponent (rp x) := fun x ↦ by + rw [hcp] + exact mem_connectedComponent + let H : Y → Y' := fun x ↦ (E (rp x) ⟨x, hmem x⟩).1 + have hH : ∀ z p (hz : z ∈ connectedComponent p), rp z = p → H z = (E p ⟨z, hz⟩).1 := by + rintro z _ hz rfl + rfl + have hHγ : ∀ s, ∀ u ∈ Icc (0 : ℝ) 1, H (γ s u) = γ' s u := fun s u hu ↦ by + refine hE _ s ?_ u hu _ rfl + rw [hcp] + exact harc hA s _ u hu mem_connectedComponent + have hHc : Continuous H := by + rw [continuous_iff_continuousAt] + intro x₀ + set p := rp x₀ with hp + have hop : IsOpen (connectedComponent p) := isOpen_connectedComponent + have hx₀ : x₀ ∈ connectedComponent p := hmem x₀ + have hcont : ContinuousOn H (connectedComponent p) := by + rw [continuousOn_iff_continuous_domRestrict] + have e₁ : (connectedComponent p).domRestrict H = Subtype.val ∘ E p := by + funext z + refine hH z.1 p z.2 ?_ + exact hrpc ((connectedComponent_eq z.2).symm.trans (hcp x₀)) + rw [e₁] + exact continuous_subtype_val.comp (E p).continuous + exact hcont.continuousAt (hop.mem_nhds hx₀) + have hpick : ∀ x, ∃ s, γ' s 0 ∈ connectedComponent (T (rp x)) ∧ γ s 0 ∈ connectedComponent (rp x) + := fun x ↦ by + obtain ⟨s, hs⟩ := h₃ (rp x) + exact ⟨s, (hT _ s).mp hs, hs⟩ + have hinj : Injective H := fun x z he ↦ by + have h₄ : connectedComponent (T (rp x)) = connectedComponent (T (rp z)) := by + have h₅ : H x ∈ connectedComponent (T (rp x)) := (E (rp x) ⟨x, hmem x⟩).2 + have h₆ : H x ∈ connectedComponent (T (rp z)) := he ▸ (E (rp z) ⟨z, hmem z⟩).2 + rw [connectedComponent_eq h₅, connectedComponent_eq h₆] + obtain ⟨s, hs₁, hs₂⟩ := hpick x + have hs₃ : γ s 0 ∈ connectedComponent (rp z) := (hT _ s).mpr (h₄ ▸ hs₁) + have h₅ : connectedComponent (rp x) = connectedComponent (rp z) := by + rw [connectedComponent_eq hs₂, connectedComponent_eq hs₃] + have h₆ : rp x = rp z := hrpc (by rw [← hcp x, ← hcp z, h₅]) + have hxz : (E (rp z) ⟨x, h₆ ▸ hmem x⟩).1 = (E (rp z) ⟨z, hmem z⟩).1 := by + rw [← hH x (rp z) (h₆ ▸ hmem x) h₆] + exact he + have := (E (rp z)).injective (Subtype.ext hxz) + exact congrArg Subtype.val this + have hsurj : Surjective H := fun y' ↦ by + obtain ⟨x₀, hx₀⟩ := hmatch' y' + set p := rp x₀ with hp + obtain ⟨s, hs₁, hs₂⟩ := hpick x₀ + have hs₃ : γ' s 0 ∈ connectedComponent y' := (hx₀ s).mp (by rw [← hcp x₀]; exact hs₂) + have h₅ : y' ∈ connectedComponent (T p) := by + rw [connectedComponent_eq hs₁, ← connectedComponent_eq hs₃] + exact mem_connectedComponent + obtain ⟨z, hz⟩ := (E p).surjective ⟨y', h₅⟩ + refine ⟨z.1, ?_⟩ + have h₆ : rp z.1 = p := hrpc ((connectedComponent_eq z.2).symm.trans (hcp x₀)) + rw [hH z.1 p z.2 h₆] + exact congrArg Subtype.val hz + let G : Y ≃ₜ Y' := Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective H ⟨hinj, hsurj⟩) hHc + have hGv : ∀ y, G y = H y := fun _ ↦ rfl + refine homeo_of_lifts hc hc' G (fun i u hu ↦ ?_) fun i u hu ↦ ?_ + · rw [hGv] + exact hHγ ⟨(i, false), .inr rfl⟩ u hu + · rw [hGv] + by_cases hi : inner i + · exact hHγ ⟨(i, true), .inl hi⟩ u hu + · rw [hc.eqb i hi u hu, hc'.eqb i hi u hu] + exact hHγ ⟨(i, false), .inr rfl⟩ u hu + +/-- The piece codes with bounded numbers. -/ +def boundedCodes (inner : I → Prop) (B N : ℕ) : Set (PieceCode inner) := + {k | k.1 ≤ B ∧ k.2.1 ≤ B ∧ k.2.2.length ≤ N ∧ ∀ l ∈ k.2.2, l.length ≤ N} + +theorem finite_boundedCodes [Finite I] (B N : ℕ) : (boundedCodes inner B N).Finite := by + let T₁ : Set (List (ArcIx inner × Bool)) := {l | l.length ≤ N} + have hT₁ : T₁.Finite := List.finite_length_le _ N + have : Finite T₁ := hT₁ + have hT₂ : {l : List T₁ | l.length ≤ N}.Finite := List.finite_length_le _ N + have hT₃ : ((fun l : List T₁ ↦ l.map Subtype.val) '' {l : List T₁ | l.length ≤ N}).Finite + := hT₂.image _ + refine ((Set.finite_Iic B).prod ((Set.finite_Iic B).prod hT₃)).subset ?_ + rintro ⟨a, b, Ls⟩ ⟨h₁, h₂, h₃, h₄⟩ + refine ⟨h₁, h₂, Ls.attach.map (fun l ↦ ⟨l.1, h₄ l.1 l.2⟩), by simpa using h₃, ?_⟩ + simp + +/-- **Finitely many codes.** -/ +theorem finite_codes [Finite I] (hS : IsSurface S) [ConnectedSpace S] (inner : I + → Prop) [Nonempty I] : + ∃ 𝒦 : Set (Set (PieceCode inner)), 𝒦.Finite ∧ ∀ b : I → 𝕀 → S, IsLineFamily b inner → ∀ + (V : Set S) (E 𝓕 : Set (Set S)), IsDissection V E 𝓕 → (∀ i, b i 0 ∈ V ∧ b i 1 ∈ V) → + (∀ i, range (b i) ⊆ gr V E) → ∃ κ ∈ 𝒦, HasCode b inner κ := by + classical + obtain ⟨a₀, b₀, c₀, ⟨e₀⟩⟩ := classification S hS inferInstance + set N := Nat.card (ArcIx inner) with hN + set B := 2 * a₀ + b₀ with hB + refine ⟨{κ | κ ⊆ boundedCodes inner B N}, (finite_boundedCodes B N).finite_subsets, + fun b hb V E 𝓕 hd hV hE ↦ ?_⟩ + obtain ⟨Y, tY, t2, ψ, ξ, η, hY, hc⟩ := exists_abstractCut hS hb hd hV hE + have := hY.1 + have := hY.locallyConnected + have hA := boundaryArcs_of_cut hb hc + have hbdS : ∀ y, ψ y ∈ bd S → y ∈ bd Y := fun y hy ↦ by + obtain ⟨i, v, hv⟩ := hb.cover _ hy + have hv' : (v : ℝ) ∈ Icc (0 : ℝ) 1 := v.2 + have h₁ : ψ y = ψ (ξ i v) := by rw [hc.hξ i v hv', extI_coe, hv] + rcases fib_bd hc h₁ with h₂ | h₂ + · rw [h₂] + exact hc.bdξ i v hv' + · exact h₂.1 + let κ : Set (PieceCode inner) := {k | k ∈ boundedCodes inner B N ∧ ∃ x : Y, PieceForm + (liftArc ξ η : ArcIx inner → ℝ → Y) (connectedComponent x) k.1 k.2.1 k.2.2} + refine ⟨κ, fun k hk ↦ hk.1, Y, tY, t2, ψ, ξ, η, hY, hc, fun x ↦ ?_, fun k hk ↦ hk.2, fun x ↦ ?_⟩ + · have hW : IsClopen (connectedComponent x) := isClopen_connectedComponent + obtain ⟨a, b', Ls, hF, h₁, h₂⟩ := exists_pieceForm hY hA hW isConnected_connectedComponent + obtain ⟨f, hf, -, -⟩ := id hF + obtain ⟨ht, f₀, hf₀⟩ := presents_ew a b' Ls.length + obtain ⟨e, -⟩ := presents_homeo (finW_sW _) hf hf₀ + have h₃ := genus_le hc.cont hc.surj (fun y y' h ↦ fib_bd hc h) hbdS hW e e₀ + refine ⟨(a, b', Ls), ⟨⟨?_, ?_, h₁, h₂⟩, x, hF⟩, hF⟩ <;> simp only <;> omega + · by_contra hcon + push Not at hcon + obtain ⟨i⟩ := ‹Nonempty I› + have hW : IsClopen (connectedComponent x) := isClopen_connectedComponent + have hnb : ∀ y ∈ connectedComponent x, y ∉ bd Y := fun y hy hb' ↦ by + obtain ⟨s, u, hu, hsu⟩ := hA.cover y hb' + have h₀ : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + refine hcon s ((isPreconnected_Icc.image _ (hA.cont s)).subset_isClopen hW ⟨y, ⟨u, hu, + hsu⟩, hy⟩ (mem_image_of_mem _ h₀)) + have hcl₁ : IsClosed (ψ '' connectedComponent x) := (hW.1.isCompact.image hc.cont).isClosed + have hcl₂ : IsClosed (ψ '' (connectedComponent x)ᶜ) := (hW.2.isClosed_compl.isCompact.image + hc.cont).isClosed + have hcompl : (ψ '' connectedComponent x)ᶜ = ψ '' (connectedComponent x)ᶜ := by + ext s + constructor + · intro hs + obtain ⟨y, rfl⟩ := hc.surj s + exact ⟨y, fun hy ↦ hs (mem_image_of_mem _ hy), rfl⟩ + · rintro ⟨y, hy, rfl⟩ ⟨y', hy', he⟩ + rcases fib_bd hc he with rfl | h₁ + · exact hy hy' + · exact hnb y' hy' h₁.1 + have hclopen : IsClopen (ψ '' connectedComponent x) := ⟨hcl₁, by + rw [← isClosed_compl_iff, hcompl] + exact hcl₂⟩ + have huniv := hclopen.eq_univ ⟨ψ x, mem_image_of_mem _ mem_connectedComponent⟩ + have hempty : (connectedComponent x)ᶜ = ∅ := by + by_contra hne + obtain ⟨y, hy⟩ := nonempty_iff_ne_empty.mpr hne + have hψy : ψ y ∈ ψ '' (connectedComponent x)ᶜ := mem_image_of_mem _ hy + rw [← hcompl, huniv] at hψy + exact hψy (mem_univ _) + have h₁ : liftArc ξ η (⟨(i, false), .inr rfl⟩ : ArcIx inner) 0 ∈ connectedComponent x := by + by_contra hn + have : liftArc ξ η (⟨(i, false), .inr rfl⟩ : ArcIx inner) 0 ∈ (connectedComponent x)ᶜ := hn + rw [hempty] at this + exact this + exact hcon _ h₁ + +end cut + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FeatureCount.lean b/LeanPool/GraphMinor/GM19/FeatureCount.lean new file mode 100644 index 0000000000..aa08cf42ab --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FeatureCount.lean @@ -0,0 +1,260 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FeatureLines +public import LeanPool.GraphMinor.GM19.Conditional2 +public import LeanPool.GraphMinor.GM11.PaintingCells + +/-! +# Graph Minors XIX, (5.2): there are finitely many features of bounded size + +Each feature gives a family of lines with a bounded number of lines (`exists_feature_lines`). Cut +the surface along the lines. There +are finitely many codes of the result (`finite_codes`), and two families with one code differ by a +homeomorphism of the surface +(`homeo_of_code`). We add to the code a tag for each line, which says what the line does in the +frame and in the feature. Two features +with one code and the same tags differ by a homeomorphism that keeps the frame +(`frame_homeo_of_lines`). This homeomorphism may reverse the +orientation, but then it reverses all orientations (`homeo_orientation`), and two reversing maps in +a row keep them. So each code and +list of tags needs at most two features (`finite_reps_of_labels`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Function Metric GraphMinor.Surface + +local notation "𝕀" => unitInterval + +/-- At most two representatives for each label, when two objects with one label are equal or +opposite, and two opposites make +an equal. -/ +theorem finite_reps_of_labels {D L : Type*} [Finite L] (Q : L → D → Prop) (Eqv Rev : D → D → Prop) + (hsame : ∀ l K K', Q l K → Q l K' → Eqv K K' ∨ Rev K K') (hrr : ∀ K K' K'', Rev K K' + → Rev K' K'' → Eqv K K'') : + ∃ 𝓕 : Set D, 𝓕.Finite ∧ ∀ K, (∃ l, Q l K) → ∃ K₀ ∈ 𝓕, Eqv K₀ K := by + classical + have h1 : ∀ l, ∃ s : Set D, s.Finite ∧ ∀ K, Q l K → ∃ K₀ ∈ s, Eqv K₀ K := by + intro l + by_cases hne : ∃ K, Q l K + · obtain ⟨K₀, h0⟩ := hne + by_cases hrev : ∃ K₁, Q l K₁ ∧ Rev K₀ K₁ + · obtain ⟨K₁, h2, h3⟩ := hrev + refine ⟨{K₀, K₁}, by simp, fun K hK ↦ ?_⟩ + rcases hsame l K₀ K h0 hK with h | h + · exact ⟨K₀, .inl rfl, h⟩ + · rcases hsame l K₁ K h2 hK with h' | h' + · exact ⟨K₁, .inr rfl, h'⟩ + · exact ⟨K₀, .inl rfl, hrr _ _ _ h3 h'⟩ + · refine ⟨{K₀}, by simp, fun K hK ↦ ?_⟩ + rcases hsame l K₀ K h0 hK with h | h + · exact ⟨K₀, rfl, h⟩ + · exact absurd ⟨K, hK, h⟩ hrev + · exact ⟨∅, finite_empty, fun K hK ↦ absurd ⟨K, hK⟩ hne⟩ + choose s hs hs' using h1 + refine ⟨⋃ l, s l, finite_iUnion hs, ?_⟩ + rintro K ⟨l, hl⟩ + obtain ⟨K₀, h0, h2⟩ := hs' l K hl + exact ⟨K₀, mem_iUnion.mpr ⟨l, h0⟩, h2⟩ + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +/-- What a line of a family does: the side of the frame that holds it, the frame vertices at its two +ends, and whether its two ends are +vertices of the feature. -/ +abbrev LineTag (Φ : Frame S) : Type := Option Φ.sides × Option Φ.V × Option Φ.V × Prop × Prop + +/-- The tag `t` is right for the line `b i`. -/ +def IsLineTag (Φ : Frame S) (K : Drawing S) {m : ℕ} (b : Fin m → 𝕀 → S) (inner : Fin m → Prop) + (i : Fin m) (t : LineTag Φ) : Prop := + (¬ inner i → ∃ s : Φ.sides, t.1 = some s ∧ range (b i) \ Φ.V ⊆ s.1) ∧ (∀ v : Φ.V, b i 0 + = v.1 ↔ t.2.1 = some v) ∧ + (∀ v : Φ.V, b i 1 = v.1 ↔ t.2.2.1 = some v) ∧ (t.2.2.2.1 ↔ b i 0 ∈ K.V) ∧ + (t.2.2.2.2 ↔ b i 1 ∈ K.V) + +omit [T2Space S] in +/-- Each line of a family made from a feature has a tag. -/ +theorem exists_line_tag {Φ : Frame S} {K : Drawing S} {m : ℕ} {b : Fin m → 𝕀 → S} {inner : Fin m + → Prop} + (D : FeatureLines Φ K b inner) (i : Fin m) : ∃ t, IsLineTag Φ K b inner i t := by + classical + have hend : ∀ x : S, ∃ o : Option Φ.V, ∀ v : Φ.V, x = v.1 ↔ o = some v := fun x ↦ by + by_cases hx : x ∈ Φ.V + · refine ⟨some ⟨x, hx⟩, fun v ↦ ?_⟩ + simp only [Option.some.injEq] + exact ⟨fun h ↦ Subtype.ext h, fun h ↦ by rw [← h]⟩ + · refine ⟨none, fun v ↦ ?_⟩ + simp only [reduceCtorEq, iff_false] + exact fun h ↦ hx (h ▸ v.2) + obtain ⟨o₀, h₀⟩ := hend (b i 0) + obtain ⟨o₁, h₁⟩ := hend (b i 1) + by_cases hi : inner i + · exact ⟨(none, o₀, o₁, _, _), fun h ↦ absurd hi h, h₀, h₁, Iff.rfl, Iff.rfl⟩ + · obtain ⟨s, hs, hsub⟩ := D.side i hi + exact ⟨(some ⟨s, hs⟩, o₀, o₁, _, _), fun _ ↦ ⟨⟨s, hs⟩, rfl, hsub⟩, h₀, h₁, Iff.rfl, Iff.rfl⟩ + +omit [T2Space S] in +/-- Two features with families of the same shape and the same tags differ by a homeomorphism that +keeps the frame, if the +homeomorphism carries lines to lines. -/ +theorem frame_homeo_of_lines {Φ : Frame S} {K K' : Drawing S} {m : ℕ} {b b' : Fin m → 𝕀 + → S} {inner : Fin m → Prop} + (D : FeatureLines Φ K b inner) (D' : FeatureLines Φ K' b' inner) {tag : Fin m → LineTag Φ} + (ht : ∀ i, IsLineTag Φ K b inner i (tag i)) (ht' : ∀ i, IsLineTag Φ K' b' inner i (tag i)) + (e : S ≃ₜ S) + (he : ∀ i, ∀ t : 𝕀, e (b i t) = b' i t) : + (∀ v ∈ Φ.V, e v = v) ∧ (∀ s ∈ Φ.sides, e '' s = s) ∧ e '' K.U = K'.U ∧ e '' K.V = K'.V := by + have hfix : ∀ v ∈ Φ.V, e v = v := by + intro v hv + obtain ⟨i, h | h⟩ := D.vertΦ v hv + · have h1 := ((ht i).2.1 ⟨v, hv⟩).1 h + have h2 := ((ht' i).2.1 ⟨v, hv⟩).2 h1 + rw [← h, he, h2, h] + · have h1 := ((ht i).2.2.1 ⟨v, hv⟩).1 h + have h2 := ((ht' i).2.2.1 ⟨v, hv⟩).2 h1 + rw [← h, he, h2, h] + have hnotV : ∀ x, x ∉ Φ.V → e x ∉ Φ.V := fun x hx h ↦ by + have := hfix _ h + exact hx (e.injective this ▸ h) + have hnotV' : ∀ x, e x ∉ Φ.V → x ∉ Φ.V := fun x hx h ↦ hx ((hfix x h).symm ▸ h) + refine ⟨hfix, ?_, ?_, ?_⟩ + · intro s hs + have hsbd : s ⊆ bd S \ Φ.V := hs.2.1 + apply Subset.antisymm + · rintro _ ⟨x, hx, rfl⟩ + obtain ⟨i, hi, t, rfl⟩ := D.border x (hsbd hx).1 + obtain ⟨s₁, hs₁, h1⟩ := (ht i).1 hi + obtain ⟨s₂, hs₂, h2⟩ := (ht' i).1 hi + have e1 : s₁ = s₂ := Option.some.inj (hs₁.symm.trans hs₂) + subst e1 + have h3 : s₁.1 = s := GM11.arcComponent_eq s₁.2 hs (h1 ⟨⟨t, rfl⟩, (hsbd hx).2⟩) hx + rw [he, ← h3] + apply h2 ⟨⟨t, rfl⟩, ?_⟩ + rw [← he] + exact hnotV _ (hsbd hx).2 + · intro y hy + obtain ⟨i, hi, t, rfl⟩ := D'.border y (hsbd hy).1 + obtain ⟨s₁, hs₁, h1⟩ := (ht i).1 hi + obtain ⟨s₂, hs₂, h2⟩ := (ht' i).1 hi + have e1 : s₁ = s₂ := Option.some.inj (hs₁.symm.trans hs₂) + subst e1 + have h3 : s₁.1 = s := GM11.arcComponent_eq s₁.2 hs (h2 ⟨⟨t, rfl⟩, (hsbd hy).2⟩) hy + have hoff : b i t ∉ Φ.V := hnotV' _ (by rw [he]; exact (hsbd hy).2) + exact ⟨b i t, h3 ▸ h1 ⟨⟨t, rfl⟩, hoff⟩, he i t⟩ + · rw [D.eqU, D'.eqU] + apply Subset.antisymm + · rintro _ ⟨x, hx, rfl⟩ + obtain ⟨i, hi, t, rfl⟩ := mem_iUnion₂.mp hx + exact mem_iUnion₂.mpr ⟨i, hi, t, (he i t).symm⟩ + · intro y hy + obtain ⟨i, hi, t, rfl⟩ := mem_iUnion₂.mp hy + exact ⟨b i t, mem_iUnion₂.mpr ⟨i, hi, t, rfl⟩, he i t⟩ + · apply Subset.antisymm + · rintro _ ⟨x, hx, rfl⟩ + obtain ⟨i, -, h | h⟩ := D.vertK x hx + · rw [← h, he] + exact (ht' i).2.2.2.1.1 ((ht i).2.2.2.1.2 (h ▸ hx)) + · rw [← h, he] + exact (ht' i).2.2.2.2.1 ((ht i).2.2.2.2.2 (h ▸ hx)) + · intro y hy + obtain ⟨i, -, h | h⟩ := D'.vertK y hy + · exact ⟨b i 0, (ht i).2.2.2.1.1 ((ht' i).2.2.2.1.2 (h ▸ hy)), by rw [he, h]⟩ + · exact ⟨b i 1, (ht i).2.2.2.2.1 ((ht' i).2.2.2.2.2 (h ▸ hy)), by rw [he, h]⟩ + +/-- The four conditions of a homeomorphism that keeps a frame and carries `K` to `K'`, and that +reverses all orientations. -/ +def FeatureRev (Φ : Frame S) (K K' : Drawing S) : Prop := + ∃ f : S ≃ₜ S, (∀ v ∈ Φ.V, f v = v) ∧ (∀ s ∈ Φ.sides, f '' s = s) ∧ f '' K.U = K'.U ∧ f '' K.V + = K'.V ∧ + ∀ ω : SurfaceOrientation S, IsReversedBy ω f + +/-- **Graph Minors XIX, (5.2).** -/ +theorem theorem_5_2_proof : Theorem52Statement := by + classical + intro S _ _ hS hconn Φ n + obtain ⟨B, hB⟩ := exists_feature_lines hS Φ + let M : ℕ := B + Φ.V.ncard + 3 * n + have hex : ∀ (m : ℕ) (inner : Fin m → Prop), ∃ 𝒦 : Set (Set (PieceCode inner)), 𝒦.Finite ∧ + (Nonempty (Fin m) → + ∀ b : Fin m → 𝕀 → S, IsLineFamily b inner → ∀ (V : Set S) (E 𝓕 : Set + (Set S)), IsDissection V E 𝓕 → + (∀ i, b i 0 ∈ V ∧ b i 1 ∈ V) → (∀ i, range (b i) ⊆ gr V E) → ∃ κ ∈ 𝒦, HasCode b inner κ) + := by + intro m inner + by_cases hm : Nonempty (Fin m) + · obtain ⟨𝒦, h1, h2⟩ := finite_codes hS inner + exact ⟨𝒦, h1, fun _ ↦ h2⟩ + · exact ⟨∅, finite_empty, fun h ↦ absurd h hm⟩ + choose 𝒦 h𝒦 h𝒦c using hex + have : Finite Φ.sides := Φ.finite_sides.to_subtype + have : Finite Φ.V := Φ.finite_V.to_subtype + have : ∀ m inner, Finite (𝒦 m inner) := fun m inner ↦ (h𝒦 m inner).to_subtype + let L : Type := Σ m : Fin (M + 1), Σ inner : Fin m.1 → Prop, (Fin m.1 → LineTag Φ) × Option + (𝒦 m.1 inner) + let Q : L → Drawing S → Prop := fun l K ↦ ∃ b : Fin l.1.1 → 𝕀 → S, FeatureLines Φ K b l.2.1 ∧ + (∀ i, IsLineTag Φ K b l.2.1 i (l.2.2.1 i)) ∧ ((IsEmpty (Fin l.1.1) ∧ l.2.2.2 = none) + ∨ ∃ κ, l.2.2.2 = some κ ∧ HasCode b l.2.1 κ.1) + have hsame : ∀ l K K', Q l K → Q l K' → FeatureEquiv Φ K K' ∨ FeatureRev Φ K K' := by + rintro ⟨m, inner, tag, κo⟩ K K' ⟨b, D, ht, hc⟩ ⟨b', D', ht', hc'⟩ + obtain ⟨e, he⟩ : ∃ e : S ≃ₜ S, ∀ i, ∀ t : 𝕀, e (b i t) = b' i t := by + rcases hc with ⟨hemp, -⟩ | ⟨κ, h1, h2⟩ + · exact ⟨Homeomorph.refl S, fun i ↦ (hemp.false i).elim⟩ + · rcases hc' with ⟨-, h3⟩ | ⟨κ', h3, h4⟩ + · simp only at h1 h3 + rw [h1] at h3 + exact absurd h3 (by simp) + · have hκ : κ = κ' := Option.some.inj (h1.symm.trans h3) + subst hκ + obtain ⟨e, he⟩ := homeo_of_code D.family D'.family h2 h4 + refine ⟨e, fun i t ↦ ?_⟩ + have := he i t t.2 + rwa [extI_coe, extI_coe] at this + obtain ⟨h1, h2, h3, h4⟩ := frame_homeo_of_lines D D' ht ht' e he + rcases homeo_orientation hS e with h5 | h5 + · exact .inl ⟨e, ⟨h1, h2, h5⟩, h3, h4⟩ + · exact .inr ⟨e, h1, h2, h3, h4, h5⟩ + have hrr : ∀ K K' K'', FeatureRev Φ K K' → FeatureRev Φ K' K'' → FeatureEquiv Φ K K'' := by + rintro K K' K'' ⟨f, h1, h2, h3, h4, h5⟩ ⟨g, h1', h2', h3', h4', h5'⟩ + refine ⟨f.trans g, ⟨fun v hv ↦ ?_, fun s hs ↦ ?_, fun ω ↦ preserved_of_reversed (h5 ω) + (h5' ω)⟩, ?_, ?_⟩ + · change g (f v) = v + rw [h1 v hv, h1' v hv] + · have : (f.trans g) '' s = g '' (f '' s) := by + rw [image_image] + rfl + rw [this, h2 s hs, h2' s hs] + · have : (f.trans g) '' K.U = g '' (f '' K.U) := by + rw [image_image] + rfl + rw [this, h3, h3'] + · have : (f.trans g) '' K.V = g '' (f '' K.V) := by + rw [image_image] + rfl + rw [this, h4, h4'] + obtain ⟨𝓕, hf, h𝓕⟩ := finite_reps_of_labels Q (FeatureEquiv Φ) (FeatureRev Φ) hsame hrr + refine ⟨𝓕, hf, fun K hK hn ↦ h𝓕 K ?_⟩ + obtain ⟨m, b, inner, hm, D⟩ := hB K hK + have hmM : m < M + 1 := by + have : K.E.ncard ≤ n := by omega + have : K.V.ncard ≤ n := by omega + simp only [M] + omega + have htag := fun i ↦ exists_line_tag D i + choose tag htag using htag + by_cases hne : Nonempty (Fin m) + · obtain ⟨V, E, 𝓕', hd, h0, h1⟩ := D.cuts + obtain ⟨κ, hκ, hc⟩ := h𝒦c m inner hne b D.family V E 𝓕' hd h0 h1 + exact ⟨⟨⟨m, hmM⟩, inner, tag, some ⟨κ, hκ⟩⟩, b, D, htag, .inr ⟨⟨κ, hκ⟩, rfl, hc⟩⟩ + · exact ⟨⟨⟨m, hmM⟩, inner, tag, none⟩, b, D, htag, .inl ⟨not_nonempty_iff.mp hne, rfl⟩⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FeatureCover.lean b/LeanPool/GraphMinor/GM19/FeatureCover.lean new file mode 100644 index 0000000000..97a24d3240 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FeatureCover.lean @@ -0,0 +1,186 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FeatureForm + +/-! +# A local cocycle from a function on a space that maps onto a surface + +Let `F` map a compact space `D` onto `S`, and let `g` be a function on `D` with values in a finite +group. Suppose that the +difference of `g` on two points of one fibre of `F` has closed level sets. The copies of `D` indexed +by the group, pasted along +the fibres of `F` with the shift by `g`, form a finite cover of `S`, and this cover gives a local +cocycle on `S` with `g` as a +primitive (`exists_cocycle_quot`). It is the construction of `exists_cocycle`, with the map `F` in +place of a word. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Function GraphMinor.Surface + +universe u + +variable {D S : Type*} [TopologicalSpace D] [CompactSpace D] [T2Space D] [TopologicalSpace S] + [T2Space S] {A : Type} [AddCommGroup A] [Finite A] + +/-- Two points of the copies of `D` are the same when they lie on one fibre, at the same height +after the shift by `g`. -/ +def qSetoid (F : D → S) (g : D → A) : Setoid (D × A) := + ⟨fun x y ↦ F x.1 = F y.1 ∧ -g x.1 + x.2 = -g y.1 + y.2, ⟨fun _ ↦ ⟨rfl, rfl⟩, fun h ↦ ⟨h.1.symm, + h.2.symm⟩, fun h h' ↦ ⟨h.1.trans h'.1, h.2.trans h'.2⟩⟩⟩ + +/-- **A local cocycle from a map onto a surface.** -/ +theorem exists_cocycle_quot [Nonempty D] {F : D → S} (hF : Continuous F) (hs : Surjective F) (g : D + → A) + (hcl : ∀ c : A, IsClosed {p : D × D | F p.1 = F p.2 ∧ g p.2 - g p.1 = c}) : + ∃ φ : S → S → A, IsCoc φ ∧ (∃ N : Set (D × D), NearDiag N ∧ ∀ a b, (a, b) ∈ N → φ (F a) (F b) + = -g a + g b) ∧ + ((∀ a, F a ∈ bd S → g a = 0) → BdTriv φ) := by + classical + let _ : TopologicalSpace A := ⊥ + have : DiscreteTopology A := ⟨rfl⟩ + have hrel : IsClosed {p : (D × A) × (D × A) | (qSetoid F g).r p.1 p.2} := by + have e : {p : (D × A) × (D × A) | (qSetoid F g).r p.1 p.2} = ⋃ t : A, ⋃ u : A, ((fun p : + (D × A) × (D × A) ↦ (p.1.1, p.2.1)) ⁻¹' {p : D × D | F p.1 = F p.2 ∧ g p.2 - g p.1 = u - t}) ∩ + ((fun p : (D × A) × (D × A) ↦ (p.1.2, p.2.2)) ⁻¹' {(t, u)}) := by + ext ⟨⟨a, t⟩, ⟨b, u⟩⟩ + simp only [mem_ofPred_eq, mem_iUnion, mem_inter_iff, mem_preimage, mem_singleton_iff, + Prod.mk.injEq] + constructor + · rintro ⟨h₁, h₂⟩ + refine ⟨t, u, ⟨h₁, ?_⟩, rfl, rfl⟩ + have h₃ : -g a + t = -g b + u := h₂ + have h₄ : g b - g a = u - t := by + have : g b + (-g a + t) = g b + (-g b + u) := by rw [h₃] + simp only [add_neg_cancel_left] at this + rw [← this] + abel + exact h₄ + · rintro ⟨t', u', ⟨h₁, h₂⟩, h₃, h₅⟩ + rw [← h₃, ← h₅] at h₂ + refine ⟨h₁, ?_⟩ + have h₄ : -g a + t = -g b + u := by + have : g b = g a + (u - t) := by rw [← h₂]; abel + rw [this] + abel + exact h₄ + rw [e] + refine isClosed_iUnion_of_finite fun t ↦ isClosed_iUnion_of_finite fun u ↦ ?_ + refine ((hcl _).preimage (by fun_prop)).inter ((isClosed_singleton (x := (t, + u))).preimage (by fun_prop)) + have ht : T2Space (Quotient (qSetoid F g)) := t2Space_quotient_of_isClosed (qSetoid F g) hrel + let Z := Quotient (qSetoid F g) + let mk : D × A → Z := Quotient.mk (qSetoid F g) + have hmk : Continuous mk := continuous_quotient_mk' + have hsound : ∀ {x y : D × A}, F x.1 = F y.1 → -g x.1 + x.2 = -g y.1 + y.2 → mk x = mk y + := fun h₁ h₂ ↦ Quotient.sound ⟨h₁, h₂⟩ + have hexact : ∀ {x y : D × A}, mk x = mk y → F x.1 = F y.1 ∧ -g x.1 + x.2 = -g y.1 + y.2 + := fun h ↦ Quotient.exact h + let τ : A → Z → Z := fun s ↦ Quotient.lift (fun x ↦ mk (x.1, x.2 + s)) (fun x y h ↦ hsound h.1 (by + have h₂ : -g x.1 + x.2 = -g y.1 + y.2 := h.2 + simp only + rw [← add_assoc, h₂, add_assoc])) + have hτmk : ∀ s x, τ s (mk x) = mk (x.1, x.2 + s) := fun _ _ ↦ rfl + have hτc : ∀ s, Continuous (τ s) := fun s ↦ Continuous.quotient_lift (hmk.comp (by fun_prop)) _ + have hexZ : ∀ z : Z, ∃ x, mk x = z := fun z ↦ Quotient.exists_rep z + have hτ0 : ∀ z, τ 0 z = z := by + intro z + obtain ⟨x, rfl⟩ := hexZ z + rw [hτmk, add_zero] + have hτa : ∀ s t z, τ s (τ t z) = τ (t + s) z := by + intro s t z + obtain ⟨x, rfl⟩ := hexZ z + rw [hτmk, hτmk, hτmk, add_assoc] + have hfree : ∀ s z, τ s z = z → s = 0 := by + intro s z he + obtain ⟨x, rfl⟩ := hexZ z + rw [hτmk] at he + have h₁ := (hexact he).2 + simp only at h₁ + exact add_eq_left.mp (add_left_cancel h₁) + let q : Z → S := Quotient.lift (fun x ↦ F x.1) (fun x y h ↦ h.1) + have hq : Continuous q := Continuous.quotient_lift (hF.comp continuous_fst) _ + have hsq : Surjective q := fun y ↦ by + obtain ⟨a, rfl⟩ := hs y + exact ⟨mk (a, 0), rfl⟩ + have hfib : ∀ z z', q z = q z' → ∃ s, z' = τ s z := by + intro z z' he + obtain ⟨x, rfl⟩ := hexZ z + obtain ⟨y, rfl⟩ := hexZ z' + have h₁ : F x.1 = F y.1 := he + refine ⟨-x.2 + (g x.1 + (-g y.1 + y.2)), ?_⟩ + rw [hτmk] + refine hsound h₁.symm ?_ + simp only [add_neg_cancel_left, neg_add_cancel_left] + have hfib' : ∀ s z, q (τ s z) = q z := by + intro s z + obtain ⟨x, rfl⟩ := hexZ z + rfl + choose l hl using hs + let σ : S → Z := fun y ↦ mk (l y, g (l y)) + have hσ : ∀ y, q (σ y) = y := fun y ↦ hl y + have hσf : ∀ a, σ (F a) = mk (a, g a) := fun a ↦ hsound (hl _) (by simp) + obtain ⟨φ, V, hV, hφ, hφs, hinv⟩ := cocycle_of_cover τ hτc hτ0 hτa hfree q hq hsq hfib hfib' σ hσ + have hP : Continuous fun a : D ↦ mk (a, 0) := hmk.comp (by fun_prop) + refine ⟨φ, hφ, ⟨(fun p : D × D ↦ (mk (p.1, 0), mk (p.2, 0))) ⁻¹' V, fun a ↦ ?_, + fun a b hab ↦ ?_⟩, fun hbd ↦ ?_⟩ + · have hc : Continuous fun p : D × D ↦ (mk (p.1, 0), mk (p.2, 0)) := by fun_prop + exact hc.continuousAt.preimage_mem_nhds (hV (mk (a, 0))) + · have h₂ := hinv (g b) _ _ hab + rw [hτmk, hτmk] at h₂ + refine hφs _ _ _ ?_ + rw [hσf, hσf, hτmk] + simp only [zero_add] at h₂ ⊢ + have e₃ : g a + (-g a + g b) = g b := add_neg_cancel_left _ _ + rw [e₃] + exact h₂ + · have hcl' : IsClosed (bd S) := isClosed_bd S + let K : Set Z := (fun a : D ↦ mk (a, 0)) '' (F ⁻¹' bd S) + have hK : IsCompact K := ((hcl'.preimage hF).isCompact).image hP + have hinj : InjOn q K := by + rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ he + refine hsound he ?_ + simp only + rw [hbd a ha, hbd b hb] + have : Nonempty Z := ⟨mk (Classical.arbitrary D, 0)⟩ + obtain ⟨q', hq', hql⟩ := exists_inv_of_compactOn hK hq.continuousOn hinj + have hσK : ∀ x ∈ bd S, σ x ∈ K := fun x hx ↦ by + have h₁ : F (l x) ∈ bd S := by rwa [hl x] + refine ⟨l x, h₁, ?_⟩ + simp only [σ] + rw [hbd _ h₁] + have hσc : ContinuousOn σ (bd S) := by + have hsub : bd S ⊆ q '' K := fun x hx ↦ ⟨σ x, hσK x hx, hσ x⟩ + refine (hq'.mono hsub).congr fun x hx ↦ ?_ + have h₁ := hql (hσK x hx) + rw [hσ] at h₁ + exact h₁.symm + refine ⟨0, {p | p.1 ∈ bd S → p.2 ∈ bd S → (σ p.1, σ p.2) ∈ V}, fun y ↦ ?_, + fun x hx y hy hxy ↦ ?_⟩ + · by_cases hy : y ∈ bd S + · have h₁ : ContinuousWithinAt (fun p : S × S ↦ (σ p.1, σ p.2)) (bd S ×ˢ bd S) (y, y) := by + have h₂ := hσc.prodMap hσc + exact h₂ (y, y) ⟨hy, hy⟩ + have h₃ := h₁ (hV (σ y)) + obtain ⟨u, hu, hus⟩ := mem_nhdsWithin_iff_exists_mem_nhds_inter.mp h₃ + refine Filter.mem_of_superset hu fun p hp h₄ h₅ ↦ ?_ + exact hus ⟨hp, h₄, h₅⟩ + · have h₁ : (bd S)ᶜ ×ˢ (univ : Set S) ∈ 𝓝 (y, y) := (hcl'.isOpen_compl.prod + isOpen_univ).mem_nhds ⟨hy, mem_univ _⟩ + refine Filter.mem_of_superset h₁ fun p hp h₄ ↦ ?_ + exact absurd h₄ hp.1 + · have h₁ := hφs x y 0 (by rw [hτ0]; exact hxy hx hy) + simp [h₁] + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FeatureCut.lean b/LeanPool/GraphMinor/GM19/FeatureCut.lean new file mode 100644 index 0000000000..46a2d0d624 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FeatureCut.lean @@ -0,0 +1,771 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FeatureLift + +/-! +# Cutting a surface along a family of lines + +`IsLineFamily` is a finite family of lines of a surface that meet only at their ends. Each line lies +in the boundary or meets +the boundary only at its ends, and the lines cover the boundary. Cutting the word of a dissection +gives a surface `Y` with a +map `ψ` to `S`. Each line has two lifts to `Y`, or one if it lies in the boundary. These lifts cover +`bd(Y)`, and two points of +`Y` over one point of `S` are joined by a chain of pairs of lifts of one point (`AbstractCut`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Function GraphMinor.Surface + +universe u + +local notation "𝕀" => unitInterval + +/-- A finite family of lines that meet only at their ends, and that cover the boundary. -/ +structure IsLineFamily {S : Type u} [TopologicalSpace S] {I : Type} (b : I → 𝕀 → S) (inner : I + → Prop) : Prop where + arc : ∀ i, IsArcMap (b i) + meet : ∀ i j (u v : ℝ), u ∈ Icc (0 : ℝ) 1 → v ∈ Icc (0 : ℝ) 1 → extI (b i) u = extI (b j) v → (i + = j ∧ u = v) ∨ ((u = 0 ∨ u = 1) ∧ (v = 0 ∨ v = 1)) + off : ∀ i, inner i → ∀ u ∈ Ioo (0 : ℝ) 1, extI (b i) u ∉ bd S + onBd : ∀ i, ¬ inner i → ∀ u ∈ Icc (0 : ℝ) 1, extI (b i) u ∈ bd S + cover : ∀ x ∈ bd S, ∃ i, x ∈ range (b i) + +/-- The result of cutting along a family of lines, without the words. -/ +structure AbstractCut {S Y : Type u} [TopologicalSpace S] [TopologicalSpace Y] {I : Type} (b : I + → 𝕀 → S) (inner : I → Prop) (ψ : Y → S) (ξ η : I → ℝ → Y) : Prop where + cont : Continuous ψ + surj : Surjective ψ + cξ : ∀ i, ContinuousOn (ξ i) (Icc 0 1) + cη : ∀ i, ContinuousOn (η i) (Icc 0 1) + hξ : ∀ i, ∀ u ∈ Icc (0 : ℝ) 1, ψ (ξ i u) = extI (b i) u + hη : ∀ i, ∀ u ∈ Icc (0 : ℝ) 1, ψ (η i u) = extI (b i) u + bdξ : ∀ i, ∀ u ∈ Icc (0 : ℝ) 1, ξ i u ∈ bd Y + bdη : ∀ i, ∀ u ∈ Icc (0 : ℝ) 1, η i u ∈ bd Y + ne : ∀ i, inner i → ∀ u ∈ Ioo (0 : ℝ) 1, ξ i u ≠ η i u + eqb : ∀ i, ¬ inner i → ∀ u ∈ Icc (0 : ℝ) 1, η i u = ξ i u + cover : ∀ y ∈ bd Y, ∃ i, ∃ u ∈ Icc (0 : ℝ) 1, y = ξ i u ∨ y = η i u + fib : ∀ y y', ψ y = ψ y' → Relation.EqvGen (fun p q ↦ ∃ i, ∃ u ∈ Icc (0 : ℝ) 1, p = ξ i u ∧ q + = η i u) y y' + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {W : ℕ → List Letter} {f : ℕ × ℂ + → S} {V : Set S} {E : Set (Set S)} + {A : Set S → 𝕀 → S} {lab : Set S → ℕ} {Y : Type u} [TopologicalSpace Y] [T2Space Y] {D : Set + (Set S)} {g : ℕ × ℂ → Y} {ψ : Y → S} + +/-- A property of a closed set that holds inside an interval holds on all of it. -/ +theorem mem_of_Ioo {T : Type*} [TopologicalSpace T] {ξ : ℝ → T} {Z : Set T} (hZ : IsClosed Z) + (hc : ContinuousOn ξ (Icc 0 1)) (h : ∀ u ∈ Ioo (0 : ℝ) 1, ξ u ∈ Z) : + ∀ u ∈ Icc (0 : ℝ) 1, ξ u ∈ Z := by + have hcl : closure (Ioo (0 : ℝ) 1) = Icc 0 1 := closure_Ioo (by norm_num) + intro u hu + have h₁ : ξ '' closure (Ioo (0 : ℝ) 1) ⊆ closure (ξ '' Ioo 0 1) := ContinuousOn.image_closure + (by rwa [hcl]) + have h₂ : ξ u ∈ closure (ξ '' Ioo 0 1) := h₁ ⟨u, hcl ▸ hu, rfl⟩ + exact closure_minimal (by rintro _ ⟨v, hv, rfl⟩; exact h v hv) hZ h₂ + +omit [T2Space S] in +/-- Two points of the discs with the same image, off the edges of `D`, stay pasted after cutting. -/ +theorem prel_off (h : WordEdges W f V E A lab) (hD : D ⊆ E) {a b : ℕ × ℂ} (hab : PRel W a b) : + f a = f b ∧ (f a ∉ ⋃₀ D → PRel (cutW W (lab '' D)) a b) := by + induction hab with + | rel a b hs => + have hfe := presents_eq_of_stp h.pres hs + refine ⟨hfe, fun hF ↦ ?_⟩ + obtain ⟨i, j, p, q, k, e, e', u, h1, h2, h3, hu, rfl, rfl⟩ := stp_iff.mp hs + refine .rel _ _ (stp_to_cut h1 h2 h3 hu fun hk ↦ ?_) + obtain ⟨e'', he'', rfl⟩ := hk + exact hF ⟨e'', he'', by + rw [h.f_side (hD he'') h1 hu] + exact h.extI_mem (hD he'') _⟩ + | refl _ => exact ⟨rfl, fun _ ↦ .refl _⟩ + | symm a b _ ih => exact ⟨ih.1.symm, fun hF ↦ .symm _ _ (ih.2 (ih.1 ▸ hF))⟩ + | trans a b c _ _ h1 h2 => exact ⟨h1.1.trans h2.1, fun hF ↦ .trans _ _ _ (h1.2 hF) (h2.2 + (h1.1 ▸ hF))⟩ + +/-- A side that is free stays free after cutting. -/ +theorem freeSide_cut_of_free {L : Set ℕ} {i p k : ℕ} {e : Bool} (h : (W i)[p]? = some (k, e)) + (hk : k ∉ L) (hf : FreeSide W i p) : FreeSide (cutW W L) i p := by + intro j q k' e₁ e₂ h1 h2 + obtain ⟨l, h3, h4⟩ := cut_get_iff.mp h1 + obtain ⟨l', h5, h6⟩ := cut_get_iff.mp h2 + have hl : l = k := by + rw [h] at h3 + exact (Prod.mk.inj (Option.some.inj h3)).1.symm + subst hl + rcases h4 with ⟨h7, -⟩ | ⟨-, rfl⟩ + · exact absurd h7 hk + · rcases h6 with ⟨-, h8⟩ | ⟨-, h8⟩ + · omega + · have : l' = l := by omega + subst this + exact hf _ _ _ _ _ h h5 + +/-- The other way: a side free after cutting with an uncut label was free. -/ +theorem freeSide_of_cut {L : Set ℕ} {i p k : ℕ} {e : Bool} (h : (W i)[p]? = some (k, e)) + (hk : k ∉ L) (hf : FreeSide (cutW W L) i p) : FreeSide W i p := by + intro j q k' e₁ e₂ h1 h2 + have h₁ : k' = k := by + rw [h] at h1 + exact (Prod.mk.inj (Option.some.inj h1)).1.symm + subst h₁ + exact hf j q (2 * k') e₁ e₂ (cut_get_iff.mpr ⟨_, h1, .inr ⟨hk, rfl⟩⟩) (cut_get_iff.mpr ⟨_, h2, + .inr ⟨hk, rfl⟩⟩) + +/-- A point of an interval between the terms of a chain lies in one of the steps. -/ +theorem exists_chainStep {t : ℕ → ℝ} {m : ℕ} (hm : 0 < m) (h0 : t 0 = 0) (hlt : ∀ p < m, t p < t + (p + 1)) {u : ℝ} (hu : u ∈ Icc 0 (t m)) : + ∃ p < m, u ∈ Icc (t p) (t (p + 1)) := by + induction m with + | zero => omega + | succ n ih => + by_cases h : u ≤ t n + · rcases Nat.eq_zero_or_pos n with rfl | hn + · exact ⟨0, by omega, ⟨h0 ▸ hu.1, by simpa using hu.2⟩⟩ + · obtain ⟨p, hp, h₁⟩ := ih hn (fun p hp ↦ hlt p (by omega)) ⟨hu.1, h⟩ + exact ⟨p, by omega, h₁⟩ + · exact ⟨n, by omega, ⟨(not_le.1 h).le, hu.2⟩⟩ + +/-- The parameter on an edge of the dissection along a piece of a line. -/ +theorem exists_theta (h : WordEdges W f V E A lab) {x : Set S} (hx : x ∈ E) {a : ℝ → S} {b c : ℝ} + (ha : ContinuousOn a (Icc b c)) (him : a '' Icc b c = x) : + ∃ θ : ℝ → ℝ, ContinuousOn θ (Icc b c) ∧ (∀ u ∈ Icc b c, θ u ∈ Icc (0 : ℝ) 1) + ∧ ∀ u ∈ Icc b c, extI (A x) (θ u) = a u := by + have hcA : ContinuousOn (extI (A x)) (Icc 0 1) := (continuous_extI (h.arc x hx).1.1).continuousOn + have hiA := extI_injOn (h.arc x hx).1.2 + have himA : extI (A x) '' Icc 0 1 = x := by rw [image_extI, (h.arc x hx).2.1] + obtain ⟨θ', hθc, hθl⟩ := exists_inv_of_compactOn isCompact_Icc hcA hiA + rw [himA] at hθc + have hmem : ∀ u ∈ Icc b c, a u ∈ x := fun u hu ↦ him ▸ mem_image_of_mem _ hu + have hex : ∀ u ∈ Icc b c, ∃ w ∈ Icc (0 : ℝ) 1, extI (A x) w = a u := fun u hu ↦ by + have := hmem u hu + rwa [← himA] at this + choose! θ hθ₁ hθ₂ using hex + have hθeq : ∀ u ∈ Icc b c, θ u = θ' (a u) := fun u hu ↦ by + rw [← hθ₂ u hu, hθl (hθ₁ u hu)] + exact ⟨θ, (hθc.comp ha (fun u hu ↦ hmem u hu)).congr hθeq, hθ₁, hθ₂⟩ + +omit [T2Space Y] in +/-- A line in the boundary has a lift, because over its inner points there is only one point. -/ +theorem exists_borderLift (h : WordEdges W f V E A lab) (_hD : D ⊆ E) (hg : Presents (cutW W + (lab '' D)) g) (hψ : ∀ a ∈ Dsk W, ψ (g a) = f a) {a : ℝ → S} + (ha : ContinuousOn a (Icc 0 1)) {m : ℕ} {t : ℕ → ℝ} {ss : ℕ → Set S} (hm : 0 < m) (ht0 : t 0 + = 0) (htm : t m = 1) + (hlt : ∀ p < m, t p < t (p + 1)) (hch : ∀ p < m, ss p ∈ E ∧ a '' Icc (t p) (t (p + 1)) = ss p) + (huniq : ∀ y y', ψ y = ψ y' → (∃ u ∈ Ioo (0 : ℝ) 1, ψ y = a u) → y = y') : ∃ ξ : ℝ + → Y, ContinuousOn ξ (Icc 0 1) ∧ ∀ u ∈ Icc (0 : ℝ) 1, ψ (ξ u) = a u := by + have hD' : Dsk (cutW W (lab '' D)) = Dsk W := dsk_cut + have hmono : ∀ {k k'}, k ≤ k' → k' ≤ m → t k ≤ t k' := fun {k k'} h₁ h₂ ↦ chain_mono' hlt h₁ h₂ + have hI : ∀ k ≤ m, t k ∈ Icc (0 : ℝ) 1 := fun k hk ↦ ⟨ht0 ▸ hmono (Nat.zero_le k) hk, htm ▸ hmono + hk le_rfl⟩ + have hpiece : ∀ p < m, ∃ ξ : ℝ → Y, ContinuousOn ξ (Icc (t p) (t (p + 1))) ∧ ∀ u ∈ Icc (t p) (t + (p + 1)), ψ (ξ u) = a u := fun p hp ↦ by + obtain ⟨θ, hθc, hθ₁, hθ₂⟩ := exists_theta h (hch p hp).1 (ha.mono (Icc_subset_Icc + (hI p hp.le).1 (hI (p + 1) hp).2)) (hch p hp).2 + have hne : (ss p).Nonempty := by + rw [← (hch p hp).2] + exact ⟨_, mem_image_of_mem _ (⟨le_rfl, (hlt p hp).le⟩ : t p ∈ Icc (t p) (t (p + 1)))⟩ + obtain ⟨z, hz⟩ := hne + obtain ⟨c, hc, hfc⟩ : z ∈ f '' Dsk W := h.pres.2.1 ▸ mem_univ z + obtain ⟨q, e, x, hx, u, hu, h₁, -, -⟩ := h.exists_side hc ⟨ss p, (hch p hp).1, hfc ▸ hz⟩ + obtain ⟨i, r, k, e', h₃, h₄, h₅⟩ : ∃ (i r k : ℕ) (e' : Bool), (W i)[r]? = some (k, e') ∧ k + = lab (ss p) ∧ True := by + obtain ⟨d, hd, hd'⟩ : extI (A (ss p)) (1 / 2) ∈ f '' Dsk W := h.pres.2.1 ▸ mem_univ _ + obtain ⟨q', e₃, x', hx', u', hu', h₆, -, h₇⟩ := h.exists_side hd ⟨ss p, + (hch p hp).1, hd' ▸ h.extI_mem (hch p hp).1 _⟩ + have hxx : x' = ss p := by + by_contra hne + have hV : extI (A (ss p)) (1 / 2) ∈ V := h.graph.disj x' hx' (ss p) (hch p hp).1 hne + ⟨by rw [← hd', h₇]; exact h.extI_mem hx' _, h.extI_mem (hch p hp).1 _⟩ + exact h.extI_notMem (hch p hp).1 (by norm_num) hV + subst hxx + exact ⟨_, _, _, _, h₆, rfl, trivial⟩ + subst h₄ + refine ⟨fun u ↦ g (spt W i r (ofs e' (θ u))), ?_, fun u hu ↦ ?_⟩ + · have h₁ : ContinuousOn (fun u ↦ spt W i r (ofs e' (θ u))) (Icc (t p) (t (p + 1))) := + (continuous_spt_ofs W i r e').comp_continuousOn hθc + exact hg.1.comp h₁ fun u _ ↦ hD' ▸ spt_mem (lt_length h₃) _ + · simp only + rw [hψ _ (spt_mem (lt_length h₃) _), h.f_side (hch p hp).1 h₃ (ofs_mem (hθ₁ u hu)), + ofs_ofs, hθ₂ u hu] + have key : ∀ n, 1 ≤ n → n ≤ m → ∃ ξ : ℝ → Y, ContinuousOn ξ (Icc 0 (t n)) ∧ ∀ u ∈ Icc 0 (t n), ψ + (ξ u) = a u := by + intro n hn + induction n, hn using Nat.le_induction with + | base => + intro _ + obtain ⟨ξ, h₁, h₂⟩ := hpiece 0 hm + simp only [zero_add] at h₁ h₂ + rw [ht0] at h₁ h₂ + exact ⟨ξ, h₁, h₂⟩ + | succ n hn ih => + intro hle + obtain ⟨ξ, h₁, h₂⟩ := ih (by omega) + have hnm : n < m := by omega + obtain ⟨ξ₁, h₃, h₄⟩ := hpiece n hnm + have hb₀ := (hI _ hnm.le).1 + have hstep := (hlt _ hnm).le + have hin : t n ∈ Ioo (0 : ℝ) 1 := ⟨by + have := hmono (show 1 ≤ n from hn) hnm.le + have h₅ := hlt 0 hm + simp only [zero_add] at h₅ + linarith, by + have := hmono (show n + 1 ≤ m from hnm) le_rfl + have h₅ := hlt n hnm + linarith⟩ + have h₅ : ξ (t n) = ξ₁ (t n) := by + have e₁ := h₂ _ (⟨hb₀, le_rfl⟩ : t n ∈ Icc 0 (t n)) + have e₂ := h₄ _ (⟨le_rfl, hstep⟩ : t n ∈ Icc (t n) (t (n + 1))) + exact huniq _ _ (e₁.trans e₂.symm) ⟨_, hin, e₁⟩ + refine ⟨fun u ↦ if u ≤ t n then ξ u else ξ₁ u, continuousOn_join hb₀ h₁ h₃ h₅ hstep, + fun u hu ↦ ?_⟩ + by_cases hl : u ≤ t n + · simp only [hl, ite_true] + exact h₂ u ⟨hu.1, hl⟩ + · simp only [hl, ite_false] + exact h₄ u ⟨(not_le.1 hl).le, hu.2⟩ + rw [← htm] + exact key m hm le_rfl + +private theorem cut_edge_has_two_sides + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {I : Type} + {b : I → 𝕀 → S} + {inner : I → Prop} + (hb : IsLineFamily b inner) + {V : Set S} + {E : Set (Set S)} + (W : ℕ → List Letter) + (f : ℕ × ℂ → S) + (A : Set S → 𝕀 → S) + (lab : Set S → ℕ) + (hw : WordEdges W f V E A lab) + (m : I → ℕ) + (t : I → ℕ → ℝ) + (ss : I → ℕ → Set S) + (ε : I → ℕ → Bool) + (hch : ∀ (i : I), ∀ p < m i, ss i p ∈ E ∧ (fun i => extI (b i)) i '' Icc (t i p) (t i (p + 1)) + = ss i p ∧ (fun i => extI (b i)) i (t i p) = extI (A (ss i p)) (if ε i p = true then 0 else + 1) ∧ (fun i => extI (b i)) i (t i (p + 1)) = extI (A (ss i p)) (if ε i p = true then 1 else + 0)) + (hsub : ∀ (i : I) {p : ℕ}, p < m i → Icc (t i p) (t i (p + 1)) ⊆ Icc 0 1) + (hendV : ∀ (i : I) {u : ℝ}, u = 0 ∨ u = 1 → (fun i => extI (b i)) i u ∈ V) + (hpt : ∀ (i : I) {p : ℕ}, p < m i → ∀ z ∈ ss i p, ∃ u ∈ Icc (t i p) (t i (p + 1)), (fun i => + extI (b i)) i u = z) : + ∀ e ∈ ({x | ∃ i, inner i ∧ ∃ p < m i, x = ss i p}), ∃ i p j q e₁ e₂, EdgeSides W (lab e) i p j + q e₁ e₂ := by + let a := fun i => extI (b i) + let D := {x | ∃ i, inner i ∧ ∃ p < m i, x = ss i p} + rintro _ ⟨c, hc, p, hp, rfl⟩ + have hmid : edgeMid A (ss c p) ∉ bd S := fun hb' ↦ by + obtain ⟨u, hu, hau⟩ := hpt c hp _ (hw.extI_mem (hch c p hp).1 _) + have hu' := hsub c hp hu + by_cases he : u = 0 ∨ u = 1 + · exact hw.extI_notMem (hch c p hp).1 (show (1 / 2 : ℝ) ∈ Ioo (0 : ℝ) 1 by norm_num) (by + have := hendV c he + rwa [hau] at this) + · push Not at he + exact hb.off c hc u ⟨lt_of_le_of_ne hu'.1 he.1.symm, lt_of_le_of_ne hu'.2 he.2⟩ (by + exact (congrArg (· ∈ bd S) hau).mpr hb') + obtain ⟨i, p', j, q, e₁, e₂, h1, h2, h3⟩ := hw.exists_sides (hch c p hp).1 hmid + exact ⟨i, p', j, q, e₁, e₂, ⟨h1, h2, h3⟩⟩ + +private theorem chain_step_at_interior_endpoint + {S : Type u} + [TopologicalSpace S] + {I : Type} + {b : I → 𝕀 → S} + {inner : I → Prop} + (hb : IsLineFamily b inner) + {E : Set (Set S)} + (A : Set S → 𝕀 → S) + (m : I → ℕ) + (t : I → ℕ → ℝ) + (ss : I → ℕ → Set S) + (ε : I → ℕ → Bool) + (hm : ∀ (i : I), 0 < m i) + (ht0 : ∀ (i : I), t i 0 = 0) + (htm : ∀ (i : I), t i (m i) = 1) + (hlt : ∀ (i : I), ∀ p < m i, t i p < t i (p + 1)) + (hch : ∀ (i : I), ∀ p < m i, ss i p ∈ E ∧ (fun i => extI (b i)) i '' Icc (t i p) (t i (p + 1)) + = ss i p ∧ (fun i => extI (b i)) i (t i p) = extI (A (ss i p)) (if ε i p = true then 0 else + 1) ∧ (fun i => extI (b i)) i (t i (p + 1)) = extI (A (ss i p)) (if ε i p = true then 1 else + 0)) + (hsne : ∀ (i : I), ∀ p < m i, ∀ q < m i, p ≠ q → ss i p ≠ ss i q) + (hmono : ∀ (i : I) {k k' : ℕ}, k ≤ k' → k' ≤ m i → t i k ≤ t i k') + (hI : ∀ (i : I), ∀ k ≤ m i, t i k ∈ Icc 0 1) : + ∀ (i : I), inner i → ∀ (k : ℕ), 0 < k → k < m i → ∀ p < m i, ∀ (τ : Bool), extI (A (ss i p)) + (eo τ) = (fun i => extI (b i)) i (t i k) → EndCase S A ({x | ∃ i, inner i ∧ ∃ p < m i, x = + ss i p}) (ss i p) τ := by + let a := fun i => extI (b i) + let D := {x | ∃ i, inner i ∧ ∃ p < m i, x = ss i p} + intro i hi k hk0 hkm + have hkI : t i k ∈ Ioo (0 : ℝ) 1 := ⟨by + have h₁ := hmono i (show 1 ≤ k from hk0) hkm.le + have h₂ := hlt i 0 (hm i) + simp only [zero_add] at h₂ + linarith [ht0 i], by + have h₁ := hmono i (show k + 1 ≤ m i from hkm) le_rfl + have h₂ := hlt i k hkm + linarith [htm i]⟩ + have hkey : ∀ j, ∀ p < m j, ∀ τ, extI (A (ss j p)) (eo τ) = a i (t i k) → j = i ∧ ((p + 1 = k + ∧ τ = ε i p) ∨ (p = k ∧ τ ≠ ε i p)) := by + intro j p hp τ he + have h₁ := chain_hex (hch j p hp).2.2.1 (hch j p hp).2.2.2 τ + rw [he] at h₁ + have hc : chainAt (ε j) p τ ≤ m j := by + unfold chainAt + split_ifs <;> omega + rcases hb.meet i j (t i k) (t j (chainAt (ε j) p τ)) ⟨hkI.1.le, hkI.2.le⟩ + (hI j _ hc) h₁ with ⟨rfl, h₂⟩ | ⟨h₂, -⟩ + · refine ⟨rfl, ?_⟩ + have h₃ : chainAt (ε i) p τ = k := by + rcases lt_trichotomy (chainAt (ε i) p τ) k with h₄ | h₄ | h₄ + · exact absurd h₂.symm (chain_mono (hlt i) h₄ hkm.le).ne + · exact h₄ + · exact absurd h₂ (chain_mono (hlt i) h₄ hc).ne + unfold chainAt at h₃ + split_ifs at h₃ with h₄ + · exact .inl ⟨h₃, h₄⟩ + · exact .inr ⟨h₃, h₄⟩ + · rcases h₂ with h₂ | h₂ + · exact absurd h₂ hkI.1.ne' + · exact absurd h₂ hkI.2.ne + obtain ⟨k', rfl⟩ : ∃ k', k = k' + 1 := ⟨k - 1, by omega⟩ + have hk' : k' < m i := by omega + have hA₁ : extI (A (ss i k')) (eo (ε i k')) = a i (t i (k' + 1)) := by + have := chain_hex (hch i k' hk').2.2.1 (hch i k' hk').2.2.2 (ε i k') + simpa [chainAt] using this + have hA₂ : extI (A (ss i (k' + 1))) (eo (!ε i (k' + 1))) = a i (t i (k' + 1)) := by + have := chain_hex (hch i (k' + 1) hkm).2.2.1 (hch i (k' + 1) hkm).2.2.2 (!ε i (k' + 1)) + simpa [chainAt] using this + have hD₁ : ss i k' ∈ D := ⟨i, hi, k', hk', rfl⟩ + have hD₂ : ss i (k' + 1) ∈ D := ⟨i, hi, k' + 1, hkm, rfl⟩ + have hoff' : a i (t i (k' + 1)) ∉ bd S := hb.off i hi _ hkI + have hall : ∀ e'' ∈ D, ∀ τ'', extI (A e'') (eo τ'') = a i (t i (k' + 1)) → (e'' = ss i k' ∧ τ'' + = ε i k') ∨ (e'' = ss i (k' + 1) ∧ τ'' = !ε i (k' + 1)) := by + rintro _ ⟨j, -, q, hq, rfl⟩ τ'' he + obtain ⟨rfl, h₁⟩ := hkey j q hq τ'' he + rcases h₁ with ⟨h₂, h₃⟩ | ⟨h₂, h₃⟩ + · obtain rfl : k' = q := by omega + exact .inl ⟨rfl, h₃⟩ + · subst h₂ + exact .inr ⟨rfl, by cases h₄ : ε j (k' + 1) <;> cases τ'' <;> simp_all⟩ + intro p hp τ he + obtain ⟨-, h₁⟩ := hkey i p hp τ he + rcases h₁ with ⟨h₂, h₃⟩ | ⟨h₂, h₃⟩ + · obtain rfl : k' = p := by omega + subst h₃ + refine .inl ⟨ss i (k' + 1), hD₂, !ε i (k' + 1), hsne i _ hkm _ hk' + (by omega), hA₂.trans he.symm, by rw [he]; exact hoff', fun e'' he'' τ'' h₄ ↦ ?_⟩ + exact hall e'' he'' τ'' (h₄.trans he) + · subst h₂ + have hτ : τ = !ε i (k' + 1) := by + revert h₃ + generalize ε i (k' + 1) = c + cases c <;> cases τ <;> simp + subst hτ + have hoffE : extI (A (ss i (k' + 1))) (eo (!ε i (k' + 1))) ∉ bd S := by + rw [he] + exact hoff' + refine .inl ⟨ss i k', hD₁, ε i k', hsne i _ hk' _ hkm (by omega), hA₁.trans he.symm, + hoffE, fun e'' he'' τ'' h₄ ↦ ?_⟩ + rcases hall e'' he'' τ'' (h₄.trans he) with h₅ | h₅ + · exact .inr h₅ + · exact .inl h₅ + +private theorem lift_endpoints_are_cut_sides + {S : Type u} + [TopologicalSpace S] + {I : Type} + {inner : I → Prop} + {V : Set S} + {E : Set (Set S)} + (W : ℕ → List Letter) + (f : ℕ × ℂ → S) + (A : Set S → 𝕀 → S) + (lab : Set S → ℕ) + (hw : WordEdges W f V E A lab) + (a : I → ℝ → S) + (m : I → ℕ) + (t : I → ℕ → ℝ) + (ss : I → ℕ → Set S) + (ε : I → ℕ → Bool) + (hch : ∀ (i : I), ∀ p < m i, ss i p ∈ E ∧ a i '' Icc (t i p) (t i (p + 1)) = ss i p ∧ a i (t i + p) = extI (A (ss i p)) (if ε i p = true then 0 else 1) ∧ a i (t i (p + 1)) = extI (A (ss i + p)) (if ε i p = true then 1 else 0)) + (hsub : ∀ (i : I) {p : ℕ}, p < m i → Icc (t i p) (t i (p + 1)) ⊆ Icc 0 1) + (hpt : ∀ (i : I) {p : ℕ}, p < m i → ∀ z ∈ ss i p, ∃ u ∈ Icc (t i p) (t i (p + 1)), a i u = z) + (Y : Type u) + [TopologicalSpace Y] + (g : ℕ × ℂ → Y) + (ψ : Y → S) + (ξ : I → ℝ → Y) + (η : I → ℝ → Y) + (hL : ∀ (i : I), inner i → ChainLift W A lab g ψ (a i) (t i) (ss i) (m i) (ξ i) (η i)) : + ∀ (c : I), inner c → ∀ p' < m c, ∀ {i p j q : ℕ} {e e' : Bool}, (W i)[p]? = some (lab (ss c + p'), e) → (W j)[q]? = some (lab (ss c p'), e') → (i, p) ≠ (j, q) → ∀ w ∈ Icc 0 1, ∃ v ∈ Icc + 0 1, g (spt W i p (ofs e w)) = ξ c v ∧ g (spt W j q (ofs e' w)) = η c v ∨ g (spt W i p (ofs + e w)) = η c v ∧ g (spt W j q (ofs e' w)) = ξ c v := by + intro c hc p' hp' i p j q e e' h₁ h₂ hne' w hw' + obtain ⟨i₀, q₀, j₀, r₀, e₁, e₂, s₀, hform⟩ := (hL c hc).pieces p' hp' + obtain ⟨v, hv, hav⟩ := hpt c hp' _ (hw.extI_mem (hch c p' hp').1 w) + obtain ⟨hf₁, hf₂⟩ := hform v hv w hw' hav.symm + have hsign : ∀ {i' p' i'' p'' : ℕ} {k : ℕ} {e' e'' : Bool}, (W i')[p']? = some (k, e') → + (W i'')[p'']? = some (k, e'') → (i', p') = (i'', p'') → e' = e'' := by + intro i' p' i'' p'' k e' e'' h₃ h₄ h₅ + obtain ⟨rfl, rfl⟩ := Prod.mk.inj h₅ + rw [h₃] at h₄ + exact (Prod.mk.inj (Option.some.inj h₄)).2 + refine ⟨v, hsub c hp' hv, ?_⟩ + rcases hw.paired.third s₀.one s₀.two h₁ s₀.ne with h₃ | h₃ <;> rcases hw.paired.third s₀.one + s₀.two h₂ s₀.ne with h₄ | h₄ + · exact (hne' (h₃.trans h₄.symm)).elim + · obtain rfl := hsign h₁ s₀.one h₃ + obtain rfl := hsign h₂ s₀.two h₄ + obtain ⟨rfl, rfl⟩ := Prod.mk.inj h₃ + obtain ⟨rfl, rfl⟩ := Prod.mk.inj h₄ + exact .inl ⟨hf₁.symm, hf₂.symm⟩ + · obtain rfl := hsign h₁ s₀.two h₃ + obtain rfl := hsign h₂ s₀.one h₄ + obtain ⟨rfl, rfl⟩ := Prod.mk.inj h₃ + obtain ⟨rfl, rfl⟩ := Prod.mk.inj h₄ + exact .inr ⟨hf₂.symm, hf₁.symm⟩ + · exact (hne' (h₃.trans h₄.symm)).elim + +private theorem border_arc_lift_on_boundary + {S : Type u} + [TopologicalSpace S] + [T2Space S] + {I : Type} + {b : I → 𝕀 → S} + {inner : I → Prop} + (hb : IsLineFamily b inner) + {V : Set S} + {E : Set (Set S)} + (W : ℕ → List Letter) + (f : ℕ × ℂ → S) + (A : Set S → 𝕀 → S) + (lab : Set S → ℕ) + (hw : WordEdges W f V E A lab) + (D : Set (Set S)) + (hDE : D ⊆ E) + (hoffD : ∀ (c : I), ¬inner c → ∀ v ∈ Ioo 0 1, (fun i => extI (b i)) c v ∉ ⋃₀ D) + (Y : Type u) + [TopologicalSpace Y] + (g : ℕ × ℂ → Y) + (hbdY : bd Y = g '' freePts (cutW W (lab '' D))) + (ψ : Y → S) + (hψ : ∀ q ∈ Dsk W, ψ (g q) = f q) + (hone : ∀ (y y' : Y), ψ y = ψ y' → ψ y ∉ ⋃₀ D → y = y') + (ξ : I → ℝ → Y) + (cξ : ∀ (i : I), ContinuousOn (ξ i) (Icc 0 1)) + (hξ : ∀ (i : I), ∀ u ∈ Icc 0 1, ψ (ξ i u) = (fun i => extI (b i)) i u) : + ∀ (c : I), ¬inner c → ∀ u ∈ Icc 0 1, ξ c u ∈ bd Y := by + let a := fun i => extI (b i) + intro c hc + refine mem_of_Ioo (isClosed_bd Y) (cξ c) fun u hu ↦ ?_ + have hu' : u ∈ Icc (0 : ℝ) 1 := ⟨hu.1.le, hu.2.le⟩ + have hz : a c u ∈ f '' freePts W := hw.bd_eq ▸ hb.onBd c hc u hu' + obtain ⟨_, ⟨i, p, r, hp, hfr, hr, rfl⟩, hzr⟩ := hz + obtain ⟨k, e, hk⟩ : ∃ k e, (W i)[p]? = some (k, e) := by + obtain ⟨l, hl⟩ : ∃ l, (W i)[p]? = some l := ⟨_, List.getElem?_eq_getElem hp⟩ + exact ⟨l.1, l.2, hl⟩ + have hkL : k ∉ lab '' D := by + rintro ⟨x, hx, rfl⟩ + refine hoffD c hc u hu ⟨x, hx, ?_⟩ + change a c u ∈ x + rw [← hzr, hw.f_side (hDE hx) hk hr] + exact hw.extI_mem (hDE hx) _ + have hm₁ : spt W i p r ∈ Dsk W := spt_mem hp r + have hin : g (spt W i p r) ∈ bd Y := by + rw [hbdY] + refine ⟨spt W i p r, ⟨i, p, r, ?_, freeSide_cut_of_free hk hkL hfr, hr, + (spt_cut _ _ _).symm⟩, rfl⟩ + rw [cutW_length] + exact hp + have := hone (ξ c u) (g (spt W i p r)) (by rw [hξ c u hu', hψ _ hm₁, hzr]) + (by rw [hξ c u hu']; exact hoffD c hc u hu) + rwa [this] + +private theorem uncut_fiber_preserved + {S : Type u} + {I : Type} + {inner : I → Prop} + (W : ℕ → List Letter) + (lab : Set S → ℕ) + (m : I → ℕ) + (ss : I → ℕ → Set S) + (Y : Type u) + [TopologicalSpace Y] + (g : ℕ × ℂ → Y) + (hg : Presents (cutW W (lab '' ({x | ∃ i, inner i ∧ ∃ p < m i, x = ss i p}))) g) + (ξ : I → ℝ → Y) + (η : I → ℝ → Y) + (hQ : ∀ (c : I), inner c → ∀ p' < m c, ∀ {i p j q : ℕ} {e e' : Bool}, (W i)[p]? = some (lab + (ss c p'), e) → (W j)[q]? = some (lab (ss c p'), e') → (i, p) ≠ (j, q) → ∀ w ∈ Icc 0 1, ∃ v + ∈ Icc 0 1, g (spt W i p (ofs e w)) = ξ c v ∧ g (spt W j q (ofs e' w)) = η c v ∨ g (spt W i p + (ofs e w)) = η c v ∧ g (spt W j q (ofs e' w)) = ξ c v) : + ∀ (c d : ℕ × ℂ), PRel W c d → Relation.EqvGen (fun p q => ∃ i, ∃ u ∈ Icc 0 1, p = ξ i u ∧ q = + η i u) (g c) (g d) := by + let D := {x | ∃ i, inner i ∧ ∃ p < m i, x = ss i p} + intro c d hcd + induction hcd with + | rel c d hs => + obtain ⟨i, j, p, q, k, e, e', u, h1, h2, h3, hu, rfl, rfl⟩ := stp_iff.mp hs + by_cases hk : k ∈ lab '' D + · obtain ⟨x, ⟨c', hc', p', hp', rfl⟩, rfl⟩ := hk + obtain ⟨v, hv, h₄⟩ := hQ c' hc' p' hp' h1 h2 h3 (ofs e u) (ofs_mem hu) + rw [ofs_ofs, ofs_flp] at h₄ + rcases h₄ with h₄ | h₄ + · exact .rel _ _ ⟨c', v, hv, h₄.1, h₄.2⟩ + · exact .symm _ _ (.rel _ _ ⟨c', v, hv, h₄.2, h₄.1⟩) + · have := presents_eq_of_stp hg (stp_to_cut h1 h2 h3 hu hk) + rw [this] + exact .refl _ + | refl _ => exact .refl _ + | symm _ _ _ ih => exact .symm _ _ ih + | trans _ _ _ _ _ h1 h2 => exact .trans _ _ _ h1 h2 + +private theorem off_original_preimage_of_boundary + {S : Type u} + [TopologicalSpace S] + {I : Type} + {b : I → 𝕀 → S} + {inner : I → Prop} + (hb : IsLineFamily b inner) + (m : I → ℕ) + (t : I → ℕ → ℝ) + (ss : I → ℕ → Set S) + (hsub : ∀ (i : I) {p : ℕ}, p < m i → Icc (t i p) (t i (p + 1)) ⊆ Icc 0 1) + (hpt : ∀ (i : I) {p : ℕ}, p < m i → ∀ z ∈ ss i p, ∃ u ∈ Icc (t i p) (t i (p + 1)), extI (b i) u + = z) : + ∀ (c : I), ¬inner c → ∀ v ∈ Ioo 0 1, extI (b c) v ∉ ⋃₀ {z | ∃ j, inner j ∧ ∃ p < m j, z + = ss j p} := by + rintro c hc v hv ⟨_, ⟨j, hj, p, hp, rfl⟩, hz⟩ + obtain ⟨u, hu, hau⟩ := hpt j hp _ hz + rcases hb.meet j c u v (hsub j hp hu) ⟨hv.1.le, hv.2.le⟩ hau with ⟨rfl, -⟩ | ⟨-, h₂⟩ + · exact hc hj + · rcases h₂ with h₂ | h₂ + · exact hv.1.ne' h₂ + · exact hv.2.ne h₂ + +/-- **Cutting along a family of lines.** -/ +theorem exists_abstractCut (hS : IsSurface S) [ConnectedSpace S] {I : Type} [Finite I] {b : I → 𝕀 + → S} {inner : I → Prop} (hb : IsLineFamily b inner) + {V : Set S} {E 𝓕 : Set (Set S)} (hd : IsDissection V E 𝓕) (hV : ∀ i, b i 0 ∈ V ∧ b i 1 ∈ V) + (hE : ∀ i, range (b i) ⊆ gr V E) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S) (ξ η : I → ℝ + → Y), IsSurface Y ∧ AbstractCut b inner ψ ξ η := by + classical + obtain ⟨W, f, A, lab, hw, hdn⟩ := exists_word_edges hS hd + set a : I → ℝ → S := fun i ↦ extI (b i) with ha + have hac : ∀ i, Continuous (a i) := fun i ↦ continuous_extI (hb.arc i).1 + have hinj : ∀ i, InjOn (a i) (Icc 0 1) := fun i ↦ extI_injOn (hb.arc i).2 + have hv0 : ∀ i, a i 0 = b i 0 := fun i ↦ extI_coe (b i) 0 + have hv1 : ∀ i, a i 1 = b i 1 := fun i ↦ extI_coe (b i) 1 + have him : ∀ i, a i '' Icc 0 1 = range (b i) := fun i ↦ image_extI _ + have hne : ∀ i, a i 0 ≠ a i 1 := fun i he ↦ by + have := hinj i (by simp : (0 : ℝ) ∈ Icc (0 : ℝ) 1) (by simp : (1 : ℝ) ∈ Icc (0 : ℝ) 1) he + norm_num at this + have hexch := fun i ↦ exists_chain hw.graph A hw.arc (hac i) ((hinj i).mono Ico_subset_Icc_self) + ((hinj i).mono Ioc_subset_Icc_self) + (by rw [him]; exact hE i) (by rw [hv0]; exact (hV i).1) (by rw [hv1]; exact (hV i).2) (.inl + (hne i)) + choose m t ss ε hm ht0 htm hlt hVt hch hsne using hexch + have hmono : ∀ i {k k'}, k ≤ k' → k' ≤ m i → t i k ≤ t i k' := fun i {k k'} h₁ h₂ ↦ chain_mono' + (hlt i) h₁ h₂ + have hI : ∀ i, ∀ k ≤ m i, t i k ∈ Icc (0 : ℝ) 1 := fun i k hk ↦ ⟨ht0 i ▸ hmono i + (Nat.zero_le k) hk, htm i ▸ hmono i hk le_rfl⟩ + have hsub : ∀ i {p}, p < m i → Icc (t i p) (t i (p + 1)) ⊆ Icc 0 1 := fun i {p} hp ↦ + Icc_subset_Icc (hI i p hp.le).1 (hI i (p + 1) hp).2 + have hendV : ∀ i {u : ℝ}, (u = 0 ∨ u = 1) → a i u ∈ V := fun i {u} hu ↦ by + rcases hu with rfl | rfl + · rw [hv0] + exact (hV i).1 + · rw [hv1] + exact (hV i).2 + let D : Set (Set S) := {x | ∃ i, inner i ∧ ∃ p < m i, x = ss i p} + have hDE : D ⊆ E := by + rintro _ ⟨i, -, p, hp, rfl⟩ + exact (hch i p hp).1 + have hpt : ∀ i {p}, p < m i → ∀ z ∈ ss i p, ∃ u ∈ Icc (t i p) (t i (p + 1)), a i u = z + := fun i {p} hp z hz ↦ by + have := hz + rwa [← (hch i p hp).2.1] at this + have hsd : ∀ e ∈ D, ∃ (i p j q : ℕ) (e₁ e₂ : Bool), EdgeSides W (lab e) i p j q e₁ e₂ := by + exact cut_edge_has_two_sides (S := S) (I := I) (b := b) (inner := inner) hb (V := V) (E := E) + W f A lab hw m t ss ε hch hsub hendV hpt + have hoffD : ∀ c, ¬ inner c → ∀ v ∈ Ioo (0 : ℝ) 1, a c v ∉ ⋃₀ D := by + exact off_original_preimage_of_boundary (S := S) (I := I) (b := b) (inner := inner) hb m t + ss hsub hpt + have hfinL := finW_cut (W := W) (L := lab '' D) hw.fin + have hPL := isPaired_cut (W := W) (L := lab '' D) hw.paired + obtain ⟨Y, tY, t2, g, hg⟩ := exists_cut_presented.{u} (W := cutW W (lab '' D)) hfinL hPL + (by rw [dsk_cut]; exact hdn) + have hD' : Dsk (cutW W (lab '' D)) = Dsk W := dsk_cut + obtain ⟨hsurf, hbdY⟩ := surface_of_presents hfinL hPL hg + obtain ⟨ψ, hψc, hψ⟩ := exists_descend hfinL hg (hD' ▸ hw.pres.1) (fun a ha b hb hab ↦ + (hw.pres.2.2 a (hD' ▸ ha) b (hD' ▸ hb)).mpr (prel_of_prel_cut hab)) + rw [hD'] at hψ + have hrep : ∀ z : Y, ∃ c ∈ Dsk W, g c = z := fun z ↦ by + have hz : z ∈ g '' Dsk (cutW W (lab '' D)) := hg.2.1 ▸ mem_univ z + rwa [hD'] at hz + have hone : ∀ y y', ψ y = ψ y' → ψ y ∉ ⋃₀ D → y = y' := fun y y' he hn ↦ by + obtain ⟨c, hc, rfl⟩ := hrep y + obtain ⟨d, hd', rfl⟩ := hrep y' + rw [hψ c hc, hψ d hd'] at he + rw [hψ c hc] at hn + exact (hg.2.2 _ (hD' ▸ hc) _ (hD' ▸ hd')).mpr ((prel_off hw hDE ((hw.pres.2.2 c hc d hd').mp + he)).2 hn) + have hcase : ∀ i, inner i → ∀ k, 0 < k → k < m i → ∀ p < m i, ∀ τ, extI (A (ss i p)) (eo τ) = a i + (t i k) → EndCase S A D (ss i p) τ := by + exact chain_step_at_interior_endpoint (S := S) (I := I) (b := b) (inner := inner) hb (E := E) + A m t ss ε hm ht0 htm hlt hch hsne hmono hI + have hlift : ∀ i, ∃ ξ η : ℝ → Y, ContinuousOn ξ (Icc 0 1) ∧ ContinuousOn η (Icc 0 1) ∧ (∀ u ∈ Icc + (0 : ℝ) 1, ψ (ξ u) = a i u) ∧ (∀ u ∈ Icc (0 : ℝ) 1, ψ (η u) = a i u) ∧ + (inner i → ChainLift W A lab g ψ (a i) (t i) (ss i) (m i) ξ η) ∧ (¬ inner i → ∀ u ∈ Icc + (0 : ℝ) 1, η u = ξ u) := fun i ↦ by + by_cases hi : inner i + · obtain ⟨ξ, η, hL⟩ := + exists_chainLift hw hDE hg hψ hsd (hac i).continuousOn (hinj i) (hm i) + (ht0 i) (htm i) (hlt i) + (fun p hp ↦ ⟨⟨i, hi, p, hp, rfl⟩, (hch i p hp).2⟩) (hcase i hi) + have e := htm i + refine ⟨ξ, η, e ▸ hL.cξ, e ▸ hL.cη, e ▸ hL.hξ, e ▸ hL.hη, fun _ ↦ hL, fun h ↦ (h hi).elim⟩ + · obtain ⟨ξ, h₁, h₂⟩ := + exists_borderLift hw hDE hg hψ (hac i).continuousOn (hm i) (ht0 i) + (htm i) (hlt i) (fun p hp ↦ ⟨(hch i p hp).1, (hch i p hp).2.1⟩) + (fun y y' he ⟨u, hu, hy⟩ ↦ hone y y' he (hy ▸ hoffD i hi u hu)) + exact ⟨ξ, ξ, h₁, h₁, h₂, h₂, fun h ↦ (hi h).elim, fun _ _ _ ↦ rfl⟩ + choose ξ η cξ cη hξ hη hL heq using hlift + have hQ : ∀ c, inner c → ∀ p' < m c, ∀ {i p j q : ℕ} {e e' : Bool}, (W i)[p]? = some (lab + (ss c p'), e) → (W j)[q]? = some (lab (ss c p'), e') → (i, p) ≠ (j, q) → + ∀ w ∈ Icc (0 : ℝ) 1, ∃ v ∈ Icc (0 : ℝ) 1, (g (spt W i p (ofs e w)) = ξ c v ∧ g (spt W j q + (ofs e' w)) = η c v) ∨ + (g (spt W i p (ofs e w)) = η c v ∧ g (spt W j q (ofs e' w)) = ξ c v) := by + exact lift_endpoints_are_cut_sides (S := S) (I := I) (inner := inner) (V := V) (E := E) W f A + lab hw a m t ss ε hch hsub hpt Y g ψ ξ η hL + have hQ' : ∀ c, inner c → ∀ p' < m c, ∀ {i p : ℕ} {e : Bool}, (W i)[p]? = some (lab (ss c p'), e) + → ∀ w ∈ Icc (0 : ℝ) 1, ∃ v ∈ Icc (0 : ℝ) 1, + g (spt W i p (ofs e w)) = ξ c v ∨ g (spt W i p (ofs e w)) = η c v := by + intro c hc p' hp' i p e h₁ w hw' + obtain ⟨i₀, q₀, j₀, r₀, e₁, e₂, s₀⟩ := hsd _ (⟨c, hc, p', hp', rfl⟩ : ss c p' ∈ D) + by_cases hne' : (i, p) = (i₀, q₀) + · obtain ⟨v, hv, h₂⟩ := hQ c hc p' hp' h₁ s₀.two (hne'.symm ▸ s₀.ne) w hw' + exact ⟨v, hv, h₂.elim (fun h₃ ↦ .inl h₃.1) fun h₃ ↦ .inr h₃.1⟩ + · obtain ⟨v, hv, h₂⟩ := hQ c hc p' hp' h₁ s₀.one hne' w hw' + exact ⟨v, hv, h₂.elim (fun h₃ ↦ .inl h₃.1) fun h₃ ↦ .inr h₃.1⟩ + have hfreeD : ∀ c, inner c → ∀ p' < m c, ∀ {i p : ℕ} {e : Bool}, (W i)[p]? = some (lab + (ss c p'), e) → ∀ w ∈ Icc (0 : ℝ) 1, g (spt W i p (ofs e w)) ∈ bd Y := by + intro c hc p' hp' i p e h₁ w hw' + rw [hbdY] + refine ⟨spt W i p (ofs e w), ⟨i, p, ofs e w, ?_, freeSide_cut h₁ ⟨_, ⟨c, hc, p', hp', rfl⟩, + rfl⟩, ofs_mem hw', (spt_cut _ _ _).symm⟩, rfl⟩ + rw [cutW_length] + exact lt_length h₁ + have hbdIn : ∀ c, inner c → ∀ u ∈ Icc (0 : ℝ) 1, ξ c u ∈ bd Y ∧ η c u ∈ bd Y := by + intro c hc u hu + obtain ⟨p', hp', hu'⟩ := exists_chainStep (hm c) (ht0 c) (hlt c) (u := u) (by rwa [htm c]) + obtain ⟨i₀, q₀, j₀, r₀, e₁, e₂, s₀, hform⟩ := (hL c hc).pieces p' hp' + have hmem : a c u ∈ ss c p' := (hch c p' hp').2.1 ▸ mem_image_of_mem _ hu' + have himA : extI (A (ss c p')) '' Icc 0 1 = ss c p' := by + rw [image_extI, (hw.arc _ (hch c p' hp').1).2.1] + rw [← himA] at hmem + obtain ⟨w, hw', hwe⟩ := hmem + obtain ⟨h₁, h₂⟩ := hform u hu' w hw' hwe + exact ⟨h₁ ▸ hfreeD c hc p' hp' s₀.one w hw', h₂ ▸ hfreeD c hc p' hp' s₀.two w hw'⟩ + have hbdB : ∀ c, ¬ inner c → ∀ u ∈ Icc (0 : ℝ) 1, ξ c u ∈ bd Y := by + exact border_arc_lift_on_boundary (S := S) (I := I) (b := b) (inner := inner) hb (V := V) (E + := E) W f A lab hw D hDE hoffD Y g hbdY ψ hψ hone ξ cξ hξ + have hfibr : ∀ c d, PRel W c d → Relation.EqvGen (fun p q ↦ ∃ i, ∃ u ∈ Icc (0 : ℝ) 1, p = ξ i u + ∧ q = η i u) (g c) (g d) := by + exact uncut_fiber_preserved (S := S) (I := I) (inner := inner) W lab m ss Y g hg ξ η hQ + have hZ : IsClosed (⋃ i, (ξ i '' Icc 0 1 ∪ η i '' Icc 0 1)) := by + refine isClosed_iUnion_of_finite fun i ↦ ?_ + exact ((isCompact_Icc.image_of_continuousOn (cξ i)).union (isCompact_Icc.image_of_continuousOn + (cη i))).isClosed + refine ⟨Y, tY, t2, ψ, ξ, η, hsurf, ⟨hψc, ?_, cξ, cη, hξ, hη, ?_, ?_, ?_, heq, ?_, ?_⟩⟩ + · intro x + obtain ⟨c, hc, rfl⟩ : x ∈ f '' Dsk W := hw.pres.2.1 ▸ mem_univ x + exact ⟨g c, hψ c hc⟩ + · intro c u hu + by_cases hc : inner c + · exact (hbdIn c hc u hu).1 + · exact hbdB c hc u hu + · intro c u hu + by_cases hc : inner c + · exact (hbdIn c hc u hu).2 + · rw [heq c hc u hu] + exact hbdB c hc u hu + · exact fun i hi u hu ↦ (hL i hi).ne u (by rw [htm i]; exact hu) + · intro y hy + rw [hbdY] at hy + obtain ⟨_, ⟨i, p, r, hp, hfr, hr, rfl⟩, rfl⟩ := hy + rw [cutW_length] at hp + obtain ⟨k, e, hk⟩ : ∃ k e, (W i)[p]? = some (k, e) := by + obtain ⟨l, hl⟩ : ∃ l, (W i)[p]? = some l := ⟨_, List.getElem?_eq_getElem hp⟩ + exact ⟨l.1, l.2, hl⟩ + rw [spt_cut] at * + have hc₀ : ContinuousOn (fun r ↦ g (spt W i p r)) (Icc 0 1) := by + have h₁ : Continuous fun r ↦ spt W i p r := by + have := continuous_spt_ofs W i p true + simpa [ofs] using this + exact hg.1.comp h₁.continuousOn fun u _ ↦ hD' ▸ spt_mem hp u + have hall := mem_of_Ioo hZ hc₀ (fun u hu ↦ ?_) r hr + · obtain ⟨c, hc⟩ := mem_iUnion.1 hall + rcases hc with ⟨u, hu, h₁⟩ | ⟨u, hu, h₁⟩ + · exact ⟨c, u, hu, .inl h₁.symm⟩ + · exact ⟨c, u, hu, .inr h₁.symm⟩ + · have hu' : u ∈ Icc (0 : ℝ) 1 := ⟨hu.1.le, hu.2.le⟩ + by_cases hkL : k ∈ lab '' D + · obtain ⟨x, ⟨c, hc, p', hp', rfl⟩, rfl⟩ := hkL + obtain ⟨v, hv, h₄⟩ := hQ' c hc p' hp' hk (ofs e u) (ofs_mem hu') + rw [ofs_ofs] at h₄ + rcases h₄ with h₄ | h₄ + · exact mem_iUnion.2 ⟨c, .inl ⟨v, hv, h₄.symm⟩⟩ + · exact mem_iUnion.2 ⟨c, .inr ⟨v, hv, h₄.symm⟩⟩ + · have hfr' := freeSide_of_cut hk hkL hfr + have hzb : f (spt W i p u) ∈ bd S := hw.bd_eq ▸ mem_image_of_mem _ ⟨i, p, u, hp, hfr', hu', + rfl⟩ + obtain ⟨x, hx, hxk, -⟩ := hw.side _ _ _ _ hk + subst hxk + have hnV : f (spt W i p u) ∉ V := by + rw [hw.f_side hx hk hu'] + exact hw.extI_notMem hx (ofs_Ioo e hu) + obtain ⟨c, v, hv⟩ := hb.cover _ hzb + have hv' : (v : ℝ) ∈ Icc (0 : ℝ) 1 := v.2 + have hav : a c v = f (spt W i p u) := (extI_coe (b c) v).trans hv + have hvin : (v : ℝ) ∈ Ioo (0 : ℝ) 1 := by + refine ⟨lt_of_le_of_ne hv'.1 fun h₁ ↦ hnV ?_, lt_of_le_of_ne hv'.2 fun h₁ ↦ hnV ?_⟩ + · rw [← hav] + exact hendV c (.inl h₁.symm) + · rw [← hav] + exact hendV c (.inr h₁) + have hc : ¬ inner c := fun hc ↦ hb.off c hc v hvin (by + change a c v ∈ bd S + rw [hav] + exact hzb) + have := hone (ξ c v) (g (spt W i p u)) (by rw [hξ c v hv', hψ _ (spt_mem hp u), hav]) + (by rw [hξ c v hv']; exact hoffD c hc v hvin) + exact mem_iUnion.2 ⟨c, .inl ⟨v, hv', this⟩⟩ + · intro y y' he + obtain ⟨c, hc, rfl⟩ := hrep y + obtain ⟨d, hd', rfl⟩ := hrep y' + rw [hψ c hc, hψ d hd'] at he + exact hfibr c d ((hw.pres.2.2 c hc d hd').mp he) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FeatureDissect.lean b/LeanPool/GraphMinor/GM19/FeatureDissect.lean new file mode 100644 index 0000000000..57b81fef0a --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FeatureDissect.lean @@ -0,0 +1,434 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FeatureAccess +public import LeanPool.GraphMinor.Surface.CutGraph + +/-! +# A dissection of a surface that contains a given graph + +We want to cut a surface along a graph, so we want a dissection into discs whose graph contains the +given graph. The theorem +`exists_dissection` for closed surfaces asks that the graph hangs well on any graph that stays +connected when a point is removed. A +vertex of degree one does not hang well. So first we add `O`-arcs, one through each vertex that is +not on the boundary. At a vertex of +degree at least two, a small curve around the vertex meets two edges, and these close up to an +`O`-arc. At a vertex of degree one, the +arc given by `exists_chord` closes up the end of the edge (`exists_arcs_through`). Every edge then +has both ends on the `O`-arcs, and +this is all the proof for closed surfaces needs (`exists_dissection_graph`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Function Metric GraphMinor.Surface + +local notation "𝕀" => unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The part of a line from its end `v` to the first point outside the open set `O`. The set `R` +holds the rest of the line. -/ +theorem exists_piece [T2Space S] {e : Set S} {v w : S} (hl : IsLineWithEnds e v w) {O : Set S} + (hO : IsOpen O) (hv : v ∈ O) + (hw : w ∉ O) : + ∃ ℓ : 𝕀 → S, IsArcMap ℓ ∧ ℓ 0 = v ∧ range ℓ ⊆ e ∧ ℓ 1 ∉ O ∧ ℓ 1 ∈ closure O ∧ (∀ t, t ≠ 1 + → ℓ t ∈ O) ∧ + ∃ R, IsClosed R ∧ v ∉ R ∧ e ⊆ range ℓ ∪ R := by + obtain ⟨b, hb, rfl, rfl, rfl⟩ := hl.exists_arc + have hK : IsCompact (b ⁻¹' Oᶜ) := (hO.isClosed_compl.preimage hb.1).isCompact + obtain ⟨τ, ⟨hτ, hmin⟩⟩ := hK.exists_isLeast ⟨1, hw⟩ + have hτ0 : τ ≠ 0 := fun h ↦ hτ (h ▸ hv) + have hpos : (0 : 𝕀) < τ := lt_of_le_of_ne unitInterval.nonneg' hτ0.symm + have hin : ∀ t, t < τ → b t ∈ O := fun t ht ↦ by + by_contra h + exact absurd (hmin h) (not_le.mpr ht) + have hcl : b τ ∈ closure O := by + have h1 : τ ∈ closure (Iio τ) := by + rw [closure_Iio' (a := τ) ⟨0, hpos⟩] + exact mem_Iic.mpr le_rfl + exact map_mem_closure hb.1 h1 hin + have hne : (0 : 𝕀) ≠ τ := hτ0.symm + have hr := range_subArc b hpos.le + refine ⟨subArc b 0 τ, hb.sub hne, subArc_zero _ _ _, range_subArc_subset _ _ _, ?_, ?_, ?_, + b '' Icc τ 1, + (isCompact_Icc.image hb.1).isClosed, ?_, ?_⟩ + · rw [subArc_one] + exact hτ + · rw [subArc_one] + exact hcl + · intro t ht + have hm : subArc b 0 τ t ∈ b '' Icc 0 τ := hr ▸ mem_range_self t + obtain ⟨x, hx, hxe⟩ := hm + rw [← hxe] + refine hin x (lt_of_le_of_ne hx.2 fun h ↦ ht ?_) + apply (hb.sub hne).2 + rw [subArc_one, ← hxe, h] + · rintro ⟨x, hx, hxe⟩ + have : x = 0 := hb.2 hxe + rw [this] at hx + exact absurd hx.1 (not_le.mpr hpos) + · rintro _ ⟨x, rfl⟩ + rcases le_total x τ with h | h + · exact .inl (hr ▸ ⟨x, ⟨unitInterval.nonneg', h⟩, rfl⟩) + · exact .inr ⟨x, ⟨h, unitInterval.le_one'⟩, rfl⟩ + +/-- An edge through a vertex `v` is a line from `v` to another vertex. -/ +theorem exists_other {V : Set S} {E : Set (Set S)} (hg : IsGraph V E) {e : Set S} + (he : e ∈ E) {v : S} (hv : v ∈ V) + (hve : v ∈ e) : ∃ w, w ∈ V ∧ w ≠ v ∧ IsLineWithEnds e v w := by + obtain ⟨a, b, hab, hl, hi⟩ := hg.edge e he + have h1 : v ∈ e ∩ V := ⟨hve, hv⟩ + have h2 : a ∈ e ∩ V := hi ▸ .inl rfl + have h3 : b ∈ e ∩ V := hi ▸ .inr rfl + rw [hi] at h1 + rcases h1 with rfl | rfl + · exact ⟨b, h3.2, hab.symm, hl⟩ + · exact ⟨a, h2.2, hab, hl.symm⟩ + +/-- A vertex of degree one that is not on the boundary lies on an `O`-arc that we can add to the +graph. -/ +theorem exists_leaf_loop [T2Space S] {V : Set S} {E : Set (Set S)} (hg : IsGraph V E) + (hVE : V ⊆ ⋃₀ E) {v : S} {e : Set S} + (hvi : IsInteriorPoint v) (hv : v ∈ V) (he : e ∈ E) (hve : v ∈ e) (huniq : ∀ f ∈ E, v ∈ f → f + = e) : + ∃ V' E' C, IsGraph V' E' ∧ V ⊆ V' ∧ V' ⊆ ⋃₀ E' ∧ ⋃₀ E' = ⋃₀ E ∪ C ∧ IsOArc C ∧ v ∈ C := by + classical + obtain ⟨w, hwV, hwv, hl⟩ := exists_other hg he hv hve + let Z : Set S := (V \ {v}) ∪ ⋃₀ (E \ {e}) + have hZc : IsClosed Z := by + refine ((hg.fin.subset sdiff_subset).isClosed).union ((hg.fine.subset + sdiff_subset).isClosed_sUnion ?_) + rintro f ⟨hf, -⟩ + obtain ⟨_, _, -, hl', -⟩ := hg.edge f hf + exact hl'.isCompact.isClosed + have hvZ : v ∉ Z := by + rintro (⟨-, h⟩ | ⟨f, ⟨hf, hfe⟩, hvf⟩) + · exact h rfl + · exact hfe (huniq f hf hvf) + obtain ⟨U, h, g, c, hUW, hg0⟩ := hvi.exists_ballChart hZc.isOpen_compl hvZ (R := 2) (by norm_num) + have hb12 : ball (0 : ℂ) 1 ⊆ ball 0 2 := ball_subset_ball (by norm_num) + have hcb : closedBall (0 : ℂ) 1 ⊆ ball 0 2 := closedBall_subset_ball (by norm_num) + have hh0 : h v = 0 := by + have := c.hg (mem_ball_self (by norm_num : (0 : ℝ) < 2)) + rwa [hg0] at this + have hO : IsOpen (g '' ball 0 1) := c.isOpen_image isOpen_ball hb12 + have hvO : v ∈ g '' ball 0 1 := ⟨0, mem_ball_self one_pos, hg0⟩ + have hgU : ∀ z ∈ ball (0 : ℂ) 2, g z ∈ U := fun z hz ↦ c.gm hz + have hwO : w ∉ g '' ball 0 1 := by + rintro ⟨z, hz, rfl⟩ + exact hUW (hgU z (hb12 hz)) (.inl ⟨hwV, hwv⟩) + obtain ⟨ℓ, hℓ, hℓ0, hℓe, hℓ1, hℓc, hℓi, R, hRc, hvR, heR⟩ := exists_piece hl hO hvO hwO + have hT : IsClosed (g '' closedBall 0 1) := + ((isCompact_closedBall 0 1).image_of_continuousOn (c.gc.mono hcb)).isClosed + have hclT : closure (g '' ball 0 1) ⊆ g '' closedBall 0 1 := closure_minimal + (image_mono ball_subset_closedBall) hT + have hℓU : ∀ t, ℓ t ∈ U := fun t ↦ by + by_cases ht : t = 1 + · obtain ⟨z, hz, hzv⟩ := hclT hℓc + rw [ht, ← hzv] + exact hgU z (hcb hz) + · obtain ⟨z, hz, hzv⟩ := hℓi t ht + rw [← hzv] + exact hgU z (hb12 hz) + let a : 𝕀 → ℂ := fun t ↦ h (ℓ t) + have ha : IsArcMap a := ⟨c.hc.comp_continuous hℓ.1 hℓU, fun x y hxy ↦ hℓ.2 (by + rw [← c.gh (hℓU x), ← c.gh (hℓU y)] + exact congrArg g hxy)⟩ + have ha0 : a 0 = 0 := by simp only [a, hℓ0, hh0] + have ha1 : ‖a 1‖ = 1 := by + obtain ⟨z, hz, hzv⟩ := hclT hℓc + have hne : ¬ ‖z‖ < 1 := fun hlt ↦ hℓ1 ⟨z, mem_ball_zero_iff.mpr hlt, hzv⟩ + have e1 : a 1 = z := by + simp only [a] + rw [← hzv, c.hg (hcb hz)] + rw [e1] + exact le_antisymm (mem_closedBall_zero_iff.mp hz) (not_lt.mp hne) + have halt : ∀ t, t ≠ 1 → ‖a t‖ < 1 := fun t ht ↦ by + obtain ⟨z, hz, hzv⟩ := hℓi t ht + have e1 : a t = z := by + simp only [a] + rw [← hzv, c.hg (hb12 hz)] + rw [e1] + exact mem_ball_zero_iff.mp hz + have hnh : g ⁻¹' Rᶜ ∈ 𝓝 (0 : ℂ) := by + have hcont : ContinuousAt g 0 := c.gc.continuousAt (ball_mem_nhds 0 (by norm_num)) + refine hcont.preimage_mem_nhds (hRc.isOpen_compl.mem_nhds ?_) + rw [hg0] + exact hvR + obtain ⟨ε₀, hε₀, hball⟩ := Metric.mem_nhds_iff.mp hnh + have hε : 0 < min ε₀ 1 := lt_min hε₀ one_pos + obtain ⟨s, hs0, -, q, hq, hq0, hq1, hqb, hqoff⟩ := exists_chord ha ha0 ha1 halt hε + have hq2 : ∀ t, q t ∈ ball (0 : ℂ) 2 := fun t ↦ by + have := mem_ball_zero_iff.mp (hqb (mem_range_self t)) + exact mem_ball_zero_iff.mpr (by linarith [min_le_right ε₀ (1 : ℝ)]) + have hqR : ∀ t, g (q t) ∉ R := fun t ↦ by + have := mem_ball_zero_iff.mp (hqb (mem_range_self t)) + exact hball (mem_ball_zero_iff.mpr (by linarith [min_le_left ε₀ (1 : ℝ)])) + let A' : 𝕀 → S := fun t ↦ g (q t) + have hA' : IsArcMap A' := ⟨c.gc.comp_continuous hq.1 hq2, fun x y hxy ↦ hq.2 (by + rw [← c.hg (hq2 x), ← c.hg (hq2 y)] + exact congrArg h hxy)⟩ + have hA0 : A' 0 = v := by simp only [A', hq0, hg0] + have hA1 : A' 1 = ℓ s := by + simp only [A', hq1, a] + exact c.gh (hℓU s) + have hlA := hA'.isLineWithEnds + rw [hA0, hA1] at hlA + have hgr : gr V E = ⋃₀ E := union_eq_right.mpr hVE + have hps : ℓ s ∈ e := hℓe (mem_range_self s) + have hps' : ℓ s ∈ ⋃₀ E := ⟨e, he, hps⟩ + have hmeet : range A' ∩ gr V E = {v, ℓ s} := by + rw [hgr] + ext x + constructor + · rintro ⟨⟨t, rfl⟩, f, hf, hxf⟩ + by_cases ht0 : t = 0 + · exact .inl (by rw [ht0, hA0]) + by_cases ht1 : t = 1 + · exact .inr (by rw [ht1, hA1]; rfl) + exfalso + have hxU : A' t ∈ U := hgU _ (hq2 t) + have hfe : f = e := by + by_contra hne + exact hUW hxU (.inr ⟨f, ⟨hf, hne⟩, hxf⟩) + rcases heR (hfe ▸ hxf) with ⟨y, hy⟩ | hR + · apply hqoff t ht0 ht1 + refine ⟨y, ?_⟩ + simp only [a] + rw [hy] + exact c.hg (hq2 t) + · exact hqR t hR + · rintro (rfl | rfl) + · exact ⟨⟨0, hA0⟩, hVE hv⟩ + · exact ⟨⟨1, hA1⟩, hps'⟩ + have hvp : v ≠ ℓ s := fun h' ↦ hs0 (hℓ.2 (hℓ0.trans h').symm) + obtain ⟨E₁, hg1, hgr1, hsub1⟩ := hg.add_point (ℓ s) + have hV1 : insert (ℓ s) V ⊆ ⋃₀ E₁ := by + rintro x (rfl | hx) + · exact hsub1 hps' + · exact hsub1 (hVE hx) + have hE1 : gr (insert (ℓ s) V) E₁ = ⋃₀ E := by + rw [hgr1, hgr, insert_eq_of_mem hps'] + have hE1' : ⋃₀ E₁ = ⋃₀ E := by rw [← hE1]; exact (union_eq_right.mpr hV1).symm + have hA : range A' ∩ gr (insert (ℓ s) V) E₁ = {v, ℓ s} := by rw [hE1, ← hgr, hmeet] + obtain ⟨hg2, -⟩ := hg1.add_arc hvp hlA (.inr hv) (.inl rfl) hA + have hB := (hℓ.sub hs0.symm).isLineWithEnds + rw [subArc_zero, subArc_one, hℓ0] at hB + have hBsub : range (subArc ℓ 0 s) ⊆ ⋃₀ E := fun x hx ↦ ⟨e, he, hℓe (range_subArc_subset _ _ _ hx)⟩ + have hi : range A' ∩ range (subArc ℓ 0 s) = {v, ℓ s} := by + apply Subset.antisymm + · rw [← hmeet, hgr] + exact inter_subset_inter_right _ hBsub + · rintro x (rfl | rfl) + · exact ⟨⟨0, hA0⟩, hB.left_mem⟩ + · exact ⟨⟨1, hA1⟩, hB.right_mem⟩ + refine ⟨insert (ℓ s) V, insert (range A') E₁, range A' ∪ range (subArc ℓ 0 s), hg2, + subset_insert _ _, ?_, ?_, + oArc_of_lines hlA hB hi, .inl ⟨0, hA0⟩⟩ + · rw [sUnion_insert] + exact hV1.trans subset_union_right + · rw [sUnion_insert, hE1', union_comm] + ext x + constructor + · rintro (h' | h') + · exact .inl h' + · exact .inr (.inl h') + · rintro (h' | h' | h') + · exact .inl h' + · exact .inr h' + · exact .inl (hBsub h') + +/-- A vertex with two edges that is not on the boundary lies on an `O`-arc. We add a small curve +around it, and with this curve +also an `O`-arc made of two pieces of edges and a part of the curve. -/ +theorem exists_two_loop [CompactSpace S] [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) {V : Set + S} {E : Set (Set S)} + (hg : IsGraph V E) (hVE : V ⊆ ⋃₀ E) {v : S} {e₁ e₂ : Set S} (hvi : IsInteriorPoint v) + (hv : v ∈ V) (he₁ : e₁ ∈ E) + (he₂ : e₂ ∈ E) (hne : e₁ ≠ e₂) (hv₁ : v ∈ e₁) (hv₂ : v ∈ e₂) : + ∃ V' E' 𝓑, IsGraph V' E' ∧ V ⊆ V' ∧ V' ⊆ ⋃₀ E' ∧ ⋃₀ E' = ⋃₀ E ∪ ⋃₀ 𝓑 ∧ 𝓑.Finite ∧ + (∀ C ∈ 𝓑, IsOArc C) ∧ v ∈ ⋃₀ 𝓑 := by + classical + obtain ⟨w₁, hw₁V, hw₁v, hl₁⟩ := exists_other hg he₁ hv hv₁ + obtain ⟨w₂, hw₂V, hw₂v, hl₂⟩ := exists_other hg he₂ hv hv₂ + have hZc : IsClosed (V \ {v}) := (hg.fin.subset sdiff_subset).isClosed + obtain ⟨U, h, g, c, hUW, hg0⟩ := hvi.exists_ballChart hZc.isOpen_compl (by simp) (R := 3) + (by norm_num) + obtain ⟨L, hL, hLu⟩ := hg.exists_list + obtain ⟨P, D, hPO, hPt, hD, hbd, hgD, hDU, hdis⟩ := exists_tame_curve' hman c L hL + have hgr : gr V E = ⋃₀ E := union_eq_right.mpr hVE + rw [hLu, ← hgr] at hPt + obtain ⟨V1, E1, hV1, hg1, hgr1, hno1⟩ := hg.add_curve hPO hPt + have hO := hD.isOpen_discInt hman + have hvg : v ∈ g '' closedBall 0 2 := ⟨0, mem_closedBall_self (by norm_num), hg0⟩ + have hvP : v ∉ P := fun h' ↦ Set.disjoint_left.mp hdis h' hvg + have hvO : v ∈ discInt D := ⟨hgD hvg, by rwa [hbd]⟩ + have hOD : discInt D ⊆ D := sdiff_subset + have hwO : ∀ w, w ∈ V → w ≠ v → w ∉ discInt D := fun w hw hne' hin ↦ + hUW (hDU (hOD hin)) ⟨hw, hne'⟩ + obtain ⟨ℓ₁, hℓ₁, h10, h1e, h1n, h1c, h1i, -⟩ := exists_piece hl₁ hO hvO (hwO w₁ hw₁V hw₁v) + obtain ⟨ℓ₂, hℓ₂, h20, h2e, h2n, h2c, h2i, -⟩ := exists_piece hl₂ hO hvO (hwO w₂ hw₂V hw₂v) + have hDc : IsClosed D := hD.isCompact.isClosed + have hclD : closure (discInt D) ⊆ D := closure_minimal hOD hDc + have hend : ∀ x, x ∈ closure (discInt D) → x ∉ discInt D → x ∈ P := fun x h1 h2 ↦ by + by_contra h3 + exact h2 ⟨hclD h1, by rwa [hbd]⟩ + have hx₁ := hend _ h1c h1n + have hx₂ := hend _ h2c h2n + have hsubD : ∀ ℓ : 𝕀 → S, ℓ 1 ∈ closure (discInt D) → (∀ t, t ≠ 1 → ℓ t ∈ discInt D) + → range ℓ ⊆ D := by + rintro ℓ h1 h2 _ ⟨t, rfl⟩ + by_cases ht : t = 1 + · rw [ht] + exact hclD h1 + · exact hOD (h2 t ht) + have hin : range ℓ₁ ∩ range ℓ₂ = {v} := by + apply Subset.antisymm + · rintro x ⟨hx1, hx2⟩ + have hxV := hg.disj _ he₁ _ he₂ hne ⟨h1e hx1, h2e hx2⟩ + by_contra hxv + exact hUW (hDU (hsubD _ h1c h1i hx1)) ⟨hxV, hxv⟩ + · rintro x rfl + exact ⟨⟨0, h10⟩, ⟨0, h20⟩⟩ + have hl1 := hℓ₁.isLineWithEnds + have hl2 := hℓ₂.isLineWithEnds + rw [h10] at hl1 + rw [h20] at hl2 + have hM := hl1.symm.union hl2 hin + have hxne : ℓ₁ 1 ≠ ℓ₂ 1 := fun h' ↦ by + have : ℓ₁ 1 ∈ range ℓ₁ ∩ range ℓ₂ := ⟨⟨1, rfl⟩, ⟨1, h'.symm⟩⟩ + rw [hin] at this + exact hvP (this ▸ hx₁) + obtain ⟨A, B, hA, hB, hAB, -⟩ := hPO.lines hx₁ hx₂ hxne + have hAP : A ⊆ P := hAB ▸ subset_union_left + have hoff : ∀ x, x ∈ P → x ∉ discInt D := fun x hx h' ↦ h'.2 (hbd ▸ hx) + have hi : (range ℓ₁ ∪ range ℓ₂) ∩ A = {ℓ₁ 1, ℓ₂ 1} := by + apply Subset.antisymm + · rintro x ⟨⟨t, rfl⟩ | ⟨t, rfl⟩, hxA⟩ + · by_cases ht : t = 1 + · exact .inl (by rw [ht]) + · exact absurd (h1i t ht) (hoff _ (hAP hxA)) + · by_cases ht : t = 1 + · exact .inr (by rw [ht]; rfl) + · exact absurd (h2i t ht) (hoff _ (hAP hxA)) + · rintro x (rfl | rfl) + · exact ⟨hM.left_mem, hA.left_mem⟩ + · exact ⟨hM.right_mem, hA.right_mem⟩ + have hC := oArc_of_lines hM hA hi + have hgrV1 : gr V1 E1 = ⋃₀ E1 := union_eq_right.mpr (hno1 hVE) + have hMsub : range ℓ₁ ∪ range ℓ₂ ⊆ ⋃₀ E := by + rintro x (hx | hx) + · exact ⟨e₁, he₁, h1e hx⟩ + · exact ⟨e₂, he₂, h2e hx⟩ + refine ⟨V1, E1, {(range ℓ₁ ∪ range ℓ₂) ∪ A, P}, hg1, hV1, hno1 hVE, ?_, by simp, ?_, ?_⟩ + · rw [← hgrV1, hgr1, hgr] + apply Subset.antisymm + · rintro x (hx | hx) + · exact .inl hx + · exact .inr ⟨P, .inr rfl, hx⟩ + · rintro x (hx | ⟨C, rfl | rfl, hx⟩) + · exact .inl hx + · rcases hx with hx | hx + · exact .inl (hMsub hx) + · exact .inr (hAP hx) + · exact .inr hx + · rintro C (rfl | rfl) + · exact hC + · exact hPO + · exact ⟨_, .inl rfl, .inl (.inl ⟨0, h10⟩)⟩ + +/-- We can enlarge a graph that contains the boundary, by `O`-arcs, so that every chosen vertex is +on one of the `O`-arcs. -/ +theorem exists_arcs_through (hS : IsSurface S) {V₀ : Set S} {E₀ : Set (Set S)} (hg : IsGraph V₀ E₀) + (hV₀ : V₀ ⊆ ⋃₀ E₀) + (hbd : bd S ⊆ ⋃₀ E₀) {W : Set S} (hW : W.Finite) (hWV : W ⊆ V₀) : + ∃ V E 𝓐, IsGraph V E ∧ V₀ ⊆ V ∧ V ⊆ ⋃₀ E ∧ ⋃₀ E = ⋃₀ E₀ ∪ ⋃₀ 𝓐 ∧ 𝓐.Finite ∧ (∀ C ∈ 𝓐, IsOArc C) + ∧ cuffs S ⊆ 𝓐 ∧ + W ⊆ ⋃₀ 𝓐 := by + classical + obtain ⟨hcpt, ht2, hman⟩ := id hS + induction W, hW using Set.Finite.induction_on with + | empty => + have hc := cuff_statement.{u} S hS + refine ⟨V₀, E₀, cuffs S, hg, subset_rfl, hV₀, ?_, hc.2.1, hc.2.2, subset_rfl, empty_subset _⟩ + rw [sUnion_cuffs] + exact (union_eq_left.mpr hbd).symm + | @insert v W _ _ ih => + obtain ⟨V, E, 𝓐, h1, h2, h3, h4, h5, h6, h7, h8⟩ := ih fun x hx ↦ hWV (mem_insert_of_mem _ hx) + have hvV₀ : v ∈ V₀ := hWV (mem_insert _ _) + by_cases hv : v ∈ ⋃₀ 𝓐 + · refine ⟨V, E, 𝓐, h1, h2, h3, h4, h5, h6, h7, ?_⟩ + rintro x (rfl | hx) + · exact hv + · exact h8 hx + have hvi : IsInteriorPoint v := by + by_contra h' + exact hv (sUnion_mono h7 (sUnion_cuffs (S := S) ▸ h')) + obtain ⟨e, he, hve⟩ := h3 (h2 hvV₀) + have hstep : ∃ V' E' 𝓑, IsGraph V' E' ∧ V ⊆ V' ∧ V' ⊆ ⋃₀ E' ∧ ⋃₀ E' = ⋃₀ E ∪ ⋃₀ 𝓑 ∧ 𝓑.Finite ∧ + (∀ C ∈ 𝓑, IsOArc C) ∧ v ∈ ⋃₀ 𝓑 := by + by_cases hsec : ∃ f ∈ E, v ∈ f ∧ f ≠ e + · obtain ⟨f, hf, hvf, hfe⟩ := hsec + exact exists_two_loop hman h1 h3 hvi (h2 hvV₀) he hf hfe.symm hve hvf + · push Not at hsec + obtain ⟨V', E', C, a1, a2, a3, a4, a5, a6⟩ := exists_leaf_loop h1 h3 hvi + (h2 hvV₀) he hve hsec + exact ⟨V', E', {C}, a1, a2, a3, by simpa using a4, by simp, by simpa using a5, + by simpa using a6⟩ + obtain ⟨V', E', 𝓑, a1, a2, a3, a4, a5, a6, a7⟩ := hstep + refine ⟨V', E', 𝓐 ∪ 𝓑, a1, h2.trans a2, a3, ?_, h5.union a5, ?_, + subset_union_of_subset_left h7 _, ?_⟩ + · rw [a4, h4, sUnion_union, union_assoc] + · rintro C (hC | hC) + · exact h6 C hC + · exact a6 C hC + · rintro x (rfl | hx) + · exact sUnion_mono subset_union_right a7 + · exact sUnion_mono subset_union_left (h8 hx) + +/-- Adding finitely many lines with distinct ends in a set keeps it connected after removing a +point. -/ +theorem twoConn_add_lines {G : Set S} (hG : TwoConn G) {𝓛 : Set (Set S)} (h𝓛 : 𝓛.Finite) + (hl : ∀ L ∈ 𝓛, ∃ s t, IsLineWithEnds L s t ∧ s ≠ t ∧ s ∈ G ∧ t ∈ G) : TwoConn (G ∪ ⋃₀ 𝓛) := by + induction 𝓛, h𝓛 using Set.Finite.induction_on with + | empty => simpa using hG + | @insert L 𝓛 _ _ ih => + have h1 := ih fun L' hL' ↦ hl L' (mem_insert_of_mem _ hL') + obtain ⟨s, t, hL, hne, hs, ht⟩ := hl L (mem_insert _ _) + have h2 := h1.add_line hL (.inl hs) (.inl ht) hne + rwa [sUnion_insert, union_comm L, ← union_assoc] + +/-- **A dissection of a connected surface whose graph contains a given graph.** The given graph has +to contain the boundary. -/ +theorem exists_dissection_graph (hS : IsSurface S) [ConnectedSpace S] {V₀ : Set S} {E₀ : Set + (Set S)} (hg₀ : IsGraph V₀ E₀) + (hV₀ : V₀ ⊆ ⋃₀ E₀) (hbd : bd S ⊆ ⋃₀ E₀) : + ∃ (V : Set S) (E 𝓕 : Set (Set S)), IsDissection V E 𝓕 ∧ V₀ ⊆ V ∧ ⋃₀ E₀ ⊆ gr V E := by + classical + obtain ⟨V₁, E₁, 𝓐, hg, hV₀₁, hV₁, hE₁, h𝓐, hO𝓐, hcu, hW⟩ := exists_arcs_through hS hg₀ hV₀ hbd + hg₀.fin subset_rfl + have hline : ∀ e ∈ E₀, ∃ u v, u ≠ v ∧ IsLineWithEnds e u v ∧ + u ∈ ⋃₀ 𝓐 ∧ v ∈ ⋃₀ 𝓐 := by + intro e he + obtain ⟨u, v, hne, hl, hend⟩ := hg₀.edge e he + exact ⟨u, v, hne, hl, hW (show u ∈ e ∩ V₀ from hend ▸ .inl rfl).2, + hW (show v ∈ e ∩ V₀ from hend ▸ .inr rfl).2⟩ + obtain ⟨V, E, 𝓕, hd, hVV, hsub⟩ := exists_dissection_with_lines hS hg hV₁ h𝓐 + hg₀.fine hO𝓐 hcu hline (hE₁.trans (union_comm _ _)) + refine ⟨V, E, 𝓕, hd, hV₀₁.trans hVV, ?_⟩ + exact (show ⋃₀ E₀ ⊆ ⋃₀ E₁ from hE₁ ▸ subset_union_left).trans hsub + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FeatureForm.lean b/LeanPool/GraphMinor/GM19/FeatureForm.lean new file mode 100644 index 0000000000..e898ae5f5a --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FeatureForm.lean @@ -0,0 +1,230 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FeatureTile + +/-! +# A word of a surface with given arcs on its cuffs + +Let `Y` be a connected surface whose boundary is a union of arcs that meet only at their ends. The +classification gives `Y` the +word `ew a b c`, and each cuff is one free side of this word. We move each cuff along itself, so +that the free side runs through +the arcs of this cuff in their order around the cuff (`exists_form`). So `Y` with its arcs is +determined by `(a, b, c)` and the +list of arcs of each cuff (`homeo_of_form`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Function GraphMinor.Surface + +universe u + +/-- Arcs in the boundary of `Y` that cover it and meet only at their ends. -/ +structure BoundaryArcs {Y : Type*} [TopologicalSpace Y] {J : Type*} (γ : J → ℝ → Y) : Prop where + cont : ∀ s, ContinuousOn (γ s) (Icc 0 1) + inj : ∀ s, InjOn (γ s) (Icc 0 1) + bd : ∀ s, ∀ u ∈ Icc (0 : ℝ) 1, γ s u ∈ GraphMinor.Surface.bd Y + disj : ∀ s s', ∀ u ∈ Ioo (0 : ℝ) 1, ∀ v ∈ Ioo (0 : ℝ) 1, γ s u = γ s' v → s = s' ∧ u = v + cover : ∀ y ∈ GraphMinor.Surface.bd Y, ∃ s, ∃ u ∈ Icc (0 : ℝ) 1, γ s u = y + +/-- `f` is a word of `Y`, and the lists `L` say which arcs its free sides run through. -/ +structure IsForm {Y : Type*} [TopologicalSpace Y] {J : Type*} (a b c : ℕ) (γ : J → ℝ → Y) + (f : ℕ × ℂ → Y) (L : ℕ → List (J × Bool)) : Prop where + pres : Presents (sW (ew a b c)) f + side : ∀ i < c, ∀ (p : ℕ) (s : J) (e : Bool), (L i)[p]? = some (s, e) → ∀ u ∈ Icc + (0 : ℝ) 1, holeP a b c f i (pos (L i).length p u) = γ s (ofs e u) + all : ∀ s : J, ∃ i < c, ∃ (p : ℕ) (e : Bool), (L i)[p]? = some (s, e) + +variable {Y : Type u} [TopologicalSpace Y] [T2Space Y] {J : Type*} {γ : J → ℝ + → Y} {a b c : ℕ} {f : ℕ × ℂ → Y} + +theorem lt_length_of_get {T : Type*} {l : List T} {p : ℕ} {x : T} (h : l[p]? + = some x) : p < l.length := by + by_contra hc + rw [List.getElem?_eq_none (by omega)] at h + simp at h + +omit [T2Space Y] in +/-- An arc that has a point in a cuff lies in this cuff. -/ +theorem arc_in_cuff (hγ : BoundaryArcs γ) {C : Set Y} (hC : C ∈ cuffs Y) {s : J} {u v : ℝ} + (hu : u ∈ Icc (0 : ℝ) 1) (hv : v ∈ Icc (0 : ℝ) 1) (h : γ s u ∈ C) : γ s v ∈ C := by + obtain ⟨y, hy, rfl⟩ := hC + rw [connectedComponentIn_eq h] + have hp : IsPreconnected (γ s '' Icc 0 1) := isPreconnected_Icc.image _ (hγ.cont s) + have hsub : γ s '' Icc 0 1 ⊆ bd Y := by + rintro _ ⟨w, hw, rfl⟩ + exact hγ.bd s w hw + exact hp.subset_connectedComponentIn (mem_image_of_mem _ hu) hsub (mem_image_of_mem _ hv) + +/-- **Moving the cuffs so that the free sides run through the arcs.** -/ +theorem exists_form [Finite J] (hS : IsSurface Y) (e : Y ≃ₜ SurfaceModel a b c) + (hγ : BoundaryArcs γ) : + ∃ f L, IsForm a b c γ f L ∧ c ≤ Nat.card J ∧ ∀ i < c, (L i).length ≤ Nat.card J := by + classical + obtain ⟨-, f₀, hf₀⟩ := presents_ew a b c + have hf : Presents (sW (ew a b c)) (e.symm ∘ f₀) := presents_comp hf₀ e.symm + set f₁ := e.symm ∘ f₀ with hf₁ + have hcuff := cuffs_eq_holeC hf + set C : ℕ → Set Y := holeC a b c f₁ with hCdef + have hCc : ∀ {i}, i < c → C i ∈ cuffs Y := fun {i} hi ↦ by + rw [hcuff] + exact mem_image_of_mem _ hi + have hloop := fun i (hi : i < c) ↦ hole_loop hf hi + have hex : ∀ i, ∃ (L : List (J × Bool)) (m : ℕ → ℝ → ℝ), i < c → ∃ φ : Circle ≃ₜ + (holeP a b c f₁ i '' Icc 0 1 : Set Y), + (∀ u ∈ Icc (0 : ℝ) 1, (φ (ee u)).1 = holeP a b c f₁ i u) ∧ + 0 < L.length ∧ L.length ≤ Nat.card J ∧ (∀ s, γ s 0 ∈ C i → ∃ p e, L[p]? = some (s, e)) ∧ + (∀ p s e, L[p]? = some (s, e) → γ s 0 ∈ C i) ∧ + (∀ p < L.length, ContinuousOn (m p) (Icc 0 1) ∧ StrictMonoOn (m p) (Icc 0 1)) ∧ + (∀ p s e, L[p]? = some (s, e) → ∀ u ∈ Icc (0 : ℝ) 1, (φ (ee (m p u))).1 = γ s (ofs e u)) ∧ + (∀ p, p + 1 < L.length → m p 1 = m (p + 1) 0) ∧ m (L.length - 1) 1 = m 0 0 + 1 := fun i ↦ by + by_cases hi : i < c + · obtain ⟨h₁, h₂, h₃⟩ := hloop i hi + obtain ⟨φ, hφ⟩ := exists_circle_param h₁ h₂ h₃ + let J' := {s : J // γ s 0 ∈ C i} + have h01 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hin : ∀ s, γ s 0 ∈ C i → ∀ u ∈ Icc (0 : ℝ) 1, γ s u ∈ C i := fun s hs u hu ↦ arc_in_cuff + hγ (hCc hi) h01 hu hs + have hne : Nonempty J' := by + obtain ⟨x, hx⟩ : (C i).Nonempty := ⟨_, 0, h01, rfl⟩ + have hbd : x ∈ bd Y := by + rw [← sUnion_cuffs] + exact ⟨_, hCc hi, hx⟩ + obtain ⟨s, u, hu, rfl⟩ := hγ.cover x hbd + exact ⟨⟨s, arc_in_cuff hγ (hCc hi) hu h01 hx⟩⟩ + obtain ⟨k, sq, fl, m, hk, hsur, hinj, hm, hch, hlast⟩ := exists_cuff_order (J := J') (γ + := fun s ↦ γ s.1) φ (fun s ↦ hγ.cont s.1) (fun s ↦ hγ.inj s.1) + (fun s ↦ hin s.1 s.2) (fun s s' u hu v hv he ↦ by + obtain ⟨h₄, h₅⟩ := hγ.disj s.1 s'.1 u hu v hv he + exact ⟨Subtype.ext h₄, h₅⟩) (fun y hy ↦ by + have hbd : y ∈ bd Y := by + rw [← sUnion_cuffs] + exact ⟨_, hCc hi, hy⟩ + obtain ⟨s, u, hu, rfl⟩ := hγ.cover y hbd + exact ⟨⟨s, arc_in_cuff hγ (hCc hi) hu h01 hy⟩, u, hu, rfl⟩) + have hget : ∀ p s e, ((List.range k).map fun p ↦ ((sq p).1, fl p))[p]? = some (s, e) → p < k + ∧ (sq p).1 = s ∧ fl p = e := by + intro p s e h + rw [List.getElem?_map] at h + by_cases hp : p < k + · simp only [List.getElem?_range hp, Option.map_some, Option.some.injEq, Prod.mk.injEq] at h + exact ⟨hp, h⟩ + · rw [List.getElem?_eq_none (by simpa using hp)] at h + simp at h + refine ⟨(List.range k).map fun p ↦ ((sq p).1, fl p), m, fun _ ↦ ⟨φ, hφ, ?_, ?_, fun s hs ↦ + ?_, fun p s e h ↦ ?_, fun p hp ↦ ?_, fun p s e h u hu ↦ ?_, fun p hp ↦ ?_, ?_⟩⟩ + · simpa using hk + · have h₄ : Injective fun p : Fin k ↦ (sq p).1 := fun p p' he ↦ Fin.ext (hinj p p.2 p' p'.2 + (Subtype.ext he)) + have h₅ := Nat.card_le_card_of_injective _ h₄ + simpa using h₅ + · obtain ⟨p, hp, hq⟩ := hsur ⟨s, hs⟩ + refine ⟨p, fl p, ?_⟩ + rw [List.getElem?_map, List.getElem?_range hp, Option.map_some, hq] + · obtain ⟨-, rfl, -⟩ := hget p s e h + exact (sq p).2 + · exact ⟨(hm p (by simpa using hp)).1, (hm p (by simpa using hp)).2.1⟩ + · obtain ⟨hp, rfl, rfl⟩ := hget p s e h + exact (hm p hp).2.2 u hu + · exact hch p (by simpa using hp) + · simpa using hlast + · exact ⟨[], fun _ _ ↦ 0, fun h ↦ absurd h hi⟩ + choose L m hex using hex + choose φ hφ hL₀ hLc hL₁ hL₂ hm₁ hm₂ hm₃ hm₄ using hex + set τ : ℕ → ℝ → ℝ := fun i ↦ cc (L i).length (m i) with hτ + have hτc : ∀ i (hi : i < c), ContinuousOn (τ i) (Icc 0 1) ∧ StrictMonoOn (τ i) (Icc 0 1) ∧ τ i 1 + = τ i 0 + 1 := fun i hi ↦ by + refine ⟨continuousOn_cc _ _ (hm₃ i hi) (fun p hp ↦ (hm₁ i hi p hp).1) (hL₀ i hi), + strictMonoOn_cc _ _ (hm₃ i hi) (fun p hp ↦ (hm₁ i hi p hp).2) (hL₀ i hi), ?_⟩ + rw [hτ] + simp only + rw [cc_one _ _ (hm₃ i hi), cc_zero, hm₄ i hi] + have hclosed : ∀ i, i < c → IsClosed (C i) := fun i _ ↦ (isCompact_Icc.image_of_continuousOn + (continuousOn_hole hf i)).isClosed + have hstep : ∀ n ≤ c, ∃ g : ℕ × ℂ → Y, Presents (sW (ew a b c)) g ∧ (∀ i (hi : i < c), i < n + → ∀ u ∈ Icc (0 : ℝ) 1, holeP a b c g i u = (φ i hi (ee (τ i u))).1) ∧ + ∀ i, i < c → n ≤ i → ∀ u ∈ Icc (0 : ℝ) 1, holeP a b c g i u = holeP a b c f₁ i u := by + intro n + induction n with + | zero => exact fun _ ↦ ⟨f₁, hf, fun i _ h ↦ absurd h (Nat.not_lt_zero i), fun _ _ _ _ _ ↦ rfl⟩ + | succ n ih => + intro hn + obtain ⟨g, hg, h₁, h₂⟩ := ih (by omega) + have hnc : n < c := hn + let U : Set Y := (⋃ i ∈ {i | i < c ∧ i ≠ n}, C i)ᶜ + have hU : IsOpen U := by + refine isOpen_compl_iff.mpr ?_ + have hfinite : {i | i < c ∧ i ≠ n}.Finite := + (Set.finite_lt_nat c).subset fun _ hi => hi.1 + exact hfinite.isClosed_biUnion fun i hi => hclosed i hi.1 + have hCU : C n ⊆ U := by + intro x hx hx' + obtain ⟨i, hi, hxi⟩ := mem_iUnion₂.mp hx' + exact Set.disjoint_left.mp (disjoint_holeC hf hnc hi.1 hi.2.symm) hx hxi + obtain ⟨hc₁, hc₂, hc₃⟩ := hτc n hnc + obtain ⟨α, hα₁, hα₂⟩ := exists_move_loop hS (hCc hnc) hU hCU (φ n hnc) hc₁ hc₂ hc₃ + have hfix : ∀ i (hi : i < c), i ≠ n → ∀ x ∈ C i, α x = x := fun i hi hne x hx ↦ hα₂ x fun hxU + ↦ hxU (mem_iUnion₂.mpr ⟨i, ⟨hi, hne⟩, hx⟩) + refine ⟨α ∘ g, presents_comp hg α, fun i hi hin u hu ↦ ?_, fun i hi hin u hu ↦ ?_⟩ + · change α (holeP a b c g i u) = _ + rcases Nat.lt_succ_iff_lt_or_eq.mp hin with h₃ | rfl + · rw [h₁ i hi h₃ u hu] + exact hfix i hi (by omega) _ (φ i hi _).2 + · rw [h₂ i hi le_rfl u hu, ← hφ i hi u hu] + exact hα₁ u hu + · change α (holeP a b c g i u) = _ + rw [h₂ i hi (by omega) u hu] + exact hfix i hi (by omega) _ ⟨u, hu, rfl⟩ + obtain ⟨g, hg, h₁, -⟩ := hstep c le_rfl + refine ⟨g, L, ⟨hg, fun i hi p s e' h u hu ↦ ?_, fun s ↦ ?_⟩, ?_, hLc⟩ + · have hp : p < (L i).length := lt_length_of_get h + rw [h₁ i hi hi _ (pos_mem _ _ hu)] + simp only [hτ] + rw [cc_pos _ _ (hm₃ i hi) p hp u hu] + exact hm₂ i hi p s e' h u hu + · have h01 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hb := hγ.bd s 0 h01 + rw [← sUnion_cuffs, hcuff] at hb + obtain ⟨_, ⟨i, hi, rfl⟩, hs⟩ := hb + obtain ⟨p, e', h⟩ := hL₁ i hi s hs + exact ⟨i, hi, p, e', h⟩ + · have hpick : ∀ i : Fin c, ∃ s : J, γ s 0 ∈ C i.1 := fun i ↦ by + obtain ⟨l, t, ht⟩ := List.exists_cons_of_length_pos (hL₀ i.1 i.2) + have h₃ : (L i.1)[0]? = some (l.1, l.2) := by simp [ht] + exact ⟨l.1, hL₂ i.1 i.2 0 _ _ h₃⟩ + choose t ht using hpick + have hinj : Injective t := fun i j he ↦ by + by_contra hne + have h₃ := ht i + rw [he] at h₃ + exact Set.disjoint_left.mp (disjoint_holeC hf i.2 j.2 fun h ↦ hne (Fin.ext h)) h₃ (ht j) + have h₃ := Nat.card_le_card_of_injective _ hinj + simpa using h₃ + +/-- Two surfaces with the same form are homeomorphic, by a map that keeps the arcs. -/ +theorem homeo_of_form {Y' : Type*} [TopologicalSpace Y'] [T2Space Y'] {γ' : J → ℝ → Y'} {f' : ℕ × ℂ + → Y'} {L : ℕ → List (J × Bool)} (h : IsForm a b c γ f L) (h' : IsForm a b c γ' f' L) : + ∃ e : Y ≃ₜ Y', ∀ s, ∀ u ∈ Icc (0 : ℝ) 1, e (γ s u) = γ' s u := by + obtain ⟨e, he⟩ := presents_homeo (finW_sW _) h.pres h'.pres + refine ⟨e, fun s v hv ↦ ?_⟩ + obtain ⟨i, hi, p, b', hg⟩ := h.all s + have hu := ofs_mem (e := b') hv + have h₁ := h.side i hi p s b' hg _ hu + have h₂ := h'.side i hi p s b' hg _ hu + rw [ofs_ofs] at h₁ h₂ + rw [← h₁, ← h₂] + refine he _ ?_ + exact ⟨(ew_mem_dsk a b c).1, (norm_per _ _).le⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FeatureGenus.lean b/LeanPool/GraphMinor/GM19/FeatureGenus.lean new file mode 100644 index 0000000000..5ba09db44a --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FeatureGenus.lean @@ -0,0 +1,398 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FeatureCover + +/-! +# The pieces of a cut surface are no more complicated than the surface + +Let `ψ` map `Y` onto `S`, and suppose that `ψ` is one to one off the boundary of `Y`. A clopen part +`W` of `Y` is a model surface +`Σ(a, b, c)`. Each choice of values in `ℤ/2` on the `2a + b` loops of `W` gives a class on `S`: the +function of the word of `W` +vanishes near the free sides, so it extends over the fibres of `ψ`, and `exists_cocycle_quot` +applies. Different choices give +different classes, because pulling back to `W` recovers the values. So `2a + b` is at most the same +number for `S` +(`genus_le`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Function Metric GraphMinor.Surface + +universe u + +section words + +variable {a b c : ℕ} + +/-- The points of the free sides of the word `ew a b c`. -/ +def freeSet (a b c : ℕ) : Set ℂ := + {z | ∃ i < c, ∃ u ∈ Icc (0 : ℝ) 1, z = per (4 * a + 2 * b + 3 * c + 2) + ((4 * a + 2 * b + 3 * i + 1 : ℕ) + u)} + +/-- A pasting step does not leave the free sides. -/ +theorem stp_free {x y : ℕ × ℂ} (h : Stp (sW (ew a b c)) x y) (hx : x.2 ∈ freeSet a b c) : y.2 ∈ + freeSet a b c := by + obtain ⟨i, j, p, q, k, e, e', u, h1, h2, h3, hu, rfl, rfl⟩ := stp_iff.mp h + obtain ⟨rfl, h4⟩ := sW_get h1 + obtain ⟨rfl, h5⟩ := sW_get h2 + obtain ⟨hp, hl, rfl⟩ := (ew_get_iff _ _ _ _ _ _).mp h4 + obtain ⟨hq, hl', rfl⟩ := (ew_get_iff _ _ _ _ _ _).mp h5 + have hne : p ≠ q := fun he ↦ h3 (by rw [he]) + have htw : q = twin a b c p := (lab_two hp hq (hl.trans hl'.symm)).resolve_left hne.symm + obtain ⟨l, hlc, v, hv, hxv⟩ := hx + rw [spt_ew] at hxv + simp only at hxv + set n := 4 * a + 2 * b + 3 * c + 2 with hn + set r := 4 * a + 2 * b + 3 * l + 1 with hr + have hrn : r + 1 < n := by omega + have hnr : p ≠ r := fun he ↦ by + have : twin a b c p = p := (twin_eq_iff hp).mpr ⟨l, hlc, he⟩ + exact hne (htw.trans this).symm + have hu01 : u ∉ Ioo (0 : ℝ) 1 := fun hi ↦ hnr (side_unique hp (by omega) hi hv hxv).1 + have hv01 : v ∉ Ioo (0 : ℝ) 1 := fun hi ↦ hnr (side_unique (by omega) hp hi hu hxv.symm).1.symm + have hend : ∀ w ∈ Icc (0 : ℝ) 1, w ∉ Ioo (0 : ℝ) 1 → w = 0 ∨ w = 1 := fun w hw hw' ↦ by + by_contra hc + push Not at hc + exact hw' ⟨lt_of_le_of_ne hw.1 (Ne.symm hc.1), lt_of_le_of_ne hw.2 hc.2⟩ + have hkey : ∀ w w' : ℕ, w ≤ n → 1 ≤ w' → w' < n → per n w = per n w' → w = w' := by + intro w w' h₁ h₂ h₃ he + obtain ⟨m, hm⟩ := per_eq (show 0 < n by omega) he + have hm' : (w : ℤ) = w' + m * n := by exact_mod_cast hm + have hn0 : (0 : ℤ) < n := by exact_mod_cast (show 0 < n by omega) + have h₄ : m = 0 := by + have h₅ : m < 1 := by + by_contra hc + have : (n : ℤ) ≤ m * n := by nlinarith + omega + have h₆ : -1 < m := by + by_contra hc + have : m * (n : ℤ) ≤ -1 * n := by nlinarith + omega + omega + subst h₄ + omega + have hcase : ∀ {w w' : ℕ}, (p : ℝ) + u = w → (r : ℝ) + v = w' → w ≤ n → 1 ≤ w' → w' < n → w = w' + := fun {w w'} h₁ h₂ h₃ h₄ h₅ ↦ by + rw [h₁, h₂] at hxv + exact hkey w w' h₃ h₄ h₅ hxv + rw [spt_ew] + simp only + rcases hend u hu hu01 with rfl | rfl <;> rcases hend v hv hv01 with rfl | rfl + · exact absurd (hcase (w := p) (w' := r) (by simp) (by simp) (by omega) (by omega) (by omega)) hnr + · have h₁ : p = r + 1 := + hcase (w := p) (w' := r + 1) (by simp) (by simp) (by omega) (by omega) (by omega) + have hpe : p = 4 * a + 2 * b + 3 * l + 2 := by omega + have htp : twin a b c p = 4 * a + 2 * b + 3 * l := by + subst hpe + unfold twin + rw [ite_eq_right (by omega), ite_eq_right (by omega), ite_eq_left (by omega), ite_eq_right + (by omega), ite_eq_left (by omega)] + omega + have hs₁ : sgn a b c p = false := by + rw [hpe, sgn_t hlc (δ := 2) (by norm_num)] + rfl + have hs₂ : sgn a b c q = true := by + rw [htw, htp] + exact (sgn_t hlc (δ := 0) (by norm_num)).trans rfl + refine ⟨l, hlc, 0, by simp, ?_⟩ + rw [hs₁, hs₂, htw, htp] + congr 1 + norm_num [flp] + · have h₁ : p + 1 = r := + hcase (w := p + 1) (w' := r) (by simp) (by simp) (by omega) (by omega) (by omega) + have hpe : p = 4 * a + 2 * b + 3 * l := by omega + have htp : twin a b c p = 4 * a + 2 * b + 3 * l + 2 := by + subst hpe + unfold twin + rw [ite_eq_right (by omega), ite_eq_right (by omega), ite_eq_left (by omega), ite_eq_left + (by omega)] + have hs₁ : sgn a b c p = true := by + rw [hpe] + exact (sgn_t hlc (δ := 0) (by norm_num)).trans rfl + have hs₂ : sgn a b c q = false := by + rw [htw, htp, sgn_t hlc (δ := 2) (by norm_num)] + rfl + refine ⟨l, hlc, 1, by simp, ?_⟩ + rw [hs₁, hs₂, htw, htp] + congr 1 + norm_num [flp] + ring + · have h₁ : p + 1 = r + 1 := + hcase (w := p + 1) (w' := r + 1) (by simp) (by simp) (by omega) (by omega) (by omega) + exact absurd (by omega) hnr + +/-- Points of the discs pasted to a point of a free side are on the free sides. -/ +theorem prel_free {x y : ℕ × ℂ} (h : PRel (sW (ew a b c)) x y) : x.2 ∈ freeSet a b c ↔ y.2 ∈ + freeSet a b c := by + induction h with + | rel x y hs => exact ⟨stp_free hs, stp_free hs.symm⟩ + | refl _ => exact Iff.rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h₁ h₂ => exact h₁.trans h₂ + +variable {Y : Type*} [TopologicalSpace Y] [T2Space Y] {f : ℕ × ℂ → Y} + +theorem mem_free_of_bd (hf : Presents (sW (ew a b c)) f) {x : ℕ × ℂ} (hx : x ∈ Dsk (sW (ew a b c))) + (hb : f x ∈ bd Y) : x.2 ∈ freeSet a b c := by + have hbd := (surface_of_presents (finW_sW _) (isPaired_ew a b c) hf).2 + rw [hbd] at hb + obtain ⟨_, ⟨i, p, u, hp, hfr, hu, rfl⟩, he⟩ := hb + have hi : i = 0 := by + by_contra hi + simp [sW, hi, nW] at hp + subst hi + rw [sW_zero, ew_length] at hp + obtain ⟨l, hl, rfl⟩ := (twin_eq_iff hp).mp (twin_of_free hp hfr) + have hm : spt (sW (ew a b c)) 0 (4 * a + 2 * b + 3 * l + 1) u ∈ Dsk (sW (ew a b c)) := + spt_mem (by rw [sW_zero, ew_length]; exact hp) u + have hr := (hf.2.2 _ hm _ hx).mp he + refine (prel_free hr).mp ⟨l, hl, u, hu, ?_⟩ + rw [spt_ew] + +/-- Values on the loops only. -/ +noncomputable def loopV (a b : ℕ) (v : Fin (2 * a + b) → ZMod 2) (k : ℕ) : ZMod 2 + := if h : k < 2 * a + b then v ⟨k, h⟩ else 0 + +theorem two_smul_zmod (x : ZMod 2) : (2 : ℕ) • x = 0 := by + revert x + decide + +theorem loopV_zero {v : Fin (2 * a + b) → ZMod 2} {k : ℕ} (h : 2 * a + b ≤ k) : loopV a b v k = 0 + := by + simp [loopV, not_lt.mpr h] + +theorem total_zero (v : Fin (2 * a + b) → ZMod 2) : Sm a b c (loopV a b v) + (4 * a + 2 * b + 3 * c + 2) = 0 := by + rw [Sm_total, two_smul_zmod, Finset.sum_eq_zero fun i _ ↦ loopV_zero (by omega), add_zero] + +/-- The function of the word vanishes on the free sides. -/ +theorem gz_free (v : Fin (2 * a + b) → ZMod 2) {z : ℂ} (hz : z ∈ freeSet a b c) : gz a b c + (loopV a b v) z = 0 := by + obtain ⟨i, hi, u, hu, rfl⟩ := hz + rw [gz_per _ (total_zero v) (by omega) hu, gx] + have h₁ : st a b c (4 * a + 2 * b + 3 * i + 1) = 4 * a + 2 * b + 3 * i + 1 := by + have h₂ : sgn a b c (4 * a + 2 * b + 3 * i + 1) = true := (sgn_t hi (δ := 1) + (by norm_num)).trans rfl + simp [st, h₂] + have h₅ : lv a b c (loopV a b v) (4 * a + 2 * b + 3 * i) = 0 := by + have h₆ := lv_t (a := a) (b := b) (loopV a b v) hi (δ := 0) (by norm_num) + rw [add_zero] at h₆ + rw [h₆, ite_eq_left (by norm_num)] + exact loopV_zero (by omega) + rw [h₁, Sm_succ, Sm_holes _ hi.le, lab_t hi (δ := 1) (by norm_num), h₅] + rw [two_smul_zmod, Finset.sum_eq_zero fun i _ ↦ loopV_zero (by omega)] + have h₃ : loopV a b v (2 * a + b + 2 * i + 1 % 2) = 0 := loopV_zero (by omega) + simp [h₃] + +theorem lval_gz (v : Fin (2 * a + b) → ZMod 2) {k : ℕ} (hk : k ≤ 2 * a + b + 2 * c) : lval a b c + (gz a b c (loopV a b v)) k = loopV a b v k := by + have hr := rep_lt hk (a := a) (b := b) (c := c) + have hV := total_zero (c := c) v + have h₆ : ∀ t : ℝ, t = 0 ∨ t = 1 → gz a b c (loopV a b v) (per (4 * a + 2 * b + 3 * c + 2) + (rep a b c k + ofs (sgn a b c (rep a b c k)) t)) = + gx a b c (loopV a b v) (rep a b c k) (ofs (sgn a b c (rep a b c k)) t) + := fun t ht ↦ gz_per _ hV hr (ofs_mem' ht) + have h₇ := h₆ 0 (.inl rfl) + have h₈ := h₆ 1 (.inr rfl) + rw [per_st] at h₇ + rw [per_en] at h₈ + rw [lval, volt, h₇, h₈, gx, gx, lab_rep hk] + cases sgn a b c (rep a b c k) <;> norm_num [ofs] + +end words + +section main + +variable {S Y : Type u} [TopologicalSpace S] [T2Space S] [TopologicalSpace Y] [T2Space Y] + [CompactSpace Y] + +/-- **The bound on the pieces of a cut surface.** -/ +theorem genus_le {ψ : Y → S} (hψ : Continuous ψ) (hsurj : Surjective ψ) (hfib : ∀ y y', ψ y = ψ y' + → y = y' ∨ (y ∈ bd Y ∧ y' ∈ bd Y)) + (hbd : ∀ y, ψ y ∈ bd S → y ∈ bd Y) {W : Set Y} (hW : IsClopen W) {a b c a₀ b₀ c₀ : ℕ} + (e : W ≃ₜ SurfaceModel a b c) (e₀ : S ≃ₜ SurfaceModel a₀ b₀ c₀) : + 2 * a + b ≤ 2 * a₀ + b₀ := by + classical + obtain ⟨-, f₀, hf₀⟩ := presents_ew a b c + have hf : Presents (sW (ew a b c)) (e.symm ∘ f₀) := presents_comp hf₀ e.symm + set f := e.symm ∘ f₀ with hfd + obtain ⟨-, f₁, hf₁⟩ := presents_ew a₀ b₀ c₀ + have hfS : Presents (sW (ew a₀ b₀ c₀)) (e₀.symm ∘ f₁) := presents_comp hf₁ e₀.symm + let D₁ := Dsk (sW (ew a b c)) + let R : Set Y := Wᶜ + have : CompactSpace D₁ := compactSpace_dsk (finW_sW _) + have : CompactSpace R := isCompact_iff_compactSpace.mp hW.isOpen.isClosed_compl.isCompact + let D := D₁ ⊕ R + have hne : Nonempty D := ⟨.inl ⟨_, ew_mem_dsk a b c⟩⟩ + let Q : D → Y := Sum.elim (fun x ↦ (f x.1).1) fun y ↦ y.1 + have hfc : Continuous fun x : D₁ ↦ f x.1 := hf.1.comp_continuous continuous_subtype_val fun x ↦ + x.2 + have hQ : Continuous Q := (continuous_subtype_val.comp hfc).sumElim continuous_subtype_val + have hF : Continuous (ψ ∘ Q) := hψ.comp hQ + have hQs : Surjective Q := fun y ↦ by + by_cases hy : y ∈ W + · have h₁ : (⟨y, hy⟩ : W) ∈ f '' Dsk (sW (ew a b c)) := hf.2.1 ▸ mem_univ _ + obtain ⟨x, hx, he⟩ := h₁ + exact ⟨.inl ⟨x, hx⟩, congrArg Subtype.val he⟩ + · exact ⟨.inr ⟨y, hy⟩, rfl⟩ + have hFs : Surjective (ψ ∘ Q) := hsurj.comp hQs + let gD : (Fin (2 * a + b) → ZMod 2) → D → ZMod 2 := fun v ↦ Sum.elim (fun x ↦ gz a b c + (loopV a b v) x.1.2) fun _ ↦ 0 + have hg0 : ∀ v x, Q x ∈ bd Y → gD v x = 0 := fun v x hx ↦ by + rcases x with x | x + · have h₁ : f x.1 ∈ bd W := (mem_bd_sub hW.isOpen).mpr hx + exact gz_free v (mem_free_of_bd hf x.2 h₁) + · rfl + have hcl : ∀ v (c' : ZMod 2), IsClosed {p : D × D | (ψ ∘ Q) p.1 = (ψ ∘ Q) p.2 + ∧ gD v p.2 - gD v p.1 = c'} := by + intro v c' + let _ : TopologicalSpace (ZMod 2) := ⊥ + have : DiscreteTopology (ZMod 2) := ⟨rfl⟩ + have hrel := isClosed_covRel (A := ZMod 2) (g := fun x ↦ gz a b c (loopV a b v) x.2) + (finW_sW _) (isPaired_ew a b c) (sideConst_gz (loopV a b v) (total_zero v)) + let B : Set D := Q ⁻¹' bd Y + have hB : IsClosed B := (isClosed_bd Y).preimage hQ + let E₁ : Set (D × D) := {p | p.1 ∈ B ∧ p.2 ∈ B ∧ (ψ ∘ Q) p.1 = (ψ ∘ Q) p.2 ∧ c' = 0} + have hE₁ : IsClosed E₁ := by + by_cases hc : c' = 0 + · have e₁ : E₁ = (B ×ˢ B) ∩ {p | (ψ ∘ Q) p.1 = (ψ ∘ Q) p.2} := by + ext p + simp only [E₁, hc, and_true, mem_inter_iff, mem_prod, mem_ofPred_eq, and_assoc] + rw [e₁] + exact (hB.prod hB).inter (isClosed_eq (hF.comp continuous_fst) (hF.comp continuous_snd)) + · have e₁ : E₁ = ∅ := by + ext p + simp only [E₁, hc, and_false, mem_ofPred_eq, mem_empty_iff_false] + rw [e₁] + exact isClosed_empty + let T : Set (D₁ × D₁) := {p | PRel (sW (ew a b c)) p.1.1 p.2.1 ∧ gz a b c + (loopV a b v) p.2.1.2 - gz a b c (loopV a b v) p.1.1.2 = c'} + have hT : IsClosed T := by + have e₁ : T = (fun p : D₁ × D₁ ↦ (((p.1, 0), (p.2, c')) : (Dsk (sW (ew a b c)) × ZMod 2) × + (Dsk (sW (ew a b c)) × ZMod 2))) ⁻¹' + {p | covRel (sW (ew a b c)) (fun x ↦ gz a b c (loopV a b v) x.2) p.1 p.2} := by + ext p + simp only [T, covRel, mem_ofPred_eq, mem_preimage, add_zero] + refine and_congr_right fun _ ↦ ?_ + constructor + · intro h + rw [← h] + ring + · intro h + have : -gz a b c (loopV a b v) p.1.1.2 = -gz a b c (loopV a b v) p.2.1.2 + c' := h + linear_combination this + rw [e₁] + exact hrel.preimage (by fun_prop) + let E₂ : Set (D × D) := (fun p : D₁ × D₁ ↦ ((Sum.inl p.1, Sum.inl p.2) : D × D)) '' T + have hE₂ : IsClosed E₂ := (IsClosedEmbedding.inl.prodMap IsClosedEmbedding.inl).isClosedMap _ hT + let E₃ : Set (D × D) := {p | p.1 = p.2 ∧ p.1 ∈ range (Sum.inr : R → D) ∧ c' = 0} + have hE₃ : IsClosed E₃ := by + by_cases hc : c' = 0 + · have e₁ : E₃ = {p | p.1 = p.2} ∩ (range (Sum.inr : R → D) ×ˢ univ) := by + ext p + simp only [E₃, hc, and_true, mem_inter_iff, mem_prod, mem_univ] + exact Iff.rfl + rw [e₁] + exact (isClosed_eq continuous_fst continuous_snd).inter + (IsClosedEmbedding.inr.isClosed_range.prod isClosed_univ) + · have e₁ : E₃ = ∅ := by + ext p + simp only [E₃, hc, and_false, mem_ofPred_eq, mem_empty_iff_false] + rw [e₁] + exact isClosed_empty + have heq : {p : D × D | (ψ ∘ Q) p.1 = (ψ ∘ Q) p.2 ∧ gD v p.2 - gD v p.1 = c'} = E₁ ∪ E₂ ∪ E₃ + := by + ext ⟨x, y⟩ + constructor + · rintro ⟨h₁, h₂⟩ + simp only at h₁ h₂ + rcases hfib _ _ h₁ with h₃ | ⟨h₃, h₄⟩ + · rcases x with x | x <;> rcases y with y | y + · have h₄ : f x.1 = f y.1 := Subtype.ext h₃ + exact .inl (.inr ⟨(x, y), ⟨(hf.2.2 _ x.2 _ y.2).mp h₄, h₂⟩, rfl⟩) + · have h₄ : (f x.1).1 = y.1 := h₃ + exact absurd (h₄ ▸ (f x.1).2) y.2 + · have h₄ : x.1 = (f y.1).1 := h₃ + exact absurd (h₄.symm ▸ (f y.1).2) x.2 + · have h₄ : x = y := Subtype.ext h₃ + subst h₄ + exact .inr ⟨rfl, ⟨x, rfl⟩, by simpa using h₂.symm⟩ + · refine .inl (.inl ⟨h₃, h₄, h₁, ?_⟩) + rw [← h₂, hg0 v x h₃, hg0 v y h₄, sub_zero] + · rintro ((⟨h₁, h₂, h₃, h₄⟩ | ⟨⟨x', y'⟩, ⟨h₁, h₂⟩, h₃⟩) | ⟨h₁, ⟨z, h₂⟩, h₃⟩) + · refine ⟨h₃, ?_⟩ + simp only at h₁ h₂ + simp only + rw [hg0 v x h₁, hg0 v y h₂, h₄, sub_zero] + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj h₃ + refine ⟨?_, h₂⟩ + have h₄ : f x'.1 = f y'.1 := (hf.2.2 _ x'.2 _ y'.2).mpr h₁ + exact congrArg (fun z : W ↦ ψ z.1) h₄ + · simp only at h₁ h₂ h₃ + subst h₁ + exact ⟨rfl, by simpa using h₃.symm⟩ + rw [heq] + exact (hE₁.union hE₂).union hE₃ + have hex := fun v ↦ exists_cocycle_quot hF hFs (gD v) (hcl v) + choose φ hφ hN hB using hex + have hBd : ∀ v, BdTriv (φ v) := fun v ↦ hB v fun x hx ↦ hg0 v x (hbd _ hx) + let cl : (Fin (2 * a + b) → ZMod 2) → KCl S (ZMod 2) := fun v ↦ Quotient.mk (kSetoid S + (ZMod 2)) ⟨φ v, hφ v, hBd v⟩ + have hprim : ∀ v, IsPrim (fun x y : W ↦ φ v (ψ x.1) (ψ y.1)) (pmap f) (gz a b c (loopV a b v)) + := fun v ↦ by + obtain ⟨N, hN₁, hN₂⟩ := hN v + have hba : ∀ z ∈ closedBall (0 : ℂ) 1, ((0 : ℕ), z) ∈ Dsk (sW (ew a b c)) + := fun z hz ↦ ⟨(ew_mem_dsk a b c).1, by simpa using hz⟩ + let P : ℂ → D := fun z ↦ if h : z ∈ closedBall (0 : ℂ) 1 then .inl ⟨(0, z), hba z h⟩ else .inl + ⟨(0, 0), hba 0 (by simp)⟩ + have hP : ∀ z (h : z ∈ closedBall (0 : ℂ) 1), P z = .inl ⟨(0, z), hba z h⟩ + := fun z h ↦ by simp only [P, h, dite_eq_left] + have hPc : ContinuousOn P (closedBall 0 1) := by + rw [continuousOn_iff_continuous_domRestrict] + have e₁ : (closedBall (0 : ℂ) 1).domRestrict P = Sum.inl ∘ fun z : closedBall (0 : ℂ) 1 ↦ + (⟨(0, z.1), hba z.1 z.2⟩ : D₁) := by + funext z + exact hP z.1 z.2 + rw [e₁] + refine continuous_inl.comp (Continuous.subtype_mk ?_ _) + fun_prop + obtain ⟨ε, hε, h₁⟩ := exists_eps (isCompact_closedBall 0 1) hPc hN₁ + refine ⟨ε, hε, fun x hx y hy hxy ↦ ?_⟩ + have h₂ := hN₂ _ _ (h₁ x hx y hy hxy) + rw [hP x hx, hP y hy] at h₂ + exact h₂ + have hinj : Injective cl := fun v v' he ↦ by + obtain ⟨h, N, hN₁, hN₂⟩ : CohRel (φ v) (φ v') := Quotient.exact he + have hr : CohRel (fun x y : W ↦ φ v (ψ x.1) (ψ y.1)) (fun x y : W ↦ φ v' (ψ x.1) (ψ y.1)) := by + have hc : Continuous fun x : W ↦ ψ x.1 := hψ.comp continuous_subtype_val + refine ⟨fun x ↦ h (ψ x.1), (fun p : W × W ↦ (ψ p.1.1, ψ p.2.1)) ⁻¹' N, fun x ↦ ?_, + fun x y hxy ↦ hN₂ _ _ hxy⟩ + have hc' : Continuous fun p : W × W ↦ (ψ p.1.1, ψ p.2.1) := (hc.comp continuous_fst).prodMk + (hc.comp continuous_snd) + exact hc'.continuousAt.preimage_mem_nhds (hN₁ _) + funext k + have h₁ := lval_rel hf (hprim v) (hprim v') hr k.2 + rw [lval_gz v (by have := k.2; omega), lval_gz v' (by have := k.2; omega)] at h₁ + simpa [loopV, k.2] using h₁ + have hcard : Nat.card (KCl S (ZMod 2)) = 2 ^ (2 * a₀ + b₀) := by + rw [card_kCl hfS, card_lam_two] + have : Finite (KCl S (ZMod 2)) := Nat.finite_of_card_ne_zero (by rw [hcard]; positivity) + have h₁ := Nat.card_le_card_of_injective _ hinj + rw [hcard, card_fin_fun] at h₁ + exact (Nat.pow_le_pow_iff_right (by norm_num)).mp h₁ + +end main + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FeatureLift.lean b/LeanPool/GraphMinor/GM19/FeatureLift.lean new file mode 100644 index 0000000000..02969f1167 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FeatureLift.lean @@ -0,0 +1,344 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutSimilar + +/-! +# The two lifts of an edge + +Let a surface be presented by the word of a dissection, and cut the word along a set `D` of edges. +An arc that is a chain of +edges of `D`, and that has at each inner vertex only the two ends of its own chain, has two lifts to +the cut surface. Unlike +`LiftPair` we allow the two lifts to meet at the ends of the arc, as they do at a vertex of degree +one. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Function GraphMinor.Surface + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {W : ℕ → List Letter} {f : ℕ × ℂ + → S} {V : Set S} {E : Set (Set S)} + {A : Set S → unitInterval → S} {lab : Set S → ℕ} + +/-- The condition of `WordEdges.vertex_cut` at the end `τ` of the edge `e`. -/ +abbrev EndCase (S : Type u) [TopologicalSpace S] (A : Set S → unitInterval → S) (D : Set (Set S)) + (e : Set S) (τ : Bool) : Prop := + CutEndCondition A D e τ + +variable {Y : Type u} [TopologicalSpace Y] [T2Space Y] {D : Set (Set S)} {g : ℕ × ℂ → Y} {ψ : Y → S} + +section + +variable (h : WordEdges W f V E A lab) (hD : D ⊆ E) (hg : Presents (cutW W (lab '' D)) g) + (hψ : ∀ a ∈ Dsk W, ψ (g a) = f a) +include h hD hg hψ + +omit [T2Space S] [T2Space Y] hD hψ in +/-- The two sides of an edge of `D` are apart inside the edge. -/ +theorem sides_ne {e : Set S} (heD : e ∈ D) {i p j q : ℕ} {e₁ e₂ : Bool} (s : EdgeSides W + (lab e) i p j q e₁ e₂) {t : ℝ} (ht : t ∈ Ioo (0 : ℝ) 1) : + g (spt W i p (ofs e₁ t)) ≠ g (spt W j q (ofs e₂ t)) := by + intro he + have hP' : IsPaired (cutW W (lab '' D)) := isPaired_cut h.paired + have hD' : Dsk (cutW W (lab '' D)) = Dsk W := dsk_cut + have hL0 : lab e ∈ lab '' D := ⟨e, heD, rfl⟩ + have hp := lt_length s.one + have hq := lt_length s.two + have hm1 : spt W i p (ofs e₁ t) ∈ Dsk W := spt_mem hp _ + have hm2 : spt W j q (ofs e₂ t) ∈ Dsk W := spt_mem hq _ + have hpr := (hg.2.2 _ (hD' ▸ hm1) _ (hD' ▸ hm2)).mp he + have hu := ofs_Ioo e₁ ht + have hl' : (cutW W (lab '' D) i)[p]? = some (2 * Nat.pair i p + 1, e₁) + := cut_get_iff.mpr ⟨_, s.one, .inl ⟨hL0, rfl⟩⟩ + have hpr' : PRel (cutW W (lab '' D)) (spt (cutW W (lab '' D)) i p (ofs e₁ t)) (spt W j q + (ofs e₂ t)) := by + rw [spt_cut] + exact hpr + have hfree := freeSide_cut (L := lab '' D) s.one hL0 + have heqs : spt W j q (ofs e₂ t) = spt W i p (ofs e₁ t) := by + rcases hpr'.eq_or_stp hP' hl' hu with h1 | h1 + · rw [h1, spt_cut] + · exfalso + obtain ⟨j', q', e', h2, h3, -⟩ := stp_of_side hP' hl' hu h1 + exact h3 (hfree _ _ _ _ _ hl' h2) + have h1 : j = i := congrArg Prod.fst heqs + subst h1 + have h2 : per (W j).length (q + ofs e₂ t) = per (W j).length (p + ofs e₁ t) + := congrArg Prod.snd heqs + obtain ⟨h3, -⟩ := side_unique hq hp (ofs_Ioo e₂ ht) (ofs_mem ⟨ht.1.le, ht.2.le⟩) h2 + exact s.ne (by rw [h3]) + +omit [T2Space Y] in +/-- What happens at an end of an edge of `D` with `EndCase`: the two sides end at different points, +and these are all the points over the end. -/ +theorem sides_end {e : Set S} (heD : e ∈ D) (hsd : ∀ e ∈ D, ∃ (i p j q : ℕ) + (e₁ e₂ : Bool), EdgeSides W (lab e) i p j q e₁ e₂) {i p j q : ℕ} {e₁ e₂ : Bool} + (s : EdgeSides W (lab e) i p j q e₁ e₂) {τ : Bool} (hc : EndCase S A D e τ) : + g (spt W i p (ofs e₁ (eo τ))) ≠ g (spt W j q (ofs e₂ (eo τ))) ∧ + ∀ y : Y, ψ y = extI (A e) (eo τ) → y = g (spt W i p (ofs e₁ (eo τ))) ∨ y = g (spt W j q + (ofs e₂ (eo τ))) := by + have hD' : Dsk (cutW W (lab '' D)) = Dsk W := dsk_cut + obtain ⟨hv₁, hv₂⟩ := h.vertex_cut hD heD hsd s τ hc + have hspe : spe W (s.end₁ τ) = spt W i p (ofs e₁ (eo τ)) := by + simp only [spe, EdgeSides.end₁, eo_xn] + have hspe' : spe W (s.end₂ τ) = spt W j q (ofs e₂ (eo τ)) := by + simp only [spe, EdgeSides.end₂, eo_xn] + have hm1 : spe W (s.end₁ τ) ∈ Dsk W := spe_mem _ + have hm2 : spe W (s.end₂ τ) ∈ Dsk W := spe_mem _ + refine ⟨fun he ↦ hv₁ ?_, fun y hy ↦ ?_⟩ + · rw [← hspe, ← hspe'] at he + exact (hg.2.2 _ (hD' ▸ hm1) _ (hD' ▸ hm2)).mp he + · obtain ⟨a, ha, rfl⟩ : y ∈ g '' Dsk (cutW W (lab '' D)) := hg.2.1 ▸ mem_univ y + rw [hD'] at ha + rw [hψ a ha] at hy + rcases hv₂ a ha hy with h₁ | h₁ + · left + rw [← hspe] + exact ((hg.2.2 _ (hD' ▸ hm1) _ (hD' ▸ ha)).mpr h₁).symm + · right + rw [← hspe'] + exact ((hg.2.2 _ (hD' ▸ hm2) _ (hD' ▸ ha)).mpr h₁).symm + +end + +/-- A lift of the first `n` pieces of a chain to the two sides. -/ +structure ChainLift (W : ℕ → List Letter) (A : Set S → unitInterval → S) (lab : Set S → ℕ) + (g : ℕ × ℂ → Y) (ψ : Y → S) (a : ℝ → S) (t : ℕ → ℝ) (ss : ℕ → Set S) + (n : ℕ) (ξ η : ℝ → Y) : Prop where + cξ : ContinuousOn ξ (Icc 0 (t n)) + cη : ContinuousOn η (Icc 0 (t n)) + hξ : ∀ u ∈ Icc 0 (t n), ψ (ξ u) = a u + hη : ∀ u ∈ Icc 0 (t n), ψ (η u) = a u + ne : ∀ u ∈ Ioo 0 (t n), ξ u ≠ η u + pieces : ∀ p < n, ∃ (i q j r : ℕ) (e₁ e₂ : Bool), EdgeSides W (lab (ss p)) i q j r e₁ e₂ + ∧ ∀ u ∈ Icc (t p) (t (p + 1)), ∀ w ∈ Icc (0 : ℝ) 1, + extI (A (ss p)) w = a u → ξ u = g (spt W i q (ofs e₁ w)) ∧ η u = g (spt W j r (ofs e₂ w)) + +theorem EdgeSides.swap' {k i p j q : ℕ} {e₁ e₂ : Bool} (s : EdgeSides W k i p j q e₁ e₂) : + EdgeSides W k j q i p e₂ e₁ := + ⟨s.two, s.one, s.ne.symm⟩ + +/-- Two continuous maps that agree at a point make a continuous map. -/ +theorem continuousOn_join {T : Type*} [TopologicalSpace T] {ξ ξ₁ : ℝ → T} {b c : ℝ} (hb : 0 ≤ b) + (h₁ : ContinuousOn ξ (Icc 0 b)) (h₂ : ContinuousOn ξ₁ (Icc b c)) + (he : ξ b = ξ₁ b) (hbc : b ≤ c) : ContinuousOn (fun u ↦ if u ≤ b then ξ u else ξ₁ u) (Icc 0 c) + := by + have e : Icc 0 c = Icc 0 b ∪ Icc b c := (Icc_union_Icc_eq_Icc hb hbc).symm + rw [e] + refine ContinuousOn.union_of_isClosed ?_ ?_ isClosed_Icc isClosed_Icc + · exact h₁.congr fun u hu ↦ ite_eq_left hu.2 + · refine h₂.congr fun u hu ↦ ?_ + by_cases h : u ≤ b + · have : u = b := le_antisymm h hu.1 + subst this + simp only [le_refl, ite_true] + exact he + · exact ite_eq_right_iff.mpr fun h' ↦ absurd h' h + +section + +variable (h : WordEdges W f V E A lab) (hD : D ⊆ E) (hg : Presents (cutW W (lab '' D)) g) + (hψ : ∀ a ∈ Dsk W, ψ (g a) = f a) +include h hD hg hψ + +omit [T2Space Y] in +/-- A piece of a chain, seen through one pair of sides. -/ +theorem piece_lift {x : Set S} (hx : x ∈ D) {i q j r : ℕ} {e₁ e₂ : Bool} (s : EdgeSides W + (lab x) i q j r e₁ e₂) {a : ℝ → S} {b c : ℝ} (hbc : b < c) + (ha : ContinuousOn a (Icc b c)) (hinj : InjOn a (Icc b c)) (him : a '' Icc b c = x) + (hb : ∃ τ, extI (A x) (eo τ) = a b) (hc : ∃ τ, extI (A x) (eo τ) = a c) : + ∃ ξ η : ℝ → Y, ContinuousOn ξ (Icc b c) ∧ ContinuousOn η (Icc b c) ∧ (∀ u ∈ Icc b c, ψ (ξ u) + = a u) ∧ (∀ u ∈ Icc b c, ψ (η u) = a u) ∧ + (∀ u ∈ Ioo b c, ξ u ≠ η u) ∧ ∀ u ∈ Icc b c, ∀ w ∈ Icc (0 : ℝ) 1, extI (A x) w = a u → ξ u = g + (spt W i q (ofs e₁ w)) ∧ η u = g (spt W j r (ofs e₂ w)) := by + have hxE := hD hx + have hD' : Dsk (cutW W (lab '' D)) = Dsk W := dsk_cut + have hcA : ContinuousOn (extI (A x)) (Icc 0 1) := (continuous_extI (h.arc x hxE).1.1).continuousOn + have hiA := extI_injOn (h.arc x hxE).1.2 + have himA : extI (A x) '' Icc 0 1 = x := by rw [image_extI, (h.arc x hxE).2.1] + obtain ⟨θ', hθc, hθl⟩ := exists_inv_of_compactOn isCompact_Icc hcA hiA + rw [himA] at hθc + have hmem : ∀ u ∈ Icc b c, a u ∈ x := fun u hu ↦ him ▸ mem_image_of_mem _ hu + have hex : ∀ u ∈ Icc b c, ∃ w ∈ Icc (0 : ℝ) 1, extI (A x) w = a u := fun u hu ↦ by + have := hmem u hu + rwa [← himA] at this + choose! θ hθ₁ hθ₂ using hex + have hθeq : ∀ u ∈ Icc b c, θ u = θ' (a u) := fun u hu ↦ by + rw [← hθ₂ u hu, hθl (hθ₁ u hu)] + have hθcont : ContinuousOn θ (Icc b c) := (hθc.comp ha (fun u hu ↦ hmem u hu)).congr hθeq + have hp := lt_length s.one + have hq := lt_length s.two + have hcs : ∀ {i p : ℕ} {e : Bool}, p < (W i).length → ContinuousOn (fun u ↦ g (spt W i p (ofs e + (θ u)))) (Icc b c) := fun {i p e} hp ↦ by + have h₁ : ContinuousOn (fun u ↦ spt W i p (ofs e (θ u))) (Icc b c) := + (continuous_spt_ofs W i p e).comp_continuousOn hθcont + exact hg.1.comp h₁ fun u _ ↦ hD' ▸ spt_mem hp _ + have hval : ∀ {i p : ℕ} {e : Bool}, (W i)[p]? = some (lab x, e) → ∀ u ∈ Icc b c, ψ (g (spt W i p + (ofs e (θ u)))) = a u := fun {i p e} he u hu ↦ by + rw [hψ _ (spt_mem (lt_length he) _), h.f_side hxE he (ofs_mem (hθ₁ u hu)), ofs_ofs, hθ₂ u hu] + refine ⟨_, _, hcs hp, hcs hq, hval s.one, hval s.two, fun u hu ↦ ?_, fun u hu w hw he ↦ ?_⟩ + · have hu' : u ∈ Icc b c := ⟨hu.1.le, hu.2.le⟩ + have hend : ∀ {v τ}, v ∈ Icc b c → extI (A x) (eo τ) = a v → u ≠ v → θ u ≠ eo τ + := fun {v τ} hv hτ hne he ↦ by + have h₁ : a u = a v := by rw [← hθ₂ u hu', he, hτ] + exact hne (hinj hu' hv h₁) + have hθu : θ u ∈ Ioo (0 : ℝ) 1 := by + obtain ⟨τ₁, h₁⟩ := hb + obtain ⟨τ₂, h₂⟩ := hc + have n₁ := hend (⟨le_rfl, hbc.le⟩ : b ∈ Icc b c) h₁ hu.1.ne' + have n₂ := hend (⟨hbc.le, le_rfl⟩ : c ∈ Icc b c) h₂ hu.2.ne + have hτ : τ₁ ≠ τ₂ := by + rintro rfl + exact hbc.ne (hinj ⟨le_rfl, hbc.le⟩ ⟨hbc.le, le_rfl⟩ (h₁.symm.trans h₂)) + have hne : θ u ≠ 0 ∧ θ u ≠ 1 := by + cases τ₁ <;> cases τ₂ <;> simp_all [eo] + exact ⟨lt_of_le_of_ne (hθ₁ u hu').1 hne.1.symm, lt_of_le_of_ne (hθ₁ u hu').2 hne.2⟩ + exact sides_ne h hg hx s hθu + · have hw' : w = θ u := by + exact hiA hw (hθ₁ u hu) (he.trans (hθ₂ u hu).symm) + subst hw' + exact ⟨rfl, rfl⟩ + +omit [T2Space Y] in +/-- An arc that is a chain of edges of `D` has two lifts. -/ +theorem exists_chainLift (hsd : ∀ e ∈ D, ∃ (i p j q : ℕ) (e₁ e₂ : Bool), EdgeSides W + (lab e) i p j q e₁ e₂) {a : ℝ → S} + (ha : ContinuousOn a (Icc 0 1)) (hinj : InjOn a (Icc 0 1)) {m : ℕ} {t : ℕ → ℝ} {ss : ℕ + → Set S} {ε : ℕ → Bool} (hm : 0 < m) (ht0 : t 0 = 0) (htm : t m = 1) + (hlt : ∀ p < m, t p < t (p + 1)) (hch : ∀ p < m, ss p ∈ D ∧ a '' Icc (t p) (t (p + 1)) = ss p + ∧ a (t p) = extI (A (ss p)) (if ε p then 0 else 1) ∧ + a (t (p + 1)) = extI (A (ss p)) (if ε p then 1 else 0)) + (hc : ∀ k, 0 < k → k < m → ∀ p < m, ∀ τ, extI (A (ss p)) (eo τ) = a (t k) → EndCase S A D + (ss p) τ) : + ∃ ξ η, ChainLift W A lab g ψ a t ss m ξ η := by + have hmono : ∀ {k k'}, k ≤ k' → k' ≤ m → t k ≤ t k' := fun {k k'} h₁ h₂ ↦ chain_mono' hlt h₁ h₂ + have hI : ∀ k ≤ m, t k ∈ Icc (0 : ℝ) 1 := fun k hk ↦ ⟨ht0 ▸ hmono (Nat.zero_le k) hk, htm ▸ hmono + hk le_rfl⟩ + have hsub : ∀ {p}, p < m → Icc (t p) (t (p + 1)) ⊆ Icc 0 1 := fun {p} hp ↦ Icc_subset_Icc + (hI p hp.le).1 (hI (p + 1) hp).2 + have hend : ∀ {p}, p < m → (∃ τ, extI (A (ss p)) (eo τ) = a (t p)) ∧ ∃ τ, extI (A (ss p)) (eo τ) + = a (t (p + 1)) := fun {p} hp ↦ by + obtain ⟨-, -, h₁, h₂⟩ := hch p hp + refine ⟨⟨!ε p, ?_⟩, ⟨ε p, ?_⟩⟩ + · rw [h₁] + cases ε p <;> simp [eo] + · rw [h₂] + cases ε p <;> simp [eo] + have hpiece : ∀ {p}, p < m → ∀ {i q j r : ℕ} {e₁ e₂ : Bool}, EdgeSides W (lab + (ss p)) i q j r e₁ e₂ → _ := fun {p} hp {i q j r e₁ e₂} s ↦ + piece_lift h hD hg hψ (hch p hp).1 s (hlt p hp) (ha.mono (hsub hp)) (hinj.mono (hsub hp)) + (hch p hp).2.1 (hend hp).1 (hend hp).2 + have key : ∀ n, 1 ≤ n → n ≤ m → ∃ ξ η, ChainLift W A lab g ψ a t ss n ξ η := by + intro n hn + induction n, hn using Nat.le_induction with + | base => + intro hle + obtain ⟨i, q, j, r, e₁, e₂, s⟩ := hsd _ (hch 0 hm).1 + obtain ⟨ξ, η, h₁, h₂, h₃, h₄, h₅, h₆⟩ := hpiece hm s + simp only [zero_add] at h₁ h₂ h₃ h₄ h₅ h₆ + rw [ht0] at h₁ h₂ h₃ h₄ h₅ h₆ + refine ⟨ξ, η, ⟨h₁, h₂, h₃, h₄, h₅, fun p hp ↦ ?_⟩⟩ + obtain rfl : p = 0 := by omega + refine ⟨i, q, j, r, e₁, e₂, s, ?_⟩ + simp only [zero_add] + rw [ht0] + exact h₆ + | succ n hn ih => + intro hle + obtain ⟨ξ, η, hL⟩ := ih (by omega) + have hn₀ : 0 < n := by omega + have hnm : n < m := by omega + obtain ⟨n', rfl⟩ : ∃ n', n = n' + 1 := ⟨n - 1, by omega⟩ + have hn'm : n' < m := by omega + obtain ⟨i₀, q₀, j₀, r₀, e₁₀, e₂₀, s₀, hp₀⟩ := hL.pieces n' (by omega) + obtain ⟨τ₀, hτ₀⟩ := (hend hn'm).2 + obtain ⟨τ₁, hτ₁⟩ := (hend hnm).1 + have hzero : ∀ τ : Bool, eo τ ∈ Icc (0 : ℝ) 1 := fun τ ↦ by cases τ <;> simp [eo] + have ht₁ : t (n' + 1) ∈ Icc (t n') (t (n' + 1)) := ⟨(hlt n' hn'm).le, le_rfl⟩ + obtain ⟨hv₁, hv₂⟩ := hp₀ _ ht₁ _ (hzero τ₀) hτ₀ + have hne₀ := (sides_end h hD hg hψ (hch n' hn'm).1 hsd s₀ (hc (n' + 1) hn₀ hnm n' hn'm τ₀ + hτ₀)).1 + rw [← hv₁, ← hv₂] at hne₀ + obtain ⟨i, q, j, r, e₁, e₂, s⟩ := hsd _ (hch (n' + 1) hnm).1 + have hcase := hc (n' + 1) hn₀ hnm (n' + 1) hnm τ₁ hτ₁ + obtain ⟨hne₁, hall⟩ := sides_end h hD hg hψ (hch (n' + 1) hnm).1 hsd s hcase + have htI : t (n' + 1) ∈ Icc 0 (t (n' + 1)) := ⟨(hI _ hnm.le).1, le_rfl⟩ + have ex : ∃ (i q j r : ℕ) (e₁ e₂ : Bool), EdgeSides W (lab (ss (n' + 1))) i q j r e₁ e₂ ∧ ξ + (t (n' + 1)) = g (spt W i q (ofs e₁ (eo τ₁))) ∧ + η (t (n' + 1)) = g (spt W j r (ofs e₂ (eo τ₁))) := by + rcases hall _ ((hL.hξ _ htI).trans hτ₁.symm) with h₁ | h₁ <;> rcases hall _ + ((hL.hη _ htI).trans hτ₁.symm) with h₂ | h₂ + · exact (hne₀ (h₁.trans h₂.symm)).elim + · exact ⟨i, q, j, r, e₁, e₂, s, h₁, h₂⟩ + · exact ⟨j, r, i, q, e₂, e₁, EdgeSides.swap' s, h₁, h₂⟩ + · exact (hne₀ (h₁.trans h₂.symm)).elim + obtain ⟨i', q', j', r', a₁, a₂, s', hξt, hηt⟩ := ex + obtain ⟨ξ₁, η₁, c₁, c₂, c₃, c₄, c₅, c₆⟩ := hpiece hnm s' + have ht₂ : t (n' + 1) ∈ Icc (t (n' + 1)) (t (n' + 1 + 1)) := ⟨le_rfl, (hlt _ hnm).le⟩ + obtain ⟨hv₃, hv₄⟩ := c₆ _ ht₂ _ (hzero τ₁) hτ₁ + have hb₀ := (hI _ hnm.le).1 + have hstep := (hlt _ hnm).le + refine ⟨fun u ↦ if u ≤ t (n' + 1) then ξ u else ξ₁ u, fun u ↦ if u ≤ t + (n' + 1) then η u else η₁ u, ⟨continuousOn_join hb₀ hL.cξ c₁ (hξt.trans hv₃.symm) hstep, + continuousOn_join hb₀ hL.cη c₂ (hηt.trans hv₄.symm) hstep, ?_, ?_, ?_, ?_⟩⟩ + · intro u hu + by_cases hl : u ≤ t (n' + 1) + · simp only [hl, ite_true] + exact hL.hξ u ⟨hu.1, hl⟩ + · simp only [hl, ite_false] + exact c₃ u ⟨(not_le.1 hl).le, hu.2⟩ + · intro u hu + by_cases hl : u ≤ t (n' + 1) + · simp only [hl, ite_true] + exact hL.hη u ⟨hu.1, hl⟩ + · simp only [hl, ite_false] + exact c₄ u ⟨(not_le.1 hl).le, hu.2⟩ + · intro u hu + by_cases hl : u ≤ t (n' + 1) + · simp only [hl, ite_true] + rcases hl.lt_or_eq with h₁ | h₁ + · exact hL.ne u ⟨hu.1, h₁⟩ + · rw [h₁] + exact hne₀ + · simp only [hl, ite_false] + exact c₅ u ⟨not_le.1 hl, hu.2⟩ + · intro p hp + by_cases hpn : p = n' + 1 + · subst hpn + refine ⟨i', q', j', r', a₁, a₂, s', fun u hu w hw he ↦ ?_⟩ + obtain ⟨h₁, h₂⟩ := c₆ u hu w hw he + by_cases hl : u ≤ t (n' + 1) + · have : u = t (n' + 1) := le_antisymm hl hu.1 + subst this + simp only [le_refl, ite_true] + rw [hξt, hηt] + have hw' : w = eo τ₁ := extI_injOn (h.arc _ (hD (hch _ hnm).1)).1.2 hw (hzero τ₁) + (he.trans hτ₁.symm) + subst hw' + exact ⟨rfl, rfl⟩ + · simp only [hl, ite_false] + exact ⟨h₁, h₂⟩ + · obtain ⟨a₃, a₄, a₅, a₆, a₇, a₈, a₉, a₁₀⟩ := hL.pieces p (by omega) + refine ⟨a₃, a₄, a₅, a₆, a₇, a₈, a₉, fun u hu w hw he ↦ ?_⟩ + have hl : u ≤ t (n' + 1) := hu.2.trans (hmono (by omega) hnm.le) + simp only [hl, ite_true] + exact a₁₀ u hu w hw he + rw [← htm] at * + exact key m hm le_rfl + +end + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FeatureLines.lean b/LeanPool/GraphMinor/GM19/FeatureLines.lean new file mode 100644 index 0000000000..7ce3ce56fb --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FeatureLines.lean @@ -0,0 +1,442 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FeatureOrient +public import LeanPool.GraphMinor.GM19.FeatureCode +public import LeanPool.GraphMinor.GM19.CutDrawing2 +public import LeanPool.GraphMinor.GM11.Walks +public import LeanPool.GraphMinor.GM07.Defs + +/-! +# From a feature to a family of lines + +To count features we cut the surface along each feature, with the boundary. So we turn a feature `K` +in a frame `Φ` into a finite family +of lines. The edges of `K` that are lines are lines of the family, and an edge that is an `O`-arc +gives two lines. The vertices of `Φ` +and of `K` cut the boundary into further lines (`exists_feature_lines`). The number of lines is +bounded in terms of the size of `K`, so we +keep count of the edges while we add points to a graph (`exists_counted_line_graph`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Function Metric GraphMinor.Surface + +local notation "𝕀" => unitInterval + +universe u + +variable {X : Type u} [TopologicalSpace X] + +/-- `IsGraph.add_point`, with a count of the edges. Each new edge lies in an old edge. -/ +theorem exists_add_point_counted [T2Space X] {V : Set X} {E : Set (Set X)} (h : IsGraph V E) + (x : X) : + ∃ E', IsGraph (insert x V) E' ∧ gr (insert x V) E' = insert x (gr V E) ∧ ⋃₀ E ⊆ ⋃₀ E' + ∧ E'.ncard ≤ E.ncard + 1 ∧ + ∀ f ∈ E', ∃ e ∈ E, f ⊆ e := + h.add_point_counted x + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- `L` is a line in the closure of the edge `e`, with ends vertices or `m`, and with all the rest +in `e`. -/ +def GoodEdgeLine (K : Drawing S) (e L : Set S) (m : S) : Prop := + ∃ u v, u ≠ v ∧ IsLineWithEnds L u v ∧ (u ∈ K.V ∨ u = m) ∧ (v ∈ K.V ∨ v = m) ∧ L \ {u, v} ⊆ e ∧ + (m ∈ L → m = u ∨ m = v) + +/-- The closure of an edge of a drawing is the union of two lines. For an edge that is an `O`-arc, +these are its two parts between its +vertex and a point `m` of the edge. -/ +theorem exists_edge_lines (K : Drawing S) {e : Set S} (he : e ∈ K.E) : + ∃ L₁ L₂ m, L₁ ∪ L₂ = closure e ∧ GoodEdgeLine K e L₁ m ∧ GoodEdgeLine K e L₂ m ∧ (L₁ ≠ L₂ + → L₁ ∩ L₂ ⊆ K.V ∪ {m}) ∧ + (m ∈ K.V ∨ m ∈ e) := by + have hcd := K.closure_diff_V he + rcases K.edge_cond e he with ⟨u, v, huv, hcap, hL⟩ | ⟨u, hcap, hF⟩ + · have hu : u ∈ closure e ∩ K.V := hcap ▸ .inl rfl + have hv : v ∈ closure e ∩ K.V := hcap ▸ .inr rfl + have hgood : GoodEdgeLine K e (closure e) u := by + refine ⟨u, v, huv, hL, .inl hu.2, .inl hv.2, ?_, fun _ ↦ .inl rfl⟩ + rintro x ⟨hx, hxn⟩ + rw [← hcd] + exact ⟨hx, fun hxV ↦ hxn (hcap ▸ ⟨hx, hxV⟩)⟩ + exact ⟨_, _, u, union_self _, hgood, hgood, fun h ↦ absurd rfl h, .inl hu.2⟩ + · have hu : u ∈ closure e ∩ K.V := hcap ▸ rfl + obtain ⟨a, b, d, ha, hb, -, hab, -, -⟩ := hF.exists_three + obtain ⟨m, hm, hmu⟩ : ∃ m ∈ closure e, u ≠ m := by + by_cases h : u = a + · exact ⟨b, hb, h ▸ hab⟩ + · exact ⟨a, ha, h⟩ + have hoff : ∀ x, x ∈ closure e → x ≠ u → x ∈ e := fun x hx hxu ↦ by + rw [← hcd] + refine ⟨hx, fun hxV ↦ hxu ?_⟩ + have h1 : x ∈ closure e ∩ K.V := ⟨hx, hxV⟩ + rw [hcap] at h1 + exact h1 + obtain ⟨A, B, hA, hB, hAB, hi⟩ := hF.lines hu.1 hm hmu + have hgood : ∀ L, L ⊆ closure e → IsLineWithEnds L u m → GoodEdgeLine K e L m := fun L hLc hl ↦ + ⟨u, m, hmu, hl, .inl hu.2, .inr rfl, fun x hx ↦ hoff x (hLc hx.1) fun h ↦ hx.2 + (.inl h), fun _ ↦ .inr rfl⟩ + refine ⟨A, B, m, hAB, hgood A (hAB ▸ subset_union_left) hA, hgood B + (hAB ▸ subset_union_right) hB, fun _ ↦ ?_, + .inr (hoff m hm hmu.symm)⟩ + rw [hi] + rintro x (rfl | rfl) + · exact .inl hu.2 + · exact .inr rfl + +/-- A family of lines made from a feature `K` in a frame `Φ`, with a dissection that holds the +lines. -/ +structure FeatureLines (Φ : Frame S) (K : Drawing S) {m : ℕ} (b : Fin m → 𝕀 → S) (inner : Fin m + → Prop) : Prop where + family : IsLineFamily b inner + cuts : ∃ (V : Set S) (E 𝓕 : Set (Set S)), IsDissection V E 𝓕 ∧ (∀ i, b i 0 ∈ V ∧ b i 1 ∈ V) + ∧ ∀ i, range (b i) ⊆ gr V E + eqU : K.U = ⋃ i ∈ {i | inner i}, range (b i) + vertK : ∀ v ∈ K.V, ∃ i, inner i ∧ (b i 0 = v ∨ b i 1 = v) + vertΦ : ∀ v ∈ Φ.V, ∃ i, b i 0 = v ∨ b i 1 = v + border : ∀ x ∈ bd S, ∃ i, ¬ inner i ∧ x ∈ range (b i) + side : ∀ i, ¬ inner i → ∃ s ∈ Φ.sides, range (b i) \ Φ.V ⊆ s + +private theorem feature_half_edges_have_two_marked_ends + {S : Type u} + [TopologicalSpace S] + (Φ : Frame S) + (K : Drawing S) + (m : Set S → S) + (𝓔 : Set (Set S)) + (hgood : ∀ L ∈ 𝓔, ∃ e ∈ Drawing.E K, GoodEdgeLine K e L (m e) ∧ L ⊆ closure e) + (hoffV : ∀ e ∈ Drawing.E K, ∀ x ∈ e, x ∉ K.V) + (hoffb : ∀ e ∈ Drawing.E K, ∀ x ∈ e, x ∉ bd S) + (hoffm : ∀ e ∈ Drawing.E K, ∀ x ∈ e, ∀ e' ∈ Drawing.E K, e' ≠ e → x ≠ m e') + (hmN : ∀ e ∈ Drawing.E K, m e ∈ (Φ.V ∪ K.V ∪ m '' Drawing.E K)) : + ∀ L ∈ 𝓔, ∃ u v, u ≠ v ∧ IsLineWithEnds L u v ∧ L ∩ (Φ.V ∪ K.V ∪ m '' Drawing.E K) = {u, v} := by + let N := Φ.V ∪ K.V ∪ m '' Drawing.E K + intro L hL + obtain ⟨e, he, ⟨u, v, huv, hl, hu, hv, hop, hmm⟩, -⟩ := hgood L hL + have huN : u ∈ N := by + rcases hu with h | h + · exact .inl (.inr h) + · exact h ▸ hmN e he + have hvN : v ∈ N := by + rcases hv with h | h + · exact .inl (.inr h) + · exact h ▸ hmN e he + refine ⟨u, v, huv, hl, Subset.antisymm ?_ ?_⟩ + · rintro x ⟨hxL, hxN⟩ + by_contra hxn + have hxe := hop ⟨hxL, hxn⟩ + rcases hxN with (h | h) | ⟨e', he', rfl⟩ + · exact hoffb e he x hxe (Φ.V_subset h) + · exact hoffV e he x hxe h + · by_cases hee : e' = e + · subst hee + exact hxn (hmm hxL) + · exact hoffm e he _ hxe e' he' hee rfl + · rintro x (rfl | rfl) + · exact ⟨hl.left_mem, huN⟩ + · exact ⟨hl.right_mem, hvN⟩ + +private theorem feature_half_edges_meet_at_marked_points + {S : Type u} + [TopologicalSpace S] + (Φ : Frame S) + (K : Drawing S) + (L₁ : Set S → Set S) + (L₂ : Set S → Set S) + (m : Set S → S) + (hun : ∀ e ∈ Drawing.E K, L₁ e ∪ L₂ e = closure e) + (hne12 : ∀ e ∈ Drawing.E K, L₁ e ≠ L₂ e → L₁ e ∩ L₂ e ⊆ K.V ∪ {m e}) + (𝓔 : Set (Set S)) + (hdec : ∀ L ∈ 𝓔, ∃ e ∈ Drawing.E K, L = L₁ e ∨ L = L₂ e) + (hmN : ∀ e ∈ Drawing.E K, m e ∈ (Φ.V ∪ K.V ∪ m '' Drawing.E K)) : + ∀ L ∈ 𝓔, ∀ L' ∈ 𝓔, L ≠ L' → L ∩ L' ⊆ (Φ.V ∪ K.V ∪ m '' Drawing.E K) := by + let N := Φ.V ∪ K.V ∪ m '' Drawing.E K + intro L hL L' hL' hne x hx + obtain ⟨e, he, h1⟩ := hdec L hL + obtain ⟨e', he', h2⟩ := hdec L' hL' + have hLc : ∀ {A e}, e ∈ K.E → (A = L₁ e ∨ A = L₂ e) → A ⊆ closure e := by + rintro A e he (rfl | rfl) + · exact (hun e he) ▸ subset_union_left + · exact (hun e he) ▸ subset_union_right + by_cases hxV : x ∈ K.V + · exact .inl (.inr hxV) + have hxe : x ∈ e := by + rw [← K.closure_diff_V he] + exact ⟨hLc he h1 hx.1, hxV⟩ + have hxe' : x ∈ e' := by + rw [← K.closure_diff_V he'] + exact ⟨hLc he' h2 hx.2, hxV⟩ + obtain rfl := K.edge_eq_of_mem he he' hxe hxe' + have hin : x ∈ K.V ∪ {m e} → x ∈ N := by + rintro (h5 | h5) + · exact .inl (.inr h5) + · exact h5 ▸ hmN e he + rcases h1 with rfl | rfl <;> rcases h2 with rfl | rfl + · exact absurd rfl hne + · exact hin (hne12 e he hne hx) + · exact hin (hne12 e he hne.symm ⟨hx.2, hx.1⟩) + · exact absurd rfl hne + +private theorem feature_half_edges_meet_boundary_at_marked_points + {S : Type u} + [TopologicalSpace S] + (Φ : Frame S) + (K : Drawing S) + (m : Set S → S) + (𝓔 : Set (Set S)) + (hgood : ∀ L ∈ 𝓔, ∃ e ∈ Drawing.E K, GoodEdgeLine K e L (m e) ∧ L ⊆ closure e) + (hoffb : ∀ e ∈ Drawing.E K, ∀ x ∈ e, x ∉ bd S) + (hmN : ∀ e ∈ Drawing.E K, m e ∈ (Φ.V ∪ K.V ∪ m '' Drawing.E K)) + (hline : ∀ L ∈ 𝓔, ∃ u v, u ≠ v ∧ IsLineWithEnds L u v ∧ L ∩ (Φ.V ∪ K.V ∪ m '' Drawing.E K) = + {u, v}) : + ∀ L ∈ 𝓔, L ∩ bd S ⊆ (Φ.V ∪ K.V ∪ m '' Drawing.E K) := by + let N := Φ.V ∪ K.V ∪ m '' Drawing.E K + rintro L hL x ⟨hxL, hxb⟩ + obtain ⟨u, v, -, -, hi⟩ := hline L hL + obtain ⟨e, he, ⟨u', v', -, hl, hu, hv, hop, -⟩, -⟩ := hgood L hL + by_cases hx : x ∈ ({u', v'} : Set S) + · rcases hx with rfl | rfl + · rcases hu with h | h + · exact .inl (.inr h) + · exact h ▸ hmN e he + · rcases hv with h | h + · exact .inl (.inr h) + · exact h ▸ hmN e he + · exact absurd hxb (hoffb e he x (hop ⟨hxL, hx⟩)) + +private theorem feature_line_family_cardinality_bound + {S : Type u} + [TopologicalSpace S] + (Φ : Frame S) + (B : ℕ) + (K : Drawing S) + (hEf : (Drawing.E K).Finite) + (L₁ : Set S → Set S) + (L₂ : Set S → Set S) + (m : Set S → S) + (E : Set (Set S)) + (hcard : E.ncard ≤ B + (Φ.V ∪ K.V ∪ m '' Drawing.E K).ncard + (L₁ '' Drawing.E K ∪ L₂ '' + Drawing.E K).ncard) : + Nat.card ↑E ≤ B + Φ.V.ncard + K.V.ncard + 3 * (Drawing.E K).ncard := by + let 𝓔 := L₁ '' Drawing.E K ∪ L₂ '' Drawing.E K + let N := Φ.V ∪ K.V ∪ m '' Drawing.E K + rw [Nat.card_coe_set_eq] + change E.ncard ≤ B + N.ncard + 𝓔.ncard at hcard + have h1 : N.ncard ≤ (Φ.V ∪ K.V).ncard + (m '' K.E).ncard := ncard_union_le _ _ + have h2 : (Φ.V ∪ K.V).ncard ≤ Φ.V.ncard + K.V.ncard := ncard_union_le _ _ + have h3 : (m '' K.E).ncard ≤ K.E.ncard := ncard_image_le hEf + have h4 : 𝓔.ncard ≤ (L₁ '' K.E).ncard + (L₂ '' K.E).ncard := ncard_union_le _ _ + have h5 : (L₁ '' K.E).ncard ≤ K.E.ncard := ncard_image_le hEf + have h6 : (L₂ '' K.E).ncard ≤ K.E.ncard := ncard_image_le hEf + omega + +/-- Each feature in `Φ` gives a family of lines, and the number of lines is bounded in terms of the +size of the feature. -/ +theorem exists_feature_lines (hS : IsSurface S) [ConnectedSpace S] (Φ : Frame S) : + ∃ B : ℕ, ∀ K : Drawing S, IsFeature Φ K → ∃ (m : ℕ) (b : Fin m → 𝕀 → S) (inner : Fin m → Prop), + m ≤ B + Φ.V.ncard + K.V.ncard + 3 * K.E.ncard ∧ FeatureLines Φ K b inner := by + classical + obtain ⟨B, hB⟩ := exists_counted_line_graph hS + refine ⟨B, fun K hK ↦ ?_⟩ + have : Nonempty S := inferInstance + have hEf : K.E.Finite := K.finite_edges + have hVf : K.V.Finite := K.finite_V + have hch := fun e (he : e ∈ K.E) ↦ exists_edge_lines K he + choose! L₁ L₂ m hun hg1 hg2 hne12 hm using hch + let 𝓔 : Set (Set S) := L₁ '' K.E ∪ L₂ '' K.E + let N : Set S := Φ.V ∪ K.V ∪ m '' K.E + have hNf : N.Finite := (Φ.finite_V.union hVf).union (hEf.image _) + have h𝓔f : 𝓔.Finite := (hEf.image _).union (hEf.image _) + have hdec : ∀ L ∈ 𝓔, ∃ e ∈ K.E, (L = L₁ e ∨ L = L₂ e) := by + rintro _ (⟨e, he, rfl⟩ | ⟨e, he, rfl⟩) + · exact ⟨e, he, .inl rfl⟩ + · exact ⟨e, he, .inr rfl⟩ + have hgood : ∀ L ∈ 𝓔, ∃ e ∈ K.E, GoodEdgeLine K e L (m e) ∧ L ⊆ closure e := by + intro L hL + obtain ⟨e, he, rfl | rfl⟩ := hdec L hL + · exact ⟨e, he, hg1 e he, (hun e he) ▸ subset_union_left⟩ + · exact ⟨e, he, hg2 e he, (hun e he) ▸ subset_union_right⟩ + have hoffV : ∀ e ∈ K.E, ∀ x ∈ e, x ∉ K.V := fun e he x hx ↦ (he.2.1 hx).2 + have hoffb : ∀ e ∈ K.E, ∀ x ∈ e, x ∉ bd S := fun e he x hx ↦ Set.disjoint_left.mp + (hK.no_border_edges e he) hx + have hoffm : ∀ e ∈ K.E, ∀ x ∈ e, ∀ e' ∈ K.E, e' ≠ e → x ≠ m e' := by + rintro e he x hx e' he' hne rfl + rcases hm e' he' with h | h + · exact hoffV e he _ hx h + · exact hne (K.edge_eq_of_mem he' he h hx) + have hmN : ∀ e ∈ K.E, m e ∈ N := fun e he ↦ .inr ⟨e, he, rfl⟩ + have hline : ∀ L ∈ 𝓔, ∃ u v, u ≠ v ∧ IsLineWithEnds L u v ∧ L ∩ N = {u, v} := by + exact feature_half_edges_have_two_marked_ends (S := S) Φ K m 𝓔 hgood hoffV hoffb hoffm hmN + have hdisj : ∀ L ∈ 𝓔, ∀ L' ∈ 𝓔, L ≠ L' → L ∩ L' ⊆ N := by + exact feature_half_edges_meet_at_marked_points (S := S) Φ K L₁ L₂ m hun hne12 𝓔 hdec hmN + have hbdN : ∀ L ∈ 𝓔, L ∩ bd S ⊆ N := by + exact feature_half_edges_meet_boundary_at_marked_points (S := S) Φ K m 𝓔 hgood hoffb hmN hline + have hcl : ∀ e ∈ K.E, closure e ⊆ ⋃₀ 𝓔 := fun e he x hx ↦ by + rw [← hun e he] at hx + rcases hx with hx | hx + · exact ⟨_, .inl ⟨e, he, rfl⟩, hx⟩ + · exact ⟨_, .inr ⟨e, he, rfl⟩, hx⟩ + have hKV : ∀ v ∈ K.V, ∃ e ∈ K.E, v ∈ closure e := fun v hv ↦ by + obtain ⟨e, he, h⟩ := hK.no_isolated_vertices v hv + exact ⟨e, he, h.1⟩ + have hNs : N ⊆ bd S ∪ ⋃₀ 𝓔 := by + rintro x ((h | h) | ⟨e, he, rfl⟩) + · exact .inl (Φ.V_subset h) + · obtain ⟨e, he, hc⟩ := hKV x h + exact .inr (hcl e he hc) + · rcases hm e he with h | h + · obtain ⟨e', he', hc⟩ := hKV _ h + exact .inr (hcl e' he' hc) + · exact .inr (hcl e he (subset_closure h)) + obtain ⟨V, E, hNV, hg, hV, hUU, h𝓔E, hcard, hnon, hcov⟩ := hB hNf h𝓔f hline hdisj hbdN hNs + have hbE : bd S ⊆ ⋃₀ E := hUU ▸ subset_union_left + obtain ⟨V', E', 𝓕, hd, hVV, hEE⟩ := exists_dissection_graph hS hg hV hbE + have hedge : ∀ e : E, ∃ a : 𝕀 → S, IsArcMap a ∧ range a = e.1 ∧ e.1 ∩ V = {a 0, a 1} := by + rintro ⟨e, he⟩ + obtain ⟨u, v, -, hl, hi⟩ := hg.edge e he + obtain ⟨a, ha, h1, h2, h3⟩ := hl.exists_arc + exact ⟨a, ha, h1, by simp only [hi, h2, h3]⟩ + choose a ha har hai using hedge + have : Finite E := hg.fine.to_subtype + let eqv : Fin (Nat.card E) ≃ E := (Finite.equivFin E).symm + let b : Fin (Nat.card E) → 𝕀 → S := fun i ↦ a (eqv i) + let inner : Fin (Nat.card E) → Prop := fun i ↦ (eqv i).1 ∈ 𝓔 + have hb : ∀ i, IsArcMap (b i) := fun i ↦ ha _ + have hr : ∀ i, range (b i) = (eqv i).1 := fun i ↦ har _ + have hi : ∀ i, (eqv i).1 ∩ V = {b i 0, b i 1} := fun i ↦ hai _ + have hsurj : ∀ e ∈ E, ∃ i, (eqv i).1 = e := fun e he ↦ ⟨eqv.symm ⟨e, he⟩, by rw + [Equiv.apply_symm_apply]⟩ + have hendm : ∀ i (t : 𝕀), b i t ∈ V → t = 0 ∨ t = 1 := fun i t ht ↦ by + have h1 : b i t ∈ (eqv i).1 ∩ V := ⟨hr i ▸ mem_range_self t, ht⟩ + rw [hi] at h1 + rcases h1 with h1 | h1 + · exact .inl ((hb i).2 h1) + · exact .inr ((hb i).2 h1) + have hmemV : ∀ (e : Set S) i, (eqv i).1 = e → ∀ x ∈ e, x ∈ V → b i 0 = x ∨ b i 1 = x := by + rintro e i rfl x hx hxV + have h1 : x ∈ (eqv i).1 ∩ V := ⟨hx, hxV⟩ + rw [hi] at h1 + rcases h1 with h1 | h1 + · exact .inl h1.symm + · exact .inr h1.symm + have hΦV : Φ.V ⊆ V := fun x hx ↦ hNV (.inl (.inl hx)) + have hfam : IsLineFamily b inner := by + refine ⟨hb, ?_, ?_, ?_, ?_⟩ + · intro i j u v hu hv he + rw [extI_of_mem _ hu, extI_of_mem _ hv] at he + by_cases hij : i = j + · subst hij + exact .inl ⟨rfl, congrArg Subtype.val ((hb i).2 he)⟩ + · right + have hne : (eqv i).1 ≠ (eqv j).1 := fun h ↦ hij (eqv.injective (Subtype.ext h)) + have hx : b i ⟨u, hu⟩ ∈ V := hg.disj _ (eqv i).2 _ (eqv j).2 hne + ⟨hr i ▸ mem_range_self _, by rw [he]; exact hr j ▸ mem_range_self _⟩ + have hx' : b j ⟨v, hv⟩ ∈ V := he ▸ hx + refine ⟨?_, ?_⟩ + · rcases hendm i _ hx with h | h + · exact .inl (congrArg Subtype.val h) + · exact .inr (congrArg Subtype.val h) + · rcases hendm j _ hx' with h | h + · exact .inl (congrArg Subtype.val h) + · exact .inr (congrArg Subtype.val h) + · intro i hin u hu hbd + have hu' : u ∈ Icc (0 : ℝ) 1 := Ioo_subset_Icc_self hu + rw [extI_of_mem _ hu'] at hbd + have hx : b i ⟨u, hu'⟩ ∈ V := hNV (hbdN _ hin ⟨hr i ▸ mem_range_self _, hbd⟩) + rcases hendm i _ hx with h | h + · exact hu.1.ne' (congrArg Subtype.val h) + · exact hu.2.ne (congrArg Subtype.val h) + · intro i hin u hu + rw [extI_of_mem _ hu] + exact hnon _ (eqv i).2 hin (hr i ▸ mem_range_self _) + · intro x hx + obtain ⟨e, he, hxe⟩ := hbE hx + obtain ⟨i, rfl⟩ := hsurj e he + exact ⟨i, hr i ▸ hxe⟩ + have hbound : Nat.card E ≤ B + Φ.V.ncard + K.V.ncard + 3 * K.E.ncard := by + exact feature_line_family_cardinality_bound (S := S) Φ B K hEf L₁ L₂ m E hcard + refine ⟨_, b, inner, hbound, hfam, ⟨V', E', 𝓕, hd, fun i ↦ ?_, fun i ↦ ?_⟩, ?_, ?_, ?_, ?_, ?_⟩ + · have h0 : b i 0 ∈ (eqv i).1 ∩ V := hi i ▸ .inl rfl + have h1 : b i 1 ∈ (eqv i).1 ∩ V := hi i ▸ .inr rfl + exact ⟨hVV h0.2, hVV h1.2⟩ + · rw [hr] + exact (subset_sUnion_of_mem (eqv i).2).trans hEE + · apply Subset.antisymm + · intro x hx + rw [K.U_eq] at hx + have hin : x ∈ ⋃₀ 𝓔 := by + rcases hx with hx | hx + · obtain ⟨e, he, hc⟩ := hKV x hx + exact hcl e he hc + · obtain ⟨e, he, hc⟩ := mem_iUnion₂.mp hx + exact hcl e he hc + obtain ⟨L, hL, hxL⟩ := hin + obtain ⟨i, hie⟩ := hsurj L (h𝓔E hL) + refine mem_biUnion (show i ∈ {i | inner i} from ?_) (by rw [hr, hie]; exact hxL) + change (eqv i).1 ∈ 𝓔 + rw [hie] + exact hL + · refine iUnion₂_subset fun i hin ↦ ?_ + rw [hr] + obtain ⟨e, he, -, hLc⟩ := hgood _ hin + exact hLc.trans (K.closure_subset_U he) + · intro v hv + obtain ⟨e, he, hc⟩ := hKV v hv + have hvin := hcl e he hc + obtain ⟨L, hL, hxL⟩ := hvin + obtain ⟨i, hie⟩ := hsurj L (h𝓔E hL) + refine ⟨i, ?_, hmemV L i hie v hxL (hNV (.inl (.inr hv)))⟩ + change (eqv i).1 ∈ 𝓔 + rw [hie] + exact hL + · intro v hv + obtain ⟨e, he, hxe⟩ := hbE (Φ.V_subset hv) + obtain ⟨i, hie⟩ := hsurj e he + exact ⟨i, hmemV e i hie v hxe (hΦV hv)⟩ + · intro x hx + obtain ⟨e, he, hne, hxe⟩ := hcov x hx + obtain ⟨i, rfl⟩ := hsurj e he + exact ⟨i, hne, hr i ▸ hxe⟩ + · intro i hin + have h12 : (1 / 2 : ℝ) ∈ Icc (0 : ℝ) 1 := by norm_num + have hcon : Continuous (extI (b i)) := continuous_extI (hb i).1 + have hoffE : ∀ u ∈ Ioo (0 : ℝ) 1, extI (b i) u ∉ Φ.V := fun u hu hx ↦ by + have hu' := Ioo_subset_Icc_self hu + rw [extI_of_mem _ hu'] at hx + rcases hendm i _ (hΦV hx) with h | h + · exact hu.1.ne' (congrArg Subtype.val h) + · exact hu.2.ne (congrArg Subtype.val h) + let J : Set ℝ := {u | u ∈ Icc (0 : ℝ) 1 ∧ extI (b i) u ∉ Φ.V} + have hJ : J.OrdConnected := by + refine ⟨fun x hx y hy z hz ↦ ?_⟩ + by_cases hzx : z = x + · exact hzx ▸ hx + by_cases hzy : z = y + · exact hzy ▸ hy + have h0 : 0 < z := lt_of_le_of_lt hx.1.1 (lt_of_le_of_ne hz.1 (Ne.symm hzx)) + have h1 : z < 1 := lt_of_lt_of_le (lt_of_le_of_ne hz.2 hzy) hy.1.2 + exact ⟨⟨h0.le, h1.le⟩, hoffE z ⟨h0, h1⟩⟩ + have hJne : J.Nonempty := ⟨1 / 2, h12, hoffE _ (by norm_num)⟩ + have hpc : IsPathConnected (extI (b i) '' J) := (hJ.convex.isPathConnected hJne).image hcon + have hsub : extI (b i) '' J ⊆ bd S \ Φ.V := by + rintro _ ⟨u, hu, rfl⟩ + refine ⟨?_, hu.2⟩ + rw [extI_of_mem _ hu.1] + exact hnon _ (eqv i).2 hin (hr i ▸ mem_range_self _) + have hx₀ : extI (b i) (1 / 2) ∈ extI (b i) '' J := ⟨1 / 2, ⟨h12, hoffE _ (by norm_num)⟩, rfl⟩ + refine ⟨_, Surface.mem_arcComponentsIn_of_mem (hsub hx₀), ?_⟩ + rintro _ ⟨⟨t, rfl⟩, hx⟩ + exact hpc.subset_pathComponentIn hx₀ hsub ⟨t, ⟨t.2, by rwa [extI_coe]⟩, extI_coe _ _⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FeatureOrient.lean b/LeanPool/GraphMinor/GM19/FeatureOrient.lean new file mode 100644 index 0000000000..1108fb5d46 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FeatureOrient.lean @@ -0,0 +1,698 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section4b +public import LeanPool.GraphMinor.GM19.CircleLift +public import LeanPool.GraphMinor.GM19.FeatureDissect +public import LeanPool.GraphMinor.GM17.PasteCuff + +/-! +# Two orientations of a connected surface are equal or opposite + +A homeomorphism of a connected surface either keeps every orientation or reverses every orientation. +This costs at most a factor of +two in (5.2). A homeomorphism of the circle keeps all cyclic orders or reverses all of them, so two +orientations are equal or opposite on +each closed disc (`disc_sign`). Two nested discs with three common boundary points have the same +sign (`sign_of_common`). A disc inside +the interior of another is compared by a chord that runs along its boundary (`sign_of_inner`). Then +the discs with sign plus and the +discs with sign minus split the interior of the surface into two open sets, and this interior is +connected (`isPreconnected_compl_bd`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Function Metric GraphMinor.Surface + +universe u + +local notation "𝕀" => unitInterval + +theorem circle_angle_unique {s t : ℝ} (hs0 : 0 < s) (hs1 : s < 2 * Real.pi) (ht0 : 0 < t) + (ht1 : t < 2 * Real.pi) + (h : Circle.exp s = Circle.exp t) : s = t := + CircleOrder.exp_eq_of_angles hs0 hs1 ht0 ht1 h + +theorem cyclic_not_swap {a b c : Circle} (h : CircleCyclic a b c) : ¬ CircleCyclic a c b := + CircleOrder.not_circleCyclic_both h + +/-- The cyclic order after a lift that goes up. -/ +theorem cyclic_of_mono {τ : Circle ≃ₜ Circle} {L : ℝ → ℝ} (hc : Continuous L) (hm : StrictMono L) + (hl : ∀ t, τ (Circle.exp t) = Circle.exp (L t)) {a b c : Circle} (h : CircleCyclic a b c) : + CircleCyclic (τ a) (τ b) (τ c) := + CircleCyclic.map_increasing_lift hc hm hl h + +/-- The cyclic order after a lift that goes down. -/ +theorem cyclic_of_anti {τ : Circle ≃ₜ Circle} {L : ℝ → ℝ} (hc : Continuous L) (hm : StrictAnti L) + (hl : ∀ t, τ (Circle.exp t) = Circle.exp (L t)) {a b c : Circle} (h : CircleCyclic a b c) : + CircleCyclic (τ a) (τ c) (τ b) := + CircleCyclic.map_decreasing_lift hc hm hl h + +/-- A homeomorphism of the circle keeps all cyclic orders or reverses all of them. -/ +theorem circle_dichotomy (τ : Circle ≃ₜ Circle) : + (∀ a b c : Circle, a ≠ b → b ≠ c → a ≠ c → (CircleCyclic (τ a) (τ b) + (τ c) ↔ CircleCyclic a b c)) ∨ + ∀ a b c : Circle, a ≠ b → b ≠ c → a ≠ c → (CircleCyclic (τ a) (τ b) + (τ c) ↔ ¬ CircleCyclic a b c) := by + rcases circleCyclic_homeomorph τ with h | h + · exact .inl fun a b c hab hbc hac ↦ (h a b c hab hbc hac).symm + · refine .inr fun a b c hab hbc hac ↦ (h a c b hac hbc.symm hab).symm.trans ?_ + exact ⟨fun h' h'' ↦ CircleOrder.not_circleCyclic_both h'' h', + fun h' ↦ (circleCyclic_or hab hac hbc).resolve_left h'⟩ + +variable {S : Type u} [TopologicalSpace S] + +/-- The orientations `ω` and `ω'` agree on the closed disc `Δ`. -/ +def SignSame (ω ω' : SurfaceOrientation S) (Δ : Set S) : Prop := + ∀ a b c : S, a ∈ discBd Δ → b ∈ discBd Δ → c ∈ discBd Δ → a ≠ b → b ≠ c → a ≠ c → + (ω'.pos Δ a b c ↔ ω.pos Δ a b c) + +/-- The orientations `ω` and `ω'` are opposite on the closed disc `Δ`. -/ +def SignOpp (ω ω' : SurfaceOrientation S) (Δ : Set S) : Prop := + ∀ a b c : S, a ∈ discBd Δ → b ∈ discBd Δ → c ∈ discBd Δ → a ≠ b → b ≠ c → a ≠ c → + (ω'.pos Δ a b c ↔ ¬ ω.pos Δ a b c) + +variable [T2Space S] + +/-- Two orientations are equal or opposite on each closed disc. -/ +theorem disc_sign (ω ω' : SurfaceOrientation S) {Δ : Set S} (hΔ : IsClosedDisc Δ) : SignSame ω ω' Δ + ∨ SignOpp ω ω' Δ := by + obtain ⟨φ, hφc, hφi, hφr, hφ⟩ := ω.isDirection Δ hΔ + obtain ⟨φ', hφc', hφi', hφr', hφ'⟩ := ω'.isDirection Δ hΔ + have he := (hφc.isClosedEmbedding hφi).isEmbedding + have he' := (hφc'.isClosedEmbedding hφi').isEmbedding + let τ : Circle ≃ₜ Circle := he.toHomeomorph.trans ((Homeomorph.setCongr + (hφr.trans hφr'.symm)).trans he'.toHomeomorph.symm) + have hτ : ∀ z, φ' (τ z) = φ z := fun z ↦ by + have := congrArg Subtype.val (he'.toHomeomorph.apply_symm_apply ((Homeomorph.setCongr + (hφr.trans hφr'.symm)) (he.toHomeomorph z))) + exact this + have hpar : ∀ x ∈ discBd Δ, ∃ z, φ z = x := fun x hx ↦ by + rw [← hφr] at hx + exact hx + have key : ∀ a b c : Circle, a ≠ b → b ≠ c → a ≠ c → (ω'.pos Δ (φ a) (φ b) (φ c) ↔ CircleCyclic + (τ a) (τ b) (τ c)) := by + intro a b c hab hbc hac + rw [← hτ, ← hτ, ← hτ] + exact hφ' _ _ _ (τ.injective.ne hab) (τ.injective.ne hbc) (τ.injective.ne hac) + rcases circle_dichotomy τ with h | h + · left + intro a b c ha hb hc hab hbc hac + obtain ⟨a, rfl⟩ := hpar a ha + obtain ⟨b, rfl⟩ := hpar b hb + obtain ⟨c, rfl⟩ := hpar c hc + have h1 : a ≠ b := fun h' ↦ hab (by rw [h']) + have h2 : b ≠ c := fun h' ↦ hbc (by rw [h']) + have h3 : a ≠ c := fun h' ↦ hac (by rw [h']) + rw [key a b c h1 h2 h3, h a b c h1 h2 h3, hφ a b c h1 h2 h3] + · right + intro a b c ha hb hc hab hbc hac + obtain ⟨a, rfl⟩ := hpar a ha + obtain ⟨b, rfl⟩ := hpar b hb + obtain ⟨c, rfl⟩ := hpar c hc + have h1 : a ≠ b := fun h' ↦ hab (by rw [h']) + have h2 : b ≠ c := fun h' ↦ hbc (by rw [h']) + have h3 : a ≠ c := fun h' ↦ hac (by rw [h']) + rw [key a b c h1 h2 h3, h a b c h1 h2 h3, hφ a b c h1 h2 h3] + +/-- Two nested closed discs with three common boundary points have the same sign. -/ +theorem sign_of_common (ω ω' : SurfaceOrientation S) {Δ₁ Δ₂ : Set S} (h₁ : IsClosedDisc Δ₁) + (h₂ : IsClosedDisc Δ₂) (hs : Δ₁ ⊆ Δ₂) + {a b c : S} (ha : a ∈ discBd Δ₁ ∩ discBd Δ₂) (hb : b ∈ discBd Δ₁ ∩ discBd Δ₂) + (hc : c ∈ discBd Δ₁ ∩ discBd Δ₂) + (hab : a ≠ b) (hbc : b ≠ c) (hac : a ≠ c) : + (SignSame ω ω' Δ₁ ↔ SignSame ω ω' Δ₂) ∧ (SignOpp ω ω' Δ₁ ↔ SignOpp ω ω' Δ₂) := by + have e1 := ω.agree Δ₁ Δ₂ h₁ h₂ hs a b c ha hb hc hab hbc hac + have e2 := ω'.agree Δ₁ Δ₂ h₁ h₂ hs a b c ha hb hc hab hbc hac + refine ⟨⟨fun h ↦ ?_, fun h ↦ ?_⟩, ⟨fun h ↦ ?_, fun h ↦ ?_⟩⟩ + · rcases disc_sign ω ω' h₂ with h' | h' + · exact h' + · have := h a b c ha.1 hb.1 hc.1 hab hbc hac + have := h' a b c ha.2 hb.2 hc.2 hab hbc hac + tauto + · rcases disc_sign ω ω' h₁ with h' | h' + · exact h' + · have := h a b c ha.2 hb.2 hc.2 hab hbc hac + have := h' a b c ha.1 hb.1 hc.1 hab hbc hac + tauto + · rcases disc_sign ω ω' h₂ with h' | h' + · have := h a b c ha.1 hb.1 hc.1 hab hbc hac + have := h' a b c ha.2 hb.2 hc.2 hab hbc hac + tauto + · exact h' + · rcases disc_sign ω ω' h₁ with h' | h' + · have := h a b c ha.2 hb.2 hc.2 hab hbc hac + have := h' a b c ha.1 hb.1 hc.1 hab hbc hac + tauto + · exact h' + +/-- A chord cuts a closed disc into two closed discs with the sign of the disc. -/ +theorem chord_sign (ω ω' : SurfaceOrientation S) {Δ F : Set S} {s t : S} (hΔ : IsClosedDisc Δ) + (hF : F ⊆ Δ) (hst : s ≠ t) + (hl : IsLineWithEnds F s t) (hm : F ∩ discBd Δ = {s, t}) : + ∃ Δ₁ Δ₂ : Set S, IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ Δ₁ ∪ Δ₂ = Δ ∧ Δ₁ ∩ Δ₂ = F ∧ F ⊆ discBd Δ₁ + ∧ F ⊆ discBd Δ₂ ∧ + componentsIn (Δ \ F) = {Δ₁ \ F, Δ₂ \ F} ∧ (Δ₁ \ F).Nonempty ∧ (Δ₂ \ F).Nonempty ∧ + ((SignSame ω ω' Δ₁ ↔ SignSame ω ω' Δ) ∧ (SignOpp ω ω' Δ₁ ↔ SignOpp ω ω' Δ)) ∧ + ((SignSame ω ω' Δ₂ ↔ SignSame ω ω' Δ) ∧ (SignOpp ω ω' Δ₂ ↔ SignOpp ω ω' Δ)) := by + obtain ⟨A₁, A₂, Δ₁, Δ₂, hA, hc, d1, d2, hu, hi, b1, b2, hc2⟩ := disc_iArc Δ F s t hΔ hF hst hl hm + have hs : s ∈ F ∩ discBd Δ := hm ▸ .inl rfl + have ht : t ∈ F ∩ discBd Δ := hm ▸ .inr rfl + have hA₁ : A₁ ∈ componentsIn (discBd Δ \ {s, t}) := hc ▸ .inl rfl + have hA₂ : A₂ ∈ componentsIn (discBd Δ \ {s, t}) := hc ▸ .inr rfl + have part : ∀ {A G : Set S}, A ∈ componentsIn (discBd Δ \ {s, t}) → IsClosedDisc G → G ⊆ Δ + → discBd G = A ∪ F → + (G \ F).Nonempty ∧ ((SignSame ω ω' G ↔ SignSame ω ω' Δ) ∧ (SignOpp ω ω' G ↔ SignOpp ω ω' Δ)) + := by + intro A G hA hG hGΔ hb + obtain ⟨y, hy, rfl⟩ := hA + have hyA := mem_connectedComponentIn hy + have hbG : discBd G ⊆ G := Subtype.coe_image_subset _ _ + have hyb : y ∈ discBd G := hb ▸ .inl hyA + have hyF : y ∉ F := fun h' ↦ hy.2 (hm ▸ ⟨h', hy.1⟩) + refine ⟨⟨y, hbG hyb, hyF⟩, ?_⟩ + have hsb : s ∈ discBd G := hb ▸ .inr hs.1 + have htb : t ∈ discBd G := hb ▸ .inr ht.1 + exact sign_of_common ω ω' hG hΔ hGΔ ⟨hsb, hs.2⟩ ⟨htb, ht.2⟩ ⟨hyb, + hy.1⟩ hst (fun h' ↦ hy.2 (.inr h'.symm)) (fun h' ↦ hy.2 (.inl h'.symm)) + have p1 := part hA₁ d1 (hu ▸ subset_union_left) b1 + have p2 := part hA₂ d2 (hu ▸ subset_union_right) b2 + exact ⟨Δ₁, Δ₂, d1, d2, hu, hi, b1 ▸ subset_union_right, b2 ▸ subset_union_right, hc2, p1.1, + p2.1, p1.2, p2.2⟩ + +/-- A closed disc inside the interior of a closed disc has the sign of the larger disc. Straight +chords through the two discs +in the model of `exists_disc_collar` give half discs that are nested and share a boundary segment. +-/ +theorem sign_of_inner (ω ω' : SurfaceOrientation S) {D Δ : Set S} (hD : IsClosedDisc D) + (hΔ : IsClosedDisc Δ) + (hin : D ⊆ Δ \ discBd Δ) : + (SignSame ω ω' D ↔ SignSame ω ω' Δ) ∧ (SignOpp ω ω' D ↔ SignOpp ω ω' Δ) := by + obtain ⟨p⟩ := hD.isOArc_discBd + obtain ⟨c, c', hc, hc', hm, hm', hl, hr, hD1, hbd, hp⟩ := exists_disc_collar hD hΔ hin p + have hcinj : InjOn c (closedBall 0 2) := hl.injOn + have hb1 : closedBall (0 : ℂ) 1 ⊆ closedBall 0 2 := closedBall_subset_closedBall (by norm_num) + have hbdD : discBd D = c '' sphere 0 1 := by + apply Subset.antisymm + · intro x hx + refine ⟨(p.symm ⟨x, hx⟩ : Circle), by simp, ?_⟩ + rw [hp] + simp + · rintro _ ⟨z, hz, rfl⟩ + have hw := hp ⟨z, hz⟩ + simp only at hw + rw [hw] + exact (p _).2 + have hline : ∀ r : ℝ, 0 < r → r ≤ 2 → ∃ F : Set S, F = c '' {z : ℂ | z.im = 0 ∧ |z.re| ≤ r} + ∧ IsLineWithEnds F (c ((-r : ℝ) : ℂ)) (c ((r : ℝ) : ℂ)) := by + intro r hr0 hr2 + let a : 𝕀 → ℂ := fun u ↦ (((2 * (u : ℝ) - 1) * r : ℝ) : ℂ) + have hab : ∀ u, ‖a u‖ ≤ 2 := fun u ↦ by + simp only [a, Complex.norm_real, Real.norm_eq_abs, abs_mul] + have h1 : |2 * (u : ℝ) - 1| ≤ 1 := abs_le.mpr ⟨by linarith [u.2.1], by linarith [u.2.2]⟩ + rw [abs_of_pos hr0] + nlinarith [abs_nonneg (2 * (u : ℝ) - 1)] + have hac : Continuous a := by + simp only [a] + fun_prop + have hmem : ∀ u, a u ∈ closedBall (0 : ℂ) 2 := fun u ↦ mem_closedBall_zero_iff.mpr (hab u) + have harc : IsArcMap (c ∘ a) := by + refine ⟨hc.comp_continuous hac hmem, fun u v h' ↦ ?_⟩ + have h2 := hcinj (hmem u) (hmem v) h' + have h3 : (2 * (u : ℝ) - 1) * r = (2 * (v : ℝ) - 1) * r := Complex.ofReal_injective h2 + have h4 := mul_right_cancel₀ hr0.ne' h3 + exact Subtype.ext (by linarith) + have hl' := harc.isLineWithEnds + have e0 : (c ∘ a) 0 = c ((-r : ℝ) : ℂ) := by simp [a] + have e1 : (c ∘ a) 1 = c ((r : ℝ) : ℂ) := by + change c (((2 * ((1 : 𝕀) : ℝ) - 1) * r : ℝ) : ℂ) = _ + congr 2 + change (2 * (1 : ℝ) - 1) * r = r + ring + rw [e0, e1] at hl' + refine ⟨range (c ∘ a), ?_, hl'⟩ + rw [range_comp] + congr 1 + ext z + constructor + · rintro ⟨u, rfl⟩ + simp only [a, mem_ofPred_eq, Complex.ofReal_re, Complex.ofReal_im, true_and, abs_mul] + have h1 : |2 * (u : ℝ) - 1| ≤ 1 := abs_le.mpr ⟨by linarith [u.2.1], by linarith [u.2.2]⟩ + rw [abs_of_pos hr0] + nlinarith [abs_nonneg (2 * (u : ℝ) - 1)] + · rintro ⟨h1, h2⟩ + obtain ⟨h3, h4⟩ := abs_le.mp h2 + refine ⟨⟨(z.re / r + 1) / 2, ?_, ?_⟩, ?_⟩ + · have : -1 ≤ z.re / r := by rw [le_div_iff₀ hr0]; linarith + linarith + · have : z.re / r ≤ 1 := by rw [div_le_iff₀ hr0]; linarith + linarith + · apply Complex.ext + · simp only [a, Complex.ofReal_re] + field_simp + ring + · simp [a, h1] + have hnorm : ∀ z : ℂ, z.im = 0 → ‖z‖ = |z.re| := fun z hz ↦ by + have : z = (z.re : ℂ) := Complex.ext rfl (by simp [hz]) + rw [this] + simp + have hRb : ∀ r : ℝ, r ≤ 2 → {z : ℂ | z.im = 0 ∧ |z.re| ≤ r} ⊆ closedBall 0 2 := fun r hr z hz ↦ + mem_closedBall_zero_iff.mpr (by rw [hnorm z hz.1]; exact hz.2.trans hr) + have hcap : ∀ r : ℝ, 0 < r → r ≤ 2 → (c '' {z : ℂ | z.im = 0 ∧ |z.re| ≤ r}) ∩ c '' sphere 0 r + = {c ((-r : ℝ) : ℂ), c ((r : ℝ) : ℂ)} := by + intro r hr0 hr2 + have hsph : sphere (0 : ℂ) r ⊆ closedBall 0 2 := fun z hz ↦ + mem_closedBall_zero_iff.mpr ((mem_sphere_zero_iff_norm.mp hz).le.trans hr2) + apply Subset.antisymm + · rintro _ ⟨⟨z, hz, rfl⟩, w, hw, he⟩ + obtain rfl := hcinj (hsph hw) (hRb r hr2 hz) he + have h1 : |w.re| = r := by rw [← hnorm w hz.1]; exact mem_sphere_zero_iff_norm.mp hw + rcases abs_eq hr0.le |>.mp h1 with h2 | h2 + · right + have : w = (r : ℂ) := Complex.ext (by simpa using h2) (by simpa using hz.1) + rw [this]; rfl + · left + have : w = ((-r : ℝ) : ℂ) := Complex.ext (by simpa using h2) (by simpa using hz.1) + rw [this] + · have h1 : ∀ w : ℂ, w = ((r : ℝ) : ℂ) ∨ w = ((-r : ℝ) : ℂ) → c w ∈ (c '' {z : ℂ | z.im = 0 + ∧ |z.re| ≤ r}) ∩ c '' sphere 0 r := by + rintro _ (rfl | rfl) + · refine ⟨⟨_, ⟨by simp, by simp [abs_of_pos hr0]⟩, rfl⟩, _, ?_, rfl⟩ + simp [abs_of_pos hr0] + · refine ⟨⟨_, ⟨by simp, by simp [abs_of_pos hr0]⟩, rfl⟩, _, ?_, rfl⟩ + simp [abs_of_pos hr0] + rintro x (rfl | rfl) + · exact h1 _ (.inr rfl) + · exact h1 _ (.inl rfl) + have hne : ∀ r : ℝ, 0 < r → r ≤ 2 → c ((-r : ℝ) : ℂ) ≠ c ((r : ℝ) : ℂ) := fun r hr0 hr2 h' ↦ by + have h1 : (-r : ℝ) = r := by + have := hcinj (x₁ := ((-r : ℝ) : ℂ)) (x₂ := ((r : ℝ) : ℂ)) (by simp [abs_of_pos hr0, hr2]) + (by simp [abs_of_pos hr0, hr2]) h' + exact Complex.ofReal_injective this + linarith + obtain ⟨F, hFe, hlF⟩ := hline 2 (by norm_num) le_rfl + obtain ⟨F₁, hF₁e, hlF₁⟩ := hline 1 one_pos (by norm_num) + have hFΔ : F ⊆ Δ := by + rw [hFe] + rintro _ ⟨z, hz, rfl⟩ + exact hm (hRb 2 le_rfl hz) + have hF₁D : F₁ ⊆ D := by + rw [hF₁e, ← hD1] + refine image_mono fun z hz ↦ mem_closedBall_zero_iff.mpr ?_ + rw [hnorm z hz.1] + exact hz.2 + have hF₁F : F₁ ⊆ F := by + rw [hFe, hF₁e] + exact image_mono fun z hz ↦ ⟨hz.1, hz.2.trans (by norm_num)⟩ + have hm2 : F ∩ discBd Δ = {c ((-(2 : ℝ) : ℝ) : ℂ), c (((2 : ℝ) : ℝ) : ℂ)} := by + rw [hFe, ← hbd] + exact hcap 2 (by norm_num) le_rfl + have hm1 : F₁ ∩ discBd D = {c ((-(1 : ℝ) : ℝ) : ℂ), c (((1 : ℝ) : ℝ) : ℂ)} := by + rw [hF₁e, hbdD] + exact hcap 1 one_pos (by norm_num) + obtain ⟨D₁, D₂, d1, -, hDu, -, hF₁b, -, hDc, ⟨y, hy⟩, -, hsD, -⟩ := chord_sign ω ω' hD hF₁D + (hne 1 one_pos (by norm_num)) hlF₁ hm1 + obtain ⟨Δ₁, Δ₂, g1, g2, -, -, hFb1, hFb2, hΔc, -, -, hs1, hs2⟩ := chord_sign ω ω' hΔ hFΔ (hne 2 + (by norm_num) le_rfl) hlF hm2 + have hcomp1 : IsPreconnected (D₁ \ F₁) := by + have : D₁ \ F₁ ∈ componentsIn (D \ F₁) := hDc ▸ .inl rfl + obtain ⟨q, -, e⟩ := this + exact e ▸ isPreconnected_connectedComponentIn + have hDΔ : D ⊆ Δ := fun x hx ↦ (hin hx).1 + have hD₁D : D₁ ⊆ D := hDu ▸ subset_union_left + have hsub : D₁ \ F₁ ⊆ Δ \ F := by + rintro x ⟨hx, hxF⟩ + refine ⟨hDΔ (hD₁D hx), fun hF ↦ hxF ?_⟩ + rw [hFe] at hF + obtain ⟨z, hz, rfl⟩ := hF + have hxD := hD₁D hx + rw [← hD1] at hxD + obtain ⟨w, hw, he⟩ := hxD + obtain rfl := hcinj (hb1 hw) (hRb 2 le_rfl hz) he + rw [hF₁e] + exact ⟨w, ⟨hz.1, by rw [← hnorm w hz.1]; exact mem_closedBall_zero_iff.mp hw⟩, rfl⟩ + have hfin : ∀ G : Set S, IsClosedDisc G → F ⊆ discBd G → connectedComponentIn (Δ \ F) y = G \ F → + (SignSame ω ω' D₁ ↔ SignSame ω ω' G) ∧ (SignOpp ω ω' D₁ ↔ SignOpp ω ω' G) := by + intro G hG hFG hcc + have hbG : discBd G ⊆ G := Subtype.coe_image_subset _ _ + have hsubG : D₁ ⊆ G := fun x hx ↦ by + by_cases hxF : x ∈ F₁ + · exact hbG (hFG (hF₁F hxF)) + · have := hcomp1.subset_connectedComponentIn hy hsub ⟨hx, hxF⟩ + rw [hcc] at this + exact this.1 + have hmem : ∀ r : ℝ, |r| ≤ 1 → c (r : ℂ) ∈ discBd D₁ ∩ discBd G := fun r hr ↦ by + have : c (r : ℂ) ∈ F₁ := by + rw [hF₁e] + exact ⟨_, ⟨by simp, by simpa using hr⟩, rfl⟩ + exact ⟨hF₁b this, hFG (hF₁F this)⟩ + have hinj : ∀ r r' : ℝ, |r| ≤ 1 → |r'| ≤ 1 → r ≠ r' → c (r : ℂ) ≠ c (r' : ℂ) + := fun r r' h1 h2 hn he ↦ by + have hm1' : (r : ℂ) ∈ closedBall (0 : ℂ) 2 := mem_closedBall_zero_iff.mpr + (by simpa using h1.trans (by norm_num)) + have hm2' : (r' : ℂ) ∈ closedBall (0 : ℂ) 2 := mem_closedBall_zero_iff.mpr + (by simpa using h2.trans (by norm_num)) + exact hn (Complex.ofReal_injective (hcinj hm1' hm2' he)) + have a1 : |(-1 : ℝ)| ≤ 1 := by simp + have a2 : |(0 : ℝ)| ≤ 1 := by simp + have a3 : |(1 : ℝ)| ≤ 1 := by simp + exact sign_of_common ω ω' d1 hG hsubG (hmem _ a1) (hmem _ a2) (hmem _ a3) (hinj _ _ a1 a2 + (by norm_num)) + (hinj _ _ a2 a3 (by norm_num)) (hinj _ _ a1 a3 (by norm_num)) + have hyΔ := hsub hy + have hmemc : connectedComponentIn (Δ \ F) y ∈ ({Δ₁ \ F, Δ₂ \ F} : Set (Set S)) + := hΔc ▸ ⟨y, hyΔ, rfl⟩ + rcases hmemc with h' | h' + · have := hfin Δ₁ g1 hFb1 h' + exact ⟨hsD.1.symm.trans (this.1.trans hs1.1), hsD.2.symm.trans (this.2.trans hs1.2)⟩ + · have := hfin Δ₂ g2 hFb2 h' + exact ⟨hsD.1.symm.trans (this.1.trans hs2.1), hsD.2.symm.trans (this.2.trans hs2.2)⟩ + +omit [T2Space S] in +/-- A closed disc around an interior point, inside a given open set. -/ +theorem exists_disc_around_interior {x : S} (hx : IsInteriorPoint x) {W : Set S} (hW : IsOpen W) + (hxW : x ∈ W) : + ∃ D, IsClosedDisc D ∧ D ⊆ W ∧ x ∈ discInt D := by + obtain ⟨U, h, g, c, hUW, hg0⟩ := hx.exists_ballChart hW hxW (R := 2) (by norm_num) + obtain ⟨hZ, hbdZ⟩ := isClosedDisc_closedBall + have hsub : closedBall (0 : ℂ) 1 ⊆ ball 0 2 := closedBall_subset_ball (by norm_num) + obtain ⟨d, hb⟩ := c.image_disc hZ hsub + refine ⟨_, d, ?_, ⟨0, mem_closedBall_self zero_le_one, hg0⟩, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact hUW (c.gm (hsub hz)) + · rw [hb, hbdZ] + rintro ⟨z, hz, he⟩ + have h1 := c.hg (hsub (sphere_subset_closedBall hz)) + have h2 := c.hg (mem_ball_self (by norm_num : (0 : ℝ) < 2)) + rw [he] at h1 + rw [hg0] at h2 + have : z = 0 := h1.symm.trans h2 + rw [this] at hz + simp at hz + +omit [T2Space S] in +/-- The interior of a connected surface is connected. Each collar of a cuff, without the cuff, is +connected, so it lies on one +side of a splitting of the interior. Adding the collars makes a splitting of the surface. -/ +theorem isPreconnected_compl_bd (hS : IsSurface S) [ConnectedSpace S] : IsPreconnected (bd S)ᶜ := by + classical + obtain ⟨hcpt, ht2, hman⟩ := id hS + obtain ⟨hbdc, hfin, hO⟩ := cuff_statement.{u} S hS + have hcol : ∀ C ∈ cuffs S, ∃ R T : Set S, IsOpen R ∧ C ⊆ R ∧ R \ C = T ∧ IsPreconnected T ∧ T ⊆ + (bd S)ᶜ ∧ T.Nonempty := by + intro C hC + obtain ⟨φ⟩ := hO C hC + have hUo : IsOpen (⋃₀ (cuffs S \ {C}))ᶜ := ((hfin.subset sdiff_subset).isClosed_sUnion fun C' + hC' ↦ + (hO C' hC'.1).isCompact.isClosed).isOpen_compl + have hCU : C ⊆ (⋃₀ (cuffs S \ {C}))ᶜ := by + intro x hx + rw [mem_compl_iff] + rintro ⟨C', ⟨hC', hne⟩, hxC'⟩ + exact Set.disjoint_left.mp (cuffs_disjoint hC hC' (Ne.symm hne)) hx hxC' + obtain ⟨b, hbc, hbi, hbU, hb0, hbo⟩ := exists_collar hS hC φ hUo hCU + have hb0' : ∀ x ∈ C, ∃ w, b (w, 0) = x := fun x hx ↦ ⟨φ.symm ⟨x, hx⟩, by rw [hb0]; simp⟩ + have hbC : ∀ w t, b (w, t) ∈ C → t = 0 := fun w t h' ↦ by + have h1 := hb0 (φ.symm ⟨_, h'⟩) + rw [Homeomorph.apply_symm_apply] at h1 + exact congrArg Prod.snd (hbi h1) |>.symm + obtain ⟨T, hTdef⟩ : ∃ T : Set S, T = b '' (univ ×ˢ {t : 𝕀 | t ≠ 0 ∧ t ≠ 1}) := ⟨_, rfl⟩ + have hT : (range b \ b '' {x | x.2 = 1}) \ C = T := by + rw [hTdef] + ext x + constructor + · rintro ⟨⟨⟨⟨w, t⟩, rfl⟩, h1⟩, h2⟩ + refine ⟨(w, t), ⟨mem_univ _, fun h3 ↦ h2 (by + have h3' : t = 0 := h3 + rw [h3', hb0] + exact (φ w).2), fun h3 ↦ h1 ⟨(w, t), h3, rfl⟩⟩, rfl⟩ + · rintro ⟨⟨w, t⟩, ⟨-, h0, h1⟩, rfl⟩ + refine ⟨⟨⟨_, rfl⟩, ?_⟩, fun h' ↦ h0 (hbC w t h')⟩ + rintro ⟨⟨w', t'⟩, h2, h3⟩ + have := congrArg Prod.snd (hbi h3) + exact h1 (this.symm.trans h2) + refine ⟨_, T, hbo, ?_, hT, ?_, ?_, ?_⟩ <;> try rw [hTdef] + · intro x hx + obtain ⟨w, rfl⟩ := hb0' x hx + refine ⟨⟨_, rfl⟩, ?_⟩ + rintro ⟨⟨w', t'⟩, h2, h3⟩ + have := congrArg Prod.snd (hbi h3) + have h4 : t' = 1 := h2 + have h5 : t' = 0 := this + exact zero_ne_one (h5.symm.trans h4) + · have hI : IsPreconnected {t : 𝕀 | t ≠ 0 ∧ t ≠ 1} := by + apply OrdConnected.isPreconnected + refine ⟨fun x hx y hy z hz ↦ ⟨fun h0 ↦ ?_, fun h1 ↦ ?_⟩⟩ + · rw [h0] at hz + exact hx.1 (le_antisymm hz.1 unitInterval.nonneg') + · rw [h1] at hz + exact hy.2 (le_antisymm unitInterval.le_one' hz.2) + exact (isPreconnected_univ.prod hI).image _ hbc.continuousOn + · rintro _ ⟨⟨w, t⟩, ⟨-, h0, -⟩, rfl⟩ hbdx + have hxb : b (w, t) ∈ ⋃₀ cuffs S := sUnion_cuffs (S := S) ▸ hbdx + obtain ⟨C', hC', hxC'⟩ := hxb + by_cases hCC : C' = C + · exact h0 (hbC w t (hCC ▸ hxC')) + · exact (mem_compl_iff _ _).mp (hbU ⟨_, rfl⟩) ⟨C', ⟨hC', hCC⟩, hxC'⟩ + · have h12 : (1 / 2 : ℝ) ∈ Icc (0 : ℝ) 1 := by norm_num + obtain ⟨w⟩ : Nonempty Circle := inferInstance + refine ⟨_, (w, ⟨1 / 2, h12⟩), ⟨mem_univ _, fun h' ↦ ?_, fun h' ↦ ?_⟩, rfl⟩ + · have : (1 / 2 : ℝ) = 0 := congrArg Subtype.val h' + norm_num at this + · have : (1 / 2 : ℝ) = 1 := congrArg Subtype.val h' + norm_num at this + choose! R T hR hCR hRT hTp hTb hTne using hcol + rw [isPreconnected_iff_subset_of_disjoint] + intro u v hu hv hsub hdis + have hcompl : IsOpen (bd S)ᶜ := hbdc.isOpen_compl + have hTuv : ∀ C ∈ cuffs S, T C ⊆ u ∨ T C ⊆ v := fun C hC ↦ by + refine isPreconnected_iff_subset_of_disjoint.mp (hTp C hC) u v hu hv ((hTb C hC).trans hsub) ?_ + apply Subset.antisymm _ (empty_subset _) + rintro x ⟨hxT, hxu, hxv⟩ + have : x ∈ (bd S)ᶜ ∩ (u ∩ v) := ⟨hTb C hC hxT, hxu, hxv⟩ + rwa [hdis] at this + have hbdC : ∀ C ∈ cuffs S, C ⊆ bd S := fun C hC ↦ sUnion_cuffs (S := S) ▸ subset_sUnion_of_mem hC + let A : Set S := ((bd S)ᶜ ∩ u) ∪ ⋃ C ∈ {C ∈ cuffs S | T C ⊆ u}, R C + let B : Set S := ((bd S)ᶜ ∩ v) ∪ ⋃ C ∈ {C ∈ cuffs S | T C ⊆ v}, R C + have hAo : IsOpen A := (hcompl.inter hu).union (isOpen_biUnion fun C hC ↦ hR C hC.1) + have hBo : IsOpen B := (hcompl.inter hv).union (isOpen_biUnion fun C hC ↦ hR C hC.1) + have hcov : (univ : Set S) ⊆ A ∪ B := by + intro x _ + by_cases hx : x ∈ bd S + · have hxb : x ∈ ⋃₀ cuffs S := sUnion_cuffs (S := S) ▸ hx + obtain ⟨C, hC, hxC⟩ := hxb + rcases hTuv C hC with h' | h' + · exact .inl (.inr (mem_biUnion (show C ∈ {C ∈ cuffs S | T C ⊆ u} from ⟨hC, + h'⟩) (hCR C hC hxC))) + · exact .inr (.inr (mem_biUnion (show C ∈ {C ∈ cuffs S | T C ⊆ v} from ⟨hC, + h'⟩) (hCR C hC hxC))) + · rcases hsub hx with h' | h' + · exact .inl (.inl ⟨hx, h'⟩) + · exact .inr (.inl ⟨hx, h'⟩) + have hemp : ∀ x, x ∈ (bd S)ᶜ → x ∈ u → x ∈ v → False := fun x h1 h2 h3 ↦ by + have : x ∈ (bd S)ᶜ ∩ (u ∩ v) := ⟨h1, h2, h3⟩ + rw [hdis] at this + exact this + have hRmem : ∀ C ∈ cuffs S, ∀ x ∈ R C, x ∈ C ∨ x ∈ T C := fun C hC x hx ↦ by + by_cases h' : x ∈ C + · exact .inl h' + · exact .inr (hRT C hC ▸ ⟨hx, h'⟩) + have hdisj : (univ : Set S) ∩ (A ∩ B) = ∅ := by + apply Subset.antisymm _ (empty_subset _) + rintro x ⟨-, hxA, hxB⟩ + have side : ∀ {w : Set S}, x ∈ ((bd S)ᶜ ∩ w) ∪ (⋃ C ∈ {C ∈ cuffs S | T C ⊆ w}, R C) → + (x ∈ (bd S)ᶜ ∧ x ∈ w) ∨ ∃ C ∈ cuffs S, T C ⊆ w ∧ x ∈ C := by + intro w h' + rcases h' with h' | h' + · exact .inl h' + · obtain ⟨C, hC, hxC⟩ := mem_iUnion₂.mp h' + rcases hRmem C hC.1 x hxC with h2 | h2 + · exact .inr ⟨C, hC.1, hC.2, h2⟩ + · exact .inl ⟨hTb C hC.1 h2, hC.2 h2⟩ + rcases side hxA with ⟨h1, h2⟩ | ⟨C, hC, hTu, hxC⟩ <;> rcases side hxB with ⟨h3, h4⟩ | ⟨C', hC', + hTv, hxC'⟩ + · exact hemp x h1 h2 h4 + · exact h1 (hbdC C' hC' hxC') + · exact h3 (hbdC C hC hxC) + · have hCC : C = C' := by + by_contra hne + exact Set.disjoint_left.mp (cuffs_disjoint hC hC' hne) hxC hxC' + subst hCC + obtain ⟨y, hy⟩ := hTne C hC + exact hemp y (hTb C hC hy) (hTu hy) (hTv hy) + rcases isPreconnected_iff_subset_of_disjoint.mp isPreconnected_univ A B hAo hBo hcov hdisj with + h' | h' + · left + intro x hx + rcases h' (mem_univ x) with h2 | h2 + · exact h2.2 + · obtain ⟨C, hC, hxC⟩ := mem_iUnion₂.mp h2 + rcases hRmem C hC.1 x hxC with h3 | h3 + · exact absurd (hbdC C hC.1 h3) hx + · exact hC.2 h3 + · right + intro x hx + rcases h' (mem_univ x) with h2 | h2 + · exact h2.2 + · obtain ⟨C, hC, hxC⟩ := mem_iUnion₂.mp h2 + rcases hRmem C hC.1 x hxC with h3 | h3 + · exact absurd (hbdC C hC.1 h3) hx + · exact hC.2 h3 + +omit [T2Space S] in +/-- **Two orientations of a connected surface are equal on all closed discs, or opposite on all +closed discs.** -/ +theorem orientation_dichotomy (hS : IsSurface S) [ConnectedSpace S] (ω ω' : SurfaceOrientation S) : + (∀ Δ, IsClosedDisc Δ → SignSame ω ω' Δ) ∨ ∀ Δ, IsClosedDisc Δ → SignOpp ω ω' Δ := by + classical + obtain ⟨hcpt, ht2, hman⟩ := id hS + have hclash : ∀ {Δ Δ' : Set S} {x : S}, IsClosedDisc Δ → IsClosedDisc Δ' → SignSame ω ω' Δ + → SignOpp ω ω' Δ' → x ∈ (bd S)ᶜ → + x ∈ discInt Δ → x ∈ discInt Δ' → False := by + intro Δ Δ' x d d' hs ho hx hx1 hx2 + have hint : IsInteriorPoint x := by + by_contra h' + exact hx h' + obtain ⟨D, hD, hsub, -⟩ := exists_disc_around_interior hint ((d.isOpen_discInt hman).inter + (d'.isOpen_discInt hman)) ⟨hx1, hx2⟩ + have s1 := ((sign_of_inner ω ω' hD d fun y hy ↦ (hsub hy).1).1).2 hs + have s2 := ((sign_of_inner ω ω' hD d' fun y hy ↦ (hsub hy).2).2).2 ho + obtain ⟨a, b, c, ha, hb, hc, hab, hac, hbc⟩ := hD.isOArc_discBd.exists_three + have h1 := s1 a b c ha hb hc hab hbc hac + have h2 := s2 a b c ha hb hc hab hbc hac + tauto + let P : Set S := ⋃₀ {O | ∃ Δ, IsClosedDisc Δ ∧ SignSame ω ω' Δ ∧ O = discInt Δ} + let N : Set S := ⋃₀ {O | ∃ Δ, IsClosedDisc Δ ∧ SignOpp ω ω' Δ ∧ O = discInt Δ} + have hPo : IsOpen P := isOpen_sUnion fun O ⟨Δ, d, _, e⟩ ↦ e ▸ d.isOpen_discInt hman + have hNo : IsOpen N := isOpen_sUnion fun O ⟨Δ, d, _, e⟩ ↦ e ▸ d.isOpen_discInt hman + have hcov : (bd S)ᶜ ⊆ P ∪ N := fun x hx ↦ by + have hint : IsInteriorPoint x := by + by_contra h' + exact hx h' + obtain ⟨D, hD, -, hxD⟩ := exists_disc_around_interior hint isOpen_univ (mem_univ x) + rcases disc_sign ω ω' hD with h' | h' + · exact .inl ⟨_, ⟨D, hD, h', rfl⟩, hxD⟩ + · exact .inr ⟨_, ⟨D, hD, h', rfl⟩, hxD⟩ + have hdis : (bd S)ᶜ ∩ (P ∩ N) = ∅ := by + apply Subset.antisymm _ (empty_subset _) + rintro x ⟨hx, ⟨_, ⟨Δ, d, hs, rfl⟩, hxΔ⟩, ⟨_, ⟨Δ', d', ho, rfl⟩, hxΔ'⟩⟩ + exact hclash d d' hs ho hx hxΔ hxΔ' + have hmeet : ∀ Δ, IsClosedDisc Δ → ∃ x, x ∈ (bd S)ᶜ ∧ x ∈ discInt Δ := by + intro Δ d + obtain ⟨h, g, c⟩ := d.exists_isChart + have hne : (discInt Δ).Nonempty := by + rw [c.discInt_eq] + exact ⟨g 0, 0, mem_ball_self one_pos, rfl⟩ + obtain ⟨y, hy⟩ := hne + have hcl := mem_closure_compl_bd (hman y) + obtain ⟨x, hx1, hx2⟩ := mem_closure_iff.mp hcl _ (d.isOpen_discInt hman) hy + exact ⟨x, hx2, hx1⟩ + rcases isPreconnected_iff_subset_of_disjoint.mp (isPreconnected_compl_bd hS) P N hPo hNo hcov + hdis with h' | h' + · left + intro Δ d + rcases disc_sign ω ω' d with h2 | h2 + · exact h2 + · obtain ⟨x, hx, hxΔ⟩ := hmeet Δ d + obtain ⟨_, ⟨Δ', d', hs, rfl⟩, hxΔ'⟩ := h' hx + exact (hclash d' d hs h2 hx hxΔ' hxΔ).elim + · right + intro Δ d + rcases disc_sign ω ω' d with h2 | h2 + · obtain ⟨x, hx, hxΔ⟩ := hmeet Δ d + obtain ⟨_, ⟨Δ', d', ho, rfl⟩, hxΔ'⟩ := h' hx + exact (hclash d d' h2 ho hx hxΔ hxΔ').elim + · exact h2 + +omit [T2Space S] in +/-- The image of a closed disc under a homeomorphism of the surface. -/ +theorem homeo_image_disc (e : S ≃ₜ S) {Δ : Set S} (hΔ : IsClosedDisc Δ) : IsClosedDisc (e '' Δ) + ∧ discBd (e '' Δ) = e '' discBd Δ := + hΔ.image e.continuous.continuousOn e.symm.continuous.continuousOn fun x _ ↦ e.symm_apply_apply x + +/-- The orientation that a homeomorphism pulls back. -/ +noncomputable def pullOrientation (ω : SurfaceOrientation S) (e : S ≃ₜ S) : SurfaceOrientation S + where + pos Δ a b c := ω.pos (e '' Δ) (e a) (e b) (e c) + isDirection Δ hΔ := by + obtain ⟨d, hb⟩ := homeo_image_disc e hΔ + obtain ⟨φ, h1, h2, h3, h4⟩ := ω.isDirection _ d + refine ⟨fun z ↦ e.symm (φ z), e.symm.continuous.comp h1, e.symm.injective.comp h2, ?_, + fun a b c hab hbc hac ↦ ?_⟩ + · rw [range_comp', h3, hb, image_image] + simp + · simpa using h4 a b c hab hbc hac + agree Δ₁ Δ₂ h₁ h₂ hs a b c ha hb hc hab hbc hac := by + obtain ⟨d₁, b₁⟩ := homeo_image_disc e h₁ + obtain ⟨d₂, b₂⟩ := homeo_image_disc e h₂ + have hm : ∀ {x}, x ∈ discBd Δ₁ ∩ discBd Δ₂ → e x ∈ discBd (e '' Δ₁) ∩ discBd (e '' Δ₂) + := fun {x} hx ↦ by + rw [b₁, b₂] + exact ⟨mem_image_of_mem _ hx.1, mem_image_of_mem _ hx.2⟩ + exact ω.agree _ _ d₁ d₂ (image_mono hs) _ _ _ (hm ha) (hm hb) (hm hc) (e.injective.ne hab) + (e.injective.ne hbc) + (e.injective.ne hac) + +/-- `f` reverses the orientation `ω` on each closed disc. -/ +def IsReversedBy (ω : SurfaceOrientation S) (f : S ≃ₜ S) : Prop := + ∀ Δ : Set S, IsClosedDisc Δ → ∀ a b c : S, a ∈ discBd Δ → b ∈ discBd Δ → c ∈ discBd Δ → + a ≠ b → b ≠ c → a ≠ c → (ω.pos (f '' Δ) (f a) (f b) (f c) ↔ ¬ ω.pos Δ a b c) + +omit [T2Space S] in +/-- A homeomorphism of a connected surface keeps every orientation or reverses every orientation. -/ +theorem homeo_orientation (hS : IsSurface S) [ConnectedSpace S] (e : S ≃ₜ S) : + (∀ ω : SurfaceOrientation S, ω.IsPreservedBy e) ∨ ∀ ω : SurfaceOrientation S, IsReversedBy ω e + := by + by_cases h : ∀ ω : SurfaceOrientation S, ω.IsPreservedBy e + · exact .inl h + push Not at h + obtain ⟨ω₀, hω₀⟩ := h + have hrev : IsReversedBy ω₀ e := by + rcases orientation_dichotomy hS ω₀ (pullOrientation ω₀ e) with h' | h' + · exact absurd (fun Δ d a b c ha hb hc hab hbc hac ↦ h' Δ d a b c ha hb hc hab hbc hac) hω₀ + · exact fun Δ d a b c ha hb hc hab hbc hac ↦ h' Δ d a b c ha hb hc hab hbc hac + refine .inr fun ω Δ d a b c ha hb hc hab hbc hac ↦ ?_ + obtain ⟨d', hb'⟩ := homeo_image_disc e d + have hm : ∀ {x}, x ∈ discBd Δ → e x ∈ discBd (e '' Δ) := fun {x} hx ↦ hb' ▸ mem_image_of_mem _ hx + have h0 := hrev Δ d a b c ha hb hc hab hbc hac + have ne1 := e.injective.ne hab + have ne2 := e.injective.ne hbc + have ne3 := e.injective.ne hac + rcases orientation_dichotomy hS ω₀ ω with h' | h' + · have h1 := h' Δ d a b c ha hb hc hab hbc hac + have h2 := h' _ d' _ _ _ (hm ha) (hm hb) (hm hc) ne1 ne2 ne3 + tauto + · have h1 := h' Δ d a b c ha hb hc hab hbc hac + have h2 := h' _ d' _ _ _ (hm ha) (hm hb) (hm hc) ne1 ne2 ne3 + tauto + +omit [T2Space S] in +/-- Two reversing homeomorphisms in a row keep the orientation. -/ +theorem preserved_of_reversed {ω : SurfaceOrientation S} {e₁ e₂ : S ≃ₜ S} (h₁ : IsReversedBy ω e₁) + (h₂ : IsReversedBy ω e₂) : + ω.IsPreservedBy (e₁.trans e₂) := by + intro Δ d a b c ha hb hc hab hbc hac + obtain ⟨d', hb'⟩ := homeo_image_disc e₁ d + have hm : ∀ {x}, x ∈ discBd Δ → e₁ x ∈ discBd (e₁ '' Δ) := fun {x} hx ↦ hb' ▸ mem_image_of_mem _ + hx + have h3 := h₂ _ d' _ _ _ (hm ha) (hm hb) (hm hc) (e₁.injective.ne hab) (e₁.injective.ne hbc) + (e₁.injective.ne hac) + have h4 := h₁ Δ d a b c ha hb hc hab hbc hac + have e5 : (e₁.trans e₂) '' Δ = e₂ '' (e₁ '' Δ) := by + rw [image_image] + rfl + rw [e5] + change ω.pos (e₂ '' (e₁ '' Δ)) (e₂ (e₁ a)) (e₂ (e₁ b)) (e₂ (e₁ c)) ↔ _ + tauto + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FeatureTile.lean b/LeanPool/GraphMinor/GM19/FeatureTile.lean new file mode 100644 index 0000000000..9bd1731fd4 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FeatureTile.lean @@ -0,0 +1,425 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FeatureCut + +/-! +# Arcs around a cuff + +Finitely many arcs cover a cuff and meet only at their ends. Lifted to the line, they are intervals +that tile the line, with +period one. Sorting them gives the order of the arcs around the cuff (`exists_tile_order`, +`exists_cuff_order`). Then `cc` +joins a sequence of paths into one path, and `pos` says where each path sits in the join. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Function GraphMinor.Surface + +universe u + +private theorem sorted_fractional_parts_span_lt_one + {J : Type*} + (l' : J → ℝ) + (hl01 : ∀ (s : J), l' s ∈ Ico 0 1) + (T : Finset ℝ) + (hk0 : 0 < (T.card)) + (o : Fin T.card ↪o ℝ) + (sq : ℕ → J) + (hsq : ∀ (i : ℕ) (h : i < (T.card)), l' (sq i) = o ⟨i, h⟩) + (i : ℕ) + (h : i < (T.card)) : + o ⟨i, h⟩ < o ⟨0, hk0⟩ + 1 := by + let k := T.card + have h₁ := (hl01 (sq i)).2 + have h₂ := (hl01 (sq 0)).1 + rw [hsq i h] at h₁ + rw [hsq 0 hk0] at h₂ + linarith + +/-- Intervals that tile the line with period one, sorted by their left ends. -/ +theorem exists_tile_order {J : Type*} [Finite J] [Nonempty J] (l r : J → ℝ) (hlr : ∀ s, l s < r s) + (hdisj : ∀ (s s' : J) (n n' : ℤ) (x : ℝ), x ∈ Ioo (l s + n) (r s + n) → x ∈ Ioo (l s' + n') + (r s' + n') → s = s' ∧ n = n') + (hcov : ∀ x : ℝ, ∃ (s : J) (n : ℤ), x ∈ Icc (l s + n) (r s + n)) : + ∃ (k : ℕ) (sq : ℕ → J) (n : ℕ → ℤ), 0 < k ∧ (∀ s, ∃ i < k, sq i = s) ∧ (∀ i < k, ∀ j < k, sq i + = sq j → i = j) ∧ + (∀ i, i + 1 < k → r (sq i) + n i = l (sq (i + 1)) + n (i + 1)) ∧ r (sq (k - 1)) + n (k - 1) + = l (sq 0) + n 0 + 1 := by + classical + have := Fintype.ofFinite J + set N : J → ℤ := fun s ↦ -⌊l s⌋ with hN + set l' : J → ℝ := fun s ↦ l s + N s with hl' + set r' : J → ℝ := fun s ↦ r s + N s with hr' + have hl01 : ∀ s, l' s ∈ Ico (0 : ℝ) 1 := fun s ↦ by + have h₁ := Int.floor_le (l s) + have h₂ := Int.lt_floor_add_one (l s) + simp only [hl', hN, Int.cast_neg] + constructor <;> linarith + have hinj : Injective l' := fun s s' he ↦ by + have h₁ := hlr s + have h₂ := hlr s' + set p := l' s with hp + set q := min (r' s) (r' s') with hq + have hq₁ : p < q := by + apply lt_min + · simp only [hp, hl', hr'] + linarith + · have he' : p = l' s' := he + rw [he'] + simp only [hl', hr'] + linarith + have hm₁ : (p + q) / 2 ∈ Ioo (l s + N s) (r s + N s) := by + constructor + · simp only [hp, hl'] at hq₁ ⊢ + linarith + · have : q ≤ r' s := min_le_left _ _ + simp only [hr'] at this + linarith + have hm₂ : (p + q) / 2 ∈ Ioo (l s' + N s') (r s' + N s') := ⟨by + have : p = l s' + N s' := he + linarith, by + have : q ≤ r' s' := min_le_right _ _ + simp only [hr'] at this + linarith⟩ + exact (hdisj s s' _ _ _ hm₁ hm₂).1 + let T : Finset ℝ := Finset.univ.image l' + have hcard : T.card = Fintype.card J := Finset.card_image_of_injective _ hinj + set k := T.card with hk + have hk0 : 0 < k := by + rw [hcard] + exact Fintype.card_pos + let o := T.orderEmbOfFin rfl + have hoT : ∀ i, ∃ s, l' s = o i := fun i ↦ by + obtain ⟨s, -, hs⟩ := Finset.mem_image.mp (T.orderEmbOfFin_mem rfl i) + exact ⟨s, hs⟩ + have hTo : ∀ s, ∃ i, o i = l' s := fun s ↦ by + have h₁ : l' s ∈ T := Finset.mem_image_of_mem _ (Finset.mem_univ s) + have h₂ : l' s ∈ Set.range o := by + rw [Finset.range_orderEmbOfFin] + exact h₁ + exact h₂ + choose S hS using hoT + let sq : ℕ → J := fun i ↦ if h : i < k then S ⟨i, h⟩ else Classical.arbitrary J + let n : ℕ → ℤ := fun i ↦ N (sq i) + have hsq : ∀ i (h : i < k), l' (sq i) = o ⟨i, h⟩ := fun i h ↦ by + simp only [sq, h, dite_eq_left] + exact hS _ + have hx : ∀ i (h : i < k), l (sq i) + n i = o ⟨i, h⟩ := fun i h ↦ hsq i h + have hsub : ∀ {i j} (hi : i < k) (hj : j < k), i < j → o ⟨i, hi⟩ < o ⟨j, hj⟩ + := fun hi hj h ↦ o.strictMono h + have hinjS : ∀ i < k, ∀ j < k, sq i = sq j → i = j := fun i hi j hj he ↦ by + have h₁ := hsq i hi + rw [he, hsq j hj] at h₁ + exact Fin.mk.inj_iff.mp (o.injective h₁).symm + have hxlt : ∀ i (h : i < k), l (sq i) + n i < r (sq i) + n i := fun i _ ↦ by linarith [hlr (sq i)] + have h0 : ∀ i (h : i < k), o ⟨0, hk0⟩ ≤ o ⟨i, h⟩ := fun i h ↦ o.monotone (Fin.mk_le_mk.mpr + (Nat.zero_le i)) + have hlast : ∀ i (h : i < k), o ⟨i, h⟩ < o ⟨0, hk0⟩ + 1 := fun i h ↦ by + exact sorted_fractional_parts_span_lt_one (J := J) l' hl01 T hk0 o sq hsq i h + have hover : ∀ {s s' : J} {m m' : ℤ} {b : ℝ}, s ≠ s' → l s + m < l s' + m' → l s' + m' < r s + m + → r s' + m' ≤ b → l s' + m' = b → False := by + intro s s' m m' b _ _ _ h₃ h₄ + linarith [hlr s'] + have hle : ∀ {s s' : J} {m m' : ℤ}, (s, m) ≠ (s', m') → l s + m ≤ l s' + m' → r s + m ≤ l s' + m' + ∨ l s + m = l s' + m' := by + intro s s' m m' hne h₁ + by_contra hcon + push Not at hcon + obtain ⟨h₂, h₃⟩ := hcon + have h₄ : l s + m < l s' + m' := lt_of_le_of_ne h₁ h₃ + set q := min (r s + m) (r s' + m') with hq + have hq₁ : l s' + m' < q := lt_min h₂ (by linarith [hlr s']) + have hq₂ := min_le_left (r s + m) (r s' + m') + have hq₃ := min_le_right (r s + m) (r s' + m') + have hp₁ : (l s' + m' + q) / 2 ∈ Ioo (l s + m) (r s + m) := ⟨by linarith, by linarith⟩ + have hp₂ : (l s' + m' + q) / 2 ∈ Ioo (l s' + (m' : ℤ)) (r s' + m') := ⟨by linarith, by linarith⟩ + obtain ⟨rfl, rfl⟩ := hdisj _ _ _ _ _ hp₁ hp₂ + exact hne rfl + set xn : ℕ → ℝ := fun i ↦ if h : i + 1 < k then o ⟨i + 1, h⟩ else o ⟨0, hk0⟩ + 1 with hxn + have hyle : ∀ i (h : i < k), r (sq i) + n i ≤ xn i := fun i h ↦ by + by_cases h₁ : i + 1 < k + · simp only [hxn, h₁, dite_eq_left] + have h₂ := hsub h h₁ (Nat.lt_succ_self i) + have h₃ : (sq i, n i) ≠ (sq (i + 1), n (i + 1)) := fun he ↦ by + have := hinjS i h (i + 1) h₁ (Prod.mk.inj he).1 + omega + rw [← hx i h, ← hx _ h₁] at h₂ + rw [← hx _ h₁] + exact (hle h₃ h₂.le).resolve_right h₂.ne + · simp only [hxn, h₁, dite_eq_right, not_false_eq_true] + have h₂ := hlast i h + have e₀ := hx 0 hk0 + have h₃ : ((sq i, n i) : J × ℤ) ≠ (sq 0, n 0 + 1) := fun he ↦ by + have h₄ := (Prod.mk.inj he).2 + have h₅ := (Prod.mk.inj he).1 + have h₆ := hinjS i h 0 hk0 h₅ + subst h₆ + omega + have e₁ : l (sq i) + n i < l (sq 0) + ((n 0 + 1 : ℤ) : ℝ) := by + rw [hx i h] + push_cast + linarith + have := (hle h₃ e₁.le).resolve_right e₁.ne + push_cast at this + linarith + have hgap : ∀ i (h : i < k), xn i ≤ r (sq i) + n i := fun i h ↦ by + by_contra hcon + push Not at hcon + set p := (r (sq i) + n i + xn i) / 2 with hp + have hp₁ : r (sq i) + n i < p := by linarith + have hp₂ : p < xn i := by linarith + have hxn0 : ∀ j (hj : j < k), xn j ≤ o ⟨0, hk0⟩ + 1 := fun j hj ↦ by + by_cases h₁ : j + 1 < k + · simp only [hxn, h₁, dite_eq_left] + exact (hlast _ h₁).le + · simp only [hxn, h₁, dite_eq_right, not_false_eq_true, le_refl] + have hy0 := fun j hj ↦ (hyle j hj).trans (hxn0 j hj) + obtain ⟨s, m, hs₁, hs₂⟩ := hcov p + obtain ⟨t, ht⟩ := hTo s + have htk : t.1 < k := t.2 + have ht₁ : sq t.1 = s := by + apply hinj + rw [hsq t.1 htk] + exact ht + have ht₂ : (m : ℝ) = (m - n t.1 : ℤ) + n t.1 := by push_cast; ring + rw [← ht₁] at hs₁ hs₂ + set M : ℤ := m - N (sq t.1) with hM + have hs₁' : o t + M ≤ p := by + have e := hx t.1 htk + have e₂ : (m : ℝ) = M + n t.1 := by simp only [hM, n]; push_cast; ring + rw [e₂] at hs₁ + have : o ⟨t.1, htk⟩ = o t := rfl + linarith + have hs₂' : p ≤ r (sq t.1) + n t.1 + M := by + have e₂ : (m : ℝ) = M + n t.1 := by simp only [hM, n]; push_cast; ring + rw [e₂] at hs₂ + linarith + have hp₃ : o ⟨0, hk0⟩ < p := by + have h₁ := h0 i h + have h₂ := hxlt i h + rw [hx i h] at h₂ + linarith + have hp₄ : p < o ⟨0, hk0⟩ + 1 := by linarith [hxn0 i h] + have hM₀ : M = 0 := by + have h₁ : M < 1 := by + by_contra hc + have h₂ : (1 : ℝ) ≤ M := by exact_mod_cast (not_lt.mp hc) + have h₃ := h0 t.1 htk + have : o ⟨t.1, htk⟩ = o t := rfl + linarith + have h₂ : -1 < M := by + by_contra hc + have h₂ : (M : ℝ) ≤ -1 := by exact_mod_cast (not_lt.mp hc) + have h₃ := hy0 t.1 htk + linarith + omega + rw [hM₀] at hs₁' hs₂' + simp only [Int.cast_zero, add_zero] at hs₁' hs₂' + rcases lt_trichotomy t.1 i with h₁ | h₁ | h₁ + · have h₂ := hyle t.1 htk + have h₃ : xn t.1 ≤ o ⟨i, h⟩ := by + have h₄ : t.1 + 1 < k := by omega + simp only [hxn, h₄, dite_eq_left] + exact o.monotone (Fin.mk_le_mk.mpr h₁) + have h₄ := hxlt i h + rw [hx i h] at h₄ + linarith + · rw [h₁] at hs₂' + linarith + · have h₄ : i + 1 < k := by omega + have h₂ : xn i ≤ o t := by + simp only [hxn, h₄, dite_eq_left] + exact o.monotone (Fin.mk_le_mk.mpr h₁) + linarith + have heq : ∀ i (h : i < k), r (sq i) + n i = xn i := fun i h ↦ le_antisymm (hyle i h) (hgap i h) + refine ⟨k, sq, n, hk0, fun s ↦ ?_, hinjS, fun i hi ↦ ?_, ?_⟩ + · obtain ⟨t, ht⟩ := hTo s + refine ⟨t.1, t.2, hinj ?_⟩ + rw [hsq t.1 t.2] + exact ht + · rw [heq i (by omega), hx _ hi] + simp only [hxn, hi, dite_eq_left] + · have hk1 : k - 1 < k := by omega + rw [heq _ hk1, hx 0 hk0] + have h₁ : ¬ (k - 1 + 1 < k) := by omega + simp only [hxn, h₁, dite_eq_right, not_false_eq_true] + +/-- Join `k` paths of a sequence, each on `[0, 1]`, into one path. -/ +noncomputable def cc {T : Type*} : ℕ → (ℕ → ℝ → T) → ℝ → T + | 0, M => M 0 + | 1, M => M 0 + | k + 2, M => conc2 (M 0) (cc (k + 1) fun i ↦ M (i + 1)) + +/-- Where the path `i` sits in the join of `k` paths. -/ +noncomputable def pos : ℕ → ℕ → ℝ → ℝ + | 0, _, u => u + | 1, _, u => u + | _ + 2, 0, u => u / 2 + | k + 2, i + 1, u => (1 + pos (k + 1) i u) / 2 + +theorem pos_mem : ∀ (k i : ℕ) {u : ℝ}, u ∈ Icc (0 : ℝ) 1 → pos k i u ∈ Icc (0 : ℝ) 1 + | 0, _, _, hu => hu + | 1, _, _, hu => hu + | _ + 2, 0, _, hu => ⟨by simp only [pos]; linarith [hu.1], by simp only [pos]; linarith [hu.2]⟩ + | k + 2, i + 1, _, hu => by + have := pos_mem (k + 1) i hu + exact ⟨by simp only [pos]; linarith [this.1], by simp only [pos]; linarith [this.2]⟩ + +section cc + +variable {T : Type*} + +theorem cc_zero : ∀ (k : ℕ) (M : ℕ → ℝ → T), cc k M 0 = M 0 0 + | 0, _ => rfl + | 1, _ => rfl + | k + 2, M => by + simp only [cc] + exact conc2_zero + +theorem cc_one : ∀ (k : ℕ) (M : ℕ → ℝ → T), (∀ i, i + 1 < k → M i 1 = M (i + 1) 0) → cc k M 1 = M + (k - 1) 1 + | 0, _, _ => rfl + | 1, _, _ => rfl + | k + 2, M, h => by + simp only [cc] + rw [conc2_one (by rw [cc_zero]; exact h 0 (by omega)), cc_one (k + 1) _ fun i hi ↦ h (i + 1) + (by omega)] + rfl + +theorem cc_pos : ∀ (k : ℕ) (M : ℕ → ℝ → T), (∀ i, i + 1 < k → M i 1 = M (i + 1) 0) + → ∀ i < k, ∀ u ∈ Icc (0 : ℝ) 1, cc k M (pos k i u) = M i u + | 0, _, _, _, hi, _, _ => by omega + | 1, _, _, 0, _, _, _ => rfl + | 1, _, _, _ + 1, hi, _, _ => by omega + | _ + 2, _, _, 0, _, _, hu => by + simp only [cc, pos] + exact conc2_left hu + | k + 2, M, h, i + 1, hi, u, hu => by + simp only [cc, pos] + rw [conc2_right (by rw [cc_zero]; exact h 0 (by omega)) (pos_mem (k + 1) i hu), cc_pos + (k + 1) _ (fun i hi ↦ h (i + 1) (by omega)) i (by omega) u hu] + +theorem continuousOn_cc [TopologicalSpace T] : ∀ (k : ℕ) (M : ℕ → ℝ → T), (∀ i, i + 1 < k → M i 1 + = M (i + 1) 0) → (∀ i < k, ContinuousOn (M i) (Icc 0 1)) → 0 < k → + ContinuousOn (cc k M) (Icc 0 1) + | 0, _, _, _, h => by omega + | 1, _, _, h, _ => h 0 (by omega) + | k + 2, M, h, hc, _ => by + simp only [cc] + exact continuousOn_conc2 (hc 0 (by omega)) (continuousOn_cc (k + 1) _ (fun i hi ↦ h (i + 1) + (by omega)) (fun i hi ↦ hc (i + 1) (by omega)) (by omega)) + (by rw [cc_zero]; exact h 0 (by omega)) + +theorem strictMonoOn_cc : ∀ (k : ℕ) (M : ℕ → ℝ → ℝ), (∀ i, i + 1 < k → M i 1 = M (i + 1) 0) → + (∀ i < k, StrictMonoOn (M i) (Icc 0 1)) → 0 < k → + StrictMonoOn (cc k M) (Icc 0 1) + | 0, _, _, _, h => by omega + | 1, _, _, h, _ => h 0 (by omega) + | k + 2, M, h, hc, _ => by + simp only [cc] + exact strictMonoOn_conc2 (hc 0 (by omega)) (strictMonoOn_cc (k + 1) _ (fun i hi ↦ h (i + 1) + (by omega)) (fun i hi ↦ hc (i + 1) (by omega)) (by omega)) + (by rw [cc_zero]; exact h 0 (by omega)) + +end cc + +theorem ofs_false' : ofs false = fun u : ℝ ↦ 1 - u := funext ofs_false + +theorem ofs_true' : ofs true = fun u : ℝ ↦ u := funext ofs_true + +/-- **The order of the arcs around a cuff.** -/ +theorem exists_cuff_order {Y : Type*} [TopologicalSpace Y] {C : Set Y} + (φ : Circle ≃ₜ C) {J : Type*} [Finite J] [Nonempty J] {γ : J → ℝ → Y} + (hc : ∀ s, ContinuousOn (γ s) (Icc 0 1)) (hi : ∀ s, InjOn (γ s) (Icc 0 1)) (hC : ∀ s, ∀ u ∈ Icc + (0 : ℝ) 1, γ s u ∈ C) + (hd : ∀ s s', ∀ u ∈ Ioo (0 : ℝ) 1, ∀ v ∈ Ioo (0 : ℝ) 1, γ s u = γ s' v → s = s' ∧ u = v) + (hcov : ∀ y ∈ C, ∃ s, ∃ u ∈ Icc (0 : ℝ) 1, γ s u = y) : + ∃ (k : ℕ) (sq : ℕ → J) (fl : ℕ → Bool) (m : ℕ → ℝ → ℝ), 0 < k ∧ (∀ s, ∃ i < k, sq i = s) ∧ + (∀ i < k, ∀ j < k, sq i = sq j → i = j) ∧ + (∀ i < k, ContinuousOn (m i) (Icc 0 1) ∧ StrictMonoOn (m i) (Icc 0 1) ∧ ∀ u ∈ Icc (0 : ℝ) 1, + (φ (ee (m i u))).1 = γ (sq i) (ofs (fl i) u)) ∧ + (∀ i, i + 1 < k → m i 1 = m (i + 1) 0) ∧ m (k - 1) 1 = m 0 0 + 1 := by + have hlift := fun s ↦ exists_lift φ (hc s) (hC s) + choose m₀ hm₀ hm₁ using hlift + have hdir : ∀ s, ∃ e : Bool, StrictMonoOn (fun u ↦ m₀ s (ofs e u)) (Icc 0 1) := fun s ↦ by + have hinj : InjOn (fun u ↦ ee (m₀ s u)) (Icc 0 1) := fun u hu v hv he ↦ by + apply hi s hu hv + rw [← hm₁ s u hu, ← hm₁ s v hv] + simp only at he + rw [he] + rcases lift_mono (hm₀ s) hinj with h | h + · refine ⟨true, fun u hu v hv huv ↦ ?_⟩ + simpa [ofs] using h hu hv huv + · refine ⟨false, fun u hu v hv huv ↦ ?_⟩ + have h₁ := h (ofs_mem (e := false) hv) (ofs_mem (e := false) hu) + (by rw [ofs_false, ofs_false]; linarith) + exact h₁ + choose e he using hdir + set M : J → ℝ → ℝ := fun s u ↦ m₀ s (ofs (e s) u) with hM + have hM₁ : ∀ s, ∀ u ∈ Icc (0 : ℝ) 1, (φ (ee (M s u))).1 = γ s (ofs (e s) u) + := fun s u hu ↦ hm₁ s _ (ofs_mem hu) + have hMc : ∀ s, ContinuousOn (M s) (Icc 0 1) := fun s ↦ by + have h₁ : Continuous (ofs (e s)) := by + cases e s + · simp only [ofs_false'] + fun_prop + · simp only [ofs_true'] + fun_prop + exact (hm₀ s).comp h₁.continuousOn fun u hu ↦ ofs_mem hu + have h01 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have h11 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hlr : ∀ s, M s 0 < M s 1 := fun s ↦ he s h01 h11 zero_lt_one + have hmid : ∀ s (n : ℤ) (x : ℝ), x ∈ Ioo (M s 0 + n) (M s 1 + n) → ∃ u ∈ Ioo (0 : ℝ) 1, M s u + n + = x := fun s n x hx ↦ by + have h₁ : x - n ∈ Ioo (M s 0) (M s 1) := ⟨by linarith [hx.1], by linarith [hx.2]⟩ + obtain ⟨u, hu, hue⟩ := intermediate_value_Ioo zero_le_one (hMc s) h₁ + exact ⟨u, hu, by linarith⟩ + have hofs : ∀ (e : Bool) {u : ℝ}, u ∈ Ioo (0 : ℝ) 1 → ofs e u ∈ Ioo (0 : ℝ) 1 + := fun e {u} hu ↦ ofs_Ioo e hu + obtain ⟨k, sq, n, hk, hsur, hinj, hch, hlast⟩ := exists_tile_order (fun s ↦ M s 0) + (fun s ↦ M s 1) hlr (fun s s' n n' x hx hx' ↦ by + obtain ⟨u, hu, hue⟩ := hmid s n x hx + obtain ⟨v, hv, hve⟩ := hmid s' n' x hx' + have hee : ee (M s u) = ee (M s' v) := by + rw [← ee_add_int (M s u) n, ← ee_add_int (M s' v) n', hue, hve] + have h₁ : γ s (ofs (e s) u) = γ s' (ofs (e s') v) := by + rw [← hM₁ s u ⟨hu.1.le, hu.2.le⟩, ← hM₁ s' v ⟨hv.1.le, hv.2.le⟩, hee] + obtain ⟨rfl, h₂⟩ := hd s s' _ (hofs _ hu) _ (hofs _ hv) h₁ + have h₃ : u = v := by + have := congrArg (ofs (e s)) h₂ + rwa [ofs_ofs, ofs_ofs] at this + subst h₃ + refine ⟨rfl, ?_⟩ + have : (n : ℝ) = n' := by linarith + exact_mod_cast this) (fun x ↦ by + obtain ⟨s, v, hv, hve⟩ := hcov _ (φ (ee x)).2 + have h₁ : (φ (ee (M s (ofs (e s) v)))).1 = (φ (ee x)).1 := by + rw [hM₁ s _ (ofs_mem hv), ofs_ofs, hve] + obtain ⟨n, hn⟩ := ee_eq_iff.mp (φ.injective (Subtype.ext h₁)) + refine ⟨s, -n, ?_⟩ + have hu := ofs_mem (e := e s) hv + have h₂ := (he s).monotoneOn h01 hu hu.1 + have h₃ := (he s).monotoneOn hu h11 hu.2 + change M s 0 ≤ M s (ofs (e s) v) at h₂ + change M s (ofs (e s) v) ≤ M s 1 at h₃ + constructor <;> push_cast <;> linarith) + refine ⟨k, sq, fun i ↦ e (sq i), fun i u ↦ M (sq i) u + n i, hk, hsur, hinj, fun i _ ↦ ⟨(hMc + _).add continuousOn_const, fun u hu v hv huv ↦ ?_, fun u hu ↦ ?_⟩, fun i hi ↦ ?_, ?_⟩ + · simpa using he _ hu hv huv + · simp only + rw [ee_add_int, hM₁ _ u hu] + · exact hch i hi + · exact hlast + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Flower.lean b/LeanPool/GraphMinor/GM19/Flower.lean new file mode 100644 index 0000000000..01f0628fef --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Flower.lean @@ -0,0 +1,346 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.PlaneOrientation +public import LeanPool.GraphMinor.Surface.DiscTwist + +/-! +# Flowers in the plane + +Step (3) of the proof of Graph Minors XIX, (15.2), page 382 joins each end of an edge to a vertex by +a tree. We use small discs around the vertices in place of trees, and so we need a closed disc that +meets a given compact set `F` in exactly one point near each of some given directions. A set `{z | +‖z‖ ≤ ρ(z / ‖z‖)}` with `ρ` continuous is a closed disc (`starHomeo`), and we call the point +`ρ(w) * w` the peak in direction `w`. For each direction `w` we take the point `z` of `F` that +minimizes `‖z‖ + L * ‖z / ‖z‖ - w‖`, and `ρ` falls away from this point just fast enough to miss +the rest of `F` (`exists_flower`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Metric Topology Filter GraphMinor.Surface + +open Classical in +/-- Stretch each ray of the plane by the factor `ρ`. -/ +noncomputable def starMap (ρ : Circle → ℝ) (z : ℂ) : ℂ := + if hz : z = 0 then 0 else (ρ (unitOf z hz) : ℂ) * z + +theorem starMap_coe (ρ : Circle → ℝ) (w : Circle) : starMap ρ w = (ρ w : ℂ) * w := by + have hw : (w : ℂ) ≠ 0 := Circle.coe_ne_zero w + have hu : unitOf w hw = w := by + have := unitOf_mul 1 one_pos w (by simp [hw]) + simpa using this + simp only [starMap, dite_eq_right hw, hu] + +theorem continuous_starMap {ρ : Circle → ℝ} (hρ : Continuous ρ) : Continuous (starMap ρ) := by + rw [continuous_iff_continuousAt] + intro z + by_cases hz : z = 0 + · subst hz + obtain ⟨B, hB⟩ := (isCompact_range (hρ.norm)).bddAbove + have hB' : ∀ w, ‖ρ w‖ ≤ B := fun w => hB (mem_range_self w) + have hB0 : 0 ≤ B := (norm_nonneg _).trans (hB' 1) + have h0 : starMap ρ 0 = 0 := by simp [starMap] + rw [ContinuousAt, h0, tendsto_zero_iff_norm_tendsto_zero] + have hle : ∀ w, ‖starMap ρ w‖ ≤ B * ‖w‖ := fun w => by + by_cases hw : w = 0 + · simp [starMap, hw] + · simp only [starMap, dite_eq_right hw, norm_mul, Complex.norm_real] + exact mul_le_mul_of_nonneg_right (hB' _) (norm_nonneg _) + have ht : Tendsto (fun w : ℂ => B * ‖w‖) (𝓝 0) (𝓝 0) := by + have h : Continuous fun w : ℂ => B * ‖w‖ := continuous_const.mul continuous_norm + simpa using h.tendsto (0 : ℂ) + exact squeeze_zero (fun _ => norm_nonneg _) hle ht + · have hmem : {z : ℂ | z ≠ 0} ∈ 𝓝 z := isOpen_ne.mem_nhds hz + refine ContinuousOn.continuousAt ?_ hmem + rw [continuousOn_iff_continuous_domRestrict] + have heq : ({z : ℂ | z ≠ 0}).domRestrict (starMap ρ) = fun x : {z : ℂ // z ≠ 0} => (ρ + (unitOf x.1 x.2) : ℂ) * x.1 := by + funext x + change starMap ρ x.1 = _ + simp only [starMap, dite_eq_right x.2] + rw [heq] + exact (Complex.continuous_ofReal.comp (hρ.comp continuous_unitOf)).mul continuous_subtype_val + +theorem starMap_form (ρ : Circle → ℝ) {z : ℂ} (hz : z ≠ 0) : starMap ρ z = ((ρ + (unitOf z hz) * ‖z‖ : ℝ) : ℂ) * unitOf z hz := by + simp only [starMap, dite_eq_right hz] + rw [Complex.ofReal_mul, mul_assoc, norm_mul_unitOf] + +theorem starMap_ne {ρ : Circle → ℝ} (hρ : ∀ w, 0 < ρ w) {z : ℂ} (hz : z ≠ 0) : starMap ρ z ≠ 0 := by + simp only [starMap, dite_eq_right hz] + exact mul_ne_zero (by exact_mod_cast (hρ _).ne') hz + +theorem unitOf_starMap {ρ : Circle → ℝ} (hρ : ∀ w, 0 < ρ w) {z : ℂ} (hz : z ≠ 0) : unitOf + (starMap ρ z) (starMap_ne hρ hz) = unitOf z hz := by + have hpos : 0 < ρ (unitOf z hz) * ‖z‖ := mul_pos (hρ _) (norm_pos_iff.mpr hz) + have hne : ((ρ (unitOf z hz) * ‖z‖ : ℝ) : ℂ) * unitOf z hz ≠ 0 := by + rw [← starMap_form ρ hz] + exact starMap_ne hρ hz + have := unitOf_mul _ hpos (unitOf z hz) hne + simp only [starMap_form ρ hz] + exact this + +theorem starMap_inv {ρ : Circle → ℝ} (hρ : ∀ w, 0 < ρ w) (z : ℂ) : starMap (fun w => (ρ w)⁻¹) + (starMap ρ z) = z := by + by_cases hz : z = 0 + · simp [starMap, hz] + · have hn := starMap_ne hρ hz + have hu := unitOf_starMap hρ hz + rw [starMap, dite_eq_right hn, hu] + simp only [starMap, dite_eq_right hz] + have hr : (ρ (unitOf z hz) : ℂ) ≠ 0 := by exact_mod_cast (hρ _).ne' + rw [Complex.ofReal_inv, inv_mul_cancel_left₀ hr] + +/-- The stretching of rays is a homeomorphism of the plane. -/ +noncomputable def starHomeo {ρ : Circle → ℝ} (hc : Continuous ρ) (hρ : ∀ w, 0 < ρ w) : ℂ ≃ₜ ℂ where + toFun := starMap ρ + invFun := starMap fun w => (ρ w)⁻¹ + left_inv := starMap_inv hρ + right_inv := fun z => by + have := starMap_inv (ρ := fun w => (ρ w)⁻¹) (fun w => inv_pos.mpr (hρ w)) z + simpa using this + continuous_toFun := continuous_starMap hc + continuous_invFun := continuous_starMap (hc.inv₀ fun w => (hρ w).ne') + +/-- The closed disc under the graph of `ρ`. -/ +noncomputable def starDisc {ρ : Circle → ℝ} (hc : Continuous ρ) (hρ : ∀ w, 0 < ρ w) : Set ℂ := + starHomeo hc hρ '' closedBall 0 1 + +theorem starHomeo_apply {ρ : Circle → ℝ} (hc : Continuous ρ) (hρ : ∀ w, 0 < ρ w) + (z : ℂ) : starHomeo hc hρ z = starMap ρ z := rfl + +theorem starHomeo_zero {ρ : Circle → ℝ} (hc : Continuous ρ) (hρ : ∀ w, 0 < ρ w) : starHomeo hc hρ 0 + = 0 := by + simp [starHomeo_apply, starMap] + +theorem mem_starDisc {ρ : Circle → ℝ} {hc : Continuous ρ} {hρ : ∀ w, 0 < ρ w} {z : ℂ} + (hz : z ≠ 0) : z ∈ starDisc hc hρ ↔ ‖z‖ ≤ ρ (unitOf z hz) := by + constructor + · rintro ⟨x, hx, rfl⟩ + have hx0 : x ≠ 0 := fun h => hz (by rw [h, starHomeo_zero]) + have hu := unitOf_starMap hρ hx0 + have hk : unitOf (starHomeo hc hρ x) hz = unitOf x hx0 := hu + rw [hk, starHomeo_apply, starMap_form ρ hx0, norm_mul, Complex.norm_real, Circle.norm_coe, + mul_one, Real.norm_of_nonneg (mul_pos (hρ _) (norm_pos_iff.mpr hx0)).le] + have := mem_closedBall_zero_iff.mp hx + nlinarith [hρ (unitOf x hx0), norm_nonneg x] + · intro h + refine ⟨(starHomeo hc hρ).symm z, ?_, Homeomorph.apply_symm_apply _ _⟩ + change starMap (fun w => (ρ w)⁻¹) z ∈ _ + rw [mem_closedBall_zero_iff, starMap_form _ hz, norm_mul, Complex.norm_real, Circle.norm_coe, + mul_one, Real.norm_of_nonneg (mul_pos (inv_pos.mpr (hρ _)) (norm_pos_iff.mpr hz)).le] + have hp := hρ (unitOf z hz) + rw [inv_mul_le_iff₀ hp] + simpa using h + +theorem zero_mem_starDisc {ρ : Circle → ℝ} {hc : Continuous ρ} {hρ : ∀ w, 0 < ρ w} : + (0 : ℂ) ∈ starDisc hc hρ := + ⟨0, by simp, starHomeo_zero hc hρ⟩ + +theorem starDisc_subset_ball {ρ : Circle → ℝ} {hc : Continuous ρ} {hρ : ∀ w, 0 < ρ w} + (hlt : ∀ w, ρ w < 1) : starDisc hc hρ ⊆ ball 0 1 := by + intro z hz + rw [mem_ball_zero_iff] + by_cases h0 : z = 0 + · simp [h0] + · exact ((mem_starDisc h0).mp hz).trans_lt (hlt _) + +theorem isClosedDisc_starDisc {ρ : Circle → ℝ} (hc : Continuous ρ) (hρ : ∀ w, 0 < ρ w) : + IsClosedDisc (starDisc hc hρ) := + (isClosedDisc_image_injOn isClosedDisc_closedBall.1 (starHomeo hc hρ).continuous.continuousOn + (starHomeo hc hρ).injective.injOn).1 + +theorem discBd_starDisc {ρ : Circle → ℝ} (hc : Continuous ρ) (hρ : ∀ w, 0 < ρ w) : discBd + (starDisc hc hρ) = starHomeo hc hρ '' sphere 0 1 := by + have := (isClosedDisc_image_injOn isClosedDisc_closedBall.1 (starHomeo hc + hρ).continuous.continuousOn (starHomeo hc hρ).injective.injOn).2 + rwa [isClosedDisc_closedBall.2] at this + +/-- The boundary of a star disc is parametrized by its peaks, in the positive direction. -/ +theorem isPosParam_star {ρ : Circle → ℝ} (hc : Continuous ρ) (hρ : ∀ w, 0 < ρ w) : IsPosParam + (starDisc hc hρ) fun w => (ρ w : ℂ) * w := by + have hG : ∀ w : Circle, starHomeo hc hρ w = (fun w : Circle => (ρ w : ℂ) * w) w := fun w + => starMap_coe ρ w + have hφc : Continuous fun w : Circle => (ρ w : ℂ) * w := (Complex.continuous_ofReal.comp hc).mul + continuous_induced_dom + have himg := image_sphere_of_extension (starHomeo hc hρ) hG + have hr : range (fun w : Circle => (ρ w : ℂ) * w) = discBd (starDisc hc hρ) := by + rw [discBd_starDisc, himg] + refine ⟨hφc, fun a b h => ?_, hr, fun z hz => ?_⟩ + · have h' : starHomeo hc hρ a = starHomeo hc hρ b := by rw [hG, hG]; exact h + exact Circle.ext ((starHomeo hc hρ).injective h') + · rw [discInt_eq_of_extension (starHomeo hc hρ) hG hr rfl] at hz + obtain ⟨a, ha, rfl⟩ := hz + rw [wind_eq_of_ball (starHomeo hc hρ) hφc hG ha (mem_ball_self one_pos), starHomeo_zero] + have h0 : ∀ t : ℝ, (ρ (Circle.exp t) : ℂ) * (Circle.exp t) - 0 ≠ 0 := fun t => by + rw [sub_zero] + exact mul_ne_zero (by exact_mod_cast (hρ _).ne') (Circle.coe_ne_zero _) + have hang : IsAngle (fun t : ℝ => (ρ (Circle.exp t) : ℂ) * (Circle.exp t) - 0) fun t => t := by + refine ⟨continuous_id, fun t => ?_⟩ + simp only [sub_zero, norm_mul, Complex.norm_real, Circle.norm_coe, mul_one, + Real.norm_of_nonneg (hρ _).le] + rw [Circle.coe_exp] + rw [wind, hang.turn_eq h0] + have := Real.pi_pos + linarith + +/-- **Flowers.** Let `F` be a compact set off the ball of radius `ρ₀`, and let `w` be finitely many +directions, each with a point of `F` strictly inside the unit circle. Then some star disc inside +the open unit ball meets `F` in exactly its peaks in directions `u`, with `u y` as near to `w y` as +we like. -/ +theorem exists_flower {Y : Type} [Finite Y] {F : Set ℂ} (hF : IsCompact F) {ρ₀ : ℝ} (h0 : 0 < ρ₀) + (h1 : ρ₀ < 1) (hρ₀ : ∀ z ∈ F, ρ₀ < ‖z‖) {w : Y → Circle} (hw : Function.Injective w) + (ht : ∀ y, ∃ t : ℝ, 0 < t ∧ t < 1 ∧ (t : ℂ) * w y ∈ F) {δ : ℝ} (hδ : 0 < δ) : + ∃ ρ : Circle → ℝ, Continuous ρ ∧ (∀ x, 0 < ρ x ∧ ρ x < 1) ∧ ∃ u : Y + → Circle, Function.Injective u ∧ (∀ y, ‖(u y : ℂ) - w y‖ < δ) ∧ (∀ y, (ρ + (u y) : ℂ) * u y ∈ F) ∧ + ∀ z (hz : z ≠ 0), z ∈ F → ‖z‖ ≤ ρ (unitOf z hz) → ∃ y, z = (ρ (u y) : ℂ) * u y := by + classical + have := Fintype.ofFinite Y + have hne0 : ∀ z ∈ F, z ≠ 0 := fun z hz h => by + have := hρ₀ z hz + rw [h, norm_zero] at this + linarith + obtain ⟨L, hL0, hLδ, hLw⟩ : ∃ L : ℝ, 0 < L ∧ 1 / L < δ ∧ ∀ x y, x ≠ y → 2 / L < ‖(w x : ℂ) - w y‖ + := by + have hlim : ∀ c : ℝ, Tendsto (fun L : ℝ => c / L) atTop (𝓝 0) := fun c + => tendsto_const_nhds.div_atTop tendsto_id + have e1 : ∀ᶠ L : ℝ in atTop, 1 / L < δ := (hlim 1).eventually (gt_mem_nhds hδ) + have e2 : ∀ᶠ L : ℝ in atTop, ∀ x y, x ≠ y → 2 / L < ‖(w x : ℂ) - w y‖ := by + refine eventually_all.mpr fun x => eventually_all.mpr fun y => ?_ + by_cases hxy : x = y + · exact Eventually.of_forall fun L h => absurd hxy h + · have hp : 0 < ‖(w x : ℂ) - w y‖ := norm_pos_iff.mpr (sub_ne_zero.mpr fun h => hxy (hw + (Circle.ext h))) + exact ((hlim 2).eventually (gt_mem_nhds hp)).mono fun L hL _ => hL + obtain ⟨L, h1', h2', h3'⟩ := (e1.and (e2.and (eventually_gt_atTop 0))).exists + exact ⟨L, h3', h1', h2'⟩ + let dir : ℂ → ℂ := fun z => ((‖z‖ : ℝ) : ℂ)⁻¹ * z + have hdir : ∀ z (hz : z ≠ 0), dir z = unitOf z hz := fun z hz => (coe_unitOf z hz).symm + have hdc : ContinuousOn dir F := fun z hz => by + refine ContinuousAt.continuousWithinAt ?_ + have hn : ((‖z‖ : ℝ) : ℂ) ≠ 0 := by exact_mod_cast norm_ne_zero_iff.mpr (hne0 z hz) + exact ((Complex.continuous_ofReal.comp continuous_norm).continuousAt.inv₀ hn).mul + continuousAt_id + let Q : Y → ℂ → ℝ := fun y z => ‖z‖ + L * ‖dir z - w y‖ + have hQc : ∀ y, ContinuousOn (Q y) F := fun y => + continuous_norm.continuousOn.add (continuousOn_const.mul (hdc.sub continuousOn_const).norm) + have hmin : ∀ y, ∃ z ∈ F, IsMinOn (Q y) F z := fun y => by + obtain ⟨t, _, _, ht'⟩ := ht y + exact hF.exists_isMinOn ⟨_, ht'⟩ (hQc y) + choose z hzF hzmin using hmin + have hzne : ∀ y, z y ≠ 0 := fun y => hne0 _ (hzF y) + let u : Y → Circle := fun y => unitOf (z y) (hzne y) + have hdu : ∀ y, dir (z y) = u y := fun y => hdir _ _ + have hQ1 : ∀ y, Q y (z y) < 1 := fun y => by + obtain ⟨t, ht0, ht1, ht'⟩ := ht y + refine (hzmin y ht').trans_lt ?_ + have hne : (t : ℂ) * w y ≠ 0 := hne0 _ ht' + have h1 : dir ((t : ℂ) * w y) = w y := by rw [hdir _ hne, unitOf_mul t ht0 (w y) hne] + have h2 : ‖(t : ℂ) * w y‖ = t := by + rw [norm_mul, Complex.norm_real, Circle.norm_coe, mul_one, Real.norm_of_nonneg ht0.le] + change ‖(t : ℂ) * w y‖ + L * ‖dir ((t : ℂ) * w y) - w y‖ < 1 + rw [h1, h2, sub_self, norm_zero, mul_zero, add_zero] + exact ht1 + have hzn : ∀ y, ρ₀ < ‖z y‖ := fun y => hρ₀ _ (hzF y) + have hclose : ∀ y, L * ‖(u y : ℂ) - w y‖ < 1 := fun y => by + have := hQ1 y + have h2 : Q y (z y) = ‖z y‖ + L * ‖(u y : ℂ) - w y‖ := by simp only [Q, hdu] + rw [h2] at this + linarith [hzn y] + have hclose' : ∀ y, ‖(u y : ℂ) - w y‖ < 1 / L := fun y => by + rw [lt_div_iff₀ hL0] + linarith [hclose y] + let b : Option Y → Circle → ℝ := fun a x => match a with + | none => ρ₀ + | some y => Q y (z y) - L * ‖(x : ℂ) - w y‖ - ‖(x : ℂ) - u y‖ + let ρ : Circle → ℝ := fun x => Finset.univ.sup' Finset.univ_nonempty fun a => b a x + have hbc : ∀ a, Continuous (b a) := by + rintro (_ | y) + · exact continuous_const + · change Continuous fun x : Circle => Q y (z y) - L * ‖(x : ℂ) - w y‖ - ‖(x : ℂ) - u y‖ + have hcoe : Continuous fun x : Circle => (x : ℂ) := continuous_induced_dom + exact (continuous_const.sub (continuous_const.mul (hcoe.sub continuous_const).norm)).sub + (hcoe.sub continuous_const).norm + have hρc : Continuous ρ := Continuous.finset_sup'_apply Finset.univ_nonempty fun a _ => hbc a + have hle : ∀ a x, b a x ≤ ρ x := fun a x => Finset.le_sup' (fun a => b a x) (Finset.mem_univ a) + have hb1 : ∀ a x, b a x < 1 := by + rintro (_ | y) x + · exact h1 + · change Q y (z y) - L * ‖(x : ℂ) - w y‖ - ‖(x : ℂ) - u y‖ < 1 + have := mul_nonneg hL0.le (norm_nonneg ((x : ℂ) - w y)) + linarith [hQ1 y, norm_nonneg ((x : ℂ) - u y)] + have hρ0 : ∀ x, ρ₀ ≤ ρ x := fun x => hle none x + have hρ1 : ∀ x, ρ x < 1 := fun x => (Finset.sup'_lt_iff _).mpr fun a _ => hb1 a x + have hpeak : ∀ y, ρ (u y) = ‖z y‖ := fun y => by + refine le_antisymm (Finset.sup'_le _ _ ?_) ?_ + · rintro (_ | x) - + · exact (hzn y).le + · change Q x (z x) - L * ‖(u y : ℂ) - w x‖ - ‖(u y : ℂ) - u x‖ ≤ ‖z y‖ + by_cases hxy : x = y + · subst hxy + simp only [Q, hdu, sub_self, norm_zero] + linarith + · have h2 := hLw x y hxy + rw [div_lt_iff₀ hL0] at h2 + have htri : ‖(w x : ℂ) - w y‖ ≤ ‖(u y : ℂ) - w x‖ + ‖(u y : ℂ) - w y‖ := by + have : (w x : ℂ) - w y = ((u y : ℂ) - w y) - ((u y : ℂ) - w x) := by ring + rw [this] + exact (norm_sub_le _ _).trans (by rw [add_comm]) + have h3 := mul_le_mul_of_nonneg_right htri hL0.le + have h4 := hclose y + have h5 := hQ1 x + have h6 := norm_nonneg ((u y : ℂ) - u x) + nlinarith [hzn y] + · have := hle (some y) (u y) + refine le_trans (le_of_eq ?_) this + change ‖z y‖ = Q y (z y) - L * ‖(u y : ℂ) - w y‖ - ‖(u y : ℂ) - u y‖ + simp only [Q, hdu, sub_self, norm_zero] + ring + have hpk : ∀ y, (ρ (u y) : ℂ) * u y = z y := fun y => by + rw [hpeak] + exact norm_mul_unitOf _ _ + refine ⟨ρ, hρc, fun x => ⟨h0.trans_le (hρ0 x), hρ1 x⟩, u, fun x y he => ?_, fun y => + (hclose' y).trans hLδ, fun y => by rw [hpk]; exact hzF y, fun v hv hvF hvle => ?_⟩ + · by_contra hxy + have h2 := hLw x y hxy + have htri : ‖(w x : ℂ) - w y‖ ≤ ‖(u x : ℂ) - w x‖ + ‖(u y : ℂ) - w y‖ := by + have : (w x : ℂ) - w y = ((u y : ℂ) - w y) - ((u x : ℂ) - w x) := by rw [he]; ring + rw [this] + exact (norm_sub_le _ _).trans (by rw [add_comm]) + have h3 := hclose' x + have h4 := hclose' y + have : (2 : ℝ) / L = 1 / L + 1 / L := by ring + linarith + · obtain ⟨a, -, ha⟩ := Finset.exists_mem_eq_sup' Finset.univ_nonempty fun a => b a (unitOf v hv) + have ha' : ρ (unitOf v hv) = b a (unitOf v hv) := ha + rcases a with _ | y + · have : ρ (unitOf v hv) = ρ₀ := ha' + linarith [hρ₀ v hvF] + · refine ⟨y, ?_⟩ + have hb' : ρ (unitOf v hv) = Q y (z y) - L * ‖(unitOf v hv : ℂ) - w y‖ - ‖(unitOf v hv : ℂ) - + u y‖ := ha' + have hm : Q y (z y) ≤ Q y v := hzmin y hvF + have hQv : Q y v = ‖v‖ + L * ‖(unitOf v hv : ℂ) - w y‖ := by simp only [Q, hdir v hv] + have hzero : ‖(unitOf v hv : ℂ) - u y‖ = 0 := le_antisymm (by linarith) (norm_nonneg _) + have hequ : unitOf v hv = u y := Circle.ext (sub_eq_zero.mp (norm_eq_zero.mp hzero)) + have hQz : Q y (z y) = ‖z y‖ + L * ‖(u y : ℂ) - w y‖ := by simp only [Q, hdu] + rw [hpk, ← norm_mul_unitOf v hv, hequ] + have hnorm : ‖v‖ = ‖z y‖ := by + rw [hequ] at hQv hvle + rw [hpeak] at hvle + linarith + rw [hnorm] + exact norm_mul_unitOf _ _ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FragmentBridge.lean b/LeanPool/GraphMinor/GM19/FragmentBridge.lean new file mode 100644 index 0000000000..d1f924515e --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FragmentBridge.lean @@ -0,0 +1,328 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FragmentForm +public import LeanPool.GraphMinor.GM12.Section3PuncturedModel +public import LeanPool.GraphMinor.GM12.Section3BoundaryEquality +public import LeanPool.GraphMinor.Surface.CutIArc +public import LeanPool.GraphMinor.Surface.ModelCriterion +public import LeanPool.GraphMinor.GM19.CapModel +public import LeanPool.GraphMinor.GM19.Section5o + +/-! +# Two discs joined by a line + +Let `D₁` and `D₂` be disjoint closed discs of a closed connected surface `T`, joined by a line `L`. +Then `D₁ ∪ L ∪ D₂` is cellular: `T` without +this set is a surface homeomorphic to `T`, without a point (`isCell_bridge`). We remove the insides +of the two discs. Then `L` is a proper arc with ends in different cuffs. Cutting along it gives a +connected surface with one cuff, and with the same genus (`cutIArc`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric Filter GraphMinor.Surface GraphMinor.GM12 + +variable {T : Type} [TopologicalSpace T] [T2Space T] [ConnectedSpace T] + +private theorem cut_model_interior_image_is_open + {T : Type} + [TopologicalSpace T] + [T2Space T] + {D₁ : Set T} + {D₂ : Set T} + (h₁ : IsClosedDisc D₁) + (h₂ : IsClosedDisc D₂) + (Δ : Bool → Set T) + (hZout : (D₁ ∪ D₂)ᶜ ⊆ discComplement Δ) + (hZin : ∀ {x : T}, x ∈ discComplement Δ → x ∉ discBd D₁ → x ∉ discBd D₂ → x ∉ D₁ ∪ D₂) + (hbdZ : ∀ (z : ↑(discComplement Δ)), z ∈ bd ↑(discComplement Δ) ↔ ↑z ∈ discBd D₁ ∨ ↑z ∈ discBd + D₂) + (a₁ : ℕ) + (b₁ : ℕ) + [CompactSpace (SurfaceModel a₁ b₁ 1)] + (ψ' : SurfaceModel a₁ b₁ 1 → ↑(discComplement Δ)) + (F : Set (discComplement Δ)) (hψ' : IsCutMap ψ' F) + (hsoff : ∀ w ∉ bd (SurfaceModel a₁ b₁ 1), ψ' w ∉ F ∧ ψ' w ∉ bd + ↑(discComplement Δ)) : + ∀ u ⊆ (bd (SurfaceModel a₁ b₁ 1))ᶜ, IsOpen u → + IsOpen ((fun w => ((ψ' w : discComplement Δ) : T)) '' u) := by + intro u hu huo + have hop : IsOpen (ψ' '' u) := isOpen_image_of_isCutMap hψ' (fun w hw ↦ (hsoff w (hu hw)).1) huo + obtain ⟨O, hO, hOe⟩ := isOpen_induced_iff.1 hop + have hset : (fun w ↦ (ψ' w).1) '' u = O ∩ (D₁ ∪ D₂)ᶜ := by + ext x + constructor + · rintro ⟨w, hw, rfl⟩ + have hin : ψ' w ∈ ψ' '' u := mem_image_of_mem _ hw + rw [← hOe] at hin + have hb' := (hsoff w (hu hw)).2 + rw [hbdZ, not_or] at hb' + exact ⟨hin, hZin (ψ' w).2 hb'.1 hb'.2⟩ + · rintro ⟨hxO, hxn⟩ + have hin : (⟨x, hZout hxn⟩ : discComplement Δ) ∈ ψ' '' u := by + rw [← hOe] + exact hxO + obtain ⟨w, hw, he⟩ := hin + exact ⟨w, hw, congrArg Subtype.val he⟩ + rw [hset] + exact hO.inter (h₁.isClosed.union h₂.isClosed).isOpen_compl + +private theorem cut_model_interior_image_is_bridge_complement + {T : Type} + [TopologicalSpace T] + [T2Space T] + {D₁ : Set T} + {D₂ : Set T} + {L : Set T} + (Δ : Bool → Set T) + (hZout : (D₁ ∪ D₂)ᶜ ⊆ discComplement Δ) + (hZin : ∀ {x : T}, x ∈ discComplement Δ → x ∉ discBd D₁ → x ∉ discBd D₂ → x ∉ D₁ ∪ D₂) + (hbdZ : ∀ (z : ↑(discComplement Δ)), z ∈ bd ↑(discComplement Δ) ↔ ↑z ∈ discBd D₁ ∨ ↑z ∈ discBd + D₂) + (hFc : IsClosed ((Subtype.val : discComplement Δ → T) ⁻¹' L)) + (a₁ : ℕ) + (b₁ : ℕ) + [this : CompactSpace (SurfaceModel a₁ b₁ 1)] + (ψ' : SurfaceModel a₁ b₁ 1 → ↑(discComplement Δ)) + (hψ' : IsCutMap ψ' ((Subtype.val : discComplement Δ → T) ⁻¹' L)) + (hsoff : ∀ w ∉ bd (SurfaceModel a₁ b₁ 1), ψ' w ∉ ((Subtype.val : discComplement Δ → T) ⁻¹' L) ∧ + ψ' w ∉ bd + ↑(discComplement Δ)) : + (fun w => ↑(ψ' w)) '' (bd (SurfaceModel a₁ b₁ 1))ᶜ = (D₁ ∪ L ∪ D₂)ᶜ := by + let F := (Subtype.val : discComplement Δ → T) ⁻¹' L + ext x + constructor + · rintro ⟨w, hw, rfl⟩ + obtain ⟨hnF, hnb⟩ := hsoff w hw + rw [hbdZ, not_or] at hnb + have h₃ := hZin (ψ' w).2 hnb.1 hnb.2 + rintro ((h | h) | h) + · exact h₃ (Or.inl h) + · exact hnF h + · exact h₃ (Or.inr h) + · intro hx + have hx₁ : x ∉ D₁ ∪ D₂ := by + rintro (h | h) + · exact hx (Or.inl (Or.inl h)) + · exact hx (Or.inr h) + have hxL : x ∉ L := fun h ↦ hx (Or.inl (Or.inr h)) + obtain ⟨w, hw⟩ := hψ'.2.1 ⟨x, hZout hx₁⟩ + refine ⟨w, fun hb' ↦ ?_, congrArg Subtype.val hw⟩ + have hnF : ψ' w ∉ F := fun h ↦ hxL (by rw [hw] at h; exact h) + have := bd_of_bd_cutMap hψ' hFc hb' hnF + rw [hbdZ, hw] at this + rcases this with h | h + · exact hx₁ (Or.inl (Surface.discBd_subset _ h)) + · exact hx₁ (Or.inr (Surface.discBd_subset _ h)) + +theorem isCell_bridge (hT : IsClosedSurface T) {D₁ D₂ L : Set T} (h₁ : IsClosedDisc D₁) + (h₂ : IsClosedDisc D₂) (hd : Disjoint D₁ D₂) + {a b : T} (ha : a ∈ discBd D₁) (hb : b ∈ discBd D₂) (hl : IsLineWithEnds L a b) (hL₁ : L ∩ D₁ + = {a}) (hL₂ : L ∩ D₂ = {b}) : + IsCell T (D₁ ∪ L ∪ D₂) := by + classical + have : CompactSpace T := hT.1 + have hman : ∀ x : T, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + let Δ : Bool → Set T := fun i ↦ if i then D₁ else D₂ + have hΔ : ∀ i, IsClosedDisc (Δ i) := fun i ↦ by cases i <;> simpa [Δ] + have hdisj : Pairwise fun i j ↦ Disjoint (Δ i) (Δ j) := by + intro i j hij + cases i <;> cases j <;> simp_all [Δ, disjoint_comm] + have hZs := discComplement_isSurface hT Δ hΔ hdisj + have hZc : ConnectedSpace (discComplement Δ) := Subtype.connectedSpace + (discComplement_isConnected hT Δ hΔ hdisj) + obtain ⟨a₀, b₀, c₀, ⟨e₀⟩⟩ := classification T hT.isSurface inferInstance + have hc₀ : c₀ = 0 := by + have := numCuffs_eq e₀ + rw [numCuffs_model] at this + have hb : bd T = ∅ := eq_empty_of_forall_notMem fun x hx ↦ hx (hT.2.2 x) + rw [← this, numCuffs, cuffs, hb] + simp [componentsIn] + subst hc₀ + obtain ⟨e₁⟩ := discComplement_model_of_closed_model hT Δ hΔ hdisj e₀ + have hZcl : IsClosed (discComplement Δ) := isClosed_closure + have hun : (⋃ i, Δ i) = D₁ ∪ D₂ := by + ext x + simp [Δ, or_comm] + have hZout : (D₁ ∪ D₂)ᶜ ⊆ discComplement Δ := by + intro x hx + apply subset_closure + rwa [hun] + have hZin : ∀ {x}, x ∈ discComplement Δ → x ∉ discBd D₁ → x ∉ discBd D₂ → x ∉ D₁ ∪ D₂ := by + have key : ∀ {x D}, IsClosedDisc D → D ⊆ D₁ ∪ D₂ → x ∈ discComplement Δ → x ∉ discBd D → x ∉ D + := by + intro x D hD hsub hx hb hxD + obtain ⟨w, hw, hwn⟩ := _root_.mem_closure_iff.1 hx _ (hD.isOpen_discInt hman) ⟨hxD, hb⟩ + apply hwn + rw [hun] + exact hsub (discInt_subset D hw) + rintro x hx hb₁ hb₂ (h | h) + · exact key h₁ subset_union_left hx hb₁ h + · exact key h₂ subset_union_right hx hb₂ h + have hbdZ : ∀ z : discComplement Δ, z ∈ bd (discComplement Δ) ↔ z.1 ∈ discBd D₁ ∨ z.1 ∈ discBd D₂ + := by + intro z + rw [discComplement_boundary_eq hT Δ hΔ] + simp [Δ, or_comm] + have hb₁Z : discBd D₁ ⊆ discComplement Δ := disc_boundary_subset_discComplement hT Δ hΔ hdisj true + have hb₂Z : discBd D₂ ⊆ discComplement Δ := disc_boundary_subset_discComplement hT Δ hΔ hdisj + false + have ha₁ : a ∈ D₁ := Surface.discBd_subset _ ha + have hb₂ : b ∈ D₂ := Surface.discBd_subset _ hb + have hLZ : L ⊆ discComplement Δ := by + intro x hx + by_cases hx₁ : x ∈ D₁ + · have : x ∈ L ∩ D₁ := ⟨hx, hx₁⟩ + rw [hL₁] at this + rw [mem_singleton_iff.1 this] + exact hb₁Z ha + by_cases hx₂ : x ∈ D₂ + · have : x ∈ L ∩ D₂ := ⟨hx, hx₂⟩ + rw [hL₂] at this + rw [mem_singleton_iff.1 this] + exact hb₂Z hb + · exact hZout (by simp [hx₁, hx₂]) + have hLc : IsClosed L := by + obtain ⟨f, -, -⟩ := hl + have : L = range fun t ↦ (f t).1 := by + ext x + constructor + · intro hx + exact ⟨f.symm ⟨x, hx⟩, by simp⟩ + · rintro ⟨t, rfl⟩ + exact (f t).2 + rw [this] + exact (isCompact_range (continuous_subtype_val.comp f.continuous)).isClosed + have hLa : a ∈ L := by + have : a ∈ L ∩ D₁ := by rw [hL₁]; rfl + exact this.1 + have hLb : b ∈ L := by + have : b ∈ L ∩ D₂ := by rw [hL₂]; rfl + exact this.1 + let a' : discComplement Δ := ⟨a, hLZ hLa⟩ + let b' : discComplement Δ := ⟨b, hLZ hLb⟩ + set F : Set (discComplement Δ) := Subtype.val ⁻¹' L with hF + have hFc : IsClosed F := hLc.preimage continuous_subtype_val + have hab : a ≠ b := fun h ↦ disjoint_left.1 hd ha₁ (h ▸ hb₂) + have hne : a' ≠ b' := fun h ↦ hab (congrArg Subtype.val h) + have hline : IsLineWithEnds F a' b' := by + refine isLine_comap (j := Subtype.val) hZcl.isClosedEmbedding_subtypeVal ?_ + have : (Subtype.val : discComplement Δ → T) '' F = L := by + rw [hF, Subtype.image_preimage_coe] + exact inter_eq_right.2 hLZ + rw [this] + exact hl + have hFbd : F ∩ bd (discComplement Δ) = {a', b'} := by + ext z + constructor + · rintro ⟨hz, hzb⟩ + rcases (hbdZ z).1 hzb with h | h + · have : z.1 ∈ L ∩ D₁ := ⟨hz, Surface.discBd_subset _ h⟩ + rw [hL₁] at this + exact Or.inl (Subtype.ext this) + · have : z.1 ∈ L ∩ D₂ := ⟨hz, Surface.discBd_subset _ h⟩ + rw [hL₂] at this + exact Or.inr (Subtype.ext this) + · rintro (rfl | h) + · exact ⟨hLa, (hbdZ _).2 (Or.inl ha)⟩ + · rw [mem_singleton_iff.1 h] + exact ⟨hLb, (hbdZ _).2 (Or.inr hb)⟩ + have ha'b : a' ∈ bd (discComplement Δ) := (hbdZ _).2 (Or.inl ha) + have hb'b : b' ∈ bd (discComplement Δ) := (hbdZ _).2 (Or.inr hb) + have hcuffs : connectedComponentIn (bd (discComplement Δ)) a' ≠ connectedComponentIn (bd + (discComplement Δ)) b' := by + intro he + have hmem : connectedComponentIn (bd (discComplement Δ)) a' ∈ cuffs (discComplement Δ) + := mem_image_of_mem _ ha'b + rw [discComplement_cuffs_eq hT Δ hΔ hdisj] at hmem + obtain ⟨i, hi⟩ := hmem + have h₁' : a ∈ discBd (Δ i) := by + have : a' ∈ (Subtype.val : discComplement Δ → T) ⁻¹' discBd (Δ i) := by + have hi' := hi + simp only at hi' + rw [hi'] + exact mem_connectedComponentIn ha'b + exact this + have h₂' : b ∈ discBd (Δ i) := by + have : b' ∈ (Subtype.val : discComplement Δ → T) ⁻¹' discBd (Δ i) := by + have hi' := hi + simp only at hi' + rw [hi', he] + exact mem_connectedComponentIn hb'b + exact this + cases i + · exact disjoint_left.1 hd ha₁ (Surface.discBd_subset _ (by simpa [Δ] using h₁')) + · exact disjoint_left.1 hd (Surface.discBd_subset _ (by simpa [Δ] using h₂')) hb₂ + obtain ⟨S', tS', ψ, hS', hcut, hdiff, -, -⟩ := cutIArc _ F a' b' hZs hZc hne hFbd hline + obtain ⟨hS'c, a₁, b₁, c₁, ⟨e₂⟩, ⟨e₃⟩⟩ := hdiff hcuffs + obtain ⟨hc, h2, hb0⟩ := (modelCriterion.2 _ _ _ _ _ _).1 ⟨e₂.symm.trans e₁⟩ + have hc₁ : c₁ = 1 := by + simp only [Nat.card_eq_fintype_card, Fintype.card_bool] at hc + omega + subst hc₁ + obtain ⟨f⟩ := (modelCriterion.2 a₁ b₁ 0 a₀ b₀ 0).2 ⟨rfl, h2, hb0⟩ + obtain ⟨cap⟩ := nonempty_capped_model a₁ b₁ 1 + have hW : IsSurface (SurfaceModel a₁ b₁ 1) := (modelCriterion.1 a₁ b₁ 1).1 + have : T2Space (SurfaceModel a₁ b₁ 1) := (presents_ew a₁ b₁ 1).1 + have : ConnectedSpace (SurfaceModel a₁ b₁ 1) := (modelCriterion.1 a₁ b₁ 1).2 + have : CompactSpace (SurfaceModel a₁ b₁ 1) := hW.1 + obtain ⟨e₄, Q, hQ, hs₄, ht₄, hn⟩ := exists_cap_chart hW cap + rw [numCuffs_model] at hn + have hψc : IsCutMap ψ F := IsCutting.isCutMap hcut + let ψ' : SurfaceModel a₁ b₁ 1 → discComplement Δ := ψ ∘ e₃.symm + have hψ' : IsCutMap ψ' F := by + refine ⟨hψc.1.comp e₃.symm.continuous, hψc.2.1.comp e₃.symm.surjective, ?_, ?_, ?_⟩ + · intro x hx y hy hxy + exact e₃.symm.injective (hψc.2.2.1 hx hy hxy) + · intro x + have : ψ' ⁻¹' {x} = e₃ '' (ψ ⁻¹' {x}) := by + ext w + constructor + · intro hw + exact ⟨e₃.symm w, hw, e₃.apply_symm_apply w⟩ + · rintro ⟨u, hu, rfl⟩ + simpa [ψ'] using hu + rw [this] + exact (hψc.2.2.2.1 x).image _ + · intro w hw + have h := hψc.2.2.2.2 hw + have : e₃ (e₃.symm w) ∈ e₃ '' bd S' := mem_image_of_mem _ h + rw [e₃.apply_symm_apply, image_bd_homeomorph] at this + exact this + have hcZ : CompactSpace (discComplement Δ) := isCompact_iff_compactSpace.1 hZcl.isCompact + have hbW : IsClosed (bd (SurfaceModel a₁ b₁ 1)) := (cuff_statement _ hW).1 + have hsoff : ∀ w, w ∉ bd (SurfaceModel a₁ b₁ 1) → ψ' w ∉ F ∧ ψ' w ∉ bd (discComplement Δ) := by + intro w hw + have hnF : ψ' w ∉ F := fun h ↦ hw (hψ'.2.2.2.2 h) + have hint : IsInteriorPoint w := by + by_contra h + exact hw h + exact ⟨hnF, fun h ↦ h (isInteriorPoint_image hψ' hFc hint hnF)⟩ + have hinjS : InjOn ψ' (bd (SurfaceModel a₁ b₁ 1))ᶜ := hψ'.2.2.1.mono fun w hw ↦ (hsoff w hw).1 + have hopen : ∀ u ⊆ (bd (SurfaceModel a₁ b₁ 1))ᶜ, IsOpen u → IsOpen ((fun w ↦ (ψ' w).1) '' u) := by + exact cut_model_interior_image_is_open (T := T) (D₁ := D₁) (D₂ := D₂) h₁ h₂ Δ hZout hZin hbdZ + a₁ b₁ ψ' F hψ' hsoff + have himg : (fun w ↦ (ψ' w).1) '' (bd (SurfaceModel a₁ b₁ 1))ᶜ = (D₁ ∪ L ∪ D₂)ᶜ := by + exact cut_model_interior_image_is_bridge_complement (T := T) (D₁ := D₁) (D₂ := D₂) (L := L) Δ + hZout hZin hbdZ hFc a₁ b₁ ψ' hψ' hsoff + obtain ⟨e₅, hs₅, ht₅, hf₅⟩ := exists_oph (f := fun w ↦ (ψ' w).1) (s := (bd + (SurfaceModel a₁ b₁ 1))ᶜ) + (t := (D₁ ∪ L ∪ D₂)ᶜ) hbW.isOpen_compl (continuous_subtype_val.comp hψ'.1).continuousOn + (fun x hx y hy hxy ↦ hinjS hx hy (Subtype.ext hxy)) hopen himg + refine ⟨SurfaceModel a₁ b₁ 0, inferInstance, e₅.symm.trans' e₄ (by simp [hs₅, hs₄]), Q, + cap.isClosedSurface, + ⟨f.trans e₀.symm⟩, hQ, hn.le, ?_, ?_⟩ + · simp [ht₅] + · simp [ht₄] + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FragmentCapping.lean b/LeanPool/GraphMinor/GM19/FragmentCapping.lean new file mode 100644 index 0000000000..2134bdd8e4 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FragmentCapping.lean @@ -0,0 +1,362 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FragmentCollapse +public import LeanPool.GraphMinor.GM19.CutFragment +public import LeanPool.GraphMinor.Surface.DiscMerge +public import Mathlib.Topology.ExtendFrom +public import Mathlib.Analysis.Normed.Module.Connected +import LeanPool.GraphMinor.Surface.TriLocal + +/-! +# The capping of a surface depends only on its interior + +Let `W` be a surface and `T` a closed surface. Suppose that the inside of `W` is homeomorphic to `T` +without a finite set `P`. +Then each capping of `W` is homeomorphic to `T`, and `W` has `|P|` cuffs (`capping_homeo`). The +reason: by +`exists_collapse` the inside of `W` is also a capping of `W` without a finite set of points, one +point for each cuff. And a +homeomorphism between two closed surfaces without finite sets extends over these sets +(`exists_homeomorph_of_punctures`), +since a small punctured neighbourhood of a point is connected. + +This is the tool that identifies the capping of a fragment, also when the fragment has a corner, or +two sides of a cut +that touches a cuff. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric Filter GraphMinor.Surface + +section Oph + +variable {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + +/-- A continuous open injective map on an open set is a partial homeomorphism. -/ +theorem exists_oph [Nonempty X] {f : X → Y} {s : Set X} {t : Set Y} (hs : IsOpen s) + (hf : ContinuousOn f s) + (hi : InjOn f s) (ho : ∀ u ⊆ s, IsOpen u → IsOpen (f '' u)) (ht : f '' s = t) : + ∃ e : OpenPartialHomeomorph X Y, e.source = s ∧ e.target = t ∧ EqOn e f s := by + classical + let E : PartialEquiv X Y := hi.toPartialEquiv f s + have hE : E.source = s := rfl + have hEt : E.target = t := by rw [← ht]; rfl + refine ⟨OpenPartialHomeomorph.ofContinuousOpenRestrict E hf ?_ hs, hE, hEt, fun _ _ ↦ rfl⟩ + intro u hu + have := ho (Subtype.val '' u) (by rintro _ ⟨x, -, rfl⟩; exact x.2) (hs.isOpenMap_subtype_val _ hu) + rw [image_image] at this + exact this + +theorem IsCollapse.exists_oph [T2Space X] [CompactSpace X] [Nonempty X] {c : C(X, X)} {A P : Set X} + (h : IsCollapse c A P) : + ∃ e : OpenPartialHomeomorph X X, e.source = Aᶜ ∧ e.target = Pᶜ ∧ EqOn e c Aᶜ := by + have hA : A = c ⁻¹' P := Subset.antisymm (fun x hx ↦ h.mapsTo hx) h.preimage + have hcl : IsClosed A := hA ▸ h.finite.isClosed.preimage c.continuous + refine GM19.exists_oph hcl.isOpen_compl c.continuous.continuousOn h.injOn (fun u hu huo ↦ ?_) ?_ + · have hcm : IsClosedMap c := c.continuous.isClosedMap + have : c '' u = (c '' uᶜ)ᶜ := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ ⟨z, hz, he⟩ + by_cases hzA : z ∈ A + · exact hu hx (hA ▸ (show c x ∈ P from he ▸ h.mapsTo hzA)) + · exact hz (h.injOn hzA (hu hx) he ▸ hx) + · intro hy + obtain ⟨x, rfl⟩ := h.surjective y + by_cases hxu : x ∈ u + · exact ⟨x, hxu, rfl⟩ + · exact absurd ⟨x, hxu, rfl⟩ hy + rw [this] + exact (hcm _ huo.isClosed_compl).isOpen_compl + · ext y + constructor + · rintro ⟨x, hx, rfl⟩ hy + exact hx (h.preimage hy) + · intro hy + obtain ⟨x, rfl⟩ := h.surjective y + exact ⟨x, fun hx ↦ hy (h.mapsTo hx), rfl⟩ + +end Oph + +section Punctures + +variable {T : Type*} [TopologicalSpace T] + +/-- The punctured complex unit disc is preconnected. -/ +theorem isPreconnected_ball_sdiff : IsPreconnected (ball (0 : ℂ) 1 \ {0}) := + Surface.punctured_unit_ball + +/-- An interior point has small neighbourhoods that stay connected when the point is removed. -/ +theorem exists_punctured {x : T} (hx : IsInteriorPoint x) {W : Set T} (hW : W ∈ 𝓝 x) : + ∃ N, IsOpen N ∧ x ∈ N ∧ N ⊆ W ∧ IsPreconnected (N \ {x}) ∧ (N \ {x}).Nonempty := by + obtain ⟨U, h, g, c, hU, h0⟩ := hx.exists_ballChart isOpen_interior (mem_interior_iff_mem_nhds.2 + hW) one_pos + have h0m : (0 : ℂ) ∈ ball (0 : ℂ) 1 := by simp + have hxU : x ∈ U := h0 ▸ c.gm h0m + have heq : U \ {x} = g '' (ball 0 1 \ {0}) := by + ext y + constructor + · rintro ⟨hy, hne⟩ + refine ⟨h y, ⟨c.hm hy, fun h1 ↦ hne ?_⟩, c.gh hy⟩ + rw [← c.gh hy, h1, h0] + rfl + · rintro ⟨z, ⟨hz, hz0⟩, rfl⟩ + refine ⟨c.gm hz, fun he ↦ hz0 ?_⟩ + have h1 : h (g z) = z := c.hg hz + have h2 : h (g 0) = 0 := c.hg h0m + rw [show g z = g 0 from he.trans h0.symm] at h1 + exact h1.symm.trans h2 + refine ⟨U, c.isOpen, hxU, hU.trans interior_subset, ?_, ?_⟩ + · rw [heq] + exact isPreconnected_ball_sdiff.image _ (c.gc.mono sdiff_subset) + · rw [heq] + refine ⟨g (1 / 2), _, ⟨?_, ?_⟩, rfl⟩ + · simp; norm_num + · simp + +theorem neBot_punctured (hT : ∀ x : T, IsInteriorPoint x) (x : T) : (𝓝[≠] x).NeBot := by + rw [← mem_closure_iff_nhdsWithin_neBot, mem_closure_iff_nhds] + intro W hW + obtain ⟨N, -, -, hN, -, ⟨y, hy, hne⟩⟩ := exists_punctured (hT x) hW + exact ⟨y, hN hy, hne⟩ + +theorem dense_compl_finite [T1Space T] (hT : ∀ x : T, IsInteriorPoint x) {P : Set T} + (hP : P.Finite) : Dense Pᶜ := by + have := neBot_punctured hT + rw [compl_eq_univ_sdiff] + exact dense_univ.sdiff_finite hP + +variable {T₂ : Type*} [TopologicalSpace T₂] + +/-- Near a removed point `p`, the map `e` stays near one removed point of the target. -/ +theorem exists_eventually_mem [T2Space T] [CompactSpace T₂] + (hT : ∀ x : T, IsInteriorPoint x) {P₁ : Set T} {P₂ : Set T₂} + (hP₁ : P₁.Finite) (e : OpenPartialHomeomorph T T₂) (hs : e.source = P₁ᶜ) (ht : e.target + = P₂ᶜ) {p : T} + (hp : p ∈ P₁) {U : T₂ → Set T₂} (hU : ∀ q ∈ P₂, IsOpen (U q) ∧ q ∈ U q) + (hd : P₂.PairwiseDisjoint U) : + ∃ q ∈ P₂, ∀ᶠ x in 𝓝[P₁ᶜ] p, e x ∈ U q := by + classical + set O : Set T₂ := ⋃ q ∈ P₂, U q with hO + have hOo : IsOpen O := isOpen_biUnion fun q hq ↦ (hU q hq).1 + have hsubt : Oᶜ ⊆ e.target := by + rw [ht] + intro y hy hq + exact hy (mem_biUnion hq (hU y hq).2) + have hK : IsCompact (e.symm '' Oᶜ) := hOo.isClosed_compl.isCompact.image_of_continuousOn + (e.continuousOn_symm.mono hsubt) + have hKs : e.symm '' Oᶜ ⊆ P₁ᶜ := by + rintro _ ⟨y, hy, rfl⟩ + rw [← hs] + exact e.map_target (hsubt hy) + have hW : (e.symm '' Oᶜ)ᶜ ∩ (P₁ \ {p})ᶜ ∈ 𝓝 p := by + refine inter_mem (hK.isClosed.isOpen_compl.mem_nhds fun h ↦ hKs h hp) ?_ + exact (hP₁.subset sdiff_subset).isClosed.isOpen_compl.mem_nhds fun h ↦ h.2 rfl + obtain ⟨N, hNo, hpN, hNW, hNc, ⟨a₀, ha₀⟩⟩ := exists_punctured (hT p) hW + have hA : N \ {p} ⊆ P₁ᶜ := fun x hx hxP ↦ (hNW hx.1).2 ⟨hxP, hx.2⟩ + have hAO : e '' (N \ {p}) ⊆ O := by + rintro _ ⟨x, hx, rfl⟩ + by_contra hn + refine (hNW hx.1).1 ⟨e x, hn, ?_⟩ + exact e.left_inv (hs ▸ hA hx) + obtain ⟨q₀, hq₀, ha⟩ := mem_iUnion₂.1 (hAO ⟨a₀, ha₀, rfl⟩) + have hconn : IsPreconnected (e '' (N \ {p})) := + hNc.image _ (e.continuousOn.mono (hs ▸ hA)) + have hsub : e '' (N \ {p}) ⊆ U q₀ := by + refine hconn.subset_left_of_subset_union (hU q₀ hq₀).1 (v := ⋃ q ∈ P₂ \ {q₀}, U q) + (isOpen_biUnion fun q hq ↦ (hU q hq.1).1) ?_ (fun y hy ↦ ?_) ⟨_, ⟨a₀, ha₀, rfl⟩, ha⟩ + · refine disjoint_iUnion₂_right.2 fun q hq ↦ ?_ + exact hd hq₀ hq.1 (fun h ↦ hq.2 h.symm) + · obtain ⟨q, hq, hy'⟩ := mem_iUnion₂.1 (hAO hy) + by_cases hqe : q = q₀ + · exact Or.inl (hqe ▸ hy') + · exact Or.inr (mem_biUnion (show q ∈ P₂ \ {q₀} from ⟨hq, hqe⟩) hy') + refine ⟨q₀, hq₀, ?_⟩ + have hmem : N ∩ P₁ᶜ ∈ 𝓝[P₁ᶜ] p := by + rw [inter_comm] + exact inter_mem_nhdsWithin _ (hNo.mem_nhds hpN) + refine mem_of_superset hmem fun x hx ↦ hsub ⟨x, ⟨hx.1, fun h ↦ hx.2 (h ▸ hp)⟩, rfl⟩ + +/-- Near a removed point `p`, the map `e` tends to a removed point of the target. -/ +theorem exists_tendsto_puncture [T2Space T] [T2Space T₂] [CompactSpace T₂] + (hT : ∀ x : T, IsInteriorPoint x) {P₁ : Set T} {P₂ : Set T₂} + (hP₁ : P₁.Finite) (hP₂ : P₂.Finite) (e : OpenPartialHomeomorph T T₂) (hs : e.source = P₁ᶜ) + (ht : e.target = P₂ᶜ) {p : T} + (hp : p ∈ P₁) : ∃ q ∈ P₂, Tendsto e (𝓝[P₁ᶜ] p) (𝓝 q) := by + classical + have : (𝓝[P₁ᶜ] p).NeBot := mem_closure_iff_nhdsWithin_neBot.1 ((dense_compl_finite hT hP₁) p) + obtain ⟨U, hU, hd⟩ := hP₂.t2_separation + obtain ⟨q, hq, hev⟩ := exists_eventually_mem hT hP₁ e hs ht hp (U := U) (fun q _ ↦ ⟨(hU q).2, + (hU q).1⟩) hd + refine ⟨q, hq, tendsto_nhds.2 fun V hV hqV ↦ ?_⟩ + let U' : T₂ → Set T₂ := fun r ↦ if r = q then U r ∩ V else U r + have hsub : ∀ r, U' r ⊆ U r := fun r ↦ by + by_cases h : r = q + · simp only [U', ite_eq_left h] + exact inter_subset_left + · simp only [U', ite_eq_right h] + rfl + have hU' : ∀ r ∈ P₂, IsOpen (U' r) ∧ r ∈ U' r := fun r _ ↦ by + by_cases h : r = q + · simp only [U', ite_eq_left h] + exact ⟨(hU r).2.inter hV, (hU r).1, h ▸ hqV⟩ + · simp only [U', ite_eq_right h] + exact ⟨(hU r).2, (hU r).1⟩ + obtain ⟨r, hr, hev'⟩ := exists_eventually_mem hT hP₁ e hs ht hp hU' + (fun a ha b hb hab ↦ (hd ha hb hab).mono (hsub a) (hsub b)) + have hrq : r = q := by + by_contra hne + obtain ⟨x, hx, hx'⟩ := (hev.and hev').exists + exact disjoint_left.1 (hd hq hr (Ne.symm hne)) hx (hsub r hx') + subst hrq + refine hev'.mono fun x hx ↦ ?_ + simp only [U', ite_true] at hx + exact hx.2 + +theorem tendsto_of_source {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + (e : OpenPartialHomeomorph X Y) {A : Set X} + (hA : e.source = A) (hX : ∀ x ∉ A, ∃ y, Tendsto e (𝓝[A] x) (𝓝 y)) (x : X) : ∃ y, Tendsto e + (𝓝[A] x) (𝓝 y) := by + by_cases hx : x ∈ A + · exact ⟨e x, (e.continuousOn x (hA ▸ hx)).mono_left (by rw [hA])⟩ + · exact hX x hx + +/-- A homeomorphism between two closed surfaces without finite sets extends to a homeomorphism of +the closed surfaces. -/ +theorem exists_homeomorph_of_punctures [T2Space T] [T2Space T₂] [CompactSpace T] [CompactSpace T₂] + (hT : ∀ x : T, IsInteriorPoint x) + (hT₂ : ∀ x : T₂, IsInteriorPoint x) {P₁ : Set T} {P₂ : Set T₂} (hP₁ : P₁.Finite) + (hP₂ : P₂.Finite) + (e : OpenPartialHomeomorph T T₂) (hs : e.source = P₁ᶜ) (ht : e.target = P₂ᶜ) : + ∃ f : T ≃ₜ T₂, EqOn f e P₁ᶜ ∧ f '' P₁ = P₂ := by + classical + have hd₁ := dense_compl_finite hT hP₁ + have hd₂ := dense_compl_finite hT₂ hP₂ + have h₁ : ∀ x, ∃ y, Tendsto e (𝓝[P₁ᶜ] x) (𝓝 y) := tendsto_of_source e hs fun x hx ↦ by + obtain ⟨q, -, h⟩ := exists_tendsto_puncture hT hP₁ hP₂ e hs ht (not_not.1 hx) + exact ⟨q, h⟩ + have h₂ : ∀ x, ∃ y, Tendsto e.symm (𝓝[P₂ᶜ] x) (𝓝 y) := tendsto_of_source e.symm + (by simpa using ht) fun x hx ↦ by + obtain ⟨q, -, h⟩ := exists_tendsto_puncture hT₂ hP₂ hP₁ e.symm (by simpa using ht) + (by simpa using hs) (not_not.1 hx) + exact ⟨q, h⟩ + have hc₁ : Continuous (extendFrom P₁ᶜ e) := continuous_extendFrom hd₁ h₁ + have hc₂ : Continuous (extendFrom P₂ᶜ e.symm) := continuous_extendFrom hd₂ h₂ + have he₁ : ∀ x ∈ P₁ᶜ, extendFrom P₁ᶜ e x = e x := extendFrom_extends (hs ▸ e.continuousOn) + have he₂ : ∀ x ∈ P₂ᶜ, extendFrom P₂ᶜ e.symm x = e.symm x := extendFrom_extends + (ht ▸ e.continuousOn_symm) + have hl : ∀ x, extendFrom P₂ᶜ e.symm (extendFrom P₁ᶜ e x) = x := by + refine congrFun (Continuous.ext_on hd₁ (hc₂.comp hc₁) continuous_id fun x hx ↦ ?_) + rw [he₁ x hx, he₂ _ (ht ▸ e.map_source (hs ▸ hx)), e.left_inv (hs ▸ hx)] + have hr : ∀ x, extendFrom P₁ᶜ e (extendFrom P₂ᶜ e.symm x) = x := by + refine congrFun (Continuous.ext_on hd₂ (hc₁.comp hc₂) continuous_id fun x hx ↦ ?_) + rw [he₂ x hx, he₁ _ (hs ▸ e.map_target (ht ▸ hx)), e.right_inv (ht ▸ hx)] + have hm₁ : ∀ p ∈ P₁, extendFrom P₁ᶜ e p ∈ P₂ := fun p hp ↦ by + obtain ⟨q, hq, h⟩ := exists_tendsto_puncture hT hP₁ hP₂ e hs ht hp + rw [extendFrom_eq (hd₁ p) h] + exact hq + have hm₂ : ∀ p ∈ P₂, extendFrom P₂ᶜ e.symm p ∈ P₁ := fun p hp ↦ by + obtain ⟨q, hq, h⟩ := exists_tendsto_puncture hT₂ hP₂ hP₁ e.symm (by simpa using ht) + (by simpa using hs) hp + rw [extendFrom_eq (hd₂ p) h] + exact hq + refine ⟨⟨⟨_, _, hl, hr⟩, hc₁, hc₂⟩, he₁, ?_⟩ + apply Subset.antisymm + · rintro _ ⟨p, hp, rfl⟩ + exact hm₁ p hp + · intro q hq + exact ⟨_, hm₂ q hq, hr q⟩ + +end Punctures + +section Capping + + + +variable {W What : Type} [TopologicalSpace W] [T2Space W] [TopologicalSpace What] + +omit [T2Space W] in +/-- The inside of a surface is a capping without finitely many points, one point for each cuff. -/ +theorem exists_cap_chart [Nonempty W] (hW : IsSurface W) (cap : IsCappedSurface W What) : + ∃ (e : OpenPartialHomeomorph W What) (P : Set What), P.Finite ∧ e.source = (bd W)ᶜ ∧ e.target + = Pᶜ ∧ + P.ncard = numCuffs W := by + classical + have hT := cap.isClosedSurface + have : T2Space What := hT.2.1 + have : CompactSpace What := hT.1 + have hfc : (cuffs W).Finite := (cuff_statement W hW).2.1 + let 𝓐 : Set (Set What) := (fun Θ ↦ closure (cap.cuffDisc Θ)) '' cuffs W + have hne : ∀ Θ ∈ cuffs W, (closure (cap.cuffDisc Θ)).Nonempty := fun Θ hΘ ↦ + (cap.cuffDisc_closedDisc Θ hΘ).nonempty_discInt.mono (discInt_subset _) + have hinj : InjOn (fun Θ ↦ closure (cap.cuffDisc Θ)) (cuffs W) := fun Θ₁ h₁ Θ₂ h₂ he ↦ by + by_contra hn + have hd := cap.cuffDisc_disjoint Θ₁ h₁ Θ₂ h₂ hn + simp only at he + rw [← he, disjoint_self] at hd + exact (hne Θ₁ h₁).ne_empty (by simpa using hd) + have hpd : 𝓐.PairwiseDisjoint id := by + rintro _ ⟨Θ₁, h₁, rfl⟩ _ ⟨Θ₂, h₂, rfl⟩ hn + exact cap.cuffDisc_disjoint Θ₁ h₁ Θ₂ h₂ fun h ↦ hn (h ▸ rfl) + have : Nonempty What := cap.connected.toNonempty + obtain ⟨c, P, q, hc, -, rfl, hqi⟩ := exists_collapse hT (hfc.image _) + (by rintro _ ⟨Θ, hΘ, rfl⟩; exact cap.cuffDisc_closedDisc Θ hΘ) hpd + have hU : (⋃₀ 𝓐)ᶜ = cap.emb '' (bd W)ᶜ := by + rw [← cap.compl_eq_image, sUnion_image] + have hUo : IsOpen (⋃₀ 𝓐)ᶜ := by + refine (Set.Finite.isClosed_sUnion (hfc.image _) ?_).isOpen_compl + rintro _ ⟨Θ, -, rfl⟩ + exact isClosed_closure + have ho : ∀ u ⊆ (bd W)ᶜ, IsOpen u → IsOpen (cap.emb '' u) := fun u hu huo ↦ by + obtain ⟨O, hO, rfl⟩ := cap.isEmbedding.isInducing.isOpen_iff.1 huo + have : cap.emb '' (cap.emb ⁻¹' O) = O ∩ (⋃₀ 𝓐)ᶜ := by + apply Subset.antisymm + · rintro _ ⟨x, hx, rfl⟩ + exact ⟨hx, hU ▸ mem_image_of_mem _ (hu hx)⟩ + · rintro y ⟨hy, hy'⟩ + rw [hU] at hy' + obtain ⟨x, -, rfl⟩ := hy' + exact ⟨x, hy, rfl⟩ + rw [this] + exact hO.inter hUo + obtain ⟨e₁, hs₁, ht₁, -⟩ := GM19.exists_oph (f := cap.emb) (cuff_statement W hW).1.isOpen_compl + cap.isEmbedding.continuous.continuousOn cap.isEmbedding.injective.injOn ho hU.symm + obtain ⟨e₂, hs₂, ht₂, -⟩ := hc.exists_oph + refine ⟨e₁.trans' e₂ (ht₁.trans hs₂.symm), q '' 𝓐, (hfc.image _).image _, hs₁, ht₂, ?_⟩ + rw [numCuffs, InjOn.ncard_image hqi, InjOn.ncard_image hinj] + +omit [T2Space W] in +/-- **The capping depends only on the inside.** If the inside of `W` is a closed surface `T` without +a finite set `P`, then +each capping of `W` is homeomorphic to `T`, and `W` has `|P|` cuffs. -/ +theorem capping_homeo {T : Type*} [TopologicalSpace T] [Nonempty W] (hW : IsSurface W) + (cap : IsCappedSurface W What) + (hT : IsClosedSurface T) {P : Set T} (hP : P.Finite) (e : OpenPartialHomeomorph W T) + (hs : e.source = (bd W)ᶜ) + (ht : e.target = Pᶜ) : Nonempty (What ≃ₜ T) ∧ numCuffs W = P.ncard := by + obtain ⟨e₁, Q, hQ, hs₁, ht₁, hn⟩ := exists_cap_chart hW cap + have hC := cap.isClosedSurface + have : T2Space What := hC.2.1 + have : CompactSpace What := hC.1 + have : T2Space T := hT.2.1 + have : CompactSpace T := hT.1 + obtain ⟨f, -, hf⟩ := exists_homeomorph_of_punctures hC.2.2 hT.2.2 hQ hP (e₁.symm.trans' e + (by simp [hs₁, hs])) + (by simp [ht₁]) (by simp [ht]) + refine ⟨⟨f⟩, ?_⟩ + rw [← hn, ← hf, f.injective.injOn.ncard_image] + +end Capping + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FragmentChord.lean b/LeanPool/GraphMinor/GM19/FragmentChord.lean new file mode 100644 index 0000000000..b7a23cfcca --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FragmentChord.lean @@ -0,0 +1,407 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FragmentShape +import LeanPool.GraphMinor.GM19.Section6Cuff + +/-! +# A chord that passes along an inner disc + +Let `D₀` lie inside the closed disc `D₁`. A straight line of a chart of `D₁` through a point inside +`D₀` leaves `D₀` for the last time at +two boundary points of `D₀`. The two outer pieces of this line and one arc of the boundary of `D₀` +form a chord of `D₁`. So `D₁` has a +closed subdisc `Δ` that holds `D₀`, shares an arc of its boundary with `D₀`, and shares an arc of +its boundary with `D₁` +(`exists_nested_chord`). This links the direction of the boundary of `D₀` to the direction of the +boundary of `D₁`, in the proof of +`FragmentOrientationStatement`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric Filter GraphMinor.Surface + +/-- `U` has three distinct points. -/ +def HasTriple {X : Type*} (U : Set X) : Prop := + ∃ a b c, a ∈ U ∧ b ∈ U ∧ c ∈ U ∧ a ≠ b ∧ b ≠ c ∧ a ≠ c + +theorem HasTriple.of_infinite {X : Type*} {U : Set X} (h : U.Infinite) : HasTriple U := by + classical + obtain ⟨s, hs, hc⟩ := h.exists_subset_card_eq 3 + obtain ⟨a, b, c, hab, hac, hbc, rfl⟩ := Finset.card_eq_three.1 hc + exact ⟨a, b, c, hs (by simp), hs (by simp), hs (by simp), hab, hbc, hac⟩ + +theorem HasTriple.mono {X : Type*} {U V : Set X} (h : HasTriple U) (hs : U ⊆ V) : HasTriple V := by + obtain ⟨a, b, c, ha, hb, hc, h1, h2, h3⟩ := h + exact ⟨a, b, c, hs ha, hs hb, hs hc, h1, h2, h3⟩ + +theorem HasTriple.image {X Y : Type*} {U : Set X} (h : HasTriple U) {f : X → Y} + (hf : InjOn f U) : HasTriple (f '' U) := by + obtain ⟨a, b, c, ha, hb, hc, h1, h2, h3⟩ := h + exact ⟨f a, f b, f c, mem_image_of_mem _ ha, mem_image_of_mem _ hb, mem_image_of_mem _ hc, + fun e ↦ h1 (hf ha hb e), + fun e ↦ h2 (hf hb hc e), fun e ↦ h3 (hf ha hc e)⟩ + +theorem hasTriple_of_line {X : Type} [TopologicalSpace X] [T1Space X] {L : Set X} {a b : X} + (hl : IsLineWithEnds L a b) : HasTriple L := + HasTriple.of_infinite ((isPreconnected_of_line hl).infinite_of_nontrivial + ⟨a, (ends_of_line hl).1, b, (ends_of_line hl).2.1, (ends_of_line hl).2.2⟩) + +theorem isManifoldPoint_complex (x : ℂ) : IsManifoldPoint x := by + obtain ⟨e⟩ := exists_homeomorph_ball x one_pos + have : IsInteriorPoint x := ⟨ball x 1, isOpen_ball, mem_ball_self one_pos, ⟨e⟩⟩ + exact this.isManifoldPoint + +/-- A ray from a point inside a closed disc of the plane leaves the disc for the last time at a +boundary point. -/ +theorem exists_last_point {K : Set ℂ} (hK : IsClosedDisc K) {c : ℂ} (hc : c ∈ discInt K) {u : ℂ} + (hu : ‖u‖ = 1) : + ∃ t : ℝ, 0 < t ∧ c + t * u ∈ discBd K ∧ ∀ t' : ℝ, t < t' → c + t' * u ∉ K := by + have hop : IsOpen (discInt K) := hK.isOpen_discInt isManifoldPoint_complex + have hcpt : IsCompact K := by + obtain ⟨e⟩ := hK + have : K = range fun z ↦ (e z).1 := by + ext x + constructor + · intro hx + exact ⟨e.symm ⟨x, hx⟩, by simp⟩ + · rintro ⟨z, rfl⟩ + exact (e z).2 + rw [this] + have : CompactSpace ClosedUnitDisc := isCompact_iff_compactSpace.1 (isCompact_closedBall 0 1) + exact isCompact_range (continuous_subtype_val.comp e.continuous) + let p : ℝ → ℂ := fun t ↦ c + t * u + have hp : Continuous p := by fun_prop + obtain ⟨R, hR⟩ := hcpt.isBounded.subset_closedBall 0 + have hbound : ∀ t : ℝ, 0 ≤ t → p t ∈ K → t ≤ R + ‖c‖ := by + intro t ht hk + have h1 : ‖p t‖ ≤ R := by simpa using hR hk + have h2 : ‖(t : ℂ) * u‖ = t := by simp [hu, abs_of_nonneg ht] + have h3 : ‖(t : ℂ) * u‖ ≤ ‖p t‖ + ‖c‖ := by + have : (t : ℂ) * u = p t - c := by simp [p] + rw [this] + exact norm_sub_le _ _ + linarith + have hset : IsCompact (Icc 0 (R + ‖c‖) ∩ p ⁻¹' K) := isCompact_Icc.inter_right + (hcpt.isClosed.preimage hp) + have hne : (Icc 0 (R + ‖c‖) ∩ p ⁻¹' K).Nonempty := by + have h0 : p 0 ∈ K := by + simpa [p] using discInt_subset K hc + exact ⟨0, ⟨le_rfl, hbound 0 le_rfl h0⟩, h0⟩ + obtain ⟨t, ⟨⟨ht0, -⟩, htK⟩, hmax⟩ := hset.exists_isGreatest hne + have hlast : ∀ t' : ℝ, t < t' → p t' ∉ K := fun t' hlt hk ↦ by + have h0 : 0 ≤ t' := ht0.trans hlt.le + exact absurd (hmax ⟨⟨h0, hbound t' h0 hk⟩, hk⟩) (not_le.2 hlt) + have hint : ∀ {s : ℝ}, p s ∈ discInt K → ∃ s', s < s' ∧ p s' ∈ K := by + intro s hs + have : ∀ᶠ r in 𝓝[>] s, p r ∈ discInt K := + (hp.continuousAt.eventually (hop.mem_nhds hs)).filter_mono nhdsWithin_le_nhds + obtain ⟨r, hr, hr'⟩ := (this.and self_mem_nhdsWithin).exists + exact ⟨r, hr', discInt_subset K hr⟩ + have htpos : 0 < t := by + obtain ⟨s', hs', hk⟩ := hint (s := 0) (by simpa [p] using hc) + exact hs'.trans_le (hmax ⟨⟨hs'.le, hbound s' hs'.le hk⟩, hk⟩) + refine ⟨t, htpos, ?_, hlast⟩ + by_contra hn + obtain ⟨s', hs', hk⟩ := hint (s := t) ⟨htK, hn⟩ + exact hlast s' hs' hk + +/-- A ray from a point of the open unit ball reaches the unit circle, and it stays in the open ball +up to then. -/ +theorem exists_exit {y : ℂ} (hy : ‖y‖ < 1) {u : ℂ} (hu : ‖u‖ = 1) : + ∃ r : ℝ, 0 < r ∧ ‖y + r * u‖ = 1 ∧ ∀ t : ℝ, 0 ≤ t → t < r → ‖y + t * u‖ < 1 := by + let f : ℝ → ℝ := fun t ↦ ‖y + t * u‖ + have hf : Continuous f := by fun_prop + have h2 : 1 ≤ f 2 := by + have h3 : ‖(2 : ℂ) * u‖ = 2 := by simp [hu] + have h4 : ‖(2 : ℂ) * u‖ ≤ f 2 + ‖y‖ := by + have : (2 : ℂ) * u = (y + ((2 : ℝ) : ℂ) * u) - y := by simp + rw [this] + exact norm_sub_le _ _ + linarith + have hset : IsCompact (Icc 0 2 ∩ f ⁻¹' Ici 1) := isCompact_Icc.inter_right + (isClosed_Ici.preimage hf) + obtain ⟨r, ⟨⟨hr0, -⟩, hr1⟩, hmin⟩ := hset.exists_isLeast ⟨2, ⟨by norm_num, le_rfl⟩, h2⟩ + have hf0 : f 0 < 1 := by simpa [f] using hy + have hr2 : r ≤ 2 := hmin ⟨⟨by norm_num, le_rfl⟩, h2⟩ + have hlt : ∀ t : ℝ, 0 ≤ t → t < r → f t < 1 := fun t h0 ht ↦ by + by_contra hn + have h3 : r ≤ t := hmin ⟨⟨h0, ht.le.trans hr2⟩, not_lt.1 hn⟩ + linarith + have hrpos : 0 < r := by + rcases hr0.eq_or_lt with h | h + · rw [← h] at hr1 + exact absurd (mem_Ici.1 hr1) (not_le.2 hf0) + · exact h + have heq : f r = 1 := by + apply le_antisymm _ hr1 + have hcl : ∀ᶠ t in 𝓝[<] r, f t ≤ 1 := by + filter_upwards [Ioo_mem_nhdsLT hrpos] with t ht + exact (hlt t ht.1.le ht.2).le + exact le_of_tendsto (hf.continuousAt.tendsto.mono_left nhdsWithin_le_nhds) hcl + exact ⟨r, hrpos, heq, hlt⟩ + +/-- A closed disc in the open unit ball of the plane, and a closed subdisc of the unit disc that +holds it and shares with it and with +the unit disc arcs of the boundary. -/ +theorem exists_chord_plane {K : Set ℂ} (hK : IsClosedDisc K) (hin : K ⊆ ball 0 1) : + ∃ Δ : Set ℂ, IsClosedDisc Δ ∧ K ⊆ Δ ∧ Δ ⊆ closedBall 0 1 ∧ HasTriple (discBd K ∩ discBd Δ) ∧ + HasTriple (discBd Δ ∩ sphere 0 1) := by + classical + obtain ⟨c, hc⟩ := hK.nonempty_discInt + have hnorm : ∀ {x}, x ∈ K → ‖x‖ < 1 := fun hx ↦ by simpa using hin hx + let p : ℝ → ℂ := fun t ↦ c + t + have hp : Continuous p := by fun_prop + have hpi : Function.Injective p := fun s t h ↦ by + have : (s : ℂ) = t := add_left_cancel h + exact_mod_cast this + obtain ⟨a, ha, hab, hall⟩ := exists_last_point hK hc (u := 1) (by simp) + obtain ⟨b, hb, hbb, hbll⟩ := exists_last_point hK hc (u := -1) (by simp) + have hpa : c + (a : ℂ) * 1 = p a := by simp [p] + have hpb : ∀ t : ℝ, c + (t : ℂ) * (-1) = p (-t) := fun t ↦ by simp [p] + rw [hpa] at hab + rw [hpb] at hbb + have hall' : ∀ t, a < t → p t ∉ K := fun t ht ↦ by + have := hall t ht + rwa [show c + (t : ℂ) * 1 = p t by simp [p]] at this + have hbll' : ∀ t, t < -b → p t ∉ K := fun t ht ↦ by + have := hbll (-t) (by linarith) + rwa [hpb, neg_neg] at this + obtain ⟨r, hr, hre, hrl⟩ := exists_exit (hnorm (Surface.discBd_subset _ hab)) (u := 1) (by simp) + obtain ⟨r', hr', hre', hrl'⟩ := exists_exit (hnorm (Surface.discBd_subset _ hbb)) (u := -1) + (by simp) + have hshift : ∀ t : ℝ, p a + (t : ℂ) * 1 = p (a + t) := fun t ↦ by simp [p, add_assoc] + have hshift' : ∀ t : ℝ, p (-b) + (t : ℂ) * (-1) = p (-b - t) := fun t ↦ by + simp [p, add_assoc, sub_eq_add_neg] + rw [hshift] at hre + rw [hshift'] at hre' + have hLa := GM11.isLine_of_injOn hp (show a < a + r by linarith) hpi.injOn + have hLb := GM11.isLine_of_injOn hp (show -b - r' < -b by linarith) hpi.injOn + have hne : p (-b) ≠ p a := fun h ↦ by + have := hpi h + linarith + obtain ⟨J, J', hJ, hJ', hun, hinter⟩ := hK.isOArc_discBd.lines hbb hab hne + have hJb : J ⊆ discBd K := fun x hx ↦ hun ▸ Or.inl hx + have hJK : J ⊆ K := hJb.trans (Surface.discBd_subset K) + set La := p '' Icc a (a + r) with hLp + set Lb := p '' Icc (-b - r') (-b) with hLm + have hma : ∀ {t}, t ∈ Icc a (a + r) → p t ∈ K → t = a := fun {t} ht hk ↦ by + by_contra hn + exact hall' t (lt_of_le_of_ne ht.1 (Ne.symm hn)) hk + have hmb : ∀ {t}, t ∈ Icc (-b - r') (-b) → p t ∈ K → t = -b := fun {t} ht hk ↦ by + by_contra hn + exact hbll' t (lt_of_le_of_ne ht.2 hn) hk + have haJ : p a ∈ J := (ends_of_line hJ).2.1 + have hbJ : p (-b) ∈ J := (ends_of_line hJ).1 + have h₁ : Lb ∩ J = {p (-b)} := by + ext x + constructor + · rintro ⟨⟨t, ht, rfl⟩, hx⟩ + rw [hmb ht (hJK hx)] + rfl + · rintro rfl + exact ⟨⟨_, ⟨by linarith, le_rfl⟩, rfl⟩, hbJ⟩ + have hF₁ := hLb.union hJ h₁ + have h₂ : (Lb ∪ J) ∩ La = {p a} := by + ext x + constructor + · rintro ⟨⟨t, ht, rfl⟩ | hx, ⟨t', ht', he⟩⟩ + · have h3 := hpi he + linarith [ht.2, ht'.1] + · rw [← he] at hx ⊢ + rw [hma ht' (hJK hx)] + rfl + · rintro rfl + exact ⟨Or.inr haJ, _, ⟨le_rfl, by linarith⟩, rfl⟩ + have hF := hF₁.union hLa h₂ + set F := Lb ∪ J ∪ La with hFdef + set s₀ := p (-b - r') with hs₀ + set e₀ := p (a + r) with he₀ + have hse : s₀ ≠ e₀ := fun h ↦ by + have := hpi h + linarith + have hballa : ∀ {t}, t ∈ Icc a (a + r) → t ≠ a + r → ‖p t‖ < 1 := fun {t} ht hn ↦ by + have := hrl (t - a) (by linarith [ht.1]) (by + have : t < a + r := lt_of_le_of_ne ht.2 hn + linarith) + rwa [hshift, show a + (t - a) = t by ring] at this + have hballb : ∀ {t}, t ∈ Icc (-b - r') (-b) → t ≠ -b - r' → ‖p t‖ < 1 := fun {t} ht hn ↦ by + have := hrl' (-b - t) (by linarith [ht.2]) (by + have : -b - r' < t := lt_of_le_of_ne ht.1 (Ne.symm hn) + linarith) + rwa [hshift', show -b - (-b - t) = t by ring] at this + have hFball : F ⊆ closedBall 0 1 := by + rintro x ((⟨t, ht, rfl⟩ | hx) | ⟨t, ht, rfl⟩) + · by_cases h : t = -b - r' + · rw [h] + exact mem_closedBall_zero_iff.2 hre'.le + · exact mem_closedBall_zero_iff.2 (hballb ht h).le + · exact ball_subset_closedBall (hin (hJK hx)) + · by_cases h : t = a + r + · rw [h] + exact mem_closedBall_zero_iff.2 hre.le + · exact mem_closedBall_zero_iff.2 (hballa ht h).le + have hbdb := isClosedDisc_closedBall.2 + have hmeet : F ∩ discBd (closedBall (0 : ℂ) 1) = {s₀, e₀} := by + rw [hbdb] + ext x + constructor + · rintro ⟨(⟨t, ht, rfl⟩ | hx) | ⟨t, ht, rfl⟩, hsp⟩ + · by_cases h : t = -b - r' + · exact Or.inl (by rw [h]) + · exact absurd (mem_sphere_zero_iff_norm.1 hsp) (hballb ht h).ne + · exact absurd (mem_sphere_zero_iff_norm.1 hsp) (hnorm (hJK hx)).ne + · by_cases h : t = a + r + · exact Or.inr (by rw [h]; rfl) + · exact absurd (mem_sphere_zero_iff_norm.1 hsp) (hballa ht h).ne + · rintro (rfl | h) + · exact ⟨(ends_of_line hF).1, mem_sphere_zero_iff_norm.2 hre'⟩ + · rw [mem_singleton_iff.1 h] + exact ⟨(ends_of_line hF).2.1, mem_sphere_zero_iff_norm.2 hre⟩ + obtain ⟨A₁, A₂, Δ₁, Δ₂, -, hcomp, hd₁, hd₂, hun', hint, hb₁, hb₂, hcomp'⟩ := + disc_iArc (closedBall (0 : ℂ) 1) F s₀ e₀ isClosedDisc_closedBall.1 hFball hse hF hmeet + have hFcl : IsClosed F := isClosed_of_cuffLine hF + have hJF : J ⊆ F := fun x hx ↦ Or.inl (Or.inr hx) + have hfinish : ∀ {Δ A : Set ℂ}, IsClosedDisc Δ → discBd Δ = A ∪ F → A ∈ componentsIn (discBd + (closedBall (0 : ℂ) 1) \ {s₀, e₀}) → + Δ ⊆ closedBall 0 1 → K \ J ⊆ Δ → F ⊆ Δ → ∃ Δ : Set ℂ, IsClosedDisc Δ ∧ K ⊆ Δ + ∧ Δ ⊆ closedBall 0 1 ∧ + HasTriple (discBd K ∩ discBd Δ) ∧ HasTriple (discBd Δ ∩ sphere 0 1) := by + intro Δ A hd hb hA hsub hQ hFΔ + refine ⟨Δ, hd, fun x hx ↦ ?_, hsub, ?_, ?_⟩ + · by_cases hxJ : x ∈ J + · exact hFΔ (hJF hxJ) + · exact hQ ⟨hx, hxJ⟩ + · exact (hasTriple_of_line hJ).mono fun x hx ↦ ⟨hJb hx, hb ▸ Or.inr (hJF hx)⟩ + · obtain ⟨x, hx, rfl⟩ := hA + set A := connectedComponentIn (discBd (closedBall (0 : ℂ) 1) \ {s₀, e₀}) x with hAdef + have hxA : x ∈ A := mem_connectedComponentIn hx + have hAs : A ⊆ discBd (closedBall (0 : ℂ) 1) \ {s₀, e₀} := connectedComponentIn_subset _ _ + have hAF : ∀ {z}, z ∈ A → z ∉ F := fun {z} hz hzF ↦ (hAs hz).2 (hmeet ▸ ⟨hzF, (hAs hz).1⟩) + have hnt : A.Nontrivial := by + by_contra hn + rw [not_nontrivial_iff] at hn + have hsing : A = {x} := hn.eq_singleton_of_mem hxA + have hx₂ : x ∈ discBd Δ := hb ▸ Or.inl hxA + have hlim := mem_closure_oArc_sdiff hd.isOArc_discBd hx₂ + have hsubF : discBd Δ \ {x} ⊆ F := by + rintro z ⟨hz, hne⟩ + rw [hb] at hz + rcases hz with h | h + · exact absurd (hsing ▸ h) hne + · exact h + exact hAF hxA (closure_minimal hsubF hFcl hlim) + refine HasTriple.of_infinite ((isPreconnected_connectedComponentIn.infinite_of_nontrivial + hnt).mono fun z hz ↦ ?_) + refine ⟨hb ▸ Or.inl hz, ?_⟩ + rw [← hbdb] + exact (hAs hz).1 + have hdisjQ : Disjoint (discInt K) J := disjoint_left.2 fun x hx hxJ ↦ hx.2 (hJb hxJ) + have hQc : IsPreconnected (K \ J) := hK.isPreconnected_discInt.subset_closure + (fun x hx ↦ ⟨discInt_subset K hx, disjoint_left.1 hdisjQ hx⟩) (sdiff_subset.trans + hK.subset_closure_discInt) + have hcQ : c ∈ K \ J := ⟨discInt_subset K hc, disjoint_left.1 hdisjQ hc⟩ + have hQsub : K \ J ⊆ closedBall (0 : ℂ) 1 \ F := by + rintro x ⟨hx, hxJ⟩ + refine ⟨ball_subset_closedBall (hin hx), ?_⟩ + rintro ((⟨t, ht, rfl⟩ | h) | ⟨t, ht, rfl⟩) + · apply hxJ + rw [hmb ht hx] + exact hbJ + · exact hxJ h + · apply hxJ + rw [hma ht hx] + exact haJ + have hQC := hQc.subset_connectedComponentIn hcQ hQsub + have hmemc : connectedComponentIn (closedBall (0 : ℂ) 1 \ F) c ∈ componentsIn (closedBall + (0 : ℂ) 1 \ F) := + mem_image_of_mem _ (hQsub hcQ) + rw [hcomp'] at hmemc + have hFΔ₁ : F ⊆ Δ₁ := fun x hx ↦ (hint ▸ hx : x ∈ Δ₁ ∩ Δ₂).1 + have hFΔ₂ : F ⊆ Δ₂ := fun x hx ↦ (hint ▸ hx : x ∈ Δ₁ ∩ Δ₂).2 + rcases hmemc with h | h + · refine hfinish hd₁ hb₁ (by rw [hcomp]; exact mem_insert _ _) (hun' ▸ subset_union_left) ?_ hFΔ₁ + rw [h] at hQC + exact hQC.trans sdiff_subset + · refine hfinish hd₂ hb₂ (by rw [hcomp]; exact mem_insert_of_mem _ rfl) + (hun' ▸ subset_union_right) ?_ hFΔ₂ + rw [mem_singleton_iff.1 h] at hQC + exact hQC.trans sdiff_subset + +/-- A closed disc `D₀` inside a closed disc `D₁`. There is a closed disc `Δ` between them that +shares with each of them three points +of the boundary. -/ +theorem exists_nested_chord {T : Type} [TopologicalSpace T] [T2Space T] {D₀ D₁ : Set T} + (h₀ : IsClosedDisc D₀) (h₁ : IsClosedDisc D₁) + (hin : D₀ ⊆ discInt D₁) : ∃ Δ : Set T, IsClosedDisc Δ ∧ D₀ ⊆ Δ ∧ Δ ⊆ D₁ ∧ HasTriple + (discBd D₀ ∩ discBd Δ) ∧ + HasTriple (discBd Δ ∩ discBd D₁) := by + obtain ⟨h, g, c⟩ := h₁.exists_isChart + have hsub : D₀ ⊆ D₁ := hin.trans (discInt_subset D₁) + have hinj : InjOn h D₁ := c.gh.injOn + obtain ⟨hK, hbK⟩ := isClosedDisc_image_injOn h₀ (c.hc.mono hsub) (hinj.mono hsub) + have hball : h '' D₀ ⊆ ball 0 1 := by + rintro _ ⟨x, hx, rfl⟩ + have hcb : h x ∈ closedBall (0 : ℂ) 1 := c.hm (hsub hx) + refine (mem_ball_zero_iff).2 (lt_of_le_of_ne (mem_closedBall_zero_iff.1 hcb) fun he ↦ ?_) + have : h x ∈ h '' discBd D₁ := by + rw [c.bd] + exact mem_sphere_zero_iff_norm.2 he + obtain ⟨y, hy, hxy⟩ := this + have hxe : y = x := hinj (Surface.discBd_subset _ hy) (hsub hx) hxy + exact (hin hx).2 (hxe ▸ hy) + obtain ⟨Δ, hd, hKΔ, hΔ, ht₁, ht₂⟩ := exists_chord_plane hK hball + have hginj : InjOn g (closedBall 0 1) := c.hg.injOn + obtain ⟨hd', hb'⟩ := isClosedDisc_image_injOn hd (c.gc.mono hΔ) (hginj.mono hΔ) + have hgh : ∀ {x}, x ∈ D₁ → g (h x) = x := fun hx ↦ c.gh hx + have hD₀ : g '' (h '' D₀) = D₀ := by + ext x + constructor + · rintro ⟨_, ⟨y, hy, rfl⟩, rfl⟩ + rwa [hgh (hsub hy)] + · intro hx + exact ⟨_, mem_image_of_mem _ hx, hgh (hsub hx)⟩ + have hsph : g '' sphere 0 1 = discBd D₁ := by + rw [← c.bd] + ext x + constructor + · rintro ⟨_, ⟨y, hy, rfl⟩, rfl⟩ + rwa [hgh (Surface.discBd_subset _ hy)] + · intro hx + exact ⟨_, mem_image_of_mem _ hx, hgh (Surface.discBd_subset _ hx)⟩ + have hcomm : ∀ {U V : Set ℂ}, U ⊆ closedBall 0 1 → V ⊆ closedBall 0 1 → g '' (U ∩ V) + = g '' U ∩ g '' V := + fun hU hV ↦ hginj.image_inter hU hV + have hD₀' : g '' (h '' discBd D₀) = discBd D₀ := by + ext x + constructor + · rintro ⟨_, ⟨y, hy, rfl⟩, rfl⟩ + rwa [hgh (hsub (Surface.discBd_subset _ hy))] + · intro hx + exact ⟨_, mem_image_of_mem _ hx, hgh (hsub (Surface.discBd_subset _ hx))⟩ + refine ⟨g '' Δ, hd', ?_, ?_, ?_, ?_⟩ + · rw [← hD₀] + exact image_mono hKΔ + · exact (image_mono hΔ).trans (image_subset_iff.2 fun x hx ↦ c.gm hx) + · have hs₁ : discBd (h '' D₀) ⊆ closedBall 0 1 := + (Surface.discBd_subset _).trans (hball.trans ball_subset_closedBall) + have hs₂ : discBd Δ ⊆ closedBall 0 1 := (Surface.discBd_subset _).trans hΔ + have := ht₁.image (hginj.mono (inter_subset_left.trans hs₁)) + rw [hcomm hs₁ hs₂, hbK, hD₀', ← hb'] at this + exact this + · have hs₂ : discBd Δ ⊆ closedBall 0 1 := (Surface.discBd_subset _).trans hΔ + have := ht₂.image (hginj.mono (inter_subset_left.trans hs₂)) + rw [hcomm hs₂ sphere_subset_closedBall, ← hb', hsph] at this + exact this + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FragmentCollapse.lean b/LeanPool/GraphMinor/GM19/FragmentCollapse.lean new file mode 100644 index 0000000000..638d269c79 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FragmentCollapse.lean @@ -0,0 +1,357 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collar +public import LeanPool.GraphMinor.Surface.PlaneDisc +public import LeanPool.GraphMinor.Surface.DiscGrow +public import LeanPool.GraphMinor.Surface.Gluing +public import Mathlib.Topology.Homotopy.Basic + +/-! +# Collapsing closed discs of a closed surface + +To compare the capping of a fragment with a closed surface we use a simple fact. Let `D` be a closed +disc in a closed +surface `T`. There is a map of `T` onto itself that sends `D` to one point, is one to one off `D`, +and is homotopic to the +identity (`exists_collapse`). So `T` without `D` looks like `T` without a point. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface + +variable {T : Type*} [TopologicalSpace T] + +/-- A one to one continuous image of a closed disc in a Hausdorff space is a closed disc. -/ +theorem isClosedDisc_image_injOn {T' : Type*} [TopologicalSpace T'] [T2Space T'] {Δ : Set T} + (hΔ : IsClosedDisc Δ) + {f : T → T'} (hf : ContinuousOn f Δ) (hi : InjOn f Δ) : + IsClosedDisc (f '' Δ) ∧ discBd (f '' Δ) = f '' discBd Δ := by + classical + obtain ⟨z, hz⟩ := hΔ.nonempty_discInt + have : Nonempty T := ⟨z⟩ + have hc : IsCompact Δ := hΔ.isCompact + refine hΔ.image hf (f' := Function.invFunOn f Δ) ?_ hi.leftInvOn_invFunOn + have hl := hi.leftInvOn_invFunOn + refine continuousOn_iff_isClosed.2 fun C hC ↦ ⟨f '' (C ∩ Δ), ?_, ?_⟩ + · exact ((hc.inter_left hC).image_of_continuousOn (hf.mono inter_subset_right)).isClosed + · ext y + constructor + · rintro ⟨hy, x, hx, rfl⟩ + rw [mem_preimage, hl hx] at hy + exact ⟨⟨x, ⟨hy, hx⟩, rfl⟩, x, hx, rfl⟩ + · rintro ⟨⟨x, ⟨hx, hxd⟩, rfl⟩, -⟩ + exact ⟨by rw [mem_preimage, hl hxd]; exact hx, x, hxd, rfl⟩ + +/-- `c` collapses `X` to the finite set `P`: it is onto, one to one off `X`, sends `X` into `P` and +nothing else into `P`, +and it is homotopic to the identity. -/ +structure IsCollapse (c : C(T, T)) (X P : Set T) : Prop where + surjective : Function.Surjective c + mapsTo : MapsTo c X P + preimage : c ⁻¹' P ⊆ X + injOn : InjOn c Xᶜ + finite : P.Finite + homotopic : c.Homotopic (ContinuousMap.id T) + +theorem IsCollapse.comp {c c' : C(T, T)} {X X' P P' : Set T} (h : IsCollapse c X P) + (h' : IsCollapse c' X' P') : + IsCollapse (c'.comp c) (X ∪ c ⁻¹' X') (c' '' P ∪ P') := by + refine ⟨h'.surjective.comp h.surjective, ?_, ?_, ?_, (h.finite.image _).union h'.finite, ?_⟩ + · rintro x (hx | hx) + · exact Or.inl ⟨_, h.mapsTo hx, rfl⟩ + · exact Or.inr (h'.mapsTo hx) + · rintro x (⟨p, hp, he⟩ | hx) + · by_cases hc : c x ∈ X' + · exact Or.inr hc + · by_cases hpX : p ∈ X' + · exact absurd (h'.preimage (by have := h'.mapsTo hpX; rw [he] at this; exact this)) hc + · have : p = c x := h'.injOn hpX hc he + exact Or.inl (h.preimage (by rw [mem_preimage, ← this]; exact hp)) + · exact Or.inr (h'.preimage hx) + · intro x hx y hy he + simp only [mem_compl_iff, mem_union, not_or, mem_preimage] at hx hy + exact h.injOn hx.1 hy.1 (h'.injOn hx.2 hy.2 he) + · simpa using h'.homotopic.comp h.homotopic + +/-- The radial map of the disc of radius `2` that sends the unit disc to `0`. -/ +noncomputable def squash (z : ℂ) : ℂ := ((2 - 2 / max 1 ‖z‖ : ℝ) : ℂ) * z + +theorem continuous_squash : Continuous squash := by + unfold squash + have : Continuous fun z : ℂ ↦ (2 - 2 / max 1 ‖z‖ : ℝ) := + continuous_const.sub (continuous_const.div (continuous_const.max continuous_norm) fun z ↦ by + positivity) + exact (Complex.continuous_ofReal.comp this).mul continuous_id + +theorem squash_of_le {z : ℂ} (h : ‖z‖ ≤ 1) : squash z = 0 := by + simp [squash, max_eq_left h] + +theorem squash_of_ge {z : ℂ} (h : 1 ≤ ‖z‖) : squash z = ((2 - 2 / ‖z‖ : ℝ) : ℂ) * z := by + simp [squash, max_eq_right h] + +theorem norm_squash {z : ℂ} (h : 1 ≤ ‖z‖) : ‖squash z‖ = 2 * ‖z‖ - 2 := by + have h0 : ‖z‖ ≠ 0 := by positivity + have hnn : 0 ≤ 2 - 2 / ‖z‖ := by + rw [sub_nonneg, div_le_iff₀ (by positivity)] + linarith + rw [squash_of_ge h, norm_mul, Complex.norm_real, Real.norm_of_nonneg hnn] + field_simp + +theorem squash_eq_of_norm {z : ℂ} (h : ‖z‖ = 2) : squash z = z := by + rw [squash_of_ge (by rw [h]; norm_num), h] + norm_num + +theorem norm_squash_le {z : ℂ} (h : ‖z‖ ≤ 2) : ‖squash z‖ ≤ 2 := by + rcases le_total ‖z‖ 1 with h1 | h1 + · rw [squash_of_le h1]; simp + · rw [norm_squash h1]; linarith + +theorem squash_inj {z w : ℂ} (hz : 1 < ‖z‖) (hw : 1 < ‖w‖) (h : squash z = squash w) : z = w := by + have hn : ‖z‖ = ‖w‖ := by + have := congrArg norm h + rw [norm_squash hz.le, norm_squash hw.le] at this + linarith + rw [squash_of_ge hz.le, squash_of_ge hw.le, hn] at h + have hne : (2 - 2 / ‖w‖ : ℝ) ≠ 0 := by + have : 2 / ‖w‖ < 2 := by rw [div_lt_iff₀ (by linarith)]; linarith + linarith + exact mul_left_cancel₀ (by exact_mod_cast hne) h + +theorem exists_squash_eq {w : ℂ} (h : ‖w‖ ≤ 2) : ∃ z, ‖z‖ ≤ 2 ∧ squash z = w := by + by_cases h0 : w = 0 + · exact ⟨0, by simp, by rw [squash_of_le (by simp)]; exact h0.symm⟩ + have hp : 0 < ‖w‖ := norm_pos_iff.2 h0 + refine ⟨((1 / 2 + 1 / ‖w‖ : ℝ) : ℂ) * w, ?_, ?_⟩ + · rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg (by positivity)] + have : (1 / 2 + 1 / ‖w‖) * ‖w‖ = ‖w‖ / 2 + 1 := by field_simp + rw [this]; linarith + · have hn : ‖((1 / 2 + 1 / ‖w‖ : ℝ) : ℂ) * w‖ = ‖w‖ / 2 + 1 := by + rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg (by positivity)] + field_simp + rw [squash_of_ge (by rw [hn]; linarith), hn, ← mul_assoc, ← Complex.ofReal_mul] + have : (2 - 2 / (‖w‖ / 2 + 1)) * (1 / 2 + 1 / ‖w‖) = 1 := by field_simp; ring + rw [this]; simp + +section Disc + +variable [T2Space T] + +/-- One closed disc of a closed surface collapses to a point. -/ +theorem exists_collapse_disc (hT : IsClosedSurface T) {D : Set T} (hD : IsClosedDisc D) : + ∃ (c : C(T, T)) (p : T), IsCollapse c D {p} := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + obtain ⟨D', hD', hin, -⟩ := exists_disc_around hman hD (fun x _ ↦ hT.2.2 x) isOpen_univ + (subset_univ _) + obtain ⟨p₀⟩ := IsClosedDisc.isOArc_discBd hD + obtain ⟨g, g', hgc, hg'c, hgm, hg'm, hl, hr, h1, h2, -⟩ := exists_disc_collar hD hD' hin p₀ + have hcl : IsClosed D' := hD'.isClosed + have hb : D' ∩ closure D'ᶜ ⊆ discBd D' := by + rintro x ⟨hx, hxc⟩ + by_contra hn + have hxi : x ∈ discInt D' := ⟨hx, hn⟩ + obtain ⟨y, hy, hyD⟩ := mem_closure_iff.1 hxc _ (hD'.isOpen_discInt hman) hxi + exact hyD hy.1 + have hnorm : ∀ {x}, x ∈ D' → ‖g' x‖ ≤ 2 := fun hx ↦ by simpa using hg'm hx + have hbd2 : ∀ {x}, x ∈ discBd D' → ‖g' x‖ = 2 := fun hx ↦ by + obtain ⟨w, hw, rfl⟩ := h2 ▸ hx + have hw' : ‖w‖ = 2 := by simpa using hw + rw [hl (by simp [hw'])] + exact hw' + let A : T × unitInterval → ℂ := fun p ↦ (p.2.1 : ℂ) * g' p.1 + (1 - p.2.1 : ℂ) * squash (g' p.1) + let H : T × unitInterval → T := fun p ↦ if p.1 ∈ D' then g (A p) else p.1 + have hA : ∀ {x} (t : unitInterval), x ∈ D' → A (x, t) ∈ closedBall (0 : ℂ) 2 := fun {x} t hx ↦ by + have ht0 : (0 : ℝ) ≤ t := t.2.1 + have ht1 : (t : ℝ) ≤ 1 := t.2.2 + have h1 := hnorm hx + have h2 := norm_squash_le h1 + rw [mem_closedBall_zero_iff] + calc ‖A (x, t)‖ ≤ ‖((t : ℝ) : ℂ) * g' x‖ + ‖(1 - (t : ℝ) : ℂ) * squash (g' x)‖ + := norm_add_le _ _ + _ = t * ‖g' x‖ + (1 - t) * ‖squash (g' x)‖ := by + rw [norm_mul, norm_mul, ← Complex.ofReal_one, ← Complex.ofReal_sub, Complex.norm_real, + Complex.norm_real, + Real.norm_of_nonneg ht0, Real.norm_of_nonneg (by linarith)] + _ ≤ t * 2 + (1 - t) * 2 := by gcongr + _ = 2 := by ring + have hAb : ∀ {x} (t : unitInterval), x ∈ discBd D' → g (A (x, t)) = x := fun {x} t hx ↦ by + have : squash (g' x) = g' x := squash_eq_of_norm (hbd2 hx) + have hAe : A (x, t) = g' x := by + simp only [A, this] + ring + rw [hAe] + exact hr (discBd_subset _ hx) + have hH : Continuous H := by + have hAc : ContinuousOn A {p | p.1 ∈ D'} := by + have h₁ : ContinuousOn (fun p : T × unitInterval ↦ g' p.1) {p | p.1 ∈ D'} := + hg'c.comp continuous_fst.continuousOn fun p hp ↦ hp + have ht : Continuous fun p : T × unitInterval ↦ ((p.2.1 : ℝ) : ℂ) := by fun_prop + exact (ht.continuousOn.mul h₁).add ((continuous_const.sub ht).continuousOn.mul + (continuous_squash.comp_continuousOn h₁)) + have hon₁ : ContinuousOn H {p | p.1 ∈ D'} := by + refine (hgc.comp hAc fun p hp ↦ ?_).congr fun p hp ↦ ite_eq_left hp + exact hA p.2 hp + have hon₂ : ContinuousOn H {p | p.1 ∈ closure D'ᶜ} := by + refine continuous_fst.continuousOn.congr fun p hp ↦ ?_ + by_cases h : p.1 ∈ D' + · have := hAb p.2 (hb ⟨h, hp⟩) + exact (ite_eq_left h).trans this + · exact ite_eq_right h + have hcA : IsClosed {p : T × unitInterval | p.1 ∈ D'} := hcl.preimage continuous_fst + have hcB : IsClosed {p : T × unitInterval | p.1 ∈ closure D'ᶜ} := isClosed_closure.preimage + continuous_fst + have := hon₁.union_of_isClosed hon₂ hcA hcB + have hu : {p : T × unitInterval | p.1 ∈ D'} ∪ {p | p.1 ∈ closure D'ᶜ} = univ := by + refine eq_univ_of_forall fun p ↦ ?_ + by_cases h : p.1 ∈ D' + · exact Or.inl h + · exact Or.inr (subset_closure (show p.1 ∈ D'ᶜ from h)) + rwa [hu, continuousOn_univ] at this + let c : C(T, T) := ⟨fun x ↦ H (x, 0), by fun_prop⟩ + have hcin : ∀ {x}, x ∈ D' → c x = g (squash (g' x)) := fun {x} hx ↦ by + have : A (x, 0) = squash (g' x) := by simp [A] + change (if x ∈ D' then g (A (x, 0)) else x) = _ + rw [ite_eq_left hx, this] + have hcout : ∀ {x}, x ∉ D' → c x = x := fun hx ↦ ite_eq_right hx + have hsub : D ⊆ D' := fun x hx ↦ (hin hx).1 + have hgi : InjOn g (closedBall 0 2) := hl.injOn + have hD1 : ∀ {x}, x ∈ D' → (x ∈ D ↔ ‖g' x‖ ≤ 1) := fun {x} hx ↦ by + constructor + · intro hxD + obtain ⟨w, hw, rfl⟩ := h1 ▸ hxD + rw [hl (closedBall_subset_closedBall (by norm_num) hw)] + simpa using hw + · intro h + rw [← hr hx, ← h1] + exact mem_image_of_mem g (by simpa using h) + refine ⟨c, g 0, ⟨fun y ↦ ?_, fun x hx ↦ ?_, fun x hx ↦ ?_, fun x hx y hy he ↦ ?_, + finite_singleton _, ?_⟩⟩ + · by_cases hy : y ∈ D' + · obtain ⟨z, hz, he⟩ := exists_squash_eq (hnorm hy) + have hz' : z ∈ closedBall (0 : ℂ) 2 := by simpa using hz + refine ⟨g z, ?_⟩ + rw [hcin (hgm hz'), hl hz', he] + exact hr hy + · exact ⟨y, hcout hy⟩ + · rw [hcin (hsub hx), squash_of_le ((hD1 (hsub hx)).1 hx)] + rfl + · have hx' : c x = g 0 := hx + have h0 : (0 : ℂ) ∈ closedBall (0 : ℂ) 2 := by simp + have hg0 : g 0 ∈ D := h1 ▸ mem_image_of_mem g (by simp) + by_cases hxD : x ∈ D' + · rw [hcin hxD] at hx' + have hs : squash (g' x) = 0 := hgi (by simpa using norm_squash_le (hnorm hxD)) h0 hx' + by_contra hn + have hlt : 1 < ‖g' x‖ := not_le.1 fun h ↦ hn ((hD1 hxD).2 h) + have := norm_squash hlt.le + rw [hs, norm_zero] at this + linarith + · rw [hcout hxD] at hx' + rw [hx'] + exact hg0 + · have hgt : ∀ {x}, x ∈ D' → x ∉ D → 1 < ‖g' x‖ := fun hx hn ↦ not_le.1 fun h ↦ hn ((hD1 hx).2 h) + have hin' : ∀ {x}, x ∈ D' → c x ∈ D' := fun {x} hx ↦ by + rw [hcin hx] + exact hgm (by simpa using norm_squash_le (hnorm hx)) + by_cases hxD : x ∈ D' <;> by_cases hyD : y ∈ D' + · rw [hcin hxD, hcin hyD] at he + have hxm : squash (g' x) ∈ closedBall 0 2 := by + simpa using norm_squash_le (hnorm hxD) + have hym : squash (g' y) ∈ closedBall 0 2 := by + simpa using norm_squash_le (hnorm hyD) + have hs := hgi hxm hym he + rw [← hr hxD, ← hr hyD, squash_inj (hgt hxD hx) (hgt hyD hy) hs] + · exact absurd ((hcout hyD) ▸ he ▸ hin' hxD) hyD + · exact absurd ((hcout hxD) ▸ he.symm ▸ hin' hyD) hxD + · rwa [hcout hxD, hcout hyD] at he + · refine ⟨⟨⟨fun p ↦ H (p.2, p.1), by fun_prop⟩, fun x ↦ rfl, fun x ↦ ?_⟩⟩ + change H (x, 1) = x + by_cases hx : x ∈ D' + · have : A (x, 1) = g' x := by simp [A] + change (if x ∈ D' then g (A (x, 1)) else x) = _ + rw [ite_eq_left hx, this] + exact hr hx + · exact ite_eq_right hx + +/-- Finitely many pairwise disjoint closed discs of a closed surface collapse, each to its own +point. -/ +theorem exists_collapse [Nonempty T] (hT : IsClosedSurface T) {𝓐 : Set (Set T)} (hf : 𝓐.Finite) + (hd : ∀ E ∈ 𝓐, IsClosedDisc E) + (hp : 𝓐.PairwiseDisjoint id) : + ∃ (c : C(T, T)) (P : Set T) (q : Set T → T), IsCollapse c (⋃₀ 𝓐) P ∧ (∀ E ∈ 𝓐, ∀ x ∈ E, c x + = q E) ∧ + P = q '' 𝓐 ∧ InjOn q 𝓐 := by + classical + induction 𝓐, hf using Set.Finite.induction_on with + | empty => + exact ⟨.id T, ∅, fun _ ↦ Classical.arbitrary T, ⟨Function.surjective_id, by simp [MapsTo], + by simp, by simp [InjOn], + finite_empty, .refl _⟩, by simp, by simp, by simp⟩ + | @insert D 𝓐 hD hf ih => + obtain ⟨c, P, q, hc, hq, rfl, hqi⟩ := ih (fun E hE ↦ hd E (mem_insert_of_mem _ hE)) + (hp.subset (subset_insert _ _)) + have hdis : Disjoint D (⋃₀ 𝓐) := by + refine disjoint_sUnion_right.2 fun E hE ↦ ?_ + exact hp (mem_insert _ _) (mem_insert_of_mem _ hE) (fun h ↦ hD (h ▸ hE)) + have hDsub : D ⊆ (⋃₀ 𝓐)ᶜ := fun _ hx hn ↦ disjoint_left.1 hdis hx hn + have hcD : InjOn c D := hc.injOn.mono hDsub + obtain ⟨hdc, -⟩ := isClosedDisc_image_injOn (hd D (mem_insert _ _)) c.continuous.continuousOn + hcD + obtain ⟨c₁, p, h₁⟩ := exists_collapse_disc hT hdc + have hpre : ⋃₀ 𝓐 ∪ c ⁻¹' (c '' D) = ⋃₀ insert D 𝓐 := by + rw [sUnion_insert] + apply Subset.antisymm + · rintro x (hx | ⟨d, hd, he⟩) + · exact Or.inr hx + · by_cases hxA : x ∈ ⋃₀ 𝓐 + · exact Or.inr hxA + · exact Or.inl (hc.injOn (fun h ↦ disjoint_left.1 hdis hd h) hxA he ▸ hd) + · rintro x (hx | hx) + · exact Or.inr ⟨x, hx, rfl⟩ + · exact Or.inl hx + have hcomp := hc.comp h₁ + rw [hpre] at hcomp + have hPd : Disjoint (q '' 𝓐) (c '' D) := by + refine disjoint_left.2 ?_ + rintro _ ⟨E, hE, rfl⟩ ⟨d, hdD, he⟩ + exact disjoint_left.1 hdis hdD (hc.preimage ⟨E, hE, he.symm⟩) + have hmem : ∀ x ∈ c '' D, c₁ x = p := fun x hx ↦ h₁.mapsTo hx + have hout : ∀ E ∈ 𝓐, c₁ (q E) ≠ p := fun E hE h ↦ disjoint_left.1 hPd ⟨E, hE, rfl⟩ + (h₁.preimage h) + refine ⟨c₁.comp c, _, fun E ↦ if E = D then p else c₁ (q E), hcomp, ?_, ?_, ?_⟩ + · rintro E (rfl | hE) x hx + · simpa using hmem _ (mem_image_of_mem c hx) + · have hne : E ≠ D := fun h ↦ hD (h ▸ hE) + simp only [ContinuousMap.comp_apply, ite_eq_right hne, hq E hE x hx] + · rw [image_insert_eq, union_comm, image_image, singleton_union] + simp only [ite_true] + congr 1 + exact image_congr fun E hE ↦ (ite_eq_right fun h : E = D ↦ hD (h ▸ hE)).symm + · rintro E (rfl | hE) F (rfl | hF) he + · rfl + · have hne : F ≠ E := fun h ↦ hD (h ▸ hF) + simp only [ite_true, ite_eq_right hne] at he + exact absurd he.symm (hout F hF) + · have hne : E ≠ F := fun h ↦ hD (h ▸ hE) + simp only [ite_true, ite_eq_right hne] at he + exact absurd he (hout E hE) + · have hne : E ≠ D := fun h ↦ hD (h ▸ hE) + have hne' : F ≠ D := fun h ↦ hD (h ▸ hF) + simp only [ite_eq_right hne, ite_eq_right hne'] at he + have hPout : ∀ G ∈ 𝓐, q G ∉ c '' D := fun G hG h ↦ disjoint_left.1 hPd ⟨G, hG, rfl⟩ h + exact hqi hE hF (h₁.injOn (hPout E hE) (hPout F hF) he) + +end Disc + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FragmentCut.lean b/LeanPool/GraphMinor/GM19/FragmentCut.lean new file mode 100644 index 0000000000..fa4ef26f00 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FragmentCut.lean @@ -0,0 +1,131 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FragmentOrient +public import LeanPool.GraphMinor.Surface.CutOArc +public import LeanPool.GraphMinor.Surface.Epstein + +/-! +# Cutting a closed surface along a non-null-homotopic `O`-arc + +Each piece of a closed connected surface, cut along an `O`-arc that is not null-homotopic, is +simpler than the surface +(`exists_cut_simpler`). The surface `cutOArc` leaves three cases. A piece that is a copy of the +surface would have no boundary, while +each piece has boundary. A piece that is a closed disc would give a closed disc that holds the +`O`-arc, and then the `O`-arc is +null-homotopic by `epstein`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {T : Type} [TopologicalSpace T] [T2Space T] [ConnectedSpace T] + +theorem exists_cut_simpler (hT : IsClosedSurface T) {F : Set T} (hF : IsOArc F) + (hn : ¬ IsNullHomotopicOArc F) : + ∃ (S' : Type) (_ : TopologicalSpace S') (ψ : S' → T), IsSurface S' ∧ IsCutting ψ F ∧ + ∀ C ∈ spaceComponents S', IsSimplerThan C T := by + classical + have hb : bd T = ∅ := eq_empty_of_forall_notMem fun x hx ↦ hx (hT.2.2 x) + obtain ⟨S', tS', ψ, hS', hcut, hcase, harcs⟩ := cutOArc T F hT.isSurface inferInstance hF + (by rw [hb]; exact disjoint_empty _) + refine ⟨S', tS', ψ, hS', hcut, ?_⟩ + have hψ : IsCutMap ψ F := IsCutting.isCutMap hcut + have : CompactSpace S' := hS'.1 + have : T2Space S' := hS'.2.1 + have : LocallyConnectedSpace S' := hS'.locallyConnected + have : CompactSpace T := hT.1 + have hFne : F.Nonempty := by + obtain ⟨φ⟩ := hF + exact ⟨_, (φ 1).2⟩ + have hmeet : ∀ x : S', (connectedComponent x ∩ ψ ⁻¹' F).Nonempty := by + intro x + by_contra hne + have hsub : connectedComponent x ⊆ ψ ⁻¹' Fᶜ := fun w hw hwF ↦ hne ⟨w, hw, hwF⟩ + have hop : IsOpen (ψ '' connectedComponent x) := isOpen_image_of_isCutMap hψ hsub + isOpen_connectedComponent + have hcl : IsClosed (ψ '' connectedComponent x) := (isClosed_connectedComponent.isCompact.image + hψ.1).isClosed + have huniv : ψ '' connectedComponent x = univ := IsClopen.eq_univ ⟨hcl, hop⟩ ⟨_, + mem_image_of_mem _ mem_connectedComponent⟩ + obtain ⟨f, hf⟩ := hFne + obtain ⟨w, hw, rfl⟩ := huniv.ge (mem_univ f) + exact hsub hw hf + have hmemC : ∀ {C}, C ∈ spaceComponents S' → ∃ x, C = connectedComponent x ∧ IsOpen C + := fun {C} hC ↦ by + rw [spaceComponents_eq] at hC + obtain ⟨x, rfl⟩ := hC + exact ⟨x, rfl, isOpen_connectedComponent⟩ + have hbS : ψ ⁻¹' F ⊆ bd S' := hψ.2.2.2.2 + rcases hcase with h | ⟨C₁, C₂, hne, hc, -, ⟨e⟩⟩ | ⟨C₁, C₂, hne, hc, hd⟩ + · exact h.2 + · exfalso + have hC₂ : C₂ ∈ spaceComponents S' := by + rw [hc] + exact mem_insert_of_mem _ rfl + obtain ⟨x, rfl, hop⟩ := hmemC hC₂ + obtain ⟨w, hw, hwF⟩ := hmeet x + have hbw : (⟨w, hw⟩ : connectedComponent x) ∈ bd (connectedComponent x) := (mem_bd_sub hop).2 + (hbS hwF) + have := (isInteriorPoint_homeomorph_iff e ⟨w, hw⟩).1 (hT.2.2 _) + exact hbw this + · exfalso + have hm₁ : C₁ ∈ spaceComponents S' := by rw [hc]; exact mem_insert _ _ + have hm₂ : C₂ ∈ spaceComponents S' := by rw [hc]; exact mem_insert_of_mem _ rfl + obtain ⟨x₁, rfl, -⟩ := hmemC hm₁ + obtain ⟨x₂, rfl, -⟩ := hmemC hm₂ + have hdisj : Disjoint (connectedComponent x₁) (connectedComponent x₂) := + connectedComponent_disjoint hne + have hin : ∀ {Z : Set S'} {x : S'}, IsPreconnected Z → (connectedComponent x ∩ Z).Nonempty + → Z ⊆ connectedComponent x := by + rintro Z x hZ ⟨w, hw, hwZ⟩ + rw [connectedComponent_eq hw] + exact hZ.subset_connectedComponent hwZ + rcases harcs with ⟨X, Z, hXZ, hun, hX, hZ, hbX, hbZ⟩ | hO + · have key : ∀ {A B : Set S'}, IsOArc A → BijOn ψ A F → A ⊆ connectedComponent x₁ + → B ⊆ connectedComponent x₂ → A ∪ B = ψ ⁻¹' F → False := by + intro A B hA hbA hA₁ hB₂ hAB + have hinj : InjOn ψ (connectedComponent x₁) := by + intro a ha b hb he + by_cases hf : ψ a ∈ F + · have hmem : ∀ {z}, z ∈ connectedComponent x₁ → ψ z ∈ F → z ∈ A := fun {z} hz hzF ↦ by + have : z ∈ A ∪ B := hAB ▸ hzF + exact this.resolve_right fun h ↦ disjoint_left.1 hdisj hz (hB₂ h) + exact hbA.injOn (hmem ha hf) (hmem hb (he ▸ hf)) he + · exact hψ.2.2.1 hf (fun h ↦ hf (he ▸ h)) he + have hdisc := (isClosedDisc_image_injOn hd hψ.1.continuousOn hinj).1 + have hFsub : F ⊆ ψ '' connectedComponent x₁ := fun f hf ↦ by + obtain ⟨a, ha, rfl⟩ := hbA.surjOn hf + exact mem_image_of_mem _ (hA₁ ha) + exact hn ((epstein T univ F hT.isSurface inferInstance hF (subset_univ _) + (by rw [hb]; exact disjoint_empty _)).2.1 + ⟨_, subset_univ _, hdisc, hFsub⟩) + obtain ⟨w₁, hw₁, hF₁⟩ := hmeet x₁ + obtain ⟨w₂, hw₂, hF₂⟩ := hmeet x₂ + rw [← hun] at hF₁ hF₂ + rcases hF₁ with h₁ | h₁ <;> rcases hF₂ with h₂ | h₂ + · have := hin hX.isPreconnected ⟨w₁, hw₁, h₁⟩ + exact disjoint_left.1 hdisj (this h₂) hw₂ + · exact key hX hbX (hin hX.isPreconnected ⟨w₁, hw₁, h₁⟩) (hin hZ.isPreconnected ⟨w₂, hw₂, + h₂⟩) hun + · exact key hZ hbZ (hin hZ.isPreconnected ⟨w₁, hw₁, h₁⟩) (hin hX.isPreconnected ⟨w₂, hw₂, + h₂⟩) (by rw [union_comm]; exact hun) + · have := hin hZ.isPreconnected ⟨w₁, hw₁, h₁⟩ + exact disjoint_left.1 hdisj (this h₂) hw₂ + · obtain ⟨w₁, hw₁, hF₁⟩ := hmeet x₁ + obtain ⟨w₂, hw₂, hF₂⟩ := hmeet x₂ + have := hin hO.isPreconnected ⟨w₁, hw₁, hF₁⟩ + exact disjoint_left.1 hdisj (this hF₂) hw₂ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FragmentDirection.lean b/LeanPool/GraphMinor/GM19/FragmentDirection.lean new file mode 100644 index 0000000000..d15f57e313 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FragmentDirection.lean @@ -0,0 +1,314 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FragmentChord +public import LeanPool.GraphMinor.GM19.CircleLift + +/-! +# Directions of a circle + +A direction of the boundary of a closed disc comes from a parametrization by the circle. Two +directions of one `O`-arc are equal or +reverse (`IsDirectionOf.same_or_reverse`), since a homeomorphism of the circle keeps or reverses the +cyclic order. We then consider +relations given only on a family of discs (`IsPartialOrientation`). Two of them on a closed disc +that are equal on one subdisc are equal +on every subdisc, by `exists_nested_chord`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric Filter GraphMinor.Surface + +theorem exp_eq_of_angles {s t : ℝ} (hs : 0 < s) (hs' : s < 2 * Real.pi) (ht : 0 < t) + (ht' : t < 2 * Real.pi) + (h : Circle.exp s = Circle.exp t) : s = t := + CircleOrder.exp_eq_of_angles hs hs' ht ht' h + +/-- Three points of the circle do not lie in both cyclic orders. -/ +theorem not_circleCyclic_both {a b c : Circle} (h : CircleCyclic a b c) + (h' : CircleCyclic a c b) : False := + CircleOrder.not_circleCyclic_both h h' + +theorem circleCyclic_inv {a b c : Circle} (h : CircleCyclic a b c) : CircleCyclic a⁻¹ c⁻¹ b⁻¹ := + CircleOrder.circleCyclic_inv h + +theorem exists_angle_of_circle (a : Circle) : ∃ α : ℝ, a = Circle.exp α := + CircleOrder.exists_angle_of_circle a + +/-- A homeomorphism of the circle with an increasing lift keeps the cyclic order. -/ +theorem circleCyclic_map_mono {τ : Circle ≃ₜ Circle} {L : ℝ → ℝ} (hc : Continuous L) + (hm : StrictMono L) + (hl : ∀ t, τ (Circle.exp t) = Circle.exp (L t)) {a b c : Circle} (h : CircleCyclic a b c) : + CircleCyclic (τ a) (τ b) (τ c) := + CircleCyclic.map_increasing_lift hc hm hl h + +/-- A homeomorphism of the circle with a decreasing lift reverses the cyclic order. -/ +theorem circleCyclic_map_anti {τ : Circle ≃ₜ Circle} {L : ℝ → ℝ} (hc : Continuous L) + (hm : StrictAnti L) + (hl : ∀ t, τ (Circle.exp t) = Circle.exp (L t)) {a b c : Circle} (h : CircleCyclic a b c) : + CircleCyclic (τ a) (τ c) (τ b) := + CircleCyclic.map_decreasing_lift hc hm hl h + +theorem circle_map_or (τ : Circle ≃ₜ Circle) : + (∀ a b c : Circle, a ≠ b → b ≠ c → a ≠ c → (CircleCyclic a b c ↔ CircleCyclic (τ a) (τ b) + (τ c))) ∨ + (∀ a b c : Circle, a ≠ b → b ≠ c → a ≠ c → (CircleCyclic a b c ↔ CircleCyclic (τ a) (τ c) + (τ b))) := + circleCyclic_homeomorph τ + +variable {X : Type} [TopologicalSpace X] [T2Space X] + +/-- `r` is a direction of the set `F`: a cyclic order that comes from a parametrization of `F` by +the circle. -/ +def IsDirectionOf (F : Set X) (r : X → X → X → Prop) : Prop := + ∃ φ : Circle → X, Continuous φ ∧ Function.Injective φ ∧ range φ = F ∧ + ∀ a b c : Circle, a ≠ b → b ≠ c → a ≠ c → (r (φ a) (φ b) (φ c) ↔ CircleCyclic a b c) + +omit [T2Space X] in +theorem IsDirectionOf.swap {F : Set X} {r : X → X → X → Prop} (h : IsDirectionOf F r) {a b c : X} + (ha : a ∈ F) (hb : b ∈ F) (hc : c ∈ F) + (hab : a ≠ b) (hbc : b ≠ c) (hac : a ≠ c) : r a b c ↔ ¬ r a c b := by + obtain ⟨φ, -, hi, rfl, hφ⟩ := h + obtain ⟨a, rfl⟩ := ha + obtain ⟨b, rfl⟩ := hb + obtain ⟨c, rfl⟩ := hc + have hab' : a ≠ b := fun h ↦ hab (by rw [h]) + have hac' : a ≠ c := fun h ↦ hac (by rw [h]) + have hbc' : b ≠ c := fun h ↦ hbc (by rw [h]) + rw [hφ a b c hab' hbc' hac', hφ a c b hac' hbc'.symm hab'] + exact ⟨fun h h' ↦ not_circleCyclic_both h h', fun h ↦ (circleCyclic_or hab' hac' + hbc').resolve_right h⟩ + +theorem IsDirectionOf.same_or_reverse {F : Set X} {r r' : X → X → X → Prop} (h : IsDirectionOf F r) + (h' : IsDirectionOf F r') : + (∀ a b c, a ∈ F → b ∈ F → c ∈ F → a ≠ b → b ≠ c → a ≠ c → (r a b c ↔ r' a b c)) ∨ + (∀ a b c, a ∈ F → b ∈ F → c ∈ F → a ≠ b → b ≠ c → a ≠ c → (r a b c ↔ r' a c b)) := by + obtain ⟨φ, hc, hi, rfl, hφ⟩ := h + obtain ⟨φ', hc', hi', hr, hφ'⟩ := h' + let e : Circle ≃ₜ range φ := (hc.isClosedEmbedding hi).isEmbedding.toHomeomorph + let e' : Circle ≃ₜ range φ' := (hc'.isClosedEmbedding hi').isEmbedding.toHomeomorph + let τ : Circle ≃ₜ Circle := e.trans ((Homeomorph.setCongr hr.symm).trans e'.symm) + have hτ : ∀ x, φ' (τ x) = φ x := fun x ↦ by + have : (e' (τ x)).1 = (e x).1 := by + change (e' (e'.symm (Homeomorph.setCongr hr.symm (e x)))).1 = _ + rw [e'.apply_symm_apply] + rfl + exact this + have hne : ∀ {x y : Circle}, x ≠ y → τ x ≠ τ y := fun h h' ↦ h (τ.injective h') + rcases circle_map_or τ with hm | hm + · refine Or.inl ?_ + rintro _ _ _ ⟨a, rfl⟩ ⟨b, rfl⟩ ⟨c, rfl⟩ hab hbc hac + have hab' : a ≠ b := fun h ↦ hab (by rw [h]) + have hac' : a ≠ c := fun h ↦ hac (by rw [h]) + have hbc' : b ≠ c := fun h ↦ hbc (by rw [h]) + rw [hφ a b c hab' hbc' hac', ← hτ a, ← hτ b, ← hτ c, hφ' _ _ _ (hne hab') (hne hbc') (hne hac')] + exact hm a b c hab' hbc' hac' + · refine Or.inr ?_ + rintro _ _ _ ⟨a, rfl⟩ ⟨b, rfl⟩ ⟨c, rfl⟩ hab hbc hac + have hab' : a ≠ b := fun h ↦ hab (by rw [h]) + have hac' : a ≠ c := fun h ↦ hac (by rw [h]) + have hbc' : b ≠ c := fun h ↦ hbc (by rw [h]) + rw [hφ a b c hab' hbc' hac', ← hτ a, ← hτ b, ← hτ c, hφ' _ _ _ (hne hac') (hne hbc'.symm) + (hne hab')] + exact hm a b c hab' hbc' hac' + +/-- The relation `pos` is a direction of the boundary of each disc of `𝓕`, and nested discs of `𝓕` +agree on common boundary points. +So `pos` is an orientation, restricted to the discs of `𝓕`. -/ +structure IsPartialOrientation (𝓕 : Set (Set X)) (pos : Set X → X → X → X → Prop) : Prop where + dir : ∀ Δ ∈ 𝓕, IsClosedDisc Δ → IsDirectionOf (discBd Δ) (pos Δ) + agree : ∀ Δ₁ ∈ 𝓕, ∀ Δ₂ ∈ 𝓕, IsClosedDisc Δ₁ → IsClosedDisc Δ₂ → Δ₁ ⊆ Δ₂ → ∀ a b c : X, + a ∈ discBd Δ₁ ∩ discBd Δ₂ → b ∈ discBd Δ₁ ∩ discBd Δ₂ → c ∈ discBd Δ₁ ∩ discBd Δ₂ → + a ≠ b → b ≠ c → a ≠ c → (pos Δ₁ a b c ↔ pos Δ₂ a b c) + +omit [T2Space X] in +theorem SurfaceOrientation.isPartial (ω : SurfaceOrientation X) (𝓕 : Set + (Set X)) : IsPartialOrientation 𝓕 ω.pos := + ⟨fun Δ _ hΔ ↦ ω.isDirection Δ hΔ, fun Δ₁ _ Δ₂ _ h₁ h₂ ↦ ω.agree Δ₁ Δ₂ h₁ h₂⟩ + +omit [T2Space X] in +theorem IsPartialOrientation.mono {𝓕 𝓖 : Set (Set X)} {pos : Set X → X → X → X → Prop} + (h : IsPartialOrientation 𝓕 pos) (hs : 𝓖 ⊆ 𝓕) : + IsPartialOrientation 𝓖 pos := + ⟨fun Δ hΔ ↦ h.dir Δ (hs hΔ), fun Δ₁ h₁ Δ₂ h₂ ↦ h.agree Δ₁ (hs h₁) Δ₂ (hs h₂)⟩ + +/-- The reverse of `pos`. -/ +def revPos (pos : Set X → X → X → X → Prop) : Set X → X → X → X → Prop := fun Δ a b c ↦ pos Δ a c b + +omit [T2Space X] in +theorem IsPartialOrientation.rev {𝓕 : Set (Set X)} {pos : Set X → X → X → X → Prop} + (h : IsPartialOrientation 𝓕 pos) : + IsPartialOrientation 𝓕 (revPos pos) := by + refine ⟨fun Δ hΔ hd ↦ ?_, fun Δ₁ h₁ Δ₂ h₂ hd₁ hd₂ hs a b c ha hb hc hab hbc hac ↦ + h.agree Δ₁ h₁ Δ₂ h₂ hd₁ hd₂ hs a c b ha hc hb hac hbc.symm hab⟩ + obtain ⟨φ, hc, hi, hr, hφ⟩ := h.dir Δ hΔ hd + refine ⟨fun x ↦ φ x⁻¹, by fun_prop, fun x y he ↦ inv_injective (hi he), ?_, + fun a b c hab hbc hac ↦ ?_⟩ + · rw [← hr] + ext x + constructor + · rintro ⟨y, rfl⟩ + exact ⟨y⁻¹, rfl⟩ + · rintro ⟨y, rfl⟩ + exact ⟨y⁻¹, by simp⟩ + · have hne : ∀ {x y : Circle}, x ≠ y → x⁻¹ ≠ y⁻¹ := fun h h' ↦ h (inv_injective h') + change pos Δ (φ a⁻¹) (φ c⁻¹) (φ b⁻¹) ↔ _ + rw [hφ _ _ _ (hne hac) (hne hbc.symm) (hne hab)] + refine ⟨fun h ↦ ?_, circleCyclic_inv⟩ + simpa using circleCyclic_inv h + +/-- The relations `pos` and `pos'` are equal on the boundary of `Δ`. -/ +def SameOn (pos pos' : Set X → X → X → X → Prop) (Δ : Set X) : Prop := + ∀ a b c, a ∈ discBd Δ → b ∈ discBd Δ → c ∈ discBd Δ → a ≠ b → b ≠ c → a ≠ c → + (pos Δ a b c ↔ pos' Δ a b c) + +theorem sameOn_iff_triple {pos pos' : Set X → X → X → X → Prop} {Δ : Set X} (h : IsDirectionOf + (discBd Δ) (pos Δ)) + (h' : IsDirectionOf (discBd Δ) (pos' Δ)) {a b c : X} (ha : a ∈ discBd Δ) (hb : b ∈ discBd Δ) + (hc : c ∈ discBd Δ) (hab : a ≠ b) + (hbc : b ≠ c) (hac : a ≠ c) : SameOn pos pos' Δ ↔ (pos Δ a b c ↔ pos' Δ a b c) := by + refine ⟨fun hs ↦ hs a b c ha hb hc hab hbc hac, fun he ↦ ?_⟩ + rcases h.same_or_reverse h' with h₁ | h₁ + · exact h₁ + · have h₂ := h₁ a b c ha hb hc hab hbc hac + have h₃ := h'.swap ha hc hb hac hbc.symm hab + have h₄ := h'.swap ha hb hc hab hbc hac + tauto + +theorem sameOn_of_notSame {pos pos' : Set X → X → X → X → Prop} {Δ : Set X} (h : IsDirectionOf + (discBd Δ) (pos Δ)) + (h' : IsDirectionOf (discBd Δ) (pos' Δ)) (hn : ¬ SameOn pos pos' Δ) : SameOn pos + (revPos pos') Δ := + (h.same_or_reverse h').resolve_left hn + +/-- Nested discs with three common boundary points are alike for the comparison of two relations. -/ +theorem sameOn_nested_triple {𝓕 : Set (Set X)} {pos pos' : Set X → X → X → X → Prop} + (h : IsPartialOrientation 𝓕 pos) + (h' : IsPartialOrientation 𝓕 pos') {Δ₁ Δ₂ : Set X} (h₁ : Δ₁ ∈ 𝓕) (h₂ : Δ₂ ∈ 𝓕) + (hd₁ : IsClosedDisc Δ₁) (hd₂ : IsClosedDisc Δ₂) + (hs : Δ₁ ⊆ Δ₂) (ht : HasTriple (discBd Δ₁ ∩ discBd Δ₂)) : SameOn pos pos' Δ₁ ↔ SameOn pos pos' + Δ₂ := by + obtain ⟨a, b, c, ha, hb, hc, hab, hbc, hac⟩ := ht + rw [sameOn_iff_triple (h.dir _ h₁ hd₁) (h'.dir _ h₁ hd₁) ha.1 hb.1 hc.1 hab hbc hac, + sameOn_iff_triple (h.dir _ h₂ hd₂) (h'.dir _ h₂ hd₂) ha.2 hb.2 hc.2 hab hbc hac, + h.agree _ h₁ _ h₂ hd₁ hd₂ hs a b c ha hb hc hab hbc hac, h'.agree _ h₁ _ h₂ hd₁ hd₂ hs a b c ha + hb hc hab hbc hac] + +theorem sameOn_of_subset_discInt {𝓕 : Set (Set X)} {pos pos' : Set X → X → X → X → Prop} + (hh : ∀ Δ ∈ 𝓕, ∀ Δ' ⊆ Δ, Δ' ∈ 𝓕) + (h : IsPartialOrientation 𝓕 pos) (h' : IsPartialOrientation 𝓕 pos') {D₀ D₁ : Set X} + (h₁ : D₁ ∈ 𝓕) (hd₀ : IsClosedDisc D₀) + (hd₁ : IsClosedDisc D₁) (hs : D₀ ⊆ discInt D₁) : SameOn pos pos' D₀ ↔ SameOn pos pos' D₁ := by + obtain ⟨Δ, hΔ, h₀Δ, hΔ₁, t₁, t₂⟩ := exists_nested_chord hd₀ hd₁ hs + have hF : Δ ∈ 𝓕 := hh D₁ h₁ Δ hΔ₁ + have hF₀ : D₀ ∈ 𝓕 := hh Δ hF D₀ h₀Δ + exact (sameOn_nested_triple h h' hF₀ hF hd₀ hΔ h₀Δ t₁).trans (sameOn_nested_triple h h' hF h₁ hΔ + hd₁ hΔ₁ t₂) + +/-- A closed disc has a smaller closed disc in its inside. -/ +theorem exists_inner_disc {D : Set X} (hD : IsClosedDisc D) : ∃ D', IsClosedDisc D' + ∧ D' ⊆ discInt D := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hb : Convex ℝ (closedBall (0 : ℂ) (1 / 2)) := convex_closedBall _ _ + obtain ⟨hZ, -⟩ := isClosedDisc_of_convex hb (by + rw [interior_closedBall _ (by norm_num)] + exact ⟨0, by simp⟩) isBounded_closedBall isClosed_closedBall + have hs : closedBall (0 : ℂ) (1 / 2) ⊆ closedBall 0 1 := closedBall_subset_closedBall + (by norm_num) + refine ⟨g '' closedBall 0 (1 / 2), (isClosedDisc_image_injOn hZ (c.gc.mono hs) + (c.hg.injOn.mono hs)).1, ?_⟩ + rw [c.discInt_eq] + exact image_mono (closedBall_subset_ball (by norm_num)) + +/-- Two relations are equal on a subdisc if and only if they are equal on the disc. This is the step +that makes orientations rigid. -/ +theorem sameOn_of_subset (hman : ∀ x : X, IsManifoldPoint x) {𝓕 : Set (Set X)} {pos pos' : Set X + → X → X → X → Prop} + (hh : ∀ Δ ∈ 𝓕, ∀ Δ' ⊆ Δ, Δ' ∈ 𝓕) (h : IsPartialOrientation 𝓕 pos) + (h' : IsPartialOrientation 𝓕 pos') {D₀ D₁ : Set X} (h₁ : D₁ ∈ 𝓕) + (hd₀ : IsClosedDisc D₀) (hd₁ : IsClosedDisc D₁) (hs : D₀ ⊆ D₁) : SameOn pos pos' D₀ ↔ SameOn + pos pos' D₁ := by + obtain ⟨D', hD', hin⟩ := exists_inner_disc hd₀ + have hF₀ : D₀ ∈ 𝓕 := hh D₁ h₁ D₀ hs + rw [← sameOn_of_subset_discInt hh h h' hF₀ hD' hd₀ hin] + exact sameOn_of_subset_discInt hh h h' h₁ hD' hd₁ (hin.trans (discInt_mono hman hd₀ hs)) + +omit [T2Space X] in +/-- Around an interior point there is a closed disc inside any given open set. -/ +theorem exists_small_disc {y : X} (hy : IsInteriorPoint y) {W : Set X} (hW : IsOpen W) + (hyW : y ∈ W) : + ∃ E : Set X, IsClosedDisc E ∧ y ∈ discInt E ∧ E ⊆ W := by + obtain ⟨U, h, g, c, hU, hg0⟩ := hy.exists_ballChart hW hyW (R := 2) two_pos + obtain ⟨hZ, hbd⟩ := isClosedDisc_closedBall + have hsub : Metric.closedBall (0 : ℂ) 1 ⊆ Metric.ball 0 2 := + Metric.closedBall_subset_ball (by norm_num) + obtain ⟨hE, hEb⟩ := c.image_disc hZ hsub + refine ⟨_, hE, ⟨⟨0, by simp, hg0⟩, fun hy' ↦ ?_⟩, image_subset_iff.2 fun z hz ↦ hU (c.gm + (hsub hz))⟩ + rw [hEb, hbd] at hy' + obtain ⟨z, hz, hzy⟩ := hy' + have hz' : ‖z‖ = 1 := by simpa using hz + have h₁ : z = 0 := by + have ha := c.hg (show z ∈ Metric.ball (0 : ℂ) 2 from hsub (Metric.sphere_subset_closedBall hz)) + have hb := c.hg (show (0 : ℂ) ∈ Metric.ball (0 : ℂ) 2 by simp) + rw [← ha, hzy, ← hg0, hb] + rw [h₁] at hz' + simp at hz' + +/-- **Rigidity.** Two relations on the discs of a connected open set of interior points are equal on +all discs or on none. -/ +theorem sameOn_const (hman : ∀ x : X, IsManifoldPoint x) {G : Set X} (hG : IsOpen G) + (hGc : IsPreconnected G) + (hint : ∀ x ∈ G, IsInteriorPoint x) {pos pos' : Set X → X → X → X → Prop} + (h : IsPartialOrientation {Δ | Δ ⊆ G} pos) + (h' : IsPartialOrientation {Δ | Δ ⊆ G} pos') {D₁ D₂ : Set X} (hd₁ : IsClosedDisc D₁) + (hd₂ : IsClosedDisc D₂) (hs₁ : D₁ ⊆ G) + (hs₂ : D₂ ⊆ G) : SameOn pos pos' D₁ ↔ SameOn pos pos' D₂ := by + have hh : ∀ Δ ∈ {Δ | Δ ⊆ G}, ∀ Δ' ⊆ Δ, Δ' ∈ {Δ | Δ ⊆ G} := fun Δ hΔ Δ' hs ↦ hs.trans hΔ + have key : ∀ {D D' : Set X}, IsClosedDisc D → IsClosedDisc D' → D ⊆ G → D' ⊆ G → + (discInt D ∩ discInt D').Nonempty → + (SameOn pos pos' D ↔ SameOn pos pos' D') := by + intro D D' hD hD' hs hs' ⟨x, hx, hx'⟩ + obtain ⟨E, hE, hxE, hEW⟩ := exists_small_disc (hint x (hs (discInt_subset D hx))) + ((hD.isOpen_discInt hman).inter (hD'.isOpen_discInt hman)) ⟨hx, hx'⟩ + rw [← sameOn_of_subset_discInt hh h h' hs hE hD (hEW.trans inter_subset_left), + ← sameOn_of_subset_discInt hh h h' hs' hE hD' (hEW.trans inter_subset_right)] + let Z : Prop → Set X := fun p ↦ ⋃₀ {U | ∃ D, IsClosedDisc D ∧ D ⊆ G ∧ U = discInt D ∧ + (SameOn pos pos' D ↔ p)} + have hop : ∀ p, IsOpen (Z p) := fun p ↦ isOpen_sUnion (by + rintro _ ⟨D, hD, -, rfl, -⟩ + exact hD.isOpen_discInt hman) + have hmem : ∀ {D}, IsClosedDisc D → D ⊆ G → ∀ {x}, x ∈ discInt D → x ∈ Z (SameOn pos pos' D) + := fun hD hs _ hx ↦ + ⟨_, ⟨_, hD, hs, rfl, Iff.rfl⟩, hx⟩ + have hdisj : Disjoint (Z True) (Z False) := by + refine disjoint_left.2 ?_ + rintro x ⟨_, ⟨D, hD, hs, rfl, ht⟩, hx⟩ ⟨_, ⟨D', hD', hs', rfl, hf⟩, hx'⟩ + have := key hD hD' hs hs' ⟨x, hx, hx'⟩ + tauto + have hcov : G ⊆ Z True ∪ Z False := by + intro x hx + obtain ⟨E, hE, hxE, hEW⟩ := exists_small_disc (hint x hx) hG hx + by_cases hc : SameOn pos pos' E + · exact Or.inl ⟨_, ⟨E, hE, hEW, rfl, by simpa using hc⟩, hxE⟩ + · exact Or.inr ⟨_, ⟨E, hE, hEW, rfl, by simpa using hc⟩, hxE⟩ + have hex : ∀ {D}, IsClosedDisc D → D ⊆ G → ∀ p, G ⊆ Z p → (SameOn pos pos' D ↔ p) := by + intro D hD hs p hp + obtain ⟨x, hx⟩ := hD.nonempty_discInt + obtain ⟨_, ⟨D', hD', hs', rfl, he⟩, hx'⟩ := hp (hs (discInt_subset D hx)) + exact (key hD hD' hs hs' ⟨x, hx, hx'⟩).trans he + rcases hGc.subset_or_subset (hop _) (hop _) hdisj hcov with hZ | hZ + · exact (hex hd₁ hs₁ _ hZ).trans (hex hd₂ hs₂ _ hZ).symm + · exact (hex hd₁ hs₁ _ hZ).trans (hex hd₂ hs₂ _ hZ).symm + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FragmentExtend.lean b/LeanPool/GraphMinor/GM19/FragmentExtend.lean new file mode 100644 index 0000000000..4babac9c94 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FragmentExtend.lean @@ -0,0 +1,456 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FragmentDirection + +/-! +# Extending an orientation over a finite set + +We show that a partial orientation of a closed connected surface `T` off a finite set `A` extends to +a surface orientation of `T` +(`extend_orientation`), by induction on `A` using `extend_over_point`. Given a partial orientation +`pos` on closed discs in +`(insert p A₀)ᶜ` with `p ∉ A₀`, `extend_over_point` extends `pos` to closed discs in `A₀ᶜ`: a +homeomorphism supported in a closed disc +`D ⊆ A₀ᶜ` (`exists_inside_move`) moves a puncture inside `discInt D` while preserving the +orientation off both punctures +(`IsPunctureShift.move`, by `sameOn_const`), connectedness of `A₀ᶜ` shifts the puncture `p` to any +point `q ∈ A₀ᶜ`, and any two shifted +orientations agree on closed discs in `A₀ᶜ` avoiding their punctures (by `sameOn_const`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric Filter GraphMinor.Surface + +variable {X Y : Type} [TopologicalSpace X] [T2Space X] [TopologicalSpace Y] [T2Space Y] + +/-- The relation `pos` on `Y`, read on `X` through `j`. -/ +def pullPos (j : X → Y) (pos : Set Y → Y → Y → Y → Prop) : Set X → X → X → X → Prop := + fun Δ a b c ↦ pos (j '' Δ) (j a) (j b) (j c) + +theorem isCompact_of_isClosedDisc {T : Type*} [TopologicalSpace T] {D : Set T} + (hD : IsClosedDisc D) : IsCompact D := by + obtain ⟨e⟩ := hD + have : D = range fun z ↦ (e z).1 := by + ext x + constructor + · intro hx + exact ⟨e.symm ⟨x, hx⟩, by simp⟩ + · rintro ⟨z, rfl⟩ + exact (e z).2 + rw [this] + have : CompactSpace ClosedUnitDisc := isCompact_iff_compactSpace.1 (isCompact_closedBall 0 1) + exact isCompact_range (continuous_subtype_val.comp e.continuous) + +theorem isPreconnected_of_isClosedDisc {T : Type*} [TopologicalSpace T] {D : Set T} + (hD : IsClosedDisc D) : IsPreconnected D := by + obtain ⟨e⟩ := hD + have : D = range fun z ↦ (e z).1 := by + ext x + constructor + · intro hx + exact ⟨e.symm ⟨x, hx⟩, by simp⟩ + · rintro ⟨z, rfl⟩ + exact (e z).2 + rw [this] + have : PreconnectedSpace ClosedUnitDisc := + isPreconnected_iff_preconnectedSpace.1 (convex_closedBall (0 : EuclideanPlane) 1).isPreconnected + exact isPreconnected_range (continuous_subtype_val.comp e.continuous) + +omit [T2Space X] in +theorem IsPartialOrientation.pull {𝓕 : Set (Set X)} {𝓖 : Set (Set Y)} {pos : Set Y → Y → Y → Y + → Prop} (h : IsPartialOrientation 𝓖 pos) + {j : X → Y} (hj : ∀ Δ ∈ 𝓕, ContinuousOn j Δ ∧ InjOn j Δ ∧ j '' Δ ∈ 𝓖) : IsPartialOrientation 𝓕 + (pullPos j pos) := by + refine ⟨fun Δ hΔ hd ↦ ?_, fun Δ₁ h₁ Δ₂ h₂ hd₁ hd₂ hs a b c ha hb hc hab hbc hac ↦ ?_⟩ + · obtain ⟨hcj, hij, hG⟩ := hj Δ hΔ + obtain ⟨hd', hb'⟩ := isClosedDisc_image_injOn hd hcj hij + obtain ⟨φ', hc, hi, hr, hφ⟩ := h.dir _ hG hd' + have hcpt : CompactSpace Δ := isCompact_iff_compactSpace.1 (isCompact_of_isClosedDisc hd) + let f : Δ → j '' Δ := fun x ↦ ⟨j x.1, mem_image_of_mem _ x.2⟩ + have hf : Continuous f := Continuous.subtype_mk (continuousOn_iff_continuous_domRestrict.1 hcj) + _ + have hbij : Function.Bijective f := ⟨fun x y he ↦ Subtype.ext (hij x.2 y.2 + (congrArg Subtype.val he)), fun ⟨_, x, hx, rfl⟩ ↦ ⟨⟨x, hx⟩, rfl⟩⟩ + let e : Δ ≃ₜ j '' Δ := hf.homeoOfEquivCompactToT2 (f := Equiv.ofBijective f hbij) + have hmem : ∀ z, φ' z ∈ j '' Δ := fun z ↦ Surface.discBd_subset _ (hr ▸ mem_range_self z) + let φ : Circle → X := fun z ↦ (e.symm ⟨φ' z, hmem z⟩).1 + have hjφ : ∀ z, j (φ z) = φ' z := fun z ↦ by + have : (e (e.symm ⟨φ' z, hmem z⟩)).1 = φ' z := by rw [e.apply_symm_apply] + exact this + have hφΔ : ∀ z, φ z ∈ Δ := fun z ↦ (e.symm _).2 + refine ⟨φ, continuous_subtype_val.comp (e.symm.continuous.comp (hc.subtype_mk hmem)), + fun x y he ↦ hi (by rw [← hjφ, ← hjφ, he]), ?_, + fun a b c hab hbc hac ↦ ?_⟩ + · ext x + constructor + · rintro ⟨z, rfl⟩ + have : j (φ z) ∈ j '' discBd Δ := by + rw [← hb', ← hr, hjφ] + exact mem_range_self z + obtain ⟨y, hy, he⟩ := this + exact hij (Surface.discBd_subset _ hy) (hφΔ z) he ▸ hy + · intro hx + have : j x ∈ range φ' := by + rw [hr, hb'] + exact mem_image_of_mem _ hx + obtain ⟨z, hz⟩ := this + exact ⟨z, hij (hφΔ z) (Surface.discBd_subset _ hx) ((hjφ z).trans hz)⟩ + · change pos (j '' Δ) (j (φ a)) (j (φ b)) (j (φ c)) ↔ _ + rw [hjφ, hjφ, hjφ] + exact hφ a b c hab hbc hac + · obtain ⟨hcj₁, hij₁, hG₁⟩ := hj Δ₁ h₁ + obtain ⟨hcj₂, hij₂, hG₂⟩ := hj Δ₂ h₂ + obtain ⟨hd₁', hb₁⟩ := isClosedDisc_image_injOn hd₁ hcj₁ hij₁ + obtain ⟨hd₂', hb₂⟩ := isClosedDisc_image_injOn hd₂ hcj₂ hij₂ + have hmem : ∀ {x}, x ∈ discBd Δ₁ ∩ discBd Δ₂ → j x ∈ discBd (j '' Δ₁) ∩ discBd (j '' Δ₂) + := fun hx ↦ + ⟨hb₁ ▸ mem_image_of_mem _ hx.1, hb₂ ▸ mem_image_of_mem _ hx.2⟩ + have hsub : ∀ {x}, x ∈ discBd Δ₁ ∩ discBd Δ₂ → x ∈ Δ₂ := fun hx ↦ Surface.discBd_subset _ hx.2 + exact h.agree _ hG₁ _ hG₂ hd₁' hd₂' (image_mono hs) _ _ _ (hmem ha) (hmem hb) (hmem hc) + (fun e ↦ hab (hij₂ (hsub ha) (hsub hb) e)) (fun e ↦ hbc (hij₂ (hsub hb) (hsub hc) e)) + (fun e ↦ hac (hij₂ (hsub ha) (hsub hc) e)) + +omit [T2Space X] in +theorem sameOn_rev_left {pos pos' : Set X → X → X → X → Prop} {Δ : Set X} (h : SameOn pos + (revPos pos') Δ) : SameOn (revPos pos) pos' Δ := + fun a b c ha hb hc hab hbc hac ↦ h a c b ha hc hb hac hbc.symm hab + +omit [T2Space X] in +theorem SameOn.trans {pos₁ pos₂ pos₃ : Set X → X → X → X → Prop} {Δ : Set X} + (h : SameOn pos₁ pos₂ Δ) (h' : SameOn pos₂ pos₃ Δ) : + SameOn pos₁ pos₃ Δ := fun a b c ha hb hc hab hbc hac ↦ (h a b c ha hb hc hab hbc hac).trans + (h' a b c ha hb hc hab hbc hac) + +omit [T2Space X] in +theorem SameOn.symm {pos₁ pos₂ : Set X → X → X → X → Prop} {Δ : Set X} + (h : SameOn pos₁ pos₂ Δ) : SameOn pos₂ pos₁ Δ := + fun a b c ha hb hc hab hbc hac ↦ (h a b c ha hb hc hab hbc hac).symm + +omit [T2Space X] in +theorem IsDirectionOf.congr {F : Set X} {r r' : X → X → X → Prop} (h : IsDirectionOf F r) + (he : ∀ a b c, a ∈ F → b ∈ F → c ∈ F → a ≠ b → b ≠ c → a ≠ c → (r a b c ↔ r' a b c)) : + IsDirectionOf F r' := by + obtain ⟨φ, hc, hi, rfl, hφ⟩ := h + refine ⟨φ, hc, hi, rfl, fun a b c hab hbc hac ↦ ?_⟩ + rw [← he _ _ _ (mem_range_self a) (mem_range_self b) (mem_range_self c) (hi.ne hab) (hi.ne hbc) + (hi.ne hac)] + exact hφ a b c hab hbc hac + +section Move + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +/-- A homeomorphism of `T`, the identity off the closed disc `D`, that takes the centre of a chart +of `D` to a given inside point. -/ +theorem exists_inside_push (hT : IsClosedSurface T) {D : Set T} {h : T → ℂ} {g : ℂ → T} + (hD : IsClosedDisc D) (c : IsChart D h g) {x : T} + (hx : x ∈ discInt D) : ∃ e : T ≃ₜ T, e (g 0) = x ∧ ∀ z ∉ D, e z = z := by + classical + have : CompactSpace T := hT.1 + have hman : ∀ x : T, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + rw [c.discInt_eq] at hx + obtain ⟨u, hu, rfl⟩ := hx + have hu' : ‖u‖ < 1 := by simpa using hu + obtain ⟨θ, θc, θb, θ0, θe⟩ := exists_disc_push hu' + let F : T → T := fun z ↦ if z ∈ D then g (θ (h z)) else z + have hin : ∀ {z}, z ∈ D → F z = g (θ (h z)) := fun hz ↦ ite_eq_left hz + have hout : ∀ {z}, z ∉ D → F z = z := fun hz ↦ ite_eq_right hz + have hbd : ∀ {z}, z ∈ discBd D → g (θ (h z)) = z := fun {z} hz ↦ by + have : h z ∈ sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem _ hz + rw [θe _ this] + exact c.gh (Surface.discBd_subset _ hz) + have hmaps : MapsTo (fun z ↦ g (θ (h z))) D D := fun z hz ↦ c.gm (θb.mapsTo (c.hm hz)) + have hcont : Continuous F := by + have h₁ : ContinuousOn F D := by + refine ContinuousOn.congr ?_ fun z hz ↦ hin hz + exact c.gc.comp (θc.comp_continuousOn c.hc) fun z hz ↦ θb.mapsTo (c.hm hz) + have h₂ : ContinuousOn F (closure Dᶜ) := by + refine continuousOn_id.congr fun z hz ↦ ?_ + by_cases hzD : z ∈ D + · rw [hin hzD] + refine hbd ?_ + by_contra hn + have hzi : z ∈ discInt D := ⟨hzD, hn⟩ + obtain ⟨w, hw, hwn⟩ := _root_.mem_closure_iff.1 hz _ (hD.isOpen_discInt hman) hzi + exact hwn (discInt_subset D hw) + · exact hout hzD + have hcov : D ∪ closure Dᶜ = univ := by + refine eq_univ_of_forall fun z ↦ ?_ + by_cases hz : z ∈ D + · exact Or.inl hz + · exact Or.inr (subset_closure hz) + have := h₁.union_of_isClosed h₂ hD.isClosed isClosed_closure + rw [hcov] at this + exact continuousOn_univ.1 this + have hbij : Function.Bijective F := by + constructor + · intro z w he + by_cases hz : z ∈ D <;> by_cases hw : w ∈ D + · rw [hin hz, hin hw] at he + have h₁ := c.hg.injOn (θb.mapsTo (c.hm hz)) (θb.mapsTo (c.hm hw)) he + have h₂ := θb.injOn (c.hm hz) (c.hm hw) h₁ + exact c.gh.injOn hz hw h₂ + · rw [hin hz, hout hw] at he + exact absurd (he ▸ hmaps hz) hw + · rw [hout hz, hin hw] at he + exact absurd (he.symm ▸ hmaps hw) hz + · rwa [hout hz, hout hw] at he + · intro w + by_cases hw : w ∈ D + · obtain ⟨v, hv, hve⟩ := θb.surjOn (c.hm hw) + refine ⟨g v, ?_⟩ + rw [hin (c.gm hv), c.hg hv, hve] + exact c.gh hw + · exact ⟨w, hout hw⟩ + let e : T ≃ₜ T := hcont.homeoOfEquivCompactToT2 (f := Equiv.ofBijective F hbij) + refine ⟨e, ?_, fun z hz ↦ hout hz⟩ + change F (g 0) = _ + rw [hin (c.gm (by simp)), c.hg (by simp), θ0] + +/-- Two inside points of a closed disc are moved one to the other by a homeomorphism that is the +identity off the disc. -/ +theorem exists_inside_move (hT : IsClosedSurface T) {D : Set T} (hD : IsClosedDisc D) {x y : T} + (hx : x ∈ discInt D) (hy : y ∈ discInt D) : + ∃ e : T ≃ₜ T, e x = y ∧ ∀ z ∉ D, e z = z := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + obtain ⟨e₁, h₁, h₂⟩ := exists_inside_push hT hD c hx + obtain ⟨e₂, h₃, h₄⟩ := exists_inside_push hT hD c hy + refine ⟨e₁.symm.trans e₂, ?_, fun z hz ↦ ?_⟩ + · simp [← h₁, h₃] + · have : e₁.symm z = z := by + rw [e₁.symm_apply_eq, h₂ z hz] + simp [this, h₄ z hz] + +theorem exists_test_disc (hT : IsClosedSurface T) {W : Set T} (hW : IsOpen W) + (hne : W.Nonempty) {B : Set T} (hB : B.Finite) : + ∃ E : Set T, IsClosedDisc E ∧ E ⊆ W ∩ Bᶜ := by + obtain ⟨x, hxW, hxB⟩ := (dense_compl_finite hT.2.2 hB).inter_open_nonempty W hW hne + obtain ⟨E, hE, -, hs⟩ := exists_small_disc (hT.2.2 x) (hW.inter hB.isClosed.isOpen_compl) ⟨hxW, + hxB⟩ + exact ⟨E, hE, hs⟩ + +omit [T2Space T] in +theorem nonempty_compl_disc (hT : IsClosedSurface T) {D : Set T} (hD : IsClosedDisc D) : + Dᶜ.Nonempty := by + by_contra hn + obtain ⟨y, hy⟩ := hD.nonempty_discInt + obtain ⟨x, hx, -⟩ := hD.isOArc_discBd.exists_ne y + have := discBd_subset_closure_compl hT hD hx + rw [not_nonempty_iff_eq_empty.1 hn, closure_empty] at this + exact this + +end Move + +section Extend + +variable {T : Type} [TopologicalSpace T] [T2Space T] [ConnectedSpace T] + +/-- `ρ` is an orientation off `q` and off `A₀`, and it is equal to `pos` off `p` and off `q`. -/ +structure IsPunctureShift (A₀ : Set T) (p q : T) (pos ρ : Set T → T → T → T → Prop) : Prop where + isPartial : IsPartialOrientation {Δ | Δ ⊆ (insert q A₀)ᶜ} ρ + same : ∀ D, IsClosedDisc D → D ⊆ (insert p (insert q A₀))ᶜ → SameOn ρ pos D + +omit [ConnectedSpace T] in +theorem isOpen_compl_finite (B : Set T) (hB : B.Finite) : IsOpen Bᶜ := hB.isClosed.isOpen_compl + +theorem isPreconnected_compl_finite (hT : IsClosedSurface T) {B : Set T} + (hB : B.Finite) : IsPreconnected Bᶜ := by + have := isPreconnected_sdiff_finite hT isOpen_univ isPreconnected_univ hB + rwa [show univ \ B = Bᶜ by ext; simp] at this + +/-- A shift of the puncture from `q` to a point `q'` of the same closed disc. -/ +theorem IsPunctureShift.move (hT : IsClosedSurface T) {A₀ : Set T} (hA : A₀.Finite) {p q q' : T} + {pos ρ : Set T → T → T → T → Prop} + (hpos : IsPartialOrientation {Δ | Δ ⊆ (insert p A₀)ᶜ} pos) (hρ : IsPunctureShift A₀ p q pos ρ) + {D : Set T} (hD : IsClosedDisc D) + (hDA : D ⊆ A₀ᶜ) (hq : q ∈ discInt D) (hq' : q' ∈ discInt D) : ∃ ρ', IsPunctureShift A₀ p q' pos + ρ' := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + obtain ⟨e, he, hfix⟩ := exists_inside_move hT hD hq' hq + have hP : IsPartialOrientation {Δ | Δ ⊆ (insert q' A₀)ᶜ} (pullPos e ρ) := by + refine hρ.isPartial.pull fun Δ hΔ ↦ ⟨e.continuous.continuousOn, e.injective.injOn, ?_⟩ + rintro _ ⟨z, hz, rfl⟩ (h | h) + · apply hΔ hz + exact Or.inl (e.injective (h.trans he.symm)) + · have hn : e z ∉ D := fun hin ↦ hDA hin h + have hzn : z ∉ D := fun hin ↦ by + have h' : e z = z := e.injective (hfix (e z) hn) + rw [h'] at hn + exact hn hin + apply hΔ hz + exact Or.inr (hfix z hzn ▸ h) + refine ⟨pullPos e ρ, hP, fun D₁ hD₁ hs ↦ ?_⟩ + have hfin : (insert p (insert q' A₀)).Finite := (hA.insert _).insert _ + have hG := isOpen_compl_finite _ hfin + have hGc := isPreconnected_compl_finite hT hfin + have h₁ : IsPartialOrientation {Δ | Δ ⊆ (insert p (insert q' A₀))ᶜ} (pullPos e ρ) + := hP.mono fun Δ hΔ ↦ + hΔ.trans (compl_subset_compl.2 (subset_insert _ _)) + have h₂ : IsPartialOrientation {Δ | Δ ⊆ (insert p (insert q' A₀))ᶜ} pos := hpos.mono fun Δ hΔ ↦ + hΔ.trans (compl_subset_compl.2 (insert_subset_insert (subset_insert _ _))) + obtain ⟨E, hE, hsE⟩ := exists_test_disc hT hD.isClosed.isOpen_compl (nonempty_compl_disc hT hD) + (B := insert q (insert p (insert q' A₀))) (hfin.insert _) + have hsG : E ⊆ (insert p (insert q' A₀))ᶜ := fun x hx hn ↦ (hsE hx).2 (Or.inr hn) + have hE₁ : E ⊆ (insert p (insert q A₀))ᶜ := by + intro x hx hn + have h' := (hsE hx).2 + rcases hn with h | h | h + · exact h' (Or.inr (Or.inl h)) + · exact h' (Or.inl h) + · exact h' (Or.inr (Or.inr (Or.inr h))) + have hfixE : ∀ x ∈ E, e x = x := fun x hx ↦ hfix x (hsE hx).1 + have himg : e '' E = E := by + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + rwa [hfixE y hy] + · intro hx + exact ⟨x, hx, hfixE x hx⟩ + have hSameE : SameOn (pullPos e ρ) pos E := by + intro a b c ha hb hc hab hbc hac + change ρ (e '' E) (e a) (e b) (e c) ↔ _ + rw [himg, hfixE a (Surface.discBd_subset _ ha), hfixE b (Surface.discBd_subset _ hb), + hfixE c (Surface.discBd_subset _ hc)] + exact hρ.same E hE hE₁ a b c ha hb hc hab hbc hac + exact (sameOn_const hman hG hGc (fun x _ ↦ hT.2.2 x) h₁ h₂ hE hD₁ hsG hs).1 hSameE + +/-- An orientation off `A₀` and off one more point `p` extends to an orientation off `A₀`. -/ +theorem extend_over_point (hT : IsClosedSurface T) {A₀ : Set T} (hA : A₀.Finite) {p : T} + (hp : p ∉ A₀) {pos : Set T → T → T → T → Prop} + (hpos : IsPartialOrientation {Δ | Δ ⊆ (insert p A₀)ᶜ} pos) : + ∃ pos', IsPartialOrientation {Δ | Δ ⊆ A₀ᶜ} pos' ∧ ∀ D, IsClosedDisc D → D ⊆ (insert p A₀)ᶜ + → SameOn pos' pos D := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + set Q : Set T := {q | ∃ ρ, IsPunctureShift A₀ p q pos ρ} with hQ + have hstart : IsPunctureShift A₀ p p pos pos := + ⟨hpos, fun D _ _ a b c _ _ _ _ _ _ ↦ Iff.rfl⟩ + have hopenV : IsOpen A₀ᶜ := isOpen_compl_finite _ hA + have hnear : ∀ x ∈ A₀ᶜ, ∃ D, IsClosedDisc D ∧ x ∈ discInt D ∧ D ⊆ A₀ᶜ + := fun x hx ↦ exists_small_disc (hT.2.2 x) hopenV hx + have hop₁ : IsOpen (Q ∩ A₀ᶜ) := by + refine isOpen_iff_mem_nhds.2 ?_ + rintro q ⟨⟨ρ, hρ⟩, hqV⟩ + obtain ⟨D, hD, hqD, hs⟩ := hnear q hqV + refine Filter.mem_of_superset ((hD.isOpen_discInt hman).mem_nhds hqD) fun q' hq' ↦ ?_ + exact ⟨hρ.move hT hA hpos hD hs hqD hq', hs (discInt_subset D hq')⟩ + have hop₂ : IsOpen (Qᶜ ∩ A₀ᶜ) := by + refine isOpen_iff_mem_nhds.2 ?_ + rintro q ⟨hqn, hqV⟩ + obtain ⟨D, hD, hqD, hs⟩ := hnear q hqV + refine Filter.mem_of_superset ((hD.isOpen_discInt hman).mem_nhds hqD) fun q' hq' ↦ ?_ + refine ⟨fun ⟨ρ, hρ⟩ ↦ hqn (hρ.move hT hA hpos hD hs hq' hqD), hs (discInt_subset D hq')⟩ + have hall : A₀ᶜ ⊆ Q := by + have hd : Disjoint (Q ∩ A₀ᶜ) (Qᶜ ∩ A₀ᶜ) := disjoint_left.2 fun x hx hx' ↦ hx'.1 hx.1 + have hcov : A₀ᶜ ⊆ (Q ∩ A₀ᶜ) ∪ (Qᶜ ∩ A₀ᶜ) := fun x hx ↦ by + by_cases h : x ∈ Q + · exact Or.inl ⟨h, hx⟩ + · exact Or.inr ⟨h, hx⟩ + rcases (isPreconnected_compl_finite hT hA).subset_or_subset hop₁ hop₂ hd hcov with h | h + · exact fun x hx ↦ (h hx).1 + · exact absurd ⟨pos, hstart⟩ (h hp).1 + have huniq : ∀ {q₁ q₂ ρ₁ ρ₂}, IsPunctureShift A₀ p q₁ pos ρ₁ → IsPunctureShift A₀ p q₂ pos ρ₂ + → ∀ {Δ}, IsClosedDisc Δ → + Δ ⊆ A₀ᶜ → q₁ ∉ Δ → q₂ ∉ Δ → SameOn ρ₁ ρ₂ Δ := by + intro q₁ q₂ ρ₁ ρ₂ h₁ h₂ Δ hΔ hs hn₁ hn₂ + have hfin : (insert q₁ (insert q₂ A₀)).Finite := (hA.insert _).insert _ + have hP₁ : IsPartialOrientation {Δ | Δ ⊆ (insert q₁ (insert q₂ A₀))ᶜ} ρ₁ + := h₁.isPartial.mono fun Δ hΔ ↦ + hΔ.trans (compl_subset_compl.2 (insert_subset_insert (subset_insert _ _))) + have hP₂ : IsPartialOrientation {Δ | Δ ⊆ (insert q₁ (insert q₂ A₀))ᶜ} ρ₂ + := h₂.isPartial.mono fun Δ hΔ ↦ + hΔ.trans (compl_subset_compl.2 (subset_insert _ _)) + obtain ⟨E, hE, hsE⟩ := exists_test_disc hT isOpen_univ univ_nonempty (B := insert p (insert q₁ + (insert q₂ A₀))) (hfin.insert _) + have hoff : ∀ {x}, x ∈ E → x ∉ insert p (insert q₁ (insert q₂ A₀)) := fun hx ↦ (hsE hx).2 + have hE₀ : E ⊆ (insert q₁ (insert q₂ A₀))ᶜ := fun x hx h ↦ hoff hx (Or.inr h) + have hE₁ : E ⊆ (insert p (insert q₁ A₀))ᶜ := fun x hx h ↦ hoff hx (by + rcases h with h | h | h + · exact Or.inl h + · exact Or.inr (Or.inl h) + · exact Or.inr (Or.inr (Or.inr h))) + have hE₂ : E ⊆ (insert p (insert q₂ A₀))ᶜ := fun x hx h ↦ hoff hx (by + rcases h with h | h | h + · exact Or.inl h + · exact Or.inr (Or.inr (Or.inl h)) + · exact Or.inr (Or.inr (Or.inr h))) + have hsΔ : Δ ⊆ (insert q₁ (insert q₂ A₀))ᶜ := by + rintro x hx (h | h | h) + · exact hn₁ (h ▸ hx) + · exact hn₂ (h ▸ hx) + · exact hs hx h + exact (sameOn_const hman (isOpen_compl_finite _ hfin) (isPreconnected_compl_finite hT hfin) + (fun x _ ↦ hT.2.2 x) hP₁ hP₂ hE hΔ hE₀ hsΔ).1 + ((h₁.same E hE hE₁).trans (h₂.same E hE hE₂).symm) + have hex : ∀ {Δ}, IsClosedDisc Δ → Δ ⊆ A₀ᶜ → ∃ q ρ, q ∉ Δ ∧ IsPunctureShift A₀ p q pos ρ := by + intro Δ hΔ hs + obtain ⟨E, hE, hsE⟩ := exists_test_disc hT hΔ.isClosed.isOpen_compl + (nonempty_compl_disc hT hΔ) hA + obtain ⟨q, hq⟩ := hE.nonempty_discInt + have hqE := hsE (discInt_subset E hq) + obtain ⟨ρ, hρ⟩ := hall hqE.2 + exact ⟨q, ρ, hqE.1, hρ⟩ + let pos' : Set T → T → T → T → Prop := fun Δ a b c ↦ ∃ q ρ, q ∉ Δ ∧ IsPunctureShift A₀ p q pos ρ + ∧ ρ Δ a b c + have hval : ∀ {q ρ Δ}, IsClosedDisc Δ → Δ ⊆ A₀ᶜ → q ∉ Δ → IsPunctureShift A₀ p q pos ρ + → SameOn pos' ρ Δ := by + intro q ρ Δ hΔ hs hq hρ a b c ha hb hc hab hbc hac + constructor + · rintro ⟨q', ρ', hq', hρ', h⟩ + exact (huniq hρ' hρ hΔ hs hq' hq a b c ha hb hc hab hbc hac).1 h + · exact fun h ↦ ⟨q, ρ, hq, hρ, h⟩ + have hsubq : ∀ {q Δ}, Δ ⊆ A₀ᶜ → q ∉ Δ → Δ ∈ {Δ | Δ ⊆ (insert q A₀)ᶜ} := fun hs hq x hx h ↦ + h.elim (fun he ↦ hq (he ▸ hx)) (hs hx) + refine ⟨pos', ⟨fun Δ hs hΔ ↦ ?_, fun Δ₁ h₁ Δ₂ h₂ hd₁ hd₂ hsub a b c ha hb hc hab hbc hac ↦ ?_⟩, + fun D hD hs ↦ ?_⟩ + · obtain ⟨q, ρ, hq, hρ⟩ := hex hΔ hs + exact (hρ.isPartial.dir Δ (hsubq hs hq) hΔ).congr (fun a b c ha hb hc hab hbc hac ↦ + (hval hΔ hs hq hρ a b c ha hb hc hab hbc hac).symm) + · obtain ⟨q, ρ, hq, hρ⟩ := hex hd₂ h₂ + have hq₁ : q ∉ Δ₁ := fun h ↦ hq (hsub h) + rw [hval hd₁ h₁ hq₁ hρ a b c ha.1 hb.1 hc.1 hab hbc hac, hval hd₂ h₂ hq hρ a b c ha.2 hb.2 hc.2 + hab hbc hac] + exact hρ.isPartial.agree _ (hsubq h₁ hq₁) _ (hsubq h₂ hq) hd₁ hd₂ hsub a b c ha hb hc hab hbc + hac + · have hsV : D ⊆ A₀ᶜ := hs.trans (compl_subset_compl.2 (subset_insert _ _)) + have hpD : p ∉ D := fun h ↦ hs h (Or.inl rfl) + exact hval hD hsV hpD hstart + +/-- **An orientation off a finite set extends to the closed surface.** -/ +theorem extend_orientation (hT : IsClosedSurface T) {A : Set T} (hA : A.Finite) {pos : Set T → T + → T → T → Prop} + (hpos : IsPartialOrientation {Δ | Δ ⊆ Aᶜ} pos) : + ∃ ω : SurfaceOrientation T, ∀ D, IsClosedDisc D → D ⊆ Aᶜ → SameOn ω.pos pos D := by + have key : ∀ {A : Set T}, A.Finite → ∀ {pos : Set T → T → T → T → Prop}, IsPartialOrientation {Δ + | Δ ⊆ Aᶜ} pos → + ∃ pos', IsPartialOrientation {Δ | Δ ⊆ (∅ : Set T)ᶜ} pos' ∧ ∀ D, IsClosedDisc D → D ⊆ Aᶜ + → SameOn pos' pos D := by + intro A hA + induction A, hA using Set.Finite.induction_on with + | empty => exact fun {pos} h ↦ ⟨pos, h, fun _ _ _ _ _ _ _ _ _ _ _ _ ↦ Iff.rfl⟩ + | @insert p A₀ hp hA₀ ih => + intro pos h + obtain ⟨pos₁, h₁, hs₁⟩ := extend_over_point hT hA₀ hp h + obtain ⟨pos₂, h₂, hs₂⟩ := ih h₁ + exact ⟨pos₂, h₂, fun D hD hs ↦ (hs₂ D hD (hs.trans (compl_subset_compl.2 + (subset_insert _ _)))).trans (hs₁ D hD hs)⟩ + obtain ⟨pos', h', hs⟩ := key hA hpos + have hall : ∀ Δ : Set T, Δ ∈ {Δ | Δ ⊆ (∅ : Set T)ᶜ} := fun Δ x _ h ↦ h + exact ⟨⟨pos', fun Δ hΔ ↦ h'.dir Δ (hall Δ) hΔ, fun Δ₁ Δ₂ h₁ h₂ ↦ h'.agree Δ₁ (hall _) Δ₂ + (hall _) h₁ h₂⟩, hs⟩ + +end Extend + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FragmentForm.lean b/LeanPool/GraphMinor/GM19/FragmentForm.lean new file mode 100644 index 0000000000..56bf9462bc --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FragmentForm.lean @@ -0,0 +1,441 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FragmentSides +public import LeanPool.GraphMinor.GM19.Conditional2 + +/-! +# A line of a cuff and the disc it closes + +Let `F` be the boundary of a closed disc `Δ` of `Σ̂`, made of a line `K` of `Σ` with both ends on a +cuff `Θ` and of a line `β` in the +disc pasted onto `Θ`. Then `β` cuts the pasted disc `E` in two. One half lies in `Δ` and the other +half outside (`exists_split`). +Taking the first half out of `Δ`, or adding the second, gives closed discs with the same part of +`Σ`, and with boundaries in `Σ` +(`exists_form_discs`). So the case of a line reduces to the case of a disc with boundary in `Σ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric Filter GraphMinor.Surface + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +omit [T2Space T] in +private theorem component_pair_covers (A A' U : Set T) + (hcomp : componentsIn U = {A, A'}) : U ⊆ A ∪ A' := by + intro x hx + have : connectedComponentIn (U) x ∈ componentsIn (U) + := mem_image_of_mem _ hx + rw [hcomp] at this + have hm := mem_connectedComponentIn hx + rcases this with h | h + · exact Or.inl (h ▸ hm) + · exact Or.inr ((mem_singleton_iff.1 h) ▸ hm) + +/-- A line `β` of the boundary of `Δ` crosses a closed disc `E` that meets the boundary of `Δ` only +in `β`. Taking out of `Δ` the half +of `E` in `Δ`, or adding the other half, gives closed discs `Δ₁` and `Δ₂`. -/ +theorem exists_split (hT : IsClosedSurface T) {Δ E β : Set T} (hΔ : IsClosedDisc Δ) + (hE : IsClosedDisc E) {s t : T} + (hst : s ≠ t) (hl : IsLineWithEnds β s t) (hβΔ : β ⊆ discBd Δ) (hβE : β ⊆ E) + (hmeet : β ∩ discBd E = {s, t}) + (hEΔ : E ∩ discBd Δ ⊆ β) : + ∃ (Δ₁ Δ₂ A₁ A₂ : Set T), IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ A₁ ⊆ discBd E ∧ A₂ ⊆ discBd E ∧ + discBd Δ₁ = (discBd Δ \ (β \ {s, t})) ∪ A₁ ∧ discBd Δ₂ = (discBd Δ \ (β \ {s, t})) ∪ A₂ ∧ + A₂.Nonempty ∧ Disjoint A₂ Δ₁ ∧ E ⊆ Δ₂ ∧ Δ ⊆ Δ₂ ∧ Δ₁ ⊆ Δ ∧ Δ \ Δ₁ ⊆ E ∧ Δ ∩ discBd E ⊆ Δ₁ ∧ + (∀ x ∉ discInt E, x ∈ discInt Δ₂ ↔ x ∈ discInt Δ) := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have hsβ : s ∈ β := by + have : s ∈ β ∩ discBd E := by rw [hmeet]; exact mem_insert _ _ + exact this.1 + have htβ : t ∈ β := by + have : t ∈ β ∩ discBd E := by rw [hmeet]; exact mem_insert_of_mem _ rfl + exact this.1 + obtain ⟨A, A', D, D', hAne, hcomp, hD, hD', hun, hint, hbd, hbd', hcomp'⟩ + := disc_iArc E β s t hE hβE hst hl hmeet + have hmemc : ∀ {B}, B ∈ componentsIn (discBd E \ {s, t}) → B ⊆ discBd E \ {s, t} := by + rintro _ ⟨x, -, rfl⟩ + exact connectedComponentIn_subset _ _ + have hAs : A ⊆ discBd E \ {s, t} := hmemc (by rw [hcomp]; exact mem_insert _ _) + have hAs' : A' ⊆ discBd E \ {s, t} := hmemc (by rw [hcomp]; exact mem_insert_of_mem _ rfl) + have hcov := component_pair_covers A A' (discBd E \ {s, t}) hcomp + have hA'ne : A'.Nonempty := by + have : A' ∈ componentsIn (discBd E \ {s, t}) := by rw [hcomp]; exact mem_insert_of_mem _ rfl + obtain ⟨x, hx, rfl⟩ := this + exact ⟨x, mem_connectedComponentIn hx⟩ + have hAne' : A.Nonempty := by + have : A ∈ componentsIn (discBd E \ {s, t}) := by rw [hcomp]; exact mem_insert _ _ + obtain ⟨x, hx, rfl⟩ := this + exact ⟨x, mem_connectedComponentIn hx⟩ + have hoffβ : ∀ {x}, x ∈ discBd E \ {s, t} → x ∉ β := fun {x} hx hxβ ↦ hx.2 (hmeet ▸ ⟨hxβ, hx.1⟩) + have core : ∀ {D D' A A' : Set T}, IsClosedDisc D → IsClosedDisc D' → D ∪ D' = E → D ∩ D' = β + → discBd D = A ∪ β → + discBd D' = A' ∪ β → A ⊆ discBd E \ {s, t} → A' ⊆ discBd E \ {s, t} + → discBd E \ {s, t} ⊆ A ∪ A' → A'.Nonempty → + D \ β ⊆ discInt Δ → Disjoint (D' \ β) Δ → + ∃ (Δ₁ Δ₂ A₁ A₂ : Set T), IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ A₁ ⊆ discBd E ∧ A₂ ⊆ discBd E ∧ + discBd Δ₁ = (discBd Δ \ (β \ {s, t})) ∪ A₁ ∧ discBd Δ₂ = (discBd Δ \ (β \ {s, t})) ∪ A₂ ∧ + A₂.Nonempty ∧ Disjoint A₂ Δ₁ ∧ E ⊆ Δ₂ ∧ Δ ⊆ Δ₂ ∧ Δ₁ ⊆ Δ ∧ Δ \ Δ₁ ⊆ E ∧ Δ ∩ discBd E ⊆ Δ₁ ∧ + (∀ x ∉ discInt E, x ∈ discInt Δ₂ ↔ x ∈ discInt Δ) := by + intro D D' A A' hD hD' hun hint hbd hbd' hAs hAs' hcov hA'ne hin hout + have hsubb : ∀ {x}, x ∈ β → x ∈ Δ := fun hx ↦ Surface.discBd_subset _ (hβΔ hx) + have hβD : β ⊆ discBd D := fun x hx ↦ hbd ▸ Or.inr hx + have hβD' : β ⊆ discBd D' := fun x hx ↦ hbd' ▸ Or.inr hx + have hDΔ : D ⊆ Δ := fun x hx ↦ by + by_cases h : x ∈ β + · exact hsubb h + · exact discInt_subset Δ (hin ⟨hx, h⟩) + have hsE : ∀ {B}, B ⊆ discBd E \ {s, t} → B ⊆ E := fun hB x hx ↦ Surface.discBd_subset _ + (hB hx).1 + have hmd : discBd D ∩ discBd Δ = β := by + apply Subset.antisymm + · rintro x ⟨hx, hxb⟩ + rw [hbd] at hx + rcases hx with h | h + · exact hEΔ ⟨hsE hAs h, hxb⟩ + · exact h + · exact fun x hx ↦ ⟨hβD hx, hβΔ hx⟩ + obtain ⟨hc, hb, hi⟩ := disc_difference D Δ β s t hD hΔ hDΔ hl hmd + have hmd2 : Δ ∩ D' = β := by + apply Subset.antisymm + · rintro x ⟨hx, hx'⟩ + by_contra hn + exact disjoint_left.1 hout ⟨hx', hn⟩ hx + · exact fun x hx ↦ ⟨hsubb hx, Surface.discBd_subset _ (hβD' hx)⟩ + obtain ⟨hu, hub⟩ := disc_union Δ D' β s t hΔ hD' hl hmd2 hβΔ hβD' + have hoffA : ∀ {B}, B ⊆ discBd E \ {s, t} → ∀ {x}, x ∈ B → x ∉ β := fun hB _ hx ↦ hoffβ (hB hx) + have hsub1 : closure (Δ \ D) ⊆ Δ := closure_minimal sdiff_subset hΔ.isClosed + have hA'D' : A' ⊆ D' := fun x hx ↦ Surface.discBd_subset _ (hbd' ▸ Or.inl hx) + have hAD : A ⊆ D := fun x hx ↦ Surface.discBd_subset _ (hbd ▸ Or.inl hx) + have hA₂out : Disjoint A' Δ := disjoint_left.2 fun x hx hxΔ ↦ disjoint_left.1 hout ⟨hA'D' hx, + hoffA hAs' hx⟩ hxΔ + have hbd₁ : discBd (closure (Δ \ D)) = (discBd Δ \ (β \ {s, t})) ∪ A := by + rw [hb] + ext x + constructor + · rintro ⟨hx | hx, hn⟩ + · rw [hbd] at hx + rcases hx with h | h + · exact Or.inr h + · exact Or.inl ⟨hβΔ h, hn⟩ + · exact Or.inl ⟨hx, hn⟩ + · rintro (⟨hx, hn⟩ | hx) + · exact ⟨Or.inr hx, hn⟩ + · exact ⟨Or.inl (hbd ▸ Or.inl hx), fun h ↦ hoffA hAs hx h.1⟩ + have hbd₂ : discBd (Δ ∪ D') = (discBd Δ \ (β \ {s, t})) ∪ A' := by + rw [hub] + ext x + constructor + · rintro ⟨hx | hx, hn⟩ + · exact Or.inl ⟨hx, hn⟩ + · rw [hbd'] at hx + rcases hx with h | h + · exact Or.inr h + · exact Or.inl ⟨hβΔ h, hn⟩ + · rintro (⟨hx, hn⟩ | hx) + · exact ⟨Or.inl hx, hn⟩ + · exact ⟨Or.inr (hbd' ▸ Or.inl hx), fun h ↦ hoffA hAs' hx h.1⟩ + have hEsub : E ⊆ Δ ∪ D' := by + rw [← hun] + rintro x (h | h) + · exact Or.inl (hDΔ h) + · exact Or.inr h + refine ⟨closure (Δ \ D), Δ ∪ D', A, A', hc, hu, fun x hx ↦ (hAs hx).1, + fun x hx ↦ (hAs' hx).1, hbd₁, hbd₂, hA'ne, + hA₂out.mono_right hsub1, hEsub, subset_union_left, hsub1, ?_, ?_, ?_⟩ + · rintro x ⟨hx, hn⟩ + by_contra hxE + exact hn (subset_closure ⟨hx, fun h ↦ hxE (hun ▸ Or.inl h)⟩) + · rintro x ⟨hxΔ, hxb⟩ + have hinD : x ∈ D → x ∉ β \ {s, t} → x ∈ discBd D → x ∈ closure (Δ \ D) := fun _ hn hb' ↦ by + have : x ∈ closure (Δ \ D) ∩ D := hi ▸ ⟨hb', hn⟩ + exact this.1 + by_cases hxβ : x ∈ β + · have hxe : x ∈ ({s, t} : Set T) := hmeet ▸ ⟨hxβ, hxb⟩ + exact hinD (Surface.discBd_subset _ (hβD hxβ)) (fun h ↦ h.2 hxe) (hβD hxβ) + · have hxn : x ∈ discBd E \ {s, t} := ⟨hxb, fun h ↦ hxβ (by + rcases h with h | h + · exact h ▸ hsβ + · exact (mem_singleton_iff.1 h) ▸ htβ)⟩ + rcases hcov hxn with h | h + · exact hinD (hAD h) (fun h' ↦ hxβ h'.1) (hbd ▸ Or.inl h) + · exact absurd hxΔ (disjoint_left.1 hA₂out h) + · intro x hx + constructor + · rintro ⟨hxu, hn⟩ + have hxΔ : x ∈ Δ := by + rcases hxu with h | h + · exact h + · by_contra hxΔ + have hxb : x ∈ discBd E := by + by_contra hb' + exact hx ⟨hun ▸ Or.inr h, hb'⟩ + by_cases hxe : x ∈ ({s, t} : Set T) + · rcases hxe with h' | h' + · exact hxΔ (h' ▸ hsubb hsβ) + · exact hxΔ ((mem_singleton_iff.1 h') ▸ hsubb htβ) + · rcases hcov ⟨hxb, hxe⟩ with h' | h' + · exact hxΔ (hDΔ (hAD h')) + · exact hn (hbd₂ ▸ Or.inr h') + refine ⟨hxΔ, fun hb' ↦ hn ?_⟩ + rw [hbd₂] + refine Or.inl ⟨hb', fun h ↦ hx ⟨hβE h.1, fun hE' ↦ h.2 (hmeet ▸ ⟨h.1, hE'⟩)⟩⟩ + · rintro ⟨hxΔ, hn⟩ + refine ⟨Or.inl hxΔ, fun hb' ↦ ?_⟩ + rw [hbd₂] at hb' + rcases hb' with h | h + · exact hn h.1 + · exact disjoint_left.1 hA₂out h hxΔ + have hEun : E = D ∪ D' := hun.symm + have hpre : ∀ {B}, B ∈ componentsIn (E \ β) → IsPreconnected B := by + rintro _ ⟨x, -, rfl⟩ + exact isPreconnected_connectedComponentIn + have hc₁ : IsPreconnected (D \ β) := hpre (by rw [hcomp']; exact mem_insert _ _) + have hc₂ : IsPreconnected (D' \ β) := hpre (by rw [hcomp']; exact mem_insert_of_mem _ rfl) + have hbdj : ∀ {D}, D ⊆ E → Disjoint (D \ β) (discBd Δ) := fun hD' ↦ + disjoint_left.2 fun x hx hb ↦ hx.2 (hEΔ ⟨hD' hx.1, hb⟩) + have hDE : D ⊆ E := by rw [hEun]; exact subset_union_left + have hDE' : D' ⊆ E := by rw [hEun]; exact subset_union_right + obtain ⟨f, hf0, hf1⟩ := hl + let b : T := (f (⟨1 / 2, by norm_num, by norm_num⟩ : unitInterval)).1 + have hbβ : b ∈ β := (f _).2 + have hb_ne : ∀ {r : unitInterval}, r ≠ ⟨1 / 2, by norm_num, by norm_num⟩ → (f r).1 ≠ b + := fun hr he ↦ hr (f.injective (Subtype.ext he)) + have hbs : b ≠ s := fun he ↦ + hb_ne (r := 0) (fun h ↦ by have := congrArg Subtype.val h; norm_num at this) (hf0.trans he.symm) + have hbt : b ≠ t := fun he ↦ + hb_ne (r := 1) (fun h ↦ by have := congrArg Subtype.val h; norm_num at this) (hf1.trans he.symm) + have hl' : IsLineWithEnds β s t := ⟨f, hf0, hf1⟩ + have hbE : b ∈ discInt E := ⟨hβE hbβ, fun hb' ↦ by + have : b ∈ ({s, t} : Set T) := hmeet ▸ ⟨hbβ, hb'⟩ + rcases this with h | h + · exact hbs h + · exact hbt h⟩ + have hEopen : IsOpen (discInt E) := hE.isOpen_discInt hman + rcases hΔ.side hman hc₁ (hbdj hDE) with h₁ | h₁ <;> rcases hΔ.side hman hc₂ + (hbdj hDE') with h₂ | h₂ + · exfalso + have hsub : E ⊆ Δ := by + rw [hEun] + rintro x hx + by_cases hxβ : x ∈ β + · exact Surface.discBd_subset _ (hβΔ hxβ) + · rcases hx with h | h + · exact discInt_subset Δ (h₁ ⟨h, hxβ⟩) + · exact discInt_subset Δ (h₂ ⟨h, hxβ⟩) + have := subset_discInt_of_isOpen (fun y _ ↦ hT.2.2 y) hEopen ((discInt_subset E).trans hsub) hbE + exact this.2 (hβΔ hbβ) + · exact core hD hD' hun hint hbd hbd' hAs hAs' hcov hA'ne h₁ h₂ + · refine core hD' hD (by rw [union_comm, hun]) (by rw [inter_comm, + hint]) hbd' hbd hAs' hAs ?_ hAne' h₂ h₁ + rw [union_comm] + exact hcov + · exfalso + have hbcl := hΔ.subset_closure_discInt (Surface.discBd_subset _ (hβΔ hbβ)) + obtain ⟨w, hw, hwi⟩ := _root_.mem_closure_iff.1 hbcl _ hEopen hbE + have hwE : w ∈ E := discInt_subset E hw + by_cases hwβ : w ∈ β + · exact hwi.2 (hβΔ hwβ) + · rw [hEun] at hwE + rcases hwE with h | h + · exact disjoint_left.1 h₁ ⟨h, hwβ⟩ (discInt_subset Δ hwi) + · exact disjoint_left.1 h₂ ⟨h, hwβ⟩ (discInt_subset Δ hwi) + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + +omit [T2Space S] in +/-- A form with a line of a cuff reduces to two closed discs with boundary in `S`, one with the same +part of `S` as `Δ` and one with +the same part of `S` in its inside. -/ +theorem exists_form_discs (cap : IsCappedSurface S Shat) {K : Drawing S} {Δ : + Set Shat} (hΔ : IsClosedDisc Δ) + {s t : S} {Θ : Set S} (hΘ : Θ ∈ cuffs S) (hst : s ≠ t) (hs : s ∈ Θ) (ht : t ∈ Θ) + (hKb : K.U ∩ bd S = {s, t}) + (hl : IsLineWithEnds K.U s t) (hsub : cap.emb '' K.U ⊆ discBd Δ) (hrest : discBd Δ \ cap.emb '' + K.U ⊆ cap.cuffDisc Θ) : + ∃ Δ₁ Δ₂ : Set Shat, IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ + cap.emb '' K.U ⊆ discBd Δ₁ ∧ cap.emb '' K.U ⊆ discBd Δ₂ ∧ + discBd Δ₁ ⊆ range cap.emb ∧ discBd Δ₂ ⊆ range cap.emb ∧ + discBd Δ₁ ⊆ cap.emb '' K.U ∪ cap.emb '' Θ ∧ discBd Δ₂ ⊆ cap.emb '' K.U ∪ cap.emb '' Θ ∧ + ¬ closure (cap.cuffDisc Θ) ⊆ Δ₁ ∧ closure (cap.cuffDisc Θ) ⊆ Δ₂ ∧ Δ ⊆ Δ₂ ∧ + cap.emb ⁻¹' Δ₁ = cap.emb ⁻¹' Δ ∧ cap.emb ⁻¹' discInt Δ₂ = cap.emb ⁻¹' discInt Δ := by + classical + have hT := cap.isClosedSurface + have hE := cap.cuffDisc_closedDisc Θ hΘ + set E := closure (cap.cuffDisc Θ) with hEdef + have hbE : discBd E = cap.emb '' Θ := cap.cuffDisc_bd Θ hΘ + have hcl : E = cap.cuffDisc Θ ∪ cap.emb '' Θ := cap.closure_cuffDisc hΘ + have hEr : ∀ {z}, cap.emb z ∈ E → z ∈ Θ := fun {z} hz ↦ by + rw [hcl] at hz + rcases hz with h | ⟨y, hy, he⟩ + · exact absurd (mem_range_self z) (cap.notMem_range hΘ h) + · exact cap.isEmbedding.injective he ▸ hy + have hline := hl.map_of_embedding cap.isEmbedding + obtain ⟨u, v, htw, hru, hu0, hu1, hun⟩ := exists_arcs_of_line hΔ.isOArc_discBd hline hsub + have hv0 : v 0 = cap.emb s := htw.zero.trans hu0 + have hv1 : v 1 = cap.emb t := htw.one.trans hu1 + set β := range v with hβ + have hβl : IsLineWithEnds β (cap.emb s) (cap.emb t) := by + have := htw.arc_right.isLineWithEnds + rwa [hv0, hv1] at this + have hne : cap.emb s ≠ cap.emb t := fun h ↦ hst (cap.isEmbedding.injective h) + have hβsub : β ⊆ discBd Δ := fun x hx ↦ hun ▸ Or.inr hx + have hsE : cap.emb s ∈ E := hbE ▸ mem_image_of_mem _ hs |> Surface.discBd_subset _ + have htE : cap.emb t ∈ E := hbE ▸ mem_image_of_mem _ ht |> Surface.discBd_subset _ + have hsβ : cap.emb s ∈ β := ⟨0, hv0⟩ + have htβ : cap.emb t ∈ β := ⟨1, hv1⟩ + have hβK : ∀ {x}, x ∈ β → x ∈ cap.emb '' K.U → x = cap.emb s ∨ x = cap.emb t := by + rintro _ ⟨r, rfl⟩ hx + rw [← hru] at hx + obtain ⟨a, ha⟩ := hx + rcases htw.meet a r ha with ⟨-, rfl⟩ | ⟨-, rfl⟩ + · exact Or.inl hv0 + · exact Or.inr hv1 + have hmem : ∀ {x}, x ∈ β → x ∈ cap.emb '' K.U ∨ x ∈ cap.cuffDisc Θ := fun {x} hx ↦ by + by_cases h : x ∈ cap.emb '' K.U + · exact Or.inl h + · exact Or.inr (hrest ⟨hβsub hx, h⟩) + have hβE : β ⊆ E := fun x hx ↦ by + rcases hmem hx with h | h + · rcases hβK hx h with rfl | rfl + · exact hsE + · exact htE + · exact subset_closure h + have hmeet : β ∩ discBd E = {cap.emb s, cap.emb t} := by + apply Subset.antisymm + · rintro x ⟨hx, hxb⟩ + rw [hbE] at hxb + obtain ⟨z, -, rfl⟩ := hxb + rcases hmem hx with h | h + · rcases hβK hx h with h' | h' + · exact Or.inl h' + · exact Or.inr h' + · exact absurd (mem_range_self z) (cap.notMem_range hΘ h) + · rintro x (rfl | rfl) + · exact ⟨hsβ, hbE ▸ mem_image_of_mem _ hs⟩ + · exact ⟨htβ, hbE ▸ mem_image_of_mem _ ht⟩ + have hEΔ : E ∩ discBd Δ ⊆ β := by + rintro x ⟨hxE, hxb⟩ + rw [← hun] at hxb + rcases hxb with h | h + · rw [hru] at h + obtain ⟨z, hz, rfl⟩ := h + have hzb : z ∈ K.U ∩ bd S := ⟨hz, cuff_subset_bd ⟨Θ, hΘ⟩ (hEr hxE)⟩ + rw [hKb] at hzb + rcases hzb with rfl | h' + · exact hsβ + · rw [mem_singleton_iff.1 h'] + exact htβ + · exact h + obtain ⟨Δ₁, Δ₂, A₁, A₂, h₁, h₂, hA₁, hA₂, hb₁, hb₂, hne₂, hdj, hEΔ₂, hΔΔ₂, hΔ₁Δ, hdiff, hbdΔ₁, + hint⟩ := + exists_split hT hΔ hE hne hβl hβsub hβE hmeet hEΔ + have hoff : discBd Δ \ (β \ {cap.emb s, cap.emb t}) ⊆ cap.emb '' K.U := by + rintro x ⟨hxb, hn⟩ + rw [← hun] at hxb + rcases hxb with h | h + · exact hru ▸ h + · have hxe : x ∈ ({cap.emb s, cap.emb t} : Set Shat) := by + by_contra hne' + exact hn ⟨h, hne'⟩ + rw [← hru] + rcases hxe with rfl | h' + · exact ⟨0, hu0⟩ + · exact ⟨1, hu1.trans (mem_singleton_iff.1 h').symm⟩ + have hKin : cap.emb '' K.U ⊆ discBd Δ \ (β \ {cap.emb s, cap.emb t}) := fun x hx ↦ + ⟨hsub hx, fun h ↦ h.2 (by rcases hβK h.1 hx with h' | h'; exacts [Or.inl h', Or.inr h'])⟩ + have hbdsub : ∀ {B D}, B ⊆ discBd E → discBd D = (discBd Δ \ (β \ {cap.emb s, cap.emb t})) ∪ B → + discBd D ⊆ cap.emb '' K.U ∪ cap.emb '' Θ := fun hB hD x hx ↦ by + rw [hD] at hx + rcases hx with h | h + · exact Or.inl (hoff h) + · exact Or.inr (hbE ▸ hB h) + have hr : ∀ {D}, discBd D ⊆ cap.emb '' K.U ∪ cap.emb '' Θ → discBd D ⊆ range cap.emb + := fun hD x hx ↦ by + rcases hD hx with ⟨z, -, rfl⟩ | ⟨z, -, rfl⟩ <;> exact mem_range_self z + have hs₁ := hbdsub hA₁ hb₁ + have hs₂ := hbdsub hA₂ hb₂ + refine ⟨Δ₁, Δ₂, h₁, h₂, fun x hx ↦ hb₁ ▸ Or.inl (hKin hx), fun x hx ↦ hb₂ ▸ Or.inl (hKin hx), + hr hs₁, hr hs₂, hs₁, hs₂, ?_, hEΔ₂, + hΔΔ₂, ?_, ?_⟩ + · intro hn + obtain ⟨x, hx⟩ := hne₂ + exact disjoint_left.1 hdj hx (hn (Surface.discBd_subset _ (hA₂ hx))) + · ext z + constructor + · exact fun h ↦ hΔ₁Δ h + · intro hz + by_contra hn + have hzE : cap.emb z ∈ E := hdiff ⟨hz, hn⟩ + exact hn (hbdΔ₁ ⟨hz, hbE ▸ mem_image_of_mem _ (hEr hzE)⟩) + · ext z + refine hint (cap.emb z) fun h ↦ h.2 ?_ + exact hbE ▸ mem_image_of_mem _ (hEr h.1) + +omit [T2Space Shat] in +omit [T2Space S] in +theorem IsCappedSurface.mem_of_emb_mem (cap : IsCappedSurface S Shat) {Θ : Set + S} (hΘ : Θ ∈ cuffs S) {z : S} + (hz : cap.emb z ∈ closure (cap.cuffDisc Θ)) : z ∈ Θ := by + rw [cap.closure_cuffDisc hΘ] at hz + rcases hz with h | ⟨y, hy, he⟩ + · exact absurd (mem_range_self z) (cap.notMem_range hΘ h) + · exact cap.isEmbedding.injective he ▸ hy + +omit [T2Space S] in +theorem cuffs_eq_of_mem {Θ Θ' : Set S} (hΘ : Θ ∈ cuffs S) (hΘ' : Θ' ∈ cuffs S) {z : S} (h : z ∈ Θ) + (h' : z ∈ Θ') : Θ = Θ' := by + obtain ⟨a, -, rfl⟩ := hΘ + obtain ⟨b, -, rfl⟩ := hΘ' + exact (connectedComponentIn_eq h).trans (connectedComponentIn_eq h').symm + +/-- The step of the proof of (10.2), Graph Minors XIX, pages 354-355. -/ +theorem discSide : DiscSideStatement := by + intro S Shat _ _ _ _ cap K F Δ hS hf hΔ hb Y _ _ ψ hY hψ + subst hb + rcases hf with ⟨hF, -, hsing⟩ | ⟨s, t, Θ, hΘ, hst, hs, ht, hKb, hl, hsub, hrest⟩ + · refine exists_inner_fragment hS cap hY hψ hΔ hF.ge (hF.le.trans subset_union_right) + (hF.le.trans (image_subset_range _ _)) ?_ + rintro x ⟨hx, hxb⟩ y ⟨hy, hyb⟩ + obtain ⟨Θ₁, h₁, hxΘ⟩ := mem_iUnion₂.1 hx + obtain ⟨Θ₂, h₂, hyΘ⟩ := mem_iUnion₂.1 hy + rw [hF] at hxb hyb + obtain ⟨a, ha, rfl⟩ := hxb + obtain ⟨b, hb, rfl⟩ := hyb + rw [hsing ⟨ha, cuff_subset_bd ⟨Θ₁, h₁.1⟩ (cap.mem_of_emb_mem h₁.1 hxΘ)⟩ + ⟨hb, cuff_subset_bd ⟨Θ₂, h₂.1⟩ (cap.mem_of_emb_mem h₂.1 hyΘ)⟩] + · obtain ⟨Δ₁, -, h₁, -, hK₁, -, hr₁, -, hs₁, -, hnE, -, -, hpre, -⟩ + := exists_form_discs cap hΔ hΘ hst hs ht hKb hl hsub hrest + rw [← hpre] + refine exists_inner_fragment hS cap hY hψ h₁ hK₁ (fun x hx ↦ ?_) hr₁ ?_ + · rcases hs₁ hx with h | h + · exact Or.inr h + · refine Or.inl (mem_biUnion hΘ ?_) + rw [cap.closure_cuffDisc hΘ] + exact Or.inr h + · rintro x ⟨hx, hxb⟩ + exfalso + obtain ⟨Θ₁, h, hxΘ⟩ := mem_iUnion₂.1 hx + have hne : Θ₁ ≠ Θ := fun he ↦ hnE (he ▸ h.2) + rcases hs₁ hxb with ⟨z, hz, rfl⟩ | ⟨z, hz, rfl⟩ + · have hzΘ := cap.mem_of_emb_mem h.1 hxΘ + have hzb : z ∈ K.U ∩ bd S := ⟨hz, cuff_subset_bd ⟨Θ₁, h.1⟩ hzΘ⟩ + rw [hKb] at hzb + rcases hzb with rfl | h' + · exact hne (cuffs_eq_of_mem h.1 hΘ hzΘ hs) + · exact hne (cuffs_eq_of_mem h.1 hΘ hzΘ (mem_singleton_iff.1 h' ▸ ht)) + · exact hne (cuffs_eq_of_mem h.1 hΘ (cap.mem_of_emb_mem h.1 hxΘ) hz) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FragmentOrient.lean b/LeanPool/GraphMinor/GM19/FragmentOrient.lean new file mode 100644 index 0000000000..314481501d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FragmentOrient.lean @@ -0,0 +1,128 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FragmentExtend +public import LeanPool.GraphMinor.GM19.CapModel + +/-! +# Orientations of fragments + +We prove the orientation steps of Graph Minors XIX. Let `W` be a connected surface whose inside is a +closed surface `T'` without a finite +set. An orientation of the inside of `W` gives one of `T'` (`extend_orientation`). If `T'` caps `W`, +this gives one of `W`. + +So a fragment of an oriented surface is orientable. By `sameOn_const` an orientation of the fragment +is equal on its inside to the +orientation read through `ψ`, or reverse to it, and we reverse it in the second case +(`fragmentOrientation`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric Filter GraphMinor.Surface + +variable {W T' : Type} [TopologicalSpace W] [T2Space W] [TopologicalSpace T'] [T2Space T'] + +/-- An orientation with all discs as domain is an orientation. -/ +def orientationOfPartial {X : Type} [TopologicalSpace X] {pos : Set X → X → X → X + → Prop} + (h : IsPartialOrientation univ pos) : SurfaceOrientation X := + ⟨pos, fun Δ hΔ ↦ h.dir Δ (mem_univ _) hΔ, fun Δ₁ Δ₂ h₁ h₂ ↦ h.agree Δ₁ (mem_univ _) Δ₂ + (mem_univ _) h₁ h₂⟩ + +theorem isOrientable_of_inside [ConnectedSpace T'] (hT : IsClosedSurface T') {P : Set T'} + (hP : P.Finite) (e : OpenPartialHomeomorph W T') + (hs : e.source = (bd W)ᶜ) (ht : e.target = Pᶜ) {pos : Set W → W → W → W → Prop} + (hpos : IsPartialOrientation {Δ | Δ ⊆ (bd W)ᶜ} pos) : + IsOrientableSurface T' := by + have hs' : ∀ Δ ∈ {Δ : Set T' | Δ ⊆ Pᶜ}, ContinuousOn e.symm Δ ∧ InjOn e.symm Δ + ∧ e.symm '' Δ ∈ {Δ | Δ ⊆ (bd W)ᶜ} := by + intro Δ hΔ + have hΔ' : Δ ⊆ e.target := ht ▸ hΔ + refine ⟨e.continuousOn_symm.mono hΔ', e.symm.injOn.mono hΔ', ?_⟩ + rintro _ ⟨x, hx, rfl⟩ + have := e.map_target (hΔ' hx) + rwa [hs] at this + obtain ⟨ω, -⟩ := extend_orientation hT hP (hpos.pull hs') + exact ⟨ω⟩ + +/-- A surface whose inside is oriented is orientable. -/ +theorem isOrientable_of_interior (hW : IsSurface W) [ConnectedSpace W] {pos : Set W → W → W → W + → Prop} + (hpos : IsPartialOrientation {Δ | Δ ⊆ (bd W)ᶜ} pos) : IsOrientableSurface W := by + obtain ⟨T, _, ⟨cap⟩⟩ := exists_cappedSurface _ W hW inferInstance rfl + have : T2Space T := cap.isSurface.2.1 + have : ConnectedSpace T := cap.connected + obtain ⟨x⟩ : Nonempty W := inferInstance + have : Nonempty W := ⟨x⟩ + obtain ⟨e, P, hP, hs, ht, -⟩ := exists_cap_chart hW cap + exact isOrientable_of_embedding cap.isEmbedding (isOrientable_of_inside cap.isClosedSurface hP e + hs ht hpos) + +/-- **The step of the proof of (5.4)**, Graph Minors XIX, page 338: a fragment takes its orientation +from the surface. -/ +theorem fragmentOrientation : FragmentOrientationStatement := by + intro S S₁ _ _ _ _ K ψ hS hc hf ω + have hS₁ := hf.isSurface + have := hf.connected + have hman : ∀ x : S₁, IsManifoldPoint x := hS₁.2.2 + have hψ := hf.continuous_ψ + let 𝓙 : Set (Set S₁) := {Δ | InjOn ψ Δ} + have hJ : IsPartialOrientation 𝓙 (pullPos ψ ω.pos) := + (ω.isPartial univ).pull fun Δ hΔ ↦ ⟨hψ.continuousOn, hΔ, mem_univ _⟩ + have hhered : ∀ Δ ∈ 𝓙, ∀ Δ' ⊆ Δ, Δ' ∈ 𝓙 := fun Δ hΔ Δ' hs ↦ InjOn.mono hs hΔ + have hIJ : {Δ | Δ ⊆ (bd S₁)ᶜ} ⊆ 𝓙 := fun Δ hΔ ↦ hf.injOn_interior.mono hΔ + have hIopen : IsOpen (bd S₁)ᶜ := (cuff_statement S₁ hS₁).1.isOpen_compl + have hIc := isConnected_interior hS₁ + have hIint : ∀ x ∈ (bd S₁)ᶜ, IsInteriorPoint x := fun x hx ↦ by + by_contra h + exact hx h + obtain ⟨ω₂⟩ := isOrientable_of_interior hS₁ (hJ.mono hIJ) + obtain ⟨x₀, hx₀⟩ := hIc.nonempty + obtain ⟨E, hE, -, hEs⟩ := exists_small_disc (hIint x₀ hx₀) hIopen hx₀ + have hdir₂ := (ω₂.isPartial 𝓙).dir E (hIJ hEs) hE + have hdirJ := hJ.dir E (hIJ hEs) hE + obtain ⟨pos₁, hpos₁, hE₁⟩ : ∃ pos₁, IsPartialOrientation univ pos₁ ∧ SameOn pos₁ + (pullPos ψ ω.pos) E := by + by_cases hs : SameOn ω₂.pos (pullPos ψ ω.pos) E + · exact ⟨ω₂.pos, ω₂.isPartial univ, hs⟩ + · exact ⟨revPos ω₂.pos, (ω₂.isPartial univ).rev, sameOn_rev_left (sameOn_of_notSame hdir₂ hdirJ + hs)⟩ + refine ⟨orientationOfPartial hpos₁, fun Δ hΔ hinj a b c ha hb hc hab hbc hac ↦ ?_⟩ + have hP : IsPartialOrientation 𝓙 pos₁ := hpos₁.mono (subset_univ _) + obtain ⟨y, hyI, hyΔ⟩ := (dense_interior' hS₁).inter_open_nonempty _ + (hΔ.isOpen_discInt hman) hΔ.nonempty_discInt + have hyI' : y ∈ (bd S₁)ᶜ := hyΔ + obtain ⟨D, hD, -, hDs⟩ := exists_small_disc (hIint y hyI') (hIopen.inter + (hΔ.isOpen_discInt hman)) ⟨hyI', hyI⟩ + have hDI : D ⊆ (bd S₁)ᶜ := hDs.trans inter_subset_left + have hDΔ : D ⊆ Δ := hDs.trans (inter_subset_right.trans (discInt_subset Δ)) + have hG : SameOn pos₁ (pullPos ψ ω.pos) D := + (sameOn_const hman hIopen hIc.isPreconnected hIint (hP.mono hIJ) (hJ.mono hIJ) hE hD hEs hDI).1 + hE₁ + exact (sameOn_of_subset hman hhered hP hJ hinj hD hΔ hDΔ).1 hG a b c ha hb hc hab hbc hac + +/-- **The steps of the proof of (10.4)**, Graph Minors XIX, page 357. -/ +theorem outerSide : OuterSideStatement := by + intro S Shat _ _ _ _ cap K 𝓓 hS hshape Y _ _ ψ hY hψ + obtain ⟨y, hy, hcap, hnum, T', _, e, P, hT', ⟨hom⟩, hP, hs, ht⟩ := outer_shape (ψ + := ψ) hS cap hY hψ hshape + refine ⟨y, hy, hcap, hnum, fun ⟨ω⟩ ↦ ?_⟩ + have : T2Space T' := hT'.2.1 + have : ConnectedSpace Shat := cap.connected + have : ConnectedSpace T' := hom.symm.surjective.connectedSpace hom.symm.continuous + have h₁ := isOrientable_of_inside hT' hP e hs ht (ω.isPartial _) + exact isOrientable_of_embedding cap.isEmbedding (isOrientable_of_embedding hom.symm.isEmbedding + h₁) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FragmentOuter.lean b/LeanPool/GraphMinor/GM19/FragmentOuter.lean new file mode 100644 index 0000000000..b3adfe49c1 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FragmentOuter.lean @@ -0,0 +1,491 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FragmentBridge + +/-! +# The fragment outside a cell + +Let `Z` be a closed set of `Σ̂` that holds `K` and collapses to a point (`IsCell`). Let `G` be an +open part of `Z` such that the rest of +`Z` lies in `K` and in the pasted discs. Then one fragment has image `Σ` without `G`, and it caps to +`Σ̂`. Each pasted disc outside `Z` +adds a cuff to the fragment, and the set `Z` adds one more. So if `Z` holds two pasted discs, the +fragment has fewer cuffs than `Σ` +(`exists_outer_fragment`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric Filter GraphMinor.Surface + +section Frontier + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +omit [T2Space T] in +/-- Each point of the boundary of a closed disc is a limit of points outside the disc. -/ +theorem discBd_subset_closure_compl (hT : IsClosedSurface T) {D : Set T} + (_hD : IsClosedDisc D) : discBd D ⊆ closure Dᶜ := by + intro p hp + rw [closure_compl] + intro hi + have := subset_discInt_of_isOpen (fun y _ ↦ hT.2.2 y) isOpen_interior interior_subset hi + exact this.2 hp + +/-- A line of a closed surface holds no open set, so each of its points is a limit of points off the +line. -/ +theorem line_subset_closure_compl (hT : IsClosedSurface T) {L : Set T} {a b : T} + (hl : IsLineWithEnds L a b) : L ⊆ closure Lᶜ := by + intro p hp + rw [closure_compl] + intro hi + have hO : IsOpen (interior L) := isOpen_interior + have : LocallyConnectedSpace T := IsSurface.locallyConnected hT.isSurface + set G := connectedComponentIn (interior L) p with hG + have hGo : IsOpen G := hO.connectedComponentIn + have hGc : IsPreconnected G := isPreconnected_connectedComponentIn + have hGL : G ⊆ L := (connectedComponentIn_subset _ _).trans interior_subset + have hpG : p ∈ G := mem_connectedComponentIn hi + obtain ⟨f, -, -⟩ := hl + let g : unitInterval → T := fun t ↦ (f t).1 + have hgi : IsEmbedding g := IsEmbedding.subtypeVal.comp f.isEmbedding + have hrg : ∀ x ∈ L, ∃ t, g t = x := fun x hx ↦ ⟨f.symm ⟨x, hx⟩, by simp [g]⟩ + have hdn := dense_compl_finite hT.2.2 (finite_singleton p) + obtain ⟨q, hqG, hqp⟩ := hdn.inter_open_nonempty G hGo ⟨p, hpG⟩ + obtain ⟨s, rfl⟩ := hrg p hp + obtain ⟨t, rfl⟩ := hrg q (hGL hqG) + have hst : s ≠ t := fun h ↦ hqp (by rw [h]; rfl) + have key : ∀ {s t : unitInterval}, s < t → g s ∈ G → g t ∈ G → False := by + intro s t hlt hs ht + obtain ⟨m, hsm, hmt⟩ := exists_between hlt + have him : ∀ {W : Set T}, W ⊆ range g → g '' (g ⁻¹' W) = W := fun h ↦ + image_preimage_eq_of_subset h + have hGr : G ⊆ range g := fun x hx ↦ hrg x (hGL hx) + have hJ : IsPreconnected (g ⁻¹' G) := by + rw [← hgi.isInducing.isPreconnected_image, him hGr] + exact hGc + have hmG : g m ∈ G := hJ.ordConnected.out hs ht ⟨hsm.le, hmt.le⟩ + have hJ' : IsPreconnected (g ⁻¹' (G \ {g m})) := by + rw [← hgi.isInducing.isPreconnected_image, him (sdiff_subset.trans hGr)] + exact isPreconnected_sdiff_point hT hGo hGc _ + have hmem := hJ'.ordConnected.out (x := s) (y := t) + ⟨hs, fun h ↦ hsm.ne (hgi.injective h)⟩ ⟨ht, fun h ↦ hmt.ne' (hgi.injective h)⟩ ⟨hsm.le, + hmt.le⟩ + exact hmem.2 rfl + rcases lt_or_gt_of_ne hst with h | h + · exact key h hpG hqG + · exact key h hqG hpG + +omit [T2Space T] in +/-- If `Z = Z₁ ∪ Z₂`, a point of `Z₁` off `Z₂` that is a limit of points off `Z₁` is a limit of +points off `Z`. -/ +theorem mem_closure_compl_union {Z₁ Z₂ : Set T} (h₂ : IsClosed Z₂) {p : T} (hp : p ∈ closure Z₁ᶜ) + (hn : p ∉ Z₂) : + p ∈ closure (Z₁ ∪ Z₂)ᶜ := by + rw [_root_.mem_closure_iff] at hp ⊢ + intro O hO hpO + obtain ⟨w, hw, hwn⟩ := hp (O ∩ Z₂ᶜ) (hO.inter h₂.isOpen_compl) ⟨hpO, hn⟩ + exact ⟨w, hw.1, fun h ↦ h.elim hwn hw.2⟩ + +omit [T2Space T] in +/-- The closure of the complement of a closed disc is the complement of the inside of the disc. -/ +theorem closure_compl_disc (hT : IsClosedSurface T) {D : Set T} (hD : IsClosedDisc D) : closure Dᶜ + = (discInt D)ᶜ := by + have hman : ∀ x : T, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + apply Subset.antisymm + · refine closure_minimal ?_ (hD.isOpen_discInt hman).isClosed_compl + exact fun x hx hi ↦ hx (discInt_subset D hi) + · intro x hx + by_cases hxD : x ∈ D + · exact discBd_subset_closure_compl hT hD (by + by_contra hn + exact hx ⟨hxD, hn⟩) + · exact subset_closure hxD + +/-- A connected set that meets the closed disc `D` only in `b` and is not inside `D` meets it in a +boundary point. -/ +theorem mem_discBd_of_cross (hT : IsClosedSurface T) {D L : Set T} (hD : IsClosedDisc D) + (hc : IsPreconnected L) {a b : T} (ha : a ∈ L) + (haD : a ∉ D) (hb : b ∈ L) (hL : L ∩ D = {b}) : b ∈ discBd D := by + have hman : ∀ x : T, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + by_contra hn + have hbD : b ∈ D := by + have : b ∈ L ∩ D := by rw [hL]; rfl + exact this.2 + have hsub : L ⊆ discInt D ∪ Dᶜ := by + intro x hx + by_cases hxD : x ∈ D + · have : x ∈ L ∩ D := ⟨hx, hxD⟩ + rw [hL] at this + exact Or.inl (by rw [mem_singleton_iff.1 this]; exact ⟨hbD, hn⟩) + · exact Or.inr hxD + have hdj : Disjoint (discInt D) Dᶜ := disjoint_left.2 fun x hx hc ↦ hc (discInt_subset D hx) + have := hc.subset_left_of_subset_union (hD.isOpen_discInt hman) hD.isClosed.isOpen_compl hdj hsub + ⟨b, hb, hbD, hn⟩ + exact haD (discInt_subset D (this ha)) + +omit [T2Space T] in +/-- A point on the boundary of a closed disc, off a closed set `W`, is a limit of points off both. +-/ +theorem discBd_closure_compl_union (hT : IsClosedSurface T) {D W : Set T} (hD : IsClosedDisc D) + (hW : IsClosed W) {p : T} + (hp : p ∈ discBd D) (hn : p ∉ W) : p ∈ closure (D ∪ W)ᶜ := + mem_closure_compl_union hW (discBd_subset_closure_compl hT hD hp) hn + +theorem frontier_touch (hT : IsClosedSurface T) {D₁ D₂ : Set T} (h₁ : IsClosedDisc D₁) + (h₂ : IsClosedDisc D₂) {a : T} + (ha : D₁ ∩ D₂ = {a}) : (D₁ ∪ D₂) \ (discInt D₁ ∪ discInt D₂) ⊆ closure (D₁ ∪ D₂)ᶜ := by + have hA : ∀ {x}, x ∈ D₁ → x ∈ D₂ → x = a := fun hx hy ↦ by + have : _ ∈ D₁ ∩ D₂ := ⟨hx, hy⟩ + rwa [ha] at this + have k₁ : ∀ {q}, q ∈ discBd D₁ → q ≠ a → q ∈ closure (D₁ ∪ D₂)ᶜ := fun hq hne ↦ + discBd_closure_compl_union hT h₁ h₂.isClosed hq fun h ↦ hne (hA (Surface.discBd_subset _ hq) h) + have k₂ : ∀ {q}, q ∈ discBd D₂ → q ≠ a → q ∈ closure (D₁ ∪ D₂)ᶜ := fun hq hne ↦ by + rw [union_comm] + exact discBd_closure_compl_union hT h₂ h₁.isClosed hq fun h ↦ hne (hA h + (Surface.discBd_subset _ hq)) + rintro p ⟨hp, hn⟩ + have hb : p ∈ discBd D₁ ∨ p ∈ discBd D₂ := by + rcases hp with h | h + · refine Or.inl ?_ + by_contra hb + exact hn (Or.inl ⟨h, hb⟩) + · refine Or.inr ?_ + by_contra hb + exact hn (Or.inr ⟨h, hb⟩) + rcases hb with h | h + · by_cases hpa : p = a + · refine closure_minimal ?_ isClosed_closure (mem_closure_oArc_sdiff h₁.isOArc_discBd h) + rintro q ⟨hq, hqn⟩ + exact k₁ hq (fun he ↦ hqn (he.trans hpa.symm)) + · exact k₁ h hpa + · by_cases hpa : p = a + · refine closure_minimal ?_ isClosed_closure (mem_closure_oArc_sdiff h₂.isOArc_discBd h) + rintro q ⟨hq, hqn⟩ + exact k₂ hq (fun he ↦ hqn (he.trans hpa.symm)) + · exact k₂ h hpa + +theorem frontier_bridge (hT : IsClosedSurface T) {D₁ D₂ L : Set T} + (h₁ : IsClosedDisc D₁) (h₂ : IsClosedDisc D₂) + (hd : Disjoint D₁ D₂) {a b : T} (ha : a ∈ discBd D₁) (hb : b ∈ discBd D₂) + (hl : IsLineWithEnds L a b) (hL₁ : L ∩ D₁ = {a}) + (hL₂ : L ∩ D₂ = {b}) : (D₁ ∪ L ∪ D₂) \ (discInt D₁ ∪ discInt D₂) ⊆ closure (D₁ ∪ L ∪ D₂)ᶜ := by + have hLc : IsClosed L := by + obtain ⟨f, -, -⟩ := hl + have : L = range fun t ↦ (f t).1 := by + ext x + constructor + · intro hx + exact ⟨f.symm ⟨x, hx⟩, by simp⟩ + · rintro ⟨t, rfl⟩ + exact (f t).2 + rw [this] + exact (isCompact_range (continuous_subtype_val.comp f.continuous)).isClosed + have hmem₁ : ∀ {x}, x ∈ L → x ∈ D₁ → x = a := fun hx hy ↦ by + have : _ ∈ L ∩ D₁ := ⟨hx, hy⟩ + rwa [hL₁] at this + have hmem₂ : ∀ {x}, x ∈ L → x ∈ D₂ → x = b := fun hx hy ↦ by + have : _ ∈ L ∩ D₂ := ⟨hx, hy⟩ + rwa [hL₂] at this + have k₁ : ∀ {q}, q ∈ discBd D₁ → q ≠ a → q ∈ closure (D₁ ∪ L ∪ D₂)ᶜ := fun hq hne ↦ by + rw [union_assoc] + refine discBd_closure_compl_union hT h₁ (hLc.union h₂.isClosed) hq ?_ + rintro (h | h) + · exact hne (hmem₁ h (Surface.discBd_subset _ hq)) + · exact disjoint_left.1 hd (Surface.discBd_subset _ hq) h + have k₂ : ∀ {q}, q ∈ discBd D₂ → q ≠ b → q ∈ closure (D₁ ∪ L ∪ D₂)ᶜ := fun hq hne ↦ by + rw [union_comm] + refine discBd_closure_compl_union hT h₂ (h₁.isClosed.union hLc) hq ?_ + rintro (h | h) + · exact disjoint_left.1 hd h (Surface.discBd_subset _ hq) + · exact hne (hmem₂ h (Surface.discBd_subset _ hq)) + have k₃ : ∀ {q}, q ∈ discBd D₁ → q ∈ closure (D₁ ∪ L ∪ D₂)ᶜ := fun {q} hq ↦ by + by_cases hqa : q = a + · refine closure_minimal ?_ isClosed_closure (mem_closure_oArc_sdiff h₁.isOArc_discBd hq) + rintro w ⟨hw, hwn⟩ + exact k₁ hw (fun he ↦ hwn (he.trans hqa.symm)) + · exact k₁ hq hqa + have k₄ : ∀ {q}, q ∈ discBd D₂ → q ∈ closure (D₁ ∪ L ∪ D₂)ᶜ := fun {q} hq ↦ by + by_cases hqb : q = b + · refine closure_minimal ?_ isClosed_closure (mem_closure_oArc_sdiff h₂.isOArc_discBd hq) + rintro w ⟨hw, hwn⟩ + exact k₂ hw (fun he ↦ hwn (he.trans hqb.symm)) + · exact k₂ hq hqb + rintro p ⟨hp, hn⟩ + rcases hp with (h | h) | h + · exact k₃ (by + by_contra hb' + exact hn (Or.inl ⟨h, hb'⟩)) + · by_cases hpa : p = a + · exact k₃ (hpa ▸ ha) + by_cases hpb : p = b + · exact k₄ (hpb ▸ hb) + have hoff : p ∉ D₁ ∪ D₂ := by + rintro (h' | h') + · exact hpa (hmem₁ h h') + · exact hpb (hmem₂ h h') + have hc := mem_closure_compl_union (h₁.isClosed.union h₂.isClosed) + (line_subset_closure_compl hT hl h) hoff + refine closure_mono ?_ hc + rintro w hw ((h' | h') | h') + · exact hw (Or.inr (Or.inl h')) + · exact hw (Or.inl h') + · exact hw (Or.inr (Or.inr h')) + · exact k₄ (by + by_contra hb' + exact hn (Or.inr ⟨h, hb'⟩)) + +theorem isCell_touch_image [Nonempty T] (hT : IsClosedSurface T) {D₁ D₂ : Set T} + (h₁ : IsClosedDisc D₁) (h₂ : IsClosedDisc D₂) {a : T} + (ha : D₁ ∩ D₂ = {a}) (c : C(T, T)) (hc : InjOn c (D₁ ∪ D₂)) : IsCell T (c '' (D₁ ∪ D₂)) := by + rw [image_union] + obtain ⟨hd₁, -⟩ := isClosedDisc_image_injOn h₁ c.continuous.continuousOn + (hc.mono subset_union_left) + obtain ⟨hd₂, -⟩ := isClosedDisc_image_injOn h₂ c.continuous.continuousOn + (hc.mono subset_union_right) + refine isCell_touch hT hd₁ hd₂ (a := c a) ?_ + rw [← hc.image_inter subset_union_left subset_union_right, ha, image_singleton] + +theorem isCell_bridge_image [ConnectedSpace T] (hT : IsClosedSurface T) {D₁ D₂ L : Set T} + (h₁ : IsClosedDisc D₁) (h₂ : IsClosedDisc D₂) + (hd : Disjoint D₁ D₂) {a b : T} (ha : a ∈ discBd D₁) (hb : b ∈ discBd D₂) + (hl : IsLineWithEnds L a b) (hL₁ : L ∩ D₁ = {a}) + (hL₂ : L ∩ D₂ = {b}) (c : C(T, T)) (hc : InjOn c (D₁ ∪ L ∪ D₂)) : IsCell T (c '' (D₁ ∪ L ∪ D₂)) + := by + have hs₁ : D₁ ⊆ D₁ ∪ L ∪ D₂ := subset_union_left.trans subset_union_left + have hsL : L ⊆ D₁ ∪ L ∪ D₂ := subset_union_right.trans subset_union_left + have hs₂ : D₂ ⊆ D₁ ∪ L ∪ D₂ := subset_union_right + rw [image_union, image_union] + obtain ⟨hd₁, hb₁⟩ := isClosedDisc_image_injOn h₁ c.continuous.continuousOn (hc.mono hs₁) + obtain ⟨hd₂, hb₂⟩ := isClosedDisc_image_injOn h₂ c.continuous.continuousOn (hc.mono hs₂) + have hline : IsLineWithEnds (c '' L) (c a) (c b) := by + obtain ⟨u, hu, rfl, rfl, rfl⟩ := hl.exists_arc + have h1 : IsArcMap (c ∘ u) := ⟨c.continuous.comp hu.1, fun x y h ↦ hu.2 (hc (hsL + (mem_range_self x)) (hsL (mem_range_self y)) h)⟩ + have := h1.isLineWithEnds + rwa [range_comp] at this + refine isCell_bridge hT hd₁ hd₂ ?_ (hb₁ ▸ mem_image_of_mem _ ha) (hb₂ ▸ mem_image_of_mem _ hb) + hline ?_ ?_ + · refine disjoint_left.2 ?_ + rintro _ ⟨x, hx, rfl⟩ ⟨y, hy, he⟩ + exact disjoint_left.1 hd hx (hc (hs₁ hx) (hs₂ hy) he.symm ▸ hy) + · rw [← hc.image_inter hsL hs₁, hL₁, image_singleton] + · rw [← hc.image_inter hsL hs₂, hL₂, image_singleton] + +end Frontier + +section Outer + +variable {S Shat Y : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + [TopologicalSpace Y] + [T2Space Y] {ψ : Y → S} {K : Drawing S} + +/-- The fragment wanted in the proof of (10.4), Graph Minors XIX, page 357: its image is `A`, it +caps to `Σ̂`, it has fewer cuffs than +`Σ`, and its inside is a closed surface `T'` homeomorphic to `Σ̂`, without a finite set. -/ +def IsOuterFragment (_cap : IsCappedSurface S Shat) (ψ : Y → S) (A : Set S) : Prop := + ∃ y : Y, ψ '' connectedComponent y = A ∧ + (∀ (Shat₁ : Type) [TopologicalSpace Shat₁], IsCappedSurface (connectedComponent y) Shat₁ + → Nonempty (Shat₁ ≃ₜ Shat)) ∧ + numCuffs (connectedComponent y) < numCuffs S ∧ + ∃ (T' : Type) (_ : TopologicalSpace T') (e : OpenPartialHomeomorph (connectedComponent y) T') + (P : Set T'), + IsClosedSurface T' ∧ Nonempty (T' ≃ₜ Shat) ∧ P.Finite ∧ e.source = (bd + (connectedComponent y))ᶜ ∧ e.target = Pᶜ + +omit [T2Space Y] in +/-- The fragment outside a cell `Z` of `Σ̂`. Its capping is `Σ̂`, and its cuffs are the cuffs of `Σ` +not in `Z`, and one more. -/ +theorem exists_outer_fragment_core (hS : IsSurface S) (cap : IsCappedSurface S Shat) + (hY : IsSurface Y) (hψ : IsCutMap ψ K.U) + {Z G : Set Shat} (hZc : IsClosed Z) (hG : IsOpen G) (hGZ : G ⊆ Z) + (hcell : ∀ c : C(Shat, Shat), InjOn c Z → IsCell Shat (c '' Z)) + (hK : cap.emb '' K.U ⊆ Z) (hrest : Z \ G ⊆ cap.discs ∪ cap.emb '' K.U) + (hfr : Z \ G ⊆ closure Zᶜ) + (hm : ∀ Θ ∈ cuffs S, ¬ closure (cap.cuffDisc Θ) ⊆ Z → (closure (cap.cuffDisc Θ) ∩ + Z).Subsingleton) : + ∃ y : Y, ψ '' connectedComponent y = cap.emb ⁻¹' Gᶜ ∧ + (∀ (Shat₁ : Type) [TopologicalSpace Shat₁], IsCappedSurface (connectedComponent y) Shat₁ + → Nonempty (Shat₁ ≃ₜ Shat)) ∧ + numCuffs (connectedComponent y) ≤ {Θ ∈ cuffs S | Disjoint (closure + (cap.cuffDisc Θ)) Z}.ncard + 1 ∧ + ∃ (T' : Type) (_ : TopologicalSpace T') (e : OpenPartialHomeomorph (connectedComponent y) T') + (P : Set T'), + IsClosedSurface T' ∧ Nonempty (T' ≃ₜ Shat) ∧ P.Finite ∧ e.source = (bd + (connectedComponent y))ᶜ ∧ e.target = Pᶜ := by + classical + have hT := cap.isClosedSurface + have hconn : ConnectedSpace Shat := cap.connected + have : CompactSpace Shat := hT.1 + have : CompactSpace S := hS.1 + have hfc : (cuffs S).Finite := (cuff_statement S hS).2.1 + set 𝓑 : Set (Set S) := {Θ ∈ cuffs S | ¬ closure (cap.cuffDisc Θ) ⊆ Z} with h𝓑 + let E : Set S → Set Shat := fun Θ ↦ closure (cap.cuffDisc Θ) + have hf𝓑 : 𝓑.Finite := hfc.subset fun _ h ↦ h.1 + have hdisj : (E '' 𝓑).PairwiseDisjoint id := by + rintro _ ⟨Θ₁, h₁, rfl⟩ _ ⟨Θ₂, h₂, rfl⟩ hn + exact cap.cuffDisc_disjoint Θ₁ h₁.1 Θ₂ h₂.1 fun h ↦ hn (h ▸ rfl) + obtain ⟨T', tT', e, P, hT', ⟨hom⟩, hP, hcard, hs, ht⟩ := exists_cell_region hT hcell (hf𝓑.image E) + (by + rintro _ ⟨Θ, hΘ, rfl⟩ + exact cap.cuffDisc_closedDisc Θ hΘ.1) hdisj (by + rintro _ ⟨Θ, hΘ, rfl⟩ + exact hm Θ hΘ.1 hΘ.2) + set X : Set Shat := Z ∪ ⋃₀ (E '' 𝓑) with hX + have hdc : IsClosed cap.discs := hfc.isClosed_biUnion fun _ _ ↦ isClosed_closure + have hKc : IsClosed (cap.emb '' K.U) := (K.isClosed_U.isCompact.image + cap.isEmbedding.continuous).isClosed + have hAc : IsClosed (⋃₀ (E '' 𝓑)) := (hf𝓑.image E).isClosed_sUnion (by + rintro _ ⟨Θ, -, rfl⟩ + exact isClosed_closure) + have hsub : cap.discs ∪ cap.emb '' K.U ⊆ X := by + rintro x (hx | hx) + · obtain ⟨Θ, hΘ, hxΘ⟩ := mem_iUnion₂.1 hx + by_cases h : closure (cap.cuffDisc Θ) ⊆ Z + · exact Or.inl (h hxΘ) + · exact Or.inr ⟨_, ⟨Θ, ⟨hΘ, h⟩, rfl⟩, hxΘ⟩ + · exact Or.inl (hK hx) + have hop : IsOpen (X \ (cap.discs ∪ cap.emb '' K.U)) := by + have : X \ (cap.discs ∪ cap.emb '' K.U) = G \ (cap.discs ∪ cap.emb '' K.U) := by + ext x + constructor + · rintro ⟨hx | hx, hn⟩ + · refine ⟨?_, hn⟩ + by_contra hxG + exact hn (hrest ⟨hx, hxG⟩) + · obtain ⟨_, ⟨Θ, hΘ, rfl⟩, hxΘ⟩ := hx + exact absurd (Or.inl (mem_biUnion hΘ.1 hxΘ)) hn + · rintro ⟨hx, hn⟩ + exact ⟨Or.inl (hGZ hx), hn⟩ + rw [this] + exact hG.sdiff (hdc.union hKc) + have : ConnectedSpace T' := hom.symm.surjective.connectedSpace hom.symm.continuous + obtain ⟨y, hy, hcap, hnum, e', hs', ht'⟩ := exists_fragment_of_region hS cap hY hψ hT' hP e + (by rw [hs]) ht hsub hop + refine ⟨y, ?_, fun Shat₁ _ cap₁ ↦ ?_, ?_, T', tT', e', P, hT', ⟨hom⟩, hP, hs', ht'⟩ + · rw [hy] + have hXr : Xᶜ ⊆ range cap.emb := by + rw [← compl_subset_compl, compl_compl, cap.compl_eq] + intro x hx + obtain ⟨Θ, hΘ, hxΘ⟩ := mem_iUnion₂.1 hx + exact hsub (Or.inl (mem_biUnion hΘ (subset_closure hxΘ))) + have hoff : ∀ {p}, p ∉ ⋃₀ (E '' 𝓑) → p ∈ Z → p ∉ G → p ∈ closure Xᶜ := fun hp hpZ hpG ↦ + mem_closure_compl_union hAc (hfr ⟨hpZ, hpG⟩) hp + have hEout : ∀ {Θ}, Θ ∈ 𝓑 → ∀ {x}, cap.emb x ∈ E Θ → cap.emb x ∉ Z → cap.emb x ∈ closure Xᶜ + := by + intro Θ hΘ x hxE hxZ + have hb : cap.emb x ∈ discBd (E Θ) := by + rw [show discBd (E Θ) = _ from cap.cuffDisc_bd Θ hΘ.1] + exact mem_image_of_mem _ (cap.mem_of_emb_mem hΘ.1 hxE) + have hlim := discBd_subset_closure_compl hT (cap.cuffDisc_closedDisc Θ hΘ.1) hb + have hrest' : IsClosed (Z ∪ ⋃₀ (E '' (𝓑 \ {Θ}))) := + hZc.union (((hf𝓑.subset sdiff_subset).image E).isClosed_sUnion (by + rintro _ ⟨Θ, -, rfl⟩ + exact isClosed_closure)) + have hn : cap.emb x ∉ Z ∪ ⋃₀ (E '' (𝓑 \ {Θ})) := by + rintro (h | ⟨_, ⟨Θ', hΘ', rfl⟩, hxΘ'⟩) + · exact hxZ h + · exact disjoint_left.1 (cap.cuffDisc_disjoint Θ hΘ.1 Θ' hΘ'.1.1 + (fun he ↦ hΘ'.2 he.symm)) hxE hxΘ' + refine closure_mono ?_ (mem_closure_compl_union hrest' hlim hn) + rintro w hw (hwZ | ⟨_, ⟨Θ', hΘ', rfl⟩, hwΘ'⟩) + · exact hw (Or.inr (Or.inl hwZ)) + · by_cases he : Θ' = Θ + · exact hw (Or.inl (he ▸ hwΘ')) + · exact hw (Or.inr (Or.inr ⟨_, ⟨Θ', ⟨hΘ', he⟩, rfl⟩, hwΘ'⟩)) + have hcl : ∀ x, cap.emb x ∉ G → cap.emb x ∈ closure Xᶜ := by + intro x hxG + by_cases hxE : cap.emb x ∈ ⋃₀ (E '' 𝓑) + · obtain ⟨_, ⟨Θ, hΘ, rfl⟩, hxΘ⟩ := hxE + by_cases hxZ : cap.emb x ∈ Z + · have hb : cap.emb x ∈ discBd (E Θ) := by + rw [show discBd (E Θ) = _ from cap.cuffDisc_bd Θ hΘ.1] + exact mem_image_of_mem _ (cap.mem_of_emb_mem hΘ.1 hxΘ) + have hlim := mem_closure_oArc_sdiff (cap.cuffDisc_closedDisc Θ hΘ.1).isOArc_discBd hb + refine closure_minimal ?_ isClosed_closure hlim + rintro w ⟨hwb, hwn⟩ + rw [show discBd (E Θ) = _ from cap.cuffDisc_bd Θ hΘ.1] at hwb + obtain ⟨z, hz, rfl⟩ := hwb + have hzE : cap.emb z ∈ E Θ := Surface.discBd_subset (E Θ) (by + rw [show discBd (E Θ) = _ from cap.cuffDisc_bd Θ hΘ.1] + exact mem_image_of_mem _ hz) + exact hEout hΘ hzE fun hzZ ↦ hwn (hm Θ hΘ.1 hΘ.2 ⟨hzE, hzZ⟩ ⟨hxΘ, hxZ⟩) + · exact hEout hΘ hxΘ hxZ + · by_cases hxZ : cap.emb x ∈ Z + · exact hoff hxE hxZ hxG + · exact subset_closure (fun h ↦ h.elim hxZ hxE) + apply Subset.antisymm + · refine closure_minimal ?_ (hG.isClosed_compl.preimage cap.isEmbedding.continuous) + intro x hx hxG + exact hx (Or.inl (hGZ hxG)) + · intro x hx + rw [cap.isEmbedding.closure_eq_preimage_closure_image, mem_preimage, + image_preimage_eq_of_subset hXr] + exact hcl x hx + · obtain ⟨f⟩ := hcap Shat₁ cap₁ + exact ⟨f.trans hom⟩ + · rw [hnum] + have hfd : {Θ ∈ cuffs S | Disjoint (closure (cap.cuffDisc Θ)) Z}.Finite + := hfc.subset fun _ h ↦ h.1 + have hsub' : {F ∈ E '' 𝓑 | Disjoint F Z} ⊆ E '' {Θ ∈ cuffs S | Disjoint (closure + (cap.cuffDisc Θ)) Z} := by + rintro _ ⟨⟨Θ, hΘ, rfl⟩, hd⟩ + exact ⟨Θ, ⟨hΘ.1, hd⟩, rfl⟩ + have h₅ := (ncard_le_ncard hsub' (hfd.image _)).trans (ncard_image_le hfd) + omega + +omit [T2Space Y] in +/-- **The fragment outside a cell.** -/ +theorem exists_outer_fragment (hS : IsSurface S) (cap : IsCappedSurface S Shat) (hY : IsSurface Y) + (hψ : IsCutMap ψ K.U) + {Z G : Set Shat} (hZc : IsClosed Z) (hG : IsOpen G) (hGZ : G ⊆ Z) + (hcell : ∀ c : C(Shat, Shat), InjOn c Z → IsCell Shat (c '' Z)) + (hK : cap.emb '' K.U ⊆ Z) (hrest : Z \ G ⊆ cap.discs ∪ cap.emb '' K.U) + (hfr : Z \ G ⊆ closure Zᶜ) + (hm : ∀ Θ ∈ cuffs S, ¬ closure (cap.cuffDisc Θ) ⊆ Z → (closure (cap.cuffDisc Θ) ∩ + Z).Subsingleton) + {Θ₁ Θ₂ : Set S} (h₁ : Θ₁ ∈ cuffs S) (h₂ : Θ₂ ∈ cuffs S) (hne : Θ₁ ≠ Θ₂) (hZ₁ : closure + (cap.cuffDisc Θ₁) ⊆ Z) + (hZ₂ : closure (cap.cuffDisc Θ₂) ⊆ Z) : + IsOuterFragment cap ψ (cap.emb ⁻¹' Gᶜ) := by + classical + have hfc : (cuffs S).Finite := (cuff_statement S hS).2.1 + obtain ⟨y, hy, hcap, hnum, hrest'⟩ := exists_outer_fragment_core hS cap hY hψ hZc hG hGZ hcell hK + hrest hfr hm + refine ⟨y, hy, hcap, ?_, hrest'⟩ + set 𝓑 : Set (Set S) := {Θ ∈ cuffs S | Disjoint (closure (cap.cuffDisc Θ)) Z} with h𝓑 + have hne' : ∀ {Θ}, Θ ∈ cuffs S → (closure (cap.cuffDisc Θ)).Nonempty := fun hΘ ↦ + (cap.cuffDisc_closedDisc _ hΘ).nonempty_discInt.mono (discInt_subset _) + have hsub𝓑 : 𝓑 ⊆ cuffs S \ {Θ₁, Θ₂} := by + rintro Θ ⟨hΘ, hn⟩ + refine ⟨hΘ, ?_⟩ + rintro (rfl | h) + · obtain ⟨x, hx⟩ := hne' hΘ + exact disjoint_left.1 hn hx (hZ₁ hx) + · rw [mem_singleton_iff.1 h] at hn + obtain ⟨x, hx⟩ := hne' h₂ + exact disjoint_left.1 hn hx (hZ₂ hx) + have h₃ : 𝓑.ncard ≤ (cuffs S \ {Θ₁, Θ₂}).ncard := ncard_le_ncard hsub𝓑 (hfc.subset sdiff_subset) + have h₄ : (cuffs S \ {Θ₁, Θ₂}).ncard + 2 = (cuffs S).ncard := by + have hsb : ({Θ₁, Θ₂} : Set (Set S)) ⊆ cuffs S := by + rintro _ (rfl | h) + · exact h₁ + · rw [mem_singleton_iff.1 h] + exact h₂ + rw [← ncard_pair hne, ncard_sdiff_add_ncard_of_subset hsb hfc] + change _ < (cuffs S).ncard + omega + +end Outer + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FragmentRegion.lean b/LeanPool/GraphMinor/GM19/FragmentRegion.lean new file mode 100644 index 0000000000..cd1b064a15 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FragmentRegion.lean @@ -0,0 +1,503 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FragmentCapping +public import LeanPool.GraphMinor.GM19.DiscSides +public import LeanPool.GraphMinor.GM19.CutTwo + +/-! +# Fragments as regions of a closed surface + +Let `ψ` undo a cut of `S` along `K`, and let `S ⊆ Shat` be a capping. A component of the complement +of `K` and of the pasted discs +is the inside of a fragment. So if this region is a closed surface `T'` without a finite set, then +by `capping_homeo` each +capping of the fragment is `T'` (`exists_fragment_of_region`). The second part finds such `T'`: +finitely many disjoint +closed discs collapse to points, also if they touch a given set in one point each +(`exists_cell_region`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric Filter GraphMinor.Surface + +section Dense + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +/-- The inside of a connected surface is dense. -/ +theorem dense_interior (hS : IsSurface S) [ConnectedSpace S] : Dense (bd S)ᶜ := by + obtain ⟨Shat, _, ⟨cap⟩⟩ := exists_cappedSurface _ S hS inferInstance rfl + have hT := cap.isClosedSurface + have : T2Space Shat := hT.2.1 + have hc := cap.isEmbedding + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have hfin : (cuffs S).Finite := (cuff_statement S hS).2.1 + intro x + by_cases hx : x ∈ bd S + · rw [← sUnion_cuffs] at hx + obtain ⟨Θ, hΘ, hxΘ⟩ := hx + have hE := cap.cuffDisc_closedDisc Θ hΘ + set E := closure (cap.cuffDisc Θ) with hEdef + have hxb : cap.emb x ∈ discBd E := cap.cuffDisc_bd Θ hΘ ▸ mem_image_of_mem _ hxΘ + have hnot : cap.emb x ∉ interior E := fun h ↦ by + have := subset_discInt_of_isOpen (fun y _ ↦ hT.2.2 y) isOpen_interior interior_subset h + exact this.2 hxb + have hcl : cap.emb x ∈ closure Eᶜ := by + rw [closure_compl] + exact hnot + set V : Set Shat := (⋃ Θ' ∈ cuffs S \ {Θ}, closure (cap.cuffDisc Θ'))ᶜ with hV + have hVo : IsOpen V := ((hfin.subset sdiff_subset).isClosed_biUnion fun _ _ ↦ + isClosed_closure).isOpen_compl + have hxV : cap.emb x ∈ V := by + intro hn + obtain ⟨Θ', hΘ', hxΘ'⟩ := mem_iUnion₂.1 hn + exact disjoint_left.1 (cap.cuffDisc_disjoint Θ hΘ Θ' hΘ'.1 (Ne.symm hΘ'.2)) + (discBd_subset _ hxb) hxΘ' + rw [hc.closure_eq_preimage_closure_image, mem_preimage, ← cap.compl_eq_image] + rw [_root_.mem_closure_iff] at hcl ⊢ + intro O hO hxO + obtain ⟨y, hy, hyE⟩ := hcl (O ∩ V) (hO.inter hVo) ⟨hxO, hxV⟩ + refine ⟨y, hy.1, fun hn ↦ ?_⟩ + obtain ⟨Θ', hΘ', hyΘ'⟩ := mem_iUnion₂.1 hn + by_cases he : Θ' = Θ + · rw [he] at hyΘ' + exact hyE hyΘ' + · exact hy.2 (mem_biUnion (show Θ' ∈ cuffs S \ {Θ} from ⟨hΘ', he⟩) hyΘ') + · exact subset_closure hx + +omit [T2Space S] in +/-- The inside of a surface is dense. -/ +theorem dense_interior' (hS : IsSurface S) : Dense (bd S)ᶜ := by + have : LocallyConnectedSpace S := IsSurface.locallyConnected hS + intro x + have hWo : IsOpen (connectedComponent x) := isOpen_connectedComponent + have hWc : IsClopen (connectedComponent x) := ⟨isClosed_connectedComponent, hWo⟩ + have : ConnectedSpace (connectedComponent x) := isConnected_iff_connectedSpace.mp + isConnected_connectedComponent + have hd := dense_interior (isSurface_sub hS hWc) + have hx := hd ⟨x, mem_connectedComponent⟩ + rw [_root_.mem_closure_iff] at hx ⊢ + intro O hO hxO + obtain ⟨y, hyO, hy⟩ := hx (Subtype.val ⁻¹' O) (hO.preimage continuous_subtype_val) hxO + exact ⟨y.1, hyO, fun h ↦ hy ((mem_bd_sub hWo).2 h)⟩ + +end Dense + +section Connected + +variable {T : Type} [TopologicalSpace T] [T2Space T] [ConnectedSpace T] + +omit [ConnectedSpace T] in +/-- An open connected set of a closed surface stays connected when a point is removed. -/ +theorem isPreconnected_sdiff_point (hT : IsClosedSurface T) {G : Set T} (hG : IsOpen G) + (hGc : IsPreconnected G) (x : T) : + IsPreconnected (G \ {x}) := by + by_cases hx : x ∈ G + swap + · rwa [sdiff_singleton_eq_self hx] + obtain ⟨U, h, g, c, hU, h0⟩ := (hT.2.2 x).exists_ballChart hG hx one_pos + have h0m : (0 : ℂ) ∈ ball (0 : ℂ) 1 := by simp + have hsub : closedBall (0 : ℂ) (1 / 2) ⊆ ball 0 1 := closedBall_subset_ball (by norm_num) + have hdisc := isClosedDisc_of_convex (K := closedBall (0 : ℂ) (1 / 2)) + (convex_closedBall 0 _) + (by rw [interior_closedBall _ (by norm_num)]; exact ⟨0, by simp⟩) + isBounded_closedBall isClosed_closedBall + obtain ⟨hB, -⟩ := c.image_disc hdisc.1 hsub + have hBU : g '' closedBall 0 (1 / 2) ⊆ U := image_subset_iff.2 fun z hz ↦ c.gm (hsub hz) + have hxB : x ∈ g '' closedBall 0 (1 / 2) := ⟨0, by simp, h0⟩ + have hheq : U \ {x} = g '' (ball 0 1 \ {0}) := by + ext y + constructor + · rintro ⟨hy, hne⟩ + refine ⟨h y, ⟨c.hm hy, fun h1 ↦ hne ?_⟩, c.gh hy⟩ + rw [← c.gh hy, h1, h0] + rfl + · rintro ⟨z, ⟨hz, hz0⟩, rfl⟩ + refine ⟨c.gm hz, fun he ↦ hz0 ?_⟩ + have h1 : h (g z) = z := c.hg hz + have h2 : h (g 0) = 0 := c.hg h0m + rw [show g z = g 0 from he.trans h0.symm] at h1 + exact h1.symm.trans h2 + have hc1 : IsPreconnected (U \ {x}) := hheq ▸ isPreconnected_ball_sdiff.image _ + (c.gc.mono sdiff_subset) + have hc2 := isPreconnected_sdiff_disc hT hG hGc hB (hBU.trans hU) + have hz : g (3 / 4) ∈ (U \ {x}) ∩ (G \ g '' closedBall 0 (1 / 2)) := by + have hm : (3 / 4 : ℂ) ∈ ball (0 : ℂ) 1 := by simp; norm_num + have hnot : g (3 / 4) ∉ g '' closedBall 0 (1 / 2) := by + rintro ⟨w, hw, he⟩ + have := c.hg.injOn (hsub hw) hm he + rw [this, mem_closedBall_zero_iff] at hw + norm_num at hw + refine ⟨⟨c.gm hm, fun he ↦ hnot (he ▸ hxB)⟩, hU (c.gm hm), hnot⟩ + have := hc1.union' ⟨_, hz.1, hz.2⟩ hc2 + convert this using 1 + ext y + constructor + · rintro ⟨hy, hne⟩ + by_cases hyB : y ∈ g '' closedBall 0 (1 / 2) + · exact Or.inl ⟨hBU hyB, hne⟩ + · exact Or.inr ⟨hy, hyB⟩ + · rintro (⟨hy, hne⟩ | ⟨hy, hyB⟩) + · exact ⟨hU hy, hne⟩ + · exact ⟨hy, fun he ↦ hyB (he ▸ hxB)⟩ + +omit [ConnectedSpace T] in +theorem isPreconnected_sdiff_finite (hT : IsClosedSurface T) {G : Set T} (hG : IsOpen G) + (hGc : IsPreconnected G) {P : Set T} + (hP : P.Finite) : IsPreconnected (G \ P) := by + induction P, hP using Set.Finite.induction_on with + | empty => simpa using hGc + | @insert x P _ hP ih => + have hop : IsOpen (G \ P) := hG.sdiff hP.isClosed + have := isPreconnected_sdiff_point hT hop ih x + rwa [sdiff_sdiff, union_comm, ← insert_eq] at this + +end Connected + +section Fragment + +variable {S Y : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Y] [T2Space Y] {ψ : Y + → S} {K : Drawing S} + +omit [T2Space Y] in +/-- A component of the complement of `K` and of the boundary is the inside of a fragment. -/ +theorem exists_fragment (hS : IsSurface S) (hY : IsSurface Y) (hψ : IsCutMap ψ K.U) {A : Set S} + (hA : A ∈ componentsIn (bd S ∪ K.U)ᶜ) : + ∃ y : Y, ψ '' connectedComponent y = closure A ∧ ∃ e : OpenPartialHomeomorph + (connectedComponent y) S, + e.source = (bd (connectedComponent y))ᶜ ∧ e.target = A := by + classical + have : CompactSpace Y := hY.1 + have : LocallyConnectedSpace Y := IsSurface.locallyConnected hY + have hF : IsClosed K.U := K.isClosed_U + obtain ⟨a, haD, rfl⟩ := hA + obtain ⟨y, rfl⟩ := hψ.2.1 a + have haD' : ψ y ∉ bd S ∧ ψ y ∉ K.U := by simpa using haD + have hyb : y ∉ bd Y := fun h ↦ haD'.1 (bd_of_bd_cutMap hψ hF h haD'.2) + refine ⟨y, ?_⟩ + have hWo : IsOpen (connectedComponent y) := isOpen_connectedComponent + have hbdW : ∀ {x : connectedComponent y}, x ∈ bd (connectedComponent y) ↔ x.1 ∈ bd Y + := mem_bd_sub hWo + have hfrag := isCuttingFragment_of_cut hS hY hψ (K := K) rfl y + set R := (fun x : connectedComponent y ↦ ψ x.1) '' (bd (connectedComponent y))ᶜ with hR + have hRcomp : R = connectedComponentIn (bd S ∪ K.U)ᶜ (ψ y) := by + obtain ⟨r, hr, hRe⟩ := hfrag.interior_component + refine hRe.symm.trans (connectedComponentIn_eq ?_) + rw [hRe] + exact ⟨⟨y, mem_connectedComponent⟩, fun h ↦ hyb (hbdW.1 h), rfl⟩ + rw [← hRcomp] + have hRW : R ⊆ ψ '' connectedComponent y := by + rintro _ ⟨x, -, rfl⟩ + exact mem_image_of_mem ψ x.2 + have hoff : ∀ {x : connectedComponent y}, x ∉ bd (connectedComponent y) → ψ x.1 ∉ K.U + := fun hx hn ↦ + hx (hbdW.2 (hψ.2.2.2.2 hn)) + have : Nonempty (connectedComponent y) := ⟨⟨y, mem_connectedComponent⟩⟩ + have hopen : ∀ u ⊆ (bd (connectedComponent y))ᶜ, IsOpen u → IsOpen ((fun x : connectedComponent y + ↦ ψ x.1) '' u) := by + intro u hu huo + have : (fun x : connectedComponent y ↦ ψ x.1) '' u = ψ '' (Subtype.val '' u) := by + rw [image_image] + rw [this] + refine isOpen_image_of_isCutMap hψ ?_ (hWo.isOpenMap_subtype_val _ huo) + rintro _ ⟨x, hx, rfl⟩ + exact hoff (hu hx) + obtain ⟨e, hs, ht, -⟩ := GM19.exists_oph (cuff_statement _ hfrag.isSurface).1.isOpen_compl + (hψ.1.comp continuous_subtype_val).continuousOn hfrag.injOn_interior hopen rfl + refine ⟨Subset.antisymm ?_ ?_, e, hs, ht⟩ + · rintro _ ⟨x, hx, rfl⟩ + have hd := dense_interior' hY x + rw [_root_.mem_closure_iff] at hd ⊢ + intro O hO hxO + have hWm : connectedComponent y ∈ 𝓝 x := hWo.mem_nhds hx + obtain ⟨z, ⟨hzO, hzW⟩, hzb⟩ := hd (ψ ⁻¹' O ∩ connectedComponent y) + ((hO.preimage hψ.1).inter hWo) ⟨hxO, hx⟩ + exact ⟨ψ z, hzO, ⟨⟨z, hzW⟩, fun h ↦ hzb (hbdW.1 h), rfl⟩⟩ + · exact closure_minimal hRW (isClosedMap_of_isCutMap hψ _ isClosed_connectedComponent) + +variable {Shat T' : Type} [TopologicalSpace Shat] [T2Space Shat] [TopologicalSpace T'] + +/-- The pasted discs. -/ +def IsCappedSurface.discs (cap : IsCappedSurface S Shat) : Set Shat := ⋃ Θ ∈ cuffs S, closure + (cap.cuffDisc Θ) + +omit [T2Space S] [T2Space Shat] in +/-- Transporting a capping reindexes its cuffs and preserves the union of the pasted discs. -/ +theorem IsCappedSurface.ofHomeo_discs (cap : IsCappedSurface S Shat) (f : S ≃ₜ S) : + (cap.ofHomeo f).discs = cap.discs := by + ext x + simp only [IsCappedSurface.discs, mem_iUnion₂] + constructor + · rintro ⟨Θ, hΘ, hx⟩ + rw [(cap.ofHomeo_cuffDisc f hΘ).2] at hx + exact ⟨_, (cap.ofHomeo_cuffDisc f hΘ).1, hx⟩ + · rintro ⟨Θ, hΘ, hx⟩ + rw [← (cap.ofHomeo_cuffDisc_symm f hΘ).2] at hx + exact ⟨_, (cap.ofHomeo_cuffDisc_symm f hΘ).1, hx⟩ + +omit [T2Space Shat] in +omit [T2Space Y] in +/-- If the region off `X` is a component of the complement of `K` and of the pasted discs, and it is +a connected closed surface +`T'` without a finite set `P`, then there is a fragment with this inside. Each capping of the +fragment is `T'`, and the fragment has +`|P|` cuffs. -/ +theorem exists_fragment_of_region (hS : IsSurface S) (cap : IsCappedSurface S Shat) + (hY : IsSurface Y) (hψ : IsCutMap ψ K.U) + (hT' : IsClosedSurface T') [ConnectedSpace T'] {P : Set T'} (hP : P.Finite) {X : Set Shat} + (e : OpenPartialHomeomorph Shat T') + (hs : e.source = Xᶜ) (ht : e.target = Pᶜ) (hsub : cap.discs ∪ cap.emb '' K.U ⊆ X) + (hop : IsOpen (X \ (cap.discs ∪ cap.emb '' K.U))) : + ∃ y : Y, ψ '' connectedComponent y = closure (cap.emb ⁻¹' Xᶜ) ∧ + (∀ (Shat₁ : Type) [TopologicalSpace Shat₁], IsCappedSurface (connectedComponent y) Shat₁ + → Nonempty (Shat₁ ≃ₜ T')) ∧ + numCuffs (connectedComponent y) = P.ncard ∧ + ∃ e' : OpenPartialHomeomorph (connectedComponent y) T', e'.source = (bd + (connectedComponent y))ᶜ ∧ e'.target = Pᶜ := by + classical + have : T2Space T' := hT'.2.1 + have hcomp : cap.discsᶜ = cap.emb '' (bd S)ᶜ := cap.compl_eq_image + have hXA : Xᶜ ⊆ cap.emb '' (bd S)ᶜ := by + rw [← hcomp] + exact compl_subset_compl.2 (subset_union_left.trans hsub) + set A : Set S := cap.emb ⁻¹' Xᶜ with hA + have hAim : cap.emb '' A = Xᶜ := by + apply Subset.antisymm (image_preimage_subset _ _) + intro x hx + obtain ⟨z, -, rfl⟩ := hXA hx + exact ⟨z, hx, rfl⟩ + have hXo : IsOpen Xᶜ := hs ▸ e.open_source + have hAo : IsOpen A := hXo.preimage cap.isEmbedding.continuous + have hconn : IsPreconnected A := by + rw [← cap.isEmbedding.isInducing.isPreconnected_image, hAim] + have h₁ : IsPreconnected Pᶜ := by + have := isPreconnected_sdiff_finite hT' isOpen_univ isPreconnected_univ hP + rwa [← compl_eq_univ_sdiff] at this + have h₂ : e.symm '' Pᶜ = Xᶜ := by + rw [← hs, ← ht] + exact e.symm_image_target_eq_source + rw [← h₂] + exact h₁.image _ (ht ▸ e.continuousOn_symm) + have hAD : A ⊆ (bd S ∪ K.U)ᶜ := by + intro x hx + have hx' : cap.emb x ∉ X := hx + rintro (hb | hu) + · refine hx' (hsub (Or.inl ?_)) + by_contra hn + have : cap.emb x ∈ cap.emb '' (bd S)ᶜ := hcomp ▸ hn + obtain ⟨z, hz, he⟩ := this + exact hz (cap.isEmbedding.injective he ▸ hb) + · exact hx' (hsub (Or.inr (mem_image_of_mem _ hu))) + have : Nonempty T' := (inferInstance : ConnectedSpace T').toNonempty + obtain ⟨z₀, hz₀⟩ : (Pᶜ).Nonempty := (dense_compl_finite hT'.2.2 hP).nonempty + obtain ⟨a, ha⟩ : A.Nonempty := by + have hm : e.symm z₀ ∈ Xᶜ := by rw [← hs]; exact e.map_target (ht ▸ hz₀) + obtain ⟨z, -, he⟩ := hXA hm + exact ⟨z, by rw [hA, mem_preimage, he]; exact hm⟩ + have hAcomp : A ∈ componentsIn (bd S ∪ K.U)ᶜ := by + refine ⟨a, hAD ha, Subset.antisymm ?_ (hconn.subset_connectedComponentIn ha hAD)⟩ + have hco := isPreconnected_connectedComponentIn (F := (bd S ∪ K.U)ᶜ) (x := a) + have hV : IsOpen (cap.emb ⁻¹' (X \ (cap.discs ∪ cap.emb '' K.U))) + := hop.preimage cap.isEmbedding.continuous + refine hco.subset_left_of_subset_union hAo hV ?_ (fun x hx ↦ ?_) ⟨a, + mem_connectedComponentIn (hAD ha), ha⟩ + · exact disjoint_left.2 fun x hx hx' ↦ hx hx'.1 + · have hxD := connectedComponentIn_subset _ _ hx + by_cases hxX : cap.emb x ∈ X + · refine Or.inr ⟨hxX, ?_⟩ + rintro (hd | ⟨u, hu, he⟩) + · have : cap.emb x ∉ cap.discsᶜ := fun h ↦ h hd + rw [hcomp] at this + exact this (mem_image_of_mem _ fun h ↦ hxD (Or.inl h)) + · exact hxD (Or.inr (cap.isEmbedding.injective he ▸ hu)) + · exact Or.inl hxX + obtain ⟨y, hy, e₁, hs₁, ht₁⟩ := exists_fragment hS hY hψ hAcomp + refine ⟨y, hy, ?_⟩ + have : Nonempty (connectedComponent y) := ⟨⟨y, mem_connectedComponent⟩⟩ + have : LocallyConnectedSpace Y := IsSurface.locallyConnected hY + have hsW : IsSurface (connectedComponent y) := isSurface_sub hY ⟨isClosed_connectedComponent, + isOpen_connectedComponent⟩ + have ho : ∀ u ⊆ A, IsOpen u → IsOpen (cap.emb '' u) := fun u hu huo ↦ by + obtain ⟨O, hO, rfl⟩ := cap.isEmbedding.isInducing.isOpen_iff.1 huo + have : cap.emb '' (cap.emb ⁻¹' O) = O ∩ Xᶜ := by + apply Subset.antisymm + · rintro _ ⟨x, hx, rfl⟩ + exact ⟨hx, hu hx⟩ + · rintro z ⟨hz, hz'⟩ + rw [← hAim] at hz' + obtain ⟨x, -, rfl⟩ := hz' + exact ⟨x, hz, rfl⟩ + rw [this] + exact hO.inter hXo + have : Nonempty S := ⟨a⟩ + obtain ⟨e₂, hs₂, ht₂, -⟩ := GM19.exists_oph hAo cap.isEmbedding.continuous.continuousOn + cap.isEmbedding.injective.injOn ho hAim + let e' := (e₁.trans' e₂ (ht₁.trans hs₂.symm)).trans' e (ht₂.trans hs.symm) + have hs' : e'.source = (bd (connectedComponent y))ᶜ := hs₁ + have ht' : e'.target = Pᶜ := ht + refine ⟨fun Shat₁ _ cap₁ ↦ (capping_homeo hsW cap₁ hT' hP e' hs' ht').1, ?_, e', hs', ht'⟩ + obtain ⟨Shat₁, _, ⟨cap₁⟩⟩ := exists_cappedSurface _ (connectedComponent y) hsW + (isConnected_iff_connectedSpace.mp isConnected_connectedComponent) rfl + exact (capping_homeo hsW cap₁ hT' hP e' hs' ht').2 + +end Fragment + +section Cell + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +/-- `Y` is cellular in `T`: `T` without `Y` is a closed surface homeomorphic to `T`, without at most +one point. -/ +def IsCell (T : Type) [TopologicalSpace T] (Y : Set T) : Prop := + ∃ (T' : Type) (_ : TopologicalSpace T') (e : OpenPartialHomeomorph T T') + (P : Set T'), IsClosedSurface T' ∧ + Nonempty (T' ≃ₜ T) ∧ P.Finite ∧ P.ncard ≤ 1 ∧ e.source = Yᶜ ∧ e.target = Pᶜ + +theorem isCell_disc [Nonempty T] (hT : IsClosedSurface T) {D : Set T} + (hD : IsClosedDisc D) : IsCell T D := by + have : CompactSpace T := hT.1 + obtain ⟨c, p, hc⟩ := exists_collapse_disc hT hD + obtain ⟨e, hs, ht, -⟩ := hc.exists_oph + exact ⟨T, _, e, {p}, hT, ⟨.refl T⟩, finite_singleton _, by simp, hs, ht⟩ + +theorem isCell_touch [Nonempty T] (hT : IsClosedSurface T) {D₁ D₂ : Set T} (h₁ : IsClosedDisc D₁) + (h₂ : IsClosedDisc D₂) {a : T} + (ha : D₁ ∩ D₂ = {a}) : IsCell T (D₁ ∪ D₂) := by + classical + have : CompactSpace T := hT.1 + obtain ⟨c, p, hc⟩ := exists_collapse_disc hT h₁ + have hinj : InjOn c D₂ := by + intro x hx y hy he + by_cases hx₁ : x ∈ D₁ + · have hy₁ : y ∈ D₁ := hc.preimage (by rw [mem_preimage, ← he]; exact hc.mapsTo hx₁) + have hxa : x = a := by + have : x ∈ D₁ ∩ D₂ := ⟨hx₁, hx⟩ + rwa [ha] at this + have hya : y = a := by + have : y ∈ D₁ ∩ D₂ := ⟨hy₁, + hy⟩ + rwa [ha] at this + rw [hxa, hya] + · have hy₁ : y ∉ D₁ := fun hy₁ ↦ + hx₁ (hc.preimage (by rw [mem_preimage, he]; exact hc.mapsTo hy₁)) + exact hc.injOn hx₁ hy₁ he + obtain ⟨hd, -⟩ := isClosedDisc_image_injOn h₂ c.continuous.continuousOn hinj + obtain ⟨c', p', hc'⟩ := exists_collapse_disc hT hd + have hcomp := hc.comp hc' + have hpre : D₁ ∪ c ⁻¹' (c '' D₂) = D₁ ∪ D₂ := by + apply Subset.antisymm + · rintro x (hx | ⟨z, hz, he⟩) + · exact Or.inl + hx + · by_cases hx₁ : x ∈ + D₁ + · exact Or.inl hx₁ + · have hz₁ : z ∉ D₁ := fun hz₁ ↦ + hx₁ (hc.preimage (by rw [mem_preimage, ← he]; exact hc.mapsTo hz₁)) + exact Or.inr (hc.injOn hz₁ hx₁ he ▸ hz) + · rintro x (hx | hx) + · exact Or.inl hx + · exact Or.inr ⟨x, hx, rfl⟩ + have hp' : c' '' {p} ∪ {p'} = {p'} := by + have hm : p ∈ c '' D₂ := by + have hm : a ∈ D₁ ∩ D₂ := by rw [ha]; exact mem_singleton a + exact ⟨a, hm.2, hc.mapsTo hm.1⟩ + rw [image_singleton, show c' p = p' from hc'.mapsTo hm] + simp + rw [hpre, hp'] at hcomp + obtain ⟨e, hs, ht, -⟩ := hcomp.exists_oph + exact ⟨T, _, e, {p'}, hT, ⟨.refl T⟩, finite_singleton _, by simp, hs, ht⟩ + +/-- Let `Y` be cellular, also after each continuous map that is one to one on `Y`. Let finitely many +pairwise disjoint closed +discs meet `Y` in at most one point each. Then `T` without `Y` and without the discs is a closed +surface homeomorphic to `T`, +without a finite set, with one point for each disc and at most one more. -/ +theorem exists_cell_region [Nonempty T] (hT : IsClosedSurface T) {Y : Set T} + (hY : ∀ c : C(T, T), InjOn c Y → IsCell T (c '' Y)) + {𝓐 : Set (Set T)} (hf : 𝓐.Finite) (hd : ∀ E ∈ 𝓐, IsClosedDisc E) (hp : 𝓐.PairwiseDisjoint id) + (hm : ∀ E ∈ 𝓐, (E ∩ Y).Subsingleton) : + ∃ (T' : Type) (_ : TopologicalSpace T') (e : OpenPartialHomeomorph T T') + (P : Set T'), IsClosedSurface T' ∧ + Nonempty (T' ≃ₜ T) ∧ P.Finite ∧ P.ncard ≤ {E ∈ 𝓐 | Disjoint E Y}.ncard + 1 ∧ e.source = + (Y ∪ ⋃₀ 𝓐)ᶜ ∧ e.target = Pᶜ := by + classical + have : CompactSpace T := hT.1 + obtain ⟨c, P₀, q, hc, hq, rfl, hqi⟩ := exists_collapse hT hf hd hp + have hinj : InjOn c Y := by + intro x hx y hy he + by_cases hxA : x ∈ ⋃₀ 𝓐 + · obtain ⟨E, hE, hxE⟩ := hxA + have hyA : y ∈ ⋃₀ 𝓐 := hc.preimage (by + rw [mem_preimage, ← he, hq E hE x hxE] + exact mem_image_of_mem q hE) + obtain ⟨E', hE', hyE'⟩ := hyA + have : E = E' := hqi hE hE' (by rw [← hq E hE x hxE, ← hq E' hE' y hyE', + he]) + subst this + exact hm E hE ⟨hxE, hx⟩ ⟨hyE', hy⟩ + · have hyA : y ∉ ⋃₀ 𝓐 := fun hyA ↦ + hxA (hc.preimage (by rw [mem_preimage, he]; exact hc.mapsTo hyA)) + exact hc.injOn hxA hyA he + obtain ⟨T', tT', e₁, P₁, hT', hhom, hP₁, hc₁, hs₁, ht₁⟩ := hY c hinj + obtain ⟨e₀, hs₀, ht₀, heq⟩ := hc.exists_oph + have hT2' : T2Space T' := hT'.2.1 + refine ⟨T', tT', e₀.trans e₁, P₁ ∪ e₁ '' (q '' 𝓐 \ c '' Y), hT', hhom, + hP₁.union (((hf.image _).subset sdiff_subset).image _), + ?_, ?_, ?_⟩ + · refine (ncard_union_le _ _).trans ?_ + have hfd : {E ∈ 𝓐 | Disjoint E Y}.Finite := hf.subset fun _ h ↦ h.1 + have hsub : q '' 𝓐 \ c '' Y ⊆ q '' {E ∈ 𝓐 | Disjoint E Y} := by + rintro _ ⟨⟨E, hE, rfl⟩, hn⟩ + refine ⟨E, ⟨hE, disjoint_left.2 fun x hxE hxY ↦ hn ⟨x, hxY, hq E hE x hxE⟩⟩, rfl⟩ + have h₂ : (e₁ '' (q '' 𝓐 \ c '' Y)).ncard ≤ {E ∈ 𝓐 | Disjoint E Y}.ncard := + (ncard_image_le ((hf.image _).subset sdiff_subset)).trans + ((ncard_le_ncard hsub (hfd.image _)).trans (ncard_image_le hfd)) + omega + · ext x + rw [e₀.trans_source, hs₀, hs₁] + simp only [mem_inter_iff, mem_preimage, mem_compl_iff, mem_union, not_or] + constructor + · rintro ⟨hx, hy⟩ + refine ⟨fun hxY ↦ hy ?_, hx⟩ + rw [heq hx] + exact mem_image_of_mem c hxY + · rintro ⟨hxY, hx⟩ + refine ⟨hx, fun hy ↦ ?_⟩ + rw [heq hx] at hy + obtain ⟨z, hz, he⟩ := hy + by_cases hzA : z ∈ ⋃₀ 𝓐 + · exact hx (hc.preimage (by rw [mem_preimage, ← he]; exact hc.mapsTo hzA)) + · exact hxY (hc.injOn hzA hx he ▸ hz) + · ext z + rw [e₀.trans_target, ht₁, ht₀] + simp only [mem_inter_iff, mem_preimage, mem_compl_iff, mem_union, not_or] + constructor + · rintro ⟨hz, hw⟩ + refine ⟨hz, ?_⟩ + rintro ⟨w, ⟨hw₁, hw₂⟩, rfl⟩ + have hws : w ∈ e₁.source := by rw [hs₁]; exact hw₂ + rw [e₁.left_inv hws] at hw + exact hw hw₁ + · rintro ⟨hz, hw⟩ + refine ⟨hz, fun hq' ↦ hw ?_⟩ + have hzt : z ∈ e₁.target := by rw [ht₁]; exact hz + have hws : e₁.symm z ∈ e₁.source := e₁.map_target hzt + rw [hs₁] at hws + exact ⟨e₁.symm z, ⟨hq', hws⟩, e₁.right_inv hzt⟩ + +end Cell + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FragmentShape.lean b/LeanPool/GraphMinor/GM19/FragmentShape.lean new file mode 100644 index 0000000000..ca63c13481 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FragmentShape.lean @@ -0,0 +1,466 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FragmentOuter +import LeanPool.GraphMinor.GM19.Section6Cuff + +/-! +# The three shapes of a distance flaw + +We apply `exists_outer_fragment` to each of the three shapes of `IsOuterShape`. In the first shape +the cell is one closed disc. In the +second it is a disc and a pasted disc, joined by a line or touching in a point. In the third it is +two discs, joined by a line or +touching in a point. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric Filter GraphMinor.Surface + +variable {S Shat Y : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + [TopologicalSpace Y] + [T2Space Y] {ψ : Y → S} {K : Drawing S} + +omit [T2Space S] in +/-- A pasted disc that meets a closed disc with boundary in `S` lies in that disc. -/ +theorem IsCappedSurface.subset_of_meet (cap : IsCappedSurface S Shat) {D : Set + Shat} (hD : IsClosedDisc D) + (h : discBd D ⊆ range cap.emb) {Θ : Set S} (hΘ : Θ ∈ cuffs S) (hm : + (cap.cuffDisc Θ ∩ D).Nonempty) : + closure (cap.cuffDisc Θ) ⊆ D := by + obtain ⟨x, hx, hxD⟩ := hm + rcases cap.side hD h hΘ with h' | h' + · exact h' + · exfalso + refine disjoint_left.1 h' (subset_closure hx) ⟨hxD, fun hb ↦ ?_⟩ + exact cap.notMem_range hΘ hx (h hb) + +omit [T2Space S] [T2Space Shat] in +theorem IsCappedSurface.bd_of_mem (cap : IsCappedSurface S Shat) {Θ : Set S} + (hΘ : Θ ∈ cuffs S) {z : S} + (hz : cap.emb z ∈ closure (cap.cuffDisc Θ)) : z ∈ bd S := + cuff_subset_bd ⟨Θ, hΘ⟩ (cap.mem_of_emb_mem hΘ hz) + +omit [T2Space S] [T2Space Shat] in +theorem IsCappedSurface.mem_closure_emb (cap : IsCappedSurface S Shat) {Θ : Set + S} (hΘ : Θ ∈ cuffs S) {z : S} + (hz : z ∈ Θ) : cap.emb z ∈ closure (cap.cuffDisc Θ) := by + rw [cap.closure_cuffDisc hΘ] + exact Or.inr (mem_image_of_mem _ hz) + +omit [T2Space Y] in +/-- The cell is one closed disc `D`. -/ +theorem outer_disc (hS : IsSurface S) (cap : IsCappedSurface S Shat) (hY : IsSurface Y) + (hψ : IsCutMap ψ K.U) {D : Set Shat} + (hD : IsClosedDisc D) (hr : discBd D ⊆ range cap.emb) (hK : cap.emb '' K.U ⊆ discBd D) + (hrest : discBd D ⊆ cap.discs ∪ cap.emb '' K.U) + (hm : ∀ Θ ∈ cuffs S, ¬ closure (cap.cuffDisc Θ) ⊆ D → (closure (cap.cuffDisc Θ) ∩ discBd + D).Subsingleton) + {Θ₁ Θ₂ : Set S} (h₁ : Θ₁ ∈ cuffs S) (h₂ : Θ₂ ∈ cuffs S) (hne : Θ₁ ≠ Θ₂) (hZ₁ : closure + (cap.cuffDisc Θ₁) ⊆ D) + (hZ₂ : closure (cap.cuffDisc Θ₂) ⊆ D) : IsOuterFragment cap ψ (cap.emb ⁻¹' (discInt D)ᶜ) := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have hbd : D \ discInt D ⊆ discBd D := by + rintro x ⟨hx, hn⟩ + by_contra hb + exact hn ⟨hx, hb⟩ + refine exists_outer_fragment hS cap hY hψ hD.isClosed (hD.isOpen_discInt hman) (discInt_subset D) + (fun c hc ↦ ?_) + (hK.trans (Surface.discBd_subset D)) (hbd.trans hrest) (hbd.trans + (discBd_subset_closure_compl hT hD)) ?_ h₁ h₂ hne hZ₁ hZ₂ + · exact isCell_disc hT (isClosedDisc_image_injOn hD c.continuous.continuousOn hc).1 + · intro Θ hΘ hn x hx y hy + have key : ∀ {x}, x ∈ closure (cap.cuffDisc Θ) ∩ D → x ∈ closure (cap.cuffDisc Θ) ∩ discBd D + := by + rintro x ⟨hxE, hxD⟩ + refine ⟨hxE, ?_⟩ + rcases cap.side hD hr hΘ with h | h + · exact absurd h hn + · by_contra hb + exact disjoint_left.1 h hxE ⟨hxD, hb⟩ + exact hm Θ hΘ hn (key hx) (key hy) + +omit [T2Space Y] in +/-- The first shape: one closed disc. Its boundary may run through a pasted disc. -/ +theorem outer_shape1 (hS : IsSurface S) (cap : IsCappedSurface S Shat) (hY : IsSurface Y) + (hψ : IsCutMap ψ K.U) {Δ : Set Shat} + (hΔ : IsClosedDisc Δ) (hf : IsCutFormOf cap K (discBd Δ)) {Θ₁ Θ₂ : Set S} (h₁ : Θ₁ ∈ cuffs S) + (h₂ : Θ₂ ∈ cuffs S) (hne : Θ₁ ≠ Θ₂) + (m₁ : (cap.cuffDisc Θ₁ ∩ Δ).Nonempty) (m₂ : (cap.cuffDisc Θ₂ ∩ Δ).Nonempty) : + IsOuterFragment cap ψ (cap.emb ⁻¹' (discInt Δ)ᶜ) := by + rcases hf with ⟨hF, -, hsing⟩ | ⟨s, t, Θ, hΘ, hst, hs, ht, hKb, hl, hsub, hrest⟩ + · have hr : discBd Δ ⊆ range cap.emb := hF.le.trans (image_subset_range _ _) + refine outer_disc hS cap hY hψ hΔ hr hF.ge (hF.le.trans subset_union_right) ?_ h₁ h₂ hne + (cap.subset_of_meet hΔ hr h₁ m₁) (cap.subset_of_meet hΔ hr h₂ m₂) + rintro Θ' hΘ' - x ⟨hxE, hx⟩ y ⟨hyE, hy⟩ + rw [hF] at hx hy + obtain ⟨a, ha, rfl⟩ := hx + obtain ⟨b, hb, rfl⟩ := hy + rw [hsing ⟨ha, cap.bd_of_mem hΘ' hxE⟩ ⟨hb, cap.bd_of_mem hΘ' hyE⟩] + · obtain ⟨-, Δ₂, -, hd₂, -, hK₂, -, hr₂, -, hs₂, -, hE₂, hΔΔ₂, -, hpre⟩ := + exists_form_discs cap hΔ hΘ hst hs ht hKb hl hsub hrest + have hres := outer_disc (ψ := ψ) hS cap hY hψ hd₂ hr₂ hK₂ (fun x hx ↦ ?_) ?_ h₁ h₂ hne + (cap.subset_of_meet hd₂ hr₂ h₁ (m₁.mono (inter_subset_inter_right _ hΔΔ₂))) + (cap.subset_of_meet hd₂ hr₂ h₂ (m₂.mono (inter_subset_inter_right _ hΔΔ₂))) + · rwa [preimage_compl, hpre, ← preimage_compl] at hres + · rcases hs₂ hx with h | ⟨z, hz, rfl⟩ + · exact Or.inr h + · exact Or.inl (mem_biUnion hΘ (cap.mem_closure_emb hΘ hz)) + · rintro Θ' hΘ' hn x ⟨hxE, hx⟩ + exfalso + have hne' : Θ' ≠ Θ := fun he ↦ hn (he ▸ hE₂) + rcases hs₂ hx with ⟨z, hz, rfl⟩ | ⟨z, hz, rfl⟩ + · have hzΘ := cap.mem_of_emb_mem hΘ' hxE + have hzb : z ∈ K.U ∩ bd S := ⟨hz, cuff_subset_bd ⟨Θ', hΘ'⟩ hzΘ⟩ + rw [hKb] at hzb + rcases hzb with rfl | h' + · exact hne' (cuffs_eq_of_mem hΘ' hΘ hzΘ hs) + · exact hne' (cuffs_eq_of_mem hΘ' hΘ hzΘ (mem_singleton_iff.1 h' ▸ ht)) + · exact hne' (cuffs_eq_of_mem hΘ' hΘ (cap.mem_of_emb_mem hΘ' hxE) hz) + +omit [T2Space Shat] in +omit [T2Space S] in +theorem IsCappedSurface.preimage_compl_discInt (cap : IsCappedSurface S Shat) {Θ + : Set S} (hΘ : Θ ∈ cuffs S) + (G : Set Shat) : cap.emb ⁻¹' (G ∪ discInt (closure (cap.cuffDisc Θ)))ᶜ = cap.emb ⁻¹' Gᶜ := by + ext z + simp only [mem_preimage, mem_compl_iff, mem_union, not_or] + rw [← cap.cuffDisc_eq_discInt hΘ] + exact ⟨fun h ↦ h.1, fun h ↦ ⟨h, fun h' ↦ cap.notMem_range hΘ h' (mem_range_self z)⟩⟩ + +theorem isPreconnected_of_line {T : Type} [TopologicalSpace T] {L : Set T} {a b : T} + (hl : IsLineWithEnds L a b) : IsPreconnected L := + GraphMinor.Surface.IsLineWithEnds.isPreconnected hl + +theorem ends_of_line {T : Type} [TopologicalSpace T] {L : Set T} {a b : T} + (hl : IsLineWithEnds L a b) : a ∈ L ∧ b ∈ L ∧ a ≠ b := by + obtain ⟨f, h0, h1⟩ := hl + refine ⟨h0 ▸ (f 0).2, h1 ▸ (f 1).2, fun h ↦ ?_⟩ + have : (0 : unitInterval) = 1 := f.injective (Subtype.ext (h0.trans (h.trans h1.symm))) + exact zero_ne_one this + +omit [T2Space Y] in +/-- The second shape: a path from a cuff to a circuit. The cell is the pasted disc, the path, and +the disc of the circuit. -/ +theorem outer_shape2 (hS : IsSurface S) (cap : IsCappedSurface S Shat) (hY : IsSurface Y) + (hψ : IsCutMap ψ K.U) {Δ : Set Shat} + {L : Set S} {s u : S} {Θ Θ' : Set S} (hΔ : IsClosedDisc Δ) (hr : discBd Δ ⊆ range cap.emb) + (hΘ : Θ ∈ cuffs S) (hΘ' : Θ' ∈ cuffs S) + (hne : Θ ≠ Θ') (hs : s ∈ Θ) (hL : (L = {u} ∧ s = u) ∨ IsLineWithEnds L s u) + (hK : cap.emb '' K.U = discBd Δ ∪ cap.emb '' L) + (hLΔ : cap.emb '' L ∩ Δ = {cap.emb u}) (hLb : L ∩ bd S ⊆ {s}) (hbd : discBd Δ ∩ cap.emb '' bd S + ⊆ {cap.emb u}) + (hdj : Disjoint (cap.cuffDisc Θ) Δ) (hmeet : (cap.cuffDisc Θ' ∩ Δ).Nonempty) : + IsOuterFragment cap ψ (cap.emb ⁻¹' (discInt Δ)ᶜ) := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + set E := closure (cap.cuffDisc Θ) with hEdef + have hE : IsClosedDisc E := cap.cuffDisc_closedDisc Θ hΘ + have hbE : discBd E = cap.emb '' Θ := cap.cuffDisc_bd Θ hΘ + have hnot : ¬ E ⊆ Δ := by + obtain ⟨x, hx⟩ := hE.nonempty_discInt + rw [← cap.cuffDisc_eq_discInt hΘ] at hx + exact fun h ↦ disjoint_left.1 hdj hx (h (subset_closure hx)) + have hEi : Disjoint E (discInt Δ) := (cap.side hΔ hr hΘ).resolve_left hnot + have hbdmem : ∀ {Θ₂}, Θ₂ ∈ cuffs S → Disjoint (closure (cap.cuffDisc Θ₂)) (discInt Δ) → + ∀ {x}, x ∈ closure (cap.cuffDisc Θ₂) → x ∈ Δ → x = cap.emb u := by + intro Θ₂ h₂ hd x hxE hxD + have hb : x ∈ discBd Δ := by + by_contra hb + exact disjoint_left.1 hd hxE ⟨hxD, hb⟩ + obtain ⟨z, rfl⟩ := hr hb + exact hbd ⟨hb, mem_image_of_mem _ (cap.bd_of_mem h₂ hxE)⟩ + have hEΔ : ∀ {x}, x ∈ E → x ∈ Δ → x = cap.emb u := fun h h' ↦ hbdmem hΘ hEi h h' + have hLs : ∀ {Θ₂}, Θ₂ ∈ cuffs S → ∀ {z}, z ∈ L → cap.emb z ∈ closure (cap.cuffDisc Θ₂) → z = s + := by + intro Θ₂ h₂ z hz hzE + exact hLb ⟨hz, cap.bd_of_mem h₂ hzE⟩ + have huL : cap.emb u ∈ cap.emb '' L ∩ Δ := by rw [hLΔ]; rfl + have hE'Δ : closure (cap.cuffDisc Θ') ⊆ Δ := cap.subset_of_meet hΔ hr hΘ' hmeet + have hmO : ∀ Θ₂ ∈ cuffs S, Θ₂ ≠ Θ → ¬ closure (cap.cuffDisc Θ₂) ⊆ Δ → ∀ {x}, x ∈ closure + (cap.cuffDisc Θ₂) → + (x ∈ Δ ∨ x ∈ cap.emb '' L) → x = cap.emb u := by + rintro Θ₂ h₂ hn₂ hn x hx (h | ⟨z, hz, rfl⟩) + · exact hbdmem h₂ ((cap.side hΔ hr h₂).resolve_left hn) hx h + · have hzs := hLs h₂ hz hx + subst hzs + exact absurd (cuffs_eq_of_mem h₂ hΘ (cap.mem_of_emb_mem h₂ hx) hs) hn₂ + have hEd : ∀ Θ₂ ∈ cuffs S, Θ₂ ≠ Θ → Disjoint (closure (cap.cuffDisc Θ₂)) E + := fun Θ₂ h₂ hn ↦ cap.cuffDisc_disjoint Θ₂ h₂ Θ hΘ hn + have hrestK : ∀ {x}, x ∈ discBd Δ ∨ x ∈ cap.emb '' L ∨ x ∈ E → x ∈ cap.discs ∪ cap.emb '' K.U + := by + rintro x (h | h | h) + · exact Or.inr (hK ▸ Or.inl h) + · exact Or.inr (hK ▸ Or.inr h) + · exact Or.inl (mem_biUnion hΘ h) + rcases hL with ⟨rfl, rfl⟩ | hl + · have hsE : cap.emb s ∈ E := cap.mem_closure_emb hΘ hs + have hsimp : cap.emb '' {s} = {cap.emb s} := image_singleton + have ht : Δ ∩ E = {cap.emb s} := by + ext x + constructor + · rintro ⟨h, h'⟩ + exact hEΔ h' h + · rintro rfl + exact ⟨huL.2, hsE⟩ + have hres := exists_outer_fragment (ψ := ψ) (Z := Δ ∪ E) (G := discInt Δ ∪ discInt E) hS cap hY + hψ + (hΔ.isClosed.union hE.isClosed) ((hΔ.isOpen_discInt hman).union (hE.isOpen_discInt hman)) + (union_subset_union (discInt_subset Δ) (discInt_subset E)) (fun c hc ↦ isCell_touch_image hT + hΔ hE ht c hc) + (by + rw [hK] + rintro x (h | h) + · exact Or.inl (Surface.discBd_subset _ h) + · rw [hsimp] at h + exact Or.inl (mem_singleton_iff.1 h ▸ huL.2)) + (by + rintro x ⟨h | h, hn⟩ + · exact hrestK (Or.inl (by + by_contra hb + exact hn (Or.inl ⟨h, hb⟩))) + · exact hrestK (Or.inr (Or.inr h))) + (frontier_touch hT hΔ hE ht) + (by + intro Θ₂ h₂ hn x hx y hy + have hn₂ : Θ₂ ≠ Θ := fun he ↦ hn (he ▸ subset_union_right) + have hn₃ : ¬ closure (cap.cuffDisc Θ₂) ⊆ Δ := fun h ↦ hn (h.trans subset_union_left) + have key : ∀ {x}, x ∈ closure (cap.cuffDisc Θ₂) ∩ (Δ ∪ E) → x = cap.emb s := by + rintro x ⟨hxE, h | h⟩ + · exact hmO Θ₂ h₂ hn₂ hn₃ hxE (Or.inl h) + · exact absurd h (disjoint_left.1 (hEd Θ₂ h₂ hn₂) hxE) + rw [key hx, key hy]) + hΘ hΘ' hne subset_union_right (hE'Δ.trans subset_union_left) + rwa [cap.preimage_compl_discInt hΘ] at hres + · obtain ⟨hsL, huL', hsu⟩ := ends_of_line hl + have hline := hl.map_of_embedding cap.isEmbedding + have hLE : cap.emb '' L ∩ E = {cap.emb s} := by + ext x + constructor + · rintro ⟨⟨z, hz, rfl⟩, h⟩ + rw [hLs hΘ hz h] + rfl + · rintro rfl + exact ⟨mem_image_of_mem _ hsL, cap.mem_closure_emb hΘ hs⟩ + have hdE : Disjoint E Δ := disjoint_left.2 fun x hx hxΔ ↦ by + have hxu := hEΔ hx hxΔ + have : cap.emb u ∈ cap.emb '' L ∩ E := ⟨huL.1, hxu ▸ hx⟩ + rw [hLE] at this + exact hsu (cap.isEmbedding.injective this).symm + have hsE : cap.emb s ∈ discBd E := by + rw [hbE] + exact mem_image_of_mem _ hs + have huB : cap.emb u ∈ discBd Δ := mem_discBd_of_cross hT hΔ (isPreconnected_of_line hline) + (mem_image_of_mem _ hsL) + (disjoint_left.1 hdE (Surface.discBd_subset _ hsE)) huL.1 hLΔ + have hres := exists_outer_fragment (ψ := ψ) (Z := E ∪ cap.emb '' L ∪ Δ) (G + := discInt E ∪ discInt Δ) hS cap hY hψ + ((hE.isClosed.union (isClosed_of_cuffLine hline)).union hΔ.isClosed) + ((hE.isOpen_discInt hman).union (hΔ.isOpen_discInt hman)) + (union_subset_union (discInt_subset E |>.trans subset_union_left) (discInt_subset Δ)) + (fun c hc ↦ isCell_bridge_image hT hE hΔ hdE hsE huB hline hLE hLΔ c hc) + (by + rw [hK] + rintro x (h | h) + · exact Or.inr (Surface.discBd_subset _ h) + · exact Or.inl (Or.inr h)) + (by + rintro x ⟨(h | h) | h, hn⟩ + · exact hrestK (Or.inr (Or.inr h)) + · exact hrestK (Or.inr (Or.inl h)) + · exact hrestK (Or.inl (by + by_contra hb + exact hn (Or.inr ⟨h, hb⟩)))) + (frontier_bridge hT hE hΔ hdE hsE huB hline hLE hLΔ) + (by + intro Θ₂ h₂ hn x hx y hy + have hn₂ : Θ₂ ≠ Θ := fun he ↦ hn (he ▸ subset_union_left.trans subset_union_left) + have hn₃ : ¬ closure (cap.cuffDisc Θ₂) ⊆ Δ := fun h ↦ hn (h.trans subset_union_right) + have key : ∀ {x}, x ∈ closure (cap.cuffDisc Θ₂) ∩ (E ∪ cap.emb '' L ∪ Δ) → x = cap.emb u + := by + rintro x ⟨hxE, (h | h) | h⟩ + · exact absurd h (disjoint_left.1 (hEd Θ₂ h₂ hn₂) hxE) + · exact hmO Θ₂ h₂ hn₂ hn₃ hxE (Or.inr h) + · exact hmO Θ₂ h₂ hn₂ hn₃ hxE (Or.inl h) + rw [key hx, key hy]) + hΘ hΘ' hne (subset_union_left.trans subset_union_left) (hE'Δ.trans subset_union_right) + rwa [union_comm, cap.preimage_compl_discInt hΘ] at hres + +omit [T2Space Y] in +/-- The third shape: two circuits with a path between them. The cell is the two discs and the path. +-/ +theorem outer_shape3 (hS : IsSurface S) (cap : IsCappedSurface S Shat) (hY : IsSurface Y) + (hψ : IsCutMap ψ K.U) {Δ₁ Δ₂ : Set Shat} + {L : Set S} {a b : S} {Θ₁ Θ₂ : Set S} (hΔ₁ : IsClosedDisc Δ₁) (hΔ₂ : IsClosedDisc Δ₂) + (hr₁ : discBd Δ₁ ⊆ range cap.emb) + (hr₂ : discBd Δ₂ ⊆ range cap.emb) (hL : (L = {a} ∧ a = b) ∨ IsLineWithEnds L a b) + (hK : cap.emb '' K.U = discBd Δ₁ ∪ discBd Δ₂ ∪ cap.emb '' L) (hL₁ : cap.emb '' L ∩ Δ₁ + = {cap.emb a}) + (hL₂ : cap.emb '' L ∩ Δ₂ = {cap.emb b}) (hdb : Disjoint (cap.emb '' bd S) + (discBd Δ₁ ∪ cap.emb '' L)) + (hsing : (discBd Δ₂ ∩ cap.emb '' bd S).Subsingleton) (hmeet : Δ₁ ∩ Δ₂ ⊆ {cap.emb a}) + (h₁ : Θ₁ ∈ cuffs S) (h₂ : Θ₂ ∈ cuffs S) + (hne : Θ₁ ≠ Θ₂) (m₁ : (cap.cuffDisc Θ₁ ∩ Δ₁).Nonempty) (m₂ : (cap.cuffDisc Θ₂ ∩ Δ₂).Nonempty) : + IsOuterFragment cap ψ (cap.emb ⁻¹' (discInt Δ₁ ∪ discInt Δ₂)ᶜ) := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have hE₁ := cap.subset_of_meet hΔ₁ hr₁ h₁ m₁ + have hE₂ := cap.subset_of_meet hΔ₂ hr₂ h₂ m₂ + have hG : IsOpen (discInt Δ₁ ∪ discInt Δ₂) := (hΔ₁.isOpen_discInt hman).union + (hΔ₂.isOpen_discInt hman) + have haL : cap.emb a ∈ cap.emb '' L ∩ Δ₁ := by rw [hL₁]; rfl + have hbL : cap.emb b ∈ cap.emb '' L ∩ Δ₂ := by rw [hL₂]; rfl + have hbound : ∀ {D}, IsClosedDisc D → (D = Δ₁ ∨ D = Δ₂) → ∀ {Θ}, Θ ∈ cuffs S → ¬ closure + (cap.cuffDisc Θ) ⊆ D → ∀ {x}, + x ∈ closure (cap.cuffDisc Θ) → x ∈ D → x ∈ discBd D := by + rintro D hD hc Θ hΘ hn x hx hxD + have hr : discBd D ⊆ range cap.emb := by + rcases hc with rfl | rfl + · exact hr₁ + · exact hr₂ + by_contra hb + exact disjoint_left.1 ((cap.side hD hr hΘ).resolve_left hn) hx ⟨hxD, hb⟩ + have hEb : ∀ {Θ}, Θ ∈ cuffs S → ∀ {z}, cap.emb z ∈ closure (cap.cuffDisc Θ) + → cap.emb z ∈ cap.emb '' bd S := fun hΘ _ hz ↦ + mem_image_of_mem _ (cap.bd_of_mem hΘ hz) + have hrange : ∀ {D}, (D = Δ₁ ∨ D = Δ₂) → discBd D ⊆ range cap.emb := by + rintro D (rfl | rfl) + · exact hr₁ + · exact hr₂ + have hm₃ : ∀ {Θ}, Θ ∈ cuffs S → ¬ closure (cap.cuffDisc Θ) ⊆ Δ₁ → ¬ closure (cap.cuffDisc Θ) ⊆ Δ₂ + → ∀ {x}, + x ∈ closure (cap.cuffDisc Θ) → x ∈ Δ₁ ∪ cap.emb '' L ∪ Δ₂ → x ∈ discBd Δ₂ ∩ cap.emb '' bd S + := by + rintro Θ hΘ hn₁ hn₂ x hx ((h | h) | h) + · exfalso + have hb := hbound hΔ₁ (Or.inl rfl) hΘ hn₁ hx h + obtain ⟨z, rfl⟩ := hr₁ hb + exact disjoint_left.1 hdb (hEb hΘ hx) (Or.inl hb) + · exfalso + obtain ⟨z, hz, rfl⟩ := h + exact disjoint_left.1 hdb (hEb hΘ hx) (Or.inr (mem_image_of_mem _ hz)) + · have hb := hbound hΔ₂ (Or.inr rfl) hΘ hn₂ hx h + obtain ⟨z, rfl⟩ := hr₂ hb + exact ⟨hb, hEb hΘ hx⟩ + rcases hL with ⟨rfl, rfl⟩ | hl + · have hsimp : cap.emb '' {a} = {cap.emb a} := image_singleton + have ht : Δ₁ ∩ Δ₂ = {cap.emb a} := by + refine Subset.antisymm hmeet ?_ + rintro _ rfl + exact ⟨haL.2, hbL.2⟩ + exact exists_outer_fragment (ψ := ψ) (Z := Δ₁ ∪ Δ₂) hS cap hY hψ (hΔ₁.isClosed.union + hΔ₂.isClosed) hG + (union_subset_union (discInt_subset Δ₁) (discInt_subset Δ₂)) (fun c hc ↦ isCell_touch_image + hT hΔ₁ hΔ₂ ht c hc) + (by + rw [hK] + rintro x ((h | h) | h) + · exact Or.inl (Surface.discBd_subset _ h) + · exact Or.inr (Surface.discBd_subset _ h) + · rw [hsimp] at h + exact Or.inl (mem_singleton_iff.1 h ▸ haL.2)) + (by + rintro x ⟨h | h, hn⟩ + · refine Or.inr (hK ▸ Or.inl (Or.inl ?_)) + by_contra hb + exact hn (Or.inl ⟨h, hb⟩) + · refine Or.inr (hK ▸ Or.inl (Or.inr ?_)) + by_contra hb + exact hn (Or.inr ⟨h, hb⟩)) + (frontier_touch hT hΔ₁ hΔ₂ ht) + (by + intro Θ hΘ hn x hx y hy + have hn₁ : ¬ closure (cap.cuffDisc Θ) ⊆ Δ₁ := fun h ↦ hn (h.trans subset_union_left) + have hn₂ : ¬ closure (cap.cuffDisc Θ) ⊆ Δ₂ := fun h ↦ hn (h.trans subset_union_right) + have key : ∀ {x}, x ∈ closure (cap.cuffDisc Θ) ∩ (Δ₁ ∪ Δ₂) → x ∈ discBd Δ₂ ∩ cap.emb '' bd + S := by + rintro x ⟨hxE, h | h⟩ + · exact hm₃ hΘ hn₁ hn₂ hxE (Or.inl (Or.inl h)) + · exact hm₃ hΘ hn₁ hn₂ hxE (Or.inr h) + exact hsing (key hx) (key hy)) + h₁ h₂ hne (hE₁.trans subset_union_left) (hE₂.trans subset_union_right) + · obtain ⟨haL', hbL', hab⟩ := ends_of_line hl + have hline := hl.map_of_embedding cap.isEmbedding + have hb₁ : cap.emb b ∉ Δ₁ := fun h ↦ by + have : cap.emb b ∈ cap.emb '' L ∩ Δ₁ := ⟨hbL.1, h⟩ + rw [hL₁] at this + exact hab (cap.isEmbedding.injective this).symm + have ha₂ : cap.emb a ∉ Δ₂ := fun h ↦ by + have : cap.emb a ∈ cap.emb '' L ∩ Δ₂ := ⟨haL.1, h⟩ + rw [hL₂] at this + exact hab (cap.isEmbedding.injective this) + have hd : Disjoint Δ₁ Δ₂ := disjoint_left.2 fun x hx hx' ↦ by + have hxa := hmeet ⟨hx, hx'⟩ + exact ha₂ (mem_singleton_iff.1 hxa ▸ hx') + have ha : cap.emb a ∈ discBd Δ₁ := mem_discBd_of_cross hT hΔ₁ (isPreconnected_of_line hline) + hbL.1 hb₁ haL.1 hL₁ + have hb : cap.emb b ∈ discBd Δ₂ := mem_discBd_of_cross hT hΔ₂ (isPreconnected_of_line hline) + haL.1 ha₂ hbL.1 hL₂ + exact exists_outer_fragment (ψ := ψ) (Z := Δ₁ ∪ cap.emb '' L ∪ Δ₂) hS cap hY hψ + ((hΔ₁.isClosed.union (isClosed_of_cuffLine hline)).union hΔ₂.isClosed) hG + (union_subset_union ((discInt_subset Δ₁).trans subset_union_left) (discInt_subset Δ₂)) + (fun c hc ↦ isCell_bridge_image hT hΔ₁ hΔ₂ hd ha hb hline hL₁ hL₂ c hc) + (by + rw [hK] + rintro x ((h | h) | h) + · exact Or.inl (Or.inl (Surface.discBd_subset _ h)) + · exact Or.inr (Surface.discBd_subset _ h) + · exact Or.inl (Or.inr h)) + (by + rintro x ⟨(h | h) | h, hn⟩ + · refine Or.inr (hK ▸ Or.inl (Or.inl ?_)) + by_contra hb' + exact hn (Or.inl ⟨h, hb'⟩) + · exact Or.inr (hK ▸ Or.inr h) + · refine Or.inr (hK ▸ Or.inl (Or.inr ?_)) + by_contra hb' + exact hn (Or.inr ⟨h, hb'⟩)) + (frontier_bridge hT hΔ₁ hΔ₂ hd ha hb hline hL₁ hL₂) + (by + intro Θ hΘ hn x hx y hy + have hn₁ : ¬ closure (cap.cuffDisc Θ) ⊆ Δ₁ := fun h ↦ hn (h.trans + (subset_union_left.trans subset_union_left)) + have hn₂ : ¬ closure (cap.cuffDisc Θ) ⊆ Δ₂ := fun h ↦ hn (h.trans subset_union_right) + exact hsing (hm₃ hΘ hn₁ hn₂ hx.1 hx.2) (hm₃ hΘ hn₁ hn₂ hy.1 hy.2)) + h₁ h₂ hne (hE₁.trans (subset_union_left.trans subset_union_left)) + (hE₂.trans subset_union_right) + +omit [T2Space Y] in +/-- The fragment of the proof of (10.4), for each shape of a distance flaw. -/ +theorem outer_shape (hS : IsSurface S) (cap : IsCappedSurface S Shat) (hY : IsSurface Y) + (hψ : IsCutMap ψ K.U) {𝓓 : Set (Set Shat)} + (h : IsOuterShape cap K 𝓓) : IsOuterFragment cap ψ (⋂ Δ ∈ 𝓓, cap.emb ⁻¹' closure Δᶜ) := by + have hT := cap.isClosedSurface + rcases h with ⟨Δ, rfl, hΔ, hf, Θ₁, h₁, Θ₂, h₂, hne, m₁, m₂⟩ | ⟨Δ, L, s, u, Θ, Θ', rfl, hΔ, hr, + hΘ, hΘ', hne, hs, hL, hK, hLΔ, hLb, hbd, + hdj, hmeet⟩ | ⟨Δ₁, Δ₂, L, a, b, Θ₁, Θ₂, rfl, -, hΔ₁, hΔ₂, hr₁, hr₂, hL, hK, hL₁, hL₂, hdb, + hsing, hmeet, h₁, h₂, hne, m₁, m₂⟩ + · simp only [mem_singleton_iff, iInter_iInter_eq_left] + rw [closure_compl_disc hT hΔ] + exact outer_shape1 hS cap hY hψ hΔ hf h₁ h₂ hne m₁ m₂ + · simp only [mem_singleton_iff, iInter_iInter_eq_left] + rw [closure_compl_disc hT hΔ] + exact outer_shape2 hS cap hY hψ hΔ hr hΘ hΘ' hne hs hL hK hLΔ hLb hbd hdj hmeet + · have := outer_shape3 (ψ := ψ) hS cap hY hψ hΔ₁ hΔ₂ hr₁ hr₂ hL hK hL₁ hL₂ hdb + hsing hmeet h₁ h₂ hne m₁ m₂ + have he : (⋂ Δ ∈ ({Δ₁, Δ₂} : Set (Set Shat)), cap.emb ⁻¹' closure Δᶜ) = cap.emb ⁻¹' + (discInt Δ₁ ∪ discInt Δ₂)ᶜ := by + simp only [mem_insert_iff, mem_singleton_iff, iInter_iInter_eq_or_left, iInter_iInter_eq_left] + rw [closure_compl_disc hT hΔ₁, closure_compl_disc hT hΔ₂, compl_union, preimage_inter] + rwa [he] + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FragmentSides.lean b/LeanPool/GraphMinor/GM19/FragmentSides.lean new file mode 100644 index 0000000000..652217eccd --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FragmentSides.lean @@ -0,0 +1,348 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FragmentRegion +public import LeanPool.GraphMinor.GM19.RadialExists +public import LeanPool.GraphMinor.GM11.PerimeterPull +public import LeanPool.GraphMinor.GM11.GlueDiscs +public import LeanPool.GraphMinor.Surface.PushOff + +/-! +# The inside of a disc of a capped surface + +Let `D` be a closed disc of a capped surface, and take the region of `D` off the pasted discs in +`D`. We identify the boundary of `D` +to one point, and get a sphere in which the pasted discs are closed discs. So the region is a sphere +without a finite set +(`exists_inner_region`). This gives the fragment inside `D` (`exists_inner_fragment`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric Filter GraphMinor.Surface GraphMinor.GM11 OnePoint + +/-- The sphere is the model `Σ(0, 0, 0)`. -/ +theorem nonempty_homeomorph_of_isSphere {T : Type} [TopologicalSpace T] (h : IsSphere T) : Nonempty + (T ≃ₜ SurfaceModel 0 0 0) := by + obtain ⟨e⟩ := h + let f : OnePoint EuclideanPlane → SurfaceModel 0 0 0 := fun x ↦ Quot.mk _ ⟨x, fun i hi ↦ absurd + hi (Nat.not_lt_zero i)⟩ + let g : SurfaceModel 0 0 0 → OnePoint EuclideanPlane := Quot.lift (fun p ↦ p.1) (fun p q hr ↦ by + cases hr with + | handle i hi => exact absurd hi (Nat.not_lt_zero i) + | crosscap i hi => exact absurd hi (Nat.not_lt_zero i)) + have hfc : Continuous f := continuous_quot_mk.comp (Continuous.subtype_mk continuous_id _) + have hgc : Continuous g := continuous_quot_lift _ continuous_subtype_val + exact ⟨e.trans ⟨⟨f, g, fun x ↦ rfl, fun x ↦ by + induction x using Quot.ind with + | mk p => rfl⟩, hfc, hgc⟩⟩ + +section Inner + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +theorem isCell_point [Nonempty T] (hT : IsClosedSurface T) (p : T) : IsCell T {p} := by + obtain ⟨e, hs, ht, -⟩ := GM19.exists_oph (f := id) (s := {p}ᶜ) (t := {p}ᶜ) isOpen_compl_singleton + continuous_id.continuousOn + (injOn_id _) (fun u _ hu ↦ by simpa using hu) (by simp) + exact ⟨T, _, e, {p}, hT, ⟨.refl T⟩, finite_singleton _, by simp, hs, ht⟩ + +/-- The inside of a closed disc of a closed surface, without finitely many disjoint closed discs in +the disc that touch the +boundary in at most one point, is a sphere without a finite set. -/ +theorem exists_inner_region (hT : IsClosedSurface T) {D : Set T} (hD : IsClosedDisc D) {𝓘 : Set + (Set T)} (hf : 𝓘.Finite) + (hd : ∀ E ∈ 𝓘, IsClosedDisc E) (hp : 𝓘.PairwiseDisjoint id) (hsub : ∀ E ∈ 𝓘, E ⊆ D) (ht : + (⋃₀ 𝓘 ∩ discBd D).Subsingleton) : + ∃ (T' : Type) (_ : TopologicalSpace T') (e : OpenPartialHomeomorph T T') + (P : Set T'), IsClosedSurface T' ∧ + ConnectedSpace T' ∧ Nonempty (T' ≃ₜ SurfaceModel 0 0 0) ∧ P.Finite ∧ e.source + = discInt D \ ⋃₀ 𝓘 ∧ e.target = Pᶜ := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have : CompactSpace T := hT.1 + set A := discInt D with hA + have hAo : IsOpen A := hD.isOpen_discInt hman + have hsph : IsSphere (OnePoint A) := isSphere_onePoint (isOpenDisc_discInt hman hD) + have hT₀ := (IsSphere.isClosedSurface hsph).1 + have : T2Space (OnePoint A) := hT₀.2.1 + have hrc : Continuous (collapse A) := continuous_collapse hAo + have hrinj : ∀ {x y}, x ∈ A → y ∈ A → collapse A x = collapse A y → x = y := fun hx hy he ↦ by + rw [collapse_of_mem hx, collapse_of_mem hy] at he + exact congrArg Subtype.val (OnePoint.coe_injective he) + have hrne : ∀ {x y}, x ∈ A → y ∉ A → collapse A x ≠ collapse A y := fun hx hy he ↦ by + rw [collapse_of_mem hx, collapse_of_notMem hy] at he + exact OnePoint.coe_ne_infty _ he + have hoff : ∀ {x E}, E ∈ 𝓘 → x ∈ E → x ∉ A → x ∈ ⋃₀ 𝓘 ∩ discBd D := fun {x E} hE hx hxA ↦ by + refine ⟨⟨E, hE, hx⟩, ?_⟩ + by_contra hn + exact hxA ⟨hsub E hE hx, hn⟩ + have hinjE : ∀ E ∈ 𝓘, InjOn (collapse A) E := fun E hE x hx y hy he ↦ by + by_cases hxA : x ∈ A <;> by_cases hyA : y ∈ A + · exact hrinj hxA hyA he + · exact absurd he (hrne hxA hyA) + · exact absurd he.symm (hrne hyA hxA) + · exact ht (hoff hE hx hxA) (hoff hE hy hyA) + let 𝓐 : Set (Set (OnePoint A)) := (fun E ↦ collapse A '' E) '' 𝓘 + have hdA : ∀ E ∈ 𝓐, IsClosedDisc E := by + rintro _ ⟨E, hE, rfl⟩ + exact (isClosedDisc_image_injOn (hd E hE) hrc.continuousOn (hinjE E hE)).1 + have hpA : 𝓐.PairwiseDisjoint id := by + rintro _ ⟨E₁, h₁, rfl⟩ _ ⟨E₂, h₂, rfl⟩ hn + have hne : E₁ ≠ E₂ := fun h ↦ hn (h ▸ rfl) + refine disjoint_left.2 ?_ + rintro _ ⟨x, hx, rfl⟩ ⟨y, hy, he⟩ + by_cases hxA : x ∈ A <;> by_cases hyA : y ∈ A + · have : y = x := hrinj hyA hxA he + exact disjoint_left.1 (hp h₁ h₂ hne) hx (this ▸ hy) + · exact hrne hxA hyA he.symm + · exact hrne hyA hxA he + · have : x = y := ht (hoff h₁ hx hxA) (hoff h₂ hy hyA) + exact disjoint_left.1 (hp h₁ h₂ hne) hx (this ▸ hy) + have : Nonempty (OnePoint A) := ⟨∞⟩ + obtain ⟨T', tT', e₁, P, hT', ⟨hom⟩, hP, -, hs₁, ht₁⟩ := exists_cell_region hT₀ (Y := {∞}) + (fun c _ ↦ by rw [image_singleton]; exact isCell_point hT₀ _) (hf.image _) hdA hpA + (fun E _ ↦ subsingleton_of_subset_singleton inter_subset_right) + obtain ⟨hsn⟩ := nonempty_homeomorph_of_isSphere hsph + have : Nonempty T := by + obtain ⟨z, hz⟩ := hD.nonempty_discInt + exact ⟨z⟩ + have him : ∀ u ⊆ A, collapse A '' u = (fun a : A ↦ (a : OnePoint A)) '' (Subtype.val ⁻¹' u) + := fun u hu ↦ by + apply Subset.antisymm + · rintro _ ⟨x, hx, rfl⟩ + exact ⟨⟨x, hu hx⟩, hx, (collapse_of_mem (hu hx)).symm⟩ + · rintro _ ⟨a, ha, rfl⟩ + exact ⟨a.1, ha, collapse_of_mem a.2⟩ + have ho : ∀ u ⊆ A, IsOpen u → IsOpen (collapse A '' u) := fun u hu huo ↦ by + rw [him u hu] + exact OnePoint.isOpenEmbedding_coe.isOpenMap _ (huo.preimage continuous_subtype_val) + have himg : collapse A '' A = {∞}ᶜ := by + rw [him A Subset.rfl] + ext z + induction z using OnePoint.rec with + | infty => simp + | coe a => simp + obtain ⟨e₀, hs₀, ht₀, heq⟩ := GM19.exists_oph hAo hrc.continuousOn (fun x hx y hy he ↦ hrinj hx + hy he) ho himg + · have := (IsSphere.isClosedSurface hsph).2 + refine ⟨T', tT', e₀.trans e₁, P, hT', hom.symm.surjective.connectedSpace hom.symm.continuous, + ⟨hom.trans hsn⟩, hP, ?_, ?_⟩ + · ext x + rw [e₀.trans_source, hs₀, hs₁] + simp only [mem_inter_iff, mem_preimage, mem_compl_iff, mem_union, mem_singleton_iff, + not_or, Set.mem_sdiff] + constructor + · rintro ⟨hx, -, hn⟩ + refine ⟨hx, ?_⟩ + rintro ⟨E, hE, hxE⟩ + refine hn ⟨_, ⟨E, hE, rfl⟩, ?_⟩ + rw [heq hx] + exact mem_image_of_mem _ hxE + · rintro ⟨hx, hn⟩ + refine ⟨hx, ?_, ?_⟩ + · rw [heq hx, collapse_of_mem hx] + exact OnePoint.coe_ne_infty _ + · rintro ⟨_, ⟨E, hE, rfl⟩, ⟨y, hy, he⟩⟩ + rw [heq hx] at he + by_cases hyA : y ∈ A + · exact hn ⟨E, hE, hrinj hyA hx he ▸ hy⟩ + · exact hrne hx hyA he.symm + · ext z + rw [e₀.trans_target, ht₁, ht₀] + simp only [mem_inter_iff, mem_preimage, mem_compl_iff, mem_singleton_iff] + constructor + · exact fun h ↦ h.1 + · intro hz + refine ⟨hz, fun hi ↦ ?_⟩ + have hzt : z ∈ e₁.target := by rw [ht₁]; exact hz + have := e₁.map_target hzt + rw [hs₁] at this + exact this (Or.inl hi) + +/-- A point of an `O`-arc is a limit of the other points of the arc. -/ +theorem mem_closure_oArc_sdiff {F : Set T} (hF : IsOArc F) {y : T} (hy : y ∈ F) : y ∈ closure + (F \ {y}) := by + obtain ⟨φ⟩ := hF + have : ConnectedSpace F := φ.surjective.connectedSpace φ.continuous + have : Nontrivial Circle := ⟨1, Circle.exp Real.pi, fun h ↦ by + have := congrArg (fun z : Circle ↦ (z : ℂ)) h + simp at this + norm_num at this⟩ + have : Nontrivial F := φ.injective.nontrivial + have hne : (𝓝[≠] (⟨y, hy⟩ : F)).NeBot := + ConnectedSpace.neBot_nhdsWithin_compl_of_nontrivial_of_t1space _ + have hcl : (⟨y, hy⟩ : F) ∈ closure ({⟨y, hy⟩}ᶜ : Set F) := mem_closure_iff_nhdsWithin_neBot.2 hne + have := image_closure_subset_closure_image continuous_subtype_val (mem_image_of_mem _ hcl) + refine closure_mono ?_ this + rintro _ ⟨z, hz, rfl⟩ + exact ⟨z.2, fun h ↦ hz (Subtype.ext h)⟩ + +end Inner + +section Fragment + +variable {S Shat Y : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + [TopologicalSpace Y] + [T2Space Y] {ψ : Y → S} {K : Drawing S} + +omit [T2Space S] in +/-- If the boundary of a closed disc `D` lies in `S`, then a pasted disc is in `D` or misses the +inside of `D`. -/ +theorem IsCappedSurface.side (cap : IsCappedSurface S Shat) {D : Set Shat} + (hD : IsClosedDisc D) + (h : discBd D ⊆ range cap.emb) {Θ : Set S} (hΘ : Θ ∈ cuffs S) : + closure (cap.cuffDisc Θ) ⊆ D ∨ Disjoint (closure (cap.cuffDisc Θ)) (discInt D) := by + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have hE := cap.cuffDisc_closedDisc Θ hΘ + have hC : IsPreconnected (cap.cuffDisc Θ) := by + rw [cap.cuffDisc_eq_discInt hΘ] + exact hE.isPreconnected_discInt + have hbd : Disjoint (cap.cuffDisc Θ) (discBd D) := disjoint_left.2 fun x hx hb ↦ cap.notMem_range + hΘ hx (h hb) + rcases hD.side hman hC hbd with hin | hout + · exact Or.inl (closure_minimal (hin.trans (discInt_subset _)) hD.isClosed) + · refine Or.inr (disjoint_left.2 fun x hx hxi ↦ ?_) + obtain ⟨z, hz, hzC⟩ := _root_.mem_closure_iff.1 hx _ (hD.isOpen_discInt hman) hxi + exact disjoint_left.1 hout hzC (discInt_subset _ hz) + +omit [T2Space Y] in +/-- **The fragment inside a disc.** Let `D` be a closed disc whose boundary lies in `S` and holds +`K`, and is otherwise in the pasted +discs. Let the pasted discs in `D` touch the boundary of `D` in at most one point. Then one fragment +has image `D ∩ S`, and it caps +to a sphere. -/ +theorem exists_inner_fragment (hS : IsSurface S) (cap : IsCappedSurface S Shat) (hY : IsSurface Y) + (hψ : IsCutMap ψ K.U) + {D : Set Shat} (hD : IsClosedDisc D) (hK : cap.emb '' K.U ⊆ discBd D) + (hR : discBd D ⊆ cap.discs ∪ cap.emb '' K.U) + (hrange : discBd D ⊆ range cap.emb) + (ht : ((⋃ Θ ∈ {Θ ∈ cuffs S | closure (cap.cuffDisc Θ) ⊆ D}, closure + (cap.cuffDisc Θ)) ∩ discBd D).Subsingleton) : + ∃ y : Y, ψ '' connectedComponent y = cap.emb ⁻¹' D ∧ ∀ (Shat₁ : Type) [TopologicalSpace Shat₁], + IsCappedSurface (connectedComponent y) Shat₁ → Nonempty (Shat₁ ≃ₜ SurfaceModel 0 0 0) := by + classical + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have hfc : (cuffs S).Finite := (cuff_statement S hS).2.1 + have : CompactSpace Shat := hT.1 + have : CompactSpace S := hS.1 + set 𝓣 : Set (Set S) := {Θ ∈ cuffs S | closure (cap.cuffDisc Θ) ⊆ D} with h𝓣 + have hf𝓣 : 𝓣.Finite := hfc.subset fun _ h ↦ h.1 + let E : Set S → Set Shat := fun Θ ↦ closure (cap.cuffDisc Θ) + have hUn : ⋃₀ (E '' 𝓣) = ⋃ Θ ∈ 𝓣, E Θ := sUnion_image _ _ + have hdisj : (E '' 𝓣).PairwiseDisjoint id := by + rintro _ ⟨Θ₁, h₁, rfl⟩ _ ⟨Θ₂, h₂, rfl⟩ hn + exact cap.cuffDisc_disjoint Θ₁ h₁.1 Θ₂ h₂.1 fun h ↦ hn (h ▸ rfl) + obtain ⟨T', tT', e, P, hT', hconn, ⟨hom⟩, hP, hs, ht'⟩ := exists_inner_region hT hD (𝓘 := E '' 𝓣) + (hf𝓣.image _) + (by rintro _ ⟨Θ, hΘ, rfl⟩; exact cap.cuffDisc_closedDisc Θ hΘ.1) hdisj + (by rintro _ ⟨Θ, hΘ, rfl⟩; exact hΘ.2) + (by rw [hUn]; exact ht) + set X : Set Shat := (discInt D \ ⋃₀ (E '' 𝓣))ᶜ with hX + have hdc : IsClosed cap.discs := hfc.isClosed_biUnion fun _ _ ↦ isClosed_closure + have hKc : IsClosed (cap.emb '' K.U) := (K.isClosed_U.isCompact.image + cap.isEmbedding.continuous).isClosed + have hsub : cap.discs ∪ cap.emb '' K.U ⊆ X := by + rintro x (hx | hx) ⟨hi, hn⟩ + · obtain ⟨Θ, hΘ, hxΘ⟩ := mem_iUnion₂.1 hx + rcases cap.side hD hrange hΘ with h | h + · exact hn ⟨_, ⟨Θ, ⟨hΘ, h⟩, rfl⟩, hxΘ⟩ + · exact disjoint_left.1 h hxΘ hi + · exact hi.2 (hK hx) + have hop : IsOpen (X \ (cap.discs ∪ cap.emb '' K.U)) := by + have : X \ (cap.discs ∪ cap.emb '' K.U) = Dᶜ \ (cap.discs ∪ cap.emb '' K.U) := by + ext x + constructor + · rintro ⟨hx, hn⟩ + refine ⟨fun hxD ↦ ?_, hn⟩ + by_cases hb : x ∈ discBd D + · exact hn (hR hb) + · by_contra - + refine hx ⟨⟨hxD, hb⟩, ?_⟩ + rintro ⟨_, ⟨Θ, hΘ, rfl⟩, hxΘ⟩ + exact hn (Or.inl (mem_biUnion hΘ.1 hxΘ)) + · rintro ⟨hx, hn⟩ + exact ⟨fun h ↦ hx (discInt_subset _ h.1), hn⟩ + rw [this] + exact hD.isClosed.isOpen_compl.sdiff (hdc.union hKc) + obtain ⟨y, hy, hcap, -⟩ := exists_fragment_of_region hS cap hY hψ hT' hP e + (by rw [hs, hX, compl_compl]) ht' hsub hop + refine ⟨y, ?_, fun Shat₁ _ cap₁ ↦ ?_⟩ + · rw [hy] + set A := cap.emb ⁻¹' Xᶜ with hA + set G := cap.emb ⁻¹' discInt D with hG + have hGo : IsOpen G := (hD.isOpen_discInt hman).preimage cap.isEmbedding.continuous + have hGA : G ∩ (bd S)ᶜ ⊆ A := by + rintro x ⟨hxG, hxb⟩ + change cap.emb x ∈ Xᶜ + rw [hX, compl_compl] + refine ⟨hxG, ?_⟩ + rintro ⟨_, ⟨Θ, hΘ, rfl⟩, hxΘ⟩ + have hn : cap.emb x ∈ cap.discsᶜ := by + rw [show cap.discsᶜ = _ from cap.compl_eq_image] + exact mem_image_of_mem _ hxb + exact hn (mem_biUnion hΘ.1 hxΘ) + have hGcl : closure G ⊆ closure A := + closure_minimal (((dense_interior' hS).open_subset_closure_inter hGo).trans + (closure_mono hGA)) isClosed_closure + have hAsub : A ⊆ cap.emb ⁻¹' D := by + intro x hx + have hx' : cap.emb x ∈ Xᶜ := hx + rw [hX, compl_compl] at hx' + exact discInt_subset D hx'.1 + have hnear : ∀ {x}, cap.emb x ∈ discBd D → cap.emb x ∉ ⋃ Θ ∈ 𝓣, E Θ → x ∈ closure G := by + intro x hxb hxn + have hV : IsOpen (⋃ Θ ∈ 𝓣, E Θ)ᶜ := (hf𝓣.isClosed_biUnion fun _ _ ↦ + isClosed_closure).isOpen_compl + rw [cap.isEmbedding.closure_eq_preimage_closure_image, mem_preimage, _root_.mem_closure_iff] + intro O hO hxO + obtain ⟨w, hw, hwi⟩ := _root_.mem_closure_iff.1 (hD.subset_closure_discInt + (Surface.discBd_subset _ hxb)) (O ∩ _) (hO.inter hV) ⟨hxO, hxn⟩ + refine ⟨w, hw.1, ?_⟩ + have hwr : w ∈ range cap.emb := by + by_contra hn + have hn' : w ∈ (range cap.emb)ᶜ := hn + rw [cap.compl_eq] at hn' + obtain ⟨Θ, hΘ, hwΘ⟩ := mem_iUnion₂.1 hn' + rcases cap.side hD hrange hΘ with h | h + · exact hw.2 (mem_biUnion (show Θ ∈ 𝓣 from ⟨hΘ, h⟩) (subset_closure hwΘ)) + · exact disjoint_left.1 h (subset_closure hwΘ) hwi + obtain ⟨x', rfl⟩ := hwr + exact ⟨x', hwi, rfl⟩ + apply Subset.antisymm + · exact closure_minimal hAsub (hD.isClosed.preimage cap.isEmbedding.continuous) + · intro x hx + refine hGcl ?_ + by_cases hxi : x ∈ G + · exact subset_closure hxi + have hxb : cap.emb x ∈ discBd D := by + by_contra hn + exact hxi ⟨hx, hn⟩ + by_cases hxT : cap.emb x ∈ ⋃ Θ ∈ 𝓣, E Θ + · have hlim := mem_closure_oArc_sdiff hD.isOArc_discBd hxb + rw [cap.isEmbedding.closure_eq_preimage_closure_image, mem_preimage] + refine closure_minimal ?_ isClosed_closure (closure_mono (Subset.rfl) hlim) + rintro z ⟨hzb, hne⟩ + obtain ⟨x', rfl⟩ := hrange hzb + have hx'n : cap.emb x' ∉ ⋃ Θ ∈ 𝓣, E Θ := fun h ↦ hne (ht ⟨h, hzb⟩ ⟨hxT, hxb⟩) + have := hnear hzb hx'n + rw [cap.isEmbedding.closure_eq_preimage_closure_image] at this + exact this + · exact hnear hxb hxT + · obtain ⟨f⟩ := hcap Shat₁ cap₁ + exact ⟨f.trans hom⟩ + +end Fragment + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FragmentSimpler.lean b/LeanPool/GraphMinor/GM19/FragmentSimpler.lean new file mode 100644 index 0000000000..1d1ce7ca9b --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FragmentSimpler.lean @@ -0,0 +1,435 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FragmentCut + +/-! +# The fragments of a non-null-homotopic feature are simpler + +We prove the step of (5.5), Graph Minors XIX, page 339. Let `K` lie in an `O`-arc `F` of `Σ̂` that +is not null-homotopic. We collapse each +pasted disc of `Σ̂` to a point. The image `F'` of `F` is an `O`-arc, and it is not null-homotopic, +since the collapse is homotopic to the +identity. Each piece of `Σ̂` cut along `F'` is simpler than `Σ̂`, by `exists_cut_simpler`. The +inside of a fragment is, up to a finite set, +the inside of such a piece. So its capping is the capping of the piece (`simpler_of_piece`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +omit [T2Space T] in +/-- If a map homotopic to the identity carries the `O`-arc `F` onto a null-homotopic `O`-arc, then +`F` is null-homotopic. -/ +theorem null_of_homotopic {c : C(T, T)} (hc : c.Homotopic (ContinuousMap.id T)) {F F' : Set T} + (hF : IsOArc F) (hF' : c '' F = F') + (hn : IsNullHomotopicOArc F') : IsNullHomotopicOArc F := by + obtain ⟨φ⟩ := hF + obtain ⟨φ', p, -, H, -, h0, h1⟩ := hn + let l : C(Circle, T) := ⟨fun x ↦ (φ x).1, continuous_subtype_val.comp φ.continuous⟩ + have hmem : ∀ x, c (l x) ∈ F' := fun x ↦ hF' ▸ mem_image_of_mem _ (φ x).2 + let m : C(Circle, Circle) := ⟨fun x ↦ φ'.symm ⟨c (l x), hmem x⟩, φ'.symm.continuous.comp + (Continuous.subtype_mk (by fun_prop) _)⟩ + have hm : ∀ x, (φ' (m x)).1 = c (l x) := fun x ↦ by + change (φ' (φ'.symm _)).1 = _ + rw [φ'.apply_symm_apply] + have h₁ : (ContinuousMap.id T).comp l |>.Homotopic (c.comp l) := (hc.symm).comp + (ContinuousMap.Homotopic.refl l) + let G : ContinuousMap.Homotopy (c.comp l) (ContinuousMap.const Circle p) := + { toFun := fun q ↦ H (m q.2, q.1) + continuous_toFun := by fun_prop + map_zero_left := fun x ↦ by + change H (m x, 0) = c (l x) + rw [h0] + exact hm x + map_one_left := fun x ↦ by + change H (m x, 1) = p + rw [h1] + rfl } + obtain ⟨G'⟩ := h₁.trans ⟨G⟩ + refine ⟨φ, p, mem_univ _, ⟨⟨fun q ↦ G' (q.2, q.1), by fun_prop⟩, fun _ ↦ mem_univ _, + fun x ↦ ?_, fun x ↦ ?_⟩⟩ + · exact G'.apply_zero x + · exact G'.apply_one x + +theorem isOArc_of_injective_range {f : Circle → T} (hf : Continuous f) + (hi : Function.Injective f) : IsOArc (range f) := + ⟨(hf.isClosedEmbedding hi).isEmbedding.toHomeomorph⟩ + +/-- A one to one map on an `O`-arc gives an `O`-arc. -/ +theorem isOArc_image_injOn {c : T → T} (hc : Continuous c) {F : Set T} (hF : IsOArc F) + (hi : InjOn c F) : IsOArc (c '' F) := by + obtain ⟨φ⟩ := hF + have : c '' F = range fun x ↦ c (φ x).1 := by + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + exact ⟨φ.symm ⟨y, hy⟩, by simp⟩ + · rintro ⟨z, rfl⟩ + exact mem_image_of_mem _ (φ z).2 + rw [this] + exact isOArc_of_injective_range (by fun_prop) fun x y he ↦ φ.injective (Subtype.ext (hi (φ x).2 + (φ y).2 he)) + +/-- A map on a line that is one to one, except that the two ends go to one point, gives an `O`-arc. +-/ +theorem isOArc_image_line {c : T → T} (hc : Continuous c) {L : Set T} {a b : T} + (hl : IsLineWithEnds L a b) (hab : c a = c b) + (hi : ∀ x ∈ L, ∀ y ∈ L, c x = c y → x = y ∨ (x = a ∧ y = b) ∨ (x = b ∧ y = a)) : IsOArc + (c '' L) := by + obtain ⟨f, h0, h1⟩ := id hl + have hane : a ≠ b := hl.ne' + let x : T := (f (⟨1 / 2, by norm_num, by norm_num⟩ : unitInterval)).1 + have hxL : x ∈ L := (f _).2 + have hne : ∀ {r : unitInterval}, r ≠ ⟨1 / 2, by norm_num, by norm_num⟩ → (f r).1 ≠ x + := fun hr he ↦ hr (f.injective (Subtype.ext he)) + have hxa : x ≠ a := fun he ↦ hne (r := 0) (fun h ↦ by have := congrArg Subtype.val h; norm_num + at this) (h0.trans he.symm) + have hxb : x ≠ b := fun he ↦ hne (r := 1) (fun h ↦ by have := congrArg Subtype.val h; norm_num + at this) (h1.trans he.symm) + obtain ⟨L₁, L₂, hL₁, hL₂, hun, hint⟩ := hl.split hxL hxa hxb + have hnotb : b ∉ L₁ := fun h ↦ hxb (by + have : b ∈ L₁ ∩ L₂ := ⟨h, hL₂.right_mem⟩ + rw [hint] at this + exact this.symm) + have hnota : a ∉ L₂ := fun h ↦ hxa (by + have : a ∈ L₁ ∩ L₂ := ⟨hL₁.left_mem, h⟩ + rw [hint] at this + exact this.symm) + have hs₁ : L₁ ⊆ L := hun ▸ subset_union_left + have hs₂ : L₂ ⊆ L := hun ▸ subset_union_right + obtain ⟨u, hu, hur, hu0, hu1⟩ := hL₁.exists_arc + obtain ⟨v, hv, hvr, hv0, hv1⟩ := hL₂.symm.exists_arc + have huL : ∀ s, u s ∈ L₁ := fun s ↦ hur ▸ mem_range_self s + have hvL : ∀ s, v s ∈ L₂ := fun s ↦ hvr ▸ mem_range_self s + have hcu : InjOn c L₁ := fun p hp q hq he ↦ by + rcases hi p (hs₁ hp) q (hs₁ hq) he with h | ⟨-, rfl⟩ | ⟨rfl, -⟩ + · exact h + · exact absurd hq hnotb + · exact absurd hp hnotb + have hcv : InjOn c L₂ := fun p hp q hq he ↦ by + rcases hi p (hs₂ hp) q (hs₂ hq) he with h | ⟨rfl, -⟩ | ⟨-, rfl⟩ + · exact h + · exact absurd hp hnota + · exact absurd hq hnota + have ha₁ : IsArcMap (c ∘ u) := ⟨hc.comp hu.1, fun s t he ↦ hu.2 (hcu (huL s) (huL t) he)⟩ + have ha₂ : IsArcMap (c ∘ v) := ⟨hc.comp hv.1, fun s t he ↦ hv.2 (hcv (hvL s) (hvL t) he)⟩ + have hO := oArc_of_two_arcs ha₁ ha₂ (by simp [hu0, hv0, hab]) (by simp [hu1, hv1]) (by + intro s t he + have he' : c (u s) = c (v t) := he + rcases hi _ (hs₁ (huL s)) _ (hs₂ (hvL t)) he' with h | ⟨h, h'⟩ | ⟨h, -⟩ + · have : u s ∈ L₁ ∩ L₂ := ⟨huL s, h ▸ hvL t⟩ + rw [hint] at this + have h₁ : s = 1 := hu.2 (by rw [hu1]; exact this) + have h₂ : t = 1 := hv.2 (by rw [hv1, ← h]; exact this) + exact Or.inr ⟨h₁, h₂⟩ + · exact Or.inl ⟨hu.2 (by rw [h, hu0]), hv.2 (by rw [h', hv0])⟩ + · exact absurd (h ▸ huL s) hnotb) + have heq : c '' L = range (c ∘ u) ∪ range (c ∘ v) := by + rw [← hun, image_union, range_comp, range_comp, hur, hvr] + rw [heq] + exact hO + +section Piece + +variable {S Shat Y : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + [TopologicalSpace Y] + [T2Space Y] {ψ : Y → S} {K : Drawing S} + +omit [T2Space Y] in +/-- A capped fragment is the capping of a piece of `Σ̂` cut along `F'`, so it is simpler than `Σ̂`. +-/ +theorem simpler_of_piece (hS : IsSurface S) (cap : IsCappedSurface S Shat) (hY : IsSurface Y) + (hψ : IsCutMap ψ K.U) {c₀ : C(Shat, Shat)} + {P₀ F' : Set Shat} (hc : IsCollapse c₀ cap.discs P₀) {S' : Type} [TopologicalSpace S'] (ψ' : S' + → Shat) (hS' : IsSurface S') + (hF'c : IsClosed F') (hcut : IsCutMap ψ' F') (hKF : ∀ x ∈ K.U, c₀ (cap.emb x) ∈ F') + (hoff : ∀ x, x ∉ cap.discs ∪ cap.emb '' K.U → c₀ x ∉ F') + (hsimple : ∀ C ∈ spaceComponents S', IsSimplerThan C Shat) (y : Y) + (Shat₁ : Type) [TopologicalSpace Shat₁] + (cap₁ : IsCappedSurface (connectedComponent y) Shat₁) : IsSimplerThan Shat₁ Shat := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have : CompactSpace Shat := hT.1 + have : CompactSpace Y := hY.1 + have : CompactSpace S' := hS'.1 + have : T2Space S' := hS'.2.1 + have : LocallyConnectedSpace S' := hS'.locallyConnected + have : LocallyConnectedSpace Y := hY.locallyConnected + have : Nonempty Shat := inferInstance + have : CompactSpace S := hS.1 + have hbT : bd Shat = ∅ := cap.bd_empty + have hbS' : ∀ {z : S'}, z ∈ bd S' → ψ' z ∈ F' := fun {z} hz ↦ by + by_contra hn + have := bd_of_bd_cutMap hcut hF'c hz hn + rw [hbT] at this + exact this + have hF'S : ∀ {z : S'}, ψ' z ∈ F' → z ∈ bd S' := fun h ↦ hcut.2.2.2.2 h + obtain ⟨y', hy'c, hy'i⟩ : ∃ y', y' ∈ connectedComponent y ∧ y' ∈ (bd Y)ᶜ := by + obtain ⟨z, hz, hz'⟩ := (dense_interior' hY).inter_open_nonempty _ isOpen_connectedComponent ⟨y, + mem_connectedComponent⟩ + exact ⟨z, hz, hz'⟩ + have hxK : ψ y' ∉ K.U := fun h ↦ hy'i (hψ.2.2.2.2 h) + have hint' : IsInteriorPoint y' := by + by_contra h + exact hy'i h + have hxb : ψ y' ∉ bd S := fun h ↦ h (isInteriorPoint_image hψ K.isClosed_U hint' hxK) + have hxd : cap.emb (ψ y') ∉ cap.discs := fun h ↦ by + have hc' : cap.emb (ψ y') ∈ cap.discsᶜ := by + rw [show cap.discsᶜ = _ from cap.compl_eq_image] + exact mem_image_of_mem _ hxb + exact hc' h + have hxZ : cap.emb (ψ y') ∉ cap.discs ∪ cap.emb '' K.U := by + rintro (h | ⟨z, hz, he⟩) + · exact hxd h + · exact hxK (cap.isEmbedding.injective he ▸ hz) + obtain ⟨w, hw⟩ := hcut.2.1 (c₀ (cap.emb (ψ y'))) + set C := connectedComponent w with hC + have hCo : IsOpen C := isOpen_connectedComponent + have hCcl : IsClopen C := ⟨isClosed_connectedComponent, hCo⟩ + have hCs : IsSurface C := isSurface_sub hS' hCcl + have : ConnectedSpace C := Subtype.connectedSpace isConnected_connectedComponent + have : T2Space C := inferInstance + obtain ⟨CHat, _, ⟨capC⟩⟩ := exists_cappedSurface _ C hCs inferInstance rfl + have : T2Space CHat := capC.isSurface.2.1 + have : ConnectedSpace CHat := capC.connected + obtain ⟨eC, Q, hQ, hsC, htC, -⟩ := exists_cap_chart hCs capC + have hbdC : ∀ {x : C}, x ∉ bd C → ψ' x.1 ∉ F' := fun {x} hx h ↦ hx ((mem_bd_sub hCo).2 (hF'S h)) + have hbdo : IsOpen (bd C)ᶜ := (cuff_statement C hCs).1.isOpen_compl + obtain ⟨g, hgs, hgt, hgf⟩ := exists_oph (f := fun x : C ↦ ψ' x.1) (s := (bd C)ᶜ) (t := + (fun x : C ↦ ψ' x.1) '' (bd C)ᶜ) hbdo + (hcut.1.comp continuous_subtype_val).continuousOn + (fun a ha b hb he ↦ Subtype.ext (hcut.2.2.1 (hbdC ha) (hbdC hb) he)) + (fun u hu huo ↦ by + have : (fun x : C ↦ ψ' x.1) '' u = ψ' '' (Subtype.val '' u) := by rw [image_image] + rw [this] + refine isOpen_image_of_isCutMap hcut ?_ (hCo.isOpenMap_subtype_val _ huo) + rintro _ ⟨v, hv, rfl⟩ + exact hbdC (hu hv)) rfl + set R := (fun x : C ↦ ψ' x.1) '' (bd C)ᶜ with hR + have hRF : Disjoint R F' := disjoint_left.2 fun x ⟨v, hv, he⟩ hxF ↦ hbdC hv (by + have h : ψ' v.1 = x := he + rw [h] + exact hxF) + let d : OpenPartialHomeomorph Shat CHat := g.symm.trans' eC (by simp [hgs, hsC]) + have hds : d.source = R := by simp [d, hgt] + have hdt : d.target = Qᶜ := by simp [d, htC] + obtain ⟨e₀, hs₀, ht₀, he₀⟩ := hc.exists_oph + let E : OpenPartialHomeomorph Shat CHat := e₀.trans d + have hEs : ∀ x, x ∈ E.source ↔ x ∉ cap.discs ∧ c₀ x ∈ R := fun x ↦ by + change x ∈ e₀.source ∩ e₀ ⁻¹' d.source ↔ _ + rw [hs₀, hds] + constructor + · rintro ⟨h, h'⟩ + exact ⟨h, he₀ h ▸ h'⟩ + · rintro ⟨h, h'⟩ + exact ⟨h, by rw [mem_preimage, he₀ h]; exact h'⟩ + set P : Set CHat := Q ∪ d '' (P₀ ∩ R) with hP + have hPf : P.Finite := hQ.union ((hc.finite.subset inter_subset_left).image _) + have hEt : E.target = Pᶜ := by + ext z + change z ∈ d.target ∩ d.symm ⁻¹' e₀.target ↔ _ + rw [hdt, ht₀, hP] + constructor + · rintro ⟨hz, hzP⟩ (h | ⟨u, hu, rfl⟩) + · exact hz h + · apply hzP + rw [d.left_inv (hds ▸ hu.2)] + exact hu.1 + · intro hz + have hzQ : z ∉ Q := fun h ↦ hz (Or.inl h) + refine ⟨hzQ, fun hzP ↦ hz (Or.inr ⟨d.symm z, ⟨hzP, ?_⟩, d.right_inv (hdt ▸ hzQ)⟩)⟩ + have := d.map_target (hdt ▸ hzQ : z ∈ d.target) + rwa [hds] at this + have hsub : cap.discs ∪ cap.emb '' K.U ⊆ E.sourceᶜ := by + rintro x (hx | ⟨z, hz, rfl⟩) hxs + · exact ((hEs x).1 hxs).1 hx + · exact disjoint_left.1 hRF ((hEs _).1 hxs).2 (hKF z hz) + have hdc : IsClosed cap.discs := (cuff_statement S hS).2.1.isClosed_biUnion fun _ _ ↦ + isClosed_closure + have hKc : IsClosed (cap.emb '' K.U) := (K.isClosed_U.isCompact.image + cap.isEmbedding.continuous).isClosed + have hop : IsOpen (E.sourceᶜ \ (cap.discs ∪ cap.emb '' K.U)) := by + set W := ψ' '' (Cᶜ ∩ (bd S')ᶜ) with hWdef + have hWo : IsOpen W := isOpen_image_of_isCutMap hcut (fun z hz h ↦ hz.2 (hF'S h)) + (hCcl.compl.isOpen.inter (cuff_statement S' hS').1.isOpen_compl) + have : E.sourceᶜ \ (cap.discs ∪ cap.emb '' K.U) = (cap.discs ∪ cap.emb '' K.U)ᶜ ∩ c₀ ⁻¹' W := by + ext x + constructor + · rintro ⟨hx, hxZ'⟩ + refine ⟨hxZ', ?_⟩ + obtain ⟨v, hv⟩ := hcut.2.1 (c₀ x) + have hvb : v ∉ bd S' := fun h ↦ hoff x hxZ' (hv ▸ hbS' h) + refine ⟨v, ⟨fun hvC ↦ hx ((hEs x).2 ⟨fun h ↦ hxZ' (Or.inl h), ?_⟩), hvb⟩, hv⟩ + exact ⟨⟨v, hvC⟩, fun h ↦ hvb ((mem_bd_sub hCo).1 h), hv⟩ + · rintro ⟨hxZ', v, ⟨hvC, hvb⟩, hv⟩ + refine ⟨fun hxs ↦ ?_, hxZ'⟩ + obtain ⟨u, hu, hue⟩ := ((hEs x).1 hxs).2 + have hnF : ψ' v ∉ F' := hv ▸ hoff x hxZ' + have heq : u.1 = v := hcut.2.2.1 (hbdC hu) hnF (hue.trans hv.symm) + exact hvC (heq ▸ u.2) + rw [this] + exact (hdc.union hKc).isOpen_compl.inter (hWo.preimage c₀.continuous) + obtain ⟨y₁, hy₁, hcap, -, -⟩ := exists_fragment_of_region hS cap hY hψ capC.isClosedSurface hPf E + (compl_compl _).symm hEt hsub hop + have hxsrc : cap.emb (ψ y') ∈ E.sourceᶜᶜ := by + rw [compl_compl, hEs] + refine ⟨hxd, ⟨w, mem_connectedComponent⟩, fun h ↦ ?_, hw⟩ + have := hbS' ((mem_bd_sub hCo).1 h) + change ψ' w ∈ F' at this + rw [hw] at this + exact hoff _ hxZ this + have hxin : ψ y' ∈ ψ '' connectedComponent y₁ := by + rw [hy₁] + exact subset_closure hxsrc + obtain ⟨y₂, hy₂, he⟩ := hxin + have hy₂e : y₂ = y' := hψ.2.2.1 (show ψ y₂ ∈ K.Uᶜ by rw [he]; exact hxK) hxK he + have hcomp : connectedComponent y = connectedComponent y₁ := by + rw [connectedComponent_eq hy'c] + exact (connectedComponent_eq (hy₂e ▸ hy₂)).symm + obtain ⟨f⟩ := hcap Shat₁ (hcomp ▸ cap₁) + have hCmem : C ∈ spaceComponents S' := by + rw [spaceComponents_eq] + exact ⟨w, rfl⟩ + obtain ⟨a, b, c, a', b', c', ⟨e₁⟩, ⟨e₂⟩, h1, h2, h3⟩ := hsimple C hCmem + have hc' : c' = 0 := by + have := numCuffs_eq e₂ + rw [numCuffs_model] at this + rw [← this, numCuffs, cuffs, hbT] + simp [componentsIn] + subst hc' + obtain ⟨f'⟩ := capModel a b c CHat (capC.ofHomeo e₁.symm) + exact ⟨a, b, 0, a', b', 0, ⟨f.trans f'⟩, ⟨e₂⟩, h1, h2, by omega⟩ + +end Piece + +/-- **The step of the proof of (5.5)**, Graph Minors XIX, page 339: "For each fragment $\Sigma_1$ +say, $\hat{\Sigma}_1$ is simpler than $\hat{\Sigma}_\chi$ because $U(F)$ is non-null-homotopic in +$\hat{\Sigma}$". -/ +theorem cutSimpler : CutSimplerStatement := by + classical + intro S Shat _ _ _ _ cap K hS hlines hKne hKbd ⟨F, hF, hnull, hf⟩ + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hfc : (cuffs S).Finite := (cuff_statement S hS).2.1 + have hSne : Nonempty S := by + rcases hf with ⟨-, hO, -⟩ | ⟨s, -⟩ + · obtain ⟨φ⟩ := hO + exact ⟨(φ 1).1⟩ + · exact ⟨s⟩ + have : ConnectedSpace S := by + have h := (cap.isPreconnected_compl hfc subset_rfl).2 + rw [cap.compl_eq_image, cap.isEmbedding.isInducing.isPreconnected_image] at h + have hc := h.closure + rw [(dense_interior' hS).closure_eq] at hc + exact { toPreconnectedSpace := ⟨hc⟩, toNonempty := hSne } + let E : Set S → Set Shat := fun Θ ↦ closure (cap.cuffDisc Θ) + have hdisj : (E '' cuffs S).PairwiseDisjoint id := by + rintro _ ⟨Θ₁, h₁, rfl⟩ _ ⟨Θ₂, h₂, rfl⟩ hn + exact cap.cuffDisc_disjoint Θ₁ h₁ Θ₂ h₂ fun h ↦ hn (h ▸ rfl) + obtain ⟨c₀, P₀, q, hc, hq, -, hqi⟩ := exists_collapse hT (hfc.image E) + (by rintro _ ⟨Θ, hΘ, rfl⟩; exact cap.cuffDisc_closedDisc Θ hΘ) hdisj + have hUn : ⋃₀ (E '' cuffs S) = cap.discs := sUnion_image _ _ + rw [hUn] at hc + have hsame : ∀ {x y}, c₀ x = c₀ y → x ≠ y → ∃ Θ ∈ cuffs S, x ∈ closure (cap.cuffDisc Θ) + ∧ y ∈ closure (cap.cuffDisc Θ) := by + intro x y he hne + have hx : x ∈ cap.discs := by + by_contra hx + have hy : y ∉ cap.discs := fun hy ↦ hx (hc.preimage (by + rw [mem_preimage, he] + exact hc.mapsTo hy)) + exact hne (hc.injOn hx hy he) + have hy : y ∈ cap.discs := hc.preimage (by rw [mem_preimage, ← he]; exact hc.mapsTo hx) + obtain ⟨Θ₁, h₁, hx₁⟩ := mem_iUnion₂.1 hx + obtain ⟨Θ₂, h₂, hy₂⟩ := mem_iUnion₂.1 hy + have hE : E Θ₁ = E Θ₂ := hqi (mem_image_of_mem _ h₁) (mem_image_of_mem _ h₂) (by + rw [← hq _ (mem_image_of_mem _ h₁) x hx₁, ← hq _ (mem_image_of_mem _ h₂) y hy₂, he]) + have hy₃ : y ∈ E Θ₂ := hy₂ + rw [← hE] at hy₃ + exact ⟨Θ₁, h₁, hx₁, hy₃⟩ + have hFdata : cap.emb '' K.U ⊆ F ∧ F ⊆ cap.discs ∪ cap.emb '' K.U ∧ IsOArc (c₀ '' F) ∧ + ∃ (Y : Type) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S), IsSurface Y + ∧ IsCutMap ψ K.U ∧ HasSheets ψ K := by + rcases hf with ⟨rfl, hO, hsing⟩ | ⟨s, t, Θ, hΘ, hst, hs, ht, hKb, hl, hsub, hrest⟩ + · refine ⟨Subset.rfl, subset_union_right, isOArc_image_injOn c₀.continuous hF ?_, ?_⟩ + · rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ he + by_contra hne + obtain ⟨Θ, hΘ, h₁, h₂⟩ := hsame he hne + rw [hsing ⟨ha, cap.bd_of_mem hΘ h₁⟩ ⟨hb, cap.bd_of_mem hΘ h₂⟩] at hne + exact hne rfl + · obtain ⟨Y, tY, t2, ψ, h₁, h₂, h₃⟩ := exists_cut_drawing (𝓐 := cuffs S ∪ {K.U}) (𝓛 + := ∅) hS hlines hKbd hKne + (isCutFrame_of hS (finite_singleton _) finite_empty (fun C hC ↦ hC ▸ hO) + (fun L hL ↦ absurd hL (notMem_empty L))) + (by simp [sUnion_cuffs, union_comm]) + exact ⟨Y, tY, t2, ψ, h₁, h₂, h₃⟩ + · have hE := cap.mem_closure_emb hΘ hs + have hE' := cap.mem_closure_emb hΘ ht + have hline := hl.map_of_embedding cap.isEmbedding + have hab : c₀ (cap.emb s) = c₀ (cap.emb t) := by + rw [hq _ (mem_image_of_mem _ hΘ) _ hE, hq _ (mem_image_of_mem _ hΘ) _ hE'] + have himg : c₀ '' F = c₀ '' (cap.emb '' K.U) := by + apply Subset.antisymm + · rintro _ ⟨x, hx, rfl⟩ + by_cases hxK : x ∈ cap.emb '' K.U + · exact mem_image_of_mem _ hxK + · have hxE : x ∈ closure (cap.cuffDisc Θ) := subset_closure (hrest ⟨hx, hxK⟩) + refine ⟨cap.emb s, mem_image_of_mem _ hl.left_mem, ?_⟩ + rw [hq _ (mem_image_of_mem _ hΘ) _ hE, hq _ (mem_image_of_mem _ hΘ) _ hxE] + · exact image_mono hsub + refine ⟨hsub, fun x hx ↦ ?_, ?_, ?_⟩ + · by_cases hxK : x ∈ cap.emb '' K.U + · exact Or.inr hxK + · exact Or.inl (mem_biUnion hΘ (subset_closure (hrest ⟨hx, hxK⟩))) + · rw [himg] + refine isOArc_image_line c₀.continuous hline hab ?_ + rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ he + by_cases hne : cap.emb a = cap.emb b + · exact Or.inl hne + · obtain ⟨Θ', hΘ', h₁, h₂⟩ := hsame he hne + have hma : a ∈ K.U ∩ bd S := ⟨ha, cap.bd_of_mem hΘ' h₁⟩ + have hmb : b ∈ K.U ∩ bd S := ⟨hb, cap.bd_of_mem hΘ' h₂⟩ + rw [hKb] at hma hmb + rcases hma with rfl | hma <;> rcases hmb with rfl | hmb + · exact absurd rfl hne + · exact Or.inr (Or.inl ⟨rfl, by rw [mem_singleton_iff.1 hmb]⟩) + · exact Or.inr (Or.inr ⟨by rw [mem_singleton_iff.1 hma], rfl⟩) + · rw [mem_singleton_iff.1 hma, mem_singleton_iff.1 hmb] at hne + exact absurd rfl hne + · obtain ⟨Y, tY, t2, ψ, h₁, h₂, h₃⟩ := exists_cut_drawing (𝓐 := cuffs S ∪ ∅) (𝓛 + := {K.U}) hS hlines hKbd hKne + (isCutFrame_of hS finite_empty (finite_singleton _) (fun C hC ↦ absurd hC + (notMem_empty C)) + (fun L hL ↦ ⟨s, t, hst, hL ▸ hl, Or.inl (cuff_subset_bd ⟨Θ, hΘ⟩ hs), Or.inl + (cuff_subset_bd ⟨Θ, hΘ⟩ ht)⟩)) + (by simp [sUnion_cuffs]) + exact ⟨Y, tY, t2, ψ, h₁, h₂, h₃⟩ + obtain ⟨hKF, hFsub, hF'O, Y, tY, t2, ψ, hY, hψ, hsheet⟩ := hFdata + have hnn : ¬ IsNullHomotopicOArc (c₀ '' F) := fun h ↦ hnull (null_of_homotopic hc.homotopic hF + rfl h) + obtain ⟨S', tS', ψ', hS', hcut, hsimple⟩ := exists_cut_simpler hT hF'O hnn + refine ⟨Y, tY, t2, ψ, hY, hψ, hsheet, fun y Shat₁ _ cap₁ ↦ ?_⟩ + refine simpler_of_piece hS cap hY hψ hc ψ' hS' hF'O.isCompact.isClosed (IsCutting.isCutMap hcut) + (fun x hx ↦ mem_image_of_mem _ (hKF (mem_image_of_mem _ hx))) (fun x hx hxF ↦ ?_) hsimple y + Shat₁ cap₁ + obtain ⟨f, hf', he⟩ := hxF + by_cases hxf : f = x + · exact hx (hxf ▸ hFsub hf') + · obtain ⟨Θ, hΘ, -, h₂⟩ := hsame he hxf + exact hx (Or.inl (mem_biUnion hΘ h₂)) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FrameExists.lean b/LeanPool/GraphMinor/GM19/FrameExists.lean new file mode 100644 index 0000000000..600ad3cea2 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FrameExists.lean @@ -0,0 +1,416 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.ThinFits +public import LeanPool.GraphMinor.GM19.CircleLift +public import LeanPool.GraphMinor.GM11.ArcDrawings + +/-! +# The frame in the proof of Graph Minors XIX, (2.1) + +Fix a way to read each cuff as the circle. The upper half of the circle is the short side on that +cuff, and the +lower half is the long side. This gives a frame. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +/-! ### Arcs of a cuff -/ + +section Arc + +variable {Θ : Set S} (f : Circle ≃ₜ Θ) + +/-- The open arc of angles between `a` and `b`. -/ +noncomputable def arcOf (a b : ℝ) : Set S := cuffPoint f '' Ioo a b + +omit [T2Space S] in +theorem cuffPoint_eq {s t : ℝ} (h : cuffPoint f s = cuffPoint f t) : + ∃ m : ℤ, s = t + m * (2 * Real.pi) := by + have h1 : f (Circle.exp s) = f (Circle.exp t) := Subtype.ext h + exact Circle.exp_eq_exp.mp (f.injective h1) + +omit [T2Space S] in +theorem cuffPoint_injOn {a b : ℝ} (hab : b ≤ a + 2 * Real.pi) {s t : ℝ} (hs : s ∈ Ico a b) + (ht : t ∈ Ico a b) (h : cuffPoint f s = cuffPoint f t) : s = t := by + obtain ⟨m, hm⟩ := cuffPoint_eq f h + have hpi := Real.pi_pos + have h0 : m = 0 := by + by_contra hne + rcases lt_or_gt_of_ne hne with h1 | h1 + · have h2 : (m : ℝ) ≤ -1 := by exact_mod_cast (by omega : m ≤ -1) + nlinarith [hs.1, ht.2] + · have h2 : (1 : ℝ) ≤ m := by exact_mod_cast (by omega : 1 ≤ m) + nlinarith [ht.1, hs.2] + rw [hm, h0] + simp + +omit [T2Space S] in +theorem cuffPoint_injOn_Icc {a b : ℝ} (hab : b < a + 2 * Real.pi) : + InjOn (cuffPoint f) (Icc a b) := fun s hs t ht h ↦ + cuffPoint_injOn f (b := a + 2 * Real.pi) le_rfl ⟨hs.1, by linarith [hs.2]⟩ + ⟨ht.1, by linarith [ht.2]⟩ h + +omit [T2Space S] in +theorem isPathConnected_arcOf {a b : ℝ} (hab : a < b) : IsPathConnected (arcOf f a b) := + ((convex_Ioo a b).isPathConnected (nonempty_Ioo.mpr hab)).image (continuous_cuffPoint f) + +theorem closure_arcOf {a b : ℝ} (hab : a < b) : closure (arcOf f a b) = cuffPoint f '' Icc a b := by + have h := image_closure_of_isCompact (f := cuffPoint f) (s := Ioo a b) + (by rw [closure_Ioo hab.ne]; exact isCompact_Icc) (continuous_cuffPoint f).continuousOn + rw [closure_Ioo hab.ne] at h + exact h.symm + +theorem isLine_arcOf {a b : ℝ} (hab : a < b) (hb : b < a + 2 * Real.pi) : + IsLineWithEnds (closure (arcOf f a b)) (cuffPoint f a) (cuffPoint f b) := by + rw [closure_arcOf f hab] + exact GM11.isLine_of_injOn (continuous_cuffPoint f) hab (cuffPoint_injOn_Icc f hb) + +theorem tilde_arcOf {a b : ℝ} (hab : a < b) (hb : b < a + 2 * Real.pi) : + tilde (arcOf f a b) = {cuffPoint f a, cuffPoint f b} := by + rw [tilde, closure_arcOf f hab] + ext x + constructor + · rintro ⟨⟨t, ht, rfl⟩, hn⟩ + rcases eq_or_lt_of_le ht.1 with rfl | h1 + · exact Or.inl rfl + rcases eq_or_lt_of_le ht.2 with rfl | h2 + · exact Or.inr rfl + exact absurd ⟨t, ⟨h1, h2⟩, rfl⟩ hn + · rintro (rfl | rfl) + · refine ⟨⟨a, ⟨le_rfl, hab.le⟩, rfl⟩, ?_⟩ + rintro ⟨t, ht, he⟩ + have := cuffPoint_injOn_Icc f hb ⟨ht.1.le, ht.2.le⟩ ⟨le_rfl, hab.le⟩ he + linarith [ht.1] + · refine ⟨⟨b, ⟨hab.le, le_rfl⟩, rfl⟩, ?_⟩ + rintro ⟨t, ht, he⟩ + have := cuffPoint_injOn_Icc f hb ⟨ht.1.le, ht.2.le⟩ ⟨hab.le, le_rfl⟩ he + linarith [ht.2] + +omit [T2Space S] in +theorem cuffPoint_mem (t : ℝ) : cuffPoint f t ∈ Θ := (f _).2 + +omit [T2Space S] in +theorem arcOf_subset (a b : ℝ) : arcOf f a b ⊆ Θ := by + rintro _ ⟨t, -, rfl⟩ + exact cuffPoint_mem f t + +omit [T2Space S] in +theorem cuffPoint_add_two_pi (t : ℝ) : cuffPoint f (t + 2 * Real.pi) = cuffPoint f t := by + simp only [cuffPoint] + rw [exp_add_two_pi] + +omit [T2Space S] in +/-- Each point of `Θ` has an angle in `[a, a + 2π)`. -/ +theorem exists_angle_in (a : ℝ) (x : Θ) : ∃ t ∈ Ico a (a + 2 * Real.pi), cuffPoint f t = x := by + have hpi := Real.pi_pos + by_cases hx : (f.symm x) = Circle.exp a + · refine ⟨a, ⟨le_rfl, by linarith⟩, ?_⟩ + simp only [cuffPoint, ← hx] + simp + have hne : (Circle.exp a)⁻¹ * f.symm x ≠ 1 := fun h ↦ hx (inv_mul_eq_one.mp h).symm + obtain ⟨s, hs0, hs1, hs⟩ := exists_angle hne + refine ⟨a + s, ⟨by linarith, by linarith⟩, ?_⟩ + simp only [cuffPoint] + rw [Circle.exp_add, ← hs] + simp + +end Arc + +/-! ### The frame -/ + +section Frame + +variable (par : ∀ C : cuffs S, Circle ≃ₜ C.1) + +/-- The short side on a cuff. -/ +noncomputable def upSide (C : cuffs S) : Set S := arcOf (par C) 0 Real.pi + +/-- The long side on a cuff. -/ +noncomputable def lowSide (C : cuffs S) : Set S := arcOf (par C) Real.pi (2 * Real.pi) + +/-- The two points of a cuff that are vertices of the frame. -/ +noncomputable def pt₀ (C : cuffs S) : S := cuffPoint (par C) 0 + +/-- The frame vertex at angle `π` on a cuff. -/ +noncomputable def pt₁ (C : cuffs S) : S := cuffPoint (par C) Real.pi + +/-- The two chosen frame vertices on each cuff, taken over all cuffs. -/ +noncomputable def frameV : Set S := ⋃ C, {pt₀ par C, pt₁ par C} + +omit [T2Space S] in +theorem cuff_subset_bd (C : cuffs S) : C.1 ⊆ bd S := by + obtain ⟨C, x, -, rfl⟩ := C + exact connectedComponentIn_subset _ _ + +omit [T2Space S] in +theorem cuffs_disjoint' {C C' : cuffs S} (hne : C ≠ C') : Disjoint C.1 C'.1 := by + obtain ⟨_, x, hx, rfl⟩ := C + obtain ⟨_, y, hy, rfl⟩ := C' + refine disjoint_left.mpr fun z hzx hzy ↦ hne (Subtype.ext ?_) + simp only + rw [connectedComponentIn_eq hzx, connectedComponentIn_eq hzy] + +theorem pi_lt : Real.pi < 0 + 2 * Real.pi := by linarith [Real.pi_pos] + +theorem two_pi_lt : 2 * Real.pi < Real.pi + 2 * Real.pi := by linarith [Real.pi_pos] + +theorem tilde_up (C : cuffs S) : tilde (upSide par C) = {pt₀ par C, pt₁ par C} := + tilde_arcOf (par C) Real.pi_pos pi_lt + +theorem tilde_low (C : cuffs S) : tilde (lowSide par C) = {pt₁ par C, pt₀ par C} := by + have h := tilde_arcOf (par C) (a := Real.pi) (b := 2 * Real.pi) (by linarith [Real.pi_pos]) + two_pi_lt + have h2 : cuffPoint (par C) (2 * Real.pi) = cuffPoint (par C) 0 := by + have := cuffPoint_add_two_pi (par C) 0 + rwa [zero_add] at this + rw [h2] at h + exact h + +theorem pt_ne (C : cuffs S) : pt₀ par C ≠ pt₁ par C := + (GM20.line_facts (isLine_arcOf (par C) Real.pi_pos pi_lt)).1 + +theorem line_up (C : cuffs S) : IsLineWithEnds (closure (upSide par C)) (pt₀ par C) (pt₁ par C) := + isLine_arcOf (par C) Real.pi_pos pi_lt + +theorem line_low (C : cuffs S) : IsLineWithEnds (closure (lowSide par C)) (pt₁ par C) (pt₀ par C) + := by + have h := isLine_arcOf (par C) (a := Real.pi) (b := 2 * Real.pi) (by linarith [Real.pi_pos]) + two_pi_lt + have h2 : cuffPoint (par C) (2 * Real.pi) = cuffPoint (par C) 0 := by + have := cuffPoint_add_two_pi (par C) 0 + rwa [zero_add] at this + rw [h2] at h + exact h + +omit [T2Space S] in +theorem up_nonempty (C : cuffs S) : (upSide par C).Nonempty := + (isPathConnected_arcOf _ Real.pi_pos).nonempty + +omit [T2Space S] in +theorem low_nonempty (C : cuffs S) : (lowSide par C).Nonempty := + (isPathConnected_arcOf _ (by linarith [Real.pi_pos])).nonempty + +omit [T2Space S] in +theorem disjoint_up_low (C : cuffs S) : Disjoint (upSide par C) (lowSide par C) := by + have hpi := Real.pi_pos + refine disjoint_left.mpr ?_ + rintro _ ⟨s, hs, rfl⟩ ⟨t, ht, he⟩ + have := cuffPoint_injOn (par C) (a := 0) (b := 2 * Real.pi) (by linarith) + ⟨hs.1.le, by linarith [hs.2]⟩ ⟨by linarith [ht.1], ht.2⟩ he.symm + linarith [hs.2, ht.1] + +/-- The sides of the frame. -/ +noncomputable def sidePieces : Set (Set S) := range (upSide par) ∪ range (lowSide par) + +omit [T2Space S] in +theorem sidePieces_mem_cases {s : Set S} (hs : s ∈ sidePieces par) : + ∃ C : cuffs S, s ⊆ C.1 ∧ s.Nonempty ∧ (s = upSide par C ∨ s = lowSide par C) := by + rcases hs with ⟨C, rfl⟩ | ⟨C, rfl⟩ + · exact ⟨C, arcOf_subset _ _ _, up_nonempty par C, Or.inl rfl⟩ + · exact ⟨C, arcOf_subset _ _ _, low_nonempty par C, Or.inr rfl⟩ + +theorem sides_eq (hS : IsSurface S) : arcComponentsIn (bd S \ frameV par) = sidePieces par := by + have hpi := Real.pi_pos + have hfin : Finite (cuffs S) := (cuff_statement S hS).2.1.to_subtype + have hVt : ∀ C : cuffs S, pt₀ par C ∈ frameV par ∧ pt₁ par C ∈ frameV par := fun C ↦ + ⟨mem_iUnion.2 ⟨C, Or.inl rfl⟩, mem_iUnion.2 ⟨C, Or.inr rfl⟩⟩ + refine arcComponentsIn_of_pieces ((finite_range _).union (finite_range _)) ?_ ?_ ?_ ?_ + · rintro s (⟨C, rfl⟩ | ⟨C, rfl⟩) + · exact isPathConnected_arcOf _ hpi + · exact isPathConnected_arcOf _ (by linarith) + · intro s hs t ht hne + obtain ⟨C, hsC, -, hs'⟩ := sidePieces_mem_cases par hs + obtain ⟨C', htC, -, ht'⟩ := sidePieces_mem_cases par ht + by_cases hCC : C = C' + · subst hCC + rcases hs' with rfl | rfl <;> rcases ht' with rfl | rfl + · exact absurd rfl hne + · exact disjoint_up_low par C + · exact (disjoint_up_low par C).symm + · exact absurd rfl hne + · exact (cuffs_disjoint' hCC).mono hsC htC + · rintro s (⟨C, rfl⟩ | ⟨C, rfl⟩) x ⟨hx, hxW⟩ + · by_contra hn + have : x ∈ tilde (upSide par C) := ⟨hx, hn⟩ + rw [tilde_up] at this + rcases this with rfl | rfl + · exact hxW.2 (hVt C).1 + · exact hxW.2 (hVt C).2 + · by_contra hn + have : x ∈ tilde (lowSide par C) := ⟨hx, hn⟩ + rw [tilde_low] at this + rcases this with rfl | rfl + · exact hxW.2 (hVt C).2 + · exact hxW.2 (hVt C).1 + · ext x + constructor + · rintro ⟨hx, hxV⟩ + let C : cuffs S := ⟨_, x, hx, rfl⟩ + have hxC : x ∈ C.1 := mem_connectedComponentIn hx + obtain ⟨t, ht, he⟩ := exists_angle_in (par C) 0 ⟨x, hxC⟩ + have he' : cuffPoint (par C) t = x := he + rcases eq_or_lt_of_le ht.1 with rfl | h0 + · exact absurd (he' ▸ (hVt C).1) hxV + rcases lt_trichotomy t Real.pi with h1 | rfl | h1 + · exact ⟨_, Or.inl ⟨C, rfl⟩, t, ⟨h0, h1⟩, he'⟩ + · exact absurd (he' ▸ (hVt C).2) hxV + · exact ⟨_, Or.inr ⟨C, rfl⟩, t, ⟨h1, by linarith [ht.2]⟩, he'⟩ + · rintro ⟨s, hs, hx⟩ + obtain ⟨C, hsC, -, hs'⟩ := sidePieces_mem_cases par hs + refine ⟨cuff_subset_bd C (hsC hx), fun hxV ↦ ?_⟩ + obtain ⟨C', hC'⟩ := mem_iUnion.mp hxV + have hxC' : x ∈ C'.1 := by + rcases hC' with rfl | rfl <;> exact cuffPoint_mem _ _ + by_cases hCC : C = C' + · subst hCC + rcases hs' with rfl | rfl + · have : x ∉ tilde (upSide par C) := fun h ↦ h.2 hx + rw [tilde_up] at this + exact this hC' + · have : x ∉ tilde (lowSide par C) := fun h ↦ h.2 hx + rw [tilde_low] at this + rcases hC' with h | h + · exact this (Or.inr h) + · exact this (Or.inl h) + · exact disjoint_left.mp (cuffs_disjoint' hCC) (hsC hx) hxC' + +omit [T2Space S] in +theorem up_injective : Function.Injective (upSide par) := fun C C' he ↦ by + by_contra hne + obtain ⟨x, hx⟩ := up_nonempty par C + exact disjoint_left.mp (cuffs_disjoint' hne) (arcOf_subset _ _ _ hx) + (arcOf_subset _ _ _ (he ▸ hx)) + +omit [T2Space S] in +theorem low_injective : Function.Injective (lowSide par) := fun C C' he ↦ by + by_contra hne + obtain ⟨x, hx⟩ := low_nonempty par C + exact disjoint_left.mp (cuffs_disjoint' hne) (arcOf_subset _ _ _ hx) + (arcOf_subset _ _ _ (he ▸ hx)) + +omit [T2Space S] in +theorem up_ne_low (C C' : cuffs S) : upSide par C ≠ lowSide par C' := fun he ↦ by + by_cases hCC : C = C' + · subst hCC + obtain ⟨x, hx⟩ := up_nonempty par C + exact disjoint_left.mp (disjoint_up_low par C) hx (he ▸ hx) + · obtain ⟨x, hx⟩ := up_nonempty par C + exact disjoint_left.mp (cuffs_disjoint' hCC) (arcOf_subset _ _ _ hx) + (arcOf_subset _ _ _ (he ▸ hx)) + +/-- The direction of each side of the frame. -/ +noncomputable def sideγ (s : Set S) : List S := + open Classical in + if h : ∃ C, upSide par C = s then [pt₀ par h.choose, pt₁ par h.choose] + else if h : ∃ C, lowSide par C = s then [pt₁ par h.choose, pt₀ par h.choose] + else [] + +omit [T2Space S] in +theorem sideγ_up (C : cuffs S) : sideγ par (upSide par C) = [pt₀ par C, pt₁ par C] := by + have h : ∃ C', upSide par C' = upSide par C := ⟨C, rfl⟩ + rw [sideγ, dite_eq_left h, up_injective par h.choose_spec] + +omit [T2Space S] in +theorem sideγ_low (C : cuffs S) : sideγ par (lowSide par C) = [pt₁ par C, pt₀ par C] := by + have h₁ : ¬ ∃ C', upSide par C' = lowSide par C := fun ⟨C', h⟩ ↦ up_ne_low par C' C h + have h : ∃ C', lowSide par C' = lowSide par C := ⟨C, rfl⟩ + rw [sideγ, dite_eq_right h₁, dite_eq_left h, low_injective par h.choose_spec] + +theorem side_line {s : Set S} (hs : s ∈ sidePieces par) : + ∃ x y, x ≠ y ∧ sideγ par s = [x, y] ∧ tilde s = {x, y} ∧ IsLineWithEnds (closure s) x y := by + rcases hs with ⟨C, rfl⟩ | ⟨C, rfl⟩ + · exact ⟨_, _, pt_ne par C, sideγ_up par C, tilde_up par C, line_up par C⟩ + · exact ⟨_, _, (pt_ne par C).symm, sideγ_low par C, tilde_low par C, line_low par C⟩ + +/-- The frame in the proof of (2.1). -/ +noncomputable def stdFrame (hS : IsSurface S) : Frame S where + V := frameV par + γ := sideγ par + isLong s := s ∈ range (lowSide par) + V_subset := by + refine iUnion_subset fun C x hx ↦ ?_ + rcases hx with rfl | rfl <;> exact cuff_subset_bd C (cuffPoint_mem _ _) + finite_V := by + have : Finite (cuffs S) := (cuff_statement S hS).2.1.to_subtype + exact finite_iUnion fun C ↦ (finite_singleton _).insert _ + finite_sides := by + have : Finite (cuffs S) := (cuff_statement S hS).2.1.to_subtype + rw [sides_eq par hS] + exact (finite_range _).union (finite_range _) + side_shape := by + rw [sides_eq par hS] + intro s hs + obtain ⟨x, y, hxy, -, ht, hL⟩ := side_line par hs + obtain ⟨f, hf⟩ := id hL + exact ⟨by rw [ht, ncard_pair hxy], by rw [ht]; exact (finite_singleton y).insert x, ⟨f⟩, + by rw [ht]; exact (GM20.line_facts hL).2.2.2⟩ + γ_nodup := by + rw [sides_eq par hS] + intro s hs + obtain ⟨x, y, hxy, hγ, -, -⟩ := side_line par hs + rw [hγ] + simpa using hxy + γ_set := by + rw [sides_eq par hS] + intro s hs + obtain ⟨x, y, hxy, hγ, ht, -⟩ := side_line par hs + rw [hγ, ht] + ext z + simp + long_disjoint := by + rw [sides_eq par hS] + rintro _ - _ - hne ⟨C, rfl⟩ ⟨C', rfl⟩ + have hCC : C ≠ C' := fun h ↦ hne (by rw [h]) + rw [tilde_low, tilde_low] + refine (cuffs_disjoint' hCC).mono ?_ ?_ + · rintro _ (rfl | rfl) <;> exact cuffPoint_mem _ _ + · rintro _ (rfl | rfl) <;> exact cuffPoint_mem _ _ + +theorem stdFrame_short (hS : IsSurface S) {t : Set S} (ht : t ∈ (stdFrame par hS).shortSides) : + ∃ C, t = upSide par C := by + obtain ⟨hs, hl⟩ := ht + change t ∈ arcComponentsIn (bd S \ frameV par) at hs + rw [sides_eq par hS] at hs + rcases hs with ⟨C, rfl⟩ | h + · exact ⟨C, rfl⟩ + · exact absurd h hl + +/-- Either order of the ends of a line in a side agrees with the direction of the side. -/ +theorem dirAgrees_or (hS : IsSurface S) {s e : Set S} (hs : s ∈ (stdFrame par hS).sides) {x y : S} + (hxy : x ≠ y) (hes : e ⊆ s) (hx : x ∈ closure s) (hy : y ∈ closure s) : + DirAgrees s ((stdFrame par hS).γ s) e [x, y] ∨ DirAgrees s ((stdFrame par hS).γ s) e [y, x] + := by + change s ∈ arcComponentsIn (bd S \ frameV par) at hs + rw [sides_eq par hS] at hs + obtain ⟨u, v, -, hγ, -, f, hf0, hf1⟩ := side_line par hs + change Set.Icc (0 : ℝ) 1 ≃ₜ closure s at f + have hG : (stdFrame par hS).γ s = [u, v] := hγ + rw [hG] + let a := f.symm ⟨x, hx⟩ + let b := f.symm ⟨y, hy⟩ + have hfa : (f a).1 = x := by simp [a] + have hfb : (f b).1 = y := by simp [b] + have hne : a ≠ b := fun h ↦ hxy (by rw [← hfa, ← hfb, h]) + rcases lt_or_gt_of_ne hne with h | h + · exact Or.inl ⟨f, a, b, h, hes, by simpa using hf0.symm, by simpa using hf1.symm, + by simpa using hfa.symm, by simpa using hfb.symm⟩ + · exact Or.inr ⟨f, b, a, h, hes, by simpa using hf0.symm, by simpa using hf1.symm, + by simpa using hfb.symm, by simpa using hfa.symm⟩ + +end Frame + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FrameMove.lean b/LeanPool/GraphMinor/GM19/FrameMove.lean new file mode 100644 index 0000000000..f058d0b64d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FrameMove.lean @@ -0,0 +1,301 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FrameExists + +/-! +# Moving a painting onto the frame + +For each cuff, a painting has a border edge on it. An arc of the cuff moves onto the short side, by +a +homeomorphism of the circle that preserves orientation, and this extends to the surface by +`move_cuff`. The +composite homeomorphism has null signature. This is "a suitable homeomorphism of $\Sigma$ to itself" +in the proof of +Graph Minors XIX, (2.1). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +/-! ### Edges on a cuff -/ + +omit [T2Space S] in +theorem exists_edge_on_cuff (Γ : Painting S) (C : cuffs S) (f : Circle ≃ₜ C.1) : + ∃ e ∈ Γ.E, e ⊆ C.1 ∧ Painting.IsBorder e := by + have hpi := Real.pi_pos + have hinf : (arcOf f 0 1).Infinite := by + refine (Ioo_infinite (zero_lt_one' ℝ)).image ?_ + refine (cuffPoint_injOn_Icc f (a := 0) (b := 1) (by linarith [Real.pi_gt_three])).mono ?_ + exact Ioo_subset_Icc_self + obtain ⟨x, hx, hxV⟩ := (hinf.sdiff Γ.finite_V).nonempty + have hxC : x ∈ C.1 := arcOf_subset f _ _ hx + have hxb : x ∈ bd S := cuff_subset_bd C hxC + have hm : x ∈ Γ.U \ Γ.V := ⟨Γ.bd_subset hxb, hxV⟩ + have hc : pathComponentIn (Γ.U \ Γ.V) x ∈ Γ.E := Surface.mem_arcComponentsIn_of_mem hm + have hxc : x ∈ pathComponentIn (Γ.U \ Γ.V) x := mem_pathComponentIn_self hm + have hbo : Painting.IsBorder (pathComponentIn (Γ.U \ Γ.V) x) := ⟨x, hxc, hxb⟩ + refine ⟨_, hc, ?_, hbo⟩ + have key : ∀ C' ∈ cuffs S, x ∈ C' → C' = connectedComponentIn (bd S) x := by + rintro _ ⟨y, -, rfl⟩ hx' + exact connectedComponentIn_eq hx' + rw [key _ C.2 hxC] + exact hc.2.2.1.isConnected.isPreconnected.subset_connectedComponentIn hxc + (Γ.border_edge _ hc hbo).2 + +theorem arc_eq_of_mem {Θ e : Set S} (f : Circle ≃ₜ Θ) {a b : ℝ} (hab : a < b) + (hb : b < a + 2 * Real.pi) (he : IsPathConnected e) (heΘ : e ⊆ Θ) (hcl : closure e ⊆ Θ) + (hL : IsLineWithEnds (closure e) (cuffPoint f a) (cuffPoint f b)) + (ht : tilde e = {cuffPoint f a, cuffPoint f b}) {z : S} (hz : z ∈ e) + (hza : z ∈ arcOf f a b) : e = arcOf f a b := by + have hF : IsOArc Θ := ⟨f⟩ + have hLA := isLine_arcOf f hab hb + have htA := tilde_arcOf f hab hb + have hsubA : arcOf f a b ⊆ Θ \ {cuffPoint f a, cuffPoint f b} := fun x hx ↦ + ⟨arcOf_subset f _ _ hx, fun hm ↦ (htA ▸ hm : x ∈ tilde (arcOf f a b)).2 hx⟩ + have hsube : e ⊆ Θ \ {cuffPoint f a, cuffPoint f b} := fun x hx ↦ + ⟨heΘ hx, fun hm ↦ (ht ▸ hm : x ∈ tilde e).2 hx⟩ + have hc₁ : closure (arcOf f a b) ⊆ Θ := + closure_minimal (arcOf_subset f _ _) (IsOArc.isCompact hF).isClosed + apply Subset.antisymm + · intro x hx + have := subset_line_of_preconnected hF hLA hc₁ he.isConnected.isPreconnected hsube hz + (subset_closure hza) hx + by_contra hn + have hm : x ∈ tilde (arcOf f a b) := ⟨this, hn⟩ + rw [htA] at hm + exact (hsube hx).2 hm + · intro x hx + have := subset_line_of_preconnected hF hL hcl + (isPathConnected_arcOf f hab).isConnected.isPreconnected hsubA hza (subset_closure hz) hx + by_contra hn + have hm : x ∈ tilde e := ⟨this, hn⟩ + rw [ht] at hm + exact (hsubA hx).2 hm + +/-- A border edge on a cuff is an open arc of the cuff, as read through any parametrization. -/ +theorem edge_arc (Γ : Painting S) {e Θ : Set S} (f : Circle ≃ₜ Θ) (he : e ∈ Γ.E) + (h2 : (tilde e).ncard = 2) (heΘ : e ⊆ Θ) : + ∃ α θ : ℝ, θ ∈ Ioo 0 (2 * Real.pi) ∧ e = arcOf f α (α + θ) := by + have hpi := Real.pi_pos + have hF : IsOArc Θ := ⟨f⟩ + have hcl : closure e ⊆ Θ := closure_minimal heΘ (IsOArc.isCompact hF).isClosed + obtain ⟨g, hne, ht⟩ := Γ.exists_line he h2 + have hL : IsLineWithEnds (closure e) (g 0).1 (g 1).1 := ⟨g, rfl, rfl⟩ + obtain ⟨a, ha, hax⟩ := exists_angle_in f 0 ⟨(g 0).1, hcl (g 0).2⟩ + obtain ⟨b, hb, hby⟩ := exists_angle_in f a ⟨(g 1).1, hcl (g 1).2⟩ + change cuffPoint f a = _ at hax + change cuffPoint f b = _ at hby + rw [← hax, ← hby] at hL ht + have hab : a < b := by + rcases eq_or_lt_of_le hb.1 with h | h + · exact absurd (by rw [← hax, ← hby, h]) hne + · exact h + have hb2 := hb.2 + obtain ⟨z, hz⟩ := he.1 + have hzΘ := heΘ hz + obtain ⟨t, ht₁, htz⟩ := exists_angle_in f a ⟨z, hzΘ⟩ + change cuffPoint f t = z at htz + have hza : t ≠ a := fun h ↦ by + have : z ∈ tilde e := ht ▸ Or.inl (by rw [← htz, h]) + exact this.2 hz + have hzb : t ≠ b := fun h ↦ by + have : z ∈ tilde e := ht ▸ Or.inr (by rw [← htz, h]; rfl) + exact this.2 hz + have hta : a < t := lt_of_le_of_ne ht₁.1 (Ne.symm hza) + rcases lt_or_gt_of_ne hzb with h | h + · exact ⟨a, b - a, ⟨by linarith, by linarith⟩, by + rw [add_sub_cancel] + exact arc_eq_of_mem f hab hb2 he.2.2.1 heΘ hcl hL ht hz ⟨t, ⟨hta, h⟩, htz⟩⟩ + · have hend : cuffPoint f (a + 2 * Real.pi) = cuffPoint f a := cuffPoint_add_two_pi f a + refine ⟨b, a + 2 * Real.pi - b, ⟨by linarith, by linarith⟩, ?_⟩ + rw [add_sub_cancel] + refine arc_eq_of_mem f (a := b) (b := a + 2 * Real.pi) hb2 (by linarith) he.2.2.1 heΘ hcl + ?_ ?_ hz ⟨t, ⟨h, ht₁.2⟩, htz⟩ + · rw [hend] + exact GM11.IsLineWithEnds.symm hL + · rw [hend, ht, pair_comm] + +/-! ### One cuff at a time -/ + +/-- Each homeomorphism of a surface that moves `Θ` along an orientation preserving homeomorphism of +the +circle. -/ +def MovesAlong (h : S ≃ₜ S) {Θ : Set S} (f : Circle ≃ₜ Θ) : Prop := + ∃ ψ : Circle ≃ₜ Circle, PreservesCircleOrientation ψ ∧ ∀ z, h (f z).1 = (f (ψ z)).1 + +omit [T2Space S] in +theorem MovesAlong.symm {h : S ≃ₜ S} {Θ : Set S} {f : Circle ≃ₜ Θ} (hm : MovesAlong h f) : + MovesAlong h.symm f := by + obtain ⟨ψ, hψ, he⟩ := hm + refine ⟨ψ.symm, preserves_symm hψ, fun z ↦ ?_⟩ + rw [Homeomorph.symm_apply_eq, he] + simp + +omit [T2Space S] in +theorem MovesAlong.trans {h h' : S ≃ₜ S} {Θ : Set S} {f : Circle ≃ₜ Θ} (hm : MovesAlong h f) + (hm' : MovesAlong h' f) : MovesAlong (h.trans h') f := by + obtain ⟨ψ, ⟨l, lc, lm, hl⟩, he⟩ := hm + obtain ⟨ψ', ⟨l', lc', lm', hl'⟩, he'⟩ := hm' + refine ⟨ψ.trans ψ', ⟨l' ∘ l, lc'.comp lc, lm'.comp lm, fun t ↦ ?_⟩, fun z ↦ ?_⟩ + · simp only [Homeomorph.trans_apply, Function.comp] + rw [hl, hl'] + · simp only [Homeomorph.trans_apply] + rw [he, he'] + +omit [T2Space S] in +theorem movesAlong_refl {Θ : Set S} (f : Circle ≃ₜ Θ) : MovesAlong (Homeomorph.refl S) f := + ⟨Homeomorph.refl _, ⟨id, continuous_id, strictMono_id, fun _ ↦ rfl⟩, fun _ ↦ rfl⟩ + +omit [T2Space S] in +theorem movesAlong_of_fix {h : S ≃ₜ S} {Θ : Set S} (f : Circle ≃ₜ Θ) (hfix : ∀ x ∈ Θ, h x = x) : + MovesAlong h f := + ⟨Homeomorph.refl _, ⟨id, continuous_id, strictMono_id, fun _ ↦ rfl⟩, fun z ↦ hfix _ (f z).2⟩ + +omit [T2Space S] in +/-- A homeomorphism that moves each cuff along one parametrization has null signature. -/ +theorem hasNullSignature_of_moves {h : S ≃ₜ S} {par : ∀ C : cuffs S, Circle ≃ₜ C.1} + (hm : ∀ C, MovesAlong h (par C)) : HasNullSignature h := by + intro C φ hC + obtain ⟨ψ, hψ, he⟩ := hm ⟨C, hC⟩ + let τ : Circle ≃ₜ Circle := φ.trans (par ⟨C, hC⟩).symm + refine ⟨τ.trans (ψ.trans τ.symm), preserves_conj τ hψ, fun x ↦ ?_⟩ + have h1 : (φ x).1 = ((par ⟨C, hC⟩) (τ x)).1 := by simp [τ] + rw [h1, he] + simp [τ] + +variable (par : ∀ C : cuffs S, Circle ≃ₜ C.1) + +theorem isClosed_cuff (hS : IsSurface S) (C : cuffs S) : IsClosed C.1 := + (IsOArc.isCompact ((cuff_statement S hS).2.2 C.1 C.2)).isClosed + +theorem exists_move_one (hS : IsSurface S) (C : cuffs S) {e : Set S} {α θ : ℝ} + (hθ : θ ∈ Ioo 0 (2 * Real.pi)) (he : e = arcOf (par C) α (α + θ)) : + ∃ h : S ≃ₜ S, MovesAlong h (par C) ∧ (∀ C', C' ≠ C → ∀ x ∈ C'.1, h x = x) ∧ + h '' e = upSide par C := by + have hpi := Real.pi_pos + obtain ⟨ψ, hψ, hs⟩ := exists_circle_move (Circle.exp α) hθ + have hopen : IsOpen (bd S \ C.1)ᶜ := by + refine (?_ : IsClosed (bd S \ C.1)).isOpen_compl + have heq : bd S \ C.1 = ⋃ C' ∈ {C' : cuffs S | C' ≠ C}, C'.1 := by + ext x + constructor + · rintro ⟨hx, hn⟩ + exact mem_iUnion₂.2 ⟨⟨_, x, hx, rfl⟩, fun h ↦ hn (by + rw [← h] + exact mem_connectedComponentIn hx), mem_connectedComponentIn hx⟩ + · intro hx + obtain ⟨C', hC', hxC⟩ := mem_iUnion₂.mp hx + exact ⟨cuff_subset_bd C' hxC, disjoint_left.mp (cuffs_disjoint' hC') hxC⟩ + rw [heq] + have : Finite (cuffs S) := (cuff_statement S hS).2.1.to_subtype + exact (Set.toFinite _).isClosed_biUnion fun C' _ ↦ isClosed_cuff hS C' + obtain ⟨h, hh, hfix⟩ := move_cuff S C.1 (bd S \ C.1)ᶜ (par C) ψ hS C.2 hopen + (fun x hx hn ↦ hn.2 hx) hψ + have hstep : ∀ s ∈ Icc 0 θ, h (cuffPoint (par C) (α + s)) = cuffPoint (par C) (Real.pi * (s / θ)) + := by + intro s hsm + simp only [cuffPoint] + rw [hh, Circle.exp_add, hs s hsm] + refine ⟨h, ⟨ψ, hψ, hh⟩, fun C' hne x hx ↦ hfix x ?_, ?_⟩ + · intro hU + exact hU ⟨cuff_subset_bd C' hx, disjoint_left.mp (cuffs_disjoint' hne) hx⟩ + · rw [he] + ext y + constructor + · rintro ⟨_, ⟨t, ht, rfl⟩, rfl⟩ + have hs₀ : t - α ∈ Ioo 0 θ := ⟨by linarith [ht.1], by linarith [ht.2]⟩ + have hrw := hstep (t - α) ⟨hs₀.1.le, hs₀.2.le⟩ + rw [add_sub_cancel] at hrw + rw [hrw] + refine ⟨_, ⟨by + have := div_pos hs₀.1 hθ.1 + positivity, ?_⟩, rfl⟩ + have : (t - α) / θ < 1 := (div_lt_one hθ.1).mpr hs₀.2 + nlinarith + · rintro ⟨t, ht, rfl⟩ + have ht' : θ * (t / Real.pi) ∈ Ioo 0 θ := by + have h1 : 0 < t / Real.pi := div_pos ht.1 hpi + have h2 : t / Real.pi < 1 := (div_lt_one hpi).mpr ht.2 + exact ⟨mul_pos hθ.1 h1, by nlinarith [hθ.1]⟩ + refine ⟨cuffPoint (par C) (α + θ * (t / Real.pi)), ⟨_, ⟨by linarith [ht'.1], + by linarith [ht'.2]⟩, + rfl⟩, ?_⟩ + rw [hstep _ ⟨ht'.1.le, ht'.2.le⟩] + have h3 : θ * (t / Real.pi) / θ = t / Real.pi := mul_div_cancel_left₀ _ hθ.1.ne' + rw [h3, mul_div_cancel₀ _ hpi.ne'] + +/-- All the cuffs at once. -/ +theorem exists_move (hS : IsSurface S) (Γ : Painting S) : + ∃ h : S ≃ₜ S, (∀ C, MovesAlong h (par C)) ∧ + ∀ C, ∃ e ∈ Γ.E, e ⊆ C.1 ∧ (tilde e).ncard = 2 ∧ h '' e = upSide par C := by + have : Finite (cuffs S) := (cuff_statement S hS).2.1.to_subtype + have := Fintype.ofFinite (cuffs S) + classical + have main : ∀ s : Finset (cuffs S), ∃ h : S ≃ₜ S, (∀ C, MovesAlong h (par C)) ∧ + (∀ C, C ∉ s → ∀ x ∈ C.1, h x = x) ∧ + ∀ C ∈ s, ∃ e ∈ Γ.E, e ⊆ C.1 ∧ (tilde e).ncard = 2 ∧ h '' e = upSide par C := by + intro s + induction s using Finset.induction_on with + | empty => + exact ⟨Homeomorph.refl S, fun C ↦ movesAlong_refl _, fun _ _ _ _ ↦ rfl, fun C hC ↦ + absurd hC (by simp)⟩ + | insert C s hCs ih => + obtain ⟨h, h₁, h₂, h₃⟩ := ih + obtain ⟨e, he, heC, hbo⟩ := exists_edge_on_cuff Γ C (par C) + have h2 := size_two_of_border Γ he hbo + obtain ⟨α, θ, hθ, heq⟩ := edge_arc Γ (par C) he h2 heC + obtain ⟨k, k₁, k₂, k₃⟩ := exists_move_one par hS C hθ heq + refine ⟨h.trans k, fun C' ↦ ?_, fun C' hC' x hx ↦ ?_, fun C' hC' ↦ ?_⟩ + · refine (h₁ C').trans ?_ + by_cases hCC : C' = C + · subst hCC + exact k₁ + · exact movesAlong_of_fix _ (k₂ C' hCC) + · have hne : C' ≠ C := fun he ↦ hC' (by simp [he]) + have hns : C' ∉ s := fun he ↦ hC' (by simp [he]) + change k (h x) = x + rw [h₂ C' hns x hx, k₂ C' hne x hx] + · by_cases hCC : C' = C + · subst hCC + refine ⟨e, he, heC, h2, ?_⟩ + have : (h.trans k) '' e = k '' (h '' e) := by + rw [← image_comp] + rfl + rw [this, ← k₃] + congr 1 + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + rwa [h₂ C' hCs x (heC hx)] + · intro hy + exact ⟨y, hy, h₂ C' hCs y (heC hy)⟩ + · have hs : C' ∈ s := by simpa [hCC] using hC' + obtain ⟨e', he', hsub, h2', himg⟩ := h₃ C' hs + refine ⟨e', he', hsub, h2', ?_⟩ + have : (h.trans k) '' e' = k '' (h '' e') := by + rw [← image_comp] + rfl + rw [this, himg] + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + rwa [k₂ C' hCC x (arcOf_subset _ _ _ hx)] + · intro hy + exact ⟨y, hy, k₂ C' hCC y (arcOf_subset _ _ _ hy)⟩ + obtain ⟨h, h₁, -, h₃⟩ := main Finset.univ + exact ⟨h, h₁, fun C ↦ h₃ C (Finset.mem_univ C)⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FreeData.lean b/LeanPool/GraphMinor/GM19/FreeData.lean new file mode 100644 index 0000000000..e9b9d2a82d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FreeData.lean @@ -0,0 +1,826 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FreeFlaw + +/-! +# The data of a freedom flaw + +From a flaw circuit `F` we make the drawing `K` of `F ∩ Σ`, with the vertices of `Γ` as its only +vertices, and the closed disc `Z`. +`K` has at most `½|E(F)|` vertices, and this is what the count of `fragScheme_isRefinement` needs. +If `F` misses the poles then `Z` is +`ins(F)`. If `F` runs through the pole of a cuff disc `E`, then `Z` is `ins(F)` with the half of `E` +outside `ins(F)` added +(`exists_outer_half`). The result used later is `exists_free_data`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +/-- The drawing on `U₀` whose vertices are the vertices of `Γ` on `U₀`. -/ +def coarseDrawing (Γ : Painting S) (U₀ : Set S) (hc : IsClosed U₀) (hfe : (arcComponentsIn (U₀ \ + (U₀ ∩ Γ.V))).Finite) + (hm : ∀ e ∈ arcComponentsIn (U₀ \ (U₀ ∩ Γ.V)), IsMarkedArc (U₀ ∩ Γ.V) e) : Drawing S where + U := U₀ + V := U₀ ∩ Γ.V + V_subset_U := inter_subset_left + isClosed_U := hc + finite_V := Γ.finite_V.subset inter_subset_right + finite_edges := hfe + edge_cond := fun e he ↦ Or.inl (hm e he) + +namespace TangleDatum + +variable {D : TangleDatum cap χ} + +omit [T2Space S] [T2Space Shat] in +/-- `F ∩ Σ` holds at most `½|E(F)|` vertices of `Γ`. -/ +theorem two_mul_ncard_le (D : TangleDatum cap χ) {F : Drawing Shat} (hF : F.IsCircuitOf D.rad.G) + {U₀ : Set S} (hU : ∀ x ∈ U₀, cap.emb x ∈ F.U) : + 2 * (U₀ ∩ D.P.Γ.V).ncard ≤ F.E.ncard := by + have : ConnectedSpace Shat := cap.connected + rw [D.ncard_E_eq_hat hF, ← ncard_image_of_injective _ cap.isEmbedding.injective] + refine Nat.mul_le_mul_left 2 (ncard_le_ncard ?_ (F.finite_V.subset inter_subset_left)) + rintro _ ⟨x, hx, rfl⟩ + have hh : cap.emb x ∈ D.P.Γ.hatV cap := mem_image_of_mem _ hx.2 + exact ⟨mem_V_of_mem_U hF.1 (hU x hx.1) (D.rad.isPreRadial.2.1 hh), hh⟩ + +omit [T2Space S] in +omit [T2Space Shat] in +/-- The flaw gives the count of `FreeFacts`. -/ +theorem free_count {n : ℕ} {F : Drawing Shat} (hF : D.IsFreeCircuit n F) {K : Drawing S} + (hK : 2 * K.V.ncard ≤ F.E.ncard) {In : Set S} + (hIn : cap.emb ⁻¹' D.ins F ⊆ In) : (∃ s ∈ χ.Φ.longSides, s ⊆ In) ∨ K.V.ncard < + (χ.Φ.V ∩ In).ncard := by + rcases hF.2.2 with ⟨s, hs, hsub⟩ | hlt + · exact Or.inl ⟨s, hs, (image_subset_iff.1 hsub).trans hIn⟩ + · right + have h₁ : ((cap.emb '' χ.Φ.V) ∩ D.ins F).ncard ≤ (χ.Φ.V ∩ In).ncard := by + rw [← ncard_image_of_injective (χ.Φ.V ∩ In) cap.isEmbedding.injective] + refine ncard_le_ncard ?_ ((χ.Φ.finite_V.subset inter_subset_left).image _) + rintro _ ⟨⟨x, hx, rfl⟩, hxi⟩ + exact mem_image_of_mem _ ⟨hx, hIn hxi⟩ + omega + +variable (hS : IsSurface S) (h3 : D.P.Γ.IsInternallyThreeConnected) +include hS h3 + +/-- **The facts about `K` that do not depend on the shape.** -/ +theorem free_data_of_cut {n : ℕ} (hn : n < D.rep) {F : Drawing Shat} (hF : D.IsFreeCircuit n F) + (hlink : GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins F)) + (partIn cap D.P.Γ (closure (D.ins F)ᶜ))) {U₀ : Set S} + (hc : IsClosed U₀) (hfe : (arcComponentsIn (U₀ \ (U₀ ∩ D.P.Γ.V))).Finite) + (hm : ∀ e ∈ arcComponentsIn (U₀ \ (U₀ ∩ D.P.Γ.V)), IsMarkedArc (U₀ ∩ D.P.Γ.V) e) + (hUF : cap.emb ⁻¹' F.U = U₀) + (hdense : U₀ ⊆ closure (U₀ \ (U₀ ∩ D.P.Γ.V))) (hcard : (arcComponentsIn (U₀ \ + (U₀ ∩ D.P.Γ.V))).ncard ≤ (U₀ ∩ D.P.Γ.V).ncard) {Z : Set Shat} + (hshape : IsFreeShape cap χ.Φ (coarseDrawing D.P.Γ U₀ hc hfe hm) Z) + (hint : cap.emb ⁻¹' discInt Z = cap.emb ⁻¹' discInt (D.ins F)) + (hpieces : ∃ 𝓞 𝓛 : Set (Set S), 𝓞.Finite ∧ 𝓛.Finite ∧ (∀ C ∈ 𝓞, IsOArc C) ∧ + (∀ L ∈ 𝓛, ∃ s t, s ≠ t ∧ IsLineWithEnds L s t ∧ s ∈ bd S ∪ ⋃₀ 𝓞 ∧ t ∈ bd S ∪ ⋃₀ 𝓞) ∧ U₀ + = ⋃₀ 𝓞 ∪ ⋃₀ 𝓛) + (hanc : ∀ u x, x ∈ U₀ → x ≠ u → ∃ C ⊆ U₀ \ {u}, x ∈ C ∧ IsPreconnected C ∧ + (C ∩ D.P.Γ.V).Nonempty) : + IsFreeData D n (D.ins F) Z (coarseDrawing D.P.Γ U₀ hc hfe hm) := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hle := hF.2.1 + have hlt : F.E.ncard < 2 * D.rep := by omega + have hi := D.ins_spec hF.1 hlt + have hdisc := hi.2.2.1 + have hbd : discBd (D.ins F) = F.U := hi.2.2.2.1 + have hfr : frontier (D.ins F) = F.U := by rw [IsClosedDisc.frontier_eq_discBd hT hdisc, hbd] + have hU : ∀ {x}, x ∈ U₀ ↔ cap.emb x ∈ F.U := fun {x} ↦ by rw [← hUF]; rfl + have hinter : D.P.Γ.U ∩ U₀ ⊆ D.P.Γ.V ∩ (U₀ ∩ D.P.Γ.V) := by + rintro x ⟨hxΓ, hxK⟩ + have hm' : cap.emb x ∈ D.P.Γ.hatU cap ∩ D.rad.G.U := ⟨mem_image_of_mem _ hxΓ, hF.1.1.U_subset + (hU.1 hxK)⟩ + rw [D.rad.isPreRadial.1] at hm' + obtain ⟨v, hv, hvx⟩ := hm' + obtain rfl := cap.isEmbedding.injective hvx + exact ⟨hv, hxK, hv⟩ + have hbdN : ∀ {x}, x ∈ U₀ → x ∈ bd S → x ∈ U₀ ∩ D.P.Γ.V := fun hx hb ↦ + (hinter ⟨D.P.Γ.bd_subset hb, hx⟩).2 + have hNle : 2 * (U₀ ∩ D.P.Γ.V).ncard ≤ F.E.ncard := D.two_mul_ncard_le hF.1 fun x hx ↦ hU.1 hx + have hcov : U₀ \ (U₀ ∩ D.P.Γ.V) ⊆ ⋃ e ∈ arcComponentsIn (U₀ \ (U₀ ∩ D.P.Γ.V)), e := fun x hx ↦ by + obtain ⟨c, hc', hxc⟩ := exists_arcComp_superset (isPathConnected_singleton x) + (singleton_subset_iff.2 hx) + exact mem_biUnion hc' (hxc rfl) + refine ⟨hshape, hdisc, hint, ?_, ⟨?_, ?_, ?_⟩, hinter, fun e he ↦ hm e he, ?_, hpieces, ?_, ?_, + hanc⟩ + · refine family_of_discs (finite_singleton _) (by rintro _ rfl; exact hlink) ?_ ?_ + · rintro _ rfl + have := disc_order hS h3 D.rad hF.1 hdisc hbd + omega + · rintro _ rfl _ rfl h + exact (h rfl).elim + · exact fun e he ↦ disjoint_left.2 fun x hxe hxb ↦ (he.2.1 hxe).2 (hbdN (he.2.1 hxe).1 hxb) + · intro v hv + have hvc := hdense hv.1 + have : v ∈ closure (⋃ e ∈ arcComponentsIn (U₀ \ (U₀ ∩ D.P.Γ.V)), e) := closure_mono hcov hvc + rw [hfe.closure_biUnion] at this + obtain ⟨e, he, hve⟩ := mem_iUnion₂.1 this + exact ⟨e, he, hve, fun h ↦ (he.2.1 h).2 hv⟩ + · refine fun s₀ hs₀ ↦ disjoint_left.2 fun x hx hxs ↦ ?_ + have hxb : x ∈ bd S := (hs₀.1.2.1 hxs).1 + exact D.P.Γ.disjoint_V (D.P.fits.short_sides hs₀) hxs (hbdN hx hxb).2 + · change (U₀ ∩ D.P.Γ.V).ncard + (arcComponentsIn (U₀ \ (U₀ ∩ D.P.Γ.V))).ncard ≤ 8 * n + omega + · intro v _ h₁ h₂ + have : cap.emb v ∈ frontier (D.ins F) := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure h₁, h₂⟩ + rw [hfr] at this + exact hU.2 this + · intro v hv + have : cap.emb v ∈ frontier (D.ins F) := hfr ▸ hU.1 hv + rw [frontier_eq_closure_inter_closure] at this + exact this.2 + +/-- A least flaw circuit has a pole inside. Without one, each cuff would touch `ins(F)` in at most +one point, so `ins(F)` would hold no long +side and no vertices of the frame off `F`. -/ +theorem exists_pole_ins {n : ℕ} (hn : n < D.rep) {F : Drawing Shat} (hF : D.IsFreeCircuit n F) + (hmin : ∀ C, D.IsFreeCircuit n C → F.E.ncard ≤ C.E.ncard ∧ (F.E.ncard = C.E.ncard + → D.insCount C ≤ D.insCount F)) : + ∃ r ∈ D.rad.poles, r ∈ D.ins F := by + classical + have : ConnectedSpace Shat := cap.connected + have hle := hF.2.1 + have hlt : F.E.ncard < 2 * D.rep := by omega + have hi := D.ins_spec hF.1 hlt + by_contra hno + push Not at hno + have hnp : ∀ z ∈ F.V, z ∉ D.rad.poles := fun z hz hzp ↦ hno z hzp (D.U_subset_ins hF.1 hlt + (F.V_subset_U hz)) + have hrange := subset_range_of_no_pole D.rad hF.1.1 hnp + have hall : ∀ Θ ∈ cuffs S, (closure (cap.cuffDisc Θ) ∩ D.ins F).Subsingleton ∧ closure + (cap.cuffDisc Θ) ∩ D.ins F ⊆ F.U := fun Θ hΘ ↦ by + obtain ⟨p, hp, -, hreg⟩ := D.rad.exists_pole hΘ + have hdis : Disjoint (cap.cuffDisc Θ) F.U := disjoint_left.2 fun x hx hxF ↦ cap.notMem_range hΘ + hx (hrange hxF) + exact ⟨touch_subsingleton hS h3 hn hF hmin hp (hno p hp) hΘ hreg hdis, + fun x hx ↦ D.cuff_inter_ins_of_disjoint hF.1 hlt hp (hno p hp) hreg hdis hx.1 hx.2⟩ + rcases hF.2.2 with ⟨s, hs, hsub⟩ | hlt' + · obtain ⟨Θ, hΘ, hsΘ, u, v, huv, hset, -⟩ := Frame.side_on_cuff hS χ.Φ hs.1 + have hcl : closure s ⊆ cap.emb ⁻¹' D.ins F ∩ Θ := closure_minimal (fun x hx ↦ ⟨hsub + (mem_image_of_mem _ hx), hsΘ hx⟩) + ((hi.2.2.1.isClosed.preimage cap.isEmbedding.continuous).inter (isClosed_cuff hS ⟨Θ, hΘ⟩)) + have hu : u ∈ closure s := (hset ▸ mem_insert u {v} : u ∈ closure s ∩ (χ.Φ.V ∩ Θ)).1 + have hv : v ∈ closure s := (hset ▸ mem_insert_of_mem u rfl : v ∈ closure s ∩ (χ.Φ.V ∩ Θ)).1 + have h₁ := hcl hu + have h₂ := hcl hv + exact huv (cap.isEmbedding.injective ((hall Θ hΘ).1 ⟨cap.mem_closure_emb hΘ h₁.2, + h₁.1⟩ ⟨cap.mem_closure_emb hΘ h₂.2, h₂.1⟩)) + · have hsub : (cap.emb '' χ.Φ.V) ∩ D.ins F ⊆ F.V ∩ D.P.Γ.hatV cap := by + rintro _ ⟨⟨v, hv, rfl⟩, hvi⟩ + have hvb := χ.Φ.V_subset hv + have hΘ : connectedComponentIn (bd S) v ∈ cuffs S := ⟨v, hvb, rfl⟩ + have hF' := (hall _ hΘ).2 ⟨cap.mem_closure_emb hΘ (mem_connectedComponentIn hvb), hvi⟩ + exact ⟨(D.rad.bd_point hF.1.1 hvb hF').2.1, mem_image_of_mem _ (D.P.fits.V_subset hv)⟩ + have h₁ := ncard_le_ncard hsub (F.finite_V.subset inter_subset_left) + have h₂ := D.ncard_E_eq_hat hF.1 + omega + +omit hS h3 in +private theorem pole_edges_form_boundary_line + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [TopologicalSpace Shat] + [T2Space Shat] + {cap : IsCappedSurface S Shat} + {β : Type w} + {χ : ColourScheme S β} + {D : TangleDatum cap χ} + {F : Drawing Shat} {r : Shat} {e₁ e₂ : Set Shat} {v₁ v₂ : S} + (hr : r ∈ D.rad.poles) (he₁ : e₁ ∈ F.E) (he₂ : e₂ ∈ F.E) + (hv₁ : v₁ ∈ D.P.Γ.V) (hv₂ : v₂ ∈ D.P.Γ.V) + (hFc : F.IsCircuitOf D.rad.G) + (hs₁ : closure e₁ ∩ D.rad.G.V = {cap.emb v₁, r}) + (hs₂ : closure e₂ ∩ D.rad.G.V = {cap.emb v₂, r}) + (hvG : ∀ {v : S}, v ∈ D.P.Γ.V → cap.emb v ∈ D.rad.G.V) + (hvp : ∀ {v : S}, v ∈ D.P.Γ.V → cap.emb v ≠ r) + (hsne : cap.emb v₁ ≠ cap.emb v₂) (hm₁ : cap.emb v₁ ∈ closure e₁) + (hm₂ : cap.emb v₂ ∈ closure e₂) (hr₁ : r ∈ closure e₁) : + IsLineWithEnds (closure e₁ ∪ closure e₂) (cap.emb v₁) (cap.emb v₂) := by + let G := D.rad.G + let Β := closure e₁ ∪ closure e₂ + have hl₁ : G.toGraph.IsLink e₁ (cap.emb v₁) r := ⟨hFc.1.2 he₁, hvG hv₁, hr.1.1, hs₁⟩ + have hl₂ : G.toGraph.IsLink e₂ r (cap.emb v₂) := ⟨hFc.1.2 he₂, hr.1.1, hvG hv₂, by rw [hs₂, + pair_comm]⟩ + let W : GraphWalk G.toGraph (cap.emb v₁) (cap.emb v₂) := .cons hl₁ (.cons hl₂ (.nil (hvG hv₂))) + have hWs : W.IsSimple := by + simp [GraphWalk.IsSimple, W, GraphWalk.support, hvp hv₁, hsne, (hvp hv₂).symm] + have := walk_isLine G W hWs hsne + have heq : ({x | x ∈ W.support} ∪ ⋃ e ∈ {e | e ∈ W.edges}, closure e) = Β := by + apply Subset.antisymm + · rintro x (hx | hx) + · simp only [W, GraphWalk.support, mem_ofPred_eq, List.mem_cons, List.not_mem_nil, or_false] + at hx + rcases hx with rfl | rfl | rfl + · exact Or.inl hm₁ + · exact Or.inl hr₁ + · exact Or.inr hm₂ + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.1 hx + simp only [W, GraphWalk.edges, mem_ofPred_eq, List.mem_cons, List.not_mem_nil, or_false] + at hf + rcases hf with rfl | rfl + · exact Or.inl hxf + · exact Or.inr hxf + · rintro x (h | h) + · exact Or.inr (mem_biUnion (by simp [W, GraphWalk.edges]) h) + · exact Or.inr (mem_biUnion (by simp [W, GraphWalk.edges]) h) + rwa [heq] at this + +omit hS h3 in +private theorem pole_edges_meet_embedded_surface_only_at_ends + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} + (F : Drawing Shat) + (r : Shat) + (e₁ : Set Shat) + (e₂ : Set Shat) + (v₁ : S) + (v₂ : S) + (he₁ : e₁ ∈ Drawing.E F) + (he₂ : e₂ ∈ Drawing.E F) + (hd₁ : Disjoint e₁ (range cap.emb)) + (hd₂ : Disjoint e₂ (range cap.emb)) (G : Drawing Shat) : + (F.IsCircuitOf G) → + (closure e₁ ∩ G.V = {cap.emb v₁, r}) → + (closure e₂ ∩ G.V = {cap.emb v₂, r}) → + (r ∉ range cap.emb) → + let Β : Set Shat := closure e₁ ∪ closure e₂ + ∀ {x : Shat}, x ∈ Β → x ∈ range cap.emb → x = cap.emb v₁ ∨ x = cap.emb v₂ := by + intro hFc hs₁ hs₂ hrnr Β + have key : ∀ {e : Set Shat} {v : S} {x}, e ∈ G.E → closure e ∩ G.V = {cap.emb v, r} → Disjoint e + (range cap.emb) → x ∈ closure e → + x ∈ range cap.emb → x = cap.emb v := by + intro e v x he hs hdj hx hxr + by_cases hxe : x ∈ e + · exact absurd hxr (disjoint_left.1 hdj hxe) + · have hxG : x ∈ G.V := by + by_contra hn + have : x ∈ closure e \ G.V := ⟨hx, hn⟩ + rw [G.closure_diff_V he] at this + exact hxe this + have hm : x ∈ ({cap.emb v, r} : Set Shat) := hs ▸ ⟨hx, hxG⟩ + rcases hm with h | h + · exact h + · exact absurd (h ▸ hxr) hrnr + rintro x (h | h) hxr + · exact Or.inl (key (hFc.1.2 he₁) hs₁ hd₁ h hxr) + · exact Or.inr (key (hFc.1.2 he₂) hs₂ hd₂ h hxr) + +omit hS h3 in +private theorem flaw_circuit_meets_pole_disc_only_on_boundary_line + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} + {β : Type w} + {χ : ColourScheme S β} + {D : TangleDatum cap χ} + {F : Drawing Shat} {r : Shat} {Θ : Set S} {e₁ e₂ : Set Shat} + (hΘ : Θ ∈ cuffs S) (hFc : F.IsCircuitOf D.rad.G) + (hone : ∀ p ∈ D.rad.poles, p ∈ F.V → p = r) + (hedges : ∀ e ∈ F.E, r ∈ closure e → e = e₁ ∨ e = e₂) + (hr₁ : r ∈ closure e₁) : + ∀ {x : Shat}, x ∈ F.U → x ∈ cap.cuffDisc Θ → x ∈ closure e₁ ∪ closure e₂ := by + let G := D.rad.G + intro x hxF hxd + have hxr : x ∉ range cap.emb := cap.notMem_range hΘ hxd + by_cases hxV : x ∈ F.V + · have hxh : x ∉ D.P.Γ.hatV cap := fun ⟨v, _, hv⟩ ↦ hxr ⟨v, hv⟩ + have hw : x ∈ D.rad.Rstar := ⟨hFc.1.1 hxV, hxh⟩ + by_cases hp : x ∈ D.rad.poles + · rw [hone x hp hxV] + exact Or.inl hr₁ + · exact absurd (D.rad.region_subset_range hw hp (D.rad.regionOf_mem hw).2) hxr + · obtain ⟨f, hf, hxf⟩ := F.exists_edge_of_mem hxF hxV + obtain ⟨v, -, w', hw', hset⟩ := D.rad.edge_ends (hFc.1.2 hf) + have hwm : w' ∈ closure f ∩ G.V := by rw [hset]; exact Or.inr rfl + have hwF : w' ∈ F.V := mem_V_of_mem_U hFc.1 (F.closure_subset_U hf hwm.1) hwm.2 + by_cases hp : w' ∈ D.rad.poles + · have hwr := hone w' hp hwF + rw [hwr] at hwm + rcases hedges f hf hwm.1 with rfl | rfl + · exact Or.inl (subset_closure hxf) + · exact Or.inr (subset_closure hxf) + · exact absurd (D.rad.edge_subset_range (hFc.1.2 hf) hw' hp hset hxf) hxr + +omit hS h3 in +private theorem cuff_contact_off_pole_edges_follows_from_incidence + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [T2Space S] + [TopologicalSpace Shat] + [T2Space Shat] + {cap : IsCappedSurface S Shat} + {β : Type w} + {χ : ColourScheme S β} + {D : TangleDatum cap χ} + (hS : IsSurface S) + (h3 : D.P.Γ.IsInternallyThreeConnected) + {n : ℕ} + (hn : n < D.rep) + (hman : ∀ (x : Shat), IsManifoldPoint x) + {F : Drawing Shat} (hF : D.IsFreeCircuit n F) + (hmin : ∀ C : Drawing Shat, D.IsFreeCircuit n C → F.E.ncard ≤ C.E.ncard + ∧ (F.E.ncard = C.E.ncard → D.insCount C ≤ D.insCount F)) + (hdisc : IsClosedDisc (D.ins F)) (hbd : discBd (D.ins F) = F.U) + {r : Shat} {Θ : Set S} (hr : r ∈ D.rad.poles) (hΘ : Θ ∈ cuffs S) + (hreg : D.rad.regionOf r = cap.cuffDisc Θ) (hrF : r ∈ F.V) + {e₁ e₂ : Set Shat} (hedges : ∀ e ∈ F.E, r ∈ closure e → e = e₁ ∨ e = e₂) + (hFc : F.IsCircuitOf D.rad.G) + {Β : Set Shat} (hΒ : Β = closure e₁ ∪ closure e₂) (hΒF : Β ⊆ F.U) + (hEb : discBd (closure (cap.cuffDisc Θ)) = cap.emb '' Θ) + (hdE : cap.cuffDisc Θ = discInt (closure (cap.cuffDisc Θ))) : + ∀ x ∈ discBd (closure (cap.cuffDisc Θ)) ∩ discBd (D.ins F), x ∉ Β → + ∃ C ⊆ discInt (closure (cap.cuffDisc Θ)) \ Β, + C ⊆ D.ins F ∧ C.Nonempty ∧ IsPreconnected C ∧ x ∈ closure C := by + let G := D.rad.G + rintro x ⟨hxE, hxb⟩ hxΒ + rw [hEb] at hxE + obtain ⟨v, hvΘ, rfl⟩ := hxE + rw [hbd] at hxb + obtain ⟨hvV, hvF, -⟩ := D.rad.bd_point hFc.1 (cuff_subset_bd ⟨Θ, hΘ⟩ hvΘ) hxb + obtain ⟨e, he, hs⟩ := D.rad.exists_pole_edge hS h3 hr hΘ hreg hvV hvΘ + have hvm : cap.emb v ∈ closure e := (hs ▸ mem_insert _ _ : cap.emb v ∈ closure e ∩ G.V).1 + have hrm : r ∈ closure e := (hs ▸ mem_insert_of_mem _ rfl : r ∈ closure e ∩ G.V).1 + have heF : e ∉ F.E := by + intro h + rcases hedges e h hrm with rfl | rfl + · exact hxΒ (hΒ.symm ▸ Or.inl hvm) + · exact hxΒ (hΒ.symm ▸ Or.inr hvm) + have heU : Disjoint e F.U := disjoint_left.2 fun y hy hyF ↦ by + by_cases hyV : y ∈ F.V + · exact edge_notMem_V he hy (hFc.1.1 hyV) + · obtain ⟨f, hf, hyf⟩ := F.exists_edge_of_mem hyF hyV + exact heF (G.edge_eq_of_mem he (hFc.1.2 hf) hy hyf ▸ hf) + have hconn : IsPreconnected e := he.2.2.1.isConnected.isPreconnected + have hsub : e ⊆ discInt (closure (cap.cuffDisc Θ)) := fun y hy ↦ hdE ▸ + (hreg ▸ D.rad.edge_subset_region he hr.1 (by rw [hs]) hy : y ∈ cap.cuffDisc Θ) + have hin : e ⊆ discInt (D.ins F) := by + rcases hdisc.side hman hconn (by rw [hbd]; exact heU) with h | h + · exact h + · exfalso + obtain ⟨A, B, Q, ht, hQU, c₁, c₂⟩ := exists_theta_chord hS h3 hFc hr hrF hvV hvF he hs heF + have hdj : Disjoint (closure e) (discInt (D.ins F)) := disjoint_left.2 fun y hy hyi ↦ by + obtain ⟨z, hzi, hze⟩ := _root_.mem_closure_iff.1 hy _ (hdisc.isOpen_discInt hman) hyi + exact disjoint_left.1 h hze (discInt_subset _ hzi) + exact theta_contra hn hF hmin ht (hdj.mono_left hQU) c₁.le c₂.le (Or.inr ⟨c₁, c₂⟩) + exact ⟨e, fun y hy ↦ ⟨hsub hy, fun hyΒ ↦ disjoint_left.1 heU hy (hΒF hyΒ)⟩, + hin.trans (discInt_subset _), he.1, hconn, hvm⟩ + +omit hS h3 in +private theorem remaining_boundary_line_forms_free_shape + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [T2Space S] + [TopologicalSpace Shat] + [T2Space Shat] + {cap : IsCappedSurface S Shat} + {β : Type w} + {χ : ColourScheme S β} + {D : TangleDatum cap χ} + (hS : IsSurface S) + {n : ℕ} + (F : Drawing Shat) + (hF : D.IsFreeCircuit n F) + (hdisc : IsClosedDisc (D.ins F)) + (hbd : discBd (D.ins F) = F.U) + (Θ : Set S) + (hΘ : Θ ∈ cuffs S) + (hEE : ∀ {Θ' : Set S}, Θ' ∈ cuffs S → Θ' ≠ Θ → Disjoint (closure (cap.cuffDisc Θ')) (closure + (cap.cuffDisc Θ))) + (hother : ∀ {Θ' : Set S}, Θ' ∈ cuffs S → Θ' ≠ Θ → ∃ p' ∈ D.rad.poles, p' ∈ cap.cuffDisc Θ' ∧ + p' ∉ D.ins F ∧ Disjoint (cap.cuffDisc Θ') F.U ∧ (closure (cap.cuffDisc Θ') ∩ D.ins + F).Subsingleton ∧ closure (cap.cuffDisc Θ') ∩ D.ins F ⊆ F.U) + (hNle : ∀ {U₀ : Set S}, (∀ x ∈ U₀, cap.emb x ∈ F.U) → 2 * (U₀ ∩ D.P.Γ.V).ncard ≤ (Drawing.E + F).ncard) + (v₁ : S) + (v₂ : S) + (Β : Set Shat) + (L : Set Shat) + (hΒL : Β ∩ L = {cap.emb v₁, cap.emb v₂}) + (hFL : F.U = Β ∪ L) : + let U₀ : Set S := cap.emb ⁻¹' L + (cap.emb v₁ ∈ L) → + (cap.emb v₂ ∈ L) → + ∀ (K : Drawing S), + (K.V = U₀ ∩ D.P.Γ.V) → + (cap.emb '' K.U = L) → + (discBd (closure (cap.cuffDisc Θ)) = cap.emb '' Θ) → + ∀ (Z : Set Shat), + ∀ (A' : Set Shat), + (IsClosedDisc Z) → + (A' ⊆ discBd (closure (cap.cuffDisc Θ))) → + (IsPreconnected A') → + (discBd Z = discBd (D.ins F) \ (Β \ {cap.emb v₁, cap.emb v₂}) ∪ A') → + (Disjoint A' (D.ins F)) → + (discBd (closure (cap.cuffDisc Θ)) \ A' ⊆ D.ins F) → + (closure (cap.cuffDisc Θ) ⊆ Z) → + (Z \ D.ins F ⊆ closure (cap.cuffDisc Θ)) → + (cap.emb ⁻¹' D.ins F ⊆ cap.emb ⁻¹' discInt Z ∪ K.U) → + (∀ {x : S}, x ∈ K.U → cap.emb x ∈ D.ins F) → + (cap.emb ⁻¹' discInt Z ∪ K.U ⊆ cap.emb ⁻¹' Z) → + IsFreeShape cap χ.Φ K Z := by + intro U₀ hv₁L hv₂L K hK_V hKimg hEb Z A' hZ hA'b hA'c hbZ hA'd hAc hEZ hZΔ hIn hKsub hInZ + refine ⟨hZ, ?_, ?_, ?_, ⟨Θ, hΘ, hEZ⟩, fun hall ↦ ?_⟩ + · rw [hKimg, hbZ] + intro x hx + refine Or.inl ⟨hbd ▸ hFL ▸ Or.inr hx, fun h ↦ h.2 ?_⟩ + have : x ∈ Β ∩ L := ⟨h.1, hx⟩ + rwa [hΒL] at this + · rw [hbZ] + rintro x (⟨hx, hn⟩ | hx) + · refine Or.inr ?_ + rw [hKimg] + rw [hbd, hFL] at hx + rcases hx with h | h + · by_cases he : x ∈ ({cap.emb v₁, cap.emb v₂} : Set Shat) + · rcases he with h' | h' + · exact h' ▸ hv₁L + · exact (mem_singleton_iff.1 h') ▸ hv₂L + · exact absurd ⟨h, he⟩ hn + · exact h + · exact Or.inl (mem_biUnion hΘ (Surface.discBd_subset _ (hA'b hx))) + · intro Θ' hΘ' hn' + have hne' : Θ' ≠ Θ := fun h ↦ hn' (h ▸ hEZ) + obtain ⟨-, -, -, -, -, h, -⟩ := hother hΘ' hne' + refine h.anti fun x hx ↦ ⟨hx.1, ?_⟩ + by_contra hxΔ + exact disjoint_left.1 (hEE hΘ' hne') hx.1 (hZΔ ⟨hx.2, hxΔ⟩) + · have hoth : ∀ Θ' ∈ cuffs S, Θ' ≠ Θ → Disjoint (closure (cap.cuffDisc Θ')) Z + := fun Θ' hΘ' hne' ↦ by + obtain ⟨p, -, hpd, hpi, -⟩ := hother hΘ' hne' + rcases hall Θ' hΘ' with h | h + · exfalso + have hpZ := h (subset_closure hpd) + exact disjoint_left.1 (hEE hΘ' hne') (subset_closure hpd) (hZΔ ⟨hpZ, hpi⟩) + · exact h + have hA'sub : A' ⊆ cap.emb '' Θ := hEb ▸ hA'b + have hmemA : ∀ {x}, x ∈ Θ → (x ∈ cap.emb ⁻¹' A' ↔ cap.emb x ∉ D.ins F) := fun {x} hx ↦ by + constructor + · exact fun h ↦ disjoint_left.1 hA'd h + · intro h + by_contra hn + exact h (hAc ⟨hEb ▸ mem_image_of_mem _ hx, hn⟩) + have hcountK : 2 * K.V.ncard ≤ F.E.ncard := by + rw [hK_V] + exact hNle fun x hx => hFL ▸ Or.inr hx + refine freeFacts_of_cuff (A := cap.emb ⁻¹' A') hS χ.Φ cap hΘ hInZ hoth ?_ ?_ ?_ ?_ + (free_count hF hcountK hIn) + · rw [← cap.isEmbedding.isInducing.isPreconnected_image, image_preimage_eq_of_subset + (hA'sub.trans (image_subset_range _ _))] + exact hA'c + · intro x hx + obtain ⟨y, hy, he⟩ := hA'sub hx + exact cap.isEmbedding.injective he ▸ hy + · intro x hx + constructor + · rintro (h | h) hxA + · exact h.2 (hbZ ▸ Or.inr hxA) + · exact (hmemA hx).1 hxA (hKsub h) + · intro h + exact hIn (by_contra fun hn ↦ h ((hmemA hx).2 hn)) + · have : Θ \ cap.emb ⁻¹' A' = Θ ∩ cap.emb ⁻¹' D.ins F := by + ext x + constructor + · rintro ⟨h₁, h₂⟩ + exact ⟨h₁, by_contra fun hn ↦ h₂ ((hmemA h₁).2 hn)⟩ + · rintro ⟨h₁, h₂⟩ + exact ⟨h₁, fun h ↦ (hmemA h₁).1 h h₂⟩ + rw [this] + exact (isClosed_cuff hS ⟨Θ, hΘ⟩).inter (hdisc.isClosed.preimage cap.isEmbedding.continuous) + +omit hS h3 in +private theorem free_data_when_pole_is_on_circuit + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [T2Space S] + [TopologicalSpace Shat] + [T2Space Shat] + {cap : IsCappedSurface S Shat} + {β : Type w} + {χ : ColourScheme S β} + {D : TangleDatum cap χ} + (hS : IsSurface S) + (h3 : D.P.Γ.IsInternallyThreeConnected) + {n : ℕ} + (hn : n < D.rep) + (hT : IsClosedSurface Shat) + (hman : ∀ (x : Shat), IsManifoldPoint x) + (hj : IsClosedEmbedding cap.emb) + (F : Drawing Shat) + (hF : D.IsFreeCircuit n F) + (hlink : GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins F)) (partIn cap + D.P.Γ (closure (D.ins F)ᶜ))) + (hmin : ∀ (C : Drawing Shat), D.IsFreeCircuit n C → (Drawing.E F).ncard ≤ (Drawing.E C).ncard + ∧ ((Drawing.E F).ncard = (Drawing.E C).ncard → D.insCount C ≤ D.insCount F)) + (hFc : F.IsCircuitOf D.rad.G) + (hlt : (Drawing.E F).ncard < 2 * D.rep) + (hdisc : IsClosedDisc (D.ins F)) + (hbd : discBd (D.ins F) = F.U) + (r : Shat) + (hr : r ∈ D.rad.poles) + (Θ : Set S) + (hΘ : Θ ∈ cuffs S) + (hreg : D.rad.regionOf r = cap.cuffDisc Θ) + (hE : IsClosedDisc (closure (cap.cuffDisc Θ))) + (hone : ∀ p ∈ D.rad.poles, p ∈ F.V → p = r) + (hcover : F.U ⊆ range cap.emb ∪ cap.cuffDisc Θ) + (hEE : ∀ {Θ' : Set S}, Θ' ∈ cuffs S → Θ' ≠ Θ → Disjoint (closure (cap.cuffDisc Θ')) (closure + (cap.cuffDisc Θ))) + (hother : ∀ {Θ' : Set S}, Θ' ∈ cuffs S → Θ' ≠ Θ → ∃ p' ∈ D.rad.poles, p' ∈ cap.cuffDisc Θ' ∧ + p' ∉ D.ins F ∧ Disjoint (cap.cuffDisc Θ') F.U ∧ (closure (cap.cuffDisc Θ') ∩ D.ins + F).Subsingleton ∧ closure (cap.cuffDisc Θ') ∩ D.ins F ⊆ F.U) + (hNle : ∀ {U₀ : Set S}, (∀ x ∈ U₀, cap.emb x ∈ F.U) → 2 * (U₀ ∩ D.P.Γ.V).ncard ≤ (Drawing.E + F).ncard) + (hrF : r ∈ F.V) : + ∃ Δ Z K, IsFreeData D n Δ Z K := by + obtain ⟨e₁, e₂, v₁, v₂, he₁, he₂, hv₁, hv₂, hne, hs₁, hs₂, hedges⟩ := D.rad.circuit_edges hS h3 + hFc hrF hr.1 + obtain ⟨hd₁, hvΘ₁⟩ := D.rad.pole_edge (hFc.1.2 he₁) hr hΘ hreg hs₁ + obtain ⟨hd₂, hvΘ₂⟩ := D.rad.pole_edge (hFc.1.2 he₂) hr hΘ hreg hs₂ + set G := D.rad.G with hG + have hrnr := D.pole_notMem_range hr + have hvG : ∀ {v}, v ∈ D.P.Γ.V → cap.emb v ∈ G.V := fun hv ↦ D.rad.isPreRadial.2.1 + (mem_image_of_mem _ hv) + have hvp : ∀ {v}, v ∈ D.P.Γ.V → cap.emb v ≠ r := fun hv h ↦ hr.1.2 (h ▸ mem_image_of_mem _ hv) + have hsne : cap.emb v₁ ≠ cap.emb v₂ := fun h ↦ hne (cap.isEmbedding.injective h) + have hclE : ∀ {e x}, e ∈ G.E → closure e ∩ G.V = {x, r} → closure e ⊆ closure (cap.cuffDisc Θ) + := fun he hs ↦ + closure_mono (hreg ▸ D.rad.edge_subset_region he hr.1 (by rw [hs])) + set Β : Set Shat := closure e₁ ∪ closure e₂ with hΒ + have hm₁ : cap.emb v₁ ∈ closure e₁ := (hs₁ ▸ mem_insert _ _ : cap.emb v₁ ∈ closure e₁ ∩ G.V).1 + have hm₂ : cap.emb v₂ ∈ closure e₂ := (hs₂ ▸ mem_insert _ _ : cap.emb v₂ ∈ closure e₂ ∩ G.V).1 + have hr₁ : r ∈ closure e₁ := (hs₁ ▸ mem_insert_of_mem _ rfl : r ∈ closure e₁ ∩ G.V).1 + have hΒF : Β ⊆ F.U := union_subset (F.closure_subset_U he₁) (F.closure_subset_U he₂) + have hΒline : IsLineWithEnds Β (cap.emb v₁) (cap.emb v₂) := by + exact pole_edges_form_boundary_line hr he₁ he₂ hv₁ hv₂ hFc hs₁ hs₂ hvG hvp hsne hm₁ hm₂ hr₁ + have hΒr : ∀ {x}, x ∈ Β → x ∈ range cap.emb → x = cap.emb v₁ ∨ x = cap.emb v₂ := by + exact pole_edges_meet_embedded_surface_only_at_ends (S := S) (Shat := Shat) (cap := cap) F r + e₁ e₂ v₁ v₂ he₁ he₂ hd₁ hd₂ G hFc hs₁ hs₂ hrnr + obtain ⟨u, w, h2a, hru, hu0, hu1, hun⟩ := exists_arcs_of_line (IsCircuit.isOArc_U hFc.2) hΒline + hΒF + set L : Set Shat := range w with hL + have hLline : IsLineWithEnds L (cap.emb v₁) (cap.emb v₂) := by + have := h2a.arc_right.isLineWithEnds + rwa [h2a.zero, h2a.one, hu0, hu1] at this + have hΒL : Β ∩ L = {cap.emb v₁, cap.emb v₂} := by + have := h2a.inter + rwa [hru, hu0, hu1] at this + have hFL : F.U = Β ∪ L := by rw [← hun, hru] + have hFcd : ∀ {x}, x ∈ F.U → x ∈ cap.cuffDisc Θ → x ∈ Β := by + exact flaw_circuit_meets_pole_disc_only_on_boundary_line hΘ hFc hone hedges hr₁ + have hLr : L ⊆ range cap.emb := fun x hx ↦ by + have hxF : x ∈ F.U := hFL ▸ Or.inr hx + rcases hcover hxF with h | h + · exact h + · have : x ∈ Β ∩ L := ⟨hFcd hxF h, hx⟩ + rw [hΒL] at this + rcases this with h' | h' + · exact ⟨_, h'.symm⟩ + · exact ⟨_, (mem_singleton_iff.1 h').symm⟩ + set U₀ : Set S := cap.emb ⁻¹' L with hU₀ + have hU₀i : cap.emb '' U₀ = L := image_preimage_eq_of_subset hLr + have hv₁L : cap.emb v₁ ∈ L := (hΒL.symm ▸ mem_insert _ _ : cap.emb v₁ ∈ Β ∩ L).2 + have hv₂L : cap.emb v₂ ∈ L := (hΒL.symm ▸ mem_insert_of_mem _ rfl : cap.emb v₂ ∈ Β ∩ L).2 + have hUF : cap.emb ⁻¹' F.U = U₀ := by + ext x + constructor + · intro hx + change cap.emb x ∈ F.U at hx + rw [hFL] at hx + rcases hx with h | h + · change cap.emb x ∈ L + rcases hΒr h (mem_range_self x) with h' | h' + · rw [h'] + exact hv₁L + · rw [h'] + exact hv₂L + · exact h + · intro hx + change cap.emb x ∈ F.U + rw [hFL] + exact Or.inr hx + have hl : IsLineWithEnds U₀ v₁ v₂ := isLine_comap hj (by rw [hU₀i]; exact hLline) + have hc : IsClosed U₀ := hUF ▸ F.isClosed_U.preimage cap.isEmbedding.continuous + have hNf : (U₀ ∩ D.P.Γ.V).Finite := D.P.Γ.finite_V.subset inter_subset_right + have ha : v₁ ∈ U₀ ∩ D.P.Γ.V := ⟨hv₁L, hv₁⟩ + have hb : v₂ ∈ U₀ ∩ D.P.Γ.V := ⟨hv₂L, hv₂⟩ + obtain ⟨hfe, hcount, hmk⟩ := arcs_of_line _ hNf rfl hl ha hb inter_subset_left + set K := coarseDrawing D.P.Γ U₀ hc hfe fun e he ↦ (hmk e he).1 with hK + have hKimg : cap.emb '' K.U = L := hU₀i + have hEb : discBd (closure (cap.cuffDisc Θ)) = cap.emb '' Θ := cap.cuffDisc_bd Θ hΘ + have hdE : cap.cuffDisc Θ = discInt (closure (cap.cuffDisc Θ)) := cap.cuffDisc_eq_discInt hΘ + have hΒE : Β ⊆ closure (cap.cuffDisc Θ) := union_subset (hclE (hFc.1.2 he₁) hs₁) (hclE + (hFc.1.2 he₂) hs₂) + have hmeet : Β ∩ discBd (closure (cap.cuffDisc Θ)) = {cap.emb v₁, cap.emb v₂} := by + rw [hEb] + apply Subset.antisymm + · rintro x ⟨hx, y, -, rfl⟩ + exact hΒr hx (mem_range_self y) + · rintro _ (rfl | h) + · exact ⟨Or.inl hm₁, mem_image_of_mem _ hvΘ₁⟩ + · rw [mem_singleton_iff.1 h] + exact ⟨Or.inr hm₂, mem_image_of_mem _ hvΘ₂⟩ + have hoff : discInt (closure (cap.cuffDisc Θ)) ∩ discBd (D.ins F) ⊆ Β := by + rw [← hdE, hbd] + exact fun x hx ↦ hFcd hx.2 hx.1 + have htouch : ∀ x ∈ discBd (closure (cap.cuffDisc Θ)) ∩ discBd (D.ins F), x ∉ Β → + ∃ C, C ⊆ discInt (closure (cap.cuffDisc Θ)) \ Β ∧ C ⊆ D.ins F ∧ C.Nonempty ∧ IsPreconnected C + ∧ x ∈ closure C := by + exact cuff_contact_off_pole_edges_follows_from_incidence hS h3 hn hman hF hmin hdisc hbd + hr hΘ hreg hrF hedges hFc hΒ hΒF hEb hdE + obtain ⟨Z, A', hZ, hA'b, hA'c, hbZ, hA'd, hAc, hEZ, hΔZ, hZΔ, hiff⟩ := + exists_outer_half hT hdisc hE hsne hΒline (hbd ▸ hΒF) hΒE hmeet hoff htouch + have hemb : ∀ x, cap.emb x ∉ discInt (closure (cap.cuffDisc Θ)) := fun x h ↦ cap.notMem_range hΘ + (hdE ▸ h) (mem_range_self x) + have hint : cap.emb ⁻¹' discInt Z = cap.emb ⁻¹' discInt (D.ins F) := by + ext x + exact hiff _ (hemb x) + have hIn : cap.emb ⁻¹' D.ins F ⊆ cap.emb ⁻¹' discInt Z ∪ K.U := fun x hx ↦ by + by_cases hb' : cap.emb x ∈ discBd (D.ins F) + · refine Or.inr ?_ + change x ∈ U₀ + rw [← hUF] + change cap.emb x ∈ F.U + rw [← hbd] + exact hb' + · exact Or.inl ((hiff _ (hemb x)).2 ⟨hx, hb'⟩) + have hKsub : ∀ {x}, x ∈ K.U → cap.emb x ∈ D.ins F := fun {x} hx ↦ D.U_subset_ins hFc hlt + (hFL ▸ Or.inr hx) + have hInZ : cap.emb ⁻¹' discInt Z ∪ K.U ⊆ cap.emb ⁻¹' Z := by + rintro x (h | h) + · exact discInt_subset Z h + · exact hΔZ (hKsub h) + have hshape : IsFreeShape cap χ.Φ K Z := by + exact remaining_boundary_line_forms_free_shape (S := S) (Shat := Shat) (cap := cap) (β := β) + (χ := χ) (D := D) hS (n := n) F hF hdisc hbd Θ hΘ hEE hother hNle v₁ v₂ Β L hΒL hFL + hv₁L hv₂L K rfl hKimg hEb Z A' hZ hA'b hA'c hbZ hA'd hAc hEZ hZΔ hIn hKsub hInZ + refine ⟨D.ins F, Z, K, free_data_of_cut hS h3 hn hF hlink hc hfe _ hUF ?_ + (by omega) hshape hint ?_ ?_⟩ + · exact line_subset_closure_sdiff hl hNf + · refine ⟨∅, {U₀}, finite_empty, finite_singleton _, by simp, ?_, by simp⟩ + rintro _ rfl + exact ⟨v₁, v₂, hne, hl, Or.inl (cuff_subset_bd ⟨Θ, hΘ⟩ hvΘ₁), Or.inl (cuff_subset_bd ⟨Θ, + hΘ⟩ hvΘ₂)⟩ + · intro w' x hx hne' + refine line_anchor hl Subset.rfl (fun w'' h ↦ ?_) (fun w'' h ↦ ?_) hx hne' + · refine ⟨{v₁}, ?_, rfl, isPreconnected_singleton, ⟨v₁, rfl, hv₁⟩⟩ + rintro _ rfl + exact ⟨hv₁L, h⟩ + · refine ⟨{v₂}, ?_, rfl, isPreconnected_singleton, ⟨v₂, rfl, hv₂⟩⟩ + rintro _ rfl + exact ⟨hv₂L, h⟩ + +/-- **A freedom flaw gives the data.** -/ +theorem exists_free_data {n : ℕ} (hn : n < D.rep) (hd : ∀ r₁ ∈ D.rad.poles, ∀ r₂ ∈ D.rad.poles, r₁ + ≠ r₂ → n < D.vDist r₁ r₂) + (hex : ∃ C, D.IsFreeCircuit n C) : ∃ Δ Z K, IsFreeData D n Δ Z K := by + classical + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have : ConnectedSpace Shat := cap.connected + have : ConnectedSpace S := χ.connected + have hj := cap.isClosedEmbedding hS + obtain ⟨F, hF, hlink, hmin⟩ := exists_least_free hS h3 hn hex + have hFc := hF.1 + have hle := hF.2.1 + have hlt : F.E.ncard < 2 * D.rep := by omega + have hi := D.ins_spec hFc hlt + have hdisc := hi.2.2.1 + have hbd : discBd (D.ins F) = F.U := hi.2.2.2.1 + have huniq : ∀ p ∈ D.rad.poles, ∀ q ∈ D.rad.poles, p ∈ D.ins F → q ∈ D.ins F → p = q + := fun p hp q hq h₁ h₂ ↦ by + by_contra hne + have := vDist_le_of_ins hn hFc hle hp hq hne h₁ h₂ + have := hd p hp q hq hne + omega + obtain ⟨r, hr, hri⟩ := exists_pole_ins hS h3 hn hF hmin + obtain ⟨Θ, hΘ, hreg, hrd⟩ := D.rad.pole_cases hr + have hE := cap.cuffDisc_closedDisc Θ hΘ + have hone : ∀ p ∈ D.rad.poles, p ∈ F.V → p = r := fun p hp hpF ↦ + huniq p hp r hr (D.U_subset_ins hFc hlt (F.V_subset_U hpF)) hri + have hcover := U_subset_of_one_pole hFc.1 hreg hrd hone + have hEE : ∀ {Θ'}, Θ' ∈ cuffs S → Θ' ≠ Θ → Disjoint (closure (cap.cuffDisc Θ')) (closure + (cap.cuffDisc Θ)) := fun hΘ' hne ↦ + cap.cuffDisc_disjoint _ hΘ' _ hΘ hne + have hother : ∀ {Θ'}, Θ' ∈ cuffs S → Θ' ≠ Θ → ∃ p' ∈ D.rad.poles, p' ∈ cap.cuffDisc Θ' + ∧ p' ∉ D.ins F ∧ + Disjoint (cap.cuffDisc Θ') F.U ∧ (closure (cap.cuffDisc Θ') ∩ D.ins F).Subsingleton ∧ closure + (cap.cuffDisc Θ') ∩ D.ins F ⊆ F.U := fun {Θ'} hΘ' hne ↦ by + obtain ⟨p, hp, hpd, hreg'⟩ := D.rad.exists_pole hΘ' + have hne' : p ≠ r := by + rintro rfl + exact disjoint_left.1 (hEE hΘ' hne) (subset_closure hpd) (subset_closure hrd) + have hpi : p ∉ D.ins F := fun h ↦ hne' (huniq p hp r hr h hri) + have hdis : Disjoint (cap.cuffDisc Θ') F.U := disjoint_left.2 fun x hx hxF ↦ by + rcases hcover hxF with h | h + · exact cap.notMem_range hΘ' hx h + · exact disjoint_left.1 (hEE hΘ' hne) (subset_closure hx) (subset_closure h) + exact ⟨p, hp, hpd, hpi, hdis, touch_subsingleton hS h3 hn hF hmin hp hpi hΘ' hreg' hdis, + fun x hx ↦ D.cuff_inter_ins_of_disjoint hFc hlt hp hpi hreg' hdis hx.1 hx.2⟩ + have hNle := fun {U₀ : Set S} (hU : ∀ x ∈ U₀, cap.emb x ∈ F.U) ↦ D.two_mul_ncard_le hFc hU + by_cases hrF : r ∈ F.V + · exact free_data_when_pole_is_on_circuit (S := S) (Shat := Shat) (cap := cap) (β := β) (χ := χ) + (D := D) hS h3 (n := n) hn hT hman hj F hF hlink hmin hFc hlt hdisc hbd r hr Θ hΘ hreg + hE hone hcover hEE hother hNle hrF + · have hnp : ∀ z ∈ F.V, z ∉ D.rad.poles := fun z hz hzp ↦ hrF (hone z hzp hz ▸ hz) + have hrange := subset_range_of_no_pole D.rad hFc.1 hnp + have hrnr := D.pole_notMem_range hr + have hrint : r ∈ discInt (D.ins F) := ⟨hri, fun hb ↦ hrnr (hrange (hbd ▸ hb))⟩ + have hEin : closure (cap.cuffDisc Θ) ⊆ D.ins F := by + rcases cap.side hdisc (hbd.trans_subset hrange) hΘ with h | h + · exact h + · exact absurd hrint (disjoint_left.1 h (subset_closure hrd)) + obtain ⟨hinter₀, -, -, -, -⟩ := comap_facts D.rad D.P.fits hFc.1 hrange hj (circuit_iso hFc.2) + set K₀ : Drawing S := GM19.Drawing.comap F hj hrange with hK₀ + have hK₀U : K₀.U = cap.emb ⁻¹' F.U := rfl + have hKU : cap.emb '' K₀.U = F.U := image_preimage_eq_of_subset hrange + set U₀ : Set S := cap.emb ⁻¹' F.U with hU₀ + have hO : IsOArc U₀ := isOArc_comap hj (hKU ▸ IsCircuit.isOArc_U hFc.2) + have hNf : (U₀ ∩ D.P.Γ.V).Finite := D.P.Γ.finite_V.subset inter_subset_right + obtain ⟨a, ha, b, hb, hab⟩ : ∃ a ∈ U₀ ∩ D.P.Γ.V, ∃ b ∈ U₀ ∩ D.P.Γ.V, a ≠ b := by + by_cases hsing : (U₀ ∩ bd S).Subsingleton + · exact two_vertices_of_ring (K := K₀) (D := D) h3 hO hinter₀ hsing fun Δ' d₁ d₂ d₃ d₄ ↦ + D.no_empty_disc hFc hlt hr hri d₁ d₂ (d₃.trans hKU) (by rwa [hKU] at d₄) + · obtain ⟨x, hx, y, hy, hxy⟩ := not_subsingleton_iff.1 hsing + exact ⟨x, ⟨hx.1, (D.rad.bd_point hFc.1 hx.2 hx.1).1⟩, y, ⟨hy.1, + (D.rad.bd_point hFc.1 hy.2 hy.1).1⟩, hxy⟩ + have h2 : 2 ≤ (U₀ ∩ D.P.Γ.V).ncard := (one_lt_ncard hNf).2 ⟨a, ha, b, hb, hab⟩ + obtain ⟨hfe, hcount, hmk⟩ := arcs_of_oArc hNf hO inter_subset_left h2 + have hc : IsClosed U₀ := F.isClosed_U.preimage cap.isEmbedding.continuous + set K := coarseDrawing D.P.Γ U₀ hc hfe fun e he ↦ (hmk e he).1 with hK + have hIn : cap.emb ⁻¹' D.ins F ⊆ cap.emb ⁻¹' discInt (D.ins F) ∪ K.U := fun x hx ↦ by + by_cases hb' : cap.emb x ∈ discBd (D.ins F) + · refine Or.inr ?_ + change cap.emb x ∈ F.U + rw [← hbd] + exact hb' + · exact Or.inl ⟨hx, hb'⟩ + have hInZ : cap.emb ⁻¹' discInt (D.ins F) ∪ K.U ⊆ cap.emb ⁻¹' D.ins F := by + rintro x (h | h) + · exact discInt_subset (D.ins F) h + · exact D.U_subset_ins hFc hlt h + have hshape : IsFreeShape cap χ.Φ K (D.ins F) := by + refine ⟨hdisc, ?_, ?_, ?_, ⟨Θ, hΘ, hEin⟩, fun hall ↦ ?_⟩ + · rw [hbd] + exact image_preimage_subset _ _ + · rw [hbd] + exact fun x hx ↦ Or.inr (hKU ▸ hx) + · intro Θ' hΘ' hn' + have hne : Θ' ≠ Θ := fun h ↦ hn' (h ▸ hEin) + obtain ⟨-, -, -, -, -, h, -⟩ := hother hΘ' hne + exact h + · refine freeFacts_of_cuff (A := ∅) hS χ.Φ cap hΘ hInZ (fun Θ' hΘ' hne ↦ ?_) + isPreconnected_empty (empty_subset _) ?_ ?_ + (free_count hF (hNle fun x hx ↦ hx) hIn) + · obtain ⟨p, -, hpd, hpi, -⟩ := hother hΘ' hne + rcases hall Θ' hΘ' with h | h + · exact absurd (h (subset_closure hpd)) hpi + · exact h + · intro x hx + exact ⟨fun _ h ↦ h, fun _ ↦ hIn (hEin (cap.mem_closure_emb hΘ hx))⟩ + · rw [sdiff_empty] + exact isClosed_cuff hS ⟨Θ, hΘ⟩ + refine ⟨D.ins F, D.ins F, K, free_data_of_cut hS h3 hn hF hlink hc hfe _ rfl ?_ hcount.le + hshape rfl ?_ ?_⟩ + · exact oArc_subset_closure_sdiff hO ha.1 hb.1 hab hNf + · refine ⟨{U₀}, ∅, finite_singleton _, finite_empty, by rintro _ rfl; exact hO, by simp, by + simp⟩ + · intro u x hx hne + exact ring_part hO ha hb hab hx hne + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FreeFlaw.lean b/LeanPool/GraphMinor/GM19/FreeFlaw.lean new file mode 100644 index 0000000000..a7c8a79275 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FreeFlaw.lean @@ -0,0 +1,420 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FreeShape +public import LeanPool.GraphMinor.GM19.Section10r + +/-! +# The circuit of a freedom flaw + +We pick a flaw circuit `F` that is shortest and, among the shortest, has the most vertices of `Γ*` +in `ins(F)`. By (8.7) it is +`λ`-linked to `𝒯`. A path of `Γ*` outside `ins(F)` with its ends on `F` makes a circuit that is no +longer and whose inside is larger +(`theta_contra`). So only one pole lies in `ins(F)` (`vDist_le_of_ins`), and each other cuff meets +`ins(F)` in at most one point. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +namespace TangleDatum + +variable {D : TangleDatum cap χ} + +/-- A circuit as in the definition of "`n`-flawed in freedom". -/ +def IsFreeCircuit (D : TangleDatum cap χ) (n : ℕ) (C : Drawing Shat) : Prop := + C.IsCircuitOf D.rad.G ∧ C.E.ncard ≤ 2 * n ∧ ((∃ side ∈ χ.Φ.longSides, cap.emb '' side ⊆ D.ins C) ∨ + C.E.ncard < 2 * ((cap.emb '' χ.Φ.V) ∩ D.ins C).ncard) + +/-- The number of vertices of `Γ*` inside a circuit. -/ +noncomputable def insCount (D : TangleDatum cap χ) (C : Drawing Shat) : ℕ := + (D.rad.G.V ∩ D.ins C).ncard + +omit [T2Space S] in +omit [T2Space Shat] in +theorem IsFreeCircuit.mono {n : ℕ} {C C' : Drawing Shat} (h : D.IsFreeCircuit n C) + (hC' : C'.IsCircuitOf D.rad.G) (hle : C'.E.ncard ≤ C.E.ncard) + (hsub : D.ins C ⊆ D.ins C') : D.IsFreeCircuit n C' := by + refine ⟨hC', hle.trans h.2.1, ?_⟩ + rcases h.2.2 with ⟨s, hs, hsub'⟩ | hlt + · exact Or.inl ⟨s, hs, hsub'.trans hsub⟩ + · refine Or.inr (lt_of_le_of_lt hle (lt_of_lt_of_le hlt ?_)) + have hf : ((cap.emb '' χ.Φ.V) ∩ D.ins C').Finite := (χ.Φ.finite_V.image _).subset + inter_subset_left + have := ncard_le_ncard (inter_subset_inter_right (cap.emb '' χ.Φ.V) hsub) hf + omega + +variable (hS : IsSurface S) (h3 : D.P.Γ.IsInternallyThreeConnected) + +include hS h3 in +/-- **A least flaw circuit that is linked.** -/ +theorem exists_least_free {n : ℕ} (hn : n < D.rep) (h : ∃ C, D.IsFreeCircuit n C) : + ∃ F, D.IsFreeCircuit n F ∧ GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ + (D.ins F)) (partIn cap D.P.Γ (closure (D.ins F)ᶜ)) ∧ + ∀ C, D.IsFreeCircuit n C → F.E.ncard ≤ C.E.ncard ∧ (F.E.ncard = C.E.ncard → D.insCount C + ≤ D.insCount F) := by + have hfin : {C | D.IsFreeCircuit n C}.Finite := (finite_circuits D.rad.G).subset fun C hC ↦ + ⟨hC.1.2, hC.1.1⟩ + obtain ⟨F₀, hF₀, hmin⟩ := Set.exists_min_image _ (fun C ↦ C.E.ncard) hfin h + have hfin' : {C | D.IsFreeCircuit n C ∧ C.E.ncard = F₀.E.ncard}.Finite + := hfin.subset fun C hC ↦ hC.1 + obtain ⟨F₁, hF₁, hmax⟩ := Set.exists_max_image _ (fun C ↦ D.insCount C) hfin' ⟨F₀, hF₀, rfl⟩ + have hlt : F₁.E.ncard < 2 * D.rep := by have := hF₁.1.2.1; omega + obtain ⟨F, hF, hle, -, hsub, hlink⟩ := exists_linked hS h3 hF₁.1.1 hlt + have hfree := hF₁.1.mono hF hle hsub + have heq : F.E.ncard = F₀.E.ncard := le_antisymm (hle.trans hF₁.2.le) (hmin F hfree) + have hcount : D.insCount F₁ ≤ D.insCount F := + ncard_le_ncard (inter_subset_inter_right _ hsub) (D.rad.G.finite_V.subset inter_subset_left) + refine ⟨F, hfree, hlink, fun C hC ↦ ⟨heq ▸ hmin C hC, fun he ↦ ?_⟩⟩ + exact (hmax C ⟨hC, by omega⟩).trans hcount + +omit [T2Space S] [T2Space Shat] in +/-- A circuit of `Γ*` has twice as many edges as vertices of `Γ`. -/ +theorem ncard_E_eq_hat (D : TangleDatum cap χ) {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) : + C.E.ncard = 2 * (C.V ∩ D.P.Γ.hatV cap).ncard := by + have : ConnectedSpace Shat := cap.connected + refine IsCircuit.ncard_E_eq hC.2 fun e x y hl ↦ ?_ + have hlG := (hC.1.isLink_iff hl.1).mp hl + obtain ⟨v, hv, w, hw, hset⟩ := D.rad.edge_ends hlG.1 + have hset' : ({x, y} : Set Shat) = {cap.emb v, w} := hlG.2.2.2.symm.trans hset + have hvh : cap.emb v ∈ D.P.Γ.hatV cap := mem_image_of_mem _ hv + rcases Set.pair_eq_pair_iff.1 hset' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨fun _ ↦ hw.2, fun _ ↦ hvh⟩ + · exact ⟨fun h ↦ absurd h hw.2, fun h ↦ absurd hvh h⟩ + +omit [T2Space S] in +/-- Two poles inside a short circuit are close. -/ +theorem vDist_le_of_ins {n : ℕ} (hn : n < D.rep) {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hc : C.E.ncard ≤ 2 * n) {r₁ r₂ : Shat} + (h₁ : r₁ ∈ D.rad.poles) (h₂ : r₂ ∈ D.rad.poles) (hne : r₁ ≠ r₂) (hi₁ : r₁ ∈ D.ins C) + (hi₂ : r₂ ∈ D.ins C) : D.vDist r₁ r₂ ≤ n := by + classical + have : ConnectedSpace Shat := cap.connected + have hlt : C.E.ncard < 2 * D.rep := by omega + obtain ⟨e, he⟩ := IsCircuit.E_nonempty hC.2 + obtain ⟨v, -, w, -, hset⟩ := D.rad.edge_ends (hC.1.2 he) + have hvC : cap.emb v ∈ C.V := by + have hm : cap.emb v ∈ closure e ∩ D.rad.G.V := by rw [hset]; exact Or.inl rfl + exact mem_V_of_mem_U hC.1 (C.closure_subset_U he hm.1) hm.2 + obtain ⟨W, hl, -, hW⟩ := exists_circuit_walk hC hvC + have hE := D.ncard_E_eq_hat hC + let T : ClosedWalkIns D.rad D.ord D.𝒯 := + { base := cap.emb v + walk := W + sub := C + halfLen := (C.V ∩ D.P.Γ.hatV cap).ncard + ins := C.U ∪ ⋃ (F : Drawing Shat) (_ : F.IsSubdrawing C) (Δ : Set Shat) + (_ : IsInsOf D.rad D.ord D.𝒯 F Δ), Δ + sub_eq := hW.symm + walk_len := by omega + halfLen_lt := by + change _ < D.rep + omega + ins_eq := rfl } + have hsub : D.ins C ⊆ T.ins := fun x hx ↦ Or.inr (mem_iUnion.2 ⟨C, mem_iUnion.2 + ⟨Drawing.IsSubdrawing.refl C, mem_iUnion.2 ⟨D.ins C, + mem_iUnion.2 ⟨D.ins_spec hC hlt, hx⟩⟩⟩⟩) + have ha₁ : D.rad.atomOf r₁ = D.rad.regionOf r₁ := by + unfold RadialDrawing.atomOf + rw [ite_eq_right h₁.1.2] + have ha₂ : D.rad.atomOf r₂ = D.rad.regionOf r₂ := by + unfold RadialDrawing.atomOf + rw [ite_eq_right h₂.1.2] + have m₁ := D.rad.regionOf_mem h₁.1 + have m₂ := D.rad.regionOf_mem h₂.1 + have hreg : D.rad.regionOf r₁ ≠ D.rad.regionOf r₂ := fun heq ↦ by + obtain ⟨-, -, hG3, -⟩ := id D.rad.isPreRadial + exact hne ((hG3 _ m₁.1).unique ⟨m₁.2, h₁.1.1⟩ ⟨heq ▸ m₂.2, h₂.1.1⟩) + have hm₁ : (D.rad.regionOf r₁ ∩ T.ins).Nonempty := ⟨r₁, m₁.2, hsub hi₁⟩ + have hm₂ : (D.rad.regionOf r₂ ∩ T.ins).Nonempty := ⟨r₂, m₂.2, hsub hi₂⟩ + have hk : D.vDist r₁ r₂ ≤ T.halfLen := by + rw [vDist, ha₁, ha₂, dist, tangleMetric, ite_eq_right hreg, ite_eq_left ⟨T, hm₁, hm₂⟩] + exact Nat.sInf_le ⟨T, hm₁, hm₂, rfl⟩ + have : T.halfLen ≤ n := by + change (C.V ∩ D.P.Γ.hatV cap).ncard ≤ n + omega + omega + +omit [T2Space S] in +/-- **A path outside a least flaw circuit improves it.** -/ +theorem theta_contra {n : ℕ} (hn : n < D.rep) {F A B Q : Drawing Shat} {a b : Shat} + (hF : D.IsFreeCircuit n F) + (hmin : ∀ C, D.IsFreeCircuit n C → F.E.ncard ≤ C.E.ncard ∧ (F.E.ncard = C.E.ncard + → D.insCount C ≤ D.insCount F)) + (ht : TwoPaths D.rad.G F A B Q a b) (hQ : Disjoint Q.U (discInt (D.ins F))) (c₁ : Q.E.ncard + ≤ A.E.ncard) (c₂ : Q.E.ncard ≤ B.E.ncard) + (hcase : (∃ q ∈ Q.V, q ∉ D.ins F) ∨ (Q.E.ncard < A.E.ncard ∧ Q.E.ncard < B.E.ncard)) : False + := by + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have : ConnectedSpace Shat := cap.connected + have hFc := hF.1 + have hle := hF.2.1 + have hrep : 1 ≤ D.rep := by omega + have hlt : F.E.ncard < 2 * D.rep := by omega + have hi := D.ins_spec hFc hlt + have hdisc := hi.2.2.1 + have hbd : discBd (D.ins F) = F.U := hi.2.2.2.1 + have hl₂ := improve_card ht c₁ + have hl₁ := improve_card ht.swap c₂ + have hC₂ : Drawing.IsCircuitOf (D.rad.G.sup Q B) D.rad.G := ⟨D.rad.G.sup_isSubdrawing Q B, + ht.left_circuit⟩ + have hC₁ : Drawing.IsCircuitOf (D.rad.G.sup Q A) D.rad.G := ⟨D.rad.G.sup_isSubdrawing Q A, + ht.swap.left_circuit⟩ + have hcard : ∀ {X Y : Drawing Shat}, TwoPaths D.rad.G F X Y Q a b → + (D.rad.G.sup Q Y).E.ncard + X.E.ncard = Q.E.ncard + F.E.ncard := by + intro X Y ht' + have hE : (D.rad.G.sup Q Y).E = Q.E ∪ Y.E := Drawing.sup_E ht'.path.1 ht'.sub₂ + have hdis : Disjoint Q.E Y.E := disjoint_left.mpr fun e he he' ↦ disjoint_left.mp ht'.meet_E he + (ht'.right.1.2 he') + rw [hE, ncard_union_eq hdis Q.finite_edges Y.finite_edges, ht'.union_E, + ncard_union_eq ht'.disj_E X.finite_edges Y.finite_edges] + omega + have key : ∀ {X : Drawing Shat}, X.IsCircuitOf D.rad.G → X.E.ncard ≤ F.E.ncard → X.U ⊆ Q.U ∪ F.U + → Q.U ⊆ X.U → + ((∀ q ∈ Q.V, q ∈ D.ins F) → X.E.ncard < F.E.ncard) → (discInt (D.ins F) ∩ D.ins X).Nonempty + → False := by + intro X hX hXle hU hQU hstrict hm + have hXlt : X.E.ncard < 2 * D.rep := by omega + have hiX := D.ins_spec hX hXlt + have hdj : Disjoint (discInt (D.ins F)) (discBd (D.ins X)) := by + rw [hiX.2.2.2.1] + refine disjoint_left.2 fun x hx hxX ↦ ?_ + rcases hU hxX with h | h + · exact disjoint_left.1 hQ h hx + · exact hx.2 (hbd ▸ h) + have hsub : D.ins F ⊆ D.ins X := by + rcases hiX.2.2.1.side hman hdisc.isPreconnected_discInt hdj with h | h + · rw [← closure_discInt hdisc] + exact closure_minimal (h.trans (discInt_subset _)) hiX.2.2.1.isClosed + · obtain ⟨x, h₁, h₂⟩ := hm + exact absurd h₂ (disjoint_left.1 h h₁) + obtain ⟨m₁, m₂⟩ := hmin X (hF.mono hX hXle hsub) + by_cases hall : ∀ q ∈ Q.V, q ∈ D.ins F + · have := hstrict hall + omega + · push Not at hall + obtain ⟨q, hqQ, hqF⟩ := hall + have hcount := m₂ (le_antisymm m₁ hXle) + have hssub : D.rad.G.V ∩ D.ins F ⊂ D.rad.G.V ∩ D.ins X := by + refine ⟨inter_subset_inter_right _ hsub, fun h ↦ ?_⟩ + have hqG : q ∈ D.rad.G.V := ht.path.1.1 hqQ + exact hqF (h ⟨hqG, D.U_subset_ins hX hXlt (hQU (Q.V_subset_U hqQ))⟩).2 + have := ncard_lt_ncard hssub (D.rad.G.finite_V.subset inter_subset_left) + unfold insCount at hcount + omega + obtain ⟨z, hz⟩ := hdisc.nonempty_discInt + rcases ins_theta hrep ht hFc hlt (by omega) (by omega) (discInt_subset _ hz) with h | h + · refine key hC₁ hl₁ ?_ ?_ ?_ ⟨z, hz, h⟩ + · rw [ht.swap.U_right] + exact union_subset_union_right _ ht.left.1.U_subset + · rw [ht.swap.U_right] + exact subset_union_left + · intro hq + rcases hcase with ⟨q, h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact absurd (hq q h₁) h₂ + · have := hcard ht.swap + omega + · refine key hC₂ hl₂ ?_ ?_ ?_ ⟨z, hz, h⟩ + · rw [ht.U_right] + exact union_subset_union_right _ ht.right.1.U_subset + · rw [ht.U_right] + exact subset_union_left + · intro hq + rcases hcase with ⟨q, h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact absurd (hq q h₁) h₂ + · have := hcard ht + omega + +include hS h3 in +/-- A chord of a circuit through a pole on the circuit, from a vertex of `Γ` on the circuit that is +not next to the pole. -/ +theorem exists_theta_chord {F : Drawing Shat} (hF : F.IsCircuitOf D.rad.G) {p : Shat} + (hp : p ∈ D.rad.poles) (hpF : p ∈ F.V) {v : S} + (hv : v ∈ D.P.Γ.V) (hFv : cap.emb v ∈ F.V) {e : Set Shat} (he : e ∈ D.rad.G.E) + (hs : closure e ∩ D.rad.G.V = {cap.emb v, p}) (hn : e ∉ F.E) : + ∃ A B Q, TwoPaths D.rad.G F A B Q (cap.emb v) p ∧ Q.U ⊆ closure e ∧ Q.E.ncard < A.E.ncard + ∧ Q.E.ncard < B.E.ncard := by + classical + have : ConnectedSpace Shat := cap.connected + set G := D.rad.G with hG + have hvG : cap.emb v ∈ G.V := D.rad.isPreRadial.2.1 (mem_image_of_mem _ hv) + have hpG : p ∈ G.V := hp.1.1 + have hvp : cap.emb v ≠ p := fun h ↦ hp.1.2 (h ▸ mem_image_of_mem _ hv) + have hl₁ : G.toGraph.IsLink e (cap.emb v) p := ⟨he, hvG, hpG, hs⟩ + obtain ⟨A, B, hA, hB, hAs, hBs, -, -, hAB, hd, hsup⟩ := hF.2.exists_two_paths hFv hpF hvp + let W : GraphWalk G.toGraph (cap.emb v) p := .cons hl₁ (.nil hpG) + have hWs : W.IsSimple := by + simp [GraphWalk.IsSimple, W, GraphWalk.support, hvp] + have hQV : (walkDrawing G W).V = {cap.emb v, p} := by + rw [walkDrawing_V]; ext x; simp [W, GraphWalk.support] + have hQE : (walkDrawing G W).E = {e} := by + rw [walkDrawing_E]; ext x; simp [W, GraphWalk.edges] + have ht : TwoPaths G F A B (walkDrawing G W) (cap.emb v) p := by + refine ⟨hvp, hF.1, ⟨hAs, hA⟩, ⟨hBs, hB⟩, ?_, ?_, hAB.le, hd, + ⟨walkDrawing_isSubdrawing _ _, walkDrawing_isPathBetween _ hWs⟩, ?_, ?_⟩ + · conv_lhs => rw [← hsup, Drawing.sup_V hAs hBs] + · conv_lhs => rw [← hsup, Drawing.sup_E hAs hBs] + · rw [hQV]; exact inter_subset_left + · rw [hQE]; simpa using hn + have side : ∀ {X : Drawing Shat}, X.IsPathBetween (cap.emb v) p → X.IsSubdrawing F → + (walkDrawing G W).E.ncard < X.E.ncard := by + intro X hX hXs + obtain ⟨f, hf, x, hl, -, hsec⟩ := path_first hX hvp + have hfF := hXs.2 hf + have hlG := ((hXs.trans hF.1).isLink_iff hf).mp hl + obtain ⟨hxR, hset⟩ := D.rad.link_cases' hlG hv + have hxp : x ≠ p := by + rintro rfl + exact hn (D.rad.edge_unique hS h3 he (hF.1.2 hfF) hv hxR hs hset ▸ hfF) + obtain ⟨f', hf', hff, -⟩ := hsec hxp + have hsub : ({f, f'} : Set (Set Shat)) ⊆ X.E := by + rintro _ (rfl | rfl) + · exact hf + · exact hf' + rw [hQE, ncard_singleton] + have := ncard_le_ncard hsub X.finite_edges + rw [ncard_pair hff.symm] at this + omega + refine ⟨A, B, _, ht, fun x hx ↦ ?_, side hA hAs, side hB hBs⟩ + rw [mem_walkDrawing_U] at hx + rcases hx with hx | ⟨f, hf, hxf⟩ + · have hmem₁ : cap.emb v ∈ closure e ∩ D.rad.G.V := by rw [hs]; exact Or.inl rfl + have hmem₂ : p ∈ closure e ∩ D.rad.G.V := by rw [hs]; exact Or.inr rfl + simp only [W, GraphWalk.support, List.mem_cons, List.not_mem_nil, or_false] at hx + rcases hx with rfl | rfl + · exact hmem₁.1 + · exact hmem₂.1 + · simp only [W, GraphWalk.edges, List.mem_cons, List.not_mem_nil, or_false] at hf + subst hf + exact hxf + +include hS in +omit [T2Space S] [T2Space Shat] hS in +/-- A subdrawing of `Γ*` with no pole but `r` lies in `Σ` and the cuff disc of `r`. -/ +theorem U_subset_of_one_pole {F : Drawing Shat} (hF : F.IsSubdrawing D.rad.G) {r : Shat} {Θ : Set + S} (hreg : D.rad.regionOf r = cap.cuffDisc Θ) + (hr : r ∈ cap.cuffDisc Θ) (hone : ∀ p ∈ D.rad.poles, p ∈ F.V → p = r) : F.U ⊆ range cap.emb ∪ + cap.cuffDisc Θ := by + have : ConnectedSpace Shat := cap.connected + intro x hx + by_cases hxV : x ∈ F.V + · by_cases hh : x ∈ D.P.Γ.hatV cap + · obtain ⟨v, -, rfl⟩ := hh + exact Or.inl (mem_range_self v) + · have hw : x ∈ D.rad.Rstar := ⟨hF.1 hxV, hh⟩ + by_cases hp : x ∈ D.rad.poles + · exact Or.inr (hone x hp hxV ▸ hr) + · exact Or.inl (D.rad.region_subset_range hw hp (D.rad.regionOf_mem hw).2) + · obtain ⟨f, hf, hxf⟩ := F.exists_edge_of_mem hx hxV + obtain ⟨v, -, w, hw, hset⟩ := D.rad.edge_ends (hF.2 hf) + have hwm : w ∈ closure f ∩ D.rad.G.V := by rw [hset]; exact Or.inr rfl + have hwF : w ∈ F.V := mem_V_of_mem_U hF (F.closure_subset_U hf hwm.1) hwm.2 + by_cases hp : w ∈ D.rad.poles + · have := D.rad.edge_subset_region (hF.2 hf) hw hset hxf + rw [hone w hp hwF, hreg] at this + exact Or.inr this + · exact Or.inl (D.rad.edge_subset_range (hF.2 hf) hw hp hset hxf) + +include hS h3 in +/-- **A cuff with its pole outside a least flaw circuit meets the inside of the circuit in at most +one point.** -/ +theorem touch_subsingleton {n : ℕ} (hn : n < D.rep) {F : Drawing Shat} (hF : D.IsFreeCircuit n F) + (hmin : ∀ C, D.IsFreeCircuit n C → F.E.ncard ≤ C.E.ncard ∧ (F.E.ncard = C.E.ncard + → D.insCount C ≤ D.insCount F)) + {p : Shat} (hp : p ∈ D.rad.poles) (hpi : p ∉ D.ins F) {Θ : Set S} (hΘ : Θ ∈ cuffs S) + (hreg : D.rad.regionOf p = cap.cuffDisc Θ) + (hdis : Disjoint (cap.cuffDisc Θ) F.U) : (closure (cap.cuffDisc Θ) ∩ D.ins F).Subsingleton := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hle := hF.2.1 + have hlt : F.E.ncard < 2 * D.rep := by omega + have hi := D.ins_spec hF.1 hlt + have hfr : frontier (D.ins F) = F.U := by + rw [IsClosedDisc.frontier_eq_discBd hT hi.2.2.1, hi.2.2.2.1] + have hconn : IsPreconnected (cap.cuffDisc Θ) := hreg ▸ isPreconnected_connectedComponentIn + have hpd := (D.rad.regionOf_mem hp.1).2 + rw [hreg] at hpd + have hd : Disjoint (cap.cuffDisc Θ) (D.ins F) := by + refine disjoint_left.2 fun x hx hxi ↦ ?_ + obtain ⟨z, hz, hzf⟩ := inter_frontier_of_preconnected hconn hi.2.2.1.isClosed ⟨x, hx, hxi⟩ ⟨p, + hpd, hpi⟩ + rw [hfr] at hzf + exact disjoint_left.1 hdis hz hzf + have hEF : ∀ {x}, x ∈ closure (cap.cuffDisc Θ) ∩ D.ins F → x ∈ F.U := by + rintro x ⟨hx, hxi⟩ + rw [← hfr, frontier_eq_closure_inter_closure] + exact ⟨subset_closure hxi, closure_mono (fun y hy ↦ disjoint_left.1 hd hy) hx⟩ + have hEdis : Disjoint (closure (cap.cuffDisc Θ)) (discInt (D.ins F)) + := disjoint_left.2 fun x hx hxi ↦ + hxi.2 (hi.2.2.2.1 ▸ hEF ⟨hx, discInt_subset _ hxi⟩) + have hemb : ∀ {x}, x ∈ closure (cap.cuffDisc Θ) ∩ D.ins F → ∃ v ∈ Θ, cap.emb v = x := by + intro x hx + have h₁ := hx.1 + rw [cap.closure_cuffDisc hΘ] at h₁ + rcases h₁ with h₁ | h₁ + · exact absurd (hEF hx) (disjoint_left.1 hdis h₁) + · exact h₁ + have hpF : p ∉ F.V := fun h ↦ hpi (D.U_subset_ins hF.1 hlt (F.V_subset_U h)) + intro x hx y hy + obtain ⟨v₁, h₁, rfl⟩ := hemb hx + obtain ⟨v₂, h₂, rfl⟩ := hemb hy + by_contra hne + have hne' : v₁ ≠ v₂ := fun h ↦ hne (by rw [h]) + obtain ⟨hV₁, hF₁, -⟩ := D.rad.bd_point hF.1.1 (cuff_subset_bd ⟨Θ, hΘ⟩ h₁) (hEF hx) + obtain ⟨hV₂, hF₂, -⟩ := D.rad.bd_point hF.1.1 (cuff_subset_bd ⟨Θ, hΘ⟩ h₂) (hEF hy) + obtain ⟨e₁, he₁, hs₁⟩ := D.rad.exists_pole_edge hS h3 hp hΘ hreg hV₁ h₁ + obtain ⟨e₂, he₂, hs₂⟩ := D.rad.exists_pole_edge hS h3 hp hΘ hreg hV₂ h₂ + obtain ⟨A, B, Q, ht, hpQ, c₁, c₂, hQU⟩ := exists_theta_pole hF.1 hp hpF hV₁ hV₂ hne' hF₁ hF₂ he₁ + he₂ hs₁ hs₂ + have hcl : ∀ {e}, e ∈ D.rad.G.E → ∀ {x}, closure e ∩ D.rad.G.V = {x, p} → closure e ⊆ closure + (cap.cuffDisc Θ) := fun he _ hs ↦ + closure_mono (hreg ▸ D.rad.edge_subset_region he hp.1 (by rw [hs])) + have hQd : Disjoint Q.U (discInt (D.ins F)) := + Disjoint.mono_left (hQU.trans (union_subset (hcl he₁ hs₁) (hcl he₂ hs₂))) hEdis + exact theta_contra hn hF hmin ht hQd c₁ c₂ (Or.inl ⟨p, hpQ, hpi⟩) + +omit [T2Space S] in +/-- A point of a cuff disc inside a circuit that misses the cuff disc, with the pole outside, lies +on the circuit. -/ +theorem cuff_inter_ins_of_disjoint (D : TangleDatum cap χ) {C : Drawing Shat} + (hC : C.IsCircuitOf D.rad.G) (hlt : C.E.ncard < 2 * D.rep) {p : Shat} + (hp : p ∈ D.rad.poles) (hpi : p ∉ D.ins C) {Θ : Set S} (hreg : D.rad.regionOf p + = cap.cuffDisc Θ) (hdis : Disjoint (cap.cuffDisc Θ) C.U) {x : Shat} + (hx : x ∈ closure (cap.cuffDisc Θ)) (hxi : x ∈ D.ins C) : x ∈ C.U := by + have hT := cap.isClosedSurface + have hi := D.ins_spec hC hlt + have hfr : frontier (D.ins C) = C.U := by + rw [IsClosedDisc.frontier_eq_discBd hT hi.2.2.1, hi.2.2.2.1] + have hconn : IsPreconnected (cap.cuffDisc Θ) := hreg ▸ isPreconnected_connectedComponentIn + have hpd := (D.rad.regionOf_mem hp.1).2 + rw [hreg] at hpd + have hd : Disjoint (cap.cuffDisc Θ) (D.ins C) := by + refine disjoint_left.2 fun y hy hyi ↦ ?_ + obtain ⟨z, hz, hzf⟩ := inter_frontier_of_preconnected hconn hi.2.2.1.isClosed ⟨y, hy, hyi⟩ ⟨p, + hpd, hpi⟩ + rw [hfr] at hzf + exact disjoint_left.1 hdis hz hzf + rw [← hfr, frontier_eq_closure_inter_closure] + exact ⟨subset_closure hxi, closure_mono (fun y hy ↦ disjoint_left.1 hd hy) hx⟩ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FreeFrame.lean b/LeanPool/GraphMinor/GM19/FreeFrame.lean new file mode 100644 index 0000000000..5b90a94c6d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FreeFrame.lean @@ -0,0 +1,303 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.LineCut +public import LeanPool.GraphMinor.GM19.Section10g + +import LeanPool.GraphMinor.GM19.FragmentOrient + +/-! +# The refinement in the proof of (10.5) + +Let `Σ'` be a fragment on which `ψ` is one to one. Suppose `Φ` has more vertices in the part that is +cut off than the cut has vertices, +and suppose each long side keeps at most one piece. Then the colour scheme of the fragment is a +refinement of `χ`. + +To count we use that a frame has as many sides as vertices (`Frame.ncard_sides`), which holds cuff +by cuff by `arcs_of_oArc`. So the +short sides are the vertices less the long sides, and it suffices that each long side keeps a piece +and that the fragment has fewer +vertices than `Φ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe w + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +/-- **A frame has as many sides as vertices.** -/ +theorem Frame.ncard_sides (hS : IsSurface S) (Φ : Frame S) : Φ.sides.ncard = Φ.V.ncard := by + classical + have hfc : (cuffs S).Finite := (cuff_statement S hS).2.1 + have key : ∀ 𝓒 : Set (Set S), 𝓒.Finite → 𝓒 ⊆ cuffs S → + (arcComponentsIn (⋃₀ 𝓒 \ Φ.V)).Finite ∧ (arcComponentsIn (⋃₀ 𝓒 \ Φ.V)).ncard = + (Φ.V ∩ ⋃₀ 𝓒).ncard := by + intro 𝓒 hf + induction 𝓒, hf using Set.Finite.induction_on with + | empty => + intro _ + have : arcComponentsIn (⋃₀ (∅ : Set (Set S)) \ Φ.V) = ∅ := by + ext e + simp only [sUnion_empty, empty_sdiff, mem_empty_iff_false, iff_false] + rintro ⟨⟨x, hx⟩, h, -⟩ + exact h hx + rw [this] + simp + | @insert C 𝓒 hC hf ih => + intro hsub + have hCc : C ∈ cuffs S := hsub (mem_insert _ _) + obtain ⟨h₁, h₂⟩ := ih fun _ h ↦ hsub (mem_insert_of_mem _ h) + let C' : cuffs S := ⟨C, hCc⟩ + have hO : IsOArc C := ⟨cuffPar hS C'⟩ + have hcC : IsClosed C := isClosed_cuff hS C' + have hcU : IsClosed (⋃₀ 𝓒) := hf.isClosed_sUnion fun D hD ↦ isClosed_cuff hS ⟨D, hsub + (mem_insert_of_mem _ hD)⟩ + have hdis : Disjoint C (⋃₀ 𝓒) := disjoint_left.2 fun x hx ⟨D, hD, hxD⟩ ↦ + hC ((cuffs_eq_of_mem hCc (hsub (mem_insert_of_mem _ hD)) hx hxD) ▸ hD) + have hint : C ∩ ⋃₀ 𝓒 ⊆ Φ.V := by + rw [disjoint_iff_inter_eq_empty.1 hdis] + exact empty_subset _ + have h2 : 2 ≤ (Φ.V ∩ C).ncard := by + obtain ⟨p, hp, q, hq, hne⟩ := Frame.two_on_cuff hS Φ C' + exact (one_lt_ncard (Φ.finite_V.subset inter_subset_left)).2 ⟨p, hp, q, hq, hne⟩ + obtain ⟨f₃, n₃, -⟩ := arcs_of_oArc (Φ.finite_V.subset inter_subset_left) hO + inter_subset_right h2 + have hs : C \ (Φ.V ∩ C) = C \ Φ.V := by + ext z + simp only [mem_sdiff, mem_inter_iff, not_and] + exact ⟨fun h ↦ ⟨h.1, fun hz ↦ h.2 hz h.1⟩, fun h ↦ ⟨h.1, fun hz ↦ absurd hz h.2⟩⟩ + rw [hs] at f₃ n₃ + have hA : arcComponentsIn (⋃₀ insert C 𝓒 \ Φ.V) = arcComponentsIn (C \ Φ.V) ∪ arcComponentsIn + (⋃₀ 𝓒 \ Φ.V) := by + rw [sUnion_insert] + exact arcComponentsIn_union_sdiff hcC hcU hint + have hdisj : Disjoint (arcComponentsIn (C \ Φ.V)) (arcComponentsIn (⋃₀ 𝓒 \ Φ.V)) + := disjoint_left.2 fun e he₁ he₂ ↦ by + obtain ⟨z, hz⟩ := he₁.1 + exact disjoint_left.1 hdis (he₁.2.1 hz).1 (he₂.2.1 hz).1 + rw [hA] + refine ⟨f₃.union h₁, ?_⟩ + have hdisjV : Disjoint (Φ.V ∩ C) (Φ.V ∩ ⋃₀ 𝓒) := + disjoint_left.2 fun x hx hx' => disjoint_left.1 hdis hx.2 hx'.2 + rw [ncard_union_eq hdisj f₃ h₁, n₃, h₂, sUnion_insert, inter_union_distrib_left, + ncard_union_eq hdisjV (Φ.finite_V.subset inter_subset_left) + (Φ.finite_V.subset inter_subset_left)] + obtain ⟨-, h⟩ := key (cuffs S) hfc Subset.rfl + rw [sUnion_cuffs, inter_eq_left.2 Φ.V_subset] at h + exact h + +/-- A side of a frame lies on one cuff, and it has two ends there, both vertices of the frame. -/ +theorem Frame.side_on_cuff (hS : IsSurface S) (Φ : Frame S) {s : Set S} (hs : s ∈ Φ.sides) : + ∃ Θ ∈ cuffs S, s ⊆ Θ ∧ IsMarkedArc (Φ.V ∩ Θ) s := by + classical + have hs' : s ∈ arcComponentsIn (bd S \ Φ.V) := hs + obtain ⟨⟨x, hx⟩, hsub, hpc, hmax⟩ := hs' + have hxb : x ∈ bd S := (hsub hx).1 + let Θ := connectedComponentIn (bd S) x + have hΘ : Θ ∈ cuffs S := ⟨x, hxb, rfl⟩ + have hsΘ : s ⊆ Θ := hpc.isConnected.isPreconnected.subset_connectedComponentIn hx fun y hy ↦ + (hsub hy).1 + let C' : cuffs S := ⟨Θ, hΘ⟩ + have hO : IsOArc Θ := ⟨cuffPar hS C'⟩ + have h2 : 2 ≤ (Φ.V ∩ Θ).ncard := by + obtain ⟨p, hp, q, hq, hne⟩ := Frame.two_on_cuff hS Φ C' + exact (one_lt_ncard (Φ.finite_V.subset inter_subset_left)).2 ⟨p, hp, q, hq, hne⟩ + obtain ⟨-, -, hm⟩ := arcs_of_oArc (Φ.finite_V.subset inter_subset_left) hO inter_subset_right h2 + refine ⟨Θ, hΘ, hsΘ, (hm s ?_).1⟩ + refine ⟨⟨x, hx⟩, fun y hy ↦ ⟨hsΘ hy, fun h ↦ (hsub hy).2 h.1⟩, hpc, + fun T hT hTp hsT ↦ hmax T (fun y hy ↦ ?_) hTp hsT⟩ + exact ⟨cuff_subset_bd C' (hT hy).1, fun h ↦ (hT hy).2 ⟨h, (hT hy).1⟩⟩ + + +variable {S₁ : Type} [TopologicalSpace S₁] [T2Space S₁] [Nonempty S₁] {β : Type w} {χ : + ColourScheme S β} {K : Drawing S} {ψ : S₁ → S} + {Γ : Painting S} + +theorem QuasiOrder.isSubIdeal_refl (Ω : QuasiOrder β) : Ω.IsSubIdeal Ω + := ⟨Subset.rfl, fun _ _ _ h _ ↦ h, fun _ _ _ _ ↦ Iff.rfl⟩ + +omit [Nonempty S₁] in +omit [T2Space S₁] in +/-- Two sides of the frame of a fragment over a path-connected set of `bd(Σ)` without vertices are +equal, if `ψ` is one to one. -/ +theorem FrameData.side_eq_of_isPathConnected {Φ : Frame S} (D : FrameData Φ Γ K ψ) + (hinj : Function.Injective ψ) {B : Set S} + (hB : IsPathConnected B) (hBr : B ⊆ range ψ) (hBb : B ⊆ bd S) (hBV : Disjoint B + (Φ.V ∪ K.V)) {R₁ R₂ : Set S₁} + (h₁ : R₁ ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ)) (h₂ : R₂ ∈ arcComponentsIn + (bd S₁ \ pullFrameV Φ K ψ)) (hs₁ : ψ '' R₁ ⊆ B) + (hs₂ : ψ '' R₂ ⊆ B) : R₁ = R₂ := by + have : CompactSpace S₁ := D.pull.frag.isSurface.1 + have he : IsClosedEmbedding ψ := D.pull.frag.continuous_ψ.isClosedEmbedding hinj + have hX : IsPathConnected (ψ ⁻¹' B) := by + rw [he.isInducing.isPathConnected_iff, image_preimage_eq_of_subset hBr] + exact hB + have hsub : ψ ⁻¹' B ⊆ bd S₁ \ pullFrameV Φ K ψ := fun x hx ↦ + ⟨D.pull.mem_bd_of_notMem_R (Or.inl (hBb hx)), fun hv ↦ disjoint_left.1 hBV hx hv⟩ + have e₁ := h₁.2.2.2 _ hsub hX (image_subset_iff.1 hs₁) + have e₂ := h₂.2.2.2 _ hsub hX (image_subset_iff.1 hs₂) + exact e₁.symm.trans e₂ + +open Classical in +omit [Nonempty S₁] in +/-- **The colour scheme of the fragment is a refinement of `χ`.** -/ +theorem fragScheme_isRefinement (D : FrameData χ.Φ Γ K ψ) (hF : IsFeature χ.Φ K) (flip : Set S₁ + → Bool) (a₀ : β) + (hhom : Nonempty (S₁ ≃ₜ S)) (hinj : Function.Injective ψ) + (hconn : ∀ s ∈ χ.Φ.longSides, (s ∩ range ψ) \ K.U = ∅ ∨ IsPathConnected ((s ∩ range ψ) \ K.U)) + (hcount : (∃ s ∈ χ.Φ.longSides, s ∩ range ψ ⊆ K.U) ∨ K.V.ncard < (χ.Φ.V ∩ + ((range ψ)ᶜ ∪ K.U)).ncard) : + (fragScheme χ a₀ D hF flip).IsRefinement χ := by + have hS := D.pull.surface + have hS₁ := D.pull.frag.isSurface + set Φ' := D.frame hF flip with hΦ' + have hlongs : ∀ R, R ∈ Φ'.longSides ↔ R ∈ arcComponentsIn (bd S₁ \ pullFrameV χ.Φ K ψ) + ∧ ∃ s ∈ χ.Φ.longSides, ψ '' R ⊆ s := + fun R ↦ Iff.rfl + let f : Set S₁ → Set S := fun R ↦ if h : ∃ s ∈ χ.Φ.longSides, ψ '' R ⊆ s then h.choose else ∅ + have hf : ∀ {R}, (∃ s ∈ χ.Φ.longSides, ψ '' R ⊆ s) → f R ∈ χ.Φ.longSides ∧ ψ '' R ⊆ f R + := fun {R} h ↦ by + simp only [f, dite_eq_left h] + exact h.choose_spec + have hoffK : ∀ {R s}, R ∈ arcComponentsIn (bd S₁ \ pullFrameV χ.Φ K ψ) → s ∈ χ.Φ.longSides + → ψ '' R ⊆ s → ψ '' R ⊆ (s ∩ range ψ) \ K.U := by + rintro R s hR hs hsub _ ⟨x, hx, rfl⟩ + refine ⟨⟨hsub (mem_image_of_mem _ hx), mem_range_self x⟩, fun hk ↦ ?_⟩ + have hb : ψ x ∈ bd S := (hs.1.2.1 (hsub (mem_image_of_mem _ hx))).1 + exact (hR.2.1 hx).2 (Or.inr (D.K_bd ⟨hk, hb⟩)) + have huniq : ∀ {R₁ R₂}, R₁ ∈ Φ'.longSides → R₂ ∈ Φ'.longSides → f R₁ = f R₂ → R₁ = R₂ := by + intro R₁ R₂ h₁ h₂ he + obtain ⟨h₁s, h₁l⟩ := (hlongs R₁).1 h₁ + obtain ⟨h₂s, h₂l⟩ := (hlongs R₂).1 h₂ + obtain ⟨m₁, s₁⟩ := hf h₁l + obtain ⟨m₂, s₂⟩ := hf h₂l + rw [← he] at m₂ s₂ + have b₁ := hoffK h₁s m₁ s₁ + have b₂ := hoffK h₁s m₁ s₁ + have b₂' := hoffK h₂s m₁ s₂ + obtain ⟨x, hx⟩ := h₁s.1 + have hne : ((f R₁ ∩ range ψ) \ K.U).Nonempty := ⟨_, b₁ (mem_image_of_mem _ hx)⟩ + rcases hconn _ m₁ with h₀ | hp + · exact absurd hne (by rw [h₀]; exact not_nonempty_empty) + · refine D.side_eq_of_isPathConnected hinj hp (fun z hz ↦ hz.1.2) (fun z hz ↦ + (m₁.1.2.1 hz.1.1).1) ?_ h₁s h₂s b₁ b₂' + refine disjoint_left.2 fun z hz hv ↦ ?_ + rcases hv with hv | hv + · exact (m₁.1.2.1 hz.1.1).2 hv + · exact hz.2 (K.V_subset_U hv) + refine ⟨hhom, rfl, rfl, f, fun R hR ↦ (hf ((hlongs R).1 hR).2).1, fun R hR ↦ ?_, + fun R₁ h₁ R₂ h₂ hne he ↦ absurd (huniq h₁ h₂ he) hne, ?_⟩ + · obtain ⟨hRs, hl⟩ := (hlongs R).1 hR + obtain ⟨m, sub⟩ := hf hl + have : (fragScheme χ a₀ D hF flip).ΩS R = χ.ΩS (f R) := fragScheme_ΩS hRs.1 m.1 sub + rw [this] + exact QuasiOrder.isSubIdeal_refl _ + · intro hall + have hcard : K.V.ncard < (χ.Φ.V ∩ ((range ψ)ᶜ ∪ K.U)).ncard := by + rcases hcount with ⟨s, hs, hsub⟩ | h + · exfalso + obtain ⟨R, hR, hsf, -⟩ := hall s hs + obtain ⟨hRs, hl⟩ := (hlongs R).1 hR + obtain ⟨m, sub⟩ := hf hl + obtain ⟨x, hx⟩ := hRs.1 + have := hoffK hRs m sub (mem_image_of_mem _ hx) + exact this.2 (hsub ⟨hsf ▸ this.1.1, this.1.2⟩) + · exact h + have hfΦ : χ.Φ.sides.Finite := χ.Φ.finite_sides + have hfΦ' : Φ'.sides.Finite := Φ'.finite_sides + have hsΦ := Frame.ncard_sides hS χ.Φ + have hsΦ' := Frame.ncard_sides hS₁ Φ' + have hsplit : ∀ {T : Type} [TopologicalSpace T] (X : Frame T), X.longSides.ncard + + X.shortSides.ncard = X.sides.ncard := by + intro T _ X + have hd : Disjoint X.longSides X.shortSides := disjoint_left.2 fun _ h h' ↦ h'.2 h.2 + have hu : X.longSides ∪ X.shortSides = X.sides := by + ext e + constructor + · rintro (h | h) + · exact h.1 + · exact h.1 + · intro h + by_cases hl : X.isLong e + · exact Or.inl ⟨h, hl⟩ + · exact Or.inr ⟨h, hl⟩ + rw [← hu, ncard_union_eq hd (X.finite_sides.subset fun _ h ↦ h.1) + (X.finite_sides.subset fun _ h ↦ h.1)] + have hL : χ.Φ.longSides.ncard ≤ Φ'.longSides.ncard := by + have hsub : χ.Φ.longSides ⊆ f '' Φ'.longSides := fun s hs ↦ by + obtain ⟨R, hR, h, -⟩ := hall s hs + exact ⟨R, hR, h⟩ + have hfin : Φ'.longSides.Finite := hfΦ'.subset fun _ h => h.1 + exact (ncard_le_ncard hsub (hfin.image _)).trans (ncard_image_le hfin) + have hP := χ.Φ.finite_V + set P := χ.Φ.V ∩ ((range ψ)ᶜ ∪ K.U) with hPdef + have hVsub : ψ '' Φ'.V ⊆ (χ.Φ.V \ P) ∪ K.V := by + rintro _ ⟨x, hx, rfl⟩ + rcases hx with h | h + · by_cases hk : ψ x ∈ K.U + · exact Or.inr (D.K_bd ⟨hk, χ.Φ.V_subset h⟩) + · exact Or.inl ⟨h, fun hp ↦ hp.2.elim (fun h' ↦ h' (mem_range_self x)) hk⟩ + · exact Or.inr h + have hle : Φ'.V.ncard ≤ (χ.Φ.V \ P).ncard + K.V.ncard := by + rw [← ncard_image_of_injective _ hinj] + exact (ncard_le_ncard hVsub ((hP.subset sdiff_subset).union K.finite_V)).trans + (ncard_union_le _ _) + have hdiff : (χ.Φ.V \ P).ncard + P.ncard = χ.Φ.V.ncard := ncard_sdiff_add_ncard_of_subset + inter_subset_left hP + have h₁ := hsplit χ.Φ + have h₂ := hsplit Φ' + change Φ'.shortSides.ncard < χ.Φ.shortSides.ncard + omega + +/-- The places of one fragment are well-behaved by `S₄`, if the fragment is a copy of `Σ` and the +count of `fragScheme_isRefinement` +holds. -/ +theorem wellBehaved_S4 (hS : IsSurface S) {K : Drawing S} (hF : IsFeature χ.Φ K) {𝒮 : Set + (ColouredPainting χ)} + (hcl : IsPaintingClass χ 𝒮) + (hlines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} + ∧ IsLineWithEnds (closure e) u v) + {Y : Type} [TopologicalSpace Y] [T2Space Y] {ψ : Y → S} (hY : IsSurface Y) + (hψ : IsCutMap ψ K.U) (hsheet : HasSheets ψ K) + (y : Y) (l : List S) (m : ℕ) (a₀ : β) (hS4 : ConditionS4 χ) (hhom : Nonempty + (connectedComponent y ≃ₜ S)) + (hinj : InjOn ψ (connectedComponent y)) + (hconn : ∀ s ∈ χ.Φ.longSides, (s ∩ (ψ '' connectedComponent y)) \ K.U = ∅ ∨ IsPathConnected + ((s ∩ (ψ '' connectedComponent y)) \ K.U)) + (hcount : (∃ s ∈ χ.Φ.longSides, s ∩ (ψ '' connectedComponent y) ⊆ K.U) ∨ + K.V.ncard < (χ.Φ.V ∩ ((ψ '' connectedComponent y)ᶜ ∪ K.U)).ncard) + (hO : IsOrientableSurface (connectedComponent y) → IsOrientableSurface S) : + IsWellBehavedPlaces {X | IsCutPlace χ K (fun x : connectedComponent y ↦ ψ x.1) l m X ∧ X.P ∈ 𝒮} + := by + have : Nonempty (connectedComponent y) := ⟨⟨y, mem_connectedComponent⟩⟩ + have hr : range (fun x : connectedComponent y ↦ ψ x.1) = ψ '' connectedComponent y := by + ext z + simp + apply wellBehaved_of_fragment (fun x : connectedComponent y ↦ ψ x.1) hF l m a₀ + (fun a b hab hoff ↦ Subtype.ext (hψ.2.2.1 hoff (fun h ↦ hoff (hab ▸ h)) hab)) + (fun X hX ↦ frameData_of_cut hS X.P.fits hX.inter hlines hY hψ hsheet y) + intro seq hq h flip hflip + set D := fun i ↦ frameData_of_cut hS (seq i).P.fits (h i).inter hlines hY hψ hsheet y with hDdef + have hnb := hS4 _ (fragScheme χ a₀ (D 0) hF flip) (fragScheme_isRefinement (D 0) hF flip a₀ hhom + (fun a b hab ↦ Subtype.ext (hinj a.2 b.2 hab)) (by rw [hr]; exact hconn) + (by rw [hr]; exact hcount)) + have hsim := frag_similarly hcl hS hF a₀ (D 0) (fun i ↦ (seq i).P) hq D (fun i ↦ + (h i).anchored) flip hO + by_contra hno + push Not at hno + exact hnb ⟨_, fun i j hij ⟨σv, σe, hσ⟩ ↦ hno i j hij σv σe hσ, hsim⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FreeShape.lean b/LeanPool/GraphMinor/GM19/FreeShape.lean new file mode 100644 index 0000000000..7f55a79fbf --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FreeShape.lean @@ -0,0 +1,409 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FreeTopology +public import LeanPool.GraphMinor.GM19.Section10j +public import LeanPool.GraphMinor.GM19.FragmentOrient + +/-! +# The fragment outside a freedom flaw + +`IsFreeShape cap Φ K Z` says what the proof of (10.5) needs of the closed disc `Z` around a flaw. If +the fragment outside `Z` has fewer +cuffs than `Σ` we use `S₃`. Otherwise it is a copy of `Σ` on which `ψ` is one to one +(`free_fragment`), and we use `S₄`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + + +/-- What the count needs: each long side keeps at most one piece outside `In`, and `In` holds a long +side or more vertices of the frame +than `K` has. -/ +def FreeFacts (Φ : Frame S) (K : Drawing S) (In : Set S) : Prop := + (∀ s ∈ Φ.longSides, s \ In = ∅ ∨ IsPathConnected (s \ In)) ∧ ((∃ s ∈ Φ.longSides, s ⊆ In) + ∨ K.V.ncard < (Φ.V ∩ In).ncard) + +/-- The closed disc `Z` around a freedom flaw. -/ +structure IsFreeShape (cap : IsCappedSurface S Shat) (Φ : Frame S) (K : Drawing S) + (Z : Set Shat) : Prop where + disc : IsClosedDisc Z + sub : cap.emb '' K.U ⊆ discBd Z + rest : discBd Z ⊆ cap.discs ∪ cap.emb '' K.U + touch : ∀ Θ ∈ cuffs S, ¬ closure (cap.cuffDisc Θ) ⊆ Z → (closure (cap.cuffDisc Θ) ∩ + Z).Subsingleton + inner : ∃ Θ ∈ cuffs S, closure (cap.cuffDisc Θ) ⊆ Z + facts : (∀ Θ ∈ cuffs S, closure (cap.cuffDisc Θ) ⊆ Z ∨ Disjoint (closure (cap.cuffDisc Θ)) Z) → + FreeFacts Φ K (cap.emb ⁻¹' discInt Z ∪ K.U) + +/-- What makes a fragment good for (10.5). -/ +def FreeGood {Y : Type} [TopologicalSpace Y] (Φ : Frame S) (K : Drawing S) + (Shat : Type) [TopologicalSpace Shat] (ψ : Y → S) (c : Set Y) : Prop := + (∀ (Shat₁ : Type) [TopologicalSpace Shat₁], IsCappedSurface c Shat₁ → Nonempty (Shat₁ ≃ₜ Shat)) ∧ + (IsOrientableSurface c → IsOrientableSurface S) ∧ + (numCuffs c < numCuffs S ∨ (Nonempty (c ≃ₜ S) ∧ InjOn ψ c ∧ + (∀ s ∈ Φ.longSides, (s ∩ (ψ '' c)) \ K.U = ∅ ∨ IsPathConnected ((s ∩ (ψ '' c)) \ K.U)) ∧ + ((∃ s ∈ Φ.longSides, s ∩ (ψ '' c) ⊆ K.U) ∨ K.V.ncard < (Φ.V ∩ ((ψ '' c)ᶜ ∪ K.U)).ncard))) + +/-- **The fragment outside `Z`.** -/ +theorem free_fragment {Y : Type} [TopologicalSpace Y] [T2Space Y] [ConnectedSpace S] + (hS : IsSurface S) (cap : IsCappedSurface S Shat) + {Φ : Frame S} {K : Drawing S} {Z : Set Shat} (h : IsFreeShape cap Φ K Z) {ψ : Y → S} + (hY : IsSurface Y) (hψ : IsCutMap ψ K.U) : + ∃ y : Y, ψ '' connectedComponent y = (cap.emb ⁻¹' discInt Z)ᶜ ∧ FreeGood Φ K Shat ψ + (connectedComponent y) := by + classical + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have hD := h.disc + have : ConnectedSpace Shat := cap.connected + have hfc : (cuffs S).Finite := (cuff_statement S hS).2.1 + have hbd : Z \ discInt Z ⊆ discBd Z := by + rintro x ⟨hx, hn⟩ + by_contra hb + exact hn ⟨hx, hb⟩ + obtain ⟨y, hy, hcap, hnum, T', _, e, P, hT', ⟨hom⟩, hP, hs, ht⟩ := exists_outer_fragment_core hS + cap hY hψ hD.isClosed + (hD.isOpen_discInt hman) (discInt_subset Z) (fun c hc ↦ isCell_disc hT + (isClosedDisc_image_injOn hD c.continuous.continuousOn hc).1) + (h.sub.trans (Surface.discBd_subset Z)) (hbd.trans h.rest) (hbd.trans + (discBd_subset_closure_compl hT hD)) h.touch + have hy' : ψ '' connectedComponent y = (cap.emb ⁻¹' discInt Z)ᶜ := by rw [hy, preimage_compl] + refine ⟨y, hy', hcap, fun ⟨ω⟩ ↦ ?_, ?_⟩ + · have : T2Space T' := hT'.2.1 + have : ConnectedSpace Shat := cap.connected + have : ConnectedSpace T' := hom.symm.surjective.connectedSpace hom.symm.continuous + have h₁ := isOrientable_of_inside hT' hP e hs ht (ω.isPartial _) + exact isOrientable_of_embedding cap.isEmbedding (isOrientable_of_embedding hom.symm.isEmbedding + h₁) + by_cases hlt : numCuffs (connectedComponent y) < numCuffs S + · exact Or.inl hlt + right + have hall : ∀ Θ ∈ cuffs S, closure (cap.cuffDisc Θ) ⊆ Z ∨ Disjoint (closure (cap.cuffDisc Θ)) Z + := by + by_contra hno + push Not at hno + obtain ⟨Θ₀, hΘ₀, hn₁, hn₂⟩ := hno + obtain ⟨Θ₁, hΘ₁, hin⟩ := h.inner + have hne' : Θ₀ ≠ Θ₁ := by + rintro rfl + exact hn₁ hin + have hE₁ : (closure (cap.cuffDisc Θ₁)).Nonempty := (cap.cuffDisc_closedDisc _ + hΘ₁).nonempty_discInt.mono (discInt_subset _) + have hsub : {Θ ∈ cuffs S | Disjoint (closure (cap.cuffDisc Θ)) Z} ⊆ cuffs S \ {Θ₀, Θ₁} := by + rintro Θ ⟨hΘ, hd⟩ + refine ⟨hΘ, ?_⟩ + rintro (rfl | h') + · exact hn₂ hd + · rw [mem_singleton_iff.1 h'] at hd + obtain ⟨x, hx⟩ := hE₁ + exact disjoint_left.1 hd hx (hin hx) + have h₁ := ncard_le_ncard hsub (hfc.subset sdiff_subset) + have h₂ : (cuffs S \ {Θ₀, Θ₁}).ncard + ({Θ₀, Θ₁} : Set (Set S)).ncard = (cuffs S).ncard := + ncard_sdiff_add_ncard_of_subset (by + rintro _ (rfl | h') + · exact hΘ₀ + · exact (mem_singleton_iff.1 h') ▸ hΘ₁) hfc + rw [ncard_pair hne'] at h₂ + change ¬ numCuffs (connectedComponent y) < (cuffs S).ncard at hlt + omega + have hfrag := isCuttingFragment_of_cut hS hY hψ (K := K) rfl y + have hconn := hfrag.connected + obtain ⟨Shat₁, _, ⟨cap₁⟩⟩ := exists_cappedSurface _ (connectedComponent y) hfrag.isSurface hconn + rfl + have hle : numCuffs S ≤ numCuffs (connectedComponent y) := not_lt.1 hlt + have hcard : numCuffs (connectedComponent y) = numCuffs S := by + refine le_antisymm ?_ hle + obtain ⟨Θ₁, hΘ₁, hin⟩ := h.inner + have hE₁ : (closure (cap.cuffDisc Θ₁)).Nonempty := (cap.cuffDisc_closedDisc _ + hΘ₁).nonempty_discInt.mono (discInt_subset _) + have hsub : {Θ ∈ cuffs S | Disjoint (closure (cap.cuffDisc Θ)) Z} ⊆ cuffs S \ {Θ₁} := by + rintro Θ ⟨hΘ, hd⟩ + refine ⟨hΘ, ?_⟩ + intro h' + rw [mem_singleton_iff.1 h'] at hd + obtain ⟨x, hx⟩ := hE₁ + exact disjoint_left.1 hd hx (hin hx) + have h₁ := ncard_le_ncard hsub (hfc.subset sdiff_subset) + have h₂ : (cuffs S \ {Θ₁}).ncard + ({Θ₁} : Set (Set S)).ncard = (cuffs S).ncard := + ncard_sdiff_add_ncard_of_subset (singleton_subset_iff.2 hΘ₁) hfc + rw [ncard_singleton] at h₂ + change _ ≤ (cuffs S).ncard + omega + obtain ⟨hf₁, hf₂⟩ := h.facts hall + have hset : ∀ s : Set S, (s ∩ (ψ '' connectedComponent y)) \ K.U = s \ + (cap.emb ⁻¹' discInt Z ∪ K.U) := fun s ↦ by + rw [hy'] + ext x + simp only [mem_sdiff, mem_inter_iff, mem_compl_iff, mem_union, not_or] + tauto + have hcompl : (ψ '' connectedComponent y)ᶜ ∪ K.U = cap.emb ⁻¹' discInt Z ∪ K.U := by + rw [hy', compl_compl] + refine ⟨nonempty_homeomorph_of_cap hfrag.isSurface hconn hS ‹_› cap₁ cap (hcap _ cap₁) hcard, + ?_, ?_, ?_⟩ + · refine injOn_of_outside hS cap hY hψ y hD h.sub h.rest hall ?_ + rw [hy'] + · intro s hs' + rw [hset] + exact hf₁ s hs' + · rw [hcompl] + refine hf₂.imp ?_ id + rintro ⟨s, hs', hsub⟩ + refine ⟨s, hs', fun x hx ↦ ?_⟩ + by_contra hk + have : x ∈ (s ∩ (ψ '' connectedComponent y)) \ K.U := ⟨hx, hk⟩ + rw [hset] at this + exact this.2 (hsub this.1) + +omit [T2Space S] [T2Space Shat] in +/-- The shape moves to the cap twisted by a homeomorphism that keeps the frame. -/ +theorem IsFreeShape.ofHomeo {cap : IsCappedSurface S Shat} {Φ : Frame S} {K K' : + Drawing S} {Z : Set Shat} + (h : IsFreeShape cap Φ K' Z) (f : S ≃ₜ S) (hf : IsFramePreservingHomeo Φ f) (hU : f '' K.U + = K'.U) (hV : f '' K.V = K'.V) : + IsFreeShape (cap.ofHomeo f) Φ K Z := by + have hKU : (cap.ofHomeo f).emb '' K.U = cap.emb '' K'.U := by rw [cap.ofHomeo_emb_image, hU] + refine ⟨h.disc, ?_, ?_, ?_, ?_, ?_⟩ + · rw [hKU] + exact h.sub + · rw [hKU, cap.ofHomeo_discs] + exact h.rest + · intro Θ hΘ hn + rw [(cap.ofHomeo_cuffDisc f hΘ).2] at hn ⊢ + exact h.touch _ (cap.ofHomeo_cuffDisc f hΘ).1 hn + · obtain ⟨Θ, hΘ, hin⟩ := h.inner + obtain ⟨hΘ', hDisc⟩ := cap.ofHomeo_cuffDisc_symm f hΘ + exact ⟨_, hΘ', hDisc.symm ▸ hin⟩ + · intro hall + obtain ⟨hf₁, hf₂⟩ := h.facts fun Θ hΘ ↦ by + have := hall _ (cap.ofHomeo_cuffDisc_symm f hΘ).1 + rwa [(cap.ofHomeo_cuffDisc_symm f hΘ).2] at this + set In' := cap.emb ⁻¹' discInt Z ∪ K'.U with hIn' + have hmem : ∀ x, x ∈ (cap.ofHomeo f).emb ⁻¹' discInt Z ∪ K.U ↔ f x ∈ In' := fun x ↦ by + refine or_congr Iff.rfl ?_ + rw [← hU] + exact (f.injective.mem_set_image).symm + have hside : ∀ s ∈ Φ.longSides, ∀ x, f x ∈ s ↔ x ∈ s := fun s hs x ↦ by + have := hf.preserve_sides s hs.1 + constructor + · intro hx + rw [← this] at hx + obtain ⟨y, hy, he⟩ := hx + exact f.injective he ▸ hy + · intro hx + rw [← this] + exact mem_image_of_mem _ hx + constructor + · intro s hs + have heq : s \ ((cap.ofHomeo f).emb ⁻¹' discInt Z ∪ K.U) = f.symm '' (s \ In') := by + ext x + simp only [mem_sdiff, hmem] + constructor + · rintro ⟨h₁, h₂⟩ + exact ⟨f x, ⟨(hside s hs x).2 h₁, h₂⟩, f.symm_apply_apply x⟩ + · rintro ⟨y, ⟨h₁, h₂⟩, rfl⟩ + refine ⟨?_, by rwa [f.apply_symm_apply]⟩ + rw [← hside s hs, f.apply_symm_apply] + exact h₁ + rw [heq] + rcases hf₁ s hs with h' | h' + · left + rw [h', image_empty] + · exact Or.inr (h'.image f.symm.continuous) + · refine hf₂.imp ?_ ?_ + · rintro ⟨s, hs, hsub⟩ + refine ⟨s, hs, fun x hx ↦ (hmem x).2 (hsub ((hside s hs x).2 hx))⟩ + · intro hlt + have h₁ : K.V.ncard = K'.V.ncard := by + rw [← hV, ncard_image_of_injective _ f.injective] + have h₂ : Φ.V ∩ ((cap.ofHomeo f).emb ⁻¹' discInt Z ∪ K.U) = Φ.V ∩ In' := by + ext x + simp only [mem_inter_iff] + refine and_congr_right fun hx ↦ ?_ + rw [hmem, hf.fix_V x hx] + rw [h₁, h₂] + exact hlt + +omit [T2Space Shat] in +/-- **The count holds on the cuff `Θ`.** Off `Θ` the frame lies outside `Z`. On `Θ` the part `A` is +what stays outside. -/ +theorem freeFacts_of_cuff (hS : IsSurface S) (Φ : Frame S) {K : Drawing S} + (cap : IsCappedSurface S Shat) {Z : Set Shat} {Θ A : Set S} (hΘ : Θ ∈ cuffs S) + {In : Set S} (hInZ : In ⊆ cap.emb ⁻¹' Z) (hoth : ∀ Θ' ∈ cuffs S, Θ' ≠ Θ → Disjoint (closure + (cap.cuffDisc Θ')) Z) (hApc : IsPreconnected A) + (hAΘ : A ⊆ Θ) (hiff : ∀ x ∈ Θ, x ∈ In ↔ x ∉ A) (hcl : IsClosed (Θ \ A)) + (hcount : (∃ s ∈ Φ.longSides, s ⊆ In) ∨ K.V.ncard < (Φ.V ∩ In).ncard) : FreeFacts Φ K In := by + classical + have hO : IsOArc Θ := ⟨cuffPar hS ⟨Θ, hΘ⟩⟩ + have hoff : ∀ {Θ' x}, Θ' ∈ cuffs S → Θ' ≠ Θ → x ∈ Θ' → x ∉ In := fun {Θ' x} hΘ' hne hx hxI ↦ + disjoint_left.1 (hoth Θ' hΘ' hne) (cap.mem_closure_emb hΘ' hx) (hInZ hxI) + have hcuff : ∀ {x}, x ∈ bd S → x ∈ In → x ∈ Θ := fun {x} hx hxI ↦ by + by_contra hn + have hΘ' : connectedComponentIn (bd S) x ∈ cuffs S := ⟨x, hx, rfl⟩ + have hm : x ∈ connectedComponentIn (bd S) x := mem_connectedComponentIn hx + exact hoff hΘ' (fun h ↦ hn (h ▸ hm)) hm hxI + obtain ⟨w, hwV, hwΘ, hwA⟩ : ∃ w ∈ Φ.V, w ∈ Θ ∧ w ∉ A := by + rcases hcount with ⟨s, hs, hsub⟩ | hlt + · obtain ⟨Θ', hΘ', hsΘ, u, v, huv, hset, -⟩ := Frame.side_on_cuff hS Φ hs.1 + obtain ⟨x, hx⟩ : s.Nonempty := hs.1.1 + have hxb : x ∈ bd S := cuff_subset_bd ⟨Θ', hΘ'⟩ (hsΘ hx) + have hxΘ := hcuff hxb (hsub hx) + have hsame : Θ' = Θ := cuffs_eq_of_mem hΘ' hΘ (hsΘ hx) hxΘ + subst hsame + have hsA : s ⊆ Θ' \ A := fun y hy ↦ ⟨hsΘ hy, (hiff y (hsΘ hy)).1 (hsub hy)⟩ + have hu : u ∈ closure s ∩ (Φ.V ∩ Θ') := by rw [hset]; exact Or.inl rfl + have := closure_minimal hsA hcl hu.1 + exact ⟨u, hu.2.1, hu.2.2, this.2⟩ + · obtain ⟨w, hw⟩ : (Φ.V ∩ In).Nonempty := by + by_contra hne + rw [not_nonempty_iff_eq_empty] at hne + rw [hne] at hlt + simp at hlt + have hwb := Φ.V_subset hw.1 + have hwΘ := hcuff hwb hw.2 + exact ⟨w, hw.1, hwΘ, (hiff w hwΘ).1 hw.2⟩ + refine ⟨fun s hs ↦ ?_, hcount⟩ + obtain ⟨Θ', hΘ', hsΘ, -⟩ := Frame.side_on_cuff hS Φ hs.1 + have hspc : IsPathConnected s := hs.1.2.2.1 + by_cases hsame : Θ' = Θ + · subst hsame + have heq : s \ In = s ∩ A := by + ext x + constructor + · rintro ⟨h₁, h₂⟩ + by_contra h₃ + exact h₂ ((hiff x (hsΘ h₁)).2 fun h ↦ h₃ ⟨h₁, h⟩) + · rintro ⟨h₁, h₂⟩ + exact ⟨h₁, fun h ↦ (hiff x (hsΘ h₁)).1 h h₂⟩ + rw [heq] + refine oArc_inter_isPathConnected hO hwΘ (fun y hy ↦ ⟨hsΘ hy, ?_⟩) (fun y hy ↦ ⟨hAΘ hy, + ?_⟩) hspc.isConnected.isPreconnected hApc + · rintro rfl + exact (hs.1.2.1 hy).2 hwV + · rintro rfl + exact hwA hy + · have heq : s \ In = s := sdiff_eq_left.2 (disjoint_left.2 fun x hx ↦ hoff hΘ' hsame (hsΘ hx)) + rw [heq] + exact Or.inr hspc + +variable {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +theorem closure_compl_eq_compl_discInt {T : Type} [TopologicalSpace T] + (hT : IsClosedSurface T) {Δ : Set T} (hΔ : IsClosedDisc Δ) : + closure Δᶜ = (discInt Δ)ᶜ := by + have hman : ∀ x : T, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + ext x + constructor + · intro hx hi + obtain ⟨w, hw, hwi⟩ := _root_.mem_closure_iff.1 hx _ (hΔ.isOpen_discInt hman) hi + exact hwi (discInt_subset Δ hw) + · intro hx + by_cases hxΔ : x ∈ Δ + · exact discBd_subset_closure_compl hT hΔ (by + by_contra hb + exact hx ⟨hxΔ, hb⟩) + · exact subset_closure hxΔ + +/-- What the proof of (10.5) needs of a freedom flaw. -/ +structure IsFreeData (D : TangleDatum cap χ) (n : ℕ) (Δ Z : Set Shat) (K : Drawing S) : Prop where + shape : IsFreeShape cap χ.Φ K Z + disc : IsClosedDisc Δ + int_eq : cap.emb ⁻¹' discInt Z = cap.emb ⁻¹' discInt Δ + family : IsLinkedFamily D (n + 1) (discPairs cap {Δ}) + feature : IsFeature χ.Φ K + inter : D.P.Γ.U ∩ K.U ⊆ D.P.Γ.V ∩ K.V + lines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} + ∧ IsLineWithEnds (closure e) u v + size : K.V.ncard + K.E.ncard ≤ 8 * n + pieces : ∃ 𝓞 𝓛 : Set (Set S), 𝓞.Finite ∧ 𝓛.Finite ∧ (∀ C ∈ 𝓞, IsOArc C) ∧ + (∀ L ∈ 𝓛, ∃ s t, s ≠ t ∧ IsLineWithEnds L s t ∧ s ∈ bd S ∪ ⋃₀ 𝓞 ∧ t ∈ bd S ∪ ⋃₀ 𝓞) ∧ K.U + = ⋃₀ 𝓞 ∪ ⋃₀ 𝓛 + roots : ∀ v ∈ D.P.Γ.V, cap.emb v ∈ Δ → cap.emb v ∈ closure Δᶜ → v ∈ K.U + outer : ∀ v ∈ K.U, cap.emb v ∈ closure Δᶜ + anchored : IsAnchored D.P.Γ K + +/-- All the places over one equivalence class of features are one well-behaved set, as in the proof +of (10.4). -/ +theorem exists_class_free (hS : IsSurface S) (hd : χ.IsDisjoint) + {𝒮 : Set (ColouredPainting χ)} (hcl : IsPaintingClass χ 𝒮) (n : ℕ) (a₀ : β) + (hS3 : ConditionS3 χ cap) (hS4 : ConditionS4 χ) {Kc : Drawing S} + (hg : ∃ (D : TangleDatum cap χ) (Δ Z : Set Shat), IsFreeData D n Δ Z Kc) : + ∃ B : Set (Place χ), IsWellBehavedPlaces B ∧ ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → n + 1 ≤ D.ord → + ∀ (Δ Z : Set Shat) (K : Drawing S) (α : S ≃ₜ S), IsFreeData D n Δ Z K + → IsFramePreservingHomeo χ.Φ α → + α '' Kc.U = K.U → α '' Kc.V = K.V → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb (n + 1) D.ord D.𝒯 ∧ (⟨hd, D.P, L⟩ : Place χ) ∈ B + := by + classical + have : ConnectedSpace S := χ.connected + have hT := cap.isClosedSurface + obtain ⟨D₀, Δ₀, Z₀, hp⟩ := hg + have hKne : Kc.V ⊆ ⋃ e ∈ arcComponentsIn (Kc.U \ Kc.V), closure e := fun v hv ↦ by + obtain ⟨e, he, hve⟩ := hp.feature.no_isolated_vertices v hv + exact mem_biUnion he hve.1 + obtain ⟨𝓞, 𝓛, h𝓞, h𝓛, hO, hL, hU⟩ := hp.pieces + obtain ⟨Y, tY, t2Y, ψ, hY, hψ, hsheet, -⟩ := exists_pullData_of_shape hS D₀.P.fits hp.inter + hp.lines hKne h𝓞 h𝓛 hO hL hU + obtain ⟨B, hB, hmem⟩ := exists_class_cut (χ := χ) (K := Kc) hY (ψ := ψ) 2 + (FreeGood χ.Φ Kc Shat ψ) (fun X ↦ X.P ∈ 𝒮) + (fun y l h ↦ by + rcases h.2.2 with h₃ | ⟨h₁, h₂, h₄, h₅⟩ + · exact wellBehaved_S3 hS hp.feature hcl hp.lines hY hψ hsheet y l 2 a₀ hS3 h.1 h₃ h.2.1 + · exact wellBehaved_S4 hS hp.feature hcl hp.lines hY hψ hsheet y l 2 a₀ hS4 h₁ h₂ h₄ h₅ h.2.1) + refine ⟨_, theorem_9_4_proof hB, ?_⟩ + rintro D hmem𝒮 hord Δ Z K α hK hα hαU hαV + obtain ⟨y, hy, hgood⟩ := free_fragment hS (cap.ofHomeo α) (hK.shape.ofHomeo α hα hαU hαV) hY hψ + let Q : ColouredPainting χ := D.P.image α.symm hα.symm + have hQ : IsColouredImage α.symm D.P Q := ColouredPainting.isImage_image _ _ _ + have I : IsColouredImage α Q D.P := hQ.symm + have hclΔ := closure_compl_eq_compl_discInt hT hK.disc + have hrange : range (fun x : connectedComponent y ↦ ψ x.1) = α ⁻¹' ⋂ p ∈ discPairs cap {Δ}, + Prod.snd p := by + have : range (fun x : connectedComponent y ↦ ψ x.1) = ψ '' connectedComponent y := by + ext z + simp + rw [this, hy, iInter_discPairs] + ext x + have hint : cap.emb (α x) ∈ discInt Z ↔ cap.emb (α x) ∈ discInt Δ := by + have := Set.ext_iff.1 hK.int_eq (α x) + simpa using this + simp only [mem_compl_iff, mem_iInter, mem_singleton_iff, forall_eq, mem_preimage, hclΔ] + exact not_congr hint + obtain ⟨_, hinter, hanc, hl⟩ := hQ.exists_feature_placement_data hαU hαV hK.inter hK.anchored + have hr : ∀ v, v ∈ Kc.U → v ∈ range (fun x : connectedComponent y ↦ ψ x.1) := fun v hv ↦ by + rw [hrange] + have hvK : α v ∈ K.U := hαU ▸ mem_image_of_mem _ hv + rw [mem_preimage, iInter_discPairs] + exact mem_iInter₂.2 fun Δ' hΔ' ↦ (mem_singleton_iff.1 hΔ') ▸ hK.outer _ hvK + have hπ : ∀ p ∈ discPairs cap {Δ}, ∀ v ∈ D.P.Γ.V, v ∈ p.1 → v ∈ p.2 → α.symm v ∈ Kc.U := by + rintro _ ⟨Δ', hΔ', rfl⟩ v hv h₁ h₂ + obtain rfl := mem_singleton_iff.1 hΔ' + have := hK.roots v hv h₁ h₂ + rw [← hαU] at this + obtain ⟨z, hz, rfl⟩ := this + rwa [α.symm_apply_apply] + have hm : (discPairs cap {Δ}).ncard ≤ 2 := le_trans (ncard_image_le (finite_singleton _)) + (by simp) + obtain ⟨X, hXP, hX, hXim⟩ := hK.family.exists_place (K := Kc) hd hα I hrange hinter hanc hl hr hπ + hm + have hX𝒮 : X.P ∈ 𝒮 := hXP ▸ hcl.image_mem _ hmem𝒮 _ _ hα.symm hQ + refine ⟨hK.family.location, hK.family.isolates hS (by omega) hord, X, + hmem y _ X hgood ?_ hX hX𝒮, α, hXim⟩ + exact fun v hv ↦ ((hl v).1 hv).1 + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/FreeTopology.lean b/LeanPool/GraphMinor/GM19/FreeTopology.lean new file mode 100644 index 0000000000..1bf5a942d0 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/FreeTopology.lean @@ -0,0 +1,676 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FreeFrame +public import Mathlib.Analysis.SpecialFunctions.PolarCoord +public import LeanPool.GraphMinor.GM19.FragmentForm + +/-! +# The fragment outside a closed disc + +Let `Z` be a closed disc of `Σ̂` whose boundary holds `K`. We show that the fragment outside `Z` +meets the fibre of `ψ` in at most one +point (`injOn_of_outside`). The reason is local. Near a point of the boundary of `Z`, the outside of +`Z` is connected, so all points +of the fragment near that point lie near one lift of it. + +If the fragment has as many cuffs as `Σ`, then it is a copy of `Σ`, by the classification of +surfaces (`nonempty_homeomorph_of_cap`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +/-- The rectangle of polar coordinates around a point `ζ` of the unit circle. -/ +noncomputable def polarBox (ζ : ℂ) (r₁ r₂ δ : ℝ) : Set ℂ := (fun p : ℝ × ℝ ↦ ζ * + Complex.polarCoord.symm p) '' (Ioo r₁ r₂ ×ˢ Ioo (-δ) δ) + +theorem norm_polar_mul {ζ : ℂ} (hζ : ‖ζ‖ = 1) {p : ℝ × ℝ} (hp : 0 ≤ p.1) : ‖ζ * + Complex.polarCoord.symm p‖ = p.1 := by + rw [norm_mul, hζ, one_mul, Complex.polarCoord_symm_apply, norm_mul, Complex.norm_real, + Real.norm_of_nonneg hp] + have : ((Real.cos p.2 : ℝ) : ℂ) + (Real.sin p.2 : ℝ) * Complex.I = Complex.exp (p.2 * Complex.I) + := by + rw [Complex.exp_mul_I, Complex.ofReal_cos, Complex.ofReal_sin] + rw [this, Complex.norm_exp_ofReal_mul_I, mul_one] + +theorem isOpen_polarBox {ζ : ℂ} (hζ : ‖ζ‖ = 1) {r₁ r₂ δ : ℝ} (h₁ : 0 ≤ r₁) (hδ : δ + ≤ Real.pi) : IsOpen (polarBox ζ r₁ r₂ δ) := by + have hne : ζ ≠ 0 := by + intro h + simp [h] at hζ + have hO : IsOpen (Complex.polarCoord.symm '' (Ioo r₁ r₂ ×ˢ Ioo (-δ) δ)) := by + refine Complex.polarCoord.symm.isOpen_image_of_subset_source (isOpen_Ioo.prod isOpen_Ioo) ?_ + rintro ⟨r, θ⟩ ⟨hr, hθ⟩ + rw [OpenPartialHomeomorph.symm_source, Complex.polarCoord_target] + exact ⟨lt_of_le_of_lt h₁ hr.1, by simpa using ⟨by linarith [hθ.1], by linarith [hθ.2]⟩⟩ + have : polarBox ζ r₁ r₂ δ = (Homeomorph.mulLeft₀ ζ hne) '' (Complex.polarCoord.symm '' + (Ioo r₁ r₂ ×ˢ Ioo (-δ) δ)) := by + rw [polarBox, image_image] + rfl + rw [this] + exact (Homeomorph.mulLeft₀ ζ hne).isOpenMap _ hO + +/-- **A neighbourhood of a boundary point whose outside part is connected.** -/ +theorem exists_nhd_outside (hT : IsClosedSurface T) {Z W : Set T} (hZ : IsClosedDisc Z) {p : T} + (hp : p ∈ discBd Z) (hW : IsOpen W) + (hpW : p ∈ W) : ∃ O, IsOpen O ∧ p ∈ O ∧ O ⊆ W ∧ IsPreconnected (O \ Z) := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + obtain ⟨Δ', hΔ', hin, -⟩ := Surface.exists_disc_around hman hZ (fun x _ ↦ hT.2.2 x) isOpen_univ + (subset_univ _) + obtain ⟨φ⟩ := hZ.isOArc_discBd + obtain ⟨c, c', hcc, hc'c, hcm, hc'm, hl, hr, hcZ, hcb, hcφ⟩ := exists_disc_collar hZ hΔ' hin φ + obtain ⟨w, hw⟩ := φ.surjective ⟨p, hp⟩ + set ζ : ℂ := (w : ℂ) with hζdef + have hζ : ‖ζ‖ = 1 := Circle.norm_coe w + have hcζ : c ζ = p := by rw [hζdef, hcφ w, hw] + have hζB : ζ ∈ ball (0 : ℂ) 2 := by + rw [mem_ball_zero_iff, hζ] + norm_num + have hcat : ContinuousAt c ζ := hcc.continuousAt (Filter.mem_of_superset (ball_mem_nhds _ + (by norm_num : (0 : ℝ) < 2 - 1)) (fun z hz ↦ by + rw [mem_closedBall_zero_iff] + have h₀ : dist z ζ < 2 - 1 := hz + have h₁ : ‖z - ζ‖ < 1 := by + rw [dist_eq_norm] at h₀ + linarith + have h₂ := norm_add_le (z - ζ) ζ + rw [sub_add_cancel, hζ] at h₂ + linarith)) + have hwn : c ⁻¹' W ∈ 𝓝 ζ := hcat.preimage_mem_nhds (by rw [hcζ]; exact hW.mem_nhds hpW) + obtain ⟨ε, hε, hεs⟩ := Metric.mem_nhds_iff.1 hwn + let Q : ℝ × ℝ → ℂ := fun q ↦ ζ * Complex.polarCoord.symm q + have hQc : Continuous Q := continuous_const.mul (by + have : (Complex.polarCoord.symm : ℝ × ℝ → ℂ) = fun q ↦ (q.1 : ℂ) * ((Real.cos q.2 : ℝ) + + (Real.sin q.2 : ℝ) * Complex.I) := by + ext q + exact Complex.polarCoord_symm_apply q + rw [this] + fun_prop) + have hQ1 : Q (1, 0) = ζ := by + change ζ * Complex.polarCoord.symm (1, 0) = ζ + rw [Complex.polarCoord_symm_apply] + simp + have hbop : IsOpen (Q ⁻¹' ball ζ ε) := isOpen_ball.preimage hQc + have hQmem : (1, 0) ∈ Q ⁻¹' ball ζ ε := by + rw [mem_preimage, hQ1] + exact mem_ball_self hε + obtain ⟨δ₀, hδ₀, hδs⟩ := Metric.isOpen_iff.1 hbop (1, 0) hQmem + obtain ⟨δ, hδ, hδ₁, hδ₂⟩ : ∃ δ : ℝ, 0 < δ ∧ δ ≤ δ₀ ∧ δ ≤ 1 / 2 := ⟨min δ₀ (1 / 2), lt_min hδ₀ + (by norm_num), min_le_left _ _, min_le_right _ _⟩ + have hpi := Real.pi_gt_three + have hnorm : ∀ {r θ : ℝ}, 0 ≤ r → ‖Q (r, θ)‖ = r := fun {r θ} h ↦ norm_polar_mul hζ (p := + (r, θ)) h + have hbox : polarBox ζ (1 - δ) (1 + δ) δ ⊆ ball ζ ε ∩ ball 0 2 := by + rintro _ ⟨⟨r, θ⟩, ⟨hr, hθ⟩, rfl⟩ + have h0 : 0 ≤ r := by linarith [hr.1] + refine ⟨hδs ?_, ?_⟩ + · rw [mem_ball, Prod.dist_eq, max_lt_iff] + refine ⟨?_, ?_⟩ + · change |r - 1| < δ₀ + rw [abs_lt] + constructor <;> linarith [hr.1, hr.2] + · change |θ - 0| < δ₀ + rw [sub_zero, abs_lt] + constructor <;> linarith [hθ.1, hθ.2] + · rw [mem_ball_zero_iff] + refine lt_of_eq_of_lt (hnorm h0) ?_ + linarith [hr.2] + have hboxo : IsOpen (polarBox ζ (1 - δ) (1 + δ) δ) := isOpen_polarBox hζ (by linarith) + (by linarith) + have hball : ball (0 : ℂ) 2 ⊆ closedBall 0 2 := ball_subset_closedBall + have hinjc : InjOn c (closedBall 0 2) := hl.injOn + have hIm : c '' ball 0 2 = discInt Δ' := by + apply Subset.antisymm + · rintro _ ⟨z, hz, rfl⟩ + refine ⟨hcm (hball hz), fun hb ↦ ?_⟩ + rw [← hcb] at hb + obtain ⟨u, hu, he⟩ := hb + have := hinjc (sphere_subset_closedBall hu) (hball hz) he + rw [this, mem_sphere_zero_iff_norm] at hu + rw [mem_ball_zero_iff, hu] at hz + exact lt_irrefl _ hz + · rintro x ⟨hx, hb⟩ + refine ⟨c' x, ?_, hr hx⟩ + have hm := hc'm hx + rw [mem_closedBall_zero_iff] at hm + rw [mem_ball_zero_iff] + refine lt_of_le_of_ne hm fun he ↦ hb ?_ + rw [← hcb] + exact ⟨c' x, by rw [mem_sphere_zero_iff_norm, he], hr hx⟩ + have hopen : IsOpen (c '' polarBox ζ (1 - δ) (1 + δ) δ) := by + have hDo : IsOpen (discInt Δ') := hΔ'.isOpen_discInt hman + have heq : c '' polarBox ζ (1 - δ) (1 + δ) δ = discInt Δ' ∩ c' ⁻¹' polarBox ζ (1 - δ) (1 + δ) δ + := by + apply Subset.antisymm + · rintro _ ⟨z, hz, rfl⟩ + have hzb := (hbox hz).2 + refine ⟨hIm ▸ mem_image_of_mem c hzb, ?_⟩ + rw [mem_preimage, hl (hball hzb)] + exact hz + · rintro x ⟨hx, hx'⟩ + exact ⟨c' x, hx', hr (discInt_subset _ hx)⟩ + rw [heq] + exact (hc'c.mono (discInt_subset _)).isOpen_inter_preimage hDo hboxo + refine ⟨_, hopen, ⟨ζ, ⟨(1, 0), ⟨⟨by linarith, by linarith⟩, ⟨by linarith, by linarith⟩⟩, hQ1⟩, + hcζ⟩, ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact hεs (hbox hz).1 + · have heq : c '' polarBox ζ (1 - δ) (1 + δ) δ \ Z = c '' polarBox ζ 1 (1 + δ) δ := by + apply Subset.antisymm + · rintro _ ⟨⟨z, ⟨⟨r, θ⟩, ⟨hr, hθ⟩, rfl⟩, rfl⟩, hn⟩ + have h0 : 0 ≤ r := by linarith [hr.1] + refine mem_image_of_mem c ⟨(r, θ), ⟨⟨?_, hr.2⟩, hθ⟩, rfl⟩ + by_contra hle + refine hn (hcZ ▸ mem_image_of_mem c ?_) + change Q (r, θ) ∈ _ + rw [mem_closedBall_zero_iff, hnorm h0] + exact not_lt.1 hle + · rintro _ ⟨z, ⟨⟨r, θ⟩, ⟨hr, hθ⟩, rfl⟩, rfl⟩ + have h0 : 0 ≤ r := by linarith [hr.1] + have hz : Q (r, θ) ∈ polarBox ζ (1 - δ) (1 + δ) δ := ⟨(r, θ), ⟨⟨by linarith [hr.1], hr.2⟩, + hθ⟩, rfl⟩ + refine ⟨mem_image_of_mem c hz, fun hin' ↦ ?_⟩ + rw [← hcZ] at hin' + obtain ⟨u, hu, he⟩ := hin' + have := hinjc (closedBall_subset_closedBall (by norm_num) hu) (hball (hbox hz).2) he + rw [mem_closedBall_zero_iff, this] at hu + change ‖Q (r, θ)‖ ≤ 1 at hu + rw [hnorm h0] at hu + linarith [hr.1] + rw [heq] + have hcon : IsPreconnected (polarBox ζ 1 (1 + δ) δ) := + ((convex_Ioo _ _).prod (convex_Ioo _ _)).isPreconnected.image _ hQc.continuousOn + refine hcon.image _ (hcc.mono ?_) + rintro _ ⟨⟨r, θ⟩, ⟨hr, hθ⟩, rfl⟩ + exact hball (hbox ⟨(r, θ), ⟨⟨by linarith [hr.1], hr.2⟩, hθ⟩, rfl⟩).2 + +/-- **One side of a chord of `E` lies inside `Δ`, and the other misses `Δ`.** Here `Δ` is a closed +disc whose boundary holds the chord `β`, and whose boundary +meets the inside of `E` only in `β`. -/ +theorem exists_chord_side (hT : IsClosedSurface T) {Δ E β : Set T} + (hΔ : IsClosedDisc Δ) (hE : IsClosedDisc E) {s t : T} (hst : s ≠ t) + (hl : IsLineWithEnds β s t) (hβΔ : β ⊆ discBd Δ) (hβE : β ⊆ E) (hmeet : β ∩ discBd E = {s, t}) + (hoff : discInt E ∩ discBd Δ ⊆ β) : + ∃ A A' D D' : Set T, IsClosedDisc D ∧ IsClosedDisc D' ∧ D ∪ D' = E ∧ D ∩ D' = β ∧ discBd D + = A ∪ β ∧ discBd D' = A' ∪ β ∧ A ⊆ discBd E \ {s, t} ∧ + A' ⊆ discBd E \ {s, t} ∧ discBd E \ {s, t} ⊆ A ∪ A' ∧ IsPreconnected A' + ∧ discInt D ⊆ discInt Δ ∧ Disjoint (discInt D') Δ ∧ discInt D ⊆ discInt E \ β ∧ + discInt D' ⊆ discInt E \ β ∧ discInt E \ β ⊆ discInt D ∪ discInt D' := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have hsβ : s ∈ β := by + have : s ∈ β ∩ discBd E := by rw [hmeet]; exact mem_insert _ _ + exact this.1 + have htβ : t ∈ β := by + have : t ∈ β ∩ discBd E := by rw [hmeet]; exact mem_insert_of_mem _ rfl + exact this.1 + obtain ⟨A, A', D, D', hAne, hcomp, hD, hD', hun, hint, hbd, hbd', hcomp'⟩ + := disc_iArc E β s t hE hβE hst hl hmeet + have hmemc : ∀ {B}, B ∈ componentsIn (discBd E \ {s, t}) → B ⊆ discBd E \ {s, t} := by + rintro _ ⟨x, -, rfl⟩ + exact connectedComponentIn_subset _ _ + have hpc : ∀ {B}, B ∈ componentsIn (discBd E \ {s, t}) → IsPreconnected B := by + rintro _ ⟨x, -, rfl⟩ + exact isPreconnected_connectedComponentIn + have hA₀ : A ∈ componentsIn (discBd E \ {s, t}) := by rw [hcomp]; exact mem_insert _ _ + have hA₁ : A' ∈ componentsIn (discBd E \ {s, t}) := by rw [hcomp]; exact mem_insert_of_mem _ rfl + have hAs := hmemc hA₀ + have hAs' := hmemc hA₁ + have hcov : discBd E \ {s, t} ⊆ A ∪ A' := by + intro x hx + have : connectedComponentIn (discBd E \ {s, t}) x ∈ componentsIn (discBd E \ {s, t}) + := mem_image_of_mem _ hx + rw [hcomp] at this + have hm := mem_connectedComponentIn hx + rcases this with h | h + · exact Or.inl (h ▸ hm) + · exact Or.inr ((mem_singleton_iff.1 h) ▸ hm) + have hoffβ : ∀ {x}, x ∈ discBd E \ {s, t} → x ∉ β := fun {x} hx hxβ ↦ hx.2 (hmeet ▸ ⟨hxβ, hx.1⟩) + have hEopen : IsOpen (discInt E) := hE.isOpen_discInt hman + -- The inside of each half lies in the inside of `E`, off `β`. + have hinner : ∀ {D D' A A' : Set T}, D ∩ D' = β → discBd D = A ∪ β → discBd D' = A' ∪ β + → A ⊆ discBd E \ {s, t} → D ⊆ E → + discBd E \ {s, t} ⊆ A ∪ A' → IsClosedDisc D' → discInt D ⊆ discInt E \ β := by + intro D D' A A' hint hbd hbd' hAs hDE hcov hD' y hy + have hyβ : y ∉ β := fun h ↦ hy.2 (hbd ▸ Or.inr h) + refine ⟨⟨hDE hy.1, fun hb ↦ ?_⟩, hyβ⟩ + have hyn : y ∉ ({s, t} : Set T) := by + rintro (h | h) + · exact hyβ (h ▸ hsβ) + · exact hyβ ((mem_singleton_iff.1 h) ▸ htβ) + rcases hcov ⟨hb, hyn⟩ with h | h + · exact hy.2 (hbd ▸ Or.inl h) + · have : y ∈ D' := Surface.discBd_subset _ (hbd' ▸ Or.inl h) + exact hyβ (hint ▸ ⟨hy.1, this⟩) + have hcover : ∀ {D D' A A' : Set T}, D ∪ D' = E → discBd D = A ∪ β → discBd D' = A' ∪ β + → A ⊆ discBd E \ {s, t} → + A' ⊆ discBd E \ {s, t} → discInt E \ β ⊆ discInt D ∪ discInt D' := by + intro D D' A A' hun hbd hbd' hAs hAs' y hy + have hy' : y ∈ D ∪ D' := hun ▸ hy.1.1 + rcases hy' with h | h + · refine Or.inl ⟨h, fun hb ↦ ?_⟩ + rw [hbd] at hb + rcases hb with h' | h' + · exact hy.1.2 (hAs h').1 + · exact hy.2 h' + · refine Or.inr ⟨h, fun hb ↦ ?_⟩ + rw [hbd'] at hb + rcases hb with h' | h' + · exact hy.1.2 (hAs' h').1 + · exact hy.2 h' + have hDE : D ⊆ E := hun ▸ subset_union_left + have hDE' : D' ⊆ E := hun ▸ subset_union_right + have hint' : D' ∩ D = β := by rw [inter_comm, hint] + have hi₁ := hinner hint hbd hbd' hAs hDE hcov hD' + have hi₂ := hinner hint' hbd' hbd hAs' hDE' (by rw [union_comm]; exact hcov) hD + have hbdj : ∀ {X}, X ⊆ discInt E \ β → Disjoint X (discBd Δ) := fun hX ↦ + disjoint_left.2 fun x hx hb ↦ (hX hx).2 (hoff ⟨(hX hx).1, hb⟩) + obtain ⟨f, hf0, hf1⟩ := hl + let b : T := (f (⟨1 / 2, by norm_num, by norm_num⟩ : unitInterval)).1 + have hbβ : b ∈ β := (f _).2 + have hb_ne : ∀ {r : unitInterval}, r ≠ ⟨1 / 2, by norm_num, by norm_num⟩ → (f r).1 ≠ b + := fun hr he ↦ hr (f.injective (Subtype.ext he)) + have hbs : b ≠ s := fun he ↦ hb_ne (r := 0) (fun h ↦ by have := congrArg Subtype.val h; norm_num + at this) (hf0.trans he.symm) + have hbt : b ≠ t := fun he ↦ hb_ne (r := 1) (fun h ↦ by have := congrArg Subtype.val h; norm_num + at this) (hf1.trans he.symm) + have hbE : b ∈ discInt E := ⟨hβE hbβ, fun hb' ↦ by + have : b ∈ ({s, t} : Set T) := hmeet ▸ ⟨hbβ, hb'⟩ + rcases this with h | h + · exact hbs h + · exact hbt h⟩ + rcases hΔ.side hman hD.isPreconnected_discInt (hbdj hi₁) with h₁ | h₁ <;> + rcases hΔ.side hman hD'.isPreconnected_discInt (hbdj hi₂) with h₂ | h₂ + · exfalso + have hsub : E ⊆ Δ := by + rw [← hun, ← closure_discInt hD, ← closure_discInt hD'] + exact union_subset (closure_minimal (h₁.trans (discInt_subset Δ)) hΔ.isClosed) + (closure_minimal (h₂.trans (discInt_subset Δ)) hΔ.isClosed) + have := subset_discInt_of_isOpen (fun y _ ↦ hT.2.2 y) hEopen ((discInt_subset E).trans hsub) hbE + exact this.2 (hβΔ hbβ) + · exact ⟨A, A', D, D', hD, hD', hun, hint, hbd, hbd', hAs, hAs', hcov, hpc hA₁, h₁, h₂, hi₁, + hi₂, hcover hun hbd hbd' hAs hAs'⟩ + · refine ⟨A', A, D', D, hD', hD, by rw [union_comm, hun], hint', hbd', hbd, hAs', hAs, ?_, + hpc hA₀, h₂, h₁, hi₂, hi₁, ?_⟩ + · rw [union_comm] + exact hcov + · rw [union_comm] + exact hcover hun hbd hbd' hAs hAs' + · exfalso + have hbcl := hΔ.subset_closure_discInt (Surface.discBd_subset _ (hβΔ hbβ)) + obtain ⟨w, hw, hwi⟩ := _root_.mem_closure_iff.1 hbcl _ hEopen hbE + have hwβ : w ∉ β := fun h ↦ hwi.2 (hβΔ h) + rcases hcover hun hbd hbd' hAs hAs' ⟨hw, hwβ⟩ with h | h + · exact disjoint_left.1 h₁ h (discInt_subset Δ hwi) + · exact disjoint_left.1 h₂ h (discInt_subset Δ hwi) + + +/-- **Half of a closed disc `E` added to a closed disc `Δ`.** The line `β` lies on the boundary of +`Δ` and cuts `E` in two. Every other +point of `E` on the boundary of `Δ` lies on the boundary of `E`, and is reached from inside `Δ` +through `E`. This form of (the second +half of) `exists_split` allows that `E` touches `Δ` again. -/ +theorem exists_outer_half (hT : IsClosedSurface T) {Δ E β : Set T} + (hΔ : IsClosedDisc Δ) (hE : IsClosedDisc E) {s t : T} (hst : s ≠ t) + (hl : IsLineWithEnds β s t) (hβΔ : β ⊆ discBd Δ) (hβE : β ⊆ E) (hmeet : β ∩ discBd E = {s, t}) + (hoff : discInt E ∩ discBd Δ ⊆ β) + (htouch : ∀ x ∈ discBd E ∩ discBd Δ, x ∉ β → ∃ C, C ⊆ discInt E \ β ∧ C ⊆ Δ ∧ C.Nonempty + ∧ IsPreconnected C ∧ x ∈ closure C) : + ∃ Z A' : Set T, IsClosedDisc Z ∧ A' ⊆ discBd E ∧ IsPreconnected A' ∧ discBd Z = (discBd Δ \ + (β \ {s, t})) ∪ A' ∧ Disjoint A' Δ ∧ + discBd E \ A' ⊆ Δ ∧ E ⊆ Z ∧ Δ ⊆ Z ∧ Z \ Δ ⊆ E ∧ ∀ x ∉ discInt E, x ∈ discInt Z ↔ x ∈ discInt + Δ := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have hsβ : s ∈ β := by + have : s ∈ β ∩ discBd E := by rw [hmeet]; exact mem_insert _ _ + exact this.1 + have htβ : t ∈ β := by + have : t ∈ β ∩ discBd E := by rw [hmeet]; exact mem_insert_of_mem _ rfl + exact this.1 + have hoffβ : ∀ {x}, x ∈ discBd E \ {s, t} → x ∉ β := fun {x} hx hxβ ↦ hx.2 (hmeet ▸ ⟨hxβ, hx.1⟩) + obtain ⟨A, A', D, D', hD, hD', hun, hint, hbd, hbd', hAs, hAs', hcov, hApc, hin, hout, hi₁, -, + hcoverE⟩ := exists_chord_side hT hΔ hE hst hl hβΔ hβE hmeet hoff + have hsubb : ∀ {x}, x ∈ β → x ∈ Δ := fun hx ↦ Surface.discBd_subset _ (hβΔ hx) + have hβD' : β ⊆ discBd D' := fun x hx ↦ hbd' ▸ Or.inr hx + have hDΔ : D ⊆ Δ := by + rw [← closure_discInt hD] + exact closure_minimal (hin.trans (discInt_subset Δ)) hΔ.isClosed + have hA'D' : A' ⊆ D' := fun x hx ↦ Surface.discBd_subset _ (hbd' ▸ Or.inl hx) + have hAD : A ⊆ D := fun x hx ↦ Surface.discBd_subset _ (hbd ▸ Or.inl hx) + have hDE : D ⊆ E := hun ▸ subset_union_left + have hDE' : D' ⊆ E := hun ▸ subset_union_right + have hA₂out : Disjoint A' Δ := by + refine disjoint_left.2 fun x hx hxΔ ↦ ?_ + have hxβ : x ∉ β := hoffβ (hAs' hx) + have hxcl : x ∈ closure (discInt D') := (closure_discInt hD').symm ▸ hA'D' hx + have hxb : x ∈ discBd Δ := by + by_contra hb + obtain ⟨w, hwi, hw⟩ := _root_.mem_closure_iff.1 hxcl _ (hΔ.isOpen_discInt hman) ⟨hxΔ, hb⟩ + exact disjoint_left.1 hout hw (discInt_subset Δ hwi) + obtain ⟨C, hC, hCΔ, hCne, hCc, hxC⟩ := htouch x ⟨(hAs' hx).1, hxb⟩ hxβ + have hsplit := hCc.subset_or_subset (hD.isOpen_discInt hman) (hD'.isOpen_discInt hman) + (disjoint_left.2 fun y hy hy' ↦ (by + have hyβ : y ∈ β := hint ▸ ⟨hy.1, hy'.1⟩ + exact hy.2 (hbd ▸ Or.inr hyβ))) (hC.trans hcoverE) + rcases hsplit with h | h + · have : x ∈ D := closure_minimal (h.trans (discInt_subset D)) hD.isClosed hxC + exact hxβ (hint ▸ ⟨this, hA'D' hx⟩) + · obtain ⟨y, hy⟩ := hCne + exact disjoint_left.1 hout (h hy) (hCΔ hy) + have hmd2 : Δ ∩ D' = β := by + apply Subset.antisymm + · rintro x ⟨hx, hx'⟩ + by_contra hn + by_cases hb : x ∈ discBd D' + · rw [hbd'] at hb + rcases hb with h | h + · exact disjoint_left.1 hA₂out h hx + · exact hn h + · exact disjoint_left.1 hout ⟨hx', hb⟩ hx + · exact fun x hx ↦ ⟨hsubb hx, Surface.discBd_subset _ (hβD' hx)⟩ + obtain ⟨hu, hub⟩ := disc_union Δ D' β s t hΔ hD' hl hmd2 hβΔ hβD' + have hoffA : ∀ {B}, B ⊆ discBd E \ {s, t} → ∀ {x}, x ∈ B → x ∉ β := fun hB _ hx ↦ hoffβ (hB hx) + have hbd₂ : discBd (Δ ∪ D') = (discBd Δ \ (β \ {s, t})) ∪ A' := by + rw [hub] + ext x + constructor + · rintro ⟨hx | hx, hn⟩ + · exact Or.inl ⟨hx, hn⟩ + · rw [hbd'] at hx + rcases hx with h | h + · exact Or.inr h + · exact Or.inl ⟨hβΔ h, hn⟩ + · rintro (⟨hx, hn⟩ | hx) + · exact ⟨Or.inl hx, hn⟩ + · exact ⟨Or.inr (hbd' ▸ Or.inl hx), fun h ↦ hoffA hAs' hx h.1⟩ + have hEsub : E ⊆ Δ ∪ D' := by + rw [← hun] + rintro x (h | h) + · exact Or.inl (hDΔ h) + · exact Or.inr h + refine ⟨Δ ∪ D', A', hu, fun x hx ↦ (hAs' hx).1, hApc, hbd₂, hA₂out, ?_, hEsub, + subset_union_left, ?_, ?_⟩ + · rintro x ⟨hx, hn⟩ + by_cases hxe : x ∈ ({s, t} : Set T) + · rcases hxe with h' | h' + · exact h' ▸ hsubb hsβ + · exact (mem_singleton_iff.1 h') ▸ hsubb htβ + · rcases hcov ⟨hx, hxe⟩ with h | h + · exact hDΔ (hAD h) + · exact absurd h hn + · rintro x ⟨h | h, hn⟩ + · exact absurd h hn + · exact hDE' h + · intro x hx + constructor + · rintro ⟨hxu, hn⟩ + have hxΔ : x ∈ Δ := by + rcases hxu with h | h + · exact h + · by_contra hxΔ + have hxb : x ∈ discBd E := by + by_contra hb' + exact hx ⟨hDE' h, hb'⟩ + by_cases hxe : x ∈ ({s, t} : Set T) + · rcases hxe with h' | h' + · exact hxΔ (h' ▸ hsubb hsβ) + · exact hxΔ ((mem_singleton_iff.1 h') ▸ hsubb htβ) + · rcases hcov ⟨hxb, hxe⟩ with h' | h' + · exact hxΔ (hDΔ (hAD h')) + · exact hn (hbd₂ ▸ Or.inr h') + refine ⟨hxΔ, fun hb' ↦ hn ?_⟩ + rw [hbd₂] + refine Or.inl ⟨hb', fun h ↦ hx ⟨hβE h.1, fun hE' ↦ h.2 (hmeet ▸ ⟨h.1, hE'⟩)⟩⟩ + · rintro ⟨hxΔ, hn⟩ + refine ⟨Or.inl hxΔ, fun hb' ↦ ?_⟩ + rw [hbd₂] at hb' + rcases hb' with h | h + · exact hn h.1 + · exact disjoint_left.1 hA₂out h hxΔ + +omit [T2Space T] in +/-- Two connected pieces of an `O`-arc that both miss the point `w` meet in a path-connected set. -/ +theorem oArc_inter_isPathConnected {F P Q : Set T} (hF : IsOArc F) {w : T} (hw : w ∈ F) + (hP : P ⊆ F \ {w}) (hQ : Q ⊆ F \ {w}) + (hPc : IsPreconnected P) (hQc : IsPreconnected Q) : P ∩ Q = ∅ ∨ IsPathConnected (P ∩ Q) := by + classical + obtain ⟨φ⟩ := hF + set c : Circle := φ.symm ⟨w, hw⟩ with hc + let E : ℝ → T := fun t ↦ (φ (c * Circle.exp (t + Real.pi))).1 + have hEc : Continuous E := continuous_subtype_val.comp (φ.continuous.comp (continuous_const.mul + (Circle.exp.continuous.comp (continuous_id.add continuous_const)))) + let g : T → Circle := fun x ↦ if h : x ∈ F then φ.symm ⟨x, h⟩ else 1 + have hg : ∀ {x} (h : x ∈ F), g x = φ.symm ⟨x, h⟩ := fun {x} h ↦ dite_eq_left h + let f : T → ℂ := fun x ↦ -(((g x : Circle) : ℂ) / (c : ℂ)) + let G : T → ℝ := fun x ↦ Complex.arg (f x) + have hne1 : ∀ z : Circle, z ≠ c → -((z : ℂ) / (c : ℂ)) ∈ Complex.slitPlane := by + intro z hz + set u : Circle := z / c with hu + have hval : -((z : ℂ) / (c : ℂ)) = -(u : ℂ) := by simp [hu] + rw [hval, Complex.mem_slitPlane_iff] + by_contra hno + push Not at hno + obtain ⟨h₁, h₂⟩ := hno + have hnorm := Circle.norm_coe u + have hre : (u : ℂ).re ^ 2 + (u : ℂ).im ^ 2 = 1 := by + have := Complex.sq_norm (u : ℂ) + rw [hnorm, Complex.normSq_apply] at this + nlinarith + have him : (u : ℂ).im = 0 := by simpa using h₂ + have hre' : 0 ≤ (u : ℂ).re := by simpa using h₁ + have h1 : (u : ℂ).re = 1 := by + rw [him] at hre + nlinarith + have hu1 : u = 1 := Circle.ext (Complex.ext (by simpa using h1) (by simpa using him)) + exact hz (by rw [hu] at hu1; exact div_eq_one.1 hu1) + have hoffw : ∀ {x} (h : x ∈ F), x ≠ w → φ.symm ⟨x, h⟩ ≠ c := fun {x} h hne he ↦ + hne (congrArg Subtype.val (φ.symm.injective he)) + have hGE : ∀ {x} (_ : x ∈ F \ {w}), E (G x) = x ∧ G x ∈ Ioo (-Real.pi) Real.pi := by + rintro x ⟨hx, hxw⟩ + set z : Circle := φ.symm ⟨x, hx⟩ with hz + have hzc := hoffw hx hxw + have hG : G x = Complex.arg (-((z : ℂ) / (c : ℂ))) := by + change Complex.arg (-(((g x : Circle) : ℂ) / (c : ℂ))) = _ + rw [hg hx] + have hs := hne1 z hzc + have hnm : ‖-((z : ℂ) / (c : ℂ))‖ = 1 := by simp + have hexp : Circle.exp (G x + Real.pi) = z / c := by + apply Circle.ext + rw [Circle.coe_exp, hG] + push_cast + rw [add_mul, Complex.exp_add, Complex.exp_pi_mul_I] + have h₁ := Complex.norm_mul_exp_arg_mul_I (-((z : ℂ) / (c : ℂ))) + rw [hnm] at h₁ + simp only [Complex.ofReal_one, one_mul] at h₁ + rw [h₁] + simp + refine ⟨?_, ?_⟩ + · change (φ (c * Circle.exp (G x + Real.pi))).1 = x + have hcz : c * (z / c) = z := by rw [mul_comm, div_mul_cancel] + rw [hexp, hcz] + simp [hz] + · rw [hG] + exact ⟨lt_of_le_of_ne (Complex.neg_pi_lt_arg _ |>.le) (fun h ↦ absurd h + (Complex.neg_pi_lt_arg _).ne), + lt_of_le_of_ne (Complex.arg_le_pi _) (Complex.mem_slitPlane_iff_arg.1 hs).1⟩ + have hgc : ContinuousOn g F := by + rw [continuousOn_iff_continuous_domRestrict] + refine φ.symm.continuous.congr fun x ↦ ?_ + change φ.symm x = g x.1 + rw [hg x.2] + have hGc : ContinuousOn G (F \ {w}) := by + intro x hx + have h₁ : ContinuousWithinAt f (F \ {w}) x := + ((continuous_subtype_val.continuousWithinAt.comp ((hgc x hx.1).mono sdiff_subset) + (mapsTo_univ _ _)).div_const _).neg + have h₂ : f x ∈ Complex.slitPlane := by + change -(((g x : Circle) : ℂ) / (c : ℂ)) ∈ _ + rw [hg hx.1] + exact hne1 _ (hoffw hx.1 hx.2) + exact ContinuousAt.comp_continuousWithinAt (f := f) (Complex.continuousAt_arg h₂) h₁ + have hOrd : ∀ {R : Set T}, R ⊆ F \ {w} → IsPreconnected R → (G '' R).OrdConnected := fun hR hRc ↦ + (hRc.image _ (hGc.mono hR)).ordConnected + have himage : P ∩ Q = E '' (G '' P ∩ G '' Q) := by + ext x + constructor + · rintro ⟨h₁, h₂⟩ + exact ⟨G x, ⟨mem_image_of_mem _ h₁, mem_image_of_mem _ h₂⟩, (hGE (hP h₁)).1⟩ + · rintro ⟨_, ⟨⟨a, ha, rfl⟩, ⟨b, hb, hab⟩⟩, rfl⟩ + have hab' : a = b := by + rw [← (hGE (hP ha)).1, ← (hGE (hQ hb)).1, hab] + refine ⟨by rw [(hGE (hP ha)).1]; exact ha, by rw [(hGE (hP ha)).1, hab']; exact hb⟩ + by_cases hne : (P ∩ Q).Nonempty + · right + rw [himage] + have hne' : (G '' P ∩ G '' Q).Nonempty := by + obtain ⟨x, h₁, h₂⟩ := hne + exact ⟨G x, mem_image_of_mem _ h₁, mem_image_of_mem _ h₂⟩ + have hconv : Convex ℝ (G '' P ∩ G '' Q) := ((hOrd hP hPc).inter (hOrd hQ hQc)).convex + exact (hconv.isPathConnected hne').image hEc + · exact Or.inl (not_nonempty_iff_eq_empty.1 hne) + +section Lift + +variable {S Shat Y : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + [TopologicalSpace Y] + [T2Space Y] {ψ : Y → S} {K : Drawing S} + +/-- **The fragment outside a closed disc meets each fibre once.** -/ +theorem injOn_of_outside (hS : IsSurface S) (cap : IsCappedSurface S Shat) (hY : IsSurface Y) + (hψ : IsCutMap ψ K.U) (y : Y) + {Z : Set Shat} (hZ : IsClosedDisc Z) (hsub : cap.emb '' K.U ⊆ discBd Z) + (hrest : discBd Z ⊆ cap.discs ∪ cap.emb '' K.U) + (hoth : ∀ Θ ∈ cuffs S, closure (cap.cuffDisc Θ) ⊆ Z ∨ Disjoint (closure (cap.cuffDisc Θ)) Z) + (him : ψ '' connectedComponent y ⊆ (cap.emb ⁻¹' discInt Z)ᶜ) : InjOn ψ (connectedComponent y) + := by + classical + have hT := cap.isClosedSurface + have : CompactSpace Y := hY.1 + have hfrag := isCuttingFragment_of_cut hS hY hψ (K := K) rfl y + have hfc : (cuffs S).Finite := (cuff_statement S hS).2.1 + intro x₁ h₁ x₂ h₂ he + by_contra hne + have hk : ψ x₁ ∈ K.U := by + by_contra hk + exact hne (hψ.2.2.1 hk (fun h ↦ hk (he ▸ h)) he) + set x := ψ x₁ with hx + have hp : cap.emb x ∈ discBd Z := hsub (mem_image_of_mem _ hk) + have hF : (ψ ⁻¹' {x}).Finite := hψ.2.2.2.1 x + obtain ⟨U, hU, hUd⟩ := hF.t2_separation + have hx₁F : x₁ ∈ ψ ⁻¹' {x} := rfl + have hx₂F : x₂ ∈ ψ ⁻¹' {x} := he.symm + let V₂ : Set Y := ⋃ w ∈ (ψ ⁻¹' {x}) \ {x₁}, U w + have hV₂o : IsOpen V₂ := isOpen_biUnion fun w _ ↦ (hU w).2 + have hdis : Disjoint (U x₁) V₂ := by + refine disjoint_left.2 fun z hz hz' ↦ ?_ + obtain ⟨w, hw, hzw⟩ := mem_iUnion₂.1 hz' + exact disjoint_left.1 (hUd hx₁F hw.1 (Ne.symm hw.2)) hz hzw + set N : Set Y := U x₁ ∪ V₂ with hN + have hNo : IsOpen N := (hU x₁).2.union hV₂o + have hFN : ψ ⁻¹' {x} ⊆ N := fun w hw ↦ by + by_cases h : w = x₁ + · exact Or.inl (h ▸ (hU x₁).1) + · exact Or.inr (mem_iUnion₂.2 ⟨w, ⟨hw, h⟩, (hU w).1⟩) + have hcl : IsClosed (ψ '' Nᶜ) := (isClosedMap_of_isCutMap hψ) _ hNo.isClosed_compl + obtain ⟨O₀, hO₀, hO₀e⟩ := cap.isEmbedding.isInducing.isOpen_iff.1 hcl.isOpen_compl + have hxO : cap.emb x ∈ O₀ := by + change x ∈ cap.emb ⁻¹' O₀ + rw [hO₀e] + rintro ⟨w, hw, hwx⟩ + exact hw (hFN hwx) + have hdf : {Θ ∈ cuffs S | Disjoint (closure (cap.cuffDisc Θ)) Z}.Finite + := hfc.subset fun _ h ↦ h.1 + let G : Set Shat := ⋂ Θ ∈ {Θ ∈ cuffs S | Disjoint (closure (cap.cuffDisc Θ)) Z}, (closure + (cap.cuffDisc Θ))ᶜ + have hGo : IsOpen G := hdf.isOpen_biInter fun _ _ ↦ isClosed_closure.isOpen_compl + have hpG : cap.emb x ∈ G := mem_iInter₂.2 fun Θ hΘ h ↦ disjoint_left.1 hΘ.2 h + (Surface.discBd_subset _ hp) + obtain ⟨O, hOo, hpO, hOW, hOc⟩ := exists_nhd_outside hT hZ hp (hO₀.inter hGo) ⟨hxO, hpG⟩ + set C : Set S := cap.emb ⁻¹' (O \ Z) with hC + have hrange : O \ Z ⊆ range cap.emb := by + rintro z ⟨hzO, hzZ⟩ + by_contra hzr + have hzc : z ∈ (range cap.emb)ᶜ := hzr + rw [cap.compl_eq] at hzc + obtain ⟨Θ, hΘ, hzΘ⟩ := mem_iUnion₂.1 hzc + rcases hoth Θ hΘ with h | h + · exact hzZ (h (subset_closure hzΘ)) + · exact (mem_iInter₂.1 (hOW hzO).2 Θ ⟨hΘ, h⟩) (subset_closure hzΘ) + have hCc : IsPreconnected C := by + rw [← cap.isEmbedding.isInducing.isPreconnected_image, image_preimage_eq_of_subset hrange] + exact hOc + have hCK : C ⊆ K.Uᶜ := fun z hz hzK ↦ hz.2 (Surface.discBd_subset _ (hsub + (mem_image_of_mem _ hzK))) + have hpc : IsPreconnected (ψ ⁻¹' C) := isPreconnected_preimage_of_isCutMap hψ K.isClosed_U hCK hCc + have hsubN : ψ ⁻¹' C ⊆ U x₁ ∪ V₂ := fun z hz ↦ by + by_contra hzN + have hmem : cap.emb (ψ z) ∈ O₀ := (hOW hz.1).1 + have : ψ z ∈ cap.emb ⁻¹' O₀ := hmem + rw [hO₀e] at this + exact this ⟨z, hzN, rfl⟩ + have hmeet : ∀ {w}, w ∈ connectedComponent y → ψ w = x → ((ψ ⁻¹' C) ∩ U w).Nonempty := by + intro w hw hwx + have hS₁ := hfrag.isSurface + have hcv : Continuous fun z : connectedComponent y ↦ ψ z.1 := hfrag.continuous_ψ + let G₁ : Set (connectedComponent y) := Subtype.val ⁻¹' U w ∩ (fun z ↦ ψ z.1) ⁻¹' (cap.emb ⁻¹' O) + have hG₁ : IsOpen G₁ := ((hU w).2.preimage continuous_subtype_val).inter (hOo.preimage + (cap.isEmbedding.continuous.comp hcv)) + have hwG : (⟨w, hw⟩ : connectedComponent y) ∈ G₁ := ⟨(hU w).1, by + change cap.emb (ψ w) ∈ O + rw [hwx] + exact hpO⟩ + obtain ⟨z, hzG, hzi⟩ := (dense_interior' hS₁).inter_open_nonempty _ hG₁ ⟨_, hwG⟩ + have hoff := disjoint_left.1 hfrag.maps_interior_disjoint (mem_image_of_mem _ hzi) + refine ⟨z.1, ⟨hzG.2, fun hzZ ↦ ?_⟩, hzG.1⟩ + have hzim : cap.emb (ψ z.1) ∉ discInt Z := him (mem_image_of_mem _ z.2) + have hzb : cap.emb (ψ z.1) ∈ discBd Z := by + by_contra hb + exact hzim ⟨hzZ, hb⟩ + rcases hrest hzb with h | ⟨a, ha, hae⟩ + · obtain ⟨Θ, hΘ, hzΘ⟩ := mem_iUnion₂.1 h + exact hoff (Or.inl (cap.bd_of_mem hΘ hzΘ)) + · exact hoff (Or.inr (cap.isEmbedding.injective hae ▸ ha)) + obtain ⟨a, ha, ha'⟩ := hmeet h₁ rfl + obtain ⟨b, hb, hb'⟩ := hmeet h₂ he.symm + have hin := hpc.subset_left_of_subset_union (hU x₁).2 hV₂o hdis hsubN ⟨a, ha, ha'⟩ + have hbV : b ∈ V₂ := mem_iUnion₂.2 ⟨x₂, ⟨hx₂F, Ne.symm hne⟩, hb'⟩ + exact disjoint_left.1 hdis (hin hb) hbV + +/-- **Surfaces with the same capping and the same number of cuffs are homeomorphic.** -/ +theorem nonempty_homeomorph_of_cap {S₁ S₂ T₁ T₂ : Type} [TopologicalSpace S₁] [TopologicalSpace S₂] + [TopologicalSpace T₁] + [TopologicalSpace T₂] (h₁ : IsSurface S₁) (c₁ : ConnectedSpace S₁) (h₂ : IsSurface S₂) + (c₂ : ConnectedSpace S₂) + (cap₁ : IsCappedSurface S₁ T₁) (cap₂ : IsCappedSurface S₂ T₂) (hT : Nonempty (T₁ ≃ₜ T₂)) + (hn : numCuffs S₁ = numCuffs S₂) : + Nonempty (S₁ ≃ₜ S₂) := by + obtain ⟨a, b, c, ⟨e₁⟩⟩ := classification S₁ h₁ c₁ + obtain ⟨a', b', c', ⟨e₂⟩⟩ := classification S₂ h₂ c₂ + obtain ⟨g₁⟩ := capModel a b c T₁ (cap₁.ofHomeo e₁.symm) + obtain ⟨g₂⟩ := capModel a' b' c' T₂ (cap₂.ofHomeo e₂.symm) + obtain ⟨t⟩ := hT + have hc : c = c' := by + rw [numCuffs_eq e₁, numCuffs_eq e₂, numCuffs_model, numCuffs_model] at hn + exact hn + obtain ⟨-, h₃, h₄⟩ := (modelCriterion.2 a b 0 a' b' 0).1 ⟨g₁.symm.trans (t.trans g₂)⟩ + obtain ⟨m⟩ := (modelCriterion.2 a b c a' b' c').2 ⟨hc, h₃, h₄⟩ + exact ⟨e₁.trans (m.trans e₂.symm)⟩ + +end Lift + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Lens.lean b/LeanPool/GraphMinor/GM19/Lens.lean new file mode 100644 index 0000000000..197a9d2dd8 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Lens.lean @@ -0,0 +1,369 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section8a +public import LeanPool.GraphMinor.GM11.Fan +public import LeanPool.GraphMinor.GM11.Forest +public import LeanPool.GraphMinor.Surface.PushOff + +/-! +# Three lenses in a disc + +Let `a`, `b`, `c` be three points on the boundary of a closed disc `D`. In the proof of Graph Minors +XIX, +(2.1), we choose a disc `Δ ⊆ D` that meets `bd(D)` exactly in these three points. Here we cut `D` +along three +chords, one after the other. Each cut takes off a lens `R` next to one arc of `bd(D)`. What stays is +`Δ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM20.Thin + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +/-- A connected part of an `O`-arc that misses the ends of a line in the `O`-arc, and meets the +line, +lies in the line. -/ +theorem subset_line_of_preconnected {F Y X : Set S} {p q b : S} (hF : IsOArc F) + (hY : IsLineWithEnds Y p q) (hYF : Y ⊆ F) (hX : IsPreconnected X) (hXF : X ⊆ F \ {p, q}) + (hb : b ∈ X) (hbY : b ∈ Y) : X ⊆ Y := by + obtain ⟨u, v, huv, hr, h0, h1, hun⟩ := exists_arcs_of_line hF hY hYF + have hc₁ : IsClosed (range u) := (isCompact_range huv.arc_left.1).isClosed + have hc₂ : IsClosed (range v) := (isCompact_range huv.arc_right.1).isClosed + intro x hx + by_contra hxY + have hxv : x ∈ range v := by + have := (hXF hx).1 + rw [← hun, hr] at this + exact this.resolve_left hxY + obtain ⟨y, hyX, hy₁, hy₂⟩ := isPreconnected_closed_iff.mp hX _ _ hc₁ hc₂ + (fun z hz ↦ by + have := (hXF hz).1 + rwa [← hun] at this) + ⟨b, hb, hr ▸ hbY⟩ ⟨x, hx, hxv⟩ + obtain ⟨s, rfl⟩ := hy₁ + obtain ⟨t, ht⟩ := hy₂ + rcases huv.meet s t ht.symm with ⟨rfl, -⟩ | ⟨rfl, -⟩ + · exact (hXF hyX).2 (Or.inl h0) + · exact (hXF hyX).2 (Or.inr h1) + +/-- One cut. A chord from `a` to `b` splits `D` into a lens `R` and a disc `Q`, with `c` on the +boundary of `Q` and not in `R`. -/ +theorem exists_cut {D : Set S} (hD : IsClosedDisc D) {a b c : S} (ha : a ∈ discBd D) + (hb : b ∈ discBd D) (hc : c ∈ discBd D) (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) : + ∃ L R Q : Set S, IsLineWithEnds L a b ∧ IsClosedDisc R ∧ IsClosedDisc Q ∧ R ∪ Q = D ∧ R ∩ Q = L + ∧ + L ∩ discBd D = {a, b} ∧ L ⊆ discBd R ∧ L ⊆ discBd Q ∧ discBd R ⊆ L ∪ discBd D ∧ + discBd Q ⊆ L ∪ connectedComponentIn (discBd D \ {a, b}) c ∧ discBd D ∩ Q ⊆ discBd Q ∧ + ∀ X : Set S, IsPreconnected X → X ⊆ discBd D \ {a, b} → c ∈ X → X ⊆ discBd Q \ R := by + obtain ⟨L, hL, hLD, hLi⟩ := GM20.exists_chord hD ha hb hab + have haL : a ∈ L := by + obtain ⟨f, h0, -⟩ := hL + exact h0 ▸ (f 0).2 + have hbL : b ∈ L := by + obtain ⟨f, -, h1⟩ := hL + exact h1 ▸ (f 1).2 + have hcap : L ∩ discBd D = {a, b} := by + ext x + constructor + · rintro ⟨hx, hxb⟩ + by_contra hn + exact (hLi ⟨hx, hn⟩).2 hxb + · rintro (rfl | rfl) + · exact ⟨haL, ha⟩ + · exact ⟨hbL, hb⟩ + obtain ⟨A₁, A₂, Δ₁, Δ₂, -, hcomp, hd₁, hd₂, hun, hint, hbd₁, hbd₂, -⟩ := + disc_iArc D L a b hD hLD hab hL hcap + have key : ∀ A₁ A₂ Δ₁ Δ₂ : Set S, componentsIn (discBd D \ {a, b}) = {A₁, A₂} → IsClosedDisc Δ₁ → + IsClosedDisc Δ₂ → Δ₁ ∪ Δ₂ = D → Δ₁ ∩ Δ₂ = L → discBd Δ₁ = A₁ ∪ L → discBd Δ₂ = A₂ ∪ L → + connectedComponentIn (discBd D \ {a, b}) c = A₂ → + ∃ L R Q : Set S, IsLineWithEnds L a b ∧ IsClosedDisc R ∧ IsClosedDisc Q ∧ R ∪ Q = D ∧ + R ∩ Q = L ∧ L ∩ discBd D = {a, b} ∧ L ⊆ discBd R ∧ L ⊆ discBd Q ∧ + discBd R ⊆ L ∪ discBd D ∧ discBd Q ⊆ L ∪ connectedComponentIn (discBd D \ {a, b}) c + ∧ discBd D ∩ Q ⊆ discBd Q ∧ + ∀ X : Set S, IsPreconnected X → X ⊆ discBd D \ {a, b} → c ∈ X → X ⊆ discBd Q \ R := by + intro A₁ A₂ Δ₁ Δ₂ hcomp hd₁ hd₂ hun hint hbd₁ hbd₂ hA + have hsub : ∀ A ∈ componentsIn (discBd D \ {a, b}), A ⊆ discBd D \ {a, b} := by + rintro _ ⟨x, -, rfl⟩ + exact connectedComponentIn_subset _ _ + have hA₁ : A₁ ⊆ discBd D \ {a, b} := hsub _ (hcomp ▸ Or.inl rfl) + have hA₂ : A₂ ⊆ discBd D \ {a, b} := hsub _ (hcomp ▸ Or.inr rfl) + have hcov : discBd D \ {a, b} ⊆ A₁ ∪ A₂ := by + intro x hx + have : connectedComponentIn (discBd D \ {a, b}) x ∈ componentsIn (discBd D \ {a, b}) + := ⟨x, hx, rfl⟩ + rw [hcomp] at this + rcases this with h | h + · exact Or.inl (h ▸ mem_connectedComponentIn hx) + · exact Or.inr (h ▸ mem_connectedComponentIn hx) + have hcm : c ∈ discBd D \ {a, b} := ⟨hc, by + rintro (rfl | rfl) + · exact hac rfl + · exact hbc rfl⟩ + have hmeet : ∀ x ∈ Δ₁, x ∈ A₂ → False := fun x hx₁ hx₂ ↦ by + have hxL : x ∈ L := hint ▸ ⟨hx₁, discBd_subset Δ₂ (hbd₂ ▸ Or.inl hx₂)⟩ + have hx : x ∈ L ∩ discBd D := ⟨hxL, (hA₂ hx₂).1⟩ + rw [hcap] at hx + exact (hA₂ hx₂).2 hx + refine ⟨L, Δ₁, Δ₂, hL, hd₁, hd₂, hun, hint, hcap, hbd₁ ▸ subset_union_right, + hbd₂ ▸ subset_union_right, ?_, ?_, ?_, ?_⟩ + · rw [hbd₁] + rintro x (hx | hx) + · exact Or.inr (hA₁ hx).1 + · exact Or.inl hx + · rw [hbd₂, hA, union_comm] + · rintro x ⟨hxb, hxQ⟩ + by_cases hab' : x ∈ ({a, b} : Set S) + · rw [hbd₂] + rcases hab' with rfl | rfl + · exact Or.inr haL + · exact Or.inr hbL + · rcases hcov ⟨hxb, hab'⟩ with h | h + · have hx1 : x ∈ Δ₁ := discBd_subset Δ₁ (hbd₁ ▸ Or.inl h) + have hxL : x ∈ L := hint ▸ ⟨hx1, hxQ⟩ + exact absurd (hcap ▸ (⟨hxL, hxb⟩ : x ∈ L ∩ discBd D)) hab' + · rw [hbd₂] + exact Or.inl h + · intro X hX hXs hcX x hx + have : x ∈ A₂ := hA ▸ hX.subset_connectedComponentIn hcX hXs hx + refine ⟨hbd₂ ▸ Or.inl this, fun h ↦ hmeet x h this⟩ + have hcm : c ∈ discBd D \ {a, b} := ⟨hc, by + rintro (rfl | rfl) + · exact hac rfl + · exact hbc rfl⟩ + have hin : connectedComponentIn (discBd D \ {a, b}) c ∈ componentsIn (discBd D \ {a, b}) := + ⟨c, hcm, rfl⟩ + rw [hcomp] at hin + rcases hin with h | h + · refine key A₂ A₁ Δ₂ Δ₁ (by rw [hcomp, pair_comm]) hd₂ hd₁ (by rw [union_comm, hun]) + (by rw [inter_comm, hint]) hbd₂ hbd₁ h + · exact key A₁ A₂ Δ₁ Δ₂ hcomp hd₁ hd₂ hun hint hbd₁ hbd₂ h + +/-- `Δ` and the three lenses `R₁`, `R₂`, `R₃` of a disc `D` with three points on its boundary. Each +lens `Rᵢ` is cut off along a line `Lᵢ` of `Δ` joining two of the points. -/ +structure IsLens (D Δ L R : Set S) (a b c : S) : Prop where + line : IsLineWithEnds L a b + disc : IsClosedDisc R + sub : R ⊆ D + sub_Δ : L ⊆ Δ + inter : R ∩ Δ = L + cap : L ∩ discBd D = {a, b} + L_bd : L ⊆ discBd R + bd : discBd R ⊆ L ∪ discBd D + third : c ∉ R + +theorem exists_lenses {D : Set S} (hD : IsClosedDisc D) {a b c : S} (ha : a ∈ discBd D) + (hb : b ∈ discBd D) (hc : c ∈ discBd D) (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) : + ∃ Δ L₁ L₂ L₃ R₁ R₂ R₃ : Set S, IsClosedDisc Δ ∧ Δ ⊆ D ∧ a ∈ discBd Δ ∧ b ∈ discBd Δ ∧ + c ∈ discBd Δ ∧ Δ ∩ discBd D = {a, b, c} ∧ discBd Δ ⊆ L₁ ∪ L₂ ∪ L₃ ∧ + IsLens D Δ L₁ R₁ a b c ∧ IsLens D Δ L₂ R₂ b c a ∧ IsLens D Δ L₃ R₃ c a b ∧ + R₁ ∩ R₂ ⊆ {a, b, c} ∧ R₁ ∩ R₃ ⊆ {a, b, c} ∧ R₂ ∩ R₃ ⊆ {a, b, c} ∧ D = Δ ∪ R₁ ∪ R₂ ∪ R₃ := by + have hmemL : ∀ {L : Set S} {u v : S}, IsLineWithEnds L u v → u ∈ L ∧ v ∈ L := by + rintro L u v ⟨f, h0, h1⟩ + exact ⟨h0 ▸ (f 0).2, h1 ▸ (f 1).2⟩ + obtain ⟨L₁, R₁, Q₁, hL₁, hR₁, hQ₁, hu₁, hi₁, hcap₁, hLR₁, hLQ₁, hbR₁, hbQ₁, hsub₁, hX₁⟩ := + exists_cut hD ha hb hc hab hac hbc + have hcQ₁ := hX₁ {c} isPreconnected_singleton + (singleton_subset_iff.mpr ⟨hc, by + rintro (rfl | rfl) + · exact hac rfl + · exact hbc rfl⟩) rfl rfl + have haQ₁ := hLQ₁ (hmemL hL₁).1 + have hbQ₁' := hLQ₁ (hmemL hL₁).2 + obtain ⟨L₂, R₂, Q₂, hL₂, hR₂, hQ₂, hu₂, hi₂, hcap₂, hLR₂, hLQ₂, hbR₂, hbQ₂, hsub₂, hX₂⟩ := + exists_cut hQ₁ hbQ₁' hcQ₁.1 haQ₁ hbc hab.symm hac.symm + have hb₂ := hLQ₂ (hmemL hL₂).1 + have hc₂ := hLQ₂ (hmemL hL₂).2 + have hX₁₂ : L₁ \ {b} ⊆ discBd Q₂ \ R₂ := by + refine hX₂ _ (GM11.IsLineWithEnds.isPreconnected_sdiff (GM11.IsLineWithEnds.symm hL₁)) ?_ + ⟨(hmemL hL₁).1, hab⟩ + rintro x ⟨hx, hxb⟩ + refine ⟨hLQ₁ hx, ?_⟩ + rintro (rfl | rfl) + · exact hxb rfl + · exact (hX₁ {x} isPreconnected_singleton (singleton_subset_iff.mpr ⟨hc, by + rintro (rfl | rfl) + · exact hac rfl + · exact hbc rfl⟩) rfl rfl).2 (hi₁ ▸ hx |>.1) + have ha₂ : a ∈ discBd Q₂ := (hX₁₂ ⟨(hmemL hL₁).1, hab⟩).1 + have hL₁Q₂ : L₁ ⊆ discBd Q₂ := fun x hx ↦ by + by_cases h : x = b + · exact h ▸ hb₂ + · exact (hX₁₂ ⟨hx, h⟩).1 + have haR₂ : a ∉ R₂ := (hX₁₂ ⟨(hmemL hL₁).1, hab⟩).2 + obtain ⟨L₃, R₃, Q₃, hL₃, hR₃, hQ₃, hu₃, hi₃, hcap₃, hLR₃, hLQ₃, hbR₃, hbQ₃, hsub₃, hX₃⟩ := + exists_cut hQ₂ hc₂ ha₂ hb₂ hac.symm hbc.symm hab + have hcL₁ : c ∉ L₁ := fun h ↦ (hcQ₁.2) (hi₁ ▸ h |>.1) + have haL₂ : a ∉ L₂ := fun h ↦ haR₂ (hi₂ ▸ h |>.1) + have hX₁₃ : L₁ \ {a} ⊆ discBd Q₃ \ R₃ := by + refine hX₃ _ (GM11.IsLineWithEnds.isPreconnected_sdiff hL₁) ?_ ⟨(hmemL hL₁).2, hab.symm⟩ + rintro x ⟨hx, hxa⟩ + refine ⟨hL₁Q₂ hx, ?_⟩ + rintro (rfl | rfl) + · exact hcL₁ hx + · exact hxa rfl + have hX₂₃ : L₂ \ {c} ⊆ discBd Q₃ \ R₃ := by + refine hX₃ _ (GM11.IsLineWithEnds.isPreconnected_sdiff (GM11.IsLineWithEnds.symm hL₂)) ?_ + ⟨(hmemL hL₂).1, hbc⟩ + rintro x ⟨hx, hxc⟩ + refine ⟨hLQ₂ hx, ?_⟩ + rintro (rfl | rfl) + · exact hxc rfl + · exact haL₂ hx + have ha₃ := hLQ₃ (hmemL hL₃).2 + have hc₃ := hLQ₃ (hmemL hL₃).1 + have hb₃ : b ∈ discBd Q₃ := (hX₁₃ ⟨(hmemL hL₁).2, hab.symm⟩).1 + have hbnR₃ : b ∉ R₃ := (hX₁₃ ⟨(hmemL hL₁).2, hab.symm⟩).2 + have hQ₃₂ : Q₃ ⊆ Q₂ := hu₃ ▸ subset_union_right + have hQ₂₁ : Q₂ ⊆ Q₁ := hu₂ ▸ subset_union_right + have hQ₁D : Q₁ ⊆ D := hu₁ ▸ subset_union_right + have hL₁Q₃ : L₁ ⊆ Q₃ := fun x hx ↦ by + by_cases h : x = a + · exact h ▸ discBd_subset _ ha₃ + · exact discBd_subset _ (hX₁₃ ⟨hx, h⟩).1 + have hL₂Q₃ : L₂ ⊆ Q₃ := fun x hx ↦ by + by_cases h : x = c + · exact h ▸ discBd_subset _ hc₃ + · exact discBd_subset _ (hX₂₃ ⟨hx, h⟩).1 + have hL₃Q₃ : L₃ ⊆ Q₃ := hi₃ ▸ inter_subset_right + have hR₂Q₁ : R₂ ⊆ Q₁ := hu₂ ▸ subset_union_left + have hR₃Q₂ : R₃ ⊆ Q₂ := hu₃ ▸ subset_union_left + have hYline : IsLineWithEnds (L₁ ∪ L₂) a c := by + refine GM11.IsLineWithEnds.union (v := b) (GM11.IsLineWithEnds.symm hL₁) hL₂ ?_ + ext x + constructor + · rintro ⟨hx₁, hx₂⟩ + by_contra hn + exact (hX₁₂ ⟨hx₁, hn⟩).2 (hi₂ ▸ hx₂ |>.1) + · rintro rfl + exact ⟨(hmemL hL₁).2, (hmemL hL₂).1⟩ + have hbd₃ : discBd Q₃ ⊆ L₁ ∪ L₂ ∪ L₃ := by + intro x hx + rcases hbQ₃ hx with h | h + · exact Or.inr h + · have hY := + subset_line_of_preconnected (F := discBd Q₂) hQ₂.isOArc_discBd + (GM11.IsLineWithEnds.symm hYline) (union_subset hL₁Q₂ hLQ₂) (X := connectedComponentIn + (discBd Q₂ \ {c, a}) b) + isPreconnected_connectedComponentIn (connectedComponentIn_subset _ _) + (mem_connectedComponentIn ⟨hb₂, by + rintro (rfl | rfl) + · exact hbc rfl + · exact hab.symm rfl⟩) (Or.inl (hmemL hL₁).2) h + exact Or.inl hY + have hbdQ₁ : ∀ {x}, x ∈ discBd D → x ∈ Q₂ → x ∈ discBd Q₂ := fun hx hxQ ↦ + hsub₂ ⟨hsub₁ ⟨hx, hQ₂₁ hxQ⟩, hxQ⟩ + have hbQ₁₂ : discBd Q₁ ⊆ L₁ ∪ discBd D := fun x hx ↦ + (hbQ₁ hx).imp_right fun h ↦ (connectedComponentIn_subset (discBd D \ {a, b}) c h).1 + have hbQ₂₂ : discBd Q₂ ⊆ L₂ ∪ discBd Q₁ := fun x hx ↦ + (hbQ₂ hx).imp_right fun h ↦ (connectedComponentIn_subset (discBd Q₁ \ {b, c}) a h).1 + have hL₂c : L₂ ∩ discBd D = {b, c} := by + ext x + constructor + · rintro ⟨hx, hxb⟩ + have : x ∈ L₂ ∩ discBd Q₁ := ⟨hx, hsub₁ ⟨hxb, hR₂Q₁ (hi₂ ▸ hx |>.1)⟩⟩ + rwa [hcap₂] at this + · rintro (rfl | rfl) + · exact ⟨(hmemL hL₂).1, hb⟩ + · exact ⟨(hmemL hL₂).2, hc⟩ + have hL₃c : L₃ ∩ discBd D = {c, a} := by + ext x + constructor + · rintro ⟨hx, hxb⟩ + have hxQ : x ∈ Q₂ := hR₃Q₂ (hi₃ ▸ hx |>.1) + have : x ∈ L₃ ∩ discBd Q₂ := ⟨hx, hbdQ₁ hxb hxQ⟩ + rwa [hcap₃] at this + · rintro (rfl | rfl) + · exact ⟨(hmemL hL₃).1, hc⟩ + · exact ⟨(hmemL hL₃).2, ha⟩ + have hcapD : Q₃ ∩ discBd D = {a, b, c} := by + ext x + constructor + · rintro ⟨hx, hxb⟩ + rcases hbd₃ (hsub₃ ⟨hbdQ₁ hxb (hQ₃₂ hx), hx⟩) with (h | h) | h + · have : x ∈ L₁ ∩ discBd D := ⟨h, hxb⟩ + rw [hcap₁] at this + rcases this with rfl | rfl + · exact Or.inl rfl + · exact Or.inr (Or.inl rfl) + · have : x ∈ L₂ ∩ discBd D := ⟨h, hxb⟩ + rw [hL₂c] at this + rcases this with rfl | rfl + · exact Or.inr (Or.inl rfl) + · exact Or.inr (Or.inr rfl) + · have : x ∈ L₃ ∩ discBd D := ⟨h, hxb⟩ + rw [hL₃c] at this + rcases this with rfl | rfl + · exact Or.inr (Or.inr rfl) + · exact Or.inl rfl + · rintro (rfl | rfl | rfl) + · exact ⟨discBd_subset _ ha₃, ha⟩ + · exact ⟨discBd_subset _ hb₃, hb⟩ + · exact ⟨discBd_subset _ hc₃, hc⟩ + refine ⟨Q₃, L₁, L₂, L₃, R₁, R₂, R₃, hQ₃, (hQ₃₂.trans hQ₂₁).trans hQ₁D, ha₃, hb₃, hc₃, hcapD, hbd₃, + ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · refine ⟨hL₁, hR₁, hu₁ ▸ subset_union_left, hL₁Q₃, ?_, hcap₁, hLR₁, hbR₁, hcQ₁.2⟩ + ext x + constructor + · rintro ⟨hx, hxQ⟩ + exact hi₁ ▸ ⟨hx, hQ₂₁ (hQ₃₂ hxQ)⟩ + · intro hx + exact ⟨(hi₁ ▸ hx : x ∈ R₁ ∩ Q₁).1, hL₁Q₃ hx⟩ + · refine ⟨hL₂, hR₂, hR₂Q₁.trans hQ₁D, hL₂Q₃, ?_, hL₂c, hLR₂, ?_, haR₂⟩ + · ext x + constructor + · rintro ⟨hx, hxQ⟩ + exact hi₂ ▸ ⟨hx, hQ₃₂ hxQ⟩ + · intro hx + exact ⟨(hi₂ ▸ hx : x ∈ R₂ ∩ Q₂).1, hL₂Q₃ hx⟩ + · intro x hx + rcases hbR₂ hx with h | h + · exact Or.inl h + · rcases hbQ₁₂ h with h' | h' + · by_cases hxb : x = b + · exact Or.inl (hxb ▸ (hmemL hL₂).1) + · exact absurd (discBd_subset _ hx) (hX₁₂ ⟨h', hxb⟩).2 + · exact Or.inr h' + · refine ⟨hL₃, hR₃, (hR₃Q₂.trans hQ₂₁).trans hQ₁D, hL₃Q₃, hi₃, hL₃c, hLR₃, ?_, hbnR₃⟩ + intro x hx + have hxR := discBd_subset _ hx + rcases hbR₃ hx with h | h + · exact Or.inl h + · rcases hbQ₂₂ h with h' | h' + · by_cases hxc : x = c + · exact Or.inl (hxc ▸ (hmemL hL₃).1) + · exact absurd hxR (hX₂₃ ⟨h', hxc⟩).2 + · rcases hbQ₁₂ h' with h'' | h'' + · by_cases hxa : x = a + · exact Or.inl (hxa ▸ (hmemL hL₃).2) + · exact absurd hxR (hX₁₃ ⟨h'', hxa⟩).2 + · exact Or.inr h'' + · rintro x ⟨hx₁, hx₂⟩ + have hxL : x ∈ L₁ := hi₁ ▸ ⟨hx₁, hR₂Q₁ hx₂⟩ + by_contra hn + exact (hX₁₂ ⟨hxL, fun h ↦ hn (Or.inr (Or.inl h))⟩).2 hx₂ + · rintro x ⟨hx₁, hx₃⟩ + have hxL : x ∈ L₁ := hi₁ ▸ ⟨hx₁, hQ₂₁ (hR₃Q₂ hx₃)⟩ + by_contra hn + exact (hX₁₃ ⟨hxL, fun h ↦ hn (Or.inl h)⟩).2 hx₃ + · rintro x ⟨hx₂, hx₃⟩ + have hxL : x ∈ L₂ := hi₂ ▸ ⟨hx₂, hR₃Q₂ hx₃⟩ + by_contra hn + exact (hX₂₃ ⟨hxL, fun h ↦ hn (Or.inr (Or.inr h))⟩).2 hx₃ + · rw [← hu₁, ← hu₂, ← hu₃] + ext x + simp only [mem_union] + tauto + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/LineCut.lean b/LeanPool/GraphMinor/GM19/LineCut.lean new file mode 100644 index 0000000000..a0e06be3df --- /dev/null +++ b/LeanPool/GraphMinor/GM19/LineCut.lean @@ -0,0 +1,307 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FragmentShape +import LeanPool.GraphMinor.GM19.Section6Cuff + +/-! +# Lines and `O`-arcs cut at a finite set + +A line with `m` marked points, its two ends among them, falls into `m - 1` open arcs, each with two +of the marked points as ends. An +`O`-arc with `m ≥ 2` marked points falls into `m` open arcs. The proof of (10.5) uses this twice. It +tells how many edges a circuit +has once we forget its vertices that are off `Γ`, and how many sides of the frame lie in an arc of a +cuff. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +omit [T2Space T] in +/-- A path-connected set off `N` lies in one of two closed sets that cover it and meet only in `N`. +-/ +theorem subset_or_of_closed {X Y N C : Set T} (hX : IsClosed X) (hY : IsClosed Y) (hXY : X ∩ Y ⊆ N) + (hC : IsPathConnected C) (hsub : C ⊆ (X ∪ Y) \ N) : C ⊆ X ∨ C ⊆ Y := by + have hp := hC.isConnected.isPreconnected + by_contra hno + push Not at hno + obtain ⟨hnX, hnY⟩ := hno + obtain ⟨a, ha, haX⟩ := not_subset.1 hnX + obtain ⟨b, hb, hbY⟩ := not_subset.1 hnY + have haY : a ∈ Y := ((hsub ha).1).resolve_left haX + have hbX : b ∈ X := ((hsub hb).1).resolve_right hbY + obtain ⟨z, hz, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp hp X Y hX hY (fun z hz ↦ + (hsub hz).1) ⟨b, hb, hbX⟩ ⟨a, ha, haY⟩ + exact (hsub hz).2 (hXY ⟨hz₁, hz₂⟩) + +omit [T2Space T] in +/-- The arcs of a union of two closed sets that meet only in `N` are the arcs of the two sets. -/ +theorem arcComponentsIn_union_sdiff {X Y N : Set T} (hX : IsClosed X) (hY : IsClosed Y) + (hXY : X ∩ Y ⊆ N) : + arcComponentsIn ((X ∪ Y) \ N) = arcComponentsIn (X \ N) ∪ arcComponentsIn (Y \ N) := by + have hsX : X \ N ⊆ (X ∪ Y) \ N := sdiff_subset_sdiff_left subset_union_left + have hsY : Y \ N ⊆ (X ∪ Y) \ N := sdiff_subset_sdiff_left subset_union_right + ext C + constructor + · rintro ⟨hne, hsub, hC, hmax⟩ + have key : ∀ {W : Set T}, W \ N ⊆ (X ∪ Y) \ N → C ⊆ W → C ∈ arcComponentsIn (W \ N) + := fun {W} hW hCW ↦ + ⟨hne, fun x hx ↦ ⟨hCW hx, (hsub hx).2⟩, hC, fun D hD hDc hCD ↦ hmax D (hD.trans hW) hDc hCD⟩ + rcases subset_or_of_closed hX hY hXY hC hsub with h | h + · exact Or.inl (key hsX h) + · exact Or.inr (key hsY h) + · have key : ∀ {W W' : Set T}, IsClosed W → IsClosed W' → W ∩ W' ⊆ N → W \ N ⊆ (X ∪ Y) \ N → + (X ∪ Y) = W ∪ W' → + C ∈ arcComponentsIn (W \ N) → C ∈ arcComponentsIn ((X ∪ Y) \ N) := by + rintro W W' h₁ h₂ h₃ hW hun ⟨hne, hsub, hC, hmax⟩ + refine ⟨hne, hsub.trans hW, hC, fun D hD hDc hCD ↦ hmax D ?_ hDc hCD⟩ + rw [hun] at hD + rcases subset_or_of_closed h₁ h₂ h₃ hDc hD with h | h + · exact fun x hx ↦ ⟨h hx, (hD hx).2⟩ + · obtain ⟨x, hx⟩ := hne + exact absurd h₃ fun hc ↦ (hD (hCD hx)).2 (hc ⟨(hsub hx).1, h (hCD hx)⟩) + rintro (h | h) + · exact key hX hY hXY hsX rfl h + · exact key hY hX (by rwa [inter_comm]) hsY (union_comm _ _) h + +/-- The shape of an open arc cut from a line or an `O`-arc. -/ +def IsMarkedArc (N e : Set T) : Prop := + ∃ u v, u ≠ v ∧ closure e ∩ N = {u, v} ∧ IsLineWithEnds (closure e) u v + +omit [T2Space T] in +theorem line_isPathConnected_sdiff {L : Set T} {a b : T} (h : IsLineWithEnds L a b) : + IsPathConnected (L \ {a, b}) := + h.isPathConnected_interior + +/-- **A line cut at a finite set.** -/ +theorem arcs_of_line : ∀ (m : ℕ) {N L : Set T} {a b : T}, N.Finite → N.ncard = m + → IsLineWithEnds L a b → a ∈ N → b ∈ N → N ⊆ L → + (arcComponentsIn (L \ N)).Finite ∧ (arcComponentsIn (L \ N)).ncard + 1 = N.ncard ∧ + ∀ e ∈ arcComponentsIn (L \ N), IsMarkedArc N e ∧ e ⊆ L := by + intro m + induction m using Nat.strong_induction_on with + | _ m ih => + intro N L a b hN hm hL ha hb hNL + have hab : a ≠ b := (ends_of_line hL).2.2 + by_cases hx : ∃ x ∈ N, x ≠ a ∧ x ≠ b + · obtain ⟨x, hxN, hxa, hxb⟩ := hx + obtain ⟨L₁, L₂, h₁, h₂, hun, hint⟩ := hL.split (hNL hxN) hxa hxb + have hc₁ := isClosed_of_cuffLine h₁ + have hc₂ := isClosed_of_cuffLine h₂ + have hxL₁ := (ends_of_line h₁).2.1 + have hxL₂ := (ends_of_line h₂).1 + have haL := (ends_of_line h₁).1 + have hbL := (ends_of_line h₂).2.1 + have hbn₁ : b ∉ L₁ := fun h ↦ hxb (by + have : b ∈ L₁ ∩ L₂ := ⟨h, hbL⟩ + rw [hint] at this + exact this.symm) + have han₂ : a ∉ L₂ := fun h ↦ hxa (by + have : a ∈ L₁ ∩ L₂ := ⟨haL, h⟩ + rw [hint] at this + exact this.symm) + have hsub₁ : N ∩ L₁ ⊂ N := ⟨inter_subset_left, fun h ↦ hbn₁ (h hb).2⟩ + have hsub₂ : N ∩ L₂ ⊂ N := ⟨inter_subset_left, fun h ↦ han₂ (h ha).2⟩ + have hl₁ : (N ∩ L₁).ncard < m := hm ▸ ncard_lt_ncard hsub₁ hN + have hl₂ : (N ∩ L₂).ncard < m := hm ▸ ncard_lt_ncard hsub₂ hN + obtain ⟨f₁, n₁, s₁⟩ := ih _ hl₁ (hN.subset inter_subset_left) rfl h₁ ⟨ha, haL⟩ ⟨hxN, hxL₁⟩ + inter_subset_right + obtain ⟨f₂, n₂, s₂⟩ := ih _ hl₂ (hN.subset inter_subset_left) rfl h₂ ⟨hxN, hxL₂⟩ ⟨hb, hbL⟩ + inter_subset_right + have hXN : L₁ ∩ L₂ ⊆ N := by + rw [hint] + rintro _ rfl + exact hxN + have hs₁ : L₁ \ (N ∩ L₁) = L₁ \ N := by + ext z + simp only [mem_sdiff, mem_inter_iff, not_and] + exact ⟨fun h ↦ ⟨h.1, fun hz ↦ h.2 hz h.1⟩, fun h ↦ ⟨h.1, fun hz ↦ absurd hz h.2⟩⟩ + have hs₂ : L₂ \ (N ∩ L₂) = L₂ \ N := by + ext z + simp only [mem_sdiff, mem_inter_iff, not_and] + exact ⟨fun h ↦ ⟨h.1, fun hz ↦ h.2 hz h.1⟩, fun h ↦ ⟨h.1, fun hz ↦ absurd hz h.2⟩⟩ + rw [hs₁] at f₁ n₁ s₁ + rw [hs₂] at f₂ n₂ s₂ + have hA : arcComponentsIn (L \ N) = arcComponentsIn (L₁ \ N) ∪ arcComponentsIn (L₂ \ N) := by + rw [← hun] + exact arcComponentsIn_union_sdiff hc₁ hc₂ hXN + have hdisj : Disjoint (arcComponentsIn (L₁ \ N)) (arcComponentsIn (L₂ \ N)) + := disjoint_left.2 fun e he₁ he₂ ↦ by + obtain ⟨z, hz⟩ := he₁.1 + exact (he₁.2.1 hz).2 (hXN ⟨(he₁.2.1 hz).1, (he₂.2.1 hz).1⟩) + have hcard : (N ∩ L₁).ncard + (N ∩ L₂).ncard = N.ncard + 1 := by + have hu : (N ∩ L₁) ∪ (N ∩ L₂) = N := by + rw [← inter_union_distrib_left, hun] + exact inter_eq_left.2 hNL + have hi : (N ∩ L₁) ∩ (N ∩ L₂) = {x} := by + ext z + constructor + · rintro ⟨⟨-, h₁'⟩, -, h₂'⟩ + have : z ∈ L₁ ∩ L₂ := ⟨h₁', h₂'⟩ + rwa [hint] at this + · rintro rfl + exact ⟨⟨hxN, hxL₁⟩, hxN, hxL₂⟩ + have := ncard_union_add_ncard_inter (N ∩ L₁) (N ∩ L₂) (hN.subset inter_subset_left) + (hN.subset inter_subset_left) + rw [hu, hi, ncard_singleton] at this + omega + rw [hA] + refine ⟨f₁.union f₂, ?_, ?_⟩ + · rw [ncard_union_eq hdisj f₁ f₂] + omega + · have conv : ∀ {W e : Set T}, IsMarkedArc (N ∩ W) e → e ∈ arcComponentsIn (W \ N) + → IsClosed W → W ⊆ L → IsMarkedArc N e ∧ e ⊆ L := by + rintro W e ⟨u, v, huv, hs, hl⟩ he hW hWL + have hclo : closure e ⊆ W := closure_minimal (fun z hz ↦ (he.2.1 hz).1) hW + refine ⟨⟨u, v, huv, ?_, hl⟩, (subset_closure.trans hclo).trans hWL⟩ + rw [← hs] + ext z + exact ⟨fun h ↦ ⟨h.1, h.2, hclo h.1⟩, fun h ↦ ⟨h.1, h.2.1⟩⟩ + rintro e (he | he) + · exact conv (s₁ e he).1 he hc₁ (hun ▸ subset_union_left) + · exact conv (s₂ e he).1 he hc₂ (hun ▸ subset_union_right) + · push Not at hx + have hNe : N = {a, b} := by + apply Subset.antisymm + · intro z hz + by_cases hza : z = a + · exact Or.inl hza + · exact Or.inr (hx z hz hza) + · rintro _ (rfl | h) + · exact ha + · exact (mem_singleton_iff.1 h) ▸ hb + subst hNe + have hpc := line_isPathConnected_sdiff hL + have hne := hpc.nonempty + have hA : arcComponentsIn (L \ {a, b}) = {L \ {a, b}} := by + ext e + constructor + · intro he + exact (he.2.2.2 _ Subset.rfl hpc he.2.1).symm + · rintro rfl + exact ⟨hne, Subset.rfl, hpc, fun D hD _ hsub ↦ Subset.antisymm hD hsub⟩ + have hcl : closure (L \ {a, b}) = L := + Subset.antisymm (closure_minimal sdiff_subset (isClosed_of_cuffLine hL)) + hL.subset_closure_diff + rw [hA, ncard_singleton, ncard_pair hab] + refine ⟨finite_singleton _, rfl, ?_⟩ + rintro _ rfl + refine ⟨⟨a, b, hab, ?_, ?_⟩, sdiff_subset⟩ + · rw [hcl] + exact inter_eq_right.2 hNL + · rw [hcl] + exact hL + +/-- **An `O`-arc cut at a finite set.** -/ +theorem arcs_of_oArc {N F : Set T} (hN : N.Finite) (hF : IsOArc F) (hNF : N ⊆ F) (h2 : 2 + ≤ N.ncard) : + (arcComponentsIn (F \ N)).Finite ∧ (arcComponentsIn (F \ N)).ncard = N.ncard ∧ + ∀ e ∈ arcComponentsIn (F \ N), IsMarkedArc N e ∧ e ⊆ F := by + obtain ⟨x, hx, y, hy, hxy⟩ := (one_lt_ncard hN).1 h2 + obtain ⟨A, B, hA, hB, hun, hint⟩ := hF.lines (hNF hx) (hNF hy) hxy + have hcA := isClosed_of_cuffLine hA + have hcB := isClosed_of_cuffLine hB + have hxA := (ends_of_line hA).1 + have hyA := (ends_of_line hA).2.1 + have hxB := (ends_of_line hB).1 + have hyB := (ends_of_line hB).2.1 + obtain ⟨f₁, n₁, s₁⟩ := arcs_of_line _ (hN.subset inter_subset_left) rfl hA ⟨hx, hxA⟩ ⟨hy, hyA⟩ + inter_subset_right + obtain ⟨f₂, n₂, s₂⟩ := arcs_of_line _ (hN.subset inter_subset_left) rfl hB ⟨hx, hxB⟩ ⟨hy, hyB⟩ + inter_subset_right + have hXN : A ∩ B ⊆ N := by + rw [hint] + rintro _ (rfl | h) + · exact hx + · exact (mem_singleton_iff.1 h) ▸ hy + have hs : ∀ W : Set T, W \ (N ∩ W) = W \ N := fun W ↦ by + ext z + simp only [mem_sdiff, mem_inter_iff, not_and] + exact ⟨fun h ↦ ⟨h.1, fun hz ↦ h.2 hz h.1⟩, fun h ↦ ⟨h.1, fun hz ↦ absurd hz h.2⟩⟩ + rw [hs] at f₁ n₁ s₁ f₂ n₂ s₂ + have hA' : arcComponentsIn (F \ N) = arcComponentsIn (A \ N) ∪ arcComponentsIn (B \ N) := by + rw [← hun] + exact arcComponentsIn_union_sdiff hcA hcB hXN + have hdisj : Disjoint (arcComponentsIn (A \ N)) (arcComponentsIn (B \ N)) + := disjoint_left.2 fun e he₁ he₂ ↦ by + obtain ⟨z, hz⟩ := he₁.1 + exact (he₁.2.1 hz).2 (hXN ⟨(he₁.2.1 hz).1, (he₂.2.1 hz).1⟩) + have hcard : (N ∩ A).ncard + (N ∩ B).ncard = N.ncard + 2 := by + have hu : (N ∩ A) ∪ (N ∩ B) = N := by + rw [← inter_union_distrib_left, hun] + exact inter_eq_left.2 hNF + have hi : (N ∩ A) ∩ (N ∩ B) = {x, y} := by + ext z + constructor + · rintro ⟨⟨-, h₁'⟩, -, h₂'⟩ + have : z ∈ A ∩ B := ⟨h₁', h₂'⟩ + rwa [hint] at this + · rintro (rfl | h) + · exact ⟨⟨hx, hxA⟩, hx, hxB⟩ + · rw [mem_singleton_iff.1 h] + exact ⟨⟨hy, hyA⟩, hy, hyB⟩ + have := ncard_union_add_ncard_inter (N ∩ A) (N ∩ B) (hN.subset inter_subset_left) + (hN.subset inter_subset_left) + rw [hu, hi, ncard_pair hxy] at this + omega + rw [hA'] + refine ⟨f₁.union f₂, ?_, ?_⟩ + · rw [ncard_union_eq hdisj f₁ f₂] + omega + · have conv : ∀ {W e : Set T}, IsMarkedArc (N ∩ W) e → e ∈ arcComponentsIn (W \ N) → IsClosed W + → W ⊆ F → IsMarkedArc N e ∧ e ⊆ F := by + rintro W e ⟨u, v, huv, hs, hl⟩ he hW hWL + have hclo : closure e ⊆ W := closure_minimal (fun z hz ↦ (he.2.1 hz).1) hW + refine ⟨⟨u, v, huv, ?_, hl⟩, (subset_closure.trans hclo).trans hWL⟩ + rw [← hs] + ext z + exact ⟨fun h ↦ ⟨h.1, h.2, hclo h.1⟩, fun h ↦ ⟨h.1, h.2.1⟩⟩ + rintro e (he | he) + · exact conv (s₁ e he).1 he hcA (hun ▸ subset_union_left) + · exact conv (s₂ e he).1 he hcB (hun ▸ subset_union_right) + +omit [T2Space T] in +/-- A finite set does not cut points off a line. -/ +theorem line_subset_closure_sdiff {L N : Set T} {a b : T} (hl : IsLineWithEnds L a b) + (hN : N.Finite) : L ⊆ closure (L \ N) := by + obtain ⟨f, -, -⟩ := hl + let g : unitInterval → T := fun t ↦ (f t).1 + have hg : Continuous g := continuous_subtype_val.comp f.continuous + have hginj : Function.Injective g := fun u v h ↦ f.injective (Subtype.ext h) + have hd : Dense (g ⁻¹' N)ᶜ := by + have := (dense_univ (X := unitInterval)).sdiff_finite (hN.preimage hginj.injOn) + rwa [compl_eq_univ_sdiff] + intro x hx + have hmem : (f.symm ⟨x, hx⟩) ∈ closure (g ⁻¹' N)ᶜ := hd _ + have := image_closure_subset_closure_image hg (mem_image_of_mem g hmem) + have hgx : g (f.symm ⟨x, hx⟩) = x := by simp [g] + rw [hgx] at this + refine closure_mono ?_ this + rintro _ ⟨t, ht, rfl⟩ + exact ⟨(f t).2, ht⟩ + +/-- A finite set does not cut points off an `O`-arc with two points. -/ +theorem oArc_subset_closure_sdiff {F N : Set T} (hF : IsOArc F) {x y : T} (hx : x ∈ F) (hy : y ∈ F) + (hxy : x ≠ y) (hN : N.Finite) : + F ⊆ closure (F \ N) := by + obtain ⟨A, B, hA, hB, hun, -⟩ := hF.lines hx hy hxy + rw [← hun] + refine union_subset ((line_subset_closure_sdiff hA hN).trans (closure_mono ?_)) + ((line_subset_closure_sdiff hB hN).trans (closure_mono ?_)) + · exact sdiff_subset_sdiff_left subset_union_left + · exact sdiff_subset_sdiff_left subset_union_right + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Main.lean b/LeanPool/GraphMinor/GM19/Main.lean new file mode 100644 index 0000000000..5fa9eafa0f --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Main.lean @@ -0,0 +1,33 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Conditional +public import LeanPool.GraphMinor.GM20.Cited +import LeanPool.GraphMinor.GM19.ThinningProved +import LeanPool.GraphMinor.GM19.Section15b + +/-! +# The main theorem of Graph Minors XIX + +The proofs of the feature, inflation, wheel, and linkage steps supply (4.1). +The topology and thinning proofs then give (2.1), in the form used by XX. +-/ + +public section +namespace GraphMinor.GM19 +universe u w + +/-- Graph Minors XIX, (4.1), with its preceding deductions supplied by their proofs. -/ +theorem theorem_4_1_main : Theorem41Statement.{u, w} := theorem_4_1_proof + +/-- The main theorem of Graph Minors XIX, (2.1), in the form used by XX. -/ +theorem gm19_main : GM20.GM19Theorem21Statement.{w} := gm19Theorem21' + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/MarkedMatch.lean b/LeanPool/GraphMinor/GM19/MarkedMatch.lean new file mode 100644 index 0000000000..8b1a34c2a3 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/MarkedMatch.lean @@ -0,0 +1,496 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.OrientOfHomeos +public import LeanPool.GraphMinor.GM19.FeatureOrient + +/-! +# Matching marked discs + +We prove the homeomorphism of step (2) of the proof of Graph Minors XIX, (15.2), page 381. On a +closed connected surface, let two families of +disjoint closed discs be given, each disc with a parametrized boundary. There is a homeomorphism +that carries each disc to its partner and +each parametrization to its partner, if the surface is not orientable, or if some orientation agrees +with the parametrizations on each pair +of discs (`exists_marked_match`). + +A homeomorphism `e` matching one disc induces a map `τ` of the circle. If `τ` keeps the direction of +the circle, then a twist in a collar +finishes (`exists_boundary_twist`). If it reverses the direction, then there are two cases. A +homeomorphism that fixes a disc keeps each +orientation, so this does not happen when the parametrizations agree with an orientation. On a +surface that is not orientable, +`orientable_of_no_reversal` gives a homeomorphism that fixes the matched discs and reverses this +one. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Metric Topology Filter GraphMinor.Surface + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +/-- `p` parametrizes the boundary of `D`. -/ +def IsBdParam (D : Set T) (p : Circle → T) : Prop := + Continuous p ∧ Function.Injective p ∧ range p = discBd D + +theorem IsBdParam.exists_homeo {D : Set T} {p : Circle → T} (h : IsBdParam D p) : ∃ ψ : Circle ≃ₜ + discBd D, ∀ w, (ψ w).1 = p w := by + obtain ⟨hc, hi, hr⟩ := h + let f : Circle → discBd D := fun w => ⟨p w, by rw [← hr]; exact mem_range_self w⟩ + have hfb : Function.Bijective f := ⟨fun a b h => hi (congrArg Subtype.val h), fun x => by + obtain ⟨w, hw⟩ : x.1 ∈ range p := by rw [hr]; exact x.2 + exact ⟨w, Subtype.ext hw⟩⟩ + have hfc : Continuous f := hc.subtype_mk _ + exact ⟨hfc.homeoOfEquivCompactToT2 (f := Equiv.ofBijective f hfb), fun w => rfl⟩ + +omit [T2Space T] in +theorem image_disc (e : T ≃ₜ T) {D : Set T} (hD : IsClosedDisc D) : IsClosedDisc (e '' D) ∧ discBd + (e '' D) = e '' discBd D := + hD.image e.continuous.continuousOn e.symm.continuous.continuousOn fun _ _ => e.symm_apply_apply _ + +omit [T2Space T] in +theorem IsBdParam.image {D : Set T} {p : Circle → T} (h : IsBdParam D p) (e : T ≃ₜ T) + (hD : IsClosedDisc D) : IsBdParam (e '' D) fun w => e (p w) := by + refine ⟨e.continuous.comp h.1, fun a b he => h.2.1 (e.injective he), ?_⟩ + have : (fun w => e (p w)) = e ∘ p := rfl + rw [this, range_comp, h.2.2, (image_disc e hD).2] + +/-- A homeomorphism carrying `D` onto `D'` induces a map of the circle between parametrizations. -/ +theorem exists_circle_transfer {D D' : Set T} {p p' : Circle → T} (hp : IsBdParam D p) + (hp' : IsBdParam D' p') (e : T ≃ₜ T) (hD : IsClosedDisc D) (he : e '' D = D') : + ∃ τ : Circle ≃ₜ Circle, ∀ w, p' (τ w) = e (p w) := by + obtain ⟨ψ', hψ'⟩ := hp'.exists_homeo + have hbd : discBd D' = e '' discBd D := by rw [← he]; exact (image_disc e hD).2 + have hmem : ∀ w, e (p w) ∈ discBd D' := fun w => by + rw [hbd, ← hp.2.2] + exact mem_image_of_mem e (mem_range_self w) + let f : Circle → Circle := fun w => ψ'.symm ⟨e (p w), hmem w⟩ + have hspec : ∀ w, p' (f w) = e (p w) := fun w => by + rw [← hψ', Homeomorph.apply_symm_apply] + have hfc : Continuous f := ψ'.symm.continuous.comp ((e.continuous.comp hp.1).subtype_mk _) + have hfi : Function.Injective f := fun a b h => hp.2.1 (e.injective (by rw [← hspec, ← hspec, h])) + have hfs : Function.Surjective f := fun x => by + have h1 : p' x ∈ discBd D' := by rw [← hp'.2.2]; exact mem_range_self x + rw [hbd, ← hp.2.2] at h1 + obtain ⟨_, ⟨w, rfl⟩, hw⟩ := h1 + exact ⟨w, hp'.2.1 (by rw [hspec, hw])⟩ + exact ⟨hfc.homeoOfEquivCompactToT2 (f := Equiv.ofBijective f ⟨hfi, hfs⟩), hspec⟩ + +omit [T2Space T] in +/-- A closed disc has three distinct boundary points. -/ +theorem exists_three_bd {D : Set T} {p : Circle → T} (hp : IsBdParam D p) : ∃ a ∈ discBd D, ∃ b ∈ + discBd D, ∃ c ∈ discBd D, a ≠ b ∧ b ≠ c ∧ a ≠ c := by + have hm : ∀ w, p w ∈ discBd D := fun w => by rw [← hp.2.2]; exact mem_range_self w + have hpi := Real.pi_gt_three + have h1 : Circle.exp 0 ≠ Circle.exp 1 := circle_exp_ne (by norm_num) (by rw [abs_lt]; constructor + <;> linarith) + have h2 : Circle.exp 1 ≠ Circle.exp 2 := circle_exp_ne (by norm_num) (by rw [abs_lt]; constructor + <;> linarith) + have h3 : Circle.exp 0 ≠ Circle.exp 2 := circle_exp_ne (by norm_num) (by rw [abs_lt]; constructor + <;> linarith) + exact ⟨_, hm _, _, hm _, _, hm _, fun h => h1 (hp.2.1 h), fun h => h2 (hp.2.1 h), + fun h => h3 (hp.2.1 h)⟩ + +omit [T2Space T] in +/-- A homeomorphism that fixes a closed disc keeps each orientation. -/ +theorem preserved_of_fix (hT : IsClosedSurface T) [ConnectedSpace T] (ω : SurfaceOrientation T) + (e : T ≃ₜ T) {Q : Set T} (hQ : IsClosedDisc Q) (hfix : ∀ z ∈ Q, e z = z) : ω.IsPreservedBy e := by + have hS : IsSurface T := ⟨hT.1, hT.2.1, fun x => (hT.2.2 x).isManifoldPoint⟩ + rcases homeo_orientation hS e with h | h + · exact h ω + exfalso + obtain ⟨a, ha, b, hb, c, hc, hab, hbc, hac⟩ : ∃ a ∈ discBd Q, ∃ b ∈ discBd Q, ∃ c ∈ discBd Q, a ≠ + b ∧ b ≠ c ∧ a ≠ c := by + obtain ⟨ψ⟩ := hQ.isOArc_discBd + exact exists_three_bd (p := fun w => (ψ w).1) ⟨continuous_subtype_val.comp ψ.continuous, + fun a b h => ψ.injective (Subtype.ext h), by + ext y + exact ⟨fun ⟨w, hw⟩ => hw ▸ (ψ w).2, fun hy => ⟨ψ.symm ⟨y, hy⟩, by simp⟩⟩⟩ + have himg : e '' Q = Q := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + rw [hfix z hz]; exact hz + · exact fun hx => ⟨x, hx, hfix x hx⟩ + have := h ω Q hQ a b c ha hb hc hab hbc hac + rw [himg, hfix a (discBd_subset _ ha), hfix b (discBd_subset _ hb), + hfix c (discBd_subset _ hc)] at this + exact iff_not_self this + +/-- A strictly increasing angle finishes the match of one disc: a twist in a collar corrects the +boundary. -/ +theorem finish_match (hT : IsClosedSurface T) {ι : Type} [Finite ι] {P : ι → Set T} + (hP : ∀ i, IsClosedDisc (P i)) {A' : Set T} (hA' : IsClosedDisc A') + (hAP' : Disjoint A' (⋃ i, P i)) {p' : Circle → T} (hp' : IsBdParam A' p') {τ : Circle ≃ₜ + Circle} (hτ : PreservesCircleOrientation τ) : + ∃ e : T ≃ₜ T, e '' A' = A' ∧ (∀ i, ∀ z ∈ P i, e z = z) ∧ ∀ w, e (p' (τ w)) = p' w := by + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + have hBc : IsClosed (⋃ i, P i) := isClosed_iUnion_of_finite fun i => (hP i).isClosed + obtain ⟨E, hE, hsub, hEP⟩ := GM12.exists_disc_enlargement_avoiding hT hA' hBc hAP' + obtain ⟨ψ, hψ⟩ := hp'.exists_homeo + obtain ⟨e, he, htw, hfix⟩ := exists_boundary_twist hman hA' hE hsub ψ (preserves_symm hτ) + refine ⟨e, he, fun i z hz => hfix z fun hzE => Set.disjoint_left.mp hEP hzE (mem_iUnion.mpr ⟨i, + hz⟩), fun w => ?_⟩ + have := htw (τ w) + rw [hψ, hψ, Homeomorph.symm_apply_apply] at this + exact this + +/-- **One marked disc.** A homeomorphism fixing the protected discs carries `(A, p)` to `(A', p')`, +if the surface is not orientable, or if an +orientation agrees with `p` and `p'`. -/ +theorem exists_param_match [ConnectedSpace T] (hT : IsClosedSurface T) {ι : Type} [Finite ι] {P : ι + → Set T} (hP : ∀ i, IsClosedDisc (P i)) (hPP : Pairwise fun i j => Disjoint (P i) (P j)) + {A A' : Set T} (hA : IsClosedDisc A) (hA' : IsClosedDisc A') (hAP : Disjoint A (⋃ i, P i)) + (hAP' : Disjoint A' (⋃ i, P i)) {p p' : Circle → T} (hp : IsBdParam A p) + (hp' : IsBdParam A' p') + (H : ¬ IsOrientableSurface T ∨ ∃ (_ : ι) (ω : SurfaceOrientation T), ∀ a b c, a ≠ b → b ≠ c + → a ≠ c → (ω.pos A (p a) (p b) (p c) ↔ ω.pos A' (p' a) (p' b) (p' c))) : + ∃ e : T ≃ₜ T, e '' A = A' ∧ (∀ i, ∀ z ∈ P i, e z = z) ∧ ∀ w, e (p w) = p' w := by + obtain ⟨e₀, he₀, hfix₀⟩ := exists_disc_match hT P hP hPP hA hA' hAP hAP' + obtain ⟨τ, hτ⟩ := exists_circle_transfer hp hp' e₀ hA he₀ + have done : ∀ (e₁ : T ≃ₜ T) (τ₁ : Circle ≃ₜ Circle), (∀ i, ∀ z ∈ P i, e₁ z = z) → e₁ '' A = A' → + (∀ w, p' (τ₁ w) = e₁ (p w)) → PreservesCircleOrientation τ₁ → + ∃ e : T ≃ₜ T, e '' A = A' ∧ (∀ i, ∀ z ∈ P i, e z = z) ∧ ∀ w, e (p w) = p' w := by + intro e₁ τ₁ h1 h2 h3 h4 + obtain ⟨f, hf, hfix, hw⟩ := finish_match hT hP hA' hAP' hp' h4 + refine ⟨e₁.trans f, ?_, fun i z hz => ?_, fun w => ?_⟩ + · change (fun x => f (e₁ x)) '' A = A' + rw [← image_image (g := f) (f := e₁), h2, hf] + · change f (e₁ z) = z + rw [h1 i z hz, hfix i z hz] + · change f (e₁ (p w)) = p' w + rw [← h3, hw] + obtain ⟨L, hLc, hL, hl⟩ := exists_circle_lift τ + rcases hL with hL | hL + · exact done e₀ τ hfix₀ he₀ hτ ⟨L, hLc, hL, hl⟩ + rcases H with h | ⟨i₀, ω, hω⟩ + · have hex : ¬ ∀ α : T ≃ₜ T, (∀ i, ∀ z ∈ P i, α z = z) → α '' A' = A' → ∀ u v w u' v' w', + α (p' u) = p' u' → α (p' v) = p' v' → α (p' w) = p' w' → + CircleCyclic u v w → CircleCyclic u' v' w' := + fun hno => h (orientable_of_no_reversal hT hP hPP hA' hAP' hp'.1 hp'.2.1 hp'.2.2 hno) + push Not at hex + obtain ⟨α, hαf, hαi, u, v, w, u', v', w', hu, hv, hw, hc, hnc⟩ := hex + obtain ⟨σ, hσ⟩ := exists_circle_transfer hp' hp' α hA' hαi + obtain ⟨M, hMc, hM, hm⟩ := exists_circle_lift σ + rcases hM with hM | hM + · exfalso + have h1 := circleCyclic_map_mono hMc hM hm hc + have e1 : σ u = u' := hp'.2.1 (by rw [hσ, hu]) + have e2 : σ v = v' := hp'.2.1 (by rw [hσ, hv]) + have e3 : σ w = w' := hp'.2.1 (by rw [hσ, hw]) + rw [e1, e2, e3] at h1 + exact hnc h1 + · refine done (e₀.trans α) (τ.trans σ) (fun i z hz => ?_) ?_ (fun x => ?_) ⟨fun t => M (L t), + hMc.comp hLc, hM.comp hL, fun t => ?_⟩ + · change α (e₀ z) = z + rw [hfix₀ i z hz, hαf i z hz] + · change (fun x => α (e₀ x)) '' A = A' + rw [← image_image (g := α) (f := e₀), he₀, hαi] + · change p' (σ (τ x)) = α (e₀ (p x)) + rw [hσ, hτ] + · change σ (τ _) = _ + rw [hl, hm] + · exfalso + have hpres := preserved_of_fix hT ω e₀ (hP i₀) (hfix₀ i₀) + obtain ⟨φ, hφc, hφi, hφr, hφ⟩ := ω.isDirection A' hA' + obtain ⟨s, hs⟩ := exists_circle_transfer hp' (D' := A') ⟨hφc, hφi, hφr⟩ (Homeomorph.refl T) hA' + (image_id _) + have hs' : ∀ w, φ (s w) = p' w := hs + have hpi := Real.pi_gt_three + have hcy : CircleCyclic (Circle.exp 0) (Circle.exp 1) (Circle.exp 2) := by + refine ⟨1, 2, by norm_num, by norm_num, by linarith, ?_, ?_⟩ <;> simp + have hab : Circle.exp 0 ≠ Circle.exp 1 := circle_exp_ne (by norm_num) + (by rw [abs_lt]; constructor <;> linarith) + have hbc : Circle.exp 1 ≠ Circle.exp 2 := circle_exp_ne (by norm_num) + (by rw [abs_lt]; constructor <;> linarith) + have hac : Circle.exp 0 ≠ Circle.exp 2 := circle_exp_ne (by norm_num) + (by rw [abs_lt]; constructor <;> linarith) + generalize Circle.exp 0 = a at hcy hab hac + generalize Circle.exp 1 = b at hcy hab hbc + generalize Circle.exp 2 = c at hcy hbc hac + have hmem : ∀ w, p w ∈ discBd A := fun w => by rw [← hp.2.2]; exact mem_range_self w + have h1 := circleCyclic_map_anti hLc hL hl hcy + have h2 := hpres A hA (p a) (p b) (p c) (hmem a) (hmem b) (hmem c) (fun h => hab (hp.2.1 h)) + (fun h => hbc (hp.2.1 h)) (fun h => hac (hp.2.1 h)) + rw [he₀, ← hτ, ← hτ, ← hτ] at h2 + have h3 := h2.trans (hω a b c hab hbc hac) + simp only [← hs'] at h3 + have hsτ : ∀ {x y : Circle}, x ≠ y → s (τ x) ≠ s (τ y) := fun h he => h (τ.injective + (s.injective he)) + have hs1 : ∀ {x y : Circle}, x ≠ y → s x ≠ s y := fun h he => h (s.injective he) + rw [hφ _ _ _ (hsτ hab) (hsτ hbc) (hsτ hac), hφ _ _ _ (hs1 hab) (hs1 hbc) (hs1 hac)] at h3 + have hτ1 : ∀ {x y : Circle}, x ≠ y → τ x ≠ τ y := fun h he => h (τ.injective he) + rcases circle_map_or s with hf | hf + · have h4 := (hf _ _ _ (hτ1 hab) (hτ1 hbc) (hτ1 hac)).trans (h3.trans + (hf a b c hab hbc hac).symm) + exact not_circleCyclic_both (h4.2 hcy) h1 + · have h4 : CircleCyclic (s (τ a)) (s (τ b)) (s (τ c)) := (hf _ _ _ (hτ1 hac) (hτ1 hbc).symm + (hτ1 hab)).1 h1 + have h5 := (hf a c b hac hbc.symm hab).2 (h3.1 h4) + exact not_circleCyclic_both hcy h5 + +/-- **A family of marked discs**, with some protected discs. -/ +theorem exists_family_param_match [ConnectedSpace T] (hT : IsClosedSurface T) {κ : Type} [Finite κ] + {Q : κ → Set T} (hQ : ∀ k, IsClosedDisc (Q k)) (hQQ : Pairwise fun i j => Disjoint (Q i) + (Q j)) + {n : ℕ} {A A' : Fin n → Set T} (hA : ∀ i, IsClosedDisc (A i)) (hA' : ∀ i, IsClosedDisc (A' i)) + (hAA : Pairwise fun i j => Disjoint (A i) (A j)) (hAA' : Pairwise fun i j => Disjoint (A' i) + (A' j)) + (hAQ : ∀ i k, Disjoint (A i) (Q k)) (hAQ' : ∀ i k, Disjoint (A' i) (Q k)) {p p' : Fin n + → Circle → T} (hp : ∀ i, IsBdParam (A i) (p i)) (hp' : ∀ i, IsBdParam (A' i) (p' i)) + (H : ¬ IsOrientableSurface T ∨ ∃ (_ : κ) (ω : SurfaceOrientation T), ∀ i a b c, a ≠ b → b ≠ c + → a ≠ c → (ω.pos (A i) (p i a) (p i b) (p i c) ↔ ω.pos (A' i) (p' i a) (p' i b) (p' i c))) : + ∃ e : T ≃ₜ T, (∀ k, ∀ z ∈ Q k, e z = z) ∧ (∀ i, e '' A i = A' i) ∧ ∀ i w, e (p i w) = p' i w + := by + classical + suffices S : ∀ m ≤ n, ∃ e : T ≃ₜ T, (∀ k, ∀ z ∈ Q k, e z = z) ∧ ∀ i : Fin n, i.1 < m → e '' A i + = A' i ∧ ∀ w, e (p i w) = p' i w by + obtain ⟨e, h1, h2⟩ := S n le_rfl + exact ⟨e, h1, fun i => (h2 i i.2).1, fun i => (h2 i i.2).2⟩ + intro m + induction m with + | zero => exact fun _ => ⟨Homeomorph.refl T, fun _ _ _ => rfl, fun i h => absurd h + (Nat.not_lt_zero _)⟩ + | succ m ih => + intro hm + obtain ⟨e, h1, h2⟩ := ih (by omega) + let c : Fin n := ⟨m, by omega⟩ + let P : κ ⊕ {i : Fin n // i.1 < m} → Set T := fun x => match x with + | .inl k => Q k + | .inr i => A' i.1 + have hP : ∀ i, IsClosedDisc (P i) := by + rintro (k | i) + · exact hQ k + · exact hA' i.1 + have hPP : Pairwise fun i j => Disjoint (P i) (P j) := by + rintro (k | i) (l | j) hne + · exact hQQ fun h => hne (by rw [h]) + · exact (hAQ' j.1 k).symm + · exact hAQ' i.1 l + · exact hAA' fun h => hne (by rw [Subtype.ext h]) + have hne : ∀ i : {i : Fin n // i.1 < m}, c ≠ i.1 := fun i h => by + have := congrArg Fin.val h + have hi := i.2 + simp only [c] at this + omega + have hmA : Disjoint (e '' A c) (⋃ i, P i) := by + refine Set.disjoint_iUnion_right.mpr ?_ + rintro (k | i) + · refine Set.disjoint_left.mpr ?_ + rintro _ ⟨x, hx, rfl⟩ hy + have hx' : x ∈ Q k := by + have : x = e x := (e.injective (h1 k (e x) hy)).symm + exact this ▸ hy + exact Set.disjoint_left.mp (hAQ c k) hx hx' + · change Disjoint (e '' A c) (A' i.1) + rw [← (h2 i.1 i.2).1] + exact (Set.disjoint_image_iff e.injective).mpr (hAA (hne i)) + have hmA' : Disjoint (A' c) (⋃ i, P i) := by + refine Set.disjoint_iUnion_right.mpr ?_ + rintro (k | i) + · exact hAQ' c k + · exact hAA' (hne i) + have hH : ¬ IsOrientableSurface T ∨ ∃ (_ : κ ⊕ {i : Fin n // i.1 < m}) + (ω : SurfaceOrientation T), ∀ a b c', a ≠ b → b ≠ c' → a ≠ c' → + (ω.pos (e '' A c) (e (p c a)) (e (p c b)) (e (p c c')) ↔ ω.pos (A' c) (p' c a) (p' c b) + (p' c c')) := by + rcases H with h | ⟨k, ω, hω⟩ + · exact Or.inl h + · refine Or.inr ⟨.inl k, ω, fun a b c' hab hbc hac => + ?_⟩ + have hpres := preserved_of_fix hT ω e (hQ k) (h1 k) + have hmem : ∀ w, p c w ∈ discBd (A c) := by + intro w + rw [← (hp c).2.2] + exact mem_range_self w + exact (hpres _ (hA c) _ _ _ (hmem a) (hmem b) (hmem c') (fun h => hab ((hp c).2.1 h)) + (fun h => hbc ((hp c).2.1 h)) (fun h => hac ((hp c).2.1 h))).trans + (hω c a b c' hab hbc hac) + obtain ⟨f, hf, hfix, hfw⟩ := exists_param_match hT hP hPP (image_disc e (hA c)).1 + (hA' c) hmA hmA' ((hp c).image e (hA c)) (hp' c) hH + have hQf : ∀ k, ∀ z ∈ Q k, f z = z := fun k => hfix (.inl k) + have hAf : ∀ i : {i : Fin n // i.1 < m}, ∀ z ∈ A' i.1, f z = z := fun i => hfix (.inr i) + refine ⟨e.trans f, fun k z hz => ?_, fun i hi => ?_⟩ + · change f (e z) = z + rw [h1 k z hz, hQf k z hz] + by_cases him : i.1 < m + · obtain ⟨h3, h4⟩ := h2 i him + constructor + · change (fun x => f (e x)) '' A i = _ + rw [← image_image (g := f) (f := e), h3] + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + rw [hAf ⟨i, him⟩ y hy] + exact hy + · exact fun hx => ⟨x, hx, hAf ⟨i, him⟩ x hx⟩ + · intro w + change f (e (p i w)) = _ + rw [h4, hAf ⟨i, him⟩] + exact discBd_subset _ (by rw [← (hp' i).2.2]; exact mem_range_self w) + · have hic : i = c := Fin.ext (by simp only [c]; omega) + subst hic + constructor + · change (fun x => f (e x)) '' A _ = _ + rw [← image_image (g := f) (f := e), hf] + · exact fun w => hfw w + +/-- Finitely many disjoint closed discs do not cover a closed connected surface. -/ +theorem nonempty_compl_iUnion [ConnectedSpace T] (hT : IsClosedSurface T) {ι : Type*} [Finite ι] {D + : ι → Set T} (hD : ∀ i, IsClosedDisc (D i)) (hdd : Pairwise fun i j => Disjoint (D i) (D j)) : + (⋃ i, D i)ᶜ.Nonempty := by + classical + by_contra hn + rw [not_nonempty_iff_eq_empty, compl_empty_iff] at hn + obtain ⟨x⟩ : Nonempty T := inferInstance + obtain ⟨i, hi⟩ := mem_iUnion.mp (hn ▸ mem_univ x) + have hop : IsOpen (D i) := by + have : D i = (⋃ j : {j // j ≠ i}, D j.1)ᶜ := by + ext y + constructor + · intro hy hu + obtain ⟨j, hj⟩ := mem_iUnion.mp hu + exact Set.disjoint_left.mp (hdd j.2.symm) hy hj + · intro hy + obtain ⟨j, hj⟩ := mem_iUnion.mp (hn ▸ mem_univ y) + by_cases hji : j = i + · exact hji ▸ hj + · exact absurd (mem_iUnion.mpr ⟨⟨j, hji⟩, hj⟩) hy + rw [this] + exact (isClosed_iUnion_of_finite fun j : {j // j ≠ i} => (hD j.1).isClosed).isOpen_compl + have := IsClopen.eq_univ ⟨(hD i).isClosed, hop⟩ ⟨x, hi⟩ + obtain ⟨y, hy⟩ := nonempty_compl_disc hT (hD i) + exact hy (this ▸ mem_univ y) + +/-- An open set that is not empty holds any number of disjoint closed discs. -/ +theorem exists_disc_family_in (hT : IsClosedSurface T) (n : ℕ) {V : Set T} (hV : IsOpen V) + (hne : V.Nonempty) : + ∃ M : Fin n → Set T, (∀ i, IsClosedDisc (M i)) ∧ (Pairwise fun i j => Disjoint (M i) (M j)) + ∧ ∀ i, M i ⊆ V := by + induction n generalizing V with + | zero => exact ⟨fun i => i.elim0, fun i => i.elim0, fun i => i.elim0, fun i => i.elim0⟩ + | succ n ih => + obtain ⟨y, hy⟩ := hne + obtain ⟨E, hE, hs⟩ := exists_test_disc hT hV ⟨y, hy⟩ (B := {y}) (finite_singleton y) + have hyE : y ∉ E := fun h => (hs h).2 rfl + obtain ⟨M, hM, hMM, hMV⟩ := ih (hV.sdiff hE.isClosed) ⟨y, hy, hyE⟩ + refine ⟨Fin.cons E M, ?_, ?_, ?_⟩ + · intro i + refine Fin.cases ?_ (fun j => ?_) i + · simpa using hE + · simpa using hM j + · intro i j hij + induction i using Fin.cases with + | zero => + induction j using Fin.cases with + | zero => exact absurd rfl hij + | succ j => + simp only [Fin.cons_zero, Fin.cons_succ] + exact Set.disjoint_left.mpr fun x hx hx' => (hMV j hx').2 hx + | succ i => + induction j using Fin.cases with + | zero => + simp only [Fin.cons_zero, Fin.cons_succ] + exact Set.disjoint_right.mpr fun x hx hx' => (hMV i hx').2 hx + | succ j => + simp only [Fin.cons_succ] + exact hMM fun h => hij (by rw [h]) + · intro i + refine Fin.cases ?_ (fun j => ?_) i + · simp only [Fin.cons_zero] + exact fun x hx => (hs hx).1 + · simp only [Fin.cons_succ] + exact fun x hx => (hMV j hx).1 + +/-- **Step (2) of the proof of Graph Minors XIX, (15.2)**, page 381. On a closed connected surface a +homeomorphism carries a family of +disjoint marked discs to another such family, with the same index, if the surface is not orientable, +or if an orientation agrees with the +parametrizations on each pair of discs. -/ +theorem exists_marked_match [ConnectedSpace T] (hT : IsClosedSurface T) {n : ℕ} {A A' : Fin n + → Set T} (hA : ∀ i, IsClosedDisc (A i)) (hA' : ∀ i, IsClosedDisc (A' + i)) + (hAA : Pairwise fun i j => Disjoint (A i) (A j)) (hAA' : Pairwise fun i j => Disjoint (A' i) + (A' j)) {p p' : Fin n → Circle → T} (hp : ∀ i, IsBdParam (A i) (p i)) (hp' : ∀ i, IsBdParam + (A' i) (p' i)) + (H : ¬ IsOrientableSurface T ∨ ∃ ω : SurfaceOrientation T, ∀ i a b c, a ≠ b → b ≠ c → a ≠ c → + (ω.pos (A i) (p i a) (p i b) (p i c) ↔ ω.pos (A' i) (p' i a) (p' i b) (p' i c))) : + ∃ e : T ≃ₜ T, (∀ i, e '' A i = A' i) ∧ ∀ i w, e (p i w) = p' i w := by + have hc₀ : IsClosed (⋃ i, A i) := isClosed_iUnion_of_finite fun i => (hA i).isClosed + have hc₁ : IsClosed (⋃ i, A' i) := isClosed_iUnion_of_finite fun i => (hA' i).isClosed + obtain ⟨y, hy⟩ := nonempty_compl_iUnion hT hA hAA + obtain ⟨Q₁, hQ₁, hs₁⟩ := exists_test_disc hT hc₁.isOpen_compl (nonempty_compl_iUnion hT hA' hAA') + (B := {y}) (finite_singleton y) + have hyQ : y ∉ Q₁ := fun h => (hs₁ h).2 rfl + obtain ⟨Q₀, hQ₀, -, hs₀⟩ := exists_small_disc (hT.2.2 y) (hc₀.isOpen_compl.sdiff hQ₁.isClosed) + ⟨hy, hyQ⟩ + have hQ01 : Disjoint Q₀ Q₁ := Set.disjoint_left.mpr fun x hx hx' => + (hs₀ hx).2 hx' + have hne : ((Q₀ ∪ Q₁)ᶜ).Nonempty := by + have := nonempty_compl_iUnion hT (D := fun b : Bool => if b then Q₀ else Q₁) (fun b + => by cases b <;> simpa) + (by + rintro (_ | _) (_ | _) h + · exact absurd rfl h + · simpa using hQ01.symm + · simpa using hQ01 + · exact absurd rfl h) + obtain ⟨z, hz⟩ := this + refine ⟨z, fun hu => hz ?_⟩ + rcases hu with hu | hu + · exact mem_iUnion.mpr ⟨true, by simpa using hu⟩ + · exact mem_iUnion.mpr ⟨false, by simpa using hu⟩ + obtain ⟨M, hM, hMM, hMV⟩ := exists_disc_family_in hT n (hQ₀.isClosed.union + hQ₁.isClosed).isOpen_compl hne + have hAQ₀ : ∀ i (_ : Unit), Disjoint (A i) Q₀ := fun i _ => Set.disjoint_right.mpr fun x hx hx' + => (hs₀ hx).1 (mem_iUnion.mpr ⟨i, hx'⟩) + have hMQ₀ : ∀ i (_ : Unit), Disjoint (M i) Q₀ := fun i _ => Set.disjoint_left.mpr fun x hx hx' + => hMV i hx (Or.inl hx') + have hMQ₁ : ∀ i, Disjoint (M i) Q₁ := fun i => Set.disjoint_left.mpr fun x hx hx' => hMV i hx + (Or.inr hx') + obtain ⟨e₁, he₁, hfix₁⟩ := exists_disc_family_match hT (fun _ : Unit => Q₀) (fun _ => hQ₀) + (fun _ _ h => absurd rfl h) A M hA hM hAA hMM hAQ₀ hMQ₀ + have hpM : ∀ i, IsBdParam (e₁ '' A i) fun w => e₁ (p i w) := by + intro i + exact (hp i).image e₁ (hA i) + have hMM_e : ∀ i j, i ≠ j → Disjoint (e₁ '' A i) (e₁ '' A j) := by + intro i j hij + rw [he₁, he₁] + exact hMM hij + have hMQ₁_e : ∀ i, Disjoint (e₁ '' A i) Q₁ := by + intro i + rw [he₁] + exact hMQ₁ i + obtain ⟨e₂, -, he₂, hw⟩ := exists_family_param_match hT (κ := Unit) (Q := fun _ => Q₁) + (fun _ => hQ₁) (fun _ _ h => absurd rfl h) (A := fun i => e₁ '' A i) (A' := A') + (fun i => (image_disc e₁ (hA i)).1) hA' hMM_e hAA' (fun i _ => hMQ₁_e i) + (fun i _ => Set.disjoint_left.mpr fun x hx hx' => (hs₁ hx').1 (mem_iUnion.mpr ⟨i, hx⟩)) hpM hp' + (by + rcases H with h | ⟨ω, hω⟩ + · exact Or.inl h + · refine Or.inr ⟨(), ω, fun i a b c hab hbc hac => + ?_⟩ + have hpres := preserved_of_fix hT ω e₁ hQ₀ (hfix₁ ()) + have hmem : ∀ w, p i w ∈ discBd (A i) := by + intro w + rw [← (hp i).2.2] + exact mem_range_self w + exact (hpres _ (hA i) _ _ _ (hmem a) (hmem b) (hmem c) (fun h => hab ((hp i).2.1 h)) (fun h + => hbc ((hp i).2.1 h)) (fun h => hac ((hp i).2.1 h))).trans (hω i a b c hab hbc hac)) + refine ⟨e₁.trans e₂, fun i => ?_, hw⟩ + change (fun x => e₂ (e₁ x)) '' A i = _ + rw [← image_image (g := e₂) (f := e₁)] + exact he₂ i + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/OrientOfHomeos.lean b/LeanPool/GraphMinor/GM19/OrientOfHomeos.lean new file mode 100644 index 0000000000..863592c243 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/OrientOfHomeos.lean @@ -0,0 +1,332 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.PlaneOrientation +public import LeanPool.GraphMinor.GM19.FragmentOrient +public import LeanPool.GraphMinor.GM19.FragmentCapping +public import LeanPool.GraphMinor.Surface.DiscMatch +public import LeanPool.GraphMinor.Surface.RemoveDiscs + +/-! +# An orientation from the homeomorphisms of a surface + +Let `T` be a closed connected surface, with a family of disjoint closed discs and one more disc `A₀` +off them. We show that if no +homeomorphism fixing the family reverses `A₀`, then `T` is orientable (`orientable_of_no_reversal`). +So on a surface that is not +orientable some homeomorphism fixing the family reverses `A₀`. This proves the sentence in step (2) +of the proof of Graph Minors XIX, (15.2), page 382: +"Since $\Sigma_\chi$ is connected, there is, for each internal $e \in E(\Gamma_0)$ with $|\tilde{e}| += 3$, a $\Phi_\chi$-preserving homeomorphism $\alpha_e \colon \Sigma_\chi \to \Sigma_\chi$ which +maps $\beta(e)$ onto itself with reversed orientation, and fixes $bd(\Sigma)$ and every $\beta(f)$ +($f \in E(\Gamma_0)\setminus \{e\}$) pointwise." + +The direction of a disc `Δ` off the family is read from `A₀` through any homeomorphism fixing the +family and sending `A₀` to `Δ`. No choice +matters, since no homeomorphism reverses `A₀`. Nested discs agree: a disc `F` around them lies in a +chart, so it is oriented by +`planeOrientation`, a homeomorphism supported inside `F` keeps this orientation by `sameOn_const`, +and the discs are images of one +small disc under such homeomorphisms. + +This orients the surface made by removing the open discs, and the closed surface `T` caps it. So +`isOrientable_of_inside` orients `T`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Metric Topology Filter GraphMinor.Surface + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +omit [T2Space T] in +/-- A closed disc has an orientation on its subdiscs, from a chart. -/ +theorem exists_local_orientation {F : Set T} (hF : IsClosedDisc F) : ∃ pos : Set T → T → T → T + → Prop, IsPartialOrientation {Δ | Δ ⊆ F} pos := by + obtain ⟨h, g, c⟩ := hF.exists_isChart + refine ⟨pullPos h planeOrientation.pos, (planeOrientation.isPartial univ).pull fun Δ hΔ + => ⟨c.hc.mono hΔ, ?_, mem_univ _⟩⟩ + exact (c.gh.injOn).mono hΔ + +omit [T2Space T] in +theorem isPreconnected_discInt {F : Set T} (hF : IsClosedDisc F) : IsPreconnected (discInt F) := by + obtain ⟨h, g, c⟩ := hF.exists_isChart + rw [c.discInt_eq] + exact (convex_ball (0 : ℂ) 1).isPreconnected.image g (c.gc.mono ball_subset_closedBall) + +/-- A homeomorphism supported inside a disc keeps an orientation of that disc. -/ +theorem sameOn_of_support (hT : IsClosedSurface T) {F F₁ : Set T} (hF : IsClosedDisc F) + (hF₁ : IsClosedDisc F₁) (hsub : F₁ ⊆ discInt F) {pos : Set T → T → T → T → Prop} + (hpos : IsPartialOrientation {Δ | Δ ⊆ discInt F} pos) (e : T ≃ₜ T) (he : ∀ x, x ∉ F₁ → e x + = x) {D : Set T} (hD : IsClosedDisc D) (hDF : D ⊆ discInt F) : + SameOn (pullPos e pos) pos D := by + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + have hin : ∀ {x}, x ∈ F₁ → e x ∈ F₁ := fun {x} hx => by + by_contra hn + have h1 := he _ hn + have h2 := e.injective h1 + exact hn (by rw [h2]; exact hx) + have hmaps : MapsTo e (discInt F) (discInt F) := fun x hx => by + by_cases h : x ∈ F₁ + · exact hsub (hin h) + · rw [he x h]; exact hx + have hP' : IsPartialOrientation {Δ | Δ ⊆ discInt F} (pullPos e pos) := + hpos.pull fun Δ hΔ => ⟨e.continuous.continuousOn, e.injective.injOn, by + rintro _ ⟨x, hx, rfl⟩ + exact hmaps (hΔ hx)⟩ + have hO : IsOpen (discInt F) := hF.isOpen_discInt hman + have hopen : IsOpen (discInt F \ F₁) := hO.sdiff hF₁.isClosed + obtain ⟨h, g, c⟩ := hF.exists_isChart + have hne : (discInt F \ F₁).Nonempty := by + by_contra hn + rw [not_nonempty_iff_eq_empty, sdiff_eq_empty] at hn + have h1 : F ⊆ F₁ := by + have := closure_mono hn + rw [hF₁.isClosed.closure_eq] at this + exact hF.subset_closure_discInt.trans this + obtain ⟨y, hy⟩ := (IsOArc.isConnected' hF.isOArc_discBd).nonempty + exact (hsub (h1 (discBd_subset _ hy))).2 hy + obtain ⟨y, hy⟩ := hne + obtain ⟨E, hE, -, hEs⟩ := exists_small_disc (hT.2.2 y) hopen hy + have hEsame : SameOn (pullPos e pos) pos E := by + intro a b c ha hb hc _ _ _ + have hfix : ∀ {x}, x ∈ E → e x = x := fun hx => he _ (hEs hx).2 + have himg : e '' E = E := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + rw [hfix hz]; exact hz + · exact fun hx => ⟨x, hx, hfix hx⟩ + change pos (e '' E) (e a) (e b) (e c) ↔ _ + rw [himg, hfix (discBd_subset _ ha), hfix (discBd_subset _ hb), hfix (discBd_subset _ hc)] + exact (sameOn_const hman hO (isPreconnected_discInt hF) (fun x _ => hT.2.2 x) hP' hpos hE hD + (hEs.trans sdiff_subset) hDF).1 hEsame + +section Capping + +variable [ConnectedSpace T] {ι : Type} [Finite ι] {P : ι → Set T} + +/-- A closed surface caps the surface made by removing disjoint open discs. -/ +theorem nonempty_capped_of_removal (hT : IsClosedSurface T) (hP : ∀ i, IsClosedDisc (P i)) + (hd : Pairwise fun i j => Disjoint (P i) (P j)) : + Nonempty (IsCappedSurface ↥(⋃ i, discInt (P i))ᶜ T) := by + classical + have hS : IsSurface T := ⟨hT.1, hT.2.1, fun x => (hT.2.2 x).isManifoldPoint⟩ + obtain ⟨hc, hW, hbd, hconn, hcuffs⟩ := remove_discs hS hT.2.2 hP hd + have hclo : ∀ i, closure (discInt (P i)) = P i := fun i => + Subset.antisymm (closure_minimal (discInt_subset _) (hP i).isClosed) + (hP i).subset_closure_discInt + have hbW : ∀ i, discBd (P i) ⊆ (⋃ i, discInt (P i))ᶜ := fun i x hx hu => by + obtain ⟨j, hj⟩ := mem_iUnion.mp hu + by_cases hij : i = j + · subst hij + exact hj.2 hx + · exact Set.disjoint_left.mp (hd hij) (discBd_subset _ hx) hj.1 + have hinj : ∀ {i j}, (Subtype.val ⁻¹' discBd (P i) : Set ↥(⋃ i, discInt (P i))ᶜ) + = Subtype.val ⁻¹' discBd (P j) → i = j := by + intro i j he + by_contra hij + obtain ⟨y, hy⟩ := (IsOArc.isConnected' (hP i).isOArc_discBd).nonempty + have h1 : (⟨y, hbW i hy⟩ : ↥(⋃ i, discInt (P i))ᶜ) ∈ (Subtype.val ⁻¹' discBd + (P j) : Set ↥(⋃ i, discInt (P i))ᶜ) := by + rw [← he]; exact hy + exact Set.disjoint_left.mp (hd hij) (discBd_subset _ hy) (discBd_subset _ h1) + let cd : Set ↥(⋃ i, discInt (P i))ᶜ → Set T := fun Θ => {x | ∃ i, Θ = Subtype.val ⁻¹' discBd + (P i) ∧ x ∈ discInt (P i)} + have hcd : ∀ i, cd (Subtype.val ⁻¹' discBd (P i)) = discInt (P i) := fun i => by + ext x + constructor + · rintro ⟨j, he, hx⟩ + rw [hinj he]; exact hx + · exact fun hx => ⟨i, rfl, hx⟩ + refine ⟨⟨hS, inferInstance, ?_, Subtype.val, IsEmbedding.subtypeVal, cd, ?_, ?_, ?_, ?_⟩⟩ + · ext x + simp only [mem_empty_iff_false, iff_false] + exact hT.2.2 x |> fun h hb => hb h + · rintro Θ hΘ + rw [hcuffs] at hΘ + obtain ⟨i, rfl⟩ := hΘ + show IsClosedDisc (closure (cd _)) + rw [hcd, hclo] + exact hP i + · rintro Θ hΘ + rw [hcuffs] at hΘ + obtain ⟨i, rfl⟩ := hΘ + show discBd (closure (cd _)) = _ + rw [hcd, hclo, Subtype.image_preimage_coe, inter_eq_right.mpr (hbW i)] + · rintro Θ₁ hΘ₁ Θ₂ hΘ₂ hne + rw [hcuffs] at hΘ₁ hΘ₂ + obtain ⟨i, rfl⟩ := hΘ₁ + obtain ⟨j, rfl⟩ := hΘ₂ + rw [hcd, hcd, hclo, hclo] + exact hd fun h => hne (by rw [h]) + · rw [Subtype.range_coe, compl_compl] + ext x + simp only [mem_iUnion, exists_prop] + constructor + · rintro ⟨i, hx⟩ + refine ⟨_, ?_, (show x ∈ cd _ by rw [hcd]; exact hx)⟩ + rw [hcuffs] + exact ⟨i, rfl⟩ + · rintro ⟨Θ, hΘ, hx⟩ + rw [hcuffs] at hΘ + obtain ⟨i, rfl⟩ := hΘ + rw [hcd] at hx + exact ⟨i, hx⟩ + +/-- An orientation of the part of `T` off disjoint closed discs orients `T`. -/ +theorem orientable_of_off_discs (hT : IsClosedSurface T) (hP : ∀ i, IsClosedDisc (P i)) + (hd : Pairwise fun i j => Disjoint (P i) (P j)) {pos : Set T → T → T → T → Prop} + (hpos : IsPartialOrientation {Δ | Δ ⊆ (⋃ i, P i)ᶜ} pos) : IsOrientableSurface T := by + classical + have hS : IsSurface T := ⟨hT.1, hT.2.1, fun x => (hT.2.2 x).isManifoldPoint⟩ + obtain ⟨hc, hW, hbd, hconn, hcuffs⟩ := remove_discs hS hT.2.2 hP hd + obtain ⟨cap⟩ := nonempty_capped_of_removal hT hP hd + have : Nonempty ↥(⋃ i, discInt (P i))ᶜ := hconn.toNonempty + obtain ⟨e, X, hX, hs, ht, -⟩ := exists_cap_chart hW cap + refine isOrientable_of_inside hT hX e hs ht (pos := pullPos Subtype.val pos) (hpos.pull fun Δ hΔ + => ⟨continuous_subtype_val.continuousOn, Subtype.val_injective.injOn, ?_⟩) + rintro _ ⟨x, hx, rfl⟩ hu + obtain ⟨i, hi⟩ := mem_iUnion.mp hu + by_cases hb : x.1 ∈ discBd (P i) + · apply hΔ hx + rw [hbd] + exact mem_iUnion.mpr ⟨i, hb⟩ + · exact x.2 (mem_iUnion.mpr ⟨i, hi, hb⟩) + +end Capping + +section Reading + +variable {ι : Type} [Finite ι] + +/-- The cyclic order on `bd(Δ)` read from the parametrization `p` of `bd(A₀)` through a +homeomorphism that fixes the family `P`. -/ +def homeoPos (P : ι → Set T) (A₀ : Set T) (p : Circle → T) (Δ : Set T) (a b c : T) : Prop := + ∃ e : T ≃ₜ T, (∀ i, ∀ z ∈ P i, e z = z) ∧ e '' A₀ = Δ ∧ ∃ u v w, e (p u) = a ∧ e (p v) = b ∧ e + (p w) = c ∧ CircleCyclic u v w + +omit [T2Space T] [Finite ι] in +theorem homeoPos.map {P : ι → Set T} {A₀ : Set T} {p : Circle → T} {Δ : Set T} {a b c : T} + (h : homeoPos P A₀ p Δ a b c) (f : T ≃ₜ T) (hf : ∀ i, ∀ z ∈ P i, f z = z) : + homeoPos P A₀ p (f '' Δ) (f a) (f b) (f c) := by + obtain ⟨e, he, rfl, u, v, w, rfl, rfl, rfl, hc⟩ := h + refine ⟨e.trans f, fun i z hz => ?_, ?_, u, v, w, rfl, rfl, rfl, hc⟩ + · change f (e z) = z + rw [he i z hz, hf i z hz] + · exact (image_image f e A₀).symm ▸ rfl + +omit [T2Space T] [Finite ι] in +theorem homeoPos_map_iff {P : ι → Set T} {A₀ : Set T} {p : Circle → T} {Δ : Set T} {a b c : T} + (f : T ≃ₜ T) (hf : ∀ i, ∀ z ∈ P i, f z = z) : + homeoPos P A₀ p (f '' Δ) (f a) (f b) (f c) ↔ homeoPos P A₀ p Δ a b c := by + refine ⟨fun h => ?_, fun h => h.map f hf⟩ + have := h.map f.symm fun i z hz => by + rw [Homeomorph.symm_apply_eq, hf i z hz] + simpa [image_image] using this + +/-- **No reversal gives an orientation.** Let `A₀` be a closed disc off the disjoint closed discs `P +i`, and let `p` parametrize its boundary. +If each homeomorphism that fixes every `P i` pointwise and maps `A₀` onto itself keeps the cyclic +order of `p`, then `T` is orientable. -/ +theorem orientable_of_no_reversal [ConnectedSpace T] (hT : IsClosedSurface T) {P : ι → Set T} + (hP : ∀ i, IsClosedDisc (P i)) (hd : Pairwise fun i j => Disjoint (P i) (P j)) {A₀ : Set T} + (hA : IsClosedDisc A₀) (hAP : Disjoint A₀ (⋃ i, P i)) {p : Circle → T} (hpc : Continuous p) + (hpi : Function.Injective p) (hpr : range p = discBd A₀) + (hno : ∀ α : T ≃ₜ T, (∀ i, ∀ z ∈ P i, α z = z) → α '' A₀ = A₀ → ∀ u v w u' v' w', α (p u) + = p u' → α (p v) = p v' → α (p w) = p w' → CircleCyclic u v w → CircleCyclic u' v' w') : + IsOrientableSurface T := by + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + have hBc : IsClosed (⋃ i, P i) := isClosed_iUnion_of_finite fun i => (hP i).isClosed + have hbdimg : ∀ (f : T ≃ₜ T) {D : Set T}, IsClosedDisc D → IsClosedDisc (f '' D) ∧ discBd + (f '' D) = f '' discBd D := fun f D hD => + hD.image f.continuous.continuousOn f.symm.continuous.continuousOn fun _ _ + => f.symm_apply_apply _ + have hdisj : ∀ {Δ : Set T}, Δ ⊆ (⋃ i, P i)ᶜ → Disjoint Δ (⋃ i, P i) := fun h + => Set.disjoint_left.mpr fun x hx hu => h hx hu + have hdir : ∀ Δ ∈ {Δ | Δ ⊆ (⋃ i, P i)ᶜ}, IsClosedDisc Δ → IsDirectionOf (discBd Δ) + (homeoPos P A₀ p Δ) := by + intro Δ hs hΔ + obtain ⟨e, he, hfix⟩ := exists_disc_match hT P hP hd hA hΔ hAP (hdisj hs) + refine ⟨fun w => e (p w), e.continuous.comp hpc, fun a b h => hpi (e.injective h), ?_, + fun a b c _ _ _ => ⟨?_, fun h => ⟨e, hfix, he, a, b, c, rfl, rfl, rfl, h⟩⟩⟩ + · have : (fun w => e (p w)) = e ∘ p := rfl + rw [this, range_comp, hpr, ← (hbdimg e hA).2, he] + · rintro ⟨e', he', himg, u, v, w, hu, hv, hw, hc⟩ + refine hno (e'.trans e.symm) (fun i z hz => ?_) ?_ u v w a b c ?_ ?_ ?_ hc + · change e.symm (e' z) = z + rw [he' i z hz, Homeomorph.symm_apply_eq, hfix i z hz] + · change (fun x => e.symm (e' x)) '' A₀ = A₀ + rw [← image_image (g := e.symm) (f := e'), himg, ← he, image_image] + simp + · change e.symm (e' (p u)) = _ + rw [hu, Homeomorph.symm_apply_apply] + · change e.symm (e' (p v)) = _ + rw [hv, Homeomorph.symm_apply_apply] + · change e.symm (e' (p w)) = _ + rw [hw, Homeomorph.symm_apply_apply] + refine orientable_of_off_discs hT hP hd (pos := homeoPos P A₀ p) ⟨hdir, ?_⟩ + intro Δ₁ h₁ Δ₂ h₂ hd₁ hd₂ hsub a b c ha hb hc hab hbc hac + obtain ⟨F₁, hF₁, hsF₁, hdF₁⟩ := GM12.exists_disc_enlargement_avoiding hT hd₂ hBc (hdisj h₂) + obtain ⟨F, hF, hsF, hdF⟩ := GM12.exists_disc_enlargement_avoiding hT hF₁ hBc hdF₁ + obtain ⟨pos, hpos⟩ := exists_local_orientation hF + have hpos' : IsPartialOrientation {Δ | Δ ⊆ discInt F} pos := hpos.mono fun Δ hs => hs.trans + (discInt_subset F) + obtain ⟨D, hD, hDin⟩ := exists_inner_disc hd₁ + have hint : discInt Δ₁ ⊆ discInt Δ₂ := discInt_mono hman hd₁ hsub + have hDF : D ⊆ discInt F := fun x hx => hsF (hsF₁ (hsub (discInt_subset _ (hDin hx)))).1 + have hin₂ : Δ₂ ⊆ discInt F := fun x hx => hsF (hsF₁ hx).1 + have hin₁ : Δ₁ ⊆ discInt F := hsub.trans hin₂ + have hF₁F : F₁ ⊆ discInt F := hsF + have key : ∀ {Δ : Set T}, IsClosedDisc Δ → Δ ⊆ F₁ \ discBd F₁ → D ⊆ Δ \ discBd Δ → Δ ⊆ discInt F + → (SameOn (homeoPos P A₀ p) pos D ↔ SameOn (homeoPos P A₀ p) pos Δ) := by + intro Δ hΔ hΔF hDΔ hΔI + obtain ⟨e, he, hfix⟩ := exists_disc_onto_nested hman hD hΔ hF₁ hDΔ hΔF + have heP : ∀ i, ∀ z ∈ P i, e z = z := fun i z hz => hfix z fun hzF + => Set.disjoint_left.mp hdF₁ hzF (mem_iUnion.mpr ⟨i, hz⟩) + have hs := sameOn_of_support hT hF hF₁ hF₁F hpos' e hfix hD hDF + have hbd : discBd Δ = e '' discBd D := by rw [← he]; exact (hbdimg e hD).2 + constructor + · intro hS x y z hx hy hz hxy hyz hxz + rw [hbd] at hx hy hz + obtain ⟨x, hx, rfl⟩ := hx + obtain ⟨y, hy, rfl⟩ := hy + obtain ⟨z, hz, rfl⟩ := hz + have hxy' : x ≠ y := fun h => hxy (by rw [h]) + have hyz' : y ≠ z := fun h => hyz (by rw [h]) + have hxz' : x ≠ z := fun h => hxz (by rw [h]) + rw [← he, homeoPos_map_iff e heP, hS x y z hx hy hz hxy' hyz' hxz'] + exact (hs x y z hx hy hz hxy' hyz' + hxz').symm + · intro hS x y z hx hy hz hxy hyz hxz + have hmem : ∀ {w}, w ∈ discBd D → e w ∈ discBd Δ := by + intro w hw + rw [hbd] + exact mem_image_of_mem e hw + rw [← homeoPos_map_iff (Δ := D) e heP, he, hS _ _ _ (hmem hx) (hmem hy) (hmem hz) (fun h + => hxy (e.injective h)) (fun h => hyz (e.injective h)) (fun h => hxz (e.injective h)), ← he] + exact hs x y z hx hy hz hxy hyz hxz + have hk₁ := key hd₁ (hsub.trans hsF₁) hDin hin₁ + have hk₂ := key hd₂ hsF₁ (hDin.trans hint) hin₂ + by_cases hs : SameOn (homeoPos P A₀ p) pos D + · exact (hk₁.1 hs a b c ha.1 hb.1 hc.1 hab hbc hac).trans ((hpos'.agree Δ₁ hin₁ Δ₂ hin₂ hd₁ hd₂ + hsub a b c ha hb hc hab hbc hac).trans + (hk₂.1 hs a b c ha.2 hb.2 hc.2 hab hbc hac).symm) + · have hs₁ := sameOn_of_notSame (hdir Δ₁ h₁ hd₁) (hpos'.dir Δ₁ hin₁ hd₁) (mt hk₁.2 hs) + have hs₂ := sameOn_of_notSame (hdir Δ₂ h₂ hd₂) (hpos'.dir Δ₂ hin₂ hd₂) (mt hk₂.2 hs) + exact (hs₁ a b c ha.1 hb.1 hc.1 hab hbc hac).trans ((hpos'.rev.agree Δ₁ hin₁ Δ₂ hin₂ hd₁ hd₂ + hsub a b c ha hb hc hab hbc hac).trans + (hs₂ a b c ha.2 hb.2 hc.2 hab hbc hac).symm) + +end Reading + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/PadData.lean b/LeanPool/GraphMinor/GM19/PadData.lean new file mode 100644 index 0000000000..89c746f1cd --- /dev/null +++ b/LeanPool/GraphMinor/GM19/PadData.lean @@ -0,0 +1,313 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.CuffOrder +public import LeanPool.GraphMinor.GM12.Section4ThinArcDisc + +/-! +# Order data of the pads of edges + +For the pad of an internal edge of `Γ₀` there are at most three ends, each with its own vertex. So +the order data are simple: we read each end at the place of its vertex (`padOrder_of_injOn`). With +two ends +there is nothing to check, and with three ends it is enough to compare one triple +(`padOrder_of_triple`). We also compare a given partial orientation with the orientation of a pad +read from its chart +(`exists_chart_sign`, `chart_cyc`), and we thicken lines into discs that meet only in given points +(`exists_thin_family`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Metric Topology GraphMinor.Surface + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +theorem isPosParam_unit : IsPosParam (closedBall 0 1) fun w : Circle => (w : ℂ) := by + have hc : Continuous fun _ : Circle => (1 : ℝ) := continuous_const + have hp : ∀ _ : Circle, (0 : ℝ) < 1 := fun _ => one_pos + have h := isPosParam_star hc hp + have hid : ∀ z, starHomeo hc hp z = z := fun z => by + rw [starHomeo_apply] + by_cases hz : z = 0 + · simp [starMap, hz] + · simp [starMap, hz] + have hS : starDisc hc hp = closedBall 0 1 := by + simp [starDisc, hid] + rw [hS] at h + simpa using h + +omit [T2Space T] in +/-- The orientation of the plane on a pad, read off the chart. -/ +theorem chart_cyc {C : Set T} {c : T → ℂ} {g : ℂ → T} (hch : IsChart C c g) {x y z : T} + (hx : x ∈ discBd C) (hy : y ∈ discBd C) (hz : z ∈ discBd C) : + pullPos c planePos C x y z ↔ CircleCyclic (toCircle (c x)) (toCircle (c y)) (toCircle (c z)) + := by + have him : c '' C = closedBall 0 1 := by + ext w + constructor + · rintro ⟨p, hp, rfl⟩ + exact hch.hm hp + · exact fun hw => ⟨g w, hch.gm hw, hch.hg hw⟩ + have hc : ∀ {p}, p ∈ discBd C → ((toCircle (c p) : Circle) : ℂ) = c p := fun {p} hp => by + have : c p ∈ sphere (0 : ℂ) 1 := by rw [← hch.bd]; exact mem_image_of_mem c hp + exact coe_toCircle (by simpa using this) + change planePos (c '' C) (c x) (c y) (c z) ↔ _ + rw [him] + have h := planePos_iff isClosedDisc_closedBall.1 isPosParam_unit (toCircle (c x)) (toCircle + (c y)) (toCircle (c z)) + simp only [hc hx, hc hy, hc hz] at h + exact h + +/-- Either a partial orientation or its reverse agrees with the chart of a pad. -/ +theorem exists_chart_sign (hT : IsClosedSurface T) {𝓖 : Set (Set T)} {ϖ₀ : Set T → T → T → T + → Prop} (hpart : IsPartialOrientation 𝓖 ϖ₀) (hh : ∀ Δ ∈ 𝓖, ∀ Δ' ⊆ Δ, Δ' ∈ 𝓖) {C : Set T} {c : T + → ℂ} {g : ℂ → T} + (hC : C ∈ 𝓖) (hd : IsClosedDisc C) (hch : IsChart C c g) : + ∃ ϖ, (ϖ = ϖ₀ ∨ ϖ = revPos ϖ₀) ∧ IsPartialOrientation 𝓖 ϖ ∧ ∀ D, IsClosedDisc D → D ⊆ C + → SameOn ϖ (pullPos c planePos) D := by + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + let 𝓙 : Set (Set T) := {D | D ⊆ C} + have hci : InjOn c C := fun x hx y hy h => by rw [← hch.gh hx, ← hch.gh hy, h] + have hJ : IsPartialOrientation 𝓙 (pullPos c planePos) := (planeOrientation.isPartial univ).pull + fun Δ hΔ => ⟨hch.hc.mono hΔ, hci.mono hΔ, mem_univ _⟩ + have hhJ : ∀ Δ ∈ 𝓙, ∀ Δ' ⊆ Δ, Δ' ∈ 𝓙 := fun Δ hΔ Δ' hs => hs.trans hΔ + have hJG : 𝓙 ⊆ 𝓖 := fun D hD => hh C hC D hD + have hd₂ := hJ.dir C (Subset.refl C) hd + obtain ⟨ϖ, h1, h2, h3⟩ : ∃ ϖ, (ϖ = ϖ₀ ∨ ϖ = revPos ϖ₀) ∧ IsPartialOrientation 𝓖 ϖ ∧ SameOn ϖ + (pullPos c planePos) C := by + by_cases hs : SameOn ϖ₀ (pullPos c planePos) C + · exact ⟨ϖ₀, Or.inl rfl, hpart, hs⟩ + · exact ⟨revPos ϖ₀, Or.inr rfl, hpart.rev, sameOn_rev_left (sameOn_of_notSame + (hpart.dir C hC hd) hd₂ hs)⟩ + exact ⟨ϖ, h1, h2, fun D hD hs => (sameOn_of_subset hman hhJ (h2.mono hJG) hJ + (Subset.refl C) hD hd hs).2 h3⟩ + +omit [T2Space T] in +/-- Order data when each end has its own vertex: each end sits at the place of its vertex. -/ +theorem padOrder_of_injOn {C : Set T} {c : T → ℂ} {g : ℂ → T} (hch : IsChart C c g) {q : Circle + → T} {Y : Set T} {φ : T → T} (hY : Y.Finite) (hsub : Y ⊆ range q) (hq : Function.Injective q) + (hφ : ∀ y ∈ Y, φ y ∈ discBd C) (hi : InjOn φ Y) (hcyc : ∀ a b d, q a ∈ Y → q b ∈ Y → q d ∈ Y + → a ≠ b → b ≠ d → a ≠ d → (CircleCyclic a b d ↔ CircleCyclic (toCircle (c (φ (q a)))) + (toCircle (c (φ (q b)))) (toCircle (c (φ (q d)))))) : + ∃ A U : T → ℝ, PadOrder q g Y φ A U := by + classical + have hc : ∀ {p}, p ∈ discBd C → ((toCircle (c p) : Circle) : ℂ) = c p := fun {p} hp => by + have : c p ∈ sphere (0 : ℂ) 1 := by rw [← hch.bd]; exact mem_image_of_mem c hp + exact coe_toCircle (by simpa using this) + have hex : ∀ y, ∃ s : ℝ, 0 ≤ s ∧ s < 1 ∧ toCircle (c (φ y)) = ee s := fun y => exists_ee _ + choose U hU0 hU1 hUe using hex + have hinj : InjOn U Y := fun x hx y hy he => by + have h1 : c (φ x) = c (φ y) := by rw [← hc (hφ x hx), ← hc (hφ y hy), hUe, hUe, he] + have h2 : φ x = φ y := by + rw [← hch.gh (Surface.discBd_subset _ (hφ x hx)), + ← hch.gh (Surface.discBd_subset _ (hφ y hy)), h1] + exact hi hx hy h2 + refine ⟨U, U, hY, hsub, fun y _ => ⟨hU0 y, (hU1 y).le⟩, fun y _ => ⟨hU0 y, (hU1 y).le⟩, + fun y hy => ?_, fun x _ y _ h => h.le, hinj, fun a b d ha hb hd hab hbd had => ?_⟩ + · rw [← hUe, hc (hφ y hy)] + exact hch.gh (Surface.discBd_subset _ (hφ y hy)) + · have hne : ∀ {p p' : Circle}, q p ∈ Y → q p' ∈ Y → p ≠ p' → U (q p) ≠ U (q p') + := fun hp hp' h he => h (hq (hinj hp hp' he)) + rw [hcyc a b d ha hb hd hab hbd had, hUe, hUe, hUe] + have hw : ∀ x y, U x < U y + 1 := fun x y => by linarith [hU1 x, hU0 y] + exact circleCyclic_ee_iff (hw _ _) (hw _ _) (hw _ _) (hw _ _) (hw _ _) (hw _ _) (hne ha hb hab) + (hne hb hd hbd) (hne ha hd had) + +theorem circleCyclic_rotate_iff {a b c : Circle} : CircleCyclic a b c ↔ CircleCyclic b c a := + ⟨CircleCyclic.rotate, fun h => h.rotate.rotate⟩ + +theorem circleCyclic_swap_iff {a b c : Circle} (hab : a ≠ b) (hbc : b ≠ c) + (hac : a ≠ c) : CircleCyclic a c b ↔ ¬ CircleCyclic a b c := + ⟨fun h h' => not_circleCyclic_both h' h, fun h => (circleCyclic_or hab hac hbc).resolve_left h⟩ + +/-- If one triple of points has the same cyclic order as another, then so does each reordering. -/ +theorem cyclic_perm {a b c a' b' c' : Circle} (h1 : a ≠ b) (h2 : b ≠ c) (h3 : a ≠ c) + (h1' : a' ≠ b') (h2' : b' ≠ c') (h3' : a' ≠ c') (h : CircleCyclic a b c ↔ CircleCyclic a' b' c') : + (CircleCyclic b c a ↔ CircleCyclic b' c' a') ∧ (CircleCyclic c a b ↔ CircleCyclic c' a' b') ∧ + (CircleCyclic a c b ↔ CircleCyclic a' c' b') ∧ (CircleCyclic c b a ↔ CircleCyclic c' b' a') ∧ + (CircleCyclic b a c ↔ CircleCyclic b' a' c') := by + have rot : ∀ {x y z x' y' z' : Circle}, (CircleCyclic x y z ↔ CircleCyclic x' y' z') → + (CircleCyclic y z x ↔ CircleCyclic y' z' x') := fun h => + circleCyclic_rotate_iff.symm.trans (h.trans circleCyclic_rotate_iff) + have r1 := rot h + have s1 : CircleCyclic a c b ↔ CircleCyclic a' c' b' := (circleCyclic_swap_iff h1 h2 h3).trans + ((not_congr h).trans (circleCyclic_swap_iff h1' h2' h3').symm) + have s2 := rot s1 + exact ⟨r1, rot r1, s1, s2, rot s2⟩ + +omit [T2Space T] in +/-- Order data for three ends with their own vertices: one triple is enough. -/ +theorem padOrder_of_triple {C : Set T} {c : T → ℂ} {g : ℂ → T} (hch : IsChart C c g) {q : Circle + → T} {φ : T → T} (hq : Function.Injective q) {a₀ a₁ a₂ : Circle} (h01 : a₀ ≠ a₁) (h12 : a₁ ≠ a₂) + (h02 : a₀ ≠ a₂) + (hφ : ∀ y ∈ ({q a₀, q a₁, q a₂} : Set T), φ y ∈ discBd C) (n01 : φ (q a₀) ≠ φ (q a₁)) (n12 : φ + (q a₁) ≠ φ (q a₂)) (n02 : φ (q a₀) ≠ φ (q a₂)) + (hbase : CircleCyclic a₀ a₁ a₂ ↔ CircleCyclic (toCircle (c (φ (q a₀)))) (toCircle (c (φ + (q a₁)))) (toCircle (c (φ (q a₂))))) : ∃ A U : T → ℝ, PadOrder q g {q a₀, q a₁, q a₂} φ A U + := by + have hne : ∀ {x y}, x ∈ ({q a₀, q a₁, q a₂} : Set T) → y ∈ ({q a₀, q a₁, q a₂} : Set T) + → φ x ≠ φ y → toCircle (c (φ x)) ≠ toCircle (c (φ y)) := fun {x y} hx hy hn he => by + have hk : ∀ {p}, p ∈ discBd C → ((toCircle (c p) : Circle) : ℂ) = c p := fun {p} hp => by + have : c p ∈ sphere (0 : ℂ) 1 := by rw [← hch.bd]; exact mem_image_of_mem c hp + exact coe_toCircle (by simpa using this) + have h1 : c (φ x) = c (φ y) := by rw [← hk (hφ x hx), ← hk (hφ y hy), he] + exact hn (by rw [← hch.gh (Surface.discBd_subset _ (hφ x hx)), + ← hch.gh (Surface.discBd_subset _ (hφ y hy)), h1]) + have m0 : q a₀ ∈ ({q a₀, q a₁, q a₂} : Set T) := by simp + have m1 : q a₁ ∈ ({q a₀, q a₁, q a₂} : Set T) := by simp + have m2 : q a₂ ∈ ({q a₀, q a₁, q a₂} : Set T) := by simp + obtain ⟨p1, p2, p3, p4, p5⟩ := cyclic_perm h01 h12 h02 (hne m0 m1 n01) (hne m1 m2 n12) + (hne m0 m2 n02) hbase + refine padOrder_of_injOn hch (toFinite _) ?_ hq hφ ?_ ?_ + · rintro _ (rfl | rfl | rfl) <;> exact mem_range_self _ + · rintro x (rfl | rfl | rfl) y (rfl | rfl | rfl) he + · rfl + · exact absurd he n01 + · exact absurd he n02 + · exact absurd he.symm n01 + · rfl + · exact absurd he n12 + · exact absurd he.symm n02 + · exact absurd he.symm n12 + · rfl + · intro a b d ha hb hd hab hbd had + have hm : ∀ {x}, q x ∈ ({q a₀, q a₁, q a₂} : Set T) → x = a₀ ∨ x = a₁ ∨ x = a₂ := fun {x} hx + => by + rcases hx with h | h | h + · exact Or.inl (hq h) + · exact Or.inr (Or.inl (hq h)) + · exact Or.inr (Or.inr (hq h)) + rcases hm ha with rfl | rfl | rfl <;> rcases hm hb with rfl | rfl | rfl <;> + rcases hm hd with rfl | rfl | rfl <;> + first + | exact absurd rfl hab + | exact absurd rfl hbd + | exact absurd rfl had + | exact hbase + | exact p1 + | exact p2 + | exact p3 + | exact p4 + | exact p5 + +omit [T2Space T] in +/-- Order data for two ends with their own vertices. -/ +theorem padOrder_of_pair {C : Set T} {c : T → ℂ} {g : ℂ → T} (hch : IsChart C c g) {q : Circle + → T} {φ : T → T} (hq : Function.Injective q) {a₀ a₁ : Circle} (hφ : ∀ y ∈ + ({q a₀, q a₁} : Set T), φ y ∈ discBd C) + (n01 : φ (q a₀) ≠ φ (q a₁)) : ∃ A U : T → ℝ, PadOrder q g {q a₀, q a₁} φ A U := by + refine padOrder_of_injOn hch (toFinite _) ?_ hq hφ ?_ ?_ + · rintro _ (rfl | rfl) <;> exact mem_range_self _ + · rintro x (rfl | rfl) y (rfl | rfl) he + · rfl + · exact absurd he n01 + · exact absurd he.symm n01 + · rfl + · intro a b d ha hb hd hab hbd had + have hm : ∀ {x}, q x ∈ ({q a₀, q a₁} : Set T) → x = a₀ ∨ x = a₁ := fun {x} hx => by + rcases hx with h | h + · exact Or.inl (hq h) + · exact Or.inr (hq h) + rcases hm ha with rfl | rfl <;> rcases hm hb with rfl | rfl <;> rcases hm hd with rfl | rfl <;> + first + | exact absurd rfl hab + | exact absurd rfl hbd + | exact absurd rfl had + +/-- **Thickening lines.** Let `Z` be closed sets that pairwise meet only in the finite set `V`. +Those that are lines, with ends `u i` and `w i` in `V` and no other point of `V`, thicken to closed +discs. The ends +stay on the boundary of the disc, and the sets still pairwise meet only in `V`. -/ +theorem exists_thin_family (hT : IsClosedSurface T) {κ : Type} [Finite κ] {Z : κ → Set T} + (hZ : ∀ i, IsClosed (Z i)) {V : Set T} (hV : IsClosed V) (hZZ : ∀ i j, i ≠ j + → Z i ∩ Z j ⊆ V) {L : Set κ} {u w : κ → T} + (hL : ∀ i ∈ L, IsLineWithEnds (Z i) (u i) (w i)) (hLV : ∀ i ∈ L, Z i ∩ V = {u i, w i}) : + ∃ Z' : κ → Set T, (∀ i, IsClosed (Z' i)) ∧ (∀ i j, i ≠ j → Z' i ∩ Z' j ⊆ V) ∧ (∀ i, i ∉ L + → Z' i = Z i) ∧ ∀ i ∈ L, IsClosedDisc (Z' i) ∧ Z' i ∩ V = {u i, w i} ∧ + ({u i, w i} : Set T) ⊆ discBd (Z' i) ∧ Z i ⊆ Z' i := by + classical + have := Fintype.ofFinite κ + suffices H : ∀ 𝓐 : Finset κ, (∀ i ∈ 𝓐, i ∈ L) → ∃ Z' : κ → Set T, (∀ i, IsClosed (Z' i)) ∧ + (∀ i j, i ≠ j → Z' i ∩ Z' j ⊆ V) ∧ (∀ i, i ∉ 𝓐 → Z' i = Z i) ∧ + ∀ i ∈ 𝓐, IsClosedDisc (Z' i) ∧ Z' i ∩ V = {u i, w i} ∧ ({u i, w i} : Set T) ⊆ discBd (Z' i) + ∧ Z i ⊆ Z' i by + obtain ⟨Z', h1, h2, h3, h4⟩ := H (Finset.univ.filter (· ∈ L)) (fun i hi => + (Finset.mem_filter.mp hi).2) + exact ⟨Z', h1, h2, fun i hi => h3 i fun h => hi (Finset.mem_filter.mp h).2, + fun i hi => h4 i (Finset.mem_filter.mpr ⟨Finset.mem_univ i, hi⟩)⟩ + intro 𝓐 + induction 𝓐 using Finset.induction_on with + | empty => exact fun _ => ⟨Z, hZ, hZZ, fun _ _ => rfl, fun i hi => absurd hi + (Finset.notMem_empty i)⟩ + | insert i₀ 𝓐 hi₀ ih => + intro hsub + obtain ⟨Z', h1, h2, h3, h4⟩ := ih fun i hi => hsub i (Finset.mem_insert_of_mem hi) + have hi₀L := hsub i₀ (Finset.mem_insert_self _ _) + have hZ₀ : Z' i₀ = Z i₀ := h3 i₀ hi₀ + obtain ⟨a, ha, hr, ha0, ha1⟩ := (hL i₀ hi₀L).exists_arc + let B : Set T := V ∪ ⋃ j : {j // j ≠ i₀}, Z' j.1 + have hB : IsClosed B := hV.union (isClosed_iUnion_of_finite fun j => h1 j.1) + have hends : ({u i₀, w i₀} : Set T) ⊆ V := by + rw [← hLV i₀ hi₀L] + exact inter_subset_right + have hmeet : range a ∩ B ⊆ {a 0, a 1} := by + rintro x ⟨hxa, hxB⟩ + rw [ha0, ha1, ← hLV i₀ hi₀L] + rw [hr] at hxa + refine ⟨hxa, ?_⟩ + rcases hxB with h | h + · exact h + · obtain ⟨j, hj⟩ := mem_iUnion.mp h + have := h2 i₀ j.1 j.2.symm + rw [hZ₀] at this + exact this ⟨hxa, hj⟩ + obtain ⟨D, hD, hDB, hbd, hrange⟩ := + GM12.exists_thin_disc_of_arc hT ha hB (by rw [ha0]; exact Or.inl (hends (by simp))) + (by rw [ha1]; exact Or.inl (hends (by simp))) hmeet + rw [ha0, ha1] at hDB hbd + rw [hr] at hrange + refine ⟨Function.update Z' i₀ D, fun i => ?_, fun i j hij => ?_, fun i hi => ?_, fun i hi => ?_⟩ + · by_cases h : i = i₀ + · subst h + simpa using hD.isClosed + · simpa [Function.update_of_ne h] using h1 i + · have key : ∀ j, j ≠ i₀ → D ∩ Z' j ⊆ V := fun j hj x hx => by + have : x ∈ D ∩ B := ⟨hx.1, Or.inr (mem_iUnion.mpr ⟨⟨j, hj⟩, hx.2⟩)⟩ + rw [hDB] at this + exact hends this + by_cases hi : i = i₀ + · subst hi + rw [Function.update_self, Function.update_of_ne hij.symm] + exact key j hij.symm + · by_cases hj : j = i₀ + · subst hj + rw [Function.update_self, Function.update_of_ne hi, inter_comm] + exact key i hi + · rw [Function.update_of_ne hi, Function.update_of_ne hj] + exact h2 i j hij + · have hne : i ≠ i₀ := fun h => hi (h ▸ Finset.mem_insert_self _ _) + rw [Function.update_of_ne hne] + exact h3 i fun h => hi (Finset.mem_insert_of_mem h) + · by_cases h : i = i₀ + · subst h + rw [Function.update_self] + refine ⟨hD, ?_, hbd, hrange⟩ + apply Subset.antisymm + · rintro x ⟨hx, hxV⟩ + have : x ∈ D ∩ B := ⟨hx, Or.inl hxV⟩ + rwa [hDB] at this + · exact fun x hx => ⟨Surface.discBd_subset _ (hbd hx), hends hx⟩ + · rw [Function.update_of_ne h] + exact h4 i ((Finset.mem_insert.mp hi).resolve_left h) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/PadFlower.lean b/LeanPool/GraphMinor/GM19/PadFlower.lean new file mode 100644 index 0000000000..9c5b4b429d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/PadFlower.lean @@ -0,0 +1,276 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Flower +public import LeanPool.GraphMinor.GM19.CircleOrder +public import LeanPool.GraphMinor.GM19.MarkedMatch + +/-! +# A flower in a pad + +For step (3) of the proof of Graph Minors XIX, (15.2), page 382, we work in a closed disc `C`, which +we call a pad, with a chart onto the closed unit disc. The ends `Y` of a disc `Δ` of `Σ̂` lie around +`bd(Δ)`, and each end `y` has a vertex `φ y` on `bd(C)`. If the two orders agree, then +`exists_pad_flower` gives a flower in the chart with one peak for each end, near `φ y`, and a +homeomorphism `τ` of the +circle that carries the peaks to the ends. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Metric Topology Filter GraphMinor.Surface + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +/-- The order data of a pad. `A y` and `U y` are the places of the end `y` and of its vertex `φ y`, +read along a cut circle. The vertices come in the order of the ends. The cyclic order of the ends +around +the parametrization `q` of `bd(Δ)` is the order of the places `A`. -/ +structure PadOrder (q : Circle → T) (g : ℂ → T) (Y : Set T) (φ : T → T) (A U : T → ℝ) : Prop where + finite : Y.Finite + sub : Y ⊆ range q + A_mem : ∀ y ∈ Y, A y ∈ Icc (0 : ℝ) 1 + U_mem : ∀ y ∈ Y, U y ∈ Icc (0 : ℝ) 1 + g_U : ∀ y ∈ Y, g (ee (U y)) = φ y + mono : ∀ x ∈ Y, ∀ y ∈ Y, A x < A y → U x ≤ U y + inj : InjOn A Y + cyc : ∀ a b c : Circle, q a ∈ Y → q b ∈ Y → q c ∈ Y → a ≠ b → b ≠ c → a ≠ c → + (CircleCyclic a b c ↔ CycOrder (A (q a)) (A (q b)) (A (q c))) + +theorem exists_ee (u : Circle) : ∃ s : ℝ, 0 ≤ s ∧ s < 1 ∧ u = ee s := by + by_cases h : u = 1 + · exact ⟨0, le_rfl, one_pos, by simp [ee, h]⟩ + · obtain ⟨s, hs0, hs1, hs⟩ := exists_angle h + have hpi := Real.pi_pos + refine ⟨s / (2 * Real.pi), by positivity, by rw [div_lt_one (by positivity)]; exact hs1, ?_⟩ + rw [ee, mul_div_cancel₀ _ (by positivity), ← hs] + +theorem ee_add (x y : ℝ) : ee (x + y) = ee x * ee y := by + rw [ee, ee, ee, ← Circle.exp_add] + congr 1 + ring + +theorem ee_one_add (x : ℝ) : ee (x - 1) = ee x := by + have : ee 1 = 1 := by simp [ee] + have h := ee_add (x - 1) 1 + rw [sub_add_cancel, this, mul_one] at h + exact h.symm + +theorem ee_ne_of_window {x y : ℝ} (hne : x ≠ y) (h : |x - y| < 1) : ee x ≠ ee y := by + have hpi := Real.pi_pos + refine circle_exp_ne (fun he => hne (mul_left_cancel₀ (by positivity) he)) ?_ + rw [← mul_sub, abs_mul, abs_of_pos (by positivity : 0 < 2 * Real.pi)] + nlinarith + +theorem continuous_ee_coe : Continuous fun x : ℝ => (ee x : ℂ) := continuous_induced_dom.comp + continuous_ee + +/-- Directions close to `ee (w y)`, for finitely many separated `w y`, have angles in the same +order. -/ +theorem exists_near {Y : Type} [Finite Y] (w : Y → ℝ) (_hw : Function.Injective w) + (h0 : ∀ y, 0 < w y) (h1 : ∀ y, w y < 1) : + ∃ δ > 0, ∀ u : Y → Circle, (∀ y, ‖(u y : ℂ) - ee (w y)‖ < δ) → ∃ b : Y → ℝ, (∀ y, ee (b y) + = u y) ∧ (∀ y, 0 < b y ∧ b y < 1) ∧ ∀ x y, w x < w y → b x < b y := by + obtain ⟨θ, hθ0, hθ1, hθ, hθs⟩ : ∃ θ : ℝ, 0 < θ ∧ θ < 1 / 2 ∧ (∀ y, θ < w y ∧ w y < 1 - θ) + ∧ ∀ x y, w x < w y → w x + 2 * θ < w y := by + have e : ∀ᶠ θ : ℝ in 𝓝[>] 0, (∀ y, θ < w y ∧ w y < 1 - θ) ∧ ∀ x y, w x < w y + → w x + 2 * θ < w y := by + refine Eventually.and (eventually_all.mpr fun y => Eventually.and ?_ ?_) + (eventually_all.mpr fun x => eventually_all.mpr fun y => ?_) + · exact ((continuous_id.tendsto 0).eventually (gt_mem_nhds (h0 y))).filter_mono + nhdsWithin_le_nhds + · have hc : Continuous fun θ : ℝ => 1 - θ := by fun_prop + exact ((hc.tendsto 0).eventually (lt_mem_nhds (by simpa using h1 y))).filter_mono + nhdsWithin_le_nhds + · by_cases hxy : w x < w y + · have hc : Continuous fun θ : ℝ => w x + 2 * θ := by fun_prop + have := (hc.tendsto 0).eventually (gt_mem_nhds (by simpa using hxy)) + exact (this.filter_mono nhdsWithin_le_nhds).mono fun θ h _ => h + · exact Eventually.of_forall fun θ h => absurd h hxy + obtain ⟨θ, h2, h3⟩ := (e.and (Ioo_mem_nhdsGT (by norm_num : (0 : ℝ) < 1 / 2))).exists + exact ⟨θ, h3.1, h3.2, h2.1, h2.2⟩ + have hne : (Icc θ (1 - θ)).Nonempty := ⟨θ, le_rfl, by linarith⟩ + obtain ⟨m, hm, hmin⟩ := (isCompact_Icc (a := θ) (b := 1 - θ)).exists_isMinOn hne (f := fun s + => ‖(ee s : ℂ) - 1‖) ((continuous_ee_coe.sub continuous_const).norm.continuousOn) + have hμ : 0 < ‖(ee m : ℂ) - 1‖ := by + refine norm_pos_iff.mpr (sub_ne_zero.mpr fun h => ?_) + have h1' : ee m = ee 0 := Circle.ext (by rw [h]; simp [ee]) + exact ee_ne_of_window (by linarith [hm.1] : m ≠ 0) (by rw [sub_zero, abs_lt]; constructor + <;> linarith [hm.1, hm.2]) h1' + refine ⟨_, hμ, fun u hu => ?_⟩ + have hb : ∀ y, ∃ b : ℝ, |b - w y| < θ ∧ ee (b) = u y := fun y => by + obtain ⟨s, hs0, hs1, hs⟩ := exists_ee ((ee (w y))⁻¹ * u y) + have hu' : u y = ee (w y + s) := by rw [ee_add, ← hs, mul_inv_cancel_left] + have hsn : ‖(ee s : ℂ) - 1‖ = ‖(u y : ℂ) - ee (w y)‖ := by + have : (u y : ℂ) - ee (w y) = ee (w y) * ((ee s : ℂ) - 1) := by + rw [hu', ee_add] + push_cast + ring + rw [this, norm_mul, Circle.norm_coe, one_mul] + have hlt := hu y + rw [← hsn] at hlt + by_cases hs2 : s < θ + · exact ⟨w y + s, by rw [add_sub_cancel_left, abs_of_nonneg hs0]; exact hs2, hu'.symm⟩ + · by_cases hs3 : 1 - θ < s + · refine ⟨w y + s - 1, by rw [abs_lt]; constructor <;> linarith, ?_⟩ + rw [ee_one_add, hu'] + · exact absurd (hmin (⟨not_lt.mp hs2, not_lt.mp hs3⟩ : s ∈ Icc θ (1 - θ))) (not_le.mpr hlt) + choose b hb1 hb2 using hb + refine ⟨b, hb2, fun y => ?_, fun x y hxy => ?_⟩ + · have := abs_lt.mp (hb1 y) + have h' := hθ y + constructor <;> linarith [this.1, this.2, h'.1, h'.2] + · have h1' := abs_lt.mp (hb1 x) + have h2' := abs_lt.mp (hb1 y) + have := hθs x y hxy + linarith [h1'.2, h2'.1] + +theorem cycOrder_congr {x y z x' y' z' : ℝ} (h1 : x < y ↔ x' < y') (h2 : y < z ↔ y' < z') + (h3 : z < x ↔ z' < x') : CycOrder x y z ↔ CycOrder x' y' z' := by + simp only [CycOrder, h1, h2, h3] + +omit [T2Space T] in +/-- **A flower in a pad.** Here `X` is the union of the discs around the vertices. It holds the part +of the pad near each vertex `φ y`, and the part of `X` in the pad stays away from the centre. The +flower +in the chart meets the chart image of `X` in exactly its peaks `u y`. Each peak is near the place of +`φ y`, and `τ` carries it to the end `y`. -/ +theorem exists_pad_flower {C : Set T} {c : T → ℂ} {g : ℂ → T} (hC : IsCompact C) + (hch : IsChart C c g) {q : Circle → T} {Y : Set T} {φ : T → T} {A U : T → ℝ} + (hO : PadOrder q g Y φ A U) {X : Set T} + (hX : IsClosed X) (hfar : ∀ x ∈ C ∩ X, 1 / 2 < ‖c x‖) (hnear : ∀ y ∈ Y, ∀ᶠ z in 𝓝 (ee + (U y) : ℂ), z ∈ closedBall (0 : ℂ) 1 → g z ∈ X) {s : ℝ} (hs : 0 < s) : + ∃ ρ : Circle → ℝ, Continuous ρ ∧ (∀ x, 0 < ρ x ∧ ρ x < 1) ∧ ∃ u : {y // y ∈ Y} → Circle, + (∀ y, ‖(u y : ℂ) - ee (U y.1)‖ < s) ∧ (∀ y, (ρ (u y) : ℂ) * u y ∈ c '' (C ∩ X)) ∧ + (∀ z (hz : z ≠ 0), z ∈ c '' (C ∩ X) → ‖z‖ ≤ ρ (unitOf z hz) → ∃ y, z = (ρ (u y) : ℂ) * u y) + ∧ ∃ τ : Circle ≃ₜ Circle, PreservesCircleOrientation τ ∧ ∀ y, q (τ (u y)) = y.1 := by + classical + let Y' := {y // y ∈ Y} + have : Finite Y' := hO.finite.to_subtype + let F : Set ℂ := c '' (C ∩ X) + have hF : IsCompact F := (hC.inter_right hX).image_of_continuousOn (hch.hc.mono inter_subset_left) + let wf : ℝ → Y' → ℝ := fun ε y => (1 - 3 * ε) * U y.1 + ε * A y.1 + ε + have hev : ∀ᶠ ε : ℝ in 𝓝[>] 0, ∀ y : Y', ‖(ee (wf ε y) : ℂ) - ee (U y.1)‖ < s / 2 + ∧ ∃ t : ℝ, 0 < t ∧ t < 1 ∧ (t : ℂ) * ee (wf ε y) ∈ F := by + refine eventually_all.mpr fun y => ?_ + obtain ⟨η, hη, hb⟩ := Metric.eventually_nhds_iff.mp (hnear y.1 y.2) + let η₁ := min (min η s) 1 / 2 + have hη₁ : 0 < η₁ := by simp only [η₁]; positivity + have hη₂ : η₁ ≤ η / 2 := by + have : min (min η s) 1 ≤ η := (min_le_left _ _).trans (min_le_left _ _) + simp only [η₁] + linarith + have hη₃ : η₁ ≤ s / 2 := by + have : min (min η s) 1 ≤ s := (min_le_left _ _).trans (min_le_right _ _) + simp only [η₁] + linarith + have hη₄ : η₁ ≤ 1 / 2 := by + have : min (min η s) 1 ≤ 1 := min_le_right _ _ + simp only [η₁] + linarith + have hc : Continuous fun ε : ℝ => (ee ((1 - 3 * ε) * U y.1 + ε * A y.1 + ε) : ℂ) + := continuous_ee_coe.comp (by fun_prop) + have ht : Tendsto (fun ε : ℝ => (ee ((1 - 3 * ε) * U y.1 + ε * A y.1 + ε) : ℂ)) (𝓝 0) (𝓝 (ee + (U y.1) : ℂ)) := by + have := hc.tendsto 0 + simpa using this + have hev := (Metric.tendsto_nhds.mp ht η₁ hη₁).filter_mono (nhdsWithin_le_nhds (s := Ioi 0)) + refine hev.mono fun ε hε => ?_ + rw [dist_eq_norm] at hε + refine ⟨hε.trans_le hη₃, 1 - η₁, by linarith, by linarith, ?_⟩ + have ht1 : (1 - η₁ : ℝ) ∈ Icc (0 : ℝ) 1 := ⟨by linarith, by linarith⟩ + have hn : ‖((1 - η₁ : ℝ) : ℂ) * ee (wf ε y)‖ = 1 - η₁ := by + rw [norm_mul, Complex.norm_real, Circle.norm_coe, mul_one, Real.norm_of_nonneg ht1.1] + have hmem : ((1 - η₁ : ℝ) : ℂ) * ee (wf ε y) ∈ closedBall (0 : ℂ) 1 := by + rw [mem_closedBall_zero_iff, hn] + linarith + have hd : dist (((1 - η₁ : ℝ) : ℂ) * ee (wf ε y)) (ee (U y.1)) < η := by + rw [dist_eq_norm] + have : ((1 - η₁ : ℝ) : ℂ) * ee (wf ε y) - ee (U y.1) = ((ee (wf ε y) : ℂ) - ee (U y.1)) - + ((η₁ : ℝ) : ℂ) * ee (wf ε y) := by + push_cast + ring + rw [this] + refine (norm_sub_le _ _).trans_lt ?_ + rw [norm_mul, Complex.norm_real, Circle.norm_coe, mul_one, Real.norm_of_nonneg hη₁.le] + have := hε + simp only [wf] + linarith + exact ⟨_, ⟨hch.gm hmem, hb hd hmem⟩, hch.hg hmem⟩ + obtain ⟨ε, hev', hε0, hε1⟩ := (hev.and (Ioo_mem_nhdsGT (by norm_num : (0 : ℝ) < 1 / 4))).exists + let w : Y' → ℝ := wf ε + have hA := fun y : Y' => hO.A_mem y.1 y.2 + have hU := fun y : Y' => hO.U_mem y.1 y.2 + have hp : 0 < 1 - 3 * ε := by linarith + have hw0 : ∀ y, 0 < w y := fun y => by + have h1 := mul_nonneg hp.le (hU y).1 + have h2 := mul_nonneg hε0.le (hA y).1 + simp only [w, wf] + linarith + have hw1 : ∀ y, w y < 1 := fun y => by + have h1 := mul_le_mul_of_nonneg_left (hU y).2 hp.le + have h2 := mul_le_mul_of_nonneg_left (hA y).2 hε0.le + simp only [w, wf] + linarith + have hlt : ∀ x y : Y', A x.1 < A y.1 → w x < w y := fun x y hxy => by + have h1 := mul_le_mul_of_nonneg_left (hO.mono x.1 x.2 y.1 y.2 hxy) hp.le + have h2 := mul_lt_mul_of_pos_left hxy hε0 + simp only [w, wf] + linarith + have hAne : ∀ x y : Y', x ≠ y → A x.1 ≠ A y.1 := fun x y hne h => hne (Subtype.ext + (hO.inj x.2 y.2 h)) + have hwi : Function.Injective w := fun x y he => by + by_contra hne + rcases lt_or_gt_of_ne (hAne x y hne) with h | h + · exact (hlt x y h).ne he + · exact (hlt y x h).ne he.symm + have heei : Function.Injective fun y => ee (w y) := fun x y he => by + by_contra hne + refine ee_ne_of_window (fun h => hne (hwi h)) ?_ he + rw [abs_lt] + constructor <;> linarith [hw0 x, hw0 y, hw1 x, hw1 y] + obtain ⟨δ, hδ, hnear'⟩ := exists_near w hwi hw0 hw1 + obtain ⟨ρ, hρc, hρ, u, hu, hud, hupk, hF'⟩ := exists_flower hF (by norm_num : (0 : ℝ) < 1 / 2) + (by norm_num) (fun z ⟨x, hx, hz⟩ => hz ▸ hfar x hx) heei (fun y => (hev' y).2) + (lt_min hδ (half_pos hs)) + refine ⟨ρ, hρc, hρ, u, fun y => ?_, hupk, hF', ?_⟩ + · have h1 : ‖(u y : ℂ) - ee (w y)‖ < s / 2 := (hud y).trans_le (min_le_right _ _) + have h2 := (hev' y).1 + have : (u y : ℂ) - ee (U y.1) = ((u y : ℂ) - ee (w y)) + ((ee (w y) : ℂ) - ee (U y.1)) := by + ring + rw [this] + refine (norm_add_le _ _).trans_lt ?_ + have h2' : ‖(ee (w y) : ℂ) - ee (U y.1)‖ < s / 2 := h2 + linarith + obtain ⟨b, hbe, hb01, hbl⟩ := hnear' u fun y => (hud y).trans_le (min_le_left _ _) + have hbi : Function.Injective b := fun x y he => hu (by rw [← hbe, ← hbe, he]) + have hto : ∀ y : Y', ∃ t, q t = y.1 := fun y => hO.sub y.2 + choose t ht using hto + have hti : Function.Injective t := fun x y he => Subtype.ext (by rw [← ht, ← ht, he]) + have hord : ∀ x y : Y', A x.1 < A y.1 ↔ b x < b y := fun x y => by + refine ⟨fun h => hbl x y (hlt x y h), fun h => ?_⟩ + by_contra hn + rcases (not_lt.mp hn).lt_or_eq with h' | h' + · exact absurd h (hbl y x (hlt y x h')).not_gt + · have := Subtype.ext (hO.inj y.2 x.2 h') + rw [this] at h + exact lt_irrefl _ h + obtain ⟨τ, hτ, hτe⟩ := exists_circle_interp b hbi (fun x y => by linarith [(hb01 x).2, + (hb01 y).1]) t hti (fun x y z hxy hyz hxz => by + have hc := hO.cyc (t x) (t y) (t z) (by rw [ht]; exact x.2) (by rw [ht]; exact y.2) + (by rw [ht]; exact z.2) (fun h => hxy (hti h)) (fun h => hyz (hti h)) (fun h => hxz (hti h)) + rw [hc, ht, ht, ht] + exact cycOrder_congr (hord x y) (hord y z) (hord z x)) + refine ⟨τ, hτ, fun y => ?_⟩ + rw [← hbe, hτe, ht] + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/PaintingPatchwork.lean b/LeanPool/GraphMinor/GM19/PaintingPatchwork.lean new file mode 100644 index 0000000000..4322511587 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/PaintingPatchwork.lean @@ -0,0 +1,210 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section4b +public import LeanPool.GraphMinor.GM19.Section9a +public import LeanPool.GraphMinor.GM18.Section6 +public import Mathlib.Data.Nat.Nth + +import LeanPool.GraphMinor.GM04.Patchwork.Menger + +/-! +# A painting as a patchwork + +Graph Minors XIX, Section 9, regards a painting as a patchwork by giving each edge `e` the free +patch on `eTilde`. This file sets that up. A simulation of one such patchwork in another gives an +inflation of paintings. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface +open GraphMinor.GM04 (Patchwork freePatch IsGrouping IsComponent) + +universe u w + +variable {S : Type u} [TopologicalSpace S] {α : Type w} + +namespace QuasiOrder + +/-- A sequence with infinitely many terms in a well-quasi-order has two of them in order. -/ +theorem IsWQO.exists_pair {Ω : QuasiOrder α} (h : Ω.IsWQO) {f : ℕ → α} {I : Set ℕ} + (hI : I.Infinite) (hf : ∀ i ∈ I, f i ∈ Ω.E) : + ∃ i ∈ I, ∃ j ∈ I, i < j ∧ Ω.le (f i) (f j) := by + classical + obtain ⟨a, b, hab, hle⟩ := h (fun n ↦ f (Nat.nth (· ∈ I) n)) + fun n ↦ hf _ (Nat.nth_mem_of_infinite hI n) + exact ⟨_, Nat.nth_mem_of_infinite hI a, _, Nat.nth_mem_of_infinite hI b, + Nat.nth_strictMono hI hab, hle⟩ + +end QuasiOrder + +namespace ColourScheme + +variable {χ : ColourScheme S α} + +/-- A finite union of well-quasi-orders with disjoint element sets is a well-quasi-order. -/ +theorem isWQO_unionWQO (hd : χ.IsDisjoint) : (χ.unionWQO hd).IsWQO := by + intro f hf + let I₂ : Set ℕ := {i | f i ∈ χ.Ω2.E} + let I₃ : Set ℕ := {i | f i ∈ χ.Ω3.E} + let IS : Set S → Set ℕ := fun s ↦ {i | f i ∈ (χ.ΩS s).E} + have hcover : (univ : Set ℕ) = I₂ ∪ I₃ ∪ ⋃ s ∈ χ.Φ.sides, IS s := by + ext i + simp only [mem_univ, true_iff] + rcases hf i with (h | h) | h + · exact Or.inl (Or.inl h) + · exact Or.inl (Or.inr h) + · refine Or.inr ?_ + obtain ⟨s, hs, his⟩ := mem_iUnion₂.mp h + exact mem_iUnion₂.mpr ⟨s, hs, his⟩ + have hinf : (I₂ ∪ I₃ ∪ ⋃ s ∈ χ.Φ.sides, IS s).Infinite := hcover ▸ infinite_univ + rcases infinite_union.mp hinf with h | h + · rcases infinite_union.mp h with h | h + · obtain ⟨i, hi, j, hj, hij, hle⟩ := χ.isWQO_2.exists_pair h fun _ hi ↦ hi + exact ⟨i, j, hij, Or.inl ⟨hi, hj, hle⟩⟩ + · obtain ⟨i, hi, j, hj, hij, hle⟩ := χ.isWQO_3.exists_pair h fun _ hi ↦ hi + exact ⟨i, j, hij, Or.inr (Or.inl ⟨hi, hj, hle⟩)⟩ + · have hfin : χ.Φ.sides.Finite := χ.Φ.finite_sides + by_contra hno + refine h (hfin.biUnion fun s hs ↦ ?_) + by_contra hs' + obtain ⟨i, hi, j, hj, hij, hle⟩ := (χ.isWQO_S s hs).exists_pair hs' fun _ hi ↦ hi + exact hno ⟨i, j, hij, Or.inr (Or.inr ⟨s, hs, hi, hj, hle⟩)⟩ + +/-- The element set of `Ω_χ`, as a type. -/ +def Colour (hd : χ.IsDisjoint) : Type w := {x : α // x ∈ (χ.unionWQO hd).E} + +instance (hd : χ.IsDisjoint) : Preorder (Colour hd) where + le a b := (χ.unionWQO hd).le a.1 b.1 + le_refl a := (χ.unionWQO hd).refl a.1 a.2 + le_trans a b c h₁ h₂ := (χ.unionWQO hd).trans a.1 a.2 b.1 b.2 c.1 c.2 h₁ h₂ + +instance (hd : χ.IsDisjoint) : WellQuasiOrderedLE (Colour hd) := + ⟨fun f ↦ isWQO_unionWQO hd (fun n ↦ (f n).1) fun n ↦ (f n).2⟩ + +end ColourScheme + +open ColourScheme + +namespace ColouredPainting + +variable {χ : ColourScheme S α} + +theorem φ_mem (hd : χ.IsDisjoint) (P : ColouredPainting χ) {e : Set S} (he : e ∈ P.Γ.E) : + P.φ e ∈ (χ.unionWQO hd).E := by + rcases P.cases he with ⟨-, -, h⟩ | ⟨-, -, h⟩ | ⟨-, s, hs, -, h⟩ + · exact Or.inl (Or.inl h) + · exact Or.inl (Or.inr h) + · exact Or.inr (mem_iUnion₂.mpr ⟨s, hs, h⟩) + +open Classical in +/-- The colour of an edge, as an element of `Ω_χ`. -/ +noncomputable def colour (hd : χ.IsDisjoint) (P : ColouredPainting χ) (e : Set S) : Colour hd := + if h : e ∈ P.Γ.E then ⟨P.φ e, P.φ_mem hd h⟩ + else ⟨P.φ P.fits.internally_three_connected.1.some, + P.φ_mem hd P.fits.internally_three_connected.1.some_mem⟩ + +theorem colour_val (hd : χ.IsDisjoint) (P : ColouredPainting χ) {e : Set S} (he : e ∈ P.Γ.E) : + (P.colour hd e).1 = P.φ e := by + simp [colour, he] + +end ColouredPainting + +theorem Painting.ends_eq (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) : + Γ.toHypergraph.ends e = tilde e := by + ext v + exact ⟨fun h ↦ h.2.2, fun h ↦ ⟨he, Γ.tilde_subset_V he h, h⟩⟩ + +variable {χ : ColourScheme S α} + +/-- A coloured painting as a patchwork: the free patch on `eTilde` for each edge `e`, and the march +`γ(e)` as `μ(e)`. -/ +noncomputable def ColouredPainting.toPatchwork (hd : χ.IsDisjoint) (P : ColouredPainting χ) : + Patchwork (Colour hd) S (Set S) where + G := P.Γ.toHypergraph.toRooted + dom := P.Γ.E + μ := P.Γ.γ + Δ e := freePatch (P.Γ.toHypergraph.ends e) + φ := P.colour hd + dom_subset := Subset.rfl + μ_nodup e he := P.Γ.γ_nodup e he + μ_set e he := (P.Γ.γ_set e he).trans (P.Γ.ends_eq he).symm + Δ_verts _ _ := rfl + Δ_free _ _ _ := GM04.freePatch_isFree _ + +omit [TopologicalSpace S] in +/-- The free patch on a finite set is robust. -/ +theorem freePatch_isRobust {U : Set S} (hU : U.Finite) : (freePatch U).IsRobust := + GM04.Patch.IsFree.isRobust hU (GM04.freePatch_isFree U) + +theorem ColouredPainting.toPatchwork_isRobust (hd : χ.IsDisjoint) (P : ColouredPainting χ) : + (P.toPatchwork hd).IsRobust := fun _e he ↦ + freePatch_isRobust ((P.Γ.ends_eq he) ▸ P.Γ.finite_V.subset (P.Γ.tilde_subset_V he)) + +omit [TopologicalSpace S] in +/-- A component of a subgraph whose edges all lie in `G` induces a connected subgraph of `G`. -/ +theorem preconnected_of_isComponent {H D : (⊤ : SimpleGraph S).Subgraph} {G : SimpleGraph S} + (hadj : ∀ u v, H.Adj u v → G.Adj u v) (hD : IsComponent H D) : + (G.induce D.verts).Preconnected := by + obtain ⟨x, rfl⟩ := hD + have key : ∀ (a b : H.verts) (w : H.coe.Walk a b) + (ha : (a : S) ∈ GM04.componentVerts H x) (hb : (b : S) ∈ GM04.componentVerts H x), + (G.induce (GM04.componentVerts H x)).Reachable ⟨a, ha⟩ ⟨b, hb⟩ := by + intro a b w + induction w with + | nil => exact fun _ _ ↦ SimpleGraph.Reachable.refl _ + | @cons a c b hac _ ih => + intro ha hb + have hc : (c : S) ∈ GM04.componentVerts H x := by + obtain ⟨h₁, h₂⟩ := ha + exact ⟨c.2, h₂.trans (SimpleGraph.Adj.reachable hac)⟩ + have hstep : (G.induce (GM04.componentVerts H x)).Adj ⟨a, ha⟩ ⟨c, hc⟩ := + hadj _ _ hac + exact hstep.reachable.trans (ih hc hb) + have hx := GM04.self_mem_componentVerts H x + intro u v + obtain ⟨hu, hru⟩ := u.2 + obtain ⟨hv, hrv⟩ := v.2 + obtain ⟨wu⟩ := hru + obtain ⟨wv⟩ := hrv + exact (key _ _ wu hx u.2).symm.trans (key _ _ wv hx v.2) + +/-- A simulation of one painting patchwork in another is an inflation. -/ +theorem inflation_of_simulated (hd : χ.IsDisjoint) {P P' : ColouredPainting χ} + (h : GM04.Simulated (P.toPatchwork hd) (P'.toPatchwork hd)) : + ∃ σv σe, IsColouredInflation χ P P' σv σe := by + obtain ⟨ηv, ηe, hexp, H, ⟨δ, hδ, hH⟩, hcomp⟩ := h + have hadj : ∀ u v, H.Adj u v → P'.Γ.skAdj.Adj u v := by + intro u v huv + rw [hH] at huv + obtain ⟨e, he, hAdj⟩ := GM04.realizationOf_adj.mp huv + have heE : e ∈ P'.Γ.E := he.1 + have hm := (hδ e he).2 + have hu : u ∈ (δ e).verts := (δ e).edge_vert hAdj + have hv : v ∈ (δ e).verts := (δ e).edge_vert hAdj.symm + rw [hm] at hu hv + have hu' : u ∈ P'.Γ.toHypergraph.ends e := hu + have hv' : v ∈ P'.Γ.toHypergraph.ends e := hv + exact ⟨hAdj.ne, hu'.2.1, hv'.2.1, e, heE, hu'.2.2, hv'.2.2⟩ + refine ⟨ηv, ηe, theorem_9_1_proof hd P P' ⟨hexp.edge_mem, fun e he ↦ ?_, hexp.edge_injOn, + hexp.vertex_nonempty, hexp.vertex_subset, fun v hv ↦ ?_, hexp.vertex_disjoint, + fun e he i hi hi' ↦ hexp.μ_mem e he i hi hi'⟩ fun e he ↦ ?_⟩ + · rw [← P'.Γ.length_γ (hexp.edge_mem e he), ← P.Γ.length_γ he] + exact (hexp.μ_length e he).symm + · obtain ⟨D, hD, hDv⟩ := hcomp v hv + rw [← hDv] + exact preconnected_of_isComponent hadj hD + · have : (χ.unionWQO hd).le (P.colour hd e).1 (P'.colour hd (ηe e)).1 := hexp.φ_le e he + rwa [P.colour_val hd he, P'.colour_val hd (hexp.edge_mem e he)] at this + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Perimeter.lean b/LeanPool/GraphMinor/GM19/Perimeter.lean new file mode 100644 index 0000000000..fa21cef9c9 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Perimeter.lean @@ -0,0 +1,875 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.ThinPainting +public import LeanPool.GraphMinor.GM11.RadialAccess +public import LeanPool.GraphMinor.GM11.Corners +public import LeanPool.GraphMinor.GM20.Section8a +public import LeanPool.GraphMinor.GM11.PlaneFacts + +/-! +# The perimeter of a region has no repeated vertices + +Graph Minors XIX, Section 6 (page 341) and Section 8 (page 346), use that the perimeter of a region +of +an internally 3-connected painting has no repeated vertices. We prove the form that the rest of the +paper needs: a region has at most one corner at a vertex. If it had two, an `O`-arc inside the +region +would pass through the vertex from one corner to the other. Such an `O`-arc bounds a disc that +misses +the drawing, apart from the vertex. But near the vertex the disc lies in a single corner, and the +two +ends of the `O`-arc at the vertex lie in different corners. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface unitInterval Metric + +section Arcs + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +/-- The part of a parametrized line up to a given time. -/ +theorem line_piece {L : Set T} (f : I ≃ₜ L) {τ : I} (hτ : 0 < τ) : + IsLineWithEnds ((fun t : I ↦ (f t).1) '' Iic τ) (f 0).1 (f τ).1 := by + let p : ℝ → T := fun t ↦ (f (projIcc 0 1 zero_le_one t)).1 + have hp : Continuous p := continuous_subtype_val.comp (f.continuous.comp continuous_projIcc) + have hp' : ∀ t : I, p t = (f t).1 := fun t ↦ by simp [p] + have hτ0 : (0 : ℝ) < τ := hτ + have hinj : InjOn p (Icc 0 (τ : ℝ)) := fun a ha b hb hab ↦ by + have ha' : a ∈ Icc (0 : ℝ) 1 := ⟨ha.1, ha.2.trans τ.2.2⟩ + have hb' : b ∈ Icc (0 : ℝ) 1 := ⟨hb.1, hb.2.trans τ.2.2⟩ + have := f.injective (Subtype.ext hab) + have h₂ := congrArg Subtype.val this + rwa [projIcc_of_mem _ ha', projIcc_of_mem _ hb'] at h₂ + have hl := GM11.isLine_of_injOn hp hτ0 hinj + have hp0 : p 0 = (f 0).1 := by simpa using hp' 0 + have hpτ : p τ = (f τ).1 := hp' τ + rw [hp0, hpτ] at hl + have hset : p '' Icc 0 (τ : ℝ) = (fun t : I ↦ (f t).1) '' Iic τ := by + ext x + constructor + · rintro ⟨t, ht, rfl⟩ + have ht' : t ∈ Icc (0 : ℝ) 1 := ⟨ht.1, ht.2.trans τ.2.2⟩ + refine ⟨⟨t, ht'⟩, ht.2, ?_⟩ + simp only [p] + rw [projIcc_of_mem _ ht'] + · rintro ⟨t, ht, rfl⟩ + exact ⟨t, ⟨t.2.1, ht⟩, hp' t⟩ + rwa [hset] at hl + +/-- The part of a line up to a given point. -/ +theorem IsLineWithEnds.exists_sub {L : Set T} {u v c : T} (h : IsLineWithEnds L u v) (hc : c ∈ L) + (hne : c ≠ u) : ∃ L', IsLineWithEnds L' u c ∧ L' ⊆ L := by + obtain ⟨f, h0, -⟩ := h + obtain ⟨τ, hτ⟩ := f.surjective ⟨c, hc⟩ + have hτ0 : 0 < τ := by + refine lt_of_le_of_ne bot_le fun h ↦ hne ?_ + have h₁ : c = (f τ).1 := by rw [hτ] + rw [h₁, ← h, ← h0] + have hl := line_piece f hτ0 + rw [h0, hτ] at hl + refine ⟨_, hl, ?_⟩ + rintro _ ⟨t, -, rfl⟩ + exact (f _).2 + +/-- A short part of a line, near its first end. -/ +theorem IsLineWithEnds.exists_short {L : Set T} {u v : T} (h : IsLineWithEnds L u v) {W : Set T} + (hW : IsOpen W) (hu : u ∈ W) : + ∃ L' a, IsLineWithEnds L' u a ∧ L' ⊆ L ∧ L' ⊆ W ∧ a ≠ u := by + obtain ⟨f, h0, h1⟩ := h + have hc : Continuous fun t : I ↦ (f t).1 := continuous_subtype_val.comp f.continuous + have hO : IsOpen ((fun t : I ↦ (f t).1) ⁻¹' W) := hW.preimage hc + have h0' : (0 : I) ∈ (fun t : I ↦ (f t).1) ⁻¹' W := by + change (f 0).1 ∈ W + rwa [h0] + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hO 0 h0' + let τ : I := ⟨min (ε / 2) 1, le_min (by positivity) zero_le_one, min_le_right _ _⟩ + have hτ0 : (0 : ℝ) < τ := lt_min (half_pos hε) one_pos + have hτ0' : 0 < τ := hτ0 + have hτne : (f τ).1 ≠ u := by + rw [← h0] + intro he + have := f.injective (Subtype.ext he) + have h₂ := congrArg Subtype.val this + simp only [Icc.coe_zero] at h₂ + exact hτ0.ne' h₂ + have hl := line_piece f hτ0' + rw [h0] at hl + refine ⟨_, _, hl, ?_, ?_, hτne⟩ + · rintro _ ⟨t, -, rfl⟩ + exact (f _).2 + · rintro _ ⟨t, ht, rfl⟩ + refine hball ?_ + rw [Metric.mem_ball, Subtype.dist_eq, Real.dist_eq] + have ht' : (t : ℝ) ≤ τ := ht + have : (τ : ℝ) ≤ ε / 2 := min_le_left _ _ + simp only [Icc.coe_zero, sub_zero] + rw [abs_of_nonneg t.2.1] + linarith + +omit [T2Space T] in +/-- A path from a closed set `A` to a disjoint closed set `B` has a part that meets `A` and `B` only +at its ends. -/ +theorem exists_bridge {p : I → T} (hp : Continuous p) {A B : Set T} (hA : IsClosed A) + (hB : IsClosed B) + (hAB : ∀ t, p t ∈ A → p t ∉ B) (h0 : p 0 ∈ A) (h1 : p 1 ∈ B) : + ∃ s t : I, s < t ∧ p s ∈ A ∧ p t ∈ B ∧ ∀ u, s < u → u < t → p u ∉ A ∧ p u ∉ B := by + have hcB : IsCompact (p ⁻¹' B) := (hB.preimage hp).isCompact + obtain ⟨t, ht, htm⟩ := hcB.exists_isLeast ⟨1, h1⟩ |>.imp fun t h ↦ h + have hcA : IsCompact (p ⁻¹' A ∩ Iic t) := ((hA.preimage hp).inter isClosed_Iic).isCompact + obtain ⟨s, hs, hsm⟩ := hcA.exists_isGreatest ⟨0, h0, (bot_le : (0 : I) ≤ t)⟩ |>.imp fun t h ↦ h + have hst : s < t := by + refine lt_of_le_of_ne hs.2 fun h ↦ hAB s hs.1 (h ▸ ht) + refine ⟨s, t, hst, hs.1, ht, fun u hsu hut ↦ ⟨fun hu ↦ ?_, fun hu ↦ ?_⟩⟩ + · exact absurd (hsm ⟨hu, hut.le⟩) (not_le.mpr hsu) + · exact absurd (htm hu) (not_le.mpr hut) + +omit [T2Space T] in +/-- Near a boundary point, a closed disc without that point is connected. -/ +theorem exists_lens {Δ W : Set T} (hΔ : IsClosedDisc Δ) {v : T} (hv : v ∈ discBd Δ) (hW : IsOpen W) + (hvW : v ∈ W) : ∃ O, IsOpen O ∧ v ∈ O ∧ O ⊆ W ∧ IsPreconnected ((Δ ∩ O) \ {v}) := by + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + have hvΔ : v ∈ Δ := discBd_subset _ hv + have hp : h v ∈ sphere (0 : ℂ) 1 := by + rw [← c.bd] + exact mem_image_of_mem _ hv + have hpB : h v ∈ closedBall (0 : ℂ) 1 := sphere_subset_closedBall hp + have hgp : g (h v) = v := c.gh hvΔ + obtain ⟨Y, hY, hYe⟩ := continuousOn_iff'.mp c.gc W hW + have hpY : h v ∈ Y := by + have : h v ∈ g ⁻¹' W ∩ closedBall 0 1 := ⟨by change g _ ∈ W; rwa [hgp], hpB⟩ + rw [hYe] at this + exact this.1 + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hY _ hpY + obtain ⟨O', hO', hOe⟩ := continuousOn_iff'.mp c.hc _ (isOpen_ball (x := h v) (ε := ε)) + have hvO' : v ∈ O' := by + have : v ∈ h ⁻¹' ball (h v) ε ∩ Δ := ⟨mem_ball_self hε, hvΔ⟩ + rw [hOe] at this + exact this.1 + let A : Set ℂ := (ball (h v) ε ∩ closedBall 0 1) \ {h v} + have hAc : Convex ℝ A := by + intro x hx y hy a b ha hb hab + refine ⟨(convex_ball _ _).inter (convex_closedBall _ _) hx.1 hy.1 ha hb hab, fun he ↦ ?_⟩ + have he' : a • x + b • y = h v := he + rcases ha.eq_or_lt with rfl | ha' + · have : b = 1 := by linarith + subst this + exact hy.2 (by simpa using he') + rcases hb.eq_or_lt with rfl | hb' + · have : a = 1 := by linarith + subst this + exact hx.2 (by simpa using he') + by_cases hxy : x = y + · subst hxy + refine hx.2 ?_ + rw [← add_smul, hab, one_smul] at he' + exact he' + · have := strictConvex_closedBall ℝ (0 : ℂ) 1 hx.1.2 hy.1.2 hxy ha' hb' hab + rw [interior_closedBall _ one_ne_zero, he'] at this + exact (mem_ball.mp this).ne (by simpa using hp) + have hAg : ContinuousOn g A := c.gc.mono fun _ hx ↦ hx.1.2 + have hset : (Δ ∩ (O' ∩ W)) \ {v} = g '' A := by + ext x + constructor + · rintro ⟨⟨hxΔ, hxO, -⟩, hxv⟩ + have hx' : x ∈ h ⁻¹' ball (h v) ε ∩ Δ := by + rw [hOe] + exact ⟨hxO, hxΔ⟩ + refine ⟨h x, ⟨⟨hx'.1, c.hm hxΔ⟩, fun he ↦ hxv ?_⟩, c.gh hxΔ⟩ + have := congrArg g he + rwa [c.gh hxΔ, hgp] at this + · rintro ⟨y, hy, rfl⟩ + have hyΔ := c.gm hy.1.2 + have hhy : h (g y) = y := c.hg hy.1.2 + refine ⟨⟨hyΔ, ?_, ?_⟩, fun he ↦ hy.2 ?_⟩ + · have : g y ∈ h ⁻¹' ball (h v) ε ∩ Δ := + ⟨show h (g y) ∈ ball (h v) ε by rw [hhy]; exact hy.1.1, hyΔ⟩ + rw [hOe] at this + exact this.1 + · have : y ∈ g ⁻¹' W ∩ closedBall 0 1 := by + rw [hYe] + exact ⟨hball hy.1.1, hy.1.2⟩ + exact this.1 + · have he' : g y = v := he + change y = h v + rw [← hhy, he'] + refine ⟨O' ∩ W, hO'.inter hW, ⟨hvO', hvW⟩, inter_subset_right, ?_⟩ + rw [hset] + exact hAc.isPreconnected.image g hAg + +end Arcs + +section Corner + +open GM11 + +variable {T : Type} [TopologicalSpace T] + +/-- `GM11.exists_sectors`, which also says that the sectors cover what lies off the drawing near the +vertex. -/ +theorem exists_sectors' (hS : IsClosedSurface T) (D : Drawing T) {γ : Set T → I → T} + (hγ : EdgePar D γ) {v : T} (hv : v ∈ D.V) (h2 : 2 ≤ Nat.card (halfEdges D γ v)) : + ∃ next ρ P W Q τ, IsSectors D γ v next ρ P W Q τ ∧ (W \ D.U ⊆ ⋃ k, P k) ∧ ∀ k, P k ⊆ Q k := by + obtain ⟨next, ρ, P, W, Q, τ, h⟩ := GM11.exists_sectors hS D hγ hv h2 + exact ⟨next, ρ, P, W, Q, τ, h, h.cover, h.subQ⟩ + +/-- A line from `v` into a sector, close to `v`. -/ +theorem exists_line_in_sector [T2Space T] {D : Drawing T} {γ : Set T → I + → T} {v : T} {next} {ρ P Q τ} + {W : Set T} (h : IsSectors D γ v next ρ P W Q τ) (k) : + ∃ L a, IsLineWithEnds L v a ∧ L ⊆ W ∧ a ≠ v ∧ L \ {v} ⊆ P k ∧ L ⊆ Q k := by + have hQ := h.disc k + have hvbd := h.bd k + obtain ⟨b, hb, hbv⟩ : ∃ b ∈ discBd (Q k), b ≠ v := by + obtain ⟨F⟩ := hQ.isOArc_discBd + by_contra hall + push Not at hall + have hsing : ∀ x y : Circle, F x = F y := fun x y ↦ + Subtype.ext ((hall _ (F x).2).trans (hall _ (F y).2).symm) + have := F.injective (hsing 1 (-1)) + have h₂ := congrArg (fun z : Circle ↦ (z : ℂ)) this + norm_num at h₂ + obtain ⟨L₀, hL₀, hsub, hint⟩ := GM20.exists_chord hQ hvbd hb hbv.symm + obtain ⟨L, a, hL, hLL, hLW, hav⟩ := IsLineWithEnds.exists_short hL₀ + (h.isOpen.inter (isOpen_compl_singleton (x := b))) ⟨h.mem, hbv.symm⟩ + refine ⟨L, a, hL, fun x hx ↦ (hLW hx).1, hav, fun x hx ↦ ?_, hLL.trans hsub⟩ + have hx₁ := hint ⟨hLL hx.1, fun hc ↦ by + rcases hc with hc | hc + · exact hx.2 hc + · exact (hLW hx.1).2 hc⟩ + exact h.inside k ⟨⟨(hLW hx.1).1, hx₁.1⟩, hx₁.2⟩ + +/-- **Only one corner.** Suppose that each `O`-arc through `v` that otherwise lies in the region +`ρ k` bounds a disc that misses the drawing except at `v`. Then the region has only the corner `k` +at +`v`. -/ +theorem corner_unique (hS : IsClosedSurface T) {D : Drawing T} {γ : Set T → I → T} {v : T} + (hv : v ∈ D.V) {next} + {ρ P Q τ} {W : Set T} (h : IsSectors D γ v next ρ P W Q τ) (hcov : W \ D.U ⊆ ⋃ k, P k) + (hPQ : ∀ k, P k ⊆ Q k) {k j} (hkj : ρ k = ρ j) + (hpinch : ∀ F : Set T, IsOArc F → v ∈ F → v ∈ closure (F \ {v}) → F \ {v} ⊆ ρ k → + ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = F ∧ Δ ∩ D.U ⊆ {v}) : k = j := by + classical + by_contra hne + have : T2Space T := hS.2.1 + have hlp := IsClosedSurface.locPathConnected hS + have hrR := h.corners.region k + obtain ⟨A₀, a, hA₀, hA₀W, hav, hA₀P, hA₀Q⟩ := exists_line_in_sector h k + obtain ⟨B₀, b, hB₀, hB₀W, hbv, hB₀P, hB₀Q⟩ := exists_line_in_sector h j + have hPU : ∀ i, Disjoint (P i) D.U := fun i ↦ + (h.sub i).trans (region_subset (h.corners.region i)) |> fun hs ↦ + disjoint_left.mpr fun x hx hxU ↦ hs hx hxU + have hAB : A₀ ∩ B₀ = {v} := by + ext x + constructor + · rintro ⟨hxA, hxB⟩ + by_contra hxv + exact disjoint_left.mp (hPU k) (hA₀P ⟨hxA, hxv⟩) (h.inter k j hne ⟨hA₀Q hxA, hB₀Q hxB⟩) + · rintro rfl + obtain ⟨f, h0, -⟩ := id hA₀ + obtain ⟨g, g0, -⟩ := id hB₀ + exact ⟨h0 ▸ (f 0).2, g0 ▸ (g 0).2⟩ + have haA : a ∈ A₀ := by + obtain ⟨f, -, h1⟩ := hA₀ + exact h1 ▸ (f 1).2 + have hbB : b ∈ B₀ := by + obtain ⟨f, -, h1⟩ := hB₀ + exact h1 ▸ (f 1).2 + have har : a ∈ ρ k := h.sub k (hA₀P ⟨haA, hav⟩) + have hbr : b ∈ ρ k := hkj ▸ h.sub j (hB₀P ⟨hbB, hbv⟩) + have hlc : LocallyConnectedSpace T := IsClosedSurface.locallyConnectedSpace hS + have hrO : IsOpen (ρ k) := region_isOpen hrR + have hrC : IsConnected (ρ k) := by + obtain ⟨x₀, hx₀, hr₀⟩ := (mem_R_iff D).mp hrR + rw [hr₀] + exact isConnected_connectedComponentIn_iff.mpr ⟨trivial, hx₀⟩ + have hrP : IsPathConnected (ρ k) := hrO.isConnected_iff_isPathConnected.mp hrC + have hvr : v ∉ ρ k := fun hc ↦ region_subset hrR hc (D.V_subset_U hv) + obtain ⟨p, hp⟩ := hrP.joinedIn a har b hbr + have hA₀c : IsClosed A₀ := by + obtain ⟨f, -, -⟩ := id hA₀ + have : A₀ = range fun t : I ↦ (f t).1 := by + ext x + exact ⟨fun hx ↦ ⟨f.symm ⟨x, hx⟩, by simp⟩, by rintro ⟨t, rfl⟩; exact (f t).2⟩ + rw [this] + exact (isCompact_range (continuous_subtype_val.comp f.continuous)).isClosed + have hB₀c : IsClosed B₀ := by + obtain ⟨f, -, -⟩ := id hB₀ + have : B₀ = range fun t : I ↦ (f t).1 := by + ext x + exact ⟨fun hx ↦ ⟨f.symm ⟨x, hx⟩, by simp⟩, by rintro ⟨t, rfl⟩; exact (f t).2⟩ + rw [this] + exact (isCompact_range (continuous_subtype_val.comp f.continuous)).isClosed + obtain ⟨s, t, hst, hsA, htB, hmid⟩ := exists_bridge p.continuous hA₀c hB₀c + (fun u hu hu' ↦ by + have : p u ∈ A₀ ∩ B₀ := ⟨hu, hu'⟩ + rw [hAB] at this + exact hvr (this ▸ hp u)) + (by rw [p.source]; exact haA) (by rw [p.target]; exact hbB) + let m : I → I := fun u ↦ ⟨s + u * (t - s), by + constructor + · nlinarith [s.2.1, u.2.1, (show (s : ℝ) < t from hst)] + · nlinarith [t.2.2, u.2.2, (show (s : ℝ) < t from hst)]⟩ + have hmc : Continuous m := by + refine Continuous.subtype_mk ?_ _ + fun_prop + have hm0 : m 0 = s := Subtype.ext (by simp [m]) + have hm1 : m 1 = t := Subtype.ext (by simp [m]) + have hstR : (s : ℝ) < t := hst + have hqc : Continuous (p ∘ m) := p.continuous.comp hmc + have hq01 : (p ∘ m) 0 ≠ (p ∘ m) 1 := by + simp only [Function.comp, hm0, hm1] + intro he + have : p s ∈ A₀ ∩ B₀ := ⟨hsA, he ▸ htB⟩ + rw [hAB] at this + exact hvr (this ▸ hp s) + obtain ⟨e, hec, hei, he0, he1, her⟩ := exists_arc_of_path hqc hq01 + simp only [Function.comp, hm0, hm1] at he0 he1 + have hM : IsLineWithEnds (range e) (p s) (p t) := by + have hcont : Continuous fun x : ℝ ↦ e (projIcc 0 1 zero_le_one x) := hec.comp continuous_projIcc + have hl := GM11.isLine_of_injOn hcont (zero_lt_one' ℝ) (fun x hx y hy hxy ↦ by + have := hei hxy + have h₂ := congrArg Subtype.val this + rwa [projIcc_of_mem _ hx, projIcc_of_mem _ hy] at h₂) + have hset : (fun x : ℝ ↦ e (projIcc 0 1 zero_le_one x)) '' Icc 0 1 = range e := by + ext x + constructor + · rintro ⟨y, -, rfl⟩ + exact mem_range_self _ + · rintro ⟨y, rfl⟩ + exact ⟨y, y.2, by simp⟩ + rw [hset] at hl + simpa [he0, he1] using hl + have hMm : ∀ x ∈ range e, x = p s ∨ x = p t ∨ (x ∉ A₀ ∧ x ∉ B₀) := by + intro x hx + obtain ⟨u, rfl⟩ := her hx + simp only [Function.comp] + rcases u.2.1.eq_or_lt with h0 | h0 + · left + have : u = 0 := Subtype.ext h0.symm + rw [this, hm0] + rcases u.2.2.eq_or_lt with h1 | h1 + · right + left + have : u = 1 := Subtype.ext h1 + rw [this, hm1] + right + right + refine hmid _ ?_ ?_ + · change (s : ℝ) < s + u * (t - s) + nlinarith + · change (s : ℝ) + u * (t - s) < t + nlinarith + have hMr : range e ⊆ ρ k := by + intro x hx + obtain ⟨u, rfl⟩ := her hx + exact hp _ + have hsv : p s ≠ v := fun he ↦ hvr (he ▸ hp s) + have htv : p t ≠ v := fun he ↦ hvr (he ▸ hp t) + obtain ⟨A, hA, hAA⟩ := IsLineWithEnds.exists_sub hA₀ hsA hsv + obtain ⟨B, hB, hBB⟩ := IsLineWithEnds.exists_sub hB₀ htB htv + have hps : p s ∉ B₀ := fun hc ↦ by + have : p s ∈ A₀ ∩ B₀ := ⟨hsA, hc⟩ + rw [hAB] at this + exact hsv this + have hpt : p t ∉ A₀ := fun hc ↦ by + have : p t ∈ A₀ ∩ B₀ := ⟨hc, htB⟩ + rw [hAB] at this + exact htv this + have hcsA : p s ∈ A := by + obtain ⟨f, -, h1⟩ := id hA + exact h1 ▸ (f 1).2 + have hctB : p t ∈ B := by + obtain ⟨f, -, h1⟩ := id hB + exact h1 ▸ (f 1).2 + have hsM : p s ∈ range e := ⟨0, he0⟩ + have htM : p t ∈ range e := ⟨1, he1⟩ + have hX : IsLineWithEnds (A ∪ range e) v (p t) := by + refine GM11.IsLineWithEnds.union (GM11.IsLineWithEnds.symm hA) hM ?_ + ext x + constructor + · rintro ⟨hxA, hxM⟩ + rcases hMm x hxM with h | h | h + · exact h + · exact absurd (h ▸ hAA hxA) hpt + · exact absurd (hAA hxA) h.1 + · rintro rfl + exact ⟨hcsA, hsM⟩ + have hF : IsOArc ((A ∪ range e) ∪ B) := by + refine GM11.isOArc_union hX hB ?_ + rintro x ⟨hxX | hxM, hxB⟩ + · have : x ∈ A₀ ∩ B₀ := ⟨hAA hxX, hBB hxB⟩ + rw [hAB] at this + exact Or.inl this + · rcases hMm x hxM with h | h | h + · exact absurd (h ▸ hBB hxB) hps + · exact Or.inr h + · exact absurd (hBB hxB) h.2 + have hvA : v ∈ A := by + obtain ⟨f, h0, -⟩ := id hA + exact h0 ▸ (f 0).2 + have hvB : v ∈ B := by + obtain ⟨f, h0, -⟩ := id hB + exact h0 ▸ (f 0).2 + obtain ⟨Δ, hΔ, hΔF, hΔU⟩ := hpinch _ hF (Or.inl (Or.inl hvA)) + (closure_mono (sdiff_subset_sdiff_left (fun x hx ↦ Or.inl (Or.inl hx))) + (GM11.IsLineWithEnds.mem_closure_sdiff hA)) (by + rintro x ⟨(hx | hx) | hx, hxv⟩ + · exact h.sub k (hA₀P ⟨hAA hx, hxv⟩) + · exact hMr hx + · exact hkj ▸ h.sub j (hB₀P ⟨hBB hx, hxv⟩)) + have hFΔ : (A ∪ range e) ∪ B ⊆ Δ := hΔF ▸ Surface.discBd_subset Δ + obtain ⟨O, hO, hvO, hOW, hCon⟩ := exists_lens hΔ (by rw [hΔF]; exact Or.inl (Or.inl hvA)) h.isOpen + h.mem + obtain ⟨x₁, hx₁O, hx₁⟩ := mem_closure_iff.mp (GM11.IsLineWithEnds.mem_closure_sdiff hA) O hO hvO + obtain ⟨x₂, hx₂O, hx₂⟩ := mem_closure_iff.mp (GM11.IsLineWithEnds.mem_closure_sdiff hB) O hO hvO + have hfin : Finite (halfEdges D γ v) := (finite_halfEdges D γ v).to_subtype + have hCU : ∀ y ∈ (Δ ∩ O) \ {v}, y ∉ D.U := fun y hy hyU ↦ hy.2 (hΔU ⟨hy.1.1, hyU⟩) + have hcover : (Δ ∩ O) \ {v} ⊆ Q k ∪ ⋃ i : {i // i ≠ k}, Q i.1 := by + intro y hy + obtain ⟨i, hi⟩ := mem_iUnion.mp (hcov ⟨hOW hy.1.2, hCU y hy⟩) + by_cases hik : i = k + · exact Or.inl (hik ▸ hPQ i hi) + · exact Or.inr (mem_iUnion.mpr ⟨⟨i, hik⟩, hPQ i hi⟩) + have hQ' : IsClosed (⋃ i : {i // i ≠ k}, Q i.1) := + isClosed_iUnion_of_finite fun i : {i // i ≠ k} ↦ (h.disc i.1).isClosed + obtain ⟨y, hy, hyk, hyi⟩ := isPreconnected_closed_iff.mp hCon _ _ (h.disc k).isClosed + hQ' hcover + ⟨x₁, ⟨⟨hFΔ (Or.inl (Or.inl hx₁.1)), hx₁O⟩, hx₁.2⟩, hPQ k (hA₀P ⟨hAA hx₁.1, hx₁.2⟩)⟩ + ⟨x₂, ⟨⟨hFΔ (Or.inr hx₂.1), hx₂O⟩, hx₂.2⟩, mem_iUnion.mpr ⟨⟨j, Ne.symm hne⟩, + hPQ j (hB₀P ⟨hBB hx₂.1, hx₂.2⟩)⟩⟩ + obtain ⟨i, hi⟩ := mem_iUnion.mp hyi + exact hCU y hy (h.inter k i.1 (Ne.symm i.2) ⟨hyk, hi⟩) + +end Corner + +section Hat + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] + +omit [T2Space S] in +theorem IsCappedSurface.isClosedSurface (cap : IsCappedSurface S Shat) : IsClosedSurface Shat := by + have hsurf := cap.isSurface + refine ⟨hsurf.1, hsurf.2.1, fun x ↦ ?_⟩ + by_contra hx + have : x ∈ bd Shat := hx + rw [cap.bd_empty] at this + exact this + +omit [T2Space S] in +theorem IsCappedSurface.isClosedEmbedding (hS : IsSurface S) (cap : IsCappedSurface S Shat) : + IsClosedEmbedding cap.emb := by + have hsurf := cap.isSurface + have : CompactSpace S := hS.1 + have : T2Space Shat := hsurf.2.1 + exact IsClosedEmbedding.of_continuous_injective_isClosedMap cap.isEmbedding.continuous + cap.isEmbedding.injective cap.isEmbedding.continuous.isClosedMap + +omit [T2Space S] in +theorem IsCappedSurface.notMem_range (cap : IsCappedSurface S Shat) {Θ : Set S} (hΘ : Θ ∈ cuffs S) + {x : Shat} (hx : x ∈ cap.cuffDisc Θ) : x ∉ range cap.emb := fun hr ↦ by + have : x ∈ (range cap.emb)ᶜ := by + rw [cap.compl_eq] + exact mem_iUnion₂.2 ⟨Θ, hΘ, hx⟩ + exact this hr + +omit [T2Space S] in +/-- A region of `Γ` in `Σ̂` either lies in `Σ`, or is the inside of a pasted disc. -/ +theorem hatRegion_cases (cap : IsCappedSurface S Shat) + (Γ : Painting S) {r : Set Shat} + (hr : r ∈ Γ.hatRegions cap) : r ⊆ range cap.emb ∨ ∃ Θ ∈ cuffs S, r = cap.cuffDisc Θ := by + have hsurf := cap.isSurface + have : T2Space Shat := hsurf.2.1 + have hman : ∀ x : Shat, IsManifoldPoint x := hsurf.2.2 + by_cases hex : ∃ Θ ∈ cuffs S, (r ∩ cap.cuffDisc Θ).Nonempty + · right + obtain ⟨Θ, hΘ, x, hxr, hxΘ⟩ := hex + refine ⟨Θ, hΘ, ?_⟩ + obtain ⟨y, hy, rfl⟩ := hr + rw [connectedComponentIn_eq hxr] + have hx : x ∈ (Γ.hatU cap)ᶜ := connectedComponentIn_subset _ _ hxr + set r := connectedComponentIn (Γ.hatU cap)ᶜ x with hrdef + have hrpre : IsPreconnected r := isPreconnected_connectedComponentIn + have hrU : r ⊆ (Γ.hatU cap)ᶜ := connectedComponentIn_subset _ _ + have hcapopen : IsOpen (cap.cuffDisc Θ) := by + rw [cap.cuffDisc_eq_discInt hΘ] + exact (cap.cuffDisc_closedDisc Θ hΘ).isOpen_discInt hman + have hcapU : cap.cuffDisc Θ ⊆ (Γ.hatU cap)ᶜ := fun w hw ⟨y, _, hy⟩ ↦ + cap.notMem_range hΘ hw ⟨y, hy⟩ + have hconn : IsPreconnected (cap.cuffDisc Θ) := by + rw [cap.cuffDisc_eq_discInt hΘ] + exact (cap.cuffDisc_closedDisc Θ hΘ).isPreconnected_discInt + have h₁ : cap.cuffDisc Θ ⊆ r := hconn.subset_connectedComponentIn hxΘ hcapU + have h₂ : r ⊆ cap.cuffDisc Θ := by + refine hrpre.subset_left_of_subset_union hcapopen + (isClosed_closure (s := cap.cuffDisc Θ)).isOpen_compl ?_ (fun w hw ↦ ?_) + ⟨x, mem_connectedComponentIn hx, hxΘ⟩ + · exact disjoint_left.2 fun w hw hn ↦ hn (subset_closure hw) + · by_cases hwc : w ∈ cap.cuffDisc Θ + · exact Or.inl hwc + · refine Or.inr fun hcl ↦ ?_ + rw [cap.closure_cuffDisc hΘ] at hcl + rcases hcl with h | ⟨y, hy, rfl⟩ + · exact hwc h + · have hyb : y ∈ bd S := by + obtain ⟨z, hz, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ hy + exact hrU hw (mem_image_of_mem _ (Γ.bd_subset hyb)) + exact Subset.antisymm h₂ h₁ + · left + intro x hxr + by_contra hn + have hmem : x ∈ ⋃ Θ ∈ cuffs S, cap.cuffDisc Θ := by + rw [← cap.compl_eq] + exact hn + obtain ⟨Θ, hΘ, hxΘ⟩ := mem_iUnion₂.1 hmem + exact hex ⟨Θ, hΘ, x, hxr, hxΘ⟩ + +/-- If a drawing has no loops, and an `O`-arc through `v` meets the drawing only at `v`, and a disc +bounded by the `O`-arc has only the vertex `v`, then the disc meets the drawing only at `v`. An +edge that meets the disc elsewhere stays inside, so both ends lie in the disc, and they are +different. -/ +theorem disc_misses {T : Type} [TopologicalSpace T] [T2Space T] (hman : ∀ x : T, IsManifoldPoint x) + {D : Drawing T} (hloop : ∀ e ∈ D.E, ∃ u w, u ≠ w ∧ closure e ∩ D.V = {u, w}) + {Δ : Set T} (hΔ : IsClosedDisc Δ) {v : T} (hvV : v ∈ D.V) (hbd : discBd Δ ∩ D.U ⊆ {v}) + (hV : Δ ∩ D.V ⊆ {v}) : + Δ ∩ D.U ⊆ {v} := by + rintro y ⟨hyΔ, hyU⟩ + by_cases hyV : y ∈ D.V + · exact hV ⟨hyΔ, hyV⟩ + by_cases hyF : y ∈ discBd Δ + · exact hbd ⟨hyF, hyU⟩ + exfalso + obtain ⟨e, he, hye⟩ := GM19.exists_arcComp_superset (F := D.U \ D.V) (isPathConnected_singleton y) + (singleton_subset_iff.2 ⟨hyU, hyV⟩) + have hye' : y ∈ e := hye rfl + have hint : IsOpen (discInt Δ) := hΔ.isOpen_discInt hman + have hyint : y ∈ discInt Δ := ⟨hyΔ, hyF⟩ + have hec : e ⊆ D.U \ D.V := he.2.1 + have hsub : e ⊆ discInt Δ := by + have hdis : ∀ x ∈ e, x ∉ discBd Δ := fun x hx hxF ↦ by + have hxv : x = v := hbd ⟨hxF, (hec hx).1⟩ + exact (hec hx).2 (hxv ▸ hvV) + refine he.2.2.1.isConnected.isPreconnected.subset_left_of_subset_union hint + (hΔ.isClosed.isOpen_compl) ?_ (fun x hx ↦ ?_) ⟨y, hye', hyint⟩ + · exact disjoint_left.2 fun x hx hn ↦ hn hx.1 + · by_cases hxΔ : x ∈ Δ + · exact Or.inl ⟨hxΔ, hdis x hx⟩ + · exact Or.inr hxΔ + obtain ⟨u, w, huw, hset⟩ := hloop e he + have hcl : closure e ⊆ Δ := closure_minimal (hsub.trans fun x hx ↦ hx.1) hΔ.isClosed + have hu : u ∈ closure e ∩ D.V := by rw [hset]; exact Or.inl rfl + have hw : w ∈ closure e ∩ D.V := by rw [hset]; exact Or.inr rfl + have h₁ : u = v := hV ⟨hcl hu.1, hu.2⟩ + have h₂ : w = v := hV ⟨hcl hw.1, hw.2⟩ + exact huw (h₁.trans h₂.symm) + +theorem arcComponentsIn_image' {X Y : Type} [TopologicalSpace X] [TopologicalSpace Y] {ι : X → Y} + (hι : IsEmbedding ι) {F c : Set X} (hc : c ∈ arcComponentsIn F) : + ι '' c ∈ arcComponentsIn (ι '' F) := by + refine ⟨hc.1.image _, image_mono hc.2.1, hc.2.2.1.image hι.continuous, fun D hDF hD hsub ↦ ?_⟩ + have hDr : ι '' (ι ⁻¹' D) = D := image_preimage_eq_of_subset (hDF.trans (image_subset_range _ _)) + have hpc : IsPathConnected (ι ⁻¹' D) := by + rw [hι.isInducing.isPathConnected_iff, hDr] + exact hD + have hsub' : ι ⁻¹' D ⊆ F := fun x hx ↦ by + obtain ⟨y, hy, hyx⟩ := hDF hx + exact hι.injective hyx ▸ hy + have := hc.2.2.2 (ι ⁻¹' D) hsub' hpc (by + intro x hx + exact hsub (mem_image_of_mem _ hx)) + rw [← hDr, this] + +/-- The sets that come from `sk(Γ)` drawn in `Σ̂`. -/ +structure IsSkHat (cap : IsCappedSurface S Shat) (Γ : Painting S) (D : Drawing Shat) : Prop where + hU : D.U = cap.emb '' Γ.skU + hV : D.V = cap.emb '' Γ.V + +theorem exists_isSkHat (hS : IsSurface S) (cap : IsCappedSurface S Shat) (Γ : Painting S) : + ∃ D, IsSkHat cap Γ D := by + obtain ⟨D₀, hD₀U, hD₀V⟩ := Γ.exists_skDrawing + obtain ⟨D, hDU, hDV⟩ := exists_drawing_image D₀ (cap.isClosedEmbedding hS) + rw [hD₀U] at hDU + rw [hD₀V] at hDV + exact ⟨D, hDU, hDV⟩ + +omit [T2Space S] in +theorem IsSkHat.edge_iff {cap : IsCappedSurface S Shat} {Γ : Painting S} + {D : Drawing Shat} (h : IsSkHat cap Γ D) {C : Set Shat} : + C ∈ D.E ↔ ∃ e ∈ arcComponentsIn (Γ.skU \ Γ.V), cap.emb '' e = C := by + have hset : D.U \ D.V = cap.emb '' (Γ.skU \ Γ.V) := by + rw [h.hU, h.hV, image_sdiff cap.isEmbedding.injective] + constructor + · intro hC + have hC' : C ∈ arcComponentsIn (cap.emb '' (Γ.skU \ Γ.V)) := hset ▸ hC + obtain ⟨c, hc, rfl⟩ := arcComponentsIn_image cap.isEmbedding hC' + exact ⟨c, hc, rfl⟩ + · rintro ⟨e, he, rfl⟩ + change _ ∈ arcComponentsIn (D.U \ D.V) + rw [hset] + exact arcComponentsIn_image' cap.isEmbedding he + +omit [T2Space S] in +/-- A region of `Γ` in `Σ̂` is a region of `sk(Γ)`. If a component of the complement of `sk(Γ)` went +beyond the region it would enter the inside of a disc of an edge of size 3. The frontier of that +inside lies in `sk(Γ)`, so the component would lie in it, which it does not. -/ +theorem IsSkHat.hatRegion_mem_R {cap : IsCappedSurface S Shat} {Γ : Painting S} + {D : Drawing Shat} (h : IsSkHat cap Γ D) {r : Set Shat} + (hr : r ∈ Γ.hatRegions cap) : r ∈ D.R := by + have hT := cap.isClosedSurface + have : T2Space Shat := hT.2.1 + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hsub : D.U ⊆ Γ.hatU cap := by + rw [h.hU] + exact image_mono Γ.skU_subset + obtain ⟨x, hx, rfl⟩ := hr + have hxD : x ∈ univ \ D.U := ⟨trivial, fun hc ↦ hx (hsub hc)⟩ + refine ⟨x, hxD, Subset.antisymm ?_ ?_⟩ + rotate_left + · refine isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn hx) ?_ + exact (connectedComponentIn_subset _ _).trans fun y hy ↦ ⟨trivial, fun hc ↦ hy (hsub hc)⟩ + · refine isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn hxD) fun y hy ↦ ?_ + have hyD : y ∈ univ \ D.U := connectedComponentIn_subset _ _ hy + by_contra hyU + have hyU' : y ∈ Γ.hatU cap := not_not.mp hyU + obtain ⟨z, hzU, rfl⟩ := hyU' + have hzsk : z ∉ Γ.skU := fun hc ↦ hyD.2 (by rw [h.hU]; exact mem_image_of_mem _ hc) + have hzV : z ∉ Γ.V := fun hc ↦ hzsk (Or.inl (Or.inl hc)) + obtain ⟨c, hc, hzc⟩ := exists_arcComp_superset (F := Γ.U \ Γ.V) + (isPathConnected_singleton z) (singleton_subset_iff.2 ⟨hzU, hzV⟩) + have hzc' : z ∈ c := hzc rfl + have h3 : (tilde c).ncard = 3 := by + rcases Γ.size_cases hc with h2 | h3 + · exact absurd (Or.inl (Or.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h2⟩, hzc'⟩))) hzsk + · exact h3 + obtain ⟨hdisc, -⟩ := Γ.isDisc_of_three hc h3 + obtain ⟨hC, hCbd⟩ := isClosedDisc_image hdisc cap.isEmbedding + have hopen := hC.isOpen_discInt hman + have hbdU : discBd (cap.emb '' closure c) ⊆ D.U := by + rw [hCbd, h.hU] + exact image_mono fun w hw ↦ Or.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h3⟩, hw⟩) + have hyB : cap.emb z ∈ discInt (cap.emb '' closure c) := + ⟨mem_image_of_mem _ (subset_closure hzc'), fun hc' ↦ hyD.2 (hbdU hc')⟩ + have hin : connectedComponentIn (univ \ D.U) x ⊆ discInt (cap.emb '' closure c) := by + refine isPreconnected_connectedComponentIn.subset_left_of_subset_union hopen + hC.isClosed.isOpen_compl ?_ (fun w hw ↦ ?_) ⟨_, hy, hyB⟩ + · exact disjoint_left.2 fun w hw hn ↦ hn hw.1 + · by_cases hwC : w ∈ cap.emb '' closure c + · exact Or.inl ⟨hwC, fun hb ↦ (connectedComponentIn_subset _ _ hw).2 (hbdU hb)⟩ + · exact Or.inr hwC + obtain ⟨⟨u, hu, hue⟩, -⟩ := hin (mem_connectedComponentIn hxD) + exact hx ⟨u, Γ.closure_subset_U hc hu, hue⟩ + +/-- `sk(Γ)` has no loops. -/ +theorem IsSkHat.no_loops (hS : IsSurface S) {cap : IsCappedSurface S Shat} {Γ : Painting S} + {D : Drawing Shat} (h : IsSkHat cap Γ D) : + ∀ e ∈ D.E, ∃ u w, u ≠ w ∧ closure e ∩ D.V = {u, w} := by + intro C hC + obtain ⟨e, he, rfl⟩ := h.edge_iff.mp hC + obtain ⟨u, w, huw, ht, htV, -⟩ := Γ.sk_line he + refine ⟨cap.emb u, cap.emb w, cap.isEmbedding.injective.ne huw, ?_⟩ + have hset : closure e ∩ Γ.V = {u, w} := by + rw [← ht] + ext x + constructor + · rintro ⟨hx, hxV⟩ + exact ⟨hx, fun hxe ↦ (he.2.1 hxe).2 hxV⟩ + · exact fun hx ↦ ⟨hx.1, htV hx⟩ + rw [(cap.isClosedEmbedding hS).closure_image_eq, h.hV, ← image_inter cap.isEmbedding.injective, + hset, image_pair] + +/-- Inside a closed disc whose boundary holds all of the drawing in the disc, an `O`-arc through a +boundary +point `v` and otherwise in the open disc bounds a disc that meets the drawing only at `v`. -/ +theorem pinch_of_cell {T : Type} [TopologicalSpace T] (hT : IsClosedSurface T) {D : Drawing T} + {C F : Set T} (hC : IsClosedDisc C) (hF : IsOArc F) {v : T} (hsub : F ⊆ C) + (hint : F \ {v} ⊆ discInt C) (hU : C ∩ D.U ⊆ discBd C) : + ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = F ∧ Δ ∩ D.U ⊆ {v} := by + have : T2Space T := hT.2.1 + have hman : ∀ x : T, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + obtain ⟨Δ, ⟨hΔC, hΔ, hbd, -⟩, -⟩ := disc_oArc.{0} C F hC hsub hF + refine ⟨Δ, hΔ, hbd, ?_⟩ + rintro y ⟨hyΔ, hyU⟩ + by_contra hyv + have hyb := hU ⟨hΔC hyΔ, hyU⟩ + have hyF : y ∉ F := fun h ↦ (hint ⟨h, hyv⟩).2 hyb + have hyint : y ∈ discInt Δ := ⟨hyΔ, by rwa [hbd]⟩ + have hin : y ∈ interior C := mem_interior.mpr ⟨discInt Δ, fun x hx ↦ hΔC hx.1, + hΔ.isOpen_discInt hman, hyint⟩ + rw [← GM11.IsClosedDisc.frontier_eq_discBd hT hC] at hyb + exact hyb.2 hin + +/-- An `O`-arc through a vertex `v` that otherwise lies in a region of an internally 3-connected +painting bounds a disc that meets `sk(Γ)` only at `v`. In `Σ` this comes from the definition of +internal 3-connectivity, since the `O`-arc meets `V(Γ)` and `bd(Σ)` only at `v`. In a pasted disc it +comes from the disc. -/ +theorem pinch (hS : IsSurface S) {cap : IsCappedSurface S Shat} {Γ : Painting S} {D : Drawing Shat} + (h : IsSkHat cap Γ D) (h3 : Γ.IsInternallyThreeConnected) {r : Set Shat} + (hr : r ∈ Γ.hatRegions cap) {v₀ : S} (hv₀ : v₀ ∈ Γ.V) {F : Set Shat} (hF : IsOArc F) + (_hvF : cap.emb v₀ ∈ F) (hcl : cap.emb v₀ ∈ closure (F \ {cap.emb v₀})) + (hsub : F \ {cap.emb v₀} ⊆ r) : + ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = F ∧ Δ ∩ D.U ⊆ {cap.emb v₀} := by + have hT := cap.isClosedSurface + have : T2Space Shat := hT.2.1 + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hrU : r ⊆ (Γ.hatU cap)ᶜ := by + obtain ⟨x, hx, rfl⟩ := hr + exact connectedComponentIn_subset _ _ + rcases hatRegion_cases cap Γ hr with hrr | ⟨Θ, hΘ, rfl⟩ + · have hFr : F ⊆ range cap.emb := fun x hx ↦ by + by_cases hxv : x = cap.emb v₀ + · exact ⟨v₀, hxv.symm⟩ + · exact hrr (hsub ⟨hx, hxv⟩) + have hFe : cap.emb '' (cap.emb ⁻¹' F) = F := image_preimage_eq_of_subset hFr + set F₀ := cap.emb ⁻¹' F with hF₀ + have hO : IsOArc F₀ := by + obtain ⟨φ⟩ := hF + rw [← hFe] at φ + exact ⟨φ.trans (cap.isEmbedding.homeomorphImage F₀).symm⟩ + have hF₀U : F₀ ∩ Γ.U ⊆ {v₀} := by + rintro x ⟨hxF, hxU⟩ + by_contra hxv + exact hrU (hsub ⟨hxF, fun he ↦ hxv (cap.isEmbedding.injective he)⟩) + (mem_image_of_mem _ hxU) + have hbdU : F₀ ∩ bd S ⊆ {v₀} := fun x hx ↦ hF₀U ⟨hx.1, Γ.bd_subset hx.2⟩ + have hVU : F₀ ∩ Γ.V ⊆ {v₀} := fun x hx ↦ hF₀U ⟨hx.1, Γ.V_subset hx.2⟩ + have hc₁ : (F₀ ∩ Γ.V).ncard ≤ 1 := by + simpa using ncard_le_ncard hVU (finite_singleton v₀) + have hc₂ : (F₀ ∩ bd S).ncard ≤ 1 := by + simpa using ncard_le_ncard hbdU (finite_singleton v₀) + obtain ⟨Δ₀, hΔ₀, hbd, hV⟩ := h3.2 F₀ hO (fun x hx ↦ by + have := hF₀U hx + rw [mem_singleton_iff.mp this] + exact hv₀) ((finite_singleton v₀).subset hbdU) (by omega) + obtain ⟨hΔ, hbdΔ⟩ := isClosedDisc_image hΔ₀ cap.isEmbedding + refine ⟨cap.emb '' Δ₀, hΔ, by rw [hbdΔ, hbd, hFe], ?_⟩ + refine disc_misses hman (h.no_loops hS) hΔ (by rw [h.hV]; exact mem_image_of_mem _ hv₀) ?_ ?_ + · rintro _ ⟨hy, hyU⟩ + rw [hbdΔ, hbd] at hy + obtain ⟨x, hx, rfl⟩ := hy + rw [h.hU] at hyU + obtain ⟨z, hz, hzx⟩ := hyU + obtain rfl := cap.isEmbedding.injective hzx + exact congrArg _ (hF₀U ⟨hx, Γ.skU_subset hz⟩) + · rintro _ ⟨⟨x, hx, rfl⟩, hyV⟩ + rw [h.hV] at hyV + obtain ⟨z, hz, hzx⟩ := hyV + obtain rfl := cap.isEmbedding.injective hzx + exact congrArg _ (hVU ⟨hV ⟨hx, hz⟩, hz⟩) + · have hC := cap.cuffDisc_closedDisc Θ hΘ + have hint : F \ {cap.emb v₀} ⊆ discInt (closure (cap.cuffDisc Θ)) := by + rw [← cap.cuffDisc_eq_discInt hΘ] + exact hsub + refine pinch_of_cell hT hC hF (fun x hx ↦ ?_) hint ?_ + · by_cases hxv : x = cap.emb v₀ + · rw [hxv] + exact closure_mono hsub hcl + · exact subset_closure (hsub ⟨hx, hxv⟩) + · rintro y ⟨hyC, hyU⟩ + rw [cap.cuffDisc_bd Θ hΘ] + rw [cap.closure_cuffDisc hΘ] at hyC + rcases hyC with hy | hy + · rw [h.hU] at hyU + obtain ⟨z, -, rfl⟩ := hyU + exact absurd (mem_range_self z) (cap.notMem_range hΘ hy) + · exact hy + +/-- The two edges of `sk(Γ)` at a vertex in the frontier of a region: there are at most two. -/ +theorem sk_frontier_pair (hS : IsSurface S) {cap : IsCappedSurface S Shat} {Γ : Painting S} + (h3 : Γ.IsInternallyThreeConnected) {r : Set Shat} (hr : r ∈ Γ.hatRegions cap) {v₀ : S} + (hv₀ : v₀ ∈ Γ.V) : ∃ f₁ f₂ : Set S, ∀ f ∈ arcComponentsIn (Γ.skU \ Γ.V), v₀ ∈ tilde f → + cap.emb '' f ⊆ frontier r → f = f₁ ∨ f = f₂ := by + classical + obtain ⟨D, hD⟩ := exists_isSkHat hS cap Γ + have hT := cap.isClosedSurface + have : T2Space Shat := hT.2.1 + have : Nonempty Shat := ⟨cap.emb v₀⟩ + by_cases hex : ∃ f ∈ arcComponentsIn (Γ.skU \ Γ.V), v₀ ∈ tilde f ∧ cap.emb '' f ⊆ frontier r + swap + · exact ⟨∅, ∅, fun f hf hv hfr ↦ absurd ⟨f, hf, hv, hfr⟩ hex⟩ + obtain ⟨f₀, hf₀, hvf₀, hfr₀⟩ := hex + have hvD : cap.emb v₀ ∈ D.V := by + rw [hD.hV] + exact mem_image_of_mem _ hv₀ + obtain ⟨γ, hγ⟩ := GM11.exists_edgePar D + have hhalf : ∀ f ∈ arcComponentsIn (Γ.skU \ Γ.V), v₀ ∈ tilde f → + ∃ x ∈ GM11.halfEdges D γ (cap.emb v₀), x.1 = cap.emb '' f := by + intro f hf hv + have hE : cap.emb '' f ∈ D.E := hD.edge_iff.mpr ⟨f, hf, rfl⟩ + have hcl : cap.emb v₀ ∈ closure (cap.emb '' f) := + image_closure_subset_closure_image cap.isEmbedding.continuous (mem_image_of_mem _ hv.1) + obtain ⟨b, hb⟩ := GM11.exists_end_eq hγ hE hvD hcl + exact ⟨(cap.emb '' f, b), ⟨hE, hb⟩, rfl⟩ + have hinj : ∀ f : Set S, cap.emb ⁻¹' (cap.emb '' f) = f := fun f ↦ + preimage_image_eq _ cap.isEmbedding.injective + have hfin : Finite (GM11.halfEdges D γ (cap.emb v₀)) := + (GM11.finite_halfEdges D γ _).to_subtype + by_cases h2 : 2 ≤ Nat.card (GM11.halfEdges D γ (cap.emb v₀)) + · obtain ⟨next, ρ, P, W, Q, τ, hsec, hcov, hPQ⟩ := exists_sectors' hT D hγ hvD h2 + have hrD : r ∈ D.R := hD.hatRegion_mem_R hr + have hsurj : Function.Surjective next := Finite.injective_iff_surjective.mp hsec.corners.inj + have hcl : ∀ f : Set S, cap.emb '' f ⊆ frontier r → cap.emb '' f ⊆ closure r := + fun f hf ↦ hf.trans frontier_subset_closure + obtain ⟨x₀, hx₀, hx₀e⟩ := hhalf f₀ hf₀ hvf₀ + obtain ⟨k₀, hk₀⟩ := hsurj ⟨x₀, hx₀⟩ + obtain ⟨i, hi⟩ : ∃ i, ρ i = r := by + have hs : (next k₀).1.1 ⊆ closure r := by + rw [hk₀] + change x₀.1 ⊆ _ + rw [hx₀e] + exact hcl _ hfr₀ + rcases hsec.corners.sides k₀ r hrD hs with h | h + · exact ⟨k₀, h.symm⟩ + · exact ⟨_, h.symm⟩ + have huniq : ∀ j, ρ j = r → j = i := fun j hj ↦ by + refine (corner_unique hT hvD hsec hcov hPQ (hi.trans hj.symm) fun F hF hvF hclF hsub ↦ + ?_).symm + rw [hi] at hsub + exact pinch hS hD h3 hr hv₀ hF hvF hclF hsub + refine ⟨cap.emb ⁻¹' i.1.1, cap.emb ⁻¹' (next i).1.1, fun f hf hv hfr ↦ ?_⟩ + obtain ⟨x, hx, hxe⟩ := hhalf f hf hv + obtain ⟨k, hk⟩ := hsurj ⟨x, hx⟩ + have hs : (next k).1.1 ⊆ closure r := by + rw [hk] + change x.1 ⊆ _ + rw [hxe] + exact hcl _ hfr + rcases hsec.corners.sides k r hrD hs with h | h + · right + obtain rfl := huniq k h.symm + rw [hk] + change f = cap.emb ⁻¹' x.1 + rw [hxe, hinj] + · left + have := huniq _ h.symm + rw [← this, hk] + change f = cap.emb ⁻¹' x.1 + rw [hxe, hinj] + · have hsub : Subsingleton (GM11.halfEdges D γ (cap.emb v₀)) := by + rw [← Finite.card_le_one_iff_subsingleton] + omega + obtain ⟨x₀, hx₀, hx₀e⟩ := hhalf f₀ hf₀ hvf₀ + refine ⟨f₀, f₀, fun f hf hv _ ↦ Or.inl ?_⟩ + obtain ⟨x, hx, hxe⟩ := hhalf f hf hv + have := congrArg Subtype.val (hsub.elim ⟨x, hx⟩ ⟨x₀, hx₀⟩) + have he : cap.emb '' f = cap.emb '' f₀ := by + rw [← hxe, ← hx₀e] + exact congrArg Prod.fst this + rw [← hinj f, he, hinj] + +end Hat + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/PlaneOrientation.lean b/LeanPool/GraphMinor/GM19/PlaneOrientation.lean new file mode 100644 index 0000000000..09a0a64a63 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/PlaneOrientation.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.PlaneOrientation +public import LeanPool.GraphMinor.GM19.Section4b +public import LeanPool.GraphMinor.GM19.FragmentDirection +public import LeanPool.GraphMinor.GM19.FragmentChord + +/-! +# The orientation of the plane + +We orient the plane (`planeOrientation : SurfaceOrientation ℂ`) using the positive boundary +parametrization `IsPosParam` and nested-disc lemma `order_of_nested` from +`GraphMinor.Surface.PlaneOrientation`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Metric Topology Filter GraphMinor.Surface + +export GraphMinor.Surface (wind exp_add_two_pi' isAngle_exp turn_period circle_exp_ne + exists_plane_extension wind_ne_zero exists_mem_period wind_eq_of_ball turn_eq_of_nested + image_sphere_of_extension discInt_eq_of_extension wind_eq_turn_rotate wind_eq_of_nested + IsPosParam isPosParam_or_inv exists_posParam not_isPosParam_inv order_of_nested planePos) + +/-- **The orientation of the plane.** -/ +noncomputable def planeOrientation : SurfaceOrientation ℂ where + pos := planePos + isDirection := fun Δ hΔ => by + obtain ⟨φ, hφ⟩ := exists_posParam hΔ + refine ⟨φ, hφ.1, hφ.2.1, hφ.2.2.1, + fun a b c _ _ _ => ⟨?_, fun h => ⟨φ, a, b, c, hφ, rfl, rfl, rfl, h⟩⟩⟩ + rintro ⟨φ', u, v, w, hφ', ha, hb, hc, hcy⟩ + exact order_of_nested hΔ hΔ subset_rfl hφ' hφ hcy ha hb hc + agree := fun Δ₁ Δ₂ h₁ h₂ hsub a b c ha hb hc hab hbc hac => by + obtain ⟨φ₁, hφ₁⟩ := exists_posParam h₁ + obtain ⟨φ₂, hφ₂⟩ := exists_posParam h₂ + have hm₁ : ∀ {x}, x ∈ discBd Δ₁ → ∃ u, φ₁ u = x := fun hx => by + rw [← hφ₁.2.2.1] at hx; exact hx + have hm₂ : ∀ {x}, x ∈ discBd Δ₂ → ∃ u, φ₂ u = x := fun hx => by + rw [← hφ₂.2.2.1] at hx; exact hx + obtain ⟨u₁, rfl⟩ := hm₁ ha.1 + obtain ⟨v₁, rfl⟩ := hm₁ hb.1 + obtain ⟨w₁, rfl⟩ := hm₁ hc.1 + obtain ⟨u₂, hu₂⟩ := hm₂ ha.2 + obtain ⟨v₂, hv₂⟩ := hm₂ hb.2 + obtain ⟨w₂, hw₂⟩ := hm₂ hc.2 + have key : ∀ {x y z : Circle}, IsPosParam Δ₁ φ₁ → + planePos Δ₁ (φ₁ x) (φ₁ y) (φ₁ z) → CircleCyclic x y z := by + rintro x y z - ⟨φ, u, v, w, hφ, h1, h2, h3, hcy⟩ + exact order_of_nested h₁ h₁ subset_rfl hφ hφ₁ hcy h1 h2 h3 + constructor + · intro h + exact ⟨φ₂, u₂, v₂, w₂, hφ₂, hu₂, hv₂, hw₂, + order_of_nested h₁ h₂ hsub hφ₁ hφ₂ (key hφ₁ h) hu₂.symm hv₂.symm hw₂.symm⟩ + · rintro ⟨φ, u, v, w, hφ, h1, h2, h3, hcy⟩ + have hd : u₁ ≠ v₁ := fun he => hab (by rw [he]) + have hd' : u₁ ≠ w₁ := fun he => hac (by rw [he]) + have hd'' : v₁ ≠ w₁ := fun he => hbc (by rw [he]) + refine ⟨φ₁, u₁, v₁, w₁, hφ₁, rfl, rfl, rfl, ?_⟩ + rcases circleCyclic_or hd hd' hd'' with h | h + · exact h + · exfalso + have := order_of_nested h₁ h₂ hsub hφ₁ hφ h h1.symm h3.symm h2.symm + exact not_circleCyclic_both hcy this + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Poles.lean b/LeanPool/GraphMinor/GM19/Poles.lean new file mode 100644 index 0000000000..1d2ca1e165 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Poles.lean @@ -0,0 +1,178 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section8i + +/-! +# Poles and the edges of `Γ*` + +An edge of the radial drawing either lies in `Σ`, or runs from a pole to a vertex on the cuff of the +pole. We also show that two vertices on a cuff are joined through the pole, and that a pole on a +circuit of `Γ*` has two different neighbours in the circuit. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {rad : RadialDrawing cap Γ} + +omit [T2Space S] [T2Space Shat] in +theorem RadialDrawing.edge_ends (rad : RadialDrawing cap Γ) {e : Set Shat} (he : e ∈ rad.G.E) : + ∃ v ∈ Γ.V, ∃ w ∈ rad.Rstar, closure e ∩ rad.G.V = {cap.emb v, w} := by + obtain ⟨_, ⟨v, hv, rfl⟩, w, hw, h⟩ := rad.isPreRadial.2.2.2.2.1 e he + exact ⟨v, hv, w, hw, h⟩ + +omit [T2Space S] [T2Space Shat] in +theorem RadialDrawing.not_mem_hatV (rad : RadialDrawing cap Γ) {w : Shat} (hw : w ∈ rad.Rstar) : + w ∉ Γ.hatV cap := hw.2 + +omit [T2Space Shat] in +omit [T2Space S] in +/-- An edge of `Γ*` with end `w ∈ R*` lies in the region of `w`. -/ +theorem RadialDrawing.edge_subset_region (rad : RadialDrawing cap Γ) {e : Set Shat} {x w : Shat} + (he : e ∈ rad.G.E) (hw : w ∈ rad.Rstar) (hset : closure e ∩ rad.G.V = {x, w}) : + e ⊆ rad.regionOf w := by + have hdis : e ⊆ (Γ.hatU cap)ᶜ := fun y hy hyU ↦ by + have hm : y ∈ Γ.hatU cap ∩ rad.G.U := ⟨hyU, rad.G.closure_subset_U he (subset_closure hy)⟩ + rw [rad.isPreRadial.1] at hm + exact (he.2.1 hy).2 (rad.isPreRadial.2.1 hm) + have hwcl : w ∈ closure e := by + have : w ∈ closure e ∩ rad.G.V := by rw [hset]; exact Or.inr rfl + exact this.1 + have hwU := (rad.regionOf_mem hw).2 + have hwn : w ∈ (Γ.hatU cap)ᶜ := connectedComponentIn_subset _ _ hwU + have hconn : IsPreconnected (insert w e) := by + have : insert w e = e ∪ {w} := by rw [union_singleton] + rw [this] + exact he.2.2.1.isConnected.isPreconnected.subset_closure subset_union_left + (union_subset subset_closure (singleton_subset_iff.mpr hwcl)) + have hsub := hconn.subset_connectedComponentIn (mem_insert w e) + (insert_subset hwn hdis) + exact (subset_insert w e).trans hsub + +variable (hS : IsSurface S) +include hS + +omit [T2Space Shat] hS in +omit [T2Space S] in +/-- A cuff has a pole, and the region of this pole is the pasted open disc. -/ +theorem RadialDrawing.exists_pole (rad : RadialDrawing cap Γ) {Θ : Set S} (hΘ : Θ ∈ cuffs S) : + ∃ p ∈ rad.poles, p ∈ cap.cuffDisc Θ ∧ rad.regionOf p = cap.cuffDisc Θ := by + have hman : ∀ x : Shat, IsManifoldPoint x := cap.isSurface.2.2 + obtain ⟨x, hx⟩ : (cap.cuffDisc Θ).Nonempty := by + by_contra hne + rw [not_nonempty_iff_eq_empty] at hne + have h₁ := cap.closure_cuffDisc hΘ + rw [hne, closure_empty, empty_union] at h₁ + obtain ⟨y, hy, rfl⟩ := hΘ + exact (h₁.symm ▸ mem_image_of_mem cap.emb (mem_connectedComponentIn hy) : cap.emb y ∈ + (∅ : Set Shat)) + have hxU : x ∈ (Γ.hatU cap)ᶜ := fun ⟨y, _, hy⟩ ↦ cap.notMem_range hΘ hx ⟨y, hy⟩ + have hr : connectedComponentIn (Γ.hatU cap)ᶜ x ∈ Γ.hatRegions cap := ⟨x, hxU, rfl⟩ + have hxr := mem_connectedComponentIn hxU + have hreg : connectedComponentIn (Γ.hatU cap)ᶜ x = cap.cuffDisc Θ := by + rcases hatRegion_cases cap Γ hr with h | ⟨Θ', hΘ', h⟩ + · exact absurd (h hxr) (cap.notMem_range hΘ hx) + · have : Θ' = Θ := by + by_contra hne + have hd := cap.cuffDisc_disjoint Θ' hΘ' Θ hΘ hne + exact disjoint_left.mp hd (subset_closure (h ▸ hxr)) (subset_closure hx) + rw [h, this] + obtain ⟨p, ⟨hpr, hpG⟩, -⟩ := rad.isPreRadial.2.2.1 _ hr + have hpU : p ∉ Γ.hatV cap := fun ⟨y, hy, h⟩ ↦ + (connectedComponentIn_subset _ _ hpr) ⟨y, Γ.V_subset hy, h⟩ + have hpΘ : p ∈ cap.cuffDisc Θ := hreg ▸ hpr + have hreg' : rad.regionOf p = cap.cuffDisc Θ := by + simp only [RadialDrawing.regionOf] + rw [← connectedComponentIn_eq hpr, hreg] + exact ⟨p, ⟨⟨hpG, hpU⟩, fun h ↦ cap.notMem_range hΘ hpΘ + (h (hreg'.symm ▸ hpΘ : p ∈ rad.regionOf p))⟩, hpΘ, hreg'⟩ + +omit [T2Space Shat] hS in +omit [T2Space S] in +/-- The region of a pole is a pasted open disc. -/ +theorem RadialDrawing.pole_cases (rad : RadialDrawing cap Γ) {p : Shat} (hp : p ∈ rad.poles) : + ∃ Θ ∈ cuffs S, rad.regionOf p = cap.cuffDisc Θ ∧ p ∈ cap.cuffDisc Θ := by + obtain ⟨hr, hpr⟩ := rad.regionOf_mem hp.1 + rcases hatRegion_cases cap Γ hr with h | ⟨Θ, hΘ, h⟩ + · exact absurd h hp.2 + · exact ⟨Θ, hΘ, h, h ▸ hpr⟩ + +omit [T2Space S] [T2Space Shat] hS in +/-- A vertex in `R*` that is not a pole has its region in `Σ`. -/ +theorem RadialDrawing.region_subset_range (rad : RadialDrawing cap Γ) {w : Shat} + (hw : w ∈ rad.Rstar) (hn : w ∉ rad.poles) : rad.regionOf w ⊆ range cap.emb := by + by_contra h + exact hn ⟨hw, h⟩ + +omit [T2Space Shat] hS in +omit [T2Space S] in +/-- An edge of `Γ*` at a pole misses `Σ`, and its other end lies on the cuff of the pole. -/ +theorem RadialDrawing.pole_edge (rad : RadialDrawing cap Γ) {e : Set Shat} {p : Shat} {v : S} + (he : e ∈ rad.G.E) (hp : p ∈ rad.poles) {Θ : Set S} (hΘ : Θ ∈ cuffs S) + (hreg : rad.regionOf p = cap.cuffDisc Θ) (hset : closure e ∩ rad.G.V = {cap.emb v, p}) : + Disjoint e (range cap.emb) ∧ v ∈ Θ := by + have hsub := rad.edge_subset_region he hp.1 hset + rw [hreg] at hsub + refine ⟨disjoint_left.mpr fun x hx hr ↦ cap.notMem_range hΘ (hsub hx) hr, ?_⟩ + have hvcl : cap.emb v ∈ closure e := by + have : cap.emb v ∈ closure e ∩ rad.G.V := by rw [hset]; exact Or.inl rfl + exact this.1 + have h₁ := closure_mono hsub hvcl + rw [cap.closure_cuffDisc hΘ] at h₁ + rcases h₁ with h | ⟨y, hy, hyv⟩ + · exact absurd ⟨v, rfl⟩ (cap.notMem_range hΘ h) + · rwa [← cap.isEmbedding.injective hyv] + +omit [T2Space Shat] hS in +omit [T2Space S] in +/-- An edge of `Γ*` with no end a pole lies in `Σ`. -/ +theorem RadialDrawing.edge_subset_range (rad : RadialDrawing cap Γ) {e : Set Shat} {x w : Shat} + (he : e ∈ rad.G.E) (hw : w ∈ rad.Rstar) (hn : w ∉ rad.poles) + (hset : closure e ∩ rad.G.V = {x, w}) : e ⊆ range cap.emb := + (rad.edge_subset_region he hw hset).trans (rad.region_subset_range hw hn) + +variable (h3 : Γ.IsInternallyThreeConnected) +include h3 + +omit [T2Space Shat] in +/-- Each vertex on a cuff is joined to the pole of the cuff. -/ +theorem RadialDrawing.exists_pole_edge (rad : RadialDrawing cap Γ) {p : Shat} (hp : p ∈ rad.poles) + {Θ : Set S} (hΘ : Θ ∈ cuffs S) (hreg : rad.regionOf p = cap.cuffDisc Θ) {v : S} + (hv : v ∈ Γ.V) (hvΘ : v ∈ Θ) : ∃ e ∈ rad.G.E, closure e ∩ rad.G.V = {cap.emb v, p} := by + refine rad.exists_spoke hS (h3.hatRegions_isOpenDisc hS cap) h3.1 hp.1 hv ?_ + rw [hreg, cap.closure_cuffDisc hΘ] + exact Or.inr (mem_image_of_mem _ hvΘ) + +/-- There is at most one edge of `Γ*` between two given vertices. -/ +theorem RadialDrawing.edge_unique (rad : RadialDrawing cap Γ) {e₁ e₂ : Set Shat} {v : S} {w : Shat} + (he₁ : e₁ ∈ rad.G.E) (he₂ : e₂ ∈ rad.G.E) (hv : v ∈ Γ.V) (hw : w ∈ rad.Rstar) + (h₁ : closure e₁ ∩ rad.G.V = {cap.emb v, w}) (h₂ : closure e₂ ∩ rad.G.V = {cap.emb v, w}) : + e₁ = e₂ := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + obtain ⟨D, G₃, hD, hrad, hmax, hsub, hhat⟩ := + rad.exists_full hS (h3.hatRegions_isOpenDisc hS cap) h3.1 + obtain ⟨hr, hwr⟩ := rad.regionOf_mem hw + have key : ∀ {e}, e ∈ rad.G.E → closure e ∩ rad.G.V = {cap.emb v, w} → + closure e ∩ G₃.V = {cap.emb v, w} := by + intro e he h + have hl : rad.G.toGraph.IsLink e (cap.emb v) w := + ⟨he, rad.isPreRadial.2.1 (mem_image_of_mem _ hv), hw.1, h⟩ + exact ((hsub.isLink_iff hl.1).mp hl).2.2.2 + exact spoke_unique hS hD h3 hrad (hsub.2 he₁) (hsub.2 he₂) hr + (rad.edge_subset_region he₁ hw h₁) (rad.edge_subset_region he₂ hw h₂) hv hwr + (hsub.1 hw.1) (key he₁ h₁) (key he₂ h₂) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/PullLift.lean b/LeanPool/GraphMinor/GM19/PullLift.lean new file mode 100644 index 0000000000..ccc670fe0d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/PullLift.lean @@ -0,0 +1,428 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.InvarianceOfDomain +public import LeanPool.GraphMinor.GM19.CuffPieces +public import LeanPool.GraphMinor.GM19.CutMap +public import Mathlib.Analysis.Convex.StrictConvexSpace +public import Mathlib.Analysis.InnerProductSpace.Convex +public import LeanPool.GraphMinor.Surface.CutComp + +/-! +# Lifting sets along a fragment + +Let `Σ₁` be a fragment of `Σ` after cutting along `U(K)`, with its associated surjection `ψ`. Then +`ψ` maps +the interior of `Σ₁` homeomorphically onto a component `R` of `Σ \ (bd(Σ) ∪ U(K))`. This file proves +that, +and then studies the closure of the lift of a set `A ⊆ R`. If `A` is connected near a point `v`, +then the +closure of the lift of `A` has just one point over `v`. So the closure of the lift of an edge of a +painting is a copy of the closure of the edge (`homeoClosure`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +universe u + +open Set Topology GraphMinor.Surface + +variable {S S₁ : Type u} [TopologicalSpace S] [TopologicalSpace S₁] [T2Space S] [T2Space S₁] + {K : Drawing S} {ψ : S₁ → S} + +namespace IsCuttingFragment + +/-- The part of `Σ` that the interior of the fragment covers. -/ +def R (ψ : S₁ → S) : Set S := ψ '' (bd S₁)ᶜ + +section Fragment + +variable {A : Set S} (h : IsCuttingFragment S K S₁ ψ) +include h + +omit [T2Space S₁] in +theorem isClosedMap : IsClosedMap ψ := + have : CompactSpace S₁ := h.isSurface.1 + h.continuous_ψ.isClosedMap + +omit [T2Space S] [T2Space S₁] in +theorem notMem_R_of_bd {x : S₁} (hx : x ∈ bd S₁) : ψ x ∉ R ψ := fun hR ↦ + disjoint_left.mp h.maps_interior_disjoint hR (h.maps_bd (mem_image_of_mem ψ hx)) + +omit [T2Space S] [T2Space S₁] in +theorem mem_R_iff {x : S₁} : ψ x ∈ R ψ ↔ x ∉ bd S₁ := + ⟨fun hR hx ↦ h.notMem_R_of_bd hx hR, fun hx ↦ mem_image_of_mem ψ hx⟩ + +omit [T2Space S] [T2Space S₁] in +theorem disjoint_R : Disjoint (R ψ) (bd S ∪ K.U) := h.maps_interior_disjoint + +omit [T2Space S] [T2Space S₁] in +theorem isOpen_R (hS : IsSurface S) (hK : IsClosed K.U) : IsOpen (R ψ) := by + have : LocallyConnectedSpace S := IsSurface.locallyConnected hS + obtain ⟨x, hx, hR⟩ := h.interior_component + rw [R, ← hR] + exact IsOpen.connectedComponentIn (((cuff_statement S hS).1.union hK).isOpen_compl) + +omit [T2Space S₁] in +/-- `ψ` maps open subsets of the interior to open sets. -/ +theorem isOpen_image (hR : IsOpen (R ψ)) {W : Set S₁} (hW : W ⊆ (bd S₁)ᶜ) (hWo : IsOpen W) : + IsOpen (ψ '' W) := by + have heq : ψ '' W = R ψ \ ψ '' Wᶜ := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + refine ⟨mem_image_of_mem ψ (hW hx), ?_⟩ + rintro ⟨z, hz, hzx⟩ + by_cases hzb : z ∈ bd S₁ + · exact h.notMem_R_of_bd hzb (hzx ▸ mem_image_of_mem ψ (hW hx)) + · exact hz (h.injOn_interior hzb (hW hx) hzx ▸ hx) + · rintro ⟨⟨z, hz, rfl⟩, hn⟩ + by_contra hne + exact hn ⟨z, fun hzW ↦ hne (mem_image_of_mem ψ hzW), rfl⟩ + rw [heq] + exact hR.sdiff (h.isClosedMap _ hWo.isClosed_compl) + +/-- `ψ` as a bijection from the interior onto `R`. -/ +noncomputable def intEquiv : ↥(bd S₁)ᶜ ≃ ↥(R ψ) := + Equiv.ofBijective (fun x : ↥(bd S₁)ᶜ ↦ (⟨ψ x.1, mem_image_of_mem ψ x.2⟩ : ↥(R ψ))) + ⟨fun _ _ hxy ↦ Subtype.ext (h.injOn_interior (Subtype.property _) (Subtype.property _) + (congrArg Subtype.val hxy)), by + rintro ⟨_, x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩⟩ + +omit [T2Space S₁] in +theorem isOpenMap_intEquiv (hbd : IsClosed (bd S₁)) (hR : IsOpen (R ψ)) : + IsOpenMap (h.intEquiv) := by + intro W hW + have hW' := hbd.isOpen_compl.isOpenEmbedding_subtypeVal.isOpenMap W hW + have himg := h.isOpen_image hR (W := Subtype.val '' W) (by rintro _ ⟨x, -, rfl⟩; exact x.2) hW' + refine (hR.isOpenEmbedding_subtypeVal.isInducing.isOpen_iff).mpr ⟨_, himg, ?_⟩ + ext ⟨y, hy⟩ + constructor + · rintro ⟨_, ⟨x, hx, rfl⟩, hxy⟩ + exact ⟨x, hx, Subtype.ext hxy⟩ + · rintro ⟨x, hx, hxy⟩ + exact ⟨x.1, ⟨x, hx, rfl⟩, congrArg Subtype.val hxy⟩ + +/-- The inverse of `ψ` on the interior is continuous: `ψ` is a homeomorphism from the interior of +the +fragment onto `R`. -/ +noncomputable def intHomeo (hbd : IsClosed (bd S₁)) (hR : IsOpen (R ψ)) : + ↥(bd S₁)ᶜ ≃ₜ ↥(R ψ) := + h.intEquiv.toHomeomorphOfContinuousOpen + ((h.continuous_ψ.comp continuous_subtype_val).subtype_mk _) (h.isOpenMap_intEquiv hbd hR) + +omit [T2Space S₁] in +theorem intHomeo_apply (hbd : IsClosed (bd S₁)) (hR : IsOpen (R ψ)) (x : ↥(bd S₁)ᶜ) : + (h.intHomeo hbd hR x).1 = ψ x.1 := rfl + +omit [T2Space S₁] in +/-- The lift of a subset of `R` is the homeomorphic image of the subset. -/ +theorem preimage_eq (hbd : IsClosed (bd S₁)) (hR : IsOpen (R ψ)) {A : Set S} (hA : A ⊆ R ψ) : + ψ ⁻¹' A = Subtype.val '' ((h.intHomeo hbd hR).symm '' (Subtype.val ⁻¹' A)) := by + ext x + constructor + · intro hx + have hxi : x ∉ bd S₁ := h.mem_R_iff.mp (hA hx) + refine ⟨⟨x, hxi⟩, ⟨h.intHomeo hbd hR ⟨x, hxi⟩, hx, by simp⟩, rfl⟩ + · rintro ⟨_, ⟨y, hy, rfl⟩, rfl⟩ + have hyy : ψ ((h.intHomeo hbd hR).symm y).1 = y.1 := by + rw [← h.intHomeo_apply hbd hR, Homeomorph.apply_symm_apply] + change ψ _ ∈ A + rw [hyy] + exact hy + +omit [T2Space S₁] in +theorem isPathConnected_preimage (hbd : IsClosed (bd S₁)) (hR : IsOpen (R ψ)) {A : Set S} + (hA : A ⊆ R ψ) (hAc : IsPathConnected A) : IsPathConnected (ψ ⁻¹' A) := by + rw [h.preimage_eq hbd hR hA] + refine IsPathConnected.image ?_ continuous_subtype_val + refine IsPathConnected.image ?_ (h.intHomeo hbd hR).symm.continuous + rw [IsInducing.subtypeVal.isPathConnected_iff, image_preimage_eq_of_subset] + · exact hAc + · rwa [Subtype.range_coe] + +omit [T2Space S₁] in +theorem isPreconnected_preimage (hbd : IsClosed (bd S₁)) (hR : IsOpen (R ψ)) {A : Set S} + (hA : A ⊆ R ψ) (hAc : IsPreconnected A) : IsPreconnected (ψ ⁻¹' A) := by + rw [h.preimage_eq hbd hR hA] + refine IsPreconnected.image ?_ _ continuous_subtype_val.continuousOn + refine IsPreconnected.image ?_ _ (h.intHomeo hbd hR).symm.continuous.continuousOn + rw [← IsInducing.subtypeVal.isPreconnected_image, image_preimage_eq_of_subset] + · exact hAc + · rwa [Subtype.range_coe] + +/-- **One side at each point.** Let `A ⊆ R` be connected near `v`. Then the closure of the lift of +`A` +has at most one point over `v`. Two such points have disjoint open neighbourhoods. These can be +chosen +to cover the finite fibre, so they cover the lift of a small connected part of `A`, which meets +both. -/ +theorem eq_of_mem_closure_preimage (hbd : IsClosed (bd S₁)) (hR : IsOpen (R ψ)) {A : Set S} {v : S} + (hA : A ⊆ R ψ) + (hloc : ∀ W ∈ 𝓝 v, ∃ B ⊆ A ∩ W, IsPreconnected B ∧ ∃ W' ∈ 𝓝 v, A ∩ W' ⊆ B) {v₁ v₂ : S₁} + (h₁ : ψ v₁ = v) (h₂ : ψ v₂ = v) (hc₁ : v₁ ∈ closure (ψ ⁻¹' A)) (hc₂ : v₂ ∈ closure (ψ ⁻¹' A)) : + v₁ = v₂ := by + by_contra hne + have hfin := h.finite_fibres v + -- Separate `v₁` from the rest of the fibre. + obtain ⟨U₁, U₂, hU₁, hU₂, hv₁, hv₂, hdis⟩ : + ∃ U₁ U₂ : Set S₁, IsOpen U₁ ∧ IsOpen U₂ ∧ v₁ ∈ U₁ ∧ ψ ⁻¹' {v} \ {v₁} ⊆ U₂ ∧ Disjoint U₁ U₂ + := by + have hcomp : IsCompact (ψ ⁻¹' {v} \ {v₁}) := (hfin.subset sdiff_subset).isCompact + obtain ⟨U₁, U₂, hU₁, hU₂, hv, hsub, hd⟩ := SeparatedNhds.of_isCompact_isCompact + (isCompact_singleton (x := v₁)) hcomp (by + rw [disjoint_singleton_left] + exact fun hx ↦ hx.2 rfl) + exact ⟨U₁, U₂, hU₁, hU₂, hv rfl, hsub, hd⟩ + have hWo : IsOpen (ψ '' (U₁ ∪ U₂)ᶜ)ᶜ := (h.isClosedMap _ (hU₁.union + hU₂).isClosed_compl).isOpen_compl + have hvW : v ∈ (ψ '' (U₁ ∪ U₂)ᶜ)ᶜ := by + rintro ⟨x, hx, hxv⟩ + by_cases hxv₁ : x = v₁ + · exact hx (Or.inl (hxv₁ ▸ hv₁)) + · exact hx (Or.inr (hv₂ ⟨hxv, hxv₁⟩)) + obtain ⟨B, hBsub, hBc, W', hW', hsub⟩ := hloc _ (hWo.mem_nhds hvW) + have hBA : B ⊆ R ψ := fun y hy ↦ hA (hBsub hy).1 + have hcov : ψ ⁻¹' B ⊆ U₁ ∪ U₂ := by + intro x hx + by_contra hnx + exact (hBsub hx).2 ⟨x, hnx, rfl⟩ + have hpt : ∀ {w : S₁} {U : Set S₁}, ψ w = v → IsOpen U → w ∈ U → w ∈ closure (ψ ⁻¹' A) → + (ψ ⁻¹' B ∩ U).Nonempty := by + intro w U hw hU hwU hc + have hn : U ∩ ψ ⁻¹' W' ∈ 𝓝 w := + Filter.inter_mem (hU.mem_nhds hwU) (h.continuous_ψ.continuousAt.preimage_mem_nhds + (hw.symm ▸ hW')) + obtain ⟨p, ⟨hpU, hpW⟩, hpA⟩ := mem_closure_iff_nhds.mp hc _ hn + exact ⟨p, hsub ⟨hpA, hpW⟩, hpU⟩ + have hv₂U : v₂ ∈ U₂ := hv₂ ⟨h₂, fun hx ↦ hne hx.symm⟩ + obtain ⟨p, -, hp₁, hp₂⟩ := h.isPreconnected_preimage hbd hR hBA hBc U₁ U₂ hU₁ hU₂ hcov + (hpt h₁ hU₁ hv₁ hc₁) (hpt h₂ hU₂ hv₂U hc₂) + exact disjoint_left.mp hdis hp₁ hp₂ + +omit [T2Space S₁] in +/-- The closure of the lift of `A` maps onto the closure of `A`. -/ +theorem image_closure_preimage (hA : A ⊆ R ψ) : ψ '' closure (ψ ⁻¹' A) = closure A := by + have hsur : ψ '' (ψ ⁻¹' A) = A := image_preimage_eq_of_subset (hA.trans (image_subset_range _ _)) + refine Subset.antisymm ?_ ?_ + · refine (image_closure_subset_closure_image h.continuous_ψ).trans (closure_mono hsur.subset) + · conv_lhs => rw [← hsur] + exact (h.isClosedMap.closure_image_subset _) + +/-- `ψ` as a map from the closure of the lift of `A` to the closure of `A`. -/ +def closureMap (A : Set S) (hA : A ⊆ R ψ) : ↥(closure (ψ ⁻¹' A)) → ↥(closure A) := fun x ↦ + ⟨ψ x.1, h.image_closure_preimage hA ▸ mem_image_of_mem ψ x.2⟩ + +theorem bijective_closureMap (hbd : IsClosed (bd S₁)) (hR : IsOpen (R ψ)) (hA : A ⊆ R ψ) + (hloc : ∀ v ∈ tilde A, ∀ W ∈ 𝓝 v, ∃ B ⊆ A ∩ W, IsPreconnected B ∧ ∃ W' ∈ 𝓝 v, A ∩ W' ⊆ B) : + Function.Bijective (h.closureMap A hA) := by + constructor + · rintro ⟨x, hx⟩ ⟨y, hy⟩ hxy + have hxy' : ψ x = ψ y := congrArg Subtype.val hxy + refine Subtype.ext ?_ + change x = y + by_cases hv : ψ x ∈ A + · exact h.injOn_interior (h.mem_R_iff.mp (hA hv)) (h.mem_R_iff.mp (hA (hxy' ▸ hv))) hxy' + · have hcl : ψ x ∈ closure A := (h.image_closure_preimage hA) ▸ mem_image_of_mem ψ hx + exact h.eq_of_mem_closure_preimage hbd hR hA (hloc _ ⟨hcl, hv⟩) rfl hxy'.symm hx hy + · rintro ⟨y, hy⟩ + rw [← h.image_closure_preimage hA] at hy + obtain ⟨x, hx, rfl⟩ := hy + exact ⟨⟨x, hx⟩, rfl⟩ + +/-- If `A ⊆ R` is connected near each point of its frontier, then `ψ` maps the closure of the lift +of `A` +homeomorphically onto the closure of `A`. The map is a continuous bijection from a compact space to +a +Hausdorff space. -/ +noncomputable def homeoClosure (hbd : IsClosed (bd S₁)) (hR : IsOpen (R ψ)) (hA : A ⊆ R ψ) + (hloc : ∀ v ∈ tilde A, ∀ W ∈ 𝓝 v, ∃ B ⊆ A ∩ W, IsPreconnected B ∧ ∃ W' ∈ 𝓝 v, A ∩ W' ⊆ B) : + ↥(closure (ψ ⁻¹' A)) ≃ₜ ↥(closure A) := + have : CompactSpace S₁ := h.isSurface.1 + have : CompactSpace ↥(closure (ψ ⁻¹' A)) := isCompact_iff_compactSpace.mp + isClosed_closure.isCompact + Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective _ (h.bijective_closureMap hbd hR hA + hloc)) + ((h.continuous_ψ.comp continuous_subtype_val).subtype_mk _) + +theorem homeoClosure_apply (hbd : IsClosed (bd S₁)) (hR : IsOpen (R ψ)) (hA : A ⊆ R ψ) + (hloc : ∀ v ∈ tilde A, ∀ W ∈ 𝓝 v, ∃ B ⊆ A ∩ W, IsPreconnected B ∧ ∃ W' ∈ 𝓝 v, A ∩ W' ⊆ B) + (x : ↥(closure (ψ ⁻¹' A))) : (h.homeoClosure hbd hR hA hloc x).1 = ψ x.1 := rfl + +omit [T2Space S₁] in +/-- The closure of the lift has the frontier one expects: a point over `tilde A`, and only such +points. -/ +theorem image_tilde_preimage (hA : A ⊆ R ψ) : ψ '' tilde (ψ ⁻¹' A) = tilde A := by + have hsur : ψ '' (ψ ⁻¹' A) = A := image_preimage_eq_of_subset (hA.trans (image_subset_range _ _)) + ext y + constructor + · rintro ⟨x, ⟨hx, hxn⟩, rfl⟩ + exact ⟨h.image_closure_preimage hA ▸ mem_image_of_mem ψ hx, hxn⟩ + · rintro ⟨hy, hyn⟩ + rw [← h.image_closure_preimage hA] at hy + obtain ⟨x, hx, rfl⟩ := hy + exact ⟨x, ⟨hx, hyn⟩, rfl⟩ + +end Fragment + +end IsCuttingFragment + +/-! ### Connected near a point -/ + +/-- `A` is connected near `v`: inside any neighbourhood of `v` there is a connected part of `A` that +holds +all of `A` near `v`. -/ +def IsConnectedNear (A : Set S) (v : S) : Prop := + ∀ W ∈ 𝓝 v, ∃ B ⊆ A ∩ W, IsPreconnected B ∧ ∃ W' ∈ 𝓝 v, A ∩ W' ⊆ B + +/-- A homeomorphism from a compact space `X` onto `closure A` carries the property to `A` from a +subset of +`X`. If `B ⊆ X` has, for each `ε`-neighbourhood of `p`, a connected part as in `IsConnectedNear`, +then +so does its image. -/ +theorem isConnectedNear_of_homeo {X : Type} [TopologicalSpace X] [CompactSpace X] {L : Set S} + (f : X ≃ₜ L) {Y : Set X} {p : X} + (hY : ∀ W ∈ 𝓝 p, ∃ B ⊆ Y ∩ W, IsPreconnected B ∧ ∃ W' ∈ 𝓝 p, Y ∩ W' ⊆ B) : + IsConnectedNear ((fun x ↦ (f x).1) '' Y) (f p).1 := by + intro W hW + have hcont : Continuous fun x ↦ (f x).1 := continuous_subtype_val.comp f.continuous + obtain ⟨B, hB, hBc, W', hW', hsub⟩ := hY _ (hcont.continuousAt.preimage_mem_nhds hW) + refine ⟨_, ?_, hBc.image _ hcont.continuousOn, ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + exact ⟨mem_image_of_mem _ (hB hx).1, (hB hx).2⟩ + -- The part of `L` far from `p` is compact and misses `f p`. + obtain ⟨O, hOW, hO, hpO⟩ := mem_nhds_iff.mp hW' + have hclosed : IsClosed ((fun x ↦ (f x).1) '' Oᶜ) := + (hO.isClosed_compl.isCompact.image hcont).isClosed + refine ⟨_, hclosed.isOpen_compl.mem_nhds ?_, ?_⟩ + · rintro ⟨x, hx, hxp⟩ + have : x = p := f.injective (Subtype.ext hxp) + exact hx (this ▸ hpO) + · rintro _ ⟨⟨x, hx, rfl⟩, hn⟩ + have hxO : x ∈ O := by + by_contra hxO + exact hn ⟨x, hxO, rfl⟩ + exact mem_image_of_mem _ (hsub ⟨hx, hOW hxO⟩) + +/-- In a convex set `C`, take a finite set `T` and a point `p ∈ T` that is extreme in `C`. Then the +complement of `T` in `C` is connected near `p`: a small ball around `p` with `p` removed is convex. +-/ +theorem connected_near_extreme {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] {C : Set E} {p : + C} + (_hconv : Convex ℝ C) (hext : Convex ℝ (C \ {p.1})) {T : Set C} (hT : T.Finite) (hp : p ∈ T) : + ∀ W ∈ 𝓝 p, ∃ B ⊆ Tᶜ ∩ W, IsPreconnected B ∧ ∃ W' ∈ 𝓝 p, Tᶜ ∩ W' ⊆ B := by + intro W hW + have hcl : (T \ {p})ᶜ ∈ 𝓝 p := + (hT.subset sdiff_subset).isClosed.isOpen_compl.mem_nhds fun h ↦ h.2 rfl + obtain ⟨ε, hε, hsub⟩ := Metric.mem_nhds_iff.mp (Filter.inter_mem hW hcl) + refine ⟨Metric.ball p ε ∩ {p}ᶜ, ?_, ?_, Metric.ball p ε, Metric.ball_mem_nhds p hε, ?_⟩ + · rintro x ⟨hx, hxp⟩ + exact ⟨fun hxT ↦ (hsub hx).2 ⟨hxT, hxp⟩, (hsub hx).1⟩ + · rw [← IsInducing.subtypeVal.isPreconnected_image] + have himg : Subtype.val '' (Metric.ball p ε ∩ {p}ᶜ) = (C \ {p.1}) ∩ Metric.ball p.1 ε := by + ext x + constructor + · rintro ⟨y, ⟨hy, hyp⟩, rfl⟩ + exact ⟨⟨y.2, fun h ↦ hyp (Subtype.ext h)⟩, hy⟩ + · rintro ⟨⟨hxC, hxp⟩, hx⟩ + exact ⟨⟨x, hxC⟩, ⟨hx, fun h ↦ hxp (congrArg Subtype.val h)⟩, rfl⟩ + rw [himg] + exact (hext.inter (convex_ball _ _)).isPreconnected + · rintro x ⟨hxT, hx⟩ + exact ⟨hx, fun h ↦ hxT (h ▸ hp)⟩ + +/-- A point of the unit circle is extreme in the closed disc, since the disc is strictly convex. -/ +theorem convex_disc_sdiff {p : EuclideanPlane} (hp : p ∈ UnitCircle) : + Convex ℝ (ClosedUnitDisc \ {p}) := by + have hstrict : StrictConvex ℝ ClosedUnitDisc := strictConvex_closedBall ℝ _ _ + have hconv : Convex ℝ ClosedUnitDisc := convex_closedBall _ _ + rintro x ⟨hx, hxp⟩ y ⟨hy, hyp⟩ a b ha hb hab + refine ⟨hconv hx hy ha hb hab, fun h ↦ ?_⟩ + have h' : a • x + b • y = p := h + rcases eq_or_lt_of_le ha with rfl | ha' + · have hb1 : b = 1 := by linarith + exact hyp (by simpa [hb1] using h') + rcases eq_or_lt_of_le hb with rfl | hb' + · have ha1 : a = 1 := by linarith + exact hxp (by simpa [ha1] using h') + by_cases hxy : x = y + · subst hxy + rw [← add_smul, hab, one_smul] at h' + exact hxp h' + have hint := hstrict.openSegment_subset hx hy hxy ⟨a, b, ha', hb', hab, h'⟩ + have hint' : p ∈ Metric.ball (0 : EuclideanPlane) 1 := by + have := hint + rwa [ClosedUnitDisc, interior_closedBall _ one_ne_zero] at this + have hp' : dist p 0 = 1 := hp + exact absurd (Metric.mem_ball.mp hint') (by rw [hp']; exact lt_irrefl _) + +/-- An edge of a painting is connected near each of its ends. -/ +theorem Painting.isConnectedNear (Γ : Painting S) {e : Set S} + (he : e ∈ Γ.E) {v : S} (hv : v ∈ tilde e) : IsConnectedNear e v := by + have hfin : (tilde e).Finite := (Γ.finite_V.subset (Γ.tilde_subset_V he)) + have hcore : ∀ {X : Type} [TopologicalSpace X] (f : X ≃ₜ ↥(closure e)) {T : Set X} {p : X}, + f p = v → (∀ x, x ∈ T ↔ (f x).1 ∈ tilde e) → + [CompactSpace X] → + (∀ W ∈ 𝓝 p, ∃ B ⊆ Tᶜ ∩ W, IsPreconnected B ∧ ∃ W' ∈ 𝓝 p, Tᶜ ∩ W' ⊆ B) → + IsConnectedNear e v := by + intro X _ f T p hp hT _ hY + have himg : (fun x ↦ (f x).1) '' Tᶜ = e := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + by_contra hne + exact hx ((hT x).mpr ⟨(f x).2, hne⟩) + · intro hy + refine ⟨f.symm ⟨y, subset_closure hy⟩, fun hx ↦ ?_, by simp⟩ + have := ((hT _).mp hx).2 + simp only [Homeomorph.apply_symm_apply] at this + exact this hy + have h := isConnectedNear_of_homeo f hY + rw [himg, hp] at h + exact h + have hfinT : ∀ {X : Type} [TopologicalSpace X] (f : X ≃ₜ ↥(closure e)), ({x | + (f x).1 ∈ tilde e}).Finite := by + intro X _ f + refine Set.Finite.of_injOn (f := fun x ↦ (f x).1) (t := tilde e) (fun x hx ↦ hx) ?_ hfin + exact fun x _ y _ hxy ↦ f.injective (Subtype.ext hxy) + rcases Γ.edge_shape e he with ⟨-, -, -, hends⟩ | ⟨-, -, ⟨φ⟩, hsub⟩ + · rw [← hends] at hv + obtain ⟨w, f, hf₀, hf₁⟩ := hv + refine hcore f (T := {x | (f x).1 ∈ tilde e}) (p := 0) hf₀ (fun _ ↦ Iff.rfl) ?_ + refine connected_near_extreme (C := Icc (0 : ℝ) 1) (convex_Icc _ _) ?_ (hfinT f) ?_ + · have heq : Icc (0 : ℝ) 1 \ {((0 : unitInterval) : ℝ)} = Ioc 0 1 := by + ext x + simp only [mem_sdiff, mem_Icc, mem_singleton_iff, mem_Ioc, Set.Icc.coe_zero] + constructor + · rintro ⟨⟨h₁, h₂⟩, h₃⟩ + exact ⟨lt_of_le_of_ne h₁ (Ne.symm h₃), h₂⟩ + · rintro ⟨h₁, h₂⟩ + exact ⟨⟨h₁.le, h₂⟩, h₁.ne'⟩ + exact heq ▸ convex_Ioc (0 : ℝ) 1 + · change (f 0).1 ∈ tilde e + rw [hf₀, ← hends] + exact ⟨w, f, hf₀, hf₁⟩ + · have hvb := hsub hv + rw [disc_boundary (closure e) φ] at hvb + obtain ⟨x, hx, hxv⟩ := hvb + have : CompactSpace ClosedUnitDisc := + isCompact_iff_compactSpace.mp (isCompact_closedBall _ _) + refine hcore φ (T := {y | (φ y).1 ∈ tilde e}) (p := x) hxv (fun _ ↦ Iff.rfl) ?_ + refine connected_near_extreme (C := ClosedUnitDisc) (convex_closedBall _ _) + (convex_disc_sdiff hx) (hfinT φ) ?_ + have hxv' : (φ x).1 = v := hxv + change (φ x).1 ∈ tilde e + rw [hxv'] + exact hv + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/PullPainting.lean b/LeanPool/GraphMinor/GM19/PullPainting.lean new file mode 100644 index 0000000000..795c19db3a --- /dev/null +++ b/LeanPool/GraphMinor/GM19/PullPainting.lean @@ -0,0 +1,402 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.PullLift +public import LeanPool.GraphMinor.GM19.ThinPainting +public import LeanPool.GraphMinor.GM19.Section4c + +/-! +# Pulling a painting back to a fragment + +Let `Γ` be a painting in `Σ`, let `K` be a drawing with `U(Γ) ∩ U(K) = V(Γ) ∩ V(K)`, and let `Σ₁` be +a +fragment of `Σ` after cutting along `U(K)`, with associated surjection `ψ`. Graph Minors XIX, +Section 5 +(page 336) defines the painting `ψ⁻¹(Γ) ∩ Σ₁` by +`U₁ = ψ⁻¹(U(Γ)) ∪ bd(Σ₁)` and `V₁ = ψ⁻¹(V(Γ) ∪ V(K))`. + +Its edges are of two kinds. The inner edges are the lifts of the edges of `Γ` that lie in the part +of `Σ` +that `Σ₁` covers, and such an edge has the same shape as the edge of `Γ` by `homeoClosure`. The +others are +the open arcs of `bd(Σ₁)` between points of `V₁`, and these are lines as long as each cuff of `Σ₁` +has two +points of `V₁`. That is a real condition. Cutting along a loop with one vertex gives a cuff with one +vertex, which no painting has. So we ask for it (`PullData.two`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S S₁ : Type} [TopologicalSpace S] [TopologicalSpace S₁] [T2Space S] [T2Space S₁] + +/-- The set `V₁ = ψ⁻¹(V(Γ) ∪ V(K))`. -/ +def pullV (Γ : Painting S) (K : Drawing S) (ψ : S₁ → S) : Set S₁ := ψ ⁻¹' (Γ.V ∪ K.V) + +/-- The set `U₁ = ψ⁻¹(U(Γ)) ∪ bd(Σ₁)`. -/ +def pullU (Γ : Painting S) (ψ : S₁ → S) : Set S₁ := ψ ⁻¹' Γ.U ∪ bd S₁ + +/-- The hypotheses of the pull-back. -/ +structure PullData (Γ : Painting S) (K : Drawing S) (ψ : S₁ → S) : Prop where + surface : IsSurface S + frag : IsCuttingFragment S K S₁ ψ + inter : Γ.U ∩ K.U ⊆ Γ.V ∩ K.V + two : ∀ C : cuffs S₁, ∃ p ∈ pullV Γ K ψ ∩ C.1, ∃ q ∈ pullV Γ K ψ ∩ C.1, p ≠ q + +/-- The lifts of the inner edges of `Γ`. -/ +def liftPieces (Γ : Painting S) (ψ : S₁ → S) : Set (Set S₁) := + {p | ∃ e ∈ Γ.E, ¬ Painting.IsBorder e ∧ p.Nonempty ∧ p = ψ ⁻¹' e} + +/-- The edges of the pull-back. -/ +def pullPieces (Γ : Painting S) (K : Drawing S) (ψ : S₁ → S) : Set (Set S₁) := + arcComponentsIn (bd S₁ \ pullV Γ K ψ) ∪ liftPieces Γ ψ + +namespace PullData + +variable {Γ : Painting S} {K : Drawing S} {ψ : S₁ → S} (d : PullData Γ K ψ) +include d + +omit [T2Space S] [T2Space S₁] in +theorem isClosed_bd : IsClosed (bd S₁) := (cuff_statement S₁ d.frag.isSurface).1 + +omit [T2Space S] [T2Space S₁] in +theorem isOpen_R : IsOpen (IsCuttingFragment.R ψ) := + d.frag.isOpen_R d.surface K.isClosed_U + +omit [T2Space S] [T2Space S₁] in +theorem finite_pullV : (pullV Γ K ψ).Finite := + (Γ.finite_V.union K.finite_V).preimage' fun y _ ↦ d.frag.finite_fibres y + +omit [T2Space S] [T2Space S₁] in +theorem disjoint_K {e : Set S} (he : e ∈ Γ.E) : Disjoint e K.U := by + refine disjoint_left.mpr fun x hx hxK ↦ ?_ + exact Γ.disjoint_V he hx (d.inter ⟨he.2.1 hx |>.1, hxK⟩).1 + +omit [T2Space S] [T2Space S₁] in +theorem subset_R {e : Set S} (he : e ∈ Γ.E) (hb : ¬ Painting.IsBorder e) + (hne : (ψ ⁻¹' e).Nonempty) : e ⊆ IsCuttingFragment.R ψ := by + obtain ⟨x, hx⟩ := hne + have hoff : e ⊆ (bd S ∪ K.U)ᶜ := by + rintro y hy (hyb | hyK) + · exact hb ⟨y, hy, hyb⟩ + · exact disjoint_left.mp (d.disjoint_K he) hy hyK + have hxi : x ∉ bd S₁ := fun hxb ↦ hoff hx (d.frag.maps_bd (mem_image_of_mem ψ hxb)) + obtain ⟨z, hz, hzc⟩ := d.frag.interior_component + have hxR : ψ x ∈ connectedComponentIn (bd S ∪ K.U)ᶜ z := by + rw [hzc] + exact mem_image_of_mem ψ hxi + have hsub := he.2.2.1.isConnected.isPreconnected.subset_connectedComponentIn hx hoff + rw [← connectedComponentIn_eq hxR] at hsub + rwa [IsCuttingFragment.R, ← hzc] + +omit [T2Space S] [T2Space S₁] in +theorem preimage_subset_int {e : Set S} (hsub : e ⊆ IsCuttingFragment.R ψ) : + ψ ⁻¹' e ⊆ (bd S₁)ᶜ := fun _ hx ↦ d.frag.mem_R_iff.mp (hsub hx) + +omit [T2Space S] [T2Space S₁] in +theorem mem_bd_of_notMem_R {x : S₁} (hx : ψ x ∈ bd S ∪ K.U) : x ∈ bd S₁ := by + by_contra hn + exact disjoint_left.mp d.frag.disjoint_R (mem_image_of_mem ψ hn) hx + +omit [T2Space S] [T2Space S₁] in +/-- A point of `V₁` over `V(K)`, or any point over `U(K)`, lies on the boundary. -/ +theorem pullV_subset : pullV Γ K ψ ⊆ pullU Γ ψ := by + rintro x (hx | hx) + · exact Or.inl (Γ.V_subset hx) + · exact Or.inr (d.mem_bd_of_notMem_R (Or.inr (K.V_subset_U hx))) + +omit [T2Space S] in +theorem finite_pieces : (pullPieces Γ K ψ).Finite := by + refine (finite_arcComponentsIn_bd d.frag.isSurface d.finite_pullV d.two).union ?_ + refine (Γ.finite_edges.image fun e ↦ ψ ⁻¹' e).subset ?_ + rintro p ⟨e, he, -, -, rfl⟩ + exact mem_image_of_mem _ he + +/-- The pieces are the edges: they are connected, disjoint, closed in `U₁ \ V₁`, and cover `U₁ \ +V₁`. -/ +theorem arcComponentsIn_eq : arcComponentsIn (pullU Γ ψ \ pullV Γ K ψ) = pullPieces Γ K ψ := by + have hSur := d.frag.isSurface + have hR := d.isOpen_R + have hbd := d.isClosed_bd + have har := fun {p} (hp : p ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ)) ↦ + exists_arc_of_mem hSur (fun C ↦ ((cuff_statement S₁ hSur).2.2 C.1 C.2).some) d.finite_pullV + d.two hp + refine arcComponentsIn_of_pieces d.finite_pieces ?_ ?_ ?_ ?_ + · rintro p (hp | ⟨e, he, hb, hne, rfl⟩) + · exact hp.2.2.1 + · exact d.frag.isPathConnected_preimage hbd hR (d.subset_R he hb hne) he.2.2.1 + · have hbl : ∀ {p q}, p ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ) → q ∈ liftPieces Γ ψ → + Disjoint p q := by + rintro p _ hp ⟨e, he, hb, hne, rfl⟩ + exact disjoint_left.mpr fun x hxp hxq ↦ + d.preimage_subset_int (d.subset_R he hb hne) hxq (hp.2.1 hxp).1 + rintro p (hp | hp) q (hq | hq) hne + · exact disjoint_iff_forall_ne.mpr fun x hx y hy he ↦ hne + (arcComp_eq_of_mem hp hq hx (he ▸ hy)) + · exact hbl hp hq + · exact (hbl hq hp).symm + · obtain ⟨e, he, -, -, rfl⟩ := hp + obtain ⟨e', he', -, -, rfl⟩ := hq + have hee : e ≠ e' := fun h ↦ hne (h ▸ rfl) + refine disjoint_left.mpr fun x hx hx' ↦ hee ?_ + exact arcComp_eq_of_mem he he' hx hx' + · rintro p (hp | ⟨e, he, hb, hne, rfl⟩) x ⟨hxc, hxU, hxV⟩ + · obtain ⟨C, a, b, hab, hub, rfl, -, ha, hb⟩ := har hp + by_contra hxn + have ht : x ∈ tilde (arcOf _ a b) := ⟨hxc, hxn⟩ + rw [tilde_arcOf _ hab hub] at ht + rcases ht with rfl | rfl + · exact hxV ha + · exact hxV hb + · by_contra hxn + have hsur := d.frag.image_tilde_preimage (d.subset_R he hb hne) + have ht : ψ x ∈ tilde e := hsur ▸ mem_image_of_mem ψ ⟨hxc, hxn⟩ + exact hxV (Or.inl (Γ.tilde_subset_V he ht)) + · ext x + constructor + · rintro ⟨hxU | hxb, hxV⟩ + · have hxV' : ψ x ∉ Γ.V := fun h ↦ hxV (Or.inl h) + obtain ⟨e, he, hxe⟩ := exists_arcComp_superset (F := Γ.U \ Γ.V) + (isPathConnected_singleton (ψ x)) (singleton_subset_iff.mpr ⟨hxU, hxV'⟩) + have hxe' : ψ x ∈ e := hxe rfl + by_cases hb : Painting.IsBorder e + · have hxb : ψ x ∈ bd S := (Γ.border_edge e he hb).2 hxe' + have hxi := d.mem_bd_of_notMem_R (Or.inl hxb) + obtain ⟨p, hp, hxp⟩ := exists_arcComp_superset (F := bd S₁ \ pullV Γ K ψ) + (isPathConnected_singleton x) (singleton_subset_iff.mpr ⟨hxi, hxV⟩) + exact ⟨p, Or.inl hp, hxp rfl⟩ + · exact ⟨ψ ⁻¹' e, Or.inr ⟨e, he, hb, ⟨x, hxe'⟩, rfl⟩, hxe'⟩ + · obtain ⟨p, hp, hxp⟩ := exists_arcComp_superset (F := bd S₁ \ pullV Γ K ψ) + (isPathConnected_singleton x) (singleton_subset_iff.mpr ⟨hxb, hxV⟩) + exact ⟨p, Or.inl hp, hxp rfl⟩ + · rintro ⟨p, hp | ⟨e, he, hb, hne, rfl⟩, hxp⟩ + · exact ⟨Or.inr (hp.2.1 hxp).1, (hp.2.1 hxp).2⟩ + · refine ⟨Or.inl (he.2.1 hxp).1, ?_⟩ + rintro (hxV | hxK) + · exact (he.2.1 hxp).2 hxV + · exact disjoint_left.mp (d.disjoint_K he) hxp (K.V_subset_U hxK) + +/-! ### The shape of a lifted edge -/ + +variable {e : Set S} + +theorem injOn_closure (he : e ∈ Γ.E) (hsub : e ⊆ IsCuttingFragment.R ψ) : + InjOn ψ (closure (ψ ⁻¹' e)) := by + intro x hx y hy hxy + have h := (d.frag.bijective_closureMap d.isClosed_bd d.isOpen_R hsub + (fun _ hv ↦ Γ.isConnectedNear he hv)).1 (a₁ := ⟨x, hx⟩) (a₂ := ⟨y, hy⟩) (Subtype.ext hxy) + exact congrArg Subtype.val h + +theorem ncard_tilde (he : e ∈ Γ.E) (hsub : e ⊆ IsCuttingFragment.R ψ) : + (tilde (ψ ⁻¹' e)).ncard = (tilde e).ncard := by + rw [← d.frag.image_tilde_preimage hsub] + exact ((d.injOn_closure he hsub).mono sdiff_subset).ncard_image.symm + +theorem finite_tilde (he : e ∈ Γ.E) (hsub : e ⊆ IsCuttingFragment.R ψ) : + (tilde (ψ ⁻¹' e)).Finite := by + have hfin : (ψ '' tilde (ψ ⁻¹' e)).Finite := by + rw [d.frag.image_tilde_preimage hsub] + exact Γ.finite_V.subset (Γ.tilde_subset_V he) + exact Set.Finite.of_finite_image hfin ((d.injOn_closure he hsub).mono sdiff_subset) + +/-- The closure of a lifted edge is homeomorphic to the closure of the edge, by `ψ`. -/ +noncomputable def edgeHomeo (he : e ∈ Γ.E) (hsub : e ⊆ IsCuttingFragment.R ψ) : + ↥(closure (ψ ⁻¹' e)) ≃ₜ ↥(closure e) := + d.frag.homeoClosure d.isClosed_bd d.isOpen_R hsub (fun _ hv ↦ Γ.isConnectedNear he hv) + +theorem edgeHomeo_apply (he : e ∈ Γ.E) (hsub : e ⊆ IsCuttingFragment.R ψ) + (x : ↥(closure (ψ ⁻¹' e))) : (d.edgeHomeo he hsub x).1 = ψ x.1 := rfl + +/-- The ends of a lifted line are the points of `tilde` of the lift. -/ +theorem lineEnds_closure (he : e ∈ Γ.E) (hsub : e ⊆ IsCuttingFragment.R ψ) + (hends : lineEnds (closure e) = tilde e) : + lineEnds (closure (ψ ⁻¹' e)) = tilde (ψ ⁻¹' e) := by + have hinj := d.injOn_closure he hsub + have himg := d.frag.image_tilde_preimage hsub + let H := d.edgeHomeo he hsub + ext u + constructor + · rintro ⟨w, f, hf₀, hf₁⟩ + have hu : ψ u ∈ tilde e := by + rw [← hends] + refine ⟨ψ w, f.trans H, ?_, ?_⟩ + · change (H (f 0)).1 = ψ u + rw [d.edgeHomeo_apply he hsub, hf₀] + · change (H (f 1)).1 = ψ w + rw [d.edgeHomeo_apply he hsub, hf₁] + rw [← himg] at hu + obtain ⟨x, hx, hxu⟩ := hu + have hucl : u ∈ closure (ψ ⁻¹' e) := hf₀ ▸ (f 0).2 + exact hinj hx.1 hucl hxu ▸ hx + · intro hu + have hv : ψ u ∈ tilde e := himg ▸ mem_image_of_mem ψ hu + rw [← hends] at hv + obtain ⟨w, g, hg₀, hg₁⟩ := hv + refine ⟨(H.symm (g 1)).1, g.trans H.symm, ?_, rfl⟩ + change (H.symm (g 0)).1 = u + refine hinj (Subtype.property _) hu.1 ?_ + rw [← d.edgeHomeo_apply he hsub, Homeomorph.apply_symm_apply, hg₀] + +theorem tilde_subset_discBd (he : e ∈ Γ.E) (hsub : e ⊆ IsCuttingFragment.R ψ) + (hd : tilde e ⊆ discBd (closure e)) : tilde (ψ ⁻¹' e) ⊆ discBd (closure (ψ ⁻¹' e)) := by + have hinj := d.injOn_closure he hsub + have himg := d.frag.image_tilde_preimage hsub + let H := d.edgeHomeo he hsub + intro u hu + obtain ⟨y, hy, hyu⟩ := hd (himg ▸ mem_image_of_mem ψ hu) + refine ⟨H.symm y, ?_, ?_⟩ + · rw [← image_bd H.symm] + exact mem_image_of_mem _ hy + · refine hinj (Subtype.property _) hu.1 ?_ + rw [← d.edgeHomeo_apply he hsub, Homeomorph.apply_symm_apply, hyu] + +/-- The shape of a lifted edge. -/ +theorem edge_shape_lift (he : e ∈ Γ.E) (hsub : e ⊆ IsCuttingFragment.R ψ) : + ((tilde (ψ ⁻¹' e)).ncard = 2 ∧ (tilde (ψ ⁻¹' e)).Finite ∧ IsLine (closure (ψ ⁻¹' e)) ∧ + lineEnds (closure (ψ ⁻¹' e)) = tilde (ψ ⁻¹' e)) ∨ + ((tilde (ψ ⁻¹' e)).ncard = 3 ∧ (tilde (ψ ⁻¹' e)).Finite ∧ IsClosedDisc (closure (ψ ⁻¹' e)) ∧ + tilde (ψ ⁻¹' e) ⊆ discBd (closure (ψ ⁻¹' e))) := by + have hc := d.ncard_tilde he hsub + have hf := d.finite_tilde he hsub + let H := d.edgeHomeo he hsub + rcases Γ.edge_shape e he with ⟨h₂, -, ⟨f⟩, hends⟩ | ⟨h₃, -, ⟨φ⟩, hs⟩ + · exact Or.inl ⟨hc.trans h₂, hf, ⟨f.trans H.symm⟩, d.lineEnds_closure he hsub hends⟩ + · exact Or.inr ⟨hc.trans h₃, hf, ⟨φ.trans H.symm⟩, d.tilde_subset_discBd he hsub hs⟩ + +end PullData + +/-! ### The painting -/ + +/-- The march of a lifted edge. -/ +noncomputable def liftMarch [Nonempty S₁] (Γ : Painting S) (ψ : S₁ → S) (p : Set S₁) : List S₁ := + (Γ.γ (ψ '' p)).map (Function.invFunOn ψ (tilde p)) + +open Classical in +/-- The marches of the pull-back: `γb` on the boundary arcs, and the lift of `γ_Γ` on the others. -/ +noncomputable def pullγ [Nonempty S₁] (Γ : Painting S) (ψ : S₁ → S) + (γb : Set S₁ → List S₁) (p : Set S₁) : List S₁ := + if p ∈ liftPieces Γ ψ then liftMarch Γ ψ p else γb p + +namespace PullData + +variable {Γ : Painting S} {K : Drawing S} {ψ : S₁ → S} (d : PullData Γ K ψ) +include d + +theorem liftMarch_spec [Nonempty S₁] {e : Set S} (he : e ∈ Γ.E) (hsub : e ⊆ IsCuttingFragment.R ψ) : + (liftMarch Γ ψ (ψ ⁻¹' e)).Nodup ∧ {v | v ∈ liftMarch Γ ψ (ψ ⁻¹' e)} = tilde (ψ ⁻¹' e) := by + have hsur : ψ '' (ψ ⁻¹' e) = e := image_preimage_eq_of_subset (hsub.trans + (image_subset_range _ _)) + have hinj := (d.injOn_closure he hsub).mono (sdiff_subset (t := ψ ⁻¹' e)) + have himg := d.frag.image_tilde_preimage hsub + have hright : ∀ y ∈ tilde e, Function.invFunOn ψ (tilde (ψ ⁻¹' e)) y ∈ tilde (ψ ⁻¹' e) ∧ + ψ (Function.invFunOn ψ (tilde (ψ ⁻¹' e)) y) = y := fun y hy ↦ by + exact + have hy' : y ∈ ψ '' tilde (ψ ⁻¹' e) := himg ▸ hy + ⟨Function.invFunOn_mem hy', Function.invFunOn_eq hy'⟩ + have hset : ∀ v, v ∈ Γ.γ e ↔ v ∈ tilde e := fun v ↦ by + have := Γ.γ_set e he + exact Set.ext_iff.mp this v + rw [liftMarch, hsur] + constructor + · refine List.Nodup.map_on (fun x hx y hy hxy ↦ ?_) (Γ.γ_nodup e he) + rw [← (hright x ((hset x).mp hx)).2, hxy, (hright y ((hset y).mp hy)).2] + · ext v + simp only [mem_ofPred_eq, List.mem_map] + constructor + · rintro ⟨y, hy, rfl⟩ + exact (hright y ((hset y).mp hy)).1 + · intro hv + have hy : ψ v ∈ tilde e := himg ▸ mem_image_of_mem ψ hv + refine ⟨ψ v, (hset _).mpr hy, ?_⟩ + exact hinj (hright _ hy).1 hv (hright _ hy).2 + +omit [T2Space S] in +/-- A boundary arc has the shape of a border edge. -/ +theorem exists_ends {p : Set S₁} (hp : p ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ)) : + ∃ u v, u ≠ v ∧ tilde p = {u, v} ∧ IsLineWithEnds (closure p) u v := by + have hSur := d.frag.isSurface + let par : ∀ C : cuffs S₁, Circle ≃ₜ C.1 := fun C ↦ ((cuff_statement S₁ hSur).2.2 C.1 C.2).some + obtain ⟨C, a, b, hab, hub, rfl, -, -, -⟩ := exists_arc_of_mem hSur par d.finite_pullV d.two hp + have hL := isLine_arcOf (par C) hab hub + exact ⟨_, _, (GM20.line_facts hL).1, tilde_arcOf (par C) hab hub, hL⟩ + +omit [T2Space S] [T2Space S₁] in +theorem notMem_liftPieces {p : Set S₁} (hp : p ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ)) : + p ∉ liftPieces Γ ψ := by + rintro ⟨e, he, hb, hne, rfl⟩ + obtain ⟨x, hx⟩ := hne + exact d.preimage_subset_int (d.subset_R he hb ⟨x, hx⟩) hx (hp.2.1 hx).1 + +end PullData + +omit [T2Space S] [T2Space S₁] in +theorem pullγ_lift [Nonempty S₁] {Γ : Painting S} {ψ : S₁ → S} {γb : Set S₁ → List S₁} {p : Set S₁} + (hp : p ∈ liftPieces Γ ψ) : pullγ Γ ψ γb p = liftMarch Γ ψ p := by + simp [pullγ, hp] + +omit [T2Space S] [T2Space S₁] in +theorem pullγ_arc [Nonempty S₁] {Γ : Painting S} {ψ : S₁ → S} {γb : Set S₁ → List S₁} {p : Set S₁} + (hp : p ∉ liftPieces Γ ψ) : pullγ Γ ψ γb p = γb p := by + simp [pullγ, hp] + +/-- **The painting `ψ⁻¹(Γ) ∩ Σ₁`** (Graph Minors XIX, Section 5, page 336). The marches of the +boundary +arcs are given by `γb`. -/ +noncomputable def pullPainting [Nonempty S₁] {Γ : Painting S} {K : Drawing S} {ψ : S₁ → S} + (d : PullData Γ K ψ) (γb : Set S₁ → List S₁) + (hγ₁ : ∀ p ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ), (γb p).Nodup) + (hγ₂ : ∀ p ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ), {v | v ∈ γb p} + = tilde p) : Painting S₁ where + U := pullU Γ ψ + V := pullV Γ K ψ + γ := pullγ Γ ψ γb + isClosed_U := (Γ.isClosed_U.preimage d.frag.continuous_ψ).union d.isClosed_bd + V_subset := d.pullV_subset + finite_V := d.finite_pullV + bd_subset := subset_union_right + finite_edges := by + rw [d.arcComponentsIn_eq] + exact d.finite_pieces + edge_shape := by + rw [d.arcComponentsIn_eq] + rintro p (hp | ⟨e, he, hb, hne, rfl⟩) + · obtain ⟨u, v, huv, ht, hL⟩ := d.exists_ends hp + obtain ⟨f, -⟩ := id hL + exact Or.inl ⟨by rw [ht, ncard_pair huv], by rw [ht]; exact (finite_singleton v).insert u, + ⟨f⟩, + by rw [ht]; exact (GM20.line_facts hL).2.2.2⟩ + · exact d.edge_shape_lift he (d.subset_R he hb hne) + γ_nodup := by + rw [d.arcComponentsIn_eq] + rintro p (hp | hp) + · rw [pullγ_arc (d.notMem_liftPieces hp)] + exact hγ₁ p hp + · rw [pullγ_lift hp] + obtain ⟨e, he, hb, hne, rfl⟩ := hp + exact (d.liftMarch_spec he (d.subset_R he hb hne)).1 + γ_set := by + rw [d.arcComponentsIn_eq] + rintro p (hp | hp) + · rw [pullγ_arc (d.notMem_liftPieces hp)] + exact hγ₂ p hp + · rw [pullγ_lift hp] + obtain ⟨e, he, hb, hne, rfl⟩ := hp + exact (d.liftMarch_spec he (d.subset_R he hb hne)).2 + border_edge := by + rw [d.arcComponentsIn_eq] + rintro p (hp | ⟨e, he, hb, hne, rfl⟩) ⟨x, hxp, hxb⟩ + · obtain ⟨u, v, huv, ht, -⟩ := d.exists_ends hp + exact ⟨by rw [ht, ncard_pair huv], fun y hy ↦ (hp.2.1 hy).1⟩ + · exact absurd hxb (d.preimage_subset_int (d.subset_R he hb hne) hxp) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/PushSide.lean b/LeanPool/GraphMinor/GM19/PushSide.lean new file mode 100644 index 0000000000..3b465d16d0 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/PushSide.lean @@ -0,0 +1,54 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.PushOff + +/-! +# Pushing a closed set off a disc across its boundary + +Here is a form of `GraphMinor.Surface.push_off` for a disc `D` and a line `L` in the boundary of +`D`, with +the same local construction. A closed set that meets `L` only in its ends moves off `D`. +The fixed set `Z` meets `D` only in `L`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric Filter GraphMinor.Surface + +universe u + +theorem push_off_side {S : Type u} [TopologicalSpace S] (hS : IsSurface S) {ι : Type} [Finite ι] + {N Z : Set S} {D L : ι → Set S} (hN : N.Finite) (hZ : IsClosed Z) (hD : ∀ i, IsClosedDisc (D i)) + (hL : ∀ i, ∃ a b, IsLineWithEnds (L i) a b ∧ D i ∩ N = {a, b} ∧ L i ⊆ discBd (D i) ∧ + D i ∩ bd S ⊆ N) + (hDD : ∀ i j, i ≠ j → D i ∩ D j ⊆ N) (hDZ : ∀ i, D i ∩ Z ⊆ L i) + {F : Set S} (hF : IsOArc F) (hFZ : F ∩ Z ⊆ N) (hFL : ∀ i, F ∩ L i ⊆ N) : + ∃ h : S ≃ₜ S, (∀ n ∈ N, h n = n) ∧ (h '' F) ∩ Z ⊆ N ∧ ∀ i, (h '' F) ∩ D i ⊆ N := by + refine push_off_discs hS hN hZ hD ?_ hDD hF hFZ hFL + intro i + obtain ⟨a, b, hLi, hDN, hLb, hbdN⟩ := hL i + have haL : a ∈ L i := by + obtain ⟨f, h0, _⟩ := hLi + exact h0 ▸ (f 0).2 + have hbL : b ∈ L i := by + obtain ⟨f, _, h1⟩ := hLi + exact h1 ▸ (f 1).2 + have hNL : D i ∩ N ⊆ L i := by + rw [hDN] + rintro _ (rfl | rfl) + · exact haL + · exact hbL + exact ⟨a, b, hLi, hDN, hLb haL, hLb hbL, hLb.trans (discBd_subset _), + .inr ⟨hLb, fun y hy => hNL ⟨hy.1, hbdN hy⟩, hDZ i⟩⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/RadialExists.lean b/LeanPool/GraphMinor/GM19/RadialExists.lean new file mode 100644 index 0000000000..2795db6433 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/RadialExists.lean @@ -0,0 +1,1135 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Defs2 +public import LeanPool.GraphMinor.GM11.RadialExists +public import LeanPool.GraphMinor.GM11.ArcDrawings +public import LeanPool.GraphMinor.Surface.DiscMerge +public import LeanPool.GraphMinor.Surface.Disc +public import LeanPool.GraphMinor.Surface.OpenDisc +public import Mathlib.Analysis.Convex.PathConnected + +/-! +# Radial drawings of paintings of Graph Minors XIX + +Graph Minors XIX, Section 5 (page 337), uses a radial drawing of a 2-cell painting `Γ` in `Σ̂`, and +Graph Minors XI, Section 3 (page 75), says that it exists. A painting of XIX may have both line +edges +and disc edges, so it is neither a painting nor a drawing of XI, and `GM11.exists_radialDrawing` +does +not apply to it. Here we reduce to the drawing `sk(Γ)` of XI. + +The regions of `sk(Γ)` in `Σ̂` are the regions of `Γ` and the insides of the discs of the edges of +size 3. A drawing that satisfies conditions (i)–(iv) for `Γ`, with one more isolated vertex inside +each +such disc, satisfies them for `sk(Γ)`. So `GM11.ncard_spokes_le` bounds its number of edges, and a +drawing with the most edges is a radial drawing of `Γ` (`Painting.exists_radialDrawing`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface unitInterval + +universe u + +section Arc + +variable {X Y : Type u} [TopologicalSpace X] [TopologicalSpace Y] + +instance : PathConnectedSpace I := + isPathConnected_iff_pathConnectedSpace.1 ((convex_Icc (0 : ℝ) 1).isPathConnected ⟨0, by simp⟩) + +theorem exists_arcComp_superset {F C : Set X} (hC : IsPathConnected C) (hCF : C ⊆ F) : + ∃ c ∈ arcComponentsIn F, C ⊆ c := by + obtain ⟨x, hx⟩ := hC.nonempty + have hc : IsPathConnected (pathComponentIn F x) := isPathConnected_pathComponentIn (hCF hx) + refine ⟨_, ⟨⟨x, mem_pathComponentIn_self (hCF hx)⟩, pathComponentIn_subset, hc, + fun D hDF hD hcD ↦ ?_⟩, fun y hy ↦ (hC.joinedIn x hx y hy).mono hCF⟩ + refine Subset.antisymm (fun y hy ↦ ?_) hcD + exact (hD.joinedIn x (hcD (mem_pathComponentIn_self (hCF hx))) y hy).mono hDF + +theorem arcComp_eq_of_mem {F a b : Set X} (ha : a ∈ arcComponentsIn F) (hb : b ∈ arcComponentsIn F) + {x : X} (hxa : x ∈ a) (hxb : x ∈ b) : a = b := by + have hu : IsPathConnected (a ∪ b) := ha.2.2.1.union hb.2.2.1 ⟨x, hxa, hxb⟩ + have h₁ := ha.2.2.2 (a ∪ b) (union_subset ha.2.1 hb.2.1) hu subset_union_left + have h₂ := hb.2.2.2 (a ∪ b) (union_subset ha.2.1 hb.2.1) hu subset_union_right + rw [← h₁, h₂] + +theorem mem_arcComp_of_path {F e : Set X} (he : e ∈ arcComponentsIn F) {φ : I → X} + (hφ : Continuous φ) (hF : ∀ t, φ t ∈ F) (h1 : φ 1 ∈ e) : φ 0 ∈ e := by + have hK : IsPathConnected (φ '' univ) := isPathConnected_univ.image hφ + have hu := he.2.2.1.union hK ⟨φ 1, h1, mem_image_of_mem _ (mem_univ _)⟩ + have h := he.2.2.2 _ (union_subset he.2.1 (by rintro _ ⟨t, -, rfl⟩; exact hF t)) hu + subset_union_left + rw [← h] + exact Or.inr (mem_image_of_mem _ (mem_univ _)) + +theorem arcComponentsIn_image {ι : X → Y} (hι : IsEmbedding ι) {F : Set X} {C : Set Y} + (hC : C ∈ arcComponentsIn (ι '' F)) : ∃ c ∈ arcComponentsIn F, ι '' c = C := by + have hCr : ι '' (ι ⁻¹' C) = C := image_preimage_eq_of_subset (hC.2.1.trans + (image_subset_range _ _)) + have hpc : IsPathConnected (ι ⁻¹' C) := by + rw [hι.isInducing.isPathConnected_iff, hCr] + exact hC.2.2.1 + have hsub : ι ⁻¹' C ⊆ F := fun x hx ↦ by + obtain ⟨y, hy, hyx⟩ := hC.2.1 hx + exact hι.injective hyx ▸ hy + refine ⟨ι ⁻¹' C, ⟨hpc.nonempty, hsub, hpc, fun D hDF hD hCD ↦ ?_⟩, hCr⟩ + have h := hC.2.2.2 (ι '' D) (image_mono hDF) (hD.image hι.continuous) + (by rw [← hCr]; exact image_mono hCD) + rw [← h, preimage_image_eq _ hι.injective] + +theorem connectedComponentIn_union_left {A B : Set X} (hA : IsOpen A) (hB : IsOpen B) + (hd : Disjoint A B) {x : X} (hx : x ∈ A) : + connectedComponentIn (A ∪ B) x = connectedComponentIn A x := by + refine Subset.antisymm ?_ (connectedComponentIn_mono _ subset_union_left) + have hc : IsPreconnected (connectedComponentIn (A ∪ B) x) := isPreconnected_connectedComponentIn + have hxc : x ∈ connectedComponentIn (A ∪ B) x := mem_connectedComponentIn (Or.inl hx) + have hs : connectedComponentIn (A ∪ B) x ⊆ A := + hc.subset_left_of_subset_union hA hB hd (connectedComponentIn_subset _ _) ⟨x, hxc, hx⟩ + exact hc.subset_connectedComponentIn hxc hs + +end Arc + +variable {S : Type u} [TopologicalSpace S] + +namespace Painting + +theorem isDisc_of_three (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) (h3 : (tilde e).ncard = 3) : + IsClosedDisc (closure e) ∧ tilde e ⊆ discBd (closure e) ∧ (tilde e).Finite := by + rcases Γ.edge_shape e he with h | h + · have := h.1 + omega + · exact ⟨h.2.2.1, h.2.2.2, h.2.1⟩ + +theorem size_cases (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) : + (tilde e).ncard = 2 ∨ (tilde e).ncard = 3 := by + rcases Γ.edge_shape e he with h | h + · exact Or.inl h.1 + · exact Or.inr h.1 + +theorem closure_subset_U (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) : closure e ⊆ Γ.U := + closure_minimal (he.2.1.trans sdiff_subset) Γ.isClosed_U + +theorem disjoint_V (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) {x : S} (hx : x ∈ e) : x ∉ Γ.V := + (he.2.1 hx).2 + +/-- A line edge, with its ends written out. -/ +theorem exists_line (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) (h2 : (tilde e).ncard = 2) : + ∃ (f : I ≃ₜ closure e), (f 0).1 ≠ (f 1).1 ∧ tilde e = {(f 0).1, (f 1).1} := by + rcases Γ.edge_shape e he with h | h + · obtain ⟨-, hfin, ⟨f⟩, hends⟩ := h + have hne : (f 0).1 ≠ (f 1).1 := fun h ↦ by + have := f.injective (Subtype.ext h) + exact zero_ne_one this + have h0 : (f 0).1 ∈ tilde e := hends ▸ ⟨(f 1).1, f, rfl, rfl⟩ + have h1 : (f 1).1 ∈ tilde e := by + rw [← hends] + refine ⟨(f 0).1, (unitInterval.symmHomeomorph.trans f), ?_, ?_⟩ <;> simp + refine ⟨f, hne, ?_⟩ + have hsub : ({(f 0).1, (f 1).1} : Set S) ⊆ tilde e := by + rintro x (rfl | rfl) + · exact h0 + · exact h1 + refine (eq_of_subset_of_ncard_le hsub ?_ hfin).symm + rw [ncard_pair hne, h2] + · have := h.1 + omega + +/-- The set `eTilde` consists of vertices of `Γ`. -/ +theorem tilde_subset_V (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) : tilde e ⊆ Γ.V := by + intro x hx + by_contra hxV + have hxU : x ∈ Γ.U := Γ.closure_subset_U he hx.1 + have hmem : ∀ y, y ∈ e ∨ y = x → y ∈ Γ.U \ Γ.V := by + rintro y (hy | rfl) + · exact he.2.1 hy + · exact ⟨hxU, hxV⟩ + rcases Γ.size_cases he with h2 | h3 + · obtain ⟨f, hne, hset⟩ := Γ.exists_line he h2 + have hsame : ∀ t : I, t ≠ 0 → t ≠ 1 → (f t).1 ∈ e := by + intro t h0 h1 + by_contra hn + have : (f t).1 ∈ tilde e := ⟨(f t).2, hn⟩ + rw [hset] at this + rcases this with h | h + · exact h0 (f.injective (Subtype.ext h)) + · exact h1 (f.injective (Subtype.ext h)) + let half : I := ⟨1 / 2, by norm_num, by norm_num⟩ + have hhalf : (f half).1 ∈ e := hsame half + (fun h ↦ by have := congrArg Subtype.val h; norm_num [half] at this) + (fun h ↦ by have := congrArg Subtype.val h; norm_num [half] at this) + have hx' : x = (f 0).1 ∨ x = (f 1).1 := by + rw [hset] at hx + exact hx + rcases hx' with rfl | rfl + · let φ : I → S := fun t ↦ (f ⟨t.1 / 2, by have := t.2.1; positivity, by + have := t.2.2; linarith⟩).1 + have hφ : Continuous φ := by + refine continuous_subtype_val.comp (f.continuous.comp (Continuous.subtype_mk ?_ _)) + exact continuous_subtype_val.div_const 2 + have h0 : φ 0 = (f 0).1 := by + simp only [φ] + congr 2 + exact Subtype.ext (by simp) + have h1 : φ 1 = (f half).1 := by + simp only [φ] + congr 2 + refine hx.2 (h0 ▸ mem_arcComp_of_path he hφ (fun t ↦ hmem _ ?_) (h1 ▸ hhalf)) + by_cases ht : t = 0 + · exact Or.inr (by rw [ht]; exact h0) + · refine Or.inl (hsame _ (fun h ↦ ht (Subtype.ext ?_)) (fun h ↦ ?_)) + · have := congrArg Subtype.val h + simp only [Icc.coe_zero] at this + simpa using (by linarith : t.1 = 0) + · have := congrArg Subtype.val h + have ht1 := t.2.2 + simp only [Icc.coe_one] at this + linarith + · let φ : I → S := fun t ↦ (f ⟨1 - t.1 / 2, by have := t.2.2; linarith, by + have := t.2.1; linarith⟩).1 + have hφ : Continuous φ := by + refine continuous_subtype_val.comp (f.continuous.comp (Continuous.subtype_mk ?_ _)) + exact continuous_const.sub (continuous_subtype_val.div_const 2) + have h0 : φ 0 = (f 1).1 := by + simp only [φ] + congr 2 + exact Subtype.ext (by simp) + have h1 : φ 1 = (f half).1 := by + simp only [φ] + congr 2 + exact Subtype.ext (by simp [half]; norm_num) + refine hx.2 (h0 ▸ mem_arcComp_of_path he hφ (fun t ↦ hmem _ ?_) (h1 ▸ hhalf)) + by_cases ht : t = 0 + · exact Or.inr (by rw [ht]; exact h0) + · refine Or.inl (hsame _ (fun h ↦ ?_) (fun h ↦ ht (Subtype.ext ?_))) + · have := congrArg Subtype.val h + have ht1 := t.2.2 + simp only [Icc.coe_zero] at this + linarith + · have := congrArg Subtype.val h + simp only [Icc.coe_one] at this + simpa using (by linarith : t.1 = 0) + · obtain ⟨hD, hbd, -⟩ := Γ.isDisc_of_three he h3 + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hxb := hbd hx + have hp : h x ∈ Metric.sphere (0 : ℂ) 1 := c.bd ▸ mem_image_of_mem h hxb + have hnorm : ‖h x‖ = 1 := by simpa using hp + have hball : ∀ t : I, (1 - t.1 : ℝ) • h x ∈ Metric.closedBall (0 : ℂ) 1 := fun t ↦ by + have h1 := t.2.1 + have h2 := t.2.2 + rw [mem_closedBall_zero_iff, norm_smul, hnorm, mul_one, Real.norm_eq_abs, + abs_of_nonneg (sub_nonneg.2 h2)] + linarith + have hint : ∀ z ∈ Metric.ball (0 : ℂ) 1, g z ∈ e := by + intro z hz + have hz' : g z ∈ discInt (closure e) := by + rw [c.discInt_eq] + exact mem_image_of_mem g hz + by_contra hn + exact hz'.2 (hbd ⟨hz'.1, hn⟩) + let φ : I → S := fun t ↦ g ((1 - t.1 : ℝ) • h x) + have hφ : Continuous φ := by + refine c.gc.comp_continuous ?_ hball + exact (continuous_const.sub continuous_subtype_val).smul continuous_const + have h0 : φ 0 = x := by + simp only [φ, Icc.coe_zero, sub_zero, one_smul] + exact c.gh (discBd_subset _ hxb) + have hnear : ∀ t : I, t ≠ 0 → φ t ∈ e := fun t ht ↦ by + refine hint _ ?_ + have h1 : 0 < t.1 := lt_of_le_of_ne t.2.1 (fun h ↦ ht (Subtype.ext h.symm)) + have h2 := t.2.2 + simp only [Metric.mem_ball, dist_zero_right, norm_smul, hnorm, mul_one, Real.norm_eq_abs, + abs_of_nonneg (sub_nonneg.2 h2)] + linarith + have := mem_arcComp_of_path he hφ (fun t ↦ hmem _ (by + by_cases ht : t = 0 + · exact Or.inr (by rw [ht]; exact h0) + · exact Or.inl (hnear t ht))) (hnear 1 one_ne_zero) + exact hx.2 (h0 ▸ this) + +theorem closure_inter_V (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) : + closure e ∩ Γ.V = tilde e := by + ext x + exact ⟨fun h ↦ ⟨h.1, fun hx ↦ Γ.disjoint_V he hx h.2⟩, fun h ↦ ⟨h.1, Γ.tilde_subset_V he h⟩⟩ + +theorem closure_subset (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) : closure e ⊆ e ∪ Γ.V := by + intro x hx + by_cases h : x ∈ e + · exact Or.inl h + · exact Or.inr (Γ.tilde_subset_V he ⟨hx, h⟩) + +theorem skU_subset (Γ : Painting S) : Γ.skU ⊆ Γ.U := by + rintro x ((hx | hx) | hx) + · exact Γ.V_subset hx + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.1 hx + exact (he.1.2.1 hxe).1 + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.1 hx + exact Γ.closure_subset_U he.1 (discBd_subset _ hxe) + +/-- A point of an edge of size 3 that lies in `U(sk(Γ))` lies on the boundary of the disc. -/ +theorem mem_discBd_of_skU (Γ : Painting S) {c : Set S} (hc : c ∈ Γ.E) (h3 : (tilde c).ncard = 3) + {x : S} (hxc : x ∈ c) (hx : x ∈ Γ.skU) : x ∈ discBd (closure c) := by + rcases hx with (hx | hx) | hx + · exact absurd hx (Γ.disjoint_V hc hxc) + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.1 hx + have := arcComp_eq_of_mem he.1 hc hxe hxc + rw [this] at he + have := he.2 + omega + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.1 hx + rcases Γ.closure_subset he.1 (discBd_subset _ hxe) with h | h + · rw [← arcComp_eq_of_mem he.1 hc h hxc] + exact hxe + · exact absurd h (Γ.disjoint_V hc hxc) + +/-- `sk(Γ)` is a drawing of Graph Minors XI (Graph Minors XIX, Section 2, page 327). -/ +theorem exists_skDrawing [T2Space S] (Γ : Painting S) : + ∃ D : Drawing S, D.U = Γ.skU ∧ D.V = Γ.V := by + classical + have hDc : ∀ c, ∃ D : Drawing S, c ∈ Γ.E → (tilde c).ncard = 3 → + D.U = discBd (closure c) ∧ D.V = tilde c := by + intro c + by_cases h : c ∈ Γ.E ∧ (tilde c).ncard = 3 + · obtain ⟨hD, hbd, hfin⟩ := Γ.isDisc_of_three h.1 h.2 + have hne : (tilde c).Nonempty := by + rw [← ncard_pos hfin, h.2] + norm_num + obtain ⟨D, h₁, h₂⟩ := GM11.exists_drawing_on_oArc hD.isOArc_discBd hfin hne hbd + exact ⟨D, fun _ _ ↦ ⟨h₁, h₂⟩⟩ + · exact ⟨GM11.pointsDrawing (finite_empty (α := S)), fun h₁ h₂ ↦ absurd ⟨h₁, h₂⟩ h⟩ + choose Dc hDc using hDc + set Z2 : Set (Set S) := {e ∈ Γ.E | (tilde e).ncard = 2} with hZ2 + set Z3 : Set (Set S) := {e ∈ Γ.E | (tilde e).ncard = 3} with hZ3 + have hfin2 : Z2.Finite := Γ.finite_edges.subset fun _ h ↦ h.1 + have hfin3 : Z3.Finite := Γ.finite_edges.subset fun _ h ↦ h.1 + have hclosed : IsClosed Γ.skU := by + have hset : Γ.skU = Γ.V ∪ (⋃ e ∈ Z2, closure e) ∪ + (⋃ e ∈ Z3, discBd (closure e)) := by + apply Subset.antisymm + · refine union_subset_union_left _ (union_subset_union_right _ ?_) + exact iUnion₂_mono fun e _ ↦ subset_closure + · refine union_subset (union_subset (fun x hx ↦ Or.inl (Or.inl hx)) ?_) fun x hx ↦ Or.inr hx + refine iUnion₂_subset fun e he ↦ fun x hx ↦ ?_ + rcases Γ.closure_subset he.1 hx with h | h + · exact Or.inl (Or.inr (mem_iUnion₂.2 ⟨e, he, h⟩)) + · exact Or.inl (Or.inl h) + rw [hset] + refine ((Γ.finite_V.isClosed).union ?_).union ?_ + · exact hfin2.isClosed_biUnion fun _ _ ↦ isClosed_closure + · refine hfin3.isClosed_biUnion fun e he ↦ ?_ + exact (IsOArc.isCompact (Γ.isDisc_of_three he.1 he.2).1.isOArc_discBd).isClosed + have hAsub : Γ.skU \ Γ.V ⊆ Γ.U \ Γ.V := sdiff_subset_sdiff_left Γ.skU_subset + have hcomp : ∀ C ∈ arcComponentsIn (Γ.skU \ Γ.V), C ∈ Z2 ∨ ∃ c ∈ Z3, C ∈ (Dc c).E := by + intro C hC + obtain ⟨c, hc, hCc⟩ := exists_arcComp_superset hC.2.2.1 (hC.2.1.trans hAsub) + rcases Γ.size_cases hc with h2 | h3 + · left + have hsub : c ⊆ Γ.skU \ Γ.V := fun x hx ↦ + ⟨Or.inl (Or.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h2⟩, hx⟩)), Γ.disjoint_V hc hx⟩ + rw [← hC.2.2.2 c hsub hc.2.2.1 hCc] + exact ⟨hc, h2⟩ + · right + refine ⟨c, ⟨hc, h3⟩, ?_⟩ + obtain ⟨hU, hV⟩ := hDc c hc h3 + change C ∈ arcComponentsIn ((Dc c).U \ (Dc c).V) + rw [hU, hV] + refine ⟨hC.1, fun x hx ↦ ?_, hC.2.2.1, fun D hD hpc hCD ↦ ?_⟩ + · exact ⟨Γ.mem_discBd_of_skU hc h3 (hCc hx) (hC.2.1 hx).1, fun h ↦ h.2 (hCc hx)⟩ + · refine hC.2.2.2 D (fun x hx ↦ ⟨Or.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h3⟩, (hD hx).1⟩), + fun hV ↦ ?_⟩) + hpc hCD + have hxc := discBd_subset _ (hD hx).1 + rw [← Γ.closure_inter_V hc] at hD + exact (hD hx).2 ⟨hxc, hV⟩ + refine ⟨{ U := Γ.skU, V := Γ.V, V_subset_U := fun x hx ↦ Or.inl (Or.inl hx), + isClosed_U := hclosed, finite_V := Γ.finite_V, finite_edges := ?_, + edge_cond := ?_ }, rfl, rfl⟩ + · refine (hfin2.union (hfin3.biUnion fun c _ ↦ (Dc c).finite_edges)).subset fun C hC ↦ ?_ + rcases hcomp C hC with h | ⟨c, hc, h⟩ + · exact Or.inl h + · exact Or.inr (mem_iUnion₂.2 ⟨c, hc, h⟩) + · intro e he + rcases hcomp e he with h | ⟨c, hc, h⟩ + · obtain ⟨f, hne, hset⟩ := Γ.exists_line h.1 h.2 + left + refine ⟨_, _, hne, ?_, f, rfl, rfl⟩ + rw [Γ.closure_inter_V h.1, hset] + · obtain ⟨hU, hV⟩ := hDc c hc.1 hc.2 + have hsub : closure e ⊆ closure c := by + have h₁ : closure e ⊆ (Dc c).U := + closure_minimal (h.2.1.trans sdiff_subset) (Dc c).isClosed_U + exact h₁.trans (hU ▸ discBd_subset _) + have hset : closure e ∩ Γ.V = closure e ∩ (Dc c).V := by + rw [hV, ← Γ.closure_inter_V hc.1] + ext x + exact ⟨fun hx ↦ ⟨hx.1, hsub hx.1, hx.2⟩, fun hx ↦ ⟨hx.1, hx.2.2⟩⟩ + rw [hset] + exact (Dc c).edge_cond e h + +end Painting + +section Hat + +variable {T : Type u} [TopologicalSpace T] + +/-- The image of a drawing under a closed embedding is a drawing. -/ +theorem exists_drawing_image (D : Drawing S) {ι : S → T} (hι : IsClosedEmbedding ι) : + ∃ D' : Drawing T, D'.U = ι '' D.U ∧ D'.V = ι '' D.V := by + have hset : ι '' D.U \ ι '' D.V = ι '' (D.U \ D.V) := (image_sdiff hι.injective _ _).symm + refine ⟨{ U := ι '' D.U, V := ι '' D.V, V_subset_U := image_mono D.V_subset_U, + isClosed_U := hι.isClosedMap _ D.isClosed_U, finite_V := D.finite_V.image _, + finite_edges := ?_, edge_cond := ?_ }, rfl, rfl⟩ + · rw [hset] + refine (D.finite_edges.image fun c ↦ ι '' c).subset fun C hC ↦ ?_ + obtain ⟨c, hc, rfl⟩ := arcComponentsIn_image hι.isEmbedding hC + exact mem_image_of_mem _ hc + · intro C hC + rw [hset] at hC + obtain ⟨c, hc, rfl⟩ := arcComponentsIn_image hι.isEmbedding hC + rw [hι.closure_image_eq, ← image_inter hι.injective] + let e := hι.isEmbedding.homeomorphImage (closure c) + rcases D.edge_cond c hc with ⟨u, v, huv, hset', f, hf0, hf1⟩ | ⟨u, hset', ⟨f⟩⟩ + · refine Or.inl ⟨ι u, ι v, hι.injective.ne huv, ?_, f.trans e, ?_, ?_⟩ + · rw [hset', image_pair] + · change ι (f 0).1 = ι u + rw [hf0] + · change ι (f 1).1 = ι v + rw [hf1] + · exact Or.inr ⟨ι u, by rw [hset', image_singleton], ⟨f.trans e⟩⟩ + +/-- A drawing with some isolated vertices added. -/ +theorem exists_addPoints [T1Space T] (G : Drawing T) {W : Set T} (hW : W.Finite) + (hd : Disjoint W G.U) : ∃ G' : Drawing T, G'.U = G.U ∪ W ∧ G'.V = G.V ∪ W ∧ G'.E = G.E := by + have hset : (G.U ∪ W) \ (G.V ∪ W) = G.U \ G.V := by + ext x + constructor + · rintro ⟨hx | hx, hn⟩ + · exact ⟨hx, fun h ↦ hn (Or.inl h)⟩ + · exact absurd (Or.inr hx) hn + · rintro ⟨hx, hn⟩ + exact ⟨Or.inl hx, fun h ↦ h.elim hn fun h' ↦ disjoint_left.1 hd h' hx⟩ + refine ⟨{ U := G.U ∪ W, V := G.V ∪ W, V_subset_U := union_subset_union_left _ G.V_subset_U, + isClosed_U := G.isClosed_U.union hW.isClosed, finite_V := G.finite_V.union hW, + finite_edges := by rw [hset]; exact G.finite_edges, edge_cond := ?_ }, rfl, rfl, ?_⟩ + · intro e he + rw [hset] at he + have hcl : closure e ⊆ G.U := closure_minimal (he.2.1.trans sdiff_subset) G.isClosed_U + have heq : closure e ∩ (G.V ∪ W) = closure e ∩ G.V := by + ext x + constructor + · rintro ⟨hx, h | h⟩ + · exact ⟨hx, h⟩ + · exact absurd (hcl hx) (disjoint_left.1 hd h) + · exact fun h ↦ ⟨h.1, Or.inl h.2⟩ + rw [heq] + exact G.edge_cond e he + · change arcComponentsIn ((G.U ∪ W) \ (G.V ∪ W)) = arcComponentsIn (G.U \ G.V) + rw [hset] + +/-- Conditions (i)–(iv) have a solution with no edges: the vertices and one point in each region. -/ +theorem exists_preRadial_points [T2Space T] [Nonempty T] {U V : Set T} (hVU : V ⊆ U) (hV : V.Finite) + (hR : (componentsIn Uᶜ).Finite) : ∃ G : Drawing T, IsPreRadial U V G := by + classical + have hne : ∀ r ∈ componentsIn Uᶜ, r.Nonempty := by + rintro _ ⟨y, hy, rfl⟩ + exact ⟨y, mem_connectedComponentIn hy⟩ + have hout : ∀ r ∈ componentsIn Uᶜ, ∀ x ∈ r, x ∉ U := by + rintro _ ⟨y, hy, rfl⟩ x hx + exact connectedComponentIn_subset _ _ hx + have hsame : ∀ r₁ ∈ componentsIn Uᶜ, ∀ r₂ ∈ componentsIn Uᶜ, ∀ x, x ∈ r₁ → x ∈ r₂ → r₁ = r₂ := by + rintro _ ⟨a, -, rfl⟩ _ ⟨b, -, rfl⟩ x ha hb + rw [connectedComponentIn_eq ha, connectedComponentIn_eq hb] + choose! hub hhub using hne + have hA : (V ∪ hub '' componentsIn Uᶜ).Finite := hV.union (hR.image _) + have hE := GM11.pointsDrawing_E hA + have hUV : (GM11.pointsDrawing hA).U = V ∪ hub '' componentsIn Uᶜ := rfl + have hVV : (GM11.pointsDrawing hA).V = V ∪ hub '' componentsIn Uᶜ := rfl + refine ⟨GM11.pointsDrawing hA, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [hUV] + ext x + constructor + · rintro ⟨hxU, hx | ⟨r, hr, rfl⟩⟩ + · exact hx + · exact absurd hxU (hout r hr _ (hhub r hr)) + · exact fun hx ↦ ⟨hVU hx, Or.inl hx⟩ + · rw [hVV] + exact subset_union_left + · intro r hr + refine ⟨hub r, ⟨hhub r hr, Or.inr ⟨r, hr, rfl⟩⟩, ?_⟩ + rintro w ⟨hwr, hw | ⟨r', hr', rfl⟩⟩ + · exact absurd (hVU hw) (hout r hr _ hwr) + · rw [hsame r hr r' hr' _ hwr (hhub r' hr')] + · rintro w ⟨hw | ⟨r, hr, rfl⟩, hn⟩ + · exact absurd hw hn + · exact ⟨r, hr, hhub r hr⟩ + · intro e he + rw [hE] at he + exact absurd he (notMem_empty _) + · intro e he + rw [hE] at he + exact absurd he (notMem_empty _) + +/-- The inside of a closed disc in a manifold is an open disc. -/ +theorem isOpenDisc_discInt (hman : ∀ x : T, IsManifoldPoint x) {D : Set T} (hD : IsClosedDisc D) : + IsOpenDisc (discInt D) := by + refine ⟨hD.isOpen_discInt hman, ?_⟩ + obtain ⟨φ⟩ := hD + have hsub : ∀ x : OpenUnitDisc, x.1 ∈ ClosedUnitDisc := fun x ↦ + Metric.ball_subset_closedBall x.2 + let j : OpenUnitDisc → T := fun x ↦ (φ ⟨x.1, hsub x⟩).1 + have hj : IsEmbedding j := by + refine IsEmbedding.subtypeVal.comp (φ.isEmbedding.comp ?_) + exact IsEmbedding.inclusion (fun x hx ↦ Metric.ball_subset_closedBall hx) + have hr : range j = discInt D := by + have hbd := disc_boundary.{u} D φ + ext y + constructor + · rintro ⟨x, rfl⟩ + refine ⟨(φ _).2, fun hy ↦ ?_⟩ + rw [hbd] at hy + obtain ⟨z, hz, hzy⟩ := hy + have hz' : z = ⟨x.1, hsub x⟩ := φ.injective (Subtype.ext hzy) + have h₁ : ‖z.1‖ = 1 := mem_sphere_zero_iff_norm.1 hz + have h₂ : ‖x.1‖ < 1 := mem_ball_zero_iff.1 x.2 + rw [hz'] at h₁ + exact absurd h₁ h₂.ne + · rintro ⟨hyD, hn⟩ + let z := φ.symm ⟨y, hyD⟩ + have hzφ : (φ z).1 = y := by simp [z] + have h₁ : ‖z.1‖ ≤ 1 := mem_closedBall_zero_iff.1 z.2 + have h₂ : ‖z.1‖ ≠ 1 := fun h ↦ hn (by + rw [hbd] + exact ⟨z, mem_sphere_zero_iff_norm.2 h, hzφ⟩) + exact ⟨⟨z.1, mem_ball_zero_iff.2 (lt_of_le_of_ne h₁ h₂)⟩, hzφ⟩ + exact ⟨hj.toHomeomorph.trans (Homeomorph.setCongr hr)⟩ + +/-- The image of a closed disc under a closed embedding, with its boundary. -/ +theorem isClosedDisc_image {Δ : Set S} (hΔ : IsClosedDisc Δ) {ι : S → T} (hι : IsEmbedding ι) : + IsClosedDisc (ι '' Δ) ∧ discBd (ι '' Δ) = ι '' discBd Δ := by + obtain ⟨φ⟩ := hΔ + let e := hι.homeomorphImage Δ + refine ⟨⟨φ.trans e⟩, ?_⟩ + rw [disc_boundary.{u} (ι '' Δ) (φ.trans e), disc_boundary.{u} Δ φ, image_image] + rfl + +end Hat + +section Main + +variable {Shat : Type u} [TopologicalSpace Shat] + +omit [TopologicalSpace S] in +private theorem components_of_disjoint_open_discs + {A U : Set Shat} {cells : Set (Set S)} {B : Set S → Set Shat} + (hcompl : Uᶜ = A ∪ ⋃ c ∈ cells, B c) + (hAopen : IsOpen A) (hBopen : ∀ c ∈ cells, IsOpen (B c)) + (hBconn : ∀ c ∈ cells, IsPreconnected (B c)) + (hBne : ∀ c ∈ cells, (B c).Nonempty) + (hBU : ∀ c ∈ cells, Disjoint (B c) A) + (hBdisj : ∀ c ∈ cells, ∀ c' ∈ cells, c ≠ c' → Disjoint (B c) (B c')) : + componentsIn A ⊆ componentsIn (univ \ U) ∧ + (∀ c ∈ cells, B c ∈ componentsIn (univ \ U)) ∧ + ∀ r ∈ componentsIn (univ \ U), r ∈ componentsIn A ∨ ∃ c ∈ cells, r = B c := by + have hBs : IsOpen (⋃ c ∈ cells, B c) := isOpen_biUnion fun c hc ↦ hBopen c hc + have hABd : Disjoint A (⋃ c ∈ cells, B c) := by + refine disjoint_left.2 fun w hw hb ↦ ?_ + obtain ⟨c, hc, hwc⟩ := mem_iUnion₂.1 hb + exact disjoint_left.1 (hBU c hc) hwc hw + have hRhat : componentsIn A ⊆ componentsIn (univ \ U) := by + rintro _ ⟨x, hx, rfl⟩ + refine ⟨x, ?_, ?_⟩ + · rw [← compl_eq_univ_sdiff, hcompl] + exact Or.inl hx + · rw [← compl_eq_univ_sdiff, hcompl, connectedComponentIn_union_left hAopen hBs hABd hx] + have hRB : ∀ c ∈ cells, B c ∈ componentsIn (univ \ U) := by + intro c hc + obtain ⟨x, hx⟩ := hBne c hc + refine ⟨x, ?_, ?_⟩ + · rw [← compl_eq_univ_sdiff, hcompl] + exact Or.inr (mem_iUnion₂.2 ⟨c, hc, hx⟩) + · have hsplit : Uᶜ = B c ∪ (A ∪ ⋃ c' ∈ cells \ {c}, B c') := by + rw [hcompl] + ext w + simp only [mem_union, mem_iUnion₂, mem_sdiff, mem_singleton_iff] + constructor + · rintro (h | ⟨c', hc', hw⟩) + · exact Or.inr (Or.inl h) + · by_cases he : c' = c + · exact Or.inl (he ▸ hw) + · exact Or.inr (Or.inr ⟨c', ⟨hc', he⟩, hw⟩) + · rintro (h | h | ⟨c', ⟨hc', -⟩, hw⟩) + · exact Or.inr ⟨c, hc, h⟩ + · exact Or.inl h + · exact Or.inr ⟨c', hc', hw⟩ + have hopen : IsOpen (A ∪ ⋃ c' ∈ cells \ {c}, B c') := + hAopen.union (isOpen_biUnion fun c' hc' ↦ hBopen c' hc'.1) + have hd : Disjoint (B c) (A ∪ ⋃ c' ∈ cells \ {c}, B c') := by + refine disjoint_union_right.2 ⟨hBU c hc, disjoint_iUnion₂_right.2 fun c' hc' ↦ ?_⟩ + exact hBdisj c hc c' hc'.1 (Ne.symm hc'.2) + rw [← compl_eq_univ_sdiff, hsplit, + connectedComponentIn_union_left (hBopen c hc) hopen hd hx, + (hBconn c hc).connectedComponentIn hx] + have hRcases : ∀ r ∈ componentsIn (univ \ U), r ∈ componentsIn A ∨ ∃ c ∈ cells, r = B c := by + rintro _ ⟨x, hx, rfl⟩ + rw [← compl_eq_univ_sdiff, hcompl] at hx ⊢ + rcases hx with hx | hx + · left + rw [connectedComponentIn_union_left hAopen hBs hABd hx] + exact ⟨x, hx, rfl⟩ + · right + obtain ⟨c, hc, hxc⟩ := mem_iUnion₂.1 hx + refine ⟨c, hc, ?_⟩ + have := hRB c hc + obtain ⟨y, hy, hyc⟩ := this + rw [← compl_eq_univ_sdiff, hcompl] at hy hyc + have hxy : x ∈ connectedComponentIn (A ∪ ⋃ c ∈ cells, B c) y := by + rw [hyc] + exact hxc + rw [← connectedComponentIn_eq hxy, hyc] + exact ⟨hRhat, hRB, hRcases⟩ + +/-- `sk(Γ)` in `Σ̂` is a 2-cell drawing. A drawing that satisfies conditions (i)–(iv) for `Γ`, with +one +more isolated vertex inside each disc of an edge of size 3, satisfies them for `sk(Γ)`. -/ +theorem Painting.exists_hubDrawing (hS : IsSurface S) (cap : IsCappedSurface S Shat) + (Γ : Painting S) (h2 : ∀ r ∈ Γ.hatRegions cap, IsOpenDisc r) : + ∃ (D : Drawing Shat) (W : Set Shat), D.U = cap.emb '' Γ.skU ∧ D.V = cap.emb '' Γ.V ∧ + (GM11.PaintingOrDrawing.drawing D).IsTwoCell ∧ (Γ.hatRegions cap).Finite ∧ + ∀ G : Drawing Shat, IsPreRadial (Γ.hatU cap) (Γ.hatV cap) G → ∃ G' : Drawing Shat, + (GM11.PaintingOrDrawing.drawing D).IsPreRadialDrawing G' ∧ G'.U = G.U ∪ W ∧ + G'.V = G.V ∪ W ∧ G'.E = G.E := by + classical + obtain ⟨hcomp, hT2, -⟩ := hS + have hsurf := cap.isSurface + have hclosedS : IsClosedSurface Shat := by + refine ⟨hsurf.1, hsurf.2.1, fun x ↦ ?_⟩ + by_contra hx + have : x ∈ bd Shat := hx + rw [cap.bd_empty] at this + exact this + have : CompactSpace Shat := hsurf.1 + have : T2Space Shat := hsurf.2.1 + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := hsurf.2.2 + set ι := cap.emb with hιdef + have hιc : IsClosedEmbedding ι := + IsClosedEmbedding.of_continuous_injective_isClosedMap cap.isEmbedding.continuous + cap.isEmbedding.injective cap.isEmbedding.continuous.isClosedMap + obtain ⟨D₀, hD₀U, hD₀V⟩ := Γ.exists_skDrawing + obtain ⟨D, hDU, hDV⟩ := exists_drawing_image D₀ hιc + rw [hD₀U] at hDU + rw [hD₀V] at hDV + have hDV' : D.V = Γ.hatV cap := hDV + have hUc : IsClosed (Γ.hatU cap) := hιc.isClosedMap _ Γ.isClosed_U + set Z3 : Set (Set S) := {c ∈ Γ.E | (tilde c).ncard = 3} with hZ3 + have hZfin : Z3.Finite := Γ.finite_edges.subset fun _ h ↦ h.1 + let B : Set S → Set Shat := fun c ↦ discInt (ι '' closure c) + have hdisc : ∀ c ∈ Z3, IsClosedDisc (ι '' closure c) ∧ + discBd (ι '' closure c) = ι '' discBd (closure c) := fun c hc ↦ + isClosedDisc_image (Γ.isDisc_of_three hc.1 hc.2).1 cap.isEmbedding + have hBmem : ∀ c ∈ Z3, ∀ w ∈ B c, ∃ y ∈ c, ι y = w ∧ y ∉ discBd (closure c) := by + rintro c hc w ⟨⟨y, hy, rfl⟩, hn⟩ + rw [(hdisc c hc).2] at hn + have hnb : y ∉ discBd (closure c) := fun h ↦ hn (mem_image_of_mem _ h) + refine ⟨y, ?_, rfl, hnb⟩ + by_contra hyc + exact hnb ((Γ.isDisc_of_three hc.1 hc.2).2.1 ⟨hy, hyc⟩) + have hBopen : ∀ c ∈ Z3, IsOpenDisc (B c) := fun c hc ↦ isOpenDisc_discInt hman (hdisc c hc).1 + have hBconn : ∀ c ∈ Z3, IsPreconnected (B c) := fun c hc ↦ + (hdisc c hc).1.isPreconnected_discInt + have hBne : ∀ c ∈ Z3, (B c).Nonempty := fun c hc ↦ (hdisc c hc).1.nonempty_discInt + have hBU : ∀ c ∈ Z3, Disjoint (B c) (Γ.hatU cap)ᶜ := fun c hc ↦ by + refine disjoint_left.2 fun w hw hn ↦ ?_ + obtain ⟨y, hy, rfl, -⟩ := hBmem c hc w hw + exact hn (mem_image_of_mem _ (hc.1.2.1 hy).1) + have hBV : ∀ c ∈ Z3, ∀ w ∈ B c, w ∉ Γ.hatV cap := fun c hc w hw ⟨v, hv, hvw⟩ ↦ by + obtain ⟨y, hy, rfl, -⟩ := hBmem c hc w hw + exact Γ.disjoint_V hc.1 hy (hιc.injective hvw ▸ hv) + have hBdisj : ∀ c ∈ Z3, ∀ c' ∈ Z3, c ≠ c' → Disjoint (B c) (B c') := fun c hc c' hc' hne ↦ by + refine disjoint_left.2 fun w hw hw' ↦ ?_ + obtain ⟨y, hy, rfl, -⟩ := hBmem c hc w hw + obtain ⟨y', hy', hyy, -⟩ := hBmem c' hc' _ hw' + exact hne (arcComp_eq_of_mem hc.1 hc'.1 hy (hιc.injective hyy ▸ hy')) + have hcompl : D.Uᶜ = (Γ.hatU cap)ᶜ ∪ ⋃ c ∈ Z3, B c := by + rw [hDU] + ext w + constructor + · intro hw + by_cases hwU : w ∈ Γ.hatU cap + · obtain ⟨y, hy, rfl⟩ := hwU + have hyS : y ∉ Γ.skU := fun h ↦ hw (mem_image_of_mem _ h) + have hyV : y ∉ Γ.V := fun h ↦ hyS (Or.inl (Or.inl h)) + obtain ⟨c, hc, hyc⟩ := exists_arcComp_superset (F := Γ.U \ Γ.V) + (isPathConnected_singleton y) (singleton_subset_iff.2 ⟨hy, hyV⟩) + have hyc' : y ∈ c := hyc rfl + rcases Γ.size_cases hc with h | h + · exact absurd (Or.inl (Or.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h⟩, hyc'⟩))) hyS + · refine Or.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h⟩, mem_image_of_mem _ (subset_closure hyc'), ?_⟩) + rw [(hdisc c ⟨hc, h⟩).2] + rintro ⟨z, hz, hzy⟩ + exact hyS (Or.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h⟩, hιc.injective hzy ▸ hz⟩)) + · exact Or.inl hwU + · rintro (hw | hw) ⟨y, hy, rfl⟩ + · exact hw (mem_image_of_mem _ (Γ.skU_subset hy)) + · obtain ⟨c, hc, hyB⟩ := mem_iUnion₂.1 hw + obtain ⟨z, hz, hzy, hn⟩ := hBmem c hc _ hyB + obtain rfl := hιc.injective hzy + exact hn (Γ.mem_discBd_of_skU hc.1 hc.2 hz hy) + have hAopen : IsOpen (Γ.hatU cap)ᶜ := hUc.isOpen_compl + obtain ⟨hRhat, hRB, hRcases⟩ := + components_of_disjoint_open_discs hcompl hAopen + (fun c hc => (hBopen c hc).1) hBconn hBne hBU hBdisj + have hD2 : (GM11.PaintingOrDrawing.drawing D).IsTwoCell := by + refine ⟨inferInstance, fun r hr ↦ ?_⟩ + rcases hRcases r hr with h | ⟨c, hc, rfl⟩ + · exact h2 r h + · exact hBopen c hc + have hRfin : (Γ.hatRegions cap).Finite := + (GM11.finite_R hclosedS D).subset hRhat + have hVU : Γ.hatV cap ⊆ Γ.hatU cap := image_mono Γ.V_subset + have hVfin : (Γ.hatV cap).Finite := Γ.finite_V.image _ + obtain ⟨hub, hhub⟩ : ∃ hub : Set S → Shat, ∀ c ∈ Z3, hub c ∈ B c := by + choose! f hf using hBne + exact ⟨f, hf⟩ + refine ⟨D, hub '' Z3, hDU, hDV, hD2, hRfin, fun G hG ↦ ?_⟩ + · obtain ⟨h1, h2', h3, h4, h5, h6⟩ := hG + have hBG : ∀ c ∈ Z3, ∀ w ∈ B c, w ∉ G.U := fun c hc w hw hwG ↦ by + have hwU : w ∈ Γ.hatU cap := by + by_contra hn + exact disjoint_left.1 (hBU c hc) hw hn + exact hBV c hc w hw (h1 ▸ ⟨hwU, hwG⟩) + have hWfin : (hub '' Z3).Finite := hZfin.image _ + have hWd : Disjoint (hub '' Z3) G.U := by + refine disjoint_left.2 ?_ + rintro _ ⟨c, hc, rfl⟩ + exact hBG c hc _ (hhub c hc) + obtain ⟨G', hU', hV', hE'⟩ := exists_addPoints G hWfin hWd + have hcl : ∀ e ∈ G.E, closure e ⊆ G.U := fun e he ↦ + closure_minimal (he.2.1.trans sdiff_subset) G.isClosed_U + have hcle : ∀ e ∈ G.E, closure e ∩ G'.V = closure e ∩ G.V := fun e he ↦ by + rw [hV'] + ext x + constructor + · rintro ⟨hx, h | h⟩ + · exact ⟨hx, h⟩ + · exact absurd (hcl e he hx) (disjoint_left.1 hWd h) + · exact fun h ↦ ⟨h.1, Or.inl h.2⟩ + have hout : ∀ r ∈ Γ.hatRegions cap, ∀ x ∈ r, x ∉ Γ.hatU cap := by + rintro _ ⟨y, hy, rfl⟩ x hx + exact connectedComponentIn_subset _ _ hx + have hpre : (GM11.PaintingOrDrawing.drawing D).IsPreRadialDrawing G' := by + refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ + · change D.U ∩ G'.U = D.V + rw [hDU, hDV, hU'] + ext x + constructor + · rintro ⟨⟨y, hy, rfl⟩, h | ⟨c, hc, hcy⟩⟩ + · rw [← Painting.hatV, ← h1] + exact ⟨mem_image_of_mem _ (Γ.skU_subset hy), h⟩ + · have hin : hub c ∈ D.Uᶜ := by + rw [hcompl] + exact Or.inr (mem_iUnion₂.2 ⟨c, hc, hhub c hc⟩) + exact absurd (show hub c ∈ D.U by + rw [hDU, hcy] + exact mem_image_of_mem _ hy) hin + · rintro ⟨v, hv, rfl⟩ + exact ⟨mem_image_of_mem _ (Or.inl (Or.inl hv)), Or.inl (G.V_subset_U (h2' ⟨v, hv, rfl⟩))⟩ + · change D.V ⊆ G'.V + rw [hDV, hV'] + exact h2'.trans subset_union_left + · intro r hr + change r ∈ componentsIn (univ \ D.U) at hr + rcases hRcases r hr with h | ⟨c, hc, rfl⟩ + · obtain ⟨w, ⟨hwr, hwV⟩, huniq⟩ := h3 r h + refine ⟨w, ⟨hwr, hV' ▸ Or.inl hwV⟩, ?_⟩ + rintro w' ⟨hw'r, hw'⟩ + rw [hV'] at hw' + rcases hw' with hw' | ⟨c, hc, rfl⟩ + · exact huniq w' ⟨hw'r, hw'⟩ + · exact absurd (hout r h _ hw'r) (fun hn ↦ hn (by + by_contra hn' + exact disjoint_left.1 (hBU c hc) (hhub c hc) hn')) + · refine ⟨hub c, ⟨hhub c hc, hV' ▸ Or.inr ⟨c, hc, rfl⟩⟩, ?_⟩ + rintro w' ⟨hw'r, hw'⟩ + rw [hV'] at hw' + rcases hw' with hw' | ⟨c', hc', rfl⟩ + · exact absurd (G.V_subset_U hw') (hBG c hc _ hw'r) + · by_cases he : c = c' + · rw [he] + · exact absurd (hhub c' hc') (disjoint_left.1 (hBdisj c hc c' hc' he) hw'r) + · rintro w ⟨hw, hn⟩ + change w ∈ G'.V at hw + change w ∉ D.V at hn + rw [hV'] at hw + rcases hw with hw | ⟨c, hc, rfl⟩ + · obtain ⟨r, hr, hwr⟩ := h4 w ⟨hw, fun h ↦ hn (by rw [hDV']; exact h)⟩ + exact ⟨r, hRhat hr, hwr⟩ + · exact ⟨B c, hRB c hc, hhub c hc⟩ + · intro e he + rw [hE'] at he + obtain ⟨v, hv, w, ⟨hw, hwn⟩, hset⟩ := h5 e he + refine ⟨v, (by change v ∈ D.V; rw [hDV']; exact hv), w, ⟨hV' ▸ Or.inl hw, fun h ↦ hwn (by + rw [← hDV']; exact h)⟩, ?_⟩ + rw [hcle e he, hset] + · intro e he f hf hne v hv r hr w hw h₁ h₂ + rw [hE'] at he hf + rw [hcle e he] at h₁ + rw [hcle f hf] at h₂ + have hwG : w ∈ G.V := by + have : w ∈ closure e ∩ G.V := by + rw [h₁] + exact Or.inr rfl + exact this.2 + change r ∈ componentsIn (univ \ D.U) at hr + change v ∈ D.V at hv + rcases hRcases r hr with h | ⟨c, hc, rfl⟩ + · exact h6 e he f hf hne v (hDV' ▸ hv) r h w ⟨hw.1, hwG⟩ h₁ h₂ + · exact absurd (G.V_subset_U hwG) (hBG c hc _ hw.1) + exact ⟨G', hpre, hU', hV', hE'⟩ + +/-- **A 2-cell painting of Graph Minors XIX has a radial drawing** (Graph Minors XIX, Section 5, +page 337, and Graph Minors XI, Section 3, page 75). -/ +theorem Painting.exists_radialDrawing (hS : IsSurface S) (cap : IsCappedSurface S Shat) + (Γ : Painting S) (h2 : ∀ r ∈ Γ.hatRegions cap, IsOpenDisc r) : + Nonempty (RadialDrawing cap Γ) := by + classical + have hsurf := cap.isSurface + have hclosedS : IsClosedSurface Shat := by + refine ⟨hsurf.1, hsurf.2.1, fun x ↦ ?_⟩ + by_contra hx + have : x ∈ bd Shat := hx + rw [cap.bd_empty] at this + exact this + have : CompactSpace Shat := hsurf.1 + have : T2Space Shat := hsurf.2.1 + have : ConnectedSpace Shat := cap.connected + obtain ⟨D, W, -, -, hD2, hRfin, hG'⟩ := Γ.exists_hubDrawing hS cap h2 + have hVU : Γ.hatV cap ⊆ Γ.hatU cap := image_mono Γ.V_subset + have hVfin : (Γ.hatV cap).Finite := Γ.finite_V.image _ + have hbound : ∀ G : Drawing Shat, IsPreRadial (Γ.hatU cap) (Γ.hatV cap) G → + G.E.ncard ≤ D.V.ncard + 2 * D.E.ncard := by + intro G hG + obtain ⟨G', hpre, -, -, hE'⟩ := hG' G hG + have := GM11.ncard_spokes_le (Γ := D) (Γ' := G') ⟨hD2, hpre⟩ hclosedS + rwa [hE'] at this + have hAne : {n | ∃ G : Drawing Shat, IsPreRadial (Γ.hatU cap) (Γ.hatV cap) G ∧ G.E.ncard + = n}.Nonempty := by + obtain ⟨G, hG⟩ := exists_preRadial_points hVU hVfin hRfin + exact ⟨_, G, hG, rfl⟩ + have hbdd : BddAbove {n | ∃ G : Drawing Shat, IsPreRadial (Γ.hatU cap) (Γ.hatV cap) G ∧ G.E.ncard + = n} := + ⟨_, by rintro _ ⟨G, h, rfl⟩; exact hbound G h⟩ + obtain ⟨G, hpre, hc⟩ := Nat.sSup_mem hAne hbdd + refine ⟨⟨G, hpre, fun G' hG' hsub ↦ ⟨fun w hw ↦ ?_, ?_⟩⟩⟩ + · by_cases hwV : w ∈ Γ.hatV cap + · exact hpre.2.1 hwV + obtain ⟨r, hr, hwr⟩ := hG'.2.2.2.1 w ⟨hw, hwV⟩ + obtain ⟨w', ⟨hw'r, hw'⟩, -⟩ := hpre.2.2.1 r hr + rw [(hG'.2.2.1 r hr).unique ⟨hwr, hw⟩ ⟨hw'r, hsub.1 hw'⟩] + exact hw' + · have hle : G'.E.ncard ≤ G.E.ncard := by + rw [hc] + exact le_csSup hbdd ⟨G', hG', rfl⟩ + exact (eq_of_subset_of_ncard_le hsub.2 hle G'.finite_edges).ge + +/-- Each interior point is inside a closed disc. -/ +theorem exists_disc_around {y : S} (hy : IsInteriorPoint y) : + ∃ E : Set S, IsClosedDisc E ∧ y ∈ discInt E := by + obtain ⟨U, h, g, c, -, hg0⟩ := hy.exists_ballChart isOpen_univ (mem_univ _) (R := 2) two_pos + obtain ⟨hZ, hbd⟩ := isClosedDisc_closedBall + have hsub : Metric.closedBall (0 : ℂ) 1 ⊆ Metric.ball 0 2 := + Metric.closedBall_subset_ball (by norm_num) + obtain ⟨hE, hEb⟩ := c.image_disc hZ hsub + refine ⟨_, hE, ⟨0, by simp, hg0⟩, fun hy' ↦ ?_⟩ + rw [hEb, hbd] at hy' + obtain ⟨z, hz, hzy⟩ := hy' + have hz' : ‖z‖ = 1 := by simpa using hz + have h₁ : z = 0 := by + have ha := c.hg (show z ∈ Metric.ball (0 : ℂ) 2 from hsub (Metric.sphere_subset_closedBall hz)) + have hb := c.hg (show (0 : ℂ) ∈ Metric.ball (0 : ℂ) 2 by simp) + rw [← ha, hzy, ← hg0, hb] + rw [h₁] at hz' + simp at hz' + +/-- The pasted open disc of a cuff is the inside of its closure. -/ +theorem IsCappedSurface.cuffDisc_eq_discInt (cap : IsCappedSurface S Shat) + {Θ : Set S} (hΘ : Θ ∈ cuffs S) : cap.cuffDisc Θ = discInt (closure (cap.cuffDisc Θ)) := by + have hsurf := cap.isSurface + have : T2Space Shat := hsurf.2.1 + have hcomp : ∀ Θ' ∈ cuffs S, cap.cuffDisc Θ' ⊆ (range cap.emb)ᶜ := fun Θ' hΘ' x hx ↦ by + rw [cap.compl_eq] + exact mem_iUnion₂.2 ⟨Θ', hΘ', hx⟩ + apply Subset.antisymm + · intro x hx + refine ⟨subset_closure hx, fun hb ↦ ?_⟩ + rw [cap.cuffDisc_bd Θ hΘ] at hb + obtain ⟨y, -, rfl⟩ := hb + exact hcomp Θ hΘ hx (mem_range_self y) + · rintro x ⟨hxD, hxb⟩ + by_contra hxc + by_cases hxr : x ∈ range cap.emb + · obtain ⟨y, rfl⟩ := hxr + rw [cap.cuffDisc_bd Θ hΘ] at hxb + have hyΘ : y ∉ Θ := fun h ↦ hxb (mem_image_of_mem _ h) + by_cases hy : y ∈ bd S + · have hΘ' : connectedComponentIn (bd S) y ∈ cuffs S := ⟨y, hy, rfl⟩ + have hne : connectedComponentIn (bd S) y ≠ Θ := fun h ↦ + hyΘ (h ▸ mem_connectedComponentIn hy) + have hin : cap.emb y ∈ closure (cap.cuffDisc (connectedComponentIn (bd S) y)) := by + apply discBd_subset + rw [cap.cuffDisc_bd _ hΘ'] + exact mem_image_of_mem _ (mem_connectedComponentIn hy) + exact disjoint_left.1 (cap.cuffDisc_disjoint _ hΘ' _ hΘ hne) hin hxD + · have hyI : IsInteriorPoint y := by + by_contra hn + exact hy hn + obtain ⟨E, hE, hyE⟩ := exists_disc_around hyI + obtain ⟨hE', hEb⟩ := isClosedDisc_image hE cap.isEmbedding + have hopen : IsOpen (discInt (cap.emb '' E)) := hE'.isOpen_discInt hsurf.2.2 + have hmem : cap.emb y ∈ discInt (cap.emb '' E) := by + refine ⟨mem_image_of_mem _ hyE.1, fun h ↦ ?_⟩ + rw [hEb] at h + obtain ⟨z, hz, hzy⟩ := h + exact hyE.2 (cap.isEmbedding.injective hzy ▸ hz) + obtain ⟨w, hw₁, hw₂⟩ := mem_closure_iff.1 hxD _ hopen hmem + obtain ⟨z, -, rfl⟩ := discInt_subset _ hw₁ + exact hcomp Θ hΘ hw₂ (mem_range_self z) + · have hmem : x ∈ ⋃ Θ' ∈ cuffs S, cap.cuffDisc Θ' := by + rw [← cap.compl_eq] + exact hxr + obtain ⟨Θ', hΘ', hx'⟩ := mem_iUnion₂.1 hmem + by_cases he : Θ' = Θ + · exact hxc (he ▸ hx') + · exact disjoint_left.1 (cap.cuffDisc_disjoint _ hΘ' _ hΘ he) (subset_closure hx') hxD + +theorem IsCappedSurface.closure_cuffDisc (cap : IsCappedSurface S Shat) + {Θ : Set S} (hΘ : Θ ∈ cuffs S) : + closure (cap.cuffDisc Θ) = cap.cuffDisc Θ ∪ cap.emb '' Θ := by + rw [← cap.cuffDisc_bd Θ hΘ] + ext x + constructor + · intro hx + by_cases hb : x ∈ discBd (closure (cap.cuffDisc Θ)) + · exact Or.inr hb + · left + rw [cap.cuffDisc_eq_discInt hΘ] + exact ⟨hx, hb⟩ + · rintro (hx | hx) + · exact subset_closure hx + · exact discBd_subset _ hx + +/-- **Every internally 3-connected painting is 2-cell** (Graph Minors XIX, Section 5, page 337), for +its regions in `Σ̂`. A region inside a pasted disc is that disc. For any other region `r`, an +`O`-arc +`F` in `r` misses `V(Γ)` and `bd(Σ)`, so by internal 3-connectivity it bounds a disc in `Σ` with no +vertex. This disc has no point of `U(Γ)`, because the ends of an edge inside it would be vertices in +it, so the disc lies in `r`. Then Graph Minors VII, (4.2), says `r` is an open disc. -/ +theorem Painting.IsInternallyThreeConnected.hatRegions_isOpenDisc {Γ : Painting S} + (h3 : Γ.IsInternallyThreeConnected) (hS : IsSurface S) (cap : IsCappedSurface S Shat) : + ∀ r ∈ Γ.hatRegions cap, IsOpenDisc r := by + classical + have hS' := hS + obtain ⟨hcomp, hT2, hmanS⟩ := hS + have hsurf := cap.isSurface + have hclosedS : IsClosedSurface Shat := by + refine ⟨hsurf.1, hsurf.2.1, fun x ↦ ?_⟩ + by_contra hx + have : x ∈ bd Shat := hx + rw [cap.bd_empty] at this + exact this + have : CompactSpace Shat := hsurf.1 + have : T2Space Shat := hsurf.2.1 + have : ConnectedSpace Shat := cap.connected + have : LocallyConnectedSpace Shat := GM11.IsClosedSurface.locallyConnectedSpace hclosedS + have hman : ∀ x : Shat, IsManifoldPoint x := hsurf.2.2 + set ι := cap.emb with hιdef + have hιc : IsClosedEmbedding ι := + IsClosedEmbedding.of_continuous_injective_isClosedMap cap.isEmbedding.continuous + cap.isEmbedding.injective cap.isEmbedding.continuous.isClosedMap + have hUc : IsClosed (Γ.hatU cap) := hιc.isClosedMap _ Γ.isClosed_U + obtain ⟨-, hcfin, -⟩ := cuff_statement.{u} S hS' + have hcapopen : ∀ Θ ∈ cuffs S, IsOpen (cap.cuffDisc Θ) := fun Θ hΘ ↦ by + rw [cap.cuffDisc_eq_discInt hΘ] + exact (cap.cuffDisc_closedDisc Θ hΘ).isOpen_discInt hman + have hcaprange : ∀ Θ ∈ cuffs S, ∀ x ∈ cap.cuffDisc Θ, x ∉ range ι := fun Θ hΘ x hx hr ↦ by + have : x ∈ (range cap.emb)ᶜ := by + rw [cap.compl_eq] + exact mem_iUnion₂.2 ⟨Θ, hΘ, hx⟩ + exact this hr + have hbdsub : ∀ y ∈ bd S, ι y ∈ ⋃ Θ ∈ cuffs S, closure (cap.cuffDisc Θ) := fun y hy ↦ by + have hΘ : connectedComponentIn (bd S) y ∈ cuffs S := ⟨y, hy, rfl⟩ + refine mem_iUnion₂.2 ⟨_, hΘ, ?_⟩ + rw [cap.closure_cuffDisc hΘ] + exact Or.inr (mem_image_of_mem _ (mem_connectedComponentIn hy)) + let Y₀ : Set Shat := (⋃ Θ ∈ cuffs S, closure (cap.cuffDisc Θ))ᶜ + have hY₀ : IsOpen Y₀ := (hcfin.isClosed_biUnion fun _ _ ↦ isClosed_closure).isOpen_compl + have hY₀sub : ∀ w ∈ Y₀, w ∈ range ι := fun w hw ↦ by + by_contra hn + have hmem : w ∈ ⋃ Θ ∈ cuffs S, cap.cuffDisc Θ := by + rw [← cap.compl_eq] + exact hn + obtain ⟨Θ, hΘ, hwΘ⟩ := mem_iUnion₂.1 hmem + exact hw (mem_iUnion₂.2 ⟨Θ, hΘ, subset_closure hwΘ⟩) + have hbdU : ∀ y ∈ bd S, ι y ∈ Γ.hatU cap := fun y hy ↦ mem_image_of_mem _ (Γ.bd_subset hy) + rintro _ ⟨x, hx, rfl⟩ + set r := connectedComponentIn (Γ.hatU cap)ᶜ x with hr + have hrpre : IsPreconnected r := isPreconnected_connectedComponentIn + have hrU : r ⊆ (Γ.hatU cap)ᶜ := connectedComponentIn_subset _ _ + have hrx : x ∈ r := mem_connectedComponentIn hx + by_cases hxcap : ∃ Θ ∈ cuffs S, x ∈ cap.cuffDisc Θ + · obtain ⟨Θ, hΘ, hxΘ⟩ := hxcap + have hcapU : cap.cuffDisc Θ ⊆ (Γ.hatU cap)ᶜ := fun w hw ⟨y, _, hy⟩ ↦ + hcaprange Θ hΘ w hw ⟨y, hy⟩ + have hconn : IsPreconnected (cap.cuffDisc Θ) := by + rw [cap.cuffDisc_eq_discInt hΘ] + exact (cap.cuffDisc_closedDisc Θ hΘ).isPreconnected_discInt + have h₁ : cap.cuffDisc Θ ⊆ r := hconn.subset_connectedComponentIn hxΘ hcapU + have h₂ : r ⊆ cap.cuffDisc Θ := by + refine hrpre.subset_left_of_subset_union (hcapopen Θ hΘ) + (isClosed_closure (s := cap.cuffDisc Θ)).isOpen_compl ?_ (fun w hw ↦ ?_) ⟨x, hrx, hxΘ⟩ + · exact disjoint_left.2 fun w hw hn ↦ hn (subset_closure hw) + · by_cases hwc : w ∈ cap.cuffDisc Θ + · exact Or.inl hwc + · refine Or.inr fun hcl ↦ ?_ + rw [cap.closure_cuffDisc hΘ] at hcl + rcases hcl with h | ⟨y, hy, rfl⟩ + · exact hwc h + · have hyb : y ∈ bd S := by + obtain ⟨z, hz, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ hy + exact hrU hw (hbdU y hyb) + rw [Subset.antisymm h₂ h₁, cap.cuffDisc_eq_discInt hΘ] + exact isOpenDisc_discInt hman (cap.cuffDisc_closedDisc Θ hΘ) + · have hxr : ∃ y, ι y = x := by + by_contra hn + have hmem : x ∈ ⋃ Θ ∈ cuffs S, cap.cuffDisc Θ := by + rw [← cap.compl_eq] + exact hn + obtain ⟨Θ, hΘ, hxΘ⟩ := mem_iUnion₂.1 hmem + exact hxcap ⟨Θ, hΘ, hxΘ⟩ + have hxY : x ∈ Y₀ := by + intro hmem + obtain ⟨Θ, hΘ, hcl⟩ := mem_iUnion₂.1 hmem + rw [cap.closure_cuffDisc hΘ] at hcl + rcases hcl with h | ⟨y, hy, rfl⟩ + · exact hxcap ⟨Θ, hΘ, h⟩ + · have hyb : y ∈ bd S := by + obtain ⟨z, hz, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ hy + exact hx (hbdU y hyb) + have hrY : r ⊆ Y₀ := by + refine hrpre.subset_left_of_subset_union hY₀ + (isOpen_biUnion fun Θ hΘ ↦ hcapopen Θ hΘ) ?_ (fun w hw ↦ ?_) ⟨x, hrx, hxY⟩ + · refine disjoint_left.2 fun w hw hn ↦ ?_ + obtain ⟨Θ, hΘ, hwΘ⟩ := mem_iUnion₂.1 hn + exact hw (mem_iUnion₂.2 ⟨Θ, hΘ, subset_closure hwΘ⟩) + · by_cases hwc : w ∈ ⋃ Θ ∈ cuffs S, cap.cuffDisc Θ + · exact Or.inr hwc + · left + intro hmem + obtain ⟨Θ, hΘ, hcl⟩ := mem_iUnion₂.1 hmem + rw [cap.closure_cuffDisc hΘ] at hcl + rcases hcl with h | ⟨y, hy, rfl⟩ + · exact hwc (mem_iUnion₂.2 ⟨Θ, hΘ, h⟩) + · have hyb : y ∈ bd S := by + obtain ⟨z, hz, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ hy + exact hrU hw (hbdU y hyb) + have hrO : IsOpen r := hUc.isOpen_compl.connectedComponentIn + have hmain : ∀ F : Set Shat, F ⊆ r → IsOArc F → + ∃ Δ : Set Shat, Δ ⊆ r ∧ IsClosedDisc Δ ∧ discBd Δ = F := by + intro F hFr hF + have hFrange : F ⊆ range ι := fun w hw ↦ hY₀sub w (hrY (hFr hw)) + have hFimg : ι '' (ι ⁻¹' F) = F := image_preimage_eq_of_subset hFrange + set F₀ : Set S := ι ⁻¹' F with hF₀ + have hF₀O : IsOArc F₀ := by + obtain ⟨φ⟩ := hF + exact ⟨φ.trans ((Homeomorph.setCongr hFimg).symm.trans + (cap.isEmbedding.homeomorphImage F₀).symm)⟩ + have hF₀U : ∀ y ∈ F₀, y ∉ Γ.U := fun y hy hyU ↦ + hrU (hFr hy) (mem_image_of_mem _ hyU) + have hF₀b : F₀ ∩ bd S = ∅ := by + refine eq_empty_of_forall_notMem fun y hy ↦ hF₀U y hy.1 (Γ.bd_subset hy.2) + have hF₀V : F₀ ∩ Γ.V = ∅ := by + refine eq_empty_of_forall_notMem fun y hy ↦ hF₀U y hy.1 (Γ.V_subset hy.2) + obtain ⟨Δ₀, hΔ₀, hbΔ₀, hVΔ₀⟩ := h3.2 F₀ hF₀O + (fun y hy ↦ absurd hy.2 (hF₀U y hy.1)) (by rw [hF₀b]; exact finite_empty) + (by rw [hF₀b, hF₀V]; simp) + have hΔV : ∀ y ∈ Δ₀, y ∉ Γ.V := fun y hy hyV ↦ by + have := hVΔ₀ ⟨hy, hyV⟩ + exact hF₀U y this (Γ.V_subset hyV) + have hΔU : ∀ y ∈ Δ₀, y ∉ Γ.U := by + intro y hy hyU + obtain ⟨c, hc, hyc⟩ := exists_arcComp_superset (F := Γ.U \ Γ.V) + (isPathConnected_singleton y) (singleton_subset_iff.2 ⟨hyU, hΔV y hy⟩) + have hyc' : y ∈ c := hyc rfl + have hyint : y ∈ discInt Δ₀ := ⟨hy, fun h ↦ by + rw [hbΔ₀] at h + exact hF₀U y h hyU⟩ + have hcsub : c ⊆ discInt Δ₀ := by + refine hc.2.2.1.isConnected.isPreconnected.subset_left_of_subset_union + (hΔ₀.isOpen_discInt hmanS) (hΔ₀.isClosed.isOpen_compl) ?_ + (fun w hw ↦ ?_) ⟨y, hyc', hyint⟩ + · exact disjoint_left.2 fun w hw hn ↦ hn hw.1 + · by_cases hwΔ : w ∈ Δ₀ + · refine Or.inl ⟨hwΔ, fun h ↦ ?_⟩ + rw [hbΔ₀] at h + exact hF₀U w h (hc.2.1 hw).1 + · exact Or.inr hwΔ + have hcl : closure c ⊆ Δ₀ := closure_minimal (hcsub.trans (discInt_subset _)) hΔ₀.isClosed + have hne : (tilde c).Nonempty := by + rcases Γ.size_cases hc with h | h <;> + · by_contra hn + rw [not_nonempty_iff_eq_empty.1 hn] at h + simp at h + obtain ⟨v, hv⟩ := hne + exact hΔV v (hcl hv.1) (Γ.tilde_subset_V hc hv) + obtain ⟨hD, hDb⟩ := isClosedDisc_image hΔ₀ cap.isEmbedding + refine ⟨ι '' Δ₀, ?_, hD, by rw [hDb, hbΔ₀, hFimg]⟩ + obtain ⟨φ⟩ := hF + have hFne : (F : Set Shat).Nonempty := ⟨_, (φ 1).2⟩ + obtain ⟨p, hp⟩ := hFne + have hpr : connectedComponentIn (Γ.hatU cap)ᶜ x = connectedComponentIn (Γ.hatU cap)ᶜ p := + connectedComponentIn_eq (hFr hp) + rw [hr, hpr] + have hpre : IsPreconnected (ι '' Δ₀) := + ((IsClosedDisc.isPathConnected hΔ₀).image + cap.isEmbedding.continuous).isConnected.isPreconnected + refine hpre.subset_connectedComponentIn ?_ ?_ + · rw [← hFimg] at hp + obtain ⟨y, hy, rfl⟩ := hp + refine ⟨y, ?_, rfl⟩ + have : y ∈ discBd Δ₀ := by + rw [hbΔ₀] + exact hy + exact discBd_subset _ this + · rintro _ ⟨y, hy, rfl⟩ ⟨z, hz, hzy⟩ + exact hΔU y hy (hιc.injective hzy ▸ hz) + rcases open_disc.{u} Shat r hclosedS inferInstance ⟨⟨x, hrx⟩, hrpre⟩ hrO hmain with h | h + · obtain ⟨c, hc⟩ := h3.1 + obtain ⟨y, hy⟩ := hc.1 + have hmem : ι y ∈ r := by + rw [h.2] + exact mem_univ _ + exact absurd (mem_image_of_mem ι (hc.2.1 hy).1) (hrU hmem) + · exact h + +/-- An internally 3-connected painting has a radial drawing. This is the case used in the paper. -/ +theorem Painting.IsInternallyThreeConnected.nonempty_radialDrawing {Γ : Painting S} + (h3 : Γ.IsInternallyThreeConnected) (hS : IsSurface S) (cap : IsCappedSurface S Shat) : + Nonempty (RadialDrawing cap Γ) := + Γ.exists_radialDrawing hS cap (h3.hatRegions_isOpenDisc hS cap) + +end Main + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Relabel.lean b/LeanPool/GraphMinor/GM19/Relabel.lean new file mode 100644 index 0000000000..cdf055a176 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Relabel.lean @@ -0,0 +1,514 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Conditional +public import LeanPool.GraphMinor.GM19.Section4a +public import LeanPool.GraphMinor.GM19.Defs3 +public import LeanPool.GraphMinor.GM11.PaintingCells + +/-! +# Changing the labels of a colour scheme + +Section 15 of Graph Minors XIX starts: "(by replacing the $\Omega_\chi(k)$'s and $\Omega_\chi(S)$'s +by isomorphic +well-quasi-orders) we may choose $\chi$ to be disjoint". A colour scheme here has one type of +labels, and +`S₂`, `S₃`, `S₄` compare schemes over that type. So we keep the type and move the labels inside it. +This needs a type `β` that holds a copy of `β × ℕ`, that is, an infinite one. The proof of (3.1) can +pick such a type, by first moving the labels of a bad scheme to `Option β × ℕ`. + +`LabelMap χ χ'` is a map of labels. It sends a `χ`-coloured painting to a `χ'`-coloured painting +with +the same painting. A linear inflation of the new paintings is one of the old paintings, so a bad +sequence stays bad. We need linear inflations here, since these send internal edges to internal +edges, and only then do the labels of an edge and of its image come from the same quasi-order. + +The main results are `IsBad.of_labelMap`, `IsOrientedlyBad.of_labelMap` and `exists_disjoint`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface + +universe u w + +variable {S : Type u} [TopologicalSpace S] {α α' : Type w} + +namespace QuasiOrder + +/-- The copy of `Ω` under an injection `i`. -/ +def map (Ω : QuasiOrder α) (i : α → α') (hi : Injective i) : QuasiOrder α' where + E := i '' Ω.E + le a b := ∃ x y, a = i x ∧ b = i y ∧ Ω.le x y + refl := by + rintro _ ⟨x, hx, rfl⟩ + exact ⟨x, x, rfl, rfl, Ω.refl x hx⟩ + trans := by + rintro _ ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩ _ ⟨z, hz, rfl⟩ ⟨a, b, h₁, h₂, h⟩ ⟨c, d, h₃, h₄, h'⟩ + obtain rfl := hi h₁ + obtain rfl := hi h₂ + obtain rfl := hi h₃ + obtain rfl := hi h₄ + exact ⟨_, _, rfl, rfl, Ω.trans _ hx _ hy _ hz h h'⟩ + +/-- The pull-back of `Ω` along `i`. -/ +def comap (Ω : QuasiOrder α') (i : α → α') : QuasiOrder α where + E := i ⁻¹' Ω.E + le x y := Ω.le (i x) (i y) + refl _x hx := Ω.refl _ hx + trans _x hx _y hy _z hz := Ω.trans _ hx _ hy _ hz + +theorem map_isWQO {Ω : QuasiOrder α} {i : α → α'} (hi : Injective i) (h : Ω.IsWQO) : + (Ω.map i hi).IsWQO := by + intro f hf + choose g hg hgf using hf + obtain ⟨a, b, hab, hle⟩ := h g hg + exact ⟨a, b, hab, g a, g b, (hgf a).symm, (hgf b).symm, hle⟩ + +theorem comap_isWQO {Ω : QuasiOrder α'} {i : α → α'} (h : Ω.IsWQO) : (Ω.comap i).IsWQO := + fun f hf ↦ h (i ∘ f) hf + +theorem comap_map (Ω : QuasiOrder α) {i : α → α'} (hi : Injective i) : + (Ω.map i hi).comap i = Ω := by + have hE : ((Ω.map i hi).comap i).E = Ω.E := preimage_image_eq _ hi + have hle : ((Ω.map i hi).comap i).le = Ω.le := by + funext x y + refine propext ⟨?_, fun h ↦ ⟨x, y, rfl, rfl, h⟩⟩ + rintro ⟨a, b, h₁, h₂, h⟩ + rw [hi h₁, hi h₂] + exact h + cases h : (Ω.map i hi).comap i + cases Ω + simp only [h, mk.injEq] at hE hle ⊢ + exact ⟨hE, hle⟩ + +theorem comap_subIdeal {Ω' : QuasiOrder α'} {Ω : QuasiOrder α} {i : α → α'} (hi : Injective i) + (h : Ω'.IsSubIdeal (Ω.map i hi)) : (Ω'.comap i).IsSubIdeal Ω where + E_subset x hx := by + obtain ⟨y, hy, hxy⟩ := h.E_subset hx + rwa [← hi hxy] + downward_closed x' hx' x hx hle := + h.downward_closed _ hx' _ (mem_image_of_mem _ hx) ⟨x, x', rfl, rfl, hle⟩ + le_iff x₁ hx₁ x₂ hx₂ := by + refine (h.le_iff _ hx₁ _ hx₂).trans ⟨?_, fun h' ↦ ⟨_, _, rfl, rfl, h'⟩⟩ + rintro ⟨a, b, h₁, h₂, h'⟩ + rw [hi h₁, hi h₂] + exact h' + +theorem comap_E_ne {Ω' : QuasiOrder α'} {Ω : QuasiOrder α} {i : α → α'} (hi : Injective i) + (h : Ω'.IsSubIdeal (Ω.map i hi)) (hne : Ω'.E ≠ (Ω.map i hi).E) : (Ω'.comap i).E ≠ Ω.E := by + intro hE + refine hne (Subset.antisymm h.E_subset ?_) + rintro _ ⟨x, hx, rfl⟩ + rw [← hE] at hx + exact hx + +end QuasiOrder + +/-- A map of labels from `χ` to `χ'`, which have the same frame. It may depend on the kind of edge. +It +preserves the element sets and reflects the order. -/ +structure LabelMap (χ : ColourScheme S α) (χ' : ColourScheme S α') where + hΦ : χ'.Φ = χ.Φ + /-- The relabeling for interior edges with two ends. -/ + f2 : α → α' + /-- The relabeling for interior edges with three ends. -/ + f3 : α → α' + /-- The relabeling for an edge on a specified side. -/ + fS : Set S → α → α' + map_2 : ∀ x ∈ χ.Ω2.E, f2 x ∈ χ'.Ω2.E + map_3 : ∀ x ∈ χ.Ω3.E, f3 x ∈ χ'.Ω3.E + map_S : ∀ s ∈ χ.Φ.sides, ∀ x ∈ (χ.ΩS s).E, fS s x ∈ (χ'.ΩS s).E + le_2 : ∀ x ∈ χ.Ω2.E, ∀ y ∈ χ.Ω2.E, χ'.Ω2.le (f2 x) (f2 y) → χ.Ω2.le x y + le_3 : ∀ x ∈ χ.Ω3.E, ∀ y ∈ χ.Ω3.E, χ'.Ω3.le (f3 x) (f3 y) → χ.Ω3.le x y + le_S : ∀ s ∈ χ.Φ.sides, ∀ x ∈ (χ.ΩS s).E, ∀ y ∈ (χ.ΩS s).E, + (χ'.ΩS s).le (fS s x) (fS s y) → (χ.ΩS s).le x y + +namespace LabelMap + +variable {χ : ColourScheme S α} {χ' : ColourScheme S α'} + +open Classical in +/-- The new label of an edge. -/ +noncomputable def col (m : LabelMap χ χ') (P : ColouredPainting χ) (e : Set S) : α' := + if Painting.IsInternal e then + (if (tilde e).ncard = 2 then m.f2 (P.φ e) else m.f3 (P.φ e)) + else if h : ∃ s ∈ χ.Φ.sides, BordersSide e s then m.fS h.choose (P.φ e) else m.f2 (P.φ e) + +theorem col_two (m : LabelMap χ χ') (P : ColouredPainting χ) {e : Set S} + (hi : Painting.IsInternal e) (h2 : (tilde e).ncard = 2) : m.col P e = m.f2 (P.φ e) := by + simp [col, hi, h2] + +theorem col_three (m : LabelMap χ χ') (P : ColouredPainting χ) {e : Set S} + (hi : Painting.IsInternal e) (h3 : (tilde e).ncard = 3) : m.col P e = m.f3 (P.φ e) := by + simp [col, hi, h3] + +theorem not_internal {e s : Set S} (h : BordersSide e s) : ¬ Painting.IsInternal e := by + obtain ⟨x, hx, hb⟩ := h.1 + exact fun hi ↦ disjoint_left.mp hi hx hb + +theorem col_border (m : LabelMap χ χ') (P : ColouredPainting χ) {e s : Set S} (he : e ∈ P.Γ.E) + (hs : s ∈ χ.Φ.sides) (hb : BordersSide e s) : m.col P e = m.fS s (P.φ e) := by + classical + have hex : ∃ s ∈ χ.Φ.sides, BordersSide e s := ⟨s, hs, hb⟩ + have hspec := hex.choose_spec + obtain ⟨x, hx⟩ : e.Nonempty := he.2.2.1.nonempty + have hsame : hex.choose = s := GM11.arcComponent_eq hspec.1 hs (hspec.2.2 hx) (hb.2 hx) + rw [col, ite_eq_right (not_internal hb), dite_eq_left hex, hsame] + +/-- The `χ'`-coloured painting with the same painting and the new labels. -/ +noncomputable def map (m : LabelMap χ χ') (P : ColouredPainting χ) : ColouredPainting χ' where + Γ := P.Γ + φ := m.col P + fits := by + rw [m.hΦ] + exact P.fits + internal_2_mem e he hi h2 := by + rw [m.col_two P hi h2] + exact m.map_2 _ (P.internal_2_mem e he hi h2) + internal_3_mem e he hi h3 := by + rw [m.col_three P hi h3] + exact m.map_3 _ (P.internal_3_mem e he hi h3) + border_mem e he s hs hb := by + rw [m.hΦ] at hs + rw [m.col_border P he hs hb] + exact m.map_S s hs _ (P.border_mem e he s hs hb) + +theorem isInternal_of_linear {Γ Γ' : Painting S} {σv : S → Set S} {σe : Set S → Set S} + (h : IsLinearInflation Γ Γ' σv σe) {e : Set S} (he : e ∈ Γ.E) (hi : Painting.IsInternal e) : + Painting.IsInternal (σe e) := by + rw [Painting.IsInternal, disjoint_left] + intro x hx hb + obtain ⟨Θ, hΘ, hxΘ⟩ : ∃ Θ ∈ cuffs S, x ∈ Θ := ⟨_, ⟨x, hb, rfl⟩, mem_connectedComponentIn hb⟩ + obtain ⟨y, hy, hyΘ⟩ := (h.borders_iff e he Θ hΘ).2 ⟨x, hx, hxΘ⟩ + obtain ⟨z, hz, rfl⟩ := hΘ + exact disjoint_left.mp hi hy (connectedComponentIn_subset _ _ hyΘ) + +/-- A linear inflation of the relabelled paintings is a linear inflation of the old ones. -/ +theorem of_map (m : LabelMap χ χ') {P P' : ColouredPainting χ} {σv : S → Set S} + {σe : Set S → Set S} (h : IsColouredLinearInflation χ' (m.map P) (m.map P') σv σe) : + IsColouredLinearInflation χ P P' σv σe := by + have hinf : IsInflation P.Γ P'.Γ σv σe := h.isInflation + have hlin : IsLinearInflation P.Γ P'.Γ σv σe := h.isLinear + have hresp : RespectsFrame χ.Φ P.Γ σe := by + have := h.respects + rwa [m.hΦ] at this + refine ⟨⟨hinf, hresp, ?_, ?_, ?_⟩, hlin⟩ + · intro e he hi h2 + have hi' := isInternal_of_linear hlin he hi + have h2' : (tilde (σe e)).ncard = 2 := (hinf.edge_size e he).trans h2 + have hm' := hinf.edge_mem e he + have hle : χ'.Ω2.le (m.col P e) (m.col P' (σe e)) := h.le_internal_2 e he hi h2 + rw [m.col_two P hi h2, m.col_two P' hi' h2'] at hle + exact m.le_2 _ (P.internal_2_mem e he hi h2) _ (P'.internal_2_mem _ hm' hi' h2') hle + · intro e he hi h3 + have hi' := isInternal_of_linear hlin he hi + have h3' : (tilde (σe e)).ncard = 3 := (hinf.edge_size e he).trans h3 + have hm' := hinf.edge_mem e he + have hle : χ'.Ω3.le (m.col P e) (m.col P' (σe e)) := h.le_internal_3 e he hi h3 + rw [m.col_three P hi h3, m.col_three P' hi' h3'] at hle + exact m.le_3 _ (P.internal_3_mem e he hi h3) _ (P'.internal_3_mem _ hm' hi' h3') hle + · intro e he s hs hb + have hm' := hinf.edge_mem e he + obtain ⟨hb', hiff⟩ := hresp e he hb.1 + have hb₂ : BordersSide (σe e) s := ⟨hb', (hiff s hs).1 hb.2⟩ + have hle : (χ'.ΩS s).le (m.col P e) (m.col P' (σe e)) := + h.le_border e he s (by rw [m.hΦ]; exact hs) hb + rw [m.col_border P he hs hb, m.col_border P' hm' hs hb₂] at hle + exact m.le_S s hs _ (P.border_mem e he s hs hb) _ (P'.border_mem _ hm' s hs hb₂) hle + +theorem isBadSequence (m : LabelMap χ χ') {P : ℕ → ColouredPainting χ} (h : IsBadSequence χ P) : + IsBadSequence χ' fun i ↦ m.map (P i) := + fun i j hij ⟨σv, σe, hσ⟩ ↦ h i j hij ⟨σv, σe, m.of_map hσ⟩ + +theorem isBad (m : LabelMap χ χ') (h : χ.IsBad) : χ'.IsBad := by + obtain ⟨P, hP⟩ := h + exact ⟨_, m.isBadSequence hP⟩ + +theorem isOrientedlyBad (m : LabelMap χ χ') (h : χ.IsOrientedlyBad) : χ'.IsOrientedlyBad := by + obtain ⟨P, hP, hsim⟩ := h + exact ⟨_, m.isBadSequence hP, hsim⟩ + +end LabelMap + +/-- The copy of `χ` over `Option α × ℕ`. -/ +def ColourScheme.lift (χ : ColourScheme S α) : ColourScheme S (Option α × ℕ) where + isSurface := χ.isSurface + connected := χ.connected + Φ := χ.Φ + Ω2 := χ.Ω2.map (fun x ↦ (some x, 0)) fun _ _ h ↦ by simpa using h + Ω3 := χ.Ω3.map (fun x ↦ (some x, 0)) fun _ _ h ↦ by simpa using h + ΩS s := (χ.ΩS s).map (fun x ↦ (some x, 0)) fun _ _ h ↦ by simpa using h + shortElem s := (some (χ.shortElem s), 0) + isWQO_2 := QuasiOrder.map_isWQO _ χ.isWQO_2 + isWQO_3 := QuasiOrder.map_isWQO _ χ.isWQO_3 + isWQO_S s hs := QuasiOrder.map_isWQO _ (χ.isWQO_S s hs) + short_singleton s hs := by + change (fun x ↦ (some x, 0)) '' (χ.ΩS s).E = _ + rw [χ.short_singleton s hs, image_singleton] + +/-- `χ` maps to its copy over `Option α × ℕ`. -/ +def ColourScheme.liftMap (χ : ColourScheme S α) : LabelMap χ χ.lift where + hΦ := rfl + f2 x := (some x, 0) + f3 x := (some x, 0) + fS _ x := (some x, 0) + map_2 _ hx := mem_image_of_mem _ hx + map_3 _ hx := mem_image_of_mem _ hx + map_S _ _ _ hx := mem_image_of_mem _ hx + le_2 _ _ _ _ := by + rintro ⟨a, b, h₁, h₂, h⟩ + simp only [Prod.mk.injEq, Option.some.injEq, and_true] at h₁ h₂ + rwa [h₁, h₂] + le_3 _ _ _ _ := by + rintro ⟨a, b, h₁, h₂, h⟩ + simp only [Prod.mk.injEq, Option.some.injEq, and_true] at h₁ h₂ + rwa [h₁, h₂] + le_S _ _ _ _ _ _ := by + rintro ⟨a, b, h₁, h₂, h⟩ + simp only [Prod.mk.injEq, Option.some.injEq, and_true] at h₁ h₂ + rwa [h₁, h₂] + +section Disjoint + +variable {β : Type w} (e : β × ℕ ≃ β) + +/-- The copy of `β` with tag `n`. -/ +def tagged (n : ℕ) (x : β) : β := e (x, n) + +theorem tagged_injective (n : ℕ) : Injective (tagged e n) := fun _ _ h ↦ by + simpa [tagged] using h + +theorem tagged_ne {n m : ℕ} (hnm : n ≠ m) (x y : β) : tagged e n x ≠ tagged e m y := fun h ↦ by + have := e.injective h + simp only [Prod.mk.injEq] at this + exact hnm this.2 + +/-- Undoes every `tagged e n`. -/ +def untag (y : β) : β := (e.symm y).1 + +theorem untag_tagged (n : ℕ) (x : β) : untag e (tagged e n x) = x := by + simp [untag, tagged] + +theorem disjoint_map (Ω Ω' : QuasiOrder β) {n m : ℕ} (hnm : n ≠ m) : + Disjoint (Ω.map (tagged e n) (tagged_injective e n)).E + (Ω'.map (tagged e m) (tagged_injective e m)).E := by + rw [disjoint_left] + rintro _ ⟨x, -, rfl⟩ ⟨y, -, h⟩ + exact tagged_ne e hnm x y h.symm + +variable {S' : Type u} [TopologicalSpace S'] + +/-- The scheme `χ'` with its internal labels moved back by `tagged e 0`, `tagged e 1`, and with the +labels of each long side `R` moved back by `tagged e (t R)`. -/ +noncomputable def ColourScheme.pull (χ' : ColourScheme S' β) (t : Set S' → ℕ) (L : Set S' → Prop) : + ColourScheme S' β where + isSurface := χ'.isSurface + connected := χ'.connected + Φ := χ'.Φ + Ω2 := χ'.Ω2.comap (tagged e 0) + Ω3 := χ'.Ω3.comap (tagged e 1) + ΩS s := open Classical in if L s ∧ s ∈ χ'.Φ.longSides then (χ'.ΩS s).comap (tagged e + (t s)) else χ'.ΩS s + shortElem := χ'.shortElem + isWQO_2 := QuasiOrder.comap_isWQO χ'.isWQO_2 + isWQO_3 := QuasiOrder.comap_isWQO χ'.isWQO_3 + isWQO_S s hs := by + by_cases h : L s ∧ s ∈ χ'.Φ.longSides + · simpa only [ite_eq_left h] using QuasiOrder.comap_isWQO (χ'.isWQO_S s hs) + · simpa only [ite_eq_right h] using χ'.isWQO_S s hs + short_singleton s hs := by + have h : ¬ (L s ∧ s ∈ χ'.Φ.longSides) := fun h ↦ hs.2 h.2.2 + simpa only [ite_eq_right h] using χ'.short_singleton s hs + +theorem tagged_untag {Ω : QuasiOrder β} {n : ℕ} {y : β} + (hy : y ∈ (Ω.map (tagged e n) (tagged_injective e n)).E) : tagged e n (untag e y) = y := by + obtain ⟨x, -, rfl⟩ := hy + rw [untag_tagged] + +/-- `χ'` maps to `χ'.pull` when its labels are tagged in the right way. -/ +noncomputable def ColourScheme.pullMap (χ' : ColourScheme S' β) (t : Set S' → ℕ) (L : Set S' → Prop) + (h2 : ∀ y ∈ χ'.Ω2.E, tagged e 0 (untag e y) = y) + (h3 : ∀ y ∈ χ'.Ω3.E, tagged e 1 (untag e y) = y) + (hS : ∀ s, L s → s ∈ χ'.Φ.longSides → ∀ y ∈ (χ'.ΩS s).E, tagged e (t s) (untag e y) = y) : + open Classical in LabelMap χ' (χ'.pull e t L) where + hΦ := rfl + f2 := untag e + f3 := untag e + fS s := open Classical in if L s ∧ s ∈ χ'.Φ.longSides then untag e else id + map_2 x hx := by + change tagged e 0 (untag e x) ∈ χ'.Ω2.E + rwa [h2 x hx] + map_3 x hx := by + change tagged e 1 (untag e x) ∈ χ'.Ω3.E + rwa [h3 x hx] + map_S s hs x hx := by + by_cases h : L s ∧ s ∈ χ'.Φ.longSides + · simp only [ColourScheme.pull, ite_eq_left h] + change tagged e (t s) (untag e x) ∈ (χ'.ΩS s).E + rwa [hS s h.1 h.2 x hx] + · simp only [ColourScheme.pull, ite_eq_right h] + exact hx + le_2 x hx y hy hle := by + change χ'.Ω2.le (tagged e 0 (untag e x)) (tagged e 0 (untag e y)) at hle + rwa [h2 x hx, h2 y hy] at hle + le_3 x hx y hy hle := by + change χ'.Ω3.le (tagged e 1 (untag e x)) (tagged e 1 (untag e y)) at hle + rwa [h3 x hx, h3 y hy] at hle + le_S s hs x hx y hy hle := by + by_cases h : L s ∧ s ∈ χ'.Φ.longSides + · simp only [ColourScheme.pull, ite_eq_left h] at hle + change (χ'.ΩS s).le (tagged e (t s) (untag e x)) (tagged e (t s) (untag e y)) at hle + rwa [hS s h.1 h.2 x hx, hS s h.1 h.2 y hy] at hle + · simp only [ColourScheme.pull, ite_eq_right h] at hle + exact hle + +variable {S₀ : Type u} [TopologicalSpace S₀] + +/-- The copy of `χ` with tag `0` on `Ω(2)`, tag `1` on `Ω(3)`, and tag `2 + t s` on `Ω(s)`. When `t` +is +injective on the sides this copy is disjoint. -/ +def ColourScheme.tag (χ : ColourScheme S₀ β) (t : Set S₀ → ℕ) : ColourScheme S₀ β where + isSurface := χ.isSurface + connected := χ.connected + Φ := χ.Φ + Ω2 := χ.Ω2.map (tagged e 0) (tagged_injective e 0) + Ω3 := χ.Ω3.map (tagged e 1) (tagged_injective e 1) + ΩS s := (χ.ΩS s).map (tagged e (2 + t s)) (tagged_injective e _) + shortElem s := tagged e (2 + t s) (χ.shortElem s) + isWQO_2 := QuasiOrder.map_isWQO _ χ.isWQO_2 + isWQO_3 := QuasiOrder.map_isWQO _ χ.isWQO_3 + isWQO_S s hs := QuasiOrder.map_isWQO _ (χ.isWQO_S s hs) + short_singleton s hs := by + change tagged e (2 + t s) '' (χ.ΩS s).E = _ + rw [χ.short_singleton s hs, image_singleton] + +/-- `χ` maps to its tagged copy. -/ +def ColourScheme.tagMap (χ : ColourScheme S₀ β) (t : Set S₀ → ℕ) : LabelMap χ (χ.tag e t) where + hΦ := rfl + f2 := tagged e 0 + f3 := tagged e 1 + fS s := tagged e (2 + t s) + map_2 _ hx := mem_image_of_mem _ hx + map_3 _ hx := mem_image_of_mem _ hx + map_S _ _ _ hx := mem_image_of_mem _ hx + le_2 _ _ _ _ := by + rintro ⟨a, b, h₁, h₂, h⟩ + rwa [tagged_injective e 0 h₁, tagged_injective e 0 h₂] + le_3 _ _ _ _ := by + rintro ⟨a, b, h₁, h₂, h⟩ + rwa [tagged_injective e 1 h₁, tagged_injective e 1 h₂] + le_S s _ _ _ _ _ := by + rintro ⟨a, b, h₁, h₂, h⟩ + rwa [tagged_injective e (2 + t s) h₁, tagged_injective e (2 + t s) h₂] + +theorem ColourScheme.tag_disjoint (χ : ColourScheme S₀ β) {t : Set S₀ → ℕ} + (ht : InjOn t χ.Φ.sides) : (χ.tag e t).IsDisjoint where + disj_2_3 := disjoint_map e _ _ (by omega) + disj_2_S _ _ := disjoint_map e _ _ (by omega) + disj_3_S _ _ := disjoint_map e _ _ (by omega) + disj_S_S s₁ h₁ s₂ h₂ hne := disjoint_map e _ _ fun h ↦ hne (ht h₁ h₂ (by omega)) + +variable {Shat Shat₀ : Type u} [TopologicalSpace Shat] [TopologicalSpace Shat₀] + +theorem ColourScheme.tag_S2 {χ : ColourScheme S₀ β} (t : Set S₀ → ℕ) + {cap : IsCappedSurface S₀ Shat₀} (h : ConditionS2 χ cap) : ConditionS2 (χ.tag e t) cap := by + classical + rintro S' Shat' _ _ χ' hcap hhom h3 h2 hstrict hb + have h3E : ∀ y ∈ χ'.Ω3.E, tagged e 1 (untag e y) = y := fun y hy ↦ tagged_untag e (h3.E_subset hy) + have h2E : ∀ y ∈ χ'.Ω2.E, tagged e 0 (untag e y) = y := fun y hy ↦ tagged_untag e (h2.E_subset hy) + refine h S' Shat' (χ'.pull e (fun _ ↦ 0) (fun _ ↦ False)) hcap hhom + (QuasiOrder.comap_subIdeal (tagged_injective e 1) h3) (QuasiOrder.comap_subIdeal + (tagged_injective e 0) h2) ?_ + ((χ'.pullMap e _ _ h2E h3E fun _ h ↦ h.elim).isOrientedlyBad hb) + rcases hstrict with hs | hs + · exact Or.inl ⟨QuasiOrder.comap_subIdeal (tagged_injective e 1) h3, + QuasiOrder.comap_E_ne (tagged_injective e 1) h3 hs.2⟩ + · exact Or.inr ⟨QuasiOrder.comap_subIdeal (tagged_injective e 0) h2, + QuasiOrder.comap_E_ne (tagged_injective e 0) h2 hs.2⟩ + +theorem ColourScheme.tag_S3 {χ : ColourScheme S₀ β} (t : Set S₀ → ℕ) + {cap : IsCappedSurface S₀ Shat₀} (h : ConditionS3 χ cap) : ConditionS3 (χ.tag e t) cap := by + classical + rintro S' Shat' _ _ χ' hcap hhom h2 h3 hlt hb + have h3E : ∀ y ∈ χ'.Ω3.E, tagged e 1 (untag e y) = y := fun y hy ↦ by + rw [h3] at hy + exact tagged_untag e hy + have h2E : ∀ y ∈ χ'.Ω2.E, tagged e 0 (untag e y) = y := fun y hy ↦ by + rw [h2] at hy + exact tagged_untag e hy + refine h S' Shat' (χ'.pull e (fun _ ↦ 0) (fun _ ↦ False)) hcap hhom ?_ ?_ hlt + ((χ'.pullMap e _ _ h2E h3E fun _ h ↦ h.elim).isOrientedlyBad hb) + · change χ'.Ω2.comap (tagged e 0) = _ + rw [h2] + exact QuasiOrder.comap_map _ (tagged_injective e 0) + · change χ'.Ω3.comap (tagged e 1) = _ + rw [h3] + exact QuasiOrder.comap_map _ (tagged_injective e 1) + +theorem ColourScheme.tag_S4 {χ : ColourScheme S₀ β} (t : Set S₀ → ℕ) (h : ConditionS4 χ) : + ConditionS4 (χ.tag e t) := by + classical + rintro S' _ χ' ⟨hhom, h2, h3, f, hf, hsub, hstrict, hshort⟩ hb + have h3E : ∀ y ∈ χ'.Ω3.E, tagged e 1 (untag e y) = y := fun y hy ↦ by + rw [h3] at hy + exact tagged_untag e hy + have h2E : ∀ y ∈ χ'.Ω2.E, tagged e 0 (untag e y) = y := fun y hy ↦ by + rw [h2] at hy + exact tagged_untag e hy + let t' : Set S' → ℕ := fun R ↦ 2 + t (f R) + have hSE : ∀ R, True → R ∈ χ'.Φ.longSides → ∀ y ∈ (χ'.ΩS R).E, tagged e (t' R) (untag e y) = y := + fun R _ hR y hy ↦ tagged_untag e ((hsub R hR).E_subset hy) + have hpull : ∀ R ∈ χ'.Φ.longSides, ((χ'.pull e t' fun _ ↦ True).ΩS R) = + (χ'.ΩS R).comap (tagged e (t' R)) := fun R hR ↦ by + simp only [ColourScheme.pull, true_and, ite_eq_left hR] + refine h S' (χ'.pull e t' fun _ ↦ True) ⟨hhom, ?_, ?_, f, hf, ?_, ?_, ?_⟩ + ((χ'.pullMap e t' _ h2E h3E hSE).isOrientedlyBad hb) + · change χ'.Ω2.comap (tagged e 0) = _ + rw [h2] + exact QuasiOrder.comap_map _ (tagged_injective e 0) + · change χ'.Ω3.comap (tagged e 1) = _ + rw [h3] + exact QuasiOrder.comap_map _ (tagged_injective e 1) + · intro R hR + rw [hpull R hR] + exact QuasiOrder.comap_subIdeal (tagged_injective e _) (hsub R hR) + · intro R₁ h₁ R₂ h₂ hne hff + rw [hpull R₁ h₁] + exact ⟨QuasiOrder.comap_subIdeal (tagged_injective e _) (hsub R₁ h₁), + QuasiOrder.comap_E_ne (tagged_injective e _) (hsub R₁ h₁) (hstrict R₁ h₁ R₂ h₂ hne hff).2⟩ + · intro hall + refine hshort fun s hs ↦ ?_ + obtain ⟨R, hR, hfR, hE⟩ := hall s hs + refine ⟨R, hR, hfR, ?_⟩ + rw [hpull R hR] at hE + subst hfR + by_contra hne + exact QuasiOrder.comap_E_ne (tagged_injective e _) (hsub R hR) hne hE + +/-- **Graph Minors XIX, Section 15**: "(by replacing the $\Omega_\chi(k)$'s and $\Omega_\chi(S)$'s +by isomorphic well-quasi-orders) we may choose $\chi$ to be disjoint". -/ +theorem ColourScheme.exists_disjoint [Infinite β] (χ : ColourScheme S₀ β) + (cap : IsCappedSurface S₀ Shat₀) (h2 : ConditionS2 χ cap) (h3 : ConditionS3 χ cap) + (h4 : ConditionS4 χ) (hb : χ.IsOrientedlyBad) : + ∃ χ' : ColourScheme S₀ β, χ'.IsDisjoint ∧ ConditionS2 χ' cap ∧ ConditionS3 χ' cap ∧ + ConditionS4 χ' ∧ χ'.IsOrientedlyBad := by + obtain ⟨e⟩ : Nonempty (β × ℕ ≃ β) := by + rw [← Cardinal.eq] + simp [Cardinal.mul_aleph0_eq (Cardinal.aleph0_le_mk β)] + obtain ⟨t, ht⟩ := Set.countable_iff_exists_injOn.mp χ.Φ.finite_sides.countable + exact ⟨χ.tag e t, χ.tag_disjoint e ht, ColourScheme.tag_S2 e t h2, ColourScheme.tag_S3 e t h3, + ColourScheme.tag_S4 e t h4, (χ.tagMap e t).isOrientedlyBad hb⟩ + +end Disjoint + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10a.lean b/LeanPool/GraphMinor/GM19/Section10a.lean new file mode 100644 index 0000000000..d93f0ba6e0 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10a.lean @@ -0,0 +1,423 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Poles +public import LeanPool.GraphMinor.GM19.Defs3 + +/-! +# Graph Minors XIX, (10.1), the first and third assertions + +The improvement step behind the second assertion is `flaw_theta`: a path `Q` that joins two vertices +of a representativeness flaw `F`, and is lighter than both paths of `F`, gives a lighter flaw. The +second assertion is proved in `Section10b.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +section Theta + +variable {T : Type} [TopologicalSpace T] [T2Space T] [ConnectedSpace T] + {G F F₁ F₂ P : Drawing T} {u v : T} + +omit [T2Space T] [ConnectedSpace T] in +/-- The two paths of a circuit meet only in their ends, as point sets. -/ +theorem TwoPaths.inter_U (h : TwoPaths G F F₁ F₂ P u v) {x : T} (h₁ : x ∈ F₁.U) (h₂ : x ∈ F₂.U) : + x = u ∨ x = v := by + by_cases hxV : x ∈ F₁.V + · exact h.inter_V ⟨hxV, mem_V_of_mem_U h.sub₂ h₂ (h.sub₁.1 hxV)⟩ + · obtain ⟨g, hg, hxg⟩ := F₁.exists_edge_of_mem h₁ hxV + have hn : g ∉ F₂.E := disjoint_left.mp h.disj_E hg + exact absurd h₂ (disjoint_left.mp (edge_disjoint_U h.sub₂ (h.sub₁.2 hg) hn) hxg) + +end Theta + +/-- The complement of a disc bounded by `F`, if it is a disc, is also bounded by `F`. -/ +theorem discBd_closure_compl {T : Type} [TopologicalSpace T] [T2Space T] [ConnectedSpace T] + (hT : IsClosedSurface T) {F : Drawing T} {Δ : Set T} (hΔ : IsClosedDisc Δ) + (hbd : discBd Δ = F.U) (hd : IsClosedDisc (closure Δᶜ)) : discBd (closure Δᶜ) = F.U := by + have hO := isSide_out hT hΔ hbd + have hE : closure Δᶜ = Δᶜ ∪ F.U := by + rw [closure_eq_self_union_frontier, hO.frontier_eq] + have hsub : F.U ⊆ Δ := hbd ▸ Surface.discBd_subset _ + have hc : (closure Δᶜ)ᶜ = discInt Δ := by + rw [hE] + ext x + simp only [mem_compl_iff, mem_union, not_or, not_not] + exact ⟨fun h ↦ ⟨h.1, hbd ▸ h.2⟩, fun h ↦ ⟨h.1, hbd ▸ h.2⟩⟩ + rw [← IsClosedDisc.frontier_eq_discBd hT hd, frontier_eq_closure_inter_closure, + closure_closure, hc, closure_discInt hΔ, hE] + ext x + exact ⟨fun ⟨h₁, h₂⟩ ↦ h₁.resolve_left (not_not.mpr h₂), fun h ↦ ⟨Or.inr h, hsub h⟩⟩ + +/-- The two sides of a drawing that bounds a disc `Δ` are `Δ` and the closure of its complement. -/ +theorem isSidesOf_cases {T : Type} [TopologicalSpace T] [T2Space T] [ConnectedSpace T] + (hT : IsClosedSurface T) {F : Drawing T} {Δ S₁ S₂ : Set T} (hΔ : IsClosedDisc Δ) + (hbd : discBd Δ = F.U) (hs : IsSidesOf F S₁ S₂) : + (S₁ = Δ ∧ S₂ = closure Δᶜ) ∨ (S₁ = closure Δᶜ ∧ S₂ = Δ) := by + obtain ⟨C₁, C₂, hne, hset, rfl, rfl⟩ := hs + have h₀ : Sided F (discInt Δ) Δᶜ := ⟨Δ, hΔ, hbd, Or.inl ⟨rfl, rfl⟩⟩ + have hset' : componentsIn F.Uᶜ = {discInt Δ, Δᶜ} := Sided.components hT h₀ + have hC₁ : C₁ ∈ componentsIn F.Uᶜ := by rw [hset]; exact Or.inl rfl + have hC₂ : C₂ ∈ componentsIn F.Uᶜ := by rw [hset]; exact Or.inr rfl + rw [hset'] at hC₁ hC₂ + rcases hC₁ with rfl | rfl + · rcases hC₂ with rfl | rfl + · exact absurd rfl hne + · exact Or.inl ⟨closure_discInt hΔ, rfl⟩ + · rcases hC₂ with rfl | rfl + · exact Or.inr ⟨rfl, closure_discInt hΔ⟩ + · exact absurd rfl hne + +/-- On a surface that is not a sphere, a second disc cannot include the complement of a disc. -/ +theorem not_compl_subset {T : Type} [TopologicalSpace T] [T2Space T] [ConnectedSpace T] + (hT : IsClosedSurface T) (hns : ¬ IsSphere T) {F C : Drawing T} {Δ Δ' : Set T} + (hΔ : IsClosedDisc Δ) (hbd : discBd Δ = F.U) (hΔ' : IsClosedDisc Δ') (hbd' : discBd Δ' = C.U) + (h : Δᶜ ⊆ Δ') : False := by + have hO := isSide_out hT hΔ hbd + have hsub : F.U ⊆ Δ' := fun x hx ↦ + closure_minimal h hΔ'.isClosed (hO.U_subset_closure hx) + obtain ⟨D, ⟨hD, hDd, hDb, -⟩, -⟩ := disc_oArc Δ' F.U hΔ' hsub + (hbd ▸ hΔ.isOArc_discBd) + have heq : D = Δ := eq_of_discBd_eq (Surface.IsClosedSurface.isSurface hT) hns hDd hΔ + (hDb.trans hbd.symm) + obtain ⟨y, hy⟩ := (isSide_out hT hΔ' hbd').nonempty + by_cases hyΔ : y ∈ Δ + · exact hy (hD (heq ▸ hyΔ)) + · exact hy (h hyΔ) + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {α : Type w} {χ : ColourScheme S α} {D : TangleDatum cap χ} + {F F₁ F₂ Q : Drawing Shat} {a b : Shat} + +namespace TangleDatum + +omit [T2Space S] in +/-- A disc bounded by a circuit with `𝒯` on the outside cannot be lighter than a representativeness +flaw. -/ +theorem IsRepFlaw.weight_le (hFl : D.IsRepFlaw F) {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hc : C.E.ncard ≤ F.E.ncard) {Δ : Set Shat} (hΔ : IsClosedDisc Δ) (hbd : discBd Δ = C.U) + (hm : (partIn cap D.Γ (closure Δᶜ), partIn cap D.Γ Δ) ∈ D.𝒯) : + D.tb.weightSub F ≤ D.tb.weightSub C := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + refine hFl.minimal_weight C hC (hc.trans hFl.card_le) ⟨closure Δᶜ, Δ, ?_, ?_, hm⟩ + · have h : Sided C Δᶜ (discInt Δ) := ⟨Δ, hΔ, hbd, Or.inr ⟨rfl, rfl⟩⟩ + have := h.isSidesOf hT + rwa [closure_discInt hΔ] at this + · intro hdisc + have hfr := (discBd_closure_compl hT hΔ hbd hdisc).trans hbd.symm + have heq := eq_of_discBd_eq (Surface.IsClosedSurface.isSurface hT) hFl.not_sphere hdisc hΔ hfr + obtain ⟨y, hy⟩ := (isSide_out hT hΔ hbd).nonempty + exact hy (heq ▸ subset_closure hy) + +omit [T2Space S] in +omit [T2Space Shat] in +/-- A flaw is shorter than twice `rep(Γ)`. -/ +theorem IsRepFlaw.lt_two_rep (hFl : D.IsRepFlaw F) : (F.E.ncard : ℕ∞) < 2 * Painting.rep D.rad := by + have h₁ := hFl.card_le + have h₂ := hFl.lt_rep_Γ + generalize Painting.rep D.rad = r at h₂ ⊢ + induction r using ENat.recTopCoe with + | top => + rw [ENat.mul_top (by simp)] + exact ENat.natCast_lt_top _ + | coe n => + have h₃ : D.rep < n := by exact_mod_cast h₂ + have h₄ : F.E.ncard < 2 * n := by omega + exact_mod_cast h₄ + +variable (hS : IsSurface S) (h3 : D.P.Γ.IsInternallyThreeConnected) +include hS h3 + +/-- A circuit no longer than a flaw has one of its two discs on the small side of `𝒯`. -/ +theorem IsRepFlaw.disc_mem_or (hFl : D.IsRepFlaw F) {C : Drawing Shat} + (hC : C.IsCircuitOf D.rad.G) (hc : C.E.ncard ≤ F.E.ncard) {Δ : Set Shat} (hΔ : IsClosedDisc Δ) + (hbd : discBd Δ = C.U) : + (partIn cap D.P.Γ Δ, partIn cap D.P.Γ (closure Δᶜ)) ∈ D.𝒯 ∨ + (partIn cap D.P.Γ (closure Δᶜ), partIn cap D.P.Γ Δ) ∈ D.𝒯 := by + have : ConnectedSpace Shat := cap.connected + have h₁ := (disc_facts hS h3 D.rad hC hΔ hbd).1 + have o := disc_order hS h3 D.rad hC hΔ hbd + refine D.isTangle.axiom1 h₁ ?_ + have := hFl.lt_ord_T + have := hFl.card_le + omega + + +/-- **The improvement step.** Let `Q` join two vertices of a representativeness flaw `F`, and meet +`F` +in nothing else. If `Q` is lighter than each of the two paths of `F`, and no longer, then we get a +lighter flaw. So no such `Q` exists. This is the argument in the proof of (10.1) of Graph Minors +XIX: +"Thus if $e_1 \subseteq \Sigma_2$ then one of $F_1 \cup Q, F_2 \cup Q$ contradicts the choice of +$F$. If $e_1 \not\subseteq \Sigma_2$ then one of $U(F_1 \cup Q), U(F_2 \cup Q)$ bounds a disc in +$\hat{\Sigma}_\chi$ including $\Sigma_2$, because $\hat{\Sigma}$ is not a sphere and +$rep(\Gamma) > \frac{1}{2}|E(F)|$, and again the choice of $F$ is contradicted." -/ +theorem IsRepFlaw.theta (hFl : D.IsRepFlaw F) {Δ : Set Shat} (hΔ : IsClosedDisc Δ) + (hbd : discBd Δ = F.U) (hm : (partIn cap D.P.Γ (closure Δᶜ), partIn cap D.P.Γ Δ) ∈ D.𝒯) + (ht : TwoPaths D.rad.G F F₁ F₂ Q a b) (hc₁ : Q.E.ncard ≤ F₁.E.ncard) + (hw₁ : D.tb.weightSub Q < D.tb.weightSub F₁) (hc₂ : Q.E.ncard ≤ F₂.E.ncard) + (hw₂ : D.tb.weightSub Q < D.tb.weightSub F₂) : False := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hsurf := Surface.IsClosedSurface.isSurface hT + have hns := hFl.not_sphere + set G := D.rad.G with hG + have hF : F.IsCircuitOf G := hFl.is_circuit + -- A circuit made of `Q` and one path of `F` is lighter than `F`. + have improve : ∀ {Fa Fb : Drawing Shat}, TwoPaths G F Fa Fb Q a b → Q.E.ncard ≤ Fa.E.ncard → + D.tb.weightSub Q < D.tb.weightSub Fa → + Drawing.IsCircuitOf (G.sup Q Fb) G ∧ (G.sup Q Fb).E.ncard ≤ F.E.ncard ∧ + D.tb.weightSub (G.sup Q Fb) < D.tb.weightSub F := by + intro Fa Fb h hc hw + have hE : (G.sup Q Fb).E = Q.E ∪ Fb.E := Drawing.sup_E h.path.1 h.sub₂ + have hdis : Disjoint Q.E Fb.E := disjoint_left.mpr fun e he he' ↦ + disjoint_left.mp h.meet_E he (h.right.1.2 he') + refine ⟨⟨G.sup_isSubdrawing Q Fb, h.left_circuit⟩, ?_, ?_⟩ + · rw [hE, ncard_union_eq hdis Q.finite_edges Fb.finite_edges, h.union_E, + ncard_union_eq h.disj_E Fa.finite_edges Fb.finite_edges] + omega + · rw [D.tb.weightSub_sup hE hdis, D.tb.weightSub_sup h.union_E h.disj_E] + linarith + have noDisc : ∀ {C : Drawing Shat}, C.IsCircuitOf G → C.E.ncard ≤ F.E.ncard → + D.tb.weightSub C < D.tb.weightSub F → ∀ {Δ' : Set Shat}, IsClosedDisc Δ' → + discBd Δ' = C.U → (partIn cap D.P.Γ Δ', partIn cap D.P.Γ (closure Δ'ᶜ)) ∈ D.𝒯 := by + intro C hC hc hw Δ' hΔ' hbd' + rcases hFl.disc_mem_or hS h3 hC hc hΔ' hbd' with h | h + · exact h + · exact absurd (hFl.weight_le hC hc hΔ' hbd' h) (not_le.mpr hw) + obtain ⟨hC₂, hcC₂, hwC₂⟩ := improve ht hc₁ hw₁ + obtain ⟨hC₁, hcC₁, hwC₁⟩ := improve ht.swap hc₂ hw₂ + have hfour : ∀ {C : Drawing Shat}, C.IsCircuitOf G → C.E.ncard ≤ F.E.ncard → + ∃ Δ', IsClosedDisc Δ' ∧ discBd Δ' = C.U := fun hC hc ↦ + exists_disc_of_lt_rep hC (lt_of_le_of_lt (by exact_mod_cast hc) hFl.lt_two_rep) + obtain ⟨Δ₁, hΔ₁, hbd₁⟩ := hfour hC₁ hcC₁ + obtain ⟨Δ₂, hΔ₂, hbd₂⟩ := hfour hC₂ hcC₂ + have m₁ := noDisc hC₁ hcC₁ hwC₁ hΔ₁ hbd₁ + have m₂ := noDisc hC₂ hcC₂ hwC₂ hΔ₂ hbd₂ + have hin := isSide_int hT hΔ hbd + have hout := isSide_out hT hΔ hbd + have hdis : Disjoint (discInt Δ) Δᶜ := disjoint_left.mpr fun x hx hx' ↦ hx' hx.1 + have hcov : F.Uᶜ ⊆ discInt Δ ∪ Δᶜ := fun x hx ↦ by + by_cases hxΔ : x ∈ Δ + · exact Or.inl ⟨hxΔ, fun hb ↦ hx (hbd ▸ hb)⟩ + · exact Or.inr hxΔ + have hO₁ := isSide_int hT hΔ₁ hbd₁ + have hO₂ := isSide_int hT hΔ₂ hbd₂ + rcases path_side ht.sub hin hout hdis hcov ht.path.1 ht.path.2 ht.ne ht.meet_V ht.meet_E with + hP | hP + · -- `Q` lies inside `Δ`, so the discs miss the outside. + have d₁ : Disjoint Δᶜ Δ₁ := disjoint_disc hT hout hΔ₁ hbd₁ + (ht.swap.side_disjoint hout hdis.symm hP) fun h ↦ + not_compl_subset hT hns hΔ hbd hΔ₁ hbd₁ (h.trans (discInt_subset _)) + have d₂ : Disjoint Δᶜ Δ₂ := disjoint_disc hT hout hΔ₂ hbd₂ + (ht.side_disjoint hout hdis.symm hP) fun h ↦ + not_compl_subset hT hns hΔ hbd hΔ₂ hbd₂ (h.trans (discInt_subset _)) + have hc := ht.theta_cover hT hout hΔ₁ hΔ₂ hbd₁ hbd₂ d₁ d₂ + have hu := part_cover D.rad hF.1 hC₁.1 hC₂.1 hout hO₁ hO₂ (fun x ↦ by + rw [closure_discInt hΔ₁, closure_discInt hΔ₂] + exact hc x) + rw [closure_discInt hΔ₁, closure_discInt hΔ₂] at hu + exact D.isTangle.axiom2 hm m₁ m₂ hu + · -- `Q` lies outside `Δ`, so a circuit bounds a disc that includes `Δ`. + have key : ∀ {C : Drawing Shat} {Δ' : Set Shat}, C.IsSubdrawing G → IsClosedDisc Δ' → + discBd Δ' = C.U → (partIn cap D.P.Γ Δ', partIn cap D.P.Γ (closure Δ'ᶜ)) ∈ D.𝒯 → + Δ ⊆ Δ' → False := by + intro C Δ' hC hΔ' hbd' hm' hsub + have hO := isSide_int hT hΔ' hbd' + have hu := part_cover D.rad hF.1 hC hC hout hO hO (fun x ↦ by + rw [closure_discInt hΔ'] + by_cases hx : x ∈ Δ + · exact Or.inr (Or.inl (hsub hx)) + · exact Or.inl (subset_closure hx)) + rw [closure_discInt hΔ'] at hu + exact D.isTangle.axiom2 hm hm' hm' hu + by_cases hin₁ : discInt Δ ⊆ discInt Δ₁ + · refine key hC₁.1 hΔ₁ hbd₁ m₁ ?_ + rw [← closure_discInt hΔ] + exact closure_minimal (hin₁.trans (discInt_subset _)) hΔ₁.isClosed + · have d₁ : Disjoint (discInt Δ) Δ₁ := disjoint_disc hT hin hΔ₁ hbd₁ + (ht.swap.side_disjoint hin hdis hP) hin₁ + have hL := isLine_of_isPathBetween ht.left.2 ht.ne + have hF₁F : F₁.U ⊆ F.U := by rw [ht.U_eq]; exact subset_union_left + have hF₂F : F₂.U ⊆ F.U := by rw [ht.U_eq]; exact subset_union_right + have hUC₁ : (G.sup Q F₁).U = Q.U ∪ F₁.U := ht.swap.U_right + have hUC₂ : (G.sup Q F₂).U = Q.U ∪ F₂.U := ht.U_right + have hbdΔ : F.U ⊆ Δ := hbd ▸ Surface.discBd_subset _ + have hab := ht.mem_V₁ + have hmeet : Δ₁ ∩ Δ = F₁.U := by + apply Subset.antisymm + · rintro x ⟨hx₁, hx⟩ + have hxF : x ∈ F.U := by + by_contra hn + exact disjoint_left.mp d₁ ⟨hx, hbd ▸ hn⟩ hx₁ + rcases (ht.U_eq ▸ hxF : x ∈ F₁.U ∪ F₂.U) with h | h + · exact h + · by_contra hn + have hxb : x ∉ discBd Δ₁ := by + rw [hbd₁, hUC₁] + rintro (hq | hq) + · rcases hP x hq with h' | rfl | rfl + · exact h' (hbdΔ hxF) + · exact hn (F₁.V_subset_U hab.1) + · exact hn (F₁.V_subset_U hab.2) + · exact hn hq + have hopen := hΔ₁.isOpen_discInt cap.isSurface.2.2 + obtain ⟨z, hz₁, hz⟩ := mem_closure_iff.mp (hin.U_subset_closure hxF) _ hopen ⟨hx₁, hxb⟩ + exact disjoint_left.mp d₁ hz (discInt_subset _ hz₁) + · intro x hx + exact ⟨Surface.discBd_subset _ (hbd₁ ▸ hUC₁ ▸ Or.inr hx), hbdΔ (hF₁F hx)⟩ + have hb₁ : F₁.U ⊆ discBd Δ₁ := by rw [hbd₁, hUC₁]; exact subset_union_right + have hb₂ : F₁.U ⊆ discBd Δ := by rw [hbd]; exact hF₁F + obtain ⟨hdisc, hbdU⟩ := disc_union Δ₁ Δ F₁.U a b hΔ₁ hΔ hL hmeet hb₁ hb₂ + have hbdU' : discBd (Δ₁ ∪ Δ) = (G.sup Q F₂).U := by + rw [hbdU, hbd₁, hbd, hUC₁, hUC₂, ht.U_eq] + have hQa : a ∈ Q.U := by + obtain ⟨W, -, hWV, -⟩ := ht.path.2 + exact Q.V_subset_U (hWV ▸ W.start_mem_support) + have hQb : b ∈ Q.U := by + obtain ⟨W, -, hWV, -⟩ := ht.path.2 + exact Q.V_subset_U (hWV ▸ W.end_mem_support) + ext x + constructor + · rintro ⟨(h | h) | (h | h), hn⟩ + · exact Or.inl h + · by_cases hxab : x ∈ ({a, b} : Set Shat) + · rcases hxab with rfl | rfl + · exact Or.inl hQa + · exact Or.inl hQb + · exact absurd ⟨h, hxab⟩ hn + · by_cases hxab : x ∈ ({a, b} : Set Shat) + · rcases hxab with rfl | rfl + · exact Or.inl hQa + · exact Or.inl hQb + · exact absurd ⟨h, hxab⟩ hn + · exact Or.inr h + · rintro (h | h) + · refine ⟨Or.inl (Or.inl h), fun ⟨h₁, h₂⟩ ↦ ?_⟩ + rcases hP x h with h' | h' | h' + · exact h' (hbdΔ (hF₁F h₁)) + · exact h₂ (Or.inl h') + · exact h₂ (Or.inr h') + · exact ⟨Or.inr (Or.inr h), fun ⟨h₁, h₂⟩ ↦ h₂ (ht.inter_U h₁ h)⟩ + exact key hC₂.1 hdisc hbdU' (noDisc hC₂ hcC₂ hwC₂ hdisc hbdU') subset_union_right + +omit hS h3 in +omit [T2Space S] in +/-- The first assertion of (10.1): the side of a flaw that is not the big one is a disc. -/ +theorem IsRepFlaw.isClosedDisc (hFl : D.IsRepFlaw F) {S₁ S₂ : Set Shat} (hs : IsSidesOf F S₁ S₂) + (hnd : ¬ IsClosedDisc S₁) : IsClosedDisc S₂ := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + obtain ⟨Δ, hΔ, hbd⟩ := exists_disc_of_lt_rep hFl.is_circuit hFl.lt_two_rep + obtain ⟨Ω₁, Ω₂, ⟨Δ', hΔ', hbd', h⟩, rfl, rfl⟩ := exists_sided_of_isSidesOf hT hΔ hbd hs + rcases h with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact absurd (by rwa [closure_discInt hΔ']) hnd + · rwa [closure_discInt hΔ'] + +/-- The third assertion of (10.1): a representativeness flaw is `λ`-linked to `𝒯`. -/ +theorem IsRepFlaw.linked (hFl : D.IsRepFlaw F) {S₁ S₂ : Set Shat} (hs : IsSidesOf F S₁ S₂) + (hnd : ¬ IsClosedDisc S₁) + (hm : (partIn cap D.P.Γ S₁, partIn cap D.P.Γ S₂) ∈ D.𝒯) : + IsLambdaLinkedCircuit D.tb D.ord D.𝒯 F := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hsurf := Surface.IsClosedSurface.isSurface hT + have hc := hFl.card_le + have hlo := hFl.lt_ord_T + have hlt : (F.E.ncard : ℕ∞) < 2 * min (D.ord : ℕ∞) (Painting.rep D.rad) := by + rcases min_cases (D.ord : ℕ∞) (Painting.rep D.rad) with ⟨h, -⟩ | ⟨h, -⟩ + · rw [h] + have : F.E.ncard < 2 * D.ord := by omega + exact_mod_cast this + · rw [h] + exact hFl.lt_two_rep + obtain ⟨F', S₁', S₂', hL, hs', hLT, hle, heq, h₁, h₂⟩ := theorem_8_7_proof hS h3 D.tb D.isTangle + hFl.is_circuit hlt hs hm + have hF' := hL.1 + have hm' := hLT.1 + have hsmall : ∀ {C : Drawing Shat}, C.IsCircuitOf D.rad.G → C.E.ncard ≤ F.E.ncard → + ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = C.U := fun hC hc' ↦ + exists_disc_of_lt_rep hC (lt_of_le_of_lt (by exact_mod_cast hc') hFl.lt_two_rep) + obtain ⟨Δ, hΔ, hbd⟩ := hsmall hFl.is_circuit le_rfl + have hS₁ : S₁ = closure Δᶜ ∧ S₂ = Δ := by + rcases isSidesOf_cases hT hΔ hbd hs with ⟨rfl, -⟩ | h + · exact absurd hΔ hnd + · exact h + obtain ⟨rfl, rfl⟩ := hS₁ + obtain ⟨Δ', hΔ', hbd'⟩ := hsmall hF' hle + -- `S₁'` is not a disc, because it includes `S₁`. + have hnd' : ¬ IsClosedDisc S₁' := by + intro hd' + have hbdS : discBd S₁' = F'.U := by + rcases isSidesOf_cases hT hΔ' hbd' hs' with ⟨rfl, -⟩ | ⟨rfl, -⟩ + · exact hbd' + · exact discBd_closure_compl hT hΔ' hbd' hd' + exact not_compl_subset hT hFl.not_sphere hΔ hbd hd' hbdS (subset_closure.trans h₁) + -- So `F'` is at least as long as `F`, since `½|E(F')| < rep(𝒯)` would give the other orientation. + have hgeq : F.E.ncard ≤ F'.E.ncard := by + by_contra hshort + obtain ⟨Δ'', hΔ'', hbd'', hm''⟩ := (tangleRep_spec D.rad D.ord D.𝒯).2 F' hF' (by + have : F.E.ncard ≤ 2 * D.rep := hc + simp only [TangleDatum.rep] at this + omega) + rcases isSidesOf_cases hT hΔ'' hbd'' hs' with ⟨e₁, -⟩ | ⟨e₁, e₂⟩ + · exact hnd' (e₁ ▸ hΔ'') + · rw [e₁, e₂] at hm' + have hu := part_cover D.rad hF'.1 hF'.1 hF'.1 (isSide_out hT hΔ'' hbd'') + (isSide_int hT hΔ'' hbd'') (isSide_int hT hΔ'' hbd'') (fun x ↦ by + rw [closure_discInt hΔ''] + by_cases hx : x ∈ Δ'' + · exact Or.inr (Or.inl hx) + · exact Or.inl (subset_closure hx)) + rw [closure_discInt hΔ''] at hu + exact D.isTangle.axiom2 hm' hm'' hm'' hu + have hcard : F'.E.ncard = F.E.ncard := le_antisymm hle hgeq + have hw₁ := heq hcard + have hw₂ := hFl.minimal_weight F' hF' (hcard ▸ hc) ⟨S₁', S₂', hs', hnd', hm'⟩ + -- The rational independence of the weights gives `E(F') = E(F)`. + have hEE : F'.E = F.E := by + by_contra hne + have hdiff : (F.E \ F'.E).Nonempty := by + by_contra hemp + rw [not_nonempty_iff_eq_empty, sdiff_eq_empty] at hemp + exact hne (eq_of_subset_of_ncard_le hemp hcard.le F'.finite_edges).symm + have hX : F'.E \ F.E ⊆ D.rad.G.E := fun e he ↦ hF'.1.2 he.1 + have hY : F.E \ F'.E ⊆ D.rad.G.E := fun e he ↦ hFl.is_circuit.1.2 he.1 + have hd : Disjoint (F'.E \ F.E) (F.E \ F'.E) := disjoint_left.mpr fun e h₁ h₂ ↦ h₁.2 h₂.1 + refine D.tb.weight_ne hX hY hd hdiff ?_ + have split : ∀ {s t : Set (Set Shat)}, s.Finite → ∑ᶠ e ∈ s, D.tb.wtE e = + ∑ᶠ e ∈ s ∩ t, D.tb.wtE e + ∑ᶠ e ∈ s \ t, D.tb.wtE e := by + intro s t hs + have hdisj : Disjoint (s ∩ t) (s \ t) := disjoint_left.mpr fun _ h₁ h₂ => h₂.2 h₁.2 + rw [← finsum_mem_union hdisj (hs.inter_of_left _) hs.sdiff, inter_union_sdiff] + have e₁ := split (s := F'.E) (t := F.E) F'.finite_edges + have e₂ := split (s := F.E) (t := F'.E) F.finite_edges + rw [Set.inter_comm] at e₂ + simp only [TieBreaker.weightSub] at hw₁ hw₂ + linarith + have hUU : F'.U = F.U := by + have key : ∀ {X Y : Drawing Shat}, X.IsCircuit → X.E = Y.E → X.U ⊆ Y.U := by + intro X Y hX hE + refine U_of_edges hX Y.isClosed_U fun e he ↦ ?_ + exact (subset_closure.trans (Y.closure_subset_U (hE ▸ he))) + exact Subset.antisymm (key hF'.2 hEE) (key hFl.is_circuit.2 hEE.symm) + obtain ⟨C₁, C₂, hne, hset, e₁, e₂⟩ := hs' + exact ⟨hFl.is_circuit, hlt, S₁', S₂', ⟨C₁, C₂, hne, hUU ▸ hset, e₁, e₂⟩, hLT⟩ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10b.lean b/LeanPool/GraphMinor/GM19/Section10b.lean new file mode 100644 index 0000000000..23f9d6fbed --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10b.lean @@ -0,0 +1,586 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10a + +/-! +# Graph Minors XIX, (10.1), the second assertion + +A representativeness flaw `F` that meets one cuff twice must pass through the pole of the cuff, +since otherwise the two spokes of the pole give a lighter flaw. If `F` meets two cuffs then two +poles +are close together. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +/-- Two links through a third vertex form a path with exactly those two edges. -/ +theorem exists_two_edge_drawing_path {T : Type*} [TopologicalSpace T] [T1Space T] + {G : Drawing T} {a p b : T} {e f : Set T} + (he : G.toGraph.IsLink e a p) (hf : G.toGraph.IsLink f p b) + (hap : a ≠ p) (hab : a ≠ b) (hpb : p ≠ b) : + ∃ Q : Drawing T, Q.IsSubdrawing G ∧ Q.IsPathBetween a b ∧ + Q.V = {a, p, b} ∧ Q.E = {e, f} ∧ Q.U = closure e ∪ closure f := by + let W : GraphWalk G.toGraph a b := .cons he (.cons hf (.nil hf.2.2.1)) + have hsimple : W.IsSimple := by + simp [GraphWalk.IsSimple, W, GraphWalk.support, hap, hab, hpb] + refine ⟨walkDrawing G W, walkDrawing_isSubdrawing G W, walkDrawing_isPathBetween G hsimple, + ?_, ?_, ?_⟩ + · rw [walkDrawing_V] + ext x + simp [W, GraphWalk.support] + · rw [walkDrawing_E] + ext x + simp [W, GraphWalk.edges] + · dsimp only [W] + rw [GraphWalk.drawing_U_cons, GraphWalk.drawing_U_cons, GraphWalk.drawing_U_nil] + have hb : b ∈ closure f ∩ G.V := hf.2.2.2.symm ▸ Or.inr rfl + rw [union_eq_self_of_subset_right (singleton_subset_iff.mpr hb.1)] + +/-- A drawing with exactly two edges has at most as many edges as a drawing containing +two distinct edges. -/ +theorem ncard_edges_le_of_pair_subset {T : Type*} [TopologicalSpace T] {Q X : Drawing T} + {e₁ e₂ f₁ f₂ : Set T} (hQ : Q.E = {e₁, e₂}) (he : e₁ ≠ e₂) + (hf : f₁ ≠ f₂) (hsub : ({f₁, f₂} : Set (Set T)) ⊆ X.E) : + Q.E.ncard ≤ X.E.ncard := by + rw [hQ, ncard_pair he, ← ncard_pair hf] + exact ncard_le_ncard hsub X.finite_edges + +section Walks + +variable {T : Type} [TopologicalSpace T] [T2Space T] {P : Drawing T} {a b : T} + +omit [T2Space T] in +/-- A path starts with one edge, and this is the only edge of the path at the start. If this edge +does not reach the end of the path, then the path has a second edge. -/ +theorem path_first (hP : P.IsPathBetween a b) (hab : a ≠ b) : + ∃ e ∈ P.E, ∃ x, P.toGraph.IsLink e a x ∧ (∀ f ∈ P.E, a ∈ closure f → f = e) ∧ + (x ≠ b → ∃ f ∈ P.E, f ≠ e ∧ ∃ y, P.toGraph.IsLink f x y) := by + obtain ⟨W, hW, hV, hE⟩ := hP + cases W with + | nil h => exact absurd rfl hab + | @cons _ x _ e h r => + have hsim : (GraphWalk.cons h r).support.Nodup := hW + simp only [GraphWalk.support_cons, List.nodup_cons] at hsim + have hanot : ∀ f ∈ r.edges, a ∉ closure f := fun f hf ha ↦ + hsim.1 (mem_support_of_mem_edges r hf ha h.2.1) + refine ⟨e, h.1, x, h, fun f hf ha ↦ ?_, fun hxb ↦ ?_⟩ + · rw [hE] at hf + simp only [GraphWalk.edges_cons, mem_ofPred_eq, List.mem_cons] at hf + rcases hf with rfl | hf + · rfl + · exact absurd ha (hanot f hf) + · cases r with + | nil h' => exact absurd rfl hxb + | @cons _ y _ f h' r' => + have hf : f ∈ (GraphWalk.cons h' r').edges := by simp + refine ⟨f, hE ▸ (by simp : f ∈ (GraphWalk.cons h (GraphWalk.cons h' r')).edges), ?_, y, h'⟩ + rintro rfl + have ha : a ∈ closure f := by + have : a ∈ closure f ∩ P.V := by rw [h.2.2.2]; exact Or.inl rfl + exact this.1 + exact hanot f hf ha + +end Walks + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {rad : RadialDrawing cap Γ} + +omit [T2Space S] [T2Space Shat] in +/-- An edge of `Γ*` at a vertex of `R*` goes to a vertex of `Γ`. -/ +theorem RadialDrawing.link_cases (rad : RadialDrawing cap Γ) {e : Set Shat} {p x : Shat} + (hl : rad.G.toGraph.IsLink e p x) (hp : p ∈ rad.Rstar) : + ∃ v ∈ Γ.V, x = cap.emb v ∧ closure e ∩ rad.G.V = {cap.emb v, p} := by + obtain ⟨v, hv, w, hw, hset⟩ := rad.edge_ends hl.1 + have hne : cap.emb v ≠ w := fun h ↦ hw.2 (h ▸ mem_image_of_mem _ hv) + have hpm : p ∈ ({cap.emb v, w} : Set Shat) := hset ▸ hl.2.2.2 ▸ Or.inl rfl + have hxm : x ∈ ({cap.emb v, w} : Set Shat) := hset ▸ hl.2.2.2 ▸ Or.inr rfl + have hvm : cap.emb v ∈ ({p, x} : Set Shat) := hl.2.2.2 ▸ hset ▸ Or.inl rfl + have hpw : p = w := by + rcases hpm with h | h + · exact absurd (h ▸ mem_image_of_mem _ hv) hp.2 + · exact h + subst hpw + have hvx : cap.emb v = x := by + rcases hvm with h | h + · exact absurd h hne + · exact h + exact ⟨v, hv, hvx.symm, hset⟩ + +section Radial + +variable (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) +include hS h3 + +/-- A vertex of `R*` on a circuit of `Γ*` has exactly two edges in the circuit, and they go to +different vertices. -/ +theorem RadialDrawing.circuit_edges (rad : RadialDrawing cap Γ) {F : Drawing Shat} + (hF : F.IsCircuitOf rad.G) {p : Shat} (hp : p ∈ F.V) (hpR : p ∈ rad.Rstar) : + ∃ (e₁ e₂ : Set Shat) (v₁ v₂ : S), e₁ ∈ F.E ∧ e₂ ∈ F.E ∧ v₁ ∈ Γ.V ∧ v₂ ∈ Γ.V ∧ v₁ ≠ v₂ ∧ + closure e₁ ∩ rad.G.V = {cap.emb v₁, p} ∧ closure e₂ ∩ rad.G.V = {cap.emb v₂, p} ∧ + ∀ e ∈ F.E, p ∈ closure e → e = e₁ ∨ e = e₂ := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨e, he⟩ := IsCircuit.E_nonempty hF.2 + obtain ⟨v, hv, w, hw, hset⟩ := rad.edge_ends (hF.1.2 he) + have hqF : cap.emb v ∈ F.V := by + have hm : cap.emb v ∈ closure e ∩ rad.G.V := by rw [hset]; exact Or.inl rfl + exact mem_V_of_mem_U hF.1 (F.closure_subset_U he hm.1) hm.2 + have hne : p ≠ cap.emb v := fun h ↦ hpR.2 (h ▸ mem_image_of_mem _ hv) + obtain ⟨A, B, hA, hB, hAs, hBs, -, -, hAB, hd, hsup⟩ := hF.2.exists_two_paths hp hqF hne + obtain ⟨e₁, he₁, x₁, hl₁, hu₁, -⟩ := path_first hA hne + obtain ⟨e₂, he₂, x₂, hl₂, hu₂, -⟩ := path_first hB hne + have hAG := hAs.trans hF.1 + have hBG := hBs.trans hF.1 + obtain ⟨v₁, hv₁, -, hs₁⟩ := rad.link_cases ((hAG.isLink_iff he₁).mp hl₁) hpR + obtain ⟨v₂, hv₂, -, hs₂⟩ := rad.link_cases ((hBG.isLink_iff he₂).mp hl₂) hpR + have heq : ∀ e ∈ F.E, p ∈ closure e → e = e₁ ∨ e = e₂ := by + intro f hf hpf + rw [← hsup, Drawing.sup_E hAs hBs] at hf + rcases hf with hf | hf + · exact Or.inl (hu₁ f hf hpf) + · exact Or.inr (hu₂ f hf hpf) + refine ⟨e₁, e₂, v₁, v₂, hAs.2 he₁, hBs.2 he₂, hv₁, hv₂, ?_, hs₁, hs₂, heq⟩ + rintro rfl + have := rad.edge_unique hS h3 (hAG.2 he₁) (hBG.2 he₂) hv₁ hpR hs₁ hs₂ + exact disjoint_left.mp hd he₁ (this ▸ he₂) + +omit hS h3 in +omit [T2Space S] in +omit [T2Space Shat] in +/-- A point of `F.U` on `bd(Σ)` is a vertex of `Γ` on a cuff, and a vertex of `F`. -/ +theorem RadialDrawing.bd_point (rad : RadialDrawing cap Γ) {F : Drawing Shat} + (hF : F.IsSubdrawing rad.G) {v : S} (hv : v ∈ bd S) (hvF : cap.emb v ∈ F.U) : + v ∈ Γ.V ∧ cap.emb v ∈ F.V ∧ ∃ Θ ∈ cuffs S, v ∈ Θ := by + have : ConnectedSpace Shat := cap.connected + have hm : cap.emb v ∈ Γ.hatU cap ∩ rad.G.U := + ⟨mem_image_of_mem _ (Γ.bd_subset hv), hF.U_subset hvF⟩ + rw [rad.isPreRadial.1] at hm + obtain ⟨z, hz, hzv⟩ := hm + obtain rfl := cap.isEmbedding.injective hzv + exact ⟨hz, mem_V_of_mem_U hF hvF (rad.isPreRadial.2.1 (mem_image_of_mem _ hz)), + connectedComponentIn (bd S) z, ⟨z, hv, rfl⟩, mem_connectedComponentIn hv⟩ + +/-- Two vertices of a circuit on different cuffs give a path of `Γ*` between two poles, of length at +most half the circuit plus two. -/ +theorem RadialDrawing.dist_le_of_two_cuffs (rad : RadialDrawing cap Γ) {F : Drawing Shat} + (hF : F.IsCircuitOf rad.G) {v₁ v₂ : S} {Θ₁ Θ₂ : Set S} (hΘ₁ : Θ₁ ∈ cuffs S) + (hΘ₂ : Θ₂ ∈ cuffs S) (hne : Θ₁ ≠ Θ₂) (h₁ : v₁ ∈ Θ₁) (h₂ : v₂ ∈ Θ₂) (hv₁ : v₁ ∈ Γ.V) + (hv₂ : v₂ ∈ Γ.V) (hF₁ : cap.emb v₁ ∈ F.V) (hF₂ : cap.emb v₂ ∈ F.V) : + Painting.dist rad * 4 ≤ ((F.E.ncard + 4 : ℕ) : ℕ∞) := by + classical + have hvne : cap.emb v₁ ≠ cap.emb v₂ := fun h ↦ by + have h' := cap.isEmbedding.injective h + exact disjoint_left.mp (cuffs_disjoint hΘ₁ hΘ₂ hne) h₁ (h' ▸ h₂) + obtain ⟨p₁, hp₁, hp₁Θ, hr₁⟩ := rad.exists_pole hΘ₁ + obtain ⟨p₂, hp₂, hp₂Θ, hr₂⟩ := rad.exists_pole hΘ₂ + have hpne : p₁ ≠ p₂ := fun h ↦ disjoint_left.mp (cap.cuffDisc_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ hne) + (subset_closure hp₁Θ) (subset_closure (h ▸ hp₂Θ)) + obtain ⟨e₁, he₁, hs₁⟩ := rad.exists_pole_edge hS h3 hp₁ hΘ₁ hr₁ hv₁ h₁ + obtain ⟨e₂, he₂, hs₂⟩ := rad.exists_pole_edge hS h3 hp₂ hΘ₂ hr₂ hv₂ h₂ + obtain ⟨A, B, hA, hB, hAs, hBs, -, -, -, hd, hsup⟩ := hF.2.exists_two_paths hF₁ hF₂ hvne + have hcard : A.E.ncard + B.E.ncard = F.E.ncard := by + rw [← ncard_union_eq hd A.finite_edges B.finite_edges] + conv_rhs => rw [← hsup, Drawing.sup_E hAs hBs] + -- One of the two paths has at most half the edges. + obtain ⟨X, hX, hXs, hXc⟩ : ∃ X : Drawing Shat, X.IsPathBetween (cap.emb v₁) (cap.emb v₂) ∧ + X.IsSubdrawing F ∧ 2 * X.E.ncard ≤ F.E.ncard := by + by_cases h : A.E.ncard ≤ B.E.ncard + · exact ⟨A, hA, hAs, by omega⟩ + · exact ⟨B, hB, hBs, by omega⟩ + obtain ⟨W, hW, hWV, hWE⟩ := hX + obtain ⟨W₁, -, hW₁⟩ := (hXs.trans hF.1).exists_walk_up W + have hl₁ : rad.G.toGraph.IsLink e₁ p₁ (cap.emb v₁) := + ⟨he₁, hp₁.1.1, rad.isPreRadial.2.1 (mem_image_of_mem _ hv₁), by rw [hs₁, pair_comm]⟩ + have hl₂ : rad.G.toGraph.IsLink e₂ (cap.emb v₂) p₂ := + ⟨he₂, rad.isPreRadial.2.1 (mem_image_of_mem _ hv₂), hp₂.1.1, hs₂⟩ + let W₂ : GraphWalk rad.G.toGraph p₁ p₂ := + (GraphWalk.cons hl₁ W₁).append (GraphWalk.cons hl₂ (.nil hp₂.1.1)) + obtain ⟨W₃, hW₃, -, hW₃E⟩ := GM11.GraphWalk.exists_isSimple W₂ + set P := walkDrawing rad.G W₃ with hPdef + have hPpath : Drawing.IsPathOf P rad.G p₁ p₂ := + ⟨walkDrawing_isSubdrawing _ _, walkDrawing_isPathBetween _ hW₃⟩ + have hsubE : P.E ⊆ {e₁, e₂} ∪ X.E := by + intro e he + rw [hPdef, walkDrawing_E] at he + have := hW₃E e he + simp only [W₂, GraphWalk.edges_append, GraphWalk.edges_cons, List.mem_append, List.mem_cons, + hW₁] at this + have hX : e ∈ W.edges → e ∈ X.E := fun h ↦ hWE ▸ h + rcases this with (rfl | h) | (rfl | h) + · exact Or.inl (Or.inl rfl) + · exact Or.inr (hX h) + · exact Or.inl (Or.inr rfl) + · simp [GraphWalk.edges] at h + have hPc : P.E.ncard ≤ 2 + X.E.ncard := by + refine (ncard_le_ncard hsubE ((toFinite _).union X.finite_edges)).trans ?_ + refine (ncard_union_le _ _).trans ?_ + have := ncard_insert_le e₁ ({e₂} : Set (Set Shat)) + simp only [ncard_singleton] at this + omega + have hdist : Painting.dist rad ≤ ((P.E.ncard / 2 : ℕ) : ℕ∞) := + sInf_le ⟨P, p₁, p₂, hp₁, hp₂, hpne, hPpath, rfl⟩ + calc Painting.dist rad * 4 ≤ ((P.E.ncard / 2 : ℕ) : ℕ∞) * 4 := by gcongr + _ ≤ ((F.E.ncard + 4 : ℕ) : ℕ∞) := by + have : (P.E.ncard / 2) * 4 ≤ F.E.ncard + 4 := by omega + exact_mod_cast this + +omit hS h3 in +omit [T2Space S] [T2Space Shat] in +/-- An edge of `Γ*` at a vertex of `Γ` goes to a vertex of `R*`. -/ +theorem RadialDrawing.link_cases' (rad : RadialDrawing cap Γ) {e : Set Shat} {v : S} {x : Shat} + (hl : rad.G.toGraph.IsLink e (cap.emb v) x) (hv : v ∈ Γ.V) : + x ∈ rad.Rstar ∧ closure e ∩ rad.G.V = {cap.emb v, x} := by + obtain ⟨u, hu, w, hw, hset⟩ := rad.edge_ends hl.1 + have hne : cap.emb u ≠ w := fun h ↦ hw.2 (h ▸ mem_image_of_mem _ hu) + have hpm : cap.emb v ∈ ({cap.emb u, w} : Set Shat) := hset ▸ hl.2.2.2 ▸ Or.inl rfl + have hxm : w ∈ ({cap.emb v, x} : Set Shat) := hl.2.2.2 ▸ hset ▸ Or.inr rfl + have hvu : cap.emb v = cap.emb u := by + rcases hpm with h | h + · exact h + · exact absurd (h ▸ mem_image_of_mem _ hv) hw.2 + have hwx : w = x := by + rcases hxm with h | h + · exact absurd (hvu.symm.trans h.symm) hne + · exact h + subst hwx + exact ⟨hw, hl.2.2.2⟩ + +omit hS h3 in +omit [T2Space S] [T2Space Shat] in +/-- A set of edges of a subdrawing of `Γ*` is no heavier than the subdrawing. -/ +theorem TieBreaker.weight_subset (tb : TieBreaker rad) {X : Drawing Shat} + (hX : X.IsSubdrawing rad.G) {Y : Set (Set Shat)} (hY : Y ⊆ X.E) : + ∑ᶠ e ∈ Y, tb.wtE e ≤ tb.weightSub X := by + have hdis : Disjoint Y (X.E \ Y) := disjoint_left.mpr fun e h₁ h₂ ↦ h₂.2 h₁ + have hsplit : tb.weightSub X = ∑ᶠ e ∈ Y, tb.wtE e + ∑ᶠ e ∈ X.E \ Y, tb.wtE e := by + rw [← finsum_mem_union hdis (X.finite_edges.subset hY) X.finite_edges.sdiff, + union_sdiff_cancel hY] + rfl + have hnn : 0 ≤ ∑ᶠ e ∈ X.E \ Y, tb.wtE e := + finsum_nonneg fun e ↦ finsum_nonneg fun he ↦ (tb.wtE_pos e (hX.2 he.1)).le + linarith + +end Radial + +namespace TangleDatum + +variable {α : Type w} {χ : ColourScheme S α} {D : TangleDatum cap χ} {F : Drawing Shat} + +variable (hS : IsSurface S) (h3' : D.P.Γ.IsInternallyThreeConnected) +include hS h3' + +/-- No path through a pole improves `F`. This is what the proofs of (10.1) and of the text before +(10.4) need of the choice of +`F`: "Let `Q` be a path of `Γ*`", and "one of $F_1 \cup Q, F_2 \cup Q$ contradicts the choice of +$F$". -/ +def ThetaFree (D : TangleDatum cap χ) (F : Drawing Shat) : Prop := + ∀ {F₁ F₂ Q : Drawing Shat} {a b : Shat}, TwoPaths D.rad.G F F₁ F₂ Q a b → + (∃ p ∈ D.rad.poles, p ∈ Q.V) → + Q.E.ncard ≤ F₁.E.ncard → D.tb.weightSub Q < D.tb.weightSub F₁ → Q.E.ncard ≤ F₂.E.ncard → + D.tb.weightSub Q < D.tb.weightSub F₂ → False + +/-- The claim in the proof of the second assertion of (10.1): if `F` meets a cuff in two vertices +`v₁, v₂`, and meets no other pole, then the edge from `v₁` to the pole is in `F`. "For suppose that +$e_1 \notin E(F)$. Let $u = r^*$ if $r^* \in V(F)$, and $u = v_2$ if $r^* +\notin V(F)$. Let $Q$ be a path of $\Gamma^*$ between $v_1$ and $u$ with $E(Q) \subseteq +\{e_1, e_2\}$." -/ +theorem spoke_mem (hF : F.IsCircuitOf D.rad.G) (hθ : ThetaFree D F) + {p : Shat} (hp : p ∈ D.rad.poles) (honly : ∀ p' ∈ D.rad.poles, p' ∈ F.V → p' = p) + {v₁ v₂ : S} (hv₁ : v₁ ∈ D.P.Γ.V) (hv₂ : v₂ ∈ D.P.Γ.V) (hne : v₁ ≠ v₂) + (hF₁ : cap.emb v₁ ∈ F.V) (hF₂ : cap.emb v₂ ∈ F.V) {e₁ e₂ : Set Shat} (he₁ : e₁ ∈ D.rad.G.E) + (he₂ : e₂ ∈ D.rad.G.E) (hs₁ : closure e₁ ∩ D.rad.G.V = {cap.emb v₁, p}) + (hs₂ : closure e₂ ∩ D.rad.G.V = {cap.emb v₂, p}) : e₁ ∈ F.E := by + classical + have : ConnectedSpace Shat := cap.connected + by_contra hn + set G := D.rad.G with hG + have hvG : ∀ {v}, v ∈ D.P.Γ.V → cap.emb v ∈ G.V := fun hv ↦ + D.rad.isPreRadial.2.1 (mem_image_of_mem _ hv) + have hpG : p ∈ G.V := hp.1.1 + have hvp : ∀ {v}, v ∈ D.P.Γ.V → cap.emb v ≠ p := fun hv h ↦ hp.1.2 (h ▸ mem_image_of_mem _ hv) + obtain ⟨Θ, hΘ, hreg, hpΘ⟩ := D.rad.pole_cases hp + have hnr₁ := (D.rad.pole_edge he₁ hp hΘ hreg hs₁).1 + have hnr₂ := (D.rad.pole_edge he₂ hp hΘ hreg hs₂).1 + have hrange : ∀ f ∈ F.E, p ∉ closure f → f ⊆ range cap.emb := by + intro f hf hpf + obtain ⟨v, -, w, hw, hset⟩ := D.rad.edge_ends (hF.1.2 hf) + have hwm : w ∈ closure f ∩ G.V := by rw [hset]; exact Or.inr rfl + have hwF : w ∈ F.V := mem_V_of_mem_U hF.1 (F.closure_subset_U hf hwm.1) hwm.2 + refine D.rad.edge_subset_range (hF.1.2 hf) hw (fun hwp ↦ ?_) hset + exact hpf (honly w hwp hwF ▸ hwm.1) + have hlt₁ : ∀ f ∈ F.E, p ∉ closure f → D.tb.wtE e₁ < D.tb.wtE f := fun f hf hpf ↦ + D.tb.cuff_lt_internal e₁ he₁ f (hF.1.2 hf) hnr₁ (hrange f hf hpf) + have hlt₂ : ∀ f ∈ F.E, p ∉ closure f → D.tb.wtE e₂ < D.tb.wtE f := fun f hf hpf ↦ + D.tb.cuff_lt_internal e₂ he₂ f (hF.1.2 hf) hnr₂ (hrange f hf hpf) + have hvne : cap.emb v₁ ≠ cap.emb v₂ := fun h ↦ hne (cap.isEmbedding.injective h) + have hl₁ : G.toGraph.IsLink e₁ (cap.emb v₁) p := ⟨he₁, hvG hv₁, hpG, hs₁⟩ + have hl₁' : G.toGraph.IsLink e₁ p (cap.emb v₁) := ⟨he₁, hpG, hvG hv₁, by rw [hs₁, pair_comm]⟩ + have hl₂ : G.toGraph.IsLink e₂ p (cap.emb v₂) := ⟨he₂, hpG, hvG hv₂, by rw [hs₂, pair_comm]⟩ + by_cases hpF : p ∈ F.V + · -- The pole is on `F`, and `Q` is the edge `e₁`. + obtain ⟨A, B, hA, hB, hAs, hBs, -, -, hAB, hd, hsup⟩ := + hF.2.exists_two_paths hF₁ hpF (hvp hv₁) + let W : GraphWalk G.toGraph (cap.emb v₁) p := .cons hl₁ (.nil hpG) + have hWs : W.IsSimple := by + simp [GraphWalk.IsSimple, W, GraphWalk.support, hvp hv₁] + have hQV : (walkDrawing G W).V = {cap.emb v₁, p} := by + rw [walkDrawing_V]; ext x; simp [W, GraphWalk.support] + have hQE : (walkDrawing G W).E = {e₁} := by + rw [walkDrawing_E]; ext x; simp [W, GraphWalk.edges] + have ht : TwoPaths G F A B (walkDrawing G W) (cap.emb v₁) p := by + refine ⟨hvp hv₁, hF.1, ⟨hAs, hA⟩, ⟨hBs, hB⟩, ?_, ?_, hAB.le, hd, + ⟨walkDrawing_isSubdrawing _ _, walkDrawing_isPathBetween _ hWs⟩, ?_, ?_⟩ + · conv_lhs => rw [← hsup, Drawing.sup_V hAs hBs] + · conv_lhs => rw [← hsup, Drawing.sup_E hAs hBs] + · rw [hQV]; exact inter_subset_left + · rw [hQE]; simpa using hn + have side : ∀ {X : Drawing Shat}, X.IsPathBetween (cap.emb v₁) p → X.IsSubdrawing F → + (walkDrawing G W).E.ncard ≤ X.E.ncard ∧ + D.tb.weightSub (walkDrawing G W) < D.tb.weightSub X := by + intro X hX hXs + obtain ⟨f, hf, x, hl, -, -⟩ := path_first hX (hvp hv₁) + have hfF := hXs.2 hf + have hlG := ((hXs.trans hF.1).isLink_iff hf).mp hl + obtain ⟨hxR, hset⟩ := D.rad.link_cases' hlG hv₁ + have hpf : p ∉ closure f := by + intro hc + have hmem : p ∈ ({cap.emb v₁, x} : Set Shat) := hset ▸ ⟨hc, hpG⟩ + rcases hmem with h | h + · exact hvp hv₁ h.symm + · subst h + exact hn (D.rad.edge_unique hS h3' he₁ (hF.1.2 hfF) hv₁ hxR hs₁ hset ▸ hfF) + constructor + · rw [hQE, ncard_singleton] + exact (ncard_pos X.finite_edges).2 ⟨f, hf⟩ + · have h₁ : D.tb.weightSub (walkDrawing G W) = D.tb.wtE e₁ := by + simp only [TieBreaker.weightSub, hQE, finsum_mem_singleton] + have h₂ := D.tb.weight_subset (hXs.trans hF.1) (singleton_subset_iff.mpr hf) + rw [finsum_mem_singleton] at h₂ + rw [h₁] + exact lt_of_lt_of_le (hlt₁ f hfF hpf) h₂ + obtain ⟨c₁, w₁⟩ := side hA hAs + obtain ⟨c₂, w₂⟩ := side hB hBs + exact hθ ht ⟨p, hp, by rw [hQV]; simp⟩ c₁ w₁ c₂ w₂ + · -- The pole is not on `F`, and `Q` is the path through the pole. + have hclo : ∀ f ∈ F.E, p ∉ closure f := fun f hf hc ↦ + hpF (mem_V_of_mem_U hF.1 (F.closure_subset_U hf hc) hpG) + have hn₂ : e₂ ∉ F.E := fun h ↦ hclo e₂ h (by + have : p ∈ closure e₂ ∩ G.V := by rw [hs₂]; exact Or.inr rfl + exact this.1) + have hene : e₁ ≠ e₂ := by + rintro rfl + have hm : cap.emb v₂ ∈ ({cap.emb v₁, p} : Set Shat) := hs₁ ▸ hs₂ ▸ Or.inl rfl + rcases hm with h | h + · exact hvne h.symm + · exact hvp hv₂ h + obtain ⟨A, B, hA, hB, hAs, hBs, -, -, hAB, hd, hsup⟩ := hF.2.exists_two_paths hF₁ hF₂ hvne + obtain ⟨Q, hQs, hQpath, hQV, hQE, _⟩ := + exists_two_edge_drawing_path hl₁ hl₂ (hvp hv₁) hvne (hvp hv₂).symm + have ht : TwoPaths G F A B Q (cap.emb v₁) (cap.emb v₂) := by + refine ⟨hvne, hF.1, ⟨hAs, hA⟩, ⟨hBs, hB⟩, ?_, ?_, hAB.le, hd, + ⟨hQs, hQpath⟩, ?_, ?_⟩ + · conv_lhs => rw [← hsup, Drawing.sup_V hAs hBs] + · conv_lhs => rw [← hsup, Drawing.sup_E hAs hBs] + · rw [hQV] + rintro x ⟨rfl | rfl | rfl, hx⟩ + · exact Or.inl rfl + · exact absurd hx hpF + · exact Or.inr rfl + · rw [hQE] + refine disjoint_left.mpr ?_ + rintro _ (rfl | rfl) h + · exact hn h + · exact hn₂ h + have side : ∀ {X : Drawing Shat}, X.IsPathBetween (cap.emb v₁) (cap.emb v₂) → X.IsSubdrawing F → + Q.E.ncard ≤ X.E.ncard ∧ + D.tb.weightSub Q < D.tb.weightSub X := by + intro X hX hXs + obtain ⟨f, hf, x, hl, -, hsec⟩ := path_first hX hvne + have hlG := ((hXs.trans hF.1).isLink_iff hf).mp hl + obtain ⟨hxR, -⟩ := D.rad.link_cases' hlG hv₁ + obtain ⟨f', hf', hff, -⟩ := hsec fun h ↦ hxR.2 (h ▸ mem_image_of_mem _ hv₂) + have hfF := hXs.2 hf + have hfF' := hXs.2 hf' + have hsub : ({f, f'} : Set (Set Shat)) ⊆ X.E := by + rintro _ (rfl | rfl) + · exact hf + · exact hf' + constructor + · exact ncard_edges_le_of_pair_subset hQE hene hff.symm hsub + · have h₁ : D.tb.weightSub Q = D.tb.wtE e₁ + D.tb.wtE e₂ := by + simp only [TieBreaker.weightSub, hQE] + exact finsum_mem_pair hene + have h₂ := D.tb.weight_subset (hXs.trans hF.1) hsub + rw [finsum_mem_pair hff.symm] at h₂ + have := hlt₁ f hfF (hclo f hfF) + have := hlt₂ f' hfF' (hclo f' hfF') + rw [h₁] + linarith + obtain ⟨c₁, w₁⟩ := side hA hAs + obtain ⟨c₂, w₂⟩ := side hB hBs + exact hθ ht ⟨p, hp, by rw [hQV]; simp⟩ c₁ w₁ c₂ w₂ + +/-- The second assertion of (10.1). The third alternative `dist(Γ) ≤ ¼|E(F)| + 1` is written without +fractions. -/ +theorem second_of_thetaFree (hF : F.IsCircuitOf D.rad.G) (hθ : ThetaFree D F) : + ((F.U ∩ cap.emb '' bd S).ncard ≤ 1 ∧ F.U ⊆ range cap.emb) ∨ + ((F.U ∩ cap.emb '' bd S).ncard = 2 ∧ ¬ F.U ⊆ range cap.emb) ∨ + Painting.dist D.rad * 4 ≤ ((F.E.ncard + 4 : ℕ) : ℕ∞) := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hsubbd : ∀ {Θ}, Θ ∈ cuffs S → Θ ⊆ bd S := by + rintro _ ⟨y, -, rfl⟩ + exact connectedComponentIn_subset _ _ + by_cases htwo : ∃ (v₁ v₂ : S) (Θ₁ Θ₂ : Set S), Θ₁ ∈ cuffs S ∧ Θ₂ ∈ cuffs S ∧ Θ₁ ≠ Θ₂ ∧ v₁ ∈ Θ₁ ∧ + v₂ ∈ Θ₂ ∧ cap.emb v₁ ∈ F.U ∧ cap.emb v₂ ∈ F.U + · obtain ⟨v₁, v₂, Θ₁, Θ₂, hΘ₁, hΘ₂, hne, h₁, h₂, hF₁, hF₂⟩ := htwo + obtain ⟨hv₁, hV₁, -⟩ := D.rad.bd_point hF.1 (hsubbd hΘ₁ h₁) hF₁ + obtain ⟨hv₂, hV₂, -⟩ := D.rad.bd_point hF.1 (hsubbd hΘ₂ h₂) hF₂ + exact Or.inr (Or.inr (D.rad.dist_le_of_two_cuffs hS h3' hF hΘ₁ hΘ₂ hne h₁ h₂ hv₁ hv₂ hV₁ hV₂)) + have hsame : ∀ {v₁ v₂ : S} {Θ₁ Θ₂ : Set S}, Θ₁ ∈ cuffs S → Θ₂ ∈ cuffs S → v₁ ∈ Θ₁ → v₂ ∈ Θ₂ → + cap.emb v₁ ∈ F.U → cap.emb v₂ ∈ F.U → Θ₁ = Θ₂ := by + intro v₁ v₂ Θ₁ Θ₂ h₁ h₂ h₃ h₄ h₅ h₆ + by_contra hne + exact htwo ⟨v₁, v₂, Θ₁, Θ₂, h₁, h₂, hne, h₃, h₄, h₅, h₆⟩ + have hBfin : (F.U ∩ cap.emb '' bd S).Finite := by + refine (D.P.Γ.finite_V.image cap.emb).subset ?_ + rintro _ ⟨hx, v, hv, rfl⟩ + exact mem_image_of_mem _ (D.rad.bd_point hF.1 hv hx).1 + by_cases hpole : ∃ p ∈ D.rad.poles, p ∈ F.V + · obtain ⟨p, hp, hpF⟩ := hpole + obtain ⟨Θ, hΘ, hreg, hpΘ⟩ := D.rad.pole_cases hp + obtain ⟨e₁, e₂, v₁, v₂, he₁, he₂, hv₁, hv₂, hne, hs₁, hs₂, huniq⟩ := + D.rad.circuit_edges hS h3' hF hpF hp.1 + have hG : ∀ {e}, e ∈ F.E → e ∈ D.rad.G.E := fun h ↦ hF.1.2 h + have honF : ∀ {e : Set Shat} {x y : Shat}, e ∈ F.E → closure e ∩ D.rad.G.V = {x, y} → + x ∈ F.V := by + intro e x y he hset + have hm : x ∈ closure e ∩ D.rad.G.V := by rw [hset]; exact Or.inl rfl + exact mem_V_of_mem_U hF.1 (F.closure_subset_U he hm.1) hm.2 + have hV₁ := honF he₁ hs₁ + have hV₂ := honF he₂ hs₂ + have hΘ₁ := (D.rad.pole_edge (hG he₁) hp hΘ hreg hs₁).2 + have hΘ₂ := (D.rad.pole_edge (hG he₂) hp hΘ hreg hs₂).2 + have honly : ∀ p' ∈ D.rad.poles, p' ∈ F.V → p' = p := by + intro p' hp' hp'F + obtain ⟨Θ', hΘ', hreg', hp'Θ⟩ := D.rad.pole_cases hp' + obtain ⟨f, -, u, -, hf, -, hu, -, -, hset, -, -⟩ := D.rad.circuit_edges hS h3' hF hp'F hp'.1 + have huΘ := (D.rad.pole_edge (hG hf) hp' hΘ' hreg' hset).2 + have heq := hsame hΘ' hΘ huΘ hΘ₁ (F.V_subset_U (honF hf hset)) (F.V_subset_U hV₁) + subst heq + obtain ⟨hr, -⟩ := D.rad.regionOf_mem hp.1 + obtain ⟨w, -, huq⟩ := D.rad.isPreRadial.2.2.1 _ hr + have h₁ := huq p ⟨(D.rad.regionOf_mem hp.1).2, hp.1.1⟩ + have h₂ := huq p' ⟨hreg ▸ hreg'.symm ▸ (D.rad.regionOf_mem hp'.1).2, hp'.1.1⟩ + rw [h₁, h₂] + refine Or.inr (Or.inl ⟨?_, fun h ↦ cap.notMem_range hΘ hpΘ (h (F.V_subset_U hpF))⟩) + have hset : F.U ∩ cap.emb '' bd S = {cap.emb v₁, cap.emb v₂} := by + apply Subset.antisymm + · rintro _ ⟨hx, v, hv, rfl⟩ + obtain ⟨hvV, hvF, Θ', hΘ', hvΘ'⟩ := D.rad.bd_point hF.1 hv hx + have heq := hsame hΘ' hΘ hvΘ' hΘ₁ hx (F.V_subset_U hV₁) + subst heq + by_cases h₁ : v = v₁ + · exact Or.inl (h₁ ▸ rfl) + obtain ⟨e, he, hsv⟩ := D.rad.exists_pole_edge hS h3' hp hΘ' hreg hvV hvΘ' + obtain ⟨e', he', hsv'⟩ := D.rad.exists_pole_edge hS h3' hp hΘ' hreg hv₁ hΘ₁ + have heF := spoke_mem hS h3' hF hθ hp honly hvV hv₁ h₁ hvF hV₁ he he' + hsv hsv' + have hpc : p ∈ closure e := by + have : p ∈ closure e ∩ D.rad.G.V := by rw [hsv]; exact Or.inr rfl + exact this.1 + rcases huniq e heF hpc with rfl | rfl + · have hm : cap.emb v ∈ ({cap.emb v₁, p} : Set Shat) := hs₁ ▸ hsv ▸ Or.inl rfl + rcases hm with h | h + · exact absurd (cap.isEmbedding.injective h) h₁ + · exact absurd (h ▸ mem_image_of_mem _ hvV) hp.1.2 + · have hm : cap.emb v ∈ ({cap.emb v₂, p} : Set Shat) := hs₂ ▸ hsv ▸ Or.inl rfl + rcases hm with h | h + · exact Or.inr h + · exact absurd (h ▸ mem_image_of_mem _ hvV) hp.1.2 + · rintro _ (rfl | rfl) + · exact ⟨F.V_subset_U hV₁, mem_image_of_mem _ (hsubbd hΘ hΘ₁)⟩ + · exact ⟨F.V_subset_U hV₂, mem_image_of_mem _ (hsubbd hΘ hΘ₂)⟩ + rw [hset, ncard_pair fun h ↦ hne (cap.isEmbedding.injective h)] + · -- No pole lies on `F`. + refine Or.inl ⟨?_, ?_⟩ + · by_contra hcard + obtain ⟨_, ⟨hx₁, v₁, hv₁, rfl⟩, _, ⟨hx₂, v₂, hv₂, rfl⟩, hne⟩ := + (one_lt_ncard hBfin).1 (not_le.mp hcard) + obtain ⟨hvV₁, hvF₁, Θ, hΘ, hvΘ₁⟩ := D.rad.bd_point hF.1 hv₁ hx₁ + obtain ⟨hvV₂, hvF₂, Θ₂, hΘ₂, hvΘ₂⟩ := D.rad.bd_point hF.1 hv₂ hx₂ + have heq := hsame hΘ₂ hΘ hvΘ₂ hvΘ₁ hx₂ hx₁ + subst heq + obtain ⟨p, hp, -, hreg⟩ := D.rad.exists_pole hΘ + obtain ⟨e₁, he₁, hs₁⟩ := D.rad.exists_pole_edge hS h3' hp hΘ hreg hvV₁ hvΘ₁ + obtain ⟨e₂, he₂, hs₂⟩ := D.rad.exists_pole_edge hS h3' hp hΘ hreg hvV₂ hvΘ₂ + have heF := spoke_mem hS h3' hF hθ hp + (fun p' hp' h ↦ absurd ⟨p', hp', h⟩ hpole) hvV₁ hvV₂ + (fun h ↦ hne (congrArg _ h)) hvF₁ hvF₂ he₁ he₂ hs₁ hs₂ + have hpm : p ∈ closure e₁ ∩ D.rad.G.V := by rw [hs₁]; exact Or.inr rfl + exact hpole ⟨p, hp, mem_V_of_mem_U hF.1 (F.closure_subset_U heF hpm.1) hpm.2⟩ + · intro x hx + by_cases hxV : x ∈ F.V + · by_contra hr + have hxR : x ∈ D.rad.Rstar := ⟨hF.1.1 hxV, fun ⟨v, _, h⟩ ↦ hr ⟨v, h⟩⟩ + refine hpole ⟨x, ⟨hxR, fun h ↦ hr (h (D.rad.regionOf_mem hxR).2)⟩, hxV⟩ + · obtain ⟨e, he, hxe⟩ := F.exists_edge_of_mem hx hxV + obtain ⟨v, -, w, hw, hset⟩ := D.rad.edge_ends (hF.1.2 he) + have hwm : w ∈ closure e ∩ D.rad.G.V := by rw [hset]; exact Or.inr rfl + have hwF : w ∈ F.V := mem_V_of_mem_U hF.1 (F.closure_subset_U he hwm.1) hwm.2 + exact D.rad.edge_subset_range (hF.1.2 he) hw (fun hp ↦ hpole ⟨w, hp, hwF⟩) hset hxe + +/-- The second assertion of (10.1), for a flaw. -/ +theorem IsRepFlaw.second (hFl : D.IsRepFlaw F) {S₁ S₂ : Set Shat} (hs : IsSidesOf F S₁ S₂) + (hnd : ¬ IsClosedDisc S₁) (hm : (partIn cap D.P.Γ S₁, partIn cap D.P.Γ S₂) ∈ D.𝒯) : + ((F.U ∩ cap.emb '' bd S).ncard ≤ 1 ∧ F.U ⊆ range cap.emb) ∨ + ((F.U ∩ cap.emb '' bd S).ncard = 2 ∧ ¬ F.U ⊆ range cap.emb) ∨ + Painting.dist D.rad * 4 ≤ ((F.E.ncard + 4 : ℕ) : ℕ∞) := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hF := hFl.is_circuit + obtain ⟨Δ, hΔ, hbd⟩ := exists_disc_of_lt_rep hF hFl.lt_two_rep + have hsd : S₁ = closure Δᶜ ∧ S₂ = Δ := by + rcases isSidesOf_cases hT hΔ hbd hs with ⟨rfl, -⟩ | h + · exact absurd hΔ hnd + · exact h + obtain ⟨rfl, rfl⟩ := hsd + exact second_of_thetaFree hS h3' hF fun ht _ c₁ w₁ c₂ w₂ ↦ hFl.theta hS h3' hΔ hbd hm ht c₁ w₁ c₂ + w₂ + +end TangleDatum + +/-- **Graph Minors XIX, (10.1)** (page 353): "With $\Gamma, \phi, \lambda, \mathscr{T}, F, \Sigma_1, +\Sigma_2$ as above,* • *$\Sigma_2$ is +a disc,* • *either $|U(F) \cap bd(\Sigma_\chi)| \le 1$ and $U(F) \subseteq \Sigma_\chi$, or +$|U(F) \cap bd(\Sigma_\chi)| = 2$ and $U(F) \not\subseteq \Sigma_\chi$, or $dist(\Gamma) \le +\frac{1}{4}|E(F)| + 1$,* • *$F$ is $\lambda$-linked to $\mathscr{T}$." -/ +theorem theorem_10_1_proof {α : Type w} {χ : ColourScheme S α} {D : TangleDatum cap χ} {F : Drawing + Shat} + (hS : IsSurface S) (h3' : D.P.Γ.IsInternallyThreeConnected) + (hFl : D.IsRepFlaw F) {S₁ S₂ : Set Shat} (hs : IsSidesOf F S₁ S₂) (hnd : ¬ IsClosedDisc S₁) + (hm : (partIn cap D.P.Γ S₁, partIn cap D.P.Γ S₂) ∈ D.𝒯) : + IsClosedDisc S₂ ∧ + (((F.U ∩ cap.emb '' bd S).ncard ≤ 1 ∧ F.U ⊆ range cap.emb) ∨ + ((F.U ∩ cap.emb '' bd S).ncard = 2 ∧ ¬ F.U ⊆ range cap.emb) ∨ + Painting.dist D.rad * 4 ≤ ((F.E.ncard + 4 : ℕ) : ℕ∞)) ∧ + IsLambdaLinkedCircuit D.tb D.ord D.𝒯 F := + ⟨TangleDatum.IsRepFlaw.isClosedDisc hFl hs hnd, + TangleDatum.IsRepFlaw.second hS h3' hFl hs hnd hm, + TangleDatum.IsRepFlaw.linked hS h3' hFl hs hnd hm⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10c.lean b/LeanPool/GraphMinor/GM19/Section10c.lean new file mode 100644 index 0000000000..9a19b55a87 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10c.lean @@ -0,0 +1,231 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5r +public import LeanPool.GraphMinor.GM19.Section10b + +/-! +# A well-behaved set from one fragment + +The proofs of (10.2), (10.4), (10.5) and (11.1) have one shape. Cut `Σ_χ` along a fixed feature `K`, +keep one fragment `Σ'`, +and let `ℒ` be a rooted location with `M(Γ, ℒ) = Γ ∩ ψ(Σ')`. If the fragment gives no bad sequence, +then the set of such places +is well-behaved, by (9.3). This is `wellBehaved_of_fragment`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe w + +variable {S S₁ : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace S₁] [T2Space S₁] + [Nonempty S₁] {β : Type w} + + +/-- The places of the proofs in Section 10. The location `ℒ` is outside the fragment `ψ(Σ')`, all +paintings meet `K` in the +same vertices, and those vertices are `l`. -/ +structure IsCutPlace (χ : ColourScheme S β) (K : Drawing S) (ψ : S₁ → S) (l : List S) (m : ℕ) + (X : Place χ) : Prop where + inter : X.P.Γ.U ∩ K.U ⊆ X.P.Γ.V ∩ K.V + roots : ∀ v, v ∈ l ↔ v ∈ K.V ∩ X.P.Γ.V + roots_range : ∀ v ∈ l, v ∈ range ψ + anchored : IsAnchored X.P.Γ K + M_V : X.L.M.vertexSet = X.P.Γ.V ∩ range ψ + M_E : X.L.M.edgeSet = {e ∈ X.P.Γ.E | e ⊆ range ψ} + arms_π : ∀ A ∈ X.L.arms, ∀ v ∈ A.π, v ∈ l + arms_card : X.L.arms.ncard ≤ m + +omit [T2Space S] in +/-- A border edge lies in a side of the frame. -/ +theorem Painting.exists_side {Φ : Frame S} {Γ : Painting S} (hfit : Γ.Fits Φ) {e : Set S} + (he : e ∈ Γ.E) + (hb : Painting.IsBorder e) : ∃ s ∈ Φ.sides, BordersSide e s := by + have hbe := (Γ.border_edge e he hb).2 + obtain ⟨R, hR, hes⟩ := exists_arcComp_superset he.2.2.1 (F := bd S \ Φ.V) + (fun x hx ↦ ⟨hbe hx, fun h ↦ (he.2.1 hx).2 (hfit.V_subset h)⟩) + exact ⟨R, hR, hb, hes⟩ + +section + +variable {χ : ColourScheme S β} {K : Drawing S} {ψ : S₁ → S} {a₀ : β} {Γ₀ : Painting S} + {D₀ : FrameData χ.Φ Γ₀ K ψ} {hF : IsFeature χ.Φ K} {flip : Set S₁ → Bool} {P₁ P₂ : + ColouredPainting χ} + {D₁ : FrameData χ.Φ P₁.Γ K ψ} {D₂ : FrameData χ.Φ P₂.Γ K ψ} {hA₁ : IsAnchored P₁.Γ K} {hA₂ : + IsAnchored P₂.Γ K} + {σv : S₁ → Set S₁} {σe : Set S₁ → Set S₁} + +/-- An edge with a lift keeps its colour under the inflation of the fragment. -/ +theorem frag_le (h : IsColouredLinearInflation (fragScheme χ a₀ D₀ hF flip) (fragPainting (a₀ + := a₀) D₀ hF flip P₁ D₁ hA₁) + (fragPainting (a₀ := a₀) D₀ hF flip P₂ D₂ hA₂) σv σe) + (G : FragInflation D₁ D₂ hF flip σv σe) {e : Set S} (he : e ∈ P₁.Γ.E) (hne : + (ψ ⁻¹' e).Nonempty) : + χ.unionLE (P₁.φ e) (P₂.φ (ψ '' σe (ψ ⁻¹' e))) := by + obtain ⟨hsur, hE₁, hE', -⟩ := G.edge_main he hne + by_cases hb : Painting.IsBorder e + · obtain ⟨s, hs, hbs⟩ := Painting.exists_side P₁.fits he hb + have hbe := (P₁.Γ.border_edge e he hbs.1).2 + obtain ⟨x, hx⟩ := id hne + obtain ⟨he₁, -⟩ := D₁.pull.preimage_border_edge he hbe hx + obtain ⟨R, hR, hes⟩ := exists_arcComp_superset he₁.2.2.1 (F := bd S₁ \ pullFrameV χ.Φ K ψ) + (fun x hx ↦ ⟨(he₁.2.1 hx).1, fun h ↦ (he₁.2.1 hx).2 (D₁.pullFrameV_subset h)⟩) + obtain ⟨s', hs', hRs⟩ := D₁.exists_side_of_bd hR (hes hx) (hbe hx) + obtain rfl : s' = s := GM11.arcComponent_eq hs' hs (hRs (mem_image_of_mem _ (hes hx))) + (hbs.2 hx) + have hbb : Painting.IsBorder (ψ ⁻¹' e) := ⟨x, hx, (he₁.2.1 hx).1⟩ + have := h.le_border _ hE₁ R hR ⟨hbb, hes⟩ + rw [fragScheme_ΩS ⟨x, hes hx⟩ hs hRs] at this + change (χ.ΩS s').le (fragφ P₁ ψ a₀ (ψ ⁻¹' e)) (fragφ P₂ ψ a₀ (σe (ψ ⁻¹' e))) at this + rw [fragφ_eq (hsur.symm ▸ he), fragφ_eq hE', hsur] at this + have hP := P₁.border_mem e he s' hs hbs + obtain ⟨-, -, hE'', -, -, -, -, hb₁, -⟩ := G.edge_main he hne + obtain ⟨s'', hs'', hes'', hgs, hbg⟩ := hb₁ hbs.1 + obtain rfl : s'' = s' := GM11.arcComponent_eq hs'' hs (hes'' hx) (hbs.2 hx) + exact Or.inr (Or.inr ⟨s'', hs, hP, P₂.border_mem _ hE'' s'' hs ⟨hbg, hgs⟩, this⟩) + · have hi : Painting.IsInternal e := disjoint_left.mpr fun x hx hxb ↦ hb ⟨x, hx, hxb⟩ + have hsub := D₁.pull.subset_R he hb hne + have hE₂ : ψ ⁻¹' e ∈ (D₁.paint flip).E := (D₁.mem_paint_E flip).mpr + (Or.inr ⟨e, he, hb, hne, rfl⟩) + have hi₁ : Painting.IsInternal (ψ ⁻¹' e) := + disjoint_left.mpr fun x hx hxb ↦ D₁.pull.preimage_subset_int hsub hx hxb + have hn := D₁.pull.ncard_tilde he hsub + obtain ⟨-, -, hE'', -, hsize, -, -, -, hb₂⟩ := G.edge_main he hne + have hi' : Painting.IsInternal (ψ '' σe (ψ ⁻¹' e)) := + disjoint_left.mpr fun x hx hxb ↦ hb₂ hb ⟨x, hx, hxb⟩ + rcases P₁.Γ.edge_shape e he with h₂ | h₂ + · have := h.le_internal_2 _ hE₁ hi₁ (hn.trans h₂.1) + change χ.Ω2.le (fragφ P₁ ψ a₀ (ψ ⁻¹' e)) (fragφ P₂ ψ a₀ (σe (ψ ⁻¹' e))) at this + rw [fragφ_eq (hsur.symm ▸ he), fragφ_eq hE', hsur] at this + exact Or.inl ⟨P₁.internal_2_mem e he hi h₂.1, P₂.internal_2_mem _ hE'' hi' + (hsize.trans h₂.1), this⟩ + · have := h.le_internal_3 _ hE₁ hi₁ (hn.trans h₂.1) + change χ.Ω3.le (fragφ P₁ ψ a₀ (ψ ⁻¹' e)) (fragφ P₂ ψ a₀ (σe (ψ ⁻¹' e))) at this + rw [fragφ_eq (hsur.symm ▸ he), fragφ_eq hE', hsur] at this + exact Or.inr (Or.inl ⟨P₁.internal_3_mem e he hi h₂.1, P₂.internal_3_mem _ hE'' hi' + (hsize.trans h₂.1), this⟩) + +end + +/-- **One fragment gives a well-behaved set.** Let `Σ'` be a fragment of the cut along `K`. Suppose +each sequence of places of the +form `IsCutPlace` has two members with a linear inflation between the fragments. Then the set of +these places is well-behaved. -/ +theorem wellBehaved_of_fragment {χ : ColourScheme S β} {K : Drawing S} (ψ : S₁ → S) + (hF : IsFeature χ.Φ K) (l : List S) (m : ℕ) + (a₀ : β) (hoff : ∀ x y : S₁, ψ x = ψ y → ψ x ∉ K.U → x = y) + (hD : ∀ X : Place χ, IsCutPlace χ K ψ l m X → FrameData χ.Φ X.P.Γ K ψ) (Q : Place χ → Prop) + (hseq : ∀ seq : ℕ → Place χ, (∀ i, Q (seq i)) → ∀ h : ∀ i, IsCutPlace χ K ψ l m (seq i), ∀ flip, + IsPaperFlip χ.Φ K ψ (hD _ (h 0)).pull.frag.isSurface flip → ∃ i j, i < j ∧ ∃ σv σe, + IsColouredLinearInflation (fragScheme χ a₀ (hD _ (h 0)) hF flip) + (fragPainting (a₀ := a₀) (hD _ (h 0)) hF flip (seq i).P (hD _ (h i)) (h i).anchored) + (fragPainting (a₀ := a₀) (hD _ (h 0)) hF flip (seq j).P (hD _ (h j)) + (h j).anchored) σv σe) : + IsWellBehavedPlaces {X | IsCutPlace χ K ψ l m X ∧ Q X} := by + classical + refine theorem_9_3_proof (Pl := {X | IsCutPlace χ K ψ l m X ∧ Q X}) (fun _ ↦ l) + (fun X hX A hA v hv ↦ hX.1.arms_π A hA v hv) + (m := m) (n := l.length) (fun X hX ↦ hX.1.arms_card) + (fun _ _ ↦ le_rfl) fun seq hs ↦ ?_ + have h : ∀ i, IsCutPlace χ K ψ l m (seq i) := fun i ↦ (hs i).1 + obtain ⟨flip, hflip⟩ := (hD _ (h 0)).exists_flip + obtain ⟨i, j, hij, σv₀, σe₀, hσ⟩ := hseq seq (fun i ↦ (hs i).2) h flip hflip + have hV : ∀ v ∈ K.V, v ∈ (seq i).P.Γ.V ↔ v ∈ (seq j).P.Γ.V := fun v hv ↦ by + constructor + · exact fun hi ↦ (((h j).roots v).1 (((h i).roots v).2 ⟨hv, hi⟩)).2 + · exact fun hj ↦ (((h i).roots v).1 (((h j).roots v).2 ⟨hv, hj⟩)).2 + have G₀ := fragInflation hσ hflip hV + let Y : Unit → Type := fun _ ↦ S₁ + let ψ' : ∀ t, Y t → S := fun _ ↦ ψ + let G : ∀ t : Unit, FragInflation (ψ := ψ' t) (hD _ (h i)) (hD _ (h j)) hF flip σv₀ σe₀ + := fun _ ↦ G₀ + have hC : IsOneOff K ψ' := ⟨fun t t' x x' hxx hK ↦ by + cases t; cases t' + exact congrArg (Sigma.mk ()) (hoff x x' hxx hK)⟩ + let σv : S → Set S := glueV ψ' fun _ ↦ σv₀ + let σe : Set S → Set S := glueE ψ' fun _ ↦ σe₀ + have hEe : ∀ {e}, e ∈ (seq i).L.M.edgeSet → e ∈ (seq i).P.Γ.E ∧ e ⊆ range ψ := fun {e} he ↦ by + rw [(h i).M_E] at he + exact he + have hne : ∀ {e}, e ∈ (seq i).L.M.edgeSet → (ψ ⁻¹' e).Nonempty := fun {e} he ↦ by + obtain ⟨x, hx⟩ := (hEe he).1.1 + obtain ⟨y, rfl⟩ := (hEe he).2 hx + exact ⟨y, hx⟩ + have hV' : ∀ {v}, v ∈ (seq i).L.M.vertexSet → v ∈ (seq i).P.Γ.V ∧ v ∈ range ψ := fun {v} hv ↦ by + rw [(h i).M_V] at hv + exact hv + have hσeq : ∀ {e} (he : e ∈ (seq i).L.M.edgeSet), σe e = ψ '' σe₀ (ψ ⁻¹' e) := fun {e} he ↦ + glueE_eq G hC (t := ()) (hEe he).1 (hne he) + have hmemV : ∀ {v x}, x ∈ σv v → x ∈ range ψ := fun {v x} hx ↦ by + obtain ⟨t, hu⟩ := mem_iUnion.mp hx + obtain ⟨y, -, z, -, rfl⟩ := mem_iUnion₂.mp hu + exact mem_range_self z + have hmain := fun {e} (he : e ∈ (seq i).L.M.edgeSet) ↦ G₀.edge_main (hEe he).1 (hne he) + refine ⟨i, j, hij, σv, σe, ⟨(seq i).L.M_le, fun e he ↦ ?_, fun e he ↦ ?_, + fun e he e' he' heq ↦ ?_, fun v hv ↦ ?_, + fun v hv z hz ↦ ?_, fun v hv ↦ ?_, fun v₁ hv₁ v₂ hv₂ hne' ↦ ?_, fun e he k hk hk' ↦ ?_⟩, fun v + hv z hz ↦ ?_, + fun e he ↦ ⟨?_, ?_⟩, rfl, fun k h₁ h₂ ↦ ?_⟩ + · rw [hσeq he] + exact (hmain he).2.2.1 + · rw [hσeq he] + exact (hmain he).2.2.2.2.1 + · have heq' := heq + rw [hσeq he, hσeq he'] at heq' + obtain ⟨hsur, hE₁, hE', hpre, -⟩ := hmain he + obtain ⟨hsur', hE₁', -, hpre', -⟩ := hmain he' + have hf : σe₀ (ψ ⁻¹' e) = σe₀ (ψ ⁻¹' e') := by rw [← hpre, ← hpre', heq'] + rw [← hsur, G₀.inflation.edge_injOn hE₁ hE₁' hf, hsur'] + · obtain ⟨hvΓ, y, rfl⟩ := hV' hv + obtain ⟨x, hx⟩ := G₀.inflation.vertex_nonempty y (Or.inl hvΓ) + exact ⟨ψ x, mem_iUnion.mpr ⟨(), mem_iUnion₂.mpr ⟨y, rfl, mem_image_of_mem _ hx⟩⟩⟩ + · obtain ⟨t, hu⟩ := mem_iUnion.mp hz + obtain ⟨y, hy, x, hx, rfl⟩ := mem_iUnion₂.mp hu + have hy₀ : ψ y = v := hy + exact piece_subset G (t := ()) (hy₀ ▸ (hV' hv).1) hx + · exact glue_connected G hC (hV' hv).1 + · exact glue_disjoint G hC (hV' hv₁).1 (hV' hv₂).1 hne' + · obtain ⟨-, hE₁, -, -, -, hm', hm, -⟩ := hmain he + have heq := hσeq he + have hi₁ : k < ((hD _ (h i)).paint flip |>.γ (ψ ⁻¹' e)).length := by + rw [← List.length_map (f := ψ), hm] + exact hk + have hi₂ : k < ((hD _ (h j)).paint flip |>.γ (σe₀ (ψ ⁻¹' e))).length := by + rw [← List.length_map (f := ψ), hm', ← heq] + exact hk' + have hx := G₀.inflation.ends _ hE₁ k hi₁ hi₂ + have e₁ : ((seq i).P.Γ.γ e)[k] = ψ ((hD _ (h i)).paint flip |>.γ (ψ ⁻¹' e))[k] := by + simp only [← hm, List.getElem_map] + have e₂ : ((seq j).P.Γ.γ (σe e))[k] = ψ ((hD _ (h j)).paint flip |>.γ (σe₀ (ψ ⁻¹' e)))[k] := by + simp only [heq, ← hm', List.getElem_map] + rw [e₁, e₂] + exact mem_iUnion.mpr ⟨(), mem_iUnion₂.mpr ⟨_, rfl, mem_image_of_mem _ hx⟩⟩ + · rw [(h j).M_V] + obtain ⟨t, hu⟩ := mem_iUnion.mp hz + obtain ⟨y, hy, x, hx, rfl⟩ := mem_iUnion₂.mp hu + have hy₀ : ψ y = v := hy + exact ⟨piece_subset G (t := ()) (hy₀ ▸ (hV' hv).1) hx, mem_range_self x⟩ + · rw [(h j).M_E, hσeq he] + refine ⟨(hmain he).2.2.1, ?_⟩ + rintro _ ⟨x, -, rfl⟩ + exact mem_range_self x + · rw [hσeq he] + exact frag_le hσ G₀ (hEe he).1 (hne he) + · change l[k] ∈ σv l[k] + obtain ⟨y, hy⟩ := (h i).roots_range _ (List.getElem_mem h₁) + have hK : l[k] ∈ K.V := (((h i).roots _).1 (List.getElem_mem h₁)).1 + have hf : y ∈ pullFrameV χ.Φ K ψ := Or.inr (hy ▸ hK) + exact mem_iUnion.mpr ⟨(), mem_iUnion₂.mpr ⟨y, hy, y, G₀.mem_frame hf, hy⟩⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10d.lean b/LeanPool/GraphMinor/GM19/Section10d.lean new file mode 100644 index 0000000000..784a4b6301 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10d.lean @@ -0,0 +1,274 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10c + +/-! +# Existence of a representativeness flaw + +Graph Minors XIX, page 353: "Let $(\Gamma, \phi, \lambda, \mathscr{T}) \in \mathscr{D}$, such that +$rep(\Gamma), ord(\mathscr{T}) > rep(\mathscr{T})$. Then $\hat{\Sigma}_\chi$ is not a sphere, and +there is +a circuit $F$ of $\Gamma^*$ with $\frac{1}{2}|E(F)| \le rep(\mathscr{T})$ such that $\Sigma_1$ is +not a disc". +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {α : Type w} {χ : ColourScheme S α} {D : TangleDatum cap χ} + + +namespace TangleDatum + +/-- The circuits a flaw is chosen from: `½|E(F)| ≤ rep(𝒯)`, with `Σ₁` not a disc. -/ +def IsFlawCandidate (D : TangleDatum cap χ) (F : Drawing Shat) : Prop := + F.IsCircuitOf D.rad.G ∧ F.E.ncard ≤ 2 * D.rep ∧ ∃ S₁ S₂ : Set Shat, IsSidesOf F S₁ S₂ + ∧ ¬ IsClosedDisc S₁ ∧ + (D.Γ.restrict (cap.emb ⁻¹' S₁), D.Γ.restrict (cap.emb ⁻¹' S₂)) ∈ D.𝒯 + +omit [T2Space Shat] in +theorem finite_circuits (G : Drawing Shat) : {C : Drawing Shat | C.IsCircuit + ∧ C.IsSubdrawing G}.Finite := by + refine Set.Finite.of_finite_image (f := fun C : Drawing Shat ↦ (C.V, C.E)) ?_ ?_ + · refine (G.finite_V.finite_subsets.prod G.finite_edges.finite_subsets).subset ?_ + rintro _ ⟨C, ⟨-, hs'⟩, rfl⟩ + exact ⟨hs'.1, hs'.2⟩ + · intro C _ C' _ h + exact Drawing.ext_of_V_E (congrArg Prod.fst h) (congrArg Prod.snd h) + +variable (hS : IsSurface S) (h3 : D.P.Γ.IsInternallyThreeConnected) +include hS h3 + +/-- There is a circuit of `Γ*` that is at most `2 rep(𝒯)` long with `Σ₁` not a disc. -/ +theorem exists_candidate (h₁ : (D.rep : ℕ∞) < Painting.rep D.rad) (h₂ : D.rep < D.ord) : + ∃ F, D.IsFlawCandidate F ∧ ¬ IsSphere Shat := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + set A : Set ℕ := {k : ℕ | k ≤ D.ord ∧ ∀ F : Drawing Shat, F.IsCircuitOf D.rad.G + → F.E.ncard < 2 * k → + ∃ Δ : Set Shat, IsClosedDisc Δ ∧ discBd Δ = F.U ∧ + (D.P.Γ.restrict (cap.emb ⁻¹' Δ), D.P.Γ.restrict (cap.emb ⁻¹' closure Δᶜ)) ∈ D.𝒯} with hA + have hbdd : BddAbove A := ⟨D.ord, fun k hk ↦ hk.1⟩ + have hrep : D.rep = sSup A := rfl + have hnot : D.rep + 1 ∉ A := fun h ↦ by + have := le_csSup hbdd h + omega + have hle : D.rep + 1 ≤ D.ord := h₂ + simp only [hA, mem_ofPred_eq, not_and, not_forall] at hnot + obtain ⟨F, hF, hlt, hno⟩ := hnot hle + have hlt₂ : (F.E.ncard : ℕ∞) < 2 * Painting.rep D.rad := by + have h₃ : ((D.rep + 1 : ℕ) : ℕ∞) ≤ Painting.rep D.rad := by + have := Order.add_one_le_of_lt h₁ + exact_mod_cast this + have h₄ : (F.E.ncard : ℕ∞) < ((2 * (D.rep + 1) : ℕ) : ℕ∞) := by exact_mod_cast hlt + refine h₄.trans_le ?_ + push_cast + push_cast at h₃ + gcongr + obtain ⟨Δ, hΔ, hbd⟩ := exists_disc_of_lt_rep hF hlt₂ + have h₁' := (disc_facts hS h3 D.rad hF hΔ hbd).1 + have o := disc_order hS h3 D.rad hF hΔ hbd + have heven : F.E.ncard ≤ 2 * D.rep := by omega + have hmem : (partIn cap D.P.Γ Δ, partIn cap D.P.Γ (closure Δᶜ)) ∈ D.𝒯 ∨ + (partIn cap D.P.Γ (closure Δᶜ), partIn cap D.P.Γ Δ) ∈ D.𝒯 := D.isTangle.axiom1 h₁' (by omega) + have h₀ : Sided F (discInt Δ) Δᶜ := ⟨Δ, hΔ, hbd, Or.inl ⟨rfl, rfl⟩⟩ + have hsides : IsSidesOf F (closure Δᶜ) Δ := by + have := (Sided.symm h₀).isSidesOf hT + rwa [closure_discInt hΔ] at this + rcases hmem with h | h + · exact absurd ⟨Δ, hΔ, hbd, h⟩ hno + · have hnd : ¬ IsClosedDisc (closure Δᶜ) := fun hd ↦ by + refine hno ⟨closure Δᶜ, hd, discBd_closure_compl hT hΔ hbd hd, ?_⟩ + have hO := isSide_out hT hΔ hbd + have hE : closure Δᶜ = Δᶜ ∪ F.U := by + rw [closure_eq_self_union_frontier, hO.frontier_eq] + have hc : (closure Δᶜ)ᶜ = discInt Δ := by + rw [hE] + ext x + simp only [mem_compl_iff, mem_union, not_or, not_not] + exact ⟨fun h ↦ ⟨h.1, hbd ▸ h.2⟩, fun h ↦ ⟨h.1, hbd ▸ h.2⟩⟩ + rw [hc, closure_discInt hΔ] + exact h + refine ⟨F, ⟨hF, heven, closure Δᶜ, Δ, hsides, hnd, h⟩, fun hsph ↦ hnd ?_⟩ + obtain ⟨Δ₁, Δ₂, -, h₁d, h₂d, -, -, hun, hin, -, huniq⟩ := sphere_disc Shat hsph F.U + (IsCircuit.isOArc_U hF.2) + have hO := isSide_out hT hΔ hbd + have hE : closure Δᶜ = Δᶜ ∪ F.U := by + rw [closure_eq_self_union_frontier, hO.frontier_eq] + have key : ∀ {A B : Set Shat}, A ∪ B = univ → A ∩ B = F.U → Aᶜ ∪ F.U = B := fun {A B} hu hi ↦ by + ext x + constructor + · rintro (hx | hx) + · exact (eq_univ_iff_forall.1 hu x).resolve_left hx + · exact (hi ▸ hx : x ∈ A ∩ B).2 + · intro hx + by_cases hxA : x ∈ A + · exact Or.inr (hi ▸ ⟨hxA, hx⟩) + · exact Or.inl hxA + rw [hE] + rcases huniq Δ hΔ hbd with rfl | rfl + · rwa [key hun hin] + · rwa [key (by rwa [union_comm]) (by rwa [inter_comm])] + +/-- **A representativeness flaw exists.** -/ +theorem exists_repFlaw (h₁ : (D.rep : ℕ∞) < Painting.rep D.rad) (h₂ : D.rep < D.ord) : ∃ F, + D.IsRepFlaw F := by + classical + obtain ⟨F₀, hF₀, hns⟩ := exists_candidate hS h3 h₁ h₂ + have hfin : {F | D.IsFlawCandidate F}.Finite := + (finite_circuits D.rad.G).subset fun F hF ↦ ⟨hF.1.2, hF.1.1⟩ + obtain ⟨F, hF, hmin⟩ := Set.exists_min_image _ (fun F ↦ D.tb.weightSub F) hfin ⟨F₀, hF₀⟩ + exact ⟨F, h₁, h₂, hns, hF.1, hF.2.1, hF.2.2, fun F' h₃ h₄ h₅ ↦ hmin F' ⟨h₃, h₄, h₅⟩⟩ + +omit [T2Space S] [T2Space Shat] hS in +/-- A ring of `Σ` holds two vertices of `Γ`, unless it bounds a disc of `Σ̂` in `Σ` with no vertex +of `Γ` off the ring. -/ +theorem two_vertices_of_ring {K : Drawing S} (hO : IsOArc K.U) (hinter : D.P.Γ.U ∩ K.U ⊆ D.P.Γ.V ∩ + K.V) (hsing : (K.U ∩ bd S).Subsingleton) + (hempty : ∀ Δ : Set Shat, IsClosedDisc Δ → Δ ⊆ range cap.emb → discBd Δ = cap.emb '' K.U → + (∀ v ∈ D.P.Γ.V, cap.emb v ∈ Δ → cap.emb v ∈ cap.emb '' K.U) → False) : + ∃ a ∈ K.U ∩ D.P.Γ.V, ∃ b ∈ K.U ∩ D.P.Γ.V, a ≠ b := by + by_contra hno + push Not at hno + have hfinU : (K.U ∩ D.P.Γ.V).Finite := D.P.Γ.finite_V.inter_of_right _ + have hfinb : (K.U ∩ bd S).Finite := hsing.finite + have hle₁ : (K.U ∩ D.P.Γ.V).ncard ≤ 1 := (ncard_le_one hfinU).2 hno + have hle₂ : (K.U ∩ bd S).ncard ≤ 1 := (ncard_le_one hfinb).2 fun a ha b hb ↦ hsing ha hb + obtain ⟨Δ, hΔ, hb, hΔV⟩ := h3.2 K.U hO (fun x hx ↦ (hinter ⟨hx.2, hx.1⟩).1) hfinb (by omega) + refine hempty _ (isClosedDisc_image hΔ cap.isEmbedding).1 (image_subset_range _ _) ?_ ?_ + · rw [(isClosedDisc_image hΔ cap.isEmbedding).2, hb] + · intro v hv hvΔ + obtain ⟨u, hu, hvu⟩ := hvΔ + obtain rfl := cap.isEmbedding.injective hvu + exact mem_image_of_mem _ (hΔV ⟨hu, hv⟩) + +/-- The part in `Σ` of a circuit of the two forms is a feature, and it holds two vertices of `Γ`. -/ +theorem exists_part_of_form [Nonempty S] {F : Drawing Shat} (hF : F.IsCircuitOf D.rad.G) + (hform : ((F.U ∩ cap.emb '' bd S).ncard ≤ 1 ∧ F.U ⊆ range cap.emb) ∨ + ((F.U ∩ cap.emb '' bd S).ncard = 2 ∧ ¬ F.U ⊆ range cap.emb)) + (hempty : ∀ Δ : Set Shat, IsClosedDisc Δ → Δ ⊆ range cap.emb → discBd Δ = F.U → + (∀ v ∈ D.P.Γ.V, cap.emb v ∈ Δ → cap.emb v ∈ F.U) → False) : + ∃ K, IsCircuitPart cap χ.Φ D.P.Γ F K ∧ ∃ a ∈ K.U ∩ D.P.Γ.V, ∃ b ∈ K.U ∩ D.P.Γ.V, a ≠ b := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + obtain ⟨hFG, hFc⟩ := hF + rcases hform with ⟨hc, hr⟩ | ⟨hc, hr⟩ + · have hnp : ∀ z ∈ F.V, z ∉ D.rad.poles := fun z hz hzp ↦ by + obtain ⟨Θ, hΘ, -, hzd⟩ := D.rad.pole_cases hzp + exact cap.notMem_range hΘ hzd (hr (F.V_subset_U hz)) + have hfin : (F.U ∩ cap.emb '' bd S).Finite := F.finite_V.subset fun x ⟨hx, v, hv, hvx⟩ ↦ by + subst hvx + exact (D.rad.bd_point hFG hv hx).2.1 + obtain ⟨K, h₁, hKU, hO, hsing⟩ := ring_of_circuit hS D.rad D.P.fits hFG hFc hnp + (fun {x y} hxb hyb hxF hyF ↦ by + have := (ncard_le_one hfin).1 hc _ ⟨hxF, mem_image_of_mem _ hxb⟩ _ ⟨hyF, mem_image_of_mem _ + hyb⟩ + exact cap.isEmbedding.injective this) + refine ⟨K, h₁, two_vertices_of_ring h3 hO h₁.inter hsing fun Δ h₁ h₂ h₃ h₄ ↦ ?_⟩ + exact hempty Δ h₁ h₂ (h₃.trans hKU.symm) (by rwa [hKU]) + · have hex : ∃ p ∈ D.rad.poles, p ∈ F.V := by + by_contra hno + push Not at hno + exact hr (subset_range_of_no_pole D.rad hFG fun z hz hzp ↦ hno z hzp hz) + obtain ⟨p, hp, hpF⟩ := hex + obtain ⟨Θ, hΘ, hreg, hpd⟩ := D.rad.pole_cases hp + obtain ⟨e₁, e₂, v₁, v₂, he₁, he₂, hv₁, hv₂, hne, hs₁, hs₂, -⟩ := D.rad.circuit_edges hS h3 + ⟨hFG, hFc⟩ hpF hp.1 + have hfin : (F.U ∩ cap.emb '' bd S).Finite := F.finite_V.subset fun x ⟨hx, v, hv, hvx⟩ ↦ by + subst hvx + exact (D.rad.bd_point hFG hv hx).2.1 + have hend : ∀ {e v}, e ∈ F.E → closure e ∩ D.rad.G.V = {cap.emb v, p} → v ∈ Θ ∧ cap.emb v ∈ F.V + := fun {e v} he hset ↦ by + refine ⟨(D.rad.pole_edge (hFG.2 he) hp hΘ hreg hset).2, ?_⟩ + have : cap.emb v ∈ closure e ∩ F.V := by + rw [hFG.closure_inter_V he, hset] + exact mem_insert _ _ + exact this.2 + have hin : ∀ {v : S}, v ∈ Θ → cap.emb v ∈ F.V → cap.emb v ∈ F.U ∩ cap.emb '' bd S + := fun {v} h₁ h₂ ↦ + ⟨F.V_subset_U h₂, mem_image_of_mem _ (cuff_subset_bd ⟨Θ, hΘ⟩ h₁)⟩ + obtain ⟨hΘ₁, hF₁⟩ := hend he₁ hs₁ + obtain ⟨hΘ₂, hF₂⟩ := hend he₂ hs₂ + have hsub : ({cap.emb v₁, cap.emb v₂} : Set Shat) ⊆ F.U ∩ cap.emb '' bd S := by + rintro x (rfl | rfl) + · exact hin hΘ₁ hF₁ + · exact hin hΘ₂ hF₂ + have hemb : cap.emb v₁ ≠ cap.emb v₂ := fun h ↦ hne (cap.isEmbedding.injective h) + have heq : F.U ∩ cap.emb '' bd S = {cap.emb v₁, cap.emb v₂} := by + refine (eq_of_subset_of_ncard_le hsub ?_ hfin).symm + rw [hc, ncard_pair hemb] + have hpick : ∀ {v : S}, v ∈ bd S → cap.emb v ∈ F.V → v = v₁ ∨ v = v₂ := fun {v} hb hF ↦ by + have : cap.emb v ∈ F.U ∩ cap.emb '' bd S := ⟨F.V_subset_U hF, mem_image_of_mem _ hb⟩ + rw [heq] at this + rcases this with h | h + · exact Or.inl (cap.isEmbedding.injective h) + · exact Or.inr (cap.isEmbedding.injective h) + refine chord_of_circuit hS D.rad h3 D.P.fits hFG hFc hp hpF (fun z hz hzp ↦ ?_) fun {x} hxb _ + hxF ↦ ?_ + · obtain ⟨Θ', hΘ', hreg', hzd⟩ := D.rad.pole_cases hzp + obtain ⟨f₁, -, u₁, -, hf₁, -, hu₁, -, -, hs₁', -, -⟩ := D.rad.circuit_edges hS h3 ⟨hFG, hFc⟩ + hz hzp.1 + have huΘ := (D.rad.pole_edge (hFG.2 hf₁) hzp hΘ' hreg' hs₁').2 + have huF : cap.emb u₁ ∈ F.V := by + have : cap.emb u₁ ∈ closure f₁ ∩ F.V := by + rw [hFG.closure_inter_V hf₁, hs₁'] + exact mem_insert _ _ + exact this.2 + have huΘ₀ : u₁ ∈ Θ := by + rcases hpick (cuff_subset_bd ⟨Θ', hΘ'⟩ huΘ) huF with rfl | rfl + · exact hΘ₁ + · exact hΘ₂ + have hee : Θ' = Θ := by + by_contra hn + exact disjoint_left.1 (cuffs_disjoint hΘ' hΘ hn) huΘ huΘ₀ + subst hee + obtain ⟨-, -, hG3, -⟩ := id D.rad.isPreRadial + exact (hG3 _ (D.rad.regionOf_mem hp.1).1).unique + ⟨hreg.trans hreg'.symm ▸ (D.rad.regionOf_mem hzp.1).2, hzp.1.1⟩ ⟨(D.rad.regionOf_mem + hp.1).2, hp.1.1⟩ + · rcases hpick hxb hxF with rfl | rfl + · exact ⟨e₁, he₁, hs₁⟩ + · exact ⟨e₂, he₂, hs₂⟩ + +/-- The part of a representativeness flaw in `Σ` is a feature, and it holds two vertices of `Γ`. -/ +theorem exists_flaw_part [Nonempty S] {F : Drawing Shat} (hFl : D.IsRepFlaw F) {S₁ S₂ : Set Shat} + (hs : IsSidesOf F S₁ S₂) + (hnd : ¬ IsClosedDisc S₁) (hm : (partIn cap D.P.Γ S₁, partIn cap D.P.Γ S₂) ∈ D.𝒯) + (hd : ((F.E.ncard + 4 : ℕ) : ℕ∞) < Painting.dist D.rad * 4) : + ∃ K, IsCircuitPart cap χ.Φ D.P.Γ F K ∧ ∃ a ∈ K.U ∩ D.P.Γ.V, ∃ b ∈ K.U ∩ D.P.Γ.V, a ≠ b := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hform : ((F.U ∩ cap.emb '' bd S).ncard ≤ 1 ∧ F.U ⊆ range cap.emb) ∨ + ((F.U ∩ cap.emb '' bd S).ncard = 2 ∧ ¬ F.U ⊆ range cap.emb) := by + rcases TangleDatum.IsRepFlaw.second hS h3 hFl hs hnd hm with h | h | h + · exact Or.inl h + · exact Or.inr h + · exact absurd h (not_le.2 hd) + refine exists_part_of_form hS h3 hFl.is_circuit hform fun Δ hd' _ hbd' hΔV ↦ ?_ + rcases isSidesOf_cases hT hd' hbd' hs with ⟨rfl, -⟩ | ⟨rfl, rfl⟩ + · exact hnd hd' + · refine D.isTangle.axiom3 hm ?_ + refine subset_antisymm inter_subset_left fun v hv ↦ ⟨hv, ?_⟩ + by_cases hvΔ : cap.emb v ∈ S₂ + · exact (isSide_out hT hd' hbd').U_subset_closure (hΔV v hv hvΔ) + · exact subset_closure hvΔ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10e.lean b/LeanPool/GraphMinor/GM19/Section10e.lean new file mode 100644 index 0000000000..b2148d2d1c --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10e.lean @@ -0,0 +1,188 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10d +public import LeanPool.GraphMinor.GM19.Section6a + +/-! +# Arms of a side, and images + +Tools for (10.2) and (10.3): the arm `(Γ ∩ Σ₁, π)` of a location with one member, and its image +under a homeomorphism. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +/-- The arm with sides `Γ ∩ A` and `Γ ∩ B`. -/ +def restrictArm (Γ : Painting S) (A B : Set S) (h : Γ.toHypergraph.IsSeparation (Γ.restrict A) + (Γ.restrict B)) (π : List S) + (hn : π.Nodup) (hs : {v | v ∈ π} = (Γ.restrict A ∩ Γ.restrict B).vertexSet) : Arm Γ where + minus := Γ.restrict A + compl := Γ.restrict B + isSeparation := h + π := π + π_nodup := hn + π_set := hs + +/-- A location with one member. -/ +def oneLocation {Γ : Painting S} (A : Arm Γ) : RootedLocation Γ where + arms := {A} + finite_arms := finite_singleton A + disjoint_arms _A₁ h₁ _A₂ h₂ hne := absurd (h₁.trans h₂.symm) hne + +omit [T2Space S] in +theorem oneLocation_M_V {Γ : Painting S} (A : Arm Γ) : + (oneLocation A).M.vertexSet = Γ.V ∩ {v | v ∈ A.compl.vertexSet} := by + ext v + simp [RootedLocation.M, oneLocation] + +omit [T2Space S] in +theorem oneLocation_M_E {Γ : Painting S} (A : Arm Γ) : + (oneLocation A).M.edgeSet = Γ.E ∩ {e | e ∈ A.compl.edgeSet} := by + ext e + simp [RootedLocation.M, oneLocation] + +variable {f : S ≃ₜ S} {P P' : ColouredPainting χ} + +omit [T2Space S] in +theorem restrict_image_V (I : IsColouredImage f P P') (A : Set S) : + (P'.Γ.restrict (f '' A)).vertexSet = f '' (P.Γ.restrict A).vertexSet := by + change P'.Γ.V ∩ f '' A = f '' (P.Γ.V ∩ A) + rw [I.V, image_inter f.injective] + +omit [T2Space S] in +theorem restrict_image_E (I : IsColouredImage f P P') (A : Set S) : + (P'.Γ.restrict (f '' A)).edgeSet = (fun e ↦ f '' e) '' (P.Γ.restrict A).edgeSet := by + ext e + constructor + · rintro ⟨he, hs, ht⟩ + rw [I.E_eq] at he + obtain ⟨c, hc, rfl⟩ := he + refine ⟨c, ⟨hc, (image_subset_image_iff f.injective).1 hs, ?_⟩, rfl⟩ + rintro x ⟨hx, hxV⟩ + obtain ⟨y, hy, hyx⟩ := ht ⟨tilde_image_homeo f c ▸ mem_image_of_mem _ hx, I.V ▸ + mem_image_of_mem _ hxV⟩ + exact f.injective hyx ▸ hy + · rintro ⟨c, ⟨hc, hs, ht⟩, rfl⟩ + refine ⟨I.E_eq ▸ mem_image_of_mem _ hc, image_mono hs, ?_⟩ + rintro x ⟨hx, hxV⟩ + rw [tilde_image_homeo] at hx + rw [I.V] at hxV + obtain ⟨y, hy, rfl⟩ := hx + obtain ⟨z, hz, hzy⟩ := hxV + obtain rfl := f.injective hzy + exact mem_image_of_mem _ (ht ⟨hy, hz⟩) + +omit [T2Space S] in +/-- A separation by two sets moves along a homeomorphism. -/ +theorem sep_image (I : IsColouredImage f P P') {A B : Set S} + (h : P.Γ.toHypergraph.IsSeparation (P.Γ.restrict A) (P.Γ.restrict B)) : + P'.Γ.toHypergraph.IsSeparation (P'.Γ.restrict (f '' A)) (P'.Γ.restrict (f '' B)) := by + rw [isSeparation_iff_of_le (P'.Γ.restrict_le _) (P'.Γ.restrict_le _)] + rw [isSeparation_iff_of_le (P.Γ.restrict_le _) (P.Γ.restrict_le _)] at h + obtain ⟨h₁, h₂, h₃⟩ := h + refine ⟨?_, ?_, ?_⟩ + · rw [restrict_image_V I, restrict_image_V I, ← image_union, h₁] + exact I.V.symm + · rw [restrict_image_E I, restrict_image_E I, ← image_union, h₂] + exact I.E_eq.symm + · rw [restrict_image_E I, restrict_image_E I, ← image_inter f.injective.image_injective, h₃, + image_empty] + +omit [T2Space Shat] in +omit [T2Space S] in +/-- The cut form moves to the cap twisted by a homeomorphism. -/ +theorem IsCutFormOf.ofHomeo {K K' : Drawing S} {F : Set Shat} + (hf : IsCutFormOf cap K' F) + (f : S ≃ₜ S) (hU : f '' K.U = K'.U) : IsCutFormOf (cap.ofHomeo f) K F := by + have hemb : (cap.ofHomeo f).emb '' K.U = cap.emb '' K'.U := by + rw [← hU, image_image] + rfl + have hbd : ∀ {x}, x ∈ bd S → f x ∈ bd S := fun hx ↦ image_bd f ▸ mem_image_of_mem _ hx + have hbd' : ∀ {x}, f x ∈ bd S → x ∈ bd S := fun {x} hx ↦ by + have := image_bd f.symm ▸ mem_image_of_mem f.symm hx + rwa [f.symm_apply_apply] at this + have hmem : ∀ {x}, x ∈ K.U ↔ f x ∈ K'.U := fun {x} ↦ by + rw [← hU] + exact ⟨mem_image_of_mem _, fun ⟨y, hy, hyx⟩ ↦ f.injective hyx ▸ hy⟩ + obtain ⟨rfl, hO, hs⟩ | ⟨s, t, Θ, hΘ, hst, hsΘ, htΘ, hbdK, hl, h₁, h₂⟩ := hf + · refine Or.inl ⟨hemb.symm, isOArc_comap f.isClosedEmbedding (hU ▸ hO), fun x hx y hy ↦ ?_⟩ + exact f.injective (hs ⟨hmem.1 hx.1, hbd hx.2⟩ ⟨hmem.1 hy.1, hbd hy.2⟩) + · refine Or.inr ⟨f.symm s, f.symm t, f.symm '' Θ, ?_, fun h ↦ hst (f.symm.injective h), + mem_image_of_mem _ hsΘ, + mem_image_of_mem _ htΘ, ?_, ?_, hemb ▸ h₁, ?_⟩ + · rw [cuffs_eq_image f.symm] + exact mem_image_of_mem _ hΘ + · ext x + constructor + · rintro ⟨hx, hxb⟩ + have : f x ∈ K'.U ∩ bd S := ⟨hmem.1 hx, hbd hxb⟩ + rw [hbdK] at this + rcases this with h | h + · exact Or.inl (by rw [← h, f.symm_apply_apply]) + · exact Or.inr (by rw [← h, f.symm_apply_apply]; rfl) + · have key : ∀ {z}, z ∈ K'.U ∩ bd S → f.symm z ∈ K.U ∩ bd S := fun {z} hz ↦ + ⟨hmem.2 (by rw [f.apply_symm_apply]; exact hz.1), hbd' (by rw [f.apply_symm_apply]; exact + hz.2)⟩ + rintro (rfl | rfl) + · exact key (hbdK ▸ mem_insert _ _) + · exact key (hbdK ▸ mem_insert_of_mem _ rfl) + · refine isLine_comap f.isClosedEmbedding ?_ + rw [hU, f.apply_symm_apply, f.apply_symm_apply] + exact hl + · rw [hemb] + change _ ⊆ cap.cuffDisc (f '' (f.symm '' Θ)) + simpa [image_image] using h₂ + +omit [T2Space Shat] in +omit [T2Space S] in +/-- A point of `F` in `Σ` lies in `K`. -/ +theorem IsCutFormOf.mem_U {K : Drawing S} {F : Set Shat} (hf : IsCutFormOf cap K F) {x : S} + (hx : cap.emb x ∈ F) : + x ∈ K.U := by + obtain ⟨rfl, -, -⟩ | ⟨s, t, Θ, hΘ, -, -, -, -, -, -, hd⟩ := hf + · obtain ⟨y, hy, hyx⟩ := hx + exact cap.isEmbedding.injective hyx ▸ hy + · by_contra hn + refine cap.notMem_range hΘ (hd ⟨hx, ?_⟩) (mem_range_self x) + rintro ⟨y, hy, hyx⟩ + exact hn (cap.isEmbedding.injective hyx ▸ hy) + +omit [T2Space S] [T2Space Shat] in +/-- A sphere is simpler than a closed surface that is not a sphere. -/ +theorem simpler_of_sphere {T : Type} [TopologicalSpace T] (cap : IsCappedSurface S Shat) + (hns : ¬ IsSphere Shat) + (h : Nonempty (T ≃ₜ SurfaceModel 0 0 0)) : IsSimplerThan T Shat := by + obtain ⟨a, b, c, ⟨e⟩⟩ := classification Shat cap.isSurface cap.connected + have hc : c = 0 := by + have h₁ := numCuffs_eq e + rw [numCuffs_model] at h₁ + rw [← h₁, numCuffs, cuffs, cap.bd_empty, componentsIn, image_empty, ncard_empty] + subst hc + have hab : 1 ≤ 2 * a + b := by + by_contra hn + have ha : a = 0 := by omega + have hb : b = 0 := by omega + subst ha hb + obtain ⟨g⟩ := isSphere_model + exact hns ⟨e.trans g⟩ + exact ⟨0, 0, 0, a, b, 0, h, ⟨e⟩, by omega, by omega, by omega⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10f.lean b/LeanPool/GraphMinor/GM19/Section10f.lean new file mode 100644 index 0000000000..d2fe5d4103 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10f.lean @@ -0,0 +1,472 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10e +public import LeanPool.GraphMinor.GM19.Section15a + +import LeanPool.GraphMinor.GM19.FeatureCount + +import LeanPool.GraphMinor.GM19.FragmentForm + +/-! +# Graph Minors XIX, (10.3) +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +omit [T2Space S] in +/-- A painting and a feature whose intersection consists of shared vertices keep that property +when pulled back by a homeomorphism. -/ +theorem IsColouredImage.feature_inter_subset {f : S ≃ₜ S} {P Q : ColouredPainting χ} + {Kc K : Drawing S} (hQ : IsColouredImage f.symm P Q) + (hU : f '' Kc.U = K.U) (hV : f '' Kc.V = K.V) + (hinter : P.Γ.U ∩ K.U ⊆ P.Γ.V ∩ K.V) : + Q.Γ.U ∩ Kc.U ⊆ Q.Γ.V ∩ Kc.V := by + rintro x ⟨hx, hxK⟩ + rw [hQ.U] at hx + obtain ⟨y, hy, rfl⟩ := hx + have hyK : y ∈ K.U := hU ▸ ⟨_, hxK, f.apply_symm_apply y⟩ + obtain ⟨hyV, hyKV⟩ := hinter ⟨hy, hyK⟩ + constructor + · rw [hQ.V] + exact mem_image_of_mem _ hyV + · rw [← hV] at hyKV + obtain ⟨z, hz, rfl⟩ := hyKV + rwa [f.symm_apply_apply] + +omit [T2Space S] [T2Space Shat] in +theorem IsCutFormOf.image_subset {K : Drawing S} {F : Set Shat} (hf : IsCutFormOf cap K F) : + cap.emb '' K.U ⊆ F := by + obtain ⟨rfl, -, -⟩ | ⟨s, t, Θ, -, -, -, -, -, -, h, -⟩ := hf + · exact Subset.rfl + · exact h + +omit [T2Space Shat] in +/-- A cut along a feature of the two forms. -/ +theorem exists_cut_of_form (hS : IsSurface S) [ConnectedSpace S] {Φ : Frame S} {Γ : Painting S} + (hfit : Γ.Fits Φ) {K : Drawing S} + {F : Set Shat} (hf : IsCutFormOf cap K F) (hinter : Γ.U ∩ K.U ⊆ Γ.V ∩ K.V) + (hlines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} + ∧ IsLineWithEnds (closure e) u v) + (hKne : K.V ⊆ ⋃ e ∈ arcComponentsIn (K.U \ K.V), closure e) : + ∃ (Y : Type) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S), IsSurface Y ∧ IsCutMap ψ K.U + ∧ HasSheets ψ K := by + obtain ⟨-, hO, -⟩ | ⟨s, t, Θ, hΘ, hst, hs, ht, -, hl, -, -⟩ := hf + · obtain ⟨Y, tY, t2, ψ, h₁, h₂, h₃, -⟩ := exists_pullData_of_shape (𝓞 := {K.U}) (𝓛 + := ∅) hS hfit hinter hlines hKne + (finite_singleton _) finite_empty (fun C hC ↦ hC ▸ hO) (fun L hL ↦ absurd hL + (notMem_empty L)) (by simp) + exact ⟨Y, tY, t2, ψ, h₁, h₂, h₃⟩ + · obtain ⟨Y, tY, t2, ψ, h₁, h₂, h₃, -⟩ := exists_pullData_of_shape (𝓞 := ∅) (𝓛 + := {K.U}) hS hfit hinter hlines hKne + finite_empty (finite_singleton _) (fun C hC ↦ absurd hC (notMem_empty C)) + (fun L hL ↦ ⟨s, t, hst, hL ▸ hl, Or.inl (cuff_subset_bd ⟨Θ, hΘ⟩ hs), Or.inl + (cuff_subset_bd ⟨Θ, hΘ⟩ ht)⟩) (by simp) + exact ⟨Y, tY, t2, ψ, h₁, h₂, h₃⟩ + +omit [T2Space Shat] in +/-- The places of one fragment are well-behaved, by `S₁`, if the capped fragment is simpler. -/ +theorem wellBehaved_S1 (hS : IsSurface S) {K : Drawing S} (hF : IsFeature χ.Φ K) + (hlines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} + ∧ IsLineWithEnds (closure e) u v) + {Y : Type} [TopologicalSpace Y] [T2Space Y] {ψ : Y → S} (hY : IsSurface Y) + (hψ : IsCutMap ψ K.U) (hsheet : HasSheets ψ K) + (y : Y) (l : List S) (m : ℕ) (a₀ : β) (hS1 : ConditionS1.{0, w} Shat) + (hsimple : ∀ (Shat₁ : Type) [TopologicalSpace Shat₁], IsCappedSurface + (connectedComponent y) Shat₁ → IsSimplerThan Shat₁ Shat) : + IsWellBehavedPlaces {X | IsCutPlace χ K (fun x : connectedComponent y ↦ ψ x.1) l m X ∧ True} + := by + have : Nonempty (connectedComponent y) := ⟨⟨y, mem_connectedComponent⟩⟩ + apply wellBehaved_of_fragment (fun x : connectedComponent y ↦ ψ x.1) hF l m a₀ + (fun a b hab hoff ↦ Subtype.ext (hψ.2.2.1 hoff (fun h ↦ hoff (hab ▸ h)) hab)) + (fun X hX ↦ frameData_of_cut hS X.P.fits hX.inter hlines hY hψ hsheet y) + intro seq _ h flip hflip + set D := fun i ↦ frameData_of_cut hS (seq i).P.fits (h i).inter hlines hY hψ hsheet y with hDdef + have hfrag := (D 0).pull.frag + obtain ⟨Shat₁, t₁, ⟨cap₁⟩⟩ := exists_cappedSurface _ _ hfrag.isSurface hfrag.connected rfl + have hnb := hS1 _ Shat₁ β (fragScheme χ a₀ (D 0) hF flip) ⟨cap₁⟩ (hsimple Shat₁ cap₁) + unfold ColourScheme.IsBad at hnb + push Not at hnb + have := hnb fun m ↦ fragPainting (a₀ := a₀) (D 0) hF flip (seq m).P (D m) (h m).anchored + unfold IsBadSequence at this + push Not at this + obtain ⟨i, j, hij, σv, σe, hσ⟩ := this + exact ⟨i, j, hij, σv, σe, hσ⟩ + +/-- **The place of a flaw.** Let `F` be a flaw, `Σ₂` its disc side, and let `α` carry the fixed +feature `Kc` to the part `K` of `F` in `Σ`, +and the fragment `ψ` onto the part of `Σ₂` in `Σ`. Then the arm `Γ ∩ Σ₁` isolates `𝒯`, and the +location comes from a place of the fragment. -/ +theorem exists_place [ConnectedSpace Shat] (hS : IsSurface S) {D : TangleDatum cap χ} + (h3 : D.P.Γ.IsInternallyThreeConnected) (hd : χ.IsDisjoint) {F : Drawing Shat} + (hFl : D.IsRepFlaw F) {Δ : Set Shat} + (hΔ : IsClosedDisc Δ) (hbd : discBd Δ = F.U) (hnd : ¬ IsClosedDisc (closure Δᶜ)) + (hm : (partIn cap D.P.Γ (closure Δᶜ), partIn cap D.P.Γ Δ) ∈ D.𝒯) {K Kc : Drawing S} + (hpart : IsCircuitPart cap χ.Φ D.P.Γ F K) (htwo : ∃ a ∈ K.U ∩ D.P.Γ.V, ∃ b ∈ K.U ∩ D.P.Γ.V, a ≠ + b) {α : S ≃ₜ S} + (hα : IsFramePreservingHomeo χ.Φ α) (hαU : α '' Kc.U = K.U) (hαV : α '' Kc.V + = K.V) {Z : Type} {ψ : Z → S} + (hrange : range ψ = α ⁻¹' (cap.emb ⁻¹' Δ)) {l : List S} (hl : ∀ v, v ∈ l ↔ v ∈ Kc.V + ∧ α v ∈ D.P.Γ.V) {n : ℕ} + (hrep : D.rep < n) (hord : n ≤ D.ord) : + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb n D.ord D.𝒯 ∧ + ∃ X : Place χ, IsCutPlace χ Kc ψ l 1 X ∧ IsPlaceHomeoImage X ⟨hd, D.P, L⟩ α := by + classical + have hT := cap.isClosedSurface + set Γ := D.P.Γ with hΓ + set A₁ := cap.emb ⁻¹' closure Δᶜ with hA₁ + set A₂ := cap.emb ⁻¹' Δ with hA₂ + have hsep : Γ.toHypergraph.IsSeparation (Γ.restrict A₁) (Γ.restrict A₂) + := D.isTangle.isSeparation hm + have hsides : IsSidesOf F (closure Δᶜ) Δ := by + have h₀ : Sided F (discInt Δ) Δᶜ := ⟨Δ, hΔ, hbd, Or.inl ⟨rfl, rfl⟩⟩ + have := (Sided.symm h₀).isSidesOf hT + rwa [closure_discInt hΔ] at this + obtain ⟨-, -, S₁', S₂', hs', hlink⟩ := TangleDatum.IsRepFlaw.linked hS h3 hFl hsides hnd hm + have hlink' : GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (Γ.restrict A₁) (Γ.restrict A₂) := by + rcases isSidesOf_cases hT hΔ hbd hs' with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · rw [h₁, h₂] at hlink + refine absurd ?_ (D.isTangle.axiom2 hm hm hlink.1) + change Γ.restrict A₁ ∪ Γ.restrict A₁ ∪ Γ.restrict A₂ = Γ.toHypergraph + rw [GM10.union_self, hsep.union_eq] + · rw [h₁, h₂] at hlink + exact hlink + let π : List S := (Γ.restrict A₁ ∩ Γ.restrict A₂).vertexSet_finite.toFinset.toList + have hπ : {v | v ∈ π} = (Γ.restrict A₁ ∩ Γ.restrict A₂).vertexSet := by + ext v + simp [π] + let A : Arm Γ := restrictArm Γ A₁ A₂ hsep π (Finset.nodup_toList _) hπ + let L : RootedLocation Γ := oneLocation A + have hLord : L.ord = A.order := by + change sSup (Arm.order '' ({A} : Set (Arm Γ))) = _ + simp + have hord' : A.order ≤ D.rep := by + have : F.E.ncard = 2 * Hypergraph.separationOrder (Γ.restrict A₂) (Γ.restrict A₁) := + disc_order hS h3 D.rad hFl.is_circuit hΔ hbd + have h₂ := hFl.card_le + change Hypergraph.separationOrder (Γ.restrict A₁) (Γ.restrict A₂) ≤ _ + rw [separationOrder_comm] + omega + have hLl : L.IsLambdaLinked D.tb D.𝒯 := by + refine ⟨?_, ?_⟩ + · rintro _ ⟨B, rfl, rfl⟩ + exact hm + · rintro B rfl + exact hlink' + refine ⟨L, theorem_8_8_proof D.tb hS h3 D.isTangle hLl (by rw [hLord]; omega) hord, ?_⟩ + let Q : ColouredPainting χ := D.P.image α.symm hα.symm + have hQ : IsColouredImage α.symm D.P Q := ColouredPainting.isImage_image _ _ _ + have I : IsColouredImage α Q D.P := hQ.symm + have hsym : ∀ X : Set S, α '' (α.symm '' X) = X := fun X ↦ by + rw [image_image] + simp + let B₁ := α.symm '' A₁ + let B₂ := α.symm '' A₂ + have hsep' : Q.Γ.toHypergraph.IsSeparation (Q.Γ.restrict B₁) (Q.Γ.restrict B₂) + := sep_image hQ hsep + have hB₂ : range ψ = B₂ := by + rw [hrange] + ext x + exact ⟨fun h ↦ ⟨α x, h, by simp⟩, fun ⟨y, hy, hyx⟩ ↦ by + subst hyx + simpa using hy⟩ + have hπ' : {v | v ∈ π.map α.symm} = (Q.Γ.restrict B₁ ∩ Q.Γ.restrict B₂).vertexSet := by + change _ = (Q.Γ.restrict B₁).vertexSet ∩ (Q.Γ.restrict B₂).vertexSet + rw [restrict_image_V hQ, restrict_image_V hQ, ← image_inter α.symm.injective] + ext v + change v ∈ π.map α.symm ↔ _ + rw [List.mem_map] + constructor + · rintro ⟨u, hu, rfl⟩ + exact mem_image_of_mem _ (hπ.subset hu) + · rintro ⟨u, hu, rfl⟩ + exact ⟨u, hπ.superset hu, rfl⟩ + let A' : Arm Q.Γ := restrictArm Q.Γ B₁ B₂ hsep' (π.map α.symm) + ((Finset.nodup_toList _).map α.symm.injective) hπ' + have hinter := hQ.feature_inter_subset hαU hαV hpart.inter + have hclosed : IsClosed B₂ := by + change IsClosed (α.symm '' _) + rw [α.symm.image_eq_preimage_symm] + exact (hΔ.isClosed.preimage cap.isEmbedding.continuous).preimage α.symm.symm.continuous + have hUF : ∀ {v}, v ∈ Kc.U → v ∈ range ψ := fun {v} hv ↦ by + rw [hrange] + refine (hbd ▸ Surface.discBd_subset Δ : F.U ⊆ Δ) (hpart.form.image_subset + (mem_image_of_mem _ ?_)) + rw [← hαU] + exact mem_image_of_mem _ hv + have htwo' : ∃ a ∈ Kc.U ∩ Q.Γ.V, ∃ b ∈ Kc.U ∩ Q.Γ.V, a ≠ b := by + obtain ⟨a, ha, b, hb, hab⟩ := htwo + have key : ∀ {a}, a ∈ K.U ∩ D.P.Γ.V → α.symm a ∈ Kc.U ∩ Q.Γ.V := fun {a} ha ↦ by + refine ⟨?_, ?_⟩ + · have := ha.1 + rw [← hαU] at this + obtain ⟨z, hz, rfl⟩ := this + rwa [α.symm_apply_apply] + · rw [hQ.V] + exact mem_image_of_mem _ ha.2 + exact ⟨_, key ha, _, key hb, fun h ↦ hab (α.symm.injective h)⟩ + refine ⟨⟨hd, Q, oneLocation A'⟩, ⟨hinter, fun v ↦ ?_, fun v hv ↦ ?_, ?_, ?_, ?_, ?_, ?_⟩, + hα, I.U.symm, I.V.symm, fun e he ↦ ⟨I.γ e he, I.φ e he⟩, fun _ ↦ A, ?_, ?_⟩ + · rw [hl, hQ.V] + refine ⟨fun h ↦ ⟨h.1, _, h.2, α.symm_apply_apply v⟩, ?_⟩ + rintro ⟨h₁, u, hu, rfl⟩ + exact ⟨h₁, by simpa using hu⟩ + · exact hUF (Kc.V_subset_U ((hl v).1 hv).1) + · exact isAnchored_of_form (hpart.form.ofHomeo α hαU) hinter htwo' + · change (oneLocation A').M.vertexSet = _ + rw [oneLocation_M_V, hB₂] + ext v + exact ⟨fun h ↦ ⟨h.1, h.2.2⟩, fun h ↦ ⟨h.1, h⟩⟩ + · change (oneLocation A').M.edgeSet = _ + rw [oneLocation_M_E, hB₂] + ext e + constructor + · exact fun h ↦ ⟨h.1, h.2.2.1⟩ + · refine fun h ↦ ⟨h.1, h.1, h.2, ?_⟩ + exact fun x hx ↦ closure_minimal h.2 hclosed hx.1.1 + · rintro B rfl v hv + obtain ⟨u, hu, rfl⟩ := List.mem_map.1 hv + have hu' : u ∈ (Γ.restrict A₁ ∩ Γ.restrict A₂).vertexSet := hπ.subset hu + have h₁ : cap.emb u ∈ F.U := (disc_facts hS h3 D.rad hFl.is_circuit hΔ hbd).2.1 u ⟨hu'.2, hu'.1⟩ + have h₂ : u ∈ K.U := hpart.form.mem_U h₁ + have h₃ := (hpart.inter ⟨Γ.V_subset hu'.1.1, h₂⟩).2 + rw [← hαV] at h₃ + obtain ⟨z, hz, rfl⟩ := h₃ + refine (hl _).2 ⟨by simpa using hz, by simpa using hu'.1.1⟩ + · change ({A'} : Set (Arm Q.Γ)).ncard ≤ 1 + simp + · refine ⟨fun B hB ↦ rfl, fun B hB C hC _ ↦ hB.trans hC.symm, ?_⟩ + rintro B rfl + exact ⟨A', rfl, rfl⟩ + · rintro B rfl + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · have := restrict_image_V I B₁ + rwa [hsym] at this + · have := restrict_image_E I B₁ + rwa [hsym] at this + · have := restrict_image_V I B₂ + rwa [hsym] at this + · have := restrict_image_E I B₂ + rwa [hsym] at this + · change π = (π.map α.symm).map α + simp + +omit [T2Space S] in +theorem IsCutPlace.congr {Z Z' : Type} {K : Drawing S} {ψ : Z → S} {ψ' : Z' + → S} {l l' : List S} {m : ℕ} {X : Place χ} + (h : IsCutPlace χ K ψ l m X) (hr : range ψ = range ψ') (hl : ∀ v, v ∈ l ↔ v ∈ l') : IsCutPlace + χ K ψ' l' m X where + inter := h.inter + roots v := by rw [← hl]; exact h.roots v + roots_range v hv := hr ▸ h.roots_range v ((hl v).2 hv) + anchored := h.anchored + M_V := hr ▸ h.M_V + M_E := hr ▸ h.M_E + arms_π A hA v hv := (hl v).1 (h.arms_π A hA v hv) + arms_card := h.arms_card + +theorem finite_components {Y : Type} [TopologicalSpace Y] (hY : IsSurface Y) : Finite + (ConnectedComponents Y) := by + have : LocallyConnectedSpace Y := hY.locallyConnected + have : CompactSpace Y := hY.1 + obtain ⟨T, hT⟩ := isCompact_univ.elim_finite_subcover (fun x : Y ↦ connectedComponent x) + (fun x ↦ isOpen_connectedComponent) (fun x _ ↦ mem_iUnion.mpr ⟨x, mem_connectedComponent⟩) + refine Finite.of_surjective (fun t : T ↦ (ConnectedComponents.mk t.1 : ConnectedComponents Y)) + fun c ↦ ?_ + obtain ⟨z, rfl⟩ := ConnectedComponents.surjective_coe c + obtain ⟨t, ht, hzt⟩ := mem_iUnion₂.mp (hT (mem_univ z)) + exact ⟨⟨t, ht⟩, ConnectedComponents.coe_eq_coe'.2 hzt |>.symm⟩ + +omit [T2Space S] in +/-- For a fixed cut, one well-behaved set holds the places of all good fragments and all sets of +roots. -/ +theorem exists_class_cut_on {K : Drawing S} {Y : Type} [TopologicalSpace Y] + (hY : IsSurface Y) {ψ : Y → S} (m : ℕ) (Good : Set Y → Prop) + (Q : Set Y → Place χ → Prop) (hw : ∀ (y : Y) (l : List S), Good (connectedComponent y) → + IsWellBehavedPlaces {X | IsCutPlace χ K (fun x : connectedComponent y ↦ ψ x.1) l m X ∧ Q + (connectedComponent y) X}) : + ∃ B : Set (Place χ), IsWellBehavedPlaces B ∧ ∀ (y : Y) (l : List S) (X : Place χ), Good + (connectedComponent y) → + (∀ v ∈ l, v ∈ K.V) → IsCutPlace χ K (fun x : connectedComponent y ↦ ψ x.1) l m X → Q + (connectedComponent y) X → X ∈ B := by + classical + have := finite_components hY + let y₀ : ConnectedComponents Y → Y := fun c ↦ (ConnectedComponents.surjective_coe c).choose + have hy₀ : ∀ c, (ConnectedComponents.mk (y₀ c) : ConnectedComponents Y) = c := + fun c ↦ (ConnectedComponents.surjective_coe c).choose_spec + let ι := ConnectedComponents Y × ↥K.finite_V.toFinset.powerset + let C : ι → Set (Place χ) := fun p ↦ + {X | Good (connectedComponent (y₀ p.1)) ∧ IsCutPlace χ K (fun x : connectedComponent + (y₀ p.1) ↦ ψ x.1) p.2.1.toList m X ∧ Q (connectedComponent (y₀ p.1)) X} + refine ⟨⋃ p, C p, IsWellBehavedPlaces.iUnion fun p ↦ ?_, fun y l X hs hl hX hQ ↦ ?_⟩ + · by_cases h : Good (connectedComponent (y₀ p.1)) + · exact IsWellBehavedPlaces.mono (Pl' := C p) (hw (y₀ p.1) p.2.1.toList h) fun _ hX ↦ hX.2 + · exact fun Ω hΩ seq hseq ↦ absurd (hseq 0).1 h + · have heq : connectedComponent (y₀ (ConnectedComponents.mk y)) = connectedComponent y := + ConnectedComponents.coe_eq_coe.1 (hy₀ _) + let W : Finset S := l.toFinset + have hW : W ∈ K.finite_V.toFinset.powerset := by + refine Finset.mem_powerset.2 fun v hv ↦ ?_ + exact K.finite_V.mem_toFinset.2 (hl v (List.mem_toFinset.1 hv)) + refine mem_iUnion.2 ⟨(ConnectedComponents.mk y, ⟨W, hW⟩), ?_, ?_, heq.symm ▸ hQ⟩ + · exact heq.symm ▸ hs + · refine hX.congr ?_ fun v ↦ by simp [W] + have h₁ : range (fun x : connectedComponent y ↦ ψ x.1) = ψ '' connectedComponent y := by + ext z + simp + have h₂ : range (fun x : connectedComponent (y₀ (ConnectedComponents.mk y)) ↦ ψ x.1) = + ψ '' connectedComponent (y₀ (ConnectedComponents.mk y)) := by + ext z + simp + rw [h₁, h₂, heq] + +omit [T2Space S] in +theorem exists_class_cut {K : Drawing S} {Y : Type} [TopologicalSpace Y] (hY : IsSurface Y) {ψ : Y + → S} (m : ℕ) (Good : Set Y → Prop) + (Q : Place χ → Prop) (hw : ∀ (y : Y) (l : List S), Good (connectedComponent y) → + IsWellBehavedPlaces {X | IsCutPlace χ K (fun x : connectedComponent y ↦ ψ x.1) l m X ∧ Q X}) : + ∃ B : Set (Place χ), IsWellBehavedPlaces B ∧ ∀ (y : Y) (l : List S) (X : Place χ), Good + (connectedComponent y) → + (∀ v ∈ l, v ∈ K.V) → IsCutPlace χ K (fun x : connectedComponent y ↦ ψ x.1) l m X → Q X + → X ∈ B := + exists_class_cut_on hY m Good (fun _ ↦ Q) hw + +/-- `Kc` is the part in `Σ` of a circuit. -/ +def IsPartFeature (cap : IsCappedSurface S Shat) (χ : ColourScheme S β) (Kc : Drawing S) : Prop := + ∃ (D : TangleDatum cap χ) (F : Drawing Shat), IsCircuitPart cap χ.Φ D.P.Γ F Kc + +/-- `D` has a flaw whose part in `Σ` is an image of `Kc`. -/ +def TangleDatum.IsFlawAt (D : TangleDatum cap χ) (Kc : Drawing S) : Prop := + ∃ (F : Drawing Shat) (Δ : Set Shat) (K : Drawing S) (α : S ≃ₜ S), D.IsRepFlaw F ∧ IsClosedDisc Δ + ∧ discBd Δ = F.U ∧ + ¬ IsClosedDisc (closure Δᶜ) ∧ (partIn cap D.P.Γ (closure Δᶜ), partIn cap D.P.Γ Δ) ∈ D.𝒯 ∧ + IsCircuitPart cap χ.Φ D.P.Γ F K ∧ (∃ a ∈ K.U ∩ D.P.Γ.V, ∃ b ∈ K.U ∩ D.P.Γ.V, a ≠ b) ∧ + IsFramePreservingHomeo χ.Φ α ∧ α '' Kc.U = K.U ∧ α '' Kc.V = K.V + +/-- One well-behaved set for all flaws with a given feature. -/ +theorem exists_class_feature (hS : IsSurface S) (hd : χ.IsDisjoint) (n : ℕ) (a₀ : β) + (hS1 : ConditionS1.{0, w} Shat) {Kc : Drawing S} (hg : IsPartFeature cap χ Kc) : + ∃ B : Set (Place χ), IsWellBehavedPlaces B ∧ ∀ D : TangleDatum cap χ, D.rep < n → n ≤ D.ord + → D.IsFlawAt Kc → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb n D.ord D.𝒯 ∧ (⟨hd, D.P, L⟩ : Place χ) ∈ B := by + classical + have : ConnectedSpace S := χ.connected + have : ConnectedSpace Shat := cap.connected + obtain ⟨D₀, F₀, hp⟩ := hg + have hKne : Kc.V ⊆ ⋃ e ∈ arcComponentsIn (Kc.U \ Kc.V), closure e := fun v hv ↦ by + obtain ⟨e, he, hve⟩ := hp.feature.no_isolated_vertices v hv + exact mem_biUnion he hve.1 + obtain ⟨Y, tY, t2Y, ψ, hY, hψ, hsheet⟩ := exists_cut_of_form hS D₀.P.fits hp.form hp.inter + hp.lines hKne + obtain ⟨B, hB, hmem⟩ := exists_class_cut (χ := χ) (K := Kc) hY (ψ := ψ) 1 + (fun c ↦ ∀ (Shat₁ : Type) [TopologicalSpace Shat₁], IsCappedSurface c Shat₁ + → IsSimplerThan Shat₁ Shat) (fun _ ↦ True) + (fun y l h ↦ wellBehaved_S1 hS hp.feature hp.lines hY hψ hsheet y l 1 a₀ hS1 h) + refine ⟨_, theorem_9_4_proof hB, ?_⟩ + rintro D hrep hord ⟨F, Δ, K, α, hFl, hΔ, hbd, hnd, hm, hpart, htwo, hα, hαU, hαV⟩ + obtain ⟨y, hy, hsph⟩ := GraphMinor.GM19.discSide S Shat (cap.ofHomeo α) Kc F.U Δ hS + (hpart.form.ofHomeo α hαU) hΔ hbd Y tY t2Y ψ hY hψ + have hfin : (Kc.V ∩ α ⁻¹' D.P.Γ.V).Finite := Kc.finite_V.subset inter_subset_left + have hrange : range (fun x : connectedComponent y ↦ ψ x.1) = α ⁻¹' (cap.emb ⁻¹' Δ) := by + have : range (fun x : connectedComponent y ↦ ψ x.1) = ψ '' connectedComponent y := by + ext z + simp + rw [this, hy] + rfl + obtain ⟨L, hL, X, hX, hXim⟩ := exists_place hS D.P.fits.internally_three_connected hd hFl hΔ hbd + hnd hm hpart htwo hα hαU hαV + hrange (l := hfin.toFinset.toList) (fun v ↦ by simp) hrep hord + refine ⟨L, hL, X, hmem y _ X (fun Shat₁ _ cap₁ ↦ ?_) (fun v hv ↦ ?_) hX trivial, α, hXim⟩ + · exact simpler_of_sphere cap hFl.not_sphere (hsph Shat₁ cap₁) + · exact (hfin.mem_toFinset.1 (Finset.mem_toList.1 hv)).1 + +/-- **Graph Minors XIX, (10.3)** (page 355), from (5.2) and the topological step of (10.2). -/ +theorem theorem_10_3_proof : Theorem103Statement.{w} := by + intro S Shat _ _ _ _ β _ cap χ hd 𝒮 _ hS1 n _ + classical + have hS := χ.isSurface + have : ConnectedSpace S := χ.connected + have : ConnectedSpace Shat := cap.connected + have hT := cap.isClosedSurface + let a₀ : β := Classical.arbitrary β + obtain ⟨𝓕, hf, h𝓕⟩ := GraphMinor.GM19.theorem_5_2_proof S hS χ.connected χ.Φ (4 * n) + have hpick : ∀ K₀, ∃ K', ∀ K, IsPartFeature cap χ K → FeatureEquiv χ.Φ K₀ K → + IsPartFeature cap χ K' ∧ FeatureEquiv χ.Φ K₀ K' := fun K₀ ↦ by + by_cases h : ∃ K, IsPartFeature cap χ K ∧ FeatureEquiv χ.Φ K₀ K + · obtain ⟨K, h₁, h₂⟩ := h + exact ⟨K, fun _ _ _ ↦ ⟨h₁, h₂⟩⟩ + · exact ⟨K₀, fun K h₁ h₂ ↦ absurd ⟨K, h₁, h₂⟩ h⟩ + choose p hp using hpick + have hB : ∀ Kc, ∃ B : Set (Place χ), IsWellBehavedPlaces B ∧ (IsPartFeature cap χ Kc + → ∀ D : TangleDatum cap χ, D.rep < n → + n ≤ D.ord → D.IsFlawAt Kc → ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb n D.ord D.𝒯 ∧ + (⟨hd, D.P, L⟩ : Place χ) ∈ B) := fun Kc ↦ by + by_cases hg : IsPartFeature cap χ Kc + · obtain ⟨B, h₁, h₂⟩ := exists_class_feature hS hd n a₀ hS1 hg + exact ⟨B, h₁, fun _ ↦ h₂⟩ + · exact ⟨∅, fun Ω hΩ seq hseq ↦ absurd (hseq 0) (notMem_empty _), fun h ↦ absurd h hg⟩ + choose B hBw hBm using hB + have : Finite 𝓕 := hf + refine ⟨⋃ K₀ : 𝓕, B (p K₀.1), IsWellBehavedPlaces.iUnion fun _ ↦ hBw _, ?_⟩ + intro D _ hrep hord hlt hdist + have h₁ : (D.rep : ℕ∞) < Painting.rep D.rad := lt_of_lt_of_le (by exact_mod_cast hlt) hrep + have h₂ : D.rep < D.ord := by omega + have h3 := D.P.fits.internally_three_connected + obtain ⟨F, hFl⟩ := TangleDatum.exists_repFlaw hS h3 h₁ h₂ + obtain ⟨S₁, S₂, hs, hnd, hm⟩ := hFl.has_non_disc + obtain ⟨Δ, hΔ, hbd⟩ := exists_disc_of_lt_rep hFl.is_circuit hFl.lt_two_rep + have hsides : S₁ = closure Δᶜ ∧ S₂ = Δ := by + rcases isSidesOf_cases hT hΔ hbd hs with ⟨rfl, -⟩ | h + · exact absurd hΔ hnd + · exact h + obtain ⟨rfl, rfl⟩ := hsides + have hE := hFl.card_le + have hdd : ((F.E.ncard + 4 : ℕ) : ℕ∞) < Painting.dist D.rad * 4 := by + calc ((F.E.ncard + 4 : ℕ) : ℕ∞) < ((2 * (n + 2) : ℕ) : ℕ∞) := by + have : F.E.ncard + 4 < 2 * (n + 2) := by omega + exact_mod_cast this + _ = 2 * ((n + 2 : ℕ) : ℕ∞) := by push_cast; ring + _ ≤ 2 * (2 * Painting.dist D.rad) := by gcongr + _ = Painting.dist D.rad * 4 := by ring + obtain ⟨K, hK, htwo⟩ := TangleDatum.exists_flaw_part hS h3 hFl hs hnd hm hdd + have hV : F.V.ncard = F.E.ncard := by + obtain ⟨-, hFc⟩ := hFl.is_circuit + exact IsCircuit.ncard_V hFc + obtain ⟨K₀, hK₀, f, hfp, hfU, hfV⟩ := h𝓕 K hK.feature (by + have := hK.V_le + have := hK.E_le + omega) + have hg : IsPartFeature cap χ K := ⟨D, F, hK⟩ + obtain ⟨hg', g, hgp, hgU, hgV⟩ := hp K₀ K hg ⟨f, hfp, hfU, hfV⟩ + have hU : (g.symm.trans f) '' (p K₀).U = K.U := by + have : (g.symm.trans f) '' (p K₀).U = f '' (g.symm '' (p K₀).U) := by + rw [image_image] + rfl + rw [this, ← hgU, symm_image_image', hfU] + have hV' : (g.symm.trans f) '' (p K₀).V = K.V := by + have : (g.symm.trans f) '' (p K₀).V = f '' (g.symm '' (p K₀).V) := by + rw [image_image] + rfl + rw [this, ← hgV, symm_image_image', hfV] + obtain ⟨L, hL, hmem⟩ := hBm (p K₀) hg' D hlt hord + ⟨F, S₂, K, g.symm.trans f, hFl, hΔ, hbd, hnd, hm, hK, htwo, hgp.symm.trans hfp, hU, hV'⟩ + exact ⟨L, hL, mem_iUnion.2 ⟨⟨K₀, hK₀⟩, hmem⟩⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10g.lean b/LeanPool/GraphMinor/GM19/Section10g.lean new file mode 100644 index 0000000000..3f412a3aaf --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10g.lean @@ -0,0 +1,113 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10f + +import LeanPool.GraphMinor.GM19.FragmentOrient + +/-! +# Fragments under `S₃` + +The proofs of (10.4) and (10.5) use a fragment whose paintings are similarly oriented. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +/-- The sequence `(Γ_i', φ_i')` of a fragment is similarly oriented: "because $\mathscr{S}$ is +similarly oriented and if $\Sigma_{\chi'}$ is orientable then so is +$\Sigma_\chi$". -/ +theorem frag_similarly {S₁ : Type} [TopologicalSpace S₁] [T2Space S₁] [Nonempty S₁] {𝒮 : Set + (ColouredPainting χ)} + (hcl : IsPaintingClass χ 𝒮) (hS : IsSurface S) {K : Drawing S} + (hF : IsFeature χ.Φ K) {ψ : S₁ → S} (a₀ : β) {Γ₀ : Painting S} (D₀ : FrameData χ.Φ Γ₀ K ψ) + (seq : ℕ → ColouredPainting χ) + (hm : ∀ i, seq i ∈ 𝒮) (D : ∀ i, FrameData χ.Φ (seq i).Γ K ψ) (hA : ∀ i, IsAnchored (seq i).Γ K) + (flip : Set S₁ → Bool) + (hO : IsOrientableSurface S₁ → IsOrientableSurface S) : + IsSimilarlyOriented (fragScheme χ a₀ D₀ hF flip) (fun m ↦ fragPainting (a₀ := a₀) D₀ hF flip + (seq m) (D m) (hA m)) := by + have : ConnectedSpace S := χ.connected + rcases hcl.similarly_oriented with h | ⟨ω, hω⟩ + · exact Or.inl fun hO' ↦ h (hO hO') + · have hfrag := D₀.pull.frag + obtain ⟨ω₁, hω₁⟩ := GraphMinor.GM19.fragmentOrientation S _ K ψ hS inferInstance hfrag ω + refine Or.inr ⟨ω₁, fun m e₁' he₁' h3 a' b' c' hl' ↦ ?_⟩ + have hEp : e₁' ∈ ((D m).paint flip).E := he₁' + have hint : Painting.IsInternal e₁' := by + refine disjoint_left.mpr fun x hx hxb ↦ ?_ + have := (((D m).paint flip).border_edge e₁' hEp ⟨x, hx, hxb⟩).1 + omega + obtain ⟨e, he, hb', hne', rfl⟩ := (D m).exists_lift_of_internal flip hEp hint + have hsub := (D m).pull.subset_R he hb' hne' + have hmap := (D m).map_march_lift (flip := flip) he hb' hne' + have hlist : ((D m).paint flip).γ (ψ ⁻¹' e) = [a', b', c'] := hl' + rw [hlist] at hmap + obtain ⟨hdisc, htil⟩ := ((D m).paint flip).tilde_subset_discBd hEp h3 + have hn := ((D m).paint flip).γ_nodup _ hEp + have hset := ((D m).paint flip).γ_set _ hEp + rw [hlist] at hn hset + have hmem : ∀ x ∈ [a', b', c'], x ∈ discBd (closure (ψ ⁻¹' e)) := fun x hx ↦ htil (hset ▸ hx) + have hsur : ψ '' (ψ ⁻¹' e) = e := image_preimage_eq_of_subset (hsub.trans + (image_subset_range _ _)) + have hcl' : ψ '' closure (ψ ⁻¹' e) = closure e := by + rw [← hfrag.isClosedMap.closure_image_eq_of_continuous hfrag.continuous_ψ, hsur] + refine (hω₁ _ hdisc ((D m).pull.injOn_closure he hsub) a' b' c' (hmem _ (by simp)) (hmem _ + (by simp)) + (hmem _ (by simp)) (by simp at hn; tauto) (by simp at hn; tauto) + (by simp at hn; tauto)).mpr ?_ + rw [hcl'] + have h3e : (tilde e).ncard = 3 := by + rw [← (D m).pull.ncard_tilde he hsub] + exact h3 + exact hω _ (hm m) e he h3e _ _ _ hmap.symm + +omit [T2Space Shat] in +/-- The places of one fragment are well-behaved by `S₃`, if its capping is `Σ̂` and it has fewer +cuffs. -/ +theorem wellBehaved_S3 (hS : IsSurface S) {K : Drawing S} (hF : IsFeature χ.Φ K) {𝒮 : Set + (ColouredPainting χ)} + (hcl : IsPaintingClass χ 𝒮) + (hlines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} + ∧ IsLineWithEnds (closure e) u v) + {Y : Type} [TopologicalSpace Y] [T2Space Y] {ψ : Y → S} (hY : IsSurface Y) + (hψ : IsCutMap ψ K.U) (hsheet : HasSheets ψ K) + (y : Y) (l : List S) (m : ℕ) (a₀ : β) (hS3 : ConditionS3 χ cap) + (hhat : ∀ (Shat₁ : Type) [TopologicalSpace Shat₁], IsCappedSurface (connectedComponent y) Shat₁ + → Nonempty (Shat₁ ≃ₜ Shat)) + (hc : numCuffs (connectedComponent y) < numCuffs S) (hO : IsOrientableSurface + (connectedComponent y) → IsOrientableSurface S) : + IsWellBehavedPlaces {X | IsCutPlace χ K (fun x : connectedComponent y ↦ ψ x.1) l m X ∧ X.P ∈ 𝒮} + := by + have : Nonempty (connectedComponent y) := ⟨⟨y, mem_connectedComponent⟩⟩ + apply wellBehaved_of_fragment (fun x : connectedComponent y ↦ ψ x.1) hF l m a₀ + (fun a b hab hoff ↦ Subtype.ext (hψ.2.2.1 hoff (fun h ↦ hoff (hab ▸ h)) hab)) + (fun X hX ↦ frameData_of_cut hS X.P.fits hX.inter hlines hY hψ hsheet y) + intro seq hq h flip hflip + set D := fun i ↦ frameData_of_cut hS (seq i).P.fits (h i).inter hlines hY hψ hsheet y with hDdef + have hfrag := (D 0).pull.frag + obtain ⟨Shat₁, t₁, ⟨cap₁⟩⟩ := exists_cappedSurface _ _ hfrag.isSurface hfrag.connected rfl + have hnb := hS3 _ Shat₁ (fragScheme χ a₀ (D 0) hF flip) ⟨cap₁⟩ (hhat Shat₁ cap₁) rfl rfl hc + have hsim := frag_similarly hcl hS hF a₀ (D 0) (fun i ↦ (seq i).P) hq D (fun i ↦ + (h i).anchored) flip hO + by_contra hno + push Not at hno + exact hnb ⟨_, fun i j hij ⟨σv, σe, hσ⟩ ↦ hno i j hij σv σe hσ, hsim⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10h.lean b/LeanPool/GraphMinor/GM19/Section10h.lean new file mode 100644 index 0000000000..84a2e43f0f --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10h.lean @@ -0,0 +1,244 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10g + +/-! +# Locations and their images + +The image of a rooted location under a homeomorphism, and the place of a location whose set `M` is +the part of a fragment. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S : Type} [TopologicalSpace S] [T2Space S] {β : Type w} {χ : ColourScheme S β} + + +/-- The image of a hypergraph with edges in `S`. -/ +def mapSub (f : S ≃ₜ S) (H : Hypergraph S (Set S)) : Hypergraph S (Set S) where + vertexSet := f '' H.vertexSet + edgeSet := (fun e ↦ f '' e) '' H.edgeSet + Inc e v := H.Inc (f.symm '' e) (f.symm v) + vertex_mem_of_inc _ v h := ⟨_, H.vertex_mem_of_inc h, f.apply_symm_apply v⟩ + edge_mem_of_inc e _ h := ⟨_, H.edge_mem_of_inc h, by simp [image_image]⟩ + vertexSet_finite := H.vertexSet_finite.image _ + edgeSet_finite := H.edgeSet_finite.image _ + +omit [T2Space S] in +theorem mapSub_symm (f : S ≃ₜ S) (H : Hypergraph S (Set S)) : mapSub f.symm (mapSub f H) = H := by + refine Hypergraph.ext ?_ ?_ ?_ + · simp [mapSub, image_image] + · simp [mapSub, image_image] + · funext e v + simp [mapSub, image_image] + +omit [T2Space S] in +theorem mapSub_symm' (f : S ≃ₜ S) (H : Hypergraph S (Set S)) : mapSub f (mapSub f.symm H) = H := by + simpa using mapSub_symm f.symm H + +omit [T2Space S] in +theorem mapSub_mono (f : S ≃ₜ S) {H H' : Hypergraph S (Set S)} (h : H ≤ H') : mapSub f H + ≤ mapSub f H' where + vertexSet_subset := image_mono h.vertexSet_subset + edgeSet_subset := image_mono h.edgeSet_subset + ends_eq e he := by + obtain ⟨c, hc, rfl⟩ := he + ext v + have := Set.ext_iff.1 (h.ends_eq c hc) (f.symm v) + simp only [Hypergraph.ends, mapSub, symm_image_image'] at this ⊢ + exact this + +variable {f : S ≃ₜ S} {P P' : ColouredPainting χ} + +omit [T2Space S] in +theorem mapSub_toHypergraph (I : IsColouredImage f P P') : mapSub f P.Γ.toHypergraph + = P'.Γ.toHypergraph := by + refine Hypergraph.ext I.V.symm I.E_eq.symm ?_ + funext e v + apply propext + change (f.symm '' e ∈ P.Γ.E ∧ f.symm v ∈ P.Γ.V ∧ f.symm v ∈ tilde (f.symm '' e)) ↔ e ∈ P'.Γ.E + ∧ v ∈ P'.Γ.V ∧ v ∈ tilde e + have hE : ∀ c, c ∈ P'.Γ.E ↔ f.symm '' c ∈ P.Γ.E := fun c ↦ by + rw [I.E_eq] + constructor + · rintro ⟨d, hd, rfl⟩ + rwa [symm_image_image'] + · exact fun h ↦ ⟨_, h, by simp [image_image]⟩ + have hV : ∀ w, w ∈ P'.Γ.V ↔ f.symm w ∈ P.Γ.V := fun w ↦ by + rw [I.V] + constructor + · rintro ⟨d, hd, rfl⟩ + simpa using hd + · exact fun h ↦ ⟨_, h, f.apply_symm_apply w⟩ + rw [hE, hV, tilde_image_homeo f.symm] + have : f.symm v ∈ f.symm '' tilde e ↔ v ∈ tilde e := + ⟨fun ⟨y, hy, hyv⟩ ↦ f.symm.injective hyv ▸ hy, mem_image_of_mem _⟩ + rw [this] + +/-- The image of an arm. -/ +def Arm.map (I : IsColouredImage f P P') (A : Arm P.Γ) : Arm P'.Γ where + minus := mapSub f A.minus + compl := mapSub f A.compl + isSeparation := by + have h₁ : mapSub f A.minus ≤ P'.Γ.toHypergraph := mapSub_toHypergraph I ▸ mapSub_mono f + A.isSeparation.left_le + have h₂ : mapSub f A.compl ≤ P'.Γ.toHypergraph := mapSub_toHypergraph I ▸ mapSub_mono f + A.isSeparation.right_le + rw [isSeparation_iff_of_le h₁ h₂] + have hs := A.isSeparation + refine ⟨?_, ?_, ?_⟩ + · change f '' _ ∪ f '' _ = _ + rw [← image_union, hs.vertexSet_union] + exact I.V.symm + · change (fun e ↦ f '' e) '' _ ∪ (fun e ↦ f '' e) '' _ = _ + rw [← image_union, hs.edgeSet_union] + exact I.E_eq.symm + · change (fun e ↦ f '' e) '' _ ∩ (fun e ↦ f '' e) '' _ = _ + have h₃ : A.minus.edgeSet ∩ A.compl.edgeSet = ∅ := hs.edgeSet_inter_eq + rw [← image_inter f.injective.image_injective, h₃, image_empty] + π := A.π.map f + π_nodup := A.π_nodup.map f.injective + π_set := by + change _ = f '' _ ∩ f '' _ + rw [← image_inter f.injective] + have := A.π_set + ext v + change v ∈ A.π.map f ↔ v ∈ f '' (A.minus ∩ A.compl).vertexSet + rw [List.mem_map, ← this] + rfl + +omit [T2Space S] in +theorem Arm.ext' {Γ : Painting S} {A B : Arm Γ} (h₁ : A.minus = B.minus) (h₂ : A.compl = B.compl) + (h₃ : A.π = B.π) : A = B := by + cases A + cases B + cases h₁ + cases h₂ + cases h₃ + rfl + +omit [T2Space S] in +theorem Arm.map_symm (I : IsColouredImage f P P') (A : Arm P.Γ) : Arm.map I.symm (Arm.map I A) = A + := by + refine Arm.ext' (mapSub_symm f _) (mapSub_symm f _) ?_ + change (A.π.map f).map f.symm = A.π + simp + +omit [T2Space S] in +theorem Arm.map_symm' (I : IsColouredImage f P P') (A : Arm P'.Γ) : Arm.map I (Arm.map I.symm A) + = A := by + refine Arm.ext' (mapSub_symm' f _) (mapSub_symm' f _) ?_ + change (A.π.map f.symm).map f = A.π + simp + +/-- The image of a rooted location. -/ +def RootedLocation.map (I : IsColouredImage f P P') (L : RootedLocation P.Γ) : RootedLocation P'.Γ + where + arms := Arm.map I '' L.arms + finite_arms := L.finite_arms.image _ + disjoint_arms := by + rintro _ ⟨A₁, h₁, rfl⟩ _ ⟨A₂, h₂, rfl⟩ hne + exact mapSub_mono f (L.disjoint_arms A₁ h₁ A₂ h₂ fun h ↦ hne (h ▸ rfl)) + +variable {K : Drawing S} {Z : Type} [TopologicalSpace Z] {ψ : Z → S} + +omit [TopologicalSpace Z] in +omit [T2Space S] in +/-- Let `ℒ` be a location of `P'` with `M(Γ', ℒ)` the part of `Γ'` in `R`, and let the fragment `ψ` +lie over `f⁻¹(R)`. Then the +location `f⁻¹(ℒ)` of `P` gives a place of the fragment. -/ +theorem exists_cut_place (hd : χ.IsDisjoint) (hf : IsFramePreservingHomeo χ.Φ f) + (I : IsColouredImage f P P') (L : RootedLocation P'.Γ) + {R : Set S} (hV : L.M.vertexSet = P'.Γ.V ∩ R) (hE : L.M.edgeSet = {e ∈ P'.Γ.E | e ⊆ R}) + (hrange : range ψ = f ⁻¹' R) + (hinter : P.Γ.U ∩ K.U ⊆ P.Γ.V ∩ K.V) (han : IsAnchored P.Γ K) {l : List S} + (hl : ∀ v, v ∈ l ↔ v ∈ K.V ∩ P.Γ.V) + (hr : ∀ v, v ∈ K.U → v ∈ range ψ) (hπ : ∀ A ∈ L.arms, ∀ v ∈ A.π, f.symm v ∈ K.U) {m : ℕ} + (hm : L.arms.ncard ≤ m) : + ∃ X : Place χ, X.P = P ∧ IsCutPlace χ K ψ l m X ∧ IsPlaceHomeoImage X ⟨hd, P', L⟩ f := by + classical + let J := I.symm + let X : Place χ := ⟨hd, P, L.map J⟩ + have hg : BijOn (Arm.map I) X.L.arms L.arms := by + refine ⟨?_, ?_, ?_⟩ + · rintro _ ⟨A, hA, rfl⟩ + rw [Arm.map_symm'] + exact hA + · rintro _ ⟨A, hA, rfl⟩ _ ⟨B, hB, rfl⟩ hAB + rw [Arm.map_symm', Arm.map_symm'] at hAB + rw [hAB] + · exact fun A hA ↦ ⟨Arm.map J A, mem_image_of_mem _ hA, Arm.map_symm' I A⟩ + have hc₁ : ∀ A ∈ X.L.arms, (Arm.map I A).compl.vertexSet = f '' A.compl.vertexSet := fun _ _ ↦ rfl + have hc₂ : ∀ A ∈ X.L.arms, (Arm.map I A).compl.edgeSet = (fun e ↦ f '' e) '' A.compl.edgeSet + := fun _ _ ↦ rfl + have hMV : L.M.vertexSet = f '' X.L.M.vertexSet := + IsPlaceHomeoImage.M_V (X := X) (Y := ⟨hd, P', L⟩) I.V hg hc₁ + have hME : L.M.edgeSet = (fun e ↦ f '' e) '' X.L.M.edgeSet := + IsPlaceHomeoImage.M_E (X := X) (Y := ⟨hd, P', L⟩) I.E_eq hg hc₂ + refine ⟨X, rfl, ⟨hinter, fun v ↦ hl v, fun v hv ↦ hr v (K.V_subset_U ((hl v).1 hv).1), han, ?_, + ?_, ?_, ?_⟩, + hf, I.U.symm, I.V.symm, fun e he ↦ ⟨I.γ e he, I.φ e he⟩, Arm.map I, hg, fun A _ ↦ ⟨rfl, rfl, + rfl, rfl, rfl⟩⟩ + · ext v + rw [hrange] + constructor + · intro hv + have : f v ∈ L.M.vertexSet := hMV ▸ mem_image_of_mem _ hv + rw [hV, I.V] at this + obtain ⟨⟨u, hu, huv⟩, hR⟩ := this + exact ⟨f.injective huv ▸ hu, hR⟩ + · rintro ⟨hv, hR⟩ + have : f v ∈ L.M.vertexSet := by + rw [hV, I.V] + exact ⟨mem_image_of_mem _ hv, hR⟩ + rw [hMV] at this + obtain ⟨u, hu, huv⟩ := this + exact f.injective huv ▸ hu + · ext e + rw [hrange] + constructor + · intro he + have : f '' e ∈ L.M.edgeSet := hME ▸ mem_image_of_mem _ he + rw [hE] at this + obtain ⟨h₁, h₂⟩ := this + rw [I.E_eq] at h₁ + obtain ⟨c, hc, hce⟩ := h₁ + obtain rfl := f.injective.image_injective hce + exact ⟨hc, fun x hx ↦ h₂ (mem_image_of_mem _ hx)⟩ + · rintro ⟨he, hR⟩ + have : f '' e ∈ L.M.edgeSet := by + rw [hE] + refine ⟨I.E_eq ▸ mem_image_of_mem _ he, ?_⟩ + rintro _ ⟨x, hx, rfl⟩ + exact hR hx + rw [hME] at this + obtain ⟨c, hc, hce⟩ := this + obtain rfl := f.injective.image_injective hce + exact hc + · rintro _ ⟨A, hA, rfl⟩ v hv + obtain ⟨u, hu, rfl⟩ := List.mem_map.1 hv + have h₁ := hπ A hA u hu + have h₂ : u ∈ (A.minus ∩ A.compl).vertexSet := A.π_set ▸ hu + have h₃ : u ∈ P'.Γ.V := A.isSeparation.left_le.vertexSet_subset h₂.1 + rw [I.V] at h₃ + obtain ⟨z, hz, rfl⟩ := h₃ + have hzK : f.symm (f z) ∈ K.U := h₁ + rw [f.symm_apply_apply] at hzK ⊢ + exact (hl z).2 ⟨(hinter ⟨P.Γ.V_subset hz, hzK⟩).2, hz⟩ + · refine le_trans (ncard_image_le L.finite_arms) hm + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10i.lean b/LeanPool/GraphMinor/GM19/Section10i.lean new file mode 100644 index 0000000000..a83f7261b2 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10i.lean @@ -0,0 +1,134 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10h + +/-! +# The location of a finite family of separations + +The location of the proofs of (10.4), (10.5) and (11.1): one arm for each member of a family of +separations `(Γ ∩ A, Γ ∩ B)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +/-- A family of `λ`-linked separations of `Γ`, by pairs of sets of `Σ`, of order `< θ`, with `Γ ∩ A +⊆ Γ ∩ B'` for two different +members. -/ +structure IsLinkedFamily (D : TangleDatum cap χ) (θ : ℕ) (𝓟 : Set (Set S × Set S)) : Prop where + finite : 𝓟.Finite + linked : ∀ p ∈ 𝓟, GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (D.P.Γ.restrict p.1) + (D.P.Γ.restrict p.2) + order : ∀ p ∈ 𝓟, Hypergraph.separationOrder (D.P.Γ.restrict p.1) (D.P.Γ.restrict p.2) < θ + disjoint : ∀ p ∈ 𝓟, ∀ q ∈ 𝓟, p ≠ q → D.P.Γ.restrict p.1 ≤ D.P.Γ.restrict q.2 + closed : ∀ p ∈ 𝓟, IsClosed p.2 + +variable {D : TangleDatum cap χ} {θ : ℕ} {𝓟 : Set (Set S × Set S)} + +/-- The arm of a member of the family. -/ +noncomputable def IsLinkedFamily.arm (h : IsLinkedFamily D θ 𝓟) (p : 𝓟) : Arm D.P.Γ := + have hf := (D.P.Γ.restrict p.1.1 ∩ D.P.Γ.restrict p.1.2).vertexSet_finite + restrictArm D.P.Γ p.1.1 p.1.2 (D.isTangle.isSeparation (h.linked p.1 p.2).1) hf.toFinset.toList + (Finset.nodup_toList _) (by ext v; simp) + +/-- The rooted location of the family. -/ +noncomputable def IsLinkedFamily.location (h : IsLinkedFamily D θ 𝓟) : RootedLocation D.P.Γ where + arms := range h.arm + finite_arms := by + have := h.finite.to_subtype + exact finite_range _ + disjoint_arms := by + rintro _ ⟨p, rfl⟩ _ ⟨q, rfl⟩ hne + exact h.disjoint p.1 p.2 q.1 q.2 fun heq ↦ hne (congrArg h.arm (Subtype.ext heq)) + +omit [T2Space S] [T2Space Shat] in +theorem IsLinkedFamily.M_V (h : IsLinkedFamily D θ 𝓟) : + h.location.M.vertexSet = D.P.Γ.V ∩ ⋂ p ∈ 𝓟, Prod.snd p := by + ext v + simp only [RootedLocation.M, IsLinkedFamily.location, mem_inter_iff, mem_iInter] + constructor + · rintro ⟨hv, ha⟩ + exact ⟨hv, fun p hp ↦ (ha _ ⟨⟨p, hp⟩, rfl⟩).2⟩ + · rintro ⟨hv, ha⟩ + refine ⟨hv, ?_⟩ + rintro _ ⟨p, rfl⟩ + exact ⟨hv, ha p.1 p.2⟩ + +omit [T2Space S] [T2Space Shat] in +theorem IsLinkedFamily.M_E (h : IsLinkedFamily D θ 𝓟) : + h.location.M.edgeSet = {e ∈ D.P.Γ.E | e ⊆ ⋂ p ∈ 𝓟, Prod.snd p} := by + ext e + simp only [RootedLocation.M, IsLinkedFamily.location, mem_ofPred_eq, subset_iInter_iff] + constructor + · rintro ⟨he, ha⟩ + exact ⟨he, fun p hp ↦ (ha _ ⟨⟨p, hp⟩, rfl⟩).2.1⟩ + · rintro ⟨he, ha⟩ + refine ⟨he, ?_⟩ + rintro _ ⟨p, rfl⟩ + exact ⟨he, ha p.1 p.2, fun x hx ↦ closure_minimal (ha p.1 p.2) (h.closed p.1 p.2) hx.1.1⟩ + +omit [T2Space Shat] in +/-- The location isolates `𝒯`, by (8.8). -/ +theorem IsLinkedFamily.isolates (h : IsLinkedFamily D θ 𝓟) (hS : IsSurface S) (hθ : 0 < θ) (hle : θ + ≤ D.ord) : + h.location.Isolates D.tb θ D.ord D.𝒯 := by + refine theorem_8_8_proof D.tb hS D.P.fits.internally_three_connected D.isTangle ⟨?_, ?_⟩ ?_ hle + · rintro _ ⟨_, ⟨p, rfl⟩, rfl⟩ + exact (h.linked p.1 p.2).1 + · rintro _ ⟨p, rfl⟩ + exact h.linked p.1 p.2 + · rcases (h.location.arms).eq_empty_or_nonempty with he | hne + · change sSup (Arm.order '' _) < θ + rw [he, image_empty, csSup_empty] + exact hθ + · have hb : BddAbove (Arm.order '' h.location.arms) := (h.location.finite_arms.image _).bddAbove + obtain ⟨_, ⟨p, rfl⟩, hA⟩ := Nat.sSup_mem (hne.image _) hb + change sSup (Arm.order '' _) < θ + rw [← hA] + exact h.order p.1 p.2 + +variable {K : Drawing S} {Z : Type} [TopologicalSpace Z] {ψ : Z → S} + +omit [T2Space S] [T2Space Shat] [TopologicalSpace Z] in +/-- The location of a family gives a place of a fragment over `f⁻¹` of the common side of the +family. -/ +theorem IsLinkedFamily.exists_place (h : IsLinkedFamily D θ 𝓟) (hd : χ.IsDisjoint) {f : S ≃ₜ S} + (hf : IsFramePreservingHomeo χ.Φ f) + {Q : ColouredPainting χ} (I : IsColouredImage f Q D.P) (hrange : range ψ + = f ⁻¹' ⋂ p ∈ 𝓟, Prod.snd p) + (hinter : Q.Γ.U ∩ K.U ⊆ Q.Γ.V ∩ K.V) (han : IsAnchored Q.Γ K) {l : List S} + (hl : ∀ v, v ∈ l ↔ v ∈ K.V ∩ Q.Γ.V) + (hr : ∀ v, v ∈ K.U → v ∈ range ψ) + (hπ : ∀ p ∈ 𝓟, ∀ v ∈ D.P.Γ.V, v ∈ p.1 → v ∈ p.2 → f.symm v ∈ K.U) {m : ℕ} (hm : 𝓟.ncard ≤ m) : + ∃ X : Place χ, X.P = Q ∧ IsCutPlace χ K ψ l m X ∧ IsPlaceHomeoImage X ⟨hd, D.P, h.location⟩ f + := by + refine exists_cut_place hd hf I h.location h.M_V h.M_E hrange hinter han hl hr ?_ ?_ + · rintro _ ⟨p, rfl⟩ v hv + have hv' : v ∈ (D.P.Γ.restrict p.1.1 ∩ D.P.Γ.restrict p.1.2).vertexSet := (h.arm p).π_set ▸ hv + exact hπ p.1 p.2 v hv'.1.1 hv'.1.2 hv'.2.2 + · have := h.finite.to_subtype + have h₁ : h.location.arms.ncard ≤ (univ : Set 𝓟).ncard := by + change (range h.arm).ncard ≤ _ + rw [← image_univ] + exact ncard_image_le (toFinite _) + rw [Set.ncard_univ, Nat.card_coe_set_eq] at h₁ + exact h₁.trans hm + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10j.lean b/LeanPool/GraphMinor/GM19/Section10j.lean new file mode 100644 index 0000000000..5df84ace0b --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10j.lean @@ -0,0 +1,243 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10i + +import LeanPool.GraphMinor.GM19.FragmentOrient + +/-! +# Graph Minors XIX, (10.4), from the data of a distance flaw +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +/-- The sides of the discs of a set of discs. -/ +def discPairs (cap : IsCappedSurface S Shat) (𝓓 : Set (Set Shat)) : Set (Set S × Set S) := + (fun Δ ↦ (cap.emb ⁻¹' Δ, cap.emb ⁻¹' closure Δᶜ)) '' 𝓓 + +omit [T2Space S] [T2Space Shat] in +theorem iInter_discPairs (𝓓 : Set (Set Shat)) : + ⋂ p ∈ discPairs cap 𝓓, Prod.snd p = ⋂ Δ ∈ 𝓓, cap.emb ⁻¹' closure Δᶜ := by + ext x + simp [discPairs] + +/-- What the proof of (10.4) needs of a distance flaw: the discs `ins(C)`, the feature `K` that is +the part of `F` in `Σ`, and how +the two fit together. -/ +structure IsOuterData (D : TangleDatum cap χ) (n : ℕ) (𝓓 : Set (Set Shat)) + (K : Drawing S) : Prop where + shape : IsOuterShape cap K 𝓓 + finite : 𝓓.Finite + card : 𝓓.ncard ≤ 2 + family : IsLinkedFamily D (n + 1) (discPairs cap 𝓓) + feature : IsFeature χ.Φ K + inter : D.P.Γ.U ∩ K.U ⊆ D.P.Γ.V ∩ K.V + lines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} + ∧ IsLineWithEnds (closure e) u v + size : K.V.ncard + K.E.ncard ≤ 8 * n + pieces : ∃ 𝓞 𝓛 : Set (Set S), 𝓞.Finite ∧ 𝓛.Finite ∧ (∀ C ∈ 𝓞, IsOArc C) ∧ + (∀ L ∈ 𝓛, ∃ s t, s ≠ t ∧ IsLineWithEnds L s t ∧ s ∈ bd S ∪ ⋃₀ 𝓞 ∧ t ∈ bd S ∪ ⋃₀ 𝓞) ∧ K.U + = ⋃₀ 𝓞 ∪ ⋃₀ 𝓛 + roots : ∀ Δ ∈ 𝓓, ∀ v ∈ D.P.Γ.V, cap.emb v ∈ Δ → cap.emb v ∈ closure Δᶜ → v ∈ K.U + outer : ∀ v ∈ K.U, ∀ Δ ∈ 𝓓, cap.emb v ∈ closure Δᶜ + anchored : IsAnchored D.P.Γ K + +omit [T2Space S] in +theorem IsAnchored.image {f : S ≃ₜ S} {Γ Γ' : Painting S} {K K' : Drawing S} (h : IsAnchored Γ K) + (hU : f '' K'.U = K.U) + (hV : Γ.V = f '' Γ'.V) : IsAnchored Γ' K' := by + intro u x hx hne + obtain ⟨C, hC, hxC, hp, z, hz, hzV⟩ := h (f u) (f x) (hU ▸ mem_image_of_mem _ hx) fun h' ↦ hne + (f.injective h') + refine ⟨f.symm '' C, ?_, ⟨_, hxC, by simp⟩, hp.image _ f.symm.continuous.continuousOn, + f.symm z, mem_image_of_mem _ hz, ?_⟩ + · rintro _ ⟨y, hy, rfl⟩ + obtain ⟨hyK, hyu⟩ := hC hy + rw [← hU] at hyK + obtain ⟨w, hw, rfl⟩ := hyK + rw [f.symm_apply_apply] + exact ⟨hw, fun h' ↦ hyu (by rw [mem_singleton_iff.1 h']; rfl)⟩ + · rw [hV] at hzV + obtain ⟨w, hw, rfl⟩ := hzV + rwa [f.symm_apply_apply] + +omit [T2Space S] in +/-- Pulling back a feature preserves the intersection and anchoring conditions for placement and +gives a list of the common vertices. -/ +theorem IsColouredImage.exists_feature_placement_data {f : S ≃ₜ S} {P Q : ColouredPainting χ} + {Kc K : Drawing S} (hQ : IsColouredImage f.symm P Q) + (hU : f '' Kc.U = K.U) (hV : f '' Kc.V = K.V) + (hinter : P.Γ.U ∩ K.U ⊆ P.Γ.V ∩ K.V) (hanc : IsAnchored P.Γ K) : + ∃ l : List S, Q.Γ.U ∩ Kc.U ⊆ Q.Γ.V ∩ Kc.V ∧ IsAnchored Q.Γ Kc ∧ + ∀ v, v ∈ l ↔ v ∈ Kc.V ∩ Q.Γ.V := by + classical + have hfin : (Kc.V ∩ f ⁻¹' P.Γ.V).Finite := Kc.finite_V.subset inter_subset_left + refine ⟨hfin.toFinset.toList, hQ.feature_inter_subset hU hV hinter, + hanc.image hU hQ.symm.V, fun v => ?_⟩ + rw [Finset.mem_toList, hfin.mem_toFinset, hQ.V] + refine ⟨fun h => ⟨h.1, _, h.2, f.symm_apply_apply v⟩, ?_⟩ + rintro ⟨h₁, u, hu, rfl⟩ + exact ⟨h₁, by simpa using hu⟩ + +omit [T2Space S] [T2Space Shat] in +/-- The shape moves to the cap twisted by a homeomorphism. -/ +theorem IsOuterShape.ofHomeo {K K' : Drawing S} {𝓓 : Set (Set Shat)} + (h : IsOuterShape cap K' 𝓓) (f : S ≃ₜ S) + (hU : f '' K.U = K'.U) : IsOuterShape (cap.ofHomeo f) K 𝓓 := by + have hsym : ∀ A : Set S, f '' (f.symm '' A) = A := fun A ↦ by + rw [image_image] + simp + have hran : range (cap.ofHomeo f).emb = range cap.emb := by + rw [← image_univ, cap.ofHomeo_emb_image, image_univ, f.range_coe, image_univ] + have hbd : (cap.ofHomeo f).emb '' bd S = cap.emb '' bd S := by + rw [cap.ofHomeo_emb_image, image_bd] + have hne : ∀ {Θ Θ' : Set S}, Θ ≠ Θ' → f.symm '' Θ ≠ f.symm '' Θ' := fun h₁ h₂ ↦ h₁ + (f.symm.injective.image_injective h₂) + have hline : ∀ {L : Set S} {a b : S}, IsLineWithEnds L a b → IsLineWithEnds (f.symm '' L) + (f.symm a) (f.symm b) := fun {L a b} hl ↦ by + refine isLine_comap f.isClosedEmbedding ?_ + rw [hsym, f.apply_symm_apply, f.apply_symm_apply] + exact hl + have hL : ∀ L : Set S, (cap.ofHomeo f).emb '' (f.symm '' L) = cap.emb '' L := fun L ↦ by + rw [cap.ofHomeo_emb_image, hsym] + have hpt : ∀ a : S, (cap.ofHomeo f).emb (f.symm a) = cap.emb a := fun a ↦ by + change cap.emb (f (f.symm a)) = _ + rw [f.apply_symm_apply] + have hKU : (cap.ofHomeo f).emb '' K.U = cap.emb '' K'.U := by + rw [cap.ofHomeo_emb_image, hU] + have hbdL : ∀ {L : Set S} {s : S}, L ∩ bd S ⊆ {s} → f.symm '' L ∩ bd S ⊆ {f.symm s} + := fun {L s} h ↦ by + rintro x ⟨⟨y, hy, rfl⟩, hb⟩ + have hb' : y ∈ bd S := by + have := mem_image_of_mem f hb + rw [image_bd] at this + rwa [f.apply_symm_apply] at this + rw [mem_singleton_iff.1 (h ⟨hy, hb'⟩)] + rfl + rcases h with ⟨Δ, rfl, hΔ, hform, Θ₁, h₁, Θ₂, h₂, hn, hm₁, hm₂⟩ | ⟨Δ, L, s, u, Θ, Θ', rfl, hΔ, + hr, h₁, h₂, hn, hs, hL₀, hK, hm, hb, hb', hd, hm'⟩ | + ⟨Δ₁, Δ₂, L, a, b, Θ₁, Θ₂, rfl, hne₀, hΔ₁, hΔ₂, hr₁, hr₂, hL₀, hK, hm₁, hm₂, hd₁, hd₂, hin, h₁, + h₂, hn, hc₁, hc₂⟩ + · refine Or.inl ⟨Δ, rfl, hΔ, hform.ofHomeo f hU, _, (cap.ofHomeo_cuffDisc_symm f h₁).1, + _, (cap.ofHomeo_cuffDisc_symm f h₂).1, hne hn, ?_, ?_⟩ + · rwa [(cap.ofHomeo_cuffDisc_symm f h₁).2] + · rwa [(cap.ofHomeo_cuffDisc_symm f h₂).2] + · refine Or.inr (Or.inl ⟨Δ, f.symm '' L, f.symm s, f.symm u, _, _, rfl, hΔ, hran ▸ hr, + (cap.ofHomeo_cuffDisc_symm f h₁).1, (cap.ofHomeo_cuffDisc_symm f h₂).1, hne hn, + mem_image_of_mem _ hs, ?_, ?_, ?_, hbdL hb, ?_, ?_, ?_⟩) + · rcases hL₀ with ⟨rfl, rfl⟩ | hl + · exact Or.inl ⟨image_singleton, rfl⟩ + · exact Or.inr (hline hl) + · rw [hKU, hL] + exact hK + · rw [hL, hpt] + exact hm + · rw [hbd, hpt] + exact hb' + · rw [(cap.ofHomeo_cuffDisc_symm f h₁).2] + exact hd + · rw [(cap.ofHomeo_cuffDisc_symm f h₂).2] + exact hm' + · refine Or.inr (Or.inr ⟨Δ₁, Δ₂, f.symm '' L, f.symm a, f.symm b, _, _, rfl, hne₀, hΔ₁, hΔ₂, + hran ▸ hr₁, hran ▸ hr₂, ?_, ?_, ?_, ?_, ?_, ?_, ?_, + (cap.ofHomeo_cuffDisc_symm f h₁).1, (cap.ofHomeo_cuffDisc_symm f h₂).1, hne hn, ?_, ?_⟩) + · rcases hL₀ with ⟨rfl, rfl⟩ | hl + · exact Or.inl ⟨image_singleton, rfl⟩ + · exact Or.inr (hline hl) + · rw [hKU, hL] + exact hK + · rw [hL, hpt] + exact hm₁ + · rw [hL, hpt] + exact hm₂ + · rw [hbd, hL] + exact hd₁ + · rw [hbd] + exact hd₂ + · rw [hpt] + exact hin + · rw [(cap.ofHomeo_cuffDisc_symm f h₁).2] + exact hc₁ + · rw [(cap.ofHomeo_cuffDisc_symm f h₂).2] + exact hc₂ + +/-- One well-behaved set for all distance flaws with a given feature. -/ +theorem exists_class_outer (hS : IsSurface S) (hd : χ.IsDisjoint) + {𝒮 : Set (ColouredPainting χ)} (hcl : IsPaintingClass χ 𝒮) (n : ℕ) (a₀ : β) + (hS3 : ConditionS3 χ cap) {Kc : Drawing S} + (hg : ∃ (D : TangleDatum cap χ) (𝓓 : Set (Set Shat)), IsOuterData D n 𝓓 Kc) : + ∃ B : Set (Place χ), IsWellBehavedPlaces B ∧ ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → n + 1 ≤ D.ord → + ∀ (𝓓 : Set (Set Shat)) (K : Drawing S) (α : S ≃ₜ S), IsOuterData D n 𝓓 K + → IsFramePreservingHomeo χ.Φ α → + α '' Kc.U = K.U → α '' Kc.V = K.V → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb (n + 1) D.ord D.𝒯 ∧ (⟨hd, D.P, L⟩ : Place χ) ∈ B + := by + classical + have : ConnectedSpace S := χ.connected + obtain ⟨D₀, 𝓓₀, hp⟩ := hg + have hKne : Kc.V ⊆ ⋃ e ∈ arcComponentsIn (Kc.U \ Kc.V), closure e := fun v hv ↦ by + obtain ⟨e, he, hve⟩ := hp.feature.no_isolated_vertices v hv + exact mem_biUnion he hve.1 + obtain ⟨𝓞, 𝓛, h𝓞, h𝓛, hO, hL, hU⟩ := hp.pieces + obtain ⟨Y, tY, t2Y, ψ, hY, hψ, hsheet, -⟩ := exists_pullData_of_shape hS D₀.P.fits hp.inter + hp.lines hKne h𝓞 h𝓛 hO hL hU + obtain ⟨B, hB, hmem⟩ := exists_class_cut (χ := χ) (K := Kc) hY (ψ := ψ) 2 + (fun c ↦ (∀ (Shat₁ : Type) [TopologicalSpace Shat₁], IsCappedSurface c Shat₁ → Nonempty + (Shat₁ ≃ₜ Shat)) ∧ + numCuffs c < numCuffs S ∧ (IsOrientableSurface c → IsOrientableSurface S)) (fun X ↦ X.P ∈ 𝒮) + (fun y l h ↦ wellBehaved_S3 hS hp.feature hcl hp.lines hY hψ hsheet y l 2 a₀ hS3 h.1 h.2.1 + h.2.2) + refine ⟨_, theorem_9_4_proof hB, ?_⟩ + rintro D hmem𝒮 hord 𝓓 K α hK hα hαU hαV + obtain ⟨y, hy, hhat, hc, hO'⟩ := GraphMinor.GM19.outerSide S Shat (cap.ofHomeo α) Kc 𝓓 hS + (hK.shape.ofHomeo α hαU) Y tY t2Y ψ hY hψ + let Q : ColouredPainting χ := D.P.image α.symm hα.symm + have hQ : IsColouredImage α.symm D.P Q := ColouredPainting.isImage_image _ _ _ + have I : IsColouredImage α Q D.P := hQ.symm + have hrange : range (fun x : connectedComponent y ↦ ψ x.1) = α ⁻¹' ⋂ p ∈ discPairs cap 𝓓, + Prod.snd p := by + have : range (fun x : connectedComponent y ↦ ψ x.1) = ψ '' connectedComponent y := by + ext z + simp + rw [this, hy, iInter_discPairs] + ext x + simp [IsCappedSurface.ofHomeo] + obtain ⟨_, hinter, hanc, hl⟩ := hQ.exists_feature_placement_data hαU hαV hK.inter hK.anchored + have hr : ∀ v, v ∈ Kc.U → v ∈ range (fun x : connectedComponent y ↦ ψ x.1) := fun v hv ↦ by + rw [hrange] + have hvK : α v ∈ K.U := hαU ▸ mem_image_of_mem _ hv + rw [mem_preimage, iInter_discPairs] + exact mem_iInter₂.2 fun Δ hΔ ↦ hK.outer _ hvK Δ hΔ + have hπ : ∀ p ∈ discPairs cap 𝓓, ∀ v ∈ D.P.Γ.V, v ∈ p.1 → v ∈ p.2 → α.symm v ∈ Kc.U := by + rintro _ ⟨Δ, hΔ, rfl⟩ v hv h₁ h₂ + have := hK.roots Δ hΔ v hv h₁ h₂ + rw [← hαU] at this + obtain ⟨z, hz, rfl⟩ := this + rwa [α.symm_apply_apply] + have hm : (discPairs cap 𝓓).ncard ≤ 2 := le_trans (ncard_image_le hK.finite) hK.card + obtain ⟨X, hXP, hX, hXim⟩ := hK.family.exists_place (K := Kc) hd hα I hrange hinter hanc hl hr hπ + hm + have hX𝒮 : X.P ∈ 𝒮 := hXP ▸ hcl.image_mem _ hmem𝒮 _ _ hα.symm hQ + refine ⟨hK.family.location, hK.family.isolates hS (by omega) hord, X, hmem y _ X ⟨hhat, hc, + ?_⟩ ?_ hX hX𝒮, α, hXim⟩ + · exact hO' + · exact fun v hv ↦ ((hl v).1 hv).1 + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10k.lean b/LeanPool/GraphMinor/GM19/Section10k.lean new file mode 100644 index 0000000000..51b66673de --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10k.lean @@ -0,0 +1,102 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10j +public import LeanPool.GraphMinor.GM19.Section12a +public import LeanPool.GraphMinor.GM11.Section92 + +/-! +# Two poles at small distance lie in a tie + +The first step of the text before (10.4): "since $dist(\Gamma) \ge \frac{1}{2}n + 1$, it follows +from Theorem 9.2 of [6] that there exists $F \subseteq \Gamma^*$". +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +namespace TangleDatum + +/-- A closed walk whose inside meets the region of a vertex `r*` has `r*` in its inside. -/ +theorem center_mem_ins (D : TangleDatum cap χ) (hrep : 1 ≤ D.rep) {w : Shat} (hw : w ∈ D.rad.Rstar) + (T : ClosedWalkIns D.rad D.ord D.𝒯) (hm : (D.rad.regionOf w ∩ T.ins).Nonempty) : w ∈ T.ins := by + have hS := χ.isSurface + obtain ⟨hρ, hwm⟩ := D.rad.regionOf_mem hw + obtain ⟨-, -, hG3, -⟩ := id D.rad.isPreRadial + obtain ⟨w', ⟨hw', hwG⟩, huniq⟩ := hG3 _ hρ + obtain rfl : w = w' := huniq w ⟨hwm, hw.1⟩ + obtain ⟨y, hyz, hy⟩ := hm + have hX := (isRestraint_ins D hrep T).1 + by_cases hyU : y ∈ D.rad.G.U + · by_cases hyV : y ∈ D.rad.G.V + · rw [huniq y ⟨hyz, hyV⟩] at hy + exact hy + · obtain ⟨e, he, hye⟩ := D.rad.G.exists_edge_of_mem hyU hyV + have hsub : e ⊆ T.ins := nice_atom hX.isGammaNice (Or.inl (Or.inr he)) ⟨y, hye, hy⟩ + exact closure_minimal hsub hX.isClosed (D.rad.center_mem_closure hS he hρ ⟨y, hye, + hyz⟩ hw' hwG) + · obtain ⟨s, hs, hys⟩ := exists_region_of_notMem hyU + have hsub := nice_region hX.isGammaNice hs ⟨y, hys, hy⟩ + exact closure_minimal hsub hX.isClosed (D.rad.center_mem_closure_region hS hs hρ ⟨y, hys, + hyz⟩ hw' hwG) + +/-- Two poles at distance at most `n < rep(𝒯)` lie in a tie of length at most `2n`, by XI (8.5) and +XI (9.2). -/ +theorem exists_pole_tie (D : TangleDatum cap χ) {n : ℕ} (hn : n < D.rep) {r₁ r₂ : Shat} + (h₁ : r₁ ∈ D.rad.poles) + (h₂ : r₂ ∈ D.rad.poles) (hne : r₁ ≠ r₂) (hd : D.vDist r₁ r₂ ≤ n) : + ∃ X, IsTie D.rad.G D.ins (2 * D.rep) X ∧ r₁ ∈ X ∧ r₂ ∈ X ∧ perimeterWalkLength D.rad.G X + ≤ 2 * n := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hrep : 1 ≤ D.rep := by omega + have ha₁ : D.rad.atomOf r₁ = D.rad.regionOf r₁ := by + classical + unfold RadialDrawing.atomOf + rw [ite_eq_right h₁.1.2] + have ha₂ : D.rad.atomOf r₂ = D.rad.regionOf r₂ := by + classical + unfold RadialDrawing.atomOf + rw [ite_eq_right h₂.1.2] + have hreg : D.rad.regionOf r₁ ≠ D.rad.regionOf r₂ := fun heq ↦ by + obtain ⟨-, -, hG3, -⟩ := id D.rad.isPreRadial + have m₁ := D.rad.regionOf_mem h₁.1 + have m₂ := D.rad.regionOf_mem h₂.1 + exact hne ((hG3 _ m₁.1).unique ⟨m₁.2, h₁.1.1⟩ ⟨heq ▸ m₂.2, h₂.1.1⟩) + have hd' : D.dist (D.rad.regionOf r₁) (D.rad.regionOf r₂) < D.rep := by + have : D.vDist r₁ r₂ = D.dist (D.rad.regionOf r₁) (D.rad.regionOf r₂) := by + rw [vDist, ha₁, ha₂] + omega + obtain ⟨T, hm₁, hm₂, hl⟩ := D.exists_of_dist_lt hreg hd' + have hr₁ := D.center_mem_ins hrep h₁.1 T hm₁ + have hr₂ := D.center_mem_ins hrep h₂.1 T hm₂ + obtain ⟨hY, hlY⟩ := isRestraint_ins D hrep T + have hA : ∀ {r : Shat}, r ∈ D.rad.poles → ({r} : Set Shat) ∈ D.rad.G.A := fun {r} hr ↦ + Or.inl (Or.inl ⟨r, hr.1.1, rfl⟩) + obtain ⟨X, hX, hs₁, hs₂, -, hle⟩ := GM11.theorem_9_2_proof hT (D.isSlope hrep) (hA h₁) (hA h₂) hY + (singleton_subset_iff.2 hr₁) + (singleton_subset_iff.2 hr₂) + refine ⟨X, hX, hs₁ rfl, hs₂ rfl, hle.trans (hlY.trans ?_)⟩ + have : D.vDist r₁ r₂ = T.halfLen := by + rw [hl, vDist, ha₁, ha₂] + omega + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10l.lean b/LeanPool/GraphMinor/GM19/Section10l.lean new file mode 100644 index 0000000000..27192c4d52 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10l.lean @@ -0,0 +1,265 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10k + +/-! +# Short circuits around two poles + +The first steps from a tie to a distance flaw. A circuit of the first bullet of page 355 is chosen +with `λ(F)` minimal, and +then the argument of (10.1) applies. The paper says only "it follows from Theorem 9.2 of [6]". +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {F F₁ F₂ Q : Drawing Shat} {a b : Shat} + +omit [T2Space S] in +/-- A circuit made of `Q` and one path of `F` is no longer than `F`. -/ +theorem improve_card (ht : TwoPaths D.rad.G F F₁ F₂ Q a b) (hc : Q.E.ncard ≤ F₁.E.ncard) : + (D.rad.G.sup Q F₂).E.ncard ≤ F.E.ncard := by + have : ConnectedSpace Shat := cap.connected + have hE : (D.rad.G.sup Q F₂).E = Q.E ∪ F₂.E := Drawing.sup_E ht.path.1 ht.sub₂ + have hdis : Disjoint Q.E F₂.E := disjoint_left.mpr fun e he he' ↦ disjoint_left.mp ht.meet_E he + (ht.right.1.2 he') + rw [hE, ncard_union_eq hdis Q.finite_edges F₂.finite_edges, ht.union_E, + ncard_union_eq ht.disj_E F₁.finite_edges F₂.finite_edges] + omega + +omit [T2Space S] in +/-- A circuit made of `Q` and one path of `F` is no longer than `F`, and it is lighter. -/ +theorem improve (ht : TwoPaths D.rad.G F F₁ F₂ Q a b) (hc : Q.E.ncard ≤ F₁.E.ncard) + (hw : D.tb.weightSub Q < D.tb.weightSub F₁) : + Drawing.IsCircuitOf (D.rad.G.sup Q F₂) D.rad.G ∧ (D.rad.G.sup Q F₂).E.ncard ≤ F.E.ncard ∧ + D.tb.weightSub (D.rad.G.sup Q F₂) < D.tb.weightSub F := by + have : ConnectedSpace Shat := cap.connected + have hE : (D.rad.G.sup Q F₂).E = Q.E ∪ F₂.E := Drawing.sup_E ht.path.1 ht.sub₂ + have hdis : Disjoint Q.E F₂.E := disjoint_left.mpr fun e he he' ↦ disjoint_left.mp ht.meet_E he + (ht.right.1.2 he') + refine ⟨⟨D.rad.G.sup_isSubdrawing Q F₂, ht.left_circuit⟩, ?_, ?_⟩ + · rw [hE, ncard_union_eq hdis Q.finite_edges F₂.finite_edges, ht.union_E, + ncard_union_eq ht.disj_E F₁.finite_edges F₂.finite_edges] + omega + · rw [D.tb.weightSub_sup hE hdis, D.tb.weightSub_sup ht.union_E ht.disj_E] + linarith + +omit [T2Space S] [T2Space Shat] in +/-- A circuit of `Γ*` shorter than `2 rep(𝒯)` lies in its inside. -/ +theorem U_subset_ins (D : TangleDatum cap χ) {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hlt : C.E.ncard < 2 * D.rep) : + C.U ⊆ D.ins C := by + have hi := D.ins_spec hC hlt + rw [← hi.2.2.2.1] + exact Surface.discBd_subset _ + +omit [T2Space S] in +/-- The three circuits of a theta: the inside of one is covered by the insides of the two others. -/ +theorem ins_theta (hrep : 1 ≤ D.rep) (ht : TwoPaths D.rad.G F F₁ F₂ Q a b) + (hFc : F.IsCircuitOf D.rad.G) (hF : F.E.ncard < 2 * D.rep) + (h₁ : (D.rad.G.sup Q F₁).E.ncard < 2 * D.rep) (h₂ : (D.rad.G.sup Q F₂).E.ncard < 2 * D.rep) : + D.ins F ⊆ D.ins (D.rad.G.sup Q F₁) ∪ D.ins (D.rad.G.sup Q F₂) := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hs := D.isSlope hrep + set G := D.rad.G with hG + have hC₂ : Drawing.IsCircuitOf (G.sup Q F₂) G := ⟨G.sup_isSubdrawing Q F₂, ht.left_circuit⟩ + have hC₁ : Drawing.IsCircuitOf (G.sup Q F₁) G := ⟨G.sup_isSubdrawing Q F₁, ht.swap.left_circuit⟩ + have hsup : G.sup F₁ F₂ = F := Drawing.ext_of_V_E (by rw [Drawing.sup_V + (ht.left.1.trans ht.sub) ht.sub₂, ht.union_V]) + (by rw [Drawing.sup_E (ht.left.1.trans ht.sub) ht.sub₂, ht.union_E]) + have hcomm : ∀ {X Y : Drawing Shat}, X.IsSubdrawing G → Y.IsSubdrawing G → G.sup X Y = G.sup Y X + := fun hX hY ↦ + Drawing.ext_of_V_E (by rw [Drawing.sup_V hX hY, Drawing.sup_V hY hX, Set.union_comm]) + (by rw [Drawing.sup_E hX hY, Drawing.sup_E hY hX, Set.union_comm]) + have hsF₁ := ht.left.1.trans ht.sub + have hsF₂ := ht.sub₂ + have hsQ := ht.path.1 + have hab₁ := ht.mem_V₁ + have hab₂ := ht.swap.mem_V₁ + obtain ⟨W, -, hWV, hWE⟩ := ht.path.2 + have habQ : a ∈ Q.V ∧ b ∈ Q.V := ⟨by rw [hWV]; exact W.start_mem_support, by rw [hWV]; exact + W.end_mem_support⟩ + have hpos : ∀ {X : Drawing Shat}, X.IsPathBetween a b → 0 < X.length := fun {X} hX ↦ by + obtain ⟨V, -, -, hVE⟩ := hX + refine (ncard_pos X.finite_edges).2 ?_ + cases V with + | nil h' => exact absurd rfl ht.ne + | @cons _ x _ e h' r => exact ⟨e, by + change e ∈ X.E + rw [hVE] + simp [GraphWalk.edges]⟩ + have hab : ({a, b} : Set Shat) ⊆ Q.V ∩ F₁.V := by + rintro x (rfl | rfl) + · exact ⟨habQ.1, hab₁.1⟩ + · exact ⟨habQ.2, hab₁.2⟩ + have hm₀₁ : Q.V ∩ F₁.V = {a, b} := by + refine Subset.antisymm (fun x hx => ht.meet_V ⟨hx.1, ?_⟩) hab + rw [ht.union_V] + exact Or.inl hx.2 + have hm₁₂ : F₁.V ∩ F₂.V = {a, b} := by + refine Subset.antisymm ht.inter_V ?_ + rintro x (rfl | rfl) + · exact ⟨hab₁.1, hab₂.1⟩ + · exact ⟨hab₁.2, hab₂.2⟩ + have hm₂₀ : F₂.V ∩ Q.V = {a, b} := by + refine Subset.antisymm (fun x hx ↦ ht.meet_V ⟨hx.2, by rw [ht.union_V]; exact Or.inr hx.1⟩) ?_ + rintro x (rfl | rfl) + · exact ⟨hab₂.1, habQ.1⟩ + · exact ⟨hab₂.2, habQ.2⟩ + have hd₀₁ : Disjoint Q.E F₁.E := disjoint_left.mpr fun e he he' ↦ disjoint_left.mp ht.meet_E he + (ht.left.1.2 he') + have hd₀₂ : Disjoint Q.E F₂.E := disjoint_left.mpr fun e he he' ↦ disjoint_left.mp ht.meet_E he + (ht.right.1.2 he') + have hl₁ : (G.sup F₁ F₂).length < 2 * D.rep := by rw [hsup]; exact hF + have hl₂ : (G.sup F₂ Q).length < 2 * D.rep := by rw [hcomm hsF₂ hsQ]; exact h₂ + have hl₃ : (G.sup Q F₁).length < 2 * D.rep := h₁ + have hcase := hs.three_paths Q F₁ F₂ a b ht.path.2 ht.left.2 ht.right.2 hsQ hsF₁ hsF₂ + (hpos ht.path.2) (hpos ht.left.2) (hpos ht.right.2) + hm₀₁ hm₁₂ hm₂₀ hd₀₁ ht.disj_E hd₀₂.symm hl₁ hl₂ hl₃ + rw [hsup, hcomm hsF₂ hsQ] at hcase + rcases hcase with ⟨c₂, c₁⟩ | ⟨h, -⟩ | ⟨h, -⟩ + · have hi := D.ins_spec hFc hF + have hi₁ := D.ins_spec hC₁ h₁ + have hi₂ := D.ins_spec hC₂ h₂ + have hd := hi.2.2.1 + have hbd := hi.2.2.2.1 + have hout := isSide_out hT hd hbd + have hd₁ : Disjoint (D.ins F)ᶜ (D.ins (G.sup Q F₁)) := disjoint_left.mpr fun x hx hx' ↦ hx + (c₁ hx') + have hd₂ : Disjoint (D.ins F)ᶜ (D.ins (G.sup Q F₂)) := disjoint_left.mpr fun x hx hx' ↦ hx + (c₂ hx') + intro x hx + rcases ht.swap.theta_cover hT hout hi₂.2.2.1 hi₁.2.2.1 hi₂.2.2.2.1 hi₁.2.2.2.1 hd₂ hd₁ x with h + | h | h + · have hxF : x ∈ F.U := by + have : x ∈ frontier (D.ins F) := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure hx, h⟩ + rwa [IsClosedDisc.frontier_eq_discBd hT hd, hbd] at this + rw [ht.U_eq] at hxF + rcases hxF with h' | h' + · exact Or.inl (D.U_subset_ins hC₁ h₁ (by rw [ht.swap.U_right]; exact Or.inr h')) + · exact Or.inr (D.U_subset_ins hC₂ h₂ (by rw [ht.U_right]; exact Or.inr h')) + · exact Or.inr h + · exact Or.inl h + · exact h.trans subset_union_right + · exact h.trans subset_union_left + +/-- A circuit of length at most `2n` with two poles in its inside: the first bullet of page 355. -/ +def IsPairCircuit (D : TangleDatum cap χ) (n : ℕ) (C : Drawing Shat) : Prop := + C.IsCircuitOf D.rad.G ∧ C.E.ncard ≤ 2 * n ∧ ∃ p ∈ D.rad.poles, ∃ q ∈ D.rad.poles, p ≠ q + ∧ p ∈ D.ins C ∧ q ∈ D.ins C + +omit [T2Space S] in +omit [T2Space Shat] in +/-- A circuit of `IsPairCircuit` that is shortest, and lightest among the shortest. -/ +theorem exists_least_pair {n : ℕ} (h : ∃ C, D.IsPairCircuit n C) + : + ∃ F, D.IsPairCircuit n F ∧ ∀ C, D.IsPairCircuit n C → F.E.ncard ≤ C.E.ncard ∧ (F.E.ncard + = C.E.ncard → D.tb.weightSub F ≤ D.tb.weightSub C) := by + have hfin : {C | D.IsPairCircuit n C}.Finite := (finite_circuits D.rad.G).subset fun C hC ↦ + ⟨hC.1.2, hC.1.1⟩ + obtain ⟨F₀, hF₀, hmin⟩ := Set.exists_min_image _ (fun C ↦ C.E.ncard) hfin h + have hfin' : {C | D.IsPairCircuit n C ∧ C.E.ncard = F₀.E.ncard}.Finite + := hfin.subset fun C hC ↦ hC.1 + obtain ⟨F, hF, hmin'⟩ := Set.exists_min_image _ (fun C ↦ D.tb.weightSub C) hfin' ⟨F₀, hF₀, rfl⟩ + refine ⟨F, hF.1, fun C hC ↦ ?_⟩ + rw [hF.2] + exact ⟨hmin C hC, fun heq ↦ hmin' C ⟨hC, heq.symm⟩⟩ + +variable (hS : IsSurface S) (h3 : D.P.Γ.IsInternallyThreeConnected) + +omit [T2Space S] in +/-- The least circuit around two poles cannot be improved through a pole. -/ +theorem thetaFree_of_least {n : ℕ} (hn : n < D.rep) {F : Drawing Shat} (hF : D.IsPairCircuit n F) + (hmin : ∀ C, D.IsPairCircuit n C → F.E.ncard ≤ C.E.ncard ∧ (F.E.ncard = C.E.ncard + → D.tb.weightSub F ≤ D.tb.weightSub C)) : ThetaFree D F := by + intro F₁ F₂ Q a b ht ⟨p, hp, hpQ⟩ c₁ w₁ c₂ w₂ + have : ConnectedSpace Shat := cap.connected + obtain ⟨hFc, hle, q₁, hq₁, q₂, hq₂, hne, hi₁, hi₂⟩ := hF + have hrep : 1 ≤ D.rep := by omega + obtain ⟨q, hq, hqi, hqp⟩ : ∃ q ∈ D.rad.poles, q ∈ D.ins F ∧ q ≠ p := by + by_cases h : q₁ = p + · exact ⟨q₂, hq₂, hi₂, fun h' ↦ hne (h.trans h'.symm)⟩ + · exact ⟨q₁, hq₁, hi₁, h⟩ + obtain ⟨hC₂, hl₂, hw₂⟩ := improve ht c₁ w₁ + obtain ⟨hC₁, hl₁, hw₁⟩ := improve ht.swap c₂ w₂ + have key : ∀ {C : Drawing Shat}, C.IsCircuitOf D.rad.G → C.E.ncard ≤ F.E.ncard + → D.tb.weightSub C < D.tb.weightSub F → Q.U ⊆ C.U → + q ∈ D.ins C → False := by + intro C hC hl hw hQC hqC + have hlt : C.E.ncard < 2 * D.rep := by omega + have := hmin C ⟨hC, by omega, q, hq, p, hp, hqp, hqC, D.U_subset_ins hC hlt (hQC + (Q.V_subset_U hpQ))⟩ + exact absurd (this.2 (le_antisymm this.1 hl)) (not_le.2 hw) + rcases ins_theta hrep ht hFc (by omega) (by omega) (by omega) hqi with h | h + · exact key hC₁ hl₁ hw₁ (by rw [ht.swap.U_right]; exact subset_union_left) h + · exact key hC₂ hl₂ hw₂ (by rw [ht.U_right]; exact subset_union_left) h + +include hS h3 in +/-- A circuit shorter than `2 rep(𝒯)` lies in a linked circuit that is no longer, and is no heavier +if it is as long. This is +(8.7) with `ins` in place of the sides. -/ +theorem exists_linked {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hlt : C.E.ncard < 2 * D.rep) : + ∃ C', C'.IsCircuitOf D.rad.G ∧ C'.E.ncard ≤ C.E.ncard ∧ (C'.E.ncard = C.E.ncard + → D.tb.weightSub C' ≤ D.tb.weightSub C) ∧ + D.ins C ⊆ D.ins C' ∧ GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins C')) + (partIn cap D.P.Γ (closure (D.ins C')ᶜ)) := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hi := D.ins_spec hC hlt + have hs : IsSidesOf C (D.ins C) (closure (D.ins C)ᶜ) := by + have h : Sided C (discInt (D.ins C)) (D.ins C)ᶜ := ⟨D.ins C, hi.2.2.1, hi.2.2.2.1, Or.inl ⟨rfl, + rfl⟩⟩ + have := h.isSidesOf hT + rwa [closure_discInt hi.2.2.1] at this + have hle₁ : D.rep ≤ D.ord := (tangleRep_spec D.rad D.ord D.𝒯).1 + have hle₂ : (D.rep : ℕ∞) ≤ Painting.rep D.rad := tangleRep_le_rep D.rad D.ord D.𝒯 + have hlt' : (C.E.ncard : ℕ∞) < 2 * min (D.ord : ℕ∞) (Painting.rep D.rad) := by + have h₁ : (D.rep : ℕ∞) ≤ min (D.ord : ℕ∞) (Painting.rep D.rad) := le_min + (by exact_mod_cast hle₁) hle₂ + have h₂ : (C.E.ncard : ℕ∞) < 2 * (D.rep : ℕ∞) := by exact_mod_cast hlt + exact lt_of_lt_of_le h₂ (by gcongr) + obtain ⟨C', S₁', S₂', hL, hs', hlink, hle, hw, hsub, -⟩ := theorem_8_7_proof hS h3 D.tb + D.isTangle hC hlt' hs hi.2.2.2.2 + have hlt₂ : C'.E.ncard < 2 * D.rep := by omega + have hi' := D.ins_spec hL.1 hlt₂ + rcases isSidesOf_cases hT hi'.2.2.1 hi'.2.2.2.1 hs' with ⟨e₁, e₂⟩ | ⟨e₁, e₂⟩ + · rw [e₁, e₂] at hlink + exact ⟨C', hL.1, hle, hw, e₁ ▸ hsub, hlink⟩ + · exfalso + rw [e₁, e₂] at hlink + have hO := isSide_int hT hi'.2.2.1 hi'.2.2.2.1 + have hu := part_cover D.rad hL.1.1 hL.1.1 hL.1.1 (isSide_out hT hi'.2.2.1 hi'.2.2.2.1) hO hO + (fun x ↦ by + rw [closure_discInt hi'.2.2.1] + by_cases hx : x ∈ D.ins C' + · exact Or.inr (Or.inl hx) + · exact Or.inl (subset_closure hx)) + rw [closure_discInt hi'.2.2.1] at hu + exact D.isTangle.axiom2 hlink.1 hi'.2.2.2.2 hi'.2.2.2.2 hu + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10m.lean b/LeanPool/GraphMinor/GM19/Section10m.lean new file mode 100644 index 0000000000..d2805716bf --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10m.lean @@ -0,0 +1,214 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10l +public import LeanPool.GraphMinor.GM19.Section5r + +/-! +# The first bullet of the distance flaw + +A short circuit around two poles gives the data of the first shape of a distance flaw. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +namespace TangleDatum + +variable {D : TangleDatum cap χ} + +omit [T2Space S] in +/-- The two sides of a short circuit are its inside and its outside. -/ +theorem sides_ins (D : TangleDatum cap χ) {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hlt : C.E.ncard < 2 * D.rep) : + IsSidesOf C (D.ins C) (closure (D.ins C)ᶜ) := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hi := D.ins_spec hC hlt + have h : Sided C (discInt (D.ins C)) (D.ins C)ᶜ := ⟨D.ins C, hi.2.2.1, hi.2.2.2.1, Or.inl ⟨rfl, + rfl⟩⟩ + have := h.isSidesOf hT + rwa [closure_discInt hi.2.2.1] at this + +omit [T2Space S] [T2Space Shat] in +/-- Linked discs with small order, each in the outside of the others, form a linked family. -/ +theorem family_of_discs {θ : ℕ} {𝓓 : Set (Set Shat)} (hf : 𝓓.Finite) + (hlink : ∀ Δ ∈ 𝓓, GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ Δ) + (partIn cap D.P.Γ (closure Δᶜ))) + (hord : ∀ Δ ∈ 𝓓, Hypergraph.separationOrder (partIn cap D.P.Γ Δ) (partIn cap D.P.Γ + (closure Δᶜ)) < θ) + (hdis : ∀ Δ ∈ 𝓓, ∀ Δ' ∈ 𝓓, Δ ≠ Δ' → Δ ⊆ closure Δ'ᶜ) : IsLinkedFamily D θ (discPairs cap 𝓓) + := by + refine ⟨hf.image _, ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨Δ, hΔ, rfl⟩ + exact hlink Δ hΔ + · rintro _ ⟨Δ, hΔ, rfl⟩ + exact hord Δ hΔ + · rintro _ ⟨Δ, hΔ, rfl⟩ _ ⟨Δ', hΔ', rfl⟩ hne + have hne' : Δ ≠ Δ' := fun h ↦ hne (by rw [h]) + refine (le_iff_of_le (D.P.Γ.restrict_le _) (D.P.Γ.restrict_le _)).2 ⟨?_, ?_⟩ + · exact fun v hv ↦ ⟨hv.1, hdis Δ hΔ Δ' hΔ' hne' hv.2⟩ + · exact fun c hc ↦ ⟨hc.1, fun x hx ↦ hdis Δ hΔ Δ' hΔ' hne' (hc.2.1 hx), + fun v hv ↦ hdis Δ hΔ Δ' hΔ' hne' (hc.2.2 hv)⟩ + · rintro _ ⟨Δ, -, rfl⟩ + exact isClosed_closure.preimage cap.isEmbedding.continuous + +variable (hS : IsSurface S) +include hS + +omit [T2Space S] [T2Space Shat] in +omit hS in +/-- A pole does not lie in `Σ`. -/ +theorem pole_notMem_range (D : TangleDatum cap χ) {r : Shat} (hr : r ∈ D.rad.poles) : r ∉ range + cap.emb := by + obtain ⟨Θ, hΘ, -, hd⟩ := D.rad.pole_cases hr + exact fun h ↦ cap.notMem_range hΘ hd h + +omit [T2Space S] [T2Space Shat] in +omit hS in +/-- Distinct poles belong to distinct cuffs. -/ +theorem pole_cuffs_ne (D : TangleDatum cap χ) {r₁ r₂ : Shat} (h₁ : r₁ ∈ D.rad.poles) + (h₂ : r₂ ∈ D.rad.poles) (hne : r₁ ≠ r₂) : + ∃ Θ₁ ∈ cuffs S, ∃ Θ₂ ∈ cuffs S, Θ₁ ≠ Θ₂ ∧ r₁ ∈ cap.cuffDisc Θ₁ ∧ r₂ ∈ cap.cuffDisc Θ₂ := by + obtain ⟨Θ₁, hΘ₁, hreg₁, hd₁⟩ := D.rad.pole_cases h₁ + obtain ⟨Θ₂, hΘ₂, hreg₂, hd₂⟩ := D.rad.pole_cases h₂ + refine ⟨Θ₁, hΘ₁, Θ₂, hΘ₂, ?_, hd₁, hd₂⟩ + rintro rfl + obtain ⟨-, -, hG3, -⟩ := id D.rad.isPreRadial + have m₁ := D.rad.regionOf_mem h₁.1 + have m₂ := D.rad.regionOf_mem h₂.1 + exact hne ((hG3 _ m₁.1).unique ⟨m₁.2, h₁.1.1⟩ ⟨(hreg₁.trans hreg₂.symm) ▸ m₂.2, h₂.1.1⟩) + +omit [T2Space S] in +omit hS in +/-- A circuit with a pole in its inside is not the edge of a disc of `Σ` that misses the vertices of +`Γ` off the circuit. -/ +theorem no_empty_disc (D : TangleDatum cap χ) {F : Drawing Shat} (hF : F.IsCircuitOf D.rad.G) + (hlt : F.E.ncard < 2 * D.rep) {r : Shat} + (hr : r ∈ D.rad.poles) (hri : r ∈ D.ins F) {Δ : Set Shat} (hd : IsClosedDisc Δ) + (hsub : Δ ⊆ range cap.emb) (hbd : discBd Δ = F.U) + (hV : ∀ v ∈ D.P.Γ.V, cap.emb v ∈ Δ → cap.emb v ∈ F.U) : False := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hi := D.ins_spec hF hlt + rcases isSidesOf_cases hT hd hbd (D.sides_ins hF hlt) with ⟨e₁, -⟩ | ⟨e₁, e₂⟩ + · exact D.pole_notMem_range hr (hsub (e₁ ▸ hri)) + · have hm := hi.2.2.2.2 + refine D.isTangle.axiom3 hm ?_ + refine subset_antisymm inter_subset_left fun v hv ↦ ⟨hv, ?_⟩ + change cap.emb v ∈ D.ins F + by_cases hvΔ : cap.emb v ∈ Δ + · exact D.U_subset_ins hF hlt (hV v hv hvΔ) + · rw [e₁] + exact subset_closure hvΔ + +omit [TopologicalSpace S] [T2Space S] hS in +/-- The bound `dist(Γ) > ½n + 1` excludes the third outcome of the second assertion of (10.1). -/ +theorem not_dist_le {d : ℕ∞} {n m : ℕ} (hd : ((n + 2 : ℕ) : ℕ∞) < 2 * d) (hm : m ≤ 2 * n) + (h : d * 4 ≤ ((m + 4 : ℕ) : ℕ∞)) : False := by + induction d using ENat.recTopCoe with + | top => simp at h + | coe k => + have h₁ : n + 2 < 2 * k := by exact_mod_cast hd + have h₂ : k * 4 ≤ m + 4 := by exact_mod_cast h + omega + +variable (h3 : D.P.Γ.IsInternallyThreeConnected) +include h3 + +/-- **The first shape.** -/ +theorem exists_outer_of_pair [Nonempty S] {n : ℕ} (hn : n < D.rep) (hd : + ((n + 2 : ℕ) : ℕ∞) < 2 * Painting.dist D.rad) + (h : ∃ C, D.IsPairCircuit n C) : ∃ 𝓓 K, IsOuterData D n 𝓓 K := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + obtain ⟨F₀, hF₀, hmin₀⟩ := exists_least_pair h + have hlt₀ : F₀.E.ncard < 2 * D.rep := by have := hF₀.2.1; omega + -- The linked circuit from (8.7) is again least. + obtain ⟨F, hFc, hle, hw, hsub, hlink⟩ := exists_linked hS h3 hF₀.1 hlt₀ + have hc₀ := hF₀.2.1 + obtain ⟨-, -, p₀, hp₀, q₀, hq₀, hne₀, hi₀, hi₀'⟩ := hF₀ + have hle₂ : F.E.ncard ≤ 2 * n := by omega + have hlF : D.IsPairCircuit n F := ⟨hFc, hle₂, p₀, hp₀, q₀, hq₀, hne₀, hsub hi₀, hsub hi₀'⟩ + have heq : F.E.ncard = F₀.E.ncard := le_antisymm hle (hmin₀ F hlF).1 + have hminF : ∀ C, D.IsPairCircuit n C → F.E.ncard ≤ C.E.ncard ∧ (F.E.ncard = C.E.ncard + → D.tb.weightSub F ≤ D.tb.weightSub C) := fun C hC ↦ by + obtain ⟨h₁, h₂⟩ := hmin₀ C hC + exact ⟨heq.le.trans h₁, fun h₃ ↦ (hw heq).trans (h₂ (heq.symm.trans h₃))⟩ + have hlt : F.E.ncard < 2 * D.rep := by omega + have hθ : ThetaFree D F := thetaFree_of_least hn hlF hminF + have hform : ((F.U ∩ cap.emb '' bd S).ncard ≤ 1 ∧ F.U ⊆ range cap.emb) ∨ + ((F.U ∩ cap.emb '' bd S).ncard = 2 ∧ ¬ F.U ⊆ range cap.emb) := by + rcases second_of_thetaFree hS h3 hFc hθ with h | h | h + · exact Or.inl h + · exact Or.inr h + · exact (not_dist_le hd hle₂ h).elim + obtain ⟨K, hK, htwo⟩ := exists_part_of_form hS h3 hFc hform fun Δ h₁ h₂ h₃ h₄ ↦ + D.no_empty_disc hFc hlt hp₀ (hsub hi₀) h₁ h₂ h₃ h₄ + have hi := D.ins_spec hFc hlt + have hbd : discBd (D.ins F) = F.U := hi.2.2.2.1 + obtain ⟨Θ₁, hΘ₁, Θ₂, hΘ₂, hΘ, hd₁, hd₂⟩ := D.pole_cuffs_ne hp₀ hq₀ hne₀ + have hKF : cap.emb '' K.U ⊆ F.U := by + rcases hK.form with ⟨h, -⟩ | ⟨s, t, Θ, -, -, -, -, -, -, h, -⟩ + · exact h.symm.subset + · exact h + have hfrontier : frontier (D.ins F) = F.U := by + rw [IsClosedDisc.frontier_eq_discBd hT hi.2.2.1, hbd] + refine ⟨{D.ins F}, K, Or.inl ⟨D.ins F, rfl, hi.2.2.1, hbd ▸ hK.form, Θ₁, hΘ₁, Θ₂, hΘ₂, hΘ, ⟨p₀, + hd₁, hsub hi₀⟩, ⟨q₀, hd₂, hsub hi₀'⟩⟩, + finite_singleton _, by simp, ?_, hK.feature, hK.inter, hK.lines, ?_, ?_, ?_, ?_, ?_⟩ + · refine family_of_discs (finite_singleton _) (by rintro _ rfl; exact hlink) ?_ ?_ + · rintro _ rfl + have := disc_order hS h3 D.rad hFc hi.2.2.1 hbd + omega + · rintro _ rfl _ rfl h + exact (h rfl).elim + · have h₁ := hK.V_le + have h₂ := hK.E_le + have h₃ := IsCircuit.ncard_V hFc.2 + omega + · rcases hK.form with ⟨-, hO, -⟩ | ⟨s, t, Θ, -, hst, -, -, hbds, hl, -⟩ + · exact ⟨{K.U}, ∅, finite_singleton _, finite_empty, by rintro _ rfl; exact hO, by simp, by + simp⟩ + · refine ⟨∅, {K.U}, finite_empty, finite_singleton _, by simp, ?_, by simp⟩ + rintro _ rfl + have hs : s ∈ K.U ∩ bd S := hbds ▸ mem_insert _ _ + have ht : t ∈ K.U ∩ bd S := hbds ▸ mem_insert_of_mem _ rfl + exact ⟨s, t, hst, hl, Or.inl hs.2, Or.inl ht.2⟩ + · rintro _ rfl v hv h₁ h₂ + have hvF : cap.emb v ∈ F.U := by + rw [← hfrontier, frontier_eq_closure_inter_closure] + exact ⟨subset_closure h₁, h₂⟩ + rcases hK.form with ⟨h, -⟩ | ⟨s, t, Θ, hΘ', -, -, -, -, -, -, h⟩ + · rw [h] at hvF + obtain ⟨u, hu, hvu⟩ := hvF + rwa [← cap.isEmbedding.injective hvu] + · by_contra hn' + exact cap.notMem_range hΘ' (h ⟨hvF, fun ⟨u, hu, hvu⟩ ↦ hn' (cap.isEmbedding.injective hvu ▸ + hu)⟩) ⟨v, rfl⟩ + · rintro v hv _ rfl + have : cap.emb v ∈ frontier (D.ins F) := hfrontier ▸ hKF (mem_image_of_mem _ hv) + rw [frontier_eq_closure_inter_closure] at this + exact this.2 + · exact isAnchored_of_form hK.form hK.inter htwo + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10n.lean b/LeanPool/GraphMinor/GM19/Section10n.lean new file mode 100644 index 0000000000..1a012adb51 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10n.lean @@ -0,0 +1,179 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10m + +/-! +# Walks around a distance flaw + +Everything on a closed walk of length at most `2n` is close to everything else on it. So, since +`dist(Γ) > ½n + 1`, such a walk +meets one cuff at most. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +/-- Two vertices of a closed walk are joined by a part of it of at most half its length. -/ +theorem exists_half_walk {α β : Type*} {G : Graph α β} {u x y : α} (Z : GraphWalk G u u) + (hx : x ∈ Z.support) (hy : y ∈ Z.support) : + ∃ W : GraphWalk G x y, 2 * W.length ≤ Z.length ∧ (∀ z ∈ W.support, z ∈ Z.support) + ∧ ∀ e ∈ W.edges, e ∈ Z.edges := by + obtain ⟨A, B, rfl⟩ := Z.exists_append_of_mem hx + have hsupp : ∀ z, z ∈ (B.append A).support ↔ z ∈ (A.append B).support := fun z ↦ by + rw [GraphWalk.mem_support_append, GraphWalk.mem_support_append, or_comm] + have hed : ∀ e, e ∈ (B.append A).edges ↔ e ∈ (A.append B).edges := fun e ↦ by + rw [GraphWalk.edges_append, GraphWalk.edges_append, List.mem_append, List.mem_append, or_comm] + obtain ⟨C, E, hR⟩ := (B.append A).exists_append_of_mem ((hsupp y).2 hy) + have hlen : (A.append B).length = C.length + E.length := by + have h₁ := congrArg GraphWalk.length hR + rw [GraphWalk.length_append, GraphWalk.length_append] at h₁ + rw [GraphWalk.length_append] + omega + have hC : (∀ z ∈ C.support, z ∈ (A.append B).support) ∧ ∀ e ∈ C.edges, e ∈ (A.append B).edges + := by + refine ⟨fun z hz ↦ (hsupp z).1 ?_, fun e he ↦ (hed e).1 ?_⟩ + · rw [hR] + exact (GraphWalk.mem_support_append _ _).2 (Or.inl hz) + · rw [hR, GraphWalk.edges_append] + exact List.mem_append.2 (Or.inl he) + have hE : (∀ z ∈ E.support, z ∈ (A.append B).support) ∧ ∀ e ∈ E.edges, e ∈ (A.append B).edges + := by + refine ⟨fun z hz ↦ (hsupp z).1 ?_, fun e he ↦ (hed e).1 ?_⟩ + · rw [hR] + exact (GraphWalk.mem_support_append _ _).2 (Or.inr hz) + · rw [hR, GraphWalk.edges_append] + exact List.mem_append.2 (Or.inr he) + rcases le_total C.length E.length with h | h + · exact ⟨C, by omega, hC.1, hC.2⟩ + · refine ⟨E.reverse, ?_, fun z hz ↦ hE.1 z ?_, fun e he ↦ hE.2 e ?_⟩ + · rw [GraphWalk.length_reverse] + omega + · rw [GraphWalk.support_reverse] at hz + exact List.mem_reverse.1 hz + · rw [GraphWalk.edges_reverse] at he + exact List.mem_reverse.1 he + +/-- A simple walk that uses only edges of a walk is no longer than that walk. -/ +theorem length_le_of_edges {α β : Type*} {G : Graph α β} {u v u' v' : α} {W : GraphWalk G u v} + {W' : GraphWalk G u' v'} (hW : W.IsSimple) (h : ∀ e ∈ W.edges, e ∈ W'.edges) : W.length + ≤ W'.length := by + classical + have h₁ : W.edges.toFinset ⊆ W'.edges.toFinset := fun e he ↦ by + rw [List.mem_toFinset] at he ⊢ + exact h e he + have h₂ := Finset.card_le_card h₁ + rw [List.toFinset_card_of_nodup hW.edges_nodup] at h₂ + exact h₂.trans (List.toFinset_card_le _) + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +namespace TangleDatum + +variable {D : TangleDatum cap χ} + +/-- The drawing of a simple walk has as many edges as the walk is long. -/ +theorem ncard_walk_E (G : Drawing Shat) {u v : Shat} {W : GraphWalk G.toGraph u v} + (hW : W.IsSimple) : + (walkDrawing G W).E.ncard = W.length := by + classical + rw [walkDrawing_E] + have : {e | e ∈ W.edges} = ↑W.edges.toFinset := by + ext e + simp + rw [this, ncard_coe_finset, List.toFinset_card_of_nodup hW.edges_nodup, GraphWalk.length] + +omit [T2Space S] in +/-- A walk between two poles is at least `2 dist(Γ)` long. -/ +theorem two_dist_le (D : TangleDatum cap χ) {p₁ p₂ : Shat} (h₁ : p₁ ∈ D.rad.poles) + (h₂ : p₂ ∈ D.rad.poles) (hne : p₁ ≠ p₂) + (T : GraphWalk D.rad.G.toGraph p₁ p₂) : 2 * Painting.dist D.rad ≤ (T.length : ℕ∞) := by + classical + obtain ⟨T', hTs, -, hTe⟩ := GraphWalk.exists_isSimple T + have hl := length_le_of_edges hTs hTe + set R := walkDrawing D.rad.G T' with hR + have hRp : GM19.Drawing.IsPathOf R D.rad.G p₁ p₂ := ⟨walkDrawing_isSubdrawing _ _, + walkDrawing_isPathBetween _ hTs⟩ + have hRE : R.E.ncard = T'.length := ncard_walk_E _ hTs + have hle : Painting.dist D.rad ≤ ((R.E.ncard / 2 : ℕ) : ℕ∞) := sInf_le ⟨R, p₁, p₂, h₁, h₂, hne, + hRp, rfl⟩ + calc 2 * Painting.dist D.rad ≤ 2 * ((R.E.ncard / 2 : ℕ) : ℕ∞) := by gcongr + _ = ((2 * (R.E.ncard / 2) : ℕ) : ℕ∞) := by push_cast; rfl + _ ≤ (T.length : ℕ∞) := by + have : 2 * (R.E.ncard / 2) ≤ T.length := by omega + exact_mod_cast this + +variable (hS : IsSurface S) (h3 : D.P.Γ.IsInternallyThreeConnected) +include hS h3 + +/-- A closed walk of length at most `2n` meets one cuff at most, if `dist(Γ) > ½n + 1`. -/ +theorem labels_eq {n : ℕ} (hd : ((n + 2 : ℕ) : ℕ∞) < 2 * Painting.dist D.rad) {u : Shat} + (Z : GraphWalk D.rad.G.toGraph u u) + (hZ : Z.length ≤ 2 * n) {x y : Shat} (hx : x ∈ Z.support) (hy : y ∈ Z.support) {c d : Set S} + (hlx : cuffLabel cap x = some c) (hly : cuffLabel cap y = some d) : c = d := by + classical + have : ConnectedSpace Shat := cap.connected + by_contra hcd + obtain ⟨hc, -⟩ := cuffLabel_some hlx + obtain ⟨hd', -⟩ := cuffLabel_some hly + obtain ⟨p₁, hp₁, hm₁, hr₁⟩ := D.rad.exists_pole hc + obtain ⟨p₂, hp₂, hm₂, hr₂⟩ := D.rad.exists_pole hd' + have hpne : p₁ ≠ p₂ := by + rintro rfl + exact disjoint_left.1 (cap.cuffDisc_disjoint _ hc _ hd' hcd) (subset_closure hm₁) + (subset_closure hm₂) + obtain ⟨W, hW, -, -⟩ := exists_half_walk Z hx hy + obtain ⟨W₁, hW₁⟩ := exists_walk_to_pole hS D.rad (mem_V_of_mem_support Z hx) hlx hp₁ hr₁ h3 + obtain ⟨W₂, hW₂⟩ := exists_walk_to_pole hS D.rad (mem_V_of_mem_support Z hy) hly hp₂ hr₂ h3 + have hle := D.two_dist_le hp₁ hp₂ hpne ((W₁.append W).append W₂.reverse) + rw [GraphWalk.length_append, GraphWalk.length_append, GraphWalk.length_reverse] at hle + have hb : W₁.length + W.length + W₂.length ≤ n + 2 := by omega + have hb' : ((W₁.length + W.length + W₂.length : ℕ) : ℕ∞) ≤ ((n + 2 : ℕ) : ℕ∞) := by + exact_mod_cast hb + exact absurd (hle.trans hb') (not_le.2 hd) + +omit h3 in +omit [T2Space S] [T2Space Shat] in +omit hS in +/-- A closed walk with a label on it holds a point of that cuff. -/ +theorem exists_touch {u : Shat} (Z : GraphWalk D.rad.G.toGraph u u) (hpos : 0 < Z.length) + {y : Shat} (hy : y ∈ Z.support) {Θ : Set S} + (hl : cuffLabel cap y = some Θ) : ∃ v ∈ D.P.Γ.V, v ∈ Θ ∧ cap.emb v ∈ Z.support := by + by_cases hV : y ∈ D.P.Γ.hatV cap + · obtain ⟨v, hv, rfl⟩ := hV + exact ⟨v, hv, (mem_cuff_of_label hl).2, hy⟩ + · obtain ⟨hp, hΘ, hreg⟩ := pole_of_label D.rad ⟨mem_V_of_mem_support Z hy, hV⟩ hl + obtain ⟨W, -, hW, -⟩ := exists_half_walk Z hy hy + obtain ⟨A, B, rfl⟩ := Z.exists_append_of_mem hy + have hsupp : ∀ z, z ∈ (B.append A).support → z ∈ (A.append B).support := fun z hz ↦ by + rw [GraphWalk.mem_support_append] at hz ⊢ + exact hz.symm + have hl' : 0 < (B.append A).length := by + rw [GraphWalk.length_append] at hpos ⊢ + omega + generalize hR : B.append A = R at hl' hsupp + cases R with + | nil h' => simp [GraphWalk.length, GraphWalk.edges] at hl' + | @cons _ x _ e h' r => + obtain ⟨v, hv, rfl, hset⟩ := D.rad.link_cases h' hp.1 + refine ⟨v, hv, (D.rad.pole_edge h'.1 hp hΘ hreg hset).2, hsupp _ ?_⟩ + simp only [GraphWalk.support_cons] + exact List.mem_cons_of_mem _ r.start_mem_support + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10o.lean b/LeanPool/GraphMinor/GM19/Section10o.lean new file mode 100644 index 0000000000..4652887b8b --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10o.lean @@ -0,0 +1,355 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10n + +/-! +# Circuits with one pole inside + +What a circuit with a pole inside and no pole on it looks like, near a cuff and near a path. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +/-- A connected set that meets a closed set and its complement meets its frontier. -/ +theorem inter_frontier_of_preconnected {X : Type*} [TopologicalSpace X] {t s : Set X} + (ht : IsPreconnected t) (hs : IsClosed s) (h₁ : (t ∩ s).Nonempty) + (h₂ : (t ∩ sᶜ).Nonempty) : (t ∩ frontier s).Nonempty := by + by_contra hno + have hin : ∀ x ∈ t, x ∈ s → x ∈ interior s := fun x hx hxs ↦ by + by_contra hni + exact hno ⟨x, hx, by rw [hs.frontier_eq]; exact ⟨hxs, hni⟩⟩ + obtain ⟨a, ha, has⟩ := h₁ + obtain ⟨z, -, hz₁, hz₂⟩ := ht _ _ isOpen_interior hs.isOpen_compl (fun x hx ↦ by + by_cases hxs : x ∈ s + · exact Or.inl (hin x hx hxs) + · exact Or.inr hxs) ⟨a, ha, hin a ha has⟩ h₂ + exact hz₂ (interior_subset hz₁) + +/-- A point of a line off `u` is joined to an end of the line, off `u`. -/ +theorem line_part {S : Type} [TopologicalSpace S] {L : Set S} {a b x u : S} + (hl : IsLineWithEnds L a b) (hx : x ∈ L) (hne : x ≠ u) : + ∃ C ⊆ L \ {u}, x ∈ C ∧ IsPreconnected C ∧ (a ∈ C ∨ b ∈ C) := by + obtain ⟨f, rfl, rfl⟩ := hl + have hc : Continuous fun t ↦ (f t).1 := continuous_subtype_val.comp f.continuous + let p := f.symm ⟨x, hx⟩ + have hp : (f p).1 = x := by simp [p] + by_cases hu : u ∈ L + · let q := f.symm ⟨u, hu⟩ + have hq : (f q).1 = u := by simp [q] + have hinj : ∀ t, (f t).1 = u → t = q := fun t ht ↦ f.injective (Subtype.ext (ht.trans hq.symm)) + rcases le_total p q with hpq | hpq + · refine ⟨(fun t ↦ (f t).1) '' Iic p, ?_, ⟨p, le_rfl, hp⟩, isPreconnected_Iic.image _ + hc.continuousOn, + Or.inl ⟨0, unitInterval.nonneg _, rfl⟩⟩ + rintro _ ⟨t, ht, rfl⟩ + refine ⟨(f t).2, fun htu ↦ hne ?_⟩ + have := hinj t htu + subst this + rw [← hp, le_antisymm hpq ht] + exact hq + · refine ⟨(fun t ↦ (f t).1) '' Ici p, ?_, ⟨p, le_rfl, hp⟩, isPreconnected_Ici.image _ + hc.continuousOn, + Or.inr ⟨1, unitInterval.le_one _, rfl⟩⟩ + rintro _ ⟨t, ht, rfl⟩ + refine ⟨(f t).2, fun htu ↦ hne ?_⟩ + have := hinj t htu + subst this + rw [← hp, le_antisymm (show p ≤ _ from ht) hpq] + exact hq + · have hL : L = (fun t ↦ (f t).1) '' univ := by + ext y + constructor + · intro hy + exact ⟨f.symm ⟨y, hy⟩, trivial, by simp⟩ + · rintro ⟨t, -, rfl⟩ + exact (f t).2 + refine ⟨L, fun y hy ↦ ⟨hy, fun h ↦ hu (h ▸ hy)⟩, hx, ?_, Or.inl (f 0).2⟩ + rw [hL] + exact isPreconnected_univ.image _ hc.continuousOn + +/-- A point of an `O`-arc with two marks, off `u`, is joined to a mark, off `u`. -/ +theorem ring_part {S : Type} [TopologicalSpace S] {O V : Set S} + (hO : IsOArc O) {a b x u : S} (ha : a ∈ O ∩ V) (hb : b ∈ O ∩ V) (hab : a ≠ b) + (hx : x ∈ O) (hne : x ≠ u) : ∃ C ⊆ O \ {u}, x ∈ C ∧ IsPreconnected C ∧ (C ∩ V).Nonempty := by + by_cases hu : u ∈ O + · refine ⟨O \ {u}, Subset.rfl, ⟨hx, hne⟩, (isPathConnected_oArc_diff hO + hu).isConnected.isPreconnected, ?_⟩ + by_cases hau : a = u + · exact ⟨b, ⟨hb.1, fun h ↦ hab (hau.trans h.symm)⟩, hb.2⟩ + · exact ⟨a, ⟨ha.1, hau⟩, ha.2⟩ + · exact ⟨O, fun z hz ↦ ⟨hz, fun h ↦ hu (h ▸ hz)⟩, hx, hO.isPreconnected, ⟨a, ha⟩⟩ + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +omit [T2Space S] in +/-- A line whose ends are anchored in `K` is anchored in `K`. -/ +theorem line_anchor {V K L : Set S} {a b : S} (hl : IsLineWithEnds L a b) (hsub : L ⊆ K) + (ha : ∀ u, a ≠ u → ∃ C ⊆ K \ {u}, a ∈ C ∧ IsPreconnected C ∧ (C ∩ V).Nonempty) + (hb : ∀ u, b ≠ u → ∃ C ⊆ K \ {u}, b ∈ C ∧ IsPreconnected C ∧ (C ∩ V).Nonempty) {x u : S} + (hx : x ∈ L) (hne : x ≠ u) : + ∃ C ⊆ K \ {u}, x ∈ C ∧ IsPreconnected C ∧ (C ∩ V).Nonempty := by + obtain ⟨C, hC, hxC, hp, h⟩ := line_part hl hx hne + have key : ∀ {c : S}, c ∈ C → (c ≠ u → ∃ C ⊆ K \ {u}, c ∈ C ∧ IsPreconnected C ∧ + (C ∩ V).Nonempty) → + ∃ C ⊆ K \ {u}, x ∈ C ∧ IsPreconnected C ∧ (C ∩ V).Nonempty := by + intro c hc hend + obtain ⟨C', hC', hcC', hp', hne'⟩ := hend (hC hc).2 + refine ⟨C ∪ C', union_subset (hC.trans (sdiff_subset_sdiff_left hsub)) hC', Or.inl hxC, + hp.union c hc hcC' hp', ?_⟩ + obtain ⟨z, hz⟩ := hne' + exact ⟨z, Or.inr hz.1, hz.2⟩ + rcases h with h | h + · exact key h (ha u) + · exact key h (hb u) + +namespace TangleDatum + +variable {D : TangleDatum cap χ} + +omit [T2Space S] in +/-- An edge of `Γ*` with a point inside a short circuit, and not on the circuit, lies inside the +circuit. -/ +theorem edge_inside (D : TangleDatum cap χ) {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hlt : C.E.ncard < 2 * D.rep) {e : Set Shat} + (he : e ∈ D.rad.G.E) (heC : e ∉ C.E) (hm : (e ∩ D.ins C).Nonempty) : closure e ⊆ D.ins C := by + have hT := cap.isClosedSurface + have hi := D.ins_spec hC hlt + have hfr : frontier (D.ins C) = C.U := by + rw [IsClosedDisc.frontier_eq_discBd hT hi.2.2.1, hi.2.2.2.1] + have hconn : IsPreconnected e := he.2.2.1.isConnected.isPreconnected + refine closure_minimal (fun x hx ↦ ?_) hi.2.2.1.isClosed + by_contra hn + obtain ⟨z, hze, hzf⟩ := inter_frontier_of_preconnected hconn hi.2.2.1.isClosed hm ⟨x, hx, hn⟩ + rw [hfr] at hzf + obtain ⟨f, hf, hzf'⟩ := C.exists_edge_of_mem hzf fun h ↦ edge_notMem_V he hze (hC.1.1 h) + exact heC (D.rad.G.edge_eq_of_mem he (hC.1.2 hf) hze hzf' ▸ hf) + +omit [T2Space S] in +/-- A walk that leaves the inside of a short circuit leaves it from a vertex of the circuit. -/ +theorem exit_mem (D : TangleDatum cap χ) {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hlt : C.E.ncard < 2 * D.rep) {e : Set Shat} {a y : Shat} + (hl : D.rad.G.toGraph.IsLink e a y) (ha : a ∈ D.ins C) (hy : y ∉ D.ins C) : a ∈ C.V := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hi := D.ins_spec hC hlt + have hfr : frontier (D.ins C) = C.U := by + rw [IsClosedDisc.frontier_eq_discBd hT hi.2.2.1, hi.2.2.2.1] + have hset : closure e ∩ D.rad.G.V = {a, y} := hl.2.2.2 + have hac : a ∈ closure e := (hset ▸ mem_insert a {y} : a ∈ closure e ∩ D.rad.G.V).1 + have hyc : y ∈ closure e := (hset ▸ mem_insert_of_mem a rfl : y ∈ closure e ∩ D.rad.G.V).1 + by_cases heC : e ∈ C.E + · exact mem_V_of_mem_U hC.1 (C.closure_subset_U heC hac) hl.2.1 + · have hdis : e ∩ D.ins C = ∅ := by + by_contra hne + exact hy (D.edge_inside hC hlt hl.1 heC (nonempty_iff_ne_empty.2 hne) hyc) + have hsub : e ⊆ (D.ins C)ᶜ := fun x hx hxi => + eq_empty_iff_forall_notMem.mp hdis x ⟨hx, hxi⟩ + have hcl : a ∈ closure (D.ins C)ᶜ := closure_mono hsub hac + have : a ∈ frontier (D.ins C) := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure ha, hcl⟩ + rw [hfr] at this + exact mem_V_of_mem_U hC.1 this hl.2.1 + +omit [T2Space S] in +/-- A simple walk with only its first vertex inside a short circuit has only that point inside. -/ +theorem walk_inter_ins (D : TangleDatum cap χ) {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hlt : C.E.ncard < 2 * D.rep) {a b c : Shat} + {W : GraphWalk D.rad.G.toGraph a b} (hW : W.IsSimple) (h : ∀ x ∈ W.support, x ∈ D.ins C → x + = c) {x : Shat} (hx : x ∈ (walkDrawing D.rad.G W).U) + (hxi : x ∈ D.ins C) : x = c := by + have : ConnectedSpace Shat := cap.connected + have hsub := walkDrawing_isSubdrawing D.rad.G W + by_cases hxV : x ∈ (walkDrawing D.rad.G W).V + · rw [walkDrawing_V] at hxV + exact h x hxV hxi + · exfalso + obtain ⟨f, hf, hxf⟩ := (walkDrawing D.rad.G W).exists_edge_of_mem hx hxV + have hf' : f ∈ W.edges := by + rw [walkDrawing_E] at hf + exact hf + by_cases hfC : f ∈ C.E + · exact edge_off hW h hf' ((C.closure_subset_U hfC).trans (D.U_subset_ins hC hlt)) + · exact edge_off hW h hf' (D.edge_inside hC hlt (hsub.2 hf) hfC ⟨x, hxf, hxi⟩) + +variable (hS : IsSurface S) +include hS + +omit hS in +omit [T2Space S] in +/-- A cuff disc with its pole outside a circuit in `Σ` misses the inside of the circuit. -/ +theorem cuffDisc_disjoint_ins (D : TangleDatum cap χ) {C : Drawing Shat} + (hC : C.IsCircuitOf D.rad.G) (hlt : C.E.ncard < 2 * D.rep) + (hr : C.U ⊆ range cap.emb) {p : Shat} (hp : p ∈ D.rad.poles) {Θ : Set S} (hΘ : Θ ∈ cuffs S) + (hreg : D.rad.regionOf p = cap.cuffDisc Θ) + (hpi : p ∉ D.ins C) : Disjoint (cap.cuffDisc Θ) (D.ins C) := by + have hT := cap.isClosedSurface + have hi := D.ins_spec hC hlt + have hfr : frontier (D.ins C) = C.U := by + rw [IsClosedDisc.frontier_eq_discBd hT hi.2.2.1, hi.2.2.2.1] + have hconn : IsPreconnected (cap.cuffDisc Θ) := hreg ▸ isPreconnected_connectedComponentIn + have hpd := (D.rad.regionOf_mem hp.1).2 + rw [hreg] at hpd + refine disjoint_left.2 fun x hx hxi ↦ ?_ + obtain ⟨z, hz, hzf⟩ := inter_frontier_of_preconnected hconn hi.2.2.1.isClosed ⟨x, hx, hxi⟩ ⟨p, + hpd, hpi⟩ + rw [hfr] at hzf + exact cap.notMem_range hΘ hz (hr hzf) + +omit hS in +omit [T2Space S] in +/-- A point of a cuff inside a circuit in `Σ`, with the pole of that cuff outside, lies on the +circuit. -/ +theorem cuff_inter_ins (D : TangleDatum cap χ) {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hlt : C.E.ncard < 2 * D.rep) + (hr : C.U ⊆ range cap.emb) {p : Shat} (hp : p ∈ D.rad.poles) {Θ : Set S} (hΘ : Θ ∈ cuffs S) + (hreg : D.rad.regionOf p = cap.cuffDisc Θ) + (hpi : p ∉ D.ins C) {x : Shat} (hx : x ∈ closure (cap.cuffDisc Θ)) + (hxi : x ∈ D.ins C) : x ∈ C.U := by + have hT := cap.isClosedSurface + have hi := D.ins_spec hC hlt + have hfr : frontier (D.ins C) = C.U := by + rw [IsClosedDisc.frontier_eq_discBd hT hi.2.2.1, hi.2.2.2.1] + rw [← hfr, frontier_eq_closure_inter_closure] + refine ⟨subset_closure hxi, closure_mono (fun y hy ↦ ?_) hx⟩ + exact disjoint_left.1 (D.cuffDisc_disjoint_ins hC hlt hr hp hΘ hreg hpi) hy + +variable (h3 : D.P.Γ.IsInternallyThreeConnected) +include h3 + +omit hS h3 in +omit [T2Space S] in +/-- A path through a pole off `F`, between two vertices of `F` on the cuff of that pole. -/ +theorem exists_theta_pole {F : Drawing Shat} (hF : F.IsCircuitOf D.rad.G) {p : Shat} + (hp : p ∈ D.rad.poles) (hpF : p ∉ F.V) {v₁ v₂ : S} (hv₁ : v₁ ∈ D.P.Γ.V) + (hv₂ : v₂ ∈ D.P.Γ.V) (hne : v₁ ≠ v₂) (hF₁ : cap.emb v₁ ∈ F.V) (hF₂ : cap.emb v₂ ∈ F.V) {e₁ e₂ : + Set Shat} (he₁ : e₁ ∈ D.rad.G.E) (he₂ : e₂ ∈ D.rad.G.E) + (hs₁ : closure e₁ ∩ D.rad.G.V = {cap.emb v₁, p}) (hs₂ : closure e₂ ∩ D.rad.G.V + = {cap.emb v₂, p}) : + ∃ A B Q, TwoPaths D.rad.G F A B Q (cap.emb v₁) (cap.emb v₂) ∧ p ∈ Q.V ∧ Q.E.ncard ≤ A.E.ncard + ∧ Q.E.ncard ≤ B.E.ncard ∧ + Q.U ⊆ closure e₁ ∪ closure e₂ := by + classical + have : ConnectedSpace Shat := cap.connected + set G := D.rad.G with hG + have hvG : ∀ {v}, v ∈ D.P.Γ.V → cap.emb v ∈ G.V := fun hv ↦ D.rad.isPreRadial.2.1 + (mem_image_of_mem _ hv) + have hpG : p ∈ G.V := hp.1.1 + have hvp : ∀ {v}, v ∈ D.P.Γ.V → cap.emb v ≠ p := fun hv h ↦ hp.1.2 (h ▸ mem_image_of_mem _ hv) + have hvne : cap.emb v₁ ≠ cap.emb v₂ := fun h ↦ hne (cap.isEmbedding.injective h) + have hl₁ : G.toGraph.IsLink e₁ (cap.emb v₁) p := ⟨he₁, hvG hv₁, hpG, hs₁⟩ + have hl₂ : G.toGraph.IsLink e₂ p (cap.emb v₂) := ⟨he₂, hpG, hvG hv₂, by rw [hs₂, pair_comm]⟩ + have hclo : ∀ f ∈ F.E, p ∉ closure f := fun f hf hc ↦ hpF (mem_V_of_mem_U hF.1 + (F.closure_subset_U hf hc) hpG) + have hn₁ : e₁ ∉ F.E := fun h ↦ hclo e₁ h (by + have : p ∈ closure e₁ ∩ D.rad.G.V := by rw [hs₁]; exact Or.inr rfl + exact this.1) + have hn₂ : e₂ ∉ F.E := fun h ↦ hclo e₂ h (by + have : p ∈ closure e₂ ∩ D.rad.G.V := by rw [hs₂]; exact Or.inr rfl + exact this.1) + have hene : e₁ ≠ e₂ := by + rintro rfl + have hm : cap.emb v₂ ∈ ({cap.emb v₁, p} : Set Shat) := hs₁ ▸ hs₂ ▸ Or.inl rfl + rcases hm with h | h + · exact hvne h.symm + · exact hvp hv₂ h + obtain ⟨A, B, hA, hB, hAs, hBs, -, -, hAB, hd, hsup⟩ := hF.2.exists_two_paths hF₁ hF₂ hvne + obtain ⟨Q, hQs, hQpath, hQV, hQE, hQU⟩ := + exists_two_edge_drawing_path hl₁ hl₂ (hvp hv₁) hvne (hvp hv₂).symm + have ht : TwoPaths G F A B Q (cap.emb v₁) (cap.emb v₂) := by + refine ⟨hvne, hF.1, ⟨hAs, hA⟩, ⟨hBs, hB⟩, ?_, ?_, hAB.le, hd, + ⟨hQs, hQpath⟩, ?_, ?_⟩ + · conv_lhs => rw [← hsup, Drawing.sup_V hAs hBs] + · conv_lhs => rw [← hsup, Drawing.sup_E hAs hBs] + · rw [hQV] + rintro x ⟨rfl | rfl | rfl, hx⟩ + · exact Or.inl rfl + · exact absurd hx hpF + · exact Or.inr rfl + · rw [hQE] + refine disjoint_left.mpr ?_ + rintro _ (rfl | rfl) h + · exact hn₁ h + · exact hn₂ h + have side : ∀ {X : Drawing Shat}, X.IsPathBetween (cap.emb v₁) (cap.emb v₂) → X.IsSubdrawing F → + Q.E.ncard ≤ X.E.ncard := by + intro X hX hXs + obtain ⟨f, hf, x, hl, -, hsec⟩ := path_first hX hvne + have hlG := ((hXs.trans hF.1).isLink_iff hf).mp hl + obtain ⟨hxR, -⟩ := D.rad.link_cases' hlG hv₁ + obtain ⟨f', hf', hff, -⟩ := hsec fun h ↦ hxR.2 (h ▸ mem_image_of_mem _ hv₂) + have hsub : ({f, f'} : Set (Set Shat)) ⊆ X.E := by + rintro _ (rfl | rfl) + · exact hf + · exact hf' + exact ncard_edges_le_of_pair_subset hQE hene hff.symm hsub + exact ⟨A, B, Q, ht, by rw [hQV]; simp, side hA hAs, side hB hBs, hQU.subset⟩ + +/-- No short circuit has a pole inside it and two vertices on the cuff of a pole outside it, if no +short circuit has two poles inside. -/ +theorem no_double_touch {n : ℕ} (hn : n < D.rep) (hNP : ¬ ∃ C, D.IsPairCircuit n C) {C : Drawing + Shat} (hC : C.IsCircuitOf D.rad.G) (hc : C.E.ncard ≤ 2 * n) + {r p : Shat} (hr : r ∈ D.rad.poles) (hri : r ∈ D.ins C) (hp : p ∈ D.rad.poles) (hrp : r ≠ p) + (hpC : p ∉ C.V) {Θ : Set S} (hΘ : Θ ∈ cuffs S) + (hreg : D.rad.regionOf p = cap.cuffDisc Θ) {v₁ v₂ : S} (hv₁ : v₁ ∈ D.P.Γ.V) + (hv₂ : v₂ ∈ D.P.Γ.V) (hne : v₁ ≠ v₂) (h₁ : v₁ ∈ Θ) (h₂ : v₂ ∈ Θ) + (hF₁ : cap.emb v₁ ∈ C.V) (hF₂ : cap.emb v₂ ∈ C.V) : False := by + have : ConnectedSpace Shat := cap.connected + have hrep : 1 ≤ D.rep := by omega + obtain ⟨e₁, he₁, hs₁⟩ := D.rad.exists_pole_edge hS h3 hp hΘ hreg hv₁ h₁ + obtain ⟨e₂, he₂, hs₂⟩ := D.rad.exists_pole_edge hS h3 hp hΘ hreg hv₂ h₂ + obtain ⟨A, B, Q, ht, hpQ, c₁, c₂, -⟩ := exists_theta_pole hC hp hpC hv₁ hv₂ hne hF₁ hF₂ he₁ he₂ + hs₁ hs₂ + have hl₂ := improve_card ht c₁ + have hl₁ := improve_card ht.swap c₂ + have hC₂ : Drawing.IsCircuitOf (D.rad.G.sup Q B) D.rad.G := ⟨D.rad.G.sup_isSubdrawing Q B, + ht.left_circuit⟩ + have hC₁ : Drawing.IsCircuitOf (D.rad.G.sup Q A) D.rad.G := ⟨D.rad.G.sup_isSubdrawing Q A, + ht.swap.left_circuit⟩ + have key : ∀ {X : Drawing Shat}, X.IsCircuitOf D.rad.G → X.E.ncard ≤ C.E.ncard → Q.U ⊆ X.U + → r ∈ D.ins X → False := by + intro X hX hl hQX hrX + have hlt : X.E.ncard < 2 * D.rep := by omega + exact hNP ⟨X, hX, by omega, r, hr, p, hp, hrp, hrX, D.U_subset_ins hX hlt (hQX + (Q.V_subset_U hpQ))⟩ + rcases ins_theta hrep ht hC (by omega) (by omega) (by omega) hri with h | h + · exact key hC₁ hl₁ (by rw [ht.swap.U_right]; exact subset_union_left) h + · exact key hC₂ hl₂ (by rw [ht.U_right]; exact subset_union_left) h + +omit [T2Space S] in +/-- A circuit in `Σ` with at most one point on the boundary and with a pole inside holds two +vertices of `Γ`. -/ +theorem ring_marks [Nonempty S] {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hlt : C.E.ncard < 2 * D.rep) + (hnp : ∀ z ∈ C.V, z ∉ D.rad.poles) (hone : ∀ {x y : S}, x ∈ bd S → y ∈ bd S → cap.emb x ∈ C.U + → cap.emb y ∈ C.U → x = y) {r : Shat} (hr : r ∈ D.rad.poles) + (hri : r ∈ D.ins C) : IsOArc (cap.emb ⁻¹' C.U) ∧ ∃ a b, a ≠ b ∧ a ∈ cap.emb ⁻¹' C.U ∩ D.P.Γ.V + ∧ b ∈ cap.emb ⁻¹' C.U ∩ D.P.Γ.V := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨K, h₁, hKU, hO, hsing⟩ := ring_of_circuit hS D.rad D.P.fits hC.1 hC.2 hnp hone + have hKU' : cap.emb ⁻¹' C.U = K.U := by rw [hKU, preimage_image_eq _ cap.isEmbedding.injective] + obtain ⟨a, ha, b, hb, hab⟩ := two_vertices_of_ring (D := D) h3 hO h₁.inter hsing fun Δ d₁ d₂ d₃ + d₄ ↦ + D.no_empty_disc hC hlt hr hri d₁ d₂ (d₃.trans hKU.symm) (by rwa [hKU]) + rw [hKU'] + exact ⟨hO, a, b, hab, ha, hb⟩ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10p.lean b/LeanPool/GraphMinor/GM19/Section10p.lean new file mode 100644 index 0000000000..673f7a7bd8 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10p.lean @@ -0,0 +1,354 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10o + +/-! +# The second bullet of the distance flaw + +A short circuit with one pole inside, and a line from it to the cuff of another pole. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +/-- The first step of a walk between two distinct vertices. -/ +theorem walk_first_step {α β : Type*} {G : Graph α β} {a b : α} (W : GraphWalk G a b) + (hW : W.IsSimple) (hab : a ≠ b) : + ∃ e y, G.IsLink e a y ∧ y ∈ W.support ∧ y ≠ a := by + cases W with + | nil h => exact absurd rfl hab + | @cons _ x _ e h r => + have hsim : (GraphWalk.cons h r).support.Nodup := hW + simp only [GraphWalk.support_cons, List.nodup_cons] at hsim + refine ⟨e, x, h, by simp [GraphWalk.support_cons, r.start_mem_support], + fun hx ↦ hsim.1 (hx ▸ r.start_mem_support)⟩ + +/-- The number of vertices of a walk. -/ +theorem ncard_walk_V {T : Type} [TopologicalSpace T] [T2Space T] (G : Drawing T) {u v : T} + (W : GraphWalk G.toGraph u v) : + (walkDrawing G W).V.ncard ≤ W.length + 1 := by + classical + rw [walkDrawing_V] + have : {x | x ∈ W.support} = ↑W.support.toFinset := by + ext x + simp + rw [this, ncard_coe_finset] + exact (List.toFinset_card_le _).trans (length_support W).le + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +namespace TangleDatum + +variable {D : TangleDatum cap χ} + +variable (hS : IsSurface S) (h3 : D.P.Γ.IsInternallyThreeConnected) +include hS h3 + +/-- **The second shape**, from a drawing `P` of the circuit and the line. -/ +theorem outer_of_line [Nonempty S] {n : ℕ} (_hn₁ : 1 ≤ n) (hn : n < D.rep) {C : Drawing Shat} + (hC : C.IsCircuitOf D.rad.G) (hc : C.E.ncard ≤ 2 * n) + (hlink : GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins C)) + (partIn cap D.P.Γ (closure (D.ins C)ᶜ))) + {r p : Shat} (hr : r ∈ D.rad.poles) (hri : r ∈ D.ins C) (hp : p ∈ D.rad.poles) (hrp : r ≠ p) + (hpi : p ∉ D.ins C) (hrange : C.U ⊆ range cap.emb) + {Θ : Set S} (hΘ : Θ ∈ cuffs S) (hreg : D.rad.regionOf p = cap.cuffDisc Θ) + (hO : IsOArc (cap.emb ⁻¹' C.U)) {a b : S} (hab : a ≠ b) (ha : a ∈ cap.emb ⁻¹' C.U ∩ D.P.Γ.V) + (hb : b ∈ cap.emb ⁻¹' C.U ∩ D.P.Γ.V) + {L : Set S} {s u : S} (hL : (L = {u} ∧ s = u) ∨ IsLineWithEnds L s u) {P : Drawing Shat} + (hPs : P.IsSubdrawing D.rad.G) (hPr : P.U ⊆ range cap.emb) + (hPi : ∀ v ∈ P.V, ∃ e ∈ P.E, v ∈ closure e) (hPU : P.U = C.U ∪ cap.emb '' L) + (hLi : cap.emb '' L ∩ D.ins C = {cap.emb u}) + (hLbd : L ∩ bd S ⊆ {s}) (hCbd : C.U ∩ cap.emb '' bd S ⊆ {cap.emb u}) + (hsize : P.V.ncard + P.E.ncard ≤ 8 * n) (huC : cap.emb u ∈ C.U) (hsΘ : s ∈ Θ) + (hsV : s ∈ D.P.Γ.V) : ∃ 𝓓 K, IsOuterData D n 𝓓 K := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hj := cap.isClosedEmbedding hS + have hlt : C.E.ncard < 2 * D.rep := by omega + have hi := D.ins_spec hC hlt + have hbd : discBd (D.ins C) = C.U := hi.2.2.2.1 + have hfr : frontier (D.ins C) = C.U := by rw [IsClosedDisc.frontier_eq_discBd hT hi.2.2.1, hbd] + obtain ⟨hinter, hfeat, hlines, hcV, hcE⟩ := comap_facts D.rad D.P.fits hPs hPr hj hPi + set K : Drawing S := GM19.Drawing.comap P hj hPr with hKdef + have hKU : cap.emb '' K.U = P.U := image_preimage_eq_of_subset hPr + have hmemK : ∀ {x}, x ∈ K.U ↔ cap.emb x ∈ C.U ∨ x ∈ L := fun {x} ↦ by + change cap.emb x ∈ P.U ↔ _ + rw [hPU] + refine or_congr Iff.rfl ⟨?_, mem_image_of_mem _⟩ + rintro ⟨y, hy, hxy⟩ + exact cap.isEmbedding.injective hxy ▸ hy + obtain ⟨Θ', hΘ', hreg', hrd⟩ := D.rad.pole_cases hr + have hΘne : Θ ≠ Θ' := by + rintro rfl + obtain ⟨-, -, hG3, -⟩ := id D.rad.isPreRadial + have m₁ := D.rad.regionOf_mem hr.1 + have m₂ := D.rad.regionOf_mem hp.1 + exact hrp ((hG3 _ m₁.1).unique ⟨m₁.2, hr.1.1⟩ ⟨(hreg'.trans hreg.symm) ▸ m₂.2, hp.1.1⟩) + have huL : u ∈ L := by + rcases hL with ⟨rfl, -⟩ | hl + · rfl + · exact GM11.IsLineWithEnds.right_mem hl + have hring : ∀ {x w : S}, cap.emb x ∈ C.U → x ≠ w → ∃ E ⊆ K.U \ {w}, x ∈ E ∧ IsPreconnected E ∧ + (E ∩ D.P.Γ.V).Nonempty := fun {x w} hx hne ↦ by + obtain ⟨E, hE, hxE, hconn, hm⟩ := ring_part hO ha hb hab hx hne + exact ⟨E, hE.trans (sdiff_subset_sdiff_left fun z hz ↦ hmemK.2 (Or.inl hz)), hxE, hconn, hm⟩ + refine ⟨{D.ins C}, K, Or.inr (Or.inl ⟨D.ins C, L, s, u, Θ, Θ', rfl, hi.2.2.1, + hbd.trans_subset hrange, hΘ, hΘ', hΘne, hsΘ, hL, ?_, hLi, hLbd, ?_, ?_, ⟨r, hrd, hri⟩⟩), + finite_singleton _, by simp, ?_, hfeat, hinter, hlines, ?_, ?_, ?_, ?_, ?_⟩ + · rw [hKU, hPU, hbd] + · rwa [hbd] + · exact D.cuffDisc_disjoint_ins hC hlt hrange hp hΘ hreg hpi + · refine family_of_discs (finite_singleton _) (by rintro _ rfl; exact hlink) ?_ ?_ + · rintro _ rfl + have := disc_order hS h3 D.rad hC hi.2.2.1 hbd + omega + · rintro _ rfl _ rfl h + exact (h rfl).elim + · rw [hcV, hcE] + exact hsize + · rcases hL with ⟨rfl, -⟩ | hl + · refine ⟨{cap.emb ⁻¹' C.U}, ∅, finite_singleton _, finite_empty, by rintro _ rfl; exact hO, by + simp, ?_⟩ + ext x + rw [hmemK] + simp only [sUnion_singleton, sUnion_empty, union_empty, mem_preimage] + refine ⟨?_, Or.inl⟩ + rintro (h | h) + · exact h + · rw [mem_singleton_iff.1 h] + exact huC + · refine ⟨{cap.emb ⁻¹' C.U}, {L}, finite_singleton _, finite_singleton _, ?_, ?_, ?_⟩ + · rintro _ rfl + exact hO + · rintro _ rfl + refine ⟨s, u, ?_, hl, Or.inl (cuff_subset_bd ⟨Θ, hΘ⟩ hsΘ), Or.inr ?_⟩ + · intro h + obtain ⟨f, h₀, h₁⟩ := hl + have := f.injective (Subtype.ext (h₀.trans (h.trans h₁.symm))) + exact zero_ne_one this + · simpa using huC + · ext x + rw [hmemK] + simp + · rintro _ rfl v hv h₁ h₂ + have : cap.emb v ∈ frontier (D.ins C) := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure h₁, h₂⟩ + rw [hfr] at this + exact hmemK.2 (Or.inl this) + · rintro v hv _ rfl + rcases hmemK.1 hv with h | h + · have : cap.emb v ∈ frontier (D.ins C) := hfr ▸ h + rw [frontier_eq_closure_inter_closure] at this + exact this.2 + · by_cases hvi : cap.emb v ∈ D.ins C + · have hvu : cap.emb v ∈ cap.emb '' L ∩ D.ins C := ⟨mem_image_of_mem _ h, hvi⟩ + rw [hLi] at hvu + rw [mem_singleton_iff.1 hvu] + have : cap.emb u ∈ frontier (D.ins C) := hfr ▸ huC + rw [frontier_eq_closure_inter_closure] at this + exact this.2 + · exact subset_closure hvi + · intro w x hx hne + rcases hmemK.1 hx with h | h + · exact hring h hne + · rcases hL with ⟨rfl, -⟩ | hl + · exact hring (by rw [mem_singleton_iff.1 h]; exact huC) hne + · refine line_anchor hl (fun z hz ↦ hmemK.2 (Or.inr hz)) (fun w' hne' ↦ ?_) + (fun w' hne' ↦ hring huC hne') h hne + refine ⟨{s}, ?_, rfl, isPreconnected_singleton, ⟨s, rfl, hsV⟩⟩ + rintro _ rfl + exact ⟨hmemK.2 (Or.inr (GM11.IsLineWithEnds.left_mem hl)), hne'⟩ + +/-- **The second shape.** A short circuit in `Σ` with a pole `r` inside, on a short closed walk that +meets the cuff of a pole `p ≠ r`. -/ +theorem outer_of_disc_point [Nonempty S] {n : ℕ} (hn₁ : 1 ≤ n) (hn : n < D.rep) (hd : + ((n + 2 : ℕ) : ℕ∞) < 2 * Painting.dist D.rad) + (hNP : ¬ ∃ C, D.IsPairCircuit n C) {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hc : C.E.ncard ≤ 2 * n) + (hlink : GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins C)) + (partIn cap D.P.Γ (closure (D.ins C)ᶜ))) + {r p : Shat} (hr : r ∈ D.rad.poles) (hri : r ∈ D.ins C) (hnp : ∀ z ∈ C.V, z ∉ D.rad.poles) + (hp : p ∈ D.rad.poles) (hrp : r ≠ p) + {Θ : Set S} (hΘ : Θ ∈ cuffs S) (hreg : D.rad.regionOf p = cap.cuffDisc Θ) {u₀ : Shat} + (Z : GraphWalk D.rad.G.toGraph u₀ u₀) (hZ : Z.length ≤ 2 * n) + (hZC : ∀ x ∈ C.V, x ∈ Z.support) {s₀ : S} (hs₀ : s₀ ∈ Θ) (hs₀Z : cap.emb s₀ ∈ Z.support) : ∃ 𝓓 + K, IsOuterData D n 𝓓 K := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hj := cap.isClosedEmbedding hS + have hlt : C.E.ncard < 2 * D.rep := by omega + have hpi : p ∉ D.ins C := fun h ↦ hNP ⟨C, hC, hc, r, hr, p, hp, hrp, hri, h⟩ + have hrange : C.U ⊆ range cap.emb := subset_range_of_no_pole D.rad hC.1 hnp + have hpC : p ∉ C.V := fun h ↦ hnp p h hp + have hl₀ : cuffLabel cap (cap.emb s₀) = some Θ := cuffLabel_emb hΘ hs₀ + have hsame : ∀ {x : Shat} {Θ' : Set S}, x ∈ Z.support → cuffLabel cap x = some Θ' → Θ' = Θ + := fun hx hl ↦ + labels_eq hS h3 hd Z hZ hx hs₀Z hl hl₀ + have hbdC : ∀ {v : S}, v ∈ bd S → cap.emb v ∈ C.U → v ∈ D.P.Γ.V ∧ cap.emb v ∈ C.V ∧ v ∈ Θ + := fun {v} hv hvC ↦ by + obtain ⟨h₁, h₂, Θ', hΘ', hvΘ⟩ := D.rad.bd_point hC.1 hv hvC + have := hsame (hZC _ h₂) (cuffLabel_emb hΘ' hvΘ) + exact ⟨h₁, h₂, this ▸ hvΘ⟩ + have hone : ∀ {x y : S}, x ∈ bd S → y ∈ bd S → cap.emb x ∈ C.U → cap.emb y ∈ C.U → x = y + := fun {x y} hx hy hxC hyC ↦ by + by_contra hne + obtain ⟨h₁, h₂, h₃⟩ := hbdC hx hxC + obtain ⟨h₄, h₅, h₆⟩ := hbdC hy hyC + exact no_double_touch hS h3 hn hNP hC hc hr hri hp hrp hpC hΘ hreg h₁ h₄ hne h₃ h₆ h₂ h₅ + obtain ⟨hO, a, b, hab, ha, hb⟩ := ring_marks hS h3 hC hlt hnp hone hr hri + by_cases htouch : ∃ v, v ∈ Θ ∧ cap.emb v ∈ C.U + · obtain ⟨v, hvΘ, hvC⟩ := htouch + have hvb : v ∈ bd S := cuff_subset_bd ⟨Θ, hΘ⟩ hvΘ + refine outer_of_line hS h3 hn₁ hn hC hc hlink hr hri hp hrp hpi hrange hΘ hreg hO hab ha hb (L + := {v}) (s := v) (u := v) (Or.inl ⟨rfl, rfl⟩) hC.1 hrange + (circuit_iso hC.2) ?_ ?_ ?_ ?_ ?_ hvC hvΘ (hbdC hvb hvC).1 + · rw [image_singleton, union_singleton, insert_eq_of_mem hvC] + · rw [image_singleton] + exact inter_eq_left.2 (singleton_subset_iff.2 (D.U_subset_ins hC hlt hvC)) + · exact inter_subset_left + · rintro _ ⟨hx, w, hw, rfl⟩ + rw [hone hw hvb hx hvC] + rfl + · have := IsCircuit.ncard_V hC.2 + omega + · push Not at htouch + have hno : ∀ y, y ∈ closure (cap.cuffDisc Θ) → y ∉ D.ins C := fun y hy hyi ↦ by + have hyC := D.cuff_inter_ins hC hlt hrange hp hΘ hreg hpi hy hyi + rw [cap.closure_cuffDisc hΘ] at hy + rcases hy with hy | ⟨w, hw, rfl⟩ + · exact cap.notMem_range hΘ hy (hrange hyC) + · exact htouch w hw hyC + have haV : cap.emb a ∈ C.V := mem_V_of_mem_U hC.1 ha.1 (D.rad.isPreRadial.2.1 + (mem_image_of_mem _ ha.2)) + obtain ⟨W, hWl, hWs, hWe⟩ := exists_half_walk Z (hZC _ haV) hs₀Z + obtain ⟨a', ha', b', hb', T', hT'e, hT's, hA, hB⟩ := exists_crossing + (D.ins C) {y | cuffLabel cap y = some Θ} W (D.U_subset_ins hC hlt ha.1) hl₀ + obtain ⟨R, hRs, hRsupp, hRe⟩ := GraphWalk.exists_isSimple T' + have hne : a' ≠ b' := by + rintro rfl + exact hno a' (cuffLabel_some hb').2 ha' + have hRin : ∀ x ∈ R.support, x ∈ Z.support := fun x hx ↦ hWs x (hT's x (hRsupp x hx)) + have hRA : ∀ x ∈ R.support, x ∈ D.ins C → x = a' := fun x hx ↦ hA x (hRsupp x hx) + have hRB : ∀ x ∈ R.support, cuffLabel cap x = some Θ → x = b' := fun x hx ↦ hB x (hRsupp x hx) + have ha'C : a' ∈ C.V := by + obtain ⟨e, y, hl, hy, hya⟩ := walk_first_step R hRs hne + exact D.exit_mem hC hlt hl ha' fun h ↦ hya (hRA y hy h) + have hb'np : b' ∉ D.rad.poles := by + intro hb'p + obtain ⟨e, y, hl, hy, hya⟩ := walk_first_step R.reverse (by + unfold GraphWalk.IsSimple + rw [GraphWalk.support_reverse] + exact List.nodup_reverse.2 hRs) hne.symm + rw [GraphWalk.support_reverse] at hy + have hy' : y ∈ R.support := List.mem_reverse.1 hy + obtain ⟨v, hv, rfl, hset⟩ := D.rad.link_cases hl hb'p.1 + obtain ⟨-, hΘ₁, hreg₁⟩ := pole_of_label D.rad hb'p.1 hb' + have hvΘ := (D.rad.pole_edge hl.1 hb'p hΘ hreg₁ hset).2 + exact hya (hRB _ hy' (cuffLabel_emb hΘ hvΘ)) + have hRnp : ∀ y ∈ R.support, y ∉ D.rad.poles := fun y hy hyp ↦ by + obtain ⟨Θ', hΘ', -, hyd⟩ := D.rad.pole_cases hyp + have hly := cuffLabel_eq hΘ' (subset_closure hyd) + have := hsame (hRin y hy) hly + subst this + exact hb'np (hRB y hy hly ▸ hyp) + have hb'V : b' ∈ D.rad.G.V := mem_V_of_mem_support R R.end_mem_support + have hb'hat : b' ∈ D.P.Γ.hatV cap := by + by_contra hn' + exact hb'np (pole_of_label D.rad ⟨hb'V, hn'⟩ hb').1 + obtain ⟨s, hsV, rfl⟩ := hb'hat + have hsΘ := (mem_cuff_of_label hb').2 + obtain ⟨u, rfl⟩ := hrange (C.V_subset_U ha'C) + set Q := walkDrawing D.rad.G R with hQ + have hQs : Q.IsSubdrawing D.rad.G := walkDrawing_isSubdrawing _ _ + have hQnp : ∀ z ∈ Q.V, z ∉ D.rad.poles := fun z hz ↦ hRnp z (by rwa [hQ, walkDrawing_V] at hz) + have hQr : Q.U ⊆ range cap.emb := subset_range_of_no_pole D.rad hQs hQnp + have hQL : cap.emb '' (cap.emb ⁻¹' Q.U) = Q.U := image_preimage_eq_of_subset hQr + have hQset : Q.U = {x | x ∈ R.support} ∪ ⋃ e ∈ {e | e ∈ R.edges}, closure e := by + ext x + rw [hQ, mem_walkDrawing_U] + simp + have hline : IsLineWithEnds (cap.emb '' (cap.emb ⁻¹' Q.U)) (cap.emb s) (cap.emb u) := by + rw [hQL, hQset] + exact GM11.IsLineWithEnds.symm (walk_isLine D.rad.G R hRs hne) + have hline' := isLine_comap hj hline + have hPV : (D.rad.G.sup C Q).V = C.V ∪ Q.V := Drawing.sup_V hC.1 hQs + have hPE : (D.rad.G.sup C Q).E = C.E ∪ Q.E := Drawing.sup_E hC.1 hQs + have hPU : (D.rad.G.sup C Q).U = C.U ∪ Q.U := U_union hPV hPE + have hQmem : ∀ {x}, x ∈ R.support → x ∈ Q.V := fun {x} hx ↦ by + rw [hQ, walkDrawing_V] + exact hx + have hRlen : 0 < R.length := by + obtain ⟨e, y, hl, hy, hya⟩ := walk_first_step R hRs hne + rcases Nat.eq_zero_or_pos R.length with h0 | h0 + · have h₁ := length_support R + rw [h0] at h₁ + have h₂ := R.start_mem_support + have h₃ := R.end_mem_support + rcases hsu : R.support with _ | ⟨z, _ | ⟨z', l⟩⟩ + · simp [hsu] at h₁ + · rw [hsu] at h₂ h₃ + simp only [List.mem_singleton] at h₂ h₃ + exact absurd (h₂.trans h₃.symm) hne + · simp [hsu] at h₁ + · exact h0 + have hlenW : R.length ≤ W.length := length_le_of_edges hRs fun e he ↦ hT'e.subset (hRe e he) + refine outer_of_line hS h3 hn₁ hn hC hc hlink hr hri hp hrp hpi hrange hΘ hreg hO hab ha hb (L + := cap.emb ⁻¹' Q.U) (s := s) (u := u) (Or.inr hline') + (D.rad.G.sup_isSubdrawing C Q) ?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_ hsΘ hsV + · rw [hPU] + exact union_subset hrange hQr + · intro v hv + rw [hPV] at hv + rcases hv with hv | hv + · obtain ⟨e, he, hve⟩ := circuit_iso hC.2 v hv + exact ⟨e, by rw [hPE]; exact Or.inl he, hve⟩ + · obtain ⟨e, he, hve⟩ := exists_edge_at R hRlen (by rwa [hQ, walkDrawing_V] at hv) + exact ⟨e, by rw [hPE]; exact Or.inr (by rw [hQ, walkDrawing_E]; exact he), hve⟩ + · rw [hPU, hQL] + · rw [hQL] + refine Subset.antisymm (fun x hx ↦ ?_) ?_ + · exact D.walk_inter_ins hC hlt hRs hRA hx.1 hx.2 + · rintro _ rfl + exact ⟨Q.V_subset_U (hQmem R.start_mem_support), ha'⟩ + · rintro x ⟨hxQ, hxb⟩ + obtain ⟨h₁, h₂, Θ', hΘ', hxΘ⟩ := D.rad.bd_point hQs hxb hxQ + have hxs : cap.emb x ∈ R.support := by rwa [hQ, walkDrawing_V] at h₂ + have hl : cuffLabel cap (cap.emb x) = some Θ' := cuffLabel_emb hΘ' hxΘ + have := hsame (hRin _ hxs) hl + subst this + exact cap.isEmbedding.injective (hRB _ hxs hl) + · rintro _ ⟨hx, w, hw, rfl⟩ + exact (htouch w (hbdC hw hx).2.2 hx).elim + · have h₁ := IsCircuit.ncard_V hC.2 + have h₂ : Q.V.ncard ≤ R.length + 1 := ncard_walk_V D.rad.G R + have h₃ : Q.E.ncard = R.length := ncard_walk_E D.rad.G hRs + have h₄ : (D.rad.G.sup C Q).V.ncard ≤ C.V.ncard + Q.V.ncard := by + rw [hPV] + exact ncard_union_le _ _ + have h₅ : (D.rad.G.sup C Q).E.ncard ≤ C.E.ncard + Q.E.ncard := by + rw [hPE] + exact ncard_union_le _ _ + omega + · exact C.V_subset_U ha'C + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10q.lean b/LeanPool/GraphMinor/GM19/Section10q.lean new file mode 100644 index 0000000000..102fcb8363 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10q.lean @@ -0,0 +1,410 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10p + +/-! +# The third bullet of the distance flaw + +Two short circuits with one pole inside each, and a line between them, or a common vertex. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +namespace TangleDatum + +variable {D : TangleDatum cap χ} + +omit [T2Space S] in +/-- A closed walk of `Γ*` around a circuit, at any vertex of the circuit. -/ +theorem exists_circuit_walk {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) {v : Shat} + (hv : v ∈ C.V) : + ∃ W : GraphWalk D.rad.G.toGraph v v, W.length = C.E.ncard ∧ 0 < W.length + ∧ walkDrawing D.rad.G W = C := by + classical + have : ConnectedSpace Shat := cap.connected + obtain ⟨X, hX, hpos, hV, hE⟩ := exists_walk_at hC.2 hv + obtain ⟨W, hs, he⟩ := hC.1.exists_walk_up X + have hEeq : C.E = ↑W.edges.toFinset := by + rw [hE, he] + ext e + simp + have hlen : W.length = C.E.ncard := by + rw [hEeq, ncard_coe_finset, List.toFinset_card_of_nodup, GraphWalk.length] + rw [he] + exact hX.2 + have hpos' : 0 < W.length := by + rw [GraphWalk.length, he] + exact hpos + refine ⟨W, hlen, hpos', Drawing.ext_of_V_E ?_ ?_⟩ + · rw [walkDrawing_V, hs, hV] + · rw [walkDrawing_E, he, hE] + +omit [T2Space S] in +/-- Two circuits with total length at most `2n` that share two vertices lie in a short circuit, so +its inside holds both insides. -/ +theorem no_two_common_vertices {n : ℕ} (hn : n < D.rep) {C₁ C₂ : Drawing Shat} + (hC₁ : C₁.IsCircuitOf D.rad.G) (hC₂ : C₂.IsCircuitOf D.rad.G) + (hc : C₁.E.ncard + C₂.E.ncard ≤ 2 * n) {x y : Shat} (hxy : x ≠ y) (hx₁ : x ∈ C₁.V) + (hx₂ : x ∈ C₂.V) (hy₁ : y ∈ C₁.V) (hy₂ : y ∈ C₂.V) : + ∃ C, C.IsCircuitOf D.rad.G ∧ C.E.ncard ≤ 2 * n ∧ D.ins C₁ ⊆ D.ins C ∧ D.ins C₂ ⊆ D.ins C + ∧ C.V ⊆ C₁.V ∪ C₂.V := by + classical + have : ConnectedSpace Shat := cap.connected + have hrep : 1 ≤ D.rep := by omega + have hs := D.isSlope hrep + obtain ⟨Z₁, hl₁, hp₁, hZ₁⟩ := exists_circuit_walk hC₁ hx₁ + obtain ⟨Z₂, hl₂, hp₂, hZ₂⟩ := exists_circuit_walk hC₂ hx₂ + have hns := isNonSeparable_walk Z₁ Z₂ (hZ₁ ▸ isBlock_of_isCircuit hC₁.2) + (hZ₂ ▸ isBlock_of_isCircuit hC₂.2) + (fun z hz ↦ exists_edge_at Z₁ hp₁ hz) (fun z hz ↦ exists_edge_at Z₂ hp₂ hz) hxy + (hZ₁ ▸ C₁.V_subset_U hx₁) (hZ₂ ▸ C₂.V_subset_U hx₂) (hZ₁ ▸ C₁.V_subset_U hy₁) + (hZ₂ ▸ C₂.V_subset_U hy₂) + set E := walkDrawing D.rad.G (Z₁.append Z₂) with hE + have hs₁ : C₁.IsSubdrawing E := hZ₁ ▸ walkDrawing_mono + (fun z h ↦ (GraphWalk.mem_support_append _ _).mpr (Or.inl h)) + (fun e h ↦ by rw [GraphWalk.edges_append]; exact List.mem_append.mpr (Or.inl h)) + have hs₂ : C₂.IsSubdrawing E := hZ₂ ▸ walkDrawing_mono + (fun z h ↦ (GraphWalk.mem_support_append _ _).mpr (Or.inr h)) + (fun e h ↦ by rw [GraphWalk.edges_append]; exact List.mem_append.mpr (Or.inr h)) + have hEΓ : E.IsSubdrawing D.rad.G := walkDrawing_isSubdrawing _ _ + have hEc : E.E.ncard ≤ 2 * n := by + have h₁ : E.E ⊆ C₁.E ∪ C₂.E := fun e he ↦ by + rw [hE, walkDrawing_E, mem_ofPred_eq, GraphWalk.edges_append, List.mem_append] at he + rcases he with h | h + · exact Or.inl (by rw [← hZ₁, walkDrawing_E]; exact h) + · exact Or.inr (by rw [← hZ₂, walkDrawing_E]; exact h) + have h₂ := ncard_le_ncard h₁ (C₁.finite_edges.union C₂.finite_edges) + have h₃ := ncard_union_le C₁.E C₂.E + omega + have hsub : ∀ {C : Drawing Shat}, C.IsSubdrawing E → C.E.ncard ≤ 2 * n := fun {C} h ↦ + (ncard_le_ncard h.2 E.finite_edges).trans hEc + have hconf : IsConfined (2 * D.rep) E := fun C _ h ↦ by + have := hsub h + change C.E.ncard < _ + omega + obtain ⟨m, hm⟩ := ((finite_circuits E).image D.ins).exists_maximal ⟨D.ins C₁, C₁, ⟨hC₁.2, hs₁⟩, + rfl⟩ + obtain ⟨C, ⟨hC, hCs⟩, rfl⟩ := hm.1 + have heq := theorem_4_3_iii hs hEΓ hconf hC hCs (fun C' h₁ h₂ h₃ ↦ hm.2 ⟨C', ⟨h₁, h₂⟩, rfl⟩ h₃) + hns + have hin : ∀ {X : Drawing Shat}, X.IsCircuit → X.IsSubdrawing E → D.ins X ⊆ D.ins C + := fun {X} hX hXs z hz ↦ by + rw [← heq] + exact Or.inr (mem_iUnion₂.mpr ⟨X, ⟨hX, hXs⟩, hz⟩) + refine ⟨C, ⟨hCs.trans hEΓ, hC⟩, hsub hCs, hin hC₁.2 hs₁, hin hC₂.2 hs₂, fun z hz ↦ ?_⟩ + have hzE : z ∈ E.V := hCs.1 hz + rw [hE, walkDrawing_V, mem_ofPred_eq, GraphWalk.mem_support_append] at hzE + rcases hzE with h | h + · exact Or.inl (by rw [← hZ₁, walkDrawing_V]; exact h) + · exact Or.inr (by rw [← hZ₂, walkDrawing_V]; exact h) + +omit [T2Space S] in +/-- Two circuits with total length at most `2n` that share two vertices lie in a short circuit. -/ +theorem no_two_common {n : ℕ} (hn : n < D.rep) {C₁ C₂ : Drawing Shat} + (hC₁ : C₁.IsCircuitOf D.rad.G) (hC₂ : C₂.IsCircuitOf D.rad.G) + (hc : C₁.E.ncard + C₂.E.ncard ≤ 2 * n) {x y : Shat} (hxy : x ≠ y) (hx₁ : x ∈ C₁.V) + (hx₂ : x ∈ C₂.V) (hy₁ : y ∈ C₁.V) (hy₂ : y ∈ C₂.V) : + ∃ C, C.IsCircuitOf D.rad.G ∧ C.E.ncard ≤ 2 * n ∧ D.ins C₁ ⊆ D.ins C ∧ D.ins C₂ ⊆ D.ins C := by + obtain ⟨C, h₁, h₂, h₃, h₄, -⟩ := no_two_common_vertices hn hC₁ hC₂ hc hxy hx₁ hx₂ hy₁ hy₂ + exact ⟨C, h₁, h₂, h₃, h₄⟩ + +omit [T2Space S] in +/-- Two short circuits whose insides do not include each other's pole: each inside misses the open +disc of the other. -/ +theorem int_disjoint (hrep : 1 ≤ D.rep) {C₁ C₂ : Drawing Shat} (hC₁ : C₁.IsCircuitOf D.rad.G) + (hC₂ : C₂.IsCircuitOf D.rad.G) (hl₁ : C₁.E.ncard < 2 * D.rep) + (hl₂ : C₂.E.ncard < 2 * D.rep) {w : Shat} (hw : C₁.U ∩ C₂.U ⊆ {w}) {r₁ r₂ : Shat} + (h₁ : r₁ ∈ D.ins C₁) (h₁' : r₁ ∉ D.ins C₂) (h₂ : r₂ ∈ D.ins C₂) (h₂' : r₂ ∉ D.ins C₁) : + Disjoint (discInt (D.ins C₂)) (D.ins C₁) := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hsl := D.isSlope hrep + have hi₁ := D.ins_spec hC₁ hl₁ + have hi₂ := D.ins_spec hC₂ hl₂ + have hfr₂ : frontier (D.ins C₂) = C₂.U := by + rw [IsClosedDisc.frontier_eq_discBd hT hi₂.2.2.1, hi₂.2.2.2.1] + have hO := isSide_int hT hi₂.2.2.1 hi₂.2.2.2.1 + have hint : ∀ {x}, x ∈ discInt (D.ins C₂) → x ∉ C₂.U := fun {x} hx hxU ↦ hx.2 (hi₂.2.2.2.1 ▸ hxU) + refine disjoint_disc hT hO hi₁.2.2.1 hi₁.2.2.2.1 ?_ ?_ + · refine disjoint_left.2 fun y hy hyC ↦ ?_ + have hconn : IsPreconnected (C₁.U \ C₂.U) := by + by_cases hwm : w ∈ C₁.U ∧ w ∈ C₂.U + · have : C₁.U \ C₂.U = C₁.U \ {w} := by + ext z + refine ⟨fun hz ↦ ⟨hz.1, fun h ↦ hz.2 (mem_singleton_iff.1 h ▸ hwm.2)⟩, fun hz ↦ ⟨hz.1, + fun h ↦ hz.2 (hw ⟨hz.1, h⟩)⟩⟩ + rw [this] + exact (isPathConnected_oArc_diff (IsCircuit.isOArc_U hC₁.2) + hwm.1).isConnected.isPreconnected + · have : C₁.U \ C₂.U = C₁.U := by + refine sdiff_eq_left.2 (disjoint_left.2 fun z h₃ h₄ ↦ hwm ?_) + have := mem_singleton_iff.1 (hw ⟨h₃, h₄⟩) + exact this ▸ ⟨h₃, h₄⟩ + rw [this] + exact (IsCircuit.isOArc_U hC₁.2).isPreconnected + have hall : C₁.U ⊆ D.ins C₂ := by + intro z hz + by_contra hzn + obtain ⟨c, hc, hcf⟩ := inter_frontier_of_preconnected hconn hi₂.2.2.1.isClosed ⟨y, ⟨hyC, hint + hy⟩, hy.1⟩ + ⟨z, ⟨hz, fun h ↦ hzn (D.U_subset_ins hC₂ hl₂ h)⟩, hzn⟩ + rw [hfr₂] at hcf + exact hc.2 hcf + exact h₁' (hsl.monotone C₁ C₂ hC₁.2 hC₁.1 hl₁ hC₂.2 hC₂.1 hl₂ hall h₁) + · intro h + have hsub : D.ins C₂ ⊆ D.ins C₁ := by + rw [← closure_discInt hi₂.2.2.1] + exact closure_minimal (h.trans (discInt_subset _)) hi₁.2.2.1.isClosed + exact h₂' (hsub h₂) + +omit [T2Space S] in +/-- Two short circuits, each with a pole inside that the other has not: the insides meet only in +common vertices. -/ +theorem ins_inter_ins (hrep : 1 ≤ D.rep) {C₁ C₂ : Drawing Shat} (hC₁ : C₁.IsCircuitOf D.rad.G) + (hC₂ : C₂.IsCircuitOf D.rad.G) (hl₁ : C₁.E.ncard < 2 * D.rep) + (hl₂ : C₂.E.ncard < 2 * D.rep) (hone : (C₁.V ∩ C₂.V).Subsingleton) {r₁ r₂ : Shat} + (h₁ : r₁ ∈ D.ins C₁) (h₁' : r₁ ∉ D.ins C₂) (h₂ : r₂ ∈ D.ins C₂) (h₂' : r₂ ∉ D.ins C₁) : + D.ins C₁ ∩ D.ins C₂ ⊆ C₁.V ∩ C₂.V := by + have : ConnectedSpace Shat := cap.connected + have hedge : ∀ {e}, e ∈ C₁.E → e ∉ C₂.E := fun {e} h₃ h₄ ↦ by + obtain ⟨u, v, huv, hc, -⟩ | ⟨u, hc, -⟩ := D.rad.G.edge_cond e (hC₁.1.2 h₃) + · have m₁ : ∀ {X : Drawing Shat}, X.IsSubdrawing D.rad.G → e ∈ X.E → u ∈ X.V ∧ v ∈ X.V + := fun {X} hX he ↦ by + have : closure e ∩ X.V = {u, v} := by rw [hX.closure_inter_V he, hc] + exact ⟨(this ▸ mem_insert _ _ : u ∈ closure e ∩ X.V).2, (this ▸ mem_insert_of_mem _ rfl : v + ∈ closure e ∩ X.V).2⟩ + exact huv (hone ⟨(m₁ hC₁.1 h₃).1, (m₁ hC₂.1 h₄).1⟩ ⟨(m₁ hC₁.1 h₃).2, (m₁ hC₂.1 h₄).2⟩) + · obtain ⟨v, hv, w, hw, hset⟩ := D.rad.edge_ends (hC₁.1.2 h₃) + have hne : cap.emb v ≠ w := fun h ↦ hw.2 (h ▸ mem_image_of_mem _ hv) + have m₁ : cap.emb v ∈ ({u} : Set Shat) := hc ▸ hset ▸ mem_insert _ _ + have m₂ : w ∈ ({u} : Set Shat) := hc ▸ hset ▸ mem_insert_of_mem _ rfl + exact hne ((mem_singleton_iff.1 m₁).trans (mem_singleton_iff.1 m₂).symm) + have hUU : ∀ {x}, x ∈ C₁.U → x ∈ C₂.U → x ∈ C₁.V ∩ C₂.V := fun {x} h₃ h₄ ↦ by + rcases U_inter_cases hC₁.1 hC₂.1 h₃ h₄ with h | ⟨e, he₁, he₂, -⟩ + · exact h + · exact (hedge he₁ he₂).elim + have hw : ∃ w, C₁.U ∩ C₂.U ⊆ {w} := by + by_cases hne : (C₁.V ∩ C₂.V).Nonempty + · obtain ⟨w, hw⟩ := hne + exact ⟨w, fun x hx ↦ hone (hUU hx.1 hx.2) hw⟩ + · refine ⟨r₁, fun x hx ↦ (hne ⟨x, hUU hx.1 hx.2⟩).elim⟩ + obtain ⟨w, hw⟩ := hw + have d₁ := int_disjoint hrep hC₁ hC₂ hl₁ hl₂ hw h₁ h₁' h₂ h₂' + have d₂ := int_disjoint hrep hC₂ hC₁ hl₂ hl₁ (by rwa [Set.inter_comm]) h₂ h₂' h₁ h₁' + have hi₁ := D.ins_spec hC₁ hl₁ + have hi₂ := D.ins_spec hC₂ hl₂ + rintro x ⟨hx₁, hx₂⟩ + have hb₁ : x ∈ C₁.U := by + by_contra hn + exact disjoint_left.1 d₂ ⟨hx₁, fun h ↦ hn (hi₁.2.2.2.1 ▸ h)⟩ hx₂ + have hb₂ : x ∈ C₂.U := by + by_contra hn + exact disjoint_left.1 d₁ ⟨hx₂, fun h ↦ hn (hi₂.2.2.2.1 ▸ h)⟩ hx₁ + exact hUU hb₁ hb₂ + +variable (hS : IsSurface S) (h3 : D.P.Γ.IsInternallyThreeConnected) +include hS h3 + +/-- **The third shape**, from a drawing `P` of the two circuits and the line. -/ +theorem outer_of_two [Nonempty S] {n : ℕ} (_hn₁ : 1 ≤ n) (hn : n < D.rep) {C₁ C₂ : Drawing Shat} + (hC₁ : C₁.IsCircuitOf D.rad.G) (hC₂ : C₂.IsCircuitOf D.rad.G) + (hc₁ : C₁.E.ncard ≤ 2 * n) (hc₂ : C₂.E.ncard ≤ 2 * n) + (hlink₁ : GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins C₁)) + (partIn cap D.P.Γ (closure (D.ins C₁)ᶜ))) + (hlink₂ : GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins C₂)) + (partIn cap D.P.Γ (closure (D.ins C₂)ᶜ))) + {r₁ r₂ : Shat} (hr₁ : r₁ ∈ D.rad.poles) (hr₂ : r₂ ∈ D.rad.poles) (hne : r₁ ≠ r₂) + (hi₁ : r₁ ∈ D.ins C₁) (hi₂ : r₂ ∈ D.ins C₂) (hi₁' : r₁ ∉ D.ins C₂) + (hrange₁ : C₁.U ⊆ range cap.emb) (hrange₂ : C₂.U ⊆ range cap.emb) + (hO₁ : IsOArc (cap.emb ⁻¹' C₁.U)) {a₁ b₁ : S} (hab₁ : a₁ ≠ b₁) (ha₁ : a₁ ∈ cap.emb ⁻¹' C₁.U ∩ + D.P.Γ.V) (hb₁ : b₁ ∈ cap.emb ⁻¹' C₁.U ∩ D.P.Γ.V) + (hO₂ : IsOArc (cap.emb ⁻¹' C₂.U)) {a₂ b₂ : S} (hab₂ : a₂ ≠ b₂) (ha₂ : a₂ ∈ cap.emb ⁻¹' C₂.U ∩ + D.P.Γ.V) (hb₂ : b₂ ∈ cap.emb ⁻¹' C₂.U ∩ D.P.Γ.V) + {L : Set S} {a b : S} (hL : (L = {a} ∧ a = b) ∨ IsLineWithEnds L a b) {P : Drawing Shat} + (hPs : P.IsSubdrawing D.rad.G) (hPr : P.U ⊆ range cap.emb) + (hPi : ∀ v ∈ P.V, ∃ e ∈ P.E, v ∈ closure e) (hPU : P.U = C₁.U ∪ C₂.U ∪ cap.emb '' L) + (hLi₁ : cap.emb '' L ∩ D.ins C₁ = {cap.emb a}) + (hLi₂ : cap.emb '' L ∩ D.ins C₂ = {cap.emb b}) (hbd : Disjoint (cap.emb '' bd S) P.U) + (hinter : D.ins C₁ ∩ D.ins C₂ ⊆ {cap.emb a}) + (hsize : P.V.ncard + P.E.ncard ≤ 8 * n) (haC : cap.emb a ∈ C₁.U) (hbC : cap.emb b ∈ C₂.U) : ∃ 𝓓 + K, IsOuterData D n 𝓓 K := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hj := cap.isClosedEmbedding hS + have hlt₁ : C₁.E.ncard < 2 * D.rep := by omega + have hlt₂ : C₂.E.ncard < 2 * D.rep := by omega + have hd₁ := D.ins_spec hC₁ hlt₁ + have hd₂ := D.ins_spec hC₂ hlt₂ + have hbd₁ : discBd (D.ins C₁) = C₁.U := hd₁.2.2.2.1 + have hbd₂ : discBd (D.ins C₂) = C₂.U := hd₂.2.2.2.1 + have hfr₁ : frontier (D.ins C₁) = C₁.U := by + rw [IsClosedDisc.frontier_eq_discBd hT hd₁.2.2.1, hbd₁] + have hfr₂ : frontier (D.ins C₂) = C₂.U := by + rw [IsClosedDisc.frontier_eq_discBd hT hd₂.2.2.1, hbd₂] + have hcl : ∀ {Δ : Set Shat} {x}, x ∈ frontier Δ → x ∈ closure Δᶜ := fun {Δ x} hx ↦ by + rw [frontier_eq_closure_inter_closure] at hx + exact hx.2 + have hmem₁ : cap.emb a ∈ cap.emb '' L ∩ D.ins C₁ := by rw [hLi₁]; rfl + have hmem₂ : cap.emb b ∈ cap.emb '' L ∩ D.ins C₂ := by rw [hLi₂]; rfl + have hout₁ : D.ins C₁ ⊆ closure (D.ins C₂)ᶜ := fun x hx ↦ by + by_cases hx₂ : x ∈ D.ins C₂ + · have h₁ : x = cap.emb a := hinter ⟨hx, hx₂⟩ + subst h₁ + have h₂ : cap.emb a ∈ cap.emb '' L ∩ D.ins C₂ := ⟨hmem₁.1, hx₂⟩ + rw [hLi₂] at h₂ + rw [mem_singleton_iff.1 h₂] + exact hcl (hfr₂ ▸ hbC) + · exact subset_closure hx₂ + have hout₂ : D.ins C₂ ⊆ closure (D.ins C₁)ᶜ := fun x hx ↦ by + by_cases hx₁ : x ∈ D.ins C₁ + · have h₁ : x = cap.emb a := hinter ⟨hx₁, hx⟩ + rw [h₁] + exact hcl (hfr₁ ▸ haC) + · exact subset_closure hx₁ + obtain ⟨hinterK, hfeat, hlines, hcV, hcE⟩ := comap_facts D.rad D.P.fits hPs hPr hj hPi + set K : Drawing S := GM19.Drawing.comap P hj hPr with hKdef + have hKU : cap.emb '' K.U = P.U := image_preimage_eq_of_subset hPr + have hmemK : ∀ {x}, x ∈ K.U ↔ (cap.emb x ∈ C₁.U ∨ cap.emb x ∈ C₂.U) ∨ x ∈ L := fun {x} ↦ by + change cap.emb x ∈ P.U ↔ _ + rw [hPU] + refine or_congr Iff.rfl ⟨?_, mem_image_of_mem _⟩ + rintro ⟨y, hy, hxy⟩ + exact cap.isEmbedding.injective hxy ▸ hy + obtain ⟨Θ₁, hΘ₁, Θ₂, hΘ₂, hΘne, hrd₁, hrd₂⟩ := D.pole_cuffs_ne hr₁ hr₂ hne + have hring₁ : ∀ {x w : S}, cap.emb x ∈ C₁.U → x ≠ w → ∃ E ⊆ K.U \ {w}, x ∈ E ∧ IsPreconnected E ∧ + (E ∩ D.P.Γ.V).Nonempty := fun {x w} hx hne ↦ by + obtain ⟨E, hE, hxE, hconn, hm⟩ := ring_part hO₁ ha₁ hb₁ hab₁ hx hne + exact ⟨E, hE.trans (sdiff_subset_sdiff_left fun z hz ↦ hmemK.2 (Or.inl (Or.inl hz))), hxE, + hconn, hm⟩ + have hring₂ : ∀ {x w : S}, cap.emb x ∈ C₂.U → x ≠ w → ∃ E ⊆ K.U \ {w}, x ∈ E ∧ IsPreconnected E ∧ + (E ∩ D.P.Γ.V).Nonempty := fun {x w} hx hne ↦ by + obtain ⟨E, hE, hxE, hconn, hm⟩ := ring_part hO₂ ha₂ hb₂ hab₂ hx hne + exact ⟨E, hE.trans (sdiff_subset_sdiff_left fun z hz ↦ hmemK.2 (Or.inl (Or.inr hz))), hxE, + hconn, hm⟩ + have hΔne : D.ins C₁ ≠ D.ins C₂ := fun h ↦ hi₁' (h ▸ hi₁) + have hcover : ∀ Δ ∈ ({D.ins C₁, D.ins C₂} : Set (Set Shat)), ∀ v ∈ D.P.Γ.V, cap.emb v ∈ Δ + → cap.emb v ∈ closure Δᶜ → v ∈ K.U := by + rintro Δ (rfl | rfl) v - h₁ h₂ + · have : cap.emb v ∈ frontier (D.ins C₁) := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure h₁, h₂⟩ + rw [hfr₁] at this + exact hmemK.2 (Or.inl (Or.inl this)) + · have : cap.emb v ∈ frontier (D.ins C₂) := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure h₁, h₂⟩ + rw [hfr₂] at this + exact hmemK.2 (Or.inl (Or.inr this)) + refine ⟨{D.ins C₁, D.ins C₂}, K, Or.inr (Or.inr ⟨D.ins C₁, D.ins C₂, L, a, b, Θ₁, Θ₂, rfl, + hΔne, hd₁.2.2.1, hd₂.2.2.1, hbd₁.trans_subset hrange₁, hbd₂.trans_subset hrange₂, hL, + ?_, hLi₁, hLi₂, ?_, ?_, ?_, hΘ₁, hΘ₂, hΘne, ⟨r₁, hrd₁, hi₁⟩, ⟨r₂, hrd₂, hi₂⟩⟩), + (finite_singleton _).insert _, ?_, ?_, hfeat, hinterK, hlines, ?_, ?_, hcover, ?_, ?_⟩ + · rw [hKU, hPU, hbd₁, hbd₂] + · refine hbd.mono_right (union_subset ?_ ?_) + · rw [hbd₁, hPU] + exact fun x hx ↦ Or.inl (Or.inl hx) + · rw [hPU] + exact fun x hx ↦ Or.inr hx + · intro x hx y hy + have h₁ : x ∈ P.U := by + rw [hPU] + exact Or.inl (Or.inr (hbd₂ ▸ hx.1)) + exact (disjoint_left.1 hbd hx.2 h₁).elim + · exact hinter + · rw [ncard_pair hΔne] + · refine family_of_discs ((finite_singleton _).insert _) ?_ ?_ ?_ + · rintro _ (rfl | rfl) + · exact hlink₁ + · exact hlink₂ + · rintro _ (rfl | rfl) + · have := disc_order hS h3 D.rad hC₁ hd₁.2.2.1 hbd₁ + omega + · have := disc_order hS h3 D.rad hC₂ hd₂.2.2.1 hbd₂ + omega + · rintro _ (rfl | rfl) _ (rfl | rfl) h + · exact (h rfl).elim + · exact hout₁ + · exact hout₂ + · exact (h rfl).elim + · rw [hcV, hcE] + exact hsize + · have hset : ∀ {x}, cap.emb x ∈ C₁.U ∨ cap.emb x ∈ C₂.U ↔ x ∈ ⋃₀ {cap.emb ⁻¹' C₁.U, cap.emb ⁻¹' + C₂.U} := fun {x} ↦ by simp + rcases hL with ⟨rfl, rfl⟩ | hl + · refine ⟨{cap.emb ⁻¹' C₁.U, cap.emb ⁻¹' C₂.U}, ∅, (finite_singleton _).insert _, + finite_empty, ?_, by simp, ?_⟩ + · rintro _ (rfl | rfl) + · exact hO₁ + · exact hO₂ + · ext x + rw [hmemK] + simp only [sUnion_empty, union_empty] + refine ⟨?_, fun h ↦ Or.inl (hset.2 h)⟩ + rintro (h | h) + · exact hset.1 h + · rw [mem_singleton_iff.1 h] + exact hset.1 (Or.inl haC) + · refine ⟨{cap.emb ⁻¹' C₁.U, cap.emb ⁻¹' C₂.U}, {L}, (finite_singleton _).insert _, + finite_singleton _, ?_, ?_, ?_⟩ + · rintro _ (rfl | rfl) + · exact hO₁ + · exact hO₂ + · rintro _ rfl + refine ⟨a, b, ?_, hl, Or.inr (hset.1 (Or.inl haC)), Or.inr (hset.1 (Or.inr hbC))⟩ + intro h + obtain ⟨f, h₀, h₁⟩ := hl + have := f.injective (Subtype.ext (h₀.trans (h.trans h₁.symm))) + exact zero_ne_one this + · ext x + rw [hmemK, sUnion_singleton] + exact or_congr hset Iff.rfl + · rintro v hv Δ (rfl | rfl) + · rcases hmemK.1 hv with (h | h) | h + · exact hcl (hfr₁ ▸ h) + · exact hout₂ (D.U_subset_ins hC₂ hlt₂ h) + · by_cases hvi : cap.emb v ∈ D.ins C₁ + · have hvu : cap.emb v ∈ cap.emb '' L ∩ D.ins C₁ := ⟨mem_image_of_mem _ h, hvi⟩ + rw [hLi₁] at hvu + rw [mem_singleton_iff.1 hvu] + exact hcl (hfr₁ ▸ haC) + · exact subset_closure hvi + · rcases hmemK.1 hv with (h | h) | h + · exact hout₁ (D.U_subset_ins hC₁ hlt₁ h) + · exact hcl (hfr₂ ▸ h) + · by_cases hvi : cap.emb v ∈ D.ins C₂ + · have hvu : cap.emb v ∈ cap.emb '' L ∩ D.ins C₂ := ⟨mem_image_of_mem _ h, hvi⟩ + rw [hLi₂] at hvu + rw [mem_singleton_iff.1 hvu] + exact hcl (hfr₂ ▸ hbC) + · exact subset_closure hvi + · intro w x hx hne + rcases hmemK.1 hx with (h | h) | h + · exact hring₁ h hne + · exact hring₂ h hne + · rcases hL with ⟨rfl, -⟩ | hl + · exact hring₁ (by rw [mem_singleton_iff.1 h]; exact haC) hne + · exact line_anchor hl (fun z hz ↦ hmemK.2 (Or.inr hz)) (fun w' hne' ↦ hring₁ haC hne') + (fun w' hne' ↦ hring₂ hbC hne') h hne + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10r.lean b/LeanPool/GraphMinor/GM19/Section10r.lean new file mode 100644 index 0000000000..1ec0f759b1 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10r.lean @@ -0,0 +1,476 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10q + +/-! +# A distance flaw gives outer data + +This is the text of page 356 between "n-flawed in distance" and (10.4), written out from XI (9.2). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +namespace TangleDatum + +variable {D : TangleDatum cap χ} + +/-- A walk of length zero stays at its start. -/ +theorem support_of_length_eq_zero {α β : Type*} {G : Graph α β} {a b : α} (R : GraphWalk G a b) + (h : R.length = 0) : a = b ∧ ∀ x ∈ R.support, x = a := by + cases R with + | nil hv => exact ⟨rfl, by simp [GraphWalk.support]⟩ + | cons hl r => simp [GraphWalk.length] at h + +/-- The edges of a walk are at most as many as its length. -/ +theorem ncard_E_le_length {T : Type} [TopologicalSpace T] [T2Space T] (G : Drawing T) {u v : T} + (W : GraphWalk G.toGraph u v) : + (walkDrawing G W).E.ncard ≤ W.length := by + classical + rw [walkDrawing_E] + have : {e | e ∈ W.edges} = ↑W.edges.toFinset := by + ext e + simp + rw [this, ncard_coe_finset] + exact List.toFinset_card_le _ + +/-- A simple walk from a vertex to itself has no edge. -/ +theorem length_of_simple_self {α β : Type*} {G : Graph α β} {a : α} (R : GraphWalk G a a) + (hR : R.IsSimple) : R.length = 0 := by + cases R with + | nil hv => rfl + | cons hl r => + have h : (GraphWalk.cons hl r).support.Nodup := hR + simp only [GraphWalk.support_cons, List.nodup_cons] at h + exact (h.1 r.end_mem_support).elim + +variable (hS : IsSurface S) (h3 : D.P.Γ.IsInternallyThreeConnected) +include hS h3 + +/-- A closed walk no longer than `2n` that has a vertex with label `Θ`, around a circuit with a pole +`r` inside, where `r` is not the pole of `Θ`. -/ +theorem outer_of_touch [Nonempty S] {n : ℕ} (hn₁ : 1 ≤ n) (hn : n < D.rep) (hd : + ((n + 2 : ℕ) : ℕ∞) < 2 * Painting.dist D.rad) + (hNP : ¬ ∃ C, D.IsPairCircuit n C) {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hc : C.E.ncard ≤ 2 * n) + (hlink : GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins C)) + (partIn cap D.P.Γ (closure (D.ins C)ᶜ))) + {r p : Shat} (hr : r ∈ D.rad.poles) (hri : r ∈ D.ins C) (hp : p ∈ D.rad.poles) + (hrp : r ≠ p) {Θ : Set S} (hΘ : Θ ∈ cuffs S) + (hreg : D.rad.regionOf p = cap.cuffDisc Θ) {u₀ : Shat} (Z : GraphWalk D.rad.G.toGraph u₀ u₀) + (hZ : Z.length ≤ 2 * n) (hpos : 0 < Z.length) + (hZC : ∀ x ∈ C.V, x ∈ Z.support) {y : Shat} (hy : y ∈ Z.support) (hl : cuffLabel cap y + = some Θ) : ∃ 𝓓 K, IsOuterData D n 𝓓 K := by + have hlt : C.E.ncard < 2 * D.rep := by omega + have hnp : ∀ z ∈ C.V, z ∉ D.rad.poles := fun z hz hzp ↦ by + obtain ⟨Θ', hΘ', hreg', hzd⟩ := D.rad.pole_cases hzp + have := labels_eq hS h3 hd Z hZ (hZC z hz) hy (cuffLabel_eq hΘ' (subset_closure hzd)) hl + subst this + obtain ⟨-, -, hG3, -⟩ := id D.rad.isPreRadial + have m₁ := D.rad.regionOf_mem hzp.1 + have m₂ := D.rad.regionOf_mem hp.1 + have hzq : z = p := (hG3 _ m₁.1).unique ⟨m₁.2, hzp.1.1⟩ ⟨(hreg'.trans hreg.symm) ▸ m₂.2, hp.1.1⟩ + subst hzq + exact hNP ⟨C, hC, hc, r, hr, z, hp, hrp, hri, D.U_subset_ins hC hlt (C.V_subset_U hz)⟩ + obtain ⟨v, -, hvΘ, hvZ⟩ := exists_touch Z hpos hy hl + exact outer_of_disc_point hS h3 hn₁ hn hd hNP hC hc hlink hr hri hnp hp hrp hΘ hreg Z hZ hZC hvΘ + hvZ + +/-- A circuit with one pole inside and a walk from its inside to a second pole. -/ +theorem outer_of_disc_pole [Nonempty S] {n : ℕ} (hn₁ : 1 ≤ n) (hn : n < D.rep) (hd : + ((n + 2 : ℕ) : ℕ∞) < 2 * Painting.dist D.rad) + (hNP : ¬ ∃ C, D.IsPairCircuit n C) {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hlink : GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins C)) + (partIn cap D.P.Γ (closure (D.ins C)ᶜ))) + {r p a : Shat} (hr : r ∈ D.rad.poles) (hri : r ∈ D.ins C) (hp : p ∈ D.rad.poles) (hrp : r ≠ p) + (ha : a ∈ D.ins C) (Q : GraphWalk D.rad.G.toGraph a p) + (hlen : C.E.ncard + 2 * Q.length ≤ 2 * n) : ∃ 𝓓 K, IsOuterData D n 𝓓 K := by + classical + have hc : C.E.ncard ≤ 2 * n := by omega + have hlt : C.E.ncard < 2 * D.rep := by omega + have hpi : p ∉ D.ins C := fun h ↦ hNP ⟨C, hC, hc, r, hr, p, hp, hrp, hri, h⟩ + obtain ⟨a', ha', b', hb', T', hT'e, -, hA, -⟩ := exists_crossing (D.ins C) {p} Q ha rfl + obtain rfl : b' = p := hb' + obtain ⟨R, hRs, hRsupp, hRe⟩ := GraphWalk.exists_isSimple T' + have hne : a' ≠ b' := fun h ↦ hpi (h ▸ ha') + have hRA : ∀ x ∈ R.support, x ∈ D.ins C → x = a' := fun x hx ↦ hA x (hRsupp x hx) + have ha'C : a' ∈ C.V := by + obtain ⟨e, y, hl, hy, hya⟩ := walk_first_step R hRs hne + exact D.exit_mem hC hlt hl ha' fun h ↦ hya (hRA y hy h) + obtain ⟨Z₁, hl₁, hp₁, hZ₁⟩ := exists_circuit_walk hC ha'C + have hRl : R.length ≤ Q.length := by + have h₁ : R.length ≤ T'.length := length_le_of_edges hRs hRe + have h₂ : T'.length ≤ Q.length := hT'e.length_le + omega + obtain ⟨Θ, hΘ, hreg, hrd⟩ := D.rad.pole_cases hp + have hlab : cuffLabel cap b' = some Θ := cuffLabel_eq hΘ (subset_closure hrd) + refine outer_of_touch hS h3 hn₁ hn hd hNP hC hc hlink hr hri hp hrp hΘ hreg (Z₁.append + (R.append R.reverse)) ?_ ?_ ?_ (y := b') ?_ hlab + · rw [GraphWalk.length_append, GraphWalk.length_append, GraphWalk.length_reverse] + omega + · rw [GraphWalk.length_append] + omega + · intro x hx + refine (GraphWalk.mem_support_append _ _).mpr (Or.inl ?_) + rwa [← hZ₁, walkDrawing_V] at hx + · exact (GraphWalk.mem_support_append _ _).mpr (Or.inr ((GraphWalk.mem_support_append _ _).mpr + (Or.inl R.end_mem_support))) + +omit hS h3 in +omit [T2Space S] in +/-- Two circuits that meet in at most one vertex, and a walk between their insides, give a simple +walk between the circuits that meets each inside once. -/ +theorem exists_join (_hrep : 1 ≤ D.rep) {C₁ C₂ : Drawing Shat} (hC₁ : C₁.IsCircuitOf D.rad.G) + (hC₂ : C₂.IsCircuitOf D.rad.G) (hl₁ : C₁.E.ncard < 2 * D.rep) + (hl₂ : C₂.E.ncard < 2 * D.rep) (hinter : D.ins C₁ ∩ D.ins C₂ ⊆ C₁.V ∩ C₂.V) (hone : + (C₁.V ∩ C₂.V).Subsingleton) {a b : Shat} (ha : a ∈ D.ins C₁) (hb : b ∈ D.ins C₂) + (Q : GraphWalk D.rad.G.toGraph a b) : + ∃ (a' b' : Shat) (R : GraphWalk D.rad.G.toGraph a' b'), R.IsSimple ∧ a' ∈ C₁.V ∧ b' ∈ C₂.V + ∧ R.length ≤ Q.length ∧ (∀ x ∈ R.support, x ∈ D.ins C₁ → x = a') ∧ + (∀ x ∈ R.support, x ∈ D.ins C₂ → x = b') ∧ (D.ins C₁ ∩ D.ins C₂ ⊆ {a'}) := by + classical + by_cases hw : (C₁.V ∩ C₂.V).Nonempty + · obtain ⟨w, hw₁, hw₂⟩ := hw + have hsub : D.ins C₁ ∩ D.ins C₂ ⊆ {w} := fun x hx ↦ hone (hinter hx) ⟨hw₁, hw₂⟩ + refine ⟨w, w, GraphWalk.nil (hC₁.1.1 hw₁), by simp [GraphWalk.IsSimple, GraphWalk.support], + hw₁, hw₂, Nat.zero_le _, ?_, ?_, hsub⟩ + · simp [GraphWalk.support] + · simp [GraphWalk.support] + · have hemp : ∀ x, x ∈ D.ins C₁ → x ∈ D.ins C₂ → False := fun x h₁ h₂ ↦ hw ⟨x, hinter ⟨h₁, h₂⟩⟩ + obtain ⟨a', ha', b', hb', T', hT'e, -, hA, hB⟩ := exists_crossing (D.ins C₁) (D.ins C₂) Q ha hb + obtain ⟨R, hRs, hRsupp, hRe⟩ := GraphWalk.exists_isSimple T' + have hne : a' ≠ b' := fun h ↦ hemp a' ha' (h ▸ hb') + have hRA : ∀ x ∈ R.support, x ∈ D.ins C₁ → x = a' := fun x hx ↦ hA x (hRsupp x hx) + have hRB : ∀ x ∈ R.support, x ∈ D.ins C₂ → x = b' := fun x hx ↦ hB x (hRsupp x hx) + have ha'C : a' ∈ C₁.V := by + obtain ⟨e, y, hl, hy, hya⟩ := walk_first_step R hRs hne + exact D.exit_mem hC₁ hl₁ hl ha' fun h ↦ hya (hRA y hy h) + have hb'C : b' ∈ C₂.V := by + obtain ⟨e, y, hl, hy, hya⟩ := walk_first_step R.reverse (by + unfold GraphWalk.IsSimple + rw [GraphWalk.support_reverse] + exact List.nodup_reverse.2 hRs) hne.symm + rw [GraphWalk.support_reverse] at hy + exact D.exit_mem hC₂ hl₂ hl hb' fun h ↦ hya (hRB y (List.mem_reverse.1 hy) h) + have hRl : R.length ≤ Q.length := by + have h₁ : R.length ≤ T'.length := length_le_of_edges hRs hRe + have h₂ : T'.length ≤ Q.length := hT'e.length_le + omega + exact ⟨a', b', R, hRs, ha'C, hb'C, hRl, hRA, hRB, fun x hx ↦ (hemp x hx.1 hx.2).elim⟩ + +/-- Two circuits, with a pole inside each, and a walk between their insides. -/ +theorem outer_of_discs [Nonempty S] {n : ℕ} (hn₁ : 1 ≤ n) (hn : n < D.rep) (hd : + ((n + 2 : ℕ) : ℕ∞) < 2 * Painting.dist D.rad) + (hNP : ¬ ∃ C, D.IsPairCircuit n C) {C₁ C₂ : Drawing Shat} (hC₁ : C₁.IsCircuitOf D.rad.G) + (hC₂ : C₂.IsCircuitOf D.rad.G) + (hlink₁ : GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins C₁)) + (partIn cap D.P.Γ (closure (D.ins C₁)ᶜ))) + (hlink₂ : GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins C₂)) + (partIn cap D.P.Γ (closure (D.ins C₂)ᶜ))) + {r₁ r₂ a b : Shat} (hr₁ : r₁ ∈ D.rad.poles) (hr₂ : r₂ ∈ D.rad.poles) (hne : r₁ ≠ r₂) + (hi₁ : r₁ ∈ D.ins C₁) (hi₂ : r₂ ∈ D.ins C₂) + (ha : a ∈ D.ins C₁) (hb : b ∈ D.ins C₂) (Q : GraphWalk D.rad.G.toGraph a b) + (hlen : C₁.E.ncard + C₂.E.ncard + 2 * Q.length ≤ 2 * n) : + ∃ 𝓓 K, IsOuterData D n 𝓓 K := by + classical + have hrep : 1 ≤ D.rep := by omega + have hc₁ : C₁.E.ncard ≤ 2 * n := by omega + have hc₂ : C₂.E.ncard ≤ 2 * n := by omega + have hlt₁ : C₁.E.ncard < 2 * D.rep := by omega + have hlt₂ : C₂.E.ncard < 2 * D.rep := by omega + have hi₁' : r₁ ∉ D.ins C₂ := fun h ↦ hNP ⟨C₂, hC₂, hc₂, r₁, hr₁, r₂, hr₂, hne, h, hi₂⟩ + have hi₂' : r₂ ∉ D.ins C₁ := fun h ↦ hNP ⟨C₁, hC₁, hc₁, r₁, hr₁, r₂, hr₂, hne, hi₁, h⟩ + have hone : (C₁.V ∩ C₂.V).Subsingleton := by + intro x hx y hy + by_contra hxy + obtain ⟨C, hC, hc, h₁, h₂⟩ := no_two_common hn hC₁ hC₂ (by omega) hxy hx.1 hx.2 hy.1 hy.2 + exact hNP ⟨C, hC, hc, r₁, hr₁, r₂, hr₂, hne, h₁ hi₁, h₂ hi₂⟩ + have hinterV := ins_inter_ins hrep hC₁ hC₂ hlt₁ hlt₂ hone hi₁ hi₁' hi₂ hi₂' + obtain ⟨a', b', R, hRs, ha'C, hb'C, hRl, hRA, hRB, hinter⟩ := exists_join hrep hC₁ hC₂ hlt₁ hlt₂ + hinterV hone ha hb Q + obtain ⟨Z₁, hl₁, hp₁, hZ₁⟩ := exists_circuit_walk hC₁ ha'C + obtain ⟨Z₂, hl₂, hp₂, hZ₂⟩ := exists_circuit_walk hC₂ hb'C + set Z := Z₁.append (R.append (Z₂.append R.reverse)) with hZdef + have hZl : Z.length = Z₁.length + (R.length + (Z₂.length + R.length)) := by + simp only [hZdef, GraphWalk.length_append, GraphWalk.length_reverse] + have hZle : Z.length ≤ 2 * n := by omega + have hZpos : 0 < Z.length := by omega + have hin₁ : ∀ x ∈ Z₁.support, x ∈ Z.support := fun x hx ↦ (GraphWalk.mem_support_append _ _).mpr + (Or.inl hx) + have hin₂ : ∀ x ∈ R.support, x ∈ Z.support := fun x hx ↦ + (GraphWalk.mem_support_append _ _).mpr (Or.inr ((GraphWalk.mem_support_append _ _).mpr + (Or.inl hx))) + have hin₃ : ∀ x ∈ Z₂.support, x ∈ Z.support := fun x hx ↦ + (GraphWalk.mem_support_append _ _).mpr (Or.inr ((GraphWalk.mem_support_append _ _).mpr (Or.inr + ((GraphWalk.mem_support_append _ _).mpr (Or.inl hx))))) + have hC₁Z : ∀ x ∈ C₁.V, x ∈ Z.support := fun x hx ↦ hin₁ x (by rwa [← hZ₁, walkDrawing_V] at hx) + have hC₂Z : ∀ x ∈ C₂.V, x ∈ Z.support := fun x hx ↦ hin₃ x (by rwa [← hZ₂, walkDrawing_V] at hx) + by_cases htouch : ∃ y Θ, y ∈ Z.support ∧ cuffLabel cap y = some Θ + · obtain ⟨y, Θ, hy, hl⟩ := htouch + have hΘ := (cuffLabel_some hl).1 + obtain ⟨p, hp, -, hreg⟩ := D.rad.exists_pole hΘ + by_cases hrp : r₁ = p + · have hrp₂ : r₂ ≠ p := fun h ↦ hne (hrp.trans h.symm) + exact outer_of_touch hS h3 hn₁ hn hd hNP hC₂ hc₂ hlink₂ hr₂ hi₂ hp hrp₂ hΘ hreg Z hZle hZpos + hC₂Z hy hl + · exact outer_of_touch hS h3 hn₁ hn hd hNP hC₁ hc₁ hlink₁ hr₁ hi₁ hp hrp hΘ hreg Z hZle hZpos + hC₁Z hy hl + · push Not at htouch + have hnl : ∀ {y}, y ∈ Z.support → ∀ Θ, cuffLabel cap y ≠ some Θ := fun {y} hy Θ ↦ htouch y Θ hy + have hnp : ∀ {y}, y ∈ Z.support → y ∉ D.rad.poles := fun {y} hy hyp ↦ by + obtain ⟨Θ, hΘ, -, hyd⟩ := D.rad.pole_cases hyp + exact hnl hy Θ (cuffLabel_eq hΘ (subset_closure hyd)) + have hnp₁ : ∀ z ∈ C₁.V, z ∉ D.rad.poles := fun z hz ↦ hnp (hC₁Z z hz) + have hnp₂ : ∀ z ∈ C₂.V, z ∉ D.rad.poles := fun z hz ↦ hnp (hC₂Z z hz) + have hrange₁ := subset_range_of_no_pole D.rad hC₁.1 hnp₁ + have hrange₂ := subset_range_of_no_pole D.rad hC₂.1 hnp₂ + set R' := walkDrawing D.rad.G R with hR' + have hR's : R'.IsSubdrawing D.rad.G := walkDrawing_isSubdrawing _ _ + have hR'V : ∀ {z}, z ∈ R'.V → z ∈ R.support := fun {z} hz ↦ by rwa [hR', walkDrawing_V] at hz + have hR'r := subset_range_of_no_pole D.rad hR's fun z hz ↦ hnp (hin₂ z (hR'V hz)) + have hnoB : ∀ {X : Drawing Shat}, X.IsSubdrawing D.rad.G → (∀ z ∈ X.V, z ∈ Z.support) + → ∀ {v : S}, v ∈ bd S → cap.emb v ∉ X.U := fun {X} hX hsup {v} hv hvX ↦ by + obtain ⟨-, h₂, Θ', hΘ', hvΘ⟩ := D.rad.bd_point hX hv hvX + exact hnl (hsup _ h₂) Θ' (cuffLabel_emb hΘ' hvΘ) + have hone₁ : ∀ {x y : S}, x ∈ bd S → y ∈ bd S → cap.emb x ∈ C₁.U → cap.emb y ∈ C₁.U → x = y + := fun hx _ hxC _ ↦ (hnoB hC₁.1 hC₁Z hx hxC).elim + have hone₂ : ∀ {x y : S}, x ∈ bd S → y ∈ bd S → cap.emb x ∈ C₂.U → cap.emb y ∈ C₂.U → x = y + := fun hx _ hxC _ ↦ (hnoB hC₂.1 hC₂Z hx hxC).elim + obtain ⟨hO₁, a₁, b₁, hab₁, ha₁, hb₁⟩ := ring_marks hS h3 hC₁ hlt₁ hnp₁ hone₁ hr₁ hi₁ + obtain ⟨hO₂, a₂, b₂, hab₂, ha₂, hb₂⟩ := ring_marks hS h3 hC₂ hlt₂ hnp₂ hone₂ hr₂ hi₂ + obtain ⟨u, rfl⟩ := hrange₁ (C₁.V_subset_U ha'C) + obtain ⟨w, rfl⟩ := hrange₂ (C₂.V_subset_U hb'C) + have hR'L : cap.emb '' (cap.emb ⁻¹' R'.U) = R'.U := image_preimage_eq_of_subset hR'r + have hj := cap.isClosedEmbedding hS + have hmemU : ∀ {x}, x ∈ R'.U ↔ x ∈ {x | x ∈ R.support} ∪ ⋃ e ∈ {e | e ∈ R.edges}, closure e + := fun {x} ↦ by + rw [hR', mem_walkDrawing_U] + simp + have hL : (cap.emb ⁻¹' R'.U = {u} ∧ u = w) ∨ IsLineWithEnds (cap.emb ⁻¹' R'.U) u w := by + by_cases hab : cap.emb u = cap.emb w + · left + have huw := cap.isEmbedding.injective hab + subst huw + have hzero : R.length = 0 := length_of_simple_self R hRs + have hsup := (support_of_length_eq_zero R hzero).2 + have hed : R.edges = [] := List.length_eq_zero_iff.1 hzero + refine ⟨?_, rfl⟩ + ext x + simp only [mem_preimage, hmemU, hed, mem_singleton_iff] + constructor + · rintro (h | h) + · exact cap.isEmbedding.injective (hsup _ h) + · simp at h + · rintro rfl + exact Or.inl R.start_mem_support + · right + have hline : IsLineWithEnds (cap.emb '' (cap.emb ⁻¹' R'.U)) (cap.emb u) (cap.emb w) := by + rw [hR'L] + have := walk_isLine D.rad.G R hRs hab + convert this using 1 + ext x + exact hmemU + exact isLine_comap hj hline + have hPV : ((D.rad.G.sup C₁ C₂).V) = C₁.V ∪ C₂.V := Drawing.sup_V hC₁.1 hC₂.1 + have hPE : ((D.rad.G.sup C₁ C₂).E) = C₁.E ∪ C₂.E := Drawing.sup_E hC₁.1 hC₂.1 + have hPs := D.rad.G.sup_isSubdrawing C₁ C₂ + have hPPV : (D.rad.G.sup (D.rad.G.sup C₁ C₂) R').V = (C₁.V ∪ C₂.V) ∪ R'.V := by + rw [Drawing.sup_V hPs hR's, hPV] + have hPPE : (D.rad.G.sup (D.rad.G.sup C₁ C₂) R').E = (C₁.E ∪ C₂.E) ∪ R'.E := by + rw [Drawing.sup_E hPs hR's, hPE] + have hPU : (D.rad.G.sup (D.rad.G.sup C₁ C₂) R').U = C₁.U ∪ C₂.U ∪ R'.U := by + rw [U_union (Drawing.sup_V hPs hR's) (Drawing.sup_E hPs hR's), U_union hPV hPE] + have hu₁ : cap.emb u ∈ C₁.U := C₁.V_subset_U ha'C + have hw₂ : cap.emb w ∈ C₂.U := C₂.V_subset_U hb'C + refine outer_of_two hS h3 hn₁ hn hC₁ hC₂ hc₁ hc₂ hlink₁ hlink₂ hr₁ hr₂ hne hi₁ hi₂ hi₁' hrange₁ + hrange₂ hO₁ hab₁ ha₁ hb₁ hO₂ hab₂ ha₂ hb₂ hL + (D.rad.G.sup_isSubdrawing (D.rad.G.sup C₁ C₂) R') ?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_ hu₁ hw₂ + · rw [hPU] + exact union_subset (union_subset hrange₁ hrange₂) hR'r + · intro v hv + rw [hPPV] at hv + rcases hv with (hv | hv) | hv + · obtain ⟨e, he, hve⟩ := circuit_iso hC₁.2 v hv + exact ⟨e, by rw [hPPE]; exact Or.inl (Or.inl he), hve⟩ + · obtain ⟨e, he, hve⟩ := circuit_iso hC₂.2 v hv + exact ⟨e, by rw [hPPE]; exact Or.inl (Or.inr he), hve⟩ + · rcases Nat.eq_zero_or_pos R.length with h0 | h0 + · obtain ⟨-, h₂⟩ := support_of_length_eq_zero R h0 + obtain ⟨e, he, hve⟩ := circuit_iso hC₁.2 _ ha'C + exact ⟨e, by rw [hPPE]; exact Or.inl (Or.inl he), h₂ v (hR'V hv) ▸ hve⟩ + · obtain ⟨e, he, hve⟩ := exists_edge_at R h0 (hR'V hv) + exact ⟨e, by rw [hPPE]; exact Or.inr (by rw [hR', walkDrawing_E]; exact he), hve⟩ + · rw [hPU, hR'L] + · rw [hR'L] + refine Subset.antisymm (fun x hx ↦ D.walk_inter_ins hC₁ hlt₁ hRs hRA hx.1 hx.2) ?_ + rintro _ rfl + exact ⟨R'.V_subset_U (by rw [hR', walkDrawing_V]; exact R.start_mem_support), D.U_subset_ins + hC₁ hlt₁ hu₁⟩ + · rw [hR'L] + refine Subset.antisymm (fun x hx ↦ D.walk_inter_ins hC₂ hlt₂ hRs hRB hx.1 hx.2) ?_ + rintro _ rfl + exact ⟨R'.V_subset_U (by rw [hR', walkDrawing_V]; exact R.end_mem_support), D.U_subset_ins + hC₂ hlt₂ hw₂⟩ + · rw [disjoint_left] + rintro _ ⟨v, hv, rfl⟩ hvP + rw [hPU] at hvP + rcases hvP with (h | h) | h + · exact hnoB hC₁.1 hC₁Z hv h + · exact hnoB hC₂.1 hC₂Z hv h + · exact hnoB hR's (fun z hz ↦ hin₂ z (hR'V hz)) hv h + · exact hinter + · have h₁ := IsCircuit.ncard_V hC₁.2 + have h₂ := IsCircuit.ncard_V hC₂.2 + have h₃ : R'.V.ncard ≤ R.length + 1 := ncard_walk_V D.rad.G R + have h₄ : R'.E.ncard = R.length := ncard_walk_E D.rad.G hRs + have h₅ : (D.rad.G.sup (D.rad.G.sup C₁ C₂) R').V.ncard ≤ C₁.V.ncard + C₂.V.ncard + R'.V.ncard + := by + rw [hPPV] + exact (ncard_union_le _ _).trans (by have := ncard_union_le C₁.V C₂.V; omega) + have h₆ : (D.rad.G.sup (D.rad.G.sup C₁ C₂) R').E.ncard ≤ C₁.E.ncard + C₂.E.ncard + R'.E.ncard + := by + rw [hPPE] + exact (ncard_union_le _ _).trans (by have := ncard_union_le C₁.E C₂.E; omega) + omega + +/-- What a piece gives at a pole `r` in it: the pole alone, or a linked circuit with `r` inside that +is no longer than `ℓ`. -/ +def IsEnd (D : TangleDatum cap χ) (r : Shat) (A : Set Shat) (ℓ : ℕ) : Prop := + A = {r} ∨ ∃ C : Drawing Shat, C.IsCircuitOf D.rad.G ∧ C.E.ncard ≤ ℓ ∧ A = D.ins C ∧ r ∈ D.ins C ∧ + GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins C)) (partIn cap D.P.Γ + (closure (D.ins C)ᶜ)) + +/-- Replace a piece by what it gives at a pole in it. When `r` is on the piece we move along its +walk to `r`, and otherwise the piece is a disc bounded by a circuit, which we make linked. -/ +theorem end_of_piece {Y A : Set Shat} {G : Drawing Shat} (hP : IsPiece D.rad.G D.ins + (2 * D.rep) Y A G) {r a b : Shat} (hr : r ∈ D.rad.poles) (hrA : r ∈ A) + (Z : GraphWalk D.rad.G.toGraph a a) (hZ : walkDrawing D.rad.G Z = G) (ha : a ∈ G.V) + (hlt : Z.length < 2 * D.rep) (Q : GraphWalk D.rad.G.toGraph a b) : + ∃ (A' : Set Shat) (a' : Shat) (Q' : GraphWalk D.rad.G.toGraph a' b) (ℓ : ℕ), D.IsEnd r A' ℓ + ∧ a' ∈ A' ∧ ℓ + 2 * Q'.length ≤ Z.length + 2 * Q.length := by + have : ConnectedSpace Shat := cap.connected + by_cases hrV : r ∈ G.V + · have hrs : r ∈ Z.support := by rwa [← hZ, walkDrawing_V] at hrV + obtain ⟨W, hW, -, -⟩ := exists_half_walk Z hrs Z.start_mem_support + refine ⟨{r}, r, W.append Q, 0, Or.inl rfl, rfl, ?_⟩ + rw [GraphWalk.length_append] + omega + · rcases hP.kind with ⟨hc, rfl⟩ | ⟨e, u, v, -, -, hset, hV, -, rfl, -⟩ | ⟨v, hV, -, rfl, -⟩ + · have hC : G.IsCircuitOf D.rad.G := ⟨walkDrawing_isSubdrawing D.rad.G Z |> fun h ↦ hZ ▸ h, hc⟩ + have hGl : G.E.ncard ≤ Z.length := hZ ▸ ncard_E_le_length D.rad.G Z + obtain ⟨C', hC', hle, -, hsub, hlink⟩ := exists_linked hS h3 hC (by omega) + refine ⟨D.ins C', a, Q, Z.length, Or.inr ⟨C', hC', by omega, rfl, hsub hrA, hlink⟩, + hsub (D.U_subset_ins hC (by omega) (G.V_subset_U ha)), le_rfl⟩ + · have : r ∈ closure e ∩ D.rad.G.V := ⟨hrA, hr.1.1⟩ + rw [hset, ← hV] at this + exact (hrV this).elim + · have : r = v := hrA + exact (hrV (by rw [hV, this]; rfl)).elim + +omit hS h3 in +omit [T2Space S] in +/-- No walk of length at most `n` joins two poles when `dist` is large. -/ +theorem no_short_walk {n : ℕ} (hd : ((n + 2 : ℕ) : ℕ∞) < 2 * Painting.dist D.rad) {p q : Shat} + (hp : p ∈ D.rad.poles) (hq : q ∈ D.rad.poles) (hne : p ≠ q) + (W : GraphWalk D.rad.G.toGraph p q) (hW : W.length ≤ n) : False := by + have h₁ := D.two_dist_le hp hq hne W + have h₂ : (W.length : ℕ∞) ≤ ((n + 2 : ℕ) : ℕ∞) := by exact_mod_cast (by omega : W.length ≤ n + 2) + exact absurd (h₁.trans h₂) (not_le.2 hd) + +/-- The step of page 356: from a distance flaw with no short circuit around two poles, we get the +second or the third bullet. -/ +theorem outer_of_flaw [Nonempty S] {n : ℕ} (hn₁ : 1 ≤ n) (hn : n < D.rep) (hd : + ((n + 2 : ℕ) : ℕ∞) < 2 * Painting.dist D.rad) + (hNP : ¬ ∃ C, D.IsPairCircuit n C) {r₁ r₂ : Shat} (h₁ : r₁ ∈ D.rad.poles) + (h₂ : r₂ ∈ D.rad.poles) (hne : r₁ ≠ r₂) (hdist : D.vDist r₁ r₂ ≤ n) : + ∃ 𝓓 K, IsOuterData D n 𝓓 K := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hrep : 1 ≤ D.rep := by omega + have ha₁ : D.rad.atomOf r₁ = D.rad.regionOf r₁ := by + classical + unfold RadialDrawing.atomOf + rw [ite_eq_right h₁.1.2] + have ha₂ : D.rad.atomOf r₂ = D.rad.regionOf r₂ := by + classical + unfold RadialDrawing.atomOf + rw [ite_eq_right h₂.1.2] + have hreg : D.rad.regionOf r₁ ≠ D.rad.regionOf r₂ := fun heq ↦ by + obtain ⟨-, -, hG3, -⟩ := id D.rad.isPreRadial + have m₁ := D.rad.regionOf_mem h₁.1 + have m₂ := D.rad.regionOf_mem h₂.1 + exact hne ((hG3 _ m₁.1).unique ⟨m₁.2, h₁.1.1⟩ ⟨heq ▸ m₂.2, h₂.1.1⟩) + have hv : D.vDist r₁ r₂ = D.dist (D.rad.regionOf r₁) (D.rad.regionOf r₂) := by + rw [vDist, ha₁, ha₂] + have hd' : D.dist (D.rad.regionOf r₁) (D.rad.regionOf r₂) < D.rep := by omega + obtain ⟨T, hm₁, hm₂, hl⟩ := D.exists_of_dist_lt hreg hd' + have hr₁ := D.center_mem_ins hrep h₁.1 T hm₁ + have hr₂ := D.center_mem_ins hrep h₂.1 T hm₂ + obtain ⟨hY, hlY⟩ := isRestraint_ins D hrep T + have hA : ∀ {r : Shat}, r ∈ D.rad.poles → ({r} : Set Shat) ∈ D.rad.G.A := fun {r} hr ↦ Or.inl + (Or.inl ⟨r, hr.1.1, rfl⟩) + have hlen : perimeterWalkLength D.rad.G T.ins ≤ 2 * n := by omega + rcases GM11.exists_pieces hT (D.isSlope hrep) (hA h₁) (hA h₂) hY (singleton_subset_iff.2 hr₁) + (singleton_subset_iff.2 hr₂) with + ⟨A, G, hP, ht₁, ht₂⟩ | ⟨A, G, B, H, hP, hP', ht₁, ht₂, -, a, b, Q, Z₁, Z₂, ha, hb, hZ₁, hZ₂, + hl'⟩ + · exfalso + have hA₁ : r₁ ∈ A := ht₁ rfl + have hA₂ : r₂ ∈ A := ht₂ rfl + obtain ⟨x, hx⟩ := hP.Vne + obtain ⟨Z, hZ, hc⟩ := hP.walk x hx + have hZl : Z.length ≤ 2 * n := (length_le_of_count hT hY (fun e he ↦ mem_E_of_mem_edges Z he) + hc).trans hlen + have hboth : ∀ {r : Shat}, r ∈ G.V → r ∈ Z.support := fun {r} hr ↦ by rwa [← hZ, walkDrawing_V] + at hr + have hclose : r₁ ∈ G.V → r₂ ∈ G.V → False := fun h h' ↦ by + obtain ⟨W, hW, -, -⟩ := exists_half_walk Z (hboth h) (hboth h') + exact no_short_walk hd h₁ h₂ hne W (by omega) + rcases hP.kind with ⟨hc', rfl⟩ | ⟨e, u, v, -, -, hset, hV, -, rfl, -⟩ | ⟨v, hV, -, rfl, -⟩ + · have hC : GM19.Drawing.IsCircuitOf G D.rad.G := ⟨walkDrawing_isSubdrawing D.rad.G Z |> fun h + ↦ hZ ▸ h, hc'⟩ + have hGl : G.E.ncard ≤ Z.length := hZ ▸ ncard_E_le_length D.rad.G Z + exact hNP ⟨G, hC, by omega, r₁, h₁, r₂, h₂, hne, hA₁, hA₂⟩ + · have m₁ : r₁ ∈ closure e ∩ D.rad.G.V := ⟨hA₁, h₁.1.1⟩ + have m₂ : r₂ ∈ closure e ∩ D.rad.G.V := ⟨hA₂, h₂.1.1⟩ + rw [hset, ← hV] at m₁ m₂ + exact hclose m₁ m₂ + · exact hne (hA₁.trans hA₂.symm) + · obtain ⟨A', a', Q', ℓ₁, hE₁, ha', hl₁⟩ := end_of_piece hS h3 hP h₁ (ht₁ rfl) Z₁ hZ₁ ha + (by omega) Q + obtain ⟨B', b', Q'', ℓ₂, hE₂, hb', hl₂⟩ := end_of_piece hS h3 hP' h₂ (ht₂ rfl) Z₂ hZ₂ hb + (by omega) Q'.reverse + rw [GraphWalk.length_reverse] at hl₂ + rcases hE₁ with rfl | ⟨C₁, hC₁, hc₁, rfl, hi₁, hlink₁⟩ <;> rcases hE₂ with rfl | ⟨C₂, hC₂, hc₂, + rfl, hi₂, hlink₂⟩ + · obtain rfl : a' = r₁ := ha' + obtain rfl : b' = r₂ := hb' + exact (no_short_walk hd h₁ h₂ hne Q''.reverse (by rw [GraphWalk.length_reverse]; omega)).elim + · obtain rfl : a' = r₁ := ha' + exact outer_of_disc_pole hS h3 hn₁ hn hd hNP hC₂ hlink₂ h₂ hi₂ h₁ hne.symm hb' Q'' (by omega) + · obtain rfl : b' = r₂ := hb' + exact outer_of_disc_pole hS h3 hn₁ hn hd hNP hC₁ hlink₁ h₁ hi₁ h₂ hne ha' Q''.reverse + (by rw [GraphWalk.length_reverse]; omega) + · exact outer_of_discs hS h3 hn₁ hn hd hNP hC₁ hC₂ hlink₁ hlink₂ h₁ h₂ hne hi₁ hi₂ ha' hb' + Q''.reverse (by rw [GraphWalk.length_reverse]; omega) + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10s.lean b/LeanPool/GraphMinor/GM19/Section10s.lean new file mode 100644 index 0000000000..2eff58f014 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10s.lean @@ -0,0 +1,128 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10r + +import LeanPool.GraphMinor.GM19.FeatureCount + +import LeanPool.GraphMinor.GM19.FragmentOrient + +/-! +# Graph Minors XIX, (10.4) +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + + +/-- The existence of a distance flaw (Graph Minors XIX, pages 355 and 356: "it follows from Theorem +9.2 of [6] that there exists $F \subseteq \Gamma" and "By 8.5 we may choose $F$ such that every +circuit of $F$ is $\lambda$-linked to $\mathscr{T}$"), in the form that the proof of (10.4) +uses. -/ +theorem distanceFlaw {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + (D : TangleDatum cap χ) {n : ℕ} (hn₁ : 1 ≤ n) + (hf : D.IsFlawedInDistance n) : ∃ (𝓓 : Set (Set Shat)) (K : Drawing S), IsOuterData D n 𝓓 K + := by + obtain ⟨hn, hd, r₁, h₁, r₂, h₂, hne, hdist⟩ := hf + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + obtain ⟨Θ, hΘ, -, -⟩ := D.rad.pole_cases h₁ + obtain ⟨x, -, -⟩ := hΘ + have : Nonempty S := ⟨x⟩ + by_cases hNP : ∃ C, D.IsPairCircuit n C + · exact TangleDatum.exists_outer_of_pair hS h3 hn hd hNP + · exact TangleDatum.outer_of_flaw hS h3 hn₁ hn hd hNP h₁ h₂ hne hdist + +omit [T2Space Shat] in +/-- A class of places for each admissible feature yields one class for all bounded features. +The finite list of representatives comes from (5.2), and their frame-preserving equivalences +transport the data for each place. -/ +theorem exists_wellBehavedPlaces_of_bounded_features + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} (hd : χ.IsDisjoint) + {𝒮 : Set (ColouredPainting χ)} (bound order : ℕ) + (Data : TangleDatum cap χ → Drawing S → Prop) + (hClass : ∀ Kc : Drawing S, (∃ D, Data D Kc) → + ∃ B : Set (Place χ), IsWellBehavedPlaces B ∧ + ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → order ≤ D.ord → + ∀ K : Drawing S, Data D K → FeatureEquiv χ.Φ Kc K → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb order D.ord D.𝒯 ∧ + (⟨hd, D.P, L⟩ : Place χ) ∈ B) : + ∃ B : Set (Place χ), IsWellBehavedPlaces B ∧ + ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → order ≤ D.ord → + ∀ K : Drawing S, Data D K → IsFeature χ.Φ K → K.V.ncard + K.E.ncard ≤ bound → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb order D.ord D.𝒯 ∧ + (⟨hd, D.P, L⟩ : Place χ) ∈ B := by + classical + obtain ⟨𝓕, hf, h𝓕⟩ := theorem_5_2_proof S χ.isSurface χ.connected χ.Φ bound + let Good : Drawing S → Prop := fun K => ∃ D, Data D K + have hpick : ∀ K₀, ∃ K', ∀ K, Good K → FeatureEquiv χ.Φ K₀ K → + Good K' ∧ FeatureEquiv χ.Φ K₀ K' := by + intro K₀ + by_cases h : ∃ K, Good K ∧ FeatureEquiv χ.Φ K₀ K + · obtain ⟨K, hGood, hEq⟩ := h + exact ⟨K, fun _ _ _ => ⟨hGood, hEq⟩⟩ + · exact ⟨K₀, fun K hGood hEq => absurd ⟨K, hGood, hEq⟩ h⟩ + choose p hp using hpick + have hB : ∀ Kc, ∃ B : Set (Place χ), IsWellBehavedPlaces B ∧ + (Good Kc → ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → order ≤ D.ord → + ∀ K : Drawing S, Data D K → FeatureEquiv χ.Φ Kc K → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb order D.ord D.𝒯 ∧ + (⟨hd, D.P, L⟩ : Place χ) ∈ B) := by + intro Kc + by_cases hGood : Good Kc + · obtain ⟨B, hB, hMem⟩ := hClass Kc hGood + exact ⟨B, hB, fun _ => hMem⟩ + · exact ⟨∅, fun Ω hΩ seq hseq => absurd (hseq 0) (notMem_empty _), + fun h => absurd h hGood⟩ + choose B hBw hBm using hB + have : Finite 𝓕 := hf + refine ⟨⋃ K₀ : 𝓕, B (p K₀.1), IsWellBehavedPlaces.iUnion fun _ => hBw _, ?_⟩ + intro D hm hord K hData hFeature hSize + obtain ⟨K₀, hK₀, f, hfp, hfU, hfV⟩ := h𝓕 K hFeature hSize + obtain ⟨hGood, g, hgp, hgU, hgV⟩ := hp K₀ K ⟨D, hData⟩ ⟨f, hfp, hfU, hfV⟩ + have hImage {A B C : Set S} (hg : g '' A = B) (hf : f '' A = C) : + (g.symm.trans f) '' B = C := by + rw [show (g.symm.trans f) '' B = f '' (g.symm '' B) by rw [image_image]; rfl, + ← hg, symm_image_image', hf] + obtain ⟨L, hL, hmem⟩ := hBm (p K₀) hGood D hm hord K hData + ⟨g.symm.trans f, hgp.symm.trans hfp, hImage hgU hfU, hImage hgV hfV⟩ + exact ⟨L, hL, mem_iUnion.2 ⟨⟨K₀, hK₀⟩, hmem⟩⟩ + +/-- **Graph Minors XIX, (10.4)** (page 356), from (5.2), the orientation of a fragment and the +fragment outside a distance flaw. -/ +theorem theorem_10_4_proof : Theorem104Statement.{w} := by + intro S Shat _ _ _ _ β _ cap χ hd 𝒮 hcl hS3 n hn + classical + have hS := χ.isSurface + let a₀ : β := Classical.arbitrary β + let Data : TangleDatum cap χ → Drawing S → Prop := + fun D K => ∃ 𝓓 : Set (Set Shat), IsOuterData D n 𝓓 K + obtain ⟨B, hB, hMem⟩ := exists_wellBehavedPlaces_of_bounded_features hd (𝒮 := 𝒮) + (8 * n) (n + 1) Data (fun Kc hGood => by + obtain ⟨B, hB, hMem⟩ := exists_class_outer hS hd hcl n a₀ hS3 (Kc := Kc) hGood + refine ⟨B, hB, ?_⟩ + rintro D hm hord K ⟨𝓓, hData⟩ ⟨f, hfp, hfU, hfV⟩ + exact hMem D hm hord 𝓓 K f hData hfp hfU hfV) + refine ⟨B, hB, fun D hm hfl => ?_⟩ + obtain ⟨𝓓, K, hK⟩ := distanceFlaw D hn hfl + have hord : n + 1 ≤ D.ord := by + have h₁ := hfl.1 + have h₂ : D.rep ≤ D.ord := (tangleRep_spec D.rad D.ord D.𝒯).1 + omega + exact hMem D hm hord K ⟨𝓓, hK⟩ hK.feature hK.size + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section10t.lean b/LeanPool/GraphMinor/GM19/Section10t.lean new file mode 100644 index 0000000000..03ee58d7fb --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section10t.lean @@ -0,0 +1,66 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FreeData +public import LeanPool.GraphMinor.GM19.FeatureCount +public import LeanPool.GraphMinor.GM19.Section10s + +import LeanPool.GraphMinor.GM19.FragmentOrient + +/-! +# Corrected Graph Minors XIX, (10.5) + +As in the proof of (10.4) we pick one feature in each class of (5.2), and use `exists_class_free` +for it. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + + +/-- The data of a freedom flaw. -/ +theorem freedomFlaw {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + (D : TangleDatum cap χ) {n : ℕ} + (hf : D.IsFlawedInFreedom n) : ∃ Δ Z K, IsFreeData D n Δ Z K := by + obtain ⟨hn, hd, F, hF, hc, h⟩ := hf + exact TangleDatum.exists_free_data χ.isSurface D.P.fits.internally_three_connected hn hd ⟨F, + hF, hc, h⟩ + +/-- Corrected Graph Minors XIX, (10.5) (page 357). The proof uses $\mathbf{S}_3$ for a +fragment with fewer cuffs and $\mathbf{S}_4$ for a refinement. -/ +theorem theorem_10_5_proof : Theorem105Statement.{w} := by + intro S Shat _ _ _ _ β _ cap χ hd 𝒮 hcl hS3 hS4 n + classical + have hS := χ.isSurface + let a₀ : β := Classical.arbitrary β + let Data : TangleDatum cap χ → Drawing S → Prop := + fun D K => ∃ Δ Z : Set Shat, IsFreeData D n Δ Z K + obtain ⟨B, hB, hMem⟩ := exists_wellBehavedPlaces_of_bounded_features hd (𝒮 := 𝒮) + (8 * n) (n + 1) Data (fun Kc hGood => by + obtain ⟨B, hB, hMem⟩ := exists_class_free hS hd hcl n a₀ hS3 hS4 (Kc := Kc) hGood + refine ⟨B, hB, ?_⟩ + rintro D hm hord K ⟨Δ, Z, hData⟩ ⟨f, hfp, hfU, hfV⟩ + exact hMem D hm hord Δ Z K f hData hfp hfU hfV) + refine ⟨B, hB, fun D hm hfl => ?_⟩ + obtain ⟨Δ, Z, K, hK⟩ := freedomFlaw D hfl + have hord : n + 1 ≤ D.ord := by + have h₁ := hfl.1 + have h₂ : D.rep ≤ D.ord := (tangleRep_spec D.rad D.ord D.𝒯).1 + omega + exact hMem D hm hord K ⟨Δ, Z, hK⟩ hK.feature hK.size + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section11a.lean b/LeanPool/GraphMinor/GM19/Section11a.lean new file mode 100644 index 0000000000..0d05e3e43b --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section11a.lean @@ -0,0 +1,213 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Order.Basic +public import Mathlib.Tactic.Linarith +public import Mathlib.Data.Nat.Find +public import Mathlib.Tactic.Push + +/-! +# Graph Minors XIX, Section 11: the sequence argument of (11.2) + +The proof of (11.2) walks along the edges `e₀, e₁, …, e_{k+1}` bordering a long side. It only uses +which intervals `[i, j]` of edges are covered by a short bite. This file does that part for an +abstract relation `N i j`, read as "`i ≪ j` fails". So `N i j` says that one short bite covers +`e_i, …, e_j`. The relation is monotone, and it holds for `i = j`. The paper uses that it holds for +neighbours, but `e_i, e_{i+1}` need not lie in one bite when the cuff has only these two edges, and +the argument does not need it if we allow `a_{i+1} = b_i` and `b_{p+1} = k + 1`. + +Given a chain `0 = b₀ < a₁ < b₁ < ⋯ < b_p` as in the paper, `exists_step` either extends the chain, +or finishes with the last pair `a_{p+1}, b_{p+1}`. These are the steps (2) and (3) of the paper. The +result used later is `exists_final`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +/-- The data `0 = b₀ ≤ a₁ < b₁ ≤ a₂ < ⋯ < b_p < k + 1` of the proof of (11.2). Here `P h j` says +that +`φ(e_j) ≥ ω_{h+1}`, and `N i j` says that `i ≪ j` fails. -/ +structure SideChain (N : ℕ → ℕ → Prop) (P : ℕ → ℕ → Prop) (k p : ℕ) (a b : ℕ → ℕ) : Prop where + b_zero : b 0 = 0 + b_le_a : ∀ i < p, b i ≤ a (i + 1) + a_lt_b : ∀ i < p, a (i + 1) < b (i + 1) + far : ∀ i < p, ¬ N (b i) (b (i + 1)) + near : ∀ i < p, N (b i) (a (i + 1)) + label : ∀ i < p, P i (b (i + 1)) + gap : ∀ i < p, ∀ j, a (i + 1) < j → j < b (i + 1) → ¬ P i j + lt_end : b p < k + 1 + far_end : ¬ N (b p) (k + 1) + +/-- The last pair `a_{p+1}, b_{p+1}`, as in (3) of the proof of (11.2). -/ +structure SideFinal (N : ℕ → ℕ → Prop) (P : ℕ → ℕ → Prop) (k p : ℕ) (b₀ a' b' : ℕ) : Prop where + le₁ : b₀ ≤ a' + lt₂ : a' < b' + le₃ : b' ≤ k + 1 + near₁ : N b₀ a' + near₂ : N b' (k + 1) + gap : ∀ j, a' < j → j < b' → ¬ P p j + +variable {N : ℕ → ℕ → Prop} {P : ℕ → ℕ → Prop} {k : ℕ} + +/-- A largest `i` in `[c, d)` with `N c i`, when `N c c` and `c < d`. -/ +theorem exists_largest {c d : ℕ} (hc : N c c) (hd : c < d) : + ∃ i, c ≤ i ∧ i < d ∧ N c i ∧ ∀ j, i < j → j < d → ¬ N c j := by + classical + obtain ⟨d', rfl⟩ : ∃ d', d = d' + 1 := ⟨d - 1, by omega⟩ + have hspec := Nat.findGreatest_spec (P := fun i ↦ c ≤ i ∧ N c i) (m := c) (n := d') + (by omega) ⟨le_rfl, hc⟩ + have hle := Nat.findGreatest_le (P := fun i ↦ c ≤ i ∧ N c i) d' + refine ⟨_, hspec.1, by omega, hspec.2, fun j hj hjd hN ↦ ?_⟩ + have := Nat.le_findGreatest (P := fun i ↦ c ≤ i ∧ N c i) (m := j) (n := d') + (by omega) ⟨by omega, hN⟩ + omega + +/-- A least `j` above `i` with the property `Q`, when some `j₀ > i` has it. -/ +theorem exists_least {Q : ℕ → Prop} {i j₀ : ℕ} (hi : i < j₀) (hj₀ : Q j₀) : + ∃ j, i < j ∧ j ≤ j₀ ∧ Q j ∧ ∀ l, i < l → l < j → ¬ Q l := by + classical + have hex : ∃ j, i < j ∧ Q j := ⟨j₀, hi, hj₀⟩ + obtain ⟨h₁, h₂⟩ := Nat.find_spec hex + refine ⟨Nat.find hex, h₁, Nat.find_min' hex ⟨hi, hj₀⟩, h₂, fun l hl hlt hQ ↦ ?_⟩ + exact Nat.find_min hex hlt ⟨hl, hQ⟩ + +/-- One step of the proof of (11.2). A chain of length `p` extends to a chain of length `p + 1`, as +in +(2) of the paper, or it ends with a last pair, as in (3). -/ +theorem exists_step (hmono : ∀ i j i' j', i ≤ i' → i' ≤ j' → j' ≤ j → N i j → N i' j') + (hself : ∀ i ≤ k + 1, N i i) {p : ℕ} {a b : ℕ → ℕ} (hc : SideChain N P k p a b) : + (∃ a' b', SideFinal N P k p (b p) a' b') ∨ ∃ a' b', SideChain N P k (p + 1) a' b' := by + have hbk := hc.lt_end + have hadjb := hself (b p) (by omega) + by_cases h2 : ∃ j, b p < j ∧ j < k + 1 ∧ ¬ N (b p) j ∧ ¬ N j (k + 1) ∧ P p j + · right + obtain ⟨j, hj₁, hj₂, hj₃, hj₄, hj₅⟩ := h2 + obtain ⟨i, hi₁, hi₂, hi₃, hi₄⟩ := exists_largest hadjb hj₁ + obtain ⟨j', hj'₁, hj'₂, hj'₃, hj'₄⟩ := exists_least (Q := P p) hi₂ hj₅ + let a' : ℕ → ℕ := fun l ↦ if l = p + 1 then i else a l + let b' : ℕ → ℕ := fun l ↦ if l = p + 1 then j' else b l + have ha' : ∀ l ≤ p, a' l = a l := fun l hl ↦ ite_eq_right (by omega) + have hb' : ∀ l ≤ p, b' l = b l := fun l hl ↦ ite_eq_right (by omega) + have ha'p : a' (p + 1) = i := ite_eq_left rfl + have hb'p : b' (p + 1) = j' := ite_eq_left rfl + have hfar : ¬ N (b p) j' := by + rcases Nat.lt_or_ge j' j with h | h + · exact hi₄ j' hj'₁ h + · have : j' = j := by omega + exact this ▸ hj₃ + refine ⟨a', b', ?_⟩ + refine + { b_zero := by rw [hb' 0 (by omega)]; exact hc.b_zero + b_le_a := fun l hl ↦ ?_ + a_lt_b := fun l hl ↦ ?_ + far := fun l hl ↦ ?_ + near := fun l hl ↦ ?_ + label := fun l hl ↦ ?_ + gap := fun l hl m h₁ h₂ ↦ ?_ + lt_end := by rw [hb'p]; omega + far_end := by + rw [hb'p] + exact fun h ↦ hj₄ (hmono _ _ _ _ hj'₂ (by omega) le_rfl h) } + all_goals + rcases Nat.lt_or_ge l p with hlp | hlp + · rw [hb' l hlp.le, ha' (l + 1) hlp] + exact hc.b_le_a l hlp + · obtain rfl : l = p := by omega + rw [hb' _ le_rfl, ha'p] + exact hi₁ + · rw [ha' (l + 1) hlp, hb' (l + 1) hlp] + exact hc.a_lt_b l hlp + · obtain rfl : l = p := by omega + rw [ha'p, hb'p] + exact hj'₁ + · rw [hb' l hlp.le, hb' (l + 1) hlp] + exact hc.far l hlp + · obtain rfl : l = p := by omega + rw [hb' _ le_rfl, hb'p] + exact hfar + · rw [hb' l hlp.le, ha' (l + 1) hlp] + exact hc.near l hlp + · obtain rfl : l = p := by omega + rw [hb' _ le_rfl, ha'p] + exact hi₃ + · rw [hb' (l + 1) hlp] + exact hc.label l hlp + · obtain rfl : l = p := by omega + rw [hb'p] + exact hj'₃ + · rw [ha' (l + 1) hlp] at h₁ + rw [hb' (l + 1) hlp] at h₂ + exact hc.gap l hlp m h₁ h₂ + · obtain rfl : l = p := by omega + rw [ha'p] at h₁ + rw [hb'p] at h₂ + exact hj'₄ m h₁ h₂ + · left + push Not at h2 + obtain ⟨i, hi₁, hi₂, hi₃, hi₄⟩ := exists_largest hadjb hbk + obtain ⟨i', hi'₁, hi'₂, hi'₃, hi'₄⟩ := + exists_least (Q := fun j ↦ N j (k + 1)) hi₂ (hself (k + 1) le_rfl) + refine ⟨i, i', ⟨hi₁, hi'₁, hi'₂, hi₃, hi'₃, fun j hj₁ hj₂ hP ↦ ?_⟩⟩ + have hj : j < k + 1 := by omega + exact h2 j (by omega) hj (hi₄ j hj₁ hj) (hi'₄ j hj₁ hj₂) hP + +/-- A number between `lo 0` and `hi (p + 1)` in none of the intervals `[lo i, hi i]` lies in a gap +between two of them. -/ +theorem exists_gap {lo hi : ℕ → ℕ} {p j : ℕ} (h0 : lo 0 ≤ j) (hlast : j ≤ hi (p + 1)) (hn : ∀ i + ≤ p + 1, ¬ (lo i ≤ j ∧ j ≤ hi i)) : + ∃ i ≤ p, hi i < j ∧ j < lo (i + 1) := by + classical + have hspec := Nat.findGreatest_spec (P := fun i ↦ lo i ≤ j) (m := 0) (n := p + 1) + (Nat.zero_le _) h0 + have hle := Nat.findGreatest_le (P := fun i ↦ lo i ≤ j) (p + 1) + set i := Nat.findGreatest (fun i ↦ lo i ≤ j) (p + 1) with hi' + have hlt : hi i < j := by + by_contra hc + exact hn i hle ⟨hspec, not_lt.1 hc⟩ + have hip : i ≠ p + 1 := by + rintro he + rw [he] at hlt + omega + refine ⟨i, by omega, hlt, ?_⟩ + by_contra hc + have := Nat.le_findGreatest (P := fun i ↦ lo i ≤ j) (m := i + 1) (n := p + 1) (by omega) + (not_lt.1 hc) + omega + +/-- The conclusion of the sequence argument of (11.2). If there is no chain of length `m` and `0 ≪ k ++ 1` +holds, then some chain of length `p < m` ends with a last pair. -/ +theorem exists_final (hmono : ∀ i j i' j', i ≤ i' → i' ≤ j' → j' ≤ j → N i j → N i' j') + (hself : ∀ i ≤ k + 1, N i i) (hstart : ¬ N 0 (k + 1)) {m : ℕ} (hno : ∀ a b, ¬ SideChain N P k m + a b) : + ∃ p < m, ∃ a b, SideChain N P k p a b ∧ ∃ a' b', SideFinal N P k p (b p) a' b' := by + have hind : ∀ q ≤ m, (∃ p < q, ∃ a b, SideChain N P k p a b ∧ + ∃ a' b', SideFinal N P k p (b p) a' b') ∨ ∃ a b, SideChain N P k q a b := by + intro q + induction q with + | zero => + intro _ + refine Or.inr ⟨fun _ ↦ 0, fun _ ↦ 0, ?_⟩ + exact ⟨rfl, fun _ h ↦ absurd h (by omega), fun _ h ↦ absurd h (by omega), + fun _ h ↦ absurd h (by omega), fun _ h ↦ absurd h (by omega), fun _ h ↦ absurd h (by omega), + fun _ h ↦ absurd h (by omega), by omega, hstart⟩ + | succ q ih => + intro hq + rcases ih (by omega) with ⟨p, hp, h⟩ | ⟨a, b, hc⟩ + · exact Or.inl ⟨p, by omega, h⟩ + · rcases exists_step hmono hself hc with hf | hc' + · exact Or.inl ⟨q, by omega, a, b, hc, hf⟩ + · exact Or.inr hc' + rcases hind m le_rfl with h | ⟨a, b, hc⟩ + · exact h + · exact absurd hc (hno a b) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section11b.lean b/LeanPool/GraphMinor/GM19/Section11b.lean new file mode 100644 index 0000000000..7aed458bfe --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section11b.lean @@ -0,0 +1,503 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.BiteArc +public import LeanPool.GraphMinor.GM19.SideEdges +public import LeanPool.GraphMinor.GM19.Section11a + +/-! +# Graph Minors XIX, (11.2) + +A datum flawed on a side has a feast of order at most `(m + 1)n`. Each edge of the cuff lies in a +bite of length at most 6 (`exists_bite_of_edge`), and +the walk along the side of `Section11a.lean` picks the bites. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +namespace TangleDatum + +variable {D : TangleDatum cap χ} + +omit [T2Space S] [T2Space Shat] in +/-- A point of a subdrawing of `Γ*` in the cuff disc of `r` shows that `r` is on the subdrawing. -/ +theorem pole_mem_of_meet {F : Drawing Shat} (hF : F.IsSubdrawing D.rad.G) {r : Shat} + (hr : r ∈ D.rad.poles) {Θ : Set S} (hΘ : Θ ∈ cuffs S) + (hreg : D.rad.regionOf r = cap.cuffDisc Θ) {x : Shat} (hx : x ∈ F.U) + (hxd : x ∈ cap.cuffDisc Θ) : r ∈ F.V := by + have : ConnectedSpace Shat := cap.connected + have hxr : x ∉ range cap.emb := cap.notMem_range hΘ hxd + have hG3 := D.rad.isPreRadial.2.2.1 + have huniq : ∀ {w}, w ∈ D.rad.Rstar → x ∈ D.rad.regionOf w → w = r := fun {w} hw hxw ↦ by + have hm := D.rad.regionOf_mem hw + have hm' := D.rad.regionOf_mem hr.1 + have hxr' : x ∈ D.rad.regionOf r := hreg ▸ hxd + have he : D.rad.regionOf w = D.rad.regionOf r := + (connectedComponentIn_eq hxw).trans (connectedComponentIn_eq hxr').symm + exact (hG3 _ hm'.1).unique ⟨he ▸ hm.2, hw.1⟩ ⟨hm'.2, hr.1.1⟩ + by_cases hxV : x ∈ F.V + · have hw : x ∈ D.rad.Rstar := ⟨hF.1 hxV, fun ⟨v, _, hv⟩ ↦ hxr ⟨v, hv⟩⟩ + rw [← huniq hw (D.rad.regionOf_mem hw).2] + exact hxV + · obtain ⟨f, hf, hxf⟩ := F.exists_edge_of_mem hx hxV + obtain ⟨v, -, w, hw, hset⟩ := D.rad.edge_ends (hF.2 hf) + have hwm : w ∈ closure f ∩ D.rad.G.V := by rw [hset]; exact Or.inr rfl + have hwF : w ∈ F.V := mem_V_of_mem_U hF (F.closure_subset_U hf hwm.1) hwm.2 + rw [← huniq hw (D.rad.edge_subset_region (hF.2 hf) hw hset hxf)] + exact hwF + +/-- From the length of a circuit, with poles far apart: the circuit has at most the one pole `r`. -/ +theorem bite_shape_of_far (hS : IsSurface S) (h3 : D.P.Γ.IsInternallyThreeConnected) {N : ℕ} + (hN : N < D.rep) + (hd : ∀ r₁ ∈ D.rad.poles, ∀ r₂ ∈ D.rad.poles, r₁ ≠ r₂ → N < D.vDist r₁ r₂) {r : Shat} {F : + Drawing Shat} (hF : F.IsCircuitOf D.rad.G) (hc : F.E.ncard ≤ 2 * N) + (hr : r ∈ D.rad.poles) {Θ : Set S} (hΘ : Θ ∈ cuffs S) (hreg : D.rad.regionOf r + = cap.cuffDisc Θ) (hrF : r ∈ F.V) : + ∃ v₁ v₂ Β L A A' Di Do, D.IsBiteShape r Θ F v₁ v₂ Β L A A' Di Do := by + have hlt : F.E.ncard < 2 * D.rep := by omega + refine exists_bite_shape hS h3 hF hlt hr hΘ hreg hrF fun p hp hpF ↦ ?_ + by_contra hne + have h₁ := vDist_le_of_ins hN hF hc hp hr hne (D.U_subset_ins hF hlt (F.V_subset_U hpF)) + (D.U_subset_ins hF hlt (F.V_subset_U hrF)) + have h₂ := hd p hp r hr hne + omega + +/-- **Each edge on a cuff lies in a short bite**, when no circuit is a flaw in freedom. -/ +theorem exists_bite_of_edge {N : ℕ} (hN : 3 ≤ N) (hrep : 4 ≤ D.rep) + (hfree : ∀ C, ¬ D.IsFreeCircuit N C) {side : Set S} (hside : side ∈ χ.Φ.longSides) {Θ : Set S} + (hsΘ : side ⊆ Θ) (hΘ : Θ ∈ cuffs S) {r : Shat} (hr : r ∈ D.rad.poles) (hreg : D.rad.regionOf r + = cap.cuffDisc Θ) {c : Set S} (hc : c ∈ D.P.Γ.E) (hcΘ : c ⊆ Θ) : + ∃ F, D.IsBiteAt r F ∧ F.E.ncard ≤ 6 ∧ cap.emb '' c ⊆ D.ins F := by + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have : ConnectedSpace Shat := cap.connected + obtain ⟨s, hs, hcs⟩ := D.exists_region_of_edge hc + obtain ⟨F, hF, h6, hsi⟩ := D.exists_circuit_around hrep hc hs hcs + have hlt : F.E.ncard < 2 * D.rep := by omega + have hi := D.ins_spec hF hlt + have hins : cap.emb '' c ⊆ D.ins F := hcs.trans hsi + have hbite : ∀ {F'}, F'.IsCircuitOf D.rad.G → F'.E.ncard < 2 * D.rep → r ∈ F'.V → D.IsBiteAt r F' + := fun h₁ h₂ h₃ ↦ ⟨hr, h₁, h₂, h₃⟩ + by_cases hrF : r ∈ F.V + · exact ⟨F, hbite hF hlt hrF, h6, hins⟩ + exfalso + have hdis : Disjoint (cap.cuffDisc Θ) F.U := disjoint_left.2 fun x hx hxF ↦ hrF + (pole_mem_of_meet hF.1 hr hΘ hreg hxF hx) + have hrd : r ∈ cap.cuffDisc Θ := hreg ▸ (D.rad.regionOf_mem hr.1).2 + obtain ⟨x, hx⟩ := hc.1 + by_cases hri : r ∈ D.ins F + · have hconn : IsPreconnected (cap.cuffDisc Θ) := hreg ▸ isPreconnected_connectedComponentIn + have hsub : cap.cuffDisc Θ ⊆ discInt (D.ins F) := by + rcases hi.2.2.1.side hman hconn (by rw [hi.2.2.2.1]; exact hdis) with h | h + · exact h + · exact absurd hri (disjoint_left.1 h hrd) + have hcl : closure (cap.cuffDisc Θ) ⊆ D.ins F := closure_minimal (hsub.trans + (discInt_subset _)) hi.2.2.1.isClosed + refine hfree F ⟨hF, by omega, Or.inl ⟨side, hside, ?_⟩⟩ + rintro _ ⟨y, hy, rfl⟩ + exact hcl (cap.mem_closure_emb hΘ (hsΘ hy)) + · have hm : cap.emb x ∈ F.U := D.cuff_inter_ins_of_disjoint hF hlt hr hri hreg hdis + (cap.mem_closure_emb hΘ (hcΘ hx)) (hins (mem_image_of_mem _ hx)) + exact disjoint_left.1 (disc_edge_disjoint D.rad hF.1 hc) (mem_image_of_mem _ hx) hm + +omit [T2Space S] [T2Space Shat] in +/-- What `l(e₁, e₂) ≤ n` says. -/ +theorem exists_bite_of_dist_le {r : Shat} {c₁ c₂ : Set S} {n : ℕ} (hn : n < D.rep) + (h : D.borderEdgeDist r c₁ c₂ ≤ n) : + ∃ F, D.IsBiteAt r F ∧ cap.emb '' c₁ ⊆ D.ins F ∧ cap.emb '' c₂ ⊆ D.ins F ∧ F.E.ncard ≤ 2 * n + := by + classical + have : ConnectedSpace Shat := cap.connected + unfold borderEdgeDist at h + split_ifs at h with hex + · obtain ⟨F₀, hF₀, h₁, h₂⟩ := hex + have hne : {k : ℕ | ∃ F : Drawing Shat, D.IsBiteAt r F ∧ cap.emb '' c₁ ⊆ D.ins F + ∧ cap.emb '' c₂ ⊆ D.ins F ∧ F.E.ncard = 2 * k}.Nonempty := + ⟨_, F₀, hF₀, h₁, h₂, D.ncard_E_eq_hat hF₀.is_circuit⟩ + obtain ⟨F, hF, h₃, h₄, h₅⟩ := Nat.sInf_mem hne + exact ⟨F, hF, h₃, h₄, by omega⟩ + · omega + +variable (hS : IsSurface S) (h3 : D.P.Γ.IsInternallyThreeConnected) +include hS h3 + +omit hS h3 in +private theorem exists_feast_of_chain_cover + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [T2Space S] + [TopologicalSpace Shat] + [T2Space Shat] + {cap : IsCappedSurface S Shat} + {β : Type w} + {χ : ColourScheme S β} + {D : TangleDatum cap χ} + {side : Set S} + {n : ℕ} + {ω : List β} : + let m : ℕ := ω.length + ∀ (hm1 : 1 ≤ m), + let N : ℕ := (m + 1) * n + ∀ (Θ : Set S), + ∀ (f : Circle ≃ₜ ↑Θ), + ∀ (a : S), + ∀ (b : S), + ∀ (k : ℕ), + ∀ (t : ℕ → ℝ), + ∀ (e : ℕ → Set S), + ∀ (hsΘ : side ⊆ Θ), + ∀ (hE : IsSideEdges χ D.P.Γ side Θ f a b k t e), + ∀ (r : Shat), + ∀ (hshape : ∀ {F : Drawing Shat}, D.IsBiteAt r F → (Drawing.E F).ncard ≤ 2 * n → ∃ v₁ v₂ Β L A + A' Di Do, D.IsBiteShape r Θ F v₁ v₂ Β L A A' Di Do), + let Nr : ℕ → ℕ → Prop := fun i j => ∃ F, D.IsBiteAt r F ∧ (Drawing.E F).ncard ≤ 2 * n ∧ ∀ (l : + ℕ), i ≤ l → l ≤ j → cap.emb '' e l ⊆ D.ins F + let P : ℕ → ℕ → Prop := fun h j => ∃ (hh : h < ω.length), (χ.ΩS side).le ω[h] (D.P.φ (e j)) + ∀ (hmono : ∀ (i j i' j' : ℕ), i ≤ i' → i' ≤ j' → j' ≤ j → Nr i j → Nr i' j'), + ∀ (hedgeΘ : ∀ {l : ℕ}, l ≤ k + 1 → e l ⊆ Θ), + ∀ (hself : ∀ i ≤ k + 1, Nr i i), + (¬Nr 0 (k + 1)) → + (∀ (a b : ℕ → ℕ), ¬SideChain Nr P k m a b) → + ∃ ℱ, D.IsFeast r side ω ℱ ∧ feastOrder ℱ ≤ N ∧ ∀ F ∈ ℱ, (Drawing.E F).ncard ≤ 2 * n := by + classical + have : ConnectedSpace Shat := cap.connected + intro m hm1 N Θ f a b k t e hsΘ hE r hshape Nr P hmono hedgeΘ hself hstart hnochain + obtain ⟨p, hpm, a₂, b₂, hc, a₁, b₁, hfin⟩ := exists_final hmono hself hstart hnochain + let lo : ℕ → ℕ := fun i ↦ if i ≤ p then b₂ i else b₁ + let hi : ℕ → ℕ := fun i ↦ if i < p then a₂ (i + 1) else if i = p then a₁ else k + 1 + have hlo0 : lo 0 = 0 := by + change (if 0 ≤ p then b₂ 0 else b₁) = 0 + rw [ite_eq_left (Nat.zero_le _), hc.b_zero] + have hlo : ∀ i ≤ p, lo i = b₂ i := fun i h ↦ ite_eq_left h + have hlop : lo (p + 1) = b₁ := ite_eq_right (by omega) + have hi₁ : ∀ i < p, hi i = a₂ (i + 1) := fun i h ↦ ite_eq_left h + have hi₂ : hi p = a₁ := by + change (if p < p then _ else if p = p then _ else _) = _ + rw [ite_eq_right (lt_irrefl _), ite_eq_left rfl] + have hi₃ : hi (p + 1) = k + 1 := by + change (if p + 1 < p then _ else if p + 1 = p then _ else _) = _ + rw [ite_eq_right (by omega), ite_eq_right (by omega)] + have hle1 : ∀ i ≤ p + 1, lo i ≤ hi i := by + intro i h + rcases Nat.lt_trichotomy i p with h' | rfl | h' + · rw [hlo i h'.le, hi₁ i h'] + exact hc.b_le_a i h' + · rw [hlo _ le_rfl, hi₂] + exact hfin.le₁ + · have hip : i = p + 1 := by omega + rw [hip, hlop, hi₃] + exact hfin.le₃ + have hlt1 : ∀ i ≤ p, hi i < lo (i + 1) := by + intro i h + rcases Nat.lt_or_eq_of_le h with h' | rfl + · rw [hi₁ i h', hlo (i + 1) (by omega)] + exact hc.a_lt_b i h' + · rw [hi₂, hlop] + exact hfin.lt₂ + have hstepb : ∀ i i', i < i' → i' ≤ p + 1 → hi i < lo i' := by + intro i i' hii + induction i' with + | zero => omega + | succ i' ih => + intro hle' + rcases Nat.lt_succ_iff_lt_or_eq.1 hii with h' | rfl + · have h₁ := ih h' (by omega) + have h₂ := hle1 i' (by omega) + have h₃ := hlt1 i' (by omega) + omega + · exact hlt1 i (by omega) + have hhile : ∀ i ≤ p + 1, hi i ≤ k + 1 := fun i h ↦ by + rcases Nat.lt_or_eq_of_le h with h' | rfl + · have h₁ := hstepb i (p + 1) h' le_rfl + have h₂ := hle1 (p + 1) le_rfl + omega + · exact hi₃.le + have hN : ∀ i ≤ p + 1, Nr (lo i) (hi i) := by + intro i h + rcases Nat.lt_trichotomy i p with h' | rfl | h' + · rw [hlo i h'.le, hi₁ i h'] + exact hc.near i h' + · rw [hlo _ le_rfl, hi₂] + exact hfin.near₁ + · have hip : i = p + 1 := by omega + rw [hip, hlop, hi₃] + exact hfin.near₂ + have hex : ∀ i, ∃ F, i ≤ p + 1 → D.IsBiteAt r F ∧ F.E.ncard ≤ 2 * n ∧ ∀ l, lo i ≤ l → l ≤ hi i + → cap.emb '' e l ⊆ D.ins F := fun i ↦ by + by_cases h : i ≤ p + 1 + · obtain ⟨F, hb⟩ := hN i h + exact ⟨F, fun _ ↦ hb⟩ + · obtain ⟨F, -⟩ := hN 0 (by omega) + exact ⟨F, fun h' ↦ absurd h' h⟩ + choose G hG using hex + let ℱ : Set (Drawing Shat) := G '' (↑(Finset.range (p + 2)) : Set ℕ) + have hfinF : ℱ.Finite := (Finset.finite_toSet _).image _ + have hcardF : ℱ.ncard ≤ p + 2 := by + refine (ncard_image_le (Finset.finite_toSet _)).trans ?_ + rw [ncard_coe_finset, Finset.card_range] + have hbite : ∀ F ∈ ℱ, D.IsBiteAt r F ∧ F.E.ncard ≤ 2 * n := by + rintro _ ⟨i, hi', rfl⟩ + have := hG i (by have := Finset.mem_range.1 (Finset.mem_coe.1 hi'); omega) + exact ⟨this.1, this.2.1⟩ + have hmemF : ∀ i ≤ p + 1, G i ∈ ℱ := fun i h ↦ mem_image_of_mem _ (Finset.mem_coe.2 + (Finset.mem_range.2 (by omega))) + have hcover : ∀ i ≤ p + 1, ∀ l, lo i ≤ l → l ≤ hi i → cap.emb '' e l ⊆ D.feastArcUnion r ℱ := by + intro i h l h₁ h₂ + obtain ⟨hb, hcard, hl⟩ := hG i h + obtain ⟨v₁, v₂, Β, L, A, A', Di, Do, hsh⟩ := hshape hb hcard + have hlk : l ≤ k + 1 := h₂.trans (hhile i h) + have hsub := hsh.edge_subset (hE.mem l hlk) (hedgeΘ hlk) (hl l h₁ h₂) + intro x hx + exact mem_iUnion₂.2 ⟨G i, hmemF i h, hsub hx⟩ + refine ⟨ℱ, ⟨hfinF, fun F hF ↦ (hbite F hF).1, ?_, fun s hs hne ↦ ?_, fun X hX ↦ ?_⟩, ?_, + fun F hF ↦ (hbite F hF).2⟩ + · omega + · rcases hE.short s hs hne with rfl | rfl + · exact hcover 0 (by omega) 0 (by omega) (Nat.zero_le _) + · exact hcover (p + 1) le_rfl _ (by have := hle1 (p + 1) le_rfl; rw [hi₃] at this; exact this) + hi₃.ge + · obtain ⟨x, hx, rfl⟩ := hX + set Y := side \ cap.emb ⁻¹' D.feastArcUnion r ℱ with hY + have hXsub : connectedComponentIn Y x ⊆ Y := connectedComponentIn_subset _ _ + have hXp : IsPreconnected (connectedComponentIn Y x) := isPreconnected_connectedComponentIn + have hout : ∀ i ≤ p + 1, ∀ l, 1 ≤ l → l ≤ k → lo i ≤ l → l ≤ hi i + → ¬ e l ⊆ connectedComponentIn Y x := by + intro i h l h₁ h₂ h₃ h₄ hsub + obtain ⟨z, -, hz⟩ := hE.exists_point h₁ h₂ + exact (hXsub (hsub hz)).2 (hcover i h l h₃ h₄ (mem_image_of_mem _ hz)) + have hgap : ∀ c ∈ D.Γ.E, c ⊆ connectedComponentIn Y x → ∃ j, 1 ≤ j ∧ j ≤ k ∧ c = e j ∧ ∃ i + ≤ p, hi i < j ∧ j < lo (i + 1) := by + intro c hc₁ hc₂ + obtain ⟨j, h₁, h₂, rfl⟩ := hE.all c hc₁ (hc₂.trans fun _ hz ↦ (hXsub hz).1) + refine ⟨j, h₁, h₂, rfl, exists_gap (by omega) (by omega) fun i h h' ↦ hout i h j h₁ h₂ h'.1 + h'.2 hc₂⟩ + have hsep : ∀ {j j' i i'}, 1 ≤ j → j' ≤ k → e j ⊆ connectedComponentIn Y x + → e j' ⊆ connectedComponentIn Y x → i < i' → i' ≤ p → j < lo (i + 1) → hi i' < j' → False + := by + intro j j' i i' h₁ h₂ h₃ h₄ hii hip h₅ h₆ + have h₇ : lo (i + 1) ≤ hi i' := by + rcases Nat.lt_or_eq_of_le (show i + 1 ≤ i' by omega) with h' | rfl + · have := hstepb (i + 1) i' h' (by omega) + have := hle1 (i + 1) (by omega) + have := hle1 i' (by omega) + omega + · exact hle1 _ (by omega) + have hhb := hE.between_of_side hXp (fun _ hz ↦ (hXsub hz).1) hsΘ h₁ (by omega) h₂ h₃ h₄ (lo + (i + 1)) h₅.le (by omega) + exact hout (i + 1) (by omega) _ (by omega) (by omega) le_rfl (hle1 (i + 1) (by omega)) hhb + have hP : ∀ i ≤ p, ∀ j, hi i < j → j < lo (i + 1) → ¬ P i j := by + intro i h j h₁ h₂ + rcases Nat.lt_or_eq_of_le h with h' | rfl + · rw [hi₁ i h'] at h₁ + rw [hlo (i + 1) (by omega)] at h₂ + exact hc.gap i h' j h₁ h₂ + · rw [hi₂] at h₁ + rw [hlop] at h₂ + exact hfin.gap j h₁ h₂ + by_cases hany : ∃ c ∈ D.Γ.E, c ⊆ connectedComponentIn Y x + · obtain ⟨c₀, hc₀, hc₀X⟩ := hany + obtain ⟨j₀, hj₁, hj₂, rfl, i₀, hi₀, hg₁, hg₂⟩ := hgap c₀ hc₀ hc₀X + refine ⟨i₀, by omega, fun c hc₁ hc₂ hle' ↦ ?_⟩ + obtain ⟨j, h₁, h₂, rfl, i, hi', hg₃, hg₄⟩ := hgap c hc₁ hc₂ + rcases Nat.lt_trichotomy i i₀ with h' | rfl | h' + · exact hsep h₁ hj₂ hc₂ hc₀X h' hi₀ hg₄ hg₁ + · exact hP i hi' j hg₃ hg₄ ⟨by omega, hle'⟩ + · exact hsep hj₁ h₂ hc₀X hc₂ h' hi' hg₂ hg₃ + · exact ⟨0, by omega, fun c hc₁ hc₂ ↦ absurd ⟨c, hc₁, hc₂⟩ hany⟩ + · rw [feastOrder, dite_eq_left hfinF] + calc ∑ F ∈ hfinF.toFinset, F.E.ncard / 2 ≤ hfinF.toFinset.card • n := + Finset.sum_le_card_nsmul _ _ _ fun F hF ↦ by + have := (hbite F (hfinF.mem_toFinset.1 hF)).2 + omega + _ ≤ (m + 1) * n := by + rw [← ncard_eq_toFinset_card _ hfinF, smul_eq_mul] + exact Nat.mul_le_mul_right _ (by omega) + +/-- **Graph Minors XIX, (11.2)** (page 358): "If $(\Gamma, \phi, \lambda, \mathscr{T}) \in +\mathscr{D}$ is $(n, (\omega_1, \dots, +\omega_m))$-flawed on $S$, then there is a feast of order $\le (m + 1)n$." We also say which pole, +and that +each bite has `½|E(F)| ≤ n`. -/ +theorem theorem_11_2_proof {side : Set S} (hside : side ∈ χ.Φ.longSides) {n : ℕ} (hn : 4 + ≤ n) {ω : List β} (hω : ω ≠ []) (hfl : D.IsFlawedOnSide side n ω) : + ∃ (r : Shat) (Θ : Set S), Θ ∈ cuffs S ∧ side ⊆ Θ ∧ r ∈ D.rad.poles ∧ D.rad.regionOf r + = cap.cuffDisc Θ ∧ ∃ ℱ, D.IsFeast r side ω ℱ ∧ feastOrder ℱ ≤ (ω.length + 1) * n ∧ + ∀ F ∈ ℱ, F.E.ncard ≤ 2 * n := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + set m := ω.length with hm + have hm1 : 1 ≤ m := List.length_pos_iff.2 hω + obtain ⟨hrep, hdist, hnd, hnf, hno⟩ := hfl + set N := (m + 1) * n with hNdef + have hnN : 2 * n ≤ N := by rw [hNdef]; nlinarith + have hrepN : N < D.rep := by nlinarith + have hd : ∀ r₁ ∈ D.rad.poles, ∀ r₂ ∈ D.rad.poles, r₁ ≠ r₂ → N < D.vDist r₁ r₂ := by + intro r₁ h₁ r₂ h₂ hne + by_contra hle + exact hnd ⟨hrepN, hdist, r₁, h₁, r₂, h₂, hne, not_lt.1 hle⟩ + have hfree : ∀ C, ¬ D.IsFreeCircuit N C := fun C hC ↦ hnf ⟨hrepN, hd, C, hC⟩ + obtain ⟨Θ, hΘ, f, a, b, k, t, e, hsΘ, hE⟩ := exists_sideEdges hS χ D.P.fits hside + obtain ⟨r, hr, hrd, hreg⟩ := D.rad.exists_pole hΘ + refine ⟨r, Θ, hΘ, hsΘ, hr, hreg, ?_⟩ + have hshape : ∀ {F}, D.IsBiteAt r F → F.E.ncard ≤ 2 * n → ∃ v₁ v₂ Β L A A' Di Do, D.IsBiteShape r + Θ F v₁ v₂ Β L A A' Di Do := fun hb hc ↦ + bite_shape_of_far hS h3 hrepN hd hb.is_circuit (by omega) hr hΘ hreg hb.rstar_mem + let J : Drawing Shat → Set S := fun F ↦ cap.emb ⁻¹' D.biteArc r F + let Nr : ℕ → ℕ → Prop := fun i j ↦ ∃ F, D.IsBiteAt r F ∧ F.E.ncard ≤ 2 * n ∧ ∀ l, i ≤ l → l ≤ j + → cap.emb '' e l ⊆ D.ins F + let P : ℕ → ℕ → Prop := fun h j ↦ ∃ hh : h < ω.length, (χ.ΩS side).le ω[h] (D.P.φ (e j)) + have hmono : ∀ i j i' j', i ≤ i' → i' ≤ j' → j' ≤ j → Nr i j → Nr i' j' := by + rintro i j i' j' h₁ - h₃ ⟨F, hb, hc, hl⟩ + exact ⟨F, hb, hc, fun l h₄ h₅ ↦ hl l (by omega) (by omega)⟩ + have hedgeΘ : ∀ {l}, l ≤ k + 1 → e l ⊆ Θ := by + intro l hl z hz + have hem := hE.mem l hl + obtain ⟨y, -⟩ := (⟨z, hz⟩ : (e l).Nonempty) + rcases Nat.eq_zero_or_pos l with rfl | hl₀ + · obtain ⟨d, -, -, hd'⟩ := hE.e_zero + rw [hd'] at hz + obtain ⟨u, -, rfl⟩ := hz + exact cuffAngle_mem f u + · rcases eq_or_ne l (k + 1) with rfl | hne + · obtain ⟨d, -, -, hd'⟩ := hE.e_last + rw [hd'] at hz + obtain ⟨u, -, rfl⟩ := hz + exact cuffAngle_mem f u + · exact hsΘ (hE.subset_side hl₀ (by omega) hz) + have hself : ∀ i ≤ k + 1, Nr i i := fun i hi ↦ by + obtain ⟨F, hb, h6, hsub⟩ := exists_bite_of_edge (by nlinarith) + (by omega) hfree hside hsΘ hΘ hr hreg (hE.mem i hi) (hedgeΘ hi) + exact ⟨F, hb, by omega, fun l h₁ h₂ ↦ by + obtain rfl : l = i := by omega + exact hsub⟩ + have hstart : ¬ Nr 0 (k + 1) := by + rintro ⟨F, hb, hc, hl⟩ + refine hfree F ⟨hb.is_circuit, by omega, Or.inl ⟨side, hside, ?_⟩⟩ + have hlt : F.E.ncard < 2 * D.rep := hb.card_lt + have hcl : IsClosed (cap.emb ⁻¹' D.ins F) := (D.ins_spec hb.is_circuit + hlt).2.2.1.isClosed.preimage cap.isEmbedding.continuous + have := hE.side_subset_of_closed hcl fun l h₁ h₂ ↦ image_subset_iff.1 (hl l (by omega) + (by omega)) + exact image_subset_iff.2 this + -- A bite with two edges in it covers what lies between them. + have hbetween : ∀ {F i j}, D.IsBiteAt r F → F.E.ncard ≤ 2 * n → 1 ≤ i → i < j → j ≤ k + → cap.emb '' e i ⊆ D.ins F → cap.emb '' e j ⊆ D.ins F → Nr i j ∨ (Nr 0 i ∧ Nr j (k + 1)) := by + intro F i j hb hc hi hij hj h₁ h₂ + obtain ⟨v₁, v₂, Β, L, A, A', Di, Do, hsh⟩ := hshape hb hc + have hmem := fun l (hl : l ≤ k + 1) (hs : cap.emb '' e l ⊆ D.ins F) ↦ image_subset_iff.1 + (hsh.edge_subset (hE.mem l hl) (hedgeΘ hl) hs) + have hJc : J F ⊆ Θ := fun x hx ↦ by + obtain ⟨y, hy, he⟩ := (hsh.biteArc_subset hx).2 + exact cap.isEmbedding.injective he ▸ hy + have hin : ∀ {l}, e l ⊆ J F → cap.emb '' e l ⊆ D.ins F := fun hl ↦ by + rintro _ ⟨z, hz, rfl⟩ + exact (hsh.biteArc_subset (hl hz)).1 + rcases hE.between (hsh.isPreconnected_biteArc) hJc hi hij hj (hmem i (by omega) h₁) (hmem j + (by omega) h₂) with hc' | ⟨hc₁, hc₂⟩ + · exact Or.inl ⟨F, hb, hc, fun l h₃ h₄ ↦ hin (hc' l h₃ h₄)⟩ + · exact Or.inr ⟨⟨F, hb, hc, fun l _ h₄ ↦ hin (hc₁ l h₄)⟩, ⟨F, hb, hc, + fun l h₃ h₄ ↦ hin (hc₂ l h₃ h₄)⟩⟩ + have hbetween' : ∀ {F i s}, D.IsBiteAt r F → F.E.ncard ≤ 2 * n → 1 ≤ i → i ≤ k + → s ∈ χ.Φ.shortSides → s ⊆ Θ → cap.emb '' e i ⊆ D.ins F → cap.emb '' s ⊆ D.ins F → + Nr i (k + 1) ∨ Nr 0 i := by + intro F i s hb hc hi hik hs hsΘ' h₁ h₂ + obtain ⟨v₁, v₂, Β, L, A, A', Di, Do, hsh⟩ := hshape hb hc + have hsΓ := D.P.fits.short_sides hs + have hJc : J F ⊆ Θ := fun x hx ↦ by + obtain ⟨y, hy, he⟩ := (hsh.biteArc_subset hx).2 + exact cap.isEmbedding.injective he ▸ hy + have hin : ∀ {l}, e l ⊆ J F → cap.emb '' e l ⊆ D.ins F := fun hl ↦ by + rintro _ ⟨z, hz, rfl⟩ + exact (hsh.biteArc_subset (hl hz)).1 + rcases hE.between_short (hsh.isPreconnected_biteArc) hJc hi hik (image_subset_iff.1 + (hsh.edge_subset (hE.mem i (by omega)) (hedgeΘ (by omega)) h₁)) hs hsΓ hsΘ' + (image_subset_iff.1 (hsh.edge_subset hsΓ hsΘ' h₂)) with hc' | hc' + · exact Or.inl ⟨F, hb, hc, fun l h₃ h₄ ↦ hin (hc' l h₃ h₄)⟩ + · exact Or.inr ⟨F, hb, hc, fun l _ h₄ ↦ hin (hc' l h₄)⟩ + have hnochain : ∀ a b, ¬ SideChain Nr P k m a b := by + intro a' b' hc + have hstep : ∀ i < m, b' i < b' (i + 1) := fun i hi ↦ (hc.b_le_a i hi).trans_lt (hc.a_lt_b i hi) + have hlt : ∀ {i j}, i < j → j ≤ m → b' i < b' j := by + intro i j hij hj + induction j with + | zero => omega + | succ j ih => + rcases Nat.lt_succ_iff_lt_or_eq.1 hij with h' | rfl + · exact (ih h' (by omega)).trans (hstep j (by omega)) + · exact hstep i (by omega) + have hle : ∀ {i j}, i ≤ j → j ≤ m → b' i ≤ b' j := fun {i j} hij hj ↦ by + rcases Nat.lt_or_eq_of_le hij with h' | rfl + · exact (hlt h' hj).le + · exact le_rfl + have hkb : b' m ≤ k := by have := hc.lt_end; omega + have hb1 : ∀ i < m, 1 ≤ b' (i + 1) := fun i hi ↦ by + have := hle (show 0 + 1 ≤ i + 1 by omega) (by omega) + have h₁ := hstep 0 (by omega) + rw [hc.b_zero] at h₁ + omega + have hbk : ∀ i < m, b' (i + 1) ≤ k := fun i hi ↦ (hle (by omega) (by omega)).trans hkb + let g : Fin ω.length → Set S := fun i ↦ e (b' (i.1 + 1)) + refine hno r hr Θ hΘ hrd hsΘ ⟨g, a, b, ⟨hE.head, hE.last, ?_, ?_, ?_⟩, ?_⟩ + · intro i j hij + by_contra hne + rcases lt_or_gt_of_ne (fun h ↦ hne (Fin.ext h) : i.1 ≠ j.1) with h' | h' + · exact hE.injOn_edges (hb1 i.1 i.2) (hlt (by omega) (by have := j.2; omega)) + (hbk j.1 j.2) hij + · exact hE.injOn_edges (hb1 j.1 j.2) (hlt (by omega) (by have := i.2; omega)) + (hbk i.1 i.2) hij.symm + · intro i + exact ⟨hE.mem _ (Nat.le_succ_of_le (hbk i.1 i.2)), + hE.subset_side (hb1 i.1 i.2) (hbk i.1 i.2)⟩ + · intro i j hij x hx y hy + have hij' : i.1 < j.1 := hij + have hj := j.2 + exact hE.inOrder (hb1 i.1 i.2) (hlt (by omega) (by omega)) (hbk j.1 j.2) hx hy + · refine ⟨fun i ↦ ?_, fun i j hij ↦ ?_, fun i s hs hsc ↦ ?_⟩ + · obtain ⟨_, hh⟩ := hc.label i.1 i.2 + exact hh + · by_contra hnl + have hij' : i.1 < j.1 := hij + obtain ⟨F, hb, h₁, h₂, hcard⟩ := exists_bite_of_dist_le (by omega) (not_lt.1 hnl) + have hj' := j.2 + rcases hbetween hb hcard (hb1 i.1 i.2) (hlt (by omega) (by omega)) + (hbk j.1 j.2) h₁ h₂ with hc₁ | ⟨-, hc₂⟩ + · exact hc.far j.1 j.2 (hmono _ _ _ _ (hle (by omega) (by omega)) + (hstep j.1 j.2).le le_rfl hc₁) + · exact hc.far_end (hmono _ _ _ _ (hle (by omega) le_rfl) (by omega) le_rfl hc₂) + · by_contra hnl + have hi' := i.2 + obtain ⟨F, hb, h₁, h₂, hcard⟩ := exists_bite_of_dist_le (by omega) (not_lt.1 hnl) + rcases hbetween' hb hcard (hb1 i.1 i.2) (hbk i.1 i.2) hs hsc h₁ h₂ with hc₁ | hc₁ + · exact hc.far_end (hmono _ _ _ _ (hle (by omega) le_rfl) (by omega) le_rfl hc₁) + · have h₀ := hc.far 0 (by omega) + rw [hc.b_zero] at h₀ + exact h₀ (hmono _ _ _ _ le_rfl (by omega) (hle (by omega) (by omega)) hc₁) + have feast_from_chain : ∃ ℱ, D.IsFeast r side ω ℱ ∧ feastOrder ℱ ≤ N ∧ + ∀ F ∈ ℱ, F.E.ncard ≤ 2 * n := by + exact exists_feast_of_chain_cover (S := S) (Shat := Shat) (cap := cap) (β := β) (χ := χ) + (D := D) (side := side) (n := n) (ω := ω) hm1 Θ f a b k t e hsΘ hE r hshape hmono + hedgeΘ hself hstart hnochain + exact feast_from_chain + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section11c.lean b/LeanPool/GraphMinor/GM19/Section11c.lean new file mode 100644 index 0000000000..922e3aa869 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section11c.lean @@ -0,0 +1,409 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section11b + +/-! +# Feasts of small order + +This file gathers what a feast can be changed into. A setting fixes a long side, its cuff and its +pole, with the other poles far away and no flaw in freedom +(`IsSideSetting`). We show how to merge two bites with two common vertices +(`IsSideSetting.exists_merge`), how to drop a bite inside another (`IsSideSetting.exists_drop`), and +how to shorten a bite with a vertex off its arc (`IsSideSetting.exists_shorten`). These are used for +(11.3) in `Section11d.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +namespace TangleDatum + +omit [T2Space Shat] in +/-- Taking a member out of a finite family takes `½|E(F)|` off the order. -/ +theorem feastOrder_diff_singleton {ℱ : Set (Drawing Shat)} (hf : ℱ.Finite) {F : Drawing Shat} + (hF : F ∈ ℱ) : + feastOrder (ℱ \ {F}) + F.E.ncard / 2 = feastOrder ℱ := by + classical + have hf' : (ℱ \ {F}).Finite := hf.subset sdiff_subset + rw [feastOrder, feastOrder, dite_eq_left hf, dite_eq_left hf'] + have : hf.toFinset = insert F hf'.toFinset := by + ext G + simp only [Finite.mem_toFinset, Finset.mem_insert, mem_sdiff, mem_singleton_iff] + by_cases h : G = F + · simp [h, hF] + · simp [h] + rw [this, Finset.sum_insert (by simp), add_comm] + +omit [T2Space Shat] in +theorem feastOrder_insert_le {ℱ : Set (Drawing Shat)} (hf : ℱ.Finite) + (F : Drawing Shat) : feastOrder (insert F ℱ) ≤ feastOrder ℱ + F.E.ncard / 2 := by + classical + have hf' : (insert F ℱ).Finite := hf.insert F + rw [feastOrder, feastOrder, dite_eq_left hf, dite_eq_left hf'] + have : hf'.toFinset = insert F hf.toFinset := by + ext G + simp + rw [this] + by_cases h : F ∈ hf.toFinset + · rw [Finset.insert_eq_of_mem h] + omega + · rw [Finset.sum_insert h] + omega + +variable {D : TangleDatum cap χ} + +open scoped Classical in +/-- The sum of the weights of a family of drawings. -/ +noncomputable def feastWeight (D : TangleDatum cap χ) (ℱ : Set (Drawing Shat)) : ℝ := + if h : ℱ.Finite then ∑ F ∈ h.toFinset, D.tb.weightSub F else 0 + +omit [T2Space S] [T2Space Shat] in +theorem feastWeight_diff_singleton {ℱ : Set (Drawing Shat)} (hf : ℱ.Finite) {F : Drawing Shat} + (hF : F ∈ ℱ) : + D.feastWeight (ℱ \ {F}) + D.tb.weightSub F = D.feastWeight ℱ := by + classical + have hf' : (ℱ \ {F}).Finite := hf.subset sdiff_subset + rw [feastWeight, feastWeight, dite_eq_left hf, dite_eq_left hf'] + have : hf.toFinset = insert F hf'.toFinset := by + ext G + simp only [Finite.mem_toFinset, Finset.mem_insert, mem_sdiff, mem_singleton_iff] + by_cases h : G = F + · simp [h, hF] + · simp [h] + rw [this, Finset.sum_insert (by simp), add_comm] + +omit [T2Space S] [T2Space Shat] in +theorem feastWeight_insert {ℱ : Set (Drawing Shat)} (hf : ℱ.Finite) {F : Drawing Shat} + (hF : F ∉ ℱ) : + D.feastWeight (insert F ℱ) = D.feastWeight ℱ + D.tb.weightSub F := by + have h := feastWeight_diff_singleton (D := D) (hf.insert F) (mem_insert F ℱ) + rw [insert_sdiff_self_of_notMem hF] at h + exact h.symm + +omit [T2Space S] in +omit [T2Space Shat] in +/-- A family with a larger union of arcs is still a feast. -/ +theorem IsFeast.of_arc_subset {r : Shat} {side : Set S} {ω : List β} {ℱ ℱ' : Set (Drawing Shat)} + (h : D.IsFeast r side ω ℱ) (hf : ℱ'.Finite) (hb : ∀ F ∈ ℱ', D.IsBiteAt r F) + (hc : ℱ'.ncard ≤ ω.length + 1) (hsub : D.feastArcUnion r ℱ ⊆ D.feastArcUnion r ℱ') : D.IsFeast + r side ω ℱ' := by + refine ⟨hf, hb, hc, fun s hs hne ↦ (h.includes_short_sides s hs hne).trans hsub, fun X hX ↦ ?_⟩ + obtain ⟨x, hx, rfl⟩ := hX + have hdiff : side \ cap.emb ⁻¹' D.feastArcUnion r ℱ' ⊆ side \ cap.emb ⁻¹' D.feastArcUnion r ℱ + := fun z hz ↦ ⟨hz.1, fun h' ↦ hz.2 (hsub h')⟩ + have hsubY := isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn hx) ((connectedComponentIn_subset _ _).trans hdiff) + obtain ⟨hh, hh', hall⟩ := h.component_omits _ (mem_image_of_mem _ (hdiff hx)) + exact ⟨hh, hh', fun e he hsub' ↦ hall e he (hsub'.trans hsubY)⟩ + +/-- A long side with its cuff and pole, the other poles far away, and no flaw in freedom. -/ +structure IsSideSetting (D : TangleDatum cap χ) (side Θ : Set S) (r : Shat) (N : ℕ) : Prop where + h3 : D.P.Γ.IsInternallyThreeConnected + long : side ∈ χ.Φ.longSides + side_cuff : side ⊆ Θ + cuff : Θ ∈ cuffs S + pole : r ∈ D.rad.poles + reg : D.rad.regionOf r = cap.cuffDisc Θ + rep_gt : N < D.rep + far : ∀ r₁ ∈ D.rad.poles, ∀ r₂ ∈ D.rad.poles, r₁ ≠ r₂ → N < D.vDist r₁ r₂ + free : ∀ C, ¬ D.IsFreeCircuit N C + +namespace IsSideSetting + +variable {side Θ : Set S} {r : Shat} {N : ℕ} (X : D.IsSideSetting side Θ r N) +include X + +omit [T2Space S] in +/-- A short circuit with `r` inside has `r` on it, or else it is a flaw in freedom. -/ +theorem pole_mem {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) (hc : C.E.ncard + ≤ 2 * N) (hri : r ∈ D.ins C) : r ∈ C.V := by + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have : ConnectedSpace Shat := cap.connected + by_contra hrC + have hlt : C.E.ncard < 2 * D.rep := by have := X.rep_gt; omega + have hi := D.ins_spec hC hlt + have hdis : Disjoint (cap.cuffDisc Θ) C.U := disjoint_left.2 fun x hx hxF ↦ hrC + (pole_mem_of_meet hC.1 X.pole X.cuff X.reg hxF hx) + have hrd : r ∈ cap.cuffDisc Θ := X.reg ▸ (D.rad.regionOf_mem X.pole.1).2 + have hconn : IsPreconnected (cap.cuffDisc Θ) := X.reg ▸ isPreconnected_connectedComponentIn + have hsub : cap.cuffDisc Θ ⊆ discInt (D.ins C) := by + rcases hi.2.2.1.side hman hconn (by rw [hi.2.2.2.1]; exact hdis) with h | h + · exact h + · exact absurd hri (disjoint_left.1 h hrd) + have hcl : closure (cap.cuffDisc Θ) ⊆ D.ins C := closure_minimal (hsub.trans + (discInt_subset _)) hi.2.2.1.isClosed + refine X.free C ⟨hC, hc, Or.inl ⟨side, X.long, ?_⟩⟩ + rintro _ ⟨y, hy, rfl⟩ + exact hcl (cap.mem_closure_emb X.cuff (X.side_cuff hy)) + +theorem shape (hS : IsSurface S) {F : Drawing Shat} (hb : D.IsBiteAt r F) (hc : F.E.ncard + ≤ 2 * N) : ∃ v₁ v₂ Β L A A' Di Do, D.IsBiteShape r Θ F v₁ v₂ Β L A A' Di Do := + bite_shape_of_far hS X.h3 X.rep_gt X.far hb.is_circuit hc X.pole X.cuff X.reg hb.rstar_mem + +theorem biteArc_subset_of_ins (hS : IsSurface S) {F₁ F₂ : Drawing Shat} (h₁ : D.IsBiteAt r F₁) + (h₂ : D.IsBiteAt r F₂) (c₁ : F₁.E.ncard ≤ 2 * N) (c₂ : F₂.E.ncard ≤ 2 * N) + (hsub : D.ins F₁ ⊆ D.ins F₂) : D.biteArc r F₁ ⊆ D.biteArc r F₂ := by + obtain ⟨_, _, _, _, _, _, _, _, s₁⟩ := X.shape hS h₁ c₁ + obtain ⟨_, _, _, _, _, _, _, _, s₂⟩ := X.shape hS h₂ c₂ + exact s₁.biteArc_mono s₂ hsub + +omit [T2Space S] in +/-- A short circuit with `r` inside is a bite. -/ +theorem bite_of_ins {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hc : C.E.ncard ≤ 2 * N) (hri : r ∈ D.ins C) : D.IsBiteAt r C := + ⟨X.pole, hC, by have := X.rep_gt; omega, X.pole_mem hC hc hri⟩ + +omit [TopologicalSpace S] [T2Space S] X in +omit [T2Space Shat] in +/-- Two distinct members of a feast of order at most `N` have together at most `2N` edges. -/ +theorem sum_le {ℱ : Set (Drawing Shat)} (hf : ℱ.Finite) {F₁ F₂ : Drawing Shat} (h₁ : F₁ ∈ ℱ) + (h₂ : F₂ ∈ ℱ) (hne : F₁ ≠ F₂) : + F₁.E.ncard / 2 + F₂.E.ncard / 2 + feastOrder ((ℱ \ {F₁}) \ {F₂}) = feastOrder ℱ := by + have e₁ := feastOrder_diff_singleton hf h₁ + have e₂ := feastOrder_diff_singleton (hf.subset sdiff_subset) (F := F₂) ⟨h₂, fun h ↦ hne + (mem_singleton_iff.1 h).symm⟩ + omega + +/-- **Merging two bites with two common vertices** makes the order drop. -/ +theorem exists_merge (hS : IsSurface S) {side' : Set S} {ω : List β} {ℱ : Set + (Drawing Shat)} {c : ℕ} (hNc : N ≤ c + 1) (hfe : D.IsFeast r side' ω ℱ) (hord : feastOrder ℱ ≤ N) + (hsm : ∀ F ∈ ℱ, F.E.ncard ≤ 2 * c) {F₁ F₂ : Drawing Shat} (h₁ : F₁ ∈ ℱ) (h₂ : F₂ ∈ ℱ) + (hne : F₁ ≠ F₂) {x y : Shat} (hxy : x ≠ y) (hx₁ : x ∈ F₁.V) (hx₂ : x ∈ F₂.V) + (hy₁ : y ∈ F₁.V) (hy₂ : y ∈ F₂.V) : ∃ ℱ', D.IsFeast r side' ω ℱ' ∧ feastOrder ℱ' < feastOrder ℱ + ∧ ∀ F ∈ ℱ', F.E.ncard ≤ 2 * c := by + classical + have : ConnectedSpace Shat := cap.connected + have hf := hfe.finite_bites + have b₁ := hfe.all_bites F₁ h₁ + have b₂ := hfe.all_bites F₂ h₂ + have hsum := sum_le hf h₁ h₂ hne + obtain ⟨k₁, hk₁⟩ : ∃ k, F₁.E.ncard = 2 * k := ⟨_, D.ncard_E_eq_hat b₁.is_circuit⟩ + obtain ⟨k₂, hk₂⟩ : ∃ k, F₂.E.ncard = 2 * k := ⟨_, D.ncard_E_eq_hat b₂.is_circuit⟩ + have d₁ : F₁.E.ncard / 2 = k₁ := by omega + have d₂ : F₂.E.ncard / 2 = k₂ := by omega + obtain ⟨C, hC, hcard, i₁, i₂, hV⟩ := no_two_common_vertices X.rep_gt b₁.is_circuit b₂.is_circuit + (by omega) hxy hx₁ hx₂ hy₁ hy₂ + obtain ⟨k, hk⟩ : ∃ k, C.E.ncard = 2 * k := ⟨_, D.ncard_E_eq_hat hC⟩ + have hlt : C.E.ncard + 2 ≤ F₁.E.ncard + F₂.E.ncard := by + have e₁ := IsCircuit.ncard_V hC.2 + have e₂ := IsCircuit.ncard_V b₁.is_circuit.2 + have e₃ := IsCircuit.ncard_V b₂.is_circuit.2 + have h₃ := ncard_le_ncard hV (F₁.finite_V.union F₂.finite_V) + have h₄ := ncard_union_add_ncard_inter F₁.V F₂.V F₁.finite_V F₂.finite_V + have h₅ : 2 ≤ (F₁.V ∩ F₂.V).ncard := by + have : ({x, y} : Set Shat) ⊆ F₁.V ∩ F₂.V := by + rintro z (rfl | hz) + · exact ⟨hx₁, hx₂⟩ + · rw [mem_singleton_iff.1 hz] + exact ⟨hy₁, hy₂⟩ + have h₆ := ncard_le_ncard this (F₁.finite_V.subset inter_subset_left) + rwa [ncard_pair hxy] at h₆ + omega + have bC : D.IsBiteAt r C := X.bite_of_ins hC (by omega) (i₁ (D.U_subset_ins b₁.is_circuit + b₁.card_lt (F₁.V_subset_U b₁.rstar_mem))) + set 𝒜 := (ℱ \ {F₁}) \ {F₂} with h𝒜 + have hfA : 𝒜.Finite := hf.subset fun z hz ↦ hz.1.1 + have hins := feastOrder_insert_le hfA C + have hnA : 𝒜.ncard + 2 ≤ ℱ.ncard := by + have e₁ := ncard_sdiff_singleton_add_one h₁ hf + have e₂ := ncard_sdiff_singleton_add_one (s := ℱ \ {F₁}) (a := F₂) ⟨h₂, fun h ↦ hne + (mem_singleton_iff.1 h).symm⟩ (hf.subset sdiff_subset) + rw [← h𝒜] at e₂ + omega + have hcle := hfe.card_le + have hsubA : ∀ F ∈ 𝒜, F ∈ ℱ := fun F hF ↦ hF.1.1 + have horder : feastOrder 𝒜 + k₁ + k₂ = feastOrder ℱ := by omega + have hCord : C.E.ncard ≤ 2 * N := by omega + refine ⟨insert C 𝒜, hfe.of_arc_subset (hfA.insert C) ?_ ?_ ?_, by omega, ?_⟩ + · rintro F (rfl | hF) + · exact bC + · exact hfe.all_bites F (hsubA F hF) + · have := ncard_insert_le C 𝒜 + omega + · intro z hz + obtain ⟨F, hF, hzF⟩ := mem_iUnion₂.1 hz + by_cases e₁ : F = F₁ + · subst e₁ + exact mem_iUnion₂.2 ⟨C, mem_insert _ _, X.biteArc_subset_of_ins hS b₁ bC + (by omega) hCord i₁ hzF⟩ + by_cases e₂ : F = F₂ + · subst e₂ + exact mem_iUnion₂.2 ⟨C, mem_insert _ _, X.biteArc_subset_of_ins hS b₂ bC + (by omega) hCord i₂ hzF⟩ + exact mem_iUnion₂.2 ⟨F, mem_insert_of_mem _ ⟨⟨hF, e₁⟩, e₂⟩, hzF⟩ + · rintro F (rfl | hF) + · omega + · exact hsm F (hsubA F hF) + +/-- **A bite inside another can be dropped**, and the order drops. -/ +theorem exists_drop (hS : IsSurface S) {side' : Set S} {ω : List β} {ℱ : Set (Drawing Shat)} + (hfe : D.IsFeast r side' ω ℱ) (hord : feastOrder ℱ ≤ N) {F₁ F₂ : Drawing Shat} (h₁ : F₁ ∈ ℱ) + (h₂ : F₂ ∈ ℱ) (hne : F₁ ≠ F₂) (hsub : D.ins F₁ ⊆ D.ins F₂) : ∃ ℱ', ℱ' ⊆ ℱ + ∧ D.IsFeast r side' ω ℱ' ∧ feastOrder ℱ' < feastOrder ℱ := by + classical + have : ConnectedSpace Shat := cap.connected + have hf := hfe.finite_bites + have b₁ := hfe.all_bites F₁ h₁ + have b₂ := hfe.all_bites F₂ h₂ + have hsum := sum_le hf h₁ h₂ hne + have hpos₁ : 0 < F₁.E.ncard := (ncard_pos F₁.finite_edges).2 (IsCircuit.E_nonempty + b₁.is_circuit.2) + obtain ⟨k₁, hk₁⟩ : ∃ k, F₁.E.ncard = 2 * k := ⟨_, D.ncard_E_eq_hat b₁.is_circuit⟩ + obtain ⟨k₂, hk₂⟩ : ∃ k, F₂.E.ncard = 2 * k := ⟨_, D.ncard_E_eq_hat b₂.is_circuit⟩ + have e₁ := feastOrder_diff_singleton hf h₁ + have hF₂ : F₂ ∈ ℱ \ {F₁} := ⟨h₂, fun h ↦ hne (mem_singleton_iff.1 h).symm⟩ + refine ⟨ℱ \ {F₁}, sdiff_subset, hfe.of_arc_subset (hf.subset sdiff_subset) + (fun F hF ↦ hfe.all_bites F hF.1) ?_ ?_, by omega⟩ + · exact (ncard_le_ncard sdiff_subset hf).trans hfe.card_le + · intro z hz + obtain ⟨F, hF, hzF⟩ := mem_iUnion₂.1 hz + by_cases e : F = F₁ + · subst e + exact mem_iUnion₂.2 ⟨F₂, hF₂, X.biteArc_subset_of_ins hS b₁ b₂ (by omega) (by omega) hsub hzF⟩ + · exact mem_iUnion₂.2 ⟨F, ⟨hF, e⟩, hzF⟩ + +/-- **A bite with a vertex on the cuff off its arc can be shortened.** The spoke from the pole to +that vertex runs outside the bite, and it gives a shorter circuit around the bite. -/ +theorem exists_shorter (hS : IsSurface S) {F : Drawing Shat} {v₁ v₂ Β L A A' Di Do} + (h : D.IsBiteShape r Θ F v₁ v₂ Β L A A' Di Do) {x : Shat} (hxV : x ∈ F.V) (hxA : x ∈ A') : + ∃ F', F'.IsCircuitOf D.rad.G ∧ F'.E.ncard < F.E.ncard ∧ D.ins F ⊆ D.ins F' ∧ r ∈ F'.V := by + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have : ConnectedSpace Shat := cap.connected + have hF := h.circuit + have hlt := h.lt + have hrep : 1 ≤ D.rep := by omega + have hi := D.ins_spec hF hlt + have hdisc := hi.2.2.1 + have hbd : discBd (D.ins F) = F.U := hi.2.2.2.1 + obtain ⟨hxΘ, hxst⟩ := h.A'_sub hxA + obtain ⟨v, hvΘ, rfl⟩ := hxΘ + have hvG := (D.rad.bd_point hF.1 (cuff_subset_bd ⟨Θ, X.cuff⟩ hvΘ) (F.V_subset_U hxV)).1 + obtain ⟨e, he, hset⟩ := D.rad.exists_pole_edge hS X.h3 X.pole X.cuff X.reg hvG hvΘ + have hvr : cap.emb v ≠ r := fun h' ↦ X.pole.1.2 (h' ▸ mem_image_of_mem _ hvG) + have heF : e ∉ F.E := by + intro heF + apply hxst + rw [← h.nbrs] + refine ⟨e, heF, ?_⟩ + rw [hF.1.closure_inter_V heF, hset, pair_comm] + obtain ⟨P, B, Q, ht, hQe, c₁, c₂⟩ := exists_theta_chord hS X.h3 hF X.pole h.r_mem hvG hxV he hset + heF + have hemem : cap.emb v ∈ closure e ∩ D.rad.G.V := by rw [hset]; exact Or.inl rfl + have hrmem : r ∈ closure e ∩ D.rad.G.V := by rw [hset]; exact Or.inr rfl + have hedis : Disjoint e F.U := edge_disjoint_U hF.1 he heF + have hereg : e ⊆ cap.cuffDisc Θ := X.reg ▸ D.rad.edge_subset_region he X.pole.1 hset + have heDo : e ⊆ discInt Do := by + have hpre : IsPreconnected e := he.2.2.1.isConnected.isPreconnected + have hcov : e ⊆ Di ∪ Do := by + rw [h.union] + exact hereg.trans subset_closure + have hnone : e ∩ (Di ∩ Do) = ∅ := by + rw [h.inter, eq_empty_iff_forall_notMem] + rintro y ⟨hy, hyΒ⟩ + exact disjoint_left.1 hedis hy (h.Β_F hyΒ) + have hvDo : cap.emb v ∈ Do := Surface.discBd_subset _ (h.bd_o ▸ Or.inl hxA) + rcases isPreconnected_iff_subset_of_disjoint_closed.1 hpre Di Do h.di.isClosed h.do_.isClosed + hcov hnone with hs | hs + · exfalso + have hvDi : cap.emb v ∈ Di := closure_minimal hs h.di.isClosed hemem.1 + have hΒ : cap.emb v ∈ Β := h.inter ▸ ⟨hvDi, hvDo⟩ + exact hxst (h.meet ▸ ⟨hΒ, mem_image_of_mem _ hvΘ⟩) + · intro y hy + refine ⟨hs hy, ?_⟩ + rw [h.bd_o] + rintro (hyA | hyΒ) + · obtain ⟨z, -, rfl⟩ := (h.A'_sub hyA).1 + exact cap.notMem_range X.cuff (hereg hy) (mem_range_self z) + · exact disjoint_left.1 hedis hy (h.Β_F hyΒ) + have hQd : Disjoint Q.U (discInt (D.ins F)) := by + refine disjoint_left.2 fun y hy hyi ↦ ?_ + have hyc := hQe hy + by_cases hyV : y ∈ D.rad.G.V + · have hym : y ∈ closure e ∩ D.rad.G.V := ⟨hyc, hyV⟩ + rw [hset] at hym + have hyF : y ∈ F.U := by + rcases hym with rfl | hm + · exact F.V_subset_U hxV + · rw [mem_singleton_iff.1 hm] + exact F.V_subset_U h.r_mem + exact hyi.2 (hbd ▸ hyF) + · have hye : y ∈ e := D.rad.G.closure_diff_V he ▸ (⟨hyc, hyV⟩ : y ∈ closure e \ D.rad.G.V) + exact disjoint_left.1 h.out_ins (heDo hye) (discInt_subset _ hyi) + have hl₂ := improve_card ht c₁.le + have hl₁ := improve_card ht.swap c₂.le + have hC₂ : Drawing.IsCircuitOf (D.rad.G.sup Q B) D.rad.G := ⟨D.rad.G.sup_isSubdrawing Q B, + ht.left_circuit⟩ + have hC₁ : Drawing.IsCircuitOf (D.rad.G.sup Q P) D.rad.G := ⟨D.rad.G.sup_isSubdrawing Q P, + ht.swap.left_circuit⟩ + have hcard : ∀ {X' Y : Drawing Shat}, TwoPaths D.rad.G F X' Y Q (cap.emb v) r → + (D.rad.G.sup Q Y).E.ncard + X'.E.ncard = Q.E.ncard + F.E.ncard := by + intro X' Y ht' + have hE : (D.rad.G.sup Q Y).E = Q.E ∪ Y.E := Drawing.sup_E ht'.path.1 ht'.sub₂ + have hdis : Disjoint Q.E Y.E := disjoint_left.mpr fun e he he' ↦ disjoint_left.mp ht'.meet_E he + (ht'.right.1.2 he') + rw [hE, ncard_union_eq hdis Q.finite_edges Y.finite_edges, ht'.union_E, + ncard_union_eq ht'.disj_E X'.finite_edges Y.finite_edges] + omega + have hrQ : r ∈ Q.U := by + obtain ⟨W, -, hV, -⟩ := ht.path.2 + exact Q.V_subset_U (hV ▸ W.end_mem_support) + have key : ∀ {Y : Drawing Shat}, Y.IsCircuitOf D.rad.G → Y.E.ncard < F.E.ncard → Y.U ⊆ Q.U ∪ F.U + → Q.U ⊆ Y.U → (discInt (D.ins F) ∩ D.ins Y).Nonempty → + ∃ F', F'.IsCircuitOf D.rad.G ∧ F'.E.ncard < F.E.ncard ∧ D.ins F ⊆ D.ins F' ∧ r ∈ F'.V := by + intro Y hY hYle hU hQU hm + have hYlt : Y.E.ncard < 2 * D.rep := by omega + have hiY := D.ins_spec hY hYlt + have hdj : Disjoint (discInt (D.ins F)) (discBd (D.ins Y)) := by + rw [hiY.2.2.2.1] + refine disjoint_left.2 fun x hx hxX ↦ ?_ + rcases hU hxX with h' | h' + · exact disjoint_left.1 hQd h' hx + · exact hx.2 (hbd ▸ h') + have hsub : D.ins F ⊆ D.ins Y := by + rcases hiY.2.2.1.side hman hdisc.isPreconnected_discInt hdj with h' | h' + · rw [← closure_discInt hdisc] + exact closure_minimal (h'.trans (discInt_subset _)) hiY.2.2.1.isClosed + · obtain ⟨x, h₁, h₂⟩ := hm + exact absurd h₂ (disjoint_left.1 h' h₁) + exact ⟨Y, hY, hYle, hsub, mem_V_of_mem_U hY.1 (hQU hrQ) hrmem.2⟩ + obtain ⟨z, hz⟩ := hdisc.nonempty_discInt + rcases ins_theta hrep ht hF hlt (by omega) (by omega) (discInt_subset _ hz) with h' | h' + · refine key hC₁ ?_ ?_ ?_ ⟨z, hz, h'⟩ + · have := hcard ht.swap + omega + · rw [ht.swap.U_right] + exact union_subset_union_right _ ht.left.1.U_subset + · rw [ht.swap.U_right] + exact subset_union_left + · refine key hC₂ ?_ ?_ ?_ ⟨z, hz, h'⟩ + · have := hcard ht + omega + · rw [ht.U_right] + exact union_subset_union_right _ ht.right.1.U_subset + · rw [ht.U_right] + exact subset_union_left + +end IsSideSetting + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section11d.lean b/LeanPool/GraphMinor/GM19/Section11d.lean new file mode 100644 index 0000000000..a75eef0d42 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section11d.lean @@ -0,0 +1,378 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section11c + +/-! +# Graph Minors XIX, (11.3) and (11.4) + +A feast of least order is disjoint, and if it also has least weight then its members are `λ`-linked +to the tangle. We prove both for feasts whose members all have `½|E(F)| ≤ c`, with +`c + 1` at least the bound on the order. The numbered results take `c` to be the bound. The proof of +(11.1) needs `c` one smaller, so that the separations made from the bites +have order less than the bound (`exists_side_flaw`). A single bite of length exactly `2(m + 1)n` +would break this, and the paper does not say why it does not arise. + +Instead of the planar graph in the paper's proof of (11.3), we change the feast one or two members +at a time, using `Section11c.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + + +namespace TangleDatum + +variable {D : TangleDatum cap χ} + +omit [T2Space S] in +/-- A short circuit with its inside linked to the tangle is `λ`-linked in the sense of the paper. -/ +theorem isLambdaLinkedCircuit_of_ins {F : Drawing Shat} (hF : F.IsCircuitOf D.rad.G) + (hlt : F.E.ncard < 2 * D.rep) + (hl : GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins F)) (partIn cap D.P.Γ + (closure (D.ins F)ᶜ))) : IsLambdaLinkedCircuit D.tb D.ord D.𝒯 F := by + have h₁ : D.rep ≤ D.ord := (tangleRep_spec D.rad D.ord D.𝒯).1 + have h₂ : (D.rep : ℕ∞) ≤ Painting.rep D.rad := tangleRep_le_rep D.rad D.ord D.𝒯 + have h₃ : (D.rep : ℕ∞) ≤ min (D.ord : ℕ∞) (Painting.rep D.rad) := le_min (by exact_mod_cast h₁) h₂ + have h₄ : (F.E.ncard : ℕ∞) < 2 * (D.rep : ℕ∞) := by exact_mod_cast hlt + exact ⟨hF, lt_of_lt_of_le h₄ (by gcongr), _, _, D.sides_ins hF hlt, hl⟩ + +omit [T2Space S] [T2Space Shat] in +/-- A member of a family of order at most `N` has at most `2N` edges. -/ +theorem ncard_E_le_of_mem {ℱ : Set (Drawing Shat)} (hf : ℱ.Finite) (hc : ∀ F ∈ ℱ, F.IsCircuitOf + D.rad.G) {N : ℕ} (hord : feastOrder ℱ ≤ N) {F : Drawing Shat} (hF : F ∈ ℱ) : + F.E.ncard ≤ 2 * N := by + have : ConnectedSpace Shat := cap.connected + have h := feastOrder_diff_singleton hf hF + have h' := D.ncard_E_eq_hat (hc F hF) + omega + +namespace IsSideSetting + +variable {side Θ : Set S} {r : Shat} {N : ℕ} (X : D.IsSideSetting side Θ r N) +include X + +omit [T2Space S] in +/-- The frontier of the region of `r` is the cuff. -/ +theorem frontier_region : closure (D.rad.regionOf r) \ D.rad.regionOf r + = cap.emb '' Θ := by + rw [X.reg, cap.closure_cuffDisc X.cuff] + ext x + constructor + · rintro ⟨hx | hx, hn⟩ + · exact absurd hx hn + · exact hx + · rintro ⟨y, hy, rfl⟩ + exact ⟨Or.inr (mem_image_of_mem _ hy), fun hd ↦ cap.notMem_range X.cuff hd (mem_range_self y)⟩ + +/-- **A feast of least order is disjoint.** -/ +theorem isDisjointFeast_of_min (hS : IsSurface S) {ω : List β} {ℱ : Set (Drawing Shat)} {c : ℕ} + (hNc : N ≤ c + 1) (hfe : D.IsFeast r side ω ℱ) (hord : feastOrder ℱ ≤ N) + (hsm : ∀ F ∈ ℱ, F.E.ncard ≤ 2 * c) (hmin : ∀ ℱ', D.IsFeast r side ω ℱ' → (∀ F ∈ ℱ', F.E.ncard + ≤ 2 * c) → feastOrder ℱ ≤ feastOrder ℱ') : D.IsDisjointFeast r side ω ℱ := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hf := hfe.finite_bites + have hsN : ∀ {F}, F ∈ ℱ → F.E.ncard ≤ 2 * N := fun hF ↦ ncard_E_le_of_mem hf (fun F hF ↦ + (hfe.all_bites F hF).is_circuit) hord hF + have hone : ∀ {F₁ F₂}, F₁ ∈ ℱ → F₂ ∈ ℱ → F₁ ≠ F₂ → (F₁.V ∩ F₂.V).Subsingleton := by + rintro F₁ F₂ h₁ h₂ hne x ⟨hx₁, hx₂⟩ y ⟨hy₁, hy₂⟩ + by_contra hxy + obtain ⟨ℱ', h₃, h₄, h₅⟩ := X.exists_merge hS hNc hfe hord hsm h₁ h₂ hne hxy hx₁ hx₂ hy₁ hy₂ + have := hmin ℱ' h₃ h₅ + omega + have hnotsub : ∀ {F₁ F₂}, F₁ ∈ ℱ → F₂ ∈ ℱ → F₁ ≠ F₂ → ¬ D.ins F₁ ⊆ D.ins F₂ := by + intro F₁ F₂ h₁ h₂ hne hsub + obtain ⟨ℱ', h₃, h₄, h₅⟩ := X.exists_drop hS hfe hord h₁ h₂ hne hsub + have := hmin ℱ' h₄ fun F hF ↦ hsm F (h₃ hF) + omega + have hrep1 : 1 ≤ D.rep := by have := X.rep_gt; omega + refine ⟨hfe, fun F hF ↦ ?_, fun F hF F' hF' hne ↦ ?_⟩ + · have hb := hfe.all_bites F hF + obtain ⟨v₁, v₂, Β, L, A, A', Di, Do, hsh⟩ := X.shape hS hb (hsN hF) + rw [X.frontier_region] + refine Subset.antisymm (hsh.biteArc_subset) fun x hx ↦ ?_ + rcases hsh.mem_biteArc_or hx.2 hx.1 with h' | ⟨hxV, hxA⟩ + · exact h' + exfalso + obtain ⟨F', hF', hlt, hsub, hrF⟩ := X.exists_shorter hS hsh hxV hxA + have hc' : F'.E.ncard ≤ 2 * N := by have := hsN hF; omega + have hb' : D.IsBiteAt r F' := ⟨X.pole, hF', by have := X.rep_gt; omega, hrF⟩ + have e₁ := feastOrder_diff_singleton hf hF + have e₂ := feastOrder_insert_le (hf.subset (sdiff_subset (t := {F}))) F' + have k₁ := D.ncard_E_eq_hat hb.is_circuit + have k₂ := D.ncard_E_eq_hat hF' + have hmn := hmin (insert F' (ℱ \ {F})) (hfe.of_arc_subset ((hf.subset sdiff_subset).insert F') + ?_ ?_ ?_) ?_ + · omega + · rintro G (rfl | hG) + · exact hb' + · exact hfe.all_bites G hG.1 + · have h₁ := ncard_insert_le F' (ℱ \ {F}) + have h₂ := ncard_sdiff_singleton_add_one hF hf + have := hfe.card_le + omega + · intro z hz + obtain ⟨G, hG, hzG⟩ := mem_iUnion₂.1 hz + by_cases e : G = F + · subst e + exact mem_iUnion₂.2 ⟨F', mem_insert _ _, X.biteArc_subset_of_ins hS hb hb' + (hsN hF) hc' hsub hzG⟩ + · exact mem_iUnion₂.2 ⟨G, mem_insert_of_mem _ ⟨hG, e⟩, hzG⟩ + · rintro G (rfl | hG) + · have := hsm F hF + omega + · exact hsm G hG.1 + · have b₁ := hfe.all_bites F hF + have b₂ := hfe.all_bites F' hF' + obtain ⟨a, ha₁, ha₂⟩ := not_subset.1 (hnotsub hF hF' hne) + obtain ⟨b, hb₁, hb₂⟩ := not_subset.1 (hnotsub hF' hF hne.symm) + have hsub := ins_inter_ins hrep1 b₁.is_circuit b₂.is_circuit b₁.card_lt b₂.card_lt + (hone hF hF' hne) ha₁ ha₂ hb₁ hb₂ + refine Subset.antisymm (fun x hx ↦ ?_) ?_ + · exact (hone hF hF' hne) (hsub hx) ⟨b₁.rstar_mem, b₂.rstar_mem⟩ + · rintro x hx + rw [mem_singleton_iff.1 hx] + exact ⟨D.U_subset_ins b₁.is_circuit b₁.card_lt (F.V_subset_U b₁.rstar_mem), + D.U_subset_ins b₂.is_circuit b₂.card_lt (F'.V_subset_U b₂.rstar_mem)⟩ + +omit X in +omit [T2Space S] [T2Space Shat] in +/-- Two circuits of the same length with the same weight are equal, as the weights are rationally +independent. -/ +theorem eq_of_weight_eq (F F' : Drawing Shat) (hF : F.IsCircuitOf D.rad.G) + (hF' : F'.IsCircuitOf D.rad.G) (hcard : F'.E.ncard = F.E.ncard) (hw : D.tb.weightSub F' + = D.tb.weightSub F) : + F' = F := by + have : ConnectedSpace Shat := cap.connected + have hEE : F'.E = F.E := by + by_contra hne + have hdiff : (F.E \ F'.E).Nonempty := by + by_contra hemp + rw [not_nonempty_iff_eq_empty, sdiff_eq_empty] at hemp + exact hne (eq_of_subset_of_ncard_le hemp hcard.le F'.finite_edges).symm + have hX : F'.E \ F.E ⊆ D.rad.G.E := fun e he ↦ hF'.1.2 he.1 + have hY : F.E \ F'.E ⊆ D.rad.G.E := fun e he ↦ hF.1.2 he.1 + have hd : Disjoint (F'.E \ F.E) (F.E \ F'.E) := disjoint_left.mpr fun e h₁ h₂ ↦ h₁.2 h₂.1 + refine D.tb.weight_ne hX hY hd hdiff ?_ + have split : ∀ {s t : Set (Set Shat)}, s.Finite → ∑ᶠ e ∈ s, D.tb.wtE e = + ∑ᶠ e ∈ s ∩ t, D.tb.wtE e + ∑ᶠ e ∈ s \ t, D.tb.wtE e := by + intro s t hs + have hd : Disjoint (s ∩ t) (s \ t) := disjoint_left.mpr fun _ h₁ h₂ ↦ h₂.2 h₁.2 + rw [← finsum_mem_union hd (hs.inter_of_left _) hs.sdiff, inter_union_sdiff] + have e₁ := split (s := F'.E) (t := F.E) F'.finite_edges + have e₂ := split (s := F.E) (t := F'.E) F.finite_edges + rw [Set.inter_comm] at e₂ + simp only [TieBreaker.weightSub] at hw + linarith + have hUU : F'.U = F.U := by + have key : ∀ {A B : Drawing Shat}, A.IsCircuit → A.E = B.E → A.U ⊆ B.U := by + intro A B hA hE + exact U_of_edges hA B.isClosed_U fun e he ↦ (subset_closure.trans (B.closure_subset_U + (hE ▸ he))) + exact Subset.antisymm (key hF'.2 hEE) (key hF.2 hEE.symm) + refine Drawing.ext_of_V_E ?_ hEE + ext x + exact ⟨fun hx ↦ mem_V_of_mem_U hF.1 (hUU ▸ F'.V_subset_U hx) (hF'.1.1 hx), + fun hx ↦ mem_V_of_mem_U hF'.1 (hUU ▸ F.V_subset_U hx) (hF.1.1 hx)⟩ + +/-- **A feast of least order and then least weight has all its members linked to the tangle.** -/ +theorem linked_of_min (hS : IsSurface S) {ω : List β} {ℱ : Set (Drawing Shat)} {c : ℕ} + (hfe : D.IsFeast r side ω ℱ) (hord : feastOrder ℱ ≤ N) + (hsm : ∀ F ∈ ℱ, F.E.ncard ≤ 2 * c) (hmin : ∀ ℱ', D.IsFeast r side ω ℱ' → (∀ F ∈ ℱ', F.E.ncard + ≤ 2 * c) → feastOrder ℱ ≤ feastOrder ℱ') + (hw : ∀ ℱ', D.IsFeast r side ω ℱ' → (∀ F ∈ ℱ', F.E.ncard ≤ 2 * c) → feastOrder ℱ' + = feastOrder ℱ → D.feastWeight ℱ ≤ D.feastWeight ℱ') {F : Drawing Shat} (hF : F ∈ ℱ) : + GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins F)) (partIn cap D.P.Γ + (closure (D.ins F)ᶜ)) := by + classical + have : ConnectedSpace Shat := cap.connected + have hf := hfe.finite_bites + have hsN : F.E.ncard ≤ 2 * N := ncard_E_le_of_mem hf (fun F hF ↦ (hfe.all_bites F hF).is_circuit) + hord hF + have hb := hfe.all_bites F hF + obtain ⟨F', hF', hle, heq, hsub, hlink⟩ := exists_linked hS X.h3 hb.is_circuit hb.card_lt + have hc' : F'.E.ncard ≤ 2 * N := by omega + have hb' : D.IsBiteAt r F' := X.bite_of_ins hF' hc' (hsub (D.U_subset_ins hb.is_circuit + hb.card_lt (F.V_subset_U hb.rstar_mem))) + have hfA : (ℱ \ {F}).Finite := hf.subset sdiff_subset + have e₁ := feastOrder_diff_singleton hf hF + have e₂ := feastOrder_insert_le hfA F' + have k₁ := D.ncard_E_eq_hat hb.is_circuit + have k₂ := D.ncard_E_eq_hat hF' + have hfe' : D.IsFeast r side ω (insert F' (ℱ \ {F})) := by + refine hfe.of_arc_subset (hfA.insert F') ?_ ?_ ?_ + · rintro G (rfl | hG) + · exact hb' + · exact hfe.all_bites G hG.1 + · have h₁ := ncard_insert_le F' (ℱ \ {F}) + have h₂ := ncard_sdiff_singleton_add_one hF hf + have := hfe.card_le + omega + · intro z hz + obtain ⟨G, hG, hzG⟩ := mem_iUnion₂.1 hz + by_cases e : G = F + · subst e + exact mem_iUnion₂.2 ⟨F', mem_insert _ _, X.biteArc_subset_of_ins hS hb hb' hsN hc' hsub hzG⟩ + · exact mem_iUnion₂.2 ⟨G, mem_insert_of_mem _ ⟨hG, e⟩, hzG⟩ + have hsm' : ∀ G ∈ insert F' (ℱ \ {F}), G.E.ncard ≤ 2 * c := by + rintro G (rfl | hG) + · have := hsm F hF + omega + · exact hsm G hG.1 + have hm₁ := hmin _ hfe' hsm' + have hcard : F'.E.ncard = F.E.ncard := by + by_contra hne + omega + have hnot : F' ∉ ℱ \ {F} := by + intro hm + have : insert F' (ℱ \ {F}) = ℱ \ {F} := insert_eq_of_mem hm + rw [this] at hm₁ + have hpos : 0 < F.E.ncard := (ncard_pos F.finite_edges).2 (IsCircuit.E_nonempty hb.is_circuit.2) + omega + have hm₂ := hw _ hfe' hsm' (by omega) + rw [feastWeight_insert hfA hnot, ← feastWeight_diff_singleton (D := D) hf hF] at hm₂ + have hw₁ := heq hcard + have hEq : F' = F := eq_of_weight_eq F F' hb.is_circuit hF' hcard (le_antisymm hw₁ (by linarith)) + rw [hEq] at hlink + exact hlink + +omit [T2Space S] X in +omit [T2Space Shat] in +/-- The finitely many feasts have one of least order and then least weight, if there is a feast at +all. -/ +theorem exists_min_feast {ω : List β} {c : ℕ} {ℱ₀ : Set (Drawing Shat)} + (hfe : D.IsFeast r side ω ℱ₀) (hsm : ∀ F ∈ ℱ₀, F.E.ncard ≤ 2 * c) : + ∃ ℱ, D.IsFeast r side ω ℱ ∧ (∀ F ∈ ℱ, F.E.ncard ≤ 2 * c) ∧ feastOrder ℱ ≤ feastOrder ℱ₀ ∧ + (∀ ℱ', D.IsFeast r side ω ℱ' → (∀ F ∈ ℱ', F.E.ncard ≤ 2 * c) → feastOrder ℱ ≤ feastOrder ℱ') ∧ + ∀ ℱ', D.IsFeast r side ω ℱ' → (∀ F ∈ ℱ', F.E.ncard ≤ 2 * c) → feastOrder ℱ' = feastOrder ℱ + → D.feastWeight ℱ ≤ D.feastWeight ℱ' := by + classical + let 𝒳 : Set (Set (Drawing Shat)) := {ℱ | D.IsFeast r side ω ℱ ∧ ∀ F ∈ ℱ, F.E.ncard ≤ 2 * c} + have hfin : 𝒳.Finite := by + refine (finite_circuits D.rad.G).finite_subsets.subset fun ℱ hℱ F hF ↦ ?_ + have := (hℱ.1.all_bites F hF).is_circuit + exact ⟨this.2, this.1⟩ + have hne : 𝒳.Nonempty := ⟨ℱ₀, hfe, hsm⟩ + obtain ⟨ℱ, hℱ, hm⟩ := exists_min_image 𝒳 (fun ℱ ↦ toLex (feastOrder ℱ, D.feastWeight ℱ)) hfin hne + refine ⟨ℱ, hℱ.1, hℱ.2, ?_, fun ℱ' h₁ h₂ ↦ ?_, fun ℱ' h₁ h₂ h₃ ↦ ?_⟩ + · have := hm ℱ₀ ⟨hfe, hsm⟩ + rw [Prod.Lex.toLex_le_toLex] at this + rcases this with h | h + · exact h.le + · exact h.1.le + · have := hm ℱ' ⟨h₁, h₂⟩ + rw [Prod.Lex.toLex_le_toLex] at this + rcases this with h | h + · exact h.le + · exact h.1.le + · have := hm ℱ' ⟨h₁, h₂⟩ + rw [Prod.Lex.toLex_le_toLex] at this + rcases this with h | h + · exact absurd h (by simp only [h₃, lt_irrefl, not_false_eq_true]) + · exact h.2 + +end IsSideSetting + +variable (hS : IsSurface S) (h3 : D.P.Γ.IsInternallyThreeConnected) +include hS h3 + +omit [T2Space S] hS in +/-- What it means to be flawed on a side, read at the pole of the cuff of the side. -/ +theorem isSideSetting_of_flawed {side : Set S} (hside : side ∈ χ.Φ.longSides) {n : ℕ} {ω : List β} + (hω : ω ≠ []) (hfl : D.IsFlawedOnSide side n ω) {Θ : Set S} {r : Shat} + (hsΘ : side ⊆ Θ) (hΘ : Θ ∈ cuffs S) (hr : r ∈ D.rad.poles) (hreg : D.rad.regionOf r + = cap.cuffDisc Θ) : D.IsSideSetting side Θ r ((ω.length + 1) * n) := by + obtain ⟨hrep, hdist, hnd, hnf, -⟩ := hfl + have hm1 : 1 ≤ ω.length := List.length_pos_iff.2 hω + have hrepN : (ω.length + 1) * n < D.rep := by nlinarith + have hd : ∀ r₁ ∈ D.rad.poles, ∀ r₂ ∈ D.rad.poles, r₁ ≠ r₂ → (ω.length + 1) * n < D.vDist r₁ r₂ + := by + intro r₁ h₁ r₂ h₂ hne + by_contra hle + exact hnd ⟨hrepN, hdist, r₁, h₁, r₂, h₂, hne, not_lt.1 hle⟩ + exact ⟨h3, hside, hsΘ, hΘ, hr, hreg, hrepN, hd, fun C hC ↦ hnf ⟨hrepN, hd, C, hC⟩⟩ + +/-- **Graph Minors XIX, (11.3)** (page 360): "Every feast of minimum order with order $\le (m + 1)n$ +is disjoint." -/ +theorem theorem_11_3_proof {side : Set S} (hside : side ∈ χ.Φ.longSides) {n : ℕ} (_ : 4 + ≤ n) {ω : List β} (hω : ω ≠ []) (hfl : D.IsFlawedOnSide side n ω) {Θ : Set S} {r : Shat} + (hsΘ : side ⊆ Θ) (hΘ : Θ ∈ cuffs S) (hr : r ∈ D.rad.poles) (hreg : D.rad.regionOf r + = cap.cuffDisc Θ) {ℱ : Set (Drawing Shat)} (hfe : D.IsFeast r side ω ℱ) + (hord : feastOrder ℱ ≤ (ω.length + 1) * n) (hmin : ∀ ℱ', D.IsFeast r side ω ℱ' → feastOrder ℱ + ≤ feastOrder ℱ') : D.IsDisjointFeast r side ω ℱ := by + have X := isSideSetting_of_flawed h3 hside hω hfl hsΘ hΘ hr hreg + exact X.isDisjointFeast_of_min hS (c := (ω.length + 1) * n) (by omega) hfe hord + (fun F hF ↦ ncard_E_le_of_mem hfe.finite_bites (fun F hF ↦ (hfe.all_bites F hF).is_circuit) + hord hF) fun ℱ' h _ ↦ hmin ℱ' h + +/-- **Graph Minors XIX, (11.4)** (page 361): "Let $\mathcal{F}$ be a feast of minimum order $\le +(m+1)n$ and subject to that with +$\Sigma(\lambda(F) : F \in \mathcal{F})$ minimum. Then each $F \in \mathcal{F}$ is +$\lambda$-linked to $\mathcal{T}$." -/ +theorem theorem_11_4_proof {side : Set S} (hside : side ∈ χ.Φ.longSides) {n : ℕ} (_ : 4 + ≤ n) {ω : List β} (hω : ω ≠ []) (hfl : D.IsFlawedOnSide side n ω) {Θ : Set S} {r : Shat} + (hsΘ : side ⊆ Θ) (hΘ : Θ ∈ cuffs S) (hr : r ∈ D.rad.poles) (hreg : D.rad.regionOf r + = cap.cuffDisc Θ) {ℱ : Set (Drawing Shat)} (hfe : D.IsFeast r side ω ℱ) + (hord : feastOrder ℱ ≤ (ω.length + 1) * n) (hmin : ∀ ℱ', D.IsFeast r side ω ℱ' → feastOrder ℱ + ≤ feastOrder ℱ') + (hw : ∀ ℱ', D.IsFeast r side ω ℱ' → feastOrder ℱ' = feastOrder ℱ → D.feastWeight ℱ + ≤ D.feastWeight ℱ') {F : Drawing Shat} (hF : F ∈ ℱ) : + IsLambdaLinkedCircuit D.tb D.ord D.𝒯 F := by + have X := isSideSetting_of_flawed h3 hside hω hfl hsΘ hΘ hr hreg + have hl := X.linked_of_min hS (c := (ω.length + 1) * n) hfe hord (fun F hF ↦ ncard_E_le_of_mem + hfe.finite_bites (fun F hF ↦ (hfe.all_bites F hF).is_circuit) hord hF) + (fun ℱ' h _ ↦ hmin ℱ' h) (fun ℱ' h _ h' ↦ hw ℱ' h h') hF + exact isLambdaLinkedCircuit_of_ins (hfe.all_bites F hF).is_circuit (hfe.all_bites F hF).card_lt hl + +/-- **The flaw of a side**, as the paper uses it in the proof of (11.1). The members have `½|E(F)| < +(m + 1)n`, and removing a member leaves no feast. -/ +theorem exists_side_flaw {side : Set S} (hside : side ∈ χ.Φ.longSides) {n : ℕ} (hn : 4 + ≤ n) {ω : List β} (hω : ω ≠ []) (hfl : D.IsFlawedOnSide side n ω) : + ∃ (r : Shat) (Θ : Set S) (ℱ : Set (Drawing Shat)), D.IsSideSetting side Θ r + ((ω.length + 1) * n) ∧ D.IsSideLabelFlaw r side n ω ℱ ∧ + (∀ F ∈ ℱ, F.E.ncard ≤ 2 * ((ω.length + 1) * n - 1)) ∧ + (∀ F ∈ ℱ, GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins F)) + (partIn cap D.P.Γ (closure (D.ins F)ᶜ))) ∧ + ∀ F ∈ ℱ, ¬ D.IsFeast r side ω (ℱ \ {F}) := by + obtain ⟨r, Θ, hΘ, hsΘ, hr, hreg, ℱ₀, hf₀, ho₀, hs₀⟩ := theorem_11_2_proof hS h3 hside hn hω hfl + have X := isSideSetting_of_flawed h3 hside hω hfl hsΘ hΘ hr hreg + have hm1 : 1 ≤ ω.length := List.length_pos_iff.2 hω + set N := (ω.length + 1) * n with hN + have h2n : 2 * n ≤ N := by rw [hN]; nlinarith + have hsm₀ : ∀ F ∈ ℱ₀, F.E.ncard ≤ 2 * (N - 1) := fun F hF ↦ by have := hs₀ F hF; omega + obtain ⟨ℱ, hfe, hsm, hle, hmin, hw⟩ := IsSideSetting.exists_min_feast hf₀ hsm₀ + have hord : feastOrder ℱ ≤ N := hle.trans ho₀ + have hNc : N ≤ N - 1 + 1 := by omega + have hdis := X.isDisjointFeast_of_min hS hNc hfe hord hsm hmin + have hlink := fun F hF ↦ X.linked_of_min hS (c := N - 1) hfe hord hsm hmin hw (F := F) hF + refine ⟨r, Θ, ℱ, X, ⟨hdis, hord, fun F hF ↦ isLambdaLinkedCircuit_of_ins + (hfe.all_bites F hF).is_circuit (hfe.all_bites F hF).card_lt (hlink F hF)⟩, hsm, hlink, fun F + hF h ↦ ?_⟩ + have := hmin _ h fun G hG ↦ hsm G hG.1 + have e := feastOrder_diff_singleton hfe.finite_bites hF + have : ConnectedSpace Shat := cap.connected + have hb := hfe.all_bites F hF + have k := D.ncard_E_eq_hat hb.is_circuit + have hpos : 0 < F.E.ncard := (ncard_pos F.finite_edges).2 (IsCircuit.E_nonempty hb.is_circuit.2) + omega + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section11e.lean b/LeanPool/GraphMinor/GM19/Section11e.lean new file mode 100644 index 0000000000..256f9a3f50 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section11e.lean @@ -0,0 +1,344 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section11d +public import LeanPool.GraphMinor.GM19.SideDisc +public import LeanPool.GraphMinor.GM19.SideShape +import LeanPool.GraphMinor.GM19.Section6Cuff + +/-! +# Graph Minors XIX, Section 11: the bites of a flaw and the cuff + +Here is what the proof of (11.1) uses of a disjoint feast, one bite at a time. A bite misses the +other cuffs (`IsSideSetting.disjoint_cuff_ins`), so each `ins(F)` is a chord disc of the +closed disc of the cuff (`IsBiteShape.isChordDisc`). If `I(F)` missed the closure of the side, then +`F` could be dropped from the feast (`IsSideSetting.biteArc_meets_side`). So each long side other +than +`S` keeps one piece when the arcs `I(F)` are taken out (`IsSideSetting.keep_of_meets`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} + +variable (hS : IsSurface S) +include hS + +omit hS in +omit [T2Space Shat] in +omit [T2Space S] in +omit hS in +/-- The closure of the region of `r` without the region is the cuff. -/ +theorem closure_region_sdiff {r : Shat} {Θ : Set S} (hΘ : Θ ∈ cuffs S) + (hreg : D.rad.regionOf r = cap.cuffDisc Θ) : + closure (D.rad.regionOf r) \ D.rad.regionOf r = cap.emb '' Θ := by + rw [hreg, cap.closure_cuffDisc hΘ] + ext x + constructor + · rintro ⟨hx | hx, hn⟩ + · exact absurd hx hn + · exact hx + · rintro ⟨y, hy, rfl⟩ + exact ⟨Or.inr (mem_image_of_mem _ hy), fun hd ↦ cap.notMem_range hΘ hd (mem_range_self y)⟩ + +omit [T2Space S] [T2Space Shat] in +omit hS in +/-- A point of `Σ` on the chord of a bite is an end of the chord. -/ +theorem IsBiteShape.Β_range {r Θ F v₁ v₂ Β L A A' Di Do} (h : D.IsBiteShape r Θ F v₁ v₂ Β L A A' Di + Do) {x : S} (hx : cap.emb x ∈ Β) : cap.emb x ∈ Β ∩ L := by + have hin : cap.emb x ∈ cap.emb '' Θ := by + have := h.Β_E hx + rw [cap.closure_cuffDisc h.cuff] at this + rcases this with h' | h' + · exact absurd (mem_range_self x) (cap.notMem_range h.cuff h') + · exact h' + have : cap.emb x ∈ Β ∩ cap.emb '' Θ := ⟨hx, hin⟩ + rw [h.meet] at this + rw [h.Β_L] + exact this + +omit [T2Space S] [T2Space Shat] in +omit hS in +/-- The circuit and the line of a bite have the same points in `Σ`. -/ +theorem IsBiteShape.preimage_U {r Θ F v₁ v₂ Β L A A' Di Do} (h : D.IsBiteShape r Θ F v₁ v₂ Β L A A' + Di Do) : cap.emb ⁻¹' F.U = cap.emb ⁻¹' L := by + ext x + constructor + · intro hx + change cap.emb x ∈ F.U at hx + rw [h.F_eq] at hx + rcases hx with hx | hx + · exact (h.Β_range hx).2 + · exact hx + · intro hx + change cap.emb x ∈ F.U + rw [h.F_eq] + exact Or.inr hx + +omit [T2Space S] in +omit hS in +/-- **The arc and its complement in the cuff.** -/ +theorem IsBiteShape.cuff_mem_A' {r Θ F v₁ v₂ Β L A A' Di Do} (h : D.IsBiteShape r Θ F v₁ v₂ Β L A + A' Di Do) {x : S} (hx : x ∈ Θ) : + x ∈ cap.emb ⁻¹' A' ↔ x ∉ cap.emb ⁻¹' D.biteArc r F := by + rw [mem_preimage, mem_preimage, h.biteArc_eq] + constructor + · rintro hA' (hA | hend) + · have h₁ : cap.emb x ∈ Di := Surface.discBd_subset _ (h.bd_i ▸ Or.inl hA) + have h₂ : cap.emb x ∈ Do := Surface.discBd_subset _ (h.bd_o ▸ Or.inl hA') + have h₃ : cap.emb x ∈ Β := h.inter ▸ ⟨h₁, h₂⟩ + exact (h.A_sub hA).2 (h.meet ▸ ⟨h₃, mem_image_of_mem _ hx⟩) + · exact (h.A'_sub hA').2 hend + · intro hn + rcases h.cover ⟨mem_image_of_mem _ hx, fun he ↦ hn (Or.inr he)⟩ with h' | h' + · exact absurd (Or.inl h') hn + · exact h' + +omit [T2Space S] hS in +omit [T2Space Shat] in +/-- The complement of the arc is connected. -/ +theorem IsBiteShape.isPreconnected_A' {r Θ F v₁ v₂ Β L A A' Di Do} (h : D.IsBiteShape r Θ F v₁ v₂ Β + L A A' Di Do) : IsPreconnected (cap.emb ⁻¹' A') := by + rw [← cap.isEmbedding.isInducing.isPreconnected_image, image_preimage_eq_of_subset fun x hx ↦ + image_subset_range _ _ (h.A'_sub hx).1] + exact h.A'_conn + +omit [T2Space S] in +omit hS in +/-- A bite whose arc is all of `ins(F)` on the cuff is a chord disc of the closed disc of the cuff. +-/ +theorem IsBiteShape.isChordDisc {r Θ F v₁ v₂ Β L A A' Di Do} (h : D.IsBiteShape r Θ F v₁ v₂ Β L A + A' Di Do) + (ha : D.biteArc r F = D.ins F ∩ (closure (D.rad.regionOf r) \ D.rad.regionOf r)) : + IsChordDisc (closure (cap.cuffDisc Θ)) (D.ins F) Β (cap.emb v₁) (cap.emb v₂) := by + have : ConnectedSpace Shat := cap.connected + have hT := cap.isClosedSurface + have hi := D.ins_spec h.circuit h.lt + have hbd : discBd (D.ins F) = F.U := hi.2.2.2.1 + have hEb : discBd (closure (cap.cuffDisc Θ)) = cap.emb '' Θ := cap.cuffDisc_bd Θ h.cuff + have hdE : cap.cuffDisc Θ = discInt (closure (cap.cuffDisc Θ)) := cap.cuffDisc_eq_discInt + h.cuff + refine ⟨hi.2.2.1, fun he ↦ h.ne (cap.isEmbedding.injective he), h.line, + hbd ▸ h.Β_F, h.Β_E, ?_, ?_, ?_⟩ + · rw [hEb] + exact h.meet + · rw [← hdE, hbd] + exact fun x hx ↦ h.F_disc x hx.2 hx.1 + · rintro x ⟨hxE, hxb⟩ hxΒ + rw [hEb] at hxE + rw [hbd] at hxb + have hxI : x ∈ D.biteArc r F := by + rw [ha, closure_region_sdiff h.cuff h.reg] + exact ⟨D.U_subset_ins h.circuit h.lt hxb, hxE⟩ + rw [h.biteArc_eq] at hxI + rcases hxI with hA | hend + · refine ⟨discInt Di, fun y hy ↦ h.in_E hy, fun y hy ↦ discInt_subset _ (h.in_ins hy), + h.di.nonempty_discInt, h.di.isPreconnected_discInt, ?_⟩ + rw [closure_discInt h.di] + exact Surface.discBd_subset _ (h.bd_i ▸ Or.inl hA) + · exact absurd (h.meet.symm ▸ hend : x ∈ Β ∩ cap.emb '' Θ).1 hxΒ + +end TangleDatum + +namespace TangleDatum.IsSideSetting + +variable {D : TangleDatum cap χ} {side Θ : Set S} {r : Shat} {N : ℕ} (X : D.IsSideSetting side Θ r + N) +include X + +/-- **A bite misses the other cuffs.** A vertex of the bite on another cuff would bring the two +poles too close together. -/ +theorem disjoint_cuff_ins (hS : IsSurface S) (hgt : ((N + 2 : ℕ) : ℕ∞) < 2 * Painting.dist D.rad) + {F : Drawing Shat} (hc : F.E.ncard ≤ 2 * N) {v₁ v₂ Β L A A' Di Do} (h : D.IsBiteShape r Θ F v₁ v₂ + Β L A A' Di Do) {Θ' : Set S} + (hΘ' : Θ' ∈ cuffs S) (hne : Θ' ≠ Θ) : Disjoint (closure (cap.cuffDisc Θ')) (D.ins F) := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨p, hp, hpd, hreg'⟩ := D.rad.exists_pole hΘ' + have hrd : r ∈ cap.cuffDisc Θ := by + rw [← h.reg] + exact (D.rad.regionOf_mem h.pole.1).2 + have hEE : Disjoint (closure (cap.cuffDisc Θ')) (closure (cap.cuffDisc Θ)) + := cap.cuffDisc_disjoint _ hΘ' _ h.cuff hne + have hri : r ∈ D.ins F := D.U_subset_ins h.circuit h.lt (F.V_subset_U h.r_mem) + have huniq : ∀ q ∈ D.rad.poles, q ∈ D.ins F → q = r := fun q hq hqi ↦ by + by_contra hn + have h₁ := vDist_le_of_ins X.rep_gt h.circuit hc hq h.pole hn hqi hri + have h₂ := X.far q hq r h.pole hn + omega + have hpr : p ≠ r := by + rintro rfl + exact disjoint_left.1 hEE (subset_closure hpd) (subset_closure hrd) + have hpi : p ∉ D.ins F := fun hi ↦ hpr (huniq p hp hi) + have hcover := U_subset_of_one_pole h.circuit.1 h.reg hrd fun q hq hqF ↦ huniq q hq + (D.U_subset_ins h.circuit h.lt (F.V_subset_U hqF)) + have hdis : Disjoint (cap.cuffDisc Θ') F.U := disjoint_left.2 fun x hx hxF ↦ by + rcases hcover hxF with h' | h' + · exact cap.notMem_range hΘ' hx h' + · exact disjoint_left.1 hEE (subset_closure hx) (subset_closure h') + refine disjoint_left.2 fun x hx hxi ↦ ?_ + have hxF := D.cuff_inter_ins_of_disjoint h.circuit h.lt hp hpi hreg' hdis hx hxi + rw [cap.closure_cuffDisc hΘ'] at hx + rcases hx with hx | ⟨v, hv, rfl⟩ + · exact disjoint_left.1 hdis hx hxF + · obtain ⟨hvV, hvF, -⟩ := D.rad.bd_point h.circuit.1 (cuff_subset_bd ⟨Θ', hΘ'⟩ hv) hxF + have hm₁ : cap.emb v₁ ∈ Β := (h.meet ▸ mem_insert _ _ : cap.emb v₁ ∈ Β ∩ cap.emb '' Θ).1 + obtain ⟨-, hv₁F, -⟩ := D.rad.bd_point h.circuit.1 (cuff_subset_bd ⟨Θ, h.cuff⟩ h.v₁_cuff) + (h.Β_F hm₁) + have hd := D.rad.dist_le_of_two_cuffs hS X.h3 h.circuit h.cuff hΘ' hne.symm h.v₁_cuff hv + h.v₁_mem hvV hv₁F hvF + revert hd hgt + generalize Painting.dist D.rad = d + cases d using ENat.recTopCoe with + | top => + intro _ hd + simp at hd + | coe d => + intro hgt hd + norm_cast at hd hgt + omega + +/-- **Each bite of a least feast reaches the closure of the side.** Otherwise the feast keeps its +properties without `F`: the arcs of `ℱ` are disjoint, so a short side touching +`S` lies in one arc, and it is not `I(F)`, since `I(F)` is closed and misses the closure of `S`. -/ +theorem biteArc_meets_side (hS : IsSurface S) {ω : List β} {ℱ : Set (Drawing Shat)} + (hfe : D.IsDisjointFeast r side ω ℱ) (hsm : ∀ F ∈ ℱ, F.E.ncard ≤ 2 * N) + (hmin : ∀ F ∈ ℱ, ¬ D.IsFeast r side ω (ℱ \ {F})) {F : Drawing Shat} (hF : F ∈ ℱ) : + (cap.emb ⁻¹' D.biteArc r F ∩ closure side).Nonempty := by + classical + by_contra hno + rw [not_nonempty_iff_eq_empty] at hno + have hf := hfe.finite_bites + have hsh : ∀ G ∈ ℱ, ∃ v₁ v₂ Β L A A' Di Do, D.IsBiteShape r Θ G v₁ v₂ Β L A A' Di Do + := fun G hG ↦ X.shape hS (hfe.all_bites G hG) (hsm G hG) + have hcl : ∀ G ∈ ℱ, IsClosed (cap.emb ⁻¹' D.biteArc r G) := fun G hG ↦ by + obtain ⟨_, _, _, _, _, _, _, _, s⟩ := hsh G hG + exact (s.isLine_biteArc |> isClosed_of_cuffLine).preimage cap.isEmbedding.continuous + have hdisj : ∀ G ∈ ℱ, ∀ G' ∈ ℱ, G ≠ G' → Disjoint (cap.emb ⁻¹' D.biteArc r G) + (cap.emb ⁻¹' D.biteArc r G') := fun G hG G' hG' hne ↦ by + obtain ⟨_, _, _, _, _, _, _, _, s⟩ := hsh G hG + obtain ⟨_, _, _, _, _, _, _, _, s'⟩ := hsh G' hG' + refine disjoint_left.2 fun x hx hx' ↦ ?_ + have : cap.emb x ∈ D.ins G ∩ D.ins G' := ⟨(s.biteArc_subset hx).1, + (s'.biteArc_subset hx').1⟩ + rw [hfe.ins_inter G hG G' hG' hne] at this + exact D.pole_notMem_range X.pole (this ▸ mem_range_self x) + have hrest : IsClosed (⋃ G ∈ ℱ \ {F}, cap.emb ⁻¹' D.biteArc r G) := + (hf.subset sdiff_subset).isClosed_biUnion fun G hG ↦ hcl G hG.1 + have hshort : ∀ s ∈ χ.Φ.shortSides, (closure s ∩ closure side).Nonempty + → cap.emb '' s ⊆ D.feastArcUnion r (ℱ \ {F}) := by + intro s hs hne + have hsub := hfe.includes_short_sides s hs hne + have hsS : s ⊆ cap.emb ⁻¹' D.biteArc r F ∪ ⋃ G ∈ ℱ \ {F}, cap.emb ⁻¹' D.biteArc r G + := fun x hx ↦ by + obtain ⟨G, hG, hxG⟩ := mem_iUnion₂.1 (hsub (mem_image_of_mem _ hx)) + by_cases he : G = F + · exact Or.inl (he ▸ hxG) + · exact Or.inr (mem_biUnion ⟨hG, he⟩ hxG) + have hconn : IsPreconnected s := hs.1.2.2.1.isConnected.isPreconnected + have hemp : s ∩ ((cap.emb ⁻¹' D.biteArc r F) ∩ ⋃ G ∈ ℱ \ {F}, cap.emb ⁻¹' D.biteArc r G) = ∅ + := by + rw [eq_empty_iff_forall_notMem] + rintro x ⟨-, hx₁, hx₂⟩ + obtain ⟨G, hG, hxG⟩ := mem_iUnion₂.1 hx₂ + exact disjoint_left.1 (hdisj F hF G hG.1 (fun he ↦ hG.2 he.symm)) hx₁ hxG + rcases isPreconnected_iff_subset_of_disjoint_closed.1 hconn _ _ (hcl F hF) hrest hsS hemp with + hA | hB + · exfalso + obtain ⟨a, ha₁, ha₂⟩ := hne + have : a ∈ cap.emb ⁻¹' D.biteArc r F := closure_minimal hA (hcl F hF) ha₁ + have hm : a ∈ cap.emb ⁻¹' D.biteArc r F ∩ closure side := ⟨this, ha₂⟩ + rw [hno] at hm + exact hm + · rintro _ ⟨x, hx, rfl⟩ + obtain ⟨G, hG, hxG⟩ := mem_iUnion₂.1 (hB hx) + exact mem_biUnion hG hxG + refine hmin F hF ⟨hf.subset sdiff_subset, fun G hG ↦ hfe.all_bites G hG.1, + (ncard_le_ncard sdiff_subset hf).trans hfe.card_le, hshort, ?_⟩ + have heq : side \ cap.emb ⁻¹' D.feastArcUnion r (ℱ \ {F}) = side \ cap.emb ⁻¹' D.feastArcUnion r + ℱ := by + ext x + constructor + · rintro ⟨h₁, h₂⟩ + refine ⟨h₁, fun h₃ ↦ h₂ ?_⟩ + obtain ⟨G, hG, hxG⟩ := mem_iUnion₂.1 h₃ + refine mem_biUnion (⟨hG, ?_⟩ : G ∈ ℱ \ {F}) hxG + intro he + rw [mem_singleton_iff.1 he] at hxG + have hm : x ∈ cap.emb ⁻¹' D.biteArc r F ∩ closure side := ⟨hxG, subset_closure h₁⟩ + rw [hno] at hm + exact hm + · rintro ⟨h₁, h₂⟩ + refine ⟨h₁, fun h₃ ↦ h₂ ?_⟩ + obtain ⟨G, hG, hxG⟩ := mem_iUnion₂.1 h₃ + exact mem_biUnion hG.1 hxG + rw [heq] + exact hfe.component_omits + +/-- **A long side other than `S` keeps one piece.** Each arc `I(F)` holds a point of the closure of +`S`, which is off the other side, so taking out the arcs one at a time leaves +a connected part of the side. -/ +theorem keep_of_meets (hS : IsSurface S) {ℱ : Finset (Drawing Shat)} {s : Set S} (hsΘ : s ⊆ Θ) + (hc : IsPathConnected s) (hdis : Disjoint (closure side) s) + (hshape : ∀ F ∈ ℱ, ∃ A' : Set Shat, IsPreconnected (cap.emb ⁻¹' A') ∧ ∀ x ∈ Θ, + (x ∈ cap.emb ⁻¹' A' ↔ x ∉ cap.emb ⁻¹' D.biteArc r F) ∧ cap.emb ⁻¹' A' ⊆ Θ) + (hm : ∀ F ∈ ℱ, (cap.emb ⁻¹' D.biteArc r F ∩ closure side).Nonempty) : + s \ (⋃ F ∈ ℱ, cap.emb ⁻¹' D.biteArc r F) = ∅ ∨ IsPathConnected (s \ ⋃ F ∈ ℱ, cap.emb ⁻¹' + D.biteArc r F) := by + classical + have hO : IsOArc Θ := ⟨cuffPar hS ⟨Θ, X.cuff⟩⟩ + induction ℱ using Finset.induction_on with + | empty => + right + simpa using hc + | insert F ℱ hF ih => + have ih' := ih (fun G hG ↦ hshape G (Finset.mem_insert_of_mem hG)) fun G hG ↦ hm G + (Finset.mem_insert_of_mem hG) + obtain ⟨A', hconn, hA'⟩ := hshape F (Finset.mem_insert_self _ _) + obtain ⟨w, hw₁, hw₂⟩ := hm F (Finset.mem_insert_self _ _) + set P := s \ ⋃ G ∈ ℱ, cap.emb ⁻¹' D.biteArc r G with hP + have hQsub : cap.emb ⁻¹' A' ⊆ Θ := fun x hx ↦ by + obtain ⟨z, hz⟩ : Θ.Nonempty := ⟨_, (cuffPar hS ⟨Θ, X.cuff⟩ 1).2⟩ + exact (hA' z hz).2 hx + have hset : s \ (⋃ G ∈ insert F ℱ, cap.emb ⁻¹' D.biteArc r G) = P ∩ cap.emb ⁻¹' A' := by + ext x + simp only [hP, mem_sdiff, mem_inter_iff, mem_iUnion₂, Finset.mem_insert, exists_prop, + not_exists, not_and, forall_eq_or_imp] + constructor + · rintro ⟨h₁, h₂, h₃⟩ + exact ⟨⟨h₁, h₃⟩, (hA' x (hsΘ h₁)).1.2 h₂⟩ + · rintro ⟨⟨h₁, h₃⟩, h₂⟩ + exact ⟨h₁, (hA' x (hsΘ h₁)).1.1 h₂, h₃⟩ + rw [hset] + rcases ih' with h' | h' + · left + rw [h', empty_inter] + · refine oArc_inter_isPathConnected hO (w := w) (?_) (fun x hx ↦ ⟨hsΘ hx.1, + ?_⟩) (fun x hx ↦ ⟨hQsub hx, ?_⟩) h'.isConnected.isPreconnected hconn + · have hws : w ∈ closure Θ := closure_mono X.side_cuff hw₂ + rwa [(isClosed_cuff hS ⟨Θ, X.cuff⟩).closure_eq] at hws + · rintro rfl + exact disjoint_left.1 hdis hw₂ hx.1 + · rintro rfl + exact (hA' x (hQsub hx)).1.1 hx hw₁ + +end TangleDatum.IsSideSetting + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section11f.lean b/LeanPool/GraphMinor/GM19/Section11f.lean new file mode 100644 index 0000000000..f27633bb7b --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section11f.lean @@ -0,0 +1,545 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section11e + +/-! +# Graph Minors XIX, Section 11: the data of a flaw on a side + +A flaw `ℱ` on a side is turned into a feature `K`, the lines `L(F)` of the bites in `Σ`, a closed +disc `Z` around the cuff and all the bites, and the family of the discs `ins(F)`. This +is `TangleDatum.IsSideSetting.exists_side_data`, and `IsSideData` says what is obtained. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +/-- What a flaw on `side` gives. -/ +structure IsSideData (D : TangleDatum cap χ) (side : Set S) (N : ℕ) (ω : List β) (𝓓 : Set + (Set Shat)) (Z : Set Shat) (K : Drawing S) : Prop where + shape : IsSideShape cap χ.Φ side K Z + finite : 𝓓.Finite + discs : ∀ Δ ∈ 𝓓, IsClosedDisc Δ + int_eq : cap.emb ⁻¹' discInt Z = ⋃ Δ ∈ 𝓓, cap.emb ⁻¹' discInt Δ + family : IsLinkedFamily D N (discPairs cap 𝓓) + card : 𝓓.ncard ≤ ω.length + 1 + feature : IsFeature χ.Φ K + inter : D.P.Γ.U ∩ K.U ⊆ D.P.Γ.V ∩ K.V + lines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} + ∧ IsLineWithEnds (closure e) u v + size : K.V.ncard + K.E.ncard ≤ 8 * N + pieces : ∃ 𝓞 𝓛 : Set (Set S), 𝓞.Finite ∧ 𝓛.Finite ∧ (∀ C ∈ 𝓞, IsOArc C) ∧ + (∀ L ∈ 𝓛, ∃ s t, s ≠ t ∧ IsLineWithEnds L s t ∧ s ∈ bd S ∪ ⋃₀ 𝓞 ∧ t ∈ bd S ∪ ⋃₀ 𝓞) ∧ K.U + = ⋃₀ 𝓞 ∪ ⋃₀ 𝓛 + roots : ∀ Δ ∈ 𝓓, ∀ v ∈ D.P.Γ.V, cap.emb v ∈ Δ → cap.emb v ∈ closure Δᶜ → v ∈ K.U + outer : ∀ v ∈ K.U, ∀ Δ ∈ 𝓓, cap.emb v ∈ closure Δᶜ + anchored : IsAnchored D.P.Γ K + omits : ∀ B ⊆ side \ (cap.emb ⁻¹' discInt Z ∪ K.U), IsPreconnected B → ∃ (h : ℕ) + (hh : h < ω.length), ∀ e ∈ D.P.Γ.E, e ⊆ B → ¬ (χ.ΩS side).le ω[h] (D.P.φ e) + +theorem ncard_biUnion_le_sum {ι T : Type*} (ℐ : Finset ι) (f : ι → Set T) (hf : ∀ i ∈ ℐ, + (f i).Finite) : (⋃ i ∈ ℐ, f i).ncard ≤ ∑ i ∈ ℐ, (f i).ncard := by + classical + induction ℐ using Finset.induction_on with + | empty => simp + | insert a ℐ ha ih => + rw [Finset.sum_insert ha, Finset.set_biUnion_insert] + have hfi : (⋃ i ∈ ℐ, f i).Finite := ℐ.finite_toSet.biUnion fun i hi ↦ hf i + (Finset.mem_insert_of_mem hi) + have := ih fun i hi ↦ hf i (Finset.mem_insert_of_mem hi) + have h₂ := ncard_union_le (f a) (⋃ i ∈ ℐ, f i) + omega + +namespace TangleDatum.IsSideSetting + +variable {D : TangleDatum cap χ} {side Θ : Set S} {r : Shat} {N : ℕ} (X : D.IsSideSetting side Θ r + N) +include X + +omit X in +private theorem side_vertices_card_le_order + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} + {β : Type w} + {χ : ColourScheme S β} + {D : TangleDatum cap χ} + {side : Set S} + {r : Shat} + {N : ℕ} + {n : ℕ} + {ω : List β} + {ℱ : Set (Drawing Shat)} + (hN : N = (ω.length + 1) * n) + (hfl : D.IsSideLabelFlaw r side n ω ℱ) + (hf : ℱ.Finite) + (hG : ∀ {F : Drawing Shat}, F ∈ ℱ → F.IsCircuitOf D.rad.G) + (U₀ : Set S) + (hU : ∀ {x : S}, x ∈ U₀ ↔ ∃ F ∈ ℱ, cap.emb x ∈ F.U) : + (U₀ ∩ D.P.Γ.V).ncard ≤ N := by + have hsubV : U₀ ∩ D.P.Γ.V ⊆ ⋃ F ∈ hf.toFinset, cap.emb ⁻¹' F.U ∩ D.P.Γ.V := fun x hx ↦ by + obtain ⟨F, hF, hxF⟩ := hU.1 hx.1 + exact mem_biUnion (hf.mem_toFinset.2 hF) ⟨hxF, hx.2⟩ + have hfin : ∀ F ∈ hf.toFinset, (cap.emb ⁻¹' F.U ∩ D.P.Γ.V).Finite := fun F _ ↦ + D.P.Γ.finite_V.subset inter_subset_right + have h₁ := ncard_le_ncard hsubV (hf.toFinset.finite_toSet.biUnion hfin) + have h₂ := ncard_biUnion_le_sum hf.toFinset (fun F ↦ cap.emb ⁻¹' F.U ∩ D.P.Γ.V) hfin + have h₃ : ∑ F ∈ hf.toFinset, (cap.emb ⁻¹' F.U ∩ D.P.Γ.V).ncard ≤ ∑ F ∈ hf.toFinset, F.E.ncard / 2 + := Finset.sum_le_sum fun F hF ↦ by + have := D.two_mul_ncard_le (hG (hf.mem_toFinset.1 hF)) (U₀ := cap.emb ⁻¹' F.U) fun x hx ↦ hx + omega + have h₄ : feastOrder ℱ = ∑ F ∈ hf.toFinset, F.E.ncard / 2 := dite_eq_left hf + have h₅ := hfl.order_le + omega + +omit X in +private theorem side_shape_of_feast_discs + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [T2Space S] + [TopologicalSpace Shat] + [T2Space Shat] + {cap : IsCappedSurface S Shat} + {β : Type w} + {χ : ColourScheme S β} + {D : TangleDatum cap χ} + {side : Set S} + {Θ : Set S} + {r : Shat} + {N : ℕ} + (X : D.IsSideSetting side Θ r N) + (hS : IsSurface S) + (hgt : ↑(N + 2) < 2 * Painting.dist D.rad) + {ω : List β} + {ℱ : Set (Drawing Shat)} + (hfe : D.IsDisjointFeast r side ω ℱ) + (hf : ℱ.Finite) + (hsm' : ∀ F ∈ ℱ, (Drawing.E F).ncard ≤ 2 * N) + (v₁ : Drawing Shat → S) + (v₂ : Drawing Shat → S) + (Β : Drawing Shat → Set Shat) + (L : Drawing Shat → Set Shat) + (A : Drawing Shat → Set Shat) + (A' : Drawing Shat → Set Shat) + (Di : Drawing Shat → Set Shat) + (Do : Drawing Shat → Set Shat) + (hshape : ∀ F ∈ ℱ, D.IsBiteShape r Θ F (v₁ F) (v₂ F) (Β F) (L F) (A F) (A' F) (Di F) (Do F)) + (hΘ : Θ ∈ cuffs S) + (hreg : D.rad.regionOf r = cap.cuffDisc Θ) + (hi : ∀ {F : Drawing Shat}, F ∈ ℱ → IsClosedDisc (D.ins F) ∧ discBd (D.ins F) = F.U) + (hrd : r ∈ cap.cuffDisc Θ) + (hE : IsClosedDisc (closure (cap.cuffDisc Θ))) + (hEb : discBd (closure (cap.cuffDisc Θ)) = cap.emb '' Θ) + (hdE : cap.cuffDisc Θ = discInt (closure (cap.cuffDisc Θ))) + (hemb : ∀ (x : S), cap.emb x ∉ discInt (closure (cap.cuffDisc Θ))) + (Z : Set Shat) + (hZ : IsClosedDisc Z) + (hEZ : closure (cap.cuffDisc Θ) ⊆ Z) + (hZc : Z ⊆ closure (cap.cuffDisc Θ) ∪ ⋃ i ∈ hf.toFinset, D.ins i) + (hJ3 : ∀ x ∉ discInt (closure (cap.cuffDisc Θ)), x ∈ discInt Z ↔ ∃ i ∈ hf.toFinset, x ∈ + discInt (D.ins i)) + (hJ1 : discBd Z ⊆ discBd (closure (cap.cuffDisc Θ)) ∪ ⋃ i ∈ hf.toFinset, discBd (D.ins i) \ + discInt (closure (cap.cuffDisc Θ))) + (hJ2 : discBd (closure (cap.cuffDisc Θ)) \ ⋃ i ∈ hf.toFinset, D.ins i ⊆ discBd Z) + (hJ4 : ∀ i ∈ hf.toFinset, discBd (D.ins i) \ (Β i \ {cap.emb (v₁ i), cap.emb (v₂ i)}) ⊆ discBd + Z) + (hv₁L : ∀ {F : Drawing Shat}, F ∈ ℱ → cap.emb (v₁ F) ∈ L F) + (K : Drawing S) (hKU : K.U = ⋃₀ ((fun F => cap.emb ⁻¹' L F) '' ℱ)) + (hIn : cap.emb ⁻¹' ⋃ F ∈ ℱ, D.ins F ⊆ cap.emb ⁻¹' discInt Z ∪ K.U) + (hKsub : ∀ {x : S}, x ∈ cap.emb ⁻¹' discInt Z ∪ K.U → ∃ F ∈ ℱ, cap.emb x ∈ D.ins F) + (hmeets : ∀ F ∈ ℱ, (cap.emb ⁻¹' D.biteArc r F ∩ closure side).Nonempty) + (hne : ℱ.Nonempty) : + IsSideShape cap χ.Φ side K Z := by + refine ⟨hZ, ?_, ?_, ⟨Θ, hΘ, hEZ, fun Θ' hΘ' hne' ↦ ?_⟩, ?_, ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + rw [hKU] at hx + obtain ⟨_, ⟨F, hF, rfl⟩, hxL⟩ := hx + refine hJ4 F (hf.mem_toFinset.2 hF) ⟨(hi hF).2 ▸ (hshape F hF).F_eq ▸ Or.inr hxL, + fun hc' ↦ hc'.2 ?_⟩ + rw [← (hshape F hF).Β_L] + exact ⟨hc'.1, hxL⟩ + · intro x hx + rcases hJ1 hx with h | h + · exact Or.inl (mem_biUnion hΘ (Surface.discBd_subset _ h)) + · obtain ⟨F, hF, hxF, -⟩ := mem_iUnion₂.1 h + have hF' := hf.mem_toFinset.1 hF + rw [(hi hF').2, (hshape F hF').F_eq] at hxF + rcases hxF with h' | h' + · exact Or.inl (mem_biUnion hΘ ((hshape F hF').Β_E h')) + · refine Or.inr ?_ + obtain ⟨y, hy⟩ := (hshape F hF').L_range h' + refine ⟨y, ?_, hy⟩ + rw [hKU] + refine ⟨_, ⟨F, hF', rfl⟩, ?_⟩ + change cap.emb y ∈ L F + rwa [hy] + · refine disjoint_left.2 fun x hx hxZ ↦ ?_ + rcases hZc hxZ with h | h + · exact disjoint_left.1 (cap.cuffDisc_disjoint _ hΘ' _ hΘ hne') hx h + · obtain ⟨F, hF, hxF⟩ := mem_iUnion₂.1 h + have hF' := hf.mem_toFinset.1 hF + exact disjoint_left.1 (X.disjoint_cuff_ins hS hgt (hsm' F hF') (hshape F hF') hΘ' hne') hx hxF + · obtain ⟨F, hF⟩ := hne + rw [hKU] + exact ⟨v₁ F, _, ⟨F, hF, rfl⟩, hv₁L hF⟩ + · intro s hs hne' + obtain ⟨Θ', hΘ', hsΘ', -⟩ := Frame.side_on_cuff hS χ.Φ hs.1 + have hspc : IsPathConnected s := hs.1.2.2.1 + by_cases hsame : Θ' = Θ + · subst hsame + have hset : s \ (cap.emb ⁻¹' discInt Z ∪ K.U) = s \ ⋃ F ∈ hf.toFinset, cap.emb ⁻¹' D.biteArc + r F := by + ext x + constructor + · rintro ⟨h₁, h₂⟩ + refine ⟨h₁, fun h₃ ↦ h₂ (hIn ?_)⟩ + obtain ⟨F, hF, hxF⟩ := mem_iUnion₂.1 h₃ + have hF' := hf.mem_toFinset.1 hF + exact mem_biUnion hF' ((hshape F hF').biteArc_subset hxF).1 + · rintro ⟨h₁, h₂⟩ + refine ⟨h₁, fun h₃ ↦ h₂ ?_⟩ + obtain ⟨F, hF, hxF⟩ := hKsub h₃ + refine mem_biUnion (hf.mem_toFinset.2 hF) ?_ + change cap.emb x ∈ D.biteArc r F + rw [hfe.arc_eq F hF, closure_region_sdiff hΘ' hreg] + exact ⟨hxF, mem_image_of_mem _ (hsΘ' h₁)⟩ + rw [hset] + have hdis : Disjoint (closure side) s := by + refine disjoint_left.2 fun x hx hxs ↦ ?_ + have hnot : x ∉ side := fun hxd ↦ hne' (GM11.arcComponent_eq hs.1 X.long.1 hxs hxd) + exact (hs.1.2.1 hxs).2 (χ.Φ.tilde_subset (cuff_statement S hS).1 X.long.1 ⟨hx, hnot⟩) + refine X.keep_of_meets hS hsΘ' hspc hdis (fun F hF ↦ ?_) fun F hF ↦ hmeets F + (hf.mem_toFinset.1 hF) + have hF' := hf.mem_toFinset.1 hF + refine ⟨A' F, (hshape F hF').isPreconnected_A', fun x hx ↦ + ⟨(hshape F hF').cuff_mem_A' hx, fun y hy ↦ ?_⟩⟩ + obtain ⟨z, hz, he⟩ := ((hshape F hF').A'_sub hy).1 + exact cap.isEmbedding.injective he ▸ hz + · right + have hset : s \ (cap.emb ⁻¹' discInt Z ∪ K.U) = s := by + refine sdiff_eq_left.2 (disjoint_right.2 fun x hx hxs ↦ ?_) + obtain ⟨F, hF, hxF⟩ := hKsub hx + exact disjoint_left.1 (X.disjoint_cuff_ins hS hgt (hsm' F hF) (hshape F hF) hΘ' hsame) + (cap.mem_closure_emb hΘ' (hsΘ' hxs)) hxF + rw [hset] + exact hspc + +omit X in +private theorem disjoint_boundary_lines_of_feast + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} + {β : Type w} + {χ : ColourScheme S β} + {D : TangleDatum cap χ} + {r : Shat} + {ℱ : Set (Drawing Shat)} + (L : Drawing Shat → Set Shat) + (hsub : ∀ {F : Drawing Shat}, F ∈ ℱ → F.U ⊆ D.ins F) + (hrnr : r ∉ range cap.emb) + (hinter : ∀ {F F' : Drawing Shat}, F ∈ ℱ → F' ∈ ℱ → F ≠ F' → D.ins F ∩ D.ins F' = {r}) + (hLU : ∀ {F : Drawing Shat}, F ∈ ℱ → cap.emb ⁻¹' L F = cap.emb ⁻¹' F.U) + {F : Drawing Shat} + {F' : Drawing Shat} + (hF : F ∈ ℱ) + (hF' : F' ∈ ℱ) + (hne : F ≠ F') : + Disjoint (cap.emb ⁻¹' L F) (cap.emb ⁻¹' L F') := by + refine disjoint_left.2 fun x hx hx' ↦ ?_ + rw [hLU hF] at hx + rw [hLU hF'] at hx' + have : cap.emb x ∈ D.ins F ∩ D.ins F' := ⟨hsub hF hx, hsub hF' hx'⟩ + rw [hinter hF hF' hne] at this + exact hrnr (this ▸ mem_range_self x) + +omit X in +private theorem feast_disc_family + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [T2Space S] + [TopologicalSpace Shat] + [T2Space Shat] + {cap : IsCappedSurface S Shat} + {β : Type w} + {χ : ColourScheme S β} + {D : TangleDatum cap χ} + {side : Set S} + {Θ : Set S} + {r : Shat} + {N : ℕ} + (X : D.IsSideSetting side Θ r N) + (hS : IsSurface S) + {n : ℕ} + {ω : List β} + {ℱ : Set (Drawing Shat)} + (hN : N = (ω.length + 1) * n) + (hpos : 1 ≤ N) + (hfl : D.IsSideLabelFlaw r side n ω ℱ) + (hsm : ∀ F ∈ ℱ, (Drawing.E F).ncard ≤ 2 * (N - 1)) + (hlink : ∀ F ∈ ℱ, GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins F)) + (partIn cap D.P.Γ (closure (D.ins F)ᶜ))) + (hmin : ∀ F ∈ ℱ, ¬D.IsFeast r side ω (ℱ \ {F})) + (hT : IsClosedSurface Shat) + (hfe : D.IsDisjointFeast r side ω ℱ) + (hf : ℱ.Finite) + (v₁ : Drawing Shat → S) + (v₂ : Drawing Shat → S) + (Β : Drawing Shat → Set Shat) + (L : Drawing Shat → Set Shat) + (A : Drawing Shat → Set Shat) + (A' : Drawing Shat → Set Shat) + (Di : Drawing Shat → Set Shat) + (Do : Drawing Shat → Set Shat) + (hshape : ∀ F ∈ ℱ, D.IsBiteShape r Θ F (v₁ F) (v₂ F) (Β F) (L F) (A F) (A' F) (Di F) (Do F)) + (hreg : D.rad.regionOf r = cap.cuffDisc Θ) + (hG : ∀ {F : Drawing Shat}, F ∈ ℱ → F.IsCircuitOf D.rad.G) + (hi : ∀ {F : Drawing Shat}, F ∈ ℱ → IsClosedDisc (D.ins F) ∧ discBd (D.ins F) = F.U) + (hrnr : r ∉ range cap.emb) + (hrd : r ∈ cap.cuffDisc Θ) + (hinter : ∀ {F F' : Drawing Shat}, F ∈ ℱ → F' ∈ ℱ → F ≠ F' → D.ins F ∩ D.ins F' = {r}) + (hmeets : ∀ F ∈ ℱ, (cap.emb ⁻¹' D.biteArc r F ∩ closure side).Nonempty) : + IsLinkedFamily D N (discPairs cap (D.ins '' ℱ)) := by + refine family_of_discs (hf.image _) ?_ ?_ ?_ + · rintro _ ⟨F, hF, rfl⟩ + exact hlink F hF + · rintro _ ⟨F, hF, rfl⟩ + have := disc_order hS X.h3 D.rad (hG hF) (hi hF).1 (hi hF).2 + have := hsm F hF + omega + · rintro _ ⟨F, hF, rfl⟩ _ ⟨F', hF', rfl⟩ hne' + rw [closure_compl_eq_compl_discInt hT (hi hF').1] + intro x hx hxi + have hFF : F ≠ F' := fun he ↦ hne' (by rw [he]) + have hm : x ∈ D.ins F ∩ D.ins F' := ⟨hx, discInt_subset _ hxi⟩ + rw [hinter hF hF' hFF] at hm + have hxr : x = r := hm + subst hxr + exact hxi.2 ((hi hF').2 ▸ F'.V_subset_U (hshape F' hF').r_mem) + +/-- **The data of a flaw.** -/ +theorem exists_side_data [ConnectedSpace S] (hS : IsSurface S) + (hgt : ((N + 2 : ℕ) : ℕ∞) < 2 * Painting.dist D.rad) {n : ℕ} {ω : List β} + {ℱ : Set (Drawing Shat)} (hN : N = (ω.length + 1) * n) (hpos : 1 ≤ N) + (hfl : D.IsSideLabelFlaw r side n ω ℱ) + (hsm : ∀ F ∈ ℱ, F.E.ncard ≤ 2 * (N - 1)) + (hlink : ∀ F ∈ ℱ, GM18.IsLambdaLinkedTo D.tb.lambdaOrder D.𝒯 (partIn cap D.P.Γ (D.ins F)) + (partIn cap D.P.Γ (closure (D.ins F)ᶜ))) + (hmin : ∀ F ∈ ℱ, ¬ D.IsFeast r side ω (ℱ \ {F})) (hω : ω ≠ []) : ∃ 𝓓 Z K, IsSideData D side N ω + 𝓓 Z K := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hj := cap.isClosedEmbedding hS + have hfe := hfl.toIsDisjointFeast + have hf := hfe.finite_bites + have hsm' : ∀ F ∈ ℱ, F.E.ncard ≤ 2 * N := fun F hF ↦ (hsm F hF).trans (by omega) + have hsh : ∀ F ∈ ℱ, ∃ v₁ v₂ Β L A A' Di Do, D.IsBiteShape r Θ F v₁ v₂ Β L A A' Di Do + := fun F hF ↦ X.shape hS (hfe.all_bites F hF) (hsm' F hF) + choose! v₁ v₂ Β L A A' Di Do hshape using hsh + have hΘ := X.cuff + have hreg := X.reg + have hG : ∀ {F}, F ∈ ℱ → F.IsCircuitOf D.rad.G := fun {F} hF ↦ (hshape F hF).circuit + have hlt : ∀ {F}, F ∈ ℱ → F.E.ncard < 2 * D.rep := fun {F} hF ↦ (hshape F hF).lt + have hi : ∀ {F}, F ∈ ℱ → IsClosedDisc (D.ins F) ∧ discBd (D.ins F) = F.U := fun {F} hF ↦ by + have := D.ins_spec (hG hF) (hlt hF) + exact ⟨this.2.2.1, this.2.2.2.1⟩ + have hsub : ∀ {F}, F ∈ ℱ → F.U ⊆ D.ins F := fun {F} hF ↦ D.U_subset_ins (hG hF) (hlt hF) + have hrnr := D.pole_notMem_range X.pole + have hrd : r ∈ cap.cuffDisc Θ := by + rw [← hreg] + exact (D.rad.regionOf_mem X.pole.1).2 + have hE := cap.cuffDisc_closedDisc Θ hΘ + have hEb : discBd (closure (cap.cuffDisc Θ)) = cap.emb '' Θ := cap.cuffDisc_bd Θ hΘ + have hdE : cap.cuffDisc Θ = discInt (closure (cap.cuffDisc Θ)) := cap.cuffDisc_eq_discInt hΘ + have hemb : ∀ x, cap.emb x ∉ discInt (closure (cap.cuffDisc Θ)) := fun x h ↦ cap.notMem_range hΘ + (hdE ▸ h) (mem_range_self x) + have hinter : ∀ {F F'}, F ∈ ℱ → F' ∈ ℱ → F ≠ F' → D.ins F ∩ D.ins F' = {r} + := fun hF hF' hne ↦ hfe.ins_inter _ hF _ hF' hne + obtain ⟨Z, hZ, hEZ, hΔZ, hZc, -, hJ3, hJ1, hJ2, hJ4⟩ := exists_disc_union hT hE hf.toFinset D.ins + Β (fun F ↦ cap.emb (v₁ F)) (fun F ↦ cap.emb (v₂ F)) + (fun F hF ↦ (hshape F (hf.mem_toFinset.1 hF)).isChordDisc (hfe.arc_eq F + (hf.mem_toFinset.1 hF))) + (fun F hF F' hF' hne ↦ by + rw [hinter (hf.mem_toFinset.1 hF) (hf.mem_toFinset.1 hF') hne, singleton_subset_iff, ← hdE] + exact hrd) + have hiff : ∀ x, cap.emb x ∈ discInt Z ↔ ∃ F ∈ ℱ, cap.emb x ∈ discInt (D.ins F) := fun x ↦ by + simpa using hJ3 _ (hemb x) + -- the lines in `Σ` + have hLr : ∀ {F}, F ∈ ℱ → cap.emb '' (cap.emb ⁻¹' L F) = L F := fun {F} hF ↦ + image_preimage_eq_of_subset (hshape F hF).L_range + have hv₁L : ∀ {F}, F ∈ ℱ → cap.emb (v₁ F) ∈ L F := fun {F} hF ↦ ((hshape F hF).Β_L ▸ mem_insert _ + _ : cap.emb (v₁ F) ∈ Β F ∩ L F).2 + have hv₂L : ∀ {F}, F ∈ ℱ → cap.emb (v₂ F) ∈ L F := fun {F} hF ↦ ((hshape F hF).Β_L ▸ + mem_insert_of_mem _ rfl : cap.emb (v₂ F) ∈ Β F ∩ L F).2 + have hline : ∀ {F}, F ∈ ℱ → IsLineWithEnds (cap.emb ⁻¹' L F) (v₁ F) (v₂ F) + := fun {F} hF ↦ isLine_comap hj (by rw [hLr hF]; exact (hshape F hF).L_line) + have hLU : ∀ {F}, F ∈ ℱ → cap.emb ⁻¹' L F = cap.emb ⁻¹' F.U := fun {F} hF ↦ + ((hshape F hF).preimage_U).symm + set 𝓛 : Set (Set S) := (fun F ↦ cap.emb ⁻¹' L F) '' ℱ with h𝓛 + have h𝓛f : 𝓛.Finite := hf.image _ + have hLdis : ∀ {F F'}, F ∈ ℱ → F' ∈ ℱ → F ≠ F' → Disjoint (cap.emb ⁻¹' L F) (cap.emb ⁻¹' L F') + := fun {F F'} hF hF' hne ↦ by + exact disjoint_boundary_lines_of_feast (S := S) (Shat := Shat) (cap := cap) (β := β) (χ := χ) + (D := D) (r := r) (ℱ := ℱ) L hsub hrnr hinter hLU (F := F) (F' := F') hF hF' hne + obtain ⟨hc, hfa, hcard, hmk⟩ := finite_lines_union h𝓛f D.P.Γ.finite_V (by + rintro _ ⟨F, hF, rfl⟩ + exact ⟨v₁ F, v₂ F, hline hF, (hshape F hF).v₁_mem, (hshape F hF).v₂_mem⟩) (by + rintro _ ⟨F, hF, rfl⟩ _ ⟨F', hF', rfl⟩ hne + exact hLdis hF hF' fun he ↦ hne (by rw [he])) + set U₀ : Set S := ⋃₀ 𝓛 with hU₀ + have hU : ∀ {x}, x ∈ U₀ ↔ ∃ F ∈ ℱ, cap.emb x ∈ F.U := fun {x} ↦ by + constructor + · rintro ⟨_, ⟨F, hF, rfl⟩, hx⟩ + refine ⟨F, hF, ?_⟩ + have hx' : x ∈ cap.emb ⁻¹' L F := hx + rw [hLU hF] at hx' + exact hx' + · rintro ⟨F, hF, hx⟩ + refine ⟨_, ⟨F, hF, rfl⟩, ?_⟩ + change x ∈ cap.emb ⁻¹' L F + rw [hLU hF] + exact hx + set K := coarseDrawing D.P.Γ U₀ hc hfa hmk with hK + have hKimg : ∀ {x}, x ∈ K.U → ∃ F ∈ ℱ, cap.emb x ∈ F.U := fun hx ↦ hU.1 hx + have hIn : cap.emb ⁻¹' ⋃ F ∈ ℱ, D.ins F ⊆ cap.emb ⁻¹' discInt Z ∪ K.U := fun x hx ↦ by + obtain ⟨F, hF, hxF⟩ := mem_iUnion₂.1 hx + by_cases hb' : cap.emb x ∈ discBd (D.ins F) + · refine Or.inr (hU.2 ⟨F, hF, ?_⟩) + rw [← (hi hF).2] + exact hb' + · exact Or.inl ((hiff x).2 ⟨F, hF, hxF, hb'⟩) + have hKsub : ∀ {x}, x ∈ cap.emb ⁻¹' discInt Z ∪ K.U → ∃ F ∈ ℱ, cap.emb x ∈ D.ins F := by + rintro x (h | h) + · obtain ⟨F, hF, hx⟩ := (hiff x).1 h + exact ⟨F, hF, discInt_subset _ hx⟩ + · obtain ⟨F, hF, hx⟩ := hKimg h + exact ⟨F, hF, hsub hF hx⟩ + have hinterK : D.P.Γ.U ∩ U₀ ⊆ D.P.Γ.V ∩ (U₀ ∩ D.P.Γ.V) := by + rintro x ⟨hxΓ, hxK⟩ + obtain ⟨F, hF, hxF⟩ := hU.1 hxK + have hm' : cap.emb x ∈ D.P.Γ.hatU cap ∩ D.rad.G.U := ⟨mem_image_of_mem _ hxΓ, + (hG hF).1.U_subset hxF⟩ + rw [D.rad.isPreRadial.1] at hm' + obtain ⟨v, hv, hvx⟩ := hm' + obtain rfl := cap.isEmbedding.injective hvx + exact ⟨hv, hxK, hv⟩ + have hbdN : ∀ {x}, x ∈ U₀ → x ∈ bd S → x ∈ U₀ ∩ D.P.Γ.V := fun hx hb ↦ + (hinterK ⟨D.P.Γ.bd_subset hb, hx⟩).2 + have hdense : U₀ ⊆ closure (U₀ \ (U₀ ∩ D.P.Γ.V)) := by + rintro x ⟨_, ⟨F, hF, rfl⟩, hx⟩ + have hNf : (U₀ ∩ D.P.Γ.V).Finite := D.P.Γ.finite_V.subset inter_subset_right + refine closure_mono ?_ (line_subset_closure_sdiff (hline hF) hNf hx) + exact sdiff_subset_sdiff_left (subset_sUnion_of_mem ⟨F, hF, rfl⟩) + have hcov : U₀ \ (U₀ ∩ D.P.Γ.V) ⊆ ⋃ e ∈ arcComponentsIn (U₀ \ (U₀ ∩ D.P.Γ.V)), e := fun x hx ↦ by + obtain ⟨c, hc', hxc⟩ := exists_arcComp_superset (isPathConnected_singleton x) + (singleton_subset_iff.2 hx) + exact mem_biUnion hc' (hxc rfl) + have hVle : (U₀ ∩ D.P.Γ.V).ncard ≤ N := by + exact side_vertices_card_le_order (S := S) (Shat := Shat) (cap := cap) (β := β) (χ := χ) (D := + D) (side := side) (r := r) (N := N) (n := n) (ω := ω) (ℱ := ℱ) hN hfl hf hG U₀ hU + have hmeets := fun F hF ↦ X.biteArc_meets_side hS hfe (fun G hG' ↦ hsm' G hG') hmin (F := F) hF + have hne : ℱ.Nonempty := by + obtain ⟨s, hs, hto⟩ := exists_short_touching hS χ D.P.fits X.long + obtain ⟨x, hx⟩ : s.Nonempty := hs.1.1 + obtain ⟨F, hF, -⟩ := mem_iUnion₂.1 (hfe.includes_short_sides s hs hto (mem_image_of_mem _ hx)) + exact ⟨F, hF⟩ + have hshapeZ : IsSideShape cap χ.Φ side K Z := by + exact side_shape_of_feast_discs (S := S) (Shat := Shat) (cap := cap) (β := β) (χ := χ) (D := + D) (side := side) (Θ := Θ) (r := r) (N := N) X hS hgt (ω := ω) (ℱ := ℱ) hfe hf hsm' v₁ v₂ Β + L A A' Di Do hshape hΘ hreg hi hrd hE hEb hdE hemb Z hZ hEZ hZc hJ3 hJ1 hJ2 hJ4 hv₁L K rfl hIn + hKsub hmeets hne + refine ⟨D.ins '' ℱ, Z, K, hshapeZ, hf.image _, ?_, ?_, ?_, ?_, ⟨?_, ?_, ?_⟩, hinterK, + fun e he ↦ hmk e he, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨F, hF, rfl⟩ + exact (hi hF).1 + · ext x + simp only [mem_preimage, hiff, mem_iUnion₂, mem_image, exists_prop, exists_exists_and_eq_and] + · exact feast_disc_family (S := S) (Shat := Shat) (cap := cap) (β := β) (χ := χ) (D := D) (side + := side) (Θ := Θ) (r := r) (N := N) X hS (n := n) (ω := ω) (ℱ := ℱ) hN hpos hfl hsm hlink + hmin hT hfe hf v₁ v₂ Β L A A' Di Do hshape hreg hG hi hrnr hrd hinter hmeets + · exact (ncard_image_le hf).trans hfe.card_le + · exact fun e he ↦ disjoint_left.2 fun x hxe hxb ↦ (he.2.1 hxe).2 (hbdN (he.2.1 hxe).1 hxb) + · intro v hv + have hvc := hdense hv.1 + have : v ∈ closure (⋃ e ∈ arcComponentsIn (U₀ \ (U₀ ∩ D.P.Γ.V)), e) := closure_mono hcov hvc + rw [hfa.closure_biUnion] at this + obtain ⟨e, he, hve⟩ := mem_iUnion₂.1 this + exact ⟨e, he, hve, fun h ↦ (he.2.1 h).2 hv⟩ + · refine fun s₀ hs₀ ↦ disjoint_left.2 fun x hx hxs ↦ ?_ + have hxb : x ∈ bd S := (hs₀.1.2.1 hxs).1 + exact D.P.Γ.disjoint_V (D.P.fits.short_sides hs₀) hxs (hbdN hx hxb).2 + · change (U₀ ∩ D.P.Γ.V).ncard + (arcComponentsIn (U₀ \ (U₀ ∩ D.P.Γ.V))).ncard ≤ 8 * N + omega + · refine ⟨∅, 𝓛, finite_empty, h𝓛f, by simp, ?_, by rw [sUnion_empty, empty_union]; rfl⟩ + rintro _ ⟨F, hF, rfl⟩ + have hs := hshape F hF + exact ⟨v₁ F, v₂ F, hs.ne, hline hF, Or.inl (cuff_subset_bd ⟨Θ, hΘ⟩ hs.v₁_cuff), + Or.inl (cuff_subset_bd ⟨Θ, hΘ⟩ hs.v₂_cuff)⟩ + · rintro _ ⟨F, hF, rfl⟩ v _ h₁ h₂ + have : cap.emb v ∈ frontier (D.ins F) := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure h₁, h₂⟩ + rw [IsClosedDisc.frontier_eq_discBd hT (hi hF).1, (hi hF).2] at this + exact hU.2 ⟨F, hF, this⟩ + · rintro v hv _ ⟨F', hF', rfl⟩ + rw [closure_compl_eq_compl_discInt hT (hi hF').1] + intro hvi + obtain ⟨F, hF, hxF⟩ := hKimg hv + by_cases he : F = F' + · subst he + exact hvi.2 ((hi hF).2 ▸ hxF) + · have hm : cap.emb v ∈ D.ins F ∩ D.ins F' := ⟨hsub hF hxF, discInt_subset _ hvi⟩ + rw [hinter hF hF' he] at hm + exact hrnr ((hm : cap.emb v = r) ▸ mem_range_self v) + · intro w' x hx hne' + obtain ⟨_, ⟨F, hF, rfl⟩, hxL⟩ := hx + have hs := hshape F hF + have hsubL : cap.emb ⁻¹' L F ⊆ U₀ := subset_sUnion_of_mem ⟨F, hF, rfl⟩ + refine line_anchor (hline hF) hsubL (fun w'' h ↦ ?_) (fun w'' h ↦ ?_) hxL hne' + · refine ⟨{v₁ F}, ?_, rfl, isPreconnected_singleton, ⟨v₁ F, rfl, hs.v₁_mem⟩⟩ + rintro _ rfl + exact ⟨hsubL (hv₁L hF), h⟩ + · refine ⟨{v₂ F}, ?_, rfl, isPreconnected_singleton, ⟨v₂ F, rfl, hs.v₂_mem⟩⟩ + rintro _ rfl + exact ⟨hsubL (hv₂L hF), h⟩ + · intro B hB hconn + by_cases hBe : B.Nonempty + · obtain ⟨x, hx⟩ := hBe + have hoff : ∀ {y}, y ∈ B → y ∈ side \ cap.emb ⁻¹' D.feastArcUnion r ℱ := fun {y} hy ↦ by + refine ⟨(hB hy).1, fun h ↦ (hB hy).2 (hIn ?_)⟩ + obtain ⟨F, hF, hyF⟩ := mem_iUnion₂.1 h + exact mem_biUnion hF ((hshape F hF).biteArc_subset hyF).1 + obtain ⟨h, hh, hall⟩ := hfe.component_omits _ (mem_image_of_mem _ (hoff hx)) + exact ⟨h, hh, fun e he hsub' ↦ hall e he (hsub'.trans (hconn.subset_connectedComponentIn hx + fun y hy ↦ hoff hy))⟩ + · rw [not_nonempty_iff_eq_empty] at hBe + refine ⟨0, List.length_pos_iff.2 hω, fun e he hsub' ↦ ?_⟩ + obtain ⟨y, hy⟩ := he.1 + have := hsub' hy + rw [hBe] at this + exact absurd this (notMem_empty _) + +end TangleDatum.IsSideSetting + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section11g.lean b/LeanPool/GraphMinor/GM19/Section11g.lean new file mode 100644 index 0000000000..ac81939f25 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section11g.lean @@ -0,0 +1,249 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section11f +public import LeanPool.GraphMinor.GM19.Section10t +public import LeanPool.GraphMinor.GM19.FragmentOrient +public import LeanPool.GraphMinor.GM19.Conditional2 + +/-! +# Graph Minors XIX, Section 11: the proof of (11.1) + +All the flaws on a side with one feature make a well-behaved set (`exists_class_side`). Each piece +of the side outside `Z` leaves out one `ω_h`, and the paper's sets `Z_{ωᵢ'}` are the labels of these +pieces. The +labels range over a finite set, so this is finitely many uses of `wellBehaved_side`. There are +finitely many features by (5.2), which gives (11.1). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +/-- The sides of a fragment over `side`. -/ +def sidesOver {Y : Type} [TopologicalSpace Y] (χ : ColourScheme S β) (K : Drawing S) (ψ : Y → S) + (side : Set S) (c : Set Y) : Set (Set c) := + {R ∈ arcComponentsIn (bd c \ pullFrameV χ.Φ K (fun x : c ↦ ψ x.1)) | + (fun x : c ↦ ψ x.1) '' R ⊆ side} + +/-- A label on each side of a fragment over `side`, chosen from `ω`, and no label on the other +sides. -/ +def IsSideLabelling {Y : Type} [TopologicalSpace Y] (χ : ColourScheme S β) (K : Drawing S) (ψ : Y + → S) (side : Set S) (ω : List β) (c : Set Y) (lab : Set c → Option β) : Prop := + ∀ R, (R ∈ sidesOver χ K ψ side c → ∃ w ∈ ω, lab R = some w) ∧ (R ∉ sidesOver χ K ψ side c → lab R + = none) + +omit [T2Space S] in +theorem finite_isSideLabelling {Y : Type} [TopologicalSpace Y] {K : Drawing S} {ψ : Y + → S} {side : Set S} (ω : List β) {c : Set Y} (hf : (sidesOver χ K ψ side c).Finite) : + {lab | IsSideLabelling χ K ψ side ω c lab}.Finite := by + classical + have := hf.to_subtype + have hT : (insert none (some '' {w | w ∈ ω}) : Set (Option β)).Finite := + (ω.finite_toSet.image _).insert _ + have := hT.to_subtype + let Φ' : (↥(sidesOver χ K ψ side c) → ↥(insert none (some '' {w | w ∈ ω}) : Set (Option β))) + → Set c → Option β := fun g R ↦ if h : R ∈ sidesOver χ K ψ side c then (g ⟨R, h⟩).1 else none + refine (finite_range Φ').subset fun lab hlab ↦ ?_ + have hmem : ∀ R, R ∈ sidesOver χ K ψ side c → lab R ∈ (insert none (some '' {w | w ∈ ω}) : Set + (Option β)) := fun R hR ↦ by + obtain ⟨w, hw, he⟩ := (hlab R).1 hR + exact he ▸ Or.inr ⟨w, hw, rfl⟩ + refine ⟨fun R ↦ ⟨lab R.1, hmem R.1 R.2⟩, funext fun R ↦ ?_⟩ + by_cases h : R ∈ sidesOver χ K ψ side c + · simp [Φ', h] + · simp [Φ', h, (hlab R).2 h] + +/-- One well-behaved set for the flaws on `side` with a given feature. -/ +theorem exists_class_side (hS : IsSurface S) (hd : χ.IsDisjoint) {𝒮 : Set (ColouredPainting χ)} + (hcl : IsPaintingClass χ 𝒮) (N : ℕ) (a₀ : β) + (hS4 : ConditionS4 χ) {side : Set S} (hside : side ∈ χ.Φ.longSides) {ω : List β} + (hωE : ∀ x ∈ ω, x ∈ (χ.ΩS side).E) (hpos : 0 < N) {Kc : Drawing S} + (hg : ∃ (D : TangleDatum cap χ) (𝓓 : Set (Set Shat)) (Z : Set Shat), IsSideData D side N ω 𝓓 Z + Kc) : + ∃ B : Set (Place χ), IsWellBehavedPlaces B ∧ ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → N ≤ D.ord → + ∀ (𝓓 : Set (Set Shat)) (Z : Set Shat) (K : Drawing S) (α : S ≃ₜ S), IsSideData D side N ω 𝓓 Z + K → IsFramePreservingHomeo χ.Φ α → + α '' Kc.U = K.U → α '' Kc.V = K.V → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb N D.ord D.𝒯 ∧ (⟨hd, D.P, L⟩ : Place χ) ∈ B := by + classical + have : ConnectedSpace S := χ.connected + have hT := cap.isClosedSurface + obtain ⟨D₀, 𝓓₀, Z₀, hp⟩ := hg + have hKne : Kc.V ⊆ ⋃ e ∈ arcComponentsIn (Kc.U \ Kc.V), closure e := fun v hv ↦ by + obtain ⟨e, he, hve⟩ := hp.feature.no_isolated_vertices v hv + exact mem_biUnion he hve.1 + obtain ⟨𝓞, 𝓛, h𝓞, h𝓛, hO, hL, hU⟩ := hp.pieces + obtain ⟨Y, tY, t2Y, ψ, hY, hψ, hsheet, -⟩ := exists_pullData_of_shape hS D₀.P.fits hp.inter + hp.lines hKne h𝓞 h𝓛 hO hL hU + have hFD := fun y ↦ frameData_of_cut hS D₀.P.fits hp.inter hp.lines hY hψ hsheet y + have hfinite : ∀ y, (sidesOver χ Kc ψ side (connectedComponent y)).Finite := fun y ↦ + (finite_arcComponentsIn_bd (hFD y).pull.frag.isSurface (hFD y).finite_pullFrameV + (hFD y).two).subset fun _ h ↦ h.1 + let Q : Set Y → Place χ → Prop := fun c X ↦ ∃ lab, IsSideLabelling χ Kc ψ side ω c lab ∧ X.P ∈ 𝒮 ∧ + ∀ R w, lab R = some w → ∀ e ∈ X.P.Γ.E, e ⊆ (fun x : c ↦ ψ x.1) '' R → ¬ (χ.ΩS side).le w + (X.P.φ e) + obtain ⟨B, hB, hmem⟩ := exists_class_cut_on (χ := χ) (K := Kc) hY (ψ := ψ) (ω.length + 1) + (fun c ↦ OuterGood χ.Φ side Kc ψ c) Q + (fun y l h ↦ by + have := (finite_isSideLabelling (χ := χ) (K := Kc) (ψ := ψ) (side := side) ω + (hfinite y)).to_subtype + let C : {lab | IsSideLabelling χ Kc ψ side ω (connectedComponent y) lab} → Set (Place χ) + := fun lab ↦ {X | IsCutPlace χ Kc (fun x : connectedComponent y ↦ ψ x.1) l (ω.length + 1) X + ∧ X.P ∈ 𝒮 ∧ + ∀ R w, lab.1 R = some w → ∀ e ∈ X.P.Γ.E, e ⊆ (fun x : connectedComponent y ↦ ψ x.1) '' R + → ¬ (χ.ΩS side).le w (X.P.φ e)} + have h₀ : ∀ lab, IsWellBehavedPlaces (C lab) := fun lab ↦ + wellBehaved_side hS hp.feature hcl hp.lines hY hψ hsheet y l (ω.length + 1) a₀ hS4 h.2.1 + h.2.2.1 h.1 hside (lab := lab.1) + (fun R hn ↦ (lab.2 R).2 fun hR ↦ hn hR.2) (fun R hR hsub ↦ by + obtain ⟨w, hw, he⟩ := (lab.2 R).1 ⟨hR, hsub⟩ + exact ⟨w, hωE w hw, he⟩) h.2.2.2 + intro γ Ω hΩ seq hseq ξ hξ + refine IsWellBehavedPlaces.iUnion h₀ Ω hΩ seq (fun i ↦ ?_) ξ hξ + obtain ⟨hX, lab, hlab, hm, hcol⟩ := hseq i + exact mem_iUnion.2 ⟨⟨lab, hlab⟩, hX, hm, hcol⟩) + refine ⟨_, theorem_9_4_proof hB, ?_⟩ + rintro D hmem𝒮 hord 𝓓 Z K α hK hα hαU hαV + obtain ⟨y, hy, hgood⟩ := outer_fragment hS (cap.ofHomeo α) (hK.shape.ofHomeo α hα hαU) hY hψ + let Q' : ColouredPainting χ := D.P.image α.symm hα.symm + have hQ : IsColouredImage α.symm D.P Q' := ColouredPainting.isImage_image _ _ _ + have I : IsColouredImage α Q' D.P := hQ.symm + have hrange : range (fun x : connectedComponent y ↦ ψ x.1) = α ⁻¹' ⋂ p ∈ discPairs cap 𝓓, + Prod.snd p := by + have : range (fun x : connectedComponent y ↦ ψ x.1) = ψ '' connectedComponent y := by + ext z + simp + rw [this, hy, iInter_discPairs] + ext x + have hint : cap.emb (α x) ∈ discInt Z ↔ ∃ Δ ∈ 𝓓, cap.emb (α x) ∈ discInt Δ := by + have := Set.ext_iff.1 hK.int_eq (α x) + simpa using this + have hcl' : ∀ Δ ∈ 𝓓, (cap.emb (α x) ∈ closure Δᶜ ↔ cap.emb (α x) ∉ discInt Δ) := fun Δ hΔ ↦ by + rw [closure_compl_eq_compl_discInt hT (hK.discs Δ hΔ)] + rfl + simp only [mem_compl_iff, mem_iInter, mem_preimage] + change ¬ cap.emb (α x) ∈ discInt Z ↔ _ + rw [hint] + constructor + · exact fun h Δ hΔ ↦ (hcl' Δ hΔ).2 fun hi ↦ h ⟨Δ, hΔ, hi⟩ + · rintro h ⟨Δ, hΔ, hi⟩ + exact (hcl' Δ hΔ).1 (h Δ hΔ) hi + obtain ⟨_, hinter, hanc, hl⟩ := hQ.exists_feature_placement_data hαU hαV hK.inter hK.anchored + have hr : ∀ v, v ∈ Kc.U → v ∈ range (fun x : connectedComponent y ↦ ψ x.1) := fun v hv ↦ by + rw [hrange] + have hvK : α v ∈ K.U := hαU ▸ mem_image_of_mem _ hv + rw [mem_preimage, iInter_discPairs] + exact mem_iInter₂.2 fun Δ' hΔ' ↦ hK.outer _ hvK Δ' hΔ' + have hπ : ∀ p ∈ discPairs cap 𝓓, ∀ v ∈ D.P.Γ.V, v ∈ p.1 → v ∈ p.2 → α.symm v ∈ Kc.U := by + rintro _ ⟨Δ', hΔ', rfl⟩ v hv h₁ h₂ + have := hK.roots Δ' hΔ' v hv h₁ h₂ + rw [← hαU] at this + obtain ⟨z, hz, rfl⟩ := this + rwa [α.symm_apply_apply] + have hm : (discPairs cap 𝓓).ncard ≤ ω.length + 1 := (ncard_image_le hK.finite).trans hK.card + obtain ⟨X, hXP, hX, hXim⟩ := hK.family.exists_place (K := Kc) hd hα I hrange hinter hanc hl hr hπ + hm + have hX𝒮 : X.P ∈ 𝒮 := hXP ▸ hcl.image_mem _ hmem𝒮 _ _ hα.symm hQ + set ψc : connectedComponent y → S := fun x ↦ ψ x.1 with hψc + have hψcc : Continuous ψc := hψ.1.comp continuous_subtype_val + have hαside : ∀ {x}, x ∈ side → α x ∈ side := fun {x} hx ↦ by + have := hα.preserve_sides side hside.1 + exact this ▸ mem_image_of_mem α hx + have hchoose : ∀ R : Set (connectedComponent y), ∃ o : Option β, (R ∈ sidesOver χ Kc ψ side + (connectedComponent y) → ∃ w ∈ ω, o = some w ∧ ∀ e ∈ D.P.Γ.E, e ⊆ α '' (ψc '' R) → ¬ + (χ.ΩS side).le w (D.P.φ e)) ∧ + (R ∉ sidesOver χ Kc ψ side (connectedComponent y) → o = none) := fun R ↦ by + by_cases hR : R ∈ sidesOver χ Kc ψ side (connectedComponent y) + · have hconn : IsPreconnected (α '' (ψc '' R)) := (hR.1.2.2.1.isConnected.isPreconnected.image + _ hψcc.continuousOn).image _ α.continuous.continuousOn + have hsubB : α '' (ψc '' R) ⊆ side \ (cap.emb ⁻¹' discInt Z ∪ K.U) := by + rintro _ ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + have hxside : ψc x ∈ side := hR.2 (mem_image_of_mem _ hx) + refine ⟨hαside hxside, ?_⟩ + rintro (hi | hk) + · have hmr : ψ x.1 ∈ ψ '' connectedComponent y := mem_image_of_mem _ x.2 + rw [hy] at hmr + exact hmr hi + · rw [← hαU] at hk + obtain ⟨z, hz, he⟩ := hk + obtain rfl := α.injective he + have hb : ψc x ∈ bd S := (hside.1.2.1 hxside).1 + exact (hR.1.2.1 hx).2 (Or.inr ((hFD y).K_bd ⟨hz, hb⟩)) + obtain ⟨h, hh, hall⟩ := hK.omits _ hsubB hconn + exact ⟨some ω[h], fun _ ↦ ⟨ω[h], List.getElem_mem hh, rfl, hall⟩, fun hn ↦ absurd hR hn⟩ + · exact ⟨none, fun h ↦ absurd h hR, fun _ ↦ rfl⟩ + choose lab hlab using hchoose + have hQc : Q (connectedComponent y) X := by + refine ⟨lab, fun R ↦ ⟨fun hR ↦ ?_, (hlab R).2⟩, hX𝒮, fun R w hw e he hsub ↦ ?_⟩ + · obtain ⟨w, hw, he, -⟩ := (hlab R).1 hR + exact ⟨w, hw, he⟩ + · have hR : R ∈ sidesOver χ Kc ψ side (connectedComponent y) := by + by_contra hn + rw [(hlab R).2 hn] at hw + exact absurd hw (by simp) + obtain ⟨w', -, hw', hall⟩ := (hlab R).1 hR + obtain rfl : w = w' := by + rw [hw'] at hw + exact (Option.some.inj hw).symm + rw [hXP] at he ⊢ + have heE : e ∈ (D.P.Γ.push α.symm).E := he + rw [push_E] at heE + obtain ⟨c, hc, rfl⟩ := heE + rw [hQ.φ c hc] + refine hall c hc fun z hz ↦ ?_ + exact ⟨α.symm z, hsub (mem_image_of_mem _ hz), α.apply_symm_apply z⟩ + refine ⟨hK.family.location, hK.family.isolates hS hpos hord, X, hmem y _ X hgood ?_ hX hQc, α, + hXim⟩ + exact fun v hv ↦ ((hl v).1 hv).1 + +/-- **Graph Minors XIX, (11.1)** (page 358): +"**11.1.** *Let $\chi$ satisfy $S_4$, let $S$ be a long side of $\Phi_\chi$, let +$\omega_1, \dots, \omega_m \in E(\Omega_\chi(S))$ with $m \ge 1$, and let $n \ge 4$. Then there is +a well-behaved set $\mathscr{C}_4(S, (\omega_1, \dots, \omega_m), n)$ of $\chi$-places with the +following property. Let $(\Gamma, \phi, \lambda, \mathscr{T}) \in \mathscr{D}$ be +$(n, (\omega_1, \dots, \omega_m))$-flawed on $S$. Then there is a rooted location $\mathscr{L}$ +which $(m + 1)n$-isolates $\mathscr{T}$, and for which +$(\Gamma, \phi, \mathscr{L}) \in \mathscr{C}_4(S, (\omega_1, \dots, \omega_m), n)$.*" -/ +theorem theorem_11_1_proof : Theorem111Statement.{w} := by + intro S Shat _ _ _ _ β _ cap χ hd 𝒮 hcl hS4 side hside ω hω hωE n hn + classical + have hS := χ.isSurface + have : ConnectedSpace S := χ.connected + let a₀ : β := Classical.arbitrary β + set N := (ω.length + 1) * n with hN + have hpos : 0 < N := by positivity + let Data : TangleDatum cap χ → Drawing S → Prop := + fun D K => ∃ (𝓓 : Set (Set Shat)) (Z : Set Shat), IsSideData D side N ω 𝓓 Z K + obtain ⟨B, hB, hMem⟩ := exists_wellBehavedPlaces_of_bounded_features hd (𝒮 := 𝒮) + (8 * N) N Data (fun Kc hGood => by + obtain ⟨B, hB, hMem⟩ := + exists_class_side hS hd hcl N a₀ hS4 hside hωE hpos (Kc := Kc) hGood + refine ⟨B, hB, ?_⟩ + rintro D hm hord K ⟨𝓓, Z, hData⟩ ⟨f, hfp, hfU, hfV⟩ + exact hMem D hm hord 𝓓 Z K f hData hfp hfU hfV) + refine ⟨B, hB, fun D hm hfl => ?_⟩ + have h3 := D.P.fits.internally_three_connected + obtain ⟨r, Θ, ℱ, X, hflaw, hsm, hlink, hmin⟩ := TangleDatum.exists_side_flaw hS h3 hside hn hω hfl + obtain ⟨𝓓, Z, K, hK⟩ := X.exists_side_data hS hfl.2.1 rfl hpos hflaw hsm hlink hmin hω + have hord : N ≤ D.ord := by + have h₁ := X.rep_gt + have h₂ : D.rep ≤ D.ord := (tangleRep_spec D.rad D.ord D.𝒯).1 + omega + exact hMem D hm hord K ⟨𝓓, Z, hK⟩ hK.feature hK.size + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section12a.lean b/LeanPool/GraphMinor/GM19/Section12a.lean new file mode 100644 index 0000000000..bb8362af53 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section12a.lean @@ -0,0 +1,398 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Epstein +public import LeanPool.GraphMinor.GM19.Section7e + +/-! +# Graph Minors XIX, Section 12: the metric, (12.2) and (12.3) + +Section 12 uses the triangle inequality for the radial drawing of a painting. In the +short-distance case the two distances sum to less than the representativeness `D.rep`. +The corresponding restraints meet at an anchor in the middle atom and have combined perimeter +below `2 * D.rep`. They fit in one restraint by `exists_restraint_union`, the short-distance +step of XI (9.1). If the sum is at least `D.rep`, the bound on `D.dist a c` gives the inequality. + +The results (12.2) and (12.3) then pick a small set of far apart vertices of `Γ*` near all edges +with a large label. The results used later are `TangleDatum.dist_triangle`, +`TangleDatum.theorem_12_3`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +omit [T2Space S] in +/-- The metric is symmetric. -/ +theorem dist_comm (D : TangleDatum cap χ) (a b : Set Shat) : D.dist a b = D.dist b a := by + classical + by_cases hab : a = b + · rw [hab] + have hne : b ≠ a := fun h ↦ hab h.symm + have hc : (∃ W : ClosedWalkIns D.rad D.ord D.𝒯, (a ∩ W.ins).Nonempty ∧ (b ∩ W.ins).Nonempty) ↔ + ∃ W : ClosedWalkIns D.rad D.ord D.𝒯, (b ∩ W.ins).Nonempty ∧ (a ∩ W.ins).Nonempty := + ⟨fun ⟨W, h₁, h₂⟩ ↦ ⟨W, h₂, h₁⟩, fun ⟨W, h₁, h₂⟩ ↦ ⟨W, h₂, h₁⟩⟩ + have hs : {k : ℕ | ∃ W : ClosedWalkIns D.rad D.ord D.𝒯, + (a ∩ W.ins).Nonempty ∧ (b ∩ W.ins).Nonempty ∧ W.halfLen = k} = + {k : ℕ | ∃ W : ClosedWalkIns D.rad D.ord D.𝒯, + (b ∩ W.ins).Nonempty ∧ (a ∩ W.ins).Nonempty ∧ W.halfLen = k} := by + ext k + exact ⟨fun ⟨W, h₁, h₂, h₃⟩ ↦ ⟨W, h₂, h₁, h₃⟩, fun ⟨W, h₁, h₂, h₃⟩ ↦ ⟨W, h₂, h₁, h₃⟩⟩ + simp only [dist, tangleMetric, ite_eq_right hab, ite_eq_right hne, hc, hs] + +omit [T2Space S] in +/-- The metric is at most `rep(𝒯)`. -/ +theorem dist_le_rep (D : TangleDatum cap χ) (a b : Set Shat) : D.dist a b ≤ D.rep := by + classical + unfold dist tangleMetric + split_ifs with h₁ h₂ + · exact Nat.zero_le _ + · obtain ⟨T, ha, hb⟩ := h₂ + have hne : {k : ℕ | ∃ W : ClosedWalkIns D.rad D.ord D.𝒯, + (a ∩ W.ins).Nonempty ∧ (b ∩ W.ins).Nonempty ∧ W.halfLen = k}.Nonempty := + ⟨_, T, ha, hb, rfl⟩ + obtain ⟨W, -, -, hW⟩ := Nat.sInf_mem hne + rw [← hW] + exact W.halfLen_lt.le + · exact le_rfl + +omit [T2Space Shat] in +omit [T2Space S] in +/-- The atom belonging to a vertex of `Γ*` is an atom of `Γ`. -/ +theorem atomOf_mem (D : TangleDatum cap χ) {x : Shat} (hx : x ∈ D.rad.G.V) : + D.rad.atomOf x ∈ D.P.Γ.atoms cap := by + classical + unfold RadialDrawing.atomOf + split_ifs with h + · obtain ⟨v, hv, rfl⟩ := h + exact Or.inl (Or.inl ⟨v, hv, rfl⟩) + · exact Or.inr (D.rad.regionOf_mem ⟨hx, h⟩).1 + +omit [T2Space S] [T2Space Shat] in +/-- The atom of a vertex of `Γ` is its singleton. -/ +theorem atomOf_emb (D : TangleDatum cap χ) {v : S} (hv : v ∈ D.P.Γ.V) : + D.rad.atomOf (cap.emb v) = {cap.emb v} := by + classical + unfold RadialDrawing.atomOf + rw [ite_eq_left (show cap.emb v ∈ D.P.Γ.hatV cap from mem_image_of_mem cap.emb hv)] + +omit [T2Space Shat] in +omit [T2Space S] in +/-- A vertex of `Γ*` lies in its atom. -/ +theorem mem_atomOf (D : TangleDatum cap χ) {x : Shat} (hx : x ∈ D.rad.G.V) : + x ∈ D.rad.atomOf x := by + classical + unfold RadialDrawing.atomOf + split_ifs with h + · rfl + · exact (D.rad.regionOf_mem ⟨hx, h⟩).2 + +/-- The set `Z` of Section 12: the edges of `Γ` with `φ(e) ≥ ω₀`. These are internal of size `k`, by +the remark in `NoInternalMatch`. -/ +def largeEdges (D : TangleDatum cap χ) (k : ℕ) (ω₀ : α) : Set (Set S) := + {e | e ∈ D.P.Γ.E ∧ Painting.IsInternal e ∧ (tilde e).ncard = k ∧ sizeLE χ k ω₀ (D.P.φ e)} + +section Restraints + + + +/-- The triangle inequality for the radial distance of a painting. Below the representativeness +cutoff, `exists_anchor` supplies a common point of the two walk insides, and their combined +perimeter is less than `2 * D.rep`. A single restraint covers both with perimeter at most their +sum, and its perimeter walk provides the distance bound. -/ +theorem dist_triangle (D : TangleDatum cap χ) (hrep : 4 ≤ D.rep) {a b c : Set Shat} + (hb : b ∈ D.P.Γ.atoms cap) : D.dist a c ≤ D.dist a b + D.dist b c := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + by_cases hac : a = c + · rw [hac, dist_self] + exact Nat.zero_le _ + by_cases hab : a = b + · rw [hab, dist_self] + omega + by_cases hbc : b = c + · rw [hbc, dist_self] + omega + by_cases hlt : D.dist a b + D.dist b c < D.rep + swap + · have := D.dist_le_rep a c + omega + obtain ⟨T₁, ha₁, hb₁, hl₁⟩ := D.exists_of_dist_lt hab (by omega) + obtain ⟨T₂, hb₂, hc₂, hl₂⟩ := D.exists_of_dist_lt hbc (by omega) + obtain ⟨p, -, hp, -⟩ := exists_anchor D hrep hb + have R₁ := isRestraint_ins D (by omega) T₁ + have R₂ := isRestraint_ins D (by omega) T₂ + obtain ⟨X, hX, h₁, h₂, h₃⟩ := exists_restraint_union hT + (D.isSlope (by omega)) R₁.1 R₂.1 ⟨p, hp T₁ hb₁, hp T₂ hb₂⟩ (by omega) + obtain ⟨T, hTX, hTl⟩ := exists_walk_of_restraint D (by omega) hX + have hle := D.dist_le T (ha₁.mono (inter_subset_inter_right _ (hTX.symm ▸ h₁))) + (hc₂.mono (inter_subset_inter_right _ (hTX.symm ▸ h₂))) + omega + +omit [T2Space S] in +/-- An inside that meets an edge `e` of `Γ` contains the ends of `e`, since it is a union of atoms +of +`Γ*` and `e` lies in a region of `Γ*`. -/ +theorem end_mem_ins (D : TangleDatum cap χ) (hrep : 1 ≤ D.rep) {e : Set S} (he : e ∈ D.P.Γ.E) + (T : ClosedWalkIns D.rad D.ord D.𝒯) (hm : (cap.emb '' e ∩ T.ins).Nonempty) {x : S} + (hx : x ∈ closure e) : cap.emb x ∈ T.ins := by + have R := (isRestraint_ins D hrep T).1 + obtain ⟨s, hs, hes⟩ := D.exists_region_of_edge he + obtain ⟨y, hye, hy⟩ := hm + have hsub : s ⊆ T.ins := nice_region R.isGammaNice hs ⟨y, hes hye, hy⟩ + have hcont : Continuous cap.emb := (cap.isClosedEmbedding χ.isSurface).continuous + exact closure_minimal hsub R.isClosed + (closure_mono hes (image_closure_subset_closure_image hcont (mem_image_of_mem _ hx))) + +omit [T2Space S] in +/-- If `e, f` are distinct edges of `Γ` at distance `< rep(𝒯)` then `e` is as close to each end of +`f`. The proof of (12.2) in the paper uses this without saying so. -/ +theorem edgeVertDist_le (D : TangleDatum cap χ) (hrep : 1 ≤ D.rep) {e f : Set S} (hne : e ≠ f) + (hf : f ∈ D.P.Γ.E) (hlt : D.edgeDist e f < D.rep) {x : S} (hx : x ∈ tilde f) + (hxV : x ∈ D.P.Γ.V) : D.edgeVertDist e (cap.emb x) ≤ D.edgeDist e f := by + have hinj := (cap.isClosedEmbedding χ.isSurface).injective + have hne' : cap.emb '' e ≠ cap.emb '' f := fun h ↦ hne (image_injective.mpr hinj h) + obtain ⟨T, h₁, h₂, h₃⟩ := D.exists_of_dist_lt hne' hlt + have hmem := end_mem_ins D hrep hf T h₂ hx.1 + change D.dist (cap.emb '' e) (D.rad.atomOf (cap.emb x)) ≤ D.dist (cap.emb '' e) (cap.emb '' f) + rw [D.atomOf_emb hxV, ← h₃] + exact D.dist_le T h₁ ⟨_, rfl, hmem⟩ + +/-- An edge of `Γ` has distance at most `3` from each of its ends, by the circuit around it. -/ +theorem edgeVertDist_self_le (D : TangleDatum cap χ) (hrep : 4 ≤ D.rep) {e : Set S} + (he : e ∈ D.P.Γ.E) {x : S} (hx : x ∈ tilde e) (hxV : x ∈ D.P.Γ.V) : + D.edgeVertDist e (cap.emb x) ≤ 3 := by + obtain ⟨s, hs, hes⟩ := D.exists_region_of_edge he + obtain ⟨X, hX, hl, hsX⟩ := exists_tie D hrep hs + obtain ⟨T, hTX, hTl⟩ := exists_walk_of_restraint D (by omega) hX + have hcont : Continuous cap.emb := (cap.isClosedEmbedding χ.isSurface).continuous + have hxs : cap.emb x ∈ closure s := + closure_mono hes (image_closure_subset_closure_image hcont (mem_image_of_mem _ hx.1)) + obtain ⟨y, hy⟩ := he.1 + have hle := D.dist_le T (a := cap.emb '' e) (b := {cap.emb x}) + ⟨_, mem_image_of_mem _ hy, hTX ▸ hsX (subset_closure (hes (mem_image_of_mem _ hy)))⟩ + ⟨_, rfl, hTX ▸ hsX hxs⟩ + change D.dist (cap.emb '' e) (D.rad.atomOf (cap.emb x)) ≤ 3 + rw [D.atomOf_emb hxV] + omega + +omit [T2Space S] [T2Space Shat] in +/-- The number of poles is `c(Σ)`, since each cuff bounds one region of `Γ` off `Σ`. -/ +theorem ncard_poles (D : TangleDatum cap χ) : D.rad.poles.ncard = numCuffs S := by + have hS := χ.isSurface + have hcf : (cuffs S).Finite := (cuff_statement S hS).2.1 + have hpf : D.rad.poles.Finite := D.rad.G.finite_V.subset fun _ h ↦ h.1.1 + have hdisj : ∀ Θ₁ ∈ cuffs S, ∀ Θ₂ ∈ cuffs S, ∀ p, p ∈ cap.cuffDisc Θ₁ → p ∈ cap.cuffDisc Θ₂ → + Θ₁ = Θ₂ := by + intro Θ₁ h₁ Θ₂ h₂ p hp₁ hp₂ + by_contra hne + exact disjoint_left.mp (cap.cuffDisc_disjoint Θ₁ h₁ Θ₂ h₂ hne) (subset_closure hp₁) + (subset_closure hp₂) + refine le_antisymm ?_ ?_ + · choose! f hf hreg hmem using fun p (hp : p ∈ D.rad.poles) ↦ D.rad.pole_cases hp + refine ncard_le_ncard_of_injOn f hf ?_ hcf + intro p hp q hq hpq + have hq' : q ∈ cap.cuffDisc (f p) := hpq ▸ hmem q hq + have hreg' : D.rad.regionOf p = D.rad.regionOf q := by rw [hreg p hp, hpq, hreg q hq] + have hr := (D.rad.regionOf_mem hp.1).1 + obtain ⟨-, -, hG3, -⟩ := id D.rad.isPreRadial + refine (hG3 _ hr).unique ⟨(D.rad.regionOf_mem hp.1).2, hp.1.1⟩ ?_ + exact ⟨hreg' ▸ (D.rad.regionOf_mem hq.1).2, hq.1.1⟩ + · have : ConnectedSpace Shat := cap.connected + choose! g hg hmem hreg using fun Θ (hΘ : Θ ∈ cuffs S) ↦ D.rad.exists_pole hΘ + refine ncard_le_ncard_of_injOn g hg ?_ hpf + intro Θ₁ h₁ Θ₂ h₂ h + exact hdisj Θ₁ h₁ Θ₂ h₂ (g Θ₁) (hmem Θ₁ h₁) (h ▸ hmem Θ₂ h₂) + +omit [T2Space S] in +/-- If `D` is not `a`-flawed in distance, and `rep(𝒯)` and `dist(Γ)` are large enough for that to +mean +something, then distinct poles are more than `a` apart. -/ +theorem lt_vDist_of_not_flawed (D : TangleDatum cap χ) {a : ℕ} (hrep : a < D.rep) + (hdist : ((a + 2 : ℕ) : ℕ∞) < 2 * Painting.dist D.rad) (hf : ¬ D.IsFlawedInDistance a) + {r₁ r₂ : Shat} (h₁ : r₁ ∈ D.rad.poles) (h₂ : r₂ ∈ D.rad.poles) (hne : r₁ ≠ r₂) : + a < D.vDist r₁ r₂ := by + by_contra hle + exact hf ⟨hrep, hdist, r₁, h₁, r₂, h₂, hne, not_lt.mp hle⟩ + +/-- **Graph Minors XIX, (12.2)** (page 363): "There exists $X_1 \subseteq V(\Gamma^*)$ with $|X_1| +\le m + c(\Sigma_\chi)$ and $P^* +\subseteq X_1$, such that for every $e \in Z$ there exists $x \in X_1$ with $d(e, x) \le n$." -/ +theorem theorem_12_2_proof (D : TangleDatum cap χ) {m n k : ℕ} {ω₀ : α} (hn : 4 ≤ n) + (hrep : n < D.rep) (hno : D.NoInternalMatch m n k ω₀) : + ∃ X₁ ⊆ D.rad.G.V, X₁.ncard ≤ m + numCuffs S ∧ D.rad.poles ⊆ X₁ ∧ + ∀ e ∈ D.largeEdges k ω₀, ∃ x ∈ X₁, D.edgeVertDist e x ≤ n := by + classical + rcases isEmpty_or_nonempty S with hSe | hSn + · refine ⟨D.rad.poles, fun _ h ↦ h.1.1, by rw [D.ncard_poles]; omega, subset_rfl, fun e he ↦ ?_⟩ + obtain ⟨y, -⟩ := he.1.1 + exact (hSe.false y).elim + have hZfin : (D.largeEdges k ω₀).Finite := D.P.Γ.finite_edges.subset fun _ h ↦ h.1 + let 𝒜 : Set (Set (Set S)) := {A | A ⊆ D.largeEdges k ω₀ ∧ + (∀ a ∈ A, ∀ b ∈ A, a ≠ b → n < D.edgeDist a b) ∧ + ∀ a ∈ A, ∀ r ∈ D.rad.poles, n < D.edgeVertDist a r} + have h𝒜fin : 𝒜.Finite := hZfin.finite_subsets.subset fun _ h ↦ h.1 + have h𝒜0 : (∅ : Set (Set S)) ∈ 𝒜 := by simp [𝒜] + obtain ⟨A, -, hmax⟩ := h𝒜fin.exists_le_maximal h𝒜0 + have hAmem : A ∈ 𝒜 := hmax.1 + have hAfin : A.Finite := hZfin.subset hAmem.1 + have hAm : A.ncard < m := by + by_contra hge + push Not at hge + have : Finite A := hAfin.to_subtype + have := Fintype.ofFinite A + have hcard : Fintype.card (Fin m) ≤ Fintype.card A := by + rw [Fintype.card_fin, ← Nat.card_eq_fintype_card, Nat.card_coe_set_eq] + exact hge + obtain ⟨f⟩ := Function.Embedding.nonempty_of_card_le hcard + refine hno ⟨fun i ↦ (f i).1, fun i ↦ ?_, fun i j hij ↦ ?_, fun i ↦ hAmem.2.2 _ (f i).2⟩ + · obtain ⟨h₁, h₂, h₃, h₄⟩ := hAmem.1 (f i).2 + exact ⟨h₁, h₂, h₃, h₄⟩ + · refine hAmem.2.1 _ (f i).2 _ (f j).2 fun h ↦ ?_ + exact hij.ne (f.injective (Subtype.ext h)) + have hend : ∀ a ∈ D.P.Γ.E, ∃ x, x ∈ tilde a ∧ x ∈ D.P.Γ.V := by + intro a ha + have hne : (tilde a).Nonempty := by + refine nonempty_of_ncard_ne_zero ?_ + rcases D.P.Γ.edge_shape a ha with h | h <;> omega + obtain ⟨x, hx⟩ := hne + exact ⟨x, hx, D.P.Γ.tilde_subset_V ha hx⟩ + have hAE : ∀ a ∈ A, a ∈ D.P.Γ.E := fun a ha ↦ (hAmem.1 ha).1 + choose! τ hτ hτV using fun a (ha : a ∈ A) ↦ hend a (hAE a ha) + have hτG : ∀ a ∈ A, cap.emb (τ a) ∈ D.rad.G.V := fun a ha ↦ + D.rad.isPreRadial.2.1 (mem_image_of_mem cap.emb (hτV a ha)) + refine ⟨D.rad.poles ∪ (fun a ↦ cap.emb (τ a)) '' A, ?_, ?_, subset_union_left, ?_⟩ + · refine union_subset (fun _ h ↦ h.1.1) ?_ + rintro _ ⟨a, ha, rfl⟩ + exact hτG a ha + · have h₁ := ncard_union_le D.rad.poles ((fun a ↦ cap.emb (τ a)) '' A) + have h₂ : ((fun a ↦ cap.emb (τ a)) '' A).ncard ≤ A.ncard := ncard_image_le hAfin + have h₃ := D.ncard_poles + omega + intro e heZ + by_contra hno' + push Not at hno' + have hfar : ∀ x, x ∈ D.rad.poles ∨ (∃ a ∈ A, x = cap.emb (τ a)) → n < D.edgeVertDist e x := by + rintro x (hx | ⟨a, ha, rfl⟩) + · exact hno' x (Or.inl hx) + · exact hno' _ (Or.inr ⟨a, ha, rfl⟩) + have heA : e ∉ A := fun h ↦ by + have h₁ := hfar _ (Or.inr ⟨e, h, rfl⟩) + have h₂ := edgeVertDist_self_le D (by omega) heZ.1 (hτ e h) (hτV e h) + omega + have hclose : ∀ b ∈ A, n < D.edgeDist e b := by + intro b hb + by_contra hle + push Not at hle + have hbe : e ≠ b := fun h ↦ heA (h ▸ hb) + have h₁ := edgeVertDist_le D (by omega) hbe (hAE b hb) (by omega) (hτ b hb) + (hτV b hb) + have h₂ := hfar _ (Or.inr ⟨b, hb, rfl⟩) + omega + have hins : insert e A ∈ 𝒜 := by + refine ⟨insert_subset heZ hAmem.1, ?_, ?_⟩ + · rintro a (rfl | ha) b (rfl | hb) hab + · exact absurd rfl hab + · exact hclose b hb + · have := hclose a ha + change n < D.dist _ _ + rw [D.dist_comm] + exact this + · exact hAmem.2.1 a ha b hb hab + · rintro a (rfl | ha) r hr + · exact hfar r (Or.inl hr) + · exact hAmem.2.2 a ha r hr + exact heA (hmax.2 hins (subset_insert e A) (mem_insert e A)) + +/-- **Graph Minors XIX, (12.3)** (page 364): "There exists $X_2 \subseteq V(\Gamma^*)$ with $|X_2| +\le m + c(\Sigma_\chi)$ and $P^* +\subseteq X_2$ and an integer $t$ with $n \le t \le 5^{2m}n$, such that" `d(x₁, x₂) > 24t` for all +distinct +`x₁, x₂ ∈ X₂`, and for every `e ∈ Z` there exists `x ∈ X₂` with `d(e, x) ≤ t`. -/ +theorem theorem_12_3_proof (D : TangleDatum cap χ) {m n k : ℕ} {ω₀ : α} (hn : 4 ≤ n) + (hfl : D.IsFlawedInternally m n k ω₀) : + ∃ X₂ ⊆ D.rad.G.V, X₂.ncard ≤ m + numCuffs S ∧ D.rad.poles ⊆ X₂ ∧ ∃ t, n ≤ t ∧ + t ≤ 5 ^ (2 * m) * n ∧ (∀ x₁ ∈ X₂, ∀ x₂ ∈ X₂, x₁ ≠ x₂ → 24 * t < D.vDist x₁ x₂) ∧ + ∀ e ∈ D.largeEdges k ω₀, ∃ x ∈ X₂, D.edgeVertDist e x ≤ t := by + classical + obtain ⟨hr₁, hr₂, hfd, hno⟩ := hfl + have h25 : 5 ^ (2 * m + 2) * n = 25 * (5 ^ (2 * m) * n) := by rw [pow_add]; ring + have hle5 : n ≤ 5 ^ (2 * m) * n := Nat.le_mul_of_pos_left _ (by positivity) + have hrep : n < D.rep := by omega + obtain ⟨X₁, hX₁G, hX₁c, hX₁p, hX₁c'⟩ := theorem_12_2_proof D hn hrep hno + set c := numCuffs S with hc + set K := m + c with hK + have hX₁fin : X₁.Finite := D.rad.G.finite_V.subset hX₁G + let 𝓕 : Set (Set Shat) := {Y | Y ⊆ X₁ ∧ D.rad.poles ⊆ Y ∧ + ∀ e ∈ D.largeEdges k ω₀, ∃ x ∈ Y, D.edgeVertDist e x ≤ 5 ^ (2 * K - 2 * Y.ncard) * n} + have h𝓕fin : 𝓕.Finite := hX₁fin.finite_subsets.subset fun _ h ↦ h.1 + have hX₁𝓕 : X₁ ∈ 𝓕 := by + refine ⟨subset_rfl, hX₁p, fun e he ↦ ?_⟩ + obtain ⟨x, hx, hd⟩ := hX₁c' e he + exact ⟨x, hx, hd.trans (Nat.le_mul_of_pos_left _ (by positivity))⟩ + obtain ⟨Y, -, hmin⟩ := h𝓕fin.exists_le_minimal hX₁𝓕 + obtain ⟨hYX, hYp, hYc⟩ := hmin.1 + have hYfin : Y.Finite := hX₁fin.subset hYX + have hYle : Y.ncard ≤ K := (ncard_le_ncard hYX hX₁fin).trans hX₁c + have hYge : c ≤ Y.ncard := by + rw [hc, ← D.ncard_poles] + exact ncard_le_ncard hYp hYfin + set t := 5 ^ (2 * K - 2 * Y.ncard) * n with ht + have htn : n ≤ t := Nat.le_mul_of_pos_left _ (by positivity) + have ht5 : t ≤ 5 ^ (2 * m) * n := + Nat.mul_le_mul_right _ (Nat.pow_le_pow_right (by norm_num) (by omega)) + have hkey : ∀ a ∈ Y, ∀ b ∈ Y, a ≠ b → b ∉ D.rad.poles → D.vDist a b ≤ 24 * t → False := by + intro a ha b hb hab hbp hd + have hYb : (Y \ {b}).ncard = Y.ncard - 1 := ncard_sdiff_singleton_of_mem hb + have hYpos : 1 ≤ Y.ncard := (ncard_pos hYfin).mpr ⟨b, hb⟩ + have hmem : Y \ {b} ∈ 𝓕 := by + refine ⟨sdiff_subset.trans hYX, fun p hp ↦ ⟨hYp hp, fun h ↦ hbp (h ▸ hp)⟩, fun e he ↦ ?_⟩ + have hexp : 5 ^ (2 * K - 2 * (Y \ {b}).ncard) * n = 25 * t := by + have : 2 * K - 2 * (Y \ {b}).ncard = (2 * K - 2 * Y.ncard) + 2 := by omega + rw [this, pow_add, ht] + ring + rw [hexp] + obtain ⟨x, hx, hdx⟩ := hYc e he + by_cases hxb : x = b + · subst hxb + refine ⟨a, ⟨ha, hab⟩, ?_⟩ + have hatom := D.atomOf_mem (hX₁G (hYX hb)) + have htri := dist_triangle D (by omega) (a := cap.emb '' e) + (c := D.rad.atomOf a) hatom + have hcomm : D.dist (D.rad.atomOf x) (D.rad.atomOf a) = D.vDist a x := D.dist_comm _ _ + change D.dist _ _ ≤ _ + have hdx' : D.dist (cap.emb '' e) (D.rad.atomOf x) ≤ t := hdx + omega + · exact ⟨x, ⟨hx, hxb⟩, hdx.trans (by omega)⟩ + exact (hmin.2 hmem sdiff_subset hb).2 rfl + refine ⟨Y, hYX.trans hX₁G, by omega, hYp, t, htn, ht5, ?_, hYc⟩ + intro x₁ h₁ x₂ h₂ hne + by_contra hle + push Not at hle + by_cases hp₂ : x₂ ∈ D.rad.poles + · by_cases hp₁ : x₁ ∈ D.rad.poles + · exact hfd ⟨hr₁, hr₂, x₁, hp₁, x₂, hp₂, hne, by omega⟩ + · exact hkey x₂ h₂ x₁ h₁ hne.symm hp₁ ((D.dist_comm _ _).trans_le hle) + · exact hkey x₁ h₁ x₂ h₂ hne hp₂ hle + +end Restraints + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section12b.lean b/LeanPool/GraphMinor/GM19/Section12b.lean new file mode 100644 index 0000000000..55563c2a71 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section12b.lean @@ -0,0 +1,179 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section12a +public import LeanPool.GraphMinor.GM19.Section10l + +/-! +# Graph Minors XIX, Section 12: growing a disc along a chord + +A disc whose boundary is a circuit of `Γ*` grows along a chord outside it. This is the step "and +subject to that with +`D(F)` maximal" of the proof of (12.1). The main result is `exists_larger_circuit`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +section Chord + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +omit [T2Space T] in +theorem _root_.GraphMinor.Surface.IsLineWithEnds.exists_arcMap {L : Set T} {s t : T} + (h : IsLineWithEnds L s t) : + ∃ a : unitInterval → T, IsArcMap a ∧ range a = L ∧ a 0 = s ∧ a 1 = t := by + obtain ⟨f, h0, h1⟩ := h + refine ⟨fun x ↦ (f x).1, ⟨continuous_subtype_val.comp f.continuous, + fun x y hxy ↦ f.injective (Subtype.ext hxy)⟩, ?_, h0, h1⟩ + ext y + constructor + · rintro ⟨x, rfl⟩ + exact (f x).2 + · intro hy + exact ⟨f.symm ⟨y, hy⟩, by simp⟩ + +omit [T2Space T] in +/-- A line has a point besides its two ends. -/ +theorem _root_.GraphMinor.Surface.IsLineWithEnds.exists_ne_ends {L : Set T} {s t : T} + (h : IsLineWithEnds L s t) : ∃ x ∈ L, x ≠ s ∧ x ≠ t := by + obtain ⟨a, ha, rfl, rfl, rfl⟩ := h.exists_arcMap + let m : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + refine ⟨a m, ⟨m, rfl⟩, fun h ↦ ?_, fun h ↦ ?_⟩ + · have := congrArg Subtype.val (ha.2 h) + norm_num [m] at this + · have := congrArg Subtype.val (ha.2 h) + norm_num [m] at this + +/-- **A chord of a disc inside a bigger disc.** The boundary of `W` is the union of two lines `A`, +`B` with the same ends +`s`, `t`, and the line `L` with these ends misses `W` otherwise. Then a bigger disc in `Δ` has +boundary `L ∪ A` or `L ∪ B`. -/ +theorem exists_larger_disc (hT : IsClosedSurface T) {Δ W A B L : Set T} {s t : T} + (hΔ : IsClosedDisc Δ) + (hW : IsClosedDisc W) (hWΔ : W ⊆ Δ) (hLΔ : L ⊆ Δ) (hA : IsLineWithEnds A s t) + (hB : IsLineWithEnds B s t) + (hL : IsLineWithEnds L s t) (hAB : A ∪ B = discBd W) (hAB' : A ∩ B = {s, t}) (hLW : L ∩ W + = {s, t}) : + ∃ W', W' ⊆ Δ ∧ IsClosedDisc W' ∧ W ⊂ W' ∧ (discBd W' = L ∪ A ∨ discBd W' = L ∪ B) := by + have hman : ∀ x : T, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + obtain ⟨a, ha, hra, ha0, ha1⟩ := hA.exists_arcMap + obtain ⟨l, hl, hrl, hl0, hl1⟩ := hL.exists_arcMap + have hAW : A ⊆ W := (subset_union_left.trans hAB.le).trans (Surface.discBd_subset W) + have hBW : B ⊆ W := (subset_union_right.trans hAB.le).trans (Surface.discBd_subset W) + have hmeet : ∀ x y, a x = l y → (x = 0 ∧ y = 0) ∨ (x = 1 ∧ y = 1) := by + intro x y he + have hm : a x ∈ L ∩ W := ⟨hrl ▸ ⟨y, he.symm⟩, hAW (hra ▸ ⟨x, rfl⟩)⟩ + rw [hLW] at hm + rcases hm with hm | hm + · have hx : x = 0 := ha.2 (hm.trans ha0.symm) + have hy : y = 0 := hl.2 (by rw [← he, hx, ha0, hl0]) + exact .inl ⟨hx, hy⟩ + · have hx : x = 1 := ha.2 (hm.trans ha1.symm) + have hy : y = 1 := hl.2 (by rw [← he, hx, ha1, hl1]) + exact .inr ⟨hx, hy⟩ + have hO : IsOArc (A ∪ L) := by + rw [← hra, ← hrl] + exact oArc_of_two_arcs ha hl (ha0.trans hl0.symm) (ha1.trans hl1.symm) hmeet + have hsub : A ∪ L ⊆ Δ := union_subset (hAW.trans hWΔ) hLΔ + obtain ⟨Δ₁, ⟨hΔ₁Δ, hΔ₁, hb₁, -⟩, -⟩ := disc_oArc Δ (A ∪ L) hΔ hsub hO + have hsub₁ : A ∪ L ⊆ Δ₁ := hb₁ ▸ Surface.discBd_subset Δ₁ + have hsL : s ∈ L ∧ t ∈ L := by + rw [← hl0, ← hl1, ← hrl] + exact ⟨⟨0, rfl⟩, ⟨1, rfl⟩⟩ + have hsA : s ∈ A ∧ t ∈ A := by + rw [← ha0, ← ha1, ← hra] + exact ⟨⟨0, rfl⟩, ⟨1, rfl⟩⟩ + have hdisj : Disjoint (discInt W) (discBd Δ₁) := by + rw [hb₁, disjoint_left] + rintro x ⟨hx, hx'⟩ (h | h) + · exact hx' (hAB ▸ Or.inl h) + · have : x ∈ L ∩ W := ⟨h, hx⟩ + rw [hLW] at this + apply hx' + rw [← hAB] + exact Or.inl (by rcases this with rfl | rfl; exacts [hsA.1, hsA.2]) + obtain ⟨y, hyL, hys, hyt⟩ := hL.exists_ne_ends + have hyW : y ∉ W := fun h ↦ by + have : y ∈ L ∩ W := ⟨hyL, h⟩ + rw [hLW] at this + rcases this with h | h + exacts [hys h, hyt h] + rcases hΔ₁.side hman hW.isPreconnected_discInt hdisj with hin | hout + · refine ⟨Δ₁, hΔ₁Δ, hΔ₁, ⟨?_, fun h ↦ hyW (h (hsub₁ (Or.inr hyL)))⟩, .inl (by rw [hb₁, + Set.union_comm])⟩ + exact hW.subset_closure_discInt.trans (closure_minimal (hin.trans sdiff_subset) hΔ₁.isClosed) + have hbout : ∀ x ∈ B, x ≠ s → x ≠ t → x ∉ Δ₁ := by + intro x hxB hxs hxt hmem + have hxb : x ∉ discBd Δ₁ := by + rw [hb₁] + rintro (h | h) + · have : x ∈ A ∩ B := ⟨h, hxB⟩ + rw [hAB'] at this + rcases this with h | h + exacts [hxs h, hxt h] + · have : x ∈ L ∩ W := ⟨h, hBW hxB⟩ + rw [hLW] at this + rcases this with h | h + exacts [hxs h, hxt h] + have hcl : x ∈ closure (discInt W) := hW.subset_closure_discInt (hBW hxB) + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp hcl _ (hΔ₁.isOpen_discInt hman) ⟨hmem, hxb⟩ + exact disjoint_left.mp hout hw2 hw1.1 + have hinter : Δ₁ ∩ W = A := by + ext x + constructor + · rintro ⟨hx, hx'⟩ + by_cases hb : x ∈ discBd W + · rw [← hAB] at hb + rcases hb with hb | hb + · exact hb + · by_cases hxs : x = s + · exact hxs ▸ hsA.1 + by_cases hxt : x = t + · exact hxt ▸ hsA.2 + exact absurd hx (hbout x hb hxs hxt) + · exact absurd hx (disjoint_left.mp hout ⟨hx', hb⟩) + · intro hx + exact ⟨hsub₁ (Or.inl hx), hAW hx⟩ + have hu := disc_union.{0} Δ₁ W A s t hΔ₁ hW hA hinter (hb₁ ▸ subset_union_left) + (hAB ▸ subset_union_left) + refine ⟨Δ₁ ∪ W, union_subset hΔ₁Δ hWΔ, hu.1, ⟨subset_union_right, fun h ↦ ?_⟩, .inr ?_⟩ + · exact hyW (h (Or.inl (hsub₁ (Or.inr hyL)))) + · rw [hu.2, hb₁, ← hAB] + ext x + have hends : ∀ {x}, x = s ∨ x = t → x ∈ L := fun h ↦ by + rcases h with rfl | rfl + exacts [hsL.1, hsL.2] + have hLA : x ∈ L → x ∈ A → x = s ∨ x = t := fun h h' ↦ by + have : x ∈ L ∩ W := ⟨h, hAW h'⟩ + rwa [hLW] at this + have hBA : x ∈ A → x ∈ B → x = s ∨ x = t := fun h h' ↦ by + have : x ∈ A ∩ B := ⟨h, h'⟩ + rwa [hAB'] at this + simp only [mem_sdiff, mem_union, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨h, hn⟩ + by_cases hst : x = s ∨ x = t + · exact .inl (hends hst) + · rcases h with (h | h) | (h | h) + · exact absurd ⟨h, hst⟩ hn + · exact .inl h + · exact absurd ⟨h, hst⟩ hn + · exact .inr h + · rintro (h | h) + · exact ⟨.inl (.inr h), fun ⟨h', hn⟩ ↦ hn (hLA h h')⟩ + · exact ⟨.inr (.inr h), fun ⟨h', hn⟩ ↦ hn (hBA h' h)⟩ + +end Chord + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section12c.lean b/LeanPool/GraphMinor/GM19/Section12c.lean new file mode 100644 index 0000000000..60b3d3094d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section12c.lean @@ -0,0 +1,652 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section12b +public import LeanPool.GraphMinor.GM19.Section10n +public import LeanPool.GraphMinor.GM19.FragmentForm + +/-! +# Graph Minors XIX, Section 12: vertices near a hub + +The proof of (12.1) measures walks of `Γ*` from the hub `H`. We say that a vertex of `Γ*` is +`k`-near `H` if a walk of +`Γ*` of length at most `k` joins it to `V(H)`. This file proves how nearness passes across the +regions of `Γ*`. + +A region `q` of `Γ*` holds one edge `e` of `Γ`. If `q` meets a region `r` of `Γ` with `r*` being +`k`-near, then the ends +of `e` should be `(k + 1)`-near. This holds if `|eTilde| = 2`. If `|eTilde| = 3`, then `r` touches +`e` along +one side of the disc +`ē`, so `rBar` holds only two of the three ends for free. The fifth condition in the definition of +"fits" helps here: if +`ē` misses `bd(Σ)`, then these two ends are the only vertices of `Γ` in `rBar`. So a shortest walk +reaches `r*` through +one of them, and the third end is a further two steps away. The result is +`TangleDatum.IsNear.of_corner`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +omit [TopologicalSpace Shat] [T2Space Shat] in +/-- A walk contains a simple walk with the same ends that is no longer. -/ +theorem _root_.GraphMinor.Surface.GraphWalk.exists_isSimple_length_le {β : Type*} {G : Graph Shat + β} {u v : Shat} + (W : GraphWalk G u v) : ∃ W' : GraphWalk G u v, W'.IsSimple ∧ W'.length ≤ W.length := by + classical + induction W with + | nil h => exact ⟨.nil h, by simp [GraphWalk.IsSimple], le_rfl⟩ + | @cons u v w e h r ih => + obtain ⟨R, hR, hl⟩ := ih + by_cases hu : u ∈ R.support + · obtain ⟨R₁, R₂, rfl⟩ := R.exists_append_of_mem hu + have hR₂ : R₂.IsSimple := by + have hn : (R₁.support ++ R₂.support.tail).Nodup := by + have h' : (R₁.append R₂).support.Nodup := hR + rwa [GraphWalk.support_append] at h' + have hd := List.nodup_append.mp hn + unfold GraphWalk.IsSimple + rw [R₂.support_eq_cons] + exact List.nodup_cons.mpr ⟨fun hx => hd.2.2 u R₁.end_mem_support u hx rfl, hd.2.1⟩ + refine ⟨R₂, hR₂, ?_⟩ + rw [GraphWalk.length_append] at hl + rw [GraphWalk.length_cons] + omega + · refine ⟨.cons h R, List.nodup_cons.mpr ⟨hu, hR⟩, ?_⟩ + simpa using hl + +omit [T2Space S] in +/-- Two ends of a disc edge lie on one side of the disc: a component of `bd(cBar) \ cTilde`. -/ +theorem Painting.exists_side_between (Γ : Painting S) {c : Set S} (hc : c ∈ Γ.E) (h3 : + (tilde c).ncard = 3) {u v : S} + (hu : u ∈ tilde c) (hv : v ∈ tilde c) (huv : u ≠ v) : + ∃ f, Γ.IsSkEdgeIn f c ∧ u ∈ closure f ∧ v ∈ closure f := by + classical + obtain ⟨hdisc, hT, hfin⟩ := Γ.isDisc_of_three hc h3 + -- the third end + obtain ⟨t, ht, htu, htv⟩ : ∃ t ∈ tilde c, t ≠ u ∧ t ≠ v := by + by_contra hno + push Not at hno + have hsub : tilde c ⊆ {u, v} := fun t ht ↦ by + by_cases h : t = u + · exact .inl h + · exact .inr (hno t ht h) + have := ncard_le_ncard hsub (toFinite _) + rw [h3, ncard_pair huv] at this + omega + have hall : ∀ y ∈ tilde c, y = u ∨ y = v ∨ y = t := fun y hy ↦ by + by_contra hno + push Not at hno + have hsub : ({u, v, t, y} : Set S) ⊆ tilde c := by + rintro z (rfl | rfl | rfl | rfl) + exacts [hu, hv, ht, hy] + have h4 : ({u, v, t, y} : Set S).ncard = 4 := by + rw [ncard_insert_of_notMem, ncard_insert_of_notMem, ncard_pair] <;> simp_all [Ne.symm] + have := ncard_le_ncard hsub hfin + omega + have key : ∀ a : unitInterval → S, IsArcMap a → a 0 = u → a 1 = v → range a ⊆ discBd (closure c) → + (∀ s, a s = t → s = 0 ∨ s = 1) → ∃ f, Γ.IsSkEdgeIn f c ∧ u ∈ closure f ∧ v ∈ closure f := by + intro a ha h0 h1 hsub ht' + let b : ℝ → S := fun s ↦ a (projIcc 0 1 zero_le_one s) + have hb : Continuous b := ha.1.comp continuous_projIcc + let A : Set S := b '' Ioo 0 1 + have hopen : ∀ s ∈ Ioo (0 : ℝ) 1, projIcc 0 1 zero_le_one s ≠ 0 ∧ projIcc 0 1 zero_le_one s ≠ 1 + := by + intro s hs + rw [projIcc_of_mem zero_le_one ⟨hs.1.le, hs.2.le⟩] + exact ⟨fun h ↦ hs.1.ne' (congrArg Subtype.val h), fun h ↦ hs.2.ne (congrArg Subtype.val h)⟩ + have hAc : IsPathConnected A := + ((convex_Ioo (0 : ℝ) 1).isPathConnected (nonempty_Ioo.mpr zero_lt_one)).image hb + have hAb : ∀ x ∈ A, x ∈ discBd (closure c) ∧ x ∉ tilde c := by + rintro x ⟨s, hs, rfl⟩ + obtain ⟨h₀, h₁⟩ := hopen s hs + refine ⟨hsub ⟨_, rfl⟩, fun hx ↦ ?_⟩ + rcases hall _ hx with h | h | h + · exact h₀ (ha.2 (h.trans h0.symm)) + · exact h₁ (ha.2 (h.trans h1.symm)) + · rcases ht' _ h with h | h + exacts [h₀ h, h₁ h] + have hAsub : A ⊆ discBd (closure c) \ tilde c := fun x hx ↦ hAb x hx + obtain ⟨f, hf, hAf⟩ := exists_arcComp_superset hAc hAsub + refine ⟨f, ⟨hc, .inr ⟨h3, hf⟩⟩, ?_, ?_⟩ + · have : (0 : ℝ) ∈ closure (Ioo (0 : ℝ) 1) := by + rw [closure_Ioo zero_ne_one] + simp + have h := image_closure_subset_closure_image hb (mem_image_of_mem b this) + have hb0 : b 0 = u := by + simp only [b, projIcc_left] + exact h0 + rw [hb0] at h + exact closure_mono hAf h + · have : (1 : ℝ) ∈ closure (Ioo (0 : ℝ) 1) := by + rw [closure_Ioo zero_ne_one] + simp + have h := image_closure_subset_closure_image hb (mem_image_of_mem b this) + have hb1 : b 1 = v := by + simp only [b, projIcc_right] + exact h1 + rw [hb1] at h + exact closure_mono hAf h + obtain ⟨a, b, hab, ha0, ha1, hun⟩ := hdisc.isOArc_discBd.exists_arcs (hT hu) (hT hv) huv + rcases hun.symm.subset (hT ht) with ⟨s, hs⟩ | ⟨s, hs⟩ + · -- `t` lies on `a`, so `b` is the side + refine key b hab.arc_right (hab.zero.trans ha0) (hab.one.trans ha1) ?_ ?_ + · rw [← hun] + exact subset_union_right + · intro s' hs' + rcases hab.meet s s' (hs.trans hs'.symm) with h | h + · exact .inl h.2 + · exact .inr h.2 + · refine key a hab.arc_left ha0 ha1 ?_ ?_ + · rw [← hun] + exact subset_union_left + · intro s' hs' + rcases hab.meet s' s (hs'.trans hs.symm) with h | h + · exact .inl h.1 + · exact .inr h.1 + +omit [T2Space S] in +/-- A side of a disc edge lies on the boundary of a region of `Γ` outside the disc. -/ +theorem IsSkHat.exists_hatRegion_side {Γ : Painting S} {Sk : Drawing Shat} (hSk : IsSkHat cap Γ Sk) + (hS : IsSurface S) + {f c : Set S} (hf : Γ.IsSkEdgeIn f c) (h3 : (tilde c).ncard = 3) : + ∃ r ∈ Γ.hatRegions cap, cap.emb '' f ⊆ closure r := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hc := hf.1 + have hfE : cap.emb '' f ∈ Sk.E := hSk.edge_iff.mpr ⟨f, hf.mem, rfl⟩ + obtain ⟨p, hp⟩ := hf.mem.1 + have hpb : p ∈ discBd (closure c) := by + rcases hf.2 with ⟨h2, -⟩ | ⟨-, h⟩ + · omega + · exact (h.2.1 hp).1 + have hpc : p ∈ c := hf.subset hp + obtain ⟨hdisc, -⟩ := Γ.isDisc_of_three hc h3 + obtain ⟨hC, hCbd⟩ := isClosedDisc_image hdisc cap.isEmbedding + have hfr : cap.emb p ∈ closure (cap.emb '' closure c)ᶜ := by + have : cap.emb p ∈ frontier (cap.emb '' closure c) := by + rw [IsClosedDisc.frontier_eq_discBd hT hC, hCbd] + exact mem_image_of_mem _ hpb + rw [frontier_eq_closure_inter_closure] at this + exact this.2 + obtain ⟨r, hr, hpr, y, hyr, hyO⟩ := exists_region_near hT Sk hC.isClosed.isOpen_compl hfr + have hinc : cap.emb '' f ⊆ closure r := + edge_subset_closure_of_incident hT hfE hr ⟨_, mem_image_of_mem _ hp, hpr⟩ + rcases hSk.region_cases hr with hhat | ⟨c', hc', -, hsub⟩ + · exact ⟨r, hhat, hinc⟩ + · exfalso + have hcl : IsClosed (cap.emb '' closure c') := (cap.isClosedEmbedding hS).isClosedMap _ + isClosed_closure + have hp' : cap.emb p ∈ cap.emb '' closure c' := closure_minimal hsub hcl hpr + obtain ⟨p', hp', hpp⟩ := hp' + obtain rfl := cap.isEmbedding.injective hpp + have hpc' : p' ∈ c' := by + rcases Γ.closure_subset hc' hp' with h | h + · exact h + · exact absurd h (Γ.disjoint_V hc hpc) + obtain rfl := arcComp_eq_of_mem hc hc' hpc hpc' + exact hyO (hsub hyr) + +namespace TangleDatum + +variable (D : TangleDatum cap χ) + +/-- A vertex `x` of `Γ*` is `k`-near `H` if a walk of `Γ*` of length at most `k` joins it to `V(H)`. +-/ +def IsNear (H : Drawing Shat) (k : ℕ) (x : Shat) : Prop := + ∃ h ∈ H.V, ∃ W : GraphWalk D.rad.G.toGraph x h, W.length ≤ k + +variable {D} {H : Drawing Shat} {k l : ℕ} {x y : Shat} + +omit [T2Space S] [T2Space Shat] in +theorem IsNear.mono (h : D.IsNear H k x) (hkl : k ≤ l) : D.IsNear H l x := by + obtain ⟨h, hh, W, hW⟩ := h + exact ⟨h, hh, W, hW.trans hkl⟩ + +omit [T2Space S] [T2Space Shat] in +theorem IsNear.step (h : D.IsNear H k x) {e : Set Shat} (hl : D.rad.G.toGraph.IsLink e y x) : + D.IsNear H (k + 1) y := by + obtain ⟨h, hh, W, hW⟩ := h + exact ⟨h, hh, .cons hl W, by simpa using hW⟩ + +omit [T2Space S] [T2Space Shat] in +theorem IsNear.mem_V (h : D.IsNear H k x) : x ∈ D.rad.G.V := by + obtain ⟨h, hh, W, -⟩ := h + cases W with + | nil h' => exact h' + | cons hl _ => exact hl.2.1 + +omit [T2Space S] [T2Space Shat] in +/-- Each vertex of `H` is `0`-near `H`. -/ +theorem isNear_self (hH : H.IsSubdrawing D.rad.G) (hx : x ∈ H.V) : D.IsNear H 0 x := + ⟨x, hx, .nil (hH.1 hx), le_of_eq rfl⟩ + +omit [T2Space S] in +/-- A path from a vertex to `V(H)` gives nearness, and conversely. -/ +theorem isNear_iff_exists_path : + D.IsNear H k x ↔ ∃ P : Drawing Shat, ∃ h ∈ H.V, P.IsPathOf D.rad.G x h ∧ P.E.ncard ≤ k := by + classical + constructor + · rintro ⟨h, hh, W, hW⟩ + obtain ⟨W', hs, hle⟩ := W.exists_isSimple_length_le + refine ⟨walkDrawing D.rad.G W', h, hh, ⟨walkDrawing_isSubdrawing _ _, + walkDrawing_isPathBetween _ hs⟩, ?_⟩ + rw [ncard_walk_E _ hs] + omega + · rintro ⟨P, h, hh, hP, hle⟩ + obtain ⟨W, hW, -, hE⟩ := hP.2 + obtain ⟨W', hs, he⟩ := hP.1.exists_walk_up W + refine ⟨h, hh, W', ?_⟩ + have h₁ := ncard_walk_E P hW + rw [walkDrawing_E, ← hE] at h₁ + have h₂ : W'.length = W.length := by rw [← edges_length, ← edges_length, he] + omega + +omit [T2Space Shat] in +/-- The region of a vertex of `R*` is open. -/ +theorem isOpen_regionOf (D : TangleDatum cap χ) {w : Shat} (hw : w ∈ D.rad.Rstar) : IsOpen + (D.rad.regionOf w) := by + have hT := cap.isClosedSurface + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + obtain ⟨Sk, hSk⟩ := exists_isSkHat χ.isSurface cap D.P.Γ + exact region_isOpen (hSk.hatRegion_mem_R (D.rad.regionOf_mem hw).1) + +omit [T2Space Shat] in +/-- An edge of `Γ*` at `w ∈ R*` lies in the region of `w`. -/ +theorem edge_subset_regionOf (D : TangleDatum cap χ) {w : Shat} (hw : w ∈ D.rad.Rstar) {g : Set + Shat} + (hg : g ∈ D.rad.G.E) (hwg : w ∈ closure g) : g ⊆ D.rad.regionOf w := by + have hT := cap.isClosedSurface + obtain ⟨Sk, hSk⟩ := exists_isSkHat χ.isSurface cap D.P.Γ + have hR := hSk.hatRegion_mem_R (D.rad.regionOf_mem hw).1 + obtain ⟨y, hyr, hyg⟩ := mem_closure_iff.mp hwg _ (isOpen_regionOf D hw) (D.rad.regionOf_mem hw).2 + have hdis : Disjoint g Sk.U := by + rw [disjoint_left] + intro z hz hzU + have h₁ : z ∈ D.P.Γ.hatU cap := by + rw [hSk.hU] at hzU + exact image_mono D.P.Γ.skU_subset hzU + have h₂ : z ∈ D.rad.G.U := by + rw [D.rad.G.U_eq] + exact .inr (mem_iUnion₂.mpr ⟨g, hg, subset_closure hz⟩) + have h₃ : z ∈ D.P.Γ.hatV cap := D.rad.isPreRadial.1 ▸ ⟨h₁, h₂⟩ + exact (hg.2.1 hz).2 (D.rad.isPreRadial.2.1 h₃) + exact subset_region hR hg.2.2.1.isConnected.isPreconnected hdis hyg hyr + +omit [T2Space Shat] in +/-- Crossing a region of `Γ` from its centre to a vertex on its boundary is one step of `Γ*`. -/ +theorem IsNear.of_closure_region (h : D.IsNear H k x) (hx : x ∈ D.rad.Rstar) {v : S} + (hv : v ∈ D.P.Γ.V) + (hcl : cap.emb v ∈ closure (D.rad.regionOf x)) : D.IsNear H (k + 1) (cap.emb v) := by + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + obtain ⟨e, he, hcap⟩ := D.rad.exists_spoke hS (h3.hatRegions_isOpenDisc hS cap) h3.1 hx hv hcl + exact h.step ⟨he, D.rad.isPreRadial.2.1 (mem_image_of_mem _ hv), hx.1, hcap⟩ + +omit [T2Space Shat] in +/-- From a vertex of `Γ` on the boundary of a region of `Γ`, one step of `Γ*` reaches the centre of +the region. -/ +theorem IsNear.to_centre {v : S} (h : D.IsNear H k (cap.emb v)) (hv : v ∈ D.P.Γ.V) {r : Set Shat} + (hr : r ∈ D.P.Γ.hatRegions cap) (hcl : cap.emb v ∈ closure r) : + ∃ w ∈ D.rad.Rstar, D.rad.regionOf w = r ∧ D.IsNear H (k + 1) w := by + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + obtain ⟨w, ⟨hwr, hwG⟩, -⟩ := D.rad.isPreRadial.2.2.1 r hr + have hwV : w ∉ D.P.Γ.hatV cap := fun hV ↦ by + obtain ⟨y, hy, rfl⟩ := id hr + exact (connectedComponentIn_subset _ _ hwr) (image_mono D.P.Γ.V_subset hV) + have hw : w ∈ D.rad.Rstar := ⟨hwG, hwV⟩ + have hreg : D.rad.regionOf w = r := by + obtain ⟨y, hy, rfl⟩ := id hr + exact (connectedComponentIn_eq hwr).symm + refine ⟨w, hw, hreg, ?_⟩ + obtain ⟨e, he, hcap⟩ := D.rad.exists_spoke hS (h3.hatRegions_isOpenDisc hS cap) h3.1 hw hv + (hreg ▸ hcl) + have hcap' : closure e ∩ D.rad.G.V = {w, cap.emb v} := by rw [hcap, pair_comm] + exact h.step ⟨he, hwG, D.rad.isPreRadial.2.1 (mem_image_of_mem _ hv), hcap'⟩ + +/-- Two ends of a disc edge are two steps apart in `Γ*`, through the region on the side between +them. -/ +theorem IsNear.across_side {c : Set S} (hc : c ∈ D.P.Γ.E) (h3 : (tilde c).ncard = 3) {u v : S} + (hu : u ∈ tilde c) + (hv : v ∈ tilde c) (huv : u ≠ v) (h : D.IsNear H k (cap.emb u)) : D.IsNear H (k + 2) + (cap.emb v) := by + have hS := χ.isSurface + have hemb : ∀ {x : S} {f : Set S}, x ∈ closure f → cap.emb x ∈ closure (cap.emb '' f) := fun hx ↦ + image_closure_subset_closure_image cap.isEmbedding.continuous (mem_image_of_mem _ hx) + obtain ⟨f, hf, huf, hvf⟩ := D.P.Γ.exists_side_between hc h3 hu hv huv + obtain ⟨Sk, hSk⟩ := exists_isSkHat hS cap D.P.Γ + obtain ⟨r, hr, hfr⟩ := hSk.exists_hatRegion_side hS hf h3 + have hcl : closure (cap.emb '' f) ⊆ closure r := closure_minimal hfr isClosed_closure + obtain ⟨w, hw, hreg, hnear⟩ := h.to_centre (D.P.Γ.tilde_subset_V hc hu) hr (hcl (hemb huf)) + exact hnear.of_closure_region hw (D.P.Γ.tilde_subset_V hc hv) (hreg ▸ hcl (hemb hvf)) + +omit [T2Space Shat] in +/-- The last step of a walk to `w ∈ R*`: either `w` is in `H`, or some vertex of `Γ` on the boundary +of the region of +`w` is one step nearer. -/ +theorem IsNear.exists_prev (h : D.IsNear H (k + 1) x) (hx : x ∈ D.rad.Rstar) : + x ∈ H.V ∨ ∃ v ∈ D.P.Γ.V, cap.emb v ∈ closure (D.rad.regionOf x) ∧ D.IsNear H k (cap.emb v) := by + obtain ⟨h, hh, W, hW⟩ := h + cases W with + | nil _ => exact .inl hh + | @cons _ u _ e hl r => + right + rw [GraphWalk.length_cons] at hW + obtain ⟨_, ⟨v', hv', rfl⟩, w, ⟨-, hw⟩, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 e hl.1 + have hxe : x ∈ closure e ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact .inl rfl + have hue : u ∈ closure e ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact .inr rfl + have huV : u ∈ D.P.Γ.hatV cap := by + rw [hcap] at hxe hue + rcases hxe with rfl | rfl + · exact absurd (mem_image_of_mem _ hv') hx.2 + · rcases hue with rfl | rfl + · exact mem_image_of_mem _ hv' + · exfalso + have hvm : cap.emb v' ∈ closure e ∩ D.rad.G.V := by + rw [hcap] + exact .inl rfl + rw [hl.2.2.2] at hvm + rcases hvm with h' | h' + · exact hx.2 (h' ▸ mem_image_of_mem _ hv') + · exact hx.2 (h' ▸ mem_image_of_mem _ hv') + obtain ⟨y, hy, rfl⟩ := huV + refine ⟨y, hy, ?_, ⟨h, hh, r, by omega⟩⟩ + exact closure_mono (edge_subset_regionOf D hx hl.1 hxe.1) hue.1 + +omit [T2Space S] [T2Space Shat] in +/-- A region of `Γ` in `Σ̂` that lies in `Σ` is the image of a region of `Γ` in `Σ`. -/ +theorem _root_.GraphMinor.GM19.Painting.exists_region_of_hat {Γ : Painting S} {r : Set Shat} + (hr : r ∈ Γ.hatRegions cap) + (hsub : r ⊆ range cap.emb) : ∃ r₀ ∈ Γ.regions, cap.emb '' r₀ = r := by + obtain ⟨y, hy, rfl⟩ := id hr + obtain ⟨x, rfl⟩ := hsub (mem_connectedComponentIn hy) + have hxU : x ∈ Γ.Uᶜ := fun h ↦ hy (mem_image_of_mem _ h) + refine ⟨connectedComponentIn Γ.Uᶜ x, ⟨x, hxU, rfl⟩, ?_⟩ + rw [image_connectedComponentIn_of_isEmbedding cap.isEmbedding hxU] + apply subset_antisymm + · exact connectedComponentIn_mono _ fun z ⟨z', hz', hzz⟩ ↦ fun ⟨u, hu, huz⟩ ↦ + hz' ((cap.isEmbedding.injective (huz.trans hzz.symm)) ▸ hu) + · have hs : connectedComponentIn (Γ.hatU cap)ᶜ (cap.emb x) ⊆ cap.emb '' Γ.Uᶜ := fun z hz ↦ by + obtain ⟨z', rfl⟩ := hsub hz + exact ⟨z', fun h ↦ (connectedComponentIn_subset _ _ hz) (mem_image_of_mem _ h), rfl⟩ + exact isPreconnected_connectedComponentIn.subset_connectedComponentIn + (mem_connectedComponentIn hy) hs + +omit [T2Space S] [T2Space Shat] in +/-- **The fifth condition.** Let `e` be an edge of size 3 whose closure misses `bd(Σ)`, and let `f` +be a side of `e` on +the boundary of the region `r` of `Γ`. If `v₁, v₂` are the two ends of `f`, then they are the only +vertices of `Γ` +in `rBar`. -/ +theorem vertex_mem_of_side (D : TangleDatum cap χ) {e f : Set S} {r : Set Shat} + (hf : D.P.Γ.IsSkEdgeIn f e) + (h3 : (tilde e).ncard = 3) (hoff : closure e ∩ bd S = ∅) (hr : r ∈ D.P.Γ.hatRegions cap) + (hfr : cap.emb '' f ⊆ closure r) {x y v : S} (hxy : x ≠ y) (hxf : x ∈ closure f) + (hyf : y ∈ closure f) + (hxV : x ∈ D.P.Γ.V) (hyV : y ∈ D.P.Γ.V) (hv : v ∈ D.P.Γ.V) (hvr : cap.emb v ∈ closure r) : v + = x ∨ v = y := by + classical + have hS := χ.isSurface + have hc := cap.isClosedEmbedding hS + obtain ⟨p, hp⟩ := hf.mem.1 + have hpe := hf.subset hp + have hpr : cap.emb p ∈ closure r := hfr (mem_image_of_mem _ hp) + rcases hatRegion_cases cap D.P.Γ hr with hsub | ⟨Θ, hΘ, rfl⟩ + · obtain ⟨r₀, hr₀, rfl⟩ := Painting.exists_region_of_hat hr hsub + have hcl : ∀ {z : S}, cap.emb z ∈ closure (cap.emb '' r₀) → z ∈ closure r₀ := fun {z} hz ↦ by + rw [hc.closure_image_eq] at hz + obtain ⟨z', hz', hzz⟩ := hz + exact cap.isEmbedding.injective hzz ▸ hz' + by_contra hne + push Not at hne + have hf₁ : closure f ⊆ closure e := closure_mono hf.subset + have hcard : 3 ≤ (closure r₀ ∩ D.P.Γ.V).ncard := by + have hsub' : ({x, y, v} : Set S) ⊆ closure r₀ ∩ D.P.Γ.V := by + have hfcl : closure f ⊆ closure r₀ := closure_minimal + (fun z hz ↦ hcl (hfr (mem_image_of_mem _ hz))) isClosed_closure + rintro z (rfl | rfl | rfl) + · exact ⟨hfcl hxf, hxV⟩ + · exact ⟨hfcl hyf, hyV⟩ + · exact ⟨hcl hvr, hv⟩ + have h₃ : ({x, y, v} : Set S).ncard = 3 := by + rw [ncard_eq_three] + exact ⟨x, y, v, hxy, hne.1.symm, hne.2.symm, rfl⟩ + rw [← h₃] + exact ncard_le_ncard hsub' (D.P.Γ.finite_V.subset inter_subset_right) + have hmem : p ∈ e ∩ closure r₀ := ⟨hpe, hcl hpr⟩ + obtain ⟨z, hz, hzb⟩ := D.P.fits.size_three_region e hf.1 h3 r₀ hr₀ hcard + (connectedComponentIn (e ∩ closure r₀) p) ⟨p, hmem, rfl⟩ + have : z ∈ closure e := closure_mono ((connectedComponentIn_subset _ _).trans + inter_subset_left) hz + have hemp : z ∈ closure e ∩ bd S := ⟨this, hzb⟩ + rw [hoff] at hemp + exact hemp.elim + · exfalso + have hpΘ : p ∈ Θ := cap.mem_of_emb_mem hΘ hpr + have : p ∈ closure e ∩ bd S := ⟨subset_closure hpe, cuff_subset_bd ⟨Θ, hΘ⟩ hpΘ⟩ + rw [hoff] at this + exact this.elim + +/-- If a region `q` of `Γ*` with edge `e` of `Γ` meets a region `r` of `Γ`, then a side of `e` lies +on the boundary of `r`. +For `|eTilde| = 2` the side is `e` itself. -/ +theorem exists_side_of_meet (D : TangleDatum cap χ) {q : Set Shat} {e : Set S} (hq : q ∈ D.rad.G.R) + (he : e ∈ D.P.Γ.E) + (heq : cap.emb '' e ⊆ q) {w : Shat} (hw : w ∈ D.rad.Rstar) (hm : (q ∩ D.rad.regionOf + w).Nonempty) : + ∃ f, D.P.Γ.IsSkEdgeIn f e ∧ cap.emb '' f ⊆ closure (D.rad.regionOf w) := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hS := χ.isSurface + have h3t := D.P.fits.internally_three_connected + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + obtain ⟨Sk, hSk⟩ := exists_isSkHat hS cap D.P.Γ + obtain ⟨hf₁, hf₂, hf₃⟩ := D.rad.region_facts hS h3t + set ρ := D.rad.regionOf w with hρdef + have hρ : ρ ∈ D.P.Γ.hatRegions cap := (D.rad.regionOf_mem hw).1 + have hρR := hSk.hatRegion_mem_R hρ + have hρU : Disjoint ρ (D.P.Γ.hatU cap) := by + rw [disjoint_left] + exact fun x hx ↦ connectedComponentIn_subset _ _ hx + -- `q` meets the frontier of `ρ` + obtain ⟨x₀, hx₀⟩ := he.1 + have hqne : (q ∩ ρᶜ).Nonempty := by + refine ⟨cap.emb x₀, heq (mem_image_of_mem _ hx₀), fun h ↦ disjoint_left.mp hρU h ?_⟩ + exact mem_image_of_mem _ (he.2.1 hx₀).1 + obtain ⟨p, hpq, hpfr⟩ : (q ∩ frontier ρ).Nonempty := by + by_contra hno + have hq' : IsPreconnected q := region_isPreconnected hq + have hO := isOpen_regionOf D hw + have hsub : q ⊆ ρ := hq'.subset_left_of_subset_union hO isClosed_closure.isOpen_compl + (disjoint_left.mpr fun x hx hn ↦ hn (subset_closure hx)) + (fun x hx ↦ by + by_cases h : x ∈ closure ρ + · refine .inl ?_ + by_contra hn + exact hno ⟨x, hx, ⟨h, by rwa [hO.interior_eq]⟩⟩ + · exact .inr h) hm + obtain ⟨y, hy, hyn⟩ := hqne + exact hyn (hsub hy) + have hpcl : p ∈ closure ρ := frontier_subset_closure hpfr + have hpρ : p ∉ ρ := fun h ↦ by + rw [(isOpen_regionOf D hw).frontier_eq] at hpfr + exact hpfr.2 h + have hpU : p ∈ D.P.Γ.hatU cap := by + by_contra hn + have hpSk : p ∉ Sk.U := fun h ↦ hn (by + rw [hSk.hU] at h + exact image_mono D.P.Γ.skU_subset h) + exact hpρ ((closure_region_subset hρR hpcl).resolve_right hpSk) + obtain ⟨z, hzU, rfl⟩ := hpU + have hzV : z ∉ D.P.Γ.V := fun h ↦ region_subset hq hpq + (D.rad.G.V_subset_U (D.rad.isPreRadial.2.1 (mem_image_of_mem _ h))) + -- the point lies on `e` + obtain ⟨c, hc, hzc⟩ := exists_arcComp_superset (F := D.P.Γ.U \ D.P.Γ.V) + (isPathConnected_singleton z) (singleton_subset_iff.2 ⟨hzU, hzV⟩) + have hzc' : z ∈ c := hzc rfl + have hcq : cap.emb '' c ⊆ q := by + refine subset_region hq (hc.2.2.1.image cap.isEmbedding.continuous).isConnected.isPreconnected + ?_ + (mem_image_of_mem _ hzc') hpq + rw [disjoint_left] + rintro _ ⟨y, hy, rfl⟩ hG + have hm : cap.emb y ∈ D.P.Γ.hatV cap := + D.rad.isPreRadial.1 ▸ ⟨mem_image_of_mem _ (hc.2.1 hy).1, hG⟩ + obtain ⟨y', hy', hyy⟩ := hm + exact (hc.2.1 hy).2 (cap.isEmbedding.injective hyy ▸ hy') + obtain rfl : c = e := hf₂ q hq c hc e he hcq heq + -- so `z` lies on an edge of `sk(Γ)` in `c` + have hskz : z ∈ D.P.Γ.skU := by + rcases D.P.Γ.size_cases hc with h2 | h3 + · exact .inl (.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h2⟩, hzc'⟩)) + · obtain ⟨hdisc, -⟩ := D.P.Γ.isDisc_of_three hc h3 + obtain ⟨hC, hCbd⟩ := isClosedDisc_image hdisc cap.isEmbedding + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + by_contra hn + have hzb : z ∉ discBd (closure c) := fun h ↦ hn (.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h3⟩, h⟩)) + have hint : cap.emb z ∈ discInt (cap.emb '' closure c) := by + refine ⟨mem_image_of_mem _ (subset_closure hzc'), fun h ↦ ?_⟩ + rw [hCbd] at h + obtain ⟨z', hz', hzz⟩ := h + exact hzb (cap.isEmbedding.injective hzz ▸ hz') + obtain ⟨y, hyO, hyρ⟩ := mem_closure_iff.mp hpcl _ (hC.isOpen_discInt hman) hint + obtain ⟨y', hy', rfl⟩ := hyO.1 + exact disjoint_left.mp hρU hyρ (mem_image_of_mem _ (D.P.Γ.closure_subset_U hc hy')) + obtain ⟨f, hfm, hzf⟩ := exists_arcComp_superset (F := D.P.Γ.skU \ D.P.Γ.V) + (isPathConnected_singleton z) (singleton_subset_iff.2 ⟨hskz, hzV⟩) + have hzf' : z ∈ f := hzf rfl + obtain ⟨c', hf⟩ := D.P.Γ.exists_isSkEdgeIn hfm + obtain rfl : c' = c := arcComp_eq_of_mem hf.1 hc (hf.subset hzf') hzc' + have hfE : cap.emb '' f ∈ Sk.E := hSk.edge_iff.mpr ⟨f, hfm, rfl⟩ + exact ⟨f, hf, edge_subset_closure_of_incident hT hfE hρR ⟨_, mem_image_of_mem _ hzf', hpcl⟩⟩ + +/-- A side of an edge of size 3 has two different ends, among the ends of the edge. -/ +theorem exists_side_ends (D : TangleDatum cap χ) {e f : Set S} (hf : D.P.Γ.IsSkEdgeIn f e) (h3 : + (tilde e).ncard = 3) : + ∃ a b, a ≠ b ∧ a ∈ closure f ∧ b ∈ closure f ∧ a ∈ tilde e ∧ b ∈ tilde e ∧ + closure f ⊆ f ∪ {a, b} := by + classical + have hS := χ.isSurface + have he := hf.1 + have : ConnectedSpace Shat := cap.connected + obtain ⟨Sk, hSk⟩ := exists_isSkHat hS cap D.P.Γ + have hfE : cap.emb '' f ∈ Sk.E := hSk.edge_iff.mpr ⟨f, hf.mem, rfl⟩ + have hc3 := D.P.Γ.isDisc_of_three he h3 + obtain ⟨hC, hCbd⟩ := isClosedDisc_image hc3.1 cap.isEmbedding + have hcl : IsClosedEmbedding cap.emb := cap.isClosedEmbedding hS + have hfb : closure (cap.emb '' f) ⊆ cap.emb '' discBd (closure e) := by + have hclosed : IsClosed (cap.emb '' discBd (closure e)) := by + rw [← hCbd] + exact hC.isOArc_discBd.isCompact.isClosed + refine closure_minimal ?_ hclosed + rintro _ ⟨z, hz, rfl⟩ + rcases hf.2 with ⟨h, -⟩ | ⟨-, h⟩ + · omega + · exact mem_image_of_mem _ (h.2.1 hz).1 + obtain ⟨a, b, hab, hcap⟩ : ∃ a b, a ≠ b ∧ closure (cap.emb '' f) ∩ Sk.V = {a, b} := by + rcases Sk.edge_cond _ hfE with ⟨a, b, hab, hcap, -⟩ | ⟨u, hcap, hO⟩ + · exact ⟨a, b, hab, hcap⟩ + · exfalso + have heq' : closure (cap.emb '' f) = discBd (cap.emb '' closure e) := + eq_of_oArc_subset hO hC.isOArc_discBd (hCbd ▸ hfb) + have hsub : cap.emb '' tilde e ⊆ {u} := by + rintro _ ⟨t, ht, rfl⟩ + rw [← hcap] + refine ⟨heq' ▸ hCbd ▸ mem_image_of_mem _ (hc3.2.1 ht), ?_⟩ + rw [hSk.hV] + exact mem_image_of_mem _ (D.P.Γ.tilde_subset_V he ht) + have := ncard_le_ncard hsub (toFinite _) + rw [ncard_image_of_injective _ cap.isEmbedding.injective, h3, ncard_singleton] at this + omega + have hend : ∀ {t}, t ∈ closure (cap.emb '' f) ∩ Sk.V → ∃ z ∈ closure f, z ∈ tilde e ∧ cap.emb z + = t := by + rintro t ⟨ht, htV⟩ + rw [hcl.closure_image_eq] at ht + obtain ⟨z, hz, rfl⟩ := ht + rw [hSk.hV] at htV + obtain ⟨z', hz', hzz⟩ := htV + obtain rfl := cap.isEmbedding.injective hzz + exact ⟨z', hz, ⟨closure_mono hf.subset hz, fun h ↦ D.P.Γ.disjoint_V he h hz'⟩, rfl⟩ + obtain ⟨a', ha'f, ha't, rfl⟩ := (hend (t := a) (hcap ▸ mem_insert _ _)) + obtain ⟨b', hb'f, hb't, rfl⟩ := (hend (t := b) (hcap ▸ mem_insert_of_mem _ rfl)) + refine ⟨a', b', fun h ↦ hab (by rw [h]), ha'f, hb'f, ha't, hb't, fun t ht ↦ ?_⟩ + have htcl : cap.emb t ∈ closure (cap.emb '' f) := + image_closure_subset_closure_image cap.isEmbedding.continuous (mem_image_of_mem _ ht) + rcases closure_edge_subset hfE htcl with ⟨t', ht', htt⟩ | htV + · exact .inl (cap.isEmbedding.injective htt ▸ ht') + · have hm : cap.emb t ∈ closure (cap.emb '' f) ∩ Sk.V := ⟨htcl, htV⟩ + rw [hcap] at hm + rcases hm with hm | hm + · exact .inr (.inl (cap.isEmbedding.injective hm)) + · exact .inr (.inr (cap.isEmbedding.injective hm)) + +/-- **The corner lemma.** Let `q` be a region of `Γ*` with edge `e` of `Γ`, and let `q` meet the +region of `w ∈ R*`, where +`w` is `k`-near `H`, for `k ≥ 2`. If `ē` misses `bd(Σ)` or `|eTilde| = 2`, then each end of `e` is +`(k + +1)`-near `H`. -/ +theorem IsNear.of_corner (hnear : D.IsNear H (k + 2) x) (hH : H.IsSubdrawing D.rad.G) {q : Set + Shat} {e : Set S} + (hq : q ∈ D.rad.G.R) (he : e ∈ D.P.Γ.E) (heq : cap.emb '' e ⊆ q) (hx : x ∈ D.rad.Rstar) + (hm : (q ∩ D.rad.regionOf x).Nonempty) (hoff : (tilde e).ncard = 3 → closure e ∩ bd S = ∅) + {v : S} (hv : v ∈ tilde e) : D.IsNear H (k + 3) (cap.emb v) := by + classical + have hS := χ.isSurface + have hvV := D.P.Γ.tilde_subset_V he hv + obtain ⟨f, hf, hfr⟩ := exists_side_of_meet D hq he heq hx hm + have hemb : ∀ {z : S}, z ∈ closure f → cap.emb z ∈ closure (D.rad.regionOf x) := fun hz ↦ by + have := image_closure_subset_closure_image cap.isEmbedding.continuous (mem_image_of_mem _ hz) + exact closure_minimal hfr isClosed_closure this + rcases D.P.Γ.size_cases he with h2 | h3 + · have hfe : f = e := by + rcases hf.2 with ⟨-, h⟩ | ⟨h, -⟩ + · exact h + · omega + subst hfe + exact hnear.of_closure_region hx hvV (hemb hv.1) + obtain ⟨a', b', hab', ha'f, hb'f, ha't, hb't, -⟩ := D.exists_side_ends hf h3 + have hoff' := hoff h3 + by_cases hva : v = a' + · subst hva + exact hnear.of_closure_region hx hvV (hemb ha'f) + by_cases hvb : v = b' + · subst hvb + exact hnear.of_closure_region hx hvV (hemb hb'f) + have hV' := D.P.Γ.tilde_subset_V he + rcases IsNear.exists_prev (k := k + 1) hnear hx with hmem | ⟨u, hu, hucl, hun⟩ + · have h₁ := (isNear_self hH hmem).of_closure_region hx (hV' ha't) (hemb ha'f) + exact (IsNear.across_side he h3 ha't hv (Ne.symm hva) h₁).mono (by omega) + · rcases D.vertex_mem_of_side hf h3 hoff' (D.rad.regionOf_mem hx).1 hfr hab' ha'f hb'f (hV' ha't) + (hV' hb't) hu hucl + with rfl | rfl + · exact IsNear.across_side he h3 ha't hv (Ne.symm hva) hun + · exact IsNear.across_side he h3 hb't hv (Ne.symm hvb) hun + +end TangleDatum + + + + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section12d.lean b/LeanPool/GraphMinor/GM19/Section12d.lean new file mode 100644 index 0000000000..34a11350f3 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section12d.lean @@ -0,0 +1,408 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section12c + +/-! +# Graph Minors XIX, Section 12: the ring around a hub + +We want a circuit of `Γ*` around the hub `H`, whose vertices of `Γ` are about `ρ` steps from `H`. +The paper builds it by +`½ρ` applications of Theorem 5.2 of XIV, along circuits of `sk(Γ)`. We use one application, to the +*ring*: the drawing +of the edges of `Γ*` from a vertex of `Γ` that is `ρ`-near `H` to a vertex of `R*` that is not `(ρ - +1)`-near `H`. + +Write `ρ = k + 3`. The *zone* holds the vertices of `Γ` that are `(k + 1)`-near `H`, and the regions +of `Γ` whose centres +are `(k + 2)`-near. Theorem 5.2 needs that each region of the ring whose closure meets the zone lies +in the disc `Λ` of +(7.1). To see this, call a region of `Γ*` *good* if it has a centre that is `(k + 2)`-near as a +corner. Then a region of +`Γ*` that is good and a region that is not cannot share a point off the ring, by the corner lemma. +So the good regions +fill the region of the ring. + +The caller may add a closed set `Y` to the zone. In (12.4) this `Y` holds an inside of a circuit +round a pole, whose cuff +may be far from `H` in steps of `Γ*`. The main result is `TangleDatum.ring_region_subset`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable (D : TangleDatum cap χ) (H : Drawing Shat) (k : ℕ) (Y : Set Shat) + +/-- The zone: the vertices of `Γ` that are `(k + 1)`-near `H`, and the regions of `Γ` with a `(k + +2)`-near centre. -/ +noncomputable def nearZone : Set Shat := + {x | x ∈ D.P.Γ.hatV cap ∧ D.IsNear H (k + 1) x} ∪ + ⋃ w ∈ {w | w ∈ D.rad.Rstar ∧ D.IsNear H (k + 2) w}, D.rad.regionOf w + +/-- A region of `Γ*` is good if it lies in `Y` or has a `(k + 2)`-near centre as a corner. -/ +def IsGood (q : Set Shat) : Prop := + q ⊆ Y ∨ ∃ w ∈ D.rad.Rstar, D.IsNear H (k + 2) w ∧ (q ∩ D.rad.regionOf w).Nonempty + +/-- The edges of the ring. -/ +def ringEdges : Set (Set Shat) := + {g | g ∈ D.rad.G.E ∧ ∃ v ∈ D.P.Γ.V, ∃ t ∈ D.rad.Rstar, closure g ∩ D.rad.G.V = {cap.emb v, t} ∧ + D.IsNear H (k + 3) (cap.emb v) ∧ ¬ D.IsNear H (k + 2) t ∧ ¬ g ⊆ Y} + +/-- The ring: the subdrawing of `Γ*` formed by the edges of the ring. -/ +noncomputable def ring : Drawing Shat := D.rad.G.span ∅ (ringEdges D H k Y) + +/-- The conditions on the set `Y`. Each point of its frontier is in the zone, and a region of `Γ*` +that meets `Y` lies +in `Y`. The last condition handles the disc edges of `Γ` with a vertex on `bd(Σ)`, to which the +fifth condition of "fit" +says nothing: if such an edge has a near corner, then its region lies in `Y` or all its ends are +near. -/ +structure IsZoneSet : Prop where + closed : IsClosed Y + meet : ∀ q ∈ D.rad.G.R, (q ∩ Y).Nonempty → q ⊆ Y + frontier_sub : frontier Y ⊆ nearZone D H k + cuff : ∀ q ∈ D.rad.G.R, ∀ e ∈ D.P.Γ.E, cap.emb '' e ⊆ q → (tilde e).ncard = 3 → + (closure e ∩ bd S).Nonempty → + ∀ w ∈ D.rad.Rstar, D.IsNear H (k + 2) w → (q ∩ D.rad.regionOf w).Nonempty → + q ⊆ Y ∨ ∀ v ∈ tilde e, D.IsNear H (k + 3) (cap.emb v) + +variable {D H k Y} + +omit [T2Space S] in +theorem mem_ring_U {x : Shat} : x ∈ (ring D H k Y).U ↔ ∃ g ∈ ringEdges D H k Y, x ∈ closure g := by + change x ∈ D.rad.G.spanU ∅ (ringEdges D H k Y) ↔ _ + constructor + · rintro ((h | h) | h) + · exact absurd h.1 (notMem_empty x) + · obtain ⟨g, hg, hx⟩ := mem_iUnion₂.mp h + exact ⟨g, hg.1, hx.1⟩ + · obtain ⟨g, hg, hx⟩ := mem_iUnion₂.mp h + exact ⟨g, hg.1, hx⟩ + · rintro ⟨g, hg, hx⟩ + exact .inr (mem_iUnion₂.mpr ⟨g, ⟨hg, hg.1⟩, hx⟩) + +omit [T2Space Shat] in +/-- A point of the zone on an edge of `Γ*` lies in the region of the near centre of this edge. -/ +theorem near_of_mem_edge {g : Set Shat} (hg : g ∈ D.rad.G.E) {t : Shat} {v : Shat} + (ht : t ∈ D.rad.Rstar) + (hv : v ∈ D.P.Γ.hatV cap) (hcap : closure g ∩ D.rad.G.V = {v, t}) {p : Shat} (hpg : p ∈ g) + (hp : p ∈ nearZone D H k) : D.IsNear H (k + 2) t := by + rcases hp with ⟨hpV, -⟩ | hp + · exact absurd (D.rad.isPreRadial.2.1 hpV) (hg.2.1 hpg).2 + · obtain ⟨w, ⟨hw, hN⟩, hpw⟩ := mem_iUnion₂.mp hp + have hc := D.rad.center_mem_closure χ.isSurface hg (D.rad.regionOf_mem hw).1 ⟨p, hpg, hpw⟩ + (D.rad.regionOf_mem hw).2 hw.1 + have hm : w ∈ closure g ∩ D.rad.G.V := ⟨hc, hw.1⟩ + rw [hcap] at hm + rcases hm with rfl | rfl + · exact absurd hv hw.2 + · exact hN + +omit [T2Space Shat] in +/-- An edge of `Γ*` with an end in `R*` that is not near, and not in `Y`, misses `Y`. -/ +theorem IsZoneSet.disjoint_edge (hY : IsZoneSet D H k Y) {g : Set Shat} + (hg : g ∈ D.rad.G.E) {t v : Shat} + (ht : t ∈ D.rad.Rstar) (hv : v ∈ D.P.Γ.hatV cap) (hcap : closure g ∩ D.rad.G.V = {v, t}) + (hnot : ¬ D.IsNear H (k + 2) t) (hgY : ¬ g ⊆ Y) : Disjoint g Y := by + have hfr : ∀ x ∈ g, x ∉ frontier Y := fun x hx hfr ↦ hnot (near_of_mem_edge hg ht hv hcap hx + (hY.frontier_sub hfr)) + rw [disjoint_left] + intro x hx hxY + have hint : ∀ y ∈ g, y ∈ Y → y ∈ interior Y := fun y hy hyY ↦ by + by_contra hn + exact hfr y hy ⟨subset_closure hyY, hn⟩ + apply hgY + have hsub : g ⊆ interior Y := IsPreconnected.subset_left_of_subset_union isOpen_interior + hY.closed.isOpen_compl + (disjoint_left.mpr fun y hy hn ↦ hn (interior_subset hy)) + (fun y hy ↦ by + by_cases h : y ∈ Y + · exact .inl (hint y hy h) + · exact .inr h) ⟨x, hx, hint x hx hxY⟩ hg.2.2.1.isConnected.isPreconnected + exact hsub.trans interior_subset + +/-- **A good region and one that is not good share no point off the ring and off `V(Γ*)`.** -/ +theorem IsZoneSet.not_clash (hY : IsZoneSet D H k Y) (hH : H.IsSubdrawing D.rad.G) {q₁ q₂ : Set + Shat} {p : Shat} + (hq₁ : q₁ ∈ D.rad.G.R) (hq₂ : q₂ ∈ D.rad.G.R) (hg₁ : IsGood D H k Y q₁) + (hg₂ : ¬ IsGood D H k Y q₂) + (hp₁ : p ∈ closure q₁) (hp₂ : p ∈ closure q₂) (hpV : p ∉ D.rad.G.V) (hpr : p ∉ + (ring D H k Y).U) : False := by + have hT := cap.isClosedSurface + have hS := χ.isSurface + have : ConnectedSpace Shat := cap.connected + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + obtain ⟨hf₁, -, hf₃⟩ := D.rad.region_facts hS D.P.fits.internally_three_connected + have hpq₁ : p ∉ q₁ := fun h ↦ by + obtain ⟨y, hy₁, hy₂⟩ := mem_closure_iff.mp hp₂ q₁ (region_isOpen hq₁) h + obtain rfl := region_eq_of_mem hq₁ hq₂ hy₁ hy₂ + exact hg₂ hg₁ + have hpU : p ∈ D.rad.G.U := (closure_region_subset hq₁ hp₁).resolve_left hpq₁ + obtain ⟨g, hg, hpg⟩ := D.rad.G.exists_edge_of_mem hpU hpV + obtain ⟨_, ⟨v, hv, rfl⟩, t, ht, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 g hg + have hgq₁ : g ⊆ closure q₁ := edge_subset_closure_of_incident hT hg hq₁ ⟨p, hpg, hp₁⟩ + have htcl : t ∈ closure g := by + have : t ∈ closure g ∩ D.rad.G.V := by + rw [hcap] + exact .inr rfl + exact this.1 + have hgt : g ⊆ D.rad.regionOf t := edge_subset_regionOf D ht hg htcl + have hnot : ¬ D.IsNear H (k + 2) t := fun hN ↦ by + obtain ⟨y, hy₁, hy₂⟩ := mem_closure_iff.mp hp₂ _ (isOpen_regionOf D ht) (hgt hpg) + exact hg₂ (.inr ⟨t, ht, hN, y, hy₂, hy₁⟩) + have hvimg : cap.emb v ∈ D.P.Γ.hatV cap := mem_image_of_mem _ hv + by_cases hgY : g ⊆ Y + · have hq₂Y : ¬ q₂ ⊆ Y := fun h ↦ hg₂ (.inl h) + have hdis : ¬ (q₂ ∩ Y).Nonempty := fun h ↦ hq₂Y (hY.meet q₂ hq₂ h) + have hfr : p ∈ frontier Y := by + refine ⟨subset_closure (hgY hpg), fun hint ↦ hdis ?_⟩ + obtain ⟨y, hy₁, hy₂⟩ := mem_closure_iff.mp hp₂ _ isOpen_interior hint + exact ⟨y, hy₂, interior_subset hy₁⟩ + exact hnot (near_of_mem_edge hg ht hvimg hcap hpg (hY.frontier_sub hfr)) + have hdis := hY.disjoint_edge hg ht hvimg hcap hnot hgY + have hv3 : ¬ D.IsNear H (k + 3) (cap.emb v) := fun hN ↦ hpr (mem_ring_U.mpr + ⟨g, ⟨hg, v, hv, t, ht, hcap, hN, hnot, hgY⟩, subset_closure hpg⟩) + have hqY : ¬ q₁ ⊆ Y := fun h ↦ disjoint_left.mp hdis hpg (closure_minimal h hY.closed hp₁) + rcases hg₁ with h | ⟨w, hw, hN, hm⟩ + · exact hqY h + obtain ⟨e, he, heq⟩ := hf₁ q₁ hq₁ + have hvcl : cap.emb v ∈ closure q₁ := by + have hve : cap.emb v ∈ closure g ∩ D.rad.G.V := by + rw [hcap] + exact .inl rfl + exact closure_minimal hgq₁ isClosed_closure hve.1 + have hve : v ∈ tilde e := ⟨hf₃ q₁ hq₁ e he heq v hv hvcl, fun h ↦ D.P.Γ.disjoint_V he h hv⟩ + by_cases hc : (tilde e).ncard = 3 ∧ (closure e ∩ bd S).Nonempty + · rcases hY.cuff q₁ hq₁ e he heq hc.1 hc.2 w hw hN hm with h | h + · exact hqY h + · exact hv3 (h v hve) + · refine hv3 (hN.of_corner hH hq₁ he heq hw hm (fun h3 ↦ ?_) hve) + exact not_nonempty_iff_eq_empty.mp fun h ↦ hc ⟨h3, h⟩ + +omit [T2Space S] [T2Space Shat] in +/-- Each point of `Σ̂` lies in an atom. -/ +theorem exists_atom_mem (D : TangleDatum cap χ) (x : Shat) : ∃ a ∈ D.P.Γ.atoms cap, x ∈ a := by + by_cases hx : x ∈ D.P.Γ.hatU cap + · obtain ⟨y, hy, rfl⟩ := hx + by_cases hyV : y ∈ D.P.Γ.V + · exact ⟨_, Or.inl (Or.inl ⟨y, hyV, rfl⟩), rfl⟩ + · obtain ⟨c, hc, hyc⟩ := exists_arcComp_superset (F := D.P.Γ.U \ D.P.Γ.V) + (isPathConnected_singleton y) (singleton_subset_iff.2 ⟨hy, hyV⟩) + exact ⟨_, Or.inl (Or.inr ⟨c, hc, rfl⟩), mem_image_of_mem _ (hyc rfl)⟩ + · exact ⟨_, Or.inr ⟨x, hx, rfl⟩, mem_connectedComponentIn hx⟩ + +/-- A walk of `Γ*` bounds the metric. The walk there and back is a closed walk through both ends. -/ +theorem dist_atomOf_le_of_walk (D : TangleDatum cap χ) {x y : Shat} (W : GraphWalk D.rad.G.toGraph + x y) + (hlt : W.length < D.rep) : D.dist (D.rad.atomOf x) (D.rad.atomOf y) ≤ W.length := by + have hlen : (W.append W.reverse).length = 2 * W.length := by + rw [GraphWalk.length_append, GraphWalk.length_reverse] + omega + obtain ⟨T, hT, hl⟩ := D.exists_closedWalkIns (W.append W.reverse) (by omega) + have hsub : ∀ z ∈ W.support, z ∈ T.ins := fun z hz ↦ by + rw [hT] + refine .inl ((walkDrawing D.rad.G _).V_subset_U ?_) + rw [walkDrawing_V] + exact (GraphWalk.mem_support_append _ _).mpr (.inl hz) + have hxG : x ∈ D.rad.G.V := W.mem_vertexSet_of_mem_support W.start_mem_support + have hyG : y ∈ D.rad.G.V := W.mem_vertexSet_of_mem_support W.end_mem_support + have := D.dist_le T ⟨x, D.mem_atomOf hxG, hsub x W.start_mem_support⟩ ⟨y, D.mem_atomOf hyG, hsub + y W.end_mem_support⟩ + omega + +/-- The closure of a region of `Γ*` is within three steps of each of its corners. -/ +theorem dist_closure_region_le (D : TangleDatum cap χ) (hrep : 4 ≤ D.rep) {q ρ a : Set Shat} + (hq : q ∈ D.rad.G.R) + (hm : (q ∩ ρ).Nonempty) (ha : (a ∩ closure q).Nonempty) : D.dist ρ a ≤ 3 := by + obtain ⟨e, he, heq⟩ := (D.rad.region_facts χ.isSurface D.P.fits.internally_three_connected).1 q hq + obtain ⟨X, hX, hl, hsX⟩ := exists_tie D hrep hq + obtain ⟨T, hTX, hTl⟩ := exists_walk_of_restraint D (by omega) hX + obtain ⟨y, hy₁, hy₂⟩ := hm + obtain ⟨b, hb₁, hb₂⟩ := ha + have := D.dist_le T (a := ρ) (b := a) ⟨y, hy₂, hTX ▸ hsX (subset_closure hy₁)⟩ ⟨b, hb₁, hTX ▸ hsX + hb₂⟩ + omega + +/-- The goodness of a region of `Γ*` puts its closure into `Λ`. -/ +theorem IsGood.closure_subset (D : TangleDatum cap χ) (hrep : 4 ≤ D.rep) {Y Λ z : Set Shat} {b : ℕ} + (hY : IsClosed Y) + (hYΛ : Y ⊆ Λ) (hΛ : ∀ x ∈ D.P.Γ.atoms cap, D.dist z x ≤ b + 3 → x ⊆ Λ) + (hnear : ∀ w ∈ D.rad.Rstar, D.IsNear H (k + 2) w → D.dist z (D.rad.regionOf w) ≤ b) + {q : Set Shat} (hq : q ∈ D.rad.G.R) (hg : IsGood D H k Y q) : closure q ⊆ Λ := by + rcases hg with h | ⟨w, hw, hN, hm⟩ + · exact (closure_minimal h hY).trans hYΛ + intro y hy + obtain ⟨a, ha, hya⟩ := exists_atom_mem D y + have h₁ := hnear w hw hN + have h₂ := dist_closure_region_le D hrep hq hm (a := a) ⟨y, hya, hy⟩ + have h₃ := D.dist_triangle hrep (a := z) (c := a) (Or.inr (D.rad.regionOf_mem hw).1) + exact hΛ a ha (by omega) hya + +/-- A vertex of `Γ` has an edge of `Γ*`. -/ +theorem exists_spoke_at (D : TangleDatum cap χ) {v : S} (hv : v ∈ D.P.Γ.V) : + ∃ g ∈ D.rad.G.E, ∃ t ∈ D.rad.Rstar, closure g ∩ D.rad.G.V = {cap.emb v, t} := by + have hTs := cap.isClosedSurface + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + obtain ⟨Sk, hSk⟩ := exists_isSkHat hS cap D.P.Γ + obtain ⟨c, hc, hvc⟩ := exists_edge_incident hS h3 D.rad hv + obtain ⟨f, hf, hvf⟩ := D.P.Γ.exists_sk_at hc ⟨hvc, fun h ↦ D.P.Γ.disjoint_V hc h hv⟩ + have hfr : ∃ r ∈ D.P.Γ.hatRegions cap, cap.emb '' f ⊆ closure r := by + rcases D.P.Γ.size_cases hc with h2 | h3' + · have hfE : cap.emb '' f ∈ Sk.E := hSk.edge_iff.mpr ⟨f, hf.mem, rfl⟩ + obtain ⟨r, hr, hsub⟩ := exists_region_incident hTs hfE + rcases hSk.region_cases hr with hhat | ⟨c', hc', h3c, hsubr⟩ + · exact ⟨r, hhat, hsub⟩ + · exfalso + have hfc : f = c := by + rcases hf.2 with ⟨-, h⟩ | ⟨h, -⟩ + · exact h + · omega + subst hfc + obtain ⟨x, hx⟩ := hc.1 + have hcl : IsClosed (cap.emb '' closure c') := (cap.isClosedEmbedding hS).isClosedMap _ + isClosed_closure + obtain ⟨x', hx', hxx⟩ := closure_minimal hsubr hcl (hsub (mem_image_of_mem _ hx)) + obtain rfl := cap.isEmbedding.injective hxx + have hxc' : x' ∈ c' := by + rcases D.P.Γ.closure_subset hc' hx' with h | h + · exact h + · exact absurd h (D.P.Γ.disjoint_V hc hx) + obtain rfl := arcComp_eq_of_mem hc hc' hx hxc' + omega + · exact hSk.exists_hatRegion_side hS hf h3' + obtain ⟨r, hr, hsub⟩ := hfr + have hvr : cap.emb v ∈ closure r := closure_minimal hsub isClosed_closure + (image_closure_subset_closure_image cap.isEmbedding.continuous (mem_image_of_mem _ hvf.1)) + obtain ⟨w, ⟨hwr, hwG⟩, -⟩ := D.rad.isPreRadial.2.2.1 r hr + have hwV : w ∉ D.P.Γ.hatV cap := fun hV ↦ by + obtain ⟨y, hy, rfl⟩ := id hr + exact (connectedComponentIn_subset _ _ hwr) (image_mono D.P.Γ.V_subset hV) + have hw : w ∈ D.rad.Rstar := ⟨hwG, hwV⟩ + have hreg : D.rad.regionOf w = r := by + obtain ⟨y, hy, rfl⟩ := id hr + exact (connectedComponentIn_eq hwr).symm + obtain ⟨e, he, hcap⟩ := D.rad.exists_spoke hS (h3.hatRegions_isOpenDisc hS cap) h3.1 hw hv + (hreg ▸ hvr) + exact ⟨e, he, w, hw, hcap⟩ + +/-- **The regions of the ring.** Let `Λ'` include the closure of each good region. Then `Λ'` +includes each region of the +ring whose closure meets the zone or `Y`. -/ +theorem IsZoneSet.ring_region_subset (hY : IsZoneSet D H k Y) (hH : H.IsSubdrawing D.rad.G) {Λ' : + Set Shat} + (hgood : ∀ q ∈ D.rad.G.R, IsGood D H k Y q → closure q ⊆ Λ') {r : Set Shat} (hr : r ∈ + (ring D H k Y).R) + (hz : (closure r ∩ (nearZone D H k ∪ Y)).Nonempty) : r ⊆ Λ' := by + have hTs := cap.isClosedSurface + have hS := χ.isSurface + have : ConnectedSpace Shat := cap.connected + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hTs + set G := D.rad.G with hGdef + have hrO : IsOpen r := region_isOpen hr + have hrU : ∀ x ∈ r, x ∉ (ring D H k Y).U := fun x hx ↦ region_subset hr hx + have hRfin : G.R.Finite := finite_R hTs G + -- A good region meets `r`. + have hreg : ∀ w ∈ D.rad.Rstar, D.IsNear H (k + 2) w → (r ∩ D.rad.regionOf w).Nonempty → + ∃ q ∈ G.R, IsGood D H k Y q ∧ (q ∩ r).Nonempty := by + rintro w hw hN ⟨y, hyr, hyw⟩ + have hO : IsOpen (r ∩ D.rad.regionOf w) := hrO.inter (isOpen_regionOf D hw) + obtain ⟨q, hq, -, u, huq, hur, huw⟩ := exists_region_near hTs G hO (subset_closure ⟨hyr, hyw⟩) + exact ⟨q, hq, .inr ⟨w, hw, hN, u, huq, huw⟩, u, huq, hur⟩ + have hzone : (closure r ∩ nearZone D H k).Nonempty → ∃ q ∈ G.R, IsGood D H k Y q ∧ + (q ∩ r).Nonempty := by + rintro ⟨z₀, hz₀, ⟨hzV, hzN⟩ | hzR⟩ + · obtain ⟨v, hv, rfl⟩ := hzV + have hnotU : cap.emb v ∉ (ring D H k Y).U := fun h ↦ by + obtain ⟨g, ⟨hg, v', hv', t, ht, hcap, -, hnot, -⟩, hx⟩ := mem_ring_U.mp h + have hm : cap.emb v ∈ closure g ∩ G.V := ⟨hx, D.rad.isPreRadial.2.1 (mem_image_of_mem _ hv)⟩ + rw [hcap] at hm + rcases hm with hm | hm + · obtain rfl := cap.isEmbedding.injective hm + have hcap' : closure g ∩ G.V = {t, cap.emb v} := by rw [hcap, pair_comm] + exact hnot (hzN.step ⟨hg, ht.1, D.rad.isPreRadial.2.1 (mem_image_of_mem _ hv'), hcap'⟩) + · exact ht.2 (hm ▸ mem_image_of_mem _ hv) + have hvr : cap.emb v ∈ r := (closure_region_subset hr hz₀).resolve_right hnotU + obtain ⟨g, hg, t, ht, hcap⟩ := exists_spoke_at D hv + have hmem : ∀ {x}, x ∈ ({cap.emb v, t} : Set Shat) → x ∈ closure g := fun {x} hx ↦ by + have : x ∈ closure g ∩ G.V := hcap ▸ hx + exact this.1 + have hcap' : closure g ∩ G.V = {t, cap.emb v} := by rw [hcap, pair_comm] + have hN : D.IsNear H (k + 2) t := + hzN.step ⟨hg, ht.1, D.rad.isPreRadial.2.1 (mem_image_of_mem _ hv), hcap'⟩ + obtain ⟨y, hyr, hyg⟩ := mem_closure_iff.mp (hmem (mem_insert _ _)) r hrO hvr + exact hreg t ht hN ⟨y, hyr, edge_subset_regionOf D ht hg (hmem (mem_insert_of_mem _ rfl)) hyg⟩ + · obtain ⟨w, ⟨hw, hN⟩, hzw⟩ := mem_iUnion₂.mp hzR + obtain ⟨y, hy₁, hy₂⟩ := mem_closure_iff.mp hz₀ _ (isOpen_regionOf D hw) hzw + exact hreg w hw hN ⟨y, hy₂, hy₁⟩ + have hkey : ∃ q ∈ G.R, IsGood D H k Y q ∧ (q ∩ r).Nonempty := by + obtain ⟨z₀, hz₀, hzz⟩ := hz + rcases hzz with hzz | hzY + · exact hzone ⟨z₀, hz₀, hzz⟩ + by_cases hfr : z₀ ∈ frontier Y + · exact hzone ⟨z₀, hz₀, hY.frontier_sub hfr⟩ + have hint : z₀ ∈ interior Y := by + by_contra hn + exact hfr ⟨subset_closure hzY, hn⟩ + obtain ⟨q, hq, hzq, u, huq, hur⟩ := exists_region_near hTs G hrO hz₀ + obtain ⟨y, hy₁, hy₂⟩ := mem_closure_iff.mp hzq _ isOpen_interior hint + exact ⟨q, hq, .inl (hY.meet q hq ⟨y, hy₂, interior_subset hy₁⟩), u, huq, hur⟩ + -- the two closed sets + let T : Set Shat := r \ G.V + have hTc : IsPreconnected T := GM11.isPreconnected_sdiff_finite hTs hrO + (region_isPreconnected hr) G.finite_V + let 𝒜 : Set (Set Shat) := {q | q ∈ G.R ∧ IsGood D H k Y q} + let ℬ : Set (Set Shat) := {q | q ∈ G.R ∧ ¬ IsGood D H k Y q} + let A : Set Shat := ⋃ q ∈ 𝒜, closure q + let B : Set Shat := ⋃ q ∈ ℬ, closure q + have h𝒜fin : 𝒜.Finite := hRfin.subset fun _ h => h.1 + have hℬfin : ℬ.Finite := hRfin.subset fun _ h => h.1 + have hAc : IsClosed A := h𝒜fin.isClosed_biUnion fun _ _ => isClosed_closure + have hBc : IsClosed B := hℬfin.isClosed_biUnion fun _ _ => isClosed_closure + have hcover : ∀ x, x ∈ A ∪ B := fun x ↦ by + obtain ⟨q, hq, hx, -⟩ := exists_region_near hTs G isOpen_univ (x := x) (by simp) + by_cases hg : IsGood D H k Y q + · exact .inl (mem_iUnion₂.mpr ⟨q, ⟨hq, hg⟩, hx⟩) + · exact .inr (mem_iUnion₂.mpr ⟨q, ⟨hq, hg⟩, hx⟩) + obtain ⟨q₀, hq₀, hg₀, y₀, hy₀q, hy₀r⟩ := hkey + have hTA : (T ∩ A).Nonempty := + ⟨y₀, ⟨hy₀r, fun h ↦ region_subset hq₀ hy₀q (G.V_subset_U h)⟩, mem_iUnion₂.mpr ⟨q₀, ⟨hq₀, hg₀⟩, + subset_closure hy₀q⟩⟩ + have hnoB : ¬ (T ∩ B).Nonempty := fun hTB ↦ by + obtain ⟨p, hpT, hpA, hpB⟩ := isPreconnected_closed_iff.mp hTc A B hAc hBc + (fun x _ ↦ hcover x) hTA hTB + obtain ⟨q₁, ⟨h₁, h₁g⟩, hp₁⟩ := mem_iUnion₂.mp hpA + obtain ⟨q₂, ⟨h₂, h₂g⟩, hp₂⟩ := mem_iUnion₂.mp hpB + exact hY.not_clash hH h₁ h₂ h₁g h₂g hp₁ hp₂ hpT.2 (hrU p hpT.1) + intro p hp + obtain ⟨q, hq, hpq, y, hyq, hyr⟩ := exists_region_near hTs G hrO (subset_closure hp) + have hyT : y ∈ T := ⟨hyr, fun h ↦ region_subset hq hyq (G.V_subset_U h)⟩ + have hqg : IsGood D H k Y q := by + rcases hcover y with hyA | hyB + · obtain ⟨q₁, ⟨h₁, h₁g⟩, hy₁⟩ := mem_iUnion₂.mp hyA + obtain ⟨u, hu₁, hu₂⟩ := mem_closure_iff.mp hy₁ q (region_isOpen hq) hyq + obtain rfl := region_eq_of_mem hq h₁ hu₁ hu₂ + exact h₁g + · exact absurd ⟨y, hyT, hyB⟩ hnoB + exact hgood q hq hqg hpq + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section12e.lean b/LeanPool/GraphMinor/GM19/Section12e.lean new file mode 100644 index 0000000000..37ace18c1c --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section12e.lean @@ -0,0 +1,660 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section12d +public import LeanPool.GraphMinor.GM19.Section10d + +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Graph Minors XIX, Section 12: (12.1), the wheel around a hub + +From the ring of `Section12d` we get a circuit of `Γ*` around the zone. Among all circuits of `Γ*` +in the closed disc of +(7.1), around the zone, with all vertices of `Γ` near, we take one with a maximal disc. As in the +paper, the maximality +gives the second condition in the definition of a wheel. + +The paper states (12.1) for `ρ ≥ 2`, and its last step asks for a circuit `F` with `U(F) ∩ V(Γ) ⊆ +V(C_{ρ/2})` that bounds +a disc. Such a circuit need not exist, and (12.1) as printed fails for `ρ = 2`: let `H = {r*}`, +where `r` is a region +with `rBar ∩ V(Γ) = {a, b}` that shares a side with a triangle `abc`. Then the only vertices of `Γ` +near `H` are `a, b`, +and a circuit around them must pass `c`. So `TangleDatum.exists_wheel` asks for `ρ ≥ 3` and for the +set `Y` of +`Section12d`, and its bound on `rep(𝒯)` is `5ρ + 14`. The paper uses (12.1) only with `ρ ≥ 8`, in +(12.4). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- **A chord of a circuit bounding a disc.** Let `F` be a circuit of `G` bounding a disc `W ⊆ Δ`, +and let `P` be a path of +`G` in `Δ` between two vertices of `F`, that meets `W` only in its ends. Then a circuit in `P ∪ F` +bounds a bigger disc +in `Δ`. -/ +theorem exists_larger_circuit {T : Type} [TopologicalSpace T] [T2Space T] + (hT : IsClosedSurface T) {G F P : Drawing T} + {Δ W : Set T} {u v : T} (hΔ : IsClosedDisc Δ) (hW : IsClosedDisc W) (hWΔ : W ⊆ Δ) + (hF : F.IsCircuitOf G) + (hbd : discBd W = F.U) (hu : u ∈ F.V) (hv : v ∈ F.V) (huv : u ≠ v) (hP : P.IsPathOf G u v) + (hPΔ : P.U ⊆ Δ) + (hPW : P.U ∩ W = {u, v}) : + ∃ (F' : Drawing T) (W' : Set T), F'.IsCircuitOf G ∧ W' ⊆ Δ ∧ IsClosedDisc W' ∧ W ⊂ W' + ∧ discBd W' = F'.U ∧ + F'.U ⊆ P.U ∪ F.U ∧ F'.V ⊆ P.V ∪ F.V := by + obtain ⟨F₁, F₂, hF₁, hF₂, hs₁, hs₂, hp₁, hp₂, hV₁₂, hE₁₂, hsup⟩ := hF.2.exists_two_paths hu hv huv + have hFW : F.U ⊆ W := hbd ▸ Surface.discBd_subset W + have hsplit : TwoPaths G F F₁ F₂ P u v := by + refine ⟨huv, hF.1, ⟨hs₁, hF₁⟩, ⟨hs₂, hF₂⟩, ?_, ?_, hV₁₂.le, hE₁₂, hP, ?_, ?_⟩ + · have := Drawing.sup_V hs₁ hs₂ + rwa [hsup] at this + · have := Drawing.sup_E hs₁ hs₂ + rwa [hsup] at this + · rintro x ⟨hxP, hxF⟩ + rw [← hPW] + exact ⟨P.V_subset_U hxP, hFW (F.V_subset_U hxF)⟩ + · refine disjoint_left.mpr fun e heP heF ↦ ?_ + obtain ⟨x, hx⟩ := (hP.1.2 heP).1 + have hxP : x ∈ P.U ∩ W := by + refine ⟨?_, hFW ?_⟩ + · rw [P.U_eq] + exact .inr (mem_iUnion₂.mpr ⟨e, heP, subset_closure hx⟩) + · rw [F.U_eq] + exact .inr (mem_iUnion₂.mpr ⟨e, heF, subset_closure hx⟩) + rw [hPW] at hxP + have hxV : x ∈ G.V := by + rcases hxP with rfl | rfl + · exact hF.1.1 hu + · exact hF.1.1 hv + exact ((hP.1.2 heP).2.1 hx).2 hxV + have hL := isLine_of_isPathBetween hP.2 huv + have hA := isLine_of_isPathBetween hF₁ huv + have hB := isLine_of_isPathBetween hF₂ huv + have hAB : F₁.U ∪ F₂.U = discBd W := by rw [hbd, hsplit.U_eq] + have hAB' : F₁.U ∩ F₂.U = {u, v} := by + rw [U_inter_of_disjoint hs₁ hs₂ hE₁₂, hV₁₂] + obtain ⟨W', hW'Δ, hW', hlt, hb⟩ := exists_larger_disc hT hΔ hW hWΔ hPΔ hA hB hL hAB hAB' hPW + rcases hb with hb | hb + · refine ⟨G.sup P F₁, W', ⟨Drawing.sup_isSubdrawing _ _ _, hsplit.swap.left_circuit⟩, hW'Δ, + hW', hlt, ?_, ?_, ?_⟩ + · rw [hsplit.swap.U_right, hb] + · rw [hsplit.swap.U_right] + exact union_subset_union_right _ (hsplit.U_eq ▸ subset_union_left) + · rw [Drawing.sup_V hP.1 hsplit.sub₁] + exact union_subset_union_right _ hs₁.1 + · refine ⟨G.sup P F₂, W', ⟨Drawing.sup_isSubdrawing _ _ _, hsplit.left_circuit⟩, hW'Δ, hW', + hlt, ?_, ?_, ?_⟩ + · rw [hsplit.U_right, hb] + · rw [hsplit.U_right] + exact union_subset_union_right _ (hsplit.U_eq ▸ subset_union_right) + · rw [Drawing.sup_V hP.1 hsplit.sub₂] + exact union_subset_union_right _ hs₂.1 + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {H : Drawing Shat} {k : ℕ} {Y : Set Shat} {x : Shat} + +omit [T2Space S] [T2Space Shat] in +/-- The first step of a walk from a vertex to `V(H)`. -/ +theorem IsNear.exists_next (h : D.IsNear H (k + 1) x) : + x ∈ H.V ∨ ∃ (g : Set Shat) (t : Shat), D.rad.G.toGraph.IsLink g x t ∧ D.IsNear H k t := by + obtain ⟨h, hh, W, hW⟩ := h + cases W with + | nil _ => exact .inl hh + | @cons _ u _ e hl r => + rw [GraphWalk.length_cons] at hW + exact .inr ⟨e, u, hl, h, hh, r, by omega⟩ + +omit [T2Space Shat] in +/-- The zone includes `U(H)`. -/ +theorem subset_nearZone (hH : H.IsSubdrawing D.rad.G) : H.U ⊆ nearZone D H k := by + have hV : ∀ x ∈ H.V, x ∈ nearZone D H k := fun x hx ↦ by + by_cases hxV : x ∈ D.P.Γ.hatV cap + · exact .inl ⟨hxV, (isNear_self hH hx).mono (by omega)⟩ + · have hw : x ∈ D.rad.Rstar := ⟨hH.1 hx, hxV⟩ + exact .inr (mem_iUnion₂.mpr ⟨x, ⟨hw, (isNear_self hH hx).mono (by omega)⟩, + (D.rad.regionOf_mem hw).2⟩) + intro x hx + by_cases hxV : x ∈ H.V + · exact hV x hxV + obtain ⟨e, he, hxe⟩ := H.exists_edge_of_mem hx hxV + obtain ⟨_, -, t, ht, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 e (hH.2 he) + have hm : t ∈ closure e ∩ D.rad.G.V := by + rw [hcap] + exact .inr rfl + have hc : t ∈ closure e ∩ H.V := (hH.closure_inter_V he).symm ▸ hm + exact .inr (mem_iUnion₂.mpr ⟨t, ⟨ht, (isNear_self hH hc.2).mono (by omega)⟩, + edge_subset_regionOf D ht (hH.2 he) hm.1 hxe⟩) + +/-- The ends of an edge of `Γ*` are the points of `eTilde`. -/ +theorem closure_inter_V_eq_tilde {T : Type} [TopologicalSpace T] [T2Space T] {G : Drawing T} {e : + Set T} (he : e ∈ G.E) : + closure e ∩ G.V = tilde e := by + ext y + constructor + · rintro ⟨hy, hV⟩ + exact ⟨hy, fun h ↦ (he.2.1 h).2 hV⟩ + · rintro ⟨hy, hn⟩ + refine ⟨hy, ?_⟩ + rcases closure_edge_subset he hy with h | h + · exact absurd h hn + · exact h + +omit [T2Space S] [T2Space Shat] in +/-- The end of an edge of `Γ*` other than a vertex of `Γ` lies in `R*`. -/ +theorem other_end_mem_Rstar (D : TangleDatum cap χ) {g : Set Shat} (hg : g ∈ D.rad.G.E) {p q : Shat} + (hcap : closure g ∩ D.rad.G.V = {p, q}) (hp : p ∈ D.P.Γ.hatV cap) : q ∈ D.rad.Rstar := by + obtain ⟨a, ha, t, ht, hcap'⟩ := D.rad.isPreRadial.2.2.2.2.1 g hg + rw [hcap] at hcap' + have h₁ : t ∈ ({p, q} : Set Shat) := hcap'.symm ▸ mem_insert_of_mem _ rfl + rcases h₁ with rfl | rfl + · exact absurd hp ht.2 + · exact ht + +omit [T2Space S] [T2Space Shat] in +/-- The atom of a vertex of `R*`. -/ +theorem atomOf_Rstar (D : TangleDatum cap χ) {w : Shat} (hw : w ∈ D.rad.Rstar) : D.rad.atomOf w + = D.rad.regionOf w := by + classical + unfold RadialDrawing.atomOf + rw [ite_eq_right hw.2] + +/-- The vertices of a circuit in a disc around the zone. -/ +structure IsRingDisc (D : TangleDatum cap χ) (H : Drawing Shat) (k : ℕ) (Y Δ W : Set Shat) + (F : Drawing Shat) : Prop where + circuit : F.IsCircuitOf D.rad.G + disc : IsClosedDisc W + sub : W ⊆ Δ + bd : discBd W = F.U + zone : nearZone D H k ∪ Y ⊆ W \ F.U + near : ∀ x ∈ F.V, x ∈ D.P.Γ.hatV cap → D.IsNear H (k + 3) x + +private theorem two_boundary_neighbors_force_vertex_inside_wheel + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [TopologicalSpace Shat] + [T2Space Shat] + {α : Type w} + {cap : IsCappedSurface S Shat} + {χ : ColourScheme S α} + {D : TangleDatum cap χ} + {H : Drawing Shat} + {k : ℕ} + {Y : Set Shat} + (Δ : Set Shat) + (W : Set Shat) + (F : Drawing Shat) + (hF : D.IsRingDisc H k Y Δ W F) + (hgrow : ∀ {P : Drawing Shat} {u v : Shat}, u ∈ F.V → v ∈ F.V → u ≠ v → P.IsPathOf (D.rad.G) u + v → P.U ⊆ Δ → P.U ∩ W = {u, v} → (∀ x ∈ P.V, x ∈ Painting.hatV cap D.P.Γ → x ∈ F.V) → False) + (hside : ∀ g ∈ Drawing.E (D.rad.G), g ⊆ W ∨ Disjoint g W) + (hmemF : ∀ {x : Shat}, x ∈ discBd W → x ∈ (D.rad.G).V → x ∈ F.V) + (hedgeΔ : ∀ {g : Set Shat} {p t : Shat}, g ∈ Drawing.E (D.rad.G) → closure g ∩ (D.rad.G).V = + {p, t} → p ∈ F.V → p ∈ Painting.hatV cap D.P.Γ → closure g ⊆ Δ) + (hTV : ∀ {g : Set Shat} {a b : Shat}, g ∈ Drawing.E (D.rad.G) → tilde g = {a, b} → closure g ∩ + (D.rad.G).V = {a, b}) : + ∀ x ∈ D.rad.G.V, ∀ v₁ ∈ cap.emb '' D.Γ.V ∩ discBd W, ∀ v₂ ∈ cap.emb '' D.Γ.V ∩ discBd + W, v₁ ≠ v₂ → (∃ e₁ ∈ Drawing.E D.rad.G, tilde e₁ = {x, v₁}) → (∃ e₂ ∈ Drawing.E + D.rad.G, tilde e₂ = {x, v₂}) → x ∈ W := by + classical + let G := D.rad.G + -- a vertex of `Γ*` with two neighbours in `V(Γ) ∩ bd(W)` lies in `W` + rintro x hx v₁ ⟨hv₁V, hv₁b⟩ v₂ ⟨hv₂V, hv₂b⟩ hne ⟨e₁, he₁, ht₁⟩ ⟨e₂, he₂, ht₂⟩ + by_contra hxW + have hc₁ : closure e₁ ∩ G.V = {x, v₁} := hTV he₁ ht₁ + have hc₂ : closure e₂ ∩ G.V = {x, v₂} := hTV he₂ ht₂ + have hxv₁ : x ≠ v₁ := fun h ↦ hxW (h ▸ Surface.discBd_subset W hv₁b) + have hxv₂ : x ≠ v₂ := fun h ↦ hxW (h ▸ Surface.discBd_subset W hv₂b) + have hF₁ := hmemF hv₁b (D.rad.isPreRadial.2.1 hv₁V) + have hF₂ := hmemF hv₂b (D.rad.isPreRadial.2.1 hv₂V) + have hc₁' : closure e₁ ∩ G.V = {v₁, x} := by rw [hc₁, pair_comm] + have hc₂' : closure e₂ ∩ G.V = {v₂, x} := by rw [hc₂, pair_comm] + have hxmem : x ∈ closure e₁ := by + have : x ∈ closure e₁ ∩ G.V := by + rw [hc₁] + exact .inl rfl + exact this.1 + have hxmem₂ : x ∈ closure e₂ := by + have : x ∈ closure e₂ ∩ G.V := by + rw [hc₂] + exact .inl rfl + exact this.1 + have hedge : ∀ {e : Set Shat}, e ∈ G.E → x ∈ closure e → Disjoint e W := fun {e} he hm ↦ by + rcases hside e he with h | h + · exact absurd (closure_minimal h hF.disc.isClosed hm) hxW + · exact h + let Q : GraphWalk G.toGraph v₁ v₂ := + .cons (e := e₁) ⟨he₁, D.rad.isPreRadial.2.1 hv₁V, hx, hc₁'⟩ + (.cons (e := e₂) ⟨he₂, hx, D.rad.isPreRadial.2.1 hv₂V, hc₂⟩ (.nil + (D.rad.isPreRadial.2.1 hv₂V))) + have hQs : Q.IsSimple := by + change [v₁, x, v₂].Nodup + simp [hne, hxv₁.symm, hxv₂] + have hQU : (walkDrawing G Q).U = closure e₁ ∪ closure e₂ := by + ext y + rw [mem_walkDrawing_U] + change (y ∈ [v₁, x, v₂] ∨ ∃ e ∈ [e₁, e₂], y ∈ closure e) ↔ _ + have hv₁c : v₁ ∈ closure e₁ := by + have : v₁ ∈ closure e₁ ∩ G.V := by + rw [hc₁] + exact .inr rfl + exact this.1 + have hv₂c : v₂ ∈ closure e₂ := by + have : v₂ ∈ closure e₂ ∩ G.V := by + rw [hc₂] + exact .inr rfl + exact this.1 + simp only [List.mem_cons, List.not_mem_nil, or_false, exists_eq_or_imp, exists_eq_left] + constructor + · rintro ((rfl | rfl | rfl) | h) + · exact .inl hv₁c + · exact .inl hxmem + · exact .inr hv₂c + · exact h + · exact .inr + refine hgrow (P := walkDrawing G Q) hF₁ hF₂ hne ⟨walkDrawing_isSubdrawing _ _, + walkDrawing_isPathBetween _ hQs⟩ ?_ ?_ ?_ + · rw [hQU] + exact union_subset (hedgeΔ he₁ hc₁' hF₁ hv₁V) (hedgeΔ he₂ hc₂' hF₂ hv₂V) + · rw [hQU] + have hpart : ∀ {e : Set Shat} {v : Shat}, e ∈ G.E → closure e ∩ G.V = {x, v} → x ∈ closure e → + ∀ y ∈ closure e, y ∈ W → y = v := fun {e v} he hc hm y hy hyW ↦ by + rcases closure_edge_subset he hy with h | h + · exact absurd hyW (disjoint_left.mp (hedge he hm) h) + · have : y ∈ closure e ∩ G.V := ⟨hy, h⟩ + rw [hc] at this + rcases this with rfl | rfl + · exact absurd hyW hxW + · rfl + ext y + constructor + · rintro ⟨h | h, hyW⟩ + · exact .inl (hpart he₁ hc₁ hxmem y h hyW) + · exact .inr (hpart he₂ hc₂ hxmem₂ y h hyW) + · rintro (rfl | rfl) + · have : y ∈ closure e₁ ∩ G.V := by + rw [hc₁] + exact .inr rfl + exact ⟨.inl this.1, Surface.discBd_subset W hv₁b⟩ + · have : y ∈ closure e₂ ∩ G.V := by + rw [hc₂] + exact .inr rfl + exact ⟨.inr this.1, Surface.discBd_subset W hv₂b⟩ + · intro y hy hyV + rw [walkDrawing_V] at hy + change y ∈ [v₁, x, v₂] at hy + simp only [List.mem_cons, List.not_mem_nil, or_false] at hy + rcases hy with rfl | rfl | rfl + · exact hF₁ + · exact absurd hyV (other_end_mem_Rstar D he₁ hc₁' hv₁V).2 + · exact hF₂ + +private theorem edge_with_both_ends_on_wheel_boundary_lies_inside + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [TopologicalSpace Shat] + [T2Space Shat] + {α : Type w} + {cap : IsCappedSurface S Shat} + {χ : ColourScheme S α} + {D : TangleDatum cap χ} + (Δ : Set Shat) + (W : Set Shat) + (F : Drawing Shat) + (hgrow : ∀ {P : Drawing Shat} {u v : Shat}, u ∈ F.V → v ∈ F.V → u ≠ v → P.IsPathOf (D.rad.G) u + v → P.U ⊆ Δ → P.U ∩ W = {u, v} → (∀ x ∈ P.V, x ∈ Painting.hatV cap D.P.Γ → x ∈ F.V) → False) + (hside : ∀ g ∈ Drawing.E (D.rad.G), g ⊆ W ∨ Disjoint g W) + (hmemF : ∀ {x : Shat}, x ∈ discBd W → x ∈ (D.rad.G).V → x ∈ F.V) + (hedgeΔ : ∀ {g : Set Shat} {p t : Shat}, g ∈ Drawing.E (D.rad.G) → closure g ∩ (D.rad.G).V = + {p, t} → p ∈ F.V → p ∈ Painting.hatV cap D.P.Γ → closure g ⊆ Δ) : + ∀ e ∈ Drawing.E D.rad.G, tilde e ⊆ discBd W → e ⊆ W := by + classical + let G := D.rad.G + -- `W` includes each edge of `Γ*` with both ends in `bd(W)` + intro g hg htg + rcases hside g hg with h | hdis + · exact h + exfalso + obtain ⟨_, ⟨v, hv, rfl⟩, t, ht, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 g hg + have hvV : cap.emb v ∈ D.P.Γ.hatV cap := mem_image_of_mem _ hv + have hmem₁ : cap.emb v ∈ closure g ∩ G.V := by + rw [hcap] + exact .inl rfl + have hmem₂ : t ∈ closure g ∩ G.V := by + rw [hcap] + exact .inr rfl + have hb₁ : cap.emb v ∈ discBd W := htg (closure_inter_V_eq_tilde hg ▸ hmem₁) + have hb₂ : t ∈ discBd W := htg (closure_inter_V_eq_tilde hg ▸ hmem₂) + have hne : cap.emb v ≠ t := fun h ↦ ht.2 (h ▸ hvV) + let Q : GraphWalk G.toGraph (cap.emb v) t := + .cons (e := g) ⟨hg, hmem₁.2, hmem₂.2, hcap⟩ (.nil hmem₂.2) + have hQs : Q.IsSimple := by + change [cap.emb v, t].Nodup + simp [hne] + have hQU : (walkDrawing G Q).U = closure g := by + ext y + rw [mem_walkDrawing_U] + change (y ∈ [cap.emb v, t] ∨ ∃ e ∈ [g], y ∈ closure e) ↔ _ + simp only [List.mem_cons, List.not_mem_nil, or_false, exists_eq_left] + constructor + · rintro ((rfl | rfl) | h) + · exact hmem₁.1 + · exact hmem₂.1 + · exact h + · exact .inr + have hF₁ := hmemF hb₁ hmem₁.2 + refine hgrow (P := walkDrawing G Q) hF₁ (hmemF hb₂ hmem₂.2) hne ⟨walkDrawing_isSubdrawing _ _, + walkDrawing_isPathBetween _ hQs⟩ ?_ ?_ ?_ + · rw [hQU] + exact hedgeΔ hg hcap hF₁ hvV + · rw [hQU] + ext y + constructor + · rintro ⟨hy, hyW⟩ + rcases closure_edge_subset hg hy with h | h + · exact absurd hyW (disjoint_left.mp hdis h) + · rw [← hcap] + exact ⟨hy, h⟩ + · rintro (rfl | rfl) + · exact ⟨hmem₁.1, Surface.discBd_subset W hb₁⟩ + · exact ⟨hmem₂.1, Surface.discBd_subset W hb₂⟩ + · intro y hy hyV + rw [walkDrawing_V] at hy + change y ∈ [cap.emb v, t] at hy + simp only [List.mem_cons, List.not_mem_nil, or_false] at hy + rcases hy with rfl | rfl + · exact hF₁ + · exact absurd hyV ht.2 + +private theorem wheel_contains_near_vertices + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [T2Space S] + [TopologicalSpace Shat] + [T2Space Shat] + {α : Type w} + {cap : IsCappedSurface S Shat} + {χ : ColourScheme S α} + {D : TangleDatum cap χ} + {H : Drawing Shat} + {k : ℕ} + {Y : Set Shat} + (Δ : Set Shat) + (W : Set Shat) + (F : Drawing Shat) + (hF : D.IsRingDisc H k Y Δ W F) + (hint : (D.nearZone H k ∪ Y) ⊆ W \ discBd W) + (hHint : H.U ⊆ W \ discBd W) : + ∀ v ∈ cap.emb '' D.Γ.V, (∃ P : Drawing Shat, ∃ h ∈ H.V, P.IsPathOf D.rad.G v h ∧ + (Drawing.E P).ncard ≤ k + 3) → v ∈ W := by + classical + let G := D.rad.G + let Z := D.nearZone H k ∪ Y + -- `W` contains the vertices of `Γ` within `ρ` steps of `H` + rintro v hv ⟨P, h, hh, hP, hle⟩ + have hN : D.IsNear H (k + 3) v := isNear_iff_exists_path.mpr ⟨P, h, hh, hP, hle⟩ + rcases IsNear.exists_next (k := k + 2) hN with hm | ⟨g, t, hl, hNt⟩ + · exact (hHint (H.V_subset_U hm)).1 + · have ht : t ∈ D.rad.Rstar := other_end_mem_Rstar D hl.1 hl.2.2.2 hv + have hvg : v ∈ closure g := by + have : v ∈ closure g ∩ G.V := by + rw [hl.2.2.2] + exact .inl rfl + exact this.1 + have htg : t ∈ closure g := by + have : t ∈ closure g ∩ G.V := by + rw [hl.2.2.2] + exact .inr rfl + exact this.1 + have hsub : D.rad.regionOf t ⊆ W := fun y hy ↦ + (hint (.inl (.inr (mem_iUnion₂.mpr ⟨t, ⟨ht, hNt⟩, hy⟩)))).1 + exact closure_minimal ((edge_subset_regionOf D ht hl.1 htg).trans hsub) hF.disc.isClosed hvg + +private theorem wheel_boundary_path_bounds + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [TopologicalSpace Shat] + [T2Space Shat] + {α : Type w} + {cap : IsCappedSurface S Shat} + {χ : ColourScheme S α} + {D : TangleDatum cap χ} + {H : Drawing Shat} + {k : ℕ} + {Y : Set Shat} + (Δ : Set Shat) + (W : Set Shat) + (F : Drawing Shat) + (hF : D.IsRingDisc H k Y Δ W F) + (hmemF : ∀ {x : Shat}, x ∈ discBd W → x ∈ (D.rad.G).V → x ∈ F.V) + (hint : (D.nearZone H k ∪ Y) ⊆ W \ discBd W) : + ∀ v ∈ cap.emb '' D.Γ.V ∩ discBd W, (∃ P : Drawing Shat, ∃ h ∈ H.V, P.IsPathOf D.rad.G + v h ∧ (Drawing.E P).ncard ≤ k + 3) ∧ ¬∃ P : Drawing Shat, ∃ h ∈ H.V, P.IsPathOf + D.rad.G v h ∧ (Drawing.E P).ncard + 2 ≤ k + 3 := by + classical + let G := D.rad.G + let Z := D.nearZone H k ∪ Y + -- the vertices of `Γ` on `bd(W)` are about `ρ` steps from `H` + rintro v ⟨hvV, hvb⟩ + have hvF := hmemF hvb (D.rad.isPreRadial.2.1 hvV) + refine ⟨isNear_iff_exists_path.mp (hF.near v hvF hvV), ?_⟩ + rintro ⟨P, h, hh, hP, hle⟩ + have hN : D.IsNear H (k + 1) v := isNear_iff_exists_path.mpr ⟨P, h, hh, hP, by omega⟩ + exact (hint (.inl (.inl ⟨hvV, hN⟩))).2 hvb + +/-- The strengthened form of XIX (12.1) (page 362). Let `ρ = k + 3` and +`rep(𝒯) ≥ 5ρ + 14`, and let `H` be a nonempty subdrawing of `Γ*` +satisfying the third +condition in the definition of a wheel, with any two vertices at distance at most `2ρ + 2`. Let `Y` +be as in `IsZoneSet`, +at distance at most `3ρ + 4`. Then there is a wheel `W` with `W`-hub `H` of radius `ρ`, and with the +zone and `Y` in +its interior. -/ +theorem exists_wheel (hrep : 5 * (k + 3) + 14 ≤ D.rep) + (hH : H.IsSubdrawing D.rad.G) {z : Shat} (hz : z ∈ H.V) + (hY : IsZoneSet D H k Y) (hconn : IsPreconnected (nearZone D H k ∪ Y)) + (hdiam : ∀ h ∈ H.V, D.dist (D.rad.atomOf z) (D.rad.atomOf h) ≤ 2 * (k + 3) + 2) + (hYd : ∀ a ∈ D.P.Γ.atoms cap, (a ∩ Y).Nonempty → D.dist (D.rad.atomOf z) a ≤ 3 * (k + 3) + 4) + (hhub : (H.V.ncard = 1 ∧ H.E = ∅ ∧ + ∀ H' : Drawing Shat, IsEnclave D.tb D.ord D.𝒯 H' → H'.E.ncard ≤ 4 * (k + 3) + 4 → + ¬ (H.V ⊆ D.ins H' \ H'.U)) ∨ + (IsEnclave D.tb D.ord D.𝒯 H ∧ H.E.ncard ≤ 4 * (k + 3) + 4 ∧ + ∀ H' : Drawing Shat, IsEnclave D.tb D.ord D.𝒯 H' → H' ≠ H → H'.E.ncard ≤ 4 * (k + 3) + 4 → + ¬ (H.U ⊆ D.ins H'))) : + ∃ W, D.IsWheelHubOfRadius W H (k + 3) ∧ nearZone D H k ∪ Y ⊆ W \ discBd W ∧ + ∀ p ∈ W, ∃ a ∈ D.P.Γ.atoms cap, p ∈ a ∧ D.dist (D.rad.atomOf z) a ≤ 3 * (k + 3) + 11 := by + classical + have hT := cap.isClosedSurface + have hS := χ.isSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + set G := D.rad.G with hGdef + have hr4 : 4 ≤ D.rep := by omega + have hzG : z ∈ G.V := hH.1 hz + obtain ⟨Sk, hSk⟩ := exists_isSkHat hS cap D.P.Γ + obtain ⟨C₀, Λ, -, -, -, hΛc, hsb, hdiff, -, hfar, -, hclose, hins⟩ := + theorem_7_1_proof D (D.atomOf_mem hzG) (κ := 3 * (k + 3) + 6) (by omega) (by omega) hSk + have hclose' : ∀ x ∈ D.P.Γ.atoms cap, D.dist (D.rad.atomOf z) x ≤ 3 * (k + 3) + 4 → x ⊆ Λ + := fun x hx hd ↦ + hclose x hx (by omega) + -- the metric bound for near vertices + have hd : ∀ {j : ℕ} {x : Shat}, j ≤ k + 4 → D.IsNear H j x → D.dist (D.rad.atomOf z) + (D.rad.atomOf x) ≤ 2 * (k + 3) + 2 + j := by + rintro j x hj ⟨h, hh, W, hW⟩ + have h₁ := D.dist_atomOf_le_of_walk W (by omega) + have h₂ := hdiam h hh + have h₃ := D.dist_triangle hr4 (a := D.rad.atomOf z) (c := D.rad.atomOf x) (D.atomOf_mem + (hH.1 hh)) + rw [D.dist_comm (D.rad.atomOf h) (D.rad.atomOf x)] at h₃ + omega + have hNΛ : ∀ {j : ℕ} {x : Shat}, j ≤ k + 4 → D.IsNear H j x → D.rad.atomOf x ⊆ Λ := fun hj hN ↦ + hclose' _ (D.atomOf_mem (hN.mem_V)) ((hd hj hN).trans (by omega)) + have hYΛ : Y ⊆ Λ := fun y hy ↦ by + obtain ⟨a, ha, hya⟩ := exists_atom_mem D y + exact hclose' a ha (hYd a ha ⟨y, hya, hy⟩) hya + have hzoneΛ : nearZone D H k ⊆ Λ := by + rintro x (⟨hxV, hN⟩ | hx) + · have hm := D.mem_atomOf (hN.mem_V) + exact hNΛ (by omega) hN hm + · obtain ⟨w, ⟨hw, hN⟩, hxw⟩ := mem_iUnion₂.mp hx + have := hNΛ (by omega) hN + rw [atomOf_Rstar D hw] at this + exact this hxw + have hgood : ∀ q ∈ G.R, IsGood D H k Y q → closure q ⊆ Λ := fun q hq hg ↦ by + refine IsGood.closure_subset (b := 3 * (k + 3) + 1) D hr4 hY.closed hYΛ + (fun x hx hdx ↦ hclose' x hx (by omega)) (fun w hw hN ↦ ?_) hq hg + have := hd (by omega) hN + rw [atomOf_Rstar D hw] at this + omega + have hsubΛ : Λ = closure Λ \ subBd (closure Λ) := by rw [hsb, hdiff] + have hzZ : z ∈ nearZone D H k ∪ Y := .inl (subset_nearZone hH (H.V_subset_U hz)) + obtain ⟨C₁, Λ₁, hC₁s, hC₁, -, -, hΛ₁, hΛ₁c, -, hsb₁, hdiff₁, hZ₁, -⟩ := + GM14.theorem_5_2_full hT (ring D H k Y) hΛc ⟨z, hzZ⟩ hconn fun r hr hm ↦ by + rw [← hsubΛ] + exact hY.ring_region_subset hH hgood hr hm + set Z := nearZone D H k ∪ Y with hZdef + set Δ := closure Λ with hΔdef + have hC₁G : Drawing.IsCircuitOf C₁ G := ⟨hC₁s.trans (Drawing.span_isSubdrawing _ _ _), hC₁⟩ + have hbd₁ : discBd (closure Λ₁) = C₁.U := by + rw [← IsClosedDisc.frontier_eq_discBd hT hΛ₁c, subBd_eq_frontier', hsb₁] + have hfirst : IsRingDisc D H k Y Δ (closure Λ₁) C₁ := by + refine ⟨hC₁G, hΛ₁c, hΛ₁, hbd₁, ?_, ?_⟩ + · rw [hdiff₁] + exact hZ₁ + · intro x hx hxV + have hxr : x ∈ (ring D H k Y).U := (ring D H k Y).V_subset_U (hC₁s.1 hx) + obtain ⟨g, ⟨hg, v, hv, t, ht, hcap, hN, -, -⟩, hxg⟩ := mem_ring_U.mp hxr + have hm : x ∈ closure g ∩ G.V := ⟨hxg, D.rad.isPreRadial.2.1 hxV⟩ + rw [hcap] at hm + rcases hm with rfl | rfl + · exact hN + · exact absurd hxV ht.2 + have huniq : ∀ {A B : Set Shat}, A ⊆ Δ → B ⊆ Δ → IsClosedDisc A → IsClosedDisc B → discBd A + = discBd B → A = B := by + intro A B hA hB hAd hBd he + have hsub : discBd A ⊆ Δ := (Surface.discBd_subset A).trans hA + obtain ⟨Δ₀, -, hu⟩ := disc_oArc Δ (discBd A) hΛc hsub hAd.isOArc_discBd + rw [hu A hA hAd rfl, hu B hB hBd he.symm] + let 𝓕 : Set (Set Shat) := {W | ∃ F, IsRingDisc D H k Y Δ W F} + have hfin : 𝓕.Finite := by + refine Set.Finite.of_finite_image (f := discBd) ?_ ?_ + · refine ((finite_circuits G).image fun C ↦ C.U).subset ?_ + rintro _ ⟨W, ⟨F, hF⟩, rfl⟩ + exact ⟨F, ⟨hF.circuit.2, hF.circuit.1⟩, hF.bd.symm⟩ + · rintro W ⟨F, hF⟩ W' ⟨F', hF'⟩ he + exact huniq hF.sub hF'.sub hF.disc hF'.disc he + obtain ⟨W, ⟨F, hF⟩, hWmax⟩ := hfin.exists_maximal ⟨_, C₁, hfirst⟩ + have hFW : F.U ⊆ W := hF.bd ▸ Surface.discBd_subset W + have hgrow : ∀ {P : Drawing Shat} {u v : Shat}, u ∈ F.V → v ∈ F.V → u ≠ v → P.IsPathOf G u v + → P.U ⊆ Δ → + P.U ∩ W = {u, v} → (∀ x ∈ P.V, x ∈ D.P.Γ.hatV cap → x ∈ F.V) → False := by + intro P u v hu hv huv hP hPΔ hPW hPV + obtain ⟨F', W', hF', hW'Δ, hW', hlt, hbd', hU', hV'⟩ := + exists_larger_circuit hT hΛc hF.disc hF.sub hF.circuit hF.bd hu hv huv hP hPΔ hPW + have hmem : IsRingDisc D H k Y Δ W' F' := by + refine ⟨hF', hW', hW'Δ, hbd', fun x hx ↦ ?_, fun x hx hxV ↦ ?_⟩ + · obtain ⟨hxW, hxF⟩ := hF.zone hx + refine ⟨hlt.1 hxW, fun hxF' ↦ ?_⟩ + rcases hU' hxF' with h | h + · have hm : x ∈ P.U ∩ W := ⟨h, hxW⟩ + rw [hPW] at hm + rcases hm with rfl | rfl + · exact hxF (F.V_subset_U hu) + · exact hxF (F.V_subset_U hv) + · exact hxF h + · rcases hV' hx with h | h + · exact hF.near x (hPV x h hxV) hxV + · exact hF.near x h hxV + exact hlt.2 (hWmax ⟨F', hmem⟩ hlt.1) + have hside : ∀ g ∈ G.E, g ⊆ W ∨ Disjoint g W := by + intro g hg + by_cases hgF : g ∈ F.E + · refine .inl (subset_closure.trans (Subset.trans ?_ hFW)) + intro x hx + rw [F.U_eq] + exact .inr (mem_iUnion₂.mpr ⟨g, hgF, hx⟩) + have hdis : Disjoint g (discBd W) := by + rw [hF.bd, disjoint_left] + intro x hx hxF + have hxV : x ∉ F.V := fun h ↦ (hg.2.1 hx).2 (hF.circuit.1.1 h) + obtain ⟨f, hf, hxf⟩ := F.exists_edge_of_mem hxF hxV + exact hgF (G.edge_eq_of_mem hg (hF.circuit.1.2 hf) hx hxf ▸ hf) + rcases hF.disc.side hman hg.2.2.1.isConnected.isPreconnected hdis with h | h + · exact .inl (h.trans sdiff_subset) + · exact .inr h + have hmemF : ∀ {x : Shat}, x ∈ discBd W → x ∈ G.V → x ∈ F.V := fun hx hV ↦ + mem_V_of_mem_U hF.circuit.1 (hF.bd ▸ hx) hV + -- an edge of `Γ*` at a vertex of `Γ` on `F` lies in `Δ` + have hedgeΔ : ∀ {g : Set Shat} {p t : Shat}, g ∈ G.E → closure g ∩ G.V = {p, t} → p ∈ F.V + → p ∈ D.P.Γ.hatV cap → + closure g ⊆ Δ := by + intro g p t hg hcap hp hpV + have ht : t ∈ D.rad.Rstar := other_end_mem_Rstar D hg hcap hpV + have hcap' : closure g ∩ G.V = {t, p} := by rw [hcap, pair_comm] + have hN : D.IsNear H (k + 4) t := (hF.near p hp hpV).step ⟨hg, ht.1, hF.circuit.1.1 hp, hcap'⟩ + have hsub := hNΛ le_rfl hN + rw [atomOf_Rstar D ht] at hsub + have htg : t ∈ closure g := by + have : t ∈ closure g ∩ G.V := by + rw [hcap] + exact .inr rfl + exact this.1 + exact closure_mono ((edge_subset_regionOf D ht hg htg).trans hsub) + have hint : Z ⊆ W \ discBd W := by + rw [hF.bd] + exact hF.zone + have hHint : H.U ⊆ W \ discBd W := fun x hx ↦ hint (.inl (subset_nearZone hH hx)) + have hTV : ∀ {g : Set Shat} {a b : Shat}, g ∈ G.E → tilde g = {a, b} → closure g ∩ G.V = {a, b} + := fun hg h ↦ by + rw [closure_inter_V_eq_tilde hg, h] + have hfarW : ∀ p ∈ W, ∃ a ∈ D.P.Γ.atoms cap, p ∈ a ∧ D.dist (D.rad.atomOf z) a ≤ 3 * (k + 3) + 11 + := fun p hp ↦ by + obtain ⟨a, ha, hpa⟩ := exists_atom_mem D p + exact ⟨a, ha, hpa, hfar a ha ⟨p, hpa, hF.sub hp⟩⟩ + refine ⟨W, ?_, hint, hfarW⟩ + refine ⟨by omega, by omega, hF.disc, ?_, hH, hHint, ?_, ?_, ?_, hhub, ?_, ?_⟩ + · rw [hF.bd] + exact hF.circuit.1.U_subset + · -- `W` includes the inside of each short circuit in it + intro F' hF' hle hsub + have hlt : F'.E.ncard < 2 * D.rep := by omega + have hi := D.ins_spec hF' hlt + have hiΔ : D.ins F' ⊆ Δ := hins F' hF' (hsub.trans hF.sub) (by omega) + have hO : IsOArc F'.U := hi.2.2.2.1 ▸ hi.2.2.1.isOArc_discBd + obtain ⟨Δ₀, ⟨h₁, h₂, h₃, -⟩, -⟩ := disc_oArc W F'.U hF.disc hsub hO + have := huniq hiΔ (h₁.trans hF.sub) hi.2.2.1 h₂ (hi.2.2.2.1.trans h₃.symm) + rw [this] + exact h₁ + · exact two_boundary_neighbors_force_vertex_inside_wheel (S := S) (Shat := Shat) (α := α) (cap + := cap) (χ := χ) (D := D) (H := H) (k := k) (Y := Y) Δ W F hF hgrow hside hmemF hedgeΔ hTV + · exact edge_with_both_ends_on_wheel_boundary_lies_inside (S := S) (Shat := Shat) (α := α) (cap + := cap) (χ := χ) (D := D) Δ W F hgrow hside hmemF hedgeΔ + · exact wheel_contains_near_vertices (S := S) (Shat := Shat) (α := α) (cap := cap) (χ := χ) (D + := D) (H := H) (k := k) (Y := Y) Δ W F hF hint hHint + · exact wheel_boundary_path_bounds (S := S) (Shat := Shat) (α := α) (cap := cap) (χ := χ) (D := + D) (H := H) (k := k) (Y := Y) Δ W F hF hmemF hint +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section12f.lean b/LeanPool/GraphMinor/GM19/Section12f.lean new file mode 100644 index 0000000000..cccb33d3ba --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section12f.lean @@ -0,0 +1,140 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section12e +public import LeanPool.GraphMinor.GM11.OArcCircuit +public import LeanPool.GraphMinor.Surface.AddCrosscap + +/-! +# Graph Minors XIX, Section 12: three vertices on the boundary of a wheel + +The proof of (13.1) says that `bd(W)` has at least six vertices of `Γ*`. The paper gives one line +for this. Here is the +proof. If at most two vertices of `Γ` lie on `bd(W)`, then internal 3-connectivity gives a disc `Δ ⊆ +Σ` with this +boundary and no other vertex of `Γ`. The disc `W` has a vertex inside, so `W ≠ Δ`, and `W ∪ Δ = Σ̂`. +By the first condition +in the definition of a wheel, `W` is the inside of its boundary circuit. So the tangle has a member +`(A, B)` with +`V(A) = V(Γ)`, against the third tangle axiom. + +The result is `TangleDatum.three_le_ncard_bd`, and it also gives the frame `Φ'` of page 377 its +vertices. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} + +/-- **At least three vertices of `Γ` lie on the boundary of a wheel**, if the boundary misses +`bd(Σ)` and the wheel has +a vertex of `Γ` inside. -/ +theorem three_le_ncard_bd (h : D.IsWheelHubOfRadius W H ρ) (hbd : discBd W ⊆ cap.emb '' + (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) : + 3 ≤ (discBd W ∩ D.P.Γ.hatV cap).ncard := by + classical + have hT := cap.isClosedSurface + have hS := χ.isSurface + have : ConnectedSpace Shat := cap.connected + have hO : IsOArc (discBd W) := h.is_disc.isOArc_discBd + obtain ⟨F, hFc, hFs, hFU⟩ := exists_circuit_of_oArc hO h.bd_sub + by_contra hlt + push Not at hlt + obtain ⟨Sk, hSk⟩ := exists_isSkHat hS cap D.P.Γ + have hVG : Sk.V ⊆ D.rad.G.V := by + rw [hSk.hV] + exact D.rad.isPreRadial.2.1 + have hw : IsWeighting D.rad.G (2 * 3) Sk.V 3 := + isWeighting_radial (Γ := PaintingOrDrawing.drawing Sk) (by omega) hVG (D.rad.bipartite hSk.hV) + have hsame : Sk.V ∩ F.V ⊆ discBd W ∩ D.P.Γ.hatV cap := by + rintro x ⟨hx, hxF⟩ + rw [hSk.hV] at hx + exact ⟨hFU ▸ F.V_subset_U hxF, hx⟩ + have hfin : (discBd W ∩ D.P.Γ.hatV cap).Finite := D.P.Γ.finite_V.image _ |>.subset + inter_subset_right + have hlen : F.E.ncard < 6 := by + by_contra hge + have := hw.le_ncard F hFc hFs (by rw [Drawing.length]; omega) + have := ncard_le_ncard hsame hfin + omega + have hρ := h.pos_ρ + have hrep := h.rep_ge + have hF : Drawing.IsCircuitOf F D.rad.G := ⟨hFs, hFc⟩ + have hi := D.ins_spec hF (by omega) + have hFW : F.U ⊆ W := hFU ▸ Surface.discBd_subset W + have hsubW : D.ins F ⊆ W := h.ins_sub F hF (by omega) hFW + have heq : D.ins F = W := by + obtain ⟨Δ₀, -, hu⟩ := disc_oArc W F.U h.is_disc hFW (hFU ▸ hO) + rw [hu _ hsubW hi.2.2.1 hi.2.2.2.1, hu W subset_rfl h.is_disc hFU.symm] + -- the preimage of the boundary in `Σ` + let F₀ : Set S := cap.emb ⁻¹' discBd W + have hF₀im : cap.emb '' F₀ = discBd W := by + rw [image_preimage_eq_iff] + exact fun x hx ↦ by + obtain ⟨y, -, rfl⟩ := hbd hx + exact mem_range_self y + have hF₀O : IsOArc F₀ := isOArc_of_image cap.isEmbedding (hF₀im ▸ hO) + have hF₀U : F₀ ∩ D.P.Γ.U ⊆ D.P.Γ.V := by + rintro x ⟨hx, hxU⟩ + have hxG : cap.emb x ∈ D.rad.G.U := h.bd_sub hx + have hm : cap.emb x ∈ D.P.Γ.hatV cap := D.rad.isPreRadial.1 ▸ ⟨mem_image_of_mem _ hxU, hxG⟩ + obtain ⟨y, hy, hyx⟩ := hm + exact cap.isEmbedding.injective hyx ▸ hy + have hF₀b : F₀ ∩ bd S = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro x ⟨hx, hxb⟩ + obtain ⟨y, hy, hyx⟩ := hbd hx + obtain rfl := cap.isEmbedding.injective hyx + exact hy.2 hxb + have hF₀V : (F₀ ∩ D.P.Γ.V).ncard ≤ 2 := by + have hsub : cap.emb '' (F₀ ∩ D.P.Γ.V) ⊆ discBd W ∩ D.P.Γ.hatV cap := by + rintro _ ⟨x, ⟨hx, hxV⟩, rfl⟩ + exact ⟨hx, mem_image_of_mem _ hxV⟩ + have := ncard_le_ncard hsub hfin + rw [ncard_image_of_injective _ cap.isEmbedding.injective] at this + omega + obtain ⟨Δ, hΔ, hΔb, hΔV⟩ := D.P.fits.internally_three_connected.2 F₀ hF₀O hF₀U + (by rw [hF₀b]; exact finite_empty) + (by rw [hF₀b, ncard_empty]; omega) + obtain ⟨hE, hEb⟩ := isClosedDisc_image hΔ cap.isEmbedding + have hbeq : discBd W = discBd (cap.emb '' Δ) := by rw [hEb, hΔb, hF₀im] + obtain ⟨_, ⟨hv₀W, hv₀b⟩, v₀, hv₀, rfl⟩ := hin + have hne : W ≠ cap.emb '' Δ := fun hne ↦ by + obtain ⟨y, hy, hyv⟩ := hne ▸ hv₀W + obtain rfl := cap.isEmbedding.injective hyv + exact hv₀b (hΔV ⟨hy, hv₀⟩) + have hcov := cover_of_discBd_eq hT h.is_disc hE hbeq hne + have hm := hi.2.2.2.2 + rw [heq] at hm + refine D.isTangle.axiom3 hm ?_ + apply subset_antisymm inter_subset_left + intro v hv + refine ⟨hv, ?_⟩ + have hx : cap.emb v ∈ W ∪ cap.emb '' Δ := hcov ▸ mem_univ _ + rcases hx with hx | ⟨y, hy, hyv⟩ + · exact hx + · obtain rfl := cap.isEmbedding.injective hyv + exact Surface.discBd_subset W (hΔV ⟨hy, hv⟩) + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section12g.lean b/LeanPool/GraphMinor/GM19/Section12g.lean new file mode 100644 index 0000000000..3d5901ddd4 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section12g.lean @@ -0,0 +1,247 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section12f + +/-! +# Graph Minors XIX, Section 12: tools for (12.4) + +The proof of (12.4) walks along short circuits, and measures atoms with them. This file holds these +steps: a short +circuit bounds the metric (`dist_le_of_circuit`), two vertices of a circuit are joined along it by +at most half of it +(`exists_walk_on_circuit`), a walk from outside a short circuit to inside it meets it +(`exists_walk_to_circuit`), and +the zone of a connected hub is connected (`isPreconnected_nearZone`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {H : Drawing Shat} {k : ℕ} + +/-- A short circuit bounds the metric between two atoms that meet its inside. -/ +theorem dist_le_of_circuit (D : TangleDatum cap χ) (hrep : 1 ≤ D.rep) {F : Drawing Shat} + (hF : Drawing.IsCircuitOf F D.rad.G) + (hlt : F.E.ncard < 2 * D.rep) {a b : Set Shat} (ha : (a ∩ D.ins F).Nonempty) (hb : + (b ∩ D.ins F).Nonempty) : + 2 * D.dist a b ≤ F.E.ncard := by + obtain ⟨X, hX, hl, hi, -⟩ := exists_restraint_of_circuit D hrep hF hlt + obtain ⟨T, hTX, hTl⟩ := exists_walk_of_restraint D hrep hX + have := D.dist_le T (a := a) (b := b) (ha.mono (inter_subset_inter_right _ (hTX ▸ hi))) + (hb.mono (inter_subset_inter_right _ (hTX ▸ hi))) + omega + +/-- A path of `G` gives a walk of `G` as long as the path. -/ +theorem _root_.GraphMinor.GM19.Drawing.IsPathOf.exists_walk {T : Type} [TopologicalSpace T] + [T2Space T] {P G : Drawing T} + {u v : T} (hP : Drawing.IsPathOf P G u v) : ∃ W : GraphWalk G.toGraph u v, W.length = P.E.ncard + := by + obtain ⟨W, hW, -, hE⟩ := hP.2 + obtain ⟨W', -, he⟩ := hP.1.exists_walk_up W + refine ⟨W', ?_⟩ + have h₁ := ncard_walk_E P hW + rw [walkDrawing_E, ← hE] at h₁ + have h₂ : W'.length = W.length := by rw [← edges_length, ← edges_length, he] + omega + +/-- Two vertices of a circuit are joined along it by a walk of at most half its length. -/ +theorem exists_walk_on_circuit {T : Type} [TopologicalSpace T] [T2Space T] {F G : Drawing T} + (hF : Drawing.IsCircuitOf F G) {a b : T} (ha : a ∈ F.V) (hb : b ∈ F.V) : + ∃ W : GraphWalk G.toGraph a b, 2 * W.length ≤ F.E.ncard ∧ ∀ x ∈ W.support, x ∈ F.V := by + classical + by_cases hab : a = b + · subst hab + exact ⟨.nil (hF.1.1 ha), by change 2 * 0 ≤ _; omega, by simpa [GraphWalk.support] using ha⟩ + obtain ⟨P, Q, hP, hQ, hPs, hQs, -, -, -, hdisj, hsup⟩ := hF.2.exists_two_paths ha hb hab + have hcount : P.E.ncard + Q.E.ncard = F.E.ncard := by + have hE := Drawing.sup_E hPs hQs + rw [hsup] at hE + rw [hE, ncard_union_eq hdisj (F.finite_edges.subset hPs.2) (F.finite_edges.subset hQs.2)] + have key : ∀ {P : Drawing T}, P.IsPathBetween a b → P.IsSubdrawing F → + ∃ W : GraphWalk G.toGraph a b, W.length = P.E.ncard ∧ ∀ x ∈ W.support, x ∈ F.V := by + intro P hP hPs + obtain ⟨W, hW, hV, hE⟩ := hP + obtain ⟨W', hs, he⟩ := (hPs.trans hF.1).exists_walk_up W + refine ⟨W', ?_, fun x hx ↦ hPs.1 ?_⟩ + · have h₁ := ncard_walk_E P hW + rw [walkDrawing_E, ← hE] at h₁ + have h₂ : W'.length = W.length := by rw [← edges_length, ← edges_length, he] + omega + · rw [hV] + rw [hs] at hx + exact hx + obtain ⟨W₁, h₁, h₁'⟩ := key hP hPs + obtain ⟨W₂, h₂, h₂'⟩ := key hQ hQs + by_cases hle : P.E.ncard ≤ Q.E.ncard + · exact ⟨W₁, by omega, h₁'⟩ + · exact ⟨W₂, by omega, h₂'⟩ + +omit [T2Space S] in +/-- A walk from outside the interior of a short circuit to its interior reaches a vertex of the +circuit. -/ +theorem exists_walk_to_circuit (D : TangleDatum cap χ) (hrep : 1 ≤ D.rep) {F : Drawing Shat} + (hF : Drawing.IsCircuitOf F D.rad.G) (hlt : F.E.ncard < 2 * D.rep) {c y : Shat} + (W : GraphWalk D.rad.G.toGraph c y) + (hc : c ∉ D.ins F \ F.U) (hy : y ∈ D.ins F \ F.U) : + ∃ h ∈ F.V, ∃ W' : GraphWalk D.rad.G.toGraph c h, W'.length ≤ W.length := by + have : ConnectedSpace Shat := cap.connected + have hsl := D.isSlope hrep + have hl : F.length < 2 * D.rep := hlt + obtain ⟨hcl, hfr, hU⟩ := ins_facts_of_length hsl hF.2 hF.1 hl + induction W with + | nil h => exact absurd hy hc + | @cons c u y g hg r ih => + by_cases hcU : c ∈ F.U + · exact ⟨c, mem_V_of_mem_U hF.1 hcU hg.2.1, .nil hg.2.1, Nat.zero_le _⟩ + have hcA : c ∉ D.ins F := fun h ↦ hc ⟨h, hcU⟩ + by_cases hu : u ∈ D.ins F \ F.U + · exfalso + have hg₁ : c ∈ closure g ∩ D.rad.G.V := by + rw [hg.2.2.2] + exact .inl rfl + have hg₂ : u ∈ closure g ∩ D.rad.G.V := by + rw [hg.2.2.2] + exact .inr rfl + rcases edge_subset_or_disjoint_of_length hsl hF.2 hF.1 hl hg.1 with h | h + · exact hcA (closure_minimal h hcl hg₁.1) + · have hint : u ∈ interior (D.ins F) := by + by_contra hn + exact hu.2 (hfr ▸ ⟨subset_closure hu.1, hn⟩) + obtain ⟨x, hx₁, hx₂⟩ := mem_closure_iff.mp hg₂.1 _ isOpen_interior hint + exact disjoint_left.mp h hx₂ (interior_subset hx₁) + · obtain ⟨h, hh, W', hW'⟩ := ih hu hy + exact ⟨h, hh, .cons hg W', by simpa using hW'⟩ + +omit [T2Space Shat] in +/-- The zone of a connected hub is connected. -/ +theorem isPreconnected_nearZone (hH : H.IsSubdrawing D.rad.G) (hc : IsPreconnected H.U) + (hne : H.V.Nonempty) : + IsPreconnected (nearZone D H k) := by + classical + have hS := χ.isSurface + -- the set of a vertex of `Γ*` + have hzH : H.U ⊆ nearZone D H k := subset_nearZone hH + have hatomN : ∀ {j : ℕ} {x : Shat}, D.IsNear H j x → (x ∈ D.P.Γ.hatV cap → j ≤ k + 1) → j ≤ k + 2 + → + D.rad.atomOf x ⊆ nearZone D H k := by + intro j x hN h₁ h₂ + by_cases hx : x ∈ D.P.Γ.hatV cap + · obtain ⟨v, hv, rfl⟩ := hx + rw [D.atomOf_emb hv] + rintro _ rfl + exact .inl ⟨mem_image_of_mem _ hv, hN.mono (h₁ (mem_image_of_mem _ hv))⟩ + · have hw : x ∈ D.rad.Rstar := ⟨hN.mem_V, hx⟩ + rw [atomOf_Rstar D hw] + exact fun y hy ↦ .inr (mem_iUnion₂.mpr ⟨x, ⟨hw, hN.mono h₂⟩, hy⟩) + have hatomc : ∀ {x : Shat}, x ∈ D.rad.G.V → IsPreconnected (D.rad.atomOf x) := by + intro x hxG + by_cases hx : x ∈ D.P.Γ.hatV cap + · obtain ⟨v, hv, rfl⟩ := hx + rw [D.atomOf_emb hv] + exact isPreconnected_singleton + · rw [atomOf_Rstar D ⟨hxG, hx⟩] + exact isPreconnected_connectedComponentIn + have key : ∀ {x h : Shat} (W : GraphWalk D.rad.G.toGraph x h), h ∈ H.V → W.length ≤ k + 2 → + (x ∈ D.P.Γ.hatV cap → W.length ≤ k + 1) → + ∃ T ⊆ nearZone D H k, D.rad.atomOf x ⊆ T ∧ h ∈ T ∧ IsPreconnected T := by + intro x h W + induction W with + | nil hG => + intro hh hl hl' + refine ⟨D.rad.atomOf _, hatomN (j := 0) (isNear_self hH hh) (fun _ ↦ by omega) (by omega), + subset_rfl, + D.mem_atomOf hG, hatomc hG⟩ + | @cons x u h g hg r ih => + intro hh hl hl' + rw [GraphWalk.length_cons] at hl + have hgu : u ∈ closure g ∩ D.rad.G.V := by + rw [hg.2.2.2] + exact .inr rfl + have hgx : x ∈ closure g ∩ D.rad.G.V := by + rw [hg.2.2.2] + exact .inl rfl + by_cases hx : x ∈ D.P.Γ.hatV cap + · have hu : u ∈ D.rad.Rstar := other_end_mem_Rstar D hg.1 hg.2.2.2 hx + rw [GraphWalk.length_cons] at hl' + obtain ⟨T, hT, hat, hhT, hTc⟩ := ih hh (by omega) (fun h ↦ absurd h hu.2) + rw [atomOf_Rstar D hu] at hat + have hclosure : x ∈ closure (D.rad.regionOf u) := + closure_mono (edge_subset_regionOf D hu hg.1 hgu.1) hgx.1 + have hS' : IsPreconnected (insert x (D.rad.regionOf u)) := + isPreconnected_connectedComponentIn.subset_closure (subset_insert _ _) + (insert_subset hclosure subset_closure) + have hxz : x ∈ nearZone D H k := .inl ⟨hx, h, hh, .cons hg r, by + rw [GraphWalk.length_cons] + exact hl' hx⟩ + have huT := hat (D.rad.regionOf_mem hu).2 + refine ⟨T ∪ insert x (D.rad.regionOf u), union_subset hT (insert_subset hxz + (hat.trans hT)), ?_, .inl hhT, + hTc.union u huT (.inr (D.rad.regionOf_mem hu).2) hS'⟩ + obtain ⟨v, hv, rfl⟩ := hx + rw [D.atomOf_emb hv] + rintro _ rfl + exact .inr (.inl rfl) + · have hw : x ∈ D.rad.Rstar := ⟨hg.2.1, hx⟩ + have hu : u ∈ D.P.Γ.hatV cap := by + obtain ⟨a, ha, t, ht, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 g hg.1 + have : a ∈ closure g ∩ D.rad.G.V := by + rw [hcap] + exact .inl rfl + rw [hg.2.2.2] at this + rcases this with rfl | rfl + · exact absurd ha hx + · exact ha + obtain ⟨T, hT, hat, hhT, hTc⟩ := ih hh (by omega) (fun _ ↦ by omega) + have huT : u ∈ T := by + apply hat + exact D.mem_atomOf hgu.2 + have hclosure : u ∈ closure (D.rad.regionOf x) := + closure_mono (edge_subset_regionOf D hw hg.1 hgx.1) hgu.1 + have hS' : IsPreconnected (insert u (D.rad.regionOf x)) := + isPreconnected_connectedComponentIn.subset_closure (subset_insert _ _) + (insert_subset hclosure subset_closure) + have hxz : D.rad.regionOf x ⊆ nearZone D H k := fun y hy ↦ + .inr (mem_iUnion₂.mpr ⟨x, ⟨hw, h, hh, .cons hg r, by + rw [GraphWalk.length_cons] + exact hl⟩, hy⟩) + refine ⟨T ∪ insert u (D.rad.regionOf x), union_subset hT (insert_subset (hT huT) hxz), + ?_, .inl hhT, + hTc.union u huT (.inl rfl) hS'⟩ + rw [atomOf_Rstar D hw] + exact fun y hy ↦ .inr (.inr hy) + obtain ⟨h₀, hh₀⟩ := hne + have hh₀U := H.V_subset_U hh₀ + have hfinal : ∀ {x h : Shat} (W : GraphWalk D.rad.G.toGraph x h), h ∈ H.V → W.length ≤ k + 2 → + (x ∈ D.P.Γ.hatV cap → W.length ≤ k + 1) → ∀ y ∈ D.rad.atomOf x, + ∃ t ⊆ nearZone D H k, h₀ ∈ t ∧ y ∈ t ∧ IsPreconnected t := by + intro x h W hh h₁ h₂ y hy + obtain ⟨T, hT, hat, hhT, hTc⟩ := key W hh h₁ h₂ + exact ⟨T ∪ H.U, union_subset hT hzH, .inr hh₀U, .inl (hat hy), + hTc.union h hhT (H.V_subset_U hh) hc⟩ + refine isPreconnected_of_forall h₀ fun y hy ↦ ?_ + rcases hy with ⟨hyV, h, hh, W, hW⟩ | hy + · exact hfinal W hh (by omega) (fun _ ↦ hW) y (D.mem_atomOf (IsNear.mem_V ⟨h, hh, W, hW⟩)) + · obtain ⟨w, ⟨hw, h, hh, W, hWl⟩, hyw⟩ := mem_iUnion₂.mp hy + exact hfinal W hh hWl (fun h' ↦ absurd h' hw.2) y (by rw [atomOf_Rstar D hw]; exact hyw) + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section12h.lean b/LeanPool/GraphMinor/GM19/Section12h.lean new file mode 100644 index 0000000000..50fa1c3199 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section12h.lean @@ -0,0 +1,347 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section12g +public import LeanPool.GraphMinor.GM11.RadialBasics +public import LeanPool.GraphMinor.Surface.AddCrosscap + +/-! +# Graph Minors XIX, Section 12: circuits in a wheel + +`Γ*` has no two edges with the same ends (`no_parallel`): such edges bound a disc in a region of +`Γ`, by internal +3-connectivity, or since a cuff bounds a disc, and the last condition on a radial drawing forbids +this disc. So at a vertex +of `R*` a circuit of `Γ*` has two different neighbours, and the second condition in the definition +of a wheel applies. +This gives `IsWheelHubOfRadius.ins_subset_of_vertices`: a short circuit with its vertices of `Γ` in +a wheel has its +inside in the wheel. The proof of (12.4) uses this as "this subwalk remains within `W_x`". +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +/-- `Γ*` has no two edges with the same ends. -/ +theorem no_parallel (D : TangleDatum cap χ) {g₁ g₂ : Set Shat} (hg₁ : g₁ ∈ D.rad.G.E) + (hg₂ : g₂ ∈ D.rad.G.E) + (hne : g₁ ≠ g₂) {v t : Shat} (hc₁ : closure g₁ ∩ D.rad.G.V = {v, t}) + (hc₂ : closure g₂ ∩ D.rad.G.V = {v, t}) + (hv : v ∈ D.P.Γ.hatV cap) : False := by + classical + have hT := cap.isClosedSurface + have hS := χ.isSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + set G := D.rad.G with hG + have ht : t ∈ D.rad.Rstar := other_end_mem_Rstar D hg₁ hc₁ hv + have hvt : v ≠ t := fun h ↦ ht.2 (h ▸ hv) + have hline : ∀ {g : Set Shat}, g ∈ G.E → closure g ∩ G.V = {v, t} → IsLineWithEnds + (closure g) v t := by + intro g hg hc + rcases G.edge_cond g hg with ⟨a, b, -, hab, hL⟩ | ⟨u, hu, -⟩ + · rw [hc] at hab + have hv' : v ∈ ({a, b} : Set Shat) := hab ▸ mem_insert _ _ + have ht' : t ∈ ({a, b} : Set Shat) := hab ▸ mem_insert_of_mem _ rfl + rcases hv' with rfl | rfl + · rcases ht' with rfl | rfl + · exact absurd rfl hvt + · exact hL + · rcases ht' with rfl | rfl + · exact GraphMinor.GM11.IsLineWithEnds.symm hL + · exact absurd rfl hvt + · rw [hc] at hu + have hv' : v ∈ ({u} : Set Shat) := hu ▸ mem_insert _ _ + have ht' : t ∈ ({u} : Set Shat) := hu ▸ mem_insert_of_mem _ rfl + exact absurd (hv'.trans ht'.symm) hvt + have hL₁ := hline hg₁ hc₁ + have hL₂ := hline hg₂ hc₂ + have hsplit : ∀ {g : Set Shat} {x : Shat}, g ∈ G.E → closure g ∩ G.V = {v, t} → x ∈ closure g + → x ∈ g ∨ x = v ∨ x = t := by + intro g x hg hc hx + rcases closure_edge_subset hg hx with h | h + · exact .inl h + · have : x ∈ closure g ∩ G.V := ⟨hx, h⟩ + rw [hc] at this + exact .inr this + have hcap : closure g₁ ∩ closure g₂ ⊆ {v, t} := by + rintro x ⟨h₁, h₂⟩ + rcases hsplit hg₁ hc₁ h₁ with h | h + · rcases hsplit hg₂ hc₂ h₂ with h' | h' + · exact absurd (G.edge_eq_of_mem hg₁ hg₂ h h') hne + · exact h' + · exact h + have hO : IsOArc (closure g₁ ∪ closure g₂) := GM11.isOArc_union hL₁ hL₂ hcap + set F₀ := closure g₁ ∪ closure g₂ with hF₀ + set r := D.rad.regionOf t with hr + have hrm : r ∈ D.P.Γ.hatRegions cap := (D.rad.regionOf_mem ht).1 + have htr : t ∈ r := (D.rad.regionOf_mem ht).2 + have hmem : ∀ {g : Set Shat}, g ∈ G.E → closure g ∩ G.V = {v, t} → g ⊆ r := fun {g} hg hc ↦ by + have : t ∈ closure g ∩ G.V := by + rw [hc] + exact .inr rfl + exact edge_subset_regionOf D ht hg this.1 + have hF₀r : F₀ ⊆ r ∪ {v} := by + rintro x (h | h) + · rcases hsplit hg₁ hc₁ h with h' | rfl | rfl + · exact .inl (hmem hg₁ hc₁ h') + · exact .inr rfl + · exact .inl htr + · rcases hsplit hg₂ hc₂ h with h' | rfl | rfl + · exact .inl (hmem hg₂ hc₂ h') + · exact .inr rfl + · exact .inl htr + have hclosed : ∃ Δ, IsClosedDisc Δ ∧ Δ ⊆ r ∪ {v} ∧ discBd Δ = F₀ := by + rcases hatRegion_cases cap D.P.Γ hrm with hsub | ⟨Θ, hΘ, hreq⟩ + · -- the region lies in `Σ` + obtain ⟨b, hb, rfl⟩ := hv + have hrU : Disjoint r (D.P.Γ.hatU cap) := by + rw [disjoint_left] + exact fun x hx ↦ connectedComponentIn_subset _ _ hx + have hF₀range : F₀ ⊆ range cap.emb := fun x hx ↦ by + rcases hF₀r hx with h | rfl + · exact hsub h + · exact mem_range_self b + let F₁ : Set S := cap.emb ⁻¹' F₀ + have hF₁im : cap.emb '' F₁ = F₀ := image_preimage_eq_iff.mpr hF₀range + have hF₁O : IsOArc F₁ := isOArc_of_image cap.isEmbedding (hF₁im ▸ hO) + have hF₁U : ∀ {x}, x ∈ F₁ → x ∈ D.P.Γ.U → x = b := fun {x} hx hxU ↦ by + rcases hF₀r hx with h | h + · exact absurd (mem_image_of_mem _ hxU) (disjoint_left.mp hrU h) + · exact cap.isEmbedding.injective h + have hbsub : F₁ ∩ bd S ⊆ {b} := fun x hx ↦ hF₁U hx.1 (D.P.Γ.bd_subset hx.2) + have hVsub : F₁ ∩ D.P.Γ.V ⊆ {b} := fun x hx ↦ hF₁U hx.1 (D.P.Γ.V_subset hx.2) + have hn₁ := ncard_le_ncard hbsub (toFinite _) + have hn₂ := ncard_le_ncard hVsub (toFinite _) + rw [ncard_singleton] at hn₁ hn₂ + obtain ⟨Δ₁, hΔ₁, hΔ₁b, hΔ₁V⟩ := D.P.fits.internally_three_connected.2 F₁ hF₁O + (fun x hx ↦ (hF₁U hx.1 hx.2) ▸ hb) ((finite_singleton b).subset hbsub) (by omega) + obtain ⟨hE, hEb⟩ := isClosedDisc_image hΔ₁ cap.isEmbedding + have hEb' : discBd (cap.emb '' Δ₁) = F₀ := by rw [hEb, hΔ₁b, hF₁im] + obtain ⟨Sk, hSk⟩ := exists_isSkHat hS cap D.P.Γ + have hintU : Disjoint (discInt (cap.emb '' Δ₁)) (D.P.Γ.hatU cap) := by + rw [disjoint_left] + rintro _ ⟨⟨x, hxΔ, rfl⟩, hxb⟩ ⟨x', hx', hxx⟩ + obtain rfl := cap.isEmbedding.injective hxx + rw [hEb'] at hxb + have hxF : x' ∉ F₁ := hxb + have hxV : x' ∉ D.P.Γ.V := fun h ↦ hxF (hΔ₁V ⟨hxΔ, h⟩) + obtain ⟨c, hc, hxc⟩ := exists_arcComp_superset (F := D.P.Γ.U \ D.P.Γ.V) + (isPathConnected_singleton x') (singleton_subset_iff.2 ⟨hx', hxV⟩) + have hxc' : x' ∈ c := hxc rfl + have hcdis : Disjoint (cap.emb '' c) (discBd (cap.emb '' Δ₁)) := by + rw [hEb', disjoint_left] + rintro _ ⟨y, hy, rfl⟩ hyF + have := hF₁U (x := y) hyF (hc.2.1 hy).1 + exact (hc.2.1 hy).2 (this ▸ hb) + have hin : cap.emb '' c ⊆ discInt (cap.emb '' Δ₁) := by + rcases hE.side hman (hc.2.2.1.image + cap.isEmbedding.continuous).isConnected.isPreconnected hcdis with h | h + · exact h + · exact absurd (mem_image_of_mem _ hxΔ) (disjoint_left.mp h (mem_image_of_mem _ hxc')) + have htil : tilde c ⊆ {b} := by + intro a ha + have hcl : cap.emb a ∈ closure (cap.emb '' c) := + image_closure_subset_closure_image cap.isEmbedding.continuous (mem_image_of_mem _ ha.1) + obtain ⟨a', ha', haa⟩ := closure_minimal (hin.trans sdiff_subset) hE.isClosed hcl + obtain rfl := cap.isEmbedding.injective haa + exact hF₁U (hΔ₁V ⟨ha', D.P.Γ.tilde_subset_V hc ha⟩) (D.P.Γ.V_subset + (D.P.Γ.tilde_subset_V hc ha)) + have hn := ncard_le_ncard htil (toFinite _) + rw [ncard_singleton] at hn + rcases D.P.Γ.size_cases hc with h | h <;> omega + obtain ⟨p, hp⟩ := hg₁.1 + have hpr := hmem hg₁ hc₁ hp + have hpb : p ∈ discBd (cap.emb '' Δ₁) := by + rw [hEb'] + exact .inl (subset_closure hp) + have hpcl := hE.subset_closure_discInt (Surface.discBd_subset _ hpb) + obtain ⟨y, hy₁, hy₂⟩ := mem_closure_iff.mp hpcl _ (isOpen_regionOf D ht) hpr + have hRr := hSk.hatRegion_mem_R hrm + have hdis : Disjoint (discInt (cap.emb '' Δ₁)) Sk.U := by + rw [disjoint_left] + intro z hz hzU + rw [hSk.hU] at hzU + exact disjoint_left.mp hintU hz (image_mono D.P.Γ.skU_subset hzU) + have hsubr : discInt (cap.emb '' Δ₁) ⊆ r := subset_region hRr hE.isPreconnected_discInt hdis + hy₂ hy₁ + refine ⟨cap.emb '' Δ₁, hE, fun x hx ↦ ?_, hEb'⟩ + by_cases hxF : x ∈ F₀ + · exact hF₀r hxF + · exact .inl (hsubr ⟨hx, by rwa [hEb']⟩) + · -- the region is a pasted disc + have hcd := cap.cuffDisc_closedDisc Θ hΘ + have hsubc : F₀ ⊆ closure (cap.cuffDisc Θ) := by + rw [← hreq] + refine hF₀r.trans (union_subset subset_closure ?_) + rw [singleton_subset_iff] + have : v ∈ closure g₁ ∩ G.V := by + rw [hc₁] + exact .inl rfl + exact closure_mono (hmem hg₁ hc₁) this.1 + obtain ⟨Δ, ⟨h₁, h₂, h₃, -, h₄, -⟩, -⟩ := disc_oArc _ F₀ hcd hsubc hO + refine ⟨Δ, h₂, fun x hx ↦ ?_, h₃⟩ + by_cases hxF : x ∈ F₀ + · exact hF₀r hxF + · have hxb : x ∉ discBd (closure (cap.cuffDisc Θ)) := disjoint_left.mp h₄ ⟨hx, hxF⟩ + have hxc := h₁ hx + rw [cap.closure_cuffDisc hΘ] at hxc + rcases hxc with h | h + · exact .inl (hreq ▸ h) + · exact absurd (by rw [cap.cuffDisc_bd Θ hΘ]; exact h) hxb + obtain ⟨Δ, hΔ, hΔr, hΔb⟩ := hclosed + refine D.rad.isPreRadial.2.2.2.2.2 g₁ hg₁ g₂ hg₂ hne v hv r hrm t ⟨htr, ht.1⟩ hc₁ hc₂ ⟨Δ, hΔ, + hΔr, ?_⟩ + rw [← subBd_eq_frontier', IsClosedDisc.frontier_eq_discBd hT hΔ, hΔb] + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} + +omit [T2Space S] in +/-- An edge of `Γ*` lies in a wheel or misses it. -/ +theorem IsWheelHubOfRadius.edge_side (h : D.IsWheelHubOfRadius W H ρ) {g : Set Shat} + (hg : g ∈ D.rad.G.E) : + g ⊆ W ∨ Disjoint g W := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + obtain ⟨F, hFc, hFs, hFU⟩ := exists_circuit_of_oArc h.is_disc.isOArc_discBd h.bd_sub + by_cases hgF : g ∈ F.E + · refine .inl (subset_closure.trans fun x hx ↦ Surface.discBd_subset W ?_) + rw [← hFU, F.U_eq] + exact .inr (mem_iUnion₂.mpr ⟨g, hgF, hx⟩) + have hdis : Disjoint g (discBd W) := by + rw [← hFU, disjoint_left] + intro x hx hxF + have hxV : x ∉ F.V := fun h' ↦ (hg.2.1 hx).2 (hFs.1 h') + obtain ⟨f, hf, hxf⟩ := F.exists_edge_of_mem hxF hxV + exact hgF (D.rad.G.edge_eq_of_mem hg (hFs.2 hf) hx hxf ▸ hf) + rcases h.is_disc.side hman hg.2.2.1.isConnected.isPreconnected hdis with h' | h' + · exact .inl (h'.trans sdiff_subset) + · exact .inr h' + +omit [T2Space S] in +omit [T2Space Shat] in +/-- A point of a wheel in the closure of an edge of `Γ*` that misses the wheel lies on the boundary +of the wheel. -/ +theorem IsWheelHubOfRadius.mem_bd_of_closure (h : D.IsWheelHubOfRadius W H ρ) {g : Set Shat} + (hdis : Disjoint g W) + {p : Shat} (hpg : p ∈ closure g) (hpW : p ∈ W) : p ∈ discBd W := by + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + by_contra hn + obtain ⟨y, hy₁, hy₂⟩ := mem_closure_iff.mp hpg _ (h.is_disc.isOpen_discInt hman) ⟨hpW, hn⟩ + exact disjoint_left.mp hdis hy₂ hy₁.1 + +omit [T2Space S] [T2Space Shat] in +/-- An end of an edge of `Γ*` that is not a vertex of `Γ` has a vertex of `Γ` as its other end. -/ +theorem hatV_of_not_hatV (D : TangleDatum cap χ) {g : Set Shat} (hg : g ∈ D.rad.G.E) {p q : Shat} + (hcap : closure g ∩ D.rad.G.V = {p, q}) (hp : p ∉ D.P.Γ.hatV cap) : q ∈ D.P.Γ.hatV cap := by + obtain ⟨a, ha, t, ht, hcap'⟩ := D.rad.isPreRadial.2.2.2.2.1 g hg + have : a ∈ closure g ∩ D.rad.G.V := by + rw [hcap'] + exact .inl rfl + rw [hcap] at this + rcases this with rfl | rfl + · exact absurd ha hp + · exact ha + +/-- A circuit of `Γ*` with its vertices of `Γ` in a wheel lies in the wheel. -/ +theorem IsWheelHubOfRadius.U_subset_of_vertices (h : D.IsWheelHubOfRadius W H ρ) {C : Drawing Shat} + (hC : Drawing.IsCircuitOf C D.rad.G) (hV : ∀ x ∈ C.V, x ∈ D.P.Γ.hatV cap → x ∈ W) : C.U ⊆ W + := by + classical + have hS := χ.isSurface + have hVall : ∀ x ∈ C.V, x ∈ W := by + intro t ht + by_cases hth : t ∈ D.P.Γ.hatV cap + · exact hV t ht hth + by_contra htW + have htG := hC.1.1 ht + -- another vertex of the circuit + obtain ⟨b, hb, hbt⟩ : ∃ b ∈ C.V, b ≠ t := by + obtain ⟨u, W₀, -, hpos, hCV, -⟩ := id hC.2 + cases W₀ with + | nil h' => simp [GraphWalk.length] at hpos + | @cons _ x _ e hl r => + have huC : u ∈ C.V := by rw [hCV]; exact .head _ + have hxC : x ∈ C.V := by + rw [hCV] + exact .tail _ r.start_mem_support + have hlG : D.rad.G.toGraph.IsLink e u x := + ⟨hC.1.2 hl.1, hC.1.1 hl.2.1, hC.1.1 hl.2.2.1, by rw [← hC.1.closure_inter_V hl.1]; exact + hl.2.2.2⟩ + by_cases hu : u = t + · refine ⟨x, hxC, fun hxt ↦ ?_⟩ + have hq := hatV_of_not_hatV D hlG.1 hlG.2.2.2 (by rw [hu]; exact hth) + exact hth (hxt ▸ hq) + · exact ⟨u, huC, hu⟩ + obtain ⟨P, Q, hP, hQ, hPs, hQs, -, -, -, hdisj, -⟩ := hC.2.exists_two_paths ht hb hbt.symm + obtain ⟨g₁, hg₁, w₁, hw₁, -, hc₁, -⟩ := first_step (hPs.trans hC.1) hbt.symm hP + obtain ⟨g₂, hg₂, w₂, hw₂, -, hc₂, -⟩ := first_step (hQs.trans hC.1) hbt.symm hQ + have hgne : g₁ ≠ g₂ := fun e ↦ disjoint_left.mp hdisj hg₁ (e ▸ hg₂) + have hg₁G := hC.1.2 (hPs.2 hg₁) + have hg₂G := hC.1.2 (hQs.2 hg₂) + have hh₁ := hatV_of_not_hatV D hg₁G hc₁ hth + have hh₂ := hatV_of_not_hatV D hg₂G hc₂ hth + have hc₁' : closure g₁ ∩ D.rad.G.V = {w₁, t} := by rw [hc₁, pair_comm] + have hc₂' : closure g₂ ∩ D.rad.G.V = {w₂, t} := by rw [hc₂, pair_comm] + have hne : w₁ ≠ w₂ := fun e ↦ no_parallel D hg₁G hg₂G hgne hc₁' (e ▸ hc₂') hh₁ + have hW₁ := hV w₁ (hPs.1 hw₁) hh₁ + have hW₂ := hV w₂ (hQs.1 hw₂) hh₂ + have hend : ∀ {g w}, g ∈ D.rad.G.E → closure g ∩ D.rad.G.V = {t, w} → w ∈ W → w ∈ discBd W := by + intro g w hg hc hwW + have hm₁ : t ∈ closure g ∩ D.rad.G.V := by + rw [hc] + exact .inl rfl + have hm₂ : w ∈ closure g ∩ D.rad.G.V := by + rw [hc] + exact .inr rfl + rcases h.edge_side hg with h' | h' + · exact absurd (closure_minimal h' h.is_disc.isClosed hm₁.1) htW + · exact h.mem_bd_of_closure h' hm₂.1 hwW + exact htW (h.two_nbrs_in_W t htG w₁ ⟨hh₁, hend hg₁G hc₁ hW₁⟩ w₂ ⟨hh₂, hend hg₂G hc₂ hW₂⟩ hne + ⟨g₁, hg₁G, (closure_inter_V_eq_tilde hg₁G).symm.trans hc₁⟩ ⟨g₂, hg₂G, + (closure_inter_V_eq_tilde hg₂G).symm.trans hc₂⟩) + intro x hx + by_cases hxV : x ∈ C.V + · exact hVall x hxV + obtain ⟨g, hg, hxg⟩ := C.exists_edge_of_mem hx hxV + have hgG := hC.1.2 hg + rcases h.edge_side hgG with h' | h' + · exact h' hxg + exfalso + have hsub : tilde g ⊆ discBd W := by + intro y hy + have hyV : y ∈ closure g ∩ D.rad.G.V := closure_inter_V_eq_tilde hgG ▸ hy + have hyC : y ∈ closure g ∩ C.V := (hC.1.closure_inter_V hg).symm ▸ hyV + exact h.mem_bd_of_closure h' hyV.1 (hVall y hyC.2) + exact disjoint_left.mp h' hxg (h.chord_in_W g hgG hsub hxg) + +/-- A short circuit of `Γ*` with its vertices of `Γ` in a wheel has its inside in the wheel. -/ +theorem IsWheelHubOfRadius.ins_subset_of_vertices (h : D.IsWheelHubOfRadius W H ρ) {C : Drawing + Shat} + (hC : Drawing.IsCircuitOf C D.rad.G) (hle : C.E.ncard ≤ 4 * ρ + 4) + (hV : ∀ x ∈ C.V, x ∈ D.P.Γ.hatV cap → x ∈ W) : + D.ins C ⊆ W := + h.ins_sub C hC hle (h.U_subset_of_vertices hC hV) + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section12i.lean b/LeanPool/GraphMinor/GM19/Section12i.lean new file mode 100644 index 0000000000..cfec601d68 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section12i.lean @@ -0,0 +1,510 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section12h + +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Graph Minors XIX, Section 12: the set around a centre in (12.4) + +The proof of (12.4) picks, for each `x ∈ X₂`, a circuit `C_x` and a hub `H_x`, each of which may be +a single vertex. To +treat the cases at once we call a *patch* a circuit with its inside, or a single vertex with the +empty set. `IsCentre` +records what the proof of (12.4) knows about `x`, `y(x)`, `C_x`, `H_x`. `IsCentre.isZoneSet` says +that the union of the +two insides can play the part of `Y` in (12.1), and `IsCentre.exists_wheel` gives the wheel `W_x`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +/-- `F` is a circuit of `Γ*` of at most `m` edges with `A` its inside, or a single vertex with `A` +empty. -/ +def IsPatch (D : TangleDatum cap χ) (F : Drawing Shat) (A : Set Shat) (m : ℕ) : Prop := + F.IsSubdrawing D.rad.G ∧ IsPreconnected F.U ∧ F.V.Nonempty ∧ + ((Drawing.IsCircuitOf F D.rad.G ∧ F.E.ncard ≤ m ∧ A = D.ins F) ∨ (A = ∅ ∧ F.E = ∅ + ∧ F.V.Subsingleton)) + +variable {D : TangleDatum cap χ} {F C H : Drawing Shat} {A B : Set Shat} {m t : ℕ} {x y : Shat} + +/-- The set of a circuit is connected. -/ +theorem isPreconnected_U_of_isCircuit {T : Type} [TopologicalSpace T] [T2Space T] {F : Drawing T} + (hF : F.IsCircuit) : + IsPreconnected F.U := by + exact (IsCircuit.isOArc_U hF).isPreconnected + +omit [T2Space S] in +theorem IsPatch.of_circuit (hF : Drawing.IsCircuitOf F D.rad.G) (hm : F.E.ncard ≤ m) : IsPatch D F + (D.ins F) m := by + obtain ⟨u, W, -, -, hV, -⟩ := id hF.2 + exact ⟨hF.1, isPreconnected_U_of_isCircuit hF.2, ⟨u, by rw [hV]; exact W.start_mem_support⟩, .inl + ⟨hF, hm, rfl⟩⟩ + +omit [T2Space S] in +/-- Facts on the set of a patch, for `2 m` below the bound of the slope. -/ +theorem IsPatch.closed (h : IsPatch D F A m) (hrep : m < 2 * D.rep) : IsClosed A := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨-, -, -, ⟨hF, hm, rfl⟩ | ⟨rfl, -⟩⟩ := h + · exact (ins_facts_of_length (D.isSlope (by omega)) hF.2 hF.1 (show F.length < _ from by + exact lt_of_le_of_lt hm hrep)).1 + · exact isClosed_empty + +omit [T2Space S] in +theorem IsPatch.frontier_subset (h : IsPatch D F A m) (hrep : m < 2 * D.rep) : frontier A ⊆ F.U + := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨-, -, -, ⟨hF, hm, rfl⟩ | ⟨rfl, -⟩⟩ := h + · exact (ins_facts_of_length (D.isSlope (by omega)) hF.2 hF.1 (show F.length < _ from by + exact lt_of_le_of_lt hm hrep)).2.1.le + · simp + +omit [T2Space S] in +theorem IsPatch.mem_interior (h : IsPatch D F A m) (hrep : m < 2 * D.rep) + (hx : x ∈ A \ F.U) : x ∈ interior A := by + by_contra hn + exact hx.2 (h.frontier_subset hrep ⟨subset_closure hx.1, hn⟩) + +omit [T2Space S] in +theorem IsPatch.region_side (h : IsPatch D F A m) (hrep : m < 2 * D.rep) {q : Set Shat} + (hq : q ∈ D.rad.G.R) + (hm : (q ∩ A).Nonempty) : q ⊆ A := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨-, -, -, ⟨hF, hle, rfl⟩ | ⟨rfl, -⟩⟩ := h + · rcases region_subset_or_disjoint (D.isSlope (by omega)) hF.2 hF.1 + (lt_of_le_of_lt hle hrep) hq with h' | h' + · exact h' + · obtain ⟨z, h₁, h₂⟩ := hm + exact absurd h₂ (disjoint_left.mp h' h₁) + · simp at hm + +omit [T2Space S] in +/-- A region of `Γ*` with a point of the interior of a patch in its closure lies in the patch. -/ +theorem IsPatch.region_side_of_closure (h : IsPatch D F A m) (hrep : m < 2 * D.rep) {q : Set Shat} + (hq : q ∈ D.rad.G.R) + (hx : x ∈ A \ F.U) (hcl : x ∈ closure q) : q ⊆ A := by + obtain ⟨z, hz₁, hz₂⟩ := mem_closure_iff.mp hcl _ isOpen_interior (h.mem_interior hrep hx) + exact h.region_side hrep hq ⟨z, hz₂, interior_subset hz₁⟩ + +omit [T2Space S] in +/-- An edge of `Γ*` that meets a patch lies in it. -/ +theorem IsPatch.edge_side (h : IsPatch D F A m) (hrep : m < 2 * D.rep) {g : Set Shat} + (hg : g ∈ D.rad.G.E) + (hm : (g ∩ A).Nonempty) : g ⊆ A := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨-, -, -, ⟨hF, hle, rfl⟩ | ⟨rfl, -⟩⟩ := h + · rcases edge_subset_or_disjoint_of_length (D.isSlope (by omega)) hF.2 hF.1 + (lt_of_le_of_lt hle hrep) hg with h' | h' + · exact h' + · obtain ⟨z, h₁, h₂⟩ := hm + exact absurd h₂ (disjoint_left.mp h' h₁) + · simp at hm + +omit [T2Space S] in +/-- An edge of `Γ*` with an end in the interior of a patch lies in it. -/ +theorem IsPatch.edge_side_of_closure (h : IsPatch D F A m) (hrep : m < 2 * D.rep) {g : Set Shat} + (hg : g ∈ D.rad.G.E) + (hx : x ∈ A \ F.U) (hcl : x ∈ closure g) : g ⊆ A := by + obtain ⟨z, hz₁, hz₂⟩ := mem_closure_iff.mp hcl _ isOpen_interior (h.mem_interior hrep hx) + exact h.edge_side hrep hg ⟨z, hz₂, interior_subset hz₁⟩ + +omit [T2Space S] in +theorem IsPatch.isPreconnected (h : IsPatch D F A m) (hrep : m < 2 * D.rep) : IsPreconnected A := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨-, -, -, ⟨hF, hle, rfl⟩ | ⟨rfl, -⟩⟩ := h + · have hd := (D.isSlope (by omega)).isClosedDisc F hF.2 hF.1 (lt_of_le_of_lt hle hrep) + exact hd.isPreconnected_discInt.subset_closure sdiff_subset hd.subset_closure_discInt + · exact isPreconnected_empty + +theorem IsPatch.dist_le (h : IsPatch D F A m) (hr : 1 ≤ D.rep) (hrep : m < 2 * D.rep) {a b : Set + Shat} + (ha : (a ∩ A).Nonempty) (hb : (b ∩ A).Nonempty) : 2 * D.dist a b ≤ m := by + obtain ⟨-, -, -, ⟨hF, hle, rfl⟩ | ⟨rfl, -⟩⟩ := h + · exact (dist_le_of_circuit D hr hF (lt_of_le_of_lt hle hrep) ha hb).trans hle + · simp at ha + +omit [T2Space S] in +theorem IsPatch.U_subset (h : IsPatch D F A m) (hrep : m < 2 * D.rep) (hn : A.Nonempty) : F.U ⊆ A + := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨-, -, -, ⟨hF, hle, rfl⟩ | ⟨rfl, -⟩⟩ := h + · exact (ins_facts_of_length (D.isSlope (by omega)) hF.2 hF.1 (lt_of_le_of_lt hle hrep)).2.2 + · simp at hn + +omit [T2Space S] in +theorem IsPatch.subsingleton_of_empty (h : IsPatch D F A m) (hrep : m < 2 * D.rep) (hA : A + = ∅) : F.V.Subsingleton := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨-, -, ⟨v, hv⟩, ⟨hF, hle, rfl⟩ | ⟨-, -, hs⟩⟩ := h + · have := (ins_facts_of_length (D.isSlope (by omega)) hF.2 hF.1 (lt_of_le_of_lt hle hrep)).2.2 + (F.V_subset_U hv) + rw [hA] at this + exact absurd this (notMem_empty v) + · exact hs + +/-- What the proof of (12.4) knows about a vertex `x`, the vertex `y = y(x)`, `C = C_x`, `H = H_x`. +-/ +structure IsCentre (D : TangleDatum cap χ) (t : ℕ) (x y : Shat) (C H : Drawing Shat) + (A B : Set Shat) : Prop where + four_le : 4 ≤ t + x_mem : x ∈ D.rad.G.V + rep_ge : 25 * t ≤ D.rep + patchC : IsPatch D C A (2 * t) + patchH : IsPatch D H B (8 * t + 4) + y_mem : y ∈ C.V + x_cases : x ∈ A \ C.U ∨ (A = ∅ ∧ y = x) + y_cases : y ∈ B \ H.U ∨ (B = ∅ ∧ y ∈ H.V) + +namespace IsCentre + +variable (h : IsCentre D t x y C H A B) +include h + +omit [T2Space S] in +omit [T2Space Shat] in +theorem rep₁ : 2 * t < 2 * D.rep := by + have := h.four_le + have := h.rep_ge + omega + +omit [T2Space S] in +omit [T2Space Shat] in +theorem rep₂ : 8 * t + 4 < 2 * D.rep := by + have := h.four_le + have := h.rep_ge + omega + +omit [T2Space S] in +omit [T2Space Shat] in +theorem hsub : H.IsSubdrawing D.rad.G := h.patchH.1 + +omit [T2Space S] in +/-- A vertex of `C` is joined to `y` by a walk of at most `t` edges. -/ +theorem exists_walk_C {c : Shat} (hc : c ∈ C.V) : ∃ W : GraphWalk D.rad.G.toGraph c y, W.length ≤ t + := by + obtain ⟨hs, -, -, ⟨hF, hm, -⟩ | ⟨-, -, hss⟩⟩ := h.patchC + · obtain ⟨W, hl, -⟩ := exists_walk_on_circuit hF hc h.y_mem + exact ⟨W, by omega⟩ + · obtain rfl := hss hc h.y_mem + exact ⟨.nil (hs.1 hc), Nat.zero_le _⟩ + +omit [T2Space S] in +/-- A walk to `y` from outside the interior of `H` shows that its start is near `H`. -/ +theorem isNear_of_walk {c : Shat} (W : GraphWalk D.rad.G.toGraph c y) (hc : c ∉ B \ H.U) : + D.IsNear H W.length c := by + rcases h.y_cases with hy | ⟨-, hy⟩ + · obtain ⟨-, -, -, ⟨hF, hm, rfl⟩ | ⟨rfl, -⟩⟩ := h.patchH + · have hrep : 1 ≤ D.rep := by + have hrep_ge := h.rep_ge + have ht := h.four_le + omega + obtain ⟨z, hz, W', hW'⟩ := + exists_walk_to_circuit D hrep hF (lt_of_le_of_lt hm h.rep₂) W hc hy + exact ⟨z, hz, W', hW'⟩ + · exact absurd hy.1 (notMem_empty y) + · exact ⟨y, hy, W, le_rfl⟩ + +omit [T2Space S] [T2Space Shat] h in +/-- A vertex within `2t - 2` steps of `H` lies in the zone, as does a vertex of `R*` one step +further. -/ +theorem mem_zone {k j : ℕ} {c : Shat} (hN : D.IsNear H j c) (h₁ : c ∈ D.P.Γ.hatV cap → j ≤ k + 1) + (h₂ : j ≤ k + 2) : + D.rad.atomOf c ⊆ nearZone D H k := by + by_cases hx : c ∈ D.P.Γ.hatV cap + · obtain ⟨v, hv, rfl⟩ := hx + rw [D.atomOf_emb hv] + rintro _ rfl + exact .inl ⟨mem_image_of_mem _ hv, hN.mono (h₁ (mem_image_of_mem _ hv))⟩ + · have hw : c ∈ D.rad.Rstar := ⟨hN.mem_V, hx⟩ + rw [atomOf_Rstar D hw] + exact fun z hz ↦ .inr (mem_iUnion₂.mpr ⟨c, ⟨hw, hN.mono h₂⟩, hz⟩) + +/-- The frontier of the set lies in the zone. -/ +theorem frontier_sub {k : ℕ} (hk : k + 3 = 2 * t) : frontier (A ∪ B) ⊆ nearZone D H k := by + have : ConnectedSpace Shat := cap.connected + have ht := h.four_le + have hzH : H.U ⊆ nearZone D H k := subset_nearZone h.hsub + refine (frontier_union_subset A B).trans (union_subset ?_ ?_) + · rintro p ⟨hp, hpB⟩ + have hpI : p ∉ interior B := fun hi ↦ by + rw [closure_compl] at hpB + exact hpB hi + have hpB' : p ∉ B \ H.U := fun h' ↦ hpI (h.patchH.mem_interior h.rep₂ h') + have hpC := h.patchC.frontier_subset h.rep₁ hp + have hCs := h.patchC.1 + by_cases hpV : p ∈ C.V + · obtain ⟨W, hW⟩ := h.exists_walk_C hpV + exact mem_zone ((h.isNear_of_walk W hpB').mono hW) (fun _ ↦ by omega) (by omega) + (D.mem_atomOf (hCs.1 hpV)) + obtain ⟨g, hg, hpg⟩ := C.exists_edge_of_mem hpC hpV + by_cases hpB₂ : p ∈ B + · by_contra hn + exact hpB' ⟨hpB₂, fun h' ↦ hn (hzH h')⟩ + have hgG := hCs.2 hg + obtain ⟨a, ha, w, hw, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 g hgG + have hwm : w ∈ closure g ∩ D.rad.G.V := by + rw [hcap] + exact .inr rfl + have hwC : w ∈ C.V := by + have := (hCs.closure_inter_V hg).symm ▸ hwm + exact this.2 + have hwB : w ∉ B \ H.U := fun h' ↦ hpB₂ (h.patchH.edge_side_of_closure h.rep₂ hgG h' hwm.1 hpg) + obtain ⟨W, hW⟩ := h.exists_walk_C hwC + have hN := (h.isNear_of_walk W hwB).mono hW + have hsub := mem_zone (k := k) hN (fun _ ↦ by omega) (by omega) + rw [atomOf_Rstar D hw] at hsub + exact hsub (edge_subset_regionOf D hw hgG hwm.1 hpg) + · rintro p ⟨-, hp⟩ + exact hzH (h.patchH.frontier_subset h.rep₂ hp) + +omit [T2Space S] in +omit [T2Space Shat] in +theorem rep₀ : 4 ≤ D.rep := by + have := h.four_le + have := h.rep_ge + omega + +omit [T2Space S] in +omit [T2Space Shat] in +theorem y_G : y ∈ D.rad.G.V := h.patchC.1.1 h.y_mem + +/-- The bound between `x` and `y`. -/ +theorem dist_x_y : D.dist (D.rad.atomOf x) (D.rad.atomOf y) ≤ t := by + rcases h.x_cases with hx | ⟨-, rfl⟩ + · have hy := h.patchC.U_subset h.rep₁ ⟨x, hx.1⟩ (C.V_subset_U h.y_mem) + have := h.patchC.dist_le (by have := h.rep₀; omega) h.rep₁ (a := D.rad.atomOf x) (b + := D.rad.atomOf y) + ⟨x, D.mem_atomOf h.x_mem, hx.1⟩ ⟨y, D.mem_atomOf h.y_G, hy⟩ + omega + · rw [D.dist_self] + exact Nat.zero_le _ + +/-- The bound between `y` and a vertex of `H`. -/ +theorem dist_h_y {z : Shat} (hz : z ∈ H.V) : D.dist (D.rad.atomOf z) (D.rad.atomOf y) ≤ 4 * t + 2 + := by + rcases h.y_cases with hy | ⟨hB, hy⟩ + · have hz' := h.patchH.U_subset h.rep₂ ⟨y, hy.1⟩ (H.V_subset_U hz) + have := h.patchH.dist_le (by have := h.rep₀; omega) h.rep₂ (a := D.rad.atomOf z) (b + := D.rad.atomOf y) + ⟨z, D.mem_atomOf (h.hsub.1 hz), hz'⟩ ⟨y, D.mem_atomOf h.y_G, hy.1⟩ + omega + · obtain rfl := h.patchH.subsingleton_of_empty h.rep₂ hB hz hy + rw [D.dist_self] + exact Nat.zero_le _ + +/-- Two vertices of `H` are close. -/ +theorem dist_h_h {z z' : Shat} (hz : z ∈ H.V) (hz' : z' ∈ H.V) : + D.dist (D.rad.atomOf z) (D.rad.atomOf z') ≤ 4 * t + 2 := by + by_cases hB : B = ∅ + · obtain rfl := h.patchH.subsingleton_of_empty h.rep₂ hB hz hz' + rw [D.dist_self] + exact Nat.zero_le _ + · obtain ⟨b, hb⟩ := nonempty_iff_ne_empty.mpr hB + have hU := h.patchH.U_subset h.rep₂ ⟨b, hb⟩ + have := h.patchH.dist_le (by have := h.rep₀; omega) h.rep₂ (a := D.rad.atomOf z) (b + := D.rad.atomOf z') + ⟨z, D.mem_atomOf (h.hsub.1 hz), hU (H.V_subset_U hz)⟩ ⟨z', D.mem_atomOf (h.hsub.1 hz'), hU + (H.V_subset_U hz')⟩ + omega + +/-- An atom that meets the set of `C ∪ H` is close to a vertex of `H`. -/ +theorem dist_h_atom {z : Shat} (hz : z ∈ H.V) {a : Set Shat} (ha : (a ∩ (A ∪ B)).Nonempty) : + D.dist (D.rad.atomOf z) a ≤ 5 * t + 2 := by + have hr := h.rep₀ + rcases ha with ⟨p, hpa, hp | hp⟩ + · have hy := h.patchC.U_subset h.rep₁ ⟨p, hp⟩ (C.V_subset_U h.y_mem) + have h₁ := h.patchC.dist_le (by omega) h.rep₁ (a := D.rad.atomOf y) (b := a) + ⟨y, D.mem_atomOf h.y_G, hy⟩ ⟨p, hpa, hp⟩ + have h₂ := h.dist_h_y hz + have h₃ := D.dist_triangle hr (a := D.rad.atomOf z) (c := a) (D.atomOf_mem h.y_G) + omega + · have hz' := h.patchH.U_subset h.rep₂ ⟨p, hp⟩ (H.V_subset_U hz) + have h₁ := h.patchH.dist_le (by omega) h.rep₂ (a := D.rad.atomOf z) (b := a) + ⟨z, D.mem_atomOf (h.hsub.1 hz), hz'⟩ ⟨p, hpa, hp⟩ + omega + +/-- The zone and the two patches together are connected. -/ +theorem isPreconnected_union {k : ℕ} : IsPreconnected (nearZone D H k ∪ (A ∪ B)) := by + have hzone : IsPreconnected (nearZone D H k) := isPreconnected_nearZone h.hsub h.patchH.2.1 + h.patchH.2.2.1 + have hzH : H.U ⊆ nearZone D H k := subset_nearZone h.hsub + have h₁ : IsPreconnected (nearZone D H k ∪ B) := by + by_cases hB : B = ∅ + · rw [hB, union_empty] + exact hzone + · obtain ⟨b, hb⟩ := nonempty_iff_ne_empty.mpr hB + obtain ⟨v, hv⟩ := h.patchH.2.2.1 + have hvU := H.V_subset_U hv + exact hzone.union v (hzH hvU) (h.patchH.U_subset h.rep₂ ⟨b, + hb⟩ hvU) (h.patchH.isPreconnected h.rep₂) + have hyz : y ∈ nearZone D H k ∪ B := by + rcases h.y_cases with hy | ⟨-, hy⟩ + · exact .inr hy.1 + · exact .inl (hzH (H.V_subset_U hy)) + have h₂ : IsPreconnected ((nearZone D H k ∪ B) ∪ A) := by + by_cases hA : A = ∅ + · rw [hA, union_empty] + exact h₁ + · obtain ⟨b, hb⟩ := nonempty_iff_ne_empty.mpr hA + exact h₁.union y hyz (h.patchC.U_subset h.rep₁ ⟨b, hb⟩ (C.V_subset_U h.y_mem)) + (h.patchC.isPreconnected h.rep₁) + have he : nearZone D H k ∪ (A ∪ B) = (nearZone D H k ∪ B) ∪ A := by + ext p + simp only [mem_union] + tauto + rw [he] + exact h₂ + +/-- The condition at a cuff. If an edge with a vertex on a cuff has a near corner, then the cuff has +pole `x`, by the +distance between the members of `X₂`. So this vertex is next to `x` or on `C`, and the ends of the +edge are near `H`. -/ +theorem cuff {k : ℕ} (hk : k + 3 = 2 * t) (hsep : ∀ p ∈ D.rad.poles, p ≠ x + → 24 * t < D.vDist x p) {q : Set Shat} + (hq : q ∈ D.rad.G.R) {e : Set S} (he : e ∈ D.P.Γ.E) (heq : cap.emb '' e ⊆ q) (h3 : + (tilde e).ncard = 3) + (hb : (closure e ∩ bd S).Nonempty) {w : Shat} (hw : w ∈ D.rad.Rstar) (hN : D.IsNear H (k + 2) w) + (hm : (q ∩ D.rad.regionOf w).Nonempty) : q ⊆ A ∪ B ∨ ∀ v ∈ tilde e, D.IsNear H (k + 3) + (cap.emb v) := by + classical + have : ConnectedSpace Shat := cap.connected + have hS := χ.isSurface + have h3c := D.P.fits.internally_three_connected + have hr := h.rep₀ + have ht := h.four_le + have hre := h.rep_ge + obtain ⟨a, hae, hab⟩ := hb + have haV : a ∈ tilde e := by + refine ⟨hae, fun hae' ↦ ?_⟩ + have := (D.P.Γ.border_edge e he ⟨a, hae', hab⟩).1 + omega + have haG : a ∈ D.P.Γ.V := D.P.Γ.tilde_subset_V he haV + obtain ⟨Θ, hΘ, haΘ⟩ := mem_sUnion.mp ((sUnion_cuffs (S := S)).symm ▸ hab : a ∈ ⋃₀ cuffs S) + obtain ⟨p, hp, -, hreg⟩ := D.rad.exists_pole hΘ + obtain ⟨g, hg, hcap⟩ := D.rad.exists_pole_edge hS h3c hp hΘ hreg haG haΘ + have hag : cap.emb a ∈ D.rad.G.V := D.rad.isPreRadial.2.1 (mem_image_of_mem _ haG) + have hlink : D.rad.G.toGraph.IsLink g (cap.emb a) p := ⟨hg, hag, hp.1.1, hcap⟩ + have hacl : cap.emb a ∈ closure q := + closure_mono heq (image_closure_subset_closure_image cap.isEmbedding.continuous + (mem_image_of_mem _ hae)) + by_cases hpx : p = x + · subst hpx + have hpcl : p ∈ closure g ∩ D.rad.G.V := by + rw [hcap] + exact .inr rfl + have hacl' : cap.emb a ∈ closure g ∩ D.rad.G.V := by + rw [hcap] + exact .inl rfl + have hwalk : (q ⊆ A ∪ B) ∨ ∃ W : GraphWalk D.rad.G.toGraph (cap.emb a) y, W.length ≤ t := by + rcases h.x_cases with hx | ⟨-, rfl⟩ + · have hgA := h.patchC.edge_side_of_closure h.rep₁ hg hx hpcl.1 + have haA : cap.emb a ∈ A := closure_minimal hgA (h.patchC.closed h.rep₁) hacl'.1 + by_cases haU : cap.emb a ∈ C.U + · exact .inr (h.exists_walk_C (mem_V_of_mem_U h.patchC.1 haU hag)) + · exact .inl ((h.patchC.region_side_of_closure h.rep₁ hq ⟨haA, + haU⟩ hacl).trans subset_union_left) + · exact .inr ⟨.cons hlink (.nil hp.1.1), by + rw [GraphWalk.length_cons] + change 0 + 1 ≤ t + omega⟩ + rcases hwalk with hsub | ⟨W, hW⟩ + · exact .inl hsub + by_cases haB : cap.emb a ∈ B \ H.U + · exact .inl ((h.patchH.region_side_of_closure h.rep₂ hq haB hacl).trans subset_union_right) + have hNa : D.IsNear H t (cap.emb a) := (h.isNear_of_walk W haB).mono hW + refine .inr fun v hv ↦ ?_ + by_cases hva : a = v + · exact hva ▸ hNa.mono (by omega) + · exact (IsNear.across_side he h3 haV hv hva hNa).mono (by omega) + · exfalso + obtain ⟨z, hz, W, hWl⟩ := hN + have hs := hsep p hp (Ne.symm (Ne.symm hpx)) + change 24 * t < D.dist _ _ at hs + have d₁ := h.dist_x_y + have d₂ := h.dist_h_y hz + rw [D.dist_comm] at d₂ + have d₃ : D.dist (D.rad.atomOf z) (D.rad.atomOf w) ≤ W.length := by + rw [D.dist_comm] + exact D.dist_atomOf_le_of_walk W (by omega) + have d₄ : D.dist (D.rad.atomOf w) (D.rad.atomOf (cap.emb a)) ≤ 3 := by + rw [atomOf_Rstar D hw] + exact dist_closure_region_le D hr hq hm ⟨cap.emb a, D.mem_atomOf hag, hacl⟩ + have d₅ : D.dist (D.rad.atomOf (cap.emb a)) (D.rad.atomOf p) ≤ 1 := + D.dist_atomOf_le_of_walk (.cons hlink (.nil hp.1.1)) (by + rw [GraphWalk.length_cons] + change 0 + 1 < D.rep + omega) + have t₁ := D.dist_triangle hr (a := D.rad.atomOf x) (c := D.rad.atomOf p) (D.atomOf_mem h.y_G) + have t₂ := D.dist_triangle hr (a := D.rad.atomOf y) (c := D.rad.atomOf p) (D.atomOf_mem + (h.hsub.1 hz)) + have t₃ := D.dist_triangle hr (a := D.rad.atomOf z) (c := D.rad.atomOf p) (D.atomOf_mem hw.1) + have t₄ := D.dist_triangle hr (a := D.rad.atomOf w) (c := D.rad.atomOf p) (D.atomOf_mem hag) + omega + +/-- The set around the centre can play the part of `Y` in (12.1). -/ +theorem isZoneSet {k : ℕ} (hk : k + 3 = 2 * t) (hsep : ∀ p ∈ D.rad.poles, p ≠ x + → 24 * t < D.vDist x p) : + IsZoneSet D H k (A ∪ B) where + closed := (h.patchC.closed h.rep₁).union (h.patchH.closed h.rep₂) + meet := by + rintro q hq ⟨p, hp, hA | hB⟩ + · exact (h.patchC.region_side h.rep₁ hq ⟨p, hp, hA⟩).trans subset_union_left + · exact (h.patchH.region_side h.rep₂ hq ⟨p, hp, hB⟩).trans subset_union_right + frontier_sub := h.frontier_sub hk + cuff := fun q hq e he heq h3 hb w hw hN hm ↦ h.cuff hk hsep hq he heq h3 hb hw hN hm + +/-- The wheel `W_x` of the proof of (12.4). -/ +theorem exists_wheel (hsep : ∀ p ∈ D.rad.poles, p ≠ x → 24 * t < D.vDist x p) + (hhub : (H.V.ncard = 1 ∧ H.E = ∅ ∧ + ∀ H' : Drawing Shat, IsEnclave D.tb D.ord D.𝒯 H' → H'.E.ncard ≤ 4 * (2 * t) + 4 → + ¬ (H.V ⊆ D.ins H' \ H'.U)) ∨ + (IsEnclave D.tb D.ord D.𝒯 H ∧ H.E.ncard ≤ 4 * (2 * t) + 4 ∧ + ∀ H' : Drawing Shat, IsEnclave D.tb D.ord D.𝒯 H' → H' ≠ H → H'.E.ncard ≤ 4 * (2 * t) + 4 → + ¬ (H.U ⊆ D.ins H'))) : + ∃ W k, k + 3 = 2 * t ∧ D.IsWheelHubOfRadius W H (2 * t) ∧ nearZone D H k ∪ + (A ∪ B) ⊆ W \ discBd W ∧ + ∀ p ∈ W, ∃ a ∈ D.P.Γ.atoms cap, p ∈ a ∧ D.dist (D.rad.atomOf x) a ≤ 11 * t + 13 := by + have ht := h.four_le + have hre := h.rep_ge + have hr := h.rep₀ + obtain ⟨k, hk⟩ : ∃ k, k + 3 = 2 * t := ⟨2 * t - 3, by omega⟩ + obtain ⟨z, hz⟩ := h.patchH.2.2.1 + rw [← hk] at hhub + obtain ⟨W, hW, hzone, hfar⟩ := GraphMinor.GM19.TangleDatum.exists_wheel (by omega) h.hsub hz + (h.isZoneSet hk hsep) h.isPreconnected_union + (fun z' hz' ↦ (h.dist_h_h hz hz').trans (by omega)) + (fun a _ ha ↦ (h.dist_h_atom hz ha).trans (by omega)) hhub + rw [hk] at hW + refine ⟨W, k, hk, hW, hzone, fun p hp ↦ ?_⟩ + obtain ⟨a, ha, hpa, hd⟩ := hfar p hp + refine ⟨a, ha, hpa, ?_⟩ + have d₁ := h.dist_x_y + have d₂ := h.dist_h_y hz + rw [D.dist_comm] at d₂ + have t₁ := D.dist_triangle hr (a := D.rad.atomOf x) (c := a) (D.atomOf_mem h.y_G) + have t₂ := D.dist_triangle hr (a := D.rad.atomOf y) (c := a) (D.atomOf_mem (h.hsub.1 hz)) + omega + +end IsCentre + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section12j.lean b/LeanPool/GraphMinor/GM19/Section12j.lean new file mode 100644 index 0000000000..b7cc6fd1d7 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section12j.lean @@ -0,0 +1,179 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section12i + +/-! +# Graph Minors XIX, Section 12: tools for the wheels of (12.4) + +Atoms are disjoint (`atom_eq_of_mem`). The set of a walk is connected +(`isPreconnected_walkDrawing_U`). Two vertices of a +closed walk are joined along it by at most half of it (`exists_walk_on_closed_walk`). Each point of +the boundary of a wheel +lies in the atom of a vertex that is next to a vertex of `Γ` on the boundary (`exists_atom_on_bd`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- The set of a walk is connected. -/ +theorem isPreconnected_walkDrawing_U {T : Type} [TopologicalSpace T] [T2Space T] {G : Drawing T} {u + v : T} + (W : GraphWalk G.toGraph u v) : IsPreconnected (walkDrawing G W).U := + GraphWalk.drawing_U_isPreconnected G W + +/-- Two vertices of a closed walk are joined by a walk of at most half its length, with its vertices +on the closed walk. -/ +theorem exists_walk_on_closed_walk {α' β : Type*} {G : Graph α' β} {u a b : α'} + (K : GraphWalk G u u) (ha : a ∈ K.support) + (hb : b ∈ K.support) : ∃ W : GraphWalk G a b, 2 * W.length ≤ K.length := by + obtain ⟨P, Q, rfl⟩ := K.exists_append_of_mem ha + have hl : (P.append Q).length = P.length + Q.length := GraphWalk.length_append _ _ + rw [hl] + have hmin : ∀ {A B : GraphWalk G a b}, A.length + B.length = P.length + Q.length → + ∃ W : GraphWalk G a b, 2 * W.length ≤ P.length + Q.length := by + intro A B h + by_cases hle : A.length ≤ B.length + · exact ⟨A, by omega⟩ + · exact ⟨B, by omega⟩ + rcases (GraphWalk.mem_support_append P Q).mp hb with h | h + · obtain ⟨P₁, P₂, rfl⟩ := P.exists_append_of_mem h + refine hmin (A := P₂.reverse) (B := Q.append P₁) ?_ + rw [GraphWalk.length_reverse, GraphWalk.length_append, GraphWalk.length_append] + omega + · obtain ⟨Q₁, Q₂, rfl⟩ := Q.exists_append_of_mem h + refine hmin (A := Q₁) (B := P.reverse.append Q₂.reverse) ?_ + rw [GraphWalk.length_append, GraphWalk.length_append, GraphWalk.length_reverse, + GraphWalk.length_reverse] + omega + +namespace TangleDatum + +omit [T2Space S] [T2Space Shat] in +/-- Atoms are disjoint or equal. -/ +theorem atom_eq_of_mem (D : TangleDatum cap χ) {a b : Set Shat} (ha : a ∈ D.P.Γ.atoms cap) + (hb : b ∈ D.P.Γ.atoms cap) {p : Shat} + (hpa : p ∈ a) (hpb : p ∈ b) : a = b := by + have hinj := cap.isEmbedding.injective + have hregU : ∀ {r : Set Shat}, r ∈ D.P.Γ.hatRegions cap → p ∈ r → p ∉ D.P.Γ.hatU cap + := fun hr hp ↦ by + obtain ⟨x, -, rfl⟩ := hr + exact connectedComponentIn_subset _ _ hp + have hUv : ∀ {v : S}, v ∈ D.P.Γ.V → cap.emb v ∈ D.P.Γ.hatU cap := fun hv ↦ mem_image_of_mem _ + (D.P.Γ.V_subset hv) + have hUe : ∀ {e : Set S}, e ∈ D.P.Γ.E → ∀ {x}, x ∈ e → cap.emb x ∈ D.P.Γ.hatU cap := fun he _ hx ↦ + mem_image_of_mem _ (he.2.1 hx).1 + rcases atom_cases ha with ⟨v, hv, rfl⟩ | ⟨e, he, rfl⟩ | hr <;> rcases atom_cases hb with ⟨v', + hv', rfl⟩ | ⟨e', he', rfl⟩ | hr' + · obtain rfl : p = _ := hpa + have hvv : cap.emb v = cap.emb v' := hpb + rw [hvv] + · obtain rfl : p = _ := hpa + obtain ⟨x, hx, hxe⟩ := hpb + obtain rfl := hinj hxe + exact absurd hv ((he'.2.1 hx).2) + · obtain rfl : p = _ := hpa + exact absurd (hUv hv) (hregU hr' hpb) + · obtain rfl : p = _ := hpb + obtain ⟨x, hx, hxe⟩ := hpa + obtain rfl := hinj hxe + exact absurd hv' ((he.2.1 hx).2) + · obtain ⟨x, hx, rfl⟩ := hpa + obtain ⟨x', hx', hxe⟩ := hpb + obtain rfl := hinj hxe + have hun : IsPathConnected (e ∪ e') := he.2.2.1.union he'.2.2.1 ⟨x', hx, hx'⟩ + have h₁ := he.2.2.2 (e ∪ e') (union_subset he.2.1 he'.2.1) hun subset_union_left + have h₂ := he'.2.2.2 (e ∪ e') (union_subset he.2.1 he'.2.1) hun subset_union_right + rw [h₁.symm.trans h₂] + · obtain ⟨x, hx, rfl⟩ := hpa + exact absurd (hUe he hx) (hregU hr' hpb) + · obtain rfl : p = _ := hpb + exact absurd (hUv hv') (hregU hr hpa) + · obtain ⟨x, hx, rfl⟩ := hpb + exact absurd (hUe he' hx) (hregU hr hpa) + · obtain ⟨x, -, rfl⟩ := hr + obtain ⟨y, -, rfl⟩ := hr' + exact (connectedComponentIn_eq hpa).trans (connectedComponentIn_eq hpb).symm + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} + +omit [T2Space S] in +/-- A vertex of a circuit of `Γ*` outside `V(Γ)` has an edge of the circuit, to a vertex of `Γ`. -/ +theorem exists_edge_at_Rstar {C : Drawing Shat} (hC : Drawing.IsCircuitOf C D.rad.G) {t : Shat} + (ht : t ∈ C.V) + (hth : t ∉ D.P.Γ.hatV cap) : ∃ g ∈ C.E, ∃ v ∈ C.V, v ∈ D.P.Γ.hatV cap ∧ closure g ∩ D.rad.G.V + = {t, v} := by + classical + obtain ⟨b, hb, hbt⟩ : ∃ b ∈ C.V, b ≠ t := by + obtain ⟨u, W₀, -, hpos, hCV, -⟩ := id hC.2 + cases W₀ with + | nil h' => simp [GraphWalk.length] at hpos + | @cons _ x _ e hl r => + have huC : u ∈ C.V := by rw [hCV]; exact .head _ + have hxC : x ∈ C.V := by + rw [hCV] + exact .tail _ r.start_mem_support + have hlG : D.rad.G.toGraph.IsLink e u x := + ⟨hC.1.2 hl.1, hC.1.1 hl.2.1, hC.1.1 hl.2.2.1, by rw [← hC.1.closure_inter_V hl.1]; exact + hl.2.2.2⟩ + by_cases hu : u = t + · refine ⟨x, hxC, fun hxt ↦ ?_⟩ + have hq := hatV_of_not_hatV D hlG.1 hlG.2.2.2 (by rw [hu]; exact hth) + exact hth (hxt ▸ hq) + · exact ⟨u, huC, hu⟩ + obtain ⟨P, Q, hP, hQ, hPs, hQs, -, -, -, hdisj, -⟩ := hC.2.exists_two_paths ht hb hbt.symm + obtain ⟨g₁, hg₁, w₁, hw₁, -, hc₁, -⟩ := first_step (hPs.trans hC.1) hbt.symm hP + exact ⟨g₁, hPs.2 hg₁, w₁, hPs.1 hw₁, hatV_of_not_hatV D (hC.1.2 (hPs.2 hg₁)) hc₁ hth, hc₁⟩ + +/-- Each point of the boundary of a wheel lies in the atom of a vertex that equals, or is next to, a +vertex of `Γ` on +the boundary. -/ +theorem IsWheelHubOfRadius.exists_atom_on_bd (h : D.IsWheelHubOfRadius W H ρ) {p : Shat} + (hp : p ∈ discBd W) : + ∃ v, v ∈ (cap.emb '' D.Γ.V) ∩ discBd W ∧ ∃ w, p ∈ D.rad.atomOf w ∧ + (w ∈ D.rad.G.V) ∧ (w = v ∨ ∃ g, D.rad.G.toGraph.IsLink g v w) := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + obtain ⟨F, hFc, hFs, hFU⟩ := exists_circuit_of_oArc h.is_disc.isOArc_discBd h.bd_sub + have hFG : Drawing.IsCircuitOf F D.rad.G := ⟨hFs, hFc⟩ + have hVb : ∀ {x}, x ∈ F.V → x ∈ discBd W := fun hx ↦ hFU ▸ F.V_subset_U hx + by_cases hpV : p ∈ F.V + · by_cases hph : p ∈ D.P.Γ.hatV cap + · exact ⟨p, ⟨hph, hp⟩, p, D.mem_atomOf (hFs.1 hpV), hFs.1 hpV, .inl rfl⟩ + · obtain ⟨g, hg, v, hv, hvh, hcap⟩ := exists_edge_at_Rstar hFG hpV hph + refine ⟨v, ⟨hvh, hVb hv⟩, p, D.mem_atomOf (hFs.1 hpV), hFs.1 hpV, .inr ⟨g, hFs.2 hg, + hFs.1 hv, hFs.1 hpV, ?_⟩⟩ + rw [hcap, pair_comm] + · rw [← hFU] at hp + obtain ⟨g, hg, hpg⟩ := F.exists_edge_of_mem hp hpV + have hgG := hFs.2 hg + obtain ⟨a, ha, r, hr, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 g hgG + have ham : a ∈ closure g ∩ D.rad.G.V := by + rw [hcap] + exact .inl rfl + have hrm : r ∈ closure g ∩ D.rad.G.V := by + rw [hcap] + exact .inr rfl + have haF : a ∈ F.V := ((hFs.closure_inter_V hg).symm ▸ ham : a ∈ closure g ∩ F.V).2 + refine ⟨a, ⟨ha, hVb haF⟩, r, ?_, hr.1, .inr ⟨g, hgG, ham.2, hrm.2, hcap⟩⟩ + rw [atomOf_Rstar D hr] + exact edge_subset_regionOf D hr hgG hrm.1 hpg + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section12k.lean b/LeanPool/GraphMinor/GM19/Section12k.lean new file mode 100644 index 0000000000..cdf33c3e92 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section12k.lean @@ -0,0 +1,416 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section12j + +/-! +# Graph Minors XIX, Section 12: steps (1)-(4) of (12.4) + +Here `W` is the wheel around a centre, from `IsCentre.exists_wheel`, and the structure +`IsCentredWheel` records it. The +results are the steps (1), (2), (3) and (4) of the proof of (12.4). The paper keeps the maximal +wheels and says that it can +prove more: the wheels of the different centres are disjoint. This is what we prove, in +`IsCentredWheel.disjoint`, since it +is shorter. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +/-- The wheel `W` around a centre, with what the construction of (12.1) gives. -/ +structure IsCentredWheel (D : TangleDatum cap χ) (t : ℕ) (x y : Shat) (C H : Drawing Shat) + (A B W : Set Shat) (k : ℕ) : + Prop where + centre : IsCentre D t x y C H A B + k_eq : k + 3 = 2 * t + hub : D.IsWheelHubOfRadius W H (2 * t) + zone : nearZone D H k ∪ (A ∪ B) ⊆ W \ discBd W + far : ∀ p ∈ W, ∃ a ∈ D.P.Γ.atoms cap, p ∈ a ∧ D.dist (D.rad.atomOf x) a ≤ 11 * t + 13 + +namespace IsCentredWheel + +variable {D : TangleDatum cap χ} {t k : ℕ} {x y : Shat} {C H : Drawing Shat} {A B W : Set Shat} +variable (h : IsCentredWheel D t x y C H A B W k) +include h + +/-- Step (1): `x` lies inside the wheel. -/ +theorem x_mem : x ∈ W \ discBd W := by + rcases h.centre.x_cases with hx | ⟨-, rfl⟩ + · exact h.zone (.inr (.inl hx.1)) + · rcases h.centre.y_cases with hy | ⟨-, hy⟩ + · exact h.zone (.inr (.inr hy.1)) + · exact h.zone (.inl (subset_nearZone h.centre.hsub (H.V_subset_U hy))) + +omit [T2Space S] in +/-- Step (1): the neighbours of `x` lie inside the wheel. -/ +theorem nbr_mem {g : Set Shat} {n : Shat} (hl : D.rad.G.toGraph.IsLink g x n) : n ∈ W \ discBd W + := by + have ht := h.centre.four_le + have hk := h.k_eq + have hx₁ : x ∈ closure g ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact .inl rfl + have hn₁ : n ∈ closure g ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact .inr rfl + rcases h.centre.x_cases with hx | ⟨-, rfl⟩ + · have hgA := h.centre.patchC.edge_side_of_closure h.centre.rep₁ hl.1 hx hx₁.1 + exact h.zone (.inr (.inl (closure_minimal hgA (h.centre.patchC.closed h.centre.rep₁) hn₁.1))) + · by_cases hnB : n ∈ B \ H.U + · exact h.zone (.inr (.inr hnB.1)) + · have hlr : D.rad.G.toGraph.IsLink g n y := ⟨hl.1, hn₁.2, hx₁.2, by rw [hl.2.2.2, pair_comm]⟩ + have hN := h.centre.isNear_of_walk (.cons hlr (.nil hx₁.2)) hnB + rw [GraphWalk.length_cons] at hN + exact h.zone (.inl (IsCentre.mem_zone (k := k) hN (fun _ ↦ by change 0 + 1 ≤ k + 1; omega) + (by change 0 + 1 ≤ k + 2; omega) (D.mem_atomOf hn₁.2))) + +/-- Step (2): a vertex of `Γ` on the boundary of the wheel is close to `x`. -/ +theorem dist_bd {v : Shat} (hv : v ∈ (cap.emb '' D.Γ.V) ∩ discBd W) : + D.dist (D.rad.atomOf x) (D.rad.atomOf v) ≤ 7 * t + 2 := by + have ht := h.centre.four_le + have hre := h.centre.rep_ge + have hr := h.centre.rep₀ + obtain ⟨⟨P, z, hz, hP, hle⟩, -⟩ := h.hub.bd_dist v hv + obtain ⟨K, hK⟩ := GraphMinor.GM19.Drawing.IsPathOf.exists_walk hP + have d₃ := D.dist_atomOf_le_of_walk K (by omega) + rw [D.dist_comm] at d₃ + have d₁ := h.centre.dist_x_y + have d₂ := h.centre.dist_h_y hz + rw [D.dist_comm] at d₂ + have t₁ := D.dist_triangle hr (a := D.rad.atomOf x) (c := D.rad.atomOf v) + (D.atomOf_mem h.centre.y_G) + have t₂ := D.dist_triangle hr (a := D.rad.atomOf y) (c := D.rad.atomOf v) (D.atomOf_mem + (h.centre.hsub.1 hz)) + omega + +/-- A point of the boundary of the wheel lies in an atom close to `x`. -/ +theorem exists_atom_bd {p : Shat} (hp : p ∈ discBd W) : ∃ a ∈ D.P.Γ.atoms cap, p ∈ a ∧ + D.dist (D.rad.atomOf x) a ≤ 7 * t + 3 := by + have ht := h.centre.four_le + have hre := h.centre.rep_ge + have hr := h.centre.rep₀ + obtain ⟨v, hv, w, hpw, hwG, hcases⟩ := h.hub.exists_atom_on_bd hp + refine ⟨D.rad.atomOf w, D.atomOf_mem hwG, hpw, ?_⟩ + have d := h.dist_bd hv + rcases hcases with rfl | ⟨g, hl⟩ + · omega + · have d₁ : D.dist (D.rad.atomOf v) (D.rad.atomOf w) ≤ 1 := + D.dist_atomOf_le_of_walk (.cons hl (.nil hwG)) (by + rw [GraphWalk.length_cons] + change 0 + 1 < D.rep + omega) + have t₁ := D.dist_triangle hr (a := D.rad.atomOf x) (c := D.rad.atomOf w) (D.atomOf_mem hl.2.1) + omega + +/-- Step (3): the boundary of the wheel avoids the capped part of `Σ̂` and `bd(Σ)`. -/ +theorem bd_in_interior (hsep : ∀ p ∈ D.rad.poles, p ≠ x → 24 * t < D.vDist x p) : + discBd W ⊆ cap.emb '' (univ \ bd S) := by + classical + have : ConnectedSpace Shat := cap.connected + have hS := χ.isSurface + have h3c := D.P.fits.internally_three_connected + have ht := h.centre.four_le + have hre := h.centre.rep_ge + have hr := h.centre.rep₀ + intro p hp + by_contra hpn + obtain ⟨v, hv, w, hpw, hwG, hcases⟩ := h.hub.exists_atom_on_bd hp + -- a pole next to a vertex on the boundary is impossible + have hno : ∀ {r v' : Shat} {g : Set Shat}, r ∈ D.rad.poles → v' ∈ (cap.emb '' D.Γ.V) ∩ discBd W → + D.rad.G.toGraph.IsLink g v' r → False := by + intro r v' g hrp hv' hl + by_cases hrx : r = x + · subst hrx + have hl' : D.rad.G.toGraph.IsLink g r v' := ⟨hl.1, hl.2.2.1, hl.2.1, by rw [hl.2.2.2, + pair_comm]⟩ + exact (h.nbr_mem hl').2 hv'.2 + · have hs := hsep r hrp (Ne.symm (Ne.symm hrx)) + change 24 * t < D.dist _ _ at hs + have d := h.dist_bd hv' + have d₁ : D.dist (D.rad.atomOf v') (D.rad.atomOf r) ≤ 1 := + D.dist_atomOf_le_of_walk (.cons hl (.nil hl.2.2.1)) (by + rw [GraphWalk.length_cons] + change 0 + 1 < D.rep + omega) + have t₁ := D.dist_triangle hr (a := D.rad.atomOf x) (c := D.rad.atomOf r) + (D.atomOf_mem hl.2.1) + omega + by_cases hw : w ∈ D.P.Γ.hatV cap + · -- `p = w` is a vertex of `Γ`, on `bd(Σ)` + obtain ⟨a, haV, rfl⟩ := hw + rw [D.atomOf_emb haV] at hpw + obtain rfl : p = _ := hpw + have hab : a ∈ bd S := by + by_contra hn + exact hpn ⟨a, ⟨mem_univ _, hn⟩, rfl⟩ + obtain ⟨Θ, hΘ, haΘ⟩ := mem_sUnion.mp ((sUnion_cuffs (S := S)).symm ▸ hab : a ∈ ⋃₀ cuffs S) + obtain ⟨r, hrp, -, hreg⟩ := D.rad.exists_pole hΘ + obtain ⟨g, hg, hcap⟩ := D.rad.exists_pole_edge hS h3c hrp hΘ hreg haV haΘ + exact hno hrp ⟨mem_image_of_mem _ haV, hp⟩ ⟨hg, hwG, hrp.1.1, hcap⟩ + · -- `p` lies in a region of `Γ` that is not in `Σ` + have hwR : w ∈ D.rad.Rstar := ⟨hwG, hw⟩ + rw [atomOf_Rstar D hwR] at hpw + have hpU : p ∉ D.P.Γ.hatU cap := by + have := (connectedComponentIn_subset _ _ hpw : p ∈ _) + exact this + have hpr : p ∉ range cap.emb := by + rintro ⟨a, rfl⟩ + exact hpn ⟨a, ⟨mem_univ _, fun hb ↦ hpU (mem_image_of_mem _ (D.P.Γ.bd_subset hb))⟩, rfl⟩ + have hwp : w ∈ D.rad.poles := ⟨hwR, fun hsub ↦ hpr (hsub hpw)⟩ + rcases hcases with rfl | ⟨g, hl⟩ + · exact hw hv.1 + · exact hno hwp hv hl + +/-- The last condition of a cover: the wheel has a vertex of `Γ` inside. -/ +theorem interior_vertex : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty := by + classical + have ht := h.centre.four_le + have hk := h.k_eq + obtain ⟨p, -, -, hp, -⟩ := h.hub.is_disc.isOArc_discBd.exists_three + obtain ⟨v, hv, -⟩ := h.hub.exists_atom_on_bd hp + obtain ⟨⟨P, z, hz, hP, -⟩, -⟩ := h.hub.bd_dist v hv + obtain ⟨K, -⟩ := GraphMinor.GM19.Drawing.IsPathOf.exists_walk hP + have hzW := h.hub.H_in_int (H.V_subset_U hz) + by_cases hzh : z ∈ D.P.Γ.hatV cap + · exact ⟨z, hzW, hzh⟩ + have hne : z ≠ v := fun e ↦ hzW.2 (e ▸ hv.2) + obtain ⟨T, -⟩ : ∃ T : GraphWalk D.rad.G.toGraph z v, T = K.reverse := ⟨_, rfl⟩ + cases T with + | nil _ => exact absurd rfl hne + | @cons _ n _ g hl r => + have hnh := hatV_of_not_hatV D hl.1 hl.2.2.2 hzh + have hlr : D.rad.G.toGraph.IsLink g n z := ⟨hl.1, hl.2.2.1, hl.2.1, by rw [hl.2.2.2, pair_comm]⟩ + have hN : D.IsNear H (0 + 1) n := (isNear_self h.centre.hsub hz).step hlr + exact ⟨n, h.zone (.inl (IsCentre.mem_zone (k := k) hN (fun _ ↦ by omega) (by omega) + (D.mem_atomOf hl.2.2.1))), hnh⟩ + +end IsCentredWheel + +omit [T2Space S] in +/-- A connected set that misses a short circuit lies inside it or misses its inside. -/ +theorem side_of_ins (D : TangleDatum cap χ) {F : Drawing Shat} (hF : Drawing.IsCircuitOf F D.rad.G) + (hlt : F.E.ncard < 2 * D.rep) {X : Set Shat} (hX : IsPreconnected X) (hdis : Disjoint X F.U) : + X ⊆ D.ins F \ F.U ∨ Disjoint X (D.ins F) := by + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hs := D.ins_spec hF hlt + have hbd : discBd (D.ins F) = F.U := hs.2.2.2.1 + rw [← hbd] at hdis ⊢ + exact hs.2.2.1.side hman hX hdis + +namespace IsCentredWheel + +variable {D : TangleDatum cap χ} {t k k' : ℕ} {x y x' y' : Shat} {C H C' H' : Drawing Shat} {A B W + A' B' W' : Set Shat} + +/-- The boundary of a wheel misses the wheel of another centre. -/ +theorem disjoint_bd (h : IsCentredWheel D t x y C H A B W k) (h' : IsCentredWheel D t x' y' C' H' + A' B' W' k') + (hlt : 24 * t < D.vDist x x') : Disjoint (discBd W) W' := by + have ht := h.centre.four_le + have hr := h.centre.rep₀ + rw [disjoint_left] + intro p hp hp' + obtain ⟨a, ha, hpa, hd⟩ := h.exists_atom_bd hp + obtain ⟨a', ha', hpa', hd'⟩ := h'.far p hp' + obtain rfl := D.atom_eq_of_mem ha ha' hpa hpa' + have t₁ := D.dist_triangle hr (a := D.rad.atomOf x) (c := D.rad.atomOf x') ha + rw [D.dist_comm a] at t₁ + change 24 * t < D.dist _ _ at hlt + omega + +/-- The wheels of different centres are disjoint. -/ +theorem disjoint (h : IsCentredWheel D t x y C H A B W k) (h' : IsCentredWheel D t x' y' C' H' A' + B' W' k') + (hlt : 24 * t < D.vDist x x') : Disjoint W W' := by + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hlt' : 24 * t < D.vDist x' x := by + change 24 * t < D.dist _ _ at hlt ⊢ + rwa [D.dist_comm] + have hd := h'.hub.is_disc + have hc : IsPreconnected W' := hd.isPreconnected_discInt.subset_closure sdiff_subset + hd.subset_closure_discInt + rcases h.hub.is_disc.side hman hc (h.disjoint_bd h' hlt).symm with hsub | hdis + · exfalso + obtain ⟨q, -, -, hq, -⟩ := hd.isOArc_discBd.exists_three + exact disjoint_left.mp (h'.disjoint_bd h hlt') hq (hsub (Surface.discBd_subset _ hq)).1 + · exact hdis.symm + +/-- Step (4): an edge of `Γ` within `t` of `x` lies in the wheel. The hypothesis says that `A` is +maximal. -/ +theorem edge_subset (h : IsCentredWheel D t x y C H A B W k) + (hmax : ∀ F : Drawing Shat, Drawing.IsCircuitOf F D.rad.G → F.E.ncard ≤ 2 * t + → x ∈ D.ins F \ F.U → + ¬ A ⊆ D.ins F \ F.U) {e : Set S} (he : e ∈ D.P.Γ.E) (hde : D.edgeVertDist e x + ≤ t) : cap.emb '' e ⊆ W := by + classical + have : ConnectedSpace Shat := cap.connected + have ht := h.centre.four_le + have hre := h.centre.rep_ge + have hr := h.centre.rep₀ + have hxG := h.centre.x_mem + have hoff : Disjoint (cap.emb '' e) D.rad.G.U := disc_edge_disjoint D.rad ⟨subset_rfl, + subset_rfl⟩ he + have hne : cap.emb '' e ≠ D.rad.atomOf x := fun heq ↦ by + have hx : x ∈ cap.emb '' e := heq ▸ D.mem_atomOf hxG + exact disjoint_left.mp hoff hx (D.rad.G.V_subset_U hxG) + obtain ⟨T, ha, hb, hT⟩ := D.exists_of_dist_lt hne (lt_of_le_of_lt hde (by omega)) + rw [D.ins_eq_insWalk T] at ha hb + have hlen := T.walk_len + change D.dist _ _ ≤ t at hde + set K := walkDrawing D.rad.G T.walk with hKdef + have hKs : K.IsSubdrawing D.rad.G := walkDrawing_isSubdrawing _ _ + have hKV : ∀ {u}, u ∈ K.V → u ∈ T.walk.support := fun {u} hu ↦ by + rw [hKdef, walkDrawing_V] at hu + exact hu + have hEle : ∀ {F : Drawing Shat}, F.IsSubdrawing K → F.E.ncard ≤ 2 * t := by + intro F hF + have hle : F.E.ncard ≤ T.walk.edges.length := by + refine (ncard_le_ncard ?_ (T.walk.edges.finite_toSet)).trans (ncard_mem_list_le T.walk.edges) + intro g hg + have := hF.2 hg + rwa [hKdef, walkDrawing_E] at this + have : T.walk.length = T.walk.edges.length := rfl + omega + have hmemIns : ∀ {X : Set Shat}, (X ∩ insWalk D.ins D.rad.G T.walk).Nonempty → Disjoint X K.U → + ∃ F : Drawing Shat, F.IsCircuit ∧ F.IsSubdrawing K ∧ (X ∩ D.ins F).Nonempty := by + rintro X ⟨z, hzX, hz⟩ hdis + rcases hz with hz | hz + · exact absurd hz (disjoint_left.mp hdis hzX) + · obtain ⟨F, ⟨hFc, hFs⟩, hzF⟩ := mem_iUnion₂.mp hz + exact ⟨F, hFc, hFs, z, hzX, hzF⟩ + obtain ⟨F, hFc, hFs, hzF⟩ := hmemIns ha (hoff.mono_right hKs.U_subset) + have hFG : Drawing.IsCircuitOf F D.rad.G := ⟨hFs.trans hKs, hFc⟩ + have hFl : F.E.ncard < 2 * D.rep := lt_of_le_of_lt (hEle hFs) (by omega) + obtain ⟨q, hq, heq⟩ := D.exists_region_of_edge he + have hqF : q ⊆ D.ins F := by + rcases region_subset_or_disjoint (D.isSlope (by omega)) hFG.2 hFG.1 hFl hq with h' | h' + · exact h' + · obtain ⟨z, hz₁, hz₂⟩ := hzF + exact absurd hz₂ (disjoint_left.mp h' (heq hz₁)) + refine heq.trans (hqF.trans ?_) + by_cases hm : ∃ m, m ∈ K.V ∧ m ∈ C.V + · obtain ⟨m, hmK, hmC⟩ := hm + refine h.hub.ins_subset_of_vertices hFG (by have := hEle hFs; omega) fun u hu huh ↦ ?_ + have huK := hFs.1 hu + obtain ⟨W₁, hW₁⟩ := exists_walk_on_closed_walk T.walk (hKV huK) (hKV hmK) + obtain ⟨W₂, hW₂⟩ := h.centre.exists_walk_C hmC + by_cases huB : u ∈ B \ H.U + · exact (h.zone (.inr (.inr huB.1))).1 + have hN := h.centre.isNear_of_walk (W₁.append W₂) huB + rw [GraphWalk.length_append] at hN + have hN' : D.IsNear H (2 * t) u := hN.mono (by omega) + exact h.hub.close_in_W u huh (isNear_iff_exists_path.mp hN') + have hUdis : Disjoint K.U C.U := by + rw [disjoint_left] + intro p hpK hpC + by_cases hpG : p ∈ D.rad.G.V + · exact hm ⟨p, mem_V_of_mem_U hKs hpK hpG, mem_V_of_mem_U h.centre.patchC.1 hpC hpG⟩ + · obtain ⟨f, hf, hpf⟩ := K.exists_edge_of_mem hpK fun h' ↦ hpG (hKs.1 h') + obtain ⟨f', hf', hpf'⟩ := C.exists_edge_of_mem hpC fun h' ↦ hpG (h.centre.patchC.1.1 h') + obtain rfl := D.rad.G.edge_eq_of_mem (hKs.2 hf) (h.centre.patchC.1.2 hf') hpf hpf' + obtain ⟨a, ha', w₀, hw₀, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 f (hKs.2 hf) + have ham : a ∈ closure f ∩ D.rad.G.V := by + rw [hcap] + exact .inl rfl + exact hm ⟨a, ((hKs.closure_inter_V hf).symm ▸ ham : a ∈ closure f ∩ K.V).2, + ((h.centre.patchC.1.closure_inter_V hf').symm ▸ ham : a ∈ closure f ∩ C.V).2⟩ + by_cases hKA : (K.U ∩ A).Nonempty + · -- `K` lies inside `C` + obtain ⟨-, -, -, ⟨hC, hle, rfl⟩ | ⟨rfl, -⟩⟩ := id h.centre.patchC + · have hClt : C.E.ncard < 2 * D.rep := lt_of_le_of_lt hle h.centre.rep₁ + have hsl := D.isSlope (by omega) + rcases side_of_ins D hC hClt (isPreconnected_walkDrawing_U T.walk) hUdis with h' | h' + · have hsub : D.ins F ⊆ D.ins C := hsl.monotone F C hFG.2 hFG.1 hFl hC.2 hC.1 hClt + (hFs.U_subset.trans (h'.trans sdiff_subset)) + exact hsub.trans fun z hz ↦ (h.zone (.inr (.inl hz))).1 + · obtain ⟨z, hz₁, hz₂⟩ := hKA + exact absurd hz₂ (disjoint_left.mp h' hz₁) + · simp at hKA + -- then `x` is inside a circuit of `K`, against the choice of `C` + exfalso + have hxK : x ∉ K.U := by + rcases h.centre.x_cases with hx | ⟨-, rfl⟩ + · exact fun h' ↦ hKA ⟨x, h', hx.1⟩ + · exact fun h' ↦ hm ⟨_, mem_V_of_mem_U hKs h' hxG, h.centre.y_mem⟩ + have hatom : Disjoint (D.rad.atomOf x) K.U := by + rw [disjoint_left] + intro p hpa hpK + by_cases hxh : x ∈ D.P.Γ.hatV cap + · obtain ⟨v, hv, rfl⟩ := hxh + rw [D.atomOf_emb hv] at hpa + obtain rfl : p = _ := hpa + exact hxK hpK + have hxR : x ∈ D.rad.Rstar := ⟨hxG, hxh⟩ + rw [atomOf_Rstar D hxR] at hpa + have hreg := D.rad.regionOf_mem hxR + have huniq : ∀ {w}, w ∈ D.rad.regionOf x → w ∈ D.rad.G.V → w = x := fun hw hwG ↦ + (D.rad.isPreRadial.2.2.1 _ hreg.1).unique ⟨hw, hwG⟩ ⟨hreg.2, hxG⟩ + by_cases hpG : p ∈ D.rad.G.V + · exact hxK (huniq hpa hpG ▸ hpK) + obtain ⟨f, hf, hpf⟩ := K.exists_edge_of_mem hpK fun h' ↦ hpG (hKs.1 h') + obtain ⟨a, -, w, hw, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 f (hKs.2 hf) + have hwm : w ∈ closure f ∩ D.rad.G.V := by + rw [hcap] + exact .inr rfl + have hpw := edge_subset_regionOf D hw (hKs.2 hf) hwm.1 hpf + have heqr : D.rad.regionOf x = D.rad.regionOf w := + (connectedComponentIn_eq hpa).trans (connectedComponentIn_eq hpw).symm + have hwx : w = x := huniq (heqr ▸ (D.rad.regionOf_mem hw).2) hw.1 + have hxf : x ∈ K.V := ((hKs.closure_inter_V hf).symm ▸ (hwx ▸ hwm : x ∈ closure f ∩ D.rad.G.V) : + x ∈ closure f ∩ K.V).2 + exact hxK (K.V_subset_U hxf) + obtain ⟨F', hF'c, hF's, hzF'⟩ := hmemIns hb hatom + have hF'G : Drawing.IsCircuitOf F' D.rad.G := ⟨hF's.trans hKs, hF'c⟩ + have hF'l : F'.E.ncard < 2 * D.rep := lt_of_le_of_lt (hEle hF's) (by omega) + have hatomc : IsPreconnected (D.rad.atomOf x) := by + by_cases hx : x ∈ D.P.Γ.hatV cap + · obtain ⟨v, hv, rfl⟩ := hx + rw [D.atomOf_emb hv] + exact isPreconnected_singleton + · rw [atomOf_Rstar D ⟨hxG, hx⟩] + exact isPreconnected_connectedComponentIn + have hxF' : x ∈ D.ins F' \ F'.U := by + rcases side_of_ins D hF'G hF'l hatomc (hatom.mono_right hF's.U_subset) with h' | h' + · exact h' (D.mem_atomOf hxG) + · obtain ⟨z, hz₁, hz₂⟩ := hzF' + exact absurd hz₂ (disjoint_left.mp h' hz₁) + refine hmax F' hF'G (hEle hF's) hxF' ?_ + by_cases hAe : A = ∅ + · rw [hAe] + exact empty_subset _ + have hxA : x ∈ A := by + rcases h.centre.x_cases with hx | ⟨h', -⟩ + · exact hx.1 + · exact absurd h' hAe + have hAdis : Disjoint A F'.U := by + rw [disjoint_left] + exact fun z hz hzU ↦ hKA ⟨z, hF's.U_subset hzU, hz⟩ + rcases side_of_ins D hF'G hF'l (h.centre.patchC.isPreconnected h.centre.rep₁) hAdis with h' | h' + · exact h' + · exact absurd hxF'.1 (disjoint_left.mp h' hxA) + +end IsCentredWheel + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section12l.lean b/LeanPool/GraphMinor/GM19/Section12l.lean new file mode 100644 index 0000000000..7d5a14eb04 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section12l.lean @@ -0,0 +1,267 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section12k + +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Graph Minors XIX, Section 12: (12.4) + +`exists_circuit_patch` chooses `C_x`, and `exists_hub_patch` chooses `H_x`. Then `theorem_12_4` +gives the cover. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {t : ℕ} {x y : Shat} + +omit [T2Space S] in +/-- The drawing with a single vertex is a patch. -/ +theorem isPatch_point (D : TangleDatum cap χ) {v : Shat} (hv : v ∈ D.rad.G.V) (m : ℕ) : + IsPatch D (walkDrawing D.rad.G (GraphWalk.nil hv)) ∅ m ∧ (walkDrawing D.rad.G + (GraphWalk.nil hv)).V = {v} ∧ + (walkDrawing D.rad.G (GraphWalk.nil hv)).E = ∅ := by + have hV : (walkDrawing D.rad.G (GraphWalk.nil hv)).V = {v} := by + rw [walkDrawing_V] + ext x + simp [GraphWalk.support] + have hE : (walkDrawing D.rad.G (GraphWalk.nil hv)).E = ∅ := by + rw [walkDrawing_E] + ext x + simp [GraphWalk.edges] + refine ⟨⟨walkDrawing_isSubdrawing _ _, isPreconnected_walkDrawing_U _, ⟨v, by rw [hV]; rfl⟩, .inr + ⟨rfl, hE, ?_⟩⟩, hV, hE⟩ + rw [hV] + exact subsingleton_singleton + +omit [T2Space S] in +/-- The choice of `C_x`: a circuit of at most `2t` edges with `x` strictly inside and its inside +maximal, if there is one. -/ +theorem exists_circuit_patch (D : TangleDatum cap χ) (ht : t < D.rep) + (hx : x ∈ D.rad.G.V) : + ∃ y C A, IsPatch D C A (2 * t) ∧ y ∈ C.V ∧ (x ∈ A \ C.U ∨ (A = ∅ ∧ y = x)) ∧ + ∀ F : Drawing Shat, Drawing.IsCircuitOf F D.rad.G → F.E.ncard ≤ 2 * t → x ∈ D.ins F \ F.U + → ¬ A ⊆ D.ins F \ F.U := by + classical + have : ConnectedSpace Shat := cap.connected + let 𝓢 : Set (Drawing Shat) := {F | Drawing.IsCircuitOf F D.rad.G ∧ F.E.ncard ≤ 2 * t + ∧ x ∈ D.ins F \ F.U} + have hfin : 𝓢.Finite := (finite_circuits D.rad.G).subset fun F hF ↦ ⟨hF.1.2, hF.1.1⟩ + by_cases hne : 𝓢.Nonempty + · obtain ⟨_, ⟨F, hF, rfl⟩, hmax⟩ := (hfin.image D.ins).exists_maximal (hne.image _) + have hP := IsPatch.of_circuit hF.1 hF.2.1 + obtain ⟨y, hy⟩ := hP.2.2.1 + refine ⟨y, F, D.ins F, hP, hy, .inl hF.2.2, fun F' h₁ h₂ h₃ hsub ↦ ?_⟩ + have hle : D.ins F' ⊆ D.ins F := hmax ⟨F', ⟨h₁, h₂, h₃⟩, rfl⟩ fun z hz ↦ (hsub hz).1 + have hP' := IsPatch.of_circuit h₁ h₂ + obtain ⟨v, hv⟩ := hP'.2.2.1 + have hU := hP'.U_subset (by omega) ⟨x, h₃.1⟩ (F'.V_subset_U hv) + exact (hsub (hle hU)).2 (F'.V_subset_U hv) + · obtain ⟨hP, hV, -⟩ := D.isPatch_point hx (2 * t) + refine ⟨x, _, ∅, hP, by rw [hV]; rfl, .inr ⟨rfl, rfl⟩, fun F h₁ h₂ h₃ _ ↦ hne ⟨F, h₁, h₂, h₃⟩⟩ + +omit [T2Space S] in +omit [T2Space Shat] in +/-- Two circuits of `Γ*` with the same set are equal. -/ +theorem eq_of_U_eq {F F' : Drawing Shat} (hF : F.IsSubdrawing D.rad.G) + (hF' : F'.IsSubdrawing D.rad.G) (he : F.U = F'.U) : + F = F' := by + have : ConnectedSpace Shat := cap.connected + have key : ∀ {A B : Drawing Shat}, A.IsSubdrawing D.rad.G → B.IsSubdrawing D.rad.G → A.U = B.U + → A.E ⊆ B.E := by + intro A B hA hB hU f hf + obtain ⟨z, hz⟩ := (hA.2 hf).2.2.1.nonempty + have hzV : z ∉ D.rad.G.V := ((hA.2 hf).2.1 hz).2 + have hzB : z ∈ B.U := hU ▸ (A.U_eq ▸ .inr (mem_iUnion₂.mpr ⟨f, hf, subset_closure hz⟩)) + obtain ⟨f', hf', hzf'⟩ := B.exists_edge_of_mem hzB fun h' ↦ hzV (hB.1 h') + exact D.rad.G.edge_eq_of_mem (hA.2 hf) (hB.2 hf') hz hzf' ▸ hf' + have keyV : ∀ {A B : Drawing Shat}, A.IsSubdrawing D.rad.G → B.IsSubdrawing D.rad.G → A.U = B.U + → A.V ⊆ B.V := + fun {A B} hA hB hU v hv ↦ mem_V_of_mem_U hB (hU ▸ A.V_subset_U hv) (hA.1 hv) + exact Drawing.ext_of_V_E ((keyV hF hF' he).antisymm (keyV hF' hF he.symm)) + ((key hF hF' he).antisymm (key hF' hF he.symm)) + +omit [T2Space S] in +/-- The choice of `H_x`: an enclave of at most `8t + 4` edges with `y` strictly inside and its +inside maximal, if there is +one. -/ +theorem exists_hub_patch (D : TangleDatum cap χ) (hre : 8 * t + 4 < 2 * D.rep) (ht : 1 ≤ D.rep) + (hy : y ∈ D.rad.G.V) : + ∃ H B, IsPatch D H B (8 * t + 4) ∧ (y ∈ B \ H.U ∨ (B = ∅ ∧ y ∈ H.V)) ∧ + ((H.V.ncard = 1 ∧ H.E = ∅ ∧ + ∀ H' : Drawing Shat, IsEnclave D.tb D.ord D.𝒯 H' → H'.E.ncard ≤ 4 * (2 * t) + 4 → + ¬ (H.V ⊆ D.ins H' \ H'.U)) ∨ + (IsEnclave D.tb D.ord D.𝒯 H ∧ H.E.ncard ≤ 4 * (2 * t) + 4 ∧ + ∀ H' : Drawing Shat, IsEnclave D.tb D.ord D.𝒯 H' → H' ≠ H → H'.E.ncard ≤ 4 * (2 * t) + 4 → + ¬ (H.U ⊆ D.ins H'))) := by + classical + have : ConnectedSpace Shat := cap.connected + have hcirc : ∀ {F : Drawing Shat}, IsEnclave D.tb D.ord D.𝒯 F → Drawing.IsCircuitOf F D.rad.G + := by + rintro F ⟨_, _, h⟩ + exact h.2.1 + let 𝓢 : Set (Drawing Shat) := {F | IsEnclave D.tb D.ord D.𝒯 F ∧ F.E.ncard ≤ 4 * (2 * t) + 4 + ∧ y ∈ D.ins F \ F.U} + have hfin : 𝓢.Finite := (finite_circuits D.rad.G).subset fun F hF ↦ ⟨(hcirc hF.1).2, + (hcirc hF.1).1⟩ + by_cases hne : 𝓢.Nonempty + · obtain ⟨_, ⟨F, hF, rfl⟩, hmax⟩ := (hfin.image D.ins).exists_maximal (hne.image _) + have hFc := hcirc hF.1 + have hP : IsPatch D F (D.ins F) (8 * t + 4) := IsPatch.of_circuit hFc (by have := hF.2.1; omega) + refine ⟨F, D.ins F, hP, .inl hF.2.2, .inr ⟨hF.1, hF.2.1, fun H' h₁ hne' h₂ hsub ↦ hne' ?_⟩⟩ + have hH'c := hcirc h₁ + have hl : F.length < 2 * D.rep := lt_of_le_of_lt hF.2.1 (by omega) + have hl' : H'.length < 2 * D.rep := lt_of_le_of_lt h₂ (by omega) + have hsl := D.isSlope ht + have hsubI := hsl.monotone F H' hFc.2 hFc.1 hl hH'c.2 hH'c.1 hl' hsub + have hyi : y ∈ interior (D.ins H') := + interior_mono hsubI (hP.mem_interior (by omega) hF.2.2) + have hyU : y ∉ H'.U := fun h' ↦ by + have hfr := (ins_facts_of_length hsl hH'c.2 hH'c.1 hl').2.1 + rw [← hfr] at h' + exact h'.2 hyi + have hsup : D.ins H' ⊆ D.ins F := hmax ⟨H', ⟨h₁, h₂, interior_subset hyi, hyU⟩, rfl⟩ hsubI + have heq : D.ins F = D.ins H' := hsubI.antisymm hsup + have hUU : F.U = H'.U := by + rw [← hsl.subBd_eq F hFc.2 hFc.1 hl, ← hsl.subBd_eq H' hH'c.2 hH'c.1 hl', heq] + exact (eq_of_U_eq hFc.1 hH'c.1 hUU).symm + · obtain ⟨hP, hV, hE⟩ := D.isPatch_point hy (8 * t + 4) + refine ⟨_, ∅, hP, .inr ⟨rfl, by rw [hV]; rfl⟩, .inl ⟨by rw [hV, ncard_singleton], hE, fun H' h₁ + h₂ hsub ↦ hne ?_⟩⟩ + refine ⟨H', h₁, h₂, hsub ?_⟩ + rw [hV] + rfl + +/-- Every centre has a wheel. -/ +theorem exists_centredWheel (D : TangleDatum cap χ) (ht : 4 ≤ t) (hre : 25 * t ≤ D.rep) + (hx : x ∈ D.rad.G.V) (hsep : ∀ p ∈ D.rad.poles, p ≠ x → 24 * t < D.vDist x p) : + ∃ y C H A B W k, IsCentredWheel D t x y C H A B W k ∧ + ∀ F : Drawing Shat, Drawing.IsCircuitOf F D.rad.G → F.E.ncard ≤ 2 * t → x ∈ D.ins F \ F.U + → ¬ A ⊆ D.ins F \ F.U := by + obtain ⟨y, C, A, hC, hy, hxc, hmax⟩ := D.exists_circuit_patch (t := t) (by omega) hx + have hyG : y ∈ D.rad.G.V := hC.1.1 hy + obtain ⟨H, B, hH, hyc, hhub⟩ := D.exists_hub_patch (t := t) (by omega) (by omega) hyG + have hc : IsCentre D t x y C H A B := ⟨ht, hx, hre, hC, hH, hy, hxc, hyc⟩ + obtain ⟨W, k, hk, hW, hzone, hfar⟩ := hc.exists_wheel hsep hhub + exact ⟨y, C, H, A, B, W, k, ⟨hc, hk, hW, hzone, hfar⟩, hmax⟩ + +omit [T2Space S] [T2Space Shat] in +/-- An edge with a label above `ω₀` is internal of size `k`, in a disjoint colour scheme. The paper: +"Since $\chi$ is disjoint, every member of $Z$ is internal". -/ +theorem mem_largeEdges (D : TangleDatum cap χ) (hd : χ.IsDisjoint) {k : ℕ} {ω₀ : α} + (hk : (k = 2 ∧ ω₀ ∈ χ.Ω2.E) ∨ (k = 3 ∧ ω₀ ∈ χ.Ω3.E)) {e : Set S} (he : e ∈ D.P.Γ.E) + (hle : χ.unionLE ω₀ (D.P.φ e)) : e ∈ D.largeEdges k ω₀ := by + classical + have hS := χ.isSurface + have hnot : ∀ s ∈ χ.Φ.sides, D.P.φ e ∉ (χ.ΩS s).E ∧ ((ω₀ ∈ (χ.ΩS s).E) → False) := by + intro s hs + rcases hk with ⟨-, h⟩ | ⟨-, h⟩ + · refine ⟨fun h' ↦ ?_, fun h' ↦ disjoint_left.mp (hd.disj_2_S s hs) h h'⟩ + rcases hle with ⟨-, h₂, -⟩ | ⟨h₃, -⟩ | ⟨s', hs', h₁, -⟩ + · exact disjoint_left.mp (hd.disj_2_S s hs) h₂ h' + · exact disjoint_left.mp hd.disj_2_3 h h₃ + · exact disjoint_left.mp (hd.disj_2_S s' hs') h h₁ + · refine ⟨fun h' ↦ ?_, fun h' ↦ disjoint_left.mp (hd.disj_3_S s hs) h h'⟩ + rcases hle with ⟨h₂, -⟩ | ⟨-, h₃, -⟩ | ⟨s', hs', h₁, -⟩ + · exact disjoint_left.mp hd.disj_2_3 h₂ h + · exact disjoint_left.mp (hd.disj_3_S s hs) h₃ h' + · exact disjoint_left.mp (hd.disj_3_S s' hs') h h₁ + have hint : Painting.IsInternal e := by + rw [Painting.IsInternal, disjoint_iff_inter_eq_empty, ← not_nonempty_iff_eq_empty] + intro hm + obtain ⟨-, hsub⟩ := D.P.Γ.border_edge e he hm + obtain ⟨s, hs, hes⟩ := exists_arcComp_superset (F := bd S \ χ.Φ.V) he.2.2.1 + (fun x hx ↦ ⟨hsub hx, fun hV ↦ D.P.Γ.disjoint_V he hx (D.P.fits.V_subset hV)⟩) + exact (hnot s hs).1 (D.P.border_mem e he s hs ⟨hm, hes⟩) + rcases D.P.Γ.size_cases he with h2 | h3 + · rcases hk with ⟨rfl, h⟩ | ⟨rfl, h⟩ + · refine ⟨he, hint, h2, .inl ⟨rfl, ?_⟩⟩ + rcases hle with ⟨-, -, h'⟩ | ⟨h₃, -⟩ | ⟨s', hs', h₁, -⟩ + · exact h' + · exact absurd h₃ (disjoint_left.mp hd.disj_2_3 h) + · exact absurd h₁ (disjoint_left.mp (hd.disj_2_S s' hs') h) + · exfalso + have hm := D.P.internal_2_mem e he hint h2 + rcases hle with ⟨h₂, -⟩ | ⟨-, h₃, -⟩ | ⟨s', hs', h₁, -⟩ + · exact disjoint_left.mp hd.disj_2_3 h₂ h + · exact disjoint_left.mp hd.disj_2_3 hm h₃ + · exact disjoint_left.mp (hd.disj_3_S s' hs') h h₁ + · rcases hk with ⟨rfl, h⟩ | ⟨rfl, h⟩ + · exfalso + have hm := D.P.internal_3_mem e he hint h3 + rcases hle with ⟨-, h₂, -⟩ | ⟨h₃, -⟩ | ⟨s', hs', h₁, -⟩ + · exact disjoint_left.mp hd.disj_2_3 h₂ hm + · exact disjoint_left.mp hd.disj_2_3 h h₃ + · exact disjoint_left.mp (hd.disj_2_S s' hs') h h₁ + · refine ⟨he, hint, h3, .inr ⟨rfl, ?_⟩⟩ + rcases hle with ⟨h₂, -⟩ | ⟨-, -, h'⟩ | ⟨s', hs', h₁, -⟩ + · exact absurd h (disjoint_left.mp hd.disj_2_3 h₂) + · exact h' + · exact absurd h₁ (disjoint_left.mp (hd.disj_3_S s' hs') h) + +/-- **Graph Minors XIX, (12.4)** (page 364): "There is a cover $\mathcal{W}$ with $|\mathcal{W}| \le +m + c(\Sigma_\chi)$, each member of +which has radius $\le 2n \cdot 5^{2m}$." Uses the proved VII (11.10) through (7.1). -/ +theorem theorem_12_4_proof (D : TangleDatum cap χ) (hd : χ.IsDisjoint) {m n k : ℕ} {ω₀ : α} + (hk : (k = 2 ∧ ω₀ ∈ χ.Ω2.E) ∨ (k = 3 ∧ ω₀ ∈ χ.Ω3.E)) (hn : 4 ≤ n) + (hfl : D.IsFlawedInternally m n k ω₀) : + ∃ 𝒲, D.IsWheelCover ω₀ 𝒲 ∧ 𝒲.ncard ≤ m + numCuffs S ∧ ∀ W ∈ 𝒲, D.wheelRadius W ≤ 2 * n * 5 ^ + (2 * m) := by + classical + obtain ⟨X₂, hX₂G, hX₂c, hpoles, t, hnt, htle, hsep, hedge⟩ := theorem_12_3_proof D hn hfl + have ht : 4 ≤ t := by omega + have hre : 25 * t ≤ D.rep := by + have h25 : 5 ^ (2 * m + 2) * n = 25 * (5 ^ (2 * m) * n) := by rw [pow_add]; ring + have := hfl.1 + omega + have hmain : ∀ x ∈ X₂, ∃ y C H A B W k, IsCentredWheel D t x y C H A B W k ∧ + ∀ F : Drawing Shat, Drawing.IsCircuitOf F D.rad.G → F.E.ncard ≤ 2 * t → x ∈ D.ins F \ F.U + → ¬ A ⊆ D.ins F \ F.U := + fun x hx ↦ D.exists_centredWheel ht hre (hX₂G hx) fun p hp hne ↦ hsep x hx p + (hpoles hp) hne.symm + have : ConnectedSpace Shat := cap.connected + have : Nonempty (Drawing Shat) := ⟨D.rad.G⟩ + choose! Y C H A B W K hW hmax using hmain + have hX₂fin : X₂.Finite := D.rad.G.finite_V.subset hX₂G + refine ⟨W '' X₂, ⟨hX₂fin.image _, ?_, ?_, ?_, ?_, ?_, ?_⟩, ?_, ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + exact ⟨H x, 2 * t, (hW x hx).hub⟩ + · rintro _ ⟨x, hx, rfl⟩ _ ⟨x', hx', rfl⟩ hne + exact (hW x hx).disjoint (hW x' hx') (hsep x hx x' hx' fun e ↦ hne (e ▸ rfl)) + · rintro _ ⟨x, hx, rfl⟩ + exact (hW x hx).bd_in_interior fun p hp hne ↦ hsep x hx p (hpoles hp) hne.symm + · intro r hr + exact ⟨W r, mem_image_of_mem _ (hpoles hr), (hW r (hpoles hr)).x_mem.1⟩ + · intro e he hle + obtain ⟨x, hx, hdx⟩ := hedge e (D.mem_largeEdges hd hk he hle) + exact ⟨W x, mem_image_of_mem _ hx, (hW x hx).edge_subset (hmax x hx) he hdx⟩ + · rintro _ ⟨x, hx, rfl⟩ + exact (hW x hx).interior_vertex + · exact (ncard_image_le hX₂fin).trans hX₂c + · rintro _ ⟨x, hx, rfl⟩ + have h₁ : D.wheelRadius (W x) ≤ 2 * t := Nat.sInf_le ⟨H x, (hW x hx).hub⟩ + have h₂ : 2 * n * 5 ^ (2 * m) = 2 * (5 ^ (2 * m) * n) := by ring + omega + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13a.lean b/LeanPool/GraphMinor/GM19/Section13a.lean new file mode 100644 index 0000000000..6236f81a49 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13a.lean @@ -0,0 +1,434 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section12l +public import LeanPool.GraphMinor.GM19.Section12c + +/-! +# Graph Minors XIX, Section 13: (13.1) + +(13.1) says that no vertex of `R*` on the boundary of a wheel is within `ρ - 1` steps of the hub. +The paper looks at the +edge `e` of `sk(Γ)` outside `W` next to `r*`. We take instead the region `q` of `Γ*` outside `W` +next to `r*`, and the edge +`c` of `Γ` in `q`. The two ends of the side of `c` on `rBar` lie on `bd(W)`. If `|cTilde| = 3`, the +fifth condition of "fit" says +that they are the only vertices of `Γ` in `rBar`. If `|cTilde| = 2`, then all of the frontier of `q` +lies on `bd(W)`, so `q` is +the whole of the complement of `W`, against `three_le_ncard_bd`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- A connected set off the vertices of a drawing that meets an edge lies in this edge. -/ +theorem Drawing.subset_edge_of_preconnected {T : Type} [TopologicalSpace T] [T2Space T] {G : + Drawing T} {g : Set T} + (hg : g ∈ G.E) {X : Set T} (hX : IsPreconnected X) (hXU : X ⊆ G.U) (hXV : Disjoint X G.V) (hm : + (X ∩ g).Nonempty) : + X ⊆ g := by + classical + have hcl : ∀ {f}, f ∈ G.E → closure f ⊆ f ∪ G.V := fun hf ↦ closure_edge_subset hf + have hsub : X ⊆ closure g ∪ ⋃ f ∈ G.E \ {g}, closure f := by + intro x hx + obtain ⟨f, hf, hxf⟩ := G.exists_edge_of_mem (hXU hx) (disjoint_left.mp hXV hx) + by_cases hfg : f = g + · exact .inl (subset_closure (hfg ▸ hxf)) + · exact .inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfg⟩, subset_closure hxf⟩) + have hfin : (G.E \ {g}).Finite := G.finite_edges.subset sdiff_subset + have hclosed : IsClosed (⋃ f ∈ G.E \ {g}, closure f) := hfin.isClosed_biUnion fun _ _ ↦ + isClosed_closure + by_contra hn + obtain ⟨z, hzX, hzg⟩ := not_subset.mp hn + have hzg' : (X ∩ ⋃ f ∈ G.E \ {g}, closure f).Nonempty := by + rcases hsub hzX with h | h + · rcases hcl hg h with h' | h' + · exact absurd h' hzg + · exact absurd h' (disjoint_left.mp hXV hzX) + · exact ⟨z, hzX, h⟩ + obtain ⟨y, hyX, hy₁, hy₂⟩ := isPreconnected_closed_iff.mp hX _ _ isClosed_closure hclosed hsub + (hm.mono (inter_subset_inter_right _ subset_closure)) hzg' + obtain ⟨f, ⟨hf, hfg⟩, hyf⟩ := mem_iUnion₂.mp hy₂ + rcases hcl hg hy₁ with h | h + · rcases hcl hf hyf with h' | h' + · exact hfg (G.edge_eq_of_mem hf hg h' h) + · exact disjoint_left.mp hXV hyX h' + · exact disjoint_left.mp hXV hyX h + +namespace TangleDatum + +/-- **The fifth condition, for a side.** Let `f` be a side, off `bd(Σ)`, of an edge `e` of size 3, +on the boundary of a +region `r` of `Γ`. If `x, y` are the two ends of `f`, then they are the only vertices of `Γ` in +`rBar`. This differs from +`vertex_mem_of_side` in that the third end of `e` may lie on `bd(Σ)`. -/ +theorem vertex_mem_of_side_off (D : TangleDatum cap χ) {e f : Set S} {r : Set Shat} + (hf : D.P.Γ.IsSkEdgeIn f e) + (h3 : (tilde e).ncard = 3) (hoff : closure f ∩ bd S = ∅) (hr : r ∈ D.P.Γ.hatRegions cap) + (hfr : cap.emb '' f ⊆ closure r) {x y v : S} (hxy : x ≠ y) (hxf : x ∈ closure f) + (hyf : y ∈ closure f) + (hxV : x ∈ D.P.Γ.V) (hyV : y ∈ D.P.Γ.V) (hv : v ∈ D.P.Γ.V) (hvr : cap.emb v ∈ closure r) : v + = x ∨ v = y := by + classical + have hS := χ.isSurface + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hc := cap.isClosedEmbedding hS + obtain ⟨p, hp⟩ := hf.mem.1 + have hpe := hf.subset hp + have hpr : cap.emb p ∈ closure r := hfr (mem_image_of_mem _ hp) + rcases hatRegion_cases cap D.P.Γ hr with hsub | ⟨Θ, hΘ, rfl⟩ + · obtain ⟨r₀, hr₀, rfl⟩ := Painting.exists_region_of_hat hr hsub + have hcl : ∀ {z : S}, cap.emb z ∈ closure (cap.emb '' r₀) → z ∈ closure r₀ := fun {z} hz ↦ by + rw [hc.closure_image_eq] at hz + obtain ⟨z', hz', hzz⟩ := hz + exact cap.isEmbedding.injective hzz ▸ hz' + by_contra hne + push Not at hne + have hcard : 3 ≤ (closure r₀ ∩ D.P.Γ.V).ncard := by + have hsub' : ({x, y, v} : Set S) ⊆ closure r₀ ∩ D.P.Γ.V := by + have hfcl : closure f ⊆ closure r₀ := closure_minimal + (fun z hz ↦ hcl (hfr (mem_image_of_mem _ hz))) isClosed_closure + rintro z (rfl | rfl | rfl) + · exact ⟨hfcl hxf, hxV⟩ + · exact ⟨hfcl hyf, hyV⟩ + · exact ⟨hcl hvr, hv⟩ + have h₃ : ({x, y, v} : Set S).ncard = 3 := by + rw [ncard_eq_three] + exact ⟨x, y, v, hxy, hne.1.symm, hne.2.symm, rfl⟩ + rw [← h₃] + exact ncard_le_ncard hsub' (D.P.Γ.finite_V.subset inter_subset_right) + have hmem : p ∈ e ∩ closure r₀ := ⟨hpe, hcl hpr⟩ + obtain ⟨z, hz, hzb⟩ := D.P.fits.size_three_region e hf.1 h3 r₀ hr₀ hcard + (connectedComponentIn (e ∩ closure r₀) p) ⟨p, hmem, rfl⟩ + -- the component lies in `f` + obtain ⟨Sk, hSk⟩ := exists_isSkHat hS cap D.P.Γ + have hfE : cap.emb '' f ∈ Sk.E := hSk.edge_iff.mpr ⟨f, hf.mem, rfl⟩ + set T := connectedComponentIn (e ∩ closure r₀) p with hTdef + have hTc : IsPreconnected (cap.emb '' T) := + isPreconnected_connectedComponentIn.image _ cap.isEmbedding.continuous.continuousOn + have hTsub : T ⊆ e ∩ closure r₀ := connectedComponentIn_subset _ _ + have hTU : cap.emb '' T ⊆ Sk.U := by + rintro _ ⟨t, ht, rfl⟩ + rw [hSk.hU] + refine mem_image_of_mem _ (.inr (mem_iUnion₂.2 ⟨e, ⟨hf.1, h3⟩, ?_⟩)) + by_contra hn + obtain ⟨hdisc, -⟩ := D.P.Γ.isDisc_of_three hf.1 h3 + obtain ⟨hC, hCbd⟩ := isClosedDisc_image hdisc cap.isEmbedding + have hint : cap.emb t ∈ discInt (cap.emb '' closure e) := by + refine ⟨mem_image_of_mem _ (subset_closure (hTsub ht).1), fun h ↦ ?_⟩ + rw [hCbd] at h + obtain ⟨z', hz', hzz⟩ := h + exact hn (cap.isEmbedding.injective hzz ▸ hz') + have htcl : cap.emb t ∈ closure (cap.emb '' r₀) := by + rw [hc.closure_image_eq] + exact mem_image_of_mem _ (hTsub ht).2 + obtain ⟨y, hyO, hyρ⟩ := mem_closure_iff.mp htcl _ (hC.isOpen_discInt hman) hint + obtain ⟨y', hy', rfl⟩ := hyO.1 + have hrU : Disjoint (cap.emb '' r₀) (D.P.Γ.hatU cap) := by + obtain ⟨x₀, -, hx₀⟩ := hr + rw [← hx₀, disjoint_left] + exact fun _ hx ↦ connectedComponentIn_subset _ _ hx + exact disjoint_left.mp hrU hyρ (mem_image_of_mem _ (D.P.Γ.closure_subset_U hf.1 hy')) + have hTV : Disjoint (cap.emb '' T) Sk.V := by + rw [disjoint_left, hSk.hV] + rintro _ ⟨z', hz', rfl⟩ ⟨z'', hz'', hzz⟩ + obtain rfl := cap.isEmbedding.injective hzz + exact D.P.Γ.disjoint_V hf.1 (hTsub hz').1 hz'' + have hsubf := Drawing.subset_edge_of_preconnected hfE hTc hTU hTV + ⟨cap.emb p, mem_image_of_mem _ (mem_connectedComponentIn hmem), mem_image_of_mem _ hp⟩ + have hTf : T ⊆ f := fun t ht ↦ by + obtain ⟨t', ht', htt⟩ := hsubf (mem_image_of_mem _ ht) + exact cap.isEmbedding.injective htt ▸ ht' + have hzf : z ∈ closure f ∩ bd S := ⟨closure_mono hTf hz, hzb⟩ + rw [hoff] at hzf + exact hzf.elim + · exfalso + have hpΘ : p ∈ Θ := cap.mem_of_emb_mem hΘ hpr + have : p ∈ closure f ∩ bd S := ⟨subset_closure hp, cuff_subset_bd ⟨Θ, hΘ⟩ hpΘ⟩ + rw [hoff] at this + exact this.elim + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} + +omit [T2Space S] in +/-- A region of `Γ*` lies inside a wheel or misses it. -/ +theorem IsWheelHubOfRadius.region_side (h : D.IsWheelHubOfRadius W H ρ) {q : Set Shat} + (hq : q ∈ D.rad.G.R) : + q ⊆ W \ discBd W ∨ Disjoint q W := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hdis : Disjoint q (discBd W) := by + rw [disjoint_left] + exact fun x hx hxb ↦ region_subset hq hx (h.bd_sub hxb) + exact h.is_disc.side hman (region_isPreconnected hq) hdis + +omit [T2Space S] in +/-- The complement of a wheel is connected. -/ +theorem IsWheelHubOfRadius.isConnected_compl (h : D.IsWheelHubOfRadius W H ρ) : IsConnected Wᶜ := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hnice : IsGammaNice D.rad.G W := by + refine ⟨{a ∈ D.rad.G.A | a ⊆ W}, fun a ha ↦ ha.1, Subset.antisymm (fun p hp ↦ ?_) + (sUnion_subset fun a ha ↦ ha.2)⟩ + by_cases hpU : p ∈ D.rad.G.U + · by_cases hpV : p ∈ D.rad.G.V + · exact ⟨{p}, ⟨.inl (.inl ⟨p, hpV, rfl⟩), by simpa using hp⟩, rfl⟩ + · obtain ⟨g, hg, hpg⟩ := D.rad.G.exists_edge_of_mem hpU hpV + rcases h.edge_side hg with h' | h' + · exact ⟨g, ⟨.inl (.inr hg), h'⟩, hpg⟩ + · exact absurd hp (disjoint_left.mp h' hpg) + · obtain ⟨q, hq, hpq⟩ := exists_region_of_notMem hpU + rcases h.region_side hq with h' | h' + · exact ⟨q, ⟨.inr hq, h'.trans sdiff_subset⟩, hpq⟩ + · exact absurd hp (disjoint_left.mp h' hpq) + have hne : W.Nonempty := by + obtain ⟨p, -, -, hp, -⟩ := h.is_disc.isOArc_discBd.exists_three + exact ⟨p, Surface.discBd_subset _ hp⟩ + have hu : W ≠ univ := by + intro he + obtain ⟨p, -, -, hp, -⟩ := h.is_disc.isOArc_discBd.exists_three + rw [← IsClosedDisc.frontier_eq_discBd hT h.is_disc, he, frontier_univ] at hp + exact hp + exact GraphMinor.GM11.isConnected_compl hT h.is_disc.isClosed hnice + (IsClosedDisc.isSimplyConnectedSet h.is_disc) hne hu + +omit [T2Space S] in +/-- A region of `Γ*` outside a wheel with its frontier in the wheel has the boundary of the wheel in +its closure. -/ +theorem IsWheelHubOfRadius.bd_subset_of_frontier (h : D.IsWheelHubOfRadius W H ρ) {q : Set Shat} + (hq : q ∈ D.rad.G.R) + (hdis : Disjoint q W) (hfr : frontier q ⊆ W) : discBd W ⊆ closure q := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + have hqo : IsOpen q := region_isOpen hq + obtain ⟨y, hy₀, hye⟩ := id hq + have hy : y ∈ q := hye ▸ mem_connectedComponentIn hy₀ + have hsub : Wᶜ ⊆ q := by + refine h.isConnected_compl.isPreconnected.subset_left_of_subset_union hqo + isClosed_closure.isOpen_compl + (disjoint_left.mpr fun x hx hn ↦ hn (subset_closure hx)) (fun x hx ↦ ?_) ⟨y, disjoint_left.mp + hdis hy, hy⟩ + by_cases hxc : x ∈ closure q + · refine .inl ?_ + by_contra hn + exact hx (hfr ⟨hxc, by rwa [hqo.interior_eq]⟩) + · exact .inr hxc + intro p hp + rw [← IsClosedDisc.frontier_eq_discBd hT h.is_disc] at hp + rw [frontier_eq_closure_inter_closure] at hp + exact closure_mono hsub hp.2 + +/-- **Graph Minors XIX, (13.1)** (page 366): "There is no path in $\Gamma^*$ from $R^* \cap bd(W)$ +to $V(H)$ with $\le \rho - 1$ edges." +The paper's "fourth condition" is the condition that `W` contains the vertices of `Γ` near `H`. -/ +theorem theorem_13_1_proof (h : D.IsWheelHubOfRadius W H ρ) (hbd : discBd W ⊆ cap.emb '' + (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) {r : Shat} (hr : r ∈ D.rad.Rstar) + (hrb : r ∈ discBd W) : + ¬ ∃ P : Drawing Shat, ∃ z ∈ H.V, P.IsPathOf D.rad.G r z ∧ P.E.ncard + 1 ≤ ρ := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hS := χ.isSurface + have h3t := D.P.fits.internally_three_connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + rintro ⟨P, z, hz, hP, hle⟩ + obtain ⟨K, hK⟩ := GraphMinor.GM19.Drawing.IsPathOf.exists_walk hP + have hH := h.H_sub + have hNr : D.IsNear H (ρ - 1) r := ⟨z, hz, K, by omega⟩ + set ρr := D.rad.regionOf r with hρr + have hρm := D.rad.regionOf_mem hr + -- the vertices of `Γ` around `r` lie in `W` + have hnbr : ∀ {v : S}, v ∈ D.P.Γ.V → cap.emb v ∈ closure ρr → cap.emb v ∈ W := by + intro v hv hcl + have hN := hNr.of_closure_region hr hv hcl + exact h.close_in_W _ (mem_image_of_mem _ hv) (isNear_iff_exists_path.mp (hN.mono (by omega))) + -- the region of `Γ*` outside `W` beside an edge of `bd(W)` at `r` + obtain ⟨F, hFc, hFs, hFU⟩ := exists_circuit_of_oArc h.is_disc.isOArc_discBd h.bd_sub + have hFG : Drawing.IsCircuitOf F D.rad.G := ⟨hFs, hFc⟩ + have hrF : r ∈ F.V := mem_V_of_mem_U hFs (hFU ▸ hrb) hr.1 + obtain ⟨e₁, he₁, v₁, -, -, hcap₁⟩ := exists_edge_at_Rstar hFG hrF hr.2 + have he₁G := hFs.2 he₁ + obtain ⟨p, hp⟩ := he₁G.2.2.1.nonempty + have hpb : p ∈ discBd W := by + rw [← hFU, F.U_eq] + exact .inr (mem_iUnion₂.mpr ⟨e₁, he₁, subset_closure hp⟩) + have hrcl : r ∈ closure e₁ ∩ D.rad.G.V := by + rw [hcap₁] + exact .inl rfl + have hpρ : p ∈ ρr := edge_subset_regionOf D hr he₁G hrcl.1 hp + have hpo : p ∈ closure Wᶜ := by + have := hpb + rw [← IsClosedDisc.frontier_eq_discBd hT h.is_disc, frontier_eq_closure_inter_closure] at this + exact this.2 + obtain ⟨q, hq, hpq, y, hyq, hyW⟩ := exists_region_near hT D.rad.G h.is_disc.isClosed.isOpen_compl + hpo + have hdis : Disjoint q W := by + rcases h.region_side hq with h' | h' + · exact absurd (h' hyq).1 hyW + · exact h' + have hnotint : ∀ {x}, x ∈ closure q → x ∈ W → x ∈ discBd W := by + intro x hx hxW + by_contra hn + obtain ⟨t, ht₁, ht₂⟩ := mem_closure_iff.mp hx _ (h.is_disc.isOpen_discInt hman) ⟨hxW, hn⟩ + exact disjoint_left.mp hdis ht₂ ht₁.1 + obtain ⟨c, hc, hcq⟩ := (D.rad.region_facts hS h3t).1 q hq + have hm : (q ∩ ρr).Nonempty := by + obtain ⟨t, ht₁, ht₂⟩ := mem_closure_iff.mp hpq _ (isOpen_regionOf D hr) hpρ + exact ⟨t, ht₂, ht₁⟩ + obtain ⟨f, hf, hfρ⟩ := exists_side_of_meet D hq hc hcq hr hm + have hcl_q : ∀ {t : S}, t ∈ closure c → cap.emb t ∈ closure q := fun {t} ht ↦ + closure_mono hcq (image_closure_subset_closure_image cap.isEmbedding.continuous + (mem_image_of_mem _ ht)) + have hcl_ρ : ∀ {t : S}, t ∈ closure f → cap.emb t ∈ closure ρr := fun {t} ht ↦ + closure_minimal hfρ isClosed_closure + (image_closure_subset_closure_image cap.isEmbedding.continuous (mem_image_of_mem _ ht)) + have hsideb : ∀ {t : S}, t ∈ closure f → t ∈ tilde c → cap.emb t ∈ discBd W := fun {t} ht htc ↦ + hnotint (hcl_q htc.1) (hnbr (D.P.Γ.tilde_subset_V hc htc) (hcl_ρ ht)) + -- the first step of the path + have hzne : r ≠ z := fun e ↦ (h.H_in_int (H.V_subset_U hz)).2 (e ▸ hrb) + obtain ⟨n, hnV, hncl, hnN⟩ : ∃ n ∈ D.P.Γ.V, cap.emb n ∈ closure ρr ∧ D.IsNear H (ρ - 2) + (cap.emb n) := by + cases K with + | nil _ => exact absurd rfl hzne + | @cons _ n₀ _ g hl rest => + rw [GraphWalk.length_cons] at hK + obtain ⟨n, hn, rfl⟩ := hatV_of_not_hatV D hl.1 hl.2.2.2 hr.2 + have hrg : r ∈ closure g ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact .inl rfl + have hng : cap.emb n ∈ closure g ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact .inr rfl + exact ⟨n, hn, closure_mono (edge_subset_regionOf D hr hl.1 hrg.1) hng.1, z, hz, rest, + by omega⟩ + have hρ2 : ∀ {m : Shat}, m ∈ cap.emb '' D.Γ.V → m ∈ discBd W → D.IsNear H (ρ - 2) m → 2 ≤ ρ + → False := by + intro m hm hmb hN h2 + obtain ⟨Q, t, ht, hQ, hQl⟩ := isNear_iff_exists_path.mp hN + exact (h.bd_dist m ⟨hm, hmb⟩).2 ⟨Q, t, ht, hQ, by omega⟩ + have h2ρ : 2 ≤ ρ := by + have hne : 1 ≤ K.length := by + by_contra h0 + have : K.length = 0 := by omega + exact hzne (GraphWalk.eq_of_length_eq_zero this) + omega + rcases D.P.Γ.size_cases hc with h2 | h3 + · have hfe : f = c := by + rcases hf.2 with ⟨-, h'⟩ | ⟨h', -⟩ + · exact h' + · omega + subst hfe + obtain ⟨x, y, hxy, htil⟩ := ncard_eq_two.mp h2 + have hx : x ∈ tilde f := htil ▸ mem_insert _ _ + have hy : y ∈ tilde f := htil ▸ mem_insert_of_mem _ rfl + have hbx := hsideb hx.1 hx + have hby := hsideb hy.1 hy + have hVx := D.P.Γ.tilde_subset_V hc hx + have hVy := D.P.Γ.tilde_subset_V hc hy + -- a vertex of `R*` on the closure of `q` lies on `bd(W)` + have hRq : ∀ {w : Shat}, w ∈ D.rad.Rstar → w ∈ closure q → w ∈ discBd W := by + intro w hw hwq + have hmw : (q ∩ D.rad.regionOf w).Nonempty := by + obtain ⟨t, ht₁, ht₂⟩ := mem_closure_iff.mp hwq _ (isOpen_regionOf D hw) + (D.rad.regionOf_mem hw).2 + exact ⟨t, ht₂, ht₁⟩ + obtain ⟨f', hf', hf'w⟩ := exists_side_of_meet D hq hc hcq hw hmw + have hff : f' = f := by + rcases hf'.2 with ⟨-, h'⟩ | ⟨h', -⟩ + · exact h' + · omega + subst hff + have hclw : ∀ {t : S}, t ∈ closure f' → cap.emb t ∈ closure (D.rad.regionOf w) := fun {t} ht ↦ + closure_minimal hf'w isClosed_closure + (image_closure_subset_closure_image cap.isEmbedding.continuous (mem_image_of_mem _ ht)) + obtain ⟨g₁, hg₁, hc₁⟩ := D.rad.exists_spoke hS (h3t.hatRegions_isOpenDisc hS cap) h3t.1 hw + hVx (hclw hx.1) + obtain ⟨g₂, hg₂, hc₂⟩ := D.rad.exists_spoke hS (h3t.hatRegions_isOpenDisc hS cap) h3t.1 hw + hVy (hclw hy.1) + refine hnotint hwq (h.two_nbrs_in_W w hw.1 _ ⟨mem_image_of_mem _ hVx, + hbx⟩ _ ⟨mem_image_of_mem _ hVy, hby⟩ + (fun e ↦ hxy (cap.isEmbedding.injective e)) ⟨g₁, hg₁, ?_⟩ ⟨g₂, hg₂, ?_⟩) + · rw [← closure_inter_V_eq_tilde hg₁, hc₁, pair_comm] + · rw [← closure_inter_V_eq_tilde hg₂, hc₂, pair_comm] + -- a vertex of `Γ` in the closure of `q` is an end of `c` + have hVq : ∀ {v : S}, v ∈ D.P.Γ.V → cap.emb v ∈ closure q → v ∈ tilde f := fun {v} hv hcl ↦ + ⟨(D.rad.region_facts hS h3t).2.2 q hq f hc hcq v hv hcl, fun h' ↦ D.P.Γ.disjoint_V hc h' hv⟩ + have hVb : ∀ {v : S}, v ∈ tilde f → cap.emb v ∈ discBd W := fun {v} hv ↦ by + have : v ∈ ({x, y} : Set S) := htil ▸ hv + rcases this with rfl | rfl + · exact hbx + · exact hby + have hGq : ∀ {t : Shat}, t ∈ D.rad.G.V → t ∈ closure q → t ∈ discBd W := by + intro t ht hcl + by_cases hth : t ∈ D.P.Γ.hatV cap + · obtain ⟨v, hv, rfl⟩ := hth + exact hVb (hVq hv hcl) + · exact hRq ⟨ht, hth⟩ hcl + have hfr : frontier q ⊆ W := by + intro t ht + have hcl := frontier_subset_closure ht + have htq : t ∉ q := fun h' ↦ by + rw [(region_isOpen hq).frontier_eq] at ht + exact ht.2 h' + have htU : t ∈ D.rad.G.U := (closure_region_subset hq hcl).resolve_left htq + by_cases htV : t ∈ D.rad.G.V + · exact Surface.discBd_subset _ (hGq htV hcl) + · obtain ⟨g, hg, htg⟩ := D.rad.G.exists_edge_of_mem htU htV + have hgq : g ⊆ closure q := edge_subset_closure_of_incident hT hg hq ⟨t, htg, hcl⟩ + have hsub : tilde g ⊆ discBd W := by + intro u hu + have hu' : u ∈ closure g ∩ D.rad.G.V := closure_inter_V_eq_tilde hg ▸ hu + exact hGq hu'.2 (closure_minimal hgq isClosed_closure hu'.1) + exact h.chord_in_W g hg hsub htg + have hbq := h.bd_subset_of_frontier hq hdis hfr + have h3b := three_le_ncard_bd h hbd hin + have hsub : discBd W ∩ D.P.Γ.hatV cap ⊆ cap.emb '' tilde f := by + rintro _ ⟨hb, v, hv, rfl⟩ + exact mem_image_of_mem _ (hVq hv (hbq hb)) + have := ncard_le_ncard hsub (((D.P.Γ.finite_V.subset (D.P.Γ.tilde_subset_V hc))).image _) + have h₂ := ncard_image_le (f := cap.emb) (D.P.Γ.finite_V.subset (D.P.Γ.tilde_subset_V hc)) + omega + · obtain ⟨a, b, hab, haf, hbf, hat, hbt, hclf⟩ := D.exists_side_ends hf h3 + have hba := hsideb haf hat + have hbb := hsideb hbf hbt + have hnotbd : ∀ {t : S}, cap.emb t ∈ discBd W → t ∉ bd S := fun {t} ht hb ↦ by + obtain ⟨t', ht', hee⟩ := hbd ht + obtain rfl := cap.isEmbedding.injective hee + exact ht'.2 hb + have hoff : closure f ∩ bd S = ∅ := by + refine eq_empty_of_forall_notMem ?_ + rintro t ⟨ht, htb⟩ + rcases hclf ht with h' | rfl | rfl + · have := (D.P.Γ.border_edge c hc ⟨t, hf.subset h', htb⟩).1 + omega + · exact hnotbd hba htb + · exact hnotbd hbb htb + rcases D.vertex_mem_of_side_off hf h3 hoff hρm.1 hfρ hab haf hbf (D.P.Γ.tilde_subset_V hc hat) + (D.P.Γ.tilde_subset_V hc hbt) hnV hncl with rfl | rfl + · exact hρ2 (mem_image_of_mem _ hnV) hba hnN h2ρ + · exact hρ2 (mem_image_of_mem _ hnV) hbb hnN h2ρ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13b.lean b/LeanPool/GraphMinor/GM19/Section13b.lean new file mode 100644 index 0000000000..798dd923de --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13b.lean @@ -0,0 +1,396 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13a + +/-! +# Graph Minors XIX, Section 13: (13.2) + +We work with walks. The weight `walkWeight` of a walk counts an edge as often as it is used. So a +walk of the same length as +a spoke, from the same vertex to the hub, weighs at least as much as the spoke +(`IsSpoke.walk_bound`). (13.2) follows, by the +paper's proof. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- A path of a drawing is a simple walk of the drawing. -/ +theorem Drawing.IsPathOf.exists_simple_walk {T : Type} [TopologicalSpace T] {P G : + Drawing T} {u v : T} + (hP : Drawing.IsPathOf P G u v) : ∃ K : GraphWalk G.toGraph u v, K.IsSimple ∧ + (∀ x, x ∈ P.V ↔ x ∈ K.support) ∧ + (∀ e, e ∈ P.E ↔ e ∈ K.edges) := by + obtain ⟨W, hW, hV, hE⟩ := hP.2 + obtain ⟨K, hs, he⟩ := hP.1.exists_walk_up W + refine ⟨K, ?_, ?_, ?_⟩ + · unfold GraphWalk.IsSimple + rw [hs] + exact hW + · intro x + rw [hV, hs] + rfl + · intro e + rw [hE, he] + rfl + +/-- The first vertex of a walk in a set. -/ +theorem GraphWalk.exists_first_mem {α' β : Type*} {G : Graph α' β} {a b : α'} + (K : GraphWalk G a b) {X : Set α'} + (hm : ∃ x ∈ K.support, x ∈ X) : ∃ u ∈ X, ∃ (A : GraphWalk G a u) (B : GraphWalk G u b), K + = A.append B ∧ + ∀ x ∈ A.support, x ∈ X → x = u := by + induction K with + | nil h => + obtain ⟨x, hx, hxX⟩ := hm + simp only [GraphWalk.support_nil, List.mem_singleton] at hx + subst hx + refine ⟨x, hxX, .nil h, .nil h, rfl, ?_⟩ + intro y hy _ + simpa using hy + | @cons a c b e h r ih => + by_cases ha : a ∈ X + · refine ⟨a, ha, .nil h.left_mem, .cons h r, rfl, ?_⟩ + intro y hy _ + simpa using hy + · obtain ⟨x, hx, hxX⟩ := hm + have hr : ∃ x ∈ r.support, x ∈ X := by + rcases List.mem_cons.mp hx with rfl | hx' + · exact absurd hxX ha + · exact ⟨x, hx', hxX⟩ + obtain ⟨u, hu, A, B, rfl, hA⟩ := ih hr + refine ⟨u, hu, .cons h A, B, rfl, ?_⟩ + intro y hy hyX + rcases List.mem_cons.mp hy with rfl | hy' + · exact absurd hyX ha + · exact hA y hy' hyX + +/-- A simple walk is determined by its start and its edge set, including its endpoint. -/ +theorem simple_walk_eq_of_common_start_and_edges {T : Type} [TopologicalSpace T] + {G : Drawing T} {u a b : T} + (A : GraphWalk G.toGraph u a) + (B : GraphWalk G.toGraph u b) (hA : A.IsSimple) (hB : B.IsSimple) + (hE : ∀ e, e ∈ A.edges ↔ e ∈ B.edges) : + ∃ h : a = b, (h ▸ A : GraphWalk G.toGraph u b) = B := by + induction A generalizing b with + | nil h => + cases B with + | nil _ => exact ⟨rfl, rfl⟩ + | @cons _ x _ e hl r => + have := (hE e).mpr (by simp) + simp at this + | @cons u x a e hl r ih => + cases B with + | nil _ => + have := (hE e).mp (by simp) + simp at this + | @cons _ x' _ e' hl' r' => + have hsA : (GraphWalk.cons hl r).support.Nodup := hA + have hsB : (GraphWalk.cons hl' r').support.Nodup := hB + simp only [GraphWalk.support_cons, List.nodup_cons] at hsA hsB + have hee : e = e' := by + have := (hE e).mp (by simp) + rcases List.mem_cons.mp (by simpa using this) with h | h + · exact h + · exact absurd (r'.left_mem_support_of_mem_edges h hl) hsB.1 + subst hee + obtain rfl := hl.right_unique hl' + have hE' : ∀ f, f ∈ r.edges ↔ f ∈ r'.edges := by + intro f + constructor + · intro hf + have h₁ := (hE f).mp (by simp [hf]) + rcases List.mem_cons.mp (by simpa using h₁) with h | h + · subst h + exact absurd (r.left_mem_support_of_mem_edges hf hl) hsA.1 + · exact h + · intro hf + have h₁ := (hE f).mpr (by simp [hf]) + rcases List.mem_cons.mp (by simpa using h₁) with h | h + · subst h + exact absurd (r'.left_mem_support_of_mem_edges hf hl) hsB.1 + · exact h + obtain ⟨rfl, htail⟩ := ih r' hsA.2 hsB.2 hE' + change r = r' at htail + subst r' + exact ⟨rfl, rfl⟩ + +/-- Two simple walks from one vertex with the same edges have the same end and the same vertices. -/ +theorem simple_walks_eq {T : Type} [TopologicalSpace T] {G : Drawing T} {u a b : T} + (A : GraphWalk G.toGraph u a) + (B : GraphWalk G.toGraph u b) (hA : A.IsSimple) (hB : B.IsSimple) + (hE : ∀ e, e ∈ A.edges ↔ e ∈ B.edges) : + a = b ∧ ∀ x, x ∈ A.support ↔ x ∈ B.support := by + obtain ⟨rfl, rfl⟩ := simple_walk_eq_of_common_start_and_edges A B hA hB hE + exact ⟨rfl, fun _ => Iff.rfl⟩ + +/-- The sum over the set of a list is at most the sum over the list, for nonnegative terms. -/ +theorem sum_toFinset_le_sum_map {β : Type*} [DecidableEq β] (f : β → ℝ) (l : List β) + (hf : ∀ e ∈ l, 0 ≤ f e) : + ∑ e ∈ l.toFinset, f e ≤ (l.map f).sum := by + induction l with + | nil => simp + | cons a l ih => + have hl := ih fun e he ↦ hf e (.tail _ he) + have ha := hf a (.head _) + rw [List.toFinset_cons, List.map_cons, List.sum_cons] + by_cases hal : a ∈ l.toFinset + · rw [Finset.insert_eq_of_mem hal] + linarith + · rw [Finset.sum_insert hal] + linarith + +namespace TieBreaker + +variable {Γ : Painting S} {rad : RadialDrawing cap Γ} + +/-- The weight of a walk, counting an edge as often as it is used. -/ +noncomputable def walkWeight (tb : TieBreaker rad) {u v : Shat} (T : GraphWalk rad.G.toGraph u v) : + ℝ := + (T.edges.map tb.wtE).sum + +omit [T2Space S] [T2Space Shat] in +theorem walkWeight_append (tb : TieBreaker rad) {u v w : Shat} (A : GraphWalk rad.G.toGraph u v) + (B : GraphWalk rad.G.toGraph v w) : tb.walkWeight (A.append B) = tb.walkWeight A + + tb.walkWeight B := by + simp [walkWeight, GraphWalk.edges_append] + +omit [T2Space S] in +theorem mem_edges_E {u v : Shat} (T : GraphWalk rad.G.toGraph u v) {e : Set Shat} + (he : e ∈ T.edges) : e ∈ rad.G.E := by + have h : e ∈ (walkDrawing rad.G T).E := by + rw [walkDrawing_E] + exact he + exact (walkDrawing_isSubdrawing rad.G T).2 h + +omit [T2Space S] in +theorem weightSub_walkDrawing_le (tb : TieBreaker rad) {u v : Shat} (T : GraphWalk rad.G.toGraph u + v) : + tb.weightSub (walkDrawing rad.G T) ≤ tb.walkWeight T := by + classical + have hE : (walkDrawing rad.G T).E = ↑T.edges.toFinset := by + rw [walkDrawing_E] + ext e + simp + rw [weightSub, hE, finsum_mem_coe_finset] + exact sum_toFinset_le_sum_map _ _ fun e he ↦ (tb.wtE_pos e (mem_edges_E T he)).le + +omit [T2Space S] [T2Space Shat] in +theorem weightSub_eq_of_simple (tb : TieBreaker rad) {u v : Shat} {T : GraphWalk rad.G.toGraph u v} + (hT : T.IsSimple) + {P : Drawing Shat} (hP : ∀ e, e ∈ P.E ↔ e ∈ T.edges) : tb.weightSub P = tb.walkWeight T := by + classical + have hE : P.E = ↑T.edges.toFinset := by + ext e + simp [hP] + rw [weightSub, hE, finsum_mem_coe_finset] + exact List.sum_toFinset _ hT.edges_nodup + +omit [T2Space S] [T2Space Shat] in +theorem weightSub_mono (tb : TieBreaker rad) {X Y : Drawing Shat} (hE : X.E ⊆ Y.E) + (hY : Y.E ⊆ rad.G.E) : + tb.weightSub X ≤ tb.weightSub Y := by + classical + simp only [weightSub] + rw [finsum_mem_eq_finite_toFinset_sum _ (show X.E.Finite from X.finite_edges), + finsum_mem_eq_finite_toFinset_sum _ (show Y.E.Finite from Y.finite_edges)] + refine Finset.sum_le_sum_of_subset_of_nonneg (fun e he ↦ ?_) fun e he _ ↦ ?_ + · exact (Set.Finite.mem_toFinset _).mpr (hE ((Set.Finite.mem_toFinset _).mp he)) + · exact (tb.wtE_pos e (hY ((Set.Finite.mem_toFinset _).mp he))).le + +end TieBreaker + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {v h h' : Shat} {P : Drawing + Shat} + +omit [T2Space S] in +/-- A walk from the outer end of a spoke to the hub is as long as the spoke, and if it has the same +length then it weighs at +least as much. -/ +theorem IsSpoke.walk_bound (hS : D.IsSpoke W H v h P) (hh' : h' ∈ H.V) + (T : GraphWalk D.rad.G.toGraph v h') : + P.E.ncard ≤ T.length ∧ (T.length = P.E.ncard → D.tb.weightSub P ≤ D.tb.walkWeight T) := by + classical + obtain ⟨T', hs, -, he⟩ := GM11.GraphWalk.exists_isSimple T + have hsub := walkDrawing_isSubdrawing D.rad.G T' + have hPath : Drawing.IsPathOf (walkDrawing D.rad.G T') D.rad.G v h' + := ⟨hsub, walkDrawing_isPathBetween _ hs⟩ + have hc := ncard_walk_E D.rad.G hs + have hl : T'.length ≤ T.length := by + have : T'.edges.length ≤ T.edges.length := (hs.edges_nodup.subperm he).length_le + exact this + have hmin := hS.min_length _ h' hh' hPath + refine ⟨by omega, fun heq ↦ ?_⟩ + have h₁ := hS.min_weight _ h' hh' hPath (by omega) + have h₂ : D.tb.weightSub (walkDrawing D.rad.G T') ≤ D.tb.weightSub (walkDrawing D.rad.G T) := + D.tb.weightSub_mono (by rw [walkDrawing_E, walkDrawing_E]; exact he) + (walkDrawing_isSubdrawing _ _).2 + have h₃ := D.tb.weightSub_walkDrawing_le T + linarith + +omit [T2Space S] in +/-- Two simple walks of the same weight have the same edges, because the weights are rationally +independent. -/ +theorem edges_eq_of_weight_eq (D : TangleDatum cap χ) {a b c d : Shat} {Q₁ : GraphWalk + D.rad.G.toGraph a b} + {Q₂ : GraphWalk D.rad.G.toGraph c d} (h₁ : Q₁.IsSimple) (h₂ : Q₂.IsSimple) + (hw : D.tb.walkWeight Q₁ = D.tb.walkWeight Q₂) : + ∀ e, e ∈ Q₁.edges ↔ e ∈ Q₂.edges := by + classical + have : ConnectedSpace Shat := cap.connected + set A := walkDrawing D.rad.G Q₁ with hA + set B := walkDrawing D.rad.G Q₂ with hB + have hAE : ∀ e, e ∈ A.E ↔ e ∈ Q₁.edges := fun e ↦ by rw [hA, walkDrawing_E]; rfl + have hBE : ∀ e, e ∈ B.E ↔ e ∈ Q₂.edges := fun e ↦ by rw [hB, walkDrawing_E]; rfl + have hwA := D.tb.weightSub_eq_of_simple h₁ hAE + have hwB := D.tb.weightSub_eq_of_simple h₂ hBE + have hAf : A.E.Finite := A.finite_edges + have hBf : B.E.Finite := B.finite_edges + have hDisjoint₁ : Disjoint (A.E ∩ B.E) (A.E \ B.E) := + disjoint_left.mpr fun _ he₁ he₂ ↦ he₂.2 he₁.2 + have hDisjoint₂ : Disjoint (B.E ∩ A.E) (B.E \ A.E) := + disjoint_left.mpr fun _ he₁ he₂ ↦ he₂.2 he₁.2 + have hs₁ : ∑ᶠ e ∈ A.E ∩ B.E, D.tb.wtE e + ∑ᶠ e ∈ A.E \ B.E, D.tb.wtE e = D.tb.weightSub A := by + rw [← finsum_mem_union hDisjoint₁ (hAf.subset inter_subset_left) + (hAf.subset sdiff_subset), inter_union_sdiff] + rfl + have hs₂ : ∑ᶠ e ∈ A.E ∩ B.E, D.tb.wtE e + ∑ᶠ e ∈ B.E \ A.E, D.tb.wtE e = D.tb.weightSub B := by + rw [Set.inter_comm, ← finsum_mem_union hDisjoint₂ (hBf.subset inter_subset_left) + (hBf.subset sdiff_subset), inter_union_sdiff] + rfl + have heq : ∑ᶠ e ∈ A.E \ B.E, D.tb.wtE e = ∑ᶠ e ∈ B.E \ A.E, D.tb.wtE e := by linarith + have hsubA : A.E ⊆ D.rad.G.E := (walkDrawing_isSubdrawing _ _).2 + have hsubB : B.E ⊆ D.rad.G.E := (walkDrawing_isSubdrawing _ _).2 + have hdis : Disjoint (A.E \ B.E) (B.E \ A.E) := disjoint_left.mpr fun e h₁ h₂ ↦ h₂.2 h₁.1 + have hY : B.E \ A.E = ∅ := by + by_contra hne + exact D.tb.weight_ne (sdiff_subset.trans hsubA) (sdiff_subset.trans hsubB) hdis + (nonempty_iff_ne_empty.mpr hne) heq + have hX : A.E \ B.E = ∅ := by + by_contra hne + exact D.tb.weight_ne (sdiff_subset.trans hsubB) (sdiff_subset.trans hsubA) hdis.symm + (nonempty_iff_ne_empty.mpr hne) heq.symm + intro e + rw [← hAE, ← hBE] + constructor + · intro h + by_contra hn + have : e ∈ A.E \ B.E := ⟨h, hn⟩ + rw [hX] at this + exact this + · intro h + by_contra hn + have : e ∈ B.E \ A.E := ⟨h, hn⟩ + rw [hY] at this + exact this + +omit [T2Space S] in +/-- **Graph Minors XIX, (13.2)** (page 366): "**13.2.** *Let $v_1, v_2 \in V(\Gamma) \cap +bd(\Sigma)$. +If $S_{v_1}$ meets $S_{v_2}$ then they have the same inner end, and $S_{v_1} \cap S_{v_2}$ is a +path.*" The paper prints `bd(Σ)` for `bd(W)`. The path `Q` also ends at the inner end. -/ +theorem theorem_13_2_proof {v₁ v₂ h₁ h₂ : Shat} {S₁ S₂ : Drawing Shat} + (hS₁ : D.IsSpoke W H v₁ h₁ S₁) (hS₂ : D.IsSpoke W H v₂ h₂ S₂) + (hm : (S₁.V ∩ S₂.V).Nonempty) : h₁ = h₂ ∧ ∃ u, ∃ Q : Drawing Shat, Q.IsPathOf D.rad.G u h₁ ∧ + S₁.V ∩ S₂.V = Q.V ∧ S₁.E ∩ S₂.E = Q.E := by + classical + have : ConnectedSpace Shat := cap.connected + obtain ⟨K₁, hK₁, hV₁, hE₁⟩ := Drawing.IsPathOf.exists_simple_walk hS₁.is_path + obtain ⟨K₂, hK₂, hV₂, hE₂⟩ := Drawing.IsPathOf.exists_simple_walk hS₂.is_path + obtain ⟨x, hx₁, hx₂⟩ := hm + obtain ⟨u, huS, P₁, Q₁, rfl, hfirst⟩ := GraphWalk.exists_first_mem K₁ (X := {y | y ∈ K₂.support}) + ⟨x, (hV₁ x).mp hx₁, (hV₂ x).mp hx₂⟩ + obtain ⟨P₂, Q₂, rfl⟩ := K₂.exists_append_of_mem huS + have hc₁ : S₁.E.ncard = (P₁.append Q₁).length := by + have := ncard_walk_E D.rad.G hK₁ + rw [← this] + congr 1 + ext e + rw [hE₁ e, walkDrawing_E] + rfl + have hc₂ : S₂.E.ncard = (P₂.append Q₂).length := by + have := ncard_walk_E D.rad.G hK₂ + rw [← this] + congr 1 + ext e + rw [hE₂ e, walkDrawing_E] + rfl + rw [GraphWalk.length_append] at hc₁ hc₂ + obtain ⟨b₁, w₁⟩ := hS₁.walk_bound hS₂.h_mem (P₁.append Q₂) + obtain ⟨b₂, w₂⟩ := hS₂.walk_bound hS₁.h_mem (P₂.append Q₁) + rw [GraphWalk.length_append] at b₁ b₂ w₁ w₂ + have hw₁ := D.tb.weightSub_eq_of_simple hK₁ hE₁ + have hw₂ := D.tb.weightSub_eq_of_simple hK₂ hE₂ + rw [D.tb.walkWeight_append] at hw₁ hw₂ + have hq : Q₁.length = Q₂.length := by omega + have hl₁ := w₁ (by omega) + have hl₂ := w₂ (by omega) + rw [D.tb.walkWeight_append] at hl₁ hl₂ + have hweq : D.tb.walkWeight Q₁ = D.tb.walkWeight Q₂ := by linarith + have hQ₁s : Q₁.IsSimple := (GraphMinor.GM19.GraphWalk.IsSimple.of_append hK₁).2 + have hQ₂s : Q₂.IsSimple := (GraphMinor.GM19.GraphWalk.IsSimple.of_append hK₂).2 + have hEq := D.edges_eq_of_weight_eq hQ₁s hQ₂s hweq + obtain ⟨he, hsup⟩ := simple_walks_eq Q₁ Q₂ hQ₁s hQ₂s hEq + subst he + refine ⟨rfl, u, walkDrawing D.rad.G Q₁, ⟨walkDrawing_isSubdrawing _ _, + walkDrawing_isPathBetween _ hQ₁s⟩, ?_, ?_⟩ + · ext y + rw [walkDrawing_V] + constructor + · rintro ⟨h₁, h₂⟩ + have h₁' := (hV₁ y).mp h₁ + have h₂' := (hV₂ y).mp h₂ + rcases (GraphWalk.mem_support_append P₁ Q₁).mp h₁' with h' | h' + · rw [hfirst y h' h₂'] + exact Q₁.start_mem_support + · exact h' + · intro h' + have h'' : y ∈ Q₁.support := h' + exact ⟨(hV₁ y).mpr ((GraphWalk.mem_support_append P₁ Q₁).mpr (.inr h'')), + (hV₂ y).mpr ((GraphWalk.mem_support_append P₂ Q₂).mpr (.inr ((hsup y).mp h'')))⟩ + · ext e + rw [walkDrawing_E] + constructor + · rintro ⟨h₁, h₂⟩ + have h₁' := (hE₁ e).mp h₁ + have h₂' := (hE₂ e).mp h₂ + rw [GraphWalk.edges_append, List.mem_append] at h₁' + rcases h₁' with h' | h' + · exfalso + have heG : e ∈ D.rad.G.E := TieBreaker.mem_edges_E _ h' + obtain ⟨a, ha, b, hb, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 e heG + have hl : D.rad.G.toGraph.IsLink e a b := ⟨heG, D.rad.isPreRadial.2.1 ha, hb.1, hcap⟩ + have hl' : D.rad.G.toGraph.IsLink e b a := ⟨heG, hb.1, D.rad.isPreRadial.2.1 ha, by rw + [hcap, pair_comm]⟩ + have e₁ := hfirst a (P₁.left_mem_support_of_mem_edges h' hl) ((P₂.append + Q₂).left_mem_support_of_mem_edges h₂' hl) + have e₂ := hfirst b (P₁.left_mem_support_of_mem_edges h' hl') + ((P₂.append Q₂).left_mem_support_of_mem_edges h₂' hl') + exact hb.2 ((e₂.trans e₁.symm) ▸ ha) + · exact h' + · intro h' + have h'' : e ∈ Q₁.edges := h' + exact ⟨(hE₁ e).mpr (by rw [GraphWalk.edges_append, List.mem_append]; exact .inr h''), + (hE₂ e).mpr (by rw [GraphWalk.edges_append, List.mem_append]; exact .inr ((hEq e).mp h''))⟩ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13c.lean b/LeanPool/GraphMinor/GM19/Section13c.lean new file mode 100644 index 0000000000..d77e4b8799 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13c.lean @@ -0,0 +1,518 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13b + +/-! +# Graph Minors XIX, Section 13: (13.3) + +A spoke and an enclave. The main fact is `IsSpoke.subwalk_in_enclave`: a part of a spoke between two +vertices of an enclave `F` +lies in `F`. Otherwise the spoke has a part between two vertices of `F` that is otherwise disjoint +from `F`, and (8.5) gives a +contradiction. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- The last vertex of a walk in a set. -/ +theorem GraphWalk.exists_last_mem {α' β : Type*} {G : Graph α' β} {a b : α'} + (K : GraphWalk G a b) {X : Set α'} + (hm : ∃ x ∈ K.support, x ∈ X) : ∃ u ∈ X, ∃ (A : GraphWalk G a u) (B : GraphWalk G u b), K + = A.append B ∧ + ∀ x ∈ B.support, x ∈ X → x = u := by + induction K with + | nil h => + obtain ⟨x, hx, hxX⟩ := hm + simp only [GraphWalk.support_nil, List.mem_singleton] at hx + subst hx + refine ⟨x, hxX, .nil h, .nil h, rfl, ?_⟩ + intro y hy _ + simpa using hy + | @cons a c b e h r ih => + by_cases hr : ∃ x ∈ r.support, x ∈ X + · obtain ⟨u, hu, A, B, rfl, hB⟩ := ih hr + exact ⟨u, hu, .cons h A, B, rfl, hB⟩ + · obtain ⟨x, hx, hxX⟩ := hm + rcases List.mem_cons.mp hx with rfl | hx' + · refine ⟨x, hxX, .nil h.left_mem, .cons h r, rfl, ?_⟩ + intro y hy hyX + rcases List.mem_cons.mp hy with rfl | hy' + · rfl + · exact absurd ⟨y, hy', hyX⟩ hr + · exact absurd ⟨x, hx', hxX⟩ hr + +/-- The ends of an edge of a subdrawing lie in the subdrawing. -/ +theorem Drawing.IsLink.mem_V_of_sub {T : Type} [TopologicalSpace T] {F G : Drawing T} + (hF : F.IsSubdrawing G) + {e : Set T} {x y : T} (hl : G.toGraph.IsLink e x y) (he : e ∈ F.E) : x ∈ F.V ∧ y ∈ F.V := by + have hl' := (hF.isLink_iff he).mpr hl + exact ⟨hl'.left_mem, hl'.right_mem⟩ + +/-- A walk with all its edges in `F`, starting in `F`, has all its vertices in `F`. -/ +theorem support_subset_of_edges {T : Type} [TopologicalSpace T] {F G : Drawing T} + (hF : F.IsSubdrawing G) + {a b : T} (M : GraphWalk G.toGraph a b) (ha : a ∈ F.V) (hE : ∀ e ∈ M.edges, e ∈ F.E) : ∀ x ∈ + M.support, x ∈ F.V := by + induction M with + | nil h => + intro x hx + simp only [GraphWalk.support_nil, List.mem_singleton] at hx + exact hx ▸ ha + | @cons a c b e h r ih => + intro x hx + rcases List.mem_cons.mp hx with rfl | hx' + · exact ha + · exact ih (Drawing.IsLink.mem_V_of_sub hF h (hE e (by simp))).2 (fun f hf ↦ hE f + (by simp [hf])) x hx' + +/-- A simple walk that leaves `F`, and meets `F` at most in its last vertex, uses no edge of `F`. -/ +theorem edges_notMem_of_avoid {T : Type} [TopologicalSpace T] {F G : Drawing T} + (hF : F.IsSubdrawing G) + {c u : T} (M : GraphWalk G.toGraph c u) (hc : c ∉ F.V) (hs : M.IsSimple) + (hX : ∀ x ∈ M.support, x ∈ F.V → x = u) : + ∀ e ∈ M.edges, e ∉ F.E := by + induction M with + | nil h => simp + | @cons c c' u e h r ih => + intro f hf hfF + rcases List.mem_cons.mp hf with rfl | hf' + · exact hc (Drawing.IsLink.mem_V_of_sub hF h hfF).1 + · by_cases hc' : c' ∈ F.V + · have h₁ : c' = u := hX c' (by simp [r.start_mem_support]) hc' + subst h₁ + have := hs.of_cons.length_eq_zero + have h₂ : r.edges = [] := List.eq_nil_of_length_eq_zero this + simp [h₂] at hf' + · exact ih hc' hs.of_cons (fun x hx ↦ hX x (by simp [hx])) f hf' hfF + +/-- A walk through an edge splits at the edge. -/ +theorem GraphWalk.exists_split_edge {α' β : Type*} {G : Graph α' β} {a b : α'} + (K : GraphWalk G a b) {e : β} + (he : e ∈ K.edges) : ∃ (x y : α') (hl : G.IsLink e x y) (A : GraphWalk G a x) + (B : GraphWalk G y b), + K = A.append (GraphWalk.cons hl B) := + K.split_at_edge he + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H F P : Drawing Shat} {v h : Shat} + +omit [T2Space S] in +/-- A part of a spoke cannot be replaced by a shorter or lighter walk. -/ +theorem IsSpoke.part_bound (hS : D.IsSpoke W H v h P) {a b : Shat} {A : GraphWalk D.rad.G.toGraph v + a} + {M L : GraphWalk D.rad.G.toGraph a b} {B : GraphWalk D.rad.G.toGraph b h} (hK : (A.append + (M.append B)).IsSimple) + (hE : ∀ e, e ∈ P.E ↔ e ∈ (A.append (M.append B)).edges) : + M.length ≤ L.length ∧ (L.length = M.length → D.tb.walkWeight M ≤ D.tb.walkWeight L) := by + classical + have hc : P.E.ncard = (A.append (M.append B)).length := by + rw [← ncard_walk_E D.rad.G hK] + congr 1 + ext e + rw [hE e, walkDrawing_E] + rfl + have hw := D.tb.weightSub_eq_of_simple hK hE + obtain ⟨b₁, w₁⟩ := hS.walk_bound hS.h_mem (A.append (L.append B)) + simp only [GraphWalk.length_append, D.tb.walkWeight_append] at hc hw b₁ w₁ + refine ⟨by omega, fun heq ↦ ?_⟩ + have := w₁ (by omega) + linarith + +/-- **The step of (13.3).** A part of a spoke between two distinct vertices of an enclave must meet +the enclave somewhere else. +The proof is the one in the paper: (8.5) applied to the part and the two paths of `F` between its +ends. -/ +theorem IsSpoke.no_ear (hS : D.IsSpoke W H v h P) (hF : IsEnclave D.tb D.ord D.𝒯 F) {a b : Shat} + {A : GraphWalk D.rad.G.toGraph v a} {M : GraphWalk D.rad.G.toGraph a b} {B : GraphWalk + D.rad.G.toGraph b h} + (hK : (A.append (M.append B)).IsSimple) (hE : ∀ e, e ∈ P.E ↔ e ∈ (A.append (M.append B)).edges) + (hab : a ≠ b) (ha : a ∈ F.V) (hb : b ∈ F.V) (hMV : ∀ x ∈ M.support, x ∈ F.V → x = a ∨ x = b) + (hME : ∀ e ∈ M.edges, e ∉ F.E) : False := by + classical + have : ConnectedSpace Shat := cap.connected + obtain ⟨ord', 𝒯', h𝒯', hc, -, Δ, hins, hd⟩ := id hF + have hS' := χ.isSurface + have h3 := D.P.fits.internally_three_connected + have hMs : M.IsSimple := (GraphWalk.IsSimple.of_append (GraphWalk.IsSimple.of_append hK).2).1 + obtain ⟨F₁, F₂, hF₁, hF₂, hs₁, hs₂, hp₁, hp₂, hV₁₂, hE₁₂, hsup⟩ := hc.2.exists_two_paths ha hb hab + set Q := walkDrawing D.rad.G M with hQ + have hQE : ∀ e, e ∈ Q.E ↔ e ∈ M.edges := fun e ↦ by rw [hQ, walkDrawing_E]; rfl + have hQp : Drawing.IsPathOf Q D.rad.G a b := ⟨walkDrawing_isSubdrawing _ _, + walkDrawing_isPathBetween _ hMs⟩ + have ht : TwoPaths D.rad.G F F₁ F₂ Q a b := by + refine ⟨hab, hc.1, ⟨hs₁, hF₁⟩, ⟨hs₂, hF₂⟩, ?_, ?_, hV₁₂.le, hE₁₂, hQp, ?_, ?_⟩ + · have := Drawing.sup_V hs₁ hs₂ + rwa [hsup] at this + · have := Drawing.sup_E hs₁ hs₂ + rwa [hsup] at this + · rintro x ⟨hxQ, hxF⟩ + have : x ∈ M.support := by simpa [hQ, walkDrawing_V] using hxQ + exact hMV x this hxF + · exact disjoint_left.mpr fun e he he' ↦ hME e ((hQE e).mp he) he' + have hwQ := D.tb.weightSub_eq_of_simple hMs hQE + have hcQ : Q.E.ncard = M.length := ncard_walk_E D.rad.G hMs + -- Each of the two paths of `F` is at least as long as `Q`, and heavier if it is equally long. + have hbound : ∀ {X : Drawing Shat}, Drawing.IsPathOf X F a b → Disjoint Q.E X.E → X.E.Nonempty → + Q.E.ncard ≤ X.E.ncard ∧ (X.E.ncard = Q.E.ncard → D.tb.weightSub Q < D.tb.weightSub X) := by + intro X hX hdis hne + have hXG : Drawing.IsPathOf X D.rad.G a b := ⟨hX.1.trans hc.1, hX.2⟩ + obtain ⟨L, hL, -, hLE⟩ := Drawing.IsPathOf.exists_simple_walk hXG + have hcL : X.E.ncard = L.length := by + rw [← ncard_walk_E D.rad.G hL] + congr 1 + ext e + rw [hLE e, walkDrawing_E] + rfl + obtain ⟨h₁, h₂⟩ := hS.part_bound (L := L) hK hE + refine ⟨by omega, fun heq ↦ ?_⟩ + have hle := h₂ (by omega) + have hwL := D.tb.weightSub_eq_of_simple hL hLE + have hne' := D.tb.weight_ne (X := Q.E) (Y := X.E) (walkDrawing_isSubdrawing _ _).2 + (hX.1.trans hc.1).2 hdis hne + have hle' : D.tb.weightSub Q ≤ D.tb.weightSub X := by rw [hwQ, hwL]; exact hle + exact lt_of_le_of_ne hle' hne' + have hd₁ : Disjoint Q.E F₁.E := disjoint_left.mpr fun e he he' ↦ disjoint_left.mp ht.meet_E he + (hs₁.2 he') + have hd₂ : Disjoint Q.E F₂.E := disjoint_left.mpr fun e he he' ↦ disjoint_left.mp ht.meet_E he + (hs₂.2 he') + obtain ⟨b₁, w₁⟩ := hbound ht.left hd₁ ht.exists_edge + obtain ⟨b₂, w₂⟩ := hbound ht.right hd₂ ht.swap.exists_edge + obtain ⟨-, -, -, -, h₁, h₂⟩ := theorem_8_5_proof hS' h3 D.tb D.isTangle h𝒯' hins hd ht b₁ + (fun e ↦ (w₁ e.symm).le) + have heq : Q.E.ncard = F₂.E.ncard := by omega + exact lt_irrefl _ ((w₂ heq.symm).trans (h₂ heq)) + +/-- **A part of a spoke between two vertices of an enclave lies in the enclave.** The paper uses +this form of (13.3) in (13.6). -/ +theorem IsSpoke.subwalk_in_enclave (hS : D.IsSpoke W H v h P) (hF : IsEnclave D.tb D.ord D.𝒯 F) {a + b : Shat} + {A : GraphWalk D.rad.G.toGraph v a} (M : GraphWalk D.rad.G.toGraph a b) {B : GraphWalk + D.rad.G.toGraph b h} + (hK : (A.append (M.append B)).IsSimple) (hE : ∀ e, e ∈ P.E ↔ e ∈ (A.append (M.append B)).edges) + (ha : a ∈ F.V) (hb : b ∈ F.V) : ∀ e ∈ M.edges, e ∈ F.E := by + classical + obtain ⟨ord', 𝒯', h𝒯', hc, -⟩ := id hF + induction M with + | nil h => simp + | @cons a c b g hl r ih => + -- `c` is a vertex of `F`, and `g` is an edge of `F`. + have hg : g ∈ F.E ∧ c ∈ F.V := by + have hm : ∃ x ∈ r.support, x ∈ F.V := ⟨b, r.end_mem_support, hb⟩ + obtain ⟨u, huF, r₁, r₂, hr, hfirst⟩ := GraphWalk.exists_first_mem r hm + subst hr + have hKs : (A.append ((GraphWalk.cons hl r₁).append (r₂.append B))).IsSimple := by + have h₁ : A.append ((GraphWalk.cons hl (r₁.append r₂)).append B) = + A.append ((GraphWalk.cons hl r₁).append (r₂.append B)) := by + rw [show (GraphWalk.cons hl (r₁.append r₂)) = (GraphWalk.cons hl r₁).append r₂ from rfl, + GraphWalk.append_assoc'] + rwa [h₁] at hK + have hE' : ∀ e, e ∈ P.E ↔ e ∈ (A.append ((GraphWalk.cons hl r₁).append (r₂.append B))).edges + := by + intro e + rw [hE e] + simp [GraphWalk.edges_append] + have hsimple : (GraphWalk.cons hl r₁).IsSimple := + (GraphWalk.IsSimple.of_append (GraphWalk.IsSimple.of_append hKs).2).1 + have hau : a ≠ u := by + rintro rfl + exact (List.nodup_cons.mp hsimple).1 r₁.end_mem_support + have huniq : ∀ x ∈ (GraphWalk.cons hl r₁).support, x ∈ F.V → x = a ∨ x = u := by + intro x hx hxF + rcases List.mem_cons.mp hx with rfl | hx' + · exact .inl rfl + · exact .inr (hfirst x hx' hxF) + by_cases hcF : c ∈ F.V + · have hcu : c = u := hfirst c r₁.start_mem_support hcF + subst hcu + refine ⟨?_, hcF⟩ + by_contra hgF + have hr₁ : r₁.edges = [] := List.eq_nil_of_length_eq_zero hsimple.of_cons.length_eq_zero + refine (hS.no_ear hF hKs hE' hau ha huF huniq fun e he ↦ ?_).elim + have : e = g := by simpa [hr₁] using he + exact this ▸ hgF + · exfalso + refine hS.no_ear hF hKs hE' hau ha huF huniq fun e he ↦ ?_ + rcases List.mem_cons.mp he with rfl | he' + · exact fun hF' ↦ hcF (Drawing.IsLink.mem_V_of_sub hc.1 hl hF').2 + · exact edges_notMem_of_avoid hc.1 r₁ hcF hsimple.of_cons hfirst e he' + intro e he + rcases List.mem_cons.mp he with rfl | he' + · exact hg.1 + · have hA : (A.append (GraphWalk.cons hl (GraphWalk.nil hl.right_mem))).append (r.append B) = + A.append ((GraphWalk.cons hl r).append B) := by + rw [GraphWalk.append_assoc'] + rfl + refine ih (A := A.append (GraphWalk.cons hl (GraphWalk.nil hl.right_mem))) + (by rw [hA]; exact hK) ?_ hg.2 hb e he' + intro f + rw [hA] + exact hE f + +omit [T2Space S] in +/-- From the inside of a circuit, an edge of `Γ*` stays inside. -/ +theorem edge_inside_of_mem (D : TangleDatum cap χ) {F : Drawing Shat} (hF : F.IsCircuitOf D.rad.G) + (hlt : F.E.ncard < 2 * D.rep) {g : Set Shat} {x y : Shat} (hl : D.rad.G.toGraph.IsLink g x y) + (hx : x ∈ D.ins F \ F.U) : g ⊆ D.ins F ∧ y ∈ D.ins F := by + have : ConnectedSpace Shat := cap.connected + have hsl := D.isSlope (by omega) + obtain ⟨hcl, hfr, hU⟩ := ins_facts_of_length hsl hF.2 hF.1 hlt + have hint : x ∈ interior (D.ins F) := by + by_contra hn + apply hx.2 + rw [← hfr, frontier, hcl.closure_eq] + exact ⟨hx.1, hn⟩ + have hxg : x ∈ closure g := by + have : x ∈ closure g ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact .inl rfl + exact this.1 + have hyg : y ∈ closure g := by + have : y ∈ closure g ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact .inr rfl + exact this.1 + have hsub : g ⊆ D.ins F := by + rcases edge_subset_or_disjoint_of_length hsl hF.2 hF.1 hlt hl.1 with h | h + · exact h + · obtain ⟨p, hp, hpg⟩ := mem_closure_iff.mp hxg _ isOpen_interior hint + exact absurd (interior_subset hp) (disjoint_left.mp h hpg) + exact ⟨hsub, closure_minimal hsub hcl hyg⟩ + +omit [T2Space S] in +/-- A walk from inside a circuit to a point not strictly inside it meets the circuit. -/ +theorem walk_meets_circuit (D : TangleDatum cap χ) {F : Drawing Shat} (hF : F.IsCircuitOf D.rad.G) + (hlt : F.E.ncard < 2 * D.rep) {x z : Shat} (T : GraphWalk D.rad.G.toGraph x z) + (hx : x ∈ D.ins F) + (hz : z ∉ D.ins F \ F.U) : ∃ a ∈ T.support, a ∈ F.V := by + have : ConnectedSpace Shat := cap.connected + induction T with + | nil h => + rename_i y + refine ⟨y, by simp, ?_⟩ + by_contra hn + exact hz ⟨hx, fun hu ↦ hn (mem_V_of_mem_U hF.1 hu h)⟩ + | @cons x c z e h r ih => + by_cases hxF : x ∈ F.V + · exact ⟨x, by simp, hxF⟩ + · have hx' : x ∈ D.ins F \ F.U := ⟨hx, fun hu ↦ hxF (mem_V_of_mem_U hF.1 hu h.left_mem)⟩ + obtain ⟨a, ha, haF⟩ := ih (D.edge_inside_of_mem hF hlt h hx').2 hz + exact ⟨a, by simp [ha], haF⟩ + +omit [T2Space S] in +/-- The ends of an edge of a walk lie on the walk, and they are different. -/ +theorem exists_ends_of_mem_edges (D : TangleDatum cap χ) {a b : Shat} + (K : GraphWalk D.rad.G.toGraph a b) {e : Set Shat} + (he : e ∈ K.edges) : ∃ x y, x ≠ y ∧ x ∈ K.support ∧ y ∈ K.support ∧ closure e ∩ D.rad.G.V + = {x, y} := by + have heG : e ∈ D.rad.G.E := TieBreaker.mem_edges_E K he + obtain ⟨x, hx, y, hy, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 e heG + have hl : D.rad.G.toGraph.IsLink e x y := ⟨heG, D.rad.isPreRadial.2.1 hx, hy.1, hcap⟩ + have hl' : D.rad.G.toGraph.IsLink e y x := ⟨heG, hy.1, D.rad.isPreRadial.2.1 hx, by rw [hcap, + pair_comm]⟩ + have hne : x ≠ y := fun h ↦ hy.2 (h ▸ hx) + exact ⟨x, y, hne, K.left_mem_support_of_mem_edges he hl, K.left_mem_support_of_mem_edges he hl', + hcap⟩ + +/-- A vertex of a spoke with vertices of an enclave on both sides lies in the enclave. -/ +theorem IsSpoke.mem_of_between (hS : D.IsSpoke W H v h P) (hF : IsEnclave D.tb D.ord D.𝒯 F) {z : + Shat} + {K₁ : GraphWalk D.rad.G.toGraph v z} {K₂ : GraphWalk D.rad.G.toGraph z h} (hK : + (K₁.append K₂).IsSimple) + (hE : ∀ e, e ∈ P.E ↔ e ∈ (K₁.append K₂).edges) (h₁ : ∃ a ∈ K₁.support, a ∈ F.V) + (h₂ : ∃ a ∈ K₂.support, a ∈ F.V) : + z ∈ F.V := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨ord', 𝒯', h𝒯', hc, -⟩ := id hF + obtain ⟨a, ha, haF⟩ := h₁ + obtain ⟨b, hb, hbF⟩ := h₂ + obtain ⟨A, L₁, rfl⟩ := K₁.exists_append_of_mem ha + obtain ⟨L₂, B, rfl⟩ := K₂.exists_append_of_mem hb + have heq : (A.append L₁).append (L₂.append B) = A.append ((L₁.append L₂).append B) := by + rw [GraphWalk.append_assoc', GraphWalk.append_assoc'] + rw [heq] at hK hE + have hin := hS.subwalk_in_enclave hF (L₁.append L₂) hK hE haF hbF + exact support_subset_of_edges hc.1 _ haF hin z + ((GraphWalk.mem_support_append L₁ L₂).mpr (.inl L₁.end_mem_support)) + +/-- **Graph Minors XIX, (13.3)** (page 367): "Let $S_v$ be a spoke with inner end $h$, and let $F$ +be a $\mathscr{T}$-enclave. If $U(S_v) +\cap ins(F) \ne \emptyset$ then $S_v \cap ins(F)$ is a path, and if $U(S_v) \cap ins(F) +\nsubseteq U(F)$ then one of $v, h \in ins(F) \setminus U(F)$." -/ +theorem theorem_13_3_proof (hS : D.IsSpoke W H v h P) (hF : IsEnclave D.tb D.ord D.𝒯 F) : + ((P.U ∩ D.ins F).Nonempty → ∃ (a b : Shat) (Q : Drawing Shat), Drawing.IsPathOf Q D.rad.G a b ∧ + Q.V = P.V ∩ D.ins F ∧ Q.E = {e ∈ P.E | e ⊆ D.ins F}) ∧ + (¬ P.U ∩ D.ins F ⊆ F.U → v ∈ D.ins F \ F.U ∨ h ∈ D.ins F \ F.U) := by + classical + have : ConnectedSpace Shat := cap.connected + obtain ⟨ord', 𝒯', h𝒯', hc, hlt, -⟩ := id hF + have hlt' : F.E.ncard < 2 * D.rep := hlt + have hsl := D.isSlope (by omega) + obtain ⟨hcl, hfr, hU⟩ := ins_facts_of_length hsl hc.2 hc.1 hlt' + obtain ⟨K, hK, hV, hE⟩ := Drawing.IsPathOf.exists_simple_walk hS.is_path + -- A point of `U(S)` inside `ins(F)` gives a vertex of `S` in `ins(F)`, or an edge of `S` with + -- both ends there. + have hclosure : ∀ e ∈ P.E, (e ∩ D.ins F).Nonempty → closure e ⊆ D.ins F := by + intro e he hne + rcases edge_subset_or_disjoint_of_length hsl hc.2 hc.1 hlt' (hS.is_path.1.2 he) with h' | h' + · exact closure_minimal h' hcl + · obtain ⟨x, h₁, h₂⟩ := hne + exact absurd h₂ (disjoint_left.mp h' h₁) + constructor + · rintro ⟨p, hpU, hpi⟩ + -- Some vertex of the spoke is in `ins(F)`. + have hm : ∃ x ∈ K.support, x ∈ D.ins F := by + by_cases hpV : p ∈ P.V + · exact ⟨p, (hV p).mp hpV, hpi⟩ + · obtain ⟨e, he, hpe⟩ := P.exists_edge_of_mem hpU hpV + obtain ⟨x, y, -, hx, -, hcap⟩ := D.exists_ends_of_mem_edges K ((hE e).mp he) + have hxc : x ∈ closure e ∩ D.rad.G.V := by rw [hcap]; exact .inl rfl + exact ⟨x, hx, hclosure e he ⟨p, hpe, hpi⟩ hxc.1⟩ + obtain ⟨u₁, hu₁, A, K', hK', hfirst⟩ := GraphWalk.exists_first_mem K hm + obtain ⟨u₂, hu₂, M, B, hK'', hlast⟩ := GraphWalk.exists_last_mem K' (X + := D.ins F) ⟨u₁, K'.start_mem_support, hu₁⟩ + subst hK'' + subst hK' + have hMs : M.IsSimple := (GraphWalk.IsSimple.of_append (GraphWalk.IsSimple.of_append hK).2).1 + -- The part `M` of the spoke stays in `ins(F)`. + have hMin : ∀ z ∈ M.support, z ∈ D.ins F := by + intro z hz + by_contra hzn + obtain ⟨M₁, M₂, rfl⟩ := M.exists_append_of_mem hz + have heq : A.append ((M₁.append M₂).append B) = (A.append M₁).append (M₂.append B) := by + rw [GraphWalk.append_assoc', GraphWalk.append_assoc'] + obtain ⟨a, ha, haF⟩ := D.walk_meets_circuit hc hlt' M₁ hu₁ fun h' ↦ hzn h'.1 + obtain ⟨b, hb, hbF⟩ := D.walk_meets_circuit hc hlt' M₂.reverse hu₂ fun h' ↦ hzn h'.1 + have hb' : b ∈ (M₂.append B).support := + (GraphWalk.mem_support_append M₂ B).mpr (.inl (by simpa [GraphWalk.support_reverse] using + hb)) + have ha' : a ∈ (A.append M₁).support := (GraphWalk.mem_support_append A M₁).mpr (.inr ha) + have hzF := hS.mem_of_between hF (K₁ := A.append M₁) (K₂ := M₂.append B) (heq ▸ hK) + (fun e ↦ by rw [← heq]; exact hE e) + ⟨a, ha', haF⟩ ⟨b, hb', hbF⟩ + exact hzn (hU (F.V_subset_U hzF)) + refine ⟨u₁, u₂, walkDrawing D.rad.G M, ⟨walkDrawing_isSubdrawing _ _, + walkDrawing_isPathBetween _ hMs⟩, ?_, ?_⟩ + · ext x + rw [walkDrawing_V] + constructor + · intro hx + have hx' : x ∈ M.support := hx + refine ⟨(hV x).mpr ?_, hMin x hx'⟩ + exact (GraphWalk.mem_support_append A _).mpr (.inr ((GraphWalk.mem_support_append M B).mpr + (.inl hx'))) + · rintro ⟨hxP, hxi⟩ + rcases (GraphWalk.mem_support_append A _).mp ((hV x).mp hxP) with h' | h' + · rw [hfirst x h' hxi] + exact M.start_mem_support + · rcases (GraphWalk.mem_support_append M B).mp h' with h'' | h'' + · exact h'' + · rw [hlast x h'' hxi] + exact M.end_mem_support + · ext e + rw [walkDrawing_E] + constructor + · intro he + have he' : e ∈ M.edges := he + have heP : e ∈ P.E := (hE e).mpr (by simp [GraphWalk.edges_append, he']) + refine ⟨heP, ?_⟩ + obtain ⟨x, y, hl, M₁, M₂, rfl⟩ := GraphWalk.exists_split_edge M he' + have hxm : x ∈ (M₁.append (GraphWalk.cons hl M₂)).support := + (GraphWalk.mem_support_append _ _).mpr (.inl M₁.end_mem_support) + have hym : y ∈ (M₁.append (GraphWalk.cons hl M₂)).support := + (GraphWalk.mem_support_append _ _).mpr (.inr (by simp [M₂.start_mem_support])) + by_cases hxF : x ∈ F.V + · by_cases hyF : y ∈ F.V + · have heq : A.append ((M₁.append (GraphWalk.cons hl M₂)).append B) = + (A.append M₁).append ((GraphWalk.cons hl (GraphWalk.nil hl.right_mem)).append + (M₂.append B)) := by + simp only [GraphWalk.append_assoc'] + rfl + have hin := hS.subwalk_in_enclave hF (GraphWalk.cons hl (GraphWalk.nil hl.right_mem)) + (heq ▸ hK) + (fun f ↦ by rw [← heq]; exact hE f) hxF hyF + have heF := hin e (by simp) + exact fun q hq ↦ hU (F.closure_subset_U heF (subset_closure hq)) + · have hl' : D.rad.G.toGraph.IsLink e y x := ⟨hl.1, hl.2.2.1, hl.2.1, by rw [hl.2.2.2, + pair_comm]⟩ + exact (D.edge_inside_of_mem hc hlt' hl' ⟨hMin y hym, fun hu ↦ hyF + (mem_V_of_mem_U hc.1 hu hl.right_mem)⟩).1 + · exact (D.edge_inside_of_mem hc hlt' hl ⟨hMin x hxm, fun hu ↦ hxF + (mem_V_of_mem_U hc.1 hu hl.left_mem)⟩).1 + · rintro ⟨heP, hei⟩ + have hcl' : closure e ⊆ D.ins F := closure_minimal hei hcl + have hK₂ := (hE e).mp heP + simp only [GraphWalk.edges_append, List.mem_append] at hK₂ + have hends : ∀ {a b : Shat} (T : GraphWalk D.rad.G.toGraph a b), e ∈ T.edges → ∀ {c : Shat}, + (∀ x ∈ T.support, x ∈ D.ins F → x = c) → False := by + intro a b T he' c hT + obtain ⟨x, y, hne, hx, hy, hcap⟩ := D.exists_ends_of_mem_edges T he' + have hxc : x ∈ closure e ∩ D.rad.G.V := by rw [hcap]; exact .inl rfl + have hyc : y ∈ closure e ∩ D.rad.G.V := by rw [hcap]; exact .inr rfl + exact hne ((hT x hx (hcl' hxc.1)).trans (hT y hy (hcl' hyc.1)).symm) + rcases hK₂ with h' | h' | h' + · exact (hends A h' hfirst).elim + · exact h' + · exact (hends B h' hlast).elim + · intro hn + by_contra hcon + push Not at hcon + have hvY : v ∉ D.ins F \ F.U := hcon.1 + have hhY : h ∉ D.ins F \ F.U := hcon.2 + -- No vertex of the spoke is strictly inside. + have hnoV : ∀ x ∈ K.support, x ∈ D.ins F \ F.U → False := by + intro x hx hxY + obtain ⟨K₁, K₂, rfl⟩ := K.exists_append_of_mem hx + have h₁ := D.walk_meets_circuit hc hlt' K₁.reverse hxY.1 hvY + have h₂ := D.walk_meets_circuit hc hlt' K₂ hxY.1 hhY + obtain ⟨a, ha, haF⟩ := h₁ + have hzF := hS.mem_of_between hF hK hE ⟨a, by simpa [GraphWalk.support_reverse] using ha, + haF⟩ h₂ + exact hxY.2 (F.V_subset_U hzF) + obtain ⟨p, ⟨hpU, hpi⟩, hpF⟩ := not_subset.mp hn + by_cases hpV : p ∈ P.V + · exact hnoV p ((hV p).mp hpV) ⟨hpi, hpF⟩ + · obtain ⟨e, he, hpe⟩ := P.exists_edge_of_mem hpU hpV + have hcl' := hclosure e he ⟨p, hpe, hpi⟩ + obtain ⟨x, y, hl, A, B, heq⟩ := GraphWalk.exists_split_edge K ((hE e).mp he) + have hxK : x ∈ K.support := by + rw [heq] + exact (GraphWalk.mem_support_append _ _).mpr (.inl A.end_mem_support) + have hyK : y ∈ K.support := by + rw [heq] + exact (GraphWalk.mem_support_append _ _).mpr (.inr (by simp [B.start_mem_support])) + have hxc : x ∈ closure e ∩ D.rad.G.V := by rw [hl.2.2.2]; exact .inl rfl + have hyc : y ∈ closure e ∩ D.rad.G.V := by rw [hl.2.2.2]; exact .inr rfl + have hxF : x ∈ F.V := by + by_contra h' + exact hnoV x hxK ⟨hcl' hxc.1, fun hu ↦ h' (mem_V_of_mem_U hc.1 hu hl.left_mem)⟩ + have hyF : y ∈ F.V := by + by_contra h' + exact hnoV y hyK ⟨hcl' hyc.1, fun hu ↦ h' (mem_V_of_mem_U hc.1 hu hl.right_mem)⟩ + have heq₂ : K = A.append ((GraphWalk.cons hl (GraphWalk.nil hl.right_mem)).append B) := heq + have hin := hS.subwalk_in_enclave hF (GraphWalk.cons hl (GraphWalk.nil hl.right_mem)) + (heq₂ ▸ hK) + (fun f ↦ by rw [← heq₂]; exact hE f) hxF hyF + have heF := hin e (by simp) + exact hpF ((F.closure_subset_U heF) (subset_closure hpe)) + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13d.lean b/LeanPool/GraphMinor/GM19/Section13d.lean new file mode 100644 index 0000000000..bca0f3b7bb --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13d.lean @@ -0,0 +1,319 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13c + +/-! +# Graph Minors XIX, Section 13: spokes as walks, and hubs at one vertex + +These are the tools for (13.4). A spoke is read as a simple walk. Two spokes that meet share a final +part (`IsSpokeWalk.merge`). +There is a spoke at each vertex of `V(Γ) ∩ bd(W)` (`IsWheelHubOfRadius.exists_spoke`). A vertex on +every spoke that no small enclave +surrounds is a hub of smaller radius (`IsWheelHubOfRadius.hub_at`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- Two simple walks with the same ends and the same edges are the same walk. -/ +theorem simple_walk_eq_of_edges {T : Type} [TopologicalSpace T] {G : Drawing T} {u a : + T} (A B : GraphWalk G.toGraph u a) + (hA : A.IsSimple) (hB : B.IsSimple) (hE : ∀ e, e ∈ A.edges ↔ e ∈ B.edges) : A = B := by + obtain ⟨h, hwalk⟩ := simple_walk_eq_of_common_start_and_edges A B hA hB hE + cases h + exact hwalk + +/-- In a simple walk, the part after a vertex does not depend on how the walk is split. -/ +theorem tail_unique {α' β : Type*} {G : Graph α' β} {a x b : α'} (A A' : GraphWalk G a x) + (T T' : GraphWalk G x b) + (hs : (A.append T).IsSimple) (heq : A.append T = A'.append T') : T = T' ∧ A = A' := by + induction A with + | nil h => + cases A' with + | nil _ => exact ⟨heq, rfl⟩ + | @cons _ c _ e hl r => + exfalso + have h₁ : (GraphWalk.nil h).append T = T := rfl + rw [h₁] at hs heq + subst heq + have hs' : (GraphWalk.cons hl (r.append T')).support.Nodup := hs + refine (List.nodup_cons.mp hs').1 ?_ + exact (GraphWalk.mem_support_append r T').mpr (.inr T'.start_mem_support) + | @cons a c x e hl r ih => + cases A' with + | nil _ => + exfalso + have h₁ : (GraphWalk.nil hl.left_mem).append T' = T' := rfl + have hs' : (GraphWalk.cons hl (r.append T)).support.Nodup := hs + have : a ∈ (r.append T).support := (GraphWalk.mem_support_append r T).mpr + (.inl r.end_mem_support) + exact (List.nodup_cons.mp hs').1 this + | @cons _ c' _ e' hl' r' => + change GraphWalk.cons hl (r.append T) = GraphWalk.cons hl' (r'.append T') at heq + injection heq with h₁ h₂ h₃ h₄ h₅ + subst h₂ + subst h₄ + obtain ⟨h₆, h₇⟩ := ih r' T T' (GraphWalk.IsSimple.of_cons hs) (eq_of_heq h₅) + exact ⟨h₆, by rw [h₇]⟩ + +/-- The drawing with one vertex and no edge. -/ +theorem point_drawing_facts {T : Type} [TopologicalSpace T] [T2Space T] (G : Drawing T) {u : T} + (hu : u ∈ G.V) : + (walkDrawing G (GraphWalk.nil hu)).V = {u} ∧ (walkDrawing G (GraphWalk.nil hu)).E = ∅ ∧ + (walkDrawing G (GraphWalk.nil hu)).U = {u} := by + have hV : (walkDrawing G (GraphWalk.nil hu)).V = {u} := by + rw [walkDrawing_V] + ext x + change x ∈ [u] ↔ _ + simp + have hE : (walkDrawing G (GraphWalk.nil hu)).E = ∅ := by + rw [walkDrawing_E] + ext x + simp [GraphWalk.edges] + refine ⟨hV, hE, ?_⟩ + rw [Drawing.U_eq, hV, hE] + simp + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {v h : Shat} + +/-- A walk gives a path between the same ends with at most as many edges. -/ +theorem exists_path_of_walk {T : Type} [TopologicalSpace T] [T2Space T] {G : Drawing T} {a b : T} + (L : GraphWalk G.toGraph a b) : + ∃ P : Drawing T, Drawing.IsPathOf P G a b ∧ P.E.ncard ≤ L.length := by + classical + obtain ⟨L', hs, -, he⟩ := GM11.GraphWalk.exists_isSimple L + refine ⟨walkDrawing G L', ⟨walkDrawing_isSubdrawing _ _, walkDrawing_isPathBetween _ hs⟩, ?_⟩ + rw [ncard_walk_E G hs] + exact (hs.edges_nodup.subperm he).length_le + +/-- A spoke, read as a simple walk. -/ +def IsSpokeWalk (D : TangleDatum cap χ) (W : Set Shat) (H : Drawing Shat) {v h : Shat} + (K : GraphWalk D.rad.G.toGraph v h) : Prop := + K.IsSimple ∧ D.IsSpoke W H v h (walkDrawing D.rad.G K) + +omit [T2Space S] in +theorem IsSpoke.exists_walk {P : Drawing Shat} (hS : D.IsSpoke W H v h P) : + ∃ K : GraphWalk D.rad.G.toGraph v h, D.IsSpokeWalk W H K ∧ P = walkDrawing D.rad.G K := by + obtain ⟨K, hK, hV, hE⟩ := Drawing.IsPathOf.exists_simple_walk hS.is_path + have heq : P = walkDrawing D.rad.G K := by + refine Drawing.ext_of_V_E ?_ ?_ + · rw [walkDrawing_V] + ext x + exact hV x + · rw [walkDrawing_E] + ext e + exact hE e + exact ⟨K, ⟨hK, heq ▸ hS⟩, heq⟩ + +omit [T2Space S] in +theorem IsSpokeWalk.mem_E {K : GraphWalk D.rad.G.toGraph v h} {e : Set Shat} : + e ∈ (walkDrawing D.rad.G K).E ↔ e ∈ K.edges := by + rw [walkDrawing_E] + rfl + +omit [T2Space S] in +theorem IsSpokeWalk.ncard {K : GraphWalk D.rad.G.toGraph v h} (hK : D.IsSpokeWalk W H K) : + (walkDrawing D.rad.G K).E.ncard = K.length := + ncard_walk_E D.rad.G hK.1 + +omit [T2Space S] in +/-- A spoke walk is shortest among the walks from `v` to `V(H)`, and lightest among those of its +length. -/ +theorem IsSpokeWalk.bound {K : GraphWalk D.rad.G.toGraph v h} (hK : D.IsSpokeWalk W H K) {h' : + Shat} (hh' : h' ∈ H.V) + (T : GraphWalk D.rad.G.toGraph v h') : K.length ≤ T.length ∧ + (T.length = K.length → D.tb.walkWeight K ≤ D.tb.walkWeight T) := by + have : ConnectedSpace Shat := cap.connected + have h₁ := hK.2.walk_bound hh' T + rw [hK.ncard, D.tb.weightSub_eq_of_simple hK.1 (fun e ↦ IsSpokeWalk.mem_E)] at h₁ + exact h₁ + +omit [T2Space S] in +/-- The final part of a spoke walk is shortest and lightest too. -/ +theorem IsSpokeWalk.tail_bound {u : Shat} {A : GraphWalk D.rad.G.toGraph v u} {B : GraphWalk + D.rad.G.toGraph u h} + (hK : D.IsSpokeWalk W H (A.append B)) {h' : Shat} (hh' : h' ∈ H.V) + (T : GraphWalk D.rad.G.toGraph u h') : + B.length ≤ T.length ∧ (T.length = B.length → D.tb.walkWeight B ≤ D.tb.walkWeight T) := by + obtain ⟨h₁, h₂⟩ := hK.bound hh' (A.append T) + simp only [GraphWalk.length_append, D.tb.walkWeight_append] at h₁ h₂ + refine ⟨by omega, fun heq ↦ ?_⟩ + have := h₂ (by omega) + linarith + +omit [T2Space S] in +/-- A spoke walk meets `V(H)` only in its last vertex. -/ +theorem IsSpokeWalk.support_hub {K : GraphWalk D.rad.G.toGraph v h} (hK : D.IsSpokeWalk W H K) {y : + Shat} (hy : y ∈ K.support) + (hyH : y ∈ H.V) : y = h := by + obtain ⟨A, B, rfl⟩ := K.exists_append_of_mem hy + have h₁ := (hK.bound hyH A).1 + rw [GraphWalk.length_append] at h₁ + exact GraphWalk.eq_of_length_eq_zero (show B.length = 0 by omega) + +omit [T2Space S] in +/-- Two spokes that meet have the same inner end. -/ +theorem IsSpokeWalk.same_end {v₁ v₂ h₁ h₂ x : Shat} {K₁ : GraphWalk D.rad.G.toGraph v₁ h₁} {K₂ : + GraphWalk D.rad.G.toGraph v₂ h₂} + (h1 : D.IsSpokeWalk W H K₁) (h2 : D.IsSpokeWalk W H K₂) (hx₁ : x ∈ K₁.support) + (hx₂ : x ∈ K₂.support) : h₁ = h₂ := by + have : ConnectedSpace Shat := cap.connected + have hV : ∀ {a b : Shat} (K : GraphWalk D.rad.G.toGraph a b), x ∈ K.support → x ∈ + (walkDrawing D.rad.G K).V := by + intro a b K hx + rw [walkDrawing_V] + exact hx + exact (theorem_13_2_proof h1.2 h2.2 ⟨x, hV _ hx₁, hV _ hx₂⟩).1 + +omit [T2Space S] in +/-- **Two spokes that meet end the same way.** This is the proof of (13.2) for walks: `K₁ = A₁ + T` +and `K₂ = A₂ + T`, the +vertex `x` lies on `T`, and `A₁` meets `K₂` only in the first vertex of `T`. -/ +theorem IsSpokeWalk.merge {v₁ v₂ h x : Shat} {K₁ : GraphWalk D.rad.G.toGraph v₁ h} {K₂ : GraphWalk + D.rad.G.toGraph v₂ h} + (h1 : D.IsSpokeWalk W H K₁) (h2 : D.IsSpokeWalk W H K₂) (hx₁ : x ∈ K₁.support) + (hx₂ : x ∈ K₂.support) : + ∃ (u : Shat) (A₁ : GraphWalk D.rad.G.toGraph v₁ u) (A₂ : GraphWalk D.rad.G.toGraph v₂ u) + (T : GraphWalk D.rad.G.toGraph u h), K₁ = A₁.append T ∧ K₂ = A₂.append T ∧ x ∈ T.support ∧ + (∀ y ∈ A₁.support, y ∈ K₂.support → y = u) := by + obtain ⟨u, hu, P₁, Q₁, rfl, hfirst⟩ := GraphWalk.exists_first_mem K₁ (X + := {y | y ∈ K₂.support}) ⟨x, hx₁, hx₂⟩ + obtain ⟨P₂, Q₂, rfl⟩ := K₂.exists_append_of_mem hu + have hh := h1.2.h_mem + obtain ⟨b₁, w₁⟩ := h1.tail_bound hh Q₂ + obtain ⟨b₂, w₂⟩ := h2.tail_bound hh Q₁ + have hlen : Q₁.length = Q₂.length := by omega + have hw : D.tb.walkWeight Q₁ = D.tb.walkWeight Q₂ := le_antisymm (w₁ hlen.symm) (w₂ hlen) + have hs₁ : Q₁.IsSimple := (GraphWalk.IsSimple.of_append h1.1).2 + have hs₂ : Q₂.IsSimple := (GraphWalk.IsSimple.of_append h2.1).2 + obtain rfl := simple_walk_eq_of_edges Q₁ Q₂ hs₁ hs₂ (D.edges_eq_of_weight_eq hs₁ hs₂ hw) + refine ⟨u, P₁, P₂, Q₁, rfl, rfl, ?_, hfirst⟩ + rcases (GraphWalk.mem_support_append P₁ Q₁).mp hx₁ with h' | h' + · rw [hfirst x h' hx₂] + exact Q₁.start_mem_support + · exact h' + +omit [T2Space S] in +/-- A spoke at each vertex of `V(Γ) ∩ bd(W)`. It exists since a shortest and then lightest path +exists, there being finitely many +paths. -/ +theorem IsWheelHubOfRadius.exists_spoke (hW : D.IsWheelHubOfRadius W H ρ) (hv : v ∈ + (cap.emb '' D.Γ.V) ∩ discBd W) : + ∃ (h : Shat) (K : GraphWalk D.rad.G.toGraph v h), D.IsSpokeWalk W H K := by + classical + let Ps : Set (Drawing Shat) := {P | P.IsSubdrawing D.rad.G ∧ ∃ z ∈ H.V, Drawing.IsPathOf P + D.rad.G v z} + have hfin : Ps.Finite := by + refine Set.Finite.of_finite_image (f := fun C : Drawing Shat ↦ (C.V, C.E)) ?_ ?_ + · refine (D.rad.G.finite_V.finite_subsets.prod D.rad.G.finite_edges.finite_subsets).subset ?_ + rintro _ ⟨C, ⟨hs', -⟩, rfl⟩ + exact ⟨hs'.1, hs'.2⟩ + · intro C _ C' _ h + exact Drawing.ext_of_V_E (congrArg Prod.fst h) (congrArg Prod.snd h) + obtain ⟨P₀, z₀, hz₀, hP₀, -⟩ := (hW.bd_dist v hv).1 + have hne : Ps.Nonempty := ⟨P₀, hP₀.1, z₀, hz₀, hP₀⟩ + obtain ⟨P, ⟨-, z, hz, hP⟩, hmin⟩ := Set.exists_min_image Ps (fun P ↦ toLex + (P.E.ncard, D.tb.weightSub P)) hfin hne + have hS : D.IsSpoke W H v z P := by + refine ⟨hv, hz, hP, ?_, ?_⟩ + · intro P' h' hh' hP' + have := hmin P' ⟨hP'.1, h', hh', hP'⟩ + rcases Prod.Lex.toLex_le_toLex.mp this with h₁ | ⟨h₁, -⟩ + · exact h₁.le + · exact h₁.le + · intro P' h' hh' hP' heq + have := hmin P' ⟨hP'.1, h', hh', hP'⟩ + rcases Prod.Lex.toLex_le_toLex.mp this with h₁ | ⟨-, h₁⟩ + · have h₁' : P.E.ncard < P'.E.ncard := h₁ + omega + · exact h₁ + obtain ⟨K, hK, -⟩ := hS.exists_walk + exact ⟨z, K, hK⟩ + +omit [T2Space S] in +/-- Walks from `V(Γ) ∩ bd(W)` to `V(H)` have at least `ρ - 1` edges. -/ +theorem IsWheelHubOfRadius.walk_ge (hW : D.IsWheelHubOfRadius W H ρ) (hv : v ∈ + (cap.emb '' D.Γ.V) ∩ discBd W) {z : Shat} + (hz : z ∈ H.V) (T : GraphWalk D.rad.G.toGraph v z) : ρ ≤ T.length + 1 := by + obtain ⟨P, hP, hle⟩ := exists_path_of_walk T + by_contra hn + exact (hW.bd_dist v hv).2 ⟨P, z, hz, hP, by omega⟩ + +omit [T2Space S] in +/-- A spoke has `ρ` or `ρ - 1` edges. -/ +theorem IsWheelHubOfRadius.spoke_length (hW : D.IsWheelHubOfRadius W H ρ) {K : GraphWalk + D.rad.G.toGraph v h} + (hK : D.IsSpokeWalk W H K) : K.length ≤ ρ ∧ ρ ≤ K.length + 1 := by + refine ⟨?_, hW.walk_ge hK.2.v_mem hK.2.h_mem K⟩ + obtain ⟨P, z, hz, hP, hle⟩ := (hW.bd_dist v hK.2.v_mem).1 + have := hK.2.min_length P z hz hP + rw [hK.ncard] at this + omega + +omit [T2Space S] in +/-- A vertex `u` of `Γ*` strictly inside `W`, at distance `T.length < ρ` from `H`, that lies on a +way from each vertex +of `V(Γ) ∩ bd(W)` to `H`, and that no small enclave surrounds, is a hub of radius `ρ - T.length`. +This is the claim in the +proof of (13.4). -/ +theorem IsWheelHubOfRadius.hub_at (hW : D.IsWheelHubOfRadius W H ρ) {u h₀ : Shat} + (huG : u ∈ D.rad.G.V) + (T : GraphWalk D.rad.G.toGraph u h₀) (hh₀ : h₀ ∈ H.V) (hlt : T.length < ρ) + (hu : u ∈ W \ discBd W) + (hsp : ∀ v ∈ (cap.emb '' D.Γ.V) ∩ discBd W, ∃ A : GraphWalk D.rad.G.toGraph v u, A.length + + T.length ≤ ρ) + (hen : ∀ F : Drawing Shat, IsEnclave D.tb D.ord D.𝒯 F → F.E.ncard ≤ 4 * ρ + 4 + → u ∉ D.ins F \ F.U) : + D.IsWheelHubOfRadius W (walkDrawing D.rad.G (GraphWalk.nil huG)) (ρ - T.length) := by + obtain ⟨hV, hE, hU⟩ := point_drawing_facts D.rad.G huG + refine ⟨by omega, ?_, hW.is_disc, hW.bd_sub, walkDrawing_isSubdrawing _ _, ?_, ?_, + hW.two_nbrs_in_W, hW.chord_in_W, ?_, ?_, ?_⟩ + · have := hW.rep_ge + omega + · rw [hU] + exact singleton_subset_iff.mpr hu + · intro F hF hle hsub + exact hW.ins_sub F hF (by omega) hsub + · refine .inl ⟨by rw [hV, ncard_singleton], hE, fun H' h₁ h₂ hsub ↦ ?_⟩ + rw [hV] at hsub + exact hen H' h₁ (by omega) (hsub rfl) + · rintro x hx ⟨P, z, hz, hP, hle⟩ + rw [hV] at hz + obtain rfl : z = u := hz + obtain ⟨L, hL⟩ := Drawing.IsPathOf.exists_walk hP + obtain ⟨P', hP', hle'⟩ := exists_path_of_walk (L.append T) + rw [GraphWalk.length_append] at hle' + exact hW.close_in_W x hx ⟨P', h₀, hh₀, hP', by omega⟩ + · intro x hx + obtain ⟨A, hA⟩ := hsp x hx + obtain ⟨P, hP, hle⟩ := exists_path_of_walk A + refine ⟨⟨P, u, by rw [hV]; rfl, hP, by omega⟩, ?_⟩ + rintro ⟨P', z, hz, hP', hle'⟩ + rw [hV] at hz + obtain rfl : z = u := hz + obtain ⟨L, hL⟩ := Drawing.IsPathOf.exists_walk hP' + have := hW.walk_ge hx hh₀ (L.append T) + rw [GraphWalk.length_append] at this + omega + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13e.lean b/LeanPool/GraphMinor/GM19/Section13e.lean new file mode 100644 index 0000000000..a0f8a5497a --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13e.lean @@ -0,0 +1,535 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13d + +/-! +# Graph Minors XIX, Section 13: the fan of two spokes that meet + +`IsFan` is the setting of (13.4). The spokes are the walks `A₁ + T` and `A₂ + T`, the vertex `r*` of +`bd(W)` is joined to their +outer ends by the edges `f₁, f₂`, and the circuit `C` runs through `f₁, A₁, A₂, f₂`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- The two parts of a simple walk meet only where they are joined. -/ +theorem GraphWalk.inter_of_simple {α' β : Type*} {G : Graph α' β} {a u b : α'} {A : GraphWalk G a + u} {T : GraphWalk G u b} + (hs : (A.append T).IsSimple) {x : α'} (h₁ : x ∈ A.support) (h₂ : x ∈ T.support) : x = u := by + induction A with + | nil h => + simpa [GraphWalk.support_nil] using h₁ + | @cons a c u e h r ih => + have hs' : (GraphWalk.cons h (r.append T)).support.Nodup := hs + rcases List.mem_cons.mp h₁ with rfl | h₁' + · exact absurd ((GraphWalk.mem_support_append r T).mpr (.inr h₂)) (List.nodup_cons.mp hs').1 + · exact ih (GraphWalk.IsSimple.of_cons hs) h₁' h₂ + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r v₁ v₂ u h : Shat} {f₁ + f₂ : Set Shat} + +omit [T2Space S] [T2Space Shat] in +/-- Two vertices of `Γ` are not adjacent in `Γ*`. -/ +theorem not_link_hatV (D : TangleDatum cap χ) {g : Set Shat} {a b : Shat} + (hl : D.rad.G.toGraph.IsLink g a b) + (ha : a ∈ D.P.Γ.hatV cap) (hb : b ∈ D.P.Γ.hatV cap) : False := by + obtain ⟨x, hx, y, hy, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 g hl.1 + have hab := hl.2.2.2 + have hya : y ∈ ({a, b} : Set Shat) := by + rw [← hab, hcap] + exact .inr rfl + rcases hya with rfl | rfl + · exact hy.2 ha + · exact hy.2 hb + +omit [T2Space S] [T2Space Shat] in +/-- A walk between two different vertices of `Γ` has at least two edges. -/ +theorem two_le_of_hatV (D : TangleDatum cap χ) {a b : Shat} (A : GraphWalk D.rad.G.toGraph a b) + (ha : a ∈ D.P.Γ.hatV cap) + (hb : b ∈ D.P.Γ.hatV cap) (hab : a ≠ b) : 2 ≤ A.length := by + cases A with + | nil _ => exact absurd rfl hab + | @cons _ c _ e hl r => + cases r with + | nil _ => exact (D.not_link_hatV hl ha hb).elim + | @cons _ c' _ e' hl' r' => + rw [GraphWalk.length_cons, GraphWalk.length_cons] + omega + +omit [T2Space S] in +/-- The ends of an edge of a walk lie on the walk. -/ +theorem ends_mem_support (D : TangleDatum cap χ) {a b x y : Shat} (K : GraphWalk D.rad.G.toGraph a + b) {e : Set Shat} + (he : e ∈ K.edges) (hcap : closure e ∩ D.rad.G.V = {x, y}) : x ∈ K.support ∧ y ∈ K.support := by + have heG : e ∈ D.rad.G.E := TieBreaker.mem_edges_E K he + have hx : x ∈ closure e ∩ D.rad.G.V := by rw [hcap]; exact .inl rfl + have hy : y ∈ closure e ∩ D.rad.G.V := by rw [hcap]; exact .inr rfl + have hl : D.rad.G.toGraph.IsLink e x y := ⟨heG, hx.2, hy.2, hcap⟩ + have hl' : D.rad.G.toGraph.IsLink e y x := ⟨heG, hy.2, hx.2, by rw [hcap, pair_comm]⟩ + exact ⟨K.left_mem_support_of_mem_edges he hl, K.left_mem_support_of_mem_edges he hl'⟩ + +omit [T2Space S] in +/-- The tail of a spoke after a vertex does not depend on the spoke. -/ +theorem IsSpokeWalk.tail_after {v v' a h : Shat} {L : GraphWalk D.rad.G.toGraph v a} {R : GraphWalk + D.rad.G.toGraph a h} + {A : GraphWalk D.rad.G.toGraph v' a} {R₁ : GraphWalk D.rad.G.toGraph a h} + (h1 : D.IsSpokeWalk W H (L.append R)) + (h2 : D.IsSpokeWalk W H (A.append R₁)) : R = R₁ := by + have ha₁ : a ∈ (L.append R).support := (GraphWalk.mem_support_append L R).mpr + (.inl L.end_mem_support) + have ha₂ : a ∈ (A.append R₁).support := (GraphWalk.mem_support_append A R₁).mpr + (.inl A.end_mem_support) + obtain ⟨u, B₁, B₂, T, h₁, h₂, ha, -⟩ := h1.merge h2 ha₁ ha₂ + obtain ⟨X, Y, rfl⟩ := T.exists_append_of_mem ha + rw [← GraphWalk.append_assoc'] at h₁ h₂ + have e₁ := (tail_unique L (B₁.append X) R Y h1.1 h₁).1 + have e₂ := (tail_unique A (B₂.append X) R₁ Y h2.1 h₂).1 + rw [e₁, e₂] + +/-- The setting of (13.4), with the two spokes read as walks. -/ +structure IsFan (D : TangleDatum cap χ) (W : Set Shat) (H : Drawing Shat) (ρ : ℕ) (r : Shat) + (f₁ f₂ : Set Shat) + (A₁ : GraphWalk D.rad.G.toGraph v₁ u) (A₂ : GraphWalk D.rad.G.toGraph v₂ u) + (T : GraphWalk D.rad.G.toGraph u h) : Prop where + hub : D.IsWheelHubOfRadius W H ρ + bd_off : discBd W ⊆ cap.emb '' (univ \ bd S) + inner : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty + r_mem : r ∈ D.rad.Rstar + r_bd : r ∈ discBd W + ne : v₁ ≠ v₂ + link₁ : D.rad.G.toGraph.IsLink f₁ r v₁ + link₂ : D.rad.G.toGraph.IsLink f₂ r v₂ + spoke₁ : D.IsSpokeWalk W H (A₁.append T) + spoke₂ : D.IsSpokeWalk W H (A₂.append T) + meet : ∀ y ∈ A₁.support, y ∈ A₂.support → y = u + +variable {A₁ : GraphWalk D.rad.G.toGraph v₁ u} {A₂ : GraphWalk D.rad.G.toGraph v₂ u} {T : GraphWalk + D.rad.G.toGraph u h} + +omit [T2Space S] in +theorem IsFan.swap (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) : D.IsFan W H ρ r f₂ f₁ A₂ A₁ T := + ⟨hf.hub, hf.bd_off, hf.inner, hf.r_mem, hf.r_bd, hf.ne.symm, hf.link₂, hf.link₁, hf.spoke₂, + hf.spoke₁, + fun y h₁ h₂ ↦ hf.meet y h₂ h₁⟩ + +/-- A walk from `r*` to the hub has at least `ρ` edges, by (13.1). -/ +theorem IsFan.walk_from_r (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) {z : Shat} (hz : z ∈ H.V) + (L : GraphWalk D.rad.G.toGraph r z) : + ρ ≤ L.length := by + obtain ⟨P, hP, hle⟩ := exists_path_of_walk L + by_contra hn + exact theorem_13_1_proof hf.hub hf.bd_off hf.inner hf.r_mem hf.r_bd ⟨P, z, hz, hP, by omega⟩ + +/-- `r*` is on no spoke, by (13.1). -/ +theorem IsFan.r_notMem_spoke (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) {v h' : Shat} {K : GraphWalk + D.rad.G.toGraph v h'} + (hK : D.IsSpokeWalk W H K) : r ∉ K.support := by + intro hr + obtain ⟨L, R, rfl⟩ := K.exists_append_of_mem hr + have h₁ := hf.walk_from_r hK.2.h_mem R + have h₂ := (hf.hub.spoke_length hK).1 + rw [GraphWalk.length_append] at h₂ + have hpos : 1 ≤ L.length := by + cases L with + | nil _ => exact absurd hK.2.v_mem.1 hf.r_mem.2 + | @cons _ c _ e hl q => + rw [GraphWalk.length_cons] + omega + omega + +omit [T2Space S] in +/-- The outer end of a spoke of the fan is not `u`. -/ +theorem IsFan.v₁_ne (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) : v₁ ≠ u := by + rintro rfl + have hs := (GraphWalk.IsSimple.of_append hf.spoke₁.1).1.length_eq_zero + have h₂ := D.two_le_of_hatV A₂ hf.spoke₂.2.v_mem.1 hf.spoke₁.2.v_mem.1 hf.ne.symm + have h₃ := (hf.hub.spoke_length hf.spoke₂).1 + have h₄ := (hf.hub.spoke_length hf.spoke₁).2 + rw [GraphWalk.length_append] at h₃ h₄ + omega + +omit [T2Space S] in +theorem IsFan.A_pos (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) : 1 ≤ A₁.length := by + cases hA : A₁ with + | nil _ => exact absurd rfl hf.v₁_ne + | @cons _ c _ e hl q => + rw [GraphWalk.length_cons] + omega + +omit [T2Space S] in +theorem IsFan.T_lt (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) : T.length < ρ := by + have h₃ := (hf.hub.spoke_length hf.spoke₁).1 + have := hf.A_pos + rw [GraphWalk.length_append] at h₃ + omega + +omit [T2Space S] in +theorem IsFan.u_mem_G (_ : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) : u ∈ D.rad.G.V := + T.mem_vertexSet_of_mem_support T.start_mem_support + +/-- `u` is not on `bd(W)`. If `u ∈ V(Γ)` then `A₁` has at least two edges, and if not then (13.1) +applies. -/ +theorem IsFan.u_notMem_bd (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) : u ∉ discBd W := by + intro hu + have hh := hf.spoke₁.2.h_mem + have h₃ := (hf.hub.spoke_length hf.spoke₁).1 + rw [GraphWalk.length_append] at h₃ + by_cases huV : u ∈ D.P.Γ.hatV cap + · have h₁ := hf.hub.walk_ge ⟨huV, hu⟩ hh T + have h₂ := D.two_le_of_hatV A₁ hf.spoke₁.2.v_mem.1 huV hf.v₁_ne + omega + · obtain ⟨P, hP, hle⟩ := exists_path_of_walk T + have := hf.A_pos + exact theorem_13_1_proof hf.hub hf.bd_off hf.inner ⟨hf.u_mem_G, huV⟩ hu ⟨P, h, hh, hP, by omega⟩ + +/-- The circuit of the fan. -/ +structure IsFanCircuit (D : TangleDatum cap χ) (r : Shat) (f₁ f₂ : Set Shat) + (A₁ : GraphWalk D.rad.G.toGraph v₁ u) + (A₂ : GraphWalk D.rad.G.toGraph v₂ u) (C : Drawing Shat) : Prop where + circuit : C.IsCircuitOf D.rad.G + mem_V : ∀ x, x ∈ C.V ↔ x = r ∨ x ∈ A₁.support ∨ x ∈ A₂.support + mem_E : ∀ e, e ∈ C.E ↔ e = f₁ ∨ e = f₂ ∨ e ∈ A₁.edges ∨ e ∈ A₂.edges + card : C.E.ncard ≤ A₁.length + A₂.length + 2 + +omit [T2Space S] in +omit [T2Space Shat] in +theorem IsFanCircuit.swap {C : Drawing Shat} (h : D.IsFanCircuit r f₁ f₂ A₁ A₂ C) : D.IsFanCircuit + r f₂ f₁ A₂ A₁ C := by + refine ⟨h.circuit, fun x ↦ ?_, fun e ↦ ?_, by have := h.card; omega⟩ + · rw [h.mem_V x] + tauto + · rw [h.mem_E e] + tauto + +/-- The circuit of a fan exists. -/ +theorem IsFan.exists_circuit (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) : ∃ C, D.IsFanCircuit r f₁ f₂ A₁ + A₂ C := by + classical + have hA₁ : A₁.IsSimple := (GraphWalk.IsSimple.of_append hf.spoke₁.1).1 + have hA₂ : A₂.IsSimple := (GraphWalk.IsSimple.of_append hf.spoke₂.1).1 + have hr₁ : r ∉ A₁.support := fun h' ↦ hf.r_notMem_spoke hf.spoke₁ + ((GraphWalk.mem_support_append A₁ T).mpr (.inl h')) + have hr₂ : r ∉ A₂.support := fun h' ↦ hf.r_notMem_spoke hf.spoke₂ + ((GraphWalk.mem_support_append A₂ T).mpr (.inl h')) + set R₁ := GraphWalk.cons hf.link₁ A₁ with hR₁ + set R₂ := (GraphWalk.cons hf.link₂ A₂).reverse with hR₂ + have hs₁ : R₁.IsSimple := List.nodup_cons.mpr ⟨hr₁, hA₁⟩ + have hs₂' : (GraphWalk.cons hf.link₂ A₂).IsSimple := List.nodup_cons.mpr ⟨hr₂, hA₂⟩ + have hs₂ : R₂.IsSimple := hs₂'.reverse + have hsup₁ : ∀ x, x ∈ R₁.support ↔ x = r ∨ x ∈ A₁.support := fun x ↦ by simp [hR₁] + have hsup₂ : ∀ x, x ∈ R₂.support ↔ x = r ∨ x ∈ A₂.support := fun x ↦ by + simp only [hR₂, GraphWalk.support_reverse, List.mem_reverse] + simp + have hed₁ : ∀ e, e ∈ R₁.edges ↔ e = f₁ ∨ e ∈ A₁.edges := fun e ↦ by simp [hR₁] + have hed₂ : ∀ e, e ∈ R₂.edges ↔ e = f₂ ∨ e ∈ A₂.edges := fun e ↦ by + simp only [hR₂, GraphWalk.edges_reverse, List.mem_reverse] + simp + have hcl : (R₁.append R₂).IsSimpleClosed := by + refine GraphWalk.isSimpleClosed_append hs₁ hs₂ ?_ ?_ + · intro x h₁ h₂ + rcases (hsup₁ x).mp h₁ with rfl | h₁' + · exact .inl rfl + rcases (hsup₂ x).mp h₂ with rfl | h₂' + · exact .inl rfl + exact .inr (hf.meet x h₁' h₂') + · intro e h₁ h₂ + rcases (hed₁ e).mp h₁ with rfl | h₁' <;> rcases (hed₂ e).mp h₂ with h₂' | h₂' + · subst h₂' + have hc := hf.link₁.2.2.2 + rw [hf.link₂.2.2.2] at hc + have hm : v₂ ∈ ({r, v₁} : Set Shat) := by + rw [← hc] + exact .inr rfl + rcases hm with rfl | hm + · exact hf.r_mem.2 hf.spoke₂.2.v_mem.1 + · exact hf.ne hm.symm + · exact hr₂ (A₂.left_mem_support_of_mem_edges h₂' hf.link₁) + · subst h₂' + exact hr₁ (A₁.left_mem_support_of_mem_edges h₁' hf.link₂) + · obtain ⟨x, y, hxy, hx, hy, hcap⟩ := D.exists_ends_of_mem_edges A₁ h₁' + obtain ⟨hx', hy'⟩ := D.ends_mem_support A₂ h₂' hcap + exact hxy ((hf.meet x hx hx').trans (hf.meet y hy hy').symm) + have hpos : 0 < (R₁.append R₂).length := by + rw [GraphWalk.length_append, hR₁, GraphWalk.length_cons] + omega + refine ⟨walkDrawing _ (R₁.append R₂), ⟨walkDrawing_isSubdrawing _ _, + isCircuit_walkDrawing _ hcl hpos⟩, fun x ↦ ?_, fun e ↦ ?_, ?_⟩ + · rw [walkDrawing_V] + change x ∈ (R₁.append R₂).support ↔ _ + rw [GraphWalk.mem_support_append, hsup₁, hsup₂] + tauto + · rw [walkDrawing_E] + change e ∈ (R₁.append R₂).edges ↔ _ + rw [GraphWalk.edges_append, List.mem_append, hed₁, hed₂] + tauto + · rw [walkDrawing_E] + refine (ncard_mem_list_le _).trans ?_ + change (R₁.append R₂).length ≤ _ + rw [GraphWalk.length_append, hR₁, hR₂, GraphWalk.length_cons, GraphWalk.length_reverse, + GraphWalk.length_cons] + omega + +omit [T2Space S] in +/-- `H` meets the circuit of the fan at most in `u`, and then `u` is the inner end. -/ +theorem IsFan.hub_meet (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) {C : Drawing Shat} + (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ C) {x : Shat} + (hx : x ∈ H.U) (hxC : x ∈ C.U) : x = u ∧ u = h := by + have : ConnectedSpace Shat := cap.connected + have hHW := hf.hub.H_in_int + have hG := hC.circuit.1 + have key : ∀ z ∈ H.V, z ∈ C.V → z = u ∧ u = h := by + intro z hz hzC + have side : ∀ {v : Shat} {A : GraphWalk D.rad.G.toGraph v u}, D.IsSpokeWalk W H (A.append T) + → z ∈ A.support → + z = u ∧ u = h := by + intro v A hA hzA + have e₁ : z = h := hA.support_hub ((GraphWalk.mem_support_append A T).mpr (.inl hzA)) hz + have e₂ : z = u := GraphWalk.inter_of_simple hA.1 hzA (e₁ ▸ T.end_mem_support) + exact ⟨e₂, e₂.symm.trans e₁⟩ + rcases (hC.mem_V z).mp hzC with rfl | h₁ | h₂ + · exact absurd hf.r_bd (hHW (H.V_subset_U hz)).2 + · exact side hf.spoke₁ h₁ + · exact side hf.spoke₂ h₂ + by_cases hxV : x ∈ H.V + · exact key x hxV (mem_V_of_mem_U hG hxC (hf.hub.H_sub.1 hxV)) + · obtain ⟨g, hg, hxg⟩ := H.exists_edge_of_mem hx hxV + have hgG : g ∈ D.rad.G.E := hf.hub.H_sub.2 hg + have hxG : x ∉ D.rad.G.V := ((hgG.2.1 hxg)).2 + have hxCV : x ∉ C.V := fun h' ↦ hxG (hG.1 h') + obtain ⟨g', hg', hxg'⟩ := C.exists_edge_of_mem hxC hxCV + obtain rfl := D.rad.G.edge_eq_of_mem hgG (hG.2 hg') hxg hxg' + obtain ⟨a, ha, b, hb, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 g hgG + have hl : D.rad.G.toGraph.IsLink g a b := ⟨hgG, D.rad.isPreRadial.2.1 ha, hb.1, hcap⟩ + have h₁ := Drawing.IsLink.mem_V_of_sub hf.hub.H_sub hl hg + have h₂ := Drawing.IsLink.mem_V_of_sub hG hl hg' + have e₁ := key a h₁.1 h₂.1 + have e₂ := key b h₁.2 h₂.2 + exact absurd (e₁.1.trans e₂.1.symm ▸ ha) hb.2 + +/-- A spoke through a vertex of the circuit of the fan has the same inner end. -/ +theorem IsFan.spoke_end (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) {C : Drawing Shat} + (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ C) + {v h' a : Shat} {K : GraphWalk D.rad.G.toGraph v h'} (hK : D.IsSpokeWalk W H K) + (ha : a ∈ K.support) (haC : a ∈ C.V) : + h' = h := by + rcases (hC.mem_V a).mp haC with rfl | h₁ | h₂ + · exact absurd ha (hf.r_notMem_spoke hK) + · exact hK.same_end hf.spoke₁ ha ((GraphWalk.mem_support_append A₁ T).mpr (.inl h₁)) + · exact hK.same_end hf.spoke₂ ha ((GraphWalk.mem_support_append A₂ T).mpr (.inl h₂)) + +omit [T2Space S] in +/-- After a vertex of `A₁`, a spoke follows `A₁`, then `T`. -/ +theorem IsFan.spoke_tail_left (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) {v a : Shat} {L : GraphWalk + D.rad.G.toGraph v a} + {R : GraphWalk D.rad.G.toGraph a h} (hK : D.IsSpokeWalk W H (L.append R)) + (ha : a ∈ A₁.support) : + ∃ X : GraphWalk D.rad.G.toGraph a u, R = X.append T ∧ (∀ e ∈ X.edges, e ∈ A₁.edges) + ∧ ∀ x ∈ X.support, x ∈ A₁.support := by + obtain ⟨Y, X, rfl⟩ := A₁.exists_append_of_mem ha + have hs₁ := hf.spoke₁ + rw [GraphWalk.append_assoc'] at hs₁ + refine ⟨X, hK.tail_after hs₁, fun e he ↦ ?_, fun x hx ↦ ?_⟩ + · rw [GraphWalk.edges_append, List.mem_append] + exact .inr he + · exact (GraphWalk.mem_support_append Y X).mpr (.inr hx) + +/-- After a vertex of the circuit of the fan, a spoke follows the circuit, then `T`. -/ +theorem IsFan.spoke_tail (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) {C : Drawing Shat} + (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ C) + {v a : Shat} {L : GraphWalk D.rad.G.toGraph v a} {R : GraphWalk D.rad.G.toGraph a h} + (hK : D.IsSpokeWalk W H (L.append R)) + (haC : a ∈ C.V) : + ∃ X : GraphWalk D.rad.G.toGraph a u, R = X.append T ∧ (∀ e ∈ X.edges, e ∈ C.E) + ∧ ∀ x ∈ X.support, x ∈ C.V := by + rcases (hC.mem_V a).mp haC with rfl | h₁ | h₂ + · exact absurd ((GraphWalk.mem_support_append L R).mpr (.inl L.end_mem_support)) + (hf.r_notMem_spoke hK) + · obtain ⟨X, h₃, h₄, h₅⟩ := hf.spoke_tail_left hK h₁ + exact ⟨X, h₃, fun e he ↦ (hC.mem_E e).mpr (.inr (.inr (.inl (h₄ e he)))), + fun x hx ↦ (hC.mem_V x).mpr (.inr (.inl (h₅ x hx)))⟩ + · obtain ⟨X, h₃, h₄, h₅⟩ := hf.swap.spoke_tail_left hK h₂ + exact ⟨X, h₃, fun e he ↦ (hC.mem_E e).mpr (.inr (.inr (.inr (h₄ e he)))), + fun x hx ↦ (hC.mem_V x).mpr (.inr (.inr (h₅ x hx)))⟩ + +omit [T2Space S] in +theorem IsFan.card_lt (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) {C : Drawing Shat} + (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ C) : + C.E.ncard ≤ 2 * ρ + 2 ∧ C.E.ncard < 2 * D.rep := by + have h₁ := (hf.hub.spoke_length hf.spoke₁).1 + have h₂ := (hf.hub.spoke_length hf.spoke₂).1 + rw [GraphWalk.length_append] at h₁ h₂ + have h₃ := hC.card + have h₄ := hf.hub.rep_ge + omega + +omit [T2Space S] in +/-- The disc in `W` bounded by a short circuit is its inside, since `W` is a wheel and `W` is not +all of `Σ̂`. -/ +theorem IsWheelHubOfRadius.eq_ins_of_disc (hW : D.IsWheelHubOfRadius W H ρ) {C : Drawing Shat} + (hC : C.IsCircuitOf D.rad.G) + (hle : C.E.ncard ≤ 4 * ρ + 4) {Δ : Set Shat} (hΔ : IsClosedDisc Δ) (hΔW : Δ ⊆ W) + (hbd : discBd Δ = C.U) : Δ = D.ins C := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hlt : C.E.ncard < 2 * D.rep := by + have := hW.rep_ge + omega + have hs := D.ins_spec hC hlt + have hsub : D.ins C ⊆ W := hW.ins_sub C hC hle (by + rw [← hbd] + exact (Surface.discBd_subset Δ).trans hΔW) + by_contra hne + have hcov := cover_of_discBd_eq hT hΔ hs.2.2.1 (hbd.trans hs.2.2.2.1.symm) hne + obtain ⟨p, hp⟩ := hW.isConnected_compl.nonempty + have : p ∈ Δ ∪ D.ins C := by + rw [hcov] + exact mem_univ p + rcases this with h' | h' + · exact hp (hΔW h') + · exact hp (hsub h') + +omit [T2Space S] in +/-- Strictly inside a circuit means in the interior of its inside. -/ +theorem ins_diff_iff (D : TangleDatum cap χ) {F : Drawing Shat} (hF : F.IsCircuitOf D.rad.G) + (hlt : F.E.ncard < 2 * D.rep) + {x : Shat} : x ∈ D.ins F \ F.U ↔ x ∈ interior (D.ins F) := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨hcl, hfr, hU⟩ := ins_facts_of_length (D.isSlope (by omega)) hF.2 hF.1 hlt + constructor + · rintro ⟨h₁, h₂⟩ + by_contra hn + apply h₂ + rw [← hfr, frontier, hcl.closure_eq] + exact ⟨h₁, hn⟩ + · intro h' + refine ⟨interior_subset h', fun hu ↦ ?_⟩ + rw [← hfr, frontier] at hu + exact hu.2 h' + +omit [T2Space S] in +/-- A part of a simple walk that starts off the strict inside of a circuit and meets the circuit at +most in its last vertex +misses the strict inside of the circuit. -/ +theorem part_outside (D : TangleDatum cap χ) {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hlt : C.E.ncard < 2 * D.rep) + {s e : Shat} (L : GraphWalk D.rad.G.toGraph s e) (hs : L.IsSimple) (hout : s ∉ D.ins C \ C.U) + (hfirst : ∀ y ∈ L.support, y ∈ C.V → y = e) {p : Shat} (hp : p ∈ (walkDrawing D.rad.G L).U) + (hpi : p ∈ D.ins C) : + p ∈ C.U := by + have : ConnectedSpace Shat := cap.connected + have hsl := D.isSlope (by omega) + obtain ⟨hcl, hfr, hU⟩ := ins_facts_of_length hsl hC.2 hC.1 hlt + have hvert : ∀ x ∈ L.support, x ∉ D.ins C \ C.U := by + intro x hx hxi + obtain ⟨L₁, L₂, rfl⟩ := L.exists_append_of_mem hx + obtain ⟨a, ha, haC⟩ := D.walk_meets_circuit hC hlt L₁.reverse hxi.1 hout + have ha' : a ∈ L₁.support := by simpa [GraphWalk.support_reverse] using ha + have hae := hfirst a ((GraphWalk.mem_support_append L₁ L₂).mpr (.inl ha')) haC + subst hae + have := GraphWalk.inter_of_simple hs ha' L₂.end_mem_support + subst this + exact hxi.2 (C.V_subset_U haC) + have hvert' : ∀ x ∈ L.support, x ∈ D.ins C → x ∈ C.V := by + intro x hx hxi + by_contra hn + exact hvert x hx ⟨hxi, fun hu ↦ hn (mem_V_of_mem_U hC.1 hu (L.mem_vertexSet_of_mem_support hx))⟩ + rcases (mem_walkDrawing_U _ _).mp hp with hp' | ⟨g, hg, hpg⟩ + · exact C.V_subset_U (hvert' p hp' hpi) + · by_cases hgC : g ∈ C.E + · exact C.closure_subset_U hgC hpg + have hgE : g ∈ D.rad.G.E := TieBreaker.mem_edges_E L hg + obtain ⟨x, y, hxy, hx, hy, hcap⟩ := D.exists_ends_of_mem_edges L hg + have hmem : ∀ z, z ∈ closure g ∩ D.rad.G.V → z ∈ L.support := by + intro z hz + rw [hcap] at hz + rcases hz with rfl | rfl + · exact hx + · exact hy + rcases closure_edge_subset hgE hpg with h' | h' + · have hsub : g ⊆ D.ins C := by + rcases edge_subset_or_disjoint_of_length hsl hC.2 hC.1 hlt hgE with h₁ | h₁ + · exact h₁ + · exact absurd hpi (disjoint_left.mp h₁ h') + have hcl' := closure_minimal hsub hcl + have hxc : x ∈ closure g ∩ D.rad.G.V := by rw [hcap]; exact .inl rfl + have hyc : y ∈ closure g ∩ D.rad.G.V := by rw [hcap]; exact .inr rfl + have hxV := hvert' x hx (hcl' hxc.1) + have hyV := hvert' y hy (hcl' hyc.1) + exact absurd ((hfirst x hx hxV).trans (hfirst y hy hyV).symm) hxy + · exact C.V_subset_U (hvert' p (hmem p ⟨hpg, h'⟩) hpi) + +/-- A part of a spoke between two points of `ins(F)`, for an enclave `F`, lies in `ins(F)`. -/ +theorem IsSpokeWalk.part_in_ins {F : Drawing Shat} (hF : IsEnclave D.tb D.ord D.𝒯 F) {v a b h : + Shat} + {A : GraphWalk D.rad.G.toGraph v a} {M : GraphWalk D.rad.G.toGraph a b} {B : GraphWalk + D.rad.G.toGraph b h} + (hK : D.IsSpokeWalk W H (A.append (M.append B))) (ha : a ∈ D.ins F) (hb : b ∈ D.ins F) : + (∀ z ∈ M.support, z ∈ D.ins F) ∧ ∀ e ∈ M.edges, e ⊆ D.ins F := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨ord', 𝒯', h𝒯', hc, hlt, -⟩ := id hF + have hlt' : F.E.ncard < 2 * D.rep := hlt + obtain ⟨hcl, hfr, hU⟩ := ins_facts_of_length (D.isSlope (by omega)) hc.2 hc.1 hlt' + have hE : ∀ {K : GraphWalk D.rad.G.toGraph v h}, ∀ e, e ∈ (walkDrawing D.rad.G K).E ↔ e ∈ K.edges + := fun e ↦ IsSpokeWalk.mem_E + have hMin : ∀ z ∈ M.support, z ∈ D.ins F := by + intro z hz + by_contra hzn + obtain ⟨M₁, M₂, rfl⟩ := M.exists_append_of_mem hz + have heq : A.append ((M₁.append M₂).append B) = (A.append M₁).append (M₂.append B) := by + rw [GraphWalk.append_assoc', GraphWalk.append_assoc'] + obtain ⟨p, hp, hpF⟩ := D.walk_meets_circuit hc hlt' M₁ ha fun h' ↦ hzn h'.1 + obtain ⟨q, hq, hqF⟩ := D.walk_meets_circuit hc hlt' M₂.reverse hb fun h' ↦ hzn h'.1 + have hq' : q ∈ (M₂.append B).support := + (GraphWalk.mem_support_append M₂ B).mpr (.inl (by simpa [GraphWalk.support_reverse] using hq)) + have hp' : p ∈ (A.append M₁).support := (GraphWalk.mem_support_append A M₁).mpr (.inr hp) + rw [heq] at hK + have hzF := hK.2.mem_of_between hF (K₁ := A.append M₁) (K₂ := M₂.append B) hK.1 (fun e ↦ hE e) + ⟨p, hp', hpF⟩ ⟨q, hq', hqF⟩ + exact hzn (hU (F.V_subset_U hzF)) + refine ⟨hMin, fun e he ↦ ?_⟩ + obtain ⟨x, y, hl, M₁, M₂, rfl⟩ := GraphWalk.exists_split_edge M he + have hxm : x ∈ (M₁.append (GraphWalk.cons hl M₂)).support := + (GraphWalk.mem_support_append _ _).mpr (.inl M₁.end_mem_support) + have hym : y ∈ (M₁.append (GraphWalk.cons hl M₂)).support := + (GraphWalk.mem_support_append _ _).mpr (.inr (by simp [M₂.start_mem_support])) + by_cases hxF : x ∈ F.V + · by_cases hyF : y ∈ F.V + · have heq : A.append ((M₁.append (GraphWalk.cons hl M₂)).append B) = + (A.append M₁).append ((GraphWalk.cons hl (GraphWalk.nil hl.right_mem)).append + (M₂.append B)) := by + simp only [GraphWalk.append_assoc'] + rfl + rw [heq] at hK + have hin := hK.2.subwalk_in_enclave hF (GraphWalk.cons hl (GraphWalk.nil hl.right_mem)) hK.1 + (fun f ↦ hE f) hxF hyF + have heF := hin e (by simp) + exact fun q hq ↦ hU (F.closure_subset_U heF (subset_closure hq)) + · have hl' : D.rad.G.toGraph.IsLink e y x := ⟨hl.1, hl.2.2.1, hl.2.1, by rw [hl.2.2.2, + pair_comm]⟩ + exact (D.edge_inside_of_mem hc hlt' hl' ⟨hMin y hym, fun hu ↦ hyF + (mem_V_of_mem_U hc.1 hu hl.right_mem)⟩).1 + · exact (D.edge_inside_of_mem hc hlt' hl ⟨hMin x hxm, fun hu ↦ hxF (mem_V_of_mem_U hc.1 hu + hl.left_mem)⟩).1 + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13f.lean b/LeanPool/GraphMinor/GM19/Section13f.lean new file mode 100644 index 0000000000..0253b12fde --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13f.lean @@ -0,0 +1,595 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13e + +/-! +# Graph Minors XIX, Section 13: (13.4) + +The proof is the paper's. If the disc `Δ` of the fan holds a point of `U(H)` other than `u`, then +all of `U(H)` lies in `Δ`, every +spoke passes through `u`, no small enclave surrounds `u`, and so `u` is a hub of radius `ρ - +|E(T)|`. Then `H` is not optimal. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r v₁ v₂ u h : Shat} {f₁ + f₂ : Set Shat} + {A₁ : GraphWalk D.rad.G.toGraph v₁ u} {A₂ : GraphWalk D.rad.G.toGraph v₂ u} {T : GraphWalk + D.rad.G.toGraph u h} {C : Drawing Shat} + +/-- A line is preconnected. -/ +theorem isPreconnected_of_isLineWithEnds {X : Type*} [TopologicalSpace X] {L : Set X} {a b : X} + (h : IsLineWithEnds L a b) : + IsPreconnected L := + GraphMinor.Surface.IsLineWithEnds.isPreconnected h + +omit [T2Space S] in +omit [T2Space Shat] in +/-- A circuit of `Γ*` has at least two vertices. -/ +theorem IsCircuit.two_vertices (D : TangleDatum cap χ) {F : Drawing Shat} + (hF : F.IsCircuitOf D.rad.G) : F.V.ncard ≠ 1 := by + intro hc + obtain ⟨u, K, -, hpos, -, hE⟩ := hF.2 + obtain ⟨y, hy⟩ := ncard_eq_one.mp hc + cases K with + | nil _ => simp [GraphWalk.length] at hpos + | @cons _ c _ e hl q => + have heF : e ∈ F.E := by rw [hE]; simp + have heG := hF.1.2 heF + obtain ⟨a, ha, b, hb, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 e heG + have hl' : D.rad.G.toGraph.IsLink e a b := ⟨heG, D.rad.isPreRadial.2.1 ha, hb.1, hcap⟩ + have h₁ := Drawing.IsLink.mem_V_of_sub hF.1 hl' heF + rw [hy] at h₁ + have e₁ : a = y := h₁.1 + have e₂ : b = y := h₁.2 + exact hb.2 (e₂.trans e₁.symm ▸ ha) + +omit [T2Space S] in +/-- Step of (13.4): a point of `U(H)` in `Δ`, not `u`, brings all of `U(H)` into `Δ`. -/ +theorem IsFan.hub_inside (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ C) + {x : Shat} (hx : x ∈ H.U) + (hxi : x ∈ D.ins C) (hxu : x ≠ u) : H.U ⊆ D.ins C := by + have : ConnectedSpace Shat := cap.connected + have hlt := (hf.card_lt hC).2 + obtain ⟨hcl, hfr, hU⟩ := ins_facts_of_length (D.isSlope (by omega)) hC.circuit.2 hC.circuit.1 hlt + have hint : x ∈ interior (D.ins C) := (D.ins_diff_iff hC.circuit hlt).mp ⟨hxi, fun hu ↦ hxu + (hf.hub_meet hC hx hu).1⟩ + intro y hy + by_cases hyu : y = u + · subst hyu + exact hU (C.V_subset_U ((hC.mem_V _).mpr (.inr (.inl A₁.end_mem_support)))) + by_cases hxy : x = y + · exact hxy ▸ hxi + rcases hf.hub.hub_cond with ⟨hc, hE, -⟩ | ⟨hen, -, -⟩ + · have hUV : H.U = H.V := by + rw [H.U_eq, hE] + simp + rw [hUV] at hx hy + obtain ⟨z, hz⟩ := ncard_eq_one.mp hc + rw [hz] at hx hy + exact absurd (hx.trans hy.symm) hxy + · obtain ⟨-, -, -, hcF, -⟩ := hen + obtain ⟨A, B, hA, hB, hAB, hAB'⟩ := (IsCircuit.isOArc_U hcF.2).lines hx hy hxy + have hAU : A ⊆ H.U := hAB ▸ subset_union_left + have hBU : B ⊆ H.U := hAB ▸ subset_union_right + have hL : ∃ L : Set Shat, IsLineWithEnds L x y ∧ L ⊆ H.U ∧ u ∉ L := by + by_cases huA : u ∈ A + · refine ⟨B, hB, hBU, fun huB ↦ ?_⟩ + have : u ∈ A ∩ B := ⟨huA, huB⟩ + rw [hAB'] at this + rcases this with h' | h' + · exact hxu h'.symm + · exact hyu h'.symm + · exact ⟨A, hA, hAU, huA⟩ + obtain ⟨L, hLl, hLU, hLu⟩ := hL + have hcon := isPreconnected_of_isLineWithEnds hLl + have hxL : x ∈ L := by + obtain ⟨f, h₀, -⟩ := hLl + rw [← h₀] + exact (f 0).2 + have hyL : y ∈ L := by + obtain ⟨f, -, h₁⟩ := hLl + rw [← h₁] + exact (f 1).2 + have hcov : L ⊆ interior (D.ins C) ∪ (D.ins C)ᶜ := by + intro p hp + by_cases hpi : p ∈ D.ins C + · refine .inl ((D.ins_diff_iff hC.circuit hlt).mp ⟨hpi, fun hu ↦ ?_⟩) + have := (hf.hub_meet hC (hLU hp) hu).1 + exact hLu (this ▸ hp) + · exact .inr hpi + have := hcon.subset_left_of_subset_union isOpen_interior hcl.isOpen_compl + (disjoint_left.mpr fun p h₁ h₂ ↦ h₂ (interior_subset h₁)) hcov ⟨x, hxL, hint⟩ + exact interior_subset (this hyL) + +/-- Step of (13.4): if `U(H) ⊆ Δ` then every spoke passes through `u`. The proof: a spoke joins +`V(H) ⊆ Δ` to a vertex of `bd(W)`, so it +meets `bd(Δ)`, and then (13.2) applies. -/ +theorem IsFan.spoke_at (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ C) + (hsub : D.ins C ⊆ W) + (hHC : H.U ⊆ D.ins C) {v : Shat} (hv : v ∈ (cap.emb '' D.Γ.V) ∩ discBd W) : + ∃ A : GraphWalk D.rad.G.toGraph v u, A.length + T.length ≤ ρ := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hlt := (hf.card_lt hC).2 + obtain ⟨h', K, hK⟩ := hf.hub.exists_spoke hv + have hout : v ∉ D.ins C \ C.U := by + intro h₁ + have hi := interior_mono hsub ((D.ins_diff_iff hC.circuit hlt).mp h₁) + have hvf : v ∈ frontier W := by + rw [IsClosedDisc.frontier_eq_discBd hT hf.hub.is_disc] + exact hv.2 + exact hvf.2 hi + obtain ⟨a, ha, haC⟩ := D.walk_meets_circuit hC.circuit hlt K.reverse (hHC + (H.V_subset_U hK.2.h_mem)) hout + have ha' : a ∈ K.support := by simpa [GraphWalk.support_reverse] using ha + obtain rfl := hf.spoke_end hC hK ha' haC + obtain ⟨L, R, rfl⟩ := K.exists_append_of_mem ha' + obtain ⟨X, rfl, -, -⟩ := hf.spoke_tail hC hK haC + refine ⟨L.append X, ?_⟩ + have := (hf.hub.spoke_length hK).1 + simp only [GraphWalk.length_append] at this ⊢ + omega + +/-- Step of (13.4): the edges and vertices of the fan's circuit lie in `ins(F)` if `v₁, v₂, u` lie +there. -/ +theorem IsFan.circuit_in_ins (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hC : D.IsFanCircuit r f₁ f₂ A₁ + A₂ C) {F : Drawing Shat} + (hFe : IsEnclave D.tb D.ord D.𝒯 F) (hv₁ : v₁ ∈ D.ins F \ F.U) (hv₂ : v₂ ∈ D.ins F \ F.U) + (hu : u ∈ D.ins F) : + C.U ⊆ D.ins F := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨ord', 𝒯', h𝒯', hc, hlt, -⟩ := id hFe + have hlt' : F.E.ncard < 2 * D.rep := hlt + obtain ⟨hcl, hfr, hU⟩ := ins_facts_of_length (D.isSlope (by omega)) hc.2 hc.1 hlt' + have hnil : ∀ {v : Shat} {A : GraphWalk D.rad.G.toGraph v u}, D.IsSpokeWalk W H (A.append T) + → v ∈ D.ins F \ F.U → + (∀ z ∈ A.support, z ∈ D.ins F) ∧ ∀ e ∈ A.edges, e ⊆ D.ins F := by + intro v A hA hv + have hv' : v ∈ (D.rad.G.V) := A.mem_vertexSet_of_mem_support A.start_mem_support + have e : A.append T = (GraphWalk.nil hv').append (A.append T) := rfl + rw [e] at hA + exact hA.part_in_ins hFe hv.1 hu + obtain ⟨hs₁, he₁⟩ := hnil hf.spoke₁ hv₁ + obtain ⟨hs₂, he₂⟩ := hnil hf.spoke₂ hv₂ + obtain ⟨hf₁, hr⟩ := D.edge_inside_of_mem hc hlt' hf.link₁.symm hv₁ + obtain ⟨hf₂, -⟩ := D.edge_inside_of_mem hc hlt' hf.link₂.symm hv₂ + rw [C.U_eq] + refine union_subset (fun x hx ↦ ?_) (iUnion₂_subset fun e he ↦ closure_minimal ?_ hcl) + · rcases (hC.mem_V x).mp hx with rfl | h₁ | h₂ + · exact hr + · exact hs₁ x h₁ + · exact hs₂ x h₂ + · rcases (hC.mem_E e).mp he with rfl | rfl | h₁ | h₂ + · exact hf₁ + · exact hf₂ + · exact he₁ e h₁ + · exact he₂ e h₂ + +/-- Step of (13.4): no small enclave has `u` strictly inside. -/ +theorem IsFan.no_enclave (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ C) + {x : Shat} (hx : x ∈ H.U) + (hxi : x ∈ D.ins C \ C.U) (hHC : H.U ⊆ D.ins C) {F : Drawing Shat} + (hFe : IsEnclave D.tb D.ord D.𝒯 F) + (hFle : F.E.ncard ≤ 4 * ρ + 4) : u ∉ D.ins F \ F.U := by + have : ConnectedSpace Shat := cap.connected + intro hu + have hrep := hf.hub.rep_ge + have hlt := (hf.card_lt hC).2 + obtain ⟨ord', 𝒯', h𝒯', hc, hlt₀, Δ, hins, hd⟩ := id hFe + have hlt' : F.E.ncard < 2 * D.rep := hlt₀ + have hsl := D.isSlope (by omega) + obtain ⟨hcl, hfr, hU⟩ := ins_facts_of_length hsl hc.2 hc.1 hlt' + obtain ⟨hclC, hfrC, hUC⟩ := ins_facts_of_length hsl hC.circuit.2 hC.circuit.1 hlt + have hh := hf.spoke₁.2.h_mem + have hlen : ∀ {Y : Drawing Shat}, Y.E.ncard < 2 * D.rep → Y.length < 2 * D.rep := fun h' ↦ h' + -- `h` is not strictly inside `F`, and if `v₁, v₂` are, then we are done. + have hstep : h ∉ D.ins F \ F.U → C.U ⊆ D.ins F := by + intro hhF + have side : ∀ {v : Shat} {A : GraphWalk D.rad.G.toGraph v u}, D.IsSpokeWalk W H (A.append T) + → v ∈ D.ins F \ F.U := by + intro v A hA + have hmem : u ∈ (walkDrawing D.rad.G (A.append T)).U ∩ D.ins F := by + refine ⟨(mem_walkDrawing_U _ _).mpr (.inl ?_), hu.1⟩ + exact (GraphWalk.mem_support_append A T).mpr (.inl A.end_mem_support) + rcases (theorem_13_3_proof hA.2 hFe).2 (fun hs ↦ hu.2 (hs hmem)) with h' | h' + · exact h' + · exact absurd h' hhF + exact hf.circuit_in_ins hC hFe (side hf.spoke₁) (side hf.spoke₂) hu.1 + have hmono : C.U ⊆ D.ins F → D.ins C ⊆ D.ins F := fun h' ↦ + hsl.monotone C F hC.circuit.2 hC.circuit.1 hlt hc.2 hc.1 hlt' h' + rcases hf.hub.hub_cond with ⟨hcard, hE, hne⟩ | ⟨hen, hHle, hne⟩ + · obtain ⟨z, hz⟩ := ncard_eq_one.mp hcard + have hhz : h = z := by + rw [hz] at hh + exact hh + subst hhz + have hUV : H.U = H.V := by + rw [H.U_eq, hE] + simp + have hnot : h ∉ D.ins F \ F.U := fun h' ↦ by + apply hne F hFe hFle + rw [hz] + exact singleton_subset_iff.mpr h' + have hxh : x = h := by + rw [hUV, hz] at hx + exact hx + subst hxh + have hi := interior_mono (hmono (hstep hnot)) ((D.ins_diff_iff hC.circuit hlt).mp hxi) + exact hnot ((D.ins_diff_iff hc hlt').mpr hi) + · have hHlt : H.E.ncard < 2 * D.rep := by omega + obtain ⟨ord₂, 𝒯₂, h𝒯₂, hcH, hlt₂, Δ₂, hins₂, hd₂⟩ := id hen + obtain ⟨hclH, hfrH, hUH⟩ := ins_facts_of_length hsl hcH.2 hcH.1 hHlt + have hne' : F ≠ H := by + rintro rfl + have hm := hsl.monotone F C hc.2 hc.1 hlt' hC.circuit.2 hC.circuit.1 hlt hHC + have hi := interior_mono hm ((D.ins_diff_iff hc hlt').mp hu) + exact (D.ins_diff_iff hC.circuit hlt).mpr hi |>.2 (C.V_subset_U ((hC.mem_V u).mpr (.inr + (.inl A₁.end_mem_support)))) + have hnotsub : ¬ H.U ⊆ D.ins F := hne F hFe hne' hFle + have hnot : h ∉ D.ins F \ F.U := by + intro h' + obtain rfl := D.eq_ins_of_isInsOf hins + obtain rfl := D.eq_ins_of_isInsOf hins₂ + rcases theorem_8_6_proof χ.isSurface D.P.fits.internally_three_connected D.tb D.isTangle h𝒯₂ + h𝒯' hins₂ hins hd₂ hd with h₁ | h₁ | h₁ + · exact hnotsub (hUH.trans h₁) + · have hi := interior_mono h₁ ((D.ins_diff_iff hc hlt').mp h') + exact (D.ins_diff_iff hcH hHlt).mpr hi |>.2 (H.V_subset_U hh) + · have : h ∈ D.ins H ∩ D.ins F := ⟨hUH (H.V_subset_U hh), h'.1⟩ + rw [h₁] at this + exact h'.2 this.2 + exact hnotsub (hHC.trans (hmono (hstep hnot))) + +/-- **The core of (13.4).** `u` is the only possible point of `U(H)` in `Δ`, and no spoke enters the +interior of `Δ`. -/ +theorem IsFan.main (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ C) + (hopt : D.IsOptimalWheelHub W H ρ) {Δ : Set Shat} (hΔ : IsClosedDisc Δ) (hΔW : Δ ⊆ W) + (hbd : discBd Δ = C.U) : + (∀ x ∈ Δ ∩ H.U, x = u) ∧ + ∀ (v h' : Shat) (K : GraphWalk D.rad.G.toGraph v h'), D.IsSpokeWalk W H K → Δ ∩ + (walkDrawing D.rad.G K).U ⊆ discBd Δ := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hle := (hf.card_lt hC).1 + have hlt := (hf.card_lt hC).2 + obtain rfl : Δ = D.ins C := hf.hub.eq_ins_of_disc hC.circuit (by omega) hΔ hΔW hbd + have hc := hC.circuit + obtain ⟨hcl, hfr, hU⟩ := ins_facts_of_length (D.isSlope (by omega)) hc.2 hc.1 hlt + have huC : u ∈ C.U := C.V_subset_U ((hC.mem_V u).mpr (.inr (.inl A₁.end_mem_support))) + have hfirstclaim : ∀ x ∈ D.ins C ∩ H.U, x = u := by + rintro x ⟨hxi, hx⟩ + by_contra hxu + have hHC := hf.hub_inside hC hx hxi hxu + have hxi' : x ∈ D.ins C \ C.U := ⟨hxi, fun hu ↦ hxu (hf.hub_meet hC hx hu).1⟩ + have huW : u ∈ W := hΔW (hU huC) + have hub := hf.hub.hub_at hf.u_mem_G T hf.spoke₁.2.h_mem hf.T_lt ⟨huW, hf.u_notMem_bd⟩ + (fun v hv ↦ hf.spoke_at hC hΔW hHC hv) (fun F h₁ h₂ ↦ hf.no_enclave hC hx hxi' hHC h₁ h₂) + have hρ : ρ ≤ ρ - T.length := by + rw [hopt.ρ_eq_radius, ← hopt.ρ_eq_radius] + have := Nat.sInf_le (s := {ρ : ℕ | ∃ H : Drawing Shat, D.IsWheelHubOfRadius W H ρ}) ⟨_, hub⟩ + rw [← wheelRadius, ← hopt.ρ_eq_radius] at this + exact this + have hT0 : T.length = 0 := by + have := hf.T_lt + omega + have hhu : u = h := GraphWalk.eq_of_length_eq_zero hT0 + rw [hT0, Nat.sub_zero] at hub + have hcard : H.V.ncard = 1 := by + rcases hopt.one_vertex_priority with h' | h' + · exact h' + · exact absurd ⟨_, hub, by rw [(point_drawing_facts D.rad.G hf.u_mem_G).1, + ncard_singleton]⟩ h' + rcases hf.hub.hub_cond with ⟨-, hE, -⟩ | ⟨⟨-, -, -, hcF, -⟩, -, -⟩ + · have hUV : H.U = H.V := by + rw [H.U_eq, hE] + simp + obtain ⟨z, hz⟩ := ncard_eq_one.mp hcard + have hh := hf.spoke₁.2.h_mem + rw [hUV, hz] at hx + rw [hz] at hh + have e₁ : x = z := hx + have e₂ : h = z := hh + exact hxu (e₁.trans (e₂.symm.trans hhu.symm)) + · exact IsCircuit.two_vertices D hcF hcard + have hd_eq : discBd (D.ins C) = C.U := hbd + -- The part `T` misses the strict inside. + have hTout : ∀ {p : Shat}, p ∈ (walkDrawing D.rad.G T.reverse).U → p ∈ D.ins C → p ∈ C.U := by + intro p hp hpi + have hTs : T.IsSimple := (GraphWalk.IsSimple.of_append hf.spoke₁.1).2 + have hhout : h ∉ D.ins C \ C.U := by + intro h₁ + have e := hfirstclaim h ⟨h₁.1, H.V_subset_U hf.spoke₁.2.h_mem⟩ + exact h₁.2 (e ▸ huC) + refine D.part_outside hc hlt T.reverse hTs.reverse hhout (fun y hy hyC ↦ ?_) hp hpi + have hy' : y ∈ T.support := by simpa [GraphWalk.support_reverse] using hy + rcases (hC.mem_V y).mp hyC with rfl | h₁ | h₂ + · exact absurd ((GraphWalk.mem_support_append A₁ T).mpr (.inr hy')) + (hf.r_notMem_spoke hf.spoke₁) + · exact GraphWalk.inter_of_simple hf.spoke₁.1 h₁ hy' + · exact GraphWalk.inter_of_simple hf.spoke₂.1 h₂ hy' + refine ⟨hfirstclaim, ?_⟩ + rintro v h' K hK p ⟨hpi, hpK⟩ + rw [hd_eq] + have hout : v ∉ D.ins C \ C.U := by + intro h₁ + have hi := interior_mono hΔW ((D.ins_diff_iff hc hlt).mp h₁) + have hvf : v ∈ frontier W := by + rw [IsClosedDisc.frontier_eq_discBd hT hf.hub.is_disc] + exact hK.2.v_mem.2 + exact hvf.2 hi + by_cases hm : ∃ x ∈ K.support, x ∈ C.V + · obtain ⟨a, haC, L, R, rfl, hfirst⟩ := GraphWalk.exists_first_mem K hm + obtain rfl := hf.spoke_end hC hK ((GraphWalk.mem_support_append L R).mpr + (.inl L.end_mem_support)) haC + obtain ⟨X, rfl, hXE, hXV⟩ := hf.spoke_tail hC hK haC + have hLs : L.IsSimple := (GraphWalk.IsSimple.of_append hK.1).1 + rcases (mem_walkDrawing_U _ _).mp hpK with hp | ⟨g, hg, hpg⟩ + · rcases (GraphWalk.mem_support_append L _).mp hp with h₁ | h₁ + · exact D.part_outside hc hlt L hLs hout hfirst ((mem_walkDrawing_U _ _).mpr (.inl h₁)) hpi + · rcases (GraphWalk.mem_support_append X T).mp h₁ with h₂ | h₂ + · exact C.V_subset_U (hXV p h₂) + · exact hTout ((mem_walkDrawing_U _ _).mpr (.inl (by simpa [GraphWalk.support_reverse] + using h₂))) hpi + · simp only [GraphWalk.edges_append, List.mem_append] at hg + rcases hg with h₁ | h₁ | h₁ + · exact D.part_outside hc hlt L hLs hout hfirst ((mem_walkDrawing_U _ _).mpr (.inr ⟨g, h₁, + hpg⟩)) hpi + · exact C.closure_subset_U (hXE g h₁) hpg + · exact hTout ((mem_walkDrawing_U _ _).mpr (.inr ⟨g, by simpa [GraphWalk.edges_reverse] using + h₁, hpg⟩)) hpi + · push Not at hm + exact D.part_outside hc hlt K hK.1 hout (fun y hy hyC ↦ absurd hyC (hm y hy)) hpK hpi + +/-- `U` of a joined walk. -/ +theorem U_append (G : Drawing Shat) {a b c : Shat} (A : GraphWalk G.toGraph a b) + (B : GraphWalk G.toGraph b c) : + (walkDrawing G (A.append B)).U = (walkDrawing G A).U ∪ (walkDrawing G B).U := by + ext x + simp only [mem_walkDrawing_U, mem_union, GraphWalk.mem_support_append, GraphWalk.edges_append, + List.mem_append] + constructor + · rintro ((h | h) | ⟨e, h | h, hx⟩) + · exact .inl (.inl h) + · exact .inr (.inl h) + · exact .inl (.inr ⟨e, h, hx⟩) + · exact .inr (.inr ⟨e, h, hx⟩) + · rintro ((h | ⟨e, h, hx⟩) | (h | ⟨e, h, hx⟩)) + · exact .inl (.inl h) + · exact .inr ⟨e, .inl h, hx⟩ + · exact .inl (.inr h) + · exact .inr ⟨e, .inr h, hx⟩ + +/-- The walks of the two parts of a simple walk meet only at the joint. -/ +theorem U_inter_of_simple (G : Drawing Shat) {a b c d : Shat} (A : GraphWalk G.toGraph a b) + (B : GraphWalk G.toGraph c d) + (hV : ∀ x ∈ A.support, x ∈ B.support → x = b) (hE : ∀ e ∈ A.edges, e ∉ B.edges) + (hb : b ∈ A.support) (hb' : b ∈ B.support) : + (walkDrawing G A).U ∩ (walkDrawing G B).U = {b} := by + have hdis : Disjoint (walkDrawing G A).E (walkDrawing G B).E := by + rw [walkDrawing_E, walkDrawing_E] + exact disjoint_left.mpr fun e h₁ h₂ ↦ hE e h₁ h₂ + rw [U_inter_of_disjoint (walkDrawing_isSubdrawing _ _) (walkDrawing_isSubdrawing _ _) hdis, + walkDrawing_V, walkDrawing_V] + ext x + constructor + · rintro ⟨h₁, h₂⟩ + exact hV x h₁ h₂ + · rintro rfl + exact ⟨hb, hb'⟩ + +omit [T2Space S] in +theorem IsFan.edges_disjoint_T (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) : ∀ e ∈ A₁.edges, e ∉ T.edges + := by + intro e h₁ h₂ + have := hf.spoke₁.1.edges_nodup + rw [GraphWalk.edges_append] at this + exact (List.nodup_append.mp this).2.2 e h₁ e h₂ rfl + +omit [T2Space S] in +theorem IsFan.edges_disjoint (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) : ∀ e ∈ A₁.edges, e ∉ A₂.edges + := by + intro e h₁ h₂ + obtain ⟨x, y, hxy, hx, hy, hcap⟩ := D.exists_ends_of_mem_edges A₁ h₁ + obtain ⟨hx', hy'⟩ := D.ends_mem_support A₂ h₂ hcap + exact hxy ((hf.meet x hx hx').trans (hf.meet y hy hy').symm) + +omit [T2Space S] in +/-- `U` of the circuit of a fan, as in the statement of (13.4). -/ +theorem IsFan.U_eq (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ C) : + C.U = (walkDrawing D.rad.G A₁).U ∪ (walkDrawing D.rad.G A₂).U ∪ closure f₁ ∪ closure f₂ := by + ext x + rw [C.U_eq] + simp only [mem_union, mem_iUnion, mem_walkDrawing_U, hC.mem_V, hC.mem_E, exists_prop] + have hr : x = r → x ∈ closure f₁ := by + rintro rfl + have : x ∈ closure f₁ ∩ D.rad.G.V := by + rw [hf.link₁.2.2.2] + exact .inl rfl + exact this.1 + constructor + · rintro ((h | h | h) | ⟨e, (rfl | rfl | h | h), hx⟩) + · exact .inl (.inr (hr h)) + · exact .inl (.inl (.inl (.inl h))) + · exact .inl (.inl (.inr (.inl h))) + · exact .inl (.inr hx) + · exact .inr hx + · exact .inl (.inl (.inl (.inr ⟨e, h, hx⟩))) + · exact .inl (.inl (.inr (.inr ⟨e, h, hx⟩))) + · rintro ((((h | ⟨e, h, hx⟩) | (h | ⟨e, h, hx⟩)) | h) | h) + · exact .inl (.inr (.inl h)) + · exact .inr ⟨e, .inr (.inr (.inl h)), hx⟩ + · exact .inl (.inr (.inr h)) + · exact .inr ⟨e, .inr (.inr (.inr h)), hx⟩ + · exact .inr ⟨_, .inl rfl, h⟩ + · exact .inr ⟨_, .inr (.inl rfl), h⟩ + +omit [T2Space S] in +/-- The set in the statement of (13.4) is `U` of the circuit of the fan. -/ +theorem IsFan.formula_eq (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ C) + : + ((walkDrawing D.rad.G (A₁.append T)).U ∪ (walkDrawing D.rad.G (A₂.append T)).U) \ + ((walkDrawing D.rad.G (A₁.append T)).U ∩ (walkDrawing D.rad.G (A₂.append T)).U) ∪ {u} ∪ + closure f₁ ∪ closure f₂ = C.U := by + have hu₁ : u ∈ A₁.support := A₁.end_mem_support + have hu₂ : u ∈ A₂.support := A₂.end_mem_support + have hT : u ∈ T.support := T.start_mem_support + have i₁ := U_inter_of_simple D.rad.G A₁ T (fun x h₁ h₂ ↦ GraphWalk.inter_of_simple hf.spoke₁.1 h₁ + h₂) hf.edges_disjoint_T hu₁ hT + have i₂ := U_inter_of_simple D.rad.G A₂ T (fun x h₁ h₂ ↦ GraphWalk.inter_of_simple hf.spoke₂.1 h₁ + h₂) hf.swap.edges_disjoint_T hu₂ hT + have i₃ := U_inter_of_simple D.rad.G A₁ A₂ hf.meet hf.edges_disjoint hu₁ hu₂ + rw [hf.U_eq hC, U_append, U_append] + set a := (walkDrawing D.rad.G A₁).U + set b := (walkDrawing D.rad.G A₂).U + set t := (walkDrawing D.rad.G T).U + have hua : u ∈ a := (mem_walkDrawing_U _ _).mpr (.inl hu₁) + congr 2 + ext x + have e₁ : x ∈ a → x ∈ t → x = u := fun h₁ h₂ ↦ by + have : x ∈ a ∩ t := ⟨h₁, h₂⟩ + rwa [i₁] at this + have e₂ : x ∈ b → x ∈ t → x = u := fun h₁ h₂ ↦ by + have : x ∈ b ∩ t := ⟨h₁, h₂⟩ + rwa [i₂] at this + have e₃ : x ∈ a → x ∈ b → x = u := fun h₁ h₂ ↦ by + have : x ∈ a ∩ b := ⟨h₁, h₂⟩ + rwa [i₃] at this + simp only [mem_union, mem_sdiff, mem_inter_iff, mem_singleton_iff] + by_cases hxu : x = u + · subst hxu + exact ⟨fun _ ↦ .inl hua, fun _ ↦ .inr rfl⟩ + · constructor + · rintro (⟨(h₁ | h₁) | (h₁ | h₁), h₂⟩ | h₁) + · exact .inl h₁ + · exact absurd ⟨.inr h₁, .inr h₁⟩ h₂ + · exact .inr h₁ + · exact absurd ⟨.inr h₁, .inr h₁⟩ h₂ + · exact absurd h₁ hxu + · rintro (h₁ | h₁) + · refine .inl ⟨.inl (.inl h₁), ?_⟩ + rintro ⟨-, h₂ | h₂⟩ + · exact hxu (e₃ h₁ h₂) + · exact hxu (e₁ h₁ h₂) + · refine .inl ⟨.inr (.inl h₁), ?_⟩ + rintro ⟨h₂ | h₂, -⟩ + · exact hxu (e₃ h₂ h₁) + · exact hxu (e₂ h₁ h₂) + +/-- **Graph Minors XIX, (13.4)** (page 367), for an optimal hub `H`: "**13.4.** *Let +$r^* \in R^* \cap bd(W)$ with neighbours $v_1, v_2$ in $\Gamma^* \cap bd(W)$. Let $S_{v_1}$ meet +$S_{v_2}$, and let $S_{v_1} \cap S_{v_2}$ have ends $u, h$ where $h \in V(H)$. Let +$\Delta \subseteq W$ be the disc bounded by* +$$(U(S_{v_1} \cup S_{v_2}) \setminus U(S_{v_1} \cap S_{v_2})) \cup \{u\} \cup \bar{f}_1 \cup +\bar{f}_2,$$ +*where $f_i$ is the edge of $\Gamma^* \cap bd(W)$ with ends $r^*, v_i$ ($i = 1, 2$). Then +$\Delta \cap U(H) = \emptyset$ unless $u = h$, in which case $\Delta \cap U(H) = \{h\}$; and +$\Delta \cap U(S_v) \subseteq bd(\Delta)$ for every $v \in V(\Gamma) \cap bd(W)$.*" The hypotheses +on `W` are those of (13.1). -/ +theorem theorem_13_4_proof (hopt : D.IsOptimalWheelHub W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) (hr : r ∈ D.rad.Rstar ∩ discBd W) + (hne : v₁ ≠ v₂) + (hf₁ : f₁ ∈ D.rad.G.E) (hf₁' : tilde f₁ = {r, v₁}) (hf₂ : f₂ ∈ D.rad.G.E) (hf₂' : tilde f₂ + = {r, v₂}) {h₁ h₂ : Shat} + {S₁ S₂ Q : Drawing Shat} (hS₁ : D.IsSpoke W H v₁ h₁ S₁) (hS₂ : D.IsSpoke W H v₂ h₂ S₂) + (hQ : Drawing.IsPathOf Q D.rad.G u h₁) + (hQV : Q.V = S₁.V ∩ S₂.V) (hQE : Q.E = S₁.E ∩ S₂.E) (hm : (S₁.V ∩ S₂.V).Nonempty) {Δ : Set + Shat} (hΔ : IsClosedDisc Δ) (hΔW : Δ ⊆ W) + (hbd : discBd Δ = (S₁.U ∪ S₂.U) \ (S₁.U ∩ S₂.U) ∪ {u} ∪ closure f₁ ∪ closure f₂) : + (u ≠ h₁ → Δ ∩ H.U = ∅) ∧ (u = h₁ → Δ ∩ H.U = {h₁}) ∧ + ∀ (v h : Shat) (P : Drawing Shat), D.IsSpoke W H v h P → Δ ∩ P.U ⊆ discBd Δ := by + classical + have : ConnectedSpace Shat := cap.connected + obtain rfl := (theorem_13_2_proof hS₁ hS₂ hm).1 + obtain ⟨K₁, h1, rfl⟩ := hS₁.exists_walk + obtain ⟨K₂, h2, rfl⟩ := hS₂.exists_walk + obtain ⟨x, hx₁, hx₂⟩ := hm + rw [walkDrawing_V] at hx₁ hx₂ hQV + rw [walkDrawing_E, walkDrawing_E] at hQE + rw [walkDrawing_V] at hQV + obtain ⟨u', A₁, A₂, T, rfl, rfl, -, hmeet⟩ := h1.merge h2 hx₁ hx₂ + have hfan : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T := by + refine ⟨hopt.toIsWheelHubOfRadius, hbdS, hin, hr.1, hr.2, hne, ?_, ?_, h1, h2, + fun y h₁ h₂ ↦ hmeet y h₁ ?_⟩ + · exact ⟨hf₁, hr.1.1, h1.2.is_path.1.1 (by rw [walkDrawing_V]; exact + (A₁.append T).start_mem_support), + by rw [closure_inter_V_eq_tilde hf₁, hf₁']⟩ + · exact ⟨hf₂, hr.1.1, h2.2.is_path.1.1 (by rw [walkDrawing_V]; exact + (A₂.append T).start_mem_support), + by rw [closure_inter_V_eq_tilde hf₂, hf₂']⟩ + · exact (GraphWalk.mem_support_append A₂ T).mpr (.inl h₂) + -- `Q` and `T` have the same edges and the same last vertex, hence the same first vertex. + have huu : u = u' := by + obtain ⟨Qw, hQs, -, hQe⟩ := Drawing.IsPathOf.exists_simple_walk hQ + have hT : T.IsSimple := (GraphWalk.IsSimple.of_append h1.1).2 + have hedges : ∀ e, e ∈ Qw.reverse.edges ↔ e ∈ T.reverse.edges := by + intro e + simp only [GraphWalk.edges_reverse, List.mem_reverse] + rw [← hQe e, hQE] + constructor + · rintro ⟨h₁, h₂⟩ + have h₁' : e ∈ (A₁.append T).edges := h₁ + have h₂' : e ∈ (A₂.append T).edges := h₂ + rw [GraphWalk.edges_append, List.mem_append] at h₁' h₂' + rcases h₁' with h₃ | h₃ + · rcases h₂' with h₄ | h₄ + · exact absurd h₄ (hfan.edges_disjoint e h₃) + · exact absurd h₄ (hfan.edges_disjoint_T e h₃) + · exact h₃ + · intro h' + constructor + · change e ∈ (A₁.append T).edges + rw [GraphWalk.edges_append, List.mem_append] + exact .inr h' + · change e ∈ (A₂.append T).edges + rw [GraphWalk.edges_append, List.mem_append] + exact .inr h' + exact (simple_walks_eq Qw.reverse T.reverse hQs.reverse hT.reverse hedges).1 + subst huu + obtain ⟨C, hC⟩ := hfan.exists_circuit + have hbd' : discBd Δ = C.U := by rw [hbd, hfan.formula_eq hC] + obtain ⟨hfirst, hsecond⟩ := hfan.main hC hopt hΔ hΔW hbd' + have huΔ : u ∈ Δ := by + apply Surface.discBd_subset Δ + rw [hbd'] + exact C.V_subset_U ((hC.mem_V u).mpr (.inr (.inl A₁.end_mem_support))) + refine ⟨fun hne' ↦ ?_, fun heq ↦ ?_, fun v h P hP ↦ ?_⟩ + · refine eq_empty_of_forall_notMem fun y hy ↦ ?_ + have hyu := hfirst y hy + subst hyu + apply hne' + have hy₂ : y ∈ C.U := by + rw [C.U_eq] + exact .inl ((hC.mem_V y).mpr (.inr (.inl A₁.end_mem_support))) + exact (hfan.hub_meet hC hy.2 hy₂).2 + · subst heq + refine Subset.antisymm (fun y hy ↦ hfirst y hy) ?_ + rw [singleton_subset_iff] + exact ⟨huΔ, H.V_subset_U h1.2.h_mem⟩ + · obtain ⟨K, hK, rfl⟩ := hP.exists_walk + exact hsecond v h K hK + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13g.lean b/LeanPool/GraphMinor/GM19/Section13g.lean new file mode 100644 index 0000000000..19641ff6b2 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13g.lean @@ -0,0 +1,581 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13f + +/-! +# Graph Minors XIX, Section 13: (13.5) + +`D_v` is short. If the two spokes meet then `D_v` is the circuit of their fan. If they do not, then +the paper's proof applies (8.5) to the +theta formed by the two paths of `H` and the outer path through the spokes. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- A simple walk from `a` to `b` with its edges among those of another one is that one. -/ +theorem simple_walk_unique {α' β : Type*} {G : Graph α' β} {a b : α'} (A B : GraphWalk G a b) + (hA : A.IsSimple) (hB : B.IsSimple) + (hsub : ∀ e ∈ B.edges, e ∈ A.edges) : A = B := by + induction A with + | nil h => + cases B with + | nil _ => rfl + | @cons _ x _ e hl r => + have := hsub e (by simp) + simp at this + | @cons a x b e hl r ih => + have hsA : (GraphWalk.cons hl r).support.Nodup := hA + simp only [GraphWalk.support_cons, List.nodup_cons] at hsA + cases B with + | nil _ => exact absurd r.end_mem_support hsA.1 + | @cons _ x' _ e' hl' r' => + have hsB : (GraphWalk.cons hl' r').support.Nodup := hB + simp only [GraphWalk.support_cons, List.nodup_cons] at hsB + have hee : e' = e := by + have := hsub e' (by simp) + rcases List.mem_cons.mp (by simpa using this) with h | h + · exact h + · exact absurd (r.left_mem_support_of_mem_edges h hl') hsA.1 + subst hee + obtain rfl := hl.right_unique hl' + have hsub' : ∀ f ∈ r'.edges, f ∈ r.edges := by + intro f hf + have h₁ := hsub f (by simp [hf]) + rcases List.mem_cons.mp (by simpa using h₁) with h | h + · subst h + exact absurd (r'.left_mem_support_of_mem_edges hf hl) hsB.1 + · exact h + rw [ih r' hsA.2 hsB.2 hsub'] + +/-- The last edge of a walk with an edge. -/ +theorem GraphWalk.exists_last_edge {α' β : Type*} {G : Graph α' β} {a b : α'} (A : GraphWalk G a b) + (h : 1 ≤ A.length) : + ∃ (g : β) (c : α'), g ∈ A.edges ∧ G.IsLink g b c := by + induction A with + | nil _ => simp [GraphWalk.length] at h + | @cons a x b e hl r ih => + by_cases hr : 1 ≤ r.length + · obtain ⟨g, c, h₁, h₂⟩ := ih hr + exact ⟨g, c, by simp [h₁], h₂⟩ + · have h₀ : x = b := GraphWalk.eq_of_length_eq_zero (show r.length = 0 by omega) + subst h₀ + exact ⟨e, a, by simp, hl.symm⟩ + +/-- A path of a circuit between `a` and `b` is one of the two paths of the circuit between them. -/ +theorem path_of_circuit {T : Type} [TopologicalSpace T] [T2Space T] {C F₁ F₂ P : Drawing T} {a b : + T} (hab : a ≠ b) + (hF₁ : F₁.IsPathBetween a b) (hF₂ : F₂.IsPathBetween a b) (hs₁ : F₁.IsSubdrawing C) + (hs₂ : F₂.IsSubdrawing C) + (hV : F₁.V ∩ F₂.V = {a, b}) (hE : Disjoint F₁.E F₂.E) (hU : C.U = F₁.U ∪ F₂.U) + (hP : Drawing.IsPathOf P C a b) : + P = F₁ ∨ P = F₂ := by + classical + have hline := isLine_of_isPathBetween hP.2 hab + have hcon : IsPreconnected (P.U \ {a, b}) := hline.isPreconnected_diff + have hinter : F₁.U ∩ F₂.U = {a, b} := by + rw [U_inter_of_disjoint hs₁ hs₂ hE, hV] + obtain ⟨Kp, hKp, hVp, hEp⟩ := Drawing.IsPathOf.exists_simple_walk hP + -- If the edges of `P` lie in `Fᵢ` then `P = Fᵢ`. + have key : ∀ {X : Drawing T}, X.IsPathBetween a b → X.IsSubdrawing C → (∀ e ∈ P.E, e ∈ X.E) → P + = X := by + intro X hX hXs hsub + obtain ⟨Kx, hKx, hVx, hEx⟩ := Drawing.IsPathOf.exists_simple_walk + (show Drawing.IsPathOf X C a b from ⟨hXs, hX⟩) + obtain rfl := simple_walk_unique Kx Kp hKx hKp fun e he ↦ (hEx e).mp (hsub e ((hEp e).mpr he)) + refine Drawing.ext_of_V_E ?_ ?_ + · ext x + rw [hVp, hVx] + · ext e + rw [hEp, hEx] + have haC : a ∈ C.V := Kp.mem_vertexSet_of_mem_support Kp.start_mem_support + have hbC : b ∈ C.V := Kp.mem_vertexSet_of_mem_support Kp.end_mem_support + -- If `P` off its ends lies in `U(Fᵢ)` then its edges are edges of `Fᵢ`. + have hedges : ∀ {X : Drawing T}, X.IsSubdrawing C → (P.U \ {a, b} ⊆ X.U) → ∀ e ∈ P.E, e ∈ X.E + := by + intro X hXs hsub e he + have heC := hP.1.2 he + obtain ⟨z, hz⟩ := heC.2.2.1.nonempty + have hzV : z ∉ C.V := (heC.2.1 hz).2 + have hzX : z ∈ P.U \ {a, b} := by + refine ⟨P.closure_subset_U he (subset_closure hz), ?_⟩ + rintro (rfl | rfl) + · exact hzV haC + · exact hzV hbC + obtain ⟨e', he', hze'⟩ := X.exists_edge_of_mem (hsub hzX) fun h' ↦ hzV (hXs.1 h') + obtain rfl := C.edge_eq_of_mem heC (hXs.2 he') hz hze' + exact he' + have hcov : P.U \ {a, b} ⊆ F₁.U ∪ F₂.U := by + rw [← hU] + exact fun x hx ↦ hP.1.U_subset hx.1 + by_cases h₁ : ((P.U \ {a, b}) ∩ F₁.U).Nonempty + · by_cases h₂ : ((P.U \ {a, b}) ∩ F₂.U).Nonempty + · exfalso + obtain ⟨x, hx, hxi⟩ := isPreconnected_closed_iff.mp hcon _ _ F₁.isClosed_U F₂.isClosed_U hcov + h₁ h₂ + rw [hinter] at hxi + exact hx.2 hxi + · refine .inl (key hF₁ hs₁ (hedges hs₁ fun x hx ↦ ?_)) + rcases hcov hx with h' | h' + · exact h' + · exact absurd ⟨x, hx, h'⟩ h₂ + · refine .inr (key hF₂ hs₂ (hedges hs₂ fun x hx ↦ ?_)) + rcases hcov hx with h' | h' + · exact absurd ⟨x, hx, h'⟩ h₁ + · exact h' + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r v₁ v₂ u h : Shat} {f₁ + f₂ : Set Shat} + {A₁ : GraphWalk D.rad.G.toGraph v₁ u} {A₂ : GraphWalk D.rad.G.toGraph v₂ u} {T : GraphWalk + D.rad.G.toGraph u h} {C : Drawing Shat} + +omit [T2Space S] in +/-- A vertex of `bd(W)` is not strictly inside a disc in `W`. -/ +theorem IsWheelHubOfRadius.bd_not_strict (hW : D.IsWheelHubOfRadius W H ρ) {F : Drawing Shat} + (hF : F.IsCircuitOf D.rad.G) + (hlt : F.E.ncard < 2 * D.rep) (hsub : D.ins F ⊆ W) {v : Shat} (hv : v ∈ discBd W) : v ∉ D.ins F + \ F.U := by + have hT := cap.isClosedSurface + intro h₁ + have hi := interior_mono hsub ((D.ins_diff_iff hF hlt).mp h₁) + have hvf : v ∈ frontier W := by + rw [IsClosedDisc.frontier_eq_discBd hT hW.is_disc] + exact hv + exact hvf.2 hi + +omit [T2Space S] in +/-- The closure in the definition of `Δ_v`, when the spokes meet, is `U` of the circuit of the fan. +-/ +theorem IsFan.closure_formula (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hC : D.IsFanCircuit r f₁ f₂ A₁ + A₂ C) : + closure (((walkDrawing D.rad.G (A₁.append T)).U ∪ (walkDrawing D.rad.G (A₂.append T)).U) \ + ((walkDrawing D.rad.G (A₁.append T)).U ∩ (walkDrawing D.rad.G (A₂.append T)).U) ∪ f₁ ∪ f₂) + = C.U := by + set X := ((walkDrawing D.rad.G (A₁.append T)).U ∪ (walkDrawing D.rad.G (A₂.append T)).U) \ + ((walkDrawing D.rad.G (A₁.append T)).U ∩ (walkDrawing D.rad.G (A₂.append T)).U) with hX + have hform := hf.formula_eq hC + have hsub₁ : X ⊆ C.U := fun x hx ↦ by + rw [← hform] + exact .inl (.inl (.inl hx)) + apply Subset.antisymm + · refine closure_minimal (union_subset (union_subset hsub₁ ?_) ?_) C.isClosed_U + · rw [← hform] + exact fun x hx ↦ .inl (.inr (subset_closure hx)) + · rw [← hform] + exact fun x hx ↦ .inr (subset_closure hx) + · rw [← hform] + refine union_subset (union_subset (union_subset ?_ ?_) ?_) ?_ + · exact subset_closure.trans' (subset_union_left.trans subset_union_left) |>.trans subset_rfl + · rw [singleton_subset_iff] + obtain ⟨g, c, hg, hl⟩ := GraphWalk.exists_last_edge A₁ hf.A_pos + have hgE : g ∈ D.rad.G.E := TieBreaker.mem_edges_E A₁ hg + have hu₁ : u ∈ A₁.support := A₁.end_mem_support + have hu₂ : u ∈ A₂.support := A₂.end_mem_support + have hT : u ∈ T.support := T.start_mem_support + have i₁ := U_inter_of_simple D.rad.G A₁ T (fun x h₁ h₂ ↦ GraphWalk.inter_of_simple + hf.spoke₁.1 h₁ h₂) hf.edges_disjoint_T hu₁ hT + have i₃ := U_inter_of_simple D.rad.G A₁ A₂ hf.meet hf.edges_disjoint hu₁ hu₂ + have hgX : g ⊆ X := by + intro p hp + have hpA : p ∈ (walkDrawing D.rad.G A₁).U := (mem_walkDrawing_U _ _).mpr + (.inr ⟨g, hg, subset_closure hp⟩) + have hpV : p ≠ u := fun h' ↦ (hgE.2.1 hp).2 (h' ▸ hf.u_mem_G) + refine ⟨.inl ?_, ?_⟩ + · rw [U_append] + exact .inl hpA + · rintro ⟨-, h₂⟩ + rw [U_append] at h₂ + rcases h₂ with h₂ | h₂ + · have : p ∈ (walkDrawing D.rad.G A₁).U ∩ (walkDrawing D.rad.G A₂).U := ⟨hpA, h₂⟩ + rw [i₃] at this + exact hpV this + · have : p ∈ (walkDrawing D.rad.G A₁).U ∩ (walkDrawing D.rad.G T).U := ⟨hpA, h₂⟩ + rw [i₁] at this + exact hpV this + have huc : u ∈ closure g ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact .inl rfl + exact closure_mono (hgX.trans (subset_union_left.trans subset_union_left)) huc.1 + · exact closure_mono (subset_union_right.trans subset_union_left) + · exact closure_mono subset_union_right + +/-- `r*` is on no spoke, by (13.1). -/ +theorem IsWheelHubOfRadius.r_notMem_spoke (hW : D.IsWheelHubOfRadius W H ρ) + (hbdS : discBd W ⊆ cap.emb '' (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) (hr : r ∈ D.rad.Rstar ∩ discBd W) {v h' + : Shat} + {K : GraphWalk D.rad.G.toGraph v h'} (hK : D.IsSpokeWalk W H K) : r ∉ K.support := by + intro hrK + obtain ⟨L, R, rfl⟩ := K.exists_append_of_mem hrK + obtain ⟨P, hP, hle⟩ := exists_path_of_walk R + have h₂ := (hW.spoke_length hK).1 + rw [GraphWalk.length_append] at h₂ + have hpos : 1 ≤ L.length := by + cases L with + | nil _ => exact absurd hK.2.v_mem.1 hr.1.2 + | @cons _ c _ e hl q => + rw [GraphWalk.length_cons] + omega + exact theorem_13_1_proof hW hbdS hin hr.1 hr.2 ⟨P, h', hK.2.h_mem, hP, by omega⟩ + +omit [T2Space S] in +/-- A disc in `W` is determined by its boundary. -/ +theorem IsWheelHubOfRadius.disc_eq (hW : D.IsWheelHubOfRadius W H ρ) {Δ₁ Δ₂ : Set Shat} + (h₁ : IsClosedDisc Δ₁) (h₂ : IsClosedDisc Δ₂) + (hs₁ : Δ₁ ⊆ W) (hs₂ : Δ₂ ⊆ W) (hb : discBd Δ₁ = discBd Δ₂) : Δ₁ = Δ₂ := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + by_contra hne + have hcov := cover_of_discBd_eq hT h₁ h₂ hb hne + obtain ⟨p, hp⟩ := hW.isConnected_compl.nonempty + have : p ∈ Δ₁ ∪ Δ₂ := by + rw [hcov] + exact mem_univ p + rcases this with h' | h' + · exact hp (hs₁ h') + · exact hp (hs₂ h') + +private theorem outer_path_point_set + {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + {D : TangleDatum cap χ} + {r v₁ v₂ h₁ h₂ : Shat} {f₁ f₂ : Set Shat} + {K₁ : GraphWalk D.rad.G.toGraph v₁ h₁} {K₂ : GraphWalk D.rad.G.toGraph v₂ h₂} + (hl₁ : D.rad.G.toGraph.IsLink f₁ v₁ r) (O : Drawing Shat) + (hOV : ∀ x, x ∈ O.V ↔ x ∈ K₁.support ∨ x = v₁ ∨ x = r ∨ x ∈ K₂.support) + (hOE : ∀ e, e ∈ O.E ↔ e ∈ K₁.edges ∨ e = f₁ ∨ e = f₂ ∨ e ∈ K₂.edges) : + O.U = (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ∪ closure f₁ ∪ closure f₂ := by + have hv₁f : v₁ ∈ closure f₁ := by + have : v₁ ∈ closure f₁ ∩ D.rad.G.V := by + rw [hl₁.2.2.2] + exact .inl rfl + exact this.1 + have hrf : r ∈ closure f₁ := by + have : r ∈ closure f₁ ∩ D.rad.G.V := by + rw [hl₁.2.2.2] + exact .inr rfl + exact this.1 + ext x + rw [O.U_eq] + simp only [mem_union, mem_iUnion, mem_walkDrawing_U, hOV, hOE, exists_prop] + constructor + · rintro ((h' | rfl | rfl | h') | ⟨e, (h' | rfl | rfl | h'), hx⟩) + · exact .inl (.inl (.inl (.inl h'))) + · exact .inl (.inr hv₁f) + · exact .inl (.inr hrf) + · exact .inl (.inl (.inr (.inl h'))) + · exact .inl (.inl (.inl (.inr ⟨e, h', hx⟩))) + · exact .inl (.inr hx) + · exact .inr hx + · exact .inl (.inl (.inr (.inr ⟨e, h', hx⟩))) + · rintro ((((h' | ⟨e, h', hx⟩) | (h' | ⟨e, h', hx⟩)) | h') | h') + · exact .inl (.inl h') + · exact .inr ⟨e, .inl h', hx⟩ + · exact .inl (.inr (.inr (.inr h'))) + · exact .inr ⟨e, .inr (.inr (.inr h')), hx⟩ + · exact .inr ⟨_, .inr (.inl rfl), h'⟩ + · exact .inr ⟨_, .inr (.inr (.inl rfl)), h'⟩ + +private theorem outer_path_inter_hub_inside + {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + {D : TangleDatum cap χ} + {W : Set Shat} {H : Drawing Shat} {r v₁ v₂ h₁ h₂ : Shat} + {K₁ : GraphWalk D.rad.G.toGraph v₁ h₁} {K₂ : GraphWalk D.rad.G.toGraph v₂ h₂} + (h1 : D.IsSpokeWalk W H K₁) (h2 : D.IsSpokeWalk W H K₂) + (hHW : H.U ⊆ W \ discBd W) (hrH : r ∉ H.V) + (hcH : H.IsCircuitOf D.rad.G) (hlt : H.E.ncard < 2 * D.rep) (hUi : H.U ⊆ D.ins H) + (R : GraphWalk D.rad.G.toGraph v₁ h₂) (hRs : R.IsSimple) + (hsupR : ∀ x, x ∈ R.support ↔ x = v₁ ∨ x = r ∨ x ∈ K₂.support) + (O : Drawing Shat) (hO : O = walkDrawing D.rad.G (K₁.reverse.append R)) + (hOp : O.IsPathOf D.rad.G h₁ h₂) + (hOV : ∀ x, x ∈ O.V ↔ x ∈ K₁.support ∨ x = v₁ ∨ x = r ∨ x ∈ K₂.support) + (hm₁ : O.V ∩ H.V ⊆ {h₁, h₂}) (hm₂ : Disjoint O.E H.E) + (hout : ∀ {v : Shat}, v ∈ discBd W → v ∉ D.ins H \ H.U) : + O.U ∩ D.ins H = {h₁, h₂} := by + apply Subset.antisymm + · rintro p ⟨hpO, hpi⟩ + have hpH : p ∈ H.U := by + rw [hO, U_append] at hpO + rcases hpO with h' | h' + · have h'' : p ∈ (walkDrawing D.rad.G K₁).U := by + simpa [mem_walkDrawing_U, GraphWalk.support_reverse, GraphWalk.edges_reverse] using h' + exact D.part_outside hcH hlt K₁ h1.1 (hout h1.2.v_mem.2) (fun y hy hyH ↦ h1.support_hub hy + hyH) h'' hpi + · refine D.part_outside hcH hlt R hRs (hout h1.2.v_mem.2) (fun y hy hyH ↦ ?_) h' hpi + rcases (hsupR y).mp hy with rfl | rfl | h₃ + · exact absurd h1.2.v_mem.2 (hHW (H.V_subset_U hyH)).2 + · exact absurd hyH hrH + · exact h2.support_hub h₃ hyH + have hin' : p ∈ O.U ∩ H.U := ⟨hpO, hpH⟩ + rw [U_inter_of_disjoint hOp.1 hcH.1 hm₂] at hin' + exact hm₁ hin' + · rintro p (rfl | rfl) + · exact ⟨O.V_subset_U ((hOV _).mpr (.inl K₁.end_mem_support)), hUi (H.V_subset_U h1.2.h_mem)⟩ + · exact ⟨O.V_subset_U ((hOV _).mpr (.inr (.inr (.inr K₂.end_mem_support)))), hUi + (H.V_subset_U h2.2.h_mem)⟩ + +/-- (13.5) when the two spokes do not meet. -/ +theorem sector_of_disjoint (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) (hr : r ∈ D.rad.Rstar ∩ discBd W) {h₁ h₂ + : Shat} + {K₁ : GraphWalk D.rad.G.toGraph v₁ h₁} {K₂ : GraphWalk D.rad.G.toGraph v₂ h₂} + (h1 : D.IsSpokeWalk W H K₁) (h2 : D.IsSpokeWalk W H K₂) + (hl₁ : D.rad.G.toGraph.IsLink f₁ v₁ r) (hl₂ : D.rad.G.toGraph.IsLink f₂ r v₂) + (hdis : ∀ x ∈ K₁.support, x ∉ K₂.support) {P : Drawing Shat} (hP : Drawing.IsPathOf P H h₁ h₂) + {Δv : Set Shat} {Dv : Drawing Shat} + (hΔ : IsClosedDisc Δv) (hΔW : Δv ⊆ W) (hDv : Dv.IsCircuitOf D.rad.G) (hDU : Dv.U = discBd Δv) + (hbd : discBd Δv = (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ∪ P.U ∪ closure f₁ ∪ + closure f₂) + (hnot : ¬ D.ins H ⊆ Δv) : Dv.E.ncard ≤ 4 * ρ + 4 := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hHW := hW.H_in_int + have hrep := hW.rep_ge + have hr₁ := hW.r_notMem_spoke hbdS hin hr h1 + have hr₂ := hW.r_notMem_spoke hbdS hin hr h2 + have hrH : r ∉ H.V := fun h' ↦ (hHW (H.V_subset_U h')).2 hr.2 + have hend₁ : h₁ ∈ K₁.support := K₁.end_mem_support + have hend₂ : h₂ ∈ K₂.support := K₂.end_mem_support + have hne12 : h₁ ≠ h₂ := fun h' ↦ hdis h₁ hend₁ (h' ▸ hend₂) + -- `H` is a circuit, since it has two vertices. + have hen : IsEnclave D.tb D.ord D.𝒯 H ∧ H.E.ncard ≤ 4 * ρ + 4 := by + rcases hW.hub_cond with ⟨hc, -, -⟩ | ⟨h₃, h₄, -⟩ + · exfalso + obtain ⟨z, hz⟩ := ncard_eq_one.mp hc + have e₁ := h1.2.h_mem + have e₂ := h2.2.h_mem + rw [hz] at e₁ e₂ + exact hne12 (e₁.trans e₂.symm) + · exact ⟨h₃, h₄⟩ + obtain ⟨hFe, hHle⟩ := hen + obtain ⟨ord', 𝒯', h𝒯', hcH, hlt₀, Δ₀, hins, hd⟩ := id hFe + obtain rfl : Δ₀ = D.ins H := D.eq_ins_of_isInsOf hins + have hlt : H.E.ncard < 2 * D.rep := by omega + have hsl := D.isSlope (by omega) + have hUi := (ins_facts_of_length hsl hcH.2 hcH.1 hlt).2.2 + have hinsW : D.ins H ⊆ W := hW.ins_sub H hcH hHle (hHW.trans sdiff_subset) + -- The outer path. + set R := GraphWalk.cons hl₁ (GraphWalk.cons hl₂ K₂) with hR + have hRs : R.IsSimple := by + have h₃ : (GraphWalk.cons hl₂ K₂).IsSimple := List.nodup_cons.mpr ⟨hr₂, h2.1⟩ + refine List.nodup_cons.mpr ⟨?_, h₃⟩ + rintro (_ | ⟨_, h'⟩) + · exact hr.1.2 h1.2.v_mem.1 + · exact hdis _ K₁.start_mem_support h' + have hsupR : ∀ x, x ∈ R.support ↔ x = v₁ ∨ x = r ∨ x ∈ K₂.support := fun x ↦ by simp [hR] + have hedgR : ∀ e, e ∈ R.edges ↔ e = f₁ ∨ e = f₂ ∨ e ∈ K₂.edges := fun e ↦ by simp [hR] + have hWkS : (K₁.reverse.append R).IsSimple := by + refine isSimple_append' h1.1.reverse hRs fun y h₃ h₄ ↦ ?_ + have h₃' : y ∈ K₁.support := by simpa [GraphWalk.support_reverse] using h₃ + rcases (hsupR y).mp h₄ with h₅ | rfl | h₅ + · exact h₅ + · exact absurd h₃' hr₁ + · exact absurd h₅ (hdis y h₃') + set O := walkDrawing D.rad.G (K₁.reverse.append R) with hO + have hOp : Drawing.IsPathOf O D.rad.G h₁ h₂ := ⟨walkDrawing_isSubdrawing _ _, + walkDrawing_isPathBetween _ hWkS⟩ + have hOV : ∀ x, x ∈ O.V ↔ x ∈ K₁.support ∨ x = v₁ ∨ x = r ∨ x ∈ K₂.support := by + intro x + rw [hO, walkDrawing_V] + change x ∈ (K₁.reverse.append R).support ↔ _ + rw [GraphWalk.mem_support_append, hsupR] + simp [GraphWalk.support_reverse] + have hOE : ∀ e, e ∈ O.E ↔ e ∈ K₁.edges ∨ e = f₁ ∨ e = f₂ ∨ e ∈ K₂.edges := by + intro e + rw [hO, walkDrawing_E] + change e ∈ (K₁.reverse.append R).edges ↔ _ + rw [GraphWalk.edges_append, List.mem_append, hedgR] + simp [GraphWalk.edges_reverse] + have hOlen : O.E.ncard ≤ 2 * ρ + 2 := by + have e₁ := ncard_walk_E D.rad.G hWkS + have l₁ := (hW.spoke_length h1).1 + have l₂ := (hW.spoke_length h2).1 + rw [← hO] at e₁ + rw [e₁, GraphWalk.length_append, GraphWalk.length_reverse, hR, GraphWalk.length_cons, + GraphWalk.length_cons] + omega + have hOU : O.U = (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ∪ closure f₁ ∪ closure + f₂ := by + exact outer_path_point_set hl₁ O hOV hOE + have hbd' : discBd Δv = O.U ∪ P.U := by + rw [hbd, hOU] + ext x + simp only [mem_union] + tauto + -- The theta of `P`, the other path of `H`, and the outer path. + obtain ⟨F₁, F₂, hF₁, hF₂, hs₁, hs₂, hp₁, hp₂, hV₁₂, hE₁₂, hsup⟩ := hcH.2.exists_two_paths + h1.2.h_mem h2.2.h_mem hne12 + have hUH : H.U = F₁.U ∪ F₂.U := by + have hv := Drawing.sup_V hs₁ hs₂ + have he := Drawing.sup_E hs₁ hs₂ + rw [hsup] at hv he + exact U_union hv he + have hm₁ : O.V ∩ H.V ⊆ {h₁, h₂} := by + rintro x ⟨hx, hxH⟩ + rcases (hOV x).mp hx with h' | rfl | rfl | h' + · exact .inl (h1.support_hub h' hxH) + · exact .inl (h1.support_hub K₁.start_mem_support hxH) + · exact absurd hxH hrH + · exact .inr (h2.support_hub h' hxH) + have hm₂ : Disjoint O.E H.E := by + refine disjoint_left.mpr fun e he heH ↦ ?_ + have heG := hcH.1.2 heH + obtain ⟨a, ha, b, hb, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 e heG + have hne : a ≠ b := fun h' ↦ hb.2 (h' ▸ ha) + have hl : D.rad.G.toGraph.IsLink e a b := ⟨heG, D.rad.isPreRadial.2.1 ha, hb.1, hcap⟩ + obtain ⟨hab, hbb⟩ := Drawing.IsLink.mem_V_of_sub hcH.1 hl heH + rcases (hOE e).mp he with h' | rfl | rfl | h' + · obtain ⟨h₃, h₄⟩ := D.ends_mem_support K₁ h' hcap + exact hne ((h1.support_hub h₃ hab).trans (h1.support_hub h₄ hbb).symm) + · rcases (show r ∈ ({a, b} : Set Shat) by rw [← hcap, hl₁.2.2.2]; exact .inr rfl) with rfl | rfl + · exact hrH hab + · exact hrH hbb + · rcases (show r ∈ ({a, b} : Set Shat) by rw [← hcap, hl₂.2.2.2]; exact .inl rfl) with rfl | rfl + · exact hrH hab + · exact hrH hbb + · obtain ⟨h₃, h₄⟩ := D.ends_mem_support K₂ h' hcap + exact hne ((h2.support_hub h₃ hab).trans (h2.support_hub h₄ hbb).symm) + have hthe : ∃ Z : Drawing Shat, TwoPaths D.rad.G H P Z O h₁ h₂ := by + have base : TwoPaths D.rad.G H F₁ F₂ O h₁ h₂ := by + refine ⟨hne12, hcH.1, ⟨hs₁, hF₁⟩, ⟨hs₂, hF₂⟩, ?_, ?_, hV₁₂.le, hE₁₂, hOp, hm₁, hm₂⟩ + · have := Drawing.sup_V hs₁ hs₂ + rwa [hsup] at this + · have := Drawing.sup_E hs₁ hs₂ + rwa [hsup] at this + rcases path_of_circuit hne12 hF₁ hF₂ hs₁ hs₂ hV₁₂ hE₁₂ hUH hP with rfl | rfl + · exact ⟨F₂, base⟩ + · exact ⟨F₁, base.swap⟩ + obtain ⟨Z, ht⟩ := hthe + have hDsup : Dv = D.rad.G.sup O P := by + refine eq_of_U_eq hDv.1 (Drawing.sup_isSubdrawing _ _ _) ?_ + rw [hDU, hbd', ht.swap.U_right] + by_contra hlarge + push Not at hlarge + have hDcard : Dv.E.ncard ≤ O.E.ncard + P.E.ncard := by + rw [hDsup, Drawing.sup_E hOp.1 (hP.1.trans hcH.1)] + exact ncard_union_le _ _ + have hle : O.E.ncard ≤ P.E.ncard := by omega + have hlt' : O.E.ncard < P.E.ncard := by omega + obtain ⟨Δ₂, hins₂, -, hsecond, -⟩ := theorem_8_5_proof χ.isSurface + D.P.fits.internally_three_connected D.tb D.isTangle h𝒯' hins hd ht hle + (fun h' ↦ absurd h' hlt'.ne) + obtain rfl : Δ₂ = D.ins (D.rad.G.sup O Z) := D.eq_ins_of_isInsOf hins₂ + have hv₁O : v₁ ∈ O.U := O.V_subset_U ((hOV v₁).mpr (.inr (.inl rfl))) + have hout : ∀ {v : Shat}, v ∈ discBd W → v ∉ D.ins H \ H.U := fun hv ↦ hW.bd_not_strict hcH hlt + hinsW hv + have hnotsub : ¬ O.U ⊆ D.ins H := by + intro hs + exact hout h1.2.v_mem.2 ⟨hs hv₁O, fun h' ↦ (hHW h').2 h1.2.v_mem.2⟩ + have hmeet := hsecond hnotsub + -- The outer path meets `ins(H)` in its ends only. + have hOi : O.U ∩ D.ins H = {h₁, h₂} := by + exact outer_path_inter_hub_inside h1 h2 hHW hrH hcH hlt hUi R hRs hsupR O hO hOp + hOV hm₁ hm₂ (fun hv ↦ hout hv) + have hOW : O.U ⊆ W := by + have : O.U ⊆ discBd Δv := by + rw [hbd'] + exact subset_union_left + exact this.trans ((Surface.discBd_subset Δv).trans hΔW) + have hA := isLine_of_isPathBetween ht.left.2 hne12 + have hB := isLine_of_isPathBetween ht.right.2 hne12 + have hL := isLine_of_isPathBetween hOp.2 hne12 + have hAB : P.U ∪ Z.U = discBd (D.ins H) := by + rw [(D.ins_spec hcH hlt).2.2.2.1, ht.U_eq] + have hAB' : P.U ∩ Z.U = {h₁, h₂} := by + rw [U_inter_of_disjoint ht.left.1 ht.right.1 ht.disj_E] + refine Subset.antisymm ht.inter_V ?_ + rintro x (rfl | rfl) + · exact ⟨ht.mem_V₁.1, ht.swap.mem_V₁.1⟩ + · exact ⟨ht.mem_V₁.2, ht.swap.mem_V₁.2⟩ + obtain ⟨W', hW'W, hW', hss, hb⟩ := exists_larger_disc hT hW.is_disc + (D.ins_spec hcH hlt).2.2.1 hinsW hOW hA hB hL hAB hAB' hOi + rcases hb with hb | hb + · have heq := hW.disc_eq hW' hΔ hW'W hΔW (by rw [hb, hbd']) + exact hnot (heq ▸ hss.1) + · have hc₂ : Drawing.IsCircuitOf (D.rad.G.sup O Z) D.rad.G := ⟨Drawing.sup_isSubdrawing _ _ _, + ht.left_circuit⟩ + have hcard₂ : (D.rad.G.sup O Z).E.ncard ≤ 4 * ρ + 4 := by + have e₁ : H.E.ncard = P.E.ncard + Z.E.ncard := by + rw [ht.union_E, ncard_union_eq ht.disj_E P.finite_edges Z.finite_edges] + rw [Drawing.sup_E hOp.1 ht.sub₂] + have := ncard_union_le O.E Z.E + omega + have heq : W' = D.ins (D.rad.G.sup O Z) := hW.eq_ins_of_disc hc₂ hcard₂ hW' hW'W + (by rw [hb, ht.U_right]) + rw [← heq] at hmeet + obtain ⟨e, he⟩ := ht.exists_edge + obtain ⟨z, hz⟩ := ((hP.1.trans hcH.1).2 he).2.2.1.nonempty + have hzi : z ∈ W' ∩ D.ins H := by + have : z ∈ D.ins H := hUi (hP.1.U_subset (P.closure_subset_U he (subset_closure hz))) + exact ⟨hss.1 this, this⟩ + rw [hmeet] at hzi + have hzG : z ∉ D.rad.G.V := ((hP.1.trans hcH.1).2 he).2.1 hz |>.2 + obtain ⟨e', he', hze'⟩ := Z.exists_edge_of_mem hzi fun h' ↦ hzG (ht.sub₂.1 h') + obtain rfl := D.rad.G.edge_eq_of_mem ((hP.1.trans hcH.1).2 he) (ht.sub₂.2 he') hz hze' + exact disjoint_left.mp ht.disj_E he he' + +/-- **Graph Minors XIX, (13.5)** (page 368): "With notation as above, $|E(D_v)| \le 4\rho + 4$, and +$ins(D_v) = \Delta_v$." The hypotheses on `W` are those of +(13.1). -/ +theorem theorem_13_5_proof (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) {Δv : Set Shat} {Dv : Drawing Shat} + (hs : D.IsBoundarySector W H r Δv Dv) : + Dv.E.ncard ≤ 4 * ρ + 4 ∧ D.ins Dv = Δv := by + have : ConnectedSpace Shat := cap.connected + suffices hle : Dv.E.ncard ≤ 4 * ρ + 4 from + ⟨hle, (hW.eq_ins_of_disc hs.Dv_circuit hle hs.is_disc hs.Δv_sub hs.Dv_U.symm).symm⟩ + obtain ⟨v₁, v₂, h₁, h₂, f₁, f₂, S₁, S₂, hne, hf₁, -, hf₁', hf₂, -, hf₂', hS₁, hS₂, hcase⟩ + := hs.sector_spec + obtain ⟨K₁, h1, rfl⟩ := hS₁.exists_walk + obtain ⟨K₂, h2, rfl⟩ := hS₂.exists_walk + have hv₁G : v₁ ∈ D.rad.G.V := K₁.mem_vertexSet_of_mem_support K₁.start_mem_support + have hv₂G : v₂ ∈ D.rad.G.V := K₂.mem_vertexSet_of_mem_support K₂.start_mem_support + have hl₁ : D.rad.G.toGraph.IsLink f₁ r v₁ := ⟨hf₁, hs.rstar_mem.1.1, hv₁G, by rw + [closure_inter_V_eq_tilde hf₁, hf₁']⟩ + have hl₂ : D.rad.G.toGraph.IsLink f₂ r v₂ := ⟨hf₂, hs.rstar_mem.1.1, hv₂G, by rw + [closure_inter_V_eq_tilde hf₂, hf₂']⟩ + rcases hcase with ⟨⟨x, hx₁, hx₂⟩, hbd⟩ | ⟨hdisj, P, hP, hbd, hnot⟩ + · rw [walkDrawing_V] at hx₁ hx₂ + obtain rfl := h1.same_end h2 hx₁ hx₂ + obtain ⟨u, A₁, A₂, T, rfl, rfl, -, hmeet⟩ := h1.merge h2 hx₁ hx₂ + have hfan : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T := + ⟨hW, hbdS, hin, hs.rstar_mem.1, hs.rstar_mem.2, hne, hl₁, hl₂, h1, h2, fun y h₁ h₂ ↦ hmeet y + h₁ + ((GraphWalk.mem_support_append A₂ T).mpr (.inl h₂))⟩ + obtain ⟨C, hC⟩ := hfan.exists_circuit + have heq : Dv = C := eq_of_U_eq hs.Dv_circuit.1 hC.circuit.1 (by rw [hs.Dv_U, hbd, + hfan.closure_formula hC]) + have := (hfan.card_lt hC).1 + rw [heq] + omega + · refine sector_of_disjoint hW hbdS hin hs.rstar_mem h1 h2 hl₁.symm hl₂ + (fun x h₃ h₄ ↦ ?_) hP hs.is_disc hs.Δv_sub + hs.Dv_circuit hs.Dv_U hbd hnot + rw [walkDrawing_V, walkDrawing_V] at hdisj + exact disjoint_left.mp hdisj h₃ h₄ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13h.lean b/LeanPool/GraphMinor/GM19/Section13h.lean new file mode 100644 index 0000000000..c13aa9d48a --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13h.lean @@ -0,0 +1,239 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13g + +/-! +# Graph Minors XIX, Section 13: the first steps of (13.6) + +Let `F` be a `𝒯`-enclave around `𝒯'`, let `D_v` be a sector with `(Γ ∩ out(D_v), Γ ∩ ins(D_v)) ∈ +𝒯'`. We take the steps of the paper +that do not depend on the wheel. A circuit `C` made of edges of `F` and `D_v`, whose disc contains +both `ins(F)` and `ins(D_v)`, is +no longer than `D_v` (step (5)). The two discs share an edge of `Γ` (step (2)). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {rad : RadialDrawing cap Γ} + {ord ord' : ℕ} {𝒯 𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {F Dv C : Drawing Shat} + {Δf Δd Δc : Set Shat} + +omit [T2Space S] [T2Space Shat] in +/-- The `λ`-order of a separation is at most the `λ`-order of a separation of larger first +component. -/ +theorem lambdaOrder_lt_of_N1 (tb : TieBreaker rad) {x y : Hypergraph S (Set S) × Hypergraph S + (Set S)} (h : tb.N1 x < tb.N1 y) : + tb.lambdaOrder x ≤ tb.lambdaOrder y := by + simp only [TieBreaker.lambdaOrder] + rw [Prod.Lex.toLex_le_toLex] + exact Or.inl h + +omit [T2Space S] [T2Space Shat] in +/-- The sum of the weights of a set of edges of `Γ*` is at most the sum over a larger set. -/ +theorem TieBreaker.finsum_le_of_subset (tb : TieBreaker rad) {X Y : Set (Set Shat)} + (hY : Y ⊆ rad.G.E) (h : X ⊆ Y) : + ∑ᶠ e ∈ X, tb.wtE e ≤ ∑ᶠ e ∈ Y, tb.wtE e := by + have hfin : Y.Finite := rad.G.finite_edges.subset hY + have hX : X.Finite := hfin.subset h + rw [finsum_mem_eq_finite_toFinset_sum _ hX, finsum_mem_eq_finite_toFinset_sum _ hfin] + exact Finset.sum_le_sum_of_subset_of_nonneg (fun e he ↦ hfin.mem_toFinset.mpr (h + (hX.mem_toFinset.mp he))) + fun e he _ ↦ (tb.wtE_pos e (hY (hfin.mem_toFinset.mp he))).le + +omit [T2Space S] in +omit [T2Space Shat] in +/-- An enclave around `𝒯'` has `λ`-order at most that of any circuit which also separates `𝒯` from +`𝒯'`. -/ +theorem enclave_lambda_le (tb : TieBreaker rad) + (hd : IsDistinction tb.lambdaOrder 𝒯 𝒯' (partIn cap Γ Δf) (partIn cap Γ (closure Δfᶜ))) + (hDv : IsInsOf rad ord 𝒯 Dv Δd) (hmem : (partIn cap Γ (closure Δdᶜ), partIn cap Γ Δd) ∈ 𝒯') : + tb.lambdaOrder (partIn cap Γ Δf, partIn cap Γ (closure Δfᶜ)) ≤ tb.lambdaOrder + (partIn cap Γ Δd, partIn cap Γ (closure Δdᶜ)) := + hd.2 ⟨hDv.2.2.2.2, hmem⟩ + +/-- Step (1) of the proof of (13.6): `|E(F)| ≤ |E(D_v)|`. -/ +theorem enclave_card_le (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (tb : TieBreaker rad) (hF : IsInsOf rad ord 𝒯 F Δf) + (hd : IsDistinction tb.lambdaOrder 𝒯 𝒯' (partIn cap Γ Δf) (partIn cap Γ (closure Δfᶜ))) + (hDv : IsInsOf rad ord 𝒯 Dv Δd) (hmem : (partIn cap Γ (closure Δdᶜ), partIn cap Γ Δd) ∈ 𝒯') : + F.E.ncard ≤ Dv.E.ncard := by + have : ConnectedSpace Shat := cap.connected + have h := (N1_le_of_lambda_le tb (enclave_lambda_le tb hd hDv hmem)).1 + simp only [TieBreaker.N1] at h + rw [disc_order hS h3 rad hF.1 hF.2.2.1 hF.2.2.2.1, disc_order hS h3 rad hDv.1 hDv.2.2.1 + hDv.2.2.2.1] + omega + +/-- Step (2) of the proof of (13.6): there is an edge of `Γ` inside both `ins(F)` and `ins(D_v)`. -/ +theorem exists_edge_in_both (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (h𝒯' : IsTangle Γ.toHypergraph ord' 𝒯') + (hF : IsInsOf rad ord 𝒯 F Δf) (hmf : (partIn cap Γ (closure Δfᶜ), partIn cap Γ Δf) ∈ 𝒯') + (hDv : IsInsOf rad ord 𝒯 Dv Δd) (hmd : (partIn cap Γ (closure Δdᶜ), partIn cap Γ Δd) ∈ 𝒯') : + ∃ c ∈ Γ.E, cap.emb '' c ⊆ discInt Δf ∧ cap.emb '' c ⊆ discInt Δd := by + have : ConnectedSpace Shat := cap.connected + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + by_contra hn + push Not at hn + have hle : partIn cap Γ (closure Δfᶜ) ∪ partIn cap Γ (closure Δdᶜ) ≤ Γ.toHypergraph := + GM10.union_le (Γ.restrict_le _) (Γ.restrict_le _) + have hall := eq_of_all_edges hS h3 rad hle fun c hc ↦ by + rcases disc_edge_side rad hF.1.1 hman hF.2.2.1 hF.2.2.2.1 hc with h₁ | h₁ + · rcases disc_edge_side rad hDv.1.1 hman hDv.2.2.1 hDv.2.2.2.1 hc with h₂ | h₂ + · exact absurd h₂ (hn c hc h₁) + · exact Or.inr (restrict_out hc h₂) + · exact Or.inl (restrict_out hc h₁) + refine h𝒯'.axiom2 hmf hmd hmd ?_ + rw [← hall] + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (GM10.union_le hle (Γ.restrict_le _)) hle (by + ext v + simp only [GM10.union_vertexSet, mem_union] + tauto) (by + ext v + simp only [GM10.union_edgeSet, mem_union] + tauto) + +theorem prop_mix {a₀ a₁ b₀ b₁ p q : Prop} (m₀ : a₀ → p) (m₁ : a₁ → p) (m₂ : b₀ → q) (m₃ : b₁ → q) + (hc : ¬ (p ↔ q)) + (hs : ¬ (a₀ ↔ b₀) ∨ ¬ (a₁ ↔ b₁)) : ¬ ((a₀ ∨ a₁) ↔ (b₀ ∨ b₁)) := by + tauto + +/-- Step (5) of the proof of (13.6): a circuit `C` of `F ∪ D_v` whose disc includes `ins(F)` and +`ins(D_v)` is no longer than `D_v`, +and if equal it is no heavier. -/ +theorem uncross_circuit_le (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (tb : TieBreaker rad) (h𝒯 : IsTangle Γ.toHypergraph ord 𝒯) + (h𝒯' : IsTangle Γ.toHypergraph ord' 𝒯') (hF : IsInsOf rad ord 𝒯 F Δf) + (hd : IsDistinction tb.lambdaOrder 𝒯 𝒯' (partIn cap Γ Δf) (partIn cap Γ (closure Δfᶜ))) + (hDv : IsInsOf rad ord 𝒯 Dv Δd) (hmem : (partIn cap Γ (closure Δdᶜ), partIn cap Γ Δd) ∈ 𝒯') + (hC : C.IsCircuitOf rad.G) (hΔc : IsClosedDisc Δc) (hbd : discBd Δc = C.U) (hfc : Δf ⊆ Δc) + (hdc : Δd ⊆ Δc) + (hsub : ∀ e ∈ C.E, e ∈ F.E ∨ e ∈ Dv.E) : + C.E.ncard ≤ Dv.E.ncard ∧ (C.E.ncard = Dv.E.ncard → tb.weightSub C ≤ tb.weightSub Dv) := by + have : ConnectedSpace Shat := cap.connected + have hT := cap.isClosedSurface + set A₀ := partIn cap Γ Δf with hA₀ + set B₀ := partIn cap Γ (closure Δfᶜ) with hB₀ + set A₁ := partIn cap Γ Δd with hA₁ + set B₁ := partIn cap Γ (closure Δdᶜ) with hB₁ + set Ac := partIn cap Γ Δc with hAc + set Bc := partIn cap Γ (closure Δcᶜ) with hBc + have hs₀ : Γ.toHypergraph.IsSeparation A₀ B₀ := (disc_facts hS h3 rad hF.1 hF.2.2.1 hF.2.2.2.1).1 + have hs₁ : Γ.toHypergraph.IsSeparation A₁ B₁ := (disc_facts hS h3 rad hDv.1 hDv.2.2.1 + hDv.2.2.2.1).1 + have hsc : Γ.toHypergraph.IsSeparation Ac Bc := (disc_facts hS h3 rad hC hΔc hbd).1 + have hX : Γ.toHypergraph.IsSeparation (A₀ ∩ A₁) (B₀ ∪ B₁) := (hs₀.symm.union_inter hs₁.symm).symm + have hY : Γ.toHypergraph.IsSeparation (A₀ ∪ A₁) (B₀ ∩ B₁) := hs₀.union_inter hs₁ + have hsum := separationOrder_add_separationOrder hs₀ hs₁ + have hle₀ : Hypergraph.separationOrder A₀ B₀ ≤ Hypergraph.separationOrder A₁ B₁ := by + have h := (N1_le_of_lambda_le tb (enclave_lambda_le tb hd hDv hmem)).1 + simpa only [TieBreaker.N1] using h + have hA1T : (A₁, B₁) ∈ 𝒯 := hDv.2.2.2.2 + have hA0T : (A₀, B₀) ∈ 𝒯 := hd.1.1 + have hlamY : tb.lambdaOrder (A₀ ∪ A₁, B₀ ∩ B₁) ≤ tb.lambdaOrder (A₁, B₁) := by + by_cases hn : Hypergraph.separationOrder (A₀ ∩ A₁) (B₀ ∪ B₁) ≤ Hypergraph.separationOrder A₁ B₁ + · have hXo : Hypergraph.separationOrder (A₀ ∩ A₁) (B₀ ∪ B₁) < ord := lt_of_le_of_lt hn + (h𝒯.order_lt hA1T) + have hcomm : Hypergraph.separationOrder B₁ A₁ = Hypergraph.separationOrder A₁ B₁ := by + simp only [Hypergraph.separationOrder, GM10.inter_comm] + have hXo' : Hypergraph.separationOrder (A₀ ∩ A₁) (B₀ ∪ B₁) < ord' := + lt_of_le_of_lt (hn.trans_eq hcomm.symm) (h𝒯'.order_lt hmem) + have l₁ := hs₀.left_le + have l₂ := hs₀.right_le + have l₃ := hs₁.left_le + have l₄ := hs₁.right_le + have hXT : (A₀ ∩ A₁, B₀ ∪ B₁) ∈ 𝒯 := by + refine (h𝒯.axiom1 hX hXo).resolve_right fun hr ↦ h𝒯.axiom2 hA0T hr hr ?_ + have l₅ := GM10.union_le l₂ l₄ + have l₆ := GM10.union_le (GM10.union_le l₁ l₅) l₅ + exact eq_of_cover hs₀ (le_trans (GM10.le_union_left l₁ l₅) (GM10.le_union_left + (GM10.union_le l₁ l₅) l₅)) + (le_trans (le_trans (GM10.le_union_left l₂ l₄) (GM10.le_union_right l₁ l₅)) + (GM10.le_union_left (GM10.union_le l₁ l₅) l₅)) l₆ + have hXT' : (B₀ ∪ B₁, A₀ ∩ A₁) ∈ 𝒯' := by + have hs' : Hypergraph.separationOrder (B₀ ∪ B₁) (A₀ ∩ A₁) < ord' := by + have : Hypergraph.separationOrder (B₀ ∪ B₁) (A₀ ∩ A₁) = Hypergraph.separationOrder + (A₀ ∩ A₁) (B₀ ∪ B₁) := by + simp only [Hypergraph.separationOrder, GM10.inter_comm] + omega + exact (h𝒯'.axiom1 hX.symm hs').resolve_right fun hr ↦ h𝒯'.axiom2 hmem hd.1.2 hr + (cover_three hs₀ hs₁.symm) + have hc := hd.2 ⟨hXT, hXT'⟩ + rcases (tb.lambda_sum hS h3 hs₁ hs₀).1 with h | h + · rwa [GM10.union_comm, GM10.inter_comm] at h + · rw [GM10.inter_comm, GM10.union_comm] at h + exact absurd hc (not_le.mpr h) + · apply lambdaOrder_lt_of_N1 + simp only [TieBreaker.N1] + omega + have hUsub : C.U ⊆ F.U ∪ Dv.U := U_of_edges hC.2 (F.isClosed_U.union Dv.isClosed_U) fun e he ↦ by + rcases hsub e he with h | h + · exact (subset_closure.trans (F.closure_subset_U h)).trans subset_union_left + · exact (subset_closure.trans (Dv.closure_subset_U h)).trans subset_union_right + have hV : (Ac ∩ Bc).vertexSet ⊆ ((A₀ ∪ A₁) ∩ (B₀ ∩ B₁)).vertexSet := by + intro v hv + have hvU : cap.emb v ∈ C.U := (disc_facts hS h3 rad hC hΔc hbd).2.1 v hv + have hvV : v ∈ Γ.V := hv.1.1 + have hfr : C.U ⊆ closure Δcᶜ := by + intro x hx + have : x ∈ frontier Δc := by + rw [IsClosedDisc.frontier_eq_discBd hT hΔc, hbd] + exact hx + rw [frontier_eq_closure_inter_closure] at this + exact this.2 + have hout : ∀ {Δ : Set Shat}, Δ ⊆ Δc → cap.emb v ∈ closure Δᶜ := fun h ↦ + closure_mono (compl_subset_compl.mpr h) (hfr hvU) + refine ⟨?_, ⟨hvV, hout hfc⟩, ⟨hvV, hout hdc⟩⟩ + rcases hUsub hvU with h | h + · exact Or.inl ⟨hvV, by + have : F.U ⊆ Δf := by + rw [← hF.2.2.2.1] + exact Surface.discBd_subset _ + exact this h⟩ + · exact Or.inr ⟨hvV, by + have : Dv.U ⊆ Δd := by + rw [← hDv.2.2.2.1] + exact Surface.discBd_subset _ + exact this h⟩ + have hSplit : ∀ e ∈ C.E, rad.Splits (A₀ ∪ A₁) (B₀ ∩ B₁) e := by + intro e he + obtain ⟨c₁, c₂, hp, -⟩ := rad.splits_iff.mp (disc_split hS h3 rad hC hΔc hbd he) + have hc := (splits_of_pair hS h3 hp hsc).mp (disc_split hS h3 rad hC hΔc hbd he) + have hm₀ : ∀ {c}, c ∈ A₀.edgeSet → c ∈ Ac.edgeSet := fun h ↦ (part_mono hfc).edgeSet_subset h + have hm₁ : ∀ {c}, c ∈ A₁.edgeSet → c ∈ Ac.edgeSet := fun h ↦ (part_mono hdc).edgeSet_subset h + have hs₃ : ¬ (c₁ ∈ A₀.edgeSet ↔ c₂ ∈ A₀.edgeSet) ∨ ¬ (c₁ ∈ A₁.edgeSet ↔ c₂ ∈ A₁.edgeSet) := by + rcases hsub e he with h | h + · exact Or.inl ((splits_of_pair hS h3 hp hs₀).mp (disc_split hS h3 rad hF.1 hF.2.2.1 + hF.2.2.2.1 h)) + · exact Or.inr ((splits_of_pair hS h3 hp hs₁).mp (disc_split hS h3 rad hDv.1 hDv.2.2.1 + hDv.2.2.2.1 h)) + exact (splits_of_pair hS h3 hp hY).mpr (prop_mix hm₀ hm₁ hm₀ hm₁ hc hs₃) + have hco : C.E.ncard = 2 * Hypergraph.separationOrder Ac Bc := disc_order hS h3 rad hC hΔc hbd + have hc₁ : Dv.E.ncard = 2 * Hypergraph.separationOrder A₁ B₁ := disc_order hS h3 rad hDv.1 + hDv.2.2.1 hDv.2.2.2.1 + have hcoY : Hypergraph.separationOrder Ac Bc ≤ Hypergraph.separationOrder (A₀ ∪ A₁) (B₀ ∩ B₁) := + ncard_le_ncard hV ((A₀ ∪ A₁) ∩ (B₀ ∩ B₁)).vertexSet_finite + obtain ⟨hN1, hN2⟩ := N1_le_of_lambda_le tb hlamY + simp only [TieBreaker.N1] at hN1 hN2 + refine ⟨by omega, fun heq ↦ ?_⟩ + have h₂ := hN2 (by omega) + rw [disc_N2 hS h3 tb hDv.1 hDv.2.2.1 hDv.2.2.2.1] at h₂ + refine le_trans ?_ h₂ + simp only [TieBreaker.N2, TieBreaker.weightSub] + exact tb.finsum_le_of_subset (fun e he ↦ he.1) fun e he ↦ ⟨hC.1.2 he, hSplit e he⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13i.lean b/LeanPool/GraphMinor/GM19/Section13i.lean new file mode 100644 index 0000000000..7fd8dc4ad9 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13i.lean @@ -0,0 +1,289 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13h + +/-! +# Graph Minors XIX, Section 13: pushing curves into a disc + +The proof of (13.6) speaks of arcs that are homotopic in `Δ₀ \ {h}` to a curve in `Δ'_v`, with +`Δ'_v` simply-connected. This file has +the plain facts behind it: a set homeomorphic to a convex set is simply-connected, so lines and a +closed disc less a boundary point +are (`isSimplyConnectedSet_of_convex`), "homotopic to a curve in `Y`" is kept by joining paths +(`PushesInto.trans`), and a loop that +runs once around an `O`-arc and is null-homotopic makes the `O`-arc null-homotopic +(`null_oArc_of_loop`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 unitInterval + +universe u + +section Convex + +variable {T : Type*} [TopologicalSpace T] {E : Type*} [AddCommGroup E] [Module ℝ E] + [TopologicalSpace E] + [IsTopologicalAddGroup E] [ContinuousSMul ℝ E] + +/-- A set homeomorphic to a nonempty convex set is simply-connected. -/ +theorem isSimplyConnectedSet_of_convex {A : Set E} {X : Set T} (hA : Convex ℝ A) (hne : A.Nonempty) + (e : A ≃ₜ X) : + IsSimplyConnectedSet X := by + refine ⟨?_, fun φ hφ ↦ ?_⟩ + · have hpc : PathConnectedSpace A := isPathConnected_iff_pathConnectedSpace.mp + (hA.isPathConnected hne) + have hpc' : PathConnectedSpace X := e.surjective.pathConnectedSpace e.continuous + exact isPathConnected_iff_pathConnectedSpace.mpr hpc' + obtain ⟨c, hc⟩ := hne + let c0 : A := ⟨c, hc⟩ + refine ⟨(e c0).1, (e c0).2, ?_⟩ + let lift : C(Circle, A) := + ⟨fun x ↦ e.symm ⟨φ x, hφ (mem_range_self x)⟩, e.symm.continuous.comp + (φ.continuous.subtype_mk _)⟩ + have hmem : ∀ p : Circle × I, (1 - (p.2 : ℝ)) • (lift p.1).1 + (p.2 : ℝ) • c ∈ A := fun p ↦ + hA (lift p.1).2 hc (sub_nonneg.mpr p.2.2.2) p.2.2.1 (sub_add_cancel 1 (p.2 : ℝ)) + let Ψ : C(Circle × I, T) := + ⟨fun p ↦ (e ⟨(1 - (p.2 : ℝ)) • (lift p.1).1 + (p.2 : ℝ) • c, hmem p⟩).1, + continuous_subtype_val.comp (e.continuous.comp + ((Continuous.add + (Continuous.smul (continuous_const.sub (continuous_subtype_val.comp continuous_snd)) + (continuous_subtype_val.comp (lift.continuous.comp continuous_fst))) + (Continuous.smul (continuous_subtype_val.comp continuous_snd) + continuous_const)).subtype_mk hmem))⟩ + refine ⟨Ψ, fun p ↦ (e ⟨_, hmem p⟩).2, fun x ↦ ?_, fun x ↦ ?_⟩ + · have hx : (⟨(1 - ((x, (0 : I)).2 : ℝ)) • (lift (x, (0 : I)).1).1 + ((x, + (0 : I)).2 : ℝ) • c, hmem (x, 0)⟩ : A) = lift x := by + ext + simp + change (e ⟨_, hmem (x, 0)⟩).1 = φ x + rw [hx] + exact congrArg Subtype.val (e.apply_symm_apply _) + · have hx : (⟨(1 - ((x, (1 : I)).2 : ℝ)) • (lift (x, (1 : I)).1).1 + ((x, + (1 : I)).2 : ℝ) • c, hmem (x, 1)⟩ : A) = c0 := by + ext + simp [c0] + change (e ⟨_, hmem (x, 1)⟩).1 = (e c0).1 + rw [hx] + +/-- A line is simply-connected. -/ +theorem _root_.GraphMinor.Surface.IsLineWithEnds.isSimplyConnectedSet {L : Set T} {a b : T} + (h : IsLineWithEnds L a b) : IsSimplyConnectedSet L := by + obtain ⟨f, -, -⟩ := h + exact isSimplyConnectedSet_of_convex (E := ℝ) (A := Icc 0 1) (convex_Icc 0 1) ⟨0, by simp⟩ f + +/-- There is a path along a line from one end to the other. -/ +theorem _root_.GraphMinor.Surface.IsLineWithEnds.exists_path {L : Set T} {a b : T} + (h : IsLineWithEnds L a b) : ∃ p : Path a b, ∀ t, p t ∈ L := by + obtain ⟨f, h0, h1⟩ := h + exact ⟨⟨⟨fun t ↦ (f t).1, by fun_prop⟩, h0, h1⟩, fun t ↦ (f t).2⟩ + +/-- The closed unit disc less a point of its boundary is convex. -/ +theorem convex_closedUnitDisc_diff {c : EuclideanPlane} (hc : c ∈ UnitCircle) : Convex ℝ + (ClosedUnitDisc \ {c}) := by + have hs : StrictConvex ℝ (Metric.closedBall (0 : EuclideanPlane) 1) + := strictConvex_closedBall ℝ 0 1 + have hcs : ‖c‖ = 1 := by simpa [UnitCircle] using hc + intro x hx y hy a b ha hb hab + refine ⟨convex_closedUnitDisc hx.1 hy.1 ha hb hab, fun he ↦ ?_⟩ + have he' : a • x + b • y = c := he + rcases ha.eq_or_lt with rfl | ha' + · rw [zero_add] at hab + subst hab + apply hy.2 + simpa using he' + rcases hb.eq_or_lt with rfl | hb' + · rw [add_zero] at hab + subst hab + apply hx.2 + simpa using he' + have hne : x ≠ y := by + rintro rfl + apply hx.2 + rw [← add_smul, hab, one_smul] at he' + exact he' + have hi := hs hx.1 hy.1 hne ha' hb' hab + rw [interior_closedBall _ one_ne_zero, Metric.mem_ball, dist_zero_right, he', hcs] at hi + exact lt_irrefl _ hi + +/-- A closed disc less a point of its boundary is simply-connected. -/ +theorem isSimplyConnectedSet_disc_diff {Δ : Set T} (hΔ : IsClosedDisc Δ) {h : T} + (hh : h ∈ discBd Δ) : IsSimplyConnectedSet (Δ \ {h}) := by + obtain ⟨e⟩ := hΔ + have hb := disc_boundary Δ e + obtain ⟨c, hc, hce⟩ : ∃ c : ClosedUnitDisc, c.1 ∈ UnitCircle ∧ (e c).1 = h := by + rw [hb] at hh + obtain ⟨c, hc, rfl⟩ := hh + exact ⟨c, hc, rfl⟩ + have hA := convex_closedUnitDisc_diff hc + have hne : (ClosedUnitDisc \ {c.1}).Nonempty := ⟨0, zero_mem_closedUnitDisc, fun h0 ↦ by + have : ‖c.1‖ = 1 := by simpa [UnitCircle] using hc + rw [← h0] at this + simp at this⟩ + let f : (ClosedUnitDisc \ {c.1} : Set EuclideanPlane) ≃ₜ (Δ \ {h} : Set T) := + { toFun := fun a ↦ ⟨(e ⟨a.1, a.2.1⟩).1, (e ⟨a.1, a.2.1⟩).2, fun hm ↦ by + have : e ⟨a.1, a.2.1⟩ = e c := Subtype.ext (hm.trans hce.symm) + exact a.2.2 (congrArg Subtype.val (e.injective this))⟩ + invFun := fun x ↦ ⟨(e.symm ⟨x.1, x.2.1⟩).1, (e.symm ⟨x.1, x.2.1⟩).2, fun hm ↦ by + have : e.symm ⟨x.1, x.2.1⟩ = c := Subtype.ext hm + apply x.2.2 + have h₂ := congrArg (fun w ↦ (e w).1) this + simpa [hce] using h₂⟩ + left_inv := fun a ↦ by simp + right_inv := fun x ↦ by simp + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop } + exact isSimplyConnectedSet_of_convex hA hne f + +end Convex + +section Push + +variable {T : Type*} [TopologicalSpace T] + +/-- Every path along `L` from `a` to `b` is homotopic in `Z` to a path in `Y`. -/ +def PushesInto (Z Y L : Set T) (a b : T) : Prop := + ∀ (ha : a ∈ Z) (hb : b ∈ Z) (p : Path (⟨a, ha⟩ : Z) ⟨b, hb⟩), (∀ t, (p t).1 ∈ L) → + ∃ q : Path (⟨a, ha⟩ : Z) ⟨b, hb⟩, (∀ t, (q t).1 ∈ Y) ∧ p.Homotopic q + +variable {Z Y L L₁ L₂ : Set T} {a b c : T} + +/-- A set in `Y` pushes into `Y`. -/ +theorem PushesInto.of_subset (h : L ⊆ Y) : PushesInto Z Y L a b := fun _ _ p hp ↦ + ⟨p, fun t ↦ h (hp t), Path.Homotopic.refl p⟩ + +/-- A path in `Z` staying in `L` from `a` to `b`, as a path of `Z`. -/ +theorem exists_path_in (hL : L ⊆ Z) {p : Path a b} (hp : ∀ t, p t ∈ L) (ha : a ∈ Z) (hb : b ∈ Z) : + ∃ p' : Path (⟨a, ha⟩ : Z) ⟨b, hb⟩, ∀ t, (p' t).1 = p t := + ⟨pathCod p ha hb fun t ↦ hL (hp t), fun _ ↦ rfl⟩ + +/-- Joining: if `L₁` from `a` to `c` and `L₂` from `c` to `b` push into `Y`, and `L` is +simply-connected, then `L` pushes into `Y`. -/ +theorem PushesInto.trans (h₁ : PushesInto Z Y L₁ a c) (h₂ : PushesInto Z Y L₂ c b) + (hL : IsSimplyConnectedSet L) (hLZ : L ⊆ Z) + (hs₁ : L₁ ⊆ L) (hs₂ : L₂ ⊆ L) {p₁ : Path a c} {p₂ : Path c b} (hp₁ : ∀ t, p₁ t ∈ L₁) + (hp₂ : ∀ t, p₂ t ∈ L₂) : + PushesInto Z Y L a b := by + intro ha hb p hp + have hc : c ∈ Z := hLZ (hs₁ (by simpa using hp₁ 1)) + obtain ⟨r₁, hr₁⟩ := exists_path_in (hs₁.trans hLZ) hp₁ ha hc + obtain ⟨r₂, hr₂⟩ := exists_path_in (hs₂.trans hLZ) hp₂ hc hb + obtain ⟨q₁, hq₁, ho₁⟩ := h₁ ha hc r₁ fun t ↦ by rw [hr₁]; exact hp₁ t + obtain ⟨q₂, hq₂, ho₂⟩ := h₂ hc hb r₂ fun t ↦ by rw [hr₂]; exact hp₂ t + refine ⟨q₁.trans q₂, fun t ↦ ?_, ?_⟩ + · rw [Path.trans_apply] + split_ifs + · exact hq₁ _ + · exact hq₂ _ + · have haL : a ∈ L := hs₁ (by simpa using hp₁ 0) + have hbL : b ∈ L := hs₂ (by simpa using hp₂ 1) + have hh := homotopic_of_mem hL hLZ p (r₁.trans r₂) haL hbL hp (fun t ↦ by + rw [Path.trans_apply] + split_ifs + · rw [hr₁]; exact hs₁ (hp₁ _) + · rw [hr₂]; exact hs₂ (hp₂ _)) + exact hh.trans (ho₁.hcomp ho₂) + +/-- A loop that runs once around `F`, read on the circle, is a homeomorphism onto `F`. -/ +theorem exists_homeo_of_loop [T2Space T] {F : Set T} (ℓ : C(I, T)) (h01 : ℓ 0 = ℓ 1) (hr : range ℓ + = F) + (hinj : ∀ s t, ℓ s = ℓ t → s = t ∨ (s = 0 ∧ t = 1) ∨ (s = 1 ∧ t = 0)) : + ∃ φ : Circle ≃ₜ F, ∀ t, (φ (arcParam 1 t)).1 = ℓ t := by + let g : C(Circle, T) := loopLift 1 ℓ h01 + have hmem : ∀ z, g z ∈ F := fun z ↦ by + obtain ⟨t, rfl⟩ := arcParam_surjective 1 z + rw [← hr] + exact ⟨t, (loopLift_apply 1 ℓ h01 t).symm⟩ + let g' : Circle → F := fun z ↦ ⟨g z, hmem z⟩ + have hc : Continuous g' := g.continuous.subtype_mk _ + have hbij : Function.Bijective g' := by + constructor + · intro x y hxy + obtain ⟨s, rfl⟩ := arcParam_surjective 1 x + obtain ⟨t, rfl⟩ := arcParam_surjective 1 y + have he : ℓ s = ℓ t := by + have := congrArg Subtype.val hxy + simpa [g', g] using this + have h₀₁ : arcParam (1 : Circle) 0 = arcParam 1 1 := by + simp [arcParam_apply] + rcases hinj s t he with rfl | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rfl + · exact h₀₁ + · exact h₀₁.symm + · rintro ⟨y, hy⟩ + rw [← hr] at hy + obtain ⟨t, rfl⟩ := hy + exact ⟨arcParam 1 t, Subtype.ext (loopLift_apply 1 ℓ h01 t)⟩ + have : T2Space F := inferInstance + refine ⟨hc.homeoOfEquivCompactToT2 (f := Equiv.ofBijective g' hbij), fun t ↦ ?_⟩ + exact loopLift_apply 1 ℓ h01 t + +/-- If a loop in `Z` runs once around the `O`-arc `F` and is null-homotopic in `Z`, then `F` is. -/ +theorem null_oArc_of_loop [T2Space T] {F : Set T} {a : Z} (p : Path a a) (hr : range (fun t ↦ + (p t).1) = F) + (hinj : ∀ s t, (p s).1 = (p t).1 → s = t ∨ (s = 0 ∧ t = 1) ∨ (s = 1 ∧ t = 0)) (hn : p.Homotopic + (Path.refl a)) : + IsNullHomotopicOArcIn Z F := by + let ℓ : C(I, T) := ⟨fun t ↦ (p t).1, by fun_prop⟩ + obtain ⟨φ, hφ⟩ := exists_homeo_of_loop ℓ (by simp [ℓ]) hr hinj + refine ⟨φ, a.1, a.2, closedCurvesHomotopicIn_of_path 1 _ _ p (Path.refl a) (fun t ↦ (hφ t).symm) + (fun t ↦ by simp) hn⟩ + +/-- Two injective paths with the same ends, meeting only at the ends: the loop formed by the first +and then the reverse of the second runs once around. -/ +theorem loop_trans_injective {u v : T} (p q : Path u v) (hp : Function.Injective p) + (hq : Function.Injective q) + (hm : ∀ s t, p s = q t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) (s t : I) + (h : (p.trans q.symm) s = (p.trans q.symm) t) : s = t ∨ (s = 0 ∧ t = 1) ∨ (s = 1 ∧ t = 0) := by + have key : ∀ {x y : I} (hx : (x : ℝ) ≤ 1 / 2) (hy : ¬ (y : ℝ) ≤ 1 / 2), (p.trans q.symm) x = + (p.trans q.symm) y → x = 0 ∧ y = 1 := by + intro x y hx hy he + rw [Path.trans_apply, Path.trans_apply, dite_eq_left hx, dite_eq_right hy, Path.symm_apply] + at he + rcases hm _ _ he with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · have h₁' := congrArg Subtype.val h₁ + have h₂' := congrArg Subtype.val h₂ + simp only [Icc.coe_zero, coe_symm_eq] at h₁' h₂' + constructor + · apply Subtype.ext + simp only [Icc.coe_zero] + linarith + · apply Subtype.ext + simp only [Icc.coe_one] + linarith + · have h₂' := congrArg Subtype.val h₂ + simp only [Icc.coe_one, coe_symm_eq] at h₂' + exfalso + apply hy + linarith + by_cases hs : (s : ℝ) ≤ 1 / 2 <;> by_cases ht : (t : ℝ) ≤ 1 / 2 + · rw [Path.trans_apply, Path.trans_apply, dite_eq_left hs, dite_eq_left ht] at h + have := congrArg Subtype.val (hp h) + refine Or.inl (Subtype.ext ?_) + simp only at this + linarith + · obtain ⟨h₁, h₂⟩ := key hs ht h + exact Or.inr (Or.inl ⟨h₁, h₂⟩) + · obtain ⟨h₁, h₂⟩ := key ht hs h.symm + exact Or.inr (Or.inr ⟨h₂, h₁⟩) + · rw [Path.trans_apply, Path.trans_apply, dite_eq_right hs, dite_eq_right ht, Path.symm_apply, + Path.symm_apply] at h + have := congrArg Subtype.val (hq h) + refine Or.inl (Subtype.ext ?_) + simp only [coe_symm_eq] at this + linarith + +end Push + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13j.lean b/LeanPool/GraphMinor/GM19/Section13j.lean new file mode 100644 index 0000000000..8bd51fa083 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13j.lean @@ -0,0 +1,488 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13i + +/-! +# Graph Minors XIX, Section 13: two outer arcs that do not push into `Δ'_v` + +This is the paragraph of the proof of (13.6) before its step (9). We have a disc `Δ₀`, a point `h ∈ +Δ \ U(C)`, and `Y = Δ'_v` +simply-connected. If each arc of `C` is homotopic in `Δ₀ \ {h}` to a curve in `Y`, then `U(C)` is +null-homotopic in `Δ₀ \ {h}`, and +by Graph Minors XI (7.2) it bounds a disc in `Δ₀ \ {h}`, which is false. So some arc is not. Since +`U(F)` is null-homotopic in `Δ₀ \ {h}` +there cannot be just one such arc. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 unitInterval + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- An *arc* of `F` on `D_v` (Graph Minors XIX, proof of (13.6)): a path of `F` with distinct ends +both in `V(D_v)`, with no internal +vertex in `V(D_v)` and no edge in `E(D_v)`. -/ +structure IsArcOn (G Dv F : Drawing Shat) {a b : Shat} (P : GraphWalk G.toGraph a b) : Prop where + ne : a ≠ b + simple : P.IsSimple + left : a ∈ Dv.V + right : b ∈ Dv.V + inner : ∀ x ∈ P.support, x ∈ Dv.V → x = a ∨ x = b + off : ∀ e ∈ P.edges, e ∉ Dv.E + inF : ∀ e ∈ P.edges, e ∈ F.E + +/-- There is a path along a simple walk. -/ +theorem exists_walk_path (G : Drawing Shat) {a b : Shat} + (K : GraphWalk G.toGraph a b) (hs : K.IsSimple) : + ∃ p : Path a b, ∀ t, p t ∈ (walkDrawing G K).U := by + by_cases hab : a = b + · subst hab + refine ⟨Path.refl a, fun t ↦ ?_⟩ + exact (walkDrawing G K).V_subset_U (by rw [walkDrawing_V]; exact K.start_mem_support) + · exact IsLineWithEnds.exists_path (isLine_of_isPathBetween (walkDrawing_isPathBetween G hs) hab) + +/-- Two discs in a third disc with the same boundary are equal. -/ +theorem disc_eq_of_subset_disc {T : Type} [TopologicalSpace T] [ConnectedSpace T] + (hT : IsClosedSurface T) {Δ₀ Δ₁ Δ₂ : Set T} (h₀ : IsClosedDisc Δ₀) + (h₁ : IsClosedDisc Δ₁) (h₂ : IsClosedDisc Δ₂) (s₁ : Δ₁ ⊆ Δ₀) (s₂ : Δ₂ ⊆ Δ₀) (hb : discBd Δ₁ + = discBd Δ₂) : Δ₁ = Δ₂ := by + by_contra hne + have hcov := cover_of_discBd_eq hT h₁ h₂ hb hne + have hu : Δ₀ = univ := eq_univ_of_univ_subset (hcov ▸ union_subset s₁ s₂) + have hf := IsClosedDisc.frontier_eq_discBd hT h₀ + rw [hu, frontier_univ] at hf + have hne' : (discBd Δ₀).Nonempty := by + obtain ⟨e⟩ := h₀.isOArc_discBd + exact ⟨_, (e 1).2⟩ + rw [hu, ← hf] at hne' + exact not_nonempty_empty hne' + +/-- All the edges of a simple walk that starts on one of two walks, and is on an edge of one or the +other, stay on that one. -/ +theorem walk_stays {α' β : Type*} {G : Graph α' β} {s t a₁ b₁ a₂ b₂ : α'} (K : GraphWalk G s t) + (hs : K.IsSimple) + (W₁ : GraphWalk G a₁ b₁) (W₂ : GraphWalk G a₂ b₂) (hE : ∀ e ∈ K.edges, e ∈ W₁.edges + ∨ e ∈ W₂.edges) + (hV : ∀ x ∈ K.support, x ∈ W₁.support → x ∈ W₂.support → x = t) (hst : s ∈ W₁.support) + (hside : ∀ {e x y}, G.IsLink e x y → e ∈ W₁.edges → x ∈ W₁.support → y ∈ W₁.support) + (hside₂ : ∀ {e x y}, G.IsLink e x y → e ∈ W₂.edges → x ∈ W₂.support) : ∀ e ∈ K.edges, e ∈ + W₁.edges := by + induction K with + | nil h => simp + | @cons a c b e hl r ih => + have hnd : (GraphWalk.cons hl r).support.Nodup := hs + simp only [GraphWalk.support_cons, List.nodup_cons] at hnd + have he : e ∈ W₁.edges := by + rcases hE e (by simp) with h | h + · exact h + · have ha := hV a (by simp) hst (hside₂ hl h) + subst ha + exact absurd r.end_mem_support hnd.1 + have hc := hside hl he hst + have ih' := ih hnd.2 (fun f hf ↦ hE f (by simp [hf])) (fun x hx ↦ hV x (by simp [hx])) hc + intro f hf + rcases List.mem_cons.mp hf with rfl | hf' + · exact he + · exact ih' f hf' + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {F Dv C : Drawing Shat} + +omit [T2Space S] in +theorem mem_V_of_link_edge {H : Drawing Shat} (hH : H.IsSubdrawing D.rad.G) {a b : Shat} {K : + GraphWalk D.rad.G.toGraph a b} {e : Set Shat} (he : e ∈ K.edges) (heH : e ∈ H.E) : + ∃ x y, x ≠ y ∧ x ∈ K.support ∧ y ∈ K.support ∧ x ∈ H.V ∧ y ∈ H.V := by + obtain ⟨x, y, hne, hx, hy, hcap⟩ := exists_ends_of_mem_edges D K he + have hxm : x ∈ closure e ∩ D.rad.G.V := by rw [hcap]; exact .inl rfl + have hym : y ∈ closure e ∩ D.rad.G.V := by rw [hcap]; exact .inr rfl + have hl : D.rad.G.toGraph.IsLink e x y := ⟨TieBreaker.mem_edges_E K he, hxm.2, hym.2, hcap⟩ + have := Drawing.IsLink.mem_V_of_sub hH hl heH + exact ⟨x, y, hne, hx, hy, this.1, this.2⟩ + +omit [T2Space S] in +/-- **Pushing a walk.** Let `K` be a simple walk of `F ∪ D_v` with ends on `D_v`, in `Z`. If each +arc in `K` pushes into `Y`, then +so does `K`. -/ +theorem walk_pushes (hDv : Dv.IsSubdrawing D.rad.G) {Z Y : Set Shat} (hY : ∀ x ∈ Dv.U, x ∈ Z + → x ∈ Y) (n : ℕ) : + ∀ {a b : Shat} (K : GraphWalk D.rad.G.toGraph a b), K.length = n → K.IsSimple → a ∈ Dv.V + → b ∈ Dv.V → + (∀ e ∈ K.edges, e ∈ Dv.E ∨ e ∈ F.E) → (walkDrawing D.rad.G K).U ⊆ Z → + (∀ (u v : Shat) (M : GraphWalk D.rad.G.toGraph u v), IsArcOn D.rad.G Dv F M → + (∀ e ∈ M.edges, e ∈ K.edges) → + PushesInto Z Y (walkDrawing D.rad.G M).U u v) → + PushesInto Z Y (walkDrawing D.rad.G K).U a b := by + classical + have : ConnectedSpace Shat := cap.connected + set G := D.rad.G with hG + induction n using Nat.strong_induction_on with + | _ n ih => + intro a b K hn hs ha hb hKe hKZ harc + cases K with + | nil hv => + refine PushesInto.of_subset fun x hx ↦ hY x ?_ (hKZ hx) + have hx' := (point_drawing_facts G hv).2.2 ▸ hx + rw [mem_singleton_iff.mp hx'] + exact Dv.V_subset_U ha + | @cons a y b e hl r => + obtain ⟨u, huX, A, B, rfl, hA⟩ := GraphWalk.exists_first_mem r (X + := Dv.V) ⟨b, r.end_mem_support, hb⟩ + have hsK : (GraphWalk.cons hl (A.append B)).IsSimple := hs + have hsplit : GraphWalk.cons hl (A.append B) = (GraphWalk.cons hl A).append B := rfl + have hnd : (GraphWalk.cons hl (A.append B)).support.Nodup := hsK + simp only [GraphWalk.support_cons, List.nodup_cons] at hnd + have hab : a ≠ b := fun h ↦ hnd.1 (h ▸ (A.append B).end_mem_support) + have hau : a ≠ u := fun h ↦ hnd.1 (h ▸ (GraphWalk.mem_support_append A B).mpr + (.inr B.start_mem_support)) + have hlen : B.length < n := by + have h₁ : (GraphWalk.cons hl (A.append B)).length = (A.append B).length + 1 := rfl + rw [GraphWalk.length_append] at h₁ + omega + rw [hsplit] at hsK hKZ hKe harc ⊢ + obtain ⟨hsM, hsB⟩ := GraphMinor.GM19.GraphWalk.IsSimple.of_append hsK + have hUK := U_append G (GraphWalk.cons hl A) B + have hEdges : ∀ f, f ∈ ((GraphWalk.cons hl A).append B).edges ↔ f ∈ + (GraphWalk.cons hl A).edges ∨ f ∈ B.edges := fun f ↦ by + rw [GraphWalk.edges_append, List.mem_append] + have hm₁ : (walkDrawing G (GraphWalk.cons hl A)).U ⊆ Z := subset_union_left.trans (hUK ▸ hKZ) + have hm₂ : (walkDrawing G B).U ⊆ Z := subset_union_right.trans (hUK ▸ hKZ) + have hpM : PushesInto Z Y (walkDrawing G (GraphWalk.cons hl A)).U a u := by + by_cases he : e ∈ Dv.E + · have hyV : y ∈ Dv.V := (Drawing.IsLink.mem_V_of_sub hDv hl he).2 + obtain rfl : y = u := hA y A.start_mem_support hyV + have hsA : A.IsSimple := (GraphWalk.IsSimple.of_cons hsM) + obtain ⟨hAe, hAs⟩ := simple_self hsA + refine PushesInto.of_subset fun x hx ↦ hY x ?_ (hm₁ hx) + rw [mem_walkDrawing_U] at hx + rcases hx with hx | ⟨f, hf, hxf⟩ + · rcases List.mem_cons.mp hx with rfl | hx + · exact Dv.V_subset_U ha + · rw [hAs, List.mem_singleton] at hx + rw [hx] + exact Dv.V_subset_U hyV + · rcases List.mem_cons.mp hf with rfl | hf + · exact Dv.closure_subset_U he hxf + · rw [hAe] at hf + simp at hf + · have hoff : ∀ f ∈ (GraphWalk.cons hl A).edges, f ∉ Dv.E := by + intro f hf hfD + rcases List.mem_cons.mp hf with rfl | hf + · exact he hfD + · obtain ⟨x, z, hne, hx, hz, hxV, hzV⟩ := mem_V_of_link_edge hDv hf hfD + exact hne ((hA x hx hxV).trans (hA z hz hzV).symm) + refine harc a u _ ⟨hau, hsM, ha, huX, ?_, hoff, fun f hf ↦ ?_⟩ fun f hf ↦ (hEdges f).mpr + (.inl hf) + · intro x hx hxV + rcases List.mem_cons.mp hx with rfl | hx + · exact .inl rfl + · exact .inr (hA x hx hxV) + · exact (hKe f ((hEdges f).mpr (.inl hf))).resolve_left (hoff f hf) + have hpB : PushesInto Z Y (walkDrawing G B).U u b := by + exact ih B.length hlen B rfl hsB huX hb (fun f hf ↦ hKe f ((hEdges f).mpr (.inr hf))) hm₂ + fun v w M hM hMe ↦ harc v w M hM fun f hf ↦ (hEdges f).mpr (.inr (hMe f hf)) + obtain ⟨p₁, hp₁⟩ := exists_walk_path G _ hsM + obtain ⟨p₂, hp₂⟩ := exists_walk_path G _ hsB + exact hpM.trans hpB (IsLineWithEnds.isSimplyConnectedSet (isLine_of_isPathBetween + (walkDrawing_isPathBetween G hsK) hab)) hKZ + (by rw [hUK]; exact subset_union_left) (by rw [hUK]; exact subset_union_right) hp₁ hp₂ + +omit [T2Space S] in +/-- A circuit in two pieces, each pushing into the simply-connected set `Y`, is null-homotopic in +`Z`. -/ +theorem split_null {Z Y : Set Shat} (hYs : IsSimplyConnectedSet Y) (hYZ : Y ⊆ Z) {a b : Shat} {W₁ : + GraphWalk D.rad.G.toGraph a b} + {W₂ : GraphWalk D.rad.G.toGraph b a} (hs : Splits C W₁ W₂) (hab : a ≠ b) (hz : C.U ⊆ Z) + (ha : a ∈ Y) (hb : b ∈ Y) + (h₁ : PushesInto Z Y (walkDrawing D.rad.G W₁).U a b) (h₂ : PushesInto Z Y + (walkDrawing D.rad.G W₂).U b a) : IsNullHomotopicOArcIn Z C.U := by + have : ConnectedSpace Shat := cap.connected + have hU₂ : (walkDrawing D.rad.G W₂.reverse).U = (walkDrawing D.rad.G W₂).U := by + ext x + simp only [mem_walkDrawing_U, GraphWalk.support_reverse, GraphWalk.edges_reverse, + List.mem_reverse] + have hCU : C.U = (walkDrawing D.rad.G W₁).U ∪ (walkDrawing D.rad.G W₂).U := U_union (by + ext x + rw [hs.V x, walkDrawing_V, walkDrawing_V] + rfl) (by + ext e + rw [hs.E e, walkDrawing_E, walkDrawing_E] + rfl) + obtain ⟨f₁, f₁0, f₁1⟩ := isLine_of_isPathBetween (walkDrawing_isPathBetween D.rad.G hs.s₁) hab + obtain ⟨f₂, f₂0, f₂1⟩ := isLine_of_isPathBetween (walkDrawing_isPathBetween D.rad.G + hs.s₂.reverse) hab + let p : Path a b := ⟨⟨fun t ↦ (f₁ t).1, by fun_prop⟩, f₁0, f₁1⟩ + let q : Path a b := ⟨⟨fun t ↦ (f₂ t).1, by fun_prop⟩, f₂0, f₂1⟩ + have hpi : Function.Injective p := fun s t h ↦ f₁.injective (Subtype.ext h) + have hqi : Function.Injective q := fun s t h ↦ f₂.injective (Subtype.ext h) + have hpm : ∀ t, p t ∈ (walkDrawing D.rad.G W₁).U := fun t ↦ (f₁ t).2 + have hqm : ∀ t, q t ∈ (walkDrawing D.rad.G W₂).U := fun t ↦ hU₂ ▸ (f₂ t).2 + have hrp : range p = (walkDrawing D.rad.G W₁).U := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact hpm t + · intro hx + obtain ⟨t, ht⟩ := f₁.surjective ⟨x, hx⟩ + exact ⟨t, congrArg Subtype.val ht⟩ + have hrq : range q = (walkDrawing D.rad.G W₂).U := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact hqm t + · intro hx + obtain ⟨t, ht⟩ := f₂.surjective ⟨x, hU₂.symm ▸ hx⟩ + exact ⟨t, congrArg Subtype.val ht⟩ + have haZ := hYZ ha + have hbZ := hYZ hb + have hzp : ∀ t, p t ∈ Z := fun t ↦ hz (hCU ▸ Or.inl (hpm t)) + have hzq : ∀ t, q.symm t ∈ Z := fun t ↦ hz (hCU ▸ Or.inr (hqm _)) + let P' : Path (⟨a, haZ⟩ : Z) ⟨b, hbZ⟩ := pathCod p haZ hbZ hzp + let Q' : Path (⟨b, hbZ⟩ : Z) ⟨a, haZ⟩ := pathCod q.symm hbZ haZ hzq + obtain ⟨y₁, hy₁, ho₁⟩ := h₁ haZ hbZ P' hpm + obtain ⟨y₂, hy₂, ho₂⟩ := h₂ hbZ haZ Q' fun t ↦ hqm _ + have hval : ∀ t, ((P'.trans Q') t).1 = (p.trans q.symm) t := fun t ↦ by + rw [Path.trans_apply, Path.trans_apply] + split_ifs <;> rfl + have hnull : (P'.trans Q').Homotopic (Path.refl _) := + (ho₁.hcomp ho₂).trans (homotopic_of_mem hYs hYZ _ _ ha ha (fun t ↦ by + rw [Path.trans_apply] + split_ifs + · exact hy₁ _ + · exact hy₂ _) fun _ ↦ ha) + refine null_oArc_of_loop (P'.trans Q') ?_ (fun s t hst ↦ ?_) hnull + · have : (fun t ↦ ((P'.trans Q') t).1) = ⇑(p.trans q.symm) := funext hval + rw [this, Path.trans_range, hrp, Path.symm_range, hrq, hCU] + · rw [hval, hval] at hst + refine loop_trans_injective p q hpi hqi (fun s t he ↦ ?_) s t hst + have hin := U_inter_of_disjoint (walkDrawing_isSubdrawing D.rad.G W₁) + (walkDrawing_isSubdrawing D.rad.G W₂) + (disjoint_left.mpr fun e h₁' h₂' ↦ hs.edge e (by rwa [walkDrawing_E] at h₁') + (by rwa [walkDrawing_E] at h₂')) + have hm : p s ∈ (walkDrawing D.rad.G W₁).V ∩ (walkDrawing D.rad.G W₂).V := by + rw [← hin] + exact ⟨hpm s, he ▸ hqm t⟩ + rw [walkDrawing_V, walkDrawing_V] at hm + rcases hs.meet _ hm.1 hm.2 with h' | h' + · left + exact ⟨hpi (h'.trans p.source.symm), hqi ((he.symm.trans h').trans q.source.symm)⟩ + · right + exact ⟨hpi (h'.trans p.target.symm), hqi ((he.symm.trans h').trans q.target.symm)⟩ + +omit [T2Space S] [T2Space Shat] in +/-- An arc of `F` with ends `a`, `b` is one of the two pieces of `F` between `a` and `b`. -/ +theorem eq_side_of_walk {a b : Shat} {P : GraphWalk D.rad.G.toGraph a b} (hne : a ≠ b) + (hsim : P.IsSimple) (hinF : ∀ e ∈ P.edges, e ∈ F.E) + {W₁ : GraphWalk D.rad.G.toGraph a b} {W₂ : GraphWalk D.rad.G.toGraph b a} + (hs : Splits F W₁ W₂) : P = W₁ ∨ P = W₂.reverse := by + have key : (∀ e ∈ P.edges, e ∈ W₁.edges) ∨ (∀ e ∈ P.edges, e ∈ W₂.edges) := by + cases P with + | nil _ => exact absurd rfl hne + | @cons _ y _ e hl r => + have hnd : (GraphWalk.cons hl r).support.Nodup := hsim + simp only [GraphWalk.support_cons, List.nodup_cons] at hnd + have hE : ∀ f ∈ r.edges, f ∈ W₁.edges ∨ f ∈ W₂.edges := fun f hf ↦ (hs.E f).mp (hinF f + (by simp [hf])) + have he := (hs.E e).mp (hinF e (by simp)) + have hmeet : ∀ x ∈ r.support, x ∈ W₁.support → x ∈ W₂.support → x = b := fun x hx h₁ h₂ ↦ + (hs.meet x h₁ h₂).resolve_left fun h' ↦ hnd.1 (h' ▸ hx) + rcases he with he | he + · left + have := walk_stays r hnd.2 W₁ W₂ hE hmeet (W₁.left_mem_support_of_mem_edges he hl.symm) + (fun {f x z} hl' hf _ ↦ W₁.left_mem_support_of_mem_edges hf hl'.symm) + (fun {f x z} hl' hf ↦ W₂.left_mem_support_of_mem_edges hf hl') + intro f hf + rcases List.mem_cons.mp hf with rfl | hf + · exact he + · exact this f hf + · right + have := walk_stays r hnd.2 W₂ W₁ (fun f hf ↦ (hE f hf).symm) (fun x hx h₁ h₂ ↦ hmeet x hx + h₂ h₁) + (W₂.left_mem_support_of_mem_edges he hl.symm) + (fun {f x z} hl' hf _ ↦ W₂.left_mem_support_of_mem_edges hf hl'.symm) + (fun {f x z} hl' hf ↦ W₁.left_mem_support_of_mem_edges hf hl') + intro f hf + rcases List.mem_cons.mp hf with rfl | hf + · exact he + · exact this f hf + rcases key with h | h + · exact .inl (simple_walk_unique W₁ P hs.s₁ hsim h).symm + · refine .inr (simple_walk_unique W₂.reverse P hs.s₂.reverse hsim fun e he ↦ ?_).symm + rw [GraphWalk.edges_reverse, List.mem_reverse] + exact h e he + +omit [T2Space S] [T2Space Shat] in +theorem exists_side_of_walk {a b : Shat} {P : GraphWalk D.rad.G.toGraph a b} (hne : a ≠ b) + (hsim : P.IsSimple) (hinF : ∀ e ∈ P.edges, e ∈ F.E) + {W₁ : GraphWalk D.rad.G.toGraph a b} {W₂ : GraphWalk D.rad.G.toGraph b a} + (hs : Splits F W₁ W₂) : + ∃ R : GraphWalk D.rad.G.toGraph b a, Splits F P R := by + rcases eq_side_of_walk hne hsim hinF hs with rfl | rfl + · exact ⟨W₂, hs⟩ + · exact ⟨W₁.reverse, hs.rev⟩ + +omit [T2Space S] in +/-- **The two outer arcs of (13.6).** -/ +theorem exists_two_arcs (hDv : Dv.IsCircuitOf D.rad.G) (hF : F.IsCircuitOf D.rad.G) + (hC : C.IsCircuitOf D.rad.G) {Δ₀ Δc Δf Δv : Set Shat} {h : Shat} + (h₀ : IsClosedDisc Δ₀) (hΔc : IsClosedDisc Δc) (hc₀ : Δc ⊆ Δ₀) (hbc : discBd Δc = C.U) + (hhc : h ∈ Δc) (hhC : h ∉ C.U) + (hΔf : IsClosedDisc Δf) (hf₀ : Δf ⊆ Δ₀) (hbf : discBd Δf = F.U) (hhf : h ∉ Δf) + (hΔv : IsClosedDisc Δv) (hv₀ : Δv ⊆ Δ₀) (hbv : discBd Δv = Dv.U) (hhv : h ∈ Δv → h ∈ Dv.U) + (hCE : ∀ e ∈ C.E, e ∈ F.E ∨ e ∈ Dv.E) : + ∃ (a₀ b₀ a₁ b₁ : Shat) (P₀ : GraphWalk D.rad.G.toGraph a₀ b₀) (P₁ : GraphWalk D.rad.G.toGraph + a₁ b₁), + IsArcOn D.rad.G Dv F P₀ ∧ IsArcOn D.rad.G Dv F P₁ ∧ ¬ PushesInto (Δ₀ \ {h}) (Δv \ {h}) + (walkDrawing D.rad.G P₀).U a₀ b₀ ∧ + ¬ PushesInto (Δ₀ \ {h}) (Δv \ {h}) (walkDrawing D.rad.G P₁).U a₁ b₁ + ∧ ∃ e ∈ P₀.edges, e ∉ P₁.edges := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hsurf := Surface.IsClosedSurface.isSurface hT + set G := D.rad.G with hG + set Z := Δ₀ \ {h} with hZ + set Y := Δv \ {h} with hYd + have hYs : IsSimplyConnectedSet Y := by + by_cases hm : h ∈ Δv + · exact isSimplyConnectedSet_disc_diff hΔv (hbv ▸ hhv hm) + · rw [hYd, sdiff_singleton_eq_self hm] + exact hΔv.isSimplyConnectedSet + have hYZ : Y ⊆ Z := fun x hx ↦ ⟨hv₀ hx.1, hx.2⟩ + have hDY : ∀ x ∈ Dv.U, x ∈ Z → x ∈ Y := fun x hx hxZ ↦ ⟨by + rw [← hbv] at hx + exact Surface.discBd_subset _ hx, hxZ.2⟩ + have hFΔ : F.U ⊆ Δf := by + rw [← hbf] + exact Surface.discBd_subset _ + have hCΔ : C.U ⊆ Δc := by + rw [← hbc] + exact Surface.discBd_subset _ + have hCZ : C.U ⊆ Z := fun x hx ↦ ⟨hc₀ (hCΔ hx), fun he ↦ hhC (he ▸ hx)⟩ + have hFZ : F.U ⊆ Z := fun x hx ↦ ⟨hf₀ (hFΔ hx), fun he ↦ hhf (he ▸ hFΔ hx)⟩ + -- the two vertices of `C` on `D_v` + have hCF : ∃ e ∈ C.E, e ∉ F.E := by + by_contra hn + push Not at hn + have hE := circuit_E_eq_of_subset hF.2 hC.2 hF.1 hC.1 hn + obtain rfl := circuit_eq_of_E hC.2 hF.2 hC.1 hF.1 hE + exact hhf ((disc_eq_of_subset_disc hT h₀ hΔc hΔf hc₀ hf₀ (hbc.trans hbf.symm)) ▸ hhc) + have hsubW : ∀ {a b : Shat} (W : GraphWalk G.toGraph a b), (∀ e ∈ W.edges, e ∈ C.E) → a ∈ C.V → + (walkDrawing G W).U ⊆ C.U := by + intro a b W hE ha x hx + rw [mem_walkDrawing_U] at hx + rcases hx with hx | ⟨e, he, hxe⟩ + · exact C.V_subset_U (support_subset_of_edges hC.1 W ha hE x hx) + · exact C.closure_subset_U (hE e he) hxe + obtain ⟨a₀, b₀, P₀, hP₀, hP₀C, hP₀n⟩ : ∃ (a₀ b₀ : Shat) (P₀ : GraphWalk G.toGraph a₀ b₀), IsArcOn + G Dv F P₀ ∧ (∀ e ∈ P₀.edges, e ∈ C.E) ∧ + ¬ PushesInto Z Y (walkDrawing G P₀).U a₀ b₀ := by + by_contra hn + push Not at hn + obtain ⟨e, heC, heF⟩ := hCF + have heD := (hCE e heC).resolve_left heF + obtain ⟨x, y, hne, hxC, hyC, hcap⟩ : ∃ x y, x ≠ y ∧ x ∈ C.V ∧ y ∈ C.V ∧ closure e ∩ G.V + = {x, y} := by + obtain ⟨x, hx, y, hy, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 e (hC.1.2 heC) + have hl : G.toGraph.IsLink e x y := ⟨hC.1.2 heC, D.rad.isPreRadial.2.1 hx, hy.1, hcap⟩ + have := Drawing.IsLink.mem_V_of_sub hC.1 hl heC + exact ⟨x, y, fun h' ↦ hy.2 (h' ▸ hx), this.1, this.2, hcap⟩ + have hl : G.toGraph.IsLink e x y := by + have hx : x ∈ closure e ∩ G.V := by rw [hcap]; exact .inl rfl + have hy : y ∈ closure e ∩ G.V := by rw [hcap]; exact .inr rfl + exact ⟨hC.1.2 heC, hx.2, hy.2, hcap⟩ + have hxD := (Drawing.IsLink.mem_V_of_sub hDv.1 hl heD).1 + have hyD := (Drawing.IsLink.mem_V_of_sub hDv.1 hl heD).2 + obtain ⟨W₁, W₂, hs⟩ := exists_splits hC.2 hC.1 hxC hyC hne + have hin₁ : ∀ f ∈ W₁.edges, f ∈ C.E := fun f hf ↦ (hs.E f).mpr (.inl hf) + have hin₂ : ∀ f ∈ W₂.edges, f ∈ C.E := fun f hf ↦ (hs.E f).mpr (.inr hf) + have hswap : ∀ f ∈ C.E, f ∈ Dv.E ∨ f ∈ F.E := fun f hf ↦ (hCE f hf).symm + have hU₁ := hsubW W₁ hin₁ hxC + have hU₂ := hsubW W₂ hin₂ hyC + have hp₁ := walk_pushes (F := F) hDv.1 hDY _ W₁ rfl hs.s₁ hxD hyD (fun f hf ↦ hswap f + (hin₁ f hf)) (hU₁.trans hCZ) + fun u v M hM hMe ↦ hn u v M hM fun f hf ↦ hin₁ f (hMe f hf) + have hp₂ := walk_pushes (F := F) hDv.1 hDY _ W₂ rfl hs.s₂ hyD hxD (fun f hf ↦ hswap f + (hin₂ f hf)) (hU₂.trans hCZ) + fun u v M hM hMe ↦ hn u v M hM fun f hf ↦ hin₂ f (hMe f hf) + have hxY : x ∈ Y := hDY x (Dv.V_subset_U hxD) (hCZ (C.V_subset_U hxC)) + have hyY : y ∈ Y := hDY y (Dv.V_subset_U hyD) (hCZ (C.V_subset_U hyC)) + have hnull := split_null hYs hYZ hs hne hCZ hxY hyY hp₁ hp₂ + have hbd : Disjoint C.U (bd Shat) := disjoint_left.mpr fun x _ hx ↦ hx (hT.2.2 x) + obtain ⟨Δ', hΔ'Z, hΔ', hb'⟩ := (epstein Shat Z C.U hsurf inferInstance + (GM14.isOArc_of_isCircuit hC.2) hCZ hbd).1 hnull + have heq := disc_eq_of_subset_disc hT h₀ hΔ' hΔc (hΔ'Z.trans sdiff_subset) hc₀ + (hb'.trans hbc.symm) + exact (hΔ'Z (heq ▸ hhc)).2 rfl + by_contra hn + have hall : ∀ (u v : Shat) (M : GraphWalk G.toGraph u v), IsArcOn G Dv F M → ¬ PushesInto Z Y + (walkDrawing G M).U u v → + ∀ e ∈ P₀.edges, e ∈ M.edges := by + intro u v M hM hMn e he + by_contra hem + exact hn ⟨a₀, b₀, u, v, P₀, M, hP₀, hM, hP₀n, hMn, e, he, hem⟩ + obtain ⟨e₀, he₀⟩ : ∃ e, e ∈ P₀.edges := by + have hne := hP₀.ne + cases P₀ with + | nil _ => exact absurd rfl hne + | @cons _ y _ e hl r => exact ⟨e, by simp⟩ + have ha₀F : a₀ ∈ F.V := by + have hinF := hP₀.inF + have hne := hP₀.ne + cases P₀ with + | nil _ => exact absurd rfl hne + | @cons _ y _ e hl r => exact (Drawing.IsLink.mem_V_of_sub hF.1 hl (hinF e (by simp))).1 + have hb₀F : b₀ ∈ F.V := support_subset_of_edges hF.1 P₀ ha₀F hP₀.inF _ P₀.end_mem_support + obtain ⟨W₁, W₂, hs⟩ := exists_splits hF.2 hF.1 ha₀F hb₀F hP₀.ne + obtain ⟨R, hR⟩ := exists_side_of_walk hP₀.ne hP₀.simple hP₀.inF hs + have hRE : ∀ f ∈ R.edges, f ∈ F.E := fun f hf ↦ (hR.E f).mpr (.inr hf) + have hRU : (walkDrawing G R).U ⊆ F.U := by + intro x hx + rw [mem_walkDrawing_U] at hx + rcases hx with hx | ⟨e, he, hxe⟩ + · exact F.V_subset_U ((hR.V x).mpr (.inr hx)) + · exact F.closure_subset_U (hRE e he) hxe + have hPU : (walkDrawing G P₀).U ⊆ F.U := by + intro x hx + rw [mem_walkDrawing_U] at hx + rcases hx with hx | ⟨e, he, hxe⟩ + · exact F.V_subset_U ((hR.V x).mpr (.inl hx)) + · exact F.closure_subset_U (hP₀.inF e he) hxe + have hpR : PushesInto Z Y (walkDrawing G R).U b₀ a₀ := by + refine walk_pushes (F := F) hDv.1 hDY _ R rfl hR.s₂ hP₀.right hP₀.left (fun f hf ↦ .inr + (hRE f hf)) (hRU.trans hFZ) fun u v M hM hMe ↦ ?_ + by_contra hMn + exact hR.edge e₀ he₀ (hMe e₀ (hall u v M hM hMn e₀ he₀)) + apply hP₀n + intro ha' hb' p hp + obtain ⟨r₀, hr₀⟩ := exists_walk_path G R hR.s₂ + obtain ⟨r, hr⟩ := exists_path_in (hRU.trans hFZ) hr₀ hb' ha' + obtain ⟨y, hy, ho⟩ := hpR hb' ha' r fun t ↦ by rw [hr]; exact hr₀ t + have hΔfZ : Δf ⊆ Z := fun x hx ↦ ⟨hf₀ hx, fun he ↦ hhf (he ▸ hx)⟩ + have ha₀Δ : a₀ ∈ Δf := hFΔ (F.V_subset_U ha₀F) + have hb₀Δ : b₀ ∈ Δf := hFΔ (F.V_subset_U hb₀F) + refine ⟨y.symm, fun t ↦ hy _, ?_⟩ + refine Path.Homotopic.trans (homotopic_of_mem hΔf.isSimplyConnectedSet hΔfZ p r.symm ha₀Δ hb₀Δ + (fun t ↦ hFΔ (hPU (hp t))) fun t ↦ ?_) ho.symm₂ + rw [Path.symm_apply] + change (r _).1 ∈ Δf + rw [hr] + exact hFΔ (hRU (hr₀ _)) + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13k.lean b/LeanPool/GraphMinor/GM19/Section13k.lean new file mode 100644 index 0000000000..86b9614132 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13k.lean @@ -0,0 +1,319 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13j + +/-! +# Graph Minors XIX, Section 13: steps (1), (2), (3) of (13.6) + +The hypotheses of (13.6) are collected in `IsSectorEnclave`. Then come the steps of the proof that +speak about the hub: +the inside of `F` meets the inside of `H` only on their boundaries. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {Δv : Set + Shat} {Dv F : Drawing Shat} + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + +/-- The hypotheses of (13.6), with the standing assumptions of Section 13. `rep(𝒯) ≥ 6ρ + 14` is the +bound used in the paper's step (4). -/ +structure IsSectorEnclave (D : TangleDatum cap χ) (W : Set Shat) (H : Drawing Shat) (ρ : ℕ) + (r : Shat) (Δv : Set Shat) (Dv : Drawing Shat) + (ord' : ℕ) (𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) + (F : Drawing Shat) : Prop where + hopt : D.IsOptimalWheelHub W H ρ + hbdS : discBd W ⊆ cap.emb '' (univ \ bd S) + hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty + hrep : 6 * ρ + 14 ≤ D.rep + sector : D.IsBoundarySector W H r Δv Dv + mem : (partIn cap D.Γ (closure Δvᶜ), partIn cap D.Γ Δv) ∈ 𝒯' + enclave : IsEnclaveAround D.tb D.ord ord' D.𝒯 𝒯' F + +/-- The two forms of a sector: the spokes meet, and `D_v` is the circuit of their fan, or they do +not, and `D_v` runs along a path of `H`. -/ +theorem IsBoundarySector.cases (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) (hs : D.IsBoundarySector W H r Δv Dv) : + (∃ (v₁ v₂ u h : Shat) (f₁ f₂ : Set Shat) (A₁ : GraphWalk D.rad.G.toGraph v₁ u) + (A₂ : GraphWalk D.rad.G.toGraph v₂ u) + (T : GraphWalk D.rad.G.toGraph u h), D.IsFan W H ρ r f₁ f₂ A₁ A₂ T + ∧ D.IsFanCircuit r f₁ f₂ A₁ A₂ Dv ∧ + f₁ ⊆ discBd W ∧ f₂ ⊆ discBd W) ∨ + (∃ (v₁ v₂ h₁ h₂ : Shat) (f₁ f₂ : Set Shat) (K₁ : GraphWalk D.rad.G.toGraph v₁ h₁) + (K₂ : GraphWalk D.rad.G.toGraph v₂ h₂) (P : Drawing Shat), + v₁ ≠ v₂ ∧ D.rad.G.toGraph.IsLink f₁ r v₁ ∧ D.rad.G.toGraph.IsLink f₂ r v₂ ∧ f₁ ⊆ discBd W + ∧ f₂ ⊆ discBd W ∧ + D.IsSpokeWalk W H K₁ ∧ D.IsSpokeWalk W H K₂ ∧ (∀ x ∈ K₁.support, x ∉ K₂.support) + ∧ Drawing.IsPathOf P H h₁ h₂ ∧ + discBd Δv = (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ∪ P.U ∪ closure f₁ ∪ + closure f₂ ∧ ¬ (D.ins H ⊆ Δv)) := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨v₁, v₂, h₁, h₂, f₁, f₂, S₁, S₂, hne, hf₁, hf₁b, hf₁', hf₂, hf₂b, hf₂', hS₁, hS₂, hcase⟩ + := hs.sector_spec + obtain ⟨K₁, h1, rfl⟩ := hS₁.exists_walk + obtain ⟨K₂, h2, rfl⟩ := hS₂.exists_walk + have hv₁G : v₁ ∈ D.rad.G.V := K₁.mem_vertexSet_of_mem_support K₁.start_mem_support + have hv₂G : v₂ ∈ D.rad.G.V := K₂.mem_vertexSet_of_mem_support K₂.start_mem_support + have hl₁ : D.rad.G.toGraph.IsLink f₁ r v₁ := ⟨hf₁, hs.rstar_mem.1.1, hv₁G, by rw + [closure_inter_V_eq_tilde hf₁, hf₁']⟩ + have hl₂ : D.rad.G.toGraph.IsLink f₂ r v₂ := ⟨hf₂, hs.rstar_mem.1.1, hv₂G, by rw + [closure_inter_V_eq_tilde hf₂, hf₂']⟩ + rcases hcase with ⟨⟨x, hx₁, hx₂⟩, hbd⟩ | ⟨hdisj, P, hP, hbd, hnot⟩ + · left + rw [walkDrawing_V] at hx₁ hx₂ + obtain rfl := h1.same_end h2 hx₁ hx₂ + obtain ⟨u, A₁, A₂, T, rfl, rfl, -, hmeet⟩ := h1.merge h2 hx₁ hx₂ + have hfan : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T := + ⟨hW, hbdS, hin, hs.rstar_mem.1, hs.rstar_mem.2, hne, hl₁, hl₂, h1, h2, fun y h₁ h₂ ↦ hmeet y + h₁ + ((GraphWalk.mem_support_append A₂ T).mpr (.inl h₂))⟩ + obtain ⟨C, hC⟩ := hfan.exists_circuit + have heq : Dv = C := eq_of_U_eq hs.Dv_circuit.1 hC.circuit.1 (by rw [hs.Dv_U, hbd, + hfan.closure_formula hC]) + subst heq + exact ⟨v₁, v₂, u, _, f₁, f₂, A₁, A₂, T, hfan, hC, hf₁b, hf₂b⟩ + · right + refine ⟨v₁, v₂, h₁, h₂, f₁, f₂, K₁, K₂, P, hne, hl₁, hl₂, hf₁b, hf₂b, h1, h2, + fun x h₃ h₄ ↦ ?_, hP, hbd, hnot⟩ + rw [walkDrawing_V, walkDrawing_V] at hdisj + exact disjoint_left.mp hdisj h₃ h₄ + +omit [T2Space S] [T2Space Shat] in +/-- The inside of an enclave `H` that is a hub misses `bd(W)`. -/ +theorem IsWheelHubOfRadius.ins_off_bd (hW : D.IsWheelHubOfRadius W H ρ) + (hc : H.IsCircuitOf D.rad.G) (hle : H.E.ncard ≤ 4 * ρ + 4) : + Disjoint (D.ins H) (discBd W) := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hrep := hW.rep_ge + have hlt : H.E.ncard < 2 * D.rep := by omega + have hi := D.ins_spec hc hlt + have hsub := hW.ins_sub H hc hle (hW.H_in_int.trans sdiff_subset) + refine disjoint_left.mpr fun x hx hxb ↦ ?_ + by_cases hxU : x ∈ H.U + · exact (hW.H_in_int hxU).2 hxb + · have hxi : x ∈ discInt (D.ins H) := ⟨hx, fun hb ↦ hxU (hi.2.2.2.1 ▸ hb)⟩ + have hop := hi.2.2.1.isOpen_discInt hman + have hint : x ∈ interior W := mem_interior.mpr ⟨_, (discInt_subset _).trans hsub, hop, hxi⟩ + have hf : x ∈ frontier W := by + rw [IsClosedDisc.frontier_eq_discBd hT hW.is_disc] + exact hxb + exact hf.2 hint + +/-- A spoke is outside the inside of an enclave `H` that is the hub. -/ +theorem IsSpokeWalk.off_ins_hub (hW : D.IsWheelHubOfRadius W H ρ) (hH : IsEnclave D.tb D.ord D.𝒯 H) + (hle : H.E.ncard ≤ 4 * ρ + 4) {v h : Shat} + {K : GraphWalk D.rad.G.toGraph v h} (hK : D.IsSpokeWalk W H K) : Disjoint + (walkDrawing D.rad.G K).U (discInt (D.ins H)) := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨-, -, -, hc, hlt, -⟩ := id hH + have hrep := hW.rep_ge + have hlt' : H.E.ncard < 2 * D.rep := by omega + have hi := D.ins_spec hc hlt' + refine disjoint_left.mpr fun x hx hxi ↦ ?_ + have h₂ := (theorem_13_3_proof hK.2 hH).2 fun hsub ↦ hxi.2 (hi.2.2.2.1 ▸ hsub ⟨hx, hxi.1⟩) + rcases h₂ with h₃ | h₃ + · exact disjoint_left.mp (hW.ins_off_bd hc hle) h₃.1 hK.2.v_mem.2 + · exact h₃.2 (H.V_subset_U hK.2.h_mem) + +/-- The inside of the hub and the inside of the sector have no common point. -/ +theorem IsBoundarySector.interior_off_hub (hopt : D.IsOptimalWheelHub W H ρ) + (hbdS : discBd W ⊆ cap.emb '' (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) (hs : D.IsBoundarySector W H r Δv Dv) + (hH : IsEnclave D.tb D.ord D.𝒯 H) + (hle : H.E.ncard ≤ 4 * ρ + 4) : Disjoint (discInt (D.ins H)) (discInt Δv) := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hW := hopt.toIsWheelHubOfRadius + obtain ⟨-, -, -, hc, hlt, -⟩ := id hH + have hrep := hW.rep_ge + have hlt' : H.E.ncard < 2 * D.rep := by omega + have hi := D.ins_spec hc hlt' + have hbdΔ : discBd Δv = Dv.U := hs.Dv_U.symm + have hO := isSide_int hT hs.is_disc hbdΔ + have hcfr : ∀ {f : Set Shat}, f ⊆ discBd W → Disjoint (closure f) (discInt (D.ins H)) + := fun hf ↦ by + have hcl : IsClosed (discBd W) := by + rw [← IsClosedDisc.frontier_eq_discBd hT hW.is_disc] + exact isClosed_frontier + exact (disjoint_of_subset_left (closure_minimal hf hcl) (hW.ins_off_bd hc hle).symm).mono_right + (discInt_subset _) + have hHU : H.U ⊆ D.ins H := by + rw [← hi.2.2.2.1] + exact Surface.discBd_subset _ + have hUoff : H.U ⊆ (discInt (D.ins H))ᶜ := fun x hx hxi ↦ hxi.2 (hi.2.2.2.1 ▸ hx) + have hkey : (∀ {x}, x ∈ Dv.U → x ∉ discInt (D.ins H)) → (discInt (D.ins H) ∩ discInt Δv).Nonempty + → D.ins H ⊆ Δv := by + intro hd hne + have := hO.subset hi.2.2.1.isPreconnected_discInt (disjoint_left.mpr fun x hx hxU ↦ hd hxU hx) + hne + exact hi.2.2.1.subset_closure_discInt.trans (closure_minimal (this.trans + (discInt_subset _)) hs.is_disc.isClosed) + rw [disjoint_iff_inter_eq_empty, ← not_nonempty_iff_eq_empty] + intro hne + rcases hs.cases hW hbdS hin with ⟨v₁, v₂, u, h, f₁, f₂, A₁, A₂, T, hf, hC, hb₁, hb₂⟩ | ⟨v₁, v₂, + h₁, h₂, f₁, f₂, K₁, K₂, P, -, -, -, hb₁, hb₂, h1, h2, -, hP, hbd, hnot⟩ + · have hsub := hkey (fun {x} hx hxi ↦ by + rw [hf.U_eq hC] at hx + have hsp : ∀ {y} {A : GraphWalk D.rad.G.toGraph y u}, D.IsSpokeWalk W H (A.append T) → x ∈ + (walkDrawing D.rad.G A).U → False := fun hA hxA ↦ by + refine disjoint_left.mp (IsSpokeWalk.off_ins_hub hW hH hle hA) ?_ hxi + rw [U_append] + exact .inl hxA + rcases hx with ((hx | hx) | hx) | hx + · exact hsp hf.spoke₁ hx + · exact hsp hf.spoke₂ hx + · exact disjoint_left.mp (hcfr hb₁) hx hxi + · exact disjoint_left.mp (hcfr hb₂) hx hxi) hne + have hmain := (hf.main hC hopt hs.is_disc hs.Δv_sub hbdΔ).1 + have hV : H.V = {u} := by + have hall : ∀ z ∈ H.V, z = u := fun z hz ↦ hmain z ⟨hsub (hHU (H.V_subset_U hz)), + H.V_subset_U hz⟩ + obtain ⟨u', W', -, -, hVe, -⟩ := hc.2 + have hu' : u' ∈ H.V := by + rw [hVe] + exact W'.start_mem_support + obtain rfl := hall u' hu' + exact Subset.antisymm (fun z hz ↦ hall z hz) (singleton_subset_iff.mpr hu') + have := IsCircuit.two_vertices D hc + rw [hV, ncard_singleton] at this + exact this rfl + · refine hnot (hkey (fun {x} hx hxi ↦ ?_) hne) + rw [← hbdΔ, hbd] at hx + rcases hx with (((hx | hx) | hx) | hx) | hx + · exact disjoint_left.mp (IsSpokeWalk.off_ins_hub hW hH hle h1) hx hxi + · exact disjoint_left.mp (IsSpokeWalk.off_ins_hub hW hH hle h2) hx hxi + · exact hUoff (hP.1.U_subset hx) hxi + · exact disjoint_left.mp (hcfr hb₁) hx hxi + · exact disjoint_left.mp (hcfr hb₂) hx hxi + +namespace IsSectorEnclave + +variable (hx : D.IsSectorEnclave W H ρ r Δv Dv ord' 𝒯' F) +include hx + +omit [T2Space S] in +omit [T2Space Shat] in +theorem wheel : D.IsWheelHubOfRadius W H ρ := hx.hopt.toIsWheelHubOfRadius + +theorem Dv_card : Dv.E.ncard ≤ 4 * ρ + 4 := (theorem_13_5_proof hx.wheel hx.hbdS hx.hin hx.sector).1 + +theorem ins_Dv : D.ins Dv = Δv := (theorem_13_5_proof hx.wheel hx.hbdS hx.hin hx.sector).2 + +theorem isInsOf_Dv : IsInsOf D.rad D.ord D.𝒯 Dv Δv := by + have h := D.ins_spec hx.sector.Dv_circuit (by have := hx.Dv_card; have := hx.hrep; omega) + rwa [hx.ins_Dv] at h + +omit [T2Space S] in +omit [T2Space Shat] in +theorem isTangle' : IsTangle D.Γ.toHypergraph ord' 𝒯' := hx.enclave.1 + +omit [T2Space S] in +theorem isInsOf_F : IsInsOf D.rad D.ord D.𝒯 F (D.ins F) := by + obtain ⟨-, hc, hlt, Δ, hins, -⟩ := hx.enclave + rw [← D.eq_ins_of_isInsOf hins] + exact hins + +omit [T2Space S] in +theorem distinction : IsDistinction D.tb.lambdaOrder D.𝒯 𝒯' (partIn cap D.Γ (D.ins F)) + (partIn cap D.Γ (closure (D.ins F)ᶜ)) := by + obtain ⟨-, hc, hlt, Δ, hins, hd⟩ := hx.enclave + rw [← D.eq_ins_of_isInsOf hins] + exact hd + +/-- Step (1) of the proof of (13.6). -/ +theorem F_card : F.E.ncard ≤ Dv.E.ncard ∧ Dv.E.ncard ≤ 4 * ρ + 4 := + ⟨enclave_card_le χ.isSurface D.P.fits.internally_three_connected D.tb hx.isInsOf_F hx.distinction + hx.isInsOf_Dv hx.mem, hx.Dv_card⟩ + +omit [T2Space S] in +omit [T2Space Shat] in +theorem isEnclave : IsEnclave D.tb D.ord D.𝒯 F := ⟨ord', 𝒯', hx.enclave⟩ + +/-- Step (2) of the proof of (13.6). -/ +theorem exists_edge : ∃ c ∈ D.Γ.E, cap.emb '' c ⊆ discInt (D.ins F) ∧ cap.emb '' c ⊆ discInt Δv := + exists_edge_in_both χ.isSurface D.P.fits.internally_three_connected hx.isTangle' hx.isInsOf_F + hx.distinction.1.2 hx.isInsOf_Dv hx.mem + +/-- Step (3) of the proof of (13.6), when `H` has one vertex. -/ +theorem hub_point (hc : H.V.ncard = 1) {h : Shat} (hh : h ∈ H.V) (hm : h ∈ D.ins F) : h ∈ F.U := by + have : ConnectedSpace Shat := cap.connected + by_contra hn + obtain ⟨z, hz⟩ := ncard_eq_one.mp hc + rcases hx.wheel.hub_cond with ⟨-, -, hcond⟩ | ⟨hen, -, -⟩ + · refine hcond F hx.isEnclave (hx.F_card.1.trans hx.F_card.2) fun y hy ↦ ?_ + rw [hz] at hy hh + rw [mem_singleton_iff.mp hy, ← mem_singleton_iff.mp hh] + exact ⟨hm, hn⟩ + · obtain ⟨-, -, -, hcir, -⟩ := id hen + have := IsCircuit.two_vertices D hcir + exact this hc + +/-- Step (3) of the proof of (13.6), when `H` is a circuit. -/ +theorem hub_circuit (hH : IsEnclave D.tb D.ord D.𝒯 H) : D.ins F ∩ D.ins H = F.U ∩ H.U := by + have : ConnectedSpace Shat := cap.connected + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + have hW := hx.wheel + have hrep := hx.hrep + have hFle := hx.F_card + have hHle : H.E.ncard ≤ 4 * ρ + 4 ∧ ∀ H' : Drawing Shat, IsEnclave D.tb D.ord D.𝒯 H' → H' ≠ H + → H'.E.ncard ≤ 4 * ρ + 4 → ¬ (H.U ⊆ D.ins H') := by + rcases hW.hub_cond with ⟨hc, -, -⟩ | ⟨-, h₂, h₃⟩ + · obtain ⟨-, -, -, hcir, -⟩ := id hH + exact absurd hc (IsCircuit.two_vertices D hcir) + · exact ⟨h₂, h₃⟩ + obtain ⟨hle, hcond⟩ := hHle + obtain ⟨ord₂, 𝒯₂, h𝒯₂, hcir, hlt, Δ, hins, hd⟩ := id hH + obtain rfl : Δ = D.ins H := D.eq_ins_of_isInsOf hins + have hlt' : H.E.ncard < 2 * D.rep := by omega + have hdis := hx.sector.interior_off_hub hx.hopt hx.hbdS hx.hin hH hle + have hnest : ¬ D.ins F ⊆ D.ins H := by + intro hsub + obtain ⟨c, hc, hc₁, hc₂⟩ := hx.exists_edge + obtain ⟨y, hy⟩ := hc.1 + have hyi₁ := hc₁ (mem_image_of_mem _ hy) + have hyi₂ := hc₂ (mem_image_of_mem _ hy) + have hFc := hx.isInsOf_F + have h₁ : cap.emb y ∈ interior (D.ins F) := (ins_diff_iff D hFc.1 hFc.2.1).mp ⟨hyi₁.1, fun hu ↦ + hyi₁.2 (hFc.2.2.2.1 ▸ hu)⟩ + have h₂ := (ins_diff_iff D hcir hlt').mpr (interior_mono hsub h₁) + exact disjoint_left.mp hdis ⟨h₂.1, fun hb ↦ h₂.2 (hins.2.2.2.1 ▸ hb)⟩ hyi₂ + rcases theorem_8_6_proof hS h3 D.tb D.isTangle hx.isTangle' h𝒯₂ hx.isInsOf_F hins hx.distinction + hd with h | h | h + · exact absurd h hnest + · by_cases heq : F = H + · subst heq + exact absurd subset_rfl hnest + · have hU : H.U ⊆ D.ins H := by + rw [← hins.2.2.2.1] + exact Surface.discBd_subset _ + exact absurd (hU.trans h) (hcond F hx.isEnclave heq (hFle.1.trans hFle.2)) + · exact h + +end IsSectorEnclave + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13l.lean b/LeanPool/GraphMinor/GM19/Section13l.lean new file mode 100644 index 0000000000..de985764f0 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13l.lean @@ -0,0 +1,481 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13k + +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Graph Minors XIX, Section 13: step (4) of (13.6) + +We find a closed disc `Δ₀` that holds `ins(F)`, `bd(W)`, the hub and the spokes, and that is closed +under taking the inside of a short +circuit. If `ins(F) ⊆ W` this is `W`. Otherwise `F` has a vertex `z*` on `bd(W)`, and all these +things are close to `z*` in the metric of +`𝒯`, so (7.1) gives `Δ₀`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {Δv : Set + Shat} {Dv F : Drawing Shat} + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + +/-- A vertex of a spoke other than its first one is not on `bd(W)`. For a vertex of `Γ` this is the +bound on the distance from `bd(W)` to +`H`, and for a region it is (13.1). -/ +theorem IsSpokeWalk.tail_off_bd (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) {v h y : Shat} {K : GraphWalk + D.rad.G.toGraph v h} (hK : D.IsSpokeWalk W H K) + (hy : y ∈ K.support) (hne : y ≠ v) : y ∉ discBd W := by + intro hyb + have : ConnectedSpace Shat := cap.connected + have hl := (hW.spoke_length hK).1 + have hh := hK.2.h_mem + obtain ⟨A, B, rfl⟩ := K.exists_append_of_mem hy + rw [GraphWalk.length_append] at hl + have hA : 1 ≤ A.length := by + by_contra hn + cases A with + | nil _ => exact hne rfl + | cons _ _ => simp at hn + by_cases hyh : y ∈ D.P.Γ.hatV cap + · have h₂ := two_le_of_hatV D A hK.2.v_mem.1 hyh hne.symm + have h₃ := hW.walk_ge ⟨hyh, hyb⟩ hh B + omega + · have hyG : y ∈ D.rad.G.V := A.mem_vertexSet_of_mem_support A.end_mem_support + obtain ⟨P, hP, hle⟩ := exists_path_of_walk B + exact theorem_13_1_proof hW hbdS hin ⟨hyG, hyh⟩ hyb ⟨P, h, hh, hP, by omega⟩ + +/-- A spoke lies in `W`: we go along it from the hub, and an edge at a point inside `W` lies in `W`. +-/ +theorem IsSpokeWalk.subset_W (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) {v h : Shat} {K : GraphWalk + D.rad.G.toGraph v h} (hK : D.IsSpokeWalk W H K) : + (walkDrawing D.rad.G K).U ⊆ W := by + have key : ∀ {a b : Shat} (L : GraphWalk D.rad.G.toGraph a b), L.IsSimple → + (∀ y ∈ L.support, y ≠ a → y ∉ discBd W) → b ∈ W → + (walkDrawing D.rad.G L).U ⊆ W := by + intro a b L + induction L with + | nil h' => + intro _ _ hb x hx + rw [mem_walkDrawing_U] at hx + rcases hx with hx | ⟨e, he, -⟩ + · obtain rfl : x = _ := by simpa using hx + exact hb + · simp at he + | @cons a y b e hl L ih => + intro hs hoff hb + have hnd : (GraphWalk.cons hl L).support.Nodup := hs + simp only [GraphWalk.support_cons, List.nodup_cons] at hnd + have hU := ih hnd.2 (fun z hz hne ↦ hoff z (by simp [hz]) fun h' ↦ hnd.1 (h' ▸ hz)) hb + have hyU : y ∈ (walkDrawing D.rad.G L).U := by + rw [mem_walkDrawing_U] + exact .inl L.start_mem_support + have hyW := hU hyU + have hya : y ≠ a := fun h' ↦ hnd.1 (h' ▸ L.start_mem_support) + have hyb := hoff y (by simp [L.start_mem_support]) hya + have hyc : y ∈ closure e := by + have : y ∈ closure e ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact .inr rfl + exact this.1 + have hsub : closure e ⊆ W := by + rcases hW.edge_side hl.1 with h₁ | h₁ + · exact closure_minimal h₁ hW.is_disc.isClosed + · exact absurd (hW.mem_bd_of_closure h₁ hyc hyW) hyb + intro x hx + rw [mem_walkDrawing_U] at hx + rcases hx with hx | ⟨f, hf, hxf⟩ + · rcases List.mem_cons.mp hx with rfl | hx + · exact hsub (by + have : x ∈ closure e ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact .inl rfl + exact this.1) + · exact hU ((mem_walkDrawing_U _ _).mpr (.inl hx)) + · rcases List.mem_cons.mp hf with rfl | hf + · exact hsub hxf + · exact hU ((mem_walkDrawing_U _ _).mpr (.inr ⟨f, hf, hxf⟩)) + exact key K hK.1 (fun y hy hne ↦ hK.tail_off_bd hW hbdS hin hy hne) ((hW.H_in_int + (H.V_subset_U hK.2.h_mem)).1) + +/-- A walk that stays close to `z` in the metric of `𝒯` lies in the set `Λ` that holds the atoms +close to `z`. -/ +theorem walk_subset_of_dist {z Λ : Set Shat} {n : ℕ} (hrep : 4 ≤ D.rep) + (hclose : ∀ a ∈ D.P.Γ.atoms cap, D.dist z a ≤ n → a ⊆ Λ) + {a b : Shat} (K : GraphWalk D.rad.G.toGraph a b) (ha : a ∈ D.rad.G.V) (hd : D.dist z + (D.rad.atomOf a) + K.length ≤ n) : + (walkDrawing D.rad.G K).U ⊆ Λ := by + induction K with + | nil h' => + intro x hx + rw [mem_walkDrawing_U] at hx + rcases hx with hx | ⟨e, he, -⟩ + · obtain rfl : x = _ := by simpa using hx + exact hclose _ (D.atomOf_mem ha) (by simpa using hd) (D.mem_atomOf ha) + · simp at he + | @cons a y b e hl L ih => + rw [GraphWalk.length_cons] at hd + have hyG : y ∈ D.rad.G.V := hl.2.2.1 + have h₁ : D.dist (D.rad.atomOf a) (D.rad.atomOf y) ≤ 1 := D.dist_atomOf_le_of_walk (.cons hl + (.nil hyG)) (by + rw [GraphWalk.length_cons] + change 0 + 1 < D.rep + omega) + have h₂ := D.dist_triangle hrep (a := z) (c := D.rad.atomOf y) (D.atomOf_mem ha) + have hU := ih hyG (by omega) + have haΛ := hclose _ (D.atomOf_mem ha) (by omega) (D.mem_atomOf ha) + have hyΛ := hclose _ (D.atomOf_mem hyG) (by omega) (D.mem_atomOf hyG) + have hsub : closure e ⊆ Λ := by + intro x hx + obtain ⟨p, hp, q, hq, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 e hl.1 + have hpm : p ∈ closure e ∩ D.rad.G.V := by + rw [hcap] + exact .inl rfl + have hqm : q ∈ closure e ∩ D.rad.G.V := by + rw [hcap] + exact .inr rfl + have hqa : q = a ∨ q = y := by + have : q ∈ ({a, y} : Set Shat) := by + rw [← hl.2.2.2] + exact hqm + exact this + rcases closure_edge_subset hl.1 hx with hxe | hxV + · have hsub := edge_subset_regionOf D hq hl.1 hqm.1 hxe + rw [← atomOf_Rstar D hq] at hsub + rcases hqa with rfl | rfl + · exact hclose _ (D.atomOf_mem ha) (by omega) hsub + · exact hclose _ (D.atomOf_mem hyG) (by omega) hsub + · have : x ∈ ({a, y} : Set Shat) := by + rw [← hl.2.2.2] + exact ⟨hx, hxV⟩ + rcases this with rfl | rfl + · exact haΛ + · exact hyΛ + intro x hx + rw [mem_walkDrawing_U] at hx + rcases hx with hx | ⟨f, hf, hxf⟩ + · rcases List.mem_cons.mp hx with rfl | hx + · exact haΛ + · exact hU ((mem_walkDrawing_U _ _).mpr (.inl hx)) + · rcases List.mem_cons.mp hf with rfl | hf + · exact hsub hxf + · exact hU ((mem_walkDrawing_U _ _).mpr (.inr ⟨f, hf, hxf⟩)) + +/-- Two vertices of a circuit are joined by a walk along the circuit of at most half its length. -/ +theorem exists_short_walk {G F : Drawing Shat} (hF : F.IsCircuitOf G) {a b : Shat} (ha : a ∈ F.V) + (hb : b ∈ F.V) : + ∃ T : GraphWalk G.toGraph a b, 2 * T.length ≤ F.E.ncard ∧ ∀ e ∈ T.edges, e ∈ F.E := by + by_cases hab : a = b + · subst hab + refine ⟨.nil (hF.1.1 ha), ?_, fun e he ↦ ?_⟩ + · change 2 * 0 ≤ _ + omega + · cases he + · obtain ⟨W₁, W₂, hs⟩ := exists_splits hF.2 hF.1 ha hb hab + have hc := hs.card_add + have h₁ : (edgeSet W₁).ncard = W₁.length := by + rw [← ncard_walk_E G hs.s₁, walkDrawing_E] + rfl + have h₂ : (edgeSet W₂).ncard = W₂.length := by + rw [← ncard_walk_E G hs.s₂, walkDrawing_E] + rfl + have h₃ : F.length = F.E.ncard := rfl + by_cases hle : W₁.length ≤ W₂.length + · exact ⟨W₁, by omega, fun e he ↦ (hs.E e).mpr (.inl he)⟩ + · refine ⟨W₂.reverse, ?_, fun e he ↦ (hs.E e).mpr (.inr ?_)⟩ + · rw [GraphWalk.length_reverse] + omega + · rw [GraphWalk.edges_reverse, List.mem_reverse] at he + exact he + +theorem U_reverse (G : Drawing Shat) {a b : Shat} (K : GraphWalk G.toGraph a b) : + (walkDrawing G K.reverse).U = (walkDrawing G K).U := by + ext x + simp only [mem_walkDrawing_U, GraphWalk.support_reverse, GraphWalk.edges_reverse, + List.mem_reverse] + +/-- `Δ₀` as in step (4) of the proof of (13.6). The paper also has `W ⊆ Δ₀`. For that it needs that +the discs `ins(D_{v'})` and `ins(H)` +fill `W`, and it uses `W ⊆ Δ₀` only to get `Δ ⊆ W` in step (6). There we use the wheel condition on +short circuits instead. -/ +structure IsAmbientDisc (D : TangleDatum cap χ) (W : Set Shat) (H : Drawing Shat) (ρ : ℕ) + (F : Drawing Shat) (Δ₀ : Set Shat) : Prop where + disc : IsClosedDisc Δ₀ + ins_F : D.ins F ⊆ Δ₀ + bd_W : discBd W ⊆ Δ₀ + hub : H.U ⊆ Δ₀ + spoke : ∀ (v h : Shat) (K : GraphWalk D.rad.G.toGraph v h), D.IsSpokeWalk W H K → + (walkDrawing D.rad.G K).U ⊆ Δ₀ + short : ∀ C : Drawing Shat, C.IsCircuitOf D.rad.G → C.E.ncard ≤ 4 * ρ + 4 → C.U ⊆ Δ₀ + → D.ins C ⊆ Δ₀ + +/-- The second case of the paper's proof of step (4): `F` has a vertex `z*` on `bd(W)`. -/ +theorem IsAmbientDisc.of_vertex (hW : D.IsWheelHubOfRadius W H ρ) (hrep : 6 * ρ + 14 ≤ D.rep) + (hF : F.IsCircuitOf D.rad.G) (hFc : F.E.ncard ≤ 4 * ρ + 4) (hHc : H.V.ncard = 1 ∨ + (H.IsCircuitOf D.rad.G ∧ H.E.ncard ≤ 4 * ρ + 4)) + {zs : Shat} (hzF : zs ∈ F.V) (hzb : zs ∈ discBd W) : ∃ Δ₀, D.IsAmbientDisc W H ρ F Δ₀ := by + classical + have hS := χ.isSurface + have hρ := hW.pos_ρ + have hr4 : 4 ≤ D.rep := by omega + have hzG : zs ∈ D.rad.G.V := hF.1.1 hzF + obtain ⟨Sk, hSk⟩ := exists_isSkHat hS cap D.P.Γ + obtain ⟨C₀, Λ, -, -, -, hΛc, hsb, hdiff, -, -, -, hclose, hins⟩ := + theorem_7_1_proof D (D.atomOf_mem hzG) (κ := 4 * ρ + 6) (by omega) (by omega) hSk + set z := D.rad.atomOf zs with hz + have hclose' : ∀ a ∈ D.P.Γ.atoms cap, D.dist z a ≤ 4 * ρ + 4 → a ⊆ Λ := fun a ha hd ↦ hclose a ha + (by omega) + have hsubcl : Λ ⊆ closure Λ := subset_closure + have hK := fun {a b : Shat} (K : GraphWalk D.rad.G.toGraph a b) (ha : a ∈ D.rad.G.V) + (hd : D.dist z (D.rad.atomOf a) + K.length ≤ 4 * ρ + 4) ↦ + walk_subset_of_dist (D := D) hr4 hclose' K ha hd + have hstep : ∀ {a b : Shat} {j : ℕ} (T : GraphWalk D.rad.G.toGraph a b), a ∈ D.rad.G.V → D.dist z + (D.rad.atomOf a) ≤ j → T.length < D.rep → + D.dist z (D.rad.atomOf b) ≤ j + T.length := by + intro a b j T ha hd hlt + have h₁ := D.dist_atomOf_le_of_walk T hlt + have h₂ := D.dist_triangle hr4 (a := z) (c := D.rad.atomOf b) (D.atomOf_mem ha) + omega + -- the distance from `z` to the hub + have hbdv : ∀ {v : Shat}, v ∈ (cap.emb '' D.Γ.V) ∩ discBd W → ∃ h₀ ∈ H.V, ∃ T : GraphWalk + D.rad.G.toGraph v h₀, T.length ≤ ρ := by + intro v hv + obtain ⟨P, h₀, hh, hP, hle⟩ := (hW.bd_dist v hv).1 + obtain ⟨K, hKs, -, hE⟩ := Drawing.IsPathOf.exists_simple_walk hP + refine ⟨h₀, hh, K, ?_⟩ + rw [← ncard_walk_E _ hKs] + have : (walkDrawing D.rad.G K).E = P.E := by + ext e + rw [hE e, walkDrawing_E] + rfl + rwa [this] + obtain ⟨v, hv, w, hzw, hwG, hcase⟩ := hW.exists_atom_on_bd hzb + have hzw' : D.rad.atomOf w = z := D.atom_eq_of_mem (D.atomOf_mem hwG) (D.atomOf_mem hzG) hzw + (D.mem_atomOf hzG) + have hvG : v ∈ D.rad.G.V := D.rad.isPreRadial.2.1 hv.1 + have hone : ∀ {a b : Shat} {g : Set Shat}, D.rad.G.toGraph.IsLink g a b → D.dist (D.rad.atomOf a) + (D.rad.atomOf b) ≤ 1 := fun hl ↦ + D.dist_atomOf_le_of_walk (.cons hl (.nil hl.2.2.1)) (by + rw [GraphWalk.length_cons] + change 0 + 1 < D.rep + omega) + have hd₁ : D.dist z (D.rad.atomOf v) ≤ 1 := by + rw [← hzw'] + rcases hcase with rfl | ⟨g, hl⟩ + · rw [D.dist_self] + omega + · rw [D.dist_comm] + exact hone hl + obtain ⟨h₀, hh₀, T₀, hT₀⟩ := hbdv hv + have hh₀G : h₀ ∈ D.rad.G.V := hW.H_sub.1 hh₀ + have hd₂ : D.dist z (D.rad.atomOf h₀) ≤ 1 + T₀.length := hstep T₀ hvG hd₁ (by omega) + have hhub : ∀ h ∈ H.V, D.dist z (D.rad.atomOf h) ≤ 3 * ρ + 3 := by + intro h hh + rcases hHc with hc | ⟨hc, hle⟩ + · obtain ⟨y, hy⟩ := ncard_eq_one.mp hc + rw [hy] at hh hh₀ + obtain rfl : h = y := hh + obtain rfl : h₀ = h := hh₀ + omega + · obtain ⟨T, hT, -⟩ := exists_short_walk hc hh₀ hh + have := hstep T hh₀G hd₂ (by omega) + omega + have hvdist : ∀ {v' : Shat}, v' ∈ (cap.emb '' D.Γ.V) ∩ discBd W → D.dist z (D.rad.atomOf v') + ≤ 4 * ρ + 3 := by + intro v' hv' + obtain ⟨h', hh', T, hT⟩ := hbdv hv' + have := hstep T.reverse (hW.H_sub.1 hh') (hhub h' hh') (by rw [GraphWalk.length_reverse]; omega) + rw [GraphWalk.length_reverse] at this + omega + have hbd : discBd W ⊆ Λ := by + intro p hp + obtain ⟨v', hv', w', hpw, hw'G, hc'⟩ := hW.exists_atom_on_bd hp + have hd := hvdist hv' + refine hclose' _ (D.atomOf_mem hw'G) ?_ hpw + rcases hc' with rfl | ⟨g, hl⟩ + · omega + · have h₁ := hone hl + have h₂ := D.dist_triangle hr4 (a := z) (c := D.rad.atomOf w') (D.atomOf_mem + (D.rad.isPreRadial.2.1 hv'.1)) + omega + have hsubd : ∀ {F₁ : Drawing Shat} {j : ℕ}, F₁.IsSubdrawing D.rad.G → (∀ a ∈ F₁.V, D.dist z + (D.rad.atomOf a) ≤ j) → j + 1 ≤ 4 * ρ + 4 → F₁.U ⊆ Λ := by + intro F₁ j hs hd hj x hx + by_cases hxV : x ∈ F₁.V + · exact hclose' _ (D.atomOf_mem (hs.1 hxV)) ((hd x hxV).trans (by omega)) (D.mem_atomOf + (hs.1 hxV)) + · obtain ⟨g, hg, hxg⟩ := F₁.exists_edge_of_mem hx hxV + have hgG := hs.2 hg + obtain ⟨a, ha, q, hq, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 g hgG + have ham : a ∈ closure g ∩ D.rad.G.V := by + rw [hcap] + exact .inl rfl + have hqm : q ∈ closure g ∩ D.rad.G.V := by + rw [hcap] + exact .inr rfl + have haF : a ∈ F₁.V := ((hs.closure_inter_V hg).symm ▸ ham : a ∈ closure g ∩ F₁.V).2 + have hl : D.rad.G.toGraph.IsLink g a q := ⟨hgG, ham.2, hqm.2, hcap⟩ + refine hK (.cons hl (.nil hqm.2)) ham.2 ?_ ?_ + · rw [GraphWalk.length_cons] + change _ + (0 + 1) ≤ _ + have := hd a haF + omega + · rw [mem_walkDrawing_U] + exact .inr ⟨g, by simp, subset_closure hxg⟩ + have hHU : H.U ⊆ Λ := hsubd hW.H_sub hhub (by omega) + have hFU : F.U ⊆ Λ := by + refine hsubd (j := 2 * ρ + 2) hF.1 (fun a ha ↦ ?_) (by omega) + obtain ⟨T, hT, -⟩ := exists_short_walk hF hzF ha + have := hstep T hzG (j := 0) (by rw [D.dist_self]) (by omega) + omega + refine ⟨closure Λ, hΛc, hins F hF (hFU.trans hsubcl) (by omega), hbd.trans hsubcl, + hHU.trans hsubcl, fun v' h' T hT ↦ ?_, + fun C hC hle hU ↦ hins C hC hU (by omega)⟩ + have hl := (hW.spoke_length hT).1 + have hHubDist := hhub h' hT.2.h_mem + have hReverse := hK T.reverse (hW.H_sub.1 hT.2.h_mem) (by + rw [GraphWalk.length_reverse] + omega) + rw [U_reverse] at hReverse + exact hReverse.trans hsubcl + +namespace IsSectorEnclave + +variable (hx : D.IsSectorEnclave W H ρ r Δv Dv ord' 𝒯' F) +include hx + +/-- If `F` has no vertex on `bd(W)`, and `ins(F)` is not in `W`, then `F` is disjoint from `W`. -/ +theorem off_W (hsub : ¬ D.ins F ⊆ W) (hnot : ∀ x ∈ F.V, x ∉ discBd W) : Disjoint F.U W := by + have : ConnectedSpace Shat := cap.connected + have hW := hx.wheel + obtain ⟨-, hc, hlt, -⟩ := hx.enclave + have hle := hx.F_card + have hstay : ∀ {a b : Shat} (T : GraphWalk D.rad.G.toGraph a b), (∀ e ∈ T.edges, e ∈ F.E) + → a ∈ F.V → a ∉ W → b ∉ W := by + intro a b T + induction T with + | nil _ => exact fun _ _ h ↦ h + | @cons a y b e hl L ih => + intro hE ha hn + have heF : e ∈ F.E := hE e (by simp) + have hac : a ∈ closure e := by + have : a ∈ closure e ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact .inl rfl + exact this.1 + have hdis : Disjoint e W := (hW.edge_side hl.1).resolve_left fun h' ↦ hn + (closure_minimal h' hW.is_disc.isClosed hac) + have hyF := (Drawing.IsLink.mem_V_of_sub hc.1 hl heF).2 + refine ih (fun f hf ↦ hE f (by simp [hf])) hyF fun hy ↦ hnot y hyF + (hW.mem_bd_of_closure hdis ?_ hy) + have : y ∈ closure e ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact .inr rfl + exact this.1 + obtain ⟨y, hyF, hyW⟩ : ∃ y ∈ F.V, y ∉ W := by + by_contra hn + push Not at hn + exact hsub (hW.ins_subset_of_vertices hc (hle.1.trans hle.2) fun x hx _ ↦ hn x hx) + have hall : ∀ x ∈ F.V, x ∉ W := fun x hxF ↦ by + obtain ⟨T, -, hT⟩ := exists_short_walk hc hyF hxF + exact hstay T hT hyF hyW + refine disjoint_left.mpr fun x hxU hxW ↦ ?_ + by_cases hxV : x ∈ F.V + · exact hall x hxV hxW + · obtain ⟨g, hg, hxg⟩ := F.exists_edge_of_mem hxU hxV + have hgG := hc.1.2 hg + obtain ⟨a, ha, q, hq, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 g hgG + have ham : a ∈ closure g ∩ D.rad.G.V := by + rw [hcap] + exact .inl rfl + have haF : a ∈ F.V := ((hc.1.closure_inter_V hg).symm ▸ ham : a ∈ closure g ∩ F.V).2 + rcases hW.edge_side hgG with h₁ | h₁ + · exact hall a haF (closure_minimal h₁ hW.is_disc.isClosed ham.1) + · exact disjoint_left.mp h₁ hxg hxW + +/-- If `ins(F)` is not in `W`, then `F` has a vertex on `bd(W)`. Otherwise `W` lies inside `F`, and +this contradicts step (3). -/ +theorem exists_vertex_on_bd (hsub : ¬ D.ins F ⊆ W) : ∃ z ∈ F.V, z ∈ discBd W := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hW := hx.wheel + by_contra hn + push Not at hn + have hdis := hx.off_W hsub hn + have hFi := hx.isInsOf_F + have hO := isSide_int hT hFi.2.2.1 hFi.2.2.2.1 + obtain ⟨c, hc, hc₁, hc₂⟩ := hx.exists_edge + obtain ⟨y, hy⟩ := hc.1 + have hyi₁ := hc₁ (mem_image_of_mem _ hy) + have hyi₂ := hc₂ (mem_image_of_mem _ hy) + have hWin : W ⊆ discInt (D.ins F) := hO.subset (by + have h₁ := hW.is_disc.isPreconnected_discInt.closure + rwa [closure_discInt hW.is_disc] at h₁) hdis.symm ⟨_, hx.sector.Δv_sub hyi₂.1, hyi₁⟩ + rcases hW.hub_cond with ⟨hc₁', -, -⟩ | ⟨hH, -, -⟩ + · obtain ⟨z, hz⟩ := ncard_eq_one.mp hc₁' + have hh : z ∈ H.V := by + rw [hz] + rfl + have hzW := hW.H_in_int (H.V_subset_U hh) + have := hx.hub_point hc₁' hh (hWin hzW.1).1 + exact disjoint_left.mp hdis this hzW.1 + · obtain ⟨-, -, -, hcir, hlt, -⟩ := id hH + obtain ⟨u', W', -, -, hVe, -⟩ := hcir.2 + have hu' : u' ∈ H.V := by + rw [hVe] + exact W'.start_mem_support + have huW := hW.H_in_int (H.V_subset_U hu') + have hi := D.ins_spec hcir hlt + have hm : u' ∈ D.ins F ∩ D.ins H := ⟨(hWin huW.1).1, by + have : u' ∈ discBd (D.ins H) := by + rw [hi.2.2.2.1] + exact H.V_subset_U hu' + exact Surface.discBd_subset _ this⟩ + rw [hx.hub_circuit hH] at hm + exact disjoint_left.mp hdis hm.1 huW.1 + +/-- **Step (4) of the proof of (13.6).** -/ +theorem exists_ambient : ∃ Δ₀, D.IsAmbientDisc W H ρ F Δ₀ := by + have : ConnectedSpace Shat := cap.connected + have hW := hx.wheel + by_cases hsub : D.ins F ⊆ W + · exact ⟨W, hW.is_disc, hsub, Surface.discBd_subset _, hW.H_in_int.trans sdiff_subset, fun v h K + hK ↦ hK.subset_W hW hx.hbdS hx.hin, + fun C hC hle hU ↦ hW.ins_sub C hC hle hU⟩ + · obtain ⟨z, hzF, hzb⟩ := hx.exists_vertex_on_bd hsub + obtain ⟨-, hc, -⟩ := hx.enclave + have hle := hx.F_card + refine IsAmbientDisc.of_vertex hW hx.hrep hc (hle.1.trans hle.2) ?_ hzF hzb + rcases hW.hub_cond with ⟨h₁, -, -⟩ | ⟨hH, h₂, -⟩ + · exact .inl h₁ + · obtain ⟨-, -, -, hcir, -⟩ := id hH + exact .inr ⟨hcir, h₂⟩ + +end IsSectorEnclave + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13m.lean b/LeanPool/GraphMinor/GM19/Section13m.lean new file mode 100644 index 0000000000..c88666a922 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13m.lean @@ -0,0 +1,310 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13l + +/-! +# Graph Minors XIX, Section 13: the circuit `C` in the proof of (13.6) + +After step (4) the paper says that there is a circuit `C ⊆ F ∪ D_v` whose disc in `Δ₀` holds `ins(F) +∪ Δ_v`. We take `Δ'` in `Δ₀` as large as +possible among the discs that hold `Δ_v` and are bounded by a circuit of `F ∪ D_v`. If some edge of +`F` is outside `Δ'` and some edge of `F` +is in `Δ'`, then a piece of `F` is an ear on `Δ'`, and `exists_larger_circuit` gives a larger disc. +If no edge of `F` is in `Δ'` then +`Δ' ⊆ ins(F)`, and `ins(F)` itself is a larger disc. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + +omit [T2Space Shat] in +/-- A simple walk with ends in `X`, through an edge `g`, has a piece through `g` that has only its +ends in `X`. -/ +theorem GraphWalk.exists_piece {G : Drawing Shat} {a b : Shat} (K : GraphWalk G.toGraph a b) + (hs : K.IsSimple) {X : Set Shat} (ha : a ∈ X) (hb : b ∈ X) + {g : Set Shat} (hg : g ∈ K.edges) : ∃ (u v : Shat) (M : GraphWalk G.toGraph u v), u ∈ X ∧ v ∈ X + ∧ M.IsSimple ∧ g ∈ M.edges ∧ (∀ e ∈ M.edges, e ∈ K.edges) ∧ + ∀ x ∈ M.support, x ∈ X → x = u ∨ x = v := by + obtain ⟨x, y, hl, A, B, rfl⟩ := GraphWalk.exists_split_edge K hg + obtain ⟨u, hu, A₁, A₂, rfl, h₁⟩ := GraphWalk.exists_last_mem A (X := X) ⟨a, A.start_mem_support, + ha⟩ + obtain ⟨v, hv, B₁, B₂, rfl, h₂⟩ := GraphWalk.exists_first_mem B (X := X) ⟨b, B.end_mem_support, + hb⟩ + have hnd := hs + unfold GraphWalk.IsSimple at hnd + rw [GraphWalk.support_append, GraphWalk.support_cons, List.tail_cons, List.nodup_append] at hnd + obtain ⟨hn₁, hn₂, hn₃⟩ := hnd + have hs₁ := (isSimple_of_append hs).1 + have hs₂ := (isSimple_of_append hs).2 + have hA₂ := (isSimple_of_append hs₁).2 + have hc : (GraphWalk.cons hl (B₁.append B₂)).support.Nodup := hs₂ + rw [GraphWalk.support_cons, List.nodup_cons] at hc + have hB₁ := (isSimple_of_append (show (B₁.append B₂).IsSimple from hc.2)).1 + have hcons : (GraphWalk.cons hl B₁).IsSimple := by + refine List.nodup_cons.mpr ⟨fun h' ↦ hc.1 ((GraphWalk.mem_support_append _ _).mpr (.inl h')), + hB₁⟩ + refine ⟨u, v, A₂.append (GraphWalk.cons hl B₁), hu, hv, isSimple_append' hA₂ hcons fun z hz hz₂ ↦ + ?_, ?_, fun e he ↦ ?_, fun z hz hzX ↦ ?_⟩ + · rcases List.mem_cons.mp hz₂ with rfl | hz₂ + · rfl + · exact absurd ((GraphWalk.mem_support_append B₁ B₂).mpr (.inl hz₂)) (hn₃ _ + ((GraphWalk.mem_support_append _ _).mpr (.inr hz)) _ · rfl) + · rw [GraphWalk.edges_append, GraphWalk.edges_cons] + exact List.mem_append_right _ List.mem_cons_self + · simp only [GraphWalk.edges_append, GraphWalk.edges_cons, List.mem_append, List.mem_cons] at he ⊢ + tauto + · rcases (GraphWalk.mem_support_append _ _).mp hz with hz | hz + · exact .inl (h₁ z hz hzX) + · rcases List.mem_cons.mp hz with rfl | hz + · exact .inl (h₁ _ A₂.end_mem_support hzX) + · exact .inr (h₂ z hz hzX) + +omit [T2Space Shat] in +/-- Each edge of a simple walk with distinct ends has an end that is not an end of the walk, or else +it is the only edge. -/ +theorem GraphWalk.edge_has_middle {G : Drawing Shat} {u v : Shat} (M : GraphWalk G.toGraph u v) + (hs : M.IsSimple) (huv : u ≠ v) {e : Set Shat} + (he : e ∈ M.edges) : M.edges = [e] ∨ ∃ x ∈ M.support, x ∈ closure e ∧ x ≠ u ∧ x ≠ v := by + obtain ⟨x, y, hl, A, B, rfl⟩ := GraphWalk.exists_split_edge M he + have hnd := hs + unfold GraphWalk.IsSimple at hnd + rw [GraphWalk.support_append, GraphWalk.support_cons, List.tail_cons, List.nodup_append] at hnd + obtain ⟨hn₁, hn₂, hn₃⟩ := hnd + have hs₂ := (isSimple_of_append hs).2 + have hc : (GraphWalk.cons hl B).support.Nodup := hs₂ + rw [GraphWalk.support_cons, List.nodup_cons] at hc + have hx : x ∈ closure e ∩ G.V := by + rw [hl.2.2.2] + exact .inl rfl + have hy : y ∈ closure e ∩ G.V := by + rw [hl.2.2.2] + exact .inr rfl + have hxs : x ∈ (A.append (GraphWalk.cons hl B)).support := (GraphWalk.mem_support_append _ _).mpr + (.inl A.end_mem_support) + have hys : y ∈ (A.append (GraphWalk.cons hl B)).support := (GraphWalk.mem_support_append _ _).mpr + (.inr (by simp [B.start_mem_support])) + by_cases h₁ : x ≠ u ∧ x ≠ v + · exact .inr ⟨x, hxs, hx.1, h₁⟩ + by_cases h₂ : y ≠ u ∧ y ≠ v + · exact .inr ⟨y, hys, hy.1, h₂⟩ + have hxy : x ≠ y := fun h' ↦ hc.1 (h' ▸ B.start_mem_support) + left + have h₁' : x = u ∨ x = v := by tauto + have h₂' : y = u ∨ y = v := by tauto + rcases h₁' with rfl | rfl + · rcases h₂' with rfl | rfl + · exact absurd rfl hxy + · rw [GraphWalk.edges_append, GraphWalk.edges_cons, (simple_self (isSimple_of_append hs).1).1, + (simple_self hc.2).1] + rfl + · rcases h₂' with rfl | rfl + · exact absurd (B.start_mem_support) (hn₃ _ A.start_mem_support _ · rfl) + · exact absurd rfl hxy + +universe w + +variable {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- An edge of `G` off `C` is inside the disc bounded by `C` or misses the disc. -/ +theorem edge_inside_or_off (hT : IsClosedSurface Shat) {G C : Drawing Shat} + {Δ : Set Shat} (hC : C.IsSubdrawing G) (hΔ : IsClosedDisc Δ) + (hbd : discBd Δ = C.U) {e : Set Shat} (he : e ∈ G.E) (heC : e ∉ C.E) : e ⊆ discInt Δ + ∨ Disjoint e Δ := by + have hd := edge_disjoint_U hC he heC + by_cases hm : (e ∩ Δ).Nonempty + · left + obtain ⟨x, hxe, hxΔ⟩ := hm + refine (isSide_int hT hΔ hbd).subset he.2.2.1.isConnected.isPreconnected hd ⟨x, hxe, hxΔ, + fun hb ↦ disjoint_left.mp hd hxe (hbd ▸ hb)⟩ + · right + exact disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp hm) + +/-- **The circuit `C` of the proof of (13.6).** Two discs in `Δ₀` bounded by circuits of `G`, whose +interiors meet, lie in a disc in `Δ₀` bounded by a circuit +in the union of the two circuits. -/ +theorem exists_enclosing_circuit [ConnectedSpace Shat] (hT : IsClosedSurface Shat) {G F Dv : + Drawing Shat} {Δ₀ Δf Δv : Set Shat} (h₀ : IsClosedDisc Δ₀) + (hF : F.IsCircuitOf G) (hDv : Dv.IsCircuitOf G) (hΔf : IsClosedDisc Δf) (hΔv : IsClosedDisc Δv) + (hf₀ : Δf ⊆ Δ₀) (hv₀ : Δv ⊆ Δ₀) + (hbf : discBd Δf = F.U) (hbv : discBd Δv = Dv.U) (hmeet : (discInt Δf ∩ discInt Δv).Nonempty) + (hG : ∀ e ∈ G.E, ∃ a b, a ≠ b ∧ closure e ∩ G.V = {a, b}) : + ∃ (C : Drawing Shat) (Δ : Set Shat), C.IsCircuitOf G ∧ (∀ e ∈ C.E, e ∈ F.E ∨ e ∈ Dv.E) + ∧ IsClosedDisc Δ ∧ Δ ⊆ Δ₀ ∧ discBd Δ = C.U ∧ Δf ⊆ Δ ∧ Δv ⊆ Δ := by + classical + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + let 𝓕 : Set (Set Shat) := {Δ | Δ ⊆ Δ₀ ∧ IsClosedDisc Δ ∧ Δv ⊆ Δ ∧ ∃ C : Drawing Shat, + C.IsCircuitOf G ∧ (∀ e ∈ C.E, e ∈ F.E ∨ e ∈ Dv.E) ∧ discBd Δ = C.U} + have hfin : 𝓕.Finite := by + refine Set.Finite.of_finite_image (f := discBd) ?_ ?_ + · refine ((finite_circuits G).image fun C ↦ C.U).subset ?_ + rintro _ ⟨W, ⟨-, -, -, C, hC, -, hb⟩, rfl⟩ + exact ⟨C, ⟨hC.2, hC.1⟩, hb.symm⟩ + · rintro A ⟨hA, hAd, -⟩ B ⟨hB, hBd, -⟩ he + exact disc_eq_of_subset_disc hT h₀ hAd hBd hA hB he + obtain ⟨Δ', ⟨hsub, hd, hvs, C, hC, hCE, hb⟩, hmax⟩ := hfin.exists_maximal ⟨Δv, hv₀, hΔv, + subset_rfl, Dv, hDv, fun e he ↦ .inr he, hbv⟩ + have hmax' : ∀ {A : Set Shat}, A ∈ 𝓕 → Δ' ⊆ A → A = Δ' := fun hA hle ↦ Subset.antisymm + (hmax hA hle) hle + have hCU : C.U ⊆ Δ' := hb ▸ Surface.discBd_subset _ + have hclosed : IsClosed Δ' := hd.isClosed + have hint : discInt Δv ⊆ discInt Δ' := by + intro x hx + refine ⟨hvs hx.1, fun hxb ↦ ?_⟩ + have hf : x ∈ frontier Δ' := by + rw [IsClosedDisc.frontier_eq_discBd hT hd] + exact hxb + exact hf.2 (mem_interior.mpr ⟨_, (discInt_subset _).trans hvs, hΔv.isOpen_discInt hman, hx⟩) + have hFs : ∀ e ∈ F.E, e ∈ G.E := fun e he ↦ hF.1.2 he + have hcase : ∀ e ∈ F.E, closure e ⊆ Δ' ∨ Disjoint e Δ' := fun e he ↦ by + by_cases heC : e ∈ C.E + · exact .inl ((C.closure_subset_U heC).trans hCU) + · rcases edge_inside_or_off hT hC.1 hd hb (hFs e he) heC with h | h + · exact .inl (closure_minimal (h.trans (discInt_subset _)) hclosed) + · exact .inr h + have hkey : Δf ⊆ Δ' := by + by_cases hall : ∀ e ∈ F.E, closure e ⊆ Δ' + · have hU : F.U ⊆ Δ' := U_of_edges hF.2 hclosed fun e he ↦ subset_closure.trans (hall e he) + obtain ⟨Δ'', ⟨hs₁, hd₁, hb₁, -⟩, -⟩ := disc_oArc Δ' F.U hd hU (GM14.isOArc_of_isCircuit hF.2) + rw [disc_eq_of_subset_disc hT h₀ hΔf hd₁ hf₀ (hs₁.trans hsub) (hbf.trans hb₁.symm)] + exact hs₁ + push Not at hall + obtain ⟨e₀, he₀, hout⟩ := hall + have he₀d := (hcase e₀ he₀).resolve_left hout + by_cases hin : ∃ e ∈ F.E, closure e ⊆ Δ' + · exfalso + obtain ⟨e₁, he₁, hcl⟩ := hin + obtain ⟨a, b, hne, hcap⟩ := hG e₁ (hFs e₁ he₁) + have ham : a ∈ closure e₁ ∩ G.V := by + rw [hcap] + exact .inl rfl + have hbm : b ∈ closure e₁ ∩ G.V := by + rw [hcap] + exact .inr rfl + have hl : G.toGraph.IsLink e₁ a b := ⟨hFs e₁ he₁, ham.2, hbm.2, hcap⟩ + have hends := Drawing.IsLink.mem_V_of_sub hF.1 hl he₁ + obtain ⟨W₁, W₂, hs⟩ := exists_splits hF.2 hF.1 hends.1 hends.2 hne + obtain ⟨u, v, M, hu, hv, hMs, he₀M, hME, hinner⟩ : ∃ (u v : Shat) + (M : GraphWalk G.toGraph u v), u ∈ Δ' ∧ v ∈ Δ' ∧ M.IsSimple ∧ e₀ ∈ M.edges ∧ + (∀ e ∈ M.edges, e ∈ F.E) ∧ ∀ x ∈ M.support, x ∈ Δ' → x = u ∨ x = v := by + rcases (hs.E e₀).mp he₀ with h | h + · obtain ⟨u, v, M, h₁, h₂, h₃, h₄, h₅, h₆⟩ := GraphWalk.exists_piece W₁ hs.s₁ (hcl ham.1) + (hcl hbm.1) h + exact ⟨u, v, M, h₁, h₂, h₃, h₄, fun e he ↦ (hs.E e).mpr (.inl (h₅ e he)), h₆⟩ + · obtain ⟨u, v, M, h₁, h₂, h₃, h₄, h₅, h₆⟩ := GraphWalk.exists_piece W₂ hs.s₂ (hcl hbm.1) + (hcl ham.1) h + exact ⟨u, v, M, h₁, h₂, h₃, h₄, fun e he ↦ (hs.E e).mpr (.inr (h₅ e he)), h₆⟩ + have huv : u ≠ v := by + rintro rfl + rw [(simple_self hMs).1] at he₀M + cases he₀M + have hMoff : ∀ e ∈ M.edges, Disjoint e Δ' := fun e he ↦ by + rcases GraphWalk.edge_has_middle M hMs huv he with h | ⟨x, hxs, hxc, hxu, hxv⟩ + · rw [h] at he₀M + obtain rfl : e₀ = e := by simpa using he₀M + exact he₀d + · refine (hcase e (hME e he)).resolve_left fun h' ↦ ?_ + rcases hinner x hxs (h' hxc) with h'' | h'' + · exact hxu h'' + · exact hxv h'' + have hstart : ∀ {a b : Shat} (N : GraphWalk G.toGraph a b), a ≠ b → (∀ e ∈ N.edges, e ∈ F.E) + → (∀ e ∈ N.edges, Disjoint e Δ') → a ∈ Δ' → a ∈ F.V ∧ a ∈ C.V := by + intro a b N hab hE hD haΔ + cases N with + | nil _ => exact absurd rfl hab + | @cons _ y _ e hl r => + have heF := hE e (by simp) + have haF := (Drawing.IsLink.mem_V_of_sub hF.1 hl heF).1 + refine ⟨haF, ?_⟩ + have hdis := hD e (by simp) + have hac : a ∈ closure e := by + have : a ∈ closure e ∩ G.V := by + rw [hl.2.2.2] + exact .inl rfl + exact this.1 + have haf : a ∈ frontier Δ' := by + refine ⟨subset_closure haΔ, fun hi ↦ ?_⟩ + obtain ⟨y, hyi, hye⟩ := mem_closure_iff.mp hac _ isOpen_interior hi + exact disjoint_left.mp hdis hye (interior_subset hyi) + rw [IsClosedDisc.frontier_eq_discBd hT hd, hb] at haf + by_contra hnV + obtain ⟨g, hg, hag⟩ := C.exists_edge_of_mem haf hnV + exact ((hC.1.2 hg).2.1 hag).2 hl.2.1 + obtain ⟨huF, huC⟩ := hstart M huv hME hMoff hu + obtain ⟨hvF, hvC⟩ := hstart M.reverse huv.symm (fun e he ↦ hME e + (by simpa [GraphWalk.edges_reverse] using he)) + (fun e he ↦ hMoff e (by simpa [GraphWalk.edges_reverse] using he)) hv + have hMV := support_subset_of_edges hF.1 M huF hME + have hPF : (walkDrawing G M).U ⊆ F.U := by + intro x hx + rw [mem_walkDrawing_U] at hx + rcases hx with hx | ⟨e, he, hxe⟩ + · exact F.V_subset_U (hMV x hx) + · exact F.closure_subset_U (hME e he) hxe + have hPU : (walkDrawing G M).U ∩ Δ' = {u, v} := by + apply Subset.antisymm + · rintro x ⟨hx, hxΔ⟩ + rw [mem_walkDrawing_U] at hx + rcases hx with hx | ⟨e, he, hxe⟩ + · exact hinner x hx hxΔ + · rcases closure_edge_subset (hF.1.2 (hME e he)) hxe with h' | h' + · exact absurd hxΔ (disjoint_left.mp (hMoff e he) h') + · obtain ⟨p, q, hl', A, B, rfl⟩ := GraphWalk.exists_split_edge M he + have hxm : x ∈ closure e ∩ G.V := ⟨hxe, h'⟩ + rw [hl'.2.2.2] at hxm + refine hinner x ?_ hxΔ + rcases hxm with rfl | rfl + · exact (GraphWalk.mem_support_append _ _).mpr (.inl A.end_mem_support) + · exact (GraphWalk.mem_support_append _ _).mpr (.inr (by simp [B.start_mem_support])) + · rintro x (rfl | rfl) + · exact ⟨(mem_walkDrawing_U _ _).mpr (.inl M.start_mem_support), hu⟩ + · exact ⟨(mem_walkDrawing_U _ _).mpr (.inl M.end_mem_support), hv⟩ + have hFΔf : F.U ⊆ Δf := hbf ▸ Surface.discBd_subset _ + obtain ⟨F', W', hF', hW'Δ, hW', hlt, hbd', hU', -⟩ := exists_larger_circuit hT h₀ hd hsub hC + hb huC hvC huv + (P := walkDrawing G M) ⟨walkDrawing_isSubdrawing _ _, walkDrawing_isPathBetween _ hMs⟩ + ((hPF.trans hFΔf).trans hf₀) hPU + have hF'E : ∀ e ∈ F'.E, e ∈ F.E ∨ e ∈ Dv.E := fun e he ↦ by + by_cases heC : e ∈ C.E + · exact hCE e heC + by_cases heM : e ∈ (walkDrawing G M).E + · rw [walkDrawing_E] at heM + exact .inl (hME e heM) + · exfalso + have heG := hF'.1.2 he + obtain ⟨x, hx⟩ := heG.1 + have hxU : x ∈ F'.U := F'.closure_subset_U he (subset_closure hx) + rcases hU' hxU with h' | h' + · exact disjoint_left.mp (edge_disjoint_U (walkDrawing_isSubdrawing _ _) heG heM) hx h' + · exact disjoint_left.mp (edge_disjoint_U hC.1 heG heC) hx h' + have hmem : W' ∈ 𝓕 := ⟨hW'Δ, hW', hvs.trans hlt.1, F', hF', hF'E, hbd'⟩ + exact hlt.ne (hmax' hmem hlt.1).symm + · push Not at hin + have hoff : ∀ e ∈ F.E, Disjoint e Δ' := fun e he ↦ (hcase e he).resolve_left (hin e he) + have hUd : F.U ⊆ (discInt Δ')ᶜ := U_of_edges hF.2 (hd.isOpen_discInt hman).isClosed_compl fun + e he x hxe hxi ↦ + disjoint_left.mp (hoff e he) hxe hxi.1 + obtain ⟨x, hx₁, hx₂⟩ := hmeet + have hsubi : discInt Δ' ⊆ discInt Δf := (isSide_int hT hΔf hbf).subset + hd.isPreconnected_discInt + (disjoint_left.mpr fun y hy hyU ↦ hUd hyU hy) ⟨x, hint hx₂, hx₁⟩ + have hle : Δ' ⊆ Δf := by + rw [← closure_discInt hd] + exact closure_minimal (hsubi.trans (discInt_subset _)) hΔf.isClosed + have hmem : Δf ∈ 𝓕 := ⟨hf₀, hΔf, hvs.trans hle, F, hF, fun e he ↦ .inl he, hbf⟩ + exact (hmax' hmem hle).le + exact ⟨C, Δ', hC, hCE, hd, hsub, hb, hkey, hvs⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13n.lean b/LeanPool/GraphMinor/GM19/Section13n.lean new file mode 100644 index 0000000000..2cdd74ec45 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13n.lean @@ -0,0 +1,378 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13m + +/-! +# Graph Minors XIX, Section 13: step (5) of (13.6), and the path `M` of step (6) +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TieBreaker + +variable {Γ : Painting S} {rad : RadialDrawing cap Γ} + +omit [T2Space S] [T2Space Shat] in +theorem walkWeight_reverse (tb : TieBreaker rad) {u v : Shat} (T : GraphWalk rad.G.toGraph u v) : + tb.walkWeight T.reverse = tb.walkWeight T := by + simp only [walkWeight, GraphWalk.edges_reverse, List.map_reverse, List.sum_reverse] + +omit [T2Space S] [T2Space Shat] in +/-- The weight of a circuit is the sum of the weights of its two sides. -/ +theorem weightSub_eq_of_splits (tb : TieBreaker rad) {C : Drawing Shat} {a b : Shat} {W₁ : + GraphWalk rad.G.toGraph a b} {W₂ : GraphWalk rad.G.toGraph b a} + (hs : Splits C W₁ W₂) : tb.weightSub C = tb.walkWeight W₁ + tb.walkWeight W₂ := by + classical + have hn : (W₁.edges ++ W₂.edges).Nodup := List.nodup_append.mpr ⟨hs.s₁.edges_nodup, + hs.s₂.edges_nodup, fun x hx y hy h ↦ hs.edge x hx (h ▸ hy)⟩ + have hE : C.E = ↑(W₁.edges ++ W₂.edges).toFinset := by + ext e + simp [hs.E e] + rw [weightSub, hE, finsum_mem_coe_finset, List.sum_toFinset _ hn] + simp [walkWeight] + +omit [T2Space S] in +theorem weightSub_le_of_edges (tb : TieBreaker rad) {P : Drawing Shat} {u v : Shat} + (T : GraphWalk rad.G.toGraph u v) (hE : ∀ e ∈ P.E, e ∈ T.edges) : + tb.weightSub P ≤ tb.walkWeight T := by + refine (tb.weightSub_mono (X := P) (Y := walkDrawing rad.G T) (fun e he ↦ ?_) + (walkDrawing_isSubdrawing _ _).2).trans (tb.weightSub_walkDrawing_le T) + rw [walkDrawing_E] + exact hE e he + +end TieBreaker + +omit [T2Space Shat] in +/-- A set of edges inside a walk has at most as many edges as the walk. -/ +theorem ncard_le_length_of_edges {G P : Drawing Shat} {u v : Shat} (T : GraphWalk G.toGraph u v) + (hE : ∀ e ∈ P.E, e ∈ T.edges) : P.E.ncard ≤ T.length := by + classical + have h₁ : P.E ⊆ ↑T.edges.toFinset := fun e he ↦ by simpa using hE e he + have h₂ := ncard_le_ncard h₁ (Finset.finite_toSet _) + rw [ncard_coe_finset] at h₂ + exact h₂.trans (List.toFinset_card_le _) + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {Δv : Set + Shat} {Dv F : Drawing Shat} + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {Δ₀ Δ : Set Shat} {C : + Drawing Shat} + +omit [T2Space Shat] in +/-- A walk of `Γ*` has even length exactly if its ends are on the same side of the bipartition. -/ +theorem even_length_walk (D : TangleDatum cap χ) {a b : Shat} (T : GraphWalk D.rad.G.toGraph a b) : + Even T.length ↔ (a ∈ D.P.Γ.hatV cap ↔ b ∈ D.P.Γ.hatV cap) := by + obtain ⟨Sk, hSk⟩ := exists_isSkHat χ.isSurface cap D.P.Γ + have := even_length_iff Sk.V (D.rad.bipartite hSk.hV) T + rwa [hSk.hV] at this + +/-- The bound of the paper's step (6): a walk from a vertex of `bd(W)` to the inner end of a spoke +is at least as long as the spoke, and if it has +the same length then it starts at a vertex of `Γ`. -/ +theorem IsSpokeWalk.le_walk_of_bd (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) {v h a : Shat} {K : GraphWalk + D.rad.G.toGraph v h} (hK : D.IsSpokeWalk W H K) + (T : GraphWalk D.rad.G.toGraph a h) (ha : a ∈ D.rad.G.V) (hab : a ∈ discBd W) : K.length + ≤ T.length ∧ (K.length = T.length → a ∈ D.P.Γ.hatV cap) := by + have : ConnectedSpace Shat := cap.connected + have hl := hW.spoke_length hK + have hh := hK.2.h_mem + have hv : v ∈ D.P.Γ.hatV cap := hK.2.v_mem.1 + have hK' := D.even_length_walk K + have hT' := D.even_length_walk T + by_cases hah : a ∈ D.P.Γ.hatV cap + · refine ⟨?_, fun _ ↦ hah⟩ + have h₁ := hW.walk_ge ⟨hah, hab⟩ hh T + by_contra hn + have h₂ : K.length = T.length + 1 := by omega + have e₁ : Even K.length ↔ Even T.length := by + rw [hK', hT'] + simp [hv, hah] + rw [h₂, Nat.even_add_one] at e₁ + tauto + · have hlt : K.length ≤ T.length := by + by_contra hn + obtain ⟨P, hP, hle⟩ := exists_path_of_walk T + exact theorem_13_1_proof hW hbdS hin ⟨ha, hah⟩ hab ⟨P, h, hh, hP, by omega⟩ + refine ⟨hlt, fun heq ↦ ?_⟩ + have e₁ : Even K.length ↔ Even T.length := by rw [heq] + rw [hK', hT'] at e₁ + tauto + +/-- The set-up after step (4) and the paragraph that follows it. -/ +structure IsRound (D : TangleDatum cap χ) (W : Set Shat) (H : Drawing Shat) (ρ : ℕ) (r : Shat) + (Δv : Set Shat) (Dv : Drawing Shat) (ord' : ℕ) + (𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (F : Drawing Shat) (Δ₀ : Set Shat) + (C : Drawing Shat) (Δ : Set Shat) : Prop where + enc : D.IsSectorEnclave W H ρ r Δv Dv ord' 𝒯' F + amb : D.IsAmbientDisc W H ρ F Δ₀ + circuit : C.IsCircuitOf D.rad.G + edges : ∀ e ∈ C.E, e ∈ F.E ∨ e ∈ Dv.E + disc : IsClosedDisc Δ + sub : Δ ⊆ Δ₀ + bd : discBd Δ = C.U + F_sub : D.ins F ⊆ Δ + v_sub : Δv ⊆ Δ + +namespace IsRound + +variable (hr : D.IsRound W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ) +include hr + +/-- **Step (5) of the proof of (13.6).** -/ +theorem card : C.E.ncard ≤ Dv.E.ncard ∧ (C.E.ncard = Dv.E.ncard → D.tb.weightSub C + ≤ D.tb.weightSub Dv) := + uncross_circuit_le χ.isSurface D.P.fits.internally_three_connected D.tb D.isTangle + hr.enc.isTangle' hr.enc.isInsOf_F hr.enc.distinction hr.enc.isInsOf_Dv + hr.enc.mem hr.circuit hr.disc hr.bd hr.F_sub hr.v_sub hr.edges + +theorem C_card : C.E.ncard ≤ 4 * ρ + 4 := hr.card.1.trans hr.enc.Dv_card + +/-- `Δ` is the inside of `C`. -/ +theorem ins_C : D.ins C = Δ := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hle := hr.C_card + have hrep := hr.enc.hrep + have hi := D.ins_spec hr.circuit (by omega) + have hsub := hr.amb.short C hr.circuit hle (hr.bd ▸ (Surface.discBd_subset Δ).trans hr.sub) + exact disc_eq_of_subset_disc hT hr.amb.disc hi.2.2.1 hr.disc hsub hr.sub + (hi.2.2.2.1.trans hr.bd.symm) + +theorem Δ_sub_W (hU : C.U ⊆ W) : Δ ⊆ W := by + rw [← hr.ins_C] + exact hr.enc.wheel.ins_sub C hr.circuit hr.C_card hU + +end IsRound + +/-- The path `M` of step (6), with `Q` the other side of `C`. -/ +structure IsOuterPath (D : TangleDatum cap χ) (W : Set Shat) (C : Drawing Shat) {a b : Shat} + (M : GraphWalk D.rad.G.toGraph a b) + (Q : GraphWalk D.rad.G.toGraph b a) : Prop where + splits : Splits C M Q + ne : a ≠ b + a_bd : a ∈ discBd W + b_bd : b ∈ discBd W + two : 2 ≤ M.length + noint : ∀ x ∈ M.support, x ∉ W \ discBd W + off_int : ∀ e ∈ M.edges, Disjoint e (W \ discBd W) + +omit [T2Space S] [T2Space Shat] in +/-- An edge of `Γ*` at a vertex has another end. -/ +theorem exists_other_end (D : TangleDatum cap χ) {g : Set Shat} (hg : g ∈ D.rad.G.E) {c : Shat} + (hc : c ∈ D.rad.G.V) (hcg : c ∈ closure g) : + ∃ y, y ≠ c ∧ D.rad.G.toGraph.IsLink g c y := by + obtain ⟨p, hp, q, hq, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 g hg + have hm : c ∈ closure g ∩ D.rad.G.V := ⟨hcg, hc⟩ + have hpm : p ∈ closure g ∩ D.rad.G.V := by + rw [hcap] + exact .inl rfl + have hqm : q ∈ closure g ∩ D.rad.G.V := by + rw [hcap] + exact .inr rfl + have hpq : p ≠ q := fun h' ↦ hq.2 (h' ▸ hp) + rw [hcap] at hm + rcases hm with rfl | rfl + · exact ⟨q, hpq.symm, hg, hpm.2, hqm.2, hcap⟩ + · exact ⟨p, hpq, hg, hqm.2, hpm.2, by rw [hcap, pair_comm]⟩ + +omit [T2Space Shat] in +theorem IsLink.left_mem_closure {G : Drawing Shat} {e : Set Shat} {x y : Shat} + (hl : G.toGraph.IsLink e x y) : x ∈ closure e := by + have : x ∈ closure e ∩ G.V := by + rw [hl.2.2.2] + exact .inl rfl + exact this.1 + +omit [T2Space Shat] in +theorem IsLink.right_mem_closure {G : Drawing Shat} {e : Set Shat} {x y : Shat} + (hl : G.toGraph.IsLink e x y) : y ∈ closure e := by + have : y ∈ closure e ∩ G.V := by + rw [hl.2.2.2] + exact .inr rfl + exact this.1 + +omit [T2Space Shat] in +theorem IsLink.symm' {G : Drawing Shat} {e : Set Shat} {x y : Shat} (hl : G.toGraph.IsLink e x y) : + G.toGraph.IsLink e y x := + ⟨hl.1, hl.2.2.1, hl.2.1, by rw [hl.2.2.2, pair_comm]⟩ + +/-- **The path `M` of step (6).** If `U(C)` is not in `W` then `M` is a piece of `C` outside `W`, +and we do not need it to be maximal among the paths +with no edge in `W`. If `U(C) ⊆ W` then `M` is `f₁ ∪ f₂`. -/ +theorem IsRound.exists_outer (hr : D.IsRound W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ) {v₁ v₂ : Shat} {f₁ f₂ + : Set Shat} (hne : v₁ ≠ v₂) + (hl₁ : D.rad.G.toGraph.IsLink f₁ r v₁) (hl₂ : D.rad.G.toGraph.IsLink f₂ r v₂) + (hb₁ : f₁ ⊆ discBd W) (hb₂ : f₂ ⊆ discBd W) (hf₁ : f₁ ∈ Dv.E) (hf₂ : f₂ ∈ Dv.E) + (hvr : r ∉ D.P.Γ.hatV cap) (hv₁ : v₁ ∈ D.P.Γ.hatV cap) (hv₂ : v₂ ∈ D.P.Γ.hatV cap) {c : Shat} + (hc : c ∈ C.V) (hcW : c ∈ W \ discBd W) : + (∃ (a b : Shat) (M : GraphWalk D.rad.G.toGraph a b) (Q : GraphWalk D.rad.G.toGraph b a), + D.IsOuterPath W C M Q ∧ ∀ x ∈ M.support, x ∈ W → x = a ∨ x = b) ∨ + (C.U ⊆ W ∧ ∃ (M : GraphWalk D.rad.G.toGraph v₁ v₂) (Q : GraphWalk D.rad.G.toGraph v₂ v₁), + D.IsOuterPath W C M Q ∧ M.edges = [f₁, f₂]) := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hW := hr.enc.wheel + have hC := hr.circuit + have hstartV : ∀ {a b : Shat} (N : GraphWalk D.rad.G.toGraph a b), a ≠ b → + (∀ e ∈ N.edges, e ∈ C.E) → a ∈ C.V := by + intro a b N hab hE + cases N with + | nil _ => exact absurd rfl hab + | @cons _ y _ e hl r => exact (Drawing.IsLink.mem_V_of_sub hC.1 hl (hE e (by simp))).1 + by_cases hU : C.U ⊆ W + · right + refine ⟨hU, ?_⟩ + have hΔW := hr.Δ_sub_W hU + have hbdf : frontier W = discBd W := IsClosedDisc.frontier_eq_discBd hT hW.is_disc + have hinC : ∀ {f : Set Shat}, f ∈ Dv.E → f ⊆ discBd W → f ∈ C.E := by + intro f hf hfb + by_contra hn + have hfΔ : f ⊆ Δ := fun x hx ↦ hr.v_sub (by + have : x ∈ discBd Δv := by + rw [← hr.enc.sector.Dv_U] + exact Dv.closure_subset_U hf (subset_closure hx) + exact Surface.discBd_subset _ this) + have hfG := hr.enc.sector.Dv_circuit.1.2 hf + obtain ⟨x, hx⟩ := hfG.1 + rcases edge_inside_or_off hT hC.1 hr.disc hr.bd hfG hn with h₁ | h₁ + · have hf' : x ∈ frontier W := hbdf ▸ hfb hx + exact hf'.2 (mem_interior.mpr ⟨_, (discInt_subset _).trans hΔW, + hr.disc.isOpen_discInt hman, h₁ hx⟩) + · exact disjoint_left.mp h₁ hx (hfΔ hx) + have h₁C := hinC hf₁ hb₁ + have h₂C := hinC hf₂ hb₂ + have hcl : ∀ {f : Set Shat}, f ⊆ discBd W → closure f ⊆ discBd W := fun hf ↦ closure_minimal hf + (hbdf ▸ isClosed_frontier) + let M : GraphWalk D.rad.G.toGraph v₁ v₂ := .cons (IsLink.symm' hl₁) (.cons hl₂ (.nil hl₂.2.2.1)) + have hMe : M.edges = [f₁, f₂] := rfl + have hMs : M.support = [v₁, r, v₂] := rfl + have hMsim : M.IsSimple := by + change [v₁, r, v₂].Nodup + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or, + List.nodup_nil, and_true] + exact ⟨⟨fun h' ↦ hvr (h' ▸ hv₁), hne⟩, fun h' ↦ hvr (h' ▸ hv₂), not_false⟩ + have hME : ∀ e ∈ M.edges, e ∈ C.E := fun e he ↦ by + rw [hMe] at he + simp only [List.mem_cons, List.not_mem_nil, or_false] at he + rcases he with rfl | rfl + · exact h₁C + · exact h₂C + have hreverse := hstartV M.reverse hne.symm fun e he ↦ + hME e (by simpa [GraphWalk.edges_reverse] using he) + obtain ⟨W₁, W₂, hs⟩ := exists_splits hC.2 hC.1 (hstartV M hne hME) hreverse hne + obtain ⟨Q, hQ⟩ := exists_side_of_walk hne hMsim hME hs + have hlength : 2 ≤ M.length := by + change 2 ≤ M.edges.length + simp [hMe] + refine ⟨M, Q, ⟨hQ, hne, hcl hb₁ (IsLink.right_mem_closure hl₁), hcl hb₂ + (IsLink.right_mem_closure hl₂), hlength, ?_, ?_⟩, hMe⟩ + · intro x hx hxi + rw [hMs] at hx + simp only [List.mem_cons, List.not_mem_nil, or_false] at hx + rcases hx with rfl | rfl | rfl + · exact hxi.2 (hcl hb₁ (IsLink.right_mem_closure hl₁)) + · exact hxi.2 (hcl hb₁ (IsLink.left_mem_closure hl₁)) + · exact hxi.2 (hcl hb₂ (IsLink.right_mem_closure hl₂)) + · intro e he + rw [hMe] at he + simp only [List.mem_cons, List.not_mem_nil, or_false] at he + rcases he with rfl | rfl + · exact disjoint_left.mpr fun x hx hxi ↦ hxi.2 (hb₁ hx) + · exact disjoint_left.mpr fun x hx hxi ↦ hxi.2 (hb₂ hx) + left + obtain ⟨e, heC, hen⟩ : ∃ e ∈ C.E, ¬ e ⊆ W := by + by_contra hn + push Not at hn + exact hU (U_of_edges hC.2 hW.is_disc.isClosed hn) + have hed : Disjoint e W := (hW.edge_side (hC.1.2 heC)).resolve_left hen + obtain ⟨g, hg, hcg⟩ := exists_edge_at_vertex hC.2 hc + have hgW : g ⊆ W := (hW.edge_side (hC.1.2 hg)).resolve_right fun h' ↦ hcW.2 + (hW.mem_bd_of_closure h' hcg hcW.1) + obtain ⟨y, hyc, hl⟩ := exists_other_end D (hC.1.2 hg) (hC.1.1 hc) hcg + have hyC := (Drawing.IsLink.mem_V_of_sub hC.1 hl hg).2 + have hyW : y ∈ W := closure_minimal hgW hW.is_disc.isClosed (IsLink.right_mem_closure hl) + obtain ⟨W₁, W₂, hs⟩ := exists_splits hC.2 hC.1 hc hyC hyc.symm + obtain ⟨u, v, M, hu, hv, hMs, heM, hME, hinner⟩ : ∃ (u v : Shat) (M : GraphWalk D.rad.G.toGraph u + v), u ∈ W ∧ v ∈ W ∧ M.IsSimple ∧ e ∈ M.edges ∧ + (∀ e ∈ M.edges, e ∈ C.E) ∧ ∀ x ∈ M.support, x ∈ W → x = u ∨ x = v := by + rcases (hs.E e).mp heC with h | h + · obtain ⟨u, v, M, h₁, h₂, h₃, h₄, h₅, h₆⟩ := GraphWalk.exists_piece W₁ hs.s₁ hcW.1 hyW h + exact ⟨u, v, M, h₁, h₂, h₃, h₄, fun e he ↦ (hs.E e).mpr (.inl (h₅ e he)), h₆⟩ + · obtain ⟨u, v, M, h₁, h₂, h₃, h₄, h₅, h₆⟩ := GraphWalk.exists_piece W₂ hs.s₂ hyW hcW.1 h + exact ⟨u, v, M, h₁, h₂, h₃, h₄, fun e he ↦ (hs.E e).mpr (.inr (h₅ e he)), h₆⟩ + have huv : u ≠ v := by + rintro rfl + rw [(simple_self hMs).1] at heM + cases heM + have hMoff : ∀ f ∈ M.edges, Disjoint f W := fun f hf ↦ by + rcases GraphWalk.edge_has_middle M hMs huv hf with h | ⟨x, hxs, hxc, hxu, hxv⟩ + · rw [h] at heM + obtain rfl : e = f := by simpa using heM + exact hed + · refine (hW.edge_side (hC.1.2 (hME f hf))).resolve_left fun h' ↦ ?_ + rcases hinner x hxs (closure_minimal h' hW.is_disc.isClosed hxc) with h'' | h'' + · exact hxu h'' + · exact hxv h'' + have hfirst : ∀ {a b : Shat} (N : GraphWalk D.rad.G.toGraph a b), a ≠ b → + (∀ f ∈ N.edges, Disjoint f W) → a ∈ W → a ∈ discBd W := by + intro a b N hab hE haW + cases N with + | nil _ => exact absurd rfl hab + | @cons _ y _ f hl r => + exact hW.mem_bd_of_closure (hE f (by simp)) (IsLink.left_mem_closure hl) haW + have hub := hfirst M huv hMoff hu + have hvb := hfirst M.reverse huv.symm (fun f hf ↦ hMoff f (by simpa [GraphWalk.edges_reverse] + using hf)) hv + have htwo : 2 ≤ M.length := by + by_contra hn + cases hM : M with + | nil _ => exact huv rfl + | @cons _ y' _ f hl' r => + cases hr' : r with + | cons _ _ => + subst hr' hM + simp [GraphWalk.length_cons] at hn + | nil _ => + subst hr' hM + have hfG := hl'.1 + have ht : tilde f ⊆ discBd W := by + rw [← closure_inter_V_eq_tilde hfG, hl'.2.2.2] + rintro x (rfl | rfl) + · exact hub + · exact hvb + obtain ⟨x, hx⟩ := hfG.1 + exact disjoint_left.mp (hMoff f (by simp)) hx (hW.chord_in_W f hfG ht hx) + obtain ⟨W₃, W₄, hs₂⟩ := exists_splits hC.2 hC.1 (hstartV M huv hME) + (hstartV M.reverse huv.symm fun f hf ↦ hME f (by simpa [GraphWalk.edges_reverse] using hf)) huv + obtain ⟨Q, hQ⟩ := exists_side_of_walk huv hMs hME hs₂ + refine ⟨u, v, M, Q, ⟨hQ, huv, hub, hvb, htwo, fun x hx hxi ↦ ?_, fun f hf ↦ + (hMoff f hf).mono_right sdiff_subset⟩, hinner⟩ + rcases hinner x hx hxi.1 with rfl | rfl + · exact hxi.2 hub + · exact hxi.2 hvb + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13o.lean b/LeanPool/GraphMinor/GM19/Section13o.lean new file mode 100644 index 0000000000..1e724e7a79 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13o.lean @@ -0,0 +1,610 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13n + +/-! +# Graph Minors XIX, Section 13: step (6) of (13.6) + +If `ins(H) ∩ Δ ⊆ U(C)` then `C = D_v`, and so the theorem holds. We count edges along `C`, and then +we compare weights. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {Δv : Set + Shat} {Dv F : Drawing Shat} + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {Δ₀ Δ : Set Shat} {C : + Drawing Shat} + +omit [T2Space Shat] in +/-- A vertex of `Γ*` on `U(C)` is a vertex of `C`. -/ +theorem mem_V_of_mem_U {G C : Drawing Shat} (hC : C.IsSubdrawing G) {x : Shat} (hx : x ∈ C.U) + (hxG : x ∈ G.V) : x ∈ C.V := by + by_contra hn + obtain ⟨g, hg, hxg⟩ := C.exists_edge_of_mem hx hn + exact ((hC.2 hg).2.1 hxg).2 hxG + +namespace IsRound + +variable (hr : D.IsRound W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ) +include hr + +omit [T2Space S] in +/-- A walk from `Δ` that ends at a vertex outside `Δ \ U(C)` meets `C`. -/ +theorem exists_mem_C {a b : Shat} (T : GraphWalk D.rad.G.toGraph a b) (ha : a ∈ Δ) (hb : b ∈ Δ + → b ∈ C.U) : ∃ x ∈ T.support, x ∈ C.V := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hC := hr.circuit + have hbG : b ∈ D.rad.G.V := T.mem_vertexSet_of_mem_support T.end_mem_support + by_contra hn + push Not at hn + have key : ∀ {a b : Shat} (T : GraphWalk D.rad.G.toGraph a b), (∀ x ∈ T.support, x ∉ C.V) → a ∈ Δ + → b ∈ Δ := by + intro a b T + induction T with + | nil _ => exact fun _ h ↦ h + | @cons a y b e hl L ih => + intro hoff ha + refine ih (fun x hx ↦ hoff x (by simp [hx])) ?_ + have heC : e ∉ C.E := fun he ↦ hoff a (by simp) (Drawing.IsLink.mem_V_of_sub hC.1 hl he).1 + have haU : a ∉ C.U := fun h' ↦ hoff a (by simp) (mem_V_of_mem_U hC.1 h' hl.2.1) + have hai : a ∈ discInt Δ := ⟨ha, fun h' ↦ haU (hr.bd ▸ h')⟩ + rcases edge_inside_or_off hT hC.1 hr.disc hr.bd hl.1 heC with h₁ | h₁ + · exact closure_minimal (h₁.trans (discInt_subset _)) hr.disc.isClosed + (IsLink.right_mem_closure hl) + · obtain ⟨z, hzi, hze⟩ := mem_closure_iff.mp (IsLink.left_mem_closure hl) _ + (hr.disc.isOpen_discInt hman) hai + exact absurd hzi.1 (disjoint_left.mp h₁ hze) + have hbΔ := key T hn ha + exact hn b T.end_mem_support (mem_V_of_mem_U hC.1 (hb hbΔ) hbG) + +omit [T2Space S] in +/-- Once `D_v` is in `C`, the theorem holds. -/ +theorem ins_of_E (hE : Dv.E ⊆ C.E) : D.ins F ⊆ Δv := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hC := hr.circuit + have hDv := hr.enc.sector.Dv_circuit + have heq := circuit_E_eq_of_subset hC.2 hDv.2 hC.1 hDv.1 hE + obtain rfl := circuit_eq_of_E hDv.2 hC.2 hDv.1 hC.1 heq + have hΔ : Δv = Δ := disc_eq_of_subset_disc hT hr.amb.disc hr.enc.sector.is_disc hr.disc + (hr.v_sub.trans hr.sub) hr.sub + (hr.enc.sector.Dv_U.symm.trans hr.bd.symm) + rw [hΔ] + exact hr.F_sub + +end IsRound + +omit [T2Space S] in +/-- If `M` has two edges and its ends are vertices of `Γ` on `bd(W)`, then its middle vertex is in +`W`. -/ +theorem IsOuterPath.not_two (hW : D.IsWheelHubOfRadius W H ρ) {C : Drawing Shat} {a b : Shat} {M : + GraphWalk D.rad.G.toGraph a b} {Q : GraphWalk D.rad.G.toGraph b a} + (ho : D.IsOuterPath W C M Q) (hlen : M.length = 2) (ha : a ∈ D.P.Γ.hatV cap) + (hb : b ∈ D.P.Γ.hatV cap) (hin : ∀ x ∈ M.support, x ∈ W → x = a ∨ x = b) : False := by + have hs := ho.splits.s₁ + cases M with + | nil _ => simp [GraphWalk.length] at hlen + | @cons _ y _ g hl L => + cases L with + | nil _ => simp [GraphWalk.length] at hlen + | @cons _ y' _ g' hl' L' => + cases L' with + | @cons _ _ _ _ _ _ => simp [GraphWalk.length] at hlen + | nil _ => + have hnd : ([a, y, b] : List Shat).Nodup := hs + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or, + List.nodup_nil, and_true] at hnd + have hyW : y ∈ W := hW.two_nbrs_in_W y hl.2.2.1 a ⟨ha, ho.a_bd⟩ b ⟨hb, ho.b_bd⟩ ho.ne ⟨g, + hl.1, by + rw [← closure_inter_V_eq_tilde hl.1, hl.2.2.2, pair_comm]⟩ ⟨g', hl'.1, + by rw [← closure_inter_V_eq_tilde hl'.1, hl'.2.2.2]⟩ + rcases hin y (by simp) hyW with h' | h' + · exact hnd.1.1 h'.symm + · exact hnd.2.1 h' + +omit [T2Space Shat] in +/-- A simple walk `K` between two vertices of a simple walk `Q`, with all its edges in `Q`, is a +piece of `Q`. -/ +theorem GraphWalk.eq_piece {G : Drawing Shat} {a b x y : Shat} (A : GraphWalk G.toGraph a x) + (K' : GraphWalk G.toGraph x y) (B : GraphWalk G.toGraph y b) + (hQ : (A.append (K'.append B)).IsSimple) (K : GraphWalk G.toGraph x y) (hK : K.IsSimple) + (hE : ∀ e ∈ K.edges, e ∈ (A.append (K'.append B)).edges) : K' = K := by + have hs₂ := (isSimple_of_append hQ).2 + have hK's := (isSimple_of_append hs₂).1 + have hnd := hQ + unfold GraphWalk.IsSimple at hnd + rw [GraphWalk.support_append, List.nodup_append] at hnd + have hnd₂ := hs₂ + unfold GraphWalk.IsSimple at hnd₂ + rw [GraphWalk.support_append, List.nodup_append] at hnd₂ + have hmem : ∀ z, z ∈ (K'.append B).support → z ∈ A.support → z = x := by + intro z h₁ h₂ + by_contra hn + have h₃ : z ∈ (K'.append B).support.tail := by + obtain ⟨l, hl⟩ : ∃ l, (K'.append B).support = x :: l := by + cases h : K' with + | nil _ => + cases B with + | nil _ => exact ⟨_, rfl⟩ + | cons _ _ => exact ⟨_, rfl⟩ + | cons _ _ => exact ⟨_, rfl⟩ + rw [hl] at h₁ ⊢ + exact (List.mem_cons.mp h₁).resolve_left hn + exact hnd.2.2 _ h₂ _ h₃ rfl + have hmem₂ : ∀ z, z ∈ K'.support → z ∈ B.support → z = y := by + intro z h₁ h₂ + by_contra hn + have h₃ : z ∈ B.support.tail := by + obtain ⟨l, hl⟩ : ∃ l, B.support = y :: l := by + cases B with + | nil _ => exact ⟨_, rfl⟩ + | cons _ _ => exact ⟨_, rfl⟩ + rw [hl] at h₂ ⊢ + exact (List.mem_cons.mp h₂).resolve_left hn + exact hnd₂.2.2 _ h₁ _ h₃ rfl + have h₁ : ∀ e ∈ K.reverse.edges, e ∈ (K'.append B).edges := walk_stays K.reverse hK.reverse + (K'.append B) A + (fun e he ↦ by + have h := hE e (by simpa [GraphWalk.edges_reverse] using he) + rw [GraphWalk.edges_append, List.mem_append] at h + exact h.symm) + (fun z _ h₁ h₂ ↦ hmem z h₁ h₂) ((GraphWalk.mem_support_append _ _).mpr + (.inl K'.end_mem_support)) + (fun {e x y} hl he _ ↦ (K'.append B).left_mem_support_of_mem_edges he (IsLink.symm' hl)) + (fun {e x y} hl he ↦ A.left_mem_support_of_mem_edges he hl) + have h₂ : ∀ e ∈ K.edges, e ∈ K'.edges := walk_stays K hK K' B + (fun e he ↦ by + have h := h₁ e (by simpa [GraphWalk.edges_reverse] using he) + rwa [GraphWalk.edges_append, List.mem_append] at h) + (fun z _ h₁ h₂ ↦ hmem₂ z h₁ h₂) K'.start_mem_support + (fun {e x y} hl he _ ↦ K'.left_mem_support_of_mem_edges he (IsLink.symm' hl)) + (fun {e x y} hl he ↦ B.left_mem_support_of_mem_edges he hl) + exact simple_walk_unique K' K hK's hK h₂ + +/-- **Step (6) of the proof of (13.6) when the spokes meet.** -/ +theorem IsRound.step_six_fan (hr : D.IsRound W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ) {v₁ v₂ u h : Shat} {f₁ + f₂ : Set Shat} {A₁ : GraphWalk D.rad.G.toGraph v₁ u} + {A₂ : GraphWalk D.rad.G.toGraph v₂ u} {T : GraphWalk D.rad.G.toGraph u h} + (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hc : D.IsFanCircuit r f₁ f₂ A₁ A₂ Dv) + (hb₁ : f₁ ⊆ discBd W) (hb₂ : f₂ ⊆ discBd W) (hh : h ∈ Δ → h ∈ C.U) : D.ins F ⊆ Δv := by + classical + have : ConnectedSpace Shat := cap.connected + have hW := hr.enc.wheel + have hbdS := hr.enc.hbdS + have hin := hr.enc.hin + have hCc := hr.circuit + have h1 := hf.spoke₁ + have h2 := hf.spoke₂ + have hDvΔ : Dv.U ⊆ Δ := fun x hx ↦ hr.v_sub (by + rw [hr.enc.sector.Dv_U] at hx + exact Surface.discBd_subset _ hx) + have huΔ : u ∈ Δ := hDvΔ (Dv.V_subset_U ((hc.mem_V u).mpr (.inr (.inl A₁.end_mem_support)))) + obtain ⟨c, hcX, T', L, rfl, hlast⟩ := GraphWalk.exists_last_mem T (X := C.V) + (hr.exists_mem_C T huΔ hh) + have hch₁ : c ∈ (A₁.append (T'.append L)).support := + (GraphWalk.mem_support_append _ _).mpr (.inr ((GraphWalk.mem_support_append _ _).mpr + (.inl T'.end_mem_support))) + have hch₂ : c ∈ (A₂.append (T'.append L)).support := + (GraphWalk.mem_support_append _ _).mpr (.inr ((GraphWalk.mem_support_append _ _).mpr + (.inl T'.end_mem_support))) + have hcW : c ∈ W \ discBd W := by + refine ⟨h1.subset_W hW hbdS hin ((mem_walkDrawing_U _ _).mpr (.inl hch₁)), ?_⟩ + by_cases hcv : c = v₁ + · exact h2.tail_off_bd hW hbdS hin hch₂ (hcv ▸ hf.ne) + · exact h1.tail_off_bd hW hbdS hin hch₁ hcv + have hf₁ : f₁ ∈ Dv.E := (hc.mem_E _).mpr (.inl rfl) + have hf₂ : f₂ ∈ Dv.E := (hc.mem_E _).mpr (.inr (.inl rfl)) + have hrep := hr.enc.hrep + -- the count, for either form of `M` + have hcount : ∀ {a b : Shat} {M : GraphWalk D.rad.G.toGraph a b} {Q : GraphWalk D.rad.G.toGraph b + a}, D.IsOuterPath W C M Q → ∃ (Q₁ : GraphWalk D.rad.G.toGraph b c) + (Q₂ : GraphWalk D.rad.G.toGraph c a), Q = Q₁.append Q₂ ∧ T'.length = 0 ∧ M.length = 2 + ∧ a ∈ D.P.Γ.hatV cap ∧ b ∈ D.P.Γ.hatV cap ∧ C.E.ncard = Dv.E.ncard ∧ + A₁.length + T'.length + L.length = Q₂.reverse.length + L.length + ∧ A₂.length + T'.length + L.length = Q₁.length + L.length := by + intro a b M Q ho + have hcQ : c ∈ Q.support := ((ho.splits.V c).mp hcX).resolve_left fun h' ↦ ho.noint c h' hcW + obtain ⟨Q₁, Q₂, rfl⟩ := Q.exists_append_of_mem hcQ + have haG : a ∈ D.rad.G.V := Q₂.mem_vertexSet_of_mem_support Q₂.end_mem_support + have hbG : b ∈ D.rad.G.V := Q₁.mem_vertexSet_of_mem_support Q₁.start_mem_support + have lA := h1.le_walk_of_bd hW hbdS hin (Q₂.reverse.append L) haG ho.a_bd + have lB := h2.le_walk_of_bd hW hbdS hin (Q₁.append L) hbG ho.b_bd + simp only [GraphWalk.length_append] at lA lB + have e₁ : (edgeSet M).ncard = M.length := by + rw [← ncard_walk_E D.rad.G ho.splits.s₁, walkDrawing_E] + rfl + have e₂ : (edgeSet (Q₁.append Q₂)).ncard = (Q₁.append Q₂).length := by + rw [← ncard_walk_E D.rad.G ho.splits.s₂, walkDrawing_E] + rfl + have e₃ := ho.splits.card_add + have e₄ : C.length = C.E.ncard := rfl + have e₅ := hr.card.1 + have e₆ := hc.card + have e₇ := ho.two + have e₈ : Q₂.reverse.length = Q₂.length := GraphWalk.length_reverse _ + rw [GraphWalk.length_append] at e₂ + have heq₁ : A₁.length + (T'.length + L.length) = Q₂.reverse.length + L.length := by omega + have heq₂ : A₂.length + (T'.length + L.length) = Q₁.length + L.length := by omega + exact ⟨Q₁, Q₂, rfl, by omega, by omega, lA.2 heq₁, lB.2 heq₂, by omega, by omega, by omega⟩ + have hout := hr.exists_outer hf.ne hf.link₁ hf.link₂ hb₁ hb₂ hf₁ hf₂ hf.r_mem.2 h1.2.v_mem.1 + h2.2.v_mem.1 hcX hcW + rcases hout with ⟨a, b, M, Q, ho, hinner⟩ | ⟨hU, M, Q, ho, hMe⟩ + · obtain ⟨Q₁, Q₂, rfl, -, hl, ha, hb, -⟩ := hcount ho + exact (ho.not_two hW hl ha hb hinner).elim + obtain ⟨Q₁, Q₂, rfl, hT0, -, -, -, hcard, l₁, l₂⟩ := hcount ho + obtain rfl : c = u := by + cases T' with + | nil _ => rfl + | cons _ _ => simp [GraphWalk.length] at hT0 + have hT'e : T'.edges = [] := List.length_eq_zero_iff.mp hT0 + have hT'w : D.tb.walkWeight T' = 0 := by simp [TieBreaker.walkWeight, hT'e] + have hLs : L.IsSimple := (GraphWalk.IsSimple.of_append (GraphWalk.IsSimple.of_append h1.1).2).2 + have hQs := ho.splits.s₂ + have hQ₁s := (GraphWalk.IsSimple.of_append hQs).1 + have hQ₂s := (GraphWalk.IsSimple.of_append hQs).2 + have hsupC : ∀ x ∈ (Q₁.append Q₂).support, x ∈ C.V := fun x hx ↦ (ho.splits.V x).mpr (.inr hx) + have hs₁ : (Q₂.reverse.append L).IsSimple := isSimple_append' hQ₂s.reverse hLs fun y hy₁ hy₂ ↦ + hlast y hy₂ (hsupC y ((GraphWalk.mem_support_append _ _).mpr (.inr + (by simpa [GraphWalk.support_reverse] using hy₁)))) + have hs₂ : (Q₁.append L).IsSimple := isSimple_append' hQ₁s hLs fun y hy₁ hy₂ ↦ + hlast y hy₂ (hsupC y ((GraphWalk.mem_support_append _ _).mpr (.inl hy₁))) + have b₁ := (h1.bound h2.2.h_mem (Q₂.reverse.append L)).2 (by + simp only [GraphWalk.length_append] at l₁ ⊢ + omega) + have b₂ := (h2.bound h2.2.h_mem (Q₁.append L)).2 (by + simp only [GraphWalk.length_append] at l₂ ⊢ + omega) + simp only [TieBreaker.walkWeight_append, TieBreaker.walkWeight_reverse, hT'w, zero_add] at b₁ b₂ + have w₁ := hr.card.2 hcard + have w₂ := D.tb.weightSub_eq_of_splits ho.splits + rw [TieBreaker.walkWeight_append] at w₂ + have w₃ : D.tb.walkWeight M = D.tb.wtE f₁ + D.tb.wtE f₂ := by simp [TieBreaker.walkWeight, hMe] + let R : GraphWalk D.rad.G.toGraph c c := A₁.reverse.append (.cons (IsLink.symm' hf.link₁) + (.cons hf.link₂ A₂)) + have hR : ∀ e ∈ Dv.E, e ∈ R.edges := fun e he ↦ by + simp only [R, GraphWalk.edges_append, GraphWalk.edges_cons, GraphWalk.edges_reverse, + List.mem_append, List.mem_reverse, List.mem_cons] + have := (hc.mem_E e).mp he + tauto + have w₄ := D.tb.weightSub_le_of_edges R hR + have w₅ : D.tb.walkWeight R = D.tb.walkWeight A₁ + D.tb.wtE f₁ + D.tb.wtE f₂ + D.tb.walkWeight A₂ + := by + simp only [R, TieBreaker.walkWeight_append, TieBreaker.walkWeight_reverse] + simp [TieBreaker.walkWeight] + ring + have eq₁ : D.tb.walkWeight (A₁.append (T'.append L)) = D.tb.walkWeight (Q₂.reverse.append L) := by + simp only [TieBreaker.walkWeight_append, TieBreaker.walkWeight_reverse, hT'w, zero_add] + linarith + have eq₂ : D.tb.walkWeight (A₂.append (T'.append L)) = D.tb.walkWeight (Q₁.append L) := by + simp only [TieBreaker.walkWeight_append, hT'w, zero_add] + linarith + have sub₁ := D.edges_eq_of_weight_eq h1.1 hs₁ eq₁ + have sub₂ := D.edges_eq_of_weight_eq h2.1 hs₂ eq₂ + refine hr.ins_of_E fun e he ↦ ?_ + have hM : ∀ e ∈ M.edges, e ∈ C.E := fun e he ↦ (ho.splits.E e).mpr (.inl he) + have hQ : ∀ e, e ∈ Q₁.edges ∨ e ∈ Q₂.edges → e ∈ C.E := fun e he ↦ (ho.splits.E e).mpr (.inr (by + rw [GraphWalk.edges_append, List.mem_append] + exact he)) + rcases (hc.mem_E e).mp he with rfl | rfl | he' | he' + · exact hM _ (by simp [hMe]) + · exact hM _ (by simp [hMe]) + · have h₃ := (sub₁ e).mp (by + rw [GraphWalk.edges_append] + exact List.mem_append_left _ he') + rw [GraphWalk.edges_append, GraphWalk.edges_reverse, List.mem_append, List.mem_reverse] at h₃ + rcases h₃ with h₃ | h₃ + · exact hQ e (.inr h₃) + · refine absurd ?_ (hf.edges_disjoint_T e he') + rw [GraphWalk.edges_append] + exact List.mem_append_right _ h₃ + · have h₃ := (sub₂ e).mp (by + rw [GraphWalk.edges_append] + exact List.mem_append_left _ he') + rw [GraphWalk.edges_append, List.mem_append] at h₃ + rcases h₃ with h₃ | h₃ + · exact hQ e (.inl h₃) + · refine absurd ?_ (hf.swap.edges_disjoint_T e he') + rw [GraphWalk.edges_append] + exact List.mem_append_right _ h₃ + +private theorem sector_supported_by_closed_walk + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [TopologicalSpace Shat] + [T2Space Shat] + {α : Type w} + {cap : IsCappedSurface S Shat} + {χ : ColourScheme S α} + {D : TangleDatum cap χ} + {r : Shat} + {Dv : Drawing Shat} + {v₁ : Shat} + {v₂ : Shat} + {h₁ : Shat} + {h₂ : Shat} + {f₁ : Set Shat} + {f₂ : Set Shat} + {K₁ : GraphWalk (Drawing.toGraph D.rad.G) v₁ h₁} + {K₂ : GraphWalk (Drawing.toGraph D.rad.G) v₂ h₂} + {P : Drawing Shat} + (hl₁ : (Drawing.toGraph D.rad.G).IsLink f₁ r v₁) + (hl₂ : (Drawing.toGraph D.rad.G).IsLink f₂ r v₂) + (hUform : (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ∪ P.U ∪ closure f₁ ∪ closure + f₂ = Dv.U) + (K₀ : GraphWalk (Drawing.toGraph D.rad.G) h₁ h₂) + (hV₀ : ∀ (x : Shat), x ∈ P.V ↔ x ∈ K₀.support) + (hE₀ : ∀ (e : Set Shat), e ∈ Drawing.E P ↔ e ∈ K₀.edges) : + let R : GraphWalk (Drawing.toGraph D.rad.G) h₁ h₁ := K₁.reverse.append (GraphWalk.cons + (IsLink.symm' hl₁) (GraphWalk.cons hl₂ (K₂.append K₀.reverse))) + Dv.U ⊆ (walkDrawing D.rad.G R).U := by + intro R x hx + rw [mem_walkDrawing_U] + rw [← hUform] at hx + have hRs : ∀ x, x ∈ K₁.support ∨ x ∈ K₂.support ∨ x ∈ K₀.support → x ∈ R.support + := fun x hx ↦ by + simp only [R, GraphWalk.mem_support_append, GraphWalk.support_reverse, List.mem_reverse, + GraphWalk.support_cons, List.mem_cons] + tauto + have hRe : ∀ e, e = f₁ ∨ e = f₂ ∨ e ∈ K₁.edges ∨ e ∈ K₂.edges ∨ e ∈ K₀.edges → e ∈ R.edges + := fun e he ↦ by + simp only [R, GraphWalk.edges_append, GraphWalk.edges_reverse, GraphWalk.edges_cons, + List.mem_append, List.mem_reverse, List.mem_cons] + tauto + rcases hx with (((hx | hx) | hx) | hx) | hx + · rcases (mem_walkDrawing_U _ _).mp hx with h' | ⟨e, he, hxe⟩ + · exact .inl (hRs x (.inl h')) + · exact .inr ⟨e, hRe e (by tauto), hxe⟩ + · rcases (mem_walkDrawing_U _ _).mp hx with h' | ⟨e, he, hxe⟩ + · exact .inl (hRs x (.inr (.inl h'))) + · exact .inr ⟨e, hRe e (by tauto), hxe⟩ + · by_cases hxV : x ∈ P.V + · exact .inl (hRs x (.inr (.inr ((hV₀ x).mp hxV)))) + · obtain ⟨g, hg, hxg⟩ := P.exists_edge_of_mem hx hxV + exact .inr ⟨g, hRe g (.inr (.inr (.inr (.inr ((hE₀ g).mp hg))))), subset_closure hxg⟩ + · exact .inr ⟨f₁, hRe _ (.inl rfl), hx⟩ + · exact .inr ⟨f₂, hRe _ (.inr (.inl rfl)), hx⟩ + +/-- **Step (6) of the proof of (13.6) when the spokes do not meet.** -/ +theorem IsRound.step_six_path (hr : D.IsRound W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ) {v₁ v₂ h₁ h₂ : Shat} + {f₁ f₂ : Set Shat} {K₁ : GraphWalk D.rad.G.toGraph v₁ h₁} + {K₂ : GraphWalk D.rad.G.toGraph v₂ h₂} {P : Drawing Shat} (hne : v₁ ≠ v₂) + (hl₁ : D.rad.G.toGraph.IsLink f₁ r v₁) (hl₂ : D.rad.G.toGraph.IsLink f₂ r v₂) + (hb₁ : f₁ ⊆ discBd W) (hb₂ : f₂ ⊆ discBd W) (h1 : D.IsSpokeWalk W H K₁) + (h2 : D.IsSpokeWalk W H K₂) (hdis : ∀ x ∈ K₁.support, x ∉ K₂.support) + (hP : Drawing.IsPathOf P H h₁ h₂) (hbd : discBd Δv = (walkDrawing D.rad.G K₁).U ∪ + (walkDrawing D.rad.G K₂).U ∪ P.U ∪ closure f₁ ∪ closure f₂) + (hh : H.U ∩ Δ ⊆ C.U) : D.ins F ⊆ Δv := by + classical + have : ConnectedSpace Shat := cap.connected + have hW := hr.enc.wheel + have hbdS := hr.enc.hbdS + have hin := hr.enc.hin + have hCc := hr.circuit + have hDv := hr.enc.sector.Dv_circuit + have hrr := hr.enc.sector.rstar_mem + have hDvΔ : Dv.U ⊆ Δ := fun x hx ↦ hr.v_sub (by + rw [hr.enc.sector.Dv_U] at hx + exact Surface.discBd_subset _ hx) + have hUform : (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ∪ P.U ∪ closure f₁ ∪ + closure f₂ = Dv.U := by + rw [← hbd, hr.enc.sector.Dv_U] + have hPG : Drawing.IsPathOf P D.rad.G h₁ h₂ := ⟨hP.1.trans hW.H_sub, hP.2⟩ + obtain ⟨K₀, hK₀, hV₀, hE₀⟩ := Drawing.IsPathOf.exists_simple_walk hPG + have hPH : P.U ⊆ H.U := hP.1.U_subset + have hPDv : P.U ⊆ Dv.U := fun x hx ↦ hUform ▸ .inl (.inl (.inr hx)) + have hPC : P.U ⊆ C.U := fun x hx ↦ hh ⟨hPH hx, hDvΔ (hPDv hx)⟩ + have hne12 : h₁ ≠ h₂ := fun h' ↦ hdis h₁ K₁.end_mem_support (h' ▸ K₂.end_mem_support) + have hV₀P : ∀ x ∈ K₀.support, x ∈ P.U := fun x hx ↦ P.V_subset_U ((hV₀ x).mpr hx) + have hedgeU : ∀ e ∈ K₀.edges, e ⊆ P.U := fun e he ↦ subset_closure.trans (P.closure_subset_U + ((hE₀ e).mpr he)) + have hK₀C : ∀ e ∈ K₀.edges, e ∈ C.E := fun e he ↦ by + by_contra hn + have heG : e ∈ D.rad.G.E := hPG.1.2 ((hE₀ e).mpr he) + obtain ⟨x, hx⟩ := heG.1 + exact disjoint_left.mp (edge_disjoint_U hCc.1 heG hn) hx (hPC (hedgeU e he hx)) + have hh₁C : h₁ ∈ C.V := mem_V_of_mem_U hCc.1 (hPC (hV₀P _ K₀.start_mem_support)) + (K₀.mem_vertexSet_of_mem_support K₀.start_mem_support) + have hh₂C : h₂ ∈ C.V := mem_V_of_mem_U hCc.1 (hPC (hV₀P _ K₀.end_mem_support)) + (K₀.mem_vertexSet_of_mem_support K₀.end_mem_support) + have hh₁W : h₁ ∈ W \ discBd W := hW.H_in_int (H.V_subset_U h1.2.h_mem) + have hh₂W : h₂ ∈ W \ discBd W := hW.H_in_int (H.V_subset_U h2.2.h_mem) + have hedgeDv : ∀ {e : Set Shat}, e ∈ D.rad.G.E → e ⊆ Dv.U → e ∈ Dv.E := fun {e} heG hs ↦ by + by_contra hn + obtain ⟨x, hx⟩ := heG.1 + exact disjoint_left.mp (edge_disjoint_U hDv.1 heG hn) hx (hs hx) + have hf₁ : f₁ ∈ Dv.E := hedgeDv hl₁.1 (subset_closure.trans fun x hx ↦ hUform ▸ .inl (.inr hx)) + have hf₂ : f₂ ∈ Dv.E := hedgeDv hl₂.1 (subset_closure.trans fun x hx ↦ hUform ▸ .inr hx) + let R : GraphWalk D.rad.G.toGraph h₁ h₁ := K₁.reverse.append (.cons (IsLink.symm' hl₁) (.cons hl₂ + (K₂.append K₀.reverse))) + have hRU : Dv.U ⊆ (walkDrawing D.rad.G R).U := by + exact sector_supported_by_closed_walk (S := S) (Shat := Shat) (α := α) (cap := cap) (χ := χ) + (D := D) (r := r) (Dv := Dv) (v₁ := v₁) (v₂ := v₂) (h₁ := h₁) (h₂ := h₂) (f₁ := f₁) (f₂ := + f₂) (K₁ := K₁) (K₂ := K₂) (P := P) hl₁ hl₂ hUform K₀ hV₀ hE₀ + have hRE : ∀ e ∈ Dv.E, e ∈ R.edges := fun e he ↦ by + by_contra hn + have heG := hDv.1.2 he + obtain ⟨x, hx⟩ := heG.1 + have hn' : e ∉ (walkDrawing D.rad.G R).E := fun h' ↦ hn (by rwa [walkDrawing_E] at h') + exact disjoint_left.mp (edge_disjoint_U (walkDrawing_isSubdrawing _ _) heG hn') hx (hRU + (Dv.closure_subset_U he (subset_closure hx))) + have hRl : R.length = K₁.length + K₂.length + K₀.length + 2 := by + simp only [R, GraphWalk.length_append, GraphWalk.length_reverse, GraphWalk.length_cons] + omega + have hcount : ∀ {a b : Shat} {M : GraphWalk D.rad.G.toGraph a b} {Q : GraphWalk D.rad.G.toGraph b + a}, D.IsOuterPath W C M Q → + ∃ (x₁ x₂ : Shat) (X₁ : GraphWalk D.rad.G.toGraph x₁ h₁) (X₂ : GraphWalk D.rad.G.toGraph x₂ + h₂), ((x₁ = a ∧ x₂ = b) ∨ (x₁ = b ∧ x₂ = a)) ∧ X₁.IsSimple ∧ X₂.IsSimple ∧ + (∀ e, e ∈ Q.edges ↔ e ∈ X₁.edges ∨ e ∈ X₂.edges ∨ e ∈ K₀.edges) ∧ D.tb.walkWeight Q + = D.tb.walkWeight X₁ + D.tb.walkWeight X₂ + D.tb.walkWeight K₀ ∧ + M.length = 2 ∧ X₁.length = K₁.length ∧ X₂.length = K₂.length ∧ a ∈ D.P.Γ.hatV cap + ∧ b ∈ D.P.Γ.hatV cap ∧ C.E.ncard = Dv.E.ncard := by + intro a b M Q ho + have hoffM : ∀ e ∈ K₀.edges, e ∉ M.edges := fun e he heM ↦ by + have heG : e ∈ D.rad.G.E := hPG.1.2 ((hE₀ e).mpr he) + obtain ⟨x, hx⟩ := heG.1 + exact disjoint_left.mp (ho.off_int e heM) hx (hW.H_in_int (hPH (hedgeU e he hx))) + have hE₀Q : ∀ e ∈ K₀.edges, e ∈ Q.edges := fun e he ↦ ((ho.splits.E e).mp + (hK₀C e he)).resolve_left (hoffM e he) + have hh₁Q : h₁ ∈ Q.support := ((ho.splits.V _).mp hh₁C).resolve_left fun h' ↦ ho.noint _ h' hh₁W + have hh₂Q : h₂ ∈ Q.support := ((ho.splits.V _).mp hh₂C).resolve_left fun h' ↦ ho.noint _ h' hh₂W + have hform : (∃ (A : GraphWalk D.rad.G.toGraph b h₁) (B : GraphWalk D.rad.G.toGraph h₂ a), Q + = A.append (K₀.append B)) ∨ + (∃ (A : GraphWalk D.rad.G.toGraph b h₂) (B : GraphWalk D.rad.G.toGraph h₁ a), Q = A.append + (K₀.reverse.append B)) := by + obtain ⟨A₀, B₀, hQ⟩ := Q.exists_append_of_mem hh₁Q + by_cases hy : h₂ ∈ B₀.support + · left + obtain ⟨K', B, rfl⟩ := B₀.exists_append_of_mem hy + subst hQ + obtain rfl := GraphWalk.eq_piece A₀ K' B ho.splits.s₂ K₀ hK₀ hE₀Q + exact ⟨A₀, B, rfl⟩ + · right + subst hQ + have hy' : h₂ ∈ A₀.support := ((GraphWalk.mem_support_append _ _).mp hh₂Q).resolve_right hy + obtain ⟨A', K', rfl⟩ := A₀.exists_append_of_mem hy' + have hass := GraphWalk.append_assoc' A' K' B₀ + rw [hass] at ho hE₀Q ⊢ + obtain rfl := GraphWalk.eq_piece A' K' B₀ ho.splits.s₂ K₀.reverse hK₀.reverse fun e he ↦ + hE₀Q e (by simpa [GraphWalk.edges_reverse] using he) + exact ⟨A', B₀, rfl⟩ + have hstruct : ∃ (x₁ x₂ : Shat) (X₁ : GraphWalk D.rad.G.toGraph x₁ h₁) + (X₂ : GraphWalk D.rad.G.toGraph x₂ h₂), ((x₁ = a ∧ x₂ = b) ∨ (x₁ = b ∧ x₂ = a)) ∧ + X₁.IsSimple ∧ X₂.IsSimple ∧ + (∀ e, e ∈ Q.edges ↔ e ∈ X₁.edges ∨ e ∈ X₂.edges ∨ e ∈ K₀.edges) ∧ D.tb.walkWeight Q + = D.tb.walkWeight X₁ + D.tb.walkWeight X₂ + D.tb.walkWeight K₀ ∧ + Q.length = X₁.length + X₂.length + K₀.length := by + rcases hform with ⟨A, B, rfl⟩ | ⟨A, B, rfl⟩ + · have hs₁ := (And.intro (isSimple_of_append ho.splits.s₂).1 (isSimple_of_append + ho.splits.s₂).2) + have hs₂ := (And.intro (isSimple_of_append hs₁.2).1 (isSimple_of_append hs₁.2).2) + refine ⟨b, a, A, B.reverse, .inr ⟨rfl, rfl⟩, hs₁.1, hs₂.2.reverse, fun e ↦ ?_, ?_, ?_⟩ + · simp only [GraphWalk.edges_append, GraphWalk.edges_reverse, List.mem_append, + List.mem_reverse] + tauto + · simp only [TieBreaker.walkWeight_append, TieBreaker.walkWeight_reverse] + ring + · simp only [GraphWalk.length_append, GraphWalk.length_reverse] + omega + · have hs₁ := (And.intro (isSimple_of_append ho.splits.s₂).1 (isSimple_of_append + ho.splits.s₂).2) + have hs₂ := (And.intro (isSimple_of_append hs₁.2).1 (isSimple_of_append hs₁.2).2) + refine ⟨a, b, B.reverse, A, .inl ⟨rfl, rfl⟩, hs₂.2.reverse, hs₁.1, fun e ↦ ?_, ?_, ?_⟩ + · simp only [GraphWalk.edges_append, GraphWalk.edges_reverse, List.mem_append, + List.mem_reverse] + tauto + · simp only [TieBreaker.walkWeight_append, TieBreaker.walkWeight_reverse] + ring + · simp only [GraphWalk.length_append, GraphWalk.length_reverse] + omega + obtain ⟨x₁, x₂, X₁, X₂, hx, hX₁, hX₂, hEq, hwq, hlq⟩ := hstruct + have hbdx : x₁ ∈ discBd W ∧ x₂ ∈ discBd W := by + rcases hx with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨ho.a_bd, ho.b_bd⟩ + · exact ⟨ho.b_bd, ho.a_bd⟩ + have lA := h1.le_walk_of_bd hW hbdS hin X₁ (X₁.mem_vertexSet_of_mem_support + X₁.start_mem_support) hbdx.1 + have lB := h2.le_walk_of_bd hW hbdS hin X₂ (X₂.mem_vertexSet_of_mem_support + X₂.start_mem_support) hbdx.2 + have e₁ : (edgeSet M).ncard = M.length := by + rw [← ncard_walk_E D.rad.G ho.splits.s₁, walkDrawing_E] + rfl + have e₂ : (edgeSet Q).ncard = Q.length := by + rw [← ncard_walk_E D.rad.G ho.splits.s₂, walkDrawing_E] + rfl + have e₃ := ho.splits.card_add + have e₄ : C.length = C.E.ncard := rfl + have e₅ := hr.card.1 + have e₆ := ncard_le_length_of_edges (G := D.rad.G) R hRE + have e₇ := ho.two + have h₁e : K₁.length = X₁.length := by omega + have h₂e : K₂.length = X₂.length := by omega + have hat₁ := lA.2 h₁e + have hat₂ := lB.2 h₂e + have hab : a ∈ D.P.Γ.hatV cap ∧ b ∈ D.P.Γ.hatV cap := by + rcases hx with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨hat₁, hat₂⟩ + · exact ⟨hat₂, hat₁⟩ + exact ⟨x₁, x₂, X₁, X₂, hx, hX₁, hX₂, hEq, hwq, by omega, by omega, by omega, hab.1, hab.2, + by omega⟩ + have hout := hr.exists_outer hne hl₁ hl₂ hb₁ hb₂ hf₁ hf₂ hrr.1.2 h1.2.v_mem.1 h2.2.v_mem.1 hh₁C + hh₁W + rcases hout with ⟨a, b, M, Q, ho, hinner⟩ | ⟨hU, M, Q, ho, hMe⟩ + · obtain ⟨-, -, -, -, -, -, -, -, -, hl, -, -, ha, hb, -⟩ := hcount ho + exact (ho.not_two hW hl ha hb hinner).elim + obtain ⟨x₁, x₂, X₁, X₂, hx, hX₁, hX₂, hEq, hwq, -, hl₃, hl₄, -, -, hcard⟩ := hcount ho + have w₁ := hr.card.2 hcard + have w₂ := D.tb.weightSub_eq_of_splits ho.splits + have w₃ : D.tb.walkWeight M = D.tb.wtE f₁ + D.tb.wtE f₂ := by simp [TieBreaker.walkWeight, hMe] + have w₄ := D.tb.weightSub_le_of_edges R hRE + have w₅ : D.tb.walkWeight R = D.tb.walkWeight K₁ + D.tb.wtE f₁ + D.tb.wtE f₂ + D.tb.walkWeight K₂ + + D.tb.walkWeight K₀ := by + have w₀ : D.tb.walkWeight (K₂.append K₀.reverse) = D.tb.walkWeight K₂ + D.tb.walkWeight K₀ := by + rw [TieBreaker.walkWeight_append, TieBreaker.walkWeight_reverse] + simp only [R, TieBreaker.walkWeight_append, TieBreaker.walkWeight_reverse] + simp only [TieBreaker.walkWeight] at w₀ ⊢ + simp only [GraphWalk.edges_cons, List.map_cons, List.sum_cons] + rw [w₀] + ring + rcases hx with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · have b₁ := (h1.bound h1.2.h_mem X₁).2 hl₃ + have b₂ := (h2.bound h2.2.h_mem X₂).2 hl₄ + have sub₁ := D.edges_eq_of_weight_eq h1.1 hX₁ (by linarith) + have sub₂ := D.edges_eq_of_weight_eq h2.1 hX₂ (by linarith) + refine hr.ins_of_E fun e he ↦ ?_ + have h₃ := hRE e he + simp only [R, GraphWalk.edges_append, GraphWalk.edges_reverse, GraphWalk.edges_cons, + List.mem_append, List.mem_reverse, List.mem_cons] at h₃ + have hM : ∀ e ∈ M.edges, e ∈ C.E := fun e he ↦ (ho.splits.E e).mpr (.inl he) + have hQ : ∀ e ∈ Q.edges, e ∈ C.E := fun e he ↦ (ho.splits.E e).mpr (.inr he) + rcases h₃ with h₃ | rfl | rfl | h₃ | h₃ + · exact hQ e ((hEq e).mpr (.inl ((sub₁ e).mp h₃))) + · exact hM _ (by simp [hMe]) + · exact hM _ (by simp [hMe]) + · exact hQ e ((hEq e).mpr (.inr (.inl ((sub₂ e).mp h₃)))) + · exact hK₀C e h₃ + · exfalso + have b₁ := h2.bound h1.2.h_mem X₁ + have b₂ := h1.bound h2.2.h_mem X₂ + have heq₁ : X₁.length = K₂.length := by omega + have heq₂ : X₂.length = K₁.length := by omega + have w₆ := b₁.2 heq₁ + have w₇ := b₂.2 heq₂ + have sub := D.edges_eq_of_weight_eq h2.1 hX₁ (by linarith) + exact hne12 (simple_walks_eq K₂ X₁ h2.1 hX₁ sub).1.symm + +/-- **Step (6) of the proof of (13.6).** -/ +theorem IsRound.step_six (hr : D.IsRound W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ) + (hh : H.U ∩ Δ ⊆ C.U) : D.ins F ⊆ Δv := by + have hW := hr.enc.wheel + rcases hr.enc.sector.cases hW hr.enc.hbdS hr.enc.hin with ⟨v₁, v₂, u, h, f₁, f₂, A₁, A₂, T, hf, + hC, hb₁, hb₂⟩ | + ⟨v₁, v₂, h₁, h₂, f₁, f₂, K₁, K₂, P, hne, hl₁, hl₂, hb₁, hb₂, h1, h2, hdis, hP, hbd, -⟩ + · exact hr.step_six_fan hf hC hb₁ hb₂ fun hm ↦ hh ⟨H.V_subset_U hf.spoke₁.2.h_mem, hm⟩ + · exact hr.step_six_path hne hl₁ hl₂ hb₁ hb₂ h1 h2 hdis hP hbd hh + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13p.lean b/LeanPool/GraphMinor/GM19/Section13p.lean new file mode 100644 index 0000000000..225e0d573c --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13p.lean @@ -0,0 +1,558 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13o + +/-! +# Graph Minors XIX, Section 13: the point `h` and the arcs in the proof of (13.6) + +From here on we suppose that `ins(H) ∩ Δ ⊄ U(C)`, and we seek a contradiction. We take the point +`h`, and we show that `F` has an inner arc and an outer arc. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +omit [T2Space Shat] in +/-- If a disc in the disc of `B` is bounded by a circuit `A`, and `C ⊆ A ∪ B` bounds a disc that +holds the disc of `B`, then `C ⊆ B`. -/ +theorem edges_of_nested (hT : IsClosedSurface Shat) {G A B C : Drawing Shat} + {ΔA ΔB Δ : Set Shat} (hB : B.IsCircuitOf G) (hC : C.IsCircuitOf G) (hΔB : IsClosedDisc ΔB) + (hbB : discBd ΔB = B.U) (hbA : discBd ΔA = A.U) (hAB : ΔA ⊆ ΔB) (hΔ : IsClosedDisc Δ) + (hb : discBd Δ = C.U) + (hBΔ : ΔB ⊆ Δ) (hE : ∀ e ∈ C.E, e ∈ A.E ∨ e ∈ B.E) : ∀ e ∈ C.E, e ∈ B.E := by + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + intro e he + rcases hE e he with h₁ | h₁ + · by_contra hn + have heG := hC.1.2 he + obtain ⟨x, hx⟩ := heG.1 + have hxA : x ∈ ΔB := hAB (by + have : x ∈ discBd ΔA := by + rw [hbA] + exact A.closure_subset_U h₁ (subset_closure hx) + exact Surface.discBd_subset _ this) + have hd := edge_disjoint_U hB.1 heG hn + have hxi : x ∈ discInt ΔB := ⟨hxA, fun hb' ↦ disjoint_left.mp hd hx (hbB ▸ hb')⟩ + have hxb : x ∈ frontier Δ := by + rw [IsClosedDisc.frontier_eq_discBd hT hΔ, hb] + exact C.closure_subset_U he (subset_closure hx) + exact hxb.2 (mem_interior.mpr ⟨_, (discInt_subset _).trans hBΔ, hΔB.isOpen_discInt hman, hxi⟩) + · exact h₁ + +omit [T2Space Shat] in +/-- A disc in `Δ₀` whose boundary lies in a second disc in `Δ₀` lies in the second disc. -/ +theorem disc_subset_of_bd [ConnectedSpace Shat] (hT : IsClosedSurface Shat) {Δ₀ Δ₁ Δ₂ : Set Shat} + (h₀ : IsClosedDisc Δ₀) (h₁ : IsClosedDisc Δ₁) (h₂ : IsClosedDisc Δ₂) + (s₁ : Δ₁ ⊆ Δ₀) (s₂ : Δ₂ ⊆ Δ₀) (hb : discBd Δ₁ ⊆ Δ₂) : Δ₁ ⊆ Δ₂ := by + obtain ⟨Δ', ⟨hs₁, hd₁, hb₁, -⟩, -⟩ := disc_oArc Δ₂ (discBd Δ₁) h₂ hb h₁.isOArc_discBd + rw [disc_eq_of_subset_disc hT h₀ h₁ hd₁ s₁ (hs₁.trans s₂) hb₁.symm] + exact hs₁ + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {Δv : Set + Shat} {Dv F : Drawing Shat} + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {Δ₀ Δ : Set Shat} {C : + Drawing Shat} {h : Shat} + +/-- The set-up after step (6): `h ∈ Δ \ U(C)`, and `h ∈ ins(H)`. If `H` is a circuit then `h ∉ +U(H)`. -/ +structure IsFar (D : TangleDatum cap χ) (W : Set Shat) (H : Drawing Shat) (ρ : ℕ) (r : Shat) + (Δv : Set Shat) (Dv : Drawing Shat) (ord' : ℕ) + (𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) (F : Drawing Shat) (Δ₀ : Set Shat) + (C : Drawing Shat) (Δ : Set Shat) (h : Shat) : Prop + extends D.IsRound W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ where + mem_Δ : h ∈ Δ + not_C : h ∉ C.U + hub : (H.V = {h} ∧ H.V.ncard = 1) ∨ (IsEnclave D.tb D.ord D.𝒯 H ∧ H.E.ncard ≤ 4 * ρ + 4 + ∧ h ∈ discInt (D.ins H)) + +omit [T2Space S] in +/-- The choice of `h`, after step (6). -/ +theorem IsRound.exists_far (hr : D.IsRound W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ) + (hn : ¬ H.U ∩ Δ ⊆ C.U) : ∃ h, D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hW := hr.enc.wheel + obtain ⟨y, ⟨hyH, hyΔ⟩, hyC⟩ := not_subset.mp hn + have hyi : y ∈ discInt Δ := ⟨hyΔ, fun hb ↦ hyC (hr.bd ▸ hb)⟩ + rcases hW.hub_cond with ⟨hc, hE, -⟩ | ⟨hH, hle, -⟩ + · refine ⟨y, hr, hyΔ, hyC, .inl ⟨?_, hc⟩⟩ + obtain ⟨z, hz⟩ := ncard_eq_one.mp hc + have hyV : y ∈ H.V := by + by_contra hnV + obtain ⟨g, hg, -⟩ := H.exists_edge_of_mem hyH hnV + rw [hE] at hg + exact hg + rw [hz] at hyV ⊢ + rw [mem_singleton_iff.mp hyV] + · obtain ⟨-, -, -, hcir, hlt, -⟩ := id hH + have hi := D.ins_spec hcir hlt + have hyb : y ∈ frontier (discInt (D.ins H)) := by + have h₁ := IsClosedDisc.frontier_eq_discBd hT hi.2.2.1 + have h₂ : y ∈ frontier (D.ins H) := by + rw [h₁, hi.2.2.2.1] + exact hyH + have hint : frontier (discInt (D.ins H)) = closure (discInt (D.ins H)) \ discInt (D.ins H) := + (hi.2.2.1.isOpen_discInt hman).frontier_eq + rw [hint, closure_discInt hi.2.2.1] + exact ⟨h₂.1 |> fun _ ↦ Surface.discBd_subset _ (hi.2.2.2.1.symm ▸ hyH), + fun h' ↦ h'.2 (hi.2.2.2.1.symm ▸ hyH)⟩ + obtain ⟨z, hzΔ, hzi⟩ := mem_closure_iff.mp hyb.1 _ (hr.disc.isOpen_discInt hman) hyi + exact ⟨z, hr, hzΔ.1, fun hb ↦ hzΔ.2 (hr.bd.symm ▸ hb), .inr ⟨hH, hle, hzi⟩⟩ + +omit [T2Space S] in +/-- A simple walk `P` from `a` to `b ≠ a` with edges in a circuit `F`, and a walk `J` back with +edges in `F` and no edge of `P`, use up `F`. -/ +theorem circuit_cover {a b : Shat} {P : GraphWalk D.rad.G.toGraph a b} (hF : F.IsCircuitOf D.rad.G) + (hne : a ≠ b) (hP : P.IsSimple) + (hPF : ∀ e ∈ P.edges, e ∈ F.E) (J : GraphWalk D.rad.G.toGraph b a) + (hJF : ∀ e ∈ J.edges, e ∈ F.E) (hd : ∀ e ∈ J.edges, e ∉ P.edges) : + ∀ e ∈ F.E, e ∈ P.edges ∨ e ∈ J.edges := by + classical + have hstart : ∀ {a b : Shat} (N : GraphWalk D.rad.G.toGraph a b), a ≠ b → + (∀ e ∈ N.edges, e ∈ F.E) → a ∈ F.V := by + intro a b N hab hE + cases N with + | nil _ => exact absurd rfl hab + | @cons _ y _ e hl r => exact (Drawing.IsLink.mem_V_of_sub hF.1 hl (hE e (by simp))).1 + have ha := hstart P hne hPF + have hb := hstart P.reverse hne.symm fun e he ↦ hPF e (by simpa [GraphWalk.edges_reverse] using + he) + obtain ⟨R₁, R₂, hs⟩ := exists_splits hF.2 hF.1 ha hb hne + obtain ⟨R, hR⟩ := exists_side_of_walk hne hP hPF hs + obtain ⟨J', hJ's, -, hJ'e⟩ := GM11.GraphWalk.exists_isSimple J + have hsub : ∀ e ∈ J'.edges, e ∈ R.edges := fun e he ↦ ((hR.E e).mp (hJF e + (hJ'e e he))).resolve_left (hd e (hJ'e e he)) + obtain rfl := simple_walk_unique R J' hR.s₂ hJ's hsub + intro e he + rcases (hR.E e).mp he with h₁ | h₁ + · exact .inl h₁ + · exact .inr (hJ'e e h₁) + +omit [T2Space S] in +/-- A vertex of a circuit is in no edge. So a walk in `G` that avoids the vertices of `Dv` and its +edges stays on one side of the disc of `Dv`. -/ +theorem side_of_walk {Dv : Drawing Shat} {Δv : Set Shat} (hDv : Dv.IsSubdrawing D.rad.G) + (hd : IsClosedDisc Δv) (hb : discBd Δv = Dv.U) {a b : Shat} + (L : GraphWalk D.rad.G.toGraph a b) (hs : L.IsSimple) (hmid : ∀ z ∈ L.support, z ≠ b + → z ∉ Dv.V) (hoff : ∀ e ∈ L.edges, e ∉ Dv.E) : + (a ∈ discInt Δv → ∀ e ∈ L.edges, e ⊆ discInt Δv) ∧ (a ∉ Δv → ∀ e ∈ L.edges, Disjoint e Δv) := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + induction L with + | nil _ => simp + | @cons a y b e hl L ih => + have hnd : (GraphWalk.cons hl L).support.Nodup := hs + simp only [GraphWalk.support_cons, List.nodup_cons] at hnd + have heoff := hoff e (by simp) + have hIH := ih hnd.2 (fun z hz hzb ↦ hmid z (by simp [hz]) hzb) (fun f hf ↦ hoff f + (by simp [hf])) + have hstep : y = b ∨ y ∉ Dv.U := by + by_cases hyb : y = b + · exact .inl hyb + · exact .inr fun hu ↦ hmid y (by simp [L.start_mem_support]) hyb + (mem_V_of_mem_U hDv hu hl.2.2.1) + have hrest : y = b → ∀ f ∈ L.edges, False := fun hyb f hf ↦ by + subst hyb + rw [(simple_self hnd.2).1] at hf + cases hf + constructor + · intro hai f hf + have hein : e ⊆ discInt Δv := by + rcases edge_inside_or_off hT hDv hd hb hl.1 heoff with h₁ | h₁ + · exact h₁ + · obtain ⟨z, hzi, hze⟩ := mem_closure_iff.mp (IsLink.left_mem_closure hl) _ + (hd.isOpen_discInt hman) hai + exact absurd hzi.1 (disjoint_left.mp h₁ hze) + rcases List.mem_cons.mp hf with rfl | hf + · exact hein + · rcases hstep with h₁ | h₁ + · exact (hrest h₁ f hf).elim + · refine hIH.1 ⟨closure_minimal (hein.trans (discInt_subset _)) hd.isClosed + (IsLink.right_mem_closure hl), fun hb' ↦ h₁ (hb ▸ hb')⟩ f hf + · intro hao f hf + have heout : Disjoint e Δv := by + rcases edge_inside_or_off hT hDv hd hb hl.1 heoff with h₁ | h₁ + · exact absurd (closure_minimal (h₁.trans (discInt_subset _)) hd.isClosed + (IsLink.left_mem_closure hl)) hao + · exact h₁ + rcases List.mem_cons.mp hf with rfl | hf + · exact heout + · rcases hstep with h₁ | h₁ + · exact (hrest h₁ f hf).elim + · refine hIH.2 (fun hyΔ ↦ ?_) f hf + have hyi : y ∈ discInt Δv := ⟨hyΔ, fun hb' ↦ h₁ (hb ▸ hb')⟩ + obtain ⟨z, hzi, hze⟩ := mem_closure_iff.mp (IsLink.right_mem_closure hl) _ + (hd.isOpen_discInt hman) hyi + exact disjoint_left.mp heout hze hzi.1 + +omit [T2Space S] in +/-- An arc is *inner* or *outer*: this is the sentence of the paper after the definition of arcs. -/ +theorem IsArcOn.side {a b : Shat} {P : GraphWalk D.rad.G.toGraph a b} (hP : IsArcOn D.rad.G Dv F P) + (hDv : Dv.IsSubdrawing D.rad.G) (hd : IsClosedDisc Δv) + (hb : discBd Δv = Dv.U) : (∀ e ∈ P.edges, e ⊆ discInt Δv) ∨ (∀ e ∈ P.edges, Disjoint e Δv) := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hne := hP.ne + have hs := hP.simple + have hinner := hP.inner + have hoff := hP.off + cases P with + | nil _ => exact absurd rfl hne + | @cons _ y _ e hl L => + have hnd : (GraphWalk.cons hl L).support.Nodup := hs + simp only [GraphWalk.support_cons, List.nodup_cons] at hnd + have heoff := hoff e (by simp) + have hmid : ∀ z ∈ L.support, z ≠ _ → z ∉ Dv.V := fun z hz hzb hzV ↦ by + rcases hinner z (by simp [hz]) hzV with rfl | h₁ + · exact hnd.1 hz + · exact hzb h₁ + have hIH := side_of_walk (D := D) hDv hd hb L hnd.2 hmid fun f hf ↦ hoff f (by simp [hf]) + have hrest : y = b → ∀ f ∈ L.edges, False := fun hyb f hf ↦ by + subst hyb + rw [(simple_self hnd.2).1] at hf + cases hf + have hstep : y = b ∨ y ∉ Dv.U := by + by_cases hyb : y = b + · exact .inl hyb + · exact .inr fun hu ↦ hmid y L.start_mem_support hyb (mem_V_of_mem_U hDv hu hl.2.2.1) + rcases edge_inside_or_off hT hDv hd hb hl.1 heoff with h₁ | h₁ + · left + intro f hf + rcases List.mem_cons.mp hf with rfl | hf + · exact h₁ + · rcases hstep with h₂ | h₂ + · exact (hrest h₂ f hf).elim + · exact hIH.1 ⟨closure_minimal (h₁.trans (discInt_subset _)) hd.isClosed + (IsLink.right_mem_closure hl), fun hb' ↦ h₂ (hb ▸ hb')⟩ f hf + · right + intro f hf + rcases List.mem_cons.mp hf with rfl | hf + · exact h₁ + · rcases hstep with h₂ | h₂ + · exact (hrest h₂ f hf).elim + · refine hIH.2 (fun hyΔ ↦ ?_) f hf + have hyi : y ∈ discInt Δv := ⟨hyΔ, fun hb' ↦ h₂ (hb ▸ hb')⟩ + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + obtain ⟨z, hzi, hze⟩ := mem_closure_iff.mp (IsLink.right_mem_closure hl) _ + (hd.isOpen_discInt hman) hyi + exact disjoint_left.mp h₁ hze hzi.1 + +omit [T2Space Shat] in +/-- The reverse of an arc is an arc. -/ +theorem IsArcOn.reverse {G Dv F : Drawing Shat} {a b : Shat} {P : GraphWalk G.toGraph a b} + (hP : IsArcOn G Dv F P) : IsArcOn G Dv F P.reverse := by + refine ⟨hP.ne.symm, hP.simple.reverse, hP.right, hP.left, fun x hx hxV ↦ ?_, + fun e he ↦ hP.off e (by simpa [GraphWalk.edges_reverse] using he), + fun e he ↦ hP.inF e (by simpa [GraphWalk.edges_reverse] using he)⟩ + exact (hP.inner x (by simpa [GraphWalk.support_reverse] using hx) hxV).symm + +namespace IsFar + +variable (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) +include hf + +/-- If `H` is a circuit then `h ∉ U(F)`, and if `h ∈ ins(F)` then `H` is the point `h`, and `h ∈ +V(F)`: this is the first line of the proof of step (7). -/ +theorem point_of_mem_ins (hm : h ∈ D.ins F) : H.V = {h} ∧ H.V.ncard = 1 ∧ h ∈ F.U := by + have : ConnectedSpace Shat := cap.connected + rcases hf.hub with ⟨h₁, h₂⟩ | ⟨hH, -, hi⟩ + · exact ⟨h₁, h₂, hf.enc.hub_point h₂ (by rw [h₁]; rfl) hm⟩ + · have := hf.enc.hub_circuit hH + have h₃ : h ∈ D.ins F ∩ D.ins H := ⟨hm, hi.1⟩ + rw [this] at h₃ + obtain ⟨-, -, -, hcir, hlt, -⟩ := id hH + exact absurd (D.ins_spec hcir hlt).2.2.2.1 fun hb ↦ hi.2 (hb ▸ h₃.2) + +/-- If `h ∈ Δ_v` then `h ∈ U(D_v)`. -/ +theorem mem_Dv_of_mem (hm : h ∈ Δv) : h ∈ Dv.U := by + have : ConnectedSpace Shat := cap.connected + have hbv := hf.enc.sector.Dv_U + have hW := hf.enc.wheel + by_contra hn + have hi : h ∈ discInt Δv := ⟨hm, fun hb ↦ hn (hbv ▸ hb)⟩ + rcases hf.hub with ⟨h₁, h₂⟩ | ⟨hH, hle, hi'⟩ + · rcases hf.enc.sector.cases hW hf.enc.hbdS hf.enc.hin with ⟨v₁, v₂, u, h', f₁, f₂, A₁, A₂, T, + hfan, hC, -, -⟩ | ⟨v₁, v₂, h₁', h₂', f₁, f₂, K₁, K₂, P, -, -, -, -, -, h1, h2, hdis, -, -, -⟩ + · have hmain := (hfan.main hC hf.enc.hopt hf.enc.sector.is_disc hf.enc.sector.Δv_sub hbv.symm).1 + have hu := hmain h ⟨hm, H.V_subset_U (by rw [h₁]; rfl)⟩ + subst hu + exact hn (Dv.V_subset_U ((hC.mem_V _).mpr (.inr (.inl A₁.end_mem_support)))) + · have e₁ := h1.2.h_mem + have e₂ := h2.2.h_mem + rw [h₁] at e₁ e₂ + obtain rfl : h₁' = h := e₁ + obtain rfl : h₂' = h₁' := e₂ + exact hdis _ K₁.end_mem_support K₂.end_mem_support + · exact disjoint_left.mp (hf.enc.sector.interior_off_hub hf.enc.hopt hf.enc.hbdS hf.enc.hin hH + hle) hi' hi + +theorem ne_Dv : ¬ ∀ e ∈ C.E, e ∈ Dv.E := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + intro hE + have hC := hf.circuit + have hDv := hf.enc.sector.Dv_circuit + have heq := circuit_E_eq_of_subset hDv.2 hC.2 hDv.1 hC.1 hE + obtain rfl := circuit_eq_of_E hC.2 hDv.2 hC.1 hDv.1 heq + have hΔ : Δ = Δv := disc_eq_of_subset_disc hT hf.amb.disc hf.disc hf.enc.sector.is_disc hf.sub + (hf.v_sub.trans hf.sub) + (hf.bd.trans hf.enc.sector.Dv_U) + exact hf.not_C (hf.mem_Dv_of_mem (hΔ ▸ hf.mem_Δ)) + +theorem ne_F : ¬ ∀ e ∈ C.E, e ∈ F.E := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + intro hE + have hC := hf.circuit + have hFi := hf.enc.isInsOf_F + have heq := circuit_E_eq_of_subset hFi.1.2 hC.2 hFi.1.1 hC.1 hE + obtain rfl := circuit_eq_of_E hC.2 hFi.1.2 hC.1 hFi.1.1 heq + have hΔ : Δ = D.ins C := hf.ins_C.symm + exact hf.not_C (hf.point_of_mem_ins (hΔ ▸ hf.mem_Δ)).2.2 + +/-- The first half of the remark after the definition of arcs: `Δ_v ⊄ ins(F)`. -/ +theorem not_v_sub : ¬ Δv ⊆ D.ins F := fun hsub ↦ by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hFi := hf.enc.isInsOf_F + exact hf.ne_F (edges_of_nested hT hFi.1 hf.circuit hFi.2.2.1 hFi.2.2.2.1 + hf.enc.sector.Dv_U.symm hsub hf.disc hf.bd hf.F_sub + fun e he ↦ (hf.edges e he).symm) + +/-- `ins(F) ⊄ Δ_v`. -/ +theorem not_F_sub : ¬ D.ins F ⊆ Δv := fun hsub ↦ by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hFi := hf.enc.isInsOf_F + exact hf.ne_Dv (edges_of_nested hT hf.enc.sector.Dv_circuit hf.circuit + hf.enc.sector.is_disc hf.enc.sector.Dv_U.symm hFi.2.2.2.1 hsub hf.disc hf.bd hf.v_sub hf.edges) + +/-- `F` has an edge outside `Δ_v`. -/ +theorem exists_edge_out : ∃ e ∈ F.E, Disjoint e Δv := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hFi := hf.enc.isInsOf_F + have hΔv := hf.enc.sector.is_disc + by_contra hn + push Not at hn + have hU : F.U ⊆ Δv := U_of_edges hFi.1.2 hΔv.isClosed fun e he ↦ by + have hG := hFi.1.1.2 he + by_cases heD : e ∈ Dv.E + · intro x hx + have : x ∈ discBd Δv := by + rw [← hf.enc.sector.Dv_U] + exact Dv.closure_subset_U heD (subset_closure hx) + exact Surface.discBd_subset _ this + · rcases edge_inside_or_off hT hf.enc.sector.Dv_circuit.1 hΔv hf.enc.sector.Dv_U.symm hG heD + with h₁ | h₁ + · exact h₁.trans (discInt_subset _) + · exact absurd h₁ (hn e he) + have hsF : D.ins F ⊆ Δ₀ := hf.F_sub.trans hf.sub + exact hf.not_F_sub (disc_subset_of_bd hT hf.amb.disc hFi.2.2.1 hΔv hsF (hf.v_sub.trans hf.sub) + (hFi.2.2.2.1 ▸ hU)) + +/-- `F` has an edge inside `Δ_v`. -/ +theorem exists_edge_in : ∃ e ∈ F.E, e ⊆ discInt Δv := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hFi := hf.enc.isInsOf_F + have hΔv := hf.enc.sector.is_disc + have hbv := hf.enc.sector.Dv_U.symm + by_contra hn + push Not at hn + have hUd : F.U ⊆ (discInt Δv)ᶜ := U_of_edges hFi.1.2 (hΔv.isOpen_discInt hman).isClosed_compl fun + e he x hx hxi ↦ by + have hG := hFi.1.1.2 he + by_cases heD : e ∈ Dv.E + · have : x ∈ discBd Δv := by + rw [hbv] + exact Dv.closure_subset_U heD (subset_closure hx) + exact hxi.2 this + · rcases edge_inside_or_off hT hf.enc.sector.Dv_circuit.1 hΔv hbv hG heD with h₁ | h₁ + · exact hn e he h₁ + · exact disjoint_left.mp h₁ hx hxi.1 + obtain ⟨c, hc, hc₁, hc₂⟩ := hf.enc.exists_edge + obtain ⟨y, hy⟩ := hc.1 + have hsub : discInt Δv ⊆ discInt (D.ins F) := (isSide_int hT hFi.2.2.1 hFi.2.2.2.1).subset + hΔv.isPreconnected_discInt + (disjoint_left.mpr fun z hz hzU ↦ hUd hzU hz) ⟨_, hc₂ (mem_image_of_mem _ hy), hc₁ + (mem_image_of_mem _ hy)⟩ + refine hf.not_v_sub ?_ + rw [← closure_discInt hΔv] + exact closure_minimal (hsub.trans (discInt_subset _)) hFi.2.2.1.isClosed + +/-- There is an outer arc. -/ +theorem exists_outer_arc : ∃ (a b : Shat) (P : GraphWalk D.rad.G.toGraph a b), IsArcOn D.rad.G Dv F + P ∧ ∀ e ∈ P.edges, Disjoint e Δv := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hFi := hf.enc.isInsOf_F + have hF := hFi.1 + have hDv := hf.enc.sector.Dv_circuit + have hΔv := hf.enc.sector.is_disc + have hbv := hf.enc.sector.Dv_U.symm + obtain ⟨e₀, he₀, he₀d⟩ := hf.exists_edge_out + obtain ⟨e₁, he₁, he₁i⟩ := hf.exists_edge_in + obtain ⟨a, b, hne, hl⟩ : ∃ a b, a ≠ b ∧ D.rad.G.toGraph.IsLink e₁ a b := by + obtain ⟨p, hp, q, hq, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 e₁ (hF.1.2 he₁) + have hpm : p ∈ closure e₁ ∩ D.rad.G.V := by + rw [hcap] + exact .inl rfl + have hqm : q ∈ closure e₁ ∩ D.rad.G.V := by + rw [hcap] + exact .inr rfl + exact ⟨p, q, fun h' ↦ hq.2 (h' ▸ hp), hF.1.2 he₁, hpm.2, hqm.2, hcap⟩ + have hclΔ : closure e₁ ⊆ Δv := closure_minimal (he₁i.trans (discInt_subset _)) hΔv.isClosed + have hends := Drawing.IsLink.mem_V_of_sub hF.1 hl he₁ + obtain ⟨W₁, W₂, hs⟩ := exists_splits hF.2 hF.1 hends.1 hends.2 hne + obtain ⟨u, v, M, hu, hv, hMs, he₀M, hME, hinner⟩ : ∃ (u v : Shat) (M : GraphWalk D.rad.G.toGraph + u v), u ∈ Δv ∧ v ∈ Δv ∧ M.IsSimple ∧ e₀ ∈ M.edges ∧ + (∀ e ∈ M.edges, e ∈ F.E) ∧ ∀ x ∈ M.support, x ∈ Δv → x = u ∨ x = v := by + rcases (hs.E e₀).mp he₀ with h₁ | h₁ + · obtain ⟨u, v, M, h₁', h₂, h₃, h₄, h₅, h₆⟩ := GraphWalk.exists_piece W₁ hs.s₁ (hclΔ + (IsLink.left_mem_closure hl)) (hclΔ (IsLink.right_mem_closure hl)) h₁ + exact ⟨u, v, M, h₁', h₂, h₃, h₄, fun e he ↦ (hs.E e).mpr (.inl (h₅ e he)), h₆⟩ + · obtain ⟨u, v, M, h₁', h₂, h₃, h₄, h₅, h₆⟩ := GraphWalk.exists_piece W₂ hs.s₂ (hclΔ + (IsLink.right_mem_closure hl)) (hclΔ (IsLink.left_mem_closure hl)) h₁ + exact ⟨u, v, M, h₁', h₂, h₃, h₄, fun e he ↦ (hs.E e).mpr (.inr (h₅ e he)), h₆⟩ + have huv : u ≠ v := by + rintro rfl + rw [(simple_self hMs).1] at he₀M + cases he₀M + have hcase : ∀ e ∈ F.E, closure e ⊆ Δv ∨ Disjoint e Δv := fun e he ↦ by + by_cases heC : e ∈ Dv.E + · refine .inl ((Dv.closure_subset_U heC).trans ?_) + rw [← hbv] + exact Surface.discBd_subset _ + · rcases edge_inside_or_off hT hDv.1 hΔv hbv (hF.1.2 he) heC with h₁ | h₁ + · exact .inl (closure_minimal (h₁.trans (discInt_subset _)) hΔv.isClosed) + · exact .inr h₁ + have hMoff : ∀ e ∈ M.edges, Disjoint e Δv := fun e he ↦ by + rcases GraphWalk.edge_has_middle M hMs huv he with h₁ | ⟨x, hxs, hxc, hxu, hxv⟩ + · rw [h₁] at he₀M + obtain rfl : e₀ = e := by simpa using he₀M + exact he₀d + · refine (hcase e (hME e he)).resolve_left fun h' ↦ ?_ + rcases hinner x hxs (h' hxc) with h'' | h'' + · exact hxu h'' + · exact hxv h'' + have hstart : ∀ {a b : Shat} (N : GraphWalk D.rad.G.toGraph a b), a ≠ b → + (∀ e ∈ N.edges, e ∈ F.E) → (∀ e ∈ N.edges, Disjoint e Δv) → a ∈ Δv → a ∈ Dv.V := by + intro a b N hab hE hD haΔ + cases N with + | nil _ => exact absurd rfl hab + | @cons _ y _ e hl r => + have hdis := hD e (by simp) + have hac := IsLink.left_mem_closure hl + have haf : a ∈ frontier Δv := by + refine ⟨subset_closure haΔ, fun hi ↦ ?_⟩ + obtain ⟨y, hyi, hye⟩ := mem_closure_iff.mp hac _ isOpen_interior hi + exact disjoint_left.mp hdis hye (interior_subset hyi) + rw [IsClosedDisc.frontier_eq_discBd hT hΔv, hbv] at haf + exact mem_V_of_mem_U hDv.1 haf hl.2.1 + have huD := hstart M huv hME hMoff hu + have hvD := hstart M.reverse huv.symm (fun e he ↦ hME e (by simpa [GraphWalk.edges_reverse] using + he)) + (fun e he ↦ hMoff e (by simpa [GraphWalk.edges_reverse] using he)) hv + have hsubΔ : Dv.V ⊆ Δv := fun x hx ↦ by + have : x ∈ discBd Δv := by + rw [hbv] + exact Dv.V_subset_U hx + exact Surface.discBd_subset _ this + refine ⟨u, v, M, ⟨huv, hMs, huD, hvD, fun x hx hxV ↦ hinner x hx (hsubΔ hxV), + fun e he heD ↦ ?_, hME⟩, hMoff⟩ + obtain ⟨x, hx⟩ := (hF.1.2 (hME e he)).1 + exact disjoint_left.mp (hMoff e he) hx (hsubΔ.trans subset_rfl |> fun _ ↦ by + have : x ∈ discBd Δv := by + rw [hbv] + exact Dv.closure_subset_U heD (subset_closure hx) + exact Surface.discBd_subset _ this) + +/-- Every edge of `F` off `D_v` lies on an arc. -/ +theorem exists_arc_through {e : Set Shat} (he : e ∈ F.E) (heD : e ∉ Dv.E) : ∃ (a b : Shat) + (P : GraphWalk D.rad.G.toGraph a b), IsArcOn D.rad.G Dv F P ∧ e ∈ P.edges := by + classical + have hF := hf.enc.isInsOf_F.1 + obtain ⟨u, v, O, hO, -⟩ := hf.exists_outer_arc + have hstart : ∀ {a b : Shat} (N : GraphWalk D.rad.G.toGraph a b), a ≠ b → + (∀ e ∈ N.edges, e ∈ F.E) → a ∈ F.V := by + intro a b N hab hE + cases N with + | nil _ => exact absurd rfl hab + | @cons _ y _ e hl r => exact (Drawing.IsLink.mem_V_of_sub hF.1 hl (hE e (by simp))).1 + have huF := hstart O hO.ne hO.inF + have hvF := hstart O.reverse hO.ne.symm fun e he ↦ hO.inF e (by simpa [GraphWalk.edges_reverse] + using he) + obtain ⟨W₁, W₂, hs⟩ := exists_splits hF.2 hF.1 huF hvF hO.ne + obtain ⟨a, b, M, ha, hb, hMs, heM, hME, hinner⟩ : ∃ (a b : Shat) (M : GraphWalk D.rad.G.toGraph a + b), a ∈ Dv.V ∧ b ∈ Dv.V ∧ M.IsSimple ∧ e ∈ M.edges ∧ + (∀ f ∈ M.edges, f ∈ F.E) ∧ ∀ x ∈ M.support, x ∈ Dv.V → x = a ∨ x = b := by + rcases (hs.E e).mp he with h₁ | h₁ + · obtain ⟨u, v, M, h₁', h₂, h₃, h₄, h₅, h₆⟩ := GraphWalk.exists_piece W₁ hs.s₁ hO.left hO.right + h₁ + exact ⟨u, v, M, h₁', h₂, h₃, h₄, fun e he ↦ (hs.E e).mpr (.inl (h₅ e he)), h₆⟩ + · obtain ⟨u, v, M, h₁', h₂, h₃, h₄, h₅, h₆⟩ := GraphWalk.exists_piece W₂ hs.s₂ hO.right hO.left + h₁ + exact ⟨u, v, M, h₁', h₂, h₃, h₄, fun e he ↦ (hs.E e).mpr (.inr (h₅ e he)), h₆⟩ + have hab : a ≠ b := by + rintro rfl + rw [(simple_self hMs).1] at heM + cases heM + refine ⟨a, b, M, ⟨hab, hMs, ha, hb, hinner, fun f hfM hfD ↦ ?_, hME⟩, heM⟩ + rcases GraphWalk.edge_has_middle M hMs hab hfM with h₁ | ⟨x, hxs, hxc, hxu, hxv⟩ + · rw [h₁] at heM + obtain rfl : e = f := by simpa using heM + exact heD hfD + · have hxV : x ∈ Dv.V := by + have hG := hf.enc.sector.Dv_circuit.1 + have hxG : x ∈ D.rad.G.V := M.mem_vertexSet_of_mem_support hxs + exact mem_V_of_mem_U hG (Dv.closure_subset_U hfD hxc) hxG + rcases hinner x hxs hxV with h₁ | h₁ + · exact hxu h₁ + · exact hxv h₁ + +/-- There is an inner arc. -/ +theorem exists_inner_arc : ∃ (a b : Shat) (P : GraphWalk D.rad.G.toGraph a b), IsArcOn D.rad.G Dv F + P ∧ ∀ e ∈ P.edges, e ⊆ discInt Δv := by + have hDv := hf.enc.sector.Dv_circuit + have hΔv := hf.enc.sector.is_disc + have hbv := hf.enc.sector.Dv_U.symm + obtain ⟨e, he, hei⟩ := hf.exists_edge_in + have heD : e ∉ Dv.E := fun h' ↦ by + obtain ⟨x, hx⟩ := (hDv.1.2 h').1 + exact (hei hx).2 (hbv ▸ Dv.closure_subset_U h' (subset_closure hx)) + obtain ⟨a, b, P, hP, heP⟩ := hf.exists_arc_through he heD + refine ⟨a, b, P, hP, ?_⟩ + rcases IsArcOn.side (D := D) hP hDv.1 hΔv hbv with h₁ | h₁ + · exact h₁ + · obtain ⟨x, hx⟩ := (hf.enc.isInsOf_F.1.1.2 he).1 + exact absurd (hei hx).1 (disjoint_left.mp (h₁ e heP) hx) + +end IsFar + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13q.lean b/LeanPool/GraphMinor/GM19/Section13q.lean new file mode 100644 index 0000000000..0085ad16d3 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13q.lean @@ -0,0 +1,303 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13p + +/-! +# Graph Minors XIX, Section 13: tools for step (7) of (13.6) + +A chord of `D_v` gives two circuits, and one of them still points to `𝒯'`. An edge at `r*` that +leaves `Δ_v` also leaves `W`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +section Tangle + +variable {Γ : Painting S} {rad : RadialDrawing cap Γ} {ord' : ℕ} {𝒯' : Set (Hypergraph S + (Set S) × Hypergraph S (Set S))} + +/-- If two discs hold a third one, and the third points to `𝒯'`, then one of the two does. -/ +theorem exists_small_side (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (h𝒯' : IsTangle Γ.toHypergraph ord' 𝒯') {Dv C₁ C₂ : Drawing Shat} {Δd Δ₁ Δ₂ : Set Shat} + (hDv : Dv.IsCircuitOf rad.G) (hΔd : IsClosedDisc Δd) (hbd : discBd Δd = Dv.U) (hmem : + (partIn cap Γ (closure Δdᶜ), partIn cap Γ Δd) ∈ 𝒯') + (hc₁ : C₁.IsCircuitOf rad.G) (hΔ₁ : IsClosedDisc Δ₁) (hb₁ : discBd Δ₁ = C₁.U) + (hc₂ : C₂.IsCircuitOf rad.G) (hΔ₂ : IsClosedDisc Δ₂) (hb₂ : discBd Δ₂ = C₂.U) + (hcov : Δd ⊆ Δ₁ ∪ Δ₂) (ho₁ : C₁.E.ncard < 2 * ord') (ho₂ : C₂.E.ncard < 2 * ord') : + (partIn cap Γ (closure Δ₁ᶜ), partIn cap Γ Δ₁) ∈ 𝒯' ∨ (partIn cap Γ + (closure Δ₂ᶜ), partIn cap Γ Δ₂) ∈ 𝒯' := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + by_contra hn + push Not at hn + have hs₁ : Γ.toHypergraph.IsSeparation (partIn cap Γ Δ₁) (partIn cap Γ (closure Δ₁ᶜ)) := + (disc_facts hS h3 rad hc₁ hΔ₁ hb₁).1 + have hs₂ : Γ.toHypergraph.IsSeparation (partIn cap Γ Δ₂) (partIn cap Γ (closure Δ₂ᶜ)) := + (disc_facts hS h3 rad hc₂ hΔ₂ hb₂).1 + have e₁ := disc_order hS h3 rad hc₁ hΔ₁ hb₁ + have e₂ := disc_order hS h3 rad hc₂ hΔ₂ hb₂ + have m₁ := (h𝒯'.axiom1 hs₁ (by omega)).resolve_right hn.1 + have m₂ := (h𝒯'.axiom1 hs₂ (by omega)).resolve_right hn.2 + have hc := part_cover rad hDv.1 hc₁.1 hc₂.1 (isSide_out hT hΔd hbd) (isSide_int hT hΔ₁ hb₁) + (isSide_int hT hΔ₂ hb₂) fun x ↦ by + rw [closure_discInt hΔ₁, closure_discInt hΔ₂] + by_cases hx : x ∈ Δd + · rcases hcov hx with h₁ | h₁ + · exact .inr (.inl h₁) + · exact .inr (.inr h₁) + · exact .inl (subset_closure hx) + rw [closure_discInt hΔ₁, closure_discInt hΔ₂] at hc + exact h𝒯'.axiom2 hmem m₁ m₂ hc + +end Tangle + +omit [T2Space Shat] in +theorem GraphWalk.append_nil' {G : Drawing Shat} {a b : Shat} (M : GraphWalk G.toGraph a b) + (h : b ∈ G.toGraph.vertexSet) : M.append (.nil h) = M := by + induction M with + | nil _ => rfl + | cons hl r ih => exact congrArg (GraphWalk.cons hl) (ih h) + +/-- If two walks cut a circuit, a walk between the same ends that misses the circuit gives a theta. +-/ +theorem Splits.twoPaths {G F : Drawing Shat} {a b : Shat} {W₁ : GraphWalk G.toGraph a b} {W₂ : + GraphWalk G.toGraph b a} (hs : Splits F W₁ W₂) (hab : a ≠ b) + (hF : F.IsSubdrawing G) {Q : GraphWalk G.toGraph a b} (hQ : Q.IsSimple) + (hV : ∀ x ∈ Q.support, x ∈ F.V → x = a ∨ x = b) (hE : ∀ e ∈ Q.edges, e ∉ F.E) : + TwoPaths G F (walkDrawing G W₁) (walkDrawing G W₂.reverse) (walkDrawing G Q) a b := by + have hrevV : ∀ x, x ∈ (walkDrawing G W₂.reverse).V ↔ x ∈ W₂.support := fun x ↦ by + rw [walkDrawing_V] + change x ∈ W₂.reverse.support ↔ _ + rw [GraphWalk.support_reverse, List.mem_reverse] + have hrevE : ∀ e, e ∈ (walkDrawing G W₂.reverse).E ↔ e ∈ W₂.edges := fun e ↦ by + rw [walkDrawing_E] + change e ∈ W₂.reverse.edges ↔ _ + rw [GraphWalk.edges_reverse, List.mem_reverse] + have hV₁ : ∀ x, x ∈ (walkDrawing G W₁).V ↔ x ∈ W₁.support := fun x ↦ by rw [walkDrawing_V]; rfl + have hE₁ : ∀ e, e ∈ (walkDrawing G W₁).E ↔ e ∈ W₁.edges := fun e ↦ by rw [walkDrawing_E]; rfl + refine ⟨hab, hF, ⟨⟨fun x hx ↦ (hs.V x).mpr (.inl ((hV₁ x).mp hx)), + fun e he ↦ (hs.E e).mpr (.inl ((hE₁ e).mp he))⟩, walkDrawing_isPathBetween G hs.s₁⟩, + ⟨⟨fun x hx ↦ (hs.V x).mpr (.inr ((hrevV x).mp hx)), fun e he ↦ (hs.E e).mpr (.inr + ((hrevE e).mp he))⟩, walkDrawing_isPathBetween G hs.s₂.reverse⟩, ?_, ?_, ?_, ?_, + ⟨walkDrawing_isSubdrawing _ _, walkDrawing_isPathBetween _ hQ⟩, ?_, ?_⟩ + · ext x + rw [hs.V x, mem_union, hV₁, hrevV] + · ext e + rw [hs.E e, mem_union, hE₁, hrevE] + · rintro x ⟨h₁, h₂⟩ + exact hs.meet x ((hV₁ x).mp h₁) ((hrevV x).mp h₂) + · exact disjoint_left.mpr fun e h₁ h₂ ↦ hs.edge e ((hE₁ e).mp h₁) ((hrevE e).mp h₂) + · rintro x ⟨h₁, h₂⟩ + have : x ∈ Q.support := by simpa [walkDrawing_V] using h₁ + exact hV x this h₂ + · refine disjoint_left.mpr fun e h₁ h₂ ↦ hE e ?_ h₂ + simpa [walkDrawing_E] using h₁ + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {Δv : Set + Shat} {Dv F : Drawing Shat} + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {Δ₀ Δ : Set Shat} {C : + Drawing Shat} {h : Shat} + +/-- A spoke meets `bd(W)` only in its first vertex. -/ +theorem IsSpokeWalk.meet_bd (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) {v h x : Shat} {K : GraphWalk + D.rad.G.toGraph v h} (hK : D.IsSpokeWalk W H K) + (hx : x ∈ (walkDrawing D.rad.G K).U) (hxb : x ∈ discBd W) : x = v := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + rw [mem_walkDrawing_U] at hx + by_contra hne + have hvert : ∀ y ∈ K.support, y ∈ discBd W → y = v := fun y hy hb ↦ by + by_contra hn + exact hK.tail_off_bd hW hbdS hin hy hn hb + rcases hx with hx | ⟨e, he, hxe⟩ + · exact hne (hvert x hx hxb) + · obtain ⟨p, q, hl, A, B, rfl⟩ := GraphWalk.exists_split_edge K he + have hps : p ∈ (A.append (GraphWalk.cons hl B)).support := (GraphWalk.mem_support_append _ + _).mpr (.inl A.end_mem_support) + have hqs : q ∈ (A.append (GraphWalk.cons hl B)).support := (GraphWalk.mem_support_append _ + _).mpr (.inr (by simp [B.start_mem_support])) + have hpq : p ≠ q := by + have hc : (GraphWalk.cons hl B).support.Nodup := (isSimple_of_append hK.1).2 + rw [GraphWalk.support_cons, List.nodup_cons] at hc + exact fun h' ↦ hc.1 (h' ▸ B.start_mem_support) + rcases closure_edge_subset hl.1 hxe with hxe' | hxV + · obtain ⟨B', hBc, hBs, hBU⟩ := exists_circuit_of_oArc hW.is_disc.isOArc_discBd hW.bd_sub + have heB : e ∈ B'.E := by + by_contra hn + exact disjoint_left.mp (edge_disjoint_U hBs hl.1 hn) hxe' (hBU ▸ hxb) + have hb₁ : p ∈ discBd W := hBU ▸ B'.closure_subset_U heB (IsLink.left_mem_closure hl) + have hb₂ : q ∈ discBd W := hBU ▸ B'.closure_subset_U heB (IsLink.right_mem_closure hl) + exact hpq ((hvert p hps hb₁).trans (hvert q hqs hb₂).symm) + · have hm : x ∈ closure e ∩ D.rad.G.V := ⟨hxe, hxV⟩ + rw [hl.2.2.2] at hm + rcases hm with rfl | rfl + · exact hne (hvert _ hps hxb) + · exact hne (hvert _ hqs hxb) + +/-- An edge at `r*` that misses `Δ_v` is not in `W`. The discs `Δ_v ⊆ W` meet along `f₁ ∪ f₂` on +their boundaries, so `closure (W \ Δ_v)` misses `r*`. -/ +theorem IsFan.edge_off_W {v₁ v₂ u h : Shat} {f₁ f₂ : Set Shat} {A₁ : GraphWalk D.rad.G.toGraph v₁ + u} {A₂ : GraphWalk D.rad.G.toGraph v₂ u} + {T : GraphWalk D.rad.G.toGraph u h} (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) + (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ Dv) (hb₁ : f₁ ⊆ discBd W) (hb₂ : f₂ ⊆ discBd W) + (hΔ : IsClosedDisc Δv) (hbv : discBd Δv = Dv.U) (hsub : Δv ⊆ W) {g : Set Shat} + (hr : r ∈ closure g) (hd : Disjoint g Δv) : ¬ g ⊆ W := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hW := hf.hub + have hne := hf.ne + have hl₁ := hf.link₁ + have hl₂ := hf.link₂ + have hvr₁ : r ≠ v₁ := fun h' ↦ hf.r_mem.2 (h' ▸ hf.spoke₁.2.v_mem.1) + have hvr₂ : r ≠ v₂ := fun h' ↦ hf.r_mem.2 (h' ▸ hf.spoke₂.2.v_mem.1) + let N : GraphWalk D.rad.G.toGraph v₁ v₂ := .cons (IsLink.symm' hl₁) (.cons hl₂ (.nil hl₂.2.2.1)) + have hNs : N.IsSimple := by + change [v₁, r, v₂].Nodup + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or, + List.nodup_nil, and_true] + exact ⟨⟨hvr₁.symm, hne⟩, hvr₂, not_false⟩ + have hNU : ∀ x, x ∈ (walkDrawing D.rad.G N).U ↔ x ∈ closure f₁ ∨ x ∈ closure f₂ := fun x ↦ by + rw [mem_walkDrawing_U] + constructor + · rintro (hx | ⟨e, he, hxe⟩) + · change x ∈ [v₁, r, v₂] at hx + simp only [List.mem_cons, List.not_mem_nil, or_false] at hx + rcases hx with rfl | rfl | rfl + · exact .inl (IsLink.right_mem_closure hl₁) + · exact .inl (IsLink.left_mem_closure hl₁) + · exact .inr (IsLink.right_mem_closure hl₂) + · change e ∈ [f₁, f₂] at he + simp only [List.mem_cons, List.not_mem_nil, or_false] at he + rcases he with rfl | rfl + · exact .inl hxe + · exact .inr hxe + · rintro (hx | hx) + · exact .inr ⟨f₁, List.mem_cons_self, hx⟩ + · exact .inr ⟨f₂, List.mem_cons_of_mem _ List.mem_cons_self, hx⟩ + have hline := isLine_of_isPathBetween (walkDrawing_isPathBetween D.rad.G hNs) hne + have hbf : frontier W = discBd W := IsClosedDisc.frontier_eq_discBd hT hW.is_disc + have hcl : ∀ {f : Set Shat}, f ⊆ discBd W → closure f ⊆ discBd W := fun hf ↦ closure_minimal hf + (hbf ▸ isClosed_frontier) + have hU := hf.U_eq hC + have hmeet : discBd Δv ∩ discBd W = (walkDrawing D.rad.G N).U := by + apply Subset.antisymm + · rintro x ⟨hx, hxb⟩ + rw [hbv, hU] at hx + rw [hNU] + rcases hx with ((hx | hx) | hx) | hx + · have hxv := IsSpokeWalk.meet_bd hW hf.bd_off hf.inner hf.spoke₁ (by + rw [U_append] + exact .inl hx) hxb + exact .inl (hxv ▸ IsLink.right_mem_closure hl₁) + · have hxv := IsSpokeWalk.meet_bd hW hf.bd_off hf.inner hf.spoke₂ (by + rw [U_append] + exact .inl hx) hxb + exact .inr (hxv ▸ IsLink.right_mem_closure hl₂) + · exact .inl hx + · exact .inr hx + · intro x hx + rcases (hNU x).mp hx with h₁ | h₁ + · exact ⟨by rw [hbv, hU]; exact .inl (.inr h₁), hcl hb₁ h₁⟩ + · exact ⟨by rw [hbv, hU]; exact .inr h₁, hcl hb₂ h₁⟩ + obtain ⟨-, -, hdiff⟩ := disc_difference Δv W _ v₁ v₂ hΔ hW.is_disc hsub hline hmeet + intro hgW + have hr₁ : r ∈ closure (W \ Δv) := closure_mono (show g ⊆ W \ Δv from fun x hx ↦ ⟨hgW hx, + disjoint_left.mp hd hx⟩) hr + have hrL : r ∈ (walkDrawing D.rad.G N).U := (hNU r).mpr (.inl (IsLink.left_mem_closure hl₁)) + have hrΔ : r ∈ Δv := by + have : r ∈ discBd Δv := by + rw [hbv, hU] + exact .inl (.inr (IsLink.left_mem_closure hl₁)) + exact Surface.discBd_subset _ this + have hm : r ∈ closure (W \ Δv) ∩ Δv := ⟨hr₁, hrΔ⟩ + rw [hdiff] at hm + refine hm.2 ⟨hrL, ?_⟩ + rintro (h' | h') + · exact hvr₁ h' + · exact hvr₂ h' + +/-- A chord of `D_v` that is short enough cannot exist: its two circuits are shorter than `F`, and +one of them points to `𝒯'`, so `F` would not be the distinction. -/ +theorem IsSectorEnclave.no_short_chord (hx : D.IsSectorEnclave W H ρ r Δv Dv ord' 𝒯' F) {a b : + Shat} {W₁ : GraphWalk D.rad.G.toGraph a b} + {W₂ : GraphWalk D.rad.G.toGraph b a} (hs : Splits Dv W₁ W₂) (hab : a ≠ b) {Q : GraphWalk + D.rad.G.toGraph a b} (hQ : Q.IsSimple) + (hV : ∀ x ∈ Q.support, x ∈ Dv.V → x = a ∨ x = b) (hE : ∀ e ∈ Q.edges, e ∉ Dv.E) + (h₁ : Q.length + W₁.length < F.E.ncard) + (h₂ : Q.length + W₂.length < F.E.ncard) : False := by + have : ConnectedSpace Shat := cap.connected + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + have hDv := hx.sector.Dv_circuit + have ht := Splits.twoPaths hs hab hDv.1 hQ hV hE + have hFc := hx.F_card + have hrep := hx.hrep + have hρ := hx.wheel.pos_ρ + have hE₁ : (walkDrawing D.rad.G W₁).E.ncard = W₁.length := ncard_walk_E _ hs.s₁ + have hE₂ : (walkDrawing D.rad.G W₂.reverse).E.ncard = W₂.length := by + rw [ncard_walk_E _ hs.s₂.reverse, GraphWalk.length_reverse] + have hEQ : (walkDrawing D.rad.G Q).E.ncard = Q.length := ncard_walk_E _ hQ + have hc : ∀ X : Drawing Shat, Disjoint (walkDrawing D.rad.G Q).E X.E → X.IsSubdrawing D.rad.G → + (D.rad.G.sup (walkDrawing D.rad.G Q) X).E.ncard = Q.length + X.E.ncard := fun X hd hX ↦ by + rw [Drawing.sup_E (walkDrawing_isSubdrawing _ _) hX, ncard_union_eq hd + (walkDrawing _ _).finite_edges X.finite_edges, hEQ] + have hdis : ∀ {X : Drawing Shat}, X.E ⊆ Dv.E → Disjoint (walkDrawing D.rad.G Q).E X.E := fun hX ↦ + disjoint_of_subset_right hX ht.meet_E + have c₁ := hc _ (hdis ht.left.1.2) ht.sub₁ + have c₂ := hc _ (hdis ht.right.1.2) ht.sub₂ + have hC₁ : Drawing.IsCircuitOf (D.rad.G.sup (walkDrawing D.rad.G Q) + (walkDrawing D.rad.G W₁)) D.rad.G := ⟨D.rad.G.sup_isSubdrawing _ _, ht.swap.left_circuit⟩ + have hC₂ : Drawing.IsCircuitOf (D.rad.G.sup (walkDrawing D.rad.G Q) + (walkDrawing D.rad.G W₂.reverse)) D.rad.G := ⟨D.rad.G.sup_isSubdrawing _ _, ht.left_circuit⟩ + have l₁ : (D.rad.G.sup (walkDrawing D.rad.G Q) (walkDrawing D.rad.G W₁)).E.ncard < F.E.ncard := by + omega + have l₂ : (D.rad.G.sup (walkDrawing D.rad.G Q) (walkDrawing D.rad.G W₂.reverse)).E.ncard < + F.E.ncard := by omega + have i₁ := D.ins_spec hC₁ (by omega) + have i₂ := D.ins_spec hC₂ (by omega) + have hcov := D.ins_theta (by omega) ht hDv (by omega) (by omega) (by omega) + rw [hx.ins_Dv] at hcov + have hFi := hx.isInsOf_F + have hd := hx.distinction + have hordF : F.E.ncard < 2 * ord' := by + have h₀ := hx.isTangle'.order_lt hd.1.2 + have e₀ : F.E.ncard = 2 * Hypergraph.separationOrder (partIn cap D.Γ (D.ins F)) (partIn cap D.Γ + (closure (D.ins F)ᶜ)) := disc_order hS h3 D.rad hFi.1 hFi.2.2.1 hFi.2.2.2.1 + have hcomm : Hypergraph.separationOrder (partIn cap D.Γ (closure (D.ins F)ᶜ)) (partIn cap D.Γ + (D.ins F)) = + Hypergraph.separationOrder (partIn cap D.Γ (D.ins F)) (partIn cap D.Γ (closure (D.ins F)ᶜ)) + := by + simp only [Hypergraph.separationOrder, GM10.inter_comm] + omega + rcases exists_small_side hS h3 hx.isTangle' hDv hx.sector.is_disc hx.sector.Dv_U.symm hx.mem hC₁ + i₁.2.2.1 i₁.2.2.2.1 hC₂ i₂.2.2.1 i₂.2.2.2.1 hcov (by omega) (by omega) with h | h + · have := enclave_card_le hS h3 D.tb hFi hd i₁ h + omega + · have := enclave_card_le hS h3 D.tb hFi hd i₂ h + omega + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13r.lean b/LeanPool/GraphMinor/GM19/Section13r.lean new file mode 100644 index 0000000000..5fdc659af8 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13r.lean @@ -0,0 +1,515 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13q + +/-! +# Graph Minors XIX, Section 13: step (7) of (13.6) + +We show that the point `h` is not in `ins(F)`. If it were, then `F` would run along the two spokes +up to `h`, every arc would have `r*` as an end, and there would be one outer +and one inner arc. The outer arc leaves `W` at `r*`, so it is long. Then the inner arc cuts `Δ_v` +into two discs with shorter boundaries than `F`, and one of them points to the +tangle `𝒯'`, against the choice of `F`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +omit [T2Space Shat] in +/-- A list of distinct edges of `F` is no longer than `F`. -/ +theorem length_le_of_nodup (F : Drawing Shat) {l : List (Set Shat)} (hn : l.Nodup) + (hE : ∀ e ∈ l, e ∈ F.E) : l.length ≤ F.E.ncard := by + classical + rw [← List.toFinset_card_of_nodup hn, ← Set.ncard_coe_finset] + exact Set.ncard_le_ncard (fun e he ↦ hE e (by simpa using he)) F.finite_edges + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {Δv : Set + Shat} {Dv F : Drawing Shat} + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {Δ₀ Δ : Set Shat} {C : + Drawing Shat} {h : Shat} + +omit [T2Space S] in +/-- A walk from outside `W` to a vertex of `W`, with no other vertex in `W`, enters at a point of +`bd(W)`. -/ +theorem IsWheelHubOfRadius.mem_bd_of_walk (hW : D.IsWheelHubOfRadius W H ρ) {a b : Shat} + (L : GraphWalk D.rad.G.toGraph a b) (ha : a ∉ W) (hb : b ∈ W) + (hL : ∀ x ∈ L.support, x ≠ b → x ∉ W) : b ∈ discBd W := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + induction L with + | nil _ => exact absurd hb ha + | @cons x y z e hl t ih => + by_cases hyz : y = z + · subst hyz + rcases hW.edge_side hl.1 with hs | hd + · have hcl : closure e ⊆ W := closure_minimal hs hW.is_disc.isClosed + exact absurd (hcl (IsLink.left_mem_closure hl)) ha + · exact hW.mem_bd_of_closure hd (IsLink.right_mem_closure hl) hb + · exact ih (hL y (by simp [t.start_mem_support]) hyz) hb fun z' hz' hne ↦ hL z' + (by simp [hz']) hne + +variable {v₁ v₂ u : Shat} {f₁ f₂ : Set Shat} {A₁ : GraphWalk D.rad.G.toGraph v₁ u} {A₂ : GraphWalk + D.rad.G.toGraph v₂ u} {T : GraphWalk D.rad.G.toGraph u h} + +/-- By (13.3), if `F` has the vertices `x` of the spoke and `h`, then it includes the spoke from `x` +to `h`. -/ +theorem IsFan.tail_in_enclave (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hF : IsEnclave D.tb D.ord D.𝒯 + F) {x : Shat} {X : GraphWalk D.rad.G.toGraph v₁ x} + {Y : GraphWalk D.rad.G.toGraph x u} (hA : A₁ = X.append Y) (hx : x ∈ F.V) + (hh : h ∈ F.V) : ∀ e ∈ (Y.append T).edges, e ∈ F.E := by + subst hA + have hend : h ∈ D.rad.G.toGraph.vertexSet := T.mem_vertexSet_of_mem_support T.end_mem_support + have hnil := GraphWalk.append_nil' (Y.append T) hend + have heq : (X.append Y).append T = X.append ((Y.append T).append (.nil hend)) := by + rw [hnil, GraphWalk.append_assoc'] + refine hf.spoke₁.2.subwalk_in_enclave hF (A := X) (Y.append T) (B := .nil hend) + (heq ▸ hf.spoke₁.1) (fun e ↦ ?_) hx hh + rw [walkDrawing_E, ← heq] + rfl + +/-- Two walks from `r*` to the same spoke, off `D_v` and in `F`, with no shared edge, cannot end +before `u`, if the later end comes after the earlier one. -/ +theorem IsFan.no_two_ends_ordered (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hF : F.IsCircuitOf D.rad.G) + (hE : IsEnclave D.tb D.ord D.𝒯 F) + (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ Dv) (hh : h ∈ F.V) {p q : Shat} {X : GraphWalk + D.rad.G.toGraph v₁ p} {Y : GraphWalk D.rad.G.toGraph p q} + {Z : GraphWalk D.rad.G.toGraph q u} (hA : A₁ = X.append (Y.append Z)) (hq : q ≠ u) + (hp : p ∈ F.V) {P : GraphWalk D.rad.G.toGraph r p} + {P' : GraphWalk D.rad.G.toGraph r q} (hPs : P.IsSimple) (hPF : ∀ e ∈ P.edges, e ∈ F.E) + (hP'F : ∀ e ∈ P'.edges, e ∈ F.E) (hPo : ∀ e ∈ P.edges, e ∉ Dv.E) + (hP'o : ∀ e ∈ P'.edges, e ∉ Dv.E) (hdis : ∀ e ∈ P'.edges, e ∉ P.edges) : False := by + have hsp : ∀ e ∈ ((Y.append Z).append T).edges, e ∈ F.E := hf.tail_in_enclave hE hA hp hh + have hYZ : ∀ e, e ∈ (Y.append Z).edges → e ∈ F.E := fun e he ↦ hsp e + (by rw [GraphWalk.edges_append]; exact List.mem_append_left _ he) + have hinD : ∀ e, e ∈ (Y.append Z).edges → e ∈ Dv.E := fun e he ↦ (hC.mem_E e).mpr (.inr (.inr + (.inl (by + rw [hA, GraphWalk.edges_append]; exact List.mem_append_right _ he)))) + have hne : r ≠ p := fun h' ↦ hf.r_notMem_spoke hf.spoke₁ (by + rw [h', GraphWalk.mem_support_append] + exact .inl (by rw [hA, GraphWalk.mem_support_append]; exact .inl X.end_mem_support)) + have hcov := circuit_cover hF hne hPs hPF (Y.append P'.reverse) (fun e he ↦ by + rw [GraphWalk.edges_append, List.mem_append, GraphWalk.edges_reverse, List.mem_reverse] at he + rcases he with he | he + · exact hYZ e (by rw [GraphWalk.edges_append]; exact List.mem_append_left _ he) + · exact hP'F e he) (fun e he hp' ↦ by + rw [GraphWalk.edges_append, List.mem_append, GraphWalk.edges_reverse, List.mem_reverse] at he + rcases he with he | he + · exact hPo e hp' (hinD e (by rw [GraphWalk.edges_append]; exact List.mem_append_left _ he)) + · exact hdis e he hp') + cases Z with + | nil _ => exact hq rfl + | @cons _ y _ g hg t => + have hgm : g ∈ (Y.append (GraphWalk.cons hg t)).edges := by + rw [GraphWalk.edges_append] + exact List.mem_append_right _ List.mem_cons_self + have hsimple : (Y.append (GraphWalk.cons hg t)).IsSimple := by + have hs := isSimple_of_append hf.spoke₁.1 + rw [hA] at hs + exact (isSimple_of_append hs.1).2 + rcases hcov g (hYZ g hgm) with h₁ | h₁ + · exact hPo g h₁ (hinD g hgm) + · rw [GraphWalk.edges_append, List.mem_append, GraphWalk.edges_reverse, List.mem_reverse] at h₁ + rcases h₁ with h₁ | h₁ + · exact Splits.append_edge hsimple h₁ List.mem_cons_self + · exact hP'o g h₁ (hinD g hgm) + +/-- Two such walks to the same spoke: one of them ends at `u`. -/ +theorem IsFan.no_two_ends (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hF : F.IsCircuitOf D.rad.G) + (hE : IsEnclave D.tb D.ord D.𝒯 F) + (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ Dv) (hh : h ∈ F.V) {p q : Shat} (hp : p ∈ A₁.support) + (hq : q ∈ A₁.support) (hpu : p ≠ u) (hqu : q ≠ u) (hpF : p ∈ F.V) (hqF : q ∈ F.V) + {P : GraphWalk D.rad.G.toGraph r p} {P' : GraphWalk D.rad.G.toGraph r q} (hPs : P.IsSimple) + (hP's : P'.IsSimple) (hPF : ∀ e ∈ P.edges, e ∈ F.E) (hP'F : ∀ e ∈ P'.edges, e ∈ F.E) + (hPo : ∀ e ∈ P.edges, e ∉ Dv.E) (hP'o : ∀ e ∈ P'.edges, e ∉ Dv.E) + (hdis : ∀ e ∈ P'.edges, e ∉ P.edges) : False := by + obtain ⟨X, Y, rfl⟩ := A₁.exists_append_of_mem hp + rcases (GraphWalk.mem_support_append _ _).mp hq with hq' | hq' + · obtain ⟨X', Y', rfl⟩ := X.exists_append_of_mem hq' + exact hf.no_two_ends_ordered hF hE hC hh (X := X') (Y := Y') (Z := Y) + (by rw [GraphWalk.append_assoc']) hpu hqF hP's hP'F hPF hP'o hPo + fun e he he' ↦ hdis e he' he + · obtain ⟨X', Y', rfl⟩ := Y.exists_append_of_mem hq' + exact hf.no_two_ends_ordered hF hE hC hh rfl hqu hpF hPs hPF hP'F hPo hP'o hdis + +end TangleDatum + +omit [T2Space Shat] in +/-- The ends of an arc are vertices of `F`. -/ +theorem IsArcOn.mem_F {G Dv F : Drawing Shat} {a b : Shat} {P : GraphWalk G.toGraph a b} + (hP : IsArcOn G Dv F P) (hF : F.IsSubdrawing G) : ∀ x ∈ P.support, x ∈ F.V := by + have ha : a ∈ F.V := by + cases hc : P with + | nil _ => exact absurd rfl hP.ne + | @cons _ y _ e hl t => + exact (Drawing.IsLink.mem_V_of_sub hF hl (hP.inF e (by + rw [hc] + exact List.mem_cons_self))).1 + exact support_subset_of_edges hF P ha hP.inF + +namespace TangleDatum.IsFar + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {Δv : Set + Shat} {Dv F : Drawing Shat} + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {Δ₀ Δ : Set Shat} {C : + Drawing Shat} {h : Shat} + {v₁ v₂ u : Shat} {f₁ f₂ : Set Shat} {A₁ : GraphWalk D.rad.G.toGraph v₁ u} {A₂ : GraphWalk + D.rad.G.toGraph v₂ u} {T : GraphWalk D.rad.G.toGraph u h} + +omit [T2Space S] [T2Space Shat] in +/-- An edge of the drawing has a point. -/ +theorem edge_nonempty {e : Set Shat} (he : e ∈ D.rad.G.E) : e.Nonempty := by + obtain ⟨x, -, y, -, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 e he + have hx : x ∈ closure e ∩ D.rad.G.V := by rw [hcap]; exact .inl rfl + exact closure_nonempty_iff.mp ⟨x, hx.1⟩ + +/-- The heart of step (7): the outer arc is long and the inner arc is a short chord of `D_v`. -/ +theorem false_of_ends (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) + (hfan : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ Dv) + (hb₁ : f₁ ⊆ discBd W) (hb₂ : f₂ ⊆ discBd W) (hh : h ∈ F.V) {a₁ a₂ : Shat} {O : GraphWalk + D.rad.G.toGraph r a₁} {I : GraphWalk D.rad.G.toGraph r a₂} + (hO : IsArcOn D.rad.G Dv F O) (hI : IsArcOn D.rad.G Dv F I) (hOo : ∀ e ∈ O.edges, Disjoint e + Δv) (hIi : ∀ e ∈ I.edges, e ⊆ discInt Δv) + (ha₁ : a₁ ∈ A₁.support) (ha₂ : a₂ ∈ A₂.support) : False := by + classical + have : ConnectedSpace Shat := cap.connected + have hx := hf.enc + have hW := hfan.hub + have hbdS := hfan.bd_off + have hinn := hfan.inner + have hFi := hx.isInsOf_F + have hE := hx.isEnclave + have hFsub := hFi.1.1 + have hΔv := hx.sector.is_disc + have hbv := hx.sector.Dv_U.symm + have hΔW := hx.sector.Δv_sub + have hmain := (hfan.main hC hx.hopt hΔv hΔW hbv).2 + have hK₁ := hfan.spoke₁ + have hK₂ := hfan.spoke₂ + obtain ⟨X₁, Y₁, hA₁⟩ := A₁.exists_append_of_mem ha₁ + obtain ⟨X₂, Y₂, hA₂⟩ := A₂.exists_append_of_mem ha₂ + have hF₁ : ∀ e ∈ (Y₁.append T).edges, e ∈ F.E := hfan.tail_in_enclave hE hA₁ + (hO.mem_F hFsub _ O.end_mem_support) hh + have hF₂ : ∀ e ∈ (Y₂.append T).edges, e ∈ F.E := hfan.swap.tail_in_enclave hE hA₂ + (hI.mem_F hFsub _ I.end_mem_support) hh + rw [GraphWalk.edges_append] at hF₁ hF₂ + have hY₁F : ∀ e ∈ Y₁.edges, e ∈ F.E := fun e he ↦ hF₁ e (List.mem_append_left _ he) + have hTF : ∀ e ∈ T.edges, e ∈ F.E := fun e he ↦ hF₁ e (List.mem_append_right _ he) + have hY₂F : ∀ e ∈ Y₂.edges, e ∈ F.E := fun e he ↦ hF₂ e (List.mem_append_left _ he) + have hY₁D : ∀ e ∈ Y₁.edges, e ∈ Dv.E := fun e he ↦ (hC.mem_E e).mpr (.inr (.inr (.inl (by + rw [hA₁, GraphWalk.edges_append]; exact List.mem_append_right _ he)))) + have hY₂D : ∀ e ∈ Y₂.edges, e ∈ Dv.E := fun e he ↦ (hC.mem_E e).mpr (.inr (.inr (.inr (by + rw [hA₂, GraphWalk.edges_append]; exact List.mem_append_right _ he)))) + have hTW : ∀ x ∈ T.support, x ∈ W ∧ x ≠ r := fun x hx' ↦ by + have hm : x ∈ (A₁.append T).support := (GraphWalk.mem_support_append _ _).mpr (.inr hx') + exact ⟨IsSpokeWalk.subset_W hW hbdS hinn hK₁ ((mem_walkDrawing_U _ _).mpr (.inl hm)), + fun h' ↦ hfan.r_notMem_spoke hK₁ (h' ▸ hm)⟩ + -- The first vertex of `O` after `r*` in `W`. + obtain ⟨y, g, hg, O', hOeq⟩ : ∃ (y : Shat) (g : Set Shat) (hg : D.rad.G.toGraph.IsLink g r y) + (O' : GraphWalk D.rad.G.toGraph y a₁), O = .cons hg O' := by + cases O with + | nil _ => exact absurd rfl hO.ne + | cons hl t => exact ⟨_, _, hl, t, rfl⟩ + subst hOeq + have ha₁W : a₁ ∈ W := IsSpokeWalk.subset_W hW hbdS hinn hK₁ ((mem_walkDrawing_U _ _).mpr (.inl + ((GraphWalk.mem_support_append _ _).mpr (.inl ha₁)))) + obtain ⟨v', hv'W, O₁, O₂, hO', hfirst⟩ := GraphWalk.exists_first_mem O' (X + := W) ⟨a₁, O'.end_mem_support, ha₁W⟩ + subst hO' + have hgoff : Disjoint g W := by + rcases hW.edge_side hg.1 with hs | hd + · exact absurd hs (hfan.edge_off_W hC hb₁ hb₂ hΔv hbv hΔW (IsLink.left_mem_closure hg) + (hOo g List.mem_cons_self)) + · exact hd + have hO₁nil : y ≠ v' := by + rintro rfl + have htil : tilde g ⊆ discBd W := by + intro p hp + have hpV : p ∈ closure g ∩ D.rad.G.V := ⟨hp.1, by + by_contra hn + exact hp.2 (closure_edge_subset hg.1 hp.1 |>.resolve_right hn)⟩ + rw [hg.2.2.2] at hpV + rcases hpV with rfl | rfl + · exact hfan.r_bd + · exact hW.mem_bd_of_closure hgoff (IsLink.right_mem_closure hg) hv'W + exact disjoint_left.mp hgoff (edge_nonempty hg.1).some_mem (hW.chord_in_W g hg.1 htil + (edge_nonempty hg.1).some_mem) + have hyW : y ∉ W := fun hn ↦ hO₁nil (hfirst y O₁.start_mem_support hn) + have hv'bd : v' ∈ discBd W := hW.mem_bd_of_walk O₁ hyW hv'W fun x hx' hne hn ↦ hne + (hfirst x hx' hn) + have hO₁len : 1 ≤ O₁.length := by + by_contra hn + cases O₁ with + | nil _ => exact hO₁nil rfl + | cons _ _ => simp at hn + -- The outer arc has at least `ρ + 2` edges, counted with the rest of the spoke. + have hO' : IsArcOn D.rad.G Dv F ((GraphWalk.cons hg O₁).append O₂) := hO + have hv'V : v' ∈ D.rad.G.V := O₂.mem_vertexSet_of_mem_support O₂.start_mem_support + obtain ⟨L', hLs, -, hLe⟩ := GM11.GraphWalk.exists_isSimple (O₂.append (Y₁.append T)) + have hb := IsSpokeWalk.le_walk_of_bd hW hbdS hinn hK₁ L' hv'V hv'bd + have sl₁ := hW.spoke_length hK₁ + have sl₂ := hW.spoke_length hK₂ + have hlong : ρ + 2 ≤ (GraphWalk.cons hg O₁).length + L'.length := by + have hc : (GraphWalk.cons hg O₁).length = O₁.length + 1 := rfl + rw [hc] + have hl : (A₁.append T).length + 1 ≤ L'.length ∨ 2 ≤ O₁.length := by + by_contra hn + push Not at hn + have hone : O₁.length = 1 := by omega + have heq : (A₁.append T).length = L'.length := by omega + have hpar := D.even_length_walk (GraphWalk.cons hg O₁) + rw [hc, hone] at hpar + exact hfan.r_mem.2 ((hpar.mp (by decide)).mpr (hb.2 heq)) + omega + have hLm : ∀ e ∈ L'.edges, e ∈ O₂.edges ∨ e ∈ Y₁.edges ∨ e ∈ T.edges := fun e he ↦ by + have := hLe e he + rwa [GraphWalk.edges_append, List.mem_append, GraphWalk.edges_append, List.mem_append] at this + have hOin : ∀ e, (e ∈ (GraphWalk.cons hg O₁).edges ∨ e ∈ O₂.edges) → e ∈ + ((GraphWalk.cons hg O₁).append O₂).edges := fun e he ↦ by + rw [GraphWalk.edges_append, List.mem_append] + exact he + have hOo' : ∀ e, (e ∈ (GraphWalk.cons hg O₁).edges ∨ e ∈ O₂.edges) → Disjoint e Δv + := fun e he ↦ hOo e (hOin e he) + have hnotI : ∀ e, (e ∈ (GraphWalk.cons hg O₁).edges ∨ e ∈ O₂.edges) → e ∉ I.edges + := fun e he hI' ↦ by + obtain ⟨x, hxe⟩ := edge_nonempty (hI.inF e hI' |> hFsub.2) + exact disjoint_left.mp (hOo' e he) hxe (discInt_subset _ (hIi e hI' hxe)) + have hTI : ∀ e ∈ T.edges, e ∉ I.edges := fun e he hI' ↦ by + obtain ⟨x, hxe⟩ := edge_nonempty (hI.inF e hI' |> hFsub.2) + have hin := hIi e hI' hxe + have hU : x ∈ (walkDrawing D.rad.G (A₁.append T)).U := by + refine (mem_walkDrawing_U _ _).mpr (.inr ⟨e, ?_, subset_closure hxe⟩) + rw [GraphWalk.edges_append] + exact List.mem_append_right _ he + exact hin.2 (hmain _ _ _ hK₁ ⟨hin.1, hU⟩) + have hOT : ∀ e ∈ (GraphWalk.cons hg O₁).edges, e ∉ T.edges := fun e he hT' ↦ by + obtain ⟨p, q, hpq, hp, hq, hcap⟩ := D.exists_ends_of_mem_edges _ he + obtain ⟨hp', hq'⟩ := D.ends_mem_support T hT' hcap + have key : ∀ x, x ∈ (GraphWalk.cons hg O₁).support → x ∈ T.support → x = v' := fun x h₁ h₂ ↦ by + rw [GraphWalk.support_cons, List.mem_cons] at h₁ + rcases h₁ with h₁ | h₁ + · exact absurd h₁ (hTW x h₂).2 + · exact hfirst x h₁ (hTW x h₂).1 + exact hpq ((key p hp hp').trans (key q hq hq').symm) + have hA₂s : (X₂.append Y₂).IsSimple := hA₂ ▸ (isSimple_of_append hK₂.1).1 + have hcard : (GraphWalk.cons hg O₁).edges.length + L'.edges.length + I.edges.length + + Y₂.edges.length ≤ F.E.ncard := by + rw [← List.length_append, ← List.length_append, ← List.length_append] + refine length_le_of_nodup F ?_ ?_ + · have n₁ := (isSimple_of_append hO'.simple).1.edges_nodup + refine List.nodup_append.mpr ⟨List.nodup_append.mpr ⟨List.nodup_append.mpr ⟨n₁, + hLs.edges_nodup, ?_⟩, hI.simple.edges_nodup, ?_⟩, (isSimple_of_append hA₂s).2.edges_nodup, + ?_⟩ + · rintro e he _ he' rfl + rcases hLm e he' with h₁ | h₁ | h₁ + · exact Splits.append_edge hO'.simple he h₁ + · exact hO'.off e (hOin e (.inl he)) (hY₁D e h₁) + · exact hOT e he h₁ + · rintro e he _ he' rfl + rw [List.mem_append] at he + rcases he with he | he + · exact hnotI e (.inl he) he' + · rcases hLm e he with h₁ | h₁ | h₁ + · exact hnotI e (.inr h₁) he' + · exact hI.off e he' (hY₁D e h₁) + · exact hTI e h₁ he' + · rintro e he _ he' rfl + have hD := hY₂D e he' + rw [List.mem_append, List.mem_append] at he + rcases he with (he | he) | he + · exact hO'.off e (hOin e (.inl he)) hD + · rcases hLm e he with h₁ | h₁ | h₁ + · exact hO'.off e (hOin e (.inr h₁)) hD + · exact hfan.edges_disjoint e (by + rw [hA₁, GraphWalk.edges_append] + exact List.mem_append_right _ h₁) (by + rw [hA₂, GraphWalk.edges_append] + exact List.mem_append_right _ he') + · exact hfan.swap.edges_disjoint_T e (by + rw [hA₂, GraphWalk.edges_append] + exact List.mem_append_right _ he') h₁ + · exact hI.off e he hD + · intro e he + simp only [List.mem_append] at he + rcases he with ((he | he) | he) | he + · exact hO'.inF e (hOin e (.inl he)) + · rcases hLm e he with h₁ | h₁ | h₁ + · exact hO'.inF e (hOin e (.inr h₁)) + · exact hY₁F e h₁ + · exact hTF e h₁ + · exact hI.inF e he + · exact hY₂F e he + -- The inner arc is a chord of `D_v`, and both of its circuits are shorter than `F`. + have hrX : r ∉ X₂.support := fun hn ↦ hfan.r_notMem_spoke hK₂ ((GraphWalk.mem_support_append _ + _).mpr (.inl (by + rw [hA₂, GraphWalk.mem_support_append]; exact .inl hn))) + have hPas : (GraphWalk.cons hfan.link₂ X₂).IsSimple := by + change (r :: X₂.support).Nodup + exact List.nodup_cons.mpr ⟨hrX, (isSimple_of_append hA₂s).1⟩ + have hPaE : ∀ e ∈ (GraphWalk.cons hfan.link₂ X₂).edges, e ∈ Dv.E := fun e he ↦ by + rw [GraphWalk.edges_cons, List.mem_cons] at he + refine (hC.mem_E e).mpr ?_ + rcases he with rfl | he + · exact .inr (.inl rfl) + · exact .inr (.inr (.inr (by + rw [hA₂, GraphWalk.edges_append] + exact List.mem_append_left _ he))) + obtain ⟨W₁, W₂, hs⟩ := exists_splits hC.circuit.2 hC.circuit.1 hI.left hI.right hI.ne + obtain ⟨R, hR⟩ := exists_side_of_walk (D := D) hI.ne hPas hPaE hs + have hadd := hR.card_add + have e₁ : (edgeSet (GraphWalk.cons hfan.link₂ X₂)).ncard = (GraphWalk.cons hfan.link₂ X₂).length + := by + rw [← ncard_walk_E D.rad.G hPas, walkDrawing_E] + rfl + have e₂ : (edgeSet R).ncard = R.length := by + rw [← ncard_walk_E D.rad.G hR.s₂, walkDrawing_E] + rfl + have e₃ : Dv.length = Dv.E.ncard := rfl + have hcl := hC.card + have hc₁ : (GraphWalk.cons hfan.link₂ X₂).length = X₂.length + 1 := rfl + have hlen₁ : (A₁.append T).length = A₁.length + T.length := GraphWalk.length_append _ _ + have hlen₂ : (A₂.append T).length = A₂.length + T.length := GraphWalk.length_append _ _ + have hlen₃ : A₂.length = X₂.length + Y₂.length := by rw [hA₂, GraphWalk.length_append] + simp only [edges_length] at hcard + exact hx.no_short_chord hR hI.ne hI.simple hI.inner hI.off (by omega) (by omega) + +/-- A vertex of `D_v` in `F` other than `r*` is joined to `u` along `D_v`, inside `F`. -/ +theorem exists_tail (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) (hfan : D.IsFan W H ρ r f₁ f₂ + A₁ A₂ T) (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ Dv) + (hh : h ∈ F.V) {x : Shat} (hx : x ∈ Dv.V) (hxr : x ≠ r) (hxF : x ∈ F.V) : ∃ w : GraphWalk + D.rad.G.toGraph x u, ∀ e ∈ w.edges, e ∈ F.E ∧ e ∈ Dv.E := by + rcases (hC.mem_V x).mp hx with rfl | hm | hm + · exact absurd rfl hxr + · obtain ⟨X, Y, hA⟩ := A₁.exists_append_of_mem hm + refine ⟨Y, fun e he ↦ ⟨hfan.tail_in_enclave hf.enc.isEnclave hA hxF hh e ?_, + (hC.mem_E e).mpr (.inr (.inr (.inl ?_)))⟩⟩ + · rw [GraphWalk.edges_append] + exact List.mem_append_left _ he + · rw [hA, GraphWalk.edges_append] + exact List.mem_append_right _ he + · obtain ⟨X, Y, hA⟩ := A₂.exists_append_of_mem hm + refine ⟨Y, fun e he ↦ ⟨hfan.swap.tail_in_enclave hf.enc.isEnclave hA hxF hh e ?_, + (hC.mem_E e).mpr (.inr (.inr (.inr ?_)))⟩⟩ + · rw [GraphWalk.edges_append] + exact List.mem_append_left _ he + · rw [hA, GraphWalk.edges_append] + exact List.mem_append_right _ he + +/-- If `h ∈ ins(F)`, then every arc has the end `r*`: otherwise `F` would be one arc and a walk of +`D_v`, and there are both an inner and an outer edge. -/ +theorem arc_end (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) (hfan : D.IsFan W H ρ r f₁ f₂ A₁ A₂ + T) (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ Dv) + (hh : h ∈ F.V) {a b : Shat} {P : GraphWalk D.rad.G.toGraph a b} (hP : IsArcOn D.rad.G Dv F P) : + a = r ∨ b = r := by + by_contra hn + push Not at hn + have hx := hf.enc + have hFi := hx.isInsOf_F + have hΔv := hx.sector.is_disc + have hbv := hx.sector.Dv_U.symm + have hFsub := hFi.1.1 + obtain ⟨wa, ha⟩ := hf.exists_tail hfan hC hh hP.left hn.1 (hP.mem_F hFsub _ P.start_mem_support) + obtain ⟨wb, hb⟩ := hf.exists_tail hfan hC hh hP.right hn.2 (hP.mem_F hFsub _ P.end_mem_support) + have hJ : ∀ e ∈ (wb.append wa.reverse).edges, e ∈ F.E ∧ e ∈ Dv.E := fun e he ↦ by + rw [GraphWalk.edges_append, List.mem_append, GraphWalk.edges_reverse, List.mem_reverse] at he + rcases he with he | he + · exact hb e he + · exact ha e he + have hcov := circuit_cover hFi.1 hP.ne hP.simple hP.inF _ (fun e he ↦ + (hJ e he).1) fun e he hp ↦ hP.off e hp (hJ e he).2 + have hin : ∀ e ∈ F.E, e ∉ Dv.E → e ∈ P.edges := fun e he hd ↦ (hcov e he).resolve_right fun hj ↦ + hd (hJ e hj).2 + have hsubΔ : ∀ x ∈ Dv.U, x ∈ discBd Δv := fun x hx' ↦ hbv ▸ hx' + obtain ⟨e₁, he₁, hd₁⟩ := hf.exists_edge_out + obtain ⟨e₂, he₂, hd₂⟩ := hf.exists_edge_in + obtain ⟨p₁, hp₁⟩ := edge_nonempty (hFsub.2 he₁) + obtain ⟨p₂, hp₂⟩ := edge_nonempty (hFsub.2 he₂) + have hUmem : ∀ {e : Set Shat}, e ∈ Dv.E → ∀ {p : Shat}, p ∈ e → p ∈ discBd Δv := fun he _ hp ↦ + hsubΔ _ (Dv.closure_subset_U he (subset_closure hp)) + have m₁ := hin e₁ he₁ fun hD ↦ disjoint_left.mp hd₁ hp₁ (Surface.discBd_subset _ (hUmem hD hp₁)) + have m₂ := hin e₂ he₂ fun hD ↦ (hd₂ hp₂).2 (hUmem hD hp₂) + rcases IsArcOn.side (D := D) hP hx.sector.Dv_circuit.1 hΔv hbv with h₁ | h₁ + · exact disjoint_left.mp hd₁ hp₁ (discInt_subset _ (h₁ e₁ m₁ hp₁)) + · exact disjoint_left.mp (h₁ e₂ m₂) hp₂ (discInt_subset _ (hd₂ hp₂)) + +/-- Step (7) of the proof of (13.6): `h ∉ ins(F)`. -/ +theorem notMem_ins_F (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) : h ∉ D.ins F := by + intro hm + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hx := hf.enc + have hW := hx.wheel + have hFi := hx.isInsOf_F + have hFsub := hFi.1.1 + obtain ⟨hV, -, hU⟩ := hf.point_of_mem_ins hm + have hhG : h ∈ D.rad.G.V := hW.H_sub.1 (by rw [hV]; rfl) + have hh : h ∈ F.V := IsSubdrawing.mem_V hFsub hU hhG + have hHeq : ∀ {y : Shat}, y ∈ H.V → y = h := fun hy ↦ by rw [hV] at hy; exact hy + rcases IsBoundarySector.cases hW hx.hbdS hx.hin hx.sector with ⟨v₁, v₂, u, h', f₁, f₂, A₁, A₂, T, + hfan, hC, hb₁, hb₂⟩ | + ⟨v₁, v₂, h₁, h₂, f₁, f₂, K₁, K₂, P, -, -, -, -, -, s₁, s₂, hdis, -⟩ + · obtain rfl : h' = h := hHeq hfan.spoke₁.2.h_mem + obtain ⟨a, b, P₀, hP₀, hout⟩ := hf.exists_outer_arc + obtain ⟨a', b', P₁, hP₁, hinn⟩ := hf.exists_inner_arc + have orient : ∀ {a b : Shat} (P : GraphWalk D.rad.G.toGraph a b), IsArcOn D.rad.G Dv F P → + ∃ (c : Shat) (P' : GraphWalk D.rad.G.toGraph r c), IsArcOn D.rad.G Dv F P' + ∧ ∀ e ∈ P'.edges, e ∈ P.edges := by + intro a b P hP + rcases hf.arc_end hfan hC hh hP with rfl | rfl + · exact ⟨_, P, hP, fun _ he ↦ he⟩ + · refine ⟨_, P.reverse, TangleDatum.IsArcOn.reverse hP, fun e he ↦ ?_⟩ + rwa [GraphWalk.edges_reverse, List.mem_reverse] at he + obtain ⟨a₁, O, hO, hOm⟩ := orient P₀ hP₀ + obtain ⟨a₂, I, hI, hIm⟩ := orient P₁ hP₁ + have hOo : ∀ e ∈ O.edges, Disjoint e Δv := fun e he ↦ hout e (hOm e he) + have hIi : ∀ e ∈ I.edges, e ⊆ discInt Δv := fun e he ↦ hinn e (hIm e he) + have hdis : ∀ e ∈ I.edges, e ∉ O.edges := fun e he he' ↦ by + obtain ⟨p, hp⟩ := edge_nonempty (hFsub.2 (hI.inF e he)) + exact disjoint_left.mp (hOo e he') hp (discInt_subset _ (hIi e he hp)) + have hpos : ∀ {c : Shat}, c ∈ Dv.V → c ≠ r → c ∈ A₁.support ∨ c ∈ A₂.support := fun hc hne ↦ + ((hC.mem_V _).mp hc).resolve_left hne + have good₁ : a₁ ∈ A₁.support → a₂ ∈ A₂.support → False := fun h₁ h₂ ↦ hf.false_of_ends hfan hC + hb₁ hb₂ hh hO hI hOo hIi h₁ h₂ + have good₂ : a₁ ∈ A₂.support → a₂ ∈ A₁.support → False := fun h₁ h₂ ↦ hf.false_of_ends + hfan.swap hC.swap hb₂ hb₁ hh hO hI hOo hIi h₁ h₂ + have hFa₁ := hO.mem_F hFsub _ O.end_mem_support + have hFa₂ := hI.mem_F hFsub _ I.end_mem_support + rcases hpos hO.right hO.ne.symm with h₁ | h₁ <;> rcases hpos hI.right hI.ne.symm with h₂ | h₂ + · by_cases hu₁ : a₁ = u + · exact good₂ (hu₁ ▸ A₂.end_mem_support) h₂ + by_cases hu₂ : a₂ = u + · exact good₁ h₁ (hu₂ ▸ A₂.end_mem_support) + exact hfan.no_two_ends hFi.1 hx.isEnclave hC hh h₁ h₂ hu₁ hu₂ hFa₁ hFa₂ hO.simple hI.simple + hO.inF hI.inF hO.off hI.off hdis + · exact good₁ h₁ h₂ + · exact good₂ h₁ h₂ + · by_cases hu₁ : a₁ = u + · exact good₁ (hu₁ ▸ A₁.end_mem_support) h₂ + by_cases hu₂ : a₂ = u + · exact good₂ h₁ (hu₂ ▸ A₁.end_mem_support) + exact hfan.swap.no_two_ends hFi.1 hx.isEnclave hC.swap hh h₁ h₂ hu₁ hu₂ hFa₁ hFa₂ hO.simple + hI.simple hO.inF hI.inF hO.off hI.off hdis + · have e₁ : h₁ = h := hHeq s₁.2.h_mem + have e₂ : h₂ = h := hHeq s₂.2.h_mem + exact hdis h (e₁ ▸ K₁.end_mem_support) (e₂ ▸ K₂.end_mem_support) + +end TangleDatum.IsFar + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13s.lean b/LeanPool/GraphMinor/GM19/Section13s.lean new file mode 100644 index 0000000000..6192a38b7d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13s.lean @@ -0,0 +1,490 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13r + +/-! +# Graph Minors XIX, Section 13: the shape of `D_v`, and step (8) of (13.6) + +The two forms of the sector are put into one shape: `D_v` is made of the edges `f₁, f₂` at `r*`, of +first parts `A₁, A₂` of the two spokes, and of vertices of `H`. +Step (8) says where the ends of an outer arc can be. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- A pushing of an arc goes in both directions. -/ +theorem PushesInto.symm {T : Type} [TopologicalSpace T] {Z Y L : Set T} {a b : T} + (h : PushesInto Z Y L a b) : PushesInto Z Y L b a := fun hb ha p hp ↦ by + obtain ⟨q, hq, hpq⟩ := h ha hb p.symm fun t ↦ hp _ + refine ⟨q.symm, fun t ↦ hq _, ?_⟩ + have := hpq.symm₂ + rwa [Path.symm_symm] at this + +omit [T2Space Shat] in +/-- In a simple walk from `x`, only the first edge has the end `x`. -/ +theorem GraphWalk.edge_at_start {G : Drawing Shat} {x y : Shat} (K : GraphWalk G.toGraph x y) + (hs : K.IsSimple) {e e' : Set Shat} (he : e ∈ K.edges) (he' : e' ∈ K.edges) + (hx : x ∈ closure e) (hx' : x ∈ closure e') : e = e' := by + cases K with + | nil _ => cases he + | @cons _ z _ g hg t => + have hxV : x ∈ G.V := hg.left_mem + have hnot : x ∉ t.support := (List.nodup_cons.mp hs).1 + have key : ∀ f ∈ (GraphWalk.cons hg t).edges, x ∈ closure f → f = g := fun f hf hxf ↦ by + rw [GraphWalk.edges_cons, List.mem_cons] at hf + rcases hf with rfl | hf + · rfl + · exfalso + obtain ⟨p, q, hl, A, B, rfl⟩ := GraphWalk.exists_split_edge t hf + have hm : x ∈ closure f ∩ G.V := ⟨hxf, hxV⟩ + rw [hl.2.2.2] at hm + refine hnot ((GraphWalk.mem_support_append _ _).mpr ?_) + rcases hm with rfl | rfl + · exact .inl A.end_mem_support + · exact .inr (by simp [B.start_mem_support]) + rw [key e he hx, key e' he' hx'] + +/-- A circuit has at most two edges at a vertex. -/ +theorem no_three_edges {G F : Drawing Shat} (hF : F.IsCircuitOf G) + (hG : ∀ g ∈ G.E, ∃ a b, a ≠ b ∧ closure g ∩ G.V = {a, b}) {x : Shat} (hx : x ∈ F.V) + {e₁ e₂ e₃ : Set Shat} (h₁ : e₁ ∈ F.E) (h₂ : e₂ ∈ F.E) (h₃ : e₃ ∈ F.E) (x₁ : x ∈ closure e₁) + (x₂ : x ∈ closure e₂) (x₃ : x ∈ closure e₃) (n₁₂ : e₁ ≠ e₂) (n₁₃ : e₁ ≠ e₃) + (n₂₃ : e₂ ≠ e₃) : False := by + obtain ⟨a, b, hab, hcap⟩ := hG e₁ (hF.1.2 h₁) + have hxV : x ∈ closure e₁ ∩ G.V := ⟨x₁, hF.1.1 hx⟩ + obtain ⟨y, hy, hxy⟩ : ∃ y, y ∈ F.V ∧ x ≠ y := by + rw [hcap] at hxV + have hab' : a ∈ F.V ∧ b ∈ F.V := by + have hl : G.toGraph.IsLink e₁ a b := ⟨hF.1.2 h₁, (by + have : a ∈ closure e₁ ∩ G.V := by rw [hcap]; exact .inl rfl + exact this.2), (by + have : b ∈ closure e₁ ∩ G.V := by rw [hcap]; exact .inr rfl + exact this.2), hcap⟩ + exact Drawing.IsLink.mem_V_of_sub hF.1 hl h₁ + rcases hxV with rfl | rfl + · exact ⟨b, hab'.2, hab⟩ + · exact ⟨a, hab'.1, hab.symm⟩ + obtain ⟨W₁, W₂, hs⟩ := exists_splits hF.2 hF.1 hx hy hxy + have hu₁ : ∀ {e e' : Set Shat}, e ∈ W₁.edges → e' ∈ W₁.edges → x ∈ closure e → x ∈ closure e' → e + = e' := fun he he' hx₁ hx₂ ↦ + GraphWalk.edge_at_start W₁ hs.s₁ he he' hx₁ hx₂ + have hu₂ : ∀ {e e' : Set Shat}, e ∈ W₂.edges → e' ∈ W₂.edges → x ∈ closure e → x ∈ closure e' → e + = e' := fun he he' hx₁ hx₂ ↦ by + refine GraphWalk.edge_at_start W₂.reverse hs.s₂.reverse ?_ ?_ hx₁ hx₂ + · rwa [GraphWalk.edges_reverse, List.mem_reverse] + · rwa [GraphWalk.edges_reverse, List.mem_reverse] + rcases (hs.E e₁).mp h₁ with a₁ | a₁ <;> + rcases (hs.E e₂).mp h₂ with a₂ | a₂ <;> rcases (hs.E e₃).mp h₃ with a₃ | a₃ + · exact n₁₂ (hu₁ a₁ a₂ x₁ x₂) + · exact n₁₂ (hu₁ a₁ a₂ x₁ x₂) + · exact n₁₃ (hu₁ a₁ a₃ x₁ x₃) + · exact n₂₃ (hu₂ a₂ a₃ x₂ x₃) + · exact n₂₃ (hu₁ a₂ a₃ x₂ x₃) + · exact n₁₃ (hu₂ a₁ a₃ x₁ x₃) + · exact n₁₂ (hu₂ a₁ a₂ x₁ x₂) + · exact n₁₂ (hu₂ a₁ a₂ x₁ x₂) + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {Δv : Set + Shat} {Dv F : Drawing Shat} + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {Δ₀ Δ : Set Shat} {C : + Drawing Shat} {h : Shat} + +omit [T2Space S] [T2Space Shat] in +/-- Every edge of the drawing has two distinct ends. -/ +theorem edge_two_ends (D : TangleDatum cap χ) : ∀ g ∈ D.rad.G.E, ∃ a b, a ≠ b + ∧ closure g ∩ D.rad.G.V = {a, b} := fun g hg ↦ by + obtain ⟨x, hx, y, hy, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 g hg + exact ⟨x, y, fun h' ↦ hy.2 (h' ▸ hx), hcap⟩ + +omit [T2Space S] in +/-- A spoke meets the hub only in its inner end. -/ +theorem IsSpokeWalk.U_inter_hub (hW : D.IsWheelHubOfRadius W H ρ) {v h₁ : Shat} {K : GraphWalk + D.rad.G.toGraph v h₁} (hK : D.IsSpokeWalk W H K) {y : Shat} + (hy : y ∈ (walkDrawing D.rad.G K).U) (hyH : y ∈ H.U) : y = h₁ := by + rcases (mem_walkDrawing_U _ _).mp hy with hs | ⟨e, he, hye⟩ + · exact hK.support_hub hs (mem_V_of_mem_U hW.H_sub hyH (K.mem_vertexSet_of_mem_support hs)) + · have heG : e ∈ D.rad.G.E := TieBreaker.mem_edges_E K he + obtain ⟨p, q, hpq, hp, hq, hcap⟩ := D.exists_ends_of_mem_edges K he + rcases closure_edge_subset heG hye with hin | hV + · have heH : e ∈ H.E := by + by_contra hn + exact disjoint_left.mp (edge_disjoint_U hW.H_sub heG hn) hin hyH + have hl : D.rad.G.toGraph.IsLink e p q := ⟨heG, K.mem_vertexSet_of_mem_support hp, + K.mem_vertexSet_of_mem_support hq, hcap⟩ + obtain ⟨h₁', h₂'⟩ := Drawing.IsLink.mem_V_of_sub hW.H_sub hl heH + exact absurd ((hK.support_hub hp h₁').trans (hK.support_hub hq h₂').symm) hpq + · have hm : y ∈ closure e ∩ D.rad.G.V := ⟨hye, hV⟩ + rw [hcap] at hm + have hs : y ∈ K.support := by + rcases hm with rfl | rfl + · exact hp + · exact hq + exact hK.support_hub hs (mem_V_of_mem_U hW.H_sub hyH hV) + +/-- Step (8), first part, when the spokes do not meet: an outer arc has no end inside the path `D_v +∩ H`, because `Δ_v ∪ ins(H)` is a disc around such an end, so the edge of the +arc there would be in `ins(H) \ H`, against (3). -/ +theorem IsFar.outer_end_path (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) {v₁ v₂ h₁ h₂ : Shat} + {f₁ f₂ : Set Shat} {K₁ : GraphWalk D.rad.G.toGraph v₁ h₁} + {K₂ : GraphWalk D.rad.G.toGraph v₂ h₂} {P : Drawing Shat} (hl₁ : D.rad.G.toGraph.IsLink f₁ r + v₁) (hl₂ : D.rad.G.toGraph.IsLink f₂ r v₂) + (hb₁ : f₁ ⊆ discBd W) (hb₂ : f₂ ⊆ discBd W) (h1 : D.IsSpokeWalk W H K₁) + (h2 : D.IsSpokeWalk W H K₂) (hdis : ∀ x ∈ K₁.support, x ∉ K₂.support) + (hP : Drawing.IsPathOf P H h₁ h₂) (hbd : discBd Δv = (walkDrawing D.rad.G K₁).U ∪ + (walkDrawing D.rad.G K₂).U ∪ P.U ∪ closure f₁ ∪ closure f₂) + {a b : Shat} {Q : GraphWalk D.rad.G.toGraph a b} (hQ : IsArcOn D.rad.G Dv F Q) + (ho : ∀ e ∈ Q.edges, Disjoint e Δv) (hn₀ : a ≠ r) (hn₁ : a ∉ K₁.support) + (hn₂ : a ∉ K₂.support) : + False := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hx := hf.enc + have hW := hx.wheel + have hDv := hx.sector.Dv_circuit + have hΔv := hx.sector.is_disc + have hbv := hx.sector.Dv_U.symm + have hFi := hx.isInsOf_F + have hne12 : h₁ ≠ h₂ := fun h' ↦ hdis h₁ K₁.end_mem_support (h' ▸ K₂.end_mem_support) + have hHV₁ : h₁ ∈ H.V := h1.2.h_mem + have hHV₂ : h₂ ∈ H.V := h2.2.h_mem + -- `H` is a circuit, since it has two vertices. + have hHe : IsEnclave D.tb D.ord D.𝒯 H ∧ H.E.ncard ≤ 4 * ρ + 4 := by + rcases hf.hub with ⟨hV, -⟩ | ⟨h₀, h₀', -⟩ + · rw [hV] at hHV₁ hHV₂ + exact absurd ((mem_singleton_iff.mp hHV₁).trans (mem_singleton_iff.mp hHV₂).symm) hne12 + · exact ⟨h₀, h₀'⟩ + obtain ⟨hEn, hEc⟩ := hHe + obtain ⟨-, -, -, hHc, hHlt, -⟩ := id hEn + have hHi := D.ins_spec hHc (by have := hW.rep_ge; omega) + have hΔH := hHi.2.2.1 + have hbH := hHi.2.2.2.1 + have hUH : H.U ⊆ D.ins H := fun x hx' ↦ Surface.discBd_subset _ (hbH ▸ hx') + have hUv : Dv.U ⊆ Δv := fun x hx' ↦ Surface.discBd_subset _ (hbv ▸ hx') + have hPU : P.U ⊆ discBd Δv := fun x hx' ↦ hbd ▸ .inl (.inl (.inr hx')) + -- `a` lies on the path `P`, away from its ends. + have haU : a ∈ discBd Δv := hbv ▸ Dv.V_subset_U hQ.left + have haV : a ∈ D.rad.G.V := hDv.1.1 hQ.left + have hclosV : ∀ {f : Set Shat} {y : Shat}, D.rad.G.toGraph.IsLink f r y → a ∈ closure f → a = r + ∨ a = y := fun {f _} hl hc ↦ by + have hm : a ∈ closure f ∩ D.rad.G.V := ⟨hc, haV⟩ + rw [hl.2.2.2] at hm + exact hm + have hsup : ∀ {u v : Shat} {K : GraphWalk D.rad.G.toGraph u v}, a ∈ (walkDrawing D.rad.G K).U + → a ∈ K.support := fun {_ _ K} hu ↦ by + have := mem_V_of_mem_U (walkDrawing_isSubdrawing D.rad.G K) hu haV + rw [walkDrawing_V] at this + exact this + have haP : a ∈ P.U := by + rw [hbd] at haU + rcases haU with (((h₀ | h₀) | h₀) | h₀) | h₀ + · exact absurd (hsup h₀) hn₁ + · exact absurd (hsup h₀) hn₂ + · exact h₀ + · rcases hclosV hl₁ h₀ with h' | h' + · exact absurd h' hn₀ + · exact absurd (h' ▸ K₁.start_mem_support) hn₁ + · rcases hclosV hl₂ h₀ with h' | h' + · exact absurd h' hn₀ + · exact absurd (h' ▸ K₂.start_mem_support) hn₂ + have hane₁ : a ≠ h₁ := fun h' ↦ hn₁ (h' ▸ K₁.end_mem_support) + have hane₂ : a ≠ h₂ := fun h' ↦ hn₂ (h' ▸ K₂.end_mem_support) + -- The first edge of the arc at `a`. + obtain ⟨y, e, hl, t, hQeq⟩ : ∃ (y : Shat) (e : Set Shat) (hl : D.rad.G.toGraph.IsLink e a y) + (t : GraphWalk D.rad.G.toGraph y b), Q = .cons hl t := by + cases Q with + | nil _ => exact absurd rfl hQ.ne + | cons hl t => exact ⟨_, _, hl, t, rfl⟩ + have heQ : e ∈ Q.edges := by rw [hQeq]; exact List.mem_cons_self + have heF : e ∈ F.E := hQ.inF e heQ + have heG : e ∈ D.rad.G.E := hl.1 + have haclos : a ∈ closure e := IsLink.left_mem_closure hl + have hdisΔ : Disjoint e Δv := ho e heQ + have heDv : e ∉ Dv.E := hQ.off e heQ + -- `e` is not an edge of `H`, as `H` has its two edges at `a` in `P`. + have hPG : Drawing.IsPathOf P D.rad.G h₁ h₂ := ⟨hP.1.trans hW.H_sub, hP.2⟩ + obtain ⟨K₀, hK₀, hV₀, hE₀⟩ := Drawing.IsPathOf.exists_simple_walk hPG + have haV₀ : a ∈ P.V := mem_V_of_mem_U hPG.1 haP haV + have hedgeDv : ∀ {g : Set Shat}, g ∈ P.E → g ∈ Dv.E := fun {g} hg ↦ by + by_contra hn + obtain ⟨x, hx'⟩ := (hPG.1.2 hg).1 + have hxU : x ∈ P.U := P.closure_subset_U hg (subset_closure hx') + exact disjoint_left.mp (edge_disjoint_U hDv.1 (hPG.1.2 hg) hn) hx' (hbv ▸ hPU hxU) + have heH : e ∉ H.E := by + intro heH + obtain ⟨L, M, hLM⟩ := K₀.exists_append_of_mem ((hV₀ a).mp haV₀) + obtain ⟨z, g₂, hg₂, t₂, hM⟩ : ∃ (z : Shat) (g : Set Shat) (hg : D.rad.G.toGraph.IsLink g a z) + (t : GraphWalk D.rad.G.toGraph z h₂), M = .cons hg t := by + cases M with + | nil _ => exact absurd rfl hane₂ + | cons hl t => exact ⟨_, _, hl, t, rfl⟩ + obtain ⟨z', g₁, hg₁, t₁, hL⟩ : ∃ (z : Shat) (g : Set Shat) (hg : D.rad.G.toGraph.IsLink g a z) + (t : GraphWalk D.rad.G.toGraph z h₁), L.reverse = .cons hg t := by + cases hR : L.reverse with + | nil _ => exact absurd rfl hane₁ + | cons hl t => exact ⟨_, _, hl, t, rfl⟩ + have hg₁L : g₁ ∈ L.edges := by + have : g₁ ∈ L.reverse.edges := by rw [hL]; exact List.mem_cons_self + rwa [GraphWalk.edges_reverse, List.mem_reverse] at this + have hg₂M : g₂ ∈ M.edges := by rw [hM]; exact List.mem_cons_self + have hP₁ : g₁ ∈ P.E := (hE₀ g₁).mpr (by + rw [hLM, GraphWalk.edges_append] + exact List.mem_append_left _ hg₁L) + have hP₂ : g₂ ∈ P.E := (hE₀ g₂).mpr (by + rw [hLM, GraphWalk.edges_append] + exact List.mem_append_right _ hg₂M) + have hne : g₁ ≠ g₂ := fun h' ↦ Splits.append_edge (hLM ▸ hK₀) hg₁L (h' ▸ hg₂M) + exact no_three_edges hHc D.edge_two_ends (hP.1.1 haV₀) heH (hP.1.2 hP₁) (hP.1.2 hP₂) haclos + (IsLink.left_mem_closure hg₁) (IsLink.left_mem_closure hg₂) + (fun h' ↦ heDv (h' ▸ hedgeDv hP₁)) (fun h' ↦ heDv (h' ▸ hedgeDv hP₂)) hne + rcases edge_inside_or_off hT hHc.1 hΔH hbH heG heH with hin | hoff + · obtain ⟨y', hy'⟩ := heG.1 + have hyU : y' ∈ F.U := F.closure_subset_U heF (subset_closure hy') + have hyF : y' ∈ D.ins F := Surface.discBd_subset _ (hFi.2.2.2.1 ▸ hyU) + have hm : y' ∈ D.ins F ∩ D.ins H := ⟨hyF, discInt_subset _ (hin hy')⟩ + rw [hx.hub_circuit hEn] at hm + exact (hin hy').2 (hbH ▸ hm.2) + · -- The union of `Δ_v` and `ins(H)` is a disc with `a` in its interior. + have hOff := IsBoundarySector.interior_off_hub hx.hopt hx.hbdS hx.hin hx.sector hEn hEc + have hmeet : Δv ∩ D.ins H = P.U := by + apply Subset.antisymm + · rintro y' ⟨hy₁, hy₂⟩ + by_cases hi₁ : y' ∈ discInt Δv + · have hc : y' ∈ closure (discInt (D.ins H)) := by rw [closure_discInt hΔH]; exact hy₂ + obtain ⟨z, hz₁, hz₂⟩ := mem_closure_iff.mp hc _ (hΔv.isOpen_discInt hman) hi₁ + exact absurd hz₂ (disjoint_left.mp hOff.symm hz₁) + by_cases hi₂ : y' ∈ discInt (D.ins H) + · have hc : y' ∈ closure (discInt Δv) := by rw [closure_discInt hΔv]; exact hy₁ + obtain ⟨z, hz₁, hz₂⟩ := mem_closure_iff.mp hc _ (hΔH.isOpen_discInt hman) hi₂ + exact absurd hz₂ (disjoint_left.mp hOff hz₁) + have hbdv : y' ∈ discBd Δv := by_contra fun hn ↦ hi₁ ⟨hy₁, hn⟩ + have hbdH : y' ∈ H.U := by + rw [← hbH] + exact by_contra fun hn ↦ hi₂ ⟨hy₂, hn⟩ + have hP₁ : h₁ ∈ P.U := P.V_subset_U ((hV₀ h₁).mpr K₀.start_mem_support) + have hP₂ : h₂ ∈ P.U := P.V_subset_U ((hV₀ h₂).mpr K₀.end_mem_support) + have hoffbd : ∀ {f : Set Shat}, f ⊆ discBd W → y' ∉ closure f := fun {f} hf' hc ↦ by + have hclos : closure f ⊆ discBd W := closure_minimal hf' (by + rw [← IsClosedDisc.frontier_eq_discBd hT hW.is_disc]; exact isClosed_frontier) + exact (hW.H_in_int hbdH).2 (hclos hc) + rw [hbd] at hbdv + rcases hbdv with (((h₀ | h₀) | h₀) | h₀) | h₀ + · rw [IsSpokeWalk.U_inter_hub hW h1 h₀ hbdH]; exact hP₁ + · rw [IsSpokeWalk.U_inter_hub hW h2 h₀ hbdH]; exact hP₂ + · exact h₀ + · exact absurd h₀ (hoffbd hb₁) + · exact absurd h₀ (hoffbd hb₂) + · intro x hx' + exact ⟨Surface.discBd_subset _ (hPU hx'), hUH (hP.1.U_subset hx')⟩ + obtain ⟨hdU, hbU⟩ := disc_union Δv (D.ins H) P.U h₁ h₂ hΔv hΔH (isLine_of_isPathBetween hP.2 + hne12) hmeet hPU (fun x hx' ↦ hbH ▸ hP.1.U_subset hx') + have hain : a ∈ discInt (Δv ∪ D.ins H) := by + refine ⟨.inl (Surface.discBd_subset _ (hbv ▸ Dv.V_subset_U hQ.left)), ?_⟩ + rw [hbU] + rintro ⟨-, h₀⟩ + refine h₀ ⟨haP, ?_⟩ + rintro (h' | h') + · exact hane₁ h' + · exact hane₂ h' + obtain ⟨z, hz₁, hz₂⟩ := mem_closure_iff.mp haclos _ (hdU.isOpen_discInt hman) hain + rcases discInt_subset _ hz₁ with h' | h' + · exact disjoint_left.mp hdisΔ hz₂ h' + · exact disjoint_left.mp hoff hz₂ h' + +end TangleDatum + +omit [T2Space Shat] in +/-- A simple closed walk has no edges. -/ +theorem GraphWalk.edges_of_closed {G : Drawing Shat} {a : Shat} (K : GraphWalk G.toGraph a a) + (hs : K.IsSimple) : K.edges = [] := by + cases K with + | nil _ => rfl + | cons hg t => exact absurd t.end_mem_support (List.nodup_cons.mp hs).1 + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {Δv : Set + Shat} {Dv F : Drawing Shat} + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {Δ₀ Δ : Set Shat} {C : + Drawing Shat} {h : Shat} + +/-- The two forms of a sector in one shape. The spokes are `A₁ T₁` and `A₂ T₂`, and `A₁, A₂` are in +`D_v`. Each vertex of `D_v` other than `r*` is on `A₁`, on `A₂` or in `H`, +and step (8) holds: the ends of outer arcs are `r*` or on `A₁ ∪ A₂`. -/ +structure IsShape (D : TangleDatum cap χ) (W : Set Shat) (H : Drawing Shat) (r : Shat) + (Δv : Set Shat) (Dv F : Drawing Shat) {v₁ v₂ c₁ c₂ h₁ h₂ : Shat} (f₁ f₂ : Set Shat) + (A₁ : GraphWalk D.rad.G.toGraph v₁ c₁) (A₂ : GraphWalk D.rad.G.toGraph v₂ c₂) + (T₁ : GraphWalk D.rad.G.toGraph c₁ h₁) (T₂ : GraphWalk D.rad.G.toGraph c₂ h₂) : Prop where + ne : v₁ ≠ v₂ + link₁ : D.rad.G.toGraph.IsLink f₁ r v₁ + link₂ : D.rad.G.toGraph.IsLink f₂ r v₂ + bd₁ : f₁ ⊆ discBd W + bd₂ : f₂ ⊆ discBd W + spoke₁ : D.IsSpokeWalk W H (A₁.append T₁) + spoke₂ : D.IsSpokeWalk W H (A₂.append T₂) + mem₁ : ∀ x ∈ A₁.support, x ∈ Dv.V + mem₂ : ∀ x ∈ A₂.support, x ∈ Dv.V + edge₁ : ∀ e ∈ A₁.edges, e ∈ Dv.E + edge₂ : ∀ e ∈ A₂.edges, e ∈ Dv.E + f₁_mem : f₁ ∈ Dv.E + f₂_mem : f₂ ∈ Dv.E + meet : ∀ x ∈ A₁.support, x ∈ A₂.support → x = c₁ ∧ x = c₂ + rest : ∀ x ∈ Dv.V, x ≠ r → x ∉ A₁.support → x ∉ A₂.support → x ∈ H.V + outer_end : ∀ {a b : Shat} {Q : GraphWalk D.rad.G.toGraph a b}, IsArcOn D.rad.G Dv F Q → + (∀ e ∈ Q.edges, Disjoint e Δv) → a = r ∨ a ∈ A₁.support ∨ a ∈ A₂.support + +variable {v₁ v₂ c₁ c₂ h₁ h₂ : Shat} {f₁ f₂ : Set Shat} {A₁ : GraphWalk D.rad.G.toGraph v₁ c₁} {A₂ : + GraphWalk D.rad.G.toGraph v₂ c₂} {T₁ : GraphWalk D.rad.G.toGraph c₁ h₁} + {T₂ : GraphWalk D.rad.G.toGraph c₂ h₂} + +omit [T2Space S] in +theorem IsShape.swap (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁ A₂ T₁ T₂) : D.IsShape W H r Δv Dv F f₂ + f₁ A₂ A₁ T₂ T₁ where + ne := s.ne.symm + link₁ := s.link₂ + link₂ := s.link₁ + bd₁ := s.bd₂ + bd₂ := s.bd₁ + spoke₁ := s.spoke₂ + spoke₂ := s.spoke₁ + mem₁ := s.mem₂ + mem₂ := s.mem₁ + edge₁ := s.edge₂ + edge₂ := s.edge₁ + f₁_mem := s.f₂_mem + f₂_mem := s.f₁_mem + meet x h₁ h₂ := (s.meet x h₂ h₁).symm + rest x hx hr h₁ h₂ := s.rest x hx hr h₂ h₁ + outer_end hQ ho := by + rcases s.outer_end hQ ho with h' | h' | h' + · exact .inl h' + · exact .inr (.inr h') + · exact .inr (.inl h') + +namespace IsFar + +/-- After step (7): the sector in its shape. In the fan form the two spokes share their tail. -/ +theorem shape_cases (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) : + (∃ (v₁ v₂ u h' : Shat) (f₁ f₂ : Set Shat) (A₁ : GraphWalk D.rad.G.toGraph v₁ u) + (A₂ : GraphWalk D.rad.G.toGraph v₂ u) (T : GraphWalk D.rad.G.toGraph u h'), + D.IsShape W H r Δv Dv F f₁ f₂ A₁ A₂ T T ∧ D.IsFan W H ρ r f₁ f₂ A₁ A₂ T + ∧ D.IsFanCircuit r f₁ f₂ A₁ A₂ Dv) ∨ + (∃ (v₁ v₂ h₁ h₂ : Shat) (f₁ f₂ : Set Shat) (K₁ : GraphWalk D.rad.G.toGraph v₁ h₁) + (K₂ : GraphWalk D.rad.G.toGraph v₂ h₂) (P : Drawing Shat), + D.IsShape W H r Δv Dv F f₁ f₂ K₁ K₂ (.nil (K₁.mem_vertexSet_of_mem_support + K₁.end_mem_support)) (.nil (K₂.mem_vertexSet_of_mem_support K₂.end_mem_support)) ∧ + (∀ x ∈ K₁.support, x ∉ K₂.support) ∧ Drawing.IsPathOf P H h₁ h₂ ∧ IsEnclave D.tb D.ord D.𝒯 H + ∧ H.E.ncard ≤ 4 * ρ + 4 ∧ P.U ⊆ Dv.U) := by + have hx := hf.enc + have hW := hx.wheel + have hDv := hx.sector.Dv_circuit + rcases IsBoundarySector.cases hW hx.hbdS hx.hin hx.sector with ⟨v₁, v₂, u, h', f₁, f₂, A₁, A₂, T, + hfan, hC, hb₁, hb₂⟩ | + ⟨v₁, v₂, h₁, h₂, f₁, f₂, K₁, K₂, P, hne, hl₁, hl₂, hb₁, hb₂, s₁, s₂, hdis, hP, hbd, -⟩ + · left + refine ⟨v₁, v₂, u, h', f₁, f₂, A₁, A₂, T, ?_, hfan, hC⟩ + refine ⟨hfan.ne, hfan.link₁, hfan.link₂, hb₁, hb₂, hfan.spoke₁, hfan.spoke₂, fun x hx' ↦ + (hC.mem_V x).mpr (.inr (.inl hx')), fun x hx' ↦ (hC.mem_V x).mpr (.inr (.inr hx')), + fun e he ↦ (hC.mem_E e).mpr (.inr (.inr (.inl he))), fun e he ↦ (hC.mem_E e).mpr (.inr (.inr + (.inr he))), (hC.mem_E _).mpr (.inl rfl), (hC.mem_E _).mpr (.inr (.inl rfl)), + fun x h₁ h₂ ↦ ⟨hfan.meet x h₁ h₂, hfan.meet x h₁ h₂⟩, fun x hx' hr h₁ h₂ ↦ ?_, fun {a b Q} hQ + _ ↦ (hC.mem_V a).mp hQ.left⟩ + rcases (hC.mem_V x).mp hx' with h₀ | h₀ | h₀ + · exact absurd h₀ hr + · exact absurd h₀ h₁ + · exact absurd h₀ h₂ + · right + have hUform : (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ∪ P.U ∪ closure f₁ ∪ + closure f₂ = Dv.U := by + rw [← hbd, hx.sector.Dv_U] + have hend₁ := K₁.mem_vertexSet_of_mem_support K₁.end_mem_support + have hend₂ := K₂.mem_vertexSet_of_mem_support K₂.end_mem_support + have hne12 : h₁ ≠ h₂ := fun h' ↦ hdis h₁ K₁.end_mem_support (h' ▸ K₂.end_mem_support) + have hHV₁ : h₁ ∈ H.V := s₁.2.h_mem + have hHV₂ : h₂ ∈ H.V := s₂.2.h_mem + have hHe : IsEnclave D.tb D.ord D.𝒯 H ∧ H.E.ncard ≤ 4 * ρ + 4 := by + rcases hf.hub with ⟨hV, -⟩ | ⟨h₀, h₀', -⟩ + · rw [hV] at hHV₁ hHV₂ + exact absurd ((mem_singleton_iff.mp hHV₁).trans (mem_singleton_iff.mp hHV₂).symm) hne12 + · exact ⟨h₀, h₀'⟩ + have hedgeDv : ∀ {e : Set Shat}, e ∈ D.rad.G.E → e ⊆ Dv.U → e ∈ Dv.E := fun {e} heG hs ↦ by + by_contra hn + obtain ⟨x, hx'⟩ := heG.1 + exact disjoint_left.mp (edge_disjoint_U hDv.1 heG hn) hx' (hs hx') + have hU₁ : (walkDrawing D.rad.G K₁).U ⊆ Dv.U := fun x hx' ↦ hUform ▸ .inl (.inl (.inl + (.inl hx'))) + have hU₂ : (walkDrawing D.rad.G K₂).U ⊆ Dv.U := fun x hx' ↦ hUform ▸ .inl (.inl (.inl + (.inr hx'))) + have hmemV : ∀ {a b : Shat} {K : GraphWalk D.rad.G.toGraph a b}, (walkDrawing D.rad.G K).U ⊆ + Dv.U → ∀ x ∈ K.support, x ∈ Dv.V := fun {a b K} hU x hx' ↦ + mem_V_of_mem_U hDv.1 (hU ((mem_walkDrawing_U _ _).mpr (.inl hx'))) + (K.mem_vertexSet_of_mem_support hx') + have hmemE : ∀ {a b : Shat} {K : GraphWalk D.rad.G.toGraph a b}, (walkDrawing D.rad.G K).U ⊆ + Dv.U → ∀ e ∈ K.edges, e ∈ Dv.E := fun {a b K} hU e he ↦ + hedgeDv (TieBreaker.mem_edges_E K he) fun x hx' ↦ hU ((mem_walkDrawing_U _ _).mpr + (.inr ⟨e, he, subset_closure hx'⟩)) + have hrest : ∀ x ∈ Dv.V, x ≠ r → x ∉ K₁.support → x ∉ K₂.support → x ∈ H.V ∧ x ∈ P.U + := fun x hxV hr h₁' h₂' ↦ by + have hxG : x ∈ D.rad.G.V := hDv.1.1 hxV + have hsup : ∀ {u v : Shat} {K : GraphWalk D.rad.G.toGraph u v}, x ∈ (walkDrawing D.rad.G K).U + → x ∈ K.support := fun {_ _ K} hu ↦ by + have := mem_V_of_mem_U (walkDrawing_isSubdrawing D.rad.G K) hu hxG + rw [walkDrawing_V] at this + exact this + have hclosV : ∀ {f : Set Shat} {y : Shat}, D.rad.G.toGraph.IsLink f r y → x ∈ closure f → x + = r ∨ x = y := fun {f _} hl hc ↦ by + have hm : x ∈ closure f ∩ D.rad.G.V := ⟨hc, hxG⟩ + rw [hl.2.2.2] at hm + exact hm + have hxU : x ∈ Dv.U := Dv.V_subset_U hxV + rw [← hUform] at hxU + rcases hxU with (((h₀ | h₀) | h₀) | h₀) | h₀ + · exact absurd (hsup h₀) h₁' + · exact absurd (hsup h₀) h₂' + · exact ⟨hP.1.1 (mem_V_of_mem_U (hP.1.trans hW.H_sub) h₀ hxG), h₀⟩ + · rcases hclosV hl₁ h₀ with h' | h' + · exact absurd h' hr + · exact absurd (h' ▸ K₁.start_mem_support) h₁' + · rcases hclosV hl₂ h₀ with h' | h' + · exact absurd h' hr + · exact absurd (h' ▸ K₂.start_mem_support) h₂' + have hs₁' : D.IsSpokeWalk W H (K₁.append (.nil hend₁)) := by + simpa only [GraphWalk.append_nil'] using s₁ + have hs₂' : D.IsSpokeWalk W H (K₂.append (.nil hend₂)) := by + simpa only [GraphWalk.append_nil'] using s₂ + refine ⟨v₁, v₂, h₁, h₂, f₁, f₂, K₁, K₂, P, ⟨hne, hl₁, hl₂, hb₁, hb₂, hs₁', hs₂', hmemV hU₁, + hmemV hU₂, hmemE hU₁, hmemE hU₂, + hedgeDv hl₁.1 (subset_closure.trans fun x hx' ↦ hUform ▸ .inl (.inr hx')), hedgeDv hl₂.1 + (subset_closure.trans fun x hx' ↦ hUform ▸ .inr hx'), + fun x h₁' h₂' ↦ absurd h₂' (hdis x h₁'), fun x hx' hr h₁' h₂' ↦ + (hrest x hx' hr h₁' h₂').1, fun {a b Q} hQ ho ↦ ?_⟩, hdis, hP, hHe.1, hHe.2, fun x hx' ↦ + hUform ▸ .inl (.inl (.inr hx'))⟩ + by_contra hn + push Not at hn + exact hf.outer_end_path hl₁ hl₂ hb₁ hb₂ s₁ s₂ hdis hP hbd hQ ho hn.1 hn.2.1 hn.2.2 + +end IsFar + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13t.lean b/LeanPool/GraphMinor/GM19/Section13t.lean new file mode 100644 index 0000000000..841cb183b8 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13t.lean @@ -0,0 +1,555 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13s + +/-! +# Graph Minors XIX, Section 13: steps (8) to (10) of (13.6) + +Two arcs with a common edge are the same. By (13.3) `F` runs along the spokes between its vertices +on them, and that closes up `F` in many cases, which leaves no room for an inner arc. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +omit [T2Space Shat] in +/-- The last edge of a walk with distinct ends. -/ +theorem GraphWalk.exists_edge_at_end {G : Drawing Shat} {a b : Shat} (K : GraphWalk G.toGraph a b) + (hab : a ≠ b) : ∃ e ∈ K.edges, b ∈ closure e := by + induction K with + | nil _ => exact absurd rfl hab + | @cons x y z e hl t ih => + by_cases hyz : y = z + · subst hyz + exact ⟨e, List.mem_cons_self, TangleDatum.IsLink.right_mem_closure hl⟩ + · obtain ⟨g, hg, hc⟩ := ih hyz + exact ⟨g, List.mem_cons_of_mem _ hg, hc⟩ + +omit [T2Space Shat] in +/-- The first edge of a walk with distinct ends. -/ +theorem GraphWalk.exists_edge_at_start {G : Drawing Shat} {a b : Shat} + (K : GraphWalk G.toGraph a b) (hab : a ≠ b) : ∃ e ∈ K.edges, a ∈ closure e := by + obtain ⟨e, he, hc⟩ := GraphWalk.exists_edge_at_end K.reverse hab.symm + exact ⟨e, by rwa [GraphWalk.edges_reverse, List.mem_reverse] at he, hc⟩ + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {Δv : Set + Shat} {Dv F : Drawing Shat} + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {Δ₀ Δ : Set Shat} {C : + Drawing Shat} {h : Shat} + +omit [T2Space S] in +/-- If an arc shares an edge with `P`, then its first end is on `P`. Otherwise it would enter `P` at +an end of `P`, which is a vertex of `D_v` inside the arc. -/ +theorem IsArcOn.start_mem_of_share {a b a' b' : Shat} {P : GraphWalk D.rad.G.toGraph a b} {P' : + GraphWalk D.rad.G.toGraph a' b'} {R : GraphWalk D.rad.G.toGraph b a} + (hP : IsArcOn D.rad.G Dv F P) (hP' : IsArcOn D.rad.G Dv F P') (hs : Splits F P R) {e : Set + Shat} (he : e ∈ P.edges) (he' : e ∈ P'.edges) : a' ∈ P.support := by + by_contra hn + obtain ⟨x, y, hl, L, M, hEq⟩ := GraphWalk.exists_split_edge P' he' + have hx : x ∈ P.support := (D.ends_mem_support P he hl.2.2.2).1 + obtain ⟨w, hw, L₁, L₂, hL, hfirst⟩ := GraphWalk.exists_first_mem L (X + := {z | z ∈ P.support}) ⟨x, L.end_mem_support, hx⟩ + subst hL + have hEq' : P' = L₁.append (L₂.append (GraphWalk.cons hl M)) := by + rw [hEq, GraphWalk.append_assoc'] + have hsim := hEq' ▸ hP'.simple + have hL₁s : L₁.IsSimple := (isSimple_of_append hsim).1 + have hnea : w ≠ a' := fun h' ↦ hn (h' ▸ hw) + obtain ⟨z, g, hg, t, hrev⟩ : ∃ (z : Shat) (g : Set Shat) (hg : D.rad.G.toGraph.IsLink g w z) + (t : GraphWalk D.rad.G.toGraph z a'), L₁.reverse = .cons hg t := by + cases hR : L₁.reverse with + | nil _ => exact absurd rfl hnea + | cons hl t => exact ⟨_, _, hl, t, rfl⟩ + have hgL : g ∈ L₁.edges := by + have : g ∈ L₁.reverse.edges := by rw [hrev]; exact List.mem_cons_self + rwa [GraphWalk.edges_reverse, List.mem_reverse] at this + have hzL : z ∈ L₁.support := by + have : z ∈ L₁.reverse.support := by rw [hrev]; simp [t.start_mem_support] + rwa [GraphWalk.support_reverse, List.mem_reverse] at this + have hzw : z ≠ w := fun h' ↦ by + have hr := hL₁s.reverse + rw [hrev] at hr + exact (List.nodup_cons.mp hr).1 (h' ▸ t.start_mem_support) + have hzP : z ∉ P.support := fun h' ↦ hzw (hfirst z hzL h') + have hgP : g ∉ P.edges := fun h' ↦ hzP (D.ends_mem_support P h' hg.2.2.2).2 + have hgP' : g ∈ P'.edges := by + rw [hEq', GraphWalk.edges_append] + exact List.mem_append_left _ hgL + have hgR : g ∈ R.edges := ((hs.E g).mp (hP'.inF g hgP')).resolve_left hgP + have hwR : w ∈ R.support := (D.ends_mem_support R hgR hg.2.2.2).1 + have hwD : w ∈ Dv.V := by + rcases hs.meet w hw hwR with rfl | rfl + · exact hP.left + · exact hP.right + have hwP' : w ∈ P'.support := by + rw [hEq', GraphWalk.mem_support_append] + exact .inl L₁.end_mem_support + rcases hP'.inner w hwP' hwD with h' | h' + · exact hnea h' + · subst h' + have hc := GraphWalk.edges_of_closed (L₂.append (GraphWalk.cons hl M)) + (isSimple_of_append hsim).2 + rw [GraphWalk.edges_append] at hc + simp at hc + +omit [T2Space S] in +/-- Two arcs with a common edge have the same edges. -/ +theorem IsArcOn.edges_of_share {a b a' b' : Shat} {P : GraphWalk D.rad.G.toGraph a b} {P' : + GraphWalk D.rad.G.toGraph a' b'} (hF : F.IsCircuitOf D.rad.G) + (hP : IsArcOn D.rad.G Dv F P) (hP' : IsArcOn D.rad.G Dv F P') {e : Set Shat} (he : e ∈ P.edges) + (he' : e ∈ P'.edges) : ∀ g ∈ P.edges, g ∈ P'.edges := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨W₁, W₂, h₀⟩ := exists_splits hF.2 hF.1 (hP.mem_F hF.1 _ P.start_mem_support) + (hP.mem_F hF.1 _ P.end_mem_support) hP.ne + obtain ⟨R, hs⟩ := exists_side_of_walk (D := D) hP.ne hP.simple hP.inF h₀ + have hrev : IsArcOn D.rad.G Dv F P'.reverse := IsArcOn.reverse hP' + have he'' : e ∈ P'.reverse.edges := by rwa [GraphWalk.edges_reverse, List.mem_reverse] + have ha' := IsArcOn.start_mem_of_share hP hP' hs he he' + have hb' := IsArcOn.start_mem_of_share hP hrev hs he he'' + rcases hP.inner a' ha' hP'.left with rfl | rfl <;> rcases hP.inner b' hb' hP'.right with rfl | rfl + · exact absurd rfl hP'.ne + · rcases eq_side_of_walk (D := D) hP'.ne hP'.simple hP'.inF hs with rfl | rfl + · exact fun _ hg ↦ hg + · rw [GraphWalk.edges_reverse, List.mem_reverse] at he' + exact absurd he' (hs.edge e he) + · rcases eq_side_of_walk (D := D) hrev.ne hrev.simple hrev.inF hs with h' | h' + · intro g hg + rw [← h', GraphWalk.edges_reverse, List.mem_reverse] at hg + exact hg + · rw [h', GraphWalk.edges_reverse, List.mem_reverse] at he'' + exact absurd he'' (hs.edge e he) + · exact absurd rfl hP'.ne + +omit [T2Space S] in +/-- Two arcs that differ in an edge have no common edge. -/ +theorem IsArcOn.edges_disjoint {a b a' b' : Shat} {P : GraphWalk D.rad.G.toGraph a b} {P' : + GraphWalk D.rad.G.toGraph a' b'} (hF : F.IsCircuitOf D.rad.G) + (hP : IsArcOn D.rad.G Dv F P) (hP' : IsArcOn D.rad.G Dv F P') (hne : ∃ e ∈ P.edges, e ∉ + P'.edges) : ∀ e ∈ P'.edges, e ∉ P.edges := fun e he' he ↦ by + obtain ⟨g, hg, hg'⟩ := hne + exact hg' (IsArcOn.edges_of_share hF hP hP' he he' g hg) + +variable {v₁ v₂ c₁ c₂ h₁ h₂ : Shat} {f₁ f₂ : Set Shat} {A₁ : GraphWalk D.rad.G.toGraph v₁ c₁} {A₂ : + GraphWalk D.rad.G.toGraph v₂ c₂} {T₁ : GraphWalk D.rad.G.toGraph c₁ h₁} + {T₂ : GraphWalk D.rad.G.toGraph c₂ h₂} + +/-- By (13.3), `F` includes the part of `A₁` between two of its vertices. -/ +theorem IsShape.middle_in_enclave (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁ A₂ T₁ T₂) + (hE : IsEnclave D.tb D.ord D.𝒯 F) {p q : Shat} {X : GraphWalk D.rad.G.toGraph v₁ p} + {Y : GraphWalk D.rad.G.toGraph p q} {Z : GraphWalk D.rad.G.toGraph q c₁} (hA : A₁ = X.append + (Y.append Z)) (hp : p ∈ F.V) (hq : q ∈ F.V) : ∀ e ∈ Y.edges, e ∈ F.E := by + subst hA + have heq : (X.append (Y.append Z)).append T₁ = X.append (Y.append (Z.append T₁)) := by + rw [GraphWalk.append_assoc', GraphWalk.append_assoc'] + refine s.spoke₁.2.subwalk_in_enclave hE (A := X) Y (B := Z.append T₁) (heq ▸ s.spoke₁.1) + (fun e ↦ ?_) hp hq + rw [walkDrawing_E, ← heq] + rfl + +/-- The part of `A₁` between two vertices of `F`, in `F`. -/ +theorem IsShape.exists_seg (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁ A₂ T₁ T₂) + (hE : IsEnclave D.tb D.ord D.𝒯 F) {a b : Shat} (ha : a ∈ A₁.support) (hb : b ∈ A₁.support) + (haF : a ∈ F.V) (hbF : b ∈ F.V) : ∃ Y : GraphWalk D.rad.G.toGraph a b, Y.IsSimple ∧ + (∀ e ∈ Y.edges, e ∈ A₁.edges ∧ e ∈ F.E) ∧ ∀ x ∈ Y.support, x ∈ A₁.support := by + have hA₁s : A₁.IsSimple := (isSimple_of_append s.spoke₁.1).1 + have key : ∀ {p q : Shat} (X : GraphWalk D.rad.G.toGraph v₁ p) (Y : GraphWalk D.rad.G.toGraph p + q) (Z : GraphWalk D.rad.G.toGraph q c₁), A₁ = X.append (Y.append Z) → + p ∈ F.V → q ∈ F.V → Y.IsSimple ∧ (∀ e ∈ Y.edges, e ∈ A₁.edges ∧ e ∈ F.E) + ∧ ∀ x ∈ Y.support, x ∈ A₁.support := by + intro p q X Y Z hA hp hq + refine ⟨?_, fun e he ↦ ⟨?_, s.middle_in_enclave hE hA hp hq e he⟩, fun x hx ↦ ?_⟩ + · rw [hA] at hA₁s + exact (isSimple_of_append (isSimple_of_append hA₁s).2).1 + · rw [hA, GraphWalk.edges_append, GraphWalk.edges_append] + exact List.mem_append_right _ (List.mem_append_left _ he) + · rw [hA, GraphWalk.mem_support_append, GraphWalk.mem_support_append] + exact .inr (.inl hx) + obtain ⟨X, Y, hXY⟩ := A₁.exists_append_of_mem ha + have hbm : b ∈ (X.append Y).support := hXY ▸ hb + rcases (GraphWalk.mem_support_append _ _).mp hbm with hb' | hb' + · obtain ⟨X', Y', hX⟩ := X.exists_append_of_mem hb' + obtain ⟨h₁', h₂', h₃'⟩ := key X' Y' Y (by rw [hXY, hX, GraphWalk.append_assoc']) hbF haF + refine ⟨Y'.reverse, h₁'.reverse, fun e he ↦ h₂' e ?_, fun x hx ↦ h₃' x ?_⟩ + · rwa [GraphWalk.edges_reverse, List.mem_reverse] at he + · rwa [GraphWalk.support_reverse, List.mem_reverse] at hx + · obtain ⟨Y', Z, hY⟩ := Y.exists_append_of_mem hb' + exact ⟨Y', key X Y' Z (by rw [hXY, hY]) haF hbF⟩ + +namespace IsFar + +/-- If `F` is one simple walk and another walk, with all edges in `D_v` or outside `Δ_v`, then `F` +has no edge inside `Δ_v`, which is false. -/ +theorem closing (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) {a b : Shat} {P : GraphWalk + D.rad.G.toGraph a b} {J : GraphWalk D.rad.G.toGraph b a} (hab : a ≠ b) + (hP : P.IsSimple) (hPF : ∀ e ∈ P.edges, e ∈ F.E) (hJF : ∀ e ∈ J.edges, e ∈ F.E) + (hd : ∀ e ∈ J.edges, e ∉ P.edges) + (hout : ∀ e, e ∈ P.edges ∨ e ∈ J.edges → e ∈ Dv.E ∨ Disjoint e Δv) : False := by + obtain ⟨e, he, hin⟩ := hf.exists_edge_in + have hFi := hf.enc.isInsOf_F + have hc := circuit_cover hFi.1 hab hP hPF J hJF hd e he + obtain ⟨x, hx⟩ := (hFi.1.1.2 he).1 + rcases hout e hc with h₁ | h₁ + · have hU : x ∈ Dv.U := Dv.closure_subset_U h₁ (subset_closure hx) + rw [hf.enc.sector.Dv_U] at hU + exact (hin hx).2 hU + · exact disjoint_left.mp h₁ hx (discInt_subset _ (hin hx)) + +/-- Step (8), second part: no outer arc has both ends on `A₁`. -/ +theorem not_both (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) (s : D.IsShape W H r Δv Dv F f₁ f₂ + A₁ A₂ T₁ T₂) {a b : Shat} {Q : GraphWalk D.rad.G.toGraph a b} + (hQ : IsArcOn D.rad.G Dv F Q) (ho : ∀ e ∈ Q.edges, Disjoint e Δv) (ha : a ∈ A₁.support) + (hb : b ∈ A₁.support) : False := by + have hFs := hf.enc.isInsOf_F.1.1 + obtain ⟨Y, -, hY, -⟩ := s.exists_seg hf.enc.isEnclave hb ha (hQ.mem_F hFs _ Q.end_mem_support) + (hQ.mem_F hFs _ Q.start_mem_support) + refine hf.closing hQ.ne hQ.simple hQ.inF (fun e he ↦ (hY e he).2) (fun e he hq ↦ hQ.off e hq + (s.edge₁ e (hY e he).1)) ?_ + rintro e (he | he) + · exact .inr (ho e he) + · exact .inl (s.edge₁ e (hY e he).1) + +/-- Each outer arc, in one of its directions, goes from `r*` to `A₁ ∪ A₂` or from `A₁` to `A₂`. -/ +theorem normal_form (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) (s : D.IsShape W H r Δv Dv F f₁ + f₂ A₁ A₂ T₁ T₂) {a b : Shat} {Q : GraphWalk D.rad.G.toGraph a b} + (hQ : IsArcOn D.rad.G Dv F Q) (ho : ∀ e ∈ Q.edges, Disjoint e Δv) : ∃ (a' b' : Shat) + (Q' : GraphWalk D.rad.G.toGraph a' b'), IsArcOn D.rad.G Dv F Q' ∧ + (∀ e, e ∈ Q'.edges ↔ e ∈ Q.edges) ∧ (∀ x, x ∈ Q'.support ↔ x ∈ Q.support) ∧ + (∀ L, ¬ PushesInto (Δ₀ \ {h}) (Δv \ {h}) L a b → ¬ PushesInto (Δ₀ \ {h}) + (Δv \ {h}) L a' b') ∧ + ((a' = r ∧ (b' ∈ A₁.support ∨ b' ∈ A₂.support)) ∨ (a' ∈ A₁.support ∧ b' ∈ A₂.support)) := by + have hrev : IsArcOn D.rad.G Dv F Q.reverse := IsArcOn.reverse hQ + have hrE : ∀ e, e ∈ Q.reverse.edges ↔ e ∈ Q.edges := fun e ↦ by + rw [GraphWalk.edges_reverse, List.mem_reverse] + have ho' : ∀ e ∈ Q.reverse.edges, Disjoint e Δv := fun e he ↦ ho e ((hrE e).mp he) + have hrS : ∀ x, x ∈ Q.reverse.support ↔ x ∈ Q.support := fun x ↦ by + rw [GraphWalk.support_reverse, List.mem_reverse] + have keep : (∀ L, ¬ PushesInto (Δ₀ \ {h}) (Δv \ {h}) L a b → ¬ PushesInto (Δ₀ \ {h}) + (Δv \ {h}) L a b) := fun _ h' ↦ h' + have flip : (∀ L, ¬ PushesInto (Δ₀ \ {h}) (Δv \ {h}) L a b → ¬ PushesInto (Δ₀ \ {h}) + (Δv \ {h}) L b a) := fun _ h' h'' ↦ h' h''.symm + rcases s.outer_end hQ ho with ha | ha | ha <;> rcases s.outer_end hrev ho' with hb | hb | hb + · exact absurd (ha.trans hb.symm) hQ.ne + · exact ⟨a, b, Q, hQ, fun _ ↦ Iff.rfl, fun _ ↦ Iff.rfl, keep, .inl ⟨ha, .inl hb⟩⟩ + · exact ⟨a, b, Q, hQ, fun _ ↦ Iff.rfl, fun _ ↦ Iff.rfl, keep, .inl ⟨ha, .inr hb⟩⟩ + · exact ⟨b, a, Q.reverse, hrev, hrE, hrS, flip, .inl ⟨hb, .inl ha⟩⟩ + · exact (hf.not_both s hQ ho ha hb).elim + · exact ⟨a, b, Q, hQ, fun _ ↦ Iff.rfl, fun _ ↦ Iff.rfl, keep, .inr ⟨ha, hb⟩⟩ + · exact ⟨b, a, Q.reverse, hrev, hrE, hrS, flip, .inl ⟨hb, .inr ha⟩⟩ + · exact ⟨b, a, Q.reverse, hrev, hrE, hrS, flip, .inr ⟨hb, ha⟩⟩ + · exact (hf.not_both s.swap hQ ho ha hb).elim + +/-- Step (9) of the proof of (13.6): two outer arcs do not both go from `A₁` to `A₂`, since `F` +would then have no inner arc. -/ +theorem not_cross (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) (s : D.IsShape W H r Δv Dv F f₁ + f₂ A₁ A₂ T₁ T₂) {a₀ b₀ a₁ b₁ : Shat} {F₀ : GraphWalk D.rad.G.toGraph a₀ b₀} + {F₁ : GraphWalk D.rad.G.toGraph a₁ b₁} (h₀ : IsArcOn D.rad.G Dv F F₀) + (h₁ : IsArcOn D.rad.G Dv F F₁) (o₀ : ∀ e ∈ F₀.edges, Disjoint e Δv) + (o₁ : ∀ e ∈ F₁.edges, Disjoint e Δv) + (hd : ∀ e ∈ F₁.edges, e ∉ F₀.edges) (ha₀ : a₀ ∈ A₁.support) (ha₁ : a₁ ∈ A₁.support) + (hb₀ : b₀ ∈ A₂.support) (hb₁ : b₁ ∈ A₂.support) : False := by + have hFs := hf.enc.isInsOf_F.1.1 + have hE := hf.enc.isEnclave + obtain ⟨Y₂, -, hY₂, -⟩ := s.swap.exists_seg hE hb₀ hb₁ (h₀.mem_F hFs _ F₀.end_mem_support) + (h₁.mem_F hFs _ F₁.end_mem_support) + obtain ⟨Y₁, -, hY₁, -⟩ := s.exists_seg hE ha₁ ha₀ (h₁.mem_F hFs _ F₁.start_mem_support) + (h₀.mem_F hFs _ F₀.start_mem_support) + have hJ : ∀ e, e ∈ (Y₂.append (F₁.reverse.append Y₁)).edges → e ∈ Y₂.edges ∨ e ∈ F₁.edges + ∨ e ∈ Y₁.edges := fun e he ↦ by + rwa [GraphWalk.edges_append, List.mem_append, GraphWalk.edges_append, List.mem_append, + GraphWalk.edges_reverse, List.mem_reverse] at he + refine hf.closing h₀.ne h₀.simple h₀.inF (J := Y₂.append (F₁.reverse.append Y₁)) (fun e he ↦ ?_) + (fun e he hq ↦ ?_) ?_ + · rcases hJ e he with h' | h' | h' + · exact (hY₂ e h').2 + · exact h₁.inF e h' + · exact (hY₁ e h').2 + · rcases hJ e he with h' | h' | h' + · exact h₀.off e hq (s.edge₂ e (hY₂ e h').1) + · exact hd e h' hq + · exact h₀.off e hq (s.edge₁ e (hY₁ e h').1) + · rintro e (he | he) + · exact .inr (o₀ e he) + · rcases hJ e he with h' | h' | h' + · exact .inl (s.edge₂ e (hY₂ e h').1) + · exact .inr (o₁ e h') + · exact .inl (s.edge₁ e (hY₁ e h').1) + +end IsFar + +/-- By (13.3), `F` includes the spoke from a vertex on `A₁` to a vertex on the tail. -/ +theorem IsShape.tail_part (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁ A₂ T₁ T₂) + (hE : IsEnclave D.tb D.ord D.𝒯 F) {p x : Shat} {X : GraphWalk D.rad.G.toGraph v₁ p} + {Y : GraphWalk D.rad.G.toGraph p c₁} (hA : A₁ = X.append Y) {T' : GraphWalk D.rad.G.toGraph c₁ + x} {T'' : GraphWalk D.rad.G.toGraph x h₁} (hT : T₁ = T'.append T'') (hp : p ∈ F.V) + (hx : x ∈ F.V) : ∀ e ∈ (Y.append T').edges, e ∈ F.E := by + subst hA hT + have heq : (X.append Y).append (T'.append T'') = X.append ((Y.append T').append T'') := by + rw [GraphWalk.append_assoc', GraphWalk.append_assoc'] + refine s.spoke₁.2.subwalk_in_enclave hE (A := X) (Y.append T') (B := T'') (heq ▸ s.spoke₁.1) + (fun e ↦ ?_) hp hx + rw [walkDrawing_E, ← heq] + rfl + +namespace IsFar + +variable {u : Shat} {A₁' : GraphWalk D.rad.G.toGraph v₁ u} {A₂' : GraphWalk D.rad.G.toGraph v₂ u} + {T : GraphWalk D.rad.G.toGraph u h₁} + +/-- No outer arc among two ends at the common vertex `u` of the spokes. -/ +theorem end_ne_common (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) + (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁' A₂' T T) {a₀ b₀ a₁ b₁ : Shat} {F₀ : GraphWalk + D.rad.G.toGraph a₀ b₀} + {F₁ : GraphWalk D.rad.G.toGraph a₁ b₁} (h₀ : IsArcOn D.rad.G Dv F F₀) + (h₁' : IsArcOn D.rad.G Dv F F₁) (o₀ : ∀ e ∈ F₀.edges, Disjoint e Δv) + (o₁ : ∀ e ∈ F₁.edges, Disjoint e Δv) + (hd : ∀ e ∈ F₁.edges, e ∉ F₀.edges) (n₀ : (a₀ = r ∧ (b₀ ∈ A₁'.support ∨ b₀ ∈ A₂'.support)) ∨ + (a₀ ∈ A₁'.support ∧ b₀ ∈ A₂'.support)) + (n₁ : (a₁ = r ∧ (b₁ ∈ A₁'.support ∨ b₁ ∈ A₂'.support)) ∨ (a₁ ∈ A₁'.support + ∧ b₁ ∈ A₂'.support)) : a₀ ≠ u ∧ b₀ ≠ u := by + have hFs := hf.enc.isInsOf_F.1.1 + have hE := hf.enc.isEnclave + have hW := hf.enc.wheel + have hu₁ : u ∈ A₁'.support := A₁'.end_mem_support + have hu₂ : u ∈ A₂'.support := A₂'.end_mem_support + have hrne : r ≠ u := fun h' ↦ IsWheelHubOfRadius.r_notMem_spoke hW hf.enc.hbdS hf.enc.hin + ⟨hf.enc.sector.rstar_mem.1, hf.enc.sector.rstar_mem.2⟩ s.spoke₁ + ((GraphWalk.mem_support_append _ _).mpr (.inl (h' ▸ hu₁))) + rcases n₀ with ⟨ra, hb⟩ | ⟨ha, hb⟩ + · subst ra + refine ⟨hrne, ?_⟩ + rintro rfl + have hF₀ : b₀ ∈ F.V := h₀.mem_F hFs _ F₀.end_mem_support + have hF₁ := h₁'.mem_F hFs _ F₁.end_mem_support + rcases n₁ with ⟨ra', hb'⟩ | ⟨ha', hb'⟩ + · subst ra' + have side : ∃ Y : GraphWalk D.rad.G.toGraph b₀ b₁, ∀ e ∈ Y.edges, e ∈ Dv.E ∧ e ∈ F.E := by + rcases hb' with hb' | hb' + · obtain ⟨Y, -, hY, -⟩ := s.exists_seg hE hu₁ hb' hF₀ hF₁ + exact ⟨Y, fun e he ↦ ⟨s.edge₁ e (hY e he).1, (hY e he).2⟩⟩ + · obtain ⟨Y, -, hY, -⟩ := s.swap.exists_seg hE hu₂ hb' hF₀ hF₁ + exact ⟨Y, fun e he ↦ ⟨s.edge₂ e (hY e he).1, (hY e he).2⟩⟩ + obtain ⟨Y, hY⟩ := side + have hJ : ∀ e, e ∈ (Y.append F₁.reverse).edges → e ∈ Y.edges ∨ e ∈ F₁.edges := fun e he ↦ by + rwa [GraphWalk.edges_append, List.mem_append, GraphWalk.edges_reverse, + List.mem_reverse] at he + refine hf.closing h₀.ne h₀.simple h₀.inF (J := Y.append F₁.reverse) (fun e he ↦ ?_) + (fun e he hq ↦ ?_) ?_ + · rcases hJ e he with h' | h' + · exact (hY e h').2 + · exact h₁'.inF e h' + · rcases hJ e he with h' | h' + · exact h₀.off e hq (hY e h').1 + · exact hd e h' hq + · rintro e (he | he) + · exact .inr (o₀ e he) + · rcases hJ e he with h' | h' + · exact .inl (hY e h').1 + · exact .inr (o₁ e h') + · obtain ⟨Y₂, -, hY₂, -⟩ := s.swap.exists_seg hE hb' hu₂ hF₁ hF₀ + obtain ⟨Y₁, -, hY₁, -⟩ := s.exists_seg hE hu₁ ha' hF₀ (h₁'.mem_F hFs _ F₁.start_mem_support) + have hJ : ∀ e, e ∈ (Y₂.append Y₁).edges → e ∈ Y₂.edges ∨ e ∈ Y₁.edges := fun e he ↦ by + rwa [GraphWalk.edges_append, List.mem_append] at he + refine hf.closing h₁'.ne h₁'.simple h₁'.inF (J := Y₂.append Y₁) (fun e he ↦ ?_) + (fun e he hq ↦ ?_) ?_ + · rcases hJ e he with h' | h' + · exact (hY₂ e h').2 + · exact (hY₁ e h').2 + · rcases hJ e he with h' | h' + · exact h₁'.off e hq (s.edge₂ e (hY₂ e h').1) + · exact h₁'.off e hq (s.edge₁ e (hY₁ e h').1) + · rintro e (he | he) + · exact .inr (o₁ e he) + · rcases hJ e he with h' | h' + · exact .inl (s.edge₂ e (hY₂ e h').1) + · exact .inl (s.edge₁ e (hY₁ e h').1) + · refine ⟨?_, ?_⟩ + · rintro rfl + exact hf.not_both s.swap h₀ o₀ hu₂ hb + · rintro rfl + exact hf.not_both s h₀ o₀ ha hu₁ + +/-- If two arcs end on `A₁`, away from `u`, then `F` has no vertex further along the spoke, since it +would have three edges at the later end. -/ +theorem beyond_ordered (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) + (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁' A₂' T T) {p q : Shat} {X : GraphWalk D.rad.G.toGraph v₁ p} + {Y : GraphWalk D.rad.G.toGraph p q} {Z : GraphWalk D.rad.G.toGraph q u} (hA : A₁' = X.append + (Y.append Z)) (hpF : p ∈ F.V) (hqF : q ∈ F.V) (hqu : q ≠ u) {g₁ g₂ : Set Shat} + (hg₁ : g₁ ∈ F.E) (hg₂ : g₂ ∈ F.E) (nd₁ : g₁ ∉ Dv.E) (nd₂ : g₂ ∉ Dv.E) (c₁' : p ∈ closure g₁) + (c₂' : q ∈ closure g₂) (hne : g₁ ≠ g₂) {x : Shat} (hx : x ∈ T.support) + (hxF : x ∈ F.V) : False := by + have : ConnectedSpace Shat := cap.connected + have hE := hf.enc.isEnclave + have hFc := hf.enc.isInsOf_F.1 + obtain ⟨T', T'', hT⟩ := T.exists_append_of_mem hx + have hA' : A₁' = (X.append Y).append Z := by rw [hA, GraphWalk.append_assoc'] + have hZF : ∀ e ∈ (Z.append T').edges, e ∈ F.E := s.tail_part hE hA' hT hqF hxF + have hYF : ∀ e ∈ Y.edges, e ∈ F.E := s.middle_in_enclave hE hA hpF hqF + obtain ⟨z₁, hz, hzc⟩ := GraphWalk.exists_edge_at_start Z hqu + have hzF : z₁ ∈ F.E := hZF z₁ (by rw [GraphWalk.edges_append]; exact List.mem_append_left _ hz) + have hzD : z₁ ∈ Dv.E := s.edge₁ z₁ (by + rw [hA, GraphWalk.edges_append, GraphWalk.edges_append] + exact List.mem_append_right _ (List.mem_append_right _ hz)) + by_cases hpq : p = q + · subst hpq + exact no_three_edges hFc D.edge_two_ends hqF hzF hg₁ hg₂ hzc c₁' c₂' (fun h' ↦ nd₁ (h' ▸ hzD)) + (fun h' ↦ nd₂ (h' ▸ hzD)) hne + · obtain ⟨y₁, hy, hyc⟩ := GraphWalk.exists_edge_at_end Y hpq + have hyD : y₁ ∈ Dv.E := s.edge₁ y₁ (by + rw [hA, GraphWalk.edges_append, GraphWalk.edges_append] + exact List.mem_append_right _ (List.mem_append_left _ hy)) + have hs : (Y.append Z).IsSimple := by + have := (isSimple_of_append s.spoke₁.1).1 + rw [hA] at this + exact (isSimple_of_append this).2 + exact no_three_edges hFc D.edge_two_ends hqF (hYF y₁ hy) hzF hg₂ hyc hzc c₂' + (fun h' ↦ Splits.append_edge hs hy (h' ▸ hz)) (fun h' ↦ nd₂ (h' ▸ hyD)) (fun h' ↦ nd₂ + (h' ▸ hzD)) + +/-- Either order of the two ends. -/ +theorem beyond (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) (s : D.IsShape W H r Δv Dv F f₁ f₂ + A₁' A₂' T T) {p q : Shat} (hp : p ∈ A₁'.support) (hq : q ∈ A₁'.support) + (hpF : p ∈ F.V) (hqF : q ∈ F.V) (hpu : p ≠ u) (hqu : q ≠ u) {g₁ g₂ : Set Shat} (hg₁ : g₁ ∈ F.E) + (hg₂ : g₂ ∈ F.E) (nd₁ : g₁ ∉ Dv.E) (nd₂ : g₂ ∉ Dv.E) + (c₁' : p ∈ closure g₁) (c₂' : q ∈ closure g₂) (hne : g₁ ≠ g₂) {x : Shat} (hx : x ∈ T.support) + (hxF : x ∈ F.V) : False := by + obtain ⟨X, Y, hXY⟩ := A₁'.exists_append_of_mem hp + have hbm : q ∈ (X.append Y).support := hXY ▸ hq + rcases (GraphWalk.mem_support_append _ _).mp hbm with hb' | hb' + · obtain ⟨X', Y', hX⟩ := X.exists_append_of_mem hb' + exact hf.beyond_ordered s (X := X') (Y := Y') (Z := Y) (by rw [hXY, hX, + GraphWalk.append_assoc']) hqF hpF hpu hg₂ hg₁ nd₂ nd₁ c₂' c₁' hne.symm hx hxF + · obtain ⟨Y', Z, hY⟩ := Y.exists_append_of_mem hb' + exact hf.beyond_ordered s (X := X) (Y := Y') (Z := Z) (by rw [hXY, + hY]) hpF hqF hqu hg₁ hg₂ nd₁ nd₂ c₁' c₂' hne hx hxF + +/-- The case of step (10) where both arcs start at `r*` and end on different sides. -/ +theorem two_sides (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) (s : D.IsShape W H r Δv Dv F f₁ + f₂ A₁' A₂' T T) (hfan : D.IsFan W H ρ r f₁ f₂ A₁' A₂' T) {p q : Shat} + {F₀ : GraphWalk D.rad.G.toGraph r p} {F₁ : GraphWalk D.rad.G.toGraph r q} + (h₀ : IsArcOn D.rad.G Dv F F₀) (h₁' : IsArcOn D.rad.G Dv F F₁) (o₀ : ∀ e ∈ F₀.edges, Disjoint + e Δv) + (o₁ : ∀ e ∈ F₁.edges, Disjoint e Δv) (hd : ∀ e ∈ F₁.edges, e ∉ F₀.edges) (hp : p ∈ A₁'.support) + (hq : q ∈ A₂'.support) (hpu : p ≠ u) (hqu : q ≠ u) {x : Shat} + (hx : x ∈ T.support) (hxF : x ∈ F.V) : False := by + have : ConnectedSpace Shat := cap.connected + have hFi := hf.enc.isInsOf_F + have hFc := hFi.1 + have hFs := hFc.1 + have hE := hf.enc.isEnclave + have hpF := h₀.mem_F hFs _ F₀.end_mem_support + have hqF := h₁'.mem_F hFs _ F₁.end_mem_support + obtain ⟨X₁, Y₁, hA₁⟩ := A₁'.exists_append_of_mem hp + obtain ⟨X₂, Y₂, hA₂⟩ := A₂'.exists_append_of_mem hq + obtain ⟨T', T'', hT⟩ := T.exists_append_of_mem hx + have h₁F : ∀ e ∈ (Y₁.append T').edges, e ∈ F.E := s.tail_part hE hA₁ hT hpF hxF + have h₂F : ∀ e ∈ (Y₂.append T').edges, e ∈ F.E := s.swap.tail_part hE hA₂ hT hqF hxF + obtain ⟨e₁, he₁, hc₁⟩ := GraphWalk.exists_edge_at_end Y₁ hpu + obtain ⟨e₂, he₂, hc₂⟩ := GraphWalk.exists_edge_at_end Y₂ hqu + have hm₁ : e₁ ∈ A₁'.edges := by + rw [hA₁, GraphWalk.edges_append] + exact List.mem_append_right _ he₁ + have hm₂ : e₂ ∈ A₂'.edges := by + rw [hA₂, GraphWalk.edges_append] + exact List.mem_append_right _ he₂ + have hF₁ : e₁ ∈ F.E := h₁F e₁ (by rw [GraphWalk.edges_append]; exact List.mem_append_left _ he₁) + have hF₂ : e₂ ∈ F.E := h₂F e₂ (by rw [GraphWalk.edges_append]; exact List.mem_append_left _ he₂) + have huF : u ∈ F.V := mem_V_of_mem_U hFs (F.closure_subset_U hF₁ hc₁) + (Y₁.mem_vertexSet_of_mem_support Y₁.end_mem_support) + have hxu : x = u := by + by_contra hne + obtain ⟨t, ht, htc⟩ := GraphWalk.exists_edge_at_start T' (Ne.symm hne) + have hmT : t ∈ T.edges := by rw [hT, GraphWalk.edges_append]; exact List.mem_append_left _ ht + have htF : t ∈ F.E := h₁F t (by + rw [GraphWalk.edges_append] + exact List.mem_append_right _ ht) + exact no_three_edges hFc D.edge_two_ends huF hF₁ hF₂ htF hc₁ hc₂ htc + (fun h' ↦ hfan.edges_disjoint e₁ hm₁ (h' ▸ hm₂)) (fun h' ↦ hfan.edges_disjoint_T e₁ hm₁ + (h' ▸ hmT)) (fun h' ↦ hfan.swap.edges_disjoint_T e₂ hm₂ (h' ▸ hmT)) + obtain ⟨S₁, -, hS₁, -⟩ := s.exists_seg hE hp A₁'.end_mem_support hpF huF + obtain ⟨S₂, -, hS₂, -⟩ := s.swap.exists_seg hE A₂'.end_mem_support hq huF hqF + have hJ : ∀ e, e ∈ (S₁.append (S₂.append F₁.reverse)).edges → e ∈ S₁.edges ∨ e ∈ S₂.edges + ∨ e ∈ F₁.edges := fun e he ↦ by + rwa [GraphWalk.edges_append, List.mem_append, GraphWalk.edges_append, List.mem_append, + GraphWalk.edges_reverse, List.mem_reverse] at he + refine hf.closing h₀.ne h₀.simple h₀.inF (J := S₁.append (S₂.append F₁.reverse)) (fun e he ↦ ?_) + (fun e he hq' ↦ ?_) ?_ + · rcases hJ e he with h' | h' | h' + · exact (hS₁ e h').2 + · exact (hS₂ e h').2 + · exact h₁'.inF e h' + · rcases hJ e he with h' | h' | h' + · exact h₀.off e hq' (s.edge₁ e (hS₁ e h').1) + · exact h₀.off e hq' (s.edge₂ e (hS₂ e h').1) + · exact hd e h' hq' + · rintro e (he | he) + · exact .inr (o₀ e he) + · rcases hJ e he with h' | h' | h' + · exact .inl (s.edge₁ e (hS₁ e h').1) + · exact .inl (s.edge₂ e (hS₂ e h').1) + · exact .inr (o₁ e h') + +/-- Step (10) of the proof of (13.6): `F` has no vertex on the common tail of the two spokes. -/ +theorem off_tail (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) (s : D.IsShape W H r Δv Dv F f₁ f₂ + A₁' A₂' T T) (hfan : D.IsFan W H ρ r f₁ f₂ A₁' A₂' T) {a₀ b₀ a₁ b₁ : Shat} + {F₀ : GraphWalk D.rad.G.toGraph a₀ b₀} {F₁ : GraphWalk D.rad.G.toGraph a₁ b₁} + (h₀ : IsArcOn D.rad.G Dv F F₀) (h₁' : IsArcOn D.rad.G Dv F F₁) (o₀ : ∀ e ∈ F₀.edges, Disjoint + e Δv) + (o₁ : ∀ e ∈ F₁.edges, Disjoint e Δv) (hd : ∀ e ∈ F₁.edges, e ∉ F₀.edges) (n₀ : (a₀ = r ∧ + (b₀ ∈ A₁'.support ∨ b₀ ∈ A₂'.support)) ∨ (a₀ ∈ A₁'.support ∧ b₀ ∈ A₂'.support)) + (n₁ : (a₁ = r ∧ (b₁ ∈ A₁'.support ∨ b₁ ∈ A₂'.support)) ∨ (a₁ ∈ A₁'.support + ∧ b₁ ∈ A₂'.support)) {x : Shat} (hx : x ∈ T.support) : x ∉ F.V := by + intro hxF + have hFs := hf.enc.isInsOf_F.1.1 + have hd' : ∀ e ∈ F₀.edges, e ∉ F₁.edges := fun e he he' ↦ hd e he' he + obtain ⟨u₁, u₂⟩ := hf.end_ne_common s h₀ h₁' o₀ o₁ hd n₀ n₁ + obtain ⟨u₃, u₄⟩ := hf.end_ne_common s h₁' h₀ o₁ o₀ hd' n₁ n₀ + obtain ⟨gs₀, hgs₀, cs₀⟩ := GraphWalk.exists_edge_at_start F₀ h₀.ne + obtain ⟨ge₀, hge₀, ce₀⟩ := GraphWalk.exists_edge_at_end F₀ h₀.ne + obtain ⟨gs₁, hgs₁, cs₁⟩ := GraphWalk.exists_edge_at_start F₁ h₁'.ne + obtain ⟨ge₁, hge₁, ce₁⟩ := GraphWalk.exists_edge_at_end F₁ h₁'.ne + have F₀b := h₀.mem_F hFs _ F₀.end_mem_support + have F₀a := h₀.mem_F hFs _ F₀.start_mem_support + have F₁b := h₁'.mem_F hFs _ F₁.end_mem_support + have F₁a := h₁'.mem_F hFs _ F₁.start_mem_support + rcases n₀ with ⟨ra, hb | hb⟩ | ⟨ha, hb⟩ <;> rcases n₁ with ⟨ra', hb' | hb'⟩ | ⟨ha', hb'⟩ + · exact hf.beyond s hb hb' F₀b F₁b u₂ u₄ (h₀.inF _ hge₀) (h₁'.inF _ hge₁) (h₀.off _ hge₀) + (h₁'.off _ hge₁) ce₀ ce₁ (fun h' ↦ hd _ hge₁ (h' ▸ hge₀)) hx hxF + · subst ra ra' + exact hf.two_sides s hfan h₀ h₁' o₀ o₁ hd hb hb' u₂ u₄ hx hxF + · exact hf.beyond s hb ha' F₀b F₁a u₂ u₃ (h₀.inF _ hge₀) (h₁'.inF _ hgs₁) (h₀.off _ hge₀) + (h₁'.off _ hgs₁) ce₀ cs₁ (fun h' ↦ hd _ hgs₁ (h' ▸ hge₀)) hx hxF + · subst ra ra' + exact hf.two_sides s.swap hfan.swap h₀ h₁' o₀ o₁ hd hb hb' u₂ u₄ hx hxF + · exact hf.beyond s.swap hb hb' F₀b F₁b u₂ u₄ (h₀.inF _ hge₀) (h₁'.inF _ hge₁) (h₀.off _ hge₀) + (h₁'.off _ hge₁) ce₀ ce₁ (fun h' ↦ hd _ hge₁ (h' ▸ hge₀)) hx hxF + · exact hf.beyond s.swap hb hb' F₀b F₁b u₂ u₄ (h₀.inF _ hge₀) (h₁'.inF _ hge₁) (h₀.off _ hge₀) + (h₁'.off _ hge₁) ce₀ ce₁ (fun h' ↦ hd _ hge₁ (h' ▸ hge₀)) hx hxF + · exact hf.beyond s ha hb' F₀a F₁b u₁ u₄ (h₀.inF _ hgs₀) (h₁'.inF _ hge₁) (h₀.off _ hgs₀) + (h₁'.off _ hge₁) cs₀ ce₁ (fun h' ↦ hd _ hge₁ (h' ▸ hgs₀)) hx hxF + · exact hf.beyond s.swap hb hb' F₀b F₁b u₂ u₄ (h₀.inF _ hge₀) (h₁'.inF _ hge₁) (h₀.off _ hge₀) + (h₁'.off _ hge₁) ce₀ ce₁ (fun h' ↦ hd _ hge₁ (h' ▸ hge₀)) hx hxF + · exact hf.not_cross s h₀ h₁' o₀ o₁ hd ha ha' hb hb' + +end IsFar + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13u.lean b/LeanPool/GraphMinor/GM19/Section13u.lean new file mode 100644 index 0000000000..06d44b9e6b --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13u.lean @@ -0,0 +1,744 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13t + +/-! +# Graph Minors XIX, Section 13: step (11) of (13.6) + +Let `F₁` be an outer arc from `r*` to a vertex `b` on `A₁`, that cannot be pushed into `Δ_v` in `Δ₀ +\ {h}`, and let `P₁` be the path of `D_v` from `r*` to `b` through `v₁`. +The disc in `Δ₀` bounded by `P₁ ∪ F₁` contains `h`, hence `ins(H)` and `Δ_v`, and then `ins(F)`. So +this disc is `Δ`, and `C = P₁ ∪ F₁`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- A connected set that meets the interior of a disc and misses its boundary lies in the interior. +-/ +theorem subset_discInt_of_connected {T : Type} [TopologicalSpace T] [T2Space T] {Δ' Y : Set T} + (hman : ∀ x : T, IsManifoldPoint x) (hΔ' : IsClosedDisc Δ') (hY : IsPreconnected Y) + (hb : Disjoint Y (discBd Δ')) (hne : (Y ∩ discInt Δ').Nonempty) : Y ⊆ discInt Δ' := by + refine IsPreconnected.subset_left_of_subset_union (hΔ'.isOpen_discInt hman) + hΔ'.isClosed.isOpen_compl ?_ ?_ hne hY + · exact disjoint_left.mpr fun x h₁ h₂ ↦ h₂ (discInt_subset _ h₁) + · intro x hx + by_cases hm : x ∈ Δ' + · exact .inl ⟨hm, disjoint_left.mp hb hx⟩ + · exact .inr hm + +/-- A walk along a drawing has its points in a larger walk, if vertices and edges are. -/ +theorem walkU_subset {G : Drawing Shat} {a b c d : Shat} {K : GraphWalk G.toGraph a b} {K' : + GraphWalk G.toGraph c d} (hV : ∀ x ∈ K.support, x ∈ K'.support) + (hE : ∀ e ∈ K.edges, e ∈ K'.edges) : (walkDrawing G K).U ⊆ (walkDrawing G K').U := fun x hx ↦ by + rcases (mem_walkDrawing_U _ _).mp hx with h | ⟨e, he, hxe⟩ + · exact (mem_walkDrawing_U _ _).mpr (.inl (hV x h)) + · exact (mem_walkDrawing_U _ _).mpr (.inr ⟨e, hE e he, hxe⟩) + +omit [T2Space Shat] in +/-- A vertex of a walk with distinct ends is on an edge of the walk. -/ +theorem GraphWalk.exists_edge_of_support {G : Drawing Shat} {a b x : Shat} + (K : GraphWalk G.toGraph a b) (hab : a ≠ b) (hx : x ∈ K.support) : ∃ e ∈ K.edges, x ∈ closure e + := by + by_cases hax : a = x + · subst hax + exact GraphWalk.exists_edge_at_start K hab + · obtain ⟨L, M, rfl⟩ := K.exists_append_of_mem hx + obtain ⟨e, he, hc⟩ := GraphWalk.exists_edge_at_end L hax + exact ⟨e, by rw [GraphWalk.edges_append]; exact List.mem_append_left _ he, hc⟩ + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {Δv : Set + Shat} {Dv F : Drawing Shat} + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {Δ₀ Δ : Set Shat} {C : + Drawing Shat} {h : Shat} + +/-- A connected set that joins the hub to `Δ_v` and stays off the arcs and off the upper part of +`D_v`. In the fan form this is the common tail, and otherwise an inner point of +an edge of `D_v ∩ H`. -/ +structure IsAnchor (D : TangleDatum cap χ) (H : Drawing Shat) (ρ : ℕ) (Δv : Set Shat) + (Dv F : Drawing Shat) (h : Shat) {v₁ v₂ c₁ c₂ : Shat} (f₁ f₂ : Set Shat) + (A₁ : GraphWalk D.rad.G.toGraph v₁ c₁) (A₂ : GraphWalk D.rad.G.toGraph v₂ c₂) + (Y : Set Shat) : Prop where + pre : IsPreconnected Y + meets : (Y ∩ Δv).Nonempty + hub : ∃ y ∈ Y, y = h ∨ (y ∈ H.U ∧ IsEnclave D.tb D.ord D.𝒯 H ∧ H.E.ncard ≤ 4 * ρ + 4 + ∧ h ∈ discInt (D.ins H)) + off_arc : ∀ {a b : Shat} {Q : GraphWalk D.rad.G.toGraph a b}, IsArcOn D.rad.G Dv F Q → Disjoint Y + (walkDrawing D.rad.G Q).U + off_f₁ : Disjoint Y (closure f₁) + off_f₂ : Disjoint Y (closure f₂) + off_A₁ : ∀ y ∈ Y, y ∈ (walkDrawing D.rad.G A₁).U → y = c₁ + off_A₂ : ∀ y ∈ Y, y ∈ (walkDrawing D.rad.G A₂).U → y = c₂ + +variable {v₁ v₂ c₁ c₂ h₁ h₂ : Shat} {f₁ f₂ : Set Shat} {A₁ : GraphWalk D.rad.G.toGraph v₁ c₁} {A₂ : + GraphWalk D.rad.G.toGraph v₂ c₂} {T₁ : GraphWalk D.rad.G.toGraph c₁ h₁} + {T₂ : GraphWalk D.rad.G.toGraph c₂ h₂} {Y : Set Shat} + +omit [T2Space S] in +theorem IsAnchor.swap (ha : D.IsAnchor H ρ Δv Dv F h f₁ f₂ A₁ A₂ Y) : D.IsAnchor H ρ Δv Dv F h f₂ + f₁ A₂ A₁ Y := + ⟨ha.pre, ha.meets, ha.hub, ha.off_arc, ha.off_f₂, ha.off_f₁, ha.off_A₂, ha.off_A₁⟩ + +namespace IsFar + +omit [T2Space S] in +/-- If `h` is not in a disc of `Δ₀` bounded by an arc and a path of `Δ_v`, then the arc can be +pushed across the disc into `Δ_v`. -/ +theorem mem_disc_of_blocked {a b : Shat} {Q N : + GraphWalk D.rad.G.toGraph a b} (hab : a ≠ b) (hN : N.IsSimple) + (hNv : (walkDrawing D.rad.G N).U ⊆ Δv) {Δ' : Set Shat} (hΔ' : IsClosedDisc Δ') (hs' : Δ' ⊆ Δ₀) + (hb' : discBd Δ' = (walkDrawing D.rad.G Q).U ∪ (walkDrawing D.rad.G N).U) + (hnp : ¬ PushesInto (Δ₀ \ {h}) (Δv \ {h}) (walkDrawing D.rad.G Q).U a b) : h ∈ Δ' := by + have : ConnectedSpace Shat := cap.connected + by_contra hh + apply hnp + intro ha₀ hb₀ p hp + have hZ : Δ' ⊆ Δ₀ \ {h} := fun x hx ↦ ⟨hs' hx, fun h' ↦ hh (h' ▸ hx)⟩ + have hin : ∀ {x : Shat}, x ∈ discBd Δ' → x ∈ Δ' := fun hx ↦ Surface.discBd_subset _ hx + have hNin : (walkDrawing D.rad.G N).U ⊆ Δ' := fun x hx ↦ hin (hb' ▸ .inr hx) + obtain ⟨n, hn⟩ := (isLine_of_isPathBetween (walkDrawing_isPathBetween D.rad.G hN) hab).exists_path + obtain ⟨q, hq⟩ := exists_path_in (hNin.trans hZ) hn ha₀ hb₀ + have haN : a ∈ Δ' := hNin ((mem_walkDrawing_U _ _).mpr (.inl N.start_mem_support)) + have hbN : b ∈ Δ' := hNin ((mem_walkDrawing_U _ _).mpr (.inl N.end_mem_support)) + refine ⟨q, fun t ↦ ⟨?_, ?_⟩, homotopic_of_mem hΔ'.isSimplyConnectedSet hZ p q haN hbN + (fun t ↦ hin (hb' ▸ .inl (hp t))) fun t ↦ ?_⟩ + · rw [hq]; exact hNv (hn t) + · rw [hq]; exact fun h' ↦ hh (h' ▸ hNin (hn t)) + · rw [hq]; exact hNin (hn t) + +private theorem enclave_inside_outer_circuit + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [T2Space S] + [TopologicalSpace Shat] + [T2Space Shat] + {α : Type w} + {cap : IsCappedSurface S Shat} + {χ : ColourScheme S α} + {D : TangleDatum cap χ} + {W : Set Shat} + {H : Drawing Shat} + {ρ : ℕ} + {r : Shat} + {Δv : Set Shat} + {Dv : Drawing Shat} + {F : Drawing Shat} + {ord' : ℕ} + {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {Δ₀ : Set Shat} + {Δ : Set Shat} + {C : Drawing Shat} + {h : Shat} + {v₁ : Shat} + {v₂ : Shat} + {c₁ : Shat} + {c₂ : Shat} + {h₁ : Shat} + {h₂ : Shat} + {f₁ : Set Shat} + {f₂ : Set Shat} + {A₁ : GraphWalk (Drawing.toGraph D.rad.G) v₁ c₁} + {A₂ : GraphWalk (Drawing.toGraph D.rad.G) v₂ c₂} + {T₁ : GraphWalk (Drawing.toGraph D.rad.G) c₁ h₁} + {T₂ : GraphWalk (Drawing.toGraph D.rad.G) c₂ h₂} + (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) + (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁ A₂ T₁ T₂) + {b : Shat} + {Q : GraphWalk (Drawing.toGraph D.rad.G) r b} + {X : GraphWalk (Drawing.toGraph D.rad.G) v₁ b} + (hQ : IsArcOn D.rad.G Dv F Q) + (ho : ∀ e ∈ Q.edges, Disjoint e Δv) + (hnp : ¬PushesInto (Δ₀ \ {h}) (Δv \ {h}) (walkDrawing D.rad.G Q).U r b) + (hT : IsClosedSurface Shat) + (hx : D.IsSectorEnclave W H ρ r Δv Dv ord' 𝒯' F) + (hFc : F.IsCircuitOf D.rad.G) + (hFs : Drawing.IsSubdrawing F D.rad.G) + (hE : IsEnclave D.tb D.ord D.𝒯 F) + (hDv : Dv.IsCircuitOf D.rad.G) + (hΔv : IsClosedDisc Δv) + (hbv : discBd Δv = Dv.U) + (hXA : ∀ y ∈ X.support, y ∈ A₁.support) + (hrnot : r ∉ (A₁.append T₁).support) + (hrA₂ : r ∉ (A₂.append T₂).support) + (hrX : r ∉ X.support) + (N : GraphWalk (Drawing.toGraph D.rad.G) r b) + (hNdef : N = GraphWalk.cons s.link₁ X) + (hNs : N.IsSimple) + (hNsup : ∀ (y : Shat), y ∈ N.support ↔ y = r ∨ y ∈ X.support) + (hNe : ∀ (e : Set Shat), e ∈ N.edges ↔ e = f₁ ∨ e ∈ X.edges) + (hrD : r ∈ Dv.V) + (hNV : ∀ y ∈ N.support, y ∈ Dv.V) + (hNE : ∀ e ∈ N.edges, e ∈ Drawing.E Dv) + (hNU : (walkDrawing D.rad.G N).U ⊆ Dv.U) + (hNcases : ∀ {y : Shat}, y ∈ (walkDrawing D.rad.G N).U → y ∈ closure f₁ ∨ y ∈ (walkDrawing + D.rad.G X).U) + (hQU : (walkDrawing D.rad.G Q).U ⊆ F.U) + (hbA : b ∈ A₁.support) + (hbF' : b ∈ F.V) + (hQs : (walkDrawing D.rad.G Q).IsSubdrawing D.rad.G) + (hNs' : (walkDrawing D.rad.G N).IsSubdrawing D.rad.G) + (hQp : (walkDrawing D.rad.G Q).IsPathBetween r b) + (hNp : (walkDrawing D.rad.G N).IsPathBetween r b) + (C' : Surface.Drawing Shat) + (hC' : C' = Drawing.sup D.rad.G (walkDrawing D.rad.G Q) (walkDrawing D.rad.G N)) + (hC'sub : C'.IsSubdrawing D.rad.G) + (hC'V : ∀ (y : Shat), y ∈ C'.V ↔ y ∈ Q.support ∨ y ∈ N.support) + (hC'E : ∀ (e : Set Shat), e ∈ C'.E ↔ e ∈ Q.edges ∨ e ∈ N.edges) + (hC'U : C'.U = (walkDrawing D.rad.G Q).U ∪ (walkDrawing D.rad.G N).U) + (hNΔ : (walkDrawing D.rad.G N).U ⊆ Δv) + (Δ' : Set Shat) + (hd' : IsClosedDisc Δ') + (hb' : discBd Δ' = C'.U) + (hbd : discBd Δ' = (walkDrawing D.rad.G Q).U ∪ (walkDrawing D.rad.G N).U) + (hinbd : ∀ {y : Shat}, y ∈ discBd Δ' → y ∈ Δ') + (hΔvΔ' : Δv ⊆ Δ') + (hDvΔ' : Dv.U ⊆ Δ') + (hNin : ∀ c ∈ C'.V, c ∈ Dv.V → c ∈ N.support) : + F.U ⊆ Δ' := by + refine U_of_edges hFc.2 hd'.isClosed fun g hgF ↦ ?_ + by_contra hn + have hgG : g ∈ D.rad.G.E := hFs.2 hgF + have hgD : g ∉ Dv.E := fun h' ↦ hn (subset_closure.trans ((Dv.closure_subset_U h').trans hDvΔ')) + have hgQ : g ∉ Q.edges := fun h' ↦ hn fun y hy ↦ hinbd (hbd ▸ .inl ((mem_walkDrawing_U _ _).mpr + (.inr ⟨g, h', subset_closure hy⟩))) + have hgC : g ∉ C'.E := fun h' ↦ by + rcases (hC'E g).mp h' with h₀ | h₀ + · exact hgQ h₀ + · exact hgD (hNE g h₀) + have hoff : Disjoint g Δ' := by + rcases edge_inside_or_off hT hC'sub hd' hb' hgG hgC with h₀ | h₀ + · exact absurd (h₀.trans (discInt_subset _)) hn + · exact h₀ + obtain ⟨a₀, b₀, P₀, hP₀, hgP₀⟩ := hf.exists_arc_through hgF hgD + have hP₀o : ∀ e ∈ P₀.edges, Disjoint e Δv := by + rcases IsArcOn.side (D := D) hP₀ hDv.1 hΔv hbv with h₀ | h₀ + · obtain ⟨p, hp⟩ := hgG.1 + exact absurd (hΔvΔ' (discInt_subset _ (h₀ g hgP₀ hp))) (disjoint_left.mp hoff hp) + · exact h₀ + obtain ⟨a', b', P, hP, hPE, -, -, n⟩ := hf.normal_form s hP₀ hP₀o + have hPo : ∀ e ∈ P.edges, Disjoint e Δv := fun e he ↦ hP₀o e ((hPE e).mp he) + have hgP : g ∈ P.edges := (hPE g).mpr hgP₀ + have endC : ∀ {c d : Shat} (L : GraphWalk D.rad.G.toGraph c d), IsArcOn D.rad.G Dv F L + → g ∈ L.edges → c ∈ C'.V := by + intro c d L hL hgL + by_contra hcn + have hdis : ∀ e ∈ L.edges, e ∉ Q.edges := fun e he he' ↦ hgQ (IsArcOn.edges_of_share hFc hL + hQ he he' g hgL) + have hLC : ∀ e ∈ L.edges, e ∉ C'.E := fun e he h' ↦ by + rcases (hC'E e).mp h' with h₀ | h₀ + · exact hdis e he h₀ + · exact hL.off e he (hNE e h₀) + have hmid : ∀ z ∈ L.support, z ≠ d → z ∉ C'.V := fun z hz hzd hzC ↦ by + by_cases hzc : z = c + · exact hcn (hzc ▸ hzC) + rcases (hC'V z).mp hzC with h₀ | h₀ + · obtain ⟨L₁, L₂, hL₁₂⟩ := L.exists_append_of_mem hz + obtain ⟨e₁, he₁, hc₁⟩ := GraphWalk.exists_edge_at_end L₁ (Ne.symm hzc) + obtain ⟨e₂, he₂, hc₂⟩ := GraphWalk.exists_edge_at_start L₂ hzd + obtain ⟨e₃, he₃, hc₃⟩ := GraphWalk.exists_edge_of_support Q hQ.ne h₀ + have hm₁ : e₁ ∈ L.edges := by + rw [hL₁₂, GraphWalk.edges_append] + exact List.mem_append_left _ he₁ + have hm₂ : e₂ ∈ L.edges := by + rw [hL₁₂, GraphWalk.edges_append] + exact List.mem_append_right _ he₂ + have hzF : z ∈ F.V := hL.mem_F hFs z hz + exact no_three_edges hFc D.edge_two_ends hzF (hL.inF _ hm₁) (hL.inF _ hm₂) + (hQ.inF _ he₃) hc₁ hc₂ hc₃ (fun h' ↦ Splits.append_edge (hL₁₂ ▸ hL.simple) he₁ (h' ▸ he₂)) + (fun h' ↦ hdis _ hm₁ (h' ▸ he₃)) (fun h' ↦ hdis _ hm₂ (h' ▸ he₃)) + · have hzD := hNV z h₀ + rcases hL.inner z hz hzD with h' | h' + · exact hzc h' + · exact hzd h' + have hcint : c ∈ discInt Δ' := by + refine ⟨hDvΔ' (Dv.V_subset_U hL.left), fun hb₀ ↦ hcn ?_⟩ + exact mem_V_of_mem_U hC'sub (hb' ▸ hb₀) (hDv.1.1 hL.left) + have := (side_of_walk (D := D) hC'sub hd' hb' L hL.simple hmid hLC).1 hcint g hgL + obtain ⟨p, hp⟩ := hgG.1 + exact disjoint_left.mp hoff hp (discInt_subset _ (this hp)) + have ha'C := endC P hP hgP + have hb'C := endC P.reverse (IsArcOn.reverse hP) (by rwa [GraphWalk.edges_reverse, + List.mem_reverse]) + have ha'N := hNin a' ha'C hP.left + have hb'N := hNin b' hb'C hP.right + have hdisPQ : ∀ e ∈ P.edges, e ∉ Q.edges := fun e he he' ↦ hgQ (IsArcOn.edges_of_share hFc hP + hQ he he' g hgP) + rcases n with ⟨rfl, -⟩ | ⟨h₀, h₁'⟩ + · have hb'X : b' ∈ X.support := ((hNsup b').mp hb'N).resolve_left hP.ne.symm + obtain ⟨Sg, -, hSg, -⟩ := s.exists_seg hE hbA (hXA b' hb'X) hbF' + (hP.mem_F hFs _ P.end_mem_support) + have hJ : ∀ e, e ∈ (Sg.append P.reverse).edges → e ∈ Sg.edges ∨ e ∈ P.edges := fun e he ↦ by + rwa [GraphWalk.edges_append, List.mem_append, GraphWalk.edges_reverse, + List.mem_reverse] at he + refine hf.closing hQ.ne hQ.simple hQ.inF (J := Sg.append P.reverse) (fun e he ↦ ?_) + (fun e he hq ↦ ?_) ?_ + · rcases hJ e he with h' | h' + · exact (hSg e h').2 + · exact hP.inF e h' + · rcases hJ e he with h' | h' + · exact hQ.off e hq (s.edge₁ e (hSg e h').1) + · exact hdisPQ e h' hq + · rintro e (he | he) + · exact .inr (ho e he) + · rcases hJ e he with h' | h' + · exact .inl (s.edge₁ e (hSg e h').1) + · exact .inr (hPo e h') + · rcases (hNsup b').mp hb'N with rfl | h₂' + · exact hrA₂ ((GraphWalk.mem_support_append _ _).mpr (.inl h₁')) + · exact hf.not_both s hP hPo h₀ (hXA b' h₂') + +private theorem sector_inside_outer_circuit + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [TopologicalSpace Shat] + [T2Space Shat] + {α : Type w} + {cap : IsCappedSurface S Shat} + {χ : ColourScheme S α} + {D : TangleDatum cap χ} + {H : Drawing Shat} + {ρ : ℕ} + {r : Shat} + {Δv : Set Shat} + {Dv : Drawing Shat} + {F : Drawing Shat} + {h : Shat} + {v₁ : Shat} + {v₂ : Shat} + {c₁ : Shat} + {c₂ : Shat} + {f₁ : Set Shat} + {f₂ : Set Shat} + {A₁ : GraphWalk (Drawing.toGraph D.rad.G) v₁ c₁} + {A₂ : GraphWalk (Drawing.toGraph D.rad.G) v₂ c₂} + {Y : Set Shat} + (ha : D.IsAnchor H ρ Δv Dv F h f₁ f₂ A₁ A₂ Y) + {b : Shat} + {Q : GraphWalk (Drawing.toGraph D.rad.G) r b} + (hQ : IsArcOn D.rad.G Dv F Q) + (ho : ∀ e ∈ Q.edges, Disjoint e Δv) + (hman : ∀ (x : Shat), IsManifoldPoint x) + (hΔv : IsClosedDisc Δv) + (hbv : discBd Δv = Dv.U) + (N : GraphWalk (Drawing.toGraph D.rad.G) r b) + (hNU : (walkDrawing D.rad.G N).U ⊆ Dv.U) + (Δ' : Set Shat) + (hd' : IsClosedDisc Δ') + (hbd : discBd Δ' = (walkDrawing D.rad.G Q).U ∪ (walkDrawing D.rad.G N).U) + (hYint : Y ⊆ discInt Δ') : + Δv ⊆ Δ' := by + obtain ⟨z, hzY, hzΔ⟩ := ha.meets + have hzi := hYint hzY + have hzc : z ∈ closure (discInt Δv) := by rw [closure_discInt hΔv]; exact hzΔ + obtain ⟨w, hw₁, hw₂⟩ := mem_closure_iff.mp hzc _ (hd'.isOpen_discInt hman) hzi + have hsub := subset_discInt_of_connected hman hd' hΔv.isPreconnected_discInt + (disjoint_left.mpr fun x hi' hb₀ ↦ by + rw [hbd] at hb₀ + rcases hb₀ with hq | hn + · have hxe : ∃ e ∈ Q.edges, x ∈ closure e := by + rcases (mem_walkDrawing_U _ _).mp hq with h' | ⟨e, he, hye⟩ + · exact GraphWalk.exists_edge_of_support Q hQ.ne h' + · exact ⟨e, he, hye⟩ + obtain ⟨e, he, hxe⟩ := hxe + obtain ⟨z', hz₁, hz₂⟩ := mem_closure_iff.mp hxe _ (hΔv.isOpen_discInt hman) hi' + exact disjoint_left.mp (ho e he) hz₂ (discInt_subset _ hz₁) + · exact hi'.2 (hbv ▸ hNU hn)) ⟨w, hw₂, hw₁⟩ + rw [← closure_discInt hΔv, ← closure_discInt hd'] + exact closure_mono hsub + +private theorem hub_inside_outer_circuit + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [T2Space S] + [TopologicalSpace Shat] + [T2Space Shat] + {α : Type w} + {cap : IsCappedSurface S Shat} + {χ : ColourScheme S α} + {D : TangleDatum cap χ} + {W : Set Shat} + {H : Drawing Shat} + {ρ : ℕ} + {r : Shat} + {Δv : Set Shat} + {Dv : Drawing Shat} + {F : Drawing Shat} + {ord' : ℕ} + {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {h : Shat} + {v₁ : Shat} + {v₂ : Shat} + {c₁ : Shat} + {c₂ : Shat} + {h₁ : Shat} + {h₂ : Shat} + {f₁ : Set Shat} + {f₂ : Set Shat} + {A₁ : GraphWalk (Drawing.toGraph D.rad.G) v₁ c₁} + {A₂ : GraphWalk (Drawing.toGraph D.rad.G) v₂ c₂} + {T₁ : GraphWalk (Drawing.toGraph D.rad.G) c₁ h₁} + {T₂ : GraphWalk (Drawing.toGraph D.rad.G) c₂ h₂} + (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁ A₂ T₁ T₂) + {b : Shat} + {Q : GraphWalk (Drawing.toGraph D.rad.G) r b} + {X : GraphWalk (Drawing.toGraph D.rad.G) v₁ b} + (hman : ∀ (x : Shat), IsManifoldPoint x) + (hx : D.IsSectorEnclave W H ρ r Δv Dv ord' 𝒯' F) + (hW : D.IsWheelHubOfRadius W H ρ) + (hUF : F.U ⊆ D.ins F) + (hclbd : ∀ {f : Set Shat}, f ⊆ discBd W → closure f ⊆ discBd W) + (hXK : ∀ {y : Shat}, y ∈ (walkDrawing D.rad.G X).U → y ∈ (walkDrawing D.rad.G (A₁.append + T₁)).U) + (N : GraphWalk (Drawing.toGraph D.rad.G) r b) + (hNcases : ∀ {y : Shat}, y ∈ (walkDrawing D.rad.G N).U → y ∈ closure f₁ ∨ y ∈ (walkDrawing + D.rad.G X).U) + (hQU : (walkDrawing D.rad.G Q).U ⊆ F.U) + (Δ' : Set Shat) + (hd' : IsClosedDisc Δ') + (hbd : discBd Δ' = (walkDrawing D.rad.G Q).U ∪ (walkDrawing D.rad.G N).U) + (hhint : h ∈ discInt Δ') + {y : Shat} + (hy : y ∈ H.U) + (hEn : IsEnclave D.tb D.ord D.𝒯 H) + (hle : (Drawing.E H).ncard ≤ 4 * ρ + 4) + (hi : h ∈ discInt (D.ins H)) : + y ∈ Δ' := by + obtain ⟨-, -, -, hHc, hHlt, -⟩ := id hEn + have hHi := D.ins_spec hHc (by have := hW.rep_ge; omega) + have hΔH := hHi.2.2.1 + have hsub := subset_discInt_of_connected hman hd' hΔH.isPreconnected_discInt + (disjoint_left.mpr fun x hi' hb₀ ↦ by + rw [hbd] at hb₀ + rcases hb₀ with hq | hn + · have hm : x ∈ D.ins F ∩ D.ins H := ⟨hUF (hQU hq), discInt_subset _ hi'⟩ + rw [hx.hub_circuit hEn] at hm + exact hi'.2 (hHi.2.2.2.1 ▸ hm.2) + · rcases hNcases hn with hc | hc + · exact disjoint_left.mp (hW.ins_off_bd hHc hle) (discInt_subset _ hi') (hclbd s.bd₁ hc) + · exact disjoint_left.mp (IsSpokeWalk.off_ins_hub hW hEn hle s.spoke₁) (hXK hc) hi') ⟨h, + hi, hhint⟩ + have hcl : D.ins H ⊆ Δ' := by + rw [← closure_discInt hΔH, ← closure_discInt hd'] + exact closure_mono hsub + exact hcl (Surface.discBd_subset _ (hHi.2.2.2.1 ▸ hy)) + +private theorem hub_point_off_outer_disc_boundary + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [T2Space S] + [TopologicalSpace Shat] + [T2Space Shat] + {α : Type w} + {cap : IsCappedSurface S Shat} + {χ : ColourScheme S α} + {D : TangleDatum cap χ} + {W : Set Shat} + {H : Drawing Shat} + {ρ : ℕ} + {r : Shat} + {Δv : Set Shat} + {Dv : Drawing Shat} + {F : Drawing Shat} + {ord' : ℕ} + {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {Δ₀ : Set Shat} + {Δ : Set Shat} + {C : Drawing Shat} + {h : Shat} + {v₁ : Shat} + {v₂ : Shat} + {c₁ : Shat} + {c₂ : Shat} + {h₁ : Shat} + {h₂ : Shat} + {f₁ : Set Shat} + {f₂ : Set Shat} + {A₁ : GraphWalk (Drawing.toGraph D.rad.G) v₁ c₁} + {A₂ : GraphWalk (Drawing.toGraph D.rad.G) v₂ c₂} + {T₁ : GraphWalk (Drawing.toGraph D.rad.G) c₁ h₁} + {T₂ : GraphWalk (Drawing.toGraph D.rad.G) c₂ h₂} + (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) + (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁ A₂ T₁ T₂) + {b : Shat} + {Q : GraphWalk (Drawing.toGraph D.rad.G) r b} + {X : GraphWalk (Drawing.toGraph D.rad.G) v₁ b} + {Z : GraphWalk (Drawing.toGraph D.rad.G) b c₁} + (hW : D.IsWheelHubOfRadius W H ρ) + (hnotF : h ∉ F.U) + (hclbd : ∀ {f : Set Shat}, f ⊆ discBd W → closure f ⊆ discBd W) + (hXK : ∀ {y : Shat}, y ∈ (walkDrawing D.rad.G X).U → y ∈ (walkDrawing D.rad.G (A₁.append + T₁)).U) + (N : GraphWalk (Drawing.toGraph D.rad.G) r b) + (hNcases : ∀ {y : Shat}, y ∈ (walkDrawing D.rad.G N).U → y ∈ closure f₁ ∨ y ∈ (walkDrawing + D.rad.G X).U) + (hQU : (walkDrawing D.rad.G Q).U ⊆ F.U) + (Δ' : Set Shat) + (hbd : discBd Δ' = (walkDrawing D.rad.G Q).U ∪ (walkDrawing D.rad.G N).U) + (hmeetX : ∀ {y : Shat}, y ∈ X.support → y ∈ (Z.append T₁).support → y = b) : + h ∉ discBd Δ' := by + rw [hbd] + rintro (hq | hn) + · exact hnotF (hQU hq) + · rcases hf.hub with ⟨hV, -⟩ | ⟨hEn, hle, hi⟩ + · have hhV : h ∈ H.V := by rw [hV]; rfl + rcases hNcases hn with hc | hc + · exact (hW.H_in_int (H.V_subset_U hhV)).2 (hclbd s.bd₁ hc) + · have e₁ := IsSpokeWalk.U_inter_hub hW s.spoke₁ (hXK hc) (H.V_subset_U hhV) + have hsup : h ∈ X.support := by + have := mem_V_of_mem_U (walkDrawing_isSubdrawing D.rad.G X) hc (hW.H_sub.1 hhV) + rw [walkDrawing_V] at this + exact this + have hend : h ∈ (Z.append T₁).support := by + rw [e₁] + exact (Z.append T₁).end_mem_support + exact hnotF (hQU (by + rw [hmeetX hsup hend] + exact (mem_walkDrawing_U _ _).mpr (.inl Q.end_mem_support))) + · obtain ⟨-, -, -, hHc, hHlt, -⟩ := id hEn + rcases hNcases hn with hc | hc + · exact disjoint_left.mp (hW.ins_off_bd hHc hle) (discInt_subset _ hi) (hclbd s.bd₁ hc) + · exact disjoint_left.mp (IsSpokeWalk.off_ins_hub hW hEn hle s.spoke₁) (hXK hc) hi + +/-- Step (11) of the proof of (13.6): an outer arc from `r*` to `b` on `A₁` that cannot be pushed +into `Δ_v`, with the path of `D_v` from `r*` to `b` through `v₁`, makes up `C`. -/ +theorem outer_circuit (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) + (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁ A₂ T₁ T₂) (ha : D.IsAnchor H ρ Δv Dv F h f₁ f₂ A₁ A₂ Y) {b + : Shat} + {Q : GraphWalk D.rad.G.toGraph r b} {X : GraphWalk D.rad.G.toGraph v₁ b} {Z : GraphWalk + D.rad.G.toGraph b c₁} (hQ : IsArcOn D.rad.G Dv F Q) (ho : ∀ e ∈ Q.edges, Disjoint e Δv) + (hA : A₁ = X.append Z) (hnp : ¬ PushesInto (Δ₀ \ {h}) (Δv \ {h}) (walkDrawing D.rad.G Q).U r b) + : ∀ e, e ∈ C.E ↔ e ∈ Q.edges ∨ e ∈ (GraphWalk.cons s.link₁ X).edges := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hx := hf.enc + have hW := hx.wheel + have hFi := hx.isInsOf_F + have hFc := hFi.1 + have hFs := hFc.1 + have hE := hx.isEnclave + have hDv := hx.sector.Dv_circuit + have hΔv := hx.sector.is_disc + have hbv := hx.sector.Dv_U.symm + have hΔF := hFi.2.2.1 + have hbF := hFi.2.2.2.1 + have hnotF : h ∉ F.U := fun hu ↦ hf.notMem_ins_F (Surface.discBd_subset _ (hbF ▸ hu)) + have hUvΔ : Dv.U ⊆ Δv := fun x hx' ↦ Surface.discBd_subset _ (hbv ▸ hx') + have hUF : F.U ⊆ D.ins F := fun x hx' ↦ Surface.discBd_subset _ (hbF ▸ hx') + have hclbd : ∀ {f : Set Shat}, f ⊆ discBd W → closure f ⊆ discBd W := fun hf' ↦ closure_minimal + hf' (by + rw [← IsClosedDisc.frontier_eq_discBd hT hW.is_disc]; exact isClosed_frontier) + have hK : (X.append (Z.append T₁)).IsSimple := by + have := s.spoke₁.1 + rwa [hA, GraphWalk.append_assoc'] at this + have hXA : ∀ y ∈ X.support, y ∈ A₁.support := fun y hy ↦ by + rw [hA, GraphWalk.mem_support_append] + exact .inl hy + have hXAe : ∀ e ∈ X.edges, e ∈ A₁.edges := fun e he ↦ by + rw [hA, GraphWalk.edges_append] + exact List.mem_append_left _ he + have hXK : ∀ {y : Shat}, y ∈ (walkDrawing D.rad.G X).U → y ∈ (walkDrawing D.rad.G + (A₁.append T₁)).U := fun hy ↦ + walkU_subset (K := X) (fun y hy ↦ (GraphWalk.mem_support_append _ _).mpr (.inl (hXA y hy))) + (fun e he ↦ by + rw [GraphWalk.edges_append]; exact List.mem_append_left _ (hXAe e he)) hy + have hXA' : ∀ {y : Shat}, y ∈ (walkDrawing D.rad.G X).U → y ∈ (walkDrawing D.rad.G A₁).U + := fun hy ↦ walkU_subset (K := X) hXA hXAe hy + have hrnot : r ∉ (A₁.append T₁).support := IsWheelHubOfRadius.r_notMem_spoke hW hx.hbdS hx.hin + hx.sector.rstar_mem s.spoke₁ + have hrA₂ : r ∉ (A₂.append T₂).support := IsWheelHubOfRadius.r_notMem_spoke hW hx.hbdS hx.hin + hx.sector.rstar_mem s.spoke₂ + have hrX : r ∉ X.support := fun h' ↦ hrnot ((GraphWalk.mem_support_append _ _).mpr (.inl + (hXA r h'))) + -- The path `P₁`, called `N` here. + set N : GraphWalk D.rad.G.toGraph r b := GraphWalk.cons s.link₁ X with hNdef + have hNs : N.IsSimple := List.nodup_cons.mpr ⟨hrX, (isSimple_of_append hK).1⟩ + have hNsup : ∀ y, y ∈ N.support ↔ y = r ∨ y ∈ X.support := fun y ↦ by + rw [hNdef, GraphWalk.support_cons, List.mem_cons] + have hNe : ∀ e, e ∈ N.edges ↔ e = f₁ ∨ e ∈ X.edges := fun e ↦ by + rw [hNdef, GraphWalk.edges_cons, List.mem_cons] + have hrD : r ∈ Dv.V := (Drawing.IsLink.mem_V_of_sub hDv.1 s.link₁ s.f₁_mem).1 + have hNV : ∀ y ∈ N.support, y ∈ Dv.V := fun y hy ↦ by + rcases (hNsup y).mp hy with rfl | hy + · exact hrD + · exact s.mem₁ y (hXA y hy) + have hNE : ∀ e ∈ N.edges, e ∈ Dv.E := fun e he ↦ by + rcases (hNe e).mp he with rfl | he + · exact s.f₁_mem + · exact s.edge₁ e (hXAe e he) + have hNU : (walkDrawing D.rad.G N).U ⊆ Dv.U := fun y hy ↦ by + rcases (mem_walkDrawing_U _ _).mp hy with h' | ⟨e, he, hye⟩ + · exact Dv.V_subset_U (hNV y h') + · exact Dv.closure_subset_U (hNE e he) hye + have hNcases : ∀ {y : Shat}, y ∈ (walkDrawing D.rad.G N).U → y ∈ closure f₁ ∨ y ∈ + (walkDrawing D.rad.G X).U := fun {y} hy ↦ by + rcases (mem_walkDrawing_U _ _).mp hy with h' | ⟨e, he, hye⟩ + · rcases (hNsup y).mp h' with rfl | h' + · exact .inl (IsLink.left_mem_closure s.link₁) + · exact .inr ((mem_walkDrawing_U _ _).mpr (.inl h')) + · rcases (hNe e).mp he with rfl | he + · exact .inl hye + · exact .inr ((mem_walkDrawing_U _ _).mpr (.inr ⟨e, he, hye⟩)) + have hQU : (walkDrawing D.rad.G Q).U ⊆ F.U := fun y hy ↦ by + rcases (mem_walkDrawing_U _ _).mp hy with h' | ⟨e, he, hye⟩ + · exact F.V_subset_U (hQ.mem_F hFs y h') + · exact F.closure_subset_U (hQ.inF e he) hye + have hbA : b ∈ A₁.support := hXA b X.end_mem_support + have hbF' : b ∈ F.V := hQ.mem_F hFs _ Q.end_mem_support + -- The circuit `P₁ ∪ F₁`, and its disc in `Δ₀`. + have hQs := walkDrawing_isSubdrawing D.rad.G Q + have hNs' := walkDrawing_isSubdrawing D.rad.G N + have hQp := walkDrawing_isPathBetween D.rad.G hQ.simple + have hNp := walkDrawing_isPathBetween D.rad.G hNs + have hcircuit : (D.rad.G.sup (walkDrawing D.rad.G Q) (walkDrawing D.rad.G N)).IsCircuit := by + refine circuit_sup hQs hNs' hQp hNp hQ.ne ?_ ?_ + · rintro y ⟨h₀, h₁'⟩ + rw [walkDrawing_V] at h₀ h₁' + exact hQ.inner y h₀ (hNV y h₁') + · refine disjoint_left.mpr fun e h₀ h₁' ↦ ?_ + rw [walkDrawing_E] at h₀ h₁' + exact hQ.off e h₀ (hNE e h₁') + set C' := D.rad.G.sup (walkDrawing D.rad.G Q) (walkDrawing D.rad.G N) with hC' + have hC'sub : C'.IsSubdrawing D.rad.G := D.rad.G.sup_isSubdrawing _ _ + have hC'V : ∀ y, y ∈ C'.V ↔ y ∈ Q.support ∨ y ∈ N.support := fun y ↦ by + rw [hC', Drawing.sup_V hQs hNs', walkDrawing_V, walkDrawing_V] + rfl + have hC'E : ∀ e, e ∈ C'.E ↔ e ∈ Q.edges ∨ e ∈ N.edges := fun e ↦ by + rw [hC', Drawing.sup_E hQs hNs', walkDrawing_E, walkDrawing_E] + rfl + have hC'U : C'.U = (walkDrawing D.rad.G Q).U ∪ (walkDrawing D.rad.G N).U := U_union + (Drawing.sup_V hQs hNs') (Drawing.sup_E hQs hNs') + have hNΔ : (walkDrawing D.rad.G N).U ⊆ Δv := hNU.trans hUvΔ + have hC'Δ₀ : C'.U ⊆ Δ₀ := by + rw [hC'U] + exact union_subset (hQU.trans (hUF.trans hf.amb.ins_F)) (hNΔ.trans (hf.v_sub.trans hf.sub)) + obtain ⟨Δ', ⟨hs', hd', hb', -⟩, -⟩ := disc_oArc Δ₀ C'.U hf.amb.disc hC'Δ₀ + (GM14.isOArc_of_isCircuit hcircuit) + have hbd : discBd Δ' = (walkDrawing D.rad.G Q).U ∪ (walkDrawing D.rad.G N).U := hb'.trans hC'U + have hhΔ' : h ∈ Δ' := IsFar.mem_disc_of_blocked (D := D) hQ.ne hNs hNΔ hd' hs' hbd hnp + have hinbd : ∀ {y : Shat}, y ∈ discBd Δ' → y ∈ Δ' := fun hy ↦ Surface.discBd_subset _ hy + have hmeetX : ∀ {y : Shat}, y ∈ X.support → y ∈ (Z.append T₁).support → y = b + := fun h₁' h₂' ↦ Splits.append_meet hK h₁' h₂' + -- `h` is not on the boundary of the disc. + have hhb : h ∉ discBd Δ' := by + exact hub_point_off_outer_disc_boundary (S := S) (Shat := Shat) (α := α) (cap := cap) (χ := χ) + (D := D) (W := W) (H := H) (ρ := ρ) (r := r) (Δv := Δv) (Dv := Dv) (F := F) (ord' := ord') + (𝒯' := 𝒯') (Δ₀ := Δ₀) (Δ := Δ) (C := C) (h := h) (v₁ := v₁) (v₂ := v₂) (c₁ := c₁) (c₂ := c₂) + (h₁ := h₁) (h₂ := h₂) (f₁ := f₁) (f₂ := f₂) (A₁ := A₁) (A₂ := A₂) (T₁ := T₁) (T₂ := T₂) hf s + (b := b) (Q := Q) (X := X) (Z := Z) hW hnotF hclbd hXK N hNcases hQU Δ' hbd hmeetX + have hhint : h ∈ discInt Δ' := ⟨hhΔ', hhb⟩ + -- The hub is in the disc. + have hHin : ∀ {y : Shat}, y ∈ H.U → IsEnclave D.tb D.ord D.𝒯 H → H.E.ncard ≤ 4 * ρ + 4 + → h ∈ discInt (D.ins H) → y ∈ Δ' := fun {y} hy hEn hle hi ↦ by + exact hub_inside_outer_circuit (S := S) (Shat := Shat) (α := α) (cap := cap) (χ := χ) (D := D) + (W := W) (H := H) (ρ := ρ) (r := r) (Δv := Δv) (Dv := Dv) (F := F) (ord' := ord') (𝒯' := 𝒯') + (h := h) (v₁ := v₁) (v₂ := v₂) (c₁ := c₁) (c₂ := c₂) (h₁ := h₁) (h₂ := h₂) (f₁ := f₁) (f₂ := + f₂) (A₁ := A₁) (A₂ := A₂) (T₁ := T₁) (T₂ := T₂) s (b := b) (Q := Q) (X := X) hman hx hW hUF + hclbd hXK N hNcases hQU Δ' hd' hbd hhint (y := y) hy hEn hle hi + -- The anchor is inside the disc. + have hYb : Disjoint Y (discBd Δ') := disjoint_left.mpr fun y hy hb₀ ↦ by + rw [hbd] at hb₀ + rcases hb₀ with hq | hn + · exact disjoint_left.mp (ha.off_arc hQ) hy hq + · rcases hNcases hn with hc | hc + · exact disjoint_left.mp ha.off_f₁ hy hc + · have e₁ := ha.off_A₁ y hy (hXA' hc) + have hsup : y ∈ X.support := by + have := mem_V_of_mem_U (walkDrawing_isSubdrawing D.rad.G X) hc (by + rw [e₁] + exact A₁.mem_vertexSet_of_mem_support A₁.end_mem_support) + rw [walkDrawing_V] at this + exact this + have hend : y ∈ Z.support := by rw [e₁]; exact Z.end_mem_support + have e₂ := Splits.append_meet (hA ▸ (isSimple_of_append s.spoke₁.1).1) hsup hend + exact disjoint_left.mp (ha.off_arc hQ) hy (by + rw [e₂] + exact (mem_walkDrawing_U _ _).mpr (.inl Q.end_mem_support)) + obtain ⟨y, hyY, hyh⟩ := ha.hub + have hyΔ' : y ∈ Δ' := by + rcases hyh with rfl | ⟨h₀, h₁', h₂', h₃'⟩ + · exact hhΔ' + · exact hHin h₀ h₁' h₂' h₃' + have hYint : Y ⊆ discInt Δ' := subset_discInt_of_connected hman hd' ha.pre hYb ⟨y, hyY, hyΔ', + disjoint_left.mp hYb hyY⟩ + -- Hence `Δ_v` is in the disc. + have hΔvΔ' : Δv ⊆ Δ' := by + exact sector_inside_outer_circuit (S := S) (Shat := Shat) (α := α) (cap := cap) (χ := χ) (D := + D) (H := H) (ρ := ρ) (r := r) (Δv := Δv) (Dv := Dv) (F := F) (h := h) (v₁ := v₁) (v₂ := v₂) + (c₁ := c₁) (c₂ := c₂) (f₁ := f₁) (f₂ := f₂) (A₁ := A₁) (A₂ := A₂) (Y := Y) ha (b := b) (Q := + Q) hQ ho hman hΔv hbv N hNU Δ' hd' hbd hYint + have hDvΔ' : Dv.U ⊆ Δ' := hUvΔ.trans hΔvΔ' + -- All of `F` is in the disc. + have hNin : ∀ c, c ∈ C'.V → c ∈ Dv.V → c ∈ N.support := fun c hc hcD ↦ by + rcases (hC'V c).mp hc with h' | h' + · rcases hQ.inner c h' hcD with rfl | rfl + · exact N.start_mem_support + · exact N.end_mem_support + · exact h' + have hFΔ' : F.U ⊆ Δ' := by + exact enclave_inside_outer_circuit (S := S) (Shat := Shat) (α := α) (cap := cap) (χ := χ) (D + := D) (W := W) (H := H) (ρ := ρ) (r := r) (Δv := Δv) (Dv := Dv) (F := F) (ord' := ord') (𝒯' + := 𝒯') (Δ₀ := Δ₀) (Δ := Δ) (C := C) (h := h) (v₁ := v₁) (v₂ := v₂) (c₁ := c₁) (c₂ := c₂) (h₁ + := h₁) (h₂ := h₂) (f₁ := f₁) (f₂ := f₂) (A₁ := A₁) (A₂ := A₂) (T₁ := T₁) (T₂ := T₂) hf s (b + := b) (Q := Q) (X := X) hQ ho hnp hT hx hFc hFs hE hDv hΔv hbv hXA hrnot hrA₂ hrX N hNdef + hNs hNsup hNe hrD hNV hNE hNU hNcases hQU hbA hbF' hQs hNs' hQp hNp C' hC' hC'sub + hC'V hC'E hC'U hNΔ Δ' hd' hb' hbd hinbd hΔvΔ' hDvΔ' hNin + -- So the disc is `Δ`. + have hFiΔ' : D.ins F ⊆ Δ' := disc_subset_of_bd hT hf.amb.disc hΔF hd' hf.amb.ins_F hs' (by + rw [hbF] + exact hFΔ') + have h₁' : Δ' ⊆ Δ := disc_subset_of_bd hT hf.amb.disc hd' hf.disc hs' hf.sub (by + rw [hbd] + exact union_subset (hQU.trans (hUF.trans hf.F_sub)) (hNΔ.trans hf.v_sub)) + have h₂' : Δ ⊆ Δ' := disc_subset_of_bd hT hf.amb.disc hf.disc hd' hf.sub hs' (by + rw [hf.bd] + refine U_of_edges hf.circuit.2 hd'.isClosed fun e he ↦ ?_ + rcases hf.edges e he with h₀ | h₀ + · exact subset_closure.trans ((F.closure_subset_U h₀).trans hFΔ') + · exact subset_closure.trans ((Dv.closure_subset_U h₀).trans hDvΔ')) + have hUeq : C.U = C'.U := by + rw [← hf.bd, ← hb', Subset.antisymm h₁' h₂'] + intro e + rw [← hC'E] + constructor + · intro he + by_contra hn + have heG := hf.circuit.1.2 he + obtain ⟨p, hp⟩ := heG.1 + exact disjoint_left.mp (edge_disjoint_U hC'sub heG hn) hp (hUeq ▸ C.closure_subset_U he + (subset_closure hp)) + · intro he + by_contra hn + have heG := hC'sub.2 he + obtain ⟨p, hp⟩ := heG.1 + exact disjoint_left.mp (edge_disjoint_U hf.circuit.1 heG hn) hp (hUeq ▸ C'.closure_subset_U he + (subset_closure hp)) + +end IsFar + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13v.lean b/LeanPool/GraphMinor/GM19/Section13v.lean new file mode 100644 index 0000000000..dc98f1d3de --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13v.lean @@ -0,0 +1,327 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13u + +/-! +# Graph Minors XIX, Section 13: tools for steps (12) to (14) of (13.6) + +If a disc holds what `ins(F)` and `Δ_v` have in common, then its boundary is at least as long as +`F`. A walk from `r*` to the spoke that replaces the start of the spoke is longer, by +(13.1) and parity. And `F` has a third arc, from `r*` to the second spoke, that does not meet the +first spoke. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +omit [T2Space Shat] in +theorem GraphWalk.reverse_append' {G : Drawing Shat} {a b c : Shat} (A : GraphWalk G.toGraph a b) + (B : GraphWalk G.toGraph b c) : (A.append B).reverse = B.reverse.append A.reverse := by + induction A with + | nil h => exact (GraphWalk.append_nil' B.reverse h).symm + | cons h r ih => + change (r.append B).reverse.append _ = B.reverse.append (r.reverse.append _) + rw [ih, GraphWalk.append_assoc'] + +/-- A point off the interior of a disc is in the closure of the complement. -/ +theorem mem_closure_compl_of_notMem_discInt {T : Type} [TopologicalSpace T] + (hT : IsClosedSurface T) {Δ : Set T} (hΔ : IsClosedDisc Δ) {x : T} + (hx : x ∉ discInt Δ) : x ∈ closure Δᶜ := by + by_cases hm : x ∈ Δ + · have hb : x ∈ discBd Δ := by_contra fun hn ↦ hx ⟨hm, hn⟩ + rw [← IsClosedDisc.frontier_eq_discBd hT hΔ, frontier_eq_closure_inter_closure] at hb + exact hb.2 + · exact subset_closure hm + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {Δv : Set + Shat} {Dv F : Drawing Shat} + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {Δ₀ Δ : Set Shat} {C : + Drawing Shat} {h : Shat} + +/-- `F` is smaller than the order of `𝒯'`, by the bound on its separation. -/ +theorem IsSectorEnclave.F_lt_order (hx : D.IsSectorEnclave W H ρ r Δv Dv ord' 𝒯' F) : F.E.ncard < 2 + * ord' := by + have : ConnectedSpace Shat := cap.connected + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + have hFi := hx.isInsOf_F + have hd := hx.distinction + have h₀ := hx.isTangle'.order_lt hd.1.2 + have e₀ : F.E.ncard = 2 * Hypergraph.separationOrder (partIn cap D.Γ (D.ins F)) (partIn cap D.Γ + (closure (D.ins F)ᶜ)) := disc_order hS h3 D.rad hFi.1 hFi.2.2.1 hFi.2.2.2.1 + have hcomm : Hypergraph.separationOrder (partIn cap D.Γ (closure (D.ins F)ᶜ)) (partIn cap D.Γ + (D.ins F)) = + Hypergraph.separationOrder (partIn cap D.Γ (D.ins F)) (partIn cap D.Γ (closure (D.ins F)ᶜ)) + := by + simp only [Hypergraph.separationOrder, GM10.inter_comm] + omega + +/-- If a disc contains the common interior of `ins(F)` and `Δ_v`, then its boundary is at least as +long as `F`: it points to `𝒯'` by the second tangle axiom, so the choice of `F` applies. -/ +theorem IsSectorEnclave.card_le_of_cover (hx : D.IsSectorEnclave W H ρ r Δv Dv ord' 𝒯' F) {C' : + Drawing Shat} {Δc : Set Shat} (hins : IsInsOf D.rad D.ord D.𝒯 C' Δc) + (hcov : ∀ y, y ∈ discInt Δv → y ∈ discInt (D.ins F) → y ∈ Δc) : F.E.ncard ≤ C'.E.ncard := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + have hFi := hx.isInsOf_F + have hd := hx.distinction + have hDv := hx.sector.Dv_circuit + have hΔv := hx.sector.is_disc + have hbv := hx.sector.Dv_U.symm + have hc := hins.1 + have hΔc := hins.2.2.1 + have hbc := hins.2.2.2.1 + by_cases hbig : 2 * ord' ≤ C'.E.ncard + · have := hx.F_lt_order + omega + have hsep : D.Γ.toHypergraph.IsSeparation (partIn cap D.Γ Δc) (partIn cap D.Γ (closure Δcᶜ)) := + (disc_facts hS h3 D.rad hc hΔc hbc).1 + have e₀ : C'.E.ncard = 2 * Hypergraph.separationOrder (partIn cap D.Γ Δc) (partIn cap D.Γ + (closure Δcᶜ)) := disc_order hS h3 D.rad hc hΔc hbc + rcases hx.isTangle'.axiom1 hsep (by omega) with hm | hm + · exfalso + have hcov' := part_cover D.rad hc.1 hDv.1 hFi.1.1 (isSide_int hT hΔc hbc) + (isSide_out hT hΔv hbv) (isSide_out hT hFi.2.2.1 hFi.2.2.2.1) fun y ↦ by + rw [closure_discInt hΔc] + by_cases h₁ : y ∈ discInt Δv + · by_cases h₂ : y ∈ discInt (D.ins F) + · exact .inl (hcov y h₁ h₂) + · exact .inr (.inr (mem_closure_compl_of_notMem_discInt hT hFi.2.2.1 h₂)) + · exact .inr (.inl (mem_closure_compl_of_notMem_discInt hT hΔv h₁)) + rw [closure_discInt hΔc] at hcov' + exact hx.isTangle'.axiom2 hm hx.mem hd.1.2 hcov' + · exact enclave_card_le hS h3 D.tb hFi hd hins hm + +/-- By (13.1), a walk from `r*` to the hub has at least `ρ` edges. -/ +theorem IsWheelHubOfRadius.walk_from_rstar (hW : D.IsWheelHubOfRadius W H ρ) + (hbdS : discBd W ⊆ cap.emb '' (univ \ bd S)) (hin : ((W \ discBd W) ∩ + (cap.emb '' D.Γ.V)).Nonempty) + (hr : r ∈ D.rad.Rstar ∩ discBd W) {z : Shat} (hz : z ∈ H.V) (L : GraphWalk D.rad.G.toGraph r z) + : ρ ≤ L.length := by + obtain ⟨P, hP, hle⟩ := exists_path_of_walk L + by_contra hn + exact theorem_13_1_proof hW hbdS hin hr.1 hr.2 ⟨P, z, hz, hP, by omega⟩ + +variable {v₁ v₂ c₁ c₂ h₁ h₂ : Shat} {f₁ f₂ : Set Shat} {A₁ : GraphWalk D.rad.G.toGraph v₁ c₁} {A₂ : + GraphWalk D.rad.G.toGraph v₂ c₂} {T₁ : GraphWalk D.rad.G.toGraph c₁ h₁} + {T₂ : GraphWalk D.rad.G.toGraph c₂ h₂} + +/-- Step (14) of the proof of (13.6): a walk from `r*` to a vertex `b` of `A₁` is longer than the +part of `A₁` before `b`. -/ +theorem IsShape.parity_bound (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) + (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁ A₂ T₁ T₂) {b : Shat} (Q : GraphWalk D.rad.G.toGraph r b) + {X : GraphWalk D.rad.G.toGraph v₁ b} {Z : GraphWalk D.rad.G.toGraph b c₁} (hA : A₁ + = X.append Z) : X.length + 1 ≤ Q.length := by + have : ConnectedSpace Shat := cap.connected + have hx := hf.enc + have hW := hx.wheel + have hb := IsWheelHubOfRadius.walk_from_rstar hW hx.hbdS hx.hin hx.sector.rstar_mem + s.spoke₁.2.h_mem (Q.append (Z.append T₁)) + have hl := (hW.spoke_length s.spoke₁).1 + have e₁ := D.even_length_walk (A₁.append T₁) + have e₂ := D.even_length_walk (Q.append (Z.append T₁)) + have hr : r ∉ D.P.Γ.hatV cap := hx.sector.rstar_mem.1.2 + have hv : v₁ ∈ D.P.Γ.hatV cap := s.spoke₁.2.v_mem.1 + have hne : (A₁.append T₁).length ≠ (Q.append (Z.append T₁)).length := fun h' ↦ by + rw [h'] at e₁ + have h₃ := e₁.symm.trans e₂ + tauto + rw [GraphWalk.length_append, hA, GraphWalk.length_append] at hne hl + rw [GraphWalk.length_append, GraphWalk.length_append] at hb hne + omega + +namespace IsFar + +/-- `F` closes up from `r*` along `Q₁`, `A₁` and `Q₀` through a third walk `F₂` from `r*` to `A₂`, +which meets `A₂` only at its end, does not meet `A₁`, has no edge in `Q₀ ∪ Q₁`, +and has an edge inside `Δ_v`. -/ +theorem exists_third (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) (s : D.IsShape W H r Δv Dv F + f₁ f₂ A₁ A₂ T₁ T₂) (hten : ∀ x ∈ A₁.support, x ∈ A₂.support → x ∉ F.V) {b₁ a₀ b₀ : Shat} + {Q₁ : GraphWalk D.rad.G.toGraph r b₁} {Q₀ : GraphWalk D.rad.G.toGraph a₀ b₀} + (h₁' : IsArcOn D.rad.G Dv F Q₁) (h₀ : IsArcOn D.rad.G Dv F Q₀) (o₁ : ∀ e ∈ Q₁.edges, Disjoint + e Δv) + (o₀ : ∀ e ∈ Q₀.edges, Disjoint e Δv) (hd : ∀ e ∈ Q₀.edges, e ∉ Q₁.edges) + (hb₁ : b₁ ∈ A₁.support) (ha₀ : a₀ ∈ A₁.support) (hb₀ : b₀ ∈ A₂.support) : + ∃ (b₂ : Shat) (F₂ : GraphWalk D.rad.G.toGraph r b₂), b₂ ∈ A₂.support ∧ F₂.IsSimple ∧ + (∀ e ∈ F₂.edges, e ∈ F.E ∧ e ∉ Q₁.edges ∧ e ∉ Q₀.edges) ∧ (∀ x ∈ F₂.support, x ∈ A₂.support + → x = b₂) ∧ + (∀ x ∈ F₂.support, x ∉ A₁.support) ∧ (∃ e ∈ F₂.edges, e ⊆ discInt Δv) + ∧ ∀ e ∈ F.E, e ∈ F₂.edges ∨ e ∈ Q₁.edges ∨ e ∈ Q₀.edges ∨ e ∈ Dv.E := by + classical + have : ConnectedSpace Shat := cap.connected + have hx := hf.enc + have hW := hx.wheel + have hFi := hx.isInsOf_F + have hFc := hFi.1 + have hFs := hFc.1 + have hE := hx.isEnclave + have hb₁F := h₁'.mem_F hFs _ Q₁.end_mem_support + have hrF := h₁'.mem_F hFs _ Q₁.start_mem_support + have ha₀F := h₀.mem_F hFs _ Q₀.start_mem_support + have hb₀F := h₀.mem_F hFs _ Q₀.end_mem_support + have hrA₁ : r ∉ A₁.support := fun h' ↦ IsWheelHubOfRadius.r_notMem_spoke hW hx.hbdS hx.hin + hx.sector.rstar_mem s.spoke₁ ((GraphWalk.mem_support_append _ _).mpr (.inl h')) + have hrA₂ : r ∉ A₂.support := fun h' ↦ IsWheelHubOfRadius.r_notMem_spoke hW hx.hbdS hx.hin + hx.sector.rstar_mem s.spoke₂ ((GraphWalk.mem_support_append _ _).mpr (.inl h')) + have hb₀A₁ : b₀ ∉ A₁.support := fun h' ↦ hten b₀ h' hb₀ hb₀F + obtain ⟨Y₁, hY₁s, hY₁, hY₁A⟩ := s.exists_seg hE hb₁ ha₀ hb₁F ha₀F + have hYQ : ∀ y ∈ Y₁.support, y ∈ Q₀.support → y = a₀ := fun y hy hy' ↦ + (h₀.inner y hy' (s.mem₁ y (hY₁A y hy))).resolve_right fun h' ↦ hb₀A₁ (h' ▸ hY₁A y hy) + have hs₂ : (Y₁.append Q₀).IsSimple := isSimple_append' hY₁s h₀.simple hYQ + have hmeet : ∀ y ∈ Q₁.support, y ∈ (Y₁.append Q₀).support → y = b₁ := fun y hy hy' ↦ by + rcases (GraphWalk.mem_support_append _ _).mp hy' with h' | h' + · exact (h₁'.inner y hy (s.mem₁ y (hY₁A y h'))).resolve_left fun h'' ↦ hrA₁ (h'' ▸ hY₁A y h') + · by_cases hyD : y ∈ Dv.V + · refine (h₁'.inner y hy hyD).resolve_left fun h'' ↦ ?_ + rcases h₀.inner y h' hyD with h₃ | h₃ + · exact hrA₁ (h'' ▸ h₃ ▸ ha₀) + · exact hrA₂ (h'' ▸ h₃ ▸ hb₀) + · exfalso + have hne₁ : a₀ ≠ y := fun h₃ ↦ hyD (h₃ ▸ h₀.left) + have hne₂ : y ≠ b₀ := fun h₃ ↦ hyD (h₃ ▸ h₀.right) + obtain ⟨L₁, L₂, hL⟩ := Q₀.exists_append_of_mem h' + obtain ⟨e₁, he₁, hc₁⟩ := GraphWalk.exists_edge_at_end L₁ hne₁ + obtain ⟨e₂, he₂, hc₂⟩ := GraphWalk.exists_edge_at_start L₂ hne₂ + obtain ⟨e₃, he₃, hc₃⟩ := GraphWalk.exists_edge_of_support Q₁ h₁'.ne hy + have hm₁ : e₁ ∈ Q₀.edges := by + rw [hL, GraphWalk.edges_append] + exact List.mem_append_left _ he₁ + have hm₂ : e₂ ∈ Q₀.edges := by + rw [hL, GraphWalk.edges_append] + exact List.mem_append_right _ he₂ + exact no_three_edges hFc D.edge_two_ends (h₀.mem_F hFs y h') (h₀.inF _ hm₁) (h₀.inF _ hm₂) + (h₁'.inF _ he₃) hc₁ hc₂ hc₃ (fun h₄ ↦ Splits.append_edge (hL ▸ h₀.simple) he₁ (h₄ ▸ he₂)) + (fun h₄ ↦ hd _ hm₁ (h₄ ▸ he₃)) (fun h₄ ↦ hd _ hm₂ (h₄ ▸ he₃)) + have hZs : (Q₁.append (Y₁.append Q₀)).IsSimple := isSimple_append' h₁'.simple hs₂ hmeet + have hZE : ∀ e, e ∈ (Q₁.append (Y₁.append Q₀)).edges ↔ e ∈ Q₁.edges ∨ e ∈ Y₁.edges ∨ e ∈ Q₀.edges + := fun e ↦ by + rw [GraphWalk.edges_append, List.mem_append, GraphWalk.edges_append, List.mem_append] + have hZF : ∀ e ∈ (Q₁.append (Y₁.append Q₀)).edges, e ∈ F.E := fun e he ↦ by + rcases (hZE e).mp he with h' | h' | h' + · exact h₁'.inF e h' + · exact (hY₁ e h').2 + · exact h₀.inF e h' + have hrb₀ : r ≠ b₀ := fun h' ↦ hrA₂ (h' ▸ hb₀) + obtain ⟨W₁, W₂, h₀s⟩ := exists_splits hFc.2 hFc.1 hrF hb₀F hrb₀ + obtain ⟨R', hR⟩ := exists_side_of_walk (D := D) hrb₀ hZs hZF h₀s + have hrev := hR.rev + obtain ⟨b₂, hb₂, F₂, Zr, hEq, hfirst⟩ := GraphWalk.exists_first_mem R'.reverse (X + := {y | y ∈ A₂.support}) ⟨b₀, R'.reverse.end_mem_support, hb₀⟩ + rw [hEq] at hrev + have hb₂r : b₂ ≠ r := fun h' ↦ hrA₂ (h' ▸ hb₂) + have hF₂s : F₂.IsSimple := (isSimple_of_append hrev.s₁).1 + have hinF : ∀ e ∈ F₂.edges, e ∈ F.E := fun e he ↦ (hrev.E e).mpr (.inl (by + rw [GraphWalk.edges_append] + exact List.mem_append_left _ he)) + have hoffZ : ∀ e ∈ F₂.edges, e ∉ (Q₁.append (Y₁.append Q₀)).edges := fun e he he' ↦ by + refine hrev.edge e (by rw [GraphWalk.edges_append]; exact List.mem_append_left _ he) ?_ + rwa [GraphWalk.edges_reverse, List.mem_reverse] + have hsupF : ∀ x ∈ F₂.support, x ∈ F.V := support_subset_of_edges hFs F₂ hrF hinF + -- The walk `Zr` from `b₂` to `b₀` runs along `A₂`. + have hZrD : ∀ e ∈ Zr.edges, e ∈ Dv.E := by + by_cases he : b₂ = b₀ + · subst he + have := GraphWalk.edges_of_closed Zr (isSimple_of_append hrev.s₁).2 + rw [this] + exact fun _ h' ↦ absurd h' (List.not_mem_nil) + have hl := Splits.split_left hrev hb₂r he + have hl' := Splits.split_left hl.swap (Ne.symm he) hrb₀.symm + obtain ⟨Y₂, hY₂s, hY₂, -⟩ := s.swap.exists_seg hE hb₂ hb₀ (hsupF _ F₂.end_mem_support) hb₀F + rcases eq_side_of_walk (D := D) he hY₂s (fun e h' ↦ (hY₂ e h').2) hl' with rfl | h' + · exact fun e h' ↦ s.edge₂ e (hY₂ e h').1 + · exfalso + obtain ⟨e, heQ, -⟩ := GraphWalk.exists_edge_at_start Q₀ h₀.ne + have hmem : e ∈ Y₂.edges := by + rw [h', GraphWalk.edges_reverse, List.mem_reverse, GraphWalk.edges_append, + List.mem_append, GraphWalk.edges_reverse, List.mem_reverse] + exact .inl ((hZE e).mpr (.inr (.inr heQ))) + exact h₀.off e heQ (s.edge₂ e (hY₂ e hmem).1) + refine ⟨b₂, F₂, hb₂, hF₂s, fun e he ↦ ⟨hinF e he, fun h' ↦ hoffZ e he ((hZE e).mpr (.inl h')), + fun h' ↦ hoffZ e he ((hZE e).mpr (.inr (.inr h')))⟩, + fun x hx' hA ↦ hfirst x hx' hA, ?_, ?_, fun e he ↦ ?_⟩ + · -- If `F₂` met `A₁`, the segment from `b₁` to their common vertex would be one of the two + -- pieces of `F` between those vertices. + intro x hxF₂ hxA₁ + have hxF := hsupF x hxF₂ + have hxr : x ≠ r := fun h' ↦ hrA₁ (h' ▸ hxA₁) + have hxb₀ : x ≠ b₀ := fun h' ↦ hb₀A₁ (h' ▸ hxA₁) + have hxb₂ : x ≠ b₂ := fun h' ↦ hten x hxA₁ (h' ▸ hb₂) hxF + have hxb₁ : b₁ ≠ x := fun h' ↦ by + have hm := hrev.meet x ((GraphWalk.mem_support_append _ _).mpr (.inl hxF₂)) (by + rw [GraphWalk.support_reverse, List.mem_reverse, ← h'] + exact (GraphWalk.mem_support_append _ _).mpr (.inl Q₁.end_mem_support)) + rcases hm with h₃ | h₃ + · exact hxr h₃ + · exact hxb₀ h₃ + obtain ⟨L, M, hLM⟩ := F₂.exists_append_of_mem hxF₂ + rw [hLM, GraphWalk.append_assoc'] at hrev + have hl := Splits.split_left hrev hxr hxb₀ + rw [GraphWalk.reverse_append', ← GraphWalk.append_assoc'] at hl + have hl' := (Splits.split_left hl.swap hxb₁ h₁'.ne.symm).swap + obtain ⟨Yx, hYxs, hYx, -⟩ := s.exists_seg hE hb₁ hxA₁ hb₁F hxF + rcases eq_side_of_walk (D := D) hxb₁ hYxs (fun e h' ↦ (hYx e h').2) hl' with h' | h' + · obtain ⟨e, heQ, -⟩ := GraphWalk.exists_edge_at_start Q₁ h₁'.ne + have hmem : e ∈ Yx.edges := by + rw [h', GraphWalk.edges_append, List.mem_append, GraphWalk.edges_reverse, List.mem_reverse] + exact .inl heQ + exact h₁'.off e heQ (s.edge₁ e (hYx e hmem).1) + · obtain ⟨e, heQ, -⟩ := GraphWalk.exists_edge_at_start Q₀ h₀.ne + have hmem : e ∈ Yx.edges := by + rw [h', GraphWalk.edges_reverse, List.mem_reverse, GraphWalk.edges_append, + List.mem_append, GraphWalk.edges_reverse, List.mem_reverse] + exact .inr (by rw [GraphWalk.edges_append]; exact List.mem_append_right _ heQ) + exact h₀.off e heQ (s.edge₁ e (hYx e hmem).1) + · obtain ⟨e, he, hin⟩ := hf.exists_edge_in + refine ⟨e, ?_, hin⟩ + obtain ⟨p, hp⟩ := (hFs.2 he).1 + have hnotD : e ∉ Dv.E := fun h' ↦ (hin hp).2 (by + rw [← hx.sector.Dv_U] + exact Dv.closure_subset_U h' (subset_closure hp)) + have hnotO : ∀ {g : Set Shat}, Disjoint g Δv → e ≠ g := fun hg h' ↦ disjoint_left.mp + (h' ▸ hg) hp (discInt_subset _ (hin hp)) + rcases (hrev.E e).mp he with h' | h' + · rw [GraphWalk.edges_append, List.mem_append] at h' + rcases h' with h' | h' + · exact h' + · exact absurd (hZrD e h') hnotD + · rw [GraphWalk.edges_reverse, List.mem_reverse] at h' + rcases (hZE e).mp h' with h₃ | h₃ | h₃ + · exact absurd rfl (hnotO (o₁ e h₃)) + · exact absurd (s.edge₁ e (hY₁ e h₃).1) hnotD + · exact absurd rfl (hnotO (o₀ e h₃)) + · rcases (hrev.E e).mp he with h' | h' + · rw [GraphWalk.edges_append, List.mem_append] at h' + rcases h' with h' | h' + · exact .inl h' + · exact .inr (.inr (.inr (hZrD e h'))) + · rw [GraphWalk.edges_reverse, List.mem_reverse] at h' + rcases (hZE e).mp h' with h₃ | h₃ | h₃ + · exact .inr (.inl h₃) + · exact .inr (.inr (.inr (s.edge₁ e (hY₁ e h₃).1))) + · exact .inr (.inr (.inl h₃)) + +end IsFar + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13w.lean b/LeanPool/GraphMinor/GM19/Section13w.lean new file mode 100644 index 0000000000..5676f004ba --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13w.lean @@ -0,0 +1,268 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13v + +/-! +# Graph Minors XIX, Section 13: steps (12) to (14) of (13.6), and (13.6) + +The third arc `F₂` is an inner arc, so it is a chord of `D_v`. One of the two discs it cuts from +`Δ_v` misses `ins(F)`. So the other disc still points to `𝒯'`, and its boundary is at +least as long as `F`. Together with the same bound for `C`, and (14), this leaves no room for the +arc `F₀`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- An open subset of a disc misses the boundary of the disc. -/ +theorem disjoint_discBd_of_isOpen {T : Type} [TopologicalSpace T] + (hT : IsClosedSurface T) {Δ O : Set T} (hΔ : IsClosedDisc Δ) (hO : IsOpen O) (hs : O ⊆ Δ) : + Disjoint O (discBd Δ) := disjoint_left.mpr fun x hx hb ↦ by + rw [← IsClosedDisc.frontier_eq_discBd hT hΔ, frontier_eq_closure_inter_closure] at hb + obtain ⟨y, hy₁, hy₂⟩ := mem_closure_iff.mp hb.2 _ hO hx + exact hy₂ (hs hy₁) + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {Δv : Set + Shat} {Dv F : Drawing Shat} + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {Δ₀ Δ : Set Shat} {C : + Drawing Shat} {h : Shat} + {v₁ v₂ c₁ c₂ h₁ h₂ : Shat} {f₁ f₂ : Set Shat} {A₁ : GraphWalk D.rad.G.toGraph v₁ c₁} {A₂ : + GraphWalk D.rad.G.toGraph v₂ c₂} {T₁ : GraphWalk D.rad.G.toGraph c₁ h₁} + {T₂ : GraphWalk D.rad.G.toGraph c₂ h₂} + +namespace IsShape + +/-- `r*` is on neither spoke. -/ +theorem r_notMem₁ (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) (s : D.IsShape W H r Δv Dv F f₁ + f₂ A₁ A₂ T₁ T₂) : r ∉ A₁.support := fun h' ↦ + IsWheelHubOfRadius.r_notMem_spoke hf.enc.wheel hf.enc.hbdS hf.enc.hin hf.enc.sector.rstar_mem + s.spoke₁ ((GraphWalk.mem_support_append _ _).mpr (.inl h')) + +omit [T2Space S] in +/-- No edge is on both `A₁` and `A₂`. -/ +theorem edges_ne (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁ A₂ T₁ T₂) : ∀ e ∈ A₁.edges, e ∉ A₂.edges + := fun e h₁' h₂' ↦ by + obtain ⟨x, y, hxy, hx, hy, hcap⟩ := D.exists_ends_of_mem_edges A₁ h₁' + obtain ⟨hx', hy'⟩ := D.ends_mem_support A₂ h₂' hcap + exact hxy ((s.meet x hx hx').1.trans (s.meet y hy hy').1.symm) + +/-- The edges of `D_v` at `r*` differ. -/ +theorem f_ne (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁ + A₂ T₁ T₂) : f₁ ≠ f₂ := by + rintro rfl + have hm : v₁ ∈ closure f₁ ∩ D.rad.G.V := by + rw [s.link₁.2.2.2] + exact .inr rfl + rw [s.link₂.2.2.2] at hm + rcases hm with h' | h' + · exact s.r_notMem₁ hf (h' ▸ A₁.start_mem_support) + · exact s.ne h' + +/-- `f₁` is not on `A₂`, as `r*` is not. -/ +theorem f₁_notMem (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) (s : D.IsShape W H r Δv Dv F f₁ + f₂ A₁ A₂ T₁ T₂) : f₁ ∉ A₂.edges := fun h' ↦ + s.swap.r_notMem₁ hf (D.ends_mem_support A₂ h' s.link₁.2.2.2).1 + +end IsShape + +namespace IsFar + +/-- Step (13) for the inner arc: `F₂` with the path of `D_v` from `r*` to `b₂` through `v₂` is at +least as long as `F`. The other disc cut from `Δ_v` by `F₂` misses `ins(F)`, since +otherwise all of `C` would be in `F`. -/ +theorem chord_bound (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) (s : D.IsShape W H r Δv Dv F f₁ + f₂ A₁ A₂ T₁ T₂) {b₁ b₂ : Shat} {Q₁ : GraphWalk D.rad.G.toGraph r b₁} + {F₂ : GraphWalk D.rad.G.toGraph r b₂} {X₁ : GraphWalk D.rad.G.toGraph v₁ b₁} {X₂ : GraphWalk + D.rad.G.toGraph v₂ b₂} {Z₁ : GraphWalk D.rad.G.toGraph b₁ c₁} + {Z₂ : GraphWalk D.rad.G.toGraph b₂ c₂} (hF₂ : IsArcOn D.rad.G Dv F F₂) + (hin : ∀ e ∈ F₂.edges, e ⊆ discInt Δv) (hA₁ : A₁ = X₁.append Z₁) (hA₂ : A₂ = X₂.append Z₂) + (hC : ∀ e, e ∈ C.E ↔ e ∈ Q₁.edges ∨ e ∈ (GraphWalk.cons s.link₁ X₁).edges) + (hQ₁ : ∀ e ∈ Q₁.edges, e ∈ F.E) + (hcover : ∀ e ∈ F.E, e ∈ F₂.edges ∨ Disjoint e Δv ∨ e ∈ Dv.E) : F.E.ncard ≤ F₂.length + + (X₂.length + 1) := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hx := hf.enc + have hW := hx.wheel + have hFi := hx.isInsOf_F + have hFc := hFi.1 + have hFs := hFc.1 + have hDv := hx.sector.Dv_circuit + have hΔv := hx.sector.is_disc + have hbv := hx.sector.Dv_U.symm + have hΔF := hFi.2.2.1 + have hbF := hFi.2.2.2.1 + have hrep := hx.hrep + have hFcard := hx.F_card + have hρ := hW.pos_ρ + have hUvΔ : Dv.U ⊆ Δv := fun x hx' ↦ Surface.discBd_subset _ (hbv ▸ hx') + have hX₂s : X₂.IsSimple := by + have := (isSimple_of_append s.spoke₂.1).1 + rw [hA₂] at this + exact (isSimple_of_append this).1 + have hrX₂ : r ∉ X₂.support := fun h' ↦ s.swap.r_notMem₁ hf (by + rw [hA₂, GraphWalk.mem_support_append] + exact .inl h') + set Pa : GraphWalk D.rad.G.toGraph r b₂ := GraphWalk.cons s.link₂ X₂ with hPa + have hPas : Pa.IsSimple := List.nodup_cons.mpr ⟨hrX₂, hX₂s⟩ + have hPaE : ∀ e, e ∈ Pa.edges ↔ e = f₂ ∨ e ∈ X₂.edges := fun e ↦ by + rw [hPa, GraphWalk.edges_cons, List.mem_cons] + have hPaD : ∀ e ∈ Pa.edges, e ∈ Dv.E := fun e he ↦ by + rcases (hPaE e).mp he with rfl | he + · exact s.f₂_mem + · exact s.edge₂ e (by rw [hA₂, GraphWalk.edges_append]; exact List.mem_append_left _ he) + obtain ⟨W₁, W₂, h₀⟩ := exists_splits hDv.2 hDv.1 hF₂.left hF₂.right hF₂.ne + obtain ⟨R, hR⟩ := exists_side_of_walk (D := D) hF₂.ne hPas hPaD h₀ + have ht := Splits.twoPaths hR hF₂.ne hDv.1 hF₂.simple hF₂.inner hF₂.off + have hUF₂ : (walkDrawing D.rad.G F₂).U ⊆ Δv := fun y hy ↦ by + have hc : ∃ e ∈ F₂.edges, y ∈ closure e := by + rcases (mem_walkDrawing_U _ _).mp hy with h' | h' + · exact GraphWalk.exists_edge_of_support F₂ hF₂.ne h' + · exact h' + obtain ⟨e, he, hye⟩ := hc + rw [← closure_discInt hΔv] + exact closure_mono (hin e he) hye + have hsubU : ∀ {a b : Shat} {K : GraphWalk D.rad.G.toGraph a b}, (walkDrawing D.rad.G + K).IsSubdrawing Dv → (walkDrawing D.rad.G K).U ⊆ Dv.U := fun h' ↦ h'.U_subset + have hPU : (walkDrawing D.rad.G Pa).U ⊆ Dv.U := ht.left.1.U_subset + have hRU : (walkDrawing D.rad.G R.reverse).U ⊆ Dv.U := ht.right.1.U_subset + have hc₁ := ht.swap.left_circuit + have hc₂ := ht.left_circuit + have hU₁ := ht.swap.U_right + have hU₂ := ht.U_right + obtain ⟨Δp, ⟨hsp, hdp, hbp, -⟩, -⟩ := disc_oArc Δv _ hΔv (by + rw [hU₁] + exact union_subset hUF₂ (hPU.trans hUvΔ)) (GM14.isOArc_of_isCircuit hc₁) + obtain ⟨Δr, ⟨hsr, hdr, hbr, -⟩, -⟩ := disc_oArc Δv _ hΔv (by + rw [hU₂] + exact union_subset hUF₂ (hRU.trans hUvΔ)) (GM14.isOArc_of_isCircuit hc₂) + have hcovT := ht.theta_cover hT (isSide_out hT hΔv hbv) hdp hdr hbp hbr + (disjoint_left.mpr fun x h₁' h₂' ↦ h₁' (hsp h₂')) (disjoint_left.mpr fun x h₁' h₂' ↦ h₁' + (hsr h₂')) + have hsub₁ : (D.rad.G.sup (walkDrawing D.rad.G F₂) (walkDrawing D.rad.G Pa)).IsSubdrawing D.rad.G + := D.rad.G.sup_isSubdrawing _ _ + have hcard : (D.rad.G.sup (walkDrawing D.rad.G F₂) (walkDrawing D.rad.G Pa)).E.ncard + = F₂.length + (X₂.length + 1) := by + rw [Drawing.sup_E (walkDrawing_isSubdrawing _ _) (walkDrawing_isSubdrawing _ _), + Set.ncard_union_eq (s := (walkDrawing D.rad.G F₂).E) (t := (walkDrawing D.rad.G Pa).E) + (disjoint_left.mpr fun e h₁' h₂' ↦ by + rw [walkDrawing_E] at h₁' h₂' + exact hF₂.off e h₁' (hPaD e h₂')) (walkDrawing D.rad.G F₂).finite_edges + (walkDrawing D.rad.G Pa).finite_edges, ncard_walk_E _ hF₂.simple, ncard_walk_E _ hPas] + rfl + rw [← hcard] + by_cases hle : F.E.ncard ≤ (D.rad.G.sup (walkDrawing D.rad.G F₂) (walkDrawing D.rad.G Pa)).E.ncard + · exact hle + have hle' : (D.rad.G.sup (walkDrawing D.rad.G F₂) (walkDrawing D.rad.G Pa)).E.ncard ≤ + 4 * ρ + 4 := by omega + have hCirc₁ : Drawing.IsCircuitOf (D.rad.G.sup (walkDrawing D.rad.G F₂) + (walkDrawing D.rad.G Pa)) D.rad.G := ⟨hsub₁, hc₁⟩ + have heq := hW.eq_ins_of_disc hCirc₁ hle' hdp (hsp.trans hx.sector.Δv_sub) hbp + have hins := D.ins_spec hCirc₁ (by omega) + rw [← heq] at hins + -- `F` misses the interior of the other disc. + have hIntΔ : discInt Δr ⊆ Δv := (discInt_subset _).trans hsr + have hoffF : Disjoint (discInt Δr) F.U := by + have hsubc : F.U ⊆ (discInt Δr)ᶜ := U_of_edges hFc.2 (hdr.isOpen_discInt hman).isClosed_compl + fun e he p hp hpi ↦ by + rcases hcover e he with h' | h' | h' + · refine hpi.2 ?_ + rw [hbr, hU₂] + exact .inl ((mem_walkDrawing_U _ _).mpr (.inr ⟨e, h', subset_closure hp⟩)) + · exact disjoint_left.mp h' hp (hIntΔ hpi) + · exact disjoint_left.mp (disjoint_discBd_of_isOpen hT hΔv (hdr.isOpen_discInt hman) hIntΔ) + hpi (hbv ▸ Dv.closure_subset_U h' (subset_closure hp)) + exact disjoint_left.mpr fun x h₁' h₂' ↦ hsubc h₂' h₁' + have hoffIns : Disjoint (discInt Δr) (D.ins F) := by + by_contra hn + obtain ⟨y, hy₁, hy₂⟩ := not_disjoint_iff.mp hn + have hyb : y ∉ discBd (D.ins F) := fun h' ↦ disjoint_left.mp hoffF hy₁ (hbF ▸ h') + have hsubI : discInt Δr ⊆ discInt (D.ins F) := + subset_discInt_of_connected hman hΔF hdr.isPreconnected_discInt (by + rw [hbF] + exact hoffF) ⟨y, hy₁, hy₂, hyb⟩ + have hrI : Δr ⊆ D.ins F := by + rw [← closure_discInt hdr, ← closure_discInt hΔF] + exact closure_mono hsubI + have hIOff : Disjoint (discInt (D.ins F)) (discBd Δ) := disjoint_discBd_of_isOpen hT hf.disc + (hΔF.isOpen_discInt hman) ((discInt_subset _).trans hf.F_sub) + refine hf.ne_F fun e he ↦ ?_ + rcases (hC e).mp he with h' | h' + · exact hQ₁ e h' + · have heD : e ∈ Dv.E := by + rw [GraphWalk.edges_cons, List.mem_cons] at h' + rcases h' with rfl | h' + · exact s.f₁_mem + · exact s.edge₁ e (by rw [hA₁, GraphWalk.edges_append]; exact List.mem_append_left _ h') + have heR : e ∈ R.reverse.edges := by + have heA : e ∉ Pa.edges := fun hn' ↦ by + rw [GraphWalk.edges_cons, List.mem_cons] at h' + rcases (hPaE e).mp hn' with rfl | h₃ <;> rcases h' with h' | h' + · exact s.f_ne hf h'.symm + · exact s.swap.f₁_notMem hf (by + rw [hA₁, GraphWalk.edges_append] + exact List.mem_append_left _ h') + · exact s.f₁_notMem hf (by + rw [hA₂, GraphWalk.edges_append, ← h'] + exact List.mem_append_left _ h₃) + · exact s.edges_ne e (by + rw [hA₁, GraphWalk.edges_append] + exact List.mem_append_left _ h') (by + rw [hA₂, GraphWalk.edges_append] + exact List.mem_append_left _ h₃) + rw [GraphWalk.edges_reverse, List.mem_reverse] + exact ((hR.E e).mp heD).resolve_left heA + have heG := hDv.1.2 heD + by_contra hnF + obtain ⟨p, hp⟩ := heG.1 + have hpF : p ∉ F.U := disjoint_left.mp (edge_disjoint_U hFs heG hnF) hp + have hpIns : p ∈ D.ins F := hrI (Surface.discBd_subset _ (by + rw [hbr, hU₂] + exact .inr ((mem_walkDrawing_U _ _).mpr (.inr ⟨e, heR, subset_closure hp⟩)))) + have hpBd : p ∈ discBd Δ := by + rw [hf.bd] + exact C.closure_subset_U he (subset_closure hp) + exact disjoint_left.mp hIOff ⟨hpIns, fun h₃ ↦ hpF (hbF ▸ h₃)⟩ hpBd + refine hx.card_le_of_cover hins fun y hy₁ hy₂ ↦ ?_ + rcases hcovT y with h' | h' | h' + · exfalso + obtain ⟨z, hz₁, hz₂⟩ := mem_closure_iff.mp h' _ (hΔv.isOpen_discInt hman) hy₁ + exact hz₂ (discInt_subset _ hz₁) + · exact h' + · exfalso + by_cases hyb : y ∈ discBd Δr + · rw [hbr, hU₂] at hyb + rcases hyb with h₃ | h₃ + · refine hy₂.2 ?_ + rw [hbF] + rcases (mem_walkDrawing_U _ _).mp h₃ with h₄ | ⟨e, he, hye⟩ + · exact F.V_subset_U (hF₂.mem_F hFs y h₄) + · exact F.closure_subset_U (hF₂.inF e he) hye + · exact hy₁.2 (hbv ▸ hRU h₃) + · exact disjoint_left.mp hoffIns ⟨h', hyb⟩ (discInt_subset _ hy₂) + +end IsFar + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13x.lean b/LeanPool/GraphMinor/GM19/Section13x.lean new file mode 100644 index 0000000000..84bdf3c949 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13x.lean @@ -0,0 +1,597 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13w + +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Graph Minors XIX, Section 13: the end of the proof of (13.6) + +Steps (8) to (11) leave two arcs of `F` outside `Δ_v`, and steps (12) to (14) use them to bound `F` +from above and below. Here we put these together. First comes the set that ties each +arc away from the hub, in both forms of the sector. Then comes the count that gives the +contradiction, and (13.6) itself. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +omit [T2Space Shat] in +/-- If every vertex of an edge of a simple walk is an end of the walk, then this edge is the only +edge of the walk. -/ +theorem GraphWalk.edges_eq_of_ends {G : Drawing Shat} {a b : Shat} (K : GraphWalk G.toGraph a b) + (hs : K.IsSimple) {e : Set Shat} (he : e ∈ K.edges) + (hV : ∀ x y, G.toGraph.IsLink e x y → (x = a ∨ x = b) ∧ (y = a ∨ y = b)) : ∀ e' ∈ K.edges, e' + = e := by + obtain ⟨x, y, hl, L, M, rfl⟩ := GraphWalk.exists_split_edge K he + obtain ⟨hL, hc⟩ := isSimple_of_append hs + obtain ⟨hxM, hM⟩ := List.nodup_cons.mp hc + obtain ⟨h₁, h₂⟩ := hV x y hl + have hxb : x ≠ b := fun h' ↦ hxM (h' ▸ M.end_mem_support) + have hxa := h₁.resolve_right hxb + subst hxa + have hya : y ≠ x := fun h' ↦ hxM (h' ▸ M.start_mem_support) + have hyb := h₂.resolve_left hya + subst hyb + intro e' he' + rw [GraphWalk.edges_append, GraphWalk.edges_cons, GraphWalk.edges_of_closed L hL, + GraphWalk.edges_of_closed M hM] at he' + simpa using he' + +/-- The image of a line is connected. -/ +theorem IsLineWithEnds.isPreconnected' {T : Type} [TopologicalSpace T] {L : Set T} {u v : T} + (h : IsLineWithEnds L u v) : IsPreconnected L := + GraphMinor.Surface.IsLineWithEnds.isPreconnected h + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {Δv : Set + Shat} {Dv F : Drawing Shat} + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {Δ₀ Δ : Set Shat} {C : + Drawing Shat} {h : Shat} + {v₁ v₂ c₁ c₂ h₁ h₂ : Shat} {f₁ f₂ : Set Shat} {A₁ : GraphWalk D.rad.G.toGraph v₁ c₁} {A₂ : + GraphWalk D.rad.G.toGraph v₂ c₂} {T₁ : GraphWalk D.rad.G.toGraph c₁ h₁} + {T₂ : GraphWalk D.rad.G.toGraph c₂ h₂} + +omit [T2Space S] in +/-- A point of a walk in the drawing of the walk that is a vertex of `Γ*` is on the walk. -/ +theorem support_of_mem_U {a b y : Shat} (L : GraphWalk D.rad.G.toGraph a b) (hy : y ∈ + (walkDrawing D.rad.G L).U) (hV : y ∈ D.rad.G.V) : y ∈ L.support := by + rcases (mem_walkDrawing_U _ _).mp hy with h' | ⟨e, he, hye⟩ + · exact h' + · obtain ⟨x, z, -, hx, hz, hcap⟩ := D.exists_ends_of_mem_edges L he + have hm : y ∈ closure e ∩ D.rad.G.V := ⟨hye, hV⟩ + rw [hcap] at hm + rcases hm with rfl | rfl + · exact hx + · exact hz + +omit [T2Space S] in +/-- Two walks meet only at common vertices and in common edges. -/ +theorem walkU_inter {a b a' b' y : Shat} (L : GraphWalk D.rad.G.toGraph a b) + (M : GraphWalk D.rad.G.toGraph a' b') (h₁' : y ∈ (walkDrawing D.rad.G L).U) + (h₂' : y ∈ (walkDrawing D.rad.G M).U) : (y ∈ L.support ∧ y ∈ M.support) ∨ ∃ e, e ∈ L.edges + ∧ e ∈ M.edges := by + by_cases hV : y ∈ D.rad.G.V + · exact .inl ⟨support_of_mem_U L h₁' hV, support_of_mem_U M h₂' hV⟩ + · right + rcases (mem_walkDrawing_U _ _).mp h₂' with h' | ⟨e, he, hye⟩ + · exact absurd (M.mem_vertexSet_of_mem_support h') hV + · have heG : e ∈ D.rad.G.E := TieBreaker.mem_edges_E M he + have hye' : y ∈ e := (closure_edge_subset heG hye).resolve_right hV + refine ⟨e, ?_, he⟩ + by_contra hn + exact disjoint_left.mp (edge_disjoint_U (walkDrawing_isSubdrawing _ _) heG + (by rwa [walkDrawing_E])) hye' h₁' + +omit [T2Space S] in +/-- A walk with no vertex on a subdrawing is disjoint from it. -/ +theorem walkU_disjoint {a b : Shat} {F : Drawing Shat} (hFs : F.IsSubdrawing D.rad.G) + (T : GraphWalk D.rad.G.toGraph a b) (hT : ∀ x ∈ T.support, x ∉ F.V) : + Disjoint (walkDrawing D.rad.G T).U F.U := disjoint_left.mpr fun y hy hyF ↦ by + by_cases hV : y ∈ D.rad.G.V + · exact hT y (support_of_mem_U T hy hV) (mem_V_of_mem_U hFs hyF hV) + · rcases (mem_walkDrawing_U _ _).mp hy with h' | ⟨e, he, hye⟩ + · exact hV (T.mem_vertexSet_of_mem_support h') + · have heG : e ∈ D.rad.G.E := TieBreaker.mem_edges_E T he + have hye' : y ∈ e := (closure_edge_subset heG hye).resolve_right hV + have heF : e ∈ F.E := by + by_contra hn + exact disjoint_left.mp (edge_disjoint_U hFs heG hn) hye' hyF + obtain ⟨x, z, -, hx, -, hcap⟩ := D.exists_ends_of_mem_edges T he + have hm : x ∈ closure e ∩ D.rad.G.V := by rw [hcap]; exact .inl rfl + exact hT x hx (mem_V_of_mem_U hFs (F.closure_subset_U heF hm.1) hm.2) + +theorem IsArcOn.U_subset_F {G Dv F : Drawing Shat} {a b : Shat} {P : GraphWalk G.toGraph a b} + (hP : IsArcOn G Dv F P) (hF : F.IsSubdrawing G) : (walkDrawing G P).U ⊆ F.U := fun y hy ↦ by + rcases (mem_walkDrawing_U _ _).mp hy with h' | ⟨e, he, hye⟩ + · exact F.V_subset_U (hP.mem_F hF y h') + · exact F.closure_subset_U (hP.inF e he) hye + +/-- The walk drawing of a simple walk is connected. -/ +theorem walkU_isPreconnected {G : Drawing Shat} {a b : Shat} (T : GraphWalk G.toGraph a b) + (hs : T.IsSimple) : IsPreconnected (walkDrawing G T).U := by + by_cases hab : a = b + · subst hab + have hE := GraphWalk.edges_of_closed T hs + have hU : (walkDrawing G T).U = {a} := by + ext y + rw [mem_singleton_iff, mem_walkDrawing_U] + constructor + · rintro (h' | ⟨e, he, -⟩) + · by_contra hne + obtain ⟨L, M, hLM⟩ := T.exists_append_of_mem h' + obtain ⟨e, he, -⟩ := GraphWalk.exists_edge_at_end L (Ne.symm hne) + rw [hLM, GraphWalk.edges_append] at hE + simp only [List.append_eq_nil_iff] at hE + simp [hE.1] at he + · simp [hE] at he + · rintro rfl + exact .inl T.start_mem_support + rw [hU] + exact isPreconnected_singleton + · exact IsLineWithEnds.isPreconnected' (isLine_of_isPathBetween (walkDrawing_isPathBetween G hs) + hab) + +namespace IsFar + +variable {u h' : Shat} {A₁' : GraphWalk D.rad.G.toGraph v₁ u} {A₂' : GraphWalk D.rad.G.toGraph v₂ + u} {T : GraphWalk D.rad.G.toGraph u h'} + +/-- In the first form of the sector, the rest of the two spokes is an anchor, as soon as `F` has no +vertex on it. -/ +theorem fan_anchor (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) (s : D.IsShape W H r Δv Dv F f₁ + f₂ A₁' A₂' T T) (hfan : D.IsFan W H ρ r f₁ f₂ A₁' A₂' T) + (hTF : ∀ x ∈ T.support, x ∉ F.V) : D.IsAnchor H ρ Δv Dv F h f₁ f₂ A₁' A₂' + (walkDrawing D.rad.G T).U := by + have hT' := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hx := hf.enc + have hW := hx.wheel + have hFs := hx.isInsOf_F.1.1 + have hbv := hx.sector.Dv_U.symm + have hsub₁ : (walkDrawing D.rad.G T).U ⊆ (walkDrawing D.rad.G (A₁'.append T)).U := walkU_subset + (fun x hx' ↦ (GraphWalk.mem_support_append _ _).mpr (.inr hx')) + (fun e he ↦ by rw [GraphWalk.edges_append]; exact List.mem_append_right _ he) + have hsub₂ : (walkDrawing D.rad.G T).U ⊆ (walkDrawing D.rad.G (A₂'.append T)).U := walkU_subset + (fun x hx' ↦ (GraphWalk.mem_support_append _ _).mpr (.inr hx')) + (fun e he ↦ by rw [GraphWalk.edges_append]; exact List.mem_append_right _ he) + have hcl : IsClosed (discBd W) := by + rw [← IsClosedDisc.frontier_eq_discBd hT' hW.is_disc] + exact isClosed_frontier + have hoffB : Disjoint (walkDrawing D.rad.G T).U (discBd W) := disjoint_left.mpr fun y hy hb ↦ + s.ne ((IsSpokeWalk.meet_bd hW hx.hbdS hx.hin s.spoke₁ (hsub₁ hy) hb).symm.trans + (IsSpokeWalk.meet_bd hW hx.hbdS hx.hin s.spoke₂ (hsub₂ hy) hb)) + have hmeetA : ∀ {v : Shat} {A : GraphWalk D.rad.G.toGraph v u}, (∀ e ∈ A.edges, e ∉ T.edges) → + (A.append T).IsSimple → ∀ y ∈ (walkDrawing D.rad.G T).U, y ∈ (walkDrawing D.rad.G A).U → y = u + := by + intro v A hd hsA y hy hy' + rcases walkU_inter A T hy' hy with ⟨h₃, h₄⟩ | ⟨e, h₃, h₄⟩ + · exact Splits.append_meet hsA h₃ h₄ + · exact absurd h₄ (hd e h₃) + have hu : u ∈ (walkDrawing D.rad.G T).U := (mem_walkDrawing_U _ _).mpr (.inl T.start_mem_support) + refine ⟨walkU_isPreconnected T (isSimple_of_append s.spoke₁.1).2, ⟨u, hu, Surface.discBd_subset _ + (hbv ▸ Dv.V_subset_U (s.mem₁ u A₁'.end_mem_support))⟩, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · have hend : h' ∈ (walkDrawing D.rad.G T).U := (mem_walkDrawing_U _ _).mpr + (.inl T.end_mem_support) + rcases hf.hub with ⟨hV, -⟩ | ⟨h₁', h₂', h₃'⟩ + · have hm := s.spoke₁.2.h_mem + rw [hV] at hm + exact ⟨h', hend, .inl hm⟩ + · exact ⟨h', hend, .inr ⟨H.V_subset_U s.spoke₁.2.h_mem, h₁', h₂', h₃'⟩⟩ + · intro a b Q hQ + exact (walkU_disjoint hFs T hTF).mono_right (IsArcOn.U_subset_F hQ hFs) + · exact hoffB.mono_right (closure_minimal s.bd₁ hcl) + · exact hoffB.mono_right (closure_minimal s.bd₂ hcl) + · exact hmeetA hfan.edges_disjoint_T s.spoke₁.1 + · exact hmeetA hfan.swap.edges_disjoint_T s.spoke₂.1 + +omit [T2Space S] in +/-- In the second form of the sector, a point of an edge of the path of `H` on `D_v` is an anchor. +-/ +theorem path_anchor (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) (s : D.IsShape W H r Δv Dv F f₁ + f₂ A₁ A₂ T₁ T₂) {p q : Shat} {P : Drawing Shat} (hpq : p ≠ q) (hP : Drawing.IsPathOf P H p q) + (hsub : P.U ⊆ Dv.U) : ∃ Y, + D.IsAnchor H ρ Δv Dv F h f₁ f₂ A₁ A₂ Y := by + have hT' := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hx := hf.enc + have hW := hx.wheel + have hbv := hx.sector.Dv_U.symm + obtain ⟨K, -, -, hKE⟩ := hP.exists_simple_walk + obtain ⟨g, hgK, -⟩ := GraphWalk.exists_edge_at_end K hpq + have hgP := (hKE g).mpr hgK + have hgH := hP.1.2 hgP + have hgG := hW.H_sub.2 hgH + obtain ⟨y, hy⟩ := hgG.1 + have hyV : y ∉ D.rad.G.V := (hgG.2.1 hy).2 + have hyP : y ∈ P.U := P.closure_subset_U hgP (subset_closure hy) + have hyH : y ∈ H.U := H.closure_subset_U hgH (subset_closure hy) + have hgD : g ∈ Dv.E := by + by_contra hn + exact disjoint_left.mp (edge_disjoint_U hx.sector.Dv_circuit.1 hgG hn) hy (hsub hyP) + have hyW : y ∉ discBd W := fun h' ↦ (hW.H_in_int hyH).2 h' + have hcl : IsClosed (discBd W) := by + rw [← IsClosedDisc.frontier_eq_discBd hT' hW.is_disc] + exact isClosed_frontier + have hhub : ∃ z ∈ ({y} : Set Shat), z = h ∨ (z ∈ H.U ∧ IsEnclave D.tb D.ord D.𝒯 H ∧ H.E.ncard + ≤ 4 * ρ + 4 ∧ h ∈ discInt (D.ins H)) := by + rcases hf.hub with ⟨hV, -⟩ | ⟨h₁', h₂', h₃'⟩ + · exfalso + have hp : p ∈ H.V := K.mem_vertexSet_of_mem_support K.start_mem_support + have hq : q ∈ H.V := K.mem_vertexSet_of_mem_support K.end_mem_support + rw [hV] at hp hq + exact hpq (hp.trans hq.symm) + · exact ⟨y, rfl, .inr ⟨hyH, h₁', h₂', h₃'⟩⟩ + refine ⟨{y}, isPreconnected_singleton, ⟨y, rfl, Surface.discBd_subset _ (hbv ▸ hsub hyP)⟩, + hhub, ?_, ?_, ?_, ?_, ?_⟩ + · intro a b Q hQ + refine disjoint_singleton_left.mpr fun hyQ ↦ ?_ + rcases (mem_walkDrawing_U _ _).mp hyQ with h' | ⟨e, he, hye⟩ + · exact hyV (Q.mem_vertexSet_of_mem_support h') + · have heG : e ∈ D.rad.G.E := TieBreaker.mem_edges_E Q he + have hye' : y ∈ e := (closure_edge_subset heG hye).resolve_right hyV + refine hQ.off e he ?_ + by_contra hn + exact disjoint_left.mp (edge_disjoint_U hx.sector.Dv_circuit.1 heG hn) hye' (hsub hyP) + · exact disjoint_singleton_left.mpr fun h' ↦ hyW (closure_minimal s.bd₁ hcl h') + · exact disjoint_singleton_left.mpr fun h' ↦ hyW (closure_minimal s.bd₂ hcl h') + · rintro z rfl hz + have hz' : z ∈ (walkDrawing D.rad.G (A₁.append T₁)).U := walkU_subset (fun x hx' ↦ + (GraphWalk.mem_support_append _ _).mpr (.inl hx')) + (fun e he ↦ by rw [GraphWalk.edges_append]; exact List.mem_append_left _ he) hz + have := IsSpokeWalk.U_inter_hub hW s.spoke₁ hz' hyH + exact absurd (this ▸ (A₁.append T₁).mem_vertexSet_of_mem_support (A₁.append + T₁).end_mem_support) hyV + · rintro z rfl hz + have hz' : z ∈ (walkDrawing D.rad.G (A₂.append T₂)).U := walkU_subset (fun x hx' ↦ + (GraphWalk.mem_support_append _ _).mpr (.inl hx')) + (fun e he ↦ by rw [GraphWalk.edges_append]; exact List.mem_append_left _ he) hz + have := IsSpokeWalk.U_inter_hub hW s.spoke₂ hz' hyH + exact absurd (this ▸ (A₂.append T₂).mem_vertexSet_of_mem_support (A₂.append + T₂).end_mem_support) hyV + +/-- The end of the proof of (13.6) when the second arc goes across: `Q₀` goes from `A₁` to `A₂`. +Then `F` has a third arc `F₂`, which is a chord of `D_v`, and counting gives the +contradiction. -/ +theorem false_of_cross (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) + (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁ A₂ T₁ T₂) {Y : Set Shat} (ha : D.IsAnchor H ρ Δv Dv F h f₁ + f₂ A₁ A₂ Y) + (hten : ∀ x ∈ A₁.support, x ∈ A₂.support → x ∉ F.V) {b₁ a₀ b₀ : Shat} {Q₁ : GraphWalk + D.rad.G.toGraph r b₁} {Q₀ : GraphWalk D.rad.G.toGraph a₀ b₀} (h₁' : IsArcOn D.rad.G Dv F Q₁) + (h₀ : IsArcOn D.rad.G Dv F Q₀) (o₁ : ∀ e ∈ Q₁.edges, Disjoint e Δv) + (o₀ : ∀ e ∈ Q₀.edges, Disjoint e Δv) (hd : ∀ e ∈ Q₀.edges, e ∉ Q₁.edges) + (hb₁ : b₁ ∈ A₁.support) (ha₀ : a₀ ∈ A₁.support) + (hb₀ : b₀ ∈ A₂.support) (hnp : ¬ PushesInto (Δ₀ \ {h}) (Δv \ {h}) + (walkDrawing D.rad.G Q₁).U r b₁) : False := by + classical + have : ConnectedSpace Shat := cap.connected + have hx := hf.enc + have hW := hx.wheel + have hDv := hx.sector.Dv_circuit + have hΔv := hx.sector.is_disc + have hbv := hx.sector.Dv_U.symm + have hrep := hx.hrep + have hρ := hW.pos_ρ + have hr := hf.toIsRound + have hcC := hr.C_card + obtain ⟨X₁, Z₁, hA₁⟩ := A₁.exists_append_of_mem hb₁ + obtain ⟨b₂, F₂, hb₂, hF₂s, hF₂E, hF₂A₂, hF₂A₁, ⟨e', he', hin'⟩, hcov⟩ + := hf.exists_third s hten h₁' h₀ o₁ o₀ hd hb₁ ha₀ hb₀ + have hC := hf.outer_circuit s ha h₁' o₁ hA₁ hnp + have hins : IsInsOf D.rad D.ord D.𝒯 C Δ := by + have h' := D.ins_spec hf.circuit (by have h₆ : 6 * ρ + 14 ≤ D.rep := hrep; omega) + rwa [hr.ins_C] at h' + have hNC : F.E.ncard ≤ C.E.ncard := hx.card_le_of_cover hins fun y _ hy ↦ hf.F_sub + (discInt_subset _ hy) + have hCle : C.E.ncard ≤ Q₁.length + (X₁.length + 1) := by + have h' := ncard_le_length_of_edges (P := C) (Q₁.append (GraphWalk.cons s.link₁ X₁).reverse) + (fun e he ↦ by + rw [GraphWalk.edges_append, List.mem_append, GraphWalk.edges_reverse, List.mem_reverse] + exact (hC e).mp he) + rw [GraphWalk.length_append, GraphWalk.length_reverse] at h' + exact h' + have hp₁ : X₁.length + 1 ≤ Q₁.length := IsShape.parity_bound hf s Q₁ hA₁ + have hXρ : X₁.length ≤ ρ := by + have h' := (hW.spoke_length s.spoke₁).1 + rw [GraphWalk.length_append, hA₁, GraphWalk.length_append] at h' + omega + have hf₀ : 1 ≤ Q₀.length := by + obtain ⟨e, he, -⟩ := GraphWalk.exists_edge_at_start Q₀ h₀.ne + have h' := List.length_pos_of_mem he + rw [edges_length] at h' + exact h' + have hcount : Q₀.length + Q₁.length + F₂.length ≤ F.E.ncard := by + have hn : (Q₀.edges ++ Q₁.edges ++ F₂.edges).Nodup := by + refine List.Nodup.append (List.Nodup.append h₀.simple.edges_nodup h₁'.simple.edges_nodup fun + e h₃ h₄ ↦ hd e h₃ h₄) hF₂s.edges_nodup fun e h₃ h₄ ↦ ?_ + rcases List.mem_append.mp h₃ with h₃ | h₃ + · exact (hF₂E e h₄).2.2 h₃ + · exact (hF₂E e h₄).2.1 h₃ + have h' := length_le_of_nodup F hn fun e he ↦ by + rcases List.mem_append.mp he with he | he + · rcases List.mem_append.mp he with he | he + · exact h₀.inF e he + · exact h₁'.inF e he + · exact (hF₂E e he).1 + rw [List.length_append, List.length_append, edges_length, edges_length, edges_length] at h' + exact h' + have hrA₂ : r ∉ A₂.support := s.swap.r_notMem₁ hf + by_cases hmid : ∃ x ∈ F₂.support, x ∈ Dv.V ∧ x ≠ r ∧ x ≠ b₂ + · -- A vertex of `D_v` inside `F₂` is on the hub, so `F₂` is too long. + obtain ⟨x, hxF, hxD, hxr, hxb⟩ := hmid + have hxH := s.rest x hxD hxr (hF₂A₁ x hxF) fun h' ↦ hxb (hF₂A₂ x hxF h') + obtain ⟨L, M, hLM⟩ := F₂.exists_append_of_mem hxF + have hL := IsWheelHubOfRadius.walk_from_rstar hW hx.hbdS hx.hin hx.sector.rstar_mem hxH L + have hM : 1 ≤ M.length := by + obtain ⟨e, he, -⟩ := GraphWalk.exists_edge_at_start M hxb + have h' := List.length_pos_of_mem he + rw [edges_length] at h' + exact h' + have hl : F₂.length = L.length + M.length := by rw [hLM, GraphWalk.length_append] + omega + have hinner : ∀ x ∈ F₂.support, x ∈ Dv.V → x = r ∨ x = b₂ := fun x hxF hxD ↦ by + by_contra hn + push Not at hn + exact hmid ⟨x, hxF, hxD, hn.1, hn.2⟩ + have hoff : ∀ e ∈ F₂.edges, e ∉ Dv.E := fun e he heD ↦ by + have h₃ := GraphWalk.edges_eq_of_ends F₂ hF₂s he (fun x y hl ↦ by + obtain ⟨h₄, h₅⟩ := Drawing.IsLink.mem_V_of_sub hDv.1 hl heD + obtain ⟨h₆, h₇⟩ := D.ends_mem_support F₂ he hl.2.2.2 + exact ⟨hinner x h₆ h₄, hinner y h₇ h₅⟩) + obtain ⟨p, hp⟩ := (hDv.1.2 heD).1 + have heq := h₃ e' he' + exact (hin' (heq ▸ hp)).2 (hbv ▸ Dv.closure_subset_U heD (subset_closure hp)) + have harc : IsArcOn D.rad.G Dv F F₂ := ⟨fun h' ↦ hrA₂ (h' ▸ hb₂), hF₂s, h₁'.left, s.mem₂ _ hb₂, + hinner, hoff, fun e he ↦ (hF₂E e he).1⟩ + have hin : ∀ e ∈ F₂.edges, e ⊆ discInt Δv := by + refine (IsArcOn.side (D := D) harc hDv.1 hΔv hbv).resolve_right fun h₃ ↦ ?_ + obtain ⟨p, hp⟩ := (TieBreaker.mem_edges_E F₂ he').1 + exact disjoint_left.mp (h₃ e' he') hp (discInt_subset _ (hin' hp)) + obtain ⟨X₂, Z₂, hA₂⟩ := A₂.exists_append_of_mem hb₂ + have hb := hf.chord_bound s harc hin hA₁ hA₂ hC (fun e he ↦ h₁'.inF e he) fun e he ↦ by + rcases hcov e he with h₃ | h₃ | h₃ | h₃ + · exact .inl h₃ + · exact .inr (.inl (o₁ e h₃)) + · exact .inr (.inl (o₀ e h₃)) + · exact .inr (.inr h₃) + have hp₂ : X₂.length + 1 ≤ F₂.length := IsShape.parity_bound hf s.swap F₂ hA₂ + omega + +/-- The rest of the proof of (13.6): one arc `Q` ends at `r*`, and the other arc is one of the +remaining possibilities. -/ +theorem false_of_rstar (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) + (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁ A₂ T₁ T₂) {Y : Set Shat} (ha : D.IsAnchor H ρ Δv Dv F h f₁ + f₂ A₁ A₂ Y) + (hten : ∀ x ∈ A₁.support, x ∈ A₂.support → x ∉ F.V) {b a' b' : Shat} {Q : GraphWalk + D.rad.G.toGraph r b} {Q' : GraphWalk D.rad.G.toGraph a' b'} (hQ : IsArcOn D.rad.G Dv F Q) + (hQ' : IsArcOn D.rad.G Dv F Q') (o : ∀ e ∈ Q.edges, Disjoint e Δv) + (o' : ∀ e ∈ Q'.edges, Disjoint e Δv) (hd : ∀ e ∈ Q'.edges, e ∉ Q.edges) (hb : b ∈ A₁.support) + (hnp : ¬ PushesInto (Δ₀ \ {h}) (Δv \ {h}) (walkDrawing D.rad.G Q).U r b) (hnp' : ¬ PushesInto + (Δ₀ \ {h}) (Δv \ {h}) (walkDrawing D.rad.G Q').U a' b') + (n : (a' = r ∧ b' ∈ A₁.support) ∨ (a' = r ∧ b' ∈ A₂.support) ∨ (a' ∈ A₁.support + ∧ b' ∈ A₂.support) ∨ (a' ∈ A₂.support ∧ b' ∈ A₁.support)) : False := by + have hx := hf.enc + have hFs := hx.isInsOf_F.1.1 + rcases n with ⟨rfl, hb'⟩ | ⟨rfl, hb'⟩ | ⟨h₃, h₄⟩ | ⟨h₃, h₄⟩ + · -- Two arcs from `r*` to `A₁` would close up with `A₁`. + obtain ⟨Sg, -, hSg, -⟩ := s.exists_seg hx.isEnclave hb hb' (hQ.mem_F hFs _ Q.end_mem_support) + (hQ'.mem_F hFs _ Q'.end_mem_support) + have hJ : ∀ e, e ∈ (Sg.append Q'.reverse).edges ↔ e ∈ Sg.edges ∨ e ∈ Q'.edges := fun e ↦ by + rw [GraphWalk.edges_append, List.mem_append, GraphWalk.edges_reverse, List.mem_reverse] + refine hf.closing (P := Q) (J := Sg.append Q'.reverse) hQ.ne hQ.simple hQ.inF (fun e he ↦ ?_) + (fun e he ↦ ?_) fun e he ↦ ?_ + · rcases (hJ e).mp he with h' | h' + · exact (hSg e h').2 + · exact hQ'.inF e h' + · rcases (hJ e).mp he with h' | h' + · exact fun h₃ ↦ hQ.off e h₃ (s.edge₁ e (hSg e h').1) + · exact hd e h' + · rcases he with he | he + · exact .inr (o e he) + · rcases (hJ e).mp he with h' | h' + · exact .inl (s.edge₁ e (hSg e h').1) + · exact .inr (o' e h') + · -- Step (12): two arcs from `r*` to different spokes cannot both be part of `C`. + obtain ⟨X, Z, hA⟩ := A₁.exists_append_of_mem hb + obtain ⟨X', Z', hA'⟩ := A₂.exists_append_of_mem hb' + have hC₁ := hf.outer_circuit s ha hQ o hA hnp + have hC₂ := hf.outer_circuit s.swap ha.swap hQ' o' hA' hnp' + obtain ⟨e, he, -⟩ := GraphWalk.exists_edge_at_start Q' hQ'.ne + rcases (hC₁ e).mp ((hC₂ e).mpr (.inl he)) with h' | h' + · exact hd e he h' + · rw [GraphWalk.edges_cons, List.mem_cons] at h' + rcases h' with rfl | h' + · exact hQ'.off _ he s.f₁_mem + · exact hQ'.off e he (s.edge₁ e (by + rw [hA, GraphWalk.edges_append] + exact List.mem_append_left _ h')) + · exact hf.false_of_cross s ha hten hQ hQ' o o' hd hb h₃ h₄ hnp + · refine hf.false_of_cross s ha hten hQ (IsArcOn.reverse hQ') o (fun e he ↦ o' e ?_) + (fun e he ↦ hd e ?_) hb h₄ h₃ hnp + · rwa [GraphWalk.edges_reverse, List.mem_reverse] at he + · rwa [GraphWalk.edges_reverse, List.mem_reverse] at he + +/-- The two arcs of step (8), brought to normal form. -/ +theorem exists_normal_arcs (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) + (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁ A₂ T₁ T₂) : + ∃ (a₀ b₀ a₁ b₁ : Shat) (Q₀ : GraphWalk D.rad.G.toGraph a₀ b₀) (Q₁ : GraphWalk D.rad.G.toGraph + a₁ b₁), IsArcOn D.rad.G Dv F Q₀ ∧ IsArcOn D.rad.G Dv F Q₁ ∧ + (∀ e ∈ Q₀.edges, Disjoint e Δv) ∧ (∀ e ∈ Q₁.edges, Disjoint e Δv) ∧ + (∀ e ∈ Q₁.edges, e ∉ Q₀.edges) ∧ + ((a₀ = r ∧ (b₀ ∈ A₁.support ∨ b₀ ∈ A₂.support)) ∨ (a₀ ∈ A₁.support ∧ b₀ ∈ A₂.support)) ∧ ((a₁ + = r ∧ (b₁ ∈ A₁.support ∨ b₁ ∈ A₂.support)) ∨ (a₁ ∈ A₁.support ∧ b₁ ∈ A₂.support)) ∧ + ¬ PushesInto (Δ₀ \ {h}) (Δv \ {h}) (walkDrawing D.rad.G Q₀).U a₀ b₀ ∧ ¬ PushesInto (Δ₀ \ {h}) + (Δv \ {h}) (walkDrawing D.rad.G Q₁).U a₁ b₁ := by + have : ConnectedSpace Shat := cap.connected + have hx := hf.enc + have hFi := hx.isInsOf_F + have hFc := hFi.1 + have hDv := hx.sector.Dv_circuit + have hΔv := hx.sector.is_disc + have hbv := hx.sector.Dv_U.symm + have hhF : h ∉ F.U := fun hm ↦ hf.notMem_ins_F (Surface.discBd_subset _ (hFi.2.2.2.1 ▸ hm)) + obtain ⟨a₀, b₀, a₁, b₁, P₀, P₁, hP₀, hP₁, np₀, np₁, hne⟩ := exists_two_arcs (D + := D) hDv hFc hf.circuit hf.amb.disc hf.disc hf.sub hf.bd hf.mem_Δ hf.not_C hFi.2.2.1 + hf.amb.ins_F + hFi.2.2.2.1 hf.notMem_ins_F hΔv (hf.v_sub.trans hf.sub) hbv hf.mem_Dv_of_mem hf.edges + have outer : ∀ {a b : Shat} {P : GraphWalk D.rad.G.toGraph a b}, IsArcOn D.rad.G Dv F P + → ¬ PushesInto (Δ₀ \ {h}) (Δv \ {h}) (walkDrawing D.rad.G P).U a b + → ∀ e ∈ P.edges, Disjoint e Δv := by + intro a b P hP hn + refine (IsArcOn.side (D := D) hP hDv.1 hΔv hbv).resolve_left fun hin ↦ hn + (PushesInto.of_subset fun y hy ↦ ?_) + refine ⟨?_, fun h' ↦ hhF (h' ▸ IsArcOn.U_subset_F hP hFc.1 hy)⟩ + have hc : ∃ e ∈ P.edges, y ∈ closure e := by + rcases (mem_walkDrawing_U _ _).mp hy with h' | h' + · exact GraphWalk.exists_edge_of_support P hP.ne h' + · exact h' + obtain ⟨e, he, hye⟩ := hc + rw [← closure_discInt hΔv] + exact closure_mono (hin e he) hye + have hd₀ := IsArcOn.edges_disjoint hFc hP₀ hP₁ hne + have ho₀ := outer hP₀ np₀ + have ho₁ := outer hP₁ np₁ + obtain ⟨a₀', b₀', Q₀, hQ₀, hE₀, hS₀, hk₀, n₀⟩ := hf.normal_form s hP₀ ho₀ + obtain ⟨a₁', b₁', Q₁, hQ₁, hE₁, hS₁, hk₁, n₁⟩ := hf.normal_form s hP₁ ho₁ + have hU : ∀ {a b a' b' : Shat} {P : GraphWalk D.rad.G.toGraph a b} {Q : GraphWalk D.rad.G.toGraph + a' b'}, (∀ e, e ∈ Q.edges ↔ e ∈ P.edges) → (∀ x, x ∈ Q.support ↔ x ∈ P.support) → + (walkDrawing D.rad.G Q).U = (walkDrawing D.rad.G P).U := fun hE hS ↦ Subset.antisymm + (walkU_subset (fun x ↦ (hS x).mp) fun e ↦ (hE e).mp) (walkU_subset (fun x ↦ + (hS x).mpr) fun e ↦ (hE e).mpr) + refine ⟨a₀', b₀', a₁', b₁', Q₀, Q₁, hQ₀, hQ₁, fun e he ↦ ho₀ e ((hE₀ e).mp he), fun e he ↦ ho₁ e + ((hE₁ e).mp he), fun e he he' ↦ hd₀ e ((hE₁ e).mp he) ((hE₀ e).mp he'), n₀, n₁, ?_, ?_⟩ + · rw [hU hE₀ hS₀] + exact hk₀ _ np₀ + · rw [hU hE₁ hS₁] + exact hk₁ _ np₁ + +/-- One of the two arcs ends at `r*`, by step (9), and then `false_of_rstar` applies. -/ +theorem false_of_normal (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) + (s : D.IsShape W H r Δv Dv F f₁ f₂ A₁ A₂ T₁ T₂) {Y : Set Shat} (ha : D.IsAnchor H ρ Δv Dv F h f₁ + f₂ A₁ A₂ Y) + (hten : ∀ x ∈ A₁.support, x ∈ A₂.support → x ∉ F.V) {a₀ b₀ a₁ b₁ : Shat} {Q₀ : GraphWalk + D.rad.G.toGraph a₀ b₀} {Q₁ : GraphWalk D.rad.G.toGraph a₁ b₁} (h₀ : IsArcOn D.rad.G Dv F Q₀) + (h₁' : IsArcOn D.rad.G Dv F Q₁) (o₀ : ∀ e ∈ Q₀.edges, Disjoint e Δv) + (o₁ : ∀ e ∈ Q₁.edges, Disjoint e Δv) (hd : ∀ e ∈ Q₁.edges, e ∉ Q₀.edges) + (n₀ : (a₀ = r ∧ (b₀ ∈ A₁.support ∨ b₀ ∈ A₂.support)) ∨ (a₀ ∈ A₁.support ∧ b₀ ∈ A₂.support)) + (n₁ : (a₁ = r ∧ (b₁ ∈ A₁.support ∨ b₁ ∈ A₂.support)) ∨ (a₁ ∈ A₁.support ∧ b₁ ∈ A₂.support)) + (np₀ : ¬ PushesInto (Δ₀ \ {h}) (Δv \ {h}) (walkDrawing D.rad.G Q₀).U a₀ b₀) (np₁ : ¬ PushesInto + (Δ₀ \ {h}) (Δv \ {h}) (walkDrawing D.rad.G Q₁).U a₁ b₁) : False := by + have key : ∀ {a b a' b' : Shat} {Q : GraphWalk D.rad.G.toGraph a b} {Q' : GraphWalk + D.rad.G.toGraph a' b'}, IsArcOn D.rad.G Dv F Q → IsArcOn D.rad.G Dv F Q' → + (∀ e ∈ Q.edges, Disjoint e Δv) → + (∀ e ∈ Q'.edges, Disjoint e Δv) → (∀ e ∈ Q'.edges, e ∉ Q.edges) → a = r → (b ∈ A₁.support + ∨ b ∈ A₂.support) → ((a' = r ∧ (b' ∈ A₁.support ∨ b' ∈ A₂.support)) ∨ (a' ∈ A₁.support + ∧ b' ∈ A₂.support)) → + ¬ PushesInto (Δ₀ \ {h}) (Δv \ {h}) (walkDrawing D.rad.G Q).U a b → ¬ PushesInto (Δ₀ \ {h}) + (Δv \ {h}) (walkDrawing D.rad.G Q').U a' b' → False := by + intro a b a' b' Q Q' hQ hQ' o o' hdd ear hb n hn hn' + subst ear + rcases hb with hb | hb + · refine hf.false_of_rstar s ha hten hQ hQ' o o' hdd hb hn hn' ?_ + rcases n with ⟨h₃, h₄ | h₄⟩ | h₃ + · exact .inl ⟨h₃, h₄⟩ + · exact .inr (.inl ⟨h₃, h₄⟩) + · exact .inr (.inr (.inl h₃)) + · refine hf.false_of_rstar s.swap ha.swap (fun x h₃ h₄ ↦ hten x h₄ h₃) hQ hQ' o o' hdd hb hn + hn' ?_ + rcases n with ⟨h₃, h₄ | h₄⟩ | h₃ + · exact .inr (.inl ⟨h₃, h₄⟩) + · exact .inl ⟨h₃, h₄⟩ + · exact .inr (.inr (.inr h₃)) + rcases n₁ with ⟨e₁, hb₁⟩ | hc₁ + · exact key h₁' h₀ o₁ o₀ (fun e he he' ↦ hd e he' he) e₁ hb₁ n₀ np₁ np₀ + · rcases n₀ with ⟨e₀, hb₀⟩ | hc₀ + · exact key h₀ h₁' o₀ o₁ hd e₀ hb₀ (.inr hc₁) np₀ np₁ + · exact hf.not_cross s h₀ h₁' o₀ o₁ hd hc₀.1 hc₁.1 hc₀.2 hc₁.2 + +/-- Steps (7) to (14) of the proof of (13.6): `h` cannot lie far inside `Δ`. -/ +theorem false_of_far (hf : D.IsFar W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ h) : False := by + rcases hf.shape_cases with ⟨v₁, v₂, u, h', f₁, f₂, A₁, A₂, T, s, hfan, -⟩ | ⟨v₁, v₂, h₁, h₂, f₁, + f₂, K₁, K₂, P, s, hdis, hP, hE, hc, hsub⟩ + · obtain ⟨a₀, b₀, a₁, b₁, Q₀, Q₁, h₀, h₁', o₀, o₁, hd, n₀, n₁, np₀, np₁⟩ + := hf.exists_normal_arcs s + have hTF : ∀ x ∈ T.support, x ∉ F.V := fun x hx ↦ hf.off_tail s hfan h₀ h₁' o₀ o₁ hd n₀ n₁ hx + refine hf.false_of_normal s (hf.fan_anchor s hfan hTF) (fun x h₃ h₄ ↦ ?_) h₀ h₁' o₀ o₁ hd n₀ n₁ + np₀ np₁ + have hxu := (s.meet x h₃ h₄).1 + exact hTF x (hxu ▸ T.start_mem_support) + · obtain ⟨a₀, b₀, a₁, b₁, Q₀, Q₁, h₀, h₁', o₀, o₁, hd, n₀, n₁, np₀, np₁⟩ + := hf.exists_normal_arcs s + have hne : h₁ ≠ h₂ := fun h₃ ↦ hdis h₁ K₁.end_mem_support (h₃ ▸ K₂.end_mem_support) + obtain ⟨Y, ha⟩ := hf.path_anchor s hne hP hsub + exact hf.false_of_normal s ha (fun x h₃ h₄ ↦ absurd h₄ (hdis x h₃)) h₀ h₁' o₀ o₁ hd n₀ n₁ np₀ + np₁ + +end IsFar + +/-- `Δ_v` lies in the ambient disc, because its boundary does. -/ +theorem IsSectorEnclave.Δv_subset (hx : D.IsSectorEnclave W H ρ r Δv Dv ord' 𝒯' F) + (ham : D.IsAmbientDisc W H ρ F Δ₀) : Δv ⊆ Δ₀ := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hW := hx.wheel + have hcl : IsClosed Δ₀ := ham.disc.isClosed + have hclB : ∀ {f : Set Shat}, f ⊆ discBd W → closure f ⊆ Δ₀ := fun hf ↦ closure_minimal + (hf.trans ham.bd_W) hcl + have hU : Dv.U ⊆ Δ₀ := by + rcases hx.sector.cases hW hx.hbdS hx.hin with ⟨v₁, v₂, u, h, f₁, f₂, A₁, A₂, T, hf, hC, hb₁, + hb₂⟩ | + ⟨v₁, v₂, h₁, h₂, f₁, f₂, K₁, K₂, P, hne, hl₁, hl₂, hb₁, hb₂, h1, h2, hdis, hP, hbd, -⟩ + · rw [hf.U_eq hC] + refine union_subset (union_subset (union_subset ?_ ?_) (hclB hb₁)) (hclB hb₂) + · refine Subset.trans ?_ (ham.spoke _ _ _ hf.spoke₁) + refine walkU_subset (fun x hx' ↦ (GraphWalk.mem_support_append _ _).mpr (.inl hx')) ?_ + intro e he + rw [GraphWalk.edges_append] + exact List.mem_append_left _ he + · refine Subset.trans ?_ (ham.spoke _ _ _ hf.spoke₂) + refine walkU_subset (fun x hx' ↦ (GraphWalk.mem_support_append _ _).mpr (.inl hx')) ?_ + intro e he + rw [GraphWalk.edges_append] + exact List.mem_append_left _ he + · rw [hx.sector.Dv_U, hbd] + exact union_subset (union_subset (union_subset (union_subset (ham.spoke _ _ _ h1) + (ham.spoke _ _ _ h2)) (hP.1.U_subset.trans ham.hub)) (hclB hb₁)) (hclB hb₂) + have h' := ham.short Dv hx.sector.Dv_circuit hx.Dv_card hU + rwa [hx.ins_Dv] at h' + +/-- (13.6): the choice of the enclave `F` puts its inside in `Δ_v`. -/ +theorem theorem_13_6_proof (hx : D.IsSectorEnclave W H ρ r Δv Dv ord' 𝒯' F) : D.ins F ⊆ Δv := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hFi := hx.isInsOf_F + have hDv := hx.sector.Dv_circuit + have hΔv := hx.sector.is_disc + obtain ⟨Δ₀, ham⟩ := hx.exists_ambient + obtain ⟨c, hc, h₁, h₂⟩ := hx.exists_edge + obtain ⟨p, hp⟩ := hc.1 + obtain ⟨C, Δ, hC, hE, hΔ, hsub, hbd, hF, hv⟩ := exists_enclosing_circuit hT ham.disc hFi.1 hDv + hFi.2.2.1 hΔv ham.ins_F (hx.Δv_subset ham) hFi.2.2.2.1 hx.sector.Dv_U.symm + ⟨cap.emb p, h₁ ⟨p, hp, rfl⟩, h₂ ⟨p, hp, rfl⟩⟩ D.edge_two_ends + have hr : D.IsRound W H ρ r Δv Dv ord' 𝒯' F Δ₀ C Δ := ⟨hx, ham, hC, hE, hΔ, hsub, hbd, hF, hv⟩ + by_cases hh : H.U ∩ Δ ⊆ C.U + · exact hr.step_six hh + · obtain ⟨h, hf⟩ := hr.exists_far hh + exact hf.false_of_far.elim + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13y.lean b/LeanPool/GraphMinor/GM19/Section13y.lean new file mode 100644 index 0000000000..33cbb77e1e --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13y.lean @@ -0,0 +1,165 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13x + +/-! +# Graph Minors XIX, Section 13: tools for (13.7) + +The proof of (13.7) applies Graph Minors VI, (3.6), to `sk(Γ)` inside a closed disc. Here we cut a +drawing down to a closed set whose frontier it meets only in vertices, and find the +vertex of a walk at a given position. We also show that two vertices on the closure of a cell of +size 3 have a common region. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- The vertex of a walk at position `p`. -/ +noncomputable def GraphWalk.vertexAt {G : Drawing Shat} {a b : Shat} (K : GraphWalk G.toGraph a b) + (p : ℕ) : Shat := K.support.getD p b + +omit [T2Space Shat] in +/-- A walk splits at each position. -/ +theorem GraphWalk.exists_split_at {G : Drawing Shat} {a b : Shat} (K : GraphWalk G.toGraph a b) {p + : ℕ} (hp : p ≤ K.length) : + ∃ (P : GraphWalk G.toGraph a (GraphWalk.vertexAt K p)) (Q : GraphWalk G.toGraph + (GraphWalk.vertexAt K p) b), K = P.append Q ∧ P.length = p := by + induction K generalizing p with + | nil h => + have : p = 0 := by simpa [GraphWalk.length] using hp + subst this + exact ⟨.nil h, .nil h, rfl, rfl⟩ + | @cons a y b e hl t ih => + cases p with + | zero => exact ⟨.nil (GraphWalk.mem_vertexSet_of_mem_support _ (GraphWalk.start_mem_support + (.cons hl t))), .cons hl t, rfl, rfl⟩ + | succ p => + obtain ⟨P, Q, h₁, h₂⟩ := ih (p := p) (by simpa [GraphWalk.length] using hp) + have hv : GraphWalk.vertexAt (.cons hl t) (p + 1) = GraphWalk.vertexAt t p := by + simp [GraphWalk.vertexAt, GraphWalk.support] + rw [hv] + refine ⟨.cons hl P, Q, congrArg (GraphWalk.cons hl) h₁, ?_⟩ + simp only [GraphWalk.length, GraphWalk.edges_cons, List.length_cons] + simp only [GraphWalk.length] at h₂ + omega + +omit [T2Space Shat] in +/-- The vertex of `P.append Q` at the length of `P` is the end of `P`. -/ +theorem GraphWalk.vertexAt_append {G : Drawing Shat} {a b c : Shat} (P : GraphWalk G.toGraph a b) + (Q : GraphWalk G.toGraph b c) : GraphWalk.vertexAt (P.append Q) P.length = b := by + induction P with + | nil h => + cases Q <;> simp [GraphWalk.vertexAt, GraphWalk.length, GraphWalk.append] + | @cons a y b e hl t ih => + have := ih Q + simpa [GraphWalk.vertexAt, GraphWalk.support, GraphWalk.length, GraphWalk.append] using this + +/-- A drawing, cut down to a closed set whose frontier it meets only in vertices. -/ +theorem exists_restrict {T : Type} [TopologicalSpace T] (D : Drawing T) {Y : Set T} + (hY : IsClosed Y) (hfr : D.U ∩ frontier Y ⊆ D.V) : + ∃ D' : Drawing T, D'.U = D.U ∩ Y ∧ D'.V = D.V ∩ Y ∧ ∀ e, e ∈ D'.E ↔ e ∈ D.E ∧ e ⊆ Y := by + have hside : ∀ e ∈ D.E, e ⊆ Y ∨ Disjoint e Y := fun e he ↦ + subset_or_disjoint_of_frontier hY he.2.2.1.isConnected.isPreconnected + (disjoint_left.mpr fun x hx hxf ↦ (he.2.1 hx).2 (hfr ⟨(he.2.1 hx).1, hxf⟩)) + have hset : (D.U ∩ Y) \ (D.V ∩ Y) = (D.U \ D.V) ∩ Y := by + ext x + constructor + · rintro ⟨⟨h₁, h₂⟩, h₃⟩ + exact ⟨⟨h₁, fun h₄ ↦ h₃ ⟨h₄, h₂⟩⟩, h₂⟩ + · rintro ⟨⟨h₁, h₃⟩, h₂⟩ + exact ⟨⟨h₁, h₂⟩, fun h₄ ↦ h₃ h₄.1⟩ + have hA : ∀ C, C ∈ arcComponentsIn ((D.U ∩ Y) \ (D.V ∩ Y)) ↔ C ∈ D.E ∧ C ⊆ Y := fun C ↦ by + rw [hset] + constructor + · intro hC + obtain ⟨x, hx⟩ := hC.1 + have hxF := hC.2.1 hx + obtain ⟨e, he, hxe⟩ := exists_mem_arcComponent (F := D.U \ D.V) hxF.1 + have heC : C ⊆ e := by + have hu := he.2.2.2 _ (union_subset he.2.1 fun y hy ↦ (hC.2.1 hy).1) + (he.2.2.1.union hC.2.2.1 ⟨x, hxe, hx⟩) subset_union_left + exact hu ▸ subset_union_right + have heY : e ⊆ Y := (hside e he).resolve_right fun hd ↦ disjoint_left.mp hd hxe hxF.2 + have := hC.2.2.2 e (fun y hy ↦ ⟨he.2.1 hy, heY hy⟩) he.2.2.1 heC + exact ⟨this ▸ he, this ▸ heY⟩ + · rintro ⟨he, hY'⟩ + exact ⟨he.1, fun y hy ↦ ⟨he.2.1 hy, hY' hy⟩, he.2.2.1, fun X hX hc hs ↦ he.2.2.2 X + (fun y hy ↦ (hX hy).1) hc hs⟩ + have hE : ∀ e ∈ arcComponentsIn ((D.U ∩ Y) \ (D.V ∩ Y)), (∃ u v : T, u ≠ v ∧ closure e ∩ + (D.V ∩ Y) = {u, v} ∧ IsLineWithEnds (closure e) u v) ∨ + (∃ u : T, closure e ∩ (D.V ∩ Y) = {u} ∧ IsOArc (closure e)) := fun e he ↦ ?_ + · exact ⟨⟨D.U ∩ Y, D.V ∩ Y, fun x hx ↦ ⟨D.V_subset_U hx.1, hx.2⟩, D.isClosed_U.inter hY, + D.finite_V.subset inter_subset_left, D.finite_edges.subset fun e he ↦ + ((hA e).mp he).1, hE⟩, rfl, rfl, hA⟩ + obtain ⟨he₁, he₂⟩ := (hA e).mp he + have hcl : closure e ∩ (D.V ∩ Y) = closure e ∩ D.V := by + ext x + exact ⟨fun h ↦ ⟨h.1, h.2.1⟩, fun h ↦ ⟨h.1, h.2, closure_minimal he₂ hY h.1⟩⟩ + rw [hcl] + exact D.edge_cond e he₁ + +/-- Two ends of an edge of size 3 are on the closure of one side of the edge. -/ +theorem Painting.exists_side_of_ends (Γ : Painting S) {c : Set S} (hc : c ∈ Γ.E) (h3 : + (tilde c).ncard = 3) {a b : S} (ha : a ∈ tilde c) (hb : b ∈ tilde c) (hab : a ≠ b) : + ∃ f, Γ.IsSkEdgeIn f c ∧ a ∈ closure f ∧ b ∈ closure f := by + obtain ⟨hdisc, hT, hfin⟩ := Γ.isDisc_of_three hc h3 + have hO := hdisc.isOArc_discBd + obtain ⟨d, hda, hdb, hd⟩ : ∃ d, d ≠ a ∧ d ≠ b ∧ d ∈ tilde c := by + by_contra hn + push Not at hn + have hsub : tilde c ⊆ {a, b} := fun d hd ↦ by + by_cases h₁ : d = a + · exact .inl h₁ + · exact .inr (by_contra fun h₂ ↦ hn d h₁ h₂ hd) + have := Set.ncard_le_ncard hsub (by simp) + rw [h3, Set.ncard_pair hab] at this + omega + obtain ⟨A, B, hA, hB, hun, hin⟩ := hO.lines (hT ha) (hT hb) hab + obtain ⟨L, hL, hdL⟩ : ∃ L, IsLineWithEnds L a b ∧ L ⊆ discBd (closure c) ∧ d ∉ L := by + by_cases hdA : d ∈ A + · refine ⟨B, hB, hun ▸ subset_union_right, fun hdB ↦ ?_⟩ + have : d ∈ A ∩ B := ⟨hdA, hdB⟩ + rw [hin] at this + rcases this with h | h + · exact hda h + · exact hdb h + · exact ⟨A, hA, hun ▸ subset_union_left, hdA⟩ + have hpc : IsPathConnected (L \ {a, b}) := GM11.isPathConnected_sdiff_pair hL + obtain ⟨p, hp⟩ := hpc.nonempty + have hsub : L \ {a, b} ⊆ discBd (closure c) \ tilde c := fun x hx ↦ ⟨hdL.1 hx.1, fun ht ↦ by + have heq : ({a, b, d} : Set S) = tilde c := Set.eq_of_subset_of_ncard_le (by + rintro y (rfl | rfl | rfl) + · exact ha + · exact hb + · exact hd) (by + rw [h3, Set.ncard_insert_of_notMem (by simp [hab, hda.symm]), Set.ncard_pair hdb.symm]) hfin + rw [← heq] at ht + rcases ht with rfl | rfl | rfl + · exact hx.2 (.inl rfl) + · exact hx.2 (.inr rfl) + · exact hdL.2 hx.1⟩ + obtain ⟨f, hf, hpf⟩ := exists_mem_arcComponent (hsub hp) + have hLf : L \ {a, b} ⊆ f := by + have hu := hf.2.2.2 _ (union_subset hf.2.1 hsub) (hf.2.2.1.union hpc ⟨p, hpf, hp⟩) + subset_union_left + exact hu ▸ subset_union_right + have hcl : L ⊆ closure f := hL.subset_closure_diff.trans (closure_mono hLf) + exact ⟨f, ⟨hc, .inr ⟨h3, hf⟩⟩, hcl hL.left_mem, hcl hL.right_mem⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13z.lean b/LeanPool/GraphMinor/GM19/Section13z.lean new file mode 100644 index 0000000000..20f71a04c6 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13z.lean @@ -0,0 +1,163 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13y + +/-! +# Graph Minors XIX, Section 13: `sk(Γ)` in a closed disc + +Let `Δ` be a closed disc whose boundary lies in `Γ*`. The part of `sk(Γ)` in `Δ` is a proper drawing +on `Δ`, and this is the drawing to which we apply VI (3.6) in the proof of (13.7). A region of +this drawing lies in a region of `Γ` or in a cell. So two vertices on its closure are joined by a +walk of `Γ*` with at most two edges. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +/-- The part of `sk(Γ)` in `Δ`, as a drawing on `Δ`. -/ +structure IsSkPart (D : TangleDatum cap χ) (Δ : Set Shat) (Sk : Drawing Shat) + (G : Drawing Δ) : Prop where + sk : IsSkHat cap D.P.Γ Sk + mem_U : ∀ z : Δ, z ∈ G.U ↔ z.1 ∈ Sk.U + mem_V : ∀ z : Δ, z ∈ G.V ↔ z.1 ∈ D.P.Γ.hatV cap + proper : G.IsProper + link : ∀ e (x y : Δ), G.toGraph.IsLink e x y → x = y ∨ ∃ a b, cap.emb a = x.1 ∧ cap.emb b = y.1 + ∧ D.P.Γ.skAdj.Adj a b + +variable {D : TangleDatum cap χ} {Δ : Set Shat} {Sk : Drawing Shat} {G : Drawing Δ} + +theorem exists_isSkPart (D : TangleDatum cap χ) (hΔ : IsClosedDisc Δ) + (hbd : discBd Δ ⊆ D.rad.G.U) : ∃ Sk G, D.IsSkPart Δ Sk G := by + classical + have hS := χ.isSurface + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + obtain ⟨Sk, hSk⟩ := exists_isSkHat hS cap D.P.Γ + have hcl : IsClosed Δ := hΔ.isClosed + have hsub : Sk.U ⊆ D.P.Γ.hatU cap := by + rw [hSk.hU] + exact image_mono D.P.Γ.skU_subset + have hrad : ∀ x ∈ Sk.U, x ∈ D.rad.G.U → x ∈ D.P.Γ.hatV cap := fun x h₁ h₂ ↦ by + rw [← D.rad.isPreRadial.1] + exact ⟨hsub h₁, h₂⟩ + obtain ⟨D', hU', hV', hE'⟩ := exists_restrict Sk hcl (fun x hx ↦ by + have hx₂ := hx.2 + rw [IsClosedDisc.frontier_eq_discBd hT hΔ] at hx₂ + rw [hSk.hV] + exact hrad x hx.1 (hbd hx₂)) + have hj : IsClosedEmbedding (Subtype.val : Δ → Shat) := hcl.isClosedEmbedding_subtypeVal + have : Nonempty Δ := (hΔ.nonempty_discInt.mono (discInt_subset _)).to_subtype + have hP : D'.U ⊆ range (Subtype.val : Δ → Shat) := fun x hx ↦ by + rw [hU'] at hx + exact ⟨⟨x, hx.2⟩, rfl⟩ + refine ⟨Sk, D'.comap hj hP, hSk, fun z ↦ ?_, fun z ↦ ?_, ?_, ?_⟩ + · change z.1 ∈ D'.U ↔ _ + rw [hU'] + exact ⟨fun h ↦ h.1, fun h ↦ ⟨h, z.2⟩⟩ + · change z.1 ∈ D'.V ↔ _ + rw [hV', hSk.hV] + exact ⟨fun h ↦ h.1, fun h ↦ ⟨h, z.2⟩⟩ + · rintro z ⟨hz₁, hz₂⟩ + have hb : z.1 ∈ discBd Δ := ⟨z, hz₁, rfl⟩ + change z.1 ∈ D'.U at hz₂ + rw [hU'] at hz₂ + change z.1 ∈ D'.V + rw [hV', hSk.hV] + exact ⟨hrad _ hz₂.1 (hbd hb), z.2⟩ + · intro e x y hl + by_cases hxy : x = y + · exact .inl hxy + right + obtain ⟨he, hx, hy, hc⟩ := hl + have heE : Subtype.val '' e ∈ arcComponentsIn (D'.U \ D'.V) := by + rw [arcs_comap hj hP] + exact mem_image_of_mem _ he + obtain ⟨heS, -⟩ := (hE' _).mp heE + obtain ⟨f, hf, hfe⟩ := hSk.edge_iff.mp heS + obtain ⟨c, hc'⟩ := D.P.Γ.exists_isSkEdgeIn hf + have hmem : ∀ z : Δ, z ∈ closure e → z ∈ (D'.comap hj hP).V → ∃ a, cap.emb a = z.1 + ∧ a ∈ D.P.Γ.V ∧ a ∈ tilde c := fun z hz hzV ↦ by + have hz₁ : z.1 ∈ D'.V := hzV + rw [hV', hSk.hV] at hz₁ + obtain ⟨a, ha, haz⟩ := hz₁.1 + have hzcl : z.1 ∈ closure (Subtype.val '' e) := by + rw [hj.closure_image_eq] + exact mem_image_of_mem _ hz + rw [← hfe, (cap.isClosedEmbedding hS).closure_image_eq] at hzcl + obtain ⟨a', ha', haz'⟩ := hzcl + have haa : a' = a := (cap.isClosedEmbedding hS).injective (haz'.trans haz.symm) + subst haa + exact ⟨a', haz, ha, closure_mono hc'.subset ha', fun hn ↦ D.P.Γ.disjoint_V hc'.1 hn ha⟩ + have hxm : x ∈ closure e ∩ (D'.comap hj hP).V := by rw [hc]; exact .inl rfl + have hym : y ∈ closure e ∩ (D'.comap hj hP).V := by rw [hc]; exact .inr rfl + obtain ⟨a, ha₁, ha₂, ha₃⟩ := hmem x hxm.1 hxm.2 + obtain ⟨b, hb₁, hb₂, hb₃⟩ := hmem y hym.1 hym.2 + refine ⟨a, b, ha₁, hb₁, fun hab ↦ hxy (Subtype.ext ?_), ha₂, hb₂, c, hc'.1, ha₃, hb₃⟩ + rw [← ha₁, ← hb₁, hab] + +omit [T2Space S] [T2Space Shat] in +/-- A region of the part of `sk(Γ)` in `Δ` lies in a region of `sk(Γ)`. -/ +theorem IsSkPart.exists_region (h : D.IsSkPart Δ Sk G) {R : Set Δ} (hR : R ∈ G.R) : ∃ q ∈ Sk.R, + Subtype.val '' R ⊆ q := by + obtain ⟨y, hy, rfl⟩ := (mem_R_iff G).mp hR + have hyR : y ∈ connectedComponentIn (univ \ G.U) y := mem_connectedComponentIn ⟨mem_univ _, hy⟩ + have hoff : y.1 ∉ Sk.U := fun hn ↦ hy ((h.mem_U y).mpr hn) + obtain ⟨q, hq, hyq⟩ := exists_region_of_notMem hoff + refine ⟨q, hq, subset_region hq (isPreconnected_connectedComponentIn.image _ + continuous_subtype_val.continuousOn) ?_ (mem_image_of_mem _ hyR) hyq⟩ + refine disjoint_left.mpr ?_ + rintro _ ⟨z, hz, rfl⟩ hzU + exact (connectedComponentIn_subset _ _ hz).2 ((h.mem_U z).mpr hzU) + +omit [T2Space Shat] in +/-- A vertex of `Γ` on the closure of a region of `Γ` is a neighbour of the vertex of `Γ*` in that +region. -/ +theorem exists_link_of_closure (D : TangleDatum cap χ) {w : Shat} (hw : w ∈ D.rad.Rstar) {v : S} + (hv : v ∈ D.P.Γ.V) (hcl : cap.emb v ∈ closure (D.rad.regionOf w)) : + ∃ e, D.rad.G.toGraph.IsLink e w (cap.emb v) := by + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + obtain ⟨e, he, hc⟩ := D.rad.exists_spoke hS (h3.hatRegions_isOpenDisc hS cap) h3.1 hw hv hcl + exact ⟨e, he, hw.1, D.rad.isPreRadial.2.1 (mem_image_of_mem _ hv), by rw [hc, Set.pair_comm]⟩ + +omit [T2Space Shat] in +/-- Two vertices of `Γ` on the closure of a region of `Γ` are at most two steps apart in `Γ*`. -/ +theorem exists_walk_of_hatRegion (D : TangleDatum cap χ) {q : Set Shat} + (hq : q ∈ D.P.Γ.hatRegions cap) {a b : S} (ha : a ∈ D.P.Γ.V) (hb : b ∈ D.P.Γ.V) + (hca : cap.emb a ∈ closure q) + (hcb : cap.emb b ∈ closure q) : ∃ K : GraphWalk D.rad.G.toGraph (cap.emb a) + (cap.emb b), K.length ≤ 2 := by + obtain ⟨w, ⟨hw, hwG⟩, -⟩ := D.rad.isPreRadial.2.2.1 q hq + have hwU : w ∉ D.P.Γ.hatU cap := by + obtain ⟨y, hy, rfl⟩ := hq + exact connectedComponentIn_subset _ _ hw + have hwR : w ∈ D.rad.Rstar := ⟨hwG, fun hn ↦ hwU (image_mono D.P.Γ.V_subset hn)⟩ + have hreg : D.rad.regionOf w = q := by + obtain ⟨y, hy, rfl⟩ := id hq + exact (connectedComponentIn_eq hw).symm + obtain ⟨e₁, h₁⟩ := D.exists_link_of_closure hwR ha (hreg ▸ hca) + obtain ⟨e₂, h₂⟩ := D.exists_link_of_closure hwR hb (hreg ▸ hcb) + have hnil : cap.emb b ∈ D.rad.G.toGraph.vertexSet := h₂.2.2.1 + exact ⟨.cons h₁.symm (.cons h₂ (.nil hnil)), by simp [GraphWalk.length]⟩ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13za.lean b/LeanPool/GraphMinor/GM19/Section13za.lean new file mode 100644 index 0000000000..ad6bbdab6a --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13za.lean @@ -0,0 +1,247 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13z + +/-! +# Graph Minors XIX, Section 13: from chains to walks of `Γ*` + +An `(x, y)`-chain of the part of `sk(Γ)` in `Δ` gives a walk of `Γ*`. Each region in the chain costs +two edges of `Γ*`, and this is where the bound of (13.7) comes from. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM06 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {Δ : Set Shat} {Sk : Drawing Shat} {G : Drawing Δ} + +/-- Two vertices on the closure of a region of the part of `sk(Γ)` in `Δ` are at most two steps +apart in `Γ*`. -/ +theorem IsSkPart.exists_walk (h : D.IsSkPart Δ Sk G) {R : Set Δ} (hR : R ∈ G.R) {z₁ z₂ : Δ} + (hz₁ : z₁ ∈ G.V) (hz₂ : z₂ ∈ G.V) (c₁ : z₁ ∈ closure R) (c₂ : z₂ ∈ closure R) : + ∃ K : GraphWalk D.rad.G.toGraph z₁.1 z₂.1, K.length ≤ 2 := by + have hS := χ.isSurface + have hΓ := cap.isClosedEmbedding hS + obtain ⟨q, hq, hRq⟩ := h.exists_region hR + have hcl : ∀ {z : Δ}, z ∈ closure R → z.1 ∈ closure q := fun hz ↦ + closure_mono hRq (map_mem_closure continuous_subtype_val hz fun x hx ↦ mem_image_of_mem _ hx) + rcases z₁ with ⟨x₁, hx₁⟩ + rcases z₂ with ⟨x₂, hx₂⟩ + obtain ⟨a, ha, rfl⟩ := (h.mem_V _).mp hz₁ + obtain ⟨b, hb, rfl⟩ := (h.mem_V _).mp hz₂ + have hca := hcl c₁ + have hcb := hcl c₂ + rcases h.sk.region_cases hq with hq' | ⟨c, hc, h3, hsub⟩ + · exact D.exists_walk_of_hatRegion hq' ha hb hca hcb + have hc' : IsClosed (cap.emb '' closure c) := hΓ.isClosedMap _ isClosed_closure + have hin : ∀ {a : S}, a ∈ D.P.Γ.V → cap.emb a ∈ closure q → a ∈ tilde c := fun ha hcq ↦ by + obtain ⟨a', ha', hae⟩ := closure_minimal hsub hc' hcq + have := hΓ.injective hae + subst this + exact ⟨ha', fun hn ↦ D.P.Γ.disjoint_V hc hn ha⟩ + by_cases hab : a = b + · subst hab + exact ⟨.nil (D.rad.isPreRadial.2.1 (mem_image_of_mem _ ha)), by simp [GraphWalk.length, + GraphWalk.edges]⟩ + obtain ⟨f, hf, h₁, h₂⟩ := D.P.Γ.exists_side_of_ends hc h3 (hin ha hca) (hin hb hcb) hab + obtain ⟨r, hr, hfr⟩ := h.sk.exists_hatRegion_side hS hf h3 + have hclf : ∀ {a : S}, a ∈ closure f → cap.emb a ∈ closure r := fun hm ↦ + closure_minimal hfr isClosed_closure (hΓ.closure_image_eq f ▸ mem_image_of_mem _ hm) + exact D.exists_walk_of_hatRegion hr ha hb (hclf h₁) (hclf h₂) + +omit [T2Space S] [T2Space Shat] in +theorem IsSkPart.region_eq (h : D.IsSkPart Δ Sk G) {R : Set Δ} (hR : R ∈ G.R) {x : Δ} + (hx : x ∈ R) {w : Shat} (hxw : x.1 ∈ D.rad.regionOf w) : + ∃ q ∈ Sk.R, Subtype.val '' R ⊆ q ∧ q = D.rad.regionOf w := by + have hS := χ.isSurface + obtain ⟨q, hq, hRq⟩ := h.exists_region hR + refine ⟨q, hq, hRq, ?_⟩ + have hxq := hRq (mem_image_of_mem _ hx) + have hxU : x.1 ∉ D.P.Γ.hatU cap := connectedComponentIn_subset _ _ hxw + rcases h.sk.region_cases hq with ⟨y, hy, rfl⟩ | ⟨c, hc, h3, hsub⟩ + · exact (connectedComponentIn_eq hxq).trans (connectedComponentIn_eq hxw).symm + · obtain ⟨p, hp, hpe⟩ := hsub hxq + exact absurd ⟨p, D.P.Γ.closure_subset_U hc hp, hpe⟩ hxU + +omit [T2Space Shat] in +/-- A vertex on the closure of a region of the part of `sk(Γ)` is a neighbour of the centre of the +region of `Γ` that holds it. -/ +theorem IsSkPart.exists_center_walk (h : D.IsSkPart Δ Sk G) {R : Set Δ} (hR : R ∈ G.R) {x : Δ} + (hx : x ∈ R) {w : Shat} (hw : w ∈ D.rad.Rstar) (hxw : x.1 ∈ D.rad.regionOf w) {z : Δ} + (hz : z ∈ G.V) (c : z ∈ closure R) : ∃ K : GraphWalk D.rad.G.toGraph w z.1, K.length ≤ 1 := by + obtain ⟨q, -, hRq, rfl⟩ := h.region_eq hR hx hxw + rcases z with ⟨y, hy⟩ + obtain ⟨v, hv, rfl⟩ := (h.mem_V _).mp hz + have hc : cap.emb v ∈ closure (D.rad.regionOf w) := closure_mono hRq (map_mem_closure (f + := Subtype.val) continuous_subtype_val c fun x hx ↦ mem_image_of_mem _ hx) + obtain ⟨e, hl⟩ := D.exists_link_of_closure hw hv hc + exact ⟨.cons hl (.nil hl.2.2.1), by simp [GraphWalk.length, GraphWalk.edges]⟩ + +omit [T2Space Shat] in +omit [T2Space S] in +/-- A region of `Γ` has only one centre. -/ +theorem center_unique (D : TangleDatum cap χ) {w w' : Shat} (hw : w ∈ D.rad.Rstar) + (hw' : w' ∈ D.rad.Rstar) (he : D.rad.regionOf w = D.rad.regionOf w') : w = w' := by + obtain ⟨hr, hm⟩ := D.rad.regionOf_mem hw + obtain ⟨-, hm'⟩ := D.rad.regionOf_mem hw' + exact (D.rad.isPreRadial.2.2.1 _ hr).unique ⟨hm, hw.1⟩ ⟨he ▸ hm', hw'.1⟩ + + +/-- How a point `x` sits on a vertex `z` of `Γ*`: it is `z`, a vertex of `Γ`, with `a = 0`, or it +lies in the region of `Γ` with centre `z`, with `a = 1`. -/ +def IsCenteredOn (D : TangleDatum cap χ) (x z : Shat) (a : ℕ) : Prop := + (a = 0 ∧ x = z ∧ z ∈ D.P.Γ.hatV cap) ∨ (a = 1 ∧ z ∈ D.rad.Rstar ∧ x ∈ D.rad.regionOf z) + +omit [T2Space S] [T2Space Shat] in +theorem notMem_hatV_of_region (D : TangleDatum cap χ) {x w : Shat} (hx : x ∈ D.rad.regionOf w) : x + ∉ D.P.Γ.hatV cap := fun hn ↦ + (connectedComponentIn_subset _ _ hx) (image_mono D.P.Γ.V_subset hn) + +theorem chainLength_inl {T : Type} (v : T) (A : List (ChainTerm T)) : chainLength (Sum.inl v :: A) + = chainLength A + 1 := rfl + +theorem chainLength_inr {T : Type} (R : Set T) (A : List (ChainTerm T)) : chainLength + (Sum.inr R :: A) = chainLength A := rfl + +theorem chainLength_nil {T : Type} : chainLength ([] : List (ChainTerm T)) = 0 := rfl + +theorem chain_from_vertex (h : D.IsSkPart Δ Sk G) {y : Δ} {z : Shat} {b : ℕ} + (hy : D.IsCenteredOn y.1 z b) (A : List (ChainTerm Δ)) (v : Δ) (hc : (Sum.inl v :: A).IsChain + (ChainTerm.AreIncident G)) + (hv : v ∈ G.V) (hl : ChainTerm.MatchesEnd y ((Sum.inl v :: A).getLast (by simp))) : + ∃ K : GraphWalk D.rad.G.toGraph v.1 z, K.length + 2 ≤ 2 * chainLength (Sum.inl v :: A) + b := by + induction hn : A.length using Nat.strong_induction_on generalizing A v with + | _ n ih => + cases A with + | nil => + have hvy : v = y := hl + subst hvy + rcases hy with ⟨rfl, hm, hz⟩ | ⟨-, -, hm⟩ + · subst hm + refine ⟨.nil (D.rad.isPreRadial.2.1 hz), ?_⟩ + rw [chainLength_inl, chainLength_nil] + simp [GraphWalk.length, GraphWalk.edges] + · exact absurd ((h.mem_V _).mp hv) (D.notMem_hatV_of_region hm) + | cons t A => + cases t with + | inl u => + rw [List.isChain_cons_cons] at hc + exact hc.1.elim + | inr R => + rw [List.isChain_cons_cons] at hc + obtain ⟨⟨-, hR, hvR⟩, hc'⟩ := hc + cases A with + | nil => + have hyR : y ∈ R := by simpa [ChainTerm.MatchesEnd] using hl + rcases hy with ⟨-, hm, hz⟩ | ⟨rfl, hw, hm⟩ + · exfalso + have hyV : y ∈ G.V := (h.mem_V _).mpr (hm ▸ hz) + obtain ⟨p, hp, rfl⟩ := (mem_R_iff G).mp hR + exact (connectedComponentIn_subset _ _ hyR).2 (G.V_subset_U hyV) + · obtain ⟨K, hK⟩ := h.exists_center_walk hR hyR hw hm hv hvR + refine ⟨K.reverse, ?_⟩ + rw [GraphWalk.length_reverse, chainLength_inl, chainLength_inr, chainLength_nil] + omega + | cons t' A' => + cases t' with + | inr R' => + rw [List.isChain_cons_cons] at hc' + exact hc'.1.elim + | inl u => + have hu : u ∈ G.V := by + rw [List.isChain_cons_cons] at hc' + exact hc'.1.1 + have huR : u ∈ closure R := by + rw [List.isChain_cons_cons] at hc' + exact hc'.1.2.2 + have hc'' := hc'.tail + have hlt : A'.length < n := by + simp at hn + omega + obtain ⟨K₂, hK₂⟩ := ih A'.length hlt A' u hc'' hu (by simpa using hl) rfl + obtain ⟨K₁, hK₁⟩ := h.exists_walk hR hv hu hvR huR + refine ⟨K₁.append K₂, ?_⟩ + rw [GraphWalk.length_append] + rw [chainLength_inl, chainLength_inr, chainLength_inl] + rw [chainLength_inl] at hK₂ + omega + +/-- An `(x, y)`-chain of the part of `sk(Γ)` in `Δ` gives a walk of `Γ*` between the centres of `x` +and `y`, with two edges for each vertex of the chain, less two, and one more edge at each of +`x, y` that is not a vertex. -/ +theorem IsSkPart.chain_walk (h : D.IsSkPart Δ Sk G) {x y : Δ} {z z' : Shat} {a b : ℕ} + (hx : D.IsCenteredOn x.1 z a) (hy : D.IsCenteredOn y.1 z' b) {A : List (ChainTerm Δ)} + (hc : IsXYChain G x y A) : ∃ K : GraphWalk D.rad.G.toGraph z z', K.length + 2 + ≤ 2 * chainLength A + a + b := by + obtain ⟨hne, hval, hch, hh, hl, -⟩ := hc + cases A with + | nil => exact absurd rfl hne + | cons t A => + cases t with + | inl v => + have hvx : v = x := by simpa [ChainTerm.MatchesEnd] using hh + subst hvx + have hvV : v ∈ G.V := hval _ List.mem_cons_self + rcases hx with ⟨rfl, hm, hz⟩ | ⟨-, -, hm⟩ + · subst hm + obtain ⟨K, hK⟩ := chain_from_vertex h hy A v hch hvV hl + exact ⟨K, by omega⟩ + · exact absurd ((h.mem_V _).mp hvV) (D.notMem_hatV_of_region hm) + | inr R => + have hxR : x ∈ R := by simpa [ChainTerm.MatchesEnd] using hh + have hRR : R ∈ G.R := hval _ List.mem_cons_self + have hoff : ∀ {p : Δ}, p ∈ R → p ∉ G.V := fun hp hpV ↦ by + obtain ⟨y', -, rfl⟩ := (mem_R_iff G).mp hRR + exact (connectedComponentIn_subset _ _ hp).2 (G.V_subset_U hpV) + rcases hx with ⟨-, hm, hz⟩ | ⟨rfl, hw, hm⟩ + · exact absurd ((h.mem_V _).mpr (hm ▸ hz)) (hoff hxR) + cases A with + | nil => + have hyR : y ∈ R := by simpa [ChainTerm.MatchesEnd] using hl + rcases hy with ⟨-, hm', hz⟩ | ⟨rfl, hw', hm'⟩ + · exact absurd ((h.mem_V _).mpr (hm' ▸ hz)) (hoff hyR) + · obtain ⟨q, -, hRq, rfl⟩ := h.region_eq hRR hxR hm + obtain ⟨q', -, hRq', e⟩ := h.region_eq hRR hyR hm' + have hq : D.rad.regionOf z = D.rad.regionOf z' := by + have h₁ := hRq (mem_image_of_mem _ hyR) + exact (connectedComponentIn_eq h₁).trans (connectedComponentIn_eq hm').symm + have := D.center_unique hw hw' hq + subst this + refine ⟨.nil hw.1, ?_⟩ + rw [chainLength_inr, chainLength_nil] + simp [GraphWalk.length, GraphWalk.edges] + | cons t A => + cases t with + | inr R' => + rw [List.isChain_cons_cons] at hch + exact hch.1.elim + | inl v => + rw [List.isChain_cons_cons] at hch + obtain ⟨⟨hv, -, hvR⟩, hch'⟩ := hch + obtain ⟨K₁, hK₁⟩ := h.exists_center_walk hRR hxR hw hm hv hvR + obtain ⟨K₂, hK₂⟩ := chain_from_vertex h hy A v hch' hv (by simpa using hl) + refine ⟨K₁.append K₂, ?_⟩ + rw [GraphWalk.length_append] + rw [chainLength_inr] + omega + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13zb.lean b/LeanPool/GraphMinor/GM19/Section13zb.lean new file mode 100644 index 0000000000..9786dde8e3 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13zb.lean @@ -0,0 +1,292 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13za + +/-! +# Graph Minors XIX, Section 13: points on the boundary of a sector + +We locate each point of `bd(Δ)` on the two paths that make up the boundary of `Δ`, by its position +on the path. Two points that lie on the same side of a pair of positions are not separated +by that pair. This is what the division of (13.7) needs. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM06 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +omit [T2Space Shat] in +theorem GraphWalk.length_support' {G : Drawing Shat} {a b : Shat} (K : GraphWalk G.toGraph a b) : + K.support.length = K.length + 1 := by + induction K with + | nil h => rfl + | cons h t ih => + simp only [GraphWalk.support_cons, List.length_cons, ih] + simp [GraphWalk.length] + +omit [T2Space Shat] in +theorem GraphWalk.vertexAt_eq {G : Drawing Shat} {a b : Shat} (K : GraphWalk G.toGraph a b) {p : ℕ} + (_ : p ≤ K.length) (h : p < K.support.length := by rw [GraphWalk.length_support']; omega) : + GraphWalk.vertexAt K p = K.support[p] := by + simp only [GraphWalk.vertexAt] + rw [List.getD_eq_getElem?_getD, List.getElem?_eq_getElem h, Option.getD_some] + +omit [T2Space Shat] in +theorem GraphWalk.exists_vertexAt {G : Drawing Shat} {a b x : Shat} (K : GraphWalk G.toGraph a b) + (hx : x ∈ K.support) : ∃ p ≤ K.length, x = GraphWalk.vertexAt K p := by + obtain ⟨i, hi, rfl⟩ := List.getElem_of_mem hx + have hl := GraphWalk.length_support' K + exact ⟨i, by omega, (GraphWalk.vertexAt_eq K (by omega) hi).symm⟩ + +omit [T2Space Shat] in +theorem GraphWalk.vertexAt_mem_left {G : Drawing Shat} {a b c : Shat} (P : GraphWalk G.toGraph a b) + (Q : GraphWalk G.toGraph b c) {p : ℕ} (hp : p ≤ P.length) : + GraphWalk.vertexAt (P.append Q) p ∈ P.support := by + have hl := GraphWalk.length_support' P + have hl' : p ≤ (P.append Q).length := by rw [GraphWalk.length_append]; omega + rw [GraphWalk.vertexAt_eq _ hl'] + have hp' : p < P.support.length := by omega + simp only [GraphWalk.support_append, List.getElem_append_left hp'] + exact List.getElem_mem _ + +omit [T2Space Shat] in +theorem GraphWalk.vertexAt_mem_right {G : Drawing Shat} {a b c : Shat} + (P : GraphWalk G.toGraph a b) (Q : GraphWalk G.toGraph b c) {p : ℕ} (hp : P.length ≤ p) (hq : p ≤ + (P.append Q).length) : + GraphWalk.vertexAt (P.append Q) p ∈ Q.support := by + by_cases he : p = P.length + · subst he + rw [GraphWalk.vertexAt_append] + exact Q.start_mem_support + have hl := GraphWalk.length_support' P + have hlk := GraphWalk.length_support' (P.append Q) + rw [GraphWalk.vertexAt_eq _ hq] + simp only [GraphWalk.support_append] + rw [List.getElem_append_right (by omega)] + exact List.mem_of_mem_tail (List.getElem_mem _) + +omit [T2Space Shat] in +theorem GraphWalk.vertexAt_zero {G : Drawing Shat} {a b : Shat} (K : GraphWalk G.toGraph a b) : + GraphWalk.vertexAt K 0 = a := by + cases K <;> simp [GraphWalk.vertexAt, GraphWalk.support] + +omit [T2Space Shat] in +theorem GraphWalk.vertexAt_length {G : Drawing Shat} {a b : Shat} (K : GraphWalk G.toGraph a b) + (h : b ∈ G.V) : GraphWalk.vertexAt K K.length = b := by + induction K with + | nil h' => simp [GraphWalk.vertexAt, GraphWalk.support, GraphWalk.length] + | cons hl t ih => + have := ih h + simpa [GraphWalk.vertexAt, GraphWalk.support, GraphWalk.length] using this + +omit [T2Space Shat] in +theorem GraphWalk.vertexAt_inj {G : Drawing Shat} {a b : Shat} (K : GraphWalk G.toGraph a b) + (hs : K.IsSimple) {p q : ℕ} (hp : p ≤ K.length) (hq : q ≤ K.length) + (h : GraphWalk.vertexAt K p = GraphWalk.vertexAt K q) : p = q := by + have hl := GraphWalk.length_support' K + have hp' : p < K.support.length := by omega + have hq' : q < K.support.length := by omega + rw [GraphWalk.vertexAt_eq K hp hp', GraphWalk.vertexAt_eq K hq hq'] at h + exact (List.Nodup.getElem_inj_iff hs).mp h + +omit [T2Space Shat] in +theorem GraphWalk.vertexAt_mem {G : Drawing Shat} {a b : Shat} (K : GraphWalk G.toGraph a b) {p : + ℕ} (hp : p ≤ K.length) : GraphWalk.vertexAt K p ∈ K.support := by + have hl := GraphWalk.length_support' K + have hp' : p < K.support.length := by omega + rw [GraphWalk.vertexAt_eq K hp hp'] + exact List.getElem_mem _ + +omit [T2Space Shat] in +/-- The position of an edge is the same in any two splittings. -/ +theorem GraphWalk.mem_edges_of_split {G : Drawing Shat} {a b x y c : Shat} {g : Set Shat} + (K : GraphWalk G.toGraph a b) (P₀ : GraphWalk G.toGraph a x) (hl : G.toGraph.IsLink g x y) + (Q₀ : GraphWalk G.toGraph y b) (h₀ : K = P₀.append (.cons hl Q₀)) (P : GraphWalk G.toGraph a c) + (Q : GraphWalk G.toGraph c b) (h : K = P.append Q) : + (P₀.length < P.length → g ∈ P.edges) ∧ (P.length ≤ P₀.length → g ∈ Q.edges) := by + have e : P₀.edges ++ g :: Q₀.edges = P.edges ++ Q.edges := by + have h₁ := congrArg GraphWalk.edges (h₀.symm.trans h) + simpa [GraphWalk.edges_append] using h₁ + have hk : (P₀.edges ++ g :: Q₀.edges)[P₀.edges.length]? = some g := by simp + rw [e] at hk + constructor + · intro hlt + have hlt' : P₀.edges.length < P.edges.length := hlt + rw [List.getElem?_append_left hlt'] at hk + exact List.mem_of_getElem? hk + · intro hle + have hle' : P.edges.length ≤ P₀.edges.length := hle + rw [List.getElem?_append_right hle'] at hk + exact List.mem_of_getElem? hk + +namespace TangleDatum + +/-- Two paths of `Γ*` from a vertex `r` of `R*` to `u`, of the same length, with no other common +vertex. They are the boundary of the sector of (13.7), and the last field says +that no walk of `Γ*` is a short cut, which we prove from the spokes later. -/ +structure IsBigon (D : TangleDatum cap χ) {r u : Shat} (B : Bool → GraphWalk D.rad.G.toGraph r u) : + Prop where + r_mem : r ∈ D.rad.Rstar + ne : r ≠ u + simple : ∀ i, (B i).IsSimple + len : ∀ i i', (B i).length = (B i').length + meet : ∀ i i', i ≠ i' → ∀ y, y ∈ (B i).support → y ∈ (B i').support → y = r ∨ y = u + far : ∀ i i' p q, p ≤ q → q ≤ (B i').length → ∀ K : GraphWalk D.rad.G.toGraph (GraphWalk.vertexAt + (B i) p) (GraphWalk.vertexAt (B i') q), q - p ≤ K.length + +variable {D : TangleDatum cap χ} {r u : Shat} {B : Bool → GraphWalk D.rad.G.toGraph r u} + +omit [T2Space S] [T2Space Shat] in +theorem IsBigon.u_mem (_hB : D.IsBigon B) : u ∈ D.rad.G.V := (B true).mem_vertexSet_of_mem_support + (B true).end_mem_support + +omit [T2Space S] in +omit [T2Space Shat] in +/-- A vertex of the bigon has one position. -/ +theorem IsBigon.position_unique (hB : D.IsBigon B) {i i' : Bool} {p q : ℕ} (hp : p ≤ (B i).length) + (hq : q ≤ (B i').length) (h : GraphWalk.vertexAt (B i) p = GraphWalk.vertexAt (B i') q) : p = q + := by + by_cases hi : i = i' + · subst hi + exact GraphWalk.vertexAt_inj _ (hB.simple i) hp hq h + have h₁ := GraphWalk.vertexAt_mem (B i) hp + have h₂ := GraphWalk.vertexAt_mem (B i') hq + rw [← h] at h₂ + rcases hB.meet i i' hi _ h₁ h₂ with h₃ | h₃ + · have e₁ : p = 0 := GraphWalk.vertexAt_inj _ (hB.simple i) hp (Nat.zero_le _) (h₃.trans + (GraphWalk.vertexAt_zero _).symm) + have e₂ : q = 0 := GraphWalk.vertexAt_inj _ (hB.simple i') hq (Nat.zero_le _) + ((h.symm.trans h₃).trans (GraphWalk.vertexAt_zero _).symm) + omega + · have e₁ : p = (B i).length := GraphWalk.vertexAt_inj _ (hB.simple i) hp le_rfl (h₃.trans + (GraphWalk.vertexAt_length _ hB.u_mem).symm) + have e₂ : q = (B i').length := GraphWalk.vertexAt_inj _ (hB.simple i') hq le_rfl + ((h.symm.trans h₃).trans (GraphWalk.vertexAt_length _ hB.u_mem).symm) + have := hB.len i i' + omega + +omit [T2Space Shat] in +/-- The vertices of `Γ` on the bigon are those in odd position, because `Γ*` is bipartite and `r` is +not a vertex of `Γ`. -/ +theorem IsBigon.hatV_iff (hB : D.IsBigon B) (i : Bool) {p : ℕ} (hp : p ≤ + (B i).length) : GraphWalk.vertexAt (B i) p ∈ D.P.Γ.hatV cap ↔ Odd p := by + obtain ⟨P, Q, -, hl⟩ := GraphWalk.exists_split_at (B i) hp + have h := D.even_length_walk P + have hr : r ∉ D.P.Γ.hatV cap := hB.r_mem.2 + rw [hl] at h + rw [← Nat.not_even_iff_odd, h] + tauto + +/-- Where a point of the boundary of the sector lies, on the walk `K`: at position `q`, in the sense +that any splitting of `K` at another position has the point on the part towards `q`. -/ +def IsPlaced (D : TangleDatum cap χ) {a b : Shat} (K : GraphWalk D.rad.G.toGraph a b) (x : Shat) + (q : ℕ) : Prop := + q ≤ K.length ∧ (x = GraphWalk.vertexAt K q ∨ x ∉ D.rad.G.V) ∧ ∀ (c : Shat) + (P : GraphWalk D.rad.G.toGraph a c) (Q : GraphWalk D.rad.G.toGraph c b), K = P.append Q → + (q < P.length → x ∈ (walkDrawing D.rad.G P).U) ∧ (P.length < q → x ∈ (walkDrawing D.rad.G Q).U) + +omit [T2Space S] in +theorem isPlaced_vertexAt (D : TangleDatum cap χ) {a b : Shat} (K : GraphWalk D.rad.G.toGraph a b) + {q : ℕ} (hq : q ≤ K.length) : D.IsPlaced K (GraphWalk.vertexAt K q) q := by + refine ⟨hq, .inl rfl, ?_⟩ + rintro c P Q rfl + refine ⟨fun h ↦ (mem_walkDrawing_U _ _).mpr (.inl (GraphWalk.vertexAt_mem_left P Q h.le)), + fun h ↦ (mem_walkDrawing_U _ _).mpr (.inl (GraphWalk.vertexAt_mem_right P Q h.le hq))⟩ + +omit [T2Space S] in +theorem isPlaced_edge {a b x y z : Shat} {g : Set Shat} (K : GraphWalk D.rad.G.toGraph a b) + (P₀ : GraphWalk D.rad.G.toGraph a x) (hl : D.rad.G.toGraph.IsLink g x y) + (Q₀ : GraphWalk D.rad.G.toGraph y b) (h₀ : K = P₀.append (.cons hl Q₀)) (hz : z ∈ g) {q : ℕ} + (hq : q = P₀.length ∨ q = P₀.length + 1) : D.IsPlaced K z q := by + have hlen : K.length = P₀.length + Q₀.length + 1 := by + rw [h₀, GraphWalk.length_append] + simp only [GraphWalk.length, GraphWalk.edges_cons, List.length_cons] + omega + refine ⟨by omega, .inr (hl.1.2.1 hz).2, ?_⟩ + intro c P Q h + have hm := GraphWalk.mem_edges_of_split K P₀ hl Q₀ h₀ P Q h + refine ⟨fun hlt ↦ (mem_walkDrawing_U _ _).mpr (.inr ⟨g, hm.1 (by omega), subset_closure hz⟩), + fun hlt ↦ (mem_walkDrawing_U _ _).mpr (.inr ⟨g, hm.2 (by omega), subset_closure hz⟩)⟩ + +theorem IsBigon.exists_place_vertex (hB : D.IsBigon B) (i : Bool) {x : Shat} (hs : x ∈ + (B i).support) : + ∃ q a, D.IsPlaced (B i) x q ∧ D.IsCenteredOn x (GraphWalk.vertexAt (B i) q) a ∧ (a = 0 ↔ Odd q) + := by + obtain ⟨q, hq, rfl⟩ := GraphWalk.exists_vertexAt _ hs + by_cases ho : Odd q + · exact ⟨q, 0, isPlaced_vertexAt D _ hq, .inl ⟨rfl, rfl, (hB.hatV_iff i hq).mpr ho⟩, + by simpa using ho⟩ + · have hw : GraphWalk.vertexAt (B i) q ∈ D.rad.Rstar := ⟨(B i).mem_vertexSet_of_mem_support hs, + fun hn ↦ ho ((hB.hatV_iff i hq).mp hn)⟩ + exact ⟨q, 1, isPlaced_vertexAt D _ hq, .inr ⟨rfl, hw, (D.rad.regionOf_mem hw).2⟩, + by simpa using ho⟩ + +/-- Each point of a side of the bigon has a place, with a centre at that position. -/ +theorem IsBigon.exists_place (hB : D.IsBigon B) (i : Bool) {x : Shat} (hx : x ∈ + (walkDrawing D.rad.G (B i)).U) : + ∃ q a, D.IsPlaced (B i) x q ∧ D.IsCenteredOn x (GraphWalk.vertexAt (B i) q) a ∧ (a = 0 ↔ Odd q) + := by + rcases (mem_walkDrawing_U _ _).mp hx with hs | ⟨g, hg, hxg⟩ + · exact hB.exists_place_vertex i hs + obtain ⟨c, d, hl, P₀, Q₀, h₀⟩ := GraphWalk.exists_split_edge (B i) hg + have hgG : g ∈ D.rad.G.E := hl.1 + by_cases hxG : x ∈ D.rad.G.V + · have hm : x ∈ closure g ∩ D.rad.G.V := ⟨hxg, hxG⟩ + rw [hl.2.2.2] at hm + have hs : x ∈ (B i).support := by + rw [h₀, GraphWalk.mem_support_append] + rcases hm with rfl | rfl + · exact .inl P₀.end_mem_support + · exact .inr (by rw [GraphWalk.support_cons]; simpa using .inr Q₀.start_mem_support) + exact hB.exists_place_vertex i hs + have hxg' : x ∈ g := (closure_edge_subset hgG hxg).resolve_right hxG + have hlen : (B i).length = P₀.length + Q₀.length + 1 := by + rw [h₀, GraphWalk.length_append] + simp only [GraphWalk.length, GraphWalk.edges_cons, List.length_cons] + omega + have hc : GraphWalk.vertexAt (B i) P₀.length = c := by + rw [h₀]; exact GraphWalk.vertexAt_append _ _ + have hd : GraphWalk.vertexAt (B i) (P₀.length + 1) = d := by + have h₁ : (B i) = (P₀.append (.cons hl (.nil hl.2.2.1))).append Q₀ := by + rw [h₀, GraphMinor.GM19.GraphWalk.append_assoc']; rfl + have h₂ : (P₀.append (.cons hl (.nil hl.2.2.1))).length = P₀.length + 1 := by + rw [GraphWalk.length_append] + simp [GraphWalk.length, GraphWalk.edges] + rw [← h₂, h₁] + exact GraphWalk.vertexAt_append _ _ + have hclo : c ∈ closure g ∧ d ∈ closure g := by + have h₁ : c ∈ closure g ∩ D.rad.G.V := by rw [hl.2.2.2]; exact .inl rfl + have h₂ : d ∈ closure g ∩ D.rad.G.V := by rw [hl.2.2.2]; exact .inr rfl + exact ⟨h₁.1, h₂.1⟩ + have hcen : ∀ {q : ℕ} {z : Shat}, q ≤ (B i).length → z ∈ closure g → z ∈ D.rad.G.V → ¬ Odd q + → GraphWalk.vertexAt (B i) q = z → D.IsCenteredOn x (GraphWalk.vertexAt (B i) q) 1 + := fun {q z} hq hzg hzG ho e ↦ by + rw [e] + have hz : z ∈ D.rad.Rstar := ⟨hzG, fun hn ↦ ho ((hB.hatV_iff i hq).mp (by rwa [e]))⟩ + exact .inr ⟨rfl, hz, edge_subset_regionOf D hz hgG hzg hxg'⟩ + by_cases hk : Odd P₀.length + · have ho : ¬ Odd (P₀.length + 1) := by + rw [Nat.not_odd_iff_even] + exact hk.add_one + exact ⟨P₀.length + 1, 1, isPlaced_edge _ P₀ hl Q₀ h₀ hxg' (.inr rfl), + hcen (by omega) hclo.2 hl.2.2.1 ho hd, by simpa using ho⟩ + · exact ⟨P₀.length, 1, isPlaced_edge _ P₀ hl Q₀ h₀ hxg' (.inl rfl), + hcen (by omega) hclo.1 hl.2.1 hk hc, by simpa using hk⟩ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13zc.lean b/LeanPool/GraphMinor/GM19/Section13zc.lean new file mode 100644 index 0000000000..2ab1ecc914 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13zc.lean @@ -0,0 +1,242 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13zb + +/-! +# Graph Minors XIX, Section 13: the division on the boundary of a sector + +We cut the bigon at a pair of vertices at the same position. What is left has a part towards `r` and +a part towards `u`, and each part is connected. So points of one part are not separated by the pair. +Then VI (3.6) gives that the division with these pairs as members is feasible in `sk(Γ)` inside the +disc. The chain condition of VI (3.6) comes from the fact that the bigon has no short cut. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM06 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +omit [T2Space Shat] in +theorem GraphWalk.vertexAt_append_left {G : Drawing Shat} {a b c : Shat} + (P : GraphWalk G.toGraph a b) (Q : GraphWalk G.toGraph b c) {t : ℕ} (ht : t ≤ P.length) : + GraphWalk.vertexAt (P.append Q) t = GraphWalk.vertexAt P t := by + have hl := GraphWalk.length_support' P + have hl' : t ≤ (P.append Q).length := by rw [GraphWalk.length_append]; omega + rw [GraphWalk.vertexAt_eq _ hl', GraphWalk.vertexAt_eq P ht (by omega)] + simp only [GraphWalk.support_append] + rw [List.getElem_append_left (by omega)] + +omit [T2Space Shat] in +theorem GraphWalk.vertexAt_append_right {G : Drawing Shat} {a b c : Shat} + (P : GraphWalk G.toGraph a b) (Q : GraphWalk G.toGraph b c) {t : ℕ} (ht : t ≤ Q.length) : + GraphWalk.vertexAt (P.append Q) (P.length + t) = GraphWalk.vertexAt Q t := by + induction P with + | nil h => simp [GraphWalk.length, GraphWalk.append] + | cons hl' s ih => + rw [← ih Q ht] + have e : (GraphWalk.cons hl' s).length + t = (s.length + t) + 1 := by + simp only [GraphWalk.length, GraphWalk.edges_cons, List.length_cons] + omega + rw [e] + simp [GraphWalk.vertexAt, GraphWalk.append] + +/-- The two pieces of a split walk lie in the walk. -/ +theorem walkU_left_subset {G : Drawing Shat} {a b c : Shat} (P : GraphWalk G.toGraph a b) + (Q : GraphWalk G.toGraph b c) : (walkDrawing G P).U ⊆ (walkDrawing G (P.append Q)).U + := fun y hy ↦ by + rw [mem_walkDrawing_U] at hy ⊢ + rcases hy with h | ⟨e, he, hye⟩ + · exact .inl ((GraphWalk.mem_support_append P Q).mpr (.inl h)) + · exact .inr ⟨e, by rw [GraphWalk.edges_append]; exact List.mem_append_left _ he, hye⟩ + +theorem walkU_right_subset {G : Drawing Shat} {a b c : Shat} (P : GraphWalk G.toGraph a b) + (Q : GraphWalk G.toGraph b c) : (walkDrawing G Q).U ⊆ (walkDrawing G (P.append Q)).U + := fun y hy ↦ by + rw [mem_walkDrawing_U] at hy ⊢ + rcases hy with h | ⟨e, he, hye⟩ + · exact .inl ((GraphWalk.mem_support_append P Q).mpr (.inr h)) + · exact .inr ⟨e, by rw [GraphWalk.edges_append]; exact List.mem_append_right _ he, hye⟩ + +theorem walkU_diff_end {G : Drawing Shat} {a b : Shat} (K : GraphWalk G.toGraph a b) + (hs : K.IsSimple) (hab : a ≠ b) : IsPreconnected ((walkDrawing G K).U \ {b}) := by + have h := isLine_of_isPathBetween (walkDrawing_isPathBetween G hs) hab + refine (IsLineWithEnds.isPreconnected_diff h).subset_closure (fun x hx ↦ ⟨hx.1, + fun h' ↦ hx.2 (.inr h')⟩) fun x hx ↦ IsLineWithEnds.subset_closure_diff h hx.1 + +theorem walkU_diff_start {G : Drawing Shat} {a b : Shat} (K : GraphWalk G.toGraph a b) + (hs : K.IsSimple) (hab : a ≠ b) : IsPreconnected ((walkDrawing G K).U \ {a}) := by + have h := isLine_of_isPathBetween (walkDrawing_isPathBetween G hs) hab + refine (IsLineWithEnds.isPreconnected_diff h).subset_closure (fun x hx ↦ ⟨hx.1, + fun h' ↦ hx.2 (.inl h')⟩) fun x hx ↦ IsLineWithEnds.subset_closure_diff h hx.1 + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {r u : Shat} {B : Bool → GraphWalk D.rad.G.toGraph r u} + +omit [T2Space S] in +/-- Cutting the bigon at position `p`, with `p ≥ 1`, leaves a connected part towards `r` and a +connected part towards `u`, and every placed point other than at `p` is in the right part. -/ +theorem IsBigon.exists_parts (hB : D.IsBigon B) {p : ℕ} (h1 : 1 ≤ p) (hp : p ≤ (B false).length) : + ∃ X Y : Set Shat, IsPreconnected X ∧ IsPreconnected Y ∧ (∀ i, GraphWalk.vertexAt (B i) p ∉ X + ∧ GraphWalk.vertexAt (B i) p ∉ Y) ∧ (X ∪ Y ⊆ ⋃ i, (walkDrawing D.rad.G (B i)).U) ∧ + ∀ i x q, D.IsPlaced (B i) x q → (q < p → x ∈ X) ∧ (p < q → x ∈ Y) := by + have hn : ∀ i, (B i).length = (B false).length := fun i ↦ hB.len i false + have hpi : ∀ i, p ≤ (B i).length := fun i ↦ by rw [hn]; exact hp + choose P Q hsplit hlen using fun i ↦ GraphWalk.exists_split_at (B i) (hpi i) + have hG : ∀ i, GraphWalk.vertexAt (B i) p ∈ D.rad.G.V := fun i ↦ (B + i).mem_vertexSet_of_mem_support (GraphWalk.vertexAt_mem _ (hpi i)) + have hra : ∀ i, r ≠ GraphWalk.vertexAt (B i) p := fun i he ↦ by + have := hB.position_unique (i := i) (i' := i) (Nat.zero_le _) (hpi i) + ((GraphWalk.vertexAt_zero _).trans he) + omega + have hsP : ∀ i, (P i).IsSimple := fun i ↦ (isSimple_of_append (hsplit i ▸ hB.simple i)).1 + have hsQ : ∀ i, (Q i).IsSimple := fun i ↦ (isSimple_of_append (hsplit i ▸ hB.simple i)).2 + have hoffP : ∀ i i', GraphWalk.vertexAt (B i') p ∈ (walkDrawing D.rad.G (P i)).U + → GraphWalk.vertexAt (B i') p = GraphWalk.vertexAt (B i) p := fun i i' hm ↦ by + obtain ⟨t, ht, e⟩ := GraphWalk.exists_vertexAt _ (support_of_mem_U (P i) hm (hG i')) + have e₁ : GraphWalk.vertexAt (B i) t = GraphWalk.vertexAt (P i) t := by + conv_lhs => rw [hsplit i] + exact GraphWalk.vertexAt_append_left _ _ ht + have := hB.position_unique (i := i') (i' := i) (hpi i') (by + have := hlen i + have := hpi i + omega) (e.trans e₁.symm) + subst this + rw [e, ← e₁] + have hoffQ : ∀ i i', GraphWalk.vertexAt (B i') p ∈ (walkDrawing D.rad.G (Q i)).U + → GraphWalk.vertexAt (B i') p = GraphWalk.vertexAt (B i) p := fun i i' hm ↦ by + obtain ⟨t, ht, e⟩ := GraphWalk.exists_vertexAt _ (support_of_mem_U (Q i) hm (hG i')) + have e₁ : GraphWalk.vertexAt (B i) (p + t) = GraphWalk.vertexAt (Q i) t := by + have h₂ := GraphWalk.vertexAt_append_right (P i) (Q i) ht + rw [hlen i, ← hsplit i] at h₂ + exact h₂ + have hlenB : (B i).length = p + (Q i).length := by + conv_lhs => rw [hsplit i, GraphWalk.length_append, hlen i] + have := hB.position_unique (i := i') (i' := i) (hpi i') (by omega) (e.trans e₁.symm) + have ht0 : t = 0 := by omega + subst ht0 + rw [e, ← e₁] + rfl + have hplace : ∀ i x q, D.IsPlaced (B i) x q → q ≠ p → x ≠ GraphWalk.vertexAt (B i) p + := fun i x q hx hqp he ↦ by + rcases hx.2.1 with h | h + · exact hqp (hB.position_unique hx.1 (hpi i) (h.symm.trans he)) + · exact h (he ▸ hG i) + by_cases hlt : p < (B false).length + · have hau : ∀ i, GraphWalk.vertexAt (B i) p ≠ u := fun i he ↦ by + have := hB.position_unique (i := i) (i' := i) (hpi i) le_rfl (he.trans + (GraphWalk.vertexAt_length _ hB.u_mem).symm) + have := hn i + omega + refine ⟨⋃ i, (walkDrawing D.rad.G (P i)).U \ {GraphWalk.vertexAt (B i) p}, ⋃ i, + (walkDrawing D.rad.G (Q i)).U \ {GraphWalk.vertexAt (B i) p}, + isPreconnected_iUnion ⟨r, mem_iInter.mpr fun i ↦ ⟨(mem_walkDrawing_U _ _).mpr (.inl + (P i).start_mem_support), hra i⟩⟩ fun i ↦ walkU_diff_end _ (hsP i) (hra i), + isPreconnected_iUnion ⟨u, mem_iInter.mpr fun i ↦ ⟨(mem_walkDrawing_U _ _).mpr (.inl + (Q i).end_mem_support), (hau i).symm⟩⟩ fun i ↦ walkU_diff_start _ (hsQ i) + (hau i), fun i ↦ ⟨?_, ?_⟩, ?_, ?_⟩ + · rintro hm + obtain ⟨i', hm₁, hm₂⟩ := mem_iUnion.mp hm + exact hm₂ (hoffP i' i hm₁) + · rintro hm + obtain ⟨i', hm₁, hm₂⟩ := mem_iUnion.mp hm + exact hm₂ (hoffQ i' i hm₁) + · rintro x (hx | hx) + · obtain ⟨i, hm, -⟩ := mem_iUnion.mp hx + exact mem_iUnion.mpr ⟨i, by rw [hsplit i]; exact walkU_left_subset _ _ hm⟩ + · obtain ⟨i, hm, -⟩ := mem_iUnion.mp hx + exact mem_iUnion.mpr ⟨i, by rw [hsplit i]; exact walkU_right_subset _ _ hm⟩ + · intro i x q hx + have hs := hx.2.2 _ (P i) (Q i) (hsplit i) + rw [hlen i] at hs + exact ⟨fun h ↦ mem_iUnion.mpr ⟨i, hs.1 h, hplace i x q hx (by omega)⟩, + fun h ↦ mem_iUnion.mpr ⟨i, hs.2 h, hplace i x q hx (by omega)⟩⟩ + · refine ⟨⋃ i, (walkDrawing D.rad.G (P i)).U \ {GraphWalk.vertexAt (B i) p}, ∅, + isPreconnected_iUnion ⟨r, mem_iInter.mpr fun i ↦ ⟨(mem_walkDrawing_U _ _).mpr (.inl + (P i).start_mem_support), hra i⟩⟩ fun i ↦ walkU_diff_end _ (hsP i) (hra i), + isPreconnected_empty, fun i ↦ ⟨?_, by simp⟩, ?_, ?_⟩ + · rintro hm + obtain ⟨i', hm₁, hm₂⟩ := mem_iUnion.mp hm + exact hm₂ (hoffP i' i hm₁) + · rintro x (hx | hx) + · obtain ⟨i, hm, -⟩ := mem_iUnion.mp hx + exact mem_iUnion.mpr ⟨i, by rw [hsplit i]; exact walkU_left_subset _ _ hm⟩ + · exact absurd hx (notMem_empty _) + · intro i x q hx + have hs := hx.2.2 _ (P i) (Q i) (hsplit i) + rw [hlen i] at hs + refine ⟨fun h ↦ mem_iUnion.mpr ⟨i, hs.1 h, hplace i x q hx (by omega)⟩, fun h ↦ ?_⟩ + have := hx.1 + have := hn i + omega + +end TangleDatum + +omit [T2Space Shat] in +/-- Points of a connected set off `a, c` are not separated by `a, c`. -/ +theorem not_crossesOn_of_part {Δ : Set Shat} {C : Set Δ} {X : Set Shat} (hX : IsPreconnected X) + (hXC : X ⊆ Subtype.val '' C) {a c b d : Δ} (ha : a.1 ∉ X) (hc : c.1 ∉ X) (hb : b.1 ∈ X) + (hd : d.1 ∈ X) : + ¬ CrossesOn C a c b d := by + rintro ⟨-, -, -, -, -, -, -, -, -, -, hne⟩ + have hsub : X ⊆ Δ := hXC.trans (by rintro _ ⟨z, -, rfl⟩; exact z.2) + have hP : IsPreconnected (Subtype.val ⁻¹' X : Set Δ) := by + rw [← IsInducing.subtypeVal.isPreconnected_image, Subtype.image_preimage_coe, + inter_eq_right.mpr hsub] + exact hX + have hin : (Subtype.val ⁻¹' X : Set Δ) ⊆ C \ {a, c} := fun z hz ↦ by + obtain ⟨z', hz', e⟩ := hXC hz + have : z = z' := Subtype.ext e.symm + subst this + refine ⟨hz', ?_⟩ + rintro (rfl | rfl) + · exact ha hz + · exact hc hz + have h₁ := hP.subset_connectedComponentIn (x := b) hb hin + exact hne (connectedComponentIn_eq (h₁ hd)) + +/-- A dual point set exists: choose one point on each segment. -/ +theorem exists_isDualPointSet {T : Type} [TopologicalSpace T] (C V : Set T) : ∃ U, IsDualPointSet C + V U := by + classical + by_cases hV : V = ∅ + · exact ⟨∅, fun _ ↦ rfl, fun h ↦ absurd hV h.ne_empty⟩ + have hne : ∀ s ∈ segmentsOf C V, s.Nonempty := fun s hs ↦ by + obtain ⟨x, hx, rfl⟩ := hs.1 + exact ⟨x, mem_connectedComponentIn hx⟩ + have : Nonempty T := ⟨(nonempty_iff_ne_empty.mpr hV).some⟩ + choose! pt hpt using hne + have hsub : ∀ s ∈ segmentsOf C V, s ⊆ C \ V := fun s hs ↦ by + obtain ⟨x, hx, rfl⟩ := hs.1 + exact connectedComponentIn_subset _ _ + refine ⟨pt '' segmentsOf C V, fun h ↦ absurd h hV, fun _ ↦ ⟨?_, fun s hs ↦ ?_⟩⟩ + · rintro _ ⟨s, hs, rfl⟩ + exact hsub s hs (hpt s hs) + · have : pt '' segmentsOf C V ∩ s = {pt s} := by + ext z + constructor + · rintro ⟨⟨s', hs', rfl⟩, hz⟩ + obtain ⟨x, hx, rfl⟩ := hs.1 + obtain ⟨x', hx', rfl⟩ := hs'.1 + have e₁ := connectedComponentIn_eq hz + have e₂ := connectedComponentIn_eq (hpt _ hs') + rw [mem_singleton_iff, e₁.trans e₂.symm] + · rintro rfl + exact ⟨mem_image_of_mem _ hs, hpt s hs⟩ + rw [this, ncard_singleton] + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13zd.lean b/LeanPool/GraphMinor/GM19/Section13zd.lean new file mode 100644 index 0000000000..d2dbe372dd --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13zd.lean @@ -0,0 +1,234 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13zc +public import LeanPool.GraphMinor.GM06.DualExists + +/-! +# Graph Minors XIX, Section 13: the division is feasible + +We apply VI (3.6) to the part of `sk(Γ)` in the disc bounded by a bigon. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM06 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {r u : Shat} {B : Bool → GraphWalk D.rad.G.toGraph r u} {Δ : Set + Shat} {Sk : Drawing Shat} {G : Drawing Δ} + +/-- The member of the division at position `2j + 1`. -/ +noncomputable def block (B : Bool → GraphWalk D.rad.G.toGraph r u) (Δ : Set Shat) (j : ℕ) : Set Δ := + Subtype.val ⁻¹' (range fun i ↦ GraphWalk.vertexAt (B i) (2 * j + 1)) + +/-- The division of the boundary of the sector: one member for each position of `Γ` on the bigon. -/ +noncomputable def blocks (B : Bool → GraphWalk D.rad.G.toGraph r u) (Δ : Set Shat) : Set (Set Δ) := + block B Δ '' {j | 2 * j + 1 ≤ (B false).length} + +/-- The bigon and the disc it bounds. -/ +structure IsBigonDisc (D : TangleDatum cap χ) (B : Bool → GraphWalk D.rad.G.toGraph r u) + (Δ : Set Shat) (Sk : Drawing Shat) (G : Drawing Δ) : Prop where + bigon : D.IsBigon B + sk : D.IsSkPart Δ Sk G + disc : IsClosedDisc Δ + bd_eq : discBd Δ = ⋃ i, (walkDrawing D.rad.G (B i)).U + +variable (h : D.IsBigonDisc B Δ Sk G) +include h + +omit [T2Space S] in +theorem IsBigonDisc.vertex_mem {i : Bool} {p : ℕ} (hp : p ≤ (B false).length) : GraphWalk.vertexAt + (B i) p ∈ discBd Δ := by + rw [h.bd_eq] + have hpi : p ≤ (B i).length := by rw [h.bigon.len i false]; exact hp + exact mem_iUnion.mpr ⟨i, (mem_walkDrawing_U _ _).mpr (.inl (GraphWalk.vertexAt_mem _ hpi))⟩ + +theorem IsBigonDisc.exists_place {x : Δ} (hx : x ∈ bd Δ) : + ∃ q a i, D.IsPlaced (B i) x.1 q ∧ D.IsCenteredOn x.1 (GraphWalk.vertexAt (B i) q) a ∧ (a + = 0 ↔ Odd q) := by + have hx' : x.1 ∈ discBd Δ := ⟨x, hx, rfl⟩ + rw [h.bd_eq] at hx' + obtain ⟨i, hi⟩ := mem_iUnion.mp hx' + obtain ⟨q, a, h₁, h₂, h₃⟩ := h.bigon.exists_place i hi + exact ⟨q, a, i, h₁, h₂, h₃⟩ + +omit [T2Space S] in +/-- Points on one side of a block are not separated by the block. -/ +theorem IsBigonDisc.not_crosses {j : ℕ} (hj : 2 * j + 1 ≤ (B false).length) {s t b d : Δ} + (hs : s ∈ block B Δ j) (ht : t ∈ block B Δ j) {i i' : Bool} {q q' : ℕ} (hb : D.IsPlaced + (B i) b.1 q) + (hd : D.IsPlaced (B i') d.1 q') (hside : (q < 2 * j + 1 ∧ q' < 2 * j + 1) ∨ (2 * j + 1 < q + ∧ 2 * j + 1 < q')) : ¬ CrossesOn (bd Δ) s t b d := by + obtain ⟨X, Y, hX, hY, hoff, hsub, hpl⟩ := h.bigon.exists_parts (p := 2 * j + 1) (by omega) hj + have hsub' : ∀ Z : Set Shat, Z ⊆ X ∪ Y → Z ⊆ Subtype.val '' bd Δ := fun Z hZ ↦ by + change Z ⊆ discBd Δ + rw [h.bd_eq] + exact hZ.trans hsub + obtain ⟨is, hs'⟩ := hs + obtain ⟨it, ht'⟩ := ht + simp only at hs' ht' + rcases hside with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · exact not_crossesOn_of_part hX (hsub' X subset_union_left) (hs' ▸ (hoff is).1) (ht' ▸ + (hoff it).1) ((hpl _ _ _ hb).1 h₁) ((hpl _ _ _ hd).1 h₂) + · exact not_crossesOn_of_part hY (hsub' Y subset_union_right) (hs' ▸ (hoff is).2) (ht' ▸ + (hoff it).2) ((hpl _ _ _ hb).2 h₁) ((hpl _ _ _ hd).2 h₂) + +omit [T2Space S] in +theorem IsBigonDisc.notMem_block {j : ℕ} (hj : 2 * j + 1 ≤ (B false).length) {b : Δ} {i : Bool} {q + : ℕ} (hb : D.IsPlaced (B i) b.1 q) (hq : q ≠ 2 * j + 1) : b ∉ block B Δ j := by + obtain ⟨X, Y, -, -, hoff, -, hpl⟩ := h.bigon.exists_parts (p := 2 * j + 1) (by omega) hj + rintro ⟨i', hi'⟩ + simp only at hi' + rcases lt_or_gt_of_ne hq with hlt | hlt + · exact (hoff i').1 (hi' ▸ (hpl _ _ _ hb).1 hlt) + · exact (hoff i').2 (hi' ▸ (hpl _ _ _ hb).2 hlt) + +omit [T2Space S] in +theorem IsBigonDisc.isDivision : IsDivision (blocks B Δ) := by + refine ⟨((Set.finite_Iio ((B false).length + 1)).subset fun j hj ↦ ?_).image _, ?_, ?_⟩ + · change 2 * j + 1 ≤ _ at hj + change j < _ + omega + · rintro _ ⟨j, hj, rfl⟩ + have hm := Surface.discBd_subset _ (h.vertex_mem (i := false) hj) + exact ⟨⟨_, hm⟩, false, rfl⟩ + · rintro _ ⟨j, hj, rfl⟩ _ ⟨k, hk, rfl⟩ hne + refine disjoint_left.mpr ?_ + rintro x ⟨i, hi⟩ ⟨i', hi'⟩ + simp only at hi hi' + have hjk : 2 * j + 1 = 2 * k + 1 := h.bigon.position_unique (i := i) (i' := i') + (by rw [h.bigon.len i false]; exact hj) (by rw [h.bigon.len i' false]; exact hk) + (hi.trans hi'.symm) + have : j = k := by omega + subst this + exact hne rfl + +theorem IsBigonDisc.union_eq : divisionUnion (blocks B Δ) = G.V ∩ bd Δ := by + ext x + constructor + · rintro ⟨_, ⟨j, hj, rfl⟩, i, hi⟩ + simp only at hi + have hpi : 2 * j + 1 ≤ (B i).length := by rw [h.bigon.len i false]; exact hj + refine ⟨(h.sk.mem_V x).mpr (hi ▸ (h.bigon.hatV_iff i hpi).mpr ⟨j, rfl⟩), ?_⟩ + obtain ⟨z, hz, e⟩ := h.vertex_mem (i := i) (p := 2 * j + 1) hj + have : z = x := Subtype.ext (e.trans hi) + exact this ▸ hz + · rintro ⟨hxV, hxb⟩ + have hx := (h.sk.mem_V x).mp hxV + have hx' : x.1 ∈ discBd Δ := ⟨x, hxb, rfl⟩ + rw [h.bd_eq] at hx' + obtain ⟨i, hi⟩ := mem_iUnion.mp hx' + have hG : x.1 ∈ D.rad.G.V := D.rad.isPreRadial.2.1 hx + obtain ⟨q, hq, e⟩ := GraphWalk.exists_vertexAt _ (support_of_mem_U _ hi hG) + obtain ⟨j, rfl⟩ := (h.bigon.hatV_iff i hq).mp (e ▸ hx) + refine ⟨_, ⟨j, ?_, rfl⟩, i, e.symm⟩ + change 2 * j + 1 ≤ _ + rw [← h.bigon.len i false] + exact hq + +omit [T2Space S] in +theorem IsBigonDisc.isCrossFree : IsCrossFree (bd Δ) (blocks B Δ) := by + rintro ⟨_, ⟨j, hj, rfl⟩, _, ⟨k, hk, rfl⟩, hne, s, hs, t, ht, s', ⟨i, hi⟩, t', ⟨i', hi'⟩, hc⟩ + simp only at hi hi' + have hk' : ∀ i, 2 * k + 1 ≤ (B i).length := fun i ↦ by rw [h.bigon.len i false]; exact hk + have hjk : j ≠ k := fun e ↦ hne (by rw [e]) + have p₁ : D.IsPlaced (B i) s'.1 (2 * k + 1) := hi ▸ isPlaced_vertexAt D _ (hk' i) + have p₂ : D.IsPlaced (B i') t'.1 (2 * k + 1) := hi' ▸ isPlaced_vertexAt D _ (hk' i') + exact h.not_crosses hj hs ht p₁ p₂ (by omega) hc + +omit [T2Space S] in +/-- The blocks that count for `x, y` lie between their places. -/ +theorem IsBigonDisc.count_le {x y : Δ} {i i' : Bool} {q q' : ℕ} (hx : D.IsPlaced (B i) x.1 q) + (hy : D.IsPlaced (B i') y.1 q') : + divisionCount (bd Δ) (blocks B Δ) x y + min q q' / 2 ≤ (max q q' + 1) / 2 := by + classical + set m := min q q' with hm + set M := max q q' with hM + have hsub : {δ ∈ blocks B Δ | (δ ∩ {x, y}).Nonempty ∨ ∃ u ∈ δ, ∃ v ∈ δ, CrossesOn + (bd Δ) u v x y} ⊆ block B Δ '' (↑(Finset.Ico (m / 2) ((M + 1) / 2)) : Set ℕ) := by + rintro _ ⟨⟨j, hj, rfl⟩, hc⟩ + refine ⟨j, ?_, rfl⟩ + have hj' : 2 * j + 1 ≤ (B false).length := hj + simp only [Finset.coe_Ico, mem_Ico] + by_contra hn + have hside : (q < 2 * j + 1 ∧ q' < 2 * j + 1) ∨ (2 * j + 1 < q ∧ 2 * j + 1 < q') := by omega + rcases hc with ⟨z, hz, hz' | hz'⟩ | ⟨s, hs, t, ht, hcr⟩ + · subst hz' + exact h.notMem_block hj' hx (by omega) hz + · rw [mem_singleton_iff] at hz' + subst hz' + exact h.notMem_block hj' hy (by omega) hz + · exact h.not_crosses hj' hs ht hx hy hside hcr + have h₁ := Set.ncard_le_ncard hsub ((Finset.finite_toSet _).image _) + have h₂ := Set.ncard_image_le (f := block B Δ) (Finset.finite_toSet (Finset.Ico (m / 2) + ((M + 1) / 2))) + rw [Set.ncard_coe_finset, Nat.card_Ico] at h₂ + have hle : m ≤ M := by omega + have : divisionCount (bd Δ) (blocks B Δ) x y ≤ (M + 1) / 2 - m / 2 := h₁.trans h₂ + omega + +/-- The chain condition of VI (3.6). -/ +theorem IsBigonDisc.chain_bound {x y : Δ} (hx : x ∈ bd Δ) (hy : y ∈ bd Δ) {A : List (ChainTerm Δ)} + (hA : IsXYChain G x y A) : 0 ≤ chainRedundancy G (blocks B Δ) x y A := by + obtain ⟨q, a, i, p₁, c₁, o₁⟩ := h.exists_place hx + obtain ⟨q', b, i', p₂, c₂, o₂⟩ := h.exists_place hy + obtain ⟨K, hK⟩ := h.sk.chain_walk c₁ c₂ hA + have hcount := h.count_le p₁ p₂ + have hfar : max q q' - min q q' ≤ K.length := by + rcases le_total q q' with hle | hle + · have := h.bigon.far i i' q q' hle p₂.1 K + rw [max_eq_right hle, min_eq_left hle] + exact this + · have := h.bigon.far i' i q' q hle p₁.1 K.reverse + rw [GraphWalk.length_reverse] at this + rw [max_eq_left hle, min_eq_right hle] + exact this + have ha : a = 0 ∨ a = 1 := by rcases c₁ with h₁ | h₁; exacts [.inl h₁.1, .inr h₁.1] + have hb : b = 0 ∨ b = 1 := by rcases c₂ with h₁ | h₁; exacts [.inl h₁.1, .inr h₁.1] + rw [Nat.odd_iff] at o₁ o₂ + unfold chainRedundancy + have : divisionCount (bd Δ) (blocks B Δ) x y ≤ chainLength A := by + rcases le_total q q' with hle | hle + · rw [max_eq_right hle, min_eq_left hle] at hcount hfar + omega + · rw [max_eq_left hle, min_eq_right hle] at hcount hfar + omega + omega + +/-- The division is feasible in the part of `sk(Γ)` in the disc, by VI (3.6). -/ +theorem IsBigonDisc.isFeasible : IsFeasible G.toGraph (blocks B Δ) := by + obtain ⟨U, hU⟩ := exists_isDualPointSet (bd Δ) (divisionUnion (blocks B Δ)) + have hUb : ∀ x ∈ U ∪ divisionUnion (blocks B Δ), x ∈ bd Δ := by + have hne : (divisionUnion (blocks B Δ)).Nonempty := by + have h₁ : (B false).length ≠ 0 := fun e ↦ h.bigon.ne (by + have := GraphWalk.vertexAt_length (B false) h.bigon.u_mem + rw [e, GraphWalk.vertexAt_zero] at this + exact this) + have hm := Surface.discBd_subset _ (h.vertex_mem (i := false) (p := 2 * 0 + 1) (by omega)) + exact ⟨⟨_, hm⟩, _, ⟨0, by change 2 * 0 + 1 ≤ _; omega, rfl⟩, false, rfl⟩ + rintro x (hx | hx) + · exact ((hU.2 hne).1 hx).1 + · rw [h.union_eq] at hx + exact hx.2 + refine (GraphMinor.GM06.theorem_3_6_proof G (blocks B Δ) U h.disc h.sk.proper h.isDivision + h.union_eq hU).mpr ⟨h.isCrossFree, fun x hx y hy A hA ↦ h.chain_bound (hUb x hx) (hUb y hy) hA⟩ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13ze.lean b/LeanPool/GraphMinor/GM19/Section13ze.lean new file mode 100644 index 0000000000..bfc4031314 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13ze.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13zd + +/-! +# Graph Minors XIX, Section 13: the paths in the disc + +A realization of the division gives vertex-disjoint paths of the part of `sk(Γ)` in the disc, one +for each member of the division. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM06 Graph + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- A walk of a subgraph is a walk of the graph, with the same vertices. -/ +theorem GraphWalk.exists_lift {α' β : Type*} {C G : Graph α' β} (hle : C ≤ G) {a b : α'} + (K : GraphWalk C a b) : ∃ K' : GraphWalk G a b, K'.support = K.support := by + induction K with + | nil h => exact ⟨.nil (hle.1 h), rfl⟩ + | cons hl t ih => + obtain ⟨K', hK'⟩ := ih + exact ⟨.cons (hle.2 hl) K', by simp [GraphWalk.support_cons, hK']⟩ + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {r u : Shat} {B : Bool → GraphWalk D.rad.G.toGraph r u} {Δ : Set + Shat} {Sk : Drawing Shat} {G : Drawing Δ} + +/-- One vertex set for each member of the division, mutually disjoint, and in each a path of `G` +between any two vertices of the member. -/ +theorem IsBigonDisc.exists_paths (h : D.IsBigonDisc B Δ Sk G) : + ∃ P : ℕ → Set Δ, (∀ j k, 2 * j + 1 ≤ (B false).length → 2 * k + 1 ≤ (B false).length → j ≠ k + → Disjoint (P j) (P k)) ∧ ∀ j, 2 * j + 1 ≤ (B false).length → + block B Δ j ⊆ P j ∧ ∀ a ∈ block B Δ j, ∀ b ∈ block B Δ j, ∃ K : GraphWalk G.toGraph a b, + K.IsSimple ∧ ∀ x ∈ K.support, x ∈ P j := by + classical + obtain ⟨H, -, -, hH, -, C, hinj, hC, -⟩ := h.isFeasible + have hmem : ∀ j, 2 * j + 1 ≤ (B false).length → block B Δ j ∈ blocks B Δ + := fun j hj ↦ ⟨j, hj, rfl⟩ + have hdis : ∀ j k, 2 * j + 1 ≤ (B false).length → 2 * k + 1 ≤ (B false).length → j ≠ k + → block B Δ j ≠ block B Δ k := fun j k hj hk hjk e ↦ by + have hm := Surface.discBd_subset _ (h.vertex_mem (i := false) hj) + have h₁ : (⟨_, hm⟩ : Δ) ∈ block B Δ k := by rw [← e]; exact ⟨false, rfl⟩ + obtain ⟨i, hi⟩ := h₁ + have := h.bigon.position_unique (i := i) (i' := false) + (by rw [h.bigon.len i false]; exact hk) hj hi + omega + refine ⟨fun j ↦ V(C (block B Δ j)), fun j k hj hk hjk ↦ ?_, fun j hj ↦ ⟨(hC _ (hmem j hj)).2, + fun a ha b hb ↦ ?_⟩⟩ + · exact (hC _ (hmem j hj)).1.disjoint_vertexSet_of_ne (hC _ (hmem k hk)).1 fun e ↦ hdis j k hj hk + hjk (hinj (hmem j hj) (hmem k hk) e) + · obtain ⟨hcomp, hsub⟩ := hC _ (hmem j hj) + obtain ⟨K⟩ := hcomp.2.1.2 a (hsub ha) b (hsub hb) + obtain ⟨K', hK'⟩ := GraphWalk.exists_lift (hcomp.1.trans hH) K + obtain ⟨L, hs, hsup, -⟩ := GM11.GraphWalk.exists_isSimple K' + exact ⟨L, hs, fun x hx ↦ K.mem_vertexSet_of_mem_support (hK' ▸ hsup x hx)⟩ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section13zf.lean b/LeanPool/GraphMinor/GM19/Section13zf.lean new file mode 100644 index 0000000000..796ac57c04 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section13zf.lean @@ -0,0 +1,416 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13ze + +/-! +# Graph Minors XIX, Section 13: the bigon of a fan, and (13.7) + +Two spokes that meet, with the edges at `r`, make a bigon. It has no short cut, by (13.1). Then +(13.7) follows from the paths in the disc, since by (13.4) the common part of the spokes is outside +the disc, apart from `u`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM06 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +omit [T2Space Shat] in +theorem GraphWalk.vertexAt_cons {G : Drawing Shat} {a x b : Shat} {e : Set Shat} + (hl : G.toGraph.IsLink e a x) (t : GraphWalk G.toGraph x b) (p : ℕ) : + GraphWalk.vertexAt (.cons hl t) (p + 1) = GraphWalk.vertexAt t p := by + simp [GraphWalk.vertexAt, GraphWalk.support] + +omit [T2Space Shat] in +theorem GraphWalk.length_cons' {G : Drawing Shat} {a x b : Shat} {e : Set Shat} + (hl : G.toGraph.IsLink e a x) (t : GraphWalk G.toGraph x b) : (GraphWalk.cons hl t).length + = t.length + 1 := by + simp [GraphWalk.length] + +omit [T2Space Shat] in +theorem GraphWalk.meet_of_simple_append {G : Drawing Shat} {a b c : Shat} + (P : GraphWalk G.toGraph a b) (Q : GraphWalk G.toGraph b c) (hs : (P.append Q).IsSimple) {y : + Shat} + (h₁ : y ∈ P.support) (h₂ : y ∈ Q.support) : y = b := by + by_contra hne + have hn : (P.support ++ Q.support.tail).Nodup := by + have h' : (P.append Q).support.Nodup := hs + rwa [GraphWalk.support_append] at h' + have hy : y ∈ Q.support.tail := by + cases Q with + | nil h => + rw [GraphWalk.support_nil, List.mem_singleton] at h₂ + exact (hne h₂).elim + | cons hl t => + rw [GraphWalk.support_cons] at h₂ ⊢ + simpa [hne] using h₂ + exact (List.nodup_append.mp hn).2.2 y h₁ y hy rfl + +omit [T2Space Shat] in +/-- A walk splits at each vertex position, with named ends. -/ +theorem GraphWalk.exists_split_vertex {G : Drawing Shat} {a b z : Shat} + (K : GraphWalk G.toGraph a b) {p : ℕ} (hp : p ≤ K.length) (hz : z = GraphWalk.vertexAt K p) : + ∃ (P : GraphWalk G.toGraph a z) (Q : GraphWalk G.toGraph z b), P.length = p ∧ Q.length + p + = K.length := by + subst hz + obtain ⟨P, Q, h, hl⟩ := GraphWalk.exists_split_at K hp + refine ⟨P, Q, hl, ?_⟩ + conv_rhs => rw [h, GraphWalk.length_append] + omega + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r u h v v₁ v₂ : Shat} + {f f₁ f₂ : Set Shat} {Δv : Set Shat} {Dv : Drawing Shat} + {A₁ : GraphWalk D.rad.G.toGraph v₁ u} {A₂ : GraphWalk D.rad.G.toGraph v₂ u} {T : GraphWalk + D.rad.G.toGraph u h} + +omit [T2Space Shat] in +theorem hatV_of_link (hr : r ∈ D.rad.Rstar) (hl : D.rad.G.toGraph.IsLink f r v) : v ∈ D.P.Γ.hatV + cap := by + have h₁ := D.even_length_walk (.cons hl (.nil hl.2.2.1)) + have h₂ : ¬ Even (GraphWalk.cons hl (.nil hl.2.2.1)).length := by + simp [GraphWalk.length, GraphWalk.edges] + have h₃ : r ∉ D.P.Γ.hatV cap := hr.2 + tauto + +/-- The sides of the bigon of a fan. -/ +def fanSide (hl₁ : D.rad.G.toGraph.IsLink f₁ r v₁) (hl₂ : D.rad.G.toGraph.IsLink f₂ r v₂) + (A₁ : GraphWalk D.rad.G.toGraph v₁ u) (A₂ : GraphWalk D.rad.G.toGraph v₂ u) : + Bool → GraphWalk D.rad.G.toGraph r u + | false => .cons hl₁ A₁ + | true => .cons hl₂ A₂ + +theorem IsFan.length_eq (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) : + A₁.length = A₂.length := by + have h₁ := hf.hub.spoke_length hf.spoke₁ + have h₂ := hf.hub.spoke_length hf.spoke₂ + rw [GraphWalk.length_append] at h₁ h₂ + have e₁ := D.even_length_walk (A₁.append T) + have e₂ := D.even_length_walk (A₂.append T) + have hv₁ := hatV_of_link hf.r_mem hf.link₁ + have hv₂ := hatV_of_link hf.r_mem hf.link₂ + rw [GraphWalk.length_append] at e₁ e₂ + have hev : Even (A₁.length + T.length) ↔ Even (A₂.length + T.length) := by tauto + rw [Nat.even_iff, Nat.even_iff] at hev + omega + +/-- No walk from a side of the bigon is shorter than the difference of positions. This uses that +spokes are shortest, for a walk starting at `r` with (13.1). -/ +theorem IsFan.far_aux (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + {v v' : Shat} {g g' : Set Shat} {A : GraphWalk D.rad.G.toGraph v u} {A' : GraphWalk + D.rad.G.toGraph v' u} (hl : D.rad.G.toGraph.IsLink g r v) (hl' : D.rad.G.toGraph.IsLink g' r + v') + (hs : D.IsSpokeWalk W H (A.append T)) (hlen : A.length + = A₁.length) (hlen' : A'.length = A₁.length) {p q : ℕ} (hpq : p ≤ q) (hq : q ≤ + (GraphWalk.cons hl' A').length) + (K : GraphWalk D.rad.G.toGraph (GraphWalk.vertexAt (.cons hl A) p) (GraphWalk.vertexAt + (.cons hl' A') q)) : q - p ≤ K.length := by + have hc' := GraphWalk.length_cons' hl' A' + obtain ⟨P', Q', hP', hQ'⟩ := GraphWalk.exists_split_vertex (GraphWalk.cons hl' A') hq rfl + have hW := hf.hub + have hsl := hW.spoke_length hs + rw [GraphWalk.length_append] at hsl + cases p with + | zero => + have e : GraphWalk.vertexAt (GraphWalk.cons hl A) 0 = r := GraphWalk.vertexAt_zero _ + revert K + rw [e] + intro K + have hW₂ := hf.walk_from_r hs.2.h_mem (K.append (Q'.append T)) + rw [GraphWalk.length_append, GraphWalk.length_append] at hW₂ + have e₁ := D.even_length_walk K + have e₂ := D.even_length_walk P' + rw [hP'] at e₂ + have hev : Even K.length ↔ Even q := by rw [e₁, e₂] + rw [Nat.even_iff, Nat.even_iff] at hev + omega + | succ p => + have hp₀ : p ≤ A.length := by + have := GraphWalk.length_cons' hl' A' + omega + revert K + rw [GraphWalk.vertexAt_cons] + intro K + obtain ⟨P, Q, hP, hQ⟩ := GraphWalk.exists_split_vertex A hp₀ rfl + have hb := hs.2.v_mem.2 + have := (IsSpokeWalk.le_walk_of_bd hW hbdS hin hs (P.append (K.append + (Q'.append T))) hl.2.2.1 hb).1 + rw [GraphWalk.length_append, GraphWalk.length_append, GraphWalk.length_append, + GraphWalk.length_append] at this + omega + +theorem IsFan.isBigon (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) : + D.IsBigon (fanSide hf.link₁ hf.link₂ A₁ A₂) := by + have hlen := hf.length_eq + have hr₁ := hf.r_notMem_spoke hf.spoke₁ + have hr₂ := hf.r_notMem_spoke hf.spoke₂ + have hnot : ∀ {v : Shat} {A : GraphWalk D.rad.G.toGraph v u}, r ∉ (A.append T).support + → r ∉ A.support := fun hn hm ↦ hn ((GraphWalk.mem_support_append _ _).mpr (.inl hm)) + have hsim : ∀ {v g} (hl : D.rad.G.toGraph.IsLink g r v) (A : GraphWalk D.rad.G.toGraph v u), + (A.append T).IsSimple → r ∉ (A.append T).support → (GraphWalk.cons hl A).IsSimple + := fun hl A hs hn ↦ by + have h₁ : A.support.Nodup := (isSimple_of_append hs).1 + change (GraphWalk.cons hl A).support.Nodup + rw [GraphWalk.support_cons] + exact List.nodup_cons.mpr ⟨hnot hn, h₁⟩ + refine ⟨hf.r_mem, fun e ↦ hnot hr₁ (e ▸ A₁.end_mem_support), ?_, ?_, ?_, ?_⟩ + · rintro (_ | _) + · exact hsim _ _ hf.spoke₁.1 hr₁ + · exact hsim _ _ hf.spoke₂.1 hr₂ + · rintro (_ | _) (_ | _) <;> simp [fanSide, hlen] + · have key : ∀ y, y ∈ (fanSide hf.link₁ hf.link₂ A₁ A₂ false).support → y ∈ + (fanSide hf.link₁ hf.link₂ A₁ A₂ true).support → y = r ∨ y = u := fun y h₁ h₂ ↦ by + simp only [fanSide, GraphWalk.support_cons, List.mem_cons] at h₁ h₂ + rcases h₁ with h₁ | h₁ + · exact .inl h₁ + rcases h₂ with h₂ | h₂ + · exact .inl h₂ + exact .inr (hf.meet y h₁ h₂) + rintro (_ | _) (_ | _) hne y h₁ h₂ + · exact absurd rfl hne + · exact key y h₁ h₂ + · exact key y h₂ h₁ + · exact absurd rfl hne + · rintro (_ | _) (_ | _) p q hpq hq K + · exact hf.far_aux hbdS hin hf.link₁ hf.link₁ hf.spoke₁ rfl rfl hpq hq K + · exact hf.far_aux hbdS hin hf.link₁ hf.link₂ hf.spoke₁ rfl hlen.symm hpq hq K + · exact hf.far_aux hbdS hin hf.link₂ hf.link₁ hf.spoke₂ hlen.symm rfl hpq hq K + · exact hf.far_aux hbdS hin hf.link₂ hf.link₂ hf.spoke₂ hlen.symm hlen.symm hpq hq K + +/-- The common part of the two spokes is outside the disc, apart from `u`, by (13.4). -/ +theorem IsFan.off_disc (hopt : D.IsOptimalWheelHub W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ Dv) + (hs : D.IsBoundarySector W H r Δv Dv) {y : Shat} (hy : y ∈ T.support) (hne : y ≠ u) : y ∉ Δv + := by + intro hyΔ + have hS₁ := hf.spoke₁ + have hS₂ := hf.spoke₂ + have hu₁ : u ∈ (A₁.append T).support := (GraphWalk.mem_support_append _ _).mpr + (.inl A₁.end_mem_support) + have hu₂ : u ∈ (A₂.append T).support := (GraphWalk.mem_support_append _ _).mpr + (.inl A₂.end_mem_support) + have hQV : (walkDrawing D.rad.G T).V = (walkDrawing D.rad.G (A₁.append T)).V ∩ + (walkDrawing D.rad.G (A₂.append T)).V := by + ext x + simp only [walkDrawing_V, mem_inter_iff, mem_ofPred_eq, GraphWalk.mem_support_append] + constructor + · exact fun h' ↦ ⟨.inr h', .inr h'⟩ + · rintro ⟨h₁ | h₁, h₂ | h₂⟩ + · exact hf.meet x h₁ h₂ ▸ T.start_mem_support + · exact h₂ + · exact h₁ + · exact h₁ + have hQE : (walkDrawing D.rad.G T).E = (walkDrawing D.rad.G (A₁.append T)).E ∩ + (walkDrawing D.rad.G (A₂.append T)).E := by + ext e + simp only [walkDrawing_E, mem_inter_iff, mem_ofPred_eq, GraphWalk.edges_append, List.mem_append] + constructor + · exact fun h' ↦ ⟨.inr h', .inr h'⟩ + · rintro ⟨h₁ | h₁, h₂ | h₂⟩ + · exact absurd h₂ (hf.edges_disjoint e h₁) + · exact h₂ + · exact h₁ + · exact h₁ + have hsT : T.IsSimple := (isSimple_of_append hS₁.1).2 + have hQ : Drawing.IsPathOf (walkDrawing D.rad.G T) D.rad.G u h := ⟨walkDrawing_isSubdrawing _ _, + walkDrawing_isPathBetween _ hsT⟩ + have hbd : discBd Δv = ((walkDrawing D.rad.G (A₁.append T)).U ∪ (walkDrawing D.rad.G + (A₂.append T)).U) \ ((walkDrawing D.rad.G (A₁.append T)).U ∩ (walkDrawing D.rad.G + (A₂.append T)).U) ∪ {u} ∪ closure f₁ ∪ closure f₂ := by + rw [hf.formula_eq hC, hs.Dv_U] + have hl₁ : f₁ ∈ D.rad.G.E ∧ tilde f₁ = {r, v₁} := ⟨hf.link₁.1, by + rw [← closure_inter_V_eq_tilde hf.link₁.1] + exact hf.link₁.2.2.2⟩ + have hl₂ : f₂ ∈ D.rad.G.E ∧ tilde f₂ = {r, v₂} := ⟨hf.link₂.1, by + rw [← closure_inter_V_eq_tilde hf.link₂.1] + exact hf.link₂.2.2.2⟩ + have h13 := theorem_13_4_proof hopt hbdS hin ⟨hf.r_mem, hf.r_bd⟩ hf.ne hl₁.1 hl₁.2 + hl₂.1 hl₂.2 hS₁.2 hS₂.2 + hQ hQV hQE ⟨u, by rwa [walkDrawing_V], by rwa [walkDrawing_V]⟩ hs.is_disc hs.Δv_sub hbd + have hyS : y ∈ (A₁.append T).support := (GraphWalk.mem_support_append _ _).mpr (.inr hy) + have hb : y ∈ discBd Δv := h13.2.2 _ _ _ hS₁.2 ⟨hyΔ, (mem_walkDrawing_U _ _).mpr (.inl hyS)⟩ + rw [hs.Dv_U.symm] at hb + have hyG : y ∈ D.rad.G.V := T.mem_vertexSet_of_mem_support hy + rcases (hC.mem_V y).mp (mem_V_of_mem_U hC.circuit.1 hb hyG) with rfl | h₁ | h₂ + · exact hf.r_notMem_spoke hS₁ hyS + · exact hne (GraphWalk.meet_of_simple_append _ _ hS₁.1 h₁ hy) + · exact hne (GraphWalk.meet_of_simple_append _ _ hS₂.1 h₂ hy) + +omit [T2Space S] in +theorem IsFan.bd_eq_sides (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ + Dv) (hU : discBd Δv = Dv.U) : + discBd Δv = ⋃ i, (walkDrawing D.rad.G (fanSide hf.link₁ hf.link₂ A₁ A₂ i)).U := by + have hside : ∀ {v g} (hl : D.rad.G.toGraph.IsLink g r v) (A : GraphWalk D.rad.G.toGraph v u), + (walkDrawing D.rad.G (.cons hl A)).U = (walkDrawing D.rad.G A).U ∪ closure g + := fun {v g} hl A ↦ by + ext x + simp only [mem_walkDrawing_U, GraphWalk.support_cons, List.mem_cons, GraphWalk.edges_cons, + mem_union, exists_eq_or_imp] + have hr : r ∈ closure g ∩ D.rad.G.V := by rw [hl.2.2.2]; exact .inl rfl + constructor + · rintro ((rfl | h₁) | (h₁ | ⟨e, he, hxe⟩)) + · exact .inr hr.1 + · exact .inl (.inl h₁) + · exact .inr h₁ + · exact .inl (.inr ⟨e, he, hxe⟩) + · rintro ((h₁ | ⟨e, he, hxe⟩) | h₁) + · exact .inl (.inr h₁) + · exact .inr (.inr ⟨e, he, hxe⟩) + · exact .inr (.inl h₁) + rw [hU, hf.U_eq hC] + ext x + simp only [mem_iUnion, Bool.exists_bool, fanSide, hside, mem_union] + tauto + +/-- **(13.7)**. Let the spokes of `v₁, v₂` meet. The vertices of `Γ` on a spoke are those at even +position. There are mutually disjoint vertex sets `P j`, one for each even position `2 * j` on the +spokes, such +that either the two vertices at that position are the same vertex, on both spokes, and `P j` is this +vertex, or neither is on the other spoke, and `P j` holds a path between them of +`sk(Γ)` in `Δ_v`. -/ +theorem IsFan.theorem_13_7_proof (hopt : D.IsOptimalWheelHub W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hC : D.IsFanCircuit r f₁ f₂ A₁ A₂ Dv) + (hs : D.IsBoundarySector W H r Δv Dv) : + ∃ (Sk : Drawing Shat) (G : Drawing Δv), D.IsSkPart Δv Sk G ∧ ∃ P : ℕ → Set Shat, + (∀ j k, 2 * j ≤ (A₁.append T).length → 2 * k ≤ (A₁.append T).length → j ≠ k → Disjoint (P j) + (P k)) ∧ + ∀ j, 2 * j ≤ (A₁.append T).length → + (GraphWalk.vertexAt (A₁.append T) (2 * j) = GraphWalk.vertexAt (A₂.append T) (2 * j) + ∧ GraphWalk.vertexAt (A₁.append T) (2 * j) ∈ (A₁.append T).support ∧ + GraphWalk.vertexAt (A₁.append T) (2 * j) ∈ (A₂.append T).support ∧ P j + = {GraphWalk.vertexAt (A₁.append T) (2 * j)}) ∨ + (GraphWalk.vertexAt (A₁.append T) (2 * j) ∉ (A₂.append T).support ∧ GraphWalk.vertexAt + (A₂.append T) (2 * j) ∉ (A₁.append T).support ∧ P j ⊆ Δv ∧ + ∃ a b : Δv, a.1 = GraphWalk.vertexAt (A₁.append T) (2 * j) ∧ b.1 = GraphWalk.vertexAt + (A₂.append T) (2 * j) ∧ + ∃ K : GraphWalk G.toGraph a b, K.IsSimple ∧ ∀ z ∈ K.support, z.1 ∈ P j) := by + classical + have hlen := hf.length_eq + have hbdU : discBd Δv ⊆ D.rad.G.U := by + rw [← hs.Dv_U] + exact hC.circuit.1.U_subset + obtain ⟨Sk, G, hsk⟩ := D.exists_isSkPart hs.is_disc hbdU + have hBD : D.IsBigonDisc (fanSide hf.link₁ hf.link₂ A₁ A₂) Δv Sk G := ⟨hf.isBigon hbdS hin, hsk, + hs.is_disc, hf.bd_eq_sides hC hs.Dv_U.symm⟩ + obtain ⟨Q, hdis, hQ⟩ := hBD.exists_paths + set L := A₁.length with hL + have hB : (fanSide hf.link₁ hf.link₂ A₁ A₂ false).length = L + 1 := GraphWalk.length_cons' _ _ + have hn : (A₁.append T).length = L + T.length := GraphWalk.length_append _ _ + have hn₂ : (A₂.append T).length = L + T.length := by rw [GraphWalk.length_append, ← hlen] + have left₁ : ∀ j, 2 * j ≤ L → GraphWalk.vertexAt (A₁.append T) (2 * j) = GraphWalk.vertexAt + (fanSide hf.link₁ hf.link₂ A₁ A₂ false) (2 * j + 1) := fun j hj ↦ + (GraphWalk.vertexAt_append_left _ _ hj).trans (GraphWalk.vertexAt_cons _ _ _).symm + have left₂ : ∀ j, 2 * j ≤ L → GraphWalk.vertexAt (A₂.append T) (2 * j) = GraphWalk.vertexAt + (fanSide hf.link₁ hf.link₂ A₁ A₂ true) (2 * j + 1) := fun j hj ↦ + (GraphWalk.vertexAt_append_left _ _ (hlen ▸ hj)).trans (GraphWalk.vertexAt_cons _ _ _).symm + have right₁ : ∀ t, t ≤ T.length → GraphWalk.vertexAt (A₁.append T) (L + t) + = GraphWalk.vertexAt T t := fun t ht ↦ GraphWalk.vertexAt_append_right _ _ ht + have right₂ : ∀ t, t ≤ T.length → GraphWalk.vertexAt (A₂.append T) (L + t) + = GraphWalk.vertexAt T t := fun t ht ↦ by + rw [hlen] + exact GraphWalk.vertexAt_append_right _ _ ht + have hat₁ : GraphWalk.vertexAt (A₁.append T) L = u := GraphWalk.vertexAt_append _ _ + have hother : ∀ {v v' : Shat} (A : GraphWalk D.rad.G.toGraph v u) (A' : GraphWalk D.rad.G.toGraph + v' u), (A.append T).IsSimple → (A'.append T).IsSimple → A.length = L → + (∀ y, y ∈ A.support → y ∈ A'.support → y = u) → ∀ j, 2 * j < L → GraphWalk.vertexAt + (A.append T) (2 * j) ∉ (A'.append T).support := fun {v v'} A A' hs₁ hs₂ hAL hm j hj hmem ↦ + by + have hx : GraphWalk.vertexAt (A.append T) (2 * j) ∈ A.support := by + rw [GraphWalk.vertexAt_append_left _ _ (by omega)] + exact GraphWalk.vertexAt_mem _ (by omega) + have hu : GraphWalk.vertexAt (A.append T) (2 * j) = u := by + rcases (GraphWalk.mem_support_append _ _).mp hmem with h' | h' + · exact hm _ hx h' + · exact GraphWalk.meet_of_simple_append _ _ hs₁ hx h' + have he : GraphWalk.vertexAt (A.append T) A.length = u := GraphWalk.vertexAt_append _ _ + have hlA : (A.append T).length = A.length + T.length := GraphWalk.length_append _ _ + have := GraphWalk.vertexAt_inj _ hs₁ (p := 2 * j) (q := A.length) (by omega) (by omega) + (hu.trans he.symm) + omega + have hTj : ∀ j, L ≤ 2 * j → 2 * j ≤ (A₁.append T).length → GraphWalk.vertexAt (A₁.append T) + (2 * j) ∈ T.support := fun j h₁ h₂ ↦ by + have e := right₁ (2 * j - L) (by omega) + rw [show L + (2 * j - L) = 2 * j by omega] at e + rw [e] + exact GraphWalk.vertexAt_mem _ (by omega) + let parts (j : ℕ) : Set Shat := + if 2 * j < L then Subtype.val '' Q j else {GraphWalk.vertexAt (A₁.append T) (2 * j)} + refine ⟨Sk, G, hsk, parts, ?_, fun j hj ↦ ?_⟩ + · have hcross : ∀ j k, 2 * j < L → L ≤ 2 * k → 2 * k ≤ (A₁.append T).length → GraphWalk.vertexAt + (A₁.append T) (2 * k) ∉ Subtype.val '' Q j := fun j k hj hk hk' ⟨z, hz, e⟩ ↦ by + have hzT := hTj k hk hk' + have hzΔ : GraphWalk.vertexAt (A₁.append T) (2 * k) ∈ Δv := e ▸ z.2 + by_cases hu : GraphWalk.vertexAt (A₁.append T) (2 * k) = u + · have hk2 : 2 * k = L := GraphWalk.vertexAt_inj _ hf.spoke₁.1 hk' (by omega) + (hu.trans hat₁.symm) + have hmem : z ∈ block (fanSide hf.link₁ hf.link₂ A₁ A₂) Δv k := by + refine ⟨false, ?_⟩ + simp only + rw [e, ← left₁ k (by omega)] + exact disjoint_left.mp (hdis j k (by omega) (by omega) (by omega)) hz ((hQ k + (by omega)).1 hmem) + · exact hf.off_disc hopt hbdS hin hC hs hzT hu hzΔ + intro j k hj hk hjk + by_cases h₁ : 2 * j < L <;> by_cases h₂ : 2 * k < L + · simp only [parts, h₁, h₂, ite_true] + exact (disjoint_image_iff Subtype.val_injective).mpr (hdis j k (by omega) (by omega) hjk) + · simp only [parts, h₁, h₂, ite_true, ite_false] + exact disjoint_singleton_right.mpr (hcross j k h₁ (by omega) hk) + · simp only [parts, h₁, h₂, ite_true, ite_false] + exact disjoint_singleton_left.mpr (hcross k j h₂ (by omega) hj) + · simp only [parts, h₁, h₂, ite_false] + refine disjoint_singleton.mpr fun e ↦ hjk ?_ + have := GraphWalk.vertexAt_inj _ hf.spoke₁.1 hj hk e + omega + · by_cases h₁ : 2 * j < L + · right + simp only [parts, h₁, ite_true] + have hj' : 2 * j + 1 ≤ (fanSide hf.link₁ hf.link₂ A₁ A₂ false).length := by omega + have m₁ : GraphWalk.vertexAt (A₁.append T) (2 * j) ∈ Δv := by + rw [left₁ j (by omega)] + exact Surface.discBd_subset _ (hBD.vertex_mem hj') + have m₂ : GraphWalk.vertexAt (A₂.append T) (2 * j) ∈ Δv := by + rw [left₂ j (by omega)] + exact Surface.discBd_subset _ (hBD.vertex_mem hj') + have b₁ : (⟨_, m₁⟩ : Δv) ∈ block (fanSide hf.link₁ hf.link₂ A₁ A₂) Δv j := ⟨false, (left₁ j + (by omega)).symm⟩ + have b₂ : (⟨_, m₂⟩ : Δv) ∈ block (fanSide hf.link₁ hf.link₂ A₁ A₂) Δv j := ⟨true, (left₂ j + (by omega)).symm⟩ + obtain ⟨K, hKs, hK⟩ := (hQ j hj').2 _ b₁ _ b₂ + refine ⟨hother A₁ A₂ hf.spoke₁.1 hf.spoke₂.1 rfl hf.meet j h₁, hother A₂ A₁ hf.spoke₂.1 + hf.spoke₁.1 hlen.symm (fun y h₂ h₃ ↦ hf.meet y h₃ h₂) j h₁, ?_, _, _, rfl, rfl, K, hKs, fun + z hz ↦ ⟨z, hK z hz, rfl⟩⟩ + rintro _ ⟨z, -, rfl⟩ + exact z.2 + · left + simp only [parts, h₁, ite_false, and_true] + have e₁ := right₁ (2 * j - L) (by omega) + have e₂ := right₂ (2 * j - L) (by omega) + rw [show L + (2 * j - L) = 2 * j by omega] at e₁ e₂ + have heq := e₁.trans e₂.symm + refine ⟨heq, GraphWalk.vertexAt_mem _ hj, ?_⟩ + rw [heq] + exact GraphWalk.vertexAt_mem _ (by omega) + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14a.lean b/LeanPool/GraphMinor/GM19/Section14a.lean new file mode 100644 index 0000000000..91f79a2feb --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14a.lean @@ -0,0 +1,326 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section13zf +public import LeanPool.GraphMinor.Surface.Fan +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Graph Minors XIX, Section 14: sectors exist + +The two spokes at a vertex of `R* ∩ bd(W)` give the sector `Δ_v` of page 368. The paper takes this +as seen. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +omit [T2Space Shat] in +theorem GraphWalk.support_of_closed {G : Drawing Shat} {a : Shat} (T : GraphWalk G.toGraph a a) + (hs : T.IsSimple) {y : Shat} (hy : y ∈ T.support) : y = a := by + cases T with + | nil h => simpa using hy + | cons hl t => + exfalso + have h₁ : (GraphWalk.cons hl t).support.Nodup := hs + rw [GraphWalk.support_cons, List.nodup_cons] at h₁ + exact h₁.1 t.end_mem_support + + +section Chord + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +omit [T2Space T] in +/-- A line with ends `a, b` is more than its ends. -/ +theorem IsLineWithEnds.diff_nonempty {L : Set T} {a b : T} (hl : IsLineWithEnds L a b) : + (L \ {a, b}).Nonempty := + Surface.IsLineWithEnds.nonempty_sdiff hl + +/-- If an `O`-arc is two lines with the same ends then a third line with those ends in the `O`-arc +is one of the two. -/ +theorem line_eq_of_two_lines {P Q J : Set T} {a b : T} (hP : IsLineWithEnds P a b) + (hQ : IsLineWithEnds Q a b) (hPQ : P ∩ Q = {a, b}) + (hJ : IsLineWithEnds J a b) (hsub : J ⊆ P ∪ Q) : J = P ∨ J = Q := by + have hc := hJ.isPreconnected_diff + have hcl₁ : IsClosed P := hP.isCompact.isClosed + have hcl₂ : IsClosed Q := hQ.isCompact.isClosed + have hcov : J \ {a, b} ⊆ P ∪ Q := sdiff_subset.trans hsub + have hmem : ∀ {X : Set T}, IsLineWithEnds X a b → J \ {a, b} ⊆ X → J = X := fun {X} hl hs ↦ by + refine hl.eq_of_subset (GraphMinor.GM19.IsLineWithEnds.isPreconnected' hJ) + (fun y hy ↦ ?_) hJ.left_mem hJ.right_mem + by_cases hy' : y ∈ ({a, b} : Set T) + · rcases hy' with rfl | hy' + · exact hl.left_mem + · rw [mem_singleton_iff.mp hy'] + exact hl.right_mem + · exact hs ⟨hy, hy'⟩ + by_cases h₁ : J \ {a, b} ⊆ P + · exact .inl (hmem hP h₁) + by_cases h₂ : J \ {a, b} ⊆ Q + · exact .inr (hmem hQ h₂) + exfalso + obtain ⟨x, hx, hxn⟩ := not_subset.mp h₁ + obtain ⟨y, hy, hyn⟩ := not_subset.mp h₂ + obtain ⟨z, hz, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp hc P Q hcl₁ hcl₂ hcov ⟨y, hy, + (hcov hy).resolve_right hyn⟩ + ⟨x, hx, (hcov hx).resolve_left hxn⟩ + exact hz.2 (hPQ ▸ ⟨hz₁, hz₂⟩) + +/-- A line on `bd(W)` and a chord of `W` with the same ends cut `W` into two discs, one of them +bounded by the line and the chord. This is `disc_iArc`, with the part of `bd(W)` named. -/ +theorem exists_chord_discs_of_lines {W P Q Y Z : Set T} {a b : T} (hW : IsClosedDisc W) + (hlP : IsLineWithEnds P a b) + (hlQ : IsLineWithEnds Q a b) (hPQ : P ∩ Q = {a, b}) (hUU : discBd W = P ∪ Q) + (hlY : IsLineWithEnds Y a b) (hYb : Y ⊆ discBd W) + (hlZ : IsLineWithEnds Z a b) (hZW : Z ⊆ W) (hZb : Z ∩ discBd W = {a, b}) : + ∃ Δ₁ Δ₂, IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ Δ₁ ∪ Δ₂ = W ∧ Δ₁ ∩ Δ₂ = Z ∧ discBd Δ₁ = Y ∪ Z + ∧ discBd Δ₂ = (discBd W \ (Y \ {a, b})) ∪ Z := by + have hab : a ≠ b := hlY.ne' + obtain ⟨A₁, A₂, Δ₁, Δ₂, hA, hc, d₁, d₂, hu, hi, b₁, b₂, -⟩ := disc_iArc W Z a b hW hZW hab hlZ hZb + -- `Y` is one of the two arcs. Name the other `Y'`. + obtain ⟨Y', hlY', hYY, hUY⟩ : ∃ Y', IsLineWithEnds Y' a b ∧ Y ∩ Y' = {a, b} ∧ discBd W = Y ∪ Y' + := by + rcases line_eq_of_two_lines hlP hlQ hPQ hlY (hUU ▸ hYb) with rfl | rfl + · exact ⟨Q, hlQ, hPQ, hUU⟩ + · exact ⟨P, hlP, by rw [Set.inter_comm]; exact hPQ, by rw [Set.union_comm]; exact hUU⟩ + have hY : discBd W \ {a, b} = (Y \ {a, b}) ∪ (Y' \ {a, b}) := by rw [hUY, union_sdiff_distrib] + have hdj : Disjoint (Y \ {a, b}) (Y' \ {a, b}) := disjoint_left.mpr fun y h₁ h₂ ↦ h₁.2 + (hYY ▸ ⟨h₁.1, h₂.1⟩) + have hab_sub : ∀ {X : Set T}, IsLineWithEnds X a b → (X \ {a, b}) ∪ {a, b} = X := fun {X} hl ↦ by + rw [sdiff_union_self, union_eq_left] + rintro y (rfl | hy) + · exact hl.left_mem + · rw [mem_singleton_iff.mp hy] + exact hl.right_mem + have hsZ : ({a, b} : Set T) ⊆ Z := by + rintro y (rfl | hy) + · exact hlZ.left_mem + · rw [mem_singleton_iff.mp hy] + exact hlZ.right_mem + have hadd : ∀ {X : Set T}, IsLineWithEnds X a b → (X \ {a, b}) ∪ Z = X ∪ Z := fun {X} hl ↦ by + conv_rhs => rw [← hab_sub hl, Set.union_assoc, union_eq_right.mpr hsZ] + have hrest : discBd W \ (Y \ {a, b}) = Y' := by + ext y + constructor + · rintro ⟨hy, hn⟩ + rcases hUY ▸ hy with h | h + · by_cases hy' : y ∈ ({a, b} : Set T) + · exact hYY ▸ hy' |>.2 + · exact absurd ⟨h, hy'⟩ hn + · exact h + · intro hy + refine ⟨hUY ▸ .inr hy, fun h ↦ h.2 (hYY ▸ ⟨h.1, hy⟩)⟩ + rcases comps_two hA hc hY hdj hlY.isPreconnected_diff hlY'.isPreconnected_diff + (GraphMinor.GM19.IsLineWithEnds.diff_nonempty hlY) + (GraphMinor.GM19.IsLineWithEnds.diff_nonempty hlY') with ⟨e₁, e₂⟩ | ⟨e₁, e₂⟩ + · refine ⟨Δ₁, Δ₂, d₁, d₂, hu, hi, ?_, ?_⟩ + · rw [b₁, e₁, hadd hlY] + · rw [b₂, e₂, hadd hlY', hrest] + · refine ⟨Δ₂, Δ₁, d₂, d₁, by rwa [Set.union_comm], + by rwa [Set.inter_comm], ?_, ?_⟩ + · rw [b₂, e₂, hadd hlY] + · rw [b₁, e₁, hadd hlY', hrest] + +variable [ConnectedSpace T] + +omit [ConnectedSpace T] in +/-- Two paths whose union is a drawing cover it. -/ +theorem paths_U_union {F P Q : Drawing T} (hPs : P.IsSubdrawing F) (hQs : Q.IsSubdrawing F) + (hsup : F.sup P Q = F) : F.U = P.U ∪ Q.U := by + apply subset_antisymm + · intro y hy + rw [← hsup, Drawing.U_eq, Drawing.sup_V hPs hQs, Drawing.sup_E hPs hQs] at hy + rcases hy with h' | h' + · rcases h' with h'' | h'' + · exact .inl (P.V_subset_U h'') + · exact .inr (Q.V_subset_U h'') + · obtain ⟨e, he, hye⟩ : ∃ e ∈ P.E ∪ Q.E, y ∈ closure e := by simpa using h' + rcases he with h'' | h'' + · exact .inl (P.closure_subset_U h'' hye) + · exact .inr (Q.closure_subset_U h'' hye) + · exact union_subset hPs.U_subset hQs.U_subset + +omit [ConnectedSpace T] in +/-- Two paths of a drawing with disjoint edges meet in `U` only where they meet in vertices. -/ +theorem paths_U_inter {F P Q : Drawing T} {a b : T} (hPs : P.IsSubdrawing F) + (hQs : Q.IsSubdrawing F) (hPQ : P.V ∩ Q.V = {a, b}) (hE : Disjoint P.E Q.E) + (hlP : IsLineWithEnds P.U a b) (hlQ : IsLineWithEnds Q.U a b) : P.U ∩ Q.U = {a, b} := by + apply subset_antisymm + · rintro y ⟨hyP, hyQ⟩ + by_cases hV : y ∈ F.V + · have h : y ∈ P.V ∩ Q.V := ⟨mem_V_of_mem_U hPs hyP hV, mem_V_of_mem_U hQs hyQ hV⟩ + rwa [hPQ] at h + · exfalso + rw [Drawing.U_eq] at hyP + rcases hyP with h' | h' + · exact hV (hPs.1 h') + obtain ⟨e, he, hye⟩ : ∃ e ∈ P.E, y ∈ closure e := by simpa using h' + have hye' : y ∈ e := (closure_edge_subset (hPs.2 he) hye).resolve_right hV + have heQ : e ∉ Q.E := fun h'' ↦ disjoint_left.mp hE he h'' + exact disjoint_left.mp (edge_disjoint_U hQs (hPs.2 he) heQ) hye' hyQ + · rintro y (rfl | hy) + · exact ⟨hlP.left_mem, hlQ.left_mem⟩ + · rw [mem_singleton_iff.mp hy] + exact ⟨hlP.right_mem, hlQ.right_mem⟩ + +/-- Graph form of `exists_chord_discs_of_lines`. -/ +theorem exists_chord_discs {G : Drawing T} {W : Set T} (hW : IsClosedDisc W) + (hG : discBd W ⊆ G.U) {a b : T} (hab : a ≠ b) + {Y Z : GraphWalk G.toGraph a b} (hY : Y.IsSimple) (hZ : Z.IsSimple) (hYb : + (walkDrawing G Y).U ⊆ discBd W) + (hZW : (walkDrawing G Z).U ⊆ W) (hZb : (walkDrawing G Z).U ∩ discBd W = {a, b}) : + ∃ Δ₁ Δ₂, IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ Δ₁ ∪ Δ₂ = W ∧ Δ₁ ∩ Δ₂ = (walkDrawing G Z).U ∧ + discBd Δ₁ = (walkDrawing G Y).U ∪ (walkDrawing G Z).U ∧ + discBd Δ₂ = (discBd W \ ((walkDrawing G Y).U \ {a, b})) ∪ (walkDrawing G Z).U := by + classical + have hlY := isLine_of_isPathBetween (walkDrawing_isPathBetween G hY) hab + have hlZ := isLine_of_isPathBetween (walkDrawing_isPathBetween G hZ) hab + obtain ⟨F, hFc, hFs, hFU⟩ := exists_circuit_of_oArc hW.isOArc_discBd hG + have haV : a ∈ F.V := mem_V_of_mem_U hFs (hFU ▸ hYb hlY.left_mem) (Y.mem_vertexSet_of_mem_support + Y.start_mem_support) + have hbV : b ∈ F.V := mem_V_of_mem_U hFs (hFU ▸ hYb hlY.right_mem) + (Y.mem_vertexSet_of_mem_support Y.end_mem_support) + obtain ⟨P, Q, hP, hQ, hPs, hQs, -, -, hPQ, hE, hsup⟩ := Drawing.IsCircuit.exists_two_paths hFc + haV hbV hab + have hlP := isLine_of_isPathBetween hP hab + have hlQ := isLine_of_isPathBetween hQ hab + have hPQU : P.U ∩ Q.U = {a, b} := paths_U_inter hPs hQs hPQ hE hlP hlQ + have hUU : discBd W = P.U ∪ Q.U := hFU ▸ paths_U_union hPs hQs hsup + exact exists_chord_discs_of_lines hW hlP hlQ hPQU hUU hlY hYb hlZ hZW hZb + +end Chord + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} + +omit [T2Space Shat] in +theorem mem_support_of_mem_closure_edge {G : Drawing Shat} {a b x : Shat} + (t : GraphWalk G.toGraph a b) {e : Set Shat} (he : e ∈ t.edges) + (hx : x ∈ closure e) (hV : x ∈ G.V) : x ∈ t.support := by + induction t with + | nil h => simp [GraphWalk.edges] at he + | cons hl q ih => + rw [GraphWalk.edges_cons, List.mem_cons] at he + rw [GraphWalk.support_cons, List.mem_cons] + rcases he with rfl | he + · have hm : x ∈ closure e ∩ G.V := ⟨hx, hV⟩ + rw [hl.2.2.2] at hm + rcases hm with rfl | hm + · exact .inl rfl + · exact .inr (mem_singleton_iff.mp hm ▸ q.start_mem_support) + · exact .inr (ih he) + +theorem exists_first_edge {G F P : Drawing Shat} (hF : F.IsSubdrawing G) + (hP : P.IsSubdrawing F) {a b : Shat} (h : P.IsPathBetween a b) (hpos : 0 < P.length) + (hG : a ∈ G.V) : + ∃ f v, G.toGraph.IsLink f a v ∧ f ∈ P.E ∧ v ∈ P.V ∧ v ≠ a ∧ (v = b → ∀ y ∈ P.V, y = a ∨ y = b) + ∧ ∀ e ∈ P.E, a ∈ closure e → e = f := by + obtain ⟨Z, hs, hV, hE⟩ := h + cases Z with + | nil h' => + exfalso + rw [Drawing.length, hE] at hpos + simp at hpos + | @cons a v b f hl t => + have hfP : f ∈ P.E := by rw [hE]; simp + have hvP : v ∈ P.V := by rw [hV]; simp [GraphWalk.support_cons, t.start_mem_support] + have hs₁ : (GraphWalk.cons hl t).support.Nodup := hs + rw [GraphWalk.support_cons, List.nodup_cons] at hs₁ + have hne : v ≠ a := fun e ↦ hs₁.1 (e ▸ t.start_mem_support) + have hsub := hP.trans hF + have hfG : f ∈ G.E := hsub.2 hfP + have haP : a ∈ P.V := by rw [hV]; simp [GraphWalk.support_cons] + refine ⟨f, v, ⟨hfG, hG, hsub.1 hvP, ?_⟩, hfP, hvP, hne, ?_, ?_⟩ + · rw [closure_inter_V_eq_tilde hfG, ← closure_inter_V_eq_tilde hfP] + exact hl.2.2.2 + · rintro rfl y hy + rw [hV] at hy + have hy' : y ∈ (GraphWalk.cons hl t).support := hy + rw [GraphWalk.support_cons, List.mem_cons] at hy' + rcases hy' with rfl | hy' + · exact .inl rfl + · exact .inr (GraphWalk.support_of_closed t hs₁.2 hy') + · intro e he hae + rw [hE] at he + have he' : e ∈ (GraphWalk.cons hl t).edges := he + rw [GraphWalk.edges_cons, List.mem_cons] at he' + rcases he' with rfl | he' + · rfl + · exact absurd (mem_support_of_mem_closure_edge t he' hae haP) hs₁.1 + +/-- A vertex of `R* ∩ bd(W)` has two neighbours in `Γ* ∩ bd(W)`, because `bd(W)` is a circuit of +`Γ*` with at least three vertices of `Γ`. -/ +theorem IsWheelHubOfRadius.exists_two_bd_edges (h : D.IsWheelHubOfRadius W H ρ) + (hbd : discBd W ⊆ cap.emb '' (univ \ bd S)) (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + (hr : r ∈ D.rad.Rstar) (hrb : r ∈ discBd W) : + ∃ f₁ f₂ v₁ v₂, v₁ ≠ v₂ ∧ D.rad.G.toGraph.IsLink f₁ r v₁ ∧ D.rad.G.toGraph.IsLink f₂ r v₂ + ∧ f₁ ⊆ discBd W ∧ f₂ ⊆ discBd W ∧ + ∀ f ∈ D.rad.G.E, f ⊆ discBd W → r ∈ closure f → f = f₁ ∨ f = f₂ := by + classical + have : ConnectedSpace Shat := cap.connected + obtain ⟨F, hFc, hFs, hFU⟩ := exists_circuit_of_oArc h.is_disc.isOArc_discBd h.bd_sub + have h3 := three_le_ncard_bd h hbd hin + obtain ⟨x, y, hx, hy, hxy⟩ : ∃ x y, x ∈ discBd W ∩ D.P.Γ.hatV cap ∧ y ∈ discBd W ∩ D.P.Γ.hatV cap + ∧ x ≠ y := by + have : 1 < (discBd W ∩ D.P.Γ.hatV cap).ncard := by omega + obtain ⟨x, hx, y, hy, hne⟩ := (one_lt_ncard (D.P.Γ.finite_V.image _ |>.subset + inter_subset_right)).mp this + exact ⟨x, y, hx, hy, hne⟩ + have hV : ∀ {z}, z ∈ discBd W ∩ D.P.Γ.hatV cap → z ∈ F.V := fun hz ↦ mem_V_of_mem_U hFs + (hFU ▸ hz.1) (D.rad.isPreRadial.2.1 hz.2) + have hrF : r ∈ F.V := mem_V_of_mem_U hFs (hFU ▸ hrb) hr.1 + have hxr : r ≠ x := fun e ↦ hr.2 (e ▸ hx.2) + have hyr : r ≠ y := fun e ↦ hr.2 (e ▸ hy.2) + obtain ⟨P, Q, hP, hQ, hPs, hQs, hP0, hQ0, hPQ, -, hsup⟩ := Drawing.IsCircuit.exists_two_paths hFc + hrF (hV hx) hxr + obtain ⟨f₁, v₁, hl₁, hf₁, hv₁, hne₁, hend₁, huq₁⟩ := exists_first_edge hFs hPs hP hP0 hr.1 + obtain ⟨f₂, v₂, hl₂, hf₂, hv₂, hne₂, hend₂, huq₂⟩ := exists_first_edge hFs hQs hQ hQ0 hr.1 + have hsubU : ∀ {f}, f ∈ F.E → f ⊆ discBd W := fun hf ↦ by + rw [← hFU] + exact fun z hz ↦ F.closure_subset_U hf (subset_closure hz) + refine ⟨f₁, f₂, v₁, v₂, ?_, hl₁, hl₂, hsubU (hPs.2 hf₁), hsubU (hQs.2 hf₂), ?_⟩ + swap + · intro f hf hfb hrf + have hfF : f ∈ F.E := by + by_contra hn + obtain ⟨z, hz⟩ := hf.1 + exact disjoint_left.mp (edge_disjoint_U hFs hf hn) hz (hFU ▸ hfb hz) + have hEF : f ∈ (F.sup P Q).E := by rw [hsup]; exact hfF + rw [Drawing.sup_E hPs hQs] at hEF + rcases hEF with h' | h' + · exact .inl (huq₁ f h' hrf) + · exact .inr (huq₂ f h' hrf) + rintro rfl + have hv : v₁ ∈ P.V ∩ Q.V := ⟨hv₁, hv₂⟩ + rw [hPQ] at hv + have hvx : v₁ = x := hv.resolve_left hne₁ + have hyF : y ∈ (F.sup P Q).V := by rw [hsup]; exact hV hy + rw [Drawing.sup_V hPs hQs] at hyF + rcases hyF with h₁ | h₁ + · rcases hend₁ hvx y h₁ with e | e + · exact hyr e.symm + · exact hxy e.symm + · rcases hend₂ hvx y h₁ with e | e + · exact hyr e.symm + · exact hxy e.symm + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14aa.lean b/LeanPool/GraphMinor/GM19/Section14aa.lean new file mode 100644 index 0000000000..17c42b2c8f --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14aa.lean @@ -0,0 +1,252 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14z +public import LeanPool.GraphMinor.GM19.FragmentOrient + +/-! +# Graph Minors XIX, Section 14: the colour scheme `χ'` + +The paper takes a colour scheme in `Σ'` with the frame `Φ'`. An internal edge keeps its colour, a +short side has one colour, and the colours of a long side record +the sector at each edge of `R`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- The scheme `χ'`. -/ +noncomputable def cutScheme {X : Type} [TopologicalSpace X] (hX : IsSurface X) + (hc : ConnectedSpace X) (Φ : Frame X) (Ω2 Ω3 Ωc : QuasiOrder α) (h2 : Ω2.IsWQO) (h3 : Ω3.IsWQO) + (hcw : Ωc.IsWQO) (a₀ : α) : + ColourScheme X α := by + classical exact + { isSurface := hX + connected := hc + Φ := Φ + Ω2 := Ω2 + Ω3 := Ω3 + ΩS := fun s ↦ if Φ.isLong s then Ωc else QuasiOrder.single a₀ + shortElem := fun _ ↦ a₀ + isWQO_2 := h2 + isWQO_3 := h3 + isWQO_S := fun s _ ↦ by + by_cases h : Φ.isLong s + · rw [ite_eq_left h] + exact hcw + · rw [ite_eq_right h] + exact QuasiOrder.isWQO_single a₀ + short_singleton := fun s hs ↦ by + rw [ite_eq_right hs.2] + rfl } + +namespace Slice + +variable {T : Set S} {D : TangleDatum cap χ} (s : Slice T D) + +open Classical in +/-- The colour of a border edge. -/ +noncomputable def borderCol (col : ↥s.𝒲 → ℕ → α) (a₀ : α) (e : Set ↥Tᶜ) : α := + if h : ∃ W p, p < (s.fr W).R.k ∧ e = s.arc W p then col h.choose h.choose_spec.choose else a₀ + +open Classical in +/-- The colour of an edge of `Γ'`. -/ +noncomputable def cutφ (col : ↥s.𝒲 → ℕ → α) (a₀ : α) (Z : Set ↥Tᶜ) (e : Set ↥Tᶜ) : α := + if Painting.IsInternal e then s.Q.φ (Subtype.val '' e) else if Disjoint e Z then s.borderCol col + a₀ e else a₀ + +include s + +theorem borderCol_arc (col : ↥s.𝒲 → ℕ → α) (a₀ : α) {W : ↥s.𝒲} {p : ℕ} (hp : p < + (s.fr W).R.k) : s.borderCol col a₀ (s.arc W p) = col W p := by + classical + have h : ∃ W' p', p' < (s.fr W').R.k ∧ s.arc W p = s.arc W' p' := ⟨W, p, hp, rfl⟩ + rw [borderCol, dite_eq_left h] + have key : ∀ W' p', p' < (s.fr W').R.k → s.arc W p = s.arc W' p' → col W' p' = col W p := by + intro W' p' hp' he + obtain rfl := s.arc_wheel he + rw [s.arc_pos W hp hp' he] + exact key _ _ h.choose_spec.choose_spec.1 h.choose_spec.choose_spec.2 + +theorem exists_pos {c : Set ↥Tᶜ} (hc : c ∈ arcComponentsIn (bd ↥Tᶜ \ s.Nb)) : ∃ W p, p < + (s.fr W).R.k ∧ c = s.arc W p := by + obtain ⟨x, hx⟩ := hc.1 + obtain ⟨C, hC, hxC⟩ := sUnion_cuffs (S := ↥Tᶜ) ▸ (hc.2.1 hx).1 + obtain ⟨W, hW⟩ := s.exists_wheel ⟨C, hC⟩ + obtain ⟨i, hi, e⟩ := s.arc_cover W hc hx (hW ▸ hxC) + exact ⟨W, i, hi, e⟩ + +/-- An edge of `Γ` in the part that we keep is not in `Z`. -/ +theorem not_above {ω₀ : α} (hz : ∀ e ∈ D.Γ.E, χ.unionLE ω₀ (D.P.φ e) → ∃ W ∈ s.𝒲, cap.emb '' e ⊆ W) + {e : Set S} (he : e ∈ s.Q.Γ.E) {x : ↥Tᶜ} (hx : x.1 ∈ e) : + ¬ χ.unionLE ω₀ (s.Q.φ e) := by + have hE : e ∈ (D.P.Γ.push s.f.symm).E := he + rw [push_E] at hE + obtain ⟨c, hc, rfl⟩ := hE + intro hle + have hφ : s.Q.φ (s.f.symm '' c) = D.P.φ c := s.isImage.φ c hc + rw [hφ] at hle + obtain ⟨W, hW, hsub⟩ := hz c hc hle + obtain ⟨y, hy, hxy⟩ := hx + have hxy' : s.f x.1 = y := by rw [← hxy]; simp + have hin : cap.emb y ∈ W := hsub (mem_image_of_mem _ hy) + have hbd : cap.emb y ∈ discBd W := by + by_contra hb + have hT : x.1 ∈ cutT (cap.emb ∘ s.f) s.𝒲 := by + refine mem_iUnion₂.mpr ⟨W, hW, ?_⟩ + change cap.emb (s.f x.1) ∈ _ + rw [hxy'] + exact ⟨hin, hb⟩ + rw [s.hT] at hT + exact x.2 hT + have hU : cap.emb y ∈ D.rad.G.U := (s.fr ⟨W, hW⟩).R.G_sub hbd + have hyU : y ∈ D.P.Γ.U := (hc.2.1 hy).1 + have hV : cap.emb y ∈ D.P.Γ.hatV cap := by + rw [← D.rad.isPreRadial.1] + exact ⟨⟨y, hyU, rfl⟩, hU⟩ + obtain ⟨v, hv, e'⟩ := hV + exact (hc.2.1 hy).2 ((cap.isEmbedding.injective e') ▸ hv) + +variable [Nonempty ↥Tᶜ] + +omit s in +/-- The hypotheses on the orders of `χ'`. -/ +structure IsCutOrders (s : Slice T D) (ω₀ : α) (Ω2 Ω3 Ωc : QuasiOrder α) (col : ↥s.𝒲 → ℕ + → α) : Prop where + mem_2 : ∀ c ∈ χ.Ω2.E, ¬ χ.unionLE ω₀ c → c ∈ Ω2.E + mem_3 : ∀ c ∈ χ.Ω3.E, ¬ χ.unionLE ω₀ c → c ∈ Ω3.E + covered : ∀ e ∈ D.Γ.E, χ.unionLE ω₀ (D.P.φ e) → ∃ W ∈ s.𝒲, cap.emb '' e ⊆ W + mem_c : ∀ W p, p < (s.fr W).R.k → p ∉ s.sing W → col W p ∈ Ωc.E + +theorem lift_φ (ε : Set ↥Tᶜ → Bool) {e₁ : Set ↥Tᶜ} (he₁ : e₁ ∈ (s.paint ε).E) + (hi : Painting.IsInternal e₁) (col : ↥s.𝒲 → ℕ → α) (a₀ : α) (Z : Set ↥Tᶜ) : + ∃ e ∈ s.Q.Γ.E, e₁ = Subtype.val ⁻¹' e ∧ Subtype.val '' e₁ = e ∧ s.cutφ col a₀ Z e₁ = s.Q.φ e ∧ + (tilde e₁).ncard = (tilde e).ncard ∧ Painting.IsInternal e ∧ ∃ x : ↥Tᶜ, x.1 ∈ e := by + classical + obtain ⟨e, he, hb, hne, rfl⟩ := s.fd.exists_lift_of_internal _ he₁ hi + have hsub := s.fd.pull.subset_R he hb hne + have hsur : Subtype.val '' (Subtype.val ⁻¹' e : Set ↥Tᶜ) = e := image_preimage_eq_of_subset + (hsub.trans (image_subset_range _ _)) + refine ⟨e, he, rfl, hsur, ?_, s.fd.pull.ncard_tilde he hsub, isInternal_iff_not_border.mpr hb, + hne⟩ + rw [cutφ, ite_eq_left hi, hsur] + +/-- The coloured painting `(Γ', φ')`. -/ +noncomputable def colPaint (ε : Set ↥Tᶜ → Bool) {Φ' : Frame ↥Tᶜ} {Z : Set ↥Tᶜ} + (hF : s.IsCutFrame Φ' Z ε) {ω₀ : α} {Ω2 Ω3 Ωc : QuasiOrder α} (h2 : Ω2.IsWQO) (h3 : Ω3.IsWQO) + (hcw : Ωc.IsWQO) (a₀ : α) + (col : ↥s.𝒲 → ℕ → α) (hO : s.IsCutOrders ω₀ Ω2 Ω3 Ωc col) : ColouredPainting + (cutScheme s.isSurface s.connected Φ' Ω2 Ω3 Ωc h2 h3 hcw a₀) where + Γ := s.paint ε + φ := s.cutφ col a₀ Z + fits := s.paint_fits hF + internal_2_mem e₁ he₁ hi h2' := by + obtain ⟨e, he, rfl, hsur, hφ, hn, hint, x, hx⟩ := s.lift_φ ε he₁ hi col a₀ Z + rw [hφ] + exact hO.mem_2 _ (s.Q.internal_2_mem e he hint (hn ▸ h2')) (s.not_above hO.covered he hx) + internal_3_mem e₁ he₁ hi h3' := by + obtain ⟨e, he, rfl, hsur, hφ, hn, hint, x, hx⟩ := s.lift_φ ε he₁ hi col a₀ Z + rw [hφ] + exact hO.mem_3 _ (s.Q.internal_3_mem e he hint (hn ▸ h3')) (s.not_above hO.covered he hx) + border_mem e he c hc hbs := by + classical + have ha := s.border_arc ε he hbs.1 + have hni : ¬ Painting.IsInternal e := fun hi ↦ isInternal_iff_not_border.mp hi hbs.1 + change s.cutφ col a₀ Z e ∈ _ + rw [cutφ, ite_eq_right hni] + change _ ∈ ((if Φ'.isLong c then Ωc else QuasiOrder.single a₀)).E + have hc' : c ∈ arcComponentsIn (bd ↥Tᶜ \ s.markN) := by + have : c ∈ arcComponentsIn (bd ↥Tᶜ \ Φ'.V) := hc + rwa [hF.V_eq] at this + by_cases hl : Φ'.isLong c + · rw [ite_eq_left hl] + have hdis : Disjoint e Z := ((hF.long_iff c).mp hl).mono_left hbs.2 + rw [ite_eq_left hdis] + obtain ⟨W, p, hp, rfl⟩ := s.exists_pos ha + rw [s.borderCol_arc col a₀ hp] + refine hO.mem_c W p hp fun hsing ↦ ?_ + have hz : s.zx W p ∈ s.markZ := mem_iUnion.mpr ⟨W, mem_iUnion₂.mpr ⟨_, hsing, rfl⟩⟩ + exact disjoint_left.mp hdis (s.zx_arc W p) (hF.Z_eq ▸ hz) + · rw [ite_eq_right hl] + have hnd : ¬ Disjoint c s.markZ := fun hd ↦ hl ((hF.long_iff c).mpr (hF.Z_eq ▸ hd)) + obtain ⟨z, hzc, hz⟩ := not_disjoint_iff.mp hnd + obtain ⟨W, hz⟩ := mem_iUnion.mp hz + obtain ⟨i, hi, rfl⟩ := mem_iUnion₂.mp hz + obtain rfl : c = s.arc W i := arcComp_eq_of_mem hc' (s.arc_side hi) hzc (s.zx_arc W i) + obtain ⟨x, hx⟩ := ha.1 + obtain rfl : e = s.arc W i := arcComp_eq_of_mem ha (s.arc_mem W i) hx (hbs.2 hx) + have hnd' : ¬ Disjoint (s.arc W i) Z := fun hd ↦ hnd (hF.Z_eq ▸ hd) + rw [ite_eq_right hnd'] + rfl + +/-- The orientation passes to `Γ'`. -/ +theorem paint_pos (ε : Set ↥Tᶜ → Bool) {ω : SurfaceOrientation S} {ω₁ : SurfaceOrientation ↥Tᶜ} + (hω₁ : ∀ Δ : Set ↥Tᶜ, IsClosedDisc Δ → InjOn Subtype.val Δ → ∀ a b c : ↥Tᶜ, a ∈ discBd Δ + → b ∈ discBd Δ → c ∈ discBd Δ → a ≠ b → b ≠ c → a ≠ c → (ω₁.pos Δ a b c ↔ ω.pos + (Subtype.val '' Δ) a.1 b.1 c.1)) + (hω : ∀ e ∈ s.Q.Γ.E, (tilde e).ncard = 3 → ∀ a b c : S, s.Q.Γ.γ e = [a, b, c] → ω.pos + (closure e) a b c) : + ∀ e ∈ (s.paint ε).E, (tilde e).ncard = 3 → ∀ a b c : ↥Tᶜ, (s.paint ε).γ e = [a, b, c] → ω₁.pos + (closure e) a b c := by + intro e₁' he₁' h3 a' b' c' hl' + have hEp : e₁' ∈ (s.paint ε).E := he₁' + have hint : Painting.IsInternal e₁' := by + refine disjoint_left.mpr fun x hx hxb ↦ ?_ + have := ((s.paint ε).border_edge e₁' hEp ⟨x, hx, hxb⟩).1 + omega + obtain ⟨e, he, hb', hne', rfl⟩ := s.fd.exists_lift_of_internal _ hEp hint + have hsub := s.fd.pull.subset_R he hb' hne' + have hmap := s.fd.map_march_lift (flip := flipOf ε) he hb' hne' + have hlist : (s.paint ε).γ (Subtype.val ⁻¹' e) = [a', b', c'] := hl' + have hmap' : [a', b', c'].map Subtype.val = s.Q.Γ.γ e := by + rw [← hlist] + exact hmap + obtain ⟨hdisc, htil⟩ := (s.paint ε).tilde_subset_discBd hEp h3 + have hn := (s.paint ε).γ_nodup _ hEp + have hset := (s.paint ε).γ_set _ hEp + rw [hlist] at hn hset + have hmem : ∀ x ∈ [a', b', c'], x ∈ discBd (closure (Subtype.val ⁻¹' e : Set ↥Tᶜ)) + := fun x hx ↦ htil (hset ▸ hx) + have hsur : Subtype.val '' (Subtype.val ⁻¹' e : Set ↥Tᶜ) = e := image_preimage_eq_of_subset + (hsub.trans (image_subset_range _ _)) + have hfrag := s.fd.pull.frag + have hcl' : Subtype.val '' closure (Subtype.val ⁻¹' e : Set ↥Tᶜ) = closure e := by + rw [← hfrag.isClosedMap.closure_image_eq_of_continuous hfrag.continuous_ψ, hsur] + refine (hω₁ _ hdisc (s.fd.pull.injOn_closure he hsub) a' b' c' (hmem _ (by simp)) (hmem _ + (by simp)) + (hmem _ (by simp)) (by simp at hn; tauto) (by simp at hn; tauto) (by simp at hn; tauto)).mpr ?_ + rw [hcl'] + have h3e : (tilde e).ncard = 3 := by + rw [← s.fd.pull.ncard_tilde he hsub] + exact h3 + exact hω e he h3e _ _ _ hmap'.symm + +omit [Nonempty ↥Tᶜ] in +/-- `Σ'` is orientable only if `Σ` is. -/ +theorem orientable [Nonempty ↥Tᶜ] (hO : IsOrientableSurface ↥Tᶜ) : IsOrientableSurface S := by + obtain ⟨cap'⟩ := s.nonempty_capped + have := cap.connected + obtain ⟨e, P, hP, hs', ht⟩ := exists_cap_chart s.isSurface cap' + obtain ⟨ω⟩ := hO + exact isOrientable_of_embedding cap.isEmbedding (isOrientable_of_inside cap.isClosedSurface hP e + hs' ht.1 (ω.isPartial _)) + +end Slice + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14ab.lean b/LeanPool/GraphMinor/GM19/Section14ab.lean new file mode 100644 index 0000000000..cc0ade74b1 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14ab.lean @@ -0,0 +1,370 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14aa + +/-! +# Graph Minors XIX, Section 14: two wheels covers and an inflation + +Take two members of the sequence in `Σ'`, with the same frame `Φ'`, and a linear inflation of `Γ'` +of the first in `Γ'` of the second. We walk around each rim of the second painting and +read off the staircase that the paper describes. The vertices of the frame stay where they are, and +at a regular place the walk either stays or moves on with a border edge. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace Slice + +variable {T : Set S} {Da Db : TangleDatum cap χ} + +/-- The wheel of the second cover on the cuff of a wheel of the first. -/ +noncomputable def wmap (sa : Slice T Da) (sb : Slice T Db) (W : ↥sa.𝒲) : ↥sb.𝒲 := + (sb.exists_wheel ⟨sa.cf W, sa.cf_mem W.2⟩).choose + +theorem cf_wmap (sa : Slice T Da) (sb : Slice T Db) (W : ↥sa.𝒲) : sa.cf W = sb.cf (sa.wmap sb W) := + (sb.exists_wheel ⟨sa.cf W, sa.cf_mem W.2⟩).choose_spec + +theorem cf_nonempty (s : Slice T Da) (W : ↥s.𝒲) : (s.cf W).Nonempty := ⟨_, s.vx_cf W 0⟩ + +theorem wmap_bij (sa : Slice T Da) (sb : Slice T Db) : Function.Bijective (sa.wmap sb) := by + constructor + · intro W₁ W₂ h + obtain ⟨x, hx⟩ := sa.cf_nonempty W₁ + have h₂ : x ∈ sa.cf W₂ := by + rw [sa.cf_wmap sb, ← h, ← sa.cf_wmap sb] + exact hx + exact sa.wheel_eq hx h₂ + · intro W' + obtain ⟨W, hW⟩ := sa.exists_wheel ⟨sb.cf W', sb.cf_mem W'.2⟩ + refine ⟨W, ?_⟩ + obtain ⟨x, hx⟩ := sb.cf_nonempty W' + have h₁ : x ∈ sa.cf W := hW ▸ hx + rw [sa.cf_wmap sb] at h₁ + exact sb.wheel_eq h₁ hx + +/-- The relation that holds the inflation outside the wheels. -/ +def Out (sa : Slice T Da) (sb : Slice T Db) (σv : ↥Tᶜ → Set ↥Tᶜ) (y x : Shat) : Prop := + ∃ x' y', x = sa.e x' ∧ y = sb.e y' ∧ x' ∈ sa.N ∧ y' ∈ σv x' + +end Slice + +/-- Two members of the sequence, and a linear inflation. -/ +structure CutPair {T : Set S} {Da Db : TangleDatum cap χ} [Nonempty ↥Tᶜ] (sa : Slice T Da) + (sb : Slice T Db) (ε : Set ↥Tᶜ → Bool) (Φ' : Frame ↥Tᶜ) (Z : Set ↥Tᶜ) + (σv : ↥Tᶜ → Set ↥Tᶜ) (σe : Set ↥Tᶜ → Set ↥Tᶜ) {β : Type*} (Ω : QuasiOrder β) (ξa : Arm Da.P.Γ + → β) (ξb : Arm Db.P.Γ → β) (cola : ↥sa.𝒲 → ℕ → α) (colb : ↥sb.𝒲 → ℕ → α) (a₀ : α) + (Ωc : QuasiOrder α) : Prop where + hFa : sa.IsCutFrame Φ' Z ε + hFb : sb.IsCutFrame Φ' Z ε + dira : ∀ W i, arcMarch sa.isSurface (flipOf ε (sa.arc W i)) (sa.arc W i) = [sa.vx W i, sa.vx W + (i + 1)] + dirb : ∀ W i, arcMarch sb.isSurface (flipOf ε (sb.arc W i)) (sb.arc W i) = [sb.vx W i, sb.vx W + (i + 1)] + infl : IsLinearInflation (sa.paint ε) (sb.paint ε) σv σe + resp : RespectsFrame Φ' (sa.paint ε) σe + le_int : ∀ e ∈ (sa.paint ε).E, Painting.IsInternal e → χ.unionLE (sa.cutφ cola a₀ Z e) + (sb.cutφ colb a₀ Z (σe e)) + le_long : ∀ e ∈ (sa.paint ε).E, Painting.IsBorder e → ∀ c ∈ Φ'.sides, Φ'.isLong c → e ⊆ c → Ωc.le + (sa.cutφ cola a₀ Z e) (sb.cutφ colb a₀ Z (σe e)) + col_le : ∀ W p W' q, Ωc.le (cola W p) (colb W' q) → (sb.fr W').code q = (sa.fr W).code p ∧ Ω.le + (ξa ((sa.fr W).secArm p)) (ξb ((sb.fr W').secArm q)) + tag : ∀ W p, p ∈ sa.sing W → ∀ W' q, q ∈ sb.sing W' → sa.zx W p = sb.zx W' q → + (p + 1 = (sa.fr W).R.k ↔ q + 1 = (sb.fr W').R.k) ∧ (sb.fr W').code q = (sa.fr W).code p ∧ Ω.le + (ξa ((sa.fr W).secArm p)) (ξb ((sb.fr W').secArm q)) ∧ + (sb.fr W').hubList.length = (sa.fr W).hubList.length ∧ ∀ hc : (sa.fr W).H.V.ncard ≠ 1, ∃ hc' + : (sb.fr W').H.V.ncard ≠ 1, Ω.le (ξa ((sa.fr W).hubArm hc)) (ξb ((sb.fr W').hubArm hc')) + +namespace CutPair + +variable {T : Set S} {Da Db : TangleDatum cap χ} [Nonempty ↥Tᶜ] {sa : Slice T Da} {sb : Slice T Db} + {ε : Set ↥Tᶜ → Bool} {Φ' : Frame ↥Tᶜ} {Z : Set ↥Tᶜ} + {σv : ↥Tᶜ → Set ↥Tᶜ} {σe : Set ↥Tᶜ → Set ↥Tᶜ} {β : Type*} {Ω : QuasiOrder β} {ξa : Arm Da.P.Γ + → β} {ξb : Arm Db.P.Γ → β} {cola : ↥sa.𝒲 → ℕ → α} {colb : ↥sb.𝒲 → ℕ + → α} {a₀ : α} {Ωc : QuasiOrder α} + (h : CutPair sa sb ε Φ' Z σv σe Ω ξa ξb cola colb a₀ Ωc) +include h + +theorem markN_eq : sa.markN = sb.markN := h.hFa.V_eq.symm.trans h.hFb.V_eq + +theorem markZ_eq : sa.markZ = sb.markZ := h.hFa.Z_eq.symm.trans h.hFb.Z_eq + +theorem mem_self {v : ↥Tᶜ} (hv : v ∈ sa.markN) : v ∈ σv v := + mem_σv_of_frame sa.isSurface (sa.paint_fits h.hFa) (sb.paint_fits h.hFb) h.infl.toIsInflation + h.resp (h.hFa.V_eq ▸ hv) + +theorem out_uniq {x₁ x₂ y : ↥Tᶜ} (h₁ : x₁ ∈ sa.N) (h₂ : x₂ ∈ sa.N) (hy₁ : y ∈ σv x₁) + (hy₂ : y ∈ σv x₂) : x₁ = x₂ := by + by_contra hne + rw [← sa.paint_V ε] at h₁ h₂ + exact disjoint_left.mp (h.infl.vertex_disjoint _ h₁ _ h₂ hne) hy₁ hy₂ + +theorem exists_match (W : ↥sa.𝒲) {p : ℕ} (hp : p ∈ sa.sing W) : ∃ q ∈ sb.sing + (sa.wmap sb W), sa.zx W p = sb.zx (sa.wmap sb W) q ∧ sa.arc W p = sb.arc (sa.wmap sb W) q + ∧ sa.vx W p = sb.vx (sa.wmap sb W) q ∧ sa.vx W (p + 1) = sb.vx (sa.wmap sb W) (q + 1) := by + have hz : sa.zx W p ∈ sa.markZ := mem_iUnion.mpr ⟨W, mem_iUnion₂.mpr ⟨_, hp, rfl⟩⟩ + rw [h.markZ_eq] at hz + obtain ⟨W', hz⟩ := mem_iUnion.mp hz + obtain ⟨q, hq, hz⟩ := mem_iUnion₂.mp hz + have hz' : sa.zx W p = sb.zx W' q := hz + have hc : sa.zx W p ∈ sa.cf W := sa.arc_cf W p (sa.zx_arc W p) + rw [sa.cf_wmap sb] at hc + obtain rfl : sa.wmap sb W = W' := sb.wheel_eq hc (hz' ▸ sb.arc_cf W' q (sb.zx_arc W' q)) + have harc : sa.arc W p = sb.arc (sa.wmap sb W) q := by + have h₁ := sa.arc_side hp + rw [h.markN_eq] at h₁ + exact arcComp_eq_of_mem h₁ (sb.arc_side hq) (sa.zx_arc W p) (hz' ▸ sb.zx_arc _ q) + have hl : [sa.vx W p, sa.vx W (p + 1)] = [sb.vx (sa.wmap sb W) q, sb.vx (sa.wmap sb W) (q + 1)] + := by + rw [← h.dira W p, ← h.dirb _ q, ← harc] + simp only [List.cons.injEq, and_true] at hl + exact ⟨q, hq, hz', harc, hl.1, hl.2⟩ + +theorem exists_match' (W : ↥sa.𝒲) {q : ℕ} (hq : q ∈ sb.sing (sa.wmap sb W)) : ∃ p ∈ sa.sing W, + sa.zx W p = sb.zx (sa.wmap sb W) q := by + have hz : sb.zx (sa.wmap sb W) q ∈ sb.markZ := mem_iUnion.mpr ⟨_, mem_iUnion₂.mpr ⟨_, hq, rfl⟩⟩ + rw [← h.markZ_eq] at hz + obtain ⟨W', hz⟩ := mem_iUnion.mp hz + obtain ⟨p, hp, hz⟩ := mem_iUnion₂.mp hz + have hz' : sb.zx (sa.wmap sb W) q = sa.zx W' p := hz + have hc : sb.zx (sa.wmap sb W) q ∈ sa.cf W := by + rw [sa.cf_wmap sb] + exact sb.arc_cf _ q (sb.zx_arc _ q) + obtain rfl : W' = W := sa.wheel_eq (hz' ▸ sa.arc_cf W' p (sa.zx_arc W' p)) hc + exact ⟨p, hp, hz'.symm⟩ + +omit [Nonempty ↑Tᶜ] h in +/-- At a place of `Σ'` where the two rims agree, the relation `Out` is the inflation. -/ +theorem out_vx {W : ↥sa.𝒲} {W' : ↥sb.𝒲} {p q : ℕ} : Slice.Out sa sb σv ((sb.fr W').R.vert q) + ((sa.fr W).R.vert p) ↔ sb.vx W' q ∈ σv (sa.vx W p) := by + constructor + · rintro ⟨x', y', e₁, e₂, -, hy⟩ + rw [← sa.e_vx] at e₁ + rw [← sb.e_vx] at e₂ + rw [sa.isEmbedding.injective e₁, sb.isEmbedding.injective e₂] + exact hy + · intro hy + exact ⟨_, _, (sa.e_vx W p).symm, (sb.e_vx W' q).symm, (sa.vx_N W p).1, hy⟩ + +theorem out_frame {W : ↥sa.𝒲} {W' : ↥sb.𝒲} {p q : ℕ} (e : sa.vx W p = sb.vx W' q) + (hm : sa.vx W p ∈ sa.markN) : Slice.Out sa sb σv ((sb.fr W').R.vert q) ((sa.fr W).R.vert p) := + (out_vx (sa := sa) (sb := sb) (σv := σv)).mpr (e ▸ h.mem_self hm) + +theorem last_match (W : ↥sa.𝒲) : sa.vx W ((sa.fr W).R.k - 1) = sb.vx (sa.wmap sb W) ((sb.fr + (sa.wmap sb W)).R.k - 1) ∧ sa.vx W 0 = sb.vx (sa.wmap sb W) 0 ∧ + (sb.fr (sa.wmap sb W)).code ((sb.fr (sa.wmap sb W)).R.k - 1) = (sa.fr W).code + ((sa.fr W).R.k - 1) ∧ + Ω.le (ξa ((sa.fr W).secArm ((sa.fr W).R.k - 1))) (ξb ((sb.fr (sa.wmap sb W)).secArm ((sb.fr + (sa.wmap sb W)).R.k - 1))) ∧ + (sb.fr (sa.wmap sb W)).hubList.length = (sa.fr W).hubList.length ∧ ∀ hc : + (sa.fr W).H.V.ncard ≠ 1, ∃ hc' : (sb.fr (sa.wmap sb W)).H.V.ncard ≠ 1, Ω.le (ξa + ((sa.fr W).hubArm hc)) (ξb ((sb.fr (sa.wmap sb W)).hubArm hc')) := by + have h2 := (sa.fr W).R.two + have hl := sa.last_sing W + obtain ⟨q, hq, hz, -, e₁, e₂⟩ := h.exists_match W hl + obtain ⟨hk, hc, hle, hlen, hhub⟩ := h.tag W _ hl _ q hq hz + have hq' : q = (sb.fr (sa.wmap sb W)).R.k - 1 := by + have := hk.mp (by omega) + omega + subst hq' + refine ⟨e₁, ?_, hc, hle, hlen, hhub⟩ + rw [← sa.vx_succ_last W, ← sb.vx_succ_last, e₂] + +omit [Nonempty ↑Tᶜ] h in +theorem vx_mem_sing {W : ↥sa.𝒲} {p : ℕ} (hp : p ∈ sa.sing W) : sa.vx W p ∈ sa.markN ∧ sa.vx W + (p + 1) ∈ sa.markN := + ⟨mem_iUnion.mpr ⟨W, mem_iUnion₂.mpr ⟨_, hp, .inl rfl⟩⟩, mem_iUnion.mpr ⟨W, mem_iUnion₂.mpr ⟨_, + hp, .inr rfl⟩⟩⟩ + +/-- The symmetry of two sectors. -/ +def _root_.GraphMinor.GM19.CutPair.Sym (_ : CutPair sa sb ε Φ' Z σv σe Ω ξa ξb cola colb a₀ Ωc) + (W : ↥sa.𝒲) (q p : ℕ) : Prop := + (sb.fr (sa.wmap sb W)).code q = (sa.fr W).code p ∧ Ω.le (ξa ((sa.fr W).secArm p)) (ξb ((sb.fr + (sa.wmap sb W)).secArm q)) + +theorem step_sing (W : ↥sa.𝒲) {q p : ℕ} (hq₁ : q + 1 < (sb.fr (sa.wmap sb W)).R.k) (hp : p < + (sa.fr W).R.k) (ho : Slice.Out sa sb σv ((sb.fr (sa.wmap sb W)).R.vert q) ((sa.fr W).R.vert p)) + (hs : q ∈ sb.sing (sa.wmap sb W)) : p + 1 < (sa.fr W).R.k ∧ Slice.Out sa sb σv ((sb.fr + (sa.wmap sb W)).R.vert (q + 1)) ((sa.fr W).R.vert (p + 1)) ∧ h.Sym W q p := by + obtain ⟨p', hp', hz⟩ := h.exists_match' W hs + obtain ⟨q', hq', hz', -, e₁, e₂⟩ := h.exists_match W hp' + obtain rfl : q' = q := by + have h₁ : sb.arc (sa.wmap sb W) q' = sb.arc (sa.wmap sb W) q := by + have e' : sb.zx (sa.wmap sb W) q' = sb.zx (sa.wmap sb W) q := hz'.symm.trans hz + exact arcComp_eq_of_mem (sb.arc_mem _ q') (sb.arc_mem _ q) (sb.zx_arc _ q') + (e' ▸ sb.zx_arc _ q) + exact sb.arc_pos _ hq'.1 hs.1 h₁ + obtain ⟨hk, hc, hle, -, -⟩ := h.tag W _ hp' _ _ hs hz + have hm := vx_mem_sing (sa := sa) hp' + have hop := h.out_frame (W := W) (W' := sa.wmap sb W) (p := p') (q := q') e₁ hm.1 + have e : p = p' := sa.vx_inj W hp hp'.1 (h.out_uniq (sa.vx_N W p).1 (sa.vx_N W p').1 ((out_vx (sa + := sa) (sb := sb) (σv := σv)).mp ho) ((out_vx (sa := sa) (sb := sb) (σv := σv)).mp hop)) + subst e + refine ⟨?_, h.out_frame e₂ hm.2, hc, hle⟩ + by_contra hn + have : p + 1 = (sa.fr W).R.k := by omega + have := hk.mp this + omega + +omit h in +theorem arc_E_a (W : ↥sa.𝒲) (i : ℕ) : sa.arc W i ∈ (sa.paint ε).E := sa.arc_E ε (sa.arc_mem W i) + +omit h in +theorem arc_E_b (W : ↥sb.𝒲) (i : ℕ) : sb.arc W i ∈ (sb.paint ε).E := sb.arc_E ε (sb.arc_mem W i) + +omit h in +omit [Nonempty ↑Tᶜ] in +theorem arc_border (s : Slice T Da) (W : ↥s.𝒲) (i : ℕ) : Painting.IsBorder (s.arc W i) := by + obtain ⟨x, hx, -⟩ := s.arc_reg W i + exact ⟨x, hx, ((s.arc_mem W i).2.1 hx).1⟩ + +theorem γ_a (W : ↥sa.𝒲) (i : ℕ) : (sa.paint ε).γ (sa.arc W i) = [sa.vx W i, sa.vx W (i + 1)] := by + rw [sa.γ_arc ε (sa.arc_mem W i), h.dira] + +theorem γ_b (W : ↥sb.𝒲) (i : ℕ) : (sb.paint ε).γ (sb.arc W i) = [sb.vx W i, sb.vx W (i + 1)] := by + rw [sb.γ_arc ε (sb.arc_mem W i), h.dirb] + +/-- The edge of the first painting whose image is an arc of the second rim is an arc of the first +rim with the same ends. -/ +theorem exists_pre (W : ↥sa.𝒲) {q : ℕ} {e₀ : Set ↥Tᶜ} (he₀ : e₀ ∈ (sa.paint ε).E) (he : σe e₀ + = sb.arc (sa.wmap sb W) q) : + ∃ p₀, p₀ < (sa.fr W).R.k ∧ e₀ = sa.arc W p₀ ∧ sb.vx (sa.wmap sb W) q ∈ σv (sa.vx W p₀) ∧ sb.vx + (sa.wmap sb W) (q + 1) ∈ σv (sa.vx W (p₀ + 1)) := by + obtain ⟨z, hz, -⟩ := sb.arc_reg (sa.wmap sb W) q + have hzc : z ∈ sb.cf (sa.wmap sb W) := sb.arc_cf _ q hz + have hmem : sa.cf W ∈ cuffs ↥Tᶜ := sa.cf_mem W.2 + have hne : (σe e₀ ∩ sa.cf W).Nonempty := ⟨z, he ▸ hz, by rw [sa.cf_wmap sb]; exact hzc⟩ + obtain ⟨y, hy, hyc⟩ := (h.infl.borders_iff e₀ he₀ _ hmem).mpr hne + have hb : Painting.IsBorder e₀ := ⟨y, hy, sa.cf_sub_bd W.2 hyc⟩ + obtain ⟨p₀, hp₀, rfl⟩ := sa.arc_cover W (sa.border_arc ε he₀ hb) hy hyc + have hγ : ∀ (i : ℕ) (hi : i < ((sa.paint ε).γ (sa.arc W p₀)).length) (hi' : i < ((sb.paint ε).γ + (σe (sa.arc W p₀))).length), ((sb.paint ε).γ (σe (sa.arc W p₀)))[i] ∈ σv ((sa.paint ε).γ + (sa.arc W p₀))[i] := + h.infl.ends _ he₀ + have key : ∀ (l : List ↥Tᶜ) (_ : l = (sb.paint ε).γ (σe (sa.arc W p₀))) (l' : List ↥Tᶜ) (_ : l' = + (sa.paint ε).γ (sa.arc W p₀)), l = [sb.vx (sa.wmap sb W) q, sb.vx (sa.wmap sb W) (q + 1)] → l' + = [sa.vx W p₀, sa.vx W (p₀ + 1)] → sb.vx (sa.wmap sb W) q ∈ σv (sa.vx W p₀) ∧ sb.vx + (sa.wmap sb W) (q + 1) ∈ σv (sa.vx W (p₀ + 1)) := by + rintro _ rfl _ rfl e₁ e₂ + have h₀ := hγ 0 (by simp [e₂]) (by simp [e₁]) + have h₁ := hγ 1 (by simp [e₂]) (by simp [e₁]) + simp only [e₁, e₂] at h₀ h₁ + exact ⟨h₀, h₁⟩ + obtain ⟨h₀, h₁⟩ := key _ rfl _ rfl (by rw [he, h.γ_b]) (h.γ_a W p₀) + exact ⟨p₀, hp₀, rfl, h₀, h₁⟩ + +/-- A regular arc of the first rim is an edge of a long side. -/ +theorem exists_long_side (W : ↥sa.𝒲) {p : ℕ} (hp : p < (sa.fr W).R.k) + (hns : p ∉ sa.sing W) : ∃ c ∈ Φ'.sides, Φ'.isLong c ∧ sa.arc W p ⊆ c := by + have hsub : sa.arc W p ⊆ bd ↥Tᶜ \ Φ'.V := by + rw [h.hFa.V_eq] + exact fun x hx ↦ ⟨((sa.arc_mem W p).2.1 hx).1, fun hm ↦ ((sa.arc_mem W p).2.1 hx).2 + (sa.markN_sub hm)⟩ + obtain ⟨c, hc, hsubc⟩ := exists_arcComp_superset (sa.arc_mem W p).2.2.1 hsub + refine ⟨c, hc, (h.hFa.long_iff c).mpr ?_, hsubc⟩ + rw [h.hFa.Z_eq] + refine disjoint_left.mpr fun z hzc hz ↦ ?_ + obtain ⟨W', hz⟩ := mem_iUnion.mp hz + obtain ⟨i, hi, rfl⟩ := mem_iUnion₂.mp hz + have hc' : c ∈ arcComponentsIn (bd ↥Tᶜ \ sa.markN) := h.hFa.V_eq ▸ hc + obtain rfl : c = sa.arc W' i := arcComp_eq_of_mem hc' (sa.arc_side hi) hzc (sa.zx_arc W' i) + obtain ⟨x, hx, -⟩ := sa.arc_reg W p + have e := arcComp_eq_of_mem (sa.arc_mem W p) (sa.arc_mem W' i) hx (hsubc hx) + obtain rfl := sa.arc_wheel e + exact hns (sa.arc_pos W hp hi.1 e ▸ hi) + +/-- If `e₀` is a singular arc then so is its image. -/ +theorem sing_of_sing (W : ↥sa.𝒲) {p q : ℕ} (hp : p ∈ sa.sing W) (hq : q < (sb.fr + (sa.wmap sb W)).R.k) (he : σe (sa.arc W p) = sb.arc (sa.wmap sb W) q) : q ∈ sb.sing + (sa.wmap sb W) := by + obtain ⟨q', hq', -, harc, -, -⟩ := h.exists_match W hp + have hc : sa.arc W p ∈ Φ'.sides := by + have := sa.arc_side hp + rwa [← h.hFa.V_eq] at this + have hsub : σe (sa.arc W p) ⊆ sa.arc W p := ((h.resp _ (arc_E_a (sa := sa) (ε := ε) W p) + (arc_border sa W p)).2 _ hc).mp subset_rfl + rw [he, harc] at hsub + obtain ⟨x, hx, -⟩ := sb.arc_reg (sa.wmap sb W) q + have e := arcComp_eq_of_mem (sb.arc_mem _ q) (sb.arc_mem _ q') hx (hsub hx) + exact sb.arc_pos _ hq hq'.1 e ▸ hq' + +theorem step_reg (W : ↥sa.𝒲) {q p : ℕ} (hq₁ : q + 1 < (sb.fr (sa.wmap sb W)).R.k) (hp : p < + (sa.fr W).R.k) (ho : Slice.Out sa sb σv ((sb.fr (sa.wmap sb W)).R.vert q) ((sa.fr W).R.vert p)) + (hs : q ∉ sb.sing (sa.wmap sb W)) : + (Slice.Out sa sb σv ((sb.fr (sa.wmap sb W)).R.vert (q + 1)) ((sa.fr W).R.vert p) ∧ (sb.fr + (sa.wmap sb W)).Reg q) ∨ + (p + 1 < (sa.fr W).R.k ∧ Slice.Out sa sb σv ((sb.fr (sa.wmap sb W)).R.vert (q + 1)) + ((sa.fr W).R.vert (p + 1)) ∧ h.Sym W q p) := by + classical + have hy := (out_vx (sa := sa) (sb := sb) (σv := σv)).mp ho + have hreg : (sb.fr (sa.wmap sb W)).Reg q := by + by_contra hn + exact hs ⟨by omega, .inr hn⟩ + by_cases hc : sb.arc (sa.wmap sb W) q ∈ σe '' (sa.paint ε).E + · obtain ⟨e₀, he₀, he⟩ := hc + obtain ⟨p₀, hp₀, rfl, h₀, h₁⟩ := h.exists_pre W he₀ he + obtain rfl : p₀ = p := sa.vx_inj W hp₀ hp (h.out_uniq (sa.vx_N W p₀).1 (sa.vx_N W p).1 h₀ hy) + have hns : p₀ ∉ sa.sing W := fun hsing ↦ hs (h.sing_of_sing W hsing (by omega) he) + have hp₁ : p₀ + 1 < (sa.fr W).R.k := by + by_contra hn + exact hns ⟨hp, .inl (by omega)⟩ + refine .inr ⟨hp₁, (out_vx (sa := sa) (sb := sb) (σv := σv)).mpr h₁, ?_⟩ + obtain ⟨c, hc, hl, hsub⟩ := h.exists_long_side W hp hns + have hle := h.le_long _ he₀ (arc_border sa W p₀) c hc hl hsub + have hdisZ : Disjoint c Z := (h.hFa.long_iff c).mp hl + have hni : ∀ {s₀ : Slice T Da} {W₀ : ↥s₀.𝒲} {i : ℕ}, ¬ Painting.IsInternal (s₀.arc W₀ i) + := fun {s₀ W₀ i} hi ↦ isInternal_iff_not_border.mp hi (arc_border s₀ W₀ i) + have hsub' : sb.arc (sa.wmap sb W) q ⊆ c := by + rw [← he] + exact ((h.resp _ (arc_E_a (sa := sa) (ε := ε) W p₀) (arc_border sa W p₀)).2 _ hc).mp hsub + have hni' : ¬ Painting.IsInternal (sb.arc (sa.wmap sb W) q) := fun hi ↦ + isInternal_iff_not_border.mp hi (arc_border sb _ q) + rw [he, Slice.cutφ, Slice.cutφ, ite_eq_right hni, ite_eq_right hni', ite_eq_left + (hdisZ.mono_left hsub), ite_eq_left (hdisZ.mono_left hsub'), sa.borderCol_arc _ _ hp, + sb.borderCol_arc _ _ (by omega)] at hle + exact h.col_le _ _ _ _ hle + · obtain ⟨v, hv, hsub⟩ := h.infl.border_edge _ (arc_E_b (sb := sb) (ε := ε) _ q) + (arc_border sb _ q) hc + rw [sb.tilde_arc] at hsub + have h₁ : sb.vx (sa.wmap sb W) q ∈ σv v := hsub (.inl rfl) + have h₂ : sb.vx (sa.wmap sb W) (q + 1) ∈ σv v := hsub (.inr rfl) + have hvN : v ∈ sa.N := by rwa [sa.paint_V] at hv + obtain rfl := h.out_uniq hvN (sa.vx_N W p).1 h₁ hy + exact .inl ⟨(out_vx (sa := sa) (sb := sb) (σv := σv)).mpr h₂, hreg⟩ + +/-- **The walk around a rim.** -/ +theorem rimWalk (W : ↥sa.𝒲) : RimWalk (sa.fr W) (sb.fr (sa.wmap sb W)) (Slice.Out sa sb σv) + (h.Sym W) := by + have hO : ∀ {y x x'}, Slice.Out sa sb σv y x → Slice.Out sa sb σv y x' → x = x' := by + rintro _ _ _ ⟨x, y, rfl, rfl, hx, hy⟩ ⟨x', y', rfl, e, hx', hy'⟩ + obtain rfl := sb.isEmbedding.injective e + rw [h.out_uniq hx hx' hy hy'] + obtain ⟨e₁, e₀, hc, hle, hlen, -⟩ := h.last_match W + have hl := sa.last_sing W + have hm := vx_mem_sing (sa := sa) hl + refine ⟨hO, h.out_frame e₀ (sa.vx_succ_last W ▸ hm.2), h.out_frame e₁ hm.1, + fun q p hq hp ho ↦ ?_, ⟨hc, hle⟩, fun _ _ h' ↦ h'.1, hlen⟩ + by_cases hs : q ∈ sb.sing (sa.wmap sb W) + · exact .inr (h.step_sing W hq hp ho hs) + · exact h.step_reg W hq hp ho hs + +end CutPair + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14ac.lean b/LeanPool/GraphMinor/GM19/Section14ac.lean new file mode 100644 index 0000000000..7d7084a6ca --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14ac.lean @@ -0,0 +1,337 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14ab + +/-! +# Graph Minors XIX, Section 14: the edges of `M(Γ, ℒ)` in `Σ'` + +An edge of `M(Γ, ℒ)` misses all the wheels. So it is an internal edge of `Γ'`, and each internal +edge of `Γ'` comes from an edge of `M(Γ, ℒ)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace Slice + +variable {T : Set S} {D : TangleDatum cap χ} (s : Slice T D) +include s + +/-- An edge of `M(Γ, ℒ)` misses each wheel. -/ +theorem off_wheels {e : Set S} (he : e ∈ (coverLoc s.𝒲 s.cut.finite s.cut.disj s.fr).M.edgeSet) {x + : S} (hx : x ∈ e) (W : ↥s.𝒲) : cap.emb x ∉ W.1 := by + have hT := cap.isClosedSurface + intro hin + have hE : e ∈ D.P.Γ.E := he.1 + have hoff : ∀ A ∈ (s.fr W).arms, ∀ Δ X, IsDiscArm (s.fr W) A Δ X → cap.emb x ∉ discInt Δ + := fun A hA Δ X hd hi ↦ by + have hc : e ∈ A.compl.edgeSet := he.2 A (mem_iUnion.mpr ⟨W, hA⟩) + rw [hd.compl] at hc + have h₁ : cap.emb x ∈ closure Δᶜ := hc.2.1 hx + rw [closure_compl_disc hT hd.disc] at h₁ + exact h₁ hi + have hG : cap.emb x ∉ D.rad.G.U := fun hU ↦ by + have hV : cap.emb x ∈ D.P.Γ.hatV cap := by + rw [← D.rad.isPreRadial.1] + exact ⟨⟨x, (hE.2.1 hx).1, rfl⟩, hU⟩ + obtain ⟨v, hv, e'⟩ := hV + exact (hE.2.1 hx).2 ((cap.isEmbedding.injective e') ▸ hv) + have hHU : (s.fr W).H.U ⊆ D.rad.G.U := (s.fr W).hW.H_sub.U_subset + by_cases hA : cap.emb x ∈ (s.fr W).sp.A + · rcases hA with hh | hu + · rcases (s.fr W).hW.hub_cases with ⟨z, -, hU, hz⟩ | ⟨-, -, hc, hz⟩ + · rw [hz] at hh + exact hG (hHU (hU ▸ hh)) + · rw [hz] at hh + by_cases hb : cap.emb x ∈ discBd (D.ins (s.fr W).H) + · obtain ⟨-, -, hi⟩ := (s.fr W).hub_data hc + exact hG (hHU (hi.2.2.2.1 ▸ hb)) + · exact hoff _ (.inr ⟨hc, rfl⟩) _ _ ((s.fr W).hubArm_disc hc) ⟨hh, hb⟩ + · obtain ⟨v, hv⟩ := mem_iUnion.mp hu + exact hG ((walkDrawing_isSubdrawing D.rad.G _).U_subset hv) + · obtain ⟨i, hi, hΔ⟩ := (s.fr W).cover_lt hin hA + by_cases hb : cap.emb x ∈ discBd ((s.fr W).sec i).Δ + · rw [← ((s.fr W).sec i).full.C_U] at hb + exact hG (((s.fr W).sec i).full.circuit.1.U_subset hb) + · exact hoff _ (.inl ⟨i, hi, rfl⟩) _ _ ((s.fr W).secArm_disc i) ⟨hΔ, hb⟩ + +omit s in +/-- The edge of `Γ` with a given lift. -/ +def up (s : Slice T D) (c : Set ↥Tᶜ) : Set S := s.f '' (Subtype.val '' c) + +omit s in +/-- The lift of an edge of `Γ`. -/ +def down (s : Slice T D) (e : Set S) : Set ↥Tᶜ := Subtype.val ⁻¹' (s.f.symm '' e) + +theorem up_inj {c c' : Set ↥Tᶜ} (h : s.up c = s.up c') : c = c' := + (Subtype.val_injective.image_injective) (s.f.injective.image_injective h) + +variable [Nonempty ↥Tᶜ] + +/-- An edge of `M(Γ, ℒ)` is an internal edge of `Γ'`. -/ +theorem down_mem (ε : Set ↥Tᶜ → Bool) {e : Set S} (he : e ∈ (coverLoc s.𝒲 s.cut.finite s.cut.disj + s.fr).M.edgeSet) : + s.down e ∈ (s.paint ε).E ∧ Painting.IsInternal (s.down e) ∧ s.up (s.down e) = e := by + have hE : e ∈ D.P.Γ.E := he.1 + have he' : s.f.symm '' e ∈ s.Q.Γ.E := by + change _ ∈ (D.P.Γ.push s.f.symm).E + rw [push_E] + exact ⟨e, hE, rfl⟩ + have hoffT : ∀ x ∈ e, s.f.symm x ∈ Tᶜ := fun x hx hT ↦ by + have hT' : s.f.symm x ∈ cutT (cap.emb ∘ s.f) s.𝒲 := (Set.ext_iff.mp s.hT _).mpr hT + obtain ⟨W, hW, hi⟩ := mem_iUnion₂.mp hT' + have hi' : cap.emb (s.f (s.f.symm x)) ∈ discInt W := hi + rw [s.f.apply_symm_apply] at hi' + exact s.off_wheels he hx ⟨W, hW⟩ (Surface.discInt_subset _ hi') + have hb : ¬ Painting.IsBorder (s.f.symm '' e) := by + rintro ⟨_, ⟨x, hx, rfl⟩, hxb⟩ + exact hoffT x hx (s.bd_sub_T hxb) + obtain ⟨x, hx⟩ := hE.1 + have hne : (Subtype.val ⁻¹' (s.f.symm '' e) : Set ↥Tᶜ).Nonempty := ⟨⟨s.f.symm x, hoffT x hx⟩, x, + hx, rfl⟩ + refine ⟨(s.fd.mem_paint_E _).mpr (.inr ⟨_, he', hb, hne, rfl⟩), ?_, ?_⟩ + · refine disjoint_left.mpr ?_ + rintro y ⟨z, hz, ez⟩ hyb + obtain ⟨W, hW, hi⟩ := mem_iUnion₂.mp (s.mem_bd.mp hyb) + have hi' : cap.emb (s.f y.1) ∈ discBd W := hi + rw [← ez, s.f.apply_symm_apply] at hi' + exact s.off_wheels he hz ⟨W, hW⟩ (Surface.discBd_subset _ hi') + · have hsub : s.f.symm '' e ⊆ range (Subtype.val : ↥Tᶜ → S) := by + rintro _ ⟨z, hz, rfl⟩ + exact ⟨⟨_, hoffT z hz⟩, rfl⟩ + rw [up, down, image_preimage_eq_of_subset hsub, image_image] + simp + +/-- An internal edge of `Γ'` comes from an edge of `Γ`. -/ +theorem internal_up (ε : Set ↥Tᶜ → Bool) {e₁ : Set ↥Tᶜ} (he₁ : e₁ ∈ (s.paint ε).E) + (hi : Painting.IsInternal e₁) : + s.up e₁ ∈ D.P.Γ.E ∧ (∀ (col : ↥s.𝒲 → ℕ → α) (a₀ : α) (Z : Set ↥Tᶜ), s.cutφ col a₀ Z e₁ = D.P.φ + (s.up e₁)) ∧ (tilde (s.up e₁)).ncard = (tilde e₁).ncard ∧ + D.P.Γ.γ (s.up e₁) = ((s.paint ε).γ e₁).map (fun x ↦ s.f x.1) ∧ ∀ x ∈ tilde e₁, s.f x.1 ∈ + tilde (s.up e₁) := by + classical + obtain ⟨e₂, he₂, hb, hne, rfl⟩ := s.fd.exists_lift_of_internal _ he₁ hi + have hsub := s.fd.pull.subset_R he₂ hb hne + have hsur : Subtype.val '' (Subtype.val ⁻¹' e₂ : Set ↥Tᶜ) = e₂ := image_preimage_eq_of_subset + (hsub.trans (image_subset_range _ _)) + have hE : e₂ ∈ (D.P.Γ.push s.f.symm).E := he₂ + rw [push_E] at hE + obtain ⟨c, hc, rfl⟩ := hE + have hff : s.f '' (s.f.symm '' c) = c := by + rw [image_image] + simp + have hup : s.up (Subtype.val ⁻¹' (s.f.symm '' c)) = c := by rw [up, hsur, hff] + rw [hup] + refine ⟨hc, fun col a₀ Z ↦ ?_, ?_, ?_, ?_⟩ + · rw [cutφ, ite_eq_left hi, hsur] + exact s.isImage.φ c hc + · rw [s.fd.pull.ncard_tilde he₂ hsub, ncard_tilde_image] + · have h₁ := (s.fd.map_march_lift (flip := flipOf ε) he₂ hb hne).trans (s.isImage.γ c hc) + have h₂ := congrArg (List.map s.f) h₁ + simp only [List.map_map] at h₂ + have h₃ : List.map (s.f ∘ s.f.symm) (D.P.Γ.γ c) = D.P.Γ.γ c := by + have : (s.f ∘ s.f.symm : S → S) = id := by + funext z + simp + rw [this, List.map_id] + rw [h₃] at h₂ + exact h₂.symm + · intro x hx + have h₁ : x.1 ∈ tilde (s.f.symm '' c) := by + rw [← s.fd.pull.frag.image_tilde_preimage hsub] + exact mem_image_of_mem _ hx + rw [tilde_image_homeo] at h₁ + obtain ⟨z, hz, ez⟩ := h₁ + have : s.f x.1 = z := by + rw [← ez] + simp + rw [this] + exact hz + +omit [Nonempty ↥Tᶜ] in +/-- An edge of `Γ` with a lift is an edge of `M(Γ, ℒ)`. -/ +theorem up_mem_M {c : Set ↥Tᶜ} (hc : s.up c ∈ D.P.Γ.E) : s.up c ∈ (coverLoc s.𝒲 s.cut.finite + s.cut.disj s.fr).M.edgeSet := by + have hT := cap.isClosedSurface + have hcl : IsClosed (s.f '' Tᶜ) := s.f.isClosed_image.mpr s.facts.1 + have hsub : closure (s.up c) ⊆ s.f '' Tᶜ := closure_minimal (by + rintro _ ⟨_, ⟨x, -, rfl⟩, rfl⟩ + exact ⟨x.1, x.2, rfl⟩) hcl + refine ⟨hc, fun A hA ↦ ?_⟩ + obtain ⟨W, hW⟩ := mem_iUnion.mp hA + obtain ⟨Δ, X, hd⟩ := (s.fr W).exists_disc hW + have key : ∀ x ∈ closure (s.up c), cap.emb x ∈ closure Δᶜ := by + intro x hx + rw [closure_compl_disc hT hd.disc] + obtain ⟨z, hz, rfl⟩ := hsub hx + intro hi + have hW' : cap.emb (s.f z) ∈ W.1 := hd.sub (.inl (Surface.discInt_subset _ hi)) + have hbd := discInt_off_bd hT (s.cut.disc W W.2) hd.disc (subset_union_left.trans hd.sub) hi + have hr : cap.emb (s.f z) ∈ range s.e := ⟨⟨z, hz⟩, rfl⟩ + rw [s.range_e] at hr + exact hr (mem_iUnion₂.mpr ⟨W, W.2, hW', hbd⟩) + rw [hd.compl] + exact ⟨hc, fun x hx ↦ key x (subset_closure hx), fun x hx ↦ key x hx.1.1⟩ + +end Slice + +namespace CutPair + +variable {T : Set S} {Da Db : TangleDatum cap χ} [Nonempty ↥Tᶜ] {sa : Slice T Da} {sb : Slice T Db} + {ε : Set ↥Tᶜ → Bool} {Φ' : Frame ↥Tᶜ} {Z : Set ↥Tᶜ} + {σv : ↥Tᶜ → Set ↥Tᶜ} {σe : Set ↥Tᶜ → Set ↥Tᶜ} {β : Type*} {Ω : QuasiOrder β} {ξa : Arm Da.P.Γ + → β} {ξb : Arm Db.P.Γ → β} {cola : ↥sa.𝒲 → ℕ → α} {colb : ↥sb.𝒲 → ℕ + → α} {a₀ : α} {Ωc : QuasiOrder α} + (h : CutPair sa sb ε Φ' Z σv σe Ω ξa ξb cola colb a₀ Ωc) +include h + +theorem image_internal {e : Set ↥Tᶜ} (he : e ∈ (sa.paint ε).E) (hi : Painting.IsInternal e) : + Painting.IsInternal (σe e) := by + refine disjoint_left.mpr fun x hx hxb ↦ ?_ + obtain ⟨C, hC, hxC⟩ := sUnion_cuffs (S := ↥Tᶜ) ▸ hxb + obtain ⟨y, hy, hyC⟩ := (h.infl.borders_iff e he C hC).mpr ⟨x, hx, hxC⟩ + obtain ⟨W, hW⟩ := sa.exists_wheel ⟨C, hC⟩ + exact disjoint_left.mp hi hy (sa.cf_sub_bd W.2 (hW ▸ hyC)) + +/-- The map on edges of `M(Γ, ℒ)`. -/ +def _root_.GraphMinor.GM19.CutPair.edgeMap (_ : CutPair sa sb ε Φ' Z σv σe Ω ξa ξb cola colb a₀ Ωc) + (e : Set S) : Set S := sb.up (σe (sa.down e)) + +theorem edge_facts {e : Set S} (he : e ∈ (coverLoc sa.𝒲 sa.cut.finite sa.cut.disj sa.fr).M.edgeSet) + : + h.edgeMap e ∈ (coverLoc sb.𝒲 sb.cut.finite sb.cut.disj sb.fr).M.edgeSet ∧ (tilde + (h.edgeMap e)).ncard = (tilde e).ncard ∧ χ.unionLE (Da.P.φ e) (Db.P.φ (h.edgeMap e)) ∧ + ∀ (i : ℕ) (hi : i < (Da.P.Γ.γ e).length) (hi' : i < (Db.P.Γ.γ (h.edgeMap e)).length), + Slice.Out sa sb σv (cap.emb (Db.P.Γ.γ (h.edgeMap e))[i]) (cap.emb (Da.P.Γ.γ e)[i]) := by + obtain ⟨hE, hint, hup⟩ := sa.down_mem ε he + have hEb := h.infl.edge_mem _ hE + have hib := h.image_internal hE hint + obtain ⟨c₁, φ₁, n₁, γ₁, -⟩ := sa.internal_up ε hE hint + obtain ⟨c₂, φ₂, n₂, γ₂, -⟩ := sb.internal_up ε hEb hib + rw [hup] at φ₁ n₁ γ₁ + refine ⟨sb.up_mem_M c₂, ?_, ?_, fun i hi hi' ↦ ?_⟩ + · change (tilde (sb.up _)).ncard = _ + rw [n₂, h.infl.edge_size _ hE, n₁] + · have := h.le_int _ hE hint + rwa [φ₁ cola a₀ Z, φ₂ colb a₀ Z] at this + · have hl₁ : i < ((sa.paint ε).γ (sa.down e)).length := by + rw [γ₁] at hi + simpa using hi + have hl₂ : i < ((sb.paint ε).γ (σe (sa.down e))).length := by + have hi'' : i < (Db.P.Γ.γ (sb.up (σe (sa.down e)))).length := hi' + rw [γ₂] at hi'' + simpa using hi'' + have hy := h.infl.ends _ hE i hl₁ hl₂ + have hmem : ((sa.paint ε).γ (sa.down e))[i] ∈ sa.N := by + rw [← sa.paint_V ε] + refine (sa.paint ε).tilde_subset_V hE ?_ + have := (sa.paint ε).γ_set _ hE + exact this ▸ List.getElem_mem hl₁ + refine ⟨_, _, ?_, ?_, hmem, hy⟩ + · change _ = cap.emb (sa.f _) + congr 1 + simp only [γ₁, List.getElem_map] + · change _ = cap.emb (sb.f _) + congr 1 + change (Db.P.Γ.γ (sb.up (σe (sa.down e))))[i] = _ + simp only [γ₂, List.getElem_map] + +omit h in +/-- The edges of an inflation stay in `Out`. -/ +theorem step_of_adj {x' u w : ↥Tᶜ} (hx : x' ∈ sa.N) (hu : u ∈ σv x') (hw : w ∈ σv x') (hadj : + (sb.paint ε).skAdj.Adj u w) : + OutStep sb.fr (Slice.Out sa sb σv) (sa.e x') (sb.e u) (sb.e w) := by + obtain ⟨hne, huV, hwV, c, hc, huc, hwc⟩ := hadj + refine ⟨⟨x', u, rfl, rfl, hx, hu⟩, ⟨x', w, rfl, rfl, hx, hw⟩, ?_⟩ + by_cases hi : Painting.IsInternal c + · obtain ⟨-, -, -, -, ht⟩ := sb.internal_up ε hc hi + have hN : ∀ {y}, y ∈ (sb.paint ε).V → sb.f y.1 ∈ Db.P.Γ.V := fun {y} hy ↦ by + rw [sb.paint_V] at hy + obtain ⟨v, hv, ev⟩ := (show sb.e y ∈ Db.P.Γ.hatV cap from hy) + exact (cap.isEmbedding.injective ev) ▸ hv + refine .inl ⟨_, _, rfl, rfl, fun e ↦ hne (Subtype.ext (sb.f.injective e)), hN huV, hN hwV, _, + (sb.internal_up ε hc hi).1, ht _ huc, ht _ hwc⟩ + · have hb : Painting.IsBorder c := by + by_contra hn + exact hi (isInternal_iff_not_border.mpr hn) + obtain ⟨W, q, hq, rfl⟩ := sb.exists_pos (sb.border_arc ε hc hb) + rw [sb.tilde_arc] at huc hwc + rcases huc with rfl | rfl <;> rcases hwc with rfl | rfl + · exact absurd rfl hne + · exact .inr ⟨W, q, hq, .inl ⟨sb.e_vx W q, sb.e_vx W (q + 1)⟩⟩ + · exact .inr ⟨W, q, hq, .inr ⟨sb.e_vx W (q + 1), sb.e_vx W q⟩⟩ + · exact absurd rfl hne + +theorem outlineData : OutlineData sa.fr sb.fr (sa.wmap sb) (Slice.Out sa sb σv) h.Sym Ω ξa ξb := by + have hwalk := h.rimWalk + refine ⟨sa.wmap_bij sb, ?_, hwalk, fun _ _ _ h' ↦ h'.2, fun W hc ↦ (h.last_match W).2.2.2.2.2 hc, + ?_, ?_, ?_, ?_, ?_⟩ + · rintro _ _ _ ⟨x, y, rfl, rfl, hx, hy⟩ ⟨x', y', rfl, e, hx', hy'⟩ + obtain rfl := sb.isEmbedding.injective e + rw [h.out_uniq hx hx' hy hy'] + · rintro _ _ ⟨x, y, rfl, rfl, hx, hy⟩ + refine ⟨?_, hx⟩ + have hV := h.infl.vertex_subset x (by rwa [sa.paint_V]) hy + rw [sb.paint_V] at hV + exact hV + · rintro _ _ ⟨x, y, rfl, rfl, -, -⟩ W hi + have hr : sb.e y ∈ range sb.e := ⟨y, rfl⟩ + rw [sb.range_e] at hr + exact hr (mem_iUnion₂.mpr ⟨W.1, W.2, hi⟩) + · rintro _ _ ⟨x, y, rfl, rfl, -, -⟩ W hi + have hr : sa.e x ∈ range sa.e := ⟨x, rfl⟩ + rw [sa.range_e] at hr + exact hr (mem_iUnion₂.mpr ⟨W.1, W.2, hi⟩) + · intro x hx hoff + have hr : x ∈ range sa.e := by + rw [sa.range_e] + intro hi + obtain ⟨W, hW, hi⟩ := mem_iUnion₂.mp hi + exact hoff ⟨W, hW⟩ hi + obtain ⟨x', rfl⟩ := hr + have hN : x' ∈ sa.N := hx + obtain ⟨y, hy⟩ := h.infl.vertex_nonempty x' (by rwa [sa.paint_V]) + exact ⟨sb.e y, x', y, rfl, rfl, hN, hy⟩ + · rintro _ _ _ ⟨x, y, rfl, rfl, hx, hy⟩ ⟨x', y', e, rfl, hx', hy'⟩ + obtain rfl := sa.isEmbedding.injective e + have hconn := h.infl.vertex_connected x (by rwa [sa.paint_V]) + have hr := hconn ⟨y, hy⟩ ⟨y', hy'⟩ + rw [SimpleGraph.reachable_iff_reflTransGen] at hr + exact hr.lift (fun u : ↥(σv x) ↦ sb.e u.1) fun u w hadj ↦ + step_of_adj (sa := sa) (sb := sb) (ε := ε) hx u.2 w.2 hadj + +/-- **The outline given by an inflation.** -/ +theorem exists_outline (hd : χ.IsDisjoint) : ∃ τ : Arm Da.P.Γ → Arm Db.P.Γ, + IsOutline (⟨hd, Da.P, coverLoc sa.𝒲 sa.cut.finite sa.cut.disj sa.fr⟩ : Place χ) ⟨hd, Db.P, + coverLoc sb.𝒲 sb.cut.finite sb.cut.disj sb.fr⟩ τ ∧ + ∀ A ∈ (coverLoc sa.𝒲 sa.cut.finite sa.cut.disj sa.fr).arms, Ω.le (ξa A) (ξb (τ A)) := by + refine h.outlineData.exists_outline hd sa.cut.finite sa.cut.disj sb.cut.finite sb.cut.disj + h.edgeMap (fun e he ↦ (h.edge_facts he).1) (fun e he ↦ (h.edge_facts he).2.1) ?_ + (fun e he i hi hi' ↦ (h.edge_facts he).2.2.2 i hi hi') (fun e he ↦ (h.edge_facts he).2.2.1) + intro e he e' he' heq + obtain ⟨hE, -, hup⟩ := sa.down_mem ε he + obtain ⟨hE', -, hup'⟩ := sa.down_mem ε he' + have h₁ := sb.up_inj heq + have h₂ := h.infl.edge_injOn hE hE' h₁ + rw [← hup, ← hup', h₂] + +end CutPair + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14ad.lean b/LeanPool/GraphMinor/GM19/Section14ad.lean new file mode 100644 index 0000000000..923fefbf4f --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14ad.lean @@ -0,0 +1,147 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14ac + +/-! +# Graph Minors XIX, Section 14: what each painting of the sequence records + +At each singular place of a rim we record a finite amount of data, and the colours of the long sides +record the sectors of the regular places. All of this +has only finitely many values, once `ρ` is bounded. So an infinite subsequence has the same data +everywhere. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- The data at a singular place. -/ +abbrev ZData := Bool × WheelFrame.CodeT × ℕ × Bool + +/-- The values of the data, for wheels of radius at most `b`. -/ +def zdataSet (b : ℕ) : Set ZData := {x | x.2.1 ∈ codeSet (2 * b + 3) ∧ x.2.2.1 ≤ 2 * b + 2} + +theorem finite_zdataSet (b : ℕ) : (zdataSet b).Finite := by + refine (((finite_univ (α := Bool)).prod ((finite_codeSet (2 * b + 3)).prod ((finite_Iic + (2 * b + 2)).prod (finite_univ (α := Bool)))))).subset ?_ + rintro ⟨a, c, l, h⟩ ⟨h₁, h₂⟩ + exact ⟨mem_univ _, h₁, h₂, mem_univ _⟩ + +theorem codeSet_mono {a b : ℕ} (h : a ≤ b) : codeSet a ⊆ codeSet b := by + rintro c ⟨h₁, h₂, h₃, h₄, h₅, h₆, h₇⟩ + refine ⟨by omega, by omega, by omega, by omega, h₅.trans (Finset.range_mono (by omega)), + by omega, fun x hx ↦ ?_⟩ + have := h₇ x hx + rcases x with x | x + · exact Nat.le_trans this h + · exact Nat.le_trans this h + +namespace Slice + +variable {T : Set S} {D : TangleDatum cap χ} (s : Slice T D) + +open Classical in +/-- The data at the `p`th place of a rim. -/ +noncomputable def zdata (W : ↥s.𝒲) (p : ℕ) : ZData := + (decide (p + 1 = (s.fr W).R.k), (s.fr W).code p, (s.fr W).hubList.length, decide + ((s.fr W).H.V.ncard ≠ 1)) + +include s + +theorem exists_pick {z : ↥Tᶜ} (hz : z ∈ s.markZ) : ∃ W p, p ∈ s.sing W ∧ z = s.zx W p := by + obtain ⟨W, hz⟩ := mem_iUnion.mp hz + obtain ⟨p, hp, hz⟩ := mem_iUnion₂.mp hz + exact ⟨W, p, hp, hz⟩ + +theorem zx_uniq {W W' : ↥s.𝒲} {p q : ℕ} (hp : p < (s.fr W).R.k) (hq : q < (s.fr W').R.k) + (h : s.zx W p = s.zx W' q) : W = W' ∧ HEq p q := by + have e := arcComp_eq_of_mem (s.arc_mem W p) (s.arc_mem W' q) (s.zx_arc W p) (h ▸ s.zx_arc W' q) + obtain rfl := s.arc_wheel e + exact ⟨rfl, heq_of_eq (s.arc_pos W hp hq e)⟩ + +omit s in +/-- A wheel and a place for a singular vertex of `R*`. -/ +noncomputable def pick (s : Slice T D) {z : ↥Tᶜ} (hz : z ∈ s.markZ) : ↥s.𝒲 × ℕ := + ((s.exists_pick hz).choose, (s.exists_pick hz).choose_spec.choose) + +theorem pick_spec {z : ↥Tᶜ} (hz : z ∈ s.markZ) : (s.pick hz).2 ∈ s.sing (s.pick hz).1 ∧ z = s.zx + (s.pick hz).1 (s.pick hz).2 := (s.exists_pick hz).choose_spec.choose_spec + +theorem pick_eq {z : ↥Tᶜ} (hz : z ∈ s.markZ) {W : ↥s.𝒲} {p : ℕ} (hp : p ∈ s.sing W) (e : z + = s.zx W p) : s.pick hz = (W, p) := by + obtain ⟨h₁, h₂⟩ := s.pick_spec hz + obtain ⟨hW, hq⟩ := s.zx_uniq h₁.1 hp.1 (h₂.symm.trans e) + exact Prod.ext hW (eq_of_heq hq) + +omit s in +open Classical in +/-- The data at a point. -/ +noncomputable def ztag (s : Slice T D) (z : ↥Tᶜ) : Option ZData := if h : z ∈ s.markZ then some + (s.zdata (s.pick h).1 (s.pick h).2) else none + +theorem ztag_zx {W : ↥s.𝒲} {p : ℕ} (hp : p ∈ s.sing W) : s.ztag (s.zx W p) = some (s.zdata W p) + := by + classical + have hz : s.zx W p ∈ s.markZ := mem_iUnion.mpr ⟨W, mem_iUnion₂.mpr ⟨_, hp, rfl⟩⟩ + rw [ztag, dite_eq_left hz, s.pick_eq hz hp rfl] + +theorem ztag_mem {b : ℕ} (hb : ∀ W, (s.fr W).ρ ≤ b) (z : ↥Tᶜ) : s.ztag z ∈ insert none + (some '' zdataSet b) := by + classical + by_cases hz : z ∈ s.markZ + · rw [ztag, dite_eq_left hz] + refine .inr (mem_image_of_mem _ ⟨?_, ?_⟩) + · exact codeSet_mono (by have := hb (s.pick hz).1; omega) ((s.fr _).code_mem _) + · have := (s.fr (s.pick hz).1).hubList_length_le + have := hb (s.pick hz).1 + change (s.fr (s.pick hz).1).hubList.length ≤ _ + omega + · rw [ztag, dite_eq_right hz] + exact .inl rfl + +omit s in +open Classical in +/-- The direction of the rim on a cuff. -/ +noncomputable def cuffDir (s : Slice T D) (C : Set ↥Tᶜ) : Bool := + if h : ∃ W : ↥s.𝒲, C = s.cf W then (s.exists_dir h.choose).choose else false + +theorem cuffDir_cf (W : ↥s.𝒲) : ∀ i, arcMarch s.isSurface (s.cuffDir (s.cf W)) (s.arc W i) + = [s.vx W i, s.vx W (i + 1)] := by + classical + have h : ∃ W' : ↥s.𝒲, s.cf W = s.cf W' := ⟨W, rfl⟩ + rw [cuffDir, dite_eq_left h] + have key : ∀ W' : ↥s.𝒲, s.cf W = s.cf W' → W = W' := fun W' e ↦ by + obtain ⟨x, hx⟩ : (s.cf W).Nonempty := ⟨_, s.vx_cf W 0⟩ + exact s.wheel_eq hx (e ▸ hx) + have e := key _ h.choose_spec + have key' : ∀ W' : ↥s.𝒲, W = W' → ∀ i, arcMarch s.isSurface (s.exists_dir W').choose (s.arc W i) + = [s.vx W i, s.vx W (i + 1)] := by + rintro _ rfl + exact (s.exists_dir W).choose_spec + exact key' _ e + +theorem march_arc {ε : Set ↥Tᶜ → Bool} (hε : ∀ C ∈ cuffs ↥Tᶜ, ε C = s.cuffDir C) (W : ↥s.𝒲) + (i : ℕ) : + arcMarch s.isSurface (flipOf ε (s.arc W i)) (s.arc W i) = [s.vx W i, s.vx W (i + 1)] := by + obtain ⟨x, hx, -⟩ := s.arc_reg W i + rw [flipOf_eq ε (s.cf_mem W.2) ⟨x, hx⟩ (s.arc_cf W i), hε _ (s.cf_mem W.2), s.cuffDir_cf] + +end Slice + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14ae.lean b/LeanPool/GraphMinor/GM19/Section14ae.lean new file mode 100644 index 0000000000..15b484106f --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14ae.lean @@ -0,0 +1,229 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14ad +public import LeanPool.GraphMinor.GM19.SideScheme + +import LeanPool.GraphMinor.GM19.FragmentOrient + +/-! +# Graph Minors XIX, Section 14: the sequence in `Σ'` + +Suppose that all the paintings of a sequence have the same frame `Φ'` and the same data at the +singular places, and that the sectors at the singular places increase along the sequence. +Then the condition `S₂` gives a linear inflation between two of the paintings `Γ'`, and so an +outline. This is the last step of the proof of (14.1) in the paper. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- The order of the colours of the long sides. Each colour stands for a sector of one of the +paintings, and two sectors are comparable if they have the same code. -/ +theorem exists_colOrder {I : Type} [Countable I] [Infinite α] {β : Type*} {τ : Type*} {Ω : + QuasiOrder β} (hΩ : Ω.IsWQO) (R : Set I) (cod : I → τ) (val : I → β) {C : Set τ} (hC : C.Finite) + (hc : ∀ x ∈ R, cod x ∈ C) (hv : ∀ x ∈ R, val x ∈ Ω.E) : + ∃ (enc : I → α) (Ωc : QuasiOrder α), Ωc.IsWQO ∧ (∀ x ∈ R, enc x ∈ Ωc.E) ∧ ∀ x y, Ωc.le (enc x) + (enc y) → cod y = cod x ∧ Ω.le (val x) (val y) := by + classical + obtain ⟨f, hf⟩ := exists_injective_nat I + let enc : I → α := fun x ↦ Infinite.natEmbedding α (f x) + have hinj : Function.Injective enc := (Infinite.natEmbedding α).injective.comp hf + let Ωc : QuasiOrder α := + { E := enc '' R + le := fun a b ↦ ∃ x y, a = enc x ∧ b = enc y ∧ cod y = cod x ∧ Ω.le (val x) (val y) + refl := by + rintro _ ⟨x, hx, rfl⟩ + exact ⟨x, x, rfl, rfl, rfl, Ω.refl _ (hv x hx)⟩ + trans := by + rintro _ ⟨x, hx, rfl⟩ _ ⟨y, hy, rfl⟩ _ ⟨z, hz, rfl⟩ ⟨x₁, y₁, e₁, e₂, h₁, h₂⟩ ⟨y₂, z₂, e₃, + e₄, h₃, h₄⟩ + obtain rfl := hinj e₁ + obtain rfl := hinj e₂ + obtain rfl := hinj e₃ + obtain rfl := hinj e₄ + exact ⟨x, z, rfl, rfl, h₃.trans h₁, Ω.trans _ (hv x hx) _ (hv y hy) _ (hv z hz) h₂ h₄⟩ } + refine ⟨enc, Ωc, ?_, fun x hx ↦ ⟨x, hx, rfl⟩, ?_⟩ + · intro g hg + choose x hx hxg using hg + have := hC.to_subtype + obtain ⟨c, hci⟩ := Finite.exists_infinite_fiber (fun i ↦ (⟨cod (x i), hc _ (hx i)⟩ : ↥C)) + have hI : ({i | (⟨cod (x i), hc _ (hx i)⟩ : ↥C) = c} : Set ℕ).Infinite + := Set.infinite_coe_iff.mp hci + obtain ⟨i, hi, j, hj, hij, hle⟩ := hΩ.exists_pair (f := fun i ↦ val (x i)) hI fun i _ ↦ hv _ + (hx i) + have hcod : cod (x j) = cod (x i) := congrArg Subtype.val (show _ = _ from (hj.trans + (Eq.symm hi))) + exact ⟨i, j, hij, x i, x j, (hxg i).symm, (hxg j).symm, hcod, hle⟩ + · rintro x y ⟨x₁, y₁, e₁, e₂, h₁, h₂⟩ + obtain rfl := hinj e₁ + obtain rfl := hinj e₂ + exact ⟨h₁, h₂⟩ + +omit [T2Space S] in +/-- The orders of `χ'` on the internal edges. The order `Ω(k)` loses the elements above `ω₀`. -/ +theorem exists_orders (χ : ColourScheme S α) {k : ℕ} {ω₀ : α} (h : (k = 2 ∧ ω₀ ∈ χ.Ω2.E) ∨ (k = 3 + ∧ ω₀ ∈ χ.Ω3.E)) : + ∃ Ω2' Ω3' : QuasiOrder α, Ω2'.IsWQO ∧ Ω3'.IsWQO ∧ Ω3'.IsSubIdeal χ.Ω3 ∧ Ω2'.IsSubIdeal χ.Ω2 ∧ + (Ω3'.IsStrictSubIdeal χ.Ω3 ∨ Ω2'.IsStrictSubIdeal χ.Ω2) ∧ + (∀ c ∈ χ.Ω2.E, ¬ χ.unionLE ω₀ c → c ∈ Ω2'.E) ∧ ∀ c ∈ χ.Ω3.E, ¬ χ.unionLE ω₀ c → c ∈ Ω3'.E + := by + have hrefl : ∀ Ω : QuasiOrder α, Ω.IsSubIdeal Ω := fun Ω ↦ ⟨subset_rfl, fun _ _ _ hx _ ↦ hx, fun + _ _ _ _ ↦ Iff.rfl⟩ + rcases h with ⟨-, hw⟩ | ⟨-, hw⟩ + · have hs := QuasiOrder.isStrictSubIdeal_withoutAbove hw + exact ⟨_, χ.Ω3, QuasiOrder.isWQO_withoutAbove χ.isWQO_2 ω₀, χ.isWQO_3, hrefl _, hs.1, + .inr hs, fun c hc hn ↦ ⟨hc, fun hle ↦ hn (.inl ⟨hw, hc, hle⟩)⟩, fun _ hc _ ↦ hc⟩ + · have hs := QuasiOrder.isStrictSubIdeal_withoutAbove hw + exact ⟨χ.Ω2, _, χ.isWQO_2, QuasiOrder.isWQO_withoutAbove χ.isWQO_3 ω₀, hs.1, hrefl _, + .inl hs, fun _ hc _ ↦ hc, fun c hc hn ↦ ⟨hc, fun hle ↦ hn (.inr (.inl ⟨hw, hc, hle⟩))⟩⟩ + +/-- The paintings of the sequence, with all that they have in common. -/ +structure Family {T : Set S} [Nonempty ↥Tᶜ] (D : ℕ → TangleDatum cap χ) (s : ∀ i, Slice T (D i)) + (N Z : Set ↥Tᶜ) (ε : Set ↥Tᶜ → Bool) (t : ↥Tᶜ → Option ZData) {β : Type*} (Ω : QuasiOrder β) + (ξ : ∀ i, Arm (D i).P.Γ → β) (ω₀ : α) (b : ℕ) (𝒮 : Set (ColouredPainting χ)) : Prop where + hN : ∀ i, (s i).markN = N + hZ : ∀ i, (s i).markZ = Z + hε : ∀ i, ∀ C ∈ cuffs ↥Tᶜ, ε C = (s i).cuffDir C + ht : ∀ i, ∀ z ∈ Z, (s i).ztag z = t z + hb : ∀ i W, ((s i).fr W).ρ ≤ b + hcov : ∀ i, ∀ e ∈ (D i).Γ.E, χ.unionLE ω₀ ((D i).P.φ e) → ∃ W ∈ (s i).𝒲, cap.emb '' e ⊆ W + hξ : ∀ i, ∀ A ∈ (coverLoc (s i).𝒲 (s i).cut.finite (s i).cut.disj (s i).fr).arms, ξ i A ∈ Ω.E + mono : ∀ i j, i < j → ∀ W p, p ∈ (s i).sing W → ∀ W' q, q ∈ (s j).sing W' → (s i).zx W p = + (s j).zx W' q → + Ω.le (ξ i (((s i).fr W).secArm p)) (ξ j (((s j).fr W').secArm q)) ∧ + ∀ (hc : ((s i).fr W).H.V.ncard ≠ 1) (hc' : ((s j).fr W').H.V.ncard ≠ 1), Ω.le (ξ i + (((s i).fr W).hubArm hc)) (ξ j (((s j).fr W').hubArm hc')) + hm : ∀ i, (D i).P ∈ 𝒮 + +namespace Family + +variable {T : Set S} [Nonempty ↥Tᶜ] {D : ℕ → TangleDatum cap χ} {s : ∀ i, Slice T + (D i)} {N Z : Set ↥Tᶜ} {ε : Set ↥Tᶜ → Bool} {t : ↥Tᶜ → Option ZData} {β : Type*} {Ω : QuasiOrder + β} + {ξ : ∀ i, Arm (D i).P.Γ → β} {ω₀ : α} {b : ℕ} {𝒮 : Set (ColouredPainting χ)} + +theorem internal_of_infl {Da Db : TangleDatum cap χ} {sa : Slice T Da} {sb : Slice T Db} {ε : Set + ↥Tᶜ → Bool} {σv : ↥Tᶜ → Set ↥Tᶜ} {σe : Set ↥Tᶜ → Set ↥Tᶜ} (h : IsLinearInflation (sa.paint ε) + (sb.paint ε) σv σe) + {e : Set ↥Tᶜ} (he : e ∈ (sa.paint ε).E) (hi : Painting.IsInternal e) : Painting.IsInternal + (σe e) := by + refine disjoint_left.mpr fun x hx hxb ↦ ?_ + obtain ⟨C, hC, hxC⟩ := sUnion_cuffs (S := ↥Tᶜ) ▸ hxb + obtain ⟨y, hy, hyC⟩ := (h.borders_iff e he C hC).mpr ⟨x, hx, hxC⟩ + obtain ⟨W, hW⟩ := sa.exists_wheel ⟨C, hC⟩ + exact disjoint_left.mp hi hy (sa.cf_sub_bd W.2 (hW ▸ hyC)) + +variable [Infinite α] (h : Family D s N Z ε t Ω ξ ω₀ b 𝒮) +include h + +theorem exists_pair (hd : χ.IsDisjoint) (hcl : IsPaintingClass χ 𝒮) (hS2 : ConditionS2 χ cap) + (hΩ : Ω.IsWQO) {k : ℕ} (hk : (k = 2 ∧ ω₀ ∈ χ.Ω2.E) ∨ (k = 3 ∧ ω₀ ∈ χ.Ω3.E)) : + ∃ i j, i < j ∧ ∃ τ : Arm (D i).P.Γ → Arm (D j).P.Γ, + IsOutline (⟨hd, (D i).P, coverLoc (s i).𝒲 (s i).cut.finite (s i).cut.disj + (s i).fr⟩ : Place χ) ⟨hd, (D j).P, coverLoc (s j).𝒲 (s j).cut.finite (s j).cut.disj + (s j).fr⟩ τ ∧ + ∀ A ∈ (coverLoc (s i).𝒲 (s i).cut.finite (s i).cut.disj (s i).fr).arms, Ω.le (ξ i A) (ξ j + (τ A)) := by + classical + have hS := χ.isSurface + have hconn := χ.connected + have hX := (s 0).isSurface + have hc := (s 0).connected + have hfN : N.Finite := h.hN 0 ▸ (s 0).finite_markN + have hsub : N ⊆ bd ↥Tᶜ := fun x hx ↦ ((s 0).markN_sub (h.hN 0 ▸ hx)).2 + have h2 : ∀ C : cuffs ↥Tᶜ, ∃ p ∈ N ∩ C.1, ∃ q ∈ N ∩ C.1, p ≠ q := h.hN 0 ▸ (s 0).two_marks + have hl : ∀ s₁ ∈ arcComponentsIn (bd ↥Tᶜ \ N), ∀ s₂ ∈ arcComponentsIn (bd ↥Tᶜ \ N), s₁ ≠ s₂ + → Disjoint s₁ Z → Disjoint s₂ Z → Disjoint (tilde s₁) (tilde s₂) := by + rw [← h.hN 0, ← h.hZ 0] + exact (s 0).long_disjoint + let Φ' : Frame ↥Tᶜ := cutFrame hX N Z ε hfN hsub h2 hl + have hF : ∀ i, (s i).IsCutFrame Φ' Z ε := fun i ↦ ⟨(h.hN i).symm, (h.hZ i).symm, fun _ ↦ Iff.rfl, + fun _ ↦ rfl⟩ + obtain ⟨Ω2', Ω3', h2w, h3w, h3s, h2s, hstrict, hm2, hm3⟩ := exists_orders χ hk + let I : Type := Σ i, ↥(s i).𝒲 × ℕ + have : ∀ i, Finite ↥(s i).𝒲 := fun i ↦ (s i).finite_𝒲 + have : Countable I := inferInstance + let R : Set I := {x | x.2.2 < ((s x.1).fr x.2.1).R.k} + obtain ⟨enc, Ωc, hcw, henc, hele⟩ := exists_colOrder (α := α) hΩ R (fun x : I ↦ + ((s x.1).fr x.2.1).code x.2.2) (fun x : I ↦ ξ x.1 (((s x.1).fr x.2.1).secArm x.2.2)) + (finite_codeSet (2 * b + 3)) + (fun x _ ↦ codeSet_mono (by have := h.hb x.1 x.2.1; omega) (((s x.1).fr x.2.1).code_mem _)) + (fun x hx ↦ h.hξ _ _ (mem_iUnion.mpr ⟨x.2.1, .inl ⟨_, hx, rfl⟩⟩)) + let a₀ : α := Classical.arbitrary α + let col : ∀ i, ↥(s i).𝒲 → ℕ → α := fun i W p ↦ enc ⟨i, W, p⟩ + have hO : ∀ i, (s i).IsCutOrders ω₀ Ω2' Ω3' Ωc (col i) := fun i ↦ ⟨hm2, hm3, h.hcov i, fun W p hp + _ ↦ henc ⟨i, W, p⟩ hp⟩ + let χ' := cutScheme hX hc Φ' Ω2' Ω3' Ωc h2w h3w hcw a₀ + let P' : ℕ → ColouredPainting χ' := fun i ↦ (s i).colPaint ε (hF i) h2w h3w hcw a₀ (col i) (hO i) + have hsim : IsSimilarlyOriented χ' P' := by + rcases hcl.similarly_oriented with h' | ⟨ω, hω⟩ + · exact Or.inl fun hO' ↦ h' ((s 0).orientable hO') + · obtain ⟨ω₁, hω₁⟩ := GraphMinor.GM19.fragmentOrientation S _ (s 0).K Subtype.val hS hconn + (s 0).fd.pull.frag ω + refine Or.inr ⟨ω₁, fun i e he h3 a b' c hl' ↦ (s i).paint_pos ε hω₁ + (fun e' he' h3' ↦ ?_) e he h3 a b' c hl'⟩ + exact hω _ (hcl.image_mem _ (h.hm i) _ _ (s i).hf.symm (s i).isImage) e' he' h3' + obtain ⟨i, j, hij, σv, σe, hI⟩ : ∃ i j, i < j ∧ ∃ σv σe, IsColouredLinearInflation χ' (P' i) + (P' j) σv σe := by + by_contra hb' + exact hS2 ↥Tᶜ Shat χ' (s 0).nonempty_capped ⟨Homeomorph.refl _⟩ h3s h2s hstrict ⟨P', + fun i j hij hex ↦ hb' ⟨i, j, hij, hex⟩, hsim⟩ + have hint : ∀ e ∈ ((s i).paint ε).E, Painting.IsInternal e → χ.unionLE ((s i).cutφ + (col i) a₀ Z e) ((s j).cutφ (col j) a₀ Z (σe e)) := by + intro e he hi + have hie := internal_of_infl hI.isLinear he hi + have hEb := hI.isLinear.edge_mem e he + have hsz := hI.isLinear.edge_size e he + rcases ((s i).paint ε).edge_shape e he with ⟨h₂, -⟩ | ⟨h₃, -⟩ + · have m₁ := (P' i).internal_2_mem e he hi h₂ + have m₂ := (P' j).internal_2_mem (σe e) hEb hie (hsz.trans h₂) + exact .inl ⟨h2s.E_subset m₁, h2s.E_subset m₂, (h2s.le_iff _ m₁ _ m₂).mp + (hI.le_internal_2 e he hi h₂)⟩ + · have m₁ := (P' i).internal_3_mem e he hi h₃ + have m₂ := (P' j).internal_3_mem (σe e) hEb hie (hsz.trans h₃) + exact .inr (.inl ⟨h3s.E_subset m₁, h3s.E_subset m₂, (h3s.le_iff _ m₁ _ m₂).mp + (hI.le_internal_3 e he hi h₃)⟩) + have hp : CutPair (s i) (s j) ε Φ' Z σv σe Ω (ξ i) (ξ j) (col i) (col j) a₀ Ωc := by + refine ⟨hF i, hF j, (s i).march_arc (h.hε i), (s j).march_arc (h.hε j), hI.isLinear, + hI.respects, hint, ?_, ?_, ?_⟩ + · intro e he hb' c hc' hl' hsub' + have := hI.le_border e he c hc' ⟨hb', hsub'⟩ + change (if Φ'.isLong c then Ωc else QuasiOrder.single a₀).le _ _ at this + rw [ite_eq_left hl'] at this + exact this + · intro W p W' q hle + exact hele ⟨i, W, p⟩ ⟨j, W', q⟩ hle + · intro W p hp' W' q hq' hz + have hzZ : (s i).zx W p ∈ Z := h.hZ i ▸ mem_iUnion.mpr ⟨W, mem_iUnion₂.mpr ⟨_, hp', rfl⟩⟩ + have hzZ' : (s j).zx W' q ∈ Z := hz ▸ hzZ + have e₁ := ((s i).ztag_zx hp').symm.trans (h.ht i _ hzZ) + have e₂ := ((s j).ztag_zx hq').symm.trans (h.ht j _ hzZ') + rw [← hz] at e₂ + have e₃ : (s i).zdata W p = (s j).zdata W' q := Option.some.inj (e₁.trans e₂.symm) + simp only [Slice.zdata, Prod.mk.injEq, decide_eq_decide] at e₃ + obtain ⟨hk', hc', hlen, hcc⟩ := e₃ + obtain ⟨hle₁, hle₂⟩ := h.mono i j hij W p hp' W' q hq' hz + exact ⟨hk', hc'.symm, hle₁, hlen.symm, fun hc₀ ↦ ⟨hcc.mp hc₀, hle₂ hc₀ (hcc.mp hc₀)⟩⟩ + obtain ⟨τ, h₁, h₂⟩ := hp.exists_outline hd + exact ⟨i, j, hij, τ, h₁, h₂⟩ + +end Family + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14af.lean b/LeanPool/GraphMinor/GM19/Section14af.lean new file mode 100644 index 0000000000..e5656ab189 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14af.lean @@ -0,0 +1,174 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14ae + +import LeanPool.GraphMinor.GM19.FragmentOrient + +/-! +# Graph Minors XIX, Section 14: thinning the sequence + +The paper passes to a subsequence in which the frames and the short sides agree. We do this here. +There are only finitely many possible values, so an infinite +subsequence takes one value. Then the sectors at the singular places lie in a well-quasi-order, and +a further subsequence makes them increase. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- A sequence with values in a finite set is constant on a subsequence. -/ +theorem exists_subseq_const {τ : Type*} {F : Set τ} (hF : F.Finite) (h : ℕ → τ) + (hm : ∀ i, h i ∈ F) : ∃ (g : ℕ → ℕ) (t : τ), StrictMono g ∧ ∀ i, h (g i) = t := by + have := hF.to_subtype + obtain ⟨c, hc⟩ := Finite.exists_infinite_fiber (fun i ↦ (⟨h i, hm i⟩ : ↥F)) + have hI : ({i | (⟨h i, hm i⟩ : ↥F) = c} : Set ℕ).Infinite := Set.infinite_coe_iff.mp hc + refine ⟨Nat.nth (· ∈ {i | (⟨h i, hm i⟩ : ↥F) = c}), c.1, Nat.nth_strictMono hI, fun i ↦ ?_⟩ + exact congrArg Subtype.val (Nat.nth_mem_of_infinite hI i) + +/-- Finitely many sequences in a well-quasi-order increase together on a subsequence. -/ +theorem exists_subseq_mono {ι β : Type*} [Finite ι] {Ω : QuasiOrder β} (hΩ : Ω.IsWQO) (y : ℕ → ι + → β) (hy : ∀ i a, y i a ∈ Ω.E) : + ∃ g : ℕ → ℕ, StrictMono g ∧ ∀ m n, m ≤ n → ∀ a, Ω.le (y (g m) a) (y (g n) a) := by + classical + have := Fintype.ofFinite ι + have key : ∀ A : Finset ι, ∃ g : ℕ → ℕ, StrictMono g ∧ ∀ m n, m ≤ n → ∀ a ∈ A, Ω.le (y (g m) a) + (y (g n) a) := by + intro A + induction A using Finset.induction_on with + | empty => exact ⟨id, strictMono_id, fun _ _ _ _ ha ↦ absurd ha (Finset.notMem_empty _)⟩ + | insert a A _ ih => + obtain ⟨g, hg, hle⟩ := ih + obtain ⟨g', hg', hle'⟩ := hΩ.exists_mono_subseq (fun n ↦ y (g n) a) fun i ↦ hy _ a + refine ⟨g ∘ g', hg.comp hg', fun m n hmn b hb ↦ ?_⟩ + rcases Finset.mem_insert.mp hb with rfl | hb + · exact hle' m n hmn + · exact hle _ _ (hg'.monotone hmn) b hb + obtain ⟨g, hg, hle⟩ := key Finset.univ + exact ⟨g, hg, fun m n hmn a ↦ hle m n hmn a (Finset.mem_univ a)⟩ + +namespace Slice + +variable {T : Set S} {D : TangleDatum cap χ} (s : Slice T D) + +/-- The sector at a singular vertex of `R*`. -/ +noncomputable def zsec {β : Type*} (ξ : Arm D.P.Γ → β) (x : ↥s.𝒲 × ℕ) : β := ξ + ((s.fr x.1).secArm x.2) + +open Classical in +/-- The hub at a singular vertex of `R*`. If the hub is a vertex then there is no arm, and we take +the sector again. -/ +noncomputable def zhub {β : Type*} (ξ : Arm D.P.Γ → β) (x : ↥s.𝒲 × ℕ) : β := if hc : + (s.fr x.1).H.V.ncard ≠ 1 then ξ ((s.fr x.1).hubArm hc) else ξ ((s.fr x.1).secArm x.2) + +theorem zsec_mem {β : Type*} {E : Set β} {ξ : Arm D.P.Γ → β} (hξ : ∀ A ∈ + (coverLoc s.𝒲 s.cut.finite s.cut.disj s.fr).arms, ξ A ∈ E) {x : ↥s.𝒲 × ℕ} + (hx : x.2 ∈ s.sing x.1) : s.zsec ξ x ∈ E := + hξ _ (mem_iUnion.mpr ⟨x.1, .inl ⟨_, hx.1, rfl⟩⟩) + +theorem zhub_mem {β : Type*} {E : Set β} {ξ : Arm D.P.Γ → β} (hξ : ∀ A ∈ + (coverLoc s.𝒲 s.cut.finite s.cut.disj s.fr).arms, ξ A ∈ E) {x : ↥s.𝒲 × ℕ} + (hx : x.2 ∈ s.sing x.1) : s.zhub ξ x ∈ E := by + classical + by_cases hc : (s.fr x.1).H.V.ncard ≠ 1 + · rw [zhub, dite_eq_left hc] + exact hξ _ (mem_iUnion.mpr ⟨x.1, .inr ⟨hc, rfl⟩⟩) + · rw [zhub, dite_eq_right hc] + exact hξ _ (mem_iUnion.mpr ⟨x.1, .inl ⟨_, hx.1, rfl⟩⟩) + +end Slice + +/-- **The sequence with the wheels in one place.** -/ +theorem exists_pair_slices [Infinite α] {T : Set S} {D : ℕ → TangleDatum cap χ} (s : ∀ i, Slice T + (D i)) {V : Set ↥Tᶜ} (hV : V.Finite) (hVm : ∀ i, (s i).markN ⊆ V ∧ (s i).markZ ⊆ V) {b : ℕ} + (hb : ∀ i W, ((s i).fr W).ρ ≤ b) + {ω₀ : α} (hcov : ∀ i, ∀ e ∈ (D i).Γ.E, χ.unionLE ω₀ ((D i).P.φ e) → ∃ W ∈ + (s i).𝒲, cap.emb '' e ⊆ W) {𝒮 : Set (ColouredPainting χ)} (hm : ∀ i, (D i).P ∈ 𝒮) + (hd : χ.IsDisjoint) + (hcl : IsPaintingClass χ 𝒮) (hS2 : ConditionS2 χ cap) {k : ℕ} (hk : (k = 2 ∧ ω₀ ∈ χ.Ω2.E) ∨ (k + = 3 ∧ ω₀ ∈ χ.Ω3.E)) {β : Type*} {Ω : QuasiOrder β} (hΩ : Ω.IsWQO) + (ξ : ∀ i, Arm (D i).P.Γ → β) (hξ : ∀ i, ∀ A ∈ (coverLoc (s i).𝒲 (s i).cut.finite (s i).cut.disj + (s i).fr).arms, ξ i A ∈ Ω.E) : + ∃ i j, i < j ∧ ∃ τ : Arm (D i).P.Γ → Arm (D j).P.Γ, + IsOutline (⟨hd, (D i).P, coverLoc (s i).𝒲 (s i).cut.finite (s i).cut.disj + (s i).fr⟩ : Place χ) ⟨hd, (D j).P, coverLoc (s j).𝒲 (s j).cut.finite (s j).cut.disj + (s j).fr⟩ τ ∧ + ∀ A ∈ (coverLoc (s i).𝒲 (s i).cut.finite (s i).cut.disj (s i).fr).arms, Ω.le (ξ i A) (ξ j + (τ A)) := by + classical + have : Nonempty ↥Tᶜ := (s 0).connected.toNonempty + have hX := (s 0).isSurface + have hcf : (cuffs ↥Tᶜ).Finite := (cuff_statement _ hX).2.1 + have : Finite ↥(cuffs ↥Tᶜ) := hcf.to_subtype + have : Finite ↥V := hV.to_subtype + let tag : ℕ → Set ↥Tᶜ × Set ↥Tᶜ × (↥(cuffs ↥Tᶜ) → Bool) × (↥V → Option ZData) := fun i ↦ + ((s i).markN, (s i).markZ, fun C ↦ (s i).cuffDir C.1, fun z ↦ (s i).ztag z.1) + have hfB := ((finite_zdataSet b).image (some : ZData → Option ZData)).insert none + have hF := (hV.finite_subsets).prod ((hV.finite_subsets).prod ((finite_univ (α := ↥(cuffs ↥Tᶜ) + → Bool)).prod (Set.Finite.pi' (ι := ↥V) (t := fun _ ↦ insert none + (some '' zdataSet b)) fun _ ↦ hfB))) + obtain ⟨g₂, ⟨N, Z, εf, tf⟩, hg₂, htag⟩ := exists_subseq_const hF tag fun i ↦ ⟨(hVm i).1, + (hVm i).2, mem_univ _, fun z ↦ (s i).ztag_mem (hb i) z.1⟩ + have hN : ∀ i, (s (g₂ i)).markN = N := fun i ↦ congrArg Prod.fst (htag i) + have hZ : ∀ i, (s (g₂ i)).markZ = Z := fun i ↦ congrArg (fun x ↦ x.2.1) (htag i) + have hε₀ : ∀ i (C : ↥(cuffs ↥Tᶜ)), (s (g₂ i)).cuffDir C.1 = εf C := fun i C ↦ congrFun (congrArg + (fun x ↦ x.2.2.1) (htag i)) C + have ht₀ : ∀ i (z : ↥V), (s (g₂ i)).ztag z.1 = tf z := fun i z ↦ congrFun (congrArg + (fun x ↦ x.2.2.2) (htag i)) z + have hZV : Z ⊆ V := hZ 0 ▸ (hVm _).2 + let ε : Set ↥Tᶜ → Bool := fun C ↦ if h : C ∈ cuffs ↥Tᶜ then εf ⟨C, h⟩ else false + let t : ↥Tᶜ → Option ZData := fun z ↦ if h : z ∈ V then tf ⟨z, h⟩ else none + have hzp : ∀ i (z : ↥Z), z.1 ∈ (s (g₂ i)).markZ := fun i z ↦ (hZ i).symm ▸ z.2 + let y : ℕ → ↥Z ⊕ ↥Z → β := fun i a ↦ Sum.elim (fun z ↦ (s (g₂ i)).zsec (ξ (g₂ i)) ((s + (g₂ i)).pick (hzp i z))) (fun z ↦ (s (g₂ i)).zhub (ξ (g₂ i)) ((s (g₂ i)).pick (hzp i z))) a + have : Finite ↥Z := (hV.subset hZV).to_subtype + obtain ⟨g₃, hg₃, hle⟩ := exists_subseq_mono hΩ y (by + rintro i (z | z) + · exact (s (g₂ i)).zsec_mem (hξ _) ((s (g₂ i)).pick_spec (hzp i z)).1 + · exact (s (g₂ i)).zhub_mem (hξ _) ((s (g₂ i)).pick_spec (hzp i z)).1) + let g : ℕ → ℕ := fun i ↦ g₂ (g₃ i) + have hg : StrictMono g := hg₂.comp hg₃ + have hfam : Family (fun i ↦ D (g i)) (fun i ↦ s (g i)) N Z ε t Ω (fun i ↦ ξ (g i)) ω₀ b 𝒮 := by + refine ⟨fun i ↦ hN _, fun i ↦ hZ _, fun i C hC ↦ ?_, fun i z hz ↦ ?_, fun i ↦ hb _, + fun i ↦ hcov _, fun i ↦ hξ _, ?_, fun i ↦ hm _⟩ + · simp only [ε, dite_eq_left hC] + exact (hε₀ _ ⟨C, hC⟩).symm + · simp only [t, dite_eq_left (hZV hz)] + exact ht₀ _ ⟨z, hZV hz⟩ + · intro i j hij W p hp W' q hq hzz + have hzZ : (s (g i)).zx W p ∈ Z := hZ (g₃ i) ▸ mem_iUnion.mpr ⟨W, mem_iUnion₂.mpr ⟨_, hp, + rfl⟩⟩ + let z : ↥Z := ⟨_, hzZ⟩ + have hp₁ : (s (g i)).pick (hzp (g₃ i) z) = (W, p) := (s (g i)).pick_eq _ hp rfl + have hp₂ : (s (g j)).pick (hzp (g₃ j) z) = (W', q) := (s (g j)).pick_eq _ hq hzz + have h₁ := hle i j hij.le (.inl z) + have h₂ := hle i j hij.le (.inr z) + simp only [y, Sum.elim_inl, Sum.elim_inr] at h₁ h₂ + change Ω.le ((s (g i)).zsec (ξ (g i)) ((s (g i)).pick (hzp (g₃ i) z))) ((s (g j)).zsec (ξ + (g j)) ((s (g j)).pick (hzp (g₃ j) z))) at h₁ + change Ω.le ((s (g i)).zhub (ξ (g i)) ((s (g i)).pick (hzp (g₃ i) z))) ((s (g j)).zhub (ξ + (g j)) ((s (g j)).pick (hzp (g₃ j) z))) at h₂ + rw [hp₁, hp₂] at h₁ h₂ + refine ⟨h₁, fun hc hc' ↦ ?_⟩ + simp only [Slice.zhub, dite_eq_left hc, dite_eq_left hc'] at h₂ + exact h₂ + obtain ⟨i, j, hij, τ, h₁, h₂⟩ := hfam.exists_pair hd hcl hS2 hΩ hk + exact ⟨g i, g j, hg hij, τ, h₁, h₂⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14ag.lean b/LeanPool/GraphMinor/GM19/Section14ag.lean new file mode 100644 index 0000000000..90ac6522d2 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14ag.lean @@ -0,0 +1,147 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14af +public import LeanPool.GraphMinor.GM07.Section5b + +import LeanPool.GraphMinor.GM19.FragmentOrient + +/-! +# Graph Minors XIX, Section 14: the places of one feature + +Fix a drawing `K` in `Σ`. A row is a wheel cover of a painting whose boundaries lie on `U(K)` and +whose marked points lie in `V(K)`, after a `Φ`-preserving homeomorphism. We show that +the places of all rows are well-behaved. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- A wheel cover of `D` in position on `K`. -/ +structure Row (D : TangleDatum cap χ) (ω₀ : α) (K : Drawing S) (b : ℕ) where + /-- The wheel discs used to make the cuts. -/ + 𝒲 : Set (Set Shat) + /-- The chosen wheel frame on each disc. -/ + fr : ∀ W : ↥𝒲, WheelFrame D W.1 + /-- The homeomorphism applied before cutting. -/ + f : S ≃ₜ S + hf : IsFramePreservingHomeo χ.Φ f + cut : IsCutData (cap.emb ∘ f) 𝒲 + cov : ∀ e ∈ D.Γ.E, χ.unionLE ω₀ (D.P.φ e) → ∃ W ∈ 𝒲, cap.emb '' e ⊆ W + hb : ∀ W, (fr W).ρ ≤ b + hU : cutF (cap.emb ∘ f) 𝒲 = K.U + hV : ∀ (W : ↥𝒲) (i : ℕ), i < (fr W).R.k → (i + 1 = (fr W).R.k ∨ ¬ (fr W).Reg i) + → ∀ x : S, cap.emb (f x) = (fr W).R.vert i ∨ cap.emb (f x) = (fr W).R.vert (i + 1) ∨ cap.emb + (f x) = (fr W).R.reg i → x ∈ K.V + +namespace Row + +variable {D : TangleDatum cap χ} {ω₀ : α} {K : Drawing S} {b : ℕ} (r : Row D ω₀ K b) + +/-- The part of `Σ` that a row deletes. -/ +def T : Set S := cutT (cap.emb ∘ r.f) r.𝒲 + +/-- The slice of a row. -/ +def slice {T' : Set S} (h : r.T = T') : Slice T' D := ⟨r.𝒲, r.fr, r.f, r.hf, r.cut, h⟩ + +/-- The place of a row. -/ +noncomputable def place (hd : χ.IsDisjoint) : Place χ := ⟨hd, D.P, coverLoc r.𝒲 r.cut.finite + r.cut.disj r.fr⟩ + +theorem T_inter : Disjoint r.T K.U := by + rw [← r.hU] + refine disjoint_left.mpr fun x hx hx' ↦ ?_ + obtain ⟨W, hW, hi⟩ := mem_iUnion₂.mp hx + obtain ⟨W', hW', hb⟩ := mem_iUnion₂.mp hx' + by_cases he : W = W' + · subst he + exact hi.2 hb + · exact disjoint_left.mp (r.cut.disj hW hW' he) hi.1 (Surface.discBd_subset _ hb) + +/-- A row deletes a union of regions of `K`. -/ +theorem T_eq : r.T = ⋃₀ {c ∈ K.R | c ⊆ r.T} := by + have := cap.connected + let s := r.slice rfl + refine Subset.antisymm (fun x hx ↦ ?_) (sUnion_subset fun c hc ↦ hc.2) + have hxU : x ∈ univ \ K.U := ⟨mem_univ _, disjoint_left.mp r.T_inter hx⟩ + refine ⟨connectedComponentIn (univ \ K.U) x, ⟨⟨x, hxU, rfl⟩, ?_⟩, mem_connectedComponentIn hxU⟩ + have hTo : IsOpen r.T := s.isOpen_T + have hco : IsOpen (r.T ∪ K.U)ᶜ := by + have := s.isClosed_T_F + rw [show cutF (cap.emb ∘ s.f) s.𝒲 = K.U from r.hU] at this + exact this.isOpen_compl + refine isPreconnected_connectedComponentIn.subset_left_of_subset_union hTo hco + (disjoint_left.mpr fun y hy hy' ↦ hy' (.inl hy)) ?_ ⟨x, mem_connectedComponentIn hxU, hx⟩ + intro y hy + have hy' := connectedComponentIn_subset _ _ hy + by_cases hyT : y ∈ r.T + · exact .inl hyT + · exact .inr fun h ↦ h.elim hyT hy'.2 + +end Row + +/-- The places of the rows on `K`. -/ +def rowPlaces (cap : IsCappedSurface S Shat) {χ : ColourScheme S α} (hd : χ.IsDisjoint) (𝒮 : Set + (ColouredPainting χ)) (ω₀ : α) (K : Drawing S) (b : ℕ) : Set (Place χ) := + {X | ∃ D : TangleDatum cap χ, D.P ∈ 𝒮 ∧ ∃ r : Row D ω₀ K b, X = r.place hd} + +theorem rowPlaces_wellBehaved [Infinite α] (hd : χ.IsDisjoint) {𝒮 : Set + (ColouredPainting χ)} (hcl : IsPaintingClass χ 𝒮) (hS2 : ConditionS2 χ cap) {k : ℕ} {ω₀ : α} + (hk : (k = 2 ∧ ω₀ ∈ χ.Ω2.E) ∨ (k = 3 ∧ ω₀ ∈ χ.Ω3.E)) (K : Drawing S) + (b : ℕ) : IsWellBehavedPlaces (rowPlaces cap hd 𝒮 ω₀ K b) := by + intro β Ω hΩ seq hseq ξ hξ + classical + have hS := χ.isSurface + have hconn := χ.connected + choose D hm r hr using hseq + obtain rfl : seq = fun i ↦ (r i).place hd := funext hr + have hprop : K.IsProper := by + rintro x ⟨hxb, hxU⟩ + exfalso + have hT : x ∈ (r 0).T := ((r 0).slice rfl).bd_sub_T hxb + exact disjoint_left.mp (r 0).T_inter hT hxU + have hR : K.R.Finite := GM07.finite_regions_of_isProper hS hprop + have hF : (sUnion '' 𝒫 K.R).Finite := hR.finite_subsets.image _ + have hsets : ∀ i, (r i).T ∈ sUnion '' 𝒫 K.R := fun i ↦ + ⟨{c ∈ K.R | c ⊆ (r i).T}, fun _ hc ↦ hc.1, (r i).T_eq.symm⟩ + obtain ⟨g₁, T₀, hg₁, hT⟩ := exists_subseq_const hF (fun i ↦ (r i).T) hsets + have hfV : ((Subtype.val : ↥T₀ᶜ → S) ⁻¹' K.V).Finite := K.finite_V.preimage + Subtype.val_injective.injOn + have hmN : ∀ i, ((r (g₁ i)).slice (hT i)).markN ⊆ (Subtype.val : ↥T₀ᶜ → S) ⁻¹' K.V ∧ ((r + (g₁ i)).slice (hT i)).markZ ⊆ (Subtype.val : ↥T₀ᶜ → S) ⁻¹' K.V := by + intro i + let s := (r (g₁ i)).slice (hT i) + constructor + · intro x hx + obtain ⟨W, hx⟩ := mem_iUnion.mp hx + obtain ⟨p, hp, hx⟩ := mem_iUnion₂.mp hx + rcases hx with rfl | hx + · exact (r (g₁ i)).hV W p hp.1 hp.2 _ (.inl (s.e_vx W p)) + · exact (r (g₁ i)).hV W p hp.1 hp.2 _ (.inr (.inl ((mem_singleton_iff.mp hx) ▸ s.e_vx W + (p + 1)))) + · intro x hx + obtain ⟨W, hx⟩ := mem_iUnion.mp hx + obtain ⟨p, hp, rfl⟩ := mem_iUnion₂.mp hx + exact (r (g₁ i)).hV W p hp.1 hp.2 _ (.inr (.inr (s.e_zx W p))) + obtain ⟨i, j, hij, τ, h₁, h₂⟩ := exists_pair_slices (fun i ↦ (r (g₁ i)).slice (hT i)) hfV hmN + (fun i ↦ (r (g₁ i)).hb) (fun i ↦ (r (g₁ i)).cov) (fun i ↦ hm _) hd hcl hS2 hk hΩ (fun i ↦ ξ + (g₁ i)) (fun i ↦ hξ _) + exact ⟨g₁ i, g₁ j, hg₁ hij, τ, h₁, h₂⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14ah.lean b/LeanPool/GraphMinor/GM19/Section14ah.lean new file mode 100644 index 0000000000..de34976e74 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14ah.lean @@ -0,0 +1,316 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14ag +public import Mathlib.Data.Set.Card.Arithmetic + +import LeanPool.GraphMinor.GM07.Bridge + +import LeanPool.GraphMinor.GM19.FeatureCount + +import LeanPool.GraphMinor.GM19.FragmentOrient + +/-! +# Graph Minors XIX, Section 14: the proof of (14.1) + +The boundaries of the wheels, with the singular places of the rims marked, form a feature of bounded +size. By (5.2) there are finitely many of these up to homeomorphism. So the places of +all the paintings lie in finitely many sets of rows, and each of these is well-behaved. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable (D : TangleDatum cap χ) {ω₀ : α} {𝒲 : Set (Set Shat)} + +omit [T2Space S] in +/-- Each capping disc lies inside a wheel, since its pole does and no rim meets it. -/ +theorem cover_compl (hc : D.IsWheelCover ω₀ 𝒲) : (⋃ W ∈ 𝒲, discInt W)ᶜ ⊆ cap.emb '' (bd S)ᶜ := by + have hS := χ.isSurface + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := cap.isSurface.2.2 + have hin : ∀ Θ ∈ cuffs S, ∃ W ∈ 𝒲, closure (cap.cuffDisc Θ) ⊆ discInt W := by + intro Θ hΘ + obtain ⟨p, hp, hpd, -⟩ := D.rad.exists_pole hΘ + obtain ⟨W, hW, hpW⟩ := hc.poles_covered p hp + have hcl : closure (cap.cuffDisc Θ) = cap.cuffDisc Θ ∪ cap.emb '' Θ + := cap.closure_cuffDisc hΘ + have hoffr : ∀ {x}, x ∈ cap.cuffDisc Θ → x ∉ range cap.emb := fun {x} hx hr ↦ by + have : x ∈ (range cap.emb)ᶜ := by + rw [cap.compl_eq] + exact mem_biUnion hΘ hx + exact this hr + have hoff : Disjoint (closure (cap.cuffDisc Θ)) (discBd W) := by + refine disjoint_left.mpr fun x hx hxb ↦ ?_ + obtain ⟨y, hy, rfl⟩ := hc.bd_in_interior W hW hxb + rw [hcl] at hx + rcases hx with hx | ⟨y', hy', e⟩ + · exact hoffr hx ⟨y, rfl⟩ + · obtain rfl := cap.isEmbedding.injective e + exact hy.2 (cuff_subset_bd ⟨Θ, hΘ⟩ hy') + obtain ⟨H, ρ, hdisc⟩ := hc.all_wheels W hW + have hWd : IsClosedDisc W := hdisc.is_disc + have hpre : IsPreconnected (closure (cap.cuffDisc Θ)) := isPreconnected_of_isClosedDisc + (cap.cuffDisc_closedDisc Θ hΘ) + have hcW : IsClosed W := hWd.isClosed + refine ⟨W, hW, hpre.subset_left_of_subset_union (hWd.isOpen_discInt hman) hcW.isOpen_compl + (disjoint_left.mpr fun y hy hy' ↦ hy' (Surface.discInt_subset _ hy)) ?_ ⟨p, subset_closure + hpd, hpW, ?_⟩⟩ + · intro y hy + by_cases hyW : y ∈ W + · exact .inl ⟨hyW, disjoint_left.mp hoff hy⟩ + · exact .inr hyW + · exact disjoint_left.mp hoff (subset_closure hpd) + intro y hy + have key : ∀ Θ ∈ cuffs S, y ∉ closure (cap.cuffDisc Θ) := fun Θ hΘ hyc ↦ by + obtain ⟨W, hW, hsub⟩ := hin Θ hΘ + exact hy (mem_iUnion₂.mpr ⟨W, hW, hsub hyc⟩) + by_cases hr : y ∈ range cap.emb + · obtain ⟨x, rfl⟩ := hr + refine ⟨x, fun hxb ↦ ?_, rfl⟩ + obtain ⟨Θ, hΘ, hxΘ⟩ := sUnion_cuffs (S := S) ▸ hxb + refine key Θ hΘ ?_ + rw [cap.closure_cuffDisc hΘ] + exact .inr ⟨x, hxΘ, rfl⟩ + · have : y ∈ (range cap.emb)ᶜ := hr + rw [cap.compl_eq] at this + obtain ⟨Θ, hΘ, hyΘ⟩ := mem_iUnion₂.mp this + exact absurd (subset_closure hyΘ) (key Θ hΘ) + +omit [T2Space S] in +/-- A wheel cover is a cut of `Σ`, from any homeomorphism of `Σ`. -/ +theorem isCutData (hc : D.IsWheelCover ω₀ 𝒲) (f : S ≃ₜ S) : IsCutData (cap.emb ∘ f) 𝒲 := by + have hS := χ.isSurface + have : CompactSpace S := hS.1 + have hbd : (fun x ↦ f x) '' (bd S)ᶜ = (bd S)ᶜ := by + rw [image_compl_eq f.bijective, image_bd f] + have himg : (cap.emb ∘ f) '' (bd S)ᶜ = cap.emb '' (bd S)ᶜ := by + rw [image_comp] + exact congrArg (cap.emb '' ·) hbd + have hdisc : ∀ W ∈ 𝒲, IsClosedDisc W := fun W hW ↦ by + obtain ⟨H, ρ, h⟩ := hc.all_wheels W hW + exact h.is_disc + refine ⟨?_, hc.finite_wheels, hdisc, hc.pairwise_disjoint, fun W hW ↦ ?_, ?_⟩ + · exact (cap.isEmbedding.continuous.comp f.continuous).isClosedEmbedding + (cap.isEmbedding.injective.comp f.injective) + · rw [himg] + intro y hy + obtain ⟨x, hx, rfl⟩ := hc.bd_in_interior W hW hy + exact ⟨x, hx.2, rfl⟩ + · rw [himg] + exact D.cover_compl hc + +end TangleDatum + +namespace Slice + +variable {T : Set S} {D : TangleDatum cap χ} (s : Slice T D) +include s + +theorem ncard_hub_le (W : ↥s.𝒲) : (s.fr W).H.V.ncard ≤ 4 * (s.fr W).ρ + 4 := by + rcases (s.fr W).hW.hub_cases with ⟨z, hV, -, -⟩ | ⟨hH, hle, -, -⟩ + · rw [hV, ncard_singleton] + omega + · obtain ⟨-, -, -, hcirc, -⟩ := id hH + rw [IsCircuit.ncard_V hcirc.2] + exact hle + +theorem ncard_sing_le (W : ↥s.𝒲) : (s.sing W).ncard ≤ 4 * (s.fr W).ρ + 5 := by + have hsub : s.sing W ⊆ insert ((s.fr W).R.k - 1) ((s.fr W).R.changes (s.fr W).sp) := by + rintro i ⟨hi, h | h⟩ + · exact .inl (by omega) + · exact .inr ⟨hi, h⟩ + have hfin : ((s.fr W).R.changes (s.fr W).sp).Finite := (finite_lt_nat _).subset fun _ h ↦ h.1 + have h₁ := ncard_le_ncard hsub (hfin.insert _) + have h₂ := ncard_insert_le ((s.fr W).R.k - 1) ((s.fr W).R.changes (s.fr W).sp) + have h₃ := (s.fr W).R.ncard_changes_le (s.fr W).hW (s.fr W).hbdS (s.fr W).hin (s.fr W).sp + have h₄ := s.ncard_hub_le W + omega + +/-- The marked points of a rim. -/ +theorem ncard_marks_le {b : ℕ} (hb : ∀ W, (s.fr W).ρ ≤ b) : (s.markN ∪ s.markZ).ncard ≤ 3 * + (4 * b + 5) * s.𝒲.ncard := by + classical + have := s.finite_𝒲 + have := Fintype.ofFinite ↥s.𝒲 + let A : ↥s.𝒲 → Set ↥Tᶜ := fun W ↦ (s.vx W '' s.sing W) ∪ ((fun i ↦ s.vx W (i + 1)) '' s.sing W) ∪ + (s.zx W '' s.sing W) + have hA : ∀ W, (A W).ncard ≤ 3 * (4 * b + 5) := fun W ↦ by + have h₁ := ncard_image_le (f := s.vx W) (s.finite_sing W) + have h₂ := ncard_image_le (f := fun i ↦ s.vx W (i + 1)) (s.finite_sing W) + have h₃ := ncard_image_le (f := s.zx W) (s.finite_sing W) + have h₄ := ncard_union_le ((s.vx W '' s.sing W) ∪ ((fun i ↦ s.vx W (i + 1)) '' s.sing W)) + (s.zx W '' s.sing W) + have h₅ := ncard_union_le (s.vx W '' s.sing W) ((fun i ↦ s.vx W (i + 1)) '' s.sing W) + have h₆ := s.ncard_sing_le W + have h₇ := hb W + change ((s.vx W '' s.sing W) ∪ ((fun i ↦ s.vx W (i + 1)) '' s.sing W) ∪ + (s.zx W '' s.sing W)).ncard ≤ _ + omega + have hsub : s.markN ∪ s.markZ ⊆ ⋃ W, A W := by + rintro x (hx | hx) + · obtain ⟨W, hx⟩ := mem_iUnion.mp hx + obtain ⟨i, hi, hx⟩ := mem_iUnion₂.mp hx + rcases hx with rfl | hx + · exact mem_iUnion.mpr ⟨W, .inl (.inl ⟨i, hi, rfl⟩)⟩ + · exact mem_iUnion.mpr ⟨W, .inl (.inr ⟨i, hi, (mem_singleton_iff.mp hx).symm⟩)⟩ + · obtain ⟨W, hx⟩ := mem_iUnion.mp hx + obtain ⟨i, hi, rfl⟩ := mem_iUnion₂.mp hx + exact mem_iUnion.mpr ⟨W, .inr ⟨i, hi, rfl⟩⟩ + have hfinA : ∀ W, (A W).Finite := fun W ↦ (((s.finite_sing W).image _).union + ((s.finite_sing W).image _)).union ((s.finite_sing W).image _) + have h₁ := ncard_le_ncard hsub (finite_iUnion hfinA) + have h₂ : (⋃ W, A W).ncard ≤ ∑ W, (A W).ncard := by + simpa using ncard_iUnion_le_of_fintype A + have h₃ : ∑ W, (A W).ncard ≤ ∑ _W : ↥s.𝒲, 3 * (4 * b + 5) := Finset.sum_le_sum fun W _ ↦ hA W + have h₄ : ∑ _W : ↥s.𝒲, 3 * (4 * b + 5) = 3 * (4 * b + 5) * s.𝒲.ncard := by + rw [Finset.sum_const, Finset.card_univ, smul_eq_mul, Nat.mul_comm, + ← Nat.card_eq_fintype_card, Nat.card_coe_set_eq] + omega + +/-- **The feature.** -/ +theorem exists_feature {b : ℕ} (hb : ∀ W, (s.fr W).ρ ≤ b) : ∃ K : Drawing S, IsFeature χ.Φ K ∧ K.U + = cutF (cap.emb ∘ s.f) s.𝒲 ∧ K.V = Subtype.val '' (s.markN ∪ s.markZ) ∧ + K.V.ncard + K.E.ncard ≤ 2 * (3 * (4 * b + 5) * s.𝒲.ncard) := by + classical + have hX := s.isSurface + have hfin : (s.markN ∪ s.markZ).Finite := s.finite_markN.union s.finite_markZ + have hsub : s.markN ∪ s.markZ ⊆ bd ↥Tᶜ := union_subset (fun x hx ↦ (s.markN_sub hx).2) + (fun x hx ↦ by + obtain ⟨W, hx⟩ := mem_iUnion.mp hx + obtain ⟨i, hi, rfl⟩ := mem_iUnion₂.mp hx + exact s.cf_sub_bd W.2 (s.arc_cf W i (s.zx_arc W i))) + have h2 : ∀ C : cuffs ↥Tᶜ, ∃ p ∈ (s.markN ∪ s.markZ) ∩ C.1, ∃ q ∈ (s.markN ∪ s.markZ) ∩ C.1, p ≠ + q := fun C ↦ by + obtain ⟨p, hp, q, hq, hne⟩ := s.two_marks C + exact ⟨p, ⟨.inl hp.1, hp.2⟩, q, ⟨.inl hq.1, hq.2⟩, hne⟩ + obtain ⟨K, hU, hV, hE⟩ := exists_boundaryDrawing hX s.isClosedEmbedding hfin hsub h2 + rw [s.image_bd] at hU + have hoff : Disjoint K.U (bd S) := by + refine disjoint_left.mpr fun x hx hxb ↦ ?_ + rw [hU, ← s.image_bd] at hx + obtain ⟨y, -, rfl⟩ := hx + exact y.2 (s.bd_sub_T hxb) + have hEsub : ∀ e ∈ K.E, e ⊆ K.U := fun e he ↦ he.2.1.trans sdiff_subset + refine ⟨K, ⟨fun e he ↦ hoff.mono_left (hEsub e he), fun v hv ↦ ?_, + fun c hc ↦ hoff.mono_right ?_⟩, hU, hV, ?_⟩ + · rw [hV] at hv + obtain ⟨x, hx, rfl⟩ := hv + obtain ⟨R, hR, -, -, -, hxR, -⟩ := exists_two_arcs hX hfin h2 hx (hsub hx) + have hEm : Subtype.val '' R ∈ K.E := by + change _ ∈ arcComponentsIn (K.U \ K.V) + rw [hE] + exact mem_image_of_mem _ hR + refine ⟨_, hEm, image_closure_subset_closure_image continuous_subtype_val + (mem_image_of_mem _ hxR.1), ?_⟩ + rintro ⟨y, hy, e⟩ + exact hxR.2 (Subtype.ext e ▸ hy) + · exact fun x hx ↦ (hc.1.2.1 hx).1 + · have h₁ : K.V.ncard ≤ (s.markN ∪ s.markZ).ncard := by + rw [hV] + exact ncard_image_le hfin + have h₂ : K.E.ncard ≤ (arcComponentsIn (bd ↥Tᶜ \ (s.markN ∪ s.markZ))).ncard := by + change (arcComponentsIn (K.U \ K.V)).ncard ≤ _ + rw [hE] + exact ncard_image_le (finite_arcComponentsIn_bd hX hfin h2) + have h₃ := ncard_arcs_le hX hfin h2 + have h₄ := s.ncard_marks_le hb + omega + +end Slice + +/-- **Graph Minors XIX, (14.1).** -/ +theorem theorem_14_1_proof : Theorem141Statement.{w} := by + intro S Shat _ _ _ _ β _ cap χ hd 𝒮 hcl hS2 k ω₀ hk m n _ hn + classical + have hS := χ.isSurface + let b := 2 * n * 5 ^ (2 * m) + obtain ⟨𝓕, hf, h𝓕⟩ := GraphMinor.GM19.theorem_5_2_proof S hS χ.connected χ.Φ (2 * (3 * + (4 * b + 5) * (m + numCuffs S))) + have : Finite 𝓕 := hf + refine ⟨⋃ K₀ : 𝓕, rowPlaces cap hd 𝒮 ω₀ K₀.1 b, IsWellBehavedPlaces.iUnion fun K₀ ↦ + rowPlaces_wellBehaved hd hcl hS2 hk K₀.1 b, ?_⟩ + intro D hm hfl + obtain ⟨𝒲, hc, hnum, hrad⟩ := theorem_12_4_proof D hd hk hn hfl + have ha : 4 ≤ 5 ^ (2 * m) * n := by + have : 1 ≤ 5 ^ (2 * m) := Nat.one_le_pow _ _ (by norm_num) + nlinarith + have hbe : b = 2 * (5 ^ (2 * m) * n) := by simp only [b]; ring + have hrep : 25 * (5 ^ (2 * m) * n) < D.rep := by + have h₁ := hfl.1 + have h25 : 5 ^ (2 * m + 2) * n = 25 * (5 ^ (2 * m) * n) := by rw [pow_add]; ring + omega + have hex : ∀ W : ↥𝒲, ∃ fr : WheelFrame D W.1, fr.ρ = D.wheelRadius W.1 := fun W ↦ by + have := hrad W.1 W.2 + exact exists_wheelFrame (hc.all_wheels W.1 W.2) (hc.bd_in_interior W.1 W.2) + (hc.interior_vertex W.1 W.2) (by omega) + choose fr hρ using hex + have hb : ∀ W, (fr W).ρ ≤ b := fun W ↦ (hρ W).trans_le (hrad W.1 W.2) + have hord : D.rep ≤ D.ord := (tangleRep_spec D.rad D.ord D.𝒯).1 + have hθ : 4 * n * 5 ^ (2 * m) + 3 = 2 * b + 3 := by simp only [b]; ring + let s₀ : Slice (cutT (cap.emb ∘ Homeomorph.refl S) 𝒲) D := ⟨𝒲, fr, Homeomorph.refl S, + IsFramePreservingHomeo.refl' _, D.isCutData hc _, rfl⟩ + obtain ⟨K, hF, hU, hV, hsize⟩ := s₀.exists_feature hb + have hle : K.V.ncard + K.E.ncard ≤ 2 * (3 * (4 * b + 5) * (m + numCuffs S)) := hsize.trans (by + gcongr) + obtain ⟨K₀, hK₀, f, hfp, hfU, hfV⟩ := h𝓕 K hF hle + have hcut := D.isCutData hc f + let r : Row D ω₀ K₀ b := + { 𝒲 := 𝒲 + fr := fr + f := f + hf := hfp + cut := hcut + cov := hc.Z_covered + hb := hb + hU := by + ext x + have h₁ : f x ∈ K.U ↔ x ∈ K₀.U := by + rw [← hfU] + exact ⟨fun ⟨y, hy, e⟩ ↦ f.injective e ▸ hy, fun h ↦ ⟨x, h, rfl⟩⟩ + rw [← h₁, hU] + rfl + hV := by + intro W i hi hs x hx + have hsing : i ∈ s₀.sing W := ⟨hi, hs⟩ + have hfx : f x ∈ K.V := by + rw [hV] + rcases hx with h | h | h + · have e : cap.emb (f x) = s₀.e (s₀.vx W i) := h.trans (s₀.e_vx W i).symm + exact ⟨s₀.vx W i, .inl (mem_iUnion.mpr ⟨W, mem_iUnion₂.mpr ⟨_, hsing, .inl rfl⟩⟩), + (cap.isEmbedding.injective e).symm⟩ + · have e : cap.emb (f x) = s₀.e (s₀.vx W (i + 1)) := h.trans (s₀.e_vx W (i + 1)).symm + exact ⟨s₀.vx W (i + 1), .inl (mem_iUnion.mpr ⟨W, mem_iUnion₂.mpr ⟨_, hsing, + .inr rfl⟩⟩), (cap.isEmbedding.injective e).symm⟩ + · have e : cap.emb (f x) = s₀.e (s₀.zx W i) := h.trans (s₀.e_zx W i).symm + exact ⟨s₀.zx W i, .inr (mem_iUnion.mpr ⟨W, mem_iUnion₂.mpr ⟨_, hsing, rfl⟩⟩), + (cap.isEmbedding.injective e).symm⟩ + rw [← hfV] at hfx + obtain ⟨y, hy, e⟩ := hfx + exact f.injective e ▸ hy } + refine ⟨coverLoc 𝒲 hc.finite_wheels hc.pairwise_disjoint fr, ?_, mem_iUnion.mpr ⟨⟨K₀, hK₀⟩, D, + hm, r, rfl⟩⟩ + refine coverLoc_isolates 𝒲 _ _ fr (by omega) (fun W ↦ ?_) ?_ + · have := hb W + omega + · omega + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14b.lean b/LeanPool/GraphMinor/GM19/Section14b.lean new file mode 100644 index 0000000000..16ba005fc8 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14b.lean @@ -0,0 +1,441 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14a + +/-! +# Graph Minors XIX, Section 14: the sector at a vertex of `R* ∩ bd(W)` + +The chord of the sector is the part of the two spokes that is not shared. When the two spokes do not +meet, it runs through a path of the hub. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +section Walks + +variable {T : Type} [TopologicalSpace T] [T2Space T] {G : Drawing T} {a b c : T} + +theorem walkU_append (A : GraphWalk G.toGraph a b) (B : GraphWalk G.toGraph b c) : + (walkDrawing G (A.append B)).U = (walkDrawing G A).U ∪ (walkDrawing G B).U := by + apply subset_antisymm + · intro x hx + rcases (mem_walkDrawing_U _ _).mp hx with h | ⟨e, he, hxe⟩ + · rcases (GraphWalk.mem_support_append A B).mp h with h | h + · exact .inl ((mem_walkDrawing_U _ _).mpr (.inl h)) + · exact .inr ((mem_walkDrawing_U _ _).mpr (.inl h)) + · rw [GraphWalk.edges_append, List.mem_append] at he + rcases he with h | h + · exact .inl ((mem_walkDrawing_U _ _).mpr (.inr ⟨e, h, hxe⟩)) + · exact .inr ((mem_walkDrawing_U _ _).mpr (.inr ⟨e, h, hxe⟩)) + · exact union_subset (walkU_left_subset A B) (walkU_right_subset A B) + +theorem walkU_reverse (A : GraphWalk G.toGraph a b) : (walkDrawing G A.reverse).U = + (walkDrawing G A).U := by + ext x + simp [mem_walkDrawing_U, GraphWalk.support_reverse, GraphWalk.edges_reverse] + +/-- The walk of the two edges at `r`. -/ +def arcWalk {f₁ f₂ : Set T} {v₁ r v₂ : T} (h₁ : G.toGraph.IsLink f₁ r v₁) + (h₂ : G.toGraph.IsLink f₂ r v₂) : GraphWalk G.toGraph v₁ v₂ := + .cons ⟨h₁.1, h₁.2.2.1, h₁.2.1, by rw [h₁.2.2.2, pair_comm]⟩ (.cons h₂ (.nil h₂.2.2.1)) + +theorem arcWalk_U {f₁ f₂ : Set T} {v₁ r v₂ : T} (h₁ : G.toGraph.IsLink f₁ r v₁) + (h₂ : G.toGraph.IsLink f₂ r v₂) : + (walkDrawing G (arcWalk h₁ h₂)).U = closure f₁ ∪ closure f₂ := by + have hend : ∀ {f : Set T} {x y : T}, G.toGraph.IsLink f x y → x ∈ closure f ∧ y ∈ closure f + := fun {f x y} h ↦ by + have hc : closure f ∩ G.V = {x, y} := h.2.2.2 + exact ⟨(hc.symm ▸ (Or.inl rfl : x ∈ ({x, y} : Set T)) : x ∈ closure f ∩ G.V).1, + (hc.symm ▸ (Or.inr rfl : y ∈ ({x, y} : Set T)) : y ∈ closure f ∩ G.V).1⟩ + ext x + simp only [mem_walkDrawing_U, arcWalk, + GraphWalk.support, GraphWalk.edges] + simp only [List.mem_cons, List.not_mem_nil, or_false, exists_eq_or_imp, exists_eq_left, mem_union] + constructor + · rintro ((rfl | rfl | rfl) | h) + · exact .inl (hend h₁).2 + · exact .inl (hend h₁).1 + · exact .inr (hend h₂).2 + · exact h + · rintro (h | h) + · exact .inr (.inl h) + · exact .inr (.inr h) + +end Walks + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {f₁ f₂ : Set + Shat} {v₁ v₂ : Shat} + +/-- The sector at `r`, with chord `Z`: `Δ` is bounded by the two edges at `r` and `Z`, and `Δ'` is +the rest of `W`. -/ +structure IsSector (D : TangleDatum cap χ) (W : Set Shat) (r : Shat) (f₁ f₂ : Set Shat) + (Z : GraphWalk D.rad.G.toGraph v₁ v₂) + (Δ Δ' : Set Shat) (C : Drawing Shat) : Prop where + r_mem : r ∈ D.rad.Rstar ∩ discBd W + link₁ : D.rad.G.toGraph.IsLink f₁ r v₁ + link₂ : D.rad.G.toGraph.IsLink f₂ r v₂ + ne : v₁ ≠ v₂ + f₁_bd : f₁ ⊆ discBd W + f₂_bd : f₂ ⊆ discBd W + simple : Z.IsSimple + disc : IsClosedDisc Δ + disc' : IsClosedDisc Δ' + union : Δ ∪ Δ' = W + inter : Δ ∩ Δ' = (walkDrawing D.rad.G Z).U + bd_eq : discBd Δ = (closure f₁ ∪ closure f₂) ∪ (walkDrawing D.rad.G Z).U + bd_eq' : discBd Δ' = (discBd W \ ((closure f₁ ∪ closure f₂) \ {v₁, v₂})) ∪ + (walkDrawing D.rad.G Z).U + circuit : C.IsCircuitOf D.rad.G + C_U : C.U = discBd Δ + +variable {Z : GraphWalk D.rad.G.toGraph v₁ v₂} + +/-- A chord between the two neighbours of `r` gives a sector. -/ +theorem exists_sector_of_chord (hW : IsClosedDisc W) (hG : discBd W ⊆ D.rad.G.U) + (hr : r ∈ D.rad.Rstar ∩ discBd W) (hl₁ : D.rad.G.toGraph.IsLink f₁ r v₁) + (hl₂ : D.rad.G.toGraph.IsLink f₂ r v₂) (hne : v₁ ≠ v₂) (hf₁ : f₁ ⊆ discBd W) + (hf₂ : f₂ ⊆ discBd W) (hZ : Z.IsSimple) + (hZW : (walkDrawing D.rad.G Z).U ⊆ W) (hZb : (walkDrawing D.rad.G Z).U ∩ discBd W = {v₁, v₂}) : + ∃ Δ Δ' C, D.IsSector W r f₁ f₂ Z Δ Δ' C := by + have : ConnectedSpace Shat := cap.connected + have hcl : IsClosed (discBd W) := by + rw [← IsClosedDisc.frontier_eq_discBd cap.isClosedSurface hW] + exact isClosed_frontier + have hrv₁ : r ≠ v₁ := fun e ↦ hr.1.2 (e ▸ D.hatV_of_link hr.1 hl₁) + have hrv₂ : r ≠ v₂ := fun e ↦ hr.1.2 (e ▸ D.hatV_of_link hr.1 hl₂) + have hY : (arcWalk hl₁ hl₂).IsSimple := by + change [v₁, r, v₂].Nodup + simp [hrv₁.symm, hrv₂, hne] + have hYb : (walkDrawing D.rad.G (arcWalk hl₁ hl₂)).U ⊆ discBd W := by + rw [arcWalk_U] + exact union_subset (closure_minimal hf₁ hcl) (closure_minimal hf₂ hcl) + obtain ⟨Δ₁, Δ₂, d₁, d₂, hu, hi, b₁, b₂⟩ := exists_chord_discs hW hG hne hY hZ hYb hZW hZb + rw [arcWalk_U] at b₁ b₂ + have hsubG : discBd Δ₁ ⊆ D.rad.G.U := by + rw [b₁] + exact union_subset (by rw [← arcWalk_U hl₁ hl₂]; exact (walkDrawing_isSubdrawing _ _).U_subset) + (walkDrawing_isSubdrawing _ _).U_subset + obtain ⟨C, hCc, hCs, hCU⟩ := exists_circuit_of_oArc d₁.isOArc_discBd hsubG + exact ⟨Δ₁, Δ₂, C, hr, hl₁, hl₂, hne, hf₁, hf₂, hZ, d₁, d₂, hu, hi, b₁, b₂, ⟨hCs, hCc⟩, hCU⟩ + +variable {u h : Shat} {A₁ : GraphWalk D.rad.G.toGraph v₁ u} {A₂ : GraphWalk D.rad.G.toGraph v₂ u} + {T : GraphWalk D.rad.G.toGraph u h} + +omit [T2Space S] in +theorem IsFan.chord_simple (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) : (A₁.append A₂.reverse).IsSimple + := by + have hA₁ : A₁.IsSimple := (GraphWalk.IsSimple.of_append hf.spoke₁.1).1 + have hA₂ : A₂.IsSimple := (GraphWalk.IsSimple.of_append hf.spoke₂.1).1 + refine isSimple_append' hA₁ hA₂.reverse fun x h₁ h₂ ↦ hf.meet x h₁ ?_ + simpa [GraphWalk.support_reverse] using h₂ + +/-- The sector of a fan. -/ +theorem IsFan.exists_sector (hf : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T) (hf₁ : f₁ ⊆ discBd W) + (hf₂ : f₂ ⊆ discBd W) : + ∃ Δ Δ' C, D.IsSector W r f₁ f₂ (A₁.append A₂.reverse) Δ Δ' C ∧ D.IsBoundarySector W H r Δ C + := by + have hW := hf.hub + have hU₁ := walkU_left_subset A₁ T + have hU₂ := walkU_left_subset A₂ T + have hsW₁ := hf.spoke₁.subset_W hW hf.bd_off hf.inner + have hsW₂ := hf.spoke₂.subset_W hW hf.bd_off hf.inner + have hmem : ∀ {a b : Shat} (A : GraphWalk D.rad.G.toGraph a b), a ∈ (walkDrawing D.rad.G A).U + ∧ b ∈ (walkDrawing D.rad.G A).U := fun A ↦ + ⟨(mem_walkDrawing_U _ _).mpr (.inl A.start_mem_support), (mem_walkDrawing_U _ _).mpr + (.inl A.end_mem_support)⟩ + have hZb : (walkDrawing D.rad.G (A₁.append A₂.reverse)).U ∩ discBd W = {v₁, v₂} := by + rw [walkU_append, walkU_reverse] + apply subset_antisymm + · rintro y ⟨hy | hy, hyb⟩ + · exact .inl (hf.spoke₁.meet_bd hW hf.bd_off hf.inner (hU₁ hy) hyb) + · exact .inr (hf.spoke₂.meet_bd hW hf.bd_off hf.inner (hU₂ hy) hyb) + · rintro y (rfl | hy) + · exact ⟨.inl (hmem A₁).1, hf.spoke₁.2.v_mem.2⟩ + · rw [mem_singleton_iff.mp hy] + exact ⟨.inr (hmem A₂).1, hf.spoke₂.2.v_mem.2⟩ + have hZW : (walkDrawing D.rad.G (A₁.append A₂.reverse)).U ⊆ W := by + rw [walkU_append, walkU_reverse] + exact union_subset (hU₁.trans hsW₁) (hU₂.trans hsW₂) + obtain ⟨Δ, Δ', C, hs⟩ := exists_sector_of_chord hW.is_disc hW.bd_sub ⟨hf.r_mem, hf.r_bd⟩ hf.link₁ + hf.link₂ hf.ne hf₁ hf₂ hf.chord_simple hZW hZb + obtain ⟨C', hC'⟩ := hf.exists_circuit + have hbd : discBd Δ = C'.U := by + rw [hs.bd_eq, hf.U_eq hC', walkU_append, walkU_reverse] + ext x + simp only [mem_union] + tauto + have hΔW : Δ ⊆ W := hs.union ▸ subset_union_left + refine ⟨Δ, Δ', C, hs, ⟨hf.r_mem, hf.r_bd⟩, hΔW, hs.disc, hs.circuit, hs.C_U, v₁, v₂, h, h, f₁, + f₂, _, _, hf.ne, hf.link₁.1, hf₁, ?_, hf.link₂.1, hf₂, ?_, hf.spoke₁.2, hf.spoke₂.2, ?_⟩ + · rw [← closure_inter_V_eq_tilde hf.link₁.1] + exact hf.link₁.2.2.2 + · rw [← closure_inter_V_eq_tilde hf.link₂.1] + exact hf.link₂.2.2.2 + · refine .inl ⟨⟨h, ?_⟩, ?_⟩ + · rw [walkDrawing_V, walkDrawing_V] + exact ⟨(GraphWalk.mem_support_append A₁ T).mpr (.inr T.end_mem_support), + (GraphWalk.mem_support_append A₂ T).mpr (.inr T.end_mem_support)⟩ + · rw [hbd, hf.closure_formula hC'] + +variable {h₁ h₂ : Shat} {K₁ : GraphWalk D.rad.G.toGraph v₁ h₁} {K₂ : GraphWalk D.rad.G.toGraph v₂ + h₂} + +/-- `r*` is on no spoke, by (13.1). -/ +theorem notMem_spoke_of_Rstar (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + (hr : r ∈ D.rad.Rstar ∩ discBd W) {v h' : Shat} {K : GraphWalk D.rad.G.toGraph v h'} + (hK : D.IsSpokeWalk W H K) : r ∉ K.support := by + intro hm + obtain ⟨L, R, rfl⟩ := K.exists_append_of_mem hm + obtain ⟨P, hP, hle⟩ := exists_path_of_walk R + have h₂ := (hW.spoke_length hK).1 + rw [GraphWalk.length_append] at h₂ + have hpos : 0 < L.length := by + by_contra hn + have hz : L.length = 0 := by omega + cases L with + | nil _ => exact hr.1.2 hK.2.v_mem.1 + | cons _ _ => simp [GraphWalk.length_cons] at hz + exact theorem_13_1_proof hW hbdS hin hr.1 hr.2 ⟨P, h', hK.2.h_mem, hP, by omega⟩ + +/-- The chord through a path of the hub. -/ +theorem exists_hub_chord (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + (h1 : D.IsSpokeWalk W H K₁) (h2 : D.IsSpokeWalk W H K₂) (hd : ∀ x ∈ K₁.support, x ∉ K₂.support) + {P : Drawing Shat} (hP : Drawing.IsPathOf P H h₁ h₂) : + ∃ Z : GraphWalk D.rad.G.toGraph v₁ v₂, Z.IsSimple ∧ (walkDrawing D.rad.G Z).U = + (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ∪ P.U ∧ + (walkDrawing D.rad.G Z).U ⊆ W ∧ (walkDrawing D.rad.G Z).U ∩ discBd W = {v₁, v₂} := by + have hPG : Drawing.IsPathOf P D.rad.G h₁ h₂ := ⟨hP.1.trans hW.H_sub, hP.2⟩ + obtain ⟨M, hMs, hMV, hME⟩ := hPG.exists_simple_walk + have hMU : (walkDrawing D.rad.G M).U = P.U := by + rw [Drawing.U_eq, Drawing.U_eq, walkDrawing_V, walkDrawing_E] + ext x + simp [hMV, hME] + have hPU : P.U ⊆ H.U := hP.1.U_subset + have hmeet₁ : ∀ x ∈ K₁.support, x ∈ M.support → x = h₁ := fun x hx hxM ↦ + h1.support_hub hx (hP.1.1 ((hMV x).mpr hxM)) + have hmeet₂ : ∀ x ∈ K₂.support, x ∈ M.support → x = h₂ := fun x hx hxM ↦ + h2.support_hub hx (hP.1.1 ((hMV x).mpr hxM)) + have hs₂ : (M.append K₂.reverse).IsSimple := isSimple_append' hMs h2.1.reverse fun x hx hx' ↦ + hmeet₂ x (by simpa [GraphWalk.support_reverse] using hx') hx + have hs : (K₁.append (M.append K₂.reverse)).IsSimple := isSimple_append' h1.1 hs₂ fun x hx hx' ↦ + by + rcases (GraphWalk.mem_support_append _ _).mp hx' with hx' | hx' + · exact hmeet₁ x hx hx' + · exact absurd (by simpa [GraphWalk.support_reverse] using hx') (hd x hx) + have hU : (walkDrawing D.rad.G (K₁.append (M.append K₂.reverse))).U = + (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ∪ P.U := by + rw [walkU_append, walkU_append, walkU_reverse, hMU] + ext x + simp only [mem_union] + tauto + have hHW : H.U ⊆ W \ discBd W := hW.H_in_int + have hsW₁ := h1.subset_W hW hbdS hin + have hsW₂ := h2.subset_W hW hbdS hin + refine ⟨_, hs, hU, ?_, ?_⟩ + · rw [hU] + exact union_subset (union_subset hsW₁ hsW₂) (hPU.trans (hHW.trans sdiff_subset)) + · rw [hU] + apply subset_antisymm + · rintro y ⟨(hy | hy) | hy, hyb⟩ + · exact .inl (h1.meet_bd hW hbdS hin hy hyb) + · exact .inr (h2.meet_bd hW hbdS hin hy hyb) + · exact absurd hyb (hHW (hPU hy)).2 + · rintro y (rfl | hy) + · exact ⟨.inl (.inl ((mem_walkDrawing_U _ _).mpr (.inl K₁.start_mem_support))), h1.2.v_mem.2⟩ + · rw [mem_singleton_iff.mp hy] + exact ⟨.inl (.inr ((mem_walkDrawing_U _ _).mpr (.inl K₂.start_mem_support))), h2.2.v_mem.2⟩ + +/-- The sector of two spokes that do not meet: the hub is a circuit, and of its two paths between +the inner ends one gives a disc that does not hold `ins(H)`. -/ +theorem exists_hub_sector (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + (h1 : D.IsSpokeWalk W H K₁) (h2 : D.IsSpokeWalk W H K₂) (hd : ∀ x ∈ K₁.support, x ∉ K₂.support) + (hr : r ∈ D.rad.Rstar ∩ discBd W) + (hl₁ : D.rad.G.toGraph.IsLink f₁ r v₁) (hl₂ : D.rad.G.toGraph.IsLink f₂ r v₂) (hne : v₁ ≠ v₂) + (hf₁ : f₁ ⊆ discBd W) (hf₂ : f₂ ⊆ discBd W) : + ∃ (P : Drawing Shat) (Z : GraphWalk D.rad.G.toGraph v₁ v₂) (Δ Δ' : Set Shat) + (C : Drawing Shat), Drawing.IsPathOf P H h₁ h₂ ∧ + (walkDrawing D.rad.G Z).U = (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ∪ P.U + ∧ D.IsSector W r f₁ f₂ Z Δ Δ' C ∧ + D.IsBoundarySector W H r Δ C := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hh₁H := h1.2.h_mem + have hh₂H := h2.2.h_mem + have hhne : h₁ ≠ h₂ := by + rintro rfl + exact hd h₁ K₁.end_mem_support K₂.end_mem_support + obtain ⟨hH, hle⟩ : IsEnclave D.tb D.ord D.𝒯 H ∧ H.E.ncard ≤ 4 * ρ + 4 := by + rcases hW.hub_cond with ⟨hc, -, -⟩ | ⟨hH, hle, -⟩ + · obtain ⟨z, hz⟩ := ncard_eq_one.mp hc + exact absurd ((hz ▸ hh₁H : h₁ ∈ ({z} : Set Shat)).trans (hz ▸ hh₂H : h₂ ∈ + ({z} : Set Shat)).symm) hhne + · exact ⟨hH, hle⟩ + obtain ⟨-, -, -, hc, hlt, -⟩ := id hH + have hrep := hW.rep_ge + have hi := D.ins_spec hc (by omega) + have hiW : D.ins H ⊆ W := hW.ins_sub H hc hle (hW.H_in_int.trans sdiff_subset) + obtain ⟨P, Q, hP, hQ, hPs, hQs, -, -, hPQ, hE, hHsup⟩ := Drawing.IsCircuit.exists_two_paths hc.2 + hh₁H hh₂H hhne + have hlP := isLine_of_isPathBetween hP hhne + have hlQ := isLine_of_isPathBetween hQ hhne + have hPQU := paths_U_inter hPs hQs hPQ hE hlP hlQ + have build : ∀ {R : Drawing Shat}, Drawing.IsPathOf R H h₁ h₂ → ∃ (Z : GraphWalk D.rad.G.toGraph + v₁ v₂) (Δ Δ' : Set Shat) (C : Drawing Shat), + (walkDrawing D.rad.G Z).U = (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ∪ R.U + ∧ D.IsSector W r f₁ f₂ Z Δ Δ' C := by + intro R hR + obtain ⟨Z, hZ, hU, hZW, hZb⟩ := exists_hub_chord hW hbdS hin h1 h2 hd hR + obtain ⟨Δ, Δ', C, hs⟩ := exists_sector_of_chord hW.is_disc hW.bd_sub hr hl₁ hl₂ hne hf₁ hf₂ hZ + hZW hZb + exact ⟨Z, Δ, Δ', C, hU, hs⟩ + obtain ⟨Z_P, Δ_P, Δ_P', C_P, hU_P, hs_P⟩ := build ⟨hPs, hP⟩ + obtain ⟨Z_Q, Δ_Q, Δ_Q', C_Q, hU_Q, hs_Q⟩ := build ⟨hQs, hQ⟩ + have finish : ∀ {R : Drawing Shat} {Z : GraphWalk D.rad.G.toGraph v₁ v₂} {Δ Δ' : Set Shat} {C : + Drawing Shat}, Drawing.IsPathOf R H h₁ h₂ → + (walkDrawing D.rad.G Z).U = (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ∪ R.U + → D.IsSector W r f₁ f₂ Z Δ Δ' C → ¬ D.ins H ⊆ Δ → + ∃ (P : Drawing Shat) (Z : GraphWalk D.rad.G.toGraph v₁ v₂) (Δ Δ' : Set Shat) + (C : Drawing Shat), Drawing.IsPathOf P H h₁ h₂ ∧ + (walkDrawing D.rad.G Z).U = (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ∪ P.U + ∧ D.IsSector W r f₁ f₂ Z Δ Δ' C ∧ + D.IsBoundarySector W H r Δ C := by + intro R Z Δ Δ' C hR hU hs hn + refine ⟨R, Z, Δ, Δ', C, hR, hU, hs, hr, hs.union ▸ subset_union_left, hs.disc, hs.circuit, + hs.C_U, v₁, v₂, h₁, h₂, f₁, f₂, _, _, hne, hl₁.1, hf₁, ?_, hl₂.1, hf₂, ?_, h1.2, h2.2, ?_⟩ + · rw [← closure_inter_V_eq_tilde hl₁.1] + exact hl₁.2.2.2 + · rw [← closure_inter_V_eq_tilde hl₂.1] + exact hl₂.2.2.2 + · refine .inr ⟨?_, R, hR, ?_, hn⟩ + · rw [walkDrawing_V, walkDrawing_V] + exact disjoint_left.mpr fun x h₁ h₂ ↦ hd x h₁ h₂ + · rw [hs.bd_eq, hU] + ext x + simp only [mem_union] + tauto + by_cases hin_P : D.ins H ⊆ Δ_P + swap + · exact finish ⟨hPs, hP⟩ hU_P hs_P hin_P + refine finish ⟨hQs, hQ⟩ hU_Q hs_Q fun hin_Q ↦ ?_ + -- `Q` is a chord of `Δ_P`, and it cuts off `ins(H)` from `Δ_Q`. + obtain ⟨M_P, hMsP, hMVP, hMEP⟩ := Drawing.IsPathOf.exists_simple_walk + (⟨hPs.trans hW.H_sub, hP⟩ : Drawing.IsPathOf P D.rad.G h₁ h₂) + obtain ⟨M_Q, hMsQ, hMVQ, hMEQ⟩ := Drawing.IsPathOf.exists_simple_walk + (⟨hQs.trans hW.H_sub, hQ⟩ : Drawing.IsPathOf Q D.rad.G h₁ h₂) + have hUP : (walkDrawing D.rad.G M_P).U = P.U := by + rw [Drawing.U_eq, Drawing.U_eq, walkDrawing_V, walkDrawing_E] + ext x + simp [hMVP, hMEP] + have hUQ : (walkDrawing D.rad.G M_Q).U = Q.U := by + rw [Drawing.U_eq, Drawing.U_eq, walkDrawing_V, walkDrawing_E] + ext x + simp [hMVQ, hMEQ] + have hHint := hW.H_in_int + have hPH : P.U ⊆ H.U := hPs.U_subset + have hQH : Q.U ⊆ H.U := hQs.U_subset + have hHU : H.U ⊆ D.ins H := by + rw [← hi.2.2.2.1] + exact Surface.discBd_subset _ + have hcl : IsClosed (discBd W) := by + rw [← IsClosedDisc.frontier_eq_discBd cap.isClosedSurface hW.is_disc] + exact isClosed_frontier + have hLbd : closure f₁ ∪ closure f₂ ⊆ discBd W := union_subset (closure_minimal hf₁ hcl) + (closure_minimal hf₂ hcl) + have hsp₁ : ∀ {y}, y ∈ (walkDrawing D.rad.G K₁).U → y ∈ H.U → y = h₁ + := fun hy hyH ↦ h1.U_inter_hub hW hy hyH + have hsp₂ : ∀ {y}, y ∈ (walkDrawing D.rad.G K₂).U → y ∈ H.U → y = h₂ + := fun hy hyH ↦ h2.U_inter_hub hW hy hyH + have hend₁ : h₁ ∈ (walkDrawing D.rad.G K₁).U := (mem_walkDrawing_U _ _).mpr + (.inl K₁.end_mem_support) + have hend₂ : h₂ ∈ (walkDrawing D.rad.G K₂).U := (mem_walkDrawing_U _ _).mpr + (.inl K₂.end_mem_support) + have hbdP : discBd Δ_P = (closure f₁ ∪ closure f₂) ∪ ((walkDrawing D.rad.G K₁).U ∪ + (walkDrawing D.rad.G K₂).U ∪ P.U) := by + rw [hs_P.bd_eq, hU_P] + have hbdQ : discBd Δ_Q = (closure f₁ ∪ closure f₂) ∪ ((walkDrawing D.rad.G K₁).U ∪ + (walkDrawing D.rad.G K₂).U ∪ Q.U) := by + rw [hs_Q.bd_eq, hU_Q] + have hG : discBd Δ_P ⊆ D.rad.G.U := hs_P.C_U ▸ hs_P.circuit.1.U_subset + have hYb : (walkDrawing D.rad.G M_P).U ⊆ discBd Δ_P := by + rw [hUP, hbdP] + exact fun y hy ↦ .inr (.inr hy) + have hZW : (walkDrawing D.rad.G M_Q).U ⊆ Δ_P := by + rw [hUQ] + exact hQH.trans (hHU.trans hin_P) + have hZb : (walkDrawing D.rad.G M_Q).U ∩ discBd Δ_P = {h₁, h₂} := by + rw [hUQ, hbdP] + apply subset_antisymm + · rintro y ⟨hyQ, hy⟩ + rcases hy with hy | (hy | hy) | hy + · exact absurd (hLbd hy) (hHint (hQH hyQ)).2 + · exact .inl (hsp₁ hy (hQH hyQ)) + · exact .inr (hsp₂ hy (hQH hyQ)) + · exact hPQU ▸ ⟨hy, hyQ⟩ + · rintro y (rfl | hy) + · exact ⟨hlQ.left_mem, .inr (.inl (.inl hend₁))⟩ + · rw [mem_singleton_iff.mp hy] + exact ⟨hlQ.right_mem, .inr (.inl (.inr hend₂))⟩ + obtain ⟨E₁, E₂, d₁, d₂, hu, hint, b₁, b₂⟩ := exists_chord_discs hs_P.disc hG hhne hMsP hMsQ hYb + hZW hZb + rw [hUP, hUQ] at b₁ b₂ + rw [hUQ] at hint + have hΔPW : Δ_P ⊆ W := hs_P.union ▸ subset_union_left + have hΔQW : Δ_Q ⊆ W := hs_Q.union ▸ subset_union_left + have hE₁W : E₁ ⊆ W := (hu ▸ subset_union_left : E₁ ⊆ Δ_P).trans hΔPW + have hE₂W : E₂ ⊆ W := (hu ▸ subset_union_right : E₂ ⊆ Δ_P).trans hΔPW + have hHeq : H.U = P.U ∪ Q.U := paths_U_union hPs hQs hHsup + have e₁ : E₁ = D.ins H := disc_eq_of_subset_disc hT hW.is_disc d₁ hi.2.2.1 hE₁W hiW + (by rw [b₁, hi.2.2.2.1, hHeq]) + have e₂ : E₂ = Δ_Q := by + refine disc_eq_of_subset_disc hT hW.is_disc d₂ hs_Q.disc hE₂W hΔQW ?_ + rw [b₂, hbdQ, hbdP] + ext y + simp only [mem_union, mem_sdiff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro (⟨h₁' | (h₁' | h₁') | h₁', hn⟩ | h₁') + · exact .inl h₁' + · exact .inr (.inl (.inl h₁')) + · exact .inr (.inl (.inr h₁')) + · by_cases hy : y = h₁ + · exact .inr (.inl (.inl (hy ▸ hend₁))) + · by_cases hy' : y = h₂ + · exact .inr (.inl (.inr (hy' ▸ hend₂))) + · exact absurd ⟨h₁', not_or.mpr ⟨hy, hy'⟩⟩ hn + · exact .inr (.inr h₁') + · rintro (h₁' | (h₁' | h₁') | h₁') + · exact .inl ⟨.inl h₁', fun h ↦ (hHint (hPH h.1)).2 (hLbd h₁')⟩ + · refine .inl ⟨.inr (.inl (.inl h₁')), fun h ↦ h.2 (.inl (hsp₁ h₁' (hPH h.1)))⟩ + · refine .inl ⟨.inr (.inl (.inr h₁')), fun h ↦ h.2 (.inr (hsp₂ h₁' (hPH h.1)))⟩ + · exact .inr h₁' + obtain ⟨y, hy, hyn⟩ := GraphMinor.GM19.IsLineWithEnds.diff_nonempty hlP + have hyE₁ : y ∈ E₁ := e₁ ▸ hHU (hPH hy) + have hyE₂ : y ∈ E₂ := e₂ ▸ hin_Q (hHU (hPH hy)) + have hyQ : y ∈ Q.U := hint ▸ ⟨hyE₁, hyE₂⟩ + exact hyn (hPQU ▸ ⟨hy, hyQ⟩) + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14c.lean b/LeanPool/GraphMinor/GM19/Section14c.lean new file mode 100644 index 0000000000..7c9f4b5a54 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14c.lean @@ -0,0 +1,254 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14b + +/-! +# Graph Minors XIX, Section 14: spokes and the hub stay out of a sector +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} {r : Shat} {f₁ f₂ : Set + Shat} {v₁ v₂ h₁ h₂ : Shat} + {K₁ : GraphWalk D.rad.G.toGraph v₁ h₁} {K₂ : GraphWalk D.rad.G.toGraph v₂ h₂} {Z : GraphWalk + D.rad.G.toGraph v₁ v₂} + {Δ Δ' : Set Shat} {C : Drawing Shat} + +omit [T2Space Shat] in +/-- A point of the inside of a disc in `W` is off `bd(W)`. -/ +theorem discInt_off_bd {Δ W : Set Shat} (hT : IsClosedSurface Shat) (hW : IsClosedDisc W) + (hΔ : IsClosedDisc Δ) (hΔW : Δ ⊆ W) {x : Shat} (hx : x ∈ discInt Δ) : + x ∉ discBd W := by + have hop : IsOpen (discInt Δ) := hΔ.isOpen_discInt (IsClosedSurface.isSurface hT).2.2 + have hi : x ∈ interior W := interior_mono ((discInt_subset Δ).trans hΔW) + (mem_interior_iff_mem_nhds.mpr (hop.mem_nhds hx)) + intro hb + have hf : x ∈ frontier W := by + rw [IsClosedDisc.frontier_eq_discBd hT hW] + exact hb + exact hf.2 hi + +/-- A spoke that meets the sector at a vertex of `U(C)` stays on `U(C)` from there, when `Z` goes +through a path of the hub. -/ +theorem spoke_off_hub_sector (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + (h1 : D.IsSpokeWalk W H K₁) (h2 : D.IsSpokeWalk W H K₂) {P : Drawing Shat} + (hP : Drawing.IsPathOf P H h₁ h₂) + (hU : (walkDrawing D.rad.G Z).U = (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ∪ + P.U) (hs : D.IsSector W r f₁ f₂ Z Δ Δ' C) + (hb : D.IsBoundarySector W H r Δ C) {v h : Shat} {K : GraphWalk D.rad.G.toGraph v h} + (hK : D.IsSpokeWalk W H K) : + Disjoint (walkDrawing D.rad.G K).U (discInt Δ) := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + obtain ⟨hle, hins⟩ := theorem_13_5_proof hW hbdS hin hb + have hrep := hW.rep_ge + have hlt : C.E.ncard < 2 * D.rep := by omega + have hc := hs.circuit + have hΔW : Δ ⊆ W := hs.union ▸ subset_union_left + have hUΔ : ∀ {y}, y ∈ (walkDrawing D.rad.G Z).U → y ∈ C.U := fun hy ↦ hs.C_U ▸ hs.bd_eq ▸ Or.inr + hy + have hout : v ∉ D.ins C \ C.U := by + intro h' + apply discInt_off_bd hT hW.is_disc hs.disc hΔW (x := v) ?_ hK.2.v_mem.2 + rw [hins, hs.C_U] at h' + exact h' + refine disjoint_left.mpr fun p hpK hpi ↦ hpi.2 ?_ + rw [← hs.C_U] + have hpins : p ∈ D.ins C := hins ▸ hpi.1 + by_cases hm : ∃ x ∈ K.support, x ∈ C.V + swap + · push Not at hm + exact D.part_outside hc hlt K hK.1 hout (fun y hy hyC ↦ absurd hyC (hm y hy)) hpK hpins + obtain ⟨a, haC, L, R, rfl, hfirst⟩ := GraphWalk.exists_first_mem K hm + have hLs : L.IsSimple := (GraphWalk.IsSimple.of_append hK.1).1 + have hRs : R.IsSimple := (GraphWalk.IsSimple.of_append hK.1).2 + have haL : a ∈ (L.append R).support := (GraphWalk.mem_support_append L R).mpr + (.inl L.end_mem_support) + have haG : a ∈ D.rad.G.V := hc.1.1 haC + -- The vertex `a` is on one of the two spokes or on the hub. + have hcase : a ∈ K₁.support ∨ a ∈ K₂.support ∨ a ∈ H.V := by + have haU : a ∈ discBd Δ := hs.C_U ▸ C.V_subset_U haC + rw [hs.bd_eq, hU] at haU + rcases haU with (ha | ha) | ((ha | ha) | ha) + · have hmem : a ∈ closure f₁ ∩ D.rad.G.V := ⟨ha, haG⟩ + rw [hs.link₁.2.2.2] at hmem + rcases hmem with rfl | hmem + · exact absurd haL (notMem_spoke_of_Rstar hW hbdS hin hs.r_mem hK) + · exact .inl (mem_singleton_iff.mp hmem ▸ K₁.start_mem_support) + · have hmem : a ∈ closure f₂ ∩ D.rad.G.V := ⟨ha, haG⟩ + rw [hs.link₂.2.2.2] at hmem + rcases hmem with rfl | hmem + · exact absurd haL (notMem_spoke_of_Rstar hW hbdS hin hs.r_mem hK) + · exact .inr (.inl (mem_singleton_iff.mp hmem ▸ K₂.start_mem_support)) + · exact .inl (support_of_mem_U K₁ ha haG) + · exact .inr (.inl (support_of_mem_U K₂ ha haG)) + · exact .inr (.inr (mem_V_of_mem_U hW.H_sub (hP.1.U_subset ha) haG)) + have hRC : (walkDrawing D.rad.G R).U ⊆ C.U := by + rcases hcase with ha | ha | ha + · obtain rfl := hK.same_end h1 haL ha + obtain ⟨Y, X, rfl⟩ := K₁.exists_append_of_mem ha + obtain rfl := hK.tail_after h1 + exact fun y hy ↦ hUΔ (hU ▸ .inl (.inl (walkU_right_subset Y R hy))) + · obtain rfl := hK.same_end h2 haL ha + obtain ⟨Y, X, rfl⟩ := K₂.exists_append_of_mem ha + obtain rfl := hK.tail_after h2 + exact fun y hy ↦ hUΔ (hU ▸ .inl (.inr (walkU_right_subset Y R hy))) + · obtain rfl : a = h := hK.support_hub haL ha + have hlen : R.length = 0 := hRs.length_eq_zero + intro y hy + cases R with + | nil _ => + rcases (mem_walkDrawing_U _ _).mp hy with hy | ⟨e, he, -⟩ + · rw [show y = a by simpa [GraphWalk.support] using hy] + exact C.V_subset_U haC + · simp [GraphWalk.edges] at he + | cons _ _ => simp [GraphWalk.length_cons] at hlen + rw [walkU_append] at hpK + rcases hpK with hp | hp + · exact D.part_outside hc hlt L hLs hout hfirst hp hpins + · exact hRC hp + +/-- A sector with all that we need of it. -/ +structure IsFullSector (D : TangleDatum cap χ) (W : Set Shat) (H : Drawing Shat) (r : Shat) + (f₁ f₂ : Set Shat) (K₁ : GraphWalk D.rad.G.toGraph v₁ h₁) + (K₂ : GraphWalk D.rad.G.toGraph v₂ h₂) (Z : GraphWalk D.rad.G.toGraph v₁ v₂) (Δ Δ' : Set Shat) + (C : Drawing Shat) : Prop extends + D.IsSector W r f₁ f₂ Z Δ Δ' C where + boundary : D.IsBoundarySector W H r Δ C + spoke_off : ∀ (v h : Shat) (K : GraphWalk D.rad.G.toGraph v h), D.IsSpokeWalk W H K → Disjoint + (walkDrawing D.rad.G K).U (discInt Δ) + hub_off : Disjoint H.U (discInt Δ) + Z_sub : (walkDrawing D.rad.G Z).U ⊆ (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ∪ H.U + Z_cover : (walkDrawing D.rad.G K₁).U ∪ (walkDrawing D.rad.G K₂).U ⊆ (walkDrawing D.rad.G Z).U ∪ + ((walkDrawing D.rad.G K₁).U ∩ (walkDrawing D.rad.G K₂).U) + Z_same : h₁ = h₂ → (walkDrawing D.rad.G Z).U ⊆ (walkDrawing D.rad.G K₁).U ∪ + (walkDrawing D.rad.G K₂).U + Z_fan : (∃ x ∈ K₁.support, x ∈ K₂.support) → ∃ (u : Shat) (A₁ : GraphWalk D.rad.G.toGraph v₁ u) + (A₂ : GraphWalk D.rad.G.toGraph v₂ u) (T₁ : GraphWalk D.rad.G.toGraph u h₁) + (T₂ : GraphWalk D.rad.G.toGraph u h₂), K₁ = A₁.append T₁ ∧ K₂ = A₂.append T₂ ∧ HEq T₁ T₂ ∧ + (∀ y ∈ A₁.support, y ∈ A₂.support → y = u) ∧ + (walkDrawing D.rad.G Z).U = (walkDrawing D.rad.G A₁).U ∪ (walkDrawing D.rad.G A₂).U + +/-- **The sector at `r`**, for either kind of pair of spokes. The paper takes the existence of `Δ_v` +as seen. -/ +theorem exists_fullSector (hopt : D.IsOptimalWheelHub W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + (h1 : D.IsSpokeWalk W H K₁) (h2 : D.IsSpokeWalk W H K₂) (hr : r ∈ D.rad.Rstar ∩ discBd W) + (hl₁ : D.rad.G.toGraph.IsLink f₁ r v₁) (hl₂ : D.rad.G.toGraph.IsLink f₂ r v₂) (hne : v₁ ≠ v₂) + (hf₁ : f₁ ⊆ discBd W) (hf₂ : f₂ ⊆ discBd W) : + ∃ Z Δ Δ' C, D.IsFullSector W H r f₁ f₂ K₁ K₂ Z Δ Δ' C := by + classical + have hW := hopt.toIsWheelHubOfRadius + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + by_cases hd : ∀ x ∈ K₁.support, x ∉ K₂.support + · obtain ⟨P, Z, Δ, Δ', C, hP, hU, hs, hb⟩ := exists_hub_sector hW hbdS hin h1 h2 hd hr hl₁ hl₂ + hne hf₁ hf₂ + have hspoke : ∀ (v h : Shat) (K : GraphWalk D.rad.G.toGraph v h), D.IsSpokeWalk W H K + → Disjoint (walkDrawing D.rad.G K).U (discInt Δ) := + fun v h K hK ↦ spoke_off_hub_sector hW hbdS hin h1 h2 hP hU hs hb hK + have hhne : h₁ ≠ h₂ := by + rintro rfl + exact hd h₁ K₁.end_mem_support K₂.end_mem_support + obtain ⟨hH, hle⟩ : IsEnclave D.tb D.ord D.𝒯 H ∧ H.E.ncard ≤ 4 * ρ + 4 := by + rcases hW.hub_cond with ⟨hc, -, -⟩ | ⟨hH, hle, -⟩ + · obtain ⟨z, hz⟩ := ncard_eq_one.mp hc + exact absurd ((hz ▸ h1.2.h_mem : h₁ ∈ ({z} : Set Shat)).trans (hz ▸ h2.2.h_mem : h₂ ∈ + ({z} : Set Shat)).symm) hhne + · exact ⟨hH, hle⟩ + obtain ⟨-, -, -, hc, hlt, -⟩ := id hH + have hrep := hW.rep_ge + have hi := D.ins_spec hc (by omega) + have hoff := hb.interior_off_hub hopt hbdS hin hH hle + refine ⟨Z, Δ, Δ', C, { hs with + boundary := hb + spoke_off := hspoke + hub_off := ?_ + Z_sub := ?_ + Z_cover := ?_ + Z_same := fun e ↦ absurd e hhne + Z_fan := fun ⟨x, hx₁, hx₂⟩ ↦ absurd hx₂ (hd x hx₁) }⟩ + · refine disjoint_left.mpr fun y hy hyi ↦ ?_ + have hyc : y ∈ closure (discInt (D.ins H)) := by + rw [closure_discInt hi.2.2.1] + exact Surface.discBd_subset _ (hi.2.2.2.1 ▸ hy) + obtain ⟨z, hz₁, hz₂⟩ := mem_closure_iff.mp hyc _ (hs.disc.isOpen_discInt + (IsClosedSurface.isSurface hT).2.2) hyi + exact disjoint_left.mp hoff hz₂ hz₁ + · rw [hU] + exact fun y hy ↦ hy.imp_right fun h' ↦ hP.1.U_subset h' + · rw [hU] + exact fun y hy ↦ .inl (.inl hy) + · push Not at hd + obtain ⟨x, hx₁, hx₂⟩ := hd + obtain rfl := h1.same_end h2 hx₁ hx₂ + obtain ⟨u, A₁, A₂, T, rfl, rfl, -, hmeet⟩ := h1.merge h2 hx₁ hx₂ + have hfan : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T := by + refine ⟨hW, hbdS, hin, hr.1, hr.2, hne, hl₁, hl₂, h1, h2, fun y h₁ h₂ ↦ hmeet y h₁ ?_⟩ + exact (GraphWalk.mem_support_append A₂ T).mpr (.inl h₂) + obtain ⟨Δ, Δ', C, hs, hb⟩ := hfan.exists_sector hf₁ hf₂ + obtain ⟨C', hC'⟩ := hfan.exists_circuit + have hbd' : discBd Δ = C'.U := by + rw [hs.bd_eq, hfan.U_eq hC', walkU_append, walkU_reverse] + ext x + simp only [mem_union] + tauto + have hΔW : Δ ⊆ W := hs.union ▸ subset_union_left + obtain ⟨hfirst, hsecond⟩ := hfan.main hC' hopt hs.disc hΔW hbd' + refine ⟨_, Δ, Δ', C, { hs with + boundary := hb + spoke_off := ?_ + hub_off := ?_ + Z_sub := ?_ + Z_cover := ?_ + Z_same := ?_ + Z_fan := fun _ ↦ ⟨u, A₁, A₂, T, T, rfl, rfl, HEq.rfl, hfan.meet, by + rw [walkU_append, walkU_reverse]⟩ }⟩ + · exact fun v h K hK ↦ disjoint_left.mpr fun y hy hyi ↦ hyi.2 (hsecond v h K hK ⟨hyi.1, hy⟩) + · refine disjoint_left.mpr fun y hy hyi ↦ hyi.2 ?_ + rw [hfirst y ⟨hyi.1, hy⟩, hbd'] + exact C'.V_subset_U ((hC'.mem_V u).mpr (.inr (.inl A₁.end_mem_support))) + · rw [walkU_append, walkU_reverse] + rintro y (hy | hy) + · exact .inl (.inl (walkU_left_subset A₁ T hy)) + · exact .inl (.inr (walkU_left_subset A₂ T hy)) + · rw [walkU_append A₁ A₂.reverse, walkU_reverse] + rintro y (hy | hy) + · rw [walkU_append] at hy + rcases hy with hy | hy + · exact .inl (.inl hy) + · exact .inr ⟨walkU_right_subset A₁ T hy, walkU_right_subset A₂ T hy⟩ + · rw [walkU_append] at hy + rcases hy with hy | hy + · exact .inl (.inr hy) + · exact .inr ⟨walkU_right_subset A₁ T hy, walkU_right_subset A₂ T hy⟩ + · intro _ + rw [walkU_append, walkU_reverse] + rintro y (hy | hy) + · exact .inl (walkU_left_subset A₁ T hy) + · exact .inr (walkU_left_subset A₂ T hy) + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14d.lean b/LeanPool/GraphMinor/GM19/Section14d.lean new file mode 100644 index 0000000000..31c662222d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14d.lean @@ -0,0 +1,198 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14c +public import LeanPool.GraphMinor.Surface.PlaneSeparation +public import LeanPool.GraphMinor.Surface.Crossing +public import LeanPool.GraphMinor.Surface.CrossCut +public import LeanPool.GraphMinor.Surface.CutTree +public import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! +# Graph Minors XIX, Section 14: a set that does not cut the plane + +The hub with all the spokes does not separate the plane. So each point of `W` off that set is joined +to `bd(W)`. This is how we see that the sectors and `ins(H)` cover `W`, which the paper takes as +seen. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface + +/-- `A` does not separate the plane. -/ +def NonSep (A : Set ℂ) : Prop := ∀ a b, a ∉ A → b ∉ A → b ∈ connectedComponentIn Aᶜ a + +theorem nonSep_of_line {L : Set ℂ} {u v : ℂ} (h : IsLineWithEnds L u v) : NonSep L := by + obtain ⟨φ, -⟩ := h + intro a b ha hb + rw [component_eq_of_arc φ ha hb] + exact mem_connectedComponentIn hb + +theorem nonSep_singleton (z : ℂ) : NonSep {z} := by + intro a b ha hb + have hc : IsPreconnected ({z}ᶜ : Set ℂ) := (isConnected_compl_singleton_of_one_lt_rank + (by simp) z).isPreconnected + exact hc.subset_connectedComponentIn ha subset_rfl hb + +theorem NonSep.union {A B : Set ℂ} (hA : NonSep A) (hB : NonSep B) (cA : IsCompact A) + (cB : IsCompact B) (hAB : IsPreconnected (A ∩ B)) : + NonSep (A ∪ B) := fun a b ha hb ↦ + janiszewski cA cB hAB ha hb (hA a b (fun h ↦ ha (.inl h)) fun h ↦ hb (.inl h)) (hB a b + (fun h ↦ ha (.inr h)) fun h ↦ hb (.inr h)) + +/-- The inside of an `O`-arc in the closed unit disc of `ℂ` lies in that disc. -/ +theorem closedInner_subset_closedBall {G : Set ℂ} (hG : G ⊆ closedBall 0 1) : closedInner G ⊆ + closedBall 0 1 := by + rintro z (⟨hz, hb⟩ | hz) + · by_contra hn + have hz1 : 1 < ‖z‖ := by simpa [mem_closedBall, dist_zero_right] using hn + set L : Set ℂ := (fun t : ℝ ↦ (t : ℂ) * z) '' Ici 1 with hL + have hLc : IsPreconnected L := (isPreconnected_Ici).image _ (by fun_prop) + have hLoff : L ⊆ Gᶜ := by + rintro _ ⟨t, ht, rfl⟩ hm + have h₁ := hG hm + simp only [mem_closedBall, dist_zero_right, norm_mul, Complex.norm_real, + Real.norm_eq_abs] at h₁ + have ht' : (1 : ℝ) ≤ t := ht + rw [abs_of_pos (by linarith)] at h₁ + nlinarith [norm_nonneg z] + have hzL : z ∈ L := ⟨1, mem_Ici.mpr le_rfl, by simp⟩ + have hsub := hLc.subset_connectedComponentIn hzL hLoff + obtain ⟨R, hR⟩ := hb.subset_closedBall (0 : ℂ) + have hpos : 0 < ‖z‖ := by linarith + have h₂ : (((|R| + 1) : ℝ) : ℂ) * z ∈ L := + ⟨|R| + 1, mem_Ici.mpr (by linarith [abs_nonneg R]), rfl⟩ + have h₃ := hR (hsub h₂) + simp only [mem_closedBall, dist_zero_right, norm_mul, Complex.norm_real, Real.norm_eq_abs] at h₃ + rw [abs_of_pos (by have := abs_nonneg R; linarith)] at h₃ + have := le_abs_self R + nlinarith [abs_nonneg R] + · exact hG hz + +/-- A closed disc in the closed unit disc does not separate the plane. -/ +theorem nonSep_of_disc {E : Set ℂ} (hE : IsClosedDisc E) (hsub : E ⊆ closedBall 0 1) : NonSep E + := by + obtain ⟨φ⟩ := hE.isOArc_discBd + have hparts := isJordanParts φ + have hbsub : discBd E ⊆ closedBall 0 1 := (Surface.discBd_subset E).trans hsub + obtain ⟨h₁, h₂⟩ := isClosedDisc_closedInner ⟨φ⟩ + have hin := closedInner_subset_closedBall hbsub + obtain ⟨Δ, -, huniq⟩ := disc_oArc (closedBall (0 : ℂ) 1) (discBd E) isClosedDisc_closedBall.1 + hbsub hE.isOArc_discBd + have heq : E = closedInner (discBd E) := (huniq E hsub hE rfl).trans (huniq _ hin h₁ h₂).symm + have hcompl : Eᶜ = outer (discBd E) := by + apply subset_antisymm + · intro z hz + have hz' : z ∈ (discBd E)ᶜ := fun h ↦ hz (Surface.discBd_subset E h) + rw [← hparts.union_eq] at hz' + rcases hz' with h | h + · exact absurd (heq ▸ (Or.inl h : z ∈ closedInner (discBd E))) hz + · exact h + · intro z hz hzE + rw [heq] at hzE + rcases hzE with h | h + · exact disjoint_left.mp hparts.disjoint h hz + · exact hz.1 h + intro a b ha hb + have hc : IsPreconnected Eᶜ := hcompl ▸ hparts.isConnected_outer.isPreconnected + exact hc.subset_connectedComponentIn ha subset_rfl hb + +/-- A point of the open unit disc off a set that does not separate the plane is joined, off that +set, to a point of the unit circle. -/ +theorem exists_plane_exit {A : Set ℂ} (hA : NonSep A) (cA : IsCompact A) + (hsub : A ⊆ closedBall 0 1) {x : ℂ} (hx : x ∈ ball (0 : ℂ) 1) (hxA : x ∉ A) : + ∃ J y, IsPreconnected J ∧ x ∈ J ∧ J ⊆ ball 0 1 \ A ∧ y ∈ sphere (0 : ℂ) 1 \ A ∧ y ∈ closure J + := by + classical + have hbA : (2 : ℂ) ∉ A := fun h ↦ by + have := hsub h + simp at this + have hb := hA x 2 hxA hbA + have hop : IsOpen Aᶜ := cA.isClosed.isOpen_compl + have hcc : IsOpen (connectedComponentIn Aᶜ x) := hop.connectedComponentIn + have hconn : IsConnected (connectedComponentIn Aᶜ x) := isConnected_connectedComponentIn_iff.mpr + hxA + have hpath := (hcc.isConnected_iff_isPathConnected).mp hconn + obtain ⟨γ, hγ⟩ := hpath.joinedIn x (mem_connectedComponentIn hxA) 2 hb + have hγA : ∀ s, γ s ∉ A := fun s ↦ connectedComponentIn_subset _ _ (hγ s) + have hTc : IsCompact {s : unitInterval | 1 ≤ ‖γ s‖} := + (isClosed_le continuous_const (continuous_norm.comp γ.continuous)).isCompact + have hTne : {s : unitInterval | 1 ≤ ‖γ s‖}.Nonempty := ⟨1, by simp⟩ + obtain ⟨t, ht, hmin⟩ := hTc.exists_isLeast hTne + have ht0 : (0 : unitInterval) < t := by + refine lt_of_le_of_ne unitInterval.nonneg' fun h ↦ ?_ + have h₁ : 1 ≤ ‖γ t‖ := ht + rw [← h, γ.source] at h₁ + have h₂ : ‖x‖ < 1 := by simpa using hx + linarith + have hIio : Iio t ⊆ {s : unitInterval | 1 ≤ ‖γ s‖}ᶜ := fun s hs h ↦ absurd (hmin h) + (not_le.mpr hs) + have hJball : γ '' Iio t ⊆ ball 0 1 \ A := by + rintro _ ⟨s, hs, rfl⟩ + refine ⟨?_, hγA s⟩ + have := hIio hs + simpa using this + have hcl : γ t ∈ closure (γ '' Iio t) := by + have hmem : t ∈ closure (Iio t) := by + rw [closure_Iio' (a := t) (⟨0, ht0⟩ : (Iio t).Nonempty)] + exact Set.mem_Iic.mpr le_rfl + exact image_closure_subset_closure_image γ.continuous (mem_image_of_mem _ hmem) + refine ⟨γ '' Iio t, γ t, isPreconnected_Iio.image _ γ.continuous.continuousOn, ⟨0, ht0, + γ.source⟩, hJball, ⟨?_, hγA t⟩, hcl⟩ + have h₁ : 1 ≤ ‖γ t‖ := ht + have h₂ : γ t ∈ closedBall (0 : ℂ) 1 := closure_minimal (hJball.trans + (sdiff_subset.trans ball_subset_closedBall)) isClosed_closedBall hcl + have h₃ : ‖γ t‖ ≤ 1 := by simpa using h₂ + simpa using le_antisymm h₃ h₁ + +/-- `exists_plane_exit` in a closed disc. -/ +theorem exists_plane_exit_of_disc {T : Type} [TopologicalSpace T] {W A : Set T} + {h : T → ℂ} {g : ℂ → T} (c : IsChart W h g) + (hA : NonSep (h '' A)) (cA : IsCompact A) (hAW : A ⊆ W) {x : T} (hx : x ∈ discInt W) + (hxA : x ∉ A) : + ∃ J y, IsPreconnected J ∧ x ∈ J ∧ J ⊆ discInt W \ A ∧ y ∈ discBd W \ A ∧ y ∈ closure J := by + have hxW : x ∈ W := hx.1 + have hcA : IsCompact (h '' A) := cA.image_of_continuousOn (c.hc.mono hAW) + have hsub : h '' A ⊆ closedBall 0 1 := image_subset_iff.mpr fun a ha ↦ c.hm (hAW ha) + have hnot : ∀ {z}, z ∈ W → h z ∈ h '' A → z ∈ A := fun {z} hz ⟨a, ha, he⟩ ↦ by + rw [← c.gh hz, ← he, c.gh (hAW ha)] + exact ha + have hxb : h x ∈ ball (0 : ℂ) 1 := by + have hm := c.hm hxW + rcases (mem_closedBall.mp hm).lt_or_eq with h' | h' + · exact mem_ball.mpr h' + · exfalso + have hs : h x ∈ sphere (0 : ℂ) 1 := mem_sphere.mpr h' + rw [← c.bd] at hs + obtain ⟨z, hz, he⟩ := hs + have : z = x := by rw [← c.gh (Surface.discBd_subset W hz), ← c.gh hxW, he] + exact hx.2 (this ▸ hz) + obtain ⟨J, y, hJc, hxJ, hJ, hy, hyc⟩ := exists_plane_exit hA hcA hsub hxb fun h' ↦ hxA + (hnot hxW h') + have hsubB : J ⊆ closedBall 0 1 := hJ.trans (sdiff_subset.trans ball_subset_closedBall) + have hyB : y ∈ closedBall (0 : ℂ) 1 := sphere_subset_closedBall hy.1 + have hgi : ∀ {z}, z ∈ ball (0 : ℂ) 1 → g z ∈ discInt W := fun {z} hz ↦ by + rw [c.discInt_eq] + exact mem_image_of_mem _ hz + refine ⟨g '' J, g y, hJc.image _ (c.gc.mono hsubB), ⟨h x, hxJ, c.gh hxW⟩, ?_, ⟨?_, ?_⟩, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + refine ⟨hgi (hJ hz).1, fun hm ↦ (hJ hz).2 ⟨g z, hm, c.hg (ball_subset_closedBall (hJ hz).1)⟩⟩ + · have hs : y ∈ h '' discBd W := c.bd ▸ hy.1 + obtain ⟨z, hz, rfl⟩ := hs + rw [c.gh (Surface.discBd_subset W hz)] + exact hz + · exact fun hm ↦ hy.2 ⟨g y, hm, c.hg hyB⟩ + · have hcw : ContinuousWithinAt g J y := (c.gc y hyB).mono hsubB + exact hcw.mem_closure_image hyc + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14e.lean b/LeanPool/GraphMinor/GM19/Section14e.lean new file mode 100644 index 0000000000..733576819f --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14e.lean @@ -0,0 +1,522 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14d + +/-! +# Graph Minors XIX, Section 14: the sectors and the hub cover the wheel +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} + +omit [T2Space Shat] in +/-- The two ends of an edge of `Γ*`: one is a vertex of `Γ` and one is in `R*`. -/ +theorem exists_Rstar_end (D : TangleDatum cap χ) {e : Set Shat} {x y : Shat} + (hl : D.rad.G.toGraph.IsLink e x y) : x ∈ D.rad.Rstar ∨ y ∈ D.rad.Rstar := by + have h := D.even_length_walk (GraphWalk.cons hl (.nil hl.2.2.1)) + have hodd : ¬ Even (GraphWalk.cons hl (.nil hl.2.2.1)).length := by + rw [show (GraphWalk.cons hl (.nil hl.2.2.1)).length = 1 from rfl] + decide + rw [h] at hodd + by_cases hx : x ∈ D.P.Γ.hatV cap + · exact .inr ⟨hl.2.2.1, fun hy ↦ hodd (by simp [hx, hy])⟩ + · exact .inl ⟨hl.2.1, hx⟩ + +/-- Each point of `bd(W)` is on an edge of `bd(W)` at a vertex of `R*`. -/ +theorem IsWheelHubOfRadius.exists_region_of_bd (h : D.IsWheelHubOfRadius W H ρ) {y : Shat} + (hy : y ∈ discBd W) : + ∃ r ∈ D.rad.Rstar ∩ discBd W, ∃ f ∈ D.rad.G.E, f ⊆ discBd W ∧ r ∈ closure f ∧ y ∈ closure f + := by + classical + have : ConnectedSpace Shat := cap.connected + have hcl : IsClosed (discBd W) := by + rw [← IsClosedDisc.frontier_eq_discBd cap.isClosedSurface h.is_disc] + exact isClosed_frontier + obtain ⟨F, hFc, hFs, hFU⟩ := exists_circuit_of_oArc h.is_disc.isOArc_discBd h.bd_sub + have hedge : ∀ {e}, e ∈ F.E → ∃ x z, D.rad.G.toGraph.IsLink e x z ∧ e ⊆ discBd W + := fun {e} he ↦ by + have heG := hFs.2 he + obtain ⟨x, hx, z, hz, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 e heG + refine ⟨x, z, ⟨heG, D.rad.isPreRadial.2.1 hx, hz.1, hcap⟩, ?_⟩ + rw [← hFU] + exact fun w hw ↦ F.closure_subset_U he (subset_closure hw) + have hfinish : ∀ {e}, e ∈ F.E → y ∈ closure e → ∃ r ∈ D.rad.Rstar ∩ discBd W, ∃ f ∈ D.rad.G.E, f + ⊆ discBd W ∧ r ∈ closure f ∧ y ∈ closure f := fun {e} he hye ↦ by + obtain ⟨x, z, hl, hsub⟩ := hedge he + have hends : x ∈ closure e ∧ z ∈ closure e := by + have hc := hl.2.2.2 + exact ⟨(hc.symm ▸ (Or.inl rfl : x ∈ ({x, z} : Set Shat)) : x ∈ closure e ∩ D.rad.G.V).1, + (hc.symm ▸ (Or.inr rfl : z ∈ ({x, z} : Set Shat)) : z ∈ closure e ∩ D.rad.G.V).1⟩ + rcases D.exists_Rstar_end hl with hr | hr + · exact ⟨x, ⟨hr, closure_minimal hsub hcl hends.1⟩, e, hl.1, hsub, hends.1, hye⟩ + · exact ⟨z, ⟨hr, closure_minimal hsub hcl hends.2⟩, e, hl.1, hsub, hends.2, hye⟩ + have hyF : y ∈ F.U := hFU ▸ hy + rw [Drawing.U_eq] at hyF + rcases hyF with hyV | hyE + swap + · obtain ⟨e, he, hye⟩ : ∃ e ∈ F.E, y ∈ closure e := by simpa using hyE + exact hfinish he hye + -- A vertex of a circuit has an edge. + obtain ⟨u, Z, hZ, hpos, hV, hE⟩ := hFc + rw [hV] at hyV + have hyZ : y ∈ Z.support := hyV + obtain ⟨L, R, hLR⟩ := Z.exists_append_of_mem hyZ + have hlen : 0 < L.length ∨ 0 < R.length := by + rw [hLR, GraphWalk.length_append] at hpos + omega + rcases hlen with hp | hp + · cases hc : L.reverse with + | nil _ => + have : L.reverse.length = 0 := by rw [hc]; rfl + rw [GraphWalk.length_reverse] at this + omega + | @cons _ _ _ e hl t => + have heF : e ∈ F.E := by + rw [hE] + have h₁ : e ∈ L.reverse.edges := by rw [hc]; simp + rw [GraphWalk.edges_reverse, List.mem_reverse] at h₁ + change e ∈ Z.edges + rw [hLR, GraphWalk.edges_append] + exact List.mem_append_left _ h₁ + have hm : y ∈ closure e ∩ F.V := by + rw [hl.2.2.2] + exact .inl rfl + exact hfinish heF hm.1 + · cases R with + | nil _ => simp [GraphWalk.length] at hp + | @cons _ _ _ e hl t => + have heF : e ∈ F.E := by + rw [hE] + change e ∈ Z.edges + rw [hLR, GraphWalk.edges_append] + exact List.mem_append_right _ (by simp) + have hm : y ∈ closure e ∩ F.V := by + rw [hl.2.2.2] + exact .inl rfl + exact hfinish heF hm.1 + +/-- The vertices of `Γ` on `bd(W)`. -/ +def bdVerts (D : TangleDatum cap χ) (W : Set Shat) : Set Shat := (cap.emb '' D.Γ.V) ∩ discBd W + +omit [T2Space S] [T2Space Shat] in +theorem finite_bdVerts (D : TangleDatum cap χ) (W : Set Shat) : (bdVerts D W).Finite := + (D.Γ.finite_V.image _).subset inter_subset_left + +/-- One spoke from each vertex of `Γ` on `bd(W)`. -/ +structure SpokeSystem (D : TangleDatum cap χ) (W : Set Shat) (H : Drawing Shat) where + /-- The endpoint in the hub chosen for each boundary vertex. -/ + hEnd : bdVerts D W → Shat + /-- The radial walk from each boundary vertex to its chosen endpoint. -/ + K : ∀ v : bdVerts D W, GraphWalk D.rad.G.toGraph v.1 (hEnd v) + spoke : ∀ v, D.IsSpokeWalk W H (K v) + +omit [T2Space S] in +theorem exists_spokeSystem (hW : D.IsWheelHubOfRadius W H ρ) : Nonempty (SpokeSystem D W H) := by + have h : ∀ v : bdVerts D W, ∃ (h : Shat) (K : GraphWalk D.rad.G.toGraph v.1 h), D.IsSpokeWalk W H + K := fun v ↦ hW.exists_spoke v.2 + choose e K hK using h + exact ⟨⟨e, K, hK⟩⟩ + +/-- The point set of a spoke. -/ +def SpokeSystem.U (sp : SpokeSystem D W H) (v : bdVerts D W) : Set Shat := (walkDrawing D.rad.G + (sp.K v)).U + +/-- The hub as a set: the disc `ins(H)`, or the one vertex of `H`. -/ +noncomputable def hubSet (D : TangleDatum cap χ) (H : Drawing Shat) : Set Shat := by + classical exact if H.V.ncard = 1 then H.U else D.ins H + +/-- The hub with all the spokes. -/ +noncomputable def SpokeSystem.A (sp : SpokeSystem D W H) : Set Shat := hubSet D H ∪ ⋃ v, sp.U v + +omit [T2Space S] [T2Space Shat] in +/-- The two cases of a hub. -/ +theorem IsWheelHubOfRadius.hub_cases (hW : D.IsWheelHubOfRadius W H ρ) : + (∃ z, H.V = {z} ∧ H.U = {z} ∧ hubSet D H = {z}) ∨ (IsEnclave D.tb D.ord D.𝒯 H ∧ H.E.ncard + ≤ 4 * ρ + 4 ∧ H.V.ncard ≠ 1 ∧ hubSet D H = D.ins H) := by + classical + rcases hW.hub_cond with ⟨hc, hE, -⟩ | ⟨hH, hle, -⟩ + · obtain ⟨z, hz⟩ := ncard_eq_one.mp hc + have hU : H.U = {z} := by + rw [H.U_eq, hz, hE] + simp + refine .inl ⟨z, hz, hU, ?_⟩ + rw [hubSet, ite_eq_left hc, hU] + · obtain ⟨-, -, -, hcirc, -⟩ := id hH + have hne := IsCircuit.two_vertices D hcirc + refine .inr ⟨hH, hle, hne, ?_⟩ + rw [hubSet, ite_eq_right hne] + +omit [T2Space S] in +theorem IsWheelHubOfRadius.hubSet_facts (hW : D.IsWheelHubOfRadius W H ρ) : IsClosed (hubSet D H) + ∧ hubSet D H ⊆ W ∧ Disjoint (hubSet D H) (discBd W) ∧ H.U ⊆ hubSet D H := by + have : ConnectedSpace Shat := cap.connected + rcases hW.hub_cases with ⟨z, -, hU, hh⟩ | ⟨hH, hle, -, hh⟩ + · rw [hh] + have hzU : z ∈ H.U := hU ▸ rfl + have hzi := hW.H_in_int hzU + exact ⟨isClosed_singleton, singleton_subset_iff.mpr hzi.1, disjoint_singleton_left.mpr hzi.2, + hU.subset⟩ + · rw [hh] + obtain ⟨-, -, -, hc, -⟩ := id hH + have hrep := hW.rep_ge + have hi := D.ins_spec hc (by omega) + refine ⟨hi.2.2.1.isClosed, hW.ins_sub H hc hle (hW.H_in_int.trans sdiff_subset), hW.ins_off_bd + hc hle, ?_⟩ + rw [← hi.2.2.2.1] + exact Surface.discBd_subset _ + +/-- The hub meets a spoke in the inner end. -/ +theorem IsWheelHubOfRadius.hubSet_inter_spoke (hW : D.IsWheelHubOfRadius W H ρ) {v h : Shat} {K : + GraphWalk D.rad.G.toGraph v h} (hK : D.IsSpokeWalk W H K) : + hubSet D H ∩ (walkDrawing D.rad.G K).U = {h} := by + have hhH : h ∈ H.U := H.V_subset_U hK.2.h_mem + have hhK : h ∈ (walkDrawing D.rad.G K).U := (mem_walkDrawing_U _ _).mpr (.inl K.end_mem_support) + apply subset_antisymm + · rintro y ⟨hy, hyK⟩ + rcases hW.hub_cases with ⟨z, -, hU, hh⟩ | ⟨hH, hle, -, hh⟩ + · rw [hh] at hy + exact hK.U_inter_hub hW hyK (hU ▸ hy) + · rw [hh] at hy + obtain ⟨-, -, -, hc, -⟩ := id hH + have hrep := hW.rep_ge + have hi := D.ins_spec hc (by omega) + by_cases hyb : y ∈ H.U + · exact hK.U_inter_hub hW hyK hyb + · exact absurd ⟨hy, fun h' ↦ hyb (hi.2.2.2.1 ▸ h')⟩ (disjoint_left.mp + (hK.off_ins_hub hW hH hle) hyK) + · rintro y rfl + exact ⟨hW.hubSet_facts.2.2.2 hhH, hhK⟩ + +omit [T2Space S] in +/-- If two spokes meet then what they share is connected and holds the inner end. -/ +theorem IsSpokeWalk.inter_facts {v₁ v₂ h₁ h₂ : Shat} {K₁ : GraphWalk D.rad.G.toGraph v₁ h₁} {K₂ : + GraphWalk D.rad.G.toGraph v₂ h₂} + (h1 : D.IsSpokeWalk W H K₁) (h2 : D.IsSpokeWalk W H K₂) {y : Shat} (hy₁ : y ∈ + (walkDrawing D.rad.G K₁).U) (hy₂ : y ∈ (walkDrawing D.rad.G K₂).U) : + IsPreconnected ((walkDrawing D.rad.G K₁).U ∩ (walkDrawing D.rad.G K₂).U) ∧ h₁ ∈ + (walkDrawing D.rad.G K₁).U ∩ (walkDrawing D.rad.G K₂).U := by + classical + obtain ⟨x, hx₁, hx₂⟩ : ∃ x, x ∈ K₁.support ∧ x ∈ K₂.support := by + rcases walkU_inter K₁ K₂ hy₁ hy₂ with ⟨h₃, h₄⟩ | ⟨e, he₁, he₂⟩ + · exact ⟨y, h₃, h₄⟩ + · obtain ⟨a, b, -, ha, -, hcap⟩ := D.exists_ends_of_mem_edges K₁ he₁ + exact ⟨a, ha, (D.ends_mem_support K₂ he₂ hcap).1⟩ + obtain rfl := h1.same_end h2 hx₁ hx₂ + obtain ⟨u, A₁, A₂, T, rfl, rfl, -, hmeet⟩ := h1.merge h2 hx₁ hx₂ + have heq : (walkDrawing D.rad.G (A₁.append T)).U ∩ (walkDrawing D.rad.G (A₂.append T)).U = + (walkDrawing D.rad.G T).U := by + apply subset_antisymm + · rintro y ⟨h₃, h₄⟩ + rw [walkU_append] at h₃ + rcases h₃ with h₃ | h₃ + · rcases walkU_inter A₁ (A₂.append T) h₃ h₄ with ⟨h₅, h₆⟩ | ⟨e, he₁, he₂⟩ + · rw [hmeet y h₅ h₆] + exact (mem_walkDrawing_U _ _).mpr (.inl T.start_mem_support) + · obtain ⟨a, b, hab, ha, hb, hcap⟩ := D.exists_ends_of_mem_edges A₁ he₁ + obtain ⟨ha', hb'⟩ := D.ends_mem_support _ he₂ hcap + exact absurd ((hmeet a ha ha').trans (hmeet b hb hb').symm) hab + · exact h₃ + · exact subset_inter (walkU_right_subset A₁ T) (walkU_right_subset A₂ T) + rw [heq] + exact ⟨walkU_isPreconnected T (GraphWalk.IsSimple.of_append h1.1).2, + (mem_walkDrawing_U _ _).mpr (.inl T.end_mem_support)⟩ + +/-- The hub with the spokes is closed, in `W`, and does not separate the plane. -/ +theorem SpokeSystem.nonSep (hW : D.IsWheelHubOfRadius W H ρ) (sp : SpokeSystem D W H) + (hbdS : discBd W ⊆ cap.emb '' (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) {h : Shat → ℂ} {g : ℂ → Shat} + (c : IsChart W h g) : + IsClosed sp.A ∧ sp.A ⊆ W ∧ NonSep (h '' sp.A) := by + classical + have hcomp : CompactSpace Shat := cap.isClosedSurface.1 + have hinj : InjOn h W := c.gh.injOn + have hhub := hW.hubSet_facts + have hUW : ∀ v, sp.U v ⊆ W := fun v ↦ (sp.spoke v).subset_W hW hbdS hin + have hUc : ∀ v, IsClosed (sp.U v) := fun v ↦ (walkDrawing _ _).isClosed_U + have hsubW : ∀ s : Finset (bdVerts D W), hubSet D H ∪ ⋃ v ∈ s, sp.U v ⊆ W := fun s ↦ + union_subset hhub.2.1 (iUnion₂_subset fun v _ ↦ hUW v) + have hcl : ∀ s : Finset (bdVerts D W), IsClosed (hubSet D H ∪ ⋃ v ∈ s, sp.U v) := fun s ↦ + hhub.1.union (isClosed_biUnion_finset fun v _ ↦ hUc v) + have himC : ∀ {X : Set Shat}, IsClosed X → X ⊆ W → IsCompact (h '' X) := fun hX hXW ↦ + hX.isCompact.image_of_continuousOn (c.hc.mono hXW) + have hhubN : NonSep (h '' hubSet D H) := by + rcases hW.hub_cases with ⟨z, -, -, hh⟩ | ⟨hH, hle, -, hh⟩ + · rw [hh, image_singleton] + exact nonSep_singleton _ + · obtain ⟨-, -, -, hcirc, -⟩ := id hH + have hrep := hW.rep_ge + have hi := D.ins_spec hcirc (by omega) + rw [hh] at hhub ⊢ + have hsubB : h '' D.ins H ⊆ closedBall 0 1 := image_subset_iff.mpr fun a ha ↦ c.hm + (hhub.2.1 ha) + exact nonSep_of_disc (hi.2.2.1.image (c.hc.mono hhub.2.1) (c.gc.mono hsubB) + (c.gh.mono hhub.2.1)).1 hsubB + have hlineN : ∀ v, NonSep (h '' sp.U v) := by + intro v + have hne : v.1 ≠ sp.hEnd v := fun e ↦ (hW.H_in_int (H.V_subset_U (sp.spoke v).2.h_mem)).2 + (e ▸ v.2.2) + obtain ⟨φ, -⟩ := isLine_of_isPathBetween (walkDrawing_isPathBetween _ (sp.spoke v).1) hne + obtain ⟨e, -⟩ := exists_homeomorph_image (Δ := sp.U v) (c.hc.mono (hUW v)) (c.gc.mono + (image_subset_iff.mpr fun a ha ↦ c.hm (hUW v ha))) (c.gh.mono (hUW v)) + exact nonSep_of_line ⟨φ.trans e, rfl, rfl⟩ + have hind : ∀ s : Finset (bdVerts D W), NonSep (h '' (hubSet D H ∪ ⋃ v ∈ s, sp.U v)) := by + intro s + induction s using Finset.induction_on with + | empty => simpa using hhubN + | @insert a s _ ih => + have hrw : hubSet D H ∪ ⋃ v ∈ insert a s, sp.U v = (hubSet D H ∪ ⋃ v ∈ s, sp.U v) ∪ sp.U a + := by + ext x + simp only [mem_union, mem_iUnion, Finset.mem_insert, exists_prop] + constructor + · rintro (h' | ⟨v, rfl | hv, hx⟩) + · exact .inl (.inl h') + · exact .inr hx + · exact .inl (.inr ⟨v, hv, hx⟩) + · rintro ((h' | ⟨v, hv, hx⟩) | hx) + · exact .inl h' + · exact .inr ⟨v, .inr hv, hx⟩ + · exact .inr ⟨a, .inl rfl, hx⟩ + rw [hrw, image_union] + refine ih.union (hlineN a) (himC (hcl s) (hsubW s)) (himC (hUc a) (hUW a)) ?_ + rw [← InjOn.image_inter hinj (hsubW s) (hUW a)] + refine IsPreconnected.image ?_ _ (c.hc.mono (inter_subset_right.trans (hUW a))) + refine isPreconnected_of_forall (sp.hEnd a) fun y hy ↦ ?_ + rcases hy.1 with hyh | hyU + · have hyp : y ∈ ({sp.hEnd a} : Set Shat) := hW.hubSet_inter_spoke (sp.spoke a) ▸ + (⟨hyh, hy.2⟩ : y ∈ hubSet D H ∩ (walkDrawing D.rad.G (sp.K a)).U) + have hpm : sp.hEnd a ∈ (hubSet D H ∪ ⋃ v ∈ s, sp.U v) ∩ sp.U a + := mem_singleton_iff.mp hyp ▸ hy + exact ⟨{sp.hEnd a}, singleton_subset_iff.mpr hpm, rfl, hyp, isPreconnected_singleton⟩ + · obtain ⟨w, hw, hyw⟩ : ∃ w ∈ s, y ∈ sp.U w := by simpa using hyU + obtain ⟨hp, hm⟩ := (sp.spoke a).inter_facts (sp.spoke w) hy.2 hyw + refine ⟨sp.U a ∩ sp.U w, ?_, hm, ⟨hy.2, hyw⟩, hp⟩ + rintro z ⟨hz₁, hz₂⟩ + exact ⟨.inr (mem_biUnion hw hz₂), hz₁⟩ + have hfin : Finite (bdVerts D W) := (finite_bdVerts D W).to_subtype + have hfty := Fintype.ofFinite (bdVerts D W) + have heq : sp.A = hubSet D H ∪ ⋃ v ∈ (Finset.univ : Finset (bdVerts D W)), sp.U v := by + simp [SpokeSystem.A] + rw [heq] + exact ⟨hcl _, hsubW _, hind _⟩ + +/-- The sector at `r`, for a fixed system of spokes. -/ +structure SectorAt (sp : SpokeSystem D W H) (r : Shat) where + /-- The first boundary vertex of the sector. -/ + v₁ : bdVerts D W + /-- The second boundary vertex of the sector. -/ + v₂ : bdVerts D W + /-- The first radial edge adjacent to the sector at its pole. -/ + f₁ : Set Shat + /-- The second radial edge adjacent to the sector at its pole. -/ + f₂ : Set Shat + /-- The radial boundary walk between the two boundary vertices. -/ + Z : GraphWalk D.rad.G.toGraph v₁.1 v₂.1 + /-- The closed disc of the sector. -/ + Δ : Set Shat + /-- The complementary disc in the hub boundary. -/ + Δ' : Set Shat + /-- The circuit bounding the sector disc. -/ + C : Drawing Shat + full : D.IsFullSector W H r f₁ f₂ (sp.K v₁) (sp.K v₂) Z Δ Δ' C + only : ∀ f ∈ D.rad.G.E, f ⊆ discBd W → r ∈ closure f → f = f₁ ∨ f = f₂ + +theorem exists_sectorAt (hopt : D.IsOptimalWheelHub W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + (sp : SpokeSystem D W H) {r : Shat} (hr : r ∈ D.rad.Rstar ∩ discBd W) : Nonempty + (SectorAt sp r) := by + have hW := hopt.toIsWheelHubOfRadius + have hcl : IsClosed (discBd W) := by + rw [← IsClosedDisc.frontier_eq_discBd cap.isClosedSurface hW.is_disc] + exact isClosed_frontier + obtain ⟨f₁, f₂, v₁, v₂, hne, hl₁, hl₂, hf₁, hf₂, honly⟩ := hW.exists_two_bd_edges hbdS hin hr.1 + hr.2 + have hend : ∀ {f : Set Shat} {v : Shat}, D.rad.G.toGraph.IsLink f r v → f ⊆ discBd W + → v ∈ bdVerts D W := fun {f v} hl hf ↦ by + have hm : v ∈ closure f ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact .inr rfl + exact ⟨D.hatV_of_link hr.1 hl, closure_minimal hf hcl hm.1⟩ + have m₁ := hend hl₁ hf₁ + have m₂ := hend hl₂ hf₂ + obtain ⟨Z, Δ, Δ', C, hs⟩ := exists_fullSector hopt hbdS hin (sp.spoke ⟨v₁, m₁⟩) + (sp.spoke ⟨v₂, m₂⟩) hr hl₁ hl₂ hne hf₁ hf₂ + exact ⟨⟨⟨v₁, m₁⟩, ⟨v₂, m₂⟩, f₁, f₂, Z, Δ, Δ', C, hs, honly⟩⟩ + +variable {sp : SpokeSystem D W H} {r r' : Shat} + +omit [T2Space S] in +theorem SectorAt.Δ_subset (s : SectorAt sp r) : s.Δ ⊆ W := by + have h := s.full.union + intro x hx + have h' : x ∈ s.Δ ∪ s.Δ' := .inl hx + rwa [h] at h' + +omit [T2Space S] in +theorem SectorAt.Z_subset_A (s : SectorAt sp r) (hW : D.IsWheelHubOfRadius W H ρ) : + (walkDrawing D.rad.G s.Z).U ⊆ sp.A := by + have h := s.full.Z_sub + rintro y hy + rcases h hy with (h' | h') | h' + · exact .inr (mem_iUnion.mpr ⟨s.v₁, h'⟩) + · exact .inr (mem_iUnion.mpr ⟨s.v₂, h'⟩) + · exact .inl (hW.hubSet_facts.2.2.2 h') + +omit [T2Space S] in +theorem SpokeSystem.start_mem_A (sp : SpokeSystem D W H) (v : bdVerts D W) : v.1 ∈ sp.A := + .inr (mem_iUnion.mpr ⟨v, (mem_walkDrawing_U _ _).mpr (.inl (sp.K v).start_mem_support)⟩) + +/-- **The sectors cover `W`, apart from the hub and the spokes.** -/ +theorem SpokeSystem.cover (hW : D.IsWheelHubOfRadius W H ρ) (sp : SpokeSystem D W H) + (hbdS : discBd W ⊆ cap.emb '' (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) {ι : Type*} (reg : ι → Shat) + (sec : ∀ i, SectorAt sp (reg i)) (hreg : ∀ r ∈ D.rad.Rstar ∩ discBd W, ∃ i, reg i + = r) {x : Shat} (hx : x ∈ W) (hxA : x ∉ sp.A) : + ∃ r, x ∈ (sec r).Δ := by + classical + have hT := cap.isClosedSurface + have : CompactSpace Shat := hT.1 + have hcl : IsClosed (discBd W) := by + rw [← IsClosedDisc.frontier_eq_discBd hT hW.is_disc] + exact isClosed_frontier + have hman := (IsClosedSurface.isSurface hT).2.2 + -- A point of `bd(W)` off the spokes lies on the two edges at some `r`, and is not an end of them. + have hbd : ∀ {y}, y ∈ discBd W → y ∉ sp.A → ∃ r, y ∈ closure (sec r).f₁ ∪ closure (sec r).f₂ + := fun {y} hy _ ↦ by + obtain ⟨r, hr, f, hf, hfb, hrf, hyf⟩ := hW.exists_region_of_bd hy + obtain ⟨i, rfl⟩ := hreg r hr + refine ⟨i, ?_⟩ + rcases (sec i).only f hf hfb hrf with rfl | rfl + · exact .inl hyf + · exact .inr hyf + by_cases hxb : x ∈ discBd W + · obtain ⟨r, hr⟩ := hbd hxb hxA + refine ⟨r, Surface.discBd_subset _ ?_⟩ + rw [(sec r).full.bd_eq] + exact .inl hr + obtain ⟨hAc, hAW, hAN⟩ := id (sp.nonSep hW hbdS hin (Classical.choose_spec + (Classical.choose_spec hW.is_disc.exists_isChart))) + obtain ⟨J, y, hJc, hxJ, hJ, hy, hyc⟩ := exists_plane_exit_of_disc + (Classical.choose_spec (Classical.choose_spec hW.is_disc.exists_isChart)) hAN hAc.isCompact hAW + ⟨hx, hxb⟩ hxA + obtain ⟨r, hr⟩ := hbd hy.1 hy.2 + have hs := (sec r).full + have hyΔ : y ∈ (sec r).Δ := Surface.discBd_subset _ (hs.bd_eq ▸ .inl hr) + have hyΔ' : y ∉ (sec r).Δ' := fun h' ↦ hy.2 ((sec r).Z_subset_A hW (hs.inter ▸ ⟨hyΔ, h'⟩)) + have hoff : ∀ z ∈ J, z ∉ discBd (sec r).Δ := by + intro z hz hzb + rw [hs.bd_eq] at hzb + rcases hzb with hzb | hzb + · have hsub : closure (sec r).f₁ ∪ closure (sec r).f₂ ⊆ discBd W := union_subset + (closure_minimal hs.f₁_bd hcl) (closure_minimal hs.f₂_bd hcl) + exact (hJ hz).1.2 (hsub hzb) + · exact (hJ hz).2 ((sec r).Z_subset_A hW hzb) + obtain ⟨z, hzo, hzJ⟩ := mem_closure_iff.mp hyc _ hs.disc'.isClosed.isOpen_compl hyΔ' + have hzΔ : z ∈ (sec r).Δ := by + have : z ∈ W := (hJ hzJ).1.1 + have hu := hs.union + rw [← hu] at this + exact this.resolve_right hzo + have hop : IsOpen (discInt (sec r).Δ) := hs.disc.isOpen_discInt hman + have hsplit := hJc.subset_left_of_subset_union hop hs.disc.isClosed.isOpen_compl + (disjoint_left.mpr fun a ha hb ↦ hb ha.1) (fun a ha ↦ by + by_cases h' : a ∈ (sec r).Δ + · exact .inl ⟨h', hoff a ha⟩ + · exact .inr h') ⟨z, hzJ, hzΔ, hoff z hzJ⟩ + exact ⟨r, (hsplit hxJ).1⟩ + +omit [T2Space S] in +/-- The boundary of a sector misses the inside of each sector. -/ +theorem SectorAt.bd_off (hW : D.IsWheelHubOfRadius W H ρ) (s : SectorAt sp r) + (s' : SectorAt sp r') : Disjoint (discBd s.Δ) (discInt s'.Δ) := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hcl : IsClosed (discBd W) := by + rw [← IsClosedDisc.frontier_eq_discBd hT hW.is_disc] + exact isClosed_frontier + refine disjoint_left.mpr fun y hy hyi ↦ ?_ + rw [s.full.bd_eq] at hy + rcases hy with hy | hy + · refine discInt_off_bd hT hW.is_disc s'.full.disc s'.Δ_subset hyi ?_ + exact (union_subset (closure_minimal s.full.f₁_bd hcl) (closure_minimal s.full.f₂_bd hcl)) hy + · rcases s.full.Z_sub hy with (h' | h') | h' + · exact disjoint_left.mp (s'.full.spoke_off _ _ _ (sp.spoke s.v₁)) h' hyi + · exact disjoint_left.mp (s'.full.spoke_off _ _ _ (sp.spoke s.v₂)) h' hyi + · exact disjoint_left.mp s'.full.hub_off h' hyi + +/-- **Two sectors have disjoint insides.** -/ +theorem SectorAt.disjoint_int (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + (s : SectorAt sp r) (s' : SectorAt sp r') (hne : r ≠ r') : Disjoint (discInt s.Δ) + (discInt s'.Δ) := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman := (IsClosedSurface.isSurface hT).2.2 + have hcl : IsClosed (discBd W) := by + rw [← IsClosedDisc.frontier_eq_discBd hT hW.is_disc] + exact isClosed_frontier + have hside : ∀ {r r' : Shat} (s : SectorAt sp r) (s' : SectorAt sp r'), Disjoint (discBd s.Δ) + (discInt s'.Δ) := fun s s' ↦ SectorAt.bd_off hW s s' + have hsub : ∀ {r r' : Shat} (s : SectorAt sp r) (s' : SectorAt sp r'), + (discInt s.Δ ∩ discInt s'.Δ).Nonempty → discInt s'.Δ ⊆ discInt s.Δ := by + intro r r' s s' ⟨z, hz, hz'⟩ + have hop : IsOpen (discInt s.Δ) := s.full.disc.isOpen_discInt hman + refine s'.full.disc.isPreconnected_discInt.subset_left_of_subset_union hop + s.full.disc.isClosed.isOpen_compl + (disjoint_left.mpr fun a ha hb ↦ hb ha.1) (fun a ha ↦ ?_) ⟨z, hz', hz⟩ + by_cases h' : a ∈ s.Δ + · exact .inl ⟨h', fun hb ↦ disjoint_left.mp (hside s s') hb ha⟩ + · exact .inr h' + refine disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp fun hm ↦ ?_) + have h₁ := hsub s s' hm + have h₂ := hsub s' s (by rwa [Set.inter_comm]) + have heq : s.Δ = s'.Δ := by + rw [← closure_discInt s.full.disc, ← closure_discInt s'.full.disc, subset_antisymm h₁ h₂] + have hrG := s.full.r_mem + have hrb : r ∈ discBd s'.Δ := by + rw [← heq, s.full.bd_eq] + have hm : r ∈ closure s.f₁ ∩ D.rad.G.V := by + rw [s.full.link₁.2.2.2] + exact .inl rfl + exact .inl (.inl hm.1) + rw [s'.full.bd_eq] at hrb + have hrne : ∀ {f : Set Shat} {v : Shat}, D.rad.G.toGraph.IsLink f r' v → r ∉ closure f + := fun {f v} hl hrf ↦ by + have hm : r ∈ closure f ∩ D.rad.G.V := ⟨hrf, hrG.1.1⟩ + rw [hl.2.2.2] at hm + rcases hm with rfl | hm + · exact hne rfl + · have hv := D.hatV_of_link s'.full.r_mem.1 hl + exact hrG.1.2 (mem_singleton_iff.mp hm ▸ hv) + rcases hrb with (hrb | hrb) | hrb + · exact hrne s'.full.link₁ hrb + · exact hrne s'.full.link₂ hrb + · rcases s'.full.Z_sub hrb with (h' | h') | h' + · exact notMem_spoke_of_Rstar hW hbdS hin hrG (sp.spoke s'.v₁) (support_of_mem_U _ h' hrG.1.1) + · exact notMem_spoke_of_Rstar hW hbdS hin hrG (sp.spoke s'.v₂) (support_of_mem_U _ h' hrG.1.1) + · exact (hW.H_in_int h').2 hrG.2 + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14f.lean b/LeanPool/GraphMinor/GM19/Section14f.lean new file mode 100644 index 0000000000..c247d203ac --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14f.lean @@ -0,0 +1,773 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14e + +/-! +# Graph Minors XIX, Section 14: a chord made of two spokes + +Two spokes that meet cut `W` in two discs. The hub lies on one side, so each spoke from the other +side must cross the chord, and then +it runs along one of the two spokes up to the point where they meet (`chord_side`). This is why the +spokes with the same inner end +leave `bd(W)` along one arc. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +omit [T2Space Shat] in +theorem GraphWalk.simple_append_meet {G : Drawing Shat} {a x b : Shat} {P : GraphWalk G.toGraph a + x} {Q : GraphWalk G.toGraph x b} + (h : (P.append Q).IsSimple) {y : Shat} (h₁ : y ∈ P.support) (h₂ : y ∈ Q.support) : y = x := by + have hn : (P.append Q).support.Nodup := h + rw [GraphWalk.support_append] at hn + cases Q with + | nil _ => + simpa [GraphWalk.support] using h₂ + | cons hl t => + rw [GraphWalk.support_cons, List.mem_cons] at h₂ + rcases h₂ with h₂ | h₂ + · exact h₂ + · exact ((List.nodup_append.mp hn).2.2 _ h₁ _ (by simpa [GraphWalk.support_cons] using h₂) + rfl).elim + +omit [T2Space Shat] in +theorem GraphWalk.closed_vertexAt_inj {G : Drawing Shat} {u : Shat} (B : GraphWalk G.toGraph u u) + (hs : B.IsSimpleClosed) {p q : ℕ} (hp : p ≤ B.length) (hq : q ≤ B.length) + (h : GraphWalk.vertexAt B p = GraphWalk.vertexAt B q) : p = q ∨ (p = 0 ∧ q = B.length) ∨ (p + = B.length ∧ q = 0) := by + cases hB : B with + | nil _ => + subst hB + have hp0 : p = 0 := by simpa [GraphWalk.length] using hp + have hq0 : q = 0 := by simpa [GraphWalk.length] using hq + omega + | cons hl t => + subst hB + have ht : t.IsSimple := by + have := hs.1 + rwa [GraphWalk.support_cons, List.tail_cons] at this + have hlen := GraphWalk.length_cons' hl t + have hu : u ∈ G.V := hl.2.1 + have hat := GraphWalk.vertexAt_length t hu + rw [hlen] at hp hq ⊢ + cases p with + | zero => + cases q with + | zero => exact .inl rfl + | succ q => + rw [GraphWalk.vertexAt_cons, GraphWalk.vertexAt_zero] at h + have := GraphWalk.vertexAt_inj t ht (le_refl _) (Nat.le_of_succ_le_succ hq) (hat.trans h) + omega + | succ p => + cases q with + | zero => + rw [GraphWalk.vertexAt_cons, GraphWalk.vertexAt_zero] at h + have := GraphWalk.vertexAt_inj t ht (Nat.le_of_succ_le_succ hp) (le_refl _) + (h.trans hat.symm) + omega + | succ q => + rw [GraphWalk.vertexAt_cons, GraphWalk.vertexAt_cons] at h + have := GraphWalk.vertexAt_inj t ht (by omega) (by omega) h + omega + +omit [T2Space Shat] in +theorem GraphWalk.link_at {G : Drawing Shat} {a b : Shat} (K : GraphWalk G.toGraph a b) {p : ℕ} + (hp : p < K.length) : + ∃ e ∈ K.edges, G.toGraph.IsLink e (GraphWalk.vertexAt K p) (GraphWalk.vertexAt K (p + 1)) := by + induction K generalizing p with + | nil _ => simp [GraphWalk.length] at hp + | cons hl t ih => + rw [GraphWalk.length_cons'] at hp + cases p with + | zero => + refine ⟨_, List.mem_cons_self .., ?_⟩ + rw [GraphWalk.vertexAt_cons, GraphWalk.vertexAt_zero, GraphWalk.vertexAt_zero] + exact hl + | succ p => + obtain ⟨e, he, hl'⟩ := ih (p := p) (by omega) + refine ⟨e, by rw [GraphWalk.edges_cons]; exact List.mem_cons_of_mem _ he, ?_⟩ + rwa [GraphWalk.vertexAt_cons, GraphWalk.vertexAt_cons] + +omit [T2Space Shat] in +theorem GraphWalk.isSimple_of_vertexAt_inj {G : Drawing Shat} {a b : Shat} + (K : GraphWalk G.toGraph a b) (h : ∀ p q, p ≤ K.length → q ≤ K.length → GraphWalk.vertexAt K p + = GraphWalk.vertexAt K q → p = q) : + K.IsSimple := by + have hl := GraphWalk.length_support' K + unfold GraphWalk.IsSimple + rw [List.nodup_iff_injective_get] + rintro ⟨p, hp⟩ ⟨q, hq⟩ he + have hp' : p ≤ K.length := by omega + have hq' : q ≤ K.length := by omega + have := h p q hp' hq' (by + rwa [GraphWalk.vertexAt_eq K hp' hp, GraphWalk.vertexAt_eq K hq' hq]) + exact Fin.ext this + +omit [T2Space Shat] in +theorem GraphWalk.exists_seg_at {G : Drawing Shat} {a b : Shat} (K : GraphWalk G.toGraph a b) + (p s : ℕ) (h : p + s ≤ K.length) : + ∃ Y : GraphWalk G.toGraph (GraphWalk.vertexAt K p) (GraphWalk.vertexAt K (p + s)), Y.length = s + ∧ (∀ t ≤ s, GraphWalk.vertexAt Y t = GraphWalk.vertexAt K (p + t)) ∧ + ∀ e ∈ Y.edges, e ∈ K.edges := by + obtain ⟨P, Q, hPQ, hl⟩ := GraphWalk.exists_split_at K (p := p) (by omega) + generalize hz : GraphWalk.vertexAt K p = z at P Q hPQ ⊢ + subst hl + subst hPQ + have hs : s ≤ Q.length := by + rw [GraphWalk.length_append] at h + omega + rw [GraphWalk.vertexAt_append_right P Q hs] + obtain ⟨Y, Z, hYZ, hYl⟩ := GraphWalk.exists_split_at Q hs + refine ⟨Y, hYl, fun t ht ↦ ?_, fun e he ↦ ?_⟩ + · rw [GraphWalk.vertexAt_append_right P Q (by omega)] + have := GraphWalk.vertexAt_append_left Y Z (t := t) (by omega) + rw [← hYZ] at this + exact this.symm + · rw [GraphWalk.edges_append] + refine List.mem_append_right _ ?_ + have h' : e ∈ (Y.append Z).edges := by + rw [GraphWalk.edges_append] + exact List.mem_append_left _ he + rwa [← hYZ] at h' + +/-- A cyclic word in which equal letters have one arc of that letter between them changes at most +once for each letter. -/ +theorem cyclic_changes_injOn {L : Type*} (k : ℕ) (f : ℕ → L) (hper : f k = f 0) + (harc : ∀ i j, i < j → j < k → f i = f j → (∀ l, i ≤ l → l ≤ j → f l = f i) ∨ ∀ l < k, (l ≤ i + ∨ j ≤ l) → f l = f i) : + InjOn f {i | i < k ∧ f i ≠ f (i + 1)} := by + have key : ∀ i j, i < j → j < k → f i ≠ f (i + 1) → f j ≠ f (j + 1) → f i ≠ f j := by + intro i j hij hj h₁ h₂ he + rcases harc i j hij hj he with h' | h' + · exact h₁ (h' (i + 1) (by omega) (by omega)).symm + · by_cases hl : j + 1 = k + · apply h₂ + rw [hl, hper, h' 0 (by omega) (.inl (by omega)), he] + · apply h₂ + rw [h' (j + 1) (by omega) (.inr (by omega)), he] + rintro i ⟨hi, hi'⟩ j ⟨hj, hj'⟩ he + rcases lt_trichotomy i j with h | h | h + · exact absurd he (key i j h hj hi' hj') + · exact h + · exact absurd he.symm (key j i h hi hj' hi') + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} + +omit [T2Space S] in +/-- A spoke that meets the first part of another spoke runs along it to its end. -/ +theorem IsSpokeWalk.passes {v v' m h h' x : Shat} {A : GraphWalk D.rad.G.toGraph v m} {T : + GraphWalk D.rad.G.toGraph m h} {K : GraphWalk D.rad.G.toGraph v' h'} + (h1 : D.IsSpokeWalk W H (A.append T)) (h2 : D.IsSpokeWalk W H K) (hx : x ∈ A.support) + (hxK : x ∈ K.support) : m ∈ K.support := by + obtain rfl := IsSpokeWalk.same_end h1 h2 ((GraphWalk.mem_support_append A T).mpr (.inl hx)) hxK + obtain ⟨L, R, rfl⟩ := A.exists_append_of_mem hx + obtain ⟨L', R', rfl⟩ := K.exists_append_of_mem hxK + rw [GraphWalk.append_assoc'] at h1 + have := IsSpokeWalk.tail_after h1 h2 + subst this + exact (GraphWalk.mem_support_append L' _).mpr (.inr ((GraphWalk.mem_support_append R T).mpr + (.inr T.start_mem_support))) + +omit [T2Space S] in +/-- The hub without one point `m` is connected, when `m` is not inside it. -/ +theorem IsWheelHubOfRadius.hub_diff_preconnected (hW : D.IsWheelHubOfRadius W H ρ) {m : Shat} + (hm : m ∈ hubSet D H → m ∈ H.U) : IsPreconnected (hubSet D H \ {m}) := by + have : ConnectedSpace Shat := cap.connected + rcases hW.hub_cases with ⟨z, -, -, hh⟩ | ⟨hH, hle, -, hh⟩ + · rw [hh] + by_cases hzm : z = m + · subst hzm + simp [isPreconnected_empty] + · rw [sdiff_singleton_eq_self (by simpa [eq_comm] using hzm)] + exact isPreconnected_singleton + · obtain ⟨-, -, -, hc, -⟩ := id hH + have hrep := hW.rep_ge + have hi := D.ins_spec hc (by omega) + rw [hh] at hm ⊢ + have hbd := hi.2.2.2.1 + refine hi.2.2.1.isPreconnected_discInt.subset_closure ?_ ?_ + · refine fun a ha ↦ ⟨ha.1, ?_⟩ + rintro rfl + exact ha.2 (hbd ▸ hm ha.1) + · rw [closure_discInt hi.2.2.1] + exact sdiff_subset + +/-- **A chord made of two spokes.** One of the two discs has no hub in it, so each spoke from it +passes through the point `m` +where the two spokes meet. -/ +theorem chord_side (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + {v₁ v₂ m h : Shat} {A₁ : GraphWalk D.rad.G.toGraph v₁ m} {A₂ : GraphWalk D.rad.G.toGraph v₂ m} + {T : GraphWalk D.rad.G.toGraph m h} + (h1 : D.IsSpokeWalk W H (A₁.append T)) (h2 : D.IsSpokeWalk W H (A₂.append T)) {Δ₁ Δ₂ : Set + Shat} (c₁ : IsClosed Δ₁) (c₂ : IsClosed Δ₂) + (hu : Δ₁ ∪ Δ₂ = W) (hi : Δ₁ ∩ Δ₂ = (walkDrawing D.rad.G A₁).U ∪ (walkDrawing D.rad.G A₂).U) : + (∀ (v h' : Shat) (K : GraphWalk D.rad.G.toGraph v h'), D.IsSpokeWalk W H K → v ∈ Δ₁ + → m ∈ K.support) ∨ + ∀ (v h' : Shat) (K : GraphWalk D.rad.G.toGraph v h'), D.IsSpokeWalk W H K → v ∈ Δ₂ + → m ∈ K.support := by + have hhub := hW.hubSet_facts + have hoffA : ∀ {a : Shat} {A : GraphWalk D.rad.G.toGraph a m}, D.IsSpokeWalk W H (A.append T) + → Disjoint (hubSet D H \ {m}) (walkDrawing D.rad.G A).U := by + intro a A hs + refine disjoint_left.mpr fun y hy hyA ↦ hy.2 ?_ + have hyK := walkU_left_subset A T hyA + have hy' : y ∈ ({h} : Set Shat) := by + rw [← hW.hubSet_inter_spoke hs] + exact ⟨hy.1, hyK⟩ + obtain rfl := mem_singleton_iff.mp hy' + have hyV : y ∈ D.rad.G.V := hW.H_sub.1 hs.2.h_mem + exact GraphWalk.simple_append_meet hs.1 (support_of_mem_U A hyA hyV) T.end_mem_support + have hmU : m ∈ hubSet D H → m ∈ H.U := fun hm ↦ by + have hm' : m ∈ ({h} : Set Shat) := by + rw [← hW.hubSet_inter_spoke h1] + exact ⟨hm, (mem_walkDrawing_U _ _).mpr (.inl ((GraphWalk.mem_support_append A₁ T).mpr + (.inr T.start_mem_support)))⟩ + rw [mem_singleton_iff.mp hm'] + exact H.V_subset_U h1.2.h_mem + have hc := hW.hub_diff_preconnected hmU + -- The hub, without `m`, is in one disc. + have hside : hubSet D H \ {m} ⊆ Δ₁ ∨ hubSet D H \ {m} ⊆ Δ₂ := by + have hsub : hubSet D H \ {m} ⊆ Δ₁ ∪ Δ₂ := by + rw [hu] + exact sdiff_subset.trans hhub.2.1 + have hoff : ∀ y, y ∈ hubSet D H \ {m} → y ∉ Δ₁ ∩ Δ₂ := fun y hy hy' ↦ by + rw [hi] at hy' + rcases hy' with h' | h' + · exact disjoint_left.mp (hoffA h1) hy h' + · exact disjoint_left.mp (hoffA h2) hy h' + by_contra hn + push Not at hn + obtain ⟨hn₁, hn₂⟩ := hn + obtain ⟨a, ha, ha₁⟩ := not_subset.mp hn₁ + obtain ⟨b, hb, hb₂⟩ := not_subset.mp hn₂ + obtain ⟨z, hz, hz₁, hz₂⟩ := (isPreconnected_closed_iff.mp hc) Δ₁ Δ₂ c₁ c₂ hsub ⟨b, hb, + (hsub hb).resolve_right hb₂⟩ ⟨a, ha, (hsub ha).resolve_left ha₁⟩ + exact hoff z hz ⟨hz₁, hz₂⟩ + have key : ∀ {Δ Δ' : Set Shat}, IsClosed Δ → IsClosed Δ' → Δ ∪ Δ' = W → Δ ∩ Δ' = + (walkDrawing D.rad.G A₁).U ∪ (walkDrawing D.rad.G A₂).U → hubSet D H \ {m} ⊆ Δ' → + ∀ (v h' : Shat) (K : GraphWalk D.rad.G.toGraph v h'), D.IsSpokeWalk W H K → v ∈ Δ + → m ∈ K.support := by + intro Δ Δ' c c' hu' hi' hsub v h' K hK hv + by_contra hmK + have hh' : h' ∈ Δ' := by + refine hsub ⟨hW.hubSet_facts.2.2.2 (H.V_subset_U hK.2.h_mem), ?_⟩ + rintro rfl + exact hmK K.end_mem_support + have hsubW : (walkDrawing D.rad.G K).U ⊆ Δ ∪ Δ' := by + rw [hu'] + exact hK.subset_W hW hbdS hin + have hp := walkU_isPreconnected K hK.1 + obtain ⟨y, hy, hyΔ, hyΔ'⟩ := (isPreconnected_closed_iff.mp hp) Δ Δ' c c' hsubW + ⟨v, (mem_walkDrawing_U _ _).mpr (.inl K.start_mem_support), hv⟩ ⟨h', + (mem_walkDrawing_U _ _).mpr (.inl K.end_mem_support), hh'⟩ + have hy' : y ∈ Δ ∩ Δ' := ⟨hyΔ, hyΔ'⟩ + rw [hi'] at hy' + have hshare : ∀ {a : Shat} {A : GraphWalk D.rad.G.toGraph a m}, D.IsSpokeWalk W H (A.append T) + → y ∈ (walkDrawing D.rad.G A).U → False := by + intro a A hs hyA + rcases walkU_inter A K hyA hy with ⟨h₃, h₄⟩ | ⟨e, he₁, he₂⟩ + · exact hmK (IsSpokeWalk.passes hs hK h₃ h₄) + · obtain ⟨p, q, -, hp, -, hcap⟩ := D.exists_ends_of_mem_edges A he₁ + exact hmK (IsSpokeWalk.passes hs hK hp (D.ends_mem_support K he₂ hcap).1) + rcases hy' with h' | h' + · exact hshare h1 h' + · exact hshare h2 h' + rcases hside with h' | h' + · exact .inr (key c₂ c₁ (by rwa [Set.union_comm]) (by rwa [Set.inter_comm]) h') + · exact .inl (key c₁ c₂ hu hi h') + +/-- Two spokes that share `x`, with an arc `Y` of `bd(W)` between their outer ends: each spoke from +`Y`, or each spoke from outside `Y`, +holds `x`. -/ +theorem chord_arc (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + {u u' h₁ h₂ x : Shat} (hne : u ≠ u') {K₁ : GraphWalk D.rad.G.toGraph u h₁} {K₂ : GraphWalk + D.rad.G.toGraph u' h₂} (h1 : D.IsSpokeWalk W H K₁) (h2 : D.IsSpokeWalk W H K₂) + (hx₁ : x ∈ K₁.support) (hx₂ : x ∈ K₂.support) {Y : GraphWalk D.rad.G.toGraph u u'} + (hY : Y.IsSimple) (hYb : (walkDrawing D.rad.G Y).U ⊆ discBd W) (hG : discBd W ⊆ D.rad.G.U) : + (∀ (v h' : Shat) (K : GraphWalk D.rad.G.toGraph v h'), D.IsSpokeWalk W H K → v ∈ + (walkDrawing D.rad.G Y).U → x ∈ K.support) ∨ + ∀ (v h' : Shat) (K : GraphWalk D.rad.G.toGraph v h'), D.IsSpokeWalk W H K → v ∈ discBd W \ + ((walkDrawing D.rad.G Y).U \ {u, u'}) → x ∈ K.support := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hdisc := hW.is_disc + obtain rfl := IsSpokeWalk.same_end h1 h2 hx₁ hx₂ + obtain ⟨m, A₁, A₂, T, rfl, rfl, hxT, hmeet⟩ := IsSpokeWalk.merge h1 h2 hx₁ hx₂ + have hsA₁ := (GraphWalk.IsSimple.of_append h1.1).1 + have hsA₂ := (GraphWalk.IsSimple.of_append h2.1).1 + have hmeet' : ∀ y ∈ A₁.support, y ∈ A₂.reverse.support → y = m := fun y hy hy' ↦ by + refine hmeet y hy ((GraphWalk.mem_support_append A₂ T).mpr (.inl ?_)) + simpa [GraphWalk.support_reverse] using hy' + have hZs : (A₁.append A₂.reverse).IsSimple := isSimple_append' hsA₁ hsA₂.reverse hmeet' + have hZU : (walkDrawing D.rad.G (A₁.append A₂.reverse)).U = (walkDrawing D.rad.G A₁).U ∪ + (walkDrawing D.rad.G A₂).U := by + rw [walkU_append, walkU_reverse] + have hA₁ := walkU_left_subset A₁ T + have hA₂ := walkU_left_subset A₂ T + have hZW : (walkDrawing D.rad.G (A₁.append A₂.reverse)).U ⊆ W := by + rw [hZU] + exact union_subset (hA₁.trans (h1.subset_W hW hbdS hin)) (hA₂.trans (h2.subset_W hW hbdS hin)) + have huY : u ∈ (walkDrawing D.rad.G Y).U := (mem_walkDrawing_U _ _).mpr (.inl Y.start_mem_support) + have huY' : u' ∈ (walkDrawing D.rad.G Y).U := (mem_walkDrawing_U _ _).mpr (.inl Y.end_mem_support) + have hZb : (walkDrawing D.rad.G (A₁.append A₂.reverse)).U ∩ discBd W = {u, u'} := by + apply subset_antisymm + · rintro y ⟨hy, hyb⟩ + rw [hZU] at hy + rcases hy with hy | hy + · exact .inl (h1.meet_bd hW hbdS hin (hA₁ hy) hyb) + · exact .inr (h2.meet_bd hW hbdS hin (hA₂ hy) hyb) + · rintro y (rfl | rfl) + · exact ⟨(mem_walkDrawing_U _ _).mpr (.inl (A₁.append A₂.reverse).start_mem_support), hYb huY⟩ + · exact ⟨(mem_walkDrawing_U _ _).mpr (.inl (A₁.append A₂.reverse).end_mem_support), hYb huY'⟩ + obtain ⟨Δ₁, Δ₂, d₁, d₂, hu, hi, b₁, b₂⟩ := exists_chord_discs hdisc hG hne hY hZs hYb hZW hZb + rw [hZU] at hi b₁ b₂ + have hthrough : ∀ {v h' : Shat} {K : GraphWalk D.rad.G.toGraph v h'}, D.IsSpokeWalk W H K + → m ∈ K.support → x ∈ K.support := by + intro v h' K hK hm + have hm' : m ∈ (A₁.append T).support := (GraphWalk.mem_support_append A₁ T).mpr + (.inl A₁.end_mem_support) + obtain rfl := IsSpokeWalk.same_end h1 hK hm' hm + obtain ⟨L, R, rfl⟩ := K.exists_append_of_mem hm + have := IsSpokeWalk.tail_after h1 hK + subst this + exact (GraphWalk.mem_support_append L T).mpr (.inr hxT) + rcases chord_side hW hbdS hin h1 h2 d₁.isClosed d₂.isClosed hu hi with hs | hs + · exact .inl fun v h' K hK hv ↦ hthrough hK (hs v h' K hK (Surface.discBd_subset _ + (b₁ ▸ .inl hv))) + · exact .inr fun v h' K hK hv ↦ hthrough hK (hs v h' K hK (Surface.discBd_subset _ + (b₂ ▸ .inl hv))) + +/-- `bd(W)` read as a closed walk of `Γ*` from a vertex of `Γ`, of length `2k`. -/ +structure Rim (D : TangleDatum cap χ) (W : Set Shat) where + /-- The base vertex of the rim walk. -/ + b : Shat + /-- The closed radial walk on the boundary of the wheel disc. -/ + B : GraphWalk D.rad.G.toGraph b b + /-- Half the length of the closed radial walk. -/ + k : ℕ + simple : B.IsSimpleClosed + len : B.length = 2 * k + two : 2 ≤ k + base : b ∈ D.P.Γ.hatV cap + U_eq : (walkDrawing D.rad.G B).U = discBd W + +namespace Rim + +variable (R : Rim D W) + +/-- The `i`th vertex of `Γ` on the rim, with `i` read modulo `k`. -/ +noncomputable def vert (i : ℕ) : Shat := GraphWalk.vertexAt R.B (2 * (i % R.k)) + +/-- The `i`th vertex of `R*` on the rim, between the vertices `i` and `i + 1`. -/ +noncomputable def reg (i : ℕ) : Shat := GraphWalk.vertexAt R.B (2 * (i % R.k) + 1) + +omit [T2Space S] in +theorem pos_mem_bd {p : ℕ} (hp : p ≤ R.B.length) : GraphWalk.vertexAt R.B p ∈ discBd W := by + rw [← R.U_eq] + exact (mem_walkDrawing_U _ _).mpr (.inl (GraphWalk.vertexAt_mem _ hp)) + +theorem pos_hatV {p : ℕ} (hp : p ≤ R.B.length) : Even p ↔ GraphWalk.vertexAt R.B p ∈ D.P.Γ.hatV cap + := by + obtain ⟨P, Q, -, hl⟩ := GraphWalk.exists_split_at R.B hp + have h := D.even_length_walk P + rw [hl] at h + rw [h] + exact ⟨fun h' ↦ h'.mp R.base, fun h' ↦ ⟨fun _ ↦ h', fun _ ↦ R.base⟩⟩ + +omit [T2Space S] in +theorem mod_lt (i : ℕ) : i % R.k < R.k := Nat.mod_lt _ (by have := R.two; omega) + +theorem vert_mem (i : ℕ) : R.vert i ∈ bdVerts D W := by + have hl := R.mod_lt i + have hle : 2 * (i % R.k) ≤ R.B.length := by rw [R.len]; omega + exact ⟨(R.pos_hatV hle).mp (even_two_mul _), R.pos_mem_bd hle⟩ + +theorem reg_mem (i : ℕ) : R.reg i ∈ D.rad.Rstar ∩ discBd W := by + have hl := R.mod_lt i + have hle : 2 * (i % R.k) + 1 ≤ R.B.length := by rw [R.len]; omega + have hb := R.pos_mem_bd hle + refine ⟨⟨?_, fun h ↦ ?_⟩, hb⟩ + · exact (walkDrawing_isSubdrawing D.rad.G R.B).1 (by + rw [walkDrawing_V] + exact GraphWalk.vertexAt_mem _ hle) + · have := (R.pos_hatV hle).mpr h + rw [Nat.even_add_one] at this + exact this (even_two_mul _) + +theorem exists_vert (x : Shat) (hx : x ∈ bdVerts D W) : ∃ i < R.k, x = R.vert i := by + have hxU : x ∈ (walkDrawing D.rad.G R.B).U := R.U_eq ▸ hx.2 + have hsupp := support_of_mem_U R.B hxU (D.rad.isPreRadial.2.1 hx.1) + obtain ⟨p, hp, rfl⟩ := GraphWalk.exists_vertexAt R.B hsupp + have hev := (R.pos_hatV hp).mpr hx.1 + obtain ⟨i, rfl⟩ := hev + rw [R.len] at hp + by_cases hi : i = R.k + · subst hi + refine ⟨0, by have := R.two; omega, ?_⟩ + have h₁ : GraphWalk.vertexAt R.B (R.k + R.k) = R.b := by + rw [← two_mul, ← R.len] + exact GraphWalk.vertexAt_length _ (D.rad.isPreRadial.2.1 R.base) + rw [h₁, vert, Nat.zero_mod, Nat.mul_zero, GraphWalk.vertexAt_zero] + · refine ⟨i, by omega, ?_⟩ + rw [vert, Nat.mod_eq_of_lt (by omega), two_mul] + +theorem exists_reg (x : Shat) (hx : x ∈ D.rad.Rstar ∩ discBd W) : ∃ i < R.k, x = R.reg i := by + have hxU : x ∈ (walkDrawing D.rad.G R.B).U := R.U_eq ▸ hx.2 + have hsupp := support_of_mem_U R.B hxU hx.1.1 + obtain ⟨p, hp, rfl⟩ := GraphWalk.exists_vertexAt R.B hsupp + have hev : ¬ Even p := fun h ↦ hx.1.2 ((R.pos_hatV hp).mp h) + obtain ⟨i, rfl⟩ := Nat.not_even_iff_odd.mp hev + rw [R.len] at hp + refine ⟨i, by omega, ?_⟩ + rw [reg, Nat.mod_eq_of_lt (by omega)] + +omit [T2Space S] in +theorem vert_inj {i j : ℕ} (hi : i < R.k) (hj : j < R.k) (h : R.vert i = R.vert j) : i = j := by + rw [vert, vert, Nat.mod_eq_of_lt hi, Nat.mod_eq_of_lt hj] at h + have := GraphWalk.closed_vertexAt_inj R.B R.simple + (by rw [R.len]; omega) (by rw [R.len]; omega) h + rw [R.len] at this + omega + +omit [T2Space S] in +theorem reg_inj {i j : ℕ} (hi : i < R.k) (hj : j < R.k) (h : R.reg i = R.reg j) : i = j := by + rw [reg, reg, Nat.mod_eq_of_lt hi, Nat.mod_eq_of_lt hj] at h + have := GraphWalk.closed_vertexAt_inj R.B R.simple + (by rw [R.len]; omega) (by rw [R.len]; omega) h + rw [R.len] at this + omega + +omit [T2Space S] in +theorem vert_add_k (i : ℕ) : R.vert (i + R.k) = R.vert i := by + rw [vert, vert, Nat.add_mod_right] + +omit [T2Space S] in +theorem vert_ne_succ {i : ℕ} (hi : i < R.k) : R.vert i ≠ R.vert (i + 1) := by + have h2 := R.two + by_cases hl : i + 1 = R.k + · have h₀ : R.vert (i + 1) = R.vert 0 := by + rw [hl] + simpa using R.vert_add_k 0 + rw [h₀] + intro e + have := R.vert_inj hi (by omega) e + omega + · intro e + have := R.vert_inj hi (by omega) e + omega + +omit [T2Space S] in +/-- The two edges of the rim at the `i`th vertex of `R*`. -/ +theorem exists_links (i : ℕ) : ∃ f g, D.rad.G.toGraph.IsLink f (R.reg i) (R.vert i) + ∧ D.rad.G.toGraph.IsLink g (R.reg i) (R.vert (i + 1)) ∧ f ⊆ discBd W ∧ g ⊆ discBd W := by + have hl := R.mod_lt i + have hedge : ∀ e ∈ R.B.edges, e ⊆ discBd W := fun e he z hz ↦ by + rw [← R.U_eq] + exact (mem_walkDrawing_U _ _).mpr (.inr ⟨e, he, subset_closure hz⟩) + obtain ⟨f, hf, hlf⟩ := GraphWalk.link_at R.B (p := 2 * (i % R.k)) (by rw [R.len]; omega) + obtain ⟨g, hg, hlg⟩ := GraphWalk.link_at R.B (p := 2 * (i % R.k) + 1) (by rw [R.len]; omega) + refine ⟨f, g, hlf.symm, ?_, hedge f hf, hedge g hg⟩ + have hnext : GraphWalk.vertexAt R.B (2 * (i % R.k) + 1 + 1) = R.vert (i + 1) := by + rw [vert, show (i + 1) % R.k = (i % R.k + 1) % R.k from (Nat.mod_add_mod i R.k 1).symm] + by_cases hlast : i % R.k + 1 = R.k + · rw [hlast, Nat.mod_self, Nat.mul_zero, GraphWalk.vertexAt_zero] + have : 2 * (i % R.k) + 1 + 1 = R.B.length := by rw [R.len]; omega + rw [this] + exact GraphWalk.vertexAt_length _ (D.rad.isPreRadial.2.1 R.base) + · rw [Nat.mod_eq_of_lt (a := i % R.k + 1) (b := R.k) (by omega)] + congr 1 + rw [← hnext] + exact hlg + +omit [T2Space S] in +/-- The part of the rim from the vertex `i` to the vertex `j`. -/ +theorem exists_seg {i j : ℕ} (hij : i < j) (hj : j < R.k) : ∃ Y : GraphWalk D.rad.G.toGraph + (R.vert i) (R.vert j), Y.IsSimple ∧ (walkDrawing D.rad.G Y).U ⊆ discBd W ∧ + (∀ l, i ≤ l → l ≤ j → R.vert l ∈ (walkDrawing D.rad.G Y).U) ∧ ∀ l < R.k, R.vert l ∈ + (walkDrawing D.rad.G Y).U → i ≤ l ∧ l ≤ j := by + have hmod : ∀ {l}, l < R.k → R.vert l = GraphWalk.vertexAt R.B (2 * l) := + fun {l} hl ↦ by rw [vert, Nat.mod_eq_of_lt hl] + rw [hmod (hij.trans hj), hmod hj] + have hpos : 2 * j = 2 * i + 2 * (j - i) := by omega + have hlen : 2 * i + 2 * (j - i) ≤ R.B.length := by rw [R.len]; omega + obtain ⟨Y, hYl, hYt, hYe⟩ := GraphWalk.exists_seg_at R.B (2 * i) (2 * (j - i)) hlen + rw [hpos] + have hinj : ∀ {p q}, p < 2 * R.k → q < 2 * R.k → GraphWalk.vertexAt R.B p + = GraphWalk.vertexAt R.B q → p = q := by + intro p q hp hq h + have := GraphWalk.closed_vertexAt_inj R.B R.simple + (by rw [R.len]; omega) (by rw [R.len]; omega) h + rw [R.len] at this + omega + have hsimple : Y.IsSimple := by + refine GraphWalk.isSimple_of_vertexAt_inj Y fun p q hp hq h ↦ ?_ + rw [hYl] at hp hq + rw [hYt p hp, hYt q hq] at h + have := hinj (by omega) (by omega) h + omega + have hYU : (walkDrawing D.rad.G Y).U ⊆ (walkDrawing D.rad.G R.B).U := by + intro y hy + rw [mem_walkDrawing_U] at hy ⊢ + rcases hy with h | ⟨e, he, hye⟩ + · obtain ⟨t, ht, rfl⟩ := GraphWalk.exists_vertexAt Y h + rw [hYl] at ht + exact .inl (by rw [hYt t ht]; exact GraphWalk.vertexAt_mem _ (by omega)) + · exact .inr ⟨e, hYe e he, hye⟩ + refine ⟨Y, hsimple, R.U_eq ▸ hYU, fun l h₁ h₂ ↦ ?_, fun l hl hm ↦ ?_⟩ + · rw [hmod (by omega)] + have := hYt (2 * (l - i)) (by omega) + rw [show 2 * i + 2 * (l - i) = 2 * l by omega] at this + rw [← this] + exact (mem_walkDrawing_U _ _).mpr (.inl (GraphWalk.vertexAt_mem _ (by omega))) + · rw [hmod hl] at hm + have hV : GraphWalk.vertexAt R.B (2 * l) ∈ D.rad.G.V := + (walkDrawing_isSubdrawing D.rad.G R.B).1 (by + rw [walkDrawing_V] + exact GraphWalk.vertexAt_mem _ (by rw [R.len]; omega)) + obtain ⟨t, ht, he⟩ := GraphWalk.exists_vertexAt Y (support_of_mem_U Y hm hV) + rw [hYl] at ht + rw [hYt t ht] at he + have := hinj (by omega) (by omega) he + omega + + +/-- The spoke at the `i`th vertex of the rim. -/ +noncomputable def spoke (sp : SpokeSystem D W H) (i : ℕ) : GraphWalk D.rad.G.toGraph (R.vert i) + (sp.hEnd ⟨R.vert i, R.vert_mem i⟩) := sp.K ⟨R.vert i, R.vert_mem i⟩ + +/-- The inner end of the spoke at the `i`th vertex of the rim. -/ +noncomputable def inner (sp : SpokeSystem D W H) (i : ℕ) : Shat := sp.hEnd ⟨R.vert i, R.vert_mem i⟩ + +theorem spoke_spoke (sp : SpokeSystem D W H) (i : ℕ) : D.IsSpokeWalk W H (R.spoke sp i) + := sp.spoke _ + +omit [T2Space S] in +theorem G_sub (R : Rim D W) : discBd W ⊆ D.rad.G.U := by + rw [← R.U_eq] + exact (walkDrawing_isSubdrawing D.rad.G R.B).U_subset + +/-- **The spokes through a point leave `bd(W)` along one arc.** -/ +theorem arc (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' (univ \ bd S)) (hin : + ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) (sp : SpokeSystem D W H) + {i j : ℕ} {x : Shat} (hij : i < j) (hj : j < R.k) (hxi : x ∈ (R.spoke sp i).support) (hxj : x ∈ + (R.spoke sp j).support) : + (∀ l, i ≤ l → l ≤ j → x ∈ (R.spoke sp l).support) ∨ ∀ l < R.k, (l ≤ i ∨ j ≤ l) → x ∈ + (R.spoke sp l).support := by + have hne : R.vert i ≠ R.vert j := fun e ↦ by + have := R.vert_inj (hij.trans hj) hj e + omega + obtain ⟨Y, hYs, hYb, hin₁, hin₂⟩ := R.exists_seg hij hj + rcases chord_arc hW hbdS hin hne (R.spoke_spoke sp i) (R.spoke_spoke sp j) hxi hxj hYs hYb + R.G_sub with h' | h' + · exact .inl fun l h₁ h₂ ↦ h' _ _ _ (R.spoke_spoke sp l) (hin₁ l h₁ h₂) + · refine .inr fun l hl hl' ↦ h' _ _ _ (R.spoke_spoke sp l) ⟨(R.vert_mem l).2, fun hm ↦ hm.2 ?_⟩ + obtain ⟨h₁, h₂⟩ := hin₂ l hl hm.1 + have : l = i ∨ l = j := by omega + rcases this with rfl | rfl + · exact .inl rfl + · exact .inr rfl + +/-- The indices where the inner end changes. -/ +def changes (sp : SpokeSystem D W H) : Set ℕ := {i | i < R.k ∧ R.inner sp i ≠ R.inner sp (i + 1)} + +theorem inner_eq_of_mem (sp : SpokeSystem D W H) {i j : ℕ} {x : + Shat} (hi : x ∈ (R.spoke sp i).support) (hj : x ∈ (R.spoke sp j).support) : + R.inner sp i = R.inner sp j := IsSpokeWalk.same_end (R.spoke_spoke sp i) + (R.spoke_spoke sp j) hi hj + +/-- **At most `|V(H)|` changes.** -/ +theorem injOn_inner_changes (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + (sp : SpokeSystem D W H) : InjOn (R.inner sp) (R.changes sp) := by + have hper : R.inner sp R.k = R.inner sp 0 := by + have : R.vert R.k = R.vert 0 := by simpa using R.vert_add_k 0 + simp only [inner, this] + refine cyclic_changes_injOn R.k _ hper fun i j hij hj he ↦ ?_ + have hxi : R.inner sp i ∈ (R.spoke sp i).support := GraphWalk.end_mem_support _ + have hxj : R.inner sp i ∈ (R.spoke sp j).support := by + rw [he] + exact GraphWalk.end_mem_support _ + rcases R.arc hW hbdS hin sp hij hj hxi hxj with h' | h' + · exact .inl fun l h₁ h₂ ↦ (R.inner_eq_of_mem sp (GraphWalk.end_mem_support _) + (h' l h₁ h₂)).symm ▸ rfl + · exact .inr fun l h₁ h₂ ↦ (R.inner_eq_of_mem sp (GraphWalk.end_mem_support _) + (h' l h₁ h₂)).symm ▸ rfl + +theorem inner_mem (sp : SpokeSystem D W H) (i : ℕ) : R.inner sp i ∈ H.V := + (R.spoke_spoke sp i).2.h_mem + +theorem ncard_changes_le (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + (sp : SpokeSystem D W H) : (R.changes sp).ncard ≤ H.V.ncard := by + rw [← (R.injOn_inner_changes hW hbdS hin sp).ncard_image] + refine ncard_le_ncard ?_ H.finite_V + rintro _ ⟨i, -, rfl⟩ + exact R.inner_mem sp i + +end Rim + +/-- `bd(W)` can be read as a rim. -/ +theorem exists_rim (hW : D.IsWheelHubOfRadius W H ρ) (hbdS : discBd W ⊆ cap.emb '' (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) : Nonempty (Rim D W) := by + classical + have : ConnectedSpace Shat := cap.connected + obtain ⟨F, hFc, hFs, hFU⟩ := exists_circuit_of_oArc hW.is_disc.isOArc_discBd hW.bd_sub + have h3 := three_le_ncard_bd hW hbdS hin + obtain ⟨x, y, hx, hy, hxy⟩ : ∃ x y, x ∈ discBd W ∩ D.P.Γ.hatV cap ∧ y ∈ discBd W ∩ D.P.Γ.hatV cap + ∧ x ≠ y := by + have : 1 < (discBd W ∩ D.P.Γ.hatV cap).ncard := by omega + obtain ⟨x, hx, y, hy, hne⟩ := (one_lt_ncard (D.P.Γ.finite_V.image _ |>.subset + inter_subset_right)).mp this + exact ⟨x, y, hx, hy, hne⟩ + have hV : ∀ {z}, z ∈ discBd W ∩ D.P.Γ.hatV cap → z ∈ F.V := fun hz ↦ mem_V_of_mem_U hFs + (hFU ▸ hz.1) (D.rad.isPreRadial.2.1 hz.2) + obtain ⟨P, Q, hP, hQ, hPs, hQs, -, -, hPQ, hdis, hsup⟩ := Drawing.IsCircuit.exists_two_paths hFc + (hV hx) (hV hy) hxy + obtain ⟨KP, hKP, hPV, hPE⟩ := Drawing.IsPathOf.exists_simple_walk (G + := D.rad.G) ⟨hPs.trans hFs, hP⟩ + obtain ⟨KQ, hKQ, hQV, hQE⟩ := Drawing.IsPathOf.exists_simple_walk (G + := D.rad.G) ⟨hQs.trans hFs, hQ⟩ + have hsimple : (KP.append KQ.reverse).IsSimpleClosed := by + refine GraphWalk.isSimpleClosed_append hKP hKQ.reverse (fun z h₁ h₂ ↦ ?_) fun e h₁ h₂ ↦ ?_ + · have hz₂ : z ∈ KQ.support := by simpa [GraphWalk.support_reverse] using h₂ + have : z ∈ P.V ∩ Q.V := ⟨(hPV z).mpr h₁, (hQV z).mpr hz₂⟩ + rw [hPQ] at this + exact this + · have he₂ : e ∈ KQ.edges := by simpa [GraphWalk.edges_reverse] using h₂ + exact disjoint_left.mp hdis ((hPE e).mpr h₁) ((hQE e).mpr he₂) + have hUeq : ∀ {Y : Drawing Shat} {a b : Shat} {K : GraphWalk D.rad.G.toGraph a b}, + (∀ x, x ∈ Y.V ↔ x ∈ K.support) → (∀ e, e ∈ Y.E ↔ e ∈ K.edges) → (walkDrawing D.rad.G K).U = Y.U + := by + intro Y a b K h₁ h₂ + rw [Drawing.U_eq, Drawing.U_eq, walkDrawing_V, walkDrawing_E] + congr 1 + · ext z + exact (h₁ z).symm + · ext z + simp only [mem_iUnion, exists_prop] + exact ⟨fun ⟨e, he, hz⟩ ↦ ⟨e, (h₂ e).mpr he, hz⟩, fun ⟨e, he, hz⟩ ↦ ⟨e, (h₂ e).mp he, hz⟩⟩ + have hU : (walkDrawing D.rad.G (KP.append KQ.reverse)).U = discBd W := by + rw [walkU_append, walkU_reverse, hUeq hPV hPE, hUeq hQV hQE, ← hFU] + exact (paths_U_union hPs hQs hsup).symm + have hev : Even (KP.append KQ.reverse).length := (D.even_length_walk _).mpr (Iff.rfl) + obtain ⟨k, hk⟩ := hev + have hxV : x ∈ D.rad.G.V := D.rad.isPreRadial.2.1 hx.2 + have hsupp : y ∈ (KP.append KQ.reverse).support := by + have : y ∈ KP.support := KP.end_mem_support + exact (GraphWalk.mem_support_append _ _).mpr (.inl this) + refine ⟨⟨x, KP.append KQ.reverse, k, hsimple, by omega, ?_, hx.2, hU⟩⟩ + obtain ⟨p, hp, hpe⟩ := GraphWalk.exists_vertexAt _ hsupp + have hEv : Even p := by + obtain ⟨A, -, -, hl⟩ := GraphWalk.exists_split_at (KP.append KQ.reverse) hp + have h := D.even_length_walk A + rw [hl] at h + exact h.mpr ⟨fun _ ↦ hpe ▸ hy.2, fun _ ↦ hx.2⟩ + by_contra hlt + have hle : p = 0 ∨ p = (KP.append KQ.reverse).length := by + obtain ⟨q, rfl⟩ := hEv + omega + rcases hle with rfl | hp' + · rw [GraphWalk.vertexAt_zero] at hpe + exact hxy hpe.symm + · rw [hp', GraphWalk.vertexAt_length _ hxV] at hpe + exact hxy hpe.symm + +/-- A vertex of a hub that is a circuit is not strictly inside a small enclave. -/ +theorem IsWheelHubOfRadius.hub_vertex_off_enclave (hW : D.IsWheelHubOfRadius W H ρ) + (hH : IsEnclave D.tb D.ord D.𝒯 H) (hHle : H.E.ncard ≤ 4 * ρ + 4) + (hne : ∀ H' : Drawing Shat, IsEnclave D.tb D.ord D.𝒯 H' → H' ≠ H → H'.E.ncard ≤ 4 * ρ + 4 → ¬ + (H.U ⊆ D.ins H')) {h : Shat} (hh : h ∈ H.V) + {F : Drawing Shat} (hFe : IsEnclave D.tb D.ord D.𝒯 F) (hFle : F.E.ncard + ≤ 4 * ρ + 4) : h ∉ D.ins F \ F.U := by + have : ConnectedSpace Shat := cap.connected + intro h' + have hrep := hW.rep_ge + obtain ⟨ord', 𝒯', h𝒯', hc, hlt₀, Δ, hins, hd⟩ := id hFe + have hlt' : F.E.ncard < 2 * D.rep := hlt₀ + have hsl := D.isSlope (by omega) + have hHlt : H.E.ncard < 2 * D.rep := by omega + obtain ⟨ord₂, 𝒯₂, h𝒯₂, hcH, hlt₂, Δ₂, hins₂, hd₂⟩ := id hH + obtain ⟨hclH, hfrH, hUH⟩ := ins_facts_of_length hsl hcH.2 hcH.1 hHlt + have hne' : F ≠ H := by + intro e + have : h ∈ F.U := e ▸ H.V_subset_U hh + exact h'.2 this + have hnotsub : ¬ H.U ⊆ D.ins F := hne F hFe hne' hFle + obtain rfl := D.eq_ins_of_isInsOf hins + obtain rfl := D.eq_ins_of_isInsOf hins₂ + rcases theorem_8_6_proof χ.isSurface D.P.fits.internally_three_connected D.tb D.isTangle h𝒯₂ h𝒯' + hins₂ hins hd₂ hd with h₁ | h₁ | h₁ + · exact hnotsub (hUH.trans h₁) + · have hi := interior_mono h₁ ((D.ins_diff_iff hc hlt').mp h') + exact (D.ins_diff_iff hcH hHlt).mpr hi |>.2 (H.V_subset_U hh) + · have : h ∈ D.ins H ∩ D.ins F := ⟨hUH (H.V_subset_U hh), h'.1⟩ + rw [h₁] at this + exact h'.2 this.2 + +/-- If the hub is a circuit, then not all spokes have the same inner end, because `H` is optimal. -/ +theorem Rim.exists_change (R : Rim D W) (hopt : D.IsOptimalWheelHub W H ρ) (sp : SpokeSystem D W H) + (hc : H.V.ncard ≠ 1) : (R.changes sp).Nonempty := by + have hW := hopt.toIsWheelHubOfRadius + by_contra hno + have hall : ∀ i, i < R.k → R.inner sp i = R.inner sp 0 := by + intro i hi + induction i with + | zero => rfl + | succ i ih => + rw [← ih (by omega)] + by_contra hn + exact hno ⟨i, by omega, fun e ↦ hn e.symm⟩ + set h := R.inner sp 0 with hh + have hhV : h ∈ H.V := R.inner_mem sp 0 + have huG : h ∈ D.rad.G.V := hW.H_sub.1 hhV + have hsp : ∀ v ∈ (cap.emb '' D.Γ.V) ∩ discBd W, ∃ A : GraphWalk D.rad.G.toGraph v h, A.length + + (GraphWalk.nil huG : GraphWalk D.rad.G.toGraph h h).length ≤ ρ := by + intro v hv + obtain ⟨i, hi, rfl⟩ := R.exists_vert v hv + have e : R.inner sp i = h := hall i hi + have hK := R.spoke_spoke sp i + have hl := (hW.spoke_length hK).1 + have hS : ∀ {a : Shat} (A : GraphWalk D.rad.G.toGraph (R.vert i) a), a = h → A.length ≤ ρ + → ∃ A : GraphWalk D.rad.G.toGraph (R.vert i) h, A.length + (GraphWalk.nil huG : GraphWalk + D.rad.G.toGraph h h).length ≤ ρ := by + rintro a A rfl hle + exact ⟨A, by change A.length + 0 ≤ ρ; exact hle⟩ + exact hS (R.spoke sp i) e hl + have hen : ∀ F : Drawing Shat, IsEnclave D.tb D.ord D.𝒯 F → F.E.ncard ≤ 4 * ρ + 4 + → h ∉ D.ins F \ F.U := by + intro F h₁ h₂ + rcases hW.hub_cond with ⟨hcard, -, -⟩ | ⟨hen, hle, hne⟩ + · exact absurd hcard hc + · exact hW.hub_vertex_off_enclave hen hle hne hhV h₁ h₂ + have hub := hW.hub_at huG (GraphWalk.nil huG) hhV + (by change 0 < ρ; exact hW.pos_ρ) (hW.H_in_int (H.V_subset_U hhV)) hsp hen + have hρ : (GraphWalk.nil huG : GraphWalk D.rad.G.toGraph h h).length = 0 := rfl + rw [hρ, Nat.sub_zero] at hub + rcases hopt.one_vertex_priority with h' | h' + · exact hc h' + · exact h' ⟨_, hub, by rw [(point_drawing_facts D.rad.G huG).1, ncard_singleton]⟩ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14g.lean b/LeanPool/GraphMinor/GM19/Section14g.lean new file mode 100644 index 0000000000..9d9e10f99d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14g.lean @@ -0,0 +1,170 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14f +public import LeanPool.GraphMinor.GM19.FragmentOuter + +/-! +# Graph Minors XIX, Section 14: the arm of a disc + +A disc of `Σ̂` bounded by a circuit of `Γ*`, with some further vertices of `Γ` outside it, gives a +separation of `Γ`. The tools here show that it +lies in `𝒯`, and how a distinction compares with it. These are the steps of the claim (2) in the +proof of (14.1). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} + +/-- The part of `Γ` in `Δ`, with the vertices of `X` added. -/ +def partPlus (D : TangleDatum cap χ) (Δ X : Set Shat) : Hypergraph S (Set S) := D.Γ.restrict + (cap.emb ⁻¹' (Δ ∪ X)) + +omit [T2Space S] [T2Space Shat] in +theorem part_le_plus (D : TangleDatum cap χ) (Δ X : Set Shat) : partIn cap D.Γ Δ ≤ D.partPlus Δ X + := by + have : ConnectedSpace Shat := cap.connected + exact part_mono subset_union_left + +omit [T2Space S] [T2Space Shat] in +theorem edge_mem_plus_iff {Δ X : Set Shat} (hX : X ⊆ cap.emb '' D.Γ.V) + (hΔ : IsClosed Δ) {e : Set S} : e ∈ (D.partPlus Δ X).edgeSet ↔ e ∈ (partIn cap D.Γ Δ).edgeSet + := by + constructor + · rintro ⟨he, hs, ht⟩ + have hsub : e ⊆ cap.emb ⁻¹' Δ := fun z hz ↦ by + refine (hs hz).resolve_right fun hzX ↦ ?_ + obtain ⟨y, hy, hyz⟩ := hX hzX + have hzV : z ∈ D.Γ.V := cap.isEmbedding.injective hyz ▸ hy + exact (he.2.1 hz).2 hzV + have hcl : IsClosed (cap.emb ⁻¹' Δ) := hΔ.preimage cap.isEmbedding.continuous + refine ⟨he, hsub, fun z hz ↦ ?_⟩ + exact closure_minimal hsub hcl hz.1.1 + · exact fun he ↦ (D.part_le_plus Δ X).edgeSet_subset he + +theorem sep_plus {F : Drawing Shat} (hF : F.IsCircuitOf D.rad.G) {Δ X : Set Shat} + (hΔ : IsClosedDisc Δ) (hbd : discBd Δ = F.U) (hX : X ⊆ cap.emb '' D.Γ.V) + : D.Γ.toHypergraph.IsSeparation (D.partPlus Δ X) + (partIn cap D.Γ (closure Δᶜ)) := by + have hT := cap.isClosedSurface + have hs := (disc_facts χ.isSurface D.P.fits.internally_three_connected D.rad hF hΔ hbd).1 + have hl : D.partPlus Δ X ≤ D.Γ.toHypergraph := D.Γ.restrict_le _ + have hr : partIn cap D.Γ (closure Δᶜ) ≤ D.Γ.toHypergraph := D.Γ.restrict_le _ + have hl₀ : partIn cap D.Γ Δ ≤ D.Γ.toHypergraph := D.Γ.restrict_le _ + rw [isSeparation_iff_of_le hl hr] + replace hs : D.Γ.toHypergraph.IsSeparation (partIn cap D.Γ Δ) (partIn cap D.Γ (closure Δᶜ)) := hs + rw [isSeparation_iff_of_le hl₀ hr] at hs + obtain ⟨h₁, h₂, h₃⟩ := hs + refine ⟨?_, ?_, ?_⟩ + · apply subset_antisymm + · exact union_subset hl.vertexSet_subset hr.vertexSet_subset + · intro v hv + have := h₁ ▸ hv + rcases this with h | h + · exact .inl ((D.part_le_plus Δ X).vertexSet_subset h) + · exact .inr h + · have : (D.partPlus Δ X).edgeSet = (partIn cap D.Γ Δ).edgeSet := Set.ext fun e ↦ + edge_mem_plus_iff hX hΔ.isClosed + rw [this] + exact h₂ + · have : (D.partPlus Δ X).edgeSet = (partIn cap D.Γ Δ).edgeSet := Set.ext fun e ↦ + edge_mem_plus_iff hX hΔ.isClosed + rw [this] + exact h₃ + +omit [T2Space S] [T2Space Shat] in +/-- A separation with the same first part up to some vertices is on the same side of `𝒯`. -/ +theorem plus_mem_of_mem {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ord' : ℕ} + (h𝒯' : IsTangle D.Γ.toHypergraph ord' 𝒯') + {A A₀ B : Hypergraph S (Set S)} (hA : D.Γ.toHypergraph.IsSeparation A B) + (hA₀ : D.Γ.toHypergraph.IsSeparation A₀ B) + (hord : Hypergraph.separationOrder A B < ord') (hm : (A₀, B) ∈ 𝒯') : (A, B) ∈ 𝒯' := by + refine (h𝒯'.axiom1 hA hord).resolve_right fun hn ↦ ?_ + refine h𝒯'.axiom2 hm hn hn ?_ + rw [GM10.union_assoc, GM10.union_self] + exact hA₀.union_eq + +omit [T2Space S] [T2Space Shat] in +/-- The first part may lose some vertices and stay on the same side, seen from the other tangle. -/ +theorem part_mem_of_plus_mem {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {ord' : ℕ} + (h𝒯' : IsTangle D.Γ.toHypergraph ord' 𝒯') + {A A₀ B : Hypergraph S (Set S)} (hA₀ : D.Γ.toHypergraph.IsSeparation A₀ B) + (hord : Hypergraph.separationOrder A₀ B < ord') (hm : (B, A) ∈ 𝒯') : (B, A₀) ∈ 𝒯' := by + refine (h𝒯'.axiom1 hA₀ hord).resolve_left fun hn ↦ ?_ + refine h𝒯'.axiom2 hn hm hm ?_ + rw [GM10.union_assoc, GM10.union_self] + exact hA₀.union_eq + +/-- The `(𝒯, 𝒯')`-distinction is the inside of an enclave around `𝒯'`, when a circuit of `Γ*` with +small inside separates them. -/ +theorem exists_enclave_of_distinction {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S + (Set S))} (h𝒯' : IsTangle D.Γ.toHypergraph ord' 𝒯') {F : Drawing Shat} {Δ : Set Shat} + (hins : IsInsOf D.rad D.ord D.𝒯 F Δ) (hm : (partIn cap D.Γ (closure Δᶜ), partIn cap D.Γ Δ) ∈ + 𝒯') {C B : Hypergraph S (Set S)} + (hd : IsDistinction D.tb.lambdaOrder D.𝒯 𝒯' C B) : + ∃ F', IsEnclaveAround D.tb D.ord ord' D.𝒯 𝒯' F' ∧ F'.E.ncard ≤ F.E.ncard ∧ C = partIn cap D.Γ + (D.ins F') ∧ B = partIn cap D.Γ (closure (D.ins F')ᶜ) := by + have : ConnectedSpace Shat := cap.connected + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + have hle := (N1_le_of_lambda_le D.tb (hd.2 ⟨hins.2.2.2.2, hm⟩)).1 + simp only [TieBreaker.N1] at hle + have hord := disc_order hS h3 D.rad hins.1 hins.2.2.1 hins.2.2.2.1 + have hlt : Hypergraph.separationOrder C B < tangleRep D.rad D.ord D.𝒯 := by + have h₁ := hins.2.1 + have h₂ : Hypergraph.separationOrder (partIn cap D.P.Γ Δ) (partIn cap D.P.Γ (closure Δᶜ)) < + tangleRep D.rad D.ord D.𝒯 := by omega + exact lt_of_le_of_lt hle h₂ + obtain ⟨F', Δ', hins', rfl, rfl⟩ := theorem_8_4_proof hS h3 D.tb D.isTangle h𝒯' hd hlt + obtain rfl := D.eq_ins_of_isInsOf hins' + exact ⟨F', ⟨h𝒯', hins'.1, hins'.2.1, _, hins', hd⟩, enclave_card_le hS h3 D.tb hins' hd hins hm, + rfl, rfl⟩ + +omit [T2Space S] [T2Space Shat] in +/-- If the inside of the enclave is in `Δ`, then the distinction is as (14.1) needs it. -/ +theorem le_of_ins_subset {Δ Δ' X : Set Shat} (h : Δ' ⊆ Δ) : partIn cap D.Γ Δ' ≤ D.partPlus Δ X + ∧ partIn cap D.Γ (closure Δᶜ) ≤ partIn cap D.Γ (closure Δ'ᶜ) := by + have : ConnectedSpace Shat := cap.connected + refine ⟨(part_mono h).trans (D.part_le_plus Δ X), part_mono (closure_mono + (compl_subset_compl.mpr h))⟩ + +omit [T2Space S] [T2Space Shat] in +/-- The vertices of the separation of `Δ` with `X`. -/ +theorem plus_inter_V {Δ X : Set Shat} (hΔ : IsClosedDisc Δ) (hoff : Disjoint X + (discInt Δ)) {v : S} : + v ∈ (D.partPlus Δ X ∩ partIn cap D.Γ (closure Δᶜ)).vertexSet ↔ v ∈ D.Γ.V + ∧ cap.emb v ∈ discBd Δ ∪ X := by + have hT := cap.isClosedSurface + rw [GM10.inter_vertexSet] + change (v ∈ D.Γ.V ∧ cap.emb v ∈ Δ ∪ X) ∧ (v ∈ D.Γ.V ∧ cap.emb v ∈ closure Δᶜ) ↔ _ + rw [closure_compl_disc hT hΔ] + constructor + · rintro ⟨⟨hv, h | h⟩, -, h'⟩ + · exact ⟨hv, .inl (by_contra fun hn ↦ h' ⟨h, hn⟩)⟩ + · exact ⟨hv, .inr h⟩ + · rintro ⟨hv, h | h⟩ + · exact ⟨⟨hv, .inl (Surface.discBd_subset _ h)⟩, hv, fun h' ↦ h'.2 h⟩ + · exact ⟨⟨hv, .inr h⟩, hv, fun h' ↦ disjoint_left.mp hoff h h'⟩ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14h.lean b/LeanPool/GraphMinor/GM19/Section14h.lean new file mode 100644 index 0000000000..8d4dc9cdca --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14h.lean @@ -0,0 +1,283 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14g + +/-! +# Graph Minors XIX, Section 14: the frame of a wheel and its arms + +For one wheel we fix an optimal hub, a spoke at each vertex, the rim, and the sector at each vertex +of `R*` on the rim. From these come the hub +sector and the `r*`-sectors of the proof of (14.1). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} {H : Drawing Shat} {ρ : ℕ} + +omit [T2Space S] in +omit [T2Space Shat] in +/-- A wheel has an optimal hub. -/ +theorem exists_optimal_hub (h : D.IsWheel W) : ∃ H, D.IsOptimalWheelHub W H (D.wheelRadius W) := by + have hne : {ρ : ℕ | ∃ H : Drawing Shat, D.IsWheelHubOfRadius W H ρ}.Nonempty := by + obtain ⟨H, ρ, hH⟩ := h + exact ⟨ρ, H, hH⟩ + obtain ⟨H, hH⟩ := Nat.sInf_mem hne + by_cases hone : ∃ H' : Drawing Shat, D.IsWheelHubOfRadius W H' (D.wheelRadius W) ∧ H'.V.ncard = 1 + · obtain ⟨H', h₁, h₂⟩ := hone + exact ⟨H', { h₁ with ρ_eq_radius := rfl, one_vertex_priority := .inl h₂ }⟩ + · exact ⟨H, { hH with ρ_eq_radius := rfl, one_vertex_priority := .inr hone }⟩ + +/-- The sector at the `i`th vertex of `R*` of a rim. -/ +structure RimSector (R : Rim D W) (sp : SpokeSystem D W H) (i : ℕ) where + /-- The first rim edge at the sector pole. -/ + f : Set Shat + /-- The second rim edge at the sector pole. -/ + g : Set Shat + /-- The radial walk joining the successive rim vertices. -/ + Z : GraphWalk D.rad.G.toGraph (R.vert i) (R.vert (i + 1)) + /-- The closed disc of the sector. -/ + Δ : Set Shat + /-- The other closed disc in the sector decomposition. -/ + Δ' : Set Shat + /-- The circuit bounding the sector disc. -/ + C : Drawing Shat + full : D.IsFullSector W H (R.reg i) f g (R.spoke sp i) (R.spoke sp (i + 1)) Z Δ Δ' C + only : ∀ e ∈ D.rad.G.E, e ⊆ discBd W → R.reg i ∈ closure e → e = f ∨ e = g + +/-- A sector of a rim is a sector at `r`. -/ +noncomputable def RimSector.toSectorAt {R : Rim D W} {sp : SpokeSystem D W H} {i : ℕ} + (s : RimSector R sp i) : SectorAt sp (R.reg i) := + ⟨⟨R.vert i, R.vert_mem i⟩, ⟨R.vert (i + 1), R.vert_mem (i + 1)⟩, s.f, s.g, s.Z, s.Δ, s.Δ', s.C, + s.full, s.only⟩ + +theorem exists_rimSector (hopt : D.IsOptimalWheelHub W H ρ) (hbdS : discBd W ⊆ cap.emb '' + (univ \ bd S)) (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) + (R : Rim D W) (sp : SpokeSystem D W H) (i : ℕ) : Nonempty (RimSector R sp i) := by + have hW := hopt.toIsWheelHubOfRadius + have hi := R.mod_lt i + have hvert : R.vert (i % R.k) = R.vert i := by rw [Rim.vert, Rim.vert, Nat.mod_mod] + have hne : R.vert i ≠ R.vert (i + 1) := by + have h := R.vert_ne_succ hi + rw [hvert] at h + have h₂ : R.vert (i % R.k + 1) = R.vert (i + 1) := by + rw [Rim.vert, Rim.vert] + congr 2 + exact Nat.mod_add_mod i R.k 1 + rwa [h₂] at h + obtain ⟨f, g, hl₁, hl₂, hf, hg⟩ := R.exists_links i + obtain ⟨Z, Δ, Δ', C, hs⟩ := exists_fullSector hopt hbdS hin (R.spoke_spoke sp i) + (R.spoke_spoke sp (i + 1)) (R.reg_mem i) hl₁ hl₂ hne hf hg + obtain ⟨f₁, f₂, v₁, v₂, -, -, -, -, -, honly⟩ := hW.exists_two_bd_edges hbdS hin (R.reg_mem i).1 + (R.reg_mem i).2 + have hrf : ∀ {e v}, D.rad.G.toGraph.IsLink e (R.reg i) v → R.reg i ∈ closure e + := fun {e v} hl ↦ by + have hm : R.reg i ∈ closure e ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact .inl rfl + exact hm.1 + have hfg : f ≠ g := by + rintro rfl + have hm : R.vert i ∈ closure f ∩ D.rad.G.V := by + rw [hl₁.2.2.2] + exact .inr rfl + rw [hl₂.2.2.2] at hm + rcases hm with hm | hm + · exact (R.reg_mem i).1.2 (hm ▸ (R.vert_mem i).1) + · exact hne hm + refine ⟨⟨f, g, Z, Δ, Δ', C, hs, fun e he heb hre ↦ ?_⟩⟩ + have h₁ := honly f hl₁.1 hf (hrf hl₁) + have h₂ := honly g hl₂.1 hg (hrf hl₂) + rcases honly e he heb hre with he' | he' <;> rcases h₁ with h₁ | h₁ <;> rcases h₂ with h₂ | h₂ <;> + first + | exact .inl (he'.trans h₁.symm) + | exact .inr (he'.trans h₂.symm) + | exact absurd (h₁.trans h₂.symm) hfg + +/-- All that we fix for one wheel. -/ +structure WheelFrame (D : TangleDatum cap χ) (W : Set Shat) where + /-- The hub drawing. -/ + H : Drawing Shat + /-- The radius of the chosen hub. -/ + ρ : ℕ + hopt : D.IsOptimalWheelHub W H ρ + hbdS : discBd W ⊆ cap.emb '' (univ \ bd S) + hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty + hrep : 6 * ρ + 14 ≤ D.rep + /-- The spokes joining rim vertices to the hub. -/ + sp : SpokeSystem D W H + /-- The rim walk and its base vertex. -/ + R : Rim D W + /-- The sector between each two successive spokes. -/ + sec : ∀ i, RimSector R sp i + +theorem exists_wheelFrame (h : D.IsWheel W) (hbdS : discBd W ⊆ cap.emb '' (univ \ bd S)) (hin : + ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) (hrep : 6 * D.wheelRadius W + 14 ≤ D.rep) : + ∃ fr : WheelFrame D W, fr.ρ = D.wheelRadius W := by + obtain ⟨H, hopt⟩ := exists_optimal_hub h + have hW := hopt.toIsWheelHubOfRadius + obtain ⟨sp⟩ := exists_spokeSystem hW + obtain ⟨R⟩ := exists_rim hW hbdS hin + have hsec := fun i ↦ exists_rimSector hopt hbdS hin R sp i + exact ⟨⟨H, _, hopt, hbdS, hin, hrep, sp, R, fun i ↦ (hsec i).some⟩, rfl⟩ + +/-- The left inverse of `Σ → Σ̂`. -/ +noncomputable def pre (_ : TangleDatum cap χ) : Shat → S := + haveI : Nonempty S := χ.connected.toNonempty + Function.invFun cap.emb + +omit [T2Space S] [T2Space Shat] in +theorem pre_emb (D : TangleDatum cap χ) (x : S) : D.pre (cap.emb x) = x := by + have : Nonempty S := χ.connected.toNonempty + exact Function.leftInverse_invFun cap.isEmbedding.injective x + +open Classical in +/-- The march with `front` first, and then the rest of `T` in any order. -/ +noncomputable def orderedList (front : List S) (T : Set S) (hT : T.Finite) : List S := + (front.filter (· ∈ T)).dedup ++ (hT.toFinset \ front.toFinset).toList + +omit [TopologicalSpace S] [T2Space S] in +theorem orderedList_nodup (front : List S) {T : Set S} (hT : T.Finite) : + (orderedList front T hT).Nodup := by + classical + refine List.nodup_append.mpr ⟨List.nodup_dedup _, Finset.nodup_toList _, ?_⟩ + intro a ha b hb e + subst e + simp only [Finset.mem_toList, Finset.mem_sdiff, List.mem_toFinset] at hb + exact hb.2 (List.mem_of_mem_filter (List.mem_dedup.mp ha)) + +omit [TopologicalSpace S] [T2Space S] in +theorem orderedList_set (front : List S) {T : Set S} (hT : T.Finite) : {v | v ∈ orderedList front T + hT} = T := by + classical + ext v + simp only [orderedList, mem_ofPred_eq, List.mem_append, List.mem_dedup, List.mem_filter, + Finset.mem_toList, Finset.mem_sdiff, hT.mem_toFinset, List.mem_toFinset, decide_eq_true_eq] + tauto + +omit [TopologicalSpace S] [T2Space S] in +theorem orderedList_length (front : List S) {T : Set S} (hT : T.Finite) : + (orderedList front T hT).length = T.ncard := by + classical + have hnd := orderedList_nodup front hT + have h : T = ↑(orderedList front T hT).toFinset := by + ext v + rw [Finset.mem_coe, List.mem_toFinset] + exact (Set.ext_iff.mp (orderedList_set front hT) v).symm + conv_rhs => rw [h] + rw [ncard_coe_finset, List.toFinset_card_of_nodup hnd] + +/-- The arm of the disc `Δ` with the vertices `X`. -/ +noncomputable def discArm (D : TangleDatum cap χ) (Δ X : Set Shat) (h : + D.Γ.toHypergraph.IsSeparation (D.partPlus Δ X) (partIn cap D.Γ (closure Δᶜ))) + (front : List S) : Arm D.Γ where + minus := D.partPlus Δ X + compl := partIn cap D.Γ (closure Δᶜ) + isSeparation := h + π := orderedList front (D.partPlus Δ X ∩ partIn cap D.Γ (closure Δᶜ)).vertexSet + (D.partPlus Δ X ∩ partIn cap D.Γ (closure Δᶜ)).vertexSet_finite + π_nodup := orderedList_nodup _ _ + π_set := orderedList_set _ _ + +/-- The enumeration of the vertices of `Γ` on a walk of `Γ*`. -/ +noncomputable def walkMarch (D : TangleDatum cap χ) {a b : Shat} (K : GraphWalk D.rad.G.toGraph a + b) : List S := by + classical exact (K.support.filter (· ∈ cap.emb '' D.Γ.V)).map D.pre + +namespace WheelFrame + +variable (fr : WheelFrame D W) + +theorem hW : D.IsWheelHubOfRadius W fr.H fr.ρ := fr.hopt.toIsWheelHubOfRadius + +theorem spoke_spoke (i : ℕ) : D.IsSpokeWalk W fr.H (fr.R.spoke fr.sp i) := fr.R.spoke_spoke fr.sp i + +/-- The sectors and the hub with its spokes cover `W`. -/ +theorem cover {x : Shat} (hx : x ∈ W) (hxA : x ∉ fr.sp.A) : ∃ i, x ∈ (fr.sec i).Δ := by + obtain ⟨r, hr⟩ := SpokeSystem.cover fr.hW fr.sp fr.hbdS fr.hin (ι := ℕ) fr.R.reg (fun i ↦ + (fr.sec i).toSectorAt) + (fun r hr ↦ by + obtain ⟨i, -, rfl⟩ := fr.R.exists_reg r hr + exact ⟨i, rfl⟩) hx hxA + exact ⟨r, hr⟩ + +theorem disjoint_int {i j : ℕ} (hne : fr.R.reg i ≠ fr.R.reg j) : Disjoint (discInt (fr.sec i).Δ) + (discInt (fr.sec j).Δ) := + SectorAt.disjoint_int fr.hW fr.hbdS fr.hin (fr.sec i).toSectorAt (fr.sec j).toSectorAt hne + +/-- The vertices of `Γ` in `Σ̂` that are on both spokes of the sector `i`. -/ +noncomputable def secX (i : ℕ) : Set Shat := (cap.emb '' D.Γ.V) ∩ (walkDrawing D.rad.G + (fr.R.spoke fr.sp i)).U ∩ (walkDrawing D.rad.G (fr.R.spoke fr.sp (i + 1))).U + +theorem secX_sub (i : ℕ) : fr.secX i ⊆ cap.emb '' D.Γ.V := fun _ h ↦ h.1.1 + +theorem secX_off (i : ℕ) : Disjoint (fr.secX i) (discInt (fr.sec i).Δ) := + disjoint_left.mpr fun _ h h' ↦ disjoint_left.mp ((fr.sec i).full.spoke_off _ _ _ + (fr.spoke_spoke i)) h.1.2 h' + +theorem sec_sep (i : ℕ) : D.Γ.toHypergraph.IsSeparation (D.partPlus (fr.sec i).Δ (fr.secX i)) + (partIn cap D.Γ (closure (fr.sec i).Δᶜ)) := + sep_plus (fr.sec i).full.boundary.Dv_circuit (fr.sec i).full.boundary.is_disc + (fr.sec i).full.boundary.Dv_U.symm (fr.secX_sub i) + +/-- The enumeration `μ(v)` of the vertices of `Γ` on the spoke `i`. -/ +noncomputable def lev (i : ℕ) : List S := D.walkMarch (fr.R.spoke fr.sp i) + +/-- The `r*`-sector at the `i`th vertex of `R*`. -/ +noncomputable def secArm (i : ℕ) : Arm D.Γ := D.discArm (fr.sec i).Δ (fr.secX i) (fr.sec_sep i) + (fr.lev i ++ fr.lev (i + 1)) + +theorem hub_data (hc : fr.H.V.ncard ≠ 1) : IsEnclave D.tb D.ord D.𝒯 fr.H ∧ fr.H.E.ncard + ≤ 4 * fr.ρ + 4 ∧ IsInsOf D.rad D.ord D.𝒯 fr.H (D.ins fr.H) := by + rcases fr.hW.hub_cases with ⟨z, hV, -, -⟩ | ⟨hH, hle, -, -⟩ + · rw [hV, ncard_singleton] at hc + exact absurd rfl hc + · obtain ⟨-, -, -, hcirc, -⟩ := id hH + have hrep := fr.hW.rep_ge + exact ⟨hH, hle, D.ins_spec hcirc (by omega)⟩ + +theorem hub_sep (hc : fr.H.V.ncard ≠ 1) : D.Γ.toHypergraph.IsSeparation (D.partPlus (D.ins fr.H) ∅) + (partIn cap D.Γ (closure (D.ins fr.H)ᶜ)) := by + obtain ⟨-, -, hi⟩ := fr.hub_data hc + exact sep_plus hi.1 hi.2.2.1 hi.2.2.2.1 (empty_subset _) + +/-- The hub sector. -/ +noncomputable def hubArm (hc : fr.H.V.ncard ≠ 1) : Arm D.Γ := D.discArm (D.ins fr.H) ∅ + (fr.hub_sep hc) [] + +/-- The arms at `W`. -/ +def arms : Set (Arm D.Γ) := {A | (∃ i < fr.R.k, A = fr.secArm i) ∨ ∃ hc : fr.H.V.ncard ≠ 1, A + = fr.hubArm hc} + +theorem arms_finite : fr.arms.Finite := by + refine ((finite_lt_nat fr.R.k).image fr.secArm |>.union (Set.Subsingleton.finite (s + := {A | ∃ hc : fr.H.V.ncard ≠ 1, A = fr.hubArm hc}) ?_)).subset ?_ + · rintro _ ⟨h, rfl⟩ _ ⟨h', rfl⟩ + rfl + · rintro A (⟨i, hi, rfl⟩ | h) + · exact .inl ⟨i, hi, rfl⟩ + · exact .inr h + +end WheelFrame + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14i.lean b/LeanPool/GraphMinor/GM19/Section14i.lean new file mode 100644 index 0000000000..18a8564800 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14i.lean @@ -0,0 +1,408 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14h + +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Graph Minors XIX, Section 14: the location of a wheel cover + +The arms of all wheels of a cover form a rooted location, and it isolates `𝒯`. This is the claim (2) +in the proof of (14.1). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {W : Set Shat} + +/-- An arm of a wheel is the arm of a disc in `W`, whose inside misses all else that is not in that +disc. -/ +structure IsDiscArm (fr : WheelFrame D W) (A : Arm D.Γ) (Δ X : Set Shat) : Prop where + disc : IsClosedDisc Δ + sub : Δ ∪ X ⊆ W + minus : A.minus = D.partPlus Δ X + compl : A.compl = partIn cap D.Γ (closure Δᶜ) + +omit [T2Space S] [T2Space Shat] in +theorem mem_walkMarch {a b : Shat} {K : GraphWalk D.rad.G.toGraph a b} {x : S} : x ∈ D.walkMarch K + ↔ x ∈ D.Γ.V ∧ cap.emb x ∈ K.support := by + classical + simp only [walkMarch, List.mem_map, List.mem_filter, decide_eq_true_eq] + constructor + · rintro ⟨y, ⟨hy, z, hz, rfl⟩, rfl⟩ + rw [D.pre_emb] + exact ⟨hz, hy⟩ + · rintro ⟨hx, hK⟩ + exact ⟨cap.emb x, ⟨hK, x, hx, rfl⟩, D.pre_emb x⟩ + +omit [T2Space S] in +omit [T2Space Shat] in +theorem walkMarch_length_le {a b : Shat} (K : GraphWalk D.rad.G.toGraph a b) : + (D.walkMarch K).length ≤ K.length + 1 := by + classical + simp only [walkMarch, List.length_map] + refine (List.length_filter_le _ _).trans ?_ + rw [GraphWalk.length_support'] + +omit [T2Space S] in +/-- `|V(Γ) ∩ (U(K) ∪ U(K'))|` is at most the sum of the two lengths. -/ +theorem ncard_le_of_two_walks {a b a' b' : Shat} (K : GraphWalk D.rad.G.toGraph a b) + (K' : GraphWalk D.rad.G.toGraph a' b') {T : Set S} + (hT : ∀ v ∈ T, v ∈ D.Γ.V ∧ cap.emb v ∈ (walkDrawing D.rad.G K).U ∪ + (walkDrawing D.rad.G K').U) : T.ncard ≤ K.length + K'.length + 2 := by + classical + have hsub : T ⊆ ↑((D.walkMarch K ++ D.walkMarch K').toFinset) := by + intro v hv + obtain ⟨hV, hU⟩ := hT v hv + have hG : cap.emb v ∈ D.rad.G.V := D.rad.isPreRadial.2.1 ⟨v, hV, rfl⟩ + simp only [Finset.mem_coe, List.mem_toFinset, List.mem_append] + rcases hU with hU | hU + · exact .inl (mem_walkMarch.mpr ⟨hV, support_of_mem_U K hU hG⟩) + · exact .inr (mem_walkMarch.mpr ⟨hV, support_of_mem_U K' hU hG⟩) + refine (ncard_le_ncard hsub (Finset.finite_toSet _)).trans ?_ + rw [ncard_coe_finset] + refine (List.toFinset_card_le _).trans ?_ + rw [List.length_append] + have h₁ := walkMarch_length_le (D := D) K + have h₂ := walkMarch_length_le (D := D) K' + omega + +namespace WheelFrame + +variable (fr : WheelFrame D W) + +theorem spoke_subset (i : ℕ) : (walkDrawing D.rad.G (fr.R.spoke fr.sp i)).U ⊆ W := + (fr.spoke_spoke i).subset_W fr.hW fr.hbdS fr.hin + +theorem sec_Δ_sub (i : ℕ) : (fr.sec i).Δ ⊆ W := (fr.sec i).toSectorAt.Δ_subset + +theorem secArm_disc (i : ℕ) : IsDiscArm fr (fr.secArm i) (fr.sec i).Δ (fr.secX i) := + ⟨(fr.sec i).full.disc, union_subset (fr.sec_Δ_sub i) fun _ h ↦ fr.spoke_subset i h.1.2, rfl, rfl⟩ + +theorem hubArm_disc (hc : fr.H.V.ncard ≠ 1) : IsDiscArm fr (fr.hubArm hc) (D.ins fr.H) ∅ := by + obtain ⟨hH, hle, hi⟩ := fr.hub_data hc + have hsub := (fr.hW.hubSet_facts).2.1 + rcases fr.hW.hub_cases with ⟨z, hV, -, -⟩ | ⟨-, -, -, hh⟩ + · rw [hV, ncard_singleton] at hc + exact absurd rfl hc + · rw [hh] at hsub + exact ⟨hi.2.2.1, by simpa using hsub, rfl, rfl⟩ + +/-- The set in an arm misses the inside of each other arm of the wheel: first for two sectors. -/ +theorem sec_off_sec {i j : ℕ} (hne : fr.R.reg i ≠ fr.R.reg j) : Disjoint ((fr.sec i).Δ ∪ fr.secX i) + (discInt (fr.sec j).Δ) := by + refine disjoint_left.mpr fun y hy hyi ↦ ?_ + rcases hy with hy | hy + · by_cases hb : y ∈ discBd (fr.sec i).Δ + · exact disjoint_left.mp (SectorAt.bd_off fr.hW (fr.sec i).toSectorAt + (fr.sec j).toSectorAt) hb hyi + · exact disjoint_left.mp (fr.disjoint_int hne) ⟨hy, hb⟩ hyi + · exact disjoint_left.mp ((fr.sec j).full.spoke_off _ _ _ (fr.spoke_spoke i)) hy.1.2 hyi + +theorem sec_off_hub (hc : fr.H.V.ncard ≠ 1) (i : ℕ) : Disjoint ((fr.sec i).Δ ∪ fr.secX i) (discInt + (D.ins fr.H)) := by + have hT := cap.isClosedSurface + obtain ⟨hH, hle, hi⟩ := fr.hub_data hc + have hbd := hi.2.2.2.1 + have hcl : IsClosed (discBd W) := by + rw [← IsClosedDisc.frontier_eq_discBd hT fr.hW.is_disc] + exact isClosed_frontier + have hsp : ∀ {j}, Disjoint (walkDrawing D.rad.G (fr.R.spoke fr.sp j)).U (discInt (D.ins fr.H)) + := fun {j} ↦ + disjoint_left.mpr fun y hy hyi ↦ disjoint_left.mp ((fr.spoke_spoke j).off_ins_hub fr.hW hH hle) + hy ⟨hyi.1, fun h' ↦ hyi.2 (hbd ▸ h')⟩ + have hoff := (fr.sec i).full.boundary.interior_off_hub fr.hopt fr.hbdS fr.hin hH hle + refine disjoint_left.mpr fun y hy hyi ↦ ?_ + rcases hy with hy | hy + · by_cases hb : y ∈ discBd (fr.sec i).Δ + · rw [(fr.sec i).full.bd_eq] at hb + rcases hb with hb | hb + · refine disjoint_left.mp (fr.hW.ins_off_bd hi.1 hle) hyi.1 ?_ + exact (union_subset (closure_minimal (fr.sec i).full.f₁_bd hcl) (closure_minimal + (fr.sec i).full.f₂_bd hcl)) hb + · rcases (fr.sec i).full.Z_sub hb with (h' | h') | h' + · exact disjoint_left.mp hsp h' hyi + · exact disjoint_left.mp hsp h' hyi + · exact hyi.2 (hbd ▸ h') + · exact disjoint_left.mp hoff hyi ⟨hy, hb⟩ + · exact disjoint_left.mp hsp hy.1.2 hyi + +theorem hub_off_sec (hc : fr.H.V.ncard ≠ 1) (i : ℕ) : Disjoint (D.ins fr.H ∪ ∅) (discInt + (fr.sec i).Δ) := by + have hT := cap.isClosedSurface + obtain ⟨hH, hle, hi⟩ := fr.hub_data hc + have hoff := (fr.sec i).full.boundary.interior_off_hub fr.hopt fr.hbdS fr.hin hH hle + rw [union_empty] + refine disjoint_left.mpr fun y hy hyi ↦ ?_ + by_cases hb : y ∈ discBd (D.ins fr.H) + · exact disjoint_left.mp (fr.sec i).full.hub_off (hi.2.2.2.1 ▸ hb) hyi + · exact disjoint_left.mp hoff ⟨hy, hb⟩ hyi + +omit [T2Space S] [T2Space Shat] in +/-- A hat vertex on the closure of an edge at `r` is the other end. -/ +theorem hat_on_edge {r v x : Shat} {f : Set Shat} (hr : r ∈ D.rad.Rstar) + (hl : D.rad.G.toGraph.IsLink f r v) (hx : x ∈ closure f) (hxV : x ∈ cap.emb '' D.Γ.V) : x = v + := by + have hm : x ∈ closure f ∩ D.rad.G.V := ⟨hx, D.rad.isPreRadial.2.1 hxV⟩ + rw [hl.2.2.2] at hm + rcases hm with rfl | hm + · exact absurd hxV hr.2 + · exact hm + +/-- The vertices of the `r*`-sector on the boundary are on the two spokes, or `H` has a path in it. +-/ +theorem sec_order_le (i : ℕ) : (fr.secArm i).order ≤ 2 * fr.ρ + 2 := by + classical + have : ConnectedSpace Shat := cap.connected + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + have hs := (fr.sec i).full + have hb := hs.boundary + have h5 := theorem_13_5_proof fr.hW fr.hbdS fr.hin hb + by_cases he : fr.R.inner fr.sp i = fr.R.inner fr.sp (i + 1) + · have hT : ∀ v ∈ (D.partPlus (fr.sec i).Δ (fr.secX i) ∩ partIn cap D.Γ (closure + (fr.sec i).Δᶜ)).vertexSet, + v ∈ D.Γ.V ∧ cap.emb v ∈ (walkDrawing D.rad.G (fr.R.spoke fr.sp i)).U ∪ (walkDrawing D.rad.G + (fr.R.spoke fr.sp (i + 1))).U := by + intro v hv + obtain ⟨hV, hU⟩ := (plus_inter_V hs.disc (fr.secX_off i)).mp hv + refine ⟨hV, ?_⟩ + have hem : cap.emb v ∈ cap.emb '' D.Γ.V := ⟨v, hV, rfl⟩ + rcases hU with hU | hU + · rw [hs.bd_eq] at hU + rcases hU with (hU | hU) | hU + · rw [hat_on_edge hs.r_mem.1 hs.link₁ hU hem] + exact .inl ((mem_walkDrawing_U _ _).mpr (.inl (fr.R.spoke fr.sp i).start_mem_support)) + · rw [hat_on_edge hs.r_mem.1 hs.link₂ hU hem] + exact .inr ((mem_walkDrawing_U _ _).mpr (.inl (fr.R.spoke fr.sp + (i + 1)).start_mem_support)) + · exact hs.Z_same he hU + · exact .inl hU.1.2 + have h := ncard_le_of_two_walks _ _ hT + have h₁ := (fr.hW.spoke_length (fr.spoke_spoke i)).1 + have h₂ := (fr.hW.spoke_length (fr.spoke_spoke (i + 1))).1 + change Hypergraph.separationOrder _ _ ≤ _ + simp only [Hypergraph.separationOrder] + refine h.trans ?_ + omega + · have hX : fr.secX i = ∅ := by + refine eq_empty_of_forall_notMem fun y hy ↦ he ?_ + have hG : y ∈ D.rad.G.V := D.rad.isPreRadial.2.1 hy.1.1 + exact fr.R.inner_eq_of_mem fr.sp (support_of_mem_U _ hy.1.2 hG) + (support_of_mem_U _ hy.2 hG) + have hord := disc_order hS h3 D.rad hb.Dv_circuit hb.is_disc hb.Dv_U.symm + have hE := h5.1 + change Hypergraph.separationOrder (D.partPlus (fr.sec i).Δ (fr.secX i)) _ ≤ _ + rw [hX] + have hp : D.partPlus (fr.sec i).Δ ∅ = partIn cap D.Γ (fr.sec i).Δ := by + simp [partPlus, partIn] + rw [hp] + have hq : Hypergraph.separationOrder (partIn cap D.P.Γ (fr.sec i).Δ) + (partIn cap D.P.Γ (closure (fr.sec i).Δᶜ)) ≤ 2 * fr.ρ + 2 := by omega + exact hq + +theorem hub_order_le (hc : fr.H.V.ncard ≠ 1) : (fr.hubArm hc).order ≤ 2 * fr.ρ + 2 := by + have : ConnectedSpace Shat := cap.connected + obtain ⟨hH, hle, hi⟩ := fr.hub_data hc + have hord := disc_order χ.isSurface D.P.fits.internally_three_connected D.rad hi.1 hi.2.2.1 + hi.2.2.2.1 + change Hypergraph.separationOrder (D.partPlus (D.ins fr.H) ∅) _ ≤ _ + have hp : D.partPlus (D.ins fr.H) ∅ = partIn cap D.Γ (D.ins fr.H) := by + simp [partPlus, partIn] + rw [hp] + have hq : Hypergraph.separationOrder (partIn cap D.P.Γ (D.ins fr.H)) + (partIn cap D.P.Γ (closure (D.ins fr.H)ᶜ)) ≤ 2 * fr.ρ + 2 := by omega + exact hq + +/-- The enclaves of the distinctions fall in the sector. -/ +theorem sec_ins (i : ℕ) : IsInsOf D.rad D.ord D.𝒯 (fr.sec i).C (fr.sec i).Δ ∧ (fr.sec i).C.E.ncard + ≤ 4 * fr.ρ + 4 ∧ + ∀ {ord' 𝒯' F'}, IsEnclaveAround D.tb D.ord ord' D.𝒯 𝒯' F' → (partIn cap D.Γ (closure + (fr.sec i).Δᶜ), partIn cap D.Γ (fr.sec i).Δ) ∈ 𝒯' → D.ins F' ⊆ (fr.sec i).Δ := by + have hb := (fr.sec i).full.boundary + have h5 := theorem_13_5_proof fr.hW fr.hbdS fr.hin hb + have hrep := fr.hrep + have hi := D.ins_spec hb.Dv_circuit (by omega) + rw [h5.2] at hi + refine ⟨hi, h5.1, fun he hm ↦ ?_⟩ + exact theorem_13_6_proof ⟨fr.hopt, fr.hbdS, fr.hin, hrep, hb, hm, he⟩ + +theorem hub_ins (hc : fr.H.V.ncard ≠ 1) {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S + (Set S))} {F' : Drawing Shat} (he : IsEnclaveAround D.tb D.ord ord' D.𝒯 𝒯' F') + (hle : F'.E.ncard ≤ fr.H.E.ncard) (hm : (partIn cap D.Γ (closure (D.ins fr.H)ᶜ), partIn cap D.Γ + (D.ins fr.H)) ∈ 𝒯') : D.ins F' ⊆ D.ins fr.H := by + have : ConnectedSpace Shat := cap.connected + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + obtain ⟨hH, hHle, hi⟩ := fr.hub_data hc + obtain ⟨ord₂, 𝒯₂, h𝒯₂, hcH, hlt₂, Δ₂, hins₂, hd₂⟩ := id hH + obtain ⟨h𝒯', hc', hlt', Δ', hins', hd'⟩ := id he + obtain rfl := D.eq_ins_of_isInsOf hins₂ + obtain rfl := D.eq_ins_of_isInsOf hins' + rcases theorem_8_6_proof hS h3 D.tb D.isTangle h𝒯' h𝒯₂ hins' hins₂ hd' hd₂ with h₁ | h₁ | h₁ + · exact h₁ + · by_cases hF : F' = fr.H + · rw [hF] + · rcases fr.hW.hub_cond with ⟨hcard, -, -⟩ | ⟨-, -, hne⟩ + · exact absurd hcard hc + · exact absurd ((hi.2.2.2.1 ▸ Surface.discBd_subset _ : fr.H.U ⊆ D.ins fr.H).trans h₁) + (hne F' ⟨ord', 𝒯', he⟩ hF (by omega)) + · obtain ⟨c, hc₁, hc₂, hc₃⟩ := exists_edge_in_both hS h3 h𝒯' hins' hd'.1.2 hins₂ hm + obtain ⟨p, hp⟩ := hc₁.1 + have hmem : cap.emb p ∈ D.ins F' ∩ D.ins fr.H := ⟨(hc₂ ⟨p, hp, rfl⟩).1, (hc₃ ⟨p, hp, rfl⟩).1⟩ + rw [h₁] at hmem + exact absurd (hi.2.2.2.1 ▸ hmem.2 : cap.emb p ∈ discBd (D.ins fr.H)) (hc₃ ⟨p, hp, rfl⟩).2 + +end WheelFrame + +/-- A separation of the form of an arm of a disc is in `𝒯`. -/ +theorem IsDiscArm.sep_mem {fr : WheelFrame D W} {A : Arm D.Γ} {Δ X : Set Shat} + (h : IsDiscArm fr A Δ X) {F : Drawing Shat} (hins : IsInsOf D.rad D.ord D.𝒯 F Δ) + (hord : A.order < D.ord) : A.sep ∈ D.𝒯 := by + have hs₀ := (disc_facts χ.isSurface D.P.fits.internally_three_connected D.rad hins.1 hins.2.2.1 + hins.2.2.2.1).1 + have hs := A.isSeparation + change D.Γ.toHypergraph.IsSeparation A.minus A.compl at hs + have hc : A.compl = partIn cap D.Γ (closure Δᶜ) := h.compl + have : (A.minus, A.compl) ∈ D.𝒯 := by + have hord' : Hypergraph.separationOrder A.minus A.compl < D.ord := hord + rw [hc] at hs hord' ⊢ + exact plus_mem_of_mem D.isTangle hs hs₀ hord' hins.2.2.2.2 + exact this + +theorem IsDiscArm.distinction {fr : WheelFrame D W} {A : Arm D.Γ} {Δ X : Set Shat} + (h : IsDiscArm fr A Δ X) {F : Drawing Shat} (hins : IsInsOf D.rad D.ord D.𝒯 F Δ) + {ord' : ℕ} {𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (h𝒯' : IsTangle D.Γ.toHypergraph ord' 𝒯') (hord : Hypergraph.separationOrder + (partIn cap D.Γ Δ) (partIn cap D.Γ (closure Δᶜ)) < ord') + (hm : A.sep.swap ∈ 𝒯') (hfin : ∀ {F'}, IsEnclaveAround D.tb D.ord ord' D.𝒯 𝒯' F' → F'.E.ncard + ≤ F.E.ncard → (partIn cap D.Γ (closure Δᶜ), partIn cap D.Γ Δ) ∈ 𝒯' → D.ins F' ⊆ Δ) + {C B : Hypergraph S (Set S)} (hd : IsDistinction D.tb.lambdaOrder D.𝒯 𝒯' C B) : C ≤ A.minus + ∧ A.compl ≤ B := by + have hs₀ := (disc_facts χ.isSurface D.P.fits.internally_three_connected D.rad hins.1 hins.2.2.1 + hins.2.2.2.1).1 + have hm' : (A.compl, A.minus) ∈ 𝒯' := hm + rw [h.compl] at hm' ⊢ + have hm₀ := part_mem_of_plus_mem h𝒯' hs₀ hord hm' + obtain ⟨F', he, hle, rfl, rfl⟩ := exists_enclave_of_distinction h𝒯' hins hm₀ hd + rw [h.minus] + exact le_of_ins_subset (hfin he hle hm₀) + +theorem IsDiscArm.minus_le {fr : WheelFrame D W} {W' : Set Shat} {fr' : WheelFrame D W'} {A A' : + Arm D.Γ} {Δ X Δ' X' : Set Shat} (h : IsDiscArm fr A Δ X) (h' : IsDiscArm fr' A' Δ' X') + (hd : Disjoint (Δ ∪ X) (discInt Δ')) : A.minus ≤ A'.compl := by + have : ConnectedSpace Shat := cap.connected + rw [h.minus, h'.compl, closure_compl_disc cap.isClosedSurface h'.disc] + exact part_mono fun y hy h'' ↦ disjoint_left.mp hd hy h'' + +theorem WheelFrame.exists_disc (fr : WheelFrame D W) {A : Arm D.Γ} (hA : A ∈ fr.arms) : ∃ Δ X, + IsDiscArm fr A Δ X := by + rcases hA with ⟨i, -, rfl⟩ | ⟨hc, rfl⟩ + · exact ⟨_, _, fr.secArm_disc i⟩ + · exact ⟨_, _, fr.hubArm_disc hc⟩ + +theorem WheelFrame.minus_le (fr : WheelFrame D W) {A A' : Arm D.Γ} (hA : A ∈ fr.arms) + (hA' : A' ∈ fr.arms) (hne : A ≠ A') : A.minus ≤ A'.compl := by + rcases hA with ⟨i, hi, rfl⟩ | ⟨hc, rfl⟩ <;> rcases hA' with ⟨j, hj, rfl⟩ | ⟨hc', rfl⟩ + · have hij : i ≠ j := fun e ↦ hne (by rw [e]) + have hr : fr.R.reg i ≠ fr.R.reg j := fun e ↦ hij (fr.R.reg_inj hi hj e) + exact (fr.secArm_disc i).minus_le (fr.secArm_disc j) (fr.sec_off_sec hr) + · exact (fr.secArm_disc i).minus_le (fr.hubArm_disc hc') (fr.sec_off_hub hc' i) + · exact (fr.hubArm_disc hc).minus_le (fr.secArm_disc j) (fr.hub_off_sec hc j) + · exact absurd rfl hne + +/-- The rooted location of a wheel cover. -/ +noncomputable def coverLoc (𝒲 : Set (Set Shat)) (hf : 𝒲.Finite) (hd : 𝒲.PairwiseDisjoint id) + (fr : ∀ W : ↥𝒲, WheelFrame D W.1) : RootedLocation D.Γ where + arms := ⋃ W, (fr W).arms + finite_arms := by + have := hf.to_subtype + exact finite_iUnion fun W ↦ (fr W).arms_finite + disjoint_arms := by + intro A₁ h₁ A₂ h₂ hne + obtain ⟨W₁, h₁⟩ := mem_iUnion.mp h₁ + obtain ⟨W₂, h₂⟩ := mem_iUnion.mp h₂ + by_cases he : W₁ = W₂ + · subst he + exact (fr W₁).minus_le h₁ h₂ hne + · obtain ⟨Δ, X, hc⟩ := (fr W₁).exists_disc h₁ + obtain ⟨Δ', X', hc'⟩ := (fr W₂).exists_disc h₂ + refine hc.minus_le hc' (disjoint_left.mpr fun y hy hy' ↦ ?_) + have hdis := hd W₁.2 W₂.2 (fun e ↦ he (Subtype.ext e)) + exact disjoint_left.mp hdis (hc.sub hy) (hc'.sub (.inl hy'.1)) + +/-- **The claim (2) of the proof of (14.1).** -/ +theorem coverLoc_isolates (𝒲 : Set (Set Shat)) (hf : 𝒲.Finite) (hd : 𝒲.PairwiseDisjoint id) + (fr : ∀ W : ↥𝒲, WheelFrame D W.1) {θ : ℕ} (hθ : 0 < θ) + (hord : ∀ W, 2 * (fr W).ρ + 2 < θ) (hle : θ ≤ D.ord) : (coverLoc 𝒲 hf hd fr).Isolates D.tb θ + D.ord D.𝒯 := by + have : ConnectedSpace Shat := cap.connected + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + have horder : ∀ A ∈ (coverLoc 𝒲 hf hd fr).arms, A.order < θ := by + intro A hA + obtain ⟨W, hW⟩ := mem_iUnion.mp hA + have := hord W + rcases hW with ⟨i, -, rfl⟩ | ⟨hc, rfl⟩ + · have := (fr W).sec_order_le i + omega + · have := (fr W).hub_order_le hc + omega + refine ⟨?_, ?_, hle, ?_⟩ + · rintro _ ⟨A, hA, rfl⟩ + obtain ⟨W, hW⟩ := mem_iUnion.mp hA + have hlt := lt_of_lt_of_le (horder A hA) hle + rcases hW with ⟨i, -, rfl⟩ | ⟨hc, rfl⟩ + · exact ((fr W).secArm_disc i).sep_mem ((fr W).sec_ins i).1 hlt + · exact ((fr W).hubArm_disc hc).sep_mem ((fr W).hub_data hc).2.2 hlt + · change sSup (Arm.order '' (coverLoc 𝒲 hf hd fr).arms) < θ + by_cases hne : (Arm.order '' (coverLoc 𝒲 hf hd fr).arms).Nonempty + · obtain ⟨A, hA, hm⟩ := hne.csSup_mem ((coverLoc 𝒲 hf hd fr).finite_arms.image _) + rw [← hm] + exact horder A hA + · rw [not_nonempty_iff_eq_empty.mp hne] + simpa using hθ + · intro A hA ord' 𝒯' h𝒯' hθ' hm C B hdist + obtain ⟨W, hW⟩ := mem_iUnion.mp hA + have hρ := hord W + rcases hW with ⟨i, -, rfl⟩ | ⟨hc, rfl⟩ + · obtain ⟨hi, hE, hfin⟩ := (fr W).sec_ins i + have ho := disc_order hS h3 D.rad hi.1 hi.2.2.1 hi.2.2.2.1 + have hlt : Hypergraph.separationOrder (partIn cap D.Γ (fr W |>.sec i).Δ) (partIn cap D.Γ + (closure (fr W |>.sec i).Δᶜ)) < ord' := by + have hq : Hypergraph.separationOrder (partIn cap D.P.Γ (fr W |>.sec i).Δ) + (partIn cap D.P.Γ (closure (fr W |>.sec i).Δᶜ)) < ord' := by omega + exact hq + exact ((fr W).secArm_disc i).distinction hi h𝒯' hlt hm (fun he _ hm' ↦ hfin he hm') hdist + · obtain ⟨hH, hE, hi⟩ := (fr W).hub_data hc + have ho := disc_order hS h3 D.rad hi.1 hi.2.2.1 hi.2.2.2.1 + have hlt : Hypergraph.separationOrder (partIn cap D.Γ (D.ins (fr W).H)) (partIn cap D.Γ + (closure (D.ins (fr W).H)ᶜ)) < ord' := by + have hq : Hypergraph.separationOrder (partIn cap D.P.Γ (D.ins (fr W).H)) + (partIn cap D.P.Γ (closure (D.ins (fr W).H)ᶜ)) < ord' := by omega + exact hq + exact ((fr W).hubArm_disc hc).distinction hi h𝒯' hlt hm (fun he hle' hm' ↦ + (fr W).hub_ins hc he hle' hm') hdist + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14j.lean b/LeanPool/GraphMinor/GM19/Section14j.lean new file mode 100644 index 0000000000..767a74ca06 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14j.lean @@ -0,0 +1,220 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14i +public import LeanPool.GraphMinor.Surface.DiscRemove + +/-! +# Graph Minors XIX, Section 14: removing several discs from a surface + +The proof of (14.1) deletes the inside of each wheel from `Σ`. "Then $\Sigma'$ is a surface since +the $W$'s are disjoint and each $bd(W)$ is disjoint from +$bd(\Sigma_\chi)$." Here is that fact for a finite family of disjoint closed discs. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {R : Type} [TopologicalSpace R] + +/-- Two subspaces that agree on an open set have the same local shape there. -/ +theorem local_congr_of_open {A B O : Set R} (hO : IsOpen O) (h : A ∩ O = B ∩ O) {x : R} + (hxA : x ∈ A) (hxB : x ∈ B) (hxO : x ∈ O) : + (IsInteriorPoint (⟨x, hxA⟩ : ↥A) ↔ IsInteriorPoint (⟨x, hxB⟩ : ↥B)) ∧ (IsManifoldPoint + (⟨x, hxA⟩ : ↥A) ↔ IsManifoldPoint (⟨x, hxB⟩ : ↥B)) := by + have hOA : IsOpen (Subtype.val ⁻¹' O : Set ↥A) := hO.preimage continuous_subtype_val + have hOB : IsOpen (Subtype.val ⁻¹' O : Set ↥B) := hO.preimage continuous_subtype_val + have hab : ∀ z : (Subtype.val ⁻¹' O : Set ↥A), z.1.1 ∈ B := fun z ↦ by + have : z.1.1 ∈ A ∩ O := ⟨z.1.2, z.2⟩ + rw [h] at this + exact this.1 + have hba : ∀ z : (Subtype.val ⁻¹' O : Set ↥B), z.1.1 ∈ A := fun z ↦ by + have : z.1.1 ∈ B ∩ O := ⟨z.1.2, z.2⟩ + rw [← h] at this + exact this.1 + let φ : (Subtype.val ⁻¹' O : Set ↥A) ≃ₜ (Subtype.val ⁻¹' O : Set ↥B) := + { toFun := fun z ↦ ⟨⟨z.1.1, hab z⟩, z.2⟩ + invFun := fun z ↦ ⟨⟨z.1.1, hba z⟩, z.2⟩ + left_inv := fun z ↦ rfl + right_inv := fun z ↦ rfl + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop } + let a : (Subtype.val ⁻¹' O : Set ↥A) := ⟨⟨x, hxA⟩, hxO⟩ + let b : (Subtype.val ⁻¹' O : Set ↥B) := ⟨⟨x, hxB⟩, hxO⟩ + have hφ : φ a = b := rfl + have hφ' : φ.symm b = a := rfl + constructor + · rw [show (⟨x, hxA⟩ : ↥A) = a.1 from rfl, show (⟨x, hxB⟩ : ↥B) = b.1 from rfl, + ← isInteriorPoint_sub hOA, ← isInteriorPoint_sub hOB] + refine ⟨fun h' ↦ ?_, fun h' ↦ ?_⟩ + · exact hφ ▸ isInteriorPoint_of_isOpenEmbedding φ.isOpenEmbedding h' + · exact hφ' ▸ isInteriorPoint_of_isOpenEmbedding φ.symm.isOpenEmbedding h' + · rw [show (⟨x, hxA⟩ : ↥A) = a.1 from rfl, show (⟨x, hxB⟩ : ↥B) = b.1 from rfl] + rw [show a.1 = Subtype.val a from rfl, show b.1 = Subtype.val b from rfl, + isManifoldPoint_iff_of_isOpenEmbedding hOA.isOpenEmbedding_subtypeVal, + isManifoldPoint_iff_of_isOpenEmbedding hOB.isOpenEmbedding_subtypeVal] + refine ⟨fun h' ↦ ?_, fun h' ↦ ?_⟩ + · exact hφ ▸ isManifoldPoint_of_isOpenEmbedding φ.isOpenEmbedding h' + · exact hφ' ▸ isManifoldPoint_of_isOpenEmbedding φ.symm.isOpenEmbedding h' + +/-- **Removing the insides of finitely many disjoint closed discs from a surface.** -/ +theorem remove_discs [ConnectedSpace R] (hR : IsSurface R) {ℱ : Set (Set R)} (hf : ℱ.Finite) + (hd : ∀ E ∈ ℱ, IsClosedDisc E) (hint : ∀ E ∈ ℱ, ∀ x ∈ discBd E, IsInteriorPoint x) + (hdis : ℱ.PairwiseDisjoint id) : + IsClosed (⋃ E ∈ ℱ, discInt E)ᶜ ∧ IsSurface ↥(⋃ E ∈ ℱ, discInt E)ᶜ ∧ bd ↥(⋃ E ∈ ℱ, discInt E)ᶜ + = Subtype.val ⁻¹' (bd R ∪ ⋃ E ∈ ℱ, discBd E) ∧ + ConnectedSpace ↥(⋃ E ∈ ℱ, discInt E)ᶜ := by + classical + have ht2 : T2Space R := hR.2.1 + have hcR : CompactSpace R := hR.1 + have hman := hR.2.2 + set X := (⋃ E ∈ ℱ, discInt E)ᶜ with hX + have hop : IsOpen (⋃ E ∈ ℱ, discInt E) := isOpen_biUnion fun E hE ↦ (hd E hE).isOpen_discInt hman + have hcl : IsClosed X := hop.isClosed_compl + have hcS : CompactSpace ↥X := isCompact_iff_compactSpace.mp hcl.isCompact + have hrest : ∀ {E : Set R}, E ∈ ℱ → IsOpen (⋃ E' ∈ ℱ \ {E}, E')ᶜ := fun {E} hE ↦ + (hf.sdiff.isClosed_biUnion fun E' hE' ↦ (hd E' hE'.1).isClosed).isOpen_compl + have hagree : ∀ {E : Set R}, E ∈ ℱ → X ∩ (⋃ E' ∈ ℱ \ {E}, E')ᶜ = (discInt E)ᶜ ∩ + (⋃ E' ∈ ℱ \ {E}, E')ᶜ := by + intro E hE + ext y + constructor + · rintro ⟨h₁, h₂⟩ + exact ⟨fun h' ↦ h₁ (mem_biUnion hE h'), h₂⟩ + · rintro ⟨h₁, h₂⟩ + refine ⟨fun h' ↦ ?_, h₂⟩ + obtain ⟨E', hE', hy⟩ := mem_iUnion₂.mp h' + by_cases he : E' = E + · exact h₁ (he ▸ hy) + · exact h₂ (mem_biUnion (show E' ∈ ℱ \ {E} from ⟨hE', he⟩) hy.1) + have hbdcase : ∀ {E : Set R} (hE : E ∈ ℱ) (x : ↥X), x.1 ∈ discBd E → IsManifoldPoint x + ∧ x ∈ bd ↥X := by + intro E hE x hxb + obtain ⟨-, hsurf, hbd⟩ := remove_disc hR (hd E hE) (hint E hE) + have hxE : x.1 ∈ (discInt E)ᶜ := fun h' ↦ h'.2 hxb + have hxO : x.1 ∈ (⋃ E' ∈ ℱ \ {E}, E')ᶜ := by + intro h' + obtain ⟨E', hE', hy⟩ := mem_iUnion₂.mp h' + exact disjoint_left.mp (hdis hE'.1 hE hE'.2) hy (Surface.discBd_subset _ hxb) + obtain ⟨h₁, h₂⟩ := local_congr_of_open (hrest hE) (hagree hE) x.2 hxE hxO + refine ⟨h₂.mpr (hsurf.2.2 _), fun h' ↦ ?_⟩ + have hm : (⟨x.1, hxE⟩ : ↥(discInt E)ᶜ) ∈ bd ↥(discInt E)ᶜ := by + rw [hbd] + exact .inr hxb + exact hm (h₁.mp h') + have hoff : ∀ x : ↥X, (∀ E ∈ ℱ, x.1 ∉ discBd E) → x.1 ∈ (⋃ E ∈ ℱ, E)ᶜ := by + intro x hx h' + obtain ⟨E, hE, hy⟩ := mem_iUnion₂.mp h' + exact x.2 (mem_biUnion hE ⟨hy, hx E hE⟩) + have hsubO : (⋃ E ∈ ℱ, E)ᶜ ⊆ X := by + intro y hy h' + obtain ⟨E, hE, hz⟩ := mem_iUnion₂.mp h' + exact hy (mem_biUnion hE hz.1) + have hOo : IsOpen (⋃ E ∈ ℱ, E)ᶜ := (hf.isClosed_biUnion fun E hE ↦ (hd E + hE).isClosed).isOpen_compl + have hsurf : IsSurface ↥X := by + refine ⟨hcS, inferInstance, fun x ↦ ?_⟩ + by_cases hx : ∃ E ∈ ℱ, x.1 ∈ discBd E + · obtain ⟨E, hE, hb⟩ := hx + exact (hbdcase hE x hb).1 + · push Not at hx + exact (sub_open_iff hOo hsubO (hoff x hx)).2 (hman _) + refine ⟨hcl, hsurf, ?_, ?_⟩ + · ext x + by_cases hx : ∃ E ∈ ℱ, x.1 ∈ discBd E + · obtain ⟨E, hE, hb⟩ := hx + exact ⟨fun _ ↦ .inr (mem_biUnion hE hb), fun _ ↦ (hbdcase hE x hb).2⟩ + · push Not at hx + have h1 := (sub_open_iff hOo hsubO (hoff x hx)).1 + constructor + · intro h + exact .inl fun h2 ↦ h (h1.mpr h2) + · rintro (h | h) + · exact fun h2 ↦ h (h1.mp h2) + · obtain ⟨E, hE, hb⟩ := mem_iUnion₂.mp h + exact absurd hb (hx E hE) + · have hprec : IsPreconnected X := by + rw [isPreconnected_closed_iff] + intro t t' ht ht' hsub hne hne' + by_contra hnone + have hdisj : Disjoint (X ∩ t) (X ∩ t') := by + refine disjoint_left.mpr fun y h₁ h₂ ↦ hnone ⟨y, h₁.1, h₁.2, h₂.2⟩ + have hbdE : ∀ E ∈ ℱ, discBd E ⊆ X ∩ t ∨ discBd E ⊆ X ∩ t' := by + intro E hE + have hsubX : discBd E ⊆ X := fun y hy h' ↦ by + obtain ⟨E', hE', hz⟩ := mem_iUnion₂.mp h' + by_cases he : E' = E + · exact hz.2 (he ▸ hy) + · exact disjoint_left.mp (hdis hE' hE he) hz.1 (Surface.discBd_subset _ hy) + have hp := (hd E hE).isOArc_discBd.isPreconnected + by_contra hn + push Not at hn + obtain ⟨a, ha, ha'⟩ := not_subset.mp hn.1 + obtain ⟨b, hb, hb'⟩ := not_subset.mp hn.2 + have hat : a ∈ t' := (hsub (hsubX ha)).resolve_left fun h' ↦ ha' ⟨hsubX ha, h'⟩ + have hbt : b ∈ t := (hsub (hsubX hb)).resolve_right fun h' ↦ hb' ⟨hsubX hb, h'⟩ + obtain ⟨z, hz, hz₁, hz₂⟩ := (isPreconnected_closed_iff.mp hp) t t' ht ht' (fun y hy ↦ hsub + (hsubX hy)) ⟨b, hb, hbt⟩ ⟨a, ha, hat⟩ + exact hnone ⟨z, hsubX hz, hz₁, hz₂⟩ + set ℱ₁ := {E ∈ ℱ | discBd E ⊆ X ∩ t} with hℱ₁ + set ℱ₂ := {E ∈ ℱ | discBd E ⊆ X ∩ t'} with hℱ₂ + have hcl₁ : IsClosed ((X ∩ t) ∪ ⋃ E ∈ ℱ₁, E) := (hcl.inter ht).union ((hf.subset + (sep_subset _ _)).isClosed_biUnion fun E hE ↦ (hd E hE.1).isClosed) + have hcl₂ : IsClosed ((X ∩ t') ∪ ⋃ E ∈ ℱ₂, E) := (hcl.inter ht').union ((hf.subset + (sep_subset _ _)).isClosed_biUnion fun E hE ↦ (hd E hE.1).isClosed) + have hcover : (univ : Set R) ⊆ ((X ∩ t) ∪ ⋃ E ∈ ℱ₁, E) ∪ ((X ∩ t') ∪ ⋃ E ∈ ℱ₂, E) := by + intro y _ + by_cases hy : y ∈ X + · rcases hsub hy with h' | h' + · exact .inl (.inl ⟨hy, h'⟩) + · exact .inr (.inl ⟨hy, h'⟩) + · obtain ⟨E, hE, hz⟩ := mem_iUnion₂.mp (not_not.mp hy) + rcases hbdE E hE with h' | h' + · exact .inl (.inr (mem_biUnion (show E ∈ ℱ₁ from ⟨hE, h'⟩) hz.1)) + · exact .inr (.inr (mem_biUnion (show E ∈ ℱ₂ from ⟨hE, h'⟩) hz.1)) + obtain ⟨a, ha, hat⟩ := hne + obtain ⟨b, hb, hbt⟩ := hne' + obtain ⟨z, -, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp (isPreconnected_univ (α + := R)) _ _ hcl₁ hcl₂ hcover ⟨a, trivial, .inl ⟨ha, hat⟩⟩ ⟨b, trivial, .inl ⟨hb, hbt⟩⟩ + have hedge : ∀ {E}, E ∈ ℱ → z ∈ E → z ∈ X → z ∈ discBd E := fun {E} hE hzE hzX ↦ by + by_contra hn + exact hzX (mem_biUnion hE ⟨hzE, hn⟩) + rcases hz₁ with h₁ | h₁ <;> rcases hz₂ with h₂ | h₂ + · exact disjoint_left.mp hdisj h₁ h₂ + · obtain ⟨E, hE, hzE⟩ := mem_iUnion₂.mp h₂ + exact disjoint_left.mp hdisj h₁ (hE.2 (hedge hE.1 hzE h₁.1)) + · obtain ⟨E, hE, hzE⟩ := mem_iUnion₂.mp h₁ + exact disjoint_left.mp hdisj (hE.2 (hedge hE.1 hzE h₂.1)) h₂ + · obtain ⟨E, hE, hzE⟩ := mem_iUnion₂.mp h₁ + obtain ⟨E', hE', hzE'⟩ := mem_iUnion₂.mp h₂ + by_cases he : E = E' + · subst he + obtain ⟨y, hy, -⟩ := (hd E hE.1).isOArc_discBd.exists_ne (Classical.arbitrary R) + exact disjoint_left.mp hdisj (hE.2 hy) (hE'.2 hy) + · exact disjoint_left.mp (hdis hE.1 hE'.1 he) hzE hzE' + have hne : Nonempty ↥X := by + by_cases hemp : ℱ.Nonempty + · obtain ⟨E, hE⟩ := hemp + obtain ⟨y, hy, -⟩ := (hd E hE).isOArc_discBd.exists_ne (Classical.arbitrary R) + refine ⟨⟨y, fun h' ↦ ?_⟩⟩ + obtain ⟨E', hE', hz⟩ := mem_iUnion₂.mp h' + by_cases he : E' = E + · exact hz.2 (he ▸ hy) + · exact disjoint_left.mp (hdis hE' hE he) hz.1 (Surface.discBd_subset _ hy) + · rw [not_nonempty_iff_eq_empty.mp hemp] at hX + obtain ⟨y⟩ := (inferInstance : Nonempty R) + exact ⟨⟨y, by simp [hX]⟩⟩ + obtain ⟨y⟩ := hne + exact Subtype.connectedSpace ⟨⟨y.1, y.2⟩, hprec⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14l.lean b/LeanPool/GraphMinor/GM19/Section14l.lean new file mode 100644 index 0000000000..c44ce13ddb --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14l.lean @@ -0,0 +1,173 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14j + +/-! +# Graph Minors XIX, Section 14: levels of a sector + +Two spokes that meet have the same length, and (13.7) gives disjoint paths in the sector between the +vertices of `Γ` at the same +position on them. This is the "paths given by 13.6" of the proof of (14.1): the paper's +cross-reference is to (13.7). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +universe w + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} {D : TangleDatum cap χ} {W Δ Δ' : Set Shat} + {H C : Drawing Shat} {ρ : ℕ} + {r v₁ v₂ h₁ h₂ : Shat} {f₁ f₂ : Set Shat} + +theorem GraphWalk.support_mem_V {T : Type} [TopologicalSpace T] {G : Drawing T} {a b : T} + (K : GraphWalk G.toGraph a b) {z : T} (hz : z ∈ K.support) : z ∈ G.V := by + induction K with + | nil h => + obtain rfl : z = _ := by simpa [GraphWalk.support] using hz + exact h + | cons hl t ih => + rw [GraphWalk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · exact hl.2.1 + · exact ih hz + +namespace TangleDatum + +/-- Two points of `Σ̂` are joined by a walk of `sk(Γ)` in `X`. -/ +def SkJoined (D : TangleDatum cap χ) (X : Set Shat) : Shat → Shat → Prop := + Relation.ReflTransGen fun x y ↦ x ∈ X ∧ y ∈ X ∧ ∃ a b, cap.emb a = x ∧ cap.emb b = y + ∧ D.P.Γ.skAdj.Adj a b + +omit [T2Space S] [T2Space Shat] in +theorem SkJoined.mono {X Y : Set Shat} (h : X ⊆ Y) {x y : Shat} (hj : D.SkJoined X x y) : + D.SkJoined Y x y := + Relation.ReflTransGen.mono (r := fun x y ↦ x ∈ X ∧ y ∈ X ∧ ∃ a b, cap.emb a = x ∧ cap.emb b = y + ∧ D.P.Γ.skAdj.Adj a b) (fun _ _ h' ↦ ⟨h h'.1, h h'.2.1, h'.2.2⟩) _ _ hj + +omit [T2Space S] [T2Space Shat] in +theorem skJoined_of_walk {Sk : Drawing Shat} {G : Drawing Δ} (hG : D.IsSkPart Δ Sk G) {a b : Δ} + (K : GraphWalk G.toGraph a b) {X : Set Shat} + (hX : ∀ z ∈ K.support, z.1 ∈ X) : ∀ z ∈ K.support, D.SkJoined X a.1 z.1 := by + induction K with + | nil h => + intro z hz + obtain rfl : z = _ := by simpa [GraphWalk.support] using hz + exact Relation.ReflTransGen.refl + | @cons u v w e hl t ih => + intro z hz + rw [GraphWalk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · exact Relation.ReflTransGen.refl + · have hs : v.1 ∈ X := hX _ (by + rw [GraphWalk.support_cons] + exact List.mem_cons_of_mem _ t.start_mem_support) + have hrest := ih (fun z hz ↦ hX z (by + rw [GraphWalk.support_cons] + exact List.mem_cons_of_mem _ hz)) z hz + rcases hG.link _ _ _ hl with e' | ⟨p, q, hp, hq, hadj⟩ + · rw [e'] + exact hrest + · exact Relation.ReflTransGen.head + ⟨hX _ (by rw [GraphWalk.support_cons]; exact List.mem_cons_self), hs, p, q, hp, hq, hadj⟩ + hrest + +omit [T2Space Shat] in +/-- The vertices of `Γ` on a spoke are those at even position. -/ +theorem IsSpokeWalk.even_hatV {K : GraphWalk D.rad.G.toGraph v₁ h₁} (hv : v₁ ∈ D.P.Γ.hatV cap) {p : + ℕ} (hp : p ≤ K.length) : + GraphWalk.vertexAt K p ∈ D.P.Γ.hatV cap ↔ Even p := by + obtain ⟨P, Q, -, hl⟩ := GraphWalk.exists_split_at K hp + have h := D.even_length_walk P + rw [hl] at h + rw [h] + exact ⟨fun h' ↦ ⟨fun _ ↦ h', fun _ ↦ hv⟩, fun h' ↦ h'.mp hv⟩ + +/-- **The paths of (13.7), for a sector.** -/ +theorem IsFullSector.levels {K₁ : GraphWalk D.rad.G.toGraph v₁ h₁} {K₂ : GraphWalk D.rad.G.toGraph + v₂ h₂} {Z : GraphWalk D.rad.G.toGraph v₁ v₂} + (hs : D.IsFullSector W H r f₁ f₂ K₁ K₂ Z Δ Δ' C) (hopt : D.IsOptimalWheelHub W H ρ) + (hbdS : discBd W ⊆ cap.emb '' (univ \ bd S)) + (hin : ((W \ discBd W) ∩ (cap.emb '' D.Γ.V)).Nonempty) (h1 : D.IsSpokeWalk W H K₁) + (h2 : D.IsSpokeWalk W H K₂) (hv₁ : v₁ ∈ D.P.Γ.hatV cap) + (hx : ∃ x ∈ K₁.support, x ∈ K₂.support) : + K₁.length = K₂.length ∧ ∃ P : ℕ → Set Shat, (∀ j k, 2 * j ≤ K₁.length → 2 * k ≤ K₁.length + → j ≠ k → Disjoint (P j) (P k)) ∧ + ∀ j, 2 * j ≤ K₁.length → GraphWalk.vertexAt K₁ (2 * j) ∈ P j ∧ GraphWalk.vertexAt K₂ + (2 * j) ∈ P j ∧ P j ⊆ D.P.Γ.hatV cap ∧ (∀ y ∈ P j, D.SkJoined (P j) (GraphWalk.vertexAt K₁ + (2 * j)) y) ∧ + ((GraphWalk.vertexAt K₁ (2 * j) = GraphWalk.vertexAt K₂ (2 * j) ∧ P j + = {GraphWalk.vertexAt K₁ (2 * j)}) ∨ + (GraphWalk.vertexAt K₁ (2 * j) ∉ K₂.support ∧ GraphWalk.vertexAt K₂ (2 * j) ∉ K₁.support + ∧ P j ⊆ Δ)) := by + classical + obtain ⟨u, A₁, A₂, T₁, T₂, hK₁, hK₂, hT, hmeet, hZU⟩ := hs.Z_fan hx + obtain rfl : h₁ = h₂ := h1.same_end h2 hx.choose_spec.1 hx.choose_spec.2 + obtain rfl : T₁ = T₂ := eq_of_heq hT + subst hK₁ hK₂ + have hW := hopt.toIsWheelHubOfRadius + have hfan : D.IsFan W H ρ r f₁ f₂ A₁ A₂ T₁ := ⟨hW, hbdS, hin, hs.r_mem.1, hs.r_mem.2, hs.ne, + hs.link₁, hs.link₂, h1, h2, hmeet⟩ + obtain ⟨C', hC'⟩ := hfan.exists_circuit + have hbd' : C'.U = discBd Δ := by + rw [hs.bd_eq, hfan.U_eq hC', hZU] + ext x + simp only [mem_union] + tauto + have hb : D.IsBoundarySector W H r Δ C' := { hs.boundary with Dv_circuit := hC'.circuit, Dv_U + := hbd' } + have hlen := hfan.length_eq + have hlen' : (A₁.append T₁).length = (A₂.append T₁).length := by + rw [GraphWalk.length_append, GraphWalk.length_append, hlen] + obtain ⟨Sk, G, hG, P, hdis, hP⟩ := hfan.theorem_13_7_proof hopt hbdS hin hC' hb + set x₁ := fun j ↦ GraphWalk.vertexAt (A₁.append T₁) (2 * j) with hx₁def + set x₂ := fun j ↦ GraphWalk.vertexAt (A₂.append T₁) (2 * j) with hx₂def + have hone : ∀ j, ∃ Q : Set Shat, 2 * j ≤ (A₁.append T₁).length → Q ⊆ P j ∧ x₁ j ∈ Q ∧ x₂ j ∈ Q + ∧ Q ⊆ D.P.Γ.hatV cap ∧ (∀ y ∈ Q, D.SkJoined Q (x₁ j) y) ∧ + ((x₁ j = x₂ j ∧ Q = {x₁ j}) ∨ (x₁ j ∉ (A₂.append T₁).support ∧ x₂ j ∉ (A₁.append T₁).support + ∧ Q ⊆ Δ)) := fun j ↦ by + by_cases hj : 2 * j ≤ (A₁.append T₁).length + · have hh₁ : x₁ j ∈ D.P.Γ.hatV cap := (IsSpokeWalk.even_hatV (K := A₁.append T₁) hv₁ hj).mpr + (even_two_mul _) + rcases hP j hj with ⟨e, -, -, hPj⟩ | ⟨n₁, n₂, hsub, a, b, ha, hb', K, -, hK⟩ + · refine ⟨{x₁ j}, fun _ ↦ ⟨singleton_subset_iff.mpr (by rw [hPj]; exact rfl), + rfl, e.symm, singleton_subset_iff.mpr hh₁, ?_, .inl ⟨e, rfl⟩⟩⟩ + rintro y rfl + exact Relation.ReflTransGen.refl + · have hG' : ∀ z : Δ, z ∈ G.V ↔ z.1 ∈ D.P.Γ.hatV cap := hG.mem_V + refine ⟨{y | ∃ z ∈ K.support, z.1 = y}, fun _ ↦ ⟨?_, ⟨a, K.start_mem_support, ha⟩, ⟨b, + K.end_mem_support, hb'⟩, ?_, ?_, .inr ⟨n₁, n₂, ?_⟩⟩⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact hK z hz + · rintro _ ⟨z, hz, rfl⟩ + exact (hG' z).mp (GraphWalk.support_mem_V K hz) + · rintro _ ⟨z, hz, rfl⟩ + have := skJoined_of_walk hG K (X := {y | ∃ z ∈ K.support, z.1 = y}) + (fun z hz ↦ ⟨z, hz, rfl⟩) z hz + rw [ha] at this + exact this + · rintro _ ⟨z, hz, rfl⟩ + exact hsub (hK z hz) + · exact ⟨∅, fun h' ↦ absurd h' hj⟩ + choose Q hQ using hone + refine ⟨hlen', Q, fun j k hj hk hne ↦ (hdis j k hj hk hne).mono (hQ j hj).1 (hQ k hk).1, + fun j hj ↦ ?_⟩ + obtain ⟨-, h₁, h₂, h₃, h₄, h₅⟩ := hQ j hj + exact ⟨h₁, h₂, h₃, h₄, h₅⟩ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14m.lean b/LeanPool/GraphMinor/GM19/Section14m.lean new file mode 100644 index 0000000000..833e8e98fc --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14m.lean @@ -0,0 +1,229 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14l + +/-! +# Graph Minors XIX, Section 14: the vertices of `Γ` on the spokes of a wheel + +We read the vertices of `Γ` on a spoke as levels `0, 1, ...`, and we record how the paths of (13.7) +sit on the levels. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +universe w + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} {D : TangleDatum cap χ} {W : Set Shat} {H : + Drawing Shat} {ρ : ℕ} + +namespace TangleDatum + +/-- Two spokes with the same inner end from vertices of `Γ` have the same length. -/ +theorem spoke_length_eq (hW : D.IsWheelHubOfRadius W H ρ) {v₁ v₂ h : Shat} {K₁ : GraphWalk + D.rad.G.toGraph v₁ h} {K₂ : GraphWalk D.rad.G.toGraph v₂ h} + (hv₁ : v₁ ∈ D.P.Γ.hatV cap) (hv₂ : v₂ ∈ D.P.Γ.hatV cap) (h1 : D.IsSpokeWalk W H K₁) + (h2 : D.IsSpokeWalk W H K₂) : K₁.length = K₂.length := by + have e₁ := D.even_length_walk K₁ + have e₂ := D.even_length_walk K₂ + have l₁ := hW.spoke_length h1 + have l₂ := hW.spoke_length h2 + have hpar : Even K₁.length ↔ Even K₂.length := by + rw [e₁, e₂] + exact ⟨fun h' ↦ ⟨fun _ ↦ h'.mp hv₁, fun _ ↦ hv₂⟩, fun h' ↦ ⟨fun _ ↦ h'.mp hv₂, fun _ ↦ hv₁⟩⟩ + rw [Nat.even_iff, Nat.even_iff] at hpar + omega + +/-- A vertex that is on two spokes has the same position on both. -/ +theorem spoke_pos_eq (hW : D.IsWheelHubOfRadius W H ρ) {v₁ v₂ h₁ h₂ : Shat} {K₁ : GraphWalk + D.rad.G.toGraph v₁ h₁} {K₂ : GraphWalk D.rad.G.toGraph v₂ h₂} + (hv₁ : v₁ ∈ D.P.Γ.hatV cap) (hv₂ : v₂ ∈ D.P.Γ.hatV cap) (h1 : D.IsSpokeWalk W H K₁) + (h2 : D.IsSpokeWalk W H K₂) {p q : ℕ} (hp : p ≤ K₁.length) (hq : q ≤ K₂.length) + (e : GraphWalk.vertexAt K₁ p = GraphWalk.vertexAt K₂ q) : p = q := by + have hx₁ := GraphWalk.vertexAt_mem K₁ hp + have hx₂ := GraphWalk.vertexAt_mem K₂ hq + rw [← e] at hx₂ + obtain rfl := h1.same_end h2 hx₁ hx₂ + have hlen := spoke_length_eq hW hv₁ hv₂ h1 h2 + obtain ⟨u, A₁, A₂, T, hK₁, hK₂, hxT, -⟩ := h1.merge h2 hx₁ hx₂ + subst hK₁ hK₂ + obtain ⟨s, hs, hsx⟩ := GraphWalk.exists_vertexAt T hxT + simp only [GraphWalk.length_append] at hlen hp hq + have hp' := GraphWalk.vertexAt_append_right A₁ T hs + have hq' := GraphWalk.vertexAt_append_right A₂ T hs + have i₁ := GraphWalk.vertexAt_inj _ h1.1 (p := p) (q := A₁.length + s) + (by simp only [GraphWalk.length_append]; omega) (by simp only [GraphWalk.length_append]; omega) + (by rw [hp', hsx]) + have i₂ := GraphWalk.vertexAt_inj _ h2.1 (p := q) (q := A₂.length + s) + (by simp only [GraphWalk.length_append]; omega) (by simp only [GraphWalk.length_append]; omega) + (by rw [hq']; exact e.symm.trans hsx) + omega + +namespace WheelFrame + +variable (fr : WheelFrame D W) + +/-- The vertex at level `t` of the spoke at the `i`th vertex of the rim. -/ +noncomputable def levV (i t : ℕ) : Shat := GraphWalk.vertexAt (fr.R.spoke fr.sp i) (2 * t) + +/-- The top level of the spoke at the `i`th vertex of the rim. -/ +noncomputable def top (i : ℕ) : ℕ := (fr.R.spoke fr.sp i).length / 2 + +theorem vert_hatV (i : ℕ) : fr.R.vert i ∈ D.P.Γ.hatV cap := (fr.R.vert_mem i).1 + +theorem levV_support {i t : ℕ} (ht : t ≤ fr.top i) : fr.levV i t ∈ (fr.R.spoke fr.sp i).support := + GraphWalk.vertexAt_mem _ (by rw [top] at ht; omega) + +theorem levV_hatV {i t : ℕ} (ht : t ≤ fr.top i) : fr.levV i t ∈ D.P.Γ.hatV cap := + (IsSpokeWalk.even_hatV (fr.vert_hatV i) (by rw [top] at ht; omega)).mpr (even_two_mul _) + +theorem levV_zero (i : ℕ) : fr.levV i 0 = fr.R.vert i := GraphWalk.vertexAt_zero _ + +theorem exists_levV {i : ℕ} {y : Shat} (hy : y ∈ (fr.R.spoke fr.sp i).support) + (hV : y ∈ D.P.Γ.hatV cap) : ∃ t ≤ fr.top i, y = fr.levV i t := by + obtain ⟨p, hp, rfl⟩ := GraphWalk.exists_vertexAt _ hy + obtain ⟨t, rfl⟩ := (IsSpokeWalk.even_hatV (fr.vert_hatV i) hp).mp hV + exact ⟨t, by rw [top]; omega, by rw [levV, two_mul]⟩ + +/-- A vertex on two spokes is at the same level on both. -/ +theorem level_eq {i j t t' : ℕ} (ht : t ≤ fr.top i) (ht' : t' ≤ fr.top j) (e : fr.levV i t + = fr.levV j t') : t = t' := by + have := spoke_pos_eq fr.hW (fr.vert_hatV i) (fr.vert_hatV j) (fr.spoke_spoke i) + (fr.spoke_spoke j) (p := 2 * t) (q := 2 * t') + (by rw [top] at ht; omega) (by rw [top] at ht'; omega) e + omega + +/-- The levels of one spoke are distinct. -/ +theorem levV_inj {i t t' : ℕ} (ht : t ≤ fr.top i) (ht' : t' ≤ fr.top i) (e : fr.levV i t + = fr.levV i t') : t = t' := fr.level_eq ht ht' e + +/-- The two spokes of a sector end at the same vertex. -/ +def Reg (i : ℕ) : Prop := fr.R.inner fr.sp i = fr.R.inner fr.sp (i + 1) + +theorem top_eq_of_inner {i j : ℕ} (h : fr.R.inner fr.sp i = fr.R.inner fr.sp j) : fr.top i + = fr.top j := by + have key : ∀ {v₁ v₂ h₁ h₂ : Shat} (K₁ : GraphWalk D.rad.G.toGraph v₁ h₁) + (K₂ : GraphWalk D.rad.G.toGraph v₂ h₂), h₁ = h₂ → v₁ ∈ D.P.Γ.hatV cap → v₂ ∈ D.P.Γ.hatV cap → + D.IsSpokeWalk W fr.H K₁ → D.IsSpokeWalk W fr.H K₂ → K₁.length = K₂.length := by + rintro v₁ v₂ h₁ h₂ K₁ K₂ rfl h₃ h₄ h₅ h₆ + exact spoke_length_eq fr.hW h₃ h₄ h₅ h₆ + exact congrArg (· / 2) (key _ _ h (fr.vert_hatV i) (fr.vert_hatV j) (fr.spoke_spoke i) + (fr.spoke_spoke j)) + +/-- The paths of (13.7) in the sector `i`, one for each level. -/ +structure IsPaths (i : ℕ) (P : ℕ → Set Shat) : Prop where + disj : ∀ j k, j ≤ fr.top i → k ≤ fr.top i → j ≠ k → Disjoint (P j) (P k) + left : ∀ j ≤ fr.top i, fr.levV i j ∈ P j + right : ∀ j ≤ fr.top i, fr.levV (i + 1) j ∈ P j + hat : ∀ j ≤ fr.top i, P j ⊆ D.P.Γ.hatV cap + joined : ∀ j ≤ fr.top i, ∀ y ∈ P j, D.SkJoined (P j) (fr.levV i j) y + cases : ∀ j ≤ fr.top i, (fr.levV i j = fr.levV (i + 1) j ∧ P j = {fr.levV i j}) ∨ + (fr.levV i j ∉ (fr.R.spoke fr.sp (i + 1)).support ∧ fr.levV (i + 1) j ∉ + (fr.R.spoke fr.sp i).support ∧ P j ⊆ (fr.sec i).Δ) + +theorem exists_paths {i : ℕ} (hr : fr.Reg i) : ∃ P, fr.IsPaths i P := by + have hmeet : ∃ x ∈ (fr.R.spoke fr.sp i).support, x ∈ (fr.R.spoke fr.sp (i + 1)).support := + ⟨fr.R.inner fr.sp i, GraphWalk.end_mem_support _, by + have h := (fr.R.spoke fr.sp (i + 1)).end_mem_support + rw [show fr.R.inner fr.sp i = fr.R.inner fr.sp (i + 1) from hr] + exact h⟩ + obtain ⟨hl, P, hd, hP⟩ := (fr.sec i).full.levels fr.hopt fr.hbdS fr.hin (fr.spoke_spoke i) + (fr.spoke_spoke (i + 1)) (fr.vert_hatV i) hmeet + have hle : ∀ j, j ≤ fr.top i → 2 * j ≤ (fr.R.spoke fr.sp i).length := fun j hj ↦ by + rw [top] at hj + omega + exact ⟨P, fun j k hj hk ↦ hd j k (hle j hj) (hle k hk), fun j hj ↦ (hP j (hle j hj)).1, + fun j hj ↦ (hP j (hle j hj)).2.1, fun j hj ↦ (hP j (hle j hj)).2.2.1, + fun j hj ↦ (hP j (hle j hj)).2.2.2.1, fun j hj ↦ (hP j (hle j hj)).2.2.2.2⟩ + +open Classical in +/-- The vertex sets of the paths of (13.7) in the sector `i`. -/ +noncomputable def path (i : ℕ) : ℕ → Set Shat := if h : fr.Reg i then + (fr.exists_paths h).choose else fun _ ↦ ∅ + +theorem path_spec {i : ℕ} (hr : fr.Reg i) : fr.IsPaths i (fr.path i) := by + rw [path, dite_eq_left hr] + exact (fr.exists_paths hr).choose_spec + +/-- A vertex of `Γ` on the boundary of a sector is on one of its two spokes or on the hub. -/ +theorem bd_sector {i : ℕ} {y : Shat} (hV : y ∈ D.P.Γ.hatV cap) (hy : y ∈ discBd (fr.sec i).Δ) : + y ∈ (fr.R.spoke fr.sp i).support ∨ y ∈ (fr.R.spoke fr.sp (i + 1)).support ∨ y ∈ fr.H.U := by + have hG : y ∈ D.rad.G.V := D.rad.isPreRadial.2.1 hV + have hfull := (fr.sec i).full + rw [hfull.bd_eq] at hy + rcases hy with (hy | hy) | hy + · exact .inl ((hat_on_edge hfull.r_mem.1 hfull.link₁ hy hV) ▸ (fr.R.spoke fr.sp + i).start_mem_support) + · exact .inr (.inl ((hat_on_edge hfull.r_mem.1 hfull.link₂ hy hV) ▸ (fr.R.spoke fr.sp + (i + 1)).start_mem_support)) + · rcases hfull.Z_sub hy with (h' | h') | h' + · exact .inl (support_of_mem_U _ h' hG) + · exact .inr (.inl (support_of_mem_U _ h' hG)) + · exact .inr (.inr h') + +/-- For a sector with spokes that meet, the hub is not needed. -/ +theorem bd_sector_reg {i : ℕ} (hr : fr.Reg i) {y : Shat} (hV : y ∈ D.P.Γ.hatV cap) (hy : y ∈ discBd + (fr.sec i).Δ) : + y ∈ (fr.R.spoke fr.sp i).support ∨ y ∈ (fr.R.spoke fr.sp (i + 1)).support := by + have hG : y ∈ D.rad.G.V := D.rad.isPreRadial.2.1 hV + have hfull := (fr.sec i).full + rw [hfull.bd_eq] at hy + rcases hy with (hy | hy) | hy + · exact .inl ((hat_on_edge hfull.r_mem.1 hfull.link₁ hy hV) ▸ (fr.R.spoke fr.sp + i).start_mem_support) + · exact .inr ((hat_on_edge hfull.r_mem.1 hfull.link₂ hy hV) ▸ (fr.R.spoke fr.sp + (i + 1)).start_mem_support) + · rcases hfull.Z_same hr hy with h' | h' + · exact .inl (support_of_mem_U _ h' hG) + · exact .inr (support_of_mem_U _ h' hG) + +/-- A vertex of a path of (13.7) is an end of the path, or it is off all the spokes, inside the +sector. -/ +theorem path_cases {i j : ℕ} (hr : fr.Reg i) (hj : j ≤ fr.top i) {y : Shat} + (hy : y ∈ fr.path i j) : y = fr.levV i j ∨ y = fr.levV (i + 1) j ∨ y ∈ discInt (fr.sec i).Δ := by + have hP := fr.path_spec hr + have hV := hP.hat j hj hy + have ht : fr.top (i + 1) = fr.top i := (fr.top_eq_of_inner hr).symm + rcases hP.cases j hj with ⟨-, hs⟩ | ⟨-, -, hsub⟩ + · rw [hs] at hy + exact .inl hy + · by_cases hb : y ∈ discBd (fr.sec i).Δ + · have hlev : ∃ t ≤ fr.top i, y ∈ fr.path i t ∧ (y = fr.levV i t ∨ y = fr.levV (i + 1) t) := by + rcases fr.bd_sector_reg hr hV hb with h' | h' + · obtain ⟨t, ht', rfl⟩ := fr.exists_levV h' hV + exact ⟨t, ht', hP.left t ht', .inl rfl⟩ + · obtain ⟨t, ht', rfl⟩ := fr.exists_levV h' hV + exact ⟨t, ht ▸ ht', hP.right t (ht ▸ ht'), .inr rfl⟩ + obtain ⟨t, ht', hyt, ho⟩ := hlev + obtain rfl : t = j := by + by_contra hne + exact disjoint_left.mp (hP.disj t j ht' hj hne) hyt hy + exact ho.imp id .inl + · exact .inr (.inr ⟨hsub hy, hb⟩) + +theorem discInt_off_spoke (i l : ℕ) {y : Shat} (hy : y ∈ discInt (fr.sec i).Δ) : y ∉ + (fr.R.spoke fr.sp l).support := fun h' ↦ + disjoint_left.mp ((fr.sec i).full.spoke_off _ _ _ (fr.spoke_spoke l)) + ((mem_walkDrawing_U _ _).mpr (.inl h')) hy + +theorem discInt_off_hub (i : ℕ) {y : Shat} (hy : y ∈ discInt (fr.sec i).Δ) : y ∉ fr.H.U + := fun h' ↦ disjoint_left.mp (fr.sec i).full.hub_off h' hy + +end WheelFrame + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14n.lean b/LeanPool/GraphMinor/GM19/Section14n.lean new file mode 100644 index 0000000000..6f8f5ed99e --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14n.lean @@ -0,0 +1,489 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14m + +/-! +# Graph Minors XIX, Section 14: a staircase between two wheels + +A linear inflation of the cut paintings sends the rim of a wheel in `Γ_j` to the rim of the same +wheel in `Γ_i`. Each step along the +rim of `Γ_j` either stays at a vertex or moves on one vertex. This is the check that the paper omits +at the end of (14.1): it defines +`σ''` by the `k`th terms of the marches `μ(u)`, and refers to the proof of XX (9.1). We write it +here in full. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +universe w + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} {D Da Db : TangleDatum cap χ} {W Wa Wb : + Set Shat} + +namespace TangleDatum.WheelFrame + +/-- The spoke at a rim position depends only on the rim vertex. -/ +theorem levV_congr (fr : WheelFrame D W) {i j : ℕ} (h : fr.R.vert i = fr.R.vert j) + (t : ℕ) : fr.levV i t = fr.levV j t := by + have key : ∀ (x y : bdVerts D W), x.1 = y.1 → GraphWalk.vertexAt (fr.sp.K x) (2 * t) + = GraphWalk.vertexAt (fr.sp.K y) (2 * t) := by + rintro ⟨x, hx⟩ ⟨y, hy⟩ e + obtain rfl : x = y := e + rfl + exact key _ _ h + +theorem vert_mod (fr : WheelFrame D W) (i : ℕ) : fr.R.vert (i % fr.R.k) = fr.R.vert i := by + rw [TangleDatum.Rim.vert, TangleDatum.Rim.vert, Nat.mod_mod] + +theorem levV_wrap (fr : WheelFrame D W) (t : ℕ) : fr.levV fr.R.k t = fr.levV 0 t := + fr.levV_congr (by simpa using fr.R.vert_add_k 0) t + +theorem top_congr (fr : WheelFrame D W) {i j : ℕ} (h : fr.R.vert i = fr.R.vert j) : fr.top i + = fr.top j := by + have key : ∀ (x y : bdVerts D W), x.1 = y.1 → (fr.sp.K x).length / 2 = (fr.sp.K y).length / 2 + := by + rintro ⟨x, hx⟩ ⟨y, hy⟩ e + obtain rfl : x = y := e + rfl + exact key _ _ h + +/-- All the spokes through a vertex at level `t`, along an arc of the rim. -/ +theorem arc_level (fr : WheelFrame D W) {i j t : ℕ} (hij : i < j) (hj : j < fr.R.k) (ht : t + ≤ fr.top i) (ht' : t ≤ fr.top j) (e : fr.levV i t = fr.levV j t) : + (∀ l, i ≤ l → l ≤ j → t ≤ fr.top l ∧ fr.levV l t = fr.levV i t) ∨ ∀ l < fr.R.k, (l ≤ i ∨ j ≤ l) + → t ≤ fr.top l ∧ fr.levV l t = fr.levV i t := by + have hV := fr.levV_hatV ht + have hsi := fr.levV_support ht + have hsj := fr.levV_support ht' + rw [← e] at hsj + have key : ∀ l, fr.levV i t ∈ (fr.R.spoke fr.sp l).support → t ≤ fr.top l ∧ fr.levV l t + = fr.levV i t := fun l hl ↦ by + obtain ⟨t', ht₂, he⟩ := fr.exists_levV hl hV + obtain rfl := fr.level_eq ht ht₂ he + exact ⟨ht₂, he.symm⟩ + exact (fr.R.arc fr.hW fr.hbdS fr.hin fr.sp hij hj hsi hsj).imp (fun h l h₁ h₂ ↦ key l + (h l h₁ h₂)) fun h l hl h₁ ↦ key l (h l hl h₁) + +theorem path_reg (fr : WheelFrame D W) {i t : ℕ} {y : Shat} (hy : y ∈ fr.path i t) : fr.Reg i := by + classical + by_contra hn + rw [path, dite_eq_right hn] at hy + exact hy + +end TangleDatum.WheelFrame + +open TangleDatum + +/-- **A staircase** from the rim of a wheel of `Γ_j` to the rim of the same wheel of `Γ_i`, with a +pairing `Rt` of the vertices of `Γ_j` and `Γ_i` on the hubs. -/ +structure Stair (a : WheelFrame Da Wa) (b : WheelFrame Db Wb) (θ : ℕ → ℕ) (Rt : Shat → Shat + → Prop) : Prop where + zero : θ 0 = 0 + last : θ (b.R.k - 1) = a.R.k - 1 + step : ∀ q, q + 1 < b.R.k → θ (q + 1) = θ q ∨ θ (q + 1) = θ q + 1 + top_eq : ∀ q < b.R.k, b.top q = a.top (θ q) + stay_reg : ∀ q, q + 1 < b.R.k → θ (q + 1) = θ q → b.Reg q + move_iff : ∀ q, q + 1 < b.R.k → θ (q + 1) = θ q + 1 → ∀ t ≤ b.top q, (b.levV q t = b.levV + (q + 1) t ↔ a.levV (θ q) t = a.levV (θ q + 1) t) + wrap_iff : ∀ t ≤ b.top (b.R.k - 1), (b.levV (b.R.k - 1) t = b.levV 0 t ↔ a.levV (a.R.k - 1) t + = a.levV 0 t) + rt_fun : ∀ {y x x'}, Rt y x → Rt y x' → x = x' + rt_inj : ∀ {y y' x}, Rt y x → Rt y' x → y = y' + rt_hub : ∀ {y x}, Rt y x → (y ∈ b.H.U ∧ y ∈ Db.P.Γ.hatV cap) ∧ x ∈ a.H.U ∧ x ∈ Da.P.Γ.hatV cap + rt_b : ∀ {y}, y ∈ b.H.U → y ∈ Db.P.Γ.hatV cap → ∃ x, Rt y x + rt_a : ∀ {x}, x ∈ a.H.U → x ∈ Da.P.Γ.hatV cap → ∃ y, Rt y x + rt_lev : ∀ {y x}, Rt y x → ∀ q < b.R.k, ∀ t ≤ b.top q, (x = a.levV (θ q) t ↔ y = b.levV q t) + +namespace Stair + +variable {a : WheelFrame Da Wa} {b : WheelFrame Db Wb} {θ : ℕ → ℕ} {Rt : Shat → Shat → Prop} + (h : Stair a b θ Rt) +include h + +theorem mono {q q' : ℕ} (hq : q ≤ q') (hq' : q' < b.R.k) : θ q ≤ θ q' := by + induction q', hq using Nat.le_induction with + | base => exact le_rfl + | succ n hn ih => + have := ih (by omega) + rcases h.step n hq' with e | e <;> omega + +theorem lt {q : ℕ} (hq : q < b.R.k) : θ q < a.R.k := by + have h₁ := h.mono (show q ≤ b.R.k - 1 by omega) (by have := b.R.two; omega) + have h₂ := h.last + have := a.R.two + omega + +theorem surj {p : ℕ} (hp : p < a.R.k) : ∃ q < b.R.k, θ q = p := by + have h2 := b.R.two + by_contra hn + push Not at hn + have hle : ∀ q, q < b.R.k → θ q < p := fun q ↦ by + induction q with + | zero => + intro hq + have := hn 0 hq + rw [h.zero] at this ⊢ + omega + | succ n ih => + intro hq + have h₁ := ih (by omega) + have h₂ := hn _ hq + rcases h.step n hq with e | e <;> omega + have h₁ := hle _ (show b.R.k - 1 < b.R.k by omega) + rw [h.last] at h₁ + omega + +/-- Equal levels on a run of the rim of `Γ_j` give equal levels at the two ends of the image of the +run. -/ +theorem run {q q' t : ℕ} (hq : q ≤ q') (hq' : q' < b.R.k) (hl : ∀ l, q ≤ l → l ≤ q' → t ≤ b.top l + ∧ b.levV l t = b.levV q t) : a.levV (θ q) t = a.levV (θ q') t := by + induction q', hq using Nat.le_induction with + | base => rfl + | succ n hn ih => + have h₁ := ih (by omega) fun l h₁ h₂ ↦ hl l h₁ (by omega) + rw [h₁] + rcases h.step n hq' with e | e + · rw [e] + · rw [e] + have e₁ := (hl n hn (by omega)) + have e₂ := (hl (n + 1) (by omega) le_rfl) + exact (h.move_iff n hq' e t e₁.1).mp (e₁.2.trans e₂.2.symm) + +/-- **Levels pass from `Γ_j` to `Γ_i`.** -/ +theorem transfer {q q' t : ℕ} (hq : q < b.R.k) (hq' : q' < b.R.k) (ht : t ≤ b.top q) (ht' : t + ≤ b.top q') (e : b.levV q t = b.levV q' t) : a.levV (θ q) t = a.levV (θ q') t := by + have main : ∀ {q q' : ℕ}, q < q' → q' < b.R.k → t ≤ b.top q → t ≤ b.top q' → b.levV q t + = b.levV q' t → a.levV (θ q) t = a.levV (θ q') t := by + intro q q' hlt hq' ht ht' e + rcases b.arc_level hlt hq' ht ht' e with hl | hl + · exact h.run hlt.le hq' hl + · have h₁ : a.levV (θ 0) t = a.levV (θ q) t := h.run (Nat.zero_le q) (by omega) fun l _ h₂ ↦ by + have e₁ := hl l (by omega) (.inl h₂) + have e₂ := hl 0 (by omega) (.inl (Nat.zero_le _)) + exact ⟨e₁.1, e₁.2.trans e₂.2.symm⟩ + have h₂ : a.levV (θ q') t = a.levV (θ (b.R.k - 1)) t := + h.run (show q' ≤ b.R.k - 1 by omega) (by omega) fun l h₁ h₂ ↦ by + have e₁ := hl l (by omega) (.inr h₁) + have e₂ := hl q' hq' (.inr le_rfl) + exact ⟨e₁.1, e₁.2.trans e₂.2.symm⟩ + have hl₁ := hl (b.R.k - 1) (by omega) (.inr (by omega)) + have hl₀ := hl 0 (by omega) (.inl (Nat.zero_le _)) + have h₃ := (h.wrap_iff t hl₁.1).mp (hl₁.2.trans hl₀.2.symm) + rw [h.zero] at h₁ + rw [h.last] at h₂ + rw [← h₁, h₂, h₃] + rcases lt_trichotomy q q' with hlt | rfl | hlt + · exact main hlt hq' ht ht' e + · rfl + · exact (main hlt hq ht' ht e.symm).symm + +/-- A step of the rim of `Γ_j` keeps equal levels of `Γ_i` joined, by a path of (13.7) when the step +stays, and by equality when it moves. -/ +theorem wrap_lev {t : ℕ} (ht : t ≤ a.top (a.R.k - 1)) (e : a.levV (a.R.k - 1) t + = a.levV 0 t) : b.levV (b.R.k - 1) t = b.levV 0 t := by + have h2 := b.R.two + have htt : t ≤ b.top (b.R.k - 1) := by + rw [h.top_eq _ (by omega), h.last] + exact ht + exact (h.wrap_iff t htt).mpr e + +end Stair + +omit [T2Space S] [T2Space Shat] in +theorem TangleDatum.SkJoined.symm {X : Set Shat} {x y : Shat} (h : D.SkJoined X x y) : D.SkJoined X + y x := by + induction h with + | refl => exact Relation.ReflTransGen.refl + | tail _ hs ih => + obtain ⟨h₁, h₂, p, q, hp, hq, hadj⟩ := hs + exact Relation.ReflTransGen.head ⟨h₂, h₁, q, p, hq, hp, hadj.symm⟩ ih + +omit [T2Space S] [T2Space Shat] in +theorem TangleDatum.SkJoined.trans {X : Set Shat} {x y z : Shat} (h : D.SkJoined X x y) + (h' : D.SkJoined X y z) : D.SkJoined X x z := Relation.ReflTransGen.trans h h' + +/-- `y` is at the same level as `x`, under the staircase. -/ +def Stair.Lev (a : WheelFrame Da Wa) (b : WheelFrame Db Wb) (θ : ℕ → ℕ) (y x : Shat) : Prop := + ∃ q < b.R.k, ∃ t ≤ b.top q, y = b.levV q t ∧ x = a.levV (θ q) t + +/-- `y` lies on a path of (13.7) of a step that stays at the rim vertex below `x`. -/ +def Stair.OnPath (a : WheelFrame Da Wa) (b : WheelFrame Db Wb) (θ : ℕ → ℕ) (y x : Shat) : Prop := + ∃ q t, q + 1 < b.R.k ∧ θ (q + 1) = θ q ∧ t ≤ b.top q ∧ y ∈ b.path q t ∧ x = a.levV (θ q) t + +/-- The set `σ(x)` in the wheel: `y` is sent back to `x`. -/ +def Stair.Back (a : WheelFrame Da Wa) (b : WheelFrame Db Wb) (θ : ℕ → ℕ) (Rt : Shat → Shat → Prop) + (y x : Shat) : Prop := + Stair.Lev a b θ y x ∨ Rt y x ∨ Stair.OnPath a b θ y x + +namespace Stair + +variable {a : WheelFrame Da Wa} {b : WheelFrame Db Wb} {θ : ℕ → ℕ} {Rt : Shat → Shat → Prop} + (h : Stair a b θ Rt) +include h + +theorem onPath_cases {y x : Shat} (hp : OnPath a b θ y x) : Lev a b θ y x ∨ ∃ q t, q < b.R.k ∧ t + ≤ b.top q ∧ y ∈ b.path q t ∧ y ∈ discInt (b.sec q).Δ ∧ x = a.levV (θ q) t := by + obtain ⟨q, t, hq, hs, ht, hy, rfl⟩ := hp + have hr := h.stay_reg q hq hs + rcases b.path_cases hr ht hy with e | e | e + · exact .inl ⟨q, by omega, t, ht, e, rfl⟩ + · refine .inl ⟨q + 1, hq, t, ?_, e, by rw [hs]⟩ + rw [← b.top_eq_of_inner hr] + exact ht + · exact .inr ⟨q, t, by omega, ht, hy, e, rfl⟩ + +theorem onPath_stay {y x : Shat} (hp : OnPath a b θ y x) : Lev a b θ y x ∨ ∃ q, q + 1 < b.R.k ∧ θ + (q + 1) = θ q ∧ y ∈ discInt (b.sec q).Δ := by + obtain ⟨q, t, hq, hs, ht, hy, rfl⟩ := hp + have hr := h.stay_reg q hq hs + rcases b.path_cases hr ht hy with e | e | e + · exact .inl ⟨q, by omega, t, ht, e, rfl⟩ + · refine .inl ⟨q + 1, hq, t, ?_, e, by rw [hs]⟩ + rw [← b.top_eq_of_inner hr] + exact ht + · exact .inr ⟨q, hq, hs, e⟩ + +theorem lev_fun {y x x' : Shat} (h₁ : Lev a b θ y x) (h₂ : Lev a b θ y x') : x = x' := by + obtain ⟨q, hq, t, ht, rfl, rfl⟩ := h₁ + obtain ⟨q', hq', t', ht', e, rfl⟩ := h₂ + obtain rfl := b.level_eq ht ht' e + exact h.transfer hq hq' ht ht' e + +theorem lev_rt {y x x' : Shat} (h₁ : Lev a b θ y x) (h₂ : Rt y x') : x = x' := by + obtain ⟨q, hq, t, ht, rfl, rfl⟩ := h₁ + exact ((h.rt_lev h₂ q hq t ht).mpr rfl).symm + +/-- `σ` of two vertices are disjoint. -/ +theorem back_fun {y x x' : Shat} (h₁ : Back a b θ Rt y x) (h₂ : Back a b θ Rt y x') : x = x' := by + have hoff : ∀ {x₁ x₂ : Shat} {q : ℕ}, Lev a b θ y x₁ → y ∈ discInt (b.sec q).Δ → x₁ = x₂ + := fun {x₁ x₂ q} hl hi ↦ by + obtain ⟨q', hq', t', ht', rfl, -⟩ := hl + exact absurd (b.levV_support ht') (b.discInt_off_spoke q q' hi) + have hoffR : ∀ {x₁ x₂ : Shat} {q : ℕ}, Rt y x₁ → y ∈ discInt (b.sec q).Δ → x₁ = x₂ + := fun {x₁ x₂ q} hl hi ↦ absurd (h.rt_hub hl).1.1 (b.discInt_off_hub q hi) + have hsorted : Lev a b θ y x ∨ Rt y x ∨ ∃ q t, q < b.R.k ∧ t ≤ b.top q ∧ y ∈ b.path q t + ∧ y ∈ discInt (b.sec q).Δ ∧ x = a.levV (θ q) t := by + rcases h₁ with h' | h' | h' + · exact .inl h' + · exact .inr (.inl h') + · rcases h.onPath_cases h' with h'' | h'' + · exact .inl h'' + · exact .inr (.inr h'') + have hsorted' : Lev a b θ y x' ∨ Rt y x' ∨ ∃ q t, q < b.R.k ∧ t ≤ b.top q ∧ y ∈ b.path q t + ∧ y ∈ discInt (b.sec q).Δ ∧ x' = a.levV (θ q) t := by + rcases h₂ with h' | h' | h' + · exact .inl h' + · exact .inr (.inl h') + · rcases h.onPath_cases h' with h'' | h'' + · exact .inl h'' + · exact .inr (.inr h'') + rcases hsorted with h₃ | h₃ | ⟨q, t, hq, ht, hy, hi, rfl⟩ <;> + rcases hsorted' with h₄ | h₄ | ⟨q', t', hq', ht', hy', hi', rfl⟩ + · exact h.lev_fun h₃ h₄ + · exact h.lev_rt h₃ h₄ + · exact hoff h₃ hi' + · exact (h.lev_rt h₄ h₃).symm + · exact h.rt_fun h₃ h₄ + · exact hoffR h₃ hi' + · exact (hoff h₄ hi).symm + · exact (hoffR h₄ hi).symm + · obtain rfl : q = q' := by + by_contra hne + refine disjoint_left.mp (b.disjoint_int (i := q) (j := q') fun e ↦ hne ?_) hi hi' + exact b.R.reg_inj hq hq' e + obtain rfl : t = t' := by + by_contra hne + exact disjoint_left.mp ((b.path_spec (b.path_reg hy)).disj t t' ht ht' hne) hy hy' + rfl + +/-- Consecutive equal levels of `Γ_i` are joined in `σ(x)`. -/ +theorem join_step {x : Shat} {l t : ℕ} (hl : l + 1 < b.R.k) (ht : t ≤ b.top l) + (h₁ : a.levV (θ l) t = x) (h₂ : a.levV (θ (l + 1)) t = x) : + Db.SkJoined {y | Back a b θ Rt y x} (b.levV l t) (b.levV (l + 1) t) := by + rcases h.step l hl with e | e + · have hr := h.stay_reg l hl e + have hP := b.path_spec hr + have hsub : b.path l t ⊆ {y | Back a b θ Rt y x} := fun y hy ↦ .inr + (.inr ⟨l, t, hl, e, ht, hy, h₁.symm⟩) + exact TangleDatum.SkJoined.mono hsub (hP.joined t ht _ (hP.right t ht)) + · rw [(h.move_iff l hl e t ht).mpr (by rw [h₁, ← e, h₂])] + exact Relation.ReflTransGen.refl + +theorem join_run {x : Shat} {q q' t : ℕ} (hq : q ≤ q') (hq' : q' < b.R.k) (hl : ∀ l, q ≤ l → l ≤ q' + → t ≤ a.top (θ l) ∧ a.levV (θ l) t = x) : + Db.SkJoined {y | Back a b θ Rt y x} (b.levV q t) (b.levV q' t) := by + induction q', hq using Nat.le_induction with + | base => exact Relation.ReflTransGen.refl + | succ n hn ih => + have h₁ := ih (by omega) fun l h₁ h₂ ↦ hl l h₁ (by omega) + have e₁ := hl n hn (by omega) + have e₂ := hl (n + 1) (by omega) le_rfl + exact TangleDatum.SkJoined.trans h₁ + (h.join_step hq' (by rw [h.top_eq _ (by omega)]; exact e₁.1) e₁.2 e₂.2) + +theorem lev_top {q t : ℕ} (hq : q < b.R.k) (ht : t ≤ b.top q) : t ≤ a.top (θ q) := by + rw [← h.top_eq q hq] + exact ht + +/-- **`σ(x)` is connected: the levels.** -/ +theorem join_lev {x : Shat} {q q' t t' : ℕ} (hq : q < b.R.k) (hq' : q' < b.R.k) (ht : t ≤ b.top q) + (ht' : t' ≤ b.top q') (h₁ : x = a.levV (θ q) t) (h₂ : x = a.levV (θ q') t') : + Db.SkJoined {y | Back a b θ Rt y x} (b.levV q t) (b.levV q' t') := by + obtain rfl : t = t' := a.level_eq (h.lev_top hq ht) (h.lev_top hq' ht') (h₁.symm.trans h₂) + have main : ∀ {q q' : ℕ}, q < q' → q' < b.R.k → t ≤ b.top q → t ≤ b.top q' → x = a.levV (θ q) t + → x = a.levV (θ q') t → Db.SkJoined {y | Back a b θ Rt y x} (b.levV q t) (b.levV q' t) := by + intro q q' hlt hq' ht ht' h₁ h₂ + have hat := h.lev_top (by omega) ht + have hat' := h.lev_top hq' ht' + rcases (h.mono hlt.le hq').lt_or_eq with hθ | hθ + · rcases a.arc_level hθ (h.lt hq') hat hat' (h₁.symm.trans h₂) with hl | hl + · refine h.join_run hlt.le hq' fun l h₃ h₄ ↦ ?_ + have := hl (θ l) (h.mono h₃ (by omega)) (h.mono h₄ hq') + exact ⟨this.1, this.2.trans h₁.symm⟩ + · have h₃ : Db.SkJoined {y | Back a b θ Rt y x} (b.levV 0 t) (b.levV q t) := h.join_run + (Nat.zero_le q) (by omega) fun l _ h₄ ↦ by + have := hl (θ l) (h.lt (by omega)) (.inl (h.mono h₄ (by omega))) + exact ⟨this.1, this.2.trans h₁.symm⟩ + have h₄ : Db.SkJoined {y | Back a b θ Rt y x} (b.levV q' t) (b.levV (b.R.k - 1) t) := + h.join_run (show q' ≤ b.R.k - 1 by omega) (by omega) fun l h₄ h₅ ↦ by + have := hl (θ l) (h.lt (by omega)) (.inr (h.mono h₄ (by omega))) + exact ⟨this.1, this.2.trans h₁.symm⟩ + have e₀ := hl (θ 0) (h.lt (by omega)) (.inl (h.mono (Nat.zero_le q) (by omega))) + have e₁ := hl (θ (b.R.k - 1)) (h.lt (by omega)) + (.inr (h.mono (show q' ≤ b.R.k - 1 by omega) (by omega))) + rw [h.zero] at e₀ + rw [h.last] at e₁ + have e₂ := h.wrap_lev e₁.1 (e₁.2.trans e₀.2.symm) + have h₅ : Db.SkJoined {y | Back a b θ Rt y x} (b.levV 0 t) (b.levV q' t) := by + rw [← e₂] + exact h₄.symm + exact TangleDatum.SkJoined.trans h₃.symm h₅ + · refine h.join_run hlt.le hq' fun l h₃ h₄ ↦ ?_ + have h₅ : θ l = θ q := le_antisymm (hθ ▸ h.mono h₄ hq') (h.mono h₃ (by omega)) + rw [h₅] + exact ⟨hat, h₁.symm⟩ + rcases lt_trichotomy q q' with hlt | rfl | hlt + · exact main hlt hq' ht ht' h₁ h₂ + · exact Relation.ReflTransGen.refl + · exact (main hlt hq ht' ht h₂ h₁).symm + +/-- **`σ(x)` is connected in the wheel.** -/ +theorem join_back {x y y' : Shat} (h₁ : Back a b θ Rt y x) (h₂ : Back a b θ Rt y' x) : Db.SkJoined + {y | Back a b θ Rt y x} y y' := by + by_cases hl : ∃ q, ∃ t, q < b.R.k ∧ t ≤ b.top q ∧ x = a.levV (θ q) t + · obtain ⟨q₀, t₀, hq₀, ht₀, hx⟩ := hl + have key : ∀ {z}, Back a b θ Rt z x → Db.SkJoined {y | Back a b θ Rt y x} (b.levV q₀ t₀) z := by + intro z hz + rcases hz with ⟨q, hq, t, ht, rfl, hx'⟩ | hz | ⟨q, t, hq, hs, ht, hy, hx'⟩ + · exact h.join_lev hq₀ hq ht₀ ht hx hx' + · rw [(h.rt_lev hz q₀ hq₀ t₀ ht₀).mp hx] + exact Relation.ReflTransGen.refl + · have hP := b.path_spec (h.stay_reg q hq hs) + have hsub : b.path q t ⊆ {y | Back a b θ Rt y x} := fun y hy ↦ .inr + (.inr ⟨q, t, hq, hs, ht, hy, hx'⟩) + exact TangleDatum.SkJoined.trans (h.join_lev hq₀ (by omega) ht₀ ht hx hx') + (TangleDatum.SkJoined.mono hsub (hP.joined t ht z hy)) + exact TangleDatum.SkJoined.trans (key h₁).symm (key h₂) + · have key : ∀ {z}, Back a b θ Rt z x → Rt z x := by + intro z hz + rcases hz with ⟨q, hq, t, ht, -, hx'⟩ | hz | ⟨q, t, hq, -, ht, -, hx'⟩ + · exact absurd ⟨q, t, hq, ht, hx'⟩ hl + · exact hz + · exact absurd ⟨q, t, by omega, ht, hx'⟩ hl + rw [h.rt_inj (key h₁) (key h₂)] + exact Relation.ReflTransGen.refl + +/-- A vertex of `Γ_j` sent back to `x`, on a spoke of the wheel, is at the same level as `x`. -/ +theorem lev_of_spoke {x y : Shat} {q t : ℕ} (hq : q < b.R.k) (ht : t ≤ b.top q) (hy : y + = b.levV q t) (hb : Back a b θ Rt y x) : x = a.levV (θ q) t := + h.back_fun hb (.inl ⟨q, hq, t, ht, hy, rfl⟩) + +/-- A vertex of the hub of `Γ_j` is paired with the vertex it is sent back to. -/ +theorem rt_of_hub {x y : Shat} (hyH : y ∈ b.H.U) (hyV : y ∈ Db.P.Γ.hatV cap) + (hb : Back a b θ Rt y x) : Rt y x := by + obtain ⟨x', hx'⟩ := h.rt_b hyH hyV + rw [h.back_fun hb (.inr (.inl hx'))] + exact hx' + +/-- **At most one vertex of `σ(x)` is on the boundary of the image of a sector.** -/ +theorem sector_unique {x y₁ y₂ : Shat} {q : ℕ} (hq : q < b.R.k) (hmove : q + 1 < b.R.k → θ (q + 1) + = θ q + 1) (h₁ : Back a b θ Rt y₁ x) (h₂ : Back a b θ Rt y₂ x) + (hV₁ : y₁ ∈ Db.P.Γ.hatV cap) (hV₂ : y₂ ∈ Db.P.Γ.hatV cap) (hy₁ : y₁ ∈ + (b.R.spoke b.sp q).support ∨ y₁ ∈ (b.R.spoke b.sp (q + 1)).support ∨ y₁ ∈ b.H.U) + (hy₂ : y₂ ∈ (b.R.spoke b.sp q).support ∨ y₂ ∈ (b.R.spoke b.sp (q + 1)).support + ∨ y₂ ∈ b.H.U) : y₁ = y₂ := by + have h2 := b.R.two + -- The rim position after `q`. + obtain ⟨q', hq'lt, hvert, hcase⟩ : ∃ q' < b.R.k, b.R.vert (q + 1) = b.R.vert q' ∧ ((q + 1 < b.R.k + ∧ q' = q + 1) ∨ (q + 1 = b.R.k ∧ q' = 0)) := by + by_cases hlt : q + 1 < b.R.k + · exact ⟨q + 1, hlt, rfl, .inl ⟨hlt, rfl⟩⟩ + · have e : q + 1 = b.R.k := by omega + refine ⟨0, by omega, ?_, .inr ⟨e, rfl⟩⟩ + rw [e] + simpa using b.R.vert_add_k 0 + have hform : ∀ {y}, y ∈ Db.P.Γ.hatV cap → (y ∈ (b.R.spoke b.sp q).support ∨ y ∈ (b.R.spoke b.sp + (q + 1)).support ∨ y ∈ b.H.U) → + y ∈ b.H.U ∨ (∃ t ≤ b.top q, y = b.levV q t) ∨ ∃ t ≤ b.top q', y = b.levV q' t := by + intro y hV hy + rcases hy with hy | hy | hy + · exact .inr (.inl (b.exists_levV hy hV)) + · obtain ⟨t, ht, e⟩ := b.exists_levV hy hV + exact .inr (.inr ⟨t, by rw [← b.top_congr hvert]; exact ht, + by rw [e]; exact b.levV_congr hvert t⟩) + · exact .inl hy + have hmix : ∀ {y y' : Shat} {p t : ℕ}, Back a b θ Rt y x → Back a b θ Rt y' x → y' ∈ b.H.U + → y' ∈ Db.P.Γ.hatV cap → p < b.R.k → t ≤ b.top p → y = b.levV p t → y = y' := by + intro y y' p t hb hb' hH hV hp ht he + have hR := h.rt_of_hub hH hV hb' + have hx := h.lev_of_spoke hp ht he hb + rw [he] + exact ((h.rt_lev hR p hp t ht).mp hx).symm + have hpair : ∀ {t t' : ℕ}, t ≤ b.top q → t' ≤ b.top q' → Back a b θ Rt (b.levV q t) x + → Back a b θ Rt (b.levV q' t') x → b.levV q t = b.levV q' t' := by + intro t t' ht ht' hb hb' + have hx := h.lev_of_spoke hq ht rfl hb + have hx' := h.lev_of_spoke hq'lt ht' rfl hb' + obtain rfl : t = t' := a.level_eq (h.lev_top hq ht) (h.lev_top hq'lt ht') (hx.symm.trans hx') + rcases hcase with ⟨hlt, rfl⟩ | ⟨e, rfl⟩ + · exact (h.move_iff q hlt (hmove hlt) t ht).mpr (by rw [← hmove hlt, ← hx, ← hx']) + · obtain rfl : q = b.R.k - 1 := by omega + refine (h.wrap_iff t ht).mpr ?_ + rw [h.last] at hx + rw [h.zero] at hx' + rw [← hx, ← hx'] + have hsame : ∀ {p t t' : ℕ}, p < b.R.k → t ≤ b.top p → t' ≤ b.top p → Back a b θ Rt + (b.levV p t) x → Back a b θ Rt (b.levV p t') x → b.levV p t = b.levV p t' := by + intro p t t' hp ht ht' hb hb' + have hx := h.lev_of_spoke hp ht rfl hb + have hx' := h.lev_of_spoke hp ht' rfl hb' + rw [a.level_eq (h.lev_top hp ht) (h.lev_top hp ht') (hx.symm.trans hx')] + rcases hform hV₁ hy₁ with hH | ⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩ <;> + rcases hform hV₂ hy₂ with hH' | ⟨t', ht', rfl⟩ | ⟨t', ht', rfl⟩ + · exact h.rt_inj (h.rt_of_hub hH hV₁ h₁) (h.rt_of_hub hH' hV₂ h₂) + · exact (hmix h₂ h₁ hH hV₁ hq ht' rfl).symm + · exact (hmix h₂ h₁ hH hV₁ hq'lt ht' rfl).symm + · exact hmix h₁ h₂ hH' hV₂ hq ht rfl + · exact hsame hq ht ht' h₁ h₂ + · exact hpair ht ht' h₁ h₂ + · exact hmix h₁ h₂ hH' hV₂ hq'lt ht rfl + · exact (hpair ht' ht h₂ h₁).symm + · exact hsame hq'lt ht ht' h₁ h₂ + +end Stair + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14o.lean b/LeanPool/GraphMinor/GM19/Section14o.lean new file mode 100644 index 0000000000..e46fd85524 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14o.lean @@ -0,0 +1,262 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14n + +/-! +# Graph Minors XIX, Section 14: the vertices of `M(Γ, ℒ)` in a wheel + +Inside a wheel, `M(Γ, ℒ)` keeps only the vertices on the spokes and the hub. The arms of the wheel +are distinct. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +universe w + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} {D : TangleDatum cap χ} {W : Set Shat} + +namespace TangleDatum.WheelFrame + +variable (fr : WheelFrame D W) + +theorem spoke_support_congr {i : ℕ} {v : bdVerts D W} (h : fr.R.vert i = v.1) {x : Shat} (hx : x ∈ + (fr.sp.K v).support) : x ∈ (fr.R.spoke fr.sp i).support := by + have key : ∀ (y z : bdVerts D W), y.1 = z.1 → x ∈ (fr.sp.K z).support → x ∈ (fr.sp.K y).support + := by + rintro ⟨y, hy⟩ ⟨z, hz⟩ e h' + obtain rfl : y = z := e + exact h' + exact key _ _ h hx + +theorem k_three : 3 ≤ fr.R.k := by + have h₁ := three_le_ncard_bd fr.hW fr.hbdS fr.hin + have hsub : discBd W ∩ D.P.Γ.hatV cap ⊆ fr.R.vert '' Iio fr.R.k := by + rintro x ⟨hb, hV⟩ + obtain ⟨i, hi, rfl⟩ := fr.R.exists_vert x ⟨hV, hb⟩ + exact ⟨i, hi, rfl⟩ + have h₂ := ncard_le_ncard hsub ((finite_Iio _).image _) + have h₃ := ncard_image_le (f := fr.R.vert) (finite_Iio fr.R.k) + have h₄ : (Iio fr.R.k).ncard = fr.R.k := by + rw [← Nat.card_coe_set_eq] + simp + omega + +/-- A vertex of `Γ` on a spoke, seen at a rim position below `k`. -/ +theorem exists_levV_lt {i : ℕ} {y : Shat} (hy : y ∈ (fr.R.spoke fr.sp i).support) + (hV : y ∈ D.P.Γ.hatV cap) : ∃ j < fr.R.k, ∃ t ≤ fr.top j, y = fr.levV j t := by + obtain ⟨t, ht, rfl⟩ := fr.exists_levV hy hV + refine ⟨i % fr.R.k, fr.R.mod_lt i, t, ?_, ?_⟩ + · rw [fr.top_congr (fr.vert_mod i)] + exact ht + · exact fr.levV_congr (fr.vert_mod i).symm t + +/-- The sectors with rim position below `k` cover `W` off the hub and the spokes. -/ +theorem cover_lt {x : Shat} (hx : x ∈ W) (hxA : x ∉ fr.sp.A) : ∃ i < fr.R.k, x ∈ (fr.sec i).Δ := by + obtain ⟨r, hr⟩ := SpokeSystem.cover fr.hW fr.sp fr.hbdS fr.hin (ι := {i : ℕ // i < fr.R.k}) + (fun i ↦ fr.R.reg i.1) (fun i ↦ (fr.sec i.1).toSectorAt) + (fun r hr ↦ by + obtain ⟨i, hi, rfl⟩ := fr.R.exists_reg r hr + exact ⟨⟨i, hi⟩, rfl⟩) hx hxA + exact ⟨r.1, r.2, hr⟩ + +theorem emb_notMem_discInt {A : Arm D.Γ} {Δ X : Set Shat} (h : IsDiscArm fr A Δ X) {v : S} + (hv : v ∈ A.compl.vertexSet) : cap.emb v ∉ discInt Δ := by + have hT := cap.isClosedSurface + rw [h.compl] at hv + have : cap.emb v ∈ closure Δᶜ := hv.2 + rw [closure_compl_disc hT h.disc] at this + exact this + +/-- **Inside a wheel, `M(Γ, ℒ)` lives on the spokes and on the hub.** -/ +theorem mem_cases {x : Shat} (hV : x ∈ D.P.Γ.hatV cap) (hxW : x ∈ W) (hoff : ∀ A ∈ fr.arms, ∀ Δ X, + IsDiscArm fr A Δ X → x ∉ discInt Δ) : + (∃ i < fr.R.k, ∃ t ≤ fr.top i, x = fr.levV i t) ∨ x ∈ fr.H.U := by + have hspoke : ∀ {i : ℕ}, x ∈ (fr.R.spoke fr.sp i).support → (∃ i < fr.R.k, ∃ t ≤ fr.top i, x + = fr.levV i t) ∨ x ∈ fr.H.U := fun h ↦ .inl (fr.exists_levV_lt h hV) + have hG : x ∈ D.rad.G.V := D.rad.isPreRadial.2.1 hV + by_cases hxA : x ∈ fr.sp.A + · rcases hxA with hh | hu + · rcases fr.hW.hub_cases with ⟨z, -, hU, hz⟩ | ⟨hH, hle, hc, hz⟩ + · right + rw [hU] + rw [hz] at hh + exact hh + · right + rw [hz] at hh + obtain ⟨-, -, hi⟩ := fr.hub_data hc + by_contra hn + have hb : x ∉ discBd (D.ins fr.H) := fun h' ↦ hn (hi.2.2.2.1 ▸ h') + exact hoff _ (.inr ⟨hc, rfl⟩) _ _ (fr.hubArm_disc hc) ⟨hh, hb⟩ + · obtain ⟨v, hv⟩ := mem_iUnion.mp hu + obtain ⟨i, -, hi⟩ := fr.R.exists_vert v.1 v.2 + exact hspoke (fr.spoke_support_congr hi.symm (support_of_mem_U _ hv hG)) + · obtain ⟨i, hi, hx⟩ := fr.cover_lt hxW hxA + have hb : x ∈ discBd (fr.sec i).Δ := by + by_contra hn + exact hoff _ (.inl ⟨i, hi, rfl⟩) _ _ (fr.secArm_disc i) ⟨hx, hn⟩ + rcases fr.bd_sector hV hb with h' | h' | h' + · exact hspoke h' + · exact hspoke h' + · exact .inr h' + +theorem discInt_sec_off_bd (i : ℕ) {y : Shat} (hy : y ∈ discInt (fr.sec i).Δ) : y ∈ discInt W := + ⟨fr.sec_Δ_sub i ((discInt_subset _) hy), discInt_off_bd cap.isClosedSurface fr.hW.is_disc + (fr.sec i).full.disc (fr.sec_Δ_sub i) hy⟩ + +theorem spoke_mem_W (i : ℕ) {y : Shat} (hy : y ∈ (fr.R.spoke fr.sp i).support) : y ∈ W := + fr.spoke_subset i ((mem_walkDrawing_U _ _).mpr (.inl hy)) + +theorem spoke_bd (i : ℕ) {y : Shat} (hy : y ∈ (fr.R.spoke fr.sp i).support) (hb : y ∈ discBd W) : y + = fr.R.vert i := + (fr.spoke_spoke i).meet_bd fr.hW fr.hbdS fr.hin ((mem_walkDrawing_U _ _).mpr (.inl hy)) hb + +theorem hub_int {y : Shat} (hy : y ∈ fr.H.U) : y ∈ discInt W := by + obtain ⟨-, h₁, h₂, h₃⟩ := fr.hW.hubSet_facts + exact ⟨h₁ (h₃ hy), fun hb ↦ disjoint_left.mp h₂ (h₃ hy) hb⟩ + +/-- The vertices of `Γ` on the rim in a sector are the two rim vertices of the sector. -/ +theorem sec_rim {i : ℕ} {y : Shat} (hV : y ∈ D.P.Γ.hatV cap) (hy : y ∈ (fr.sec i).Δ ∪ fr.secX i) + (hb : y ∈ discBd W) : y = fr.R.vert i ∨ y = fr.R.vert (i + 1) := by + have hG : y ∈ D.rad.G.V := D.rad.isPreRadial.2.1 hV + rcases hy with hy | hy + · have hbd : y ∈ discBd (fr.sec i).Δ := by + by_contra hn + exact (fr.discInt_sec_off_bd i ⟨hy, hn⟩).2 hb + rcases fr.bd_sector hV hbd with h' | h' | h' + · exact .inl (fr.spoke_bd i h' hb) + · exact .inr (fr.spoke_bd (i + 1) h' hb) + · exact absurd hb (fr.hub_int h').2 + · exact .inl (fr.spoke_bd i (support_of_mem_U _ hy.1.2 hG) hb) + +theorem vert_mem_sec (i : ℕ) : fr.R.vert i ∈ (fr.sec i).Δ ∧ fr.R.vert (i + 1) ∈ (fr.sec i).Δ := by + have hfull := (fr.sec i).full + have h₁ : fr.R.vert i ∈ discBd (fr.sec i).Δ := by + rw [hfull.bd_eq] + exact .inr ((mem_walkDrawing_U _ _).mpr (.inl (fr.sec i).Z.start_mem_support)) + have h₂ : fr.R.vert (i + 1) ∈ discBd (fr.sec i).Δ := by + rw [hfull.bd_eq] + exact .inr ((mem_walkDrawing_U _ _).mpr (.inl (fr.sec i).Z.end_mem_support)) + exact ⟨Surface.discBd_subset _ h₁, Surface.discBd_subset _ h₂⟩ + +theorem vert_V (i : ℕ) : D.pre (fr.R.vert i) ∈ D.Γ.V ∧ cap.emb (D.pre (fr.R.vert i)) = fr.R.vert i + := by + obtain ⟨u, hu, e⟩ := fr.vert_hatV i + rw [← e, D.pre_emb] + exact ⟨hu, rfl⟩ + +theorem vert_mem_arm (i : ℕ) : D.pre (fr.R.vert i) ∈ (fr.secArm i).minus.vertexSet ∧ D.pre + (fr.R.vert (i + 1)) ∈ (fr.secArm i).minus.vertexSet := by + have h := fr.secArm_disc i + rw [h.minus] + refine ⟨⟨(fr.vert_V i).1, ?_⟩, ⟨(fr.vert_V (i + 1)).1, ?_⟩⟩ + · change cap.emb (D.pre (fr.R.vert i)) ∈ (fr.sec i).Δ ∪ fr.secX i + rw [(fr.vert_V i).2] + exact .inl (fr.vert_mem_sec i).1 + · change cap.emb (D.pre (fr.R.vert (i + 1))) ∈ (fr.sec i).Δ ∪ fr.secX i + rw [(fr.vert_V (i + 1)).2] + exact .inl (fr.vert_mem_sec i).2 + +theorem arm_rim {i : ℕ} {v : S} (hv : v ∈ (fr.secArm i).minus.vertexSet) + (hb : cap.emb v ∈ discBd W) : cap.emb v = fr.R.vert i ∨ cap.emb v = fr.R.vert (i + 1) := by + rw [(fr.secArm_disc i).minus] at hv + exact fr.sec_rim ⟨v, hv.1, rfl⟩ hv.2 hb + +/-- **Distinct rim positions give distinct sectors.** -/ +theorem secArm_inj {i j : ℕ} (hi : i < fr.R.k) (hj : j < fr.R.k) (h : fr.secArm i + = fr.secArm j) : i = j := by + have h3 := fr.k_three + have hmod : ∀ {a b : ℕ}, fr.R.vert a = fr.R.vert b → a % fr.R.k = b % fr.R.k := fun {a b} e ↦ + fr.R.vert_inj (fr.R.mod_lt a) (fr.R.mod_lt b) (by rw [fr.vert_mod, fr.vert_mod, e]) + have hsucc : ∀ a, a < fr.R.k → (a + 1) % fr.R.k = if a + 1 < fr.R.k then a + 1 else 0 + := fun a ha ↦ by + split_ifs with h' + · exact Nat.mod_eq_of_lt h' + · rw [show a + 1 = fr.R.k by omega, Nat.mod_self] + have hbd : ∀ a, fr.R.vert a ∈ discBd W := fun a ↦ (fr.R.vert_mem a).2 + have he : ∀ a, cap.emb (D.pre (fr.R.vert a)) = fr.R.vert a := fun a ↦ (fr.vert_V a).2 + have h₁ := fr.arm_rim (i := j) (by rw [← h]; exact (fr.vert_mem_arm i).1) + (by rw [he]; exact hbd _) + have h₂ := fr.arm_rim (i := j) (by rw [← h]; exact (fr.vert_mem_arm i).2) + (by rw [he]; exact hbd _) + rw [he] at h₁ h₂ + by_contra hne + have hi' := Nat.mod_eq_of_lt hi + have hj' := Nat.mod_eq_of_lt hj + have s₁ := hsucc i hi + have s₂ := hsucc j hj + rcases h₁ with e | e + · exact hne (fr.R.vert_inj hi hj e) + · have m₁ := hmod e + rcases h₂ with e' | e' + · have m₂ := hmod e' + rw [hi', s₂] at m₁ + rw [s₁, hj'] at m₂ + split_ifs at m₁ m₂ <;> omega + · exact fr.R.vert_ne_succ hi (e.trans e'.symm) + +/-- A hub of more than one vertex has a vertex of `Γ`. -/ +theorem hub_has_vertex (hc : fr.H.V.ncard ≠ 1) : ∃ x ∈ fr.H.U, x ∈ D.P.Γ.hatV cap := by + obtain ⟨-, -, hi⟩ := fr.hub_data hc + have hC := hi.1 + obtain ⟨e, he⟩ := GraphMinor.GM11.IsCircuit.E_nonempty hC.2 + have heG := hC.1.2 he + have hcl : closure e ⊆ fr.H.U := fun z hz ↦ by + rw [fr.H.U_eq] + exact .inr (mem_biUnion he hz) + have key : ∀ {x y : Shat}, D.rad.G.toGraph.IsLink e x y → ∃ x ∈ fr.H.U, x ∈ D.P.Γ.hatV cap := by + intro x y hl + have h₁ := D.even_length_walk (.cons hl (.nil hl.2.2.1)) + have h₂ : ¬ Even (GraphWalk.cons hl (.nil hl.2.2.1)).length := by + simp [GraphWalk.length, GraphWalk.edges] + have hm : ∀ z, z ∈ ({x, y} : Set Shat) → z ∈ fr.H.U := fun z hz ↦ by + have : z ∈ closure e ∩ D.rad.G.V := by + rw [hl.2.2.2] + exact hz + exact hcl this.1 + have hx : x ∈ fr.H.U := hm x (mem_insert x {y}) + have hy : y ∈ fr.H.U := hm y (mem_insert_of_mem x rfl) + by_cases hxV : x ∈ D.P.Γ.hatV cap + · exact ⟨x, hx, hxV⟩ + · by_cases hyV : y ∈ D.P.Γ.hatV cap + · exact ⟨y, hy, hyV⟩ + · exact absurd (h₁.mpr ⟨fun h' ↦ absurd h' hxV, fun h' ↦ absurd h' hyV⟩) h₂ + rcases D.rad.G.edge_cond e heG with ⟨u, v, -, hc₁, -⟩ | ⟨u, hc₁, -⟩ + · have hu : u ∈ closure e ∩ D.rad.G.V := by + rw [hc₁] + exact mem_insert u {v} + have hv : v ∈ closure e ∩ D.rad.G.V := by + rw [hc₁] + exact mem_insert_of_mem u rfl + exact key (x := u) (y := v) ⟨heG, hu.2, hv.2, hc₁⟩ + · have hu : u ∈ closure e ∩ D.rad.G.V := by + rw [hc₁] + exact rfl + exact key (x := u) (y := u) ⟨heG, hu.2, hu.2, by rw [hc₁]; simp⟩ + +theorem hub_minus_mem (hc : fr.H.V.ncard ≠ 1) : ∃ v ∈ (fr.hubArm hc).minus.vertexSet, cap.emb v ∈ W + := by + obtain ⟨x, hx, u, hu, rfl⟩ := fr.hub_has_vertex hc + have h := fr.hubArm_disc hc + obtain ⟨-, -, hi⟩ := fr.hub_data hc + have hxI : cap.emb u ∈ D.ins fr.H := Surface.discBd_subset _ (hi.2.2.2.1 ▸ hx) + refine ⟨u, ?_, (fr.hub_int hx).1⟩ + rw [h.minus] + exact ⟨hu, .inl hxI⟩ + +end TangleDatum.WheelFrame + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14p.lean b/LeanPool/GraphMinor/GM19/Section14p.lean new file mode 100644 index 0000000000..a8646d31f0 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14p.lean @@ -0,0 +1,515 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14o + +/-! +# Graph Minors XIX, Section 14: from staircases to an outline + +We collect the staircases of all the wheels, with the part of the inflation outside the wheels. The +set `σ(x)` is then the set of the +vertices that are sent back to `x`. This is the check that the paper omits in (14.1). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +universe w + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} {Da Db : TangleDatum cap χ} {𝒲a 𝒲b : Set + (Set Shat)} + +/-- One step inside `σ'(x)`, in the cut painting: an edge of `sk(Γ_j)`, or an edge of the rim of a +wheel. -/ +def OutStep (fb : ∀ W : ↥𝒲b, WheelFrame Db W.1) (Out : Shat → Shat → Prop) (x u w : Shat) : Prop := + Out u x ∧ Out w x ∧ ((∃ a b, cap.emb a = u ∧ cap.emb b = w ∧ Db.P.Γ.skAdj.Adj a b) ∨ + ∃ (W : ↥𝒲b) (q : ℕ), q < (fb W).R.k ∧ ((u = (fb W).R.vert q ∧ w = (fb W).R.vert (q + 1)) ∨ (u = + (fb W).R.vert (q + 1) ∧ w = (fb W).R.vert q))) + +/-- **The staircases of all the wheels**, with the relation `Out` that holds the inflation outside +the wheels. -/ +structure StairSystem (fa : ∀ W : ↥𝒲a, WheelFrame Da W.1) (fb : ∀ W : ↥𝒲b, WheelFrame Db W.1) + (p : ↥𝒲a → ↥𝒲b) (θ : ↥𝒲a → ℕ → ℕ) (Rt : ↥𝒲a → Shat → Shat → Prop) + (Out : Shat → Shat → Prop) : Prop where + p_bij : Function.Bijective p + stair : ∀ W, Stair (fa W) (fb (p W)) (θ W) (Rt W) + out_fun : ∀ {y x x'}, Out y x → Out y x' → x = x' + out_hat : ∀ {y x}, Out y x → y ∈ Db.P.Γ.hatV cap ∧ x ∈ Da.P.Γ.hatV cap + out_off_b : ∀ {y x}, Out y x → ∀ W : ↥𝒲b, y ∉ discInt W.1 + out_off_a : ∀ {y x}, Out y x → ∀ W : ↥𝒲a, x ∉ discInt W.1 + out_rim : ∀ W q, q < (fb (p W)).R.k → Out ((fb (p W)).R.vert q) ((fa W).R.vert (θ W q)) + out_ne : ∀ x ∈ Da.P.Γ.hatV cap, (∀ W : ↥𝒲a, x ∉ discInt W.1) → ∃ y, Out y x + out_conn : ∀ {y y' x}, Out y x → Out y' x → Relation.ReflTransGen (OutStep fb Out x) y y' + +variable {fa : ∀ W : ↥𝒲a, WheelFrame Da W.1} {fb : ∀ W : ↥𝒲b, WheelFrame Db W.1} {p : ↥𝒲a + → ↥𝒲b} {θ : ↥𝒲a → ℕ → ℕ} {Rt : ↥𝒲a → Shat → Shat → Prop} + {Out : Shat → Shat → Prop} + +/-- The set `σ(x)`: `y` is sent back to `x`. -/ +def StairSystem.GBack (fa : ∀ W : ↥𝒲a, WheelFrame Da W.1) (fb : ∀ W : ↥𝒲b, WheelFrame Db W.1) + (p : ↥𝒲a → ↥𝒲b) (θ : ↥𝒲a → ℕ → ℕ) (Rt : ↥𝒲a → Shat → Shat → Prop) + (Out : Shat → Shat → Prop) (y x : Shat) : Prop := + Out y x ∨ ∃ W, Stair.Back (fa W) (fb (p W)) (θ W) (Rt W) y x + +namespace Stair + +variable {Wa Wb : Set Shat} {a : WheelFrame Da Wa} {b : WheelFrame Db Wb} {t : ℕ → ℕ} {R : Shat + → Shat → Prop} + +/-- A vertex that is sent back lies in the wheel, on both sides. -/ +theorem back_mem (h : Stair a b t R) {y x : Shat} (hb : Back a b t R y x) : (y ∈ Wb + ∧ y ∈ Db.P.Γ.hatV cap) ∧ x ∈ Wa ∧ x ∈ Da.P.Γ.hatV cap := by + have hlev : ∀ {q l : ℕ}, q < b.R.k → l ≤ b.top q → (b.levV q l ∈ Wb + ∧ b.levV q l ∈ Db.P.Γ.hatV cap) ∧ a.levV (t q) l ∈ Wa ∧ a.levV (t q) l ∈ Da.P.Γ.hatV cap + := fun {q l} hq hl ↦ + ⟨⟨b.spoke_mem_W q (b.levV_support hl), b.levV_hatV hl⟩, a.spoke_mem_W _ (a.levV_support + (h.lev_top hq hl)), a.levV_hatV (h.lev_top hq hl)⟩ + rcases hb with ⟨q, hq, l, hl, rfl, rfl⟩ | hb | hb + · exact hlev hq hl + · obtain ⟨⟨h₁, h₂⟩, h₃, h₄⟩ := h.rt_hub hb + exact ⟨⟨(b.hub_int h₁).1, h₂⟩, (a.hub_int h₃).1, h₄⟩ + · rcases h.onPath_cases hb with ⟨q, hq, l, hl, rfl, rfl⟩ | ⟨q, l, hq, hl, hy, hi, rfl⟩ + · exact hlev hq hl + · exact ⟨⟨(b.discInt_sec_off_bd q hi).1, (b.path_spec (b.path_reg hy)).hat l hl hy⟩, + (hlev hq hl).2⟩ + +end Stair + +namespace StairSystem + +variable (h : StairSystem fa fb p θ Rt Out) +include h + +theorem back_out {W : ↥𝒲a} {y x x' : Shat} (h₁ : Out y x) (h₂ : Stair.Back (fa W) (fb (p W)) (θ W) + (Rt W) y x') : x = x' := by + have hst := h.stair W + have hoff := h.out_off_b h₁ (p W) + have hlev : ∀ {x₂ : Shat}, Stair.Lev (fa W) (fb (p W)) (θ W) y x₂ → x = x₂ := by + rintro _ ⟨q, hq, t, ht, rfl, rfl⟩ + have hmem := (fb (p W)).spoke_mem_W q ((fb (p W)).levV_support ht) + have hbd : (fb (p W)).levV q t ∈ discBd (p W).1 := by + by_contra hn + exact hoff ⟨hmem, hn⟩ + have hv := (fb (p W)).spoke_bd q ((fb (p W)).levV_support ht) hbd + rw [← (fb (p W)).levV_zero] at hv + obtain rfl : t = 0 := (fb (p W)).levV_inj ht (Nat.zero_le _) hv + rw [(fa W).levV_zero, h.out_fun h₁ (hv ▸ (fb (p W)).levV_zero q ▸ h.out_rim W q hq)] + rcases h₂ with h₂ | h₂ | h₂ + · exact hlev h₂ + · exact absurd ((fb (p W)).hub_int (hst.rt_hub h₂).1.1) hoff + · rcases hst.onPath_cases h₂ with h₃ | ⟨q, t, hq, ht, hy, hi, -⟩ + · exact hlev h₃ + · exact absurd ((fb (p W)).discInt_sec_off_bd q hi) hoff + +/-- **The sets `σ(x)` are disjoint.** -/ +theorem gback_fun (hdb : 𝒲b.PairwiseDisjoint id) {y x x' : Shat} (h₁ : GBack fa fb p θ Rt Out y x) + (h₂ : GBack fa fb p θ Rt Out y x') : x = x' := by + rcases h₁ with h₁ | ⟨W, h₁⟩ <;> rcases h₂ with h₂ | ⟨W', h₂⟩ + · exact h.out_fun h₁ h₂ + · exact h.back_out h₁ h₂ + · exact (h.back_out h₂ h₁).symm + · have m₁ := ((h.stair W).back_mem h₁).1.1 + have m₂ := ((h.stair W').back_mem h₂).1.1 + obtain rfl : W = W' := by + by_contra hne + have hne' : (p W).1 ≠ (p W').1 := fun e ↦ hne (h.p_bij.1 (Subtype.ext e)) + exact disjoint_left.mp (hdb (p W).2 (p W').2 hne') m₁ m₂ + exact (h.stair W).back_fun h₁ h₂ + +/-- A step of the cut painting inside `σ'(x)` stays inside `σ(x)`. -/ +theorem join_outStep {x u w : Shat} (hs : OutStep fb Out x u w) : Db.SkJoined {y | GBack fa fb p θ + Rt Out y x} u w := by + obtain ⟨hu, hw, ⟨a, b, ha, hb, hadj⟩ | ⟨W', q, hq, ho⟩⟩ := hs + · exact Relation.ReflTransGen.single ⟨.inl hu, .inl hw, a, b, ha, hb, hadj⟩ + · obtain ⟨W, rfl⟩ := h.p_bij.2 W' + have hst := h.stair W + have key : Out ((fb (p W)).R.vert q) x → Out ((fb (p W)).R.vert (q + 1)) x + → Db.SkJoined {y | GBack fa fb p θ Rt Out y x} ((fb (p W)).R.vert q) ((fb (p W)).R.vert + (q + 1)) := by + intro h₁ h₂ + have h2 := (fa W).R.two + have h2' := (fb (p W)).R.two + by_cases hlt : q + 1 < (fb (p W)).R.k + · have e₁ := h.out_fun h₁ (h.out_rim W q hq) + have e₂ := h.out_fun h₂ (h.out_rim W (q + 1) hlt) + have hs : θ W (q + 1) = θ W q := (fa W).R.vert_inj (hst.lt hlt) (hst.lt hq) + (e₂.symm.trans e₁) + have hP := (fb (p W)).path_spec (hst.stay_reg q hlt hs) + have hsub : (fb (p W)).path q 0 ⊆ {y | GBack fa fb p θ Rt Out y x} := fun y hy ↦ + .inr ⟨W, .inr (.inr ⟨q, 0, hlt, hs, Nat.zero_le _, hy, + (by rw [(fa W).levV_zero]; exact e₁)⟩)⟩ + have hj := TangleDatum.SkJoined.mono hsub (hP.joined 0 (Nat.zero_le _) _ (hP.right 0 + (Nat.zero_le _))) + rw [(fb (p W)).levV_zero, (fb (p W)).levV_zero] at hj + exact hj + · have hq₁ : q = (fb (p W)).R.k - 1 := by omega + have hk : (fb (p W)).R.vert (q + 1) = (fb (p W)).R.vert 0 := by + rw [show q + 1 = 0 + (fb (p W)).R.k by omega] + exact (fb (p W)).R.vert_add_k 0 + rw [hk] at h₂ + have e₁ := h.out_fun h₁ (h.out_rim W q hq) + have e₂ := h.out_fun h₂ (h.out_rim W 0 (by omega)) + rw [hq₁, hst.last] at e₁ + rw [hst.zero] at e₂ + have := (fa W).R.vert_inj (by omega) (by omega) (e₁.symm.trans e₂) + omega + rcases ho with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact key hu hw + · exact (key hw hu).symm + +theorem join_outs {x y y' : Shat} (h₁ : Out y x) (h₂ : Out y' x) : Db.SkJoined {y | GBack fa fb p θ + Rt Out y x} y y' := by + have key : ∀ {u w}, Relation.ReflTransGen (OutStep fb Out x) u w → Db.SkJoined {y | GBack fa fb p + θ Rt Out y x} u w := by + intro u w hr + induction hr with + | refl => exact Relation.ReflTransGen.refl + | tail _ hs ih => exact TangleDatum.SkJoined.trans ih (h.join_outStep hs) + exact key (h.out_conn h₁ h₂) + +/-- **The sets `σ(x)` are connected.** -/ +theorem gjoin (hda : 𝒲a.PairwiseDisjoint id) {x y y' : Shat} (h₁ : GBack fa fb p θ Rt Out y x) + (h₂ : GBack fa fb p θ Rt Out y' x) : Db.SkJoined {y | GBack fa fb p θ Rt Out y x} y y' := by + have hmixed : ∀ {W y y'}, Out y x → Stair.Back (fa W) (fb (p W)) (θ W) (Rt W) y' x + → Db.SkJoined {y | GBack fa fb p θ Rt Out y x} y y' := by + intro W y y' ho hb + have hst := h.stair W + obtain ⟨-, hxW, hxV⟩ := hst.back_mem hb + have hbd : x ∈ discBd W.1 := by + by_contra hn + exact h.out_off_a ho W ⟨hxW, hn⟩ + obtain ⟨i, hi, rfl⟩ := (fa W).R.exists_vert x ⟨hxV, hbd⟩ + obtain ⟨q, hq, rfl⟩ := hst.surj hi + have hO := h.out_rim W q hq + have hL : Stair.Back (fa W) (fb (p W)) (θ W) (Rt W) ((fb (p W)).R.vert q) ((fa W).R.vert + (θ W q)) := + .inl ⟨q, hq, 0, Nat.zero_le _, ((fb (p W)).levV_zero q).symm, ((fa W).levV_zero _).symm⟩ + have hsub : {y | Stair.Back (fa W) (fb (p W)) (θ W) (Rt W) y ((fa W).R.vert + (θ W q))} ⊆ {y | GBack fa fb p θ Rt Out y ((fa W).R.vert (θ W q))} := fun y hy ↦ .inr ⟨W, hy⟩ + exact TangleDatum.SkJoined.trans (h.join_outs ho hO) (TangleDatum.SkJoined.mono hsub + (hst.join_back hL hb)) + rcases h₁ with h₁ | ⟨W, h₁⟩ <;> rcases h₂ with h₂ | ⟨W', h₂⟩ + · exact h.join_outs h₁ h₂ + · exact hmixed h₁ h₂ + · exact (hmixed h₂ h₁).symm + · obtain rfl : W = W' := by + by_contra hne + have hne' : W.1 ≠ W'.1 := fun e ↦ hne (Subtype.ext e) + exact disjoint_left.mp (hda W.2 W'.2 hne') ((h.stair W).back_mem h₁).2.1 + ((h.stair W').back_mem h₂).2.1 + have hsubset : {y | Stair.Back (fa W) (fb (p W)) (θ W) (Rt W) y x} ⊆ + {y | GBack fa fb p θ Rt Out y x} := fun _ hy ↦ .inr ⟨W, hy⟩ + exact TangleDatum.SkJoined.mono hsubset ((h.stair W).join_back h₁ h₂) + +end StairSystem + +omit [T2Space S] [T2Space Shat] in +theorem reachable_of_skJoined {D : TangleDatum cap χ} {X : Set Shat} {T : Set S} + (hT : ∀ a, a ∈ D.P.Γ.V → cap.emb a ∈ X → a ∈ T) {x y : Shat} (hj : D.SkJoined X x y) {u w : S} + (hu : u ∈ T) (hw : w ∈ T) (he : cap.emb u = x) (he' : cap.emb w = y) : + (D.P.Γ.skAdj.induce T).Reachable ⟨u, hu⟩ ⟨w, hw⟩ := by + induction hj generalizing w with + | refl => + obtain rfl : w = u := cap.isEmbedding.injective (he'.trans he.symm) + exact SimpleGraph.Reachable.refl _ + | @tail b c _ hs ih => + obtain ⟨h₁, h₂, p, q, hp, hq, hadj⟩ := hs + obtain rfl : q = w := cap.isEmbedding.injective (hq.trans he'.symm) + have hpT : p ∈ T := hT p hadj.2.1 (hp ▸ h₁) + have hr := ih hpT hp + refine hr.trans (SimpleGraph.Adj.reachable ?_) + exact hadj + +namespace StairSystem + +variable (h : StairSystem fa fb p θ Rt Out) +include h + +/-- A vertex sent back that is in the image of a sector lies on the boundary of the sector. -/ +theorem onSec {W : ↥𝒲a} {q : ℕ} (hq : q < (fb (p W)).R.k) (hmove : q + 1 < (fb (p W)).R.k → θ W + (q + 1) = θ W q + 1) {x y : Shat} (hV : y ∈ Db.P.Γ.hatV cap) + (hy : y ∈ ((fb (p W)).sec q).Δ ∪ (fb (p W)).secX q) (hdb : 𝒲b.PairwiseDisjoint id) + (hb : GBack fa fb p θ Rt Out y x) : + Stair.Back (fa W) (fb (p W)) (θ W) (Rt W) y x ∧ (y ∈ ((fb (p W)).R.spoke (fb + (p W)).sp q).support ∨ y ∈ ((fb (p W)).R.spoke (fb (p W)).sp (q + 1)).support ∨ y ∈ (fb + (p W)).H.U) := by + have hG : y ∈ Db.rad.G.V := Db.rad.isPreRadial.2.1 hV + have hst := h.stair W + set b := fb (p W) with hbdef + have hmemW : y ∈ (p W).1 := by + rcases hy with hy | hy + · exact b.sec_Δ_sub q hy + · exact b.spoke_mem_W q (support_of_mem_U _ hy.1.2 hG) + have honbd : y ∉ discInt (b.sec q).Δ → (y ∈ (b.R.spoke b.sp q).support ∨ y ∈ (b.R.spoke b.sp + (q + 1)).support ∨ y ∈ b.H.U) := by + intro hn + rcases hy with hy | hy + · have hbd : y ∈ discBd (b.sec q).Δ := by + by_contra hn' + exact hn ⟨hy, hn'⟩ + exact b.bd_sector hV hbd + · exact .inl (support_of_mem_U _ hy.1.2 hG) + have hoffint : Stair.Lev (fa W) b (θ W) y x → y ∉ discInt (b.sec q).Δ := by + rintro ⟨q', -, t, ht, rfl, -⟩ hi + exact b.discInt_off_spoke q q' hi (b.levV_support ht) + have hsec : ∀ {W' : ↥𝒲a}, Stair.Back (fa W') (fb (p W')) (θ W') (Rt W') y x → W' = W := by + intro W' hB + by_contra hne + have hne' : (p W').1 ≠ (p W).1 := fun e ↦ hne (h.p_bij.1 (Subtype.ext e)) + exact disjoint_left.mp (hdb (p W').2 (p W).2 hne') ((h.stair W').back_mem hB).1.1 hmemW + rcases hb with ho | ⟨W', hB⟩ + · have hoffb := h.out_off_b ho (p W) + have hi : y ∉ discInt (b.sec q).Δ := fun hi ↦ hoffb (b.discInt_sec_off_bd q hi) + have hon := honbd hi + have hnotH : y ∉ b.H.U := fun hH ↦ hoffb (b.hub_int hH) + have hspoke : y ∈ (b.R.spoke b.sp q).support ∨ y ∈ (b.R.spoke b.sp (q + 1)).support + := hon.imp id (fun h' ↦ h'.resolve_right hnotH) + obtain ⟨q₁, hq₁, t, ht, rfl⟩ : ∃ q₁ < b.R.k, ∃ t ≤ b.top q₁, y = b.levV q₁ t := by + rcases hspoke with h' | h' <;> exact b.exists_levV_lt h' hV + have hL : Stair.Back (fa W) b (θ W) (Rt W) (b.levV q₁ t) ((fa W).levV (θ W q₁) t) + := .inl ⟨q₁, hq₁, t, ht, rfl, rfl⟩ + rw [h.back_out ho hL] + exact ⟨hL, hon⟩ + · obtain rfl := hsec hB + refine ⟨hB, ?_⟩ + rcases hB with hL | hR | hP + · exact honbd (hoffint hL) + · exact .inr (.inr (hst.rt_hub hR).1.1) + · rcases hst.onPath_stay hP with hL | ⟨q', hq', hs, hi⟩ + · exact honbd (hoffint hL) + · exfalso + have hne : q' ≠ q := by + rintro rfl + have := hmove hq' + omega + exact disjoint_left.mp (b.sec_off_sec (i := q) (j := q') fun e ↦ hne (b.R.reg_inj + (by omega) hq e.symm)) hy hi + +/-- A vertex sent back that is in the image of a hub sector is a vertex of the hub. -/ +theorem onHub {W : ↥𝒲a} (hc : (fb (p W)).H.V.ncard ≠ 1) {x y : Shat} (hV : y ∈ Db.P.Γ.hatV cap) + (hy : y ∈ Db.ins (fb (p W)).H) (hdb : 𝒲b.PairwiseDisjoint id) + (hb : GBack fa fb p θ Rt Out y x) : Rt W y x := by + have hst := h.stair W + set b := fb (p W) with hbdef + have hhub : hubSet Db b.H = Db.ins b.H := by + rcases b.hW.hub_cases with ⟨z, hz, -, -⟩ | ⟨-, -, -, hz⟩ + · rw [hz, ncard_singleton] at hc + exact absurd rfl hc + · exact hz + obtain ⟨-, hsub, hdis, -⟩ := b.hW.hubSet_facts + rw [hhub] at hsub hdis + have hint : y ∈ discInt (p W).1 := ⟨hsub hy, fun hb' ↦ disjoint_left.mp hdis hy hb'⟩ + have hsec : ∀ {W' : ↥𝒲a}, Stair.Back (fa W') (fb (p W')) (θ W') (Rt W') y x → W' = W := by + intro W' hB + by_contra hne + have hne' : (p W').1 ≠ (p W).1 := fun e ↦ hne (h.p_bij.1 (Subtype.ext e)) + exact disjoint_left.mp (hdb (p W').2 (p W).2 hne') ((h.stair W').back_mem hB).1.1 hint.1 + have hlev : Stair.Lev (fa W) b (θ W) y x → y ∈ b.H.U := by + rintro ⟨q, -, t, ht, rfl, -⟩ + have hK : b.levV q t ∈ hubSet Db b.H ∩ (walkDrawing Db.rad.G (b.R.spoke b.sp q)).U + := ⟨hhub ▸ hy, (mem_walkDrawing_U _ _).mpr (.inl (b.levV_support ht))⟩ + rw [b.hW.hubSet_inter_spoke (b.spoke_spoke q)] at hK + rw [mem_singleton_iff.mp hK] + exact b.H.V_subset_U (b.spoke_spoke q).2.h_mem + rcases hb with ho | ⟨W', hB⟩ + · exact absurd hint (h.out_off_b ho (p W)) + · obtain rfl := hsec hB + rcases hB with hL | hR | hP + · exact hst.rt_of_hub (hlev hL) hV (.inl hL) + · exact hR + · rcases hst.onPath_stay hP with hL | ⟨q', -, -, hi⟩ + · exact hst.rt_of_hub (hlev hL) hV (.inr (.inr hP)) + · exact (disjoint_left.mp (b.hub_off_sec hc q') (Or.inl hy) hi).elim + +end StairSystem + +theorem arm_wheel {fb : ∀ W : ↥𝒲b, WheelFrame Db W.1} (hdb : 𝒲b.PairwiseDisjoint id) {W₁ W₂ : ↥𝒲b} + {A : Arm Db.Γ} (h₁ : A ∈ (fb W₁).arms) (h₂ : A ∈ (fb W₂).arms) : W₁ = W₂ := by + obtain ⟨Δ₁, X₁, hc₁⟩ := (fb W₁).exists_disc h₁ + obtain ⟨Δ₂, X₂, hc₂⟩ := (fb W₂).exists_disc h₂ + have hex : ∃ v ∈ A.minus.vertexSet, cap.emb v ∈ W₁.1 := by + rcases h₁ with ⟨i, -, rfl⟩ | ⟨hc, rfl⟩ + · exact ⟨_, ((fb W₁).vert_mem_arm i).1, by + rw [((fb W₁).vert_V i).2] + exact Surface.discBd_subset _ ((fb W₁).R.vert_mem i).2⟩ + · exact (fb W₁).hub_minus_mem hc + obtain ⟨v, hv, hvW⟩ := hex + rw [hc₂.minus] at hv + by_contra hne + exact disjoint_left.mp (hdb W₁.2 W₂.2 fun e ↦ hne (Subtype.ext e)) hvW (hc₂.sub hv.2) + +theorem sec_ne_hub {W : Set Shat} (fr : WheelFrame Db W) (hc : fr.H.V.ncard ≠ 1) + (i : ℕ) : fr.secArm i ≠ fr.hubArm hc := by + intro e + have hv := (fr.vert_mem_arm i).1 + rw [e, (fr.hubArm_disc hc).minus] at hv + have hx := hv.2 + have hy : fr.R.vert i ∈ Db.ins fr.H ∪ ∅ := by + have h' : cap.emb (Db.pre (fr.R.vert i)) ∈ Db.ins fr.H ∪ ∅ := hx + rwa [(fr.vert_V i).2] at h' + rw [union_empty] at hy + have hhub : hubSet Db fr.H = Db.ins fr.H := by + rcases fr.hW.hub_cases with ⟨z, hz, -, -⟩ | ⟨-, -, -, hz⟩ + · rw [hz, ncard_singleton] at hc + exact absurd rfl hc + · exact hz + obtain ⟨-, -, hdis, -⟩ := fr.hW.hubSet_facts + rw [hhub] at hdis + exact disjoint_left.mp hdis hy (fr.R.vert_mem i).2 + +/-- **The outline of (14.1)**, given the staircases of the wheels and the arms and edges that +correspond. -/ +theorem StairSystem.isOutline (h : StairSystem fa fb p θ Rt Out) (hd : χ.IsDisjoint) + (hfa : 𝒲a.Finite) (hda : 𝒲a.PairwiseDisjoint id) (hfb : 𝒲b.Finite) (hdb : 𝒲b.PairwiseDisjoint id) + (τ : Arm Da.P.Γ → Arm Db.P.Γ) (σe : Set S → Set S) + (hτS : ∀ W, ∀ i < (fa W).R.k, ∃ q < (fb (p W)).R.k, θ W q = i ∧ (q + 1 < (fb (p W)).R.k → θ W + (q + 1) = θ W q + 1) ∧ τ ((fa W).secArm i) = (fb (p W)).secArm q) + (hτH : ∀ W (hc : (fa W).H.V.ncard ≠ 1), ∃ hc' : (fb (p W)).H.V.ncard ≠ 1, τ ((fa W).hubArm hc) + = (fb (p W)).hubArm hc') + (hπ : ∀ W, ∀ A ∈ (fa W).arms, (τ A).π.length = A.π.length ∧ ∀ (i : ℕ) (hi : i < A.π.length) + (hi' : i < (τ A).π.length), + Stair.Back (fa W) (fb (p W)) (θ W) (Rt W) (cap.emb (τ A).π[i]) (cap.emb A.π[i])) + (hem : ∀ e ∈ (coverLoc 𝒲a hfa hda fa).M.edgeSet, σe e ∈ (coverLoc 𝒲b hfb hdb fb).M.edgeSet) + (hsize : ∀ e ∈ (coverLoc 𝒲a hfa hda fa).M.edgeSet, (tilde (σe e)).ncard = (tilde e).ncard) + (hinj : InjOn σe (coverLoc 𝒲a hfa hda fa).M.edgeSet) + (hends : ∀ e ∈ (coverLoc 𝒲a hfa hda fa).M.edgeSet, ∀ (i : ℕ) (hi : i < (Da.P.Γ.γ e).length) + (hi' : i < (Db.P.Γ.γ (σe e)).length), + Out (cap.emb (Db.P.Γ.γ (σe e))[i]) (cap.emb (Da.P.Γ.γ e)[i])) + (hle : ∀ e ∈ (coverLoc 𝒲a hfa hda fa).M.edgeSet, χ.unionLE (Da.P.φ e) (Db.P.φ (σe e))) : + IsOutline (⟨hd, Da.P, coverLoc 𝒲a hfa hda fa⟩ : Place χ) ⟨hd, Db.P, coverLoc 𝒲b hfb hdb fb⟩ τ + := by + classical + have hinjE := cap.isEmbedding.injective + let σv : S → Set S := fun v ↦ {u | u ∈ Db.P.Γ.V ∧ StairSystem.GBack fa fb p θ Rt Out (cap.emb u) + (cap.emb v)} + have hpick : ∀ {y x}, y ∈ Db.P.Γ.hatV cap → ∀ {v}, x = cap.emb v → StairSystem.GBack fa fb p θ Rt + Out y x → (σv v).Nonempty := by + rintro y x ⟨u, hu, rfl⟩ v rfl hb + exact ⟨u, hu, hb⟩ + have hclass : ∀ A ∈ (coverLoc 𝒲a hfa hda fa).arms, ∃ W, A ∈ (fa W).arms + := fun A hA ↦ mem_iUnion.mp hA + refine ⟨?_, ?_, σv, σe, ⟨RootedLocation.M_le _, fun e he ↦ (hem e he).1, hsize, hinj, ?_, + fun _ _ _ hu ↦ hu.1, ?_, ?_, ?_⟩, hem, ?_, ?_, hle⟩ + · intro A hA + obtain ⟨W, hW⟩ := hclass A hA + refine mem_iUnion.mpr ⟨p W, ?_⟩ + rcases hW with ⟨i, hi, rfl⟩ | ⟨hc, rfl⟩ + · obtain ⟨q, hq, -, -, e⟩ := hτS W i hi + rw [e] + exact .inl ⟨q, hq, rfl⟩ + · obtain ⟨hc', e⟩ := hτH W hc + rw [e] + exact .inr ⟨hc', rfl⟩ + · -- `τ` is one to one. + intro A hA A' hA' he + obtain ⟨W, hW⟩ := hclass A hA + obtain ⟨W', hW'⟩ := hclass A' hA' + have hmem : ∀ {W A}, A ∈ (fa W).arms → τ A ∈ (fb (p W)).arms := by + rintro W _ (⟨i, hi, rfl⟩ | ⟨hc, rfl⟩) + · obtain ⟨q, hq, -, -, e⟩ := hτS W i hi + rw [e] + exact .inl ⟨q, hq, rfl⟩ + · obtain ⟨hc', e⟩ := hτH W hc + rw [e] + exact .inr ⟨hc', rfl⟩ + obtain rfl : W = W' := h.p_bij.1 (arm_wheel hdb (hmem hW) (he ▸ hmem hW')) + rcases hW with ⟨i, hi, rfl⟩ | ⟨hc, rfl⟩ <;> rcases hW' with ⟨i', hi', rfl⟩ | ⟨hc', rfl⟩ + · obtain ⟨q, hq, e₁, -, e⟩ := hτS W i hi + obtain ⟨q', hq', e₁', -, e'⟩ := hτS W i' hi' + rw [e, e'] at he + obtain rfl := (fb (p W)).secArm_inj hq hq' he + rw [← e₁, ← e₁'] + · obtain ⟨q, hq, -, -, e⟩ := hτS W i hi + obtain ⟨hc₂, e'⟩ := hτH W hc' + rw [e, e'] at he + exact absurd he (sec_ne_hub _ hc₂ q) + · obtain ⟨q, hq, -, -, e⟩ := hτS W i' hi' + obtain ⟨hc₂, e'⟩ := hτH W hc + rw [e, e'] at he + exact absurd he.symm (sec_ne_hub _ hc₂ q) + · rfl + · -- `σ(v)` is not empty. + rintro v ⟨hvV, hvA⟩ + have hV : cap.emb v ∈ Da.P.Γ.hatV cap := ⟨v, hvV, rfl⟩ + by_cases hin : ∃ W : ↥𝒲a, cap.emb v ∈ discInt W.1 + · obtain ⟨W, hW⟩ := hin + have hst := h.stair W + have hoff : ∀ A ∈ (fa W).arms, ∀ Δ X, IsDiscArm (fa W) A Δ X → cap.emb v ∉ discInt Δ + := fun A hA Δ X hc ↦ + (fa W).emb_notMem_discInt hc (hvA A (mem_iUnion.mpr ⟨W, hA⟩)) + rcases (fa W).mem_cases hV hW.1 hoff with ⟨i, hi, t, ht, e⟩ | hH + · obtain ⟨q, hq, rfl⟩ := hst.surj hi + have ht' : t ≤ (fb (p W)).top q := by + rw [hst.top_eq q hq] + exact ht + exact hpick ((fb (p W)).levV_hatV ht') rfl (.inr ⟨W, .inl ⟨q, hq, t, ht', rfl, e⟩⟩) + · obtain ⟨y, hy⟩ := hst.rt_a hH hV + exact hpick (hst.rt_hub hy).1.2 rfl (.inr ⟨W, .inr (.inl hy)⟩) + · push Not at hin + obtain ⟨y, hy⟩ := h.out_ne _ hV hin + exact hpick (h.out_hat hy).1 rfl (.inl hy) + · -- `σ(v)` is connected. + intro v _ a a' + obtain ⟨u, hu⟩ := a + obtain ⟨u', hu'⟩ := a' + exact reachable_of_skJoined (D := Db) (X := {y | StairSystem.GBack fa fb p θ Rt Out y + (cap.emb v)}) (T := σv v) (fun a ha hx ↦ ⟨ha, hx⟩) (h.gjoin hda hu.2 hu'.2) hu hu' rfl rfl + · -- The sets `σ(v)` are disjoint. + intro v₁ _ v₂ _ hne + refine disjoint_left.mpr fun u (h₁ : u ∈ σv v₁) (h₂ : u ∈ σv v₂) ↦ hne (hinjE + (h.gback_fun hdb h₁.2 h₂.2)) + · -- The ends. + intro e he i hi hi' + have ho := hends e he i hi hi' + obtain ⟨u, hu, hue⟩ := (h.out_hat ho).1 + have : u = (Db.P.Γ.γ (σe e))[i] := hinjE hue + exact ⟨this ▸ hu, .inl ho⟩ + · -- The marches. + intro A hA + obtain ⟨W, hW⟩ := hclass A hA + obtain ⟨h₁, h₂⟩ := hπ W A hW + refine ⟨h₁, fun i hi hi' ↦ ⟨?_, .inr ⟨W, h₂ i hi hi'⟩⟩⟩ + have hmem : (τ A).π[i] ∈ {v | v ∈ (τ A).π} := List.getElem_mem hi' + rw [(τ A).π_set] at hmem + exact (τ A).isSeparation.left_le.vertexSet_subset hmem.1 + · -- At most one vertex of `σ(v)` is in `τ(A)`. + intro A hA v _ + obtain ⟨W, hW⟩ := hclass A hA + have hfin : (σv v ∩ (τ A).V).Finite := Db.P.Γ.finite_V.subset fun _ hu ↦ hu.1.1 + refine (ncard_le_one hfin).mpr fun u hu u' hu' ↦ hinjE ?_ + have hhat : ∀ {a}, a ∈ σv v → cap.emb a ∈ Db.P.Γ.hatV cap := fun {a} ha ↦ ⟨a, ha.1, rfl⟩ + rcases hW with ⟨i, hi, rfl⟩ | ⟨hc, rfl⟩ + · obtain ⟨q, hq, -, hmove, e⟩ := hτS W i hi + have hV : ∀ {a}, a ∈ (τ ((fa W).secArm i)).V → cap.emb a ∈ ((fb (p W)).sec q).Δ ∪ (fb + (p W)).secX q := fun {a} ha ↦ by + rw [e] at ha + have h₂ : a ∈ ((fb (p W)).secArm q).minus.vertexSet := ha + rw [((fb (p W)).secArm_disc q).minus] at h₂ + exact h₂.2 + obtain ⟨b₁, s₁⟩ := h.onSec hq hmove (hhat hu.1) (hV hu.2) hdb hu.1.2 + obtain ⟨b₂, s₂⟩ := h.onSec hq hmove (hhat hu'.1) (hV hu'.2) hdb hu'.1.2 + exact (h.stair W).sector_unique hq hmove b₁ b₂ (hhat hu.1) (hhat hu'.1) s₁ s₂ + · obtain ⟨hc', e⟩ := hτH W hc + have hV : ∀ {a}, a ∈ (τ ((fa W).hubArm hc)).V → cap.emb a ∈ Db.ins (fb (p W)).H + := fun {a} ha ↦ by + rw [e] at ha + have h₂ : a ∈ ((fb (p W)).hubArm hc').minus.vertexSet := ha + rw [((fb (p W)).hubArm_disc hc').minus] at h₂ + have h₃ : cap.emb a ∈ Db.ins (fb (p W)).H ∪ ∅ := h₂.2 + rwa [union_empty] at h₃ + exact (h.stair W).rt_inj (h.onHub hc' (hhat hu.1) (hV hu.2) hdb hu.1.2) (h.onHub hc' + (hhat hu'.1) (hV hu'.2) hdb hu'.1.2) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14q.lean b/LeanPool/GraphMinor/GM19/Section14q.lean new file mode 100644 index 0000000000..ebfda6ef72 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14q.lean @@ -0,0 +1,269 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14p + +/-! +# Graph Minors XIX, Section 14: the surface `Σ'` + +Let `e` be an embedding of `Σ` in `Σ̂`, and let `𝒲` be a finite set of disjoint closed discs whose +boundaries lie in the interior of `Σ`, +such that the rest of `Σ̂`, and the boundary of `Σ`, lie inside the discs. We delete the insides of +the discs from `Σ`. The paper says +that the result `Σ'` is a surface with `Σ̂' ≅ Σ̂`. We prove this here, and we find the cuffs of +`Σ'`: they are the boundaries of the discs. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] + +/-- The hypotheses on the discs. -/ +structure IsCutData (e : S → Shat) (𝒲 : Set (Set Shat)) : Prop where + emb : IsClosedEmbedding e + finite : 𝒲.Finite + disc : ∀ W ∈ 𝒲, IsClosedDisc W + disj : 𝒲.PairwiseDisjoint id + bd_mem : ∀ W ∈ 𝒲, discBd W ⊆ e '' (bd S)ᶜ + cover : (⋃ W ∈ 𝒲, discInt W)ᶜ ⊆ e '' (bd S)ᶜ + +/-- The part of `Σ` that we delete. -/ +def cutT (e : S → Shat) (𝒲 : Set (Set Shat)) : Set S := e ⁻¹' ⋃ W ∈ 𝒲, discInt W + +/-- The boundary of `Σ'`, as a subset of `Σ`. -/ +def cutF (e : S → Shat) (𝒲 : Set (Set Shat)) : Set S := e ⁻¹' ⋃ W ∈ 𝒲, discBd W + +namespace IsCutData + +variable {e : S → Shat} {𝒲 : Set (Set Shat)} (h : IsCutData e 𝒲) +include h + +/-- `Σ'` and the complement of the insides of the discs are the same. -/ +noncomputable def homeo : ↥(cutT e 𝒲)ᶜ ≃ₜ ↥(⋃ W ∈ 𝒲, discInt W)ᶜ := + IsEmbedding.toHomeomorphOfSurjective (f := fun x : ↥(cutT e 𝒲)ᶜ ↦ (⟨e x.1, x.2⟩ : ↥(⋃ W ∈ 𝒲, + discInt W)ᶜ)) + (by + refine IsEmbedding.of_comp (Continuous.subtype_mk (h.emb.continuous.comp + continuous_subtype_val) _) continuous_subtype_val ?_ + exact h.emb.isEmbedding.comp IsEmbedding.subtypeVal) + (by + rintro ⟨y, hy⟩ + obtain ⟨x, -, rfl⟩ := h.cover hy + exact ⟨⟨x, hy⟩, rfl⟩) + +omit [T2Space S] [T2Space Shat] in +theorem homeo_val (x : ↥(cutT e 𝒲)ᶜ) : (h.homeo x).1 = e x.1 := rfl + +omit [T2Space S] [T2Space Shat] in +theorem bd_subset_T : bd S ⊆ cutT e 𝒲 := fun x hx ↦ by + by_contra hn + obtain ⟨y, hy, hxy⟩ := h.cover hn + exact hy (h.emb.injective hxy ▸ hx) + +omit [T2Space S] in +theorem isClosed_bd' {W : Set Shat} (hW : W ∈ 𝒲) : IsClosed (discBd W) := by + obtain ⟨f⟩ := (h.disc W hW).isOArc_discBd + have hc : IsCompact (discBd W) := by + have := isCompact_range (f := fun x : Circle ↦ (f x).1) (by fun_prop) + rwa [show range (fun x : Circle ↦ (f x).1) = discBd W by + ext y + exact ⟨by rintro ⟨x, rfl⟩; exact (f x).2, fun hy ↦ ⟨f.symm ⟨y, hy⟩, by simp⟩⟩] at this + exact hc.isClosed + +variable {Shat' : Type} [TopologicalSpace Shat'] + +omit [T2Space S] [T2Space Shat] in +/-- `Σ'` is a surface, it is connected, and its boundary is the union of the boundaries of the +discs. -/ +theorem surface_facts (hR : IsSurface Shat) [ConnectedSpace Shat] (hbd : bd Shat = ∅) : + IsClosed (cutT e 𝒲)ᶜ ∧ IsSurface ↥(cutT e 𝒲)ᶜ ∧ bd ↥(cutT e 𝒲)ᶜ = Subtype.val ⁻¹' cutF e 𝒲 + ∧ ConnectedSpace ↥(cutT e 𝒲)ᶜ := by + have hint : ∀ E ∈ 𝒲, ∀ x ∈ discBd E, IsInteriorPoint x := fun E _ x _ ↦ by + by_contra hn + have : x ∈ bd Shat := hn + rw [hbd] at this + exact this + obtain ⟨h₁, h₂, h₃, h₄⟩ := remove_discs hR h.finite h.disc hint h.disj + refine ⟨?_, isSurface_of_homeo h.homeo.symm h₂, ?_, ?_⟩ + · have : (cutT e 𝒲)ᶜ = e ⁻¹' (⋃ W ∈ 𝒲, discInt W)ᶜ := rfl + rw [this] + exact h₁.preimage h.emb.continuous + · rw [hbd, empty_union] at h₃ + ext x + have := image_bd h.homeo + constructor + · intro hx + have hm : h.homeo x ∈ bd ↥(⋃ W ∈ 𝒲, discInt W)ᶜ := by + rw [← this] + exact mem_image_of_mem _ hx + rw [h₃] at hm + exact hm + · intro hx + have hm : h.homeo x ∈ bd ↥(⋃ W ∈ 𝒲, discInt W)ᶜ := by + rw [h₃] + exact hx + rw [← this] at hm + obtain ⟨y, hy, hxy⟩ := hm + rwa [← h.homeo.injective hxy] + · exact h.homeo.symm.surjective.connectedSpace h.homeo.symm.continuous + +/-- The cuff of `Σ'` at a disc. -/ +def cuffAt (e : S → Shat) (𝒲 : Set (Set Shat)) (W : Set Shat) : Set ↥(cutT e 𝒲)ᶜ := Subtype.val ⁻¹' + (e ⁻¹' discBd W) + +omit [T2Space S] [T2Space Shat] in +theorem image_cuffAt {W : Set Shat} (hW : W ∈ 𝒲) : (fun x : ↥(cutT e 𝒲)ᶜ ↦ e x.1) '' cuffAt e 𝒲 W + = discBd W := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + exact hx + · intro hy + obtain ⟨x, -, rfl⟩ := h.bd_mem W hW hy + refine ⟨⟨x, fun hT ↦ ?_⟩, hy, rfl⟩ + obtain ⟨W', hW', hi⟩ := mem_iUnion₂.mp hT + by_cases e' : W = W' + · subst e' + exact hi.2 hy + · exact disjoint_left.mp (h.disj hW hW' e') (Surface.discBd_subset _ hy) hi.1 + +omit [T2Space S] [T2Space Shat] in +theorem isPreconnected_cuffAt {W : Set Shat} (hW : W ∈ 𝒲) : IsPreconnected (cuffAt e 𝒲 W) := by + have hem : IsEmbedding (fun x : ↥(cutT e 𝒲)ᶜ ↦ e x.1) := h.emb.isEmbedding.comp + IsEmbedding.subtypeVal + rw [hem.isInducing.isPreconnected_image.symm, h.image_cuffAt hW] + exact (h.disc W hW).isOArc_discBd.isPreconnected + +omit [T2Space S] in +theorem cuffs_eq (hR : IsSurface Shat) [ConnectedSpace Shat] (hbd : bd Shat + = ∅) : cuffs ↥(cutT e 𝒲)ᶜ = cuffAt e 𝒲 '' 𝒲 := by + classical + have hb := (h.surface_facts hR hbd).2.2.1 + have hcl : ∀ W ∈ 𝒲, IsClosed (cuffAt e 𝒲 W) := fun W hW ↦ ((h.isClosed_bd' hW).preimage + h.emb.continuous).preimage continuous_subtype_val + have key : ∀ W ∈ 𝒲, ∀ x ∈ cuffAt e 𝒲 W, connectedComponentIn (bd ↥(cutT e 𝒲)ᶜ) x = cuffAt e 𝒲 W + := by + intro W hW x hx + have hsub : cuffAt e 𝒲 W ⊆ bd ↥(cutT e 𝒲)ᶜ := fun y hy ↦ by + rw [hb] + exact mem_iUnion₂.mpr ⟨W, hW, hy⟩ + refine Subset.antisymm ?_ ((h.isPreconnected_cuffAt hW).subset_connectedComponentIn hx hsub) + set R := ⋃ W' ∈ 𝒲 \ {W}, cuffAt e 𝒲 W' with hRdef + have hRc : IsClosed R := (h.finite.subset sdiff_subset).isClosed_biUnion fun W' hW' ↦ hcl W' + hW'.1 + have hdis : Disjoint (cuffAt e 𝒲 W) R := by + refine disjoint_left.mpr fun y hy hyR ↦ ?_ + obtain ⟨W', hW', hyW⟩ := mem_iUnion₂.mp hyR + exact disjoint_left.mp (h.disj hW hW'.1 (Ne.symm hW'.2)) (Surface.discBd_subset _ hy) + (Surface.discBd_subset _ hyW) + have hcov : bd ↥(cutT e 𝒲)ᶜ ⊆ cuffAt e 𝒲 W ∪ R := fun y hy ↦ by + rw [hb] at hy + obtain ⟨W', hW', hyW⟩ := mem_iUnion₂.mp hy + by_cases e' : W' = W + · exact .inl (e' ▸ hyW) + · exact .inr (mem_iUnion₂.mpr ⟨W', ⟨hW', e'⟩, hyW⟩) + intro y hy + by_contra hny + have hxb := mem_connectedComponentIn (hsub hx) + have hsubb : connectedComponentIn (bd ↥(cutT e 𝒲)ᶜ) x ⊆ bd ↥(cutT e 𝒲)ᶜ + := connectedComponentIn_subset _ _ + obtain ⟨z, -, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp isPreconnected_connectedComponentIn _ _ + (hcl W hW) hRc (hsubb.trans hcov) + ⟨x, hxb, hx⟩ ⟨y, hy, (hcov (hsubb hy)).resolve_left hny⟩ + exact disjoint_left.mp hdis hz₁ hz₂ + ext C + constructor + · rintro ⟨x, hx, rfl⟩ + have hx' := hx + rw [hb] at hx' + obtain ⟨W, hW, hxW⟩ := mem_iUnion₂.mp hx' + exact ⟨W, hW, (key W hW x hxW).symm⟩ + · rintro ⟨W, hW, rfl⟩ + have hne : (discBd W).Nonempty := (IsOArc.isConnected' (h.disc W hW).isOArc_discBd).nonempty + rw [← h.image_cuffAt hW] at hne + obtain ⟨x, hx⟩ := hne.of_image + refine ⟨x, ?_, key W hW x hx⟩ + rw [hb] + exact mem_iUnion₂.mpr ⟨W, hW, hx⟩ + +omit [T2Space S] [T2Space Shat] in +theorem cuffAt_nonempty {W : Set Shat} (hW : W ∈ 𝒲) : (cuffAt e 𝒲 W).Nonempty := by + have hne : (discBd W).Nonempty := (IsOArc.isConnected' (h.disc W hW).isOArc_discBd).nonempty + rw [← h.image_cuffAt hW] at hne + exact hne.of_image + +omit [T2Space S] in +theorem closure_discInt {W : Set Shat} (hW : W ∈ 𝒲) : closure (discInt W) = W := + Subset.antisymm (closure_minimal (discInt_subset _) (h.disc W hW).isClosed) + (h.disc W hW).subset_closure_discInt + +omit [T2Space S] in +/-- The surface `Σ'` is capped by `Σ̂` itself, with the insides of the discs as the pasted discs. -/ +theorem nonempty_capped (hR : IsSurface Shat) [ConnectedSpace Shat] (hbd : bd Shat = ∅) : Nonempty + (IsCappedSurface ↥(cutT e 𝒲)ᶜ Shat) := by + classical + have hcu := h.cuffs_eq hR hbd + obtain ⟨h₁, h₂, h₃, h₄⟩ := h.surface_facts hR hbd + have hem : IsEmbedding (fun x : ↥(cutT e 𝒲)ᶜ ↦ e x.1) := h.emb.isEmbedding.comp + IsEmbedding.subtypeVal + have hex : ∀ Θ ∈ cuffs ↥(cutT e 𝒲)ᶜ, ∃ W ∈ 𝒲, cuffAt e 𝒲 W = Θ := fun Θ hΘ ↦ by + rw [hcu] at hΘ + exact hΘ + have hinj : ∀ W ∈ 𝒲, ∀ W' ∈ 𝒲, cuffAt e 𝒲 W = cuffAt e 𝒲 W' → W = W' := fun W hW W' hW' he ↦ by + by_contra hne + obtain ⟨x, hx⟩ := h.cuffAt_nonempty hW + exact disjoint_left.mp (h.disj hW hW' hne) (Surface.discBd_subset _ hx) + (Surface.discBd_subset _ (show x ∈ cuffAt e 𝒲 W' from he ▸ hx)) + let pick : Set ↥(cutT e 𝒲)ᶜ → Set Shat := fun Θ ↦ if hΘ : Θ ∈ cuffs ↥(cutT e 𝒲)ᶜ then + (hex Θ hΘ).choose else ∅ + have hpick : ∀ Θ (hΘ : Θ ∈ cuffs ↥(cutT e 𝒲)ᶜ), pick Θ ∈ 𝒲 ∧ cuffAt e 𝒲 (pick Θ) = Θ + := fun Θ hΘ ↦ by + simp only [pick, dite_eq_left hΘ] + exact (hex Θ hΘ).choose_spec + refine ⟨{ isSurface := hR, connected := inferInstance, bd_empty := hbd, emb + := fun x ↦ e x.1, isEmbedding := hem, cuffDisc := fun Θ ↦ discInt (pick Θ), cuffDisc_closedDisc + := ?_, cuffDisc_bd := ?_, cuffDisc_disjoint := ?_, compl_eq := ?_ }⟩ + · intro Θ hΘ + rw [h.closure_discInt (hpick Θ hΘ).1] + exact h.disc _ (hpick Θ hΘ).1 + · intro Θ hΘ + obtain ⟨h₅, h₆⟩ := hpick Θ hΘ + rw [h.closure_discInt h₅, ← h.image_cuffAt h₅, h₆] + · intro Θ₁ h₅ Θ₂ h₆ hne + obtain ⟨h₇, h₈⟩ := hpick Θ₁ h₅ + obtain ⟨h₉, h₁₀⟩ := hpick Θ₂ h₆ + rw [h.closure_discInt h₇, h.closure_discInt h₉] + exact h.disj h₇ h₉ fun he ↦ hne (h₈.symm.trans ((congrArg (cuffAt e 𝒲) he).trans h₁₀)) + · ext y + constructor + · intro hy + have hin : y ∈ ⋃ W ∈ 𝒲, discInt W := by + by_contra hn + obtain ⟨x, -, rfl⟩ := h.cover hn + exact hy ⟨⟨x, hn⟩, rfl⟩ + obtain ⟨W, hW, hyW⟩ := mem_iUnion₂.mp hin + have hc : cuffAt e 𝒲 W ∈ cuffs ↥(cutT e 𝒲)ᶜ := by + rw [hcu] + exact mem_image_of_mem _ hW + obtain ⟨h₅, h₆⟩ := hpick _ hc + refine mem_iUnion₂.mpr ⟨_, hc, ?_⟩ + rwa [hinj _ h₅ _ hW h₆] + · intro hy + obtain ⟨Θ, hΘ, hyΘ⟩ := mem_iUnion₂.mp hy + rintro ⟨x, rfl⟩ + exact x.2 (mem_iUnion₂.mpr ⟨_, (hpick Θ hΘ).1, hyΘ⟩) + +end IsCutData + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14r.lean b/LeanPool/GraphMinor/GM19/Section14r.lean new file mode 100644 index 0000000000..8aadce62a6 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14r.lean @@ -0,0 +1,135 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14q + +/-! +# Graph Minors XIX, Section 14: arcs of a cuff, and marked drawings +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S X : Type} [TopologicalSpace S] [TopologicalSpace X] [T2Space S] [T2Space X] {Θ : Set X} + +/-- A surface with finitely many marked points on its boundary, two on each cuff, gives a drawing +with the same arcs, in each surface that holds it. -/ +theorem exists_boundaryDrawing (hX : IsSurface X) {i : X → S} (hi : IsClosedEmbedding i) {N : Set + X} (hN : N.Finite) (hsub : N ⊆ bd X) + (h2 : ∀ C : cuffs X, ∃ p ∈ N ∩ C.1, ∃ q ∈ N ∩ C.1, p ≠ q) : + ∃ K : Drawing S, K.U = i '' bd X ∧ K.V = i '' N ∧ arcComponentsIn (K.U \ K.V) + = image i '' arcComponentsIn (bd X \ N) := by + have himd : i '' bd X \ i '' N = i '' (bd X \ N) := (image_sdiff hi.injective _ _).symm + have harc : arcComponentsIn (i '' (bd X \ N)) = image i '' arcComponentsIn (bd X \ N) := by + ext C + constructor + · intro hC + obtain ⟨c, hc, rfl⟩ := arcComponentsIn_image hi.isEmbedding hC + exact ⟨c, hc, rfl⟩ + · rintro ⟨c, hc, rfl⟩ + exact arcComponentsIn_image' hi.isEmbedding hc + refine ⟨{ + U := i '' bd X + V := i '' N + V_subset_U := image_mono hsub + isClosed_U := hi.isClosedMap _ (isClosed_bd X) + finite_V := hN.image i + finite_edges := ?_ + edge_cond := ?_ }, rfl, rfl, by simp only [himd, harc]⟩ + · simp only [himd, harc] + exact (finite_arcComponentsIn_bd hX hN h2).image _ + · simp only [himd, harc] + rintro _ ⟨c, hc, rfl⟩ + obtain ⟨C, a, b, hab, hub, rfl, hdis, ha, hb⟩ := exists_arc_of_mem hX (cuffPar hX) hN h2 hc + have hL := isLine_arcOf (cuffPar hX C) hab hub + have hne := (GM20.line_facts hL).1 + refine Or.inl ⟨i (cuffPoint (cuffPar hX C) a), i (cuffPoint (cuffPar hX C) b), + hi.injective.ne hne, ?_, ?_⟩ + · rw [hi.closure_image_eq, ← image_inter hi.injective] + have : closure (arcOf (cuffPar hX C) a b) ∩ N = + ({cuffPoint (cuffPar hX C) a, cuffPoint (cuffPar hX C) b} : Set X) := by + ext x + constructor + · rintro ⟨h₁, h₂⟩ + have ht : x ∈ tilde (arcOf (cuffPar hX C) a b) := ⟨h₁, fun h₃ ↦ disjoint_left.mp hdis h₃ + h₂⟩ + rwa [tilde_arcOf _ hab hub] at ht + · rintro (rfl | rfl) + · exact ⟨by rw [closure_arcOf _ hab]; exact ⟨a, ⟨le_rfl, hab.le⟩, rfl⟩, ha⟩ + · exact ⟨by rw [closure_arcOf _ hab]; exact ⟨b, ⟨hab.le, le_rfl⟩, rfl⟩, hb⟩ + rw [this, image_pair] + · rw [hi.closure_image_eq, closure_arcOf _ hab, image_image] + exact GM11.isLine_of_injOn (hi.continuous.comp (continuous_cuffPoint _)) hab + (hi.injective.comp_injOn (cuffPoint_injOn_Icc _ hub)) + +omit [T2Space X] in +/-- Two arcs of a cuff with no marked point on them and with the same first point are equal. -/ +theorem arc_head_eq {f : Circle ≃ₜ Θ} {W : Set X} {a b a' b' : ℝ} (hab : a < b) (hab' : a' < b') + (h₁ : arcOf f a b ∈ arcComponentsIn W) (h₂ : arcOf f a' b' ∈ arcComponentsIn W) + (e : cuffPoint f a = cuffPoint f a') : arcOf f a b = arcOf f a' b' := by + obtain ⟨m, hm⟩ := cuffPoint_eq f e + have hs := arcOf_shift f a' b' m + rw [← hs] at h₂ ⊢ + rw [← hm] at h₂ ⊢ + set c := b' + m * (2 * Real.pi) + have hc : a < c := by simp only [c]; rw [hm]; linarith + refine arcComp_eq_of_mem h₁ h₂ (x := cuffPoint f ((a + min b c) / 2)) ⟨_, ⟨?_, ?_⟩, rfl⟩ ⟨_, + ⟨?_, ?_⟩, rfl⟩ + all_goals have := lt_min hab hc + all_goals have h₃ := min_le_left b c + all_goals have h₄ := min_le_right b c + all_goals linarith + +omit [T2Space X] in +/-- Two arcs of a cuff with no marked point on them and with the same last point are equal. -/ +theorem arc_tail_eq {f : Circle ≃ₜ Θ} {W : Set X} {a b a' b' : ℝ} (hab : a < b) (hab' : a' < b') + (h₁ : arcOf f a b ∈ arcComponentsIn W) (h₂ : arcOf f a' b' ∈ arcComponentsIn W) + (e : cuffPoint f b = cuffPoint f b') : arcOf f a b = arcOf f a' b' := by + obtain ⟨m, hm⟩ := cuffPoint_eq f e + have hs := arcOf_shift f a' b' m + rw [← hs] at h₂ ⊢ + rw [← hm] at h₂ ⊢ + set c := a' + m * (2 * Real.pi) + have hc : c < b := by simp only [c]; rw [hm]; linarith + refine arcComp_eq_of_mem h₁ h₂ (x := cuffPoint f ((b + max a c) / 2)) ⟨_, ⟨?_, ?_⟩, rfl⟩ ⟨_, + ⟨?_, ?_⟩, rfl⟩ + all_goals have := max_lt hab hc + all_goals have h₃ := le_max_left a c + all_goals have h₄ := le_max_right a c + all_goals linarith + +/-- There are at most as many arcs as marked points. -/ +theorem ncard_arcs_le (hX : IsSurface X) {N : Set X} (hN : N.Finite) (h2 : ∀ C : cuffs X, ∃ p ∈ N ∩ + C.1, ∃ q ∈ N ∩ C.1, p ≠ q) : + (arcComponentsIn (bd X \ N)).ncard ≤ N.ncard := by + classical + rcases (arcComponentsIn (bd X \ N)).eq_empty_or_nonempty with he | ⟨c₀, hc₀⟩ + · rw [he] + simp + obtain ⟨x₀, -⟩ := hc₀.1 + have : Nonempty X := ⟨x₀⟩ + have hspec : ∀ c ∈ arcComponentsIn (bd X \ N), ∃ x : X, x ∈ N ∧ ∃ (C : cuffs X) (a b : ℝ), a < b + ∧ c = arcOf (cuffPar hX C) a b ∧ cuffPoint (cuffPar hX C) a = x := fun c hc ↦ by + obtain ⟨C, a, b, h₁, -, h₃, -, h₄, -⟩ := exists_arc_of_mem hX (cuffPar hX) hN h2 hc + exact ⟨_, h₄, C, a, b, h₁, h₃, rfl⟩ + choose! g hg using hspec + refine ncard_le_ncard_of_injOn g (fun c hc ↦ (hg c hc).1) (fun c hc c' hc' e ↦ ?_) hN + obtain ⟨-, C, a, b, h₁, rfl, h₃⟩ := hg c hc + obtain ⟨-, C', a', b', h₁', rfl, h₃'⟩ := hg _ hc' + rw [← h₃, ← h₃'] at e + obtain rfl : C = C' := by + by_contra hne + exact disjoint_left.mp (cuffs_disjoint' hne) (cuffPoint_mem _ _) (e.symm ▸ cuffPoint_mem _ _) + exact arc_head_eq h₁ h₁' hc hc' e + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14s.lean b/LeanPool/GraphMinor/GM19/Section14s.lean new file mode 100644 index 0000000000..47a783adc3 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14s.lean @@ -0,0 +1,314 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14r + +/-! +# Graph Minors XIX, Section 14: the code of a sector + +In the paper the hub and the spokes of the singular vertices are drawn in the flaw, so they are the +same for all the paintings. We do not +draw them. We record instead, for each sector, how its march `π` reads along the two spokes and +along the hub. There are finitely many +codes, since all the numbers are bounded in terms of the radius. Two sectors with the same code have +marches that correspond term by term. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +universe w + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} {D : TangleDatum cap χ} {W : Set Shat} + +namespace TangleDatum.WheelFrame + +variable (fr : WheelFrame D W) + +theorem finite_hubPts : (fr.H.U ∩ D.P.Γ.hatV cap).Finite := (D.P.Γ.finite_V.image _).subset + inter_subset_right + +open Classical in +/-- The vertices of `Γ` on the hub, in a fixed order: the order of the march of the hub sector, if +there is one. -/ +noncomputable def hubList : List Shat := + if hc : fr.H.V.ncard ≠ 1 then (fr.hubArm hc).π.map cap.emb else fr.finite_hubPts.toFinset.toList + +theorem hubList_of (hc : fr.H.V.ncard ≠ 1) : fr.hubList = (fr.hubArm hc).π.map cap.emb := by + rw [hubList, dite_eq_left hc] + +theorem mem_hubArm_π (hc : fr.H.V.ncard ≠ 1) {v : S} : v ∈ (fr.hubArm hc).π ↔ cap.emb v ∈ fr.H.U + ∧ v ∈ D.P.Γ.V := by + have : ConnectedSpace Shat := cap.connected + have hset : v ∈ (fr.hubArm hc).π ↔ v ∈ {v | v ∈ (fr.hubArm hc).π} := Iff.rfl + have hT : IsClosedSurface Shat := cap.isClosedSurface + obtain ⟨-, -, hi⟩ := fr.hub_data hc + have hdisc := fr.hubArm_disc hc + rw [hset, (fr.hubArm hc).π_set] + change v ∈ (fr.hubArm hc).minus.vertexSet ∩ (fr.hubArm hc).compl.vertexSet ↔ _ + rw [hdisc.minus, hdisc.compl] + constructor + · rintro ⟨⟨hv, h₁⟩, -, h₂⟩ + refine ⟨?_, hv⟩ + rw [closure_compl_disc hT hi.2.2.1] at h₂ + have h₃ : cap.emb v ∈ D.ins fr.H := by simpa using h₁ + rw [← hi.2.2.2.1] + by_contra hn + exact h₂ ⟨h₃, hn⟩ + · rintro ⟨h₁, hv⟩ + have h₂ : cap.emb v ∈ discBd (D.ins fr.H) := hi.2.2.2.1 ▸ h₁ + refine ⟨⟨hv, .inl (Surface.discBd_subset _ h₂)⟩, hv, ?_⟩ + rw [closure_compl_disc hT hi.2.2.1] + exact fun h₃ ↦ h₃.2 h₂ + +theorem mem_hubList {x : Shat} : x ∈ fr.hubList ↔ x ∈ fr.H.U ∧ x ∈ D.P.Γ.hatV cap := by + by_cases hc : fr.H.V.ncard ≠ 1 + · rw [fr.hubList_of hc] + simp only [List.mem_map] + constructor + · rintro ⟨v, hv, rfl⟩ + have := (fr.mem_hubArm_π hc).mp hv + exact ⟨this.1, v, this.2, rfl⟩ + · rintro ⟨h₁, v, hv, rfl⟩ + exact ⟨v, (fr.mem_hubArm_π hc).mpr ⟨h₁, hv⟩, rfl⟩ + · rw [hubList, dite_eq_right hc] + simp + +theorem hubList_nodup : fr.hubList.Nodup := by + by_cases hc : fr.H.V.ncard ≠ 1 + · rw [fr.hubList_of hc] + exact (fr.hubArm hc).π_nodup.map cap.isEmbedding.injective + · rw [hubList, dite_eq_right hc] + exact Finset.nodup_toList _ + +/-- The place in the hub list of the end of a spoke, or the length of the list if this end is not a +vertex of `Γ`. -/ +noncomputable def hIdx (i : ℕ) : ℕ := by + classical exact fr.hubList.idxOf (fr.levV i (fr.top i)) + +/-- A vertex of the hub lies on a spoke only at the end of the spoke. -/ +theorem hub_lev {x : Shat} (hx : x ∈ fr.hubList) {i t : ℕ} (ht : t ≤ fr.top i) : + x = fr.levV i t ↔ t = fr.top i ∧ + (haveI := Classical.decEq Shat; fr.hubList.idxOf x) = fr.hIdx i := by + classical + obtain ⟨hxH, hxV⟩ := fr.mem_hubList.mp hx + have hK := fr.spoke_spoke i + have hmemV : fr.R.inner fr.sp i ∈ D.rad.G.V := GraphWalk.support_mem_V _ + (GraphWalk.end_mem_support (fr.R.spoke fr.sp i)) + have hlen : GraphWalk.vertexAt (fr.R.spoke fr.sp i) (fr.R.spoke fr.sp i).length + = fr.R.inner fr.sp i := GraphWalk.vertexAt_length _ hmemV + have htl : 2 * t ≤ (fr.R.spoke fr.sp i).length := by + rw [top] at ht + omega + constructor + · rintro rfl + have hin : fr.levV i t ∈ hubSet D fr.H ∩ (walkDrawing D.rad.G (fr.R.spoke fr.sp i)).U := + ⟨(fr.hW.hubSet_facts).2.2.2 hxH, (mem_walkDrawing_U _ _).mpr (.inl (fr.levV_support ht))⟩ + rw [fr.hW.hubSet_inter_spoke hK] at hin + have e : 2 * t = (fr.R.spoke fr.sp i).length := GraphWalk.vertexAt_inj _ hK.1 htl le_rfl + (hin.trans hlen.symm) + have et : t = fr.top i := by + rw [top] + omega + refine ⟨et, ?_⟩ + rw [hIdx, ← et] + · rintro ⟨rfl, hi⟩ + have hlt : fr.hubList.idxOf (fr.levV i (fr.top i)) < fr.hubList.length := by + have : fr.hIdx i = fr.hubList.idxOf (fr.levV i (fr.top i)) := by + simp only [hIdx] + rw [← this, ← hi] + exact List.idxOf_lt_length_iff.mpr hx + have hmem := List.idxOf_lt_length_iff.mp hlt + have h' : fr.hubList.idxOf x = fr.hubList.idxOf (fr.levV i (fr.top i)) := hi + exact (List.idxOf_inj hx).mp h' + +/-- Addresses of the vertices of a sector: a place on one of the two spokes, or a place in the hub +list. -/ +abbrev Addr := (Bool × ℕ) ⊕ ℕ + +open Classical in +/-- The address of a vertex in the sector `i`. -/ +noncomputable def addr (i : ℕ) (v : S) : Addr := + if h : ∃ t ≤ fr.top i, cap.emb v = fr.levV i t then .inl (false, h.choose) + else if h : ∃ t ≤ fr.top (i + 1), cap.emb v = fr.levV (i + 1) t then .inl (true, h.choose) + else .inr (fr.hubList.idxOf (cap.emb v)) + +/-- The three kinds of address. -/ +theorem addr_spec {i : ℕ} {v : S} (hv : v ∈ (fr.secArm i).π) : + (∃ t ≤ fr.top i, fr.addr i v = .inl (false, t) ∧ cap.emb v = fr.levV i t) ∨ (∃ t ≤ fr.top + (i + 1), fr.addr i v = .inl (true, t) ∧ cap.emb v = fr.levV (i + 1) t) ∨ + ∃ j, fr.addr i v = .inr j ∧ fr.hubList[j]? = some (cap.emb v) := by + classical + have : ConnectedSpace Shat := cap.connected + have hT : IsClosedSurface Shat := cap.isClosedSurface + have hset : v ∈ {v | v ∈ (fr.secArm i).π} := hv + rw [(fr.secArm i).π_set] at hset + have hdisc := fr.secArm_disc i + change v ∈ (fr.secArm i).minus.vertexSet ∩ (fr.secArm i).compl.vertexSet at hset + rw [hdisc.minus, hdisc.compl] at hset + obtain ⟨⟨hvV, h₁⟩, -, h₂⟩ := hset + have hV : cap.emb v ∈ D.P.Γ.hatV cap := ⟨v, hvV, rfl⟩ + rw [closure_compl_disc hT hdisc.disc] at h₂ + have hcases : cap.emb v ∈ (fr.R.spoke fr.sp i).support ∨ cap.emb v ∈ (fr.R.spoke fr.sp + (i + 1)).support ∨ cap.emb v ∈ fr.H.U := by + rcases h₁ with h₁ | h₁ + · exact fr.bd_sector hV (by + by_contra hn + exact h₂ ⟨h₁, hn⟩) + · exact .inl (support_of_mem_U _ h₁.1.2 (D.rad.isPreRadial.2.1 hV)) + by_cases h₃ : ∃ t ≤ fr.top i, cap.emb v = fr.levV i t + · have hr : fr.addr i v = .inl (false, h₃.choose) := by rw [addr, dite_eq_left h₃] + exact .inl ⟨h₃.choose, h₃.choose_spec.1, hr, h₃.choose_spec.2⟩ + by_cases h₄ : ∃ t ≤ fr.top (i + 1), cap.emb v = fr.levV (i + 1) t + · have hr : fr.addr i v = .inl (true, h₄.choose) := by + rw [addr, dite_eq_right h₃, dite_eq_left h₄] + exact .inr (.inl ⟨h₄.choose, h₄.choose_spec.1, hr, h₄.choose_spec.2⟩) + have hH : cap.emb v ∈ fr.H.U := by + rcases hcases with h | h | h + · exact absurd (fr.exists_levV h hV) h₃ + · exact absurd (fr.exists_levV h hV) h₄ + · exact h + have hl := fr.mem_hubList.mpr ⟨hH, hV⟩ + refine .inr (.inr ⟨_, by rw [addr, dite_eq_right h₃, dite_eq_right h₄], ?_⟩) + rw [List.getElem?_eq_getElem (List.idxOf_lt_length_iff.mpr hl)] + simp [List.getElem_idxOf] + +open Classical in +/-- The places where the two spokes of a sector meet. -/ +noncomputable def same (i : ℕ) : Finset ℕ := (Finset.range (fr.top i + 1)).filter fun t ↦ fr.levV i + t = fr.levV (i + 1) t + +/-- The type of codes. -/ +abbrev CodeT := ℕ × ℕ × ℕ × ℕ × Finset ℕ × List Addr + +/-- **The code of a sector.** -/ +noncomputable def code (i : ℕ) : CodeT := + (fr.top i, fr.top (i + 1), fr.hIdx i, fr.hIdx (i + 1), fr.same i, (fr.secArm i).π.map (fr.addr i)) + +end TangleDatum.WheelFrame + +theorem finite_lists {β : Type} {A : Set β} (hA : A.Finite) (b : ℕ) : {l : List β | l.length ≤ b + ∧ ∀ x ∈ l, x ∈ A}.Finite := by + induction b with + | zero => + refine (finite_singleton ([] : List β)).subset ?_ + rintro l ⟨h, -⟩ + exact List.length_eq_zero_iff.mp (by omega) + | succ b ih => + refine (((hA.image2 List.cons ih)).insert []).subset ?_ + rintro l ⟨h₁, h₂⟩ + cases l with + | nil => exact .inl rfl + | cons x l => + refine .inr ⟨x, h₂ x (by simp), l, ⟨by simpa using h₁, fun y hy ↦ h₂ y (by simp [hy])⟩, rfl⟩ + +/-- The codes with all numbers at most `b`. -/ +def codeSet (b : ℕ) : Set TangleDatum.WheelFrame.CodeT := + {c | c.1 ≤ b ∧ c.2.1 ≤ b ∧ c.2.2.1 ≤ b ∧ c.2.2.2.1 ≤ b ∧ c.2.2.2.2.1 ⊆ Finset.range (b + 1) + ∧ c.2.2.2.2.2.length ≤ b ∧ + ∀ x ∈ c.2.2.2.2.2, (Sum.elim (fun p : Bool × ℕ ↦ p.2 ≤ b) (fun j ↦ j + ≤ b) : TangleDatum.WheelFrame.Addr → Prop) x} + +theorem finite_codeSet (b : ℕ) : (codeSet b).Finite := by + have hN : (Iic b).Finite := finite_Iic b + have hA : {x : TangleDatum.WheelFrame.Addr | Sum.elim (fun p : Bool × ℕ ↦ p.2 ≤ b) (fun j ↦ j + ≤ b) x}.Finite := by + refine ((((finite_univ (α := Bool)).prod hN).image Sum.inl).union (hN.image Sum.inr)).subset ?_ + rintro (⟨c, t⟩ | j) h + · exact .inl ⟨(c, t), ⟨mem_univ _, h⟩, rfl⟩ + · exact .inr ⟨j, h, rfl⟩ + have hF : {f : Finset ℕ | f ⊆ Finset.range (b + 1)}.Finite := (Finset.finite_toSet (Finset.range + (b + 1)).powerset).subset fun f hf ↦ Finset.mem_coe.mpr (Finset.mem_powerset.mpr hf) + refine (hN.prod (hN.prod (hN.prod (hN.prod (hF.prod (finite_lists hA b)))))).subset ?_ + rintro ⟨a, b', c, d, f, l⟩ ⟨h₁, h₂, h₃, h₄, h₅, h₆, h₇⟩ + exact ⟨h₁, h₂, h₃, h₄, h₅, h₆, h₇⟩ + +namespace TangleDatum.WheelFrame + +variable (fr : WheelFrame D W) + +theorem π_length_le (i : ℕ) : (fr.secArm i).π.length ≤ 2 * fr.ρ + 2 := by + have h := fr.sec_order_le i + have h₁ : (fr.secArm i).π.length = {v | v ∈ (fr.secArm i).π}.ncard := by + classical + have : {v | v ∈ (fr.secArm i).π} = ↑(fr.secArm i).π.toFinset := by + ext v + simp + rw [this, ncard_coe_finset, List.toFinset_card_of_nodup (fr.secArm i).π_nodup] + rw [h₁, (fr.secArm i).π_set] + exact h + +theorem hubList_length_le : fr.hubList.length ≤ 2 * fr.ρ + 2 := by + classical + by_cases hc : fr.H.V.ncard ≠ 1 + · rw [fr.hubList_of hc, List.length_map] + have h := fr.hub_order_le hc + have h₁ : (fr.hubArm hc).π.length = {v | v ∈ (fr.hubArm hc).π}.ncard := by + have : {v | v ∈ (fr.hubArm hc).π} = ↑(fr.hubArm hc).π.toFinset := by + ext v + simp + rw [this, ncard_coe_finset, List.toFinset_card_of_nodup (fr.hubArm hc).π_nodup] + rw [h₁, (fr.hubArm hc).π_set] + exact h + · rcases fr.hW.hub_cases with ⟨z, -, hU, -⟩ | ⟨-, -, h, -⟩ + · have h₁ := List.toFinset_card_of_nodup fr.hubList_nodup + have h₂ : fr.hubList.toFinset ⊆ {z} := fun x hx ↦ by + have := (fr.mem_hubList.mp (List.mem_toFinset.mp hx)).1 + rw [hU] at this + simpa using this + have h₃ := Finset.card_le_card h₂ + simp only [Finset.card_singleton] at h₃ + omega + · exact absurd h hc + +theorem top_le (i : ℕ) : fr.top i ≤ fr.ρ := by + have h := (fr.hW.spoke_length (fr.spoke_spoke i)).1 + rw [top] + omega + +theorem code_mem (i : ℕ) : fr.code i ∈ codeSet (2 * fr.ρ + 3) := by + classical + have h₁ := fr.top_le i + have h₂ := fr.top_le (i + 1) + have hL := fr.hubList_length_le + have hI : ∀ j, fr.hIdx j ≤ 2 * fr.ρ + 3 := fun j ↦ by + have := List.idxOf_le_length (a := fr.levV j (fr.top j)) (l := fr.hubList) + simp only [hIdx] + omega + refine ⟨by simp only [code]; omega, by simp only [code]; omega, hI _, hI _, ?_, ?_, ?_⟩ + · intro t ht + have := (Finset.mem_filter.mp ht).1 + simp only [Finset.mem_range] at this ⊢ + omega + · have := fr.π_length_le i + simp only [code, List.length_map] + omega + · simp only [code, List.mem_map] + rintro _ ⟨v, hv, rfl⟩ + rcases fr.addr_spec hv with ⟨t, ht, e, -⟩ | ⟨t, ht, e, -⟩ | ⟨j, e, hj⟩ + · rw [e] + simp only [Sum.elim_inl] + omega + · rw [e] + simp only [Sum.elim_inl] + omega + · rw [e] + have := (List.getElem?_eq_some_iff.mp hj).1 + simp only [Sum.elim_inr] + omega + +end TangleDatum.WheelFrame + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14t.lean b/LeanPool/GraphMinor/GM19/Section14t.lean new file mode 100644 index 0000000000..3d10ffc6c6 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14t.lean @@ -0,0 +1,237 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14s + +/-! +# Graph Minors XIX, Section 14: a staircase from a walk around the rim + +We walk around the rim of a wheel of `Γ_j` and follow the inflation. At each step we stay at the +same vertex of the rim of `Γ_i`, or we +move to the next one, and then the two sectors have the same code. This gives a staircase in the +sense of `Stair`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +universe w + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} {D Da Db : TangleDatum cap χ} {W Wa Wb : + Set Shat} + +namespace TangleDatum.WheelFrame + +theorem spoke_len_of_inner (fr : WheelFrame D W) {i j : ℕ} (h : fr.R.inner fr.sp i + = fr.R.inner fr.sp j) : (fr.R.spoke fr.sp i).length = (fr.R.spoke fr.sp j).length := by + have key : ∀ {v₁ v₂ h₁ h₂ : Shat} (K₁ : GraphWalk D.rad.G.toGraph v₁ h₁) + (K₂ : GraphWalk D.rad.G.toGraph v₂ h₂), h₁ = h₂ → v₁ ∈ D.P.Γ.hatV cap → v₂ ∈ D.P.Γ.hatV cap → + D.IsSpokeWalk W fr.H K₁ → D.IsSpokeWalk W fr.H K₂ → K₁.length = K₂.length := by + rintro v₁ v₂ h₁ h₂ K₁ K₂ rfl h₃ h₄ h₅ h₆ + exact spoke_length_eq fr.hW h₃ h₄ h₅ h₆ + exact key _ _ h (fr.vert_hatV i) (fr.vert_hatV j) (fr.spoke_spoke i) (fr.spoke_spoke j) + +theorem lev_top_eq_inner (fr : WheelFrame D W) {i : ℕ} (h : fr.levV i + (fr.top i) ∈ fr.hubList) : fr.levV i (fr.top i) = fr.R.inner fr.sp i ∧ Even + (fr.R.spoke fr.sp i).length := by + have hK := fr.spoke_spoke i + have hin : fr.levV i (fr.top i) ∈ hubSet D fr.H ∩ (walkDrawing D.rad.G (fr.R.spoke fr.sp i)).U := + ⟨(fr.hW.hubSet_facts).2.2.2 (fr.mem_hubList.mp h).1, (mem_walkDrawing_U _ _).mpr (.inl + (fr.levV_support le_rfl))⟩ + rw [fr.hW.hubSet_inter_spoke hK] at hin + have hmemV : fr.R.inner fr.sp i ∈ D.rad.G.V := GraphWalk.support_mem_V _ + (GraphWalk.end_mem_support (fr.R.spoke fr.sp i)) + have hlen : GraphWalk.vertexAt (fr.R.spoke fr.sp i) (fr.R.spoke fr.sp i).length + = fr.R.inner fr.sp i := GraphWalk.vertexAt_length _ hmemV + have htl : 2 * fr.top i ≤ (fr.R.spoke fr.sp i).length := by + rw [top] + omega + have e : 2 * fr.top i = (fr.R.spoke fr.sp i).length := GraphWalk.vertexAt_inj _ hK.1 htl le_rfl + (hin.trans hlen.symm) + exact ⟨hin, ⟨fr.top i, by omega⟩⟩ + +theorem lev_top_of_even (fr : WheelFrame D W) {i : ℕ} (h : Even (fr.R.spoke fr.sp i).length) : + fr.levV i (fr.top i) = fr.R.inner fr.sp i := by + have hmemV : fr.R.inner fr.sp i ∈ D.rad.G.V := GraphWalk.support_mem_V _ + (GraphWalk.end_mem_support (fr.R.spoke fr.sp i)) + have hlen : GraphWalk.vertexAt (fr.R.spoke fr.sp i) (fr.R.spoke fr.sp i).length + = fr.R.inner fr.sp i := GraphWalk.vertexAt_length _ hmemV + rw [← hlen, levV, top] + obtain ⟨c, hc⟩ := h + congr 1 + omega + +/-- Two spokes with the same inner end have the same place in the hub list. -/ +theorem hIdx_of_reg (fr : WheelFrame D W) {i j : ℕ} (h : fr.R.inner fr.sp i + = fr.R.inner fr.sp j) : fr.hIdx i = fr.hIdx j := by + classical + have hl := fr.spoke_len_of_inner h + by_cases h₁ : fr.levV i (fr.top i) ∈ fr.hubList + · obtain ⟨e, ev⟩ := fr.lev_top_eq_inner h₁ + have e' := fr.lev_top_of_even (i := j) (hl ▸ ev) + simp only [hIdx] + rw [e, e', h] + · by_cases h₂ : fr.levV j (fr.top j) ∈ fr.hubList + · obtain ⟨e, ev⟩ := fr.lev_top_eq_inner h₂ + have e' := fr.lev_top_of_even (i := i) (hl.symm ▸ ev) + rw [e', h, ← e] at h₁ + exact absurd h₂ h₁ + · simp only [hIdx] + rw [List.idxOf_of_notMem h₁, List.idxOf_of_notMem h₂] + +theorem hIdx_congr (fr : WheelFrame D W) {i j : ℕ} (h : fr.R.vert i = fr.R.vert j) : fr.hIdx i + = fr.hIdx j := by + classical + simp only [hIdx] + rw [fr.top_congr h, fr.levV_congr h] + +end TangleDatum.WheelFrame + +open TangleDatum.WheelFrame in +/-- The pairing of the vertices of `Γ` on two hubs. -/ +def rtOf (a : WheelFrame Da Wa) (b : WheelFrame Db Wb) (y x : Shat) : Prop + := ∃ j : ℕ, b.hubList[j]? = some y ∧ a.hubList[j]? = some x + +/-- The walk around the rim, in the form that the inflation gives. -/ +structure RimWalk (a : WheelFrame Da Wa) (b : WheelFrame Db Wb) (Out : Shat → Shat → Prop) (Sym : ℕ + → ℕ → Prop) : Prop where + out_fun : ∀ {y x x'}, Out y x → Out y x' → x = x' + base : Out (b.R.vert 0) (a.R.vert 0) + last : Out (b.R.vert (b.R.k - 1)) (a.R.vert (a.R.k - 1)) + step : ∀ q p, q + 1 < b.R.k → p < a.R.k → Out (b.R.vert q) (a.R.vert p) → + (Out (b.R.vert (q + 1)) (a.R.vert p) ∧ b.Reg q) ∨ (p + 1 < a.R.k ∧ Out (b.R.vert (q + 1)) + (a.R.vert (p + 1)) ∧ Sym q p) + last_sym : Sym (b.R.k - 1) (a.R.k - 1) + sym_code : ∀ q p, Sym q p → b.code q = a.code p + hub_len : b.hubList.length = a.hubList.length + +theorem RimWalk.exists_stair {a : WheelFrame Da Wa} {b : WheelFrame Db Wb} {Out : Shat → Shat + → Prop} {Sym : ℕ → ℕ → Prop} (h : RimWalk a b Out Sym) : + ∃ θ, Stair a b θ (rtOf a b) ∧ (∀ q < b.R.k, Out (b.R.vert q) (a.R.vert (θ q))) ∧ + (∀ q, q + 1 < b.R.k → θ (q + 1) = θ q + 1 → Sym q (θ q)) := by + classical + have ha2 := a.R.two + have hb2 := b.R.two + have hex : ∀ q < b.R.k, ∃ p, p < a.R.k ∧ Out (b.R.vert q) (a.R.vert p) := by + intro q + induction q with + | zero => exact fun _ ↦ ⟨0, by omega, h.base⟩ + | succ q ih => + intro hq + obtain ⟨p, hp, ho⟩ := ih (by omega) + rcases h.step q p hq hp ho with ⟨h₁, -⟩ | ⟨h₁, h₂, -⟩ + · exact ⟨p, hp, h₁⟩ + · exact ⟨p + 1, h₁, h₂⟩ + choose! θ hθ hO using hex + have huniq : ∀ q p, q < b.R.k → p < a.R.k → Out (b.R.vert q) (a.R.vert p) → θ q = p + := fun q p hq hp ho ↦ + a.R.vert_inj (hθ q hq) hp (h.out_fun (hO q hq) ho) + have hcase : ∀ q, q + 1 < b.R.k → (θ (q + 1) = θ q ∧ b.Reg q) ∨ (θ (q + 1) = θ q + 1 ∧ Sym q + (θ q)) := by + intro q hq + have hq' : q < b.R.k := by omega + rcases h.step q (θ q) hq (hθ q hq') (hO q hq') with ⟨h₁, h₂⟩ | ⟨h₁, h₂, h₃⟩ + · exact .inl ⟨huniq _ _ hq (hθ q hq') h₁, h₂⟩ + · exact .inr ⟨huniq _ _ hq h₁ h₂, h₃⟩ + have hc := h.sym_code _ _ h.last_sym + have hk : ∀ {D' : TangleDatum cap χ} {W' : Set Shat} (fr : WheelFrame D' W'), fr.R.vert + (fr.R.k - 1 + 1) = fr.R.vert 0 := fun fr ↦ by + have := fr.R.two + rw [show fr.R.k - 1 + 1 = 0 + fr.R.k by omega] + exact fr.R.vert_add_k 0 + simp only [WheelFrame.code, Prod.mk.injEq] at hc + obtain ⟨-, ct, -, ci, cs, -⟩ := hc + have hsym : ∀ {q p}, Sym q p → (b.top q = a.top p ∧ b.top (q + 1) = a.top (p + 1)) ∧ (b.hIdx q + = a.hIdx p ∧ b.hIdx (q + 1) = a.hIdx (p + 1)) ∧ b.same q = a.same p := fun hs ↦ by + have := h.sym_code _ _ hs + simp only [WheelFrame.code, Prod.mk.injEq] at this + exact ⟨⟨this.1, this.2.1⟩, ⟨this.2.2.1, this.2.2.2.1⟩, this.2.2.2.2.1⟩ + have h0 : θ 0 = 0 := huniq 0 0 (by omega) (by omega) h.base + have hl : θ (b.R.k - 1) = a.R.k - 1 := huniq _ _ (by omega) (by omega) h.last + have htop : ∀ q < b.R.k, b.top q = a.top (θ q) ∧ b.hIdx q = a.hIdx (θ q) := by + intro q + induction q with + | zero => + intro _ + rw [h0, ← b.top_congr (hk b), ← a.top_congr (hk a), ← b.hIdx_congr (hk b), + ← a.hIdx_congr (hk a)] + exact ⟨ct, ci⟩ + | succ q ih => + intro hq + obtain ⟨i₁, i₂⟩ := ih (by omega) + rcases hcase q hq with ⟨e, hr⟩ | ⟨e, hs⟩ + · rw [e, ← i₁, ← i₂] + exact ⟨(b.top_eq_of_inner hr).symm, (b.hIdx_of_reg hr).symm⟩ + · rw [e] + exact ⟨(hsym hs).1.2, (hsym hs).2.1.2⟩ + have hsame : ∀ {D' : TangleDatum cap χ} {W' : Set Shat} (fr : WheelFrame D' W') (i t : ℕ), t + ≤ fr.top i → (t ∈ fr.same i ↔ fr.levV i t = fr.levV (i + 1) t) := fun fr i t ht ↦ by + simp only [WheelFrame.same, Finset.mem_filter, Finset.mem_range] + exact ⟨fun h' ↦ h'.2, fun h' ↦ ⟨by omega, h'⟩⟩ + have hget : ∀ {D' : TangleDatum cap χ} {W' : Set Shat} (fr : WheelFrame D' W') {j : ℕ} {x : + Shat}, fr.hubList[j]? = some x → x ∈ fr.hubList ∧ fr.hubList.idxOf x = j := fun fr j x hj ↦ by + obtain ⟨hlt, e⟩ := List.getElem?_eq_some_iff.mp hj + have hm : x ∈ fr.hubList := e ▸ List.getElem_mem hlt + refine ⟨hm, ?_⟩ + rw [← e] + exact fr.hubList_nodup.idxOf_getElem _ hlt + refine ⟨θ, ⟨h0, hl, fun q hq ↦ ?_, fun q hq ↦ (htop q hq).1, fun q hq hs ↦ ?_, + fun q hq hm t ht ↦ ?_, fun t ht ↦ ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩, hO, fun q hq hm ↦ ?_⟩ + · rcases hcase q hq with ⟨e, -⟩ | ⟨e, -⟩ + · exact .inl e + · exact .inr e + · rcases hcase q hq with ⟨e, hr⟩ | ⟨e, -⟩ + · exact hr + · omega + · rcases hcase q hq with ⟨e, -⟩ | ⟨-, hs⟩ + · omega + · rw [← hsame b q t ht, (hsym hs).2.2, + hsame a (θ q) t (by rw [← (htop q (by omega)).1]; exact ht)] + · have ht' : t ≤ a.top (a.R.k - 1) := by rw [← hl, ← (htop _ (by omega)).1]; exact ht + rw [← b.levV_congr (hk b), ← a.levV_congr (hk a), ← hsame b _ t ht, cs, hsame a _ t ht'] + · rintro y x x' ⟨j, h₁, h₂⟩ ⟨j', h₃, h₄⟩ + have e : j = j' := ((hget b h₁).2).symm.trans (hget b h₃).2 + subst e + exact Option.some.inj (h₂.symm.trans h₄) + · rintro y y' x ⟨j, h₁, h₂⟩ ⟨j', h₃, h₄⟩ + have e : j = j' := ((hget a h₂).2).symm.trans (hget a h₄).2 + subst e + exact Option.some.inj (h₁.symm.trans h₃) + · rintro y x ⟨j, h₁, h₂⟩ + have := b.mem_hubList.mp (hget b h₁).1 + have := a.mem_hubList.mp (hget a h₂).1 + tauto + · intro y hy hV + have hm := b.mem_hubList.mpr ⟨hy, hV⟩ + have hlt := List.idxOf_lt_length_iff.mpr hm + refine ⟨a.hubList[b.hubList.idxOf y]'(h.hub_len ▸ hlt), _, ?_, List.getElem?_eq_getElem _⟩ + rw [List.getElem?_eq_getElem hlt] + simp + · intro x hx hV + have hm := a.mem_hubList.mpr ⟨hx, hV⟩ + have hlt := List.idxOf_lt_length_iff.mpr hm + refine ⟨b.hubList[a.hubList.idxOf x]'(h.hub_len ▸ hlt), _, List.getElem?_eq_getElem _, ?_⟩ + rw [List.getElem?_eq_getElem hlt] + simp + · rintro y x ⟨j, h₁, h₂⟩ q hq t ht + obtain ⟨hmb, eb⟩ := hget b h₁ + obtain ⟨hma, ea⟩ := hget a h₂ + obtain ⟨e₁, e₂⟩ := htop q hq + rw [a.hub_lev hma (i := θ q) (by rw [← e₁]; exact ht), b.hub_lev hmb ht, ea, eb, e₁, e₂] + · rcases hcase q hq with ⟨e, -⟩ | ⟨-, hs⟩ + · omega + · exact hs + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14u.lean b/LeanPool/GraphMinor/GM19/Section14u.lean new file mode 100644 index 0000000000..cbf1116fed --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14u.lean @@ -0,0 +1,246 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14t + +/-! +# Graph Minors XIX, Section 14: the outline `τ` + +Here we define `τ` on the sectors and the hub sectors, as in the paper, and we check that the +marches correspond. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +universe w + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} {Da Db : TangleDatum cap χ} {𝒲a 𝒲b : Set + (Set Shat)} + +/-- An arm with nothing in it. -/ +def trivialArm (Γ : Painting S) : Arm Γ where + minus := Γ.toHypergraph + compl := ⟨∅, ∅, fun _ _ ↦ False, fun _ _ h ↦ h.elim, fun _ _ h ↦ h.elim, finite_empty, + finite_empty⟩ + isSeparation := by + refine ⟨le_refl _, ⟨empty_subset _, empty_subset _, fun e he ↦ he.elim⟩, ?_, inter_empty _⟩ + refine Hypergraph.ext (union_empty _) (union_empty _) ?_ + funext e v + apply propext + change _ ∨ False ↔ _ + simp + π := [] + π_nodup := List.nodup_nil + π_set := by + ext v + simp only [mem_ofPred_eq, List.not_mem_nil, false_iff] + exact fun h ↦ h.2.elim + +/-- The march of the image of a sector corresponds to the march of the sector. -/ +theorem Stair.back_π {Wa Wb : Set Shat} {a : WheelFrame Da Wa} {b : WheelFrame Db Wb} {θ : ℕ → ℕ} + (h : Stair a b θ (rtOf a b)) {q : ℕ} (hq : q < b.R.k) + (hmove : q + 1 < b.R.k → θ (q + 1) = θ q + 1) (hlast : b.R.k ≤ q + 1 → θ q + 1 = a.R.k) + (hc : b.code q = a.code (θ q)) : + (b.secArm q).π.length = (a.secArm (θ q)).π.length ∧ ∀ (n : ℕ) (hn : n < (a.secArm + (θ q)).π.length) (hn' : n < (b.secArm q).π.length), + Stair.Back a b θ (rtOf a b) (cap.emb (b.secArm q).π[n]) (cap.emb (a.secArm (θ q)).π[n]) := by + have hl := congrArg (fun c : WheelFrame.CodeT ↦ c.2.2.2.2.2) hc + simp only [WheelFrame.code] at hl + have hlen := congrArg List.length hl + simp only [List.length_map] at hlen + refine ⟨hlen, fun n hn hn' ↦ ?_⟩ + have he : b.addr q (b.secArm q).π[n] = a.addr (θ q) (a.secArm (θ q)).π[n] := by + have := List.getElem_of_eq hl (i := n) (by simpa using hn') + simpa using this + have hlev₂ : ∀ t, t ≤ b.top (q + 1) → b.levV (q + 1) t = b.levV (q + 1) t → Stair.Lev a b θ + (b.levV (q + 1) t) (a.levV (θ q + 1) t) := by + intro t ht _ + by_cases hq₁ : q + 1 < b.R.k + · exact ⟨q + 1, hq₁, t, ht, rfl, by rw [hmove hq₁]⟩ + · have h₁ : q + 1 = 0 + b.R.k := by omega + have h₂ := hlast (by omega) + have hb : b.R.vert (q + 1) = b.R.vert 0 := by rw [h₁]; exact b.R.vert_add_k 0 + have ha : a.R.vert (θ q + 1) = a.R.vert 0 := by + rw [h₂, show a.R.k = 0 + a.R.k by omega] + exact a.R.vert_add_k 0 + exact ⟨0, by omega, t, by rw [← b.top_congr hb]; exact ht, + b.levV_congr hb t, by rw [h.zero]; exact a.levV_congr ha t⟩ + rcases b.addr_spec (List.getElem_mem hn') with ⟨t, ht, e, ey⟩ | ⟨t, ht, e, ey⟩ | ⟨j, e, ey⟩ <;> + rcases a.addr_spec (List.getElem_mem hn) with + ⟨t', ht', e', ex⟩ | ⟨t', ht', e', ex⟩ | ⟨j', e', ex⟩ <;> + rw [e, e'] at he <;> + simp only [Sum.inl.injEq, Prod.mk.injEq, reduceCtorEq, false_and, Sum.inr.injEq, true_and, + Bool.false_eq_true, Bool.true_eq_false] at he + · obtain rfl := he + exact .inl ⟨q, hq, t, ht, ey, ex⟩ + · obtain rfl := he + rw [ey, ex] + exact .inl (hlev₂ t ht rfl) + · obtain rfl := he + exact .inr (.inl ⟨j, ey, ex⟩) + +theorem Stair.exists_top {Wa Wb : Set Shat} {a : WheelFrame Da Wa} {b : WheelFrame Db Wb} {θ : ℕ + → ℕ} {R : Shat → Shat → Prop} (h : Stair a b θ R) {p : ℕ} (hp : p < a.R.k) : + ∃ q < b.R.k, θ q = p ∧ (q + 1 < b.R.k → θ (q + 1) = θ q + 1) ∧ (b.R.k ≤ q + 1 → θ q + 1 + = a.R.k) := by + classical + obtain ⟨q₀, hq₀, e₀⟩ := h.surj hp + have hex : ∃ q, q < b.R.k ∧ θ q = p := ⟨q₀, hq₀, e₀⟩ + have hbd : ∀ q, (q < b.R.k ∧ θ q = p) → q ≤ b.R.k := fun q hq ↦ hq.1.le + let q := Nat.findGreatest (fun q ↦ q < b.R.k ∧ θ q = p) b.R.k + have hs : q < b.R.k ∧ θ q = p := Nat.findGreatest_spec (P := fun q ↦ q < b.R.k ∧ θ q = p) + (hbd q₀ ⟨hq₀, e₀⟩) ⟨hq₀, e₀⟩ + refine ⟨q, hs.1, hs.2, fun hq ↦ ?_, fun hq ↦ ?_⟩ + · rcases h.step q hq with e | e + · have : q + 1 ≤ q := Nat.le_findGreatest (P := fun q ↦ q < b.R.k ∧ θ q + = p) hq.le ⟨hq, e.trans hs.2⟩ + omega + · exact e + · have h₁ : q = b.R.k - 1 := by have := hs.1; omega + rw [h₁, h.last] + have := a.R.two + omega + +/-- The hypotheses of the outline, for two sequences of wheels. -/ +structure OutlineData (fa : ∀ W : ↥𝒲a, WheelFrame Da W.1) (fb : ∀ W : ↥𝒲b, WheelFrame Db W.1) + (p : ↥𝒲a → ↥𝒲b) (Out : Shat → Shat → Prop) (Sym : ↥𝒲a → ℕ → ℕ → Prop) {β : Type*} + (Ω : QuasiOrder β) + (ξa : Arm Da.P.Γ → β) (ξb : Arm Db.P.Γ → β) : Prop where + p_bij : Function.Bijective p + out_fun : ∀ {y x x'}, Out y x → Out y x' → x = x' + walk : ∀ W, RimWalk (fa W) (fb (p W)) Out (Sym W) + sym_le : ∀ W q i, Sym W q i → Ω.le (ξa ((fa W).secArm i)) (ξb ((fb (p W)).secArm q)) + hub : ∀ W (hc : (fa W).H.V.ncard ≠ 1), ∃ hc' : (fb (p W)).H.V.ncard ≠ 1, Ω.le (ξa + ((fa W).hubArm hc)) (ξb ((fb (p W)).hubArm hc')) + out_hat : ∀ {y x}, Out y x → y ∈ Db.P.Γ.hatV cap ∧ x ∈ Da.P.Γ.hatV cap + out_off_b : ∀ {y x}, Out y x → ∀ W : ↥𝒲b, y ∉ discInt W.1 + out_off_a : ∀ {y x}, Out y x → ∀ W : ↥𝒲a, x ∉ discInt W.1 + out_ne : ∀ x ∈ Da.P.Γ.hatV cap, (∀ W : ↥𝒲a, x ∉ discInt W.1) → ∃ y, Out y x + out_conn : ∀ {y y' x}, Out y x → Out y' x → Relation.ReflTransGen (OutStep fb Out x) y y' + +/-- **The outline of (14.1).** -/ +theorem OutlineData.exists_outline {fa : ∀ W : ↥𝒲a, WheelFrame Da W.1} {fb : ∀ W : ↥𝒲b, WheelFrame + Db W.1} {p : ↥𝒲a → ↥𝒲b} {Out : Shat → Shat → Prop} {Sym : ↥𝒲a → ℕ → ℕ + → Prop} {β : Type*} {Ω : QuasiOrder β} + {ξa : Arm Da.P.Γ → β} {ξb : Arm Db.P.Γ → β} (h : OutlineData fa fb p Out Sym Ω ξa ξb) + (hd : χ.IsDisjoint) (hfa : 𝒲a.Finite) (hda : 𝒲a.PairwiseDisjoint id) (hfb : 𝒲b.Finite) + (hdb : 𝒲b.PairwiseDisjoint id) + (σe : Set S → Set S) + (hem : ∀ e ∈ (coverLoc 𝒲a hfa hda fa).M.edgeSet, σe e ∈ (coverLoc 𝒲b hfb hdb fb).M.edgeSet) + (hsize : ∀ e ∈ (coverLoc 𝒲a hfa hda fa).M.edgeSet, (tilde (σe e)).ncard = (tilde e).ncard) + (hinj : InjOn σe (coverLoc 𝒲a hfa hda fa).M.edgeSet) + (hends : ∀ e ∈ (coverLoc 𝒲a hfa hda fa).M.edgeSet, ∀ (i : ℕ) (hi : i < (Da.P.Γ.γ e).length) + (hi' : i < (Db.P.Γ.γ (σe e)).length), + Out (cap.emb (Db.P.Γ.γ (σe e))[i]) (cap.emb (Da.P.Γ.γ e)[i])) + (hle : ∀ e ∈ (coverLoc 𝒲a hfa hda fa).M.edgeSet, χ.unionLE (Da.P.φ e) (Db.P.φ (σe e))) : + ∃ τ : Arm Da.P.Γ → Arm Db.P.Γ, IsOutline (⟨hd, Da.P, coverLoc 𝒲a hfa hda fa⟩ : Place χ) ⟨hd, + Db.P, coverLoc 𝒲b hfb hdb fb⟩ τ ∧ + ∀ A ∈ (coverLoc 𝒲a hfa hda fa).arms, Ω.le (ξa A) (ξb (τ A)) := by + classical + have hst : ∀ W, ∃ θ, Stair (fa W) (fb (p W)) θ (rtOf (fa W) (fb (p W))) ∧ (∀ q < (fb + (p W)).R.k, Out ((fb (p W)).R.vert q) ((fa W).R.vert (θ q))) ∧ + (∀ q, q + 1 < (fb (p W)).R.k → θ (q + 1) = θ q + 1 → Sym W q (θ q)) := fun W ↦ + (h.walk W).exists_stair + choose θ hθ hrim hsym using hst + have hsys : StairSystem fa fb p θ (fun W ↦ rtOf (fa W) (fb (p W))) Out := + ⟨h.p_bij, hθ, h.out_fun, h.out_hat, h.out_off_b, h.out_off_a, hrim, h.out_ne, h.out_conn⟩ + have hS : ∀ W q, q < (fb (p W)).R.k → (q + 1 < (fb (p W)).R.k → θ W (q + 1) = θ W q + 1) + → Sym W q (θ W q) := fun W q hq hm ↦ by + by_cases hq₁ : q + 1 < (fb (p W)).R.k + · exact hsym W q hq₁ (hm hq₁) + · have e : q = (fb (p W)).R.k - 1 := by omega + rw [e, (hθ W).last] + exact (h.walk W).last_sym + let rel : Arm Da.P.Γ → Arm Db.P.Γ → Prop := fun A A' ↦ + (∃ W, ∃ q, q < (fb (p W)).R.k ∧ A = (fa W).secArm (θ W q) ∧ A' = (fb (p W)).secArm q ∧ (q + 1 < + (fb (p W)).R.k → θ W (q + 1) = θ W q + 1) ∧ ((fb (p W)).R.k ≤ q + 1 → θ W q + 1 = + (fa W).R.k)) ∨ + ∃ W, ∃ (hc : (fa W).H.V.ncard ≠ 1) (hc' : (fb (p W)).H.V.ncard ≠ 1), A = (fa W).hubArm hc + ∧ A' = (fb (p W)).hubArm hc' ∧ Ω.le (ξa ((fa W).hubArm hc)) (ξb ((fb (p W)).hubArm hc')) + have hrel : ∀ A ∈ (coverLoc 𝒲a hfa hda fa).arms, ∃ A', rel A A' := by + intro A hA + obtain ⟨W, hW⟩ := mem_iUnion.mp hA + rcases hW with ⟨i, hi, rfl⟩ | ⟨hc, rfl⟩ + · obtain ⟨q, hq, rfl, h₁, h₂⟩ := (hθ W).exists_top hi + exact ⟨_, .inl ⟨W, q, hq, rfl, rfl, h₁, h₂⟩⟩ + · obtain ⟨hc', hl⟩ := h.hub W hc + exact ⟨_, .inr ⟨W, hc, hc', rfl, rfl, hl⟩⟩ + let τ : Arm Da.P.Γ → Arm Db.P.Γ := fun A ↦ if hA : ∃ A', rel A A' then hA.choose else trivialArm _ + have hτ : ∀ A ∈ (coverLoc 𝒲a hfa hda fa).arms, rel A (τ A) := fun A hA ↦ by + simp only [τ, dite_eq_left (hrel A hA)] + exact (hrel A hA).choose_spec + have hmemS : ∀ W i, i < (fa W).R.k → (fa W).secArm i ∈ (coverLoc 𝒲a hfa hda fa).arms + := fun W i hi ↦ mem_iUnion.mpr ⟨W, .inl ⟨i, hi, rfl⟩⟩ + have hmemH : ∀ W hc, (fa W).hubArm hc ∈ (coverLoc 𝒲a hfa hda fa).arms + := fun W hc ↦ mem_iUnion.mpr ⟨W, .inr ⟨hc, rfl⟩⟩ + have hτS : ∀ W, ∀ i < (fa W).R.k, ∃ q < (fb (p W)).R.k, θ W q = i ∧ (q + 1 < (fb (p W)).R.k → θ W + (q + 1) = θ W q + 1) ∧ ((fb (p W)).R.k ≤ q + 1 → θ W q + 1 = (fa W).R.k) ∧ τ ((fa W).secArm i) + = (fb (p W)).secArm q := by + intro W i hi + rcases hτ _ (hmemS W i hi) with ⟨W', q, hq, e, e', h₁, h₂⟩ | ⟨W', hc, hc', e, -, -⟩ + · have hin := (hθ W').lt hq + obtain rfl : W = W' := arm_wheel (Db := Da) hda (fb := fa) (.inl ⟨i, hi, rfl⟩) + (e ▸ .inl ⟨_, hin, rfl⟩) + obtain rfl := (fa W).secArm_inj hi hin e + exact ⟨q, hq, rfl, h₁, h₂, e'⟩ + · obtain rfl : W = W' := arm_wheel (Db := Da) hda (fb := fa) (.inl ⟨i, hi, rfl⟩) + (e ▸ .inr ⟨hc, rfl⟩) + exact absurd e (sec_ne_hub _ hc i) + have hτH : ∀ W (hc : (fa W).H.V.ncard ≠ 1), ∃ hc' : (fb (p W)).H.V.ncard ≠ 1, τ + ((fa W).hubArm hc) = (fb (p W)).hubArm hc' ∧ Ω.le (ξa ((fa W).hubArm hc)) (ξb ((fb + (p W)).hubArm hc')) := by + intro W hc + rcases hτ _ (hmemH W hc) with ⟨W', q, hq, e, -, -, -⟩ | ⟨W', hc₁, hc', e, e', hl⟩ + · have hin := (hθ W').lt hq + obtain rfl : W = W' := arm_wheel (Db := Da) hda (fb := fa) (.inr ⟨hc, rfl⟩) + (e ▸ .inl ⟨_, hin, rfl⟩) + exact absurd e.symm (sec_ne_hub _ hc _) + · obtain rfl : W = W' := arm_wheel (Db := Da) hda (fb := fa) (.inr ⟨hc, rfl⟩) + (e ▸ .inr ⟨hc₁, rfl⟩) + exact ⟨hc', e', hl⟩ + have hπ : ∀ W, ∀ A ∈ (fa W).arms, (τ A).π.length = A.π.length ∧ ∀ (i : ℕ) (hi : i < A.π.length) + (hi' : i < (τ A).π.length), + Stair.Back (fa W) (fb (p W)) (θ W) (rtOf (fa W) (fb (p W))) (cap.emb (τ A).π[i]) + (cap.emb A.π[i]) := by + rintro W _ (⟨i, hi, rfl⟩ | ⟨hc, rfl⟩) + · obtain ⟨q, hq, rfl, h₁, h₂, e⟩ := hτS W i hi + rw [e] + exact (hθ W).back_π hq h₁ h₂ ((h.walk W).sym_code _ _ (hS W q hq h₁)) + · obtain ⟨hc', e, -⟩ := hτH W hc + rw [e] + have hl := (h.walk W).hub_len + rw [(fb (p W)).hubList_of hc', (fa W).hubList_of hc, List.length_map, List.length_map] at hl + refine ⟨hl, fun n hn hn' ↦ .inr (.inl ⟨n, ?_, ?_⟩)⟩ + · rw [(fb (p W)).hubList_of hc', List.getElem?_map, List.getElem?_eq_getElem hn'] + rfl + · rw [(fa W).hubList_of hc, List.getElem?_map, List.getElem?_eq_getElem hn] + rfl + refine ⟨τ, hsys.isOutline hd hfa hda hfb hdb τ σe (fun W i hi ↦ ?_) + (fun W hc ↦ ?_) hπ hem hsize hinj hends hle, fun A hA ↦ ?_⟩ + · obtain ⟨q, hq, h₁, h₂, -, e⟩ := hτS W i hi + exact ⟨q, hq, h₁, h₂, e⟩ + · obtain ⟨hc', e, -⟩ := hτH W hc + exact ⟨hc', e⟩ + · obtain ⟨W, hW⟩ := mem_iUnion.mp hA + rcases hW with ⟨i, hi, rfl⟩ | ⟨hc, rfl⟩ + · obtain ⟨q, hq, rfl, h₁, -, e⟩ := hτS W i hi + rw [e] + exact h.sym_le W q _ (hS W q hq h₁) + · obtain ⟨hc', e, hl⟩ := hτH W hc + rw [e] + exact hl + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14v.lean b/LeanPool/GraphMinor/GM19/Section14v.lean new file mode 100644 index 0000000000..4bc9adb8df --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14v.lean @@ -0,0 +1,143 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14u +public import LeanPool.GraphMinor.GM19.BiteArc + +/-! +# Graph Minors XIX, Section 14: the arcs of the rim + +Between two consecutive vertices of `Γ` on the rim there is one vertex of `R*`. Here we show that +the arc of the rim between them has no other vertex of `Γ`, and that +each arc of the rim between two vertices of `Γ` contains a vertex of `R*`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} {D : TangleDatum cap χ} {W : Set Shat} + +theorem IsLineWithEnds.isPathConnected_diff {T : Type} [TopologicalSpace T] {L : Set T} {u v : T} + (h : IsLineWithEnds L u v) : IsPathConnected (L \ {u}) := by + obtain ⟨f, hf₀, hf₁⟩ := h + have hs : L \ {u} = (fun x ↦ (f x).1) '' {x | x ≠ 0} := by + ext y + constructor + · rintro ⟨hy, hne⟩ + refine ⟨f.symm ⟨y, hy⟩, ?_, by simp⟩ + intro h0 + apply hne + have : f (f.symm ⟨y, hy⟩) = f 0 := by rw [h0] + rw [f.apply_symm_apply] at this + exact (congrArg Subtype.val this).trans hf₀ + · rintro ⟨x, hx, rfl⟩ + refine ⟨(f x).2, fun h' ↦ hx (f.injective (Subtype.ext (h'.trans hf₀.symm)))⟩ + rw [hs] + refine IsPathConnected.image ?_ (by fun_prop) + have hconv : {x : unitInterval | x ≠ 0} = (fun t : Ioc (0 : ℝ) 1 ↦ (⟨t.1, t.2.1.le, t.2.2⟩ : + unitInterval)) '' univ := by + ext x + constructor + · intro hx + refine ⟨⟨x.1, lt_of_le_of_ne x.2.1 (fun h' ↦ hx (Subtype.ext h'.symm)), x.2.2⟩, mem_univ _, + rfl⟩ + · rintro ⟨t, -, rfl⟩ h' + have := congrArg Subtype.val h' + exact t.2.1.ne' this + rw [hconv] + have : PathConnectedSpace (Ioc (0 : ℝ) 1) := isPathConnected_iff_pathConnectedSpace.mp + ((convex_Ioc 0 1).isPathConnected ⟨1, by norm_num, le_rfl⟩) + exact isPathConnected_univ.image (by fun_prop) + +namespace TangleDatum.Rim + +/-- The rim arc through `R.reg i`. -/ +theorem exists_arc (R : Rim D W) (i : ℕ) : ∃ A : Set Shat, IsPathConnected A ∧ A ⊆ discBd W + ∧ Disjoint A (D.P.Γ.hatV cap) ∧ R.reg i ∈ A ∧ R.vert i ∈ closure A ∧ R.vert (i + 1) ∈ closure A + := by + have hT2 := cap.isSurface + obtain ⟨f, g, hf, hg, hfW, hgW⟩ := R.exists_links i + have hreg := R.reg_mem i + have hvh : ∀ j, R.vert j ∈ D.P.Γ.hatV cap := fun j ↦ (R.vert_mem j).1 + have hcW : IsClosed (discBd W) := R.U_eq ▸ (walkDrawing D.rad.G R.B).isClosed_U + have key : ∀ {f : Set Shat} {v : Shat}, D.rad.G.toGraph.IsLink f (R.reg i) v → f ⊆ discBd W + → v ∈ D.P.Γ.hatV cap → + ∃ A : Set Shat, IsPathConnected A ∧ A ⊆ discBd W ∧ Disjoint A (D.P.Γ.hatV cap) ∧ R.reg i ∈ A + ∧ v ∈ closure A := by + intro f v hf hfW hv + obtain ⟨hfE, hrV, hvV, hcl⟩ := hf + have hne : v ≠ R.reg i := fun e ↦ hreg.1.2 (e ▸ hv) + have hL : IsLineWithEnds (closure f) v (R.reg i) := by + rcases D.rad.G.edge_cond f hfE with ⟨u, w, huw, h₁, h₂⟩ | ⟨u, h₁, -⟩ + · have h₃ : ({u, w} : Set Shat) = {R.reg i, v} := h₁.symm.trans hcl + have hu : u = R.reg i ∨ u = v := by simpa using h₃.subset (mem_insert u {w}) + have hw : w = R.reg i ∨ w = v := by simpa using h₃.subset (mem_insert_of_mem u rfl) + rcases hu with rfl | rfl <;> rcases hw with rfl | rfl + · exact absurd rfl huw + · exact GM11.IsLineWithEnds.symm h₂ + · exact h₂ + · exact absurd rfl huw + · have h₃ : (R.reg i ∈ ({u} : Set Shat)) ∧ v ∈ ({u} : Set Shat) := by + rw [← h₁, hcl] + simp + exact absurd (h₃.2.trans h₃.1.symm) hne + refine ⟨closure f \ {v}, IsLineWithEnds.isPathConnected_diff hL, + fun y hy ↦ closure_minimal hfW hcW hy.1, ?_, ?_, ?_⟩ + · refine disjoint_left.mpr fun y hy hyV ↦ ?_ + have hyG : y ∈ closure f ∩ D.rad.G.V := ⟨hy.1, D.rad.isPreRadial.2.1 hyV⟩ + rw [hcl] at hyG + rcases hyG with rfl | h' + · exact hreg.1.2 hyV + · exact hy.2 h' + · refine ⟨?_, fun h' ↦ hne h'.symm⟩ + have : R.reg i ∈ closure f ∩ D.rad.G.V := by rw [hcl]; simp + exact this.1 + · have := line_subset_closure_diff hL (finite_singleton v) + refine this ?_ + have : v ∈ closure f ∩ D.rad.G.V := by rw [hcl]; simp + exact this.1 + obtain ⟨A₁, h₁, h₂, h₃, h₄, h₅⟩ := key hf hfW (hvh _) + obtain ⟨A₂, h₆, h₇, h₈, h₉, h₁₀⟩ := key hg hgW (hvh _) + exact ⟨A₁ ∪ A₂, h₁.union h₆ ⟨_, h₄, h₉⟩, union_subset h₂ h₇, disjoint_union_left.mpr ⟨h₃, h₈⟩, + .inl h₄, closure_mono subset_union_left h₅, closure_mono subset_union_right h₁₀⟩ + +omit [T2Space S] in +/-- A connected part of the rim with no vertex of `Γ*` has at most one vertex of `Γ` in its closure. +-/ +theorem no_two_ends (R : Rim D W) {E : Set Shat} (hE : IsPathConnected E) (hEW : E ⊆ discBd W) + (hEV : Disjoint E D.rad.G.V) {u v : Shat} (hu : u ∈ closure E) (hv : v ∈ closure E) + (hne : u ≠ v) (huV : u ∈ D.P.Γ.hatV cap) (hvV : v ∈ D.P.Γ.hatV cap) : False := by + obtain ⟨x, hx⟩ := hE.nonempty + obtain ⟨f, hf, hxf⟩ := exists_mem_arcComponent (F := D.rad.G.U \ D.rad.G.V) ⟨R.G_sub + (hEW hx), disjoint_left.mp hEV hx⟩ + obtain ⟨f', hf', hEf⟩ := exists_arcComp_superset hE (F := D.rad.G.U \ D.rad.G.V) + (fun y hy ↦ ⟨R.G_sub (hEW hy), disjoint_left.mp hEV hy⟩) + have hff : f' = f := arcComp_eq_of_mem hf' hf (hEf hx) hxf + subst hff + obtain ⟨a, b, hb, ha', hab⟩ := D.rad.isPreRadial.2.2.2.2.1 f' hf + have h₁ : u ∈ closure f' ∩ D.rad.G.V := ⟨closure_mono hEf hu, D.rad.isPreRadial.2.1 huV⟩ + have h₂ : v ∈ closure f' ∩ D.rad.G.V := ⟨closure_mono hEf hv, D.rad.isPreRadial.2.1 hvV⟩ + rw [hab] at h₁ h₂ + rcases h₁ with rfl | h₁ + · rcases h₂ with rfl | h₂ + · exact hne rfl + · exact ha'.2 (mem_singleton_iff.mp h₂ ▸ hvV) + · exact ha'.2 (mem_singleton_iff.mp h₁ ▸ huV) + +end TangleDatum.Rim + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14w.lean b/LeanPool/GraphMinor/GM19/Section14w.lean new file mode 100644 index 0000000000..b3cb438f33 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14w.lean @@ -0,0 +1,405 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14v + +/-! +# Graph Minors XIX, Section 14: a painting seen from `Σ'` + +All the paintings of the sequence in (14.1) have their wheels in the same place, after a +homeomorphism of `Σ`. So there is one surface `Σ' = Σ \ T`, and for each painting a map +`e` of `Σ'` to `Σ̂` whose image is the complement of the insides of the wheels. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- A cover by wheels in `D`, seen from `Σ' = Σ \ T`. -/ +structure Slice (T : Set S) (D : TangleDatum cap χ) where + /-- The wheel discs used to make the cuts. -/ + 𝒲 : Set (Set Shat) + /-- The chosen wheel frame on each disc. -/ + fr : ∀ W : ↥𝒲, WheelFrame D W.1 + /-- The homeomorphism applied before cutting. -/ + f : S ≃ₜ S + hf : IsFramePreservingHomeo χ.Φ f + cut : IsCutData (cap.emb ∘ f) 𝒲 + hT : cutT (cap.emb ∘ f) 𝒲 = T + +namespace Slice + +variable {T : Set S} {D : TangleDatum cap χ} (s : Slice T D) +include s + +/-- The map of `Σ'` to `Σ̂`. -/ +def e (x : ↥Tᶜ) : Shat := cap.emb (s.f x.1) + +theorem isEmbedding : IsEmbedding s.e := by + have : IsEmbedding (cap.emb ∘ s.f) := s.cut.emb.isEmbedding + exact this.comp IsEmbedding.subtypeVal + +theorem range_e : range s.e = (⋃ W ∈ s.𝒲, discInt W)ᶜ := by + ext y + constructor + · rintro ⟨x, rfl⟩ + have h : x.1 ∉ cutT (cap.emb ∘ s.f) s.𝒲 := by + rw [s.hT] + exact x.2 + exact h + · intro hy + obtain ⟨x, -, rfl⟩ := s.cut.cover hy + refine ⟨⟨x, ?_⟩, rfl⟩ + have h : x ∉ cutT (cap.emb ∘ s.f) s.𝒲 := hy + rw [s.hT] at h + exact h + +theorem facts : IsClosed Tᶜ ∧ IsSurface ↥Tᶜ ∧ bd ↥Tᶜ = Subtype.val ⁻¹' cutF (cap.emb ∘ s.f) s.𝒲 + ∧ ConnectedSpace ↥Tᶜ := by + have := cap.connected + have h := s.cut.surface_facts cap.isSurface cap.bd_empty + rw [s.hT] at h + exact h + +theorem isSurface : IsSurface ↥Tᶜ := s.facts.2.1 + +theorem connected : ConnectedSpace ↥Tᶜ := s.facts.2.2.2 + +theorem mem_bd {x : ↥Tᶜ} : x ∈ bd ↥Tᶜ ↔ s.e x ∈ ⋃ W ∈ s.𝒲, discBd W := by + rw [s.facts.2.2.1] + rfl + +/-- The cuff of `Σ'` at a wheel. -/ +def cf (W : Set Shat) : Set ↥Tᶜ := s.e ⁻¹' discBd W + +theorem image_cf {W : Set Shat} (hW : W ∈ s.𝒲) : s.e '' s.cf W = discBd W := by + have h := s.cut.image_cuffAt hW + have key : ∀ (T' : Set S) (hT' : cutT (cap.emb ∘ s.f) s.𝒲 = T'), (fun x : ↥T'ᶜ ↦ cap.emb + (s.f x.1)) '' ((fun x : ↥T'ᶜ ↦ cap.emb (s.f x.1)) ⁻¹' discBd W) = discBd W := by + rintro _ rfl + exact h + exact key T s.hT + +theorem cuffs_eq : cuffs ↥Tᶜ = s.cf '' s.𝒲 := by + have := cap.connected + have key : ∀ (T' : Set S) (hT' : cutT (cap.emb ∘ s.f) s.𝒲 = T'), cuffs ↥T'ᶜ = (fun W ↦ + (fun x : ↥T'ᶜ ↦ cap.emb (s.f x.1)) ⁻¹' discBd W) '' s.𝒲 := by + rintro _ rfl + exact s.cut.cuffs_eq cap.isSurface cap.bd_empty + exact key T s.hT + +theorem cf_mem {W : Set Shat} (hW : W ∈ s.𝒲) : s.cf W ∈ cuffs ↥Tᶜ := by + rw [s.cuffs_eq] + exact mem_image_of_mem _ hW + +theorem nonempty_capped : Nonempty (IsCappedSurface ↥Tᶜ Shat) := by + have := cap.connected + have key : ∀ (T' : Set S) (_ : cutT (cap.emb ∘ s.f) s.𝒲 = T'), Nonempty + (IsCappedSurface ↥T'ᶜ Shat) := by + rintro _ rfl + exact s.cut.nonempty_capped cap.isSurface cap.bd_empty + exact key T s.hT + +/-- The vertices of `Γ` on `Σ'`. -/ +def N : Set ↥Tᶜ := s.e ⁻¹' D.P.Γ.hatV cap + +theorem finite_N : s.N.Finite := (D.P.Γ.finite_V.image _).preimage (s.isEmbedding.injective.injOn) + +/-- The vertices of `Γ` on the boundary of `Σ'`. -/ +def Nb : Set ↥Tᶜ := s.N ∩ bd ↥Tᶜ + +theorem finite_Nb : s.Nb.Finite := s.finite_N.subset inter_subset_left + +theorem exists_pt {W : Set Shat} (hW : W ∈ s.𝒲) {y : Shat} (hy : y ∈ discBd W) : ∃ x ∈ s.cf W, s.e + x = y := by + rw [← s.image_cf hW] at hy + exact hy + +theorem cf_sub_bd {W : Set Shat} (hW : W ∈ s.𝒲) : s.cf W ⊆ bd ↥Tᶜ := fun _ hx ↦ s.mem_bd.mpr + (mem_iUnion₂.mpr ⟨W, hW, hx⟩) + +omit s in +theorem vert_bd (s : Slice T D) (W : ↥s.𝒲) (i : ℕ) : (s.fr W).R.vert i ∈ discBd W.1 := + ((s.fr W).R.vert_mem i).2 + +/-- The point of `Σ'` at the `i`th vertex of the rim of a wheel. -/ +noncomputable def vx (W : ↥s.𝒲) (i : ℕ) : ↥Tᶜ := (s.exists_pt W.2 (s.vert_bd W i)).choose + +theorem e_vx (W : ↥s.𝒲) (i : ℕ) : s.e (s.vx W i) = (s.fr W).R.vert i := (s.exists_pt W.2 + (s.vert_bd W i)).choose_spec.2 + +theorem vx_cf (W : ↥s.𝒲) (i : ℕ) : s.vx W i ∈ s.cf W := (s.exists_pt W.2 + (s.vert_bd W i)).choose_spec.1 + +theorem vx_N (W : ↥s.𝒲) (i : ℕ) : s.vx W i ∈ s.Nb := + ⟨show s.e _ ∈ D.P.Γ.hatV cap by rw [s.e_vx]; exact ((s.fr W).R.vert_mem i).1, + s.cf_sub_bd W.2 (s.vx_cf W i)⟩ + +theorem vx_inj (W : ↥s.𝒲) {i j : ℕ} (hi : i < (s.fr W).R.k) (hj : j < (s.fr W).R.k) (h : s.vx W i + = s.vx W j) : i = j := + (s.fr W).R.vert_inj hi hj (by rw [← s.e_vx, ← s.e_vx, h]) + +theorem vx_add_k (W : ↥s.𝒲) (i : ℕ) : s.vx W (i + (s.fr W).R.k) = s.vx W i := + s.isEmbedding.injective (by rw [s.e_vx, s.e_vx, (s.fr W).R.vert_add_k]) + +theorem two (C : cuffs ↥Tᶜ) : ∃ p ∈ s.Nb ∩ C.1, ∃ q ∈ s.Nb ∩ C.1, p ≠ q := by + obtain ⟨C, hC⟩ := C + rw [s.cuffs_eq] at hC + obtain ⟨W, hW, rfl⟩ := hC + have h3 := (s.fr ⟨W, hW⟩).k_three + exact ⟨_, ⟨s.vx_N ⟨W, hW⟩ 0, s.vx_cf ⟨W, hW⟩ 0⟩, _, ⟨s.vx_N ⟨W, hW⟩ 1, s.vx_cf ⟨W, hW⟩ 1⟩, + fun h ↦ absurd (s.vx_inj ⟨W, hW⟩ (by omega) (by omega) h) (by omega)⟩ + +/-- **A rim arc in `Σ'`.** -/ +theorem exists_arc (W : ↥s.𝒲) (i : ℕ) : ∃ A ∈ arcComponentsIn (bd ↥Tᶜ \ s.Nb), A ⊆ s.cf W ∧ tilde A + = {s.vx W i, s.vx W (i + 1)} ∧ ∃ x ∈ A, s.e x = (s.fr W).R.reg i := by + obtain ⟨A, h₁, h₂, h₃, h₄, h₅, h₆⟩ := (s.fr W).R.exists_arc i + have hsur := s.image_cf W.2 + have hAr : s.e '' (s.e ⁻¹' A) = A := image_preimage_eq_of_subset + (h₂.trans (by rw [← hsur]; exact image_subset_range _ _)) + have hpc : IsPathConnected (s.e ⁻¹' A) := by + rw [s.isEmbedding.isInducing.isPathConnected_iff, hAr] + exact h₁ + have hsub : s.e ⁻¹' A ⊆ bd ↥Tᶜ \ s.Nb := fun x hx ↦ ⟨s.cf_sub_bd W.2 + (h₂ hx), fun hN ↦ disjoint_left.mp h₃ hx hN.1⟩ + obtain ⟨c, hc, hAc⟩ := exists_arcComp_superset hpc hsub + have hcl : ∀ i', (s.fr W).R.vert i' ∈ closure A → s.vx W i' ∈ closure (s.e ⁻¹' A) + := fun i' hi' ↦ by + rw [s.isEmbedding.closure_eq_preimage_closure_image, hAr] + change s.e (s.vx W i') ∈ closure A + rwa [s.e_vx] + have hnc : ∀ i', s.vx W i' ∉ c := fun i' h' ↦ (hc.2.1 h').2 (s.vx_N W i') + have ht := arc_shape s.isSurface s.finite_Nb s.two hc + have hne : s.vx W i ≠ s.vx W (i + 1) := fun h' ↦ by + have h₇ : (s.fr W).R.vert i = (s.fr W).R.vert (i + 1) := by rw [← s.e_vx, ← s.e_vx, h'] + have h₈ := (s.fr W).R.mod_lt i + have h₉ : (s.fr W).R.vert (i % (s.fr W).R.k) = (s.fr W).R.vert i := by + rw [Rim.vert, Rim.vert, Nat.mod_mod] + have h₁₀ : (s.fr W).R.vert (i % (s.fr W).R.k + 1) = (s.fr W).R.vert (i + 1) := by + rw [Rim.vert, Rim.vert, Nat.mod_add_mod] + exact (s.fr W).R.vert_ne_succ h₈ (by rw [h₉, h₁₀, h₇]) + have hm₁ : s.vx W i ∈ tilde c := ⟨closure_mono hAc (hcl _ h₅), hnc _⟩ + have hm₂ : s.vx W (i + 1) ∈ tilde c := ⟨closure_mono hAc (hcl _ h₆), hnc _⟩ + have htc : tilde c = {s.vx W i, s.vx W (i + 1)} := by + symm + apply eq_of_subset_of_ncard_le _ _ ht.2.1 + · rintro _ (rfl | rfl) + · exact hm₁ + · exact hm₂ + · rw [ht.1, ncard_pair hne] + have hrb : (s.fr W).R.reg i ∈ discBd W.1 := ((s.fr W).R.reg_mem i).2 + obtain ⟨y, hy, hye⟩ : ∃ y ∈ s.cf W, s.e y = (s.fr W).R.reg i := s.exists_pt W.2 hrb + have hyA : y ∈ c := hAc (by change s.e y ∈ A; rw [hye]; exact h₄) + refine ⟨c, hc, ?_, htc, y, hyA, hye⟩ + have hcC : s.cf W.1 ∈ cuffs ↥Tᶜ := s.cf_mem W.2 + obtain ⟨C, a, b, -, -, rfl, -, -, -⟩ := exists_arc_of_mem s.isSurface + (cuffPar s.isSurface) s.finite_Nb s.two hc + have hyC : y ∈ C.1 := arcOf_subset _ _ _ hyA + have hC : C.1 = s.cf W.1 := by + by_contra hne' + exact disjoint_left.mp (cuffs_disjoint C.2 hcC hne') hyC hy + rw [← hC] + exact arcOf_subset _ _ _ + +/-- The arc of the rim at `R.reg i`, in `Σ'`. -/ +noncomputable def arc (W : ↥s.𝒲) (i : ℕ) : Set ↥Tᶜ := (s.exists_arc W i).choose + +theorem arc_mem (W : ↥s.𝒲) (i : ℕ) : s.arc W i ∈ arcComponentsIn (bd ↥Tᶜ \ s.Nb) := + (s.exists_arc W i).choose_spec.1 + +theorem arc_cf (W : ↥s.𝒲) (i : ℕ) : s.arc W i ⊆ s.cf W := (s.exists_arc W i).choose_spec.2.1 + +theorem tilde_arc (W : ↥s.𝒲) (i : ℕ) : tilde (s.arc W i) = {s.vx W i, s.vx W (i + 1)} := + (s.exists_arc W i).choose_spec.2.2.1 + +theorem arc_reg (W : ↥s.𝒲) (i : ℕ) : ∃ x ∈ s.arc W i, s.e x = (s.fr W).R.reg i := + (s.exists_arc W i).choose_spec.2.2.2 + +theorem vert_mod (W : ↥s.𝒲) (i : ℕ) : (s.fr W).R.vert (i % (s.fr W).R.k) = (s.fr W).R.vert i := by + rw [Rim.vert, Rim.vert, Nat.mod_mod] + +theorem vx_mod_eq (W : ↥s.𝒲) {i j : ℕ} (h : s.vx W i = s.vx W j) : i % (s.fr W).R.k = j % + (s.fr W).R.k := by + refine (s.fr W).R.vert_inj ((s.fr W).R.mod_lt i) ((s.fr W).R.mod_lt j) ?_ + rw [s.vert_mod, s.vert_mod, ← s.e_vx, ← s.e_vx, h] + +theorem vx_ne_succ (W : ↥s.𝒲) (i : ℕ) : s.vx W i ≠ s.vx W (i + 1) := fun h ↦ by + have h₁ := s.vx_mod_eq W h + have h₃ := (s.fr W).k_three + have : (s.fr W).R.k ∣ (i + 1) - i := (Nat.modEq_iff_dvd' (by omega)).mp h₁ + have := Nat.le_of_dvd (by omega) this + omega + +theorem vx_ne_add_two (W : ↥s.𝒲) (i : ℕ) : s.vx W i ≠ s.vx W (i + 2) := fun h ↦ by + have h₁ := s.vx_mod_eq W h + have h₃ := (s.fr W).k_three + have : (s.fr W).R.k ∣ (i + 2) - i := (Nat.modEq_iff_dvd' (by omega)).mp h₁ + have := Nat.le_of_dvd (by omega) this + omega + +/-- Each arc of `bd(Σ')` between vertices of `Γ` on a cuff is an arc of the rim. -/ +theorem arc_cover (W : ↥s.𝒲) {c : Set ↥Tᶜ} (hc : c ∈ arcComponentsIn (bd ↥Tᶜ \ s.Nb)) {x₀ : ↥Tᶜ} + (hx₀ : x₀ ∈ c) (hx₀W : x₀ ∈ s.cf W) : ∃ i < (s.fr W).R.k, c = s.arc W i := by + classical + obtain ⟨C, a, b, hab, hub, rfl, hdis, ha, hb⟩ := exists_arc_of_mem s.isSurface + (cuffPar s.isSurface) s.finite_Nb s.two hc + have hC : C.1 = s.cf W.1 := by + by_contra hne' + exact disjoint_left.mp (cuffs_disjoint C.2 (s.cf_mem W.2) hne') (arcOf_subset _ _ _ hx₀) hx₀W + have hsub : arcOf (cuffPar s.isSurface C) a b ⊆ s.cf W := hC ▸ arcOf_subset _ _ _ + by_cases hr : ∃ x ∈ arcOf (cuffPar s.isSurface C) a b, s.e x ∈ D.rad.Rstar + · obtain ⟨x, hx, hxr⟩ := hr + obtain ⟨i, hi, e⟩ := (s.fr W).R.exists_reg _ ⟨hxr, hsub hx⟩ + obtain ⟨y, hy, hye⟩ := s.arc_reg W i + obtain rfl : y = x := s.isEmbedding.injective (hye.trans e.symm) + exact ⟨i, hi, arcComp_eq_of_mem hc (s.arc_mem W i) hx hy⟩ + · exfalso + push Not at hr + have hpc := isPathConnected_arcOf (cuffPar s.isSurface C) hab + have hdV : Disjoint (s.e '' arcOf (cuffPar s.isSurface C) a b) D.rad.G.V := by + refine disjoint_left.mpr ?_ + rintro _ ⟨x, hx, rfl⟩ hG + by_cases hh : s.e x ∈ D.P.Γ.hatV cap + · exact (hc.2.1 hx).2 ⟨hh, (hc.2.1 hx).1⟩ + · exact hr x hx ⟨hG, hh⟩ + have hcl : ∀ p, p ∈ tilde (arcOf (cuffPar s.isSurface C) a b) → s.e p ∈ closure (s.e '' arcOf + (cuffPar s.isSurface C) a b) := fun p hp ↦ image_closure_subset_closure_image + s.isEmbedding.continuous (mem_image_of_mem _ hp.1) + have ht := tilde_arcOf (cuffPar s.isSurface C) hab hub + have hne := (GM20.line_facts (isLine_arcOf (cuffPar s.isSurface C) hab hub)).1 + refine (s.fr W).R.no_two_ends (hpc.image s.isEmbedding.continuous) ?_ hdV + (hcl _ (by rw [ht]; simp)) (hcl _ (by rw [ht]; simp)) + (s.isEmbedding.injective.ne hne) ha.1 hb.1 + rintro _ ⟨x, hx, rfl⟩ + exact hsub hx + +end Slice + +/-- The two ends of an arc are determined by the arc. -/ +theorem arcOf_ends_eq {X : Type} [TopologicalSpace X] {Θ : Set X} + (f : Circle ≃ₜ Θ) {a b a' b' : ℝ} (hab : a < b) (hub : b < a + 2 * Real.pi) (hab' : a' < b') + (hub' : b' < a' + 2 * Real.pi) + (h : arcOf f a b = arcOf f a' b') : cuffPoint f a = cuffPoint f a' ∧ cuffPoint f b + = cuffPoint f b' := by + obtain ⟨m, h₁, h₂⟩ := exists_shift f hab hab' hub h.ge + obtain ⟨m', h₃, h₄⟩ := exists_shift f hab' hab hub' h.le + have hpi := Real.pi_pos + have hm : (0 : ℝ) ≤ (m + m' : ℝ) * (2 * Real.pi) := by nlinarith + have hm' : ((m + m' : ℝ)) * (2 * Real.pi) ≤ 0 := by nlinarith + have h0 : (m + m' : ℝ) = 0 := by + have : (m + m' : ℝ) * (2 * Real.pi) = 0 := le_antisymm hm' hm + rcases mul_eq_zero.mp this with h' | h' + · exact h' + · exact absurd h' (by positivity) + have he : (m' : ℝ) = -m := by linarith + rw [he] at h₃ h₄ + have ea : a = a' + m * (2 * Real.pi) := by nlinarith + have eb : b = b' + m * (2 * Real.pi) := by nlinarith + rw [ea, eb, cuffPoint_shift, cuffPoint_shift] + exact ⟨rfl, rfl⟩ + +namespace Slice + +variable {T : Set S} {D : TangleDatum cap χ} (s : Slice T D) +include s + +/-- **All the arcs of a rim run the same way around the cuff.** -/ +theorem exists_dir (W : ↥s.𝒲) : ∃ ε : Bool, ∀ i, arcMarch s.isSurface ε (s.arc W i) + = [s.vx W i, s.vx W (i + 1)] := by + have hX := s.isSurface + let Fw : ℕ → Bool → Prop := fun i c ↦ ∃ (C : cuffs ↥Tᶜ) (a b : ℝ), a < b ∧ b < a + 2 * Real.pi + ∧ s.arc W i = arcOf (cuffPar hX C) a b ∧ + cuffPoint (cuffPar hX C) a = (if c then s.vx W (i + 1) else s.vx W i) ∧ cuffPoint + (cuffPar hX C) b = (if c then s.vx W i else s.vx W (i + 1)) + have hall : ∀ i, Fw i false ∨ Fw i true := by + intro i + obtain ⟨C, a, b, hab, hub, he, -, ha, hb⟩ := exists_arc_of_mem hX + (cuffPar hX) s.finite_Nb s.two (s.arc_mem W i) + have ht := tilde_arcOf (cuffPar hX C) hab hub + rw [← he, s.tilde_arc] at ht + have hne := s.vx_ne_succ W i + have h₁ : cuffPoint (cuffPar hX C) a ∈ ({s.vx W i, s.vx W (i + 1)} : Set _) := by rw [ht]; simp + have h₂ : cuffPoint (cuffPar hX C) b ∈ ({s.vx W i, s.vx W (i + 1)} : Set _) := by rw [ht]; simp + have hab' := (GM20.line_facts (isLine_arcOf (cuffPar hX C) hab hub)).1 + rcases h₁ with e₁ | e₁ <;> rcases h₂ with e₂ | e₂ + · exact absurd (e₁.trans e₂.symm) hab' + · exact .inl ⟨C, a, b, hab, hub, he, e₁, e₂⟩ + · exact .inr ⟨C, a, b, hab, hub, he, e₁, e₂⟩ + · exact absurd (e₁.trans (mem_singleton_iff.mp e₂).symm) hab' + have hcuff : ∀ {C C' : cuffs ↥Tᶜ} {x : ↥Tᶜ}, x ∈ C.1 → x ∈ C'.1 → C = C' + := fun {C C' x} h₁ h₂ ↦ by + by_contra hne + exact disjoint_left.mp (cuffs_disjoint' hne) h₁ h₂ + have hstep : ∀ i c, Fw i c → Fw (i + 1) c := by + intro i c hF + obtain ⟨C, a, b, hab, hub, he, h₁, h₂⟩ := hF + rcases hall (i + 1) with hF' | hF' + · cases c + · exact hF' + · exfalso + obtain ⟨C', a', b', hab', hub', he', h₁', h₂'⟩ := hF' + simp only [ite_true, Bool.false_eq_true, ite_false] at h₁ h₂ h₁' h₂' + obtain rfl : C = C' := hcuff (x := s.vx W (i + 1)) (h₁ ▸ cuffPoint_mem _ _) + (h₁' ▸ cuffPoint_mem _ _) + have ea := arc_head_eq hab hab' (he ▸ s.arc_mem W i) (he' ▸ s.arc_mem W (i + 1)) + (h₁.trans h₁'.symm) + have ht := congrArg tilde (he.trans (ea.trans he'.symm)) + rw [s.tilde_arc, s.tilde_arc] at ht + have hm : s.vx W i ∈ ({s.vx W (i + 1), s.vx W (i + 1 + 1)} : Set _) := ht ▸ (by simp) + rcases hm with h' | h' + · exact s.vx_ne_succ W i h' + · exact s.vx_ne_add_two W i h' + · cases c + · exfalso + obtain ⟨C', a', b', hab', hub', he', h₁', h₂'⟩ := hF' + simp only [ite_true, Bool.false_eq_true, ite_false] at h₁ h₂ h₁' h₂' + obtain rfl : C = C' := hcuff (x := s.vx W (i + 1)) (h₂ ▸ cuffPoint_mem _ _) + (h₂' ▸ cuffPoint_mem _ _) + have ea := arc_tail_eq hab hab' (he ▸ s.arc_mem W i) (he' ▸ s.arc_mem W (i + 1)) + (h₂.trans h₂'.symm) + have ht := congrArg tilde (he.trans (ea.trans he'.symm)) + rw [s.tilde_arc, s.tilde_arc] at ht + have hm : s.vx W i ∈ ({s.vx W (i + 1), s.vx W (i + 1 + 1)} : Set _) := ht ▸ (by simp) + rcases hm with h' | h' + · exact s.vx_ne_succ W i h' + · exact s.vx_ne_add_two W i h' + · exact hF' + have hconst : ∃ c, ∀ i, Fw i c := by + rcases hall 0 with h₀ | h₀ + · exact ⟨false, fun i ↦ by + induction i with + | zero => exact h₀ + | succ i ih => exact hstep i _ ih⟩ + · exact ⟨true, fun i ↦ by + induction i with + | zero => exact h₀ + | succ i ih => exact hstep i _ ih⟩ + obtain ⟨c, hc⟩ := hconst + refine ⟨c, fun i ↦ ?_⟩ + obtain ⟨C, a, b, hab, hub, he, h₁, h₂⟩ := hc i + obtain ⟨C', a', b', hab', hub', he', hl⟩ := arcMarch_spec hX c hab hub he + obtain rfl : C = C' := by + obtain ⟨x, hx⟩ := (s.arc_mem W i).1 + exact hcuff (x := x) (arcOf_subset _ _ _ (he ▸ hx)) (arcOf_subset _ _ _ (he' ▸ hx)) + obtain ⟨e₁, e₂⟩ := arcOf_ends_eq _ hab hub hab' hub' (he.symm.trans he') + rw [hl, ← e₁, ← e₂, h₁, h₂] + cases c <;> simp + +end Slice + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14x.lean b/LeanPool/GraphMinor/GM19/Section14x.lean new file mode 100644 index 0000000000..1956fd46f7 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14x.lean @@ -0,0 +1,215 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14w +public import LeanPool.GraphMinor.GM19.Section5n +public import LeanPool.GraphMinor.GM19.Section5o +public import LeanPool.GraphMinor.GM19.FeatureOrient + +/-! +# Graph Minors XIX, Section 14: the painting `Γ'` + +The painting `Γ'` in `Σ'` is the pull-back of `Γ` by the inclusion of `Σ'` in `Σ`, with the boundary +of `Σ'` added. It is a fragment of `Σ` in the sense of Section 5, for the +drawing `K` with `U(K) = bd(Σ')` and with the vertices of `Γ` on it as vertices. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace Slice + +variable {T : Set S} {D : TangleDatum cap χ} (s : Slice T D) +include s + +/-- The painting in `Σ` with the wheels in the fixed place. -/ +noncomputable def Q : ColouredPainting χ := D.P.image s.f.symm s.hf.symm + +theorem isImage : IsColouredImage s.f.symm D.P s.Q := ColouredPainting.isImage_image _ _ _ + +theorem mem_QV {x : S} : x ∈ s.Q.Γ.V ↔ cap.emb (s.f x) ∈ D.P.Γ.hatV cap := by + rw [s.isImage.V] + constructor + · rintro ⟨v, hv, rfl⟩ + exact ⟨v, hv, by simp⟩ + · rintro ⟨v, hv, h⟩ + exact ⟨v, hv, by rw [cap.isEmbedding.injective h]; simp⟩ + +theorem mem_QU {x : S} : x ∈ s.Q.Γ.U ↔ cap.emb (s.f x) ∈ D.P.Γ.hatU cap := by + rw [s.isImage.U] + constructor + · rintro ⟨v, hv, rfl⟩ + exact ⟨v, hv, by simp⟩ + · rintro ⟨v, hv, h⟩ + exact ⟨v, hv, by rw [cap.isEmbedding.injective h]; simp⟩ + +theorem image_bd : Subtype.val '' bd ↥Tᶜ = cutF (cap.emb ∘ s.f) s.𝒲 := by + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + rw [s.facts.2.2.1] at hy + exact hy + · intro hx + obtain ⟨W, hW, hxW⟩ := mem_iUnion₂.mp hx + obtain ⟨y, hy, e⟩ := s.exists_pt hW hxW + exact ⟨y, s.cf_sub_bd hW hy, s.f.injective (cap.isEmbedding.injective e)⟩ + +theorem bd_sub_T : bd S ⊆ T := s.hT ▸ s.cut.bd_subset_T + +theorem isOpen_T : IsOpen T := isClosed_compl_iff.mp s.facts.1 + +theorem isClosedEmbedding : IsClosedEmbedding (Subtype.val : ↥Tᶜ → S) + := s.facts.1.isClosedEmbedding_subtypeVal + +/-- `T` and the boundary together are closed. -/ +theorem isClosed_T_F : IsClosed (T ∪ cutF (cap.emb ∘ s.f) s.𝒲) := by + have hc : IsClosed (⋃ W ∈ s.𝒲, W) := s.cut.finite.isClosed_biUnion fun W hW ↦ + (s.cut.disc W hW).isClosed + have he : T ∪ cutF (cap.emb ∘ s.f) s.𝒲 = (cap.emb ∘ s.f) ⁻¹' ⋃ W ∈ s.𝒲, W := by + ext x + have hT' := Set.ext_iff.mp s.hT x + simp only [mem_union, ← hT'] + simp only [cutT, cutF, mem_preimage, mem_iUnion₂, exists_prop] + constructor + · rintro (⟨W, hW, h⟩ | ⟨W, hW, h⟩) + · exact ⟨W, hW, h.1⟩ + · exact ⟨W, hW, Surface.discBd_subset _ h⟩ + · rintro ⟨W, hW, h⟩ + by_cases hb : (cap.emb ∘ s.f) x ∈ discBd W + · exact .inr ⟨W, hW, hb⟩ + · exact .inl ⟨W, hW, h, hb⟩ + rw [he] + exact hc.preimage s.cut.emb.continuous + +theorem exists_K : ∃ K : Drawing S, K.U = cutF (cap.emb ∘ s.f) s.𝒲 ∧ K.V = Subtype.val '' s.Nb + ∧ FrameData χ.Φ s.Q.Γ K (Subtype.val : ↥Tᶜ → S) ∧ IsAnchored s.Q.Γ K := by + classical + have hX := s.isSurface + have hconn := s.connected + have hS := χ.isSurface + obtain ⟨K, hU, hV, -⟩ := exists_boundaryDrawing hX s.isClosedEmbedding s.finite_Nb + inter_subset_right s.two + rw [s.image_bd] at hU + have hNQ : ∀ x : ↥Tᶜ, x ∈ s.N ↔ x.1 ∈ s.Q.Γ.V := fun x ↦ s.mem_QV.symm + have hVNb : ∀ x : ↥Tᶜ, x.1 ∈ K.V ↔ x ∈ s.Nb := fun x ↦ by + rw [hV] + exact ⟨fun ⟨y, hy, e⟩ ↦ Subtype.ext e ▸ hy, fun h ↦ ⟨x, h, rfl⟩⟩ + have hUb : ∀ x : ↥Tᶜ, x.1 ∈ K.U ↔ x ∈ bd ↥Tᶜ := fun x ↦ by + rw [s.facts.2.2.1, hU] + rfl + have hfrag : IsCuttingFragment S K ↥Tᶜ Subtype.val := by + have hoff : ∀ x : ↥Tᶜ, x ∉ bd ↥Tᶜ → x.1 ∉ bd S ∪ K.U := fun x hx ↦ by + rintro (h | h) + · exact x.2 (s.bd_sub_T h) + · exact hx ((hUb x).mp h) + refine ⟨hX, hconn, continuous_subtype_val, Subtype.val_injective.injOn, fun x ↦ + Set.Subsingleton.finite fun a ha b hb ↦ Subtype.ext (ha.trans hb.symm), ?_, ?_, ?_⟩ + · refine disjoint_left.mpr ?_ + rintro _ ⟨x, hx, rfl⟩ + exact hoff x hx + · rintro _ ⟨x, hx, rfl⟩ + exact .inr ((hUb x).mpr hx) + · obtain ⟨z, hz⟩ := nonempty_interior hX + refine ⟨z.1, hoff z hz, ?_⟩ + have hI : IsOpen (Subtype.val '' (bd ↥Tᶜ)ᶜ : Set S) := by + have he : (Subtype.val '' (bd ↥Tᶜ)ᶜ : Set S) = (T ∪ cutF (cap.emb ∘ s.f) s.𝒲)ᶜ := by + ext x + constructor + · rintro ⟨y, hy, rfl⟩ (h | h) + · exact y.2 h + · exact hy ((hUb y).mp (hU ▸ h)) + · intro hx + have hxT : x ∈ Tᶜ := fun h ↦ hx (.inl h) + exact ⟨⟨x, hxT⟩, fun h ↦ hx (.inr (hU ▸ (hUb ⟨x, hxT⟩).mpr h)), rfl⟩ + rw [he] + exact s.isClosed_T_F.isOpen_compl + have hpre : IsPreconnected (Subtype.val '' (bd ↥Tᶜ)ᶜ : Set S) := + (isPreconnected_compl_bd hX).image _ continuous_subtype_val.continuousOn + have hsubF : (Subtype.val '' (bd ↥Tᶜ)ᶜ : Set S) ⊆ (bd S ∪ K.U)ᶜ := by + rintro _ ⟨x, hx, rfl⟩ + exact hoff x hx + refine Subset.antisymm ?_ (hpre.subset_connectedComponentIn ⟨z, hz, rfl⟩ hsubF) + refine isPreconnected_connectedComponentIn.subset_left_of_subset_union hI s.isOpen_T ?_ ?_ + ⟨z.1, mem_connectedComponentIn (hoff z hz), z, hz, rfl⟩ + · refine disjoint_left.mpr ?_ + rintro _ ⟨x, hx, rfl⟩ h + exact x.2 h + · intro x hx + have hx' := connectedComponentIn_subset _ _ hx + by_cases hT : x ∈ T + · exact .inr hT + · refine .inl ⟨⟨x, hT⟩, fun h ↦ hx' (.inr ((hUb ⟨x, hT⟩).mpr h)), rfl⟩ + have hd : PullData s.Q.Γ K (Subtype.val : ↥Tᶜ → S) := by + refine ⟨hS, hfrag, ?_, fun C ↦ ?_⟩ + · rintro x ⟨hx₁, hx₂⟩ + have hb : cap.emb (s.f x) ∈ ⋃ W ∈ s.𝒲, discBd W := by + have : x ∈ cutF (cap.emb ∘ s.f) s.𝒲 := hU ▸ hx₂ + exact this + obtain ⟨W, hW, hxW⟩ := mem_iUnion₂.mp hb + have hU' : cap.emb (s.f x) ∈ D.rad.G.U := (s.fr ⟨W, hW⟩).R.G_sub hxW + have hh : cap.emb (s.f x) ∈ D.P.Γ.hatV cap := by + rw [← D.rad.isPreRadial.1] + exact ⟨s.mem_QU.mp hx₁, hU'⟩ + refine ⟨s.mem_QV.mpr hh, ?_⟩ + obtain ⟨y, hy, e⟩ := s.exists_pt hW hxW + have hyx : y.1 = x := s.f.injective (cap.isEmbedding.injective e) + exact hyx ▸ (hVNb y).mpr ⟨show s.e y ∈ D.P.Γ.hatV cap by rw [e]; exact hh, s.cf_sub_bd hW hy⟩ + · obtain ⟨p, hp, q, hq, hne⟩ := s.two C + exact ⟨p, ⟨.inr ((hVNb p).mpr hp.1), hp.2⟩, q, ⟨.inr ((hVNb q).mpr hq.1), hq.2⟩, hne⟩ + refine ⟨K, hU, hV, ⟨hd, s.Q.fits, fun C ↦ ?_, ?_⟩, ?_⟩ + · obtain ⟨p, hp, q, hq, hne⟩ := s.two C + exact ⟨p, ⟨.inr ((hVNb p).mpr hp.1), hp.2⟩, q, ⟨.inr ((hVNb q).mpr hq.1), hq.2⟩, hne⟩ + · rintro x ⟨h₁, h₂⟩ + exfalso + obtain ⟨y, hy, rfl⟩ := (show x ∈ Subtype.val '' bd ↥Tᶜ by rw [s.image_bd, ← hU]; exact h₁) + exact y.2 (s.bd_sub_T h₂) + · intro u x hx hxu + rw [hU] at hx + obtain ⟨W, hW, hxW⟩ := mem_iUnion₂.mp hx + have hO : IsOArc (discBd W) := (s.cut.disc W hW).isOArc_discBd + have hem : IsEmbedding (cap.emb ∘ s.f) := s.cut.emb.isEmbedding + set C := (cap.emb ∘ s.f) ⁻¹' (discBd W \ {cap.emb (s.f u)}) with hC + have hsubr : discBd W \ {cap.emb (s.f u)} ⊆ range (cap.emb ∘ s.f) := fun y hy ↦ by + obtain ⟨z, -, e⟩ := s.exists_pt hW hy.1 + exact ⟨z.1, e⟩ + have hsubK : C ⊆ K.U \ {u} := fun y hy ↦ + ⟨by rw [hU]; exact mem_iUnion₂.mpr ⟨W, hW, hy.1⟩, + fun e ↦ hy.2 (by rw [mem_singleton_iff.mp e]; rfl)⟩ + refine ⟨C, hsubK, ⟨hxW, fun e ↦ hxu (s.f.injective (cap.isEmbedding.injective e))⟩, ?_, ?_⟩ + · have : IsPreconnected ((cap.emb ∘ s.f) '' C) := by + rw [hC, image_preimage_eq_of_subset hsubr] + exact hO.twoConn _ + exact hem.isInducing.isPreconnected_image.mp this + · have h3 := (s.fr ⟨W, hW⟩).k_three + obtain ⟨i, hi, hne⟩ : ∃ i, i < 2 ∧ (s.fr ⟨W, hW⟩).R.vert i ≠ cap.emb (s.f u) := by + by_contra hn + push Not at hn + have e₀ := hn 0 (by omega) + have e₁ := hn 1 (by omega) + exact absurd ((s.fr ⟨W, hW⟩).R.vert_inj (by omega) (by omega) (e₀.trans e₁.symm)) (by omega) + obtain ⟨y, hy, e⟩ := s.exists_pt hW (s.vert_bd ⟨W, hW⟩ i) + exact ⟨y.1, ⟨show s.e y ∈ discBd W by rw [e]; exact s.vert_bd ⟨W, hW⟩ i, + fun h' ↦ hne (e.symm.trans h')⟩, + s.mem_QV.mpr (show s.e y ∈ D.P.Γ.hatV cap by + rw [e] + exact ((s.fr ⟨W, hW⟩).R.vert_mem i).1)⟩ + +end Slice + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14y.lean b/LeanPool/GraphMinor/GM19/Section14y.lean new file mode 100644 index 0000000000..529c386535 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14y.lean @@ -0,0 +1,317 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14x + +/-! +# Graph Minors XIX, Section 14: the frame `Φ'` + +The frame `Φ'` in `Σ'` has as vertices the vertices of `Γ` next to the singular vertices of `R*`. A +side of `Φ'` is short if it contains a singular vertex. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +universe w + +section Arcs + +variable {X : Type} [TopologicalSpace X] [T2Space X] (hX : IsSurface X) {N N' : Set X} + +include hX + +/-- An arc for `N'` with its ends in `N` is an arc for `N`. -/ +theorem arc_mem_of_ends (hN : N.Finite) (h2 : ∀ C : cuffs X, ∃ p ∈ N ∩ C.1, ∃ q ∈ N ∩ C.1, p ≠ q) + (hN' : N'.Finite) (h2' : ∀ C : cuffs X, ∃ p ∈ N' ∩ C.1, ∃ q ∈ N' ∩ C.1, p ≠ q) + (hsub : N ⊆ N') {c : Set X} (hc : c ∈ arcComponentsIn (bd X \ N')) + (ht : tilde c ⊆ N) : c ∈ arcComponentsIn (bd X \ N) := by + have hcs : c ⊆ bd X \ N := fun y hy ↦ ⟨(hc.2.1 hy).1, fun h ↦ (hc.2.1 hy).2 (hsub h)⟩ + obtain ⟨s, hs, hcs'⟩ := exists_arcComp_superset hc.2.2.1 hcs + obtain ⟨C, a, b, hab, hub, he, -, -, -⟩ := exists_arc_of_mem hX (cuffPar hX) hN' h2' hc + obtain ⟨C', a', b', hab', hub', he', hd, -, -⟩ := exists_arc_of_mem hX (cuffPar hX) hN h2 hs + obtain rfl : C = C' := by + by_contra hne + obtain ⟨x, hx⟩ := hc.1 + exact disjoint_left.mp (cuffs_disjoint' hne) (arcOf_subset _ _ _ (he ▸ hx)) (arcOf_subset _ _ _ + (he' ▸ hcs' hx)) + have hsubarc : arcOf (cuffPar hX C) a b ⊆ arcOf (cuffPar hX C) a' b' := by + rw [← he, ← he'] + exact hcs' + obtain ⟨m, h₁, h₂⟩ := exists_shift (cuffPar hX C) hab' hab hub' hsubarc + have hta : cuffPoint (cuffPar hX C) a ∈ N := ht (by rw [he, tilde_arcOf _ hab hub]; simp) + have htb : cuffPoint (cuffPar hX C) b ∈ N := ht (by rw [he, tilde_arcOf _ hab hub]; simp) + have hnot : ∀ t, cuffPoint (cuffPar hX C) t ∈ N → t ∉ Ioo a' b' := fun t ht₁ ht₂ ↦ + disjoint_left.mp hd (he' ▸ ⟨t, ht₂, rfl⟩) ht₁ + have hpi := Real.pi_pos + have e₁ : a' = a + m * (2 * Real.pi) := by + by_contra hne + exact hnot (a + m * (2 * Real.pi)) + (by rw [cuffPoint_shift]; exact hta) ⟨lt_of_le_of_ne h₁ hne, by linarith⟩ + have e₂ : b' = b + m * (2 * Real.pi) := by + by_contra hne + exact hnot (b + m * (2 * Real.pi)) + (by rw [cuffPoint_shift]; exact htb) ⟨by linarith, lt_of_le_of_ne h₂ (Ne.symm hne)⟩ + have : c = s := by rw [he, he', e₁, e₂, arcOf_shift] + exact this ▸ hs + +/-- At most two arcs end at a point. -/ +theorem three_arcs (hN : N.Finite) (h2 : ∀ C : cuffs X, ∃ p ∈ N ∩ C.1, ∃ q ∈ N ∩ C.1, p ≠ q) {c₁ c₂ + c₃ : Set X} (h₁ : c₁ ∈ arcComponentsIn (bd X \ N)) (h₂ : c₂ ∈ arcComponentsIn (bd X \ N)) + (h₃ : c₃ ∈ arcComponentsIn (bd X \ N)) {v : X} (hv₁ : v ∈ tilde c₁) (hv₂ : v ∈ tilde c₂) + (hv₃ : v ∈ tilde c₃) (h₁₂ : c₁ ≠ c₂) (h₁₃ : c₁ ≠ c₃) (h₂₃ : c₂ ≠ c₃) : False := by + have key : ∀ {c}, c ∈ arcComponentsIn (bd X \ N) → v ∈ tilde c → ∃ (C : cuffs X) (a b : ℝ), a < b + ∧ c = arcOf (cuffPar hX C) a b ∧ (v = cuffPoint (cuffPar hX C) a ∨ v = cuffPoint + (cuffPar hX C) b) := by + intro c hc hv + obtain ⟨C, a, b, hab, hub, rfl, -, -, -⟩ := exists_arc_of_mem hX (cuffPar hX) hN h2 hc + rw [tilde_arcOf _ hab hub] at hv + exact ⟨C, a, b, hab, rfl, by simpa using hv⟩ + obtain ⟨C₁, a₁, b₁, hab₁, rfl, hv₁'⟩ := key h₁ hv₁ + obtain ⟨C₂, a₂, b₂, hab₂, rfl, hv₂'⟩ := key h₂ hv₂ + obtain ⟨C₃, a₃, b₃, hab₃, rfl, hv₃'⟩ := key h₃ hv₃ + have hcuff : ∀ {C C' : cuffs X} {t t' : ℝ}, v = cuffPoint (cuffPar hX C) t → v = cuffPoint + (cuffPar hX C') t' → C = C' := fun {C C' t t'} h h' ↦ by + by_contra hne + exact disjoint_left.mp (cuffs_disjoint' hne) (h ▸ cuffPoint_mem _ _) (h' ▸ cuffPoint_mem _ _) + have h12 : C₁ = C₂ := by rcases hv₁' with h | h <;> rcases hv₂' with h' | h' <;> exact hcuff h h' + have h13 : C₁ = C₃ := by rcases hv₁' with h | h <;> rcases hv₃' with h' | h' <;> exact hcuff h h' + subst h12 h13 + rcases hv₁' with e₁ | e₁ <;> rcases hv₂' with e₂ | e₂ <;> rcases hv₃' with e₃ | e₃ + · exact h₁₂ (arc_head_eq hab₁ hab₂ h₁ h₂ (e₁.symm.trans e₂)) + · exact h₁₂ (arc_head_eq hab₁ hab₂ h₁ h₂ (e₁.symm.trans e₂)) + · exact h₁₃ (arc_head_eq hab₁ hab₃ h₁ h₃ (e₁.symm.trans e₃)) + · exact h₂₃ (arc_tail_eq hab₂ hab₃ h₂ h₃ (e₂.symm.trans e₃)) + · exact h₂₃ (arc_head_eq hab₂ hab₃ h₂ h₃ (e₂.symm.trans e₃)) + · exact h₁₃ (arc_tail_eq hab₁ hab₃ h₁ h₃ (e₁.symm.trans e₃)) + · exact h₁₂ (arc_tail_eq hab₁ hab₂ h₁ h₂ (e₁.symm.trans e₂)) + · exact h₁₂ (arc_tail_eq hab₁ hab₂ h₁ h₂ (e₁.symm.trans e₂)) + +/-- An arc inside a side, read in the same sense as the side, has the direction of the side. -/ +theorem dirAgrees_arcs (ε : Bool) (hN : N.Finite) (h2 : ∀ C : cuffs X, ∃ p ∈ N ∩ C.1, ∃ q ∈ N ∩ + C.1, p ≠ q) (hN' : N'.Finite) (h2' : ∀ C : cuffs X, ∃ p ∈ N' ∩ C.1, ∃ q ∈ N' ∩ C.1, p ≠ q) {e s : + Set X} + (he : e ∈ arcComponentsIn (bd X \ N')) (hs : s ∈ arcComponentsIn (bd X \ N)) (hes : e ⊆ s) : + DirAgrees s (arcMarch hX ε s) e (arcMarch hX ε e) := by + obtain ⟨C, a, b, hab, hub, hse, -, -, -⟩ := exists_arc_of_mem hX (cuffPar hX) hN h2 hs + obtain ⟨C', a', b', hab', hub', hee, -, -, -⟩ := exists_arc_of_mem hX (cuffPar hX) hN' h2' he + obtain ⟨C₁, a₁, b₁, hab₁, hub₁, hs₁, hl₁⟩ := arcMarch_spec hX ε hab hub hse + obtain ⟨C₂, a₂, b₂, hab₂, hub₂, he₂, hl₂⟩ := arcMarch_spec hX ε hab' hub' hee + rw [hl₁, hl₂] + have hC : C₂ = C₁ := by + by_contra hne + obtain ⟨x, hx⟩ := he.1 + have h₁ : x ∈ C₁.1 := arcOf_subset _ _ _ (hs₁ ▸ hes hx) + have h₂ : x ∈ C₂.1 := arcOf_subset _ _ _ (he₂ ▸ hx) + exact disjoint_left.mp (cuffs_disjoint' hne) h₂ h₁ + subst hC + obtain ⟨m, h₁, h₂⟩ := exists_shift (cuffPar hX C₂) hab₁ hab₂ hub₁ (by + rw [← he₂, ← hs₁] + exact hes) + have hshift := arcOf_shift (cuffPar hX C₂) a₂ b₂ m + have hp₁ := cuffPoint_shift (cuffPar hX C₂) a₂ m + have hp₂ := cuffPoint_shift (cuffPar hX C₂) b₂ m + rw [hs₁, he₂, ← hshift, ← hp₁, ← hp₂] + have hlt : a₂ + m * (2 * Real.pi) < b₂ + m * (2 * Real.pi) := by linarith + cases ε + · simpa using dirAgrees_forward (cuffPar hX C₂) hub₁ h₁ hlt h₂ + · simpa using dirAgrees_backward (cuffPar hX C₂) hub₁ h₁ hlt h₂ + +end Arcs + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +/-- The direction of the arcs of each cuff. -/ +noncomputable def flipOf {X : Type} [TopologicalSpace X] (ε : Set X → Bool) (e : Set X) : Bool := by + classical exact decide (∃ C ∈ cuffs X, (e ∩ C).Nonempty ∧ ε C = true) + +theorem flipOf_eq {X : Type} [TopologicalSpace X] (ε : Set X → Bool) {e C : Set X} + (hC : C ∈ cuffs X) (he : e.Nonempty) (hs : e ⊆ C) : flipOf ε e = ε C := by + classical + have key : (∃ C' ∈ cuffs X, (e ∩ C').Nonempty ∧ ε C' = true) ↔ ε C = true := by + constructor + · rintro ⟨C', hC', ⟨x, hx, hx'⟩, h⟩ + obtain rfl : C = C' := by + by_contra hne + exact disjoint_left.mp (cuffs_disjoint hC hC' hne) (hs hx) hx' + exact h + · intro h + obtain ⟨x, hx⟩ := he + exact ⟨C, hC, ⟨x, hx, hs hx⟩, h⟩ + simp only [flipOf, key, Bool.decide_eq_true] + +namespace Slice + +variable {T : Set S} {D : TangleDatum cap χ} (s : Slice T D) + +/-- The singular places on the rim of a wheel: the last one, and those where the two spokes have +different inner ends. -/ +def sing (W : ↥s.𝒲) : Set ℕ := {i | i < (s.fr W).R.k ∧ (i + 1 = (s.fr W).R.k ∨ ¬ (s.fr W).Reg i)} + +/-- The point of `Σ'` at the `i`th vertex of `R*` on the rim of a wheel. -/ +noncomputable def zx (W : ↥s.𝒲) (i : ℕ) : ↥Tᶜ := (s.arc_reg W i).choose + +theorem zx_arc (W : ↥s.𝒲) (i : ℕ) : s.zx W i ∈ s.arc W i := (s.arc_reg W i).choose_spec.1 + +theorem e_zx (W : ↥s.𝒲) (i : ℕ) : s.e (s.zx W i) = (s.fr W).R.reg i := (s.arc_reg W i).choose_spec.2 + +/-- The vertices of the frame. -/ +noncomputable def markN : Set ↥Tᶜ := ⋃ W, ⋃ i ∈ s.sing W, {s.vx W i, s.vx W (i + 1)} + +/-- The singular vertices of `R*`. -/ +noncomputable def markZ : Set ↥Tᶜ := ⋃ W, ⋃ i ∈ s.sing W, {s.zx W i} + +include s + +theorem finite_sing (W : ↥s.𝒲) : (s.sing W).Finite := (finite_lt_nat _).subset fun _ h ↦ h.1 + +theorem finite_𝒲 : Finite ↥s.𝒲 := s.cut.finite.to_subtype + +theorem finite_markN : s.markN.Finite := by + have := s.finite_𝒲 + exact finite_iUnion fun W ↦ (s.finite_sing W).biUnion fun i _ ↦ by simp + +theorem finite_markZ : s.markZ.Finite := by + have := s.finite_𝒲 + exact finite_iUnion fun W ↦ (s.finite_sing W).biUnion fun i _ ↦ by simp + +theorem markN_sub : s.markN ⊆ s.Nb := by + intro x hx + obtain ⟨W, hx⟩ := mem_iUnion.mp hx + obtain ⟨i, -, hx⟩ := mem_iUnion₂.mp hx + rcases hx with rfl | hx + · exact s.vx_N W i + · exact (mem_singleton_iff.mp hx) ▸ s.vx_N W (i + 1) + +theorem last_sing (W : ↥s.𝒲) : (s.fr W).R.k - 1 ∈ s.sing W := by + have := (s.fr W).R.two + exact ⟨by omega, .inl (by omega)⟩ + +theorem vx_succ_last (W : ↥s.𝒲) : s.vx W ((s.fr W).R.k - 1 + 1) = s.vx W 0 := by + have := (s.fr W).R.two + rw [show (s.fr W).R.k - 1 + 1 = 0 + (s.fr W).R.k by omega] + exact s.vx_add_k W 0 + +theorem exists_wheel (C : cuffs ↥Tᶜ) : ∃ W : ↥s.𝒲, C.1 = s.cf W := by + obtain ⟨C, hC⟩ := C + rw [s.cuffs_eq] at hC + obtain ⟨W, hW, rfl⟩ := hC + exact ⟨⟨W, hW⟩, rfl⟩ + +theorem two_marks (C : cuffs ↥Tᶜ) : ∃ p ∈ s.markN ∩ C.1, ∃ q ∈ s.markN ∩ C.1, p ≠ q := by + obtain ⟨W, hW⟩ := s.exists_wheel C + rw [hW] + have hl := s.last_sing W + have h₁ : s.vx W ((s.fr W).R.k - 1) ∈ s.markN := mem_iUnion.mpr ⟨W, mem_iUnion₂.mpr ⟨_, hl, .inl + rfl⟩⟩ + have h₂ : s.vx W ((s.fr W).R.k - 1 + 1) ∈ s.markN := mem_iUnion.mpr ⟨W, mem_iUnion₂.mpr ⟨_, hl, + .inr rfl⟩⟩ + exact ⟨_, ⟨h₁, s.vx_cf W _⟩, _, ⟨h₂, s.vx_cf W _⟩, s.vx_ne_succ W _⟩ + +theorem tilde_sing {W : ↥s.𝒲} {i : ℕ} (hi : i ∈ s.sing W) : tilde (s.arc W i) ⊆ s.markN := by + rw [s.tilde_arc] + rintro _ (rfl | h) + · exact mem_iUnion.mpr ⟨W, mem_iUnion₂.mpr ⟨_, hi, .inl rfl⟩⟩ + · exact mem_iUnion.mpr ⟨W, mem_iUnion₂.mpr ⟨_, hi, .inr h⟩⟩ + +/-- A singular arc of the rim is a side of the frame. -/ +theorem arc_side {W : ↥s.𝒲} {i : ℕ} (hi : i ∈ s.sing W) : s.arc W i ∈ arcComponentsIn + (bd ↥Tᶜ \ s.markN) := + arc_mem_of_ends s.isSurface s.finite_markN s.two_marks s.finite_Nb s.two s.markN_sub + (s.arc_mem W i) (s.tilde_sing hi) + +theorem exists_sing_side {v : ↥Tᶜ} (hv : v ∈ s.markN) : ∃ W, ∃ i ∈ s.sing W, v ∈ tilde (s.arc W i) + := by + obtain ⟨W, hv⟩ := mem_iUnion.mp hv + obtain ⟨i, hi, hv⟩ := mem_iUnion₂.mp hv + exact ⟨W, i, hi, by rw [s.tilde_arc]; exact hv⟩ + +/-- The sides with no singular point have no common end. -/ +theorem long_disjoint : ∀ s₁ ∈ arcComponentsIn (bd ↥Tᶜ \ s.markN), ∀ s₂ ∈ arcComponentsIn + (bd ↥Tᶜ \ s.markN), s₁ ≠ s₂ → Disjoint s₁ s.markZ → Disjoint s₂ s.markZ → Disjoint (tilde s₁) + (tilde s₂) := by + intro s₁ h₁ s₂ h₂ hne hl₁ hl₂ + refine disjoint_left.mpr fun v hv₁ hv₂ ↦ ?_ + have hX := s.isSurface + have hv : v ∈ s.markN := by + obtain ⟨C, a, b, hab, hub, rfl, -, ha, hb⟩ := exists_arc_of_mem hX + (cuffPar hX) s.finite_markN s.two_marks h₁ + rw [tilde_arcOf _ hab hub] at hv₁ + rcases hv₁ with rfl | h + · exact ha + · exact (mem_singleton_iff.mp h) ▸ hb + obtain ⟨W, i, hi, hvt⟩ := s.exists_sing_side hv + have hz : s.zx W i ∈ s.markZ := mem_iUnion.mpr ⟨W, mem_iUnion₂.mpr ⟨_, hi, rfl⟩⟩ + refine three_arcs hX s.finite_markN s.two_marks h₁ h₂ (s.arc_side hi) hv₁ hv₂ hvt hne ?_ ?_ + · rintro rfl + exact disjoint_left.mp hl₁ (s.zx_arc W i) hz + · rintro rfl + exact disjoint_left.mp hl₂ (s.zx_arc W i) hz + +/-- Wheels with a common point on their rims are the same. -/ +theorem wheel_eq {W W' : ↥s.𝒲} {x : ↥Tᶜ} (h : x ∈ s.cf W) (h' : x ∈ s.cf W') : W = W' := by + by_contra hne + have hne' : W.1 ≠ W'.1 := fun e ↦ hne (Subtype.ext e) + exact disjoint_left.mp (s.cut.disj W.2 W'.2 hne') (Surface.discBd_subset _ h) + (Surface.discBd_subset _ h') + +/-- An arc lies on the rim of one wheel only. -/ +theorem arc_wheel {W W' : ↥s.𝒲} {p q : ℕ} (h : s.arc W p = s.arc W' q) : W = W' := by + obtain ⟨x, hx, -⟩ := s.arc_reg W p + exact s.wheel_eq (s.arc_cf W p hx) (s.arc_cf W' q (h ▸ hx)) + +/-- The two ends of an arc tell us its place on the rim. -/ +theorem arc_pos (W : ↥s.𝒲) {p q : ℕ} (hp : p < (s.fr W).R.k) (hq : q < (s.fr W).R.k) (h : s.arc W p + = s.arc W q) : p = q := by + have ht := congrArg tilde h + rw [s.tilde_arc, s.tilde_arc] at ht + have h₁ : s.vx W p ∈ ({s.vx W q, s.vx W (q + 1)} : Set ↥Tᶜ) := ht ▸ .inl rfl + rcases h₁ with h₁ | h₁ + · exact s.vx_inj W hp hq h₁ + have h₂ : s.vx W q ∈ ({s.vx W p, s.vx W (p + 1)} : Set ↥Tᶜ) := ht ▸ .inl rfl + rcases h₂ with h₂ | h₂ + · exact s.vx_inj W hp hq h₂.symm + exfalso + have hm := s.vx_mod_eq W h₁ + refine s.vx_ne_add_two W q (h₂.trans ?_) + apply s.isEmbedding.injective + rw [s.e_vx, s.e_vx, Rim.vert, Rim.vert] + congr 2 + rw [show q + 2 = q + 1 + 1 by omega, Nat.add_mod, hm, ← Nat.add_mod] + +end Slice + +/-- The frame `Φ'`. -/ +noncomputable def cutFrame {X : Type} [TopologicalSpace X] [T2Space X] (hX : IsSurface X) + (N Z : Set X) (ε : Set X → Bool) (hf : N.Finite) (hsub : N ⊆ bd X) (h2 : ∀ C : cuffs X, ∃ p ∈ N ∩ + C.1, ∃ q ∈ N ∩ C.1, p ≠ q) + (hl : ∀ s₁ ∈ arcComponentsIn (bd X \ N), ∀ s₂ ∈ arcComponentsIn (bd X \ N), s₁ ≠ s₂ + → Disjoint s₁ Z → Disjoint s₂ Z → Disjoint (tilde s₁) (tilde s₂)) : Frame X where + V := N + γ s := arcMarch hX (flipOf ε s) s + isLong s := Disjoint s Z + V_subset := hsub + finite_V := hf + finite_sides := finite_arcComponentsIn_bd hX hf h2 + side_shape _ hs := arc_shape hX hf h2 hs + γ_nodup s hs := by + obtain ⟨C, a, b, hab, hub, he, -, -, -⟩ := exists_arc_of_mem hX (cuffPar hX) hf h2 hs + exact (arcMarch_spec hX _ hab hub he).nodup + γ_set s hs := by + obtain ⟨C, a, b, hab, hub, he, -, -, -⟩ := exists_arc_of_mem hX (cuffPar hX) hf h2 hs + exact (arcMarch_spec hX _ hab hub he).set_eq + long_disjoint := hl + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section14z.lean b/LeanPool/GraphMinor/GM19/Section14z.lean new file mode 100644 index 0000000000..4f2437d1e7 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section14z.lean @@ -0,0 +1,157 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section14y + +/-! +# Graph Minors XIX, Section 14: the coloured painting `(Γ', φ')` +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 TangleDatum + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [TopologicalSpace Shat] [T2Space S] [T2Space Shat] {α + : Type w} + {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace Slice + +variable {T : Set S} {D : TangleDatum cap χ} (s : Slice T D) + +/-- The drawing `K` of the fragment. -/ +noncomputable def K : Drawing S := s.exists_K.choose + +include s + +theorem K_U : s.K.U = cutF (cap.emb ∘ s.f) s.𝒲 := s.exists_K.choose_spec.1 + +theorem K_V : s.K.V = Subtype.val '' s.Nb := s.exists_K.choose_spec.2.1 + +theorem fd : FrameData χ.Φ s.Q.Γ s.K (Subtype.val : ↥Tᶜ → S) := s.exists_K.choose_spec.2.2.1 + +theorem anchored : IsAnchored s.Q.Γ s.K := s.exists_K.choose_spec.2.2.2 + +theorem mem_pullV {x : ↥Tᶜ} : x ∈ pullV s.Q.Γ s.K Subtype.val ↔ x ∈ s.N := by + constructor + · rintro (h | h) + · exact s.mem_QV.mp h + · rw [s.K_V] at h + obtain ⟨y, hy, e⟩ := h + exact Subtype.ext e ▸ hy.1 + · intro h + exact .inl (s.mem_QV.mpr h) + +theorem bd_pullV : bd ↥Tᶜ \ pullV s.Q.Γ s.K Subtype.val = bd ↥Tᶜ \ s.Nb := by + ext x + simp only [mem_sdiff, s.mem_pullV, Nb, mem_inter_iff] + tauto + +theorem pullFrameV_eq : pullFrameV χ.Φ s.K (Subtype.val : ↥Tᶜ → S) = s.Nb := by + ext x + constructor + · rintro (h | h) + · exact absurd (s.bd_sub_T (χ.Φ.V_subset h)) x.2 + · rw [s.K_V] at h + obtain ⟨y, hy, e⟩ := h + exact Subtype.ext e ▸ hy + · intro h + exact .inr (by rw [s.K_V]; exact ⟨x, h, rfl⟩) + +variable [Nonempty ↥Tᶜ] + +omit s in +/-- The painting `Γ'`. -/ +noncomputable def paint (s : Slice T D) (ε : Set ↥Tᶜ → Bool) : Painting ↥Tᶜ := s.fd.paint (flipOf ε) + +theorem paint_V (ε : Set ↥Tᶜ → Bool) : (s.paint ε).V = s.N := by + ext x + exact s.mem_pullV + +theorem arc_E (ε : Set ↥Tᶜ → Bool) {c : Set ↥Tᶜ} (hc : c ∈ arcComponentsIn (bd ↥Tᶜ \ s.Nb)) : c ∈ + (s.paint ε).E := + (s.fd.mem_paint_E _).mpr (.inl (by rw [s.bd_pullV]; exact hc)) + +theorem border_arc (ε : Set ↥Tᶜ → Bool) {e : Set ↥Tᶜ} (he : e ∈ (s.paint ε).E) + (hb : Painting.IsBorder e) : e ∈ arcComponentsIn (bd ↥Tᶜ \ s.Nb) := by + rw [← s.bd_pullV] + exact s.fd.mem_arcs_of_border _ he hb + +theorem γ_arc (ε : Set ↥Tᶜ → Bool) {c : Set ↥Tᶜ} (hc : c ∈ arcComponentsIn (bd ↥Tᶜ \ s.Nb)) : + (s.paint ε).γ c = arcMarch s.isSurface (flipOf ε c) c := by + have hp : c ∈ arcComponentsIn (bd ↥Tᶜ \ pullV s.Q.Γ s.K Subtype.val) := by + rwa [s.bd_pullV] + have hnl := s.fd.pull.notMem_liftPieces hp + change pullγ s.Q.Γ Subtype.val _ c = _ + rw [pullγ_arc hnl] + change arcMarch _ (flipOf ε (sideOf χ.Φ s.K Subtype.val c)) c = _ + have hs : c ∈ arcComponentsIn (bd ↥Tᶜ \ pullFrameV χ.Φ s.K Subtype.val) := by + rwa [s.pullFrameV_eq] + rw [FrameData.sideOf_eq hc.1 hs subset_rfl] + +/-- The hypotheses on the frame. -/ +structure IsCutFrame (Φ' : Frame ↥Tᶜ) (Z : Set ↥Tᶜ) (ε : Set ↥Tᶜ → Bool) : Prop where + V_eq : Φ'.V = s.markN + Z_eq : Z = s.markZ + long_iff : ∀ c, Φ'.isLong c ↔ Disjoint c Z + γ_eq : ∀ c, Φ'.γ c = arcMarch s.isSurface (flipOf ε c) c + +theorem paint_fits {Φ' : Frame ↥Tᶜ} {Z : Set ↥Tᶜ} {ε : Set ↥Tᶜ → Bool} (h : s.IsCutFrame Φ' Z ε) : + (s.paint ε).Fits Φ' := by + have hS := χ.isSurface + have := χ.connected + have hX := s.isSurface + have hsides : Φ'.sides = arcComponentsIn (bd ↥Tᶜ \ s.markN) := by + simp only [Frame.sides, h.V_eq] + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · intro x hx + rw [h.V_eq] at hx + rw [s.paint_V] + exact (s.markN_sub hx).1 + · rintro c ⟨hc, hl⟩ + rw [hsides] at hc + have hnd : ¬ Disjoint c s.markZ := fun hd ↦ hl ((h.long_iff c).mpr (h.Z_eq ▸ hd)) + obtain ⟨z, hzc, hz⟩ := not_disjoint_iff.mp hnd + obtain ⟨W, hz⟩ := mem_iUnion.mp hz + obtain ⟨i, hi, rfl⟩ := mem_iUnion₂.mp hz + obtain rfl : c = s.arc W i := arcComp_eq_of_mem hc (s.arc_side hi) hzc (s.zx_arc W i) + exact s.arc_E ε (s.arc_mem W i) + · intro e he hb c hc hes + rw [hsides] at hc + have ha := s.border_arc ε he hb + rw [s.γ_arc ε ha, h.γ_eq] + have hne : e.Nonempty := ha.1 + obtain ⟨x, hx⟩ := hne + have hxb := (ha.2.1 hx).1 + obtain ⟨C, hC, hxC⟩ := sUnion_cuffs (S := ↥Tᶜ) ▸ hxb + obtain ⟨C₁, a, b, -, -, rfl, -, -, -⟩ := exists_arc_of_mem hX (cuffPar hX) s.finite_markN + s.two_marks hc + have hCe : (C₁ : Set ↥Tᶜ) = C := by + by_contra hne + exact disjoint_left.mp (cuffs_disjoint C₁.2 hC hne) (arcOf_subset _ _ _ (hes hx)) hxC + rw [flipOf_eq ε C₁.2 hc.1 (arcOf_subset _ _ _), flipOf_eq ε C₁.2 ha.1 (hes.trans + (arcOf_subset _ _ _))] + exact dirAgrees_arcs hX _ s.finite_markN s.two_marks s.finite_Nb s.two ha hc hes + · exact s.fd.pull.isInternallyThreeConnected _ (fun _ hp ↦ (s.fd.nodup_arcMarch _ + s.fd.pull.finite_pullV s.fd.pull.two hp).1) + (fun _ hp ↦ (s.fd.nodup_arcMarch _ s.fd.pull.finite_pullV s.fd.pull.two hp).2) + s.Q.fits.internally_three_connected s.anchored + · exact s.fd.pull.size_three_region hS _ (fun _ hp ↦ (s.fd.nodup_arcMarch _ + s.fd.pull.finite_pullV s.fd.pull.two hp).1) + (fun _ hp ↦ (s.fd.nodup_arcMarch _ s.fd.pull.finite_pullV s.fd.pull.two hp).2) + s.Q.fits.size_three_region s.anchored + +end Slice + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15a.lean b/LeanPool/GraphMinor/GM19/Section15a.lean new file mode 100644 index 0000000000..6877ea8719 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15a.lean @@ -0,0 +1,205 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Conditional2 + +/-! +# Tools for the proof of (4.1) + +The set `𝒮` of the proof of (4.1) consists of all images of a similarly oriented sequence. A finite +union of well-behaved sets is well-behaved, and a rooted location that isolates a tangle also +isolates +it for larger `θ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {χ : ColourScheme S α} + +omit [T2Space S] in +theorem IsFramePreservingHomeo.refl' (Φ : Frame S) : IsFramePreservingHomeo Φ + (Homeomorph.refl S) where + fix_V _ _ := rfl + preserve_sides s _ := by simp + preserves_orientation ω Δ _ a b c _ _ _ _ _ _ := by simp + +omit [T2Space S] in +theorem IsFramePreservingHomeo.comp {Φ : Frame S} {f g : S ≃ₜ S} + (hf : IsFramePreservingHomeo Φ f) (hg : IsFramePreservingHomeo Φ g) : + IsFramePreservingHomeo Φ (f.trans g) where + fix_V v hv := by simp [hf.fix_V v hv, hg.fix_V v hv] + preserve_sides s hs := by + rw [show ⇑(f.trans g) = g ∘ f from rfl, image_comp, hf.preserve_sides s hs, + hg.preserve_sides s hs] + preserves_orientation ω Δ hΔ a b c ha hb hc hab hbc hac := by + have h₁ := hf.preserves_orientation ω Δ hΔ a b c ha hb hc hab hbc hac + have hΔ' : IsClosedDisc (f '' Δ) := GM20.image_isClosedDisc f hΔ + have hbd := GM20.image_discBd f Δ + have h₂ := hg.preserves_orientation ω (f '' Δ) hΔ' (f a) (f b) (f c) + (hbd ▸ mem_image_of_mem _ ha) (hbd ▸ mem_image_of_mem _ hb) (hbd ▸ mem_image_of_mem _ hc) + (fun h ↦ hab (f.injective h)) (fun h ↦ hbc (f.injective h)) (fun h ↦ hac (f.injective h)) + change ω.pos ((g ∘ f) '' Δ) (g (f a)) (g (f b)) (g (f c)) ↔ _ + rw [image_comp] + exact h₂.trans h₁ + +omit [T2Space S] in +theorem IsColouredImage.refl' (P : ColouredPainting χ) : + IsColouredImage (Homeomorph.refl S) P P where + U := by simp + V := by simp + γ e _ := by simp + φ e _ := by simp + +omit [T2Space S] in +theorem IsColouredImage.comp {f g : S ≃ₜ S} {P P' P'' : ColouredPainting χ} + (I : IsColouredImage f P P') (J : IsColouredImage g P' P'') : + IsColouredImage (f.trans g) P P'' where + U := by rw [J.U, I.U]; exact (image_comp g f _).symm + V := by rw [J.V, I.V]; exact (image_comp g f _).symm + γ e he := by + have hm : f '' e ∈ P'.Γ.E := I.E_eq ▸ mem_image_of_mem _ he + change P''.Γ.γ ((g ∘ f) '' e) = List.map (g ∘ f) (P.Γ.γ e) + rw [image_comp, J.γ _ hm, I.γ e he, List.map_map] + φ e he := by + have hm : f '' e ∈ P'.Γ.E := I.E_eq ▸ mem_image_of_mem _ he + change P''.φ ((g ∘ f) '' e) = P.φ e + rw [image_comp, J.φ _ hm, I.φ e he] + +omit [T2Space S] in +/-- The image of a painting under a `Φ`-preserving homeomorphism has the same orientations. -/ +theorem IsColouredImage.oriented {f : S ≃ₜ S} {P P' : ColouredPainting χ} + (I : IsColouredImage f P P') (hf : IsFramePreservingHomeo χ.Φ f) {ω : SurfaceOrientation S} + (hω : ∀ e ∈ P.Γ.E, (tilde e).ncard = 3 → ∀ a b c : S, P.Γ.γ e = [a, b, c] → + ω.pos (closure e) a b c) {e' : Set S} (he' : e' ∈ P'.Γ.E) (h3 : (tilde e').ncard = 3) + {a b c : S} (hγ : P'.Γ.γ e' = [a, b, c]) : ω.pos (closure e') a b c := by + rw [I.E_eq] at he' + obtain ⟨d, hd, rfl⟩ := he' + have h3' : (tilde d).ncard = 3 := by rwa [ncard_tilde_image] at h3 + rw [I.γ d hd] at hγ + obtain ⟨a₀, b₀, c₀, h₀, rfl, rfl, rfl⟩ : ∃ a₀ b₀ c₀, P.Γ.γ d = [a₀, b₀, c₀] ∧ f a₀ = a ∧ f b₀ = b + ∧ + f c₀ = c := by + generalize P.Γ.γ d = l at hγ + match l, hγ with + | [a₀, b₀, c₀], h => + simp only [List.map_cons, List.map_nil, List.cons.injEq, and_true] at h + exact ⟨a₀, b₀, c₀, rfl, h.1, h.2.1, h.2.2⟩ + have hdisc : IsClosedDisc (closure d) ∧ tilde d ⊆ discBd (closure d) := by + rcases P.Γ.edge_shape d hd with h | h + · omega + · exact ⟨h.2.2.1, h.2.2.2⟩ + have hset := P.Γ.γ_set d hd + have hnd := P.Γ.γ_nodup d hd + rw [h₀] at hset hnd + have hmem : ∀ x, x ∈ [a₀, b₀, c₀] → x ∈ discBd (closure d) := fun x hx ↦ + hdisc.2 (hset ▸ hx) + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or, List.nodup_nil, + and_true, not_false_eq_true] at hnd + change ω.pos (closure (f '' d)) _ _ _ + rw [← f.image_closure] + exact (hf.preserves_orientation ω _ hdisc.1 a₀ b₀ c₀ (hmem _ (by simp)) (hmem _ (by simp)) + (hmem _ (by simp)) hnd.1.1 hnd.2 hnd.1.2).mpr (hω d hd h3' a₀ b₀ c₀ h₀) + +/-- The set `𝒮` of the proof of (4.1): "Let $\mathscr{S}$ be a similarly oriented set of +$\chi$-coloured paintings containing +$(\Gamma_i, \phi_i)$ for each $i \ge 0$, and closed under $\Phi_\chi$-preserving +homeomorphisms of $\Sigma_\chi$. This exists since $\{(\Gamma_i, \phi_i) \colon i \ge 0\}$ +is similarly oriented and so are all images of each $(\Gamma_i, \phi_i)$ under +$\Phi_\chi$-preserving homeomorphisms." -/ +def imageClass (P : ℕ → ColouredPainting χ) : Set (ColouredPainting χ) := + {P' | ∃ i, ∃ f : S ≃ₜ S, IsFramePreservingHomeo χ.Φ f ∧ IsColouredImage f (P i) P'} + +omit [T2Space S] in +theorem mem_imageClass (P : ℕ → ColouredPainting χ) (i : ℕ) : P i ∈ imageClass P := + ⟨i, _, IsFramePreservingHomeo.refl' _, IsColouredImage.refl' _⟩ + +omit [T2Space S] in +theorem isPaintingClass_imageClass {P : ℕ → ColouredPainting χ} (h : IsSimilarlyOriented χ P) : + IsPaintingClass χ (imageClass P) := by + refine ⟨?_, ?_⟩ + · rcases h with h | ⟨ω, hω⟩ + · exact Or.inl h + · refine Or.inr ⟨ω, ?_⟩ + rintro P' ⟨i, f, hf, I⟩ e he h3 a b c hγ + exact I.oriented hf (hω i) he h3 hγ + · rintro P' ⟨i, f, hf, I⟩ g P'' hg J + exact ⟨i, f.trans g, hf.comp hg, I.comp J⟩ + +omit [T2Space S] in +/-- A finite union of well-behaved sets is well-behaved. A sequence in the union has an infinite +part +in one of the sets. -/ +theorem IsWellBehavedPlaces.iUnion {ι : Type*} [Finite ι] {C : ι → Set (Place χ)} + (hC : ∀ i, IsWellBehavedPlaces (C i)) : IsWellBehavedPlaces (⋃ i, C i) := by + intro β Ω hΩ seq hseq ξ hξ + classical + choose c hc using fun n ↦ mem_iUnion.mp (hseq n) + obtain ⟨j, hj⟩ := Finite.exists_infinite_fiber c + have hfreq : ∀ N, ∃ n > N, c n = j := by + intro N + have hinf : (c ⁻¹' {j}).Infinite := infinite_coe_iff.mp hj + obtain ⟨n, hn, hN⟩ := hinf.exists_gt N + exact ⟨n, hN, hn⟩ + obtain ⟨g, hg, hgj⟩ := Nat.exists_strictMono_subsequence hfreq + obtain ⟨a, b, hab, τ, hτ, hle⟩ := hC j Ω hΩ (fun n ↦ seq (g n)) + (fun n ↦ hgj n ▸ hc (g n)) (fun n ↦ ξ (g n)) (fun n ↦ hξ (g n)) + exact ⟨g a, g b, hg hab, τ, hτ, hle⟩ + +omit [T2Space S] in +theorem IsWellBehavedPlaces.union {C D : Set (Place χ)} (hC : IsWellBehavedPlaces C) + (hD : IsWellBehavedPlaces D) : IsWellBehavedPlaces (C ∪ D) := by + rw [union_eq_iUnion] + exact IsWellBehavedPlaces.iUnion fun b ↦ by + cases b + · exact hD + · exact hC + +omit [T2Space S] [T2Space Shat] in +/-- A rooted location that `θ₁`-isolates a tangle also `θ₂`-isolates it, for `θ₁ ≤ θ₂ ≤ ord(𝒯)`. -/ +theorem RootedLocation.Isolates.mono {Γ : Painting S} {cap : IsCappedSurface S Shat} + {rad : RadialDrawing cap Γ} {tb : TieBreaker rad} {L : RootedLocation Γ} {θ₁ θ₂ ord : ℕ} + {𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} (h : L.Isolates tb θ₁ ord 𝒯) + (h₁ : θ₁ ≤ θ₂) (h₂ : θ₂ ≤ ord) : L.Isolates tb θ₂ ord 𝒯 where + seps_subset := h.seps_subset + ord_lt := lt_of_lt_of_le h.ord_lt h₁ + le_ord := h₂ + distinction_le A hA ord' 𝒯' h𝒯' hθ := h.distinction_le A hA ord' 𝒯' h𝒯' (h₁.trans hθ) + +/-- A bound on `dist(Γ)`, or on `rep(Γ)`, used with no fractions. -/ +theorem two_mul_le_of_lt {N x : ℕ} {d : ℕ∞} (h : (N : ℕ∞) < d) (hx : x ≤ 2 * N + 2) : + (x : ℕ∞) ≤ 2 * d := by + induction d using ENat.recTopCoe with + | top => + rw [ENat.mul_top (by simp)] + exact le_top + | coe n => + have h₁ : N < n := by exact_mod_cast h + have h₂ : x ≤ 2 * n := by omega + exact_mod_cast h₂ + +theorem two_mul_lt_of_lt {N x : ℕ} {d : ℕ∞} (h : (N : ℕ∞) < d) (hx : x < 2 * N + 2) : + (x : ℕ∞) < 2 * d := by + induction d using ENat.recTopCoe with + | top => + rw [ENat.mul_top (by simp)] + exact ENat.natCast_lt_top _ + | coe n => + have h₁ : N < n := by exact_mod_cast h + have h₂ : x < 2 * n := by omega + exact_mod_cast h₂ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15b.lean b/LeanPool/GraphMinor/GM19/Section15b.lean new file mode 100644 index 0000000000..b8cdb448b3 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15b.lean @@ -0,0 +1,307 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section15a +public import LeanPool.GraphMinor.GM19.Section6b +public import LeanPool.GraphMinor.GM19.Relabel +public import LeanPool.GraphMinor.GM19.Section8a + +import LeanPool.GraphMinor.GM19.Section10f + +import LeanPool.GraphMinor.GM19.Section10s + +import LeanPool.GraphMinor.GM19.Section10t + +import LeanPool.GraphMinor.GM19.Section11g + +import LeanPool.GraphMinor.GM19.Section14ah + +import LeanPool.GraphMinor.GM19.Section15q + +import LeanPool.GraphMinor.GM19.Section5oProved + +import LeanPool.GraphMinor.GM19.Section5r + +import LeanPool.GraphMinor.GM19.Section6Two +import LeanPool.GraphMinor.GM19.UniverseLift2 + +/-! +# Graph Minors XIX, (4.1) + +This is the proof of (4.1) at the end of Section 15. It takes a similarly oriented bad sequence for +a +disjoint colour scheme, and shows that every tangle of large order in a late term is isolated by a +rooted location from one well-behaved set. Then (9.2) gives an inflation, which (6.1) forbids. + +The argument for one tangle is `exists_isolating`. In the paper it is the display (1) of the proof +together with the sentence on (10.3), (10.4), (10.5), (11.1) and (14.1). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe u w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {β : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S β} + +/-- The arithmetic used in the proof of (4.1), with `B = 5^{2m+2} n = 25n · 5^{2m}`. -/ +theorem level_bound (m n : ℕ) : 25 * ((m + 1) * n) ≤ 5 ^ (2 * m + 2) * n := by + refine Nat.mul_le_mul_right _ ?_ |>.trans' (by rw [Nat.mul_assoc]) |>.trans (le_refl _) + have h : 2 * m < 5 ^ (2 * m) := Nat.lt_pow_self (by norm_num) + rw [pow_add] + omega + +omit [T2Space S] in +/-- One tangle in the proof of (4.1): if `𝒯` has order larger than `B = 5^{2m+2} n` in a painting +with +`rep`, `dist` larger than `B`, and there is no inflation of `P₀`, then one of the five kinds of flaw +holds and so `𝒯` is `(B + 1)`-isolated by a rooted location from `𝒞`. -/ +theorem exists_isolating (hd : χ.IsDisjoint) {𝒮 : Set (ColouredPainting χ)} + {P₀ : ColouredPainting χ} {n : ℕ} (hn : 8 ≤ n) {ω : Set S → List β} + (hω : ∀ side ∈ χ.Φ.longSides, IsBorderLabels P₀ side (ω side)) + {𝒞₁ : Set (Place χ)} {𝒞₂ 𝒞₃ : ℕ → Set (Place χ)} {𝒞₄ 𝒞₅ : Set (Place χ)} + {B : ℕ} (hB : B = 5 ^ (2 * P₀.Γ.E.ncard + 2) * n) + (p₁ : ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → ((B + 1 : ℕ) : ℕ∞) ≤ Painting.rep D.rad → B + 1 + ≤ D.ord → + D.rep < B + 1 → ((B + 1 + 2 : ℕ) : ℕ∞) ≤ 2 * Painting.dist D.rad → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb (B + 1) D.ord D.𝒯 ∧ (⟨hd, D.P, L⟩ : Place χ) ∈ 𝒞₁) + (p₂ : ∀ a, ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → D.IsFlawedInDistance (a + 1) → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb (a + 1 + 1) D.ord D.𝒯 ∧ + (⟨hd, D.P, L⟩ : Place χ) ∈ 𝒞₂ a) + (p₃ : ∀ a, ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → D.IsFlawedInFreedom a → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb (a + 1) D.ord D.𝒯 ∧ + (⟨hd, D.P, L⟩ : Place χ) ∈ 𝒞₃ a) + (p₄ : ∀ side ∈ χ.Φ.longSides, ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → + D.IsFlawedOnSide side (n / 2) (ω side) → + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb (((ω side).length + 1) * (n / 2)) D.ord D.𝒯 ∧ + (⟨hd, D.P, L⟩ : Place χ) ∈ 𝒞₄) + (p₅ : ∀ f ∈ P₀.Γ.E, Painting.IsInternal f → ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → + D.IsFlawedInternally P₀.Γ.E.ncard n (tilde f).ncard (P₀.φ f) → + ∃ L : RootedLocation D.P.Γ, + L.Isolates D.tb (4 * n * 5 ^ (2 * P₀.Γ.E.ncard) + 3) D.ord D.𝒯 ∧ + (⟨hd, D.P, L⟩ : Place χ) ∈ 𝒞₅) + {𝒞 : Set (Place χ)} (h₁ : 𝒞₁ ⊆ 𝒞) (h₂ : ∀ a ≤ B, 𝒞₂ a ⊆ 𝒞) (h₃ : ∀ a ≤ B, 𝒞₃ a ⊆ 𝒞) + (h₄ : 𝒞₄ ⊆ 𝒞) (h₅ : 𝒞₅ ⊆ 𝒞) + (D : TangleDatum cap χ) (hD : D.P ∈ 𝒮) (hrep : (B : ℕ∞) < Painting.rep D.rad) + (hdist : (B : ℕ∞) < Painting.dist D.rad) (hord : B + 1 ≤ D.ord) + (h152 : 3 * n < 2 * D.rep → + (∃ r₁ ∈ D.rad.poles, ∃ r₂ ∈ D.rad.poles, r₁ ≠ r₂ ∧ D.vDist r₁ r₂ ≤ n) ∨ + (∃ F : Drawing Shat, F.IsCircuitOf D.rad.G ∧ F.E.ncard ≤ 2 * n ∧ + ((∃ side ∈ χ.Φ.longSides, cap.emb '' side ⊆ D.ins F) ∨ + F.E.ncard < 2 * ((cap.emb '' χ.Φ.V) ∩ D.ins F).ncard)) ∨ + (∃ side ∈ χ.Φ.longSides, D.NoSideMatch side (n / 2) (ω side)) ∨ + (∃ f ∈ P₀.Γ.E, Painting.IsInternal f ∧ + D.NoInternalMatch P₀.Γ.E.ncard n (tilde f).ncard (P₀.φ f))) : + ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb (B + 1) D.ord D.𝒯 ∧ (⟨hd, D.P, L⟩ : Place χ) ∈ 𝒞 + := by + have hlev : 25 * ((P₀.Γ.E.ncard + 1) * n) ≤ B := hB ▸ level_bound _ _ + set m := P₀.Γ.E.ncard with hm + have hnc : n ≤ (m + 1) * n := Nat.le_mul_of_pos_left _ (by omega) + have hB25 : 25 * n ≤ B := by omega + -- The two reductions: a flaw in distance or in freedom at any level up to `B`. + have G : ∀ a, 1 ≤ a → a ≤ B → D.IsFlawedInDistance a → ∃ L : RootedLocation D.P.Γ, + L.Isolates D.tb (B + 1) D.ord D.𝒯 ∧ (⟨hd, D.P, L⟩ : Place χ) ∈ 𝒞 := by + intro a ha₁ haB hf + obtain ⟨b, rfl⟩ : ∃ b, a = b + 1 := ⟨a - 1, by omega⟩ + obtain ⟨L, hL, hmem⟩ := p₂ b D hD hf + exact ⟨L, hL.mono (by omega) hord, h₂ b (by omega) hmem⟩ + have H : ∀ a, a ≤ B → D.IsFlawedInFreedom a → ∃ L : RootedLocation D.P.Γ, + L.Isolates D.tb (B + 1) D.ord D.𝒯 ∧ (⟨hd, D.P, L⟩ : Place χ) ∈ 𝒞 := by + intro a haB hf + obtain ⟨L, hL, hmem⟩ := p₃ a D hD hf + exact ⟨L, hL.mono (by omega) hord, h₃ a haB hmem⟩ + by_cases hrepT : D.rep < B + 1 + · -- `rep(𝒯)` is small, so (10.3) applies. + obtain ⟨L, hL, hmem⟩ := p₁ D hD (Order.add_one_le_of_lt hrep |>.trans' + (by norm_cast)) hord hrepT + (two_mul_le_of_lt hdist (by omega)) + exact ⟨L, hL, h₁ hmem⟩ + have hrepB : B < D.rep := by omega + rcases h152 (by omega) with ⟨r₁, h₁', r₂, h₂', hne, hle⟩ | ⟨F, hF, hcard, hbad⟩ | ⟨s, hs, hno⟩ | + ⟨f, hf, hi, hno⟩ + · -- Two poles are close. + exact G n (by omega) (by omega) ⟨by omega, two_mul_lt_of_lt hdist (by omega), r₁, h₁', r₂, + h₂', hne, hle⟩ + · -- A short circuit includes a long side or many vertices of the frame. + by_cases hclose : ∃ r₁ ∈ D.rad.poles, ∃ r₂ ∈ D.rad.poles, r₁ ≠ r₂ ∧ D.vDist r₁ r₂ ≤ (m + 1) * n + · obtain ⟨r₁, h₁', r₂, h₂', hne, hle⟩ := hclose + exact G ((m + 1) * n) (by omega) (by omega) + ⟨by omega, two_mul_lt_of_lt hdist (by omega), r₁, h₁', r₂, h₂', hne, hle⟩ + · push Not at hclose + exact H ((m + 1) * n) (by omega) ⟨by omega, hclose, F, hF, by omega, hbad⟩ + · -- A long side has no good edges. All edges of a list are distinct edges of `Γ₀`. + have hlen : (ω s).length ≤ m := by + obtain ⟨-, -, c, g, u₀, u₁, -, -, hg, -, -⟩ := hω s hs + have hinj := hg.2.2.1 + have hmaps : ∀ i, g i ∈ P₀.Γ.E := fun i ↦ (hg.2.2.2.1 i).1 + have hcardg := Set.ncard_le_ncard (s := range g) (t := P₀.Γ.E) + (by rintro _ ⟨i, rfl⟩; exact hmaps i) P₀.Γ.finite_edges + rw [← image_univ, Set.ncard_image_of_injective _ hinj, Set.ncard_univ] at hcardg + simpa using hcardg + set a := ((ω s).length + 1) * (n / 2) with ha + have ha₁ : a ≤ (m + 1) * n := Nat.mul_le_mul (by omega) (Nat.div_le_self _ _) + have ha₂ : 1 ≤ a := Nat.mul_pos (by omega) (by omega) + by_cases hfd : D.IsFlawedInDistance a + · exact G a ha₂ (by omega) hfd + by_cases hff : D.IsFlawedInFreedom a + · exact H a (by omega) hff + have hflaw : D.IsFlawedOnSide s (n / 2) (ω s) := by + refine ⟨?_, two_mul_lt_of_lt hdist (by omega), hfd, hff, hno⟩ + have : 2 * ((ω s).length + 1) * (n / 2) = 2 * a := by rw [ha]; ring + omega + obtain ⟨L, hL, hmem⟩ := p₄ s hs D hD hflaw + exact ⟨L, hL.mono (by omega) hord, h₄ hmem⟩ + · -- An internal edge of `Γ₀` has no far apart copies. + by_cases hfd : D.IsFlawedInDistance B + · exact G B (by omega) le_rfl hfd + have hflaw : D.IsFlawedInternally m n (tilde f).ncard (P₀.φ f) := by + refine ⟨?_, ?_, ?_, hno⟩ + · rw [← hB] + exact hrepB + · rw [← hB] + exact two_mul_lt_of_lt hdist (by omega) + · rwa [← hB] + obtain ⟨L, hL, hmem⟩ := p₅ f hf hi D hD hflaw + have hu : 5 ^ (2 * m + 2) * n = 25 * (5 ^ (2 * m) * n) := by rw [pow_add]; ring + have hv : 4 * n * 5 ^ (2 * m) = 4 * (5 ^ (2 * m) * n) := by ring + have hw : n ≤ 5 ^ (2 * m) * n := Nat.le_mul_of_pos_left _ (by positivity) + exact ⟨L, hL.mono (by omega) hord, h₅ hmem⟩ + +/-- (4.1) for a disjoint colour scheme. -/ +theorem not_orientedlyBad_of_disjoint + [Infinite β] (hd : χ.IsDisjoint) + (hS1 : ConditionS1.{0, w} Shat) (hS2 : ConditionS2 χ cap) (hS3 : ConditionS3 χ cap) + (hS4 : ConditionS4 χ) : ¬ χ.IsOrientedlyBad := by + classical + rintro ⟨P, hbad, hsim⟩ + have rad : ∀ i, RadialDrawing cap (P i).Γ := fun i ↦ + ((P i).fits.internally_three_connected.nonempty_radialDrawing χ.isSurface cap).some + -- "By 6.1 we may assume that for all `j > i ≥ 0` there is no inflation". + obtain ⟨h₀, hno⟩ := theorem_6_1_proof cap χ hS1 hS3 P hbad hsim rad + let Q : ℕ → ColouredPainting χ := fun i ↦ P (h₀ + i) + have hbadQ : IsBadSequence χ Q := fun i j hij ↦ hbad _ _ (by omega) + have hsimQ : IsSimilarlyOriented χ Q := hsim.imp id fun ⟨o, ho⟩ ↦ ⟨o, fun i ↦ ho _⟩ + let radQ : ∀ i, RadialDrawing cap (Q i).Γ := fun i ↦ rad _ + -- "Choose `n ≥ 4` and even such that 15.2 holds (for `(Γ₀, φ₀)`)." + obtain ⟨n, hn, hEven, ω, hω, hn152⟩ := GraphMinor.GM19.theorem_15_2_proof.{w} S Shat β cap χ (Q 0) + set B := 5 ^ (2 * (Q 0).Γ.E.ncard + 2) * n with hB + -- "By 5.4 and 5.5, we may assume ... that `dist(Γ_i), rep(Γ_i) > 25n · 5^{2|E(Γ₀)|}`". + obtain ⟨h₁, hh₁⟩ := GraphMinor.GM19.theorem_5_4_proof.{w} S Shat β cap χ hS3 Q hbadQ hsimQ radQ B + obtain ⟨h₂, hh₂⟩ := GraphMinor.GM19.theorem_5_5_proof.{0, w} S Shat β cap χ hS1 hS3 Q hbadQ hsimQ + radQ B + let T : ℕ → ColouredPainting χ := fun i ↦ Q (max h₁ h₂ + 1 + i) + let radT : ∀ i, RadialDrawing cap (T i).Γ := fun i ↦ radQ _ + have tb : ∀ i, TieBreaker (radT i) := fun i ↦ (nonempty_tieBreaker (radT i)).some + -- The well-behaved set `𝒞`. + let 𝒮 := imageClass P + have hcl : IsPaintingClass χ 𝒮 := isPaintingClass_imageClass hsim + have hmem : ∀ i, T i ∈ 𝒮 := fun i ↦ mem_imageClass P _ + obtain ⟨𝒞₁, w₁, p₁⟩ := GraphMinor.GM19.theorem_10_3_proof.{w} S Shat β cap χ hd 𝒮 hcl hS1 (B + 1) + (by omega) + choose 𝒞₂ w₂ p₂ using fun a : ℕ ↦ GraphMinor.GM19.theorem_10_4_proof.{w} S Shat β cap χ hd 𝒮 hcl + hS3 (a + 1) (by omega) + choose 𝒞₃ w₃ p₃ using fun a : ℕ ↦ GraphMinor.GM19.theorem_10_5_proof.{w} S Shat β cap χ hd 𝒮 hcl + hS3 hS4 a + have : Finite χ.Φ.longSides := χ.Φ.finite_longSides.to_subtype + have hne : ∀ s ∈ χ.Φ.longSides, (ω s) ≠ [] := fun s hs ↦ (hω s hs).1 + choose 𝒞₄ w₄ p₄ using fun s : χ.Φ.longSides ↦ GraphMinor.GM19.theorem_11_1_proof.{w} S Shat β cap + χ hd 𝒮 hcl hS4 s.1 s.2 (ω s) + (hne s s.2) (hω s s.2).2.1 (n / 2) (by omega) + have : Finite (Q 0).Γ.E := (Q 0).Γ.finite_edges.to_subtype + have hsize : ∀ f : (Q 0).Γ.E, Painting.IsInternal f.1 → + ((tilde f.1).ncard = 2 ∧ (Q 0).φ f.1 ∈ χ.Ω2.E) ∨ + ((tilde f.1).ncard = 3 ∧ (Q 0).φ f.1 ∈ χ.Ω3.E) := by + intro f hi + rcases (Q 0).Γ.edge_shape f.1 f.2 with h | h + · exact Or.inl ⟨h.1, (Q 0).internal_2_mem f.1 f.2 hi h.1⟩ + · exact Or.inr ⟨h.1, (Q 0).internal_3_mem f.1 f.2 hi h.1⟩ + have hm : ∀ f : (Q 0).Γ.E, 1 ≤ (Q 0).Γ.E.ncard := fun f ↦ + (Set.ncard_pos (Q 0).Γ.finite_edges).2 ⟨f.1, f.2⟩ + have hfam : ∀ f : (Q 0).Γ.E, ∃ 𝒞 : Set (Place χ), IsWellBehavedPlaces 𝒞 ∧ + (Painting.IsInternal f.1 → ∀ D : TangleDatum cap χ, D.P ∈ 𝒮 → + D.IsFlawedInternally (Q 0).Γ.E.ncard n (tilde f.1).ncard ((Q 0).φ f.1) → + ∃ L : RootedLocation D.P.Γ, + L.Isolates D.tb (4 * n * 5 ^ (2 * (Q 0).Γ.E.ncard) + 3) D.ord D.𝒯 ∧ + (⟨hd, D.P, L⟩ : Place χ) ∈ 𝒞) := by + intro f + by_cases hi : Painting.IsInternal f.1 + · obtain ⟨𝒞, hw, hp⟩ := GraphMinor.GM19.theorem_14_1_proof.{w} S Shat β cap χ hd 𝒮 hcl hS2 _ _ + (hsize f hi) (Q 0).Γ.E.ncard n + (hm f) (by omega) + exact ⟨𝒞, hw, fun _ ↦ hp⟩ + · refine ⟨∅, fun Ω _ seq hseq ↦ ?_, fun h ↦ absurd h hi⟩ + exact absurd (hseq 0) (notMem_empty _) + choose 𝒞₅ w₅ p₅ using hfam + let A₁ : Set (Place χ) := 𝒞₁ + let A₂ : Set (Place χ) := ⋃ a : Fin (B + 1), 𝒞₂ a + let A₃ : Set (Place χ) := ⋃ a : Fin (B + 1), 𝒞₃ a + let A₄ : Set (Place χ) := ⋃ s, 𝒞₄ s + let A₅ : Set (Place χ) := ⋃ f, 𝒞₅ f + have wA₂ : IsWellBehavedPlaces A₂ := IsWellBehavedPlaces.iUnion fun a : Fin (B + 1) ↦ @w₂ a.1 + have wA₃ : IsWellBehavedPlaces A₃ := IsWellBehavedPlaces.iUnion fun a : Fin (B + 1) ↦ @w₃ a.1 + have wA₄ : IsWellBehavedPlaces A₄ := IsWellBehavedPlaces.iUnion fun s ↦ @w₄ s + have wA₅ : IsWellBehavedPlaces A₅ := IsWellBehavedPlaces.iUnion fun f ↦ @w₅ f + have hwell : IsWellBehavedPlaces (A₁ ∪ A₂ ∪ A₃ ∪ A₄ ∪ A₅) := + IsWellBehavedPlaces.union (IsWellBehavedPlaces.union (IsWellBehavedPlaces.union + (IsWellBehavedPlaces.union w₁ wA₂) wA₃) wA₄) wA₅ + -- "By 9.2 there exist `j > i ≥ 1` such that there is an inflation". + obtain ⟨i, j, hij, σv, σe, hσ⟩ := theorem_9_2_proof hd T radT tb (θ := B + 1) (by omega) hwell (by + intro i ord 𝒯 ht hθ + let D : TangleDatum cap χ := ⟨T i, radT i, tb i, ord, 𝒯, ht⟩ + suffices hsuff : ∃ L : RootedLocation D.P.Γ, L.Isolates D.tb (B + 1) D.ord D.𝒯 ∧ + (⟨hd, D.P, L⟩ : Place χ) ∈ (A₁ ∪ A₂ ∪ A₃ ∪ A₄ ∪ A₅) by + obtain ⟨L, hL, hm'⟩ := hsuff + exact ⟨L, hm', hL⟩ + refine exists_isolating hd hn hω (𝒮 := 𝒮) hB p₁ p₂ p₃ + (𝒞₄ := A₄) (𝒞₅ := A₅) + (fun s hs D hD hf ↦ ?_) (fun f hf hi D hD hfl ↦ ?_) + (fun x hx ↦ Or.inl (Or.inl (Or.inl (Or.inl hx)))) + (fun a ha x hx ↦ Or.inl (Or.inl (Or.inl (Or.inr (show x ∈ A₂ from + mem_iUnion.2 ⟨⟨a, Nat.lt_succ_of_le ha⟩, hx⟩))))) + (fun a ha x hx ↦ Or.inl (Or.inl (Or.inr (show x ∈ A₃ from + mem_iUnion.2 ⟨⟨a, Nat.lt_succ_of_le ha⟩, hx⟩)))) + (fun x hx ↦ Or.inl (Or.inr hx)) (fun x hx ↦ Or.inr hx) D (hmem i) ?_ ?_ hθ ?_ + · obtain ⟨L, hL, hm'⟩ := p₄ ⟨s, hs⟩ D hD hf + exact ⟨L, hL, show _ ∈ A₄ from mem_iUnion.2 ⟨⟨s, hs⟩, hm'⟩⟩ + · obtain ⟨L, hL, hm'⟩ := p₅ ⟨f, hf⟩ hi D hD hfl + exact ⟨L, hL, show _ ∈ A₅ from mem_iUnion.2 ⟨⟨f, hf⟩, hm'⟩⟩ + · exact hh₂ _ (by omega) + · exact hh₁ _ (by omega) + · intro hrep + refine hn152 D ?_ ?_ hrep + · rcases hsimQ with h | ⟨o, ho⟩ + · exact Or.inl h + · refine Or.inr ⟨o, fun P' hP' ↦ ?_⟩ + rcases hP' with rfl | rfl + · exact ho 0 + · exact ho _ + · exact hno _ (by omega) _ (by omega)) + exact hno _ (by omega) _ (by omega) ⟨σv, σe, hσ⟩ + +/-- **Graph Minors XIX, (4.1)** (page 333), in surface universe `0`. -/ +private theorem theorem_4_1_zero + : Theorem41Statement.{0, w} := by + intro S Shat _ _ β _ cap χ hS1 hS2 hS3 hS4 hb + have : T2Space S := χ.isSurface.2.1 + have : T2Space Shat := cap.isSurface.2.1 + obtain ⟨χ', hd, hS2', hS3', hS4', hb'⟩ := χ.exists_disjoint cap hS2 hS3 hS4 hb + exact not_orientedlyBad_of_disjoint hd hS1 hS2' hS3' hS4' + hb' + +/-- **Graph Minors XIX, (4.1)** (page 333): "If $\chi$ satisfies $\mathbf{S}_1$--$\mathbf{S}_4$ then +it is not orientedly bad." -/ +theorem theorem_4_1_proof : Theorem41Statement.{u, w} := + theorem_4_1_lift theorem_4_1_zero + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15c.lean b/LeanPool/GraphMinor/GM19/Section15c.lean new file mode 100644 index 0000000000..7bf330d0f6 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15c.lean @@ -0,0 +1,564 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM11.Theorem63 +public import LeanPool.GraphMinor.GM14.Section7a +public import LeanPool.GraphMinor.GM14.Cited +public import LeanPool.GraphMinor.GM11.CircuitRegions +public import LeanPool.GraphMinor.GM11.PaintingRegions +public import LeanPool.GraphMinor.GM11.Section5b + +/-! +# Graph Minors XIX, (15.1) + +Let `H` be a 2-cell drawing with a respectful tangle of order `θ`, and let `X` be a set of at most +`θ` vertices on the closure of one region `r`. A tangle separation of order `< |X|` with `X` on its +small side exists exactly when a short circuit of the radial drawing has `r*` on its inside and +more than half its length in vertices of `X`. + +The proof of the paper takes all edges of the radial drawing split by the separation. We take the +union `G` of the circuits that (6.3) of XI gives for the separation. That is all the argument needs. +The circuits of `G` with maximal inside are confined, and (4.3) of XI shows that two of them through +`r*` meet only there. Counting vertices of `Γ` on these circuits then gives one with the property. + +The result used later is `theorem_15_1_proof`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 GraphMinor.GM14 Hypergraph + +universe u + +variable {S : Type u} [TopologicalSpace S] [T2Space S] + +/-- In a 2-cell drawing with an edge, every vertex is an end of some edge. If `x` were not, each +region would have frontier missing `x`, since frontiers of open discs are connected, and a region +with frontier `{x}` would fill the connected set `Σ \ {x}`. So the closures of the regions and the +rest of `U(H)` form a closed set with complement `{x}`, and `{x}` would be open and closed. -/ +theorem exists_edge_at_vertex_of_twoCell (hS : IsClosedSurface S) [ConnectedSpace S] {H : Drawing S} + (hT : (PaintingOrDrawing.drawing H).IsTwoCell) (hE : H.E.Nonempty) {x : S} (hx : x ∈ H.V) : + ∃ e ∈ H.E, x ∈ closure e := by + by_contra hno + push Not at hno + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + have hcpt : CompactSpace S := hS.1 + set T : Set S := (H.V \ {x}) ∪ ⋃ e ∈ H.E, closure e with hTdef + have hTcl : IsClosed T := + ((H.finite_V.subset sdiff_subset).isClosed).union + (Set.Finite.isClosed_biUnion H.finite_edges fun _ _ ↦ isClosed_closure) + have hxT : x ∉ T := by + rintro (h | h) + · exact h.2 rfl + · obtain ⟨e, he, h⟩ := mem_iUnion₂.mp h + exact hno e he h + have hUT : H.U ⊆ {x} ∪ T := by + intro y hy + rw [H.U_eq] at hy + by_cases hyx : y = x + · exact Or.inl hyx + rcases hy with hy | hy + · exact Or.inr (Or.inl ⟨hy, hyx⟩) + · exact Or.inr (Or.inr hy) + obtain ⟨e₀, he₀⟩ := hE + obtain ⟨y₀, hy₀⟩ := he₀.1 + have hy₀U : y₀ ∈ H.U := (he₀.2.1 hy₀).1 + have hy₀x : y₀ ≠ x := fun h ↦ (he₀.2.1 hy₀).2 (h ▸ hx) + have hfrU : ∀ r ∈ H.R, frontier r ⊆ H.U := by + intro r hr y hy + have hyr : y ∉ r := by + have := hy.2 + rwa [(region_isOpen hr).interior_eq] at this + exact (closure_region_subset hr hy.1).resolve_left hyr + have hY : IsPreconnected (univ \ {x} : Set S) := + GM11.isPreconnected_sdiff_finite hS isOpen_univ isPreconnected_univ (finite_singleton x) + have hfx : ∀ r ∈ H.R, x ∉ closure r := by + intro r hr hxc + have hxr : x ∉ r := fun h ↦ region_subset hr h (H.V_subset_U hx) + have hxf : x ∈ frontier r := ⟨hxc, by rwa [(region_isOpen hr).interior_eq]⟩ + have hcon : IsPreconnected (frontier r) := isPreconnected_frontier (hT.2 r hr) + have hsingle : frontier r ⊆ {x} := by + intro y hy + by_contra hyx + have hyT : y ∈ T := (hUT (hfrU r hr hy)).resolve_left hyx + obtain ⟨z, -, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp hcon {x} T isClosed_singleton hTcl + ((hfrU r hr).trans hUT) ⟨x, hxf, rfl⟩ ⟨y, hy, hyT⟩ + exact hxT (hz₁ ▸ hz₂) + obtain ⟨w, hw⟩ := region_nonempty hr + have hwx : w ≠ x := fun h ↦ hxr (h ▸ hw) + have hsplit : (univ \ {x} : Set S) ⊆ r ∪ (closure r)ᶜ := by + intro y hy + by_cases hyr : y ∈ r + · exact Or.inl hyr + refine Or.inr fun hyc ↦ hy.2 (hsingle ⟨hyc, ?_⟩) + rwa [(region_isOpen hr).interior_eq] + have hy₀c : y₀ ∈ (closure r)ᶜ := by + refine (hsplit ⟨mem_univ _, hy₀x⟩).resolve_left fun h ↦ region_subset hr h hy₀U + obtain ⟨z, -, hz₁, hz₂⟩ := hY r (closure r)ᶜ (region_isOpen hr) isClosed_closure.isOpen_compl + hsplit ⟨w, ⟨mem_univ _, hwx⟩, hw⟩ ⟨y₀, ⟨mem_univ _, hy₀x⟩, hy₀c⟩ + exact hz₂ (subset_closure hz₁) + have hRfin : H.R.Finite := finite_R hS H + have hZcl : IsClosed (T ∪ ⋃ r ∈ H.R, closure r) := + hTcl.union (hRfin.isClosed_biUnion fun _ _ ↦ isClosed_closure) + have hZ : T ∪ ⋃ r ∈ H.R, closure r = {x}ᶜ := by + ext y + constructor + · rintro (h | h) (rfl : y = x) + · exact hxT h + · obtain ⟨r, hr, h⟩ := mem_iUnion₂.mp h + exact hfx r hr h + · intro (hy : y ≠ x) + by_cases hyU : y ∈ H.U + · exact Or.inl ((hUT hyU).resolve_left hy) + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem hyU + exact Or.inr (mem_iUnion₂.mpr ⟨r, hr, subset_closure hyr⟩) + have hopen : IsOpen ({x} : Set S) := by + rw [← isClosed_compl_iff, ← hZ] + exact hZcl + have hclopen : IsClopen ({x} : Set S) := ⟨isClosed_singleton, hopen⟩ + have := hclopen.eq_univ ⟨x, rfl⟩ + have hy₀m : y₀ ∈ ({x} : Set S) := this ▸ mem_univ y₀ + exact hy₀x hy₀m + +omit [T2Space S] in +/-- A vertex of a drawing that lies on `U(C)`, for a subdrawing `C`, is a vertex of `C`. -/ +theorem mem_V_of_mem_U_sub {C K : Drawing S} (hCs : C.IsSubdrawing K) {x : S} (hxU : x ∈ C.U) + (hxK : x ∈ K.V) : x ∈ C.V := by + by_contra hxC + obtain ⟨g, hg, hxg⟩ := C.exists_edge_of_mem hxU hxC + exact ((hCs.2 hg).2.1 hxg).2 hxK + +omit [T2Space S] in +/-- The ends in `K` of an edge of a subdrawing `C` are vertices of `C`. -/ +theorem end_mem_V {C K : Drawing S} (hCs : C.IsSubdrawing K) {e : Set S} (he : e ∈ C.E) {x : S} + (hxe : x ∈ closure e) (hxK : x ∈ K.V) : x ∈ C.V := + mem_V_of_mem_U_sub hCs (C.closure_subset_U he hxe) hxK + +omit [T2Space S] in +/-- A region of `H` meets `U(C)`, for a subdrawing `C` of a radial drawing, only if the vertex of +the +radial drawing in that region is on `C`: the edges of the radial drawing in `r` all end at that +vertex. -/ +theorem disjoint_region_U (hS : IsClosedSurface S) {H K : Drawing S} + (hP : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) {r : Set S} (hr : r ∈ H.R) {w : S} + (hw : w ∈ r) (hwV : w ∈ K.V) {C : Drawing S} (hCs : C.IsSubdrawing K) (hwU : w ∉ C.U) : + Disjoint r C.U := by + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hS + obtain ⟨h1, h2, h3, h4, h5, -⟩ := hP + have huniq : ∀ {a b : S}, a ∈ r ∧ a ∈ K.V → b ∈ r ∧ b ∈ K.V → a = b := fun ha hb ↦ + (h3 r hr).unique ha hb + refine disjoint_left.mpr fun y hyr hyU ↦ ?_ + by_cases hyV : y ∈ C.V + · have : y = w := huniq ⟨hyr, hCs.1 hyV⟩ ⟨hw, hwV⟩ + exact hwU (this ▸ hyU) + obtain ⟨f, hf, hyf⟩ := C.exists_edge_of_mem hyU hyV + have hfK := hCs.2 hf + obtain ⟨v, hv, w', hw', hcap⟩ := h5 f hfK + have hfdis : Disjoint f H.U := by + refine disjoint_left.mpr fun z hz hzU ↦ ?_ + have hzK := hfK.2.1 hz + have : z ∈ H.V := by + change z ∈ (PaintingOrDrawing.drawing H).V + rw [← h1] + exact ⟨hzU, hzK.1⟩ + exact hzK.2 (h2 this) + have hfr : f ⊆ r := subset_region hr hfK.2.2.1.isConnected.isPreconnected hfdis hyf hyr + have hw'cl : w' ∈ closure f := by + have : w' ∈ closure f ∩ K.V := by rw [hcap]; simp + exact this.1 + obtain ⟨r', hr', hw'r'⟩ := h4 w' hw' + obtain ⟨z, hz₁, hz₂⟩ := mem_closure_iff.mp (closure_mono hfr hw'cl) r' (region_isOpen hr') hw'r' + have hrr : r' = r := region_eq_of_mem hr' hr hz₁ hz₂ + have hw'w : w' = w := huniq ⟨hrr ▸ hw'r', hw'.1⟩ ⟨hw, hwV⟩ + exact hwU (hw'w ▸ C.closure_subset_U hf hw'cl) + +section Slope + +variable {K : Drawing S} {k : ℕ} {ins : Drawing S → Set S} + +/-- If `w ∉ ins(C)` and `r` is disjoint from `U(C)`, then the only points of `closure r` in `ins(C)` +are on `U(C)`. -/ +theorem mem_U_of_mem_closure (hs : IsSlope K k ins) {C : Drawing S} (hC : C.IsCircuit) + (hCs : C.IsSubdrawing K) (hl : C.length < k) {r : Set S} (hr : IsPreconnected r) {w : S} + (hw : w ∈ r) (hwi : w ∉ ins C) (hdis : Disjoint r C.U) {x : S} (hx : x ∈ closure r) + (hxi : x ∈ ins C) : x ∈ C.U := by + have hcl : IsClosed (ins C) := (hs.isClosedDisc C hC hCs hl).isClosed + have hfr : frontier (ins C) = C.U := by rw [subBd_eq_frontier', hs.subBd_eq C hC hCs hl] + rcases GM11.subset_or_disjoint_of_frontier hcl hr (hfr ▸ hdis) with h | h + · exact absurd (h hw) hwi + by_contra hxU + have hint : x ∈ interior (ins C) := by + by_contra hni + exact hxU (hfr ▸ (show x ∈ frontier (ins C) by rw [hcl.frontier_eq]; exact ⟨hxi, hni⟩)) + obtain ⟨z, hz₁, hz₂⟩ := mem_closure_iff.mp hx _ isOpen_interior hint + exact disjoint_left.mp h hz₂ (interior_subset hz₁) + +/-- If `w` is inside `C` and off `U(C)`, then all of `closure r` is inside `C`. -/ +theorem closure_subset_ins (hs : IsSlope K k ins) {C : Drawing S} (hC : C.IsCircuit) + (hCs : C.IsSubdrawing K) (hl : C.length < k) {r : Set S} (hr : IsPreconnected r) {w : S} + (hw : w ∈ r) (hwi : w ∈ ins C) (hdis : Disjoint r C.U) : closure r ⊆ ins C := by + have hcl : IsClosed (ins C) := (hs.isClosedDisc C hC hCs hl).isClosed + have hfr : frontier (ins C) = C.U := by rw [subBd_eq_frontier', hs.subBd_eq C hC hCs hl] + rcases GM11.subset_or_disjoint_of_frontier hcl hr (hfr ▸ hdis) with h | h + · exact closure_minimal h hcl + · exact absurd hwi (disjoint_left.mp h hw) + +/-- A circuit with two vertices on a circuit with maximal inside is inside it, by (4.3) of XI. -/ +theorem ins_subset_of_two_common {Γ' C C' : Drawing S} (hs : IsSlope K k ins) + (hsub : Γ'.IsSubdrawing K) (hconf : IsConfined k Γ') (hC : C.IsCircuit) + (hCs : C.IsSubdrawing Γ') + (hmax : ∀ C' : Drawing S, C'.IsCircuit → C'.IsSubdrawing Γ' → ins C ⊆ ins C' → ins C' ⊆ ins C) + (hC' : C'.IsCircuit) (hC's : C'.IsSubdrawing Γ') {a b : S} (haC : a ∈ C.V) (haC' : a ∈ C'.V) + (hbC : b ∈ C.V) (hbC' : b ∈ C'.V) (hab : a ≠ b) : ins C' ⊆ ins C := by + have hs' := theorem_4_2_proof hs hsub + obtain ⟨P, Q, hP, hQ, hPs, hQs, -, -, -, -, hsup⟩ := hC'.exists_two_paths haC' hbC' hab + have hP' : P.U ⊆ ins C := path_U_subset hP (hPs.trans hC's) fun hW ↦ + theorem_4_3_i hs hsub hconf hC hCs hmax _ hW haC hbC + have hQ' : Q.U ⊆ ins C := path_U_subset hQ (hQs.trans hC's) fun hW ↦ + theorem_4_3_i hs hsub hconf hC hCs hmax _ hW haC hbC + have hU : C'.U ⊆ ins C := by + rw [← hsup] + intro z hz + rw [Drawing.U_eq, Drawing.sup_V hPs hQs, Drawing.sup_E hPs hQs] at hz + rcases hz with (hz | hz) | hz + · exact hP' (P.V_subset_U hz) + · exact hQ' (Q.V_subset_U hz) + · obtain ⟨f, hf | hf, hz⟩ := mem_iUnion₂.mp hz + · exact hP' (P.closure_subset_U hf hz) + · exact hQ' (Q.closure_subset_U hf hz) + exact hs'.monotone C' C hC' hC's (hconf C' hC' hC's) hC hCs (hconf C hC hCs) hU + +/-- Two circuits with the same inside are equal: the inside gives `U(C)`, and `U(C)` gives the +vertices and the edges. -/ +theorem eq_of_ins_eq (hs : IsSlope K k ins) {C C' : Drawing S} (hC : C.IsCircuit) + (hCs : C.IsSubdrawing K) (hl : C.length < k) (hC' : C'.IsCircuit) (hCs' : C'.IsSubdrawing K) + (hl' : C'.length < k) (h : ins C = ins C') : C = C' := by + have hU : C.U = C'.U := by rw [← hs.subBd_eq C hC hCs hl, ← hs.subBd_eq C' hC' hCs' hl', h] + have hedge : ∀ {D D' : Drawing S}, D.IsSubdrawing K → D'.IsSubdrawing K → D.U = D'.U → + D.E ⊆ D'.E := by + intro D D' hD hD' hUU e he + by_contra he' + obtain ⟨y, hy⟩ := (hD.2 he).1 + exact disjoint_left.mp (edge_disjoint_U hD' (hD.2 he) he') hy + (hUU ▸ (he.2.1 hy).1) + refine Drawing.ext_of_V_E ?_ ((hedge hCs hCs' hU).antisymm (hedge hCs' hCs hU.symm)) + ext x + exact ⟨fun hx ↦ mem_V_of_mem_U_sub hCs' (hU ▸ C.V_subset_U hx) (hCs.1 hx), + fun hx ↦ mem_V_of_mem_U_sub hCs (hU ▸ C'.V_subset_U hx) (hCs'.1 hx)⟩ + +end Slope + +/-- The second statement of (15.1) implies the first, by (6.3) of XI. The side `A` is `Γ ∩ ins(C)` +with the vertices of `X` added, so its order is `½|E(C)| + |X \ ins(C)| < |X|`. -/ +theorem exists_separation_of_circuit (_hS : IsClosedSurface S) + {H K : Drawing S} {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} (hResp : IsRespectfulDrawingTangle H θ T) + (hP : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) (hs : IsSlope K (2 * θ) ins) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) + (hiff : ∀ A B : Hypergraph S (Set S), H.toHypergraph.IsSeparation A B → separationOrder A B < θ + → + ((A, B) ∈ T ↔ ∃ (k : ℕ) (C : Fin k → Drawing S), + (∀ i : Fin k, (C i).IsCircuit ∧ (C i).IsSubdrawing K ∧ (C i).length < 2 * θ ∧ + (C i).V ∩ H.V ⊆ (A ∩ B).vertexSet) ∧ ∀ e ∈ A.edgeSet, ∃ i : Fin k, e ⊆ ins (C i))) + {X : Set S} (hXV : X ⊆ H.V) (hXθ : X.ncard ≤ θ) {C : Drawing S} (hC : C.IsCircuit) + (hCs : C.IsSubdrawing K) (hl : C.length < 2 * θ) (hlX : C.length < 2 * (X ∩ ins C).ncard) : + ∃ A B, (A, B) ∈ T ∧ separationOrder A B < X.ncard ∧ X ⊆ A.vertexSet := by + classical + have hXfin : X.Finite := H.finite_V.subset hXV + have hmem := hd C hC hCs hl + set A₀ := (PaintingOrDrawing.drawing H).inter (ins C) with hA₀ + set B := (PaintingOrDrawing.drawing H).interOutside (ins C) with hB + have hsep : H.toHypergraph.IsSeparation A₀ B := hResp.2.1.isSeparation hmem.2.2 + let A : Hypergraph S (Set S) := + { vertexSet := A₀.vertexSet ∪ X + edgeSet := A₀.edgeSet + Inc := A₀.Inc + vertex_mem_of_inc := fun _ _ h ↦ Or.inl (A₀.vertex_mem_of_inc h) + edge_mem_of_inc := fun _ _ h ↦ A₀.edge_mem_of_inc h + vertexSet_finite := A₀.vertexSet_finite.union hXfin + edgeSet_finite := A₀.edgeSet_finite } + have hVeq : A₀.vertexSet ∪ B.vertexSet = H.V := congrArg Hypergraph.vertexSet hsep.union_eq + have hunion : A ∪ B = A₀ ∪ B := by + refine Hypergraph.ext ?_ rfl rfl + change (A₀.vertexSet ∪ X) ∪ B.vertexSet = A₀.vertexSet ∪ B.vertexSet + refine subset_antisymm (union_subset (union_subset subset_union_left ?_) subset_union_right) + (union_subset_union_left _ subset_union_left) + rw [hVeq] + exact hXV + have hsepA : H.toHypergraph.IsSeparation A B := + { left_le := ⟨union_subset hsep.left_le.vertexSet_subset hXV, hsep.left_le.edgeSet_subset, + hsep.left_le.ends_eq⟩ + right_le := hsep.right_le + union_eq := hunion.trans hsep.union_eq + edgeSet_inter_eq := hsep.edgeSet_inter_eq } + have hfr : frontier (ins C) = C.U := by rw [subBd_eq_frontier', hs.subBd_eq C hC hCs hl] + have hcl : IsClosed (ins C) := hmem.1.isClosed + have hcompl : (univ \ ins C : Set S) = (ins C)ᶜ := by ext; simp + have hUin : C.U ⊆ ins C := fun z hz ↦ hcl.frontier_subset (hfr ▸ hz) + have hbd : ∀ v, v ∈ H.V → v ∈ ins C → v ∈ B.vertexSet → v ∈ C.V := by + intro v hvH hvi hvB + have hvc : v ∈ closure (ins C)ᶜ := by + have := hvB.2 + rwa [hcompl] at this + have : v ∈ frontier (ins C) := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure hvi, hvc⟩ + exact mem_V_of_mem_U_sub hCs (hfr ▸ this) (hP.2.1 hvH) + have hsub : (A ∩ B).vertexSet ⊆ (C.V ∩ H.V) ∪ (X \ ins C) := by + rintro v ⟨hvA, hvB⟩ + have hvH : v ∈ H.V := hsepA.right_le.vertexSet_subset hvB + by_cases hvi : v ∈ ins C + · exact Or.inl ⟨hbd v hvH hvi hvB, hvH⟩ + · rcases hvA with hvA | hvX + · exact absurd hvA.2 hvi + · exact Or.inr ⟨hvX, hvi⟩ + have hord : separationOrder A B ≤ (C.V ∩ H.V).ncard + (X \ ins C).ncard := + (ncard_le_ncard hsub (((H.finite_V.subset inter_subset_right)).union + (hXfin.subset sdiff_subset))).trans (ncard_union_le _ _) + have hlen := (circuit_length_eq_two_mul_ncard hP hC hCs).1 + have hsum : (X ∩ ins C).ncard + (X \ ins C).ncard = X.ncard := + ncard_inter_add_ncard_sdiff_eq_ncard X (ins C) hXfin + have hlt : separationOrder A B < X.ncard := by omega + refine ⟨A, B, ?_, hlt, subset_union_right⟩ + refine (hiff A B hsepA (by omega)).mpr ⟨1, fun _ ↦ C, fun _ ↦ ⟨hC, hCs, hl, ?_⟩, fun e he ↦ + ⟨0, he.2⟩⟩ + rintro v ⟨hvC, hvH⟩ + have hvU : v ∈ C.U := C.V_subset_U hvC + refine ⟨Or.inl ⟨hvH, hUin hvU⟩, hvH, ?_⟩ + have hvf : v ∈ frontier (ins C) := hfr.symm ▸ hvU + rw [frontier_eq_closure_inter_closure] at hvf + change v ∈ closure (univ \ ins C) + rw [hcompl] + exact hvf.2 + +/-- The core of (15.1). Let `G` be a subdrawing of the radial drawing whose vertices in `H` lie in a +set `Z` with `|Z| < |X|`. Every circuit of `G` is then short, since `Γ*` is bipartite. Suppose that +each `x ∈ X \ Z` is inside a circuit of `G`. Then some circuit of `G` has the second property of +(15.1). If a circuit of `G` with maximal inside has `w` strictly inside, it is that circuit, since +its inside includes `X`. Otherwise the maximal circuits with `w` inside go through `w`, and meet +only +there by (4.3) of XI, and a count of the vertices of `H` on them finds the circuit. -/ +theorem exists_circuit_of_confined_in (hS : IsClosedSurface S) {H K G : Drawing S} {θ : ℕ} + {ins : Drawing S → Set S} (hP : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) + (hs : IsSlope K (2 * θ) ins) {r : Set S} (hr : r ∈ H.R) {w : S} (hw : w ∈ r) (hwV : w ∈ K.V) + {X : Set S} (hXV : X ⊆ H.V) (hXr : X ⊆ closure r) (hXθ : X.ncard ≤ θ) (hGK : G.IsSubdrawing K) + {Z : Set S} (hZfin : Z.Finite) (hGZ : ∀ v ∈ G.V, v ∈ H.V → v ∈ Z) (hZX : Z.ncard < X.ncard) + (hcov : ∀ x ∈ X, x ∉ Z → ∃ D : Drawing S, D.IsCircuit ∧ D.IsSubdrawing G ∧ x ∈ ins D) : + ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing G ∧ C.length < 2 * θ ∧ + C.length < 2 * (X ∩ ins C).ncard ∧ w ∈ ins C := by + classical + have hXfin : X.Finite := H.finite_V.subset hXV + have hrc : IsPreconnected r := region_isPreconnected hr + have hlen : ∀ D : Drawing S, D.IsCircuit → D.IsSubdrawing G → D.length = 2 * (D.V ∩ H.V).ncard := + fun D hD hDs ↦ (circuit_length_eq_two_mul_ncard hP hD (hDs.trans hGK)).1 + have hZsub : ∀ D : Drawing S, D.IsSubdrawing G → (D.V ∩ H.V).ncard ≤ Z.ncard := fun D hDs ↦ + ncard_le_ncard (fun v hv ↦ hGZ v (hDs.1 hv.1) hv.2) hZfin + have hconf : IsConfined (2 * θ) G := by + intro D hD hDs + have := hlen D hD hDs + have := hZsub D hDs + omega + let 𝒞 : Set (Drawing S) := {D | D.IsCircuit ∧ D.IsSubdrawing G} + have h𝒞fin : 𝒞.Finite := by + refine Set.Finite.of_injOn (f := fun D : Drawing S ↦ (D.V, D.E)) + (t := 𝒫 G.V ×ˢ 𝒫 G.E) ?_ ?_ (G.finite_V.finite_subsets.prod G.finite_edges.finite_subsets) + · exact fun D hD ↦ ⟨hD.2.1, hD.2.2⟩ + · intro D _ D' _ h + exact Drawing.ext_of_V_E (congrArg Prod.fst h) (congrArg Prod.snd h) + let 𝓜 : Set (Drawing S) := {D | D ∈ 𝒞 ∧ ∀ D' ∈ 𝒞, ins D ⊆ ins D' → ins D' ⊆ ins D} + have h𝓜fin : 𝓜.Finite := h𝒞fin.subset fun _ h ↦ h.1 + have hmaxex : ∀ D ∈ 𝒞, ∃ M ∈ 𝓜, ins D ⊆ ins M := by + intro D hD + obtain ⟨m, hle, hm⟩ := (h𝒞fin.image ins).exists_le_maximal (mem_image_of_mem ins hD) + obtain ⟨M, hM, rfl⟩ := hm.1 + exact ⟨M, ⟨hM, fun D' hD' h ↦ hm.2 (mem_image_of_mem ins hD') h⟩, hle⟩ + have hshort : ∀ M ∈ 𝒞, (M : Drawing S).length < 2 * θ := fun M hM ↦ hconf M hM.1 hM.2 + have hsK : ∀ M ∈ 𝒞, (M : Drawing S).IsSubdrawing K := fun M hM ↦ hM.2.trans hGK + by_cases hcase : ∃ M ∈ 𝓜, w ∈ ins M ∧ w ∉ (M : Drawing S).U + · obtain ⟨M, hM, hwi, hwU⟩ := hcase + have hsub := closure_subset_ins hs hM.1.1 (hsK M hM.1) (hshort M hM.1) hrc hw hwi + (disjoint_region_U hS hP hr hw hwV (hsK M hM.1) hwU) + have hXi : X ∩ ins M = X := inter_eq_left.mpr (hXr.trans hsub) + refine ⟨M, hM.1.1, hM.1.2, hshort M hM.1, ?_, hwi⟩ + rw [hXi, hlen M hM.1.1 hM.1.2] + have := hZsub M hM.1.2 + omega + push Not at hcase + have hUin : ∀ M ∈ 𝒞, (M : Drawing S).U ⊆ ins M := fun M hM ↦ + hs.U_subset_ins hM.1 (hsK M hM) (hshort M hM) + have hwH : w ∉ H.U := region_subset hr hw + let Mb : Finset (Drawing S) := h𝓜fin.toFinset.filter fun M ↦ w ∈ ins M + have hMb : ∀ {M : Drawing S}, M ∈ Mb ↔ M ∈ 𝓜 ∧ w ∈ ins M := by + intro M + simp [Mb] + let vv : Drawing S → Finset S := fun M ↦ H.finite_V.toFinset.filter (· ∈ M.V) + have hvv : ∀ M : Drawing S, (vv M).card = (M.V ∩ H.V).ncard := by + intro M + rw [← ncard_coe_finset] + congr 1 + ext y + simp [vv, and_comm] + have hmemvv : ∀ {M : Drawing S} {y : S}, y ∈ vv M ↔ y ∈ H.V ∧ y ∈ M.V := by + intro M y + simp [vv] + let xx : Drawing S → Finset S := fun M ↦ hXfin.toFinset.filter (· ∈ ins M) + have hxx : ∀ M : Drawing S, (xx M).card = (X ∩ ins M).ncard := by + intro M + rw [← ncard_coe_finset] + congr 1 + ext y + simp [xx] + let X0 : Finset S := hXfin.toFinset.filter fun x ↦ ∀ M ∈ Mb, x ∉ ins M + have hX0Z : ∀ x ∈ X0, x ∈ Z := by + intro x hx + have hxX : x ∈ X := by simpa using (Finset.mem_filter.mp hx).1 + have hx0 := (Finset.mem_filter.mp hx).2 + by_contra hxZ + obtain ⟨D, hD, hDs, hxD⟩ := hcov x hxX hxZ + obtain ⟨M, hM, hsub⟩ := hmaxex D ⟨hD, hDs⟩ + have hxM := hsub hxD + have hwM : w ∉ ins M := fun h ↦ hx0 M (hMb.mpr ⟨hM, h⟩) hxM + have hwU : w ∉ (M : Drawing S).U := fun h ↦ hwM (hUin M hM.1 h) + have hxU := mem_U_of_mem_closure hs hM.1.1 (hsK M hM.1) (hshort M hM.1) hrc hw hwM + (disjoint_region_U hS hP hr hw hwV (hsK M hM.1) hwU) (hXr hxX) hxM + exact hxZ (hGZ x (hM.1.2.1 (mem_V_of_mem_U_sub (hsK M hM.1) hxU (hP.2.1 (hXV hxX)))) (hXV hxX)) + have hpd : ∀ M ∈ Mb, ∀ M' ∈ Mb, M ≠ M' → Disjoint (vv M) (vv M') := by + intro M hM M' hM' hne + refine Finset.disjoint_left.mpr fun a ha ha' ↦ hne ?_ + obtain ⟨hm, hwi⟩ := hMb.mp hM + obtain ⟨hm', hwi'⟩ := hMb.mp hM' + have hwM := mem_V_of_mem_U_sub (hsK M hm.1) (hcase M hm hwi) hwV + have hwM' := mem_V_of_mem_U_sub (hsK M' hm'.1) (hcase M' hm' hwi') hwV + obtain ⟨haH, haM⟩ := hmemvv.mp ha + obtain ⟨-, haM'⟩ := hmemvv.mp ha' + have haw : a ≠ w := fun h ↦ hwH (h ▸ H.V_subset_U haH) + have hsk := fun (M₁ : Drawing S) (hm₁ : M₁ ∈ 𝓜) ↦ fun C' hC' hC's ↦ hm₁.2 C' ⟨hC', hC's⟩ + have h₁ : ins M' ⊆ ins M := ins_subset_of_two_common hs hGK hconf hm.1.1 hm.1.2 (hsk M hm) + hm'.1.1 hm'.1.2 haM haM' hwM hwM' haw + exact eq_of_ins_eq hs hm.1.1 (hsK M hm.1) (hshort M hm.1) hm'.1.1 (hsK M' hm'.1) + (hshort M' hm'.1) (subset_antisymm (hm'.2 M hm.1 h₁) h₁) + have hdisj : Disjoint (Mb.biUnion vv) X0 := by + refine Finset.disjoint_left.mpr fun a ha ha₀ ↦ ?_ + obtain ⟨M, hM, haM⟩ := Finset.mem_biUnion.mp ha + have hm := (hMb.mp hM).1 + exact (Finset.mem_filter.mp ha₀).2 M hM + (hUin M hm.1 ((M : Drawing S).V_subset_U (hmemvv.mp haM).2)) + have hsubZ : Mb.biUnion vv ∪ X0 ⊆ hZfin.toFinset := by + intro a ha + rcases Finset.mem_union.mp ha with ha | ha + · obtain ⟨M, hM, haM⟩ := Finset.mem_biUnion.mp ha + obtain ⟨haH, haV⟩ := hmemvv.mp haM + simpa using hGZ a ((hMb.mp hM).1.1.2.1 haV) haH + · simpa using hX0Z a ha + have hc1 : ∑ M ∈ Mb, (vv M).card + X0.card ≤ hZfin.toFinset.card := by + rw [← Finset.card_biUnion hpd, ← Finset.card_union_of_disjoint hdisj] + exact Finset.card_le_card hsubZ + have hc2 : hXfin.toFinset.card ≤ X0.card + ∑ M ∈ Mb, (xx M).card := by + have hsub : hXfin.toFinset ⊆ X0 ∪ Mb.biUnion xx := by + intro x hx + by_cases h : ∀ M ∈ Mb, x ∉ ins M + · exact Finset.mem_union_left _ (Finset.mem_filter.mpr ⟨hx, h⟩) + · push Not at h + obtain ⟨M, hM, hxM⟩ := h + exact Finset.mem_union_right _ (Finset.mem_biUnion.mpr ⟨M, hM, Finset.mem_filter.mpr ⟨hx, + hxM⟩⟩) + exact (Finset.card_le_card hsub).trans + ((Finset.card_union_le _ _).trans (Nat.add_le_add_left Finset.card_biUnion_le _)) + have hZc : hZfin.toFinset.card < hXfin.toFinset.card := by + rw [← ncard_eq_toFinset_card _ hZfin, ← ncard_eq_toFinset_card _ hXfin] + exact hZX + have hlt : ∑ M ∈ Mb, (vv M).card < ∑ M ∈ Mb, (xx M).card := by omega + obtain ⟨M, hM, hltM⟩ := Finset.exists_lt_of_sum_lt hlt + obtain ⟨hm, hwi⟩ := hMb.mp hM + refine ⟨M, hm.1.1, hm.1.2, hshort M hm.1, ?_, hwi⟩ + rw [hlen M hm.1.1 hm.1.2, ← hxx, ← hvv] + omega + +/-- `exists_circuit_of_confined_in`, with the circuit read in the radial drawing. -/ +theorem exists_circuit_of_confined (hS : IsClosedSurface S) {H K G : Drawing S} {θ : ℕ} + {ins : Drawing S → Set S} (hP : (PaintingOrDrawing.drawing H).IsPreRadialDrawing K) + (hs : IsSlope K (2 * θ) ins) {r : Set S} (hr : r ∈ H.R) {w : S} (hw : w ∈ r) (hwV : w ∈ K.V) + {X : Set S} (hXV : X ⊆ H.V) (hXr : X ⊆ closure r) (hXθ : X.ncard ≤ θ) (hGK : G.IsSubdrawing K) + {Z : Set S} (hZfin : Z.Finite) (hGZ : ∀ v ∈ G.V, v ∈ H.V → v ∈ Z) (hZX : Z.ncard < X.ncard) + (hcov : ∀ x ∈ X, x ∉ Z → ∃ D : Drawing S, D.IsCircuit ∧ D.IsSubdrawing G ∧ x ∈ ins D) : + ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing K ∧ C.length < 2 * θ ∧ + C.length < 2 * (X ∩ ins C).ncard ∧ w ∈ ins C := by + obtain ⟨C, h₁, h₂, h₃⟩ := exists_circuit_of_confined_in hS hP hs hr hw hwV hXV hXr hXθ hGK hZfin + hGZ hZX hcov + exact ⟨C, h₁, h₂.trans hGK, h₃⟩ + +/-- **Graph Minors XIX, (15.1)** (page 379), for a respectful tangle of order `θ`. + +"Let $\Gamma$ be a 2-cell drawing with $E(\Gamma) \ne +\emptyset$ in a surface $\Sigma$ with +$\text{bd}(\Sigma) = \emptyset$, and let $\mathscr{T}$ be a tangle in $\Gamma$ with +$\text{rep}(\mathscr{T}) \ge \theta$. Let $r$ be a region of $\Gamma$, and let $X \subseteq +V(\Gamma) \cap \bar{r}$ with $|X| \le \theta$. Then the following are equivalent:" the existence of +`(A, B) ∈ 𝒯` of order `< |X|` with `X ⊆ V(A)`, and the existence of a circuit `C` of `Γ*` of length +`< 2θ` such that `|X ∩ ins(C)| > ½|E(C)|` and `r* ∈ ins(C)`. + +The Lean statement takes a respectful tangle of order exactly `θ` and its derived slope. +The radial vertex `w` represents the region `r`. With the paper's representativity bound, the +order-`θ` truncation retains the separations of order below `θ`. These include the orientations +that determine the inside of each circuit of length below `2 * θ` in Section 7. -/ +theorem theorem_15_1_proof (hS : IsClosedSurface S) [ConnectedSpace S] + {H K : Drawing S} {θ : ℕ} {T : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + {ins : Drawing S → Set S} (hE : H.E.Nonempty) (hResp : IsRespectfulDrawingTangle H θ T) + (hK : (PaintingOrDrawing.drawing H).IsRadialDrawing K) + (hd : IsDerivedSlope (PaintingOrDrawing.drawing H) K θ T ins) {r : Set S} (hr : r ∈ H.R) {w : S} + (hw : w ∈ r) (hwV : w ∈ K.V) {X : Set S} (hXV : X ⊆ H.V) (hXr : X ⊆ closure r) + (hXθ : X.ncard ≤ θ) : + (∃ A B, (A, B) ∈ T ∧ separationOrder A B < X.ncard ∧ X ⊆ A.vertexSet) ↔ + ∃ C : Drawing S, C.IsCircuit ∧ C.IsSubdrawing K ∧ C.length < 2 * θ ∧ + C.length < 2 * (X ∩ ins C).ncard ∧ w ∈ ins C := by + classical + have hP := hK.2.1 + have hs : IsSlope K (2 * θ) ins := + GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) hS hResp.2.1.isPretangle hP.1 hd + have hiff := (GM11.theorem_6_3_proof S hS inferInstance (PaintingOrDrawing.drawing H) K θ T ins + hResp.1 hE + hResp.2.1.isPretangle hResp.2.2 hK hd).1 + constructor + · rintro ⟨A, B, hAB, hord, hXA⟩ + have hsep : H.toHypergraph.IsSeparation A B := hResp.2.1.isSeparation hAB + obtain ⟨n, Cs, hCs, hcov⟩ := (hiff A B hsep (hResp.2.1.order_lt hAB)).mp hAB + set G : Drawing S := K.span (⋃ i, (Cs i).V) (⋃ i, (Cs i).E) with hG + have hGK : G.IsSubdrawing K := + ⟨K.spanV_subset _ _, by rw [hG, K.span_E]; exact inter_subset_right⟩ + have hCG : ∀ i, (Cs i).IsSubdrawing G := fun i ↦ + ⟨fun v hv ↦ Or.inl ⟨mem_iUnion.mpr ⟨i, hv⟩, (hCs i).2.1.1 hv⟩, fun e he ↦ by + rw [hG, K.span_E] + exact ⟨mem_iUnion.mpr ⟨i, he⟩, (hCs i).2.1.2 he⟩⟩ + refine exists_circuit_of_confined hS hP hs hr hw hwV hXV hXr hXθ hGK + (Z := (A ∩ B).vertexSet) (A ∩ B).vertexSet_finite ?_ hord ?_ + · rintro v (⟨hv, -⟩ | hv) hvH + · obtain ⟨i, hi⟩ := mem_iUnion.mp hv + exact (hCs i).2.2.2 ⟨hi, hvH⟩ + · obtain ⟨e, he, hve⟩ := mem_iUnion₂.mp hv + obtain ⟨i, hi⟩ := mem_iUnion.mp he.1 + exact (hCs i).2.2.2 ⟨end_mem_V (hCs i).2.1 hi hve.1 hve.2, hvH⟩ + · intro x hxX hxZ + have hxB : x ∉ B.vertexSet := fun h ↦ hxZ ⟨hXA hxX, h⟩ + obtain ⟨e, he, hxe⟩ := exists_edge_at_vertex_of_twoCell hS hResp.1 hE (hXV hxX) + have hinc : (A ∪ B).Inc e x := by + rw [hsep.union_eq] + exact ⟨he, hXV hxX, hxe⟩ + rcases hinc with h | h + · obtain ⟨i, hi⟩ := hcov e (A.edge_mem_of_inc h) + have hclosed : IsClosed (ins (Cs i)) := + (hs.isClosedDisc _ (hCs i).1 (hCs i).2.1 (hCs i).2.2.1).isClosed + exact ⟨Cs i, (hCs i).1, hCG i, closure_minimal hi hclosed hxe⟩ + · exact absurd (B.vertex_mem_of_inc h) hxB + · rintro ⟨C, hC, hCs, hl, hlX, -⟩ + exact exists_separation_of_circuit hS hResp hP hs hd hiff hXV hXθ hC hCs hl hlX + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15d.lean b/LeanPool/GraphMinor/GM19/Section15d.lean new file mode 100644 index 0000000000..f1d5fd758d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15d.lean @@ -0,0 +1,312 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section12a +public import LeanPool.GraphMinor.GM19.Section11g + +/-! +# Graph Minors XIX, (15.2): the choice of the edges + +This is step (1) of the proof of (15.2). If the third and fourth outcomes of (15.2) fail, then each +edge `e` of `Γ₀` has an image `β(e)` in `Γ`, of the same size and with a larger colour, and the +images are far apart. The result used later is `exists_edgeMap`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +namespace TangleDatum + +/-- What step (1) of the proof of (15.2) says about a long side: the edges `f` of `Γ₀` along the +side, in order, have images `g` in `Γ`, in order. -/ +structure IsSideMap (D : TangleDatum cap χ) (P₀ : ColouredPainting χ) (n : ℕ) (b : Set S → Set S) + (side : Set S) (m : ℕ) (f g : Fin m → Set S) (c : Set S) (r : Shat) + (u₀ u₁ u₀' u₁' : S) : Prop where + pole : r ∈ D.rad.poles + cuff : c ∈ cuffs S + pole_disc : r ∈ cap.cuffDisc c + side_cuff : side ⊆ c + order₀ : BordersInOrder χ P₀.Γ side c f u₀ u₁ + all₀ : ∀ e ∈ P₀.Γ.E, e ⊆ side → ∃ i, f i = e + order : BordersInOrder χ D.P.Γ side c g u₀' u₁' + map : ∀ i, b (f i) = g i + le : ∀ i, (χ.ΩS side).le (P₀.φ (f i)) (D.P.φ (g i)) + far : ∀ i j, i < j → n / 2 < D.borderEdgeDist r (g i) (g j) + far_short : ∀ i, ∀ s ∈ χ.Φ.shortSides, s ⊆ c → n / 2 < D.borderEdgeDist r (g i) s + +/-- What step (1) of the proof of (15.2) gives. -/ +structure IsEdgeMap (D : TangleDatum cap χ) (P₀ : ColouredPainting χ) (n : ℕ) (b : Set S + → Set S) : Prop where + mem : ∀ e ∈ P₀.Γ.E, b e ∈ D.P.Γ.E + injOn : InjOn b P₀.Γ.E + short : ∀ s ∈ χ.Φ.shortSides, b s = s + size : ∀ e ∈ P₀.Γ.E, (tilde (b e)).ncard = (tilde e).ncard + side : ∀ side ∈ χ.Φ.longSides, ∃ m f g c r u₀ u₁ u₀' u₁', D.IsSideMap P₀ n b side m f g c r u₀ u₁ + u₀' u₁' + internal : ∀ e ∈ P₀.Γ.E, Painting.IsInternal e → Painting.IsInternal (b e) + internal_le : ∀ e ∈ P₀.Γ.E, Painting.IsInternal e → sizeLE χ (tilde e).ncard (P₀.φ e) (D.P.φ + (b e)) + pole_far : ∀ e ∈ P₀.Γ.E, Painting.IsInternal e → ∀ r ∈ D.rad.poles, n < D.edgeVertDist (b e) r + far : ∀ e ∈ P₀.Γ.E, Painting.IsInternal e → ∀ e' ∈ P₀.Γ.E, Painting.IsInternal e' → e ≠ e' + → n / 2 < D.edgeDist (b e) (b e') + +variable {D : TangleDatum cap χ} {P₀ : ColouredPainting χ} + +/-- **The internal edges.** Given images of the edges of a set `𝓘`, a new edge has `|E(Γ₀)|` +candidates far apart. If each of them were within `½n` of an old image, then two would be within +`½n` of one +image, and so within `n` of each other. -/ +theorem exists_internal_images {n : ℕ} (hn : Even n) (hrep : 4 ≤ D.rep) + (h4 : ∀ f ∈ P₀.Γ.E, Painting.IsInternal f → ¬ D.NoInternalMatch P₀.Γ.E.ncard n (tilde f).ncard + (P₀.φ f)) (𝓘 : Finset (Set S)) (h𝓘 : ∀ e ∈ 𝓘, e ∈ P₀.Γ.E ∧ Painting.IsInternal e) : + ∃ b : Set S → Set S, (∀ e ∈ 𝓘, b e ∈ D.P.Γ.E ∧ Painting.IsInternal (b e) ∧ (tilde (b e)).ncard + = (tilde e).ncard ∧ sizeLE χ (tilde e).ncard (P₀.φ e) (D.P.φ (b e)) ∧ + ∀ r ∈ D.rad.poles, n < D.edgeVertDist (b e) r) ∧ ∀ e ∈ 𝓘, ∀ e' ∈ 𝓘, e ≠ e' + → n / 2 < D.edgeDist (b e) (b e') := by + classical + induction 𝓘 using Finset.induction_on with + | empty => exact ⟨id, by simp, by simp⟩ + | insert f₀ 𝓘 hf₀ ih => + obtain ⟨b, hb₁, hb₂⟩ := ih fun e he ↦ h𝓘 e (Finset.mem_insert_of_mem he) + obtain ⟨hf₀E, hf₀I⟩ := h𝓘 f₀ (Finset.mem_insert_self _ _) + have hn' := h4 f₀ hf₀E hf₀I + unfold NoInternalMatch at hn' + rw [not_not] at hn' + obtain ⟨c, hc, hfar, hpole⟩ := hn' + have hcard : 𝓘.card < P₀.Γ.E.ncard := by + have hsub : ((insert f₀ 𝓘 : Finset (Set S)) : Set (Set S)) ⊆ P₀.Γ.E := fun e he ↦ (h𝓘 e + (Finset.mem_coe.1 he)).1 + have := ncard_le_ncard hsub P₀.Γ.finite_edges + rw [ncard_coe_finset, Finset.card_insert_of_notMem hf₀] at this + omega + have hex : ∃ j, ∀ e ∈ 𝓘, n / 2 < D.edgeDist (b e) (c j) := by + by_contra hno + push Not at hno + choose t ht ht' using hno + have hne : ¬ Function.Injective (fun j ↦ (⟨t j, ht j⟩ : {x // x ∈ 𝓘})) := fun hinj ↦ by + have := Fintype.card_le_of_injective _ hinj + simp at this + omega + rw [Function.Injective] at hne + push Not at hne + obtain ⟨j, j', he, hjj⟩ := hne + have he' : t j = t j' := congrArg Subtype.val he + have htj := hb₁ (t j) (ht j) + have hat : cap.emb '' b (t j) ∈ D.P.Γ.atoms cap := Or.inl (Or.inr ⟨_, htj.1, rfl⟩) + have htri := D.dist_triangle hrep (a := cap.emb '' c j) (b := cap.emb '' b (t j)) (c + := cap.emb '' c j') hat + have h₁ : D.dist (cap.emb '' c j) (cap.emb '' b (t j)) ≤ n / 2 := by + rw [D.dist_comm] + exact ht' j + have h₂ : D.dist (cap.emb '' b (t j)) (cap.emb '' c j') ≤ n / 2 := by + rw [he'] + exact ht' j' + obtain ⟨k, hk⟩ := hn + rcases lt_or_gt_of_ne (fun h ↦ hjj (Fin.ext h) : j.1 ≠ j'.1) with hlt | hlt + · have := hfar j j' hlt + change n < D.dist _ _ at this + omega + · have := hfar j' j hlt + rw [edgeDist, D.dist_comm] at this + omega + obtain ⟨j, hj⟩ := hex + obtain ⟨hc₁, hc₂, hc₃, hc₄⟩ := hc j + refine ⟨Function.update b f₀ (c j), fun e he ↦ ?_, fun e he e' he' hne ↦ ?_⟩ + · rcases Finset.mem_insert.1 he with rfl | he + · rw [Function.update_self] + exact ⟨hc₁, hc₂, hc₃, hc₄, hpole j⟩ + · have hne : e ≠ f₀ := fun h ↦ hf₀ (h ▸ he) + rw [Function.update_of_ne hne] + exact hb₁ e he + · rcases Finset.mem_insert.1 he with rfl | he₁ + · rcases Finset.mem_insert.1 he' with rfl | he₂ + · exact absurd rfl hne + · have hne' : e' ≠ e := hne.symm + rw [Function.update_self, Function.update_of_ne hne', edgeDist, D.dist_comm] + exact hj e' he₂ + · have hne₁ : e ≠ f₀ := fun h ↦ hf₀ (h ▸ he₁) + rcases Finset.mem_insert.1 he' with rfl | he₂ + · rw [Function.update_of_ne hne₁, Function.update_self] + exact hj e he₁ + · have hne₂ : e' ≠ f₀ := fun h ↦ hf₀ (h ▸ he₂) + rw [Function.update_of_ne hne₁, Function.update_of_ne hne₂] + exact hb₂ e he₁ e' he₂ hne + +omit [T2Space S] [T2Space Shat] in +/-- A long side has the data of `IsSideMap` when the third outcome fails. -/ +theorem exists_sideMap {n : ℕ} {side : Set S} (hside : side ∈ χ.Φ.longSides) {ω : List β} + (hl : IsBorderLabels P₀ side ω) (h3 : ¬ D.NoSideMatch side (n / 2) ω) : + ∃ (m : ℕ) (f g : Fin m → Set S) (c : Set S) (r : Shat) (u₀ u₁ u₀' u₁' : S), BordersInOrder χ + P₀.Γ side c f u₀ u₁ ∧ BordersInOrder χ D.P.Γ side c g u₀' u₁' ∧ ∀ b : Set S → Set S, (∀ i, b + (f i) = g i) → D.IsSideMap P₀ n b side m f g c r u₀ u₁ u₀' u₁' := by + obtain ⟨-, -, c₀, f, u₀, u₁, hc₀, hs₀, hord₀, hall, hω⟩ := hl + unfold NoSideMatch at h3 + push Not at h3 + obtain ⟨r, hr, c, hc, hrd, hsc, g, u₀', u₁', hord, hle, hfar, hshort⟩ := h3 + obtain ⟨x, hx⟩ : side.Nonempty := hside.1.1 + obtain rfl : c₀ = c := cuffs_eq_of_mem hc₀ hc (hs₀ hx) (hsc hx) + exact ⟨_, f, g, c₀, r, u₀, u₁, u₀', u₁', hord₀, hord, fun b hb ↦ ⟨hr, hc, hrd, hsc, hord₀, hall, + hord, hb, fun i ↦ hω i ▸ hle i, fun i j hij ↦ hfar i j hij, fun i s hs hsub ↦ hshort i s hs + hsub⟩⟩ + +omit [T2Space S] in +/-- An edge inside a short side is that side. -/ +theorem eq_short_of_subset {Γ : Painting S} (hfit : Γ.Fits χ.Φ) {e s : Set S} (he : e ∈ Γ.E) + (hs : s ∈ χ.Φ.shortSides) (hsub : e ⊆ s) : e = s := by + obtain ⟨x, hx⟩ : e.Nonempty := he.1 + exact GM11.arcComponent_eq he (hfit.short_sides hs) hx (hsub hx) + +/-- **Step (1) of the proof of (15.2).** -/ +theorem exists_edgeMap {n : ℕ} (hn : Even n) (hrep : 4 ≤ D.rep) {ω : Set S → List β} + (hl : ∀ side ∈ χ.Φ.longSides, IsBorderLabels P₀ side (ω side)) + (h3 : ∀ side ∈ χ.Φ.longSides, ¬ D.NoSideMatch side (n / 2) (ω side)) + (h4 : ∀ f ∈ P₀.Γ.E, Painting.IsInternal f → ¬ D.NoInternalMatch P₀.Γ.E.ncard n (tilde f).ncard + (P₀.φ f)) : ∃ b, D.IsEdgeMap P₀ n b := by + classical + have hfin : {e ∈ P₀.Γ.E | Painting.IsInternal e}.Finite := P₀.Γ.finite_edges.subset fun _ h ↦ h.1 + obtain ⟨bI, hI₁, hI₂⟩ := exists_internal_images (D := D) hn hrep h4 hfin.toFinset fun e he ↦ + hfin.mem_toFinset.1 he + have hI₁' : ∀ e ∈ P₀.Γ.E, Painting.IsInternal e → _ := fun e he hi ↦ hI₁ e + (hfin.mem_toFinset.2 ⟨he, hi⟩) + have hsm : ∀ side : {s // s ∈ χ.Φ.longSides}, _ := fun side ↦ exists_sideMap (D := D) (n + := n) side.2 (hl side.1 side.2) (h3 side.1 side.2) + choose m f g c r u₀ u₁ u₀' u₁' hO₀ hO hSM using hsm + have hfE : ∀ s i, f s i ∈ P₀.Γ.E := fun s i ↦ ((hO₀ s).2.2.2.1 i).1 + have hfs : ∀ s i, f s i ⊆ s.1 := fun s i ↦ ((hO₀ s).2.2.2.1 i).2 + have hgE : ∀ s i, g s i ∈ D.P.Γ.E := fun s i ↦ ((hO s).2.2.2.1 i).1 + have hgs : ∀ s i, g s i ⊆ s.1 := fun s i ↦ ((hO s).2.2.2.1 i).2 + have hside : ∀ {Γ : Painting S} {e} {s s' : Set S}, e ∈ Γ.E → s ∈ χ.Φ.sides → s' ∈ χ.Φ.sides + → e ⊆ s → e ⊆ s' → s = s' := fun {Γ e s s'} he hs hs' h₁ h₂ ↦ by + obtain ⟨x, hx⟩ : e.Nonempty := he.1 + exact GM11.arcComponent_eq hs hs' (h₁ hx) (h₂ hx) + have huniq : ∀ {p q : Σ s : {s // s ∈ χ.Φ.longSides}, Fin (m s)}, f p.1 p.2 = f q.1 q.2 → p = q + := by + rintro ⟨s, i⟩ ⟨s', i'⟩ he + have h₁ : s = s' := Subtype.ext (hside (hfE s i) s.2.1 s'.2.1 (hfs s i) (he ▸ hfs s' i')) + subst h₁ + obtain rfl : i = i' := (hO₀ s).2.2.1 he + rfl + have hbd : ∀ {Γ : Painting S} {e s : Set S}, e ∈ Γ.E → s ∈ χ.Φ.sides → e ⊆ s + → ¬ Painting.IsInternal e := fun {Γ e s} he hs hsub hi ↦ by + obtain ⟨x, hx⟩ : e.Nonempty := he.1 + exact disjoint_left.1 hi hx (hs.2.1 (hsub hx)).1 + let b : Set S → Set S := fun e ↦ if Painting.IsInternal e then bI e else if h : ∃ p : Σ s : {s // + s ∈ χ.Φ.longSides}, Fin (m s), f p.1 p.2 = e then g h.choose.1 h.choose.2 else e + have hbI : ∀ {e}, Painting.IsInternal e → b e = bI e := fun {e} h ↦ ite_eq_left h + have hbf : ∀ s i, b (f s i) = g s i := fun s i ↦ by + have hn : ¬ Painting.IsInternal (f s i) := hbd (hfE s i) s.2.1 (hfs s i) + have hex : ∃ p : Σ s : {s // s ∈ χ.Φ.longSides}, Fin (m s), f p.1 p.2 = f s i := ⟨⟨s, i⟩, rfl⟩ + simp only [b, ite_eq_right hn, dite_eq_left hex] + have he := huniq (p := hex.choose) (q := ⟨s, i⟩) hex.choose_spec + rw [he] + have hbs : ∀ s ∈ χ.Φ.shortSides, b s = s := fun s hs ↦ by + have hsE := P₀.fits.short_sides hs + have hn : ¬ Painting.IsInternal s := hbd hsE hs.1 Subset.rfl + have hex : ¬ ∃ p : Σ s : {s // s ∈ χ.Φ.longSides}, Fin (m s), f p.1 p.2 = s := by + rintro ⟨⟨s', i⟩, he⟩ + have := hside hsE hs.1 s'.2.1 Subset.rfl (he ▸ hfs s' i) + exact hs.2 (this ▸ s'.2.2) + simp only [b, ite_eq_right hn, dite_eq_right hex] + have hcases : ∀ e ∈ P₀.Γ.E, Painting.IsInternal e ∨ e ∈ χ.Φ.shortSides ∨ ∃ s i, f s i = e + := fun e he ↦ by + by_cases hi : Painting.IsInternal e + · exact Or.inl hi + · have hb : Painting.IsBorder e := by + rw [Painting.IsBorder, ← not_disjoint_iff_nonempty_inter] + exact hi + obtain ⟨s, hs, hs₁, hs₂⟩ := Painting.exists_side P₀.fits he hb + by_cases hl' : s ∈ χ.Φ.longSides + · obtain ⟨i, rfl⟩ := (hSM ⟨s, hl'⟩ b (hbf _)).all₀ e he hs₂ + exact Or.inr (Or.inr ⟨_, i, rfl⟩) + · have hss : s ∈ χ.Φ.shortSides := ⟨hs, fun h ↦ hl' ⟨hs, h⟩⟩ + exact Or.inr (Or.inl ((eq_short_of_subset P₀.fits he hss hs₂) ▸ hss)) + have hbInt : ∀ {e}, e ∈ P₀.Γ.E → Painting.IsInternal e → _ := fun {e} he hi ↦ hI₁' e he hi + have hsideD : ∀ {e}, e ∈ χ.Φ.shortSides → e ∈ D.P.Γ.E := fun h ↦ D.P.fits.short_sides h + refine ⟨b, ⟨fun e he ↦ ?_, ?_, hbs, fun e he ↦ ?_, fun side hside' ↦ ?_, fun e he hi ↦ ?_, + fun e he hi ↦ ?_, fun e he hi r' hr ↦ ?_, fun e he hi e' he' hi' hne ↦ ?_⟩⟩ + · rcases hcases e he with h | h | ⟨s, i, rfl⟩ + · rw [hbI h] + exact (hbInt he h).1 + · rw [hbs e h] + exact hsideD h + · rw [hbf] + exact hgE s i + · have key : ∀ e ∈ P₀.Γ.E, ∀ e' ∈ P₀.Γ.E, Painting.IsInternal e → ¬ Painting.IsInternal e' + → b e ≠ b e' := by + intro e he e' he' hi hi' heq + have h₁ := (hbInt he hi).2.1 + rw [← hbI hi, heq] at h₁ + rcases hcases e' he' with h | h | ⟨s, i, rfl⟩ + · exact hi' h + · rw [hbs e' h] at h₁ + exact hbd (hsideD h) h.1 Subset.rfl h₁ + · rw [hbf] at h₁ + exact hbd (hgE s i) s.2.1 (hgs s i) h₁ + intro e he e' he' heq + by_cases hi : Painting.IsInternal e + · by_cases hi' : Painting.IsInternal e' + · by_contra hne + have := hI₂ e (hfin.mem_toFinset.2 ⟨he, hi⟩) e' (hfin.mem_toFinset.2 ⟨he', hi'⟩) hne + rw [← hbI hi, ← hbI hi', heq, edgeDist, D.dist_self] at this + omega + · exact absurd heq (key e he e' he' hi hi') + · by_cases hi' : Painting.IsInternal e' + · exact absurd heq.symm (key e' he' e he hi' hi) + · rcases hcases e he with h | h | ⟨s, i, rfl⟩ + · exact absurd h hi + · rcases hcases e' he' with h' | h' | ⟨s', i', rfl⟩ + · exact absurd h' hi' + · rw [hbs e h, hbs e' h'] at heq + exact heq + · exfalso + rw [hbs e h, hbf] at heq + have := hside (hsideD h) h.1 s'.2.1 Subset.rfl (heq ▸ hgs s' i') + exact h.2 (this ▸ s'.2.2) + · rcases hcases e' he' with h' | h' | ⟨s', i', rfl⟩ + · exact absurd h' hi' + · exfalso + rw [hbf, hbs e' h'] at heq + have := hside (hsideD h') h'.1 s.2.1 Subset.rfl (heq ▸ hgs s i) + exact h'.2 (this ▸ s.2.2) + · rw [hbf, hbf] at heq + have h₁ : s = s' := Subtype.ext (hside (hgE s i) s.2.1 s'.2.1 (hgs s i) + (heq ▸ hgs s' i')) + subst h₁ + rw [(hO s).2.2.1 heq] + · have htwo : ∀ {Γ : Painting S} {e s : Set S}, e ∈ Γ.E → s ∈ χ.Φ.sides → e ⊆ s → (tilde e).ncard + = 2 := fun {Γ e s} he hs hsub ↦ by + obtain ⟨x, hx⟩ : e.Nonempty := he.1 + exact (Γ.border_edge e he ⟨x, hx, (hs.2.1 (hsub hx)).1⟩).1 + rcases hcases e he with h | h | ⟨s, i, rfl⟩ + · rw [hbI h] + exact (hbInt he h).2.2.1 + · rw [hbs e h] + · rw [hbf, htwo (hgE s i) s.2.1 (hgs s i), htwo he s.2.1 (hfs s i)] + · exact ⟨_, _, _, _, _, _, _, _, _, hSM ⟨side, hside'⟩ b (hbf _)⟩ + · rw [hbI hi] + exact (hbInt he hi).2.1 + · rw [hbI hi] + exact (hbInt he hi).2.2.2.1 + · rw [hbI hi] + exact (hbInt he hi).2.2.2.2 r' hr + · rw [hbI hi, hbI hi'] + exact hI₂ e (hfin.mem_toFinset.2 ⟨he, hi⟩) e' (hfin.mem_toFinset.2 ⟨he', hi'⟩) hne + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15e.lean b/LeanPool/GraphMinor/GM19/Section15e.lean new file mode 100644 index 0000000000..363701002d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15e.lean @@ -0,0 +1,181 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section15d + +/-! +# Graph Minors XIX, (15.2): the inflation + +The last step of the proof of (15.2). Suppose that `sk(Γ)`, drawn in `Σ̂`, has mutually disjoint +connected subdrawings, one for +each vertex `v` of `Γ₀`, that contain the ends of the edges `β(e)` in the right places. Then their +vertex sets, and the map `β`, +form an inflation of `(Γ₀, φ₀)` in `(Γ, φ)`. The result used later is +`isColouredInflation_of_subdrawings`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 GraphMinor.GM12 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +omit [T2Space Shat] in +/-- Two vertices joined by an edge of `sk(Γ)` drawn in `Σ̂` are adjacent in `sk(Γ)`. -/ +theorem IsSkHat.skAdj_of_edge (hS : IsSurface S) {Γ : Painting S} {H : Drawing Shat} + (h : IsSkHat cap Γ H) {C : Set Shat} (hC : C ∈ H.E) {x y : Shat} (hcap : closure C ∩ H.V + = {x, y}) : + ∃ u w, x = cap.emb u ∧ y = cap.emb w ∧ Γ.skAdj.Adj u w := by + obtain ⟨e, he, rfl⟩ := h.edge_iff.mp hC + obtain ⟨u, w, huw, ht, htV, -⟩ := Γ.sk_line he + have hcl : closure (cap.emb '' e) = cap.emb '' closure e := ((cap.isClosedEmbedding + hS).closure_image_eq e).symm ▸ rfl + have huS : u ∈ tilde e := ht ▸ mem_insert u _ + have hwS : w ∈ tilde e := ht ▸ mem_insert_of_mem u rfl + have hset : closure (cap.emb '' e) ∩ H.V = {cap.emb u, cap.emb w} := by + rw [hcl, h.hV] + ext z + constructor + · rintro ⟨⟨p, hp, rfl⟩, ⟨q, hq, hpq⟩⟩ + obtain rfl := cap.isEmbedding.injective hpq + have hpe : q ∉ e := fun hc ↦ (he.2.1 hc).2 hq + have : q ∈ tilde e := ⟨hp, hpe⟩ + rw [ht] at this + rcases this with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + · rintro (rfl | rfl) + · exact ⟨mem_image_of_mem _ huS.1, mem_image_of_mem _ (htV huS)⟩ + · exact ⟨mem_image_of_mem _ hwS.1, mem_image_of_mem _ (htV hwS)⟩ + have hadj : Γ.skAdj.Adj u w := by + refine ⟨huw, htV huS, htV hwS, ?_⟩ + rcases Γ.sk_cases he with ⟨heE, -⟩ | ⟨c, hc, -, hec, -⟩ + · exact ⟨e, heE, huS, hwS⟩ + · have hin : ∀ {z}, z ∈ tilde e → z ∈ tilde c := fun {z} hz ↦ + ⟨closure_mono hec hz.1, fun hzc ↦ Γ.disjoint_V hc hzc (htV hz)⟩ + exact ⟨c, hc, hin huS, hin hwS⟩ + have hpair : ({x, y} : Set Shat) = {cap.emb u, cap.emb w} := hcap.symm.trans hset + have hx : x ∈ ({cap.emb u, cap.emb w} : Set Shat) := hpair ▸ mem_insert x _ + have hy : y ∈ ({cap.emb u, cap.emb w} : Set Shat) := hpair ▸ mem_insert_of_mem x rfl + have hu' : cap.emb u ∈ ({x, y} : Set Shat) := hpair ▸ mem_insert _ _ + rcases hx with rfl | rfl + · rcases hy with rfl | rfl + · exfalso + have hw' : cap.emb w ∈ ({cap.emb u, cap.emb u} : Set Shat) := hpair ▸ mem_insert_of_mem _ rfl + rcases hw' with hw' | hw' <;> exact huw (cap.isEmbedding.injective hw').symm + · exact ⟨u, w, rfl, rfl, hadj⟩ + · rcases hy with rfl | rfl + · exact ⟨w, u, rfl, rfl, hadj.symm⟩ + · exfalso + rcases hu' with hu' | hu' <;> exact huw (cap.isEmbedding.injective hu') + +omit [T2Space Shat] in +/-- A walk in a subdrawing of `sk(Γ)` gives a walk in the induced subgraph of the skeleton. -/ +theorem IsSkHat.reachable_of_walk (hS : IsSurface S) {Γ : Painting S} {H H' : Drawing Shat} + (h : IsSkHat cap Γ H) (hs : H'.IsSubdrawing H) {x y : Shat} (W : GraphWalk H'.toGraph x y) {a b : + S} + (ha : cap.emb a = x) (hb : cap.emb b = y) (hmem : a ∈ cap.emb ⁻¹' H'.V) + (hmemb : b ∈ cap.emb ⁻¹' H'.V) : + (Γ.skAdj.induce (cap.emb ⁻¹' H'.V)).Reachable ⟨a, hmem⟩ ⟨b, hmemb⟩ := by + induction W generalizing a with + | nil hv => + obtain rfl : a = b := cap.isEmbedding.injective (ha.trans hb.symm) + exact SimpleGraph.Reachable.refl _ + | @cons u v w g hlink rest ih => + obtain ⟨hg, hu, hv, hcap⟩ := hlink + have hcap' : closure g ∩ H.V = {u, v} := by + rw [← hcap] + exact (hs.closure_inter_V hg).symm + obtain ⟨p, q, hp, hq, hadj⟩ := h.skAdj_of_edge hS (hs.2 hg) hcap' + obtain rfl : a = p := cap.isEmbedding.injective (ha.trans hp) + have hqm : q ∈ cap.emb ⁻¹' H'.V := by + rw [mem_preimage, ← hq] + exact hv + exact (SimpleGraph.Adj.reachable (G := Γ.skAdj.induce (cap.emb ⁻¹' H'.V)) (u := ⟨a, + hmem⟩) (v := ⟨q, hqm⟩) hadj).trans (ih hq.symm hb hqm) + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {P₀ : ColouredPainting χ} {n : ℕ} {b : Set S → Set S} + +omit [T2Space S] in +/-- A border edge of `Γ₀` and its image lie on the same sides. -/ +theorem IsEdgeMap.border (hb : D.IsEdgeMap P₀ n b) {e : Set S} (he : e ∈ P₀.Γ.E) + (hB : Painting.IsBorder e) : + ∃ s ∈ χ.Φ.sides, e ⊆ s ∧ b e ⊆ s ∧ (χ.ΩS s).le (P₀.φ e) (D.P.φ (b e)) := by + obtain ⟨s, hs, -, hsub⟩ := Painting.exists_side P₀.fits he hB + by_cases hl : s ∈ χ.Φ.longSides + · obtain ⟨m, f, g, c, r, u₀, u₁, u₀', u₁', hM⟩ := hb.side s hl + obtain ⟨i, rfl⟩ := hM.all₀ e he hsub + rw [hM.map i] + exact ⟨s, hs, hsub, (hM.order.2.2.2.1 i).2, hM.le i⟩ + · have hss : s ∈ χ.Φ.shortSides := ⟨hs, fun h ↦ hl ⟨hs, h⟩⟩ + obtain rfl := eq_short_of_subset P₀.fits he hss hsub + rw [hb.short e hss] + have hm₀ := P₀.border_mem e he e hs ⟨hB, Subset.rfl⟩ + have hm₁ := D.P.border_mem e (D.P.fits.short_sides hss) e hs ⟨hB, Subset.rfl⟩ + rw [χ.short_singleton e hss] at hm₀ hm₁ + rw [mem_singleton_iff.1 hm₀, mem_singleton_iff.1 hm₁] + exact ⟨e, hs, Subset.rfl, Subset.rfl, (χ.ΩS e).refl _ (by rw [χ.short_singleton e hss]; exact + rfl)⟩ + +end TangleDatum + +/-- **The end of the proof of (15.2).** -/ +theorem isColouredInflation_of_subdrawings {D : TangleDatum cap χ} {P₀ : ColouredPainting χ} {n : + ℕ} {b : Set S → Set S} (hS : IsSurface S) {H : Drawing Shat} (hH : IsSkHat cap D.P.Γ H) + (hb : D.IsEdgeMap P₀ n b) (Hv : S → Drawing Shat) (hsub : ∀ v ∈ P₀.Γ.V, (Hv v).IsSubdrawing H) + (hconn : ∀ v ∈ P₀.Γ.V, IsConnectedDrawing (Hv v)) + (hdisj : ∀ v ∈ P₀.Γ.V, ∀ v' ∈ P₀.Γ.V, v ≠ v' → Disjoint (Hv v).V (Hv v').V) + (hne : ∀ v ∈ P₀.Γ.V, (Hv v).V.Nonempty) + (hends : ∀ e ∈ P₀.Γ.E, ∀ (i : ℕ) (hi : i < (P₀.Γ.γ e).length) (hi' : i < (D.P.Γ.γ + (b e)).length), cap.emb (D.P.Γ.γ (b e))[i] ∈ (Hv (P₀.Γ.γ e)[i]).V) : + IsColouredInflation χ P₀ D.P (fun v ↦ cap.emb ⁻¹' (Hv v).V) b := by + have hVS : ∀ v ∈ P₀.Γ.V, ∀ x ∈ (Hv v).V, ∃ y ∈ D.P.Γ.V, cap.emb y = x := fun v hv x hx ↦ by + have := (hsub v hv).1 hx + rw [hH.hV] at this + exact this + refine ⟨⟨hb.mem, hb.size, hb.injOn, fun v hv ↦ ?_, fun v hv x hx ↦ ?_, fun v hv ⟨x, hx⟩ ⟨y, hy⟩ ↦ + ?_, fun v hv v' hv' hne' ↦ ?_, hends⟩, fun e he hB ↦ ?_, fun e he hi h2 ↦ ?_, fun e he hi h3 ↦ + ?_, fun e he s hs hbs ↦ ?_⟩ + · obtain ⟨x, hx⟩ := hne v hv + obtain ⟨y, -, rfl⟩ := hVS v hv x hx + exact ⟨y, hx⟩ + · obtain ⟨y, hy, hyx⟩ := hVS v hv _ hx + exact cap.isEmbedding.injective hyx ▸ hy + · obtain ⟨W⟩ := hconn v hv _ hx _ hy + exact hH.reachable_of_walk hS (hsub v hv) W rfl rfl hx hy + · exact disjoint_left.mpr fun x h₁ h₂ ↦ disjoint_left.mp (hdisj v hv v' hv' hne') h₁ h₂ + · obtain ⟨s, hs, hes, hbs, -⟩ := hb.border he hB + obtain ⟨x, hxe⟩ : (b e).Nonempty := (hb.mem e he).1 + have hbe : Painting.IsBorder (b e) := ⟨x, hxe, (hs.2.1 (hbs hxe)).1⟩ + refine ⟨hbe, fun s' hs' ↦ ⟨fun h ↦ ?_, fun h ↦ ?_⟩⟩ + · obtain ⟨y, hy⟩ : e.Nonempty := he.1 + rw [← GM11.arcComponent_eq hs hs' (hes hy) (h hy)] + exact hbs + · rw [← GM11.arcComponent_eq hs hs' (hbs hxe) (h hxe)] + exact hes + · rcases hb.internal_le e he hi with ⟨-, h⟩ | ⟨h', -⟩ + · exact h + · omega + · rcases hb.internal_le e he hi with ⟨h', -⟩ | ⟨-, h⟩ + · omega + · exact h + · obtain ⟨s', hs', hes, -, hle⟩ := hb.border he hbs.1 + obtain ⟨y, hy⟩ : e.Nonempty := he.1 + rw [GM11.arcComponent_eq hs hs' (hbs.2 hy) (hes hy)] + exact hle + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15f.lean b/LeanPool/GraphMinor/GM19/Section15f.lean new file mode 100644 index 0000000000..7134bce22d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15f.lean @@ -0,0 +1,344 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section15e +public import LeanPool.GraphMinor.GM19.Section15c +public import LeanPool.GraphMinor.GM19.Section8e + +/-! +# Graph Minors XIX: the small side of a separation in `𝒯` + +This file proves the part of (6.3) of Graph Minors XI that the proof of (15.2) needs, for a tangle +in a painting in `Σ̂`. The +painting is not a drawing or a painting in the sense of XI, so we repeat the proof, with the drawing +`G₃` of Section 8 in place of +the radial drawing. If `(A, B) ∈ 𝒯` has small order, then the edges of `A` lie in the insides of +short circuits of `Γ*` whose +vertices in `Γ` lie in `V(A ∩ B)`. The result used later is `TangleDatum.exists_inside_cover`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 Hypergraph + +universe w + +/-- For a separation `(A, B)` of small order, the pair `(A ∩ B, G)` lies in a pretangle `𝒯`, since +`(G, A ∩ B)` would break the +second tangle axiom. -/ +theorem mem_pretangle_inter {α β : Type*} {G : Hypergraph α β} {θ : ℕ} {T : Set + (Hypergraph α β × Hypergraph α β)} (hT : IsPretangle G θ T) {A B : Hypergraph α β} + (hsep : G.IsSeparation A B) + (hord : separationOrder A B < θ) : (A ∩ B, G) ∈ T := by + have hinf : (A ∩ B) ≤ G := by + refine le_trans ?_ hsep.left_le + refine ⟨inter_subset_left, inter_subset_left, fun e he => ?_⟩ + have h₀ : (A ∩ B).edgeSet = ∅ := hsep.edgeSet_inter_eq + rw [h₀] at he + exact absurd he (notMem_empty e) + have hE₀ : (A ∩ B).edgeSet = ∅ := hsep.edgeSet_inter_eq + have hsep₀ : G.IsSeparation (A ∩ B) G := by + refine ⟨hinf, le_rfl, ?_, ?_⟩ + · exact le_antisymm (by + refine ⟨union_subset hinf.vertexSet_subset subset_rfl, + union_subset hinf.edgeSet_subset subset_rfl, fun e he => ?_⟩ + rcases he with he | he + · rw [hE₀] at he + exact absurd he (notMem_empty e) + · ext v + constructor + · exact fun h => Or.inr h + · rintro (h | h) + · exact absurd ((A ∩ B).edge_mem_of_inc h) (by rw [hE₀]; exact notMem_empty e) + · exact h) + (Hypergraph.IsSubhypergraph.mk subset_union_right subset_union_right fun e he => by + ext v + constructor + · rintro (h | h) + · exact absurd ((A ∩ B).edge_mem_of_inc h) (by rw [hE₀]; exact notMem_empty e) + · exact h + · exact fun h => Or.inr h) + · have : ((A ∩ B) ∩ G).edgeSet ⊆ ∅ := fun e he => hE₀ ▸ he.1 + exact subset_empty_iff.mp this + have hord₀ : separationOrder (A ∩ B) G < θ := by + refine lt_of_le_of_lt (ncard_le_ncard inter_subset_left (A ∩ B).vertexSet_finite) hord + rcases hT.axiom1 hsep₀ hord₀ with h | h + · exact h + · have heq : G ∪ G ∪ G = G := by + rw [GM10.union_self, GM10.union_self] + exact absurd heq (hT.axiom2 h h h) + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +namespace TangleDatum + +private theorem boundary_vertex_in_both_sides + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} + {β : Type w} + {χ : ColourScheme S β} + (D : TangleDatum cap χ) + {A : Hypergraph S (Set S)} + {B : Hypergraph S (Set S)} : + let Γ : Painting S := D.P.Γ + ∀ (rad : RadialDrawing cap D.P.Γ), + ∀ (G₃ : Drawing Shat), + (Drawing.IsSubdrawing rad.G G₃) → + (Γ.toHypergraph.IsSeparation A B) → + let t : Set S → Prop := fun x ↦ x ∈ A.edgeSet + ∀ (N₀ : Drawing Shat), + (∀ {e : Set Shat}, e ∈ Drawing.E N₀ → e ∈ Drawing.E rad.G ∧ ∃ v₀ w, v₀ ∈ D.P.Γ.V ∧ w ∈ + rad.Rstar ∧ closure e ∩ G₃.V = {cap.emb v₀, w} ∧ ∃ f₁ f₂ c₁ c₂, rad.PairOf e c₁ c₂ ∧ + D.P.Γ.IsSkEdgeIn f₁ c₁ ∧ D.P.Γ.IsSkEdgeIn f₂ c₂ ∧ v₀ ∈ tilde f₁ ∧ v₀ ∈ tilde f₂ ∧ ¬(t c₁ ↔ t + c₂)) → + ∀ (N : Drawing Shat), + (Drawing.IsSubdrawing N rad.G) → + (∀ x ∈ N.V, ∃ e ∈ Drawing.E N₀, x ∈ closure e) → + (∀ {X : Hypergraph S (Set S)}, X ≤ Γ.toHypergraph → ∀ {c : Set S} {v : S}, c ∈ + X.edgeSet → v ∈ Γ.V → v ∈ tilde c → v ∈ X.vertexSet) → + ∀ v ∈ Γ.V, cap.emb v ∈ N.V → v ∈ (A ∩ B).vertexSet := by + intro Γ rad G₃ hsub hAB t N₀ hbs N hN hNV hincX v hv hvN + obtain ⟨g, hg, hxg⟩ := hNV _ hvN + have hG₃V : cap.emb v ∈ G₃.V := hsub.1 (hN.1 hvN) + obtain ⟨-, v₀, w, hv₀, hw, hset, f₁, f₂, c₁, c₂, hp, h₁, h₂, ht₁, ht₂, hnt⟩ := hbs hg + have hxg' : cap.emb v ∈ closure g ∩ G₃.V := ⟨hxg, hG₃V⟩ + rw [hset] at hxg' + obtain rfl : v = v₀ := by + rcases hxg' with h | h + · exact cap.isEmbedding.injective h + · exact absurd (show w ∈ Γ.hatV cap from h ▸ mem_image_of_mem _ hv) hw.2 + have hc₁ : v ∈ tilde c₁ := ⟨closure_mono h₁.subset ht₁.1, fun h ↦ Γ.disjoint_V h₁.1 h hv₀⟩ + have hc₂ : v ∈ tilde c₂ := ⟨closure_mono h₂.subset ht₂.1, fun h ↦ Γ.disjoint_V h₂.1 h hv₀⟩ + have e₁ := edge_cases hAB h₁.1 + have e₂ := edge_cases hAB h₂.1 + have hnt' : ¬ (c₁ ∈ A.edgeSet ↔ c₂ ∈ A.edgeSet) := hnt + by_cases ha₁ : c₁ ∈ A.edgeSet + · have hb₂ : c₂ ∈ B.edgeSet := by tauto + exact ⟨hincX hAB.left_le ha₁ hv₀ hc₁, hincX hAB.right_le hb₂ hv₀ hc₂⟩ + · have hb₁ : c₁ ∈ B.edgeSet := by tauto + have ha₂ : c₂ ∈ A.edgeSet := by tauto + exact ⟨hincX hAB.left_le ha₂ hv₀ hc₂, hincX hAB.right_le hb₁ hv₀ hc₁⟩ + +/-- **The small side of a separation in `𝒯`.** -/ +theorem exists_inside_cover (D : TangleDatum cap χ) {A B : Hypergraph S (Set S)} (hmem : + (A, B) ∈ D.𝒯) (hord : separationOrder A B < D.rep) : + ∃ N : Drawing Shat, N.IsSubdrawing D.rad.G ∧ (∀ C : Drawing Shat, C.IsCircuit + → C.IsSubdrawing N → C.E.ncard < 2 * D.rep) ∧ (∀ v ∈ D.P.Γ.V, cap.emb v ∈ N.V → v ∈ + (A ∩ B).vertexSet) ∧ + ∀ e ∈ A.edgeSet, ∃ F : Drawing Shat, F.IsCircuit ∧ F.IsSubdrawing N ∧ cap.emb '' e ⊆ D.ins F + := by + classical + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + set Γ := D.P.Γ with hΓ + set rad := D.rad with hradDef + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + have h2 := h3.hatRegions_isOpenDisc hS cap + obtain ⟨H, G₃, hH, hrad, hmax, hsub, hhat⟩ := rad.exists_full hS h2 h3.1 + have hHE := hH.E_nonempty h3.1 + have hAB : Γ.toHypergraph.IsSeparation A B := D.isTangle.isSeparation hmem + let t : Set S → Prop := (· ∈ A.edgeSet) + let Z : Set (Set Shat) := colourSet cap Γ G₃ t + have hZ : Z ⊆ G₃.R := fun _ h ↦ h.1 + let N₀ : Drawing Shat := boundaryDrawing G₃ Z + have hbs : ∀ {e}, e ∈ N₀.E → _ := fun {e} he ↦ boundary_split hS hHE rad hH hrad hmax hsub hhat + (t := t) (e := e) he + let N : Drawing Shat := rad.G.span ∅ N₀.E + have hN : N.IsSubdrawing rad.G := Drawing.span_isSubdrawing _ _ _ + have hNE : ∀ {e}, e ∈ N.E ↔ e ∈ N₀.E := fun {e} ↦ by + change e ∈ (rad.G.span _ _).E ↔ _ + rw [rad.G.span_E] + exact ⟨fun h ↦ h.1, fun h ↦ ⟨h, (hbs h).1⟩⟩ + have hNV : ∀ x ∈ N.V, ∃ e ∈ N₀.E, x ∈ closure e := by + rintro x (hx | hx) + · exact absurd hx.1 (notMem_empty x) + · obtain ⟨e, ⟨he, -⟩, hxe⟩ := mem_iUnion₂.mp hx + exact ⟨e, he, hxe.1⟩ + have hincX : ∀ {X : Hypergraph S (Set S)}, X ≤ Γ.toHypergraph → ∀ {c v}, c ∈ X.edgeSet → v ∈ Γ.V + → v ∈ tilde c → v ∈ X.vertexSet := by + intro X hX c v hc hv hvc + have h₁ : v ∈ Γ.toHypergraph.ends c := ⟨hX.edgeSet_subset hc, hv, hvc⟩ + rw [hX.ends_eq c hc] at h₁ + exact X.vertex_mem_of_inc h₁ + have hmid : ∀ v ∈ Γ.V, cap.emb v ∈ N.V → v ∈ (A ∩ B).vertexSet := by + exact boundary_vertex_in_both_sides (S := S) (Shat := Shat) (cap := cap) (β := β) (χ := χ) D + (A := A) (B := B) rad G₃ hsub hAB N₀ hbs N hN hNV hincX + have hshort : ∀ C : Drawing Shat, C.IsCircuit → C.IsSubdrawing N → C.E.ncard < 2 * D.rep := by + intro C hC hCs + have hCG₃ := (hCs.trans hN).trans hsub + have hb := IsCircuit.ncard_le hC (P := H.V) fun e x y hl ↦ bipartite_of_preRadial hrad.2 e x y + ((hCG₃.isLink_iff hl.1).mp hl) + have hsubs : C.V ∩ H.V ⊆ cap.emb '' (A ∩ B).vertexSet := by + rintro x ⟨hx, hxH⟩ + rw [hH.hV] at hxH + obtain ⟨v, hv, rfl⟩ := hxH + exact mem_image_of_mem _ (hmid v hv (hCs.1 hx)) + have hle₁ := ncard_le_ncard hsubs ((A ∩ B).vertexSet_finite.image _) + have hle₂ := ncard_image_le (f := cap.emb) (A ∩ B).vertexSet_finite + have : (C.V ∩ H.V).ncard ≤ separationOrder A B := hle₁.trans hle₂ + omega + have hsl := D.isSlope (by omega) + have hr₀ := GM11.theorem_4_4_proof hT hsl hN hshort + set r₀ := univ \ insOf D.ins N with hr₀def + have hopen : IsOpen r₀ := region_isOpen hr₀ + have hprec : IsPreconnected r₀ := region_isPreconnected hr₀ + have hno : ∀ s₁ ∈ Z, ∀ s₂ ∈ G₃.R \ Z, (s₁ ∩ r₀).Nonempty → (s₂ ∩ r₀).Nonempty → False := by + intro s₁ h₁ s₂ h₂ m₁ m₂ + obtain ⟨e, he, y, hye, hyi⟩ := exists_boundary_edge hT hopen hprec h₁ hZ h₂ m₁ m₂ + have hyU : y ∈ N.U := (hNE.mpr he |> fun h ↦ (h.2.1 hye).1) + exact hyi.2 (Or.inl hyU) + have hreg : ∀ f, f ∈ arcComponentsIn (Γ.skU \ Γ.V) → ∃ s ∈ G₃.R, cap.emb '' f ⊆ s := by + intro f hf + have hg := hH.edge_iff.mpr ⟨f, hf, rfl⟩ + have hdis : Disjoint (cap.emb '' f) G₃.U := by + refine disjoint_left.mpr fun y hy hyU ↦ ?_ + have hyD := hg.2.1 hy + have : y ∈ H.U ∩ G₃.U := ⟨hyD.1, hyU⟩ + rw [show H.U ∩ G₃.U = H.V from hrad.2.1] at this + exact hyD.2 this + obtain ⟨y, hy⟩ := hg.1 + obtain ⟨s, hs, hys⟩ := exists_region_of_notMem (disjoint_left.mp hdis hy) + exact ⟨s, hs, subset_region hs hg.2.2.1.isConnected.isPreconnected hdis hy hys⟩ + have hcol : ∀ {f c s}, Γ.IsSkEdgeIn f c → s ∈ G₃.R → cap.emb '' f ⊆ s → (s ∈ Z ↔ c ∈ A.edgeSet) + := by + intro f c s hfc hs hfs + constructor + · rintro ⟨-, f', c', h', hf', ht⟩ + rw [(colour_unique hH hrad hmax hHE hs hfc h' hfs hf').2] + exact ht + · exact fun h ↦ ⟨hs, f, c, hfc, hfs, h⟩ + have hcov : ∀ c ∈ Γ.E, (∀ f, Γ.IsSkEdgeIn f c → ∀ s ∈ G₃.R, cap.emb '' f ⊆ s → Disjoint s r₀) + → ∃ C : Drawing Shat, C.IsCircuit ∧ C.IsSubdrawing N ∧ cap.emb '' c ⊆ D.ins C := by + intro c hc hall + obtain ⟨f, hf⟩ := Γ.exists_sk_in hc + obtain ⟨s, hs, hfs⟩ := hreg f hf.mem + obtain ⟨x, hx⟩ := hf.mem.1 + have hxs := hfs (mem_image_of_mem _ hx) + have hdis : ∀ y ∈ c, cap.emb y ∉ rad.G.U := fun y hy hyG ↦ by + have : cap.emb y ∈ Γ.hatU cap ∩ rad.G.U := ⟨mem_image_of_mem _ (hc.2.1 hy).1, hyG⟩ + rw [rad.isPreRadial.1] at this + obtain ⟨z, hz, hzy⟩ := this + obtain rfl := cap.isEmbedding.injective hzy + exact (hc.2.1 hy).2 hz + have hxN : cap.emb x ∈ insOf D.ins N := by + by_contra hn + exact disjoint_left.mp (hall f hf s hs hfs) hxs ⟨mem_univ _, hn⟩ + rcases hxN with hxU | hxC + · exact absurd (hN.U_subset hxU) (hdis x (hf.subset hx)) + obtain ⟨C, ⟨hC, hCs⟩, hxC⟩ := mem_iUnion₂.mp hxC + refine ⟨C, hC, hCs, ?_⟩ + have hlt := hshort C hC hCs + have hfr : frontier (D.ins C) = C.U := by + rw [subBd_eq_frontier', hsl.subBd_eq C hC (hCs.trans hN) hlt] + have hconn : IsPreconnected (cap.emb '' c) := hc.2.2.1.isConnected.isPreconnected.image _ + cap.isEmbedding.continuous.continuousOn + by_contra hcn + obtain ⟨y, hyc, hyn⟩ := not_subset.mp hcn + have hcl : IsClosed (D.ins C) := (hsl.isClosedDisc C hC (hCs.trans hN) hlt).isClosed + have hint : ∀ z ∈ cap.emb '' c, z ∈ D.ins C → z ∈ interior (D.ins C) := by + rintro _ ⟨q, hq, rfl⟩ hz + by_contra hni + have hzf : cap.emb q ∈ frontier (D.ins C) := ⟨subset_closure hz, hni⟩ + rw [hfr] at hzf + exact hdis q hq ((hCs.trans hN).U_subset hzf) + obtain ⟨z, -, hz₁, hz₂⟩ := hconn _ _ isOpen_interior hcl.isOpen_compl (fun z hz ↦ by + by_cases hzI : z ∈ D.ins C + · exact Or.inl (hint z hz hzI) + · exact Or.inr hzI) ⟨_, mem_image_of_mem _ (hf.subset hx), hint _ (mem_image_of_mem _ + (hf.subset hx)) hxC⟩ ⟨y, hyc, hyn⟩ + exact hz₂ (interior_subset hz₁) + obtain ⟨y, hyr, hyU⟩ := exists_notMem_U (Γ := G₃) hT hopen (region_nonempty hr₀) + obtain ⟨s₀, hs₀, hys₀⟩ := exists_region_of_notMem hyU + have hm₀ : (s₀ ∩ r₀).Nonempty := ⟨y, hys₀, hyr⟩ + refine ⟨N, hN, hshort, hmid, ?_⟩ + by_cases hcase : s₀ ∈ Z + · exfalso + have hBc : ∀ e ∈ B.edgeSet, ∃ C : Drawing Shat, C.IsCircuit ∧ C.IsSubdrawing N + ∧ cap.emb '' e ⊆ D.ins C := by + intro e he + have heE : e ∈ Γ.E := hAB.right_le.edgeSet_subset he + refine hcov e heE fun f hf s hs hfs ↦ disjoint_iff_inter_eq_empty.mpr ?_ + by_contra hne + have hsZ : s ∉ Z := fun h ↦ by + rcases edge_cases hAB heE with ⟨-, h'⟩ | ⟨h', -⟩ + · exact h' he + · exact h' ((hcol hf hs hfs).mp h) + exact hno s₀ hcase s ⟨hs, hsZ⟩ hm₀ (nonempty_iff_ne_empty.mpr hne) + have : Nonempty (Drawing Shat) := ⟨N⟩ + choose! C hC₁ hC₂ hC₃ using hBc + have hspec : ∀ e ∈ B.edgeSet, IsInsOf D.rad D.ord D.𝒯 (C e) (D.ins (C e)) := fun e he ↦ + D.ins_spec ⟨(hC₂ e he).trans hN, hC₁ e he⟩ (hshort _ (hC₁ e he) (hC₂ e he)) + have hpre := IsTangle.isPretangle D.isTangle + let p : Set S → Hypergraph S (Set S) × Hypergraph S (Set S) := fun e ↦ (Γ.restrict + (cap.emb ⁻¹' D.ins (C e)), Γ.restrict (cap.emb ⁻¹' closure (D.ins (C e))ᶜ)) + let L : List (Hypergraph S (Set S) × Hypergraph S (Set S)) := (A ∩ B, Γ.toHypergraph) :: + B.edgeSet_finite.toFinset.toList.map p + have hmemL : ∀ e ∈ B.edgeSet, p e ∈ L := fun e he ↦ List.mem_cons_of_mem _ + (List.mem_map.mpr ⟨e, by simpa using he, rfl⟩) + refine GM11.theorem_6_2_proof hpre hmem L ?_ ?_ ?_ ?_ + · intro q hq + rcases List.mem_cons.mp hq with rfl | hq + · have hrepLeOrd : D.rep ≤ D.ord := (tangleRep_spec D.rad D.ord D.𝒯).1 + exact mem_pretangle_inter hpre hAB (by omega) + · obtain ⟨e, he, rfl⟩ := List.mem_map.mp hq + exact (hspec e (by simpa using he)).2.2.2.2 + · intro q hq x hx + rcases List.mem_cons.mp hq with rfl | hq + · exact hx.1 + · obtain ⟨e, he, rfl⟩ := List.mem_map.mp hq + have he' : e ∈ B.edgeSet := by simpa using he + obtain ⟨⟨hxV, hxi⟩, -, hxo⟩ := hx + have hd := hspec e he' + have hfr : frontier (D.ins (C e)) = (C e).U := by + rw [IsClosedDisc.frontier_eq_discBd hT hd.2.2.1, hd.2.2.2.1] + have hxf : cap.emb x ∈ frontier (D.ins (C e)) := by + rw [frontier_eq_closure_inter_closure] + exact ⟨subset_closure hxi, hxo⟩ + rw [hfr] at hxf + exact hmid x hxV ((hC₂ e he').1 (mem_V_of_mem_U_sub ((hC₂ e he').trans hN) hxf + (rad.isPreRadial.2.1 (mem_image_of_mem _ hxV)))) + · intro v hv + by_cases hva : v ∈ A.vertexSet + · exact ⟨_, List.mem_cons_self .., ⟨hva, hv⟩⟩ + have hvΓ : v ∈ Γ.V := hAB.right_le.vertexSet_subset hv + obtain ⟨c, hc, hvc⟩ := exists_edge_incident hS h3 rad hvΓ + have hvt : v ∈ tilde c := ⟨hvc, fun h ↦ Γ.disjoint_V hc h hvΓ⟩ + have hcB : c ∈ B.edgeSet := by + rcases edge_cases hAB hc with ⟨h, -⟩ | ⟨-, h⟩ + · exact absurd (hincX hAB.left_le h hvΓ hvt) hva + · exact h + refine ⟨_, hmemL c hcB, hvΓ, ?_⟩ + have hcl : IsClosed (D.ins (C c)) := (hspec c hcB).2.2.1.isClosed + exact hcl.closure_subset_iff.mpr (hC₃ c hcB) (((cap.isClosedEmbedding hS).closure_image_eq c) + ▸ mem_image_of_mem _ hvc) + · intro e he + have heE : e ∈ Γ.E := hAB.right_le.edgeSet_subset he + refine ⟨_, hmemL e he, heE, fun x hx ↦ hC₃ e he (mem_image_of_mem _ hx), ?_⟩ + rintro x ⟨hxt, -⟩ + have hcl : IsClosed (D.ins (C e)) := (hspec e he).2.2.1.isClosed + exact hcl.closure_subset_iff.mpr (hC₃ e he) (((cap.isClosedEmbedding hS).closure_image_eq e) + ▸ mem_image_of_mem _ hxt.1) + · intro e he + have heE : e ∈ Γ.E := hAB.left_le.edgeSet_subset he + refine hcov e heE fun f hf s hs hfs ↦ disjoint_iff_inter_eq_empty.mpr ?_ + by_contra hne + exact hno s ((hcol hf hs hfs).mpr he) s₀ ⟨hs₀, hcase⟩ (nonempty_iff_ne_empty.mpr hne) hm₀ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15g.lean b/LeanPool/GraphMinor/GM19/Section15g.lean new file mode 100644 index 0000000000..d7dcfd3d82 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15g.lean @@ -0,0 +1,180 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section15f +public import LeanPool.GraphMinor.GM19.SkeletonTangle +public import LeanPool.GraphMinor.GM17.Bridge + +/-! +# Graph Minors XIX, (15.2): the tangle in `sk(Γ)` + +The proof of (15.2) passes from `𝒯` to a tangle `𝒯'` in `sk(Γ)` by (14.1) of Graph Minors XVII. The +paper's `sk(Γ)` has an edge +between any two ends of an edge of `Γ`, and we check this for the boundary of a disc +(`exists_skEdge_of_mem_tilde`). The result used +later is `TangleDatum.isTangle_skTangle`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 GraphMinor.GM17 Hypergraph + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +/-- A circuit with three vertices has an edge between any two of them. -/ +theorem exists_edge_of_three_vertices {T : Type} [TopologicalSpace T] {C : Drawing T} + (hC : C.IsCircuit) (h3 : C.V.ncard = 3) {x y : T} (hx : x ∈ C.V) (hy : y ∈ C.V) (hxy : x ≠ y) : + ∃ e ∈ C.E, x ∈ closure e ∧ y ∈ closure e := by + classical + obtain ⟨u, W, ⟨hnd, hed⟩, hpos, hV, hE⟩ := hC + have hlink : ∀ {e a b}, C.toGraph.IsLink e a b → e ∈ {e | e ∈ W.edges} → ∃ e ∈ C.E, a ∈ closure e + ∧ b ∈ closure e := fun {e a b} h he ↦ by + have hc := h.2.2.2 + have ha : a ∈ closure e ∩ C.V := hc ▸ mem_insert a _ + have hb : b ∈ closure e ∩ C.V := hc ▸ mem_insert_of_mem a rfl + exact ⟨e, hE ▸ he, ha.1, hb.1⟩ + cases W with + | nil hv => simp [GraphWalk.length, GraphWalk.edges] at hpos + | @cons _ a _ e₁ h₁ r₁ => + cases r₁ with + | nil hv => + have : C.V = {u} := by + rw [hV] + ext z + simp [GraphWalk.support] + rw [this, ncard_singleton] at h3 + omega + | @cons _ b _ e₂ h₂ r₂ => + cases r₂ with + | nil hv => + have hsub : C.V ⊆ {u, a} := by + rw [hV] + intro z hz + have hz' : z = u ∨ z = a ∨ z = u := by simpa [GraphWalk.support] using hz + rcases hz' with rfl | rfl | rfl <;> simp + have := ncard_le_ncard hsub ((finite_singleton a).insert u) + have h2 := ncard_insert_le u ({a} : Set T) + rw [ncard_singleton] at h2 + omega + | @cons _ c _ e₃ h₃ r₃ => + cases r₃ with + | nil hv => + have hmem : ∀ z ∈ C.V, z = u ∨ z = a ∨ z = b := fun z hz ↦ by + rw [hV] at hz + have hz' : z = u ∨ z = a ∨ z = b ∨ z = u := by simpa [GraphWalk.support] using hz + rcases hz' with rfl | rfl | rfl | rfl <;> simp + have l₁ := hlink h₁ (by simp [GraphWalk.edges]) + have l₂ := hlink h₂ (by simp [GraphWalk.edges]) + have l₃ := hlink h₃ (by simp [GraphWalk.edges]) + have sw : ∀ {p q : T}, (∃ e ∈ C.E, p ∈ closure e ∧ q ∈ closure e) + → ∃ e ∈ C.E, q ∈ closure e ∧ p ∈ closure e := fun ⟨e, he, h, h'⟩ ↦ ⟨e, he, h', h⟩ + rcases hmem x hx with rfl | rfl | rfl <;> rcases hmem y hy with rfl | rfl | rfl + · exact absurd rfl hxy + · exact l₁ + · exact sw l₃ + · exact sw l₁ + · exact absurd rfl hxy + · exact l₂ + · exact l₃ + · exact sw l₂ + · exact absurd rfl hxy + | @cons _ d _ e₄ h₄ r₄ => + exfalso + have hne : ∃ d' rest, GraphWalk.support r₄ = d' :: rest := by + cases r₄ <;> exact ⟨_, _, rfl⟩ + obtain ⟨d', rest, hr⟩ := hne + have hnd' : [a, b, c, d'].Nodup := by + have : (a :: b :: c :: d' :: rest).Nodup := by simpa [GraphWalk.support, hr] using hnd + exact this.sublist (by simp) + have hsub : (([a, b, c, d'].toFinset : Finset T) : Set T) ⊆ C.V := by + rw [hV] + intro z hz + have hz' : z = a ∨ z = b ∨ z = c ∨ z = d' := by simpa using hz + have : z ∈ a :: b :: c :: d' :: rest := by + rcases hz' with rfl | rfl | rfl | rfl <;> simp + simpa [GraphWalk.support, hr] using Or.inr this + have := ncard_le_ncard hsub (Set.finite_of_ncard_ne_zero (by omega)) + rw [ncard_coe_finset, List.toFinset_card_of_nodup hnd'] at this + simp at this + omega + +/-- Two ends of an edge of size 3 are joined by an edge of `sk(Γ)` on the boundary of the disc. -/ +theorem Painting.exists_skEdge_of_mem_tilde [ConnectedSpace S] (Γ : Painting S) {c : Set S} + (hc : c ∈ Γ.E) {x y : S} (hx : x ∈ tilde c) (hy : y ∈ tilde c) (hxy : x ≠ y) : + ∃ f ∈ arcComponentsIn (Γ.skU \ Γ.V), x ∈ closure f ∧ y ∈ closure f := by + rcases Γ.size_cases hc with h2 | h3 + · exact ⟨c, Γ.two_mem_sk hc h2, hx.1, hy.1⟩ + obtain ⟨hD, hbd, hfin⟩ := Γ.isDisc_of_three hc h3 + obtain ⟨D₀, hU, hV⟩ := Γ.exists_skDrawing + have hsub : discBd (closure c) ⊆ D₀.U := fun z hz ↦ by + rw [hU] + exact Or.inr (mem_iUnion₂.mpr ⟨c, ⟨hc, h3⟩, hz⟩) + obtain ⟨C, hC, hCs, hCU⟩ := exists_circuit_of_oArc hD.isOArc_discBd hsub + have hmem : ∀ z ∈ tilde c, z ∈ C.V := fun z hz ↦ + mem_V_of_mem_U_sub hCs (hCU ▸ hbd hz) (hV ▸ Γ.tilde_subset_V hc hz) + have hCV : C.V = tilde c := by + refine Subset.antisymm (fun z hz ↦ ?_) hmem + have hzF : z ∈ discBd (closure c) := hCU ▸ C.V_subset_U hz + have hzV : z ∈ Γ.V := hV ▸ hCs.1 hz + exact ⟨Surface.discBd_subset _ hzF, fun h ↦ Γ.disjoint_V hc h hzV⟩ + obtain ⟨e, he, hxe, hye⟩ := + exists_edge_of_three_vertices hC (by rwa [hCV]) (hmem x hx) (hmem y hy) hxy + have he' : e ∈ D₀.E := hCs.2 he + refine ⟨e, ?_, hxe, hye⟩ + rw [← hU, ← hV] + exact he' + +omit [T2Space Shat] in +/-- The adjacency of the skeleton of `Γ` is witnessed by an edge of `sk(Γ)` in `Σ̂`. -/ +theorem IsSkHat.exists_edge_of_adj [ConnectedSpace S] (hS : IsSurface S) {Γ : Painting S} {H : + Drawing Shat} (h : IsSkHat cap Γ H) (x y : S) (hadj : Γ.toHypergraph.skeleton.Adj x y) : + ∃ f ∈ H.toHypergraph.edgeSet, H.toHypergraph.Inc f (cap.emb x) ∧ H.toHypergraph.Inc f + (cap.emb y) := by + obtain ⟨hne, e, hx, hy⟩ := hadj + obtain ⟨he, hxV, hxt⟩ := hx + obtain ⟨-, hyV, hyt⟩ := hy + obtain ⟨f, hf, hxf, hyf⟩ := Γ.exists_skEdge_of_mem_tilde he hxt hyt hne + have hg : cap.emb '' f ∈ H.E := h.edge_iff.mpr ⟨f, hf, rfl⟩ + have hcl : closure (cap.emb '' f) = cap.emb '' closure f := ((cap.isClosedEmbedding + hS).closure_image_eq f).symm ▸ rfl + refine ⟨_, hg, ⟨hg, ?_, ?_⟩, hg, ?_, ?_⟩ + · rw [h.hV] + exact mem_image_of_mem _ hxV + · rw [hcl] + exact mem_image_of_mem _ hxf + · rw [h.hV] + exact mem_image_of_mem _ hyV + · rw [hcl] + exact mem_image_of_mem _ hyf + +namespace TangleDatum + +/-- The tangle `𝒯'` of the proof of (15.2), with separations of order `< m`. -/ +def skTangle (D : TangleDatum cap χ) (H : Drawing Shat) (m : ℕ) : Set (Hypergraph Shat + (Set Shat) × Hypergraph Shat (Set Shat)) := + skeletonTangle cap.emb H.toHypergraph D.𝒯 m + +omit [T2Space Shat] in +/-- **`𝒯'` is a tangle in `sk(Γ)`**, by (14.1) of Graph Minors XVII. -/ +theorem isTangle_skTangle (D : TangleDatum cap χ) {H : Drawing Shat} (hH : IsSkHat cap D.P.Γ H) {m + : ℕ} (hm : 1 ≤ m) (h3 : 3 * m < 2 * D.ord + 3) : IsTangle H.toHypergraph m (D.skTangle H m) := by + have : ConnectedSpace S := χ.connected + refine isTangle_skeletonTangle cap.isEmbedding.injective hH.hV (hH.exists_edge_of_adj + χ.isSurface) (fun q hq ↦ D.isTangle.isSeparation hq) ?_ + exact gm17Theorem141 S (Set S) D.P.Γ.toHypergraph D.ord m D.𝒯 hm h3 D.isTangle + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15h.lean b/LeanPool/GraphMinor/GM19/Section15h.lean new file mode 100644 index 0000000000..1e5f830565 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15h.lean @@ -0,0 +1,444 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section15g +public import LeanPool.GraphMinor.GM19.CellFlat +public import LeanPool.GraphMinor.GM16.SphereRespectful +public import LeanPool.GraphMinor.GM11.Section64b +public import LeanPool.GraphMinor.GM11.Theorem61 +public import LeanPool.GraphMinor.GM19.Section12c +public import LeanPool.GraphMinor.Surface.EdgeLens + +/-! +# Graph Minors XIX, (15.2): the tangle on the skeleton is respectful + +The proof of (15.2) applies (3.2) of Graph Minors XII to the tangle `𝒯'` in `sk(Γ)`, drawn in `Σ̂`. +That theorem asks for a +respectful tangle. The paper writes "`rep(𝒯') = n + 1`", without saying more. Here is the proof. + +The argument of (6.4) of Graph Minors XI shows that the regions of `Γ` and small open sets around a +few vertices form a flat set. +The regions of `sk(Γ)` include the cells of the disc edges of `Γ`. Two corners `a, b` of a cell lie +on a side of the cell, and the +side lies on the boundary of a region of `Γ`. So a path in the cell from `a` to `b` is homotopic to +a path in that region +(`exists_class_beside_edge`), and we may add the cells to the flat set +(`TangleDatum.exists_flat_skeleton`). + +Now a `sk(Γ)`-normal `O`-arc `F` with few vertices is in a flat set, so it bounds a closed disc `Δ`. +If the tangle lies on the +wrong side, then the rest of the surface lies in the insides of short circuits, and (7.5) of Graph +Minors XI gives a contradiction. +The result used later is `TangleDatum.isRespectful_skTangle`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 GraphMinor.GM16 Hypergraph + +universe w + +/-- A line has a path along it. -/ +theorem IsLineWithEnds.exists_path {T : Type} [TopologicalSpace T] {L : Set T} {u v : T} + (h : IsLineWithEnds L u v) : + ∃ p : Path u v, ∀ t, p t ∈ L := by + obtain ⟨f, h0, h1⟩ := h + exact ⟨⟨⟨fun t => (f t).1, continuous_subtype_val.comp f.continuous⟩, h0, h1⟩, fun t => (f t).2⟩ + +/-- **A path beside an edge.** If an edge of a drawing lies on the boundary of a region, then the +line of the edge is homotopic to +a path through the region. -/ +theorem exists_class_beside_edge {T : Type} [TopologicalSpace T] [T2Space T] + (hT : IsClosedSurface T) (G : Drawing T) {e r : Set T} {a b : T} (he : e ∈ G.E) + (hL : IsLineWithEnds (closure e) a b) (hab : a ≠ b) (hV : closure e ∩ G.V = {a, b}) + (hr : r ∈ G.R) (her : e ⊆ closure r) : + ∃ g : Cl a b, Arw (r ∪ {a, b}) g ∧ ∀ q : Path a b, (∀ t, q t ∈ closure e) → Cl.mk q = g := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + have ha : a ∈ closure e ∩ G.V := hV ▸ .inl rfl + have hb : b ∈ closure e ∩ G.V := hV ▸ .inr rfl + let Z : Set T := G.V ∪ ⋃ f ∈ G.E \ {e}, closure f + have hZ : IsClosed Z := G.finite_V.isClosed.union ((G.finite_edges.subset + sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure) + have heV : Disjoint e G.V := disjoint_left.mpr fun x hx => (he.2.1 hx).2 + have hcl : closure e ⊆ e ∪ {a, b} := fun x hx => by + by_cases hxV : x ∈ G.V + · exact .inr (hV ▸ ⟨hx, hxV⟩) + · exact .inl ((G.closure_diff_V he).subset ⟨hx, hxV⟩) + have hLZ : closure e ∩ Z ⊆ {a, b} := by + rintro x ⟨hx, hxZ⟩ + rcases hxZ with hxV | hxf + · exact hV ▸ ⟨hx, hxV⟩ + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hxf + by_contra hn + have hxe : x ∈ e := (hcl hx).resolve_right hn + have hxV : x ∉ G.V := disjoint_left.mp heV hxe + have hxf' : x ∈ f := (G.closure_diff_V hf.1).subset ⟨hxf, hxV⟩ + exact hf.2 (G.edge_eq_of_mem hf.1 he hxf' hxe) + have hUZ : G.U ⊆ Z ∪ e := fun x hx => by + by_cases hxV : x ∈ G.V + · exact .inl (.inl hxV) + obtain ⟨f, hf, hxf⟩ := G.exists_edge_of_mem hx hxV + by_cases hfe : f = e + · exact .inr (hfe ▸ hxf) + · exact .inl (.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfe⟩, subset_closure hxf⟩)) + obtain ⟨D, A, B, hD, hLD, hDZ, -, -, hbL, hDe, hAc, hBc, -, -, hAL, hBL, -, -, ⟨p, -, hp₀⟩, q, -, + hq₀⟩ := exists_edge_lens hT hL hab hZ hLZ + have hends : ∀ {X : Set T} (p : Path a b), (∀ t : unitInterval, 0 < t → t < 1 → p t ∈ X) + → ∀ t, p t ∈ X ∪ {a, b} := fun {X} p h t => by + by_cases h₀ : t = 0 + · exact .inr (.inl (by rw [h₀, p.source])) + by_cases h₁ : t = 1 + · exact .inr (.inr (mem_singleton_iff.mpr (by rw [h₁, p.target]))) + exact .inl (h t (unitInterval.pos_iff_ne_zero.mpr h₀) (unitInterval.lt_one_iff_ne_one.mpr h₁)) + have hp := hends p hp₀ + have hq := hends q hq₀ + have hoff : ∀ X : Set T, X ⊆ D → Disjoint X (closure e) → Disjoint X G.U := fun X hXD hX + => disjoint_left.mpr fun x hx hxU => by + rcases hUZ hxU with hxZ | hxe + · rcases hDZ ⟨hXD hx, hxZ⟩ with rfl | rfl + · exact disjoint_left.mp hX hx ha.1 + · exact disjoint_left.mp hX hx hb.1 + · exact disjoint_left.mp hX hx (subset_closure hxe) + have hAD : A ⊆ D := hDe ▸ fun x hx => .inl (.inl hx) + have hBD : B ⊆ D := hDe ▸ fun x hx => .inl (.inr hx) + have hfl : Flat D := IsSimplyConnectedSet.flat (IsClosedDisc.isSimplyConnectedSet hD) + have hfin : ∀ X : Set T, X ⊆ D → X ⊆ r → ∀ p : Path a b, (∀ t, p t ∈ X ∪ {a, b}) → + ∃ g : Cl a b, Arw (r ∪ {a, b}) g ∧ ∀ q : Path a b, (∀ t, q t ∈ closure e) → Cl.mk q = g := by + intro X hXD hXr p hp + refine ⟨Cl.mk p, Arw.of_path p fun t => ?_, fun q hq => ?_⟩ + · rcases hp t with h | h + · exact .inl (hXr h) + · exact .inr h + · refine hfl.eq (Arw.of_path q fun t => hLD (hq t)) (Arw.of_path p fun t => ?_) + rcases hp t with h | h | h + · exact hXD h + · rw [h] + exact hLD ha.1 + · rw [h] + exact hLD hb.1 + obtain ⟨x₀, hx₀⟩ := he.1 + have hx₀int : x₀ ∈ discInt D := by + refine ⟨hLD (subset_closure hx₀), fun hbd => ?_⟩ + rcases hbL ⟨hbd, subset_closure hx₀⟩ with rfl | rfl + · exact disjoint_left.mp heV hx₀ ha.2 + · exact disjoint_left.mp heV hx₀ hb.2 + obtain ⟨y, hyD, hyr⟩ := mem_closure_iff.mp (her hx₀) _ (hD.isOpen_discInt hman) hx₀int + have hyU : y ∉ G.U := region_subset hr hyr + have hyD' : y ∈ A ∪ B ∪ closure e := hDe ▸ hyD.1 + rcases hyD' with (hyA | hyB) | hyL + · exact hfin A hAD (subset_region hr hAc (hoff A hAD hAL) hyA hyr) p hp + · exact hfin B hBD (subset_region hr hBc (hoff B hBD hBL) hyB hyr) q hq + · exact absurd (G.closure_subset_U he hyL) hyU + +/-- **Claim (2) of (6.4)** of Graph Minors XI (pages 90–91), from a flat set. -/ +theorem exists_oArc_of_flat {T : Type} [TopologicalSpace T] [ConnectedSpace T] + (hS : IsClosedSurface T) (hns : ¬ IsSphere T) (Γ : Drawing T) {A B : Hypergraph T (Set T)} + (hsep : Γ.toHypergraph.IsSeparation A B) + (hflat : ∃ D : T → Set T, (∀ s ∈ (A ∩ B).vertexSet, IsOpen (D s)) ∧ (∀ s ∈ + (A ∩ B).vertexSet, s ∈ D s) ∧ + Flat ((⋃ r ∈ Γ.R, r) ∪ ⋃ s ∈ (A ∩ B).vertexSet, D s)) + (hA : ∀ F : Set T, F ⊆ PaintingOrDrawing.underlying A → IsOArc F → IsNullHomotopicOArc F) : + ∃ F : Set T, IsOArc F ∧ F ⊆ PaintingOrDrawing.underlying B \ PaintingOrDrawing.underlying A ∧ + ¬ IsNullHomotopicOArc F := + GM11.exists_oArc_of_flat_regions hS hns Γ hsep hflat hA + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +/-- The data that `RadialDrawing.exists_full` gives: `sk(Γ)` in `Σ̂`, and a radial drawing of it +that extends `Γ*`. -/ +structure TangleDatum.SkData (D : TangleDatum cap χ) (H G₃ : Drawing Shat) : Prop where + sk : IsSkHat cap D.P.Γ H + pre : PreRad (PaintingOrDrawing.drawing H) G₃ + max : RadMax (PaintingOrDrawing.drawing H) G₃ + sub : D.rad.G.IsSubdrawing G₃ + spoke : ∀ e ∈ G₃.E, ∀ r ∈ D.P.Γ.hatRegions cap, e ⊆ r → e ∈ D.rad.G.E + +/-- Two corners of a disc edge are joined by a class with a path in a region of `Γ` and a path in +the closed cell. -/ +theorem IsSkHat.exists_class_of_corners {Γ : Painting S} {H : Drawing Shat} (hH : IsSkHat cap Γ H) + (hS : IsSurface S) {c : Set S} (hc : c ∈ Γ.E) (h3 : (tilde c).ncard = 3) + {a b : S} (ha : a ∈ tilde c) (hb : b ∈ tilde c) (hab : a ≠ b) : + ∃ g : Cl (cap.emb a) (cap.emb b), Arw ((⋃ r ∈ Γ.hatRegions cap, r) ∪ {cap.emb a, cap.emb b}) g + ∧ Arw (cap.emb '' closure c) g := by + have hT := cap.isClosedSurface + obtain ⟨f, hf, haf, hbf⟩ := Γ.exists_side_between hc h3 ha hb hab + obtain ⟨r, hr, hfr⟩ := hH.exists_hatRegion_side hS hf h3 + have hfm := hf.mem + obtain ⟨u, w, huw, ht, htV, hline⟩ := Γ.sk_line hfm + have haV : a ∈ Γ.V := Γ.tilde_subset_V hc ha + have hbV : b ∈ Γ.V := Γ.tilde_subset_V hc hb + have hta : a ∈ tilde f := ⟨haf, fun h => (hfm.2.1 h).2 haV⟩ + have htb : b ∈ tilde f := ⟨hbf, fun h => (hfm.2.1 h).2 hbV⟩ + have hL : IsLineWithEnds (closure f) a b := by + rw [ht] at hta htb + rcases hta with rfl | rfl <;> rcases htb with rfl | rfl + · exact absurd rfl hab + · exact hline + · exact hline.symm + · exact absurd rfl hab + have hcle : closure (cap.emb '' f) = cap.emb '' closure f := (cap.isClosedEmbedding + hS).closure_image_eq f + have hL' : IsLineWithEnds (closure (cap.emb '' f)) (cap.emb a) (cap.emb b) + := hcle ▸ hL.map_of_embedding cap.isEmbedding + have hfE : cap.emb '' f ∈ H.E := hH.edge_iff.mpr ⟨f, hfm, rfl⟩ + have hV : closure (cap.emb '' f) ∩ H.V = {cap.emb a, cap.emb b} := by + rw [hcle, hH.hV] + ext z + constructor + · rintro ⟨⟨p, hp, rfl⟩, ⟨q, hq, hpq⟩⟩ + obtain rfl := cap.isEmbedding.injective hpq + have : q ∈ tilde f := ⟨hp, fun h => (hfm.2.1 h).2 hq⟩ + rw [ht] at this hta htb + rcases hta with rfl | rfl <;> rcases htb with rfl | rfl <;> + rcases this with rfl | rfl <;> simp_all + · rintro (rfl | rfl) + · exact ⟨mem_image_of_mem _ haf, mem_image_of_mem _ haV⟩ + · exact ⟨mem_image_of_mem _ hbf, mem_image_of_mem _ hbV⟩ + obtain ⟨g, hg, hq⟩ := exists_class_beside_edge hT H hfE hL' (cap.isEmbedding.injective.ne hab) hV + (hH.hatRegion_mem_R hr) hfr + obtain ⟨q, hq'⟩ := IsLineWithEnds.exists_path hL' + refine ⟨g, hg.mono (union_subset_union_left _ fun x hx => mem_iUnion₂.mpr ⟨r, hr, hx⟩), ?_⟩ + rw [← hq q hq'] + refine Arw.of_path q fun t => ?_ + have h₁ := hq' t + rw [hcle] at h₁ + refine image_mono (closure_minimal ?_ isClosed_closure) h₁ + rcases hf.2 with ⟨h2, -⟩ | ⟨-, hfb⟩ + · exact absurd h3 (by omega) + · exact (hfb.2.1).trans (sdiff_subset.trans ((Γ.isDisc_of_three hc h3).1.isClosed.closure_eq ▸ + Surface.discBd_subset _)) + +/-- **The regions of `sk(Γ)` and small open sets around a few vertices form a flat set.** -/ +theorem TangleDatum.exists_flat_skeleton (D : TangleDatum cap χ) {H G₃ : Drawing Shat} + (hd : D.SkData H G₃) {S₀ : Set Shat} (hS₀ : S₀ ⊆ H.V) (hord : S₀.ncard < D.rep) : + ∃ D' : Shat → Set Shat, (∀ s ∈ S₀, IsOpen (D' s)) ∧ (∀ s ∈ S₀, s ∈ D' s) ∧ Flat + ((⋃ r ∈ H.R, r) ∪ ⋃ s ∈ S₀, D' s) := by + classical + have hS := χ.isSurface + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + have h3 := D.P.fits.internally_three_connected + set Γ := D.P.Γ with hΓ + have hf : S₀.Finite := H.finite_V.subset hS₀ + have hE : H.E.Nonempty := hd.sk.E_nonempty h3.1 + have hrad : (PaintingOrDrawing.drawing H).IsRadialDrawing G₃ := ⟨hd.pre.1, hd.pre.2, hd.max⟩ + have hRH : Γ.hatRegions cap ⊆ H.R := fun r hr => hd.sk.hatRegion_mem_R hr + have hS₀G : S₀ ⊆ D.rad.G.V := fun s hs => by + have := hS₀ hs + rw [hd.sk.hV] at this + exact D.rad.isPreRadial.2.1 this + obtain ⟨D₀, hD₀o, hsD₀, hfl⟩ := exists_flat_regions_of_sub (Γ := H) (Γ' := G₃) (θ + := D.rep) hT hE hrad (by omega) hd.sub hRH hd.spoke + (fun r hr c hc hcV => by + obtain ⟨w, ⟨-, -⟩, huniq⟩ := hd.pre.2.2.2.1 r (hRH hr) + obtain ⟨w', ⟨hw'r, hw'V⟩, -⟩ := D.rad.isPreRadial.2.2.1 r hr + have e : c = w' := (huniq c ⟨hc, hcV⟩).trans (huniq w' ⟨hw'r, hd.sub.1 hw'V⟩).symm + exact e ▸ hw'V) + (fun C hC hCs hl => by + have hi := D.ins_spec ⟨hCs, hC⟩ hl + exact isNullHomotopicOArcIn_of_subset_disc (IsCircuit.isOArc_U hC) (subset_univ _) hi.2.2.1 + (hi.2.2.2.1 ▸ Surface.discBd_subset _)) + hS₀ hS₀G hf hord + let 𝒟 : Set (Set Shat) := (fun c => cap.emb '' closure c) '' {c ∈ Γ.E | (tilde c).ncard = 3} + have hdisc : ∀ c ∈ Γ.E, (tilde c).ncard = 3 → IsClosedDisc (cap.emb '' closure c) ∧ discBd + (cap.emb '' closure c) = cap.emb '' discBd (closure c) := fun c hc h3' => + isClosedDisc_image (Γ.isDisc_of_three hc h3').1 cap.isEmbedding + have hcellU : ∀ c ∈ Γ.E, (tilde c).ncard = 3 → discBd (cap.emb '' closure c) ⊆ H.U + := fun c hc h3' => by + rw [(hdisc c hc h3').2, hd.sk.hU] + exact image_mono fun w hw => Or.inr (mem_iUnion₂.mpr ⟨c, ⟨hc, h3'⟩, hw⟩) + have hcl : ∀ c ∈ Γ.E, ∀ x ∈ closure c, x ∉ Γ.V → x ∈ c := fun c hc x hx hxV => by + by_contra hn + exact hxV (Γ.tilde_subset_V hc ⟨hx, hn⟩) + have htilde : ∀ c ∈ Γ.E, ∀ x ∈ closure c, x ∈ Γ.V → x ∈ tilde c := fun c hc x hx hxV + => ⟨hx, fun h => Γ.disjoint_V hc h hxV⟩ + have hint_c : ∀ c ∈ Γ.E, (tilde c).ncard = 3 → discInt (cap.emb '' closure c) ⊆ cap.emb '' c + := fun c hc h3' => by + rintro _ ⟨⟨x, hx, rfl⟩, hxb⟩ + refine mem_image_of_mem _ (hcl c hc x hx fun hxV => hxb ?_) + rw [(hdisc c hc h3').2] + exact mem_image_of_mem _ ((Γ.isDisc_of_three hc h3').2.1 (htilde c hc x hx hxV)) + have hRopen : IsOpen (⋃ r ∈ Γ.hatRegions cap, r) := isOpen_biUnion fun r hr => region_isOpen + (hRH hr) + have hsame : ∀ c ∈ Γ.E, ∀ c' ∈ Γ.E, ∀ x, x ∈ c → x ∈ c' → c = c' := fun c hc c' hc' x hx hx' => by + exact arcComp_eq_of_mem hc hc' hx hx' + have key : ∃ D' : Shat → Set Shat, (∀ s ∈ S₀, IsOpen (D' s)) ∧ (∀ s ∈ S₀, s ∈ D' s) ∧ + Flat (((⋃ r ∈ Γ.hatRegions cap, r) ∪ ⋃ s ∈ S₀, D' s) ∪ ⋃ Δ ∈ 𝒟, discInt Δ) := by + refine exists_flat_with_cells (𝒟 := 𝒟) (V₀ := H.V) (S₀ := S₀) (R := ⋃ r ∈ Γ.hatRegions cap, + r) (D := D₀) hT + ((Γ.finite_edges.subset (sep_subset _ _)).image _) ?_ H.finite_V ?_ ?_ ?_ hRopen ?_ hD₀o hsD₀ + hfl ?_ + · rintro _ ⟨c, ⟨hc, h3'⟩, rfl⟩ + exact (hdisc c hc h3').1 + · rintro _ ⟨c, ⟨hc, -⟩, rfl⟩ _ ⟨c', ⟨hc', -⟩, rfl⟩ hne _ ⟨⟨x, hx, rfl⟩, ⟨y, hy, hxy⟩⟩ + obtain rfl := cap.isEmbedding.injective hxy + by_contra hn + have hxV : y ∉ Γ.V := fun h => hn (hd.sk.hV ▸ mem_image_of_mem _ h) + exact hne (by rw [hsame c hc c' hc' y (hcl c hc y hx hxV) (hcl c' hc' y hy hxV)]) + · rintro _ ⟨c, ⟨hc, h3₁⟩, rfl⟩ _ ⟨c', ⟨hc', h3₂⟩, rfl⟩ hne + refine disjoint_left.mpr fun x hx hx' => ?_ + obtain ⟨y, hy, rfl⟩ := hint_c c hc h3₁ hx + obtain ⟨y', hy', hyy⟩ := hint_c c' hc' h3₂ hx' + obtain rfl := cap.isEmbedding.injective hyy + exact hne (by rw [hsame c hc c' hc' y' hy hy']) + · rintro _ ⟨c, ⟨hc, h3'⟩, rfl⟩ s hs ⟨x, hx, rfl⟩ + have hxV : x ∈ Γ.V := by + have := hS₀ hs + rw [hd.sk.hV] at this + obtain ⟨y, hy, hyx⟩ := this + exact cap.isEmbedding.injective hyx ▸ hy + rw [(hdisc c hc h3').2] + exact mem_image_of_mem _ ((Γ.isDisc_of_three hc h3').2.1 (htilde c hc x hx hxV)) + · rintro _ ⟨c, ⟨hc, h3'⟩, rfl⟩ + refine disjoint_left.mpr fun x hx hxc => ?_ + obtain ⟨r, hr, hxr⟩ := mem_iUnion₂.mp hx + obtain ⟨y, hy, rfl⟩ := hint_c c hc h3' hxc + obtain ⟨z, hz, rfl⟩ := id hr + exact (connectedComponentIn_subset _ _ hxr) (mem_image_of_mem _ (hc.2.1 hy).1) + · rintro _ ⟨c, ⟨hc, h3'⟩, rfl⟩ a ha b hb ⟨a₀, ha₀, rfl⟩ ⟨b₀, hb₀, rfl⟩ hab + have hV : ∀ x, x ∈ closure c → cap.emb x ∈ S₀ → x ∈ Γ.V := fun x _ hx => by + have := hS₀ hx + rw [hd.sk.hV] at this + obtain ⟨y, hy, hyx⟩ := this + exact cap.isEmbedding.injective hyx ▸ hy + exact hd.sk.exists_class_of_corners hS hc h3' (htilde c hc a₀ ha₀ (hV a₀ ha₀ ha)) + (htilde c hc b₀ hb₀ (hV b₀ hb₀ hb)) fun h => hab (h ▸ rfl) + obtain ⟨D', hD'o, hsD', hfl'⟩ := key + refine ⟨D', hD'o, hsD', hfl'.mono (union_subset (iUnion₂_subset fun r hr => ?_) fun x hx => .inl + (.inr hx))⟩ + intro x hx + rcases hd.sk.region_cases hr with hh | ⟨c, hc, h3', hrc⟩ + · exact .inl (.inl (mem_iUnion₂.mpr ⟨r, hh, hx⟩)) + · refine .inr (mem_iUnion₂.mpr ⟨_, ⟨c, ⟨hc, h3'⟩, rfl⟩, hrc hx, fun hb => ?_⟩) + exact region_subset hr hx (hcellU c hc h3' hb) + +/-- **`𝒯'` is respectful.** The paper states this as `rep(𝒯') = n + 1` in the proof of (15.2) (page +383). See the module docstring. -/ +theorem TangleDatum.isRespectful_skTangle (D : TangleDatum cap χ) {H G₃ : Drawing Shat} + (hd : D.SkData H G₃) {m : ℕ} (hm : 1 ≤ m) (hmr : m ≤ D.rep) (h3m : 3 * m < 2 * D.ord + 3) : + (PaintingOrDrawing.drawing H).IsRespectful m (D.skTangle H m) := by + classical + have hS := χ.isSurface + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hTg := D.isTangle_skTangle hd.sk hm h3m + have hH := hd.sk + by_cases hsp : IsSphere Shat + · exact drawing_tangle_isRespectful_of_isSphere hT hsp H hTg + refine ⟨inferInstance, fun F hF hN hk => ?_⟩ + obtain ⟨D₀, -, hsD₀, hfl⟩ := D.exists_flat_skeleton hd (S₀ := F ∩ H.V) inter_subset_right + (hk.trans_le hmr) + have hFK : F ⊆ (⋃ r ∈ H.R, r) ∪ ⋃ s ∈ F ∩ H.V, D₀ s := fun x hx => by + by_cases hxU : x ∈ H.U + · have hxs : x ∈ F ∩ H.V := ⟨hx, hN ⟨hx, hxU⟩⟩ + exact .inr (mem_iUnion₂.mpr ⟨x, hxs, hsD₀ x hxs⟩) + · obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem hxU + exact .inl (mem_iUnion₂.mpr ⟨r, hr, hxr⟩) + have hb : bd Shat = ∅ := eq_empty_of_forall_notMem fun x hx => hx (hT.2.2 x) + obtain ⟨Δ, -, hΔ, hbF⟩ := + (epstein Shat univ F cap.isSurface inferInstance hF (subset_univ _) (by simp [hb])).1 + (null_of_flat hfl hF hFK) + have hfr : frontier Δ = F := (IsClosedDisc.frontier_eq_discBd hT hΔ).trans hbF + have hsub : subBd Δ = F := by rw [subBd_eq_frontier, hfr] + have hsep : H.toHypergraph.IsSeparation ((PaintingOrDrawing.drawing H).inter Δ) + ((PaintingOrDrawing.drawing H).interOutside Δ) := + isSeparation_inter (Γ := PaintingOrDrawing.drawing H) hΔ.isClosed (by rw [hfr]; exact hN) + have hsord : ((PaintingOrDrawing.drawing H).inter Δ ∩ (PaintingOrDrawing.drawing H).interOutside + Δ).vertexSet ⊆ F ∩ H.V := fun x hx => by + have := inter_outside_subset (Γ := PaintingOrDrawing.drawing H) hx + rwa [hfr] at this + have hordle : separationOrder ((PaintingOrDrawing.drawing H).inter Δ) + ((PaintingOrDrawing.drawing H).interOutside Δ) < m := + lt_of_le_of_lt (ncard_le_ncard hsord (H.finite_V.subset inter_subset_right)) hk + refine ⟨Δ, hΔ, hsub, ?_⟩ + rcases hTg.axiom1 hsep hordle with h | h + · exact h + exfalso + obtain ⟨-, -, q, hq, e₁, e₂⟩ := h + simp only at e₁ e₂ + set Ai := (PaintingOrDrawing.drawing H).inter Δ with hAi0 + set Bo := (PaintingOrDrawing.drawing H).interOutside Δ with hBo0 + have hinj := cap.isEmbedding.injective + have hqsep := D.isTangle.isSeparation (A := q.1) (B := q.2) hq + have hqord : separationOrder q.1 q.2 < D.rep := by + have e : cap.emb '' (q.1 ∩ q.2).vertexSet = (Ai ∩ Bo).vertexSet := by + change cap.emb '' (q.1.vertexSet ∩ q.2.vertexSet) = Ai.vertexSet ∩ Bo.vertexSet + rw [image_inter hinj, e₁, e₂, Set.inter_comm] + have h₁ : (q.1 ∩ q.2).vertexSet.ncard = (Ai ∩ Bo).vertexSet.ncard := by + rw [← e, ncard_image_of_injective _ hinj] + change (q.1 ∩ q.2).vertexSet.ncard < D.rep + rw [h₁] + exact hordle.trans_le hmr + obtain ⟨N, hNG, hshort, -, hcov⟩ := D.exists_inside_cover (A := q.1) (B := q.2) hq hqord + have hins : ∀ C : Drawing Shat, C.IsCircuit → C.IsSubdrawing N → IsInsOf D.rad D.ord D.𝒯 C + (D.ins C) := fun C hC hCs => + D.ins_spec ⟨hCs.trans hNG, hC⟩ (hshort C hC hCs) + obtain ⟨D₁, hD₁, hND₁⟩ := exists_disc_of_circuits hT N fun C hC hCs => by + have hi := hins C hC hCs + exact isNullHomotopicOArcIn_of_subset_disc (IsCircuit.isOArc_U hC) (subset_univ _) hi.2.2.1 + (hi.2.2.2.1 ▸ Surface.discBd_subset _) + have hcov' : ∀ e ∈ q.1.edgeSet, cap.emb '' e ⊆ D₁ := fun e he => by + obtain ⟨F', hF', hF's, hin⟩ := hcov e he + have hi := hins F' hF' hF's + exact hin.trans (disc_subset_of_bd hT hsp hi.2.2.1 hD₁ (by + rw [hi.2.2.2.1] + exact hF's.U_subset.trans hND₁)) + obtain ⟨F', hF', hF's, hnn⟩ := exists_oArc_of_flat hT hsp H hsep + (D.exists_flat_skeleton hd (fun x hx => hsep.left_le.vertexSet_subset hx.1) + (lt_of_lt_of_le hordle hmr)) + (fun F₂ hF₂ hO => by + refine isNullHomotopicOArcIn_of_subset_disc hO (subset_univ _) hΔ fun x hx => ?_ + rcases hF₂ hx with hxV | ⟨e, he, hxe⟩ + · exact hxV.2 + · exact he.2 hxe) + apply hnn + have hF'U : F' ⊆ H.U := fun x hx => by + rcases hF's hx |>.1 with hxV | ⟨e, he, hxe⟩ + · exact H.V_subset_U (hsep.right_le.vertexSet_subset hxV) + · exact (he.1.2.1 hxe).1 + obtain ⟨C, hC, hCs, hCU⟩ := exists_circuit_of_oArc hF' hF'U + refine isNullHomotopicOArcIn_of_subset_disc hF' (subset_univ _) hD₁ ?_ + refine oArc_subset_of_edges hF' hD₁.isClosed C.finite_V (E₀ := C.E) (fun e he => ?_) fun x hx + => ?_ + · obtain ⟨f₀, hf₀, rfl⟩ := hH.edge_iff.mp (hCs.2 he) + obtain ⟨u, w, -, ht, htV, -⟩ := D.P.Γ.sk_line hf₀ + have hu : u ∈ tilde f₀ := ht ▸ .inl rfl + have huV : u ∈ D.P.Γ.V := htV hu + have huF : cap.emb u ∈ F' := by + rw [← hCU] + refine C.closure_subset_U he ?_ + rw [(cap.isClosedEmbedding hS).closure_image_eq f₀] + exact mem_image_of_mem _ hu.1 + have huH : cap.emb u ∈ H.V := hH.hV ▸ mem_image_of_mem _ huV + have hnA : cap.emb u ∉ Ai.vertexSet := fun h => (hF's huF).2 (.inl h) + have hnB : u ∉ q.2.vertexSet := fun h => hnA (e₂ ▸ mem_image_of_mem _ h) + obtain ⟨c, hc, hf₀c, huc⟩ : ∃ c ∈ D.P.Γ.E, f₀ ⊆ c ∧ u ∈ tilde c := by + rcases D.P.Γ.sk_cases hf₀ with ⟨h₁, -⟩ | ⟨c, hc, -, h₁, -⟩ + · exact ⟨f₀, h₁, Subset.rfl, hu⟩ + · exact ⟨c, hc, h₁, closure_mono h₁ hu.1, fun h => D.P.Γ.disjoint_V hc h huV⟩ + rcases edge_cases hqsep hc with ⟨hcA, -⟩ | ⟨-, hcB⟩ + · exact (image_mono hf₀c).trans (hcov' c hcA) + · exfalso + apply hnB + have hinc : u ∈ q.2.ends c := by + rw [← hqsep.right_le.ends_eq c hcB] + exact ⟨hc, huV, huc⟩ + exact q.2.vertex_mem_of_inc hinc + · by_cases hxV : x ∈ C.V + · exact .inl hxV + · obtain ⟨e, he, hxe⟩ := C.exists_edge_of_mem (hCU ▸ hx) hxV + exact .inr ⟨e, he, hxe⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15i.lean b/LeanPool/GraphMinor/GM19/Section15i.lean new file mode 100644 index 0000000000..0cc2761f9d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15i.lean @@ -0,0 +1,589 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section15h +public import LeanPool.GraphMinor.GM19.Section12g +public import LeanPool.GraphMinor.GM12.Section4WalkMetric + +/-! +# Graph Minors XIX, (15.2): the metric of the tangle on the skeleton + +The proof of (15.2) applies (3.2) of Graph Minors XII to the tangle `𝒯'` in `sk(Γ)`. That theorem +asks that certain regions of +`sk(Γ)` are far apart in the metric of `𝒯'`. The proof of (15.2) gets from (1) that they are far +apart in the metric of `𝒯`. So we +compare the two metrics. + +A closed walk `W` of the radial drawing of `sk(Γ)` may pass through the centre of a cell, so it is +not a walk of `Γ*`. We do not +replace it by a walk of `Γ*`. Instead we give each vertex of the radial drawing an atom of `Γ` +(`SkData.exists_anchor`), and neighbours +get atoms at distance at most three. So all of `W` lies within `3|W|` of any one of its vertices. If +a region of `sk(Γ)` lies inside `W`, +then a separation of `𝒯` has its boundary on `W`, and `TangleDatum.exists_inside_cover` shows that +the region is close to `W`. +The result used later is `TangleDatum.dist_le_of_skMetric`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 GraphMinor.GM14 Hypergraph + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} {D : TangleDatum cap χ} {H G₃ + : Drawing Shat} + +/-- A tangle cannot hold both a separation and one with the same two vertex sets the other way +round. The two can differ only in edges +with all ends in the middle, so `(A ∪ A', B ∩ B')` is a separation of small order. It is not in `𝒯` +by the third axiom, and its reverse breaks +the second axiom. -/ +theorem not_mem_of_swapped_vertexSets {α β' : Type*} {G : Hypergraph α β'} {θ : ℕ} {T : Set + (Hypergraph α β' × Hypergraph α β')} (hT : IsTangle G θ T) {A B A' B' : Hypergraph α β'} + (h : (A, B) ∈ T) (h' : (A', B') ∈ T) (hA : A.vertexSet = B'.vertexSet) (hB : B.vertexSet + = A'.vertexSet) : False := by + have h₁ := hT.isSeparation h + have h₂ := hT.isSeparation h' + have hsep := h₁.union_inter h₂ + have hle : ((A ∪ A') ∩ (B ∩ B')).vertexSet ⊆ (A ∩ B).vertexSet := fun x hx => by + obtain ⟨-, hxB, hxB'⟩ := hx + exact ⟨hA ▸ hxB', hxB⟩ + have hord : separationOrder (A ∪ A') (B ∩ B') < θ := + lt_of_le_of_lt (ncard_le_ncard hle (A ∩ B).vertexSet_finite) (hT.order_lt h) + rcases hT.axiom1 hsep hord with h₃ | h₃ + · refine hT.axiom3 h₃ ?_ + rw [← h₁.vertexSet_union, hB] + rfl + · exact hT.axiom2 h h' h₃ hsep.union_eq + +namespace TangleDatum.SkData + +omit [T2Space Shat] in +omit [T2Space S] in +/-- A centre of a region of `Γ` in the radial drawing of `sk(Γ)` is a vertex of `Γ*`. -/ +theorem hub_mem (hd : D.SkData H G₃) {r : Set Shat} (hr : r ∈ D.P.Γ.hatRegions cap) {c : Shat} + (hc : c ∈ r) (hcV : c ∈ G₃.V) : c ∈ D.rad.G.V := by + have hrR := hd.sk.hatRegion_mem_R hr + obtain ⟨w, -, huniq⟩ := hd.pre.2.2.2.1 r hrR + obtain ⟨w', ⟨hw'r, hw'V⟩, -⟩ := D.rad.isPreRadial.2.2.1 r hr + have e : c = w' := (huniq c ⟨hc, hcV⟩).trans (huniq w' ⟨hw'r, hd.sub.1 hw'V⟩).symm + exact e ▸ hw'V + +/-- Each vertex of the radial drawing of `sk(Γ)` has an atom of `Γ`: itself if it is a vertex of +`Γ`, and the region or the edge of its +region otherwise. The atom is close to the corners of the region. -/ +theorem exists_anchor (hd : D.SkData H G₃) (hrep : 4 ≤ D.rep) {x : Shat} (hx : x ∈ G₃.V) : + ∃ α ∈ D.P.Γ.atoms cap, (∀ v ∈ D.P.Γ.V, x = cap.emb v → α = {x}) ∧ ∀ r ∈ H.R, x ∈ r + → ∀ v ∈ D.P.Γ.V, cap.emb v ∈ closure r → D.dist α {cap.emb v} ≤ 3 := by + classical + have hS := χ.isSurface + have hT := cap.isClosedSurface + have h3 := D.P.fits.internally_three_connected + by_cases hxH : x ∈ H.V + · have hxH' := hxH + rw [hd.sk.hV] at hxH' + obtain ⟨v, hv, rfl⟩ := hxH' + refine ⟨_, Or.inl (Or.inl ⟨v, hv, rfl⟩), fun _ _ _ => rfl, fun r hr hxr => ?_⟩ + exact absurd (H.V_subset_U hxH) (region_subset hr hxr) + obtain ⟨r, hr, hxr⟩ := hd.pre.2.2.2.2.1 x ⟨hx, hxH⟩ + have hrU : ∀ r' ∈ H.R, x ∈ r' → r' = r := fun r' hr' hxr' => by + obtain ⟨y, -, rfl⟩ := (mem_R_iff H).mp hr + obtain ⟨y', -, rfl⟩ := (mem_R_iff H).mp hr' + rw [connectedComponentIn_eq hxr, connectedComponentIn_eq hxr'] + have hne : ∀ v ∈ D.P.Γ.V, x ≠ cap.emb v := fun v hv h => hxH (hd.sk.hV ▸ h ▸ mem_image_of_mem _ + hv) + rcases hd.sk.region_cases hr with hh | ⟨c, hc, h3', hrc⟩ + · have hxG := hd.hub_mem hh hxr hx + have hxR : x ∈ D.rad.Rstar := ⟨hxG, fun h => hxH (hd.sk.hV ▸ h)⟩ + have hreg : D.rad.regionOf x = r := by + obtain ⟨y, hy, rfl⟩ := id hh + exact (connectedComponentIn_eq hxr).symm + refine ⟨r, Or.inr ?_, fun v hv h => absurd h (hne v hv), fun r' hr' hxr' v hv hcl => ?_⟩ + · exact hh + rw [hrU r' hr' hxr'] at hcl + obtain ⟨e, he, hcap⟩ := D.rad.exists_spoke hS (h3.hatRegions_isOpenDisc hS cap) h3.1 hxR hv + (hreg ▸ hcl) + have hvG : cap.emb v ∈ D.rad.G.V := D.rad.isPreRadial.2.1 (mem_image_of_mem _ hv) + have hl : D.rad.G.toGraph.IsLink e x (cap.emb v) := ⟨he, hxG, hvG, by rw [hcap, pair_comm]⟩ + have hlen : (GraphWalk.cons hl (GraphWalk.nil hvG)).length = 1 := by + simp [GraphWalk.length, GraphWalk.edges] + have h₁ := D.dist_atomOf_le_of_walk (GraphWalk.cons hl (GraphWalk.nil hvG)) (by omega) + have h₂ : D.rad.atomOf x = r := by + unfold RadialDrawing.atomOf + rw [ite_eq_right hxR.2, hreg] + have h₃ : D.rad.atomOf (cap.emb v) = {cap.emb v} := D.atomOf_emb hv + rw [h₂, h₃, hlen] at h₁ + omega + · refine ⟨cap.emb '' c, Or.inl (Or.inr ⟨c, hc, rfl⟩), fun v hv h => absurd h (hne v hv), + fun r' hr' hxr' v hv hcl => ?_⟩ + rw [hrU r' hr' hxr'] at hcl + have hcld : IsClosed (cap.emb '' closure c) := (cap.isClosedEmbedding χ.isSurface).isClosedMap + _ isClosed_closure + obtain ⟨y, hy, hyv⟩ := closure_minimal hrc hcld hcl + obtain rfl := cap.isEmbedding.injective hyv + have h₁ := D.edgeVertDist_self_le hrep hc ⟨hy, fun h => D.P.Γ.disjoint_V hc h hv⟩ hv + have h₃ : D.rad.atomOf (cap.emb y) = {cap.emb y} := D.atomOf_emb hv + unfold edgeVertDist at h₁ + rwa [h₃] at h₁ + +/-- A choice of atoms for the vertices of the radial drawing of `sk(Γ)`, with neighbours close. -/ +structure IsAnchors (D : TangleDatum cap χ) (H G₃ : Drawing Shat) (A : Shat → Set Shat) : Prop where + atom : ∀ x ∈ G₃.V, A x ∈ D.P.Γ.atoms cap + vertex : ∀ v ∈ D.P.Γ.V, A (cap.emb v) = {cap.emb v} + corner : ∀ r ∈ H.R, ∀ x ∈ r, x ∈ G₃.V → ∀ v ∈ D.P.Γ.V, cap.emb v ∈ closure r → D.dist + (A x) {cap.emb v} ≤ 3 + +theorem exists_isAnchors (hd : D.SkData H G₃) (hrep : 4 ≤ D.rep) : ∃ A, IsAnchors D H G₃ A := by + classical + have hex : ∀ x, x ∈ G₃.V → _ := fun x (hx : x ∈ G₃.V) => hd.exists_anchor hrep hx + choose! A hA₁ hA₂ hA₃ using hex + refine ⟨A, hA₁, fun v hv => ?_, fun r hr x hxr hx v hv hcl => hA₃ x hx r hr hxr v hv hcl⟩ + have hG : cap.emb v ∈ G₃.V := hd.sub.1 (D.rad.isPreRadial.2.1 (mem_image_of_mem _ hv)) + exact hA₂ _ hG v hv rfl + +omit [T2Space S] in +/-- Neighbours in the radial drawing of `sk(Γ)` have close atoms. -/ +theorem IsAnchors.step (hd : D.SkData H G₃) {A : Shat → Set Shat} (hA : IsAnchors D H G₃ A) {e : + Set Shat} {a b : Shat} (hl : G₃.toGraph.IsLink e a b) : + D.dist (A a) (A b) ≤ 3 := by + have hT := cap.isClosedSurface + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + obtain ⟨v, hv, w, ⟨hwG, hwH⟩, hcap⟩ := hd.pre.2.2.2.2.2.1 e hl.1 + have heq : ({a, b} : Set Shat) = {v, w} := hl.2.2.2.symm.trans hcap + obtain ⟨r, hr, hwr⟩ := hd.pre.2.2.2.2.1 w ⟨hwG, hwH⟩ + have hwc : w ∈ closure e := by + have : w ∈ closure e ∩ G₃.V := hcap ▸ .inr rfl + exact this.1 + have hvc : v ∈ closure e := by + have : v ∈ closure e ∩ G₃.V := hcap ▸ .inl rfl + exact this.1 + obtain ⟨y, hyr, hye⟩ := mem_closure_iff.mp hwc r (region_isOpen hr) hwr + have hdis : Disjoint e H.U := disjoint_left.mpr fun z hz hzU => by + have hzG : z ∈ G₃.U := (hl.1.2.1 hz).1 + have : z ∈ H.U ∩ G₃.U := ⟨hzU, hzG⟩ + rw [show H.U ∩ G₃.U = H.V from hd.pre.2.1] at this + exact (hl.1.2.1 hz).2 (hd.pre.2.2.1 this) + have her : e ⊆ r := subset_region hr hl.1.2.2.1.isConnected.isPreconnected hdis hye hyr + have hv' := hv + change v ∈ H.V at hv' + rw [hd.sk.hV] at hv' + obtain ⟨v₀, hv₀, rfl⟩ := hv' + have h₁ := hA.corner r hr w hwr hwG v₀ hv₀ (closure_mono her hvc) + rw [← hA.vertex v₀ hv₀] at h₁ + rcases Set.pair_eq_pair_iff.mp heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rwa [D.dist_comm] + · exact h₁ + +/-- All of a walk of the radial drawing of `sk(Γ)` is close to its start. -/ +theorem IsAnchors.dist_le_of_walk (hd : D.SkData H G₃) (hrep : 4 ≤ D.rep) {A : Shat → Set Shat} + (hA : IsAnchors D H G₃ A) {a b : Shat} (W : GraphWalk G₃.toGraph a b) : + ∀ x ∈ W.support, D.dist (A a) (A x) ≤ 3 * W.length := by + induction W with + | nil hv => + intro x hx + simp only [GraphWalk.support, List.mem_singleton] at hx + rw [hx, D.dist_self] + exact Nat.zero_le _ + | @cons u v w e hl rest ih => + intro x hx + simp only [GraphWalk.support, List.mem_cons] at hx + have hlen : (GraphWalk.cons hl rest).length = rest.length + 1 := by + simp [GraphWalk.length, GraphWalk.edges] + rw [hlen] + rcases hx with rfl | hx + · rw [D.dist_self] + exact Nat.zero_le _ + · have h₁ := D.dist_triangle hrep (a := A u) (c := A x) (hA.atom v hl.2.2.1) + have h₂ := hA.step hd hl + have h₃ := ih x hx + omega + +/-- The two atoms of two vertices of a closed walk are close. -/ +theorem IsAnchors.dist_le_of_closed_walk (hd : D.SkData H G₃) (hrep : 4 ≤ D.rep) {A : Shat + → Set Shat} (hA : IsAnchors D H G₃ A) {u : Shat} (W : GraphWalk G₃.toGraph u u) {x y : Shat} + (hx : x ∈ W.support) (hy : y ∈ W.support) : D.dist (A x) (A y) ≤ 6 * W.length := by + have h₁ := hA.dist_le_of_walk hd hrep W x hx + have h₂ := hA.dist_le_of_walk hd hrep W y hy + have h₃ := D.dist_triangle hrep (a := A x) (c := A y) (hA.atom u (W.mem_vertexSet_of_mem_support + W.start_mem_support)) + rw [D.dist_comm (A x) (A u)] at h₃ + omega + +omit [T2Space S] in +/-- A side of an edge lies in the closure of the edge. -/ +theorem _root_.GraphMinor.GM19.Painting.IsSkEdgeIn.subset_closure {Γ : Painting S} {f c : Set S} + (hf : Γ.IsSkEdgeIn f c) : f ⊆ closure c := by + rcases hf.2 with ⟨-, rfl⟩ | ⟨h3, hfb⟩ + · exact _root_.subset_closure + · exact hfb.2.1.trans (sdiff_subset.trans (Surface.discBd_subset _)) + +/-- **An atom on a region inside a walk is close to the walk.** Let `W` be a closed walk of the +radial drawing of `sk(Γ)` that has the +centre of a region inside it, and let `c` be an edge of `Γ` with a side on the boundary of the +region. If the region is off `W`, then +the separation of `𝒯'` at a circuit of `W` around it comes from a separation of `𝒯`, and +`TangleDatum.exists_inside_cover` applies. -/ +theorem exists_near_walk (hd : D.SkData H G₃) (hrep : 4 ≤ D.rep) {A : Shat → Set Shat} + (hA : IsAnchors D H G₃ A) {m : ℕ} (hmr : m ≤ D.rep) (hm : 1 ≤ m) (h3m : 3 * m < 2 * D.ord + 3) + {ins : Drawing Shat → Set Shat} (hins : IsDerivedSlope (PaintingOrDrawing.drawing H) G₃ m + (D.skTangle H m) ins) {u : Shat} (W : GraphWalk G₃.toGraph u u) (hl : W.length < 2 * m) + {r : Set Shat} (hr : r ∈ H.R) {h : Shat} (hh : h ∈ r) (hhV : h ∈ G₃.V) + (hin : h ∈ insWalk ins G₃ W) {f c : Set S} (hf : D.P.Γ.IsSkEdgeIn f c) + (hfr : cap.emb '' f ⊆ closure r) : + ∃ x ∈ W.support, D.dist (cap.emb '' c) (A x) ≤ W.length + 6 := by + classical + have hS := χ.isSurface + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hTg := D.isTangle_skTangle hd.sk hm h3m + have hsl : IsSlope G₃ (2 * m) ins := GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) + hT hTg.isPretangle hd.pre.2.1 hins + have hc := hf.1 + obtain ⟨p, q, -, ht, htV, -⟩ := D.P.Γ.sk_line hf.mem + have hp : p ∈ tilde f := ht ▸ .inl rfl + have hpV : p ∈ D.P.Γ.V := htV hp + have hpc : p ∈ tilde c := ⟨closure_minimal hf.subset_closure isClosed_closure hp.1, fun h' + => D.P.Γ.disjoint_V hc h' hpV⟩ + have hpr : cap.emb p ∈ closure r := closure_minimal hfr isClosed_closure (by + rw [(cap.isClosedEmbedding hS).closure_image_eq f] + exact mem_image_of_mem _ hp.1) + have hcp : D.dist (cap.emb '' c) {cap.emb p} ≤ 3 := by + have := D.edgeVertDist_self_le hrep hc hpc hpV + unfold edgeVertDist at this + rwa [D.atomOf_emb hpV] at this + have hsingle : ({cap.emb p} : Set Shat) ∈ D.P.Γ.atoms cap := Or.inl (Or.inl ⟨p, hpV, rfl⟩) + rcases hin with hU | hC + · have hsup : h ∈ W.support := by + have := mem_V_of_mem_U_sub (walkDrawing_isSubdrawing G₃ W) hU hhV + rwa [walkDrawing_V] at this + refine ⟨h, hsup, ?_⟩ + have h₁ := hA.corner r hr h hh hhV p hpV hpr + have h₂ := D.dist_triangle hrep (a := cap.emb '' c) (c := A h) hsingle + rw [D.dist_comm {cap.emb p} (A h)] at h₂ + omega + obtain ⟨C, ⟨hC, hCs⟩, hiC⟩ := mem_iUnion₂.mp hC + have hCG : C.IsSubdrawing G₃ := hCs.trans (walkDrawing_isSubdrawing G₃ W) + have hCU : C.U ⊆ (walkDrawing G₃ W).U := hCs.U_subset + by_cases hhU : h ∈ C.U + · have hsup : h ∈ W.support := by + have := mem_V_of_mem_U_sub (walkDrawing_isSubdrawing G₃ W) (hCU hhU) hhV + rwa [walkDrawing_V] at this + refine ⟨h, hsup, ?_⟩ + have h₁ := hA.corner r hr h hh hhV p hpV hpr + have h₂ := D.dist_triangle hrep (a := cap.emb '' c) (c := A h) hsingle + rw [D.dist_comm {cap.emb p} (A h)] at h₂ + omega + have hCE : C.E.ncard ≤ W.length := by + have hsub : C.E ⊆ {e | e ∈ W.edges} := by + have := hCs.2 + rwa [walkDrawing_E] at this + calc C.E.ncard ≤ {e | e ∈ W.edges}.ncard := ncard_le_ncard hsub (List.finite_toSet _) + _ ≤ W.edges.length := by + have e : {e | e ∈ W.edges} = (↑W.edges.toFinset : Set (Set Shat)) := by + ext x + simp + rw [e, ncard_coe_finset] + exact List.toFinset_card_le _ + have hCl : C.length < 2 * m := lt_of_le_of_lt hCE hl + have hdis : Disjoint r C.U := disjoint_region_U hT hd.pre.2 hr hh hhV hCG hhU + have hcl : closure r ⊆ ins C := closure_subset_ins hsl hC hCG hCl (region_isPreconnected hr) hh + hiC hdis + obtain ⟨hdisc, hsub, hmem⟩ := hins C hC hCG hCl + have hfr' : frontier (ins C) = C.U := by rw [← subBd_eq_frontier, hsub] + obtain ⟨-, -, q₀, hq, e₁, e₂⟩ := hmem + simp only at e₁ e₂ + have hinj := cap.isEmbedding.injective + have hqsep := D.isTangle.isSeparation (A := q₀.1) (B := q₀.2) hq + have hsep₀ : ∀ v, cap.emb v ∈ ((PaintingOrDrawing.drawing H).inter (ins C)).vertexSet + → cap.emb v ∈ ((PaintingOrDrawing.drawing H).interOutside (ins C)).vertexSet → cap.emb v ∈ C.V + := fun v h₁ h₂ => by + have := inter_outside_subset (Γ := PaintingOrDrawing.drawing H) (Δ := ins C) (x + := cap.emb v) ⟨h₁, h₂⟩ + rw [hfr'] at this + exact mem_V_of_mem_U_sub (Drawing.IsSubdrawing.refl C) this.1 (mem_V_of_mem_U_sub hCG this.1 + (hd.pre.2.2.1 this.2)) + have hcard := (GM12.circuit_length_eq_two_mul_ncard hd.pre.2 hC hCG).1 + have hsepV : ∀ v, v ∈ (q₀.1 ∩ q₀.2).vertexSet → cap.emb v ∈ C.V := fun v hv => + hsep₀ v (e₁ ▸ mem_image_of_mem _ hv.1) (e₂ ▸ mem_image_of_mem _ hv.2) + have hqVV : ∀ v, v ∈ (q₀.1 ∩ q₀.2).vertexSet → v ∈ D.P.Γ.V := fun v hv + => hqsep.left_le.vertexSet_subset hv.1 + have hord : (q₀.1 ∩ q₀.2).vertexSet.ncard ≤ (C.V ∩ H.V).ncard := by + rw [← ncard_image_of_injective _ hinj] + refine ncard_le_ncard ?_ (C.finite_V.subset inter_subset_left) + rintro _ ⟨v, hv, rfl⟩ + exact ⟨hsepV v hv, hd.sk.hV ▸ mem_image_of_mem _ (hqVV v hv)⟩ + have hordrep : separationOrder q₀.1 q₀.2 < D.rep := by + change (q₀.1 ∩ q₀.2).vertexSet.ncard < D.rep + change C.E.ncard = _ at hcard + omega + have hpA : p ∈ q₀.1.vertexSet := by + have : cap.emb p ∈ ((PaintingOrDrawing.drawing H).inter (ins C)).vertexSet + := ⟨(hd.sk.hV ▸ mem_image_of_mem _ hpV : cap.emb p ∈ H.V), hcl hpr⟩ + rw [← e₁] at this + obtain ⟨y, hy, hye⟩ := this + exact hinj hye ▸ hy + rcases edge_cases hqsep hc with ⟨hcA, -⟩ | ⟨-, hcB⟩ + · obtain ⟨N, hNG, hshort, hNV, hcov⟩ := D.exists_inside_cover (A := q₀.1) (B := q₀.2) hq hordrep + obtain ⟨F, hF, hFN, hin'⟩ := hcov c hcA + have hFG : F.IsSubdrawing D.rad.G := hFN.trans hNG + obtain ⟨hFc, ⟨y, hyF, hyH⟩⟩ := GM12.circuit_length_eq_two_mul_ncard hd.pre.2 hF + (hFG.trans hd.sub) + have hyH' := hyH + rw [hd.sk.hV] at hyH' + have hle : (F.V ∩ H.V).ncard ≤ (q₀.1 ∩ q₀.2).vertexSet.ncard := by + rw [← ncard_image_of_injective _ hinj] + refine ncard_le_ncard ?_ ((q₀.1 ∩ q₀.2).vertexSet_finite.image _) + rintro z ⟨hzF, hzH⟩ + rw [hd.sk.hV] at hzH + obtain ⟨z₀, hz₀, rfl⟩ := hzH + exact mem_image_of_mem _ (hNV z₀ hz₀ (hFN.1 hzF)) + obtain ⟨y₀, hy₀, rfl⟩ := hyH' + have hy₀q := hNV y₀ hy₀ (hFN.1 hyF) + have hyC := hsepV y₀ hy₀q + have hsup : cap.emb y₀ ∈ W.support := by + have := hCs.1 hyC + rwa [walkDrawing_V] at this + refine ⟨cap.emb y₀, hsup, ?_⟩ + rw [hA.vertex y₀ hy₀] + change F.E.ncard = _ at hFc + change C.E.ncard = _ at hcard + have hFlt : F.E.ncard < 2 * D.rep := hshort F hF hFN + obtain ⟨x, hx⟩ := hc.1 + have := D.dist_le_of_circuit (by omega) (F := F) ⟨hFG, hF⟩ hFlt (a := cap.emb '' c) (b + := {cap.emb y₀}) ⟨_, mem_image_of_mem _ hx, hin' (mem_image_of_mem _ hx)⟩ + ⟨_, rfl, D.U_subset_ins ⟨hFG, hF⟩ hFlt (F.V_subset_U hyF)⟩ + omega + · have hpB : p ∈ q₀.2.vertexSet := by + have h₁ : p ∈ D.P.Γ.toHypergraph.ends c := ⟨hc, hpV, hpc⟩ + rw [hqsep.right_le.ends_eq c hcB] at h₁ + exact q₀.2.vertex_mem_of_inc h₁ + have hsup : cap.emb p ∈ W.support := by + have := hCs.1 (hsepV p ⟨hpA, hpB⟩) + rwa [walkDrawing_V] at this + refine ⟨cap.emb p, hsup, ?_⟩ + rw [hA.vertex p hpV] + omega + +omit [T2Space Shat] in +/-- The atom of the radial drawing that corresponds to a region is its centre. -/ +theorem exists_hub_of_corresponding {r x' : Set Shat} (hr : r ∈ H.R) (hx : IsCorrespondingAtom H G₃ + r x') : ∃ v ∈ G₃.V ∩ r, x' = {v} := by + rcases hx.2.2 with ⟨v, hv, rfl, -⟩ | ⟨hE, -⟩ | ⟨-, v, hv, e⟩ + · exact absurd (H.V_subset_U hv) (region_subset hr rfl) + · obtain ⟨y, hy⟩ := hE.1 + exact absurd (hE.2.1 hy).1 (region_subset hr hy) + · exact ⟨v, hv, e⟩ + +/-- **Comparing the metrics.** If two regions of `sk(Γ)` are close in the metric of `𝒯'`, then edges +of `Γ` with sides on their boundaries +are close in the metric of `𝒯`. -/ +theorem dist_le_of_skMetric (hd : D.SkData H G₃) (hrep : 4 ≤ D.rep) {m : ℕ} (hmr : m ≤ D.rep) + (hm : 1 ≤ m) (h3m : 3 * m < 2 * D.ord + 3) + {ins : Drawing Shat → Set Shat} (hins : IsDerivedSlope (PaintingOrDrawing.drawing H) G₃ m + (D.skTangle H m) ins) {r₁ r₂ : Set Shat} (hr₁ : r₁ ∈ H.R) (hr₂ : r₂ ∈ H.R) (hne : r₁ ≠ r₂) + (hlt : GM14.tangleMetric H G₃ ins m r₁ r₂ < m) {f₁ c₁ f₂ c₂ : Set S} + (hf₁ : D.P.Γ.IsSkEdgeIn f₁ c₁) (hfr₁ : cap.emb '' f₁ ⊆ closure r₁) + (hf₂ : D.P.Γ.IsSkEdgeIn f₂ c₂) + (hfr₂ : cap.emb '' f₂ ⊆ closure r₂) : D.dist (cap.emb '' c₁) (cap.emb '' c₂) + ≤ 16 * GM14.tangleMetric H G₃ ins m r₁ r₂ + 12 := by + obtain ⟨A, hA⟩ := hd.exists_isAnchors hrep + rcases GM11.tangleMetric_cases hd.pre.2 hne (ins := ins) (θ := m) with h | ⟨-, hw⟩ + · omega + obtain ⟨u, W, x', y', hx, hy, hl, hlen, hxi, hyi⟩ := hw + obtain ⟨h₁, ⟨h₁V, h₁r⟩, rfl⟩ := exists_hub_of_corresponding hr₁ hx + obtain ⟨h₂, ⟨h₂V, h₂r⟩, rfl⟩ := exists_hub_of_corresponding hr₂ hy + obtain ⟨a, ha, hda⟩ := exists_near_walk hd hrep hA hmr hm h3m hins W hl hr₁ h₁r h₁V + (hxi rfl) hf₁ hfr₁ + obtain ⟨b, hb, hdb⟩ := exists_near_walk hd hrep hA hmr hm h3m hins W hl hr₂ h₂r h₂V + (hyi rfl) hf₂ hfr₂ + have hab := hA.dist_le_of_closed_walk hd hrep W ha hb + have h₃ := D.dist_triangle hrep (a := cap.emb '' c₁) (c := cap.emb '' c₂) (hA.atom a + (W.mem_vertexSet_of_mem_support ha)) + have h₄ := D.dist_triangle hrep (a := A a) (c := cap.emb '' c₂) (hA.atom b + (W.mem_vertexSet_of_mem_support hb)) + rw [D.dist_comm (A b) (cap.emb '' c₂)] at h₄ + omega + +omit [T2Space S] in +/-- **The slopes agree.** The slope `ins` of `𝒯'` and the slope `D.ins` of `𝒯` agree on short +circuits of `Γ*`. If not, the surface is a sphere and they +give two opposite discs. That gives two separations of `𝒯` with the same vertex sets the other way +round. -/ +theorem ins_eq_of_derived (hd : D.SkData H G₃) {m : ℕ} (hmr : m ≤ D.rep) + {ins : Drawing Shat → Set Shat} (hins : IsDerivedSlope (PaintingOrDrawing.drawing H) G₃ m + (D.skTangle H m) ins) {F : Drawing Shat} (hF : F.IsCircuitOf D.rad.G) + (hlt : F.E.ncard < 2 * m) : + ins F = D.ins F := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hinj := cap.isEmbedding.injective + have hi := D.ins_spec hF (by omega) + have hFG : F.IsSubdrawing G₃ := hF.1.trans hd.sub + obtain ⟨hdisc, hsub, hmem⟩ := hins F hF.2 hFG hlt + have hbd₁ : discBd (ins F) = F.U := by + rw [← GM11.IsClosedDisc.frontier_eq_discBd hT hdisc, ← subBd_eq_frontier, hsub] + have hbd₂ : discBd (D.ins F) = F.U := hi.2.2.2.1 + by_contra hne + have hsph : IsSphere Shat := by + by_contra hns + exact hne (eq_of_discBd_eq hT.isSurface hns hdisc hi.2.2.1 (hbd₁.trans hbd₂.symm)) + obtain ⟨Δ₁, Δ₂, -, -, -, -, -, hun, hcap, -, huniq⟩ := sphere_disc Shat hsph F.U + (IsCircuit.isOArc_U hF.2) + have hun' : ins F ∪ D.ins F = univ ∧ ins F ∩ D.ins F = F.U := by + rcases huniq _ hdisc hbd₁ with e₁ | e₁ <;> rcases huniq _ hi.2.2.1 hbd₂ with e₂ | e₂ + · exact absurd (e₁.trans e₂.symm) hne + · rw [e₁, e₂] + exact ⟨hun, hcap⟩ + · rw [e₁, e₂, Set.union_comm, Set.inter_comm] + exact ⟨hun, hcap⟩ + · exact absurd (e₁.trans e₂.symm) hne + obtain ⟨hU, hI⟩ := hun' + have hfr₁ : frontier (ins F) = F.U := by rw [← subBd_eq_frontier, hsub] + have hfr₂ : frontier (D.ins F) = F.U := by + rw [GM11.IsClosedDisc.frontier_eq_discBd hT hi.2.2.1, hbd₂] + have key : ∀ {X Y : Set Shat}, IsClosed Y → X ∪ Y = univ → X ∩ Y = F.U → frontier X = F.U + → ∀ z, z ∈ closure Xᶜ ↔ z ∈ Y := fun {X Y} hY hXY hXY' hfr z => by + refine ⟨fun h => closure_minimal (fun w hw => ?_) hY h, fun h => ?_⟩ + · exact (hXY.symm ▸ mem_univ w : w ∈ X ∪ Y).resolve_left hw + · by_cases hz : z ∈ X + · have : z ∈ frontier X := by rw [hfr, ← hXY']; exact ⟨hz, h⟩ + rw [closure_compl] + exact this.2 + · exact subset_closure hz + obtain ⟨-, -, q₀, hq, e₁, e₂⟩ := hmem + simp only at e₁ e₂ + have hcl : ∀ X : Set Shat, closure (univ \ X) = closure Xᶜ := fun X => by rw [compl_eq_univ_sdiff] + have hV₁ : q₀.1.vertexSet = (D.P.Γ.restrict (cap.emb ⁻¹' closure (D.ins F)ᶜ)).vertexSet := by + ext v + have hvi : v ∈ q₀.1.vertexSet ↔ cap.emb v ∈ cap.emb '' q₀.1.vertexSet := + (hinj.mem_set_image).symm + rw [hvi, e₁] + refine ⟨fun h => ?_, fun h => ?_⟩ + · have hvH : cap.emb v ∈ H.V := h.1 + rw [hd.sk.hV] at hvH + have hv : v ∈ D.P.Γ.V := hinj.mem_set_image.mp hvH + exact ⟨hv, (key hdisc.isClosed (by rwa [Set.union_comm]) (by rwa [Set.inter_comm]) hfr₂ + _).mpr h.2⟩ + · exact ⟨(hd.sk.hV ▸ mem_image_of_mem _ h.1 : cap.emb v ∈ H.V), + (key hdisc.isClosed (by rwa [Set.union_comm]) (by rwa [Set.inter_comm]) hfr₂ _).mp h.2⟩ + have hV₂ : q₀.2.vertexSet = (D.P.Γ.restrict (cap.emb ⁻¹' D.ins F)).vertexSet := by + ext v + have hvi : v ∈ q₀.2.vertexSet ↔ cap.emb v ∈ cap.emb '' q₀.2.vertexSet := + (hinj.mem_set_image).symm + rw [hvi, e₂] + refine ⟨fun h => ?_, fun h => ?_⟩ + · have hvH : cap.emb v ∈ H.V := h.1 + rw [hd.sk.hV] at hvH + have hv : v ∈ D.P.Γ.V := hinj.mem_set_image.mp hvH + refine ⟨hv, (key hi.2.2.1.isClosed hU hI hfr₁ _).mp ?_⟩ + have := h.2 + rwa [hcl] at this + · refine ⟨(hd.sk.hV ▸ mem_image_of_mem _ h.1 : cap.emb v ∈ H.V), ?_⟩ + rw [hcl] + exact (key hi.2.2.1.isClosed hU hI hfr₁ _).mpr h.2 + exact not_mem_of_swapped_vertexSets D.isTangle hi.2.2.2.2 hq hV₂.symm hV₁.symm + +/-- **The free sets of (15.2).** Let `X` be a small set of vertices of `sk(Γ)` on the closure of a +region. If a separation of `𝒯'` has `X` on its left and +has order less than `|X|`, then (15.1) gives a circuit of `Γ*` that holds the centre of the region +and more than half its length of `X`. +This is the step from (4) to (5) in the proof of (15.2), done without moving a circuit of the radial +drawing of `sk(Γ)`. -/ +theorem exists_circuit_of_not_free (hd : D.SkData H G₃) {m : ℕ} (hmr : m + ≤ D.rep) (hm : 1 ≤ m) (h3m : 3 * m < 2 * D.ord + 3) + {ins : Drawing Shat → Set Shat} (hins : IsDerivedSlope (PaintingOrDrawing.drawing H) G₃ m + (D.skTangle H m) ins) {r : Set Shat} (hr : r ∈ H.R) {w : Shat} (hw : w ∈ r) (hwV : w ∈ G₃.V) + {X : Set Shat} (hXV : X ⊆ H.V) (hXr : X ⊆ closure r) (hXm : X.ncard + ≤ m) {A' B' : Hypergraph Shat (Set Shat)} (hmem : (A', B') ∈ D.skTangle H m) + (hXA : X ⊆ A'.vertexSet) + (hord : separationOrder A' B' < X.ncard) : ∃ F : Drawing Shat, F.IsCircuitOf D.rad.G + ∧ F.E.ncard < 2 * m ∧ F.E.ncard < 2 * (X ∩ D.ins F).ncard ∧ w ∈ D.ins F := by + classical + have hS := χ.isSurface + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have h3 := D.P.fits.internally_three_connected + have hinj := cap.isEmbedding.injective + have hTg := D.isTangle_skTangle hd.sk hm h3m + have hsl : IsSlope G₃ (2 * m) ins := GM11.isSlope_of_derived (Γ := PaintingOrDrawing.drawing H) + hT hTg.isPretangle hd.pre.2.1 hins + obtain ⟨-, -, q₀, hq, e₁, e₂⟩ := hmem + simp only at e₁ e₂ + obtain ⟨A, B⟩ := q₀ + simp only at e₁ e₂ hq + have hsep := D.isTangle.isSeparation hq + set Z : Set Shat := cap.emb '' (A ∩ B).vertexSet with hZ + have hZe : Z = (A' ∩ B').vertexSet := by + change _ = A'.vertexSet ∩ B'.vertexSet + rw [← e₁, ← e₂, hZ] + exact image_inter hinj + have hordq : separationOrder A B < X.ncard := by + have : Z.ncard = separationOrder A B := ncard_image_of_injective _ hinj + change (A' ∩ B').vertexSet.ncard < _ at hord + rw [← hZe] at hord + omega + obtain ⟨N, hNG, -, hNV, hcov⟩ := D.exists_inside_cover hq (by omega) + have hZfin : Z.Finite := (A ∩ B).vertexSet_finite.image _ + have hGZ : ∀ v ∈ N.V, v ∈ H.V → v ∈ Z := fun v hv hvH => by + rw [hd.sk.hV] at hvH + obtain ⟨y, hy, rfl⟩ := hvH + exact mem_image_of_mem _ (hNV y hy hv) + have hZX : Z.ncard < X.ncard := by + rw [hZ, ncard_image_of_injective _ hinj] + exact hordq + have hshort : ∀ F : Drawing Shat, F.IsCircuit → F.IsSubdrawing N → F.E.ncard < 2 * m + := fun F hF hFN => by + have hFc := (GM12.circuit_length_eq_two_mul_ncard hd.pre.2 hF (hFN.trans (hNG.trans hd.sub))).1 + change F.E.ncard = _ at hFc + have : (F.V ∩ H.V).ncard ≤ Z.ncard := ncard_le_ncard (fun z hz => hGZ z (hFN.1 hz.1) hz.2) hZfin + omega + have hagree : ∀ F : Drawing Shat, F.IsCircuit → F.IsSubdrawing N → ins F = D.ins F + := fun F hF hFN => + hd.ins_eq_of_derived hmr hins ⟨hFN.trans hNG, hF⟩ (hshort F hF hFN) + have hcov' : ∀ x ∈ X, x ∉ Z → ∃ F : Drawing Shat, F.IsCircuit ∧ F.IsSubdrawing N ∧ x ∈ ins F + := fun x hx hxZ => by + have hxH := hXV hx + rw [hd.sk.hV] at hxH + obtain ⟨v, hv, rfl⟩ := hxH + have hvA : v ∈ A.vertexSet := by + have := hXA hx + rw [← e₁] at this + exact hinj.mem_set_image.mp this + have hvB : v ∉ B.vertexSet := fun h => hxZ (mem_image_of_mem _ ⟨hvA, h⟩) + obtain ⟨c, hc, hvc⟩ := exists_edge_incident hS h3 D.rad hv + have hvt : v ∈ tilde c := ⟨hvc, fun h => D.P.Γ.disjoint_V hc h hv⟩ + have hcA : c ∈ A.edgeSet := by + rcases edge_cases hsep hc with h | ⟨-, hcB⟩ + · exact h.1 + · have h₁ : v ∈ D.P.Γ.toHypergraph.ends c := ⟨hc, hv, hvt⟩ + rw [hsep.right_le.ends_eq c hcB] at h₁ + exact absurd (B.vertex_mem_of_inc h₁) hvB + obtain ⟨F, hF, hFN, hin⟩ := hcov c hcA + refine ⟨F, hF, hFN, ?_⟩ + rw [hagree F hF hFN] + have hcl : IsClosed (D.ins F) := + (D.ins_spec ⟨hFN.trans hNG, hF⟩ (by have := hshort F hF hFN; omega)).2.2.1.isClosed + have : cap.emb v ∈ closure (cap.emb '' c) := by + rw [(cap.isClosedEmbedding hS).closure_image_eq c] + exact mem_image_of_mem _ hvc + exact closure_minimal hin hcl this + obtain ⟨C, hC, hCN, hl, hlX, hwC⟩ := exists_circuit_of_confined_in hT hd.pre.2 hsl hr hw hwV hXV + hXr hXm (hNG.trans hd.sub) hZfin hGZ hZX hcov' + rw [hagree C hC hCN] at hlX hwC + exact ⟨C, ⟨hCN.trans hNG, hC⟩, hl, hlX, hwC⟩ + +end TangleDatum.SkData + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15j.lean b/LeanPool/GraphMinor/GM19/Section15j.lean new file mode 100644 index 0000000000..9927d37dfe --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15j.lean @@ -0,0 +1,490 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section15i +public import LeanPool.GraphMinor.GM19.Section11g +public import LeanPool.GraphMinor.GM19.Section5i +public import LeanPool.GraphMinor.GM19.FragmentForm +public import LeanPool.GraphMinor.GM19.FreeFrame + +/-! +# Graph Minors XIX, (15.2): bites and the border edges + +Step (4) of the proof of (15.2) says that no short circuit through a pole holds many of the ends of +the images of the border edges. We need to grow a bite so that it +holds a given border edge, as the paper does when it writes `l(β(e), s₁) ≤ ½|E(F)| + 2`. A border +edge lies in a bite of length at most six (`exists_bite_of_edge`), and two bites that share a +point of the cuff lie in one bite (`IsSideSetting.exists_bite_superset`). + +The paper shows that no `β(e)` lies in `ins(F)`, and then says that `N(r*) ∩ ins(F) = V(Φ) ∩ +ins(F)`. An end of `β(e)` may still lie on `F`. So we work with an edge that has an end in `ins(F)`, +and not with an edge that lies in +`ins(F)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 GraphMinor.GM14 Hypergraph + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} {D : TangleDatum cap χ} + +/-- A connected set in an `O`-arc that meets a line of the `O`-arc but misses its ends lies in the +line. -/ +theorem subset_line_of_isPreconnected {T : Type} [TopologicalSpace T] [T2Space T] {c L J : Set T} + {a b : T} (hc : IsOArc c) (hl : IsLineWithEnds L a b) (hLc : L ⊆ c) (hJ : IsPreconnected J) + (hJc : J ⊆ c) (ha : a ∉ J) (hb : b ∉ J) {y : T} (hy : y ∈ J) (hyL : y ∈ L) : J ⊆ L := by + classical + obtain ⟨f, h0, hpi, himg⟩ := exists_angle_of_line hc hl hLc + have hp := Real.pi_pos + by_contra hn + obtain ⟨z, hzJ, hzL⟩ := not_subset.mp hn + have hC₁ : IsClosed L := himg ▸ (isCompact_Icc.image (continuous_cuffAngle f)).isClosed + have hC₂ : IsClosed (cuffPoint f '' Icc Real.pi (2 * Real.pi)) := (isCompact_Icc.image + (continuous_cuffAngle f)).isClosed + have hcov : J ⊆ L ∪ cuffPoint f '' Icc Real.pi (2 * Real.pi) := fun w hw => by + obtain ⟨t, ht, rfl⟩ := exists_cuffAngle_eq f 0 (hJc hw) + by_cases h : t ≤ Real.pi + · exact .inl (himg ▸ ⟨t, ⟨ht.1, h⟩, rfl⟩) + · exact .inr ⟨t, ⟨(not_le.1 h).le, by linarith [ht.2]⟩, rfl⟩ + have hzC : z ∈ cuffPoint f '' Icc Real.pi (2 * Real.pi) := (hcov hzJ).resolve_left hzL + obtain ⟨w, hwJ, hw₁, hw₂⟩ := isPreconnected_closed_iff.mp hJ _ _ hC₁ hC₂ hcov ⟨y, hy, hyL⟩ ⟨z, + hzJ, hzC⟩ + rw [← himg] at hw₁ + obtain ⟨t₁, ht₁, rfl⟩ := hw₁ + obtain ⟨t₂, ht₂, he⟩ := hw₂ + by_cases h2 : t₂ = 2 * Real.pi + · have : cuffPoint f t₂ = a := by + rw [← h0, h2] + have := cuffAngle_add_two_pi f 0 + rwa [zero_add] at this + exact ha (by rw [← this, he]; exact hwJ) + · have ht₂' : t₂ ∈ Ico (0 : ℝ) (0 + 2 * Real.pi) := + ⟨by linarith [ht₂.1], by simpa only [zero_add] using lt_of_le_of_ne ht₂.2 h2⟩ + have e := cuffAngle_injOn f ht₂' ⟨ht₁.1, by linarith [ht₁.2]⟩ he + have : t₁ = Real.pi := le_antisymm ht₁.2 (by linarith [ht₂.1]) + exact hb (by rw [← hpi, ← this]; exact hwJ) + +namespace TangleDatum + +omit [T2Space S] [T2Space Shat] in +/-- A short bite that holds two border edges bounds their border distance. -/ +theorem borderEdgeDist_le_of_bite {r : Shat} {c₁ c₂ : Set S} {C : Drawing Shat} + (hC : D.IsBiteAt r C) (h₁ : cap.emb '' c₁ ⊆ D.ins C) (h₂ : cap.emb '' c₂ ⊆ D.ins C) : + D.borderEdgeDist r c₁ c₂ ≤ C.E.ncard / 2 := by + classical + have : ConnectedSpace Shat := cap.connected + unfold borderEdgeDist + rw [dite_eq_left ⟨C, hC, h₁, h₂⟩] + have e := D.ncard_E_eq_hat hC.is_circuit + exact Nat.sInf_le ⟨C, hC, h₁, h₂, by omega⟩ + +omit [T2Space S] [T2Space Shat] in +/-- The pole in the disc of a cuff is the one whose region is that disc. -/ +theorem pole_eq_of_mem_cuffDisc {r r' : Shat} (hr : r ∈ D.rad.poles) {Θ : Set S} + (hΘ : Θ ∈ cuffs S) (hreg : D.rad.regionOf r = cap.cuffDisc Θ) (hr' : r' ∈ D.rad.poles) + (hd : r' ∈ cap.cuffDisc Θ) : r' = r := by + obtain ⟨Θ', hΘ', hreg', hd'⟩ := D.rad.pole_cases hr' + have e : Θ' = Θ := by + by_contra hne + exact disjoint_left.mp (cap.cuffDisc_disjoint Θ' hΘ' Θ hΘ hne) (subset_closure hd') + (subset_closure hd) + subst e + have hm := D.rad.regionOf_mem hr.1 + have hm' := D.rad.regionOf_mem hr'.1 + obtain ⟨w, -, huniq⟩ := D.rad.isPreRadial.2.2.1 _ hm.1 + rw [hreg'] at hm' + rw [hreg] at huniq hm + exact (huniq r' ⟨hm'.2, hr'.1.1⟩).trans (huniq r ⟨hm.2, hr.1.1⟩).symm + +end TangleDatum + +namespace TangleDatum.IsSideSetting + +variable {side Θ : Set S} {r : Shat} {N : ℕ} (X : D.IsSideSetting side Θ r N) +include X + +/-- A bite can be replaced by one no longer, with a bigger inside and no vertex in the outer arc of +the cuff. -/ +theorem exists_tight_bite (hS : IsSurface S) {F : Drawing Shat} (hb : D.IsBiteAt r F) + (hc : F.E.ncard ≤ 2 * N) : + ∃ F', D.IsBiteAt r F' ∧ F'.E.ncard ≤ F.E.ncard ∧ D.ins F ⊆ D.ins F' + ∧ ∃ v₁ v₂ Β L A A' Di Do, D.IsBiteShape r Θ F' v₁ v₂ Β L A A' Di Do ∧ Disjoint F'.V A' := by + induction hk : F.E.ncard using Nat.strong_induction_on generalizing F with + | _ k ih => + obtain ⟨v₁, v₂, Β, L, A, A', Di, Do, hs⟩ := X.shape hS hb hc + by_cases hdis : Disjoint F.V A' + · exact ⟨F, hb, hk.le, Subset.rfl, v₁, v₂, Β, L, A, A', Di, Do, hs, hdis⟩ + obtain ⟨x, hxV, hxA⟩ := not_disjoint_iff.mp hdis + obtain ⟨F', hF', hlt, hsub, hr⟩ := X.exists_shorter hS hs hxV hxA + have hb' : D.IsBiteAt r F' := ⟨hb.pole_mem, hF', by have := hb.card_lt; omega, hr⟩ + obtain ⟨F'', h₁, h₂, h₃, h₄⟩ := ih F'.E.ncard (hk ▸ hlt) hb' (by omega) rfl + exact ⟨F'', h₁, by omega, hsub.trans h₃, h₄⟩ + +omit X in +omit [T2Space S] in +omit [T2Space Shat] in +/-- A point of a circuit of `Γ*` that lies on another circuit of `Γ*` gives a common vertex other +than `r`, if it is not `r`. -/ +theorem exists_common_vertex {F G : Drawing Shat} (hF : F.IsCircuitOf D.rad.G) + (hG : G.IsCircuitOf D.rad.G) {z : Shat} (hzF : z ∈ F.U) (hzG : z ∈ G.U) (hzr : z ≠ r) : + ∃ x ∈ F.V, x ∈ G.V ∧ x ≠ r := by + classical + by_cases hzV : z ∈ D.rad.G.V + · exact ⟨z, mem_V_of_mem_U_sub hF.1 hzF hzV, mem_V_of_mem_U_sub hG.1 hzG hzV, hzr⟩ + obtain ⟨e, he, hze⟩ := D.rad.G.exists_edge_of_mem (hF.1.U_subset hzF) hzV + have hmem : ∀ C : Drawing Shat, C.IsSubdrawing D.rad.G → z ∈ C.U → e ∈ C.E := fun C hC hzC => by + obtain ⟨f, hf, hzf⟩ := C.exists_edge_of_mem hzC (fun h => hzV (hC.1 h)) + exact (D.rad.G.edge_eq_of_mem (hC.2 hf) he hzf hze) ▸ hf + have heF := hmem F hF.1 hzF + have heG := hmem G hG.1 hzG + obtain ⟨v, hvh, w, hwh, hcap⟩ := D.rad.isPreRadial.2.2.2.2.1 e he + have hends : ∀ C : Drawing Shat, e ∈ C.E → ∀ x, x ∈ closure e ∩ D.rad.G.V → x ∈ C.V + := fun C hC' x hx => by + by_contra hxC + have : x ∈ closure e \ C.V := ⟨hx.1, hxC⟩ + rw [C.closure_diff_V hC'] at this + exact (he.2.1 this).2 hx.2 + have hv : v ∈ closure e ∩ D.rad.G.V := hcap ▸ .inl rfl + have hw : w ∈ closure e ∩ D.rad.G.V := hcap ▸ .inr rfl + by_cases hvr : v = r + · have hwr : w ≠ r := fun h => hwh.2 (h ▸ hvr ▸ hvh) + exact ⟨w, hends F heF w hw, hends G heG w hw, hwr⟩ + · exact ⟨v, hends F heF v hv, hends G heG v hv, hvr⟩ + +omit [T2Space S] in +/-- Two bites at `r`, one with a vertex other than `r` inside the other, lie in one bite. If they +have a second common vertex we use `no_two_common_vertices`. If not, the first bite without `r` is +connected and misses the +second bite, so it lies inside the second bite. -/ +theorem exists_bite_superset_of_vertex {F G : Drawing Shat} + (hF : D.IsBiteAt r F) (hG : D.IsBiteAt r G) (hc : F.E.ncard + G.E.ncard ≤ 2 * N) {p : Shat} + (hpF : p ∈ F.V) (hpr : p ≠ r) (hpG : p ∈ D.ins G) : + ∃ C, D.IsBiteAt r C ∧ C.E.ncard ≤ F.E.ncard + G.E.ncard ∧ D.ins F ⊆ D.ins C ∧ D.ins G ⊆ D.ins C + := by + classical + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have : ConnectedSpace Shat := cap.connected + have hrep : 1 ≤ D.rep := by have := X.rep_gt; omega + by_cases hx : ∃ x ∈ F.V, x ∈ G.V ∧ x ≠ r + · obtain ⟨x, hxF, hxG, hxr⟩ := hx + obtain ⟨C, hC, hcard, i₁, i₂, hV⟩ := no_two_common_vertices X.rep_gt hF.is_circuit + hG.is_circuit hc hxr hxF hxG hF.rstar_mem hG.rstar_mem + have e₁ := IsCircuit.ncard_V hC.2 + have e₂ := IsCircuit.ncard_V hF.is_circuit.2 + have e₃ := IsCircuit.ncard_V hG.is_circuit.2 + have h₃ := ncard_le_ncard hV (F.finite_V.union G.finite_V) + have h₄ := ncard_union_le F.V G.V + have hrF := D.U_subset_ins hF.is_circuit hF.card_lt (F.V_subset_U hF.rstar_mem) + exact ⟨C, X.bite_of_ins hC hcard (i₁ hrF), by omega, i₁, i₂⟩ + push Not at hx + have hi := D.ins_spec hG.is_circuit hG.card_lt + have hconn : IsPreconnected (F.U \ {r}) := (Surface.isPathConnected_oArc_diff + (IsCircuit.isOArc_U hF.is_circuit.2) (F.V_subset_U hF.rstar_mem)).isConnected.isPreconnected + have hdis : Disjoint (F.U \ {r}) (discBd (D.ins G)) := by + rw [hi.2.2.2.1] + refine disjoint_left.mpr fun z hz hzG => ?_ + obtain ⟨x, h₁, h₂, h₃⟩ := exists_common_vertex hF.is_circuit hG.is_circuit hz.1 hzG hz.2 + exact h₃ (hx x h₁ h₂) + have hsub : F.U ⊆ D.ins G := by + rcases hi.2.2.1.side hman hconn hdis with h | h + · intro z hz + by_cases hzr : z = r + · exact hzr ▸ D.U_subset_ins hG.is_circuit hG.card_lt (G.V_subset_U hG.rstar_mem) + · exact discInt_subset _ (h ⟨hz, hzr⟩) + · exact absurd hpG (disjoint_left.mp h ⟨F.V_subset_U hpF, hpr⟩) + have hmono := (D.isSlope hrep).monotone _ _ hF.is_circuit.2 hF.is_circuit.1 hF.card_lt + hG.is_circuit.2 hG.is_circuit.1 hG.card_lt hsub + exact ⟨G, hG, by omega, hmono, Subset.rfl⟩ + +omit X [T2Space S] in +/-- What a tight bite meets on the cuff is its arc. -/ +theorem _root_.GraphMinor.GM19.TangleDatum.IsBiteShape.isPreconnected_cuff_inter_ins + {F : Drawing Shat} {v₁ v₂ Β L A A' Di Do} (h : D.IsBiteShape r Θ F v₁ v₂ Β L A + A' Di Do) (hdis : Disjoint F.V A') : + IsPreconnected (cap.emb '' Θ ∩ D.ins F) := by + classical + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have : ConnectedSpace Shat := cap.connected + have hi := D.ins_spec h.circuit h.lt + have hsubI : ∀ x ∈ D.biteArc r F, x ∈ cap.emb '' Θ ∧ x ∈ D.ins F := fun x hx => by + obtain ⟨I, hI, hxI⟩ := hx + have := hI.1 hxI + exact ⟨closure_region_sdiff h.cuff h.reg ▸ this.2, this.1⟩ + have hfr : IsOpen (discInt (D.ins F)) := hi.2.2.1.isOpen_discInt hman + have heq : cap.emb '' Θ ∩ D.ins F = D.biteArc r F := by + refine Subset.antisymm (fun x hx => ?_) fun x hx => hsubI x hx + obtain ⟨⟨y, hy, rfl⟩, hxi⟩ := hx + by_contra hn + have hA' : cap.emb y ∈ A' := by + by_contra hA' + exact hn (by + rw [h.biteArc_eq] + by_cases he : cap.emb y ∈ ({cap.emb v₁, cap.emb v₂} : Set Shat) + · exact .inr he + · rcases h.cover ⟨mem_image_of_mem _ hy, he⟩ with h' | h' + · exact .inl h' + · exact absurd h' hA') + have hnotU : cap.emb y ∉ F.U := fun hU => by + obtain ⟨-, hyF, -⟩ := D.rad.bd_point h.circuit.1 (cuff_subset_bd ⟨Θ, h.cuff⟩ hy) hU + exact disjoint_left.mp hdis hyF hA' + have hint : cap.emb y ∈ discInt (D.ins F) := ⟨hxi, by rwa [hi.2.2.2.1]⟩ + have hyD : cap.emb y ∈ closure (discInt Do) := by + rw [closure_discInt h.do_] + exact Surface.discBd_subset _ (h.bd_o ▸ Or.inl hA') + obtain ⟨w, hw₁, hw₂⟩ := mem_closure_iff.mp hyD _ hfr hint + exact disjoint_left.mp h.out_ins hw₂ (discInt_subset _ hw₁) + rw [heq, ← image_preimage_eq_of_subset (f := cap.emb) (s := D.biteArc r F) fun x hx + => image_subset_range _ _ (hsubI x hx).1] + exact (cap.isEmbedding.isInducing.isPreconnected_image).mpr (h.isPreconnected_biteArc) + +/-- **Two bites at `r` that share a point of the cuff lie in one bite.** We may take the first +tight, so it meets the cuff in a connected set. Either an end of that set lies in the second bite, +or the second bite has a vertex in that set. -/ +theorem exists_bite_superset (hS : IsSurface S) {F G : Drawing Shat} (hF : D.IsBiteAt r F) + (hG : D.IsBiteAt r G) (hc : F.E.ncard + G.E.ncard ≤ 2 * N) {z : Shat} (hzΘ : z ∈ cap.emb '' Θ) + (hzF : z ∈ D.ins F) (hzG : z ∈ D.ins G) : + ∃ C, D.IsBiteAt r C ∧ C.E.ncard ≤ F.E.ncard + G.E.ncard ∧ D.ins F ⊆ D.ins C ∧ D.ins G ⊆ D.ins C + := by + classical + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have : ConnectedSpace Shat := cap.connected + obtain ⟨F', hF', hle, hsub, v₁, v₂, Β, L, A, A', Di, Do, hs, hdis⟩ := X.exists_tight_bite hS hF + (by omega) + have hcon := hs.isPreconnected_cuff_inter_ins hdis + have hrr : ∀ {y : S}, cap.emb y ≠ r := fun {y} he => by + have hrd : r ∈ cap.cuffDisc Θ := X.reg ▸ (D.rad.regionOf_mem X.pole.1).2 + exact cap.notMem_range X.cuff hrd ⟨y, he⟩ + have hv₁U : cap.emb v₁ ∈ F'.U := hs.Β_F (hs.meet ▸ mem_insert _ _ : cap.emb v₁ ∈ Β ∩ cap.emb '' + Θ).1 + obtain ⟨-, hv₁F, -⟩ := D.rad.bd_point hs.circuit.1 (cuff_subset_bd ⟨Θ, hs.cuff⟩ hs.v₁_cuff) hv₁U + have fin : ∀ {C}, D.IsBiteAt r C → C.E.ncard ≤ F'.E.ncard + G.E.ncard → D.ins F' ⊆ D.ins C + → D.ins G ⊆ D.ins C → + ∃ C, D.IsBiteAt r C ∧ C.E.ncard ≤ F.E.ncard + G.E.ncard ∧ + D.ins F ⊆ D.ins C ∧ D.ins G ⊆ D.ins C := by + intro C h₁ h₂ h₃ h₄ + exact ⟨C, h₁, by omega, hsub.trans h₃, h₄⟩ + by_cases hv : cap.emb v₁ ∈ D.ins G + · obtain ⟨C, h₁, h₂, h₃, h₄⟩ := X.exists_bite_superset_of_vertex hF' hG (by omega) hv₁F hrr hv + exact fin h₁ h₂ h₃ h₄ + have hi := D.ins_spec hG.is_circuit hG.card_lt + have hne : ∃ w, w ∈ cap.emb '' Θ ∩ D.ins F' ∧ w ∈ G.U := by + by_contra hn + push Not at hn + have hd : Disjoint (cap.emb '' Θ ∩ D.ins F') (discBd (D.ins G)) := by + rw [hi.2.2.2.1] + exact disjoint_left.mpr hn + rcases hi.2.2.1.side hman hcon hd with h | h + · exact hv (discInt_subset _ (h ⟨mem_image_of_mem _ hs.v₁_cuff, + D.U_subset_ins hs.circuit hs.lt hv₁U⟩)) + · exact disjoint_left.mp h ⟨hzΘ, hsub hzF⟩ hzG + obtain ⟨w, ⟨⟨y, hy, rfl⟩, hwF⟩, hwG⟩ := hne + obtain ⟨-, hyG, -⟩ := D.rad.bd_point hG.is_circuit.1 (cuff_subset_bd ⟨Θ, X.cuff⟩ hy) hwG + obtain ⟨C, h₁, h₂, h₃, h₄⟩ := X.exists_bite_superset_of_vertex hG hF' (by omega) hyG hrr hwF + exact fin h₁ (by omega) h₄ h₃ + +end TangleDatum.IsSideSetting + +namespace TangleDatum + +variable {P₀ : ColouredPainting χ} {n : ℕ} {b : Set S → Set S} + +/-- The set `N(r*)` of step (4) of the proof of (15.2): the ends of the images of the edges of `Γ₀` +on a cuff. -/ +def cuffEnds (P₀ : ColouredPainting χ) (b : Set S → Set S) (Θ : Set S) : Set S + := {y | ∃ e ∈ P₀.Γ.E, e ⊆ Θ ∧ y ∈ tilde (b e)} + +/-- An edge of `Γ₀` on a cuff has its image on a side of that cuff. -/ +theorem exists_side_of_cuffEnds (hS : IsSurface S) (hb : D.IsEdgeMap P₀ n b) {Θ : Set S} + (hΘ : Θ ∈ cuffs S) {e : Set S} (he : e ∈ P₀.Γ.E) (heΘ : e ⊆ Θ) : + ∃ s ∈ χ.Φ.sides, s ⊆ Θ ∧ e ⊆ s ∧ b e ⊆ s ∧ (s ∉ χ.Φ.longSides → b e = s) := by + obtain ⟨x, hx⟩ : e.Nonempty := he.1 + obtain ⟨s, hs, hes, hbs, -⟩ := hb.border he ⟨x, hx, cuff_subset_bd ⟨Θ, hΘ⟩ (heΘ hx)⟩ + obtain ⟨Θ', hΘ', hsΘ', -⟩ := χ.Φ.side_on_cuff hS hs + obtain rfl : Θ' = Θ := cuffs_eq_of_mem hΘ' hΘ (hsΘ' (hes hx)) (heΘ hx) + refine ⟨s, hs, hsΘ', hes, hbs, fun hl => ?_⟩ + have hss : s ∈ χ.Φ.shortSides := ⟨hs, fun h => hl ⟨hs, h⟩⟩ + obtain rfl := eq_short_of_subset P₀.fits he hss hes + exact hb.short e hss + +/-- **Step (4) of the proof of (15.2).** No short circuit of `Γ*` through or around the pole of a +cuff holds more than half its length of `N(r*)`. -/ +theorem no_circuit_holds_cuffEnds (hS : IsSurface S) (hb : D.IsEdgeMap P₀ n b) (hn : 3 ≤ n) + (hnr : n < D.rep) (hfree : ∀ C, ¬ D.IsFreeCircuit n C) + (hfar : ∀ r₁ ∈ D.rad.poles, ∀ r₂ ∈ D.rad.poles, r₁ ≠ r₂ → n < D.vDist r₁ r₂) {r : Shat} + (hr : r ∈ D.rad.poles) {Θ : Set S} (hΘ : Θ ∈ cuffs S) (hreg : D.rad.regionOf r + = cap.cuffDisc Θ) + {F₀ : Drawing Shat} (hF₀ : F₀.IsCircuitOf D.rad.G) (hsm : F₀.E.ncard + 12 ≤ n) + (hri : r ∈ D.ins F₀) (hlt : F₀.E.ncard < 2 * ((cap.emb '' cuffEnds P₀ b Θ) ∩ D.ins F₀).ncard) + : False := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hbd : IsClosed (bd S) := (cuff_statement S hS).1 + have h3 := D.P.fits.internally_three_connected + have hinj := cap.isEmbedding.injective + have hNfin : (cuffEnds P₀ b Θ).Finite := by + refine (P₀.Γ.finite_edges.biUnion (t := fun e => tilde (b e)) fun e he => D.P.Γ.finite_V.subset + (D.P.Γ.tilde_subset_V (hb.mem e he))).subset ?_ + rintro y ⟨e, he, -, hy⟩ + exact mem_biUnion he hy + have hΘo : IsOArc Θ := (cuff_statement S hS).2.2 Θ hΘ + have hΘcl : IsClosed Θ := hΘo.isCompact.isClosed + have hfree' : ∀ F : Drawing Shat, F.IsCircuitOf D.rad.G → F.E.ncard ≤ 2 * n → F.E.ncard < 2 * + ((cap.emb '' cuffEnds P₀ b Θ) ∩ D.ins F).ncard → (cap.emb '' cuffEnds P₀ b Θ) ∩ D.ins F ⊆ + cap.emb '' χ.Φ.V → False := fun F hF hc hl hsub => + hfree F ⟨hF, hc, Or.inr (lt_of_lt_of_le hl (by + have := ncard_le_ncard (s := (cap.emb '' cuffEnds P₀ b Θ) ∩ D.ins F) (t := + (cap.emb '' χ.Φ.V) ∩ D.ins F) (fun x hx => ⟨hsub hx, hx.2⟩) (χ.Φ.finite_V.image _ + |>.inter_of_left _) + omega))⟩ + by_cases hlong : ∃ side ∈ χ.Φ.longSides, side ⊆ Θ + swap + · refine hfree' F₀ hF₀ (by omega) hlt ?_ + rintro _ ⟨⟨y, ⟨e, he, heΘ, hy⟩, rfl⟩, -⟩ + obtain ⟨s, hs, hsΘ, -, -, hshort⟩ := exists_side_of_cuffEnds hS hb hΘ he heΘ + rw [hshort fun hl => hlong ⟨s, hl, hsΘ⟩] at hy + exact mem_image_of_mem _ (χ.Φ.tilde_subset hbd hs hy) + obtain ⟨side₀, hside₀, hs₀Θ⟩ := hlong + have X : D.IsSideSetting side₀ Θ r n := ⟨h3, hside₀, hs₀Θ, hΘ, hr, hreg, hnr, hfar, hfree⟩ + have hri' := X.pole_mem hF₀ (by omega) hri + obtain ⟨F, hbF, hle, hsub, v₁, v₂, Β, L, A, A', Di, Do, hs, hdis⟩ := + X.exists_tight_bite hS (⟨hr, hF₀, by omega, hri'⟩ : D.IsBiteAt r F₀) (by omega) + have hmono : ((cap.emb '' cuffEnds P₀ b Θ) ∩ D.ins F₀).ncard ≤ ((cap.emb '' cuffEnds P₀ b Θ) ∩ + D.ins F).ncard := + ncard_le_ncard (fun x hx => ⟨hx.1, hsub hx.2⟩) ((hNfin.image _).inter_of_left _) + have hF4 : 4 ≤ F.E.ncard := by + have hp : ({cap.emb v₁, cap.emb v₂} : Set Shat) ⊆ F.V ∩ D.P.Γ.hatV cap := by + have key : ∀ {v}, cap.emb v ∈ Β → v ∈ Θ → v ∈ D.P.Γ.V → cap.emb v ∈ F.V ∩ D.P.Γ.hatV cap + := fun {v} h₁ h₂ h₃ => + ⟨(D.rad.bd_point hs.circuit.1 (cuff_subset_bd ⟨Θ, hΘ⟩ h₂) (hs.Β_F h₁)).2.1, + mem_image_of_mem _ h₃⟩ + rintro x (rfl | hx) + · exact key (hs.meet ▸ mem_insert _ _ : cap.emb v₁ ∈ Β ∩ cap.emb '' Θ).1 hs.v₁_cuff hs.v₁_mem + · rw [mem_singleton_iff.mp hx] + exact key (hs.meet ▸ mem_insert_of_mem _ rfl : cap.emb v₂ ∈ Β ∩ cap.emb '' Θ).1 hs.v₂_cuff + hs.v₂_mem + have := ncard_le_ncard hp (F.finite_V.subset inter_subset_left) + rw [ncard_pair fun he => hs.ne (hinj he)] at this + have e := D.ncard_E_eq_hat hs.circuit + omega + have hsmF : F.E.ncard + 12 ≤ n := by omega + have grow : ∀ t ∈ D.P.Γ.E, t ⊆ Θ → ∀ B, D.IsBiteAt r B → B.E.ncard + 6 ≤ 2 * n + → ∀ z ∈ closure t, cap.emb z ∈ D.ins B → ∃ C, D.IsBiteAt r C ∧ C.E.ncard ≤ B.E.ncard + 6 + ∧ D.ins B ⊆ D.ins C ∧ cap.emb '' t ⊆ D.ins C := by + intro t ht htΘ B hB hBn z hz hzB + obtain ⟨G, hG, hG6, hGt⟩ := exists_bite_of_edge hn (by omega) hfree hside₀ hs₀Θ hΘ hr hreg + ht htΘ + have hzG : cap.emb z ∈ D.ins G := by + have hG' := (D.ins_spec hG.is_circuit hG.card_lt).2.2.1.isClosed + refine closure_minimal hGt hG' ?_ + rw [(cap.isClosedEmbedding hS).closure_image_eq t] + exact mem_image_of_mem _ hz + have hzΘ : cap.emb z ∈ cap.emb '' Θ := by + refine mem_image_of_mem _ ?_ + exact closure_minimal htΘ hΘcl hz + obtain ⟨C, h₁, h₂, h₃, h₄⟩ := X.exists_bite_superset hS hB hG (by omega) hzΘ hzB hzG + exact ⟨C, h₁, by omega, h₃, hGt.trans h₄⟩ + have hcΘ : IsOArc (cap.emb '' Θ) := cap.cuffDisc_bd Θ hΘ ▸ (cap.cuffDisc_closedDisc Θ + hΘ).isOArc_discBd + by_cases hY : (cap.emb '' cuffEnds P₀ b Θ) ∩ D.ins F ⊆ cap.emb '' χ.Φ.V + · exact hfree' F hs.circuit (by omega) (by omega) hY + obtain ⟨_, ⟨⟨y, ⟨e, he, heΘ, hy⟩, rfl⟩, hyi⟩, hyΦ⟩ := not_subset.mp hY + obtain ⟨s, hs', hsΘ, hes, hbs, hshort⟩ := exists_side_of_cuffEnds hS hb hΘ he heΘ + have hsl : s ∈ χ.Φ.longSides := by + by_contra hl + rw [hshort hl] at hy + exact hyΦ (mem_image_of_mem _ (χ.Φ.tilde_subset hbd hs' hy)) + obtain ⟨m, f, g, c, r', u₀, u₁, u₀', u₁', hM⟩ := hb.side s hsl + obtain ⟨x, hx⟩ : e.Nonempty := he.1 + have hcE : c = Θ := cuffs_eq_of_mem hM.cuff hΘ (hM.side_cuff (hes hx)) (hsΘ (hes hx)) + rw [hcE] at hM + have hrE : r' = r := pole_eq_of_mem_cuffDisc hr hΘ hreg hM.pole hM.pole_disc + rw [hrE] at hM + obtain ⟨i, rfl⟩ := hM.all₀ e he hes + have hgi := hM.map i + obtain ⟨F₁, hF₁, hF₁c, hF₁i, hF₁g⟩ := grow _ (hb.mem _ he) (hbs.trans hsΘ) F hbF + (by omega) y hy.1 hyi + have hcorner : ∀ v ∈ tilde s, cap.emb v ∉ D.ins F := by + intro v hv hvi + have hvV := χ.Φ.tilde_subset hbd hs' hv + obtain ⟨t, ht, hvt⟩ := χ.Φ.exists_short_side hS hvV + obtain ⟨Θ', hΘ', htΘ', -⟩ := χ.Φ.side_on_cuff hS ht.1 + have hcl' : IsClosed Θ' := ((cuff_statement S hS).2.2 Θ' hΘ').isCompact.isClosed + obtain rfl : Θ' = Θ := cuffs_eq_of_mem hΘ' hΘ (closure_minimal htΘ' hcl' hvt.1) + (closure_minimal hsΘ hΘcl hv.1) + obtain ⟨F₂, hF₂, hF₂c, hF₂i, hF₂t⟩ := grow t (D.P.fits.short_sides ht) htΘ' F₁ hF₁ + (by omega) v hvt.1 (hF₁i hvi) + have h₁ := D.borderEdgeDist_le_of_bite hF₂ (hF₁g.trans hF₂i) hF₂t + have h₂ := hM.far_short i t ht htΘ' + rw [← hgi] at h₂ + omega + obtain ⟨v, hv⟩ : (tilde s).Nonempty := by + have h2 := (χ.Φ.side_shape s hs').1 + exact nonempty_of_ncard_ne_zero (by omega) + obtain ⟨w, -, htil, hline⟩ := χ.Φ.exists_line hs' hv + have hwt : w ∈ tilde s := htil ▸ mem_insert_of_mem _ rfl + have hJ : cap.emb '' Θ ∩ D.ins F ⊆ cap.emb '' closure s := + subset_line_of_isPreconnected hcΘ (hline.map_of_embedding cap.isEmbedding) (image_mono + (closure_minimal hsΘ hΘcl)) + (hs.isPreconnected_cuff_inter_ins hdis) inter_subset_left (fun h => hcorner v hv h.2) + (fun h => hcorner w hwt h.2) + ⟨mem_image_of_mem _ (closure_minimal (hbs.trans hsΘ) hΘcl hy.1), hyi⟩ (mem_image_of_mem _ + (closure_mono hbs hy.1)) + have hsubN : (cap.emb '' cuffEnds P₀ b Θ) ∩ D.ins F ⊆ cap.emb '' tilde (b (f i)) := by + rintro _ ⟨⟨y', ⟨e', he', he'Θ, hy'⟩, rfl⟩, hy'i⟩ + obtain ⟨s', hs'', hs'Θ, hes', hbs', -⟩ := exists_side_of_cuffEnds hS hb hΘ he' he'Θ + have hy's : y' ∈ s := by + obtain ⟨z, hz, hze⟩ := hJ ⟨mem_image_of_mem _ (closure_minimal (hbs'.trans hs'Θ) hΘcl hy'.1), + hy'i⟩ + obtain rfl := hinj hze + by_contra hn' + exact hcorner z ⟨hz, hn'⟩ hy'i + have hy'V : y' ∉ χ.Φ.V := (hs'.2.1 hy's).2 + have hy's' : y' ∈ s' := by + by_contra hn' + exact hy'V (χ.Φ.tilde_subset hbd hs'' ⟨closure_mono hbs' hy'.1, hn'⟩) + obtain rfl : s' = s := GM11.arcComponent_eq hs'' hs' hy's' hy's + obtain ⟨j, rfl⟩ := hM.all₀ e' he' hes' + by_cases hij : i = j + · rw [hij] + exact mem_image_of_mem _ hy' + exfalso + obtain ⟨F₂, hF₂, hF₂c, hF₂i, hF₂t⟩ := grow _ (hb.mem _ he') (hbs'.trans hsΘ) F₁ hF₁ + (by omega) y' hy'.1 (hF₁i hy'i) + rcases lt_or_gt_of_ne hij with hlt' | hlt' + · have h₁ := D.borderEdgeDist_le_of_bite hF₂ (hF₁g.trans hF₂i) hF₂t + have h₂ := hM.far i j hlt' + rw [← hM.map i, ← hM.map j] at h₂ + omega + · have h₁ := D.borderEdgeDist_le_of_bite hF₂ hF₂t (hF₁g.trans hF₂i) + have h₂ := hM.far j i hlt' + rw [← hM.map i, ← hM.map j] at h₂ + omega + have h2 : (tilde (b (f i))).ncard = 2 := by + obtain ⟨z, hz⟩ : (b (f i)).Nonempty := (hb.mem _ he).1 + exact (D.P.Γ.border_edge _ (hb.mem _ he) ⟨z, hz, (hs'.2.1 (hbs hz)).1⟩).1 + have hcard : ((cap.emb '' cuffEnds P₀ b Θ) ∩ D.ins F).ncard ≤ 2 := by + have := ncard_le_ncard hsubN ((D.P.Γ.finite_V.subset (D.P.Γ.tilde_subset_V + (hb.mem _ he))).image _) + rw [ncard_image_of_injective _ hinj, h2] at this + exact this + omega + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15k.lean b/LeanPool/GraphMinor/GM19/Section15k.lean new file mode 100644 index 0000000000..5ca0fbf75d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15k.lean @@ -0,0 +1,167 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section15j + +/-! +# Graph Minors XIX, (15.2): an internal edge has no small separation around it + +This is step (6) of the proof of (15.2), read for circuits of `Γ*`. If a short circuit of `Γ*` holds +more than half its length of the ends of an edge, then it has at most two vertices of `Γ`. An edge +far from the +poles keeps this circuit off the cuffs, so internal 3-connectivity applies in `Σ`, and gives a disc +with no vertex of `Γ` inside. That disc cannot be `ins(F)`, and it cannot be the other disc either, +by the third tangle axiom. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 GraphMinor.GM14 Hypergraph + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} {D : TangleDatum cap χ} + +namespace TangleDatum + +/-- **Step (6) of the proof of (15.2).** -/ +theorem no_circuit_holds_tilde (hS : IsSurface S) {n : ℕ} (hn : 8 ≤ n) (hrep : 4 + ≤ D.rep) {c : Set S} (hc : c ∈ D.P.Γ.E) (h3c : (tilde c).ncard ≤ 3) + (hfar : ∀ r ∈ D.rad.poles, n < D.edgeVertDist c r) + {F : Drawing Shat} (hF : F.IsCircuitOf D.rad.G) (hl : F.E.ncard < 2 * D.rep) + (hlt : F.E.ncard < 2 * ((cap.emb '' tilde c) ∩ D.ins F).ncard) : False := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have h3 := D.P.fits.internally_three_connected + have hinj := cap.isEmbedding.injective + have hi := D.ins_spec hF hl + have htfin : (tilde c).Finite := D.P.Γ.finite_V.subset (D.P.Γ.tilde_subset_V hc) + have hX3 : ((cap.emb '' tilde c) ∩ D.ins F).ncard ≤ 3 := by + have := ncard_le_ncard (s := (cap.emb '' tilde c) ∩ D.ins F) inter_subset_left (htfin.image _) + rw [ncard_image_of_injective _ hinj] at this + omega + have hE := D.ncard_E_eq_hat hF + have hpos : ((cap.emb '' tilde c) ∩ D.ins F).Nonempty := nonempty_of_ncard_ne_zero (by omega) + obtain ⟨_, ⟨x, hxt, rfl⟩, hxi⟩ := hpos + have hxV : x ∈ D.P.Γ.V := D.P.Γ.tilde_subset_V hc hxt + have hxa : ({cap.emb x} : Set Shat) ∈ D.P.Γ.atoms cap := Or.inl (Or.inl ⟨x, hxV, rfl⟩) + have hcx : D.dist (cap.emb '' c) {cap.emb x} ≤ 3 := by + have := D.edgeVertDist_self_le hrep hc hxt hxV + unfold edgeVertDist at this + rwa [D.atomOf_emb hxV] at this + have near : ∀ a : Set Shat, (a ∩ D.ins F).Nonempty → D.dist (cap.emb '' c) a ≤ 5 := fun a ha => by + have h₁ := D.dist_le_of_circuit (by omega) hF hl (a := {cap.emb x}) ⟨_, rfl, hxi⟩ ha + have h₂ := D.dist_triangle hrep (a := cap.emb '' c) (c := a) hxa + omega + have npole : ∀ r ∈ D.rad.poles, r ∉ D.ins F := fun r hr hri => by + have h₁ := near (D.rad.atomOf r) ⟨r, D.mem_atomOf hr.1.1, hri⟩ + have h₂ := hfar r hr + unfold edgeVertDist at h₂ + omega + have hnb : ∀ Θ ∈ cuffs S, ∀ y ∈ Θ, cap.emb y ∉ F.U := fun Θ hΘ y hy hyF => by + obtain ⟨hyV, hyFV, -⟩ := D.rad.bd_point hF.1 (cuff_subset_bd ⟨Θ, hΘ⟩ hy) hyF + obtain ⟨p, hp, -, hreg⟩ := D.rad.exists_pole hΘ + obtain ⟨e, he, hcap⟩ := D.rad.exists_pole_edge hS h3 hp hΘ hreg hyV hy + have hyG : cap.emb y ∈ D.rad.G.V := hF.1.1 hyFV + have hl₁ : D.rad.G.toGraph.IsLink e (cap.emb y) p := ⟨he, hyG, hp.1.1, hcap⟩ + have hlen : (GraphWalk.cons hl₁ (GraphWalk.nil hp.1.1)).length = 1 := by + simp [GraphWalk.length, GraphWalk.edges] + have h₁ := D.dist_atomOf_le_of_walk (GraphWalk.cons hl₁ (GraphWalk.nil hp.1.1)) (by omega) + rw [hlen, D.atomOf_emb hyV] at h₁ + have h₂ := near {cap.emb y} ⟨_, rfl, D.U_subset_ins hF hl hyF⟩ + have h₃ := D.dist_triangle hrep (a := cap.emb '' c) (c := D.rad.atomOf p) (Or.inl + (Or.inl ⟨y, hyV, rfl⟩) : ({cap.emb y} : Set Shat) ∈ D.P.Γ.atoms cap) + have h₄ := hfar p hp + unfold edgeVertDist at h₄ + omega + have hrange : F.U ⊆ range cap.emb := fun z hz => by + by_contra hzr + have hmem : z ∈ (range cap.emb)ᶜ := hzr + rw [cap.compl_eq] at hmem + obtain ⟨Θ, hΘ, hzd⟩ := mem_iUnion₂.mp hmem + obtain ⟨p, hp, -, hreg⟩ := D.rad.exists_pole hΘ + have hpF := pole_mem_of_meet hF.1 hp hΘ hreg hz hzd + exact npole p hp (D.U_subset_ins hF hl (F.V_subset_U hpF)) + have hnebd : Disjoint (cap.emb ⁻¹' F.U) (bd S) := disjoint_left.mpr fun y hy hyb => + hnb _ ⟨y, hyb, rfl⟩ y (mem_connectedComponentIn hyb) hy + have : Nonempty S := ⟨x⟩ + have hO : IsOArc (cap.emb ⁻¹' F.U) := by + obtain ⟨f', hf'c, hf'⟩ := exists_inv_of_isEmbedding cap.isEmbedding + have himg : f' '' F.U = cap.emb ⁻¹' F.U := by + ext y + constructor + · rintro ⟨z, hz, rfl⟩ + obtain ⟨w, rfl⟩ := hrange hz + rw [hf' w] + exact hz + · intro hy + exact ⟨cap.emb y, hy, hf' y⟩ + rw [← himg] + refine IsOArc.image (IsCircuit.isOArc_U hF.2) (hf'c.mono hrange) + cap.isEmbedding.continuous.continuousOn ?_ + intro z hz + obtain ⟨w, rfl⟩ := hrange hz + rw [hf' w] + have hUV : cap.emb ⁻¹' F.U ∩ D.P.Γ.U ⊆ D.P.Γ.V := fun y hy => by + have : cap.emb y ∈ D.P.Γ.hatU cap ∩ D.rad.G.U := ⟨mem_image_of_mem _ hy.2, hF.1.U_subset hy.1⟩ + rw [D.rad.isPreRadial.1] at this + obtain ⟨w, hw, e⟩ := this + exact hinj e ▸ hw + have hVsub : cap.emb '' (cap.emb ⁻¹' F.U ∩ D.P.Γ.V) ⊆ F.V ∩ D.P.Γ.hatV cap := by + rintro _ ⟨y, ⟨hy, hyV⟩, rfl⟩ + exact ⟨mem_V_of_mem_U_sub hF.1 hy (D.rad.isPreRadial.2.1 (mem_image_of_mem _ hyV)), + mem_image_of_mem _ hyV⟩ + have hcount : (cap.emb ⁻¹' F.U ∩ D.P.Γ.V).ncard ≤ (F.V ∩ D.P.Γ.hatV cap).ncard := by + have := ncard_le_ncard hVsub (F.finite_V.subset inter_subset_left) + rwa [ncard_image_of_injective _ hinj] at this + have hbdE : cap.emb ⁻¹' F.U ∩ bd S = ∅ := disjoint_iff_inter_eq_empty.mp hnebd + obtain ⟨Δ, hΔ, hΔb, hΔV⟩ := + h3.2 _ hO hUV (by simp [hbdE]) (by rw [hbdE, ncard_empty]; omega) + obtain ⟨hd, hdb⟩ := isClosedDisc_image hΔ cap.isEmbedding + have hdb' : discBd (cap.emb '' Δ) = F.U := by + rw [hdb, hΔb, image_preimage_eq_of_subset hrange] + have hbd₂ : discBd (D.ins F) = F.U := hi.2.2.2.1 + by_cases he : cap.emb '' Δ = D.ins F + · have hsub : (cap.emb '' tilde c) ∩ D.ins F ⊆ F.V ∩ D.P.Γ.hatV cap := by + rintro _ ⟨⟨y, hy, rfl⟩, hyi⟩ + have hyV := D.P.Γ.tilde_subset_V hc hy + have hyΔ : y ∈ Δ := by + rw [← he] at hyi + exact hinj.mem_set_image.mp hyi + exact hVsub ⟨y, ⟨hΔV ⟨hyΔ, hyV⟩, hyV⟩, rfl⟩ + have := ncard_le_ncard hsub (F.finite_V.subset inter_subset_left) + omega + have hsph : IsSphere Shat := by + by_contra hns + exact he (eq_of_discBd_eq hT.isSurface hns hd hi.2.2.1 (hdb'.trans hbd₂.symm)) + obtain ⟨Δ₁, Δ₂, -, -, -, -, -, hun, -, -, huniq⟩ := sphere_disc Shat hsph F.U + (IsCircuit.isOArc_U hF.2) + have hU : cap.emb '' Δ ∪ D.ins F = univ := by + rcases huniq _ hd hdb' with e₁ | e₁ <;> rcases huniq _ hi.2.2.1 hbd₂ with e₂ | e₂ + · exact absurd (e₁.trans e₂.symm) he + · rw [e₁, e₂] + exact hun + · rw [e₁, e₂, Set.union_comm] + exact hun + · exact absurd (e₁.trans e₂.symm) he + refine D.isTangle.axiom3 hi.2.2.2.2 ?_ + refine Subset.antisymm inter_subset_left fun v hv => ⟨hv, ?_⟩ + rcases (hU.symm ▸ mem_univ _ : cap.emb v ∈ cap.emb '' Δ ∪ D.ins F) with h | h + · have hvΔ : v ∈ Δ := hinj.mem_set_image.mp h + exact D.U_subset_ins hF hl (hΔV ⟨hvΔ, hv⟩) + · exact h + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15l.lean b/LeanPool/GraphMinor/GM19/Section15l.lean new file mode 100644 index 0000000000..cc657281e5 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15l.lean @@ -0,0 +1,335 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section15k +public import LeanPool.GraphMinor.GM19.DiscTouch +public import LeanPool.GraphMinor.GM19.Section15h + +/-! +# Graph Minors XIX, (15.2): the discs of (3.2) + +Theorem (3.2) of Graph Minors XII takes a family of disjoint closed discs in `Σ̂`, each of which +meets `sk(Γ)` only in vertices on its boundary. The proof of (15.2) uses one disc for each cuff and +one disc for each internal edge `β(e)`. +It does not say what the discs are. Here we build them. + +The disc of a cuff lies in the closed disc pasted onto the cuff, and it touches the cuff in `N(r*)` +(`exists_cuff_disc`). The disc of an edge of size 3 lies in the closed disc of the edge, and it +touches the boundary in the three ends +(`exists_three_disc`). The disc of an edge of size 2 lies on one side of the edge in a thin disc +around it (`exists_two_disc`). In each case the regions of `sk(Γ)` that meet the disc have an edge +of the right kind on their boundary, which is +what we need to bound distances. `IsAnchoredDisc` collects what we use. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 GraphMinor.GM14 Hypergraph + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {H : Drawing Shat} + +/-- A closed disc of `Σ̂` that meets `sk(Γ)` only in vertices `N` on its boundary, such that every +region of `sk(Γ)` that meets the disc has `N` in its closure, and has on its boundary a side of the +edge `a`. -/ +structure IsAnchoredDisc (cap : IsCappedSurface S Shat) (Γ : Painting S) (H : Drawing Shat) + (Δ N : Set Shat) (a : Set S) : Prop where + disc : IsClosedDisc Δ + inter : H.U ∩ Δ = N + sub_V : N ⊆ H.V + sub_bd : N ⊆ discBd Δ + anchor : ∀ r ∈ H.R, (r ∩ Δ).Nonempty → N ⊆ closure r ∧ ∃ f, Γ.IsSkEdgeIn f a + ∧ cap.emb '' f ⊆ closure r + +omit [T2Space S] in +/-- A cuff lies in `sk(Γ)`. -/ +theorem Painting.subset_skU_of_mem_bd (Γ : Painting S) {y : S} (hy : y ∈ bd S) : y ∈ Γ.skU := by + by_cases hyV : y ∈ Γ.V + · exact .inl (.inl hyV) + obtain ⟨c, hc, hyc⟩ := exists_arcComp_superset (F := Γ.U \ Γ.V) (isPathConnected_singleton y) + (singleton_subset_iff.2 ⟨Γ.bd_subset hy, hyV⟩) + have hyc' : y ∈ c := hyc rfl + exact .inl (.inr (mem_iUnion₂.mpr ⟨c, ⟨hc, (Γ.border_edge c hc ⟨y, hyc', hy⟩).1⟩, hyc'⟩)) + +omit [T2Space S] in +/-- **The disc of a cuff.** -/ +theorem exists_cuff_disc (hH : IsSkHat cap Γ H) {Θ : Set S} + (hΘ : Θ ∈ cuffs S) {N₀ : Set S} (hN : N₀ ⊆ Θ ∩ Γ.V) (hfin : N₀.Finite) + (hne : N₀.Nonempty) {a : Set S} (ha : a ∈ Γ.E) + (haΘ : a ⊆ Θ) : ∃ Δ, Δ ⊆ closure (cap.cuffDisc Θ) ∧ IsAnchoredDisc cap Γ H Δ (cap.emb '' N₀) a + := by + classical + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have hinj := cap.isEmbedding.injective + have hd := cap.cuffDisc_closedDisc Θ hΘ + have hb := cap.cuffDisc_bd Θ hΘ + have hNb : cap.emb '' N₀ ⊆ discBd (closure (cap.cuffDisc Θ)) := hb ▸ image_mono fun x hx => + (hN hx).1 + obtain ⟨Δ, hΔ, hsub, hcap, hbd⟩ := GM19.IsClosedDisc.exists_touching hd hNb (hfin.image _) + (hne.image _) + have hUc : ∀ x ∈ H.U, x ∈ closure (cap.cuffDisc Θ) → x ∈ cap.emb '' Θ := fun x hx hxc => by + rw [cap.closure_cuffDisc hΘ] at hxc + rcases hxc with h | h + · rw [hH.hU] at hx + obtain ⟨y, -, rfl⟩ := hx + exact absurd (mem_range_self y) (cap.notMem_range hΘ h) + · exact h + have hΘU : cap.emb '' Θ ⊆ H.U := fun x hx => by + obtain ⟨y, hy, rfl⟩ := hx + rw [hH.hU] + exact mem_image_of_mem _ (Γ.subset_skU_of_mem_bd (cuff_subset_bd ⟨Θ, hΘ⟩ hy)) + have hdint : Disjoint (cap.cuffDisc Θ) H.U := disjoint_left.mpr fun x hx hxU => by + have := hUc x hxU (subset_closure hx) + obtain ⟨y, -, rfl⟩ := this + exact cap.notMem_range hΘ hx (mem_range_self y) + have hconn : IsPreconnected (cap.cuffDisc Θ) := by + rw [cap.cuffDisc_eq_discInt hΘ] + exact hd.isPreconnected_discInt + have hinter : H.U ∩ Δ = cap.emb '' N₀ := by + ext x + constructor + · rintro ⟨hxU, hxΔ⟩ + rw [← hcap] + exact ⟨hxΔ, hb ▸ hUc x hxU (hsub hxΔ)⟩ + · intro hx + refine ⟨?_, (Surface.discBd_subset _ (hbd hx))⟩ + exact hΘU (image_mono (fun z hz => (hN hz).1) hx) + refine ⟨Δ, hsub, hΔ, hinter, ?_, hbd, ?_⟩ + · rw [hH.hV] + exact image_mono fun x hx => (hN hx).2 + · rintro r hr ⟨z, hzr, hzΔ⟩ + have hzU : z ∉ H.U := region_subset hr hzr + have hzc : z ∈ cap.cuffDisc Θ := by + have := hsub hzΔ + rw [cap.closure_cuffDisc hΘ] at this + exact this.resolve_right fun h => hzU (hΘU h) + have hsubr : cap.cuffDisc Θ ⊆ r := subset_region hr hconn hdint hzc hzr + have hcl : closure (cap.cuffDisc Θ) ⊆ closure r := closure_mono hsubr + have hΘr : cap.emb '' Θ ⊆ closure r := fun x hx => hcl (Surface.discBd_subset _ (hb.symm ▸ hx)) + obtain ⟨y, hy⟩ := ha.1 + exact ⟨(image_mono fun x hx => (hN hx).1).trans hΘr, a, ⟨ha, .inl ⟨(Γ.border_edge a ha ⟨y, + hy, cuff_subset_bd ⟨Θ, hΘ⟩ (haΘ hy)⟩).1, rfl⟩⟩, (image_mono haΘ).trans hΘr⟩ + +/-- **A disc beside an edge of a drawing.** In a thin disc around the edge we take an arc on one +side with the same ends. The edge and the arc bound a disc, and a smaller disc touches its boundary +in the two ends. -/ +theorem Drawing.exists_disc_beside_edge {T : Type} [TopologicalSpace T] [T2Space T] + (hT : IsClosedSurface T) (G : Drawing T) {e : Set T} (he : e ∈ G.E) {a b : T} + (hL : IsLineWithEnds (closure e) a b) (hab : a ≠ b) + (hV : closure e ∩ G.V = {a, b}) {U : Set T} (hUo : IsOpen U) (hsub : closure e ⊆ U) : + ∃ Δ, IsClosedDisc Δ ∧ Δ ⊆ U ∧ G.U ∩ Δ = {a, b} ∧ ({a, b} : Set T) ⊆ discBd Δ ∧ ∀ r ∈ G.R, + (r ∩ Δ).Nonempty → closure e ⊆ closure r := by + classical + have ha : a ∈ closure e ∩ G.V := hV ▸ .inl rfl + have hb : b ∈ closure e ∩ G.V := hV ▸ .inr rfl + let Z : Set T := G.V ∪ (⋃ f ∈ G.E \ {e}, closure f) ∪ Uᶜ + have hZ : IsClosed Z := (G.finite_V.isClosed.union ((G.finite_edges.subset + sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure)).union hUo.isClosed_compl + have heV : Disjoint e G.V := disjoint_left.mpr fun x hx => (he.2.1 hx).2 + have hcl : closure e ⊆ e ∪ {a, b} := fun x hx => by + by_cases hxV : x ∈ G.V + · exact .inr (hV ▸ ⟨hx, hxV⟩) + · exact .inl ((G.closure_diff_V he).subset ⟨hx, hxV⟩) + have hLZ : closure e ∩ Z ⊆ {a, b} := by + rintro x ⟨hx, (hxV | hxf) | hxU⟩ + · exact hV ▸ ⟨hx, hxV⟩ + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hxf + by_contra hn + have hxe : x ∈ e := (hcl hx).resolve_right hn + have hxV : x ∉ G.V := disjoint_left.mp heV hxe + have hxf' : x ∈ f := (G.closure_diff_V hf.1).subset ⟨hxf, hxV⟩ + exact hf.2 (G.edge_eq_of_mem hf.1 he hxf' hxe) + · exact absurd (hsub hx) hxU + have hUZ : G.U ⊆ Z ∪ e := fun x hx => by + by_cases hxV : x ∈ G.V + · exact .inl (.inl (.inl hxV)) + obtain ⟨f, hf, hxf⟩ := G.exists_edge_of_mem hx hxV + by_cases hfe : f = e + · exact .inr (hfe ▸ hxf) + · exact .inl (.inl (.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfe⟩, subset_closure hxf⟩))) + have hLU : closure e ⊆ G.U := G.closure_subset_U he + obtain ⟨D, A, B, hD, hLD, hDZ, -, -, -, hDe, hAc, hBc, -, -, hAL, hBL, hLA, hLB, ⟨p, hpD, hp₀⟩, + -⟩ := exists_edge_lens hT hL hab hZ hLZ + obtain ⟨g, hgc, hgi, hg0, hg1, hgr⟩ := exists_arc_of_path (γ := p) p.continuous + (by simpa using hab) + rw [p.source] at hg0 + rw [p.target] at hg1 + have hI : IsLineWithEnds (range g) a b := by + have := IsArcMap.isLineWithEnds (⟨hgc, hgi⟩ : IsArcMap g) + rwa [hg0, hg1] at this + have hcapL : closure e ∩ range g ⊆ {a, b} := by + rintro x ⟨hxL, hxI⟩ + obtain ⟨t, rfl⟩ := hgr hxI + by_cases h₀ : t = 0 + · exact .inl (by rw [h₀, p.source]) + by_cases h₁ : t = 1 + · exact .inr (mem_singleton_iff.mpr (by rw [h₁, p.target])) + exact absurd hxL (disjoint_left.mp hAL (hp₀ t (unitInterval.pos_iff_ne_zero.mpr h₀) + (unitInterval.lt_one_iff_ne_one.mpr h₁))) + have hFo : IsOArc (closure e ∪ range g) := GM11.isOArc_union hL hI hcapL + have hFD : closure e ∪ range g ⊆ D := union_subset hLD (hgr.trans hpD) + obtain ⟨E, ⟨hEsub, hEd, hEb, -⟩, -⟩ := disc_oArc D _ hD hFD hFo + have hNb : ({a, b} : Set T) ⊆ discBd E := by + rw [hEb] + rintro x (rfl | hx) + · exact .inl ha.1 + · rw [mem_singleton_iff.mp hx] + exact .inl hb.1 + obtain ⟨Δ, hΔ, hsubE, hcap, hbd⟩ := GM19.IsClosedDisc.exists_touching hEd hNb (toFinite _) + (insert_nonempty _ _) + have hΔD : Δ ⊆ D := hsubE.trans hEsub + have hmem : ∀ x ∈ ({a, b} : Set T), x ∈ closure e := by + rintro x (rfl | hx) + · exact ha.1 + · rw [mem_singleton_iff.mp hx] + exact hb.1 + have hoff : ∀ X : Set T, X ⊆ D → Disjoint X (closure e) → Disjoint X G.U := fun X hXD hX + => disjoint_left.mpr fun x hx hxU => by + rcases hUZ hxU with hxZ | hxe + · exact disjoint_left.mp hX hx (hmem x (hDZ ⟨hXD hx, hxZ⟩)) + · exact disjoint_left.mp hX hx (subset_closure hxe) + refine ⟨Δ, hΔ, fun x hx => ?_, ?_, hbd, ?_⟩ + · by_contra hxU + exact hxU (hsub (hmem x (hDZ ⟨hΔD hx, .inr hxU⟩))) + · ext x + constructor + · rintro ⟨hxU, hxΔ⟩ + rcases hUZ hxU with hxZ | hxe + · exact hDZ ⟨hΔD hxΔ, hxZ⟩ + · rw [← hcap] + exact ⟨hxΔ, hEb ▸ .inl (subset_closure hxe)⟩ + · intro hx + exact ⟨hLU (hmem x hx), Surface.discBd_subset _ (hbd hx)⟩ + · rintro r hr ⟨z, hzr, hzΔ⟩ + have hzU : z ∉ G.U := region_subset hr hzr + have hAB : z ∈ A ∨ z ∈ B := by + have hzD := hΔD hzΔ + rw [hDe] at hzD + rcases hzD with (h | h) | h + · exact .inl h + · exact .inr h + · exact absurd (hLU h) hzU + rcases hAB with hzA | hzB + · have hAD : A ⊆ D := by + rw [hDe] + exact fun x hx => .inl (.inl hx) + exact hLA.trans (closure_mono (subset_region hr hAc (hoff A hAD hAL) hzA hzr)) + · have hBD : B ⊆ D := by + rw [hDe] + exact fun x hx => .inl (.inr hx) + exact hLB.trans (closure_mono (subset_region hr hBc (hoff B hBD hBL) hzB hzr)) + +/-- **The disc of an edge of size 3.** -/ +theorem exists_three_disc (hH : IsSkHat cap Γ H) {c : Set S} (hc : c ∈ Γ.E) (h3 : (tilde c).ncard + = 3) : + ∃ Δ, Δ ⊆ cap.emb '' closure c ∧ IsAnchoredDisc cap Γ H Δ (cap.emb '' tilde c) c := by + classical + have : ConnectedSpace Shat := cap.connected + have hinj := cap.isEmbedding.injective + obtain ⟨hdisc, htb, htf⟩ := Γ.isDisc_of_three hc h3 + obtain ⟨hd, hb⟩ := isClosedDisc_image hdisc cap.isEmbedding + have htne : (tilde c).Nonempty := nonempty_of_ncard_ne_zero (by omega) + obtain ⟨Δ, hΔ, hsub, hcap, hbd⟩ := GM19.IsClosedDisc.exists_touching hd (hb ▸ image_mono htb) + (htf.image _) (htne.image _) + have hbU : discBd (closure c) ⊆ Γ.skU := fun x hx => .inr (mem_iUnion₂.mpr ⟨c, ⟨hc, h3⟩, hx⟩) + have hUbd : ∀ y ∈ Γ.skU, y ∈ closure c → y ∈ discBd (closure c) := fun y hy hyc => by + by_cases hyt : y ∈ tilde c + · exact htb hyt + have hyc' : y ∈ c := by + by_contra hn + exact hyt ⟨hyc, hn⟩ + rcases hy with (hyV | hy) | hy + · exact absurd hyV (Γ.disjoint_V hc hyc') + · obtain ⟨e, ⟨he, h2⟩, hye⟩ := mem_iUnion₂.mp hy + obtain rfl := GM11.arcComponent_eq he hc hye hyc' + omega + · obtain ⟨e, ⟨he, h3e⟩, hye⟩ := mem_iUnion₂.mp hy + have hdE := (Γ.isDisc_of_three he h3e).1 + have hyE : y ∈ closure e := Surface.discBd_subset _ hye + have hyn : y ∈ e := by + by_contra hn + exact Γ.disjoint_V hc hyc' (Γ.tilde_subset_V he ⟨hyE, hn⟩) + obtain rfl := GM11.arcComponent_eq he hc hyn hyc' + exact hye + have hdint : Disjoint (discInt (cap.emb '' closure c)) H.U := disjoint_left.mpr fun x hx hxU => by + rw [hH.hU] at hxU + obtain ⟨y, hy, rfl⟩ := hxU + obtain ⟨y', hy', e⟩ := id hx.1 + obtain rfl := hinj e + exact hx.2 (hb ▸ mem_image_of_mem _ (hUbd y' hy hy')) + have hinter : H.U ∩ Δ = cap.emb '' tilde c := by + ext x + constructor + · rintro ⟨hxU, hxΔ⟩ + rw [← hcap] + refine ⟨hxΔ, ?_⟩ + rw [hH.hU] at hxU + obtain ⟨y, hy, rfl⟩ := hxU + obtain ⟨y', hy', e⟩ := hsub hxΔ + obtain rfl := hinj e + exact hb ▸ mem_image_of_mem _ (hUbd y' hy hy') + · intro hx + refine ⟨?_, Surface.discBd_subset _ (hbd hx)⟩ + rw [hH.hU] + exact image_mono (fun y hy => hbU (htb hy)) hx + refine ⟨Δ, hsub, hΔ, hinter, ?_, hbd, ?_⟩ + · rw [hH.hV] + exact image_mono (Γ.tilde_subset_V hc) + · rintro r hr ⟨z, hzr, hzΔ⟩ + have hzU : z ∉ H.U := region_subset hr hzr + have hzint : z ∈ discInt (cap.emb '' closure c) := by + refine ⟨hsub hzΔ, fun hzb => hzU ?_⟩ + rw [hb] at hzb + rw [hH.hU] + exact image_mono hbU hzb + have hsubr := subset_region hr hd.isPreconnected_discInt hdint hzint hzr + have hcl : cap.emb '' closure c ⊆ closure r := by + have := closure_mono hsubr + rwa [closure_discInt hd] at this + obtain ⟨f, hf⟩ := Γ.exists_sk_in hc + exact ⟨(image_mono (fun y hy => Surface.discBd_subset _ (htb hy))).trans hcl, f, hf, + (image_mono hf.subset_closure).trans hcl⟩ + +/-- **The disc of an edge of size 2.** -/ +theorem exists_two_disc (hS : IsSurface S) (hH : IsSkHat cap Γ H) {c : Set S} (hc : c ∈ Γ.E) (h2 : + (tilde c).ncard = 2) {U : Set Shat} (hUo : IsOpen U) (hU : cap.emb '' closure c ⊆ U) : + ∃ Δ, Δ ⊆ U ∧ IsAnchoredDisc cap Γ H Δ (cap.emb '' tilde c) c := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hinj := cap.isEmbedding.injective + have hsk := Γ.two_mem_sk hc h2 + obtain ⟨u, v, huv, ht, htV, hL⟩ := Γ.sk_line hsk + have hE : cap.emb '' c ∈ H.E := hH.edge_iff.2 ⟨c, hsk, rfl⟩ + have hcl : closure (cap.emb '' c) = cap.emb '' closure c := (cap.isClosedEmbedding + hS).closure_image_eq c + have hne : cap.emb u ≠ cap.emb v := fun h => huv (hinj h) + have hV : closure (cap.emb '' c) ∩ H.V = {cap.emb u, cap.emb v} := by + rw [hcl, hH.hV, ← image_inter hinj] + have e : closure c ∩ Γ.V = {u, v} := by + rw [← ht] + ext y + exact ⟨fun h => ⟨h.1, fun hy => Γ.disjoint_V hc hy h.2⟩, fun h => ⟨h.1, htV h⟩⟩ + rw [e, image_pair] + obtain ⟨Δ, hΔ, hsub, hcap, hbd, hr⟩ := H.exists_disc_beside_edge hT hE + (hcl ▸ hL.map_of_embedding cap.isEmbedding) hne hV hUo (hcl ▸ hU) + have hN : cap.emb '' tilde c = {cap.emb u, cap.emb v} := by rw [ht, image_pair] + refine ⟨Δ, hsub, hΔ, by rwa [hN], hN ▸ (hV ▸ inter_subset_right), + by rwa [hN], fun r hr' hz => ?_⟩ + have hcr := hr r hr' hz + have hsubc : cap.emb '' tilde c ⊆ closure (cap.emb '' c) := by + rw [hcl] + exact image_mono fun y hy => hy.1 + exact ⟨hsubc.trans hcr, c, ⟨hc, .inl ⟨h2, rfl⟩⟩, subset_closure.trans hcr⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15m.lean b/LeanPool/GraphMinor/GM19/Section15m.lean new file mode 100644 index 0000000000..b816908458 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15m.lean @@ -0,0 +1,172 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section15l +public import LeanPool.GraphMinor.GM19.Spokes + +/-! +# Graph Minors XIX, (15.2): a radial drawing of the skeleton + +The proof of (15.2) compares the metric of `Γ` with the metric of `sk(Γ)` in the sense of Graph +Minors XI. For this we need a radial drawing `G₃` of `sk(Γ)` that contains the radial drawing of +`Γ`, and we need that `G₃` has no more spokes than `Γ*` in the +regions of `Γ`. The paper does not say this. The reason is that a spoke of `G₃` in a region of `Γ` +could be added to `Γ*`, and `Γ*` is maximal (`RadialDrawing.mem_of_extension`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 GraphMinor.GM14 Hypergraph + +/-- A spoke that bounds no disc with another spoke can be added to a maximal pre-radial drawing, so +it is already there. The proof follows `exists_spoke_of_line`. -/ +theorem mem_of_spoke_line {T : Type} [TopologicalSpace T] [T2Space T] {U V : Set T} {G : Drawing T} + (hpre : IsPreRadial U V G) + (hmax : ∀ G' : Drawing T, IsPreRadial U V G' → G.IsSubdrawing G' → G'.IsSubdrawing G) + {r : Set T} {c x : T} (hcr : c ∈ r) (hc : c ∈ G.V) (hx : x ∈ V) + {K : Set T} (hK : IsLineWithEnds K c x) (hcx : c ≠ x) (hKr : K \ {c, x} ⊆ r) + (hKU : Disjoint (K \ {c, x}) G.U) (hrU : Disjoint r U) (hVU : V ⊆ U) + (hiv : ∀ f ∈ G.E, K \ {c, x} ≠ f → ∀ v ∈ V, ∀ r' ∈ componentsIn Uᶜ, ∀ w ∈ r' ∩ G.V, + K ∩ G.V = {v, w} → closure f ∩ G.V = {v, w} → + ¬ ∃ Δ : Set T, IsClosedDisc Δ ∧ Δ ⊆ r' ∪ {v} ∧ subBd Δ = K ∪ closure f) : + K \ {c, x} ∈ G.E := by + exact mem_spoke_line_of_no_bounded_disc hpre hmax hcr hc hx hK hcx hKr hKU hrU hVU hiv + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] + +omit [T2Space S] in +/-- **A spoke of a radial drawing of `sk(Γ)` in a region of `Γ` is already a spoke of `Γ*`.** -/ +theorem RadialDrawing.mem_of_extension {cap : IsCappedSurface S Shat} {Γ : Painting S} + (rad : RadialDrawing cap Γ) {H G₃ : Drawing Shat} (hH : IsSkHat cap Γ H) + (hpre : PreRad (PaintingOrDrawing.drawing H) G₃) (hsub : rad.G.IsSubdrawing G₃) {e r : Set + Shat} (he : e ∈ G₃.E) (hr : r ∈ Γ.hatRegions cap) (her : e ⊆ r) : e ∈ rad.G.E := by + classical + have hT := cap.isClosedSurface + have : T2Space Shat := hT.2.1 + by_contra heG + have hhat : ∀ x ∈ Γ.hatRegions cap, Disjoint x (Γ.hatU cap) := by + rintro _ ⟨y, hy, rfl⟩ + exact disjoint_left.mpr fun z hz hzU ↦ connectedComponentIn_subset _ _ hz hzU + have hrH := hH.hatRegion_mem_R hr + obtain ⟨v, hv, r', hr', w, hw, hwV, hset, hsubr⟩ := GM11.spoke_ends hpre hT he + have hrr : r' = r := by + obtain ⟨y, hy⟩ := he.1 + exact GM11.region_eq_of_mem hr' hrH (hsubr hy) (her hy) + subst hrr + obtain ⟨w₀, ⟨hw₀r, hw₀⟩, -⟩ := rad.isPreRadial.2.2.1 r' hr + have hww : w = w₀ := (hpre.2.2.2.1 r' hrH).unique ⟨hw, hwV⟩ ⟨hw₀r, hsub.1 hw₀⟩ + subst hww + have hvhat : v ∈ Γ.hatV cap := by + rw [hH.hV] at hv + exact hv + have hwv : w ≠ v := fun h => GM11.region_subset hr' hw (H.V_subset_U (h ▸ hv)) + have hK : IsLineWithEnds (closure e) w v := + GM11.isLine_closure he hwv (by rwa [pair_comm]) + have heV : ∀ y ∈ e, y ∉ G₃.V := fun y hy => (he.2.1 hy).2 + have hKsd : closure e \ {w, v} = e := by + apply Subset.antisymm + · rintro y ⟨hy, hyn⟩ + rcases closure_edge_subset he hy with h₁ | h₁ + · exact h₁ + · have h₂ : y ∈ closure e ∩ G₃.V := ⟨hy, h₁⟩ + rw [hset] at h₂ + exact absurd (show y ∈ ({w, v} : Set Shat) by rw [pair_comm]; exact h₂) hyn + · intro y hy + refine ⟨subset_closure hy, fun hyn => heV y hy ?_⟩ + rcases hyn with rfl | hyn + · exact hwV + · rw [mem_singleton_iff.mp hyn] + exact hpre.2.2.1 hv + have hKU : Disjoint (closure e \ {w, v}) rad.G.U := by + rw [hKsd] + refine disjoint_left.mpr fun y hy hyG ↦ ?_ + have hyV : y ∉ rad.G.V := fun hc ↦ heV y hy (hsub.1 hc) + obtain ⟨f, hf, hyf⟩ := exists_arcComp_superset (F := rad.G.U \ rad.G.V) + (isPathConnected_singleton y) (singleton_subset_iff.2 ⟨hyG, hyV⟩) + exact heG (arcComp_eq_of_mem he (hsub.2 hf) hy (hyf rfl) ▸ hf) + have hKV : closure e ∩ rad.G.V = closure e ∩ G₃.V := by + apply Subset.antisymm (inter_subset_inter_right _ hsub.1) + rw [hset] + rintro y (rfl | hyn) + · exact ⟨(hset ▸ (.inl rfl : y ∈ ({y, w} : Set Shat)) : y ∈ closure e ∩ G₃.V).1, + rad.isPreRadial.2.1 hvhat⟩ + · rw [mem_singleton_iff.mp hyn] + exact ⟨(hset ▸ (.inr rfl : w ∈ ({v, w} : Set Shat)) : w ∈ closure e ∩ G₃.V).1, hw₀⟩ + have hmem := mem_of_spoke_line rad.isPreRadial rad.maximal hw hw₀ hvhat hK hwv + (by rwa [hKsd]) hKU (hhat _ hr) (image_mono Γ.V_subset) ?_ + · rw [hKsd] at hmem + exact heG hmem + rw [hKsd] + intro f hf hef v' hv' r₂ hr₂ w' hw' hee hfe hΔ + have hv'H : v' ∈ H.V := by + rw [hH.hV] + exact hv' + have hr₂H := hH.hatRegion_mem_R hr₂ + have hee' : closure e ∩ G₃.V = {v', w'} := hKV ▸ hee + have hfe' : closure f ∩ G₃.V = {v', w'} := by + obtain ⟨v₂, hv₂, w₂, ⟨hw₂V, hw₂n⟩, hc⟩ := hpre.2.2.2.2.2.1 f (hsub.2 hf) + have h₁ : v' ∈ closure f ∩ G₃.V := by + have : v' ∈ closure f ∩ rad.G.V := hfe ▸ .inl rfl + exact ⟨this.1, hsub.1 this.2⟩ + have h₂ : w' ∈ closure f ∩ G₃.V := by + have : w' ∈ closure f ∩ rad.G.V := hfe ▸ .inr rfl + exact ⟨this.1, hsub.1 this.2⟩ + have hw'H : w' ∉ H.V := fun h => GM11.region_subset hr₂H hw'.1 (H.V_subset_U h) + rw [hc] at h₁ h₂ ⊢ + have e₁ : v' = v₂ := h₁.resolve_right fun h => hw₂n (mem_singleton_iff.mp h ▸ hv'H) + have e₂ : w' = w₂ := h₂.resolve_left fun h => hw'H (h ▸ hv₂) + rw [e₁, e₂] + exact hpre.2.2.2.2.2.2 e he f (hsub.2 hf) hef v' hv'H r₂ hr₂H w' ⟨hw'.1, + hsub.1 hw'.2⟩ hee' hfe' hΔ + +omit [T2Space S] in +/-- **A radial drawing of `sk(Γ)` that extends `Γ*`.** -/ +theorem TangleDatum.exists_skData {α : Type w} {χ : ColourScheme S α} {cap : IsCappedSurface S + Shat} (D : TangleDatum cap χ) (h2 : ∀ r ∈ D.P.Γ.hatRegions cap, IsOpenDisc r) : + ∃ H G₃, D.SkData H G₃ := by + classical + have hS := χ.isSurface + have hT := cap.isClosedSurface + have : T2Space Shat := hT.2.1 + have : ConnectedSpace Shat := cap.connected + obtain ⟨H, W, hDU, hDV, hD2, -, hG'⟩ := D.P.Γ.exists_hubDrawing hS cap h2 + have hD : IsSkHat cap D.P.Γ H := ⟨hDU, hDV⟩ + obtain ⟨G', hpre, hU', hV', hE'⟩ := hG' D.rad.G D.rad.isPreRadial + have hGsub : D.rad.G.IsSubdrawing G' := ⟨by rw [hV']; exact subset_union_left, by rw [hE']⟩ + let A : Set ℕ := {n | ∃ G₄ : Drawing Shat, (GM11.PaintingOrDrawing.drawing H).IsPreRadialDrawing + G₄ ∧ G'.IsSubdrawing G₄ ∧ G₄.E.ncard = n} + have hAne : A.Nonempty := ⟨_, G', hpre, ⟨subset_rfl, subset_rfl⟩, rfl⟩ + have hAb : BddAbove A := ⟨H.V.ncard + 2 * H.E.ncard, by + rintro _ ⟨G₄, h₄, -, rfl⟩ + exact GM11.ncard_spokes_le (Γ := H) (Γ' := G₄) ⟨hD2, h₄⟩ hT⟩ + obtain ⟨G₃, hpre₃, hsub₃, hc₃⟩ := Nat.sSup_mem hAne hAb + have hrad : GM11.PreRad (GM11.PaintingOrDrawing.drawing H) G₃ := ⟨hD2, hpre₃⟩ + have hmax : GM11.RadMax (GM11.PaintingOrDrawing.drawing H) G₃ := by + intro G₄ h₄ hs + refine ⟨fun y hy ↦ ?_, ?_⟩ + · by_cases hyV : y ∈ H.V + · exact hpre₃.2.1 hyV + obtain ⟨p, hp, hyp⟩ := h₄.2.2.2.1 y ⟨hy, hyV⟩ + obtain ⟨y', ⟨hy'p, hy'⟩, -⟩ := hpre₃.2.2.1 p hp + rw [(h₄.2.2.1 p hp).unique ⟨hyp, hy⟩ ⟨hy'p, hs.1 hy'⟩] + exact hy' + · have hle : G₄.E.ncard ≤ G₃.E.ncard := by + rw [hc₃] + exact le_csSup hAb ⟨G₄, h₄, ⟨hsub₃.1.trans hs.1, hsub₃.2.trans hs.2⟩, rfl⟩ + exact (eq_of_subset_of_ncard_le hs.2 hle G₄.finite_edges).ge + have hsub : D.rad.G.IsSubdrawing G₃ := ⟨hGsub.1.trans hsub₃.1, hGsub.2.trans hsub₃.2⟩ + exact ⟨H, G₃, hD, hrad, hmax, hsub, fun e he r hr her => D.rad.mem_of_extension hD hrad hsub + he hr her⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15n.lean b/LeanPool/GraphMinor/GM19/Section15n.lean new file mode 100644 index 0000000000..e444c76ddd --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15n.lean @@ -0,0 +1,370 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section15m + +/-! +# Graph Minors XIX, (15.2): the ends of the edges `β(e)` + +We collect what step (1) of the proof of (15.2) says about the ends of the edges `β(e)`, once the +first and second outcomes of (15.2) are excluded. Two edges `β(e)`, `β(e')` with `e ≠ e'` have no +common end, unless `e` and `e'` are short sides +(`no_common_end`). The paper uses this in step (2), and we use it to show that the sets `Z_v` of +(3.2) of Graph Minors XII are disjoint. A short side has the same direction in `Γ₀` and in `Γ` +(`short_γ_eq`), so in that last case the two ends belong to the same vertex. +The sets `Z_v` are `TangleDatum.endClass`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 GraphMinor.GM14 Hypergraph + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +omit [T2Space S] in +/-- The length of `γ(e)` is the size of `e`. -/ +theorem Painting.length_γ_eq (Γ : Painting S) {c : Set S} (hc : c ∈ Γ.E) : (Γ.γ c).length = + (tilde c).ncard := by + classical + have e : tilde c = ↑(Γ.γ c).toFinset := by + rw [← Γ.γ_set c hc] + ext + simp + rw [e, Set.ncard_coe_finset, List.toFinset_card_of_nodup (Γ.γ_nodup c hc)] + +omit [T2Space S] in +/-- A short side has the direction of the frame in every painting that fits the frame. -/ +theorem short_γ_eq (P : ColouredPainting χ) {s : Set S} + (hs : s ∈ χ.Φ.shortSides) : P.Γ.γ s = χ.Φ.γ s := by + classical + have hE := P.fits.short_sides hs + obtain ⟨x, hx⟩ : s.Nonempty := hE.1 + have hB : Painting.IsBorder s := ⟨x, hx, (hs.1.2.1 hx).1⟩ + obtain ⟨f, t₁, t₂, hlt, -, h₁, h₂, h₃, h₄⟩ := P.fits.border_dir s hE hB s hs.1 Subset.rfl + have hl₁ : (P.Γ.γ s).length = 2 := by + rw [P.Γ.length_γ_eq hE] + exact (P.Γ.border_edge s hE hB).1 + have hl₂ : (χ.Φ.γ s).length = 2 := by + have h2 := (P.Γ.border_edge s hE hB).1 + have e : tilde s = ↑(χ.Φ.γ s).toFinset := by + rw [← χ.Φ.γ_set s hs.1] + ext + simp + rw [e, Set.ncard_coe_finset, List.toFinset_card_of_nodup (χ.Φ.γ_nodup s hs.1)] at h2 + exact h2 + obtain ⟨a', b', ha⟩ := List.length_eq_two.mp hl₁ + obtain ⟨a, b, hb⟩ := List.length_eq_two.mp hl₂ + have hset : ∀ y, y ∈ tilde s → y = a ∨ y = b := fun y hy => by + have : y ∈ {v | v ∈ χ.Φ.γ s} := by rwa [χ.Φ.γ_set s hs.1] + simpa [hb] using this + have hset' : ∀ y, y ∈ P.Γ.γ s → y ∈ tilde s := fun y hy => by + have : y ∈ {v | v ∈ P.Γ.γ s} := hy + rwa [P.Γ.γ_set s hE] at this + rw [ha] at h₃ h₄ hset' + rw [hb] at h₁ h₂ + simp only [List.head?_cons, List.getLast?_cons_cons, List.getLast?_singleton, + Option.some.injEq] at h₁ h₂ h₃ h₄ + have hinj : Function.Injective fun t => (f t).1 := Subtype.val_injective.comp f.injective + have ht₁ : a' = a := by + rcases hset a' (hset' a' (by simp)) with h | h + · exact h + · exfalso + rw [h₃, h₂] at h + have := hinj h + have h' : t₂.1 ≤ 1 := t₂.2.2 + have h'' : t₁.1 < t₂.1 := hlt + rw [this] at h'' + simp only at h'' + linarith + have ht₂ : b' = b := by + rcases hset b' (hset' b' (by simp)) with h | h + · exfalso + rw [h₄, h₁] at h + have := hinj h + have h' : 0 ≤ t₁.1 := t₁.2.1 + have h'' : t₁.1 < t₂.1 := hlt + rw [this] at h'' + simp only at h'' + linarith + · exact h + rw [ha, hb, ht₁, ht₂] + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {P₀ : ColouredPainting χ} {n : ℕ} {b : Set S → Set S} + +/-- What we know about `β` in the proof of (15.2) once the first and second outcomes are excluded. +-/ +structure IsMatchSetting (D : TangleDatum cap χ) (P₀ : ColouredPainting χ) (n : ℕ) (b : Set S + → Set S) : Prop where + edge : D.IsEdgeMap P₀ n b + large : 16 ≤ n + rep_gt : n < D.rep + free : ∀ C, ¬ D.IsFreeCircuit n C + far : ∀ r₁ ∈ D.rad.poles, ∀ r₂ ∈ D.rad.poles, r₁ ≠ r₂ → n < D.vDist r₁ r₂ + +/-- An edge with an end on a cuff is close to the pole of the cuff. -/ +theorem edgeVertDist_pole_le (hS : IsSurface S) (hrep : 4 ≤ D.rep) {c : Set S} + (hc : c ∈ D.P.Γ.E) {y : S} (hy : y ∈ tilde c) {Θ : Set S} (hΘ : Θ ∈ cuffs S) + (hyΘ : y ∈ Θ) {p : Shat} (hp : p ∈ D.rad.poles) + (hreg : D.rad.regionOf p = cap.cuffDisc Θ) : D.edgeVertDist c p ≤ 4 := by + have h3 := D.P.fits.internally_three_connected + have hyV := D.P.Γ.tilde_subset_V hc hy + obtain ⟨e, he, hs⟩ := D.rad.exists_pole_edge hS h3 hp hΘ hreg hyV hyΘ + have hl : D.rad.G.toGraph.IsLink e (cap.emb y) p := ⟨he, D.rad.isPreRadial.2.1 + (mem_image_of_mem _ hyV), hp.1.1, hs⟩ + let W : GraphWalk D.rad.G.toGraph (cap.emb y) p := .cons hl (.nil hp.1.1) + have h₁ : D.dist (D.rad.atomOf (cap.emb y)) (D.rad.atomOf p) ≤ 1 := + D.dist_atomOf_le_of_walk W (by change 1 < _; omega) + rw [D.atomOf_emb hyV] at h₁ + have h₂ := D.edgeVertDist_self_le hrep hc hy hyV + unfold edgeVertDist at h₂ ⊢ + rw [D.atomOf_emb hyV] at h₂ + have h₃ := D.dist_triangle hrep (a := cap.emb '' c) (c := D.rad.atomOf p) (b := {cap.emb y}) + (Or.inl (Or.inl ⟨y, hyV, rfl⟩)) + omega + +/-- Two edges with a common end are close. -/ +theorem edgeDist_le_of_common_end (hrep : 4 ≤ D.rep) {c c' : Set S} (hc : c ∈ D.P.Γ.E) + (hc' : c' ∈ D.P.Γ.E) {y : S} (hy : y ∈ tilde c) (hy' : y ∈ tilde c') : D.edgeDist c c' ≤ 6 := by + have hyV := D.P.Γ.tilde_subset_V hc hy + have h₁ := D.edgeVertDist_self_le hrep hc hy hyV + have h₂ := D.edgeVertDist_self_le hrep hc' hy' hyV + unfold edgeVertDist at h₁ h₂ + rw [D.atomOf_emb hyV] at h₁ h₂ + have h₃ := D.dist_triangle hrep (a := cap.emb '' c) (c := cap.emb '' c') (b := {cap.emb y}) + (Or.inl (Or.inl ⟨y, hyV, rfl⟩)) + rw [D.dist_comm {cap.emb y} (cap.emb '' c')] at h₃ + unfold edgeDist + omega + +/-- Two edges on a cuff with a common end are close along the cuff. -/ +theorem IsSideSetting.borderEdgeDist_le_of_common_end {side Θ : Set S} {r : Shat} {N : ℕ} + (X : D.IsSideSetting side Θ r N) (hS : IsSurface S) (hN : 6 ≤ N) {t₁ t₂ : Set S} + (h₁ : t₁ ∈ D.P.Γ.E) (h₂ : t₂ ∈ D.P.Γ.E) + (h₁Θ : t₁ ⊆ Θ) (h₂Θ : t₂ ⊆ Θ) {z : S} (hz₁ : z ∈ closure t₁) (hz₂ : z ∈ closure t₂) : + D.borderEdgeDist r t₁ t₂ ≤ 6 := by + have hΘcl : IsClosed Θ := ((cuff_statement S hS).2.2 Θ X.cuff).isCompact.isClosed + have hrep : 4 ≤ D.rep := by + have := X.rep_gt + omega + obtain ⟨G₁, hG₁, h₆₁, hs₁⟩ := exists_bite_of_edge (by omega) hrep X.free X.long X.side_cuff + X.cuff X.pole X.reg h₁ h₁Θ + obtain ⟨G₂, hG₂, h₆₂, hs₂⟩ := exists_bite_of_edge (by omega) hrep X.free X.long X.side_cuff + X.cuff X.pole X.reg h₂ h₂Θ + have key : ∀ {G : Drawing Shat} {t : Set S}, D.IsBiteAt r G → cap.emb '' t ⊆ D.ins G + → z ∈ closure t → cap.emb z ∈ D.ins G := fun {G t} hG hs hz => by + refine closure_minimal hs (D.ins_spec hG.is_circuit hG.card_lt).2.2.1.isClosed ?_ + rw [(cap.isClosedEmbedding hS).closure_image_eq t] + exact mem_image_of_mem _ hz + have hzΘ : cap.emb z ∈ cap.emb '' Θ := mem_image_of_mem _ (closure_minimal h₁Θ hΘcl hz₁) + obtain ⟨C, hC, hC₂, hC₃, hC₄⟩ := X.exists_bite_superset hS hG₁ hG₂ (by omega) hzΘ + (key hG₁ hs₁ hz₁) (key hG₂ hs₂ hz₂) + have := D.borderEdgeDist_le_of_bite hC (hs₁.trans hC₃) (hs₂.trans hC₄) + omega + +variable (hM : D.IsMatchSetting P₀ n b) +include hM + +omit [T2Space S] in +/-- A setting for each cuff that holds a long side. -/ +theorem IsMatchSetting.setting {side Θ : Set S} (hside : side ∈ χ.Φ.longSides) + (hsΘ : side ⊆ Θ) (hΘ : Θ ∈ cuffs S) {r : Shat} (hr : r ∈ D.rad.poles) (hreg : D.rad.regionOf r + = cap.cuffDisc Θ) : D.IsSideSetting side Θ r n := + ⟨D.P.fits.internally_three_connected, hside, hsΘ, hΘ, hr, hreg, hM.rep_gt, hM.far, hM.free⟩ + +/-- The image of a border edge on a long side has no end in common with an edge on the same cuff +that is the image of another edge on the side, or a short side. -/ +theorem IsMatchSetting.no_common_end_long (hS : IsSurface S) {e : Set S} + (he : e ∈ P₀.Γ.E) {s Θ : Set S} (hs : s ∈ χ.Φ.longSides) (hsΘ : s ⊆ Θ) (hΘ : Θ ∈ cuffs S) + (hes : e ⊆ s) {t : Set S} + (ht : (∃ e' ∈ P₀.Γ.E, e' ≠ e ∧ e' ⊆ s ∧ t = b e') ∨ (t ∈ χ.Φ.shortSides ∧ t ⊆ Θ)) {y : S} + (hy : y ∈ closure (b e)) (hyt : y ∈ closure t) : False := by + obtain ⟨m, f, g, c, r', u₀, u₁, u₀', u₁', hM'⟩ := hM.edge.side s hs + obtain ⟨x, hx⟩ : e.Nonempty := he.1 + have hcE : c = Θ := cuffs_eq_of_mem hM'.cuff hΘ (hM'.side_cuff (hes hx)) (hsΘ (hes hx)) + rw [hcE] at hM' + obtain ⟨r, hr, -, hreg⟩ := D.rad.exists_pole hΘ + have hrE : r' = r := pole_eq_of_mem_cuffDisc hr hΘ hreg hM'.pole hM'.pole_disc + rw [hrE] at hM' + have X := hM.setting hs hsΘ hΘ hr hreg + have hn := hM.large + obtain ⟨i, rfl⟩ := hM'.all₀ e he hes + have hgi := hM'.map i + have hbm := hM.edge.mem _ he + have hbΘ : b (f i) ⊆ Θ := hgi ▸ (hM'.order.2.2.2.1 i).2.trans hsΘ + rcases ht with ⟨e', he', hne, hes', rfl⟩ | ⟨hts, htΘ⟩ + · obtain ⟨j, rfl⟩ := hM'.all₀ e' he' hes' + have hgj := hM'.map j + have hbΘ' : b (f j) ⊆ Θ := hgj ▸ (hM'.order.2.2.2.1 j).2.trans hsΘ + have hij : i ≠ j := fun h => hne (by rw [h]) + have h₁ := X.borderEdgeDist_le_of_common_end hS (by omega) hbm (hM.edge.mem _ he') hbΘ hbΘ' hy + hyt + rcases lt_or_gt_of_ne hij with h | h + · have h₂ := hM'.far i j h + rw [← hgi, ← hgj] at h₂ + omega + · have h₂ := hM'.far j i h + rw [← hgi, ← hgj] at h₂ + have h₃ := X.borderEdgeDist_le_of_common_end hS (by omega) (hM.edge.mem _ he') hbm hbΘ' hbΘ + hyt hy + omega + · have h₁ := X.borderEdgeDist_le_of_common_end hS (by omega) hbm (D.P.fits.short_sides hts) hbΘ + htΘ hy hyt + have h₂ := hM'.far_short i t hts htΘ + rw [← hgi] at h₂ + omega + +/-- A border edge of `Γ₀`, and its image, lie on one side, and the side lies on one cuff. -/ +theorem IsMatchSetting.exists_cuff_of_border (hS : IsSurface S) {e : Set S} (he : e ∈ P₀.Γ.E) + (hB : Painting.IsBorder e) : + ∃ s ∈ χ.Φ.sides, ∃ Θ ∈ cuffs S, s ⊆ Θ ∧ e ⊆ s ∧ b e ⊆ s ∧ (s ∉ χ.Φ.longSides → b e = s) := by + obtain ⟨s, hs, hes, -, -⟩ := hM.edge.border he hB + obtain ⟨Θ, hΘ, hsΘ, -⟩ := χ.Φ.side_on_cuff hS hs + obtain ⟨s', hs', hs'Θ, hes', hbs', hsh⟩ := exists_side_of_cuffEnds hS hM.edge hΘ he + (hes.trans hsΘ) + exact ⟨s', hs', Θ, hΘ, hs'Θ, hes', hbs', hsh⟩ + +/-- The image of an internal edge has no end on a cuff. -/ +theorem IsMatchSetting.not_mem_cuff_of_internal (hS : IsSurface S) {e : Set S} (he : e ∈ P₀.Γ.E) + (hi : Painting.IsInternal e) {y : S} (hy : y ∈ tilde (b e)) {Θ : Set S} + (hΘ : Θ ∈ cuffs S) : y ∉ Θ := by + intro hyΘ + obtain ⟨r, hr, -, hreg⟩ := D.rad.exists_pole hΘ + have hrep : 4 ≤ D.rep := by + have := hM.rep_gt + have := hM.large + omega + have h₁ := edgeVertDist_pole_le hS hrep (hM.edge.mem e he) hy hΘ hyΘ hr hreg + have h₂ := hM.edge.pole_far e he hi r hr + have := hM.large + omega + +/-- **Common ends.** If `e ≠ e'`, then `β(e)` and `β(e')` have no common end, unless `e` and `e'` +are short sides. -/ +theorem IsMatchSetting.no_common_end (hS : IsSurface S) {e e' : Set S} (he : e ∈ P₀.Γ.E) + (he' : e' ∈ P₀.Γ.E) (hne : e ≠ e') {y : S} (hy : y ∈ tilde (b e)) (hy' : y ∈ tilde (b e')) : + e ∈ χ.Φ.shortSides ∧ e' ∈ χ.Φ.shortSides := by + classical + have hn := hM.large + have hrep : 4 ≤ D.rep := by + have := hM.rep_gt + omega + have hbd : IsClosed (bd S) := (cuff_statement S hS).1 + have hcl : ∀ {Θ}, Θ ∈ cuffs S → IsClosed Θ := fun hΘ => ((cuff_statement S hS).2.2 _ + hΘ).isCompact.isClosed + by_cases hi : Painting.IsInternal e + · by_cases hi' : Painting.IsInternal e' + · have h₁ := edgeDist_le_of_common_end hrep (hM.edge.mem e he) (hM.edge.mem e' he') hy hy' + have h₂ := hM.edge.far e he hi e' he' hi' hne + omega + · obtain ⟨s, -, Θ, hΘ, hsΘ, -, hbs, -⟩ := hM.exists_cuff_of_border hS he' + (not_disjoint_iff_nonempty_inter.mp hi') + exact absurd (closure_minimal (hbs.trans hsΘ) (hcl hΘ) hy'.1) (hM.not_mem_cuff_of_internal hS + he hi hy hΘ) + by_cases hi' : Painting.IsInternal e' + · obtain ⟨s, -, Θ, hΘ, hsΘ, -, hbs, -⟩ := hM.exists_cuff_of_border hS he + (not_disjoint_iff_nonempty_inter.mp hi) + exact absurd (closure_minimal (hbs.trans hsΘ) (hcl hΘ) hy.1) (hM.not_mem_cuff_of_internal hS + he' hi' hy' hΘ) + obtain ⟨s, hs, Θ, hΘ, hsΘ, hes, hbs, hsh⟩ := hM.exists_cuff_of_border hS he + (not_disjoint_iff_nonempty_inter.mp hi) + obtain ⟨s', hs', Θ', hΘ', hsΘ', hes', hbs', hsh'⟩ := hM.exists_cuff_of_border hS he' + (not_disjoint_iff_nonempty_inter.mp hi') + obtain rfl : Θ' = Θ := cuffs_eq_of_mem hΘ' hΘ (closure_minimal (hbs'.trans hsΘ') (hcl hΘ') hy'.1) + (closure_minimal (hbs.trans hsΘ) (hcl hΘ) hy.1) + by_cases hl : s ∈ χ.Φ.longSides + · by_cases hl' : s' ∈ χ.Φ.longSides + · by_cases hss : s = s' + · subst hss + exact (hM.no_common_end_long hS he hl hsΘ hΘ hes (.inl ⟨e', he', hne.symm, hes', + rfl⟩) hy.1 hy'.1).elim + · exfalso + have hyc : y ∈ closure s := closure_mono hbs hy.1 + have hyc' : y ∈ closure s' := closure_mono hbs' hy'.1 + have hyV := χ.Φ + by_cases h₁ : y ∈ s + · by_cases h₂ : y ∈ s' + · exact hss (GM11.arcComponent_eq hs hs' h₁ h₂) + · exact (hs.2.1 h₁).2 (χ.Φ.tilde_subset hbd hs' ⟨hyc', h₂⟩) + · have ht : y ∈ tilde s := ⟨hyc, h₁⟩ + by_cases h₂ : y ∈ s' + · exact (hs'.2.1 h₂).2 (χ.Φ.tilde_subset hbd hs ht) + · exact disjoint_left.mp (χ.Φ.long_disjoint s hs s' hs' hss hl.2 hl'.2) ht ⟨hyc', h₂⟩ + · have hsl : s' ∈ χ.Φ.shortSides := ⟨hs', fun h => hl' ⟨hs', h⟩⟩ + exact (hM.no_common_end_long hS he hl hsΘ hΘ hes (.inr ⟨hsl, + hsΘ'⟩) hy.1 (hsh' hl' ▸ hy'.1)).elim + · have hsl : s ∈ χ.Φ.shortSides := ⟨hs, fun h => hl ⟨hs, h⟩⟩ + by_cases hl' : s' ∈ χ.Φ.longSides + · exact (hM.no_common_end_long hS he' hl' hsΘ' hΘ hes' (.inr ⟨hsl, + hsΘ⟩) hy'.1 (hsh hl ▸ hy.1)).elim + · have hsl' : s' ∈ χ.Φ.shortSides := ⟨hs', fun h => hl' ⟨hs', h⟩⟩ + exact ⟨eq_short_of_subset P₀.fits he hsl hes ▸ hsl, eq_short_of_subset P₀.fits he' hsl' hes' + ▸ hsl'⟩ + +omit hM in +/-- Each cuff has a short side. -/ +theorem exists_short_on_cuff (hS : IsSurface S) {Θ : Set S} (hΘ : Θ ∈ cuffs S) : ∃ s ∈ + χ.Φ.shortSides, s ⊆ Θ := by + obtain ⟨p, hp, -⟩ := χ.Φ.two_on_cuff hS ⟨Θ, hΘ⟩ + obtain ⟨s, hs, hps⟩ := χ.Φ.exists_short_side hS hp.1 + obtain ⟨Θ', hΘ', hsΘ', -⟩ := χ.Φ.side_on_cuff hS hs.1 + have hcl : IsClosed Θ' := ((cuff_statement S hS).2.2 _ hΘ').isCompact.isClosed + obtain rfl := cuffs_eq_of_mem hΘ' hΘ (closure_minimal hsΘ' hcl hps.1) hp.2 + exact ⟨s, hs, hsΘ'⟩ + +/-- The set `Z_v` of (3.2) of Graph Minors XII: the ends of the edges `β(e)` that correspond to `v`. +-/ +def endClass (cap : IsCappedSurface S Shat) (P₀ P : ColouredPainting χ) (b : Set S → Set S) + (v : S) : Set Shat := + cap.emb '' {y | ∃ e ∈ P₀.Γ.E, ∃ (i : ℕ) (hi : i < (P₀.Γ.γ e).length) (hi' : i < (P.Γ.γ + (b e)).length), (P₀.Γ.γ e)[i] = v ∧ (P.Γ.γ (b e))[i] = y} + +/-- Different vertices of `Γ₀` have disjoint sets of ends. -/ +theorem IsMatchSetting.disjoint_endClass (hS : IsSurface S) {v v' : S} (hne : v ≠ v') : Disjoint + (endClass cap P₀ D.P b v) (endClass cap P₀ D.P b v') := by + have hinj := cap.isEmbedding.injective + refine disjoint_left.mpr ?_ + rintro _ ⟨y, ⟨e, he, i, hi, hi', hv, hy⟩, rfl⟩ ⟨y', ⟨e', he', i', hi₂, hi₂', hv', hy'⟩, h⟩ + obtain rfl := hinj h + have hmem := fun {c : Set S} (hc : c ∈ D.P.Γ.E) {j : ℕ} (hj : j < (D.P.Γ.γ c).length) => show + (D.P.Γ.γ c)[j] ∈ tilde c by + have : (D.P.Γ.γ c)[j] ∈ {v | v ∈ D.P.Γ.γ c} := List.getElem_mem hj + rwa [D.P.Γ.γ_set c hc] at this + by_cases hee : e = e' + · subst hee + have hii : i = i' := by + have := (D.P.Γ.γ_nodup _ (hM.edge.mem e he)).getElem_inj_iff (hi := hi') (hj := hi₂') |>.mp + (hy.trans hy'.symm) + exact this + subst hii + exact hne (hv.symm.trans hv') + obtain ⟨hs, hs'⟩ := hM.no_common_end hS he he' hee (hy ▸ hmem (hM.edge.mem e he) hi') (hy' ▸ hmem + (hM.edge.mem e' he') hi₂') + have e₁ : ∀ {s : Set S}, s ∈ χ.Φ.shortSides → P₀.Γ.γ s = D.P.Γ.γ s := fun h => + (short_γ_eq P₀ h).trans (short_γ_eq D.P h).symm + have e₂ : ∀ {s : Set S}, s ∈ χ.Φ.shortSides → P₀.Γ.γ s = D.P.Γ.γ (b s) := by + intro s h + rw [hM.edge.short s h] + exact e₁ h + have g₁ : v = (D.P.Γ.γ (b e))[i] := hv.symm.trans (List.getElem_of_eq (e₂ hs) hi) + have g₂ : v' = (D.P.Γ.γ (b e'))[i'] := hv'.symm.trans (List.getElem_of_eq (e₂ hs') hi₂) + rw [hy] at g₁ + rw [hy'] at g₂ + exact hne (g₁.trans g₂.symm) + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15o.lean b/LeanPool/GraphMinor/GM19/Section15o.lean new file mode 100644 index 0000000000..77abb8992f --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15o.lean @@ -0,0 +1,277 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section15n + +/-! +# Graph Minors XIX, (15.2): the family of discs + +We now put together the discs of `exists_cuff_disc`, `exists_two_disc` and `exists_three_disc`: one +disc for each cuff and one for each internal edge of `Γ₀`. The closed sets in which they lie are +disjoint, because the edges `β(e)` are far from each other and +from the poles (`disjoint_discHull`). So we can take thin discs around the edges of size 2 and keep +them disjoint (`exists_discFamily`). + +The metric of `sk(Γ)` sees these discs as far apart (`le_skMetric`), and the sets of ends are free +(`isFreeSet_of_circuit`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 GraphMinor.GM14 Hypergraph + +universe w + +/-- Disjoint compact sets lie in disjoint open sets. -/ +theorem exists_open_separation {ι T : Type} [TopologicalSpace T] [T2Space T] [Finite ι] {K : ι + → Set T} (hK : ∀ i, IsCompact (K i)) (hd : ∀ i j, i ≠ j → Disjoint (K i) (K j)) : + ∃ U : ι → Set T, (∀ i, IsOpen (U i)) ∧ (∀ i, K i ⊆ U i) ∧ ∀ i j, i ≠ j → Disjoint (U i) (U j) + := by + have hsep : ∀ i j, i ≠ j → ∃ u v : Set T, IsOpen u ∧ IsOpen v ∧ K i ⊆ u ∧ K j ⊆ v ∧ Disjoint u v + := fun i j h => by + obtain ⟨u, v, h₁, h₂, h₃, h₄, h₅⟩ := SeparatedNhds.of_isCompact_isCompact (hK i) (hK j) + (hd i j h) + exact ⟨u, v, h₁, h₂, h₃, h₄, h₅⟩ + choose u v h₁ h₂ h₃ h₄ h₅ using hsep + refine ⟨fun i => ⋂ (j : ι), ⋂ (h : i ≠ j), u i j h ∩ v j i h.symm, fun i => ?_, fun i => ?_, + fun i j h => ?_⟩ + · exact isOpen_iInter_of_finite fun j => isOpen_iInter_of_finite fun h => (h₁ _ _ h).inter + (h₂ _ _ h.symm) + · exact subset_iInter fun j => subset_iInter fun h => subset_inter (h₃ _ _ h) (h₄ _ _ h.symm) + · refine (h₅ i j h).mono ?_ ?_ + · exact fun x hx => (mem_iInter.mp (mem_iInter.mp hx j) h).1 + · exact fun x hx => (mem_iInter.mp (mem_iInter.mp hx i) h.symm).2 + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +omit [T2Space Shat] in +omit [T2Space S] in +/-- The boundary of an anchored disc holds just the vertices `N`. -/ +theorem IsAnchoredDisc.vertex_inter_subBd {Γ : Painting S} {H : Drawing Shat} {Δ N : Set Shat} {a : + Set S} (h : IsAnchoredDisc cap Γ H Δ N a) : H.V ∩ subBd Δ = N := by + have hT := cap.isClosedSurface + have e : subBd Δ = discBd Δ := by + rw [subBd_eq_frontier, GM11.IsClosedDisc.frontier_eq_discBd hT h.disc] + rw [e] + apply Subset.antisymm + · rintro x ⟨hxV, hxb⟩ + rw [← h.inter] + exact ⟨H.V_subset_U hxV, Surface.discBd_subset _ hxb⟩ + · exact fun x hx => ⟨h.sub_V hx, h.sub_bd hx⟩ + +omit [T2Space S] [T2Space Shat] in +/-- Some region of `sk(Γ)` meets an anchored disc. -/ +theorem IsAnchoredDisc.exists_region {Γ : Painting S} {H : Drawing Shat} {Δ N : Set Shat} {a : Set + S} (h : IsAnchoredDisc cap Γ H Δ N a) : ∃ r ∈ H.R, (r ∩ Δ).Nonempty := by + obtain ⟨p, hp⟩ := h.disc.nonempty_discInt + have hpU : p ∉ H.U := fun hU => hp.2 (h.sub_bd (h.inter ▸ ⟨hU, hp.1⟩)) + obtain ⟨r, hr, hpr⟩ := exists_region_of_notMem hpU + exact ⟨r, hr, p, hpr, hp.1⟩ + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {P₀ : ColouredPainting χ} {n : ℕ} {b : Set S → Set S} + +/-- The cuffs, and the internal edges of `Γ₀`. These index the discs. -/ +abbrev DiscIndex (S : Type) [TopologicalSpace S] {β : Type w} {χ : ColourScheme S β} + (P₀ : ColouredPainting χ) : Type := + {Θ : Set S // Θ ∈ cuffs S} ⊕ {e : Set S // e ∈ P₀.Γ.E ∧ Painting.IsInternal e} + +omit [T2Space S] in +theorem finite_discIndex (hS : IsSurface S) (P₀ : ColouredPainting χ) : Finite (DiscIndex S P₀) + := by + have h₁ : Finite {Θ : Set S // Θ ∈ cuffs S} := (cuff_statement S hS).2.1 + have h₂ : {e : Set S | e ∈ P₀.Γ.E ∧ Painting.IsInternal e}.Finite := + P₀.Γ.finite_edges.subset fun _ h => h.1 + have := h₂.to_subtype + infer_instance + +/-- The closed set in which a disc lies, up to a thin neighbourhood. -/ +def discHull (cap : IsCappedSurface S Shat) (b : Set S → Set S) : DiscIndex S P₀ → Set Shat + | .inl Θ => closure (cap.cuffDisc Θ.1) + | .inr e => cap.emb '' closure (b e.1) + +/-- The vertices of `sk(Γ)` on a disc. -/ +def discEnds (cap : IsCappedSurface S Shat) (b : Set S → Set S) (P₀ : ColouredPainting χ) : + DiscIndex S P₀ → Set Shat + | .inl Θ => cap.emb '' cuffEnds P₀ b Θ.1 + | .inr e => cap.emb '' tilde (b e.1) + +/-- The edge of `Γ` on the boundary of each region that meets a disc. -/ +def discAnchor (σ b : Set S → Set S) : DiscIndex S P₀ → Set S + | .inl Θ => σ Θ.1 + | .inr e => b e.1 + +variable (hM : D.IsMatchSetting P₀ n b) +include hM + +/-- **The closed sets are disjoint.** -/ +theorem IsMatchSetting.disjoint_discHull (hS : IsSurface S) (i j : DiscIndex S P₀) + (hne : i ≠ j) : Disjoint (discHull cap b i) (discHull cap b j) := by + have hinj := cap.isEmbedding.injective + have key : ∀ (Θ : {Θ : Set S // Θ ∈ cuffs S}) (e : {e : Set S // e ∈ P₀.Γ.E + ∧ Painting.IsInternal e}), Disjoint (closure (cap.cuffDisc Θ.1)) (cap.emb '' closure (b e.1)) + := fun Θ e => by + refine disjoint_left.mpr ?_ + rintro x hx ⟨z, hz, rfl⟩ + rw [cap.closure_cuffDisc Θ.2] at hx + rcases hx with h | ⟨y, hy, hyz⟩ + · exact cap.notMem_range Θ.2 h (mem_range_self z) + · obtain rfl := hinj hyz + have hint := hM.edge.internal e.1 e.2.1 e.2.2 + have hnz : y ∉ b e.1 := fun h' => disjoint_left.mp hint h' (cuff_subset_bd ⟨Θ.1, Θ.2⟩ hy) + exact hM.not_mem_cuff_of_internal hS e.2.1 e.2.2 ⟨hz, hnz⟩ Θ.2 hy + rcases i with Θ | e <;> rcases j with Θ' | e' + · exact cap.cuffDisc_disjoint Θ.1 Θ.2 Θ'.1 Θ'.2 fun h => hne (congrArg Sum.inl (Subtype.ext h)) + · exact key Θ e' + · exact (key Θ' e).symm + · have hee : e.1 ≠ e'.1 := fun h => hne (congrArg Sum.inr (Subtype.ext h)) + change Disjoint (cap.emb '' closure (b e.1)) (cap.emb '' closure (b e'.1)) + refine (disjoint_image_iff hinj).mpr (disjoint_left.mpr fun z hz hz' => ?_) + have hbm := hM.edge.mem _ e.2.1 + have hbm' := hM.edge.mem _ e'.2.1 + have hbne : b e.1 ≠ b e'.1 := fun h => hee (hM.edge.injOn e.2.1 e'.2.1 h) + by_cases h₁ : z ∈ b e.1 + · by_cases h₂ : z ∈ b e'.1 + · exact hbne (GM11.arcComponent_eq hbm hbm' h₁ h₂) + · exact D.P.Γ.disjoint_V hbm h₁ (D.P.Γ.tilde_subset_V hbm' ⟨hz', h₂⟩) + · by_cases h₂ : z ∈ b e'.1 + · exact D.P.Γ.disjoint_V hbm' h₂ (D.P.Γ.tilde_subset_V hbm ⟨hz, h₁⟩) + · have h := (hM.no_common_end hS e.2.1 e'.2.1 hee ⟨hz, h₁⟩ ⟨hz', h₂⟩).1 + obtain ⟨x, hx⟩ : e.1.Nonempty := e.2.1.1 + exact disjoint_left.mp e.2.2 hx (h.1.2.1 (by exact hx) |>.1) + +/-- The ends of the edges on a cuff are vertices of `Γ` on the cuff. -/ +theorem IsMatchSetting.cuffEnds_subset (hS : IsSurface S) {Θ : Set S} + (hΘ : Θ ∈ cuffs S) : cuffEnds P₀ b Θ ⊆ Θ ∩ D.P.Γ.V := by + rintro y ⟨e, he, heΘ, hy⟩ + obtain ⟨s, -, -, -, hbs, -⟩ := exists_side_of_cuffEnds hS hM.edge hΘ he heΘ + obtain ⟨s', -, hs'Θ, -, hbs', -⟩ := exists_side_of_cuffEnds hS hM.edge hΘ he heΘ + have hcl : IsClosed Θ := ((cuff_statement S hS).2.2 _ hΘ).isCompact.isClosed + exact ⟨closure_minimal (hbs'.trans hs'Θ) hcl hy.1, D.P.Γ.tilde_subset_V (hM.edge.mem e he) hy⟩ + +omit [T2Space S] in +theorem IsMatchSetting.finite_cuffEnds (Θ : Set S) : (cuffEnds P₀ b Θ).Finite := by + refine (P₀.Γ.finite_edges.biUnion (t := fun e => tilde (b e)) fun e he => D.P.Γ.finite_V.subset + (D.P.Γ.tilde_subset_V (hM.edge.mem e he))).subset ?_ + rintro y ⟨e, he, -, hy⟩ + exact mem_biUnion he hy + +/-- **The discs.** -/ +theorem IsMatchSetting.exists_discFamily (hS : IsSurface S) {H : Drawing Shat} + (hH : IsSkHat cap D.P.Γ H) {σ : Set S → Set S} (hσ : ∀ Θ ∈ cuffs S, σ Θ ∈ χ.Φ.shortSides + ∧ σ Θ ⊆ Θ) : + ∃ Δ : DiscIndex S P₀ → Set Shat, (∀ i, IsAnchoredDisc cap D.P.Γ H (Δ i) (discEnds cap b P₀ i) + (discAnchor σ b i)) ∧ (∀ i j, i ≠ j → Disjoint (Δ i) (Δ j)) ∧ + (∀ Θ : {Θ : Set S // Θ ∈ cuffs S}, Δ (.inl Θ) ⊆ closure (cap.cuffDisc Θ.1)) ∧ + ∀ e : {e : Set S // e ∈ P₀.Γ.E ∧ Painting.IsInternal e}, (tilde (b e.1)).ncard = 3 → Δ + (.inr e) ⊆ cap.emb '' closure (b e.1) := by + classical + have := finite_discIndex hS P₀ + have hK : ∀ i : DiscIndex S P₀, IsCompact (discHull cap b i) := by + rintro (Θ | e) + · exact (cap.cuffDisc_closedDisc Θ.1 Θ.2).isCompact + · have : CompactSpace S := hS.1 + exact (isClosed_closure.isCompact).image cap.isEmbedding.continuous + obtain ⟨U, hUo, hKU, hUd⟩ := exists_open_separation hK fun i j h => hM.disjoint_discHull hS i j h + have key : ∀ i : DiscIndex S P₀, ∃ Δ, Δ ⊆ U i ∧ (∀ Θ, i = .inl Θ → Δ ⊆ closure + (cap.cuffDisc Θ.1)) ∧ (∀ e, i = .inr e → (tilde (b e.1)).ncard = 3 → Δ ⊆ cap.emb '' closure + (b e.1)) ∧ IsAnchoredDisc cap D.P.Γ H Δ (discEnds cap b P₀ i) (discAnchor σ b i) := by + rintro (Θ | e) + · have hs := hσ Θ.1 Θ.2 + have hs₀ := P₀.fits.short_sides hs.1 + have hne : (cuffEnds P₀ b Θ.1).Nonempty := by + obtain ⟨y, hy⟩ : (tilde (σ Θ.1)).Nonempty := nonempty_of_ncard_ne_zero (by + rw [(χ.Φ.side_shape _ hs.1.1).1] + omega) + exact ⟨y, σ Θ.1, hs₀, hs.2, by rw [hM.edge.short _ hs.1]; exact hy⟩ + obtain ⟨Δ, h₁, h₂⟩ := exists_cuff_disc hH Θ.2 (hM.cuffEnds_subset hS Θ.2) + (hM.finite_cuffEnds Θ.1) hne (D.P.fits.short_sides hs.1) hs.2 + exact ⟨Δ, h₁.trans (hKU (.inl Θ)), fun Θ' h => (Sum.inl_injective h : Θ = Θ') ▸ h₁, + fun _ h => (by cases h), h₂⟩ + · have hbm := hM.edge.mem _ e.2.1 + rcases D.P.Γ.size_cases hbm with h2 | h3 + · obtain ⟨Δ, h₁, h₂⟩ := exists_two_disc hS hH hbm h2 (hUo (.inr e)) (hKU (.inr e)) + exact ⟨Δ, h₁, fun _ h => (by cases h), fun e' h h₃ => by + obtain rfl : e = e' := Sum.inr_injective h + omega, h₂⟩ + · obtain ⟨Δ, h₁, h₂⟩ := exists_three_disc hH hbm h3 + exact ⟨Δ, h₁.trans (hKU (.inr e)), fun _ h => (by cases h), fun e' h _ => by + obtain rfl : e = e' := Sum.inr_injective h + exact h₁, h₂⟩ + choose Δ h₁ h₂ h₄ h₃ using key + exact ⟨Δ, h₃, fun i j h => (hUd i j h).mono (h₁ i) (h₁ j), fun Θ => h₂ _ Θ rfl, + fun e => h₄ _ e rfl⟩ + +/-- **The discs are far apart in `Γ`.** -/ +theorem IsMatchSetting.lt_dist_discAnchor (hS : IsSurface S) {σ : Set S → Set S} + (hσ : ∀ Θ ∈ cuffs S, σ Θ ∈ χ.Φ.shortSides ∧ σ Θ ⊆ Θ) (i j : DiscIndex S P₀) (hne : i ≠ j) : + n / 2 < D.dist (cap.emb '' discAnchor σ b i) (cap.emb '' discAnchor σ b j) + 8 := by + classical + have hn := hM.large + have hrep : 4 ≤ D.rep := by + have := hM.rep_gt + omega + have hpole : ∀ Θ : {Θ : Set S // Θ ∈ cuffs S}, ∃ p ∈ D.rad.poles, D.rad.regionOf p + = cap.cuffDisc Θ.1 ∧ p ∈ cap.cuffDisc Θ.1 ∧ D.dist (cap.emb '' σ Θ.1) (D.rad.atomOf p) ≤ 4 + := fun Θ => by + obtain ⟨p, hp, hpΘ, hreg⟩ := D.rad.exists_pole Θ.2 + have hs := hσ Θ.1 Θ.2 + have hE := D.P.fits.short_sides hs.1 + obtain ⟨y, hy⟩ : (tilde (σ Θ.1)).Nonempty := nonempty_of_ncard_ne_zero (by + rw [(χ.Φ.side_shape _ hs.1.1).1] + omega) + have hcl : IsClosed Θ.1 := ((cuff_statement S hS).2.2 _ Θ.2).isCompact.isClosed + have := edgeVertDist_pole_le hS hrep hE hy Θ.2 (closure_minimal hs.2 hcl hy.1) hp hreg + exact ⟨p, hp, hreg, hpΘ, this⟩ + have hatom : ∀ Θ : {Θ : Set S // Θ ∈ cuffs S}, cap.emb '' σ Θ.1 ∈ D.P.Γ.atoms cap := fun Θ + => Or.inl (Or.inr ⟨_, D.P.fits.short_sides (hσ Θ.1 Θ.2).1, rfl⟩) + rcases i with Θ | e <;> rcases j with Θ' | e' + · obtain ⟨p, hp, -, hpΘ, h₁⟩ := hpole Θ + obtain ⟨p', hp', -, hpΘ', h₂⟩ := hpole Θ' + have hΘ : Θ.1 ≠ Θ'.1 := fun h => hne (congrArg Sum.inl (Subtype.ext h)) + have hpp : p ≠ p' := fun h => disjoint_left.mp (cap.cuffDisc_disjoint _ Θ.2 _ Θ'.2 hΘ) + (subset_closure hpΘ) (subset_closure (h ▸ hpΘ')) + have h₃ := hM.far p hp p' hp' hpp + have h₄ := D.dist_triangle hrep (a := D.rad.atomOf p) (c := D.rad.atomOf p') (b + := cap.emb '' σ Θ.1) (hatom Θ) + have h₅ := D.dist_triangle hrep (a := cap.emb '' σ Θ.1) (c := D.rad.atomOf p') (b + := cap.emb '' σ Θ'.1) (hatom Θ') + rw [D.dist_comm (D.rad.atomOf p) (cap.emb '' σ Θ.1)] at h₄ + unfold vDist at h₃ + change n / 2 < D.dist (cap.emb '' σ Θ.1) (cap.emb '' σ Θ'.1) + 8 + omega + · obtain ⟨p, hp, -, -, h₁⟩ := hpole Θ + have h₂ := hM.edge.pole_far e'.1 e'.2.1 e'.2.2 p hp + have h₃ := D.dist_triangle hrep (a := cap.emb '' b e'.1) (c := D.rad.atomOf p) (b + := cap.emb '' σ Θ.1) (hatom Θ) + unfold edgeVertDist at h₂ + rw [D.dist_comm (cap.emb '' b e'.1) (cap.emb '' σ Θ.1)] at h₃ + change n / 2 < D.dist (cap.emb '' σ Θ.1) (cap.emb '' b e'.1) + 8 + omega + · obtain ⟨p, hp, -, -, h₁⟩ := hpole Θ' + have h₂ := hM.edge.pole_far e.1 e.2.1 e.2.2 p hp + have h₃ := D.dist_triangle hrep (a := cap.emb '' b e.1) (c := D.rad.atomOf p) (b + := cap.emb '' σ Θ'.1) (hatom Θ') + unfold edgeVertDist at h₂ + change n / 2 < D.dist (cap.emb '' b e.1) (cap.emb '' σ Θ'.1) + 8 + omega + · have hee : e.1 ≠ e'.1 := fun h => hne (congrArg Sum.inr (Subtype.ext h)) + have := hM.edge.far e.1 e.2.1 e.2.2 e'.1 e'.2.1 e'.2.2 hee + unfold edgeDist at this + change n / 2 < D.dist (cap.emb '' b e.1) (cap.emb '' b e'.1) + 8 + omega + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15p.lean b/LeanPool/GraphMinor/GM19/Section15p.lean new file mode 100644 index 0000000000..8625a5ab7d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15p.lean @@ -0,0 +1,185 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section15o +public import LeanPool.GraphMinor.GM19.SideEdges + +/-! +# Graph Minors XIX, (15.2): the metric of the skeleton and free sets + +We check the last two hypotheses of (3.2) of Graph Minors XII for the discs of `exists_discFamily`. +If two regions of `sk(Γ)` meet two different discs, then they are far apart in the metric of `sk(Γ)` +(`le_skMetric`), since `dist_le_of_skMetric` compares that +metric with the metric of `Γ`. The set of vertices on each disc is free (`isFreeSet_discEnds`). This +is steps (5) and (6) of the paper. + +We also read off the labels of a long side (`exists_isBorderLabels`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 GraphMinor.GM14 Hypergraph + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +/-- The edges along a long side, in order, give the labels of the side. -/ +theorem exists_isBorderLabels (hS : IsSurface S) (P : ColouredPainting χ) {side : Set S} + (hside : side ∈ χ.Φ.longSides) : ∃ ω, IsBorderLabels P side ω := by + classical + obtain ⟨Θ, hΘ, f, a, b, k, t, e, hsΘ, h⟩ := exists_sideEdges hS χ P.fits hside + have hkp := h.k_pos + let g : Fin k → Set S := fun i => e (i.1 + 1) + have hg : ∀ i, g i ∈ P.Γ.E ∧ g i ⊆ side := fun i => + ⟨h.mem _ (by omega), h.subset_side (by omega) (by have := i.2; omega)⟩ + have hlen : (List.ofFn fun i => P.φ (g i)).length = k := List.length_ofFn + have hinj : Function.Injective g := by + intro i j hij + by_contra hne + rcases lt_or_gt_of_ne (fun h' => hne (Fin.ext h') : i.1 ≠ j.1) with h' | h' + · exact h.injOn_edges (l := i.1 + 1) (l' := j.1 + 1) (by omega) (by omega) + (by have := j.2; omega) hij + · exact h.injOn_edges (l := j.1 + 1) (l' := i.1 + 1) (by omega) (by omega) + (by have := i.2; omega) hij.symm + refine ⟨List.ofFn fun i => P.φ (g i), ?_, ?_, Θ, fun i => g (i.cast hlen), a, b, hΘ, hsΘ, ?_, + ?_, ?_⟩ + · intro h₀ + have : k = 0 := by rw [← hlen, h₀]; rfl + omega + · intro x hx + obtain ⟨i, rfl⟩ := (List.mem_ofFn' _ _).mp hx + obtain ⟨y, hy⟩ : (g i).Nonempty := (hg i).1.1 + exact P.border_mem _ (hg i).1 side hside.1 ⟨⟨y, hy, (hside.1.2.1 ((hg i).2 hy)).1⟩, (hg i).2⟩ + · refine ⟨h.head, h.last, fun i j hij => ?_, fun i => hg _, fun i j hij x hx y hy => ?_⟩ + · exact Fin.cast_injective hlen (hinj hij) + · have hij' : i.1 < j.1 := hij + have hj : j.1 < k := by simpa only [Fin.val_cast] using (j.cast hlen).2 + exact h.inOrder (l := i.1 + 1) (l' := j.1 + 1) (by omega) (by omega) (by omega) hx hy + · intro c hc hcs + obtain ⟨l, h₁, h₂, rfl⟩ := h.all c hc hcs + exact ⟨Fin.cast hlen.symm ⟨l - 1, by omega⟩, by + change e ((l - 1) + 1) = e l + rw [Nat.sub_add_cancel h₁]⟩ + · intro i + simp only [List.getElem_ofFn] + rfl + +variable {D : TangleDatum cap χ} {H G₃ : Drawing Shat} + +namespace TangleDatum.SkData + +/-- Two edges on the boundary of one region of `sk(Γ)` are close, by way of the centre of the +region. -/ +theorem dist_le_of_same_region (hd : D.SkData H G₃) (hrep : 4 ≤ D.rep) {r : Set Shat} + (hr : r ∈ H.R) {f₁ c₁ f₂ c₂ : Set S} (hf₁ : D.P.Γ.IsSkEdgeIn f₁ c₁) + (hfr₁ : cap.emb '' f₁ ⊆ closure r) (hf₂ : D.P.Γ.IsSkEdgeIn f₂ c₂) + (hfr₂ : cap.emb '' f₂ ⊆ closure r) : D.dist (cap.emb '' c₁) (cap.emb '' c₂) ≤ 12 := by + have hS := χ.isSurface + obtain ⟨A, hA⟩ := hd.exists_isAnchors hrep + obtain ⟨h, ⟨hhr, hhV⟩, -⟩ := hd.pre.2.2.2.1 r hr + have key : ∀ {f c : Set S}, D.P.Γ.IsSkEdgeIn f c → cap.emb '' f ⊆ closure r → D.dist + (cap.emb '' c) (A h) ≤ 6 := fun {f c} hf hfr => by + have hc := hf.1 + obtain ⟨p, q, -, ht, htV, -⟩ := D.P.Γ.sk_line hf.mem + have hp : p ∈ tilde f := ht ▸ .inl rfl + have hpV : p ∈ D.P.Γ.V := htV hp + have hpc : p ∈ tilde c := ⟨closure_minimal hf.subset_closure isClosed_closure hp.1, fun h' + => D.P.Γ.disjoint_V hc h' hpV⟩ + have hpr : cap.emb p ∈ closure r := closure_minimal hfr isClosed_closure (by + rw [(cap.isClosedEmbedding hS).closure_image_eq f] + exact mem_image_of_mem _ hp.1) + have hcp : D.dist (cap.emb '' c) {cap.emb p} ≤ 3 := by + have := D.edgeVertDist_self_le hrep hc hpc hpV + unfold edgeVertDist at this + rwa [D.atomOf_emb hpV] at this + have hsingle : ({cap.emb p} : Set Shat) ∈ D.P.Γ.atoms cap := Or.inl (Or.inl ⟨p, hpV, rfl⟩) + have h₁ := hA.corner r hr h hhr hhV p hpV hpr + have h₂ := D.dist_triangle hrep (a := cap.emb '' c) (c := A h) hsingle + rw [D.dist_comm {cap.emb p} (A h)] at h₂ + omega + have h₁ := key hf₁ hfr₁ + have h₂ := key hf₂ hfr₂ + have h₃ := D.dist_triangle hrep (a := cap.emb '' c₁) (c := cap.emb '' c₂) (hA.atom h hhV) + rw [D.dist_comm (A h) (cap.emb '' c₂)] at h₃ + omega + +/-- **Far in `Γ` means far in `sk(Γ)`.** -/ +theorem le_skMetric (hd : D.SkData H G₃) (hrep : 4 ≤ D.rep) {m θ : ℕ} (hmr : m ≤ D.rep) (hm : 1 + ≤ m) (h3m : 3 * m < 2 * D.ord + 3) {ins : Drawing Shat → Set Shat} + (hins : IsDerivedSlope (PaintingOrDrawing.drawing H) G₃ m (D.skTangle H m) ins) (hθ : θ + ≤ m) {Δ₁ Δ₂ N₁ N₂ : Set Shat} {a₁ a₂ : Set S} (h₁ : IsAnchoredDisc cap D.P.Γ H Δ₁ N₁ a₁) + (h₂ : IsAnchoredDisc cap D.P.Γ H Δ₂ N₂ a₂) (hfar : 16 * θ + 12 < D.dist (cap.emb '' a₁) + (cap.emb '' a₂)) {r₁ r₂ : Set Shat} (hr₁ : r₁ ∈ H.R) (hm₁ : (r₁ ∩ Δ₁).Nonempty) + (hr₂ : r₂ ∈ H.R) + (hm₂ : (r₂ ∩ Δ₂).Nonempty) : θ ≤ GM14.tangleMetric H G₃ ins m r₁ r₂ := by + by_contra hlt + obtain ⟨-, f₁, hf₁, hfr₁⟩ := h₁.anchor r₁ hr₁ hm₁ + obtain ⟨-, f₂, hf₂, hfr₂⟩ := h₂.anchor r₂ hr₂ hm₂ + by_cases hne : r₁ = r₂ + · subst hne + have := hd.dist_le_of_same_region hrep hr₁ hf₁ hfr₁ hf₂ hfr₂ + omega + · have := hd.dist_le_of_skMetric hrep hmr hm h3m hins hr₁ hr₂ hne (by omega) hf₁ hfr₁ hf₂ hfr₂ + omega + +end TangleDatum.SkData + +namespace TangleDatum + +variable {P₀ : ColouredPainting χ} {n : ℕ} {b : Set S → Set S} + +/-- **The sets of ends are free.** -/ +theorem IsMatchSetting.isFreeSet_discEnds (hM : D.IsMatchSetting P₀ n b) + (hd : D.SkData H G₃) {m : ℕ} (hmr : m ≤ D.rep) (hm : 1 ≤ m) (h3m : 3 * m < 2 * D.ord + 3) {ins : + Drawing Shat → Set Shat} + (hins : IsDerivedSlope (PaintingOrDrawing.drawing H) G₃ m (D.skTangle H m) ins) + (hmn : 2 * m + 12 ≤ n) (i : DiscIndex S P₀) {Δ : Set Shat} {a : Set S} + (hA : IsAnchoredDisc cap D.P.Γ H Δ (discEnds cap b P₀ i) a) + (hcard : (discEnds cap b P₀ i).ncard ≤ m) : IsFreeSet H.toHypergraph (D.skTangle H m) m + (discEnds cap b P₀ i) := by + classical + have hS := χ.isSurface + have hn := hM.large + have hnr := hM.rep_gt + have hrep : 4 ≤ D.rep := by omega + refine ⟨hA.sub_V, hcard, fun A' B' hmem hXA => ?_⟩ + by_contra hord + rw [not_le] at hord + rcases i with Θ | e + · obtain ⟨p, hp, hpΘ, hreg⟩ := D.rad.exists_pole Θ.2 + have hrh : D.rad.regionOf p ∈ D.P.Γ.hatRegions cap := (D.rad.regionOf_mem hp.1).1 + have hpr : p ∈ D.rad.regionOf p := (D.rad.regionOf_mem hp.1).2 + have hXr : discEnds cap b P₀ (.inl Θ) ⊆ closure (D.rad.regionOf p) := by + rw [hreg] + rintro _ ⟨y, hy, rfl⟩ + have hyΘ := (hM.cuffEnds_subset hS Θ.2 hy).1 + exact Surface.discBd_subset _ (cap.cuffDisc_bd Θ.1 Θ.2 ▸ mem_image_of_mem _ hyΘ) + obtain ⟨F, hF, hl, hlt, hw⟩ := hd.exists_circuit_of_not_free hmr hm h3m hins + (hd.sk.hatRegion_mem_R hrh) hpr (hd.sub.1 hp.1.1) hA.sub_V hXr hcard hmem hXA hord + exact no_circuit_holds_cuffEnds hS hM.edge (by omega) hnr hM.free hM.far hp Θ.2 hreg hF + (by omega) hw hlt + · obtain ⟨r, hr, hrm⟩ := hA.exists_region + obtain ⟨hXr, -⟩ := hA.anchor r hr hrm + obtain ⟨w, ⟨hwr, hwV⟩, -⟩ := hd.pre.2.2.2.1 r hr + obtain ⟨F, hF, hl, hlt, -⟩ := hd.exists_circuit_of_not_free hmr hm h3m hins hr hwr hwV + hA.sub_V hXr hcard hmem hXA hord + have hbm := hM.edge.mem _ e.2.1 + have h3c : (tilde (b e.1)).ncard ≤ 3 := by + rcases D.P.Γ.size_cases hbm with h | h <;> omega + exact no_circuit_holds_tilde hS (by omega) hrep hbm h3c (hM.edge.pole_far e.1 e.2.1 e.2.2) hF + (by omega) hlt + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section15q.lean b/LeanPool/GraphMinor/GM19/Section15q.lean new file mode 100644 index 0000000000..13e243035d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section15q.lean @@ -0,0 +1,262 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Feasibility +public import LeanPool.GraphMinor.GM19.Section15e + +import LeanPool.GraphMinor.GM12.Bridge + +/-! +# Graph Minors XIX, (15.2) + +We apply (3.2) of Graph Minors XII to `sk(Γ)` and the discs of `exists_discFamily`. The connected +subdrawings it gives, with the edges `β(e)`, are an inflation of `(Γ₀, φ₀)` in `(Γ, φ)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 GraphMinor.GM14 Hypergraph + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {P₀ : ColouredPainting χ} {n : ℕ} {b : Set S → Set S} + +/-- All the ends of the edges `β(e)`. -/ +def allEnds (cap : IsCappedSurface S Shat) (P₀ : ColouredPainting χ) (b : Set S → Set S) : Set Shat + := + cap.emb '' ⋃ e ∈ P₀.Γ.E, tilde (b e) + +variable (hM : D.IsMatchSetting P₀ n b) +include hM + +omit [T2Space S] in +theorem IsMatchSetting.ncard_allEnds_le : (allEnds cap P₀ b).ncard ≤ 3 * P₀.Γ.E.ncard := by + classical + have hfin := P₀.Γ.finite_edges + let t : Set S → Finset S := fun e => ((D.P.Γ.finite_V.inter_of_right (tilde (b e)))).toFinset + have ht : ∀ e ∈ hfin.toFinset, (t e).card ≤ 3 := fun e he => by + have he' : e ∈ P₀.Γ.E := hfin.mem_toFinset.mp he + have hbm := hM.edge.mem e he' + have h₁ : (tilde (b e) ∩ D.P.Γ.V).ncard ≤ (tilde (b e)).ncard := ncard_le_ncard + inter_subset_left (D.P.Γ.finite_V.subset (D.P.Γ.tilde_subset_V hbm)) + have h₂ : (tilde (b e)).ncard ≤ 3 := by + rcases D.P.Γ.size_cases hbm with h | h <;> omega + have h₃ : (t e).card = (tilde (b e) ∩ D.P.Γ.V).ncard := (Set.ncard_eq_toFinset_card _ _).symm + omega + have hcard := Finset.card_biUnion_le_card_mul hfin.toFinset t 3 ht + have hsub : (⋃ e ∈ P₀.Γ.E, tilde (b e)) ⊆ ↑(hfin.toFinset.biUnion t) := fun y hy => by + obtain ⟨e, he, hy⟩ := mem_iUnion₂.mp hy + exact Finset.mem_coe.mpr (Finset.mem_biUnion.mpr ⟨e, hfin.mem_toFinset.mpr he, + (Set.Finite.mem_toFinset _).mpr ⟨hy, D.P.Γ.tilde_subset_V (hM.edge.mem e he) hy⟩⟩) + have h₁ : (allEnds cap P₀ b).ncard ≤ (⋃ e ∈ P₀.Γ.E, tilde (b e)).ncard := ncard_image_le + ((Finset.finite_toSet _).subset hsub) + have h₂ := ncard_le_ncard hsub (Finset.finite_toSet _) + rw [Set.ncard_coe_finset] at h₂ + have h₃ : hfin.toFinset.card = P₀.Γ.E.ncard := (Set.ncard_eq_toFinset_card _ _).symm + rw [h₃] at hcard + omega + +theorem IsMatchSetting.iUnion_discEnds (hS : IsSurface S) : ⋃ i, discEnds cap b P₀ i + = allEnds cap P₀ b := by + apply Subset.antisymm + · refine iUnion_subset ?_ + rintro (Θ | e) + · rintro _ ⟨y, ⟨e, he, -, hy⟩, rfl⟩ + exact mem_image_of_mem _ (mem_biUnion he hy) + · rintro _ ⟨y, hy, rfl⟩ + exact mem_image_of_mem _ (mem_biUnion e.2.1 hy) + · rintro _ ⟨y, hy, rfl⟩ + obtain ⟨e, he, hy⟩ := mem_iUnion₂.mp hy + by_cases hi : Painting.IsInternal e + · exact mem_iUnion.mpr ⟨.inr ⟨e, he, hi⟩, mem_image_of_mem _ hy⟩ + · obtain ⟨s, -, Θ, hΘ, hsΘ, hes, -, -⟩ := hM.exists_cuff_of_border hS he + (not_disjoint_iff_nonempty_inter.mp hi) + exact mem_iUnion.mpr ⟨.inl ⟨Θ, hΘ⟩, mem_image_of_mem _ ⟨e, he, hes.trans hsΘ, hy⟩⟩ + +omit [T2Space S] [T2Space Shat] hM in +theorem IsMatchSetting.endClass_of_getElem {e : Set S} (he : e ∈ P₀.Γ.E) {i : ℕ} (hi : i < + (P₀.Γ.γ e).length) (hi' : i < (D.P.Γ.γ (b e)).length) : + cap.emb (D.P.Γ.γ (b e))[i] ∈ endClass cap P₀ D.P b (P₀.Γ.γ e)[i] := + mem_image_of_mem _ ⟨e, he, i, hi, hi', rfl, rfl⟩ + +omit [T2Space S] in +theorem IsMatchSetting.length_eq {e : Set S} (he : e ∈ P₀.Γ.E) : (P₀.Γ.γ e).length = (D.P.Γ.γ + (b e)).length := by + rw [P₀.Γ.length_γ_eq he, D.P.Γ.length_γ_eq (hM.edge.mem e he), hM.edge.size e he] + +omit [T2Space S] [TopologicalSpace Shat] [T2Space Shat] hM in +theorem IsMatchSetting.getElem_mem_V {e : Set S} (he : e ∈ P₀.Γ.E) {i : ℕ} (hi : i < + (P₀.Γ.γ e).length) : (P₀.Γ.γ e)[i] ∈ P₀.Γ.V := by + have : (P₀.Γ.γ e)[i] ∈ {v | v ∈ P₀.Γ.γ e} := List.getElem_mem hi + rw [P₀.Γ.γ_set e he] at this + exact P₀.Γ.tilde_subset_V he this + +omit [T2Space S] in +theorem IsMatchSetting.iUnion_endClass : ⋃ v ∈ P₀.Γ.V, endClass cap P₀ D.P b v = allEnds cap P₀ b + := by + apply Subset.antisymm + · refine iUnion₂_subset fun v _ => ?_ + rintro _ ⟨y, ⟨e, he, i, hi, hi', -, rfl⟩, rfl⟩ + have hm : (D.P.Γ.γ (b e))[i] ∈ {v | v ∈ D.P.Γ.γ (b e)} := List.getElem_mem hi' + rw [D.P.Γ.γ_set _ (hM.edge.mem e he)] at hm + exact mem_image_of_mem _ (mem_biUnion he hm) + · rintro _ ⟨y, hy, rfl⟩ + obtain ⟨e, he, hy⟩ := mem_iUnion₂.mp hy + have hm : y ∈ {v | v ∈ D.P.Γ.γ (b e)} := by rwa [D.P.Γ.γ_set _ (hM.edge.mem e he)] + obtain ⟨i, hi', rfl⟩ := List.mem_iff_getElem.mp hm + have hi : i < (P₀.Γ.γ e).length := by rw [hM.length_eq he]; exact hi' + exact mem_iUnion₂.mpr ⟨_, TangleDatum.IsMatchSetting.getElem_mem_V he hi, + TangleDatum.IsMatchSetting.endClass_of_getElem he hi hi'⟩ + +theorem IsMatchSetting.endClass_nonempty (hS : IsSurface S) {v : S} (hv : v ∈ P₀.Γ.V) : + (endClass cap P₀ D.P b v).Nonempty := by + have h3 := P₀.fits.internally_three_connected + obtain ⟨rad⟩ := h3.nonempty_radialDrawing hS cap + obtain ⟨c, hc, hvc⟩ := exists_edge_incident hS h3 rad hv + have hvt : v ∈ tilde c := ⟨hvc, fun h => P₀.Γ.disjoint_V hc h hv⟩ + have hm : v ∈ {x | x ∈ P₀.Γ.γ c} := by rwa [P₀.Γ.γ_set _ hc] + obtain ⟨i, hi, rfl⟩ := List.mem_iff_getElem.mp hm + have hi' : i < (D.P.Γ.γ (b c)).length := by rw [← hM.length_eq hc]; exact hi + exact ⟨_, TangleDatum.IsMatchSetting.endClass_of_getElem hc hi hi'⟩ + +end TangleDatum + +/-- **Graph Minors XIX, (15.2)**, from (3.2) of Graph Minors XII. -/ +theorem theorem_15_2_proof : Theorem152Statement.{w} := by + classical + intro S Shat _ _ _ _ β cap χ P₀ + have hS := χ.isSurface + have hT := cap.isClosedSurface + have hconn : ConnectedSpace Shat := cap.connected + have hfinI := TangleDatum.finite_discIndex hS P₀ + let eI := Finite.equivFin (TangleDatum.DiscIndex S P₀) + obtain ⟨θ, hθ, hmain⟩ := GraphMinor.GM12.gm19_theorem32.{0} Shat hT hconn (Nat.card + (TangleDatum.DiscIndex S P₀)) (3 * P₀.Γ.E.ncard) + set z := 3 * P₀.Γ.E.ncard with hz + let m := θ + z + let n := 2 * (2 * m + 16 * θ + 20) + have hlab : ∀ side, ∃ ω, side ∈ χ.Φ.longSides → IsBorderLabels P₀ side ω := fun side => by + by_cases h : side ∈ χ.Φ.longSides + · obtain ⟨ω, hω⟩ := exists_isBorderLabels hS P₀ h + exact ⟨ω, fun _ => hω⟩ + · exact ⟨[], fun h' => absurd h' h⟩ + choose ω hω using hlab + refine ⟨n, by omega, ⟨2 * m + 16 * θ + 20, by omega⟩, ω, hω, fun D horient hno hrep => ?_⟩ + by_contra hall + simp only [not_or] at hall + obtain ⟨h₁, h₂, h₃, h₄⟩ := hall + have hfar : ∀ r₁ ∈ D.rad.poles, ∀ r₂ ∈ D.rad.poles, r₁ ≠ r₂ → n < D.vDist r₁ r₂ + := fun r₁ hr₁ r₂ hr₂ hne => by + by_contra hle + exact h₁ ⟨r₁, hr₁, r₂, hr₂, hne, not_lt.mp hle⟩ + have hfree : ∀ C, ¬ D.IsFreeCircuit n C := fun C hC => h₂ ⟨C, hC⟩ + have hnr : n < D.rep := by omega + have hrep4 : 4 ≤ D.rep := by omega + have hmr : m ≤ D.rep := by omega + have hro : D.rep ≤ D.ord := (tangleRep_spec D.rad D.ord D.𝒯).1 + have h3m : 3 * m < 2 * D.ord + 3 := by omega + have hm1 : 1 ≤ m := by omega + obtain ⟨b, hb⟩ := + TangleDatum.exists_edgeMap ⟨2 * m + 16 * θ + 20, by omega⟩ hrep4 hω + (fun side hs hc => h₃ ⟨side, hs, hc⟩) (fun f hf hi hc => h₄ ⟨f, hf, hi, hc⟩) + have hM : D.IsMatchSetting P₀ n b := ⟨hb, by omega, hnr, hfree, hfar⟩ + have h3 := D.P.fits.internally_three_connected + obtain ⟨H, G₃, hd⟩ := D.exists_skData (h3.hatRegions_isOpenDisc hS cap) + have hresp := D.isRespectful_skTangle hd hm1 hmr h3m + obtain ⟨ins, hins⟩ := GM11.exists_derivedSlope hT hresp hd.pre.2 + have hσ : ∀ Θ, ∃ s, Θ ∈ cuffs S → s ∈ χ.Φ.shortSides ∧ s ⊆ Θ := fun Θ => by + by_cases h : Θ ∈ cuffs S + · obtain ⟨s, h₁, h₂⟩ := TangleDatum.exists_short_on_cuff (χ := χ) hS h + exact ⟨s, fun _ => ⟨h₁, h₂⟩⟩ + · exact ⟨∅, fun h' => absurd h' h⟩ + choose σ hσ using hσ + obtain ⟨Δ, hA, hdisj, hsub, hsub₃⟩ := hM.exists_discFamily hS hd.sk (σ := σ) hσ + have hUbd : ∀ i, H.V ∩ subBd (Δ i) = TangleDatum.discEnds cap b P₀ i := fun i => + (hA i).vertex_inter_subBd + let Δ' : Fin (Nat.card (TangleDatum.DiscIndex S P₀)) → Set Shat := fun i => Δ (eI.symm i) + have hVf : Finite P₀.Γ.V := P₀.Γ.finite_V + let eV := Finite.equivFin P₀.Γ.V + let Zs : Fin (Nat.card P₀.Γ.V) → Set Shat := fun j => TangleDatum.endClass cap P₀ D.P b + (eV.symm j).1 + have hU₁ : (⋃ i, H.V ∩ subBd (Δ' i)) = TangleDatum.allEnds cap P₀ b := by + rw [← hM.iUnion_discEnds hS, ← iUnion_congr hUbd] + exact eI.symm.surjective.iUnion_comp fun i => H.V ∩ subBd (Δ i) + have hU₂ : (⋃ j, Zs j) = TangleDatum.allEnds cap P₀ b := by + rw [← hM.iUnion_endClass, biUnion_eq_iUnion] + exact eV.symm.surjective.iUnion_comp fun v : P₀.Γ.V => TangleDatum.endClass cap P₀ D.P b v.1 + have hUΔ : (⋃ i, Δ' i) = ⋃ i, Δ i := eI.symm.surjective.iUnion_comp Δ + have hallF : (TangleDatum.allEnds cap P₀ b).Finite := + (P₀.Γ.finite_edges.biUnion fun e he => D.P.Γ.finite_V.subset (D.P.Γ.tilde_subset_V + (hM.edge.mem e he))).image _ + obtain ⟨Dv, hD₁, hD₂, hD₃⟩ := theorem152Feasibility S Shat β cap χ P₀ D n b horient hM Δ (fun i + => (hA i).disc) (fun i => (hA i).sub_bd) hdisj hsub hsub₃ + have hfe : GM12.IsTopologicallyFeasible Δ' Zs := by + refine ⟨fun j => Dv (eV.symm j).1, fun j => hD₁ _ (eV.symm j).2, ?_, ?_⟩ + · intro i j hij + exact hD₂ _ (eV.symm i).2 _ (eV.symm j).2 (fun h => hij (eV.symm.injective (Subtype.ext h))) + · intro j + rw [hUΔ] + exact hD₃ _ (eV.symm j).2 + have hhalf : n / 2 = 2 * m + 16 * θ + 20 := by omega + obtain ⟨H', hs', hc', hd', hV'⟩ := hmain Δ' H m (D.skTangle H m) (GM14.tangleMetric H G₃ ins m) + (Nat.card P₀.Γ.V) Zs + (fun i => ⟨(hA _).disc, by rw [hUbd]; exact (hA _).inter⟩) + (fun i j hij => hdisj _ _ fun h => hij (eI.symm.injective h)) + (by rw [hU₁]; exact hM.ncard_allEnds_le) + (hU₂.trans hU₁.symm) + (fun j₁ j₂ h => hM.disjoint_endClass hS fun h' => h (eV.symm.injective (Subtype.ext h'))) + hfe (by omega) + ⟨⟨hd.pre.1, D.isTangle_skTangle hd.sk hm1 h3m, hresp⟩, G₃, ins, ⟨hd.pre.1, hd.pre.2, hd.max⟩, + hins, fun _ _ _ _ => rfl⟩ + (fun i j hij ri hri hmi rj hrj hmj => by + have hl := hM.lt_dist_discAnchor hS hσ (eI.symm i) (eI.symm j) (fun h => hij + (eI.symm.injective h)) + exact hd.le_skMetric hrep4 hmr hm1 h3m hins (by omega) (hA _) (hA _) + (by omega) hri hmi hrj hmj) + (fun i => by + rw [hUbd] + have hsubA : TangleDatum.discEnds cap b P₀ (eI.symm i) ⊆ TangleDatum.allEnds cap P₀ b := by + rw [← hM.iUnion_discEnds hS] + exact subset_iUnion _ _ + have hle := ncard_le_ncard hsubA hallF + have := hM.ncard_allEnds_le + exact hM.isFreeSet_discEnds hd hmr hm1 h3m hins (by omega) _ (hA _) (by omega)) + let Hv : S → Drawing Shat := fun v => if hv : v ∈ P₀.Γ.V then H' (eV ⟨v, hv⟩) else H + have hHv : ∀ v (hv : v ∈ P₀.Γ.V), Hv v = H' (eV ⟨v, hv⟩) := fun v hv => dite_eq_left hv + have hZ : ∀ v (hv : v ∈ P₀.Γ.V), TangleDatum.endClass cap P₀ D.P b v ⊆ (Hv v).V := fun v hv x hx + => by + rw [hHv v hv] + have h := hV' (eV ⟨v, hv⟩) + have hzs : Zs (eV ⟨v, hv⟩) = TangleDatum.endClass cap P₀ D.P b v := by + change TangleDatum.endClass cap P₀ D.P b (eV.symm (eV ⟨v, hv⟩)).1 = _ + rw [Equiv.symm_apply_apply] + rw [hzs] at h + exact (h ▸ hx : x ∈ (H' (eV ⟨v, hv⟩)).V ∩ _).1 + refine hno ⟨_, _, isColouredInflation_of_subdrawings hS hd.sk hb Hv + (fun v hv => ?_) (fun v hv => ?_) (fun v hv v' hv' hne => ?_) (fun v hv => ?_) + (fun e he i hi hi' => ?_)⟩ + · rw [hHv v hv] + exact hs' _ + · rw [hHv v hv] + exact hc' _ + · rw [hHv v hv, hHv v' hv'] + exact hd' _ _ fun h => hne (congrArg Subtype.val (eV.injective h)) + · exact (hM.endClass_nonempty hS hv).mono (hZ v hv) + · exact hZ _ (TangleDatum.IsMatchSetting.getElem_mem_V he hi) + (TangleDatum.IsMatchSetting.endClass_of_getElem he hi hi') + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section2.lean b/LeanPool/GraphMinor/GM19/Section2.lean new file mode 100644 index 0000000000..65248b8a44 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section2.lean @@ -0,0 +1,791 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.CapExists +public import LeanPool.GraphMinor.GM19.Section4c +public import LeanPool.GraphMinor.GM20.Cited +public import LeanPool.GraphMinor.Surface.MoveCuff + +/-! +# Graph Minors XIX, (2.1) from (3.1) + +This is the proof of (2.1) on pages 330–331 of the paper. The topology of that proof, which is +making +the frame and the thin paintings, is the named statement `Theorem21TopologyStatement`. Everything +else +is here: colouring the new paintings, passing to a subsequence for the short sides, and turning a +linear inflation of the new paintings back into one of the old paintings. +The deductions that use later proofs are in `Section2Proved`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface + +universe u w + +variable {S : Type u} [TopologicalSpace S] + +/-- `Γ'` is the painting that the proof of Graph Minors XIX, (2.1) (pages 330–331), makes from `Γ`. +It is the image of `Γ` under the homeomorphism `h`, with each edge of size 3 replaced by the three +arcs of its boundary and a thin disc `s(e)` inside it. The directions of the border edges are those +of the frame. -/ +structure IsThinning (Φ : Frame S) (Γ : Painting S) (h : S ≃ₜ S) (Γ' : Painting S) + (s : Set S → Set S) : Prop where + null : HasNullSignature h + null_symm : HasNullSignature h.symm + V_eq : Γ'.V = h '' Γ.V + fits : Γ'.Fits Φ + three : ∀ e ∈ Γ.E, (tilde e).ncard = 3 → + s e ∈ Γ'.E ∧ tilde (s e) = h '' tilde e ∧ Γ'.γ (s e) = (Γ.γ e).map h + three_inj : InjOn s {e ∈ Γ.E | (tilde e).ncard = 3} + three_surj : ∀ e' ∈ Γ'.E, (tilde e').ncard = 3 → ∃ e ∈ Γ.E, (tilde e).ncard = 3 ∧ s e = e' + two : ∀ e ∈ Γ.E, (tilde e).ncard = 2 → h '' e ∈ Γ'.E + internal_γ : ∀ e ∈ Γ.E, (tilde e).ncard = 2 → Painting.IsInternal e → + Γ'.γ (h '' e) = (Γ.γ e).map h + border_γ : ∀ e ∈ Γ.E, Painting.IsBorder e → + Γ'.γ (h '' e) = (Γ.γ e).map h ∨ Γ'.γ (h '' e) = ((Γ.γ e).map h).reverse + rest : ∀ e' ∈ Γ'.E, (tilde e').ncard = 2 → (∃ e ∈ Γ.E, (tilde e).ncard = 2 ∧ h '' e = e') ∨ + (Painting.IsInternal e' ∧ ∃ c ∈ Γ.E, (tilde c).ncard = 3 ∧ tilde e' ⊆ h '' tilde c) + short : ∀ t ∈ Φ.shortSides, ∃ e ∈ Γ.E, h '' e = t + +/-- The topology in the proof of Graph Minors XIX, (2.1) (pages 330–331): there is a frame with one +long and one short side on each cuff, and each internally 3-connected painting has, after a +homeomorphism that keeps each cuff and its orientation, a thinning that fits this frame. The rest of +that proof is `GM19.theorem_2_1_proof`. -/ +def Theorem21TopologyStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S], IsSurface S → ConnectedSpace S → + ∃ Φ : Frame S, ∀ Γ : Painting S, Γ.IsInternallyThreeConnected → + ∃ (h : S ≃ₜ S) (Γ' : Painting S) (s : Set S → Set S), IsThinning Φ Γ h Γ' s + +/-! ### Orders -/ + +namespace QuasiOrder + +/-- The quasi-order `Ω × R` of the paper. The sixth label is for short sides. -/ +def labelOrder (Ω : Type w) [Preorder Ω] : QuasiOrder (Ω × Fin 6) where + E := univ + le x y := x.1 ≤ y.1 ∧ x.2 = y.2 + refl _ _ := ⟨le_rfl, rfl⟩ + trans _ _ _ _ _ _ h₁ h₂ := ⟨h₁.1.trans h₂.1, h₁.2.trans h₂.2⟩ + +theorem labelOrder_isWQO (Ω : Type w) [Preorder Ω] [WellQuasiOrderedLE Ω] : + (labelOrder Ω).IsWQO := fun f _ ↦ + ((wellQuasiOrdered_le (α := Ω)).prod (Finite.wellQuasiOrdered (Eq : Fin 6 → Fin 6 → Prop))) f + +/-- The quasi-order with one element. -/ +def pointOrder {α : Type w} (x : α) : QuasiOrder α where + E := {x} + le := Eq + refl _ _ := rfl + trans _ _ _ _ _ _ h₁ h₂ := h₁.trans h₂ + +theorem pointOrder_isWQO {α : Type w} (x : α) : (pointOrder x).IsWQO := fun _f hf ↦ + ⟨0, 1, Nat.zero_lt_one, (hf 0).trans (hf 1).symm⟩ + +end QuasiOrder + +/-! ### Order on a cuff -/ + +theorem continuous_cuffPoint {Θ : Set S} (f : Circle ≃ₜ Θ) : Continuous (cuffPoint f) := + continuous_subtype_val.comp (f.continuous.comp Circle.exp.continuous) + +/-- The other orientation of `Θ`. -/ +noncomputable def revParam {Θ : Set S} (f : Circle ≃ₜ Θ) : Circle ≃ₜ Θ := + (Homeomorph.inv Circle).trans f + +theorem cuffPoint_revParam {Θ : Set S} (f : Circle ≃ₜ Θ) (t : ℝ) : + cuffPoint (revParam f) t = cuffPoint f (-t) := by + simp [cuffPoint, revParam, Circle.exp_neg] + +theorem revParam_revParam {Θ : Set S} (f : Circle ≃ₜ Θ) : revParam (revParam f) = f := by + ext x + simp [revParam] + +theorem cuffPoint_add {Θ : Set S} (f : Circle ≃ₜ Θ) (t : ℝ) : + cuffPoint f (t + 2 * Real.pi) = cuffPoint f t := by + simp [cuffPoint, Circle.exp_add, Circle.exp_two_pi] + +/-- A homeomorphism with null signature keeps the order on each cuff. -/ +theorem ImmediatelyPrecedes.null {α : S ≃ₜ S} (hα : HasNullSignature α) {Θ : Set S} + (hΘ : Θ ∈ cuffs S) {f : Circle ≃ₜ Θ} {n : S} {A : Set S} (h : ImmediatelyPrecedes f n A) : + ImmediatelyPrecedes f (α n) (α '' A) := by + obtain ⟨g, ⟨l, hlc, hlm, hl⟩, hg⟩ := hα Θ f hΘ + obtain ⟨t₀, t₁, h01, h02, hn, rfl⟩ := h + have hcp : ∀ t, α (cuffPoint f t) = cuffPoint f (l t) := fun t ↦ by + simp only [cuffPoint] + rw [hg, hl] + have hIoo : l '' Ioo t₀ t₁ = Ioo (l t₀) (l t₁) := by + apply Subset.antisymm + · rintro _ ⟨t, ht, rfl⟩ + exact ⟨hlm ht.1, hlm ht.2⟩ + · exact intermediate_value_Ioo h01.le hlc.continuousOn + refine ⟨l t₀, l t₁, hlm h01, ?_, by rw [← hcp, hn], ?_⟩ + · have := hlm.monotone h02 + rwa [lift_period hlc hlm hl] at this + · rw [← hIoo, image_image, image_image] + exact image_congr fun t _ ↦ hcp t + +/-- Turning the orientation around: the other end of `A` immediately precedes `A`. -/ +theorem ImmediatelyPrecedes.reverse [T2Space S] {Θ : Set S} {f : Circle ≃ₜ Θ} {n m : S} {A : Set S} + (h : ImmediatelyPrecedes f n A) (hm : m ∈ tilde A) (hne : m ≠ n) : + ImmediatelyPrecedes (revParam f) m A := by + obtain ⟨t₀, t₁, h01, h02, rfl, rfl⟩ := h + have hc := continuous_cuffPoint f + have hcl : closure (cuffPoint f '' Ioo t₀ t₁) ⊆ cuffPoint f '' Icc t₀ t₁ := + closure_minimal (image_mono Ioo_subset_Icc_self) (isCompact_Icc.image hc).isClosed + obtain ⟨t, ht, rfl⟩ := hcl hm.1 + have ht0 : t ≠ t₀ := fun h ↦ hne (by rw [h]) + have ht1 : t = t₁ := by + by_contra hn' + refine hm.2 (mem_image_of_mem _ ⟨lt_of_le_of_ne ht.1 ht0.symm, lt_of_le_of_ne ht.2 hn'⟩) + subst ht1 + refine ⟨-t, -t₀, neg_lt_neg h01, by linarith, ?_, ?_⟩ + · rw [cuffPoint_revParam, neg_neg] + · ext x + constructor + · rintro ⟨u, hu, rfl⟩ + exact ⟨-u, ⟨by linarith [hu.2], by linarith [hu.1]⟩, by rw [cuffPoint_revParam, neg_neg]⟩ + · rintro ⟨u, hu, rfl⟩ + exact ⟨-u, ⟨by linarith [hu.2], by linarith [hu.1]⟩, by rw [cuffPoint_revParam]⟩ + +theorem null_mem {α : S ≃ₜ S} (hα : HasNullSignature α) {Θ : Set S} (hΘ : Θ ∈ cuffs S) + (hO : IsOArc Θ) {a : S} (ha : a ∈ Θ) : α a ∈ Θ := by + obtain ⟨f⟩ := hO + obtain ⟨g, -, hg⟩ := hα Θ f hΘ + have := hg (f.symm ⟨a, ha⟩) + simp only [Homeomorph.apply_symm_apply] at this + rw [this] + exact (f _).2 + +/-! ### Paintings -/ + +theorem tilde_image_homeo (h : S ≃ₜ S) (e : Set S) : tilde (h '' e) = h '' tilde e := by + rw [tilde, tilde, ← h.image_closure, image_sdiff h.injective] + +theorem ncard_tilde_image (h : S ≃ₜ S) (e : Set S) : + (tilde (h '' e)).ncard = (tilde e).ncard := by + rw [tilde_image_homeo, ncard_image_of_injective _ h.injective] + +theorem isBorder_image (h : S ≃ₜ S) {e : Set S} : + Painting.IsBorder (h '' e) ↔ Painting.IsBorder e := by + have hset : h '' e ∩ bd S = h '' (e ∩ bd S) := by + conv_lhs => rw [← image_bd h] + exact (image_inter h.injective).symm + simp only [Painting.IsBorder] + rw [hset, image_nonempty] + +theorem isInternal_iff_not_border {e : Set S} : Painting.IsInternal e ↔ ¬ Painting.IsBorder e := by + rw [Painting.IsInternal, Painting.IsBorder, not_nonempty_iff_eq_empty, + disjoint_iff_inter_eq_empty] + +theorem size_two_of_border (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) + (hb : Painting.IsBorder e) : (tilde e).ncard = 2 := + (Γ.border_edge e he hb).1 + +theorem internal_of_three (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) (h3 : (tilde e).ncard = 3) : + Painting.IsInternal e := by + rw [isInternal_iff_not_border] + intro hb + have := size_two_of_border Γ he hb + omega + +namespace IsThinning + +variable {Φ : Frame S} {Γ Γ' : Painting S} {h : S ≃ₜ S} {s : Set S → Set S} + +theorem size_s (T : IsThinning Φ Γ h Γ' s) {e : Set S} (he : e ∈ Γ.E) (h3 : (tilde e).ncard = 3) : + (tilde (s e)).ncard = 3 := by + rw [(T.three e he h3).2.1, ncard_image_of_injective _ h.injective, h3] + +/-- The new edge of an old edge. -/ +noncomputable def edge (_Γ : Painting S) (h : S ≃ₜ S) (s : Set S → Set S) (e : Set S) : Set S := + open Classical in if (tilde e).ncard = 3 then s e else h '' e + +theorem edge_three {e : Set S} (h3 : (tilde e).ncard = 3) : edge Γ h s e = s e := ite_eq_left h3 + +theorem edge_two {e : Set S} (h2 : (tilde e).ncard = 2) : edge Γ h s e = h '' e := + ite_eq_right (by omega) + +theorem edge_mem (T : IsThinning Φ Γ h Γ' s) {e : Set S} (he : e ∈ Γ.E) : + edge Γ h s e ∈ Γ'.E := by + rcases Γ.size_cases he with h2 | h3 + · rw [edge_two h2] + exact T.two e he h2 + · rw [edge_three h3] + exact (T.three e he h3).1 + +theorem edge_size (T : IsThinning Φ Γ h Γ' s) {e : Set S} (he : e ∈ Γ.E) : + (tilde (edge Γ h s e)).ncard = (tilde e).ncard := by + rcases Γ.size_cases he with h2 | h3 + · rw [edge_two h2, ncard_tilde_image] + · rw [edge_three h3, T.size_s he h3, h3] + +theorem edge_inj (T : IsThinning Φ Γ h Γ' s) {e₁ e₂ : Set S} (h₁ : e₁ ∈ Γ.E) (h₂ : e₂ ∈ Γ.E) + (he : edge Γ h s e₁ = edge Γ h s e₂) : e₁ = e₂ := by + have hsz : (tilde e₁).ncard = (tilde e₂).ncard := by + rw [← T.edge_size h₁, ← T.edge_size h₂, he] + rcases Γ.size_cases h₁ with h2 | h3 + · rw [edge_two h2, edge_two (hsz ▸ h2)] at he + exact image_injective.2 h.injective he + · rw [edge_three h3, edge_three (hsz ▸ h3)] at he + exact T.three_inj ⟨h₁, h3⟩ ⟨h₂, hsz ▸ h3⟩ he + +/-- Adjacent vertices of the new skeleton come from adjacent vertices of the old one. -/ +theorem skAdj_symm (T : IsThinning Φ Γ h Γ' s) {a b : S} (hab : Γ'.skAdj.Adj a b) : + Γ.skAdj.Adj (h.symm a) (h.symm b) := by + obtain ⟨hne, ha, hb, e', he', hae, hbe⟩ := hab + have hV : ∀ {x}, x ∈ Γ'.V → h.symm x ∈ Γ.V := fun {x} hx ↦ by + rw [T.V_eq] at hx + obtain ⟨y, hy, rfl⟩ := hx + simpa using hy + have hsym : ∀ {X : Set S} {x}, x ∈ h '' X → h.symm x ∈ X := fun {X x} hx ↦ by + obtain ⟨y, hy, rfl⟩ := hx + simpa using hy + refine ⟨fun he ↦ hne (h.symm.injective he), hV ha, hV hb, ?_⟩ + rcases Γ'.size_cases he' with h2 | h3 + · rcases T.rest e' he' h2 with ⟨e, he, -, rfl⟩ | ⟨-, c, hc, -, hsub⟩ + · rw [tilde_image_homeo] at hae hbe + exact ⟨e, he, hsym hae, hsym hbe⟩ + · exact ⟨c, hc, hsym (hsub hae), hsym (hsub hbe)⟩ + · obtain ⟨e, he, h3', rfl⟩ := T.three_surj e' he' h3 + rw [(T.three e he h3').2.1] at hae hbe + exact ⟨e, he, hsym hae, hsym hbe⟩ + +theorem side_of_border (T : IsThinning Φ Γ h Γ' s) {y : Set S} (hy : y ∈ Γ'.E) + (hb : Painting.IsBorder y) : ∃ t ∈ Φ.sides, y ⊆ t := by + have hsub : y ⊆ bd S \ Φ.V := fun x hx ↦ + ⟨(Γ'.border_edge y hy hb).2 hx, fun hV ↦ (hy.2.1 hx).2 (T.fits.V_subset hV)⟩ + obtain ⟨t, ht, hyt⟩ := exists_arcComp_superset hy.2.2.1 hsub + exact ⟨t, ht, hyt⟩ + +end IsThinning + +/-! ### The colouring -/ + +variable {Ω : Type w} [Preorder Ω] + +open Classical in +/-- The colouring `φ'` of the paper, with labels `-1, 0, 1, 2, 3` written `0, 1, 2, 3, 4`. -/ +noncomputable def thinColour (Φ : Frame S) (Γ Γ' : Painting S) (h : S ≃ₜ S) (s : Set S → Set S) + (φ : Set S → Ω) (x₀ : Ω) (e' : Set S) : Ω × Fin 6 := + if h₃ : ∃ e ∈ Γ.E, (tilde e).ncard = 3 ∧ s e = e' then (φ h₃.choose, 4) + else if e' ∈ Φ.shortSides then (x₀, 5) + else if h₂ : ∃ e ∈ Γ.E, (tilde e).ncard = 2 ∧ h '' e = e' then + (φ h₂.choose, if Painting.IsInternal e' then 3 + else if Γ'.γ e' = (Γ.γ h₂.choose).map h then 2 else 0) + else (x₀, 1) + +section Colour + +variable {Φ : Frame S} {Γ Γ' : Painting S} {h : S ≃ₜ S} {s : Set S → Set S} + {φ : Set S → Ω} {x₀ : Ω} + +omit [Preorder Ω] in +theorem thinColour_three (T : IsThinning Φ Γ h Γ' s) {e : Set S} (he : e ∈ Γ.E) + (h3 : (tilde e).ncard = 3) : thinColour Φ Γ Γ' h s φ x₀ (s e) = (φ e, 4) := by + have hex : ∃ c ∈ Γ.E, (tilde c).ncard = 3 ∧ s c = s e := ⟨e, he, h3, rfl⟩ + rw [thinColour, dite_eq_left hex] + have hc := hex.choose_spec + rw [T.three_inj ⟨hc.1, hc.2.1⟩ ⟨he, h3⟩ hc.2.2] + +theorem no_three_of_size (T : IsThinning Φ Γ h Γ' s) {e' : Set S} (h2 : (tilde e').ncard = 2) : + ¬ ∃ e ∈ Γ.E, (tilde e).ncard = 3 ∧ s e = e' := by + rintro ⟨e, he, h3, rfl⟩ + have := T.size_s he h3 + omega + +omit [Preorder Ω] in +theorem thinColour_short (T : IsThinning Φ Γ h Γ' s) {t : Set S} (ht : t ∈ Φ.shortSides) : + thinColour Φ Γ Γ' h s φ x₀ t = (x₀, 5) := by + rw [thinColour, dite_eq_right (no_three_of_size T (Φ.side_shape t ht.1).1), ite_eq_left ht] + +open Classical in +omit [Preorder Ω] in +theorem thinColour_two (T : IsThinning Φ Γ h Γ' s) {e : Set S} (he : e ∈ Γ.E) + (h2 : (tilde e).ncard = 2) (hs : h '' e ∉ Φ.shortSides) : + thinColour Φ Γ Γ' h s φ x₀ (h '' e) = (φ e, if Painting.IsInternal (h '' e) then 3 + else if Γ'.γ (h '' e) = (Γ.γ e).map h then 2 else 0) := by + classical + have hex : ∃ c ∈ Γ.E, (tilde c).ncard = 2 ∧ h '' c = h '' e := ⟨e, he, h2, rfl⟩ + rw [thinColour, dite_eq_right (no_three_of_size T (by rw [ncard_tilde_image, h2])), ite_eq_right + hs, dite_eq_left hex] + have hc : hex.choose = e := image_injective.2 h.injective hex.choose_spec.2.2 + rw [hc] + +omit [Preorder Ω] in +/-- The label of an edge of size 2 of the new painting. -/ +theorem thinColour_cases (T : IsThinning Φ Γ h Γ' s) {e' : Set S} (he' : e' ∈ Γ'.E) + (h2 : (tilde e').ncard = 2) : + e' ∈ Φ.shortSides ∨ + (∃ e ∈ Γ.E, (tilde e).ncard = 2 ∧ h '' e = e' ∧ e' ∉ Φ.shortSides) ∨ + (thinColour Φ Γ Γ' h s φ x₀ e').2 = 1 := by + classical + by_cases hs : e' ∈ Φ.shortSides + · exact Or.inl hs + by_cases hex : ∃ e ∈ Γ.E, (tilde e).ncard = 2 ∧ h '' e = e' + · obtain ⟨e, he, h2', rfl⟩ := hex + exact Or.inr (Or.inl ⟨e, he, h2', rfl, hs⟩) + · refine Or.inr (Or.inr ?_) + rw [thinColour, dite_eq_right (no_three_of_size T h2), ite_eq_right hs, dite_eq_right hex] + +theorem nonempty_edge (Γ' : Painting S) {e : Set S} (he : e ∈ Γ'.E) : e.Nonempty := he.1 + +/-- A border edge of a painting that is inside a short side is this side. -/ +theorem eq_of_subset_short (T : IsThinning Φ Γ h Γ' s) {y t : Set S} (hy : y ∈ Γ'.E) + (ht : t ∈ Φ.shortSides) (hsub : y ⊆ t) : y = t := by + obtain ⟨x, hx⟩ := hy.1 + exact arcComp_eq_of_mem hy (T.fits.short_sides ht) hx (hsub hx) + +end Colour + +/-- The colour scheme `χ` of the paper. -/ +noncomputable def thinScheme [WellQuasiOrderedLE Ω] (hS : IsSurface S) (hc : ConnectedSpace S) + (Φ : Frame S) (x₀ : Ω) : ColourScheme S (Ω × Fin 6) := + open Classical in + { isSurface := hS + connected := hc + Φ := Φ + Ω2 := QuasiOrder.labelOrder Ω + Ω3 := QuasiOrder.labelOrder Ω + ΩS := fun t ↦ if t ∈ Φ.shortSides then QuasiOrder.pointOrder (x₀, 5) + else QuasiOrder.labelOrder Ω + shortElem := fun _ ↦ (x₀, 5) + isWQO_2 := QuasiOrder.labelOrder_isWQO Ω + isWQO_3 := QuasiOrder.labelOrder_isWQO Ω + isWQO_S := fun t _ ↦ by + split_ifs + · exact QuasiOrder.pointOrder_isWQO _ + · exact QuasiOrder.labelOrder_isWQO Ω + short_singleton := fun t ht ↦ by + rw [ite_eq_left ht] + rfl } + +/-- The `χ`-coloured painting `(Γ', φ')` of the paper. -/ +noncomputable def thinPainting [WellQuasiOrderedLE Ω] {Φ : Frame S} {Γ Γ' : Painting S} + {h : S ≃ₜ S} {s : Set S → Set S} (T : IsThinning Φ Γ h Γ' s) (hS : IsSurface S) + (hc : ConnectedSpace S) (φ : Set S → Ω) (x₀ : Ω) : ColouredPainting + (thinScheme hS hc Φ x₀) where + Γ := Γ' + φ := thinColour Φ Γ Γ' h s φ x₀ + fits := T.fits + internal_2_mem _ _ _ _ := mem_univ _ + internal_3_mem _ _ _ _ := mem_univ _ + border_mem e he t ht hb := by + classical + by_cases hs : t ∈ Φ.shortSides + · have heq := eq_of_subset_short T he hs hb.2 + change _ ∈ (if t ∈ Φ.shortSides then QuasiOrder.pointOrder (x₀, 5) + else QuasiOrder.labelOrder Ω).E + rw [ite_eq_left hs, heq, thinColour_short T hs] + rfl + · change _ ∈ (if t ∈ Φ.shortSides then QuasiOrder.pointOrder (x₀, 5) + else QuasiOrder.labelOrder Ω).E + rw [ite_eq_right hs] + exact mem_univ _ + +/-! ### Turning an inflation back -/ + +section Pull + +variable [WellQuasiOrderedLE Ω] {Φ : Frame S} {Γ₁ Γ₁' Γ₂ Γ₂' : Painting S} {h₁ h₂ : S ≃ₜ S} + {s₁ s₂ : Set S → Set S} {φ₁ φ₂ : Set S → Ω} {x₀ : Ω} + +/-- The direction of the new edge against the old one, for a pair of matched edges. -/ +def SameDir (Γ₁ Γ₁' Γ₂ Γ₂' : Painting S) (h₁ h₂ : S ≃ₜ S) (e f y z : Set S) : Prop := + (Γ₁'.γ y = (Γ₁.γ e).map h₁ ∧ Γ₂'.γ z = (Γ₂.γ f).map h₂) ∨ + (Γ₁'.γ y = ((Γ₁.γ e).map h₁).reverse ∧ Γ₂'.γ z = ((Γ₂.γ f).map h₂).reverse ∧ + Painting.IsBorder e) + +/-- Each old edge has its partner `f`. This is the text from "We construct `σ`" to the end of (2) in +the paper. -/ +theorem exists_partner (hS : IsSurface S) (hc : ConnectedSpace S) + (T₁ : IsThinning Φ Γ₁ h₁ Γ₁' s₁) (T₂ : IsThinning Φ Γ₂ h₂ Γ₂' s₂) + (hshort : ∀ t ∈ Φ.shortSides, ∀ e₁ ∈ Γ₁.E, ∀ e₂ ∈ Γ₂.E, h₁ '' e₁ = t → h₂ '' e₂ = t → + φ₁ e₁ ≤ φ₂ e₂ ∧ (Γ₁'.γ t = (Γ₁.γ e₁).map h₁ ↔ Γ₂'.γ t = (Γ₂.γ e₂).map h₂)) + {σv : S → Set S} {σe : Set S → Set S} + (hσ : IsColouredLinearInflation (thinScheme hS hc Φ x₀) (thinPainting T₁ hS hc φ₁ x₀) + (thinPainting T₂ hS hc φ₂ x₀) σv σe) + {e : Set S} (he : e ∈ Γ₁.E) : + ∃ f ∈ Γ₂.E, (tilde f).ncard = (tilde e).ncard ∧ φ₁ e ≤ φ₂ f ∧ + σe (IsThinning.edge Γ₁ h₁ s₁ e) = IsThinning.edge Γ₂ h₂ s₂ f ∧ + SameDir Γ₁ Γ₁' Γ₂ Γ₂' h₁ h₂ e f (IsThinning.edge Γ₁ h₁ s₁ e) (IsThinning.edge Γ₂ h₂ s₂ f) + := by + classical + have hmem : ∀ {y}, y ∈ Γ₁'.E → σe y ∈ Γ₂'.E := fun {y} hy ↦ hσ.isInflation.edge_mem y hy + have hsz : ∀ {y}, y ∈ Γ₁'.E → (tilde (σe y)).ncard = (tilde y).ncard := fun {y} hy ↦ + hσ.isInflation.edge_size y hy + rcases Γ₁.size_cases he with h2 | h3 + · have hy₁ : h₁ '' e ∈ Γ₁'.E := T₁.two e he h2 + have hy2 : (tilde (h₁ '' e)).ncard = 2 := by rw [ncard_tilde_image, h2] + have hz2 : (tilde (σe (h₁ '' e))).ncard = 2 := by rw [hsz hy₁, hy2] + have hedge : IsThinning.edge Γ₁ h₁ s₁ e = h₁ '' e := IsThinning.edge_two h2 + rw [hedge] + have partner : ∀ c : Fin 6, c ≠ 1 → c ≠ 5 → + (thinColour Φ Γ₂ Γ₂' h₂ s₂ φ₂ x₀ (σe (h₁ '' e))).2 = c → + ∃ f ∈ Γ₂.E, (tilde f).ncard = 2 ∧ h₂ '' f = σe (h₁ '' e) ∧ σe (h₁ '' e) ∉ Φ.shortSides := by + intro c hc1 hc5 hlab + rcases thinColour_cases (φ := φ₂) (x₀ := x₀) T₂ (hmem hy₁) hz2 with hs | hf | h1 + · rw [thinColour_short T₂ hs] at hlab + exact absurd hlab.symm hc5 + · exact hf + · exact absurd (hlab.symm.trans h1) hc1 + by_cases hb : Painting.IsBorder e + · have hyb : Painting.IsBorder (h₁ '' e) := (isBorder_image h₁).2 hb + by_cases hsh : h₁ '' e ∈ Φ.shortSides + · obtain ⟨hzb, hzs⟩ := hσ.respects _ hy₁ hyb + have hzsub : σe (h₁ '' e) ⊆ h₁ '' e := (hzs _ hsh.1).1 Subset.rfl + have hz : σe (h₁ '' e) = h₁ '' e := eq_of_subset_short T₂ (hmem hy₁) hsh hzsub + obtain ⟨f, hf, hft⟩ := T₂.short _ hsh + have hf2 : (tilde f).ncard = 2 := by + rw [← ncard_tilde_image h₂, hft, hy2] + obtain ⟨hle, hiff⟩ := hshort _ hsh e he f hf rfl hft + have hedgef : IsThinning.edge Γ₂ h₂ s₂ f = h₁ '' e := by + rw [IsThinning.edge_two hf2, hft] + refine ⟨f, hf, hf2.trans h2.symm, hle, by rw [hz, hedgef], ?_⟩ + rw [hedgef] + have hf' : Painting.IsBorder f := by + rw [← isBorder_image h₂, hft] + exact hyb + have hfγ := T₂.border_γ f hf hf' + rw [hft] at hfγ + rcases T₁.border_γ e he hb with hg | hg + · exact Or.inl ⟨hg, hiff.1 hg⟩ + · by_cases hg' : Γ₁'.γ (h₁ '' e) = (Γ₁.γ e).map h₁ + · exact Or.inl ⟨hg', hiff.1 hg'⟩ + · exact Or.inr ⟨hg, hfγ.resolve_left fun h ↦ hg' (hiff.2 h), hb⟩ + · obtain ⟨t, ht, hyt⟩ := T₁.side_of_border hy₁ hyb + have htshort : t ∉ Φ.shortSides := fun hts ↦ + hsh ((eq_of_subset_short T₁ hy₁ hts hyt).symm ▸ hts) + have hle := hσ.le_border _ hy₁ t ht ⟨hyb, hyt⟩ + have hle' : (thinColour Φ Γ₁ Γ₁' h₁ s₁ φ₁ x₀ (h₁ '' e)).1 ≤ + (thinColour Φ Γ₂ Γ₂' h₂ s₂ φ₂ x₀ (σe (h₁ '' e))).1 ∧ + (thinColour Φ Γ₁ Γ₁' h₁ s₁ φ₁ x₀ (h₁ '' e)).2 = + (thinColour Φ Γ₂ Γ₂' h₂ s₂ φ₂ x₀ (σe (h₁ '' e))).2 := by + change (if t ∈ Φ.shortSides then QuasiOrder.pointOrder ((x₀, 5) : Ω × Fin 6) + else QuasiOrder.labelOrder Ω).le _ _ at hle + rw [ite_eq_right htshort] at hle + exact hle + have hyint : ¬ Painting.IsInternal (h₁ '' e) := fun hi ↦ + (isInternal_iff_not_border.1 hi) hyb + rw [thinColour_two T₁ he h2 hsh, ite_eq_right hyint] at hle' + by_cases hdir : Γ₁'.γ (h₁ '' e) = (Γ₁.γ e).map h₁ + · rw [ite_eq_left hdir] at hle' + obtain ⟨f, hf, hf2, hfz, hzs⟩ := partner 2 (by decide) (by decide) hle'.2.symm + have hedgef : IsThinning.edge Γ₂ h₂ s₂ f = σe (h₁ '' e) := by + rw [IsThinning.edge_two hf2, hfz] + rw [← hfz, thinColour_two T₂ hf hf2 (hfz ▸ hzs)] at hle' + refine ⟨f, hf, hf2.trans h2.symm, hle'.1, hedgef.symm, ?_⟩ + rw [hedgef] + refine Or.inl ⟨hdir, ?_⟩ + have hl := hle'.2 + rw [← hfz] + by_contra hn + simp only [hn, ite_false] at hl + split_ifs at hl <;> simp at hl + · rw [ite_eq_right hdir] at hle' + obtain ⟨f, hf, hf2, hfz, hzs⟩ := partner 0 (by decide) (by decide) hle'.2.symm + have hedgef : IsThinning.edge Γ₂ h₂ s₂ f = σe (h₁ '' e) := by + rw [IsThinning.edge_two hf2, hfz] + rw [← hfz, thinColour_two T₂ hf hf2 (hfz ▸ hzs)] at hle' + refine ⟨f, hf, hf2.trans h2.symm, hle'.1, hedgef.symm, ?_⟩ + rw [hedgef] + have hl := hle'.2 + have hni : ¬ Painting.IsInternal (h₂ '' f) := fun hi ↦ by + simp only [hi, ite_true] at hl + simp at hl + have hnd : Γ₂'.γ (h₂ '' f) ≠ (Γ₂.γ f).map h₂ := fun hd ↦ by + simp only [hni, hd, ite_false, ite_true] at hl + simp at hl + have hf' : Painting.IsBorder f := by + rw [← isBorder_image h₂] + by_contra hn + exact hni (isInternal_iff_not_border.2 hn) + refine Or.inr ⟨(T₁.border_γ e he hb).resolve_left hdir, ?_, hb⟩ + rw [← hfz] + exact (T₂.border_γ f hf hf').resolve_left hnd + · have hint : Painting.IsInternal e := isInternal_iff_not_border.2 hb + have hyint : Painting.IsInternal (h₁ '' e) := isInternal_iff_not_border.2 fun h' ↦ + hb ((isBorder_image h₁).1 h') + have hsh : h₁ '' e ∉ Φ.shortSides := fun hts ↦ by + obtain ⟨x, hx⟩ := hy₁.1 + have hxb : x ∈ bd S := (hts.1.2.1 hx).1 + exact disjoint_left.1 hyint hx hxb + have hle : (thinColour Φ Γ₁ Γ₁' h₁ s₁ φ₁ x₀ (h₁ '' e)).1 ≤ + (thinColour Φ Γ₂ Γ₂' h₂ s₂ φ₂ x₀ (σe (h₁ '' e))).1 ∧ + (thinColour Φ Γ₁ Γ₁' h₁ s₁ φ₁ x₀ (h₁ '' e)).2 = + (thinColour Φ Γ₂ Γ₂' h₂ s₂ φ₂ x₀ (σe (h₁ '' e))).2 := + hσ.le_internal_2 _ hy₁ hyint hy2 + rw [thinColour_two T₁ he h2 hsh, ite_eq_left hyint] at hle + obtain ⟨f, hf, hf2, hfz, hzs⟩ := partner 3 (by decide) (by decide) hle.2.symm + have hedgef : IsThinning.edge Γ₂ h₂ s₂ f = σe (h₁ '' e) := by + rw [IsThinning.edge_two hf2, hfz] + rw [← hfz, thinColour_two T₂ hf hf2 (hfz ▸ hzs)] at hle + refine ⟨f, hf, hf2.trans h2.symm, hle.1, hedgef.symm, ?_⟩ + rw [hedgef, ← hfz] + have hl := hle.2 + have hi : Painting.IsInternal (h₂ '' f) := by + by_contra hn + simp only [hn, ite_false] at hl + split_ifs at hl <;> simp at hl + have hi' : Painting.IsInternal f := isInternal_iff_not_border.2 fun h' ↦ + (isInternal_iff_not_border.1 hi) ((isBorder_image h₂).2 h') + exact Or.inl ⟨T₁.internal_γ e he h2 hint, T₂.internal_γ f hf hf2 hi'⟩ + · have hy₁ := (T₁.three e he h3).1 + have hedge : IsThinning.edge Γ₁ h₁ s₁ e = s₁ e := IsThinning.edge_three h3 + rw [hedge] + have hy3 := T₁.size_s he h3 + have hint : Painting.IsInternal (s₁ e) := internal_of_three Γ₁' hy₁ hy3 + have hz3 : (tilde (σe (s₁ e))).ncard = 3 := by rw [hsz hy₁, hy3] + obtain ⟨f, hf, hf3, hfz⟩ := T₂.three_surj _ (hmem hy₁) hz3 + have hle : (thinColour Φ Γ₁ Γ₁' h₁ s₁ φ₁ x₀ (s₁ e)).1 ≤ + (thinColour Φ Γ₂ Γ₂' h₂ s₂ φ₂ x₀ (σe (s₁ e))).1 ∧ + (thinColour Φ Γ₁ Γ₁' h₁ s₁ φ₁ x₀ (s₁ e)).2 = + (thinColour Φ Γ₂ Γ₂' h₂ s₂ φ₂ x₀ (σe (s₁ e))).2 := + hσ.le_internal_3 _ hy₁ hint hy3 + rw [thinColour_three T₁ he h3, ← hfz, thinColour_three T₂ hf hf3] at hle + refine ⟨f, hf, hf3.trans h3.symm, hle.1, ?_, ?_⟩ + · rw [IsThinning.edge_three hf3, hfz] + · rw [IsThinning.edge_three hf3] + exact Or.inl ⟨(T₁.three e he h3).2.2, (T₂.three f hf hf3).2.2⟩ + +theorem ends_getElem? {Γ Γ' : Painting S} {σv : S → Set S} {σe : Set S → Set S} + (hσ : IsInflation Γ Γ' σv σe) {e : Set S} (he : e ∈ Γ.E) {i : ℕ} {a b : S} + (ha : (Γ.γ e)[i]? = some a) (hb : (Γ'.γ (σe e))[i]? = some b) : b ∈ σv a := by + obtain ⟨hi, rfl⟩ := List.getElem?_eq_some_iff.1 ha + obtain ⟨hi', rfl⟩ := List.getElem?_eq_some_iff.1 hb + exact hσ.ends e he i hi hi' + +private theorem homeomorph_preserves_cuff_meets {Θ E : Set S} {α : S ≃ₜ S} + (hΘ : Θ ∈ cuffs S) (hΘO : IsOArc Θ) (hα : HasNullSignature α) + (hα' : HasNullSignature α.symm) : + (E ∩ Θ).Nonempty ↔ (α '' E ∩ Θ).Nonempty := by + constructor + · rintro ⟨x, hx, hxΘ⟩ + exact ⟨α x, mem_image_of_mem _ hx, null_mem hα hΘ hΘO hxΘ⟩ + · rintro ⟨_, ⟨x, hx, rfl⟩, hxΘ⟩ + have h := null_mem hα' hΘ hΘO hxΘ + exact ⟨x, hx, by simpa only [Homeomorph.symm_apply_apply] using h⟩ + +/-- The inflation `σ` of the paper. -/ +theorem exists_pull (hS : IsSurface S) (hc : ConnectedSpace S) + (T₁ : IsThinning Φ Γ₁ h₁ Γ₁' s₁) (T₂ : IsThinning Φ Γ₂ h₂ Γ₂' s₂) + (hshort : ∀ t ∈ Φ.shortSides, ∀ e₁ ∈ Γ₁.E, ∀ e₂ ∈ Γ₂.E, h₁ '' e₁ = t → h₂ '' e₂ = t → + φ₁ e₁ ≤ φ₂ e₂ ∧ (Γ₁'.γ t = (Γ₁.γ e₁).map h₁ ↔ Γ₂'.γ t = (Γ₂.γ e₂).map h₂)) + {σv' : S → Set S} {σe' : Set S → Set S} + (hσ : IsColouredLinearInflation (thinScheme hS hc Φ x₀) (thinPainting T₁ hS hc φ₁ x₀) + (thinPainting T₂ hS hc φ₂ x₀) σv' σe') : + ∃ (σv : S → Set S) (σe : Set S → Set S), IsLinearInflation Γ₁ Γ₂ σv σe ∧ + ∀ e ∈ Γ₁.E, φ₁ e ≤ φ₂ (σe e) := by + classical + have : T2Space S := hS.2.1 + have hcuffO : ∀ Θ ∈ cuffs S, IsOArc Θ := (cuff_statement.{u} S hS).2.2 + have hinf : IsInflation Γ₁' Γ₂' σv' σe' := hσ.isInflation + have hlin : IsLinearInflation Γ₁' Γ₂' σv' σe' := hσ.isLinear + have hp : ∀ e, ∃ f, e ∈ Γ₁.E → f ∈ Γ₂.E ∧ (tilde f).ncard = (tilde e).ncard ∧ φ₁ e ≤ φ₂ f ∧ + σe' (IsThinning.edge Γ₁ h₁ s₁ e) = IsThinning.edge Γ₂ h₂ s₂ f ∧ + SameDir Γ₁ Γ₁' Γ₂ Γ₂' h₁ h₂ e f (IsThinning.edge Γ₁ h₁ s₁ e) (IsThinning.edge Γ₂ h₂ s₂ f) + := by + intro e + by_cases he : e ∈ Γ₁.E + · obtain ⟨f, hf⟩ := exists_partner hS hc T₁ T₂ hshort hσ he + exact ⟨f, fun _ ↦ hf⟩ + · exact ⟨e, fun h ↦ absurd h he⟩ + choose σe hσe using hp + let σv : S → Set S := fun v ↦ h₂.symm '' σv' (h₁ v) + have hV₁ : ∀ {v}, v ∈ Γ₁.V → h₁ v ∈ Γ₁'.V := fun hv ↦ T₁.V_eq ▸ mem_image_of_mem _ hv + have hsym : ∀ {X : Set S} {x}, h₂ x ∈ X → x ∈ h₂.symm '' X := fun {X x} hx ↦ + ⟨h₂ x, hx, by simp⟩ + have hbd₁ : ∀ {e}, e ∈ Γ₁.E → Painting.IsBorder e → IsThinning.edge Γ₁ h₁ s₁ e = h₁ '' e := + fun he hb ↦ IsThinning.edge_two (size_two_of_border Γ₁ he hb) + have hlen : ∀ e ∈ Γ₁.E, (Γ₂.γ (σe e)).length = (Γ₁.γ e).length := fun e he ↦ by + rw [Γ₂.length_γ (hσe e he).1, Γ₁.length_γ he, (hσe e he).2.1] + have hends : ∀ e ∈ Γ₁.E, ∀ (i : ℕ) (hi : i < (Γ₁.γ e).length) + (hi' : i < (Γ₂.γ (σe e)).length), (Γ₂.γ (σe e))[i] ∈ σv (Γ₁.γ e)[i] := by + intro e he i hi hi' + obtain ⟨hf, -, -, hz, hdir⟩ := hσe e he + have hmemy := T₁.edge_mem he + have key := fun (j : ℕ) (a b : S) ↦ ends_getElem? (i := j) (a := a) (b := b) hinf hmemy + rw [hz] at key + rcases hdir with ⟨h₁', h₂'⟩ | ⟨h₁', h₂', -⟩ + · rw [h₁', h₂'] at key + exact hsym (key i _ _ (by simp [List.getElem?_eq_getElem hi]) + (by simp [List.getElem?_eq_getElem hi'])) + · rw [h₁', h₂'] at key + have hl := hlen e he + have hj : (Γ₁.γ e).length - 1 - i < (Γ₁.γ e).length := by omega + have hindex : (Γ₁.γ e).length - 1 - ((Γ₁.γ e).length - 1 - i) = i := by omega + refine hsym (key ((Γ₁.γ e).length - 1 - i) _ _ ?_ ?_) + · rw [List.getElem?_reverse (by simpa using hj), List.length_map, hindex] + simp [List.getElem?_eq_getElem hi] + · rw [List.getElem?_reverse (by simpa [hl] using hj), List.length_map, hl, hindex] + simp [List.getElem?_eq_getElem hi'] + have hinfl : IsInflation Γ₁ Γ₂ σv σe := + { edge_mem := fun e he ↦ (hσe e he).1 + edge_size := fun e he ↦ (hσe e he).2.1 + edge_injOn := fun e₁ h₁e e₂ h₂e heq ↦ by + have hz₁ := (hσe e₁ h₁e).2.2.2.1 + have hz₂ := (hσe e₂ h₂e).2.2.2.1 + rw [heq, ← hz₂] at hz₁ + exact T₁.edge_inj h₁e h₂e (hinf.edge_injOn (T₁.edge_mem h₁e) (T₁.edge_mem h₂e) hz₁) + vertex_nonempty := fun v hv ↦ (hinf.vertex_nonempty _ (hV₁ hv)).image _ + vertex_subset := fun v hv ↦ by + rintro _ ⟨x, hx, rfl⟩ + have hx' := hinf.vertex_subset _ (hV₁ hv) hx + rw [T₂.V_eq] at hx' + obtain ⟨y, hy, rfl⟩ := hx' + simpa using hy + vertex_connected := fun v hv ↦ by + have hpre := hinf.vertex_connected _ (hV₁ hv) + let ψ : (Γ₂'.skAdj.induce (σv' (h₁ v))) →g (Γ₂.skAdj.induce (σv v)) := + { toFun := fun a ↦ ⟨h₂.symm a.1, mem_image_of_mem _ a.2⟩ + map_rel' := fun {a b} hab ↦ T₂.skAdj_symm hab } + have hsurj : Surjective ψ := by + rintro ⟨_, a, ha, rfl⟩ + exact ⟨⟨a, ha⟩, rfl⟩ + exact hpre.map ψ hsurj + vertex_disjoint := fun v₁ hv₁ v₂ hv₂ hne ↦ by + have := hinf.vertex_disjoint _ (hV₁ hv₁) _ (hV₁ hv₂) (h₁.injective.ne hne) + exact (disjoint_image_iff h₂.symm.injective).2 this + ends := hends } + refine ⟨σv, σe, ⟨hinfl, ?_, ?_, ?_⟩, fun e he ↦ (hσe e he).2.2.1⟩ + · intro e he Θ hΘ + have hbdΘ : Θ ⊆ bd S := by + obtain ⟨z, -, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + have hborder : ∀ {E : Set S}, (E ∩ Θ).Nonempty → Painting.IsBorder E := fun ⟨x, hx, hxΘ⟩ ↦ + ⟨x, hx, hbdΘ hxΘ⟩ + rcases Γ₁.size_cases he with h2 | h3 + · have hf := hσe e he + have hf2 : (tilde (σe e)).ncard = 2 := hf.2.1.trans h2 + have hz := hf.2.2.2.1 + rw [IsThinning.edge_two h2, IsThinning.edge_two hf2] at hz + have hiff := hlin.borders_iff _ (T₁.two e he h2) Θ hΘ + rw [hz] at hiff + have himg := fun {α : S ≃ₜ S} {E : Set S} hα hα' => + homeomorph_preserves_cuff_meets (α := α) (E := E) hΘ (hcuffO Θ hΘ) hα hα' + rw [himg T₁.null T₁.null_symm, himg (E := σe e) T₂.null T₂.null_symm] + exact hiff + · have h1 : ¬ (e ∩ Θ).Nonempty := fun hn ↦ by + have := size_two_of_border Γ₁ he (hborder hn) + omega + have hf3 : (tilde (σe e)).ncard = 3 := (hσe e he).2.1.trans h3 + have h2' : ¬ (σe e ∩ Θ).Nonempty := fun hn ↦ by + have := size_two_of_border Γ₂ (hσe e he).1 (hborder hn) + omega + exact iff_of_false h1 h2' + · intro e' he' hb hne + have h2 := size_two_of_border Γ₂ he' hb + have hy' := T₂.two e' he' h2 + have hyb : Painting.IsBorder (h₂ '' e') := (isBorder_image h₂).2 hb + have hnot : h₂ '' e' ∉ σe' '' Γ₁'.E := by + rintro ⟨c, hc, hcz⟩ + have hcsize : (tilde c).ncard = 2 := by + rw [← hinf.edge_size c hc, hcz, ncard_tilde_image, h2] + rcases thinColour_cases (φ := φ₁) (x₀ := x₀) T₁ hc hcsize with hs | ⟨e, he, he2, rfl, -⟩ | + hlab + · obtain ⟨e, he, rfl⟩ := T₁.short c hs + have he2 : (tilde e).ncard = 2 := by rw [← ncard_tilde_image h₁, hcsize] + refine hne ⟨e, he, ?_⟩ + have hz := (hσe e he).2.2.2.1 + have hf2 : (tilde (σe e)).ncard = 2 := (hσe e he).2.1.trans he2 + rw [IsThinning.edge_two he2, IsThinning.edge_two hf2, hcz] at hz + exact (image_injective.2 h₂.injective hz).symm + · refine hne ⟨e, he, ?_⟩ + have hz := (hσe e he).2.2.2.1 + have hf2 : (tilde (σe e)).ncard = 2 := (hσe e he).2.1.trans he2 + rw [IsThinning.edge_two he2, IsThinning.edge_two hf2, hcz] at hz + exact (image_injective.2 h₂.injective hz).symm + · have hcint : Painting.IsInternal c := by + rcases T₁.rest c hc hcsize with ⟨e, he, he2, rfl⟩ | ⟨hi, -⟩ + · exfalso + by_cases hs : h₁ '' e ∈ Φ.shortSides + · rw [thinColour_short T₁ hs] at hlab + simp at hlab + · rw [thinColour_two T₁ he he2 hs] at hlab + simp only at hlab + split_ifs at hlab <;> simp at hlab + · exact hi + have hle : (thinColour Φ Γ₁ Γ₁' h₁ s₁ φ₁ x₀ c).1 ≤ + (thinColour Φ Γ₂ Γ₂' h₂ s₂ φ₂ x₀ (σe' c)).1 ∧ + (thinColour Φ Γ₁ Γ₁' h₁ s₁ φ₁ x₀ c).2 = + (thinColour Φ Γ₂ Γ₂' h₂ s₂ φ₂ x₀ (σe' c)).2 := + hσ.le_internal_2 c hc hcint hcsize + have hl := hle.2 + rw [hlab, hcz] at hl + by_cases hs : h₂ '' e' ∈ Φ.shortSides + · rw [thinColour_short T₂ hs] at hl + simp at hl + · rw [thinColour_two T₂ he' h2 hs] at hl + have hni : ¬ Painting.IsInternal (h₂ '' e') := fun hi ↦ + (isInternal_iff_not_border.1 hi) hyb + simp only [hni, ite_false] at hl + split_ifs at hl <;> simp at hl + obtain ⟨v', hv', hsub⟩ := hlin.border_edge _ hy' hyb hnot + rw [T₁.V_eq] at hv' + obtain ⟨v, hv, rfl⟩ := hv' + refine ⟨v, hv, fun x hx ↦ ?_⟩ + exact hsym (hsub (by rw [tilde_image_homeo]; exact mem_image_of_mem _ hx)) + · intro e he Θ hΘ hne f n n' hn hn' hip + have hbdΘ : Θ ⊆ bd S := by + obtain ⟨z, -, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + obtain ⟨x, hxe, hxΘ⟩ := hne + have hb : Painting.IsBorder e := ⟨x, hxe, hbdΘ hxΘ⟩ + have h2 := size_two_of_border Γ₁ he hb + obtain ⟨hf, hf2', -, hz, hdir⟩ := hσe e he + have hf2 : (tilde (σe e)).ncard = 2 := hf2'.trans h2 + rw [IsThinning.edge_two h2, IsThinning.edge_two hf2] at hz + rw [IsThinning.edge_two h2, IsThinning.edge_two hf2] at hdir + have hyΘ : (h₁ '' e ∩ Θ).Nonempty := + ⟨h₁ x, mem_image_of_mem _ hxe, null_mem T₁.null hΘ (hcuffO Θ hΘ) hxΘ⟩ + have hback : ∀ {g : Circle ≃ₜ Θ} {m : S}, ImmediatelyPrecedes g (h₂ m) (h₂ '' σe e) → + ImmediatelyPrecedes g m (σe e) := fun {g m} hi ↦ by + have := ImmediatelyPrecedes.null T₂.null_symm hΘ hi + simpa [image_image] using this + rcases hdir with ⟨h₁', h₂'⟩ | ⟨h₁', h₂', -⟩ + · refine hback (hz ▸ hlin.orientation _ (T₁.two e he h2) Θ hΘ hyΘ f (h₁ n) (h₂ n') ?_ ?_ + (ImmediatelyPrecedes.null T₁.null hΘ hip)) + · rw [h₁', List.head?_map, hn] + rfl + · rw [hz, h₂', List.head?_map, hn'] + rfl + · have hlen₁ : (Γ₁.γ e).length = 2 := by rw [Γ₁.length_γ he, h2] + have hlen₂ : (Γ₂.γ (σe e)).length = 2 := by rw [Γ₂.length_γ hf, hf2] + obtain ⟨a, m, hl₁⟩ := List.length_eq_two.1 hlen₁ + obtain ⟨a', m', hl₂⟩ := List.length_eq_two.1 hlen₂ + rw [hl₁] at hn h₁' + rw [hl₂] at hn' h₂' + simp only [List.head?_cons, Option.some.injEq] at hn hn' + subst hn hn' + have hnd₁ := Γ₁.γ_nodup e he + have hnd₂ := Γ₂.γ_nodup _ hf + rw [hl₁] at hnd₁ + rw [hl₂] at hnd₂ + have hmt : m ∈ tilde e := by + rw [← Γ₁.γ_set e he, hl₁] + simp + have hat : a' ∈ tilde (σe e) := by + rw [← Γ₂.γ_set _ hf, hl₂] + simp + have hne₁ : m ≠ a := fun h ↦ by simp [h] at hnd₁ + have hne₂ : a' ≠ m' := fun h ↦ by simp [h] at hnd₂ + have step₁ := ImmediatelyPrecedes.null T₁.null hΘ (hip.reverse hmt hne₁) + have step₂ := hlin.orientation _ (T₁.two e he h2) Θ hΘ hyΘ (revParam f) (h₁ m) (h₂ m') + (by rw [h₁']; simp) (by rw [hz, h₂']; simp) step₁ + rw [hz] at step₂ + have step₃ := (hback step₂).reverse hat hne₂ + rwa [revParam_revParam] at step₃ + +end Pull + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section2Proved.lean b/LeanPool/GraphMinor/GM19/Section2Proved.lean new file mode 100644 index 0000000000..d17e703caf --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section2Proved.lean @@ -0,0 +1,174 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section2 +public import LeanPool.GraphMinor.GM19.CapExists +public import LeanPool.GraphMinor.GM19.Section4c +public import LeanPool.GraphMinor.GM20.Cited +public import LeanPool.GraphMinor.Surface.MoveCuff + +import LeanPool.GraphMinor.GM19.Section15b +import LeanPool.GraphMinor.GM19.Thinning +import LeanPool.GraphMinor.GM19.UniverseLift1 + +/-! +# Graph Minors XIX: proved deductions from Section2 and Section4c + +This file proves **Graph Minors XIX, (3.1)** (`theorem_3_1`) and **Graph Minors XIX, (2.1)** +(`theorem_2_1`, `gm19Theorem21`) in arbitrary surface and label universes, using the proved (4.1) +and `theorem21Topology_u`. +-/ + +@[expose] public section +namespace GraphMinor.GM19 +open Set Function Topology GraphMinor.Surface +universe u w + +/-- **Graph Minors XIX, (3.1)**, from (4.1) (Graph Minors XIX, Section 4, page 334): no colour +scheme +is bad. The paper's "we may choose it to satisfy `S₁`" is the induction on the capped surface, by +`GraphMinor.Surface.simplerWellFounded`. -/ +theorem theorem_3_1_proof + {S Shat : Type u} [TopologicalSpace S] [TopologicalSpace Shat] {α : Type w} + (cap : IsCappedSurface S Shat) (χ : ColourScheme S α) : ¬ χ.IsBad := by + intro hbad + -- Choose a bad scheme with the capped surface minimal, which gives `S₁`. + obtain ⟨X₀, ⟨β₀, D₀, hX₀, hbad₀⟩, hmin⟩ := (simplerWellFounded.{u}).has_min + {X | ∃ (β : Type w) (D : CappedScheme.{u, w} β), (⟨D.Shat, D.iH⟩ : Σ X : Type u, + TopologicalSpace X) = X ∧ D.χ.IsBad} + ⟨_, α, ⟨S, Shat, cap, χ⟩, rfl, hbad⟩ + subst hX₀ + have hS1 : ∀ (Z : Type u) [TopologicalSpace Z], Nonempty (Z ≃ₜ D₀.Shat) → ConditionS1.{u, w} Z + := by + rintro Z _ ⟨e⟩ S' Shat' _ _ β χ' ⟨cap'⟩ hsimp hb + exact hmin ⟨Shat', _⟩ ⟨β, ⟨S', Shat', cap', χ'⟩, rfl, hb⟩ (IsSimplerThan.of_homeo hsimp e) + -- Pass to an orientedly bad scheme with infinitely many labels. + obtain ⟨χ₁, -, hor₁⟩ := theorem_4_2_proof (D₀.χ.liftMap.isBad hbad₀) + let 𝒜 : Set (CappedScheme.{u, w} ((Option β₀ × ℕ) × Bool)) := + {D | Nonempty (D.Shat ≃ₜ D₀.Shat) ∧ D.χ.IsOrientedlyBad} + have hne : 𝒜.Nonempty := ⟨⟨_, _, D₀.cap, χ₁⟩, ⟨Homeomorph.refl _⟩, hor₁⟩ + -- Choose `Ω(3)`, `Ω(2)` minimal, which gives `S₂`. + have hwf : WellFounded (Prod.Lex (fun a b : WQOKey ((Option β₀ × ℕ) × Bool) ↦ a < b) + (fun a b : WQOKey ((Option β₀ × ℕ) × Bool) ↦ a < b)) := + WellFounded.prod_lex wellFounded_lt wellFounded_lt + obtain ⟨_, ⟨D₁, hD₁, rfl⟩, hmin₁⟩ := hwf.has_min (CappedScheme.key '' 𝒜) (hne.image _) + let 𝒜₁ : Set (CappedScheme.{u, w} ((Option β₀ × ℕ) × Bool)) := + {D | D ∈ 𝒜 ∧ D.χ.Ω2 = D₁.χ.Ω2 ∧ D.χ.Ω3 = D₁.χ.Ω3} + have hS2 : ∀ D ∈ 𝒜₁, ConditionS2 D.χ D.cap := by + rintro D ⟨hD, h2, h3⟩ S' Shat' _ _ χ' ⟨cap'⟩ ⟨e⟩ h3' h2' hstrict hb + rw [h3] at h3' hstrict + rw [h2] at h2' hstrict + obtain ⟨e₀⟩ := hD.1 + refine hmin₁ _ ⟨⟨S', Shat', cap', χ'⟩, ⟨⟨e.trans e₀⟩, hb⟩, rfl⟩ ?_ + by_cases hE : χ'.Ω3.E = D₁.χ.Ω3.E + · have hk : (⟨χ'.Ω3.norm, QuasiOrder.norm_isWQO χ'.isWQO_3⟩ : WQOKey _) = + ⟨D₁.χ.Ω3.norm, QuasiOrder.norm_isWQO D₁.χ.isWQO_3⟩ := Subtype.ext (h3'.norm_eq hE) + have hs2 := hstrict.resolve_left fun h ↦ h.2 hE + simp only [CappedScheme.key] + rw [hk] + exact Prod.Lex.right _ (WQOKey.lt_iff.2 ⟨h2'.norm, hs2.2⟩) + · exact Prod.Lex.left _ _ (WQOKey.lt_iff.2 ⟨h3'.norm, hE⟩) + -- Choose `c(Σ)` minimal, which gives `S₃`. + have hne₁ : 𝒜₁.Nonempty := ⟨D₁, hD₁, rfl, rfl⟩ + obtain ⟨_, ⟨D₂, hD₂, rfl⟩, hmin₂⟩ := wellFounded_lt.has_min + ((fun D : CappedScheme.{u, w} ((Option β₀ × ℕ) × Bool) ↦ numCuffs D.S) '' 𝒜₁) (hne₁.image _) + let 𝒜₂ : Set (CappedScheme.{u, w} ((Option β₀ × ℕ) × Bool)) := {D | D ∈ 𝒜₁ ∧ numCuffs D.S + = numCuffs D₂.S} + have hS3 : ∀ D ∈ 𝒜₂, ConditionS3 D.χ D.cap := by + rintro D ⟨⟨hD, h2, h3⟩, hc⟩ S' Shat' _ _ χ' ⟨cap'⟩ ⟨e⟩ h2' h3' hlt hb + obtain ⟨e₀⟩ := hD.1 + exact hmin₂ _ ⟨⟨S', Shat', cap', χ'⟩, ⟨⟨⟨e.trans e₀⟩, hb⟩, h2'.trans h2, h3'.trans h3⟩, rfl⟩ + (by simpa [hc] using hlt) + -- By (4.4), choose a scheme with no refinement in the family, which gives `S₄`. + have hstep : ∃ D ∈ 𝒜₂, ∀ D' ∈ 𝒜₂, ¬ D'.χ.IsRefinement D.χ := by + by_contra hno + push Not at hno + choose! next hnext hrefn using hno + have hD₂' : D₂ ∈ 𝒜₂ := ⟨hD₂, rfl⟩ + let g : ℕ → CappedScheme.{u, w} ((Option β₀ × ℕ) × Bool) := fun n ↦ next^[n] D₂ + have hg : ∀ n, g n ∈ 𝒜₂ := by + intro n + induction n with + | zero => exact hD₂' + | succ n ih => + change next^[n + 1] D₂ ∈ 𝒜₂ + rw [iterate_succ_apply'] + exact hnext _ ih + refine theorem_4_4_proof (fun n ↦ (g n).S) (fun n ↦ (g n).χ) fun n ↦ ?_ + have := hrefn _ (hg n) + change (next^[n + 1] D₂).χ.IsRefinement (g n).χ + rw [iterate_succ_apply'] + exact this + obtain ⟨D₃, hD₃, hno⟩ := hstep + have hS4 : ConditionS4 D₃.χ := by + intro S' _ χ' hrefn hb + obtain ⟨⟨e⟩, h2, h3, -⟩ := id hrefn + obtain ⟨⟨⟨⟨e₀⟩, -⟩, h2₃, h3₃⟩, hc⟩ := hD₃ + exact hno ⟨S', _, D₃.cap.ofHomeo e, χ'⟩ + ⟨⟨⟨⟨e₀⟩, hb⟩, h2.trans h2₃, h3.trans h3₃⟩, (numCuffs_eq e).trans hc⟩ hrefn + obtain ⟨e₃⟩ := hD₃.1.1.1 + exact theorem_4_1_proof.{u, w} D₃.S D₃.Shat _ D₃.cap D₃.χ (hS1 _ ⟨e₃⟩) (hS2 D₃ hD₃.1) + (hS3 D₃ hD₃) hS4 hD₃.1.1.2 + +/-- **Graph Minors XIX, (2.1)**, from (3.1) and the topology of its proof. -/ +theorem theorem_2_1_proof + (S : Type u) [TopologicalSpace S] {Ω : Type w} [Preorder Ω] (hS : IsSurface S) + (hc : ConnectedSpace S) (hwqo : WellQuasiOrderedLE Ω) (Γ : ℕ → Painting S) + (φ : ℕ → Set S → Ω) (h3 : ∀ i, (Γ i).IsInternallyThreeConnected) : + ∃ i j, i < j ∧ ∃ (σv : S → Set S) (σe : Set S → Set S), + IsLinearInflation (Γ i) (Γ j) σv σe ∧ ∀ e ∈ (Γ i).E, φ i e ≤ φ j (σe e) := by + classical + obtain ⟨Φ, hΦ⟩ := theorem21Topology_u.{u} S hS hc + choose h Γ' s T using fun i ↦ hΦ (Γ i) (h3 i) + obtain ⟨Shat, _, ⟨cap⟩⟩ := exists_cappedSurface _ S hS hc rfl + let x₀ : Ω := φ 0 ∅ + have hshfin : Φ.shortSides.Finite := Φ.finite_sides.subset fun _ h ↦ h.1 + have : Finite Φ.shortSides := hshfin.to_subtype + choose e he hEt using fun i (t : Φ.shortSides) ↦ (T i).short t.1 t.2 + let L : ℕ → Φ.shortSides → Ω × Prop := fun i t ↦ + (φ i (e i t), ((Γ' i).γ t.1 = ((Γ i).γ (e i t)).map (h i))) + let r : Ω × Prop → Ω × Prop → Prop := fun a b ↦ a.1 ≤ b.1 ∧ (a.2 ↔ b.2) + have hr : WellQuasiOrdered r := by + have h₁ := (wellQuasiOrdered_le (α := Ω)).prod + (Finite.wellQuasiOrdered (fun a b : Prop ↦ a ↔ b)) + exact h₁ + have : IsPreorder (Ω × Prop) r := + { refl := fun a ↦ ⟨le_rfl, Iff.rfl⟩ + trans := fun a b c h₁ h₂ ↦ ⟨h₁.1.trans h₂.1, h₁.2.trans h₂.2⟩ } + have hpi : WellQuasiOrdered fun a b : Φ.shortSides → Ω × Prop ↦ ∀ t, r (a t) (b t) := + WellQuasiOrdered.pi fun _ ↦ hr + have : IsPreorder (Φ.shortSides → Ω × Prop) (fun a b ↦ ∀ t, r (a t) (b t)) := + { refl := fun a t ↦ ⟨le_rfl, Iff.rfl⟩ + trans := fun a b c h₁ h₂ t ↦ ⟨(h₁ t).1.trans (h₂ t).1, (h₁ t).2.trans (h₂ t).2⟩ } + obtain ⟨g, hg⟩ := hpi.exists_monotone_subseq L + have hnotbad := theorem_3_1_proof cap (thinScheme hS hc Φ x₀) + have hgood : ¬ IsBadSequence (thinScheme hS hc Φ x₀) + fun n ↦ thinPainting (T (g n)) hS hc (φ (g n)) x₀ := fun hb ↦ hnotbad ⟨_, hb⟩ + rw [IsBadSequence] at hgood + push Not at hgood + obtain ⟨n, m, hnm, σv', σe', hσ⟩ := hgood + have hunique : ∀ i (t : Φ.shortSides) e', e' ∈ (Γ i).E → h i '' e' = t.1 → e' = e i t := + fun i t e' _ he' ↦ image_injective.2 (h i).injective (he'.trans (hEt i t).symm) + obtain ⟨σv, σe, hlin, hle⟩ := exists_pull hS hc (T (g n)) (T (g m)) + (fun t ht e₁ he₁ e₂ he₂ h₁ h₂ ↦ by + have hu₁ := hunique (g n) ⟨t, ht⟩ e₁ he₁ h₁ + have hu₂ := hunique (g m) ⟨t, ht⟩ e₂ he₂ h₂ + have := hg n m hnm.le ⟨t, ht⟩ + rw [hu₁, hu₂] + exact this) hσ + exact ⟨g n, g m, g.strictMono hnm, σv, σe, hlin, hle⟩ + +/-- Graph Minors XIX, (2.1), in the form used by XX. -/ +theorem gm19Theorem21 + : GM20.GM19Theorem21Statement.{w} := by + intro S _ Ω _ hS hc hwqo Γ φ h3 + exact theorem_2_1_proof S hS hc hwqo Γ φ h3 + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section4a.lean b/LeanPool/GraphMinor/GM19/Section4a.lean new file mode 100644 index 0000000000..1072a6b3b8 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section4a.lean @@ -0,0 +1,274 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Defs2 +public import Mathlib.Data.Multiset.DershowitzManna + +/-! +# Graph Minors XIX, (4.3) and (4.4) + +We show that a well-quasi-order has no infinite strictly descending chain of sub-ideals (4.3), and +that a sequence of colour schemes cannot go on refining for ever (4.4). + +The paper proves (4.4) with König's lemma on a tree of long sides. We use the same facts in a +shorter +form. A refinement replaces each long side by finitely many smaller ones, or leaves it alone. So the +multiset of quasi-orders of the long sides goes down in the Dershowitz–Manna order, unless nothing +changes, and then the third condition of a refinement makes the number of short sides go down. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface + +universe u w + +variable {α : Type w} + +namespace QuasiOrder + +/-- The relation `≼` is reflexive. -/ +theorem IsSubIdeal.refl (Ω : QuasiOrder α) : Ω.IsSubIdeal Ω := + ⟨Subset.rfl, fun _ _ _x hx _ ↦ hx, fun _ _ _ _ ↦ Iff.rfl⟩ + +/-- The relation `≼` is transitive. -/ +theorem IsSubIdeal.trans {Ω₁ Ω₂ Ω₃ : QuasiOrder α} (h₁ : Ω₁.IsSubIdeal Ω₂) + (h₂ : Ω₂.IsSubIdeal Ω₃) : Ω₁.IsSubIdeal Ω₃ where + E_subset := h₁.E_subset.trans h₂.E_subset + downward_closed x' hx' x hx hle := by + have hx'2 := h₁.E_subset hx' + have hx2 := h₂.downward_closed x' hx'2 x hx hle + exact h₁.downward_closed x' hx' x hx2 ((h₂.le_iff x hx2 x' hx'2).2 hle) + le_iff x hx y hy := (h₁.le_iff x hx y hy).trans + (h₂.le_iff x (h₁.E_subset hx) y (h₁.E_subset hy)) + +/-- **Graph Minors XIX, (4.3).** A well-quasi-order starts no infinite chain `Ω₁ ≻ Ω₂ ≻ ⋯`. The +paper omits the proof. Choose `x_i ∈ E(Ω_i) \ E(Ω_{i+1})`. Then `x_i ≤ x_j` for some `i < j`, and as +`E(Ω_{i+1})` is closed downward and contains `x_j`, it contains `x_i`, a contradiction. -/ +theorem theorem_4_3_proof (Ω : ℕ → QuasiOrder α) (hwqo : (Ω 0).IsWQO) + (hstrict : ∀ i, (Ω (i + 1)).IsStrictSubIdeal (Ω i)) : False := by + have hsub : ∀ i k, (Ω (i + k)).IsSubIdeal (Ω i) := by + intro i k + induction k with + | zero => exact IsSubIdeal.refl _ + | succ k ih => exact (hstrict (i + k)).1.trans ih + have hex : ∀ i, ∃ x, x ∈ (Ω i).E ∧ x ∉ (Ω (i + 1)).E := by + intro i + by_contra hno + push Not at hno + exact (hstrict i).2 (Subset.antisymm (hstrict i).1.E_subset hno) + choose x hx hx' using hex + obtain ⟨i, j, hij, hle⟩ := hwqo x fun i ↦ by + have := hsub 0 i + rw [Nat.zero_add] at this + exact this.E_subset (hx i) + obtain ⟨k, rfl⟩ : ∃ k, j = i + 1 + k := ⟨j - (i + 1), by omega⟩ + have h0 : ∀ i, (Ω i).IsSubIdeal (Ω 0) := fun i ↦ by simpa using hsub 0 i + have hxj : x (i + 1 + k) ∈ (Ω (i + 1)).E := (hsub (i + 1) k).E_subset (hx _) + exact hx' i ((h0 (i + 1)).downward_closed _ hxj (x i) ((h0 i).E_subset (hx i)) hle) + +/-- `Ω` with its relation cut down to `E(Ω)`, so that only this part of the relation matters. -/ +def norm (Ω : QuasiOrder α) : QuasiOrder α where + E := Ω.E + le x y := x ∈ Ω.E ∧ y ∈ Ω.E ∧ Ω.le x y + refl x hx := ⟨hx, hx, Ω.refl x hx⟩ + trans x hx y hy z hz h₁ h₂ := ⟨hx, hz, Ω.trans x hx y hy z hz h₁.2.2 h₂.2.2⟩ + +theorem norm_isWQO {Ω : QuasiOrder α} (h : Ω.IsWQO) : Ω.norm.IsWQO := fun f hf ↦ by + obtain ⟨i, j, hij, hle⟩ := h f hf + exact ⟨i, j, hij, hf i, hf j, hle⟩ + +theorem IsSubIdeal.norm {Ω' Ω : QuasiOrder α} (h : Ω'.IsSubIdeal Ω) : Ω'.norm.IsSubIdeal Ω.norm + where + E_subset := h.E_subset + downward_closed x' hx' x hx hle := h.downward_closed x' hx' x hx hle.2.2 + le_iff x hx y hy := by + constructor + · exact fun hle ↦ ⟨h.E_subset hx, h.E_subset hy, (h.le_iff x hx y hy).1 hle.2.2⟩ + · exact fun hle ↦ ⟨hx, hy, (h.le_iff x hx y hy).2 hle.2.2⟩ + +/-- Two quasi-orders with the same element set, each a sub-ideal of the other's relation, agree +after +`norm`. -/ +theorem IsSubIdeal.norm_eq {Ω' Ω : QuasiOrder α} (h : Ω'.IsSubIdeal Ω) (hE : Ω'.E = Ω.E) : + Ω'.norm = Ω.norm := by + have hle : (Ω'.norm).le = (Ω.norm).le := by + funext x y + apply propext + constructor + · exact fun hxy ↦ ⟨hE ▸ hxy.1, hE ▸ hxy.2.1, (h.le_iff x hxy.1 y hxy.2.1).1 hxy.2.2⟩ + · intro hxy + have hx : x ∈ Ω'.E := hE ▸ hxy.1 + have hy : y ∈ Ω'.E := hE ▸ hxy.2.1 + exact ⟨hx, hy, (h.le_iff x hx y hy).2 hxy.2.2⟩ + have hE' : (Ω'.norm).E = (Ω.norm).E := hE + cases hA : Ω'.norm + cases hB : Ω.norm + simp only [hA, hB] at hE' hle + subst hE' + subst hle + rfl + +end QuasiOrder + +/-- The well-quasi-orders on `α`, ordered by `≼`. -/ +def WQOKey (α : Type w) : Type w := {Ω : QuasiOrder α // Ω.IsWQO} + +instance : Preorder (WQOKey α) where + le a b := a.1.IsSubIdeal b.1 + le_refl a := QuasiOrder.IsSubIdeal.refl a.1 + le_trans _ _ _ h₁ h₂ := QuasiOrder.IsSubIdeal.trans h₁ h₂ + +theorem WQOKey.lt_iff {a b : WQOKey α} : a < b ↔ a.1.IsStrictSubIdeal b.1 := by + constructor + · rintro ⟨h₁, h₂⟩ + refine ⟨h₁, fun hE ↦ h₂ ⟨hE.ge, fun _ _ x hx _ ↦ hE ▸ hx, fun x hx y hy ↦ ?_⟩⟩ + exact (h₁.le_iff x (hE ▸ hx) y (hE ▸ hy)).symm + · rintro ⟨h₁, h₂⟩ + exact ⟨h₁, fun h ↦ h₂ (Subset.antisymm h₁.E_subset h.E_subset)⟩ + +instance : WellFoundedLT (WQOKey α) := by + suffices h : WellFounded ((· < ·) : WQOKey α → WQOKey α → Prop) from ⟨h.apply⟩ + rw [RelEmbedding.wellFounded_iff_isEmpty] + refine ⟨fun g ↦ ?_⟩ + exact QuasiOrder.theorem_4_3_proof (fun i ↦ (g i).1) (g 0).2 fun i ↦ + WQOKey.lt_iff.1 (g.map_rel_iff.2 (Nat.lt_succ_self i)) + +section Refinement + + + +variable {S₁ S₂ : Type u} [TopologicalSpace S₁] [TopologicalSpace S₂] + +open Classical in +theorem Frame.finite_longSides (Φ : Frame S₁) : Φ.longSides.Finite := + Φ.finite_sides.subset fun _ h ↦ h.1 + +open Classical in +/-- The element of `WQOKey α` of a long side. -/ +noncomputable def ColourScheme.key (χ : ColourScheme S₁ α) (s : Set S₁) : WQOKey α := + if h : s ∈ χ.Φ.sides then ⟨(χ.ΩS s).norm, QuasiOrder.norm_isWQO (χ.isWQO_S s h)⟩ + else ⟨χ.Ω2.norm, QuasiOrder.norm_isWQO χ.isWQO_2⟩ + +open Classical in +theorem ColourScheme.key_of_mem (χ : ColourScheme S₁ α) {s : Set S₁} (h : s ∈ χ.Φ.sides) : + (χ.key s).1 = (χ.ΩS s).norm := by + simp [ColourScheme.key, h] + +open Classical in +/-- The multiset of the quasi-orders of the long sides. -/ +noncomputable def ColourScheme.longMultiset (χ : ColourScheme S₁ α) : Multiset (WQOKey α) := + ∑ s ∈ χ.Φ.finite_longSides.toFinset, {χ.key s} + +open Classical in +/-- One refinement lowers the multiset of quasi-orders, or keeps it and lowers the number of short +sides. -/ +theorem ColourScheme.IsRefinement.step {χ' : ColourScheme S₁ α} {χ : ColourScheme S₂ α} + (h : χ'.IsRefinement χ) : + Prod.Lex Multiset.IsDershowitzMannaLT (· < ·) + (χ'.longMultiset, χ'.Φ.shortSides.ncard) (χ.longMultiset, χ.Φ.shortSides.ncard) := by + obtain ⟨-, -, -, f, hmaps, hsub, hstrict, hthird⟩ := h + set L' := χ'.Φ.finite_longSides.toFinset with hL' + set L := χ.Φ.finite_longSides.toFinset with hL + have memL' : ∀ {R}, R ∈ L' ↔ R ∈ χ'.Φ.longSides := by simp [hL'] + have memL : ∀ {s}, s ∈ L ↔ s ∈ χ.Φ.longSides := by simp [hL] + let good : Set S₂ → Prop := fun s ↦ ∃ R ∈ L', f R = s ∧ (∀ R' ∈ L', f R' = s → R' = R) ∧ + (χ'.ΩS R).E = (χ.ΩS s).E + have hkey : ∀ R ∈ L', (χ'.ΩS R).E = (χ.ΩS (f R)).E → χ'.key R = χ.key (f R) := by + intro R hR hE + have hR' := memL'.1 hR + apply Subtype.ext + rw [χ'.key_of_mem hR'.1, χ.key_of_mem (hmaps hR').1] + exact (hsub R hR').norm_eq hE + have hX : ∑ R ∈ L'.filter (fun R ↦ good (f R)), ({χ'.key R} : Multiset (WQOKey α)) = + ∑ s ∈ L.filter good, {χ.key s} := by + refine Finset.sum_bij (fun R _ ↦ f R) ?_ ?_ ?_ ?_ + · intro R hR + obtain ⟨hR1, hg⟩ := Finset.mem_filter.1 hR + exact Finset.mem_filter.2 ⟨memL.2 (hmaps (memL'.1 hR1)), hg⟩ + · intro R₁ h₁ R₂ h₂ he + obtain ⟨hR1, R, -, hRf, huniq, -⟩ := Finset.mem_filter.1 h₁ + have hR2 := (Finset.mem_filter.1 h₂).1 + rw [huniq R₁ hR1 rfl, huniq R₂ hR2 he.symm] + · intro s hs + obtain ⟨-, R, hR, hRf, huniq, hE⟩ := Finset.mem_filter.1 hs + subst hRf + exact ⟨R, Finset.mem_filter.2 ⟨hR, R, hR, rfl, huniq, hE⟩, rfl⟩ + · intro R hR + obtain ⟨hR1, R₀, hR₀, hRf, huniq, hE⟩ := Finset.mem_filter.1 hR + obtain rfl := huniq R hR1 rfl + rw [hkey _ hR₀ hE] + have hM' : χ'.longMultiset = ∑ s ∈ L.filter good, {χ.key s} + + ∑ R ∈ L'.filter (fun R ↦ ¬ good (f R)), {χ'.key R} := by + rw [← hX, ColourScheme.longMultiset, Finset.sum_filter_add_sum_filter_not] + have hM : χ.longMultiset = ∑ s ∈ L.filter good, {χ.key s} + + ∑ s ∈ L.filter (fun s ↦ ¬ good s), {χ.key s} := by + rw [ColourScheme.longMultiset, Finset.sum_filter_add_sum_filter_not] + by_cases hB : (L.filter fun s ↦ ¬ good s) = ∅ + · have hall : ∀ s ∈ L, good s := by + intro s hs + by_contra hg + have : s ∈ L.filter fun s ↦ ¬ good s := Finset.mem_filter.2 ⟨hs, hg⟩ + rw [hB] at this + simp at this + have hA : (L'.filter fun R ↦ ¬ good (f R)) = ∅ := by + apply Finset.filter_eq_empty_iff.2 + intro R hR + simpa using hall _ (memL.2 (hmaps (memL'.1 hR))) + have hEq : χ'.longMultiset = χ.longMultiset := by + rw [hM', hM, hA, hB] + simp + rw [hEq] + refine Prod.Lex.right _ (hthird fun s hs ↦ ?_) + obtain ⟨R, hR, hRf, -, hE⟩ := hall s (memL.2 hs) + exact ⟨R, memL'.1 hR, hRf, hE⟩ + · refine Prod.Lex.left _ _ ⟨_, _, _, ?_, hM', hM, ?_⟩ + · obtain ⟨s, hs⟩ := Finset.nonempty_iff_ne_empty.2 hB + intro h0 + have hmem : χ.key s ∈ ∑ s ∈ L.filter (fun s ↦ ¬ good s), ({χ.key s} : Multiset _) := + Multiset.mem_sum.2 ⟨s, hs, by simp⟩ + have h0' : ∑ s ∈ L.filter (fun s ↦ ¬ good s), ({χ.key s} : Multiset _) = 0 := h0 + rw [h0'] at hmem + simp at hmem + · intro y hy + obtain ⟨R, hR, hyR⟩ := Multiset.mem_sum.1 hy + obtain ⟨hR1, hg⟩ := Finset.mem_filter.1 hR + rw [Multiset.mem_singleton] at hyR + subst hyR + have hR' := memL'.1 hR1 + have hfR : f R ∈ χ.Φ.longSides := hmaps hR' + refine ⟨χ.key (f R), Multiset.mem_sum.2 ⟨f R, Finset.mem_filter.2 ⟨memL.2 hfR, hg⟩, by simp⟩, + ?_⟩ + rw [WQOKey.lt_iff, χ'.key_of_mem hR'.1, χ.key_of_mem hfR.1] + by_cases huniq : ∀ R' ∈ L', f R' = f R → R' = R + · refine ⟨(hsub R hR').norm, fun hE ↦ hg ⟨R, hR1, rfl, huniq, hE⟩⟩ + · push Not at huniq + obtain ⟨R', hR'1, hff, hne⟩ := huniq + have := hstrict R hR' R' (memL'.1 hR'1) hne.symm hff.symm + exact ⟨this.1.norm, this.2⟩ + +end Refinement + +open Classical in +/-- **Graph Minors XIX, (4.4).** There is no sequence `χ_i` of colour schemes such that `χ_{i+1}` is +a +refinement of `χ_i` for all `i`. -/ +theorem theorem_4_4_proof (S : ℕ → Type u) [∀ i, TopologicalSpace (S i)] + (χ : ∀ i, ColourScheme (S i) α) (h : ∀ i, (χ (i + 1)).IsRefinement (χ i)) : False := by + have hwf : WellFounded (Prod.Lex (Multiset.IsDershowitzMannaLT (α := WQOKey α)) (· < · : ℕ → ℕ + → Prop)) := + WellFounded.prod_lex Multiset.wellFounded_isDershowitzMannaLT wellFounded_lt + obtain ⟨_, ⟨i, rfl⟩, hmin⟩ := hwf.has_min + (range fun i ↦ ((χ i).longMultiset, (χ i).Φ.shortSides.ncard)) ⟨_, ⟨0, rfl⟩⟩ + exact hmin _ ⟨i + 1, rfl⟩ (h i).step + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section4b.lean b/LeanPool/GraphMinor/GM19/Section4b.lean new file mode 100644 index 0000000000..e6d7340b8f --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section4b.lean @@ -0,0 +1,386 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Defs2 +public import Mathlib.Analysis.SpecialFunctions.Complex.Circle +public import Mathlib.Order.OrderIsoNat + +/-! +# Graph Minors XIX, (4.2) + +A bad colour scheme gives an orientedly bad one on the same surface. We reverse the last two terms +of +the march of each disc edge whose cyclic order disagrees with a chosen orientation, and we record +this +in a second coordinate of the label (`±1` in the paper, `Bool` here). All the new labels live on +`α × Bool`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface + +universe u w + +variable {S : Type u} [TopologicalSpace S] {α : Type w} + +/-! ### The circle -/ + +/-- Each point of the circle other than `1` has an angle strictly between `0` and `2π`. -/ +theorem exists_angle {z : Circle} (hz : z ≠ 1) : + ∃ s : ℝ, 0 < s ∧ s < 2 * Real.pi ∧ z = Circle.exp s := + CircleOrder.exists_angle hz + +/-- Three distinct points of the circle occur in one of the two cyclic orders. -/ +theorem circleCyclic_or {a b c : Circle} (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) : + CircleCyclic a b c ∨ CircleCyclic a c b := + CircleOrder.circleCyclic_or hab hac hbc + +/-- Three distinct boundary points of a closed disc occur in one of the two cyclic orders of an +orientation. -/ +theorem SurfaceOrientation.pos_or (ω : SurfaceOrientation S) {Δ : Set S} (hΔ : IsClosedDisc Δ) + {a b c : S} (ha : a ∈ discBd Δ) (hb : b ∈ discBd Δ) (hc : c ∈ discBd Δ) (hab : a ≠ b) + (hac : a ≠ c) (hbc : b ≠ c) : ω.pos Δ a b c ∨ ω.pos Δ a c b := by + obtain ⟨φ, -, hinj, hrange, hφ⟩ := ω.isDirection Δ hΔ + rw [← hrange] at ha hb hc + obtain ⟨a, rfl⟩ := ha + obtain ⟨b, rfl⟩ := hb + obtain ⟨c, rfl⟩ := hc + have hab' : a ≠ b := fun h ↦ hab (by rw [h]) + have hac' : a ≠ c := fun h ↦ hac (by rw [h]) + have hbc' : b ≠ c := fun h ↦ hbc (by rw [h]) + rcases circleCyclic_or hab' hac' hbc' with h | h + · exact Or.inl ((hφ a b c hab' hbc' hac').2 h) + · exact Or.inr ((hφ a c b hac' hbc'.symm hab').2 h) + +/-! ### Quasi-orders on `α × Bool` -/ + +namespace QuasiOrder + +/-- The copy of `Ω` with second coordinate `true`. -/ +def liftTrue (Ω : QuasiOrder α) : QuasiOrder (α × Bool) where + E := {p | p.1 ∈ Ω.E ∧ p.2 = true} + le x y := Ω.le x.1 y.1 ∧ x.2 = y.2 + refl _x hx := ⟨Ω.refl _ hx.1, rfl⟩ + trans _x hx _y hy _z hz h₁ h₂ := + ⟨Ω.trans _ hx.1 _ hy.1 _ hz.1 h₁.1 h₂.1, h₁.2.trans h₂.2⟩ + +/-- The product `Ω × R`, where `R` has two elements, ordered by equality. -/ +def prodBool (Ω : QuasiOrder α) : QuasiOrder (α × Bool) where + E := {p | p.1 ∈ Ω.E} + le x y := Ω.le x.1 y.1 ∧ x.2 = y.2 + refl _x hx := ⟨Ω.refl _ hx, rfl⟩ + trans _x hx _y hy _z hz h₁ h₂ := ⟨Ω.trans _ hx _ hy _ hz h₁.1 h₂.1, h₁.2.trans h₂.2⟩ + +theorem liftTrue_isWQO {Ω : QuasiOrder α} (h : Ω.IsWQO) : Ω.liftTrue.IsWQO := fun f hf ↦ by + obtain ⟨i, j, hij, hle⟩ := h (fun n ↦ (f n).1) fun n ↦ (hf n).1 + exact ⟨i, j, hij, hle, (hf i).2.trans (hf j).2.symm⟩ + +theorem prodBool_isWQO {Ω : QuasiOrder α} (h : Ω.IsWQO) : Ω.prodBool.IsWQO := fun f hf ↦ by + classical + have key : ∀ b : Bool, {n | (f n).2 = b}.Infinite → ∃ i j, i < j ∧ Ω.prodBool.le (f i) (f j) := by + intro b hb + have : Infinite {n | (f n).2 = b} := hb.to_subtype + let g := Nat.orderEmbeddingOfSet {n | (f n).2 = b} + have hg : ∀ n, (f (g n)).2 = b := fun n ↦ by + have := mem_range_self (f := g) n + rwa [Nat.orderEmbeddingOfSet_range] at this + obtain ⟨i, j, hij, hle⟩ := h (fun n ↦ (f (g n)).1) fun n ↦ hf (g n) + exact ⟨g i, g j, g.strictMono hij, hle, (hg i).trans (hg j).symm⟩ + by_cases hT : {n | (f n).2 = true}.Infinite + · exact key true hT + · refine key false ?_ + intro hF + have huniv : ({n | (f n).2 = true} ∪ {n | (f n).2 = false}) = univ := by + ext n + cases hb : (f n).2 <;> simp [hb] + exact Set.infinite_univ (huniv ▸ (Set.not_infinite.1 hT).union hF) + +end QuasiOrder + +/-- The colour scheme `χ'` of (4.2): `Ω_{χ'}(3) = Ω_χ(3) × R`, and the other quasi-orders are copied +to `α × Bool`. -/ +def ColourScheme.orient (χ : ColourScheme S α) : ColourScheme S (α × Bool) where + isSurface := χ.isSurface + connected := χ.connected + Φ := χ.Φ + Ω2 := χ.Ω2.liftTrue + Ω3 := χ.Ω3.prodBool + ΩS s := (χ.ΩS s).liftTrue + shortElem s := (χ.shortElem s, true) + isWQO_2 := QuasiOrder.liftTrue_isWQO χ.isWQO_2 + isWQO_3 := QuasiOrder.prodBool_isWQO χ.isWQO_3 + isWQO_S s hs := QuasiOrder.liftTrue_isWQO (χ.isWQO_S s hs) + short_singleton s hs := by + ext ⟨x, b⟩ + have := χ.short_singleton s hs + simp only [QuasiOrder.liftTrue, mem_ofPred_eq, mem_singleton_iff, Prod.mk.injEq, this] + +/-! ### Reversing marches -/ + +/-- The march `[a, b, c]` becomes `[a, c, b]`. Other marches stay as they are. -/ +def swapTail : List S → List S + | [a, b, c] => [a, c, b] + | l => l + +omit [TopologicalSpace S] in +theorem swapTail_perm (l : List S) : (swapTail l).Perm l := by + match l with + | [] => exact List.Perm.refl _ + | [_] => exact List.Perm.refl _ + | [_, _] => exact List.Perm.refl _ + | [_, _, _] => exact List.Perm.cons _ (List.Perm.swap _ _ _) + | _ :: _ :: _ :: _ :: _ => exact List.Perm.refl _ + +omit [TopologicalSpace S] in +theorem swapTail_head (l : List S) : (swapTail l).head? = l.head? := by + match l with + | [] => rfl + | [_] => rfl + | [_, _] => rfl + | [_, _, _] => rfl + | _ :: _ :: _ :: _ :: _ => rfl + +open Classical in +/-- `Γ` with the march of each edge in `B` reversed by `swapTail`. -/ +noncomputable def Painting.swapOn (Γ : Painting S) (B : Set S → Prop) : Painting S where + U := Γ.U + V := Γ.V + γ e := if B e then swapTail (Γ.γ e) else Γ.γ e + isClosed_U := Γ.isClosed_U + V_subset := Γ.V_subset + finite_V := Γ.finite_V + bd_subset := Γ.bd_subset + finite_edges := Γ.finite_edges + edge_shape := Γ.edge_shape + γ_nodup e he := by + split_ifs + · exact (swapTail_perm _).nodup_iff.2 (Γ.γ_nodup e he) + · exact Γ.γ_nodup e he + γ_set e he := by + rw [← Γ.γ_set e he] + split_ifs + · ext v + exact (swapTail_perm _).mem_iff + · rfl + border_edge := Γ.border_edge + +/-- The length of `γ(e)` is the number of ends of `e`. -/ +theorem Painting.length_γ (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) : + (Γ.γ e).length = (tilde e).ncard := by + classical + rw [← Γ.γ_set e he] + have : {v | v ∈ Γ.γ e} = ((Γ.γ e).toFinset : Set S) := by + ext v + simp + rw [this, ncard_coe_finset, List.toFinset_card_of_nodup (Γ.γ_nodup e he)] + +/-- A march of length three, written out. -/ +theorem Painting.exists_three (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) + (h3 : (tilde e).ncard = 3) : ∃ a b c, Γ.γ e = [a, b, c] := by + have hlen := Γ.length_γ he + rw [h3] at hlen + match hl : Γ.γ e, hlen with + | [a, b, c], _ => exact ⟨a, b, c, rfl⟩ + +/-- An edge of a coloured painting that borders a side has two ends. -/ +theorem Painting.ncard_of_border (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) + (hb : Painting.IsBorder e) : (tilde e).ncard = 2 := + (Γ.border_edge e he hb).1 + +/-! ### The new paintings -/ + +open Classical in +/-- The `χ'`-coloured painting of (4.2), where `B` is the set of disc edges to be reversed. -/ +noncomputable def ColouredPainting.orient {χ : ColourScheme S α} (P : ColouredPainting χ) + (B : Set S → Prop) (hB : ∀ e, B e → (tilde e).ncard = 3) : ColouredPainting χ.orient where + Γ := P.Γ.swapOn B + φ e := (P.φ e, decide (¬ B e)) + fits := + { V_subset := P.fits.V_subset + short_sides := P.fits.short_sides + border_dir := fun e he hb s hs hes ↦ by + have h := P.fits.border_dir e he hb s hs hes + have hnB : ¬ B e := fun h' ↦ by + have h2 := P.Γ.ncard_of_border he hb + have h3 := hB e h' + omega + have hγ : (P.Γ.swapOn B).γ e = P.Γ.γ e := by simp [Painting.swapOn, hnB] + change DirAgrees s (χ.Φ.γ s) e _ + rw [hγ] + exact h + internally_three_connected := P.fits.internally_three_connected + size_three_region := P.fits.size_three_region } + internal_2_mem e he hi h2 := by + have hnB : ¬ B e := fun h' ↦ by + have h3 := hB e h' + omega + exact ⟨P.internal_2_mem e he hi h2, by simpa using hnB⟩ + internal_3_mem e he hi h3 := P.internal_3_mem e he hi h3 + border_mem e he s hs hes := by + have hnB : ¬ B e := fun h' ↦ by + have h2 := P.Γ.ncard_of_border he hes.1 + have h3 := hB e h' + omega + exact ⟨P.border_mem e he s hs hes, by simpa using hnB⟩ + +/-- A linear inflation of the new paintings is a linear inflation of the old ones. This is the only +step of (4.2) that the paper writes out. -/ +theorem IsColouredLinearInflation.of_orient {χ : ColourScheme S α} {P P' : ColouredPainting χ} + {B B' : Set S → Prop} {hB : ∀ e, B e → (tilde e).ncard = 3} + {hB' : ∀ e, B' e → (tilde e).ncard = 3} {σv : S → Set S} {σe : Set S → Set S} + (h : IsColouredLinearInflation χ.orient (P.orient B hB) (P'.orient B' hB') σv σe) : + IsColouredLinearInflation χ P P' σv σe := by + classical + have hinf := h.isInflation + have hsize := hinf.edge_size + have hE : ∀ e ∈ P.Γ.E, e ∈ (P.orient B hB).Γ.E := fun _ he ↦ he + have hsame : ∀ e ∈ P.Γ.E, (B e ↔ B' (σe e)) := by + intro e he + by_cases h3 : (tilde e).ncard = 3 + · have hint : Painting.IsInternal e := by + by_contra hn + have hb : Painting.IsBorder e := by + rw [Painting.IsBorder, Set.nonempty_iff_ne_empty] + intro hem + exact hn (Set.disjoint_iff_inter_eq_empty.2 hem) + have := P.Γ.ncard_of_border he hb + omega + have := (h.le_internal_3 e he hint h3).2 + simpa [ColouredPainting.orient, not_iff_not] using this + · constructor + · exact fun h' ↦ absurd (hB e h') h3 + · intro h' + have := hB' _ h' + rw [hsize e he] at this + exact absurd this h3 + have hγ : ∀ e, (P.orient B hB).Γ.γ e = if B e then swapTail (P.Γ.γ e) else P.Γ.γ e := fun _ ↦ rfl + have hγ' : ∀ e, (P'.orient B' hB').Γ.γ e = + if B' e then swapTail (P'.Γ.γ e) else P'.Γ.γ e := fun _ ↦ rfl + have hends : ∀ e ∈ P.Γ.E, ∀ (i : ℕ) (hi : i < (P.Γ.γ e).length) + (hi' : i < (P'.Γ.γ (σe e)).length), (P'.Γ.γ (σe e))[i] ∈ σv (P.Γ.γ e)[i] := by + intro e he i hi hi' + by_cases hb : B e + · have hb' : B' (σe e) := (hsame e he).1 hb + have he' : σe e ∈ P'.Γ.E := hinf.edge_mem e he + have h3 := hB e hb + obtain ⟨a, b, c, habc⟩ := P.Γ.exists_three he h3 + obtain ⟨a', b', c', habc'⟩ := P'.Γ.exists_three he' (by rw [hsize e he, h3]) + have hk := hinf.ends e he + simp only [hγ, hγ', hb, hb', ite_true, habc, habc', swapTail] at hk + simp only [habc, habc'] at hi hi' ⊢ + have h0 := hk 0 (by simp) (by simp) + have h1 := hk 1 (by simp) (by simp) + have h2 := hk 2 (by simp) (by simp) + simp only [List.length_cons, List.length_nil] at hi + interval_cases i + · exact h0 + · exact h2 + · exact h1 + · have hb' : ¬ B' (σe e) := fun h' ↦ hb ((hsame e he).2 h') + have hk := hinf.ends e he i + simp only [hγ, hγ', hb, hb', ite_false] at hk + exact hk hi hi' + have hinfl : IsInflation P.Γ P'.Γ σv σe := + { edge_mem := hinf.edge_mem + edge_size := hinf.edge_size + edge_injOn := hinf.edge_injOn + vertex_nonempty := hinf.vertex_nonempty + vertex_subset := hinf.vertex_subset + vertex_connected := hinf.vertex_connected + vertex_disjoint := hinf.vertex_disjoint + ends := hends } + refine + { isInflation := hinfl + respects := h.respects + le_internal_2 := fun e he hi h2 ↦ (h.le_internal_2 e he hi h2).1 + le_internal_3 := fun e he hi h3 ↦ (h.le_internal_3 e he hi h3).1 + le_border := fun e he s hs hes ↦ (h.le_border e he s hs hes).1 + isLinear := + { toIsInflation := hinfl + borders_iff := h.isLinear.borders_iff + border_edge := h.isLinear.border_edge + orientation := fun e he Θ hΘ hne f n n' hn hn' hp ↦ ?_ } } + have hhead : ((P.orient B hB).Γ.γ e).head? = some n := by + rw [hγ] + split_ifs + · rw [swapTail_head, hn] + · exact hn + have hhead' : ((P'.orient B' hB').Γ.γ (σe e)).head? = some n' := by + rw [hγ'] + split_ifs + · rw [swapTail_head, hn'] + · exact hn' + exact h.isLinear.orientation e he Θ hΘ hne f n n' hhead hhead' hp + +/-- **Graph Minors XIX, (4.2).** If `χ` is a bad colour scheme, there is an orientedly bad colour +scheme `χ'` with `Σ_{χ'} = Σ_χ`. Here it has the same frame, and its labels are in `α × Bool`. -/ +theorem theorem_4_2_proof {χ : ColourScheme S α} (h : χ.IsBad) : + ∃ χ' : ColourScheme S (α × Bool), χ'.Φ = χ.Φ ∧ χ'.IsOrientedlyBad := by + classical + obtain ⟨P, hbad⟩ := h + refine ⟨χ.orient, rfl, ?_⟩ + by_cases hor : IsOrientableSurface S + · obtain ⟨ω⟩ := hor + let B : ℕ → Set S → Prop := fun i e ↦ e ∈ (P i).Γ.E ∧ (tilde e).ncard = 3 ∧ + ∃ a b c, (P i).Γ.γ e = [a, b, c] ∧ ¬ ω.pos (closure e) a b c + have hB : ∀ i e, B i e → (tilde e).ncard = 3 := fun i e h ↦ h.2.1 + refine ⟨fun i ↦ (P i).orient (B i) (hB i), fun i j hij ⟨σv, σe, hσ⟩ ↦ ?_, Or.inr ⟨ω, ?_⟩⟩ + · exact hbad i j hij ⟨σv, σe, hσ.of_orient⟩ + · intro i e he h3 a b c habc + have he' : e ∈ (P i).Γ.E := he + have hγ : ((P i).orient (B i) (hB i)).Γ.γ e = + if B i e then swapTail ((P i).Γ.γ e) else (P i).Γ.γ e := by + by_cases hb : B i e + · rw [ite_eq_left hb] + exact ite_eq_left hb + · rw [ite_eq_right hb] + exact ite_eq_right hb + obtain ⟨x, y, z, hxyz⟩ := (P i).Γ.exists_three he' h3 + have hnd := (P i).Γ.γ_nodup e he' + have hset := (P i).Γ.γ_set e he' + rw [hxyz] at hnd hset + have hbdry : tilde e ⊆ discBd (closure e) := by + rcases (P i).Γ.edge_shape e he' with h | h + · have := h.1 + omega + · exact h.2.2.2 + have hdisc : IsClosedDisc (closure e) := by + rcases (P i).Γ.edge_shape e he' with h | h + · have := h.1 + omega + · exact h.2.2.1 + have hx : x ∈ tilde e := by rw [← hset]; simp + have hy : y ∈ tilde e := by rw [← hset]; simp + have hz : z ∈ tilde e := by rw [← hset]; simp + simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_or, + List.nodup_nil, not_false_eq_true, and_true] at hnd + by_cases hb : B i e + · rw [hγ, ite_eq_left hb, hxyz] at habc + simp only [swapTail, List.cons.injEq, and_true] at habc + obtain ⟨rfl, rfl, rfl⟩ := habc + obtain ⟨_, _, a', b', c', habc', hneg⟩ := hb + rw [hxyz] at habc' + simp only [List.cons.injEq, and_true] at habc' + obtain ⟨rfl, rfl, rfl⟩ := habc' + exact (ω.pos_or hdisc (hbdry hx) (hbdry hy) (hbdry hz) hnd.1.1 hnd.1.2 hnd.2).resolve_left + hneg + · rw [hγ, ite_eq_right hb, hxyz] at habc + simp only [List.cons.injEq, and_true] at habc + obtain ⟨rfl, rfl, rfl⟩ := habc + by_contra hneg + exact hb ⟨he', h3, x, y, z, hxyz, hneg⟩ + · refine ⟨fun i ↦ (P i).orient (fun _ ↦ False) (fun _ h ↦ h.elim), + fun i j hij ⟨σv, σe, hσ⟩ ↦ ?_, Or.inl hor⟩ + exact hbad i j hij ⟨σv, σe, hσ.of_orient⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section4c.lean b/LeanPool/GraphMinor/GM19/Section4c.lean new file mode 100644 index 0000000000..dd9863f87a --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section4c.lean @@ -0,0 +1,145 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Conditional +public import LeanPool.GraphMinor.GM19.Section4a +public import LeanPool.GraphMinor.GM19.Relabel +public import LeanPool.GraphMinor.GM19.Section4b +public import LeanPool.GraphMinor.Surface.ModelCriterion + +/-! +# Graph Minors XIX, (3.1) assuming (4.1) + +This is the proof at the end of Section 4 of the paper. We take a bad colour scheme and choose it to +satisfy `S₁`, `S₂`, `S₃`, `S₄` in turn, which contradicts (4.1). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface + +universe u w + +section Homeo + +theorem IsInteriorPoint.image_homeo {S : Type u} {T : Type w} [TopologicalSpace S] + [TopologicalSpace T] (h : S ≃ₜ T) {x : S} (hx : IsInteriorPoint x) : IsInteriorPoint (h x) := by + obtain ⟨U, hU, hx, ⟨e⟩⟩ := hx + exact ⟨h '' U, h.isOpenMap U hU, mem_image_of_mem h hx, ⟨(h.image U).symm.trans e⟩⟩ + +theorem image_bd {S : Type u} {T : Type w} [TopologicalSpace S] [TopologicalSpace T] (h : S ≃ₜ T) : + h '' bd S = bd T := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ hy + exact hx (by simpa using IsInteriorPoint.image_homeo h.symm hy) + · intro hy + refine ⟨h.symm y, fun hx ↦ hy ?_, by simp⟩ + simpa using IsInteriorPoint.image_homeo h hx + +variable {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] + +theorem cuffs_eq_image (h : S ≃ₜ T) : cuffs T = (fun C ↦ h '' C) '' cuffs S := by + ext C + simp only [cuffs, componentsIn, mem_image] + constructor + · rintro ⟨y, hy, rfl⟩ + rw [← image_bd h] at hy + obtain ⟨x, hx, rfl⟩ := hy + refine ⟨_, ⟨x, hx, rfl⟩, ?_⟩ + rw [← image_bd h] + exact h.image_connectedComponentIn hx + · rintro ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + refine ⟨h x, by rw [← image_bd h]; exact mem_image_of_mem h hx, ?_⟩ + rw [← image_bd h] + exact (h.image_connectedComponentIn hx).symm + +theorem numCuffs_eq (h : S ≃ₜ T) : numCuffs S = numCuffs T := by + have hinj : Injective fun C : Set S ↦ h '' C := image_injective.2 h.injective + rw [numCuffs, numCuffs, cuffs_eq_image h, ncard_image_of_injective _ hinj] + +/-- A capping of `S` is one of each surface homeomorphic to `S`. -/ +def IsCappedSurface.ofHomeo {Shat : Type u} [TopologicalSpace Shat] (h : T ≃ₜ S) + (cap : IsCappedSurface S Shat) : IsCappedSurface T Shat where + isSurface := cap.isSurface + connected := cap.connected + bd_empty := cap.bd_empty + emb := cap.emb ∘ h + isEmbedding := cap.isEmbedding.comp h.isEmbedding + cuffDisc Θ := cap.cuffDisc (h '' Θ) + cuffDisc_closedDisc Θ hΘ := cap.cuffDisc_closedDisc _ (by + rw [cuffs_eq_image h]; exact mem_image_of_mem _ hΘ) + cuffDisc_bd Θ hΘ := by + rw [cap.cuffDisc_bd _ (by rw [cuffs_eq_image h]; exact mem_image_of_mem _ hΘ), image_image, + image_comp] + simp [image_image] + cuffDisc_disjoint Θ₁ hΘ₁ Θ₂ hΘ₂ hne := cap.cuffDisc_disjoint _ + (by rw [cuffs_eq_image h]; exact mem_image_of_mem _ hΘ₁) _ + (by rw [cuffs_eq_image h]; exact mem_image_of_mem _ hΘ₂) + fun he ↦ hne (image_injective.2 h.injective he) + compl_eq := by + rw [h.surjective.range_comp, cap.compl_eq, cuffs_eq_image h, biUnion_image] + +/-- The embedding of the transported capping acts on a set through the homeomorphism. -/ +theorem IsCappedSurface.ofHomeo_emb_image {Shat : Type u} [TopologicalSpace Shat] + (cap : IsCappedSurface S Shat) (h : T ≃ₜ S) (A : Set T) : + (cap.ofHomeo h).emb '' A = cap.emb '' (h '' A) := by + rw [image_image] + rfl + +/-- A cuff and its image have the same disc in the corresponding cappings. -/ +theorem IsCappedSurface.ofHomeo_cuffDisc {Shat : Type u} [TopologicalSpace Shat] + (cap : IsCappedSurface S Shat) (h : T ≃ₜ S) {Θ : Set T} (hΘ : Θ ∈ cuffs T) : + h '' Θ ∈ cuffs S ∧ (cap.ofHomeo h).cuffDisc Θ = cap.cuffDisc (h '' Θ) := + ⟨by rw [cuffs_eq_image h]; exact mem_image_of_mem _ hΘ, rfl⟩ + +/-- A cuff of the original surface has the same disc at its inverse image. -/ +theorem IsCappedSurface.ofHomeo_cuffDisc_symm {Shat : Type u} [TopologicalSpace Shat] + (cap : IsCappedSurface S Shat) (h : T ≃ₜ S) {Θ : Set S} (hΘ : Θ ∈ cuffs S) : + h.symm '' Θ ∈ cuffs T ∧ (cap.ofHomeo h).cuffDisc (h.symm '' Θ) = cap.cuffDisc Θ := by + refine ⟨?_, ?_⟩ + · rw [cuffs_eq_image h.symm] + exact mem_image_of_mem _ hΘ + · change cap.cuffDisc (h '' (h.symm '' Θ)) = _ + rw [image_image] + simp + +/-- `IsSimplerThan` depends only on the homeomorphism type of its second argument. -/ +theorem IsSimplerThan.of_homeo {Z : Type*} [TopologicalSpace Z] (hZ : IsSimplerThan Z S) + (h : S ≃ₜ T) : IsSimplerThan Z T := by + obtain ⟨a, b, c, a', b', c', h₁, ⟨h₂⟩, h₃⟩ := hZ + exact ⟨a, b, c, a', b', c', h₁, ⟨h.symm.trans h₂⟩, h₃⟩ + +end Homeo + +/-- A colour scheme together with its surface and a capping of this surface. -/ +structure CappedScheme (β : Type w) : Type (max (u + 1) w) where + /-- The surface `Σ_χ`. -/ + S : Type u + /-- The surface `Σ̂_χ`. -/ + Shat : Type u + [iS : TopologicalSpace S] + [iH : TopologicalSpace Shat] + /-- The capping. -/ + cap : IsCappedSurface S Shat + /-- The colour scheme. -/ + χ : ColourScheme S β + +attribute [instance] CappedScheme.iS CappedScheme.iH + +/-- The pair of quasi-orders `Ω(3), Ω(2)`, in a form where only the elements matter. -/ +noncomputable def CappedScheme.key {β : Type w} (D : CappedScheme.{u, w} β) : + WQOKey β × WQOKey β := + (⟨D.χ.Ω3.norm, QuasiOrder.norm_isWQO D.χ.isWQO_3⟩, ⟨D.χ.Ω2.norm, QuasiOrder.norm_isWQO + D.χ.isWQO_2⟩) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5a.lean b/LeanPool/GraphMinor/GM19/Section5a.lean new file mode 100644 index 0000000000..127d27cf29 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5a.lean @@ -0,0 +1,604 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Thinning + +/-! +# Graph Minors XIX, (5.1): images under homeomorphisms + +A homeomorphism `α` of the surface that preserves the frame carries a coloured painting to a +coloured painting. +Here we first show that `α` keeps each cuff with its orientation, since it fixes the two ends of a +side and keeps +the side. Then a (linear) inflation carries over to the images. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +universe w + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +/-! ### The frame as a painting -/ + +/-- A frame, seen as a painting with `U = bd(Σ)`. -/ +noncomputable def Frame.toPainting (Φ : Frame S) (hbd : IsClosed (bd S)) : Painting S where + U := bd S + V := Φ.V + γ := Φ.γ + isClosed_U := hbd + V_subset := Φ.V_subset + finite_V := Φ.finite_V + bd_subset := subset_rfl + finite_edges := Φ.finite_sides + edge_shape s hs := Or.inl (Φ.side_shape s hs) + γ_nodup := Φ.γ_nodup + γ_set := Φ.γ_set + border_edge s hs _ := ⟨(Φ.side_shape s hs).1, hs.2.1.trans sdiff_subset⟩ + +omit [T2Space S] in +theorem Frame.tilde_subset (Φ : Frame S) (hbd : IsClosed (bd S)) {s : Set S} (hs : s ∈ Φ.sides) : + tilde s ⊆ Φ.V := + (Φ.toPainting hbd).tilde_subset_V hs + +omit [T2Space S] in +/-- A side has its ends fixed and goes to itself, so its closure goes to itself. -/ +theorem image_closure_side {Φ : Frame S} {α : S ≃ₜ S} (hα : IsFramePreservingHomeo Φ α) {s : Set S} + (hs : s ∈ Φ.sides) : α '' closure s = closure s := by + rw [α.image_closure, hα.preserve_sides s hs] + +/-- A homeomorphism of the circle that fixes `exp a`, `exp b` and keeps the arc between them +preserves +orientation. -/ +theorem preserves_of_arc {ψ : Circle ≃ₜ Circle} {a b : ℝ} (hab : a < b) (hb : b < a + 2 * Real.pi) + (ha' : ψ (Circle.exp a) = Circle.exp a) (hb' : ψ (Circle.exp b) = Circle.exp b) + (harc : ∀ t ∈ Ioo a b, ∃ t' ∈ Ioo a b, ψ (Circle.exp t) = Circle.exp t') : + PreservesCircleOrientation ψ := by + have hpi := Real.pi_pos + obtain ⟨L, hLc, hL, hLe⟩ := exists_circle_lift ψ + rcases hL with hL | hL + · exact ⟨L, hLc, hL, hLe⟩ + exfalso + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp ((hLe a).symm.trans ha') + obtain ⟨n, hn⟩ := Circle.exp_eq_exp.mp ((hLe b).symm.trans hb') + have hlt : L b < L a := hL hab + obtain ⟨c, hc⟩ : ∃ c, c ∈ Ioo a b := ⟨(a + b) / 2, by constructor <;> linarith⟩ + obtain ⟨c', hc', he⟩ := harc c hc + rw [hLe] at he + obtain ⟨k, hk⟩ := Circle.exp_eq_exp.mp he + have h1 : L b < L c := hL hc.2 + have h2 : L c < L a := hL hc.1 + have hup : L a - 2 * Real.pi ≤ L (a + 2 * Real.pi) := by + by_contra hn' + push Not at hn' + obtain ⟨t, ht, hte⟩ := intermediate_value_Icc' (a := a) (b := a + 2 * Real.pi) (f := L) + (by linarith) + hLc.continuousOn (show L a - 2 * Real.pi ∈ Icc (L (a + 2 * Real.pi)) (L a) from + ⟨hn'.le, by linarith⟩) + have hta : t ≠ a := fun h ↦ by + rw [h] at hte + linarith + have htb : t ≠ a + 2 * Real.pi := fun h ↦ by + rw [h] at hte + linarith + have he₂ : Circle.exp t = Circle.exp a := ψ.injective (by + rw [hLe, hLe, hte] + exact Circle.exp_eq_exp.mpr ⟨-1, by push_cast; ring⟩) + obtain ⟨j, hj⟩ := Circle.exp_eq_exp.mp he₂ + have h1' : a < t := lt_of_le_of_ne ht.1 (Ne.symm hta) + have h2' : t < a + 2 * Real.pi := lt_of_le_of_ne ht.2 htb + have h3' : (0 : ℝ) < j := by + by_contra hneg + push Not at hneg + nlinarith + have h4' : (j : ℝ) < 1 := by + by_contra hneg + push Not at hneg + nlinarith + have h5 : 0 < j := by exact_mod_cast h3' + have h6 : j < 1 := by exact_mod_cast h4' + omega + have hb2 : L (a + 2 * Real.pi) < L b := hL hb + have h3 : ((m : ℝ) - n) * (2 * Real.pi) > b - a := by nlinarith + have h4 : ((m : ℝ) - n) * (2 * Real.pi) < 2 * Real.pi + (b - a) := by nlinarith + have h5 : (0 : ℝ) < (m : ℝ) - n := by + by_contra hneg + push Not at hneg + nlinarith + have h6 : (m : ℝ) - n < 2 := by + by_contra hneg + push Not at hneg + nlinarith + have h7 : 0 < m - n := by exact_mod_cast h5 + have h8 : m - n < 2 := by exact_mod_cast h6 + obtain rfl : m = n + 1 := by omega + push_cast at hm + have h9 : (n : ℝ) < k := by + by_contra hneg + push Not at hneg + nlinarith [hc'.2] + have h10 : (k : ℝ) < n + 1 := by + by_contra hneg + push Not at hneg + nlinarith [hc'.1] + have h11 : n < k := by exact_mod_cast h9 + have h12 : k < n + 1 := by exact_mod_cast h10 + omega + + +/-! ### Frame-preserving homeomorphisms -/ + +section Preserving + +variable {Φ : Frame S} {α : S ≃ₜ S} + +omit [T2Space S] in +theorem IsFramePreservingHomeo.symm (hα : IsFramePreservingHomeo Φ α) : + IsFramePreservingHomeo Φ α.symm := by + refine ⟨fun v hv ↦ ?_, fun s hs ↦ ?_, fun ω Δ hΔ a b c ha hb hc hab hbc hac ↦ ?_⟩ + · rw [Homeomorph.symm_apply_eq, hα.fix_V v hv] + · conv_lhs => rw [← hα.preserve_sides s hs] + exact symm_image_image' α s + · have h := hα.preserves_orientation ω (α.symm '' Δ) (GM20.image_isClosedDisc α.symm hΔ) + (α.symm a) (α.symm b) (α.symm c) (GM20.image_discBd α.symm Δ ▸ mem_image_of_mem _ ha) + (GM20.image_discBd α.symm Δ ▸ mem_image_of_mem _ hb) + (GM20.image_discBd α.symm Δ ▸ mem_image_of_mem _ hc) + (fun he ↦ hab (α.symm.injective he)) (fun he ↦ hbc (α.symm.injective he)) + (fun he ↦ hac (α.symm.injective he)) + simp only [Homeomorph.apply_symm_apply] at h + have hΔ' : α '' (α.symm '' Δ) = Δ := by + rw [← image_comp] + simp + rw [hΔ'] at h + exact h.symm + +omit [T2Space S] in +/-- Each cuff has a side on it. -/ +theorem exists_side_on_cuff (hbd : IsClosed (bd S)) (Φ : Frame S) (C : cuffs S) + (f : Circle ≃ₜ C.1) : + ∃ s ∈ Φ.sides, s ⊆ C.1 := by + obtain ⟨e, he, heC, -⟩ := exists_edge_on_cuff (Φ.toPainting hbd) C f + exact ⟨e, he, heC⟩ + +/-- A frame-preserving homeomorphism has null signature: it keeps a side of each cuff, with its +ends. -/ +theorem IsFramePreservingHomeo.null (_hS : IsSurface S) (hα : IsFramePreservingHomeo Φ α) : + HasNullSignature α := by + have hbd : IsClosed (bd S) := isClosed_bd S + intro C f hC + obtain ⟨s, hs, hsC⟩ := exists_side_on_cuff hbd Φ ⟨C, hC⟩ f + have hP := Φ.toPainting hbd + obtain ⟨a, θ, hθ, heq⟩ := edge_arc (Φ.toPainting hbd) f hs (Φ.side_shape s hs).1 hsC + have hab : a < a + θ := by linarith [hθ.1] + have hb : a + θ < a + 2 * Real.pi := by linarith [hθ.2] + have hx : (s).Nonempty := hs.1 + have hαC : α '' C = C := by + have hc := cuffs_eq_image α (S := S) (T := S) + have hmem : α '' C ∈ cuffs S := hc ▸ mem_image_of_mem _ hC + obtain ⟨x, hxs⟩ := hx + have h₁ : α x ∈ s := by + rw [← hα.preserve_sides s hs] + exact mem_image_of_mem _ hxs + have hne : (⟨_, hmem⟩ : cuffs S) = ⟨C, hC⟩ := by + by_contra hne + exact disjoint_left.mp (cuffs_disjoint' hne) (mem_image_of_mem _ (hsC hxs)) (hsC h₁) + exact congrArg Subtype.val hne + have hmem : ∀ x, x ∈ C ↔ α x ∈ C := fun x ↦ by + conv_rhs => rw [← hαC] + exact (α.injective.mem_set_image).symm + let ψ : Circle ≃ₜ Circle := f.trans ((α.subtype hmem).trans f.symm) + have hψ : ∀ z, α (f z).1 = (f (ψ z)).1 := fun z ↦ by + simp [ψ] + refine ⟨ψ, ?_, hψ⟩ + have hfix : ∀ t, cuffPoint f t ∈ tilde s → ψ (Circle.exp t) = Circle.exp t := fun t ht ↦ by + have h₁ := hψ (Circle.exp t) + have h₂ : α (cuffPoint f t) = cuffPoint f t := hα.fix_V _ (Frame.tilde_subset Φ hbd hs ht) + apply f.injective + apply Subtype.ext + exact h₁.symm.trans h₂ + have htl : tilde s = {cuffPoint f a, cuffPoint f (a + θ)} := by + rw [heq] + exact tilde_arcOf f hab hb + refine preserves_of_arc hab hb (hfix a (htl ▸ Or.inl rfl)) (hfix _ (htl ▸ Or.inr rfl)) fun t ht ↦ + ?_ + have h₁ : cuffPoint f t ∈ s := heq ▸ ⟨t, ht, rfl⟩ + have h₂ : α (cuffPoint f t) ∈ s := by + rw [← hα.preserve_sides s hs] + exact mem_image_of_mem _ h₁ + rw [heq] at h₂ + obtain ⟨t', ht', he⟩ := h₂ + refine ⟨t', ht', ?_⟩ + apply f.injective + apply Subtype.ext + exact ((hψ (Circle.exp t)).symm.trans he.symm).symm ▸ rfl + +omit [T2Space S] in +/-- The image of a painting that fits a frame fits the frame. -/ +theorem Painting.Fits.push (hα : IsFramePreservingHomeo Φ α) {Γ : Painting S} (hf : Γ.Fits Φ) : + (Γ.push α).Fits Φ := by + refine ⟨fun v hv ↦ ?_, fun t ht ↦ ?_, ?_, push_internally α Γ hf.internally_three_connected, ?_⟩ + · exact ⟨v, hf.V_subset hv, hα.fix_V v hv⟩ + · have := push_mem α Γ (hf.short_sides ht) + rwa [hα.preserve_sides t ht.1] at this + · intro e' he' hb s hs hes + rw [push_E] at he' + obtain ⟨e, he, rfl⟩ := he' + have hes₀ : e ⊆ s := by + rw [← hα.preserve_sides s hs] at hes + exact (image_subset_image_iff α.injective).mp hes + obtain ⟨f, t₁, t₂, hlt, hsub, h₁, h₂, h₃, h₄⟩ := hf.border_dir e he + ((isBorder_image α).mp hb) s hs hes₀ + have hcl := image_closure_side hα hs + have hmem : ∀ x, x ∈ closure s ↔ α x ∈ closure s := fun x ↦ by + conv_rhs => rw [← hcl] + exact (α.injective.mem_set_image).symm + have hbd : IsClosed (bd S) := isClosed_bd S + have hfix : ∀ x, some x = (Φ.γ s).head? ∨ some x = (Φ.γ s).getLast? → α x = x := by + intro x hx + have hx' : x ∈ Φ.γ s := by + rcases hx with hx | hx + · exact List.mem_of_mem_head? hx.symm + · exact List.mem_of_getLast? hx.symm + have hxt : x ∈ tilde s := by + rw [← Φ.γ_set s hs] + exact hx' + exact hα.fix_V x (Frame.tilde_subset Φ hbd hs hxt) + refine ⟨f.trans (α.subtype hmem), t₁, t₂, hlt, hes, ?_, ?_, ?_, ?_⟩ + · simp only [Homeomorph.trans_apply, Homeomorph.subtype_apply_coe] + rw [hfix _ (Or.inl h₁.symm)] + exact h₁ + · simp only [Homeomorph.trans_apply, Homeomorph.subtype_apply_coe] + rw [hfix _ (Or.inr h₂.symm)] + exact h₂ + · rw [push_γ, List.head?_map, h₃] + rfl + · rw [push_γ, List.getLast?_map, h₄] + rfl + · intro e' he' h3 r hr hcard f hf' + have hcomp : ∀ X : Set S, componentsIn (α '' X) = (fun c ↦ α '' c) '' componentsIn X := fun X ↦ + componentsIn_image (f' := α.symm) α.continuous.continuousOn α.symm.continuous.continuousOn + (fun x _ ↦ by simp) + rw [push_E] at he' + obtain ⟨e, he, rfl⟩ := he' + have hreg : (Γ.push α).regions = (fun c ↦ α '' c) '' Γ.regions := by + change componentsIn (α '' Γ.U)ᶜ = _ + rw [← image_compl_eq α.bijective, hcomp] + rfl + rw [hreg] at hr + obtain ⟨r₀, hr₀, rfl⟩ := hr + change 3 ≤ (closure (α '' r₀) ∩ α '' Γ.V).ncard at hcard + rw [← α.image_closure, ← image_inter α.injective, + ncard_image_of_injective _ α.injective] at hcard + simp only at hf' + rw [← α.image_closure, ← image_inter α.injective, hcomp] at hf' + obtain ⟨f₀, hf₀, rfl⟩ := hf' + obtain ⟨x, hx, hxb⟩ := hf.size_three_region e he (by rw [← ncard_tilde_image α]; exact h3) r₀ + hr₀ + hcard f₀ hf₀ + refine ⟨α x, ?_, ?_⟩ + · simp only + rw [← α.image_closure] + exact mem_image_of_mem _ hx + · rw [← image_bd α] + exact mem_image_of_mem _ hxb + +end Preserving + +/-! ### Images of coloured paintings -/ + +section Image + +variable {α₀ : Type w} {χ : ColourScheme S α₀} + +/-- `(Γ', φ')` is the image of `(Γ, φ)` under `α` (Graph Minors XIX, page 335). -/ +structure IsColouredImage (α : S ≃ₜ S) (P P' : ColouredPainting χ) : Prop where + U : P'.Γ.U = α '' P.Γ.U + V : P'.Γ.V = α '' P.Γ.V + γ : ∀ e ∈ P.Γ.E, P'.Γ.γ (α '' e) = (P.Γ.γ e).map α + φ : ∀ e ∈ P.Γ.E, P'.φ (α '' e) = P.φ e + +/-- The image of a coloured painting under a frame-preserving homeomorphism. -/ +noncomputable def ColouredPainting.image (P : ColouredPainting χ) (α : S ≃ₜ S) + (hα : IsFramePreservingHomeo χ.Φ α) : ColouredPainting χ where + Γ := P.Γ.push α + φ e := P.φ (α.symm '' e) + fits := P.fits.push hα + internal_2_mem := by + intro e he hi h2 + rw [push_E] at he + obtain ⟨c, hc, rfl⟩ := he + simp only [symm_image_image' α] + refine P.internal_2_mem c hc ?_ (by rw [← ncard_tilde_image α]; exact h2) + exact isInternal_iff_not_border.mpr fun hb ↦ (isInternal_iff_not_border.mp hi) + ((isBorder_image α).mpr hb) + internal_3_mem := by + intro e he hi h3 + rw [push_E] at he + obtain ⟨c, hc, rfl⟩ := he + simp only [symm_image_image' α] + refine P.internal_3_mem c hc ?_ (by rw [← ncard_tilde_image α]; exact h3) + exact isInternal_iff_not_border.mpr fun hb ↦ (isInternal_iff_not_border.mp hi) + ((isBorder_image α).mpr hb) + border_mem := by + intro e he s hs hbs + rw [push_E] at he + obtain ⟨c, hc, rfl⟩ := he + simp only [symm_image_image' α] + refine P.border_mem c hc s hs ⟨(isBorder_image α).mp hbs.1, ?_⟩ + have := hbs.2 + rw [← hα.preserve_sides s hs] at this + exact (image_subset_image_iff α.injective).mp this + +omit [T2Space S] in +theorem ColouredPainting.isImage_image (P : ColouredPainting χ) (α : S ≃ₜ S) + (hα : IsFramePreservingHomeo χ.Φ α) : IsColouredImage α P (P.image α hα) where + U := rfl + V := rfl + γ e _ := push_γ α P.Γ e + φ e _ := congrArg P.φ (symm_image_image' α e) + +end Image + + +section Transfer + +variable {α₀ : Type w} {χ : ColourScheme S α₀} {P₁ P₂ P₁' P₂' : ColouredPainting χ} + {α₁ α₂ : S ≃ₜ S} + +omit [T2Space S] in +theorem IsColouredImage.E_eq {α : S ≃ₜ S} {P P' : ColouredPainting χ} (I : IsColouredImage α P P') : + P'.Γ.E = (fun c ↦ α '' c) '' P.Γ.E := by + change arcComponentsIn (P'.Γ.U \ P'.Γ.V) = _ + rw [I.U, I.V, ← image_sdiff α.injective, GM20.image_arcComponentsIn] + rfl + +omit [T2Space S] in +theorem IsColouredImage.symm {α : S ≃ₜ S} {P P' : ColouredPainting χ} (I : IsColouredImage α P P') : + IsColouredImage α.symm P' P := by + refine ⟨?_, ?_, ?_, ?_⟩ + · rw [I.U, symm_image_image' α] + · rw [I.V, symm_image_image' α] + · intro e he + rw [I.E_eq] at he + obtain ⟨c, hc, rfl⟩ := he + rw [symm_image_image' α, I.γ c hc, List.map_map] + simp + · intro e he + rw [I.E_eq] at he + obtain ⟨c, hc, rfl⟩ := he + rw [symm_image_image' α, I.φ c hc] + +omit [T2Space S] in +theorem skAdj_image {α : S ≃ₜ S} {P P' : ColouredPainting χ} (I : IsColouredImage α P P') {x y : S} + (h : P.Γ.skAdj.Adj x y) : P'.Γ.skAdj.Adj (α x) (α y) := by + obtain ⟨hne, hx, hy, e, he, hxe, hye⟩ := h + refine ⟨fun h ↦ hne (α.injective h), ?_, ?_, α '' e, ?_, ?_, ?_⟩ + · rw [I.V] + exact mem_image_of_mem _ hx + · rw [I.V] + exact mem_image_of_mem _ hy + · rw [I.E_eq] + exact mem_image_of_mem _ he + · rw [tilde_image_homeo] + exact mem_image_of_mem _ hxe + · rw [tilde_image_homeo] + exact mem_image_of_mem _ hye + +omit [T2Space S] in +theorem inter_cuff_image (hS : IsSurface S) {α : S ≃ₜ S} (hα : HasNullSignature α) + (hα' : HasNullSignature α.symm) {X Θ : Set S} (hΘ : Θ ∈ cuffs S) : + (α '' X ∩ Θ).Nonempty ↔ (X ∩ Θ).Nonempty := by + have hO := (cuff_statement S hS).2.2 Θ hΘ + constructor + · rintro ⟨_, ⟨x, hx, rfl⟩, hxΘ⟩ + refine ⟨x, hx, ?_⟩ + have := null_mem hα' hΘ hO hxΘ + simpa using this + · rintro ⟨x, hx, hxΘ⟩ + exact ⟨α x, mem_image_of_mem _ hx, null_mem hα hΘ hO hxΘ⟩ + +/-- The new `σ` on vertices. -/ +def imgV (α₁ α₂ : S ≃ₜ S) (σv : S → Set S) (v : S) : Set S := α₂ '' σv (α₁.symm v) + +/-- The new `σ` on edges. -/ +def imgE (α₁ α₂ : S ≃ₜ S) (σe : Set S → Set S) (e : Set S) : Set S := α₂ '' σe (α₁.symm '' e) + +omit [T2Space S] in +theorem imgE_image (σe : Set S → Set S) (e : Set S) : + imgE α₁ α₂ σe (α₁ '' e) = α₂ '' σe e := by + rw [imgE, symm_image_image' α₁] + +omit [T2Space S] in +theorem imgV_image (σv : S → Set S) (v : S) : imgV α₁ α₂ σv (α₁ v) = α₂ '' σv v := by + simp [imgV] + +omit [T2Space S] in +theorem IsInflation.image (I₁ : IsColouredImage α₁ P₁ P₁') (I₂ : IsColouredImage α₂ P₂ P₂') + {σv : S → Set S} {σe : Set S → Set S} (h : IsInflation P₁.Γ P₂.Γ σv σe) : + IsInflation P₁'.Γ P₂'.Γ (imgV α₁ α₂ σv) (imgE α₁ α₂ σe) := by + have hV : ∀ v ∈ P₁'.Γ.V, ∃ v₀ ∈ P₁.Γ.V, α₁ v₀ = v := fun v hv ↦ by + rw [I₁.V] at hv + exact hv + refine + { edge_mem := ?_ + edge_size := ?_ + edge_injOn := ?_ + vertex_nonempty := ?_ + vertex_subset := ?_ + vertex_connected := ?_ + vertex_disjoint := ?_ + ends := ?_ } + · intro e he + rw [I₁.E_eq] at he + obtain ⟨c, hc, rfl⟩ := he + simp only + rw [imgE_image, I₂.E_eq] + exact mem_image_of_mem _ (h.edge_mem c hc) + · intro e he + rw [I₁.E_eq] at he + obtain ⟨c, hc, rfl⟩ := he + simp only + rw [imgE_image, ncard_tilde_image, ncard_tilde_image, h.edge_size c hc] + · intro e he e' he' heq + rw [I₁.E_eq] at he he' + obtain ⟨c, hc, rfl⟩ := he + obtain ⟨c', hc', rfl⟩ := he' + simp only [imgE_image] at heq + have := h.edge_injOn hc hc' (α₂.injective.image_injective heq) + rw [this] + · intro v hv + obtain ⟨v₀, hv₀, rfl⟩ := hV v hv + rw [imgV_image] + exact (h.vertex_nonempty v₀ hv₀).image _ + · intro v hv + obtain ⟨v₀, hv₀, rfl⟩ := hV v hv + rw [imgV_image, I₂.V] + exact image_mono (h.vertex_subset v₀ hv₀) + · intro v hv + obtain ⟨v₀, hv₀, rfl⟩ := hV v hv + rw [imgV_image] + let f : P₂.Γ.skAdj.induce (σv v₀) →g P₂'.Γ.skAdj.induce (α₂ '' σv v₀) := + ⟨fun x ↦ ⟨α₂ x.1, mem_image_of_mem _ x.2⟩, fun hxy ↦ skAdj_image I₂ hxy⟩ + refine (h.vertex_connected v₀ hv₀).map f ?_ + rintro ⟨_, x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + · intro v hv w hw hne + obtain ⟨v₀, hv₀, rfl⟩ := hV v hv + obtain ⟨w₀, hw₀, rfl⟩ := hV w hw + rw [imgV_image, imgV_image] + exact (disjoint_image_iff α₂.injective).mpr + (h.vertex_disjoint v₀ hv₀ w₀ hw₀ fun he ↦ hne (by rw [he])) + · intro e he i hi hi' + rw [I₁.E_eq] at he + obtain ⟨c, hc, rfl⟩ := he + simp only [imgE_image] at hi' ⊢ + have h₁ := I₁.γ c hc + have h₂ := I₂.γ _ (h.edge_mem c hc) + simp only [h₁, h₂, List.length_map] at hi hi' ⊢ + simp only [List.getElem_map] + rw [imgV_image] + exact mem_image_of_mem _ (h.ends c hc i hi hi') + +omit [T2Space S] in +theorem IsColouredInflation.image (_hS : IsSurface S) (h₁ : IsFramePreservingHomeo χ.Φ α₁) + (h₂ : IsFramePreservingHomeo χ.Φ α₂) (I₁ : IsColouredImage α₁ P₁ P₁') + (I₂ : IsColouredImage α₂ P₂ P₂') {σv : S → Set S} {σe : Set S → Set S} + (h : IsColouredInflation χ P₁ P₂ σv σe) : + IsColouredInflation χ P₁' P₂' (imgV α₁ α₂ σv) (imgE α₁ α₂ σe) := by + have hint : ∀ {α : S ≃ₜ S} {e : Set S}, Painting.IsInternal (α '' e) → Painting.IsInternal e := by + intro α e hi + exact isInternal_iff_not_border.mpr fun hb ↦ (isInternal_iff_not_border.mp hi) + ((isBorder_image α).mpr hb) + have hsub : ∀ {α : S ≃ₜ S}, IsFramePreservingHomeo χ.Φ α → ∀ {e s : Set S}, s ∈ χ.Φ.sides → + (α '' e ⊆ s ↔ e ⊆ s) := by + intro α hα e s hs + conv_lhs => rw [← hα.preserve_sides s hs] + exact image_subset_image_iff α.injective + refine ⟨h.isInflation.image I₁ I₂, ?_, ?_, ?_, ?_⟩ + · intro e he hb + rw [I₁.E_eq] at he + obtain ⟨c, hc, rfl⟩ := he + obtain ⟨h₃, h₄⟩ := h.respects c hc ((isBorder_image α₁).mp hb) + rw [imgE_image] + refine ⟨(isBorder_image α₂).mpr h₃, fun s hs ↦ ?_⟩ + rw [hsub h₁ hs, hsub h₂ hs] + exact h₄ s hs + · intro e he hi h2 + rw [I₁.E_eq] at he + obtain ⟨c, hc, rfl⟩ := he + rw [imgE_image, I₁.φ c hc, I₂.φ _ (h.isInflation.edge_mem c hc)] + exact h.le_internal_2 c hc (hint hi) (by rw [← ncard_tilde_image α₁]; exact h2) + · intro e he hi h3 + rw [I₁.E_eq] at he + obtain ⟨c, hc, rfl⟩ := he + rw [imgE_image, I₁.φ c hc, I₂.φ _ (h.isInflation.edge_mem c hc)] + exact h.le_internal_3 c hc (hint hi) (by rw [← ncard_tilde_image α₁]; exact h3) + · intro e he s hs hb + rw [I₁.E_eq] at he + obtain ⟨c, hc, rfl⟩ := he + rw [imgE_image, I₁.φ c hc, I₂.φ _ (h.isInflation.edge_mem c hc)] + exact h.le_border c hc s hs ⟨(isBorder_image α₁).mp hb.1, (hsub h₁ hs).mp hb.2⟩ + +theorem IsColouredLinearInflation.image (hS : IsSurface S) (h₁ : IsFramePreservingHomeo χ.Φ α₁) + (h₂ : IsFramePreservingHomeo χ.Φ α₂) (I₁ : IsColouredImage α₁ P₁ P₁') + (I₂ : IsColouredImage α₂ P₂ P₂') {σv : S → Set S} {σe : Set S → Set S} + (h : IsColouredLinearInflation χ P₁ P₂ σv σe) : + IsColouredLinearInflation χ P₁' P₂' (imgV α₁ α₂ σv) (imgE α₁ α₂ σe) := by + have hn₁ := h₁.null hS + have hn₁' := h₁.symm.null hS + have hn₂ := h₂.null hS + have hn₂' := h₂.symm.null hS + have hc := IsColouredInflation.image hS h₁ h₂ I₁ I₂ h.toIsColouredInflation + have hL := h.isLinear + refine ⟨hc, { hc.isInflation with borders_iff := ?_, border_edge := ?_, orientation := ?_ }⟩ + · intro e he Θ hΘ + rw [I₁.E_eq] at he + obtain ⟨c, hc', rfl⟩ := he + rw [imgE_image, inter_cuff_image hS hn₁ hn₁' hΘ, inter_cuff_image hS hn₂ hn₂' hΘ] + exact hL.borders_iff c hc' Θ hΘ + · intro e' he' hb hne + rw [I₂.E_eq] at he' + obtain ⟨e, he, rfl⟩ := he' + obtain ⟨v, hv, hsub⟩ := hL.border_edge e he ((isBorder_image α₂).mp hb) (by + rintro ⟨c, hc', rfl⟩ + refine hne ⟨α₁ '' c, ?_, imgE_image _ _⟩ + rw [I₁.E_eq] + exact mem_image_of_mem _ hc') + refine ⟨α₁ v, ?_, ?_⟩ + · rw [I₁.V] + exact mem_image_of_mem _ hv + · rw [imgV_image, tilde_image_homeo] + exact image_mono hsub + · intro e he Θ hΘ hne f n n' hn hn' hp + rw [I₁.E_eq] at he + obtain ⟨c, hc', rfl⟩ := he + rw [imgE_image] at hn' ⊢ + rw [I₁.γ c hc', List.head?_map] at hn + rw [I₂.γ _ (hL.edge_mem c hc'), List.head?_map] at hn' + obtain ⟨n₀, hn₀, rfl⟩ := Option.map_eq_some_iff.mp hn + obtain ⟨n₀', hn₀', rfl⟩ := Option.map_eq_some_iff.mp hn' + have hp₁ := hp.null hn₁' hΘ + simp only [Homeomorph.symm_apply_apply, symm_image_image' α₁] at hp₁ + have hp₂ := hL.orientation c hc' Θ hΘ + ((inter_cuff_image hS hn₁ hn₁' hΘ).mp hne) f n₀ n₀' hn₀ hn₀' hp₁ + exact hp₂.null hn₂ hΘ + +/-- **Graph Minors XIX, (5.1)** for linear inflations. -/ +theorem theorem_5_1_proof (hS : IsSurface S) (h₁ : IsFramePreservingHomeo χ.Φ α₁) + (h₂ : IsFramePreservingHomeo χ.Φ α₂) (I₁ : IsColouredImage α₁ P₁ P₁') + (I₂ : IsColouredImage α₂ P₂ P₂') : + (∃ σv σe, IsColouredLinearInflation χ P₁' P₂' σv σe) ↔ + ∃ σv σe, IsColouredLinearInflation χ P₁ P₂ σv σe := by + constructor + · rintro ⟨σv, σe, h⟩ + exact ⟨_, _, h.image hS h₁.symm h₂.symm I₁.symm I₂.symm⟩ + · rintro ⟨σv, σe, h⟩ + exact ⟨_, _, h.image hS h₁ h₂ I₁ I₂⟩ + +omit [T2Space S] in +/-- **Graph Minors XIX, (5.1)** for inflations. -/ +theorem theorem_5_1' (hS : IsSurface S) (h₁ : IsFramePreservingHomeo χ.Φ α₁) + (h₂ : IsFramePreservingHomeo χ.Φ α₂) (I₁ : IsColouredImage α₁ P₁ P₁') + (I₂ : IsColouredImage α₂ P₂ P₂') : + (∃ σv σe, IsColouredInflation χ P₁' P₂' σv σe) ↔ ∃ σv σe, IsColouredInflation χ P₁ P₂ σv σe + := by + constructor + · rintro ⟨σv, σe, h⟩ + exact ⟨_, _, IsColouredInflation.image hS h₁.symm h₂.symm I₁.symm I₂.symm h⟩ + · rintro ⟨σv, σe, h⟩ + exact ⟨_, _, IsColouredInflation.image hS h₁ h₂ I₁ I₂ h⟩ + +end Transfer + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5b.lean b/LeanPool/GraphMinor/GM19/Section5b.lean new file mode 100644 index 0000000000..1a5103beb2 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5b.lean @@ -0,0 +1,409 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.PullPainting +public import LeanPool.GraphMinor.GM19.Sides +public import LeanPool.GraphMinor.GM19.FrameExists + +/-! +# Graph Minors XIX, (5.3): the first steps + +We start the proof of (5.3). An `O`-arc `F₁` in the fragment that is `Γ₁`-normal, with at most two +points +counted in `|F₁ ∩ V(Γ₁)| + |F₁ ∩ bd(Σ₁)|`, has at most one point on `bd(Σ₁)`. So `ψ` is injective on +it, +and `F = ψ(F₁)` is a `Γ`-normal `O`-arc of `Σ` with the same bound. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S S₁ : Type} [TopologicalSpace S] [TopologicalSpace S₁] [T2Space S] [T2Space S₁] + {Γ : Painting S} {K : Drawing S} {ψ : S₁ → S} + +namespace PullData + +variable (d : PullData Γ K ψ) +include d + +omit [T2Space S] [T2Space S₁] in +/-- A set that meets `V₁` and `bd(Σ₁)` as in the definition of internally 3-connected has at most +one +point on the boundary. Each point of the boundary on `F₁` lies in `U₁`, so by normality it lies in +`V₁`, +and it counts twice. -/ +theorem subsingleton_bd {F₁ : Set S₁} (hn : F₁ ∩ pullU Γ ψ ⊆ pullV Γ K ψ) (hfin : + (F₁ ∩ bd S₁).Finite) + (hc : (F₁ ∩ pullV Γ K ψ).ncard + (F₁ ∩ bd S₁).ncard ≤ 2) : (F₁ ∩ bd S₁).Subsingleton := by + have hsub : F₁ ∩ bd S₁ ⊆ F₁ ∩ pullV Γ K ψ := fun x hx ↦ ⟨hx.1, hn ⟨hx.1, Or.inr hx.2⟩⟩ + have hfinV : (F₁ ∩ pullV Γ K ψ).Finite := d.finite_pullV.subset inter_subset_right + have hle := ncard_le_ncard hsub hfinV + have h1 : (F₁ ∩ bd S₁).ncard ≤ 1 := by omega + rw [ncard_le_one hfin] at h1 + exact fun a ha b hb ↦ h1 a ha b hb + +omit [T2Space S] [T2Space S₁] in +/-- `ψ` is injective on a set with at most one point on the boundary. A point of the interior maps +into `R`, and a point of the boundary does not. -/ +theorem injOn_of_subsingleton {F₁ : Set S₁} (hs : (F₁ ∩ bd S₁).Subsingleton) : InjOn ψ F₁ := by + intro a ha b hb hab + by_cases hab₁ : a ∈ bd S₁ + · by_cases hbb : b ∈ bd S₁ + · exact hs ⟨ha, hab₁⟩ ⟨hb, hbb⟩ + · exact absurd (hab ▸ mem_image_of_mem ψ hbb) (d.frag.notMem_R_of_bd hab₁) + · by_cases hbb : b ∈ bd S₁ + · exact absurd (hab ▸ mem_image_of_mem ψ hab₁) (d.frag.notMem_R_of_bd hbb) + · exact d.frag.injOn_interior hab₁ hbb hab + +omit [T2Space S₁] in +/-- **The image of `F₁`.** It is an `O`-arc, it is `Γ`-normal, and it satisfies the same bound. -/ +theorem image_oArc {F₁ : Set S₁} (hO : IsOArc F₁) (hn : F₁ ∩ pullU Γ ψ ⊆ pullV Γ K ψ) + (hfin : (F₁ ∩ bd S₁).Finite) + (hc : (F₁ ∩ pullV Γ K ψ).ncard + (F₁ ∩ bd S₁).ncard ≤ 2) : + IsOArc (ψ '' F₁) ∧ ψ '' F₁ ∩ Γ.U ⊆ Γ.V ∧ (ψ '' F₁ ∩ bd S).Finite ∧ + (ψ '' F₁ ∩ Γ.V).ncard + (ψ '' F₁ ∩ bd S).ncard ≤ 2 := by + have hs := d.subsingleton_bd hn hfin hc + have hinj := d.injOn_of_subsingleton hs + have hfinV : (F₁ ∩ pullV Γ K ψ).Finite := d.finite_pullV.subset inter_subset_right + have hV : ψ '' F₁ ∩ Γ.V ⊆ ψ '' (F₁ ∩ pullV Γ K ψ) := by + rintro _ ⟨⟨x, hx, rfl⟩, hxV⟩ + exact mem_image_of_mem ψ ⟨hx, Or.inl hxV⟩ + have hb : ψ '' F₁ ∩ bd S ⊆ ψ '' (F₁ ∩ bd S₁) := by + rintro _ ⟨⟨x, hx, rfl⟩, hxb⟩ + exact mem_image_of_mem ψ ⟨hx, d.mem_bd_of_notMem_R (Or.inl hxb)⟩ + refine ⟨?_, ?_, (hfin.image ψ).subset hb, ?_⟩ + · obtain ⟨f⟩ := hO + have : CompactSpace F₁ := f.compactSpace + have hcont : Continuous fun x : F₁ ↦ (⟨ψ x.1, mem_image_of_mem ψ x.2⟩ : ↥(ψ '' F₁)) := + (d.frag.continuous_ψ.comp continuous_subtype_val).subtype_mk _ + have hbij : Function.Bijective fun x : F₁ ↦ (⟨ψ x.1, mem_image_of_mem ψ x.2⟩ : ↥(ψ '' F₁)) := by + constructor + · intro a b hab + exact Subtype.ext (hinj a.2 b.2 (congrArg Subtype.val hab)) + · rintro ⟨_, x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + exact ⟨f.trans (Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective _ hbij) hcont)⟩ + · rintro _ ⟨⟨x, hx, rfl⟩, hxU⟩ + rcases hn ⟨hx, Or.inl hxU⟩ with h | h + · exact h + · exact (d.inter ⟨hxU, K.V_subset_U h⟩).1 + · have h₁ : (ψ '' F₁ ∩ Γ.V).ncard ≤ (F₁ ∩ pullV Γ K ψ).ncard := + (ncard_le_ncard hV (hfinV.image ψ)).trans (ncard_image_le hfinV) + have h₂ : (ψ '' F₁ ∩ bd S).ncard ≤ (F₁ ∩ bd S₁).ncard := + (ncard_le_ncard hb (hfin.image ψ)).trans (ncard_image_le hfin) + omega + +omit [T2Space S] [T2Space S₁] in +/-- A connected set off `bd(Σ) ∪ U(K)` that meets `R` lies in `R`. -/ +theorem subset_R_of_preconnected {A : Set S} (hAc : IsPreconnected A) (hoff : Disjoint A + (bd S ∪ K.U)) + (hne : (A ∩ IsCuttingFragment.R ψ).Nonempty) : A ⊆ IsCuttingFragment.R ψ := by + obtain ⟨z, hzA, hzR⟩ := hne + obtain ⟨w, hw, hcomp⟩ := d.frag.interior_component + have hzc : z ∈ connectedComponentIn (bd S ∪ K.U)ᶜ w := hcomp ▸ hzR + have hsub : A ⊆ connectedComponentIn (bd S ∪ K.U)ᶜ z := hAc.subset_connectedComponentIn hzA + (fun x hx hxb ↦ disjoint_left.mp hoff hx hxb) + rw [← connectedComponentIn_eq hzc, hcomp] at hsub + exact hsub + +end PullData + +/-! ### Discs -/ + +/-- The interior of the unit disc, seen in the disc, is connected near each point of the circle: the +intersection of the open disc with a small ball is convex. -/ +theorem connected_near_disc (p : ClosedUnitDisc) : + ∀ W ∈ 𝓝 p, ∃ B ⊆ {x : ClosedUnitDisc | x.1 ∉ UnitCircle} ∩ W, IsPreconnected B ∧ + ∃ W' ∈ 𝓝 p, {x : ClosedUnitDisc | x.1 ∉ UnitCircle} ∩ W' ⊆ B := by + intro W hW + obtain ⟨ε, hε, hsub⟩ := Metric.mem_nhds_iff.mp hW + have hopen : ∀ x : ClosedUnitDisc, x.1 ∉ UnitCircle → x.1 ∈ Metric.ball (0 : EuclideanPlane) 1 + := by + intro x hx + have h₁ : dist x.1 0 ≤ 1 := x.2 + exact Metric.mem_ball.mpr (lt_of_le_of_ne h₁ hx) + refine ⟨Metric.ball p ε ∩ {x | x.1 ∉ UnitCircle}, ?_, ?_, Metric.ball p ε, + Metric.ball_mem_nhds p hε, ?_⟩ + · exact fun x hx ↦ ⟨hx.2, hsub hx.1⟩ + · rw [← IsInducing.subtypeVal.isPreconnected_image] + have himg : Subtype.val '' (Metric.ball p ε ∩ {x : ClosedUnitDisc | x.1 ∉ UnitCircle}) = + Metric.ball (0 : EuclideanPlane) 1 ∩ Metric.ball p.1 ε := by + ext x + constructor + · rintro ⟨y, ⟨hy, hyc⟩, rfl⟩ + exact ⟨hopen y hyc, hy⟩ + · rintro ⟨hx, hx'⟩ + have hx₀ : x ∈ ClosedUnitDisc := Metric.ball_subset_closedBall hx + refine ⟨⟨x, hx₀⟩, ⟨hx', ?_⟩, rfl⟩ + exact (Metric.mem_ball.mp hx).ne + rw [himg] + exact ((convex_ball _ _).inter (convex_ball _ _)).isPreconnected + · exact fun x hx ↦ ⟨hx.2, hx.1⟩ + +/-- The inside of a closed disc is connected near each boundary point. -/ +theorem isConnectedNear_discInt.{u} {S : Type u} [TopologicalSpace S] [T2Space S] {Δ : Set S} + (hΔ : IsClosedDisc Δ) + {v : S} (hv : v ∈ discBd Δ) : IsConnectedNear (discInt Δ) v := by + obtain ⟨φ⟩ := id hΔ + have hbd := disc_boundary Δ φ + rw [hbd] at hv + obtain ⟨p, hp, rfl⟩ := hv + have : CompactSpace ClosedUnitDisc := + isCompact_iff_compactSpace.mp (isCompact_closedBall _ _) + have himg : (fun x ↦ (φ x).1) '' {x : ClosedUnitDisc | x.1 ∉ UnitCircle} = discInt Δ := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + refine ⟨(φ x).2, ?_⟩ + rw [hbd] + rintro ⟨x', hx', he⟩ + have : x' = x := φ.injective (Subtype.ext he) + exact hx (this ▸ hx') + · rintro ⟨hy, hyb⟩ + refine ⟨φ.symm ⟨y, hy⟩, ?_, by simp⟩ + intro hc + apply hyb + rw [hbd] + exact ⟨_, hc, by simp⟩ + have h := isConnectedNear_of_homeo φ (connected_near_disc p) + rwa [himg] at h + +/-- **Lifting a disc.** Let `F₁` be an `O`-arc in the fragment with at most one point on the +boundary, and +let `Δ` be a disc of `Σ` bounded by `ψ(F₁)` whose inside misses `bd(Σ) ∪ U(K)`. Then the closure of +the +lift of the inside of `Δ` is a disc of `Σ₁` bounded by `F₁`. The point on the boundary needs an +argument, +since the fragment may have several points over its image: the rest of `F₁` lies in the closed disc +and +accumulates at that point. -/ +theorem PullData.exists_disc_lift (d : PullData Γ K ψ) {F₁ : Set S₁} + {Δ : Set S} (hO : IsOArc F₁) (hs : (F₁ ∩ bd S₁).Subsingleton) (hΔ : IsClosedDisc Δ) + (hF : discBd Δ = ψ '' F₁) (hoff : Disjoint (discInt Δ) (bd S ∪ K.U)) : + ∃ Δ₁ : Set S₁, IsClosedDisc Δ₁ ∧ discBd Δ₁ = F₁ ∧ ψ '' Δ₁ = Δ ∧ InjOn ψ Δ₁ := by + obtain ⟨f⟩ := id hO + have hpi := Real.pi_pos + have hnear : ∀ u ∈ F₁, u ∈ closure (F₁ \ bd S₁) := by + intro u hu + by_cases hub : u ∈ bd S₁ + · obtain ⟨t, -, ht⟩ := exists_angle_in f 0 ⟨u, hu⟩ + change cuffPoint f t = u at ht + have hsub : arcOf f t (t + Real.pi) ⊆ F₁ \ bd S₁ := by + rintro _ ⟨s, hs', rfl⟩ + refine ⟨cuffPoint_mem f s, fun hb ↦ ?_⟩ + have he : cuffPoint f s = cuffPoint f t := by + rw [ht] + exact hs ⟨cuffPoint_mem f s, hb⟩ ⟨hu, hub⟩ + have := cuffPoint_injOn f (a := t) (b := t + 2 * Real.pi) le_rfl + ⟨hs'.1.le, by linarith [hs'.2]⟩ ⟨le_rfl, by linarith⟩ he + linarith [hs'.1] + refine closure_mono hsub ?_ + rw [closure_arcOf f (by linarith)] + exact ⟨t, ⟨le_rfl, by linarith⟩, ht⟩ + · exact subset_closure ⟨hu, hub⟩ + have hR := d.isOpen_R + have hbd := d.isClosed_bd + have hAsub : discInt Δ ⊆ Δ := discInt_subset Δ + have hcl : closure (discInt Δ) = Δ := + Subset.antisymm (closure_minimal hAsub hΔ.isClosed) hΔ.subset_closure_discInt + obtain ⟨x₀, hx₀⟩ : (F₁ \ bd S₁).Nonempty := + closure_nonempty_iff.mp ⟨_, hnear _ (f 1).2⟩ + have hbdΔ : ψ x₀ ∈ Δ := Surface.discBd_subset _ (hF ▸ mem_image_of_mem ψ hx₀.1) + have hAR : discInt Δ ⊆ IsCuttingFragment.R ψ := by + refine d.subset_R_of_preconnected hΔ.isPreconnected_discInt hoff ?_ + obtain ⟨z, hzR, hzA⟩ := mem_closure_iff.mp (hcl.symm ▸ hbdΔ) _ hR + (mem_image_of_mem ψ hx₀.2) + exact ⟨z, hzA, hzR⟩ + have hloc : ∀ v ∈ tilde (discInt Δ), IsConnectedNear (discInt Δ) v := by + rintro v ⟨hv, hvn⟩ + rw [hcl] at hv + refine isConnectedNear_discInt hΔ ?_ + by_contra hvb + exact hvn ⟨hv, hvb⟩ + have himg : ψ '' closure (ψ ⁻¹' discInt Δ) = Δ := by + rw [d.frag.image_closure_preimage hAR, hcl] + have hinj : InjOn ψ (closure (ψ ⁻¹' discInt Δ)) := by + intro x hx y hy hxy + have h := (d.frag.bijective_closureMap hbd hR hAR hloc).1 (a₁ := ⟨x, hx⟩) (a₂ := ⟨y, hy⟩) + (Subtype.ext hxy) + exact congrArg Subtype.val h + let H := (d.frag.homeoClosure hbd hR hAR hloc).trans (Homeomorph.setCongr hcl) + have hH : ∀ x, (H x).1 = ψ x.1 := fun _ ↦ rfl + -- The points of `F₁` off the boundary lie in the closed disc, and so does the rest. + have hin : F₁ ⊆ closure (ψ ⁻¹' discInt Δ) := by + have hoffb : F₁ \ bd S₁ ⊆ closure (ψ ⁻¹' discInt Δ) := by + rintro x ⟨hx, hxb⟩ + have hxΔ : ψ x ∈ Δ := Surface.discBd_subset _ (hF ▸ mem_image_of_mem ψ hx) + rw [← himg] at hxΔ + obtain ⟨w, hw, hwx⟩ := hxΔ + have hwb : w ∉ bd S₁ := fun hb ↦ + d.frag.notMem_R_of_bd hb (hwx ▸ mem_image_of_mem ψ hxb) + rw [← d.frag.injOn_interior hwb hxb hwx] + exact hw + exact fun u hu ↦ closure_minimal hoffb isClosed_closure (hnear u hu) + refine ⟨_, ?_, ?_, himg, hinj⟩ + · obtain ⟨φ⟩ := id hΔ + exact ⟨φ.trans H.symm⟩ + · ext z + constructor + · rintro ⟨b, hb, rfl⟩ + have hb' : H b ∈ bd Δ := by + rw [← image_bd H] + exact mem_image_of_mem _ hb + have hm : ψ b.1 ∈ ψ '' F₁ := by + rw [← hF, ← hH] + exact ⟨_, hb', rfl⟩ + obtain ⟨x, hx, hxb⟩ := hm + rw [← hinj (hin hx) b.2 hxb] + exact hx + · intro hz + have hm : ψ z ∈ discBd Δ := hF ▸ mem_image_of_mem ψ hz + obtain ⟨y, hy, hyz⟩ := hm + refine ⟨H.symm y, ?_, ?_⟩ + · rw [← image_bd H.symm] + exact mem_image_of_mem _ hy + · refine hinj (Subtype.property _) (hin hz) ?_ + rw [← hH, Homeomorph.apply_symm_apply, hyz] + +/-- No part of `K` is hidden behind one point. Every point `x` of `U(K)`, once a point `u ≠ x` is +removed, +is joined inside `U(K) \ {u}` to a vertex of `Γ`. This follows from the hypothesis of (5.3) when `K` +is +a line whose two ends are vertices of `Γ`, or an `O`-arc with two vertices of `Γ`. Those are the +only +drawings along which we cut. For them no local study near `u` is needed, unlike the proof in the +paper +for a general `K`. -/ +def IsAnchored (Γ : Painting S) (K : Drawing S) : Prop := + ∀ u x, x ∈ K.U → x ≠ u → ∃ C ⊆ K.U \ {u}, x ∈ C ∧ IsPreconnected C ∧ (C ∩ Γ.V).Nonempty + +/-- **The fourth condition of (5.3).** The disc bounded by the image of `F₁` has nothing of `K` +inside, +since `K` would have to reach a vertex of `Γ` inside the disc. So the disc lifts. -/ +theorem PullData.exists_disc (d : PullData Γ K ψ) + (hΓ : Γ.IsInternallyThreeConnected) (hA : IsAnchored Γ K) {F₁ : Set S₁} (hO : IsOArc F₁) + (hn : F₁ ∩ pullU Γ ψ ⊆ pullV Γ K ψ) (hfin : (F₁ ∩ bd S₁).Finite) + (hc : (F₁ ∩ pullV Γ K ψ).ncard + (F₁ ∩ bd S₁).ncard ≤ 2) : + ∃ Δ₁ : Set S₁, IsClosedDisc Δ₁ ∧ discBd Δ₁ = F₁ ∧ Δ₁ ∩ pullV Γ K ψ ⊆ F₁ := by + have hs := d.subsingleton_bd hn hfin hc + obtain ⟨hO', hn', hfin', hc'⟩ := d.image_oArc hO hn hfin hc + obtain ⟨Δ, hΔ, hbdΔ, hV⟩ := hΓ.2 _ hO' hn' hfin' hc' + have hman : ∀ x : S, IsManifoldPoint x := d.surface.2.2 + -- `F` meets `U(K)` in at most one point. + obtain ⟨u, huF, hu⟩ : ∃ u ∈ ψ '' F₁, ψ '' F₁ ∩ K.U ⊆ {u} := by + by_cases hne : (ψ '' F₁ ∩ K.U).Nonempty + · obtain ⟨u, hu⟩ := hne + refine ⟨u, hu.1, ?_⟩ + rintro _ ⟨⟨a, ha, rfl⟩, haK⟩ + obtain ⟨⟨b, hb, rfl⟩, hbK⟩ := hu + have ha' : a ∈ bd S₁ := d.mem_bd_of_notMem_R (Or.inr haK) + have hb' : b ∈ bd S₁ := d.mem_bd_of_notMem_R (Or.inr hbK) + rw [hs ⟨ha, ha'⟩ ⟨hb, hb'⟩] + rfl + · obtain ⟨f⟩ := hO + exact ⟨_, mem_image_of_mem ψ (f 1).2, fun z hz ↦ (hne ⟨z, hz⟩).elim⟩ + have hoffK : Disjoint (discInt Δ) K.U := by + refine disjoint_left.mpr fun x hx hxK ↦ ?_ + have hxF : x ∉ ψ '' F₁ := hbdΔ ▸ hx.2 + have hxu : x ≠ u := fun h ↦ hxF (h ▸ huF) + obtain ⟨C, hCsub, hxC, hCc, v, hvC, hvV⟩ := hA u x hxK hxu + have hCF : Disjoint C (ψ '' F₁) := by + refine disjoint_left.mpr fun y hyC hyF ↦ (hCsub hyC).2 (hu ⟨hyF, (hCsub hyC).1⟩) + have hCin : C ⊆ discInt Δ := by + refine hCc.subset_left_of_subset_union (hΔ.isOpen_discInt hman) hΔ.isClosed.isOpen_compl + (disjoint_left.mpr fun w hw hn ↦ hn hw.1) (fun y hy ↦ ?_) ⟨x, hxC, hx⟩ + by_cases hyΔ : y ∈ Δ + · exact Or.inl ⟨hyΔ, fun hb ↦ disjoint_left.mp hCF hy (hbdΔ ▸ hb)⟩ + · exact Or.inr hyΔ + exact (hCin hvC).2 (hbdΔ ▸ hV ⟨(hCin hvC).1, hvV⟩) + have hoff : Disjoint (discInt Δ) (bd S ∪ K.U) := by + refine disjoint_left.mpr ?_ + rintro x hx (hxb | hxK) + · exact hxb (isInteriorPoint_of_mem_discInt hman hΔ hx) + · exact disjoint_left.mp hoffK hx hxK + obtain ⟨Δ₁, hΔ₁, hbd₁, himg, hinj⟩ := d.exists_disc_lift hO hs hΔ hbdΔ hoff + refine ⟨Δ₁, hΔ₁, hbd₁, ?_⟩ + rintro x ⟨hxΔ, hxV⟩ + have hxF : ψ x ∈ ψ '' F₁ := by + have hxD : ψ x ∈ Δ := himg ▸ mem_image_of_mem ψ hxΔ + rcases hxV with h | h + · exact hV ⟨hxD, h⟩ + · by_contra hn' + exact disjoint_left.mp hoffK ⟨hxD, fun hb ↦ hn' (hbdΔ ▸ hb)⟩ (K.V_subset_U h) + obtain ⟨y, hy, hyx⟩ := hxF + have hyΔ : y ∈ Δ₁ := Surface.discBd_subset _ (hbd₁ ▸ hy) + exact hinj hyΔ hxΔ hyx ▸ hy + +omit [T2Space S] [T2Space S₁] in +/-- A cuff has a point off the finite set `V₁`, so the boundary gives an edge. -/ +theorem PullData.nonempty_pieces (d : PullData Γ K ψ) (hne : (bd S₁).Nonempty) : + (arcComponentsIn (bd S₁ \ pullV Γ K ψ)).Nonempty := by + have hSur := d.frag.isSurface + have hpi := Real.pi_pos + obtain ⟨x, hx⟩ := hne + obtain ⟨C, hC, -⟩ := sUnion_cuffs (S := S₁) ▸ hx + let C' : cuffs S₁ := ⟨C, hC⟩ + obtain ⟨f⟩ := (cuff_statement S₁ hSur).2.2 C hC + have hinf : (cuffPoint f '' Ico 0 (2 * Real.pi)).Infinite := + (Ico_infinite (by linarith)).image fun a ha b hb h ↦ + cuffPoint_injOn f (a := 0) (by linarith) ha hb h + obtain ⟨y, hy, hyV⟩ := hinf.exists_notMem_finite d.finite_pullV + obtain ⟨t, -, rfl⟩ := hy + obtain ⟨p, hp, -⟩ := exists_arcComp_superset (F := bd S₁ \ pullV Γ K ψ) + (isPathConnected_singleton (cuffPoint f t)) + (singleton_subset_iff.mpr ⟨cuff_subset_bd C' (cuffPoint_mem f t), hyV⟩) + exact ⟨p, hp⟩ + +omit [T2Space S₁] in +/-- `Γ₁` has an edge. If the fragment has boundary this comes from `PullData.nonempty_pieces`. If +not, the fragment +fills all of the connected surface `Σ`, and each edge of `Γ` lifts. -/ +theorem PullData.nonempty_pullPieces [Nonempty S₁] [ConnectedSpace S] (d : PullData Γ K ψ) + (hE : Γ.E.Nonempty) : + (pullPieces Γ K ψ).Nonempty := by + by_cases hne : (bd S₁).Nonempty + · obtain ⟨p, hp⟩ := d.nonempty_pieces hne + exact ⟨p, Or.inl hp⟩ + · have hemp : bd S₁ = ∅ := not_nonempty_iff_eq_empty.mp hne + have hR : IsCuttingFragment.R ψ = range ψ := by + rw [IsCuttingFragment.R, hemp, compl_empty, image_univ] + have hclo : IsClopen (IsCuttingFragment.R ψ) := + ⟨hR ▸ d.frag.isClosedMap.isClosed_range, d.isOpen_R⟩ + obtain ⟨x⟩ := ‹Nonempty S₁› + have huniv := hclo.eq_univ ⟨ψ x, by rw [hR]; exact mem_range_self x⟩ + obtain ⟨e, he⟩ := hE + obtain ⟨z, hz⟩ := he.1 + have hb : ¬ Painting.IsBorder e := by + rintro ⟨w, -, hw⟩ + have hwR : w ∈ IsCuttingFragment.R ψ := huniv ▸ mem_univ w + exact disjoint_left.mp d.frag.disjoint_R hwR (Or.inl hw) + have hzR : z ∈ IsCuttingFragment.R ψ := huniv ▸ mem_univ z + obtain ⟨z₁, -, hz₁⟩ := hzR + exact ⟨ψ ⁻¹' e, Or.inr ⟨e, he, hb, ⟨z₁, by rw [mem_preimage, hz₁]; exact hz⟩, rfl⟩⟩ + +/-- **The fourth condition in the definition of "fit", for the pull-back** (Graph Minors XIX, +(5.3)). -/ +theorem PullData.isInternallyThreeConnected [Nonempty S₁] [ConnectedSpace S] (d : PullData Γ K ψ) + (γb : Set S₁ → List S₁) + (hγ₁ : ∀ p ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ), (γb p).Nodup) + (hγ₂ : ∀ p ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ), {v | v ∈ γb p} = tilde p) + (hΓ : Γ.IsInternallyThreeConnected) (hA : IsAnchored Γ K) : + (pullPainting d γb hγ₁ hγ₂).IsInternallyThreeConnected := by + refine ⟨?_, fun F₁ hO hn hfin hc ↦ d.exists_disc hΓ hA hO hn hfin hc⟩ + obtain ⟨p, hp⟩ := d.nonempty_pullPieces hΓ.1 + refine ⟨p, ?_⟩ + change p ∈ arcComponentsIn (pullU Γ ψ \ pullV Γ K ψ) + rw [d.arcComponentsIn_eq] + exact hp + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5c.lean b/LeanPool/GraphMinor/GM19/Section5c.lean new file mode 100644 index 0000000000..c328264e24 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5c.lean @@ -0,0 +1,206 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5b +public import LeanPool.GraphMinor.GM19.ArcDirection + +/-! +# Graph Minors XIX, Section 5: the frame of a fragment + +The frame `ψ⁻¹(Φ) ∩ Σ₁` of a fragment has vertex set `ψ⁻¹(V(Φ) ∪ V(K))`. Its sides are open arcs of +the +cuffs of `Σ₁`. Each side is read along the circle that parametrises its cuff, forward or backward as +the +parameter `flip` says. A border edge of the pulled back painting is read the same way as the side +that +holds it, so the two directions agree (`DirAgrees`). The long sides are those that `ψ` maps into a +long side of `Φ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S S₁ : Type} [TopologicalSpace S] [TopologicalSpace S₁] [T2Space S] [T2Space S₁] + +/-- A fixed way to read each cuff as a circle. -/ +noncomputable def cuffPar (hS : IsSurface S₁) (C : cuffs S₁) : Circle ≃ₜ C.1 := + ((cuff_statement S₁ hS).2.2 C.1 C.2).some + +/-- `l` lists the ends of the open arc `e` of a cuff, in the sense given by `ε`. -/ +def IsArcMarch (hS : IsSurface S₁) (ε : Bool) (e : Set S₁) (l : List S₁) : Prop := + ∃ (C : cuffs S₁) (a b : ℝ), a < b ∧ b < a + 2 * Real.pi ∧ e = arcOf (cuffPar hS C) a b ∧ + l = if ε then [cuffPoint (cuffPar hS C) b, cuffPoint (cuffPar hS C) a] + else [cuffPoint (cuffPar hS C) a, cuffPoint (cuffPar hS C) b] + +open Classical in +/-- The march of an open arc of a cuff, in the sense given by `ε`. -/ +noncomputable def arcMarch (hS : IsSurface S₁) (ε : Bool) (e : Set S₁) : List S₁ := + if h : ∃ l, IsArcMarch hS ε e l then h.choose else [] + +omit [T2Space S₁] in +theorem arcMarch_spec (hS : IsSurface S₁) (ε : Bool) {e : Set S₁} {C : cuffs S₁} {a b : ℝ} + (hab : a < b) (hub : b < a + 2 * Real.pi) (he : e = arcOf (cuffPar hS C) a b) : + IsArcMarch hS ε e (arcMarch hS ε e) := by + have h : ∃ l, IsArcMarch hS ε e l := ⟨_, C, a, b, hab, hub, he, rfl⟩ + rw [arcMarch, dite_eq_left h] + exact h.choose_spec + +theorem IsArcMarch.nodup {hS : IsSurface S₁} {ε : Bool} {e : Set S₁} {l : List S₁} + (h : IsArcMarch hS ε e l) : l.Nodup := by + obtain ⟨C, a, b, hab, hub, -, rfl⟩ := h + have hne := (GM20.line_facts (isLine_arcOf (cuffPar hS C) hab hub)).1 + cases ε <;> simp [hne, hne.symm] + +theorem IsArcMarch.set_eq {hS : IsSurface S₁} {ε : Bool} {e : Set S₁} {l : List S₁} + (h : IsArcMarch hS ε e l) : {v | v ∈ l} = tilde e := by + obtain ⟨C, a, b, hab, hub, rfl, rfl⟩ := h + rw [tilde_arcOf _ hab hub] + ext x + cases ε <;> simp [or_comm] + +/-- The shape of an arc-wise component of `bd(Σ₁) \ N`. -/ +theorem arc_shape (hS : IsSurface S₁) {N : Set S₁} (hN : N.Finite) + (h2 : ∀ C : cuffs S₁, ∃ p ∈ N ∩ C.1, ∃ q ∈ N ∩ C.1, p ≠ q) {e : Set S₁} + (he : e ∈ arcComponentsIn (bd S₁ \ N)) : + (tilde e).ncard = 2 ∧ (tilde e).Finite ∧ IsLine (closure e) ∧ lineEnds (closure e) = tilde e + := by + obtain ⟨C, a, b, hab, hub, rfl, -, -, -⟩ := exists_arc_of_mem hS (cuffPar hS) hN h2 he + have hL := isLine_arcOf (cuffPar hS C) hab hub + have ht := tilde_arcOf (cuffPar hS C) hab hub + obtain ⟨f, -⟩ := id hL + refine ⟨by rw [ht, ncard_pair (GM20.line_facts hL).1], ?_, ⟨f⟩, ?_⟩ + · rw [ht] + exact (finite_singleton _).insert _ + · rw [ht] + exact (GM20.line_facts hL).2.2.2 + +/-- The vertex set `ψ⁻¹(V(Φ) ∪ V(K))` of the frame of a fragment. -/ +def pullFrameV (Φ : Frame S) (K : Drawing S) (ψ : S₁ → S) : Set S₁ := ψ ⁻¹' (Φ.V ∪ K.V) + +/-- The hypotheses for the frame of a fragment. -/ +structure FrameData (Φ : Frame S) (Γ : Painting S) (K : Drawing S) (ψ : S₁ → S) : Prop where + pull : PullData Γ K ψ + fits : Γ.Fits Φ + two : ∀ C : cuffs S₁, ∃ p ∈ pullFrameV Φ K ψ ∩ C.1, ∃ q ∈ pullFrameV Φ K ψ ∩ C.1, p ≠ q + K_bd : K.U ∩ bd S ⊆ K.V + +namespace FrameData + +variable {Φ : Frame S} {Γ : Painting S} {K : Drawing S} {ψ : S₁ → S} + +omit [T2Space S] [T2Space S₁] in +theorem finite_pullFrameV (D : FrameData Φ Γ K ψ) : (pullFrameV Φ K ψ).Finite := + (Φ.finite_V.union K.finite_V).preimage' fun y _ ↦ D.pull.frag.finite_fibres y + +omit [T2Space S] [T2Space S₁] in +theorem pullFrameV_subset_bd (D : FrameData Φ Γ K ψ) : pullFrameV Φ K ψ ⊆ bd S₁ := by + rintro x (hx | hx) + · exact D.pull.mem_bd_of_notMem_R (Or.inl (Φ.V_subset hx)) + · exact D.pull.mem_bd_of_notMem_R (Or.inr (K.V_subset_U hx)) + +omit [T2Space S] [T2Space S₁] in +theorem pullFrameV_subset (D : FrameData Φ Γ K ψ) : pullFrameV Φ K ψ ⊆ pullV Γ K ψ := by + rintro x (hx | hx) + · exact Or.inl (D.fits.V_subset hx) + · exact Or.inr hx + +end FrameData + +/-- **The frame `ψ⁻¹(Φ) ∩ Σ₁`** (Graph Minors XIX, Section 5, page 335). No two long sides have a +common end, +which we take as a hypothesis here. -/ +noncomputable def pullFrame {Φ : Frame S} {Γ : Painting S} {K : Drawing S} {ψ : S₁ → S} + (D : FrameData Φ Γ K ψ) (flip : Set S₁ → Bool) + (hlong : ∀ s₁ ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ), + ∀ s₂ ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ), s₁ ≠ s₂ → + (∃ s ∈ Φ.longSides, ψ '' s₁ ⊆ s) → (∃ s ∈ Φ.longSides, ψ '' s₂ ⊆ s) → + Disjoint (tilde s₁) (tilde s₂)) : Frame S₁ where + V := pullFrameV Φ K ψ + γ s := arcMarch D.pull.frag.isSurface (flip s) s + isLong s := ∃ s' ∈ Φ.longSides, ψ '' s ⊆ s' + V_subset := D.pullFrameV_subset_bd + finite_V := D.finite_pullFrameV + finite_sides := finite_arcComponentsIn_bd D.pull.frag.isSurface D.finite_pullFrameV D.two + side_shape _ hs := arc_shape D.pull.frag.isSurface D.finite_pullFrameV D.two hs + γ_nodup s hs := by + have hS := D.pull.frag.isSurface + obtain ⟨C, a, b, hab, hub, he, -, -, -⟩ := + exists_arc_of_mem hS (cuffPar hS) D.finite_pullFrameV D.two hs + exact (arcMarch_spec hS (flip s) hab hub he).nodup + γ_set s hs := by + have hS := D.pull.frag.isSurface + obtain ⟨C, a, b, hab, hub, he, -, -, -⟩ := + exists_arc_of_mem hS (cuffPar hS) D.finite_pullFrameV D.two hs + exact (arcMarch_spec hS (flip s) hab hub he).set_eq + long_disjoint := hlong + +open Classical in +/-- The side of the frame of the fragment that holds a border edge. -/ +noncomputable def sideOf (Φ : Frame S) (K : Drawing S) (ψ : S₁ → S) (e : Set S₁) : Set S₁ := + if h : ∃ s ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ), e ⊆ s then h.choose else ∅ + +namespace FrameData + +variable {Φ : Frame S} {Γ : Painting S} {K : Drawing S} {ψ : S₁ → S} (D : FrameData Φ Γ K ψ) +include D + +omit [T2Space S] [T2Space S₁] D in +theorem sideOf_eq {e s : Set S₁} (hne : e.Nonempty) + (hs : s ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ)) (hes : e ⊆ s) : sideOf Φ K ψ e = s := by + have h : ∃ s ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ), e ⊆ s := ⟨s, hs, hes⟩ + rw [sideOf, dite_eq_left h] + obtain ⟨h₁, h₂⟩ := h.choose_spec + obtain ⟨x, hx⟩ := hne + exact arcComp_eq_of_mem h₁ hs (h₂ hx) (hes hx) + +omit [T2Space S] in +/-- The two parts of the third condition of "fit" for the pull-back: an edge inside a side, read in +the +sense of the side, has the direction of the side. -/ +theorem dirAgrees_pull (flip : Set S₁ → Bool) {e s : Set S₁} + (he : e ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ)) + (hs : s ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ)) (hes : e ⊆ s) : + DirAgrees s (arcMarch D.pull.frag.isSurface (flip s) s) e + (arcMarch D.pull.frag.isSurface (flip s) e) := by + have hS := D.pull.frag.isSurface + generalize flip s = ε + obtain ⟨C, a, b, hab, hub, hse, -, -, -⟩ := + exists_arc_of_mem hS (cuffPar hS) D.finite_pullFrameV D.two hs + obtain ⟨C', a', b', hab', hub', hee, -, -, -⟩ := + exists_arc_of_mem hS (cuffPar hS) D.pull.finite_pullV D.pull.two he + obtain ⟨C₁, a₁, b₁, hab₁, hub₁, hs₁, hl₁⟩ := arcMarch_spec hS ε hab hub hse + obtain ⟨C₂, a₂, b₂, hab₂, hub₂, he₂, hl₂⟩ := arcMarch_spec hS ε hab' hub' hee + rw [hl₁, hl₂] + -- The two arcs lie on the same cuff. + have hC : C₂ = C₁ := by + by_contra hne + obtain ⟨x, hx⟩ := he.1 + have h₁ : x ∈ C₁.1 := arcOf_subset _ _ _ (hs₁ ▸ hes hx) + have h₂ : x ∈ C₂.1 := arcOf_subset _ _ _ (he₂ ▸ hx) + exact disjoint_left.mp (cuffs_disjoint' hne) h₂ h₁ + subst hC + obtain ⟨m, h₁, h₂⟩ := exists_shift (cuffPar hS C₂) hab₁ hab₂ hub₁ (by + rw [← he₂, ← hs₁] + exact hes) + have hshift := arcOf_shift (cuffPar hS C₂) a₂ b₂ m + have hp₁ := cuffPoint_shift (cuffPar hS C₂) a₂ m + have hp₂ := cuffPoint_shift (cuffPar hS C₂) b₂ m + rw [hs₁, he₂, ← hshift, ← hp₁, ← hp₂] + have hlt : a₂ + m * (2 * Real.pi) < b₂ + m * (2 * Real.pi) := by linarith + cases ε + · simpa using dirAgrees_forward (cuffPar hS C₂) hub₁ h₁ hlt h₂ + · simpa using dirAgrees_backward (cuffPar hS C₂) hub₁ h₁ hlt h₂ + +end FrameData + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5d.lean b/LeanPool/GraphMinor/GM19/Section5d.lean new file mode 100644 index 0000000000..91bc975dca --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5d.lean @@ -0,0 +1,270 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5c +public import LeanPool.GraphMinor.GM19.CutTwo + +/-! +# Graph Minors XIX, (5.3): the frame and the fit + +We finish the first three conditions of "fit" for `ψ⁻¹(Γ) ∩ Σ₁` and `ψ⁻¹(Φ) ∩ Σ₁`. A side of the new +frame maps +into a side of `Φ` or into an edge of `K`. In the second case it is short, and in the first case it +is short +only if the side of `Φ` is. Either way a short side has no vertex of `Γ₁` on it. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S S₁ : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace S₁] [T2Space S₁] + + +omit [T2Space S₁] in +/-- The mirror of `arcOf_eq_of_left`. -/ +theorem arcOf_eq_of_right {Θ : Set S₁} (f : Circle ≃ₜ Θ) {N : Set S₁} {a b a' b' : ℝ} (hab : a < b) + (hab' : a' < b') + (hd : Disjoint (arcOf f a b) N) (hd' : Disjoint (arcOf f a' b') N) + (ha : cuffPoint f a ∈ N) (ha' : cuffPoint f a' ∈ N) (h : cuffPoint f b = cuffPoint f b') : + arcOf f a b = arcOf f a' b' := by + obtain ⟨m, hm⟩ := cuffPoint_eq f h + subst hm + have hshift := arcOf_shift f (a - m * (2 * Real.pi)) b' m + rw [sub_add_cancel] at hshift + rw [hshift] at hd ⊢ + have hcp : cuffPoint f (a - m * (2 * Real.pi)) = cuffPoint f a := by + have h := cuffPoint_shift f (a - m * (2 * Real.pi)) m + rwa [sub_add_cancel, eq_comm] at h + have hab₂ : a - m * (2 * Real.pi) < b' := by linarith + rcases lt_trichotomy (a - m * (2 * Real.pi)) a' with h₁ | h₁ | h₁ + · exact absurd ha' (disjoint_left.mp hd ⟨_, ⟨h₁, hab'⟩, rfl⟩) + · rw [h₁] + · exact absurd (hcp ▸ ha) (disjoint_left.mp hd' ⟨_, ⟨h₁, hab₂⟩, rfl⟩) + +/-- At a point of the boundary at most two arcs of `bd(Σ₁) \ N` end: one on each side. -/ +theorem eq_or_eq_of_mem_tilde (hS : IsSurface S₁) {N : Set S₁} (hN : N.Finite) + (h2 : ∀ C : cuffs S₁, ∃ p ∈ N ∩ C.1, ∃ q ∈ N ∩ C.1, p ≠ q) {R₁ R₂ R₃ : Set S₁} + (h₁ : R₁ ∈ arcComponentsIn (bd S₁ \ N)) (h₂ : R₂ ∈ arcComponentsIn (bd S₁ \ N)) + (h₃ : R₃ ∈ arcComponentsIn (bd S₁ \ N)) (hne : R₁ ≠ R₂) {p : S₁} (hp₁ : p ∈ tilde R₁) + (hp₂ : p ∈ tilde R₂) + (hp₃ : p ∈ tilde R₃) : R₃ = R₁ ∨ R₃ = R₂ := by + have key : ∀ {R}, R ∈ arcComponentsIn (bd S₁ \ N) → p ∈ tilde R → ∃ (C : cuffs S₁) + (a b : ℝ), a < b ∧ + R = arcOf (cuffPar hS C) a b ∧ Disjoint R N ∧ cuffPoint (cuffPar hS C) a ∈ N ∧ + cuffPoint (cuffPar hS C) b ∈ N ∧ (p = cuffPoint (cuffPar hS C) a ∨ p = cuffPoint + (cuffPar hS C) b) := by + intro R hR hp + obtain ⟨C, a, b, hab, hub, rfl, hd, ha, hb⟩ := exists_arc_of_mem hS (cuffPar hS) hN h2 hR + rw [tilde_arcOf _ hab hub] at hp + exact ⟨C, a, b, hab, rfl, hd, ha, hb, hp⟩ + obtain ⟨C₁, a₁, b₁, hab₁, rfl, hd₁, ha₁, hb₁, hc₁⟩ := key h₁ hp₁ + obtain ⟨C₂, a₂, b₂, hab₂, rfl, hd₂, ha₂, hb₂, hc₂⟩ := key h₂ hp₂ + obtain ⟨C₃, a₃, b₃, hab₃, rfl, hd₃, ha₃, hb₃, hc₃⟩ := key h₃ hp₃ + have hm : ∀ {C : cuffs S₁} {t}, p = cuffPoint (cuffPar hS C) t → p ∈ C.1 := fun {C t} h ↦ + h ▸ cuffPoint_mem _ t + have hC : ∀ {C C' : cuffs S₁}, p ∈ C.1 → p ∈ C'.1 → C = C' := fun {C C'} h h' ↦ by + by_contra hne + exact disjoint_left.mp (cuffs_disjoint' hne) h h' + have h12 : C₁ = C₂ := hC (hc₁.elim hm hm) (hc₂.elim hm hm) + have h13 : C₁ = C₃ := hC (hc₁.elim hm hm) (hc₃.elim hm hm) + subst h12 + subst h13 + rcases hc₁ with hc₁ | hc₁ <;> rcases hc₂ with hc₂ | hc₂ + · exact absurd (arcOf_eq_of_left _ hab₁ hab₂ hd₁ hd₂ hb₁ hb₂ (hc₁.symm.trans hc₂)) hne + · rcases hc₃ with hc₃ | hc₃ + · exact .inl (arcOf_eq_of_left _ hab₃ hab₁ hd₃ hd₁ hb₃ hb₁ (hc₃.symm.trans hc₁)) + · exact .inr (arcOf_eq_of_right _ hab₃ hab₂ hd₃ hd₂ ha₃ ha₂ (hc₃.symm.trans hc₂)) + · rcases hc₃ with hc₃ | hc₃ + · exact .inr (arcOf_eq_of_left _ hab₃ hab₂ hd₃ hd₂ hb₃ hb₂ (hc₃.symm.trans hc₂)) + · exact .inl (arcOf_eq_of_right _ hab₃ hab₁ hd₃ hd₁ ha₃ ha₁ (hc₃.symm.trans hc₁)) + · exact absurd (arcOf_eq_of_right _ hab₁ hab₂ hd₁ hd₂ ha₁ ha₂ (hc₁.symm.trans hc₂)) hne + +omit [T2Space S] in +/-- A boundary point is a limit of interior points, and near it the interior is connected. -/ +theorem isConnectedNear_compl_bd {x : S} (hx : IsManifoldPoint x) (hb : x ∈ bd S) : + IsConnectedNear (bd S)ᶜ x ∧ x ∈ closure (bd S)ᶜ := by + obtain ⟨U, O, j, k, hU, hO, hxU, hj, hk, hm, hk', hl, hr⟩ := hx.exists_chart + have hjx := hm hxU + have hk0 : k (j x) = x := hl hxU + have hH : ∀ {z : ℂ}, z ∈ {z : ℂ | 0 < z.re} → z ∈ halfPlane := fun {z} h ↦ + le_of_lt (show 0 < z.re from h) + have hint : ∀ y ∈ U, IsInteriorPoint y ↔ 0 < (j y).re := fun y hy ↦ by + constructor + · intro hi + exact lt_of_le_of_ne (hm hy).2 fun h ↦ + not_isInteriorPoint_of_chart hU hj hm hl.injOn hy h.symm hi + · exact isInteriorPoint_of_chart hU hO hj hk hm hk' hl hr hy + have hre : (j x).re = 0 := le_antisymm (not_lt.mp fun h ↦ hb ((hint x hxU).mpr h)) hjx.2 + have hkey : ∀ W ∈ 𝓝 x, ∃ ρ > 0, Metric.ball (j x) ρ ⊆ O ∧ + k '' (Metric.ball (j x) ρ ∩ {z | 0 < z.re}) ⊆ W := by + intro W hW + have hc : ContinuousWithinAt k (O ∩ halfPlane) (j x) := hk _ hjx + have hpre : k ⁻¹' W ∈ 𝓝[O ∩ halfPlane] j x := hc.preimage_mem_nhdsWithin (by rwa [hk0]) + obtain ⟨ρ₁, h₁, hsub₁⟩ := Metric.mem_nhdsWithin_iff.mp hpre + obtain ⟨ρ₂, h₂, hsub₂⟩ := Metric.isOpen_iff.mp hO _ hjx.1 + refine ⟨min ρ₁ ρ₂, lt_min h₁ h₂, (Metric.ball_subset_ball (min_le_right _ _)).trans hsub₂, ?_⟩ + rintro _ ⟨z, ⟨hz, hzr⟩, rfl⟩ + have hzO : z ∈ O := hsub₂ (Metric.ball_subset_ball (min_le_right _ _) hz) + exact hsub₁ ⟨Metric.ball_subset_ball (min_le_left _ _) hz, hzO, hH hzr⟩ + have hkint : ∀ {ρ : ℝ}, Metric.ball (j x) ρ ⊆ O → ∀ {z}, z ∈ Metric.ball (j x) ρ ∩ {z | 0 < z.re} + → k z ∉ bd S := by + intro ρ hρ z hz hbz + have hzH : z ∈ O ∩ halfPlane := ⟨hρ hz.1, hH hz.2⟩ + refine hbz ((hint _ (hk' hzH)).mpr ?_) + rw [hr hzH] + exact hz.2 + constructor + · intro W hW + obtain ⟨ρ, hρ, hsubO, hsubW⟩ := hkey W hW + refine ⟨k '' (Metric.ball (j x) ρ ∩ {z | 0 < z.re}), ?_, ?_, U ∩ j ⁻¹' Metric.ball (j x) ρ, + ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact ⟨hkint hsubO hz, hsubW (mem_image_of_mem k hz)⟩ + · have hconv : Convex ℝ (Metric.ball (j x) ρ ∩ {z | 0 < z.re}) := + (convex_ball _ _).inter (convex_halfSpace_re_gt 0) + exact hconv.isPreconnected.image _ (hk.mono fun z hz ↦ ⟨hsubO hz.1, hH hz.2⟩) + · exact (hj.isOpen_inter_preimage hU Metric.isOpen_ball).mem_nhds ⟨hxU, Metric.mem_ball_self hρ⟩ + · rintro y ⟨hyb, hyU, hyB⟩ + have hi : IsInteriorPoint y := not_not.mp hyb + exact ⟨j y, ⟨hyB, (hint y hyU).mp hi⟩, hl hyU⟩ + · rw [mem_closure_iff_nhds] + intro W hW + obtain ⟨ρ, hρ, hsubO, hsubW⟩ := hkey W hW + have hz : j x + ((ρ / 2 : ℝ) : ℂ) ∈ Metric.ball (j x) ρ ∩ {z | 0 < z.re} := by + refine ⟨?_, ?_⟩ + · rw [Metric.mem_ball, dist_eq_norm, add_sub_cancel_left, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (half_pos hρ)] + exact half_lt_self hρ + · simp [hre, hρ] + exact ⟨k _, hsubW (mem_image_of_mem k hz), hkint hsubO hz⟩ + +/-- Two connected parts of a line that come near one end of the line meet. -/ +theorem nonempty_inter_of_end {L A B : Set S} {u v : S} (hL : IsLineWithEnds L u v) + (hA : A ⊆ L \ {u}) + (hB : B ⊆ L \ {u}) (hAc : IsPreconnected A) (hBc : IsPreconnected B) (huA : u ∈ closure A) + (huB : u ∈ closure B) (hAn : A.Nonempty) (hBn : B.Nonempty) : (A ∩ B).Nonempty := by + obtain ⟨f, hf0, -⟩ := id hL + let g : unitInterval → S := fun t ↦ (f t).1 + have hgc : Continuous g := continuous_subtype_val.comp f.continuous + have hgi : Function.Injective g := fun a b he ↦ f.injective (Subtype.ext he) + have hgr : range g = L := by + ext z + constructor + · rintro ⟨t, rfl⟩ + exact (f t).2 + · intro hz + exact ⟨f.symm ⟨z, hz⟩, by simp [g]⟩ + have hclosed : IsClosedMap g := hgc.isClosedMap + have hemb : IsEmbedding g := (hgc.isClosedEmbedding hgi).isEmbedding + have key : ∀ {X : Set S}, X ⊆ L \ {u} → IsPreconnected X → u ∈ closure X → X.Nonempty → + ∃ X' : Set unitInterval, g '' X' = X ∧ X'.OrdConnected ∧ (∀ t ∈ X', t ≠ 0) ∧ + (∀ m, 0 < m → ∃ t ∈ X', t < m) ∧ X'.Nonempty := by + intro X hX hXc hu hXn + have hsubr : X ⊆ range g := fun z hz ↦ hgr ▸ (hX hz).1 + have him : g '' (g ⁻¹' X) = X := image_preimage_eq_of_subset hsubr + have hpre : IsPreconnected (g ⁻¹' X) := by + rw [← hemb.isInducing.isPreconnected_image, him] + exact hXc + have h0 : (0 : unitInterval) ∈ closure (g ⁻¹' X) := by + have hu' : u ∈ g '' closure (g ⁻¹' X) := by + rw [← hclosed.closure_image_eq_of_continuous hgc, him] + exact hu + obtain ⟨t, ht, hgt⟩ := hu' + have : t = 0 := hgi (hgt.trans hf0.symm) + exact this ▸ ht + refine ⟨g ⁻¹' X, him, hpre.ordConnected, ?_, ?_, ?_⟩ + · rintro t ht rfl + exact (hX ht).2 hf0 + · intro m hm + obtain ⟨t, htm, ht⟩ := mem_closure_iff_nhds.mp h0 _ (Iio_mem_nhds hm) + exact ⟨t, ht, htm⟩ + · obtain ⟨z, hz⟩ := hXn + obtain ⟨t, rfl⟩ := hsubr hz + exact ⟨t, hz⟩ + obtain ⟨A', rfl, hAo, hA0, hAl, a, ha⟩ := key hA hAc huA hAn + obtain ⟨B', rfl, hBo, hB0, hBl, b, hb⟩ := key hB hBc huB hBn + have hm0 : 0 < min a b := lt_min (unitInterval.pos_iff_ne_zero.mpr (hA0 a ha)) + (unitInterval.pos_iff_ne_zero.mpr (hB0 b hb)) + obtain ⟨a', ha', ha'm⟩ := hAl _ hm0 + obtain ⟨b', hb', hb'm⟩ := hBl _ hm0 + have h₁ : min a b ∈ A' := hAo.out ha' ha ⟨ha'm.le, min_le_left _ _⟩ + have h₂ : min a b ∈ B' := hBo.out hb' hb ⟨hb'm.le, min_le_right _ _⟩ + exact ⟨g (min a b), mem_image_of_mem g h₁, mem_image_of_mem g h₂⟩ + +namespace FrameData + +variable {Φ : Frame S} {Γ : Painting S} {K : Drawing S} {ψ : S₁ → S} (D : FrameData Φ Γ K ψ) +include D + +omit [T2Space S] [T2Space S₁] in +/-- A side of the frame of the fragment maps into a side of `Φ` or into an edge of `K`. -/ +theorem image_side {R : Set S₁} (hR : R ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ)) : + (∃ s ∈ Φ.sides, ψ '' R ⊆ s) ∨ ∃ e ∈ arcComponentsIn (K.U \ K.V), ψ '' R ⊆ e := by + have hc : Continuous ψ := D.pull.frag.continuous_ψ + have hS : IsSurface S := D.pull.surface + have hbd : IsClosed (bd S) := (cuff_statement S hS).1 + have hIc : IsPathConnected (ψ '' R) := hR.2.2.1.image hc + have hoff : ∀ {x}, x ∈ R → ψ x ∉ Φ.V ∪ K.V := fun hx ↦ (hR.2.1 hx).2 + have hcov : ψ '' R ⊆ bd S ∪ K.U := by + rintro _ ⟨x, hx, rfl⟩ + exact D.pull.frag.maps_bd (mem_image_of_mem ψ (hR.2.1 hx).1) + by_cases hb : ψ '' R ⊆ bd S + · refine Or.inl ?_ + obtain ⟨s, hs, hsub⟩ := exists_arcComp_superset hIc (F := bd S \ Φ.V) (by + rintro _ ⟨x, hx, rfl⟩ + exact ⟨hb (mem_image_of_mem ψ hx), fun hv ↦ hoff hx (Or.inl hv)⟩) + exact ⟨s, hs, hsub⟩ + have hKsub : ψ '' R ⊆ K.U := by + obtain ⟨_, ⟨u, hu, rfl⟩, hub⟩ := not_subset.mp hb + by_contra hk + obtain ⟨_, ⟨v, hv, rfl⟩, hvk⟩ := not_subset.mp hk + obtain ⟨z, ⟨x, hx, rfl⟩, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp + hIc.isConnected.isPreconnected + (bd S) K.U hbd K.isClosed_U hcov + ⟨ψ v, mem_image_of_mem ψ hv, (hcov (mem_image_of_mem ψ hv)).resolve_right hvk⟩ + ⟨ψ u, mem_image_of_mem ψ hu, (hcov (mem_image_of_mem ψ hu)).resolve_left hub⟩ + exact hoff hx (Or.inr (D.K_bd ⟨hz₂, hz₁⟩)) + refine Or.inr ?_ + obtain ⟨e, he, hsub⟩ := exists_arcComp_superset hIc (F := K.U \ K.V) (by + rintro _ ⟨x, hx, rfl⟩ + exact ⟨hKsub (mem_image_of_mem ψ hx), fun hv ↦ hoff hx (Or.inr hv)⟩) + exact ⟨e, he, hsub⟩ + +omit [T2Space S] [T2Space S₁] in +/-- A short side of the frame of the fragment has no vertex of `Γ₁`: it maps into a short side of +`Φ`, which is +an edge of `Γ`, or into an edge of `K`, which meets `Γ` in no point. So it is a component of `bd(Σ₁) +\ V₁`. -/ +theorem mem_arcComponents_of_short {R : Set S₁} (hR : R ∈ arcComponentsIn + (bd S₁ \ pullFrameV Φ K ψ)) + (hshort : ¬ ∃ s ∈ Φ.longSides, ψ '' R ⊆ s) : R ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ) := by + have hoffΓ : ∀ x ∈ R, ψ x ∉ Γ.V := by + intro x hx hxV + rcases D.image_side hR with ⟨s, hs, hsub⟩ | ⟨e, he, hsub⟩ + · have hsh : s ∈ Φ.shortSides := ⟨hs, fun hl ↦ hshort ⟨s, ⟨hs, hl⟩, hsub⟩⟩ + have hsE : s ∈ Γ.E := D.fits.short_sides hsh + exact Γ.disjoint_V hsE (hsub (mem_image_of_mem ψ hx)) hxV + · have hk := (he.2.1 (hsub (mem_image_of_mem ψ hx))) + exact hk.2 (D.pull.inter ⟨Γ.V_subset hxV, hk.1⟩).2 + have hsub : R ⊆ bd S₁ \ pullV Γ K ψ := by + intro x hx + refine ⟨(hR.2.1 hx).1, ?_⟩ + rintro (hv | hv) + · exact hoffΓ x hx hv + · exact (hR.2.1 hx).2 (Or.inr hv) + exact ⟨hR.1, hsub, hR.2.2.1, fun X hX hXc hRX ↦ + hR.2.2.2 X (hX.trans (sdiff_subset_sdiff_right D.pullFrameV_subset)) hXc hRX⟩ + +end FrameData + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5e.lean b/LeanPool/GraphMinor/GM19/Section5e.lean new file mode 100644 index 0000000000..26dcca2299 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5e.lean @@ -0,0 +1,310 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5d + +/-! +# Graph Minors XIX, (5.3): how a fragment looks near its boundary + +Let `x` be a boundary point of a fragment such that the boundary near `x` maps into `bd(Σ)`. The +fragment near +`x` then fills all of `Σ` near `ψ(x)`. From this we get what the paper leaves out: distinct points +of the boundary +over `bd(Σ)` have distinct images, and an end of an edge of `K` is not such a point `ψ(x)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S S₁ : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace S₁] [T2Space S₁] + + +namespace IsCuttingFragment + +variable {K : Drawing S} {ψ : S₁ → S} (h : IsCuttingFragment S K S₁ ψ) +include h + +/-- The image of the part of a neighbourhood of a boundary point `x` off the boundary contains all +of `Σ \ bd(Σ)` +near `ψ(x)`, if the neighbourhood meets `bd(Σ₁)` only over `bd(Σ)` and meets the fibre of `ψ(x)` +only in `x`. +The image of an open set is open. It is also closed in a small connected piece of `Σ \ bd(Σ)` at +`ψ(x)`, since a +limit point comes from the closure of the open set and by assumption not from its frontier or +`bd(Σ₁)`. -/ +theorem local_fill (hS : IsSurface S) {x : S₁} (hx : x ∈ bd S₁) (hxb : ψ x ∈ bd S) {W₁ : Set S₁} + (hW₁ : W₁ ∈ 𝓝 x) (hbd : ∀ z ∈ W₁, z ∈ bd S₁ → ψ z ∈ bd S) (hfib : ∀ z ∈ W₁, ψ z = ψ x → z = x) : + ∃ N ∈ 𝓝 (ψ x), (bd S)ᶜ ∩ N ⊆ ψ '' (W₁ \ bd S₁) := by + have hS₁ : IsSurface S₁ := h.isSurface + have : CompactSpace S₁ := hS₁.1 + have hclosed : IsClosedMap ψ := h.isClosedMap + have hc : Continuous ψ := h.continuous_ψ + have hbS₁ : IsClosed (bd S₁) := (cuff_statement S₁ hS₁).1 + obtain ⟨W₂, hW₂, hW₂c, hW₂s⟩ := exists_mem_nhds_isClosed_subset hW₁ + let W' := interior W₂ + have hW'o : IsOpen W' := isOpen_interior + have hxW' : x ∈ W' := mem_interior_iff_mem_nhds.mpr hW₂ + have hclW' : closure W' ⊆ W₂ := closure_minimal interior_subset hW₂c + have hfrC : IsClosed (ψ '' frontier W') := hclosed _ isClosed_frontier + have hxfr : ψ x ∉ ψ '' frontier W' := by + rintro ⟨z, hz, hzx⟩ + have hzW : z ∈ W₁ := hW₂s (hclW' hz.1) + rw [hfib z hzW hzx] at hz + exact hz.2 (by rw [hW'o.interior_eq]; exact hxW') + obtain ⟨B, hBsub, hBc, N, hN, hNB⟩ := (isConnectedNear_compl_bd (hS.2.2 (ψ x)) hxb).1 _ + (hfrC.isOpen_compl.mem_nhds hxfr) + have hO : IsOpen (ψ '' (W' ∩ (bd S₁)ᶜ)) := + h.isOpen_image (h.isOpen_R hS K.isClosed_U) inter_subset_right (hW'o.inter hbS₁.isOpen_compl) + have hsub : B ⊆ ψ '' (W' ∩ (bd S₁)ᶜ) ∪ (closure (ψ '' (W' ∩ (bd S₁)ᶜ)))ᶜ := by + intro y hy + by_cases hyc : y ∈ closure (ψ '' (W' ∩ (bd S₁)ᶜ)) + · refine Or.inl ?_ + rw [hclosed.closure_image_eq_of_continuous hc] at hyc + obtain ⟨z, hz, rfl⟩ := hyc + have hzcl : z ∈ closure W' := closure_mono inter_subset_left hz + have hzW : z ∈ W' := by + by_contra hzn + exact (hBsub hy).2 ⟨z, ⟨hzcl, by rwa [hW'o.interior_eq]⟩, rfl⟩ + refine ⟨z, ⟨hzW, fun hzb ↦ ?_⟩, rfl⟩ + exact (hBsub hy).1 (hbd z (hW₂s (interior_subset hzW)) hzb) + · exact Or.inr hyc + have hne : (B ∩ ψ '' (W' ∩ (bd S₁)ᶜ)).Nonempty := by + have hnb := Filter.inter_mem (hW'o.mem_nhds hxW') (hc.continuousAt.preimage_mem_nhds hN) + obtain ⟨z, hzn, hzb⟩ := mem_closure_iff_nhds.mp (isConnectedNear_compl_bd + (hS₁.2.2 x) hx).2 _ hnb + have hzo : ψ z ∉ bd S ∪ K.U := disjoint_left.mp h.maps_interior_disjoint + (mem_image_of_mem ψ hzb) + exact ⟨ψ z, hNB ⟨fun hb ↦ hzo (Or.inl hb), hzn.2⟩, mem_image_of_mem ψ ⟨hzn.1, hzb⟩⟩ + have hBO := hBc.subset_left_of_subset_union hO isClosed_closure.isOpen_compl + (disjoint_left.mpr fun _ hy hy' ↦ hy' (subset_closure hy)) hsub hne + refine ⟨N, hN, fun y hy ↦ ?_⟩ + obtain ⟨z, hz, rfl⟩ := hBO (hNB hy) + exact ⟨z, ⟨hW₂s (interior_subset hz.1), hz.2⟩, rfl⟩ + +omit [T2Space S] in +/-- Shrink a neighbourhood so that it meets the fibre of `ψ(x)` only in `x`. -/ +theorem exists_nhds_fibre (x : S₁) {W : Set S₁} (hW : W ∈ 𝓝 x) : + ∃ W' ∈ 𝓝 x, W' ⊆ W ∧ ∀ z ∈ W', ψ z = ψ x → z = x := by + have hfin : ((ψ ⁻¹' {ψ x}) \ {x}).Finite := (h.finite_fibres (ψ x)).subset sdiff_subset + refine ⟨W ∩ ((ψ ⁻¹' {ψ x}) \ {x})ᶜ, Filter.inter_mem hW (hfin.isClosed.isOpen_compl.mem_nhds + fun hx ↦ hx.2 rfl), inter_subset_left, fun z hz hzx ↦ ?_⟩ + by_contra hne + exact hz.2 ⟨hzx, hne⟩ + +/-- Two points of `bd(Σ₁)` that lie over the same point, near which `bd(Σ₁)` maps into `bd(Σ)`, are +equal. Each +fills `Σ` near the point, and `ψ` is one-to-one off the boundary. -/ +theorem eq_of_image_eq (hS : IsSurface S) {x₁ x₂ : S₁} (hx₁ : x₁ ∈ bd S₁) (hx₂ : x₂ ∈ bd S₁) + (hb : ψ x₁ ∈ bd S) {W₁ W₂ : Set S₁} (hW₁ : W₁ ∈ 𝓝 x₁) (hW₂ : W₂ ∈ 𝓝 x₂) + (hb₁ : ∀ z ∈ W₁, z ∈ bd S₁ → ψ z ∈ bd S) (hb₂ : ∀ z ∈ W₂, z ∈ bd S₁ → ψ z ∈ bd S) (heq : ψ x₁ + = ψ x₂) : + x₁ = x₂ := by + by_contra hne + obtain ⟨u, v, hu, hv, hxu, hxv, huv⟩ := t2_separation hne + obtain ⟨A₁, hA₁, hA₁s, hf₁⟩ := h.exists_nhds_fibre x₁ (Filter.inter_mem hW₁ (hu.mem_nhds hxu)) + obtain ⟨A₂, hA₂, hA₂s, hf₂⟩ := h.exists_nhds_fibre x₂ (Filter.inter_mem hW₂ (hv.mem_nhds hxv)) + obtain ⟨N₁, hN₁, hs₁⟩ := h.local_fill hS hx₁ hb hA₁ (fun z hz ↦ hb₁ z (hA₁s hz).1) hf₁ + obtain ⟨N₂, hN₂, hs₂⟩ := h.local_fill hS hx₂ (heq ▸ hb) hA₂ (fun z hz ↦ hb₂ z (hA₂s hz).1) hf₂ + rw [← heq] at hN₂ + obtain ⟨w, hwN, hwb⟩ := mem_closure_iff_nhds.mp (isConnectedNear_compl_bd (hS.2.2 (ψ x₁)) hb).2 _ + (Filter.inter_mem hN₁ hN₂) + obtain ⟨z₁, hz₁, rfl⟩ := hs₁ ⟨hwb, hwN.1⟩ + obtain ⟨z₂, hz₂, hzz⟩ := hs₂ ⟨hwb, hwN.2⟩ + have hzeq : z₂ = z₁ := h.injOn_interior hz₂.2 hz₁.2 hzz + exact disjoint_left.mp huv (hA₁s hz₁.1).2 (hzeq ▸ (hA₂s hz₂.1).2) + +/-- If `bd(Σ₁)` near `x` maps into `bd(Σ)` then `ψ(x)` is not a limit of a set in `U(K)` off +`bd(Σ)`. -/ +theorem notMem_closure_of_fill (hS : IsSurface S) {x : S₁} (hx : x ∈ bd S₁) + (hxb : ψ x ∈ bd S) {W : Set S₁} + (hW : W ∈ 𝓝 x) (hb : ∀ z ∈ W, z ∈ bd S₁ → ψ z ∈ bd S) {e : Set S} (he : e ⊆ K.U) + (hed : Disjoint e (bd S)) : ψ x ∉ closure e := by + intro hcl + obtain ⟨A, hA, hAs, hf⟩ := h.exists_nhds_fibre x hW + obtain ⟨N, hN, hs⟩ := h.local_fill hS hx hxb hA (fun z hz ↦ hb z (hAs hz)) hf + obtain ⟨y, hyN, hye⟩ := mem_closure_iff_nhds.mp hcl N hN + obtain ⟨z, hz, rfl⟩ := hs ⟨fun hyb ↦ disjoint_left.mp hed hye hyb, hyN⟩ + exact disjoint_left.mp h.maps_interior_disjoint (mem_image_of_mem ψ hz.2) (Or.inr (he hye)) + +end IsCuttingFragment + +/-- Near a boundary point `x`, the boundary consists of `x` and points of arcs that have `x` in +their closure. +There are finitely many arcs, so the arcs with `x` outside their closure stay away from `x`. -/ +theorem exists_nhds_arcs (hS : IsSurface S₁) {N : Set S₁} (hN : N.Finite) + (h2 : ∀ C : cuffs S₁, ∃ p ∈ N ∩ C.1, ∃ q ∈ N ∩ C.1, p ≠ q) (x : S₁) : + ∃ W ∈ 𝓝 x, ∀ z ∈ W, z ∈ bd S₁ → z = x ∨ ∃ R ∈ arcComponentsIn (bd S₁ \ N), z ∈ R + ∧ x ∈ closure R := by + have hfin := finite_arcComponentsIn_bd hS hN h2 + let F : Set S₁ := (N \ {x}) ∪ ⋃₀ (closure '' {R ∈ arcComponentsIn (bd S₁ \ N) | x ∉ closure R}) + have hFc : IsClosed F := by + refine ((hN.subset sdiff_subset).isClosed).union (Set.Finite.isClosed_sUnion + ((hfin.subset (sep_subset _ _)).image _) ?_) + rintro _ ⟨R, -, rfl⟩ + exact isClosed_closure + have hxF : x ∉ F := by + rintro (hx | ⟨_, ⟨R, hR, rfl⟩, hx⟩) + · exact hx.2 rfl + · exact hR.2 hx + refine ⟨Fᶜ, hFc.isOpen_compl.mem_nhds hxF, fun z hz hzb ↦ ?_⟩ + by_cases hzx : z = x + · exact Or.inl hzx + refine Or.inr ?_ + have hzN : z ∉ N := fun hn ↦ hz (Or.inl ⟨hn, hzx⟩) + obtain ⟨R, hR, hsub⟩ := exists_arcComp_superset (isPathConnected_singleton z) (F := bd S₁ \ N) + (singleton_subset_iff.mpr ⟨hzb, hzN⟩) + have hzR : z ∈ R := hsub rfl + refine ⟨R, hR, hzR, ?_⟩ + by_contra hxR + exact hz (Or.inr ⟨_, ⟨R, ⟨hR, hxR⟩, rfl⟩, subset_closure hzR⟩) + +/-- The ends of an arc of `bd(Σ₁) \ N` lie in `N`, so a point of its closure off `N` is on the arc. +-/ +theorem mem_of_mem_closure_arc (hS : IsSurface S₁) {N : Set S₁} (hN : N.Finite) + (h2 : ∀ C : cuffs S₁, ∃ p ∈ N ∩ C.1, ∃ q ∈ N ∩ C.1, p ≠ q) {R : Set S₁} + (hR : R ∈ arcComponentsIn (bd S₁ \ N)) {x : S₁} (hx : x ∈ closure R) (hxN : x ∉ N) : x ∈ R := by + by_contra hxR + obtain ⟨C, a, b, hab, hub, rfl, -, ha, hb⟩ := exists_arc_of_mem hS (cuffPar hS) hN h2 hR + have ht : x ∈ tilde (arcOf (cuffPar hS C) a b) := ⟨hx, hxR⟩ + rw [tilde_arcOf _ hab hub] at ht + rcases ht with rfl | rfl + · exact hxN ha + · exact hxN hb + +/-- A line has a homeomorphism to `[0, 1]` with one end first. -/ +theorem Frame.exists_line {T : Type} [TopologicalSpace T] [T2Space T] (Φ : Frame T) {s : Set T} + (hs : s ∈ arcComponentsIn (bd T \ Φ.V)) {v : T} (hv : v ∈ tilde s) : + ∃ w, v ≠ w ∧ tilde s = {v, w} ∧ IsLineWithEnds (closure s) v w := by + obtain ⟨hn, -, ⟨f⟩, he⟩ := Φ.side_shape s hs + have hL : IsLineWithEnds (closure s) (f 0).1 (f 1).1 := ⟨f, rfl, rfl⟩ + have ht : tilde s = {(f 0).1, (f 1).1} := by rw [← he]; exact (GM20.line_facts hL).2.2.2 + have hne := (GM20.line_facts hL).1 + rw [ht] at hv + rcases hv with rfl | rfl + · exact ⟨_, hne, ht, hL⟩ + · exact ⟨_, hne.symm, by rw [ht, pair_comm], hL.symm⟩ + +namespace FrameData + +variable {Φ : Frame S} {Γ : Painting S} {K : Drawing S} {ψ : S₁ → S} (D : FrameData Φ Γ K ψ) +include D + +omit [T2Space S] in +/-- Points of a side of the fragment map to `bd(Σ)` if the side lies over a side of `Φ`, and near a +point of such +a side the boundary is the side. -/ +theorem exists_nhds_of_mem {R : Set S₁} (hR : R ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ)) + {s : Set S} (hs : s ∈ Φ.sides) (hsub : ψ '' R ⊆ s) {x : S₁} (hx : x ∈ R) : + ∃ W ∈ 𝓝 x, ∀ z ∈ W, z ∈ bd S₁ → ψ z ∈ bd S := by + have hS₁ := D.pull.frag.isSurface + obtain ⟨W, hW, hWs⟩ := exists_nhds_arcs hS₁ D.finite_pullFrameV D.two x + have hbd : ∀ {z}, z ∈ R → ψ z ∈ bd S := fun hz ↦ (hs.2.1 (hsub (mem_image_of_mem ψ hz))).1 + refine ⟨W, hW, fun z hz hzb ↦ ?_⟩ + rcases hWs z hz hzb with rfl | ⟨R', hR', hzR', hxc⟩ + · exact hbd hx + · have hxR' := mem_of_mem_closure_arc hS₁ D.finite_pullFrameV D.two hR' hxc (hR.2.1 hx).2 + rw [arcComp_eq_of_mem hR' hR hxR' hx] at hzR' + exact hbd hzR' + +/-- `ψ` is one-to-one on a side of the fragment over a side of `Φ`. -/ +theorem injOn_side {R₁ R₂ : Set S₁} (hR₁ : R₁ ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ)) + (hR₂ : R₂ ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ)) {s₁ s₂ : Set S} (hs₁ : s₁ ∈ Φ.sides) + (hs₂ : s₂ ∈ Φ.sides) (hsub₁ : ψ '' R₁ ⊆ s₁) (hsub₂ : ψ '' R₂ ⊆ s₂) {x₁ x₂ : S₁} (hx₁ : x₁ ∈ R₁) + (hx₂ : x₂ ∈ R₂) (heq : ψ x₁ = ψ x₂) : x₁ = x₂ := by + obtain ⟨W₁, hW₁, hb₁⟩ := D.exists_nhds_of_mem hR₁ hs₁ hsub₁ hx₁ + obtain ⟨W₂, hW₂, hb₂⟩ := D.exists_nhds_of_mem hR₂ hs₂ hsub₂ hx₂ + exact D.pull.frag.eq_of_image_eq D.pull.surface (hR₁.2.1 hx₁).1 (hR₂.2.1 hx₂).1 + (hs₁.2.1 (hsub₁ (mem_image_of_mem ψ hx₁))).1 hW₁ hW₂ hb₁ hb₂ heq + +omit [T2Space S] in +/-- A short check that every side has both ends in `pullFrameV`. -/ +theorem tilde_subset {R : Set S₁} (hR : R ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ)) : + tilde R ⊆ pullFrameV Φ K ψ := by + obtain ⟨C, a, b, hab, hub, rfl, -, ha, hb⟩ := + exists_arc_of_mem D.pull.frag.isSurface (cuffPar D.pull.frag.isSurface) D.finite_pullFrameV + D.two hR + rw [tilde_arcOf _ hab hub] + rintro _ (rfl | rfl) + · exact ha + · exact hb + +/-- **No two long sides of the frame of a fragment have a common end** (Graph Minors XIX, (5.3)). +Suppose two long +sides end at `p`. The boundary near `p` is those sides and `p`, so it maps into `bd(Σ)`. Hence +`ψ(p)` is no end of an +edge of `K`, and so is no vertex of `K`, since `K` has no isolated vertex. So `ψ(p)` is an end of +both sides of +`Φ`. They are one side `s`, since no two long sides of `Φ` have a common end. Both sides of the +fragment map one-to-one +into `s` near the same end, so they meet, and this is impossible. -/ +theorem long_disjoint (hF : IsFeature Φ K) : + ∀ s₁ ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ), ∀ s₂ ∈ arcComponentsIn + (bd S₁ \ pullFrameV Φ K ψ), + s₁ ≠ s₂ → (∃ s ∈ Φ.longSides, ψ '' s₁ ⊆ s) → (∃ s ∈ Φ.longSides, ψ '' s₂ ⊆ s) → + Disjoint (tilde s₁) (tilde s₂) := by + intro R₁ hR₁ R₂ hR₂ hne ⟨s₁, hs₁, hsub₁⟩ ⟨s₂, hs₂, hsub₂⟩ + refine disjoint_left.mpr fun p hp₁ hp₂ ↦ ?_ + have hS₁ := D.pull.frag.isSurface + have hS := D.pull.surface + have hbd : IsClosed (bd S) := (cuff_statement S hS).1 + have hc := D.pull.frag.continuous_ψ + have hps : ∀ {R s : Set _}, s ∈ Φ.sides → ψ '' R ⊆ s → p ∈ tilde R → ψ p ∈ closure s + := fun hs hsub hp ↦ + image_closure_subset_closure_image hc ⟨p, hp.1, rfl⟩ |> closure_mono hsub + have hpc₁ := hps hs₁.1 hsub₁ hp₁ + have hpc₂ := hps hs₂.1 hsub₂ hp₂ + have hsb : ∀ {s : Set S}, s ∈ Φ.sides → closure s ⊆ bd S := fun hs ↦ + closure_minimal (fun z hz ↦ (hs.2.1 hz).1) hbd + have hpb := hsb hs₁.1 hpc₁ + have hpb' : p ∈ bd S₁ := by + have := (D.pullFrameV_subset_bd (D.tilde_subset hR₁ hp₁)) + exact this + -- the boundary near `p` + obtain ⟨W, hW, hWs⟩ := exists_nhds_arcs hS₁ D.finite_pullFrameV D.two p + have hnear : ∀ z ∈ W, z ∈ bd S₁ → ψ z ∈ bd S := by + intro z hz hzb + rcases hWs z hz hzb with rfl | ⟨R, hR, hzR, hpc⟩ + · exact hpb + · have hpN : p ∉ R := fun h ↦ (hR.2.1 h).2 (D.tilde_subset hR₁ hp₁) + rcases eq_or_eq_of_mem_tilde hS₁ D.finite_pullFrameV D.two hR₁ hR₂ hR hne hp₁ hp₂ ⟨hpc, hpN⟩ + with rfl | rfl + · exact (hs₁.1.2.1 (hsub₁ (mem_image_of_mem ψ hzR))).1 + · exact (hs₂.1.2.1 (hsub₂ (mem_image_of_mem ψ hzR))).1 + have hpK : ψ p ∉ K.V := by + intro hv + obtain ⟨e, he, hve⟩ := hF.no_isolated_vertices _ hv + exact D.pull.frag.notMem_closure_of_fill hS hpb' hpb hW hnear (fun z hz ↦ (he.2.1 hz).1) + (hF.no_border_edges e he) hve.1 + have hpV : ψ p ∈ Φ.V := (D.tilde_subset hR₁ hp₁).resolve_right hpK + have ht : ∀ {s : Set S}, s ∈ Φ.sides → ψ p ∈ closure s → ψ p ∈ tilde s := fun hs hp ↦ + ⟨hp, fun hin ↦ (hs.2.1 hin).2 hpV⟩ + have hss : s₁ = s₂ := by + by_contra hssne + exact disjoint_left.mp (Φ.long_disjoint s₁ hs₁.1 s₂ hs₂.1 hssne hs₁.2 hs₂.2) (ht hs₁.1 hpc₁) + (ht hs₂.1 hpc₂) + subst hss + obtain ⟨w, -, -, hL⟩ := Φ.exists_line hs₁.1 (ht hs₁.1 hpc₁) + have hneV : ∀ {R : Set S₁}, ψ '' R ⊆ s₁ → ψ '' R ⊆ closure s₁ \ {ψ p} := fun hsub _ hy ↦ + ⟨subset_closure (hsub hy), fun h ↦ (hs₁.1.2.1 (hsub hy)).2 (h ▸ hpV)⟩ + obtain ⟨_, ⟨x₁, hx₁, rfl⟩, ⟨x₂, hx₂, hxe⟩⟩ := nonempty_inter_of_end hL (hneV hsub₁) (hneV hsub₂) + (hR₁.2.2.1.isConnected.isPreconnected.image _ hc.continuousOn) + (hR₂.2.2.1.isConnected.isPreconnected.image _ hc.continuousOn) + (image_closure_subset_closure_image hc ⟨p, hp₁.1, rfl⟩) + (image_closure_subset_closure_image hc ⟨p, hp₂.1, rfl⟩) + (hR₁.1.image ψ) (hR₂.1.image ψ) + have hxx : x₂ = x₁ := D.injOn_side hR₂ hR₁ hs₁.1 hs₁.1 hsub₂ hsub₁ hx₂ hx₁ hxe + exact hne (arcComp_eq_of_mem hR₁ hR₂ hx₁ (hxx ▸ hx₂)) + +end FrameData + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5f.lean b/LeanPool/GraphMinor/GM19/Section5f.lean new file mode 100644 index 0000000000..893e421d41 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5f.lean @@ -0,0 +1,416 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.DiscSide + +/-! +# Graph Minors XIX, (5.3): the fifth condition of "fit" + +Take an edge `e₁` of size three of `Γ₁`, a region `r₁`, and a component `f₁` of `e₁ ∩ rBar₁` whose +closure misses +`bd(Σ₁)`. The paper says that `f = ψ(f₁)` is a component of `rBar ∩ e` for a region `r` of `Γ`. This +needs that the +region next to a point of the boundary of the disc `ē` does not change along an arc, and that is +what we prove +first. The rest follows the paper. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S S₁ : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace S₁] [T2Space S₁] + + +/-- A connected set in `Θ` minus the ends of an arc of `Θ`, that meets the arc, lies in the arc. -/ +theorem subset_arcOf {Θ : Set S} (f : Circle ≃ₜ Θ) {a b : ℝ} (hab : a < b) + (hub : b < a + 2 * Real.pi) + {F : Set S} (hF : IsPreconnected F) (hFΘ : F ⊆ Θ) (ha : cuffPoint f a ∉ F) + (hb : cuffPoint f b ∉ F) + {y : S} (hyF : y ∈ F) (hyA : y ∈ arcOf f a b) : F ⊆ arcOf f a b := by + have hpi := Real.pi_pos + let T₁ : Set S := cuffPoint f '' Icc a b + let T₂ : Set S := cuffPoint f '' Icc b (a + 2 * Real.pi) + have hc : Continuous (cuffPoint f) := continuous_cuffPoint f + have hT₁ : IsClosed T₁ := (isCompact_Icc.image hc).isClosed + have hT₂ : IsClosed T₂ := (isCompact_Icc.image hc).isClosed + have hcov : F ⊆ T₁ ∪ T₂ := by + intro z hz + obtain ⟨t, ht, hzt⟩ := exists_angle_in f a ⟨z, hFΘ hz⟩ + change cuffPoint f t = z at hzt + rcases le_total t b with h | h + · exact Or.inl ⟨t, ⟨ht.1, h⟩, hzt⟩ + · exact Or.inr ⟨t, ⟨h, ht.2.le⟩, hzt⟩ + have hsubT : F ⊆ T₁ := by + intro z hz + by_contra hzn + have hzT₂ := hcov hz |>.resolve_left hzn + obtain ⟨w, hwF, ⟨t, ht, hwt⟩, ⟨t', ht', hwt'⟩⟩ := isPreconnected_closed_iff.mp hF T₁ T₂ hT₁ hT₂ + hcov + ⟨y, hyF, (by obtain ⟨t, ht, h⟩ := hyA; exact ⟨t, ⟨ht.1.le, ht.2.le⟩, h⟩)⟩ ⟨z, hz, hzT₂⟩ + obtain ⟨m, hm⟩ := cuffPoint_eq f (hwt.trans hwt'.symm) + have hm0 : (m : ℝ) * (2 * Real.pi) ≤ 0 := by linarith [ht.2, ht'.1] + have hm1 : -(2 * Real.pi) ≤ (m : ℝ) * (2 * Real.pi) := by linarith [ht.1, ht'.2] + have h₁ : (m : ℝ) ≤ 0 := by nlinarith + have h₂ : (-1 : ℝ) ≤ m := by nlinarith + have h₁' : m ≤ 0 := by exact_mod_cast h₁ + have h₂' : -1 ≤ m := by exact_mod_cast h₂ + obtain rfl | rfl : m = 0 ∨ m = -1 := by omega + · have ht1 : t = b := by + push_cast at hm + linarith [ht.2, ht'.1] + exact hb (ht1 ▸ hwt ▸ hwF) + · have ht1 : t = a := by + push_cast at hm + linarith [ht.1, ht'.2] + exact ha (ht1 ▸ hwt ▸ hwF) + intro z hz + obtain ⟨t, ht, rfl⟩ := hsubT hz + refine ⟨t, ⟨lt_of_le_of_ne ht.1 ?_, lt_of_le_of_ne ht.2 ?_⟩, rfl⟩ + · rintro rfl + exact ha hz + · rintro rfl + exact hb hz + +namespace Painting + +variable {Γ : Painting S} + +omit [T2Space S] in +/-- A point of the closure of a region off the region lies in `U(Γ)`. -/ +theorem mem_U_of_closure_region (hS : IsSurface S) {r : Set S} (hr : r ∈ Γ.regions) {z : S} + (hz : z ∈ closure r) (hzr : z ∉ r) : z ∈ Γ.U := by + have : LocallyConnectedSpace S := IsSurface.locallyConnected hS + by_contra hzU + obtain ⟨r₀, hr₀, rfl⟩ := id hr + have hopen : IsOpen (connectedComponentIn Γ.Uᶜ z) := + Γ.isClosed_U.isOpen_compl.connectedComponentIn + obtain ⟨w, hw₁, hw₂⟩ := mem_closure_iff.mp hz _ hopen (mem_connectedComponentIn hzU) + have h₁ := connectedComponentIn_eq hw₁ + have h₂ := connectedComponentIn_eq hw₂ + exact hzr (h₂.trans h₁.symm ▸ mem_connectedComponentIn hzU) + +/-- Near a point `y` of the boundary of the disc of an edge `e` of size three, the outside of the +disc is connected +and misses `U(Γ)`. -/ +theorem exists_side_nhds (hS : IsSurface S) {e : Set S} (he : e ∈ Γ.E) (h3 : (tilde e).ncard = 3) + (hb : ¬ IsBorder e) {O : Set S} (hO : IsOpen O) (heO : e ⊆ O) {y : S} (hye : y ∈ e) + (hyΘ : y ∈ discBd (closure e)) : + ∃ W, IsOpen W ∧ y ∈ W ∧ ∃ B ⊆ Γ.Uᶜ ∩ O, IsPreconnected B ∧ (closure e)ᶜ ∩ W ⊆ B := by + have hy : y ∉ bd S := fun h ↦ hb ⟨y, hye, h⟩ + let 𝓔 : Set (Set S) := closure '' {e' ∈ Γ.E | e' ≠ e} + have hfin : 𝓔.Finite := (Γ.finite_edges.subset (sep_subset _ _)).image _ + let F : Set S := Γ.V ∪ ⋃₀ 𝓔 + have hFc : IsClosed F := Γ.finite_V.isClosed.union (hfin.isClosed_sUnion (by + rintro _ ⟨c, -, rfl⟩ + exact isClosed_closure)) + have hyF : y ∉ F := by + rintro (hv | ⟨_, ⟨c, ⟨hc, hne⟩, rfl⟩, hyc⟩) + · exact Γ.disjoint_V he hye hv + · rcases Γ.closure_subset hc hyc with h | h + · exact hne (arcComp_eq_of_mem hc he h hye) + · exact Γ.disjoint_V he hye h + have hoff : ∀ x, x ∉ closure e → x ∉ F → x ∉ Γ.U := by + intro x hxe hxF hxU + have hxV : x ∉ Γ.V := fun h ↦ hxF (Or.inl h) + obtain ⟨c, hc, hsub⟩ := exists_arcComp_superset (isPathConnected_singleton x) (F := Γ.U \ Γ.V) + (singleton_subset_iff.mpr ⟨hxU, hxV⟩) + have hxc : x ∈ c := hsub rfl + refine hxF (Or.inr ⟨closure c, ⟨c, ⟨hc, fun h ↦ hxe (h ▸ subset_closure hxc)⟩, rfl⟩, + subset_closure hxc⟩) + obtain ⟨B, hBs, hBc, W', hW', hsub⟩ := (isConnectedNear_compl_disc hS + (Γ.isDisc_of_three he h3).1 hyΘ hy).1 + (Fᶜ ∩ O) (hFc.isOpen_compl.inter hO |>.mem_nhds ⟨hyF, heO hye⟩) + refine ⟨interior W', isOpen_interior, mem_interior_iff_mem_nhds.mpr hW', B, ?_, hBc, ?_⟩ + · intro x hx + obtain ⟨h₁, h₂, h₃⟩ := hBs hx + exact ⟨hoff x h₁ h₂, h₃⟩ + · exact fun x hx ↦ hsub ⟨hx.1, interior_subset hx.2⟩ + +omit [T2Space S] in +/-- A point of an edge of size three in the closure of a region is on the boundary of the disc. -/ +theorem mem_discBd_of_closure_region (hS : IsSurface S) {e r : Set S} (he : e ∈ Γ.E) + (h3 : (tilde e).ncard = 3) (hr : r ⊆ Γ.Uᶜ) {y : S} (hye : y ∈ closure e) (hyr : y ∈ closure r) : + y ∈ discBd (closure e) := by + by_contra hn + have hop := (Γ.isDisc_of_three he h3).1.isOpen_discInt hS.2.2 + obtain ⟨x, hx₁, hx₂⟩ := mem_closure_iff.mp hyr _ hop ⟨hye, hn⟩ + exact hr hx₂ (Γ.closure_subset_U he hx₁.1) + +end Painting + +variable {Γ : Painting S} {K : Drawing S} {ψ : S₁ → S} + +namespace PullData + +variable (d : PullData Γ K ψ) +include d + +omit [T2Space S₁] in +/-- A connected part of `R \ U(Γ)` that meets the image of a region of `Γ₁` lies in that image. -/ +theorem subset_image_region {r₁ B : Set _} (hr₁ : r₁ ∈ componentsIn (pullU Γ ψ)ᶜ) + (hB : B ⊆ Γ.Uᶜ ∩ IsCuttingFragment.R ψ) (hBc : IsPreconnected B) (hne : + (ψ '' r₁ ∩ B).Nonempty) : + B ⊆ ψ '' r₁ := by + obtain ⟨x₀, hx₀, rfl⟩ := id hr₁ + obtain ⟨_, ⟨z, hz, rfl⟩, hzB⟩ := hne + have hB₁ : IsPreconnected (ψ ⁻¹' B) := + d.frag.isPreconnected_preimage d.isClosed_bd d.isOpen_R (fun x hx ↦ (hB hx).2) hBc + have hsub : ψ ⁻¹' B ⊆ (pullU Γ ψ)ᶜ := by + rintro x hx (hxU | hxb) + · exact (hB hx).1 hxU + · exact d.frag.mem_R_iff.mp (hB hx).2 hxb + rw [connectedComponentIn_eq hz] + have hin := hB₁.subset_connectedComponentIn hzB hsub + intro y hy + obtain ⟨x, hx, rfl⟩ := (hB hy).2 + exact mem_image_of_mem ψ (hin hy) + +omit [T2Space S₁] in +/-- The set `ψ(rBar₁)` is open in the boundary of the disc `ē`, inside `e`. This is the step the +paper leaves out: +the region next to a point of `e` does not change along the boundary of the disc. -/ +theorem exists_nhds_image_closure (hS : IsSurface S) {e r₁ : Set _} (he : e ∈ Γ.E) (h3 : + (tilde e).ncard = 3) + (hb : ¬ Painting.IsBorder e) (hR : e ⊆ IsCuttingFragment.R ψ) (hr₁ : r₁ ∈ componentsIn + (pullU Γ ψ)ᶜ) + {y : S} (hye : y ∈ e) (hyΘ : y ∈ discBd (closure e)) (hy : y ∈ ψ '' closure r₁) : + ∃ W, IsOpen W ∧ y ∈ W ∧ W ∩ e ∩ discBd (closure e) ⊆ ψ '' closure r₁ := by + obtain ⟨W, hW, hyW, B, hBs, hBc, hsub⟩ := Γ.exists_side_nhds hS he h3 hb d.isOpen_R hR hye hyΘ + obtain ⟨y₁, hy₁, rfl⟩ := hy + have hc := d.frag.continuous_ψ + obtain ⟨x₁, hx₁W, hx₁r⟩ := mem_closure_iff.mp hy₁ _ (hW.preimage hc) hyW + have hrU : r₁ ⊆ (pullU Γ ψ)ᶜ := by + obtain ⟨x₀, -, rfl⟩ := id hr₁ + exact connectedComponentIn_subset _ _ + have hxU : ψ x₁ ∉ Γ.U := fun h ↦ hrU hx₁r (Or.inl h) + have hxB : ψ x₁ ∈ B := hsub ⟨fun h ↦ hxU (Γ.closure_subset_U he h), hx₁W⟩ + have hBsub := d.subset_image_region hr₁ hBs hBc ⟨_, mem_image_of_mem ψ hx₁r, hxB⟩ + refine ⟨W, hW, hyW, fun y' hy' ↦ ?_⟩ + have hy'b : y' ∉ bd S := fun h ↦ hb ⟨y', hy'.1.2, h⟩ + have hcl := (isConnectedNear_compl_disc hS (Γ.isDisc_of_three he h3).1 hy'.2 hy'b).2 + have hcl' := hW.inter_closure ⟨hy'.1.1, hcl⟩ + have hsub' : W ∩ (closure e)ᶜ ⊆ ψ '' r₁ := fun x hx ↦ hBsub (hsub ⟨hx.2, hx.1⟩) + have h := closure_mono hsub' hcl' + rwa [d.frag.isClosedMap.closure_image_eq_of_continuous hc] at h + +omit [T2Space S₁] in +/-- The core of the fifth condition. Let `r₁` be a region of `Γ₁`, and let `y₀` be a point of `e₁ ∩ +rBar₁` whose component +in `e₁ ∩ rBar₁` has its closure off `bd(Σ₁)`. The arc of the boundary of `ē` through `ψ(y₀)` lies in +`ψ(rBar₁)`, and its ends +`v, v'` lie off `bd(Σ)` and off `U(K)`. The component of `ē ∩ rBar` through `ψ(y₀)` lies in this +arc, for the region `r` of +`Γ` that holds `ψ(r₁)`. So the fifth condition for `Γ` gives `rBar ∩ V(Γ) = {v, v'}`. Each component +of `K` has a vertex +of `Γ`, and so `U(K)` misses `rBar`. Thus each point of `rBar₁ ∩ V₁` lies over `v` or `v'`, in the +interior of `Σ₁`. -/ +theorem ncard_closure_region_le (hS : IsSurface S) (hfive : ∀ e ∈ Γ.E, (tilde e).ncard = 3 + → ∀ r ∈ Γ.regions, + 3 ≤ (closure r ∩ Γ.V).ncard → ∀ f ∈ componentsIn (e ∩ closure r), (closure f ∩ bd S).Nonempty) + (hA : IsAnchored Γ K) {e r₁ : Set _} (he : e ∈ Γ.E) (h3 : (tilde e).ncard = 3) + (hb : ¬ Painting.IsBorder e) (hR : e ⊆ IsCuttingFragment.R ψ) (hr₁ : r₁ ∈ componentsIn + (pullU Γ ψ)ᶜ) + {y₀ : S₁} (hy₀ : y₀ ∈ ψ ⁻¹' e ∩ closure r₁) + (hno : ¬ (closure (connectedComponentIn (ψ ⁻¹' e ∩ closure r₁) y₀) ∩ bd S₁).Nonempty) : + (closure r₁ ∩ pullV Γ K ψ).ncard ≤ 2 := by + have hc := d.frag.continuous_ψ + have hcl := d.frag.isClosedMap + have hinjR : ∀ {x x' : S₁}, ψ x ∈ IsCuttingFragment.R ψ → ψ x = ψ x' → x = x' + := fun {x x'} h hxx ↦ + d.frag.injOn_interior (d.frag.mem_R_iff.mp h) (d.frag.mem_R_iff.mp (hxx ▸ h)) hxx + -- the region `r` + obtain ⟨x₀, hx₀, hr₁eq⟩ := id hr₁ + let r : Set S := connectedComponentIn Γ.Uᶜ (ψ x₀) + have hrU₁ : r₁ ⊆ (pullU Γ ψ)ᶜ := hr₁eq ▸ connectedComponentIn_subset _ _ + have hx₀U : ψ x₀ ∈ Γ.Uᶜ := fun h ↦ hx₀ (Or.inl h) + have hrmem : r ∈ Γ.regions := ⟨ψ x₀, hx₀U, rfl⟩ + have hrU : r ⊆ Γ.Uᶜ := connectedComponentIn_subset _ _ + have hsubr : ψ '' r₁ ⊆ r := by + have hpc : IsPreconnected (ψ '' r₁) := + (hr₁eq ▸ isPreconnected_connectedComponentIn : IsPreconnected r₁).image _ hc.continuousOn + refine hpc.subset_connectedComponentIn ⟨x₀, hr₁eq ▸ mem_connectedComponentIn hx₀, rfl⟩ ?_ + rintro _ ⟨x, hx, rfl⟩ h + exact hrU₁ hx (Or.inl h) + have hClr : ψ '' closure r₁ ⊆ closure r := + (image_closure_subset_closure_image hc).trans (closure_mono hsubr) + -- the arc + let Δ := closure e + obtain ⟨hdisc, hTΘ, hTf⟩ := Γ.isDisc_of_three he h3 + let y := ψ y₀ + have hye : y ∈ e := hy₀.1 + have hyCl : y ∈ ψ '' closure r₁ := mem_image_of_mem ψ hy₀.2 + have hyΘ : y ∈ discBd Δ := + Γ.mem_discBd_of_closure_region hS he h3 hrU (subset_closure hye) (hClr hyCl) + have hyT : y ∉ tilde e := fun h ↦ h.2 hye + obtain ⟨φ⟩ := hdisc.isOArc_discBd + obtain ⟨p, q, w, hpq, -, -, hT⟩ := Set.ncard_eq_three.mp h3 + have hpT : p ∈ tilde e := hT ▸ mem_insert _ _ + have hqT : q ∈ tilde e := hT ▸ mem_insert_of_mem _ (mem_insert _ _) + obtain ⟨a, b, hab, hub, hyA, hdisj, haT, hbT⟩ := exists_arc_of_two φ hTf ⟨hpT, hTΘ hpT⟩ ⟨hqT, hTΘ + hqT⟩ hpq + ⟨hyΘ, hyT⟩ + let A := arcOf φ a b + let v := cuffPoint φ a + let v' := cuffPoint φ b + have hvne : v ≠ v' := (GM20.line_facts (isLine_arcOf φ hab hub)).1 + have hAΘ : A ⊆ discBd Δ := arcOf_subset φ a b + have hAe : A ⊆ e := fun x hx ↦ by + by_contra hxe + exact disjoint_left.mp hdisj hx ⟨discBd_subset _ (hAΘ hx), hxe⟩ + -- `A` lies in `ψ(rBar₁)` + have hAc : IsPreconnected A := by + rw [show A = cuffPoint φ '' Ioo a b from rfl] + exact isPreconnected_Ioo.image _ (continuous_cuffPoint φ).continuousOn + have hClc : IsClosed (ψ '' closure r₁) := hcl _ isClosed_closure + have hACl : A ⊆ ψ '' closure r₁ := by + intro x hxA + by_contra hxn + have hex : ∀ y' : ↥(A ∩ ψ '' closure r₁), ∃ W, IsOpen W ∧ y'.1 ∈ W ∧ + W ∩ e ∩ discBd (closure e) ⊆ ψ '' closure r₁ := fun y' ↦ + d.exists_nhds_image_closure hS he h3 hb hR hr₁ (hAe y'.2.1) (hAΘ y'.2.1) y'.2.2 + choose W hWo hyW hWs using hex + obtain ⟨z, hzA, hzO, hzC⟩ := hAc (⋃ y', W y') (ψ '' closure r₁)ᶜ (isOpen_iUnion hWo) + hClc.isOpen_compl + (fun z hz ↦ by + by_cases hzC : z ∈ ψ '' closure r₁ + · exact Or.inl (mem_iUnion.mpr ⟨⟨z, hz, hzC⟩, hyW _⟩) + · exact Or.inr hzC) + ⟨y, hyA, mem_iUnion.mpr ⟨⟨y, hyA, hyCl⟩, hyW _⟩⟩ ⟨x, hxA, hxn⟩ + obtain ⟨y', hzW⟩ := mem_iUnion.mp hzO + exact hzC (hWs y' ⟨⟨hzW, hAe hzA⟩, hAΘ hzA⟩) + -- lifts of the ends + have hAR : A ⊆ IsCuttingFragment.R ψ := hAe.trans hR + have hA₁c : IsPreconnected (ψ ⁻¹' A) := d.frag.isPreconnected_preimage d.isClosed_bd d.isOpen_R + hAR hAc + have hA₁sub : ψ ⁻¹' A ⊆ ψ ⁻¹' e ∩ closure r₁ := by + intro x hx + obtain ⟨x', hx', hxx⟩ := hACl hx + exact ⟨hAe hx, (hinjR (hAR hx) hxx.symm) ▸ hx'⟩ + have hA₁f := hA₁c.subset_connectedComponentIn (show y₀ ∈ ψ ⁻¹' A from hyA) hA₁sub + have hclA : closure A = cuffPoint φ '' Icc a b := closure_arcOf φ hab + have hAimg : A = ψ '' (ψ ⁻¹' A) := by + refine (image_preimage_eq_of_subset ?_).symm + exact fun x hx ↦ image_subset_range _ _ (hAR hx) + have hclsub : closure A ⊆ ψ '' closure (connectedComponentIn (ψ ⁻¹' e ∩ closure r₁) y₀) := by + conv_lhs => rw [hAimg] + rw [hcl.closure_image_eq_of_continuous hc] + exact image_mono (closure_mono hA₁f) + have hvA : v ∈ closure A := by rw [hclA]; exact ⟨a, ⟨le_rfl, hab.le⟩, rfl⟩ + have hvA' : v' ∈ closure A := by rw [hclA]; exact ⟨b, ⟨hab.le, le_rfl⟩, rfl⟩ + have hoff : ∀ {u}, u ∈ closure A → u ∉ bd S ∪ K.U := by + intro u hu hub + obtain ⟨u₁, hu₁, rfl⟩ := hclsub hu + exact hno ⟨u₁, hu₁, d.mem_bd_of_notMem_R hub⟩ + have hArcl : closure A ⊆ closure r := closure_minimal (hACl.trans hClr) isClosed_closure + have hvV : v ∈ closure r ∩ Γ.V := ⟨hArcl hvA, Γ.tilde_subset_V he haT⟩ + have hvV' : v' ∈ closure r ∩ Γ.V := ⟨hArcl hvA', Γ.tilde_subset_V he hbT⟩ + -- the fifth condition for `Γ` + have hlt : ¬ 3 ≤ (closure r ∩ Γ.V).ncard := by + intro hcard + have hf : connectedComponentIn (e ∩ closure r) y ∈ componentsIn (e ∩ closure r) := + ⟨y, ⟨hye, hClr hyCl⟩, rfl⟩ + have hfsub : connectedComponentIn (e ∩ closure r) y ⊆ e ∩ closure r + := connectedComponentIn_subset _ _ + have hFΘ : connectedComponentIn (e ∩ closure r) y ⊆ discBd Δ := fun x hx ↦ + Γ.mem_discBd_of_closure_region hS he h3 hrU (subset_closure (hfsub hx).1) (hfsub hx).2 + have hsubA := subset_arcOf φ hab hub isPreconnected_connectedComponentIn hFΘ + (fun h ↦ (hfsub h).1 |> fun hin ↦ haT.2 hin) (fun h ↦ (hfsub h).1 |> fun hin ↦ hbT.2 hin) + (mem_connectedComponentIn ⟨hye, hClr hyCl⟩) hyA + obtain ⟨z, hz, hzb⟩ := hfive e he h3 r hrmem hcard _ hf + exact hoff (closure_mono hsubA hz) (Or.inl hzb) + have hsubvv : closure r ∩ Γ.V ⊆ {v, v'} := by + rintro w₀ hw₀ + by_contra hw + have hw₁ : v ≠ w₀ := fun h ↦ hw (h ▸ mem_insert _ _) + have hw₂ : v' ≠ w₀ := fun h ↦ hw (h ▸ mem_insert_of_mem _ rfl) + have h3' : ({v, v', w₀} : Set S).ncard = 3 := Set.ncard_eq_three.mpr ⟨v, v', w₀, hvne, hw₁, + hw₂, rfl⟩ + refine hlt (h3' ▸ Set.ncard_le_ncard ?_ (Γ.finite_V.subset inter_subset_right)) + rintro _ (rfl | rfl | rfl) + · exact hvV + · exact hvV' + · exact hw₀ + have hvvK : ∀ {u}, u ∈ closure r ∩ Γ.V → u ∉ bd S ∪ K.U := by + intro u hu + rcases hsubvv hu with rfl | rfl + · exact hoff hvA + · exact hoff hvA' + -- `U(K)` misses `rBar` + have hrK : ∀ x ∈ closure r, x ∉ K.U := by + intro x hxr hxK + have hxv : x ≠ v := fun h ↦ hoff hvA (Or.inr (h ▸ hxK)) + obtain ⟨C, hCs, hxC, hCc, g, hgC, hgV⟩ := hA v x hxK hxv + by_cases hgr : g ∈ closure r + · exact hvvK ⟨hgr, hgV⟩ (Or.inr (hCs hgC).1) + · obtain ⟨z, hzC, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp hCc (closure r) (closure + (closure r)ᶜ) + isClosed_closure isClosed_closure (fun z _ ↦ by + by_cases hzr : z ∈ closure r + · exact Or.inl hzr + · exact Or.inr (subset_closure hzr)) ⟨x, hxC, hxr⟩ ⟨g, hgC, subset_closure hgr⟩ + have hrop : IsOpen r := by + have : LocallyConnectedSpace S := IsSurface.locallyConnected hS + exact Γ.isClosed_U.isOpen_compl.connectedComponentIn + have hzr : z ∉ r := fun h ↦ by + obtain ⟨w, hw₁, hw₂⟩ := mem_closure_iff.mp hz₂ _ hrop h + exact hw₂ (subset_closure hw₁) + have hzU := Painting.mem_U_of_closure_region hS hrmem hz₁ hzr + have hzV : z ∈ Γ.V := (d.inter ⟨hzU, (hCs hzC).1⟩).1 + exact hvvK ⟨hz₁, hzV⟩ (Or.inr (hCs hzC).1) + -- count + have hmap : MapsTo ψ (closure r₁ ∩ pullV Γ K ψ) {v, v'} := by + rintro x ⟨hxr, hxV | hxV⟩ + · exact hsubvv ⟨hClr (mem_image_of_mem ψ hxr), hxV⟩ + · exact absurd (K.V_subset_U hxV) (hrK _ (hClr (mem_image_of_mem ψ hxr))) + have hint : closure r₁ ∩ pullV Γ K ψ ⊆ (bd S₁)ᶜ := by + intro x hx hxb + have hv : ψ x ∈ closure r ∩ Γ.V := by + obtain ⟨hxr, hxV | hxV⟩ := hx + · exact ⟨hClr (mem_image_of_mem ψ hxr), hxV⟩ + · exact absurd (K.V_subset_U hxV) (hrK _ (hClr (mem_image_of_mem ψ hxr))) + exact hvvK hv (d.frag.maps_bd (mem_image_of_mem ψ hxb)) + have hle := Set.ncard_le_ncard_of_injOn ψ hmap (d.frag.injOn_interior.mono hint) + (toFinite _ |>.subset fun _ h ↦ h) + rwa [Set.ncard_pair hvne] at hle + +/-- **The fifth condition in the definition of "fit", for the pull-back** (Graph Minors XIX, (5.3)). +-/ +theorem size_three_region [Nonempty S₁] (hS : IsSurface S) (γb : Set S₁ → List S₁) + (hγ₁ : ∀ p ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ), (γb p).Nodup) + (hγ₂ : ∀ p ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ), {v | v ∈ γb p} = tilde p) + (hfive : ∀ e ∈ Γ.E, (tilde e).ncard = 3 → ∀ r ∈ Γ.regions, + 3 ≤ (closure r ∩ Γ.V).ncard → ∀ f ∈ componentsIn (e ∩ closure r), (closure f ∩ bd S).Nonempty) + (hA : IsAnchored Γ K) : + ∀ e₁ ∈ (pullPainting d γb hγ₁ hγ₂).E, (tilde e₁).ncard = 3 → ∀ r₁ ∈ + (pullPainting d γb hγ₁ hγ₂).regions, + 3 ≤ (closure r₁ ∩ (pullPainting d γb hγ₁ hγ₂).V).ncard → ∀ f₁ ∈ componentsIn + (e₁ ∩ closure r₁), + (closure f₁ ∩ bd S₁).Nonempty := by + intro e₁ he₁ h3 r₁ hr₁ hcard f₁ hf₁ + by_contra hne + have he₁' : e₁ ∈ arcComponentsIn (pullU Γ ψ \ pullV Γ K ψ) := he₁ + rw [d.arcComponentsIn_eq] at he₁' + rcases he₁' with hp | ⟨e, he, hb, hne', rfl⟩ + · obtain ⟨u, v, huv, ht, -⟩ := d.exists_ends hp + rw [ht, Set.ncard_pair huv] at h3 + omega + · have hsub := d.subset_R he hb hne' + obtain ⟨y₀, hy₀, rfl⟩ := id hf₁ + have hle := d.ncard_closure_region_le hS hfive hA he (by rwa [d.ncard_tilde he hsub] at h3) hb + hsub hr₁ hy₀ hne + change 3 ≤ (closure r₁ ∩ pullV Γ K ψ).ncard at hcard + omega + +end PullData + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5g.lean b/LeanPool/GraphMinor/GM19/Section5g.lean new file mode 100644 index 0000000000..2d48652279 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5g.lean @@ -0,0 +1,361 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5f + +/-! +# Graph Minors XIX, (5.3) + +We choose the direction of each side of the frame of a fragment as the paper does: `ψ` maps it onto +the direction +of the side of `Φ` below it. Then we collect the five conditions of "fit". +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S S₁ : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace S₁] [T2Space S₁] + + +/-- A continuous function on `[0, 1]` that is one-to-one on `(0, 1)` has different values at `0` and +`1`. Otherwise +it would take a value between `G(0)` and `G(t)` on both sides of a point `t`. -/ +theorem ne_of_injOn_Ioo {G : ℝ → ℝ} (hc : Continuous G) (hi : InjOn G (Ioo 0 1)) : G 0 ≠ G 1 := by + intro h + obtain ⟨t, ht, hne⟩ : ∃ t ∈ Ioo (0 : ℝ) 1, G t ≠ G 0 := by + by_contra hall + push Not at hall + have h₁ : (1 / 3 : ℝ) ∈ Ioo (0 : ℝ) 1 := by constructor <;> norm_num + have h₂ : (2 / 3 : ℝ) ∈ Ioo (0 : ℝ) 1 := by constructor <;> norm_num + have := hi h₁ h₂ ((hall _ h₁).trans (hall _ h₂).symm) + norm_num at this + have hmid₁ : (G 0 + G t) / 2 ∈ uIcc (G 0) (G t) := by + rw [mem_uIcc] + rcases le_total (G 0) (G t) with h' | h' + · exact Or.inl ⟨by linarith, by linarith⟩ + · exact Or.inr ⟨by linarith, by linarith⟩ + have hmid₂ : (G 0 + G t) / 2 ∈ uIcc (G t) (G 1) := by + rw [uIcc_comm, ← h] + exact hmid₁ + obtain ⟨s, hs, hsv⟩ := intermediate_value_uIcc hc.continuousOn hmid₁ + obtain ⟨s', hs', hsv'⟩ := intermediate_value_uIcc hc.continuousOn hmid₂ + rw [uIcc_of_le ht.1.le] at hs + rw [uIcc_of_le ht.2.le] at hs' + have hd₀ : (G 0 + G t) / 2 ≠ G 0 := fun he ↦ hne (by linarith) + have hd₁ : (G 0 + G t) / 2 ≠ G t := fun he ↦ hne (by linarith) + have hs₀ : s ≠ 0 := fun he ↦ hd₀ (by rw [← hsv, he]) + have hst : s ≠ t := fun he ↦ hd₁ (by rw [← hsv, he]) + have hs't : s' ≠ t := fun he ↦ hd₁ (by rw [← hsv', he]) + have hs'1 : s' ≠ 1 := fun he ↦ hd₀ (by rw [← hsv', he, ← h]) + have hlt : s < t := lt_of_le_of_ne hs.2 hst + have hgt : t < s' := lt_of_le_of_ne hs'.1 hs't.symm + have hsI : s ∈ Ioo (0 : ℝ) 1 := ⟨lt_of_le_of_ne hs.1 hs₀.symm, hlt.trans ht.2⟩ + have hsI' : s' ∈ Ioo (0 : ℝ) 1 := ⟨ht.1.trans hgt, lt_of_le_of_ne hs'.2 hs'1⟩ + have heq := hi hsI hsI' (hsv.trans hsv'.symm) + linarith + +/-- A list with no repeats whose set of entries is `{u, w}` is `[u, w]` or `[w, u]`. -/ +theorem list_pair {T : Type} {l : List T} {u w : T} (hn : l.Nodup) (hs : {v | v ∈ l} = {u, w}) + (hne : u ≠ w) : + l = [u, w] ∨ l = [w, u] := by + have hu : u ∈ l := by + have : u ∈ {v | v ∈ l} := hs ▸ mem_insert _ _ + exact this + have hw : w ∈ l := by + have : w ∈ {v | v ∈ l} := hs ▸ mem_insert_of_mem _ rfl + exact this + have hall : ∀ x ∈ l, x = u ∨ x = w := fun x hx ↦ by + have : x ∈ {v | v ∈ l} := hx + rw [hs] at this + exact this + rcases l with _ | ⟨x, _ | ⟨y, _ | ⟨z, t⟩⟩⟩ + · simp at hu + · simp only [List.mem_singleton] at hu hw + exact absurd (hu.trans hw.symm) hne + · simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, or_false, not_false_eq_true, + List.nodup_nil, and_true] at hn hall + rcases hall x (.inl rfl) with rfl | rfl <;> rcases hall y (.inr rfl) with rfl | rfl + · exact absurd rfl hn + · exact .inl rfl + · exact .inr rfl + · exact absurd rfl hn + · simp only [List.nodup_cons, List.mem_cons, not_or] at hn + have hx := hall x (by simp) + have hy := hall y (by simp) + have hz := hall z (by simp) + obtain ⟨⟨h₁, h₂, -⟩, ⟨h₃, -⟩, -⟩ := hn + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> rcases hz with rfl | rfl <;> simp_all + +/-- The march of a side of `Φ` is the two ends of a line. -/ +theorem Frame.exists_march (Φ : Frame S) {s : Set S} (hs : s ∈ arcComponentsIn (bd S \ Φ.V)) : + ∃ u w, Φ.γ s = [u, w] ∧ IsLineWithEnds (closure s) u w := by + obtain ⟨u₀, hu₀⟩ : (tilde s).Nonempty := by + rw [← ncard_pos (Φ.side_shape s hs).2.1] + rw [(Φ.side_shape s hs).1] + norm_num + obtain ⟨w, hne, ht, hL⟩ := Φ.exists_line hs hu₀ + rcases list_pair (Φ.γ_nodup s hs) (by rw [Φ.γ_set s hs, ht]) hne with h | h + · exact ⟨u₀, w, h, hL⟩ + · exact ⟨w, u₀, h, hL.symm⟩ + +omit [T2Space S] in +/-- For two different points of a line, one order of the points agrees with the line. -/ +theorem dirAgrees_of_ne {s e : Set S} {u w x y : S} (hL : IsLineWithEnds (closure s) u w) + (hes : e ⊆ s) + (hx : x ∈ closure s) (hy : y ∈ closure s) (hne : x ≠ y) : + DirAgrees s [u, w] e [x, y] ∨ DirAgrees s [u, w] e [y, x] := by + obtain ⟨f, hf₀, hf₁⟩ := hL + have hft : f.symm ⟨x, hx⟩ ≠ f.symm ⟨y, hy⟩ := fun h ↦ hne (congrArg Subtype.val + (f.symm.injective h)) + have hsx : (f (f.symm ⟨x, hx⟩)).1 = x := by simp + have hsy : (f (f.symm ⟨y, hy⟩)).1 = y := by simp + rcases lt_or_gt_of_ne hft with h | h + · refine .inl ⟨f, _, _, h, hes, by simpa using hf₀.symm, by simpa using hf₁.symm, ?_, ?_⟩ + · simp + · simp + · refine .inr ⟨f, _, _, h, hes, by simpa using hf₀.symm, by simpa using hf₁.symm, ?_, ?_⟩ + · simp + · simp + +omit [T2Space S₁] in +/-- The two marches of an arc of a cuff are reverses of each other. -/ +theorem arcMarch_true_eq (hS : IsSurface S₁) {e : Set S₁} {C : cuffs S₁} {a b : ℝ} (hab : a < b) + (hub : b < a + 2 * Real.pi) (he : e = arcOf (cuffPar hS C) a b) : + arcMarch hS true e = (arcMarch hS false e).reverse := by + have hpi := Real.pi_pos + obtain ⟨C₁, a₁, b₁, hab₁, hub₁, he₁, hl₁⟩ := arcMarch_spec hS true hab hub he + obtain ⟨C₂, a₂, b₂, hab₂, hub₂, he₂, hl₂⟩ := arcMarch_spec hS false hab hub he + have hCC : C₁ = C₂ := by + by_contra hne + have hx : cuffPoint (cuffPar hS C₁) ((a₁ + b₁) / 2) ∈ e := + he₁ ▸ ⟨_, ⟨by linarith, by linarith⟩, rfl⟩ + have h₁ : cuffPoint (cuffPar hS C₁) ((a₁ + b₁) / 2) ∈ C₁.1 := cuffPoint_mem _ _ + have h₂ := arcOf_subset _ _ _ (he₂ ▸ hx) + exact disjoint_left.mp (cuffs_disjoint' hne) h₁ h₂ + subst hCC + simp only [ite_true, Bool.false_eq_true, ite_false] at hl₁ hl₂ + obtain ⟨m, h₁, h₂⟩ := exists_shift (cuffPar hS C₁) hab₁ hab₂ hub₁ (by rw [← he₁, ← he₂]) + obtain ⟨m', h₃, h₄⟩ := exists_shift (cuffPar hS C₁) hab₂ hab₁ hub₂ (by rw [← he₂, ← he₁]) + have hsum : m + m' = 0 := by + have hp₁ : 0 ≤ ((m + m' : ℤ) : ℝ) * (2 * Real.pi) := by + push_cast + linarith + have hp₂ : ((m + m' : ℤ) : ℝ) * (2 * Real.pi) ≤ 0 := by + push_cast + linarith + have h₅ : (0 : ℝ) ≤ ((m + m' : ℤ) : ℝ) := by nlinarith + have h₆ : ((m + m' : ℤ) : ℝ) ≤ 0 := by nlinarith + have h₅' : 0 ≤ m + m' := by exact_mod_cast h₅ + have h₆' : m + m' ≤ 0 := by exact_mod_cast h₆ + omega + have hm' : (m' : ℝ) = -m := by + have : ((m + m' : ℤ) : ℝ) = 0 := by rw [hsum]; simp + push_cast at this + linarith + rw [hm'] at h₃ h₄ + have ha : a₂ + m * (2 * Real.pi) = a₁ := by linarith + have hb : b₂ + m * (2 * Real.pi) = b₁ := by linarith + rw [hl₁, hl₂, ← ha, ← hb, cuffPoint_shift, cuffPoint_shift] + rfl + +namespace FrameData + +variable {Φ : Frame S} {Γ : Painting S} {K : Drawing S} {ψ : S₁ → S} (D : FrameData Φ Γ K ψ) +include D + +/-- `ψ` maps the two ends of a side of the fragment over a side of `Φ` to different points. -/ +theorem image_ends_ne {R : Set S₁} (hR : R ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ)) {s : Set S} + (hs : s ∈ Φ.sides) (hsub : ψ '' R ⊆ s) {a b : S₁} (hL : IsLineWithEnds (closure R) a b) + (ht : tilde R = {a, b}) : ψ a ≠ ψ b := by + classical + have hc := D.pull.frag.continuous_ψ + obtain ⟨f, hf₀, hf₁⟩ := hL + obtain ⟨-, -, ⟨c⟩, -⟩ := Φ.side_shape s hs + have hm : ∀ t, ψ (f t).1 ∈ closure s := fun t ↦ + closure_mono hsub (image_closure_subset_closure_image hc ⟨_, (f t).2, rfl⟩) + let G : ℝ → ℝ := fun r ↦ (c.symm ⟨ψ (f (projIcc 0 1 zero_le_one r)).1, hm _⟩ : ℝ) + have hGc : Continuous G := by + refine continuous_subtype_val.comp (c.symm.continuous.comp (Continuous.subtype_mk ?_ _)) + exact hc.comp (continuous_subtype_val.comp (f.continuous.comp continuous_projIcc)) + have hmemR : ∀ t : unitInterval, t ≠ 0 → t ≠ 1 → (f t).1 ∈ R := by + intro t ht₀ ht₁ + by_contra hn + have : (f t).1 ∈ tilde R := ⟨(f t).2, hn⟩ + rw [ht] at this + rcases this with h | h + · exact ht₀ (f.injective (Subtype.ext (h.trans hf₀.symm))) + · exact ht₁ (f.injective (Subtype.ext (h.trans hf₁.symm))) + have hp : ∀ {q : ℝ}, q ∈ Ioo (0 : ℝ) 1 → ∃ t : unitInterval, projIcc 0 1 zero_le_one q = t ∧ t.1 + = q ∧ + t ≠ 0 ∧ t ≠ 1 := by + intro q hq + refine ⟨⟨q, hq.1.le, hq.2.le⟩, projIcc_of_mem _ _, rfl, fun h ↦ ?_, fun h ↦ ?_⟩ + · exact hq.1.ne' (congrArg Subtype.val h) + · exact hq.2.ne (congrArg Subtype.val h) + have hGi : InjOn G (Ioo 0 1) := by + intro r hr r' hr' hrr + obtain ⟨t, ht₁, ht₂, ht₃, ht₄⟩ := hp hr + obtain ⟨t', ht'₁, ht'₂, ht'₃, ht'₄⟩ := hp hr' + have hu := congrArg Subtype.val (c.symm.injective (Subtype.ext hrr)) + simp only [ht₁, ht'₁] at hu + have hvv := D.injOn_side hR hR hs hs hsub hsub (hmemR t ht₃ ht₄) (hmemR t' ht'₃ ht'₄) hu + have htt : t = t' := f.injective (Subtype.ext hvv) + rw [← ht₂, ← ht'₂, htt] + intro heq + refine ne_of_injOn_Ioo hGc hGi ?_ + have e₀ : projIcc 0 1 zero_le_one (0 : ℝ) = (0 : unitInterval) := projIcc_left _ + have e₁ : projIcc 0 1 zero_le_one (1 : ℝ) = (1 : unitInterval) := projIcc_right _ + have hz : (⟨ψ (f (projIcc 0 1 zero_le_one (0 : ℝ))).1, hm _⟩ : closure s) = + ⟨ψ (f (projIcc 0 1 zero_le_one (1 : ℝ))).1, hm _⟩ := by + refine Subtype.ext ?_ + simp only [e₀, e₁] + rw [hf₀, hf₁] + exact heq + exact congrArg (fun z ↦ ((c.symm z : unitInterval) : ℝ)) hz + +/-- **The direction of each side of the frame of a fragment** (Graph Minors XIX, Section 5, page +336: "if $\psi(R) \subseteq S$ for some side $S$ of $\Phi$, then $R$ is directed such that $\psi$ +maps its direction onto that of $S$"). There is such a +choice, because `ψ` maps the two ends of `R` to two different points of the closure of `S`. -/ +theorem exists_flip : ∃ flip : Set S₁ → Bool, ∀ R ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ), ∀ s + ∈ Φ.sides, + ψ '' R ⊆ s → DirAgrees s (Φ.γ s) (ψ '' R) ((arcMarch D.pull.frag.isSurface (flip R) R).map ψ) + := by + classical + have hS₁ := D.pull.frag.isSurface + let flip : Set S₁ → Bool := fun R ↦ !decide (∃ s ∈ Φ.sides, ψ '' R ⊆ s ∧ + DirAgrees s (Φ.γ s) (ψ '' R) ((arcMarch hS₁ false R).map ψ)) + refine ⟨flip, fun R hR s hs hsub ↦ ?_⟩ + have hc := D.pull.frag.continuous_ψ + obtain ⟨C, a, b, hab, hub, he, -, -, -⟩ := exists_arc_of_mem hS₁ (cuffPar hS₁) + D.finite_pullFrameV D.two hR + have hrev := arcMarch_true_eq hS₁ hab hub he + obtain ⟨C₂, a₂, b₂, hab₂, hub₂, he₂, hl₂⟩ := arcMarch_spec hS₁ false hab hub he + simp only [Bool.false_eq_true, ite_false] at hl₂ + have hLR : IsLineWithEnds (closure R) (cuffPoint (cuffPar hS₁ C₂) a₂) (cuffPoint + (cuffPar hS₁ C₂) b₂) := by + rw [he₂] + exact isLine_arcOf _ hab₂ hub₂ + have ht : tilde R = {cuffPoint (cuffPar hS₁ C₂) a₂, cuffPoint (cuffPar hS₁ C₂) b₂} := by + rw [he₂] + exact tilde_arcOf _ hab₂ hub₂ + have hne := D.image_ends_ne hR hs hsub hLR ht + have hin : ∀ {x}, x ∈ closure R → ψ x ∈ closure s := fun hx ↦ + closure_mono hsub (image_closure_subset_closure_image hc ⟨_, hx, rfl⟩) + obtain ⟨u, w, hγ, hL⟩ := Φ.exists_march hs + have hmap : (arcMarch hS₁ false R).map ψ = + [ψ (cuffPoint (cuffPar hS₁ C₂) a₂), ψ (cuffPoint (cuffPar hS₁ C₂) b₂)] := by + rw [hl₂] + rfl + have hmaprev : (arcMarch hS₁ true R).map ψ = + [ψ (cuffPoint (cuffPar hS₁ C₂) b₂), ψ (cuffPoint (cuffPar hS₁ C₂) a₂)] := by + rw [hrev, hl₂] + rfl + have hdir := dirAgrees_of_ne hL hsub (hin hLR.left_mem) (hin hLR.right_mem) hne + rw [← hγ, ← hmap, ← hmaprev] at hdir + by_cases hex : ∃ s ∈ Φ.sides, ψ '' R ⊆ s ∧ DirAgrees s (Φ.γ s) (ψ '' R) + ((arcMarch hS₁ false R).map ψ) + · have hfl : flip R = false := by simp only [flip, hex, decide_true, Bool.not_true] + rw [hfl] + obtain ⟨s', hs', hsub', hd⟩ := hex + obtain ⟨x, hx⟩ := hR.1 + have hss : s' = s := arcComp_eq_of_mem hs' hs (hsub' (mem_image_of_mem ψ hx)) (hsub + (mem_image_of_mem ψ hx)) + exact hss ▸ hd + · have hfl : flip R = true := by simp only [flip, hex, decide_false, Bool.not_false] + rw [hfl] + rcases hdir with h | h + · exact absurd ⟨s, hs, hsub, h⟩ hex + · exact h + +omit [T2Space S] in +/-- The march of a side, or of a border edge of `Γ₁`, in the sense given by `flip`. -/ +theorem nodup_arcMarch (flip : Bool) {N : Set S₁} (hN : N.Finite) + (h2 : ∀ C : cuffs S₁, ∃ p ∈ N ∩ C.1, ∃ q ∈ N ∩ C.1, p ≠ q) {e : Set S₁} + (he : e ∈ arcComponentsIn (bd S₁ \ N)) : + (arcMarch D.pull.frag.isSurface flip e).Nodup ∧ + {v | v ∈ arcMarch D.pull.frag.isSurface flip e} = tilde e := by + have hS := D.pull.frag.isSurface + obtain ⟨C, a, b, hab, hub, he', -, -, -⟩ := exists_arc_of_mem hS (cuffPar hS) hN h2 he + exact ⟨(arcMarch_spec hS flip hab hub he').nodup, (arcMarch_spec hS flip hab hub he').set_eq⟩ + +/-- The march of a border edge of `Γ₁`: "$\gamma_1(e)$ is defined such that the direction of $e$ +agrees with the direction of the +side of $\psi^{-1}(\Phi) \cap \Sigma_1$ including it" (Graph Minors XIX, Section 5, page 336). -/ +noncomputable def borderMarch (D : FrameData Φ Γ K ψ) (flip : Set S₁ → Bool) (e : Set S₁) : List S₁ + := + arcMarch D.pull.frag.isSurface (flip (sideOf Φ K ψ e)) e + +/-- **Graph Minors XIX, (5.3).** With `K` a feature in `Φ` and `Γ` a painting that fits `Φ`, such +that each component +of `K` has a vertex of `Γ` in the sense of `IsAnchored`, the painting `ψ⁻¹(Γ) ∩ Σ₁` fits the frame +`ψ⁻¹(Φ) ∩ Σ₁`. +Any choice of `flip` works here, and `exists_flip` gives the one the paper asks for. -/ +theorem theorem_5_3_proof [Nonempty S₁] [ConnectedSpace S] (hF : IsFeature Φ K) + (hA : IsAnchored Γ K) + (flip : Set S₁ → Bool) : + (pullPainting D.pull (D.borderMarch flip) + (fun _ hp ↦ (D.nodup_arcMarch _ D.pull.finite_pullV D.pull.two hp).1) + (fun _ hp ↦ (D.nodup_arcMarch _ D.pull.finite_pullV D.pull.two hp).2)).Fits + (pullFrame D flip (D.long_disjoint hF)) := by + have hE : ∀ {p}, p ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ) → + p ∈ arcComponentsIn (pullU Γ ψ \ pullV Γ K ψ) := fun {p} hp ↦ by + rw [D.pull.arcComponentsIn_eq] + exact Or.inl hp + refine ⟨D.pullFrameV_subset, ?_, ?_, ?_, ?_⟩ + · rintro s ⟨hs, hnl⟩ + exact hE (D.mem_arcComponents_of_short hs hnl) + · intro e he hb s hs hes + have he' : e ∈ arcComponentsIn (pullU Γ ψ \ pullV Γ K ψ) := he + rw [D.pull.arcComponentsIn_eq] at he' + rcases he' with hp | ⟨e₀, he₀, hb₀, hne, rfl⟩ + · have hnl := D.pull.notMem_liftPieces hp + change DirAgrees s (arcMarch _ (flip s) s) e (pullγ Γ ψ _ e) + rw [pullγ_arc hnl] + change DirAgrees s _ e (arcMarch _ (flip (sideOf Φ K ψ e)) e) + rw [sideOf_eq hp.1 hs hes] + exact D.dirAgrees_pull flip hp hs hes + · obtain ⟨x, hx, hxb⟩ := hb + exact absurd hxb (D.pull.preimage_subset_int (D.pull.subset_R he₀ hb₀ hne) hx) + · exact D.pull.isInternallyThreeConnected _ _ _ D.fits.internally_three_connected hA + · exact D.pull.size_three_region D.pull.surface _ _ _ D.fits.size_three_region hA + +end FrameData + +/-- `Frame.two_on_cuff` for a larger set. -/ +theorem Frame.two_on_cuff' {A : Set S} (hS : IsSurface S) (Φ : Frame S) (C : cuffs S) : + ∃ p ∈ (Φ.V ∪ A) ∩ C.1, ∃ q ∈ (Φ.V ∪ A) ∩ C.1, p ≠ q := by + obtain ⟨p, hp, q, hq, hpq⟩ := Frame.two_on_cuff hS Φ C + exact ⟨p, ⟨Or.inl hp.1, hp.2⟩, q, ⟨Or.inl hq.1, hq.2⟩, hpq⟩ + +/-- A cut along `K` gives for each fragment the data of (5.3). -/ +theorem exists_frameData (hS : IsSurface S) [ConnectedSpace S] {Φ : Frame S} {Γ : Painting S} + (hfit : Γ.Fits Φ) + {K : Drawing S} {𝓐 𝓛 : Set (Set S)} (hinter : Γ.U ∩ K.U ⊆ Γ.V ∩ K.V) + (hlines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} ∧ + IsLineWithEnds (closure e) u v) + (hKne : K.V ⊆ ⋃ e ∈ arcComponentsIn (K.U \ K.V), closure e) (hF : IsCutFrame S 𝓐 𝓛) + (hc : bd S ∪ K.U = ⋃₀ 𝓐 ∪ ⋃₀ 𝓛) : + ∃ (Y : Type) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S), IsSurface Y ∧ IsCutMap ψ K.U + ∧ + HasSheets ψ K ∧ ∀ y : Y, FrameData Φ Γ K (fun x : connectedComponent y ↦ ψ x.1) := by + have hKbd : K.U ∩ bd S ⊆ K.V := fun x hx ↦ (hinter ⟨Γ.bd_subset hx.2, hx.1⟩).2 + obtain ⟨Y, tY, t2, ψ, hY, hψ, hsheet⟩ := exists_cut_drawing hS hlines hKbd hKne hF hc + refine ⟨Y, tY, t2, ψ, hY, hψ, hsheet, fun y ↦ ⟨⟨hS, isCuttingFragment_of_cut hS hY hψ (K + := K) rfl y, hinter, + two_of_cut hS hY hψ hsheet hlines hKbd subset_union_right (fun C' ↦ ?_) y⟩, hfit, + two_of_cut hS hY hψ hsheet hlines hKbd subset_union_right (Frame.two_on_cuff' hS Φ) y, hKbd⟩⟩ + obtain ⟨p, hp, q, hq, hpq⟩ := Frame.two_on_cuff hS Φ C' + exact ⟨p, ⟨Or.inl (hfit.V_subset hp.1), hp.2⟩, q, ⟨Or.inl (hfit.V_subset hq.1), hq.2⟩, hpq⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5h.lean b/LeanPool/GraphMinor/GM19/Section5h.lean new file mode 100644 index 0000000000..b61c257c7a --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5h.lean @@ -0,0 +1,194 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5g + +/-! +# Graph Minors XIX, proof of (5.4): from the edges of `Γ₁` back to the edges of `Γ` + +Here we match the edges of the painting `Γ₁ = ψ⁻¹(Γ) ∩ Σ₁` with the edges of `Γ`. A lifted edge has +this form by +definition. A border edge of `Γ₁` over `bd(Σ)` maps onto a border edge of `Γ`, and it is the whole +of the preimage +of this edge in `Σ₁`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S S₁ : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace S₁] [T2Space S₁] + + +variable {Γ : Painting S} {K : Drawing S} {ψ : S₁ → S} + +namespace PullData + +variable (d : PullData Γ K ψ) +include d + +omit [T2Space S] [T2Space S₁] in +/-- `U(K) ∩ bd(Σ) ⊆ V(K)`, because `bd(Σ) ⊆ U(Γ)`. -/ +theorem K_bd : K.U ∩ bd S ⊆ K.V := fun _ hx ↦ (d.inter ⟨Γ.bd_subset hx.2, hx.1⟩).2 + +omit [T2Space S] [T2Space S₁] in +/-- An arc of `bd(Σ₁) \ V₁` that has a point over `bd(Σ)` lies over `bd(Σ)`: its image is connected +in +`bd(Σ) ∪ U(K)`, and it misses `V(K)`, which holds `U(K) ∩ bd(Σ)`. -/ +theorem image_arc_subset_bd {R : Set S₁} (hR : R ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ)) {x : S₁} + (hxR : x ∈ R) + (hb : ψ x ∈ bd S) : ψ '' R ⊆ bd S := by + have hc := d.frag.continuous_ψ + have hbc : IsClosed (bd S) := (cuff_statement S d.surface).1 + have hIc : IsPreconnected (ψ '' R) := hR.2.2.1.isConnected.isPreconnected.image _ hc.continuousOn + have hoff : ∀ {w}, w ∈ R → ψ w ∉ K.V := fun hw hv ↦ (hR.2.1 hw).2 (Or.inr hv) + have hcov : ψ '' R ⊆ (bd S) ∪ K.U := by + rintro _ ⟨w, hw, rfl⟩ + exact d.frag.maps_bd (mem_image_of_mem ψ (hR.2.1 hw).1) + by_contra hn + obtain ⟨_, ⟨z, hRz, rfl⟩, hzn⟩ := not_subset.mp hn + have hzK : ψ z ∈ K.U := (hcov (mem_image_of_mem ψ hRz)).resolve_left hzn + obtain ⟨_, ⟨w, hw, rfl⟩, hw₁, hw₂⟩ := isPreconnected_closed_iff.mp hIc + (bd S) K.U hbc K.isClosed_U hcov + ⟨ψ x, mem_image_of_mem ψ hxR, hb⟩ ⟨ψ z, mem_image_of_mem ψ hRz, hzK⟩ + exact hoff hw (d.K_bd ⟨hw₂, hw₁⟩) + +omit [T2Space S] in +/-- Near a point of an arc of `bd(Σ₁) \ V₁`, the boundary is the arc. -/ +theorem exists_nhds_arc {R : Set S₁} (hR : R ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ)) {x : S₁} + (hxR : x ∈ R) : + ∃ W ∈ 𝓝 x, ∀ z ∈ W, z ∈ bd S₁ → z ∈ R := by + have hS₁ := d.frag.isSurface + obtain ⟨W, hW, hWs⟩ := exists_nhds_arcs hS₁ d.finite_pullV d.two x + refine ⟨W, hW, fun z hz hzb ↦ ?_⟩ + rcases hWs z hz hzb with rfl | ⟨R', hR', hzR', hxc⟩ + · exact hxR + · have hx' := mem_of_mem_closure_arc hS₁ d.finite_pullV d.two hR' hxc (hR.2.1 hxR).2 + exact arcComp_eq_of_mem hR hR' hxR hx' ▸ hzR' + +omit [T2Space S] in +/-- A point of `bd(Σ₁)` off `V₁`, over `bd(Σ)`: the boundary near it maps into `bd(Σ)`. -/ +theorem exists_nhds_bd {x : S₁} (hx : x ∈ bd S₁ \ pullV Γ K ψ) (hb : ψ x ∈ bd S) : + ∃ W ∈ 𝓝 x, ∀ z ∈ W, z ∈ bd S₁ → ψ z ∈ bd S ∧ z ∉ pullV Γ K ψ := by + obtain ⟨R, hR, hsub⟩ := exists_arcComp_superset (isPathConnected_singleton x) + (singleton_subset_iff.mpr hx) + have hxR : x ∈ R := hsub rfl + obtain ⟨W, hW, hWs⟩ := d.exists_nhds_arc hR hxR + refine ⟨W, hW, fun z hz hzb ↦ ?_⟩ + have hRz := hWs z hz hzb + exact ⟨d.image_arc_subset_bd hR hxR hb (mem_image_of_mem ψ hRz), (hR.2.1 hRz).2⟩ + +/-- `ψ` is one-to-one on the points of `bd(Σ₁)` off `V₁` over `bd(Σ)`. -/ +theorem eq_of_image_eq_bd {x x' : S₁} (hx : x ∈ bd S₁ \ pullV Γ K ψ) (hx' : x' ∈ bd S₁ \ pullV Γ K + ψ) + (hb : ψ x ∈ bd S) (heq : ψ x = ψ x') : x = x' := by + obtain ⟨W, hW, hWs⟩ := d.exists_nhds_bd hx hb + obtain ⟨W', hW', hWs'⟩ := d.exists_nhds_bd hx' (heq ▸ hb) + exact d.frag.eq_of_image_eq d.surface hx.1 hx'.1 hb hW hW' (fun z hz hzb ↦ (hWs z hz hzb).1) + (fun z hz hzb ↦ (hWs' z hz hzb).1) heq + +/-- A border edge of `Γ₁` over `bd(Σ)` maps onto an edge of `Γ`, and it is the whole of the preimage +of this edge. -/ +theorem image_border_edge {e₁ : Set S₁} (he₁ : e₁ ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ)) + {x₀ : S₁} (hx₀ : x₀ ∈ e₁) (hb₀ : ψ x₀ ∈ bd S) : + ψ '' e₁ ∈ Γ.E ∧ ψ ⁻¹' (ψ '' e₁) = e₁ := by + have hS₁ := d.frag.isSurface + have hS := d.surface + have hman := hS.2.2 + have hc := d.frag.continuous_ψ + have hcl := d.frag.isClosedMap + have : CompactSpace S₁ := hS₁.1 + have hbc : IsClosed (bd S) := (cuff_statement S hS).1 + have hbd := d.image_arc_subset_bd he₁ hx₀ hb₀ + have hsubU : ψ '' e₁ ⊆ Γ.U \ Γ.V := by + rintro _ ⟨x, hx, rfl⟩ + exact ⟨Γ.bd_subset (hbd (mem_image_of_mem ψ hx)), fun hv ↦ (he₁.2.1 hx).2 (Or.inl hv)⟩ + obtain ⟨e, he, hsub⟩ := exists_arcComp_superset (he₁.2.2.1.image hc) hsubU + have heb : e ⊆ bd S := (Γ.border_edge e he ⟨ψ x₀, hsub (mem_image_of_mem ψ hx₀), + hbd (mem_image_of_mem ψ hx₀)⟩).2 + have heK : ∀ {z}, z ∈ e → z ∉ K.U := fun hz hK ↦ + Γ.disjoint_V he hz (d.inter ⟨he.2.1 hz |>.1, hK⟩).1 + have hpre : ∀ {x}, ψ x ∈ e → x ∈ bd S₁ \ pullV Γ K ψ := by + intro x hx + refine ⟨d.mem_bd_of_notMem_R (Or.inl (heb hx)), ?_⟩ + rintro (hv | hv) + · exact Γ.disjoint_V he hx hv + · exact heK hx (K.V_subset_U hv) + -- `ψ(e₁)` is open in `e` + have hopen : ∀ x ∈ e₁, ∃ O, IsOpen O ∧ ψ x ∈ O ∧ O ∩ e ⊆ ψ '' e₁ := by + intro x hx + obtain ⟨W, hW, hWs⟩ := d.exists_nhds_arc he₁ hx + obtain ⟨W', hW', hsubW⟩ := d.exists_nhds_bd (he₁.2.1 hx) (hbd (mem_image_of_mem ψ hx)) + obtain ⟨A, hA, hAs, hf⟩ := d.frag.exists_nhds_fibre x (Filter.inter_mem hW hW') + obtain ⟨C, hC, hCc, hCs⟩ := exists_mem_nhds_isClosed_subset hA + obtain ⟨N, hN, hs⟩ := d.frag.local_fill hS (he₁.2.1 hx).1 (hbd (mem_image_of_mem ψ hx)) hC + (fun z hz ↦ (hsubW z (hAs (hCs hz)).2 · |>.1)) (fun z hz ↦ hf z (hCs hz)) + refine ⟨interior N, isOpen_interior, mem_interior_iff_mem_nhds.mpr hN, ?_⟩ + rintro z ⟨hzN, hze⟩ + have hzcl := (isConnectedNear_compl_bd (hman z) (heb hze)).2 + have hzcl' := isOpen_interior.inter_closure ⟨hzN, hzcl⟩ + have hsub' : interior N ∩ (bd S)ᶜ ⊆ ψ '' C := fun y hy ↦ by + obtain ⟨c, hc', rfl⟩ := hs ⟨hy.2, interior_subset hy.1⟩ + exact mem_image_of_mem ψ hc'.1 + have hz' := closure_minimal hsub' (hcl _ hCc) hzcl' + obtain ⟨c, hcC, rfl⟩ := hz' + exact mem_image_of_mem ψ (hWs c (hAs (hCs hcC)).1 (hpre hze).1) + -- `ψ(e₁)` is closed in `e` + have hclosed : closure (ψ '' e₁) ∩ e ⊆ ψ '' e₁ := by + rintro z ⟨hz, hze⟩ + rw [hcl.closure_image_eq_of_continuous hc] at hz + obtain ⟨x, hx, rfl⟩ := hz + exact mem_image_of_mem ψ (mem_of_mem_closure_arc hS₁ d.finite_pullV d.two he₁ hx (hpre hze).2) + have hesub : e ⊆ ψ '' e₁ := by + choose! O hOo hOm hOs using hopen + intro z hz + by_contra hzn + obtain ⟨w, hwe, hwO, hwc⟩ := he.2.2.1.isConnected.isPreconnected (⋃ x ∈ e₁, O x) + (closure (ψ '' e₁))ᶜ (isOpen_biUnion hOo) isClosed_closure.isOpen_compl + (fun w hw ↦ by + by_cases hwc : w ∈ closure (ψ '' e₁) + · obtain ⟨x, hx, rfl⟩ := hclosed ⟨hwc, hw⟩ + exact Or.inl (mem_biUnion hx (hOm x hx)) + · exact Or.inr hwc) + ⟨ψ x₀, hsub (mem_image_of_mem ψ hx₀), mem_biUnion hx₀ (hOm x₀ hx₀)⟩ + ⟨z, hz, fun hzc ↦ hzn (hclosed ⟨hzc, hz⟩)⟩ + obtain ⟨x, hx, hwx⟩ := mem_iUnion₂.mp hwO + exact hwc (subset_closure (hOs x hx ⟨hwx, hwe⟩)) + have heq : ψ '' e₁ = e := Subset.antisymm hsub hesub + refine ⟨heq ▸ he, ?_⟩ + ext x + constructor + · rintro ⟨x', hx', hxx⟩ + rw [d.eq_of_image_eq_bd (hpre (heq ▸ ⟨x', hx', hxx⟩)) (he₁.2.1 hx') (by + rw [← hxx]; exact hbd (mem_image_of_mem ψ hx')) hxx.symm] + exact hx' + · exact fun hx ↦ ⟨x, hx, rfl⟩ + +/-- The preimage of a border edge of `Γ` that meets `Σ₁` is a border edge of `Γ₁`. -/ +theorem preimage_border_edge {e : Set S} (he : e ∈ Γ.E) (hb : e ⊆ bd S) {x : S₁} (hx : ψ x ∈ e) : + ψ ⁻¹' e ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ) ∧ ψ '' (ψ ⁻¹' e) = e := by + have hxm : x ∈ bd S₁ \ pullV Γ K ψ := by + refine ⟨d.mem_bd_of_notMem_R (Or.inl (hb hx)), ?_⟩ + rintro (hv | hv) + · exact Γ.disjoint_V he hx hv + · exact Γ.disjoint_V he hx (d.inter ⟨he.2.1 hx |>.1, K.V_subset_U hv⟩).1 + obtain ⟨R, hR, hsub⟩ := exists_arcComp_superset (isPathConnected_singleton x) + (singleton_subset_iff.mpr hxm) + have hxR : x ∈ R := hsub rfl + obtain ⟨hRE, hRpre⟩ := d.image_border_edge hR hxR (hb hx) + have hRe : ψ '' R = e := arcComp_eq_of_mem hRE he (mem_image_of_mem ψ hxR) hx + rw [← hRe, hRpre] + exact ⟨hR, rfl⟩ + +end PullData + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5i.lean b/LeanPool/GraphMinor/GM19/Section5i.lean new file mode 100644 index 0000000000..6ce0f85ce4 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5i.lean @@ -0,0 +1,332 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5h + +/-! +# Graph Minors XIX, proof of (5.4): frame vertices under an inflation + +The proof of (5.4) says that a vertex `v'` of the frame satisfies `v' ∈ V(σ'(v'))`. The reason is +that some side at +`v'` is short, because two long sides have no common end, and an inflation that respects a frame +fixes each short +side with its direction. We also show that the direction condition of a linear inflation follows +from respecting the +frame, since both edges are directed as the side that holds them. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] [T2Space S] + + +/-- An arc of `bd(Σ) \ N` on a cuff `Θ` is an arc of any parametrisation of `Θ`. -/ +theorem exists_arc_param (_hS : IsSurface S) {Θ : Set S} (f : Circle ≃ₜ Θ) {N : Set S} + (hN : N.Finite) + {p q : S} (hp : p ∈ N ∩ Θ) (hq : q ∈ N ∩ Θ) (hpq : p ≠ q) (hΘ : Θ ⊆ bd S) {R : Set S} + (hR : R ∈ arcComponentsIn (bd S \ N)) (hRΘ : R ⊆ Θ) : + ∃ a b : ℝ, a < b ∧ b < a + 2 * Real.pi ∧ R = arcOf f a b ∧ cuffPoint f a ∈ N + ∧ cuffPoint f b ∈ N := by + obtain ⟨x, hx⟩ := hR.1 + obtain ⟨a, b, hab, hub, hxA, hd, ha, hb⟩ := exists_arc_of_two f hN hp hq hpq ⟨hRΘ hx, + (hR.2.1 hx).2⟩ + refine ⟨a, b, hab, hub, ?_, ha, hb⟩ + refine Subset.antisymm ?_ ?_ + · exact subset_arcOf f hab hub hR.2.2.1.isConnected.isPreconnected hRΘ (fun h ↦ (hR.2.1 h).2 ha) + (fun h ↦ (hR.2.1 h).2 hb) hx hxA + · have hpc : IsPathConnected (arcOf f a b) := by + refine IsPathConnected.image ?_ (continuous_cuffPoint f) + exact (convex_Ioo a b).isPathConnected ⟨(a + b) / 2, by linarith, by linarith⟩ + have heq := hR.2.2.2 (R ∪ arcOf f a b) (by + rintro y (hy | hy) + · exact hR.2.1 hy + · exact ⟨hΘ (arcOf_subset f a b hy), disjoint_left.mp hd hy⟩) (hR.2.2.1.union hpc ⟨x, hx, + hxA⟩) + subset_union_left + exact fun y hy ↦ heq ▸ Or.inr hy + +/-- Each point of a finite set `N` on the boundary, with two points of `N` on each cuff, is an end +of two arcs of +`bd(Σ) \ N`: the arcs just after it and just before it. -/ +theorem exists_two_arcs (hS : IsSurface S) {N : Set S} (hN : N.Finite) + (h2 : ∀ C : cuffs S, ∃ p ∈ N ∩ C.1, ∃ q ∈ N ∩ C.1, p ≠ q) {p : S} (hpN : p ∈ N) + (hpb : p ∈ bd S) : + ∃ R₁ ∈ arcComponentsIn (bd S \ N), ∃ R₂ ∈ arcComponentsIn (bd S \ N), R₁ ≠ R₂ ∧ p ∈ tilde R₁ + ∧ p ∈ tilde R₂ := by + have hpi := Real.pi_pos + obtain ⟨C₀, hC₀, hpC⟩ := sUnion_cuffs (S := S) ▸ hpb + let C : cuffs S := ⟨C₀, hC₀⟩ + let f := cuffPar hS C + obtain ⟨t, -, htp⟩ := exists_angle_in f 0 ⟨p, hpC⟩ + change cuffPoint f t = p at htp + have hq : ∃ q ∈ N ∩ C.1, q ≠ p := by + obtain ⟨p', hp', q', hq', hne⟩ := h2 C + by_cases h : p' = p + · exact ⟨q', hq', fun h' ↦ hne (h.trans h'.symm)⟩ + · exact ⟨p', hp', h⟩ + obtain ⟨q, hqN, hqp⟩ := hq + obtain ⟨s₀, hs₀, hs₀q⟩ := exists_angle_in f t ⟨q, hqN.2⟩ + change cuffPoint f s₀ = q at hs₀q + let A : Set ℝ := {s | s ∈ Ioo t (t + 2 * Real.pi) ∧ cuffPoint f s ∈ N} + have hAfin : A.Finite := (finite_angles f hN t).subset fun s hs ↦ ⟨⟨hs.1.1.le, hs.1.2⟩, hs.2⟩ + have hAne : A.Nonempty := by + refine ⟨s₀, ⟨lt_of_le_of_ne hs₀.1 ?_, hs₀.2⟩, hs₀q ▸ hqN.1⟩ + rintro rfl + exact hqp (hs₀q.symm.trans htp) + obtain ⟨b, hbA, hbmin⟩ := Set.exists_min_image A id hAfin hAne + obtain ⟨c, hcA, hcmax⟩ := Set.exists_max_image A id hAfin hAne + simp only [id] at hbmin hcmax + have hbc : b ≤ c := hbmin c hcA + have hub : b < t + 2 * Real.pi := hbA.1.2 + have hpc₁ : ∀ {u v : ℝ}, u < v → IsPathConnected (arcOf f u v) := fun {u v} huv ↦ + ((convex_Ioo u v).isPathConnected ⟨(u + v) / 2, by linarith, by linarith⟩).image + (continuous_cuffPoint f) + have hC : ∀ {z : ℝ}, cuffPoint f z ∉ N → cuffPoint f z ∈ bd S \ N := fun hz ↦ + ⟨cuff_subset_bd C (cuffPoint_mem f _), hz⟩ + have hA₁ : arcOf f t b ⊆ bd S \ N := by + rintro _ ⟨z, hz, rfl⟩ + refine hC fun hzN ↦ ?_ + exact absurd (hbmin z ⟨⟨hz.1, by linarith [hz.2]⟩, hzN⟩) (not_le.mpr hz.2) + have hct : c < t + 2 * Real.pi := hcA.1.2 + have hA₂ : arcOf f c (t + 2 * Real.pi) ⊆ bd S \ N := by + rintro _ ⟨z, hz, rfl⟩ + refine hC fun hzN ↦ ?_ + exact absurd (hcmax z ⟨⟨by linarith [hz.1, hcA.1.1], hz.2⟩, hzN⟩) (not_le.mpr hz.1) + obtain ⟨R₁, hR₁, hs₁⟩ := exists_arcComp_superset (hpc₁ hbA.1.1) hA₁ + obtain ⟨R₂, hR₂, hs₂⟩ := exists_arcComp_superset (hpc₁ hct) hA₂ + have hcl₁ : p ∈ closure (arcOf f t b) := by + rw [closure_arcOf f hbA.1.1] + exact ⟨t, ⟨le_rfl, hbA.1.1.le⟩, htp⟩ + have hcl₂ : p ∈ closure (arcOf f c (t + 2 * Real.pi)) := by + rw [closure_arcOf f hct] + exact ⟨t + 2 * Real.pi, ⟨hct.le, le_rfl⟩, by rw [cuffPoint_add_two_pi, htp]⟩ + refine ⟨R₁, hR₁, R₂, hR₂, ?_, ⟨closure_mono hs₁ hcl₁, fun h ↦ (hR₁.2.1 h).2 hpN⟩, + ⟨closure_mono hs₂ hcl₂, fun h ↦ (hR₂.2.1 h).2 hpN⟩⟩ + rintro rfl + have hxp : cuffPoint f ((t + b) / 2) ∈ R₁ := hs₁ ⟨_, ⟨by linarith [hbA.1.1], by linarith + [hbA.1.1]⟩, rfl⟩ + have hxm : cuffPoint f ((c + (t + 2 * Real.pi)) / 2) ∈ R₁ := hs₂ ⟨_, ⟨by linarith, by linarith⟩, + rfl⟩ + have hR₁C : R₁ ⊆ C.1 := by + obtain ⟨C', a', b', -, -, rfl, -, -, -⟩ := exists_arc_of_mem hS (cuffPar hS) hN h2 hR₁ + have hCC : C' = C := by + by_contra hne + exact disjoint_left.mp (cuffs_disjoint' hne) (arcOf_subset _ _ _ hxp) (cuffPoint_mem f _) + subst hCC + exact arcOf_subset _ _ _ + have hsub := subset_arcOf f hbA.1.1 hub hR₁.2.2.1.isConnected.isPreconnected hR₁C + (fun h ↦ (hR₁.2.1 h).2 (htp ▸ hpN)) (fun h ↦ (hR₁.2.1 h).2 hbA.2) hxp + ⟨_, ⟨by linarith [hbA.1.1], by linarith [hbA.1.1]⟩, rfl⟩ + obtain ⟨u, hu, hue⟩ := hsub hxm + have huv : u = (c + (t + 2 * Real.pi)) / 2 := cuffPoint_injOn f le_rfl + ⟨hu.1.le, by linarith [hu.2]⟩ ⟨by linarith [hbA.1.1], by linarith⟩ hue + linarith [hu.2] + +/-- A vertex of a frame lies on a short side, since two sides end at it and they are not both long. +-/ +theorem Frame.exists_short_side (hS : IsSurface S) (Φ : Frame S) {v : S} (hv : v ∈ Φ.V) : + ∃ s ∈ Φ.shortSides, v ∈ tilde s := by + obtain ⟨R₁, hR₁, R₂, hR₂, hne, h₁, h₂⟩ := exists_two_arcs hS Φ.finite_V + (Frame.two_on_cuff hS Φ) hv (Φ.V_subset hv) + by_cases hl₁ : Φ.isLong R₁ + · by_cases hl₂ : Φ.isLong R₂ + · exact absurd h₂ (disjoint_left.mp (Φ.long_disjoint R₁ hR₁ R₂ hR₂ hne hl₁ hl₂) h₁) + · exact ⟨R₂, ⟨hR₂, hl₂⟩, h₂⟩ + · exact ⟨R₁, ⟨hR₁, hl₁⟩, h₁⟩ + +/-- The march of a side, read as an edge in the direction of the side, is the march of the side. -/ +theorem Frame.march_eq (Φ : Frame S) {s : Set S} (hs : s ∈ Φ.sides) {l : List S} (hn : l.Nodup) + (hset : {v | v ∈ l} = tilde s) (hd : DirAgrees s (Φ.γ s) s l) : l = Φ.γ s := by + obtain ⟨u, w, hγ, hL⟩ := Φ.exists_march hs + have ht : tilde s = {u, w} := by + rw [← Φ.γ_set s hs, hγ] + ext x + simp + have hne := (GM20.line_facts hL).1 + rcases list_pair hn (hset.trans ht) hne with rfl | rfl + · exact hγ.symm + · exfalso + obtain ⟨f, t₁, t₂, hlt, -, h₁, h₂, h₃, h₄⟩ := hd + rw [hγ] at h₁ h₂ + simp only [List.head?_cons, Option.some.injEq, List.getLast?_cons_cons, + List.getLast?_singleton] at h₁ h₂ h₃ h₄ + have e₁ : t₁ = ⟨1, right_mem_Icc.mpr zero_le_one⟩ := f.injective (Subtype.ext + (h₃.symm.trans h₂)) + have e₂ : t₂ = ⟨0, left_mem_Icc.mpr zero_le_one⟩ := f.injective (Subtype.ext (h₄.symm.trans h₁)) + rw [e₁, e₂] at hlt + exact absurd hlt (not_lt.mpr (by exact zero_le_one' ℝ)) + +omit [T2Space S] in +/-- Two edges in a side cannot both follow the direction of the side with the same two ends in +opposite order: the +two parametrisations of the side differ by an increasing map of `[0, 1]`. -/ +theorem dirAgrees_not_reverse {s e e' : Set S} {γs : List S} {x y : S} + (hd : DirAgrees s γs e [x, y]) + (hd' : DirAgrees s γs e' [y, x]) : False := by + obtain ⟨f, t₁, t₂, hlt, -, h₁, h₂, h₃, h₄⟩ := hd + obtain ⟨f', t₁', t₂', hlt', -, h₁', h₂', h₃', h₄'⟩ := hd' + simp only [List.head?_cons, Option.some.injEq, List.getLast?_cons_cons, + List.getLast?_singleton] at h₃ h₄ h₃' h₄' + let h : unitInterval → unitInterval := fun t ↦ f'.symm (f t) + have hc : Continuous h := f'.symm.continuous.comp f.continuous + have hi : Function.Injective h := f'.symm.injective.comp f.injective + have h0 : h ⊥ = ⊥ := by + refine f'.injective (Subtype.ext ?_) + simp only [h, Homeomorph.apply_symm_apply] + exact Option.some.inj (h₁.symm.trans h₁') + have h1 : h ⊤ = ⊤ := by + refine f'.injective (Subtype.ext ?_) + simp only [h, Homeomorph.apply_symm_apply] + exact Option.some.inj (h₂.symm.trans h₂') + have hmono : StrictMono h := hc.strictMono_of_inj_boundedOrder (by rw [h0, h1]; exact bot_le) hi + have e₁ : h t₁ = t₂' := by + refine f'.injective (Subtype.ext ?_) + simp only [h, Homeomorph.apply_symm_apply] + rw [← h₃, h₄'] + have e₂ : h t₂ = t₁' := by + refine f'.injective (Subtype.ext ?_) + simp only [h, Homeomorph.apply_symm_apply] + rw [← h₄, h₃'] + have := hmono hlt + rw [e₁, e₂] at this + exact absurd hlt' (not_lt.mpr this.le) + +/-- A subarc of an arc, in the direction of the arc. -/ +theorem dirAgrees_arc {Θ : Set S} (f : Circle ≃ₜ Θ) {a b p q : ℝ} (hab : a < b) + (hub : b < a + 2 * Real.pi) (hpq : p < q) (hsub : arcOf f p q ⊆ arcOf f a b) : + DirAgrees (arcOf f a b) [cuffPoint f a, cuffPoint f b] (arcOf f p q) [cuffPoint f p, cuffPoint + f q] ∧ + DirAgrees (arcOf f a b) [cuffPoint f b, cuffPoint f a] (arcOf f p q) [cuffPoint f q, + cuffPoint f p] ∧ + q < p + 2 * Real.pi := by + have hpi := Real.pi_pos + obtain ⟨m, h₁, h₂⟩ := exists_shift f hab hpq hub hsub + have hshift := arcOf_shift f p q m + have hp₁ := cuffPoint_shift f p m + have hp₂ := cuffPoint_shift f q m + have hlt : p + m * (2 * Real.pi) < q + m * (2 * Real.pi) := by linarith + refine ⟨?_, ?_, by linarith⟩ + · rw [← hshift, ← hp₁, ← hp₂] + exact dirAgrees_forward f hub h₁ hlt h₂ + · rw [← hshift, ← hp₁, ← hp₂] + exact dirAgrees_backward f hub h₁ hlt h₂ + +variable {Γ Γ' : Painting S} {Φ : Frame S} {σv : S → Set S} {σe : Set S → Set S} + +/-- An inflation that respects a frame fixes each short side, and maps each end of it to a set that +holds the end. -/ +theorem mem_σv_of_short (hf : Γ.Fits Φ) (hf' : Γ'.Fits Φ) (I : IsInflation Γ Γ' σv σe) + (R : RespectsFrame Φ Γ σe) {s : Set S} (hs : s ∈ Φ.shortSides) {v : S} + (hv : v ∈ tilde s) : v ∈ σv v := by + have hsE := hf.short_sides hs + have hsE' := hf'.short_sides hs + obtain ⟨x, hx⟩ := hs.1.1 + have hb : Painting.IsBorder s := ⟨x, hx, (hs.1.2.1 hx).1⟩ + have hsub : σe s ⊆ s := ((R s hsE hb).2 s hs.1).mp subset_rfl + have hσ : σe s = s := by + have hE := I.edge_mem s hsE + obtain ⟨y, hy⟩ := hE.1 + exact arcComp_eq_of_mem hE hsE' hy (hsub hy) + have hγ := Φ.march_eq hs.1 (Γ.γ_nodup s hsE) (Γ.γ_set s hsE) (hf.border_dir s hsE hb s hs.1 + subset_rfl) + have hγ' := Φ.march_eq hs.1 (Γ'.γ_nodup s hsE') (Γ'.γ_set s hsE') + (hf'.border_dir s hsE' hb s hs.1 subset_rfl) + obtain ⟨u, w, hm, -⟩ := Φ.exists_march hs.1 + have key := I.ends s hsE + rw [hσ, hγ', hγ, hm] at key + have hvm : v ∈ Φ.γ s := by + have : v ∈ {x | x ∈ Φ.γ s} := (Φ.γ_set s hs.1).symm ▸ hv + exact this + rw [hm] at hvm + simp only [List.mem_cons, List.not_mem_nil, or_false] at hvm + rcases hvm with rfl | rfl + · exact key 0 (by simp) (by simp) + · exact key 1 (by simp) (by simp) + +/-- An inflation that respects a frame keeps each vertex of the frame in its own set. -/ +theorem mem_σv_of_frame (hS : IsSurface S) (hf : Γ.Fits Φ) (hf' : Γ'.Fits Φ) + (I : IsInflation Γ Γ' σv σe) + (R : RespectsFrame Φ Γ σe) {v : S} (hv : v ∈ Φ.V) : v ∈ σv v := by + obtain ⟨s, hs, hvs⟩ := Φ.exists_short_side hS hv + exact mem_σv_of_short hf hf' I R hs hvs + +omit [T2Space S] in +/-- The march of an edge in a side. -/ +theorem Painting.march_of_arc (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) {x y : S} (hne : x ≠ y) + (ht : tilde e = {x, y}) : Γ.γ e = [x, y] ∨ Γ.γ e = [y, x] := + list_pair (Γ.γ_nodup e he) ((Γ.γ_set e he).trans ht) hne + +/-- The direction condition of a linear inflation holds for two edges of one side. Each edge is +directed as the side, +so if `e` runs forward along `f` then so does the side, and so does `e'`. -/ +theorem immediatelyPrecedes_transfer (hS : IsSurface S) (hf : Γ.Fits Φ) + (hf' : Γ'.Fits Φ) {e e' s : Set S} + (he : e ∈ Γ.E) (he' : e' ∈ arcComponentsIn (bd S \ Γ'.V)) (he'E : e' ∈ Γ'.E) (hs : s ∈ Φ.sides) + (hes : e ⊆ s) + (hes' : e' ⊆ s) (hb : Painting.IsBorder e) (hb' : Painting.IsBorder e') {Θ : Set S} + (hΘ : Θ ∈ cuffs S) (hsΘ : (s ∩ Θ).Nonempty) (f : Circle ≃ₜ Θ) {n n' : S} + (hn : (Γ.γ e).head? = some n) (hn' : (Γ'.γ e').head? = some n') (hp : ImmediatelyPrecedes f n + e) : + ImmediatelyPrecedes f n' e' := by + have hpi := Real.pi_pos + have hΘb : Θ ⊆ bd S := cuff_subset_bd ⟨Θ, hΘ⟩ + have hsΘ' : s ⊆ Θ := by + obtain ⟨C, a, b, -, -, hsC, -, -, -⟩ := exists_arc_of_mem hS (cuffPar hS) Φ.finite_V + (Frame.two_on_cuff hS Φ) hs + have hCC : C.1 = Θ := by + by_contra hne + obtain ⟨x, hx₁, hx₂⟩ := hsΘ + have hne' : C ≠ ⟨Θ, hΘ⟩ := fun h ↦ hne (congrArg Subtype.val h) + exact disjoint_left.mp (cuffs_disjoint' hne') (arcOf_subset _ _ _ (hsC ▸ hx₁)) hx₂ + rw [hsC] + exact hCC ▸ arcOf_subset _ _ _ + obtain ⟨p₀, hp₀, q₀, hq₀, hpq₀⟩ := Frame.two_on_cuff hS Φ ⟨Θ, hΘ⟩ + obtain ⟨a, b, hab, hub, hsab, haV, hbV⟩ := exists_arc_param hS f Φ.finite_V hp₀ hq₀ hpq₀ hΘb hs + hsΘ' + obtain ⟨t₀, t₁, ht, -, htn, he₀⟩ := hp + have he₀' : e = arcOf f t₀ t₁ := he₀ + obtain ⟨hd₁, hd₂, hut⟩ := dirAgrees_arc f hab hub ht (by rw [← he₀', ← hsab]; exact hes) + have hnet := (GM20.line_facts (isLine_arcOf f hab hub)).1 + have hγs : Φ.γ s = [cuffPoint f a, cuffPoint f b] ∨ Φ.γ s = [cuffPoint f b, cuffPoint f a] := + list_pair (Φ.γ_nodup s hs) ((Φ.γ_set s hs).trans (by rw [hsab, tilde_arcOf f hab hub])) hnet + have hdirΓ := hf.border_dir e he hb s hs hes + have hsplit : Γ.γ e = [cuffPoint f t₀, cuffPoint f t₁] := by + have hne := (GM20.line_facts (isLine_arcOf f ht hut)).1 + rcases Γ.march_of_arc he hne (by rw [he₀', tilde_arcOf f ht hut]) with h | h + · exact h + · rw [h] at hn + simp only [List.head?_cons, Option.some.injEq] at hn + exact absurd (hn.trans htn.symm) hne.symm + rw [hsplit] at hdirΓ + rw [he₀'] at hdirΓ + rcases hγs with hγs | hγs + · -- the side runs forward + rw [hγs, hsab] at hdirΓ + obtain ⟨p', hp', q', hq', hpq'⟩ := id (show ∃ p' ∈ Γ'.V ∩ Θ, ∃ q' ∈ Γ'.V ∩ Θ, p' ≠ q' from + ⟨p₀, ⟨hf'.V_subset hp₀.1, hp₀.2⟩, q₀, ⟨hf'.V_subset hq₀.1, hq₀.2⟩, hpq₀⟩) + obtain ⟨p, q, hpq, hu, hee, -, -⟩ := exists_arc_param hS f Γ'.finite_V hp' hq' hpq' hΘb he' + (hes'.trans hsΘ') + obtain ⟨hd₃, -, -⟩ := dirAgrees_arc f hab hub hpq (by rw [← hee, ← hsab]; exact hes') + have hdirΓ' := hf'.border_dir e' he'E hb' s hs hes' + have hne' := (GM20.line_facts (isLine_arcOf f hpq hu)).1 + rcases Γ'.march_of_arc he'E hne' (by rw [hee, tilde_arcOf f hpq hu]) with h | h + · rw [h] at hn' + simp only [List.head?_cons, Option.some.injEq] at hn' + exact ⟨p, q, hpq, hu.le, hn', hee⟩ + · rw [h, hγs, hsab, hee] at hdirΓ' + exact (dirAgrees_not_reverse hd₃ hdirΓ').elim + · rw [hγs, hsab] at hdirΓ + exact (dirAgrees_not_reverse hd₂ hdirΓ).elim + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5j.lean b/LeanPool/GraphMinor/GM19/Section5j.lean new file mode 100644 index 0000000000..55af2434d3 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5j.lean @@ -0,0 +1,244 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5i + +/-! +# Graph Minors XIX, proof of (5.4): the marches of the pull-back + +The map `ψ` carries the march of an edge of `Γ₁` over `bd(Σ)`, or of a lifted edge, to the march of +its image. For a +lifted edge this holds by definition. For a border edge we use that the side above it is directed as +in the paper, so +that `ψ` maps its direction to that of the side of `Φ` below it. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S S₁ : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace S₁] [T2Space S₁] + + +omit [T2Space S] [T2Space S₁] in +/-- A map that is one-to-one on the closure of `R` and carries the direction of `R` to that of `s` +carries the direction +of each part of `R` to that of `s`. -/ +theorem dirAgrees_image {ψ : S₁ → S} (hc : Continuous ψ) {R e₁ : Set S₁} {s : Set S} {γR l : List + S₁} {γs : List S} + (hd₁ : DirAgrees R γR e₁ l) (hd₂ : DirAgrees s γs (ψ '' R) (γR.map ψ)) (hinj : InjOn ψ + (closure R)) + (hcl : MapsTo ψ (closure R) (closure s)) : DirAgrees s γs (ψ '' e₁) (l.map ψ) := by + obtain ⟨f₁, t₁, t₂, h12, hsub, h01, h11, hl1, hl2⟩ := hd₁ + obtain ⟨c, t₃, t₄, h34, hsub2, hc0, hc1, hhead, hlast⟩ := hd₂ + let G : unitInterval → unitInterval := fun t ↦ c.symm ⟨ψ (f₁ t).1, hcl (f₁ t).2⟩ + have hcG : ∀ t, (c (G t)).1 = ψ (f₁ t).1 := fun t ↦ by simp [G] + have hGc : Continuous G := c.symm.continuous.comp ((hc.comp (continuous_subtype_val.comp + f₁.continuous)).subtype_mk _) + have hGi : Function.Injective G := fun a b hab ↦ by + have h := (hcG a).symm.trans ((congrArg (fun t ↦ (c t).1) hab).trans (hcG b)) + exact f₁.injective (Subtype.ext (hinj (f₁ a).2 (f₁ b).2 h)) + rw [List.head?_map, h01] at hhead + rw [List.getLast?_map, h11] at hlast + simp only [Option.map_some, Option.some.injEq] at hhead hlast + have hG0 : G ⊥ = t₃ := c.injective (Subtype.ext ((hcG _).trans hhead)) + have hG1 : G ⊤ = t₄ := c.injective (Subtype.ext ((hcG _).trans hlast)) + have hmono : StrictMono G := + hGc.strictMono_of_inj_boundedOrder (by rw [hG0, hG1]; exact h34.le) hGi + refine ⟨c, G t₁, G t₂, hmono h12, (image_mono hsub).trans hsub2, hc0, hc1, ?_, ?_⟩ + · rw [List.head?_map, hl1, hcG] + rfl + · rw [List.getLast?_map, hl2, hcG] + rfl + +variable {Φ : Frame S} {Γ : Painting S} {K : Drawing S} {ψ : S₁ → S} + +/-- The painting `ψ⁻¹(Γ) ∩ Σ₁`. -/ +noncomputable abbrev FrameData.paint [Nonempty S₁] (D : FrameData Φ Γ K ψ) (flip : Set S₁ + → Bool) : Painting S₁ := + pullPainting D.pull (D.borderMarch flip) + (fun _ hp ↦ (D.nodup_arcMarch _ D.pull.finite_pullV D.pull.two hp).1) + (fun _ hp ↦ (D.nodup_arcMarch _ D.pull.finite_pullV D.pull.two hp).2) + +/-- The frame `ψ⁻¹(Φ) ∩ Σ₁`. -/ +noncomputable abbrev FrameData.frame (D : FrameData Φ Γ K ψ) (hF : IsFeature Φ K) (flip : Set S₁ + → Bool) : Frame S₁ := + pullFrame D flip (D.long_disjoint hF) + +/-- The choice of direction of the sides of the frame of a fragment that the paper makes. -/ +def IsPaperFlip (Φ : Frame S) (K : Drawing S) (ψ : S₁ → S) (hS₁ : IsSurface S₁) (flip : Set S₁ + → Bool) : Prop := + ∀ R ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ), ∀ s ∈ Φ.sides, ψ '' R ⊆ s → + DirAgrees s (Φ.γ s) (ψ '' R) ((arcMarch hS₁ (flip R) R).map ψ) + +omit [T2Space S] in +/-- The ends of an arc of `bd(Σ₁) \ V₁` lie in `V₁`. -/ +theorem PullData.tilde_subset {Γ : Painting S} {K : Drawing S} {ψ : S₁ → S} + (d : PullData Γ K ψ) {R : Set S₁} + (hR : R ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ)) : tilde R ⊆ pullV Γ K ψ := by + obtain ⟨C, a, b, hab, hub, rfl, -, ha, hb⟩ := + exists_arc_of_mem d.frag.isSurface (cuffPar d.frag.isSurface) d.finite_pullV d.two hR + rw [tilde_arcOf _ hab hub] + rintro _ (rfl | rfl) + · exact ha + · exact hb + +namespace FrameData + +variable [Nonempty S₁] (D : FrameData Φ Γ K ψ) {flip : Set S₁ → Bool} +include D + +omit [Nonempty S₁] in +omit [T2Space S] in +/-- The march of an arc is its two ends. -/ +theorem exists_march_pair {e₁ : Set S₁} (he₁ : e₁ ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ)) + (ε : Bool) : + ∃ x y, arcMarch D.pull.frag.isSurface ε e₁ = [x, y] ∧ tilde e₁ = {x, y} := by + have hS₁ := D.pull.frag.isSurface + obtain ⟨C, a, b, hab, hub, he, -, -, -⟩ := exists_arc_of_mem hS₁ (cuffPar hS₁) + D.pull.finite_pullV D.pull.two he₁ + obtain ⟨C', a', b', hab', hub', he', hl⟩ := arcMarch_spec hS₁ ε hab hub he + have ht := tilde_arcOf (cuffPar hS₁ C') hab' hub' + rw [← he'] at ht + cases ε + · exact ⟨_, _, by simpa using hl, ht⟩ + · exact ⟨_, _, by simpa using hl, by rw [ht, pair_comm]⟩ + +omit [Nonempty S₁] in +omit [T2Space S] [T2Space S₁] in +/-- A side of the fragment that has a point over `bd(Σ)` lies over a side of `Φ`. -/ +theorem exists_side_of_bd {R : Set S₁} (hR : R ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ)) {x : + S₁} (hx : x ∈ R) + (hb : ψ x ∈ bd S) : ∃ s ∈ Φ.sides, ψ '' R ⊆ s := by + rcases D.image_side hR with h | ⟨e, he, hsub⟩ + · exact h + · have hxe := he.2.1 (hsub (mem_image_of_mem ψ hx)) + exact absurd (D.K_bd ⟨hxe.1, hb⟩) hxe.2 + +omit [Nonempty S₁] in +/-- `ψ` is one-to-one on the closure of a side of the fragment over a side of `Φ`. -/ +theorem injOn_closure_side {R : Set S₁} (hR : R ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ)) {s : + Set S} + (hs : s ∈ Φ.sides) (hsub : ψ '' R ⊆ s) : InjOn ψ (closure R) := by + have hS₁ := D.pull.frag.isSurface + obtain ⟨C, a, b, hab, hub, rfl, -, ha, hb⟩ := exists_arc_of_mem hS₁ + (cuffPar hS₁) D.finite_pullFrameV D.two hR + have hLn := isLine_arcOf (cuffPar hS₁ C) hab hub + have hne := D.image_ends_ne hR hs hsub hLn (tilde_arcOf _ hab hub) + have hmem : ∀ {x}, x ∈ closure (arcOf (cuffPar hS₁ C) a b) → x ∈ arcOf (cuffPar hS₁ C) a b ∨ + x = cuffPoint (cuffPar hS₁ C) a ∨ x = cuffPoint (cuffPar hS₁ C) b := fun {x} hx ↦ by + by_cases h : x ∈ arcOf (cuffPar hS₁ C) a b + · exact Or.inl h + · have ht : x ∈ tilde (arcOf (cuffPar hS₁ C) a b) := ⟨hx, h⟩ + rw [tilde_arcOf _ hab hub] at ht + exact Or.inr ht + have hoff : ∀ {x y}, x ∈ arcOf (cuffPar hS₁ C) a b → y ∈ pullFrameV Φ K ψ → ψ x ≠ ψ y + := fun hx hy heq ↦ + (hR.2.1 hx).2 (by + change ψ _ ∈ Φ.V ∪ K.V + rw [heq] + exact hy) + intro x hx y hy hxy + rcases hmem hx with h₁ | rfl | rfl <;> rcases hmem hy with h₂ | rfl | rfl + · exact D.injOn_side hR hR hs hs hsub hsub h₁ h₂ hxy + · exact absurd hxy (hoff h₁ ha) + · exact absurd hxy (hoff h₁ hb) + · exact absurd hxy.symm (hoff h₂ ha) + · rfl + · exact absurd hxy hne + · exact absurd hxy.symm (hoff h₂ hb) + · exact absurd hxy.symm hne + · rfl + +/-- `ψ` carries the march of a border edge of `Γ₁` over `bd(Σ)` to the march of its image. -/ +theorem map_march_border (hflip : IsPaperFlip Φ K ψ D.pull.frag.isSurface flip) {e₁ : Set S₁} + (he₁ : e₁ ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ)) {x₀ : S₁} (hx₀ : x₀ ∈ e₁) + (hb₀ : ψ x₀ ∈ bd S) : + ((D.paint flip).γ e₁).map ψ = Γ.γ (ψ '' e₁) := by + have hS₁ := D.pull.frag.isSurface + have hc := D.pull.frag.continuous_ψ + obtain ⟨he, hpre⟩ := D.pull.image_border_edge he₁ hx₀ hb₀ + obtain ⟨R, hR, hes⟩ := exists_arcComp_superset he₁.2.2.1 (F := bd S₁ \ pullFrameV Φ K ψ) + (fun x hx ↦ ⟨(he₁.2.1 hx).1, fun h ↦ (he₁.2.1 hx).2 (D.pullFrameV_subset h)⟩) + obtain ⟨s, hs, hsub⟩ := D.exists_side_of_bd hR (hes hx₀) hb₀ + have hl := D.pull.notMem_liftPieces he₁ + have hγ : (D.paint flip).γ e₁ = arcMarch hS₁ (flip R) e₁ := by + change pullγ Γ ψ _ e₁ = _ + rw [pullγ_arc hl] + change arcMarch _ (flip (sideOf Φ K ψ e₁)) e₁ = _ + rw [sideOf_eq he₁.1 hR hes] + rw [hγ] + have hd₁ := D.dirAgrees_pull flip he₁ hR hes + have hd₂ := hflip R hR s hs hsub + have hcl : MapsTo ψ (closure R) (closure s) := fun x hx ↦ + closure_mono hsub (image_closure_subset_closure_image hc (mem_image_of_mem ψ hx)) + have hT := dirAgrees_image hc hd₁ hd₂ (D.injOn_closure_side hR hs hsub) hcl + have hbd := D.pull.image_arc_subset_bd he₁ hx₀ hb₀ + obtain ⟨x, y, hl, ht⟩ := D.exists_march_pair he₁ (flip R) + have htx : x ∈ tilde e₁ := by rw [ht]; exact mem_insert _ _ + have hty : y ∈ tilde e₁ := by rw [ht]; exact mem_insert_of_mem _ rfl + have hxV := D.pull.tilde_subset he₁ htx + have hyV := D.pull.tilde_subset he₁ hty + have hx : ψ x ∉ ψ '' e₁ := by + rintro ⟨w, hw, hwx⟩ + exact (he₁.2.1 hw).2 (by change ψ w ∈ Γ.V ∪ K.V; rw [hwx]; exact hxV) + have hy : ψ y ∉ ψ '' e₁ := by + rintro ⟨w, hw, hwx⟩ + exact (he₁.2.1 hw).2 (by change ψ w ∈ Γ.V ∪ K.V; rw [hwx]; exact hyV) + have hte : tilde (ψ '' e₁) = {ψ x, ψ y} := by + rw [tilde, D.pull.frag.isClosedMap.closure_image_eq_of_continuous hc] + ext z + constructor + · rintro ⟨⟨w, hw, rfl⟩, hz⟩ + have hwt : w ∈ tilde e₁ := ⟨hw, fun hwe ↦ hz (mem_image_of_mem ψ hwe)⟩ + rw [ht] at hwt + rcases hwt with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + · rintro (rfl | rfl) + · exact ⟨mem_image_of_mem ψ htx.1, hx⟩ + · exact ⟨mem_image_of_mem ψ hty.1, hy⟩ + have hbE : Painting.IsBorder (ψ '' e₁) := ⟨ψ x₀, mem_image_of_mem ψ hx₀, hb₀⟩ + have hne : ψ x ≠ ψ y := by + intro h + have h2 := (Γ.border_edge _ he hbE).1 + rw [hte, h, pair_eq_singleton, ncard_singleton] at h2 + omega + rw [hl] + rcases Γ.march_of_arc he hne hte with h | h + · exact h.symm + · have hd := D.fits.border_dir _ he hbE s hs ((image_mono hes).trans hsub) + rw [h] at hd + rw [hl] at hT + exact (dirAgrees_not_reverse hT hd).elim + +/-- `ψ` carries the march of a lifted edge to the march of the edge. -/ +theorem map_march_lift {e : Set S} (he : e ∈ Γ.E) (hb : ¬ Painting.IsBorder e) (hne : + (ψ ⁻¹' e).Nonempty) : + ((D.paint flip).γ (ψ ⁻¹' e)).map ψ = Γ.γ e := by + have hsub := D.pull.subset_R he hb hne + have hl : ψ ⁻¹' e ∈ liftPieces Γ ψ := ⟨e, he, hb, hne, rfl⟩ + have hsur : ψ '' (ψ ⁻¹' e) = e := image_preimage_eq_of_subset (hsub.trans + (image_subset_range _ _)) + change (pullγ Γ ψ _ (ψ ⁻¹' e)).map ψ = _ + rw [pullγ_lift hl, liftMarch, hsur, List.map_map] + have himg := D.pull.frag.image_tilde_preimage hsub + conv_rhs => rw [← List.map_id (Γ.γ e)] + refine List.map_congr_left fun y hy ↦ ?_ + have hy' : y ∈ ψ '' tilde (ψ ⁻¹' e) := by + rw [himg, ← Γ.γ_set e he] + exact hy + exact Function.invFunOn_eq hy' + +end FrameData + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5k.lean b/LeanPool/GraphMinor/GM19/Section5k.lean new file mode 100644 index 0000000000..dd92a5a448 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5k.lean @@ -0,0 +1,261 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5j + +/-! +# Graph Minors XIX, proof of (5.4): one fragment + +We fix a linear inflation of the pull-back of `Γ` in the pull-back of `Γ'`, on one fragment, that +respects the frame +of the fragment. We study what it does to the edges and vertices that come from `Σ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S S₁ : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace S₁] [T2Space S₁] + + +/-- A step of a walk maps to a step or to one vertex, so reachability maps too. -/ +theorem reachable_map {A B : Type*} {G : SimpleGraph A} {G' : SimpleGraph B} (m : A → B) + (h : ∀ a b, G.Adj a b → m a = m b ∨ G'.Adj (m a) (m b)) {a b : A} (hr : G.Reachable a b) : + G'.Reachable (m a) (m b) := by + obtain ⟨w⟩ := hr + induction w with + | nil => exact SimpleGraph.Reachable.refl _ + | cons hadj _ ih => + rcases h _ _ hadj with heq | hadj' + · rw [heq] + exact ih + · exact hadj'.reachable.trans ih + +variable {Φ : Frame S} {Γ Γ' : Painting S} {K : Drawing S} {ψ : S₁ → S} + +/-- The edges of the pull-back. -/ +theorem FrameData.mem_paint_E [Nonempty S₁] (D : FrameData Φ Γ K ψ) (flip : Set S₁ + → Bool) {p : Set S₁} : + p ∈ (D.paint flip).E ↔ p ∈ pullPieces Γ K ψ := by + change p ∈ arcComponentsIn (pullU Γ ψ \ pullV Γ K ψ) ↔ _ + rw [D.pull.arcComponentsIn_eq] + +/-- `tilde` of the image of a boundary arc over `bd(Σ)`. -/ +theorem PullData.tilde_image_arc (d : PullData Γ K ψ) {e₁ : Set S₁} (he₁ : e₁ ∈ arcComponentsIn + (bd S₁ \ pullV Γ K ψ)) : + tilde (ψ '' e₁) = ψ '' tilde e₁ := by + have hc := d.frag.continuous_ψ + rw [tilde, d.frag.isClosedMap.closure_image_eq_of_continuous hc] + ext z + constructor + · rintro ⟨⟨w, hw, rfl⟩, hz⟩ + exact ⟨w, ⟨hw, fun hwe ↦ hz (mem_image_of_mem ψ hwe)⟩, rfl⟩ + · rintro ⟨w, hw, rfl⟩ + refine ⟨mem_image_of_mem ψ hw.1, ?_⟩ + rintro ⟨w', hw', hww⟩ + exact (he₁.2.1 hw').2 (by + change ψ w' ∈ Γ.V ∪ K.V + rw [hww] + exact d.tilde_subset he₁ hw) + +/-- A linear inflation on a fragment, with the facts that the proof of (5.4) needs of it. -/ +structure FragInflation [Nonempty S₁] (D : FrameData Φ Γ K ψ) (D' : FrameData Φ Γ' K ψ) + (hF : IsFeature Φ K) + (flip : Set S₁ → Bool) (σv : S₁ → Set S₁) (σe : Set S₁ → Set S₁) : Prop where + inflation : IsLinearInflation (D.paint flip) (D'.paint flip) σv σe + respects : RespectsFrame (D.frame hF flip) (D.paint flip) σe + flip_spec : IsPaperFlip Φ K ψ D.pull.frag.isSurface flip + fits : (D.paint flip).Fits (D.frame hF flip) + fits' : (D'.paint flip).Fits (D.frame hF flip) + same_V : ∀ v ∈ K.V, v ∈ Γ.V ↔ v ∈ Γ'.V + +namespace FragInflation + +variable [Nonempty S₁] {D : FrameData Φ Γ K ψ} {D' : FrameData Φ Γ' K ψ} {hF : IsFeature Φ K} + {flip : Set S₁ → Bool} {σv : S₁ → Set S₁} {σe : Set S₁ → Set S₁} (G : FragInflation D D' hF flip + σv σe) +include G + +/-- A vertex of the frame lies in its own set. -/ +theorem mem_frame {x : S₁} (hx : x ∈ pullFrameV Φ K ψ) : x ∈ σv x := + mem_σv_of_frame D.pull.frag.isSurface G.fits G.fits' G.inflation.toIsInflation G.respects hx + +/-- A vertex of the frame in the set of `y` is `y`. -/ +theorem eq_of_mem_frame {x y : S₁} (hx : x ∈ pullFrameV Φ K ψ) (hy : y ∈ pullV Γ K ψ) + (hxy : x ∈ σv y) : x = y := by + by_contra hne + exact disjoint_left.mp (G.inflation.vertex_disjoint x (D.pullFrameV_subset hx) y hy hne) + (G.mem_frame hx) hxy + +/-- The image under `σ'` of a lifted edge is a lifted edge. -/ +theorem sigma_lift {e : Set S} (he : e ∈ Γ.E) (hb : ¬ Painting.IsBorder e) (hne : + (ψ ⁻¹' e).Nonempty) : + ∃ e' ∈ Γ'.E, ¬ Painting.IsBorder e' ∧ σe (ψ ⁻¹' e) = ψ ⁻¹' e' ∧ (ψ ⁻¹' e').Nonempty ∧ + (tilde e').ncard = (tilde e).ncard := by + have hE : ψ ⁻¹' e ∈ (D.paint flip).E := (D.mem_paint_E flip).mpr (Or.inr ⟨e, he, hb, hne, rfl⟩) + have hsub := D.pull.subset_R he hb hne + have hfE := G.inflation.edge_mem _ hE + have hnb : ¬ Painting.IsBorder (σe (ψ ⁻¹' e)) := by + rintro ⟨x, hx, hxb⟩ + obtain ⟨Θ, hΘ, hxΘ⟩ := sUnion_cuffs (S := S₁) ▸ hxb + obtain ⟨y, hy, hyΘ⟩ := (G.inflation.borders_iff _ hE Θ hΘ).mpr ⟨x, hx, hxΘ⟩ + exact D.pull.preimage_subset_int hsub hy (cuff_subset_bd ⟨Θ, hΘ⟩ hyΘ) + rcases (D'.mem_paint_E flip).mp hfE with hp | ⟨e', he', hb', hne', hfeq⟩ + · obtain ⟨x, hx⟩ := hp.1 + exact absurd ⟨x, hx, (hp.2.1 hx).1⟩ hnb + · have hne'' : (ψ ⁻¹' e').Nonempty := hfeq ▸ hne' + refine ⟨e', he', hb', hfeq, hne'', ?_⟩ + have hsize := G.inflation.edge_size _ hE + rw [hfeq] at hsize + have h₁ := D'.pull.ncard_tilde he' (D'.pull.subset_R he' hb' hne'') + have h₂ := D.pull.ncard_tilde he hsub + rw [← h₁, ← h₂] + exact hsize + +/-- The image under `σ'` of a border edge over `bd(Σ)` is a border edge in the same side. -/ +theorem sigma_border {e₁ : Set S₁} (he₁ : e₁ ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ)) {x₀ : S₁} + (hx₀ : x₀ ∈ e₁) + (hb₀ : ψ x₀ ∈ bd S) : + σe e₁ ∈ arcComponentsIn (bd S₁ \ pullV Γ' K ψ) ∧ ∃ s ∈ Φ.sides, ψ '' e₁ ⊆ s ∧ ψ '' σe e₁ ⊆ s + := by + have hE : e₁ ∈ (D.paint flip).E := (D.mem_paint_E flip).mpr (Or.inl he₁) + have hbb : Painting.IsBorder e₁ := ⟨x₀, hx₀, (he₁.2.1 hx₀).1⟩ + obtain ⟨R, hR, hes⟩ := exists_arcComp_superset he₁.2.2.1 (F := bd S₁ \ pullFrameV Φ K ψ) + (fun x hx ↦ ⟨(he₁.2.1 hx).1, fun h ↦ (he₁.2.1 hx).2 (D.pullFrameV_subset h)⟩) + obtain ⟨s, hs, hsub⟩ := D.exists_side_of_bd hR (hes hx₀) hb₀ + have hfR : σe e₁ ⊆ R := ((G.respects e₁ hE hbb).2 R hR).mp hes + have hfE := G.inflation.edge_mem _ hE + rcases (D'.mem_paint_E flip).mp hfE with hp | ⟨e', he', hb', hne', hfeq⟩ + · exact ⟨hp, s, hs, (image_mono hes).trans hsub, (image_mono hfR).trans hsub⟩ + · exfalso + obtain ⟨x, hxf⟩ := hne' + have hx : x ∈ ψ ⁻¹' e' := hfeq ▸ hxf + exact D'.pull.preimage_subset_int (D'.pull.subset_R he' hb' ⟨x, hx⟩) hx (hR.2.1 (hfR hxf)).1 + +/-- All that an edge of `Γ` with a lift to the fragment needs. -/ +theorem edge_main {e : Set S} (he : e ∈ Γ.E) (hne : (ψ ⁻¹' e).Nonempty) : + ψ '' (ψ ⁻¹' e) = e ∧ ψ ⁻¹' e ∈ (D.paint flip).E ∧ ψ '' σe (ψ ⁻¹' e) ∈ Γ'.E ∧ + ψ ⁻¹' (ψ '' σe (ψ ⁻¹' e)) = σe (ψ ⁻¹' e) ∧ (tilde (ψ '' σe (ψ ⁻¹' e))).ncard = + (tilde e).ncard ∧ + ((D'.paint flip).γ (σe (ψ ⁻¹' e))).map ψ = Γ'.γ (ψ '' σe (ψ ⁻¹' e)) ∧ + ((D.paint flip).γ (ψ ⁻¹' e)).map ψ = Γ.γ e ∧ + (Painting.IsBorder e → ∃ s ∈ Φ.sides, e ⊆ s ∧ ψ '' σe (ψ ⁻¹' e) ⊆ s ∧ Painting.IsBorder + (ψ '' σe (ψ ⁻¹' e))) ∧ + (¬ Painting.IsBorder e → ¬ Painting.IsBorder (ψ '' σe (ψ ⁻¹' e))) := by + by_cases hb : Painting.IsBorder e + · have hbe : e ⊆ bd S := (Γ.border_edge e he hb).2 + obtain ⟨x, hx⟩ := hne + obtain ⟨he₁, hsur⟩ := D.pull.preimage_border_edge he hbe hx + have hE : ψ ⁻¹' e ∈ (D.paint flip).E := (D.mem_paint_E flip).mpr (Or.inl he₁) + obtain ⟨hf, s, hs, hs₁, hs₂⟩ := G.sigma_border he₁ hx (hbe hx) + obtain ⟨y, hy⟩ := hf.1 + have hyb : ψ y ∈ bd S := (hs.2.1 (hs₂ (mem_image_of_mem ψ hy))).1 + obtain ⟨hE', hpre⟩ := D'.pull.image_border_edge hf hy hyb + have hbE' : Painting.IsBorder (ψ '' σe (ψ ⁻¹' e)) := ⟨ψ y, mem_image_of_mem ψ hy, hyb⟩ + refine ⟨hsur, hE, hE', hpre, ?_, ?_, ?_, + fun _ ↦ ⟨s, hs, hsur ▸ hs₁, hs₂, hbE'⟩, fun h ↦ absurd hb h⟩ + · rw [(Γ'.border_edge _ hE' hbE').1, (Γ.border_edge e he hb).1] + · exact D'.map_march_border G.flip_spec hf hy hyb + · have := D.map_march_border G.flip_spec he₁ hx (hbe hx) + rwa [hsur] at this + · obtain ⟨e', he', hb', hfeq, hne', hsize⟩ := G.sigma_lift he hb hne + have hsub := D.pull.subset_R he hb hne + have hsub' := D'.pull.subset_R he' hb' hne' + have hsur' : ψ '' (ψ ⁻¹' e') = e' := image_preimage_eq_of_subset (hsub'.trans + (image_subset_range _ _)) + rw [hfeq, hsur'] + exact ⟨image_preimage_eq_of_subset (hsub.trans (image_subset_range _ _)), + (D.mem_paint_E flip).mpr (Or.inr ⟨e, he, hb, hne, rfl⟩), he', rfl, hsize, + D'.map_march_lift he' hb' hne', D.map_march_lift he hb hne, fun h ↦ absurd h hb, fun _ ↦ hb'⟩ + +omit G in +/-- Three kinds of edge of the pull-back of `Γ'`, as seen from an end. -/ +theorem edge_ends {a : S₁} {e : Set S₁} (he : e ∈ (D'.paint flip).E) (ha : a ∈ tilde e) : + ψ a ∈ Γ'.V ∨ a ∈ pullFrameV Φ K ψ := by + have hV : a ∈ pullV Γ' K ψ := by + have := (D'.paint flip).tilde_subset_V he ha + exact this + rcases hV with h | h + · exact Or.inl h + · exact Or.inr (Or.inr h) + +omit G in +/-- The two ends of an edge of the pull-back of `Γ'` map to the ends of an edge of `Γ'`, or lie both +in the frame. In the +second case the edge lies over `U(K)`. -/ +theorem ends_image {a b : S₁} {e : Set S₁} (he : e ∈ (D'.paint flip).E) (hae : a ∈ tilde e) + (hbe : b ∈ tilde e) : + (∃ e' ∈ Γ'.E, ψ a ∈ tilde e' ∧ ψ b ∈ tilde e') ∨ (a ∈ pullFrameV Φ K ψ ∧ b ∈ pullFrameV Φ K ψ) + := by + rcases (D'.mem_paint_E flip).mp he with hp | ⟨e', he', hb', hne', rfl⟩ + · by_cases hover : ∃ x₀ ∈ e, ψ x₀ ∈ bd S + · obtain ⟨x₀, hx₀, hb₀⟩ := hover + refine Or.inl ⟨ψ '' e, (D'.pull.image_border_edge hp hx₀ hb₀).1, ?_, ?_⟩ + · rw [D'.pull.tilde_image_arc hp] + exact mem_image_of_mem ψ hae + · rw [D'.pull.tilde_image_arc hp] + exact mem_image_of_mem ψ hbe + · -- `e` lies over `U(K)`, so its two ends are in the frame + push Not at hover + have hsubK : ψ '' e ⊆ K.U := by + rintro _ ⟨x, hx, rfl⟩ + exact (D'.pull.frag.maps_bd (mem_image_of_mem ψ (hp.2.1 hx).1)).resolve_left (hover x hx) + have hc := D'.pull.frag.continuous_ψ + have hclK : ∀ {w}, w ∈ tilde e → w ∈ pullFrameV Φ K ψ := by + intro w hw + have hw₁ : ψ w ∈ K.U := closure_minimal hsubK K.isClosed_U + (image_closure_subset_closure_image hc (mem_image_of_mem ψ hw.1)) + have hwV := D'.pull.tilde_subset hp hw + rcases hwV with h | h + · exact Or.inr (D'.pull.inter ⟨Γ'.V_subset h, hw₁⟩).2 + · exact Or.inr h + exact Or.inr ⟨hclK hae, hclK hbe⟩ + · have hsub' := D'.pull.subset_R he' hb' hne' + have himg := D'.pull.frag.image_tilde_preimage hsub' + exact Or.inl ⟨e', he', himg ▸ mem_image_of_mem ψ hae, himg ▸ mem_image_of_mem ψ hbe⟩ + +/-- A step in `sk(Γ₂)` inside the set of a vertex maps to a step of `sk(Γ')`, or to one vertex. An +edge over `U(K)` has +its two ends in the frame, so it is not inside the set of a vertex. -/ +theorem sk_step {y : S₁} (hy : y ∈ pullV Γ K ψ) {a b : S₁} (ha : a ∈ σv y) (hb : b ∈ σv y) + (hVa : ψ a ∈ Γ'.V) (hVb : ψ b ∈ Γ'.V) (hadj : (D'.paint flip).skAdj.Adj a b) : + ψ a = ψ b ∨ Γ'.skAdj.Adj (ψ a) (ψ b) := by + obtain ⟨hne, -, -, e, he, hae, hbe⟩ := hadj + by_cases hab : ψ a = ψ b + · exact Or.inl hab + refine Or.inr ⟨hab, hVa, hVb, ?_⟩ + rcases ends_image he hae hbe with h | ⟨h₁, h₂⟩ + · exact h + · exact absurd ((G.eq_of_mem_frame h₁ hy ha).trans (G.eq_of_mem_frame h₂ hy hb).symm) hne + +/-- If a vertex `y` of the frame does not lie over a vertex of `Γ`, then its set is `{y}`. It lies +over a point that is +no vertex of `Γ'`, so each edge at `y` lies over `U(K)`, and its other end is another frame vertex. +-/ +theorem eq_of_not_V {y a : S₁} (hy : y ∈ pullV Γ K ψ) (hyF : y ∈ pullFrameV Φ K ψ) + (hyV : ψ y ∉ Γ.V) (ha : a ∈ σv y) : + a = y := by + have hyK : ψ y ∈ K.V := hyF.resolve_left fun h ↦ hyV (D.fits.V_subset h) + have hyy := G.mem_frame hyF + obtain ⟨w⟩ := G.inflation.vertex_connected y hy ⟨y, hyy⟩ ⟨a, ha⟩ + cases w with + | nil => rfl + | @cons _ c _ hadj _ => + exfalso + obtain ⟨hne, -, -, e, he, hae, hbe⟩ := hadj + rcases ends_image he hae hbe with ⟨e', he', hy', -⟩ | ⟨-, h₂⟩ + · exact hyV ((G.same_V _ hyK).mpr (Γ'.tilde_subset_V he' hy')) + · exact hne (G.eq_of_mem_frame h₂ hy c.2).symm + +end FragInflation + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5l.lean b/LeanPool/GraphMinor/GM19/Section5l.lean new file mode 100644 index 0000000000..b6e90d5854 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5l.lean @@ -0,0 +1,350 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5k + +/-! +# Graph Minors XIX, proof of (5.4): gluing inflations + +The proofs of (5.4) and (5.5) end alike: linear inflations of the fragments give a linear inflation +of `Γ` in `Γ'`, by +`σ(e) = ψ(σ'(ψ⁻¹(e)))` and `V(σ(v)) = ⋃ ψ(V(σ'(v')))` over the points `v'` over `v`. The paper says +that it is easy to +deduce this. We do it here for any family of fragments. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] [T2Space S] + + +/-- The sides of a frame lie in one cuff. -/ +theorem side_subset_cuff (hS : IsSurface S) (Φ : Frame S) {s : Set S} + (hs : s ∈ Φ.sides) {Θ : Set S} (hΘ : Θ ∈ cuffs S) + (hsΘ : (s ∩ Θ).Nonempty) : s ⊆ Θ := by + obtain ⟨C, a, b, -, -, hsC, -, -, -⟩ := exists_arc_of_mem hS (cuffPar hS) Φ.finite_V + (Frame.two_on_cuff hS Φ) hs + have hCC : C.1 = Θ := by + by_contra hne + obtain ⟨x, hx₁, hx₂⟩ := hsΘ + have hne' : C ≠ ⟨Θ, hΘ⟩ := fun h ↦ hne (congrArg Subtype.val h) + exact disjoint_left.mp (cuffs_disjoint' hne') (arcOf_subset _ _ _ (hsC ▸ hx₁)) hx₂ + rw [hsC] + exact hCC ▸ arcOf_subset _ _ _ + +omit [T2Space S] in +/-- An edge in the boundary is an arc of `bd(Σ) \ V`. -/ +theorem Painting.mem_arcs_of_subset (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) (hb : e ⊆ bd S) : + e ∈ arcComponentsIn (bd S \ Γ.V) := + ⟨he.1, fun _ hx ↦ ⟨hb hx, (he.2.1 hx).2⟩, he.2.2.1, fun D hD hc hsub ↦ + he.2.2.2 D (fun _ hx ↦ ⟨Γ.bd_subset (hD hx).1, (hD hx).2⟩) hc hsub⟩ + +variable {ι : Type} {Y : ι → Type} [∀ t, TopologicalSpace (Y t)] [∀ t, T2Space + (Y t)] [∀ t, Nonempty (Y t)] + {ψ : ∀ t, Y t → S} + +/-- The sets `σ(v)` of the glued inflation. -/ +def glueV (ψ : ∀ t, Y t → S) (σv : ∀ t, Y t → Set (Y t)) (v : S) : Set S := + ⋃ t, ⋃ y ∈ ψ t ⁻¹' {v}, ψ t '' σv t y + +/-- The edges `σ(e)` of the glued inflation. -/ +def glueE (ψ : ∀ t, Y t → S) (σe : ∀ t, Set (Y t) → Set (Y t)) (e : Set S) : Set S := + ⋃ t, ⋃ _ : (ψ t ⁻¹' e).Nonempty, ψ t '' σe t (ψ t ⁻¹' e) + +variable {Φ : Frame S} {Γ Γ' : Painting S} {K : Drawing S} {D : ∀ t, FrameData Φ Γ K (ψ t)} + {D' : ∀ t, FrameData Φ Γ' K (ψ t)} {hF : IsFeature Φ K} {flip : ∀ t, Set (Y t) → Bool} + {σv : ∀ t, Y t → Set (Y t)} {σe : ∀ t, Set (Y t) → Set (Y t)} + +/-- The fragments cover `Σ`, and off `U(K)` each point has one point over it. -/ +structure IsCover (K : Drawing S) (ψ : ∀ t, Y t → S) : Prop where + surj : ∀ x, ∃ t y, ψ t y = x + one : ∀ t t' (y : Y t) (y' : Y t'), ψ t y = ψ t' y' → ψ t y ∉ K.U → (⟨t, y⟩ : Sigma Y) = ⟨t', y'⟩ + +/-- Off `U(K)` each point has at most one point over it. -/ +structure IsOneOff (K : Drawing S) (ψ : ∀ t, Y t → S) : Prop where + one : ∀ t t' (y : Y t) (y' : Y t'), ψ t y = ψ t' y' → ψ t y ∉ K.U → (⟨t, y⟩ : Sigma Y) = ⟨t', y'⟩ + +omit [T2Space S] [∀ (t : ι), T2Space (Y t)] [∀ (t : ι), Nonempty (Y t)] in +omit [(t : ι) → TopologicalSpace (Y t)] in +theorem IsCover.off {K : Drawing S} {ψ : ∀ t, Y t → S} (h : IsCover K ψ) : IsOneOff K ψ := ⟨h.one⟩ + +section + +variable (G : ∀ t, FragInflation (D t) (D' t) hF (flip t) (σv t) (σe t)) (hC : IsOneOff K ψ) +include G hC + +theorem glueE_eq {e : Set S} (he : e ∈ Γ.E) {t : ι} (hne : (ψ t ⁻¹' e).Nonempty) : + glueE ψ σe e = ψ t '' σe t (ψ t ⁻¹' e) := by + have huniq : ∀ t', (ψ t' ⁻¹' e).Nonempty → t' = t := by + rintro t' ⟨x', hx'⟩ + have hsur := (G t).edge_main he hne + obtain ⟨x, hx, hxx⟩ : ψ t' x' ∈ ψ t '' (ψ t ⁻¹' e) := by + rw [hsur.1] + exact hx' + have hoff : ψ t' x' ∉ K.U := fun hK ↦ Γ.disjoint_V he hx' ((D t).pull.inter ⟨(he.2.1 hx').1, + hK⟩).1 + exact congrArg Sigma.fst (hC.one t' t x' x hxx.symm hoff) + ext z + simp only [glueE, mem_iUnion] + constructor + · rintro ⟨t', hne', hz⟩ + exact huniq t' hne' ▸ hz + · exact fun hz ↦ ⟨t, hne, hz⟩ + +omit hC in +/-- The set of a vertex of `Γ` maps into `V(Γ')`. -/ +theorem piece_subset {t : ι} {y x : Y t} (hy : ψ t y ∈ Γ.V) (hx : x ∈ σv t y) : ψ t x ∈ Γ'.V := by + have hV : x ∈ pullV Γ' K (ψ t) := (G t).inflation.vertex_subset y (Or.inl hy) hx + rcases hV with h | h + · exact h + · have heq := (G t).eq_of_mem_frame (Or.inr h) (Or.inl hy) hx + exact ((G t).same_V _ h).mp (heq ▸ hy) + +/-- Each set `σ(v)` is connected. Two different points over `v` lie in the frame, so each piece +holds `v`. -/ +theorem glue_connected {v : S} (hv : v ∈ Γ.V) : (Γ'.skAdj.induce (glueV ψ σv v)).Preconnected := by + let T := glueV ψ σv v + have hmem : ∀ t y x, ψ t y = v → x ∈ σv t y → ψ t x ∈ T := fun t y x hy hx ↦ + mem_iUnion.mpr ⟨t, mem_iUnion₂.mpr ⟨y, hy, mem_image_of_mem _ hx⟩⟩ + have key : ∀ t y (hy : ψ t y = v) a b (ha : a ∈ σv t y) (hb : b ∈ σv t y), + (Γ'.skAdj.induce T).Reachable ⟨ψ t a, hmem t y a hy ha⟩ ⟨ψ t b, hmem t y b hy hb⟩ := by + intro t y hy a b ha hb + have hVy : ψ t y ∈ Γ.V := hy ▸ hv + have hyp : y ∈ pullV Γ K (ψ t) := Or.inl hVy + refine reachable_map (G := ((D' t).paint (flip t)).skAdj.induce (σv t y)) + (fun c : ↥(σv t y) ↦ (⟨ψ t c.1, hmem t y c.1 hy c.2⟩ : ↥T)) (fun c d hadj ↦ ?_) + ((G t).inflation.vertex_connected y hyp ⟨a, ha⟩ ⟨b, hb⟩) + rcases (G t).sk_step hyp c.2 d.2 (piece_subset G hVy c.2) (piece_subset G hVy d.2) hadj with h + | h + · exact Or.inl (Subtype.ext h) + · exact Or.inr h + rintro ⟨u, hu⟩ ⟨u', hu'⟩ + obtain ⟨t, hu⟩ := mem_iUnion.mp hu + obtain ⟨y, hy, x, hx, rfl⟩ := mem_iUnion₂.mp hu + obtain ⟨t', hu'⟩ := mem_iUnion.mp hu' + obtain ⟨y', hy', x', hx', rfl⟩ := mem_iUnion₂.mp hu' + have hy₀ : ψ t y = v := hy + have hy₀' : ψ t' y' = v := hy' + by_cases hsame : (⟨t, y⟩ : Sigma Y) = ⟨t', y'⟩ + · cases hsame + exact key t y hy₀ x x' hx hx' + · have hvK : v ∈ K.U := by + by_contra hn + exact hsame (hC.one t t' y y' (hy₀.trans hy₀'.symm) (hy₀ ▸ hn)) + have hvKV : v ∈ K.V := ((D t).pull.inter ⟨Γ.V_subset hv, hvK⟩).2 + have hF₁ : y ∈ pullFrameV Φ K (ψ t) := Or.inr (hy₀ ▸ hvKV) + have hF₂ : y' ∈ pullFrameV Φ K (ψ t') := Or.inr (hy₀' ▸ hvKV) + have h₁ := key t y hy₀ x y hx ((G t).mem_frame hF₁) + have h₂ := key t' y' hy₀' y' x' ((G t').mem_frame hF₂) hx' + have hee : (⟨ψ t y, hmem t y y hy₀ ((G t).mem_frame hF₁)⟩ : ↥T) = + ⟨ψ t' y', hmem t' y' y' hy₀' ((G t').mem_frame hF₂)⟩ := Subtype.ext (hy₀.trans hy₀'.symm) + exact h₁.trans (hee ▸ h₂) + +/-- Different vertices have disjoint sets. -/ +theorem glue_disjoint {v₁ v₂ : S} (hv₁ : v₁ ∈ Γ.V) (hv₂ : v₂ ∈ Γ.V) (hne : v₁ ≠ v₂) : + Disjoint (glueV ψ σv v₁) (glueV ψ σv v₂) := by + refine disjoint_left.mpr fun z hz₁ hz₂ ↦ ?_ + obtain ⟨t, hu⟩ := mem_iUnion.mp hz₁ + obtain ⟨y, hy, x, hx, rfl⟩ := mem_iUnion₂.mp hu + obtain ⟨t', hu'⟩ := mem_iUnion.mp hz₂ + obtain ⟨y', hy', x', hx', hxx⟩ := mem_iUnion₂.mp hu' + have hy₀ : ψ t y = v₁ := hy + have hy₀' : ψ t' y' = v₂ := hy' + by_cases hK : ψ t x ∈ K.U + · have hxV := piece_subset G (hy₀ ▸ hv₁) hx + have hxKV : ψ t x ∈ K.V := ((D' t).pull.inter ⟨Γ'.V_subset hxV, hK⟩).2 + have h₁ := (G t).eq_of_mem_frame (Or.inr hxKV) (Or.inl (hy₀ ▸ hv₁)) hx + have h₂ := (G t').eq_of_mem_frame (Or.inr (hxx ▸ hxKV)) (Or.inl (hy₀' ▸ hv₂)) hx' + exact hne (by rw [← hy₀, ← hy₀', ← h₁, ← h₂, hxx]) + · have hs := hC.one t t' x x' hxx.symm hK + cases hs + by_contra - + have hyy : y ≠ y' := fun h ↦ hne (by rw [← hy₀, ← hy₀', h]) + exact disjoint_left.mp ((G t).inflation.vertex_disjoint y (Or.inl (hy₀ ▸ hv₁)) y' (Or.inl + (hy₀' ▸ hv₂)) hyy) hx hx' + +end + +section + +variable (G : ∀ t, FragInflation (D t) (D' t) hF (flip t) (σv t) (σe t)) (hC : IsCover K ψ) +include G hC + +omit G in +omit [T2Space S] [∀ (t : ι), T2Space (Y t)] [∀ (t : ι), Nonempty (Y t)] in +omit [(t : ι) → TopologicalSpace (Y t)] in +theorem exists_lift {e : Set S} (he : e ∈ Γ.E) : ∃ t, (ψ t ⁻¹' e).Nonempty := by + obtain ⟨x, hx⟩ := he.1 + obtain ⟨t, y, rfl⟩ := hC.surj x + exact ⟨t, y, hx⟩ + +/-- **The glued inflation respects the frame.** -/ +theorem glue_respects : RespectsFrame Φ Γ (glueE ψ σe) := by + intro e he hb + obtain ⟨t, hne⟩ := exists_lift hC he + rw [glueE_eq G hC.off he hne] + have hm := (G t).edge_main he hne + obtain ⟨-, -, hE', -, -, -, -, hb₁, -⟩ := hm + obtain ⟨s, hs, hes, hgs, hbg⟩ := hb₁ hb + refine ⟨hbg, fun s' hs' ↦ ⟨fun h ↦ ?_, fun h ↦ ?_⟩⟩ + · obtain ⟨x, hx⟩ := he.1 + have : s' = s := GM11.arcComponent_eq hs' hs (h hx) (hes hx) + exact this ▸ hgs + · obtain ⟨x, hx⟩ := hE'.1 + have : s' = s := GM11.arcComponent_eq hs' hs (h hx) (hgs hx) + exact this ▸ hes + +/-- **The glued inflation is linear.** -/ +theorem glue_linear : IsLinearInflation Γ Γ' (glueV ψ σv) (glueE ψ σe) := by + refine ⟨⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩, ?_, ?_, ?_⟩ + · intro e he + obtain ⟨t, hne⟩ := exists_lift hC he + rw [glueE_eq G hC.off he hne] + exact ((G t).edge_main he hne).2.2.1 + · intro e he + obtain ⟨t, hne⟩ := exists_lift hC he + rw [glueE_eq G hC.off he hne] + exact ((G t).edge_main he hne).2.2.2.2.1 + · intro e he e' he' heq + obtain ⟨t, hne⟩ := exists_lift hC he + obtain ⟨t', hne'⟩ := exists_lift hC he' + have heq' := heq + rw [glueE_eq G hC.off he hne, glueE_eq G hC.off he' hne'] at heq' + obtain ⟨hsur, hE₁, hE', hpre, -⟩ := (G t).edge_main he hne + obtain ⟨hsur', hE₁', hE'', hpre', -⟩ := (G t').edge_main he' hne' + obtain ⟨_, x, hx, rfl⟩ := hE'.1 + obtain ⟨x', hx', hxx⟩ : ψ t x ∈ ψ t' '' σe t' (ψ t' ⁻¹' e') := heq' ▸ mem_image_of_mem _ hx + have hoff : ψ t x ∉ K.U := fun hK ↦ + Γ'.disjoint_V hE' (mem_image_of_mem _ hx) ((D' t).pull.inter ⟨(hE'.2.1 + (mem_image_of_mem _ hx)).1, hK⟩).1 + have hs := hC.one t t' x x' hxx.symm hoff + cases hs + have hf : σe t (ψ t ⁻¹' e) = σe t (ψ t ⁻¹' e') := by + rw [← hpre, ← hpre', heq'] + have he₁ := (G t).inflation.edge_injOn hE₁ hE₁' hf + rw [← hsur, he₁, hsur'] + · intro v hv + obtain ⟨t, y, rfl⟩ := hC.surj v + obtain ⟨x, hx⟩ := (G t).inflation.vertex_nonempty y (Or.inl hv) + exact ⟨ψ t x, mem_iUnion.mpr ⟨t, mem_iUnion₂.mpr ⟨y, rfl, mem_image_of_mem _ hx⟩⟩⟩ + · intro v hv z hz + obtain ⟨t, hu⟩ := mem_iUnion.mp hz + obtain ⟨y, hy, x, hx, rfl⟩ := mem_iUnion₂.mp hu + have hy₀ : ψ t y = v := hy + exact piece_subset G (hy₀ ▸ hv) hx + · exact fun v hv ↦ glue_connected G hC.off hv + · exact fun v₁ hv₁ v₂ hv₂ hne ↦ glue_disjoint G hC.off hv₁ hv₂ hne + · intro e he i hi hi' + obtain ⟨t, hne⟩ := exists_lift hC he + have heq := glueE_eq G hC.off he hne + obtain ⟨hsur, hE₁, hE', hpre, hsize, hm', hm, -⟩ := (G t).edge_main he hne + have hi₁ : i < ((D t).paint (flip t) |>.γ (ψ t ⁻¹' e)).length := by + rw [← List.length_map (f := ψ t), hm] + exact hi + have hi₂ : i < ((D' t).paint (flip t) |>.γ (σe t (ψ t ⁻¹' e))).length := by + rw [← List.length_map (f := ψ t), hm', ← heq] + exact hi' + have hx := (G t).inflation.ends _ hE₁ i hi₁ hi₂ + have e₁ : (Γ.γ e)[i] = ψ t ((D t).paint (flip t) |>.γ (ψ t ⁻¹' e))[i] := by + simp only [← hm, List.getElem_map] + have e₂ : (Γ'.γ (glueE ψ σe e))[i] = ψ t ((D' t).paint (flip t) |>.γ (σe t (ψ t ⁻¹' e)))[i] + := by + simp only [heq, ← hm', List.getElem_map] + rw [e₁, e₂] + exact mem_iUnion.mpr ⟨t, mem_iUnion₂.mpr ⟨_, rfl, mem_image_of_mem _ hx⟩⟩ + · intro e he Θ hΘ + obtain ⟨t, hne⟩ := exists_lift hC he + have hS := (D t).pull.surface + have hΘb : Θ ⊆ bd S := cuff_subset_bd ⟨Θ, hΘ⟩ + rw [glueE_eq G hC.off he hne] + obtain ⟨-, -, hE', -, -, -, -, hb₁, hb₂⟩ := (G t).edge_main he hne + by_cases hb : Painting.IsBorder e + · obtain ⟨s, hs, hes, hgs, -⟩ := hb₁ hb + obtain ⟨x, hx⟩ := he.1 + obtain ⟨z, hz⟩ := hE'.1 + constructor + · rintro ⟨w, hw₁, hw₂⟩ + exact ⟨z, hz, side_subset_cuff hS Φ hs hΘ ⟨w, hes hw₁, hw₂⟩ (hgs hz)⟩ + · rintro ⟨w, hw₁, hw₂⟩ + exact ⟨x, hx, side_subset_cuff hS Φ hs hΘ ⟨w, hgs hw₁, hw₂⟩ (hes hx)⟩ + · constructor + · rintro ⟨w, hw₁, hw₂⟩ + exact absurd ⟨w, hw₁, hΘb hw₂⟩ hb + · rintro ⟨w, hw₁, hw₂⟩ + exact absurd ⟨w, hw₁, hΘb hw₂⟩ (hb₂ hb) + · intro e' he' hb' hnot + have hsub' := (Γ'.border_edge e' he' hb').2 + obtain ⟨x, hx⟩ := he'.1 + obtain ⟨t, y, rfl⟩ := hC.surj x + have hyl : y ∈ ψ t ⁻¹' e' := hx + obtain ⟨hp, hsur⟩ := (D' t).pull.preimage_border_edge he' hsub' hyl + have hpE : ψ t ⁻¹' e' ∈ ((D' t).paint (flip t)).E := ((D' t).mem_paint_E (flip t)).mpr + (Or.inl hp) + have hyb : y ∈ bd (Y t) := (hp.2.1 hyl).1 + have hpb : Painting.IsBorder (ψ t ⁻¹' e') := ⟨y, hyl, hyb⟩ + have hpn : ψ t ⁻¹' e' ∉ σe t '' ((D t).paint (flip t)).E := by + rintro ⟨e₁, he₁, hσ⟩ + obtain ⟨Θ, hΘ, hyΘ⟩ := sUnion_cuffs (S := Y t) ▸ hyb + obtain ⟨w, hw, hwΘ⟩ := ((G t).inflation.borders_iff _ he₁ Θ hΘ).mpr ⟨y, hσ.symm ▸ hyl, hyΘ⟩ + have hwb : w ∈ bd (Y t) := cuff_subset_bd ⟨Θ, hΘ⟩ hwΘ + have hb₁ : Painting.IsBorder e₁ := ⟨w, hw, hwb⟩ + rcases ((D t).mem_paint_E (flip t)).mp he₁ with ha | ⟨e, he, hb, hne, rfl⟩ + · obtain ⟨R, hR, hes⟩ := exists_arcComp_superset ha.2.2.1 (F := bd (Y t) \ pullFrameV Φ K + (ψ t)) + (fun x hx ↦ ⟨(ha.2.1 hx).1, fun h ↦ (ha.2.1 hx).2 ((D t).pullFrameV_subset h)⟩) + have hfR : σe t e₁ ⊆ R := (((G t).respects e₁ he₁ hb₁).2 R hR).mp hes + obtain ⟨s, hs, hRs⟩ := (D t).exists_side_of_bd hR (hfR (hσ.symm ▸ hyl)) (hsub' hx) + have hwS : ψ t w ∈ bd S := (hs.2.1 (hRs (mem_image_of_mem _ (hes hw)))).1 + obtain ⟨hE₀, hpre⟩ := (D t).pull.image_border_edge ha hw hwS + have hlift : ((ψ t ⁻¹' (ψ t '' e₁)).Nonempty) := by + rw [hpre] + exact ha.1 + apply hnot + refine ⟨ψ t '' e₁, hE₀, ?_⟩ + rw [glueE_eq G hC.off hE₀ hlift, hpre, hσ, hsur] + · exact (D t).pull.preimage_subset_int ((D t).pull.subset_R he hb hne) hw hwb + obtain ⟨z, hz, htil⟩ := (G t).inflation.border_edge _ hpE hpb hpn + have htile : tilde e' = ψ t '' tilde (ψ t ⁻¹' e') := by + rw [← (D' t).pull.tilde_image_arc hp, hsur] + have h2 : (tilde (ψ t ⁻¹' e')).ncard = 2 := ((D' t).paint (flip t)).border_edge _ hpE hpb |>.1 + have hzV : ψ t z ∈ Γ.V := by + by_contra hn + have hF : z ∈ pullFrameV Φ K (ψ t) := by + rcases hz with h | h + · exact absurd h hn + · exact Or.inr h + have hsing : tilde (ψ t ⁻¹' e') ⊆ {z} := fun a ha ↦ (G t).eq_of_not_V hz hF hn (htil ha) + have := ncard_le_ncard hsing (finite_singleton z) + rw [h2, ncard_singleton] at this + omega + refine ⟨ψ t z, hzV, ?_⟩ + rw [htile] + rintro _ ⟨a, ha, rfl⟩ + exact mem_iUnion.mpr ⟨t, mem_iUnion₂.mpr ⟨z, rfl, mem_image_of_mem _ (htil ha)⟩⟩ + · intro e he Θ hΘ hmeet f n n' hn hn' hp + obtain ⟨t, hne⟩ := exists_lift hC he + have hS := (D t).pull.surface + have heq := glueE_eq G hC.off he hne + obtain ⟨-, -, hE', -, -, -, -, hb₁, -⟩ := (G t).edge_main he hne + obtain ⟨w, hw₁, hw₂⟩ := hmeet + have hb : Painting.IsBorder e := ⟨w, hw₁, cuff_subset_bd ⟨Θ, hΘ⟩ hw₂⟩ + obtain ⟨s, hs, hes, hgs, hbg⟩ := hb₁ hb + rw [← heq] at hE' hgs hbg + exact immediatelyPrecedes_transfer hS (D t).fits (D' t).fits he + (Γ'.mem_arcs_of_subset hE' (Γ'.border_edge _ hE' hbg).2) hE' hs hes hgs hb hbg hΘ + ⟨w, hes hw₁, hw₂⟩ f hn hn' hp + +end + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5m.lean b/LeanPool/GraphMinor/GM19/Section5m.lean new file mode 100644 index 0000000000..a1fd8dd518 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5m.lean @@ -0,0 +1,291 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5l + +/-! +# Graph Minors XIX, proof of (5.4): the colour scheme of a fragment + +The fragment `Σ₁` gets the colour scheme `χ'` of the proof of (5.4): the frame is `ψ⁻¹(Φ) ∩ Σ₁`, the +orders `Ω(2)`, +`Ω(3)` do not change, a side over a side `S` of `Φ` has the order `Ω_χ(S)`. A side over an edge of +`K` is short and +gets one colour. The paper colours that side by itself. Colour schemes here keep one fixed set of +colours, so we take +one colour `a₀` for all those sides, which does no harm since these sides have no order to respect. + +Then a coloured linear inflation on each fragment glues to a coloured linear inflation on `Σ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +universe w + +variable {S S₁ : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace S₁] [T2Space S₁] {α : + Type w} + + +/-- The order with one element. -/ +def QuasiOrder.single (a : α) : QuasiOrder α where + E := {a} + le _ _ := True + refl _ _ := trivial + trans _ _ _ _ _ _ _ _ := trivial + +theorem QuasiOrder.isWQO_single (a : α) : (QuasiOrder.single a).IsWQO := + fun _ _ ↦ ⟨0, 1, zero_lt_one, trivial⟩ + +variable {Γ : Painting S} {K : Drawing S} {ψ : S₁ → S} + +open Classical in +/-- The order of a side of the fragment. -/ +noncomputable def fragΩ (χ : ColourScheme S α) (a₀ : α) (ψ : S₁ → S) (R : Set S₁) : QuasiOrder α := + if h : ∃ s ∈ χ.Φ.sides, ψ '' R ⊆ s then χ.ΩS h.choose else QuasiOrder.single a₀ + +open Classical in +/-- The colour of a short side of the fragment. -/ +noncomputable def fragShort (χ : ColourScheme S α) (a₀ : α) (ψ : S₁ → S) (R : Set S₁) : α := + if h : ∃ s ∈ χ.Φ.sides, ψ '' R ⊆ s then χ.shortElem h.choose else a₀ + +omit [T2Space S] [TopologicalSpace S₁] [T2Space S₁] in +theorem exists_choose_eq {χ : ColourScheme S α} {R : Set S₁} (h : ∃ s ∈ χ.Φ.sides, ψ '' R ⊆ s) + (hne : R.Nonempty) + {s : Set S} (hs : s ∈ χ.Φ.sides) (hsub : ψ '' R ⊆ s) : h.choose = s := by + obtain ⟨x, hx⟩ := hne + exact GM11.arcComponent_eq h.choose_spec.1 hs (h.choose_spec.2 (mem_image_of_mem ψ hx)) (hsub + (mem_image_of_mem ψ hx)) + +/-- The colour scheme of the fragment. -/ +noncomputable def fragScheme (χ : ColourScheme S α) (a₀ : α) {Γ : Painting S} + (D : FrameData χ.Φ Γ K ψ) + (hF : IsFeature χ.Φ K) (flip : Set S₁ → Bool) : ColourScheme S₁ α where + isSurface := D.pull.frag.isSurface + connected := D.pull.frag.connected + Φ := D.frame hF flip + Ω2 := χ.Ω2 + Ω3 := χ.Ω3 + ΩS := fragΩ χ a₀ ψ + shortElem := fragShort χ a₀ ψ + isWQO_2 := χ.isWQO_2 + isWQO_3 := χ.isWQO_3 + isWQO_S R _ := by + by_cases h : ∃ s ∈ χ.Φ.sides, ψ '' R ⊆ s + · rw [fragΩ, dite_eq_left_of_eq_true (eq_true h)] + exact χ.isWQO_S _ h.choose_spec.1 + · rw [fragΩ, dite_eq_right_of_eq_false (eq_false h)] + exact QuasiOrder.isWQO_single a₀ + short_singleton R hR := by + by_cases h : ∃ s ∈ χ.Φ.sides, ψ '' R ⊆ s + · rw [fragΩ, fragShort, dite_eq_left_of_eq_true (eq_true h), dite_eq_left_of_eq_true + (eq_true h)] + exact χ.short_singleton _ ⟨h.choose_spec.1, fun hl ↦ hR.2 ⟨_, ⟨h.choose_spec.1, hl⟩, + h.choose_spec.2⟩⟩ + · rw [fragΩ, fragShort, dite_eq_right_of_eq_false (eq_false h), + dite_eq_right_of_eq_false (eq_false h)] + rfl + +variable {χ : ColourScheme S α} {a₀ : α} + +theorem fragScheme_ΩS {D : FrameData χ.Φ Γ K ψ} {hF : IsFeature χ.Φ K} {flip : Set S₁ + → Bool} {R : Set S₁} + (hne : R.Nonempty) {s : Set S} (hs : s ∈ χ.Φ.sides) (hsub : ψ '' R ⊆ s) : + (fragScheme χ a₀ D hF flip).ΩS R = χ.ΩS s := by + have h : ∃ s ∈ χ.Φ.sides, ψ '' R ⊆ s := ⟨s, hs, hsub⟩ + change fragΩ χ a₀ ψ R = _ + rw [fragΩ, dite_eq_left_of_eq_true (eq_true h), exists_choose_eq h hne hs hsub] + +open Classical in +/-- The colouring of the pull-back. -/ +noncomputable def fragφ (P : ColouredPainting χ) (ψ : S₁ → S) (a₀ : α) (e₁ : Set S₁) : α := + if ψ '' e₁ ∈ P.Γ.E then P.φ (ψ '' e₁) else a₀ + +omit [T2Space S] [TopologicalSpace S₁] [T2Space S₁] in +theorem fragφ_eq {P : ColouredPainting χ} {e₁ : Set S₁} (h : ψ '' e₁ ∈ P.Γ.E) : fragφ P ψ a₀ e₁ + = P.φ (ψ '' e₁) := + ite_eq_left h + +theorem fragScheme_Ω_neg {D : FrameData χ.Φ Γ K ψ} {hF : IsFeature χ.Φ K} {flip : Set S₁ + → Bool} {R : Set S₁} + (h : ¬ ∃ s ∈ χ.Φ.sides, ψ '' R ⊆ s) : (fragScheme χ a₀ D hF flip).ΩS R = QuasiOrder.single a₀ + := by + change fragΩ χ a₀ ψ R = _ + rw [fragΩ, dite_eq_right_of_eq_false (eq_false h)] + +namespace FrameData + +variable [Nonempty S₁] {Φ : Frame S} (D : FrameData Φ Γ K ψ) (flip : Set S₁ → Bool) +include D + +/-- An internal edge of the pull-back is a lift of an edge of `Γ`. -/ +theorem exists_lift_of_internal {e₁ : Set S₁} (he₁ : e₁ ∈ (D.paint flip).E) + (hi : Painting.IsInternal e₁) : + ∃ e ∈ Γ.E, ¬ Painting.IsBorder e ∧ (ψ ⁻¹' e).Nonempty ∧ e₁ = ψ ⁻¹' e := by + rcases (D.mem_paint_E flip).mp he₁ with hp | ⟨e, he, hb, hne, rfl⟩ + · obtain ⟨x, hx⟩ := hp.1 + exact absurd (hp.2.1 hx).1 (disjoint_left.mp hi hx) + · exact ⟨e, he, hb, hne, rfl⟩ + +/-- A border edge of the pull-back is an arc of the boundary. -/ +theorem mem_arcs_of_border {e₁ : Set S₁} (he₁ : e₁ ∈ (D.paint flip).E) (hb : Painting.IsBorder e₁) : + e₁ ∈ arcComponentsIn (bd S₁ \ pullV Γ K ψ) := by + rcases (D.mem_paint_E flip).mp he₁ with hp | ⟨e, he, hb', hne, rfl⟩ + · exact hp + · obtain ⟨x, hx, hxb⟩ := hb + exact absurd hxb (D.pull.preimage_subset_int (D.pull.subset_R he hb' hne) hx) + +omit [Nonempty S₁] in +omit [T2Space S] [T2Space S₁] in +/-- A side of the fragment over no side of `Φ` lies over an edge of `K`, so no edge of `Γ` has its +image there. -/ +theorem image_notMem {R e₁ : Set S₁} (hR : R ∈ arcComponentsIn (bd S₁ \ pullFrameV Φ K ψ)) + (hsub : e₁ ⊆ R) + (hne : e₁.Nonempty) (h : ¬ ∃ s ∈ Φ.sides, ψ '' R ⊆ s) : ψ '' e₁ ∉ Γ.E := by + intro hE + rcases D.image_side hR with h' | ⟨f, hf, hsub'⟩ + · exact h h' + · obtain ⟨x, hx⟩ := hne + have hxf := hf.2.1 (hsub' (mem_image_of_mem ψ (hsub hx))) + have hxE := hE.2.1 (mem_image_of_mem ψ hx) + exact hxf.2 (D.pull.inter ⟨hxE.1, hxf.1⟩).2 + +end FrameData + +/-- The coloured pull-back of a coloured painting. -/ +noncomputable def fragPainting {Γ₀ : Painting S} [Nonempty S₁] (D₀ : FrameData χ.Φ Γ₀ K ψ) + (hF : IsFeature χ.Φ K) + (flip : Set S₁ → Bool) (P : ColouredPainting χ) (D : FrameData χ.Φ P.Γ K ψ) + (hA : IsAnchored P.Γ K) : + ColouredPainting (fragScheme χ a₀ D₀ hF flip) where + Γ := D.paint flip + φ := fragφ P ψ a₀ + fits := by + have := χ.connected + exact D.theorem_5_3_proof hF hA flip + internal_2_mem e₁ he₁ hi h2 := by + obtain ⟨e, he, hb, hne, rfl⟩ := D.exists_lift_of_internal flip he₁ hi + have hsub := D.pull.subset_R he hb hne + have hsur : ψ '' (ψ ⁻¹' e) = e := image_preimage_eq_of_subset (hsub.trans + (image_subset_range _ _)) + rw [fragφ_eq (hsur.symm ▸ he), hsur] + refine P.internal_2_mem e he (disjoint_left.mpr fun x hx hxb ↦ hb ⟨x, hx, hxb⟩) ?_ + rw [← D.pull.ncard_tilde he hsub] + exact h2 + internal_3_mem e₁ he₁ hi h2 := by + obtain ⟨e, he, hb, hne, rfl⟩ := D.exists_lift_of_internal flip he₁ hi + have hsub := D.pull.subset_R he hb hne + have hsur : ψ '' (ψ ⁻¹' e) = e := image_preimage_eq_of_subset (hsub.trans + (image_subset_range _ _)) + rw [fragφ_eq (hsur.symm ▸ he), hsur] + refine P.internal_3_mem e he (disjoint_left.mpr fun x hx hxb ↦ hb ⟨x, hx, hxb⟩) ?_ + rw [← D.pull.ncard_tilde he hsub] + exact h2 + border_mem e₁ he₁ R hR hbs := by + have ha := D.mem_arcs_of_border flip he₁ hbs.1 + by_cases h : ∃ s ∈ χ.Φ.sides, ψ '' R ⊆ s + · obtain ⟨s, hs, hsub⟩ := h + obtain ⟨x, hx⟩ := ha.1 + have hxb : ψ x ∈ bd S := (hs.2.1 (hsub (mem_image_of_mem ψ (hbs.2 hx)))).1 + obtain ⟨hE, -⟩ := D.pull.image_border_edge ha hx hxb + rw [fragScheme_ΩS ⟨x, hbs.2 hx⟩ hs hsub, fragφ_eq hE] + exact P.border_mem _ hE s hs ⟨⟨ψ x, mem_image_of_mem ψ hx, hxb⟩, + (image_mono hbs.2).trans hsub⟩ + · have hE := D.image_notMem hR hbs.2 ha.1 h + rw [fragScheme_Ω_neg h] + exact ite_eq_right hE + +variable {Γ₀ : Painting S} [Nonempty S₁] + +/-- A coloured linear inflation on the fragment is a `FragInflation`. -/ +theorem fragInflation {D₀ : FrameData χ.Φ Γ₀ K ψ} {hF : IsFeature χ.Φ K} {flip : Set S₁ → Bool} + {P₁ P₂ : ColouredPainting χ} {D₁ : FrameData χ.Φ P₁.Γ K ψ} {D₂ : FrameData χ.Φ P₂.Γ K ψ} + {hA₁ : IsAnchored P₁.Γ K} {hA₂ : IsAnchored P₂.Γ K} {σv : S₁ → Set S₁} {σe : Set S₁ → Set S₁} + (h : IsColouredLinearInflation (fragScheme χ a₀ D₀ hF flip) (fragPainting (a₀ + := a₀) D₀ hF flip P₁ D₁ hA₁) + (fragPainting (a₀ := a₀) D₀ hF flip P₂ D₂ hA₂) σv σe) + (hflip : IsPaperFlip χ.Φ K ψ D₁.pull.frag.isSurface flip) (hV : ∀ v ∈ K.V, v ∈ P₁.Γ.V ↔ v ∈ + P₂.Γ.V) : + FragInflation D₁ D₂ hF flip σv σe where + inflation := h.isLinear + respects := h.respects + flip_spec := hflip + fits := (fragPainting (a₀ := a₀) D₀ hF flip P₁ D₁ hA₁).fits + fits' := (fragPainting (a₀ := a₀) D₀ hF flip P₂ D₂ hA₂).fits + same_V := hV + +variable {ι : Type} {Y : ι → Type} [∀ t, TopologicalSpace (Y t)] [∀ t, T2Space + (Y t)] [∀ t, Nonempty (Y t)] + {ψ : ∀ t, Y t → S} + +/-- **Gluing coloured inflations.** Coloured linear inflations of the fragments give a coloured +linear inflation of +`(Γ₁, φ₁)` in `(Γ₂, φ₂)`. -/ +theorem glue_coloured {Γ₀ : ι → Painting S} {D₀ : ∀ t, FrameData χ.Φ (Γ₀ t) K + (ψ t)} {hF : IsFeature χ.Φ K} + {flip : ∀ t, Set (Y t) → Bool} {P₁ P₂ : ColouredPainting χ} {D₁ : ∀ t, FrameData χ.Φ P₁.Γ K + (ψ t)} + {D₂ : ∀ t, FrameData χ.Φ P₂.Γ K (ψ t)} {hA₁ : IsAnchored P₁.Γ K} {hA₂ : IsAnchored P₂.Γ K} + {σv : ∀ t, Y t → Set (Y t)} {σe : ∀ t, Set (Y t) → Set (Y t)} + (h : ∀ t, IsColouredLinearInflation (fragScheme χ a₀ (D₀ t) hF (flip t)) + (fragPainting (a₀ := a₀) (D₀ t) hF (flip t) P₁ (D₁ t) hA₁) + (fragPainting (a₀ := a₀) (D₀ t) hF (flip t) P₂ (D₂ t) hA₂) (σv t) (σe t)) + (hflip : ∀ t, IsPaperFlip χ.Φ K (ψ t) (D₁ t).pull.frag.isSurface (flip t)) + (hV : ∀ v ∈ K.V, v ∈ P₁.Γ.V ↔ v ∈ P₂.Γ.V) (hC : IsCover K ψ) : + IsColouredLinearInflation χ P₁ P₂ (glueV ψ σv) (glueE ψ σe) := by + have G : ∀ t, FragInflation (D₁ t) (D₂ t) hF (flip t) (σv t) (σe t) := fun t ↦ fragInflation + (h t) (hflip t) hV + have hL := glue_linear G hC + have hint : ∀ e ∈ P₁.Γ.E, Painting.IsInternal e → ∀ t, (ψ t ⁻¹' e).Nonempty → + ψ t ⁻¹' e ∈ ((D₁ t).paint (flip t)).E ∧ Painting.IsInternal (ψ t ⁻¹' e) ∧ + (tilde (ψ t ⁻¹' e)).ncard = (tilde e).ncard := by + intro e he hi t hne + have hb : ¬ Painting.IsBorder e := fun ⟨x, hx, hxb⟩ ↦ disjoint_left.mp hi hx hxb + have hsub := (D₁ t).pull.subset_R he hb hne + exact ⟨((D₁ t).mem_paint_E (flip t)).mpr (Or.inr ⟨e, he, hb, hne, rfl⟩), + disjoint_left.mpr fun x hx hxb ↦ (D₁ t).pull.preimage_subset_int hsub hx hxb, + (D₁ t).pull.ncard_tilde he hsub⟩ + refine ⟨⟨hL.toIsInflation, glue_respects G hC, ?_, ?_, ?_⟩, hL⟩ + · intro e he hi h2 + obtain ⟨t, hne⟩ := exists_lift hC he + obtain ⟨hE₁, hi₁, hn⟩ := hint e he hi t hne + obtain ⟨hsur, -, hE', -⟩ := (G t).edge_main he hne + have := (h t).le_internal_2 _ hE₁ hi₁ (hn.trans h2) + change χ.Ω2.le (fragφ P₁ (ψ t) a₀ (ψ t ⁻¹' e)) (fragφ P₂ (ψ t) a₀ (σe t (ψ t ⁻¹' e))) at this + rwa [fragφ_eq (hsur.symm ▸ he), fragφ_eq hE', hsur, ← glueE_eq G hC.off he hne] at this + · intro e he hi h2 + obtain ⟨t, hne⟩ := exists_lift hC he + obtain ⟨hE₁, hi₁, hn⟩ := hint e he hi t hne + obtain ⟨hsur, -, hE', -⟩ := (G t).edge_main he hne + have := (h t).le_internal_3 _ hE₁ hi₁ (hn.trans h2) + change χ.Ω3.le (fragφ P₁ (ψ t) a₀ (ψ t ⁻¹' e)) (fragφ P₂ (ψ t) a₀ (σe t (ψ t ⁻¹' e))) at this + rwa [fragφ_eq (hsur.symm ▸ he), fragφ_eq hE', hsur, ← glueE_eq G hC.off he hne] at this + · intro e he s hs hbs + obtain ⟨t, hne⟩ := exists_lift hC he + obtain ⟨hsur, hE₁, hE', -⟩ := (G t).edge_main he hne + have hbe := (P₁.Γ.border_edge e he hbs.1).2 + obtain ⟨x, hx⟩ := id hne + obtain ⟨he₁, -⟩ := (D₁ t).pull.preimage_border_edge he hbe hx + obtain ⟨R, hR, hes⟩ := exists_arcComp_superset he₁.2.2.1 (F := bd (Y t) \ pullFrameV χ.Φ K + (ψ t)) + (fun x hx ↦ ⟨(he₁.2.1 hx).1, fun h ↦ (he₁.2.1 hx).2 ((D₁ t).pullFrameV_subset h)⟩) + obtain ⟨s', hs', hRs⟩ := (D₁ t).exists_side_of_bd hR (hes hx) (hbe hx) + obtain rfl : s' = s := GM11.arcComponent_eq hs' hs (hRs (mem_image_of_mem _ (hes hx))) + (hbs.2 hx) + have hbb : Painting.IsBorder (ψ t ⁻¹' e) := ⟨x, hx, (he₁.2.1 hx).1⟩ + have := (h t).le_border _ hE₁ R hR ⟨hbb, hes⟩ + rw [fragScheme_ΩS ⟨x, hes hx⟩ hs hRs] at this + change (χ.ΩS s').le (fragφ P₁ (ψ t) a₀ (ψ t ⁻¹' e)) (fragφ P₂ (ψ t) a₀ (σe t + (ψ t ⁻¹' e))) at this + rwa [fragφ_eq (hsur.symm ▸ he), fragφ_eq hE', hsur, ← glueE_eq G hC.off he hne] at this + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5n.lean b/LeanPool/GraphMinor/GM19/Section5n.lean new file mode 100644 index 0000000000..7f0725aef8 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5n.lean @@ -0,0 +1,601 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5m +public import LeanPool.GraphMinor.GM19.Poles + +/-! +# Graph Minors XIX, proof of (5.4): a path of `Γ*` between two poles gives a line in `Σ` + +The paper takes a path of `Γ*` between distinct poles whose vertices are off `bd(Σ)`, except the +first two and the last +two. We take instead a part of any path between distinct poles. Label each vertex of the path that +lies on a cuff, and +each pole, by its cuff. The two ends have different labels, so somewhere two labelled vertices that +follow each other +among the labelled ones have different labels. Two neighbours have the same label if they have +labels, so these two +vertices are not poles, and the part of the path between them is a line in `Σ` that meets `bd(Σ)` in +its two ends. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +namespace GraphWalk + +open GraphMinor.Surface.GraphWalk GraphMinor.GM11.GraphWalk + +variable {α : Type} {β : Type} {G : Graph α β} + +theorem append_assoc' {u v w x : α} (A : Surface.GraphWalk G u v) (B : Surface.GraphWalk G v w) + (C : Surface.GraphWalk G w x) : (A.append B).append C = A.append (B.append C) := by + induction A with + | nil _ => rfl + | cons h r ih => + change Surface.GraphWalk.cons h ((r.append B).append C) = Surface.GraphWalk.cons h (r.append + (B.append C)) + rw [ih] + +theorem IsSimple.of_append {u v w : α} {A : Surface.GraphWalk G u v} {B : Surface.GraphWalk G v w} + (h : (A.append B).IsSimple) : A.IsSimple ∧ B.IsSimple := + Surface.GraphWalk.simple_parts_of_append h + +variable {γ : Type} (ℓ : α → Option γ) + +/-- The first labelled vertex of a walk that ends at a labelled vertex. -/ +theorem exists_first {u v : α} (W : Surface.GraphWalk G u v) {b : γ} (hv : ℓ v = some b) : + ∃ (y : α) (d : γ) (M : Surface.GraphWalk G u y) (R : Surface.GraphWalk G y v), W = M.append R + ∧ ℓ y = some d ∧ + ∀ z ∈ M.support, z ≠ y → ℓ z = none := by + induction W with + | @nil v hv₀ => exact ⟨v, b, .nil hv₀, .nil hv₀, rfl, hv, fun z hz hne ↦ absurd + (by simpa using hz) hne⟩ + | @cons u w v e h r ih => + cases hu : ℓ u with + | none => + obtain ⟨y, d, M, R, rfl, hy, hM⟩ := ih hv + refine ⟨y, d, .cons h M, R, rfl, hy, fun z hz hne ↦ ?_⟩ + rcases List.mem_cons.mp hz with rfl | hz + · exact hu + · exact hM z hz hne + | some d => + exact ⟨u, d, .nil (h.left_mem), .cons h r, rfl, hu, fun z hz hne ↦ absurd + (by simpa using hz) hne⟩ + +/-- Two labelled vertices next to each other among the labelled vertices with different labels. -/ +theorem exists_change : ∀ (n : ℕ) {u v : α} (W : Surface.GraphWalk G u v) {a b : γ}, W.length ≤ n + → ℓ u = some a → + ℓ v = some b → a ≠ b → + ∃ (x y : α) (c d : γ) (W₁ : Surface.GraphWalk G u x) (M : Surface.GraphWalk G x y) + (W₂ : Surface.GraphWalk G y v), W = W₁.append (M.append W₂) ∧ ℓ x = some c ∧ ℓ y = some d + ∧ c ≠ d ∧ + ∀ z ∈ M.support, z ≠ x → z ≠ y → ℓ z = none := by + intro n + induction n with + | zero => + intro u v W a b hl hu hv hne + obtain rfl := eq_of_length_eq_zero (Nat.le_zero.mp hl) + exact absurd (Option.some.inj (hu.symm.trans hv)) hne + | succ n ih => + intro u v W a b hl hu hv hne + cases W with + | nil h => exact absurd (Option.some.inj (hu.symm.trans hv)) hne + | @cons _ w _ e h r => + obtain ⟨y, d, M, R, rfl, hy, hM⟩ := exists_first ℓ r hv + by_cases hd : d = a + · subst hd + have hlen : R.length ≤ n := by + rw [length_cons, length_append] at hl + omega + obtain ⟨x', y', c, d', W₁, M', W₂, hW, hx', hy', hcd, hz⟩ := ih R hlen hy hv hne + refine ⟨x', y', c, d', (Surface.GraphWalk.cons h M).append W₁, M', W₂, ?_, hx', hy', hcd, + hz⟩ + rw [hW, append_assoc'] + rfl + · refine ⟨u, y, a, d, .nil h.left_mem, .cons h M, R, rfl, hu, hy, fun hc ↦ hd hc.symm, + fun z hz hzu hzy ↦ ?_⟩ + rcases List.mem_cons.mp hz with rfl | hz + · exact absurd rfl hzu + · exact hM z hz hzy + +end GraphWalk + +section Comap + +variable {S T : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace T] [Nonempty S] {j : S → T} + +omit [T2Space S] [Nonempty S] in +theorem isLine_comap (hj : IsClosedEmbedding j) {L : Set S} {u v : S} (h : IsLineWithEnds (j '' L) + (j u) (j v)) : + IsLineWithEnds L u v := by + obtain ⟨f, h0, h1⟩ := h + let c := hj.isEmbedding.homeomorphImage L + refine ⟨f.trans c.symm, hj.injective ?_, hj.injective ?_⟩ + · refine Eq.trans ?_ h0 + exact congrArg Subtype.val (c.apply_symm_apply (f 0)) + · refine Eq.trans ?_ h1 + exact congrArg Subtype.val (c.apply_symm_apply (f 1)) + +omit [T2Space S] [Nonempty S] in +theorem isOArc_comap (hj : IsClosedEmbedding j) {L : Set S} (h : IsOArc (j '' L)) : IsOArc L := by + obtain ⟨f⟩ := h + exact ⟨f.trans (hj.isEmbedding.homeomorphImage L).symm⟩ + +omit [TopologicalSpace S] [T2Space S] [Nonempty S] in +theorem image_comap_sdiff {P : Drawing T} (hP : P.U ⊆ range j) : j '' (j ⁻¹' P.U \ j ⁻¹' P.V) + = P.U \ P.V := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + exact hx + · rintro ⟨hy, hn⟩ + obtain ⟨x, rfl⟩ := hP hy + exact ⟨x, ⟨hy, hn⟩, rfl⟩ + +omit [T2Space S] in +theorem arcs_comap (hj : IsClosedEmbedding j) {P : Drawing T} (hP : P.U ⊆ range j) : + arcComponentsIn (P.U \ P.V) = image j '' arcComponentsIn (j ⁻¹' P.U \ j ⁻¹' P.V) := by + have hl : Function.LeftInverse (Function.invFun j) j := Function.leftInverse_invFun hj.injective + rw [← image_comap_sdiff hP] + refine GM11.arcComponentsIn_image hj.continuous.continuousOn ?_ fun x _ ↦ hl x + refine hj.isInducing.continuousOn_iff.mpr (continuousOn_id.congr ?_) + rintro _ ⟨x, -, rfl⟩ + simp [hl x] + +/-- A drawing in `T` that lies in `S`, as a drawing in `S`. -/ +noncomputable def Drawing.comap (P : Drawing T) (hj : IsClosedEmbedding j) + (hP : P.U ⊆ range j) : Drawing S where + U := j ⁻¹' P.U + V := j ⁻¹' P.V + V_subset_U := preimage_mono P.V_subset_U + isClosed_U := P.isClosed_U.preimage hj.continuous + finite_V := P.finite_V.preimage hj.injective.injOn + finite_edges := by + refine Finite.of_finite_image ?_ (image_injective.mpr hj.injective).injOn + rw [← arcs_comap hj hP] + exact P.finite_edges + edge_cond e he := by + have hE : j '' e ∈ arcComponentsIn (P.U \ P.V) := by + rw [arcs_comap hj hP] + exact mem_image_of_mem _ he + have hset : ∀ {A : Set T}, closure (j '' e) ∩ P.V = A → j '' (closure e ∩ j ⁻¹' P.V) = A := by + rintro A rfl + rw [hj.closure_image_eq] + ext y + constructor + · rintro ⟨x, ⟨hx₁, hx₂⟩, rfl⟩ + exact ⟨mem_image_of_mem j hx₁, hx₂⟩ + · rintro ⟨⟨x, hx, rfl⟩, hy⟩ + exact ⟨x, ⟨hx, hy⟩, rfl⟩ + rcases P.edge_cond _ hE with ⟨u, v, hne, hs, hl⟩ | ⟨u, hs, ho⟩ + · have hs' := hset hs + obtain ⟨u', -, rfl⟩ : u ∈ j '' (closure e ∩ j ⁻¹' P.V) := hs' ▸ mem_insert _ _ + obtain ⟨v', -, rfl⟩ : v ∈ j '' (closure e ∩ j ⁻¹' P.V) := hs' ▸ mem_insert_of_mem _ rfl + refine Or.inl ⟨u', v', fun h ↦ hne (congrArg j h), ?_, isLine_comap hj ?_⟩ + · apply image_injective.mpr hj.injective + rw [hs', image_pair] + · rw [← hj.closure_image_eq] + exact hl + · have hs' := hset hs + obtain ⟨u', -, rfl⟩ : u ∈ j '' (closure e ∩ j ⁻¹' P.V) := hs' ▸ rfl + refine Or.inr ⟨u', ?_, isOArc_comap hj ?_⟩ + · apply image_injective.mpr hj.injective + rw [hs', image_singleton] + · rw [← hj.closure_image_eq] + exact ho + +end Comap + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} + +/-- What the proof of (5.4) needs of a feature `K`: a line `s t` of size at most `n` from one cuff +to another, that +meets the boundary only in `s` and `t` and meets `Γ` only in vertices. -/ +structure IsCrossLine (Φ : Frame S) (Γ : Painting S) (n : ℕ) (K : Drawing S) : Prop where + feature : IsFeature Φ K + size : K.V.ncard + K.E.ncard ≤ n + line : ∃ s t, s ≠ t ∧ K.U ∩ bd S = {s, t} ∧ IsLineWithEnds K.U s t ∧ + connectedComponentIn (bd S) s ≠ connectedComponentIn (bd S) t + inter : Γ.U ∩ K.U ⊆ Γ.V ∩ K.V + lines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} + ∧ IsLineWithEnds (closure e) u v + +open Classical in +/-- The label of a point of `Σ̂`: the cuff whose closed pasted disc holds the point, if there is +one. -/ +noncomputable def cuffLabel (cap : IsCappedSurface S Shat) (x : Shat) : Option (Set S) := + if h : ∃ Θ ∈ cuffs S, x ∈ closure (cap.cuffDisc Θ) then some h.choose else none + +omit [T2Space S] [T2Space Shat] in +theorem cuffLabel_eq {x : Shat} {Θ : Set S} (hΘ : Θ ∈ cuffs S) (hx : x ∈ closure (cap.cuffDisc Θ)) : + cuffLabel cap x = some Θ := by + have h : ∃ Θ ∈ cuffs S, x ∈ closure (cap.cuffDisc Θ) := ⟨Θ, hΘ, hx⟩ + rw [cuffLabel, dite_eq_left_of_eq_true (eq_true h)] + by_contra hne + have hne' : h.choose ≠ Θ := fun e ↦ hne (congrArg some e) + exact disjoint_left.mp (cap.cuffDisc_disjoint _ h.choose_spec.1 _ hΘ hne') h.choose_spec.2 hx + +omit [T2Space S] [T2Space Shat] in +theorem cuffLabel_some {x : Shat} {Θ : Set S} (h : cuffLabel cap x = some Θ) : + Θ ∈ cuffs S ∧ x ∈ closure (cap.cuffDisc Θ) := by + by_cases h' : ∃ Θ ∈ cuffs S, x ∈ closure (cap.cuffDisc Θ) + · rw [cuffLabel, dite_eq_left_of_eq_true (eq_true h')] at h + rw [← Option.some.inj h] + exact h'.choose_spec + · rw [cuffLabel, dite_eq_right_of_eq_false (eq_false h')] at h + exact absurd h (by simp) + +variable (hS : IsSurface S) (rad : RadialDrawing cap Γ) +include hS + +omit [T2Space S] [T2Space Shat] in +omit hS in +theorem cuffLabel_emb {v : S} {Θ : Set S} (hΘ : Θ ∈ cuffs S) (hv : v ∈ Θ) : cuffLabel cap + (cap.emb v) = some Θ := + cuffLabel_eq hΘ (by + rw [cap.closure_cuffDisc hΘ] + exact Or.inr (mem_image_of_mem _ hv)) + +omit [T2Space S] [T2Space Shat] in +omit hS in +theorem cuffLabel_emb_bd {v : S} (hv : v ∈ bd S) : ∃ Θ ∈ cuffs S, v ∈ Θ ∧ cuffLabel cap (cap.emb v) + = some Θ := by + obtain ⟨Θ, hΘ, hvΘ⟩ := sUnion_cuffs (S := S) ▸ hv + exact ⟨Θ, hΘ, hvΘ, cuffLabel_emb hΘ hvΘ⟩ + +omit [T2Space S] [T2Space Shat] in +omit hS in +/-- A point of a closed pasted disc that lies in `Σ` lies on the cuff. -/ +theorem mem_cuff_of_label {v : S} {Θ : Set S} (h : cuffLabel cap (cap.emb v) + = some Θ) : Θ ∈ cuffs S ∧ v ∈ Θ := by + obtain ⟨hΘ, hx⟩ := cuffLabel_some h + rw [cap.closure_cuffDisc hΘ] at hx + rcases hx with hx | ⟨y, hy, hyv⟩ + · exact absurd ⟨v, rfl⟩ (cap.notMem_range hΘ hx) + · exact ⟨hΘ, cap.isEmbedding.injective hyv ▸ hy⟩ + +include rad in +omit [T2Space S] [T2Space Shat] in +omit hS in +/-- A vertex of `R*` with a label is a pole. -/ +theorem pole_of_label {w : Shat} {Θ : Set S} (hw : w ∈ rad.Rstar) (h : cuffLabel cap w = some Θ) : + w ∈ rad.poles ∧ Θ ∈ cuffs S ∧ rad.regionOf w = cap.cuffDisc Θ := by + obtain ⟨hΘ, hx⟩ := cuffLabel_some h + have hG : w ∈ rad.G.U := rad.G.V_subset_U hw.1 + have hwc : w ∈ cap.cuffDisc Θ := by + rw [cap.closure_cuffDisc hΘ] at hx + rcases hx with hx | ⟨y, hy, rfl⟩ + · exact hx + · have hU : cap.emb y ∈ Γ.hatU cap ∩ rad.G.U := + ⟨mem_image_of_mem _ (Γ.bd_subset (cuff_subset_bd ⟨Θ, hΘ⟩ hy)), hG⟩ + rw [rad.isPreRadial.1] at hU + exact absurd hU hw.2 + have hp : w ∈ rad.poles := ⟨hw, fun hsub ↦ cap.notMem_range hΘ hwc (hsub (rad.regionOf_mem hw).2)⟩ + obtain ⟨Θ', hΘ', hreg, hw'⟩ := rad.pole_cases hp + have : Θ' = Θ := by + by_contra hne + exact disjoint_left.mp (cap.cuffDisc_disjoint _ hΘ' _ hΘ hne) (subset_closure hw') + (subset_closure hwc) + subst this + exact ⟨hp, hΘ, hreg⟩ + +include rad in +omit [T2Space S] [T2Space Shat] in +omit hS in +/-- A vertex joined to a labelled vertex of `R*` has the same label. -/ +theorem label_step {e : Set Shat} {v : S} {w : Shat} {Θ : Set S} (he : e ∈ rad.G.E) + (hw : w ∈ rad.Rstar) + (hset : closure e ∩ rad.G.V = {cap.emb v, w}) (h : cuffLabel cap w = some Θ) : cuffLabel cap + (cap.emb v) = some Θ := by + obtain ⟨hp, hΘ, hreg⟩ := pole_of_label rad hw h + exact cuffLabel_emb hΘ (rad.pole_edge he hp hΘ hreg hset).2 + +include rad in +omit [T2Space S] [T2Space Shat] in +omit hS in +/-- Two vertices joined by an edge of `Γ*`, both with labels, have the same label. -/ +theorem label_link {e : Set Shat} {x y : Shat} {a b : Set S} (hl : rad.G.toGraph.IsLink e x y) + (hx : cuffLabel cap x = some a) (hy : cuffLabel cap y = some b) : a = b := by + obtain ⟨v, hv, w, hw, hset⟩ := rad.edge_ends hl.1 + have hpair : ({x, y} : Set Shat) = {cap.emb v, w} := hl.2.2.2.symm.trans hset + rcases (Set.pair_eq_pair_iff.mp hpair) with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Option.some.inj (hx.symm.trans (label_step rad hl.1 hw hset hy)) + · exact Option.some.inj ((label_step rad hl.1 hw hset hx).symm.trans hy) + + +omit [T2Space S] [T2Space Shat] in +omit hS in +/-- The two ends of a path of `Γ*`. -/ +theorem cuff_of_end {x y : Shat} (M : Surface.GraphWalk rad.G.toGraph x y) {c d : Set S} + (hx : cuffLabel cap x = some c) (hy : cuffLabel cap y = some d) (hcd : c ≠ d) + (hz : ∀ z ∈ M.support, z ≠ x → z ≠ y → cuffLabel cap z = none) (hxV : x ∈ rad.G.V) : + ∃ s ∈ c, cap.emb s = x ∧ c ∈ cuffs S := by + have hxh : x ∉ rad.Rstar := by + intro hw + cases M with + | nil _ => exact hcd (Option.some.inj (hx.symm.trans hy)) + | @cons _ w' _ e h r => + have hset : closure e ∩ rad.G.V = {x, w'} := h.2.2.2 + obtain ⟨v, hv, w, hw', hset'⟩ := rad.edge_ends h.1 + have hpair : ({x, w'} : Set Shat) = {cap.emb v, w} := hset.symm.trans hset' + have hne : x ≠ w' := by + intro hxw + subst hxw + rw [pair_eq_singleton] at hset + have h₁ : cap.emb v ∈ ({x} : Set Shat) := by + rw [← hset, hset'] + exact mem_insert _ _ + exact hw.2 ⟨v, hv, h₁⟩ + obtain ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ := Set.pair_eq_pair_iff.mp hpair + · exact absurd ⟨v, hv, rfl⟩ hw.2 + · have hl := label_step rad h.1 hw (by rw [hset, pair_comm]) hx + by_cases hwy : cap.emb v = y + · exact hcd (Option.some.inj (hl.symm.trans (hwy ▸ hy))) + · rw [hz _ (by simp [r.start_mem_support]) hne.symm hwy] at hl + exact absurd hl (by simp) + obtain ⟨s, hs, rfl⟩ : x ∈ Γ.hatV cap := by + by_contra hn + exact hxh ⟨hxV, hn⟩ + obtain ⟨hΘ, hsc⟩ := mem_cuff_of_label hx + exact ⟨s, hsc, rfl, hΘ⟩ + +omit [T2Space S] hS in +omit [T2Space Shat] in +theorem exists_walk_of_dist {n : ℕ} (hd : Painting.dist rad ≤ n) : + ∃ (p₁ p₂ : Shat) (W : Surface.GraphWalk rad.G.toGraph p₁ p₂), p₁ ∈ rad.poles ∧ p₂ ∈ rad.poles + ∧ p₁ ≠ p₂ ∧ W.IsSimple ∧ + W.length ≤ 2 * n + 1 := by + set A : Set ℕ∞ := {n : ℕ∞ | ∃ (F : Drawing Shat) (p₁ p₂ : Shat), + p₁ ∈ rad.poles ∧ p₂ ∈ rad.poles ∧ p₁ ≠ p₂ ∧ F.IsPathOf rad.G p₁ p₂ ∧ n = + (F.E.ncard / 2 : ℕ)} with hA + have hne : A.Nonempty := by + by_contra h + rw [not_nonempty_iff_eq_empty] at h + have : Painting.dist rad = ⊤ := by + change sInf A = ⊤ + rw [h, sInf_empty] + rw [this] at hd + exact absurd hd (by simp) + obtain ⟨F, p₁, p₂, hp₁, hp₂, hpne, hF, heq⟩ := csInf_mem hne + have hle : ((F.E.ncard / 2 : ℕ) : ℕ∞) ≤ n := by + rw [← heq] + exact hd + have hle' : F.E.ncard / 2 ≤ n := by exact_mod_cast hle + obtain ⟨W, hW, -, hE⟩ := hF.2 + obtain ⟨W', hs, he⟩ := hF.1.exists_walk_up W + refine ⟨p₁, p₂, W', hp₁, hp₂, hpne, by unfold Surface.GraphWalk.IsSimple; rw [hs]; exact hW, ?_⟩ + have hl : W'.length = F.E.ncard := by + rw [Surface.GraphWalk.length, he, hE] + have := hW.edges_nodup + rw [← List.coe_toFinset, ncard_coe_finset, List.toFinset_card_of_nodup this] + omega + +omit hS in +/-- Each vertex of a walk of positive length is an end of one of its edges. -/ +theorem exists_edge_at {T : Type} [TopologicalSpace T] {G : Drawing T} {u v : T} + (W : Surface.GraphWalk G.toGraph u v) + (hl : 0 < W.length) {z : T} (hz : z ∈ W.support) : ∃ e ∈ W.edges, z ∈ closure e := by + induction W with + | nil h => simp [Surface.GraphWalk.length] at hl + | @cons a b c e h r ih => + have hset : closure e ∩ G.V = {a, b} := h.2.2.2 + have ha : a ∈ closure e := (hset.symm ▸ mem_insert a {b} : a ∈ closure e ∩ G.V).1 + have hb : b ∈ closure e := (hset.symm ▸ mem_insert_of_mem a rfl : b ∈ closure e ∩ G.V).1 + rcases List.mem_cons.mp hz with rfl | hz + · exact ⟨e, by simp, ha⟩ + · by_cases hr : 0 < r.length + · obtain ⟨f, hf, hzf⟩ := ih hr hz + exact ⟨f, by simp [hf], hzf⟩ + · cases r with + | nil _ => + obtain rfl : z = b := by simpa using hz + exact ⟨e, by simp, hb⟩ + | cons h' r' => simp [Surface.GraphWalk.length] at hr + +omit hS in +theorem walk_length_support {T : Type} [TopologicalSpace T] {G : Drawing T} {u v : T} + (W : Surface.GraphWalk G.toGraph u v) : + W.support.length = W.length + 1 := by + induction W with + | nil h => rfl + | cons h r ih => + simp only [Surface.GraphWalk.support_cons, List.length_cons, ih] + simp [Surface.GraphWalk.length] + +omit hS in +/-- A point of a subdrawing that is a vertex of the drawing is a vertex of the subdrawing. -/ +theorem IsSubdrawing.mem_V {T : Type} [TopologicalSpace T] {C G : Drawing T} + (h : C.IsSubdrawing G) {x : T} + (hx : x ∈ C.U) (hxG : x ∈ G.V) : x ∈ C.V := by + by_contra hn + obtain ⟨f, hf, hxf⟩ := C.exists_edge_of_mem hx hn + exact ((h.2 hf).2.1 hxf).2 hxG + +omit [T2Space S] in +/-- **The path of the proof of (5.4).** If `dist(Γ) ≤ n`, then there is a line of `Σ` of size at +most `4n + 3` from one +cuff to another, which meets `U(Γ)` only in vertices. -/ +theorem exists_crossLine [Nonempty S] {Φ : Frame S} (hfit : Γ.Fits Φ) {n : ℕ} + (hd : Painting.dist rad ≤ n) : + ∃ K : Drawing S, IsCrossLine Φ Γ (4 * n + 3) K := by + classical + have hcS : CompactSpace S := hS.1 + obtain ⟨p₁, p₂, W, hp₁, hp₂, hpne, hW, hlen⟩ := exists_walk_of_dist rad hd + obtain ⟨Θ₁, hΘ₁, hreg₁, hmem₁⟩ := rad.pole_cases hp₁ + obtain ⟨Θ₂, hΘ₂, hreg₂, hmem₂⟩ := rad.pole_cases hp₂ + have hne₁₂ : Θ₁ ≠ Θ₂ := by + rintro rfl + obtain ⟨-, -, hG3, -⟩ := id rad.isPreRadial + exact hpne ((hG3 _ (rad.regionOf_mem hp₁.1).1).unique ⟨(rad.regionOf_mem hp₁.1).2, hp₁.1.1⟩ + ⟨hreg₁.trans hreg₂.symm ▸ (rad.regionOf_mem hp₂.1).2, hp₂.1.1⟩) + obtain ⟨x, y, c, d, W₁, M, W₂, hWe, hx, hy, hcd, hz⟩ := + GraphWalk.exists_change (cuffLabel cap) W.length W le_rfl (cuffLabel_eq hΘ₁ + (subset_closure hmem₁)) + (cuffLabel_eq hΘ₂ (subset_closure hmem₂)) hne₁₂ + have hsimple : M.IsSimple := by + rw [hWe] at hW + exact (GraphWalk.IsSimple.of_append (GraphWalk.IsSimple.of_append hW).2).1 + have hxG : x ∈ rad.G.V := M.mem_vertexSet_of_mem_support M.start_mem_support + have hyG : y ∈ rad.G.V := M.mem_vertexSet_of_mem_support M.end_mem_support + obtain ⟨s, hsc, rfl, hc⟩ := cuff_of_end rad M hx hy hcd hz hxG + obtain ⟨t, htc, rfl, hd'⟩ := cuff_of_end rad M.reverse hy hx hcd.symm + (fun z hz' h₁ h₂ ↦ by + rw [Surface.GraphWalk.support_reverse, List.mem_reverse] at hz' + exact hz z hz' h₂ h₁) hyG + have hst : s ≠ t := by + rintro rfl + exact hcd (Option.some.inj (hx.symm.trans hy)) + have hemb : cap.emb s ≠ cap.emb t := fun h ↦ hst (cap.isEmbedding.injective h) + have hlenpos : 0 < M.length := by + by_contra hl + exact hemb (Surface.GraphWalk.eq_of_length_eq_zero (Nat.le_zero.mp (not_lt.mp hl))) + have hj : IsClosedEmbedding cap.emb := cap.isEmbedding.continuous.isClosedEmbedding + cap.isEmbedding.injective + have hnp : ∀ z ∈ M.support, z ∉ rad.poles := by + intro z hz' hp + obtain ⟨Θ, hΘ, -, hmem⟩ := rad.pole_cases hp + have hnr := cap.notMem_range hΘ hmem + by_cases h₁ : z = cap.emb s + · exact hnr ⟨s, h₁.symm⟩ + · by_cases h₂ : z = cap.emb t + · exact hnr ⟨t, h₂.symm⟩ + · have := hz z hz' h₁ h₂ + rw [cuffLabel_eq hΘ (subset_closure hmem)] at this + exact absurd this (by simp) + have hrv : ∀ z ∈ rad.G.V, z ∉ rad.poles → z ∈ range cap.emb := by + intro z hzG hzp + by_cases hV : z ∈ Γ.hatV cap + · obtain ⟨v, -, rfl⟩ := hV + exact mem_range_self v + · have hw : z ∈ rad.Rstar := ⟨hzG, hV⟩ + exact rad.region_subset_range hw hzp (rad.regionOf_mem hw).2 + set P := walkDrawing rad.G M with hPdef + have hsub : P.IsSubdrawing rad.G := walkDrawing_isSubdrawing _ _ + have hpath : P.IsPathBetween (cap.emb s) (cap.emb t) := walkDrawing_isPathBetween _ hsimple + have hPV : ∀ z, z ∈ P.V ↔ z ∈ M.support := fun z ↦ by rw [hPdef, walkDrawing_V]; rfl + have hPE : ∀ e, e ∈ P.E ↔ e ∈ M.edges := fun e ↦ by rw [hPdef, walkDrawing_E]; rfl + have hed : ∀ e ∈ P.E, e ⊆ range cap.emb := by + intro e he + have heG := hsub.2 he + obtain ⟨v, hv, w, hw, hset⟩ := rad.edge_ends heG + have hwP : w ∈ closure e ∩ P.V := by + rw [hsub.closure_inter_V he, hset] + exact mem_insert_of_mem _ rfl + exact rad.edge_subset_range heG hw (hnp w ((hPV w).mp hwP.2)) hset + have hP : P.U ⊆ range cap.emb := by + intro z hzU + rcases (mem_walkDrawing_U _ _).mp hzU with h | ⟨e, he, hze⟩ + · exact hrv z (M.mem_vertexSet_of_mem_support h) (hnp z h) + · exact closure_minimal (hed e ((hPE e).mpr he)) hj.isClosed_range hze + let K : Drawing S := GM19.Drawing.comap P hj hP + have hKU : cap.emb '' K.U = P.U := image_preimage_eq_of_subset hP + have hKV : cap.emb '' K.V = P.V := image_preimage_eq_of_subset (P.V_subset_U.trans hP) + have hsK : s ∈ K.V := (hPV _).mpr M.start_mem_support + have htK : t ∈ K.V := (hPV _).mpr M.end_mem_support + have hinter : Γ.U ∩ K.U ⊆ Γ.V ∩ K.V := by + rintro x ⟨hxΓ, hxK⟩ + have hU : cap.emb x ∈ Γ.hatU cap ∩ rad.G.U := ⟨mem_image_of_mem _ hxΓ, hsub.U_subset hxK⟩ + rw [rad.isPreRadial.1] at hU + obtain ⟨v, hv, hvx⟩ := hU + obtain rfl := cap.isEmbedding.injective hvx + exact ⟨hv, IsSubdrawing.mem_V hsub hxK (rad.isPreRadial.2.1 ⟨_, hv, rfl⟩)⟩ + have hbdK : K.U ∩ bd S = {s, t} := by + apply subset_antisymm + · rintro x ⟨hxK, hxb⟩ + have hxV := (hinter ⟨Γ.bd_subset hxb, hxK⟩).2 + obtain ⟨Θ, hΘ, -, hl⟩ := cuffLabel_emb_bd (cap := cap) hxb + by_contra hn + have h₁ : cap.emb x ≠ cap.emb s := fun h ↦ hn (Or.inl (cap.isEmbedding.injective h)) + have h₂ : cap.emb x ≠ cap.emb t := fun h ↦ hn (Or.inr (cap.isEmbedding.injective h)) + rw [hz _ ((hPV _).mp hxV) h₁ h₂] at hl + exact absurd hl (by simp) + · rintro x (rfl | rfl) + · exact ⟨K.V_subset_U hsK, cuff_subset_bd ⟨c, hc⟩ hsc⟩ + · exact ⟨K.V_subset_U htK, cuff_subset_bd ⟨d, hd'⟩ htc⟩ + have hsize : K.V.ncard + K.E.ncard ≤ 4 * n + 3 := by + have h₁ : K.V.ncard = P.V.ncard := by + rw [← hKV, ncard_image_of_injective _ cap.isEmbedding.injective] + have h₂ : K.E.ncard = P.E.ncard := by + change (arcComponentsIn (cap.emb ⁻¹' P.U \ cap.emb ⁻¹' P.V)).ncard = (arcComponentsIn + (P.U \ P.V)).ncard + rw [arcs_comap hj hP, ncard_image_of_injective _ (image_injective.mpr + cap.isEmbedding.injective)] + have h₃ : P.V.ncard = M.length + 1 := by + have : P.V = ↑M.support.toFinset := by + ext z + rw [hPV] + simp + rw [this, ncard_coe_finset, List.toFinset_card_of_nodup hsimple, walk_length_support] + have h₄ : P.E.ncard = M.length := by + have : P.E = ↑M.edges.toFinset := by + ext e + rw [hPE] + simp + rw [this, ncard_coe_finset, List.toFinset_card_of_nodup hsimple.edges_nodup, + Surface.GraphWalk.length] + have h₅ : M.length ≤ W.length := by + rw [hWe, Surface.GraphWalk.length_append, Surface.GraphWalk.length_append] + omega + omega + have hE' : ∀ e ∈ arcComponentsIn (K.U \ K.V), cap.emb '' e ∈ P.E := fun e he ↦ by + change cap.emb '' e ∈ arcComponentsIn (P.U \ P.V) + rw [arcs_comap hj hP] + exact mem_image_of_mem _ he + have hfeat : IsFeature Φ K := by + refine ⟨fun e he ↦ disjoint_left.mpr fun x hxe hxb ↦ ?_, fun v hv ↦ ?_, + fun s₀ hs₀ ↦ disjoint_left.mpr fun x hx hxs ↦ ?_⟩ + · have hx' : x ∈ K.U ∩ bd S := ⟨(he.2.1 hxe).1, hxb⟩ + rw [hbdK] at hx' + rcases hx' with h | h + · exact (he.2.1 hxe).2 (h ▸ hsK) + · exact (he.2.1 hxe).2 ((mem_singleton_iff.mp h) ▸ htK) + · obtain ⟨e, he, hve⟩ := exists_edge_at M hlenpos ((hPV _).mp hv) + have heP : e ∈ arcComponentsIn (P.U \ P.V) := (hPE e).mpr he + rw [arcs_comap hj hP] at heP + obtain ⟨e', he', rfl⟩ := heP + rw [hj.closure_image_eq] at hve + obtain ⟨v', hv', hvv⟩ := hve + obtain rfl := cap.isEmbedding.injective hvv + exact ⟨e', he', hv', fun h ↦ (he'.2.1 h).2 hv⟩ + · have hxb : x ∈ bd S := (hs₀.1.2.1 hxs).1 + have hxV := (hinter ⟨Γ.bd_subset hxb, hx⟩).1 + exact Γ.disjoint_V (hfit.short_sides hs₀) hxs hxV + refine ⟨K, hfeat, hsize, ⟨s, t, hst, hbdK, isLine_comap hj ?_, ?_⟩, hinter, fun e he ↦ ?_⟩ + · rw [hKU] + exact isLine_of_isPathBetween hpath hemb + · obtain ⟨a, ha, rfl⟩ := hc + obtain ⟨b, hb, rfl⟩ := hd' + rw [← connectedComponentIn_eq hsc, ← connectedComponentIn_eq htc] + exact hcd + · rcases K.edge_cond e he with h | ⟨u, hs', -⟩ + · exact h + · exfalso + have heP := hE' e he + have heG := hsub.2 heP + obtain ⟨v, hv, w, hw, hset⟩ := rad.edge_ends heG + have hset' : closure (cap.emb '' e) ∩ P.V = {cap.emb v, w} := by + rw [hsub.closure_inter_V heP, hset] + have hmem : ∀ z, z ∈ closure (cap.emb '' e) ∩ P.V → z = cap.emb u := by + rintro z ⟨hz₁, hz₂⟩ + rw [hj.closure_image_eq] at hz₁ + obtain ⟨z', hz', rfl⟩ := hz₁ + have : z' ∈ closure e ∩ K.V := ⟨hz', hz₂⟩ + rw [hs'] at this + rw [mem_singleton_iff.mp this] + have h₁ := hmem (cap.emb v) (hset' ▸ mem_insert _ _) + have h₂ := hmem w (hset' ▸ mem_insert_of_mem _ rfl) + exact hw.2 ⟨v, hv, h₁.trans h₂.symm⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5o.lean b/LeanPool/GraphMinor/GM19/Section5o.lean new file mode 100644 index 0000000000..9e859939a3 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5o.lean @@ -0,0 +1,271 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5n +public import LeanPool.GraphMinor.GM19.CapModel +public import LeanPool.GraphMinor.GM19.Conditional2 + +/-! +# Graph Minors XIX, (5.4) + +The proof of (5.4). We take the lines `K_i` of `exists_crossLine`, use (5.2) and (5.1) to make them +all equal to one +line `K`, cut along `K`, and apply `S₃` to the fragment. The inflation that this gives glues to an +inflation of the +sequence by `glue_coloured`. +The deductions that use later proofs are in `Section5oProved`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +universe w + +variable {S : Type} [TopologicalSpace S] [T2Space S] + + +omit [T2Space S] in +/-- Frame-preserving maps compose. -/ +theorem IsFramePreservingHomeo.trans {Φ : Frame S} {α β : S ≃ₜ S} (hα : IsFramePreservingHomeo Φ α) + (hβ : IsFramePreservingHomeo Φ β) : IsFramePreservingHomeo Φ (α.trans β) := by + refine ⟨fun v hv ↦ ?_, fun s hs ↦ ?_, fun ω Δ hΔ a b c ha hb hc hab hbc hac ↦ ?_⟩ + · change β (α v) = v + rw [hα.fix_V v hv, hβ.fix_V v hv] + · have : (α.trans β) '' s = β '' (α '' s) := by + rw [image_image] + rfl + rw [this, hα.preserve_sides s hs, hβ.preserve_sides s hs] + · have h₁ := hα.preserves_orientation ω Δ hΔ a b c ha hb hc hab hbc hac + have ha' : α a ∈ discBd (α '' Δ) := GM20.image_discBd α Δ ▸ mem_image_of_mem _ ha + have hb' : α b ∈ discBd (α '' Δ) := GM20.image_discBd α Δ ▸ mem_image_of_mem _ hb + have hc' : α c ∈ discBd (α '' Δ) := GM20.image_discBd α Δ ▸ mem_image_of_mem _ hc + have h₂ := hβ.preserves_orientation ω (α '' Δ) (GM20.image_isClosedDisc α hΔ) _ _ _ ha' hb' hc' + (fun h ↦ hab (α.injective h)) (fun h ↦ hbc (α.injective h)) (fun h ↦ hac (α.injective h)) + have : (α.trans β) '' Δ = β '' (α '' Δ) := by + rw [image_image] + rfl + rw [this] + exact h₂.trans h₁ + +/-- An infinite set has an infinite part on which a map to a finite set is constant. -/ +theorem exists_infinite_fiber {ι β : Type*} {A : Set ι} (hA : A.Infinite) {B : Set β} + (hB : B.Finite) (g : ι → β) + (hg : ∀ i ∈ A, g i ∈ B) : ∃ b ∈ B, (A ∩ g ⁻¹' {b}).Infinite := by + by_contra h + push Not at h + refine hA ((hB.biUnion fun b hb ↦ h b hb).subset fun i hi ↦ ?_) + exact mem_biUnion (hg i hi) ⟨hi, rfl⟩ + +omit [T2Space S] in +/-- All three points of a size three edge are on the boundary of its disc. -/ +theorem Painting.tilde_subset_discBd (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) (h3 : + (tilde e).ncard = 3) : + IsClosedDisc (closure e) ∧ tilde e ⊆ discBd (closure e) := by + rcases Γ.edge_shape e he with h | h + · omega + · exact ⟨h.2.2.1, h.2.2.2⟩ + +/-- `ω` is positive on the size three edges of `Γ`. -/ +def IsPositive (ω : SurfaceOrientation S) (Γ : Painting S) : Prop := + ∀ e ∈ Γ.E, (tilde e).ncard = 3 → ∀ a b c : S, Γ.γ e = [a, b, c] → ω.pos (closure e) a b c + +variable {α₀ : Type w} {χ : ColourScheme S α₀} + +omit [T2Space S] in +/-- The image under a map that preserves `ω` of a painting positive for `ω` is positive for `ω`. -/ +theorem isPositive_image {ω : SurfaceOrientation S} {α : S ≃ₜ S} (hα : ω.IsPreservedBy α) {P P' : + ColouredPainting χ} + (I : IsColouredImage α P P') (h : IsPositive ω P.Γ) : IsPositive ω P'.Γ := by + intro e he h3 a b c hl + obtain ⟨e₀, he₀, rfl⟩ : e ∈ image α '' P.Γ.E := by + rw [← I.E_eq] + exact he + have h3' : (tilde e₀).ncard = 3 := by + rw [← h3, ← ncard_image_of_injective _ α.injective, GM20.image_tilde] + obtain ⟨hD, hsub⟩ := P.Γ.tilde_subset_discBd he₀ h3' + have hγ := I.γ e₀ he₀ + rw [hl] at hγ + obtain ⟨a', b', c', hl', rfl, rfl, rfl⟩ : ∃ a' b' c', P.Γ.γ e₀ = [a', b', c'] ∧ a = α a' ∧ b + = α b' ∧ c = α c' := by + obtain ⟨a', l₁, h₁, ha, hl₁⟩ := List.map_eq_cons_iff.mp hγ.symm + obtain ⟨b', l₂, h₂, hb, hl₂⟩ := List.map_eq_cons_iff.mp hl₁ + obtain ⟨c', h₃, hc⟩ := List.map_eq_singleton_iff.mp hl₂ + exact ⟨a', b', c', by rw [h₁, h₂, h₃], ha.symm, hb.symm, hc.symm⟩ + have hn := P.Γ.γ_nodup e₀ he₀ + rw [hl'] at hn + have hset := P.Γ.γ_set e₀ he₀ + have hmem : ∀ x ∈ [a', b', c'], x ∈ discBd (closure e₀) := fun x hx ↦ by + have hx' : x ∈ {v | v ∈ P.Γ.γ e₀} := by + rw [hl'] + exact hx + rw [hset] at hx' + exact hsub hx' + have := hα (closure e₀) hD a' b' c' (hmem _ (by simp)) (hmem _ (by simp)) (hmem _ (by simp)) + (by simp at hn; tauto) (by simp at hn; tauto) (by simp at hn; tauto) + rw [show closure (α '' e₀) = α '' closure e₀ from (α.image_closure e₀).symm] + exact this.mpr (h e₀ he₀ h3' _ _ _ hl') + +omit [T2Space S] in +/-- Over a line, a connected compact set of a cut surface lies in one of the two copies of the line. +-/ +theorem hasSheets_of_pair {Y : Type} [TopologicalSpace Y] {ψ : Y → S} {K : Drawing S} {X X' : Set + Y} (hd : Disjoint X X') + (hu : X ∪ X' = ψ ⁻¹' K.U) (hX : IsClosed X) (hX' : IsClosed X') (hi : InjOn ψ X) + (hi' : InjOn ψ X') : + HasSheets ψ K := by + intro e he J _ hJ hsub + have hJs : J ⊆ X ∪ X' := fun x hx ↦ by + rw [hu] + exact (he.2.1 (hsub (mem_image_of_mem ψ hx))).1 + by_cases h₁ : (J ∩ X).Nonempty + · by_cases h₂ : (J ∩ X').Nonempty + · obtain ⟨z, -, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp hJ X X' hX hX' hJs h₁ h₂ + exact absurd hz₂ (disjoint_left.mp hd hz₁) + · exact hi.mono fun x hx ↦ (hJs hx).resolve_right fun hx' ↦ h₂ ⟨x, hx, hx'⟩ + · exact hi'.mono fun x hx ↦ (hJs hx).resolve_left fun hx' ↦ h₁ ⟨x, hx, hx'⟩ + +omit [T2Space S] in +/-- A line whose two ends are vertices of `Γ` is anchored: the two sides of a point each hold an +end. -/ +theorem isAnchored_of_line {Γ : Painting S} {K : Drawing S} {a b : S} (hl : IsLineWithEnds K.U a b) + (ha : a ∈ Γ.V) + (hb : b ∈ Γ.V) : IsAnchored Γ K := by + obtain ⟨f, rfl, rfl⟩ := hl + intro u x hx hne + have hc : Continuous fun t ↦ (f t).1 := continuous_subtype_val.comp f.continuous + let p := f.symm ⟨x, hx⟩ + have hp : (f p).1 = x := by simp [p] + by_cases hu : u ∈ K.U + · let q := f.symm ⟨u, hu⟩ + have hq : (f q).1 = u := by simp [q] + have hinj : ∀ t, (f t).1 = u → t = q := fun t ht ↦ f.injective (Subtype.ext (ht.trans hq.symm)) + rcases le_total p q with hpq | hpq + · refine ⟨(fun t ↦ (f t).1) '' Iic p, ?_, ⟨p, le_rfl, hp⟩, isPreconnected_Iic.image _ + hc.continuousOn, + ⟨(f 0).1, ⟨0, unitInterval.nonneg _, rfl⟩, ha⟩⟩ + rintro _ ⟨t, ht, rfl⟩ + refine ⟨(f t).2, fun htu ↦ hne ?_⟩ + have := hinj t htu + subst this + rw [← hp, le_antisymm hpq ht] + exact hq + · refine ⟨(fun t ↦ (f t).1) '' Ici p, ?_, ⟨p, le_rfl, hp⟩, isPreconnected_Ici.image _ + hc.continuousOn, + ⟨(f 1).1, ⟨1, unitInterval.le_one _, rfl⟩, hb⟩⟩ + rintro _ ⟨t, ht, rfl⟩ + refine ⟨(f t).2, fun htu ↦ hne ?_⟩ + have := hinj t htu + subst this + rw [← hp, le_antisymm (show p ≤ _ from ht) hpq] + exact hq + · refine ⟨K.U, fun y hy ↦ ⟨hy, fun h ↦ hu (h ▸ hy)⟩, hx, ?_, ⟨(f 0).1, (f 0).2, ha⟩⟩ + have : K.U = (fun t ↦ (f t).1) '' univ := by + ext y + constructor + · intro hy + exact ⟨f.symm ⟨y, hy⟩, trivial, by simp⟩ + · rintro ⟨t, -, rfl⟩ + exact (f t).2 + rw [this] + exact isPreconnected_univ.image _ hc.continuousOn + +/-- The data of (5.3) on one fragment of a given cut. -/ +theorem frameData_of_cut (hS : IsSurface S) {Φ : Frame S} {Γ : Painting S} + (hfit : Γ.Fits Φ) {K : Drawing S} + (hinter : Γ.U ∩ K.U ⊆ Γ.V ∩ K.V) + (hlines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} ∧ + IsLineWithEnds (closure e) u v) + {Y : Type} [TopologicalSpace Y] [T2Space Y] {ψ : Y → S} (hY : IsSurface Y) (hψ : IsCutMap ψ K.U) + (hsheet : HasSheets ψ K) (y : Y) : FrameData Φ Γ K (fun x : connectedComponent y ↦ ψ x.1) := by + have hKbd : K.U ∩ bd S ⊆ K.V := fun x hx ↦ (hinter ⟨Γ.bd_subset hx.2, hx.1⟩).2 + refine ⟨⟨hS, isCuttingFragment_of_cut hS hY hψ (K := K) rfl y, hinter, + two_of_cut hS hY hψ hsheet hlines hKbd subset_union_right (fun C' ↦ ?_) y⟩, hfit, + two_of_cut hS hY hψ hsheet hlines hKbd subset_union_right (Frame.two_on_cuff' hS Φ) y, hKbd⟩ + obtain ⟨p, hp, q, hq, hpq⟩ := Frame.two_on_cuff hS Φ C' + exact ⟨p, ⟨Or.inl (hfit.V_subset hp.1), hp.2⟩, q, ⟨Or.inl (hfit.V_subset hq.1), hq.2⟩, hpq⟩ + +omit [T2Space S] in +/-- Cutting along a line between two cuffs. -/ +theorem exists_cross_cut (hS : IsSurface S) [ConnectedSpace S] {K : Drawing S} {s t : S} + (hst : s ≠ t) + (hbd : K.U ∩ bd S = {s, t}) (hl : IsLineWithEnds K.U s t) + (hne : connectedComponentIn (bd S) s ≠ connectedComponentIn (bd S) t) : + ∃ (Y : Type) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S), IsSurface Y + ∧ ConnectedSpace Y ∧ + IsCutMap ψ K.U ∧ HasSheets ψ K ∧ ∃ a b c : ℕ, Nonempty (S ≃ₜ SurfaceModel a b (c + 1)) ∧ + Nonempty (Y ≃ₜ SurfaceModel a b c) := by + obtain ⟨Y, tY, ψ, hY, hψ, h₁, -, X, X', hd, hu, hX, hX', hb, hb'⟩ := + cutIArc.{0} S K.U s t hS inferInstance hst hbd hl + have : T2Space Y := hY.2.1 + obtain ⟨hc, a, b, c, h₂, h₃⟩ := h₁ hne + have hcl : ∀ {L : Set Y}, IsLine L → IsClosed L := fun {L} ⟨f⟩ ↦ by + have : CompactSpace L := f.compactSpace + exact (isCompact_iff_compactSpace.mpr this).isClosed + exact ⟨Y, tY, inferInstance, ψ, hY, hc, IsCutting.isCutMap hψ, + hasSheets_of_pair hd hu (hcl hX) (hcl hX') hb.injOn hb'.injOn, a, b, c, h₂, h₃⟩ + +theorem numCuffs_model (a b c : ℕ) : numCuffs (SurfaceModel a b c) = c := by + obtain ⟨ht, f, hf⟩ := presents_ew a b c + exact ncard_cuffs hf + +/-- A connected space is its own component. -/ +def homeoComponent {Y : Type} [TopologicalSpace Y] [ConnectedSpace Y] + (y : Y) : Y ≃ₜ connectedComponent y := + (Homeomorph.Set.univ Y).symm.trans (Homeomorph.setCongr + (PreconnectedSpace.connectedComponent_eq_univ y).symm) + +variable {Shat : Type} [TopologicalSpace Shat] [T2Space Shat] + +omit [T2Space S] [T2Space Shat] in +/-- The fragment of the cut along a line between two cuffs has a capping homeomorphic to `Σ̂`, and +one cuff fewer. -/ +theorem capped_fragment (cap : IsCappedSurface S Shat) {Y : Type} [TopologicalSpace Y] + [ConnectedSpace Y] {y : Y} (hY₁ : IsSurface (connectedComponent y)) + (hc₁ : ConnectedSpace (connectedComponent y)) {a b c : ℕ} (h₁ : Nonempty (S ≃ₜ SurfaceModel a b + (c + 1))) + (h₂ : Nonempty (Y ≃ₜ SurfaceModel a b c)) : + ∃ (Shat₁ : Type) (_ : TopologicalSpace Shat₁), Nonempty (IsCappedSurface + (connectedComponent y) Shat₁) ∧ + Nonempty (Shat₁ ≃ₜ Shat) ∧ numCuffs (connectedComponent y) < numCuffs S := by + obtain ⟨e₁⟩ := h₁ + obtain ⟨e₂⟩ := h₂ + let e₃ : connectedComponent y ≃ₜ SurfaceModel a b c := (homeoComponent y).symm.trans e₂ + obtain ⟨Shat₁, t₁, ⟨cap₁⟩⟩ := exists_cappedSurface _ _ hY₁ hc₁ rfl + obtain ⟨g₁⟩ := capModel a b c Shat₁ (cap₁.ofHomeo e₃.symm) + obtain ⟨g₂⟩ := capModel a b (c + 1) Shat (cap.ofHomeo e₁.symm) + refine ⟨Shat₁, t₁, ⟨cap₁⟩, ⟨g₁.trans g₂.symm⟩, ?_⟩ + rw [numCuffs_eq e₃, numCuffs_eq e₁, numCuffs_model, numCuffs_model] + omega + +/-- An orientation moves along a homeomorphism. -/ +theorem isOrientable_of_homeo {X X' : Type} [TopologicalSpace X] [TopologicalSpace X'] (h : X ≃ₜ X') + (hO : IsOrientableSurface X') : IsOrientableSurface X := by + obtain ⟨ω⟩ := hO + have hmem : ∀ {Δ : Set X} {a : X}, a ∈ discBd Δ → h a ∈ discBd (h '' Δ) := fun {Δ a} ha ↦ + GM20.image_discBd h Δ ▸ mem_image_of_mem _ ha + refine ⟨⟨fun Δ a b c ↦ ω.pos (h '' Δ) (h a) (h b) (h c), fun Δ hΔ ↦ ?_, + fun Δ₁ Δ₂ h₁ h₂ hsub a b c ha hb hc hab hbc hac ↦ ?_⟩⟩ + · obtain ⟨φ, hc, hi, hr, hp⟩ := ω.isDirection (h '' Δ) (GM20.image_isClosedDisc h hΔ) + refine ⟨h.symm ∘ φ, h.symm.continuous.comp hc, h.symm.injective.comp hi, ?_, + fun a b c hab hbc hac ↦ ?_⟩ + · rw [range_comp, hr, GM20.image_discBd, image_image] + simp + · simp only [Function.comp_apply, h.apply_symm_apply] + exact hp a b c hab hbc hac + · exact ω.agree _ _ (GM20.image_isClosedDisc h h₁) (GM20.image_isClosedDisc h h₂) + (image_mono hsub) _ _ _ + ⟨hmem ha.1, hmem ha.2⟩ ⟨hmem hb.1, hmem hb.2⟩ ⟨hmem hc.1, hmem hc.2⟩ + (fun e ↦ hab (h.injective e)) (fun e ↦ hbc (h.injective e)) (fun e ↦ hac (h.injective e)) + + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5oProved.lean b/LeanPool/GraphMinor/GM19/Section5oProved.lean new file mode 100644 index 0000000000..1cbbeae15d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5oProved.lean @@ -0,0 +1,221 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5o +public import LeanPool.GraphMinor.GM19.Section5n +public import LeanPool.GraphMinor.GM19.CapModel +public import LeanPool.GraphMinor.GM19.Conditional2 + +import LeanPool.GraphMinor.GM19.FeatureCount + +import LeanPool.GraphMinor.GM19.FragmentOrient + +/-! +# Graph Minors XIX: proved deductions from Section5o + +The deductions use existing proofs after the preliminary geometry has been defined. +-/ + +public section +namespace GraphMinor.GM19 +open Set Topology GraphMinor.Surface +universe w + +/-- Transport an infinite sequence of bounded features to one feature drawing and pass to a +subsequence on which the vertex intersection with that drawing is fixed. -/ +theorem exists_aligned_feature_subsequence {S : Type} [TopologicalSpace S] [T2Space S] + {β : Type w} {χ : ColourScheme S β} (P : ℕ → ColouredPainting χ) (K : ℕ → Drawing S) + {A : Set ℕ} (hA : A.Infinite) (bound : ℕ) (hFeature : ∀ i ∈ A, IsFeature χ.Φ (K i)) + (hBound : ∀ i ∈ A, (K i).V.ncard + (K i).E.ncard ≤ bound) + (hIntersection : ∀ i ∈ A, (P i).Γ.U ∩ (K i).U ⊆ (P i).Γ.V ∩ (K i).V) : + ∃ (e₁ e₂ : ℕ → ℕ) (α : ℕ → S ≃ₜ S) (hα : ∀ m, IsFramePreservingHomeo χ.Φ (α m)), + StrictMono e₁ ∧ StrictMono e₂ ∧ (∀ m, e₁ m ∈ A) ∧ + (∀ m, α m '' (K (e₁ 0)).U = (K (e₁ m)).U) ∧ + (∀ m, α m '' (K (e₁ 0)).V = (K (e₁ m)).V) ∧ + let Q : ℕ → ColouredPainting χ := fun m ↦ (P (e₁ m)).image (α m).symm (hα m).symm + (∀ m, (Q m).Γ.U ∩ (K (e₁ 0)).U ⊆ (Q m).Γ.V ∩ (K (e₁ 0)).V) ∧ + (∀ i j, ∀ v ∈ (K (e₁ 0)).V, v ∈ (Q (e₂ i)).Γ.V ↔ v ∈ (Q (e₂ j)).Γ.V) := by + classical + have : Nonempty (Drawing S) := ⟨K 0⟩ + obtain ⟨𝓕, hf, h𝓕⟩ := theorem_5_2_proof S χ.isSurface χ.connected χ.Φ bound + have h𝓕' : ∀ i ∈ A, ∃ K₀ ∈ 𝓕, FeatureEquiv χ.Φ K₀ (K i) := + fun i hi ↦ h𝓕 _ (hFeature i hi) (hBound i hi) + choose! G hG hG' using h𝓕' + obtain ⟨K₀, -, hinf⟩ := exists_infinite_fiber hA hf G hG + set e₁ := Nat.nth (· ∈ A ∩ G ⁻¹' {K₀}) + have he₁s : StrictMono e₁ := Nat.nth_strictMono hinf + have he₁m : ∀ m, e₁ m ∈ A ∧ G (e₁ m) = K₀ + := fun m ↦ Nat.nth_mem_of_infinite hinf m + set Kc := K (e₁ 0) with hKc + have hfe : ∀ m, ∃ α : S ≃ₜ S, IsFramePreservingHomeo χ.Φ α ∧ α '' Kc.U = (K (e₁ m)).U ∧ + α '' Kc.V = (K (e₁ m)).V := by + intro m + obtain ⟨g₀, hg₀, hU₀, hV₀⟩ := hG' _ (he₁m 0).1 + obtain ⟨g, hg, hU, hV⟩ := hG' _ (he₁m m).1 + rw [(he₁m 0).2] at hU₀ hV₀ + rw [(he₁m m).2] at hU hV + refine ⟨g₀.symm.trans g, hg₀.symm.trans hg, ?_, ?_⟩ + · have : (g₀.symm.trans g) '' Kc.U = g '' (g₀.symm '' Kc.U) := by + rw [image_image] + rfl + rw [this, hKc, ← hU₀, symm_image_image', hU] + · have : (g₀.symm.trans g) '' Kc.V = g '' (g₀.symm '' Kc.V) := by + rw [image_image] + rfl + rw [this, hKc, ← hV₀, symm_image_image', hV] + choose α hα hαU hαV using hfe + let Q : ℕ → ColouredPainting χ := fun m ↦ (P (e₁ m)).image (α m).symm (hα m).symm + have hQ : ∀ m, IsColouredImage (α m).symm (P (e₁ m)) (Q m) := fun m ↦ + ColouredPainting.isImage_image _ _ _ + have hinter : ∀ m, (Q m).Γ.U ∩ Kc.U ⊆ (Q m).Γ.V ∩ Kc.V := by + rintro m x ⟨hx₁, hx₂⟩ + rw [(hQ m).U] at hx₁ + obtain ⟨y, hy, rfl⟩ := hx₁ + have hy' : y ∈ (K (e₁ m)).U := by + rw [← hαU m] + exact ⟨_, hx₂, (α m).apply_symm_apply y⟩ + obtain ⟨h₁, h₂⟩ := hIntersection _ (he₁m m).1 ⟨hy, hy'⟩ + refine ⟨?_, ?_⟩ + · rw [(hQ m).V] + exact mem_image_of_mem _ h₁ + · rw [← hαV m] at h₂ + obtain ⟨z, hz, rfl⟩ := h₂ + rwa [(α m).symm_apply_apply] + let g : ℕ → Set S := fun m ↦ Kc.V ∩ (Q m).Γ.V + obtain ⟨W₀, -, hinf₂⟩ := exists_infinite_fiber (A := univ) infinite_univ + Kc.finite_V.finite_subsets g + (fun m _ ↦ inter_subset_left) + set e₂ := Nat.nth (· ∈ univ ∩ g ⁻¹' {W₀}) + have he₂s : StrictMono e₂ := Nat.nth_strictMono hinf₂ + have he₂m : ∀ m, g (e₂ m) = W₀ := fun m ↦ (Nat.nth_mem_of_infinite hinf₂ m).2 + let R : ℕ → ColouredPainting χ := fun m ↦ Q (e₂ m) + have hRV : ∀ i j, ∀ v ∈ Kc.V, v ∈ (R i).Γ.V ↔ v ∈ (R j).Γ.V := by + intro i j v hv + have h₁ : g (e₂ i) = g (e₂ j) := (he₂m i).trans (he₂m j).symm + constructor + · intro h + exact (h₁ ▸ (⟨hv, h⟩ : v ∈ g (e₂ i)) : v ∈ g (e₂ j)).2 + · intro h + exact (h₁.symm ▸ (⟨hv, h⟩ : v ∈ g (e₂ j)) : v ∈ g (e₂ i)).2 + exact ⟨e₁, e₂, α, hα, he₁s, he₂s, fun m ↦ (he₁m m).1, hαU, hαV, hinter, hRV⟩ + +/-- **Graph Minors XIX, (5.4)** (page 337), from (5.2) and the facts about orientations and +cappings. -/ +theorem theorem_5_4_proof + : Theorem54Statement.{w} := by + classical + intro S Shat _ _ _ _ β _ cap χ hS3 P hbad hsim rad n + have hS := χ.isSurface + have := χ.connected + by_contra hno + push Not at hno + have hA : {i | Painting.dist (rad i) ≤ n}.Infinite := + Set.infinite_of_forall_exists_gt fun a ↦ by + obtain ⟨i, hi, hd⟩ := hno (a + 1) + exact ⟨i, hd, by omega⟩ + have hK : ∀ i ∈ {i | Painting.dist (rad i) ≤ n}, ∃ K, IsCrossLine χ.Φ (P i).Γ (4 * n + 3) K := + fun i hi ↦ exists_crossLine hS (rad i) (P i).fits hi + have : Nonempty (Drawing S) := by + obtain ⟨i, hi⟩ := hA.nonempty + obtain ⟨K, -⟩ := hK i hi + exact ⟨K⟩ + choose! K hK using hK + obtain ⟨e₁, e₂, α, hα, he₁s, he₂s, he₁m, _, _, hinter, hRV⟩ := + exists_aligned_feature_subsequence P K hA (4 * n + 3) + (fun i hi ↦ (hK i hi).feature) (fun i hi ↦ (hK i hi).size) (fun i hi ↦ (hK i hi).inter) + let Kc := K (e₁ 0) + have hcross := hK _ (he₁m 0) + let Q : ℕ → ColouredPainting χ := fun m ↦ (P (e₁ m)).image (α m).symm (hα m).symm + have hQ : ∀ m, IsColouredImage (α m).symm (P (e₁ m)) (Q m) := fun m ↦ + ColouredPainting.isImage_image _ _ _ + let R : ℕ → ColouredPainting χ := fun m ↦ Q (e₂ m) + obtain ⟨s, t, hst, hbd, hl, hne⟩ := hcross.line + obtain ⟨Y, tY, t2Y, ψ, hY, hcY, hψ, hsheet, a, b, c, h₁, h₂⟩ := exists_cross_cut hS hst hbd hl hne + let y₀ : Y := Classical.arbitrary Y + have hF := hcross.feature + let ψ₁ : connectedComponent y₀ → S := fun x ↦ ψ x.1 + have : Nonempty (connectedComponent y₀) := ⟨⟨y₀, mem_connectedComponent⟩⟩ + have D : ∀ m, FrameData χ.Φ (R m).Γ Kc ψ₁ := fun m ↦ + frameData_of_cut hS (R m).fits (hinter (e₂ m)) hcross.lines hY hψ hsheet y₀ + have hsV : ∀ m, s ∈ (R m).Γ.V := fun m ↦ by + have : s ∈ Kc.U ∩ bd S := hbd ▸ mem_insert _ _ + exact (hinter (e₂ m) ⟨(R m).Γ.bd_subset this.2, this.1⟩).1 + have htV : ∀ m, t ∈ (R m).Γ.V := fun m ↦ by + have : t ∈ Kc.U ∩ bd S := hbd ▸ mem_insert_of_mem _ rfl + exact (hinter (e₂ m) ⟨(R m).Γ.bd_subset this.2, this.1⟩).1 + have hAn : ∀ m, IsAnchored (R m).Γ Kc := fun m ↦ isAnchored_of_line hl (hsV m) (htV m) + obtain ⟨flip, hflip⟩ := (D 0).exists_flip + let a₀ : β := Classical.arbitrary β + let χ' := fragScheme χ a₀ (D 0) hF flip + let P' : ℕ → ColouredPainting χ' := fun m ↦ fragPainting (a₀ := a₀) (D 0) hF flip (R m) (D m) + (hAn m) + have hfrag := (D 0).pull.frag + obtain ⟨Shat₁, t₁, hc₁, hh, hlt⟩ := capped_fragment cap hfrag.isSurface hfrag.connected h₁ h₂ + have hnb : ¬ χ'.IsOrientedlyBad := hS3 _ Shat₁ χ' hc₁ hh rfl rfl hlt + have hsimP : IsSimilarlyOriented χ' P' := by + rcases hsim with h | ⟨ω, hω⟩ + · refine Or.inl fun hO ↦ h ?_ + obtain ⟨e₃⟩ := h₁ + obtain ⟨e₄⟩ := h₂ + exact isOrientable_of_homeo e₃ (modelOrientation a b c (isOrientable_of_homeo e₄.symm + (isOrientable_of_homeo (homeoComponent y₀) hO))) + · obtain ⟨ω₁, hω₁⟩ := GraphMinor.GM19.fragmentOrientation S _ Kc ψ₁ hS inferInstance hfrag ω + refine Or.inr ⟨ω₁, fun m e₁' he₁' h3 a' b' c' hl' ↦ ?_⟩ + have hpos : IsPositive ω (R m).Γ := isPositive_image ((hα _).symm.preserves_orientation ω) + (hQ _) (hω _) + have hEp : e₁' ∈ ((D m).paint flip).E := he₁' + have hint : Painting.IsInternal e₁' := by + refine disjoint_left.mpr fun x hx hxb ↦ ?_ + have := (((D m).paint flip).border_edge e₁' hEp ⟨x, hx, hxb⟩).1 + omega + obtain ⟨e, he, hb', hne', rfl⟩ := (D m).exists_lift_of_internal flip hEp hint + have hsub := (D m).pull.subset_R he hb' hne' + have hmap := (D m).map_march_lift (flip := flip) he hb' hne' + have hlist : ((D m).paint flip).γ (ψ₁ ⁻¹' e) = [a', b', c'] := hl' + rw [hlist] at hmap + obtain ⟨hdisc, htil⟩ := ((D m).paint flip).tilde_subset_discBd hEp h3 + have hn := ((D m).paint flip).γ_nodup _ hEp + have hset := ((D m).paint flip).γ_set _ hEp + rw [hlist] at hn hset + have hmem : ∀ x ∈ [a', b', c'], x ∈ discBd (closure (ψ₁ ⁻¹' e)) := fun x hx ↦ htil (hset ▸ hx) + have hsur : ψ₁ '' (ψ₁ ⁻¹' e) = e := image_preimage_eq_of_subset (hsub.trans + (image_subset_range _ _)) + have hcl : ψ₁ '' closure (ψ₁ ⁻¹' e) = closure e := by + rw [← hfrag.isClosedMap.closure_image_eq_of_continuous hfrag.continuous_ψ, hsur] + refine (hω₁ _ hdisc ((D m).pull.injOn_closure he hsub) a' b' c' (hmem _ (by simp)) (hmem _ + (by simp)) + (hmem _ (by simp)) (by simp at hn; tauto) (by simp at hn; tauto) + (by simp at hn; tauto)).mpr ?_ + rw [hcl] + have h3e : (tilde e).ncard = 3 := by + rw [← (D m).pull.ncard_tilde he hsub] + exact h3 + exact hpos e he h3e _ _ _ hmap.symm + have hnotbad : ¬ IsBadSequence χ' P' := fun hb' ↦ hnb ⟨P', hb', hsimP⟩ + unfold IsBadSequence at hnotbad + push Not at hnotbad + obtain ⟨i, j, hij, σv, σe, hσ⟩ := hnotbad + have hC : IsCover Kc (fun _ : Unit ↦ ψ₁) := by + refine ⟨fun x ↦ ?_, fun _ _ x y hxy hoff ↦ ?_⟩ + · obtain ⟨y, rfl⟩ := hψ.2.1 x + exact ⟨(), ⟨y, by rw [PreconnectedSpace.connectedComponent_eq_univ]; trivial⟩, rfl⟩ + · have : x.1 = y.1 := hψ.2.2.1 hoff (fun hK' ↦ hoff (hxy ▸ hK')) hxy + exact congrArg (Sigma.mk ()) (Subtype.ext this) + have hglue := glue_coloured (ι := Unit) (Y := fun _ ↦ connectedComponent y₀) (ψ := fun _ ↦ ψ₁) + (Γ₀ := fun _ ↦ (R 0).Γ) (D₀ := fun _ ↦ D 0) (hF := hF) (flip := fun _ ↦ flip) (P₁ := R i) (P₂ + := R j) + (D₁ := fun _ ↦ D i) (D₂ := fun _ ↦ D j) (hA₁ := hAn i) (hA₂ := hAn j) (σv := fun _ ↦ σv) (σe + := fun _ ↦ σe) + (a₀ := a₀) (fun _ ↦ hσ) (fun _ ↦ hflip) (hRV i j) hC + have hfin := IsColouredLinearInflation.image hS (hα _).symm.symm (hα _).symm.symm (hQ + (e₂ i)).symm (hQ (e₂ j)).symm hglue + exact hbad _ _ (he₁s (he₂s hij)) ⟨_, _, hfin⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5p.lean b/LeanPool/GraphMinor/GM19/Section5p.lean new file mode 100644 index 0000000000..95cbb91c0b --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5p.lean @@ -0,0 +1,369 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5o +public import LeanPool.GraphMinor.GM19.Theta + +/-! +# The circuit of the proof of (5.5) + +Take a non-null-homotopic circuit `F` of `Γ*` with `½|E(F)| ≤ n`, and with `|V(F) ∩ Σ|` as small as +possible. The paper +says that then "for each pole $r^*$, $V(F)$ contains at most two neighbours of $r^*$, and at most +one if $r^* \notin V(F_i)$". This +comes from the three-path lemma `null_of_theta`: a path through `r*` between two vertices of `F` +gives a circuit with fewer +vertices in `Σ`, and it is non-null-homotopic for one of the two ways of closing it. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} + + +/-- The circuits among which `F` is chosen in the proof of (5.5). -/ +def IsShortCircuit (rad : RadialDrawing cap Γ) (n : ℕ) (F : Drawing Shat) : Prop := + F.IsCircuitOf rad.G ∧ ¬ IsNullHomotopicOArc F.U ∧ F.E.ncard / 2 ≤ n + +/-- A chord of a circuit: one of the two ways of closing it gives a circuit that is not +null-homotopic. -/ +theorem exists_closing (hT : IsClosedSurface Shat) [ConnectedSpace Shat] {G F R : Drawing Shat} + (hF : F.IsCircuitOf G) + (hn : ¬ IsNullHomotopicOArc F.U) {a b : Shat} (ha : a ∈ F.V) (hb : b ∈ F.V) (hab : a ≠ b) + (hR : R.IsPathOf G a b) + (hV : R.V ∩ F.V ⊆ {a, b}) (hE : Disjoint R.E F.E) : + ∃ P Q : Drawing Shat, P.IsPathBetween a b ∧ Q.IsPathBetween a b ∧ P.IsSubdrawing F + ∧ Q.IsSubdrawing F ∧ + F.V = P.V ∪ Q.V ∧ F.E = P.E ∪ Q.E ∧ Disjoint P.E Q.E ∧ P.V ∩ Q.V = {a, b} ∧ + (G.sup P R).IsCircuit ∧ + ¬ IsNullHomotopicOArc (G.sup P R).U ∧ (G.sup P R).V = P.V ∪ R.V ∧ (G.sup P R).E = P.E ∪ R.E + := by + obtain ⟨hFG, hFc⟩ := hF + obtain ⟨P, Q, hP, hQ, sP, sQ, -, -, hPQ, hdE, heq⟩ := hFc.exists_two_paths ha hb hab + have hrs := hR.1 + have sPG := sP.trans hFG + have sQG := sQ.trans hFG + have hFV : F.V = P.V ∪ Q.V := by rw [← Drawing.sup_V sP sQ, heq] + have hFE : F.E = P.E ∪ Q.E := by rw [← Drawing.sup_E sP sQ, heq] + have hend : ∀ {D : Drawing Shat}, D.IsPathBetween a b → a ∈ D.V ∧ b ∈ D.V := fun {D} hD ↦ by + obtain ⟨W, -, hV', -⟩ := hD + rw [hV'] + exact ⟨W.start_mem_support, W.end_mem_support⟩ + have hint : ∀ {D : Drawing Shat}, D.V ⊆ F.V → D.IsPathBetween a b → R.V ∩ D.V = {a, b} + := fun hsub hD ↦ by + apply subset_antisymm + · exact fun x hx ↦ hV ⟨hx.1, hsub hx.2⟩ + · rintro x (rfl | rfl) + · exact ⟨(hend hR.2).1, (hend hD).1⟩ + · exact ⟨(hend hR.2).2, (hend hD).2⟩ + have hPF : P.V ⊆ F.V := hFV ▸ subset_union_left + have hQF : Q.V ⊆ F.V := hFV ▸ subset_union_right + have hdP : Disjoint R.E P.E := hE.mono_right (hFE ▸ subset_union_left) + have hdQ : Disjoint R.E Q.E := hE.mono_right (hFE ▸ subset_union_right) + have hcP : (G.sup P R).IsCircuit := + Drawing.isCircuit_sup hP hR.2 sPG hrs hab (by rw [inter_comm]; exact hint hPF hP) hdP.symm + have hcQ : (G.sup Q R).IsCircuit := + Drawing.isCircuit_sup hQ hR.2 sQG hrs hab (by rw [inter_comm]; exact hint hQF hQ) hdQ.symm + have hUP : (G.sup P R).U = R.U ∪ P.U := by + rw [U_union (Drawing.sup_V sPG hrs) (Drawing.sup_E sPG hrs), union_comm] + have hUQ : (G.sup Q R).U = Q.U ∪ R.U := U_union (Drawing.sup_V sQG hrs) (Drawing.sup_E sQG hrs) + have hUF : F.U = P.U ∪ Q.U := U_union hFV hFE + have hOP : IsOArc (G.sup P R).U := (IsCircuit.isOArc_U hcP) + have hOQ : IsOArc (G.sup Q R).U := (IsCircuit.isOArc_U hcQ) + by_cases h₁ : IsNullHomotopicOArc (G.sup P R).U + · by_cases h₂ : IsNullHomotopicOArc (G.sup Q R).U + · exfalso + refine hn ?_ + rw [hUF] + refine null_of_theta hT (isLine_of_isPathBetween hP hab) (isLine_of_isPathBetween hQ hab) + (isLine_of_isPathBetween hR.2 hab) ?_ ?_ ?_ ?_ (hUQ ▸ hOQ) (hUP ▸ hOP) (hUQ ▸ h₂) (hUP ▸ h₁) + · rw [U_inter_of_disjoint sPG sQG hdE, hPQ] + · rw [U_inter_of_disjoint sQG hrs hdQ.symm, inter_comm] + exact hint hQF hQ + · rw [U_inter_of_disjoint hrs sPG hdP] + exact hint hPF hP + · rw [← hUF] + exact IsCircuit.isOArc_U hFc + · exact ⟨Q, P, hQ, hP, sQ, sP, by rw [hFV, union_comm], by rw [hFE, union_comm], hdE.symm, + by rw [inter_comm, hPQ], hcQ, h₂, Drawing.sup_V sQG hrs, + Drawing.sup_E sQG hrs⟩ + · exact ⟨P, Q, hP, hQ, sP, sQ, hFV, hFE, hdE, hPQ, hcP, h₁, Drawing.sup_V sPG hrs, + Drawing.sup_E sPG hrs⟩ + +omit [T2Space Shat] in +theorem first_step {G Q : Drawing Shat} (hsub : Q.IsSubdrawing G) {a b : Shat} (hab : a ≠ b) + (hQ : Q.IsPathBetween a b) : + ∃ e ∈ Q.E, ∃ w ∈ Q.V, w ≠ a ∧ closure e ∩ G.V = {a, w} ∧ (w = b ∨ (w ≠ b ∧ 2 ≤ Q.E.ncard)) := by + classical + obtain ⟨W, hW, hV, hE⟩ := hQ + cases W with + | nil _ => exact absurd rfl hab + | @cons _ w _ e h rest => + have hne : w ≠ a := by + rintro rfl + have : (Surface.GraphWalk.cons h rest).support = _ := rfl + unfold Surface.GraphWalk.IsSimple at hW + rw [this] at hW + exact (List.nodup_cons.1 hW).1 rest.start_mem_support + have hsetQ : closure e ∩ G.V = {a, w} := by + rw [← hsub.closure_inter_V h.1] + exact h.2.2.2 + refine ⟨e, h.1, w, h.2.2.1, hne, hsetQ, ?_⟩ + cases rest with + | nil _ => exact Or.inl rfl + | @cons _ w' _ e' h' rest' => + by_cases hwb : w = b + · exact Or.inl hwb + · right + refine ⟨hwb, ?_⟩ + have hee : e ≠ e' := by + rintro rfl + have hs₁ : ({a, w} : Set Shat) = {w, w'} := h.2.2.2.symm.trans h'.2.2.2 + have ha' : a ∈ ({w, w'} : Set Shat) := hs₁ ▸ mem_insert _ _ + rcases ha' with rfl | ha' + · exact hne rfl + · obtain rfl : a = w' := ha' + have hn : (a :: w :: a :: rest'.support).Nodup := by + have : (a :: (w :: rest'.support)) = _ := rfl + have h₂ : (Surface.GraphWalk.cons h (Surface.GraphWalk.cons h' rest')).support + = a :: w :: rest'.support := rfl + unfold Surface.GraphWalk.IsSimple at hW + rw [h₂] at hW + have h₃ : a ∈ rest'.support := rest'.start_mem_support + exact absurd (List.mem_cons_of_mem _ h₃) (List.nodup_cons.1 hW).1 + exact absurd (by simp) (List.nodup_cons.1 hn).1 + have hsub₂ : ({e, e'} : Set (Set Shat)) ⊆ Q.E := by + rw [hE] + rintro x (rfl | rfl) + · simp [Surface.GraphWalk.edges] + · simp [Surface.GraphWalk.edges] + have hfin : Q.E.Finite := Q.finite_edges + calc 2 = ({e, e'} : Set (Set Shat)).ncard := (ncard_pair hee).symm + _ ≤ Q.E.ncard := ncard_le_ncard hsub₂ hfin + +variable (hS : IsSurface S) + +omit [T2Space S] in +/-- The step that makes `F` smaller. `R` is a path outside `F` between two vertices of `F`, with its +inner vertices off +`Σ`. Each path of `F` between the two ends has an inner vertex in `Σ`, and it is at least as long as +`R`. -/ +theorem exists_smaller_circuit (rad : RadialDrawing cap Γ) [ConnectedSpace Shat] {n : ℕ} {F R : + Drawing Shat} + (hF : IsShortCircuit rad n F) {a b : Shat} (ha : a ∈ F.V) (hb : b ∈ F.V) (hab : a ≠ b) + (hR : R.IsPathOf rad.G a b) (hV : R.V ∩ F.V ⊆ {a, b}) (hE : Disjoint R.E F.E) + (hVr : R.V ∩ range cap.emb ⊆ {a, b}) + (hQ : ∀ Q : Drawing Shat, Q.IsPathBetween a b → Q.IsSubdrawing F → R.E.ncard ≤ Q.E.ncard ∧ + ∃ w ∈ Q.V, w ≠ a ∧ w ≠ b ∧ w ∈ range cap.emb) : + ∃ F', IsShortCircuit rad n F' ∧ (F'.V ∩ range cap.emb).ncard < (F.V ∩ range cap.emb).ncard := by + obtain ⟨hFc, hnn, hlen⟩ := hF + obtain ⟨P, Q, hP, hQp, sP, sQ, hFV, hFE, hdE, hPQ, hc, hnc, hcV, hcE⟩ := + exists_closing cap.isClosedSurface hFc hnn ha hb hab hR hV hE + obtain ⟨hl, w, hwQ, hwa, hwb, hwr⟩ := hQ Q hQp sQ + have hfG := rad.G + have hEle : (rad.G.sup P R).E.ncard ≤ F.E.ncard := by + rw [hcE, hFE, ncard_union_eq hdE P.finite_edges Q.finite_edges] + exact (ncard_union_le _ _).trans (by omega) + refine ⟨rad.G.sup P R, ⟨⟨rad.G.sup_isSubdrawing _ _, hc⟩, hnc, ?_⟩, ?_⟩ + · exact (Nat.div_le_div_right hEle).trans hlen + · have hfin : (F.V ∩ range cap.emb).Finite := F.finite_V.inter_of_left _ + refine ncard_lt_ncard ⟨?_, ?_⟩ hfin + · rintro x ⟨hx, hxr⟩ + rw [hcV] at hx + rcases hx with hx | hx + · exact ⟨hFV ▸ Or.inl hx, hxr⟩ + · rcases hVr ⟨hx, hxr⟩ with rfl | rfl + · exact ⟨ha, hxr⟩ + · exact ⟨hb, hxr⟩ + · intro hsub + have hwF : w ∈ F.V ∩ range cap.emb := ⟨hFV ▸ Or.inr hwQ, hwr⟩ + obtain ⟨h₁, -⟩ := hsub hwF + rw [hcV] at h₁ + rcases h₁ with h₁ | h₁ + · have : w ∈ P.V ∩ Q.V := ⟨h₁, hwQ⟩ + rw [hPQ] at this + rcases this with h | h + · exact hwa h + · exact hwb h + · rcases hVr ⟨h₁, hwr⟩ with h | h + · exact hwa h + · exact hwb h + +variable (rad : RadialDrawing cap Γ) (h3 : Γ.IsInternallyThreeConnected) +include hS + +omit hS in +omit [T2Space S] [T2Space Shat] in +theorem RadialDrawing.other_end_Rstar {e : Set Shat} (he : e ∈ rad.G.E) {u : S} {w : Shat} + (hu : u ∈ Γ.V) + (hset : closure e ∩ rad.G.V = {cap.emb u, w}) : w ∈ rad.Rstar := by + obtain ⟨v, hv, w', hw', h⟩ := rad.edge_ends he + rw [hset] at h + rcases (Set.pair_eq_pair_iff.1 h) with ⟨-, rfl⟩ | ⟨h₁, -⟩ + · exact hw' + · exact absurd (⟨u, hu, rfl⟩ : cap.emb u ∈ Γ.hatV cap) (h₁ ▸ hw'.2) + +omit [T2Space S] [T2Space Shat] in +omit hS in +/-- A neighbour in `Γ*` of a vertex on the cuff `Θ` is in `Σ`, unless it is the pole of `Θ`. -/ +theorem RadialDrawing.step_in_range {e : Set Shat} (he : e ∈ rad.G.E) {u : S} {w p : Shat} + (hu : u ∈ Γ.V) {Θ : Set S} + (hΘ : Θ ∈ cuffs S) (huΘ : u ∈ Θ) (hp : p ∈ rad.poles) (hreg : rad.regionOf p = cap.cuffDisc Θ) + (hset : closure e ∩ rad.G.V = {cap.emb u, w}) (hwp : w ≠ p) : w ∈ range cap.emb := by + have hw := rad.other_end_Rstar he hu hset + by_cases hpw : w ∈ rad.poles + · exfalso + obtain ⟨Θ', hΘ', hreg', -⟩ := rad.pole_cases hpw + obtain ⟨-, huΘ'⟩ := rad.pole_edge he hpw hΘ' hreg' hset + have hΘe : Θ' = Θ := by + by_contra hne + exact disjoint_left.1 (cuffs_disjoint hΘ' hΘ hne) huΘ' huΘ + subst hΘe + obtain ⟨-, -, hG3, -⟩ := id rad.isPreRadial + exact hwp ((hG3 _ (rad.regionOf_mem hp.1).1).unique + ⟨hreg.trans hreg'.symm ▸ (rad.regionOf_mem hpw.1).2, hpw.1.1⟩ ⟨(rad.regionOf_mem hp.1).2, + hp.1.1⟩) + · exact rad.region_subset_range hw hpw (rad.regionOf_mem hw).2 + +variable [ConnectedSpace Shat] +include h3 + +/-- Two vertices of `F` on the cuff of a pole outside `F` give a smaller circuit. -/ +theorem exists_smaller_of_two {n : ℕ} {F : Drawing Shat} (hF : IsShortCircuit rad n F) {p : Shat} + (hp : p ∈ rad.poles) + (hpF : p ∉ F.V) {Θ : Set S} (hΘ : Θ ∈ cuffs S) (hreg : rad.regionOf p + = cap.cuffDisc Θ) {u v : S} (hu : u ∈ Γ.V) + (hv : v ∈ Γ.V) (huΘ : u ∈ Θ) (hvΘ : v ∈ Θ) (hne : u ≠ v) (hu' : cap.emb u ∈ F.V) + (hv' : cap.emb v ∈ F.V) : + ∃ F', IsShortCircuit rad n F' ∧ (F'.V ∩ range cap.emb).ncard < (F.V ∩ range cap.emb).ncard := by + classical + have hpm : p ∉ range cap.emb := cap.notMem_range hΘ (hreg ▸ (rad.regionOf_mem hp.1).2) + obtain ⟨e₁, he₁, hs₁⟩ := rad.exists_pole_edge hS h3 hp hΘ hreg hu huΘ + obtain ⟨e₂, he₂, hs₂⟩ := rad.exists_pole_edge hS h3 hp hΘ hreg hv hvΘ + have hG : ∀ {w : S}, w ∈ Γ.V → cap.emb w ∈ rad.G.V := fun hw ↦ rad.isPreRadial.2.1 ⟨_, hw, rfl⟩ + have hpG : p ∈ rad.G.V := hp.1.1 + have hl₁ : rad.G.toGraph.IsLink e₁ (cap.emb u) p := ⟨he₁, hG hu, hpG, hs₁⟩ + have hl₂ : rad.G.toGraph.IsLink e₂ p (cap.emb v) := + ⟨he₂, hpG, hG hv, by rw [Set.pair_comm]; exact hs₂⟩ + let M : Surface.GraphWalk rad.G.toGraph (cap.emb u) (cap.emb v) := .cons hl₁ (.cons hl₂ (.nil + (hG hv))) + have hsupp : M.support = [cap.emb u, p, cap.emb v] := rfl + have hedge : M.edges = [e₁, e₂] := rfl + have hemb : cap.emb u ≠ cap.emb v := fun h ↦ hne (cap.isEmbedding.injective h) + have hu₁ : cap.emb u ≠ p := fun h ↦ hpm ⟨u, h⟩ + have hv₁ : p ≠ cap.emb v := fun h ↦ hpm ⟨v, h.symm⟩ + have hsimple : M.IsSimple := by + unfold Surface.GraphWalk.IsSimple + rw [hsupp] + simp [hu₁, hemb, hv₁] + set R := walkDrawing rad.G M with hRdef + have hRV : ∀ z, z ∈ R.V ↔ z = cap.emb u ∨ z = p ∨ z = cap.emb v := fun z ↦ by + rw [hRdef, walkDrawing_V, mem_ofPred_eq, hsupp] + simp + have hRE : R.E ⊆ {e₁, e₂} := fun z hz ↦ by + rw [hRdef, walkDrawing_E, mem_ofPred_eq, hedge] at hz + simpa using hz + have hsubF := hF.1.1 + have hE₁ : ∀ {e} {x}, closure e ∩ rad.G.V = {x, p} → e ∉ F.E := fun {e x} hs he ↦ by + have : p ∈ closure e ∩ F.V := by + rw [hsubF.closure_inter_V he, hs] + exact mem_insert_of_mem _ rfl + exact hpF this.2 + refine exists_smaller_circuit rad hF hu' hv' hemb ⟨walkDrawing_isSubdrawing _ _, + walkDrawing_isPathBetween _ hsimple⟩ ?_ ?_ ?_ + fun Q hQ hsQ ↦ ?_ + · rintro z ⟨hz, hzF⟩ + rcases (hRV z).1 hz with rfl | rfl | rfl + · exact Or.inl rfl + · exact absurd hzF hpF + · exact Or.inr rfl + · refine disjoint_left.2 fun e he heF ↦ ?_ + rcases hRE he with rfl | rfl + · exact hE₁ hs₁ heF + · exact hE₁ hs₂ heF + · rintro z ⟨hz, hzr⟩ + rcases (hRV z).1 hz with rfl | rfl | rfl + · exact Or.inl rfl + · exact absurd hzr hpm + · exact Or.inr rfl + · obtain ⟨e, he, w, hw, hwa, hset, hend⟩ := first_step (hsQ.trans hsubF) hemb hQ + have heG := hsubF.2 (hsQ.2 he) + have hwR := rad.other_end_Rstar heG hu hset + have hwp : w ≠ p := fun h ↦ hpF (hsQ.1 (h ▸ hw)) + have hwb : w ≠ cap.emb v := fun h ↦ hwR.2 ⟨v, hv, h.symm⟩ + refine ⟨?_, w, hw, hwa, hwb, rad.step_in_range heG hu hΘ huΘ hp hreg hset hwp⟩ + have h₂ : 2 ≤ Q.E.ncard := (hend.resolve_left hwb).2 + exact (ncard_le_ncard hRE (toFinite _)).trans ((ncard_insert_le _ _).trans (by simpa using h₂)) + +/-- A vertex of `F` on the cuff of a pole of `F` that is not next to the pole in `F` gives a smaller +circuit. -/ +theorem exists_smaller_of_pole {n : ℕ} {F : Drawing Shat} (hF : IsShortCircuit rad n F) {p : Shat} + (hp : p ∈ rad.poles) + (hpF : p ∈ F.V) {Θ : Set S} (hΘ : Θ ∈ cuffs S) (hreg : rad.regionOf p = cap.cuffDisc Θ) {v : S} + (hv : v ∈ Γ.V) (hvΘ : v ∈ Θ) (hv' : cap.emb v ∈ F.V) + (hno : ∀ e ∈ F.E, closure e ∩ rad.G.V ≠ {cap.emb v, p}) : + ∃ F', IsShortCircuit rad n F' ∧ (F'.V ∩ range cap.emb).ncard < (F.V ∩ range cap.emb).ncard := by + classical + have hpm : p ∉ range cap.emb := cap.notMem_range hΘ (hreg ▸ (rad.regionOf_mem hp.1).2) + obtain ⟨e₁, he₁, hs₁⟩ := rad.exists_pole_edge hS h3 hp hΘ hreg hv hvΘ + have hG : cap.emb v ∈ rad.G.V := rad.isPreRadial.2.1 ⟨_, hv, rfl⟩ + have hpG : p ∈ rad.G.V := hp.1.1 + have hl₁ : rad.G.toGraph.IsLink e₁ p (cap.emb v) := + ⟨he₁, hpG, hG, by rw [Set.pair_comm]; exact hs₁⟩ + let M : Surface.GraphWalk rad.G.toGraph p (cap.emb v) := .cons hl₁ (.nil hG) + have hsupp : M.support = [p, cap.emb v] := rfl + have hedge : M.edges = [e₁] := rfl + have hne : p ≠ cap.emb v := fun h ↦ hpm ⟨v, h.symm⟩ + have hsimple : M.IsSimple := by + unfold Surface.GraphWalk.IsSimple + rw [hsupp] + simp [hne] + set R := walkDrawing rad.G M with hRdef + have hRV : ∀ z, z ∈ R.V ↔ z = p ∨ z = cap.emb v := fun z ↦ by + rw [hRdef, walkDrawing_V, mem_ofPred_eq, hsupp] + simp + have hRE : R.E ⊆ {e₁} := fun z hz ↦ by + rw [hRdef, walkDrawing_E, mem_ofPred_eq, hedge] at hz + simpa using hz + have hsubF := hF.1.1 + refine exists_smaller_circuit rad hF hpF hv' hne ⟨walkDrawing_isSubdrawing _ _, + walkDrawing_isPathBetween _ hsimple⟩ ?_ ?_ ?_ + fun Q hQ hsQ ↦ ?_ + · rintro z ⟨hz, -⟩ + exact (hRV z).1 hz + · refine disjoint_left.2 fun e he heF ↦ ?_ + rcases hRE he with rfl + exact hno e heF hs₁ + · rintro z ⟨hz, -⟩ + exact (hRV z).1 hz + · obtain ⟨e, he, w, hw, hwa, hset, hend⟩ := first_step (hsQ.trans hsubF) hne hQ + have heG := hsubF.2 (hsQ.2 he) + obtain ⟨u, hu, w', hw', hset'⟩ := rad.edge_ends heG + have hset₂ : ({p, w} : Set Shat) = {cap.emb u, w'} := hset.symm.trans hset' + have hwu : w = cap.emb u := by + rcases Set.pair_eq_pair_iff.1 hset₂ with ⟨h₁, -⟩ | ⟨-, h₁⟩ + · exact absurd ⟨u, h₁.symm⟩ hpm + · exact h₁ + have hwb : w ≠ cap.emb v := by + intro h + refine hno e (hsQ.2 he) ?_ + rw [hset, h, Set.pair_comm] + refine ⟨?_, w, hw, hwa, hwb, ⟨u, hwu.symm⟩⟩ + have h₂ : 2 ≤ Q.E.ncard := (hend.resolve_left hwb).2 + have h₃ := ncard_le_ncard hRE (toFinite _) + rw [ncard_singleton] at h₃ + exact h₃.trans (by omega) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5q.lean b/LeanPool/GraphMinor/GM19/Section5q.lean new file mode 100644 index 0000000000..8c3e4c8292 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5q.lean @@ -0,0 +1,612 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5p + +/-! +# The feature of the proof of (5.5) + +`F ∩ Σ` is a feature (`comap_facts`). If `dist(Γ)` is large then `F` meets at most one cuff +(`label_eq`), and the choice of +`F` leaves the shapes of `IsCutShape`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} + + +omit [T2Space S] [T2Space Shat] in +/-- A subdrawing of `Γ*` that lies in `Σ` is a feature that meets `Γ` only in vertices. -/ +theorem comap_facts [Nonempty S] (rad : RadialDrawing cap Γ) {Φ : Frame S} + (hfit : Γ.Fits Φ) {P : Drawing Shat} (hsub : P.IsSubdrawing rad.G) + (hP : P.U ⊆ range cap.emb) (hj : IsClosedEmbedding cap.emb) (hiso : ∀ v ∈ P.V, ∃ e ∈ P.E, v ∈ + closure e) : + Γ.U ∩ (GM19.Drawing.comap P hj hP).U ⊆ Γ.V ∩ (GM19.Drawing.comap P hj hP).V ∧ + IsFeature Φ (GM19.Drawing.comap P hj hP) ∧ + (∀ e ∈ arcComponentsIn ((GM19.Drawing.comap P hj hP).U \ (GM19.Drawing.comap P hj hP).V), ∃ u + v, u ≠ v ∧ + closure e ∩ (GM19.Drawing.comap P hj hP).V = {u, v} ∧ IsLineWithEnds (closure e) u v) ∧ + (GM19.Drawing.comap P hj hP).V.ncard = P.V.ncard ∧ (GM19.Drawing.comap P hj hP).E.ncard + = P.E.ncard := by + set K : Drawing S := GM19.Drawing.comap P hj hP with hKdef + have hKU : cap.emb '' K.U = P.U := image_preimage_eq_of_subset hP + have hKV : cap.emb '' K.V = P.V := image_preimage_eq_of_subset (P.V_subset_U.trans hP) + have hinter : Γ.U ∩ K.U ⊆ Γ.V ∩ K.V := by + rintro x ⟨hxΓ, hxK⟩ + have hU : cap.emb x ∈ Γ.hatU cap ∩ rad.G.U := ⟨mem_image_of_mem _ hxΓ, hsub.U_subset hxK⟩ + rw [rad.isPreRadial.1] at hU + obtain ⟨v, hv, hvx⟩ := hU + obtain rfl := cap.isEmbedding.injective hvx + exact ⟨hv, IsSubdrawing.mem_V hsub hxK (rad.isPreRadial.2.1 ⟨_, hv, rfl⟩)⟩ + have hE' : ∀ e ∈ arcComponentsIn (K.U \ K.V), cap.emb '' e ∈ P.E := fun e he ↦ by + change cap.emb '' e ∈ arcComponentsIn (P.U \ P.V) + rw [arcs_comap hj hP] + exact mem_image_of_mem _ he + have hfeat : IsFeature Φ K := by + refine ⟨fun e he ↦ disjoint_left.mpr fun x hxe hxb ↦ ?_, fun v hv ↦ ?_, + fun s₀ hs₀ ↦ disjoint_left.mpr fun x hx hxs ↦ ?_⟩ + · exact (he.2.1 hxe).2 (hinter ⟨Γ.bd_subset hxb, (he.2.1 hxe).1⟩).2 + · obtain ⟨e, he, hve⟩ := hiso _ hv + have heP : e ∈ arcComponentsIn (P.U \ P.V) := he + rw [arcs_comap hj hP] at heP + obtain ⟨e', he', rfl⟩ := heP + rw [hj.closure_image_eq] at hve + obtain ⟨v', hv', hvv⟩ := hve + obtain rfl := cap.isEmbedding.injective hvv + exact ⟨e', he', hv', fun h ↦ (he'.2.1 h).2 hv⟩ + · have hxb : x ∈ bd S := (hs₀.1.2.1 hxs).1 + have hxV := (hinter ⟨Γ.bd_subset hxb, hx⟩).1 + exact Γ.disjoint_V (hfit.short_sides hs₀) hxs hxV + refine ⟨hinter, hfeat, fun e he ↦ ?_, ?_, ?_⟩ + · rcases K.edge_cond e he with h | ⟨u, hs', -⟩ + · exact h + · exfalso + have heP := hE' e he + have heG := hsub.2 heP + obtain ⟨v, hv, w, hw, hset⟩ := rad.edge_ends heG + have hset' : closure (cap.emb '' e) ∩ P.V = {cap.emb v, w} := by + rw [hsub.closure_inter_V heP, hset] + have hmem : ∀ z, z ∈ closure (cap.emb '' e) ∩ P.V → z = cap.emb u := by + rintro z ⟨hz₁, hz₂⟩ + rw [hj.closure_image_eq] at hz₁ + obtain ⟨z', hz', rfl⟩ := hz₁ + have : z' ∈ closure e ∩ K.V := ⟨hz', hz₂⟩ + rw [hs'] at this + rw [mem_singleton_iff.mp this] + have h₁ := hmem (cap.emb v) (hset' ▸ mem_insert _ _) + have h₂ := hmem w (hset' ▸ mem_insert_of_mem _ rfl) + exact hw.2 ⟨v, hv, h₁.trans h₂.symm⟩ + · rw [← hKV, ncard_image_of_injective _ cap.isEmbedding.injective] + · change (arcComponentsIn (cap.emb ⁻¹' P.U \ cap.emb ⁻¹' P.V)).ncard = (arcComponentsIn + (P.U \ P.V)).ncard + rw [arcs_comap hj hP, ncard_image_of_injective _ (image_injective.mpr + cap.isEmbedding.injective)] + +variable (hS : IsSurface S) (rad : RadialDrawing cap Γ) (h3 : Γ.IsInternallyThreeConnected) +include hS + +omit [T2Space Shat] in +/-- A vertex of `Γ*` with a label is the pole of that cuff or is next to it. -/ +theorem exists_walk_to_pole {x p : Shat} {c : Set S} (hx : x ∈ rad.G.V) (hl : cuffLabel cap x + = some c) + (hp : p ∈ rad.poles) (hreg : rad.regionOf p = cap.cuffDisc c) (h3 : + Γ.IsInternallyThreeConnected) : + ∃ W : Surface.GraphWalk rad.G.toGraph p x, W.length ≤ 1 := by + classical + obtain ⟨hc, hxc⟩ := cuffLabel_some hl + by_cases hV : x ∈ Γ.hatV cap + · obtain ⟨v, hv, rfl⟩ := hV + obtain ⟨-, hvc⟩ := mem_cuff_of_label hl + obtain ⟨e, he, hs⟩ := rad.exists_pole_edge hS h3 hp hc hreg hv hvc + exact ⟨.cons (⟨he, hp.1.1, hx, by rw [Set.pair_comm]; exact hs⟩ : rad.G.toGraph.IsLink e p + (cap.emb v)) (.nil hx), + by simp [Surface.GraphWalk.length, Surface.GraphWalk.edges]⟩ + · have hw : x ∈ rad.Rstar := ⟨hx, hV⟩ + have hxd : x ∈ cap.cuffDisc c := by + rw [cap.closure_cuffDisc hc] at hxc + rcases hxc with h | ⟨y, hy, rfl⟩ + · exact h + · exfalso + have hr := (rad.regionOf_mem hw).2 + have hU : cap.emb y ∈ Γ.hatU cap := mem_image_of_mem _ (Γ.bd_subset + (cuff_subset_bd ⟨c, hc⟩ hy)) + exact (connectedComponentIn_subset _ _ hr) hU + obtain ⟨-, -, hG3, -⟩ := id rad.isPreRadial + have hpr := rad.regionOf_mem hp.1 + obtain rfl : x = p := (hG3 _ hpr.1).unique ⟨hreg ▸ hxd, hx⟩ ⟨hpr.2, hp.1.1⟩ + exact ⟨.nil hx, by simp [Surface.GraphWalk.length, Surface.GraphWalk.edges]⟩ + +/-- If `dist(Γ)` is large, then a short circuit meets one cuff at most. -/ +theorem label_eq {n : ℕ} (hd : ((n + 1 : ℕ) : ℕ∞) < Painting.dist rad) {F : Drawing Shat} + (hF : IsShortCircuit rad n F) + (h3 : Γ.IsInternallyThreeConnected) {x y : Shat} (hx : x ∈ F.V) (hy : y ∈ F.V) {c d : Set S} + (hlx : cuffLabel cap x = some c) (hly : cuffLabel cap y = some d) : c = d := by + classical + by_contra hcd + have hxy : x ≠ y := by + rintro rfl + exact hcd (Option.some.inj (hlx.symm.trans hly)) + obtain ⟨hc, -⟩ := cuffLabel_some hlx + obtain ⟨hd', -⟩ := cuffLabel_some hly + obtain ⟨p₁, hp₁, hm₁, hr₁⟩ := rad.exists_pole hc + obtain ⟨p₂, hp₂, hm₂, hr₂⟩ := rad.exists_pole hd' + have hpne : p₁ ≠ p₂ := by + rintro rfl + exact disjoint_left.1 (cap.cuffDisc_disjoint _ hc _ hd' hcd) (subset_closure hm₁) + (subset_closure hm₂) + obtain ⟨hFG, hFc⟩ := hF.1 + obtain ⟨W₁, hW₁⟩ := exists_walk_to_pole hS rad (hFG.1 hx) hlx hp₁ hr₁ h3 + obtain ⟨W₂, hW₂⟩ := exists_walk_to_pole hS rad (hFG.1 hy) hly hp₂ hr₂ h3 + obtain ⟨P, -, hP, -, sP, -, -, -, -, -, heq⟩ := hFc.exists_two_paths hx hy hxy + obtain ⟨M, hMs, -, hME⟩ := hP + obtain ⟨M', hs, he⟩ := (sP.trans hFG).exists_walk_up M + have hMl : M'.length ≤ F.E.ncard := by + have h₁ : P.E.ncard = M'.length := by + rw [hME, Surface.GraphWalk.length, he, ← List.coe_toFinset, ncard_coe_finset, + List.toFinset_card_of_nodup hMs.edges_nodup] + rw [← h₁] + exact ncard_le_ncard sP.2 F.finite_edges + let T := (W₁.append M').append W₂.reverse + obtain ⟨T', hTs, -, hTe⟩ := GraphWalk.exists_isSimple T + have hTl : T'.length ≤ T.length := by + have h₁ : T'.edges.toFinset ⊆ T.edges.toFinset := fun e he' ↦ by + rw [List.mem_toFinset] at he' ⊢ + exact hTe e he' + have h₂ := Finset.card_le_card h₁ + rw [List.toFinset_card_of_nodup hTs.edges_nodup] at h₂ + exact h₂.trans (List.toFinset_card_le _) + have hTlen : T.length ≤ F.E.ncard + 2 := by + have h₁ : W₂.reverse.length = W₂.length := by + rw [Surface.GraphWalk.length, Surface.GraphWalk.length, Surface.GraphWalk.edges_reverse, + List.length_reverse] + simp only [T, Surface.GraphWalk.length_append, h₁] + omega + set R := walkDrawing rad.G T' with hR + have hRp : GM19.Drawing.IsPathOf R rad.G p₁ p₂ := ⟨walkDrawing_isSubdrawing _ _, + walkDrawing_isPathBetween _ hTs⟩ + have hRE : R.E.ncard = T'.length := by + rw [hR, walkDrawing_E] + have : {e | e ∈ T'.edges} = ↑T'.edges.toFinset := by + ext e + simp + rw [this, ncard_coe_finset, List.toFinset_card_of_nodup hTs.edges_nodup, + Surface.GraphWalk.length] + have hle : Painting.dist rad ≤ ((R.E.ncard / 2 : ℕ) : ℕ∞) := sInf_le ⟨R, p₁, p₂, hp₁, hp₂, hpne, + hRp, rfl⟩ + have hb : R.E.ncard / 2 ≤ n + 1 := by + have := hF.2.2 + omega + exact absurd (hle.trans (by exact_mod_cast hb)) (not_le.2 hd) + +/-- The part `K` of a circuit `F` of `Γ*` in `Σ`. -/ +structure IsCircuitPart (cap : IsCappedSurface S Shat) (Φ : Frame S) (Γ : Painting S) + (F : Drawing Shat) (K : Drawing S) : Prop where + feature : IsFeature Φ K + inter : Γ.U ∩ K.U ⊆ Γ.V ∩ K.V + lines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} + ∧ IsLineWithEnds (closure e) u v + V_le : K.V.ncard ≤ F.V.ncard + E_le : K.E.ncard ≤ F.E.ncard + form : IsCutFormOf cap K F.U + +/-- What the proof of (5.5) needs of a feature `K`. Its size is at most `n`, it meets `Γ` only in +vertices, and it has two +vertices of `Γ`. -/ +structure IsCutShape (cap : IsCappedSurface S Shat) (Φ : Frame S) (Γ : Painting S) (n : ℕ) + (K : Drawing S) : Prop where + feature : IsFeature Φ K + size : K.V.ncard + K.E.ncard ≤ n + inter : Γ.U ∩ K.U ⊆ Γ.V ∩ K.V + lines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} + ∧ IsLineWithEnds (closure e) u v + two : ∃ a ∈ K.U ∩ Γ.V, ∃ b ∈ K.U ∩ Γ.V, a ≠ b + form : IsCutForm cap K + +omit [T2Space S] hS in +omit [T2Space Shat] in +theorem exists_short {n : ℕ} (hrep : Painting.rep rad ≤ n) : ∃ F, IsShortCircuit rad n F := by + set A : Set ℕ∞ := {n : ℕ∞ | ∃ F : Drawing Shat, F.IsCircuitOf rad.G ∧ ¬ IsNullHomotopicOArc F.U ∧ + n = (F.E.ncard / 2 : ℕ)} with hA + have hne : A.Nonempty := by + by_contra h + rw [not_nonempty_iff_eq_empty] at h + have : Painting.rep rad = ⊤ := by + change sInf A = ⊤ + rw [h, sInf_empty] + rw [this] at hrep + exact absurd hrep (by simp) + obtain ⟨F, hc, hn, heq⟩ := csInf_mem hne + have hle : ((F.E.ncard / 2 : ℕ) : ℕ∞) ≤ n := by + rw [← heq] + exact hrep + exact ⟨F, hc, hn, by exact_mod_cast hle⟩ + +omit [T2Space S] hS in +omit [T2Space Shat] in +theorem exists_minimal {n : ℕ} (hrep : Painting.rep rad ≤ n) : + ∃ F, IsShortCircuit rad n F ∧ ∀ F', IsShortCircuit rad n F' → + (F.V ∩ range cap.emb).ncard ≤ (F'.V ∩ range cap.emb).ncard := by + classical + have hex : ∃ k, ∃ F, IsShortCircuit rad n F ∧ (F.V ∩ range cap.emb).ncard = k := by + obtain ⟨F, hF⟩ := exists_short rad hrep + exact ⟨_, F, hF, rfl⟩ + obtain ⟨F, hF, hk⟩ := Nat.find_spec hex + refine ⟨F, hF, fun F' hF' ↦ ?_⟩ + rw [hk] + exact Nat.find_min' hex ⟨F', hF', rfl⟩ + +omit hS in +omit [T2Space Shat] in +/-- A simple walk that holds an edge between its ends is that edge. -/ +theorem simple_single {G : Drawing Shat} {a b : Shat} (W : Surface.GraphWalk G.toGraph a b) + (hW : W.IsSimple) (hab : a ≠ b) + {e : Set Shat} (he : e ∈ W.edges) (hl : closure e ∩ G.V = {a, b}) : W.support = [a, b] + ∧ W.edges = [e] := by + cases W with + | nil _ => exact absurd rfl hab + | @cons _ w _ e' h rest => + have hn : a ∉ rest.support := (List.nodup_cons.1 hW).1 + have hr : rest.IsSimple := (List.nodup_cons.1 hW).2 + by_cases hee : e' = e + · subst hee + have hs : ({a, w} : Set Shat) = {a, b} := h.2.2.2.symm.trans hl + have hwb : w = b := by + rcases Set.pair_eq_pair_iff.1 hs with ⟨-, h₁⟩ | ⟨h₁, h₂⟩ + · exact h₁ + · exact absurd h₁ hab + subst hwb + obtain ⟨h₁, h₂⟩ := simple_self hr + refine ⟨?_, ?_⟩ + · change a :: rest.support = _ + rw [h₂] + · change e' :: rest.edges = _ + rw [h₁] + · have he' : e ∈ rest.edges := by + rcases List.mem_cons.1 he with h₁ | h₁ + · exact absurd h₁.symm hee + · exact h₁ + have ha : a ∈ closure e ∩ G.V := hl ▸ mem_insert _ _ + exact absurd (mem_support_of_mem_edges rest he' ha.1 ha.2) hn + +omit hS in +omit [T2Space Shat] in +theorem exists_first {G : Drawing Shat} {a b : Shat} (W : Surface.GraphWalk G.toGraph a b) + (hab : a ≠ b) : + ∃ (c : Shat) (e : Set Shat) (_ : G.toGraph.IsLink e a c) (r : Surface.GraphWalk G.toGraph c b), + W.support = a :: r.support ∧ W.edges = e :: r.edges := by + cases W with + | nil _ => exact absurd rfl hab + | @cons _ c _ e h r => exact ⟨c, e, h, r, rfl, rfl⟩ + +variable [ConnectedSpace Shat] +include h3 + +omit [ConnectedSpace Shat] h3 in +omit [T2Space S] [T2Space Shat] hS in +/-- A subdrawing of `Γ*` with no pole lies in `Σ`. -/ +theorem subset_range_of_no_pole {T : Drawing Shat} (hT : T.IsSubdrawing rad.G) + (hnp : ∀ z ∈ T.V, z ∉ rad.poles) : + T.U ⊆ range cap.emb := by + have hrangeG : ∀ z ∈ rad.G.V, z ∉ rad.poles → z ∈ range cap.emb := by + intro z hzG hzp + by_cases hV : z ∈ Γ.hatV cap + · obtain ⟨v, -, rfl⟩ := hV + exact mem_range_self v + · have hw : z ∈ rad.Rstar := ⟨hzG, hV⟩ + exact rad.region_subset_range hw hzp (rad.regionOf_mem hw).2 + intro z hz + by_cases hzV : z ∈ T.V + · exact hrangeG z (hT.1 hzV) (hnp z hzV) + · obtain ⟨f, hf, hzf⟩ := T.exists_edge_of_mem hz hzV + obtain ⟨v, hv, w, hw, hset⟩ := rad.edge_ends (hT.2 hf) + have hwT : w ∈ closure f ∩ T.V := by + rw [hT.closure_inter_V hf, hset] + exact mem_insert_of_mem _ rfl + exact rad.edge_subset_range (hT.2 hf) hw (hnp w hwT.2) hset hzf + +omit hS [ConnectedSpace Shat] h3 in +omit [T2Space Shat] in +/-- Each vertex of a circuit is on an edge of it. -/ +theorem circuit_iso {F : Drawing Shat} (hFc : F.IsCircuit) : ∀ v ∈ F.V, ∃ e ∈ F.E, v ∈ closure e + := by + obtain ⟨u₀, W₀, -, hpos₀, hV₀, hE₀⟩ := id hFc + intro v hv + rw [hV₀] at hv + obtain ⟨e, he, hve⟩ := exists_edge_at W₀ hpos₀ hv + exact ⟨e, hE₀ ▸ he, hve⟩ + +omit [ConnectedSpace Shat] in +/-- A circuit of `Γ*` through a pole `p`, with no other pole, whose vertices on `bd(Σ)` are next to +`p`, gives a line `K` with both +ends on the cuff of `p`. -/ +theorem chord_of_circuit [Nonempty S] {Φ : Frame S} (hfit : Γ.Fits Φ) {F : Drawing Shat} + (hFG : F.IsSubdrawing rad.G) + (hFc : F.IsCircuit) {p : Shat} (hp : p ∈ rad.poles) (hpF : p ∈ F.V) + (hnp₀ : ∀ z ∈ F.V, z ∈ rad.poles → z = p) + (hnb : ∀ {x : S}, x ∈ bd S → x ∈ Γ.V → cap.emb x ∈ F.V → ∃ e ∈ F.E, closure e ∩ rad.G.V + = {cap.emb x, p}) : + ∃ K, IsCircuitPart cap Φ Γ F K ∧ ∃ a ∈ K.U ∩ Γ.V, ∃ b ∈ K.U ∩ Γ.V, a ≠ b := by + classical + have hj := cap.isClosedEmbedding hS + have hiso := circuit_iso hFc + obtain ⟨Θ, hΘ, hreg, hpd⟩ := rad.pole_cases hp + have hpm : p ∉ range cap.emb := cap.notMem_range hΘ hpd + obtain ⟨e₀, he₀, hpe₀⟩ := hiso p hpF + have he₀G := hFG.2 he₀ + obtain ⟨v₀, hv₀, w₀, hw₀, hset₀⟩ := rad.edge_ends he₀G + have hw₀p : w₀ = p := by + have : p ∈ closure e₀ ∩ rad.G.V := ⟨hpe₀, hp.1.1⟩ + rw [hset₀] at this + rcases this with h | h + · exact absurd ⟨v₀, h.symm⟩ hpm + · exact h.symm + subst hw₀p + have hx₀F : cap.emb v₀ ∈ F.V := by + have : cap.emb v₀ ∈ closure e₀ ∩ F.V := by + rw [hFG.closure_inter_V he₀, hset₀] + exact mem_insert _ _ + exact this.2 + have hne₀ : w₀ ≠ cap.emb v₀ := fun h ↦ hpm ⟨v₀, h.symm⟩ + obtain ⟨P₀, Q₀, hP₀, hQ₀, sP₀, sQ₀, -, -, hPQ₀, hdE₀, heq₀⟩ := hFc.exists_two_paths hpF hx₀F hne₀ + have hFV₀ : F.V = P₀.V ∪ Q₀.V := by rw [← Drawing.sup_V sP₀ sQ₀, heq₀] + have hFE₀ : F.E = P₀.E ∪ Q₀.E := by rw [← Drawing.sup_E sP₀ sQ₀, heq₀] + obtain ⟨P, Q, hP, hQ, sP, sQ, hdE, heQ, hFV, hFE⟩ : ∃ P Q : Drawing Shat, P.IsPathBetween w₀ + (cap.emb v₀) ∧ + Q.IsPathBetween w₀ (cap.emb v₀) ∧ P.IsSubdrawing F ∧ Q.IsSubdrawing F ∧ Disjoint P.E Q.E + ∧ e₀ ∈ Q.E ∧ + F.V = P.V ∪ Q.V ∧ F.E = P.E ∪ Q.E := by + by_cases h : e₀ ∈ Q₀.E + · exact ⟨P₀, Q₀, hP₀, hQ₀, sP₀, sQ₀, hdE₀, h, hFV₀, hFE₀⟩ + · have h' : e₀ ∈ P₀.E := by + rw [hFE₀] at he₀ + exact he₀.resolve_right h + exact ⟨Q₀, P₀, hQ₀, hP₀, sQ₀, sP₀, hdE₀.symm, h', by rw [hFV₀, union_comm], by rw [hFE₀, + union_comm]⟩ + have heP : e₀ ∉ P.E := fun h ↦ disjoint_left.1 hdE h heQ + obtain ⟨Wq, hWq, hQV, hQE⟩ := hQ + obtain ⟨Wq', hsq, heq⟩ := (sQ.trans hFG).exists_walk_up Wq + obtain ⟨hsq₂, heq₂⟩ := simple_single Wq' (by unfold Surface.GraphWalk.IsSimple; rw [hsq]; exact + hWq) hne₀ + (by rw [heq, ← mem_ofPred_eq (p := fun e ↦ e ∈ Wq.edges), ← hQE]; exact heQ) + (by rw [hset₀, Set.pair_comm]) + have hQVs : Q.V ⊆ {w₀, cap.emb v₀} := fun z hz ↦ by + rw [hQV, mem_ofPred_eq, ← hsq, hsq₂] at hz + simpa using hz + have hQEs : Q.E ⊆ {e₀} := fun z hz ↦ by + rw [hQE, mem_ofPred_eq, ← heq, heq₂] at hz + simpa using hz + obtain ⟨Wp, hWp, hPV, hPE⟩ := hP + obtain ⟨Wp', hsp, hep⟩ := (sP.trans hFG).exists_walk_up Wp + obtain ⟨y, e₂, hl₂, M, hsM, heM⟩ := exists_first Wp' hne₀ + have hsimp : Wp'.IsSimple := by + unfold Surface.GraphWalk.IsSimple + rw [hsp] + exact hWp + have hnod : (w₀ :: M.support).Nodup := by + have := hsimp + unfold Surface.GraphWalk.IsSimple at this + rwa [hsM] at this + have hpM : w₀ ∉ M.support := (List.nodup_cons.1 hnod).1 + have hMs : M.IsSimple := (List.nodup_cons.1 hnod).2 + have he₂P : e₂ ∈ P.E := by + rw [hPE, mem_ofPred_eq, ← hep, heM] + exact List.mem_cons_self + have he₂G := hl₂.1 + obtain ⟨v₁, hv₁, w₁, hw₁, hset₁⟩ := rad.edge_ends he₂G + have hyv : y = cap.emb v₁ := by + rcases Set.pair_eq_pair_iff.1 (hl₂.2.2.2.symm.trans hset₁) with ⟨h₁, -⟩ | ⟨-, h₁⟩ + · exact absurd ⟨v₁, h₁.symm⟩ hpm + · exact h₁ + subst hyv + have hset₁' : closure e₂ ∩ rad.G.V = {cap.emb v₁, w₀} := by + rw [hl₂.2.2.2, Set.pair_comm] + have hvne : v₁ ≠ v₀ := by + rintro rfl + exact heP (rad.edge_unique hS h3 he₂G he₀G hv₀ hw₀ hset₁' hset₀ ▸ he₂P) + have hembne : cap.emb v₁ ≠ cap.emb v₀ := fun h ↦ hvne (cap.isEmbedding.injective h) + set T := walkDrawing rad.G M with hTdef + have hsubT : T.IsSubdrawing rad.G := walkDrawing_isSubdrawing _ _ + have hTV : ∀ z, z ∈ T.V ↔ z ∈ M.support := fun z ↦ by rw [hTdef, walkDrawing_V]; rfl + have hTE : ∀ e, e ∈ T.E ↔ e ∈ M.edges := fun e ↦ by rw [hTdef, walkDrawing_E]; rfl + have hMV : ∀ z ∈ M.support, z ∈ P.V := fun z hz ↦ by + rw [hPV, mem_ofPred_eq, ← hsp, hsM] + exact List.mem_cons_of_mem _ hz + have hME : ∀ e ∈ M.edges, e ∈ P.E := fun e he ↦ by + rw [hPE, mem_ofPred_eq, ← hep, heM] + exact List.mem_cons_of_mem _ he + have hPF : P.V ⊆ F.V := hFV ▸ subset_union_left + have hPEF : P.E ⊆ F.E := hFE ▸ subset_union_left + have hTF : T.IsSubdrawing F := by + refine ⟨fun z hz ↦ hPF (hMV z ((hTV z).1 hz)), fun e he ↦ hPEF (hME e ((hTE e).1 he))⟩ + have hlabel : cuffLabel cap w₀ = some Θ := cuffLabel_eq hΘ (subset_closure hpd) + have hnp : ∀ z ∈ T.V, z ∉ rad.poles := by + intro z hz hzp + exact hpM ((hnp₀ z (hTF.1 hz) hzp) ▸ (hTV z).1 hz) + have hU : T.U ⊆ range cap.emb := subset_range_of_no_pole rad hsubT hnp + have hlenpos : 0 < M.length := by + by_contra hl + exact hembne (Surface.GraphWalk.eq_of_length_eq_zero (Nat.le_zero.mp (not_lt.mp hl))) + have hisoT : ∀ v ∈ T.V, ∃ e ∈ T.E, v ∈ closure e := fun v hv ↦ by + obtain ⟨e, he, hve⟩ := exists_edge_at M hlenpos ((hTV v).1 hv) + exact ⟨e, (hTE e).2 he, hve⟩ + obtain ⟨hinter, hfeat, hlines, hcV, hcE⟩ := comap_facts rad hfit hsubT hU hj hisoT + set K : Drawing S := GM19.Drawing.comap T hj hU with hKdef + have hKU : cap.emb '' K.U = T.U := image_preimage_eq_of_subset hU + have hv₁Θ : v₁ ∈ Θ := (rad.pole_edge he₂G hp hΘ hreg hset₁').2 + have hv₀Θ : v₀ ∈ Θ := (rad.pole_edge he₀G hp hΘ hreg hset₀).2 + have hs : v₁ ∈ K.V := (hTV _).2 M.start_mem_support + have ht : v₀ ∈ K.V := (hTV _).2 M.end_mem_support + have hbdK : K.U ∩ bd S = {v₁, v₀} := by + apply subset_antisymm + · rintro x ⟨hxK, hxb⟩ + obtain ⟨hxV, hxK'⟩ := hinter ⟨Γ.bd_subset hxb, hxK⟩ + have hxF : cap.emb x ∈ F.V := hTF.1 hxK' + by_contra hnot + obtain ⟨e, he, hset⟩ := hnb hxb hxV hxF + have hxe : cap.emb x ∈ closure e ∩ rad.G.V := hset ▸ mem_insert _ _ + have hpe : w₀ ∈ closure e ∩ rad.G.V := hset ▸ mem_insert_of_mem _ rfl + rw [hFE] at he + rcases he with he | he + · rw [hPE, mem_ofPred_eq, ← hep, heM] at he + rcases List.mem_cons.1 he with rfl | he + · rw [hset₁'] at hset + rcases Set.pair_eq_pair_iff.1 hset with ⟨h₁, -⟩ | ⟨h₁, -⟩ + · exact hnot (Or.inl (cap.isEmbedding.injective h₁).symm) + · exact hpm ⟨_, h₁⟩ + · exact hpM (mem_support_of_mem_edges M he hpe.1 hpe.2) + · rcases hQEs he with rfl + rw [hset₀] at hset + rcases Set.pair_eq_pair_iff.1 hset with ⟨h₁, -⟩ | ⟨h₁, -⟩ + · exact hnot (Or.inr (cap.isEmbedding.injective h₁).symm) + · exact hpm ⟨_, h₁⟩ + · rintro x (rfl | rfl) + · exact ⟨K.V_subset_U hs, cuff_subset_bd ⟨Θ, hΘ⟩ hv₁Θ⟩ + · exact ⟨K.V_subset_U ht, cuff_subset_bd ⟨Θ, hΘ⟩ hv₀Θ⟩ + have h₁ : T.V.ncard ≤ F.V.ncard := ncard_le_ncard hTF.1 F.finite_V + have h₂ : T.E.ncard ≤ F.E.ncard := ncard_le_ncard hTF.2 F.finite_edges + refine ⟨K, ⟨hfeat, hinter, hlines, hcV.le.trans h₁, hcE.le.trans h₂, + Or.inr ⟨v₁, v₀, Θ, hΘ, hvne, hv₁Θ, hv₀Θ, hbdK, ?_, ?_, ?_⟩⟩, + ⟨v₁, ⟨K.V_subset_U hs, hv₁⟩, v₀, ⟨K.V_subset_U ht, hv₀⟩, hvne⟩⟩ + · refine isLine_comap hj ?_ + rw [hKU] + exact isLine_of_isPathBetween (walkDrawing_isPathBetween _ hMs) hembne + · rw [hKU] + exact hTF.U_subset + · rintro z ⟨hzF, hzT⟩ + rw [hKU] at hzT + have hedge : ∀ {e : Set Shat} {x : Shat}, e ∈ rad.G.E → closure e ∩ rad.G.V = {x, w₀} → z ∈ e + → z ∈ cap.cuffDisc Θ := by + intro e x he hs hze + exact hreg ▸ rad.edge_subset_region he hp.1 hs hze + by_cases hzV : z ∈ F.V + · rw [hFV] at hzV + rcases hzV with hz | hz + · rw [hPV, mem_ofPred_eq, ← hsp, hsM] at hz + rcases List.mem_cons.1 hz with rfl | hz + · exact hpd + · exact absurd (T.V_subset_U ((hTV z).2 hz)) hzT + · rcases hQVs hz with rfl | rfl + · exact hpd + · exact absurd (T.V_subset_U ((hTV _).2 M.end_mem_support)) hzT + · obtain ⟨f, hf, hzf⟩ := F.exists_edge_of_mem hzF hzV + rw [hFE] at hf + rcases hf with hf | hf + · rw [hPE, mem_ofPred_eq, ← hep, heM] at hf + rcases List.mem_cons.1 hf with rfl | hf + · exact hedge he₂G hset₁' hzf + · have hfT : f ∈ T.E := (hTE f).2 hf + exact absurd (hfT.2.1 hzf).1 hzT + · rcases hQEs hf with rfl + exact hedge he₀G hset₀ hzf + +omit h3 [ConnectedSpace Shat] in +omit [T2Space S] in +/-- A circuit of `Γ*` with no pole, with at most one point on `bd(Σ)`, is a feature. -/ +theorem ring_of_circuit [Nonempty S] {Φ : Frame S} (hfit : Γ.Fits Φ) {F : Drawing Shat} + (hFG : F.IsSubdrawing rad.G) + (hFc : F.IsCircuit) (hpole : ∀ z ∈ F.V, z ∉ rad.poles) + (hone : ∀ {x y : S}, x ∈ bd S → y ∈ bd S → cap.emb x ∈ F.U → cap.emb y ∈ F.U → x = y) : + ∃ K, IsCircuitPart cap Φ Γ F K ∧ F.U = cap.emb '' K.U ∧ IsOArc K.U ∧ (K.U ∩ bd S).Subsingleton + := by + have hj := cap.isClosedEmbedding hS + have hiso := circuit_iso hFc + have hU : F.U ⊆ range cap.emb := subset_range_of_no_pole rad hFG hpole + obtain ⟨hinter, hfeat, hlines, hcV, hcE⟩ := comap_facts rad hfit hFG hU hj hiso + set K : Drawing S := GM19.Drawing.comap F hj hU with hKdef + have hKU : cap.emb '' K.U = F.U := image_preimage_eq_of_subset hU + have hsing : (K.U ∩ bd S).Subsingleton := fun x hx y hy ↦ hone hx.2 hy.2 hx.1 hy.1 + have hO : IsOArc K.U := isOArc_comap hj (hKU ▸ IsCircuit.isOArc_U hFc) + exact ⟨K, ⟨hfeat, hinter, hlines, hcV.le, hcE.le, Or.inl ⟨hKU.symm, hO, hsing⟩⟩, hKU.symm, hO, + hsing⟩ + +/-- **The feature of the proof of (5.5).** -/ +theorem exists_shape [Nonempty S] {Φ : Frame S} (hfit : Γ.Fits Φ) {n : ℕ} (hd : + ((n + 1 : ℕ) : ℕ∞) < Painting.dist rad) + (hrep : Painting.rep rad ≤ n) : ∃ K, IsCutShape cap Φ Γ (4 * n + 3) K := by + classical + obtain ⟨F, hF, hmin⟩ := exists_minimal rad hrep + have hFs := hF + obtain ⟨⟨hFG, hFc⟩, hnn, hlen⟩ := hFs + have hVE : F.V.ncard = F.E.ncard := IsCircuit.ncard_V hFc + have hEn : F.E.ncard ≤ 2 * n + 1 := by omega + have hsmall : (∃ F', IsShortCircuit rad n F' ∧ (F'.V ∩ range cap.emb).ncard < + (F.V ∩ range cap.emb).ncard) → False := + fun ⟨_, h, hl⟩ ↦ absurd hl (not_lt.2 (hmin _ h)) + have hpack : ∀ {K}, IsCircuitPart cap Φ Γ F K → (∃ a ∈ K.U ∩ Γ.V, ∃ b ∈ K.U ∩ Γ.V, a ≠ b) → + IsCutShape cap Φ Γ (4 * n + 3) K := fun h₁ h₂ ↦ + ⟨h₁.feature, by have := h₁.V_le; have := h₁.E_le; omega, h₁.inter, h₁.lines, h₂, + F.U, IsCircuit.isOArc_U hFc, hnn, h₁.form⟩ + by_cases hpole : ∃ p ∈ rad.poles, p ∈ F.V + · obtain ⟨p, hp, hpF⟩ := hpole + obtain ⟨Θ, hΘ, hreg, hpd⟩ := rad.pole_cases hp + have hlabel : cuffLabel cap p = some Θ := cuffLabel_eq hΘ (subset_closure hpd) + obtain ⟨K, h₁, h₂⟩ := chord_of_circuit hS rad h3 hfit hFG hFc hp hpF (fun z hz hzp ↦ by + obtain ⟨Θ', hΘ', hreg', hzd⟩ := rad.pole_cases hzp + obtain rfl := label_eq hS rad hd hF h3 hz hpF (cuffLabel_eq hΘ' (subset_closure hzd)) hlabel + obtain ⟨-, -, hG3, -⟩ := id rad.isPreRadial + exact (hG3 _ (rad.regionOf_mem hp.1).1).unique + ⟨hreg.trans hreg'.symm ▸ (rad.regionOf_mem hzp.1).2, hzp.1.1⟩ ⟨(rad.regionOf_mem hp.1).2, + hp.1.1⟩) + (fun {x} hxb hxV hxF ↦ by + obtain ⟨Θ', hΘ', hxΘ, hl₁⟩ := cuffLabel_emb_bd (cap := cap) hxb + obtain rfl := label_eq hS rad hd hF h3 hxF hpF hl₁ hlabel + by_contra hno + push Not at hno + exact hsmall (exists_smaller_of_pole hS rad h3 hF hp hpF hΘ' hreg hxV hxΘ hxF hno)) + exact ⟨K, hpack h₁ h₂⟩ + · push Not at hpole + have hnp : ∀ z ∈ F.V, z ∉ rad.poles := fun z hz hp ↦ hpole z hp hz + have hU := subset_range_of_no_pole rad hFG hnp + obtain ⟨K, h₁, hKU, hO, hsing⟩ := ring_of_circuit hS rad hfit hFG hFc hnp + (fun {x y} hxb hyb hxF hyF ↦ by + by_contra hne + have hmemV : ∀ {x : S}, x ∈ bd S → cap.emb x ∈ F.U → x ∈ Γ.V ∧ cap.emb x ∈ F.V + := fun {x} hxb hxF ↦ by + obtain ⟨-, -, -, -, -, -⟩ := id rad.isPreRadial + have hxU : cap.emb x ∈ Γ.hatU cap ∩ rad.G.U := ⟨mem_image_of_mem _ + (Γ.bd_subset hxb), hFG.U_subset hxF⟩ + rw [rad.isPreRadial.1] at hxU + obtain ⟨v, hv, hvx⟩ := hxU + obtain rfl := cap.isEmbedding.injective hvx + exact ⟨hv, IsSubdrawing.mem_V hFG hxF (rad.isPreRadial.2.1 ⟨_, hv, rfl⟩)⟩ + obtain ⟨hxV, hxK'⟩ := hmemV hxb hxF + obtain ⟨hyV, hyK'⟩ := hmemV hyb hyF + obtain ⟨Θ, hΘ, hxΘ, hl₁⟩ := cuffLabel_emb_bd (cap := cap) hxb + obtain ⟨Θ', hΘ', hyΘ, hl₂⟩ := cuffLabel_emb_bd (cap := cap) hyb + obtain rfl := label_eq hS rad hd hF h3 hxK' hyK' hl₁ hl₂ + obtain ⟨p, hp, -, hr⟩ := rad.exists_pole hΘ + exact hsmall (exists_smaller_of_two hS rad h3 hF hp (hpole p hp) hΘ hr hxV hyV hxΘ hyΘ hne + hxK' hyK')) + refine ⟨K, hpack h₁ ?_⟩ + have hinter := h₁.inter + have hfinU : (K.U ∩ Γ.V).Finite := Γ.finite_V.inter_of_right _ + have hfinb : (K.U ∩ bd S).Finite := hsing.finite + by_contra hno + push Not at hno + have hsub : (K.U ∩ Γ.V).Subsingleton := fun a ha b hb ↦ hno a ha b hb + have hle₁ : (K.U ∩ Γ.V).ncard ≤ 1 := (ncard_le_one hfinU).2 fun a ha b hb ↦ hsub ha hb + have hle₂ : (K.U ∩ bd S).ncard ≤ 1 := (ncard_le_one hfinb).2 fun a ha b hb ↦ hsing ha hb + obtain ⟨Δ, hΔ, hb, -⟩ := h3.2 K.U hO (fun x hx ↦ (hinter ⟨hx.2, hx.1⟩).1) hfinb (by omega) + have hd' := isClosedDisc_image hΔ cap.isEmbedding + refine hnn ((epstein Shat univ _ cap.isSurface inferInstance (IsCircuit.isOArc_U hFc) + (subset_univ _) ?_).2.1 + ⟨cap.emb '' Δ, subset_univ _, hd'.1, ?_⟩) + · rw [cap.bd_empty] + exact disjoint_bot_right + · rw [hKU, ← hb] + exact image_mono (Surface.discBd_subset _) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section5r.lean b/LeanPool/GraphMinor/GM19/Section5r.lean new file mode 100644 index 0000000000..0f7d251d5e --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section5r.lean @@ -0,0 +1,265 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section5q + +import LeanPool.GraphMinor.GM19.FeatureCount + +import LeanPool.GraphMinor.GM19.FragmentSimpler + +import LeanPool.GraphMinor.GM19.Section5oProved +import LeanPool.GraphMinor.GM19.UniverseLift2 + +/-! +# Graph Minors XIX, (5.5) +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u w + + +/-- A sequence of steps along infinite sets. -/ +theorem exists_chain (P : ℕ → ℕ → Prop) {A₀ : Set ℕ} (hA₀ : A₀.Infinite) + (h : ∀ A ⊆ A₀, A.Infinite → ∃ a ∈ A, {b ∈ A | P a b}.Infinite) : + ∃ e : ℕ → ℕ, (∀ n, e n ∈ A₀) ∧ ∀ n m, n < m → P (e n) (e m) := by + classical + let T := {A : Set ℕ // A ⊆ A₀ ∧ A.Infinite} + have hstep : ∀ A : T, ∃ a ∈ A.1, {b ∈ A.1 | P a b}.Infinite := fun A ↦ h _ A.2.1 A.2.2 + choose f hf hf' using hstep + let next : T → T := fun A ↦ ⟨{b ∈ A.1 | P (f A) b}, fun x hx ↦ A.2.1 hx.1, hf' A⟩ + let B : ℕ → T := fun n ↦ next^[n] ⟨A₀, Subset.rfl, hA₀⟩ + have hB : ∀ n, B (n + 1) = next (B n) := fun n ↦ Function.iterate_succ_apply' _ _ _ + have hanti : ∀ n k, (B (n + k)).1 ⊆ (B n).1 := by + intro n k + induction k with + | zero => exact Subset.rfl + | succ k ih => + rw [← add_assoc, hB] + exact Subset.trans (fun x hx ↦ hx.1 : (next (B (n + k))).1 ⊆ (B (n + k)).1) ih + refine ⟨fun n ↦ f (B n), fun n ↦ (B n).2.1 (hf _), fun n m hnm ↦ ?_⟩ + obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_lt hnm + have h₁ : f (B (n + k + 1)) ∈ (B (n + 1 + k)).1 := by + have : n + k + 1 = n + 1 + k := by omega + rw [this] + exact hf _ + have h₂ := hanti (n + 1) k h₁ + rw [hB] at h₂ + exact h₂.2 + +/-- A relation that holds on a pair of every subsequence holds on all pairs of a subsequence. -/ +theorem exists_homogeneous (R : ℕ → ℕ → Prop) (h : ∀ e : ℕ → ℕ, StrictMono e → ∃ i j, i < j ∧ R + (e i) (e j)) : + ∃ e : ℕ → ℕ, StrictMono e ∧ ∀ i j, i < j → R (e i) (e j) := by + by_cases hgood : ∀ A : Set ℕ, A ⊆ univ → A.Infinite → ∃ a ∈ A, {b ∈ A | a < b ∧ R a b}.Infinite + · obtain ⟨e, -, he⟩ := exists_chain (fun a b ↦ a < b ∧ R a b) (A₀ := univ) infinite_univ hgood + exact ⟨e, strictMono_nat_of_lt_succ fun n ↦ (he n _ (by omega)).1, fun i j hij ↦ (he i j hij).2⟩ + · exfalso + push Not at hgood + obtain ⟨A, -, hA, hfin⟩ := hgood + obtain ⟨e, -, he⟩ := exists_chain (fun a b ↦ a < b ∧ ¬ R a b) hA fun B hB hBi ↦ by + obtain ⟨a, ha⟩ := hBi.nonempty + refine ⟨a, ha, ?_⟩ + have hf₁ : {b ∈ A | a < b ∧ R a b}.Finite := hfin a (hB ha) + refine ((hBi.sdiff ((finite_Iic a).union hf₁))).mono ?_ + rintro b ⟨hb, hn⟩ + simp only [mem_union, mem_Iic, mem_ofPred_eq, not_or, not_le, not_and] at hn + exact ⟨hb, hn.1, fun hr ↦ hn.2 (hB hb) hn.1 hr⟩ + obtain ⟨i, j, hij, hr⟩ := h e (strictMono_nat_of_lt_succ fun n ↦ (he n _ (by omega)).1) + exact (he i j hij).2 hr + +/-- Finitely many such relations hold together on a pair. -/ +theorem exists_common_pair {ι : Type*} [Finite ι] (R : ι → ℕ → ℕ → Prop) + (h : ∀ t, ∀ e : ℕ → ℕ, StrictMono e → ∃ i j, i < j ∧ R t (e i) (e j)) : ∃ i j, i < j + ∧ ∀ t, R t i j := by + classical + cases nonempty_fintype ι + have key : ∀ T : Finset ι, ∃ e : ℕ → ℕ, StrictMono e ∧ ∀ t ∈ T, ∀ i j, i < j → R t (e i) (e j) + := by + intro T + induction T using Finset.induction_on with + | empty => exact ⟨id, strictMono_id, by simp⟩ + | insert t T _ ih => + obtain ⟨e, he, heR⟩ := ih + obtain ⟨e', he', hR⟩ := exists_homogeneous (fun i j ↦ R t (e i) (e j)) fun e₁ h₁ ↦ h t _ + (he.comp h₁) + refine ⟨e ∘ e', he.comp he', fun s hs i j hij ↦ ?_⟩ + rcases Finset.mem_insert.1 hs with rfl | hs + · exact hR i j hij + · exact heR s hs _ _ (he' hij) + obtain ⟨e, he, hR⟩ := key Finset.univ + exact ⟨e 0, e 1, he zero_lt_one, fun t ↦ hR t (Finset.mem_univ t) 0 1 zero_lt_one⟩ + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + +omit [T2Space Shat] in +omit [T2Space S] in +/-- A feature of the two forms, with two vertices of `Γ`, is anchored in `Γ`. -/ +theorem isAnchored_of_form {cap : IsCappedSurface S Shat} {Γ : Painting S} {K : Drawing S} {F : Set + Shat} + (hf : IsCutFormOf cap K F) (hinter : Γ.U ∩ K.U ⊆ Γ.V ∩ K.V) (htwo : ∃ a ∈ K.U ∩ Γ.V, ∃ b ∈ K.U + ∩ Γ.V, a ≠ b) : IsAnchored Γ K := by + obtain ⟨-, hO, -⟩ | ⟨s, t, Θ, -, -, -, -, hbd, hl, -⟩ := hf + · obtain ⟨a, ha, b, hb, hab⟩ := htwo + intro u x hx hne + by_cases hu : u ∈ K.U + · refine ⟨K.U \ {u}, Subset.rfl, ⟨hx, hne⟩, (isPathConnected_oArc_diff hO + hu).isConnected.isPreconnected, ?_⟩ + by_cases hau : a = u + · exact ⟨b, ⟨hb.1, fun h ↦ hab (hau.trans h.symm)⟩, hb.2⟩ + · exact ⟨a, ⟨ha.1, hau⟩, ha.2⟩ + · refine ⟨K.U, fun z hz ↦ ⟨hz, fun h ↦ hu (h ▸ hz)⟩, hx, hO.isPreconnected, ⟨a, ha⟩⟩ + · have hm : ∀ {z}, z ∈ K.U ∩ bd S → z ∈ Γ.V := fun hz ↦ (hinter ⟨Γ.bd_subset hz.2, hz.1⟩).1 + exact isAnchored_of_line hl (hm (hbd ▸ mem_insert _ _)) (hm (hbd ▸ mem_insert_of_mem _ rfl)) + +/-- **Graph Minors XIX, (5.5)** (page 338), in surface universe `0`. -/ +private theorem theorem_5_5_zero : + Theorem55Statement.{0, w} := by + classical + intro S Shat _ _ _ _ β _ cap χ hS1 hS3 P hbad hsim rad n + have hS := χ.isSurface + have := χ.connected + have : ConnectedSpace Shat := cap.connected + have : Nonempty S := + inferInstance + obtain ⟨h₀, hh₀⟩ := GraphMinor.GM19.theorem_5_4_proof.{w} S Shat β cap χ hS3 P hbad hsim rad + (n + 1) + by_contra hno + push Not at hno + set A : Set ℕ := {i | ((n + 1 : ℕ) : ℕ∞) < Painting.dist (rad i) ∧ Painting.rep (rad i) + ≤ n} with hAdef + have hA : A.Infinite := + Set.infinite_of_forall_exists_gt fun a ↦ by + obtain ⟨i, hi, hd⟩ := hno (max h₀ (a + + 1)) + refine ⟨i, ⟨hh₀ i ((le_max_left _ _).trans hi), hd⟩, ?_⟩ + have := le_max_right h₀ (a + 1) + omega + have hK : ∀ i ∈ A, ∃ K, IsCutShape cap χ.Φ (P i).Γ (4 * n + 3) K := + fun i hi ↦ exists_shape hS (rad i) (P i).fits.internally_three_connected (P i).fits hi.1 hi.2 + have : Nonempty (Drawing S) := by + obtain ⟨i, hi⟩ := hA.nonempty + obtain ⟨K, -⟩ := hK i hi + exact ⟨K⟩ + choose! K hK using hK + obtain ⟨e₁, e₂, α, hα, he₁s, he₂s, he₁m, hαU, _, hinter, hRV⟩ := + exists_aligned_feature_subsequence P K hA (4 * n + 3) + (fun i hi ↦ (hK i hi).feature) (fun i hi ↦ (hK i hi).size) (fun i hi ↦ (hK i hi).inter) + let Kc := K (e₁ 0) + have hcross := hK _ (he₁m 0) + let Q : ℕ → ColouredPainting χ := fun m ↦ (P (e₁ m)).image (α m).symm (hα m).symm + have hQ : ∀ m, IsColouredImage (α m).symm (P (e₁ m)) (Q m) := fun m ↦ + ColouredPainting.isImage_image _ _ _ + let R : ℕ → ColouredPainting χ := fun m ↦ Q (e₂ m) + have htwo : ∀ m, ∃ a ∈ Kc.U ∩ (Q m).Γ.V, ∃ b ∈ Kc.U ∩ (Q m).Γ.V, a ≠ b := by + intro m + obtain ⟨a, ha, b, hb, hab⟩ := (hK _ (he₁m m)).two + have key : ∀ {a}, a ∈ (K (e₁ m)).U ∩ (P (e₁ m)).Γ.V → (α m).symm a ∈ Kc.U ∩ (Q m).Γ.V + := fun {a} ha ↦ by + refine ⟨?_, ?_⟩ + · have := ha.1 + rw [← hαU m] at this + obtain ⟨z, hz, rfl⟩ := this + rwa [(α m).symm_apply_apply] + · rw [(hQ m).V] + exact mem_image_of_mem _ ha.2 + exact ⟨_, key ha, _, key hb, fun h ↦ hab ((α m).symm.injective h)⟩ + have hF := hcross.feature + have hKne : Kc.V ⊆ ⋃ e ∈ arcComponentsIn (Kc.U \ Kc.V), closure e := fun v hv ↦ by + obtain ⟨e, he, hve⟩ := hF.no_isolated_vertices v hv + exact mem_biUnion he hve.1 + have hKbd : Kc.U ∩ bd S ⊆ Kc.V := by + rintro x ⟨hx, hxb⟩ + by_contra hxV + have hm : x ∈ Kc.U \ Kc.V := ⟨hx, + hxV⟩ + exact disjoint_left.1 (hF.no_border_edges _ (Surface.mem_arcComponentsIn_of_mem hm)) + (mem_pathComponentIn_self hm) hxb + obtain ⟨Y, tY, t2Y, ψ, hY, hψ, hsheet, hsimple⟩ := GraphMinor.GM19.cutSimpler S Shat cap Kc hS + hcross.lines hKne hKbd hcross.form + have : LocallyConnectedSpace Y := hY.locallyConnected + have : CompactSpace Y := hY.1 + have : Finite (ConnectedComponents Y) := by + obtain ⟨T, hT⟩ := isCompact_univ.elim_finite_subcover (fun x : Y ↦ connectedComponent x) + (fun x ↦ isOpen_connectedComponent) (fun x _ ↦ mem_iUnion.mpr ⟨x, + mem_connectedComponent⟩) + refine Finite.of_surjective (fun t : T ↦ (ConnectedComponents.mk t.1 : ConnectedComponents Y)) + fun c ↦ ?_ + obtain ⟨z, rfl⟩ := ConnectedComponents.surjective_coe c + obtain ⟨t, ht, hzt⟩ := mem_iUnion₂.mp (hT (mem_univ z)) + exact ⟨⟨t, ht⟩, ConnectedComponents.coe_eq_coe'.2 hzt |>.symm⟩ + let y : ConnectedComponents Y → Y := fun c ↦ (ConnectedComponents.surjective_coe c).choose + have hy : ∀ c, (ConnectedComponents.mk (y c) : ConnectedComponents Y) = c := + fun c ↦ (ConnectedComponents.surjective_coe c).choose_spec + let Z : ConnectedComponents Y → Type := fun c ↦ connectedComponent (y c) + let ψ₁ : ∀ c, Z c → S := fun c x ↦ ψ x.1 + have : ∀ c, Nonempty (Z c) := fun c ↦ ⟨⟨y c, mem_connectedComponent⟩⟩ + have D : ∀ c m, FrameData χ.Φ (R m).Γ Kc (ψ₁ c) := fun c m ↦ + frameData_of_cut hS (R m).fits (hinter (e₂ m)) hcross.lines hY hψ hsheet (y c) + have hAn : ∀ m, IsAnchored (R m).Γ Kc := fun m ↦ by + obtain ⟨F₀, -, -, hform⟩ := hcross.form + exact isAnchored_of_form hform (hinter (e₂ m)) (htwo (e₂ + m)) + have hfl : ∀ c, ∃ flip, IsPaperFlip χ.Φ Kc (ψ₁ c) (D c 0).pull.frag.isSurface flip := fun c ↦ + (D c 0).exists_flip + choose flip hflip using hfl + let a₀ : β := Classical.arbitrary β + let χ' : ∀ c, ColourScheme (Z c) β := fun c ↦ fragScheme χ a₀ (D c 0) hF (flip c) + let P' : ∀ c, ℕ → ColouredPainting (χ' c) := fun c m ↦ + fragPainting (a₀ := a₀) (D c 0) hF (flip c) (R m) (D c m) (hAn m) + have hgood : ∀ c, ∀ e : ℕ → ℕ, StrictMono e → ∃ i j, i < j ∧ ∃ σv σe, + IsColouredLinearInflation (χ' c) (P' c (e i)) (P' c (e j)) σv σe := by + intro c e he + have hfrag := (D c 0).pull.frag + obtain ⟨Shat₁, t₁, ⟨cap₁⟩⟩ := exists_cappedSurface _ _ hfrag.isSurface hfrag.connected rfl + have hnb := hS1 _ Shat₁ β (χ' c) ⟨cap₁⟩ (hsimple (y c) Shat₁ cap₁) + unfold ColourScheme.IsBad at hnb + push Not at hnb + have := hnb fun m ↦ P' c (e m) + unfold IsBadSequence at this + push Not at this + obtain ⟨i, j, hij, σv, σe, hσ⟩ := this + exact ⟨i, j, hij, σv, σe, hσ⟩ + obtain ⟨i, j, hij, hall⟩ := exists_common_pair (fun c i j ↦ ∃ σv σe, + IsColouredLinearInflation (χ' c) (P' c i) (P' c j) σv σe) hgood + choose σv σe hσ using hall + have hC : IsCover Kc ψ₁ := by + refine ⟨fun x ↦ ?_, fun c c' x x' hxy hoff ↦ ?_⟩ + · obtain ⟨z, rfl⟩ := hψ.2.1 x + refine ⟨(z : ConnectedComponents Y), ⟨z, ?_⟩, rfl⟩ + exact ConnectedComponents.coe_eq_coe'.1 (hy _).symm |> fun h ↦ h + · have heq : x.1 = x'.1 := hψ.2.2.1 hoff (fun hK' ↦ hoff (hxy ▸ hK')) hxy + have hc : c = c' := by + have h₁ : (ConnectedComponents.mk x.1 : ConnectedComponents Y) = c := + (ConnectedComponents.coe_eq_coe'.2 x.2).trans (hy c) + have h₂ : (ConnectedComponents.mk x'.1 : ConnectedComponents Y) = c' := + (ConnectedComponents.coe_eq_coe'.2 x'.2).trans (hy c') + rw [← h₁, ← h₂, heq] + subst hc + exact congrArg (Sigma.mk c) (Subtype.ext heq) + have hglue := glue_coloured (ι := ConnectedComponents Y) (Y := Z) (ψ := ψ₁) + (Γ₀ := fun _ ↦ (R 0).Γ) (D₀ := fun c ↦ D c 0) (hF := hF) (flip := flip) (P₁ := R i) (P₂ := R j) + (D₁ := fun c ↦ D c i) (D₂ := fun c ↦ D c j) (hA₁ := hAn i) (hA₂ := hAn j) (σv := σv) (σe := σe) + (a₀ := a₀) hσ hflip (hRV i j) + hC + have hfin := IsColouredLinearInflation.image hS (hα _).symm.symm (hα _).symm.symm (hQ + (e₂ i)).symm (hQ (e₂ j)).symm hglue + exact hbad _ _ (he₁s (he₂s hij)) ⟨_, _, hfin⟩ + +/-- **Graph Minors XIX, (5.5)** (page 338), from (5.2), (5.4) and the fact that each fragment is +simpler. -/ +theorem theorem_5_5_proof : Theorem55Statement.{u, w} := + theorem_5_5_lift theorem_5_5_zero + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Block.lean b/LeanPool/GraphMinor/GM19/Section6Block.lean new file mode 100644 index 0000000000..c41cf1b9ab --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Block.lean @@ -0,0 +1,360 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Hub +public import LeanPool.GraphMinor.GM19.Section6Comp +public import LeanPool.GraphMinor.GM19.Section6Region + +/-! +# Graph Minors XIX, (6.7): `sk(Γ)` is a block + +Let `Γ` be an internally 3-connected painting. The paper's proof, page 342, shows that the closed +curve +tracing the perimeter of a region has no repeated vertices, and then finds that a vertex that cuts +`sk(Γ)` would have to cut such a curve. + +A repeated vertex would give two spokes to the hub of the region with the same ends, and these bound +a +disc that misses `sk(Γ)` except at the vertex, which condition (iv) of a radial drawing forbids +(`spoke_once`). For a region of `Γ` in `Σ̂` the disc is `pinch`, which is where internal +3-connectivity is used, and for the inside of an edge of size 3 it comes from `pinch_of_cell`. So +each +region has a perimeter as in `exists_perimeter`. A set of vertices closed under adjacency off a +vertex +`v` that meets the closure of a region holds all vertices other than `v` in that closure +(`sk_region_part`), and since `Σ̂ \ v` is connected this gives all vertices other than `v` +(`conn_of_regions`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +section Generic + +variable {T : Type} [TopologicalSpace T] + +/-- Two spokes with the same ends, in a region in which each `O`-arc through the vertex bounds a +disc +that misses the drawing, are equal. The proof is that of `spoke_unique`. -/ +theorem spoke_once (hT : IsClosedSurface T) {D G₃ : Drawing T} + (hrad : PreRad (PaintingOrDrawing.drawing D) G₃) {e₁ e₂ r : Set T} (he₁ : e₁ ∈ G₃.E) + (he₂ : e₂ ∈ G₃.E) (hrD : r ∈ D.R) (h₁r : e₁ ⊆ r) (h₂r : e₂ ⊆ r) {v : T} (hv : v ∈ D.V) {w : T} + (hw : w ∈ r) (hwG : w ∈ G₃.V) (h₁ : closure e₁ ∩ G₃.V = {v, w}) + (h₂ : closure e₂ ∩ G₃.V = {v, w}) + (hpinch : ∀ F : Set T, IsOArc F → v ∈ F → v ∈ closure (F \ {v}) → F \ {v} ⊆ r → + ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = F ∧ Δ ∩ D.U ⊆ {v}) : e₁ = e₂ := by + by_contra hne + have : T2Space T := hT.2.1 + have hman : ∀ x : T, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hlc : LocallyConnectedSpace T := IsClosedSurface.locallyConnectedSpace hT + have hdis : Disjoint r D.U := by + refine disjoint_left.mpr fun x hx hxU ↦ region_subset hrD hx hxU + have hvne : v ≠ w := fun h ↦ disjoint_left.mp hdis hw + (D.V_subset_U (h ▸ hv)) + have hL₁ : IsLineWithEnds (closure e₁) (v) w := isLine_closure he₁ hvne h₁ + have hL₂ : IsLineWithEnds (closure e₂) (v) w := isLine_closure he₂ hvne h₂ + have hcl : ∀ {e}, e ∈ G₃.E → closure e ∩ G₃.V = {v, w} → closure e ⊆ e ∪ {v, w} := by + intro e he hset x hx + rcases closure_edge_subset he hx with h | h + · exact Or.inl h + · exact Or.inr (hset ▸ ⟨hx, h⟩) + have hcap : closure e₁ ∩ closure e₂ ⊆ {v, w} := by + rintro x ⟨hx₁, hx₂⟩ + rcases hcl he₁ h₁ hx₁ with h | h + · rcases hcl he₂ h₂ hx₂ with h' | h' + · exact absurd (arcComp_eq_of_mem he₁ he₂ h h') hne + · exact h' + · exact h + have hO := isOArc_union hL₁ hL₂ hcap + have hsubr : (closure e₁ ∪ closure e₂) \ {v} ⊆ r := by + have hc : ∀ {e}, e ∈ G₃.E → e ⊆ r → closure e ∩ G₃.V = {v, w} → + closure e \ {v} ⊆ r := by + intro e he her hset x hx + rcases hcl he hset hx.1 with h | h | h + · exact her h + · exact absurd h hx.2 + · exact h ▸ hw + rintro x ⟨hx | hx, hxn⟩ + · exact hc he₁ h₁r h₁ ⟨hx, hxn⟩ + · exact hc he₂ h₂r h₂ ⟨hx, hxn⟩ + have hvm : v ∈ closure e₁ := by + have : v ∈ closure e₁ ∩ G₃.V := by rw [h₁]; exact Or.inl rfl + exact this.1 + have hclv : v ∈ closure ((closure e₁ ∪ closure e₂) \ {v}) := by + have : e₁ ⊆ (closure e₁ ∪ closure e₂) \ {v} := fun x hx ↦ + ⟨Or.inl (subset_closure hx), fun h ↦ hdis.le_bot ⟨h₁r hx, D.V_subset_U (by + rw [mem_singleton_iff.mp h] + exact hv)⟩⟩ + exact closure_mono this hvm + obtain ⟨Δ, hΔ, hbd, hΔU⟩ := hpinch _ hO (Or.inl hvm) hclv hsubr + have hsubΔ : Δ ⊆ r ∪ {v} := by + have hopen := hΔ.isOpen_discInt hman + obtain ⟨x, hx⟩ := he₁.1 + have hxb : x ∈ discBd Δ := by rw [hbd]; exact Or.inl (subset_closure hx) + have hxΔ : x ∈ closure (discInt Δ) := hΔ.subset_closure_discInt (Surface.discBd_subset _ hxb) + obtain ⟨y, hyr, hyi⟩ := mem_closure_iff.mp hxΔ r (region_isOpen hrD) (h₁r hx) + have hdI : Disjoint (discInt Δ) D.U := by + refine disjoint_left.mpr fun z hz hzU ↦ ?_ + have hzv : z = v := hΔU ⟨hz.1, hzU⟩ + apply hz.2 + rw [hbd, hzv] + exact Or.inl hvm + have hIr := subset_region hrD hΔ.isPreconnected_discInt hdI hyi hyr + intro z hz + by_cases hzb : z ∈ discBd Δ + · rw [hbd] at hzb + by_cases hzv : z = v + · exact Or.inr hzv + · exact Or.inl (hsubr ⟨hzb, hzv⟩) + · exact Or.inl (hIr ⟨hz, hzb⟩) + refine hrad.2.2.2.2.2.2 e₁ he₁ e₂ he₂ hne (v) ?_ r hrD w ⟨hw, hwG⟩ h₁ h₂ + ⟨Δ, hΔ, hsubΔ, ?_⟩ + · exact hv + · rw [← hbd, ← subBd_eq_frontier', IsClosedDisc.frontier_eq_discBd hT hΔ] + + +/-- A closed nonempty family: the closures of the regions cover the surface. -/ +theorem exists_region_closure (hT : IsClosedSurface T) [ConnectedSpace T] (D : Drawing T) (x : T) : + ∃ r ∈ D.R, x ∈ closure r := by + have hlc : LocallyConnectedSpace T := IsClosedSurface.locallyConnectedSpace hT + have : T2Space T := hT.2.1 + have hx : x ∈ closure (⋃ r ∈ D.R, r) := by + rw [mem_closure_iff] + intro O hO hxO + obtain ⟨y, hyO, hyU⟩ := exists_notMem_U (Γ := D) hT hO ⟨x, hxO⟩ + obtain ⟨r, hr, hyr⟩ := exists_region_of_notMem hyU + exact ⟨y, hyO, mem_biUnion hr hyr⟩ + rw [(finite_R hT D).closure_biUnion] at hx + obtain ⟨r, hr, h⟩ := mem_iUnion₂.mp hx + exact ⟨r, hr, h⟩ + +theorem regions_eq_R (D : Drawing T) : D.regions = D.R := by + rw [Drawing.regions, Surface.Drawing.R, compl_eq_univ_sdiff] + +/-- **From regions to the whole drawing.** Let `X` be a set of at most one point. If a set of +vertices +off `X` closed under adjacency off `X` holds, with one vertex in the closure of a region, every +vertex +off `X` in that closure, then the vertices off `X` are connected. The reason is that `T \ X` is +connected, and it would otherwise be split by two closed unions of closures of regions. -/ +theorem conn_of_regions (hT : IsClosedSurface T) [ConnectedSpace T] (D : Drawing T) + (hl : LoopFree D) + {X : Set T} (hX : X.Subsingleton) + (hreg : ∀ r ∈ D.R, ∀ Y ⊆ D.V \ X, (∀ a ∈ Y, ∀ b ∈ D.V \ X, D.adj.Adj a b → b ∈ Y) → + ∀ x ∈ Y, x ∈ closure r → ∀ y ∈ D.V \ X, y ∈ closure r → y ∈ Y) : ConnIn D (D.V \ X) := by + classical + have hlc : LocallyConnectedSpace T := IsClosedSurface.locallyConnectedSpace hT + have : T2Space T := hT.2.1 + intro Y hY hne hc + by_contra hn + obtain ⟨w, hw, hwY⟩ : ∃ w ∈ D.V \ X, w ∉ Y := by + by_contra h + push Not at h + exact hn (Subset.antisymm hY h) + obtain ⟨y, hy⟩ := hne + have hRfin := finite_R hT D + let 𝓐 : Set (Set T) := {r | r ∈ D.R ∧ (Y ∩ closure r).Nonempty} + let 𝓑 : Set (Set T) := {r | r ∈ D.R ∧ ¬ (Y ∩ closure r).Nonempty} + let Z₁ : Set T := ⋃ r ∈ 𝓐, closure r + let Z₂ : Set T := ⋃ r ∈ 𝓑, closure r + have hfin₁ : 𝓐.Finite := hRfin.subset fun _ h => h.1 + have hfin₂ : 𝓑.Finite := hRfin.subset fun _ h => h.1 + have hZ₁ : IsClosed Z₁ := hfin₁.isClosed_biUnion fun _ _ => isClosed_closure + have hZ₂ : IsClosed Z₂ := hfin₂.isClosed_biUnion fun _ _ => isClosed_closure + have hcov : Xᶜ ⊆ Z₁ ∪ Z₂ := fun x _ ↦ by + obtain ⟨r, hr, hxr⟩ := exists_region_closure hT D x + by_cases h : (Y ∩ closure r).Nonempty + · exact Or.inl (mem_biUnion (x := r) ⟨hr, h⟩ hxr) + · exact Or.inr (mem_biUnion (x := r) ⟨hr, h⟩ hxr) + have hne₁ : (Xᶜ ∩ Z₁).Nonempty := by + obtain ⟨r, hr, hxr⟩ := exists_region_closure hT D y + exact ⟨y, (hY hy).2, mem_biUnion (x := r) ⟨hr, y, hy, hxr⟩ hxr⟩ + have hne₂ : (Xᶜ ∩ Z₂).Nonempty := by + obtain ⟨r, hr, hxr⟩ := exists_region_closure hT D w + refine ⟨w, hw.2, mem_biUnion (x := r) ⟨hr, ?_⟩ hxr⟩ + rintro ⟨z, hzY, hzr⟩ + exact hwY (hreg r hr Y hY hc z hzY hzr w hw hxr) + have hconn : IsPreconnected Xᶜ := by + have hfin : X.Finite := hX.finite + exact Surface.isPreconnected_compl_finite hT hfin + obtain ⟨z, hzX, hz₁, hz₂⟩ := isPreconnected_closed_iff.mp hconn Z₁ Z₂ hZ₁ hZ₂ hcov hne₁ hne₂ + obtain ⟨r, ⟨hr, v, hvY, hvr⟩, hzr⟩ := mem_iUnion₂.mp hz₁ + obtain ⟨r', ⟨hr', hnr'⟩, hzr'⟩ := mem_iUnion₂.mp hz₂ + have hrg : r ∈ D.regions := by rw [regions_eq_R]; exact hr + have hrg' : r' ∈ D.regions := by rw [regions_eq_R]; exact hr' + -- A vertex off `X` in both closures is a contradiction. + have hvert : ∀ u ∈ D.V \ X, u ∈ closure r → u ∈ closure r' → False := fun u hu h₁ h₂ ↦ + hnr' ⟨u, hreg r hr Y hY hc v hvY hvr u hu h₁, h₂⟩ + have hneq : r ≠ r' := by + rintro rfl + exact hnr' ⟨v, hvY, hvr⟩ + have hzU : z ∈ D.U := by + by_contra hzU + obtain ⟨-, -, -, -, -, h₁⟩ := region_props D hrg + obtain ⟨-, -, -, -, -, h₂⟩ := region_props D hrg' + have hzr₁ : z ∈ r := by_contra fun h ↦ hzU (h₁ ⟨hzr, h⟩) + obtain ⟨p, hpo, hpr⟩ := mem_closure_iff.mp hzr' r (region_props D hrg).1 hzr₁ + exact hneq (region_eq_of_mem hr hr' hpo hpr) + by_cases hzV : z ∈ D.V + · exact hvert z ⟨hzV, hzX⟩ hzr hzr' + obtain ⟨e, he, hze⟩ := exists_edge_of_mem D hzU hzV + have h₁ := edge_subset_closure hT D hl he hrg ⟨z, hze, hzr⟩ + have h₂ := edge_subset_closure hT D hl he hrg' ⟨z, hze, hzr'⟩ + obtain ⟨a, b, hab, -, -, hset⟩ := exists_end D hl he + have hcl : ∀ {q}, e ⊆ closure q → closure e ⊆ closure q := fun h ↦ closure_minimal h + isClosed_closure + have ha : a ∈ closure e ∩ D.V := by rw [hset]; exact Or.inl rfl + have hb : b ∈ closure e ∩ D.V := by rw [hset]; exact Or.inr rfl + by_cases haX : a ∈ X + · have hbX : b ∉ X := fun h ↦ hab (hX haX h) + exact hvert b ⟨hb.2, hbX⟩ (hcl h₁ hb.1) (hcl h₂ hb.1) + · exact hvert a ⟨ha.2, haX⟩ (hcl h₁ ha.1) (hcl h₂ ha.1) + +end Generic + +section Sk + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {D G₃ : Drawing Shat} + +omit [T2Space S] [T2Space Shat] in +/-- The inside of the disc of an edge `c` of size 3 holds a region `r` of `sk(Γ)`, with `sk(Γ)` in +the +disc only on its boundary. -/ +theorem cell_facts (hD : IsSkHat cap Γ D) {r c : Set Shat} {c₀ : Set S} + (hr : r ∈ D.R) (hc₀ : c₀ ∈ Γ.E) (h3 : (tilde c₀).ncard = 3) (hc : c = cap.emb '' closure c₀) + (hrs : r ⊆ c) : IsClosedDisc c ∧ r ⊆ discInt c ∧ c ∩ D.U ⊆ discBd c := by + subst hc + obtain ⟨hdisc, hT', -⟩ := Γ.isDisc_of_three hc₀ h3 + obtain ⟨hΔ, hbd⟩ := isClosedDisc_image hdisc cap.isEmbedding + have hbdsk : discBd (closure c₀) ⊆ Γ.skU := fun x hx ↦ + Or.inr (mem_iUnion₂.2 ⟨c₀, ⟨hc₀, h3⟩, hx⟩) + refine ⟨hΔ, fun x hx ↦ ⟨hrs hx, fun hb ↦ ?_⟩, ?_⟩ + · rw [hbd] at hb + refine region_subset hr hx ?_ + rw [hD.hU] + exact image_mono hbdsk hb + · rintro _ ⟨⟨x, hx, rfl⟩, hxU⟩ + rw [hD.hU] at hxU + obtain ⟨z, hz, hzx⟩ := hxU + obtain rfl := cap.isEmbedding.injective hzx + rw [hbd] + refine mem_image_of_mem _ ?_ + by_contra hnb + have hzc : z ∈ c₀ := by + by_contra hn + exact hnb (hT' ⟨hx, hn⟩) + have hzV : z ∉ Γ.V := Γ.disjoint_V hc₀ hzc + rcases hz with (hz | hz) | hz + · exact hzV hz + · obtain ⟨e, ⟨he, h2⟩, hze⟩ := mem_iUnion₂.mp hz + have := arcComp_eq_of_mem he hc₀ hze hzc + rw [this, h3] at h2 + omega + · obtain ⟨e, ⟨he, h2⟩, hze⟩ := mem_iUnion₂.mp hz + have hze' : z ∈ e := by + by_contra hn + exact hzV (Γ.tilde_subset_V he ⟨Surface.discBd_subset _ hze, hn⟩) + have := arcComp_eq_of_mem he hc₀ hze' hzc + exact hnb (this ▸ hze) + +/-- Each vertex has one spoke into each region of `sk(Γ)`, for a radial drawing of `sk(Γ)`. -/ +theorem sk_spoke_once (hS : IsSurface S) (hD : IsSkHat cap Γ D) + (h3 : Γ.IsInternallyThreeConnected) (hrad : PreRad (PaintingOrDrawing.drawing D) G₃) + {r : Set Shat} (hr : r ∈ D.R) : ∀ e₁ ∈ G₃.E, ∀ e₂ ∈ G₃.E, e₁ ⊆ r → e₂ ⊆ r → ∀ v ∈ D.V, ∀ c ∈ r, + c ∈ G₃.V → closure e₁ ∩ G₃.V = {v, c} → closure e₂ ∩ G₃.V = {v, c} → e₁ = e₂ := by + intro e₁ he₁ e₂ he₂ h₁r h₂r v hv c hc hcV h₁ h₂ + have hT := cap.isClosedSurface + refine spoke_once hT hrad he₁ he₂ hr h₁r h₂r hv hc hcV h₁ h₂ fun F hF hvF hcl hsub ↦ ?_ + rcases hD.region_cases hr with hh | ⟨c₀, hc₀, h3c, hrs⟩ + · rw [hD.hV] at hv + obtain ⟨v₀, hv₀, rfl⟩ := hv + exact pinch hS hD h3 hh hv₀ hF hvF hcl hsub + · obtain ⟨hΔ, hint, hU⟩ := cell_facts hD hr hc₀ h3c rfl hrs + have hrΔ : closure r ⊆ cap.emb '' closure c₀ := closure_minimal hrs hΔ.isClosed + refine pinch_of_cell hT hΔ hF (fun x hx ↦ ?_) (fun x hx ↦ hint (hsub hx)) hU + by_cases hxv : x = v + · exact hrΔ (closure_mono hsub (hxv ▸ hcl)) + · exact (hint (hsub ⟨hx, hxv⟩)).1 + +/-- **Two vertices on the perimeter of a region.** A set of vertices off a point of `X`, closed +under +adjacency off `X`, that holds a vertex in the closure of `r` holds all vertices off `X` in that +closure. -/ +theorem sk_region_part [ConnectedSpace Shat] (hS : IsSurface S) (hD : IsSkHat cap Γ D) + (h3 : Γ.IsInternallyThreeConnected) (hrad : PreRad (PaintingOrDrawing.drawing D) G₃) + (hmax : RadMax (PaintingOrDrawing.drawing D) G₃) {X : Set Shat} (hX : X.Subsingleton) + {r : Set Shat} (hr : r ∈ D.R) {Y : Set Shat} (hY : Y ⊆ D.V \ X) + (hc : ∀ a ∈ Y, ∀ b ∈ D.V \ X, D.adj.Adj a b → b ∈ Y) {x : Shat} (hx : x ∈ Y) + (hxr : x ∈ closure r) {y : Shat} (hy : y ∈ D.V \ X) (hyr : y ∈ closure r) : y ∈ Y := by + have hT := cap.isClosedSurface + obtain ⟨κ, _, next, A, hA, -, hrange, hedge, hreach⟩ := exists_perimeter hT hrad hmax + (hD.E_nonempty h3.1) (hD.no_loops hS) hr (sk_spoke_once hS hD h3 hrad hr) + have hAV : ∀ k, A k ∈ D.V := fun k ↦ (hrange.subset ⟨k, rfl⟩).1 + obtain ⟨k, rfl⟩ : x ∈ range A := by + rw [hrange] + exact ⟨(hY hx).1, hxr⟩ + obtain ⟨j, rfl⟩ : y ∈ range A := by + rw [hrange] + exact ⟨hy.1, hyr⟩ + have hadj : ∀ a, A a ∉ X → A (next a) ∉ X → (A a ∈ Y ↔ A (next a) ∈ Y) := by + intro a h₁ h₂ + by_cases he : A a = A (next a) + · rw [← he] + obtain ⟨e, heE, hset⟩ := hedge a + have hm : ∀ {z}, z ∈ ({A a, A (next a)} : Set Shat) → z ∈ tilde e := fun {z} hz ↦ by + rw [tilde_eq_inter_V D heE, hset] + exact hz + have hAd : D.adj.Adj (A a) (A (next a)) := ⟨he, hAV a, hAV _, e, heE, hm (Or.inl rfl), hm + (Or.inr rfl)⟩ + exact ⟨fun h ↦ hc _ h _ ⟨hAV _, h₂⟩ hAd, fun h ↦ hc _ h _ ⟨hAV _, h₁⟩ hAd.symm⟩ + by_cases hb : ∃ b, A b ∈ X + · obtain ⟨b, hbX⟩ := hb + have hnb : ∀ a, a ≠ b → A a ∉ X := fun a hab h ↦ hab (hA (hX h hbX)) + refine cycle_avoid (Y := A ⁻¹' Y) hreach b ⟨k, hx⟩ (fun h ↦ (hY h).2 hbX) ?_ ?_ j ?_ + · intro a ha hn + exact (hadj a (fun h ↦ (hY ha).2 h) (hnb _ hn)).mp ha + · intro a ha hn + exact (hadj a (hnb _ hn) (fun h ↦ (hY ha).2 h)).mpr ha + · rintro rfl + exact hy.2 hbX + · push Not at hb + have key : ∀ i, Relation.ReflTransGen (fun x y => y = next x) k i → A i ∈ Y := by + intro i h + induction h with + | refl => exact hx + | tail _ hs ih => + subst hs + exact (hadj _ (hb _) (hb _)).mp ih + exact key j (hreach k j) + +/-- **Graph Minors XIX, (6.7), first statement** (page 342): `sk(Γ)` is a block. -/ +theorem sk_isBlock [ConnectedSpace Shat] (hS : IsSurface S) (hD : IsSkHat cap Γ D) + (h3 : Γ.IsInternallyThreeConnected) (hl : LoopFree D) + (hrad : PreRad (PaintingOrDrawing.drawing D) G₃) + (hmax : RadMax (PaintingOrDrawing.drawing D) G₃) : D.IsBlock := by + have hT := cap.isClosedSurface + have hconn : ∀ {X : Set Shat}, X.Subsingleton → ConnIn D (D.V \ X) := fun hX ↦ + conn_of_regions hT D hl hX fun r hr Y hY hc x hx hxr y hy hyr ↦ + sk_region_part hS hD h3 hrad hmax hX hr hY hc hx hxr hy hyr + obtain ⟨e, he⟩ := hD.E_nonempty h3.1 + obtain ⟨a, b, -, -, -, hset⟩ := exists_end D hl he + refine ⟨⟨a, (show a ∈ closure e ∩ D.V by rw [hset]; exact Or.inl rfl).2⟩, ?_, fun v _ ↦ ?_⟩ + · have := hconn (X := ∅) subsingleton_empty + rw [sdiff_empty] at this + exact (preconnected_iff_connIn D _).mpr this + · exact (preconnected_iff_connIn D _).mpr (hconn subsingleton_singleton) + +end Sk + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Bound.lean b/LeanPool/GraphMinor/GM19/Section6Bound.lean new file mode 100644 index 0000000000..7108276025 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Bound.lean @@ -0,0 +1,131 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Graph +public import LeanPool.GraphMinor.GM19.Section6Cut + +/-! +# Graphs that a curve misses + +Let `D` be a drawing in a connected closed surface `S`, with no loops and no parallel edges, in +which no vertex cuts the graph. If an `O`-arc that bounds no closed disc misses `U(D)`, then `D` has +fewer edges than a triangulation of `S` with the same number of vertices (`edges_lt_of_curve`). + +This is the count of Euler characteristics in the proof of Graph Minors XIX, (6.5) (page 341). We +cut along the curve with `exists_simpler_side`, extend the image of `D` to a triangulation of the +new surface, and count with `IsTriang.graph_bound`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +local notation "K" => ZMod 2 + +variable {S : Type} [TopologicalSpace S] + +theorem twoConn_image {T : Type} [TopologicalSpace T] {Z : Set S} (h : TwoConn Z) + (hZ : IsPreconnected Z) {ι : S → T} (hc : ContinuousOn ι Z) (hi : InjOn ι Z) : + TwoConn (ι '' Z) := fun p => by + by_cases hp : p ∈ ι '' Z + · obtain ⟨x, hx, rfl⟩ := hp + have he : ι '' Z \ {ι x} = ι '' (Z \ {x}) := by + ext y + constructor + · rintro ⟨⟨z, hz, rfl⟩, hne⟩ + exact ⟨z, ⟨hz, fun h' => hne (h' ▸ rfl)⟩, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + exact ⟨⟨z, hz.1, rfl⟩, fun h' => hz.2 (hi hz.1 hx h')⟩ + rw [he] + exact (h x).image _ (hc.mono sdiff_subset) + · rw [sdiff_singleton_eq_self hp] + exact hZ.image _ hc + +/-- **The count.** See the module docstring. -/ +theorem edges_lt_of_curve (hT : IsClosedSurface S) [ConnectedSpace S] (D : Drawing S) + (hl : LoopFree D) (hs : ∀ e ∈ D.E, ∀ f ∈ D.E, tilde e = tilde f → e = f) + (h3V : 3 ≤ D.V.ncard) (h3E : 3 ≤ D.E.ncard) (hc : ∀ v ∈ D.V, ConnIn D (D.V \ {v})) {F : Set S} + (hO : IsOArc F) (hnn : ¬ ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = F) + (hd : Disjoint D.U F) {κ : ℕ} (hκ : Nat.card (KCl S K) = 2 ^ κ) : + (D.E.ncard : ℤ) < 3 * D.V.ncard - 6 + 3 * κ := by + have ht2S : T2Space S := hT.2.1 + have hTC := twoConn_U D hl h3V hc + obtain ⟨φ⟩ := id hO + have hpF : (φ 1).1 ∉ D.U := fun h => disjoint_left.mp hd h (φ 1).2 + have hZ : IsPreconnected D.U := by + have := hTC (φ 1).1 + rwa [sdiff_singleton_eq_self hpF] at this + obtain ⟨T, tT, cT, ι, ι', hT₁, hιc, -, hleft, hlt⟩ := exists_simpler_side hT hO hnn hZ hd + have ht2T : T2Space T := hT₁.2.1 + have hne : Nonempty T := cT.toNonempty + have hinj : InjOn ι D.U := hleft.injOn + have hg := isGraph_of_loopFree D hl + have hgU : gr D.V (closure '' D.E) = D.U := (U_eq D).symm + have hg₁ := isGraph_image hg hgU.subset hιc hinj + have hVU : D.V ∪ ⋃₀ (closure '' D.E) = ⋃₀ (closure '' D.E) := union_eq_right.mpr + (V_subset_edges D h3V hc) + have hUe : D.U = ⋃₀ (closure '' D.E) := by rw [U_eq D, hVU] + have hU₁ : ⋃₀ ((fun e => ι '' e) '' (closure '' D.E)) = ι '' D.U := by + ext y + constructor + · rintro ⟨_, ⟨_, ⟨e, he, rfl⟩, rfl⟩, x, hx, rfl⟩ + exact ⟨x, D.closure_subset_U he hx, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + rw [hUe] at hx + obtain ⟨_, ⟨e, he, rfl⟩, hxe⟩ := hx + exact ⟨_, ⟨_, ⟨e, he, rfl⟩, rfl⟩, x, hxe, rfl⟩ + have hno : ι '' D.V ⊆ ⋃₀ ((fun e => ι '' e) '' (closure '' D.E)) := by + rw [hU₁] + exact image_mono D.V_subset_U + have hTC₁ := twoConn_image hTC hZ hιc hinj + have hV₁ : (ι '' D.V).ncard = D.V.ncard := (hinj.mono D.V_subset_U).ncard_image + obtain ⟨a, b, d, ha, hb, hd', hab, had, hbd⟩ := (two_lt_ncard_iff D.finite_V).mp + (show 2 < D.V.ncard by omega) + have hinj' : ∀ {x y}, x ∈ D.V → y ∈ D.V → x ≠ y → ι x ≠ ι y := fun hx hy hxy he => hxy (hinj + (D.V_subset_U hx) (D.V_subset_U hy) he) + obtain ⟨V₂, E₂, 𝓕₂, hsubV, hsubU, hdis⟩ := exists_dissection hT₁ hg₁ hno (𝓒c := {ι '' D.U}) + (finite_singleton _) + (by rintro _ rfl; exact hTC₁) + (by + rintro _ rfl + exact ⟨ι a, ι b, ι d, ⟨a, D.V_subset_U ha, rfl⟩, ⟨b, D.V_subset_U hb, rfl⟩, ⟨d, + D.V_subset_U hd', rfl⟩, hinj' ha hb hab, hinj' ha hd' had, hinj' hb hd' hbd⟩) + (by + intro G hG hmeet + obtain ⟨x, y, hx, hy, hxy⟩ := hmeet _ rfl + rw [hU₁] + exact hG.union hTC₁ hx hy hxy) + obtain ⟨V₃, E₃, 𝓕₃, htr, hV₃, hU₃, -⟩ := hdis.exists_triang + have hE₁ : ((fun e => ι '' e) '' (closure '' D.E)).ncard = D.E.ncard := by + have h1 : InjOn closure D.E := fun e he f hf hef => by + rw [← D.closure_diff_V he, ← D.closure_diff_V hf] + exact congrArg (· \ D.V) hef + have h2 : InjOn (fun e => ι '' e) (closure '' D.E) := by + rintro _ ⟨e, he, rfl⟩ _ ⟨f, hf, rfl⟩ hef + exact (hinj.image_eq_image_iff (D.closure_subset_U he) (D.closure_subset_U hf)).mp hef + rw [h2.ncard_image, h1.ncard_image] + have hle := htr.graph_bound hT₁ hg₁ (fun y hy => hV₃ ⟨hsubV hy, hsubU (hno hy)⟩) + (hsubU.trans hU₃) (by + rintro _ ⟨_, ⟨e, he, rfl⟩, rfl⟩ _ ⟨_, ⟨f, hf, rfl⟩, rfl⟩ hef + have h5 : ∀ {g}, g ∈ D.E → ι '' closure g ∩ ι '' D.V = ι '' tilde g := fun {g} hg' => by + rw [tilde_eq_inter_V D hg', hinj.image_inter (D.closure_subset_U hg') D.V_subset_U] + have hsub_e : tilde e ⊆ D.U := fun _ hx => D.closure_subset_U he hx.1 + have hsub_f : tilde f ⊆ D.U := fun _ hx => D.closure_subset_U hf hx.1 + have h6 := hs e he f hf ((hinj.image_eq_image_iff hsub_e hsub_f).mp + ((h5 he).symm.trans (hef.trans (h5 hf)))) + rw [h6]) (by rw [hE₁]; exact h3E) + obtain ⟨κ₁, h1, h2⟩ := htr.euler_ncard hT₁ + have h4 := hlt κ κ₁ hκ h1 + rw [hE₁, hV₁] at hle + omega + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Comp.lean b/LeanPool/GraphMinor/GM19/Section6Comp.lean new file mode 100644 index 0000000000..eaf810d5f0 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Comp.lean @@ -0,0 +1,199 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Graph + +/-! +# Composing enlargements + +An enlargement of `G` in `G'` and an enlargement of `G'` in `G''` give an enlargement of `G` in +`G''` (`IsEnlargement.comp`). This is the step "and hence an enlargement of `H` in `G'`" in the +proof of Graph Minors XIX, (6.5) (page 341). We first restate connectivity of a set of vertices +without walks (`preconnected_iff_connIn`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] + +theorem preconnected_iff_connIn (D : Drawing S) (X : Set S) : (D.adj.induce X).Preconnected ↔ + ConnIn D X := by + constructor + · intro h Y hY ⟨a, ha⟩ hc + refine Subset.antisymm hY fun b hb => ?_ + obtain ⟨w⟩ := h ⟨a, hY ha⟩ ⟨b, hb⟩ + have key : ∀ {p q : X}, (D.adj.induce X).Walk p q → p.1 ∈ Y → q.1 ∈ Y := fun w => by + induction w with + | nil => exact id + | cons hadj _ ih => exact fun hp => ih (hc _ hp _ (Subtype.coe_prop _) hadj) + exact key w ha + · intro h a b + let Y : Set S := {y | ∃ hy : y ∈ X, (D.adj.induce X).Reachable a ⟨y, hy⟩} + have hY : Y = X := h Y (fun y hy => hy.1) ⟨a.1, a.2, .refl _⟩ (fun p ⟨hpX, hr⟩ q hq hadj => + ⟨hq, hr.trans (SimpleGraph.Adj.reachable (G := D.adj.induce X) (u := ⟨p, hpX⟩) (v + := ⟨q, hq⟩) hadj)⟩) + have hb : b.1 ∈ Y := by + rw [hY] + exact b.2 + obtain ⟨_, hr⟩ := hb + exact hr + +theorem adj_mono {D D' : Drawing S} (h : D.IsSubdrawing D') {a b : S} + (hab : D.adj.Adj a b) : D'.adj.Adj a b := by + obtain ⟨h1, ha, hb, e, he, h2, h3⟩ := hab + exact ⟨h1, h.1 ha, h.1 hb, e, h.2 he, h2, h3⟩ + +variable [T2Space S] + +/-- **Composing enlargements.** See the module docstring. -/ +theorem IsEnlargement.comp {G G' G'' : Drawing S} (hl' : LoopFree G') + (hl'' : LoopFree G'') {σv τv : S → Drawing S} {σe τe : Set S → Set S} + (hσ : IsEnlargement G G' σv σe) (hτ : IsEnlargement G' G'' τv τe) : + ∃ (ρv : S → Drawing S), IsEnlargement G G'' ρv (τe ∘ σe) ∧ ∀ v ∈ G.V, ∀ x ∈ (σv v).V, + (τv x).IsSubdrawing (ρv v) := by + classical + let RV : S → Set S := fun v => ⋃ x ∈ (σv v).V, (τv x).V + let RE : S → Set (Set S) := fun v => (⋃ x ∈ (σv v).V, (τv x).E) ∪ τe '' (σv v).E + have hsubV : ∀ v ∈ G.V, ∀ x ∈ (σv v).V, x ∈ G'.V := fun v hv x hx => + (hσ.vertex_subdrawing v hv).1 hx + have hsubE : ∀ v ∈ G.V, ∀ f ∈ (σv v).E, f ∈ G'.E := fun v hv f hf => + (hσ.vertex_subdrawing v hv).2 hf + have hend : ∀ v ∈ G.V, ∀ f ∈ (σv v).E, ∀ x ∈ tilde f, x ∈ (σv v).V := fun v hv f hf x hx => by + have h1 : x ∈ closure f ∩ G'.V := by + rw [← tilde_eq_inter_V G' (hsubE v hv f hf)] + exact hx + have h2 := (hσ.vertex_subdrawing v hv).closure_inter_V hf + rw [← h2] at h1 + exact h1.2 + have hends : ∀ f ∈ G'.E, ∀ x ∈ tilde f, ∃ y ∈ tilde (τe f), y ∈ (τv x).V := fun f hf x hx => by + have hxV : x ∈ G'.V := by + rw [tilde_eq_inter_V G' hf] at hx + exact hx.2 + obtain ⟨y, hy1, hy2⟩ := (hτ.ends_iff f hf x hxV).mpr hx + exact ⟨y, hy2, hy1⟩ + have hREG : ∀ v ∈ G.V, RE v ⊆ G''.E := fun v hv e he => by + rcases he with he | ⟨f, hf, rfl⟩ + · obtain ⟨x, hx, he⟩ := mem_iUnion₂.mp he + exact (hτ.vertex_subdrawing x (hsubV v hv x hx)).2 he + · exact hτ.edge_mem f (hsubE v hv f hf) + have hRVG : ∀ v ∈ G.V, RV v ⊆ G''.V := fun v hv y hy => by + obtain ⟨x, hx, hy⟩ := mem_iUnion₂.mp hy + exact (hτ.vertex_subdrawing x (hsubV v hv x hx)).1 hy + have hspanV : ∀ v ∈ G.V, G''.spanV (RV v) (RE v) = RV v := fun v hv => by + refine Subset.antisymm (union_subset inter_subset_left (iUnion₂_subset fun e he y hy + => ?_)) fun y hy => .inl ⟨hy, hRVG v hv hy⟩ + rcases he.1 with he' | ⟨f, hf, rfl⟩ + · obtain ⟨x, hx, he'⟩ := mem_iUnion₂.mp he' + have h1 : y ∈ closure e ∩ (τv x).V := by + rw [(hτ.vertex_subdrawing x (hsubV v hv x hx)).closure_inter_V he'] + exact hy + exact mem_iUnion₂.mpr ⟨x, hx, h1.2⟩ + · obtain ⟨p, q, hpq, ht, -⟩ := hl' f (hsubE v hv f hf) + have hp : p ∈ tilde f := ht ▸ .inl rfl + have hq : q ∈ tilde f := ht ▸ .inr rfl + obtain ⟨p', hp1, hp2⟩ := hends f (hsubE v hv f hf) p hp + obtain ⟨q', hq1, hq2⟩ := hends f (hsubE v hv f hf) q hq + have hne : p' ≠ q' := fun h' => disjoint_left.mp (hτ.vertex_disjoint p (hsubV v hv p + (hend v hv f hf p hp)) q (hsubV v hv q (hend v hv f hf q hq)) hpq) hp2 (h' ▸ hq2) + obtain ⟨a, b, -, ht', -⟩ := hl'' (τe f) (hτ.edge_mem f (hsubE v hv f hf)) + have hyt : y ∈ tilde (τe f) := by + rw [tilde_eq_inter_V G'' (hτ.edge_mem f (hsubE v hv f hf))] + exact hy + have hcases : y = p' ∨ y = q' := by + rw [ht'] at hp1 hq1 hyt + rcases hp1 with rfl | rfl <;> rcases hq1 with rfl | rfl <;> rcases hyt with rfl | rfl + <;> simp_all + rcases hcases with rfl | rfl + · exact mem_iUnion₂.mpr ⟨p, hend v hv f hf p hp, hp2⟩ + · exact mem_iUnion₂.mpr ⟨q, hend v hv f hf q hq, hq2⟩ + have hspanE : ∀ v ∈ G.V, (G''.span (RV v) (RE v)).E = RE v := fun v hv => by + rw [Drawing.span_E, inter_eq_left.mpr (hREG v hv)] + have hsub : ∀ v ∈ G.V, ∀ x ∈ (σv v).V, (τv x).IsSubdrawing (G''.span (RV v) (RE v)) + := fun v hv x hx => by + refine ⟨fun y hy => ?_, fun e he => ?_⟩ + · change y ∈ G''.spanV _ _ + rw [hspanV v hv] + exact mem_iUnion₂.mpr ⟨x, hx, hy⟩ + · rw [hspanE v hv] + exact .inl (mem_iUnion₂.mpr ⟨x, hx, he⟩) + refine ⟨fun v => G''.span (RV v) (RE v), + ⟨fun e he => hτ.edge_mem _ (hσ.edge_mem e he), ?_, fun v hv => ?_, fun v hv => ?_, + fun v hv => ?_, fun v₁ hv₁ v₂ hv₂ hne => ?_, fun e he v hv => ?_⟩, hsub⟩ + · exact hτ.edge_injOn.comp hσ.edge_injOn fun e he => hσ.edge_mem e he + · refine ⟨fun y hy => G''.spanV_subset _ _ hy, fun e he => ?_⟩ + have h1 := he + rw [hspanE v hv] at h1 + exact hREG v hv h1 + · obtain ⟨x, hx⟩ := hσ.vertex_nonempty v hv + obtain ⟨y, hy⟩ := hτ.vertex_nonempty x (hsubV v hv x hx) + exact ⟨y, (hsub v hv x hx).1 hy⟩ + · rw [preconnected_iff_connIn] + change ConnIn _ (G''.spanV _ _) + rw [hspanV v hv] + intro Y hY ⟨y₀, hy₀⟩ hcl + have hcl' : ∀ x ∈ (σv v).V, (Y ∩ (τv x).V).Nonempty → (τv x).V ⊆ Y := fun x hx hne' => by + have h1 := (preconnected_iff_connIn _ _).mp (hτ.vertex_connected x (hsubV v hv x hx)) (Y ∩ + (τv x).V) inter_subset_right hne' (fun a ha b hb hab => + ⟨hcl a ha.1 b (mem_iUnion₂.mpr ⟨x, hx, hb⟩) (adj_mono (hsub v hv x hx) hab), hb⟩) + exact fun y hy => (h1.symm ▸ hy : y ∈ Y ∩ (τv x).V).1 + have hZ := (preconnected_iff_connIn _ _).mp (hσ.vertex_connected v hv) {x | x ∈ (σv v).V ∧ (Y ∩ + (τv x).V).Nonempty} (fun x hx => hx.1) (by + obtain ⟨x, hx, hy⟩ := mem_iUnion₂.mp (hY hy₀) + exact ⟨x, hx, y₀, hy₀, hy⟩) (by + rintro a ⟨ha, hne'⟩ b hb ⟨hab, -, -, f, hf, haf, hbf⟩ + refine ⟨hb, ?_⟩ + have hfG := hsubE v hv f hf + obtain ⟨p, hp1, hp2⟩ := hends f hfG a haf + obtain ⟨q, hq1, hq2⟩ := hends f hfG b hbf + have hpY : p ∈ Y := hcl' a ha hne' hp2 + have hpq : p ≠ q := fun h' => disjoint_left.mp (hτ.vertex_disjoint a (hsubV v hv a ha) b + (hsubV v hv b hb) hab) hp2 (h' ▸ hq2) + have hq' : q ∈ RV v := mem_iUnion₂.mpr ⟨b, hb, hq2⟩ + have hadj : (Drawing.adj (G''.span (RV v) (RE v))).Adj p q := ⟨hpq, by + change p ∈ G''.spanV _ _ + rw [hspanV v hv] + exact hY hpY, by + change q ∈ G''.spanV _ _ + rw [hspanV v hv] + exact hq', τe f, by + rw [hspanE v hv] + exact .inr ⟨f, hf, rfl⟩, hp1, hq1⟩ + exact ⟨q, hcl p hpY q hq' hadj, hq2⟩) + refine Subset.antisymm hY fun y hy => ?_ + obtain ⟨x, hx, hyx⟩ := mem_iUnion₂.mp hy + have h2 : x ∈ {x | x ∈ (σv v).V ∧ (Y ∩ (τv x).V).Nonempty} := hZ.symm ▸ hx + exact hcl' x hx h2.2 hyx + · change Disjoint (G''.spanV _ _) (G''.spanV _ _) + rw [hspanV v₁ hv₁, hspanV v₂ hv₂] + refine disjoint_left.mpr fun y hy hy' => ?_ + obtain ⟨x, hx, h1⟩ := mem_iUnion₂.mp hy + obtain ⟨x', hx', h2⟩ := mem_iUnion₂.mp hy' + have hne' : x ≠ x' := fun h' => disjoint_left.mp (hσ.vertex_disjoint v₁ hv₁ v₂ hv₂ hne) hx + (h' ▸ hx') + exact disjoint_left.mp (hτ.vertex_disjoint x (hsubV v₁ hv₁ x hx) x' + (hsubV v₂ hv₂ x' hx') hne') h1 h2 + · change ((G''.spanV _ _) ∩ _).Nonempty ↔ _ + rw [hspanV v hv] + have hfG := hσ.edge_mem e he + constructor + · rintro ⟨y, hy, hyt⟩ + obtain ⟨x, hx, h1⟩ := mem_iUnion₂.mp hy + have h2 := (hτ.ends_iff _ hfG x (hsubV v hv x hx)).mp ⟨y, h1, hyt⟩ + exact (hσ.ends_iff e he v hv).mp ⟨x, hx, h2⟩ + · intro h1 + obtain ⟨x, hx, h2⟩ := (hσ.ends_iff e he v hv).mpr h1 + obtain ⟨y, hy, hyt⟩ := (hτ.ends_iff _ hfG x (hsubV v hv x hx)).mpr h2 + exact ⟨y, mem_iUnion₂.mpr ⟨x, hx, hy⟩, hyt⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Contract.lean b/LeanPool/GraphMinor/GM19/Section6Contract.lean new file mode 100644 index 0000000000..84499d58ed --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Contract.lean @@ -0,0 +1,546 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Null +public import LeanPool.GraphMinor.GM19.Section6a +public import LeanPool.GraphMinor.GM11.Forest +public import LeanPool.GraphMinor.GM19.RadialExists + +/-! +# Contracting one edge of a drawing + +The proof of Graph Minors XIX, (6.3) (page 340) identifies the points of a tree of a drawing, and +uses that the surface does not change. We do this one edge at a time. By `exists_collapse`, an edge +`f` that is a line can be collapsed by a map `φ` homotopic to the identity. The images of the other +edges and of the vertices form a new drawing (`exists_contract`), and `rep` does not grow. If an +`O`-arc `F` of the old drawing misses an end of `f` then `φ` is injective on `F`. Otherwise `F` is +the union of two arcs between the ends of `f`, and one of them is mapped to a non-null-homotopic +`O`-arc by `not_null_of_two_arcs`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +local notation "𝕀" => unitInterval + +variable {S : Type} [TopologicalSpace S] + +/-- Each edge of the drawing is a line with two different ends. -/ +def LoopFree (D : Drawing S) : Prop := + ∀ e ∈ D.E, ∃ u v : S, u ≠ v ∧ tilde e = {u, v} ∧ IsLineWithEnds (closure e) u v + +theorem image_mem_arcComponentsIn {X Y : Type} [TopologicalSpace X] [TopologicalSpace Y] {φ : X → Y} + {g : Y → X} {A : Set X} (hφ : ContinuousOn φ A) (hg : ContinuousOn g (φ '' A)) + (hl : LeftInvOn g φ A) {e : Set X} (he : e ∈ arcComponentsIn A) : + φ '' e ∈ arcComponentsIn (φ '' A) := by + refine ⟨he.1.image _, image_mono he.2.1, he.2.2.1.image' (hφ.mono he.2.1), + fun D hD hpc hsub => ?_⟩ + have hgD : g '' D ⊆ A := by + rintro _ ⟨y, hy, rfl⟩ + obtain ⟨x, hx, rfl⟩ := hD hy + rwa [hl hx] + have hesub : e ⊆ g '' D := fun x hx => ⟨φ x, hsub ⟨x, hx, rfl⟩, hl (he.2.1 hx)⟩ + have h1 := he.2.2.2 (g '' D) hgD (hpc.image' (hg.mono hD)) hesub + rw [← h1, image_image] + ext y + constructor + · intro hy + obtain ⟨x, hx, rfl⟩ := hD hy + exact ⟨φ x, hy, by change φ (g (φ x)) = φ x; rw [hl hx]⟩ + · rintro ⟨y', hy', rfl⟩ + obtain ⟨x, hx, rfl⟩ := hD hy' + change φ (g (φ x)) ∈ D + rw [hl hx] + exact hy' + +/-- Path components under a map with a continuous inverse. -/ +theorem arcComponentsIn_image_eq {X Y : Type} [TopologicalSpace X] [TopologicalSpace Y] {φ : X → Y} + {g : Y → X} {A : Set X} (hφ : ContinuousOn φ A) (hg : ContinuousOn g (φ '' A)) + (hl : LeftInvOn g φ A) : arcComponentsIn (φ '' A) = image φ '' arcComponentsIn A := by + ext C + constructor + · intro hC + have hgA : g '' (φ '' A) = A := by + rw [image_image] + exact (image_congr fun x hx => hl hx).trans (image_id' A) + have hr : LeftInvOn φ g (φ '' A) := by + rintro _ ⟨x, hx, rfl⟩ + rw [hl hx] + have h1 := image_mem_arcComponentsIn hg (by rwa [hgA]) hr hC + rw [hgA] at h1 + refine ⟨g '' C, h1, ?_⟩ + rw [image_image] + exact (image_congr fun y hy => hr (hC.2.1 hy)).trans (image_id' C) + · rintro ⟨e, he, rfl⟩ + exact image_mem_arcComponentsIn hφ hg hl he + +/-- Two different edges do not meet, and they meet in closure at their common ends only. -/ +theorem closure_inter_subset (D : Drawing S) {e f : Set S} (he : e ∈ D.E) (hf : f ∈ D.E) + (hne : e ≠ f) {x : S} (h1 : x ∈ closure e) (h2 : x ∈ closure f) : x ∈ tilde e ∧ x ∈ tilde f + := by + have hV : x ∈ D.V := by + by_contra hV + have hxe : x ∈ e := by rw [← D.closure_diff_V he]; exact ⟨h1, hV⟩ + have hxf : x ∈ f := by rw [← D.closure_diff_V hf]; exact ⟨h2, hV⟩ + exact hne (arcComp_eq_of_mem he hf hxe hxf) + rw [tilde_eq_inter_V D he, tilde_eq_inter_V D hf] + exact ⟨⟨h1, hV⟩, h2, hV⟩ + +private theorem image_drawing_without_edge + {S : Type} + [TopologicalSpace S] + {D : Drawing S} + {f : Set S} + (w : S) + (φ : S → S) + (hLw : ∀ x ∈ (closure f), φ x = w) + (hLV' : ∀ x ∈ (closure f), x ∉ D.V → x ∈ f) + (hwV : w ∈ φ '' D.V) + (hsame : ∀ (x y : S), φ x = φ y → x = y ∨ x ∈ (closure f) ∧ y ∈ (closure f)) + (D₀ : Surface.Drawing S) + (hD₀U : D₀.U = D.U \ f) + (hD₀V : D₀.V = D.V) : + φ '' D.U \ φ '' D.V = φ '' (D₀.U \ D₀.V) := by + rw [hD₀U, hD₀V] + ext x + constructor + · rintro ⟨⟨y, hy, rfl⟩, h⟩ + have hyV : y ∉ D.V := fun h1 => h ⟨y, h1, rfl⟩ + refine ⟨y, ⟨⟨hy, fun hyf => ?_⟩, hyV⟩, rfl⟩ + exact h (by rw [hLw y (subset_closure hyf)]; exact hwV) + · rintro ⟨y, ⟨⟨h1, h2⟩, h3⟩, rfl⟩ + refine ⟨⟨y, h1, rfl⟩, ?_⟩ + rintro ⟨z, hz, he⟩ + rcases hsame z y he with rfl | ⟨-, hy⟩ + · exact h3 hz + · exact h2 (by simpa using (hLV' y hy h3)) + +private theorem continuous_inverse_off_edge + {S : Type} + [TopologicalSpace S] + {f : Set S} + (w : S) + (φ : S → S) + (hφcl : IsClosedMap φ) + (hLw : ∀ x ∈ (closure f), φ x = w) + (hLn : ∀ x ∉ (closure f), φ x ≠ w) + (hLi : InjOn φ (closure f)ᶜ) + (g : S → S) + (hgl : LeftInvOn g φ (closure f)ᶜ) : + ContinuousOn g (φ '' (closure f)ᶜ) := by + rw [continuousOn_iff_isClosed] + intro C hC + refine ⟨φ '' (C ∪ (closure f)), hφcl _ (hC.union isClosed_closure), ?_⟩ + ext y + constructor + · rintro ⟨hy, hyL⟩ + refine ⟨⟨g y, .inl hy, ?_⟩, hyL⟩ + obtain ⟨x, hx, rfl⟩ := hyL + rw [hgl hx] + · rintro ⟨⟨x, hx, rfl⟩, ⟨z, hz, he⟩⟩ + rcases hx with hx | hx + · refine ⟨?_, ⟨z, hz, he⟩⟩ + by_cases hxL : x ∈ (closure f) + · exact absurd (he.trans (hLw x hxL)) (hLn z hz) + · have : z = x := hLi hz hxL he + subst this + change g (φ z) ∈ C + rw [hgl hz] + exact hx + · exact absurd (he.trans (hLw x hx)) (hLn z hz) + +private theorem contracted_edge_has_distinct_ends + {S : Type} + [TopologicalSpace S] + {D : Drawing S} + (hD : LoopFree D) + {f : Set S} + (hf : f ∈ Drawing.E D) + (hno : ∀ e ∈ Drawing.E D, e ≠ f → tilde e ≠ tilde f) + [T2Space S] + (u : S) + (v : S) + (huv : u ≠ v) + (hfe : tilde f = {u, v}) + (a : 𝕀 → S) + (ha0 : a 0 = u) + (ha1 : a 1 = v) + (φ : S → S) + (hφc : Continuous φ) + (hφcl : IsClosedMap φ) + (hline : IsLineWithEnds (closure f) u v) + (htV : ∀ x ∈ tilde f, x ∈ (closure f) ∧ x ∈ D.V) + (huT : u ∈ tilde f) + (hvT : v ∈ tilde f) + (hsame : ∀ (x y : S), φ x = φ y → x = y ∨ x ∈ (closure f) ∧ y ∈ (closure f)) : + ∀ e ∈ Drawing.E D \ {f}, ∃ p q, φ p ≠ φ q ∧ tilde e = {p, q} ∧ InjOn φ (closure e) ∧ closure + (φ '' e) = φ '' closure e ∧ IsLineWithEnds (closure (φ '' e)) (φ p) (φ q) ∧ closure (φ '' e) + ∩ φ '' D.V = {φ p, φ q} := by + rintro e ⟨he, hne⟩ + obtain ⟨p, q, hpq, hte, hl⟩ := hD e he + have hclos : ∀ x ∈ closure e, x ∈ (closure f) → x ∈ tilde e ∧ x ∈ tilde f := fun x h1 h2 => + closure_inter_subset D he hf hne h1 h2 + have hinj : InjOn φ (closure e) := by + intro x hx y hy hxy + rcases hsame x y hxy with h | ⟨h1, h2⟩ + · exact h + · by_contra hne' + apply hno e he hne + have h3 := hclos x hx h1 + have h4 := hclos y hy h2 + have h5 : tilde e = {x, y} := by + rw [hte] at h3 h4 ⊢ + rcases h3.1 with rfl | rfl <;> rcases h4.1 with rfl | rfl + · exact absurd rfl hne' + · rfl + · exact pair_comm _ _ + · exact absurd rfl hne' + have h6 : tilde f = {x, y} := by + have h3' := h3.2 + have h4' := h4.2 + rw [hfe] at h3' h4' ⊢ + rcases h3' with rfl | rfl <;> rcases h4' with rfl | rfl + · exact absurd rfl hne' + · rfl + · exact pair_comm _ _ + · exact absurd rfl hne' + rw [h5, h6] + have hpT : p ∈ closure e := by + have : p ∈ tilde e := by rw [hte]; exact .inl rfl + exact this.1 + have hqT : q ∈ closure e := by + have : q ∈ tilde e := by rw [hte]; exact .inr rfl + exact this.1 + have hpq' : φ p ≠ φ q := fun h => hpq (hinj hpT hqT h) + have hcl : closure (φ '' e) = φ '' closure e := + Subset.antisymm (hφcl.closure_image_subset _) (image_closure_subset_closure_image hφc) + obtain ⟨b, hb, hbr, hb0, hb1⟩ := hl.exists_arc + have hbarc : IsArcMap (φ ∘ b) := ⟨hφc.comp hb.1, fun s t h => hb.2 (hinj + (hbr ▸ mem_range_self s) (hbr ▸ mem_range_self t) h)⟩ + have hlin := hbarc.isLineWithEnds + rw [range_comp, hbr, Function.comp_apply, Function.comp_apply, hb0, hb1, ← hcl] at hlin + refine ⟨p, q, hpq', hte, hinj, hcl, hlin, ?_⟩ + rw [hcl] + ext x + constructor + · rintro ⟨⟨y, hy, rfl⟩, ⟨z, hz, he'⟩⟩ + have hyV : y ∈ D.V := by + rcases hsame z y he' with rfl | ⟨-, hyL⟩ + · exact hz + · by_contra hyV + have h1 : y ∈ e := by rw [← D.closure_diff_V he]; exact ⟨hy, hyV⟩ + exact hyV (htV y (hclos y hy hyL).2).2 + have hyT : y ∈ tilde e := by + rw [tilde_eq_inter_V D he] + exact ⟨hy, hyV⟩ + rw [hte] at hyT + rcases hyT with rfl | rfl + · exact .inl rfl + · exact .inr rfl + · have hV : ∀ x ∈ tilde e, x ∈ D.V := fun x hx => by + rw [tilde_eq_inter_V D he] at hx + exact hx.2 + rintro (rfl | rfl) + · exact ⟨⟨p, hpT, rfl⟩, ⟨p, hV p (by rw [hte]; exact .inl rfl), rfl⟩⟩ + · exact ⟨⟨q, hqT, rfl⟩, ⟨q, hV q (by rw [hte]; exact .inr rfl), rfl⟩⟩ + +private theorem normal_set_image_under_contraction + {S : Type} + [TopologicalSpace S] + {D : Drawing S} + (φ : S → S) + (L : Set S) + (hsame : ∀ (x y : S), φ x = φ y → x = y ∨ x ∈ L ∧ y ∈ L) + (D' : Drawing S) + (hU : D'.U = φ '' D.U) + (hV : D'.V = φ '' D.V) + (F : Set S) + (hFn : D.IsNormal F) + (hFL : ∀ x ∈ F, x ∈ L → x ∈ D.V) : + ∀ B ⊆ F, D'.IsNormal (φ '' B) ∧ (φ '' B ∩ D'.V).ncard ≤ (F ∩ D.V).ncard := by + intro B hB + have hnormal : φ '' B ∩ (φ '' D.U) ⊆ φ '' D.V := by + rintro _ ⟨⟨b, hb, rfl⟩, ⟨y, hy, he⟩⟩ + rcases hsame y b he with rfl | ⟨-, h2⟩ + · exact ⟨y, hFn ⟨hB hb, hy⟩, rfl⟩ + · exact ⟨b, hFL b (hB hb) h2, rfl⟩ + refine ⟨by simpa only [Drawing.IsNormal, hU, hV] using hnormal, ?_⟩ + rw [hV] + have h1 : φ '' B ∩ φ '' D.V ⊆ φ '' (F ∩ D.V) := by + rintro _ ⟨⟨b, hb, rfl⟩, ⟨y, hy, he⟩⟩ + rcases hsame y b he with rfl | ⟨-, h2⟩ + · exact ⟨y, ⟨hB hb, hy⟩, rfl⟩ + · exact ⟨b, ⟨hB hb, hFL b (hB hb) h2⟩, rfl⟩ + have hfin' : (F ∩ D.V).Finite := D.finite_V.subset inter_subset_right + exact (ncard_le_ncard h1 (hfin'.image _)).trans (ncard_image_le hfin') + +private theorem arc_collapses_to_injective_loop + {S : Type} + [TopologicalSpace S] + {D : Drawing S} + {f : Set S} + (u : S) + (v : S) + (hfe : tilde f = {u, v}) + (w : S) + (c : C(𝕀 × S, S)) + (L : Set S) + (hLV : ∀ x ∈ L, x ∈ D.V → x ∈ tilde f) + (hsame : ∀ (x y : S), c (1, x) = c (1, y) → x = y ∨ x ∈ L ∧ y ∈ L) + (F : Set S) + (hFL : ∀ x ∈ F, x ∈ L → x ∈ D.V) + (hu' : c (1, u) = w) + (hv' : c (1, v) = w) : + ∀ (x : 𝕀 → S), IsArcMap x → x 0 = u → x 1 = v → range x ⊆ F → + ∃ γ : C(Circle, S), (∀ t : 𝕀, γ (arcParam 1 t) = c (1, x t)) ∧ + range γ = (fun x => c (1, x)) '' range x ∧ Function.Injective γ := by + let φ := fun x => c (1, x) + intro x hx hx0 hx1 hxF + let ℓ : C(𝕀, S) := ⟨fun t => c (1, x t), by have := hx.1; fun_prop⟩ + have hℓ : ℓ 0 = ℓ 1 := by + change c (1, x 0) = c (1, x 1) + rw [hx0, hx1, hu', hv'] + let γ := loopLift 1 ℓ hℓ + have hγ : ∀ t, γ (arcParam 1 t) = c (1, x t) := fun t => loopLift_apply 1 ℓ hℓ t + refine ⟨γ, hγ, ?_, ?_⟩ + · ext y + constructor + · rintro ⟨z, rfl⟩ + obtain ⟨t, rfl⟩ := arcParam_surjective 1 z + exact ⟨x t, ⟨t, rfl⟩, (hγ t).symm⟩ + · rintro ⟨_, ⟨t, rfl⟩, rfl⟩ + exact ⟨arcParam 1 t, hγ t⟩ + · intro z z' he + obtain ⟨s, rfl⟩ := arcParam_surjective 1 z + obtain ⟨t, rfl⟩ := arcParam_surjective 1 z' + rw [hγ, hγ] at he + have hends : ∀ r, x r ∈ L → r = 0 ∨ r = 1 := fun r hr => by + have h2 := hLV _ hr (hFL _ (hxF ⟨r, rfl⟩) hr) + rw [hfe] at h2 + rcases h2 with h2 | h2 + · exact .inl (hx.2 (h2.trans hx0.symm)) + · exact .inr (hx.2 (h2.trans hx1.symm)) + rcases hsame _ _ he with h2 | ⟨h2, h3⟩ + · rw [hx.2 h2] + · have h4 : arcParam 1 (0 : 𝕀) = arcParam 1 (1 : 𝕀) := by + simp [arcParam_zero, arcParam_one] + rcases hends s h2 with rfl | rfl <;> rcases hends t h3 with rfl | rfl + · rfl + · exact h4 + · exact h4.symm + · rfl + +/-- **Contracting an edge.** Let `f` be an edge of a loop-free drawing in a closed surface, with no +parallel edge. Then there are a loop-free drawing `D'` with `rep(D') ≤ rep(D)` and a map `φ` that +identifies the ends of `f` and no other two vertices, and that maps the other edges of `D` onto the +edges of `D'`, preserving incidence. -/ +theorem exists_contract (hT : IsClosedSurface S) {D : Drawing S} (hD : LoopFree D) {f : Set S} + (hf : f ∈ D.E) (hno : ∀ e ∈ D.E, e ≠ f → tilde e ≠ tilde f) : + ∃ (D' : Drawing S) (φ : S → S), LoopFree D' ∧ D'.V = φ '' D.V ∧ + (∀ x ∈ D.V, ∀ y ∈ D.V, φ x = φ y ↔ x = y ∨ (x ∈ tilde f ∧ y ∈ tilde f)) ∧ + BijOn (image φ) (D.E \ {f}) D'.E ∧ (∀ e ∈ D.E, e ≠ f → tilde (φ '' e) = φ '' tilde e) ∧ + D'.rep ≤ D.rep := by + classical + have hcpt : CompactSpace S := hT.1 + have ht2 : T2Space S := hT.2.1 + obtain ⟨u, v, huv, hfe, hline⟩ := hD f hf + obtain ⟨a, ha, har, ha0, ha1⟩ := hline.exists_arc + obtain ⟨c', w, hcc, hc0, hcL, hcn, hci, hcs⟩ := exists_collapse hT ha + rw [har] at hcL hcn hci + let c : C(𝕀 × S, S) := ⟨c', hcc⟩ + let φ : S → S := fun x => c (1, x) + have hφc : Continuous φ := by fun_prop + have hφcl : IsClosedMap φ := hφc.isClosedMap + set L := closure f with hL + have hne : Nonempty S := ⟨u⟩ + have hLw : ∀ x ∈ L, φ x = w := hcL + have hLn : ∀ x, x ∉ L → φ x ≠ w := hcn + have hLi : InjOn φ Lᶜ := hci + have hLV : ∀ x ∈ L, x ∈ D.V → x ∈ tilde f := fun x h1 h2 => by + rw [tilde_eq_inter_V D hf] + exact ⟨h1, h2⟩ + have hLV' : ∀ x ∈ L, x ∉ D.V → x ∈ f := fun x h1 h2 => by + rw [← D.closure_diff_V hf] + exact ⟨h1, h2⟩ + have htV : ∀ x ∈ tilde f, x ∈ L ∧ x ∈ D.V := fun x hx => by + rwa [tilde_eq_inter_V D hf] at hx + have huT : u ∈ tilde f := by rw [hfe]; exact .inl rfl + have hvT : v ∈ tilde f := by rw [hfe]; exact .inr rfl + have hwV : w ∈ φ '' D.V := ⟨u, (htV u huT).2, hLw u (htV u huT).1⟩ + have hsame : ∀ x y, φ x = φ y → x = y ∨ (x ∈ L ∧ y ∈ L) := fun x y h => by + by_cases hx : x ∈ L + · have hy : y ∈ L := by + by_contra hy + exact hLn y hy (h ▸ hLw x hx) + exact .inr ⟨hx, hy⟩ + · have hy : y ∉ L := fun hy => hLn x hx (h.trans (hLw y hy)) + exact .inl (hLi hx hy h) + let D₀ := D.deleteEdge f + have hD₀U : D₀.U = D.U \ f := deleteEdge_U D hf + have hD₀V : D₀.V = D.V := Subset.antisymm (deleteEdge_isSubdrawing D f).1 fun x hx + => .inl ⟨hx, hx⟩ + have hD₀E : arcComponentsIn (D₀.U \ D₀.V) = D.E \ {f} := deleteEdge_E D f + have hAL : D₀.U \ D₀.V ⊆ Lᶜ := by + rintro x ⟨h1, h2⟩ h3 + rw [hD₀U] at h1 + rw [hD₀V] at h2 + exact h1.2 (hLV' x h3 h2) + have himg : (φ '' D.U) \ (φ '' D.V) = φ '' (D₀.U \ D₀.V) := by + exact image_drawing_without_edge (S := S) (D := D) (f := f) w φ hLw hLV' hwV hsame D₀ hD₀U + hD₀V + let g : S → S := Function.invFunOn φ Lᶜ + have hgl : LeftInvOn g φ Lᶜ := hLi.leftInvOn_invFunOn + have hgc : ContinuousOn g (φ '' Lᶜ) := by + exact continuous_inverse_off_edge (S := S) (f := f) w φ hφcl hLw hLn hLi g hgl + have hcomp : arcComponentsIn (φ '' (D₀.U \ D₀.V)) = image φ '' (D.E \ {f}) := by + rw [arcComponentsIn_image_eq hφc.continuousOn (hgc.mono (image_mono hAL)) (hgl.mono hAL), hD₀E] + have hfin : (arcComponentsIn ((φ '' D.U) \ (φ '' D.V))).Finite := by + rw [himg, hcomp] + exact (D.finite_edges.subset sdiff_subset).image _ + -- facts on one other edge + have hedge : ∀ e ∈ D.E \ {f}, ∃ p q : S, φ p ≠ φ q ∧ tilde e = {p, q} ∧ InjOn φ (closure e) ∧ + closure (φ '' e) = φ '' closure e ∧ IsLineWithEnds (closure (φ '' e)) (φ p) (φ q) ∧ + closure (φ '' e) ∩ φ '' D.V = {φ p, φ q} := by + exact contracted_edge_has_distinct_ends (S := S) (D := D) hD (f := f) hf hno u v huv hfe a ha0 + ha1 φ hφc hφcl hline htV huT hvT hsame + let D' : Drawing S := + { U := φ '' D.U + V := φ '' D.V + V_subset_U := image_mono D.V_subset_U + isClosed_U := hφcl _ D.isClosed_U + finite_V := D.finite_V.image _ + finite_edges := hfin + edge_cond := by + intro e he + rw [himg, hcomp] at he + obtain ⟨e₀, he₀, rfl⟩ := he + obtain ⟨p, q, h1, -, -, -, h2, h3⟩ := hedge e₀ he₀ + exact .inl ⟨φ p, φ q, h1, h3, h2⟩ } + have hE' : D'.E = image φ '' (D.E \ {f}) := by + change arcComponentsIn ((φ '' D.U) \ (φ '' D.V)) = _ + rw [himg, hcomp] + have htilde : ∀ e₀ ∈ D.E \ {f}, tilde (φ '' e₀) = φ '' tilde e₀ := by + intro e₀ he₀ + obtain ⟨p, q, h1, h2, -, -, -, h3⟩ := hedge e₀ he₀ + have h4 : φ '' e₀ ∈ D'.E := by + rw [hE'] + exact ⟨e₀, he₀, rfl⟩ + rw [tilde_eq_inter_V D' h4] + change closure (φ '' e₀) ∩ φ '' D.V = _ + rw [h3, h2, image_pair] + refine ⟨D', φ, ?_, rfl, ?_, ?_, fun e he hne => htilde e ⟨he, hne⟩, ?_⟩ + · intro e he + rw [hE'] at he + obtain ⟨e₀, he₀, rfl⟩ := he + obtain ⟨p, q, h1, h2, -, -, h3, h4⟩ := hedge e₀ he₀ + refine ⟨φ p, φ q, h1, ?_, h3⟩ + rw [htilde e₀ he₀, h2, image_pair] + · intro x hx y hy + constructor + · intro h + rcases hsame x y h with h1 | ⟨h1, h2⟩ + · exact .inl h1 + · exact .inr ⟨hLV x h1 hx, hLV y h2 hy⟩ + · rintro (rfl | ⟨h1, h2⟩) + · rfl + · rw [hLw x (htV x h1).1, hLw y (htV y h2).1] + · refine ⟨fun e he => ?_, ?_, ?_⟩ + · rw [hE'] + exact ⟨e, he, rfl⟩ + · intro e₁ he₁ e₂ he₂ h + have hsubL : ∀ e ∈ D.E \ {f}, e ⊆ Lᶜ := fun e he => by + rw [← hD₀E] at he + exact he.2.1.trans hAL + have h1 : g '' (φ '' e₁) = e₁ := by + rw [image_image] + exact (image_congr fun x hx => hgl (hsubL e₁ he₁ hx)).trans (image_id' e₁) + have h2 : g '' (φ '' e₂) = e₂ := by + rw [image_image] + exact (image_congr fun x hx => hgl (hsubL e₂ he₂ hx)).trans (image_id' e₂) + change φ '' e₁ = φ '' e₂ at h + rw [← h1, ← h2, h] + · rw [hE'] + exact Subset.rfl + · refine le_sInf ?_ + rintro _ ⟨F, hFo, hFn, hFnull, rfl⟩ + have hFL : ∀ x ∈ F, x ∈ L → x ∈ D.V := fun x hxF hxL => by + by_contra hV + exact hV (hFn ⟨hxF, D.closure_subset_U hf hxL⟩) + -- normality and the count for a subset of `F` + have hsub : ∀ B ⊆ F, D'.IsNormal (φ '' B) ∧ (φ '' B ∩ D'.V).ncard ≤ (F ∩ D.V).ncard := by + exact normal_set_image_under_contraction (S := S) (D := D) φ L hsame D' rfl rfl F hFn hFL + have finish : ∀ B ⊆ F, IsOArc (φ '' B) → ¬ IsNullHomotopicOArc (φ '' B) → + D'.rep ≤ (((F ∩ D.V).ncard : ℕ) : ℕ∞) := fun B hB h1 h2 => + (rep_le_of_arc D' h1 (hsub B hB).1 h2).trans (by exact_mod_cast (hsub B hB).2) + by_cases hboth : u ∈ F ∧ v ∈ F + · obtain ⟨a', b', hab, h0, h1, hunion⟩ := hFo.exists_arcs hboth.1 hboth.2 huv + have hb0 : b' 0 = u := by rw [hab.zero, h0] + have hb1 : b' 1 = v := by rw [hab.one, h1] + have hu' : c (1, u) = w := hLw u (htV u huT).1 + have hv' : c (1, v) = w := hLw v (htV v hvT).1 + -- the loop of an arc + have hloop : ∀ x : 𝕀 → S, IsArcMap x → x 0 = u → x 1 = v → range x ⊆ F → + ∃ γ : C(Circle, S), (∀ t, γ (arcParam 1 t) = c (1, x t)) ∧ range γ = φ '' range x ∧ + Function.Injective γ := by + exact arc_collapses_to_injective_loop (S := S) (D := D) (f := f) u v hfe w c L hLV + hsame F hFL hu' hv' + obtain ⟨γa, hγa, hra, hia⟩ := hloop a' hab.arc_left h0 h1 (hunion ▸ subset_union_left) + obtain ⟨γb, hγb, hrb, hib⟩ := hloop b' hab.arc_right hb0 hb1 (hunion ▸ subset_union_right) + have hnot : ¬ IsNullHomotopicOArc (range a' ∪ range b') := by rwa [hunion] + rcases not_null_of_two_arcs c hc0 hab (w := w) (h0 ▸ hu') (h1 ▸ hv') hnot hγa hγb with h | h + · refine finish (range a') (hunion ▸ subset_union_left) ?_ fun hn => ?_ + · rw [← hra] + exact isOArc_range hia + · exact h (null_of_param hn γa hra) + · refine finish (range b') (hunion ▸ subset_union_right) ?_ fun hn => ?_ + · rw [← hrb] + exact isOArc_range hib + · exact h (null_of_param hn γb hrb) + · have hinjF : InjOn φ F := by + intro x hx y hy hxy + rcases hsame x y hxy with h | ⟨h1, h2⟩ + · exact h + · have hx' := hLV x h1 (hFL x hx h1) + have hy' := hLV y h2 (hFL y hy h2) + rw [hfe] at hx' hy' + by_contra hne + apply hboth + rcases hx' with rfl | rfl <;> rcases hy' with rfl | rfl + · exact absurd rfl hne + · exact ⟨hx, hy⟩ + · exact ⟨hy, hx⟩ + · exact absurd rfl hne + obtain ⟨ξ⟩ := hFo + let γ : C(Circle, S) := ⟨fun z => (ξ z).1, by fun_prop⟩ + let γ' : C(Circle, S) := ⟨fun z => c (1, γ z), by fun_prop⟩ + have hγr : range γ = F := by + ext x + constructor + · rintro ⟨z, rfl⟩ + exact (ξ z).2 + · intro hx + exact ⟨ξ.symm ⟨x, hx⟩, by simp [γ]⟩ + have hγ'r : range γ' = φ '' F := by + rw [← hγr, ← range_comp] + rfl + have hγ'i : Function.Injective γ' := by + intro z z' h + exact ξ.injective (Subtype.ext (hinjF (ξ z).2 (ξ z').2 h)) + refine finish F Subset.rfl ?_ fun hn => ?_ + · rw [← hγ'r] + exact isOArc_range hγ'i + · have h1 := null_of_param hn γ' hγ'r + have h2 := null_of_collapse c hc0 (ψ := γ) (ψ' := γ') (fun _ => rfl) h1 + exact hFnull ⟨ξ, h2⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Cover.lean b/LeanPool/GraphMinor/GM19/Section6Cover.lean new file mode 100644 index 0000000000..59c8e3a184 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Cover.lean @@ -0,0 +1,275 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Enl +public import LeanPool.GraphMinor.GM19.FrameMove + +/-! +# Graph Minors XIX, proof of (6.2): the cover of a cuff + +The last step of the proof of (6.2), page 343. Let `σ'` be an inflation of `Γ₁` in `Γ₂` such that +each +`σ'(v)` meets a cuff `Θ` in a connected part. The paper sees the circuit `C₂` +on `Θ` as the paths `P₁, …, P_t` joined by the edges `σ'(e₁), …, σ'(e_t)`. Hence an edge of `Γ₂` on +`Θ` is +either some `σ'(e_i)`, or has both ends in one `σ'(v)`. + +We prove this in `cuff_cover`, in this form. A set `σ'(v)` with `v` on `Θ` is left by two edges +`σ'(e)`, +for the two edges `e` of `Γ₁` at `v` on `Θ`, and it is not left by a third, by the connectedness. So +the +vertices of `Θ` in sets `σ'(v)` with `v` on `Θ` are closed under following edges of `Θ`, and they +are all of +the vertices of `Γ₂` on `Θ`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +local notation "𝕀" => unitInterval + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +theorem sub_cuff {Θ C : Set S} (hΘ : Θ ∈ cuffs S) (hC : IsPreconnected C) (hb : C ⊆ bd S) + (hm : (C ∩ Θ).Nonempty) : C ⊆ Θ := by + obtain ⟨x, hxC, hxΘ⟩ := hm + obtain ⟨z, -, rfl⟩ := hΘ + rw [connectedComponentIn_eq hxΘ] + exact hC.subset_connectedComponentIn hxC hb + +omit [T2Space S] in +theorem cuff_sub_bd {Θ : Set S} (hΘ : Θ ∈ cuffs S) : Θ ⊆ bd S := by + obtain ⟨z, -, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + +omit [T2Space S] in +theorem edge_preconnected (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) : IsPreconnected e := + he.2.2.1.isConnected.isPreconnected + +omit [T2Space S] in +/-- An edge meeting a cuff is a border edge inside the cuff. -/ +theorem edge_sub_cuff (Γ : Painting S) {Θ e : Set S} (hΘ : Θ ∈ cuffs S) (he : e ∈ Γ.E) + (hm : (e ∩ Θ).Nonempty) : e ⊆ Θ ∧ (tilde e).ncard = 2 := by + obtain ⟨x, hxe, hxΘ⟩ := hm + obtain ⟨h2, hb⟩ := Γ.border_edge e he ⟨x, hxe, cuff_sub_bd hΘ hxΘ⟩ + exact ⟨sub_cuff hΘ (edge_preconnected Γ he) hb ⟨x, hxe, hxΘ⟩, h2⟩ + +omit [T2Space S] in +/-- Along a line from the vertex `v` to another vertex, the first part is in an edge at `v`. -/ +theorem exists_first_edge (Γ : Painting S) {Θ L : Set S} (hΘ : Θ ∈ cuffs S) (hLΘ : L ⊆ Θ) {v w : S} + (hL : IsLineWithEnds L v w) (_hvw : v ≠ w) (hv : v ∈ Γ.V) (hw : w ∈ Γ.V) : + ∃ e ∈ Γ.E, e ⊆ Θ ∧ v ∈ tilde e ∧ (e ∩ L).Nonempty := by + obtain ⟨φ, hφ, hr, h0, h1⟩ := exists_line_emb hL + have hT : (φ ⁻¹' Γ.V \ {0}).Finite := (Γ.finite_V.preimage hφ.injective.injOn).subset sdiff_subset + have h10 : (1 : 𝕀) ≠ 0 := one_ne_zero + have hone : (1 : 𝕀) ∈ φ ⁻¹' Γ.V \ {0} := ⟨show φ 1 ∈ Γ.V by rw [h1]; exact hw, h10⟩ + obtain ⟨t₀, ht₀, hmin⟩ := Set.exists_min_image _ id hT ⟨1, hone⟩ + have hpos : (0 : ℝ) < t₀ := lt_of_le_of_ne t₀.2.1 fun h => ht₀.2 (Subtype.ext h.symm) + let ψ : ℝ → S := fun x => φ (projIcc 0 1 zero_le_one x) + have hψ : Continuous ψ := hφ.continuous.comp continuous_projIcc + have hval : ∀ {x : ℝ} (hx : x ∈ Ioo (0 : ℝ) t₀), ψ x = φ ⟨x, hx.1.le, hx.2.le.trans t₀.2.2⟩ := + fun {x} hx => congrArg φ (projIcc_of_mem _ ⟨hx.1.le, hx.2.le.trans t₀.2.2⟩) + have hpc : IsPathConnected (ψ '' Ioo (0 : ℝ) t₀) := + ((convex_Ioo _ _).isPathConnected (nonempty_Ioo.mpr hpos)).image hψ + have hinΘ : ψ '' Ioo (0 : ℝ) t₀ ⊆ Θ := by + rintro _ ⟨x, -, rfl⟩ + exact hLΘ (hr ▸ mem_range_self _) + have hsub : ψ '' Ioo (0 : ℝ) t₀ ⊆ Γ.U \ Γ.V := by + rintro _ ⟨x, hx, rfl⟩ + refine ⟨Γ.bd_subset (cuff_sub_bd hΘ (hinΘ ⟨x, hx, rfl⟩)), fun hV => ?_⟩ + rw [hval hx] at hV + have hmem : (⟨x, hx.1.le, hx.2.le.trans t₀.2.2⟩ : 𝕀) ∈ φ ⁻¹' Γ.V \ {0} := + ⟨hV, fun h => hx.1.ne' (congrArg Subtype.val h)⟩ + exact absurd (hmin _ hmem) (not_le.mpr hx.2) + obtain ⟨e, he, hsupe⟩ := exists_arcComp_superset hpc hsub + obtain ⟨y, hy⟩ := nonempty_Ioo.mpr hpos + have hye : ψ y ∈ e := hsupe ⟨y, hy, rfl⟩ + have hyL : ψ y ∈ L := hr ▸ mem_range_self _ + have hyΘ : ψ y ∈ Θ := hLΘ hyL + refine ⟨e, he, (edge_sub_cuff Γ hΘ he ⟨_, hye, hyΘ⟩).1, ⟨?_, fun h => Γ.disjoint_V he h hv⟩, _, + hye, hyL⟩ + have hcl : (0 : ℝ) ∈ closure (Ioo (0 : ℝ) t₀) := by + rw [closure_Ioo hpos.ne] + exact ⟨le_rfl, hpos.le⟩ + have h2 := image_closure_subset_closure_image hψ (mem_image_of_mem ψ hcl) + have h3 : ψ 0 = v := by + change φ (projIcc 0 1 zero_le_one 0) = v + rw [projIcc_left] + exact h0 + rw [h3] at h2 + exact closure_mono hsupe h2 + +/-- A vertex on a cuff is an end of two edges on the cuff. -/ +theorem two_edges_at (hS : IsSurface S) (Γ : Painting S) {Θ : Set S} (hΘ : Θ ∈ cuffs S) {v : S} + (hv : v ∈ Γ.V) (hvΘ : v ∈ Θ) : + ∃ e₁ ∈ Γ.E, ∃ e₂ ∈ Γ.E, e₁ ≠ e₂ ∧ e₁ ⊆ Θ ∧ e₂ ⊆ Θ ∧ v ∈ tilde e₁ ∧ v ∈ tilde e₂ := by + have hO : IsOArc Θ := (cuff_statement S hS).2.2 Θ hΘ + have hcΘ : IsClosed Θ := hO.isCompact.isClosed + obtain ⟨f⟩ := id hO + obtain ⟨e, he, heΘ, -⟩ := exists_edge_on_cuff Γ ⟨Θ, hΘ⟩ f + obtain ⟨x, hxe⟩ := he.2.2.1.nonempty + have h2 := (edge_sub_cuff Γ hΘ he ⟨x, hxe, heΘ hxe⟩).2 + obtain ⟨w, hwt, hwv⟩ := exists_ne_of_one_lt_ncard (show 1 < (tilde e).ncard by omega) v + have hwΘ : w ∈ Θ := closure_minimal heΘ hcΘ hwt.1 + have hwV : w ∈ Γ.V := Γ.tilde_subset_V he hwt + obtain ⟨A₁, A₂, h₁, h₂, hU, hI⟩ := hO.lines hvΘ hwΘ hwv.symm + have hA₁ : A₁ ⊆ Θ := hU ▸ subset_union_left + have hA₂ : A₂ ⊆ Θ := hU ▸ subset_union_right + obtain ⟨e₁, he₁, hs₁, ht₁, hm₁⟩ := exists_first_edge Γ hΘ hA₁ h₁ hwv.symm hv hwV + obtain ⟨e₂, he₂, hs₂, ht₂, hm₂⟩ := exists_first_edge Γ hΘ hA₂ h₂ hwv.symm hv hwV + refine ⟨e₁, he₁, e₂, he₂, ?_, hs₁, hs₂, ht₁, ht₂⟩ + rintro rfl + obtain ⟨y, hye, hy⟩ := (isPreconnected_closed_iff.mp (edge_preconnected Γ he₁)) A₁ A₂ + (isClosed_of_cuffLine h₁) (isClosed_of_cuffLine h₂) (hU ▸ hs₁) hm₁ hm₂ + rw [hI] at hy + rcases hy with rfl | rfl + · exact Γ.disjoint_V he₁ hye hv + · exact Γ.disjoint_V he₁ hye hwV + +/-- One end of `f` is in `Y` and another is not. -/ +def Mixed (Y f : Set S) : Prop := (tilde f ∩ Y).Nonempty ∧ ¬ tilde f ⊆ Y + +variable {Γ₁ Γ₂ : Painting S} {ℓ : S → Set S} {σe : Set S → Set S} + +omit [T2Space S] in +theorem mixed_image (h : IsInflation Γ₁ Γ₂ ℓ σe) {e : Set S} (he : e ∈ Γ₁.E) (h2 : (tilde e).ncard + = 2) + {v : S} (hv : v ∈ Γ₁.V) (hvt : v ∈ tilde e) : Mixed (ℓ v) (σe e) := by + obtain ⟨-, hends⟩ := infl_ends h he + obtain ⟨a, hat, ha⟩ := hends v hvt + obtain ⟨y, hyt, hyv⟩ := exists_ne_of_one_lt_ncard (show 1 < (tilde e).ncard by omega) v + obtain ⟨b, hbt, hb⟩ := hends y hyt + refine ⟨⟨a, hat, ha⟩, fun hsub => ?_⟩ + exact disjoint_left.mp (h.vertex_disjoint y (Γ₁.tilde_subset_V he hyt) v hv hyv) hb (hsub hbt) + +/-- **The cover of a cuff** (Graph Minors XIX, proof of (6.2), page 343). -/ +theorem cuff_cover (hS : IsSurface S) (h : IsInflation Γ₁ Γ₂ ℓ σe) + (hthree : ∀ Θ ∈ cuffs S, ∀ v ∈ Γ₁.V, ∀ f₁ ∈ Γ₂.E, ∀ f₂ ∈ Γ₂.E, ∀ f₃ ∈ Γ₂.E, f₁ ≠ f₂ → f₁ ≠ f₃ → + f₂ ≠ f₃ → f₁ ⊆ Θ → f₂ ⊆ Θ → f₃ ⊆ Θ → Mixed (ℓ v) f₁ → Mixed (ℓ v) f₂ → Mixed (ℓ v) f₃ → False) + (hmove : ∀ e ∈ Γ₁.E, ∀ Θ ∈ cuffs S, (e ∩ Θ).Nonempty → σe e ⊆ Θ) + {Θ f : Set S} (hΘ : Θ ∈ cuffs S) (hf : f ∈ Γ₂.E) (hfΘ : f ⊆ Θ) : + (∃ v ∈ Γ₁.V, tilde f ⊆ ℓ v) ∨ ∃ e ∈ Γ₁.E, (e ∩ Θ).Nonempty ∧ f = σe e := by + classical + have hO : IsOArc Θ := (cuff_statement S hS).2.2 Θ hΘ + have hcΘ : IsClosed Θ := hO.isCompact.isClosed + have hclo : ∀ {g : Set S}, g ⊆ Θ → closure g ⊆ Θ := fun hg => closure_minimal hg hcΘ + have hsize₂ : ∀ {g}, g ∈ Γ₂.E → g ⊆ Θ → (tilde g).ncard = 2 := fun {g} hg hgΘ => by + obtain ⟨x, hx⟩ := hg.2.2.1.nonempty + exact (edge_sub_cuff Γ₂ hΘ hg ⟨x, hx, hgΘ hx⟩).2 + have hmeet : ∀ {e : Set S}, e ∈ Γ₁.E → e ⊆ Θ → (e ∩ Θ).Nonempty := fun {e} he heΘ => by + obtain ⟨x, hx⟩ := he.2.2.1.nonempty + exact ⟨x, hx, heΘ hx⟩ + -- Only the two edges at `v` leave `σ'(v)`. + have hCY : ∀ v ∈ Γ₁.V, v ∈ Θ → ∀ g ∈ Γ₂.E, g ⊆ Θ → Mixed (ℓ v) g → + ∃ e ∈ Γ₁.E, e ⊆ Θ ∧ v ∈ tilde e ∧ g = σe e := by + intro v hv hvΘ g hg hgΘ hmix + obtain ⟨e₁, he₁, e₂, he₂, hne, hs₁, hs₂, ht₁, ht₂⟩ := two_edges_at hS Γ₁ hΘ hv hvΘ + by_cases h₁ : g = σe e₁ + · exact ⟨e₁, he₁, hs₁, ht₁, h₁⟩ + by_cases h₂ : g = σe e₂ + · exact ⟨e₂, he₂, hs₂, ht₂, h₂⟩ + have hz₁ := (edge_sub_cuff Γ₁ hΘ he₁ (hmeet he₁ hs₁)).2 + have hz₂ := (edge_sub_cuff Γ₁ hΘ he₂ (hmeet he₂ hs₂)).2 + exact (hthree Θ hΘ v hv _ (h.edge_mem _ he₁) _ (h.edge_mem _ he₂) g hg + (fun heq => hne (h.edge_injOn he₁ he₂ heq)) (Ne.symm h₁) (Ne.symm h₂) + (hmove e₁ he₁ Θ hΘ (hmeet he₁ hs₁)) (hmove e₂ he₂ Θ hΘ (hmeet he₂ hs₂)) hgΘ + (mixed_image h he₁ hz₁ hv ht₁) (mixed_image h he₂ hz₂ hv ht₂) hmix).elim + let Y : Set S := {a | a ∈ Γ₂.V ∧ a ∈ Θ ∧ ∃ v ∈ Γ₁.V, v ∈ Θ ∧ a ∈ ℓ v} + have hclosed : ∀ g ∈ Γ₂.E, g ⊆ Θ → ∀ a ∈ tilde g, a ∈ Y → ∀ b ∈ tilde g, b ∈ Y := by + rintro g hg hgΘ a hat ⟨-, -, v, hv, hvΘ, ha⟩ b hbt + have hbV := Γ₂.tilde_subset_V hg hbt + have hbΘ := hclo hgΘ hbt.1 + by_cases hb : b ∈ ℓ v + · exact ⟨hbV, hbΘ, v, hv, hvΘ, hb⟩ + obtain ⟨e, he, heΘ, -, rfl⟩ := hCY v hv hvΘ g hg hgΘ ⟨⟨a, hat, ha⟩, fun hs => hb (hs hbt)⟩ + obtain ⟨y, hyt, hby⟩ := (infl_ends h he).1 b hbt + exact ⟨hbV, hbΘ, y, Γ₁.tilde_subset_V he hyt, hclo heΘ hyt.1, hby⟩ + have hYne : Y.Nonempty := by + obtain ⟨c⟩ := id hO + obtain ⟨e, he, heΘ, -⟩ := exists_edge_on_cuff Γ₁ ⟨Θ, hΘ⟩ c + have heΘ' : e ⊆ Θ := heΘ + have h2 := (edge_sub_cuff Γ₁ hΘ he (hmeet he heΘ')).2 + obtain ⟨v, hvt⟩ : (tilde e).Nonempty := nonempty_of_ncard_ne_zero (by omega) + have hvV := Γ₁.tilde_subset_V he hvt + obtain ⟨a, hat, ha⟩ := (infl_ends h he).2 v hvt + have hE := h.edge_mem e he + exact ⟨a, Γ₂.tilde_subset_V hE hat, hclo (hmove e he Θ hΘ (hmeet he heΘ')) hat.1, v, hvV, + hclo heΘ' hvt.1, ha⟩ + have hYsub : Y ⊆ Γ₂.V := fun a ha => ha.1 + -- All vertices of `Γ₂` on `Θ` lie in `Y`, because `Θ` is connected. + have hall : ∀ a ∈ Γ₂.V, a ∈ Θ → a ∈ Y := by + intro a₀ ha₀ ha₀Θ + by_contra hnot + let P : Set S → Prop := fun g => (tilde g ∩ Y).Nonempty + have hF : {g | g ∈ Γ₂.E ∧ g ⊆ Θ}.Finite := Γ₂.finite_edges.subset fun g hg => hg.1 + let Z₁ : Set S := Y ∪ ⋃ g ∈ {g | g ∈ {g | g ∈ Γ₂.E ∧ g ⊆ Θ} ∧ P g}, closure g + let Z₂ : Set S := ((Γ₂.V ∩ Θ) \ Y) ∪ ⋃ g ∈ {g | g ∈ {g | g ∈ Γ₂.E ∧ g ⊆ Θ} ∧ ¬ P g}, closure g + have hF₁ : {g | g ∈ {g | g ∈ Γ₂.E ∧ g ⊆ Θ} ∧ P g}.Finite := + hF.subset fun _ hg => hg.1 + have hF₂ : {g | g ∈ {g | g ∈ Γ₂.E ∧ g ⊆ Θ} ∧ ¬ P g}.Finite := + hF.subset fun _ hg => hg.1 + have hV₂ : ((Γ₂.V ∩ Θ) \ Y).Finite := (Γ₂.finite_V.subset inter_subset_left).sdiff + have hc₁ : IsClosed Z₁ := (Γ₂.finite_V.subset hYsub).isClosed.union + (hF₁.isClosed_biUnion fun _ _ => isClosed_closure) + have hc₂ : IsClosed Z₂ := hV₂.isClosed.union + (hF₂.isClosed_biUnion fun _ _ => isClosed_closure) + have hcover : Θ ⊆ Z₁ ∪ Z₂ := by + intro x hxΘ + by_cases hxV : x ∈ Γ₂.V + · by_cases hxY : x ∈ Y + · exact .inl (.inl hxY) + · exact .inr (.inl ⟨⟨hxV, hxΘ⟩, hxY⟩) + · have hm : x ∈ Γ₂.U \ Γ₂.V := ⟨Γ₂.bd_subset (cuff_sub_bd hΘ hxΘ), hxV⟩ + obtain ⟨g, hg, hxg⟩ := exists_arcComp_superset (isPathConnected_singleton x) + (singleton_subset_iff.mpr hm) + have hgΘ := (edge_sub_cuff Γ₂ hΘ hg ⟨x, hxg rfl, hxΘ⟩).1 + by_cases hPg : P g + · exact .inl (.inr (mem_iUnion₂.2 ⟨g, ⟨⟨hg, hgΘ⟩, hPg⟩, subset_closure (hxg rfl)⟩)) + · exact .inr (.inr (mem_iUnion₂.2 ⟨g, ⟨⟨hg, hgΘ⟩, hPg⟩, subset_closure (hxg rfl)⟩)) + have hne₁ : (Θ ∩ Z₁).Nonempty := by + obtain ⟨y, hy⟩ := hYne + exact ⟨y, hy.2.1, .inl hy⟩ + have hne₂ : (Θ ∩ Z₂).Nonempty := ⟨a₀, ha₀Θ, .inl ⟨⟨ha₀, ha₀Θ⟩, hnot⟩⟩ + have hconn : IsPreconnected Θ := by + obtain ⟨c⟩ := id hO + have : ConnectedSpace (Θ : Set S) := c.surjective.connectedSpace c.continuous + exact isPreconnected_iff_preconnectedSpace.mpr inferInstance + obtain ⟨z, -, hz₁, hz₂⟩ := (isPreconnected_closed_iff.mp hconn) Z₁ Z₂ hc₁ hc₂ hcover hne₁ hne₂ + have hvert : ∀ {g}, g ∈ Γ₂.E → z ∈ closure g → z ∉ g → z ∈ tilde g := fun _ hc hn => ⟨hc, hn⟩ + rcases hz₁ with hzY | hz₁ <;> rcases hz₂ with hzo | hz₂ + · exact hzo.2 hzY + · obtain ⟨g, ⟨⟨hgE, -⟩, hPg⟩, hzg⟩ := mem_iUnion₂.1 hz₂ + exact hPg ⟨z, ⟨hzg, fun hin => Γ₂.disjoint_V hgE hin hzY.1⟩, hzY⟩ + · obtain ⟨g, ⟨⟨hgE, hgΘ⟩, a, hat, haY⟩, hzg⟩ := mem_iUnion₂.1 hz₁ + have hzt : z ∈ tilde g := ⟨hzg, fun hin => Γ₂.disjoint_V hgE hin hzo.1.1⟩ + exact hzo.2 (hclosed g hgE hgΘ a hat haY z hzt) + · obtain ⟨g, ⟨⟨hgE, hgΘ⟩, a, hat, haY⟩, hzg⟩ := mem_iUnion₂.1 hz₁ + obtain ⟨g', ⟨⟨hgE', hgΘ'⟩, hPg'⟩, hzg'⟩ := mem_iUnion₂.1 hz₂ + by_cases hzV : z ∈ Γ₂.V + · have hzt : z ∈ tilde g := ⟨hzg, fun hin => Γ₂.disjoint_V hgE hin hzV⟩ + have hzt' : z ∈ tilde g' := ⟨hzg', fun hin => Γ₂.disjoint_V hgE' hin hzV⟩ + exact hPg' ⟨z, hzt', hclosed g hgE hgΘ a hat haY z hzt⟩ + · have hin : ∀ {g : Set S}, g ∈ Γ₂.E → z ∈ closure g → z ∈ g := fun {g} hg hc => + by_contra fun hn => hzV (Γ₂.tilde_subset_V hg ⟨hc, hn⟩) + obtain rfl := arcComp_eq_of_mem hgE hgE' (hin hgE hzg) (hin hgE' hzg') + exact hPg' ⟨a, hat, haY⟩ + have h2 := hsize₂ hf hfΘ + obtain ⟨a, hat⟩ : (tilde f).Nonempty := nonempty_of_ncard_ne_zero (by omega) + obtain ⟨-, -, v, hv, hvΘ, ha⟩ := hall a (Γ₂.tilde_subset_V hf hat) (hclo hfΘ hat.1) + by_cases hsub : tilde f ⊆ ℓ v + · exact .inl ⟨v, hv, hsub⟩ + · obtain ⟨e, he, heΘ, -, rfl⟩ := hCY v hv hvΘ f hf hfΘ ⟨⟨a, hat, ha⟩, hsub⟩ + exact .inr ⟨e, he, hmeet he heΘ, rfl⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Cuff.lean b/LeanPool/GraphMinor/GM19/Section6Cuff.lean new file mode 100644 index 0000000000..9c62e9d9c7 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Cuff.lean @@ -0,0 +1,407 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Tau +public import LeanPool.GraphMinor.GM19.FrameExists +public import LeanPool.GraphMinor.GM19.CuffPieces + +/-! +# Graph Minors XIX, proof of (6.2): connected sets and edges on a cuff + +In the proof of (6.2), page 343, the paper says that the paths `P₁, …, P_t` and the edges `σ'(e_i)` +go +around the circuit `C₂`, and that the direction of an edge on a cuff is kept. Here are the facts +about +`O`-arcs behind this. In `no_three_arcs`: a connected subset `A` of an `O`-arc is touched by at most +two +disjoint connected subsets outside `A`, if one of them has its ends on the `O`-arc. In +`precedes_of_dirAgrees`: an edge and a smaller edge in one side of a frame, directed along the side, +run +the same way around the cuff. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +local notation "𝕀" => unitInterval + +variable {X : Type} [TopologicalSpace X] [T2Space X] + +/-! ### Intervals -/ + +theorem order_helper {I₀ I₁ I₂ : Set 𝕀} (h₀ : I₀.OrdConnected) (h₂ : I₂.OrdConnected) (h0 : 0 ∈ I₀) + (h01 : Disjoint I₀ I₁) (h12 : Disjoint I₁ I₂) {p₁ p₂ x₂ : 𝕀} (hp₁ : p₁ ∈ I₁) (hp₂ : p₂ ∈ I₂) + (hlt : p₁ < p₂) (hx₂ : x₂ ∈ I₀) (hcl : x₂ ∈ closure I₂) : False := by + have hp₁₀ : p₁ ∉ I₀ := fun h => disjoint_left.mp h01 h hp₁ + have hx : x₂ < p₁ := by + refine lt_of_not_ge fun hle => hp₁₀ (h₀.out h0 hx₂ ⟨?_, hle⟩) + exact unitInterval.nonneg p₁ + obtain ⟨q, hq, hqI⟩ := mem_closure_iff.mp hcl (Iio p₁) isOpen_Iio hx + exact disjoint_left.mp h12 hp₁ (h₂.out hqI hp₂ ⟨le_of_lt hq, le_of_lt hlt⟩) + +/-- If `I₀` is an interval starting at `0`, there is no room for two disjoint intervals touching it. +-/ +theorem order_three {I₀ I₁ I₂ : Set 𝕀} (h₀ : I₀.OrdConnected) (h₁ : I₁.OrdConnected) + (h₂ : I₂.OrdConnected) (h0 : 0 ∈ I₀) (h01 : Disjoint I₀ I₁) (h02 : Disjoint I₀ I₂) + (h12 : Disjoint I₁ I₂) (hn₁ : I₁.Nonempty) (hn₂ : I₂.Nonempty) {x₁ x₂ : 𝕀} (hx₁ : x₁ ∈ I₀) + (hc₁ : x₁ ∈ closure I₁) (hx₂ : x₂ ∈ I₀) (hc₂ : x₂ ∈ closure I₂) : False := by + obtain ⟨p₁, hp₁⟩ := hn₁ + obtain ⟨p₂, hp₂⟩ := hn₂ + rcases lt_trichotomy p₁ p₂ with h | h | h + · exact order_helper h₀ h₂ h0 h01 h12 hp₁ hp₂ h hx₂ hc₂ + · exact disjoint_left.mp h12 hp₁ (h ▸ hp₂) + · exact order_helper h₀ h₁ h0 h02 h12.symm hp₂ hp₁ h hx₁ hc₁ + +omit [T2Space X] in +theorem preimage_ordConnected {φ : 𝕀 → X} (hφ : IsEmbedding φ) {A : Set X} (hA : IsPreconnected A) + (hAr : A ⊆ range φ) : (φ ⁻¹' A).OrdConnected := by + have h : IsPreconnected (φ ⁻¹' A) := by + rw [← hφ.isInducing.isPreconnected_image, image_preimage_eq_of_subset hAr] + exact hA + exact h.ordConnected + +omit [T2Space X] in +theorem mem_closure_preimage {φ : 𝕀 → X} (hφ : IsEmbedding φ) {A : Set X} + (hAr : A ⊆ range φ) {t : 𝕀} + (ht : φ t ∈ closure A) : t ∈ closure (φ ⁻¹' A) := by + rw [hφ.closure_eq_preimage_closure_image, image_preimage_eq_of_subset hAr] + exact ht + +omit [T2Space X] in +/-- A connected subset of a line with ends two points of the line is the part between them. -/ +theorem eq_image_Ioo {φ : 𝕀 → X} (hφ : IsEmbedding φ) {e : Set X} (he : IsPreconnected e) + (hr : e ⊆ range φ) {a b : 𝕀} (hab : a < b) (ht : tilde e = {φ a, φ b}) : e = φ '' Ioo a b := by + have hI := preimage_ordConnected hφ he hr + have ha : φ a ∈ tilde e := ht ▸ .inl rfl + have hb : φ b ∈ tilde e := ht ▸ .inr rfl + have hca := mem_closure_preimage hφ hr ha.1 + have hcb := mem_closure_preimage hφ hr hb.1 + have hmem : ∀ {x}, a < x → x < b → x ∈ φ ⁻¹' e := by + intro x hax hxb + obtain ⟨q, hq, hqI⟩ := mem_closure_iff.mp hca (Iio x) isOpen_Iio hax + obtain ⟨q', hq', hqI'⟩ := mem_closure_iff.mp hcb (Ioi x) isOpen_Ioi hxb + exact hI.out hqI hqI' ⟨le_of_lt hq, le_of_lt hq'⟩ + refine Subset.antisymm (fun y hy => ?_) (image_subset_iff.mpr fun x hx => hmem hx.1 hx.2) + obtain ⟨t, rfl⟩ := hr hy + refine ⟨t, ⟨?_, ?_⟩, rfl⟩ + · by_contra hn + have hle : t ≤ a := not_lt.mp hn + obtain ⟨q, hq, hqI⟩ := mem_closure_iff.mp hcb (Ioi a) isOpen_Ioi hab + exact ha.2 (hI.out hy hqI ⟨hle, le_of_lt hq⟩) + · by_contra hn + have hle : b ≤ t := not_lt.mp hn + obtain ⟨q, hq, hqI⟩ := mem_closure_iff.mp hca (Iio b) isOpen_Iio hab + exact hb.2 (hI.out hqI hy ⟨le_of_lt hq, hle⟩) + +/-! ### Cutting an `O`-arc along an edge -/ + +theorem isClosed_of_cuffLine {L : Set X} {a b : X} (h : IsLineWithEnds L a b) : IsClosed L := by + obtain ⟨g, -, -⟩ := h + have : CompactSpace L := g.compactSpace + exact (isCompact_iff_compactSpace.mpr this).isClosed + +omit [T2Space X] in +/-- The embedding of the unit interval given by a line. -/ +theorem exists_line_emb {L : Set X} {a b : X} (h : IsLineWithEnds L a b) : + ∃ φ : 𝕀 → X, IsEmbedding φ ∧ range φ = L ∧ φ 0 = a ∧ φ 1 = b := by + obtain ⟨g, h0, h1⟩ := h + refine ⟨fun t => (g t).1, IsEmbedding.subtypeVal.comp g.isEmbedding, ?_, h0, h1⟩ + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (g t).2 + · intro hx + exact ⟨g.symm ⟨x, hx⟩, by simp⟩ + +omit [T2Space X] in +/-- A connected set inside the closed line `L`, avoiding an interior point, stays on one side. -/ +theorem line_filled {L f : Set X} {a b : X} (hL : IsLineWithEnds L a b) (hf : IsPreconnected f) + (hfL : f ⊆ L) (ha : a ∈ closure f) (hb : b ∈ closure f) {x : X} (hx : x ∈ L) (hxa : x ≠ a) + (hxb : x ≠ b) : x ∈ f := by + obtain ⟨φ, hφ, hr, h0, h1⟩ := exists_line_emb hL + subst h0 h1 + have hfr : f ⊆ range φ := hr ▸ hfL + have hI := preimage_ordConnected hφ hf hfr + have hca := mem_closure_preimage hφ hfr ha + have hcb := mem_closure_preimage hφ hfr hb + obtain ⟨t, rfl⟩ : x ∈ range φ := hr ▸ hx + have ht0 : 0 < t := lt_of_le_of_ne (unitInterval.nonneg t) fun h => hxa (h ▸ rfl) + have ht1 : t < 1 := lt_of_le_of_ne (unitInterval.le_one t) fun h => hxb (h ▸ rfl) + obtain ⟨q, hq, hqI⟩ := mem_closure_iff.mp hca (Iio t) isOpen_Iio ht0 + obtain ⟨q', hq', hqI'⟩ := mem_closure_iff.mp hcb (Ioi t) isOpen_Ioi ht1 + exact hI.out hqI hqI' ⟨le_of_lt hq, le_of_lt hq'⟩ + +/-- An edge `f` of an `O`-arc `F`, with ends `a, b`, and the rest of `F`: there is a line `L` in `F` +with +ends `a, b`, disjoint from `f`, that holds every point of `F` outside `f`. -/ +theorem exists_rest_line {F f : Set X} {a b : X} (hF : IsOArc F) (hab : a ≠ b) + (hf : IsPreconnected f) (hfF : f ⊆ F) (hcl : closure f ⊆ F) (ht : tilde f = {a, b}) : + ∃ L, IsLineWithEnds L a b ∧ F \ f ⊆ L ∧ L ⊆ F ∧ Disjoint L f := by + have ha : a ∈ tilde f := ht ▸ .inl rfl + have hb : b ∈ tilde f := ht ▸ .inr rfl + obtain ⟨A₁, A₂, h₁, h₂, hU, hI⟩ := hF.lines (hcl ha.1) (hcl hb.1) hab + have hnot : ∀ {x}, x ∈ f → x ∉ ({a, b} : Set X) := fun {x} hxf hx => by + rw [← ht] at hx + exact hx.2 hxf + have hmain : ∀ {A₁ A₂ : Set X}, IsLineWithEnds A₁ a b → IsLineWithEnds A₂ a b → F = A₁ ∪ A₂ → + A₁ ∩ A₂ = {a, b} → f ⊆ A₁ → F \ f ⊆ A₂ ∧ A₂ ⊆ F ∧ Disjoint A₂ f := by + intro A₁ A₂ h₁ h₂ hU hI hsub + refine ⟨fun x hx => ?_, hU ▸ subset_union_right, disjoint_left.mpr fun x hx hxf => + hnot hxf (hI ▸ ⟨hsub hxf, hx⟩)⟩ + rcases (hU ▸ hx.1 : x ∈ A₁ ∪ A₂) with h | h + · by_cases hxa : x = a + · obtain ⟨g, h0, -⟩ := h₂ + exact hxa ▸ h0 ▸ (g 0).2 + by_cases hxb : x = b + · obtain ⟨g, -, h0⟩ := h₂ + exact hxb ▸ h0 ▸ (g 1).2 + exact absurd (line_filled h₁ hf hsub ha.1 hb.1 h hxa hxb) hx.2 + · exact h + have hsub : f ⊆ A₁ ∪ A₂ := hU ▸ hfF + have hcase := (isPreconnected_closed_iff.mp hf) A₁ A₂ (isClosed_of_cuffLine h₁) + (isClosed_of_cuffLine h₂) hsub + by_cases hA : (f ∩ A₁).Nonempty + · by_cases hB : (f ∩ A₂).Nonempty + · obtain ⟨x, hxf, hx⟩ := hcase hA hB + exact absurd (hI ▸ hx) (hnot hxf) + · refine ⟨A₂, h₂, hmain h₁ h₂ hU.symm hI fun x hx => ?_⟩ + rcases hsub hx with h | h + · exact h + · exact absurd ⟨x, hx, h⟩ hB + · refine ⟨A₁, h₁, hmain h₂ h₁ (by rw [← hU, union_comm]) (by rw [inter_comm, hI]) fun x hx => ?_⟩ + rcases hsub hx with h | h + · exact absurd ⟨x, hx, h⟩ hA + · exact h + +/-- The closure of an open arc of an `O`-arc is not all of it. -/ +theorem exists_notMem_closure {F f : Set X} {a b : X} (hF : IsOArc F) (hab : a ≠ b) + (hf : IsPreconnected f) (hfF : f ⊆ F) (hcl : closure f ⊆ F) (ht : tilde f = {a, b}) : + ∃ p ∈ F, p ∉ closure f := by + obtain ⟨L, hL, -, hLF, hd⟩ := exists_rest_line hF hab hf hfF hcl ht + obtain ⟨φ, hφ, hr, h0, h1⟩ := exists_line_emb hL + let m : 𝕀 := ⟨1 / 2, by norm_num, by norm_num⟩ + have hm : φ m ∈ L := hr ▸ mem_range_self m + refine ⟨φ m, hLF hm, fun hc => ?_⟩ + have htl : φ m ∉ tilde f := by + rw [ht] + rintro (h | h) + · have := hφ.injective (h.trans h0.symm) + have h' := congrArg Subtype.val this + norm_num [m] at h' + · have := hφ.injective (h.trans h1.symm) + have h' := congrArg Subtype.val this + norm_num [m] at h' + exact disjoint_left.mp hd hm (by_contra fun h => htl ⟨hc, h⟩) + +theorem no_three_arcs_aux {F A f₁ f₂ f₃ : Set X} {a b : X} (hF : IsOArc F) (hab : a ≠ b) + (hA : IsPreconnected A) (hAF : A ⊆ F) (h₁ : IsPreconnected f₁) (h₂ : IsPreconnected f₂) + (h₃ : IsPreconnected f₃) (hn₁ : f₁.Nonempty) (hn₂ : f₂.Nonempty) + (hF₁ : f₁ ⊆ F) (hF₂ : f₂ ⊆ F) (hF₃ : f₃ ⊆ F) (hcl₃ : closure f₃ ⊆ F) + (hd₁ : Disjoint A f₁) (hd₂ : Disjoint A f₂) (hd₃ : Disjoint A f₃) + (h12 : Disjoint f₁ f₂) (h13 : Disjoint f₁ f₃) (h23 : Disjoint f₂ f₃) + (hc₁ : (closure f₁ ∩ A).Nonempty) (hc₂ : (closure f₂ ∩ A).Nonempty) + (ht : tilde f₃ = {a, b}) (haA : a ∈ A) : False := by + obtain ⟨L, hL, hrest, -, -⟩ := exists_rest_line hF hab h₃ hF₃ hcl₃ ht + obtain ⟨φ, hφ, hr, h0, -⟩ := exists_line_emb hL + have hsub : ∀ {B : Set X}, B ⊆ F → Disjoint B f₃ → B ⊆ range φ := fun hB hd x hx => + hr ▸ hrest ⟨hB hx, disjoint_left.mp hd hx⟩ + have hA' := hsub hAF hd₃ + have h₁' := hsub hF₁ h13 + have h₂' := hsub hF₂ h23 + have himg : ∀ {B C : Set X}, Disjoint B C → Disjoint (φ ⁻¹' B) (φ ⁻¹' C) := fun h => h.preimage φ + have hne : ∀ {B : Set X}, B.Nonempty → B ⊆ range φ → (φ ⁻¹' B).Nonempty := by + rintro B ⟨x, hx⟩ h + obtain ⟨t, rfl⟩ := h hx + exact ⟨t, hx⟩ + obtain ⟨x₁, hx₁, hxA₁⟩ := hc₁ + obtain ⟨x₂, hx₂, hxA₂⟩ := hc₂ + obtain ⟨s₁, rfl⟩ := hA' hxA₁ + obtain ⟨s₂, rfl⟩ := hA' hxA₂ + exact order_three (preimage_ordConnected hφ hA hA') (preimage_ordConnected hφ h₁ h₁') + (preimage_ordConnected hφ h₂ h₂') (by change φ 0 ∈ A; rw [h0]; exact haA) (himg hd₁) (himg hd₂) + (himg h12) (hne hn₁ h₁') (hne hn₂ h₂') hxA₁ (mem_closure_preimage hφ h₁' hx₁) hxA₂ + (mem_closure_preimage hφ h₂' hx₂) + +/-- **At most two connected sets touch a connected subset of an `O`-arc.** Let `A` be a connected +subset of the `O`-arc `F`, and let `f₁, f₂, f₃` be connected, pairwise disjoint, and disjoint from +`A`, +inside `F`. Let `f₃` be an open arc of `F` with ends `a, b`, one of them in `A`. Then `f₁` and `f₂` +do not +both touch `A`. -/ +theorem no_three_arcs {F A f₁ f₂ f₃ : Set X} {a b : X} (hF : IsOArc F) (hab : a ≠ b) + (hA : IsPreconnected A) (hAF : A ⊆ F) (h₁ : IsPreconnected f₁) (h₂ : IsPreconnected f₂) + (h₃ : IsPreconnected f₃) (hn₁ : f₁.Nonempty) (hn₂ : f₂.Nonempty) + (hF₁ : f₁ ⊆ F) (hF₂ : f₂ ⊆ F) (hF₃ : f₃ ⊆ F) (hcl₃ : closure f₃ ⊆ F) + (hd₁ : Disjoint A f₁) (hd₂ : Disjoint A f₂) (hd₃ : Disjoint A f₃) + (h12 : Disjoint f₁ f₂) (h13 : Disjoint f₁ f₃) (h23 : Disjoint f₂ f₃) + (hc₁ : (closure f₁ ∩ A).Nonempty) (hc₂ : (closure f₂ ∩ A).Nonempty) + (ht : tilde f₃ = {a, b}) (hend : a ∈ A ∨ b ∈ A) : False := by + rcases hend with h | h + · exact no_three_arcs_aux hF hab hA hAF h₁ h₂ h₃ hn₁ hn₂ hF₁ hF₂ hF₃ hcl₃ hd₁ hd₂ hd₃ h12 h13 h23 + hc₁ hc₂ ht h + · exact no_three_arcs_aux hF hab.symm hA hAF h₁ h₂ h₃ hn₁ hn₂ hF₁ hF₂ hF₃ hcl₃ hd₁ hd₂ hd₃ h12 h13 + h23 hc₁ hc₂ (by rw [ht, pair_comm]) h + +/-! ### Angles on a cuff -/ + +section Angle + +variable {Θ : Set X} (f : Circle ≃ₜ Θ) + +omit [T2Space X] in +/-- A map into `Θ` that misses the point of angle `α` has a continuous angle in `(α, α + 2π)`. -/ +theorem exists_cuff_angle {Y : Type} [TopologicalSpace Y] {g : Y → X} (hg : Continuous g) + (hgΘ : ∀ y, g y ∈ Θ) + {α : ℝ} (hp : ∀ y, g y ≠ cuffPoint f α) : + ∃ θ : Y → ℝ, Continuous θ ∧ (∀ y, θ y ∈ Ioo α (α + 2 * Real.pi)) ∧ ∀ y, cuffPoint f (θ y) = g y + := by + let c : Y → Circle := fun y => f.symm ⟨g y, hgΘ y⟩ + have hc : Continuous c := f.symm.continuous.comp (hg.subtype_mk hgΘ) + have hf : ∀ y, ((f (c y)).1 : X) = g y := fun y => by simp [c] + let u : Y → Circle := fun y => c y * Circle.exp (-(α + Real.pi)) + have hu : Continuous u := hc.mul continuous_const + have hcu : ∀ y, Circle.exp (α + Real.pi) * u y = c y := fun y => by + simp only [u, Circle.exp_neg] + rw [mul_comm, mul_assoc, inv_mul_cancel, mul_one] + have harg : ∀ y, Complex.arg (u y) ≠ Real.pi := by + intro y h + have h1 : Circle.exp (Complex.arg (u y)) = u y := Circle.exp_arg _ + rw [h] at h1 + have h2 : c y = Circle.exp α := by + rw [← hcu y, ← h1, ← Circle.exp_add] + exact Circle.exp_eq_exp.mpr ⟨1, by push_cast; ring⟩ + exact hp y (by rw [← hf y, h2]; rfl) + refine ⟨fun y => α + Real.pi + Complex.arg (u y), ?_, fun y => ⟨?_, ?_⟩, fun y => ?_⟩ + · refine continuous_const.add (continuous_iff_continuousAt.mpr fun y => ?_) + have hs : (u y : ℂ) ∈ Complex.slitPlane := + Complex.mem_slitPlane_iff_arg.mpr ⟨harg y, Circle.coe_ne_zero _⟩ + exact ContinuousAt.comp (g := Complex.arg) (f := fun y => ((u y : Circle) : ℂ)) + (Complex.continuousAt_arg hs) + (continuous_subtype_val.comp hu).continuousAt + · linarith [Complex.neg_pi_lt_arg (u y : ℂ)] + · linarith [lt_of_le_of_ne (Complex.arg_le_pi (u y : ℂ)) (harg y)] + · change (f (Circle.exp _)).1 = g y + rw [Circle.exp_add, Circle.exp_arg, hcu y] + exact hf y + +omit [T2Space X] in +theorem angle_inj {α s t : ℝ} (hs : s ∈ Ioo α (α + 2 * Real.pi)) (ht : t ∈ Ioo α (α + 2 * Real.pi)) + (h : cuffPoint f s = cuffPoint f t) : s = t := + cuffPoint_injOn f le_rfl ⟨hs.1.le, hs.2⟩ ⟨ht.1.le, ht.2⟩ h + +omit [T2Space X] in +/-- Between two points of the line, the angle fills the interval. -/ +theorem image_Ioo_angle {θ : 𝕀 → ℝ} (hc : Continuous θ) (hm : StrictMono θ) {g : 𝕀 → X} + (hg : ∀ t, cuffPoint f (θ t) = g t) {a b : 𝕀} (hab : a ≤ b) : + g '' Ioo a b = cuffPoint f '' Ioo (θ a) (θ b) := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + exact ⟨θ x, ⟨hm hx.1, hm hx.2⟩, hg x⟩ + · rintro ⟨w, hw, rfl⟩ + have hconn : IsPreconnected (Icc a b) := ordConnected_Icc.isPreconnected + obtain ⟨x, hx, rfl⟩ := hconn.intermediate_value (left_mem_Icc.mpr hab) (right_mem_Icc.mpr hab) + hc.continuousOn ⟨hw.1.le, hw.2.le⟩ + have h1 : a ≠ x := fun h => hw.1.ne (by rw [h]) + have h2 : x ≠ b := fun h => hw.2.ne (by rw [h]) + exact ⟨x, ⟨lt_of_le_of_ne hx.1 h1, lt_of_le_of_ne hx.2 h2⟩, (hg x).symm⟩ + +omit [T2Space X] in +/-- **Directions along a side agree around the cuff.** Let `s` be a set with closure in the cuff +`Θ`, +missing the point `p` of `Θ`. If `e, e'` lie in `s` and are directed along `s` by `DirAgrees`, and +the +tail of `e` immediately precedes `e` in an orientation of `Θ`, then the tail of `e'` immediately +precedes +`e'` in the same orientation. -/ +theorem precedes_of_dirAgrees {s e e' : Set X} {γs γe γe' : List X} (hs : closure s ⊆ Θ) {p : X} + (hpΘ : p ∈ Θ) (hp : p ∉ closure s) (hd : DirAgrees s γs e γe) (hd' : DirAgrees s γs e' γe') + (he : IsPreconnected e) (he' : IsPreconnected e') + (ht : ∀ a b, γe.head? = some a → γe.getLast? = some b → tilde e = {a, b}) + (ht' : ∀ a b, γe'.head? = some a → γe'.getLast? = some b → tilde e' = {a, b}) + {n n' : X} (hn : γe.head? = some n) (hn' : γe'.head? = some n') + (hpre : ImmediatelyPrecedes f n e) : ImmediatelyPrecedes f n' e' := by + obtain ⟨g, t₁, t₂, ht12, hes, h0, h1, ha, hb⟩ := hd + obtain ⟨g', t₃, t₄, ht34, hes', h0', h1', ha', hb'⟩ := hd' + have hpi := Real.pi_pos + obtain ⟨α, hα⟩ : ∃ α, cuffPoint f α = p := by + refine ⟨Complex.arg (f.symm ⟨p, hpΘ⟩), ?_⟩ + change (f (Circle.exp _)).1 = p + rw [Circle.exp_arg] + simp + let φ : 𝕀 → X := fun t => (g t).1 + let φ' : 𝕀 → X := fun t => (g' t).1 + have hφ : IsEmbedding φ := IsEmbedding.subtypeVal.comp g.isEmbedding + have hφ' : IsEmbedding φ' := IsEmbedding.subtypeVal.comp g'.isEmbedding + have hrange : ∀ {g₀ : 𝕀 ≃ₜ closure s}, s ⊆ range fun t => (g₀ t).1 := by + intro g₀ x hx + exact ⟨g₀.symm ⟨x, subset_closure hx⟩, by simp⟩ + obtain ⟨θ, hθc, hθr, hθ⟩ := exists_cuff_angle f hφ.continuous (fun t => hs (g t).2) (α := α) + fun t h => hp (by rw [← hα, ← h]; exact (g t).2) + obtain ⟨θ', hθc', hθr', hθ'⟩ := exists_cuff_angle f hφ'.continuous (fun t => hs (g' t).2) (α := α) + fun t h => hp (by rw [← hα, ← h]; exact (g' t).2) + have hinj : Function.Injective θ := fun x y h => hφ.injective (by rw [← hθ, ← hθ, h]) + have hinj' : Function.Injective θ' := fun x y h => hφ'.injective (by rw [← hθ', ← hθ', h]) + have he0 : θ 0 = θ' 0 := by + refine angle_inj f (hθr _) (hθr' _) ?_ + rw [hθ, hθ'] + exact Option.some.inj (h0.symm.trans h0') + have he1 : θ 1 = θ' 1 := by + refine angle_inj f (hθr _) (hθr' _) ?_ + rw [hθ, hθ'] + exact Option.some.inj (h1.symm.trans h1') + have h01 : (0 : 𝕀) < 1 := by + change ((0 : ℝ)) < 1 + exact one_pos + have hn₀ : n = φ t₁ := Option.some.inj (hn.symm.trans ha) + have hn₀' : n' = φ' t₃ := Option.some.inj (hn'.symm.trans ha') + have heq : e = φ '' Ioo t₁ t₂ := eq_image_Ioo hφ he (hes.trans hrange) ht12 (ht _ _ ha hb) + have heq' : e' = φ' '' Ioo t₃ t₄ := eq_image_Ioo hφ' he' (hes'.trans hrange) ht34 + (ht' _ _ ha' hb') + have hup : StrictMono θ := by + refine (Continuous.strictMono_of_inj hθc hinj).resolve_right fun hanti => ?_ + obtain ⟨t₀, t₁', hlt, -, hc, heq₀⟩ := hpre + have hc' : cuffPoint f t₀ = cuffPoint f (θ t₁) := by rw [hc, hθ, hn₀] + obtain ⟨m, hm⟩ := cuffPoint_eq f hc' + have hy := hθr t₁ + set ε := min (t₁' - t₀) (α + 2 * Real.pi - θ t₁) / 2 with hε + have hm₁ : min (t₁' - t₀) (α + 2 * Real.pi - θ t₁) ≤ t₁' - t₀ := min_le_left _ _ + have hm₂ : min (t₁' - t₀) (α + 2 * Real.pi - θ t₁) ≤ α + 2 * Real.pi - θ t₁ := min_le_right _ _ + have hm₃ : 0 < min (t₁' - t₀) (α + 2 * Real.pi - θ t₁) := + lt_min (by linarith) (by linarith [hy.2]) + have hz : cuffPoint f (t₀ + ε) ∈ e := by + rw [heq₀] + exact ⟨_, ⟨by linarith, by linarith⟩, rfl⟩ + rw [heq] at hz + obtain ⟨x, hx, hxe⟩ := hz + have hshift : t₀ + ε = (θ t₁ + ε) + m * (2 * Real.pi) := by rw [hm]; ring + have hzz : cuffPoint f (θ x) = cuffPoint f (θ t₁ + ε) := by + rw [hθ, hxe, hshift, cuffPoint_shift] + have hle : θ x < θ t₁ := hanti hx.1 + have := angle_inj f (hθr x) ⟨by linarith [hy.1], by linarith⟩ hzz + linarith + have hup' : StrictMono θ' := by + refine (Continuous.strictMono_of_inj hθc' hinj').resolve_right fun hanti => ?_ + have h₁ := hup h01 + have h₂ := hanti h01 + rw [he0, he1] at h₁ + exact lt_asymm h₁ h₂ + refine ⟨θ' t₃, θ' t₄, hup' ht34, ?_, ?_, ?_⟩ + · linarith [(hθr' t₃).1, (hθr' t₄).2] + · rw [hθ', hn₀'] + · rw [heq'] + exact image_Ioo_angle f hθc' hup' hθ' ht34.le + +end Angle + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Cut.lean b/LeanPool/GraphMinor/GM19/Section6Cut.lean new file mode 100644 index 0000000000..7d9b3af6fc --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Cut.lean @@ -0,0 +1,225 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6a +public import LeanPool.GraphMinor.GM17.CapSide +public import LeanPool.GraphMinor.Surface.CapCoh + +/-! +# One side of a curve that bounds no disc + +Let `F` be an `O`-arc of a connected closed surface `S` that bounds no closed disc, and let `Z` be a +connected set off `F`. We cut along `F`, keep the side with `Z`, and cap all its cuffs +(`exists_simpler_side`). The result is a connected closed surface that holds a copy of `Z`, and +which has fewer classes of local cocycles than `S`. + +This is how the proof of Graph Minors XIX, (6.5) (page 341) gets a surface of larger Euler +characteristic. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM17 + +local notation "K" => ZMod 2 + +/-- What we want from a side of `F`. -/ +def SideResult (S : Type) [TopologicalSpace S] (Z : Set S) : Prop := + ∃ (T : Type) (_ : TopologicalSpace T) (_ : ConnectedSpace T) (ι : S → T) (ι' : T + → S), IsClosedSurface T ∧ ContinuousOn ι Z ∧ + ContinuousOn ι' (ι '' Z) ∧ LeftInvOn ι' ι Z ∧ ∀ κ κ₁ : ℕ, Nat.card (KCl S K) = 2 ^ κ → Nat.card + (KCl T K) = 2 ^ κ₁ → κ₁ < κ + +variable {Y S : Type} [TopologicalSpace Y] [TopologicalSpace S] + +theorem continuousOn_invFun_range {A B : Type} [TopologicalSpace A] [TopologicalSpace B] [Nonempty + A] {J : A → B} (hJ : IsEmbedding J) : + ContinuousOn (Function.invFun J) (range J) := by + rw [continuousOn_iff_continuous_domRestrict] + have he : (range J).domRestrict (Function.invFun J) = hJ.toHomeomorph.symm := by + funext t + obtain ⟨y, rfl⟩ := hJ.toHomeomorph.surjective t + rw [Homeomorph.symm_apply_apply] + exact Function.leftInverse_invFun hJ.injective y + rw [he] + exact hJ.toHomeomorph.symm.continuous + +/-- Capping the side `W` of the cut. -/ +theorem side_result_of_cap [CompactSpace Y] (hT : IsClosedSurface S) + {ψ : Y → S} {F Z : Set S} (hψ : IsCutting ψ F) (hY : IsSurface Y) + (hFc : IsClosed F) {W : Set Y} (hW : IsClopen W) (hc : ConnectedSpace W) + (hB : IsOArc ((ψ ∘ (Subtype.val : W → Y)) ⁻¹' F) ∨ ∃ P P', Disjoint P P' ∧ P ∪ P' = (ψ ∘ + (Subtype.val : W → Y)) ⁻¹' F ∧ IsOArc P ∧ IsOArc P') + (hsimp : ∀ (V : Type) [TopologicalSpace V], CapDrops W V → IsSimplerThan V S) (hZ : Z ⊆ range + (ψ ∘ (Subtype.val : W → Y)) \ F) : + SideResult S Z := by + have ht2S : T2Space S := hT.2.1 + have hm := cutMap_sub hψ hFc hW + have hsurf := isSurface_sub hY hW + have hcW : CompactSpace W := hsurf.1 + have ht2W : T2Space W := hsurf.2.1 + obtain ⟨V, tV, j, hV, hconnV, hj, -, hdrop⟩ := cap_lifts hsurf hm.bdF hB + have ht2V : T2Space V := hV.2.1 + obtain ⟨a, b, c, a', b', c', ⟨e⟩, ⟨e'⟩, h1, h2, h3⟩ := hsimp V hdrop + obtain ⟨T, tT, j', C, hT₁, hj', hC, hu, hi, hconn, 𝓓, hf, hU, hd, hdj⟩ := exists_capAll_discs V hV + have hbdS : bd S = ∅ := eq_empty_iff_forall_notMem.mpr fun x hx => hx (hT.2.2 x) + obtain rfl : c' = 0 := model_c_eq_zero e' hbdS + have ht2T : T2Space T := hT₁.2.1 + obtain ⟨f, hfi⟩ := kCl_cap_injective hj' hu hi hf hU hd hdj + have hJ : IsClosedEmbedding (j' ∘ j) := hj'.comp hj + obtain ⟨σ, hσc, hσ₁, hσ₂⟩ := hm.exists_sec + refine ⟨T, tT, hconn hconnV, (j' ∘ j) ∘ σ, (ψ ∘ Subtype.val) ∘ Function.invFun (j' ∘ j), hT₁, + ?_, ?_, ?_, ?_⟩ + · exact hJ.continuous.comp_continuousOn (hσc.mono hZ) + · refine (hψ.1.comp continuous_subtype_val).comp_continuousOn ((continuousOn_invFun_range + hJ.isEmbedding).mono ?_) + rintro _ ⟨z, -, rfl⟩ + exact ⟨_, rfl⟩ + · intro z hz + change (ψ ∘ Subtype.val) (Function.invFun (j' ∘ j) ((j' ∘ j) (σ z))) = z + rw [Function.leftInverse_invFun hJ.injective (σ z)] + exact hσ₁ z (hZ hz) + · intro κ κ₁ hκ hκ₁ + have h4 := card_kCl_of_model e + have h5 := card_kCl_of_model e' + have hfin : Finite (KCl V K) := Nat.finite_of_card_ne_zero (by rw [h4]; positivity) + have h6 := Nat.card_le_card_of_injective f hfi + rw [hκ₁, h4] at h6 + rw [hκ] at h5 + have h7 : κ₁ ≤ 2 * a + b := (Nat.pow_le_pow_iff_right (by norm_num)).mp h6 + have h8 : κ = 2 * a' + b' := Nat.pow_right_injective (le_refl 2) h5 + omega + +/-- The case where the cut has two sides, and `Z` lies in the first. -/ +theorem side_result_two [CompactSpace Y] (hT : IsClosedSurface S) [ConnectedSpace S] {ψ + : Y → S} {F Z : Set S} (hY : IsSurface Y) (hO : IsOArc F) + (hFc : IsClosed F) (hnn : ¬ ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = F) {W₁ W₂ X X' : Set Y} + (T : TwoSides ψ F W₁ W₂ X X') (hOX : IsOArc X) (hOX' : IsOArc X') + (hne : W₁ ≠ W₂) (hsc : spaceComponents Y = {W₁, W₂}) (hc₁ : ConnectedSpace W₁) + (hc₂ : ConnectedSpace W₂) + (hcase : CutIsSimpler Y S ∨ CutHasCopy Y S ClosedCylinder ∨ CutHasDisc Y) (hZ : Z ⊆ range (ψ ∘ + (Subtype.val : W₁ → Y)) \ F) : SideResult S Z := by + have hS : IsSurface S := hT.isSurface + have ht2S : T2Space S := hT.2.1 + have hcS : CompactSpace S := hT.1 + have hnod₁ : ¬ Nonempty (W₁ ≃ₜ ClosedUnitDisc) := fun ⟨e⟩ => hnn ⟨_, (T.disc hO e).1, + (T.disc hO e).2.1⟩ + have hnod₂ : ¬ Nonempty (W₂ ≃ₜ ClosedUnitDisc) := fun ⟨e⟩ => hnn ⟨_, (T.symm.disc hO e).1, + (T.symm.disc hO e).2.1⟩ + obtain ⟨φ'⟩ := id hOX' + have hs := side_tri hS (W := W₂) (W' := W₁) (X := X') hne.symm (by rw [hsc, pair_comm]) ⟨_, + (φ' 1).2, T.hX' (φ' 1).2⟩ hOX' T.hbd' hY T.c₂ hc₂ hcase + fun h => absurd h hnod₁ + have hsimp := hs.resolve_left hnod₂ + have hfib : (ψ ∘ (Subtype.val : W₁ → Y)) ⁻¹' F = Subtype.val ⁻¹' X := by + ext y + change ψ y.1 ∈ F ↔ y.1 ∈ X + constructor + · intro h + rcases (T.hun.symm.subset h : y.1 ∈ X ∪ X') with h1 | h1 + · exact h1 + · exact absurd (T.hX' h1) (disjoint_left.mp T.hd y.2) + · exact fun h => T.hun.subset (Or.inl h) + exact side_result_of_cap hT T.hψ hY hFc T.c₁ hc₁ (.inl (hfib ▸ isOArc_preimage hOX T.hX)) hsimp hZ + +/-- **One side of a curve.** Let `F` be an `O`-arc of a connected closed surface that bounds no +closed disc, and let `Z` be a nonempty connected set off `F`. Then `Z` embeds in a connected closed +surface with fewer classes of local cocycles. -/ +theorem exists_simpler_side (hT : IsClosedSurface S) [ConnectedSpace S] {F Z : Set S} + (hO : IsOArc F) (hnn : ¬ ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = F) + (hZ : IsPreconnected Z) (hd : Disjoint Z F) : SideResult S Z := by + have hS : IsSurface S := hT.isSurface + have ht2S : T2Space S := hT.2.1 + have hcS : CompactSpace S := hT.1 + have hbdS : bd S = ∅ := eq_empty_iff_forall_notMem.mpr fun x hx => hx (hT.2.2 x) + have hdb : Disjoint F (bd S) := by rw [hbdS]; exact disjoint_empty _ + have hFc : IsClosed F := by + obtain ⟨φ⟩ := id hO + have hc : IsCompact F := by + rw [isCompact_iff_compactSpace] + exact φ.compactSpace + exact hc.isClosed + obtain ⟨Y, tY, ψ, hY, hψ, hcase, hlift⟩ := cutOArc.{0} S F hS ‹_› hO hdb + have ht2Y : T2Space Y := hY.2.1 + have hcY : CompactSpace Y := hY.1 + have hconnected : ConnectedSpace Y → (IsOArc (ψ ⁻¹' F) ∨ ∃ P P', Disjoint P P' ∧ P ∪ P' = ψ ⁻¹' F + ∧ IsOArc P ∧ IsOArc P') → SideResult S Z := by + intro hYc hB + have hone : ∀ C ∈ spaceComponents Y, C = univ := fun C hC => by + rw [spaceComponents_eq] at hC + obtain ⟨y, rfl⟩ := hC + exact PreconnectedSpace.connectedComponent_eq_univ y + obtain ⟨y₀⟩ : Nonempty Y := inferInstance + have hunivc : univ ∈ spaceComponents Y := by + rw [spaceComponents_eq] + exact ⟨y₀, PreconnectedSpace.connectedComponent_eq_univ y₀⟩ + have hs : IsSimplerThan (univ : Set Y) S := by + rcases hcase with h | ⟨C₁, C₂, hneC, heq, -, -⟩ | ⟨C₁, C₂, hneC, heq, -⟩ + · exact h.2 univ hunivc + · exact absurd ((hone C₁ (heq ▸ mem_insert _ _)).trans (hone C₂ + (heq ▸ mem_insert_of_mem _ rfl)).symm) hneC + · exact absurd ((hone C₁ (heq ▸ mem_insert _ _)).trans (hone C₂ + (heq ▸ mem_insert_of_mem _ rfl)).symm) hneC + have hcu : ConnectedSpace ↥(univ : Set Y) := (Homeomorph.Set.univ + Y).symm.surjective.connectedSpace (Homeomorph.Set.univ Y).symm.continuous + have hB' : IsOArc ((ψ ∘ (Subtype.val : ↥(univ : Set Y) → Y)) ⁻¹' F) ∨ ∃ P P', Disjoint P P' + ∧ P ∪ P' = (ψ ∘ (Subtype.val : ↥(univ : Set Y) → Y)) ⁻¹' F ∧ IsOArc P ∧ IsOArc P' := by + rcases hB with h | ⟨P, P', hdj, hu, h1, h2⟩ + · exact .inl (isOArc_preimage h (subset_univ _)) + · refine .inr ⟨_, _, hdj.preimage Subtype.val, ?_, isOArc_preimage h1 (subset_univ _), + isOArc_preimage h2 (subset_univ _)⟩ + rw [← preimage_union, hu, preimage_comp] + refine side_result_of_cap hT hψ hY hFc isClopen_univ hcu hB' (fun V _ hV => ?_) fun z hz => ?_ + · obtain ⟨a, b, c, a₁, b₁, c₁, h1, h2, h3, h4, h5⟩ := hs + obtain ⟨c₂, h6, h7⟩ := hV a b c h1 + exact ⟨a, b, c₂, a₁, b₁, c₁, h7, h2, h3, h4, by omega⟩ + · obtain ⟨y, rfl⟩ := hψ.2.1 z + exact ⟨⟨⟨y, mem_univ _⟩, rfl⟩, disjoint_left.mp hd hz⟩ + rcases hlift with ⟨X, X', hdX, hun, hOX, hOX', bX, bX'⟩ | hQ + swap + · obtain ⟨φ⟩ := id hQ + have hp := hQ.isPreconnected + rcases cut_comps hψ hY hp hp (union_self _) (φ 1).2 (φ 1).2 with hYc | ⟨W₁, W₂, -, -, h1, h2, + -, -, -, hdW, -, -⟩ + · exact hconnected hYc (.inl hQ) + · exact absurd (h2 (φ 1).2) (disjoint_left.mp hdW (h1 (φ 1).2)) + obtain ⟨φ⟩ := id hOX + obtain ⟨φ'⟩ := id hOX' + rcases cut_comps hψ hY hOX.isPreconnected hOX'.isPreconnected hun (φ 1).2 + (φ' 1).2 with hYc | ⟨W₁, W₂, hne', hsc, hX₁, hX₂, hW₁, hW₂, hU, hdW, hc₁, hc₂⟩ + · exact hconnected hYc (.inr ⟨X, X', hdX, hun, hOX, hOX'⟩) + have hbX : X ⊆ bd Y := fun y hy => hψ.2.2.2.2 (hun.subset (.inl hy)) + have hbX' : X' ⊆ bd Y := fun y hy => hψ.2.2.2.2 (hun.subset (.inr hy)) + have T : TwoSides ψ F W₁ W₂ X X' := ⟨hψ, hW₁, hW₂, hU, hdW, hX₁, hX₂, hun, bX, bX', hbX, hbX'⟩ + have hm₁ := cutMap_sub hψ hFc hW₁ + have hm₂ := cutMap_sub hψ hFc hW₂ + let P₁ := range (ψ ∘ (Subtype.val : W₁ → Y)) \ F + let P₂ := range (ψ ∘ (Subtype.val : W₂ → Y)) \ F + have hPd : Disjoint P₁ P₂ := by + rw [disjoint_left] + rintro _ ⟨⟨y, rfl⟩, h1⟩ ⟨⟨y', he⟩, -⟩ + have he' : ψ y'.1 = ψ y.1 := he + have hy'F : y'.1 ∈ ψ ⁻¹' Fᶜ := by rwa [mem_preimage, he'] + have h2 : y'.1 = y.1 := hψ.2.2.1 hy'F h1 he' + exact disjoint_left.mp hdW y.2 (h2 ▸ y'.2) + have hPc : Z ⊆ P₁ ∪ P₂ := fun x hx => by + have hxF := disjoint_left.mp hd hx + obtain ⟨y, rfl⟩ := hψ.2.1 x + rcases (hU ▸ mem_univ y : y ∈ W₁ ∪ W₂) with h | h + · exact .inl ⟨⟨⟨y, h⟩, rfl⟩, hxF⟩ + · exact .inr ⟨⟨⟨y, h⟩, rfl⟩, hxF⟩ + rcases hZ.subset_or_subset hm₁.isOpen hm₂.isOpen hPd hPc with h | h + · exact side_result_two hT hY hO hFc hnn T hOX hOX' hne' hsc hc₁ hc₂ hcase h + · exact side_result_two hT hY hO hFc hnn T.symm hOX' hOX hne'.symm (by rw [hsc, + pair_comm]) hc₂ hc₁ hcase h + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Delete.lean b/LeanPool/GraphMinor/GM19/Section6Delete.lean new file mode 100644 index 0000000000..3064dbda9f --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Delete.lean @@ -0,0 +1,240 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Disc +public import LeanPool.GraphMinor.GM19.Section6a + +/-! +# Deleting a vertex lowers `rep` by at most one + +In the proof of (6.6) of Graph Minors XIX (page 341), the paper says `rep(H) ≥ k` for `H = G \ v`, +since `rep(G) > k`. Here is the reason. Let `F` be a non-null-homotopic `H`-normal O-arc. We put the +edges at `v` back one at a time. Each edge `e` has a thin disc `D` around it that meets the rest +only at its ends (`exists_edge_lens`). We reroute `F` around `D` along the boundary of `D`, by +`exists_reroute`, on the side that misses the other end of `e`. The only new vertex the curve can +meet is `v`. So `rep(G) ≤ rep(H) + 1` (`lt_rep_delete`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GM11 + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +/-- **Putting one edge back.** See the module docstring. -/ +theorem exists_curve_add_line (hT : IsClosedSurface S) {Z L : Set S} {u v : S} + (hL : IsLineWithEnds L u v) (huv : u ≠ v) (hZ : IsClosed Z) (hLZ : L ∩ Z ⊆ {u, v}) + (hu : u ∈ Z) {F : Set S} (hF : IsOArc F) + (hnn : ¬ IsNullHomotopicOArc F) : ∃ F', IsOArc F' ∧ ¬ IsNullHomotopicOArc F' ∧ F' ∩ (Z ∪ L) ⊆ + (F ∩ Z) ∪ {v} := by + classical + obtain ⟨D, -, -, hD, hLD, hDZ, -, -, hbL, -⟩ := exists_edge_lens hT hL huv hZ hLZ + by_cases hm : (F ∩ D).Nonempty + swap + · refine ⟨F, hF, hnn, ?_⟩ + rintro x ⟨hxF, hx | hx⟩ + · exact .inl ⟨hxF, hx⟩ + · exact absurd ⟨x, hxF, hLD hx⟩ hm + have hO := hD.isOArc_discBd + have hch : ∀ a b, ∃ P : Set S, a ∈ discBd D → b ∈ discBd D → P ⊆ discBd D ∧ (a ≠ b + → IsLineWithEnds P a b) ∧ (a = b → P = {a}) ∧ (u ∈ P → u = a ∨ u = b) := fun a b => by + by_cases ha : a ∈ discBd D + swap + · exact ⟨∅, fun h => absurd h ha⟩ + by_cases hb : b ∈ discBd D + swap + · exact ⟨∅, fun _ h => absurd h hb⟩ + by_cases hab : a = b + · refine ⟨{a}, fun _ _ => ⟨singleton_subset_iff.mpr ha, fun h => absurd hab h, fun _ => rfl, + fun h => .inl h⟩⟩ + obtain ⟨A, B, hA, hB, hAB, hi⟩ := hO.lines ha hb hab + by_cases huA : u ∈ A ∧ u ≠ a ∧ u ≠ b + · refine ⟨B, fun _ _ => ⟨hAB ▸ subset_union_right, fun _ => hB, fun h => absurd h hab, + fun h => ?_⟩⟩ + have : u ∈ A ∩ B := ⟨huA.1, h⟩ + rw [hi] at this + exact this + · refine ⟨A, fun _ _ => ⟨hAB ▸ subset_union_left, fun _ => hA, fun h => absurd h hab, + fun h => ?_⟩⟩ + by_contra hn + push Not at hn + exact huA ⟨h, hn.1, hn.2⟩ + choose P hP using hch + obtain ⟨C, a, b, hC, hCnn, haF, hbF, -, hCs⟩ := exists_reroute hT hD hF hnn hm P fun a ha b hb + => by + obtain ⟨h1, h2, h3, -⟩ := hP a b ha hb + exact ⟨h1.trans (Surface.discBd_subset D), h2, h3⟩ + refine ⟨C, hC, hCnn, ?_⟩ + obtain ⟨h1, -, -, h4⟩ := hP a b haF.2 hbF.2 + rintro x ⟨hxC, hxZ⟩ + rcases hCs hxC with hx | hx + · rcases hxZ with hxZ | hxZ + · exact .inl ⟨hx.1, hxZ⟩ + · exact absurd (hLD hxZ) hx.2 + · have hxbd := h1 hx + have hxuv : x = u ∨ x = v := by + rcases hxZ with hxZ | hxZ + · exact hDZ ⟨Surface.discBd_subset D hxbd, hxZ⟩ + · exact hbL ⟨hxbd, hxZ⟩ + rcases hxuv with rfl | rfl + · left + rcases h4 hx with h | h + · exact ⟨h ▸ haF.1, hu⟩ + · exact ⟨h ▸ hbF.1, hu⟩ + · exact .inr rfl + +/-- `G` with the vertices of `X` deleted, with all their edges. -/ +noncomputable def delete (G : Drawing S) (X : Set S) : Drawing S := + G.span (G.V \ X) {e | e ∈ G.E ∧ Disjoint (tilde e) X} + +theorem delete_E (G : Drawing S) (X : Set S) : (delete G X).E = {e | e ∈ G.E ∧ Disjoint + (tilde e) X} := by + rw [delete, Drawing.span_E] + exact inter_eq_left.mpr fun _ h => h.1 + +theorem delete_V (G : Drawing S) (X : Set S) : (delete G X).V = G.V \ X := by + rw [delete, Drawing.span_V] + apply Subset.antisymm + · refine union_subset (inter_subset_left.trans (Subset.refl _) |>.trans ?_) ?_ + · exact fun _ h => h + · refine iUnion₂_subset fun e he => ?_ + rintro y ⟨hy, hyV⟩ + have hyt : y ∈ tilde e := GM19.tilde_eq_inter_V G he.2 ▸ ⟨hy, hyV⟩ + exact ⟨hyV, fun h => Set.disjoint_left.mp he.1.2 hyt h⟩ + · exact fun y hy => .inl ⟨hy, hy.1⟩ + +theorem delete_U (G : Drawing S) (X : Set S) : (delete G X).U = (G.V \ X) ∪ ⋃ e ∈ {e | e ∈ G.E + ∧ Disjoint (tilde e) X}, closure e := by + have h1 : (delete G X).U = (delete G X).V ∪ ⋃ e ∈ (delete G X).E, closure e := by + rw [U_eq, sUnion_image] + rw [h1, delete_V, delete_E] + +theorem delete_subdrawing (G : Drawing S) (X : Set S) : (delete G X).IsSubdrawing G := + ⟨by rw [delete_V]; exact sdiff_subset, by rw [delete_E]; exact fun _ h => h.1⟩ + +/-- **`rep` falls by at most one when a vertex goes.** See the module docstring. -/ +theorem lt_rep_delete (hT : IsClosedSurface S) (G : Drawing S) (hl : LoopFree G) {v : S} + (hv : v ∈ G.V) {k : ℕ} (hk : (k : ℕ∞) < G.rep) : (k : ℕ∞) ≤ (delete G {v}).rep := by + classical + refine le_sInf ?_ + rintro _ ⟨F, hF, hn, hnull, rfl⟩ + let H := delete G {v} + have hE : ∀ e ∈ G.E, e ∉ H.E → v ∈ tilde e := fun e he hne => by + by_contra hv' + exact hne (by rw [delete_E]; exact ⟨he, Set.disjoint_singleton_right.mpr hv'⟩) + have hfinE : ∀ A : Finset (Set S), (∀ e ∈ A, e ∈ G.E ∧ e ∉ H.E) → ∃ F', IsOArc F' + ∧ ¬ IsNullHomotopicOArc F' ∧ F' ∩ (H.U ∪ {v} ∪ ⋃ e ∈ A, closure e) ⊆ (F ∩ H.U) ∪ {v} := by + intro A + induction A using Finset.induction_on with + | empty => + intro _ + refine ⟨F, hF, hnull, ?_⟩ + rintro x ⟨hxF, (hx | hx) | hx⟩ + · exact .inl ⟨hxF, hx⟩ + · exact .inr hx + · simp at hx + | insert e A heA ih => + intro hA + obtain ⟨F₁, hF₁, hn₁, hsub⟩ := ih fun f hf => hA f (Finset.mem_insert_of_mem hf) + obtain ⟨he, heH⟩ := hA e (Finset.mem_insert_self _ _) + obtain ⟨a, b, hab, hti, hline⟩ := hl e he + have hve : v ∈ tilde e := hE e he heH + obtain ⟨u, huv, hL, hti'⟩ : ∃ u, u ≠ v ∧ IsLineWithEnds (closure e) u v ∧ tilde e = {u, v} + := by + rw [hti] at hve + rcases hve with rfl | hve + · exact ⟨b, hab.symm, GraphMinor.GM11.IsLineWithEnds.symm hline, by rw [hti, pair_comm]⟩ + · rw [mem_singleton_iff.mp hve] + exact ⟨a, hab, mem_singleton_iff.mp hve ▸ hline, hti⟩ + have hhU : ∀ {x}, x ∈ H.U → x ∉ G.V → ∃ f ∈ H.E, x ∈ closure f := fun {x} hx hxV => by + rw [U_eq] at hx + rcases hx with hx | hx + · exact absurd ((delete_subdrawing G {v}).1 hx) hxV + · obtain ⟨_, ⟨f, hf, rfl⟩, hxf⟩ := hx + exact ⟨f, hf, hxf⟩ + let Z : Set S := H.U ∪ {v} ∪ ⋃ f ∈ A, closure f + have hZ : IsClosed Z := (H.isClosed_U.union isClosed_singleton).union + (A.finite_toSet.isClosed_biUnion fun _ _ => isClosed_closure) + have hLZ : closure e ∩ Z ⊆ {u, v} := by + rintro x ⟨hxe, hxZ⟩ + by_cases hxV : x ∈ G.V + · rw [← hti', GM19.tilde_eq_inter_V G he] + exact ⟨hxe, hxV⟩ + rcases hxZ with (hx | hx) | hx + · obtain ⟨f, hf, hxf⟩ := hhU hx hxV + have hfG := (delete_subdrawing G {v}).2 hf + exact absurd (edge_eq_of_mem G he hfG hxe hxf hxV ▸ hf) heH + · exact absurd (mem_singleton_iff.mp hx ▸ hv) hxV + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + exact absurd (edge_eq_of_mem G he (hA f (Finset.mem_insert_of_mem hf)).1 hxe hxf hxV ▸ + hf) heA + have huU : u ∈ Z := by + have hutilde : u ∈ tilde e := by rw [hti']; exact .inl rfl + have huV : u ∈ G.V := (GM19.tilde_eq_inter_V G he ▸ hutilde).2 + refine .inl (.inl (H.V_subset_U ?_)) + change u ∈ (delete G {v}).V + rw [delete_V] + exact ⟨huV, huv⟩ + obtain ⟨F₂, hF₂, hn₂, hsub₂⟩ := exists_curve_add_line hT hL huv hZ hLZ huU hF₁ hn₁ + refine ⟨F₂, hF₂, hn₂, ?_⟩ + rintro x ⟨hxF, hxZ⟩ + have hxZ' : x ∈ Z ∪ closure e := by + rcases hxZ with (hx | hx) | hx + · exact .inl (.inl (.inl hx)) + · exact .inl (.inl (.inr hx)) + · obtain ⟨f, hf, hxf⟩ := mem_iUnion₂.mp hx + rcases Finset.mem_insert.mp hf with rfl | hf + · exact .inr hxf + · exact .inl (.inr (mem_iUnion₂.mpr ⟨f, hf, hxf⟩)) + rcases hsub₂ ⟨hxF, hxZ'⟩ with h | h + · exact hsub ⟨h.1, h.2⟩ + · exact .inr h + have hfin : (G.E \ H.E).Finite := G.finite_edges.subset sdiff_subset + obtain ⟨F', hF', hn', hsub⟩ := + hfinE hfin.toFinset (fun e he => hfin.mem_toFinset.mp he) + have hGU : G.U ⊆ H.U ∪ {v} ∪ ⋃ e ∈ hfin.toFinset, closure e := fun x hx => by + by_cases hxV : x ∈ G.V + · by_cases hxv : x = v + · exact .inl (.inr hxv) + · refine .inl (.inl (H.V_subset_U ?_)) + change x ∈ (delete G {v}).V + rw [delete_V] + exact ⟨hxV, hxv⟩ + obtain ⟨e, he, hxe⟩ := exists_edge_of_mem G hx hxV + by_cases heH : e ∈ H.E + · exact .inl (.inl (H.closure_subset_U heH (subset_closure hxe))) + · exact .inr (mem_iUnion₂.mpr ⟨e, hfin.mem_toFinset.mpr ⟨he, heH⟩, subset_closure hxe⟩) + have hHV : H.V ⊆ G.V := (delete_subdrawing G {v}).1 + have hnF : ∀ {x}, x ∈ F' → x ∈ G.U → (x ∈ F ∩ H.V) ∨ x = v := fun {x} hxF hxU => by + rcases hsub ⟨hxF, hGU hxU⟩ with h | h + · exact .inl ⟨h.1, hn h⟩ + · exact .inr h + have hnormal : G.IsNormal F' := fun x hx => by + rcases hnF hx.1 hx.2 with h | h + · exact hHV h.2 + · exact h ▸ hv + have hrep := rep_le_of_arc G hF' hnormal hn' + have hcard : (F' ∩ G.V).ncard ≤ (F ∩ H.V).ncard + 1 := by + have hsub' : F' ∩ G.V ⊆ insert v (F ∩ H.V) := fun x hx => by + rcases hnF hx.1 (G.V_subset_U hx.2) with h | h + · exact .inr h + · exact .inl h + have hf : (F ∩ H.V).Finite := H.finite_V.subset inter_subset_right + calc _ ≤ (insert v (F ∩ H.V)).ncard := ncard_le_ncard hsub' (hf.insert v) + _ ≤ _ := ncard_insert_le _ _ + have h1 : (k : ℕ∞) < (((F ∩ H.V).ncard + 1 : ℕ) : ℕ∞) := lt_of_lt_of_le hk (hrep.trans + (by exact_mod_cast hcard)) + have h2 : k < (F ∩ H.V).ncard + 1 := by exact_mod_cast h1 + have h3 : k ≤ (F ∩ H.V).ncard := by omega + exact_mod_cast h3 + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Disc.lean b/LeanPool/GraphMinor/GM19/Section6Disc.lean new file mode 100644 index 0000000000..1d8bc52e4a --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Disc.lean @@ -0,0 +1,663 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Region + +/-! +# A path along a region inside a disc + +This file proves the step in claim (1) of the proof of (6.6) of Graph Minors XIX (page 342). There, +`F` is an O-arc made of a path of a drawing `G` and a line `L` through a region `r`, and `F` bounds +a disc `Δ`. The paper says that `r ∩ F` is connected, and so there is a path of `G ∩ (rBar ∩ Δ)` +between the ends `a, b` of `L`. + +We give the reason (`mem_of_closed_adj`). Suppose the part of `G` in `rBar ∩ Δ` splits into two +closed pieces, one with `a` and one with `b`. Cut `L` at a point `m`. Each piece with its half of +`L` fails to separate the region side of `L` from the outside of `Δ`, since one can cross the other +half of `L`. Two compact sets that meet in one point and do not separate two points do not separate +them together, by Janiszewski's theorem. But together they contain the frontier of the part of `r` +next to `L`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GM11 Metric + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +/-- The edges in `A`, as a set of points with their ends. -/ +def edgesIn (G : Drawing S) (A : Set S) (P : Set S → Prop) : Set S := + ⋃ e ∈ {e ∈ G.E | e ⊆ A ∧ P e}, closure e + +omit [T2Space S] in +theorem isClosed_edgesIn (G : Drawing S) (A : Set S) (P : Set S → Prop) : + IsClosed (edgesIn G A P) := by + have hfinite : {e ∈ G.E | e ⊆ A ∧ P e}.Finite := G.finite_edges.subset fun _ h => h.1 + exact hfinite.isClosed_biUnion fun _ _ => isClosed_closure + +/-- A point of `U(G)` in `rBar ∩ Δ` lies in a vertex or an edge of `G` in `rBar ∩ Δ`. -/ +theorem mem_edges_or_vertex (hT : IsClosedSurface S) (G : Drawing S) (hl : LoopFree G) {r Δ : Set + S} (hr : r ∈ G.regions) (hΔ : IsClosedDisc Δ) + (hedge : ∀ e ∈ G.E, (e ∩ discBd Δ).Nonempty → e ⊆ discBd Δ) {y : S} (hyU : y ∈ G.U) + (hyr : y ∈ closure r) (hyΔ : y ∈ Δ) : + y ∈ G.V ∨ ∃ e ∈ G.E, e ⊆ closure r ∩ Δ ∧ y ∈ e := by + by_cases hyV : y ∈ G.V + · exact .inl hyV + right + obtain ⟨e, he, hye⟩ := exists_edge_of_mem G hyU hyV + refine ⟨e, he, subset_inter (edge_subset_closure hT G hl he hr ⟨y, hye, hyr⟩) ?_, hye⟩ + by_cases hb : (e ∩ discBd Δ).Nonempty + · exact (hedge e he hb).trans (Surface.discBd_subset Δ) + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + have hc : IsPreconnected e := he.2.2.1.isConnected.isPreconnected + have hO : IsOpen (discInt Δ) := hΔ.isOpen_discInt hman + have hyI : y ∈ discInt Δ := ⟨hyΔ, fun h => hb ⟨y, hye, h⟩⟩ + have hC : IsOpen Δᶜ := hΔ.isClosed.isOpen_compl + intro w hw + by_contra hwΔ + obtain ⟨z, -, hz1, hz2⟩ := hc _ _ hO hC (fun x hx => by + by_cases h : x ∈ Δ + · exact .inl ⟨h, fun h' => hb ⟨x, hx, h'⟩⟩ + · exact .inr h) ⟨y, hye, hyI⟩ ⟨w, hw, hwΔ⟩ + exact hz2 hz1.1 + +omit [T2Space S] in +/-- The closure of a set inside the disc, seen through the chart. -/ +theorem chart_mem_closure {Δ : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart Δ h g) {A : Set S} + (hA : A ⊆ Δ) {y : S} (hy : y ∈ closure A) (hyΔ : y ∈ Δ) : + h y ∈ closure (h '' A) := + ((c.hc y hyΔ).mono hA).mem_closure_image hy + +omit [T2Space S] in +/-- The side of the line and the outside of the disc join across a part of the line. -/ +theorem isPreconnected_across {Δ : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart Δ h g) {A J : Set S} + (hA : IsPreconnected A) (hAΔ : A ⊆ Δ) (hJ : J ⊆ closure A) + (hJb : J ⊆ discBd Δ) (hne : J.Nonempty) : IsPreconnected (h '' A ∪ h '' J ∪ (closedBall + (0 : ℂ) 1)ᶜ) := by + have hbd : ∀ y ∈ J, h y ∈ sphere (0 : ℂ) 1 := fun y hy => c.bd ▸ mem_image_of_mem h (hJb hy) + have hJΔ : J ⊆ Δ := hJb.trans (Surface.discBd_subset Δ) + have h1 : IsPreconnected (h '' A ∪ h '' J) := (hA.image h (c.hc.mono hAΔ)).subset_closure + subset_union_left + (union_subset subset_closure (by + rintro _ ⟨y, hy, rfl⟩ + exact chart_mem_closure c hAΔ (hJ hy) (hJΔ hy))) + have hO : closure (closedBall (0 : ℂ) 1)ᶜ = (ball (0 : ℂ) 1)ᶜ := by + rw [closure_compl, interior_closedBall _ one_ne_zero] + have h2 : IsPreconnected ((closedBall (0 : ℂ) 1)ᶜ ∪ h '' J) := (isPreconnected_compl_closedBall 1 + zero_le_one).subset_closure subset_union_left + (union_subset subset_closure (by + rintro _ ⟨y, hy, rfl⟩ + rw [hO] + intro hb + have := hbd y hy + rw [mem_ball_zero_iff] at hb + rw [mem_sphere_zero_iff_norm] at this + linarith)) + obtain ⟨y, hy⟩ := hne + have h3 := h1.union' (s := h '' A ∪ h '' J) (t := (closedBall (0 : ℂ) 1)ᶜ ∪ h '' J) ⟨h y, .inr + ⟨y, hy, rfl⟩, .inr ⟨y, hy, rfl⟩⟩ h2 + have e : h '' A ∪ h '' J ∪ ((closedBall (0 : ℂ) 1)ᶜ ∪ h '' J) = h '' A ∪ h '' J ∪ (closedBall + (0 : ℂ) 1)ᶜ := by + ext z + simp only [mem_union] + tauto + rwa [e] at h3 + +private theorem crosscut_subset_region_closure + {S : Type} + [TopologicalSpace S] + {r : Set S} + {L : Set S} + {a : S} + {b : S} + (hLr : L \ {a, b} ⊆ r) + (c : ↑unitInterval → S) + (hc : IsArcMap c) + (hcr : range c = L) + (c0 : c 0 = a) + (c1 : c 1 = b) : + L ⊆ closure r := by + rw [← hcr] + rintro _ ⟨t, rfl⟩ + have hopen : ∀ s : unitInterval, 0 < s → s < 1 → c s ∈ r := fun s h0 h1 + => hLr ⟨hcr ▸ mem_range_self s, fun h => by + rcases h with h | h + · exact (ne_of_gt h0) (hc.2 (h.trans c0.symm)) + · exact (ne_of_lt h1) (hc.2 (h.trans c1.symm))⟩ + have hIoo : Ioo (0 : unitInterval) 1 ⊆ c ⁻¹' r := fun s hs => hopen s hs.1 hs.2 + have hcl : t ∈ closure (Ioo (0 : unitInterval) 1) := by + rw [closure_Ioo (by simp)] + exact ⟨unitInterval.nonneg', unitInterval.le_one'⟩ + exact closure_mono (image_subset_iff.mpr hIoo) (mem_closure_image hc.1.continuousAt hcl) + +private theorem selected_edges_in_region_drawing + {S : Type} + [TopologicalSpace S] + (G : Drawing S) + {Y : Set S} + (A₀ : Set S) + (hcle : ∀ {e : Set S}, e ⊆ A₀ → closure e ⊆ A₀) : + (Y ∩ (G.V ∩ A₀) ∪ edgesIn G A₀ fun e => (tilde e ∩ Y).Nonempty) ⊆ A₀ ∩ G.U := by + let Sa := Y ∩ (G.V ∩ A₀) ∪ edgesIn G A₀ fun e => (tilde e ∩ Y).Nonempty + rintro y (⟨-, hV, hy⟩ | hy) + · exact ⟨hy, G.V_subset_U hV⟩ + · obtain ⟨e, he, hye⟩ := mem_iUnion₂.mp hy + exact ⟨hcle he.2.1 hye, G.closure_subset_U he.1 hye⟩ + +private theorem remaining_edges_in_region_drawing + {S : Type} + [TopologicalSpace S] + (G : Drawing S) + {Y : Set S} + (A₀ : Set S) + (hcle : ∀ {e : Set S}, e ⊆ A₀ → closure e ⊆ A₀) : + ((G.V ∩ A₀) \ Y ∪ edgesIn G A₀ fun e => ¬(tilde e ∩ Y).Nonempty) ⊆ A₀ ∩ G.U := by + let Sb := (G.V ∩ A₀) \ Y ∪ edgesIn G A₀ fun e => ¬(tilde e ∩ Y).Nonempty + rintro y (⟨⟨hV, hy⟩, -⟩ | hy) + · exact ⟨hy, G.V_subset_U hV⟩ + · obtain ⟨e, he, hye⟩ := mem_iUnion₂.mp hy + exact ⟨hcle he.2.1 hye, G.closure_subset_U he.1 hye⟩ + +private theorem drawing_covered_by_edge_partition + {S : Type} + [TopologicalSpace S] + [T2Space S] + (hT : IsClosedSurface S) + (G : Drawing S) + (hl : LoopFree G) + {r : Set S} + {Δ : Set S} + (hr : r ∈ G.regions) + (hΔ : IsClosedDisc Δ) + (hedge : ∀ e ∈ Drawing.E G, (e ∩ discBd Δ).Nonempty → e ⊆ discBd Δ) + {Y : Set S} + (y : S) + (hyU : y ∈ G.U) + (hyr : y ∈ closure r) + (hyΔ : y ∈ Δ) : + y ∈ (Y ∩ (G.V ∩ (closure r ∩ Δ)) ∪ + edgesIn G (closure r ∩ Δ) fun e => (tilde e ∩ Y).Nonempty) ∪ ((G.V ∩ (closure r ∩ Δ)) \ Y ∪ + edgesIn G (closure r ∩ Δ) fun e => ¬(tilde e ∩ Y).Nonempty) := by + let Sa := Y ∩ (G.V ∩ (closure r ∩ Δ)) ∪ edgesIn G (closure r ∩ Δ) fun e => (tilde e ∩ Y).Nonempty + let Sb := (G.V ∩ (closure r ∩ Δ)) \ Y ∪ edgesIn G (closure r ∩ Δ) fun e => ¬(tilde e ∩ Y).Nonempty + rcases mem_edges_or_vertex hT G hl hr hΔ hedge hyU hyr hyΔ with hyV | ⟨e, he, hsub, hye⟩ + · by_cases hyY : y ∈ Y + · exact .inl (.inl ⟨hyY, hyV, hyr, hyΔ⟩) + · exact .inr (.inl ⟨⟨hyV, hyr, hyΔ⟩, hyY⟩) + · by_cases hP : (tilde e ∩ Y).Nonempty + · exact .inl (.inr (mem_iUnion₂.mpr ⟨e, ⟨he, hsub, hP⟩, subset_closure hye⟩)) + · exact .inr (.inr (mem_iUnion₂.mpr ⟨e, ⟨he, hsub, hP⟩, subset_closure hye⟩)) + +private theorem connected_crosscut_side + {S : Type} + [TopologicalSpace S] + [T2Space S] + (G : Drawing S) + {r : Set S} + {Δ : Set S} + {L : Set S} + (hΔ : IsClosedDisc Δ) + {a : S} + {b : S} + (hbU : discBd Δ ⊆ G.U ∪ L) + (hro : IsOpen r) + (hrA : ∀ (A : Set S), IsPreconnected A → Disjoint A G.U → (A ∩ r).Nonempty → A ⊆ r) + (ha : a ∈ L) + (hb : b ∈ L) + (m : S) + (hmr : m ∈ r) + (hmL : m ∈ L) + (D : Set S) + (hDZ : D ∩ G.U ⊆ {a, b}) + (hIo : IsOpen (discInt Δ)) + (y : S) + (hyI : y ∈ discInt Δ) + {C : Set S} + (hCD : C ⊆ D) + (hCc : IsPreconnected C) + (hCL : Disjoint C L) + (hLC : L ⊆ closure C) + (hyC : y ∈ C) : + C ⊆ discInt Δ ∧ C ⊆ r ∧ Disjoint C G.U := by + have hCU : Disjoint C G.U := Set.disjoint_left.mpr fun z hz hzU => by + rcases hDZ ⟨hCD hz, hzU⟩ with h' | h' + · exact Set.disjoint_left.mp hCL hz (h' ▸ ha) + · exact Set.disjoint_left.mp hCL hz (h' ▸ hb) + have hCr : C ⊆ r := hrA C hCc hCU (by + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp (hLC hmL) r hro hmr + exact ⟨w, hw2, hw1⟩) + refine ⟨fun z hz => ?_, hCr, hCU⟩ + have hbdC : ∀ w ∈ C, w ∉ discBd Δ := fun w hw hwb => by + rcases hbU hwb with h' | h' + · exact Set.disjoint_left.mp hCU hw h' + · exact Set.disjoint_left.mp hCL hw h' + by_contra hzI + have hzΔ : z ∉ Δ := fun h' => hzI ⟨h', hbdC z hz⟩ + obtain ⟨w, -, hw1, hw2⟩ := hCc _ _ hIo hΔ.isClosed.isOpen_compl (fun w hw => by + by_cases h' : w ∈ Δ + · exact .inl ⟨h', hbdC w hw⟩ + · exact .inr h') ⟨y, hyC, hyI⟩ ⟨z, hz, hzΔ⟩ + exact hw2 hw1.1 + +private theorem disc_side_joined_to_exterior + {S : Type} + [TopologicalSpace S] + {Δ : Set S} + {L : Set S} + (hLb : L ⊆ discBd Δ) + (h : S → ℂ) + (g : ℂ → S) + (cc : IsChart Δ h g) + (Sd : Set S) + (hSdc : IsPreconnected Sd) + (hLSd : L ⊆ closure Sd) + (hSdΔ : Sd ⊆ Δ) + (hhi : InjOn h Δ) + (x₀ : S) + (hx₀ : x₀ ∈ Sd) + (hnorm : ∀ z ∈ Δ, ‖h z‖ ≤ 1) + (hp : (2 : ℂ) ∈ (closedBall 0 1)ᶜ) + (K : Set S) + (J : Set S) + (hK : K ⊆ Δ) + (hJ : J ⊆ L) + (hJn : J.Nonempty) + (hJK : Disjoint J K) + (hSK : Disjoint Sd K) : + 2 ∈ connectedComponentIn (h '' K)ᶜ (h x₀) := by + let O : Set ℂ := (closedBall 0 1)ᶜ + have hc' := isPreconnected_across cc hSdc hSdΔ (hJ.trans hLSd) (hJ.trans hLb) hJn + refine hc'.subset_connectedComponentIn (x := h x₀) (.inl (.inl ⟨x₀, hx₀, rfl⟩)) ?_ (.inr hp) + rintro z (( ⟨w, hw, rfl⟩ | ⟨w, hw, rfl⟩) | hz) ⟨w', hw', he⟩ + · exact Set.disjoint_left.mp hSK hw (hhi (hK hw') (hSdΔ hw) he ▸ hw') + · exact Set.disjoint_left.mp hJK hw (hhi (hK hw') ((hJ.trans hLb).trans + (Surface.discBd_subset Δ) hw) he ▸ hw') + · exact hz (by rw [← he]; simpa using hnorm w' (hK hw')) + +private theorem side_compacts_intersect_at_midpoint {S : Type} {Δ L : Set S} {a b m : S} + {L₁ L₂ Sa Sb : Set S} (hL₁ : L₁ ⊆ L) (hL₂ : L₂ ⊆ L) + (hm₁ : m ∈ L₁) (hm₂ : m ∈ L₂) (hm12 : L₁ ∩ L₂ ⊆ {m}) + (hbnL₁ : b ∉ L₁) (hanL₂ : a ∉ L₂) + (hSdis : ∀ z ∈ Sa, z ∈ Sb → False) (hSaL : ∀ z ∈ Sa, z ∈ L → z = a) + (hSbL : ∀ z ∈ Sb, z ∈ L → z = b) + (h : S → ℂ) (hhi : InjOn h Δ) (hK₁ : Sa ∪ L₁ ⊆ Δ) (hK₂ : Sb ∪ L₂ ⊆ Δ) : + h '' (Sa ∪ L₁) ∩ h '' (Sb ∪ L₂) = {h m} := by + apply Subset.antisymm + · rintro _ ⟨⟨w, hw, rfl⟩, ⟨w', hw', he⟩⟩ + have := hhi (hK₂ hw') (hK₁ hw) he + subst this + have hwm : w' = m := by + rcases hw with hw | hw <;> rcases hw' with hw' | hw' + · exact (hSdis _ hw hw').elim + · exact absurd (hSaL _ hw (hL₂ hw') ▸ hw') hanL₂ + · exact absurd (hSbL _ hw' (hL₁ hw) ▸ hw) hbnL₁ + · exact hm12 ⟨hw, hw'⟩ + rw [hwm] + rfl + · rintro _ rfl + exact ⟨⟨m, .inr hm₁, rfl⟩, ⟨m, .inr hm₂, rfl⟩⟩ + +private theorem edge_partitions_disjoint + {S : Type} + [TopologicalSpace S] + (G : Drawing S) + {Y : Set S} + (A₀ : Set S) + (hSaV : ∀ y ∈ (Y ∩ (G.V ∩ A₀) ∪ edgesIn G A₀ fun e => (tilde e ∩ + Y).Nonempty), y ∈ G.V → y ∈ Y) + (hSbV : ∀ y ∈ ((G.V ∩ A₀) \ Y ∪ edgesIn G A₀ fun e => ¬(tilde e ∩ + Y).Nonempty), y ∈ G.V → y ∉ Y) + (z : S) + (hza : z ∈ (Y ∩ (G.V ∩ A₀) ∪ edgesIn G A₀ fun e => (tilde e ∩ + Y).Nonempty)) + (hzb : z ∈ ((G.V ∩ A₀) \ Y ∪ edgesIn G A₀ fun e => ¬(tilde e ∩ + Y).Nonempty)) : + False := by + let Sa := Y ∩ (G.V ∩ A₀) ∪ edgesIn G A₀ fun e => (tilde e ∩ Y).Nonempty + let Sb := (G.V ∩ A₀) \ Y ∪ edgesIn G A₀ fun e => ¬(tilde e ∩ Y).Nonempty + by_cases hzV : z ∈ G.V + · exact hSbV z hzb hzV (hSaV z hza hzV) + rcases hza with hza | hza + · exact hzV hza.2.1 + rcases hzb with hzb | hzb + · exact hzV hzb.1.1 + obtain ⟨e, he, hze⟩ := mem_iUnion₂.mp hza + obtain ⟨f, hf, hzf⟩ := mem_iUnion₂.mp hzb + have := edge_eq_of_mem G he.1 hf.1 hze hzf hzV + subst this + exact hf.2.2 he.2.2 + +private theorem exterior_component_cannot_cross_region + {S : Type} + [TopologicalSpace S] + (G : Drawing S) + {r : Set S} + {Δ : Set S} + {L : Set S} + (hbU : discBd Δ ⊆ G.U ∪ L) + (hro : IsOpen r) + (hrF : closure r \ r ⊆ G.U) + (L₁ : Set S) + (L₂ Sa Sb : Set S) + (hL12 : L = L₁ ∪ L₂) + (hcover : ∀ y ∈ G.U, y ∈ closure r → y ∈ Δ → y ∈ Sa ∪ Sb) + (h : S → ℂ) + (g : ℂ → S) + (cc : IsChart Δ h g) + (Sd : Set S) + (hSdI : Sd ⊆ discInt Δ) + (hSdr : Sd ⊆ r) + (hSdΔ : Sd ⊆ Δ) + (x₀ : S) + (hx₀ : x₀ ∈ Sd) + (hsep : ∀ (K J : Set S), K ⊆ Δ → J ⊆ L → J.Nonempty → Disjoint J K → Disjoint Sd K → 2 ∈ + connectedComponentIn (h '' K)ᶜ (h x₀)) + (hx₀S : ∀ {T : Set S}, T ⊆ G.U ∪ L → x₀ ∉ T) + (hJ₂ : 2 ∈ connectedComponentIn (h '' (Sa ∪ L₁))ᶜ (h x₀)) + (hJ₁ : 2 ∈ connectedComponentIn (h '' (Sb ∪ L₂))ᶜ (h x₀)) + (hq₁ : h x₀ ∉ h '' (Sa ∪ L₁) ∪ h + '' (Sb ∪ L₂)) + (hjan : 2 ∈ connectedComponentIn (h '' (Sa ∪ L₁) ∪ h '' (Sb + ∪ L₂))ᶜ (h x₀)) : + False := by + let K₁ := Sa ∪ L₁ + let K₂ := Sb ∪ L₂ + /- The part of `r` next to `L` in the plane. -/ + let Ω : Set ℂ := ball 0 1 ∩ g ⁻¹' r + have hΩ : IsOpen Ω := (cc.gc.mono ball_subset_closedBall).isOpen_inter_preimage isOpen_ball hro + let R := connectedComponentIn Ω (h x₀) + have hROpen : IsOpen R := hΩ.connectedComponentIn + have hqΩ : h x₀ ∈ Ω := by + refine ⟨?_, ?_⟩ + · have h1 : x₀ ∈ g '' ball 0 1 := cc.discInt_eq ▸ hSdI hx₀ + obtain ⟨w, hw, rfl⟩ := h1 + rw [cc.hg (ball_subset_closedBall hw)] + exact hw + · change g (h x₀) ∈ r + rw [cc.gh (hSdΔ hx₀)] + exact hSdr hx₀ + have hqR : h x₀ ∈ R := mem_connectedComponentIn hqΩ + have hRΩ : R ⊆ Ω := connectedComponentIn_subset _ _ + have hconn : IsPreconnected (connectedComponentIn (h '' K₁ ∪ h '' K₂)ᶜ (h x₀)) + := isPreconnected_connectedComponentIn + have hpR : (2 : ℂ) ∉ R := fun h' => by + have := (hRΩ h').1 + rw [mem_ball_zero_iff] at this + norm_num at this + obtain ⟨z, hzK, hzR, hzcl⟩ : ∃ z, z ∈ connectedComponentIn (h '' K₁ ∪ h '' K₂)ᶜ (h x₀) ∧ z ∉ R + ∧ z ∈ closure R := by + by_contra hno + push Not at hno + obtain ⟨w, -, hw1, hw2⟩ := hconn R (closure R)ᶜ hROpen isClosed_closure.isOpen_compl (fun w hw + => by + by_cases hwR : w ∈ R + · exact .inl hwR + · exact .inr (hno w hw hwR)) ⟨h x₀, mem_connectedComponentIn hq₁, hqR⟩ ⟨2, hjan, + hno 2 hjan hpR⟩ + exact hw2 (subset_closure hw1) + have hzn : z ∉ h '' K₁ ∪ h '' K₂ := connectedComponentIn_subset _ _ hzK + have hzb : z ∈ closedBall (0 : ℂ) 1 := by + have : closure R ⊆ closure (ball (0 : ℂ) 1) := closure_mono fun w hw => (hRΩ hw).1 + rw [closure_ball _ one_ne_zero] at this + exact this hzcl + have hyΔ : g z ∈ Δ := cc.gm hzb + have hhg : h (g z) = z := cc.hg hzb + have hyr : g z ∈ closure r := by + have h1 := ((cc.gc z hzb).mono fun w hw => ball_subset_closedBall + (hRΩ hw).1).mem_closure_image hzcl + exact closure_mono (image_subset_iff.mpr fun w hw => (hRΩ hw).2) h1 + by_cases hyU : g z ∈ G.U + · rcases hcover _ hyU hyr hyΔ with h' | h' + · exact hzn (.inl ⟨g z, .inl h', hhg⟩) + · exact hzn (.inr ⟨g z, .inl h', hhg⟩) + have hyrr : g z ∈ r := by + by_contra hn + exact hyU (hrF ⟨hyr, hn⟩) + have hzball : z ∈ ball (0 : ℂ) 1 := by + by_contra hn + have hzs : z ∈ sphere (0 : ℂ) 1 := by + rw [mem_sphere_zero_iff_norm] + rw [mem_ball_zero_iff, not_lt] at hn + rw [mem_closedBall_zero_iff] at hzb + linarith + rw [← cc.bd] at hzs + obtain ⟨w, hw, he⟩ := hzs + have hgw : g z = w := by rw [← he, cc.gh (Surface.discBd_subset Δ hw)] + rw [← hgw] at hw + rcases hbU hw with h' | h' + · exact hyU h' + · rw [hL12] at h' + rcases h' with h' | h' + · exact hzn (.inl ⟨g z, .inr h', hhg⟩) + · exact hzn (.inr ⟨g z, .inr h', hhg⟩) + have hzΩ : z ∈ Ω := ⟨hzball, hyrr⟩ + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp hzcl _ hΩ.connectedComponentIn + (mem_connectedComponentIn hzΩ) + have e : connectedComponentIn Ω (h x₀) = connectedComponentIn Ω z := + (connectedComponentIn_eq hw2).trans (connectedComponentIn_eq hw1).symm + exact hzR (by + change z ∈ connectedComponentIn Ω (h x₀) + rw [e] + exact mem_connectedComponentIn hzΩ) + +/-- **Two vertices along a region are joined inside the disc.** See the module docstring. The set +`Y` is closed under the edges of `G` in `rBar ∩ Δ`. -/ +theorem mem_of_closed_adj (hT : IsClosedSurface S) (G : Drawing S) (hl : LoopFree G) {r Δ L : Set + S} (hr : r ∈ G.regions) (hΔ : IsClosedDisc Δ) {a b : S} (hab : a ≠ b) + (hL : IsLineWithEnds L a b) (hLr : L \ {a, b} ⊆ r) (hLb : L ⊆ discBd Δ) + (hbU : discBd Δ ⊆ G.U ∪ L) (hedge : ∀ e ∈ G.E, (e ∩ discBd Δ).Nonempty → e ⊆ discBd Δ) + (haV : a ∈ G.V) (hbV : b ∈ G.V) {Y : Set S} (haY : a ∈ Y) (hstep : ∀ e ∈ G.E, e ⊆ closure r ∩ Δ + → ∀ x ∈ tilde e, ∀ y ∈ tilde e, x ∈ Y → y ∈ Y) : b ∈ Y := by + classical + by_contra hbY + have hcpt : CompactSpace S := hT.1 + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hT + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + obtain ⟨hro, -, -, hrU, hrA, hrF⟩ := region_props G hr + have hrU' : ∀ {y}, y ∈ r → y ∉ G.U := fun hy hyU => Set.disjoint_left.mp hrU hy hyU + obtain ⟨c, hc, hcr, c0, c1⟩ := hL.exists_arc + have ha : a ∈ L := hcr ▸ c0 ▸ mem_range_self _ + have hb : b ∈ L := hcr ▸ c1 ▸ mem_range_self _ + have hLU : L ∩ G.U ⊆ {a, b} := fun y hy => by + by_contra hn + exact hrU' (hLr ⟨hy.1, hn⟩) hy.2 + have hLc : L ⊆ closure r := by + exact crosscut_subset_region_closure (S := S) (r := r) (L := L) (a := a) (b := b) hLr c hc hcr + c0 c1 + let half : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + have h0h : (0 : unitInterval) < half := by + change (0 : ℝ) < 1 / 2 + norm_num + have hh1 : half < (1 : unitInterval) := by + change (1 / 2 : ℝ) < 1 + norm_num + let m := c half + have hmr : m ∈ r := hLr ⟨hcr ▸ mem_range_self half, fun h => by + rcases h with h | h + · exact (ne_of_gt h0h) (hc.2 (h.trans c0.symm)) + · exact (ne_of_lt hh1) (hc.2 (h.trans c1.symm))⟩ + have hmL : m ∈ L := hcr ▸ mem_range_self half + let L₁ := c '' Iic half + let L₂ := c '' Ici half + have hL12 : L = L₁ ∪ L₂ := by + rw [← hcr, ← image_union, Iic_union_Ici, image_univ] + have hL₁ : L₁ ⊆ L := by rw [hL12]; exact subset_union_left + have hL₂ : L₂ ⊆ L := by rw [hL12]; exact subset_union_right + have hm12 : L₁ ∩ L₂ ⊆ {m} := by + rintro _ ⟨⟨s, hs, rfl⟩, ⟨t, ht, he⟩⟩ + have := hc.2 he + subst this + exact congrArg c (le_antisymm hs ht) + have hbnL₁ : b ∉ L₁ := by + rintro ⟨s, hs, he⟩ + have : s = 1 := hc.2 (he.trans c1.symm) + subst this + exact not_le.mpr hh1 hs + have hanL₂ : a ∉ L₂ := by + rintro ⟨s, hs, he⟩ + have : s = 0 := hc.2 (he.trans c0.symm) + subst this + exact not_le.mpr h0h hs + have haL₁ : a ∈ L₁ := ⟨0, unitInterval.nonneg', c0⟩ + have hbL₂ : b ∈ L₂ := ⟨1, unitInterval.le_one', c1⟩ + /- The two pieces of the part of `G` in `rBar ∩ Δ`. -/ + let A₀ : Set S := closure r ∩ Δ + have hA₀ : IsClosed A₀ := isClosed_closure.inter hΔ.isClosed + let Sa : Set S := (Y ∩ (G.V ∩ A₀)) ∪ edgesIn G A₀ fun e => (tilde e ∩ Y).Nonempty + let Sb : Set S := ((G.V ∩ A₀) \ Y) ∪ edgesIn G A₀ fun e => ¬ (tilde e ∩ Y).Nonempty + have hVc : IsClosed G.V := G.finite_V.isClosed + have hfin : (G.V ∩ A₀).Finite := G.finite_V.subset inter_subset_left + have hSac : IsClosed Sa := (hfin.subset inter_subset_right).isClosed.union + (isClosed_edgesIn _ _ _) + have hSbc : IsClosed Sb := (hfin.subset sdiff_subset).isClosed.union (isClosed_edgesIn _ _ _) + have hcle : ∀ {e : Set S}, e ⊆ A₀ → closure e ⊆ A₀ := fun h => closure_minimal h hA₀ + have hSasub : Sa ⊆ A₀ ∩ G.U := by + exact selected_edges_in_region_drawing (S := S) G (Y := Y) A₀ hcle + have hSbsub : Sb ⊆ A₀ ∩ G.U := by + exact remaining_edges_in_region_drawing (S := S) G (Y := Y) A₀ hcle + have hclV : ∀ {e : Set S}, e ∈ G.E → ∀ {y}, y ∈ closure e → y ∈ G.V → y ∈ tilde e + := fun he _ hy hyV => GM19.tilde_eq_inter_V G he ▸ ⟨hy, hyV⟩ + have hSaV : ∀ y ∈ Sa, y ∈ G.V → y ∈ Y := by + rintro y (⟨hy, -⟩ | hy) hyV + · exact hy + · obtain ⟨e, he, hye⟩ := mem_iUnion₂.mp hy + obtain ⟨x, hx, hxY⟩ := he.2.2 + exact hstep e he.1 he.2.1 x hx y (hclV he.1 hye hyV) hxY + have hSbV : ∀ y ∈ Sb, y ∈ G.V → y ∉ Y := by + rintro y (⟨-, hy⟩ | hy) hyV hyY + · exact hy hyY + · obtain ⟨e, he, hye⟩ := mem_iUnion₂.mp hy + exact he.2.2 ⟨y, hclV he.1 hye hyV, hyY⟩ + have hSdis : ∀ z, z ∈ Sa → z ∈ Sb → False := fun z hza hzb => by + exact edge_partitions_disjoint (S := S) G (Y := Y) A₀ hSaV hSbV z hza hzb + have hSaL : ∀ z ∈ Sa, z ∈ L → z = a := fun z hz hzL => by + rcases hLU ⟨hzL, (hSasub hz).2⟩ with h | h + · exact h + · exact absurd (h ▸ hSaV z hz (h ▸ hbV)) hbY + have hSbL : ∀ z ∈ Sb, z ∈ L → z = b := fun z hz hzL => by + rcases hLU ⟨hzL, (hSbsub hz).2⟩ with h | h + · exact absurd haY (h ▸ hSbV z hz (h ▸ haV)) + · exact h + have hcover : ∀ y, y ∈ G.U → y ∈ closure r → y ∈ Δ → y ∈ Sa ∪ Sb := fun y hyU hyr hyΔ => by + exact drawing_covered_by_edge_partition (S := S) hT G hl (r := r) (Δ := Δ) hr hΔ hedge (Y := + Y) y hyU hyr hyΔ + /- The two sides of `L`, and the side inside `Δ`. -/ + obtain ⟨D, A, B, hD, hLD, hDZ, -, -, hbL, hDe, hAc, hBc, hAn, hBn, hAL, hBL, hLA, hLB, -⟩ + := exists_edge_lens hT hL hab G.isClosed_U hLU + obtain ⟨h, g, cc⟩ := hΔ.exists_isChart + have hmbd : m ∉ discBd D := fun hm => by + rcases hbL ⟨hm, hmL⟩ with h' | h' + · exact (ne_of_gt h0h) (hc.2 (h'.trans c0.symm)) + · exact (ne_of_lt hh1) (hc.2 (h'.trans c1.symm)) + have hmcl : m ∈ closure (discInt Δ) := by + have hmΔ : m ∈ Δ := Surface.discBd_subset Δ (hLb hmL) + have h1 : h m ∈ closure (ball (0 : ℂ) 1) := by + rw [closure_ball _ one_ne_zero] + exact cc.hm hmΔ + have h2 := ((cc.gc (h m) (cc.hm hmΔ)).mono ball_subset_closedBall).mem_closure_image h1 + rwa [cc.gh hmΔ, ← cc.discInt_eq] at h2 + have hIo : IsOpen (discInt Δ) := hΔ.isOpen_discInt hman + obtain ⟨y, hyD, hyI⟩ := mem_closure_iff.mp hmcl _ (hD.isOpen_discInt hman) ⟨hLD hmL, hmbd⟩ + have hyL : y ∉ L := fun h' => hyI.2 (hLb h') + have hmem : ∀ {C : Set S}, C ⊆ D → IsPreconnected C → Disjoint C L → L ⊆ closure C → (y ∈ C) → + C ⊆ discInt Δ ∧ C ⊆ r ∧ Disjoint C G.U := fun {C} hCD hCc hCL hLC hyC => by + exact connected_crosscut_side (S := S) G (r := r) (Δ := Δ) (L := L) hΔ (a := a) (b := b) hbU + hro hrA ha hb m hmr hmL D hDZ hIo y hyI (C := C) hCD hCc hCL hLC hyC + obtain ⟨Sd, hSdc, hSdL, hLSd, hSdI, hSdr, hSdU, hSdne⟩ : ∃ Sd, IsPreconnected Sd ∧ Disjoint Sd L + ∧ L ⊆ closure Sd ∧ Sd ⊆ discInt Δ ∧ Sd ⊆ r ∧ Disjoint Sd G.U ∧ Sd.Nonempty := by + have hy' : y ∈ A ∪ B ∪ L := hDe ▸ hyD.1 + rcases hy' with (hyA | hyB) | h' + · have hAD : A ⊆ D := by rw [hDe]; exact fun z hz => .inl (.inl hz) + obtain ⟨h1, h2, h3⟩ := hmem hAD hAc hAL hLA hyA + exact ⟨A, hAc, hAL, hLA, h1, h2, h3, hAn⟩ + · have hBD : B ⊆ D := by rw [hDe]; exact fun z hz => .inl (.inr hz) + obtain ⟨h1, h2, h3⟩ := hmem hBD hBc hBL hLB hyB + exact ⟨B, hBc, hBL, hLB, h1, h2, h3, hBn⟩ + · exact absurd h' hyL + /- Now we are in the plane. -/ + have hSdΔ : Sd ⊆ Δ := fun z hz => (hSdI hz).1 + have hhi : InjOn h Δ := fun x hx y hy he => by + have := congrArg g he + rwa [cc.gh hx, cc.gh hy] at this + obtain ⟨x₀, hx₀⟩ := hSdne + have hnorm : ∀ z ∈ Δ, ‖h z‖ ≤ 1 := fun z hz => by simpa using cc.hm hz + let O : Set ℂ := (closedBall (0 : ℂ) 1)ᶜ + have hp : (2 : ℂ) ∈ O := by simp [O] + have hpK : ∀ K : Set S, K ⊆ Δ → (2 : ℂ) ∉ h '' K := by + rintro K hK ⟨z, hz, he⟩ + have := hnorm z (hK hz) + rw [he] at this + norm_num at this + have hsep : ∀ K J : Set S, K ⊆ Δ → J ⊆ L → J.Nonempty → Disjoint J K → Disjoint Sd K → + (2 : ℂ) ∈ connectedComponentIn (h '' K)ᶜ (h x₀) := fun K J hK hJ hJn hJK hSK => by + exact disc_side_joined_to_exterior (S := S) (Δ := Δ) (L := L) hLb h g cc Sd hSdc hLSd hSdΔ hhi + x₀ hx₀ hnorm hp K J hK hJ hJn hJK hSK + let K₁ : Set S := Sa ∪ L₁ + let K₂ : Set S := Sb ∪ L₂ + have hLΔ : L ⊆ Δ := hLb.trans (Surface.discBd_subset Δ) + have hK₁ : K₁ ⊆ Δ := union_subset (fun z hz => (hSasub hz).1.2) (hL₁.trans hLΔ) + have hK₂ : K₂ ⊆ Δ := union_subset (fun z hz => (hSbsub hz).1.2) (hL₂.trans hLΔ) + have hcompK : ∀ {K : Set S}, IsClosed K → K ⊆ Δ → IsCompact (h '' K) := fun hK hsub + => hK.isCompact.image_of_continuousOn (cc.hc.mono hsub) + have hclL₁ : IsClosed L₁ := (isClosed_Iic.isCompact.image hc.1).isClosed + have hclL₂ : IsClosed L₂ := (isClosed_Ici.isCompact.image hc.1).isClosed + have hx₀S : ∀ {T : Set S}, T ⊆ G.U ∪ L → x₀ ∉ T := fun hT' hin => by + rcases hT' hin with h' | h' + · exact Set.disjoint_left.mp hSdU hx₀ h' + · exact Set.disjoint_left.mp hSdL hx₀ h' + have hK₁U : K₁ ⊆ G.U ∪ L := union_subset (fun z hz => .inl (hSasub hz).2) + (hL₁.trans subset_union_right) + have hK₂U : K₂ ⊆ G.U ∪ L := union_subset (fun z hz => .inl (hSbsub hz).2) + (hL₂.trans subset_union_right) + have hSdK : ∀ {K : Set S}, K ⊆ G.U ∪ L → Disjoint Sd K := fun hK => Set.disjoint_left.mpr fun z + hz hzK => by + rcases hK hzK with h' | h' + · exact Set.disjoint_left.mp hSdU hz h' + · exact Set.disjoint_left.mp hSdL hz h' + have hJ₂ : (2 : ℂ) ∈ connectedComponentIn (h '' K₁)ᶜ (h x₀) := hsep K₁ (L₂ \ {m}) hK₁ + (sdiff_subset.trans hL₂) + ⟨b, hbL₂, fun h' => hbnL₁ (mem_singleton_iff.mp h' ▸ ⟨half, le_rfl, rfl⟩)⟩ + (Set.disjoint_left.mpr fun z hz hzK => by + rcases hzK with h' | h' + · have hz1 := hSaL z h' (hL₂ hz.1) + exact hanL₂ (hz1 ▸ hz.1) + · exact hz.2 (hm12 ⟨h', hz.1⟩)) (hSdK hK₁U) + have hJ₁ : (2 : ℂ) ∈ connectedComponentIn (h '' K₂)ᶜ (h x₀) := hsep K₂ (L₁ \ {m}) hK₂ + (sdiff_subset.trans hL₁) + ⟨a, haL₁, fun h' => hanL₂ (mem_singleton_iff.mp h' ▸ ⟨half, le_rfl, rfl⟩)⟩ + (Set.disjoint_left.mpr fun z hz hzK => by + rcases hzK with h' | h' + · have hz1 := hSbL z h' (hL₁ hz.1) + exact hbnL₁ (hz1 ▸ hz.1) + · exact hz.2 (hm12 ⟨hz.1, h'⟩)) (hSdK hK₂U) + have hinter : h '' K₁ ∩ h '' K₂ = {h m} := by + exact side_compacts_intersect_at_midpoint hL₁ hL₂ ⟨half, le_rfl, rfl⟩ ⟨half, le_rfl, rfl⟩ + hm12 hbnL₁ hanL₂ hSdis hSaL hSbL h hhi hK₁ hK₂ + have hq₁ : h x₀ ∉ h '' K₁ ∪ h '' K₂ := by + rintro (⟨w, hw, he⟩ | ⟨w, hw, he⟩) + · exact hx₀S hK₁U (hhi (hK₁ hw) (hSdΔ hx₀) he ▸ hw) + · exact hx₀S hK₂U (hhi (hK₂ hw) (hSdΔ hx₀) he ▸ hw) + have hp₁ : (2 : ℂ) ∉ h '' K₁ ∪ h '' K₂ := by + rintro (h' | h') + · exact hpK _ hK₁ h' + · exact hpK _ hK₂ h' + have hmeet : IsPreconnected (h '' K₁ ∩ h '' K₂) := by + rw [hinter] + exact isPreconnected_singleton + have hjan := janiszewski (hcompK (hSac.union hclL₁) hK₁) (hcompK (hSbc.union hclL₂) hK₂) + hmeet hq₁ hp₁ hJ₂ hJ₁ + have hregion_exterior : False := by + exact exterior_component_cannot_cross_region (S := S) G (r := r) (Δ := Δ) (L := L) hbU hro hrF + L₁ L₂ Sa Sb hL12 hcover h g cc Sd hSdI hSdr hSdΔ x₀ hx₀ hsep hx₀S hJ₂ hJ₁ hq₁ hjan + exact hregion_exterior + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Enl.lean b/LeanPool/GraphMinor/GM19/Section6Enl.lean new file mode 100644 index 0000000000..1cb2119edc --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Enl.lean @@ -0,0 +1,346 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Cuff + +/-! +# Graph Minors XIX, proof of (6.2): the enlargement `τ` of `sk(Γ₁)` in `sk(Γ₂)` + +The opening of the proof of (6.2), page 342. An inflation `σ` of `Γ₁` in `Γ₂` gives an enlargement +`τ` +of `sk(Γ₁)` in `sk(Γ₂)`, drawn in `Σ̂`. The edge `τ(e)` is `σ(e)` for an edge of size 2. For a part +`e` of +the boundary of the disc of an edge `c` of size 3, it is the part of the boundary of the disc of +`σ(c)` +with ends in `σ(u), σ(v)`. The main result is `exists_enlargement`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +/-- Preconnected induced graphs map onto preconnected induced graphs. -/ +theorem preconnected_image {α β : Type} {G : SimpleGraph α} {H : SimpleGraph β} {X : Set α} {Y : + Set β} + (φ : α → β) (h : (G.induce X).Preconnected) (hs : Y = φ '' X) + (hadj : ∀ a ∈ X, ∀ b ∈ X, G.Adj a b → H.Adj (φ a) (φ b)) : (H.induce Y).Preconnected := by + subst hs + rintro ⟨_, a, ha, rfl⟩ ⟨_, b, hb, rfl⟩ + let ψ : G.induce X →g H.induce (φ '' X) := + { toFun := fun x => ⟨φ x.1, x.1, x.2, rfl⟩ + map_rel' := fun {x y} h => hadj _ x.2 _ y.2 h } + exact (h ⟨a, ha⟩ ⟨b, hb⟩).map ψ + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {D : Drawing Shat} + +/-! ### The drawing induced on a set of vertices -/ + +section Induced + +variable {T : Type} [TopologicalSpace T] [T2Space T] (G : Drawing T) + +/-- The subdrawing of `G` induced on `X`. -/ +noncomputable def indDrawing (X : Set T) : Drawing T := G.span X {e | e ∈ G.E ∧ tilde e ⊆ X} + +theorem indDrawing_V {X : Set T} (hX : X ⊆ G.V) : (indDrawing G X).V = X := by + rw [indDrawing, Drawing.span_V] + refine Subset.antisymm (union_subset inter_subset_left (iUnion₂_subset ?_)) fun x hx + => .inl ⟨hx, hX hx⟩ + rintro e ⟨he, -⟩ x hx + have h : x ∈ tilde e := tilde_eq_inter_V G he.1 ▸ hx + exact he.2 h + +theorem indDrawing_E (X : Set T) : (indDrawing G X).E = {e | e ∈ G.E ∧ tilde e ⊆ X} := by + rw [indDrawing, Drawing.span_E] + exact inter_eq_left.mpr fun e he => he.1 + +theorem indDrawing_sub {X : Set T} (hX : X ⊆ G.V) : (indDrawing G X).IsSubdrawing G := by + refine ⟨by rw [indDrawing_V G hX]; exact hX, ?_⟩ + rw [indDrawing_E G] + exact fun e he => he.1 + +theorem indDrawing_adj (hl : LoopFree G) {X : Set T} (hX : X ⊆ G.V) {a b : T} (ha : a ∈ X) + (hb : b ∈ X) + (h : G.adj.Adj a b) : (indDrawing G X).adj.Adj a b := by + obtain ⟨hne, -, -, e, he, hae, hbe⟩ := h + obtain ⟨u, v, -, ht, -⟩ := hl e he + refine ⟨hne, by rw [indDrawing_V G hX]; exact ha, by rw [indDrawing_V G hX]; exact hb, + e, ?_, hae, hbe⟩ + rw [indDrawing_E G] + refine ⟨he, ?_⟩ + have hsub : tilde e ⊆ {a, b} := by + rw [ht] at hae hbe ⊢ + rintro x (rfl | rfl) + · rcases hae with rfl | h + · exact .inl rfl + · rcases hbe with rfl | h' + · exact .inr rfl + · exact absurd (h.trans (mem_singleton_iff.mp h').symm) hne + · rcases hae with h | h + · rcases hbe with h' | h' + · exact absurd (h.trans h'.symm) hne + · exact .inr (mem_singleton_iff.mp h').symm + · exact .inl (mem_singleton_iff.mp h).symm + rintro x hx + rcases hsub hx with rfl | rfl + · exact ha + · exact hb + +end Induced + +/-! ### `sk(Γ)` in `Σ̂` -/ + +section Sk + +omit [T2Space S] in +theorem sk_of_edge (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) (h2 : (tilde e).ncard = 2) : + e ∈ arcComponentsIn (Γ.skU \ Γ.V) := by + have hsub : e ⊆ Γ.skU \ Γ.V := fun x hx => + ⟨Or.inl (Or.inr (mem_iUnion₂.2 ⟨e, ⟨he, h2⟩, hx⟩)), (he.2.1 hx).2⟩ + obtain ⟨f, hf, hef⟩ := exists_arcComp_superset he.2.2.1 hsub + obtain ⟨c, hc, hfc⟩ := exists_arcComp_superset hf.2.2.1 + (hf.2.1.trans (sdiff_subset_sdiff_left Γ.skU_subset)) + obtain ⟨x, hx⟩ := he.2.2.1.nonempty + obtain rfl := arcComp_eq_of_mem hc he (hfc (hef hx)) hx + exact (Subset.antisymm hef hfc) ▸ hf + +omit [T2Space Shat] in +omit [T2Space S] in +theorem tilde_emb (hS : IsSurface S) (cap : IsCappedSurface S Shat) (e : Set S) : + tilde (cap.emb '' e) = cap.emb '' tilde e := by + rw [tilde, tilde, image_sdiff cap.isEmbedding.injective, (cap.isClosedEmbedding + hS).closure_image_eq] + +omit [T2Space Shat] in +theorem sk_adj_of (hS : IsSurface S) (hD : IsSkHat cap Γ D) {a b : S} (h : Γ.skAdj.Adj a b) : + D.adj.Adj (cap.emb a) (cap.emb b) := by + obtain ⟨hne, ha, hb, c, hc, hac, hbc⟩ := h + refine ⟨fun h => hne (cap.isEmbedding.injective h), hD.hV ▸ mem_image_of_mem _ ha, + hD.hV ▸ mem_image_of_mem _ hb, ?_⟩ + have hend : ∃ f ∈ arcComponentsIn (Γ.skU \ Γ.V), a ∈ tilde f ∧ b ∈ tilde f := by + rcases Γ.size_cases hc with h2 | h3 + · exact ⟨c, sk_of_edge Γ hc h2, hac, hbc⟩ + · obtain ⟨f, hf, -, -, ht⟩ := exists_sk_boundary Γ hc h3 hac hbc hne + exact ⟨f, hf, ht ▸ .inl rfl, ht ▸ .inr rfl⟩ + obtain ⟨f, hf, haf, hbf⟩ := hend + refine ⟨cap.emb '' f, hD.edge_iff.mpr ⟨f, hf, rfl⟩, ?_, ?_⟩ + · rw [tilde_emb hS] + exact mem_image_of_mem _ haf + · rw [tilde_emb hS] + exact mem_image_of_mem _ hbf + +omit [T2Space Shat] in +theorem adj_sk_of (hS : IsSurface S) (hD : IsSkHat cap Γ D) {a b : S} + (h : D.adj.Adj (cap.emb a) (cap.emb b)) : Γ.skAdj.Adj a b := by + obtain ⟨hne, ha, hb, e, he, hae, hbe⟩ := h + obtain ⟨f, hf, rfl⟩ := hD.edge_iff.mp he + rw [tilde_emb hS] at hae hbe + have ha' : a ∈ tilde f := by + obtain ⟨x, hx, h⟩ := hae + rwa [← cap.isEmbedding.injective h] + have hb' : b ∈ tilde f := by + obtain ⟨x, hx, h⟩ := hbe + rwa [← cap.isEmbedding.injective h] + obtain ⟨u, v, -, -, htV, -⟩ := Γ.sk_line hf + have hneq : a ≠ b := fun h => hne (congrArg _ h) + rcases Γ.sk_cases hf with ⟨hfE, -⟩ | ⟨c, hc, -, hfc, -⟩ + · exact ⟨hneq, htV ha', htV hb', f, hfE, ha', hb'⟩ + · have htil : ∀ {x}, x ∈ tilde f → x ∈ tilde c := fun {x} hx => + ⟨closure_mono hfc hx.1, fun h => Γ.disjoint_V hc h (htV hx)⟩ + exact ⟨hneq, htV ha', htV hb', c, hc, htil ha', htil hb'⟩ + +end Sk + +/-! ### The edges of `τ` -/ + +section Tau + +variable {Γ₁ Γ₂ : Painting S} {σv : S → Set S} {σe : Set S → Set S} + +/-- The edge `τ(e)` of the proof of (6.2). -/ +theorem exists_tau_edge (h : IsInflation Γ₁ Γ₂ σv σe) {e₀ : Set S} + (he : e₀ ∈ arcComponentsIn (Γ₁.skU \ Γ₁.V)) : + ∃ e' ∈ arcComponentsIn (Γ₂.skU \ Γ₂.V), (∀ a ∈ tilde e', ∃ x ∈ tilde e₀, a ∈ σv x) ∧ + (∀ x ∈ tilde e₀, ∃ a ∈ tilde e', a ∈ σv x) ∧ + ((e₀ ∈ Γ₁.E ∧ e' = σe e₀) ∨ ∃ c ∈ Γ₁.E, e₀ ⊆ c ∧ e₀ ⊆ discBd (closure c) ∧ e' ⊆ σe c ∧ + (tilde c).ncard = 3) := by + rcases Γ₁.sk_cases he with ⟨hE, h2⟩ | ⟨c, hc, h3, hsub, hdb⟩ + · obtain ⟨h₁, h₂⟩ := infl_ends h hE + exact ⟨σe e₀, sk_of_edge Γ₂ (h.edge_mem _ hE) (by rw [h.edge_size _ hE, h2]), h₁, h₂, + .inl ⟨hE, rfl⟩⟩ + · obtain ⟨u, v, huv, ht, htV, -⟩ := Γ₁.sk_line he + have htil : ∀ {x}, x ∈ tilde e₀ → x ∈ tilde c := fun {x} hx => + ⟨closure_mono hsub hx.1, fun h' => Γ₁.disjoint_V hc h' (htV hx)⟩ + have hu : u ∈ tilde e₀ := ht ▸ .inl rfl + have hv : v ∈ tilde e₀ := ht ▸ .inr rfl + obtain ⟨-, h₂⟩ := infl_ends h hc + obtain ⟨a, hat, ha⟩ := h₂ u (htil hu) + obtain ⟨b, hbt, hb⟩ := h₂ v (htil hv) + have hab : a ≠ b := fun hab => + disjoint_left.mp (h.vertex_disjoint u (htV hu) v (htV hv) huv) ha (hab ▸ hb) + obtain ⟨f, hf, -, hfc, htf⟩ := exists_sk_boundary Γ₂ (h.edge_mem c hc) + (by rw [h.edge_size _ hc, h3]) hat hbt hab + refine ⟨f, hf, ?_, ?_, .inr ⟨c, hc, hsub, hdb, hfc, h3⟩⟩ + · rw [htf] + rintro y (rfl | rfl) + · exact ⟨u, hu, ha⟩ + · exact ⟨v, hv, hb⟩ + · rw [ht] + rintro y (rfl | rfl) + · exact ⟨a, htf ▸ .inl rfl, ha⟩ + · exact ⟨b, htf ▸ .inr rfl, hb⟩ + +/-- The edges `τ(e)` are distinct. -/ +theorem tau_inj (h : IsInflation Γ₁ Γ₂ σv σe) {e₁ e₂ e' : Set S} + (he₁ : e₁ ∈ arcComponentsIn (Γ₁.skU \ Γ₁.V)) (he₂ : e₂ ∈ arcComponentsIn (Γ₁.skU \ Γ₁.V)) + (hne : e'.Nonempty) + (h₁ : (∀ a ∈ tilde e', ∃ x ∈ tilde e₁, a ∈ σv x) ∧ (∀ x ∈ tilde e₁, ∃ a ∈ tilde e', a ∈ σv x) ∧ + ((e₁ ∈ Γ₁.E ∧ e' = σe e₁) ∨ ∃ c ∈ Γ₁.E, e₁ ⊆ c ∧ e₁ ⊆ discBd (closure c) ∧ e' ⊆ σe c ∧ + (tilde c).ncard = 3)) + (h₂ : (∀ a ∈ tilde e', ∃ x ∈ tilde e₂, a ∈ σv x) ∧ (∀ x ∈ tilde e₂, ∃ a ∈ tilde e', a ∈ σv x) ∧ + ((e₂ ∈ Γ₁.E ∧ e' = σe e₂) ∨ ∃ c ∈ Γ₁.E, e₂ ⊆ c ∧ e₂ ⊆ discBd (closure c) ∧ e' ⊆ σe c ∧ + (tilde c).ncard = 3)) : + e₁ = e₂ := by + obtain ⟨y, hy⟩ := hne + have hsize : ∀ {e}, e ∈ arcComponentsIn (Γ₁.skU \ Γ₁.V) → (tilde e).ncard = 2 := fun {e} he => by + obtain ⟨u, v, huv, ht, -, -⟩ := Γ₁.sk_line he + rw [ht, ncard_pair huv] + have hmix : ∀ {e c : Set S}, e ∈ arcComponentsIn (Γ₁.skU \ Γ₁.V) → e ∈ Γ₁.E → c ∈ Γ₁.E → + y ∈ σe e → y ∈ σe c → (tilde c).ncard = 3 → False := by + intro e c he hE hc hye hyc h3 + have h1 := arcComp_eq_of_mem (h.edge_mem _ hE) (h.edge_mem _ hc) hye hyc + obtain rfl := h.edge_injOn hE hc h1 + rw [hsize he] at h3 + omega + rcases h₁.2.2 with ⟨hE₁, rfl⟩ | ⟨c₁, hc₁, hs₁, hb₁, hy₁, h3₁⟩ <;> + rcases h₂.2.2 with ⟨hE₂, heq⟩ | ⟨c₂, hc₂, hs₂, hb₂, hy₂, h3₂⟩ + · exact h.edge_injOn hE₁ hE₂ heq + · exact (hmix he₁ hE₁ hc₂ hy (hy₂ hy) h3₂).elim + · exact (hmix he₂ hE₂ hc₁ (heq ▸ hy) (hy₁ hy) h3₁).elim + · have h1 := arcComp_eq_of_mem (h.edge_mem _ hc₁) (h.edge_mem _ hc₂) (hy₁ hy) (hy₂ hy) + obtain rfl := h.edge_injOn hc₁ hc₂ h1 + have hVs : ∀ {e}, e ∈ arcComponentsIn (Γ₁.skU \ Γ₁.V) → tilde e ⊆ Γ₁.V := fun {e} he => by + obtain ⟨u, v, -, -, htV, -⟩ := Γ₁.sk_line he + exact htV + have hsub : ∀ {e e''}, e ∈ arcComponentsIn (Γ₁.skU \ Γ₁.V) → e'' ∈ arcComponentsIn + (Γ₁.skU \ Γ₁.V) → + (∀ x ∈ tilde e, ∃ a ∈ tilde e', a ∈ σv x) → (∀ a ∈ tilde e', ∃ x ∈ tilde e'', a ∈ σv x) → + tilde e ⊆ tilde e'' := by + intro e e'' hee hee'' hA hB x hx + obtain ⟨a, hat, ha⟩ := hA x hx + obtain ⟨w, hw, haw⟩ := hB a hat + by_cases hxw : x = w + · exact hxw ▸ hw + · exact absurd haw (disjoint_left.mp (h.vertex_disjoint x (hVs hee hx) w + (hVs hee'' hw) hxw) ha) + have ht : tilde e₁ = tilde e₂ := + Subset.antisymm (hsub he₁ he₂ h₁.2.1 h₂.1) (hsub he₂ he₁ h₂.2.1 h₁.1) + exact sk_boundary_unique Γ₁ hc₁ h3₁ he₁ he₂ hb₁ hb₂ ht + +/-- **The enlargement `τ`** of `sk(Γ₁)` in `sk(Γ₂)` given by an inflation `σ` (Graph Minors XIX, +proof of +(6.2), page 342). -/ +theorem exists_enlargement (hS : IsSurface S) {D₁ D₂ : Drawing Shat} (hD₁ : IsSkHat cap Γ₁ D₁) + (hD₂ : IsSkHat cap Γ₂ D₂) (hl₂ : LoopFree D₂) (h : IsInflation Γ₁ Γ₂ σv σe) : + ∃ (τv : Shat → Drawing Shat) (τe : Set Shat → Set Shat), IsEnlargement D₁ D₂ τv τe ∧ + (∀ e ∈ Γ₁.E, (tilde e).ncard = 2 → τe (cap.emb '' e) = cap.emb '' σe e) ∧ + ∀ v ∈ Γ₁.V, (τv (cap.emb v)).V = cap.emb '' σv v := by + classical + have hinj := cap.isEmbedding.injective + have hE := fun e₀ (he : e₀ ∈ arcComponentsIn (Γ₁.skU \ Γ₁.V)) => exists_tau_edge h he + choose! τ₀ hτ using hE + let σh : Shat → Set Shat := fun x => {a | ∃ v, cap.emb v = x ∧ a ∈ cap.emb '' σv v} + have hσh : ∀ v, σh (cap.emb v) = cap.emb '' σv v := by + intro v + ext a + constructor + · rintro ⟨w, hw, ha⟩ + rwa [← hinj hw] + · exact fun ha => ⟨v, rfl, ha⟩ + have hsub : ∀ v ∈ Γ₁.V, σh (cap.emb v) ⊆ D₂.V := fun v hv => by + rw [hσh, hD₂.hV] + exact image_mono (h.vertex_subset v hv) + have hVemb : ∀ {x}, x ∈ D₁.V → ∃ v ∈ Γ₁.V, cap.emb v = x := fun {x} hx => by + rw [hD₁.hV] at hx + exact hx + let τe : Set Shat → Set Shat := fun e => cap.emb '' τ₀ (cap.emb ⁻¹' e) + have hτe : ∀ e, τe (cap.emb '' e) = cap.emb '' τ₀ e := fun e => by + change cap.emb '' τ₀ (cap.emb ⁻¹' (cap.emb '' e)) = _ + rw [preimage_image_eq _ hinj] + have hVw : ∀ {e₀}, e₀ ∈ arcComponentsIn (Γ₁.skU \ Γ₁.V) → tilde e₀ ⊆ Γ₁.V := fun {e₀} he => by + obtain ⟨u, v, -, -, htV, -⟩ := Γ₁.sk_line he + exact htV + refine ⟨fun x => indDrawing D₂ (σh x), τe, ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩, ?_, ?_⟩ + · intro e he + obtain ⟨e₀, he₀, rfl⟩ := hD₁.edge_iff.mp he + rw [hτe] + exact hD₂.edge_iff.mpr ⟨_, (hτ e₀ he₀).1, rfl⟩ + · intro e₁ he₁ e₂ he₂ heq + obtain ⟨c₁, hc₁, rfl⟩ := hD₁.edge_iff.mp he₁ + obtain ⟨c₂, hc₂, rfl⟩ := hD₁.edge_iff.mp he₂ + change τe _ = τe _ at heq + rw [hτe, hτe] at heq + have heq' := hinj.image_injective heq + have h₂ := (hτ c₂ hc₂).2 + rw [← heq'] at h₂ + rw [tau_inj h hc₁ hc₂ (hτ c₁ hc₁).1.2.2.1.nonempty (hτ c₁ hc₁).2 h₂] + · intro x hx + obtain ⟨v, hv, rfl⟩ := hVemb hx + exact indDrawing_sub D₂ (hsub v hv) + · intro x hx + obtain ⟨v, hv, rfl⟩ := hVemb hx + rw [indDrawing_V D₂ (hsub v hv), hσh] + exact (h.vertex_nonempty v hv).image _ + · intro x hx + obtain ⟨v, hv, rfl⟩ := hVemb hx + rw [indDrawing_V D₂ (hsub v hv)] + refine preconnected_image cap.emb (h.vertex_connected v hv) (hσh v) fun a ha b hb hab => ?_ + have hmem : ∀ {y}, y ∈ σv v → cap.emb y ∈ σh (cap.emb v) := fun hy => by + rw [hσh] + exact mem_image_of_mem _ hy + exact indDrawing_adj D₂ hl₂ (hsub v hv) (hmem ha) (hmem hb) (sk_adj_of hS hD₂ hab) + · intro x₁ hx₁ x₂ hx₂ hne + obtain ⟨v₁, hv₁, rfl⟩ := hVemb hx₁ + obtain ⟨v₂, hv₂, rfl⟩ := hVemb hx₂ + rw [indDrawing_V D₂ (hsub v₁ hv₁), indDrawing_V D₂ (hsub v₂ hv₂), hσh, hσh] + exact (disjoint_image_iff hinj).mpr + (h.vertex_disjoint v₁ hv₁ v₂ hv₂ fun h' => hne (congrArg _ h')) + · intro e he x hx + obtain ⟨e₀, he₀, rfl⟩ := hD₁.edge_iff.mp he + obtain ⟨v, hv, rfl⟩ := hVemb hx + rw [indDrawing_V D₂ (hsub v hv), hτe, hσh, tilde_emb hS, tilde_emb hS, ← image_inter hinj, + image_nonempty, hinj.mem_set_image] + obtain ⟨-, h₁, h₂, -⟩ := hτ e₀ he₀ + constructor + · rintro ⟨a, ha, hat⟩ + obtain ⟨y, hy, hay⟩ := h₁ a hat + by_cases hvy : v = y + · exact hvy ▸ hy + · exact absurd hay (disjoint_left.mp (h.vertex_disjoint v hv y (hVw he₀ hy) hvy) ha) + · intro hvt + obtain ⟨a, hat, ha⟩ := h₂ v hvt + exact ⟨a, ha, hat⟩ + · intro e he h2 + rw [hτe] + have hk := sk_of_edge Γ₁ he h2 + rcases (hτ e hk).2.2.2 with ⟨-, h'⟩ | ⟨c, hc, hsubc, -, -, h3⟩ + · rw [h'] + · obtain ⟨x, hx⟩ := he.2.2.1.nonempty + obtain rfl := arcComp_eq_of_mem he hc hx (hsubc hx) + omega + · intro v hv + exact (indDrawing_V D₂ (hsub v hv)).trans (hσh v) + +end Tau + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Five.lean b/LeanPool/GraphMinor/GM19/Section6Five.lean new file mode 100644 index 0000000000..1d12158eda --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Five.lean @@ -0,0 +1,152 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Comp +public import LeanPool.GraphMinor.GM19.Section6Tri +public import LeanPool.GraphMinor.GM19.Conditional + +import LeanPool.GraphMinor.GM19.Section6aProved + +/-! +# Graph Minors XIX, (6.5) + +We prove (6.5) (page 341) from (6.4), as the paper does (`theorem_6_5`). The drawing `H` is a +triangulation of the surface (`exists_triang_drawing`). By (6.4) it has an enlargement in `G`, and +so in `G'`. By (6.3) it is isomorphic to a drawing `H'` with `rep(H') ≤ rep(G')`. If `rep(H') = 0` +then a curve misses `U(H')`, and `edges_lt_of_curve` gives too few edges. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +theorem exists_curve_of_rep_lt {G : Drawing S} {k : ℕ∞} (h : G.rep < k) : + ∃ F, IsOArc F ∧ G.IsNormal F ∧ ¬ IsNullHomotopicOArc F ∧ ((F ∩ G.V).ncard : ℕ∞) < k := by + obtain ⟨n, ⟨F, h1, h2, h3, rfl⟩, h4⟩ := sInf_lt_iff.mp h + exact ⟨F, h1, h2, h3, h4⟩ + +/-- Isomorphic drawings: the facts we need on `H'`. -/ +theorem isIso_facts {H H' : Drawing S} + (hiso : H.IsIsomorphic H') (hs : ∀ e ∈ H.E, ∀ f ∈ H.E, tilde e = tilde f → e = f) + (hc : ∀ v ∈ H.V, ConnIn H (H.V \ {v})) : + H'.V.ncard = H.V.ncard ∧ H'.E.ncard = H.E.ncard ∧ (∀ e ∈ H'.E, ∀ f ∈ H'.E, tilde e = tilde f + → e = f) ∧ ∀ v ∈ H'.V, ConnIn H' (H'.V \ {v}) := by + obtain ⟨βv, βe, hbv, hbe, hinc⟩ := hiso + have ht : ∀ e ∈ H.E, tilde (βe e) = βv '' tilde e := fun e he => by + have h1 : tilde e ⊆ H.V := fun x hx => by + rw [tilde_eq_inter_V H he] at hx + exact hx.2 + have h2 : tilde (βe e) ⊆ H'.V := fun x hx => by + rw [tilde_eq_inter_V H' (hbe.mapsTo he)] at hx + exact hx.2 + ext y + constructor + · intro hy + obtain ⟨x, hx, rfl⟩ := hbv.surjOn (h2 hy) + exact ⟨x, (hinc x hx e he).mpr hy, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact (hinc x (h1 hx) e he).mp hx + refine ⟨by rw [← hbv.image_eq, hbv.injOn.ncard_image], by rw [← hbe.image_eq, + hbe.injOn.ncard_image], ?_, ?_⟩ + · intro e' he' f' hf' hef + obtain ⟨e, he, rfl⟩ := hbe.surjOn he' + obtain ⟨f, hf, rfl⟩ := hbe.surjOn hf' + rw [ht e he, ht f hf] at hef + have h1 : tilde e ⊆ H.V := fun x hx => by + rw [tilde_eq_inter_V H he] at hx + exact hx.2 + have h2 : tilde f ⊆ H.V := fun x hx => by + rw [tilde_eq_inter_V H hf] at hx + exact hx.2 + rw [hs e he f hf ((hbv.injOn.image_eq_image_iff h1 h2).mp hef)] + · intro v' hv' Y hY hne hcl + obtain ⟨v, hv, rfl⟩ := hbv.surjOn hv' + obtain ⟨y₀, hy₀⟩ := hne + obtain ⟨x₀, hx₀, rfl⟩ := hbv.surjOn (hY hy₀).1 + have hx₀v : x₀ ≠ v := fun h' => (hY hy₀).2 (h' ▸ rfl) + have hY₀ := hc v hv {x | x ∈ H.V \ {v} ∧ βv x ∈ Y} (fun x hx => hx.1) ⟨x₀, ⟨hx₀, hx₀v⟩, hy₀⟩ (by + rintro a ⟨ha, haY⟩ b hb ⟨hab, -, -, e, he, hae, hbe'⟩ + refine ⟨hb, hcl _ haY _ ⟨hbv.mapsTo hb.1, fun h' => hb.2 (hbv.injOn hb.1 hv h')⟩ ⟨fun h' + => hab (hbv.injOn ha.1 hb.1 h'), hbv.mapsTo ha.1, hbv.mapsTo hb.1, βe e, hbe.mapsTo he, ?_, + ?_⟩⟩ + · exact (hinc a ha.1 e he).mp hae + · exact (hinc b hb.1 e he).mp hbe') + refine Subset.antisymm hY fun y hy => ?_ + obtain ⟨x, hx, rfl⟩ := hbv.surjOn hy.1 + have hxv : x ≠ v := fun h' => hy.2 (h' ▸ rfl) + have h1 : x ∈ {x | x ∈ H.V \ {v} ∧ βv x ∈ Y} := hY₀.symm ▸ (⟨hx, hxv⟩ : x ∈ H.V \ {v}) + exact h1.2 + +/-- **Graph Minors XIX, (6.5)** (page 341): "For every surface $\Sigma$ with $bd(\Sigma) = +\emptyset$, not a sphere, there is a number +$k\ge 0$ such that if $G$ is a drawing in $\Sigma$ with $rep(G)\ge k$ and $G'$ is a drawing +in $\Sigma$ such that there is an enlargement of $G$ in $G'$, then $rep(G')\ge 1$." -/ +def Theorem65Statement : Prop := + ∀ (S : Type) [TopologicalSpace S], IsSurface S → ConnectedSpace S → bd S = ∅ → ¬ IsSphere S → + ∃ k : ℕ, ∀ G : Drawing S, G.IsGM19Drawing → (k : ℕ∞) ≤ G.rep → ∀ G' : Drawing S, + G'.IsGM19Drawing → + ∀ (σv : S → Drawing S) (σe : Set S → Set S), IsEnlargement G G' σv σe → 1 ≤ G'.rep + +/-- A drawing with an enlargement of the triangulation has `rep ≥ 1`. -/ +theorem rep_pos_of_enlargement (hT : IsClosedSurface S) [ConnectedSpace S] {H G' : Drawing S} + (hl : LoopFree H) (hs : ∀ e ∈ H.E, ∀ f ∈ H.E, tilde e = tilde f → e = f) + (h3V : 3 ≤ H.V.ncard) (h3E : 3 ≤ H.E.ncard) (hc : ∀ v ∈ H.V, ConnIn H (H.V \ {v})) {κ : ℕ} + (hκ : Nat.card (KCl S (ZMod 2)) = 2 ^ κ) + (hE : (H.E.ncard : ℤ) = 3 * H.V.ncard - 6 + 3 * κ) (hG' : G'.IsGM19Drawing) {σv : S + → Drawing S} {σe : Set S → Set S} + (hσ : IsEnlargement H G' σv σe) : 1 ≤ G'.rep := by + have ht2 : T2Space S := hT.2.1 + have hb : bd S = ∅ := eq_empty_iff_forall_notMem.mpr fun x hx => hx (hT.2.2 x) + have hH : H.IsGM19Drawing := gm19_of_loopFree hb hl + obtain ⟨H', hH', hiso, hle⟩ := theorem_6_3_proof hT hb hH hG' hσ + have hl' := loopFree_of_gm19 hH' + obtain ⟨hV, hE', hs', hc'⟩ := isIso_facts hiso hs hc + by_contra hlt + have hlt' : H'.rep < 1 := lt_of_le_of_lt hle (not_le.mp hlt) + obtain ⟨F, hO, hnorm, hnull, hcount⟩ := exists_curve_of_rep_lt hlt' + have h0 : (F ∩ H'.V).ncard = 0 := by + have : ((F ∩ H'.V).ncard : ℕ∞) < ((1 : ℕ) : ℕ∞) := by exact_mod_cast hcount + have := Nat.cast_lt.mp this + omega + have he : F ∩ H'.V = ∅ := (ncard_eq_zero (H'.finite_V.subset inter_subset_right)).mp h0 + have hd : Disjoint H'.U F := disjoint_left.mpr fun x hxU hxF => by + have h1 : x ∈ F ∩ H'.V := ⟨hxF, hnorm ⟨hxF, hxU⟩⟩ + rw [he] at h1 + exact h1 + have hnn : ¬ ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = F := by + rintro ⟨Δ, hΔ, hbd⟩ + have hdisc := (epstein S univ F hT.isSurface ‹_› hO (subset_univ _) (by simp [hb])).2.1 + exact hnull (hdisc ⟨Δ, subset_univ _, hΔ, hbd ▸ discBd_subset Δ⟩) + have hlt₂ := edges_lt_of_curve hT H' hl' hs' (by omega) (by omega) hc' hO hnn hd hκ + rw [hV, hE'] at hlt₂ + omega + +/-- **Graph Minors XIX, (6.5)**, from (6.4). -/ +theorem theorem_6_5_proof : Theorem65Statement := by + intro S _ hS hconn hb hsph + have ht2 : T2Space S := hS.2.1 + have hT : IsClosedSurface S := ⟨hS.1, hS.2.1, fun x => by + by_contra hx + have : x ∈ bd S := hx + rw [hb] at this + exact this⟩ + obtain ⟨H, hl, hs, h3V, h3E, hc, κ, hκ, hE⟩ := exists_triang_drawing hT + have hH : H.IsGM19Drawing := gm19_of_loopFree hb hl + obtain ⟨k, hk⟩ := GraphMinor.GM19.theorem_6_4_proof.{0} S hS hconn hb hsph H hH + refine ⟨k, fun G hG hrep G' hG' σv σe hσ => ?_⟩ + obtain ⟨τv, τe, hτ⟩ := hk G hG hrep + obtain ⟨ρv, hρ, -⟩ := IsEnlargement.comp (loopFree_of_gm19 hG) (loopFree_of_gm19 hG') hτ hσ + exact rep_pos_of_enlargement hT hl hs h3V h3E hc hκ hE hG' hρ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Graph.lean b/LeanPool/GraphMinor/GM19/Section6Graph.lean new file mode 100644 index 0000000000..1abf324f15 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Graph.lean @@ -0,0 +1,290 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Minor +public import LeanPool.GraphMinor.GM19.RadialExists +public import LeanPool.GraphMinor.Surface.TriGraph +public import LeanPool.GraphMinor.Surface.Fan + +/-! +# Drawings as graphs in a surface + +A drawing without loops is a graph in the sense of `GraphMinor.Surface.IsGraph` +(`isGraph_of_loopFree`), and a graph gives a drawing (`IsGraph.toDrawing`). If no vertex cuts the +graph of a drawing with at least three vertices, then no point cuts its underlying set +(`twoConn_U`). This is what we need to extend a drawing to a triangulation of the surface, for the +count in Graph Minors XIX, (6.5) (page 341). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +/-- The set `X` of vertices is connected in the graph of `D`: a nonempty part of `X` closed under +adjacency in `X` is all of `X`. -/ +def ConnIn (D : Drawing S) (X : Set S) : Prop := + ∀ Y ⊆ X, Y.Nonempty → (∀ a ∈ Y, ∀ b ∈ X, D.adj.Adj a b → b ∈ Y) → Y = X + +variable [T2Space S] + +omit [T2Space S] in +theorem exists_edge_of_mem (D : Drawing S) {x : S} (hx : x ∈ D.U) (hV : x ∉ D.V) : ∃ e ∈ D.E, x ∈ e + := by + obtain ⟨c, hc, hxc⟩ := exists_arcComp_superset (F := D.U \ D.V) (C := {x}) + (isPathConnected_singleton x) + (singleton_subset_iff.mpr ⟨hx, hV⟩) + exact ⟨c, hc, hxc rfl⟩ + +omit [T2Space S] in +theorem edge_eq_of_mem (D : Drawing S) {e f : Set S} (he : e ∈ D.E) (hf : f ∈ D.E) {x : S} + (hxe : x ∈ closure e) (hxf : x ∈ closure f) + (hV : x ∉ D.V) : e = f := by + have h1 : x ∈ e := D.closure_diff_V he ▸ ⟨hxe, hV⟩ + have h2 : x ∈ f := D.closure_diff_V hf ▸ ⟨hxf, hV⟩ + exact arcComp_eq_of_mem he hf h1 h2 + +omit [T2Space S] in +theorem exists_end (D : Drawing S) (hl : LoopFree D) {e : Set S} (he : e ∈ D.E) : + ∃ u v, u ≠ v ∧ tilde e = {u, v} ∧ IsLineWithEnds (closure e) u v ∧ closure e ∩ D.V = {u, v} + := by + obtain ⟨u, v, huv, ht, hL⟩ := hl e he + exact ⟨u, v, huv, ht, hL, by rw [← GraphMinor.GM19.tilde_eq_inter_V D he, ht]⟩ + +omit [T2Space S] in +/-- A drawing without loops is a graph. -/ +theorem isGraph_of_loopFree (D : Drawing S) (hl : LoopFree D) : IsGraph D.V (closure '' D.E) := by + refine ⟨D.finite_V, D.finite_edges.image _, ?_, ?_⟩ + · rintro _ ⟨e, he, rfl⟩ + obtain ⟨u, v, huv, -, hL, hi⟩ := exists_end D hl he + exact ⟨u, v, huv, hL, hi⟩ + · rintro _ ⟨e, he, rfl⟩ _ ⟨f, hf, rfl⟩ hne x hx + by_contra hV + exact hne (congrArg closure (edge_eq_of_mem D he hf hx.1 hx.2 hV)) + +omit [T2Space S] in +theorem U_eq (D : Drawing S) : D.U = D.V ∪ ⋃₀ (closure '' D.E) := by + refine Subset.antisymm (fun x hx => ?_) (union_subset D.V_subset_U (sUnion_subset ?_)) + · by_cases hV : x ∈ D.V + · exact .inl hV + · obtain ⟨e, he, hxe⟩ := exists_edge_of_mem D hx hV + exact .inr ⟨_, ⟨e, he, rfl⟩, subset_closure hxe⟩ + · rintro _ ⟨e, he, rfl⟩ + exact D.closure_subset_U he + +omit [T2Space S] in +theorem exists_adj (D : Drawing S) (h3 : 3 ≤ D.V.ncard) (hc : ∀ v ∈ D.V, ConnIn D + (D.V \ {v})) : ∀ a ∈ D.V, ∀ c ∈ D.V, a ≠ c → ∃ b, b ≠ c ∧ D.adj.Adj a b := by + intro a ha c hc' hac + by_contra hno + push Not at hno + have h1 := hc c hc' {a} (singleton_subset_iff.mpr ⟨ha, hac⟩) (singleton_nonempty a) + (fun x hx b hb hadj => absurd hadj (by + have : x = a := hx + subst this + exact hno b hb.2)) + have h2 : D.V ⊆ {a, c} := fun y hy => by + by_cases hyc : y = c + · exact .inr hyc + · have : y ∈ ({a} : Set S) := h1 ▸ ⟨hy, hyc⟩ + exact .inl this + have h4 := ncard_le_ncard h2 (toFinite _) + have h5 := ncard_pair hac + omega + +omit [T2Space S] in +/-- If no vertex cuts the graph of a drawing with at least three vertices, then no point cuts its +underlying set. -/ +theorem twoConn_U (D : Drawing S) (hl : LoopFree D) (h3 : 3 ≤ D.V.ncard) (hc : ∀ v ∈ D.V, ConnIn D + (D.V \ {v})) : TwoConn D.U := by + have hnbr := exists_adj D h3 hc + have hclosure : ∀ e ∈ D.E, IsPreconnected (closure e) := fun e he => by + obtain ⟨u, v, -, -, hL, -⟩ := exists_end D hl he + exact hL.isPreconnected_self + have hjoin : ∀ {C P : Set S} {x y : S}, IsPreconnected P → P ⊆ C → x ∈ P → y ∈ P + → ∀ {z}, x ∈ connectedComponentIn C z → y ∈ connectedComponentIn C z := + fun {C P x y} hP hPC hx hy {z} hxz => by + have h1 := hP.subset_connectedComponentIn hx hPC + rw [connectedComponentIn_eq hxz] + exact h1 hy + intro p + have hV3 : 1 < D.V.ncard := by omega + by_cases hp : p ∈ D.V + · obtain ⟨x₀, hx₀⟩ : (D.V \ {p}).Nonempty := by + by_contra hne + rw [not_nonempty_iff_eq_empty, sdiff_eq_empty] at hne + have h1 := ncard_le_ncard hne (toFinite _) + rw [ncard_singleton] at h1 + omega + have hx₀C : x₀ ∈ D.U \ {p} := ⟨D.V_subset_U hx₀.1, hx₀.2⟩ + have hoff : ∀ e ∈ D.E, p ∉ closure e → closure e ⊆ D.U \ {p} := fun e he hpe y hy => + ⟨D.closure_subset_U he hy, fun h => hpe (h ▸ hy)⟩ + have hY := hc p hp (D.V \ {p} ∩ connectedComponentIn (D.U \ {p}) x₀) inter_subset_left ⟨x₀, + hx₀, mem_connectedComponentIn hx₀C⟩ (by + rintro a ⟨ha, haC⟩ b hb ⟨hab, -, -, e, he, hae, hbe⟩ + refine ⟨hb, ?_⟩ + obtain ⟨u, v, -, ht, -, hi⟩ := exists_end D hl he + have hpe : p ∉ closure e := fun hpe => by + have h1 : p ∈ ({u, v} : Set S) := hi ▸ ⟨hpe, hp⟩ + rw [ht] at hae hbe + rcases h1 with rfl | rfl <;> rcases hae with rfl | rfl <;> + first + | exact ha.2 rfl + | rcases hbe with rfl | rfl <;> first | exact hb.2 rfl | exact hab rfl + exact hjoin (hclosure e he) (hoff e he hpe) hae.1 hbe.1 haC) + have hall : D.U \ {p} ⊆ connectedComponentIn (D.U \ {p}) x₀ := fun y hy => by + by_cases hyV : y ∈ D.V + · have : y ∈ D.V \ {p} := ⟨hyV, hy.2⟩ + rw [← hY] at this + exact this.2 + obtain ⟨e, he, hye⟩ := exists_edge_of_mem D hy.1 hyV + obtain ⟨u, v, huv, ht, hL, hi⟩ := exists_end D hl he + have huV : u ∈ closure e ∩ D.V := hi ▸ Or.inl rfl + have hvV : v ∈ closure e ∩ D.V := hi ▸ Or.inr rfl + have hend : ∀ w ∈ closure e ∩ D.V, w ≠ p → w ∈ connectedComponentIn (D.U \ {p}) x₀ + := fun w hw hwp => by + have : w ∈ D.V \ {p} := ⟨hw.2, hwp⟩ + rw [← hY] at this + exact this.2 + by_cases hpe : p ∈ closure e + · have h1 : p ∈ ({u, v} : Set S) := hi ▸ ⟨hpe, hp⟩ + rcases h1 with rfl | rfl + · have hP : IsPreconnected (closure e \ {p}) := hL.isPreconnected_diff_left + exact hjoin (C := D.U \ {p}) hP (fun z hz => ⟨D.closure_subset_U he hz.1, + hz.2⟩) ⟨hvV.1, huv.symm⟩ ⟨subset_closure hye, hy.2⟩ (hend v hvV huv.symm) + · have hP : IsPreconnected (closure e \ {p}) := hL.isPreconnected_diff_right + exact hjoin (C := D.U \ {p}) hP (fun z hz => ⟨D.closure_subset_U he hz.1, + hz.2⟩) ⟨huV.1, huv⟩ ⟨subset_closure hye, hy.2⟩ (hend u huV huv) + · exact hjoin (hclosure e he) (hoff e he hpe) huV.1 (subset_closure hye) (hend u huV fun h + => hpe (h ▸ huV.1)) + have he : D.U \ {p} = connectedComponentIn (D.U \ {p}) x₀ := Subset.antisymm hall + (connectedComponentIn_subset _ _) + rw [he] + exact isPreconnected_connectedComponentIn + · obtain ⟨u, v, huv, huV, hvV, hspec⟩ : ∃ u v, u ≠ v ∧ u ∈ D.V ∧ v ∈ D.V + ∧ ∀ e ∈ D.E, p ∈ closure e → tilde e = {u, v} := by + by_cases he₀ : ∃ e ∈ D.E, p ∈ closure e + · obtain ⟨e, he, hpe⟩ := he₀ + obtain ⟨u, v, huv, ht, -, hi⟩ := exists_end D hl he + have huV : u ∈ closure e ∩ D.V := hi ▸ Or.inl rfl + have hvV : v ∈ closure e ∩ D.V := hi ▸ Or.inr rfl + refine ⟨u, v, huv, huV.2, hvV.2, fun f hf hpf => ?_⟩ + rw [← edge_eq_of_mem D he hf hpe hpf hp, ht] + · obtain ⟨u, hu, v, hv, huv⟩ := (one_lt_ncard D.finite_V).mp hV3 + exact ⟨u, v, huv, hu, hv, fun e he hpe => absurd ⟨e, he, hpe⟩ he₀⟩ + have hv₀ : v ∈ D.U \ {p} := ⟨D.V_subset_U hvV, fun h => hp (h ▸ hvV)⟩ + have hoff : ∀ e ∈ D.E, tilde e ≠ {u, v} → closure e ⊆ D.U \ {p} := fun e he hne y hy => + ⟨D.closure_subset_U he hy, fun h => hne (hspec e he (h ▸ hy))⟩ + have hY := hc u huV (D.V \ {u} ∩ connectedComponentIn (D.U \ {p}) v) inter_subset_left + ⟨v, ⟨hvV, huv.symm⟩, mem_connectedComponentIn hv₀⟩ (by + rintro a ⟨ha, haC⟩ b hb ⟨hab, -, -, e, he, hae, hbe⟩ + refine ⟨hb, hjoin (hclosure e he) (hoff e he fun hte => ?_) hae.1 hbe.1 haC⟩ + rw [hte] at hae hbe + rcases hae with rfl | rfl + · exact ha.2 rfl + rcases hbe with rfl | rfl + · exact hb.2 rfl + · exact hab rfl) + have hmem : ∀ w ∈ D.V, w ≠ u → w ∈ connectedComponentIn (D.U \ {p}) v := fun w hw hwu => by + have : w ∈ D.V \ {u} := ⟨hw, hwu⟩ + rw [← hY] at this + exact this.2 + have hVC : ∀ w ∈ D.V, w ∈ connectedComponentIn (D.U \ {p}) v := fun w hw => by + by_cases hwu : w = u + · subst hwu + obtain ⟨b, hbv, hab, -, hb, e, he, hae, hbe⟩ := hnbr w hw v hvV huv + refine hjoin (hclosure e he) (hoff e he fun hte => ?_) hbe.1 hae.1 (hmem b hb hab.symm) + rw [hte] at hbe + rcases hbe with h | h + · exact hab h.symm + · exact hbv h + · exact hmem w hw hwu + have hall : D.U \ {p} ⊆ connectedComponentIn (D.U \ {p}) v := fun y hy => by + by_cases hyV : y ∈ D.V + · exact hVC y hyV + obtain ⟨e, he, hye⟩ := exists_edge_of_mem D hy.1 hyV + obtain ⟨u', v', huv', -, hL, hi⟩ := exists_end D hl he + have hu'V : u' ∈ closure e ∩ D.V := hi ▸ Or.inl rfl + have hv'V : v' ∈ closure e ∩ D.V := hi ▸ Or.inr rfl + by_cases hpe : p ∈ closure e + · obtain ⟨a, ha, hr, h0, h1⟩ := hL.exists_arc + obtain ⟨t, rfl⟩ : p ∈ range a := hr ▸ hpe + obtain ⟨s, rfl⟩ : y ∈ range a := hr ▸ subset_closure hye + have hst : s ≠ t := fun h => hy.2 (h ▸ rfl) + have hsub : ∀ Q : Set unitInterval, t ∉ Q → a '' Q ⊆ D.U \ {a t} := fun Q hQ => by + rintro _ ⟨r, hrQ, rfl⟩ + exact ⟨D.closure_subset_U he (hr ▸ mem_range_self r), fun h => hQ (ha.2 h ▸ hrQ)⟩ + rcases lt_or_gt_of_ne hst with hlt | hlt + · have hP : IsPreconnected (a '' Iio t) := + ordConnected_Iio.isPreconnected.image _ ha.1.continuousOn + have h0t : (0 : unitInterval) < t := lt_of_le_of_lt bot_le hlt + exact hjoin hP (hsub _ (by simp)) ⟨0, h0t, rfl⟩ ⟨s, hlt, rfl⟩ (h0 ▸ hVC u' hu'V.2) + · have hP : IsPreconnected (a '' Ioi t) := + ordConnected_Ioi.isPreconnected.image _ ha.1.continuousOn + have h1t : t < (1 : unitInterval) := lt_of_lt_of_le hlt le_top + exact hjoin hP (hsub _ (by simp)) ⟨1, h1t, rfl⟩ ⟨s, hlt, rfl⟩ (h1 ▸ hVC v' hv'V.2) + · have hs : closure e ⊆ D.U \ {p} := fun z hz => ⟨D.closure_subset_U he hz, fun h => hpe + (h ▸ hz)⟩ + exact hjoin (hclosure e he) hs hu'V.1 (subset_closure hye) (hVC u' hu'V.2) + have he : D.U \ {p} = connectedComponentIn (D.U \ {p}) v := Subset.antisymm hall + (connectedComponentIn_subset _ _) + rw [he] + exact isPreconnected_connectedComponentIn + +omit [T2Space S] in +/-- Each vertex lies on a closed edge. -/ +theorem V_subset_edges (D : Drawing S) (h3 : 3 ≤ D.V.ncard) (hc : ∀ v ∈ D.V, ConnIn D + (D.V \ {v})) : D.V ⊆ ⋃₀ (closure '' D.E) := fun a ha => by + obtain ⟨c, hc', hac⟩ : ∃ c ∈ D.V, a ≠ c := by + by_contra hno + push Not at hno + have h1 : D.V ⊆ {a} := fun y hy => (hno y hy).symm + have h2 := ncard_le_ncard h1 (toFinite _) + rw [ncard_singleton] at h2 + omega + obtain ⟨b, -, -, -, -, e, he, hae, -⟩ := exists_adj D h3 hc a ha c hc' hac + exact ⟨_, ⟨e, he, rfl⟩, hae.1⟩ + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +omit [T2Space S] in +/-- The image of a graph under a map that is injective and continuous on a set that holds the graph. +-/ +theorem isGraph_image {V : Set S} {E : Set (Set S)} (h : IsGraph V E) {ι : S → T} {Z : Set S} + (hZ : gr V E ⊆ Z) (hc : ContinuousOn ι Z) (hi : InjOn ι Z) : + IsGraph (ι '' V) ((fun e => ι '' e) '' E) := by + have hE : ∀ e ∈ E, e ⊆ Z := fun e he x hx => hZ (.inr ⟨e, he, hx⟩) + have hVZ : V ⊆ Z := fun x hx => hZ (.inl hx) + refine ⟨h.fin.image _, h.fine.image _, ?_, ?_⟩ + · rintro _ ⟨e, he, rfl⟩ + obtain ⟨u, v, huv, hl, hin⟩ := h.edge e he + have hmu : u ∈ e ∩ V := hin ▸ Or.inl rfl + have hmv : v ∈ e ∩ V := hin ▸ Or.inr rfl + obtain ⟨a, ha, hr, h0, h1⟩ := hl.exists_arc + have harc : IsArcMap (ι ∘ a) := ⟨hc.comp_continuous ha.1 fun t => hE e he + (hr ▸ mem_range_self t), fun s t hst => + ha.2 (hi (hE e he (hr ▸ mem_range_self s)) (hE e he (hr ▸ mem_range_self t)) hst)⟩ + have hrr : range (ι ∘ a) = ι '' e := by rw [range_comp, hr] + have hL := harc.isLineWithEnds + rw [hrr] at hL + simp only [Function.comp, h0, h1] at hL + refine ⟨ι u, ι v, fun he' => huv (hi (hVZ hmu.2) (hVZ hmv.2) he'), hL, ?_⟩ + rw [← (hi.mono (union_subset (hE e he) hVZ)).image_inter subset_union_left subset_union_right, + hin, image_pair] + · rintro _ ⟨e, he, rfl⟩ _ ⟨f, hf, rfl⟩ hne _ ⟨⟨x, hx, rfl⟩, ⟨y, hy, hxy⟩⟩ + have h1 : y = x := hi (hE f hf hy) (hE e he hx) hxy + subst h1 + have hef : e ≠ f := fun h' => hne (by rw [h']) + exact mem_image_of_mem _ (h.disj e he f hf hef ⟨hx, hy⟩) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Hub.lean b/LeanPool/GraphMinor/GM19/Section6Hub.lean new file mode 100644 index 0000000000..e15e3d52f6 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Hub.lean @@ -0,0 +1,181 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section8f +public import LeanPool.GraphMinor.GM11.HubCollar +public import LeanPool.GraphMinor.GM19.Section6Graph + +/-! +# Graph Minors XIX, proof of (6.7): the perimeter of a region + +Let `D` be a drawing with no loops in a connected closed surface, with a radial drawing `G₃`. The +spokes at the vertex `c` of `G₃` in a region `r` of `D` come in a cyclic order, and two consecutive +spokes end at the two ends of an edge of `D` (`GM11.corner_data`). If each vertex of `D` has only +one +spoke to `c`, then this cyclic sequence runs through the vertices in the closure of `r`, each once +(`exists_perimeter`). This is the statement of the paper's proof of (6.7), page 342, that the closed +curve tracing the perimeter of `r` has no repeated vertices. + +A cyclic sequence without one term is still connected (`perimeter_avoid`), and this is the step +"which is impossible" of that proof. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {T : Type} [TopologicalSpace T] + +theorem bool_cases {a b : Bool} (h : a ≠ b) {P : Bool → Prop} (ha : P a) (hb : P b) + (c : Bool) : P c := by + by_cases hc : c = a + · exact hc ▸ ha + · have : c = b := by + revert h hc + cases a <;> cases b <;> cases c <;> simp + exact this ▸ hb + +/-- **The perimeter of a region.** -/ +theorem exists_perimeter [ConnectedSpace T] (hT : IsClosedSurface T) {D G₃ : Drawing T} + (hrad : PreRad (PaintingOrDrawing.drawing D) G₃) + (hmax : RadMax (PaintingOrDrawing.drawing D) G₃) (hE : D.E.Nonempty) + (hloop : ∀ e ∈ D.E, ∃ x y, x ≠ y ∧ closure e ∩ D.V = {x, y}) {r : Set T} (hr : r ∈ D.R) + (honce : ∀ e₁ ∈ G₃.E, ∀ e₂ ∈ G₃.E, e₁ ⊆ r → e₂ ⊆ r → ∀ v ∈ D.V, ∀ c ∈ r, c ∈ G₃.V → + closure e₁ ∩ G₃.V = {v, c} → closure e₂ ∩ G₃.V = {v, c} → e₁ = e₂) : + ∃ (κ : Type) (_ : Finite κ) (next : κ → κ) (A : κ → T), Function.Injective A ∧ + Function.Injective next ∧ range A = D.V ∩ closure r ∧ + (∀ k, ∃ e ∈ D.E, closure e ∩ D.V = {A k, A (next k)}) ∧ + ∀ a b, Relation.ReflTransGen (fun x y => y = next x) a b := by + classical + have hlc : LocallyConnectedSpace T := IsClosedSurface.locallyConnectedSpace hT + have hne : Nonempty T := ⟨(region_nonempty hr).some⟩ + have : T2Space T := hT.2.1 + obtain ⟨γ, hγ⟩ := exists_edgePar (radialUnion hrad) + obtain ⟨c, ⟨hc, hcV⟩, -⟩ := hrad.2.2.2.1 r hr + change c ∈ r at hc + change c ∈ G₃.V at hcV + have hcH : c ∈ (radialUnion hrad).V := by + rw [radialUnion_V] + exact hcV + obtain ⟨next, ρ, Pc, Wc, Qc, τc, hsec⟩ := exists_sectors hT _ hγ hcH + (hub_two_halves hrad hT hmax hE hloop hγ hr hc hcV) + have hcor := IsSectors.corners hsec + have hR : ∀ k, ρ k ∈ (radialUnion hrad).R := IsCorners.region hcor + have hρr : ∀ k, ρ k ⊆ r := fun k => by + obtain ⟨r', hr', hsub⟩ := exists_region_of_sub hrad (hR k) + obtain ⟨w, hw', hw⟩ := mem_closure_iff.mp (IsCorners.closure_v hcor k) r (region_isOpen hr) hc + obtain rfl := region_eq_of_mem hr' hr (hsub hw) hw' + exact hsub + have hdata := corner_data hrad hT hmax hE hloop hγ hr hc hcV hsec hρr + choose E' hE' A B hAB hA hB hcap hep hcapa hcapb hfr using hdata + have hsp : ∀ k : halfEdges (radialUnion hrad) γ c, k.1.1 ∈ G₃.E := + fun k => hub_half_spoke hrad hr hc k hγ + have hBnext : ∀ k, B k = A (next k) := by + intro k + have h₁ : B k ∈ closure (next k).1.1 ∩ G₃.V := by rw [hcapb]; simp + rw [hcapa] at h₁ + rcases h₁ with h | h + · exact h + · exact (region_subset hr hc (D.V_subset_U (h ▸ hB k))).elim + have hAc : ∀ k, A k ≠ c := fun k h => region_subset hr hc (D.V_subset_U (h ▸ hA k)) + have hspr : ∀ k : halfEdges (radialUnion hrad) γ c, k.1.1 ⊆ r := by + intro k + obtain ⟨v, hv, r', hr', w, hw, hwV, hset, hsub⟩ := spoke_ends hrad hT (hsp k) + have hcl : c ∈ closure k.1.1 ∩ G₃.V := by rw [hcapa]; simp + rw [hset] at hcl + have hcw : c = w := by + rcases hcl with h | h + · exact absurd (h ▸ hv) fun h' => region_subset hr hc (D.V_subset_U h') + · exact h + subst hcw + obtain rfl := region_eq_of_mem hr' hr hw hc + exact hsub + have hAinj : Function.Injective A := by + intro k j hkj + have h₁ : k.1.1 = j.1.1 := honce _ (hsp k) _ (hsp j) (hspr k) (hspr j) (A k) (hA k) c hc hcV + (hcapa k) (by rw [hkj]; exact hcapa j) + have hkH : k.1.1 ∈ (radialUnion hrad).E := k.2.1 + have hb : k.1.2 = j.1.2 := by + by_contra hne + have hk₂ : γ k.1.1 (endOf k.1.2) = c := k.2.2 + have hj₂ : γ k.1.1 (endOf j.1.2) = c := by + rw [h₁] + exact j.2.2 + have hend : ∀ b : Bool, γ k.1.1 (endOf b) = c := fun b => + bool_cases hne (P := fun b => γ k.1.1 (endOf b) = c) hk₂ hj₂ b + have hm : A k ∈ closure k.1.1 ∩ G₃.V := by rw [hcapa]; exact Or.inl rfl + obtain ⟨b, hb⟩ := exists_end_eq hγ hkH (by rw [radialUnion_V]; exact hm.2) hm.1 + exact hAc k (by rw [← hb, hend]) + exact Subtype.ext (Prod.ext h₁ hb) + refine ⟨halfEdges (radialUnion hrad) γ c, (finite_halfEdges _ _ _).to_subtype, next, A, hAinj, + IsCorners.inj hcor, Subset.antisymm ?_ ?_, fun k => ⟨E' k, hE' k, ?_⟩, IsCorners.reach hcor⟩ + · rintro _ ⟨k, rfl⟩ + have hm : A k ∈ closure k.1.1 ∩ G₃.V := by rw [hcapa]; simp + exact ⟨hA k, closure_mono (hspr k) hm.1⟩ + · rintro x ⟨hxV, hxr⟩ + obtain ⟨h, hh, hset⟩ := exists_spoke_at hrad hmax hT hE hr hc hcV hxV hxr + have hhH : h ∈ (radialUnion hrad).E := by + rw [radialUnion_E] + exact Or.inr hh + have hcl : c ∈ closure h ∩ G₃.V := by rw [hset]; simp + obtain ⟨b, hb⟩ := exists_end_eq hγ hhH hcH hcl.1 + let k : halfEdges (radialUnion hrad) γ c := ⟨(h, b), hhH, hb⟩ + have hx : x ∈ closure k.1.1 ∩ G₃.V := by + change x ∈ closure h ∩ G₃.V + rw [hset] + simp + rw [hcapa] at hx + refine ⟨k, ?_⟩ + rcases hx with hx | hx + · exact hx.symm + · exact absurd (hx ▸ hxV) fun h' => region_subset hr hc (D.V_subset_U h') + · rw [hcap, hBnext] + +/-- **A cycle without one term is connected.** Let `next` be a cyclic permutation. A nonempty set of +terms without `b`, closed under `next` and its inverse except at `b`, holds each term other than +`b`. -/ +theorem cycle_avoid {κ : Type} {next : κ → κ} + (hreach : ∀ a b, Relation.ReflTransGen (fun x y => y = next x) a b) (b : κ) + {Y : Set κ} (hne : Y.Nonempty) (hb : b ∉ Y) + (hstep : ∀ a ∈ Y, next a ≠ b → next a ∈ Y) + (hback : ∀ a, next a ∈ Y → a ≠ b → a ∈ Y) : ∀ j, j ≠ b → j ∈ Y := by + obtain ⟨k, hk⟩ := hne + by_cases hn : next b ∈ Y + · intro j hj + have key : ∀ i, Relation.ReflTransGen (fun x y => y = next x) b i → i ∈ Y ∨ i = b := by + intro i h + induction h with + | refl => exact Or.inr rfl + | tail _ hs ih => + subst hs + rename_i a _ + rcases ih with h | h + · by_cases hnb : next a = b + · exact Or.inr hnb + · exact Or.inl (hstep _ h hnb) + · subst h + exact Or.inl hn + exact (key j (hreach b j)).resolve_right hj + · have key : ∀ i, Relation.ReflTransGen (fun x y => y = next x) b i → i ∉ Y := by + intro i h + induction h with + | refl => exact hb + | tail _ hs ih => + subst hs + rename_i a _ + by_cases hab : a = b + · subst hab + exact hn + · exact fun hc => ih (hback a hc hab) + exact absurd hk (key k (hreach b k)) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Max.lean b/LeanPool/GraphMinor/GM19/Section6Max.lean new file mode 100644 index 0000000000..a0720af126 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Max.lean @@ -0,0 +1,286 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Comp + +/-! +# Growing an enlargement + +The first step of the proof of (6.6) of Graph Minors XIX (page 341): choose an enlargement `σ'` that +keeps the edges of `σ` and contains its branch sets, as large as possible. If `G'` is connected then +the branch sets of `σ'` cover `V(G')`, and each is induced (`exists_full_enlargement`). We add one +edge at a time (`IsEnlargement.extend`), and count (`exists_full_aux`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GM11 + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +theorem tilde_subset_V (D : Drawing S) {e : Set S} (he : e ∈ D.E) : tilde e ⊆ D.V := fun _ hx => + (GM19.tilde_eq_inter_V D he ▸ hx : _ ∈ closure e ∩ D.V).2 + +omit [T2Space S] in +/-- Each end of `σ(e)` lies in the branch set of an end of `e`. -/ +theorem IsEnlargement.end_mem {G G' : Drawing S} (hl : LoopFree G) (hl' : LoopFree G') {σv : S + → Drawing S} {σe : Set S → Set S} (hσ : IsEnlargement G G' σv σe) + {e : Set S} (he : e ∈ G.E) {x : S} + (hx : x ∈ tilde (σe e)) : ∃ u ∈ G.V, u ∈ tilde e ∧ x ∈ (σv u).V := by + obtain ⟨u₁, u₂, h12, hti, -⟩ := hl e he + have hm₁ : u₁ ∈ tilde e := by rw [hti]; exact .inl rfl + have hm₂ : u₂ ∈ tilde e := by rw [hti]; exact .inr rfl + have hV₁ := tilde_subset_V G he hm₁ + have hV₂ := tilde_subset_V G he hm₂ + obtain ⟨y₁, hy₁, hy₁e⟩ := (hσ.ends_iff e he u₁ hV₁).mpr hm₁ + obtain ⟨y₂, hy₂, hy₂e⟩ := (hσ.ends_iff e he u₂ hV₂).mpr hm₂ + have hne : y₁ ≠ y₂ := fun h => Set.disjoint_left.mp (hσ.vertex_disjoint _ hV₁ _ hV₂ h12) hy₁ + (h ▸ hy₂) + obtain ⟨a, b, -, hti', -⟩ := hl' _ (hσ.edge_mem e he) + rw [hti'] at hy₁e hy₂e hx + have hcases : x = y₁ ∨ x = y₂ := by + rcases hy₁e with rfl | hy₁e <;> rcases hy₂e with rfl | hy₂e <;> rcases hx with rfl | hx + · exact absurd rfl hne + · exact absurd rfl hne + · exact .inl rfl + · exact .inr (hx.trans hy₂e.symm) + · exact .inr rfl + · exact .inl (hx.trans hy₁e.symm) + · exact absurd (hy₁e.trans hy₂e.symm) hne + · exact absurd (hy₁e.trans hy₂e.symm) hne + rcases hcases with rfl | rfl + · exact ⟨u₁, hV₁, hm₁, hy₁⟩ + · exact ⟨u₂, hV₂, hm₂, hy₂⟩ + +/-- **Adding an edge to a branch set.** The edge `f` has an end `y` in the branch set of `w`, and +its other end `x` is in no other branch set. -/ +theorem IsEnlargement.extend {G G' : Drawing S} (hl : LoopFree G) + (hl' : LoopFree G') {σv : S → Drawing S} {σe : Set S → Set S} + (hσ : IsEnlargement G G' σv σe) {w : S} (hw : w ∈ G.V) {f : Set S} + (hf : f ∈ G'.E) {x y : S} (hy : y ∈ (σv w).V) (hti : tilde f = {y, x}) (hx : ∀ u ∈ G.V, u ≠ w + → x ∉ (σv u).V) : + ∃ τ : S → Drawing S, IsEnlargement G G' τ σe ∧ (∀ v ∈ G.V, (σv v).IsSubdrawing (τ v)) ∧ x ∈ + (τ w).V ∧ f ∈ (τ w).E := by + classical + have hsubw := hσ.vertex_subdrawing w hw + have hxV : x ∈ G'.V := tilde_subset_V G' hf (by rw [hti]; exact .inr rfl) + let D : Drawing S := G'.span (insert x (σv w).V) (insert f (σv w).E) + have hDV : D.V = insert x (σv w).V := by + apply Subset.antisymm + · refine union_subset inter_subset_left (iUnion₂_subset fun e he => ?_) + rintro z ⟨hz, hzV⟩ + have hzt : z ∈ tilde e := GM19.tilde_eq_inter_V G' he.2 ▸ ⟨hz, hzV⟩ + rcases he.1 with rfl | he1 + · rw [hti] at hzt + rcases hzt with rfl | hzt + · exact .inr hy + · exact .inl hzt + · exact .inr (tilde_subset_V _ he1 hzt) + · rintro z (rfl | hz) + · exact .inl ⟨.inl rfl, hxV⟩ + · exact .inl ⟨.inr hz, hsubw.1 hz⟩ + have hDE : D.E = insert f (σv w).E := by + change (G'.span _ _).E = _ + rw [Drawing.span_E] + exact inter_eq_left.mpr (insert_subset hf hsubw.2) + have hsubD : (σv w).IsSubdrawing D := ⟨hDV ▸ subset_insert _ _, hDE ▸ subset_insert _ _⟩ + have hDsub : D.IsSubdrawing G' := ⟨hDV ▸ insert_subset hxV hsubw.1, hDE ▸ insert_subset hf + hsubw.2⟩ + have hyx : ∀ {z}, z = x → z ≠ y → D.adj.Adj y z := fun {z} hz hne => by + subst hz + exact ⟨hne.symm, hsubD.1 hy, hDV ▸ .inl rfl, f, hDE ▸ .inl rfl, + hti ▸ .inl rfl, hti ▸ .inr rfl⟩ + let τ : S → Drawing S := fun u => if u = w then D else σv u + have hτw : τ w = D := ite_eq_left rfl + have hτ : ∀ u, u ≠ w → τ u = σv u := fun u hu => ite_eq_right hu + refine ⟨τ, ⟨hσ.edge_mem, hσ.edge_injOn, fun v hv => ?_, fun v hv => ?_, fun v hv => ?_, + fun v₁ hv₁ v₂ hv₂ hne => ?_, fun e he v hv => ?_⟩, fun v hv => ?_, + hτw ▸ hDV ▸ .inl rfl, hτw ▸ hDE ▸ .inl rfl⟩ + · by_cases h : v = w + · rw [h, hτw] + exact hDsub + · rw [hτ v h] + exact hσ.vertex_subdrawing v hv + · by_cases h : v = w + · rw [h, hτw, hDV] + exact insert_nonempty _ _ + · rw [hτ v h] + exact hσ.vertex_nonempty v hv + · by_cases h : v = w + · rw [h, hτw, preconnected_iff_connIn, hDV] + rintro Y hY ⟨z, hz⟩ hc + have hold := (preconnected_iff_connIn _ _).mp (hσ.vertex_connected w hw) + have hstep : ∀ {a b}, a ∈ Y → b ∈ insert x (σv w).V → D.adj.Adj a b → b ∈ Y := fun ha hb hab + => hc _ ha _ hb hab + have hYold : (Y ∩ (σv w).V).Nonempty → (σv w).V ⊆ Y := fun hn => by + have := hold (Y ∩ (σv w).V) inter_subset_right hn fun a ha b hb hab => ⟨hc a ha.1 b + (.inr hb) (adj_mono hsubD hab), hb⟩ + rw [← this] + exact inter_subset_left + have hyY : y ∈ Y := by + rcases hY hz with rfl | hzw + · by_cases hzy : z = y + · exact hzy ▸ hz + · exact hc _ hz _ (.inr hy) ((hyx rfl hzy).symm) + · exact hYold ⟨z, hz, hzw⟩ hy + have hall := hYold ⟨y, hyY, hy⟩ + refine Subset.antisymm hY (insert_subset ?_ hall) + by_cases hxy : x = y + · exact hxy ▸ hyY + · exact hc _ hyY _ (.inl rfl) (hyx rfl hxy) + · rw [hτ v h] + exact hσ.vertex_connected v hv + · by_cases h1 : v₁ = w + · subst h1 + rw [hτw, hτ v₂ hne.symm, hDV] + exact Set.disjoint_insert_left.mpr ⟨hx v₂ hv₂ hne.symm, hσ.vertex_disjoint _ hv₁ _ hv₂ hne⟩ + · by_cases h2 : v₂ = w + · subst h2 + rw [hτw, hτ v₁ hne, hDV] + exact Set.disjoint_insert_right.mpr ⟨hx v₁ hv₁ hne, hσ.vertex_disjoint _ hv₁ _ hv₂ hne⟩ + · rw [hτ v₁ h1, hτ v₂ h2] + exact hσ.vertex_disjoint _ hv₁ _ hv₂ hne + · by_cases h : v = w + · subst h + rw [hτw, hDV] + rw [← hσ.ends_iff e he v hv] + constructor + · rintro ⟨z, rfl | hz, hzt⟩ + · obtain ⟨u, hu, -, hzu⟩ := hσ.end_mem hl hl' he hzt + by_cases huv : u = v + · exact ⟨z, huv ▸ hzu, hzt⟩ + · exact absurd hzu (hx u hu huv) + · exact ⟨z, hz, hzt⟩ + · rintro ⟨z, hz, hzt⟩ + exact ⟨z, .inr hz, hzt⟩ + · rw [hτ v h] + exact hσ.ends_iff e he v hv + · by_cases h : v = w + · rw [h, hτw] + exact hsubD + · rw [hτ v h] + exact ⟨Subset.refl _, Subset.refl _⟩ + +/-- All the vertices of the branch sets. -/ +def branchV (G : Drawing S) (σv : S → Drawing S) : Set S := ⋃ v ∈ G.V, (σv v).V + +/-- All the edges of the branch sets. -/ +def branchE (G : Drawing S) (σv : S → Drawing S) : Set (Set S) := ⋃ v ∈ G.V, (σv v).E + +theorem exists_full_aux {G G' : Drawing S} (hl : LoopFree G) (hl' : LoopFree G') + (hconn : ConnIn G' G'.V) (hne : G.V.Nonempty) {σe : Set S → Set S} : + ∀ (d : ℕ) (σv : S → Drawing S), IsEnlargement G G' σv σe → G'.V.ncard + G'.E.ncard ≤ d + + ((branchV G σv).ncard + (branchE G σv).ncard) → + ∃ τ : S → Drawing S, IsEnlargement G G' τ σe ∧ (∀ v ∈ G.V, (σv v).IsSubdrawing (τ v)) + ∧ branchV G τ = G'.V ∧ ∀ v ∈ G.V, ∀ e ∈ G'.E, tilde e ⊆ (τ v).V → e ∈ (τ v).E := by + classical + have hsubV : ∀ {σ : S → Drawing S}, IsEnlargement G G' σ σe → branchV G σ ⊆ G'.V := fun hσ + => iUnion₂_subset fun v hv => (hσ.vertex_subdrawing v hv).1 + have hsubE : ∀ {σ : S → Drawing S}, IsEnlargement G G' σ σe → branchE G σ ⊆ G'.E := fun hσ + => iUnion₂_subset fun v hv => (hσ.vertex_subdrawing v hv).2 + have hmono : ∀ {σ τ : S → Drawing S}, (∀ v ∈ G.V, (σ v).IsSubdrawing (τ v)) + → branchV G σ ⊆ branchV G τ ∧ branchE G σ ⊆ branchE G τ := fun h => + ⟨biUnion_mono (Subset.refl _) fun v hv => (h v hv).1, biUnion_mono (Subset.refl _) fun v hv => + (h v hv).2⟩ + have hgrow : ∀ {σ τ : S → Drawing S}, IsEnlargement G G' σ σe → IsEnlargement G G' τ σe → + (∀ v ∈ G.V, (σ v).IsSubdrawing (τ v)) → + ((∃ x ∈ branchV G τ, x ∉ branchV G σ) ∨ ∃ f ∈ branchE G τ, f ∉ branchE G σ) → + (branchV G σ).ncard + (branchE G σ).ncard < (branchV G τ).ncard + (branchE G τ).ncard := by + intro σ τ h1 h2 h3 h4 + obtain ⟨h5, h6⟩ := hmono h3 + have hfV := G'.finite_V.subset (hsubV h2) + have hfE := G'.finite_edges.subset (hsubE h2) + rcases h4 with ⟨x, hx, hx'⟩ | ⟨f, hf, hf'⟩ + · have := ncard_lt_ncard (⟨h5, fun h => hx' (h hx)⟩ : branchV G σ ⊂ branchV G τ) hfV + have := ncard_le_ncard h6 hfE + omega + · have := ncard_lt_ncard (⟨h6, fun h => hf' (h hf)⟩ : branchE G σ ⊂ branchE G τ) hfE + have := ncard_le_ncard h5 hfV + omega + intro d + induction d with + | zero => + intro σv hσ hd + have h1 := ncard_le_ncard (hsubV hσ) G'.finite_V + have h2 := ncard_le_ncard (hsubE hσ) G'.finite_edges + have hV : branchV G σv = G'.V := eq_of_subset_of_ncard_le (hsubV hσ) (by omega) G'.finite_V + have hE : branchE G σv = G'.E := eq_of_subset_of_ncard_le (hsubE hσ) (by omega) G'.finite_edges + refine ⟨σv, hσ, fun v _ => ⟨Subset.refl _, Subset.refl _⟩, hV, fun v hv e he hsub => ?_⟩ + rw [← hE] at he + obtain ⟨u, hu, heu⟩ := mem_iUnion₂.mp he + obtain ⟨a, b, hab, hti, -⟩ := hl' e (by rw [← hE]; exact he) + have ha : a ∈ tilde e := by rw [hti]; exact .inl rfl + have huv : u = v := by + by_contra hne' + exact Set.disjoint_left.mp (hσ.vertex_disjoint _ hu _ hv hne') (tilde_subset_V _ heu ha) + (hsub ha) + exact huv ▸ heu + | succ d ih => + intro σv hσ hd + have hfin : ∀ {τ : S → Drawing S}, IsEnlargement G G' τ σe → (∀ v ∈ G.V, (σv v).IsSubdrawing + (τ v)) → ((∃ x ∈ branchV G τ, x ∉ branchV G σv) ∨ ∃ f ∈ branchE G τ, f ∉ branchE G σv) → + ∃ τ' : S → Drawing S, IsEnlargement G G' τ' σe ∧ (∀ v ∈ G.V, (σv v).IsSubdrawing (τ' v)) + ∧ branchV G τ' = G'.V ∧ ∀ v ∈ G.V, ∀ e ∈ G'.E, tilde e ⊆ (τ' v).V → e ∈ (τ' v).E := by + intro τ hτ hs hnew + have := hgrow hσ hτ hs hnew + obtain ⟨τ', h1, h2, h3⟩ := ih τ hτ (by omega) + exact ⟨τ', h1, fun v hv => (hs v hv).trans (h2 v hv), h3⟩ + by_cases hcover : branchV G σv = G'.V + swap + · have hbne : (branchV G σv).Nonempty := by + obtain ⟨v, hv⟩ := hne + obtain ⟨x, hx⟩ := hσ.vertex_nonempty v hv + exact ⟨x, mem_iUnion₂.mpr ⟨v, hv, hx⟩⟩ + have hex : ∃ a ∈ branchV G σv, ∃ b ∈ G'.V, G'.adj.Adj a b ∧ b ∉ branchV G σv := by + by_contra hno + push Not at hno + exact hcover (hconn _ (hsubV hσ) hbne fun a ha b hb hab => hno a ha b hb hab) + obtain ⟨a, ha, b, hb, ⟨hab, -, -, f, hf, hfa, hfb⟩, hbn⟩ := hex + obtain ⟨w, hw, haw⟩ := mem_iUnion₂.mp ha + obtain ⟨p, q, hpq, hti, -⟩ := hl' f hf + have hti' : tilde f = {a, b} := by + rw [hti] at hfa hfb ⊢ + rcases hfa with rfl | hfa <;> rcases hfb with rfl | hfb + · exact absurd rfl hab + · rw [mem_singleton_iff.mp hfb] + · rw [mem_singleton_iff.mp hfa, pair_comm] + · exact absurd ((mem_singleton_iff.mp hfa).trans (mem_singleton_iff.mp hfb).symm) hab + obtain ⟨τ, h1, h2, h3, -⟩ := hσ.extend hl hl' hw hf haw hti' fun u hu _ hbu => hbn + (mem_iUnion₂.mpr ⟨u, hu, hbu⟩) + exact hfin h1 h2 (.inl ⟨b, mem_iUnion₂.mpr ⟨w, hw, h3⟩, hbn⟩) + by_cases hind : ∀ v ∈ G.V, ∀ e ∈ G'.E, tilde e ⊆ (σv v).V → e ∈ (σv v).E + · exact ⟨σv, hσ, fun v _ => ⟨Subset.refl _, Subset.refl _⟩, hcover, hind⟩ + push Not at hind + obtain ⟨w, hw, f, hf, hsub, hfn⟩ := hind + obtain ⟨p, q, hpq, hti, -⟩ := hl' f hf + have hp : p ∈ (σv w).V := hsub (by rw [hti]; exact .inl rfl) + have hq : q ∈ (σv w).V := hsub (by rw [hti]; exact .inr rfl) + obtain ⟨τ, h1, h2, -, h4⟩ := hσ.extend hl hl' hw hf hp hti fun u hu hne' hqu + => Set.disjoint_left.mp (hσ.vertex_disjoint _ hu _ hw hne') hqu hq + refine hfin h1 h2 (.inr ⟨f, mem_iUnion₂.mpr ⟨w, hw, h4⟩, fun hfb => ?_⟩) + obtain ⟨u, hu, hfu⟩ := mem_iUnion₂.mp hfb + have hpt : p ∈ tilde f := by rw [hti]; exact .inl rfl + by_cases huw : u = w + · exact hfn (huw ▸ hfu) + · exact Set.disjoint_left.mp (hσ.vertex_disjoint _ hu _ hw huw) (tilde_subset_V _ hfu hpt) hp + +/-- **A full enlargement.** See the module docstring. -/ +theorem exists_full_enlargement {G G' : Drawing S} (hl : LoopFree G) (hl' : LoopFree G') + (hconn : ConnIn G' G'.V) (hne : G.V.Nonempty) {σv : S → Drawing S} + {σe : Set S → Set S} (hσ : IsEnlargement G G' σv σe) : + ∃ τ : S → Drawing S, IsEnlargement G G' τ σe ∧ (∀ v ∈ G.V, (σv v).IsSubdrawing (τ v)) + ∧ branchV G τ = G'.V ∧ ∀ v ∈ G.V, ∀ e ∈ G'.E, tilde e ⊆ (τ v).V → e ∈ (τ v).E := by + classical + exact exists_full_aux hl hl' hconn hne _ σv hσ (Nat.le_add_right _ _) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Minor.lean b/LeanPool/GraphMinor/GM19/Section6Minor.lean new file mode 100644 index 0000000000..c01e12f8f4 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Minor.lean @@ -0,0 +1,500 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Contract +public import LeanPool.GraphMinor.GM17.ReplaceDisc + +/-! +# Graph Minors XIX, (6.3) + +If `G` has an enlargement in `G'` then `G` is isomorphic to a drawing `H` in the same surface with +`rep(H) ≤ rep(G')` (`theorem_6_3`, page 340). The proof is the paper's. We reduce to trees, pass to +the subdrawing `H'` of `G'` made of these trees and the edges `σ(e)`, for which `rep(H') ≤ rep(G')` +(`rep_le_of_isSubdrawing`), and then contract the edges of the trees (`exists_contract_set`). The +paper identifies the points of each tree at once and says that the surface does not change. We +contract one edge at a time by `exists_contract`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S : Type} [TopologicalSpace S] + +/-- Two points that are ends of one edge of `A`. -/ +def EdgeRel (A : Set (Set S)) (x y : S) : Prop := ∃ e ∈ A, x ∈ tilde e ∧ y ∈ tilde e + +/-- Two points joined by a path of edges of `A`, or equal. -/ +abbrev Conn (A : Set (Set S)) : S → S → Prop := Relation.EqvGen (EdgeRel A) + +theorem Conn.map_eq {α : Type*} {A : Set (Set S)} (ρ : S → α) + (h : ∀ e ∈ A, ∀ x ∈ tilde e, ∀ y ∈ tilde e, ρ x = ρ y) {x y : S} (hc : Conn A x y) : ρ x = ρ y + := by + induction hc with + | rel x y h' => obtain ⟨e, he, h1, h2⟩ := h'; exact h e he x h1 y h2 + | refl x => rfl + | symm x y _ ih => exact ih.symm + | trans x y z _ _ h1 h2 => exact h1.trans h2 + +theorem Conn.mono {A B : Set (Set S)} (h : ∀ x y, EdgeRel A x y → Conn B x y) {x y : S} + (hc : Conn A x y) : Conn B x y := by + induction hc with + | rel x y h' => exact h x y h' + | refl x => exact .refl x + | symm x y _ ih => exact .symm _ _ ih + | trans x y z _ _ h1 h2 => exact .trans _ _ _ h1 h2 + +theorem Conn.of_subset {A B : Set (Set S)} (h : A ⊆ B) {x y : S} (hc : Conn A x y) : Conn B x y := + hc.mono fun _ _ ⟨e, he, h1, h2⟩ => .rel _ _ ⟨e, h he, h1, h2⟩ + +theorem conn_of_reachable {α : Type*} {G : SimpleGraph α} {A : Set (Set S)} (f : α → S) + (h : ∀ a b, G.Adj a b → Conn A (f a) (f b)) {a b : α} (hr : G.Reachable a b) : + Conn A (f a) (f b) := by + obtain ⟨w⟩ := hr + induction w with + | nil => exact .refl _ + | cons hadj _ ih => exact .trans _ _ _ (h _ _ hadj) ih + +/-- **Contracting a forest.** Let `C` be a finite set of edges of a loop-free drawing `D` such that +no edge of `C` has its ends joined by the other edges of `C`, and no other edge has its ends joined +by `C`. Then we can contract `C`. -/ +theorem exists_contract_set (hT : IsClosedSurface S) {D : Drawing S} (hD : LoopFree D) + {C : Set (Set S)} (hC : C ⊆ D.E) + (hf : ∀ f ∈ C, ∀ x ∈ tilde f, ∀ y ∈ tilde f, x ≠ y → ¬ Conn (C \ {f}) x y) + (ho : ∀ e ∈ D.E \ C, ∀ x ∈ tilde e, ∀ y ∈ tilde e, x ≠ y → ¬ Conn C x y) : + ∃ (H : Drawing S) (π : S → S) (ε : Set S → Set S), LoopFree H ∧ H.V = π '' D.V ∧ + (∀ x ∈ D.V, ∀ y ∈ D.V, π x = π y ↔ Conn C x y) ∧ BijOn ε (D.E \ C) H.E ∧ + (∀ e ∈ D.E \ C, tilde (ε e) = π '' tilde e) ∧ H.rep ≤ D.rep := by + classical + have ht2 : T2Space S := hT.2.1 + have hV : ∀ e ∈ D.E, tilde e ⊆ D.V := fun e he x hx => by + rw [tilde_eq_inter_V D he] at hx + exact hx.2 + have hCf : C.Finite := D.finite_edges.subset hC + have key : ∀ C₀ : Set (Set S), C₀.Finite → C₀ ⊆ C → ∃ (H : Drawing S) (π : S → S) (ε : Set S + → Set S), + LoopFree H ∧ H.V = π '' D.V ∧ (∀ x ∈ D.V, ∀ y ∈ D.V, π x = π y ↔ Conn C₀ x y) ∧ + BijOn ε (D.E \ C₀) H.E ∧ (∀ e ∈ D.E \ C₀, tilde (ε e) = π '' tilde e) ∧ H.rep ≤ D.rep := by + intro C₀ hfin + induction C₀, hfin using Finite.induction_on with + | empty => + intro _ + refine ⟨D, id, id, hD, (image_id _).symm, ?_, ?_, ?_, le_rfl⟩ + · intro x _ y _ + constructor + · rintro rfl + exact .refl _ + · intro h + exact Conn.map_eq id (fun e he => absurd he (notMem_empty e)) h + · rw [sdiff_empty] + exact bijOn_id _ + · intro e _ + rw [image_id] + rfl + | @insert f C₀ hfC₀ _ ih => + intro hsub + have hfC : f ∈ C := hsub (mem_insert _ _) + have hC₀ : C₀ ⊆ C := (subset_insert _ _).trans hsub + have hC₀' : C₀ ⊆ C \ {f} := fun x hx => ⟨hC₀ hx, fun h => hfC₀ (h ▸ hx)⟩ + obtain ⟨H, π, ε, hH, hHV, hπ, hε, hεt, hrep⟩ := ih hC₀ + have hfE : f ∈ D.E \ C₀ := ⟨hC hfC, hfC₀⟩ + have hf' : ε f ∈ H.E := hε.mapsTo hfE + obtain ⟨u, v, huv, hfe, -⟩ := hD f (hC hfC) + have huT : u ∈ tilde f := by rw [hfe]; exact .inl rfl + have hvT : v ∈ tilde f := by rw [hfe]; exact .inr rfl + have huV := hV f (hC hfC) huT + have hvV := hV f (hC hfC) hvT + have hnotconn : ¬ Conn C₀ u v := fun h => hf f hfC u huT v hvT huv (h.of_subset hC₀') + have hno : ∀ e' ∈ H.E, e' ≠ ε f → tilde e' ≠ tilde (ε f) := by + intro e' he' hne heq + obtain ⟨e, he, rfl⟩ := hε.surjOn he' + have hef : e ≠ f := fun h => hne (h ▸ rfl) + obtain ⟨p, q, hpq, hte, -⟩ := hD e he.1 + have hpT : p ∈ tilde e := by rw [hte]; exact .inl rfl + have hqT : q ∈ tilde e := by rw [hte]; exact .inr rfl + have hpV := hV e he.1 hpT + have hqV := hV e he.1 hqT + rw [hεt e he, hεt f hfE] at heq + -- each of `p, q` is joined to an end of `f` + have h1 : π p ∈ π '' tilde f := heq ▸ mem_image_of_mem _ hpT + have h2 : π q ∈ π '' tilde f := heq ▸ mem_image_of_mem _ hqT + have h3 : π u ∈ π '' tilde e := heq ▸ mem_image_of_mem _ huT + have h4 : π v ∈ π '' tilde e := heq ▸ mem_image_of_mem _ hvT + have hcase : (Conn C₀ p u ∧ Conn C₀ q v) ∨ (Conn C₀ p v ∧ Conn C₀ q u) := by + rw [hfe] at h1 h2 + have hu : ∀ z, z = u ∨ z = v → z ∈ D.V := by + rintro z (rfl | rfl) + · exact huV + · exact hvV + obtain ⟨z, hz, hzp⟩ := h1 + obtain ⟨z', hz', hzq⟩ := h2 + have c1 := (hπ z (hu z hz) p hpV).mp hzp + have c2 := (hπ z' (hu z' hz') q hqV).mp hzq + rcases hz with hz | hz <;> rcases hz' with hz' | hz' <;> rw [hz] at c1 <;> rw [hz'] at c2 + · -- both `p` and `q` go to `u`, so `v` is joined to one of them + rw [hte] at h4 + obtain ⟨y, hy, hyv⟩ := h4 + have c3 : Conn C₀ y v := (hπ y (by rcases hy with rfl | rfl + <;> assumption) v hvV).mp hyv + have c1' : Conn C₀ u y := by + rcases hy with rfl | rfl + · exact c1 + · exact c2 + exact absurd (Relation.EqvGen.trans _ _ _ c1' c3) hnotconn + · exact .inl ⟨.symm _ _ c1, .symm _ _ c2⟩ + · exact .inr ⟨.symm _ _ c1, .symm _ _ c2⟩ + · rw [hte] at h3 + obtain ⟨y, hy, hyu⟩ := h3 + have c3 : Conn C₀ y u := (hπ y (by rcases hy with rfl | rfl + <;> assumption) u huV).mp hyu + have c1' : Conn C₀ v y := by + rcases hy with rfl | rfl + · exact c1 + · exact c2 + exact absurd (.symm _ _ (Relation.EqvGen.trans _ _ _ c1' c3)) hnotconn + by_cases heC : e ∈ C + · have heC' : e ∈ C \ {f} := ⟨heC, hef⟩ + have hrel : Conn (C \ {f}) p q := .rel _ _ ⟨e, heC', hpT, hqT⟩ + rcases hcase with ⟨c1, c2⟩ | ⟨c1, c2⟩ + · have c1' := c1.of_subset hC₀' + have c2' := c2.of_subset hC₀' + exact hf f hfC u huT v hvT huv (.trans _ _ _ (.symm _ _ c1') (.trans _ _ _ hrel c2')) + · have c1' := c1.of_subset hC₀' + have c2' := c2.of_subset hC₀' + exact hf f hfC u huT v hvT huv (.trans _ _ _ (.symm _ _ c2') (.symm _ _ (.trans _ _ _ + (.symm _ _ c1') hrel))) + · have hrel : Conn C u v := .rel _ _ ⟨f, hfC, huT, hvT⟩ + refine ho e ⟨he.1, heC⟩ p hpT q hqT hpq ?_ + rcases hcase with ⟨c1, c2⟩ | ⟨c1, c2⟩ + · exact .trans _ _ _ (c1.of_subset hC₀) (.trans _ _ _ hrel (.symm _ _ (c2.of_subset hC₀))) + · exact .trans _ _ _ (c1.of_subset hC₀) (.trans _ _ _ (.symm _ _ hrel) (.symm _ _ + (c2.of_subset hC₀))) + obtain ⟨H', φ, hH', hV', hφ, hb, ht, hr⟩ := exists_contract hT hH hf' hno + refine ⟨H', φ ∘ π, image φ ∘ ε, hH', by rw [hV', hHV, image_comp], ?_, ?_, ?_, hr.trans hrep⟩ + · intro x hx y hy + have hπV : ∀ x ∈ D.V, π x ∈ H.V := fun x hx => hHV ▸ mem_image_of_mem _ hx + have htf := hεt f hfE + rw [Function.comp_apply, Function.comp_apply, hφ _ (hπV x hx) _ (hπV y hy)] + constructor + · rintro (h | ⟨h1, h2⟩) + · exact ((hπ x hx y hy).mp h).of_subset (subset_insert _ _) + · rw [htf, hfe] at h1 h2 + have hu : ∀ z, z = u ∨ z = v → z ∈ D.V := by + rintro z (rfl | rfl) + · exact huV + · exact hvV + obtain ⟨z, hz, hzx⟩ := h1 + obtain ⟨z', hz', hzy⟩ := h2 + have c1 := ((hπ z (hu z hz) x hx).mp hzx).of_subset (subset_insert f C₀) + have c2 := ((hπ z' (hu z' hz') y hy).mp hzy).of_subset (subset_insert f C₀) + have hzT : ∀ z, z = u ∨ z = v → z ∈ tilde f := by + rintro z (rfl | rfl) + · exact huT + · exact hvT + have c3 : Conn (insert f C₀) z z' := .rel _ _ ⟨f, mem_insert _ _, hzT z hz, hzT z' hz'⟩ + exact .trans _ _ _ (.symm _ _ c1) (.trans _ _ _ c3 c2) + · intro h + have h1 : (φ ∘ π) x = (φ ∘ π) y := by + refine Conn.map_eq (φ ∘ π) ?_ h + intro e he a ha b hb' + rcases he with rfl | he + · have ha' : π a ∈ tilde (ε e) := by rw [htf]; exact mem_image_of_mem _ ha + have hb'' : π b ∈ tilde (ε e) := by rw [htf]; exact mem_image_of_mem _ hb' + exact (hφ _ (hπV a (hV e (hC hfC) ha)) _ (hπV b (hV e (hC hfC) hb'))).mpr + (.inr ⟨ha', hb''⟩) + · have heE := hC (hC₀ he) + have : π a = π b := (hπ a (hV e heE ha) b (hV e heE hb')).mpr + (.rel _ _ ⟨e, he, ha, hb'⟩) + rw [Function.comp_apply, Function.comp_apply, this] + exact (hφ _ (hπV x hx) _ (hπV y hy)).mp h1 + · have hsd : D.E \ insert f C₀ = (D.E \ C₀) \ {f} := by + ext e + simp only [mem_sdiff, mem_insert_iff, mem_singleton_iff, not_or] + tauto + rw [hsd] + have h1 : BijOn ε ((D.E \ C₀) \ {f}) (H.E \ {ε f}) := by + refine ⟨fun e he => ⟨hε.mapsTo he.1, fun h => he.2 (hε.injOn he.1 hfE h)⟩, + hε.injOn.mono sdiff_subset, fun y hy => ?_⟩ + obtain ⟨e, he, rfl⟩ := hε.surjOn hy.1 + exact ⟨e, ⟨he, fun h => hy.2 (h ▸ rfl)⟩, rfl⟩ + exact hb.comp h1 + · intro e he + have he' : e ∈ D.E \ C₀ := ⟨he.1, fun h => he.2 (mem_insert_of_mem _ h)⟩ + have hne : e ≠ f := fun h => he.2 (h ▸ mem_insert _ _) + have hne' : ε e ≠ ε f := fun h => hne (hε.injOn he' hfE h) + rw [Function.comp_apply, ht _ (hε.mapsTo he') hne', hεt e he', image_comp] + exact key C hCf Subset.rfl + +/-- A subdrawing has `rep` at most that of the drawing. -/ +theorem rep_le_of_isSubdrawing {H G : Drawing S} (h : H.IsSubdrawing G) : H.rep ≤ G.rep := by + refine le_sInf ?_ + rintro _ ⟨F, hF, hn, hnull, rfl⟩ + have hnorm : H.IsNormal F := by + rintro x ⟨hxF, hxU⟩ + by_contra hxV + obtain ⟨e, he, hxe⟩ := exists_arcComp_superset (isPathConnected_singleton x) + (singleton_subset_iff.mpr (show x ∈ H.U \ H.V from ⟨hxU, hxV⟩)) + have hxe' : x ∈ e := hxe rfl + have hG := (h.2 he).2.1 hxe' + exact hG.2 (hn ⟨hxF, hG.1⟩) + refine (rep_le_of_arc H hF hnorm hnull).trans ?_ + have h1 : (F ∩ H.V).ncard ≤ (F ∩ G.V).ncard := + ncard_le_ncard (inter_subset_inter_right _ h.1) (G.finite_V.subset inter_subset_right) + exact_mod_cast h1 + +theorem loopFree_of_gm19 {D : Drawing S} (h : D.IsGM19Drawing) : LoopFree D := by + intro e he + obtain ⟨h1, -, ⟨f⟩, h3⟩ := h.no_loops e he + have hl : IsLineWithEnds (closure e) (f 0).1 (f 1).1 := ⟨f, rfl, rfl⟩ + refine ⟨_, _, GM17.ne_of_isLineWithEnds hl, ?_, hl⟩ + rw [← h3, GM17.lineEnds_eq hl] + +theorem gm19_of_loopFree {D : Drawing S} (hb : bd S = ∅) (h : LoopFree D) : + D.IsGM19Drawing := by + refine ⟨fun e he => ?_, fun e _ => .inr (by simp [hb])⟩ + obtain ⟨u, v, huv, ht, hl⟩ := h e he + obtain ⟨f, -⟩ := id hl + exact ⟨by rw [ht, ncard_pair huv], by rw [ht]; exact (finite_singleton _).insert _, ⟨f⟩, + by rw [ht, GM17.lineEnds_eq hl]⟩ + +private theorem minimal_connecting_edges_acyclic + {S : Type} + [TopologicalSpace S] + {G : Drawing S} + {G' : Drawing S} + {σv : S → Drawing S} + (hLG' : LoopFree G') + (C : Set (Set S)) + (hCg : ∀ v ∈ G.V, ∀ x ∈ (σv v).V, ∀ y ∈ (σv v).V, Conn C x y) + (hCmin : ∀ C' ⊂ C, ¬(∀ v ∈ G.V, ∀ x ∈ (σv v).V, ∀ y ∈ (σv v).V, Conn C' x y)) + (hCG' : C ⊆ Drawing.E G') : + ∀ f ∈ C, ∀ x ∈ tilde f, ∀ y ∈ tilde f, x ≠ y → ¬Conn (C \ {f}) x y := by + intro f hf x hx y hy hxy hconn + obtain ⟨a, b, -, hfe, -⟩ := hLG' f (hCG' hf) + have hall : ∀ p ∈ tilde f, ∀ q ∈ tilde f, Conn (C \ {f}) p q := by + intro p hp q hq + rw [hfe] at hx hy hp hq + by_cases hpq : p = q + · exact hpq ▸ .refl _ + · have hset : ({p, q} : Set S) = {x, y} := by + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl <;> rcases hp with rfl | rfl <;> + rcases hq with rfl | rfl <;> + first | exact absurd rfl hxy | exact absurd rfl hpq | rfl | exact pair_comm _ _ + have hp' : p ∈ ({x, y} : Set S) := hset ▸ .inl rfl + have hq' : q ∈ ({x, y} : Set S) := hset ▸ .inr rfl + rcases hp' with rfl | rfl <;> rcases hq' with rfl | rfl + · exact .refl _ + · exact hconn + · exact .symm _ _ hconn + · exact .refl _ + have hgood : ∀ v ∈ G.V, ∀ p ∈ (σv v).V, ∀ q ∈ (σv v).V, Conn (C \ {f}) p q := by + intro v hv p hp q hq + refine (hCg v hv p hp q hq).mono ?_ + rintro a' b' ⟨e, he, h1, h2⟩ + by_cases hef : e = f + · subst hef + exact hall a' h1 b' h2 + · exact .rel _ _ ⟨e, ⟨he, hef⟩, h1, h2⟩ + exact hCmin (C \ {f}) ⟨sdiff_subset, fun h => (h hf).2 rfl⟩ hgood + +/-- **Graph Minors XIX, (6.3)** (page 340). If there is an enlargement of `G` in `G'`, for drawings +in a surface with no boundary, then `G` is isomorphic to a drawing `H` in the surface with `rep(H) ≤ +rep(G')`. -/ +theorem theorem_6_3_proof (hT : IsClosedSurface S) (hb : bd S = ∅) {G G' : Drawing S} + (hG : G.IsGM19Drawing) + (hG' : G'.IsGM19Drawing) {σv : S → Drawing S} {σe : Set S → Set S} + (hσ : IsEnlargement G G' σv σe) : + ∃ H : Drawing S, H.IsGM19Drawing ∧ G.IsIsomorphic H ∧ H.rep ≤ G'.rep := by + classical + have ht2 : T2Space S := hT.2.1 + have hLG := loopFree_of_gm19 hG + have hLG' := loopFree_of_gm19 hG' + have hsubV : ∀ v ∈ G.V, (σv v).V ⊆ G'.V := fun v hv => (hσ.vertex_subdrawing v hv).1 + have hsubE : ∀ v ∈ G.V, (σv v).E ⊆ G'.E := fun v hv => (hσ.vertex_subdrawing v hv).2 + -- the label of a vertex of a branch set + let ρ : S → S := fun x => if h : ∃ v ∈ G.V, x ∈ (σv v).V then h.choose else x + have hρ : ∀ v ∈ G.V, ∀ x ∈ (σv v).V, ρ x = v := by + intro v hv x hx + have h : ∃ v ∈ G.V, x ∈ (σv v).V := ⟨v, hv, hx⟩ + simp only [ρ, dite_eq_left h] + by_contra hne + exact (disjoint_left.mp (hσ.vertex_disjoint _ h.choose_spec.1 v hv hne)) h.choose_spec.2 hx + have hsV : ∀ v ∈ G.V, ∀ e ∈ (σv v).E, tilde e ⊆ (σv v).V := fun v _ e he x hx => by + rw [tilde_eq_inter_V (σv v) he] at hx + exact hx.2 + let VV : Set S := ⋃ v ∈ G.V, (σv v).V + have hUV : ∀ x ∈ VV, ∃ v ∈ G.V, x ∈ (σv v).V := fun x hx => by + obtain ⟨v, hv, h⟩ := mem_iUnion₂.mp hx + exact ⟨v, hv, h⟩ + let A : Set (Set S) := ⋃ v ∈ G.V, (σv v).E + have hAE : A ⊆ G'.E := iUnion₂_subset hsubE + have hAf : A.Finite := G'.finite_edges.subset hAE + let Good : Set (Set S) → Prop := fun C => ∀ v ∈ G.V, ∀ x ∈ (σv v).V, ∀ y ∈ (σv v).V, Conn C x y + have hgoodA : Good A := by + intro v hv x hx y hy + have h1 := hσ.vertex_connected v hv (⟨x, hx⟩ : (σv v).V) ⟨y, hy⟩ + refine conn_of_reachable (G := (σv v).adj.induce (σv v).V) (A := A) Subtype.val ?_ h1 + rintro ⟨a, ha⟩ ⟨b, hb'⟩ ⟨-, -, -, e, he, h2, h3⟩ + exact .rel _ _ ⟨e, mem_iUnion₂.mpr ⟨v, hv, he⟩, h2, h3⟩ + -- a minimal set of edges keeping the branch sets connected: a forest + obtain ⟨C, hCA, hCg, hCmin⟩ : ∃ C ⊆ A, Good C ∧ ∀ C' ⊂ C, ¬ Good C' := by + have hfin : ({C | C ⊆ A ∧ Good C} : Set (Set (Set S))).Finite := + hAf.powerset.subset fun C hC => hC.1 + obtain ⟨C, hC, hmin⟩ := hfin.exists_minimal ⟨A, Subset.rfl, hgoodA⟩ + refine ⟨C, hC.1, hC.2, fun C' hC' hg => ?_⟩ + exact hC'.2 (hmin ⟨hC'.1.trans hC.1, hg⟩ hC'.1) + have hCE : ∀ e ∈ C, ∃ v ∈ G.V, e ∈ (σv v).E := fun e he => by + obtain ⟨v, hv, h⟩ := mem_iUnion₂.mp (hCA he) + exact ⟨v, hv, h⟩ + have hρC : ∀ e ∈ C, ∀ x ∈ tilde e, ∀ y ∈ tilde e, ρ x = ρ y := by + intro e he x hx y hy + obtain ⟨v, hv, h⟩ := hCE e he + rw [hρ v hv x (hsV v hv e h hx), hρ v hv y (hsV v hv e h hy)] + -- ends of the edges `σ(e)` + have hends : ∀ e ∈ G.E, ∃ s ∈ G.V, ∃ t ∈ G.V, s ≠ t ∧ tilde e = {s, t} ∧ ∃ p ∈ (σv s).V, ∃ q ∈ + (σv t).V, + p ≠ q ∧ tilde (σe e) = {p, q} := by + intro e he + obtain ⟨s, t, hst, hte, -⟩ := hLG e he + have hsT : s ∈ tilde e := by rw [hte]; exact .inl rfl + have htT : t ∈ tilde e := by rw [hte]; exact .inr rfl + have hVG : tilde e ⊆ G.V := fun x hx => by + rw [tilde_eq_inter_V G he] at hx + exact hx.2 + have hsV' := hVG hsT + have htV' := hVG htT + obtain ⟨p, hp, hpT⟩ := (hσ.ends_iff e he s hsV').mpr hsT + obtain ⟨q, hq, hqT⟩ := (hσ.ends_iff e he t htV').mpr htT + have hpq : p ≠ q := fun h => + disjoint_left.mp (hσ.vertex_disjoint s hsV' t htV' hst) hp (h ▸ hq) + refine ⟨s, hsV', t, htV', hst, hte, p, hp, q, hq, hpq, ?_⟩ + obtain ⟨u, v, huv, ht', -⟩ := hLG' _ (hσ.edge_mem e he) + rw [ht'] at hpT hqT ⊢ + rcases hpT with rfl | rfl <;> rcases hqT with rfl | rfl + · exact absurd rfl hpq + · rfl + · exact pair_comm _ _ + · exact absurd rfl hpq + have hECdisj : ∀ e ∈ G.E, σe e ∉ C := by + intro e he hC + obtain ⟨s, hs, t, ht', hst, -, p, hp, q, hq, -, h1⟩ := hends e he + have h2 := hρC _ hC p (by rw [h1]; exact .inl rfl) q (by rw [h1]; exact .inr rfl) + rw [hρ s hs p hp, hρ t ht' q hq] at h2 + exact hst h2 + let D : Drawing S := G'.span VV (C ∪ σe '' G.E) + have hCG' : C ⊆ G'.E := hCA.trans hAE + have hσG' : σe '' G.E ⊆ G'.E := by + rintro _ ⟨e, he, rfl⟩ + exact hσ.edge_mem e he + have hDE : D.E = C ∪ σe '' G.E := by + change (G'.span VV (C ∪ σe '' G.E)).E = _ + rw [Drawing.span_E] + exact inter_eq_left.mpr (union_subset hCG' hσG') + have hUG' : VV ⊆ G'.V := iUnion₂_subset hsubV + have hDV : D.V = VV := by + apply Subset.antisymm + · rintro x (⟨hx, -⟩ | hx) + · exact hx + · obtain ⟨e, ⟨he, heG⟩, hxe, hxV⟩ := mem_iUnion₂.mp hx + have hxT : x ∈ tilde e := by + rw [tilde_eq_inter_V G' heG] + exact ⟨hxe, hxV⟩ + rcases he with he | ⟨e₀, he₀, rfl⟩ + · obtain ⟨v, hv, h⟩ := hCE e he + exact mem_iUnion₂.mpr ⟨v, hv, hsV v hv e h hxT⟩ + · obtain ⟨s, hs, t, ht', -, -, p, hp, q, hq, -, h1⟩ := hends e₀ he₀ + rw [h1] at hxT + rcases hxT with rfl | rfl + · exact mem_iUnion₂.mpr ⟨s, hs, hp⟩ + · exact mem_iUnion₂.mpr ⟨t, ht', hq⟩ + · exact fun x hx => .inl ⟨hx, hUG' hx⟩ + have hDsub : D.IsSubdrawing G' := Drawing.span_isSubdrawing G' _ _ + have hLD : LoopFree D := fun e he => hLG' e (hDsub.2 he) + have hCD : C ⊆ D.E := by rw [hDE]; exact subset_union_left + have hsd : D.E \ C = σe '' G.E := by + rw [hDE] + ext e + constructor + · rintro ⟨h1 | h1, h2⟩ + · exact absurd h1 h2 + · exact h1 + · rintro ⟨e₀, he₀, rfl⟩ + exact ⟨.inr ⟨e₀, he₀, rfl⟩, hECdisj e₀ he₀⟩ + have hforest : ∀ f ∈ C, ∀ x ∈ tilde f, ∀ y ∈ tilde f, x ≠ y → ¬ Conn (C \ {f}) x y := by + exact minimal_connecting_edges_acyclic (S := S) (G := G) (G' := G') (σv := σv) hLG' C hCg + hCmin hCG' + have hother : ∀ e ∈ D.E \ C, ∀ x ∈ tilde e, ∀ y ∈ tilde e, x ≠ y → ¬ Conn C x y := by + intro e he x hx y hy hxy hconn + rw [hsd] at he + obtain ⟨e₀, he₀, rfl⟩ := he + obtain ⟨s, hs, t, ht', hst, -, p, hp, q, hq, hpq, h1⟩ := hends e₀ he₀ + have h2 := Conn.map_eq ρ hρC hconn + rw [h1] at hx hy + rcases hx with rfl | rfl <;> rcases hy with rfl | rfl + · exact hxy rfl + · rw [hρ s hs _ hp, hρ t ht' _ hq] at h2 + exact hst h2 + · rw [hρ t ht' _ hq, hρ s hs _ hp] at h2 + exact hst h2.symm + · exact hxy rfl + obtain ⟨H, π, ε, hH, hHV, hπ, hε, hεt, hrep⟩ := exists_contract_set hT hLD hCD hforest hother + refine ⟨H, gm19_of_loopFree hb hH, ?_, hrep.trans (rep_le_of_isSubdrawing hDsub)⟩ + -- the isomorphism + have hx : ∀ v, ∃ x, v ∈ G.V → x ∈ (σv v).V := fun v => by + by_cases hv : v ∈ G.V + · obtain ⟨x, hx⟩ := hσ.vertex_nonempty v hv + exact ⟨x, fun _ => hx⟩ + · exact ⟨v, fun h => absurd h hv⟩ + choose x hx using hx + have hxD : ∀ v ∈ G.V, x v ∈ D.V := fun v hv => by + rw [hDV] + exact mem_iUnion₂.mpr ⟨v, hv, hx v hv⟩ + have hbranch : ∀ v ∈ G.V, ∀ y ∈ (σv v).V, π y = π (x v) := fun v hv y hy => by + have hyD : y ∈ D.V := by + rw [hDV] + exact mem_iUnion₂.mpr ⟨v, hv, hy⟩ + exact (hπ y hyD _ (hxD v hv)).mpr (hCg v hv y hy _ (hx v hv)) + have hπlabel : ∀ y ∈ D.V, ∀ z ∈ D.V, π y = π z → ρ y = ρ z := fun y hy z hz h => + Conn.map_eq ρ hρC ((hπ y hy z hz).mp h) + have hσE : BijOn σe G.E (σe '' G.E) := ⟨fun e he => ⟨e, he, rfl⟩, hσ.edge_injOn, fun _ h => h⟩ + rw [← hsd] at hσE + refine ⟨fun v => π (x v), ε ∘ σe, ⟨fun v hv => ?_, fun v hv w hw h => ?_, fun y hy => ?_⟩, + hε.comp hσE, ?_⟩ + · rw [hHV] + exact mem_image_of_mem _ (hxD v hv) + · have := hπlabel _ (hxD v hv) _ (hxD w hw) h + rwa [hρ v hv _ (hx v hv), hρ w hw _ (hx w hw)] at this + · rw [hHV, hDV] at hy + obtain ⟨y, hy, rfl⟩ := hy + obtain ⟨v, hv, h⟩ := hUV y hy + exact ⟨v, hv, (hbranch v hv y h).symm⟩ + · intro v hv e he + have hmem : σe e ∈ D.E \ C := hσE.mapsTo he + rw [Function.comp_apply, hεt _ hmem] + constructor + · intro h + obtain ⟨y, hy, hyT⟩ := (hσ.ends_iff e he v hv).mpr h + exact ⟨y, hyT, hbranch v hv y hy⟩ + · rintro ⟨y, hyT, hy⟩ + have hyD : y ∈ D.V := by + have : y ∈ tilde (σe e) := hyT + rw [tilde_eq_inter_V D hmem.1] at this + exact this.2 + have hl := hπlabel y hyD _ (hxD v hv) hy + rw [hρ v hv _ (hx v hv)] at hl + rw [hDV] at hyD + obtain ⟨w, hw, hyw⟩ := hUV y hyD + rw [hρ w hw y hyw] at hl + subst hl + exact (hσ.ends_iff e he w hw).mp ⟨y, hyw, hyT⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Null.lean b/LeanPool/GraphMinor/GM19/Section6Null.lean new file mode 100644 index 0000000000..1508878695 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Null.lean @@ -0,0 +1,119 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collapse +public import LeanPool.GraphMinor.GM11.Section3 +public import LeanPool.GraphMinor.GM12.Section2ArcHomotopy + +/-! +# Null-homotopic curves under a collapse + +Let `c` be a homotopy from the identity of a space to a map `φ`. If `φ ∘ ψ` is null-homotopic for a +closed curve `ψ` then so is `ψ` (`null_of_collapse`). If two arcs with common ends only are mapped +by `φ` to two loops at one point, and both loops are null-homotopic, then the `O`-arc made of the +two arcs is null-homotopic (`not_null_of_two_arcs`). These two facts are the topology behind +"`rep(H) ≤ rep(H')`" in the proof of Graph Minors XIX, (6.3) (page 340). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM12 + +local notation "𝕀" => unitInterval + +variable {T : Type} [TopologicalSpace T] + +/-- Null-homotopy of an `O`-arc does not depend on the way it is parametrized. -/ +theorem null_of_param {F : Set T} (hnull : IsNullHomotopicOArc F) (γ : C(Circle, T)) + (hr : range γ = F) : ClosedCurveIsNullHomotopicIn univ γ := by + obtain ⟨φ, x, hx, H, -, h0, h1⟩ := hnull + have hγF : ∀ z, γ z ∈ F := fun z => hr ▸ mem_range_self z + let r : C(Circle, Circle) := ⟨fun z => φ.symm ⟨γ z, hγF z⟩, by fun_prop⟩ + have hr' : ∀ z, (φ (r z)).1 = γ z := fun z => by simp [r] + refine ⟨x, hx, ⟨fun q => H (r q.1, q.2), by fun_prop⟩, fun _ => mem_univ _, fun z => ?_, + fun z => ?_⟩ + · exact (h0 (r z)).trans (hr' z) + · exact h1 (r z) + +/-- The range of an injective closed curve is an `O`-arc. -/ +theorem isOArc_range [T2Space T] {γ : C(Circle, T)} (hγ : Function.Injective γ) : IsOArc (range γ) + := + ⟨(γ.continuous.isClosedEmbedding hγ).isEmbedding.toHomeomorph⟩ + +/-- A closed curve with a null-homotopic image under the end of a homotopy from the identity is +null-homotopic. -/ +theorem null_of_collapse (c : C(𝕀 × T, T)) (h0 : ∀ x, c (0, x) = x) {ψ ψ' : C(Circle, T)} + (hψ : ∀ z, ψ' z = c (1, ψ z)) (hn : ClosedCurveIsNullHomotopicIn univ ψ') : + ClosedCurveIsNullHomotopicIn univ ψ := by + obtain ⟨x, hx, h⟩ := hn + have h1 : ClosedCurvesHomotopicIn univ ψ ψ' := + ⟨⟨fun q => c (q.2, ψ q.1), by fun_prop⟩, fun _ => mem_univ _, fun z => h0 _, fun z => + (hψ z).symm⟩ + exact ⟨x, hx, h1.trans h⟩ + +/-- A loop that is null-homotopic as a closed curve is homotopic to the constant path. -/ +theorem path_refl_of_null {w : T} (P : Path w w) {γ : C(Circle, T)} (hγ : ∀ t, γ (arcParam 1 t) + = P t) + (h : ClosedCurveIsNullHomotopicIn univ γ) : P.Homotopic (Path.refl w) := by + obtain ⟨x, -, H, -, h0, h1⟩ := h + let F : C(𝕀 × 𝕀, T) := ⟨fun q => H (arcParam 1 q.1, q.2), by fun_prop⟩ + refine loop_homotopic_refl P F (c := x) (fun s => ?_) (fun v => ?_) (fun s => ?_) + · change H (arcParam 1 s, 0) = _ + rw [h0, hγ] + · simp [F, arcParam_zero, arcParam_one] + · exact h1 _ + +/-- Two arcs with common ends, each mapped to a null-homotopic loop at one point by the end of a +homotopy from the identity, are homotopic. -/ +theorem paths_homotopic_of_collapse (c : C(𝕀 × T, T)) (h0 : ∀ x, c (0, x) = x) {u v w : T} + (p q : Path u v) (hu : c (1, u) = w) (hv : c (1, v) = w) (P Q : Path w w) + (hP : ∀ t, P t = c (1, p t)) (hQ : ∀ t, Q t = c (1, q t)) (hP' : P.Homotopic (Path.refl w)) + (hQ' : Q.Homotopic (Path.refl w)) : p.Homotopic q := by + let l : Path u w := ⟨⟨fun t => c (t, u), by fun_prop⟩, by simp [h0], by simpa using hu⟩ + let r : Path v w := ⟨⟨fun t => c (t, v), by fun_prop⟩, by simp [h0], by simpa using hv⟩ + have key : ∀ (p : Path u v) (P : Path w w), (∀ t, P t = c (1, p t)) → P.Homotopic (Path.refl w) → + (p.trans r).Homotopic (l.trans (Path.refl w)) := by + intro p P hP hP' + let F : C(𝕀 × 𝕀, T) := ⟨fun x => c (x.2, p x.1), by fun_prop⟩ + have h := homotopic_of_square F p r l P (fun s => h0 _) (fun t => by simp [F, r]) + (fun t => by simp [F, l]) (fun s => (hP s).symm) + exact h.trans ((Path.Homotopic.refl l).hcomp hP') + have h1 := (key p P hP hP').trans (key q Q hQ hQ').symm + have cancel : ∀ p : Path u v, ((p.trans r).trans r.symm).Homotopic p := fun p => + (Path.Homotopic.trans_assoc p r r.symm).trans + (((Path.Homotopic.refl p).hcomp (Path.Homotopic.trans_symm r)).trans + (Path.Homotopic.trans_refl p)) + exact (cancel p).symm.trans ((h1.hcomp (Path.Homotopic.refl r.symm)).trans (cancel q)) + +/-- If an `O`-arc made of two arcs is not null-homotopic, and the end of a homotopy from the +identity maps the ends of the arcs to one point, then one of the two resulting loops is not +null-homotopic. -/ +theorem not_null_of_two_arcs [T2Space T] (c : C(𝕀 × T, T)) (h0 : ∀ x, c (0, x) = x) {a b : 𝕀 → T} + (h : IsTwoArcs a b) {w : T} (hu : c (1, a 0) = w) (hv : c (1, a 1) = w) + (hn : ¬ IsNullHomotopicOArc (range a ∪ range b)) {γa γb : C(Circle, T)} + (hγa : ∀ t, γa (arcParam 1 t) = c (1, a t)) (hγb : ∀ t, γb (arcParam 1 t) = c (1, b t)) : + ¬ ClosedCurveIsNullHomotopicIn univ γa ∨ ¬ ClosedCurveIsNullHomotopicIn univ γb := by + by_contra hc + push Not at hc + apply hn + let p : Path (a 0) (a 1) := ⟨⟨a, h.arc_left.1⟩, rfl, rfl⟩ + let q : Path (a 0) (a 1) := ⟨⟨b, h.arc_right.1⟩, h.zero, h.one⟩ + let P : Path w w := ⟨⟨fun t => c (1, a t), by have := h.arc_left.1; fun_prop⟩, hu, hv⟩ + let Q : Path w w := ⟨⟨fun t => c (1, b t), by have := h.arc_right.1; fun_prop⟩, + by change c (1, b 0) = w; rw [h.zero, hu], by change c (1, b 1) = w; rw [h.one, hv]⟩ + have hpq := paths_homotopic_of_collapse c h0 p q hu hv P Q (fun _ => rfl) (fun _ => rfl) + (path_refl_of_null P hγa hc.1) (path_refl_of_null Q hγb hc.2) + have := nullHomotopic_union_of_homotopic_arcs p q h.arc_left.2 h.arc_right.2 (fun s t he + => h.meet s t he) hpq + exact this + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Path.lean b/LeanPool/GraphMinor/GM19/Section6Path.lean new file mode 100644 index 0000000000..af210726f5 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Path.lean @@ -0,0 +1,132 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Graph + +/-! +# Paths of a connected drawing as lines + +If two vertices are joined in the graph of a drawing without loops, then a path between them is a +line in the surface (`exists_line_of_connected`). We keep its vertices and edges, for the proof of +(6.6) of Graph Minors XIX. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +theorem exists_line_of_walk (D : Drawing S) (hl : LoopFree D) {X : Set S} (hX : X ⊆ D.V) {a b : X} + (p : (D.adj.induce X).Walk a b) : p.IsPath → a ≠ b → + ∃ (Vq : Set S) (Eq : Set (Set S)), (∀ x ∈ Vq, ∃ h : x ∈ X, (⟨x, h⟩ : X) ∈ p.support) ∧ Eq ⊆ D.E + ∧ a.1 ∈ Vq ∧ b.1 ∈ Vq ∧ (∀ e ∈ Eq, tilde e ⊆ Vq) ∧ IsLineWithEnds (Vq ∪ ⋃₀ Eq) a b := by + induction p with + | nil => exact fun _ hab => absurd rfl hab + | @cons a w b hadj q ih => + intro hp hab + rw [SimpleGraph.Walk.cons_isPath_iff] at hp + have hadj' : D.adj.Adj a.1 w.1 := hadj + obtain ⟨hne, -, -, e, he, h1, h2⟩ := hadj' + obtain ⟨u, v, huv, hti, hL⟩ := hl e he + have hti' : tilde e = {a.1, w.1} := by + rw [hti] at h1 h2 ⊢ + rcases h1 with h1 | h1 <;> rcases h2 with h2 | h2 + · exact absurd (h1.trans h2.symm) hne + · rw [h1, mem_singleton_iff.mp h2] + · rw [mem_singleton_iff.mp h1, h2, pair_comm] + · exact absurd ((mem_singleton_iff.mp h1).trans (mem_singleton_iff.mp h2).symm) hne + have hLe : IsLineWithEnds (closure e) a w := by + rw [hti] at h1 h2 + rcases h1 with h1 | h1 <;> rcases h2 with h2 | h2 + · exact absurd (h1.trans h2.symm) hne + · rw [h1, mem_singleton_iff.mp h2]; exact hL + · rw [mem_singleton_iff.mp h1, h2]; exact GraphMinor.GM11.IsLineWithEnds.symm hL + · exact absurd ((mem_singleton_iff.mp h1).trans (mem_singleton_iff.mp h2).symm) hne + have hcl : closure e = e ∪ {a.1, w.1} := by + rw [← hti', tilde] + exact (union_sdiff_cancel subset_closure).symm + by_cases hwb : w = b + · subst hwb + refine ⟨{a.1, w.1}, {e}, ?_, singleton_subset_iff.mpr he, .inl rfl, .inr rfl, ?_, ?_⟩ + · rintro x (rfl | rfl) + · exact ⟨a.2, by simp⟩ + · exact ⟨w.2, by simp⟩ + · rintro f hf + rw [mem_singleton_iff.mp hf, hti'] + · rw [sUnion_singleton, union_comm, ← hcl] + exact hLe + · obtain ⟨Vq, Eq, h₁, h₂, h₃, h₄, h₅, h₆⟩ := ih hp.1 hwb + have hVV : Vq ⊆ D.V := fun x hx => hX (h₁ x hx).1 + have haV : a.1 ∉ Vq := fun h => by + obtain ⟨h', hs⟩ := h₁ _ h + exact hp.2 hs + have hLq : ∀ {x}, x ∈ Vq ∪ ⋃₀ Eq → x ∈ D.V → x ∈ Vq := fun {x} hx hxV => by + rcases hx with hx | ⟨f, hf, hxf⟩ + · exact hx + · exact absurd hxV ((h₂ hf).2.1 hxf).2 + have hcap : closure e ∩ (Vq ∪ ⋃₀ Eq) = {w.1} := by + apply Subset.antisymm + · rintro x ⟨hxe, hxq⟩ + by_cases hxV : x ∈ D.V + · have hx1 : x ∈ tilde e := GM19.tilde_eq_inter_V D he ▸ ⟨hxe, hxV⟩ + rw [hti'] at hx1 + rcases hx1 with rfl | hx1 + · exact absurd (hLq hxq hxV) haV + · exact hx1 + · rcases hxq with hx | ⟨f, hf, hxf⟩ + · exact absurd (hVV hx) hxV + · have hef := edge_eq_of_mem D he (h₂ hf) hxe (subset_closure hxf) hxV + subst hef + have : a.1 ∈ tilde e := by rw [hti']; exact .inl rfl + exact absurd (h₅ e hf this) haV + · rintro _ rfl + exact ⟨hLe.right_mem, .inl h₃⟩ + have hU := IsLineWithEnds.union hLe h₆ hcap + refine ⟨insert a.1 Vq, insert e Eq, ?_, ?_, .inl rfl, .inr h₄, ?_, ?_⟩ + · rintro x (rfl | hx) + · exact ⟨a.2, by simp⟩ + · obtain ⟨h, hs⟩ := h₁ x hx + exact ⟨h, by simp [hs]⟩ + · exact insert_subset he h₂ + · rintro f (rfl | hf) x hx + · rw [hti'] at hx + rcases hx with rfl | hx + · exact .inl rfl + · exact .inr (mem_singleton_iff.mp hx ▸ h₃) + · exact .inr (h₅ f hf hx) + · have e' : insert a.1 Vq ∪ ⋃₀ insert e Eq = closure e ∪ (Vq ∪ ⋃₀ Eq) := by + rw [sUnion_insert, hcl] + ext x + simp only [mem_union, mem_insert_iff, mem_singleton_iff] + constructor + · tauto + · rintro ((h | h | h) | h | h) + · tauto + · tauto + · exact .inl (.inr (h ▸ h₃)) + · tauto + · tauto + rw [e'] + exact hU + +/-- **A path as a line.** See the module docstring. -/ +theorem exists_line_of_connected (D : Drawing S) (hl : LoopFree D) {X : Set S} (hX : X ⊆ D.V) (hc : + (D.adj.induce X).Preconnected) {a b : S} (ha : a ∈ X) (hb : b ∈ X) (hab : a ≠ b) : + ∃ (Vq : Set S) (Eq : Set (Set S)), Vq ⊆ X ∧ Eq ⊆ D.E ∧ a ∈ Vq ∧ b ∈ Vq ∧ + (∀ e ∈ Eq, tilde e ⊆ Vq) ∧ IsLineWithEnds (Vq ∪ ⋃₀ Eq) a b := by + obtain ⟨p, hp⟩ := (hc ⟨a, ha⟩ ⟨b, hb⟩).exists_isPath + obtain ⟨Vq, Eq, h₁, h₂, h₃, h₄, h₅, h₆⟩ := exists_line_of_walk D hl hX p hp (fun h => hab + (congrArg Subtype.val h)) + exact ⟨Vq, Eq, fun x hx => (h₁ x hx).1, h₂, h₃, h₄, h₅, h₆⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Region.lean b/LeanPool/GraphMinor/GM19/Section6Region.lean new file mode 100644 index 0000000000..4bd57c2a8b --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Region.lean @@ -0,0 +1,277 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Graph +public import LeanPool.GraphMinor.GM19.Section6Reroute +public import LeanPool.GraphMinor.GM11.RadialAccess +public import LeanPool.GraphMinor.Surface.EdgeLens +public import LeanPool.GraphMinor.Surface.ArcInPath +public import LeanPool.GraphMinor.Surface.Crossing + +/-! +# Regions of a drawing near an edge + +The facts about regions that the proof of (6.6) of Graph Minors XIX uses. If a point of an edge lies +in the closure of a region, then so does the whole edge (`edge_subset_closure`). Two vertices in the +closure of a region are joined by a line through the region (`exists_line_in_region`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GM11 + +local notation "𝕀" => unitInterval + +variable {S : Type} [TopologicalSpace S] + +theorem region_props [LocallyConnectedSpace S] (G : Drawing S) {r : Set S} + (hr : r ∈ G.regions) : + IsOpen r ∧ IsPreconnected r ∧ r.Nonempty ∧ Disjoint r G.U ∧ (∀ A : Set S, IsPreconnected A + → Disjoint A G.U → (A ∩ r).Nonempty → A ⊆ r) ∧ closure r \ r ⊆ G.U := by + obtain ⟨x, hx, rfl⟩ := id hr + have hO : IsOpen G.Uᶜ := G.isClosed_U.isOpen_compl + have hsub : connectedComponentIn G.Uᶜ x ⊆ G.Uᶜ := connectedComponentIn_subset _ _ + refine ⟨hO.connectedComponentIn, isPreconnected_connectedComponentIn, ⟨x, + mem_connectedComponentIn hx⟩, Set.disjoint_left.mpr fun y hy hyU => hsub hy hyU, ?_, ?_⟩ + · rintro A hA hd ⟨y, hyA, hyr⟩ + rw [connectedComponentIn_eq hyr] + exact hA.subset_connectedComponentIn hyA fun z hz hzU => Set.disjoint_left.mp hd hz hzU + · rintro z ⟨hz, hzr⟩ + by_contra hzU + have hopen : IsOpen (connectedComponentIn G.Uᶜ z) := hO.connectedComponentIn + obtain ⟨w, hw₁, hw₂⟩ := mem_closure_iff.mp hz _ hopen (mem_connectedComponentIn hzU) + exact hzr ((connectedComponentIn_eq hw₂).trans (connectedComponentIn_eq hw₁).symm ▸ + mem_connectedComponentIn hzU) + +variable [T2Space S] + +/-- Near a point of an edge, the edge lies in the closure of each region that has the point in its +closure. -/ +theorem exists_nhds_edge (hT : IsClosedSurface S) (G : Drawing S) (hl : LoopFree G) {e r : Set S} + (he : e ∈ G.E) (hr : r ∈ G.regions) {x : S} (hxe : x ∈ e) (hxr : x ∈ closure r) : + ∃ O, IsOpen O ∧ x ∈ O ∧ e ∩ O ⊆ closure r := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hT + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + obtain ⟨hro, -, -, hrU, hrA, -⟩ := region_props G hr + obtain ⟨p, q, hpq, hti, hlin⟩ := hl e he + obtain ⟨a, ha, hrg, ha0, ha1⟩ := hlin.exists_arc + have hcl : closure e = e ∪ tilde e := by + rw [tilde] + exact (union_sdiff_cancel subset_closure).symm + have hxcl : x ∈ range a := hrg ▸ subset_closure hxe + obtain ⟨t, rfl⟩ := hxcl + have hee : Disjoint e (tilde e) := Set.disjoint_left.mpr fun y hy hy' => hy'.2 hy + have hedV : Disjoint e G.V := Set.disjoint_left.mpr fun y hy hy' => (he.2.1 hy).2 hy' + have hmid : ∀ s, a s ∈ e ∨ s = 0 ∨ s = 1 := fun s => by + have h1 : a s ∈ closure e := hrg ▸ mem_range_self s + rw [hcl] at h1 + rcases h1 with h1 | h1 + · exact .inl h1 + · rw [hti] at h1 + rcases h1 with h1 | h1 + · exact .inr (.inl (ha.2 (h1.trans ha0.symm))) + · exact .inr (.inr (ha.2 (h1.trans ha1.symm))) + have hptilde : p ∈ tilde e ∧ q ∈ tilde e := by rw [hti]; simp + have h0e : a 0 ∉ e := by rw [ha0]; exact hptilde.1.2 + have h1e : a 1 ∉ e := by rw [ha1]; exact hptilde.2.2 + have ht0 : (0 : ℝ) < t := lt_of_le_of_ne t.2.1 fun h => h0e (by + have : t = 0 := Subtype.ext h.symm + rwa [this] at hxe) + have ht1 : (t : ℝ) < 1 := lt_of_le_of_ne t.2.2 fun h => h1e (by + have : t = 1 := Subtype.ext h + rwa [this] at hxe) + let t₁ : 𝕀 := ⟨t / 2, by constructor <;> linarith⟩ + let t₂ : 𝕀 := ⟨(1 + t) / 2, by constructor <;> linarith⟩ + have h1t : t₁ < t := by + change (t : ℝ) / 2 < t + linarith + have ht2 : t < t₂ := by + change (t : ℝ) < (1 + t) / 2 + linarith + have h12 : t₁ < t₂ := h1t.trans ht2 + have hL : IsLineWithEnds (a '' Icc t₁ t₂) (a t₁) (a t₂) := by + have h1 := (ha.sub (ne_of_lt h12)).isLineWithEnds + rwa [range_subArc a h12.le, subArc_zero, subArc_one] at h1 + have hane : a t₁ ≠ a t₂ := fun h => (ne_of_lt h12) (ha.2 h) + let Z : Set S := (G.V ∪ ⋃ f ∈ G.E \ {e}, closure f) ∪ (a '' Iic t₁ ∪ a '' Ici t₂) + have hZ : IsClosed Z := by + refine IsClosed.union (G.finite_V.isClosed.union ?_) ?_ + · exact (G.finite_edges.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure + · exact (isClosed_Iic.isCompact.image ha.1).isClosed.union (isClosed_Ici.isCompact.image + ha.1).isClosed + have hinner : ∀ s, 0 < s → s < 1 → a s ∈ e := fun s h0 h1 => by + rcases hmid s with h | h | h + · exact h + · exact absurd h (ne_of_gt h0) + · exact absurd h (ne_of_lt h1) + have hLZ : a '' Icc t₁ t₂ ∩ Z ⊆ {a t₁, a t₂} := by + rintro _ ⟨⟨s, hs, rfl⟩, hz⟩ + have ht₁ : (t₁ : ℝ) = t / 2 := rfl + have ht₂ : (t₂ : ℝ) = (1 + t) / 2 := rfl + have hs1' : (t₁ : ℝ) ≤ s := hs.1 + have hs2' : (s : ℝ) ≤ t₂ := hs.2 + have hs0 : 0 < s := by + change (0 : ℝ) < s + linarith + have hs1 : s < 1 := by + change (s : ℝ) < 1 + linarith + have hse := hinner s hs0 hs1 + rcases hz with (hz | hz) | hz | hz + · exact absurd hz (Set.disjoint_left.mp hedV hse) + · obtain ⟨f, hf, hsf⟩ := mem_iUnion₂.mp hz + exact absurd (edge_eq_of_mem G he hf.1 (subset_closure hse) hsf + (Set.disjoint_left.mp hedV hse)) (fun h => hf.2 h.symm) + · obtain ⟨w, hw, hwe⟩ := hz + have := ha.2 hwe + subst this + exact .inl (congrArg a (le_antisymm hw hs.1 : w = t₁)) + · obtain ⟨w, hw, hwe⟩ := hz + have := ha.2 hwe + subst this + exact .inr (congrArg a (le_antisymm hs.2 hw : w = t₂)) + obtain ⟨D, A, B, hD, hLD, hDZ, -, -, hbL, hDe, hAc, hBc, hAn, hBn, hAL, hBL, hLA, hLB, -⟩ + := exists_edge_lens hT hL hane hZ hLZ + have hUZ : G.U ⊆ Z ∪ a '' Icc t₁ t₂ := fun y hy => by + by_cases hyV : y ∈ G.V + · exact .inl (.inl (.inl hyV)) + obtain ⟨f, hf, hyf⟩ := exists_edge_of_mem G hy hyV + by_cases hfe : f = e + · subst hfe + obtain ⟨s, rfl⟩ : y ∈ range a := hrg ▸ subset_closure hyf + rcases le_total s t₁ with h | h + · exact .inl (.inr (.inl ⟨s, h, rfl⟩)) + rcases le_total t₂ s with h' | h' + · exact .inl (.inr (.inr ⟨s, h', rfl⟩)) + · exact .inr ⟨s, ⟨h, h'⟩, rfl⟩ + · exact .inl (.inl (.inr (mem_iUnion₂.mpr ⟨f, ⟨hf, hfe⟩, subset_closure hyf⟩))) + have hsideU : ∀ {C : Set S}, C ⊆ D → Disjoint C (a '' Icc t₁ t₂) → Disjoint C G.U + := fun {C} hC hdis => Set.disjoint_left.mpr fun y hy hyU => by + rcases hUZ hyU with h | h + · apply Set.disjoint_left.mp hdis hy + rcases hDZ ⟨hC hy, h⟩ with h' | h' + · exact h' ▸ ⟨t₁, ⟨le_rfl, h12.le⟩, rfl⟩ + · exact h' ▸ ⟨t₂, ⟨h12.le, le_rfl⟩, rfl⟩ + · exact Set.disjoint_left.mp hdis hy h + have hAsub : A ⊆ D := by rw [hDe]; exact fun y hy => .inl (.inl hy) + have hBsub : B ⊆ D := by rw [hDe]; exact fun y hy => .inl (.inr hy) + have hxL : a t ∈ a '' Icc t₁ t₂ := ⟨t, ⟨h1t.le, ht2.le⟩, rfl⟩ + have hxbd : a t ∉ discBd D := fun h => by + rcases hbL ⟨h, hxL⟩ with h' | h' + · exact (ne_of_gt h1t) (ha.2 h') + · exact (ne_of_lt ht2) (ha.2 h') + have hOopen : IsOpen (discInt D) := hD.isOpen_discInt hman + have hLU : a '' Icc t₁ t₂ ⊆ G.U := by + rintro _ ⟨s, -, rfl⟩ + have : closure e ⊆ G.U := G.closure_subset_U he + exact this (hrg ▸ mem_range_self s) + refine ⟨discInt D, hOopen, ⟨hLD hxL, hxbd⟩, ?_⟩ + have hmeet : (r ∩ discInt D).Nonempty := by + obtain ⟨y, hy1, hy2⟩ := mem_closure_iff.mp hxr _ hOopen ⟨hLD hxL, hxbd⟩ + exact ⟨y, hy2, hy1⟩ + obtain ⟨y, hyr, hyD⟩ := hmeet + have hyL : y ∉ a '' Icc t₁ t₂ := fun h => Set.disjoint_left.mp hrU hyr (hLU h) + have hyD' : y ∈ A ∪ B ∪ a '' Icc t₁ t₂ := hDe ▸ hyD.1 + have hLcl : a '' Icc t₁ t₂ ⊆ closure r := by + rcases hyD' with (hyA | hyB) | h + · exact hLA.trans (closure_mono (hrA A hAc (hsideU hAsub hAL) ⟨y, hyA, hyr⟩)) + · exact hLB.trans (closure_mono (hrA B hBc (hsideU hBsub hBL) ⟨y, hyB, hyr⟩)) + · exact absurd h hyL + rintro w ⟨hwe, hwD⟩ + have hwU : w ∈ G.U := by + have : closure e ⊆ G.U := G.closure_subset_U he + exact this (subset_closure hwe) + rcases hUZ hwU with h | h + · rcases hDZ ⟨hwD.1, h⟩ with h' | h' + · exact hLcl ⟨t₁, ⟨le_rfl, h12.le⟩, h'.symm⟩ + · exact hLcl ⟨t₂, ⟨h12.le, le_rfl⟩, h'.symm⟩ + · exact hLcl h + +/-- **An edge with a point in the closure of a region lies in that closure.** -/ +theorem edge_subset_closure (hT : IsClosedSurface S) (G : Drawing S) (hl : LoopFree G) {e r : Set + S} (he : e ∈ G.E) (hr : r ∈ G.regions) (hne : (e ∩ closure r).Nonempty) : e ⊆ closure r := by + classical + choose! O hO hxO hsub using fun x (hx : x ∈ e ∩ closure r) => exists_nhds_edge hT G hl he hr hx.1 + hx.2 + have hc : IsPreconnected e := he.2.2.1.isConnected.isPreconnected + by_contra hn + obtain ⟨y, hye, hyr⟩ := not_subset.mp hn + let u : Set S := ⋃ x ∈ e ∩ closure r, O x + have hu : IsOpen u := isOpen_biUnion fun x hx => hO x hx + obtain ⟨x, hxe, hxr⟩ := hne + obtain ⟨z, hze, hzu, hzr⟩ := hc u (closure r)ᶜ hu isClosed_closure.isOpen_compl + (fun w hw => by + by_cases h : w ∈ closure r + · exact .inl (mem_iUnion₂.mpr ⟨w, ⟨hw, h⟩, hxO w ⟨hw, h⟩⟩) + · exact .inr h) + ⟨x, hxe, mem_iUnion₂.mpr ⟨x, ⟨hxe, hxr⟩, hxO x ⟨hxe, hxr⟩⟩⟩ ⟨y, hye, hyr⟩ + obtain ⟨w, hw, hzw⟩ := mem_iUnion₂.mp hzu + exact hzr (hsub w hw ⟨hze, hzw⟩) + +/-- **A line through a region.** Two vertices with an edge each, in the closure of a region, are +joined by a line that runs through the region. It follows from the path of `GM11.exists_access` at +each end. -/ +theorem exists_line_in_region (hT : IsClosedSurface S) [Nonempty S] (G : Drawing S) {r : Set S} + (hr : r ∈ G.regions) {a b : S} (ha : a ∈ G.V) (hb : b ∈ G.V) (hab : a ≠ b) + (hae : ∃ e ∈ G.E, a ∈ tilde e) (hbe : ∃ e ∈ G.E, b ∈ tilde e) (har : a ∈ closure r) + (hbr : b ∈ closure r) : + ∃ L, IsLineWithEnds L a b ∧ L \ {a, b} ⊆ r := by + classical + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hT + obtain ⟨hro, -, hrn, -, -, -⟩ := region_props G hr + obtain ⟨γ, hγ⟩ := exists_edgePar G + have hhalf : ∀ x, (∃ e ∈ G.E, x ∈ tilde e) → (halfEdges G γ x).Nonempty := by + rintro x ⟨e, he, hx⟩ + have h1 : x ∈ closure e ∩ G.V := GM19.tilde_eq_inter_V G he ▸ hx + rw [closure_inter_V_eq hγ he] at h1 + rcases h1 with h1 | h1 + · exact ⟨(e, false), he, h1.symm⟩ + · exact ⟨(e, true), he, h1.symm⟩ + have hR : r ∈ G.R := by + change r ∈ componentsIn (univ \ G.U) + rw [← compl_eq_univ_sdiff] + exact hr + obtain ⟨g₁, hg₁, g₁0, g₁t⟩ := exists_access hT G hγ ha (hhalf a hae) hR har + obtain ⟨g₂, hg₂, g₂0, g₂t⟩ := exists_access hT G hγ hb (hhalf b hbe) hR hbr + have hpc : IsPathConnected r := isPathConnected_of_isOpen hT hro (region_props G hr).2.1 hrn + have h1r : g₁ 1 ∈ r := g₁t 1 (by simp) + have h2r : g₂ 1 ∈ r := g₂t 1 (by simp) + let P₁ : Path a (g₁ 1) := ⟨⟨g₁, hg₁⟩, g₁0, rfl⟩ + let P₂ : Path b (g₂ 1) := ⟨⟨g₂, hg₂⟩, g₂0, rfl⟩ + obtain ⟨M, hM⟩ := hpc.joinedIn _ h1r _ h2r + let P := P₁.trans (M.trans P₂.symm) + obtain ⟨c, hc, hci, hc0, hc1, hcr⟩ := exists_arc_of_path (γ := P) P.continuous + (by simpa [P] using hab) + have hP0 : P 0 = a := P.source + have hP1 : P 1 = b := P.target + refine ⟨range c, ?_, ?_⟩ + · have h := IsArcMap.isLineWithEnds (a := c) ⟨hc, hci⟩ + rwa [hc0, hc1, hP0, hP1] at h + · rintro y ⟨hy, hyn⟩ + have hy' : y ∈ range P := hcr hy + have hyab : y ≠ a ∧ y ≠ b := by simpa using hyn + have hrP : range P = range P₁ ∪ (range M ∪ range P₂) := by + simp only [P, Path.trans_range, Path.symm_range] + rw [hrP] at hy' + rcases hy' with ⟨t, rfl⟩ | ⟨t, rfl⟩ | ⟨t, rfl⟩ + · by_cases ht : t = 0 + · subst ht + exact absurd g₁0 hyab.1 + · exact g₁t t (unitInterval.pos_iff_ne_zero.mpr ht) + · exact hM t + · by_cases ht : t = 0 + · subst ht + exact absurd g₂0 hyab.2 + · exact g₂t t (unitInterval.pos_iff_ne_zero.mpr ht) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Rep.lean b/LeanPool/GraphMinor/GM19/Section6Rep.lean new file mode 100644 index 0000000000..1f296ecf65 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Rep.lean @@ -0,0 +1,742 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Block +public import LeanPool.GraphMinor.GM19.Section6Walk +public import LeanPool.GraphMinor.GM19.Section8e +public import LeanPool.GraphMinor.GM19.Poles + +/-! +# Graph Minors XIX, (6.7): a curve of `sk(Γ)` gives a walk of `Γ*` + +The paper's proof of (6.7), page 342, ends with "The second claim is clear". Here is one way to see +that `rep(sk(Γ)) ≥ rep(Γ)`. Let `F` be a non-null-homotopic `O`-arc that meets `sk(Γ)` only in `m` +vertices. Then `F` is a closed curve made of `m` paths between vertices, each in a region of +`sk(Γ)`. +We replace each by a homotopic path of length 2 in `Γ*` (`segment_walk`), and we get a closed walk +of +`Γ*` of length at most `2m` that is not null-homotopic. So `Γ*` has a circuit that is not +null-homotopic +with at most `2m` edges (`exists_circuit_of_walk`). + +If the region is a region of `Γ` in `Σ̂`, the path of length 2 goes through the vertex of `Γ*` in +the +region. The two paths are homotopic since the region together with one vertex is simply connected, +which +is `sector_homotopic`. If the region is inside the disc of an edge of size 3, we first move the path +across an edge of `sk(Γ)` on the boundary of the disc, into a region of `Γ` beside that edge. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +local notation "𝕀" => unitInterval + +/-- The skeleton edge along a three-ended cell joining two of its vertices, with a point in +the open edge. -/ +theorem exists_sk_boundary_with_point {S : Type} + [TopologicalSpace S] [T2Space S] (Γ : Painting S) {c₀ : Set S} (hc₀ : c₀ ∈ Γ.E) + (h3c : (tilde c₀).ncard = 3) {u₀ v₀ : S} + (hut : u₀ ∈ tilde c₀) (hvt : v₀ ∈ tilde c₀) (huv₀ : u₀ ≠ v₀) : + ∃ f ∈ arcComponentsIn (Γ.skU \ Γ.V), f ⊆ discBd (closure c₀) ∧ f ⊆ c₀ ∧ + tilde f = {u₀, v₀} ∧ ∃ x ∈ f, x ∈ c₀ ∧ x ∉ Γ.V := by + classical + obtain ⟨hdisc, hT', -⟩ := Γ.isDisc_of_three hc₀ h3c + have htil : ∀ {x₀ : S}, x₀ ∈ closure c₀ → x₀ ∈ Γ.V → x₀ ∈ tilde c₀ := fun hx hxV => + ⟨hx, fun h => Γ.disjoint_V hc₀ h hxV⟩ + have hu₀ : u₀ ∈ Γ.V := Γ.tilde_subset_V hc₀ hut + have hv₀ : v₀ ∈ Γ.V := Γ.tilde_subset_V hc₀ hvt + obtain ⟨w₀, hw₀, hwu, hwv⟩ : ∃ w₀ ∈ tilde c₀, w₀ ≠ u₀ ∧ w₀ ≠ v₀ := by + by_contra hn + push Not at hn + have hsub : tilde c₀ ⊆ {u₀, v₀} := fun x hx => by + by_cases hxu : x = u₀ + · exact .inl hxu + · exact .inr (hn x hx hxu) + have := ncard_le_ncard hsub (toFinite _) + have h2 := ncard_pair huv₀ + omega + have htri : tilde c₀ = {u₀, v₀, w₀} := by + refine (eq_of_subset_of_ncard_le (s := {u₀, v₀, w₀}) ?_ ?_ (Γ.isDisc_of_three hc₀ h3c).2.2).symm + · rintro x (rfl | rfl | rfl) + · exact hut + · exact hvt + · exact hw₀ + · rw [h3c, ncard_eq_toFinset_card', Set.toFinset_insert, Set.toFinset_insert] + simp [Finset.card_insert_of_notMem, huv₀, hwu.symm, hwv.symm] + obtain ⟨A₁, A₂, hA₁, hA₂, hAU, hAI⟩ := hdisc.isOArc_discBd.lines (hT' hut) (hT' hvt) huv₀ + obtain ⟨A₀, hA₀, hAw, hAB⟩ : ∃ A₀, IsLineWithEnds A₀ u₀ v₀ ∧ w₀ ∉ A₀ ∧ A₀ ⊆ discBd (closure c₀) + := by + by_cases hw₁ : w₀ ∈ A₁ + · refine ⟨A₂, hA₂, fun hw₂ => ?_, hAU ▸ subset_union_right⟩ + have : w₀ ∈ A₁ ∩ A₂ := ⟨hw₁, hw₂⟩ + rw [hAI] at this + rcases this with h | h + · exact hwu h + · exact hwv h + · exact ⟨A₁, hA₁, hw₁, hAU ▸ subset_union_left⟩ + have hint₀ : ∀ {x}, x ∈ A₀ \ {u₀, v₀} → x ∈ c₀ ∧ x ∈ Γ.skU \ Γ.V := by + intro x hx + have hxB := hAB hx.1 + have hxcl : x ∈ closure c₀ := Surface.discBd_subset _ hxB + have hxV : x ∉ Γ.V := fun h => by + have h₁ := htil hxcl h + rw [htri] at h₁ + rcases h₁ with h₁ | h₁ | h₁ + · exact hx.2 (.inl h₁) + · exact hx.2 (.inr h₁) + · exact hAw (h₁ ▸ hx.1) + refine ⟨by_contra fun h => hxV (Γ.tilde_subset_V hc₀ ⟨hxcl, h⟩), ?_, hxV⟩ + exact Or.inr (mem_iUnion₂.2 ⟨c₀, ⟨hc₀, h3c⟩, hxB⟩) + have hpc := isPathConnected_sdiff_pair hA₀ + obtain ⟨f, hf, hsubf⟩ := exists_arcComp_superset hpc fun x hx => (hint₀ hx).2 + obtain ⟨x₀, hx₀⟩ := hpc.nonempty + have hx₀f := hsubf hx₀ + obtain ⟨p, q, hpq, ht, htV, hline⟩ := Γ.sk_line hf + have hclf : A₀ ⊆ closure f := hA₀.subset_closure_diff.trans (closure_mono hsubf) + have htf : ∀ {y}, y ∈ A₀ → y ∈ Γ.V → y ∈ tilde f := fun hy hyV => + ⟨hclf hy, fun h => (hf.2.1 h).2 hyV⟩ + have ht' : tilde f = {u₀, v₀} := by + refine (eq_of_subset_of_ncard_le (s := {u₀, v₀}) ?_ ?_ (by rw [ht]; exact toFinite _)).symm + · rintro y (rfl | rfl) + · exact htf hA₀.left_mem hu₀ + · exact htf hA₀.right_mem hv₀ + · rw [ht, ncard_pair hpq, ncard_pair huv₀] + rcases Γ.sk_cases hf with ⟨hfE, h2⟩ | ⟨c, hc, -, hfc, hfB⟩ + · have := arcComp_eq_of_mem hfE hc₀ hx₀f (hint₀ hx₀).1 + rw [this, h3c] at h2 + omega + · obtain rfl := arcComp_eq_of_mem hc hc₀ (hfc hx₀f) (hint₀ hx₀).1 + exact ⟨f, hf, hfB, hfc, ht', x₀, hx₀f, (hint₀ hx₀).1, (hint₀ hx₀).2.2⟩ + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {D : Drawing Shat} + +omit [T2Space S] [T2Space Shat] in +/-- Each region of `sk(Γ)` in `Σ̂` is an open disc. -/ +theorem sk_region_disc (hS : IsSurface S) (hD : IsSkHat cap Γ D) + (h3 : Γ.IsInternallyThreeConnected) {r : Set Shat} (hr : r ∈ D.R) : IsOpenDisc r := by + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + rcases hD.region_cases hr with hh | ⟨c₀, hc₀, h3c, hrs⟩ + · exact h3.hatRegions_isOpenDisc hS cap r hh + · obtain ⟨hΔ, hint, hU⟩ := cell_facts hD hr hc₀ h3c rfl hrs + have hdis : Disjoint (discInt (cap.emb '' closure c₀)) D.U := + disjoint_left.mpr fun x hx hxU => hx.2 (hU ⟨hx.1, hxU⟩) + obtain ⟨y, hy⟩ := region_nonempty hr + have hsub := subset_region hr hΔ.isPreconnected_discInt hdis (hint hy) hy + rw [Subset.antisymm hint hsub] + exact isOpenDisc_discInt hman hΔ + +/-- An `O`-arc through a vertex `v` that otherwise lies in a region of `sk(Γ)` bounds a disc that +meets +`sk(Γ)` only at `v`. -/ +theorem sk_pinch (hS : IsSurface S) (hD : IsSkHat cap Γ D) (h3 : Γ.IsInternallyThreeConnected) + {r : Set Shat} (hr : r ∈ D.R) {v : Shat} (hv : v ∈ D.V) : + ∀ F : Set Shat, IsOArc F → v ∈ F → v ∈ closure (F \ {v}) → F \ {v} ⊆ r → + ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = F ∧ Δ ∩ D.U ⊆ {v} := by + intro F hF hvF hcl hsub + have hT := cap.isClosedSurface + rcases hD.region_cases hr with hh | ⟨c₀, hc₀, h3c, hrs⟩ + · rw [hD.hV] at hv + obtain ⟨v₀, hv₀, rfl⟩ := hv + exact pinch hS hD h3 hh hv₀ hF hvF hcl hsub + · obtain ⟨hΔ, hint, hU⟩ := cell_facts hD hr hc₀ h3c rfl hrs + have hrΔ : closure r ⊆ cap.emb '' closure c₀ := closure_minimal hrs hΔ.isClosed + refine pinch_of_cell hT hΔ hF (fun x hx ↦ ?_) (fun x hx ↦ hint (hsub hx)) hU + by_cases hxv : x = v + · exact hrΔ (closure_mono hsub (hxv ▸ hcl)) + · exact (hint (hsub ⟨hx, hxv⟩)).1 + +omit [T2Space S] [T2Space Shat] in +/-- `Γ*` has no loops. -/ +theorem rad_loopFree (rad : RadialDrawing cap Γ) : LoopFree rad.G := by + intro e he + obtain ⟨v, hv, w, hw, hset⟩ := rad.edge_ends he + have hne : cap.emb v ≠ w := fun h => hw.2 (h ▸ mem_image_of_mem _ hv) + exact ⟨_, _, hne, by rw [tilde_eq_inter_V rad.G he, hset], isLine_closure he hne hset⟩ + +theorem cancel_mid {X : Type} [TopologicalSpace X] {x y z w : X} (a : Path x y) (l : Path y z) + (b : Path y w) : + ((a.trans l).trans (b.symm.trans l).symm).Homotopic (a.trans b) := by + rw [Path.trans_symm, Path.symm_symm] + have h₁ := Path.Homotopic.trans_assoc a l (l.symm.trans b) + have h₂ := (Path.Homotopic.trans_assoc l l.symm b).symm + have h₃ := ((Path.Homotopic.trans_symm l).hcomp (Path.Homotopic.refl b)).trans + (Path.Homotopic.refl_trans b) + exact h₁.trans ((Path.Homotopic.refl a).hcomp (h₂.trans h₃)) + +/-- The start of a path off a closed set lies in the closure of the region. -/ +theorem start_mem_closure {X : Type} [TopologicalSpace X] {u v : X} (g : Path u v) {r : Set X} + (hg : ∀ t : 𝕀, 0 < t → t < 1 → g t ∈ r) : u ∈ closure r := by + rw [_root_.mem_closure_iff] + intro O hO huO + obtain ⟨t, ht, hs⟩ := exists_time g.continuous hO (by simpa using huO) + have h₀ : (0 : ℝ) < min t.1 (1 / 2) := lt_min ht (by norm_num) + let s : 𝕀 := ⟨min t.1 (1 / 2), h₀.le, (min_le_right _ _).trans (by norm_num)⟩ + have hs₁ : s ≤ t := (show min t.1 (1 / 2) ≤ t.1 from min_le_left _ _) + have hs₂ : s < 1 := by + change min t.1 (1 / 2) < 1 + exact lt_of_le_of_lt (min_le_right _ _) (by norm_num) + exact ⟨g s, hs s hs₁, hg s h₀ hs₂⟩ + +theorem symm_mem {X : Type} [TopologicalSpace X] {u v : X} (g : Path u v) {r : Set X} + (hg : ∀ t : 𝕀, 0 < t → t < 1 → g t ∈ r) : ∀ t : 𝕀, 0 < t → t < 1 → g.symm t ∈ r := by + intro t h₀ h₁ + rw [Path.symm_apply] + refine hg _ ?_ ?_ + · rw [unitInterval.pos_iff_ne_zero, Ne, unitInterval.symm_eq_zero] + exact h₁.ne + · rw [unitInterval.lt_one_iff_ne_one, Ne, unitInterval.symm_eq_one] + exact h₀.ne' + +/-- The time `1/2`. -/ +noncomputable def half : 𝕀 := ⟨1 / 2, by norm_num, by norm_num⟩ + +theorem half_pos : 0 < half := by + change (0 : ℝ) < 1 / 2 + norm_num + +theorem half_lt : half < 1 := by + change (1 / 2 : ℝ) < 1 + norm_num + +section Walks + +variable (rad : RadialDrawing cap Γ) + +omit [T2Space S] in +/-- A point of a step with an end `c` in `R*`, other than the other end, lies in the region of `c`. +-/ +theorem step_mem' {a b : rad.G.V} (h : (rad.G.adj.induce rad.G.V).Adj a b) {x c : Shat} + (hc : c ∈ rad.Rstar) (hset : ({a.1, b.1} : Set Shat) = {x, c}) (t : 𝕀) + (ht : stepP (rad_loopFree rad) h t ≠ x) : stepP (rad_loopFree rad) h t ∈ rad.regionOf c := by + have hl := rad_loopFree rad + have hE := stepE_mem hl h + have hset' : closure (stepE hl h) ∩ rad.G.V = {x, c} := by + rw [← tilde_eq_inter_V rad.G hE, stepE_tilde, hset] + have hsub := rad.edge_subset_region hE hc hset' + have hy : stepP hl h t ∈ closure (stepE hl h) := by + rw [← stepP_range] + exact mem_range_self t + by_cases hyV : stepP hl h t ∈ rad.G.V + · have hy' : stepP hl h t ∈ closure (stepE hl h) ∩ rad.G.V := ⟨hy, hyV⟩ + rw [hset'] at hy' + rcases hy' with hy' | hy' + · exact absurd hy' ht + · rw [show stepP hl h t = c from hy'] + exact mem_connectedComponentIn (connectedComponentIn_subset _ _ (rad.regionOf_mem hc).2) + · exact hsub ((closure_edge_subset hE hy).resolve_right hyV) + +omit [T2Space S] in +/-- A step that ends at a vertex of `R*` lies in the region of that vertex, after its start. -/ +theorem step_mem {a b : rad.G.V} (h : (rad.G.adj.induce rad.G.V).Adj a b) (hb : b.1 ∈ rad.Rstar) : + ∀ t : 𝕀, 0 < t → stepP (rad_loopFree rad) h t ∈ rad.regionOf b.1 := fun t ht => + step_mem' rad h hb rfl t fun he => + ht.ne' (stepP_injective (rad_loopFree rad) h (he.trans (stepP (rad_loopFree rad) + h).source.symm)) + +omit [T2Space S] in +/-- A step that starts at a vertex of `R*`, run backwards, lies in the region of that vertex after +its +start. -/ +theorem step_symm_mem {a b : rad.G.V} (h : (rad.G.adj.induce rad.G.V).Adj a b) + (ha : a.1 ∈ rad.Rstar) : + ∀ t : 𝕀, 0 < t → (stepP (rad_loopFree rad) h).symm t ∈ rad.regionOf a.1 := fun t ht => by + change stepP (rad_loopFree rad) h (unitInterval.symm t) ∈ _ + refine step_mem' rad h ha (pair_comm _ _) _ fun he => ht.ne' ?_ + have := stepP_injective (rad_loopFree rad) h (he.trans (stepP (rad_loopFree rad) h).target.symm) + exact unitInterval.symm_eq_one.mp this + +omit [T2Space S] [T2Space Shat] in +/-- The vertex of `Γ*` in a region. -/ +theorem exists_hub {r : Set Shat} (hr : r ∈ Γ.hatRegions cap) : + ∃ c ∈ rad.Rstar, rad.regionOf c = r ∧ c ∈ r := by + obtain ⟨c, ⟨hcr, hcV⟩, -⟩ := rad.isPreRadial.2.2.1 r hr + obtain ⟨y, hy, rfl⟩ := hr + have hc : c ∉ Γ.hatV cap := fun h => (connectedComponentIn_subset _ _ hcr) + (image_mono Γ.V_subset h) + exact ⟨c, ⟨hcV, hc⟩, (connectedComponentIn_eq hcr).symm, hcr⟩ + +variable [ConnectedSpace Shat] (hS : IsSurface S) (hD : IsSkHat cap Γ D) + (h3 : Γ.IsInternallyThreeConnected) {γ : Set Shat → 𝕀 → Shat} (hγ : EdgePar D γ) + (hval : ∀ v ∈ D.V, 2 ≤ Nat.card (halfEdges D γ v)) + +include hS hD h3 hγ hval + +omit [ConnectedSpace Shat] in +/-- A path from a vertex to itself, otherwise in a region of `sk(Γ)`, is null-homotopic. -/ +theorem segment_loop {ρ : Set Shat} (hρ : ρ ∈ D.R) {u : Shat} (hu : u ∈ D.V) (g : Path u u) + (hg : ∀ t : 𝕀, 0 < t → t < 1 → g t ∈ ρ) : g.Homotopic (Path.refl u) := by + obtain ⟨g₁, g₂, hg₀, hg₁, hg₂⟩ := path_split g half + have h₁ : g₁.Homotopic g₂.symm := by + refine sector_homotopic cap.isClosedSurface D hγ hu (hval u hu) hρ (sk_region_disc hS hD h3 hρ) + (sk_pinch hS hD h3 hρ hu) g₁ g₂.symm (fun t ht => ?_) (fun t ht => ?_) + · obtain ⟨s, hs, he, hp⟩ := hg₁ t + rw [he] + exact hg s (hp ht half_pos) (lt_of_le_of_lt hs half_lt) + · obtain ⟨s, hs, he, hp⟩ := hg₂ (unitInterval.symm t) + change g₂ (unitInterval.symm t) ∈ ρ + rw [he] + refine hg s (lt_of_lt_of_le half_pos hs) (hp ?_ half_lt) + rw [unitInterval.lt_one_iff_ne_one, Ne, unitInterval.symm_eq_one] + exact ht.ne' + exact hg₀.trans ((h₁.hcomp (Path.Homotopic.refl g₂)).trans (Path.Homotopic.symm_trans g₂)) + +omit [ConnectedSpace Shat] in +/-- **A path across a region of `Γ`.** It is homotopic to a walk of length 2 through the vertex of +`Γ*` +in the region. -/ +theorem segment_hat {r : Set Shat} (hr : r ∈ Γ.hatRegions cap) {u v : Shat} (huV : u ∈ D.V) + (hvV : v ∈ D.V) (huG : u ∈ rad.G.V) (hvG : v ∈ rad.G.V) (g : Path u v) + (hg : ∀ t : 𝕀, 0 < t → t < 1 → g t ∈ r) : + ∃ w : (rad.G.adj.induce rad.G.V).Walk ⟨u, huG⟩ ⟨v, hvG⟩, w.length ≤ 2 ∧ + g.Homotopic (walkP (rad_loopFree rad) w) := by + have hl := rad_loopFree rad + have hrD := hD.hatRegion_mem_R hr + have hρd := sk_region_disc hS hD h3 hrD + have h2 := h3.hatRegions_isOpenDisc hS cap + obtain ⟨c, hcR, hcr, hc⟩ := exists_hub rad hr + have huc : ∀ {x : Shat}, x ∈ D.V → x ≠ c := fun hx he => + region_subset hrD hc (he ▸ D.V_subset_U hx) + have hspoke : ∀ {x : Shat} (hx : x ∈ D.V), x ∈ closure r → ∃ e ∈ rad.G.E, closure e ∩ rad.G.V + = {x, c} := by + intro x hx hxr + rw [hD.hV] at hx + obtain ⟨x₀, hx₀, rfl⟩ := hx + exact rad.exists_spoke hS h2 h3.1 hcR hx₀ (by rwa [hcr]) + have hadj : ∀ {x : Shat} (hx : x ∈ D.V) (hxG : x ∈ rad.G.V), x ∈ closure r → + (rad.G.adj.induce rad.G.V).Adj ⟨x, hxG⟩ ⟨c, hcR.1⟩ := by + intro x hx hxG hxr + obtain ⟨e, he, hset⟩ := hspoke hx hxr + have ht : tilde e = {x, c} := by rw [tilde_eq_inter_V rad.G he, hset] + exact ⟨huc hx, hxG, hcR.1, e, he, by rw [ht]; exact .inl rfl, by rw [ht]; exact .inr rfl⟩ + have h₁ := hadj huV huG (start_mem_closure g hg) + have h₂ := (hadj hvV hvG (start_mem_closure g.symm (symm_mem g hg))).symm + obtain ⟨g₁, g₂, hg₀, hg₁, hg₂⟩ := path_split g half + have hp : g half ∈ r := hg _ half_pos half_lt + have hJ : JoinedIn r c (g half) := hρd.isPathConnected.joinedIn _ hc _ hp + have hlam : ∀ t, hJ.somePath t ∈ r := hJ.somePath_mem + have hs₁ : ∀ t : 𝕀, 0 < t → stepP hl h₁ t ∈ r := by + rw [← hcr] + exact step_mem rad h₁ hcR + have hs₂ : ∀ t : 𝕀, 0 < t → (stepP hl h₂).symm t ∈ r := by + rw [← hcr] + exact step_symm_mem rad h₂ hcR + have hh₁ : g₁.Homotopic ((stepP hl h₁).trans hJ.somePath) := by + refine sector_homotopic cap.isClosedSurface D hγ huV (hval u huV) hrD hρd + (sk_pinch hS hD h3 hrD huV) g₁ _ (fun t ht => ?_) (trans_mem_of_pos hs₁ hlam) + obtain ⟨s, hs, he, hp⟩ := hg₁ t + rw [he] + exact hg s (hp ht half_pos) (lt_of_le_of_lt hs half_lt) + have hh₂ : g₂.symm.Homotopic ((stepP hl h₂).symm.trans hJ.somePath) := by + refine sector_homotopic cap.isClosedSurface D hγ hvV (hval v hvV) hrD hρd + (sk_pinch hS hD h3 hrD hvV) g₂.symm _ (fun t ht => ?_) (trans_mem_of_pos hs₂ hlam) + obtain ⟨s, hs, he, hp⟩ := hg₂ (unitInterval.symm t) + change g₂ (unitInterval.symm t) ∈ r + rw [he] + refine hg s (lt_of_lt_of_le half_pos hs) (hp ?_ half_lt) + rw [unitInterval.lt_one_iff_ne_one, Ne, unitInterval.symm_eq_one] + exact ht.ne' + refine ⟨.cons h₁ (.cons h₂ .nil), by simp, ?_⟩ + have hh₂' := hh₂.symm₂ + rw [Path.symm_symm] at hh₂' + simp only [walkP] + refine hg₀.trans (((hh₁.hcomp hh₂').trans (cancel_mid _ _ _)).trans ?_) + exact (Path.Homotopic.refl _).hcomp (Path.Homotopic.trans_refl _).symm + +omit [TopologicalSpace S] [T2Space S] [T2Space Shat] [ConnectedSpace Shat] hS hD h3 hγ hval in +private theorem homotopy_in_closed_cell + {X : Type} + {Y : Type} + [TopologicalSpace X] + [TopologicalSpace Y] + {cap : IsCappedSurface X Y} + {ρ : Set Y} + {c₀ : Set X} + (hrs : ρ ⊆ cap.emb '' closure c₀) + (hC : IsClosedDisc (cap.emb '' closure c₀)) + (u₀ : X) + (hu₁ : cap.emb u₀ ∈ cap.emb '' closure c₀) + (v₀ : X) + (hv₁ : cap.emb v₀ ∈ cap.emb '' closure c₀) + (g : Path (cap.emb u₀) (cap.emb v₀)) + (hg : ∀ (t : 𝕀), 0 < t → t < 1 → g t ∈ ρ) + (e : Set Y) + (hLC : closure e ⊆ cap.emb '' closure c₀) + (ε : Path (cap.emb u₀) (cap.emb v₀)) + (hεr : range ⇑ε ⊆ closure e) : + g.Homotopic ε := by + refine paths_homotopic_in_disc hC g ε ?_ (hεr.trans hLC) + rintro _ ⟨t, rfl⟩ + by_cases h0 : t = 0 + · rw [h0, g.source] + exact hu₁ + by_cases h1 : t = 1 + · rw [h1, g.target] + exact hv₁ + exact hrs (hg t (unitInterval.pos_iff_ne_zero.mpr h0) (unitInterval.lt_one_iff_ne_one.mpr h1)) + +omit hγ hval in +omit [ConnectedSpace Shat] h3 in +/-- **A path across the disc of an edge of size 3.** It is homotopic to a path across a region of +`Γ`, +beside an edge of `sk(Γ)` on the boundary of the disc. -/ +theorem segment_cell {ρ : Set Shat} (hρ : ρ ∈ D.R) {c₀ : Set S} (hc₀ : c₀ ∈ Γ.E) + (h3c : (tilde c₀).ncard = 3) (hrs : ρ ⊆ cap.emb '' closure c₀) {u v : Shat} (huV : u ∈ D.V) + (hvV : v ∈ D.V) (huv : u ≠ v) (g : Path u v) (hg : ∀ t : 𝕀, 0 < t → t < 1 → g t ∈ ρ) : + ∃ r ∈ Γ.hatRegions cap, ∃ g' : Path u v, g.Homotopic g' ∧ ∀ t : 𝕀, 0 < t → t < 1 → g' t ∈ r + := by + classical + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hinj := cap.isEmbedding.injective + obtain ⟨hΔ, hint, hU⟩ := cell_facts hD hρ hc₀ h3c rfl hrs + obtain ⟨hdisc, -, -⟩ := Γ.isDisc_of_three hc₀ h3c + obtain ⟨hC, hbd⟩ := isClosedDisc_image hdisc cap.isEmbedding + have hclρ : closure ρ ⊆ cap.emb '' closure c₀ := closure_minimal hrs hΔ.isClosed + have hu₁ := hclρ (start_mem_closure g hg) + have hv₁ := hclρ (start_mem_closure g.symm (symm_mem g hg)) + have htil : ∀ {x₀ : S}, x₀ ∈ closure c₀ → x₀ ∈ Γ.V → x₀ ∈ tilde c₀ := fun hx hxV => + ⟨hx, fun h => Γ.disjoint_V hc₀ h hxV⟩ + rw [hD.hV] at huV hvV + obtain ⟨u₀, hu₀, rfl⟩ := huV + obtain ⟨v₀, hv₀, rfl⟩ := hvV + have hu₂ : u₀ ∈ closure c₀ := by + obtain ⟨x, hx, he⟩ := hu₁ + exact hinj he ▸ hx + have hv₂ : v₀ ∈ closure c₀ := by + obtain ⟨x, hx, he⟩ := hv₁ + exact hinj he ▸ hx + have huv₀ : u₀ ≠ v₀ := fun h => huv (congrArg _ h) + have hut := htil hu₂ hu₀ + have hvt := htil hv₂ hv₀ + obtain ⟨f, hf, hfb, hfc, ht', x₀, hx₀f, hx₀c, hx₀V⟩ := + exists_sk_boundary_with_point Γ hc₀ h3c hut hvt huv₀ + have htV : tilde f ⊆ Γ.V := by + rw [ht'] + exact pair_subset hu₀ hv₀ + let e : Set Shat := cap.emb '' f + have he : e ∈ D.E := hD.edge_iff.mpr ⟨f, hf, rfl⟩ + have hcle : closure e = cap.emb '' closure f := (cap.isClosedEmbedding hS).closure_image_eq f + have hsetV : closure f ∩ Γ.V = {u₀, v₀} := by + rw [← ht'] + ext y + exact ⟨fun h => ⟨h.1, fun hc => (hf.2.1 hc).2 h.2⟩, fun h => ⟨h.1, htV h⟩⟩ + have hset : closure e ∩ D.V = {cap.emb u₀, cap.emb v₀} := by + rw [hcle, hD.hV, ← image_inter hinj, hsetV, image_pair] + have hL : IsLineWithEnds (closure e) (cap.emb u₀) (cap.emb v₀) := isLine_closure he huv hset + have hLC : closure e ⊆ cap.emb '' closure c₀ := + closure_minimal (image_mono (hfc.trans subset_closure)) hΔ.isClosed + have hLB : closure e ⊆ discBd (cap.emb '' closure c₀) := by + rw [hbd, hcle] + exact image_mono (closure_minimal hfb (isCompact_of_isOArc hdisc.isOArc_discBd).isClosed) + let Z : Set Shat := D.V ∪ ⋃ f' ∈ D.E \ {e}, closure f' + have hZ : IsClosed Z := D.finite_V.isClosed.union + ((D.finite_edges.subset sdiff_subset).isClosed_biUnion fun _ _ => isClosed_closure) + have hLZ : closure e ∩ Z ⊆ {cap.emb u₀, cap.emb v₀} := by + rintro y ⟨hye, hyV | hyf⟩ + · rw [← hset] + exact ⟨hye, hyV⟩ + · obtain ⟨f', hf', hyf'⟩ := mem_iUnion₂.mp hyf + by_cases hyV : y ∈ D.V + · rw [← hset] + exact ⟨hye, hyV⟩ + · exact absurd (edge_eq_of_mem D hf'.1 he hyf' hye hyV) hf'.2 + have hUZ : D.U ⊆ closure e ∪ Z := fun y hy => by + by_cases hyV : y ∈ D.V + · exact .inr (.inl hyV) + obtain ⟨f', hf', hyf'⟩ := exists_edge_of_mem D hy hyV + by_cases hfe : f' = e + · exact .inl (subset_closure (hfe ▸ hyf')) + · exact .inr (.inr (mem_biUnion (x := f') ⟨hf', hfe⟩ (subset_closure hyf'))) + obtain ⟨D₀, A, B, hD₀, hLD, hDZ, -, -, hbL, hDe, hAc, hBc, hAn, hBn, hAL, hBL, hLA, hLB', hpA, + hpB⟩ := + exists_edge_lens hT hL huv hZ hLZ + have hside : ∀ Y : Set Shat, IsPreconnected Y → Y.Nonempty → Y ⊆ D₀ → Disjoint Y (closure e) → + closure e ⊆ closure Y → (∃ r ∈ Γ.hatRegions cap, Y ⊆ r) ∨ Y ⊆ cap.emb '' closure c₀ := by + intro Y hYc ⟨y₀, hy₀⟩ hYD hYL hLY + have hYU : Disjoint Y D.U := disjoint_left.mpr fun y hy hyU => by + rcases hUZ hyU with h | h + · exact disjoint_left.mp hYL hy h + · refine disjoint_left.mp hYL hy ?_ + rcases hDZ ⟨hYD hy, h⟩ with hm | hm + · exact hm ▸ hL.left_mem + · exact hm ▸ hL.right_mem + obtain ⟨a, ha, hy₀a⟩ := exists_region_of_notMem (disjoint_left.mp hYU hy₀) + have hYa := subset_region ha hYc hYU hy₀ hy₀a + rcases hD.region_cases ha with hh | ⟨c', hc', h3', hac⟩ + · exact .inl ⟨a, hh, hYa⟩ + · refine .inr ?_ + obtain ⟨hΔ', -, -⟩ := cell_facts hD ha hc' h3' rfl hac + have hm : cap.emb x₀ ∈ cap.emb '' closure c' := + closure_minimal (hYa.trans hac) hΔ'.isClosed (hLY (subset_closure + (mem_image_of_mem _ hx₀f))) + obtain ⟨z, hz, hze⟩ := hm + obtain rfl := hinj hze + have hzV : z ∉ Γ.V := hx₀V + have hzc' : z ∈ c' := by_contra fun h => hzV (Γ.tilde_subset_V hc' ⟨hz, h⟩) + obtain rfl := arcComp_eq_of_mem hc' hc₀ hzc' hx₀c + exact hYa.trans hac + have hAD : A ⊆ D₀ := by + rw [hDe] + exact subset_union_left.trans subset_union_left + have hBD : B ⊆ D₀ := by + rw [hDe] + exact subset_union_right.trans subset_union_left + have hboth : ¬ (A ⊆ cap.emb '' closure c₀ ∧ B ⊆ cap.emb '' closure c₀) := by + rintro ⟨h₁, h₂⟩ + have hxe : cap.emb x₀ ∈ closure e := subset_closure (mem_image_of_mem _ hx₀f) + have hxV : cap.emb x₀ ∉ D.V := by + rw [hD.hV] + rintro ⟨z, hz, hze⟩ + exact hx₀V (hinj hze ▸ hz) + have hxb : cap.emb x₀ ∈ discInt D₀ := ⟨hLD hxe, fun hb => by + have := hbL ⟨hb, hxe⟩ + rw [← hset] at this + exact hxV this.2⟩ + have hsub : discInt D₀ ⊆ cap.emb '' closure c₀ := fun y hy => by + have hy₁ := hy.1 + rw [hDe] at hy₁ + rcases hy₁ with (hy₁ | hy₁) | hy₁ + · exact h₁ hy₁ + · exact h₂ hy₁ + · exact hLC hy₁ + have hin : cap.emb x₀ ∈ interior (cap.emb '' closure c₀) := + mem_interior.mpr ⟨_, hsub, hD₀.isOpen_discInt hman, hxb⟩ + have hfr := hLB hxe + rw [← GM11.IsClosedDisc.frontier_eq_discBd hT hC] at hfr + exact hfr.2 hin + obtain ⟨f₂, f₀, f₁⟩ := id hL + let ε : Path (cap.emb u₀) (cap.emb v₀) := ⟨⟨fun t => (f₂ t).1, by fun_prop⟩, f₀, f₁⟩ + have hεr : range ε ⊆ closure e := by + rintro _ ⟨t, rfl⟩ + exact (f₂ t).2 + have hgC : g.Homotopic ε := by + exact homotopy_in_closed_cell (cap := cap) (ρ := ρ) (c₀ := c₀) hrs hC + u₀ hu₁ v₀ hv₁ g hg e hLC ε hεr + have hfin : ∀ {Y : Set Shat}, (∃ r ∈ Γ.hatRegions cap, Y ⊆ r) → + (∃ p : Path (cap.emb u₀) (cap.emb v₀), range p ⊆ D₀ ∧ ∀ t : 𝕀, 0 < t → t < 1 → p t ∈ Y) → + ∃ r ∈ Γ.hatRegions cap, ∃ g' : Path (cap.emb u₀) (cap.emb v₀), g.Homotopic g' ∧ + ∀ t : 𝕀, 0 < t → t < 1 → g' t ∈ r := by + rintro Y ⟨r, hr, hYr⟩ ⟨p, hpD, hpY⟩ + exact ⟨r, hr, p, hgC.trans (paths_homotopic_in_disc hD₀ ε p (hεr.trans hLD) hpD), + fun t h0 h1 => hYr (hpY t h0 h1)⟩ + by_cases hAh : A ⊆ cap.emb '' closure c₀ + · have hBh : ¬ B ⊆ cap.emb '' closure c₀ := fun h => hboth ⟨hAh, h⟩ + exact hfin ((hside B hBc hBn hBD hBL hLB').resolve_right hBh) hpB + · exact hfin ((hside A hAc hAn hAD hAL hLA).resolve_right hAh) hpA + +omit [ConnectedSpace Shat] in +/-- **A path across a region of `sk(Γ)`**, between two vertices, is homotopic to a walk of `Γ*` of +length at most 2. -/ +theorem segment_walk {u v : Shat} (huV : u ∈ D.V) (hvV : v ∈ D.V) (huG : u ∈ rad.G.V) + (hvG : v ∈ rad.G.V) (g : Path u v) (hg : ∀ t : 𝕀, 0 < t → t < 1 → g t ∉ D.U) : + ∃ w : (rad.G.adj.induce rad.G.V).Walk ⟨u, huG⟩ ⟨v, hvG⟩, w.length ≤ 2 ∧ + g.Homotopic (walkP (rad_loopFree rad) w) := by + have hlc : LocallyConnectedSpace Shat := + IsClosedSurface.locallyConnectedSpace cap.isClosedSurface + let I : Set Shat := g '' Ioo 0 1 + have hIc : IsPreconnected I := by + have : IsPreconnected (Ioo (0 : 𝕀) 1) := ordConnected_Ioo.isPreconnected + exact this.image _ g.continuous.continuousOn + have hIU : Disjoint I D.U := disjoint_left.mpr fun _ ⟨t, ht, he⟩ => he ▸ hg t ht.1 ht.2 + obtain ⟨ρ, hρ, hhalf⟩ := exists_region_of_notMem (hg half half_pos half_lt) + have hIρ := subset_region hρ hIc hIU (mem_image_of_mem _ ⟨half_pos, half_lt⟩) hhalf + have hgρ : ∀ t : 𝕀, 0 < t → t < 1 → g t ∈ ρ := fun t h0 h1 => + hIρ (mem_image_of_mem _ ⟨h0, h1⟩) + by_cases huv : u = v + · subst huv + exact ⟨.nil, by simp, segment_loop hS hD h3 hγ hval hρ huV g hgρ⟩ + rcases hD.region_cases hρ with hh | ⟨c₀, hc₀, h3c, hrs⟩ + · exact segment_hat rad hS hD h3 hγ hval hh huV hvV huG hvG g hgρ + · obtain ⟨r, hr, g', hh', hg'⟩ := segment_cell hS hD hρ hc₀ h3c hrs huV hvV huv g hgρ + obtain ⟨w, hw, hhw⟩ := segment_hat rad hS hD h3 hγ hval hr huV hvV huG hvG g' hg' + exact ⟨w, hw, hh'.trans hhw⟩ + +omit hS hD h3 hγ hval in +theorem circuit_of_closed {G : Drawing Shat} (hl : LoopFree G) {n : ℕ} {a b : G.V} (h : a = b) + (w : (G.adj.induce G.V).Walk a b) (hlen : w.length ≤ n) (q : Path a.1 b.1) + (hq : q.Homotopic (walkP hl w)) + (hnn : ¬ (q.cast rfl (congrArg Subtype.val h)).Homotopic (Path.refl _)) : + ∃ C : Drawing Shat, C.IsCircuitOf G ∧ ¬ IsNullHomotopicOArc C.U ∧ C.E.ncard ≤ n := by + subst h + have e : q.cast rfl rfl = q := by + ext + rfl + rw [e] at hnn + exact exists_circuit_of_walk hl w hlen fun hc => hnn (hq.trans hc) + +omit hS hD h3 hγ hval [T2Space S] [T2Space Shat] [ConnectedSpace Shat] in +theorem subP_self (f : C(𝕀, Shat)) (s : 𝕀) : subP f s s = Path.refl (f s) := by + ext x + change f (seg s s x) = f s + congr 1 + ext + simp only [seg] + change (1 - x.1) * s.1 + x.1 * s.1 = s.1 + ring + +/-- **A curve gives a circuit of `Γ*`.** An `O`-arc that is not null-homotopic and meets `sk(Γ)` +only in +`m` vertices gives a circuit of `Γ*` with at most `2m` edges that is not null-homotopic. -/ +theorem exists_circuit_of_curve {F : Set Shat} (hF : IsOArc F) (hn : D.IsNormal F) + (hnn : ¬ IsNullHomotopicOArc F) : + ∃ C : Drawing Shat, C.IsCircuitOf rad.G ∧ ¬ IsNullHomotopicOArc C.U ∧ + C.E.ncard ≤ 2 * (F ∩ D.V).ncard := by + classical + have hT := cap.isClosedSurface + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + have hl := rad_loopFree rad + have hDG : ∀ x ∈ D.V, x ∈ rad.G.V := fun x hx => rad.isPreRadial.2.1 (by + rw [hD.hV] at hx + exact hx) + by_cases hne : (F ∩ D.V).Nonempty + swap + · exfalso + obtain ⟨φ⟩ := id hF + have hFU : Disjoint F D.U := disjoint_left.mpr fun x hx hxU => hne ⟨x, hx, hn ⟨hx, hxU⟩⟩ + have hFr : F = range fun z : Circle => (φ z).1 := by + ext x + constructor + · intro hx + exact ⟨φ.symm ⟨x, hx⟩, by simp⟩ + · rintro ⟨z, rfl⟩ + exact (φ z).2 + have hFc : IsPreconnected F := by + rw [hFr] + exact (isPreconnected_range (by fun_prop)) + have hy := (φ 1).2 + obtain ⟨ρ, hρ, hyρ⟩ := exists_region_of_notMem (disjoint_left.mp hFU hy) + have hsub := subset_region hρ hFc hFU hy hyρ + obtain ⟨x, hx, H, -, h0, h1⟩ := (sk_region_disc hS hD h3 hρ).isSimplyConnectedSet.2 + ⟨fun z => (φ z).1, by fun_prop⟩ (by + rintro _ ⟨z, rfl⟩ + exact hsub (φ z).2) + exact hnn ⟨φ, x, mem_univ _, H, fun _ => mem_univ _, h0, h1⟩ + obtain ⟨a, ha, haV⟩ := hne + obtain ⟨φ₀⟩ := id hF + obtain ⟨z₀, hz₀⟩ := φ₀.surjective ⟨a, ha⟩ + let φ : Circle ≃ₜ F := (Homeomorph.mulLeft z₀).trans φ₀ + have hφ1 : (φ 1).1 = a := by + change (φ₀ (z₀ * 1)).1 = a + rw [mul_one, hz₀] + let γ : C(Circle, Shat) := ⟨fun z => (φ z).1, by fun_prop⟩ + let f : C(𝕀, Shat) := γ.comp (arcParam 1) + have hf0 : f 0 = a := by + change γ (arcParam 1 0) = a + rw [arcParam_zero] + exact hφ1 + have hf1 : f 1 = a := by + change γ (arcParam 1 1) = a + rw [arcParam_one] + exact hφ1 + have hfF : ∀ t, f t ∈ F := fun t => (φ _).2 + have hfeq : ∀ {s t : 𝕀}, f s = f t → s = t ∨ (s = 0 ∧ t = 1) ∨ (s = 1 ∧ t = 0) := fun {s t} h => + arcParam_eq_iff 1 (φ.injective (Subtype.ext h)) + let T₀ : Set 𝕀 := {t | 0 < t ∧ f t ∈ D.V} + have hinj : InjOn f T₀ := by + intro s hs t ht he + rcases hfeq he with h | ⟨h, -⟩ | ⟨-, h⟩ + · exact h + · exact absurd h hs.1.ne' + · exact absurd h ht.1.ne' + have himg : f '' T₀ ⊆ F ∩ D.V := by + rintro _ ⟨t, ht, rfl⟩ + exact ⟨hfF t, ht.2⟩ + have hVfin : (F ∩ D.V).Finite := D.finite_V.subset inter_subset_right + have hT₀ : T₀.Finite := Set.Finite.of_finite_image (hVfin.subset himg) hinj + have hcard : T₀.ncard ≤ (F ∩ D.V).ncard := by + rw [← hinj.ncard_image] + exact ncard_le_ncard himg hVfin + have h0V : f 0 ∈ D.V := hf0 ▸ haV + let a₀ : rad.G.V := ⟨f 0, hDG _ h0V⟩ + have key : ∀ (n : ℕ) (t : 𝕀) (ht : t ∈ T₀), {s ∈ T₀ | s ≤ t}.ncard ≤ n → + ∃ w : (rad.G.adj.induce rad.G.V).Walk a₀ ⟨f t, hDG _ ht.2⟩, w.length ≤ 2 * n ∧ + (subP f 0 t).Homotopic (walkP hl w) := by + intro n + induction n with + | zero => + intro t ht hc + have hsub : {s ∈ T₀ | s ≤ t}.Finite := hT₀.subset fun _ h => h.1 + have := (ncard_eq_zero hsub).mp (Nat.le_zero.mp hc) + exact absurd (show t ∈ {s ∈ T₀ | s ≤ t} from ⟨ht, le_rfl⟩) (this ▸ notMem_empty t) + | succ n ih => + intro t ht hc + have hprev : ∃ s₀ : 𝕀, s₀ < t ∧ (∃ hs₀ : f s₀ ∈ D.V, ∃ w₀ : + (rad.G.adj.induce rad.G.V).Walk a₀ ⟨f s₀, hDG _ hs₀⟩, w₀.length ≤ 2 * n ∧ + (subP f 0 s₀).Homotopic (walkP hl w₀)) ∧ ∀ s, s₀ < s → s < t → f s ∉ D.V := by + by_cases hS₀ : {s ∈ T₀ | s < t}.Nonempty + · have hfin_lt : {s ∈ T₀ | s < t}.Finite := hT₀.subset fun _ hs => hs.1 + obtain ⟨s₀, hs₀, hmax⟩ := Set.exists_max_image _ id hfin_lt hS₀ + have hlt : {s ∈ T₀ | s ≤ s₀}.ncard < {s ∈ T₀ | s ≤ t}.ncard := by + refine ncard_lt_ncard ⟨fun x hx => ⟨hx.1, hx.2.trans hs₀.2.le⟩, fun hsub => ?_⟩ + (hT₀.subset fun _ h => h.1) + exact absurd (hsub ⟨ht, le_rfl⟩).2 (not_le.mpr hs₀.2) + obtain ⟨w₀, hw₀, hh₀⟩ := ih s₀ hs₀.1 (by omega) + exact ⟨s₀, hs₀.2, ⟨hs₀.1.2, w₀, hw₀, hh₀⟩, fun s h₁ h₂ hV => + absurd (hmax s ⟨⟨lt_of_le_of_lt (unitInterval.nonneg s₀) h₁ |>.trans_le le_rfl, hV⟩, + h₂⟩) + (not_le.mpr h₁)⟩ + · refine ⟨0, ht.1, ⟨h0V, .nil, by simp, ?_⟩, fun s h₁ h₂ hV => hS₀ ⟨s, ⟨h₁, hV⟩, h₂⟩⟩ + rw [subP_self] + exact Path.Homotopic.refl _ + obtain ⟨s₀, hst, ⟨hs₀, w₀, hw₀, hh₀⟩, hnone⟩ := hprev + have hseg : ∀ x : 𝕀, 0 < x → x < 1 → subP f s₀ t x ∉ D.U := by + intro x h0 h1 hU + have hx0 : 0 < x.1 := h0 + have hx1 : x.1 < 1 := h1 + have hst' : s₀.1 < t.1 := hst + have hlo : s₀ < seg s₀ t x := by + change s₀.1 < (1 - x.1) * s₀.1 + x.1 * t.1 + nlinarith + have hhi : seg s₀ t x < t := by + change (1 - x.1) * s₀.1 + x.1 * t.1 < t.1 + nlinarith + exact hnone _ hlo hhi (hn ⟨hfF _, hU⟩) + obtain ⟨w₂, hw₂, hh₂⟩ := segment_walk rad hS hD h3 hγ hval hs₀ ht.2 (hDG _ hs₀) (hDG _ ht.2) + (subP f s₀ t) hseg + refine ⟨w₀.append w₂, ?_, ?_⟩ + · rw [SimpleGraph.Walk.length_append] + omega + · exact (subP_trans f 0 s₀ t).trans ((hh₀.hcomp hh₂).trans (walkP_append hl w₀ w₂).symm) + have h1T : (1 : 𝕀) ∈ T₀ := ⟨unitInterval.pos_iff_ne_zero.mpr one_ne_zero, hf1 ▸ haV⟩ + obtain ⟨w, hw, hhw⟩ := key _ 1 h1T le_rfl + have hsub : {s ∈ T₀ | s ≤ (1 : 𝕀)} ⊆ T₀ := fun _ h => h.1 + have hle : {s ∈ T₀ | s ≤ (1 : 𝕀)}.ncard ≤ (F ∩ D.V).ncard := + (ncard_le_ncard hsub hT₀).trans hcard + have hclosed : a₀ = (⟨f 1, hDG _ h1T.2⟩ : rad.G.V) := Subtype.ext (hf0.trans hf1.symm) + refine circuit_of_closed hl hclosed w (hw.trans (Nat.mul_le_mul_left 2 hle)) _ hhw fun hc + => hnn ?_ + have hv01 : f 0 = f 1 := hf0.trans hf1.symm + have hγP : ∀ t, γ (arcParam 1 t) = ((subP f 0 1).cast rfl hv01) t := by + intro t + change f t = f (seg 0 1 t) + congr 1 + ext + change t.1 = (1 - t.1) * (0 : ℝ) + t.1 * 1 + ring + exact ⟨φ, null_of_path_refl _ hγP hc⟩ + +/-- `rep(Γ) ≤ rep(sk(Γ))`, the inequality of (6.7) that the proof of (6.2) uses. -/ +theorem rep_le_sk : Painting.rep rad ≤ D.rep := by + refine le_sInf ?_ + rintro _ ⟨F, hF, hN, hnn, rfl⟩ + obtain ⟨C, hC, hCn, hle⟩ := exists_circuit_of_curve rad hS hD h3 hγ hval hF hN hnn + have h₁ : Painting.rep rad ≤ ((C.E.ncard / 2 : ℕ) : ℕ∞) := sInf_le ⟨C, hC, hCn, rfl⟩ + refine h₁.trans ?_ + exact_mod_cast Nat.div_le_of_le_mul hle + +end Walks + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Reroute.lean b/LeanPool/GraphMinor/GM19/Section6Reroute.lean new file mode 100644 index 0000000000..ce413d1ab0 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Reroute.lean @@ -0,0 +1,458 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Null +public import LeanPool.GraphMinor.Surface.Collar +public import LeanPool.GraphMinor.Surface.CutLift +public import Mathlib.AlgebraicTopology.FundamentalGroupoid.SimplyConnected +public import Mathlib.Analysis.Convex.Contractible + +/-! +# Rerouting a curve through a disc + +Let `F` be an `O`-arc of a surface that is not null-homotopic and meets a closed disc `D`. Choose a +line `P(a, b)` in `D` for any two points `a, b` of `bd(D)`. Then some component of `F \ D`, with +ends `a, b`, gives a non-null-homotopic `O`-arc when it is closed up by `P(a, b)` +(`exists_reroute`). + +The proof is this. Finitely many components of `F \ D` leave a larger disc, so `F` is a product of +these components and paths in the larger disc (`homotopic_of_intervals`). If each closed-up +component were null-homotopic, then `F` would be homotopic to a loop in the larger disc. + +Graph Minors XIX, Section 6, uses this fact twice without comment: in `rep(G \ v) ≥ rep(G) - 1` +(page 341) and for the "non-null-homotopic $O$-arc disjoint from $\Delta$" of (6.6), claim (2) (page +342). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM12 + +local notation "𝕀" => unitInterval + +variable {T : Type} [TopologicalSpace T] + +instance : ContractibleSpace 𝕀 := (convex_Icc (0 : ℝ) 1).contractibleSpace ⟨0, by simp⟩ + +/-- The straight path from `s` to `t` in the unit interval. -/ +noncomputable def seg (s t : 𝕀) : Path s t where + toFun x := ⟨(1 - x.1) * s.1 + x.1 * t.1, by + have h1 := x.2.1 + have h2 := x.2.2 + have h3 := s.2.1 + have h4 := s.2.2 + have h5 := t.2.1 + have h6 := t.2.2 + constructor <;> nlinarith [mul_nonneg h1 h5, mul_nonneg (sub_nonneg.mpr h2) h3, mul_nonneg h1 + (sub_nonneg.mpr h6), mul_nonneg (sub_nonneg.mpr h2) (sub_nonneg.mpr h4)]⟩ + continuous_toFun := by fun_prop + source' := by simp + target' := by simp + +theorem seg_mem {s t : 𝕀} (hst : s ≤ t) (x : 𝕀) : seg s t x ∈ Icc s t := by + have h1 := x.2.1 + have h2 := x.2.2 + have hst' : s.1 ≤ t.1 := hst + constructor + · change s.1 ≤ (1 - x.1) * s.1 + x.1 * t.1 + nlinarith [mul_nonneg h1 (sub_nonneg.mpr hst')] + · change (1 - x.1) * s.1 + x.1 * t.1 ≤ t.1 + nlinarith [mul_nonneg (sub_nonneg.mpr h2) (sub_nonneg.mpr hst')] + +/-- The part of a map of the interval from `s` to `t`. -/ +noncomputable def subP (f : C(𝕀, T)) (s t : 𝕀) : Path (f s) (f t) := (seg s t).map f.continuous + +theorem subP_trans (f : C(𝕀, T)) (s t u : 𝕀) : (subP f s u).Homotopic ((subP f s t).trans + (subP f t u)) := by + have h : (seg s u).Homotopic ((seg s t).trans (seg t u)) := SimplyConnectedSpace.paths_homotopic + _ _ + have h2 := h.map f + rw [Path.map_trans] at h2 + exact h2 + +theorem subP_mem (f : C(𝕀, T)) {s t : 𝕀} (hst : s ≤ t) (x : 𝕀) : ∃ y ∈ Icc s t, subP f s t x = f y + := + ⟨_, seg_mem hst x, rfl⟩ + +/-- A path with the middle parts in `W`, and with each of finitely many other parts homotopic to a +path in `W`, is homotopic to a path in `W`. -/ +theorem homotopic_of_intervals (f : C(𝕀, T)) (W : Set T) : ∀ (n : ℕ) (G : Finset (𝕀 × 𝕀)), G.card + ≤ n → ∀ s t : 𝕀, s ≤ t → f s ∈ W → f t ∈ W → + (∀ g ∈ G, s ≤ g.1 ∧ g.1 < g.2 ∧ g.2 ≤ t ∧ f g.1 ∈ W ∧ f g.2 ∈ W ∧ ∃ q : Path (f g.1) + (f g.2), range q ⊆ W ∧ (subP f g.1 g.2).Homotopic q) → + (∀ g ∈ G, ∀ g' ∈ G, g ≠ g' → g.2 ≤ g'.1 ∨ g'.2 ≤ g.1) → + (∀ x ∈ Icc s t, (∀ g ∈ G, x ∉ Ioo g.1 g.2) → f x ∈ W) → + ∃ q : Path (f s) (f t), range q ⊆ W ∧ (subP f s t).Homotopic q := by + classical + have hbase : ∀ s t : 𝕀, s ≤ t → (∀ x ∈ Icc s t, f x ∈ W) → ∃ q : Path (f s) (f t), range q ⊆ W ∧ + (subP f s t).Homotopic q := fun s t hst h => + ⟨subP f s t, by + rintro _ ⟨x, rfl⟩ + obtain ⟨y, hy, he⟩ := subP_mem f hst x + rw [he] + exact h y hy, Path.Homotopic.refl _⟩ + intro n + induction n with + | zero => + intro G hG s t hst _ _ _ _ hmid + have hG' : G = ∅ := Finset.card_eq_zero.mp (Nat.le_zero.mp hG) + exact hbase s t hst fun x hx => hmid x hx (by simp [hG']) + | succ n ih => + intro G hG s t hst hs ht hg hdis hmid + by_cases hne : G.Nonempty + swap + · exact hbase s t hst fun x hx => hmid x hx fun g hgG => absurd ⟨g, hgG⟩ hne + obtain ⟨g, hgG⟩ := hne + obtain ⟨h1, h2, h3, h4, h5, q, hq, hhq⟩ := hg g hgG + have hsub₁ : (G.filter fun g' => g'.2 ≤ g.1) ⊂ G := by + refine Finset.filter_ssubset.mpr ⟨g, hgG, not_le.mpr h2⟩ + have hsub₂ : (G.filter fun g' => g.2 ≤ g'.1) ⊂ G := by + refine Finset.filter_ssubset.mpr ⟨g, hgG, not_le.mpr h2⟩ + have hc₁ := Finset.card_lt_card hsub₁ + have hc₂ := Finset.card_lt_card hsub₂ + obtain ⟨q₁, hq₁, hh₁⟩ := ih (G.filter fun g' => g'.2 ≤ g.1) (by omega) s g.1 h1 hs h4 + (fun g' hg' => by + obtain ⟨a1, a2, a3, a4⟩ := hg g' (Finset.mem_of_mem_filter _ hg') + exact ⟨a1, a2, (Finset.mem_filter.mp hg').2, a4⟩) (fun a ha b hb => hdis a + (Finset.mem_of_mem_filter _ ha) b (Finset.mem_of_mem_filter _ hb)) + (fun x hx hno => hmid x ⟨hx.1, hx.2.trans (h2.le.trans h3)⟩ fun g' hg' hin => by + by_cases he : g' = g + · subst he + exact not_lt.mpr hx.2 hin.1 + · rcases hdis g' hg' g hgG he with h6 | h6 + · exact hno g' (Finset.mem_filter.mpr ⟨hg', h6⟩) hin + · exact not_lt.mpr (hx.2.trans (h2.le.trans h6)) hin.1) + obtain ⟨q₂, hq₂, hh₂⟩ := ih (G.filter fun g' => g.2 ≤ g'.1) (by omega) g.2 t h3 h5 ht + (fun g' hg' => by + obtain ⟨a1, a2, a3, a4⟩ := hg g' (Finset.mem_of_mem_filter _ hg') + exact ⟨(Finset.mem_filter.mp hg').2, a2, a3, a4⟩) (fun a ha b hb => hdis a + (Finset.mem_of_mem_filter _ ha) b (Finset.mem_of_mem_filter _ hb)) + (fun x hx hno => hmid x ⟨h1.trans (h2.le.trans hx.1), hx.2⟩ fun g' hg' hin => by + by_cases he : g' = g + · subst he + exact not_lt.mpr hx.1 hin.2 + · rcases hdis g' hg' g hgG he with h6 | h6 + · exact not_lt.mpr (h6.trans (h2.le.trans hx.1)) hin.2 + · exact hno g' (Finset.mem_filter.mpr ⟨hg', h6⟩) hin) + refine ⟨q₁.trans (q.trans q₂), ?_, ?_⟩ + · rw [Path.trans_range, Path.trans_range] + exact union_subset hq₁ (union_subset hq hq₂) + · exact (subP_trans f s g.1 t).trans ((hh₁.hcomp ((subP_trans f g.1 g.2 t).trans + (hhq.hcomp hh₂)))) + +/-- The intervals of the complement of a closed set of the interval. -/ +theorem exists_intervals {U K : Set 𝕀} (hU : IsOpen U) (hKc : IsClosed K) (hKU : K ⊆ U) (h0 : + (0 : 𝕀) ∉ U) (h1 : (1 : 𝕀) ∉ U) : + ∃ G : Finset (𝕀 × 𝕀), (∀ g ∈ G, g.1 < g.2 ∧ g.1 ∉ U ∧ g.2 ∉ U ∧ Ioo g.1 g.2 ⊆ U) ∧ + (∀ g ∈ G, ∀ g' ∈ G, g ≠ g' → g.2 ≤ g'.1 ∨ g'.2 ≤ g.1) ∧ + ∀ x ∈ K, ∃ g ∈ G, x ∈ Ioo g.1 g.2 := by + classical + have hint : ∀ t ∈ U, ∃ a b : 𝕀, a < t ∧ t < b ∧ a ∉ U ∧ b ∉ U ∧ Ioo a b ⊆ U := fun t ht => by + have hC : IsClosed (Uᶜ) := hU.isClosed_compl + have hL : IsClosed (Uᶜ ∩ Iic t) := hC.inter isClosed_Iic + have hR : IsClosed (Uᶜ ∩ Ici t) := hC.inter isClosed_Ici + have ha := hL.csSup_mem ⟨0, h0, unitInterval.nonneg'⟩ (OrderTop.bddAbove _) + have hb := hR.csInf_mem ⟨1, h1, unitInterval.le_one'⟩ (OrderBot.bddBelow _) + refine ⟨sSup (Uᶜ ∩ Iic t), sInf (Uᶜ ∩ Ici t), lt_of_le_of_ne ha.2 fun h' => ha.1 + (by rw [h']; exact ht), lt_of_le_of_ne hb.2 (fun h' => hb.1 (by rw [← h']; exact ht)), ha.1, + hb.1, ?_⟩ + rintro x ⟨hx1, hx2⟩ + by_contra hxU + rcases le_total x t with hxt | hxt + · exact not_le.mpr hx1 (le_csSup (OrderTop.bddAbove _) ⟨hxU, hxt⟩) + · exact not_le.mpr hx2 (csInf_le (OrderBot.bddBelow _) ⟨hxU, hxt⟩) + choose! a b ha hb haU hbU hab using hint + obtain ⟨S, hS, hf, hcov⟩ := hKc.isCompact.elim_finite_subcover_image (b := K) (c := fun t => Ioo + (a t) (b t)) (fun t _ => isOpen_Ioo) + fun t ht => mem_biUnion ht ⟨ha t (hKU ht), hb t (hKU ht)⟩ + have hmem : ∀ g ∈ hf.toFinset.image (fun t => (a t, b t)), g.1 < g.2 ∧ g.1 ∉ U ∧ g.2 ∉ U + ∧ Ioo g.1 g.2 ⊆ U := fun g hg => by + obtain ⟨t, ht, rfl⟩ := Finset.mem_image.mp hg + have htU : t ∈ U := hKU (hS (hf.mem_toFinset.mp ht)) + exact ⟨(ha t htU).trans (hb t htU), haU t htU, hbU t htU, hab t htU⟩ + refine ⟨hf.toFinset.image (fun t => (a t, b t)), hmem, fun g hg g' hg' hne => ?_, fun x hx => ?_⟩ + · obtain ⟨g1, g2, g3, g4⟩ := hmem g hg + obtain ⟨k1, k2, k3, k4⟩ := hmem g' hg' + rcases lt_trichotomy g.1 g'.1 with h | h | h + · left + by_contra hc + exact k2 (g4 ⟨h, not_le.mp hc⟩) + · have h2 : g.2 = g'.2 := by + rcases lt_trichotomy g.2 g'.2 with h3 | h3 | h3 + · exact absurd (k4 ⟨h ▸ g1, h3⟩) g3 + · exact h3 + · exact absurd (g4 ⟨h.symm ▸ k1, h3⟩) k3 + exact absurd (Prod.ext h h2) hne + · right + by_contra hc + exact g2 (k4 ⟨h, not_le.mp hc⟩) + · obtain ⟨t, ht, hxt⟩ := mem_iUnion₂.mp (hcov hx) + exact ⟨_, Finset.mem_image.mpr ⟨t, hf.mem_toFinset.mpr ht, rfl⟩, hxt⟩ + +/-- A loop homotopic to the constant path is a null-homotopic closed curve. -/ +theorem null_of_path_refl {w : T} (P : Path w w) {γ : C(Circle, T)} (hγ : ∀ t, γ + (arcParam 1 t) = P t) (h : P.Homotopic (Path.refl w)) : + ClosedCurveIsNullHomotopicIn univ γ := by + obtain ⟨H⟩ := h + let F : C(𝕀 × 𝕀, T) := ⟨fun z => H (z.2, z.1), by fun_prop⟩ + have hends : ∀ t, F (0, t) = F (1, t) := by intro t; simp [F] + refine ⟨w, mem_univ _, cylinderLift 1 F hends, fun _ => mem_univ _, ?_, ?_⟩ + · intro z + obtain ⟨s, rfl⟩ := arcParam_surjective 1 z + rw [cylinderLift_apply] + change H (0, s) = γ (arcParam 1 s) + rw [H.apply_zero, hγ] + rfl + · intro z + obtain ⟨s, rfl⟩ := arcParam_surjective 1 z + rw [cylinderLift_apply] + change H (1, s) = w + simp + +/-- Two paths in a closed disc with the same ends are homotopic. -/ +theorem paths_homotopic_in_disc {Δ : Set T} (hΔ : IsClosedDisc Δ) {a b : T} (p q : Path a b) + (hp : range p ⊆ Δ) (hq : range q ⊆ Δ) : p.Homotopic q := by + obtain ⟨e⟩ := id hΔ + have hc : ContractibleSpace ClosedUnitDisc := (convex_closedBall (0 : EuclideanPlane) + 1).contractibleSpace ⟨0, by simp⟩ + have hc' : ContractibleSpace Δ := e.symm.contractibleSpace + have ha : a ∈ Δ := hp ⟨0, by simp⟩ + have hb : b ∈ Δ := hp ⟨1, by simp⟩ + let p' : Path (⟨a, ha⟩ : Δ) ⟨b, hb⟩ := ⟨⟨fun t => ⟨p t, hp ⟨t, rfl⟩⟩, by fun_prop⟩, by simp, by + simp⟩ + let q' : Path (⟨a, ha⟩ : Δ) ⟨b, hb⟩ := ⟨⟨fun t => ⟨q t, hq ⟨t, rfl⟩⟩, by fun_prop⟩, by simp, by + simp⟩ + have h : p'.Homotopic q' := SimplyConnectedSpace.paths_homotopic _ _ + have h2 := h.map ⟨Subtype.val, continuous_subtype_val⟩ + have e1 : p'.map continuous_subtype_val = p := by + ext t + rfl + have e2 : q'.map continuous_subtype_val = q := by + ext t + rfl + have e3 := h2 + simp only [ContinuousMap.coe_mk] at e3 + rwa [e1, e2] at e3 + +theorem cast_refl_of_disc {Δ : Set T} (hΔ : IsClosedDisc Δ) {a b : T} (h : a = b) (p q : Path a b) + (hq : range q ⊆ Δ) (hp : p.Homotopic q) : + (p.cast rfl h).Homotopic (Path.refl a) := by + subst h + have hrefl : range (Path.refl a) ⊆ Δ := by + rintro _ ⟨t, rfl⟩ + exact hq ⟨0, by simp⟩ + exact hp.trans (paths_homotopic_in_disc hΔ q (Path.refl a) hq hrefl) + +theorem homotopic_of_trans_symm {a b : T} {p q : Path a b} (h : (p.trans q.symm).Homotopic + (Path.refl a)) : p.Homotopic q := by + have h1 : ((p.trans q.symm).trans q).Homotopic ((Path.refl a).trans q) := h.hcomp + (Path.Homotopic.refl q) + have h2 : ((p.trans q.symm).trans q).Homotopic p := by + refine (Path.Homotopic.trans_assoc p q.symm q).trans ?_ + have h3 := Path.Homotopic.trans_symm q.symm + rw [Path.symm_symm] at h3 + exact ((Path.Homotopic.refl p).hcomp h3).trans (Path.Homotopic.trans_refl p) + exact h2.symm.trans (h1.trans (Path.Homotopic.refl_trans q)) + +theorem seg_injective {s t : 𝕀} (hst : s < t) : Function.Injective (seg s t) := fun x y h => by + have h1 : (1 - x.1) * s.1 + x.1 * t.1 = (1 - y.1) * s.1 + y.1 * t.1 := congrArg Subtype.val h + have h2 : (x.1 - y.1) * (t.1 - s.1) = 0 := by linarith + have h3 : t.1 - s.1 ≠ 0 := sub_ne_zero.mpr (ne_of_gt hst) + exact Subtype.ext (sub_eq_zero.mp ((mul_eq_zero.mp h2).resolve_right h3)) + +theorem seg_zero_one (t : 𝕀) : seg 0 1 t = t := Subtype.ext (by + change (1 - t.1) * (0 : ℝ) + t.1 * 1 = t.1 + ring) + +variable [T2Space T] + +/-- **Rerouting a curve through a disc.** See the module docstring. -/ +theorem exists_reroute (hT : IsClosedSurface T) {D F : Set T} (hD : IsClosedDisc D) (hF : IsOArc F) + (hnn : ¬ IsNullHomotopicOArc F) (hm : (F ∩ D).Nonempty) (P : T → T → Set T) + (hP : ∀ a ∈ discBd D, ∀ b ∈ discBd D, P a b ⊆ D ∧ (a ≠ b → IsLineWithEnds (P a b) a b) ∧ (a = b + → P a b = {a})) : + ∃ C a b, IsOArc C ∧ ¬ IsNullHomotopicOArc C ∧ a ∈ F ∩ discBd D ∧ b ∈ F ∩ discBd D ∧ P a b ⊆ C + ∧ C ⊆ (F \ D) ∪ P a b := by + classical + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + by_contra hno + push Not at hno + obtain ⟨p₀, hp₀F, hp₀D⟩ := hm + obtain ⟨φ₀⟩ := id hF + let φ : Circle ≃ₜ F := (Homeomorph.mulLeft (φ₀.symm ⟨p₀, hp₀F⟩)).trans φ₀ + have hφ1 : (φ 1).1 = p₀ := by + simp [φ] + let f : C(𝕀, T) := ⟨fun x => (φ (arcParam 1 x)).1, by fun_prop⟩ + have hf0 : f 0 = p₀ := by + change (φ (arcParam 1 0)).1 = p₀ + rw [arcParam_zero, hφ1] + have hf1 : f 1 = p₀ := by + change (φ (arcParam 1 1)).1 = p₀ + rw [arcParam_one, hφ1] + have hfinj : ∀ {s t}, f s = f t → s = t ∨ (s = 0 ∧ t = 1) ∨ (s = 1 ∧ t = 0) := fun {s t} h => + arcParam_eq_iff 1 (φ.injective (Subtype.ext h)) + have hfF : ∀ t, f t ∈ F := fun t => (φ (arcParam 1 t)).2 + have hfr : ∀ x ∈ F, ∃ t, f t = x := fun x hx => by + obtain ⟨t, ht⟩ := arcParam_surjective 1 (φ.symm ⟨x, hx⟩) + exact ⟨t, by simp [f, ht]⟩ + have hDc := hD.isClosed + have hint : ∀ x ∈ discBd D, IsInteriorPoint x := fun x _ => hT.2.2 x + obtain ⟨Δ, hΔ, hsub, -⟩ := exists_disc_around hman hD hint isOpen_univ (subset_univ _) + have hI : IsOpen (Δ \ discBd Δ) := hΔ.isOpen_discInt hman + obtain ⟨G, hG, hdis, hcov⟩ := exists_intervals (U := f ⁻¹' Dᶜ) (K := f ⁻¹' (Δ \ discBd Δ)ᶜ) + (hDc.isOpen_compl.preimage f.continuous) + (hI.isClosed_compl.preimage f.continuous) (fun t ht hD' => ht (hsub hD')) + (by simpa [hf0] using hp₀D) (by simpa [hf1] using hp₀D) + have hDint : IsOpen (D \ discBd D) := hD.isOpen_discInt hman + have hbd : ∀ g ∈ G, f g.1 ∈ discBd D ∧ f g.2 ∈ discBd D := fun g hg => by + obtain ⟨g1, g2, g3, g4⟩ := hG g hg + have hcl : Icc g.1 g.2 ⊆ closure (Ioo g.1 g.2) := by rw [closure_Ioo (ne_of_lt g1)] + have key : ∀ x ∈ Icc g.1 g.2, f x ∈ D → f x ∈ discBd D := fun x hx hxD => by + by_contra hn + obtain ⟨y, hy, hyI⟩ := mem_closure_iff.mp (hcl hx) (f ⁻¹' (D \ discBd D)) + (hDint.preimage f.continuous) ⟨hxD, hn⟩ + exact g4 hyI hy.1 + exact ⟨key _ ⟨le_rfl, g1.le⟩ (not_not.mp g2), key _ ⟨g1.le, le_rfl⟩ (not_not.mp g3)⟩ + have hgood : ∀ g ∈ G, ∃ q : Path (f g.1) (f g.2), range q ⊆ Δ ∧ (subP f g.1 g.2).Homotopic q + := fun g hg => by + obtain ⟨g1, g2, g3, g4⟩ := hG g hg + obtain ⟨hb1, hb2⟩ := hbd g hg + have hg1D := not_not.mp g2 + have hg2D := not_not.mp g3 + obtain ⟨hPs, hPl, hPe⟩ := hP _ hb1 _ hb2 + by_cases hab : f g.1 = f g.2 + · exfalso + obtain ⟨h1, h2⟩ : g.1 = 0 ∧ g.2 = 1 := by + rcases hfinj hab with h | h | h + · exact absurd h (ne_of_lt g1) + · exact h + · exact absurd (h.1 ▸ g1 : (1 : 𝕀) < g.2) (not_lt.mpr unitInterval.le_one') + have hPa := hPe hab + refine hno F _ _ hF hnn ⟨hfF _, hb1⟩ ⟨hfF _, hb2⟩ ?_ ?_ + · rw [hPa] + exact singleton_subset_iff.mpr (hfF _) + · intro x hx + obtain ⟨t, rfl⟩ := hfr x hx + by_cases ht : t ∈ Ioo g.1 g.2 + · exact .inl ⟨hfF t, g4 ht⟩ + · right + rw [hPa] + have h3 : t = 0 ∨ t = 1 := by + by_contra hc + push Not at hc + exact ht ⟨h1 ▸ lt_of_le_of_ne unitInterval.nonneg' hc.1.symm, + h2 ▸ lt_of_le_of_ne unitInterval.le_one' hc.2⟩ + rw [h1] + rcases h3 with rfl | rfl + · rfl + · exact hf1.trans hf0.symm + · have hL := hPl hab + obtain ⟨c, hc, hr, c0, c1⟩ := hL.exists_arc + let q : Path (f g.1) (f g.2) := ⟨⟨c, hc.1⟩, c0, c1⟩ + have hqr : range q = P (f g.1) (f g.2) := hr + let e := subP f g.1 g.2 + have hei : Function.Injective e := fun x y hxy => by + have hxy' : f (seg g.1 g.2 x) = f (seg g.1 g.2 y) := hxy + apply seg_injective g1 + rcases hfinj hxy' with h | h | h + · exact h + · exfalso + have h1 := seg_mem g1.le x + have h2 := seg_mem g1.le y + rw [h.1] at h1 + rw [h.2] at h2 + have e1 : g.1 = 0 := le_antisymm h1.1 unitInterval.nonneg' + have e2 : g.2 = 1 := le_antisymm unitInterval.le_one' h2.2 + exact hab (by rw [e1, e2, hf0, hf1]) + · exfalso + have h1 := seg_mem g1.le x + have h2 := seg_mem g1.le y + rw [h.2] at h2 + rw [h.1] at h1 + have e1 : g.1 = 0 := le_antisymm h2.1 unitInterval.nonneg' + have e2 : g.2 = 1 := le_antisymm unitInterval.le_one' h1.2 + exact hab (by rw [e1, e2, hf0, hf1]) + have harc : IsArcMap e := ⟨e.continuous, hei⟩ + have hLe : IsLineWithEnds (range e) (f g.1) (f g.2) := by + have h1 := harc.isLineWithEnds + have h2 : e 0 = f g.1 := e.source + have h3 : e 1 = f g.2 := e.target + rwa [h2, h3] at h1 + have hmemA : ∀ x, ∀ y, e x = y → (y ∉ D ∧ y ∈ F) ∨ y = f g.1 ∨ y = f g.2 := fun x y h => by + have h1 := seg_mem g1.le x + have h2 : y = f (seg g.1 g.2 x) := h.symm + rcases eq_or_lt_of_le h1.1 with h3 | h3 + · right; left + rw [h2, ← h3] + rcases eq_or_lt_of_le h1.2 with h4 | h4 + · right; right + rw [h2, h4] + · left + exact h2 ▸ ⟨g4 ⟨h3, h4⟩, hfF _⟩ + have hend : ∀ {L : Set T} {u v : T}, IsLineWithEnds L u v → u ∈ L ∧ v ∈ L := by + rintro L u v ⟨k, h0, h1⟩ + exact ⟨h0 ▸ (k 0).2, h1 ▸ (k 1).2⟩ + have hinter : range e ∩ P (f g.1) (f g.2) = {f g.1, f g.2} := by + ext y + constructor + · rintro ⟨⟨x, hx⟩, hyP⟩ + rcases hmemA x y hx with h | h | h + · exact absurd (hPs hyP) h.1 + · exact .inl h + · exact .inr h + · rintro (rfl | rfl) + · exact ⟨(hend hLe).1, (hend hL).1⟩ + · exact ⟨(hend hLe).2, (hend hL).2⟩ + have hO := oArc_of_lines hLe hL hinter + have hnull : IsNullHomotopicOArc (range e ∪ P (f g.1) (f g.2)) := by_contra fun hn => (hno + (range e ∪ P (f g.1) (f g.2)) _ _ hO hn ⟨hfF _, hb1⟩ ⟨hfF _, hb2⟩ subset_union_right (by + rintro y (⟨x, hx⟩ | hy) + · rcases hmemA x y hx with h | h | h + · exact .inl ⟨h.2, h.1⟩ + · exact .inr (h ▸ (hend hL).1) + · exact .inr (h ▸ (hend hL).2) + · exact .inr hy)) + let loop := e.trans q.symm + let γ : C(Circle, T) := loopLift 1 loop.toContinuousMap (by simp) + have hγ : ∀ t, γ (arcParam 1 t) = loop t := fun t => loopLift_apply 1 _ _ t + have hrange : range γ = range e ∪ P (f g.1) (f g.2) := by + have heq : range γ = range loop := by + ext x + constructor + · rintro ⟨z, rfl⟩ + obtain ⟨s, rfl⟩ := arcParam_surjective 1 z + exact ⟨s, (hγ s).symm⟩ + · rintro ⟨s, rfl⟩ + exact ⟨arcParam 1 s, hγ s⟩ + rw [heq, Path.trans_range, Path.symm_range, hqr] + refine ⟨q, ?_, homotopic_of_trans_symm (path_refl_of_null loop hγ + (null_of_param hnull γ hrange))⟩ + rw [hqr] + exact fun y hy => (hsub (hPs hy)).1 + obtain ⟨q, hq, hh⟩ := homotopic_of_intervals f Δ G.card G le_rfl 0 1 unitInterval.nonneg' + (by rw [hf0]; exact (hsub hp₀D).1) + (by rw [hf1]; exact (hsub hp₀D).1) (fun g hg => by + obtain ⟨g1, g2, g3, g4⟩ := hG g hg + exact ⟨unitInterval.nonneg', g1, unitInterval.le_one', (hsub (not_not.mp g2)).1, + (hsub (not_not.mp g3)).1, hgood g hg⟩) hdis + (fun x _ hno' => by + by_contra hx + have hK : x ∈ f ⁻¹' (Δ \ discBd Δ)ᶜ := fun h' => hx h'.1 + obtain ⟨g, hg, hgx⟩ := hcov x hK + exact hno' g hg hgx) + have hcast := cast_refl_of_disc hΔ (hf0.trans hf1.symm) (subP f 0 1) q hq hh + apply hnn + refine ⟨φ, null_of_path_refl _ (fun t => ?_) hcast⟩ + change f t = f (seg 0 1 t) + rw [seg_zero_one] + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Sector.lean b/LeanPool/GraphMinor/GM19/Section6Sector.lean new file mode 100644 index 0000000000..80ba02515b --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Sector.lean @@ -0,0 +1,286 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Reroute +public import LeanPool.GraphMinor.GM19.Perimeter + +/-! +# Paths that leave a vertex into a region + +Let `v` be a vertex of a drawing `D` in a closed surface, and `ρ` a region of `D` that is an open +disc, +such that each `O`-arc through `v` that otherwise lies in `ρ` bounds a disc that misses `D` except +at +`v`. Then `ρ` has only one corner at `v` (`corner_unique`), and two paths from `v` to one point, off +`v` +inside `ρ`, are homotopic (`sector_homotopic`). This says that `ρ ∪ {v}` is simply connected, which +is +the fact the paper's proof of (6.7), page 342, starts from. + +The proof takes the start of each path, inside the closed disc `Q` of the one sector of `ρ` at `v`. +Two +points near `v` in the open disc join inside the sector (`exists_sector_nhd`). What is left of the +paths lies in `ρ`, an open disc. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 Metric + +local notation "𝕀" => unitInterval + +variable {T : Type} [TopologicalSpace T] + +/-- Near a boundary point of a closed disc, two points of the open disc are joined in the open disc. +-/ +theorem exists_sector_nhd {Q W : Set T} (hQ : IsClosedDisc Q) {v : T} (hv : v ∈ discBd Q) + (hW : IsOpen W) (hvW : v ∈ W) : ∃ O, IsOpen O ∧ v ∈ O ∧ O ⊆ W ∧ + ∀ a ∈ O ∩ discInt Q, ∀ b ∈ O ∩ discInt Q, ∃ p : Path a b, range p ⊆ O ∩ discInt Q := by + obtain ⟨h, g, c⟩ := hQ.exists_isChart + have hvQ : v ∈ Q := Surface.discBd_subset _ hv + have hp : h v ∈ sphere (0 : ℂ) 1 := by + rw [← c.bd] + exact mem_image_of_mem _ hv + have hpB : h v ∈ closedBall (0 : ℂ) 1 := sphere_subset_closedBall hp + have hgp : g (h v) = v := c.gh hvQ + obtain ⟨Y, hY, hYe⟩ := continuousOn_iff'.mp c.gc W hW + have hpY : h v ∈ Y := by + have : h v ∈ g ⁻¹' W ∩ closedBall 0 1 := ⟨by change g _ ∈ W; rwa [hgp], hpB⟩ + rw [hYe] at this + exact this.1 + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hY _ hpY + obtain ⟨O', hO', hOe⟩ := continuousOn_iff'.mp c.hc _ (isOpen_ball (x := h v) (ε := ε)) + have hvO' : v ∈ O' := by + have : v ∈ h ⁻¹' ball (h v) ε ∩ Q := ⟨mem_ball_self hε, hvQ⟩ + rw [hOe] at this + exact this.1 + let A : Set ℂ := ball (h v) ε ∩ ball 0 1 + have hAc : Convex ℝ A := (convex_ball _ _).inter (convex_ball _ _) + have hAb : A ⊆ closedBall 0 1 := fun _ hx => ball_subset_closedBall hx.2 + have hin : ∀ a ∈ (O' ∩ W) ∩ discInt Q, h a ∈ A := by + rintro a ⟨⟨haO, -⟩, haQ, hab⟩ + have h₁ : a ∈ h ⁻¹' ball (h v) ε ∩ Q := by + rw [hOe] + exact ⟨haO, haQ⟩ + refine ⟨h₁.1, ?_⟩ + have h₂ := c.hm haQ + rw [mem_closedBall, ← not_lt] at h₂ + rw [mem_ball] + refine lt_of_le_of_ne (not_lt.mp h₂) fun h₃ => hab ?_ + have h₄ : h a ∈ h '' discBd Q := by + rw [c.bd] + exact h₃ + obtain ⟨z, hz, hza⟩ := h₄ + have := congrArg g hza + rw [c.gh (Surface.discBd_subset _ hz), c.gh haQ] at this + exact this ▸ hz + have hout : ∀ y ∈ A, g y ∈ (O' ∩ W) ∩ discInt Q := by + intro y hy + have hyb := hAb hy + have hyQ := c.gm hyb + have hhy : h (g y) = y := c.hg hyb + refine ⟨⟨?_, ?_⟩, hyQ, fun hb => ?_⟩ + · have : g y ∈ h ⁻¹' ball (h v) ε ∩ Q := ⟨show h (g y) ∈ ball (h v) ε by rw [hhy]; exact hy.1, + hyQ⟩ + rw [hOe] at this + exact this.1 + · have : y ∈ g ⁻¹' W ∩ closedBall 0 1 := by + rw [hYe] + exact ⟨hball hy.1, hyb⟩ + exact this.1 + · have : h (g y) ∈ h '' discBd Q := mem_image_of_mem _ hb + rw [c.bd, hhy] at this + have h₁ := hy.2 + rw [mem_ball] at h₁ + rw [mem_sphere] at this + exact h₁.ne this + refine ⟨O' ∩ W, hO'.inter hW, ⟨hvO', hvW⟩, inter_subset_right, fun a ha b hb => ?_⟩ + have hja := hin a ha + have hjb := hin b hb + have hJ : JoinedIn A (h a) (h b) := (hAc.isPathConnected ⟨_, hja⟩).joinedIn _ hja _ hjb + have hσ : ∀ t, hJ.somePath t ∈ closedBall (0 : ℂ) 1 := fun t => hAb (hJ.somePath_mem t) + refine ⟨⟨⟨fun t => g (hJ.somePath t), c.gc.comp_continuous hJ.somePath.continuous hσ⟩, ?_, ?_⟩, + ?_⟩ + · simpa using c.gh ha.2.1 + · simpa using c.gh hb.2.1 + · rintro _ ⟨t, rfl⟩ + exact hout _ (hJ.somePath_mem t) + +/-- A continuous map from the interval stays in an open set for a while. -/ +theorem exists_time {f : 𝕀 → T} (hf : Continuous f) {O : Set T} (hO : IsOpen O) (h0 : f 0 ∈ O) : + ∃ t₀ : 𝕀, 0 < t₀ ∧ ∀ s ≤ t₀, f s ∈ O := by + obtain ⟨ε, hε, hb⟩ := Metric.isOpen_iff.mp (hO.preimage hf) 0 h0 + have hpos : 0 < min 1 (ε / 2) := lt_min one_pos (by positivity) + refine ⟨⟨min 1 (ε / 2), hpos.le, min_le_left _ _⟩, hpos, fun s hs => hb ?_⟩ + have hs' : s.1 ≤ ε / 2 := le_trans hs (min_le_right _ _) + rw [mem_ball, Subtype.dist_eq] + have h₁ := s.2.1 + change dist s.1 0 < ε + rw [Real.dist_eq, sub_zero, abs_of_nonneg h₁] + linarith + +theorem path_split_aux (f : C(𝕀, T)) {u v : T} (h0 : f 0 = u) (h1 : f 1 = v) (t : 𝕀) : + ∃ (g₁ : Path u (f t)) (g₂ : Path (f t) v), (⟨f, h0, h1⟩ : Path u v).Homotopic (g₁.trans g₂) ∧ + (∀ s, ∃ s' ≤ t, g₁ s = f s' ∧ (0 < s → 0 < t → 0 < s')) ∧ + (∀ s, ∃ s', t ≤ s' ∧ g₂ s = f s' ∧ (s < 1 → t < 1 → s' < 1)) := by + subst h0 h1 + refine ⟨subP f 0 t, subP f t 1, ?_, fun s => ⟨seg 0 t s, ?_, rfl, ?_⟩, fun s => ⟨seg t 1 s, ?_, + rfl, ?_⟩⟩ + · have e : (⟨f, rfl, rfl⟩ : Path (f 0) (f 1)) = subP f 0 1 := by + ext x + change f x = f (seg 0 1 x) + congr 1 + ext + simp [seg] + rw [e] + exact subP_trans f 0 t 1 + · change ((1 - s.1) * (0 : 𝕀).1 + s.1 * t.1) ≤ t.1 + have := s.2.2 + have := t.2.1 + simp only [Icc.coe_zero, mul_zero, zero_add] + nlinarith + · intro h₁ h₂ + change 0 < ((1 - s.1) * (0 : 𝕀).1 + s.1 * t.1) + have h₁' : 0 < s.1 := h₁ + have h₂' : 0 < t.1 := h₂ + simp only [Icc.coe_zero, mul_zero, zero_add] + positivity + · change t.1 ≤ ((1 - s.1) * t.1 + s.1 * (1 : 𝕀).1) + have := s.2.1 + have := t.2.2 + simp only [Icc.coe_one, mul_one] + nlinarith + · intro h₁ h₂ + change ((1 - s.1) * t.1 + s.1 * (1 : 𝕀).1) < 1 + have h₁' : s.1 < 1 := h₁ + have h₂' : t.1 < 1 := h₂ + simp only [Icc.coe_one, mul_one] + nlinarith + +/-- A path is the product of its parts before and after a time. -/ +theorem path_split {u v : T} (g : Path u v) (t : 𝕀) : + ∃ (g₁ : Path u (g t)) (g₂ : Path (g t) v), g.Homotopic (g₁.trans g₂) ∧ + (∀ s, ∃ s' ≤ t, g₁ s = g s' ∧ (0 < s → 0 < t → 0 < s')) ∧ + (∀ s, ∃ s', t ≤ s' ∧ g₂ s = g s' ∧ (s < 1 → t < 1 → s' < 1)) := + path_split_aux g.toContinuousMap g.source g.target t + +theorem trans_mem_of_pos {a b c : T} {p : Path a b} {q : Path b c} {ρ : Set T} + (hp : ∀ t, 0 < t → p t ∈ ρ) (hq : ∀ t, q t ∈ ρ) : ∀ t, 0 < t → p.trans q t ∈ ρ := by + intro t ht + rw [Path.trans_apply] + split_ifs with h + · refine hp _ ?_ + have ht' : 0 < t.1 := ht + change 0 < 2 * t.1 + positivity + · exact hq _ + +/-- Two paths in an open disc with the same ends are homotopic. -/ +theorem paths_homotopic_in_open {Λ : Set T} (hΛ : IsOpenDisc Λ) {a b : T} (p q : Path a b) + (hp : range p ⊆ Λ) (hq : range q ⊆ Λ) : p.Homotopic q := by + obtain ⟨-, ⟨e⟩⟩ := id hΛ + have hc : ContractibleSpace OpenUnitDisc := + (convex_ball (0 : EuclideanPlane) 1).contractibleSpace ⟨0, by simp⟩ + have hc' : ContractibleSpace Λ := e.symm.contractibleSpace + have ha : a ∈ Λ := hp ⟨0, by simp⟩ + have hb : b ∈ Λ := hp ⟨1, by simp⟩ + let p' : Path (⟨a, ha⟩ : Λ) ⟨b, hb⟩ := ⟨⟨fun t => ⟨p t, hp ⟨t, rfl⟩⟩, by fun_prop⟩, by simp, by + simp⟩ + let q' : Path (⟨a, ha⟩ : Λ) ⟨b, hb⟩ := ⟨⟨fun t => ⟨q t, hq ⟨t, rfl⟩⟩, by fun_prop⟩, by simp, by + simp⟩ + have h : p'.Homotopic q' := SimplyConnectedSpace.paths_homotopic _ _ + have h2 := h.map ⟨Subtype.val, continuous_subtype_val⟩ + have e1 : p'.map continuous_subtype_val = p := by + ext t + rfl + have e2 : q'.map continuous_subtype_val = q := by + ext t + rfl + have e3 := h2 + simp only [ContinuousMap.coe_mk] at e3 + rwa [e1, e2] at e3 + +/-- **Two paths into a region from a vertex.** See the module docstring. -/ +theorem sector_homotopic (hT : IsClosedSurface T) (D : Drawing T) {γ : Set T → 𝕀 + → T} + (hγ : EdgePar D γ) {v : T} (hv : v ∈ D.V) (h2 : 2 ≤ Nat.card (halfEdges D γ v)) {ρ : Set T} + (hρ : ρ ∈ D.R) (hρd : IsOpenDisc ρ) + (hpinch : ∀ F : Set T, IsOArc F → v ∈ F → v ∈ closure (F \ {v}) → F \ {v} ⊆ ρ → + ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = F ∧ Δ ∩ D.U ⊆ {v}) {x : T} (α β : Path v x) + (hα : ∀ t, 0 < t → α t ∈ ρ) (hβ : ∀ t, 0 < t → β t ∈ ρ) : α.Homotopic β := by + classical + have : T2Space T := hT.2.1 + obtain ⟨next, ρs, P, W, Q, τ, hsec, hcov, hPQ⟩ := exists_sectors' hT D hγ hv h2 + have hvρ : v ∈ closure ρ := by + rw [_root_.mem_closure_iff] + intro O hO hvO + obtain ⟨t, ht, hs⟩ := exists_time α.continuous hO (by simpa using hvO) + exact ⟨α t, hs t le_rfl, hα t ht⟩ + obtain ⟨k, hk⟩ := hsec.corners.all ρ hρ hvρ + have huniq : ∀ j, ρs j = ρ → j = k := fun j hj => + (corner_unique hT hv hsec hcov hPQ (hk.symm.trans hj.symm) (fun F hF hvF hcl hsub => + hpinch F hF hvF hcl (hk ▸ hsub))).symm + have hρU : Disjoint ρ D.U := disjoint_left.mpr fun y hy => region_subset hρ hy + have hWρ : W ∩ ρ ⊆ P k := by + rintro y ⟨hyW, hyρ⟩ + obtain ⟨j, hj⟩ := mem_iUnion.mp (hcov ⟨hyW, disjoint_left.mp hρU hyρ⟩) + have hjρ : ρs j = ρ := region_eq_of_mem (hsec.corners.region j) hρ (hsec.sub j hj) hyρ + rwa [huniq j hjρ] at hj + obtain ⟨O, hO, hvO, hOW, hOp⟩ := exists_sector_nhd (hsec.disc k) (hsec.bd k) hsec.isOpen hsec.mem + have hin : ∀ y ∈ O, y ∈ ρ → y ∈ O ∩ discInt (Q k) := fun y hyO hyρ => + ⟨hyO, hPQ k (hWρ ⟨hOW hyO, hyρ⟩), fun hb => + disjoint_left.mp hρU hyρ (hsec.bdU k ⟨hOW hyO, hb⟩)⟩ + have hsecρ : O ∩ discInt (Q k) ⊆ ρ := by + rintro y ⟨hyO, hyQ⟩ + have := hsec.sub k (hsec.inside k ⟨⟨hOW hyO, hyQ.1⟩, hyQ.2⟩) + rwa [← hk] at this + obtain ⟨t₀, ht₀, hsα⟩ := exists_time α.continuous hO (by simpa using hvO) + obtain ⟨t₁, ht₁, hsβ⟩ := exists_time β.continuous hO (by simpa using hvO) + obtain ⟨α₁, α₂, hα₀, hα₁, hα₂⟩ := path_split α t₀ + obtain ⟨β₁, β₂, hβ₀, hβ₁, hβ₂⟩ := path_split β t₁ + obtain ⟨δ, hδ⟩ := hOp _ (hin _ (hsα t₀ le_rfl) (hα _ ht₀)) _ (hin _ (hsβ t₁ le_rfl) (hβ _ ht₁)) + have hvQ : v ∈ Q k := Surface.discBd_subset _ (hsec.bd k) + have hrng : ∀ {y : 𝕀 → T} {t : 𝕀}, y 0 = v → (∀ s ≤ t, y s ∈ O) → (∀ s, 0 < s → y s ∈ ρ) → + ∀ s ≤ t, y s ∈ Q k := by + intro y t h0 hO' hρ' s hs + by_cases h : s = 0 + · rwa [h, h0] + · exact (hin _ (hO' s hs) (hρ' s (unitInterval.pos_iff_ne_zero.mpr h))).2.1 + have h₁ : (α₁.trans δ).Homotopic β₁ := by + refine paths_homotopic_in_disc (hsec.disc k) _ _ ?_ ?_ + · rw [Path.trans_range] + refine union_subset ?_ (fun y hy => (hδ hy).2.1) + rintro _ ⟨s, rfl⟩ + obtain ⟨s', hs', he, -⟩ := hα₁ s + rw [he] + exact hrng α.source hsα hα s' hs' + · rintro _ ⟨s, rfl⟩ + obtain ⟨s', hs', he, -⟩ := hβ₁ s + rw [he] + exact hrng β.source hsβ hβ s' hs' + have h₂ : α₂.Homotopic (δ.trans β₂) := by + refine paths_homotopic_in_open hρd _ _ ?_ ?_ + · rintro _ ⟨s, rfl⟩ + obtain ⟨s', hs', he, -⟩ := hα₂ s + rw [he] + exact hα _ (lt_of_lt_of_le ht₀ hs') + · rw [Path.trans_range] + refine union_subset (fun y hy => hsecρ (hδ hy)) ?_ + rintro _ ⟨s, rfl⟩ + obtain ⟨s', hs', he, -⟩ := hβ₂ s + rw [he] + exact hβ _ (lt_of_lt_of_le ht₁ hs') + exact hα₀.trans (((Path.Homotopic.refl α₁).hcomp h₂).trans + ((Path.Homotopic.trans_assoc α₁ δ β₂).symm.trans ((h₁.hcomp (Path.Homotopic.refl β₂)).trans + hβ₀.symm))) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Seven.lean b/LeanPool/GraphMinor/GM19/Section6Seven.lean new file mode 100644 index 0000000000..2da9dcac43 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Seven.lean @@ -0,0 +1,301 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Rep +public import LeanPool.GraphMinor.GM11.Section64 + +/-! +# Graph Minors XIX, (6.7) + +**(6.7)** (page 342): if `Γ` is an internally 3-connected painting in a surface `Σ`, then `sk(Γ)` is +a +block and `rep(sk(Γ)) = rep(Γ)`. The first part is `sk_isBlock`. For the second part, a +non-null-homotopic +circuit of `Γ*` with `2m` edges is an `sk(Γ)`-normal `O`-arc with `m` vertices. The converse is +`rep_le_sk`, which needs each vertex of `sk(Γ)` to have at least two half-edges. A block has this +property, unless it is one edge with its two ends. In that case each `O`-arc is null-homotopic, +since a +disc around the edge leaves only an open disc (`null_of_single_edge`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +local notation "𝕀" => unitInterval + +theorem drawing_eq {T : Type} [TopologicalSpace T] {D D' : Drawing T} (hU : D.U = D'.U) + (hV : D.V = D'.V) : D = D' := by + cases D + cases D' + simp_all + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {D : Drawing Shat} + +omit [T2Space Shat] in +theorem sk_loopFree (hS : IsSurface S) (hD : IsSkHat cap Γ D) : LoopFree D := by + intro e he + obtain ⟨u, w, huw, hset⟩ := hD.no_loops hS e he + exact ⟨u, w, huw, by rw [tilde_eq_inter_V D he, hset], isLine_closure he huw hset⟩ + +omit [T2Space Shat] in +omit [T2Space S] in +/-- A radial drawing of `Γ` extends to a radial drawing of `sk(Γ)`. -/ +theorem exists_sk_radial (rad : RadialDrawing cap Γ) (hS : IsSurface S) (hD : IsSkHat cap Γ D) + (h3 : Γ.IsInternallyThreeConnected) : ∃ G₃, PreRad (PaintingOrDrawing.drawing D) G₃ ∧ + RadMax (PaintingOrDrawing.drawing D) G₃ := by + obtain ⟨D', G₃, hD', hpre, hmax, -, -⟩ := rad.exists_full hS (h3.hatRegions_isOpenDisc hS cap) + h3.1 + obtain rfl : D = D' := drawing_eq (hD.hU.trans hD'.hU.symm) (hD.hV.trans hD'.hV.symm) + exact ⟨G₃, hpre, hmax⟩ + +variable [ConnectedSpace Shat] + +/-- **Graph Minors XIX, (6.7), first statement**: `sk(Γ)` is a block. -/ +theorem sk_block (rad : RadialDrawing cap Γ) (hS : IsSurface S) (hD : IsSkHat cap Γ D) + (h3 : Γ.IsInternallyThreeConnected) : D.IsBlock := by + obtain ⟨G₃, hpre, hmax⟩ := exists_sk_radial rad hS hD h3 + exact sk_isBlock hS hD h3 (sk_loopFree hS hD) hpre hmax + +omit [T2Space S] [T2Space Shat] in +omit [ConnectedSpace Shat] in +/-- An `O`-arc off `sk(Γ)` lies in an open disc, so it is null-homotopic. -/ +theorem null_of_disjoint (hS : IsSurface S) (hD : IsSkHat cap Γ D) + (h3 : Γ.IsInternallyThreeConnected) {F : Set Shat} (hF : IsOArc F) (hFU : Disjoint F D.U) : + IsNullHomotopicOArc F := by + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace cap.isClosedSurface + obtain ⟨φ⟩ := id hF + have hFr : F = range fun z : Circle => (φ z).1 := by + ext x + constructor + · intro hx + exact ⟨φ.symm ⟨x, hx⟩, by simp⟩ + · rintro ⟨z, rfl⟩ + exact (φ z).2 + have hFc : IsPreconnected F := by + rw [hFr] + exact isPreconnected_range (by fun_prop) + have hy := (φ 1).2 + obtain ⟨ρ, hρ, hyρ⟩ := exists_region_of_notMem (disjoint_left.mp hFU hy) + have hsub := subset_region hρ hFc hFU hy hyρ + obtain ⟨x, hx, H, -, h0, h1⟩ := (sk_region_disc hS hD h3 hρ).isSimplyConnectedSet.2 + ⟨fun z => (φ z).1, by fun_prop⟩ (by + rintro _ ⟨z, rfl⟩ + exact hsub (φ z).2) + exact ⟨φ, x, mem_univ _, H, fun _ => mem_univ _, h0, h1⟩ + +omit [ConnectedSpace Shat] in +/-- If `sk(Γ)` is one edge with its ends, each `O`-arc is null-homotopic. A disc holds the edge off +its +boundary, and we reroute the `O`-arc along that boundary, off `sk(Γ)`. -/ +theorem null_of_single_edge (hS : IsSurface S) (hD : IsSkHat cap Γ D) + (h3 : Γ.IsInternallyThreeConnected) {e : Set Shat} (he : D.U = closure e) (heE : e ∈ D.E) + {F : Set Shat} (hF : IsOArc F) : IsNullHomotopicOArc F := by + classical + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + by_contra hnn + obtain ⟨u, v, huv, -, hL, -⟩ := exists_end D (sk_loopFree hS hD) heE + obtain ⟨D₀, -, -, hD₀, hLD, -, -, -, -, -⟩ := exists_edge_lens hT hL huv isClosed_empty (by simp) + obtain ⟨Δ, hΔ, hsub, -⟩ := Surface.exists_disc_around hman hD₀ (fun x _ => hT.2.2 x) + isOpen_univ (subset_univ _) + have hBU : Disjoint (discBd Δ) D.U := by + rw [he] + exact disjoint_left.mpr fun x hx hxL => (hsub (hLD hxL)).2 hx + have hUΔ : D.U ⊆ Δ := by + rw [he] + exact fun x hx => (hsub (hLD hx)).1 + by_cases hm : (F ∩ Δ).Nonempty + · have hex : ∀ a b : Shat, ∃ P : Set Shat, a ∈ discBd Δ → b ∈ discBd Δ → + P ⊆ discBd Δ ∧ (a ≠ b → IsLineWithEnds P a b) ∧ (a = b → P = {a}) := by + intro a b + by_cases hab : a = b + · exact ⟨{a}, fun ha _ => ⟨singleton_subset_iff.mpr ha, fun h => absurd hab h, fun _ => rfl⟩⟩ + by_cases h : a ∈ discBd Δ ∧ b ∈ discBd Δ + · obtain ⟨A, B, hA, -, hU, -⟩ := hΔ.isOArc_discBd.lines h.1 h.2 hab + exact ⟨A, fun _ _ => ⟨hU ▸ subset_union_left, fun _ => hA, fun h' => absurd h' hab⟩⟩ + · exact ⟨∅, fun ha hb => absurd ⟨ha, hb⟩ h⟩ + choose P hP using hex + obtain ⟨C, a, b, hC, hCn, ha, hb, -, hCs⟩ := exists_reroute hT hΔ hF hnn hm P fun a ha b hb => + ⟨(hP a b ha hb).1.trans (Surface.discBd_subset _), (hP a b ha hb).2⟩ + refine hCn (null_of_disjoint hS hD h3 hC (disjoint_left.mpr fun x hx hxU => ?_)) + rcases hCs hx with h | h + · exact h.2 (hUΔ hxU) + · exact disjoint_left.mp hBU ((hP a b ha.2 hb.2).1 h) hxU + · refine hnn (null_of_disjoint hS hD h3 hF (disjoint_left.mpr fun x hx hxU => ?_)) + exact hm ⟨x, hx, hUΔ hxU⟩ + +omit [T2Space Shat] [ConnectedSpace Shat] in +/-- Each vertex of a block lies on two edges, unless the block is one edge with its ends. -/ +theorem two_edges_or_single {G : Drawing Shat} (hl : LoopFree G) (hb : G.IsBlock) + (hE : G.E.Nonempty) : (∀ v ∈ G.V, ∃ e₁ ∈ G.E, ∃ e₂ ∈ G.E, e₁ ≠ e₂ ∧ v ∈ tilde e₁ + ∧ v ∈ tilde e₂) ∨ + ∃ e ∈ G.E, G.U = closure e := by + classical + by_contra hno + push Not at hno + obtain ⟨⟨v, hv, hnot⟩, hsingle⟩ := hno + have hconn := (preconnected_iff_connIn G _).mp hb.connected + have hcut : ∀ w ∈ G.V, ConnIn G (G.V \ {w}) := fun w hw => + (preconnected_iff_connIn G _).mp (hb.biconnected w hw) + obtain ⟨e₀, he₀⟩ := hE + have hend : ∀ e ∈ G.E, tilde e ⊆ G.V := fun e he x hx => by + rw [tilde_eq_inter_V G he] at hx + exact hx.2 + obtain ⟨p, q, hpq, htp, -⟩ := hl e₀ he₀ + have hne₂ : ∃ c ∈ G.V, c ≠ v := by + by_cases hp : p = v + · exact ⟨q, hend _ he₀ (htp ▸ .inr rfl), fun h => hpq (hp.trans h.symm)⟩ + · exact ⟨p, hend _ he₀ (htp ▸ .inl rfl), hp⟩ + obtain ⟨c, hc, hcv⟩ := hne₂ + obtain ⟨b, hbadj⟩ : ∃ b, G.adj.Adj v b := by + by_contra hn + push Not at hn + have := hconn {v} (singleton_subset_iff.mpr hv) (singleton_nonempty v) fun a ha b _ hab => by + rw [mem_singleton_iff.mp ha] at hab + exact absurd hab (hn b) + have hc' : c ∈ ({v} : Set Shat) := this ▸ hc + exact hcv hc' + obtain ⟨hvb, -, hbV, e₁, he₁, hv₁, hb₁⟩ := id hbadj + obtain ⟨u₁, w₁, huw, ht₁, -⟩ := hl e₁ he₁ + have htv : tilde e₁ = {v, b} := by + refine (eq_of_subset_of_ncard_le (s := {v, b}) ?_ ?_ (by rw [ht₁]; exact toFinite _)).symm + · rintro y (rfl | rfl) + · exact hv₁ + · exact hb₁ + · rw [ht₁, ncard_pair huw, ncard_pair hvb] + have hall : ∀ e ∈ G.E, v ∈ tilde e → e = e₁ := fun e he hve => by + by_contra hne + obtain ⟨e', he', hne', hv'⟩ := hnot e₁ he₁ e he (Ne.symm hne) hv₁ |> fun h => + (⟨e, he, hne, hve, h⟩ : ∃ e' ∈ G.E, e' ≠ e₁ ∧ v ∈ tilde e' ∧ v ∉ tilde e) + exact hv'.2 hve + have hVsub : G.V ⊆ {v, b} := by + have hY := (hcut b hbV) {v} (singleton_subset_iff.mpr ⟨hv, hvb⟩) (singleton_nonempty v) + fun a ha y hy hay => by + rw [mem_singleton_iff.mp ha] at hay + obtain ⟨hne, -, -, e₂, he₂, hv₂, hy₂⟩ := hay + rw [hall e₂ he₂ hv₂, htv] at hy₂ + rcases hy₂ with h | h + · exact absurd h.symm hne + · exact absurd h hy.2 + intro y hy + by_cases hyb : y = b + · exact .inr hyb + · have : y ∈ ({v} : Set Shat) := hY ▸ ⟨hy, hyb⟩ + exact .inl this + refine hsingle e₁ he₁ (Subset.antisymm (fun x hx => ?_) (G.closure_subset_U he₁)) + by_cases hxV : x ∈ G.V + · have : x ∈ tilde e₁ := by + rw [htv] + exact hVsub hxV + exact this.1 + · obtain ⟨e, he, hxe⟩ := exists_edge_of_mem G hx hxV + obtain ⟨u₂, w₂, huw₂, ht₂, -⟩ := hl e he + have h₁ : u₂ ∈ tilde e := ht₂ ▸ .inl rfl + have h₂ : w₂ ∈ tilde e := ht₂ ▸ .inr rfl + have hve : v ∈ tilde e := by + rcases hVsub (hend e he h₁) with h | h + · exact h ▸ h₁ + · rcases hVsub (hend e he h₂) with h' | h' + · exact h' ▸ h₂ + · exact absurd (h.trans h'.symm) huw₂ + exact subset_closure (hall e he hve ▸ hxe) + +/-- `rep(Γ) ≤ rep(sk(Γ))`. -/ +theorem rep_le_sk' (rad : RadialDrawing cap Γ) (hS : IsSurface S) (hD : IsSkHat cap Γ D) + (h3 : Γ.IsInternallyThreeConnected) : Painting.rep rad ≤ D.rep := by + classical + have hl := sk_loopFree hS hD + obtain ⟨γ, hγ⟩ := exists_edgePar D + rcases two_edges_or_single hl (sk_block rad hS hD h3) (hD.E_nonempty h3.1) with hall | ⟨e, he, + hU⟩ + · refine rep_le_sk rad hS hD h3 hγ fun v hv => ?_ + obtain ⟨e₁, he₁, e₂, he₂, hne, hv₁, hv₂⟩ := hall v hv + have hcl : ∀ {e}, e ∈ D.E → v ∈ tilde e → v ∈ closure e := fun he h => by + rw [tilde_eq_inter_V D he] at h + exact h.1 + obtain ⟨b₁, hb₁⟩ := exists_end_eq hγ he₁ hv (hcl he₁ hv₁) + obtain ⟨b₂, hb₂⟩ := exists_end_eq hγ he₂ hv (hcl he₂ hv₂) + have hfin : Finite (halfEdges D γ v) := (finite_halfEdges D γ v).to_subtype + have hnt : Nontrivial (halfEdges D γ v) := + ⟨⟨(e₁, b₁), he₁, hb₁⟩, ⟨(e₂, b₂), he₂, hb₂⟩, fun h => hne (congrArg (fun x => x.1.1) h)⟩ + exact Finite.one_lt_card_iff_nontrivial.mpr hnt + · refine le_sInf ?_ + rintro _ ⟨F, hF, -, hnn, -⟩ + exact absurd (null_of_single_edge hS hD h3 hU he hF) hnn + +omit [ConnectedSpace Shat] in +omit [T2Space S] in +/-- `rep(sk(Γ)) ≤ rep(Γ)`: a circuit of `Γ*` is an `sk(Γ)`-normal `O`-arc. -/ +theorem sk_le_rep (rad : RadialDrawing cap Γ) (hD : IsSkHat cap Γ D) : + D.rep ≤ Painting.rep rad := by + have hVhat : D.V = Γ.hatV cap := hD.hV + have hUhat : D.U ⊆ Γ.hatU cap := by + rw [hD.hU] + exact image_mono Γ.skU_subset + have hb : ∀ e x y, rad.G.toGraph.IsLink e x y → (x ∈ D.V ↔ y ∉ D.V) := by + intro e x y hl + obtain ⟨v, hv, w, hw, hcap⟩ := rad.edge_ends hl.1 + have heq : ({x, y} : Set Shat) = {cap.emb v, w} := hl.2.2.2.symm.trans hcap + have hx : x ∈ ({cap.emb v, w} : Set Shat) := heq ▸ mem_insert x _ + have hy : y ∈ ({cap.emb v, w} : Set Shat) := heq ▸ mem_insert_of_mem x rfl + have hvD : cap.emb v ∈ D.V := by + rw [hD.hV] + exact mem_image_of_mem _ hv + have hwD : w ∉ D.V := fun h => hw.2 (hVhat ▸ h) + have hw' : w ∈ ({x, y} : Set Shat) := heq ▸ .inr rfl + have hv' : cap.emb v ∈ ({x, y} : Set Shat) := heq ▸ .inl rfl + rcases hx with hx | hx <;> rcases hy with hy | hy + · exfalso + rcases hw' with h | h + · exact hwD (h.trans hx ▸ hvD) + · exact hwD (h.trans hy ▸ hvD) + · rw [hx, hy] + exact ⟨fun _ => hwD, fun _ => hvD⟩ + · rw [hx, hy] + exact ⟨fun h => absurd h hwD, fun h => absurd hvD h⟩ + · exfalso + rcases hv' with h | h + · exact hwD ((h.trans hx) ▸ hvD) + · exact hwD ((h.trans hy) ▸ hvD) + refine le_sInf ?_ + rintro _ ⟨C, ⟨hCs, hC⟩, hnn, rfl⟩ + have hN : D.IsNormal C.U := fun x hx => by + have : x ∈ Γ.hatU cap ∩ rad.G.U := ⟨hUhat hx.2, hCs.U_subset hx.1⟩ + rw [rad.isPreRadial.1] at this + exact hVhat ▸ this + have h₁ : D.rep ≤ ((C.U ∩ D.V).ncard : ℕ∞) := + sInf_le ⟨C.U, IsCircuit.isOArc_U hC, hN, hnn, rfl⟩ + refine h₁.trans ?_ + have hsub : C.U ∩ D.V ⊆ D.V ∩ C.V := by + rintro x ⟨hxC, hxV⟩ + refine ⟨hxV, ?_⟩ + by_contra hn + obtain ⟨e, he, hxe⟩ := C.exists_edge_of_mem hxC hn + exact ((hCs.2 he).2.1 hxe).2 (rad.isPreRadial.2.1 (hVhat ▸ hxV)) + have h₂ := two_mul_ncard_le_length D.V hb hC hCs + have h₃ := ncard_le_ncard hsub (C.finite_V.subset inter_subset_right) + have h₄ : (C.U ∩ D.V).ncard ≤ C.E.ncard / 2 := by + rw [Nat.le_div_iff_mul_le (by norm_num)] + have : C.length = C.E.ncard := rfl + omega + exact_mod_cast h₄ + +/-- **Graph Minors XIX, (6.7)** (page 342): if `Γ` is an internally 3-connected painting in a +surface +`Σ`, then `sk(Γ)` is a block and `rep(sk(Γ)) = rep(Γ)`. -/ +theorem theorem_6_7_proof (rad : RadialDrawing cap Γ) (hS : IsSurface S) (hD : IsSkHat cap Γ D) + (h3 : Γ.IsInternallyThreeConnected) : D.IsBlock ∧ D.rep = Painting.rep rad := + ⟨sk_block rad hS hD h3, le_antisymm (sk_le_rep rad hD) (rep_le_sk' rad hS hD h3)⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Six.lean b/LeanPool/GraphMinor/GM19/Section6Six.lean new file mode 100644 index 0000000000..5ae864d8f9 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Six.lean @@ -0,0 +1,498 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Delete +public import LeanPool.GraphMinor.GM19.Section6Path +public import LeanPool.GraphMinor.GM19.Section6Max +public import LeanPool.GraphMinor.GM19.Section6Five + +/-! +# Theorem (6.6) of Graph Minors XIX + +We follow the proof on pages 341-342. Let `σ'` be a largest enlargement, from +`exists_full_enlargement`. Let `r` be a region of `G'`, let `a, b` be vertices of `σ'(v)` in the +closure of `r`. Take a path `Q` of `σ'(v)` from `a` to `b`, and a line `L` from `a` to `b` through +`r`. By (6.5), the O-arc `F = U(Q) ∪ L` bounds a disc `Δ`. Claim (1) of the paper is +`mem_of_closed_adj`. Since `G` is a block, all branch sets other than `σ'(v)` lie on one side of +`F`. If they lie outside `Δ` we use claim (1). If they lie inside, then the surface is a sphere by +(6.5), since `exists_curve_off_disc` gives a non-null-homotopic O-arc off the inside of `Δ`, and we +use claim (1) for the other disc. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GM11 + +section + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +theorem IsEnlargement.restrict {G G' H H' : Drawing S} {σv : S → Drawing S} {σe : Set S → Set S} + (hσ : IsEnlargement G G' σv σe) (hH : H.IsSubdrawing G) + (hτ : ∀ u ∈ H.V, (σv u).IsSubdrawing H') (he : ∀ e ∈ H.E, σe e ∈ H'.E) : IsEnlargement H H' σv + σe := + ⟨he, hσ.edge_injOn.mono hH.2, hτ, fun v hv => hσ.vertex_nonempty v (hH.1 hv), fun v hv + => hσ.vertex_connected v (hH.1 hv), + fun a ha b hb => hσ.vertex_disjoint a (hH.1 ha) b (hH.1 hb), fun e he v hv => hσ.ends_iff e + (hH.2 he) v (hH.1 hv)⟩ + +/-- Deleting `v` from `G`, and from `G'` a set that misses the other branch sets. -/ +theorem IsEnlargement.delete {G G' : Drawing S} (hl : LoopFree G) (hl' : LoopFree G') {σv : S + → Drawing S} {σe : Set S → Set S} (hσ : IsEnlargement G G' σv σe) {v : S} {X : Set S} + (hX : ∀ u ∈ G.V, u ≠ v → Disjoint (σv u).V X) : IsEnlargement (delete G {v}) + (delete G' X) σv σe := by + refine hσ.restrict (delete_subdrawing G {v}) (fun u hu => ?_) fun e he => ?_ + · rw [delete_V] at hu + have hu' : u ≠ v := fun h => hu.2 h + have hsub := hσ.vertex_subdrawing u hu.1 + refine ⟨?_, ?_⟩ + · rw [delete_V] + exact fun x hx => ⟨hsub.1 hx, fun h => Set.disjoint_left.mp (hX u hu.1 hu') hx h⟩ + · rw [delete_E] + exact fun e he => ⟨hsub.2 he, Set.disjoint_left.mpr fun x hx h => Set.disjoint_left.mp + (hX u hu.1 hu') (tilde_subset_V _ he hx) h⟩ + · rw [delete_E] at he ⊢ + refine ⟨hσ.edge_mem e he.1, Set.disjoint_left.mpr fun x hx h => ?_⟩ + obtain ⟨u, hu, hue, hxu⟩ := hσ.end_mem hl hl' he.1 hx + have huv : u ≠ v := fun h' => Set.disjoint_left.mp he.2 hue h' + exact Set.disjoint_left.mp (hX u hu huv) hxu h + +omit [T2Space S] in +theorem Drawing.IsGM19Drawing.sub {H G : Drawing S} (hG : G.IsGM19Drawing) + (h : H.IsSubdrawing G) : H.IsGM19Drawing := + ⟨fun e he => hG.no_loops e (h.2 he), fun e he => hG.border_or_disjoint e (h.2 he)⟩ + +/-- A connected set off the boundary of a disc is inside it or outside it. -/ +theorem side_const (hT : IsClosedSurface S) {Δ C : Set S} (hΔ : IsClosedDisc Δ) + (hC : IsPreconnected C) (hd : Disjoint C (discBd Δ)) {x y : S} (hx : x ∈ C) (hy : y ∈ C) + (hxΔ : x ∈ Δ) : y ∈ Δ := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + by_contra hyΔ + obtain ⟨w, -, hw1, hw2⟩ := hC _ _ (hΔ.isOpen_discInt hman) hΔ.isClosed.isOpen_compl (fun w hw + => by + by_cases h' : w ∈ Δ + · exact .inl ⟨h', Set.disjoint_left.mp hd hw⟩ + · exact .inr h') ⟨x, hx, hxΔ, Set.disjoint_left.mp hd hx⟩ ⟨y, hy, hyΔ⟩ + exact hw2 hw1.1 + +/-- In a surface that is not a sphere, there is a non-null-homotopic O-arc off the inside of a given +disc. It comes from `exists_reroute`. -/ +theorem exists_curve_off_disc (hT : IsClosedSurface S) {Δ F : Set S} (hΔ : IsClosedDisc Δ) + (hF : IsOArc F) (hnn : ¬ IsNullHomotopicOArc F) : + ∃ C, IsOArc C ∧ ¬ IsNullHomotopicOArc C ∧ Disjoint C (discInt Δ) := by + classical + by_cases hm : (F ∩ Δ).Nonempty + swap + · exact ⟨F, hF, hnn, Set.disjoint_left.mpr fun x hx hxI => hm ⟨x, hx, hxI.1⟩⟩ + have hO := hΔ.isOArc_discBd + have hch : ∀ a b, ∃ P : Set S, a ∈ discBd Δ → b ∈ discBd Δ → P ⊆ discBd Δ ∧ (a ≠ b + → IsLineWithEnds P a b) ∧ (a = b → P = {a}) := fun a b => by + by_cases ha : a ∈ discBd Δ + swap + · exact ⟨∅, fun h => absurd h ha⟩ + by_cases hb : b ∈ discBd Δ + swap + · exact ⟨∅, fun _ h => absurd h hb⟩ + by_cases hab : a = b + · exact ⟨{a}, fun _ _ => ⟨singleton_subset_iff.mpr ha, fun h => absurd hab h, fun _ => rfl⟩⟩ + obtain ⟨A, B, hA, hB, hAB, hi⟩ := hO.lines ha hb hab + exact ⟨A, fun _ _ => ⟨hAB ▸ subset_union_left, fun _ => hA, fun h => absurd h hab⟩⟩ + choose P hP using hch + obtain ⟨C, a, b, hC, hCnn, haF, hbF, -, hCs⟩ := exists_reroute hT hΔ hF hnn hm P fun a ha b hb + => by + obtain ⟨h1, h2, h3⟩ := hP a b ha hb + exact ⟨h1.trans (Surface.discBd_subset Δ), h2, h3⟩ + refine ⟨C, hC, hCnn, Set.disjoint_left.mpr fun x hx hxI => ?_⟩ + rcases hCs hx with h | h + · exact h.2 hxI.1 + · exact hxI.2 ((hP a b haF.2 hbF.2).1 h) + +omit [T2Space S] in +theorem exists_edge_at_vertex {G : Drawing S} (hc : (G.adj.induce G.V).Preconnected) {a b : S} + (ha : a ∈ G.V) (hb : b ∈ G.V) (hab : a ≠ b) : ∃ e ∈ G.E, a ∈ tilde e := by + by_contra hno + have hY := (preconnected_iff_connIn G G.V).mp hc {a} (singleton_subset_iff.mpr ha) ⟨a, rfl⟩ fun x + hx y _ hxy => by + obtain ⟨-, -, -, e, he, h1, -⟩ := hxy + exact absurd ⟨e, he, mem_singleton_iff.mp hx ▸ h1⟩ hno + exact hab (mem_singleton_iff.mp (hY ▸ hb)).symm + +private theorem adjacent_vertices_stay_on_same_disc_side + {S : Type} + [TopologicalSpace S] + [T2Space S] + (hT : IsClosedSurface S) + {G' : Drawing S} + (hl' : LoopFree G') + (F : Set S) + (hedge : ∀ e ∈ Drawing.E G', (e ∩ F).Nonempty → e ⊆ F) + (hFcl : IsClosed F) + (hclF : ∀ e ∈ Drawing.E G', (closure e ∩ F).Nonempty → (e ∩ F).Nonempty ∨ (tilde e ∩ + F).Nonempty) + (Δ : Set S) + (hΔ : IsClosedDisc Δ) + (hΔF : discBd Δ = F) + {x : S} + {y : S} + (hxF : x ∉ F) + (hyF : y ∉ F) + (hxy : G'.adj.Adj x y) + (hxΔ : x ∈ Δ) : + y ∈ Δ := by + obtain ⟨hne, -, -, e, he, h1, h2⟩ := hxy + obtain ⟨p, q, -, hti, hLn⟩ := hl' e he + have hd : Disjoint (closure e) (discBd Δ) := by + rw [hΔF] + refine Set.disjoint_left.mpr fun z hz hzF => ?_ + rcases hclF e he ⟨z, hz, hzF⟩ with h3 | ⟨w, hw, hwF⟩ + · exact hxF (closure_minimal (hedge e he h3) hFcl h1.1) + · rw [hti] at hw h1 h2 + have hcases : w = x ∨ w = y := by + rcases hw with rfl | hw <;> rcases h1 with h1 | h1 <;> rcases h2 with h2 | h2 + · exact absurd (h1.trans h2.symm) hne + · exact .inl h1.symm + · exact .inr h2.symm + · exact absurd ((mem_singleton_iff.mp h1).trans (mem_singleton_iff.mp h2).symm) hne + · exact absurd (h1.trans h2.symm) hne + · exact .inr ((mem_singleton_iff.mp hw).trans (mem_singleton_iff.mp h2).symm) + · exact .inl ((mem_singleton_iff.mp hw).trans (mem_singleton_iff.mp h1).symm) + · exact absurd ((mem_singleton_iff.mp h1).trans (mem_singleton_iff.mp h2).symm) hne + rcases hcases with rfl | rfl + · exact hxF hwF + · exact hyF hwF + exact side_const hT hΔ hLn.isPreconnected_self hd h1.1 h2.1 hxΔ + +private theorem represented_vertex_stays_on_same_disc_side + {S : Type} + [TopologicalSpace S] + {G : Drawing S} + {G' : Drawing S} + {τ : S → Drawing S} + {σe : Set S → Set S} + (hτ : IsEnlargement G G' τ σe) + {v : S} + (F : Set S) + (hbdV : ∀ u ∈ G.V, u ≠ v → ∀ x ∈ (τ u).V, x ∉ F) + (Δ : Set S) + (hsideadj : ∀ {x y : S}, x ∉ F → y ∉ F → G'.adj.Adj x y → x ∈ Δ → y ∈ Δ) : + let W : Set S := {u | (u ∈ G.V ∧ u ≠ v) ∧ ∃ x ∈ (τ u).V, x ∈ Δ} + ∀ (u : S), + (u ∈ W) → + ∀ (x : S), + (x ∈ (τ u).V) → + x ∈ Δ := by + intro W u hu x hx + obtain ⟨⟨huV, huv⟩, x₀, hx₀, hx₀Δ⟩ := hu + have h1 := (preconnected_iff_connIn _ _).mp (hτ.vertex_connected u huV) {z | z ∈ (τ u).V + ∧ z ∈ Δ} (fun z hz => hz.1) ⟨x₀, hx₀, hx₀Δ⟩ fun p hp q hq hpq => + ⟨hq, hsideadj (hbdV u huV huv p hp.1) (hbdV u huV huv q hq) (adj_mono + (hτ.vertex_subdrawing u huV) hpq) hp.2⟩ + have h2 : x ∈ {z | z ∈ (τ u).V ∧ z ∈ Δ} := by rw [h1]; exact hx + exact h2.2 + +private theorem remaining_minor_drawing_lies_inside_disc + {S : Type} + [TopologicalSpace S] + [T2Space S] + (hT : IsClosedSurface S) + {G' : Drawing S} + (hl' : LoopFree G') + (F : Set S) + (hedge : ∀ e ∈ Drawing.E G', (e ∩ F).Nonempty → e ⊆ F) + (hFcl : IsClosed F) + (hclF : ∀ e ∈ Drawing.E G', (closure e ∩ F).Nonempty → (e ∩ F).Nonempty ∨ (tilde e ∩ + F).Nonempty) + (Δ : Set S) + (hΔ : IsClosedDisc Δ) + (hΔF : discBd Δ = F) : + let X : Set S := (discInt Δ)ᶜ + ∀ (x : S), + (x ∈ (delete G' X).U) → + x ∈ discInt Δ := by + intro X x hx + rw [delete_U] at hx + rcases hx with hx | hx + · by_contra hn + exact hx.2 hn + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + obtain ⟨p, q, -, hti, hLn⟩ := hl' e he.1 + have hp : p ∈ tilde e := by rw [hti]; exact .inl rfl + have hq : q ∈ tilde e := by rw [hti]; exact .inr rfl + have hpI : p ∈ discInt Δ := by + by_contra hn + exact Set.disjoint_left.mp he.2 hp hn + have hqI : q ∈ discInt Δ := by + by_contra hn + exact Set.disjoint_left.mp he.2 hq hn + have hd : Disjoint (closure e) (discBd Δ) := by + rw [hΔF] + refine Set.disjoint_left.mpr fun z hz hzF => ?_ + rcases hclF e he.1 ⟨z, hz, hzF⟩ with h3 | ⟨w, hw, hwF⟩ + · exact hpI.2 (hΔF ▸ closure_minimal (hedge e he.1 h3) hFcl hp.1) + · rw [hti] at hw + rcases hw with rfl | hw + · exact hpI.2 (hΔF ▸ hwF) + · rw [mem_singleton_iff.mp hw] at hwF + exact hqI.2 (hΔF ▸ hwF) + exact ⟨side_const hT hΔ hLn.isPreconnected_self hd hp.1 hxe hpI.1, + Set.disjoint_left.mp hd hxe⟩ + +/-- **The third statement of (6.6).** See the module docstring. The hypothesis `hrep` is what (6.5) +gives for a surface that is not a sphere. -/ +theorem region_part (hT : IsClosedSurface S) [ConnectedSpace S] {G G' : Drawing S} + (hG : G.IsGM19Drawing) (hG' : G'.IsGM19Drawing) (hb₁ : G.IsBlock) (hb₂ : G'.IsBlock) {τ : S + → Drawing S} {σe : Set S → Set S} + (hτ : IsEnlargement G G' τ σe) (hcov : branchV G τ = G'.V) (hind : ∀ v ∈ G.V, ∀ e ∈ G'.E, tilde + e ⊆ (τ v).V → e ∈ (τ v).E) + (hrep : ¬ IsSphere S → ∀ v ∈ G.V, ∀ G'' : Drawing S, G''.IsGM19Drawing → ∀ (σv' : S + → Drawing S) (σe' : Set S → Set S), IsEnlargement (delete G {v}) G'' σv' σe' → 1 ≤ G''.rep) + {r : Set S} (hr : r ∈ G'.regions) {v : S} (hv : v ∈ G.V) : ConnIn ((τ v).interSet (closure r)) + ((τ v).interSet (closure r)).V := by + classical + have hNe : Nonempty S := ‹ConnectedSpace S›.toNonempty + have hl := loopFree_of_gm19 hG + have hl' := loopFree_of_gm19 hG' + let D := τ v + let I := D.interSet (closure r) + have hsubD : D.IsSubdrawing G' := hτ.vertex_subdrawing v hv + have hclr : IsClosed (closure r) := isClosed_closure + have hIV : ∀ {x}, x ∈ I.V → x ∈ D.V ∧ x ∈ closure r := fun {x} hx => by + rcases hx with hx | hx + · exact hx.1 + · obtain ⟨e, he, hxe, hxV⟩ := mem_iUnion₂.mp hx + exact ⟨hxV, closure_minimal he.1.2 hclr hxe⟩ + have hIV' : ∀ {x}, x ∈ D.V → x ∈ closure r → x ∈ I.V := fun hx hx' => .inl ⟨⟨hx, hx'⟩, hx⟩ + have hIE : ∀ {e}, e ∈ D.E → e ⊆ closure r → e ∈ I.E := fun {e} he he' => by + change e ∈ (D.span _ _).E + rw [Drawing.span_E] + exact ⟨⟨he, he'⟩, he⟩ + rintro Y hY ⟨a, ha⟩ hc + refine Subset.antisymm hY fun b hb => ?_ + by_cases hab : a = b + · exact hab ▸ ha + obtain ⟨haD, har⟩ := hIV (hY ha) + obtain ⟨hbD, hbr⟩ := hIV hb + have haV := hsubD.1 haD + have hbV := hsubD.1 hbD + obtain ⟨Vq, Eq, hVq, hEq, haq, hbq, htq, hQ⟩ := exists_line_of_connected D (fun e he => hl' e + (hsubD.2 he)) (Subset.refl _) (hτ.vertex_connected v hv) haD hbD hab + obtain ⟨L, hLine, hLr⟩ := exists_line_in_region hT G' hr haV hbV hab + (exists_edge_at_vertex hb₂.connected haV hbV hab) (exists_edge_at_vertex hb₂.connected hbV haV + (Ne.symm hab)) har hbr + have hlc : LocallyConnectedSpace S := IsClosedSurface.locallyConnectedSpace hT + obtain ⟨hro, -, -, hrU, -, -⟩ := region_props G' hr + have hrU' : ∀ {y}, y ∈ r → y ∉ G'.U := fun hy hyU => Set.disjoint_left.mp hrU hy hyU + have hEqG : Eq ⊆ G'.E := hEq.trans hsubD.2 + have hVqV : Vq ⊆ G'.V := hVq.trans hsubD.1 + have hUqU : Vq ∪ ⋃₀ Eq ⊆ G'.U := union_subset (hVqV.trans G'.V_subset_U) (sUnion_subset fun e he + => subset_closure.trans (G'.closure_subset_U (hEqG he))) + have hLab : ∀ {x}, x ∈ L → x ∉ r → x = a ∨ x = b := fun {x} hx hxr => by + by_contra hn + exact hxr (hLr ⟨hx, hn⟩) + have hi : (Vq ∪ ⋃₀ Eq) ∩ L = {a, b} := by + apply Subset.antisymm + · rintro x ⟨hx, hxL⟩ + exact hLab hxL fun h => hrU' h (hUqU hx) + · rintro x (rfl | hx) + · exact ⟨.inl haq, hLine.left_mem⟩ + · rw [mem_singleton_iff.mp hx] + exact ⟨.inl hbq, hLine.right_mem⟩ + let F : Set S := (Vq ∪ ⋃₀ Eq) ∪ L + have hFO : IsOArc F := oArc_of_lines hQ hLine hi + have hFV : ∀ x ∈ F, x ∈ G'.V → x ∈ Vq := fun x hx hxV => by + rcases hx with (hx | ⟨f, hf, hxf⟩) | hx + · exact hx + · exact absurd hxV ((hEqG hf).2.1 hxf).2 + · by_cases hxr : x ∈ r + · exact absurd (G'.V_subset_U hxV) (hrU' hxr) + · rcases hLab hx hxr with rfl | rfl + · exact haq + · exact hbq + have hedge : ∀ e ∈ G'.E, (e ∩ F).Nonempty → e ⊆ F := fun e he ⟨x, hxe, hxF⟩ => by + have hxV : x ∉ G'.V := (he.2.1 hxe).2 + have hxU : x ∈ G'.U := G'.closure_subset_U he (subset_closure hxe) + rcases hxF with (hx | ⟨f, hf, hxf⟩) | hx + · exact absurd (hVqV hx) hxV + · have := arcComp_eq_of_mem he (hEqG hf) hxe hxf + subst this + exact fun y hy => .inl (.inr ⟨e, hf, hy⟩) + · by_cases hxr : x ∈ r + · exact absurd hxU (hrU' hxr) + · rcases hLab hx hxr with rfl | rfl + · exact absurd haV hxV + · exact absurd hbV hxV + have hFcl : IsClosed F := hFO.isCompact.isClosed + have hclF : ∀ e ∈ G'.E, (closure e ∩ F).Nonempty → (e ∩ F).Nonempty ∨ (tilde e ∩ F).Nonempty + := fun e he ⟨x, hx, hxF⟩ => by + by_cases hxe : x ∈ e + · exact .inl ⟨x, hxe, hxF⟩ + · exact .inr ⟨x, ⟨hx, hxe⟩, hxF⟩ + have hdisjV : ∀ u ∈ G.V, u ≠ v → Disjoint (τ u).V Vq := fun u hu huv => + (hτ.vertex_disjoint u hu v hv huv).mono_right hVq + have hbdV : ∀ u ∈ G.V, u ≠ v → ∀ x ∈ (τ u).V, x ∉ F := fun u hu huv x hx hxF => + Set.disjoint_left.mp (hdisjV u hu huv) hx (hFV x hxF ((hτ.vertex_subdrawing u hu).1 hx)) + /- `F` bounds a disc. -/ + obtain ⟨Δ, hΔ, hΔF, hsph'⟩ : ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = F ∧ (IsSphere S + → ∃ Δ', IsClosedDisc Δ' ∧ discBd Δ' = F ∧ Δ ∩ Δ' ⊆ F) := by + by_cases hsph : IsSphere S + · obtain ⟨Δ₁, Δ₂, -, h₁, h₂, hb₁', hb₂', -, hcap, -, -⟩ := sphere_disc S hsph F hFO + exact ⟨Δ₁, h₁, hb₁', fun _ => ⟨Δ₂, h₂, hb₂', hcap.subset⟩⟩ + · have hbd : bd S = ∅ := eq_empty_iff_forall_notMem.mpr fun x hx => hx (hT.2.2 x) + have hpos := hrep hsph v hv (delete G' Vq) (hG'.sub (delete_subdrawing G' Vq)) τ σe + (hτ.delete hl hl' hdisjV) + have hnull : IsNullHomotopicOArc F := by + by_contra hnn + have hdis : ∀ x ∈ F, x ∉ (delete G' Vq).U := fun x hxF hxU => by + rw [delete_U] at hxU + rcases hxU with hx | hx + · exact hx.2 (hFV x hxF hx.1) + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + by_cases hxV : x ∈ G'.V + · exact Set.disjoint_left.mp he.2 (GM19.tilde_eq_inter_V G' he.1 ▸ ⟨hxe, + hxV⟩) (hFV x hxF hxV) + · have hxe' : x ∈ e := G'.closure_diff_V he.1 ▸ ⟨hxe, hxV⟩ + have hsub := hedge e he.1 ⟨x, hxe', hxF⟩ + obtain ⟨p, q, -, hti, -⟩ := hl' e he.1 + have hp : p ∈ tilde e := by rw [hti]; exact .inl rfl + have hpF : p ∈ F := closure_minimal hsub hFcl hp.1 + exact Set.disjoint_left.mp he.2 hp (hFV p hpF (tilde_subset_V G' he.1 hp)) + have h0 := rep_le_of_arc (delete G' Vq) hFO (fun x hx => absurd hx.2 (hdis x hx.1)) hnn + have h1 : F ∩ (delete G' Vq).V = ∅ := eq_empty_iff_forall_notMem.mpr fun x hx + => hdis x hx.1 ((delete G' Vq).V_subset_U hx.2) + rw [h1, ncard_empty] at h0 + exact absurd (hpos.trans h0) (by simp) + obtain ⟨Δ, -, h1, h2⟩ := + (epstein S univ F hT.isSurface ‹_› hFO (subset_univ _) (by simp [hbd])).1 hnull + exact ⟨Δ, h1, h2, fun h => absurd h hsph⟩ + /- Claim (1). -/ + have hone : ∀ Δ₀, IsClosedDisc Δ₀ → discBd Δ₀ = F → (∀ x ∈ G'.V, x ∈ Δ₀ → x ∈ D.V) → b ∈ Y + := fun Δ₀ h₀ hF₀ hin => by + refine mem_of_closed_adj hT G' hl' hr h₀ hab hLine hLr (hF₀ ▸ subset_union_right) + (hF₀ ▸ union_subset_union_left _ hUqU) (fun e he hn => ?_) haV hbV ha fun e he hsub x hx y hy + hxY => ?_ + · rw [hF₀] at hn ⊢ + exact hedge e he hn + · have hcl : closure e ⊆ closure r ∩ Δ₀ := closure_minimal hsub (hclr.inter h₀.isClosed) + have hend : tilde e ⊆ D.V := fun z hz => hin z (tilde_subset_V G' he hz) (hcl hz.1).2 + have heD : e ∈ D.E := hind v hv e he hend + have hyI : y ∈ I.V := hIV' (hend hy) (hcl hy.1).1 + by_cases hxy : x = y + · exact hxy ▸ hxY + · exact hc x hxY y hyI ⟨hxy, hY hxY, hyI, e, hIE heD fun z hz => (hsub hz).1, hx, hy⟩ + have hsideadj : ∀ {x y}, x ∉ F → y ∉ F → G'.adj.Adj x y → x ∈ Δ → y ∈ Δ + := fun {x y} hxF hyF hxy hxΔ => by + exact adjacent_vertices_stay_on_same_disc_side (S := S) hT (G' := G') hl' F hedge hFcl hclF Δ + hΔ hΔF (x := x) (y := y) hxF hyF hxy hxΔ + /- The sides of the branch sets. -/ + let W : Set S := {u | (u ∈ G.V ∧ u ≠ v) ∧ ∃ x ∈ (τ u).V, x ∈ Δ} + have hWall : ∀ u ∈ W, ∀ x ∈ (τ u).V, x ∈ Δ := fun u hu x hx => by + exact represented_vertex_stays_on_same_disc_side (S := S) (G := G) (G' := G') (τ := τ) (σe := + σe) hτ (v := v) F hbdV Δ hsideadj u hu x hx + have hcov' : ∀ x ∈ G'.V, ∃ u ∈ G.V, x ∈ (τ u).V := fun x hx => by + rw [← hcov] at hx + obtain ⟨u, hu, hxu⟩ := mem_iUnion₂.mp hx + exact ⟨u, hu, hxu⟩ + by_cases hWn : W.Nonempty + swap + · refine hone Δ hΔ hΔF fun x hx hxΔ => ?_ + obtain ⟨u, hu, hxu⟩ := hcov' x hx + by_cases huv : u = v + · change x ∈ (τ v).V + rw [← huv] + exact hxu + · exact absurd ⟨u, ⟨hu, huv⟩, x, hxu, hxΔ⟩ hWn + have hWeq : W = G.V \ {v} := (preconnected_iff_connIn G _).mp (hb₁.biconnected v hv) W (fun u hu + => ⟨hu.1.1, hu.1.2⟩) hWn fun u hu u' hu' huu' => by + obtain ⟨hne, -, -, e, he, h1, h2⟩ := huu' + obtain ⟨y, hy, hyt⟩ := (hτ.ends_iff e he u hu.1.1).mpr h1 + obtain ⟨y', hy', hyt'⟩ := (hτ.ends_iff e he u' hu'.1).mpr h2 + have hyy : y ≠ y' := fun h => Set.disjoint_left.mp (hτ.vertex_disjoint u hu.1.1 u' hu'.1 hne) + hy (h ▸ hy') + have hyΔ := hWall u hu y hy + have hadj : G'.adj.Adj y y' := ⟨hyy, (hτ.vertex_subdrawing u hu.1.1).1 hy, + (hτ.vertex_subdrawing u' hu'.1).1 hy', _, hτ.edge_mem e he, hyt, hyt'⟩ + exact ⟨⟨hu'.1, hu'.2⟩, y', hy', hsideadj (hbdV u hu.1.1 hu.1.2 y hy) + (hbdV u' hu'.1 hu'.2 y' hy') hadj hyΔ⟩ + have hinall : ∀ u ∈ G.V, u ≠ v → ∀ x ∈ (τ u).V, x ∈ Δ := fun u hu huv x hx => hWall u + (hWeq ▸ ⟨hu, huv⟩) x hx + by_cases hsph : IsSphere S + · obtain ⟨Δ', hΔ', hF', hcap⟩ := hsph' hsph + refine hone Δ' hΔ' hF' fun x hx hxΔ => ?_ + obtain ⟨u, hu, hxu⟩ := hcov' x hx + by_cases huv : u = v + · change x ∈ (τ v).V + rw [← huv] + exact hxu + · exact hVq (hFV x (hcap ⟨hinall u hu huv x hxu, hxΔ⟩) hx) + /- Inside `Δ`: impossible when the surface is not a sphere. -/ + exfalso + have hbd : bd S = ∅ := eq_empty_iff_forall_notMem.mpr fun x hx => hx (hT.2.2 x) + obtain ⟨C₀, hC₀, hC₀n⟩ := exists_not_nullHomotopic hT.isSurface hbd hsph + obtain ⟨C, hC, hCn, hCd⟩ := exists_curve_off_disc hT hΔ hC₀ hC₀n + let X : Set S := (discInt Δ)ᶜ + have hint : ∀ u ∈ G.V, u ≠ v → Disjoint (τ u).V X := fun u hu huv => Set.disjoint_left.mpr fun x + hx hxX => hxX ⟨hinall u hu huv x hx, by + rw [hΔF] + exact hbdV u hu huv x hx⟩ + have hpos := hrep hsph v hv (delete G' X) (hG'.sub (delete_subdrawing G' X)) τ σe + (hτ.delete hl hl' hint) + have hUI : (delete G' X).U ⊆ discInt Δ := fun x hx => by + exact remaining_minor_drawing_lies_inside_disc (S := S) hT (G' := G') hl' F hedge hFcl hclF Δ + hΔ hΔF x hx + have hdC : ∀ x ∈ C, x ∉ (delete G' X).U := fun x hx hxU => Set.disjoint_left.mp hCd hx (hUI hxU) + have h0 := rep_le_of_arc (delete G' X) hC (fun x hx => absurd hx.2 (hdC x hx.1)) hCn + have h1 : C ∩ (delete G' X).V = ∅ := eq_empty_iff_forall_notMem.mpr fun x hx => hdC x hx.1 + ((delete G' X).V_subset_U hx.2) + rw [h1, ncard_empty] at h0 + exact absurd (hpos.trans h0) (by simp) + +end + +/-- **(6.6) of Graph Minors XIX, page 341.** The set `σ'(v) ∩ rBar` is the subdrawing `(σ' +v).interSet (closure r)`. -/ +def Theorem66Statement : Prop := + ∀ (S : Type) [TopologicalSpace S] [T2Space S], IsSurface S → ConnectedSpace S → bd S = ∅ → + ∃ k : ℕ, ∀ G G' : Drawing S, G.IsGM19Drawing → G'.IsGM19Drawing → G.IsBlock → G'.IsBlock → + (k : ℕ∞) < G.rep → + ∀ (σv : S → Drawing S) (σe : Set S → Set S), IsEnlargement G G' σv σe → + ∃ σv' : S → Drawing S, IsEnlargement G G' σv' σe ∧ (∀ v ∈ G.V, (σv v).IsSubdrawing (σv' v)) + ∧ + (⋃ v ∈ G.V, (σv' v).V) = G'.V ∧ (∀ v ∈ G.V, ∀ e ∈ G'.E, tilde e ⊆ (σv' v).V → e ∈ + (σv' v).E) ∧ + ∀ r ∈ G'.regions, ∀ v ∈ G.V, ((GM19.Drawing.adj ((σv' v).interSet (closure r))).induce + ((σv' v).interSet (closure r)).V).Preconnected + +/-- **(6.6) of Graph Minors XIX** follows from (6.5). -/ +theorem theorem_6_6_proof : Theorem66Statement := by + intro S _ _ hS hconn hb + have hT : IsClosedSurface S := ⟨hS.1, hS.2.1, fun x => by + by_contra hx + have : x ∈ bd S := hx + rw [hb] at this + exact this⟩ + obtain ⟨k, hk⟩ : ∃ k : ℕ, ¬ IsSphere S → ∀ G : Drawing S, G.IsGM19Drawing → (k : ℕ∞) ≤ G.rep + → ∀ G' : Drawing S, G'.IsGM19Drawing → + ∀ (σv : S → Drawing S) (σe : Set S → Set S), IsEnlargement G G' σv σe → 1 ≤ G'.rep := by + by_cases hsph : IsSphere S + · exact ⟨0, fun h => absurd hsph h⟩ + · obtain ⟨k, hk⟩ := GraphMinor.GM19.theorem_6_5_proof S hS hconn hb hsph + exact ⟨k, fun _ => hk⟩ + refine ⟨k, fun G G' hG hG' hb₁ hb₂ hrep σv σe hσ => ?_⟩ + obtain ⟨τ, h1, h2, h3, h4⟩ := exists_full_enlargement (loopFree_of_gm19 hG) + (loopFree_of_gm19 hG') ((preconnected_iff_connIn G' G'.V).mp hb₂.connected) hb₁.nonempty_V hσ + refine ⟨τ, h1, h2, h3, h4, fun r hr v hv => (preconnected_iff_connIn _ _).mpr ?_⟩ + exact region_part hT hG hG' hb₁ hb₂ h1 h3 h4 (fun hsph u hu G'' hG'' σ₁ σ₂ hσ₁ => + hk hsph _ (hG.sub (delete_subdrawing G {u})) (lt_rep_delete hT G (loopFree_of_gm19 hG) hu hrep) + G'' hG'' σ₁ σ₂ hσ₁) hr hv + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Tau.lean b/LeanPool/GraphMinor/GM19/Section6Tau.lean new file mode 100644 index 0000000000..6a73afa18f --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Tau.lean @@ -0,0 +1,160 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Seven +public import LeanPool.GraphMinor.Surface.CutLoop + +/-! +# Graph Minors XIX, proof of (6.2): the enlargement `τ` + +An inflation `σ` of `Γ₁` in `Γ₂` gives an enlargement `τ` of `sk(Γ₁)` in `sk(Γ₂)`, in `Σ̂`, as in +the +proof of (6.2), page 342. If `e` is an edge of `Γ₁` of size 2 then `τ(e) = σ(e)`. If `e` is a part +of the +boundary of the disc of an edge `c` of size 3, with ends `u, v`, then `τ(e)` is the part of the +boundary of the disc of `σ(c)` with ends in `σ(u), σ(v)`. For a vertex `v`, `τ(v)` is the subdrawing +of +`sk(Γ₂)` induced on `σ(v)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + +/-- A set of vertices connected in a graph is closed under nothing smaller. -/ +theorem preconnected_closed {α : Type} {G : SimpleGraph α} {X : Set α} (h : + (G.induce X).Preconnected) + {Y : Set α} (hY : Y ⊆ X) (hne : Y.Nonempty) (hc : ∀ a ∈ Y, ∀ b ∈ X, G.Adj a b → b ∈ Y) : Y = X + := by + obtain ⟨a, ha⟩ := hne + refine Subset.antisymm hY fun b hb => ?_ + obtain ⟨p⟩ := h ⟨a, hY ha⟩ ⟨b, hb⟩ + have key : ∀ {x y : X}, (G.induce X).Walk x y → x.1 ∈ Y → y.1 ∈ Y := by + intro x y p + induction p with + | nil => exact id + | cons hadj _ ih => exact fun hx => ih (hc _ hx _ (Subtype.property _) hadj) + exact key p ha + +section Ends + +variable {Γ Γ' : Painting S} {σv : S → Set S} {σe : Set S → Set S} + + +omit [T2Space S] in +/-- The ends of `σ(e)` are matched with the ends of `e`. -/ +theorem infl_ends (h : IsInflation Γ Γ' σv σe) {e : Set S} (he : e ∈ Γ.E) : + (∀ a ∈ tilde (σe e), ∃ y ∈ tilde e, a ∈ σv y) ∧ (∀ y ∈ tilde e, ∃ a ∈ tilde (σe e), a ∈ σv y) + := by + have hE' := h.edge_mem e he + have hlen : (Γ.γ e).length = (Γ'.γ (σe e)).length := by + rw [Γ.length_γ he, Γ'.length_γ hE', h.edge_size e he] + have hs₁ : ∀ y, y ∈ Γ.γ e ↔ y ∈ tilde e := fun y => by + rw [← Γ.γ_set e he] + rfl + have hs₂ : ∀ y, y ∈ Γ'.γ (σe e) ↔ y ∈ tilde (σe e) := fun y => by + rw [← Γ'.γ_set _ hE'] + rfl + constructor + · intro a ha + obtain ⟨i, hi, rfl⟩ := List.mem_iff_getElem.mp ((hs₂ a).mpr ha) + have hi' : i < (Γ.γ e).length := hlen ▸ hi + exact ⟨_, (hs₁ _).mp (List.getElem_mem hi'), h.ends e he i hi' hi⟩ + · intro y hy + obtain ⟨i, hi, rfl⟩ := List.mem_iff_getElem.mp ((hs₁ y).mpr hy) + have hi' : i < (Γ'.γ (σe e)).length := hlen ▸ hi + exact ⟨_, (hs₂ _).mp (List.getElem_mem hi'), h.ends e he i hi hi'⟩ + +end Ends + +section Boundary + +variable (Γ : Painting S) + +/-- **The parts of the boundary of the disc of an edge of size 3.** Two of the three ends are the +ends of +an edge of `sk(Γ)` in the boundary. -/ +theorem exists_sk_boundary {c₀ : Set S} (hc₀ : c₀ ∈ Γ.E) (h3c : (tilde c₀).ncard = 3) {u₀ v₀ : S} + (hut : u₀ ∈ tilde c₀) (hvt : v₀ ∈ tilde c₀) (huv₀ : u₀ ≠ v₀) : + ∃ f ∈ arcComponentsIn (Γ.skU \ Γ.V), f ⊆ discBd (closure c₀) ∧ f ⊆ c₀ ∧ tilde f = {u₀, v₀} := by + obtain ⟨f, hf, hB, hc, ht, -⟩ := exists_sk_boundary_with_point Γ hc₀ h3c hut hvt huv₀ + exact ⟨f, hf, hB, hc, ht⟩ + +/-- Two edges of `sk(Γ)` in the boundary of the disc of an edge of size 3, with the same ends, are +equal, +since otherwise they would form all of the boundary, which holds a third vertex. -/ +theorem sk_boundary_unique {c₀ f f' : Set S} (hc₀ : c₀ ∈ Γ.E) (h3c : (tilde c₀).ncard = 3) + (hf : f ∈ arcComponentsIn (Γ.skU \ Γ.V)) (hf' : f' ∈ arcComponentsIn (Γ.skU \ Γ.V)) + (hB : f ⊆ discBd (closure c₀)) (hB' : f' ⊆ discBd (closure c₀)) (ht : tilde f = tilde f') : + f = f' := by + classical + by_contra hne + obtain ⟨hdisc, hT', -⟩ := Γ.isDisc_of_three hc₀ h3c + obtain ⟨u, v, huv, htu, htV, hL⟩ := Γ.sk_line hf + obtain ⟨u', v', huv', htu', -, hL'⟩ := Γ.sk_line hf' + have hL₂ : IsLineWithEnds (closure f') u v := by + have hset : ({u', v'} : Set S) = {u, v} := by rw [← htu', ← ht, htu] + have hu : u ∈ ({u', v'} : Set S) := hset ▸ .inl rfl + have hv : v ∈ ({u', v'} : Set S) := hset ▸ .inr rfl + rcases hu with rfl | hu + · rcases hv with rfl | hv + · exact absurd rfl huv + · rw [mem_singleton_iff.mp hv] + exact hL' + · have hu' : u = v' := hu + subst hu' + rcases hv with rfl | hv + · exact GraphMinor.GM11.IsLineWithEnds.symm hL' + · exact absurd (mem_singleton_iff.mp hv).symm huv + have hcap : closure f ∩ closure f' ⊆ {u, v} := by + rintro x ⟨hx, hx'⟩ + by_cases hxf : x ∈ f + · by_cases hxf' : x ∈ f' + · exact absurd (arcComp_eq_of_mem hf hf' hxf hxf') hne + · have hxt : x ∈ tilde f' := ⟨hx', hxf'⟩ + rw [← ht] at hxt + rw [← htu] + exact hxt + · rw [← htu] + exact ⟨hx, hxf⟩ + have hO := isOArc_union hL hL₂ hcap + have hBc : IsClosed (discBd (closure c₀)) := (isCompact_of_isOArc hdisc.isOArc_discBd).isClosed + obtain ⟨φ⟩ := id hdisc.isOArc_discBd + have heq := oarc_eq φ hO (union_subset (closure_minimal hB hBc) (closure_minimal hB' hBc)) + obtain ⟨w₀, hw₀, hwu, hwv⟩ : ∃ w₀ ∈ tilde c₀, w₀ ≠ u ∧ w₀ ≠ v := by + by_contra hn + push Not at hn + have hsub : tilde c₀ ⊆ {u, v} := fun x hx => by + by_cases hxu : x = u + · exact .inl hxu + · exact .inr (hn x hx hxu) + have := ncard_le_ncard hsub (toFinite _) + have h2 := ncard_pair huv + omega + have hwV : w₀ ∈ Γ.V := Γ.tilde_subset_V hc₀ hw₀ + have hwt : ∀ {g}, g ∈ arcComponentsIn (Γ.skU \ Γ.V) → tilde g = {u, v} → w₀ ∉ closure g := by + intro g hg htg hw + have : w₀ ∈ tilde g := ⟨hw, fun h => (hg.2.1 h).2 hwV⟩ + rw [htg] at this + rcases this with h | h + · exact hwu h + · exact hwv h + have hwF : w₀ ∈ closure f ∪ closure f' := heq ▸ hT' hw₀ + rcases hwF with h | h + · exact hwt hf htu h + · exact hwt hf' (ht ▸ htu) h + +end Boundary + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Tri.lean b/LeanPool/GraphMinor/GM19/Section6Tri.lean new file mode 100644 index 0000000000..58426fd98a --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Tri.lean @@ -0,0 +1,200 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Bound + +/-! +# A triangulation as a drawing + +A graph in a surface gives a drawing (`IsGraph.toDrawing`). A triangulation of a connected closed +surface `S`, drawn this way, has no loops, no parallel edges, and no vertex that cuts it, and its +number of edges is `3 |V| - 6 + 3 κ`, where `2 ^ κ` is the number of classes of local cocycles of +`S` (`exists_triang_drawing`). This is the drawing `H` in the proof of Graph Minors XIX, (6.5) (page +341). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +local notation "K" => ZMod 2 + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +theorem isPathConnected_edge {L : Set S} {u v : S} (h : IsLineWithEnds L u v) : + IsPathConnected (L \ {u, v}) := + h.isPathConnected_interior + +namespace IsGraphD + +variable {V : Set S} {E : Set (Set S)} + +omit [T2Space S] in +theorem inner_nonempty (h : IsGraph V E) {e : Set S} (he : e ∈ E) : (e \ V).Nonempty := by + obtain ⟨u, v, huv, hl, hi⟩ := h.edge e he + have h2 := hl.subset_closure_diff + have hne : (e \ {u, v}).Nonempty := by + by_contra hc + rw [not_nonempty_iff_eq_empty] at hc + rw [hc, closure_empty] at h2 + obtain ⟨f, h0, -⟩ := id hl + exact h2 (h0 ▸ (f 0).2) + obtain ⟨x, hx, hxn⟩ := hne + exact ⟨x, hx, fun hxV => hxn (hi ▸ ⟨hx, hxV⟩)⟩ + +omit [T2Space S] in +theorem diff_eq (_h : IsGraph V E) {e : Set S} {u v : S} (hi : e ∩ V = {u, v}) : e \ V = e \ {u, v} + := by + ext x + constructor + · exact fun hx => ⟨hx.1, fun h' => hx.2 ((hi ▸ h' : x ∈ e ∩ V).2)⟩ + · exact fun hx => ⟨hx.1, fun h' => hx.2 (hi ▸ ⟨hx.1, h'⟩)⟩ + +theorem closure_diff (h : IsGraph V E) {e : Set S} (he : e ∈ E) : closure (e \ V) = e := by + obtain ⟨u, v, huv, hl, hi⟩ := h.edge e he + rw [diff_eq h hi] + exact Subset.antisymm (closure_minimal sdiff_subset hl.isCompact.isClosed) hl.subset_closure_diff + +theorem arcComponents_eq (h : IsGraph V E) : arcComponentsIn (gr V E \ V) = (fun e => e \ V) '' E + := by + have hmem : ∀ e ∈ E, e \ V ∈ arcComponentsIn (gr V E \ V) := fun e he => by + obtain ⟨u, v, _, hl, hi⟩ := h.edge e he + have hne := inner_nonempty h + he + have hs : e \ V ⊆ gr V E \ V := fun x hx => ⟨.inr ⟨e, he, hx.1⟩, hx.2⟩ + refine ⟨hne, hs, ?_, fun D hD hc hsub => ?_⟩ + · rw [diff_eq h hi] + exact isPathConnected_edge hl + have hclosed : ∀ f ∈ E, IsClosed f := fun f hf => by + obtain ⟨p, q, -, hl', -⟩ := h.edge f hf + exact hl'.isCompact.isClosed + have hO : IsClosed (⋃₀ (E \ {e})) := (h.fine.subset sdiff_subset).isClosed_sUnion fun f hf + => hclosed f hf.1 + have hcov : D ⊆ e ∪ ⋃₀ (E \ {e}) := fun y hy => by + obtain ⟨hyG, hyV⟩ := hD hy + rcases hyG with hy' | ⟨f, hf, hyf⟩ + · exact absurd hy' hyV + · by_cases hfe : f = e + · exact .inl (hfe ▸ hyf) + · exact .inr ⟨f, ⟨hf, hfe⟩, hyf⟩ + refine Subset.antisymm (fun y hy => ?_) hsub + have hyV := (hD hy).2 + rcases hcov hy with hye | ⟨f, hf, hyf⟩ + · exact ⟨hye, hyV⟩ + · exfalso + obtain ⟨x, hx⟩ := + hne + obtain ⟨z, hzD, hze, g, hg, hzg⟩ := + isPreconnected_closed_iff.mp hc.isConnected.isPreconnected _ _ (hclosed e he) hO hcov + ⟨x, hsub hx, hx.1⟩ ⟨y, hy, f, hf, hyf⟩ + exact (hD hzD).2 (h.disj e he g hg.1 (Ne.symm hg.2) ⟨hze, hzg⟩) + refine Subset.antisymm (fun c hc => ?_) ?_ + · obtain ⟨x, hx⟩ := hc.1 + obtain ⟨hxG, hxV⟩ := hc.2.1 hx + rcases hxG with hx' | ⟨e, he, hxe⟩ + · exact absurd hx' hxV + · exact ⟨e, he, arcComp_eq_of_mem (hmem e he) hc ⟨hxe, hxV⟩ hx⟩ + · rintro _ ⟨e, he, rfl⟩ + exact hmem e he + +end IsGraphD + +open IsGraphD in +/-- The drawing of a graph. -/ +def _root_.GraphMinor.Surface.IsGraph.toDrawing {V : Set S} {E : Set (Set S)} + (h : IsGraph V E) : Drawing S where + U := gr V E + V := V + V_subset_U := subset_union_left + isClosed_U := h.isClosed_gr + finite_V := h.fin + finite_edges := by + rw [arcComponents_eq h] + exact h.fine.image _ + edge_cond := fun c hc => by + rw [arcComponents_eq h] at hc + obtain ⟨e, he, rfl⟩ := hc + obtain ⟨u, v, huv, hl, hi⟩ := h.edge e he + refine .inl ⟨u, v, huv, ?_, ?_⟩ + · simp only [closure_diff h he, hi] + · simp only [closure_diff h he, hl] + +open IsGraphD in +/-- **A triangulation as a drawing.** See the module docstring. -/ +theorem exists_triang_drawing {S : Type} [TopologicalSpace S] [T2Space S] + (hT : IsClosedSurface S) [ConnectedSpace S] : + ∃ H : Drawing S, LoopFree H ∧ (∀ e ∈ H.E, ∀ f ∈ H.E, tilde e = tilde f → e = f) ∧ 3 ≤ H.V.ncard + ∧ 3 ≤ H.E.ncard ∧ (∀ v ∈ H.V, ConnIn H (H.V \ {v})) ∧ + ∃ κ : ℕ, Nat.card (KCl S K) = 2 ^ κ ∧ (H.E.ncard : ℤ) = 3 * H.V.ncard - 6 + 3 * κ := by + classical + obtain ⟨V₁, E₁, 𝓕₁, hdis⟩ := exists_surface_dissection hT.isSurface + have hne : Nonempty S := ‹ConnectedSpace S›.toNonempty + obtain ⟨V, E, 𝓕, h, -, -, -⟩ := hdis.exists_triang + have hg : IsGraph V E := h.dis.graph + have hE : (hg.toDrawing).E = (fun e => e \ V) '' E := arcComponents_eq hg + have ht : ∀ e ∈ E, tilde (e \ V) = e ∩ V := fun e he => by + change closure (e \ V) \ (e \ V) = e ∩ V + rw [closure_diff hg he] + ext x + simp only [mem_sdiff, mem_inter_iff, not_and, not_not] + exact ⟨fun h' => ⟨h'.1, h'.2 h'.1⟩, fun h' => ⟨h'.1, fun _ => h'.2⟩⟩ + have hinj : InjOn (fun e => e \ V) E := fun e he f hf hef => by + have h1 : closure (e \ V) = closure (f \ V) := congrArg closure hef + rwa [closure_diff hg he, closure_diff hg hf] at h1 + have hEn : (hg.toDrawing).E.ncard = E.ncard := by + rw [hE, hinj.ncard_image] + have := h.dis.graph.fin.fintype + have := h.dis.graph.fine.fintype + have := h.dis.fin.fintype + obtain ⟨κ, h1, h2⟩ := h.euler_ncard hT + have h3 := (h.cx hT).three_faces + rw [← Nat.card_eq_fintype_card, ← Nat.card_eq_fintype_card, Nat.card_coe_set_eq, + Nat.card_coe_set_eq] at h3 + obtain ⟨Φ, hΦ⟩ := h.nonempty_faces + have hFpos : 0 < 𝓕.ncard := (ncard_pos h.dis.fin).mpr ⟨Φ, hΦ⟩ + have hV3 : 3 ≤ V.ncard := by + have h4 := h.three Φ hΦ + have h5 := ncard_le_ncard (inter_subset_right : Φ ∩ V ⊆ V) h.dis.graph.fin + omega + refine ⟨hg.toDrawing, ?_, ?_, hV3, ?_, ?_, κ, h1, ?_⟩ + · intro c hc + rw [hE] at hc + obtain ⟨e, he, rfl⟩ := hc + obtain ⟨u, v, huv, hl, hi⟩ := hg.edge e he + exact ⟨u, v, huv, by rw [ht e he, hi], by rwa [closure_diff hg he]⟩ + · intro c hc d hd hcd + rw [hE] at hc hd + obtain ⟨e, he, rfl⟩ := hc + obtain ⟨f, hf, rfl⟩ := hd + rw [ht e he, ht f hf] at hcd + rw [h.simple e he f hf hcd] + · rw [hEn] + omega + · intro v hv Y hY hYne hYc + have hv' : v ∈ V := hv + have hsub := h.conn_minus hT hv' (S := Y) (fun e he a ha b hb haw hbw haY => by + by_cases hab : a = b + · exact hab ▸ haY + · refine hYc a haY b ⟨hb.2, hbw⟩ ⟨hab, ha.2, hb.2, e \ V, hE ▸ mem_image_of_mem _ he, ?_, ?_⟩ + · rw [ht e he] + exact ha + · rw [ht e he] + exact hb) (by + obtain ⟨y, hy⟩ := hYne + exact ⟨y, hy, hY hy⟩) + exact Subset.antisymm hY hsub + · rw [hEn] + change (E.ncard : ℤ) = 3 * V.ncard - 6 + 3 * κ + omega + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Two.lean b/LeanPool/GraphMinor/GM19/Section6Two.lean new file mode 100644 index 0000000000..40e460c00a --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Two.lean @@ -0,0 +1,398 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Cover +public import LeanPool.GraphMinor.GM19.Section6Six + +import LeanPool.GraphMinor.GM19.Section6aProved +import LeanPool.GraphMinor.GM19.UniverseLift2 + +/-! +# Theorem (6.2) of Graph Minors XIX + +We follow the proof on pages 342-343. From an inflation `σ` we build the enlargement `τ` of `sk(Γ₁)` +in +`sk(Γ₂)` (`exists_enlargement`), and (6.7) says that these are blocks with the same representativity +as +the paintings. Then (6.6) gives a larger enlargement `τ'`, which meets each region in a connected +part. +This gives a larger inflation `σ'`. For each cuff, `τ'(v)` meets the cuff in a connected part, and +this +gives the cover of the cuff (`cuff_cover`) that makes `σ'` linear. The direction condition is not +spelled +out in the paper. It follows from the directions of the sides of the frame +(`precedes_of_dirAgrees`), +since `e` and `σ(e)` lie in one side. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe u + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {D : Drawing Shat} + +omit [T2Space Shat] in +omit [T2Space S] in +/-- The pasted disc of a cuff is a region of `sk(Γ)` in `Σ̂`. -/ +theorem cuffDisc_mem_regions (hD : IsSkHat cap Γ D) {Θ : Set S} + (hΘ : Θ ∈ cuffs S) : + cap.cuffDisc Θ ∈ D.regions := by + have hnotR : ∀ {Θ' : Set S} {x : Shat}, Θ' ∈ cuffs S → x ∈ cap.cuffDisc Θ' → x ∉ range cap.emb + := by + intro Θ' x hΘ' hx + have : x ∈ (range cap.emb)ᶜ := by + rw [cap.compl_eq] + exact mem_iUnion₂.2 ⟨Θ', hΘ', hx⟩ + exact this + obtain ⟨x, hx⟩ : (cap.cuffDisc Θ).Nonempty := by + obtain ⟨z, hz, hz'⟩ := id hΘ + have hzΘ : z ∈ Θ := hz' ▸ mem_connectedComponentIn hz + have hb : cap.emb z ∈ discBd (closure (cap.cuffDisc Θ)) := by + rw [cap.cuffDisc_bd Θ hΘ] + exact mem_image_of_mem _ hzΘ + exact closure_nonempty_iff.mp ⟨_, Surface.discBd_subset _ hb⟩ + have hxU : x ∈ (Γ.hatU cap)ᶜ := by + rintro ⟨y, -, rfl⟩ + exact hnotR hΘ hx (mem_range_self y) + have hr : connectedComponentIn (Γ.hatU cap)ᶜ x ∈ Γ.hatRegions cap := ⟨x, hxU, rfl⟩ + have hxr := mem_connectedComponentIn hxU + rcases hatRegion_cases cap Γ hr with h | ⟨Θ', hΘ', h⟩ + · exact absurd (h hxr) (hnotR hΘ hx) + · have hxΘ' : x ∈ cap.cuffDisc Θ' := h ▸ hxr + obtain rfl : Θ = Θ' := by + by_contra hne + exact disjoint_left.mp (cap.cuffDisc_disjoint Θ hΘ Θ' hΘ' hne) (subset_closure hx) + (subset_closure hxΘ') + rw [regions_eq_R] + exact hD.hatRegion_mem_R (h ▸ hr) + +/-- A connected drawing is a connected set. -/ +theorem drawing_U_preconnected {T : Type} [TopologicalSpace T] (G : Drawing T) + (hne : G.V.Nonempty) (hends : ∀ e ∈ G.E, (tilde e).Nonempty) + (h : (G.adj.induce G.V).Preconnected) : IsPreconnected G.U := by + obtain ⟨x₀, hx₀⟩ := hne + have hcl : ∀ e ∈ G.E, IsPreconnected (closure e) := fun e he => + he.2.2.1.isConnected.isPreconnected.closure + have key : ∀ {a b : G.V}, (G.adj.induce G.V).Walk a b → + ∃ C, C ⊆ G.U ∧ a.1 ∈ C ∧ b.1 ∈ C ∧ IsPreconnected C := by + intro a b w + induction w with + | @nil a => + exact ⟨{a.1}, singleton_subset_iff.mpr (G.V_subset_U a.2), rfl, rfl, isPreconnected_singleton⟩ + | @cons a c b hadj _ ih => + obtain ⟨C, hC, hc, hb, hpre⟩ := ih + obtain ⟨-, -, -, e, he, hae, hce⟩ := hadj + refine ⟨closure e ∪ C, union_subset (G.closure_subset_U he) hC, .inl hae.1, .inr hb, ?_⟩ + exact (hcl e he).union c.1 hce.1 hc hpre + have hV : ∀ y (hy : y ∈ G.V), ∃ t, t ⊆ G.U ∧ x₀ ∈ t ∧ y ∈ t ∧ IsPreconnected t := fun y hy => by + obtain ⟨w⟩ := h ⟨x₀, hx₀⟩ ⟨y, hy⟩ + exact key w + refine isPreconnected_of_forall x₀ fun y hy => ?_ + by_cases hyV : y ∈ G.V + · exact hV y hyV + · obtain ⟨e, he, hye⟩ := exists_edge_of_mem G hy hyV + obtain ⟨u, hu⟩ := hends e he + have huV : u ∈ G.V := (tilde_eq_inter_V G he ▸ hu).2 + obtain ⟨C, hC, hx, hu', hpre⟩ := hV u huV + exact ⟨C ∪ closure e, union_subset hC (G.closure_subset_U he), .inl hx, + .inr (subset_closure hye), + hpre.union u hu' hu.1 (hcl e he)⟩ + +section Three + +variable {Γ₂ : Painting S} + +/-- **`τ'(v)` is left by at most two edges of a cuff.** This uses the third statement of (6.6) for +the +region that is the disc pasted onto the cuff, and `no_three_arcs`. -/ +theorem three_mixed (hS : IsSurface S) {D₂ : Drawing Shat} (hD₂ : IsSkHat cap Γ₂ D₂) + (hl₂ : LoopFree D₂) + {ρ : Drawing Shat} (hρ : ρ.IsSubdrawing D₂) + (hconn : ∀ r ∈ D₂.regions, + ((GM19.Drawing.adj (ρ.interSet (closure r))).induce (ρ.interSet (closure r)).V).Preconnected) + {Θ : Set S} (hΘ : Θ ∈ cuffs S) {f₁ f₂ f₃ : Set S} (h₁ : f₁ ∈ Γ₂.E) (h₂ : f₂ ∈ Γ₂.E) + (h₃ : f₃ ∈ Γ₂.E) + (h12 : f₁ ≠ f₂) (h13 : f₁ ≠ f₃) (h23 : f₂ ≠ f₃) (hs₁ : f₁ ⊆ Θ) (hs₂ : f₂ ⊆ Θ) (hs₃ : f₃ ⊆ Θ) + (hm₁ : Mixed (cap.emb ⁻¹' ρ.V) f₁) (hm₂ : Mixed (cap.emb ⁻¹' ρ.V) f₂) + (hm₃ : Mixed (cap.emb ⁻¹' ρ.V) f₃) : False := by + have hinj := cap.isEmbedding.injective + have hClosed := cap.isClosedEmbedding hS + have hO : IsOArc Θ := (cuff_statement S hS).2.2 Θ hΘ + have hcΘ : IsClosed Θ := hO.isCompact.isClosed + have hDisc := cap.cuffDisc_closedDisc Θ hΘ + have hF : IsOArc (cap.emb '' Θ) := cap.cuffDisc_bd Θ hΘ ▸ hDisc.isOArc_discBd + set r := cap.cuffDisc Θ with hrdef + have hr : r ∈ D₂.regions := cuffDisc_mem_regions hD₂ hΘ + set T := ρ.interSet (closure r) with hTdef + have hclr : closure r = r ∪ cap.emb '' Θ := cap.closure_cuffDisc hΘ + have hrU : ∀ {x}, x ∈ r → x ∉ D₂.U := by + intro x hx hU + rw [hD₂.hU] at hU + obtain ⟨y, -, rfl⟩ := hU + have : cap.emb y ∈ (range cap.emb)ᶜ := by + rw [cap.compl_eq] + exact mem_iUnion₂.2 ⟨Θ, hΘ, hx⟩ + exact this (mem_range_self y) + have hρU : ρ.V ⊆ D₂.U := hρ.1.trans D₂.V_subset_U + have hTE : ∀ e ∈ T.E, e ∈ ρ.E ∧ e ⊆ closure r := by + intro e he + rw [hTdef, Drawing.interSet, Drawing.span_E] at he + exact he.1 + have hTV : ∀ x ∈ T.V, x ∈ ρ.V ∧ x ∈ closure r := by + intro x hx + rcases hx with hx | hx + · exact ⟨hx.2, hx.1.2⟩ + · obtain ⟨e, ⟨he, -⟩, hxe⟩ := mem_iUnion₂.1 hx + exact ⟨hxe.2, closure_minimal he.2 isClosed_closure hxe.1⟩ + have hin : ∀ {x}, x ∈ closure r → x ∈ D₂.U → x ∈ cap.emb '' Θ := by + intro x hx hU + rw [hclr] at hx + exact hx.resolve_left fun h => hrU h hU + have hTU : T.U ⊆ cap.emb '' Θ := by + intro x hx + by_cases hxV : x ∈ T.V + · exact hin (hTV x hxV).2 (hρU (hTV x hxV).1) + · obtain ⟨e, he, hxe⟩ := exists_edge_of_mem T hx hxV + obtain ⟨heρ, hecl⟩ := hTE e he + exact hin (hecl hxe) (D₂.closure_subset_U (hρ.2 heρ) (subset_closure hxe)) + have hedge : ∀ {f}, f ∈ Γ₂.E → f ⊆ Θ → cap.emb '' f ∈ D₂.E ∧ closure f ⊆ Θ := by + intro f hf hfΘ + obtain ⟨x, hx⟩ := hf.2.2.1.nonempty + have h2 := (edge_sub_cuff Γ₂ hΘ hf ⟨x, hx, hfΘ hx⟩).2 + exact ⟨hD₂.edge_iff.mpr ⟨f, sk_of_edge Γ₂ hf h2, rfl⟩, closure_minimal hfΘ hcΘ⟩ + have hdisj : ∀ {f}, f ∈ Γ₂.E → f ⊆ Θ → Mixed (cap.emb ⁻¹' ρ.V) f → Disjoint T.U (cap.emb '' f) + := by + intro f hf hfΘ hmix + obtain ⟨hE, -⟩ := hedge hf hfΘ + refine disjoint_left.mpr fun x hxT hxf => ?_ + have hxV : x ∉ D₂.V := (hE.2.1 hxf).2 + have hxTV : x ∉ T.V := fun h => hxV (hρ.1 (hTV x h).1) + obtain ⟨e, he, hxe⟩ := exists_edge_of_mem T hxT hxTV + have heρ := (hTE e he).1 + obtain rfl := arcComp_eq_of_mem (hρ.2 heρ) hE hxe hxf + refine hmix.2 fun a ha => ?_ + have h' : cap.emb a ∈ tilde (cap.emb '' f) := by + rw [tilde_emb hS] + exact mem_image_of_mem _ ha + rw [tilde_eq_inter_V ρ heρ] at h' + exact h'.2 + have hend : ∀ {f}, f ∈ Γ₂.E → f ⊆ Θ → ∀ {a}, a ∈ tilde f ∩ cap.emb ⁻¹' ρ.V → cap.emb a ∈ T.V := by + intro f hf hfΘ a ha + have hab : cap.emb a ∈ cap.emb '' Θ := mem_image_of_mem _ ((hedge hf hfΘ).2 ha.1.1) + have hmem : cap.emb a ∈ closure r := by + rw [hclr] + exact .inr hab + exact .inl ⟨⟨ha.2, hmem⟩, ha.2⟩ + have hclose : ∀ {f}, f ∈ Γ₂.E → f ⊆ Θ → Mixed (cap.emb ⁻¹' ρ.V) f → + (closure (cap.emb '' f) ∩ T.U).Nonempty := by + intro f hf hfΘ hmix + obtain ⟨a, ha⟩ := hmix.1 + refine ⟨cap.emb a, ?_, T.V_subset_U (hend hf hfΘ ha)⟩ + rw [hClosed.closure_image_eq] + exact mem_image_of_mem _ ha.1.1 + have hpre : ∀ {f}, f ∈ Γ₂.E → IsPreconnected (cap.emb '' f) := fun hf => + (edge_preconnected Γ₂ hf).image _ cap.isEmbedding.continuous.continuousOn + have hsubF : ∀ {f : Set S}, f ⊆ Θ → cap.emb '' f ⊆ cap.emb '' Θ := fun h => image_mono h + have hdd : ∀ {f g}, f ∈ Γ₂.E → g ∈ Γ₂.E → f ≠ g → Disjoint (cap.emb '' f) (cap.emb '' g) := by + intro f g hf hg hne + refine (disjoint_image_iff hinj).mpr (disjoint_left.mpr fun x hxf hxg => hne ?_) + exact arcComp_eq_of_mem hf hg hxf hxg + obtain ⟨a₃, ha₃⟩ := hm₃.1 + have hTne : T.V.Nonempty := ⟨_, hend h₃ hs₃ ha₃⟩ + have hTconn : IsPreconnected T.U := by + refine drawing_U_preconnected T hTne (fun e he => ?_) (hconn r hr) + obtain ⟨u, v, -, ht, -⟩ := hl₂ e (hρ.2 (hTE e he).1) + exact ht ▸ ⟨u, .inl rfl⟩ + obtain ⟨x, hx⟩ := h₃.2.2.1.nonempty + have h2₃ := (edge_sub_cuff Γ₂ hΘ h₃ ⟨x, hx, hs₃ hx⟩).2 + obtain ⟨u, v, huv, ht⟩ := ncard_eq_two.mp h2₃ + have htA : tilde (cap.emb '' f₃) = {cap.emb u, cap.emb v} := by + rw [tilde_emb hS, ht, image_pair] + have hendA : cap.emb u ∈ T.U ∨ cap.emb v ∈ T.U := by + have hA := T.V_subset_U (hend h₃ hs₃ ha₃) + have ha : a₃ ∈ ({u, v} : Set S) := ht ▸ ha₃.1 + rcases ha with rfl | rfl + · exact .inl hA + · exact .inr hA + exact no_three_arcs hF (fun h => huv (hinj h)) hTconn hTU (hpre h₁) (hpre h₂) (hpre h₃) + (h₁.2.2.1.nonempty.image _) (h₂.2.2.1.nonempty.image _) (hsubF hs₁) (hsubF hs₂) (hsubF hs₃) + (by rw [hClosed.closure_image_eq]; exact image_mono (hedge h₃ hs₃).2) (hdisj h₁ hs₁ hm₁) + (hdisj h₂ hs₂ hm₂) (hdisj h₃ hs₃ hm₃) (hdd h₁ h₂ h12) (hdd h₁ h₃ h13) (hdd h₂ h₃ h23) + (hclose h₁ hs₁ hm₁) (hclose h₂ hs₂ hm₂) htA hendA + +end Three + +omit [T2Space S] in +theorem tilde_of_march (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) (h2 : (tilde e).ncard + = 2) {a b : S} + (ha : (Γ.γ e).head? = some a) (hb : (Γ.γ e).getLast? = some b) : tilde e = {a, b} := by + have hlen : (Γ.γ e).length = 2 := by rw [Γ.length_γ he, h2] + obtain ⟨x, y, hxy⟩ := List.length_eq_two.mp hlen + rw [hxy] at ha hb + simp only [List.head?_cons, Option.some.injEq, List.getLast?_cons_cons, + List.getLast?_singleton] at ha hb + subst ha hb + rw [← Γ.γ_set e he, hxy] + ext z + simp + +/-- **(6.2)** for a surface `Σ`, from (6.6). -/ +theorem theorem_6_2_of_6_6 : Theorem62Statement.{0} := by + classical + intro S Shat _ _ _ _ cap hS + have := cap.connected + obtain ⟨k, hk⟩ := GraphMinor.GM19.theorem_6_6_proof Shat cap.isSurface cap.connected cap.bd_empty + refine ⟨k + 1, ?_⟩ + intro Φ Γ₁ Γ₂ rad hf₁ hf₂ hn σv σe hσ hresp + have hinj := cap.isEmbedding.injective + have h3₁ := hf₁.internally_three_connected + have h3₂ := hf₂.internally_three_connected + obtain ⟨D₁, hD₁⟩ := exists_isSkHat hS cap Γ₁ + obtain ⟨D₂, hD₂⟩ := exists_isSkHat hS cap Γ₂ + have rad₂ := (Painting.exists_radialDrawing hS cap Γ₂ (h3₂.hatRegions_isOpenDisc hS cap)).some + obtain ⟨hb₁, hrep⟩ := theorem_6_7_proof rad hS hD₁ h3₁ + have hb₂ := sk_block rad₂ hS hD₂ h3₂ + have hl₁ := sk_loopFree hS hD₁ + have hl₂ := sk_loopFree hS hD₂ + obtain ⟨τv, τe, hτ, -, hτv⟩ := exists_enlargement hS hD₁ hD₂ hl₂ hσ + have hlt : (k : ℕ∞) < D₁.rep := by + rw [hrep] + refine lt_of_lt_of_le ?_ hn + exact_mod_cast Nat.lt_succ_self k + obtain ⟨ρ, hρ, hsub, -, -, hreg⟩ := hk D₁ D₂ (gm19_of_loopFree cap.bd_empty hl₁) + (gm19_of_loopFree cap.bd_empty hl₂) hb₁ hb₂ hlt τv τe hτ + have hmemV : ∀ {v}, v ∈ Γ₁.V → cap.emb v ∈ D₁.V := fun hv => hD₁.hV ▸ mem_image_of_mem _ hv + let ℓ : S → Set S := fun v => cap.emb ⁻¹' (ρ (cap.emb v)).V + have hle : ∀ v ∈ Γ₁.V, σv v ⊆ ℓ v := by + intro v hv a ha + have h₁ : cap.emb a ∈ (τv (cap.emb v)).V := by + rw [hτv v hv] + exact mem_image_of_mem _ ha + exact (hsub _ (hmemV hv)).1 h₁ + have hρsub : ∀ {v}, v ∈ Γ₁.V → (ρ (cap.emb v)).IsSubdrawing D₂ := fun hv => + hρ.vertex_subdrawing _ (hmemV hv) + have hinfl : IsInflation Γ₁ Γ₂ ℓ σe := by + refine ⟨hσ.edge_mem, hσ.edge_size, hσ.edge_injOn, fun v hv => (hσ.vertex_nonempty v hv).mono + (hle v hv), + ?_, ?_, ?_, ?_⟩ + · intro v hv a ha + have h₁ : cap.emb a ∈ D₂.V := (hρsub hv).1 ha + rw [hD₂.hV] at h₁ + obtain ⟨b, hb, hab⟩ := h₁ + exact hinj hab ▸ hb + · intro v hv + have : Nonempty S := ⟨v⟩ + have hleft : Function.LeftInverse (Function.invFun cap.emb) cap.emb := + Function.leftInverse_invFun hinj + have hrange : ∀ {x}, x ∈ (ρ (cap.emb v)).V → ∃ a, cap.emb a = x := by + intro x hx + have h₁ := (hρsub hv).1 hx + rw [hD₂.hV] at h₁ + obtain ⟨a, -, rfl⟩ := h₁ + exact ⟨a, rfl⟩ + refine preconnected_image (Function.invFun cap.emb) (hρ.vertex_connected _ (hmemV hv)) ?_ ?_ + · ext a + constructor + · intro ha + exact ⟨cap.emb a, ha, hleft a⟩ + · rintro ⟨x, hx, rfl⟩ + obtain ⟨b, rfl⟩ := hrange hx + change cap.emb (Function.invFun cap.emb (cap.emb b)) ∈ (ρ (cap.emb v)).V + rw [hleft b] + exact hx + · intro x hx y hy hadj + obtain ⟨a, rfl⟩ := hrange hx + obtain ⟨b, rfl⟩ := hrange hy + rw [hleft a, hleft b] + obtain ⟨hne, hxV, hyV, e, he, hxe, hye⟩ := hadj + exact adj_sk_of hS hD₂ ⟨hne, (hρsub hv).1 hxV, (hρsub hv).1 hyV, e, (hρsub hv).2 he, hxe, + hye⟩ + · intro v₁ hv₁ v₂ hv₂ hne + exact (hρ.vertex_disjoint _ (hmemV hv₁) _ (hmemV hv₂) fun h => hne (hinj h)).preimage cap.emb + · intro e he i hi hi' + have hmem : (Γ₁.γ e)[i] ∈ tilde e := by + rw [← Γ₁.γ_set e he] + exact List.getElem_mem hi + exact hle _ (Γ₁.tilde_subset_V he hmem) (hσ.ends e he i hi hi') + have hside : ∀ e ∈ Γ₁.E, ∀ Θ ∈ cuffs S, (e ∩ Θ).Nonempty → + Painting.IsBorder e ∧ ∃ s ∈ Φ.sides, e ⊆ s ∧ s ⊆ Θ := by + rintro e he Θ hΘ ⟨x, hxe, hxΘ⟩ + have hb : Painting.IsBorder e := ⟨x, hxe, cuff_sub_bd hΘ hxΘ⟩ + have hebd := (Γ₁.border_edge e he hb).2 + obtain ⟨s, hs, hes⟩ := exists_arcComp_superset he.2.2.1 (F := bd S \ Φ.V) + fun y hy => ⟨hebd hy, fun hyΦ => Γ₁.disjoint_V he hy (hf₁.V_subset hyΦ)⟩ + refine ⟨hb, s, hs, hes, sub_cuff hΘ hs.2.2.1.isConnected.isPreconnected + (hs.2.1.trans sdiff_subset) ⟨x, hes hxe, hxΘ⟩⟩ + have hmove : ∀ e ∈ Γ₁.E, ∀ Θ ∈ cuffs S, (e ∩ Θ).Nonempty → σe e ⊆ Θ := by + intro e he Θ hΘ hm + obtain ⟨hb, s, hs, hes, hsΘ⟩ := hside e he Θ hΘ hm + exact ((hresp e he hb).2 s hs).1 hes |>.trans hsΘ + have hcover : ∀ {Θ f : Set S}, Θ ∈ cuffs S → f ∈ Γ₂.E → f ⊆ Θ → + (∃ v ∈ Γ₁.V, tilde f ⊆ ℓ v) ∨ ∃ e ∈ Γ₁.E, (e ∩ Θ).Nonempty ∧ f = σe e := by + intro Θ f hΘ hf hfΘ + refine cuff_cover hS hinfl ?_ hmove hΘ hf hfΘ + intro Θ' hΘ' v hv f₁ h₁ f₂ h₂ f₃ h₃ h12 h13 h23 hs₁ hs₂ hs₃ hm₁ hm₂ hm₃ + exact three_mixed hS hD₂ hl₂ (hρsub hv) (fun r hr => hreg r hr _ (hmemV hv)) hΘ' h₁ h₂ h₃ h12 + h13 h23 + hs₁ hs₂ hs₃ hm₁ hm₂ hm₃ + refine ⟨ℓ, { hinfl with borders_iff := ?_, border_edge := ?_, orientation := ?_ }, hle⟩ + · intro e he Θ hΘ + constructor + · intro hm + obtain ⟨y, hy⟩ := (hσ.edge_mem e he).2.2.1.nonempty + exact ⟨y, hy, hmove e he Θ hΘ hm hy⟩ + · rintro ⟨y, hy, hyΘ⟩ + have hE := hσ.edge_mem e he + obtain ⟨hs, h2⟩ := edge_sub_cuff Γ₂ hΘ hE ⟨y, hy, hyΘ⟩ + rcases hcover hΘ hE hs with ⟨v, hv, hsub'⟩ | ⟨e₀, he₀, hm, heq⟩ + · exfalso + have h2' : (tilde e).ncard = 2 := by rw [← hσ.edge_size e he, h2] + obtain ⟨u, w, huw, ht⟩ := ncard_eq_two.mp h2' + have hsame : ∀ {x}, x ∈ tilde e → x = v := by + intro x hx + obtain ⟨a, hat, ha⟩ := (infl_ends hinfl he).2 x hx + by_contra hne + exact disjoint_left.mp (hinfl.vertex_disjoint x (Γ₁.tilde_subset_V he hx) v hv hne) ha + (hsub' hat) + exact huw ((hsame (ht ▸ .inl rfl)).trans (hsame (ht ▸ .inr rfl)).symm) + · rw [hσ.edge_injOn he he₀ heq] + exact hm + · rintro e' hE ⟨x, hxe, hxb⟩ hnot + have hΘ : connectedComponentIn (bd S) x ∈ cuffs S := ⟨x, hxb, rfl⟩ + have hx := mem_connectedComponentIn hxb + rcases hcover hΘ hE (edge_sub_cuff Γ₂ hΘ hE ⟨x, hxe, hx⟩).1 with ⟨v, hv, hs⟩ | ⟨e, he, -, rfl⟩ + · exact ⟨v, hv, hs⟩ + · exact absurd ⟨e, he, rfl⟩ hnot + · intro e he Θ hΘ hm f n n' hn₁ hn₂ hpre + obtain ⟨hb, s, hs, hes, hsΘ⟩ := hside e he Θ hΘ hm + have hE := hσ.edge_mem e he + have hes' : σe e ⊆ s := ((hresp e he hb).2 s hs).1 hes + have hO : IsOArc Θ := (cuff_statement S hS).2.2 Θ hΘ + have hclS : closure s ⊆ Θ := closure_minimal hsΘ hO.isCompact.isClosed + obtain ⟨u, w, huw, ht⟩ := ncard_eq_two.mp (Φ.side_shape s hs).1 + have hspre : IsPreconnected s := hs.2.2.1.isConnected.isPreconnected + obtain ⟨p, hpΘ, hp⟩ := exists_notMem_closure hO huw hspre hsΘ hclS ht + have h2 := (edge_sub_cuff Γ₁ hΘ he hm).2 + have h2' : (tilde (σe e)).ncard = 2 := by rw [hσ.edge_size e he, h2] + exact precedes_of_dirAgrees f hclS hpΘ hp (hf₁.border_dir e he hb s hs hes) + (hf₂.border_dir (σe e) hE (hresp e he hb).1 s hs hes') (edge_preconnected Γ₁ he) + (edge_preconnected Γ₂ hE) (fun a b ha hb' => tilde_of_march Γ₁ he h2 ha hb') + (fun a b ha hb' => tilde_of_march Γ₂ hE h2' ha hb') hn₁ hn₂ hpre + +/-- **Theorem (6.2) of Graph Minors XIX**, page 339, by the proof on pages 342-343. -/ +theorem theorem_6_2_proof : Theorem62Statement.{u} := + theorem_6_2_lift theorem_6_2_of_6_6 + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6Walk.lean b/LeanPool/GraphMinor/GM19/Section6Walk.lean new file mode 100644 index 0000000000..b50218adee --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6Walk.lean @@ -0,0 +1,424 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6Sector +public import LeanPool.GraphMinor.GM19.Section6Path +public import LeanPool.GraphMinor.GM11.OArcCircuit + +/-! +# A closed walk that is not null-homotopic gives a circuit + +Let `G` be a drawing with no loops. A walk in the graph of `G` traces a path in the surface +(`walkP`). If a closed walk of length at most `n` is not null-homotopic, then `G` has a circuit with +at +most `n` edges that is not null-homotopic (`exists_circuit_of_walk`). The proof takes a shortest +such +closed walk. All shorter closed walks are null-homotopic, so we may cut the closed pieces out of it +(`walkP_bypass`), and what remains is one edge and a path, which together form an `O`-arc, unless +the +walk goes along an edge and back. + +This is used for `rep(sk(Γ)) ≥ rep(Γ)` in (6.7) of Graph Minors XIX, where a curve is first moved +onto a closed walk of the radial drawing, which need not be a circuit. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +local notation "𝕀" => unitInterval + +variable {T : Type} [TopologicalSpace T] + +/-- Two paths in a contractible set with the same ends are homotopic. -/ +theorem paths_homotopic_of_contractible {Λ : Set T} (hc : ContractibleSpace Λ) {a b : T} + (p q : Path a b) + (hp : range p ⊆ Λ) (hq : range q ⊆ Λ) : p.Homotopic q := by + have ha : a ∈ Λ := hp ⟨0, by simp⟩ + have hb : b ∈ Λ := hp ⟨1, by simp⟩ + let p' : Path (⟨a, ha⟩ : Λ) ⟨b, hb⟩ := ⟨⟨fun t => ⟨p t, hp ⟨t, rfl⟩⟩, by fun_prop⟩, by simp, by + simp⟩ + let q' : Path (⟨a, ha⟩ : Λ) ⟨b, hb⟩ := ⟨⟨fun t => ⟨q t, hq ⟨t, rfl⟩⟩, by fun_prop⟩, by simp, by + simp⟩ + have h : p'.Homotopic q' := SimplyConnectedSpace.paths_homotopic _ _ + have h2 := h.map ⟨Subtype.val, continuous_subtype_val⟩ + have e1 : p'.map continuous_subtype_val = p := by + ext t + rfl + have e2 : q'.map continuous_subtype_val = q := by + ext t + rfl + have e3 := h2 + simp only [ContinuousMap.coe_mk] at e3 + rwa [e1, e2] at e3 + +/-- Two paths in a line with the same ends are homotopic. -/ +theorem paths_homotopic_in_line {L : Set T} {u v : T} (hL : IsLineWithEnds L u v) {a b : T} + (p q : Path a b) (hp : range p ⊆ L) (hq : range q ⊆ L) : p.Homotopic q := by + obtain ⟨f, -, -⟩ := hL + have hc : ContractibleSpace 𝕀 := (convex_Icc (0 : ℝ) 1).contractibleSpace ⟨0, by simp⟩ + exact paths_homotopic_of_contractible f.symm.contractibleSpace p q hp hq + +variable [T2Space T] + +omit [T2Space T] in +/-- A step of a walk: an edge with the two ends, and a path along it. -/ +theorem exists_walk_step {G : Drawing T} (hl : LoopFree G) {a b : G.V} + (h : (G.adj.induce G.V).Adj a b) : ∃ e ∈ G.E, ∃ p : Path a.1 b.1, tilde e = {a.1, b.1} ∧ + IsLineWithEnds (closure e) a b ∧ range p = closure e ∧ Function.Injective p := by + have h' : G.adj.Adj a.1 b.1 := h + obtain ⟨hne, -, -, e, he, h1, h2⟩ := h' + obtain ⟨u, v, huv, hti, hL⟩ := hl e he + have hti' : tilde e = {a.1, b.1} := by + rw [hti] at h1 h2 ⊢ + rcases h1 with h1 | h1 <;> rcases h2 with h2 | h2 + · exact absurd (h1.trans h2.symm) hne + · rw [h1, mem_singleton_iff.mp h2] + · rw [mem_singleton_iff.mp h1, h2, pair_comm] + · exact absurd ((mem_singleton_iff.mp h1).trans (mem_singleton_iff.mp h2).symm) hne + have hLe : IsLineWithEnds (closure e) a b := by + rw [hti] at h1 h2 + rcases h1 with h1 | h1 <;> rcases h2 with h2 | h2 + · exact absurd (h1.trans h2.symm) hne + · rw [h1, mem_singleton_iff.mp h2]; exact hL + · rw [mem_singleton_iff.mp h1, h2]; exact GraphMinor.GM11.IsLineWithEnds.symm hL + · exact absurd ((mem_singleton_iff.mp h1).trans (mem_singleton_iff.mp h2).symm) hne + obtain ⟨f, h0, h1'⟩ := id hLe + refine ⟨e, he, ⟨⟨fun t => (f t).1, by fun_prop⟩, h0, h1'⟩, hti', hLe, ?_, ?_⟩ + · ext x + constructor + · rintro ⟨t, rfl⟩ + exact (f t).2 + · intro hx + exact ⟨f.symm ⟨x, hx⟩, by simp⟩ + · intro s t hst + exact f.injective (Subtype.ext hst) + +/-- The edge of a step. -/ +noncomputable def stepE {G : Drawing T} (hl : LoopFree G) {a b : G.V} + (h : (G.adj.induce G.V).Adj a b) : Set T := (exists_walk_step hl h).choose + +/-- The path along the edge of a step. -/ +noncomputable def stepP {G : Drawing T} (hl : LoopFree G) {a b : G.V} + (h : (G.adj.induce G.V).Adj a b) : Path a.1 b.1 := (exists_walk_step hl h).choose_spec.2.choose + +omit [T2Space T] in +theorem stepE_mem {G : Drawing T} (hl : LoopFree G) {a b : G.V} (h : (G.adj.induce G.V).Adj a b) : + stepE hl h ∈ G.E := (exists_walk_step hl h).choose_spec.1 + +omit [T2Space T] in +theorem stepE_tilde {G : Drawing T} (hl : LoopFree G) {a b : G.V} (h : (G.adj.induce G.V).Adj a b) : + tilde (stepE hl h) = {a.1, b.1} := (exists_walk_step hl h).choose_spec.2.choose_spec.1 + +omit [T2Space T] in +theorem stepE_line {G : Drawing T} (hl : LoopFree G) {a b : G.V} (h : (G.adj.induce G.V).Adj a b) : + IsLineWithEnds (closure (stepE hl h)) a b := (exists_walk_step hl + h).choose_spec.2.choose_spec.2.1 + +omit [T2Space T] in +theorem stepP_range {G : Drawing T} (hl : LoopFree G) {a b : G.V} (h : (G.adj.induce G.V).Adj a b) : + range (stepP hl h) = closure (stepE hl h) := (exists_walk_step hl + h).choose_spec.2.choose_spec.2.2.1 + +omit [T2Space T] in +theorem stepP_injective {G : Drawing T} (hl : LoopFree G) {a b : G.V} + (h : (G.adj.induce G.V).Adj a b) : Function.Injective (stepP hl h) := + (exists_walk_step hl h).choose_spec.2.choose_spec.2.2.2 + +/-- The path that a walk traces. -/ +noncomputable def walkP {G : Drawing T} (hl : LoopFree G) : + ∀ {a b : G.V}, (G.adj.induce G.V).Walk a b → Path a.1 b.1 + | _, _, .nil => Path.refl _ + | _, _, .cons h p => (stepP hl h).trans (walkP hl p) + +/-- The set of points of a walk. -/ +noncomputable def walkU {G : Drawing T} (hl : LoopFree G) : + ∀ {a b : G.V}, (G.adj.induce G.V).Walk a b → Set T + | a, _, .nil => {a.1} + | _, _, .cons h p => closure (stepE hl h) ∪ walkU hl p + +/-- The set of edges of a walk. -/ +noncomputable def walkE {G : Drawing T} (hl : LoopFree G) : + ∀ {a b : G.V}, (G.adj.induce G.V).Walk a b → Set (Set T) + | _, _, .nil => ∅ + | _, _, .cons h p => insert (stepE hl h) (walkE hl p) + +variable {G : Drawing T} (hl : LoopFree G) + +omit [T2Space T] in +theorem walkE_ncard {a b : G.V} (p : (G.adj.induce G.V).Walk a b) : + (walkE hl p).Finite ∧ (walkE hl p).ncard ≤ p.length := by + induction p with + | nil => simp [walkE] + | cons h p ih => + refine ⟨ih.1.insert _, ?_⟩ + have := ncard_insert_le (stepE hl h) (walkE hl p) + simp only [walkE, SimpleGraph.Walk.length_cons] + omega + +omit [T2Space T] in +theorem walkP_range {a b : G.V} (p : (G.adj.induce G.V).Walk a b) : + range (walkP hl p) ⊆ walkU hl p := by + induction p with + | nil => + rintro _ ⟨t, rfl⟩ + rfl + | cons h p ih => + simp only [walkP, walkU] + rw [Path.trans_range, stepP_range] + exact union_subset_union_right _ ih + +omit [T2Space T] in +theorem walkU_inter_V {a b : G.V} (p : (G.adj.induce G.V).Walk a b) {x : T} (hx : x ∈ walkU hl p) + (hxV : x ∈ G.V) : (⟨x, hxV⟩ : G.V) ∈ p.support := by + induction p with + | nil => + have : x = _ := hx + subst this + simp + | @cons a c b h p ih => + rw [SimpleGraph.Walk.support_cons, List.mem_cons] + rcases hx with hx | hx + · have hxt : x ∈ tilde (stepE hl h) := by + rw [tilde_eq_inter_V G (stepE_mem hl h)] + exact ⟨hx, hxV⟩ + rw [stepE_tilde] at hxt + rcases hxt with hxt | hxt + · exact .inl (Subtype.ext hxt) + · have hc : x = c.1 := hxt + refine .inr ?_ + have hm : c ∈ p.support := p.start_mem_support + have : (⟨x, hxV⟩ : G.V) = c := Subtype.ext hc + rwa [this] + · exact .inr (ih hx) + +omit [T2Space T] in +theorem walkU_edge {a b : G.V} (p : (G.adj.induce G.V).Walk a b) {x : T} (hx : x ∈ walkU hl p) + (hxV : x ∉ G.V) : ∃ f ∈ walkE hl p, f ∈ G.E ∧ closure f ⊆ walkU hl p ∧ x ∈ closure f := by + induction p with + | nil => + have : x = _ := hx + subst this + exact absurd (Subtype.property _) hxV + | @cons a c b h p ih => + rcases hx with hx | hx + · exact ⟨_, .inl rfl, stepE_mem hl h, subset_union_left, hx⟩ + · obtain ⟨f, hf, hfE, hsub, hxf⟩ := ih hx + exact ⟨f, .inr hf, hfE, hsub.trans subset_union_right, hxf⟩ + +omit [T2Space T] in +theorem walkU_subset_U {a b : G.V} (p : (G.adj.induce G.V).Walk a b) : walkU hl p ⊆ G.U := by + induction p with + | nil => + rintro _ rfl + exact G.V_subset_U (Subtype.property _) + | cons h p ih => + exact union_subset (G.closure_subset_U (stepE_mem hl h)) ih + +/-- The points of a path of the graph form a line. -/ +theorem walkU_line {a b : G.V} (p : (G.adj.induce G.V).Walk a b) : + p.IsPath → a ≠ b → IsLineWithEnds (walkU hl p) a b := by + induction p with + | nil => exact fun _ h => absurd rfl h + | @cons a c b h p ih => + intro hp hab + rw [SimpleGraph.Walk.cons_isPath_iff] at hp + have hLe := stepE_line hl h + by_cases hcb : c = b + · subst hcb + have hp0 : p = .nil := by + cases p with + | nil => rfl + | cons h' q => + have := hp.1 + simp at this + subst hp0 + have hsub : walkU hl (.cons h .nil : (G.adj.induce G.V).Walk a c) = closure (stepE hl h) := by + apply Subset.antisymm + · refine union_subset subset_rfl ?_ + rintro _ rfl + exact hLe.right_mem + · exact subset_union_left + rw [hsub] + exact hLe + · have hL := ih hp.1 hcb + have hcap : closure (stepE hl h) ∩ walkU hl p = {c.1} := by + apply Subset.antisymm + · rintro x ⟨hxe, hxq⟩ + by_cases hxV : x ∈ G.V + · have hxt : x ∈ tilde (stepE hl h) := by + rw [tilde_eq_inter_V G (stepE_mem hl h)] + exact ⟨hxe, hxV⟩ + rw [stepE_tilde] at hxt + rcases hxt with hxt | hxt + · subst hxt + exact absurd (walkU_inter_V hl p hxq hxV) hp.2 + · exact hxt + · obtain ⟨f, -, hfE, hsub, hxf⟩ := walkU_edge hl p hxq hxV + have hef := edge_eq_of_mem G (stepE_mem hl h) hfE hxe hxf hxV + have ha : a.1 ∈ walkU hl p := hsub (hef ▸ hLe.left_mem) + exact absurd (walkU_inter_V hl p ha a.2) hp.2 + · rintro _ rfl + exact ⟨hLe.right_mem, hL.left_mem⟩ + exact IsLineWithEnds.union hLe hL hcap + +omit [T2Space T] in +theorem walkP_append {a b c : G.V} (p : (G.adj.induce G.V).Walk a b) + (q : (G.adj.induce G.V).Walk b c) : + (walkP hl (p.append q)).Homotopic ((walkP hl p).trans (walkP hl q)) := by + induction p with + | nil => + exact (Path.Homotopic.refl_trans _).symm + | cons h p ih => + simp only [SimpleGraph.Walk.cons_append, walkP] + exact ((Path.Homotopic.refl _).hcomp (ih q)).trans (Path.Homotopic.trans_assoc _ _ _).symm + +open Classical in +omit [T2Space T] in +/-- If all closed walks shorter than `L` are null-homotopic, then a walk shorter than `L` is +homotopic +to the path of the graph inside it. -/ +theorem walkP_bypass {L : ℕ} + (hnull : ∀ (a : G.V) (w : (G.adj.induce G.V).Walk a a), w.length < L → + (walkP hl w).Homotopic (Path.refl _)) {a b : G.V} (p : (G.adj.induce G.V).Walk a b) + (hp : p.length < L) : (walkP hl p).Homotopic (walkP hl p.bypass) := by + induction p with + | nil => exact Path.Homotopic.refl _ + | @cons a c b h q ih => + have hq : q.length < L := by + rw [SimpleGraph.Walk.length_cons] at hp + omega + have ih' := ih hq + simp only [SimpleGraph.Walk.bypass] + split_ifs with hs + · set r := q.bypass with hr + have hspec : (r.takeUntil a hs).append (r.dropUntil a hs) = r := r.take_spec hs + have hlen : (r.takeUntil a hs).length ≤ r.length := r.length_takeUntil_le_length hs + have hr' : r.length ≤ q.length := SimpleGraph.Walk.length_bypass_le_length q + have hclosed := hnull a (.cons h (r.takeUntil a hs)) (by + rw [SimpleGraph.Walk.length_cons] + rw [SimpleGraph.Walk.length_cons] at hp + omega) + simp only [walkP] at hclosed + have h₁ : (walkP hl r).Homotopic + ((walkP hl (r.takeUntil a hs)).trans (walkP hl (r.dropUntil a hs))) := by + have := walkP_append hl (r.takeUntil a hs) (r.dropUntil a hs) + rwa [hspec] at this + simp only [walkP] + refine ((Path.Homotopic.refl _).hcomp (ih'.trans h₁)).trans + ((Path.Homotopic.trans_assoc _ _ _).symm.trans ?_) + exact (hclosed.hcomp (Path.Homotopic.refl _)).trans (Path.Homotopic.refl_trans _) + · simp only [walkP] + exact (Path.Homotopic.refl _).hcomp ih' + + +omit [T2Space T] in +/-- A loop through a set is null-homotopic if an `O`-arc equal to that set is. -/ +theorem loop_refl_of_null {F : Set T} (hF : IsNullHomotopicOArc F) {w : T} (P : Path w w) + (hr : range P = F) : P.Homotopic (Path.refl w) := by + have h : P.toContinuousMap 0 = P.toContinuousMap 1 := by simp + have hγ : ∀ t, loopLift 1 P.toContinuousMap h (arcParam 1 t) = P t := fun t => by simp + refine path_refl_of_null P hγ (null_of_param hF _ ?_) + apply Subset.antisymm + · rintro _ ⟨z, rfl⟩ + obtain ⟨t, rfl⟩ := arcParam_surjective 1 z + rw [hγ, ← hr] + exact mem_range_self t + · rw [← hr] + rintro _ ⟨t, rfl⟩ + exact ⟨arcParam 1 t, hγ t⟩ + +open Classical in +/-- **A closed walk that is not null-homotopic gives a circuit.** See the module docstring. -/ +theorem exists_circuit_of_walk [ConnectedSpace T] {n : ℕ} {a : G.V} + (w : (G.adj.induce G.V).Walk a a) (hlen : w.length ≤ n) + (hnn : ¬ (walkP hl w).Homotopic (Path.refl _)) : + ∃ C : Drawing T, C.IsCircuitOf G ∧ ¬ IsNullHomotopicOArc C.U ∧ C.E.ncard ≤ n := by + have hex : ∃ L, ∃ (a : G.V) (w : (G.adj.induce G.V).Walk a a), w.length = L ∧ + ¬ (walkP hl w).Homotopic (Path.refl _) := ⟨_, a, w, rfl, hnn⟩ + have hLn : Nat.find hex ≤ n := (Nat.find_min' hex ⟨a, w, rfl, hnn⟩).trans hlen + obtain ⟨a₀, w', hw', hnn'⟩ := Nat.find_spec hex + set L := Nat.find hex with hLdef + have hnull : ∀ (b : G.V) (w : (G.adj.induce G.V).Walk b b), w.length < L → + (walkP hl w).Homotopic (Path.refl _) := by + intro b w hl' + by_contra hc + exact Nat.find_min hex hl' ⟨b, w, rfl, hc⟩ + clear hnn hlen w + cases w' with + | nil => exact absurd (Path.Homotopic.refl _) hnn' + | @cons _ y _ h q => + have hqL : q.length < L := by + rw [← hw', SimpleGraph.Walk.length_cons] + omega + have hay : a₀ ≠ y := h.ne + let r := q.bypass + have hrp : r.IsPath := q.bypass_isPath + have hrl : r.length ≤ q.length := SimpleGraph.Walk.length_bypass_le_length q + have hrq := walkP_bypass hl hnull q hqL + have hstep : ¬ ((stepP hl h).trans (walkP hl r)).Homotopic (Path.refl _) := fun hc => hnn' + (((Path.Homotopic.refl _).hcomp hrq).trans hc) + have hLe := stepE_line hl h + have hL₂ : IsLineWithEnds (walkU hl r) y a₀ := walkU_line hl r hrp hay.symm + have heE := stepE_mem hl h + have hcap : closure (stepE hl h) ∩ walkU hl r ⊆ {a₀.1, y.1} := by + rintro x ⟨hxe, hxq⟩ + by_cases hxV : x ∈ G.V + · rw [← stepE_tilde hl h, tilde_eq_inter_V G heE] + exact ⟨hxe, hxV⟩ + exfalso + obtain ⟨f, -, hfE, hsub, hxf⟩ := walkU_edge hl r hxq hxV + have hef := edge_eq_of_mem G heE hfE hxe hxf hxV + have hsub' : closure (stepE hl h) ⊆ walkU hl r := hef ▸ hsub + refine hstep (paths_homotopic_in_line hL₂ _ _ ?_ ?_) + · rw [Path.trans_range, stepP_range] + exact union_subset hsub' (walkP_range hl r) + · rintro _ ⟨t, rfl⟩ + exact hL₂.right_mem + let F : Set T := closure (stepE hl h) ∪ walkU hl r + have hO : IsOArc F := isOArc_union hLe (GraphMinor.GM11.IsLineWithEnds.symm hL₂) hcap + have hFU : F ⊆ G.U := union_subset (G.closure_subset_U heE) (walkU_subset_U hl r) + obtain ⟨f₂, f₀, f₁⟩ := id hL₂ + let q₂ : Path y.1 a₀.1 := ⟨⟨fun t => (f₂ t).1, by fun_prop⟩, f₀, f₁⟩ + have hq₂ : range q₂ = walkU hl r := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (f₂ t).2 + · intro hx + exact ⟨f₂.symm ⟨x, hx⟩, by simp [q₂]⟩ + have hnF : ¬ IsNullHomotopicOArc F := by + intro hn + have h₁ := loop_refl_of_null hn ((stepP hl h).trans q₂) (by + rw [Path.trans_range, stepP_range, hq₂]) + refine hstep (((Path.Homotopic.refl _).hcomp ?_).trans h₁) + exact paths_homotopic_in_line hL₂ _ _ (walkP_range hl r) hq₂.subset + obtain ⟨C, hC, hsub, hCU⟩ := exists_circuit_of_oArc hO hFU + refine ⟨C, ⟨hsub, hC⟩, by rwa [hCU], ?_⟩ + have hEs : C.E ⊆ insert (stepE hl h) (walkE hl r) := by + intro f hf + have hfG := hsub.2 hf + obtain ⟨x, hx⟩ := hfG.1 + have hxC := (hf.2.1 hx).1 + have hxV := (hfG.2.1 hx).2 + rw [hCU] at hxC + rcases hxC with hxC | hxC + · exact .inl (edge_eq_of_mem G hfG heE (subset_closure hx) hxC hxV) + · obtain ⟨f', hf', hfE, -, hxf⟩ := walkU_edge hl r hxC hxV + rw [edge_eq_of_mem G hfG hfE (subset_closure hx) hxf hxV] + exact .inr hf' + obtain ⟨hfin, hcard⟩ := walkE_ncard hl r + have h₁ := ncard_le_ncard hEs (hfin.insert _) + have h₂ := ncard_insert_le (stepE hl h) (walkE hl r) + omega + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6a.lean b/LeanPool/GraphMinor/GM19/Section6a.lean new file mode 100644 index 0000000000..3a7de9a3c4 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6a.lean @@ -0,0 +1,213 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Epstein +public import LeanPool.GraphMinor.GM19.Conditional +public import LeanPool.GraphMinor.GM19.Cited +public import LeanPool.GraphMinor.GM19.Section4c +public import LeanPool.GraphMinor.GM20.Draw10 +import LeanPool.GraphMinor.Surface.OpenDisc + +/-! +# Graph Minors XIX, (6.4) + +XIX quotes (6.4) from Graph Minors VII, (9.2), which is about digraphs and `α(G)`. This file does +the +translation. We give the edges of `H` and of `G` any direction (`exists_directed`), a minor of +digraphs is an enlargement (`isEnlargement_of_minor`), and `rep(G) ≤ α(G)` (`le_alpha_of_le_rep`). +The deductions that use later proofs are in `Section6aProved`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface GraphMinor.GM07 GraphMinor.GM11 + +universe u + +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +omit [T1Space S] in +/-- The ends of an edge are the vertices in its closure. -/ +theorem tilde_eq_inter_V (G : Drawing S) {e : Set S} (he : e ∈ G.E) : + tilde e = closure e ∩ G.V := by + ext x + constructor + · intro hx + refine ⟨hx.1, ?_⟩ + by_contra hV + exact hx.2 (by rw [← G.closure_diff_V he]; exact ⟨hx.1, hV⟩) + · intro hx + exact ⟨hx.1, fun hxe ↦ (he.2.1 hxe).2 hx.2⟩ + +omit [T1Space S] in +/-- Every drawing in a nonempty space has a direction on each edge. -/ +theorem exists_directed [Nonempty S] (G : Drawing S) : ∃ D : SurfaceDigraph S, D.G = G := by + have key : ∀ e : Set S, ∃ a b : S, e ∈ G.E → a ∈ G.V ∧ b ∈ G.V ∧ ({a, b} : Set S) = tilde e := by + intro e + by_cases he : e ∈ G.E + · have hE : closure e ∩ G.V ⊆ G.V := inter_subset_right + rcases G.edge_cond e he with ⟨u, v, -, h, -⟩ | ⟨u, h, -⟩ + · refine ⟨u, v, fun _ ↦ ?_⟩ + rw [tilde_eq_inter_V G he, h] + exact ⟨hE (by rw [h]; simp), hE (by rw [h]; simp), rfl⟩ + · refine ⟨u, u, fun _ ↦ ?_⟩ + rw [tilde_eq_inter_V G he, h] + exact ⟨hE (by rw [h]; simp), hE (by rw [h]; simp), by simp⟩ + · exact ⟨Classical.arbitrary S, Classical.arbitrary S, fun h ↦ absurd h he⟩ + choose a b h using key + exact ⟨⟨G, a, b, fun e he ↦ (h e he).1, fun e he ↦ (h e he).2.1, fun e he ↦ (h e he).2.2⟩, rfl⟩ + +omit [T1Space S] in +/-- A walk of a drawing joins its ends in the graph `adj` on the vertices of the drawing. -/ +theorem reachable_of_walk (D : Drawing S) {u v : S} (W : GraphWalk D.toGraph u v) (hu : u ∈ D.V) + (hv : v ∈ D.V) : (D.adj.induce D.V).Reachable ⟨u, hu⟩ ⟨v, hv⟩ := by + induction W with + | nil => exact SimpleGraph.Reachable.refl _ + | @cons x y z e h W ih => + obtain ⟨he, hx, hy, hlink⟩ := h + have hrest := ih hy hv + by_cases hxy : x = y + · subst hxy + exact hrest + · have hxe : x ∈ tilde e := by + rw [tilde_eq_inter_V D he, hlink] + simp + have hye : y ∈ tilde e := by + rw [tilde_eq_inter_V D he, hlink] + simp + have hadj : (D.adj.induce D.V).Adj ⟨x, hx⟩ ⟨y, hy⟩ := ⟨hxy, hx, hy, e, he, hxe, hye⟩ + exact hadj.reachable.trans hrest + +omit [T1Space S] in +/-- A minor of digraphs in the sense of Graph Minors VII gives an enlargement. -/ +theorem isEnlargement_of_minor {H G : SurfaceDigraph S} (h : IsDigraphMinor H G) : + ∃ (σv : S → Drawing S) (σe : Set S → Set S), IsEnlargement H.G G.G σv σe := by + obtain ⟨-, -, φv, φe, h1, h2, h3, h4, -, h5, -⟩ := h + refine ⟨φv, φe, ⟨h2, ?_, fun v hv ↦ (h1 v hv).1, fun v hv ↦ (h1 v hv).2.1, ?_, h3, ?_⟩⟩ + · intro e he e' he' hee + by_contra hne + exact h4 e he e' he' hne hee + · intro v hv + rintro ⟨a, ha⟩ ⟨b, hb⟩ + obtain ⟨W⟩ := (h1 v hv).2.2.2 a ha b hb + exact reachable_of_walk _ W ha hb + · intro e he v hv + have hends := H.ends_eq e he + have hendsG := G.ends_eq _ (h2 e he) + constructor + · rintro ⟨x, hxv, hx⟩ + rw [← hendsG] at hx + rcases hx with rfl | hx + · have : v = H.plus e := by + by_contra hne + exact Set.disjoint_left.1 (h3 v hv _ (H.plus_mem e he) hne) hxv (h5 e he).1 + rw [← hends, this] + simp + · rw [mem_singleton_iff] at hx + subst hx + have : v = H.minus e := by + by_contra hne + exact Set.disjoint_left.1 (h3 v hv _ (H.minus_mem e he) hne) hxv (h5 e he).2 + rw [← hends, this] + simp + · intro hv' + rw [← hends] at hv' + rcases hv' with rfl | hv' + · exact ⟨_, (h5 e he).1, by rw [← hendsG]; simp⟩ + · rw [mem_singleton_iff] at hv' + subst hv' + exact ⟨_, (h5 e he).2, by rw [← hendsG]; simp⟩ + +omit [T1Space S] in +/-- A closed surface is not an open disc. -/ +theorem not_isOpenDisc_univ [CompactSpace S] : ¬ IsOpenDisc (univ : Set S) := by + rintro ⟨-, ⟨f⟩⟩ + have hc : IsCompact OpenUnitDisc := by + have : CompactSpace OpenUnitDisc := + (Homeomorph.trans f (Homeomorph.Set.univ S)).symm.compactSpace + exact isCompact_iff_compactSpace.2 this + have hopen : IsOpen OpenUnitDisc := isOpen_lt (by fun_prop) continuous_const + have huniv : OpenUnitDisc = univ := IsClopen.eq_univ ⟨hc.isClosed, hopen⟩ ⟨0, by simp + [OpenUnitDisc]⟩ + have hmem : (!₂[2, 0] : EuclideanPlane) ∈ OpenUnitDisc := by + rw [huniv] + exact mem_univ _ + simp only [OpenUnitDisc, mem_ball_zero_iff] at hmem + have h0 := PiLp.norm_apply_le (!₂[2, 0] : EuclideanPlane) 0 + norm_num at h0 + linarith + +omit [T1Space S] in +/-- A closed connected surface that is not a sphere has a non-null-homotopic `O`-arc. -/ +theorem exists_not_nullHomotopic (hS : IsSurface S) + [ConnectedSpace S] (hbd : bd S = ∅) (hsph : ¬ IsSphere S) : + ∃ F : Set S, IsOArc F ∧ ¬ IsNullHomotopicOArc F := by + by_contra hno + push Not at hno + have hcl : IsClosedSurface S := ⟨hS.1, hS.2.1, fun x ↦ by + by_contra hx + have : x ∈ bd S := hx + rw [hbd] at this + exact this⟩ + have hbdj : ∀ F : Set S, Disjoint F (bd S) := fun F ↦ by simp [hbd] + have hd := open_disc S univ hcl ‹_› isConnected_univ isOpen_univ fun F _ hF ↦ by + obtain ⟨Δ, -, h1, h2⟩ := (epstein S univ F hS ‹_› hF (subset_univ _) (hbdj F)).1 (hno F hF) + exact ⟨Δ, subset_univ _, h1, h2⟩ + have : CompactSpace S := hS.1 + rcases hd with h | h + · exact hsph h.1 + · exact not_isOpenDisc_univ h + +omit [T1Space S] in +/-- `rep(G)` is at most the number of vertices on a `G`-normal non-null-homotopic `O`-arc. -/ +theorem rep_le_of_arc (G : Drawing S) {F : Set S} (hF : IsOArc F) (hn : G.IsNormal F) + (hnull : ¬ IsNullHomotopicOArc F) : G.rep ≤ ((F ∩ G.V).ncard : ℕ) := + sInf_le ⟨F, hF, hn, hnull, rfl⟩ + + +/-- The model `Σ(0, 0, 0)` is the sphere. -/ +theorem isSphere_model : IsSphere (SurfaceModel 0 0 0) := by + have hb : modelBase (2 * 0 + 0 + 0) = univ := by + ext p + simp [modelBase] + have : CompactSpace (modelBase (2 * 0 + 0 + 0)) := + isCompact_iff_compactSpace.1 (hb ▸ isCompact_univ) + have : CompactSpace (SurfaceModel 0 0 0) := + inferInstanceAs (CompactSpace (Quot (ModelGlue 0 0 (2 * 0 + 0 + 0)))) + let f : SurfaceModel 0 0 0 → OnePoint EuclideanPlane := + Quot.lift Subtype.val fun _ _ h ↦ by + cases h with + | handle i hi => exact absurd hi (Nat.not_lt_zero i) + | crosscap i hi => exact absurd hi (Nat.not_lt_zero i) + have hf : Continuous f := continuous_quot_lift _ continuous_subtype_val + have hinj : Function.Injective f := by + rintro ⟨x⟩ ⟨y⟩ h + exact congrArg (Quot.mk _) (Subtype.ext h) + have hsurj : Function.Surjective f := fun p ↦ ⟨Quot.mk _ ⟨p, hb ▸ mem_univ p⟩, rfl⟩ + exact ⟨Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective f ⟨hinj, hsurj⟩) hf⟩ + +/-- A surface homeomorphic to `Σ(a, b, c)` with no boundary has `c = 0`, since the model has at +least +`c` cuffs. -/ +theorem model_c_eq_zero {S : Type u} [TopologicalSpace S] [T2Space S] {a b c : ℕ} + (hom : S ≃ₜ SurfaceModel a b c) (hbd : bd S = ∅) : c = 0 := by + have : T2Space (SurfaceModel a b c) := hom.symm.isEmbedding.t2Space + have h := GM20.Draw.le_encard_cuffs (a := a) (b := b) (c := c) + have hb : bd (SurfaceModel a b c) = ∅ := by + rw [← image_bd hom, hbd, image_empty] + have hc : cuffs (SurfaceModel a b c) = ∅ := by + simp [cuffs, componentsIn, hb] + rw [hc, encard_empty] at h + simpa using h + + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6aProved.lean b/LeanPool/GraphMinor/GM19/Section6aProved.lean new file mode 100644 index 0000000000..b78512a51b --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6aProved.lean @@ -0,0 +1,81 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section6a +public import LeanPool.GraphMinor.Surface.Epstein +public import LeanPool.GraphMinor.GM19.Conditional +public import LeanPool.GraphMinor.GM19.Cited +public import LeanPool.GraphMinor.GM19.Section4c +public import LeanPool.GraphMinor.GM20.Draw10 +import LeanPool.GraphMinor.Surface.OpenDisc + +import LeanPool.GraphMinor.GM07.Bridge + +import LeanPool.GraphMinor.GM07.Section9 + +/-! +# Graph Minors XIX: proved deductions from Section6a + +The deductions use existing proofs after the preliminary geometry has been defined. +-/ + +public section +namespace GraphMinor.GM19 +open Set Topology Metric GraphMinor.Surface GraphMinor.GM07 GraphMinor.GM11 +universe u +variable {S : Type u} [TopologicalSpace S] [T1Space S] + +/-- If `rep(G) ≥ k` then `α(G) ≥ k`: a set that competes for `α(G)` is not planar, so it holds a +non-null-homotopic `O`-arc, and this arc is `G`-normal because the set is. -/ +theorem le_alpha_of_le_rep + (hS : IsSurface S) [ConnectedSpace S] (hbd : bd S = ∅) + (hsph : ¬ IsSphere S) (G : Drawing S) {k : ℕ} (hk : (k : ℕ∞) ≤ G.rep) : k ≤ alpha G := by + have hne : {n : ℕ | ∃ X : Set S, IsAlphaCandidate G X ∧ (X ∩ G.V).ncard = n}.Nonempty := by + obtain ⟨X, hX⟩ := GraphMinor.GM07.gm07_alpha_exists.{u} S hS ‹_› hbd hsph G + exact ⟨_, X, hX, rfl⟩ + obtain ⟨X, ⟨hsol, -, hnorm, hnear⟩, hn⟩ := Nat.sInf_mem hne + have hnp : ¬ IsPlanar X := fun h ↦ hnear (Or.inl h) + obtain ⟨F, hF, hFX, hnull⟩ : ∃ F, IsOArc F ∧ F ⊆ X ∧ ¬ IsNullHomotopicOArc F := by + by_cases hX : X = univ + · obtain ⟨F, hF, hnull⟩ := exists_not_nullHomotopic hS hbd hsph + exact ⟨F, hF, hX ▸ subset_univ F, hnull⟩ + · by_contra hno + push Not at hno + exact hnp ((GraphMinor.GM07.gm07_planar_iff.{u} S hS ‹_› X hsol hX).2 fun F hF hFX ↦ hno F hF + hFX) + have hFn : G.IsNormal F := fun x hx ↦ hnorm ⟨hFX hx.1, hx.2⟩ + have h1 : (k : ℕ∞) ≤ ((F ∩ G.V).ncard : ℕ) := hk.trans (rep_le_of_arc G hF hFn hnull) + have h2 : (F ∩ G.V).ncard ≤ (X ∩ G.V).ncard := + ncard_le_ncard (fun x hx ↦ ⟨hFX hx.1, hx.2⟩) (G.finite_V.subset inter_subset_right) + have h3 : k ≤ (F ∩ G.V).ncard := by exact_mod_cast h1 + change k ≤ sInf {n : ℕ | ∃ X : Set S, IsAlphaCandidate G X ∧ (X ∩ G.V).ncard = n} + omega + +/-- **Graph Minors XIX, (6.4).** The proof uses VII (9.2), VII (5.1), and the proved existence of +`α(G)`. -/ +theorem theorem_6_4_proof : Theorem64Statement.{u} := by + intro S _ hS hconn hbd hsph H _ + have : T2Space S := hS.2.1 + have : Nonempty S := hconn.toNonempty + obtain ⟨a, b, c, ⟨hom⟩⟩ := classification S hS hconn + obtain rfl : c = 0 := model_c_eq_zero hom hbd + have hab : a + b ≥ 1 := by + by_contra hab + obtain rfl : a = 0 := by omega + obtain rfl : b = 0 := by omega + obtain ⟨g⟩ := isSphere_model + exact hsph ⟨hom.trans g⟩ + obtain ⟨DH, rfl⟩ := exists_directed H + obtain ⟨N, hN⟩ := GraphMinor.GM07.gm07_theorem_9_2.{u} S hS a b hab ⟨hom⟩ DH + refine ⟨N, fun G _ hk ↦ ?_⟩ + obtain ⟨DG, rfl⟩ := exists_directed G + exact isEnlargement_of_minor (hN DG (le_alpha_of_le_rep hS hbd hsph _ hk)) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section6b.lean b/LeanPool/GraphMinor/GM19/Section6b.lean new file mode 100644 index 0000000000..c97dab11ae --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section6b.lean @@ -0,0 +1,55 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Conditional +public import LeanPool.GraphMinor.GM19.RadialExists +import LeanPool.GraphMinor.GM19.Section5r +import LeanPool.GraphMinor.GM19.Section6Two + +/-! +# Graph Minors XIX, (6.1) + +Far along a bad sequence, every inflation can be replaced by a linear one with the same edges. So +far +along the sequence there are no inflations at all. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +universe u w + +/-- **Graph Minors XIX, (6.1)** (page 339): "Let $\chi$ satisfy* **S**$_1$, **S**$_3$, *and let* +$(\Gamma_i, \phi_i)$ $(i = 1, 2, \dots)$ +*be a similarly oriented bad sequence for $\chi$. Then there exists $h \ge 1$ such that for +all $j > i \ge h$ there is no inflation of $(\Gamma_i, \phi_i)$ in $(\Gamma_j, \phi_j)$." + +The Lean form uses an infinite ambient label type `β` as in (4.1). The scheme's colour sets +can still be finite. -/ +theorem theorem_6_1_proof + {S Shat : Type u} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {β : Type w} [Infinite β] (cap : IsCappedSurface S Shat) (χ : ColourScheme S β) + (hS1 : ConditionS1.{u, w} Shat) (hS3 : ConditionS3 χ cap) + (P : ℕ → ColouredPainting χ) (hbad : IsBadSequence χ P) (hsim : IsSimilarlyOriented χ P) + (rad : ∀ i, RadialDrawing cap (P i).Γ) : + ∃ h, ∀ i ≥ h, ∀ j > i, ¬ ∃ σv σe, IsColouredInflation χ (P i) (P j) σv σe := by + obtain ⟨n, hn⟩ := theorem_6_2_proof.{u} S Shat cap χ.isSurface + obtain ⟨h, hh⟩ := theorem_5_5_proof.{u, w} S Shat β cap χ hS1 hS3 P hbad hsim rad n + refine ⟨h, fun i hi j hj ⟨σv, σe, hσ⟩ ↦ ?_⟩ + obtain ⟨σv', hσ', -⟩ := hn χ.Φ (P i).Γ (P j).Γ (rad i) (P i).fits (P j).fits (hh i hi).le σv σe + hσ.isInflation hσ.respects + exact hbad i j hj ⟨σv', σe, ⟨⟨hσ'.toIsInflation, hσ.respects, hσ.le_internal_2, + hσ.le_internal_3, hσ.le_border⟩, + hσ'⟩⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section7a.lean b/LeanPool/GraphMinor/GM19/Section7a.lean new file mode 100644 index 0000000000..7aa595ac33 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section7a.lean @@ -0,0 +1,153 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section10b +public import LeanPool.GraphMinor.GM11.Section6 + +/-! +# The slope of a tangle in a painting + +Graph Minors XIX, Section 7, uses the results of Graph Minors XI for the radial drawing `Γ*` of a +painting `Γ`. These results are about a slope in `Γ*`. The painting `Γ` as a subset of `Σ̂` is +neither a +painting nor a drawing in the sense of XI, so `GM11.isSlope_of_derived` does not apply to it. We +repeat its short proof here. The result used later is `TangleDatum.isSlope`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +omit [T2Space S] [T2Space Shat] in +/-- A circuit of `Γ*` of length `< 2 rep(𝒯)` has its inside. -/ +theorem ins_spec (D : TangleDatum cap χ) {F : Drawing Shat} (hF : F.IsCircuitOf D.rad.G) + (hlt : F.E.ncard < 2 * D.rep) : IsInsOf D.rad D.ord D.𝒯 F (D.ins F) := by + have hex : ∃ Δ : Set Shat, IsInsOf D.rad D.ord D.𝒯 F Δ := by + obtain ⟨Δ, h₁, h₂, h₃⟩ := (tangleRep_spec D.rad D.ord D.𝒯).2 F hF hlt + exact ⟨Δ, hF, hlt, h₁, h₂, h₃⟩ + simp only [ins, dite_eq_left hex] + exact Classical.choose_spec hex + +omit [T2Space S] in +/-- Three insides do not cover `Σ̂`, by the second tangle axiom. -/ +theorem not_cover (D : TangleDatum cap χ) {F₁ F₂ F₃ : Drawing Shat} {Δ₁ Δ₂ Δ₃ : Set Shat} + (h₁ : IsInsOf D.rad D.ord D.𝒯 F₁ Δ₁) (h₂ : IsInsOf D.rad D.ord D.𝒯 F₂ Δ₂) + (h₃ : IsInsOf D.rad D.ord D.𝒯 F₃ Δ₃) (hcov : Δ₁ ∪ Δ₂ ∪ Δ₃ = univ) : False := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have c₁ := closure_discInt h₁.2.2.1 + have c₂ := closure_discInt h₂.2.2.1 + have c₃ := closure_discInt h₃.2.2.1 + have hc := part_cover D.rad h₁.1.1 h₂.1.1 h₃.1.1 (isSide_int hT h₁.2.2.1 h₁.2.2.2.1) + (isSide_int hT h₂.2.2.1 h₂.2.2.2.1) (isSide_int hT h₃.2.2.1 h₃.2.2.2.1) (by + intro x + rw [c₁, c₂, c₃] + have hx : x ∈ Δ₁ ∪ Δ₂ ∪ Δ₃ := hcov ▸ mem_univ x + rcases hx with (h | h) | h + · exact Or.inl h + · exact Or.inr (Or.inl h) + · exact Or.inr (Or.inr h)) + rw [c₁, c₂, c₃] at hc + exact D.isTangle.axiom2 h₁.2.2.2.2 h₂.2.2.2.2 h₃.2.2.2.2 hc + +omit [T2Space S] in +/-- `ins` is a slope in `Γ*` of order `rep(𝒯)`. -/ +theorem isSlope (D : TangleDatum cap χ) (hrep : 1 ≤ D.rep) : IsSlope D.rad.G (2 * D.rep) D.ins := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hfr : ∀ C : Drawing Shat, C.IsCircuit → C.IsSubdrawing D.rad.G → C.length < 2 * D.rep → + IsClosedDisc (D.ins C) ∧ frontier (D.ins C) = C.U ∧ IsClosed (D.ins C) ∧ + IsInsOf D.rad D.ord D.𝒯 C (D.ins C) := by + intro C h s l + have hi := D.ins_spec ⟨s, h⟩ l + refine ⟨hi.2.2.1, ?_, hi.2.2.1.isClosed, hi⟩ + rw [IsClosedDisc.frontier_eq_discBd hT hi.2.2.1, hi.2.2.2.1] + have hmono : ∀ C₁ C₂ : Drawing Shat, C₁.IsCircuit → C₁.IsSubdrawing D.rad.G → + C₁.length < 2 * D.rep → C₂.IsCircuit → C₂.IsSubdrawing D.rad.G → C₂.length < 2 * D.rep → + C₁.U ⊆ D.ins C₂ → D.ins C₁ ⊆ D.ins C₂ := by + intro C₁ C₂ h₁ s₁ l₁ h₂ s₂ l₂ hsub + obtain ⟨d₁, f₁, c₁, m₁⟩ := hfr C₁ h₁ s₁ l₁ + obtain ⟨d₂, f₂, c₂, m₂⟩ := hfr C₂ h₂ s₂ l₂ + obtain ⟨Δ, ⟨hΔD, dΔ, bΔ, -⟩, -⟩ := disc_oArc (D.ins C₂) (discBd (D.ins C₁)) d₂ + (by rw [← IsClosedDisc.frontier_eq_discBd hT d₁, f₁]; exact hsub) d₁.isOArc_discBd + by_cases heq : D.ins C₁ = Δ + · exact heq ▸ hΔD + · exfalso + have hcov := cover_of_discBd_eq hT d₁ dΔ bΔ.symm heq + refine D.not_cover m₁ m₂ m₂ (eq_univ_of_univ_subset ?_) + rw [← hcov] + exact fun x hx ↦ hx.elim (fun h ↦ Or.inl (Or.inl h)) fun h ↦ Or.inr (hΔD h) + refine ⟨by omega, fun C h s l ↦ (hfr C h s l).1, fun C h s l ↦ ?_, hmono, ?_⟩ + · rw [subBd_eq_frontier] + exact (hfr C h s l).2.1 + intro P₀ P₁ P₂ a b hP₀ hP₁ hP₂ s₀ s₁ s₂ p₀ p₁ p₂ v₀₁ v₁₂ v₂₀ e₀₁ e₁₂ e₂₀ l₀ l₁ l₂ + have hab := ne_of_isPathBetween hP₀ p₀ + have supU : ∀ {P Q : Drawing Shat}, P.IsSubdrawing D.rad.G → Q.IsSubdrawing D.rad.G → + (D.rad.G.sup P Q).U = P.U ∪ Q.U := by + intro P Q hP hQ + rw [Drawing.U_eq, Drawing.sup_V hP hQ, Drawing.sup_E hP hQ, P.U_eq, Q.U_eq, biUnion_union] + ext x + simp only [mem_union] + tauto + have circ : ∀ {P Q : Drawing Shat}, P.IsPathBetween a b → Q.IsPathBetween a b → + P.IsSubdrawing D.rad.G → Q.IsSubdrawing D.rad.G → P.V ∩ Q.V = {a, b} → Disjoint P.E Q.E → + (D.rad.G.sup P Q).IsCircuit ∧ (D.rad.G.sup P Q).IsSubdrawing D.rad.G := fun hP hQ sP sQ v e ↦ + ⟨Drawing.isCircuit_sup hP hQ sP sQ hab v e, Drawing.sup_isSubdrawing _ _ _⟩ + obtain ⟨c₀, ss₀⟩ := circ hP₁ hP₂ s₁ s₂ v₁₂ e₁₂ + obtain ⟨c₁, ss₁⟩ := circ hP₂ hP₀ s₂ s₀ v₂₀ e₂₀ + obtain ⟨c₂, ss₂⟩ := circ hP₀ hP₁ s₀ s₁ v₀₁ e₀₁ + obtain ⟨d₀, f₀, cl₀, m₀⟩ := hfr _ c₀ ss₀ l₀ + obtain ⟨d₁, f₁, cl₁, m₁⟩ := hfr _ c₁ ss₁ l₁ + obtain ⟨d₂, f₂, cl₂, m₂⟩ := hfr _ c₂ ss₂ l₂ + rw [supU s₁ s₂] at f₀ + rw [supU s₂ s₀] at f₁ + rw [supU s₀ s₁] at f₂ + have sub : ∀ {Δ F : Set Shat}, IsClosed Δ → frontier Δ = F → F ⊆ Δ := fun c h ↦ + h ▸ c.frontier_subset + have sb₀ := sub cl₀ f₀ + have sb₁ := sub cl₁ f₁ + have sb₂ := sub cl₂ f₂ + by_cases h₀ : P₀.U ⊆ D.ins (D.rad.G.sup P₁ P₂) + · refine Or.inl ⟨hmono _ _ c₁ ss₁ l₁ c₀ ss₀ l₀ ?_, hmono _ _ c₂ ss₂ l₂ c₀ ss₀ l₀ ?_⟩ + · rw [supU s₂ s₀] + exact union_subset (subset_union_right.trans sb₀) h₀ + · rw [supU s₀ s₁] + exact union_subset h₀ (subset_union_left.trans sb₀) + by_cases h₁ : P₁.U ⊆ D.ins (D.rad.G.sup P₂ P₀) + · refine Or.inr (Or.inl ⟨hmono _ _ c₀ ss₀ l₀ c₁ ss₁ l₁ ?_, hmono _ _ c₂ ss₂ l₂ c₁ ss₁ l₁ ?_⟩) + · rw [supU s₁ s₂] + exact union_subset h₁ (subset_union_left.trans sb₁) + · rw [supU s₀ s₁] + exact union_subset (subset_union_right.trans sb₁) h₁ + by_cases h₂ : P₂.U ⊆ D.ins (D.rad.G.sup P₀ P₁) + · refine Or.inr (Or.inr ⟨hmono _ _ c₀ ss₀ l₀ c₂ ss₂ l₂ ?_, hmono _ _ c₁ ss₁ l₁ c₂ ss₂ l₂ ?_⟩) + · rw [supU s₁ s₂] + exact union_subset (subset_union_right.trans sb₂) h₂ + · rw [supU s₂ s₀] + exact union_subset h₂ (subset_union_left.trans sb₂) + exfalso + have hcov := theta_cover hT (isLine_of_isPathBetween hP₀ hab) (isLine_of_isPathBetween hP₁ hab) + (isLine_of_isPathBetween hP₂ hab) (by rw [U_inter_of_disjoint s₀ s₁ e₀₁, v₀₁]) + (by rw [U_inter_of_disjoint s₁ s₂ e₁₂, v₁₂]) (by rw [U_inter_of_disjoint s₂ s₀ e₂₀, v₂₀]) + d₀ d₁ d₂ f₀ f₁ f₂ h₀ h₁ h₂ + exact D.not_cover m₀ m₁ m₂ hcov + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section7b.lean b/LeanPool/GraphMinor/GM19/Section7b.lean new file mode 100644 index 0000000000..86a16c52e4 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section7b.lean @@ -0,0 +1,149 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section7a + +/-! +# Regions of a radial drawing + +Each region of `Γ*` contains a unique edge of `Γ`, and the vertices of `Γ` on its closure are the +ends +of that edge. Graph Minors XI, Section 3, says this for its own paintings and drawings. For a +painting +of Graph Minors XIX we get it from the colouring of `Section8e.lean`: two regions of `G₃` of +different +colours are parted by an edge of `Γ*`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} + +/-- The facts about the regions of `Γ*`. -/ +theorem RadialDrawing.region_facts (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (rad : RadialDrawing cap Γ) : + (∀ s ∈ rad.G.R, ∃ e ∈ Γ.E, cap.emb '' e ⊆ s) ∧ + (∀ s ∈ rad.G.R, ∀ e ∈ Γ.E, ∀ f ∈ Γ.E, cap.emb '' e ⊆ s → cap.emb '' f ⊆ s → e = f) ∧ + ∀ s ∈ rad.G.R, ∀ e ∈ Γ.E, cap.emb '' e ⊆ s → ∀ v ∈ Γ.V, cap.emb v ∈ closure s → + v ∈ closure e := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + have h2 := h3.hatRegions_isOpenDisc hS cap + obtain ⟨D, G₃, hD, hrad, hmax, hsub, hhat⟩ := rad.exists_full hS h2 h3.1 + have hDE := hD.E_nonempty h3.1 + have hF := regionFacts_of_radial hrad hT hmax hDE + have hUsub : rad.G.U ⊆ G₃.U := fun x hx ↦ by + by_cases hxV : x ∈ rad.G.V + · exact G₃.V_subset_U (hsub.1 hxV) + · obtain ⟨e, he, hxe⟩ := rad.G.exists_edge_of_mem hx hxV + rw [G₃.U_eq] + exact Or.inr (mem_iUnion₂.mpr ⟨e, hsub.2 he, subset_closure hxe⟩) + -- A region of `G₃` that meets a region of `Γ*` lies in it. + have hin : ∀ {s p : Set Shat}, s ∈ rad.G.R → p ∈ G₃.R → (p ∩ s).Nonempty → p ⊆ s := by + intro s p hs hp ⟨x, hxp, hxs⟩ + exact subset_region hs (region_isPreconnected hp) + (disjoint_left.mpr fun y hy h ↦ region_subset hp hy (hUsub h)) hxp hxs + -- All regions of `G₃` in a region of `Γ*` have the same colour. + have hsame : ∀ {s p q : Set Shat}, s ∈ rad.G.R → p ∈ G₃.R → q ∈ G₃.R → p ⊆ s → q ⊆ s → + ∀ {f f' c c' : Set S}, Γ.IsSkEdgeIn f c → Γ.IsSkEdgeIn f' c' → cap.emb '' f ⊆ p → + cap.emb '' f' ⊆ q → c = c' := by + intro s p q hs hp hq hps hqs f f' c c' hc hc' hfp hfq + by_contra hne + let t : Set S → Prop := (· = c) + have hpZ : p ∈ colourSet cap Γ G₃ t := ⟨hp, f, c, hc, hfp, rfl⟩ + have hqZ : q ∈ G₃.R \ colourSet cap Γ G₃ t := by + refine ⟨hq, ?_⟩ + rintro ⟨-, f₂, c₂, h₂, hf₂, ht⟩ + exact hne (ht ▸ (colour_unique hD hrad hmax hDE hq hc' h₂ hfq hf₂).2).symm + obtain ⟨xp, hxp⟩ := region_nonempty hp + obtain ⟨xq, hxq⟩ := region_nonempty hq + obtain ⟨e, he, y, hye, hys⟩ := exists_boundary_edge hT (region_isOpen hs) + (region_isPreconnected hs) hpZ (fun _ h ↦ h.1) hqZ ⟨xp, hxp, hps hxp⟩ ⟨xq, hxq, hqs hxq⟩ + have heG := (boundary_split hS hDE rad hD hrad hmax hsub hhat he).1 + have hyU : y ∈ rad.G.U := by + rw [rad.G.U_eq] + exact Or.inr (mem_iUnion₂.mpr ⟨e, heG, subset_closure hye⟩) + exact region_subset hs hys hyU + -- An edge of `Γ` in `s` has an edge of `sk(Γ)` in a region of `G₃` in `s`. + have hreg : ∀ {s : Set Shat} {e : Set S}, s ∈ rad.G.R → e ∈ Γ.E → cap.emb '' e ⊆ s → + ∃ f p, Γ.IsSkEdgeIn f e ∧ p ∈ G₃.R ∧ p ⊆ s ∧ cap.emb '' f ⊆ p := by + intro s e hs he hes + obtain ⟨f, hf⟩ := Γ.exists_sk_in he + have hg := hD.edge_iff.mpr ⟨f, hf.mem, rfl⟩ + have hdis : Disjoint (cap.emb '' f) G₃.U := by + refine disjoint_left.mpr fun y hy hyU ↦ ?_ + have hyD := hg.2.1 hy + have : y ∈ D.U ∩ G₃.U := ⟨hyD.1, hyU⟩ + rw [show D.U ∩ G₃.U = D.V from hrad.2.1] at this + exact hyD.2 this + obtain ⟨y, hy⟩ := hg.1 + obtain ⟨p, hp, hyp⟩ := exists_region_of_notMem (disjoint_left.mp hdis hy) + have hyf : y ∈ cap.emb '' e := image_mono hf.subset hy + exact ⟨f, p, hf, hp, hin hs hp ⟨y, hyp, hes hyf⟩, + subset_region hp hg.2.2.1.isConnected.isPreconnected hdis hy hyp⟩ + refine ⟨?_, ?_, ?_⟩ + · intro s hs + obtain ⟨y, hyO⟩ := region_nonempty hs + obtain ⟨z, hzs, hzU⟩ := exists_notMem_U (Γ := G₃) hT (region_isOpen hs) + ⟨y, hyO⟩ + obtain ⟨p, hp, hzp⟩ := exists_region_of_notMem hzU + have hps := hin hs hp ⟨z, hzp, hzs⟩ + obtain ⟨f, c, hc, hfp⟩ := exists_colour hD hrad hmax hDE hp + refine ⟨c, hc.1, ?_⟩ + obtain ⟨x, hx⟩ := hc.mem.1 + have hdis : Disjoint (cap.emb '' c) rad.G.U := by + refine disjoint_left.mpr ?_ + rintro _ ⟨y, hy, rfl⟩ hyU + have : cap.emb y ∈ Γ.hatU cap ∩ rad.G.U := ⟨mem_image_of_mem _ (hc.1.2.1 hy).1, hyU⟩ + rw [rad.isPreRadial.1] at this + obtain ⟨y', hy', hyy⟩ := this + obtain rfl := cap.isEmbedding.injective hyy + exact (hc.1.2.1 hy).2 hy' + exact subset_region hs (hc.1.2.2.1.isConnected.isPreconnected.image _ + cap.isEmbedding.continuous.continuousOn) hdis (mem_image_of_mem _ (hc.subset hx)) + (hps (hfp (mem_image_of_mem _ hx))) + · intro s hs e he f hf hes hfs + obtain ⟨a, p, ha, hp, hps, hap⟩ := hreg hs he hes + obtain ⟨b, q, hb, hq, hqs, hbq⟩ := hreg hs hf hfs + exact hsame hs hp hq hps hqs ha hb hap hbq + · intro s hs e he hes v hv hvs + obtain ⟨a, p, ha, hp, hps, hap⟩ := hreg hs he hes + have hRfin := finite_R hT G₃ + have hcov : s ⊆ closure (⋃ q ∈ {q | q ∈ G₃.R ∧ q ⊆ s}, q) := by + intro x hx + refine mem_closure_iff.mpr fun O hO hxO ↦ ?_ + obtain ⟨y, ⟨hyO, hys⟩, hyU⟩ := exists_notMem_U (Γ := G₃) hT + (hO.inter (region_isOpen hs)) ⟨x, hxO, hx⟩ + obtain ⟨q, hq, hyq⟩ := exists_region_of_notMem hyU + exact ⟨y, hyO, mem_iUnion₂.mpr ⟨q, ⟨hq, hin hs hq ⟨y, hyq, hys⟩⟩, hyq⟩⟩ + have hv' := closure_minimal hcov isClosed_closure hvs + have hfin : {q | q ∈ G₃.R ∧ q ⊆ s}.Finite := hRfin.subset fun _ h ↦ h.1 + rw [hfin.closure_biUnion] at hv' + obtain ⟨q, ⟨hq, hqs⟩, hvq⟩ := mem_iUnion₂.mp hv' + obtain ⟨f, c, hc, hfq⟩ := exists_colour hD hrad hmax hDE hq + obtain rfl := hsame hs hp hq hps hqs ha hc hap hfq + have hg := hD.edge_iff.mpr ⟨f, hc.mem, rfl⟩ + have hvD : cap.emb v ∈ D.V := by + rw [hD.hV] + exact mem_image_of_mem _ hv + have := hF.2.2 q hq _ hg hfq _ hvD hvq + rw [(cap.isClosedEmbedding hS).closure_image_eq] at this + obtain ⟨y, hy, hyv⟩ := this + obtain rfl := cap.isEmbedding.injective hyv + exact closure_mono hc.subset hy + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section7c.lean b/LeanPool/GraphMinor/GM19/Section7c.lean new file mode 100644 index 0000000000..9413056ba2 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section7c.lean @@ -0,0 +1,298 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section7b +import LeanPool.GraphMinor.GM10.TangleLemmas +import LeanPool.GraphMinor.GM11.Section6Pretangle + +/-! +# A short circuit around each edge of a painting + +Let `e` be an edge of `Γ`, and let `s` be the region of `Γ*` that contains `e`. The hypergraph `Γ` +has the +separation that splits off `e` with its ends. It has order at most 3, and the tangle holds it with +`e` on +the small side, by the third tangle axiom. The result of this file is +`TangleDatum.exists_circuit_around`: +some circuit of `Γ*` of length at most 6 has `s` in its inside. The proof is the proof of (6.3) of +Graph +Minors XI. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +theorem _root_.GraphMinor.GM10.IsTangle.toPretangle {α β : Type*} {G : Hypergraph α β} {θ : ℕ} + {T : Set (Hypergraph α β × Hypergraph α β)} (h : IsTangle G θ T) : IsPretangle G θ T := + ⟨h.one_le, h.isSeparation, h.order_lt, h.axiom1, h.axiom2⟩ + +/-- The subhypergraph of `Γ` obtained by deleting the edge `g`, and keeping all vertices. -/ +def Painting.deleteEdge (Γ : Painting S) (g : Set S) : Hypergraph S (Set S) where + vertexSet := Γ.V + edgeSet := Γ.E \ {g} + Inc e v := (e ∈ Γ.E \ {g}) ∧ v ∈ Γ.V ∧ v ∈ tilde e + vertex_mem_of_inc _ _ h := h.2.1 + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := Γ.finite_V + edgeSet_finite := Γ.finite_edges.subset sdiff_subset + +omit [T2Space S] in +theorem Painting.deleteEdge_le (Γ : Painting S) (g : Set S) : Γ.deleteEdge g ≤ Γ.toHypergraph where + vertexSet_subset := subset_rfl + edgeSet_subset _ he := he.1 + ends_eq _ he := by + ext v + exact ⟨fun h ↦ ⟨he, h.2.1, h.2.2⟩, fun h ↦ ⟨he.1, h.2.1, h.2.2⟩⟩ + +omit [T2Space S] in +/-- An edge `e` of `Γ` lies in `closure g` only if it is `g`. -/ +theorem Painting.eq_of_subset_closure (Γ : Painting S) {e g : Set S} (he : e ∈ Γ.E) (hg : g ∈ Γ.E) + (hsub : e ⊆ closure g) : e = g := by + obtain ⟨x, hx⟩ := he.1 + have hxg : x ∈ g := by + by_contra hn + exact Γ.disjoint_V he hx (Γ.tilde_subset_V hg ⟨hsub hx, hn⟩) + exact arcComp_eq_of_mem he hg hx hxg + +omit [T2Space S] in +/-- The separation of `Γ` that splits off the edge `g`. -/ +theorem Painting.isSeparation_edge (Γ : Painting S) {g : Set S} (hg : g ∈ Γ.E) : + Γ.toHypergraph.IsSeparation (Γ.restrict (closure g)) (Γ.deleteEdge g) ∧ + (Γ.restrict (closure g) ∩ Γ.deleteEdge g).vertexSet = tilde g := by + have hcl : ∀ {x}, x ∈ Γ.V → x ∈ closure g → x ∈ tilde g := fun hx hc ↦ + ⟨hc, fun hxg ↦ Γ.disjoint_V hg hxg hx⟩ + constructor + · rw [isSeparation_iff_of_le (Γ.restrict_le _) (Γ.deleteEdge_le g)] + refine ⟨?_, ?_, ?_⟩ + · exact Subset.antisymm (union_subset inter_subset_left subset_rfl) subset_union_right + · apply Subset.antisymm + · exact union_subset (Γ.restrict_le _).edgeSet_subset (Γ.deleteEdge_le g).edgeSet_subset + · intro e he + by_cases heg : e = g + · subst heg + exact Or.inl ⟨he, subset_closure, fun x hx ↦ hx.1.1⟩ + · exact Or.inr ⟨he, heg⟩ + · refine eq_empty_of_forall_notMem ?_ + rintro e ⟨⟨he, hsub, -⟩, -, hn⟩ + exact hn (Γ.eq_of_subset_closure he hg hsub) + · ext x + constructor + · rintro ⟨⟨hx, hc⟩, -⟩ + exact hcl hx hc + · intro hx + have hV := Γ.tilde_subset_V hg hx + exact ⟨⟨hV, hx.1⟩, hV⟩ + +omit [T2Space S] in +theorem Painting.ncard_tilde_le (Γ : Painting S) {g : Set S} (hg : g ∈ Γ.E) : (tilde g).ncard ≤ 3 + := by + rcases Γ.size_cases hg with h | h <;> omega + +omit [T2Space S] [T2Space Shat] in +/-- `Γ*` is bipartite. -/ +theorem RadialDrawing.bipartite {Γ : Painting S} (rad : RadialDrawing cap Γ) {D : Drawing Shat} + (hV : D.V = Γ.hatV cap) : ∀ e x y, rad.G.toGraph.IsLink e x y → (x ∈ D.V ↔ y ∉ D.V) := by + rw [hV] + intro e x y hl + obtain ⟨v, hv, w, ⟨-, hw⟩, hcap⟩ := rad.isPreRadial.2.2.2.2.1 e hl.1 + have heq : ({x, y} : Set Shat) = {v, w} := hl.2.2.2.symm.trans hcap + have hx : x ∈ ({v, w} : Set Shat) := heq ▸ mem_insert x _ + have hy : y ∈ ({v, w} : Set Shat) := heq ▸ mem_insert_of_mem x rfl + have hv' : v ∈ ({x, y} : Set Shat) := heq ▸ mem_insert v _ + have hw' : w ∈ ({x, y} : Set Shat) := heq ▸ mem_insert_of_mem v rfl + rcases hx with rfl | rfl + · rcases hw' with rfl | rfl + · exact absurd hv hw + · exact ⟨fun _ ↦ hw, fun _ ↦ hv⟩ + · rcases hy with rfl | rfl + · exact ⟨fun h ↦ absurd h hw, fun h ↦ absurd hv h⟩ + · rcases hv' with rfl | rfl <;> exact absurd hv hw + +namespace TangleDatum + +/-- The inside of a short circuit `C` of `Γ*` gives a member of the tangle whose middle lies in +`tilde g`, if the vertices of `Γ` on `C` lie in `tilde g`. -/ +theorem ins_middle (D : TangleDatum cap χ) {C : Drawing Shat} (hC : C.IsCircuitOf D.rad.G) + (hlt : C.E.ncard < 2 * D.rep) {g : Set S} + (hV : ∀ v ∈ D.P.Γ.V, cap.emb v ∈ C.V → v ∈ tilde g) : + ∀ v ∈ (D.P.Γ.restrict (cap.emb ⁻¹' D.ins C) ∩ + D.P.Γ.restrict (cap.emb ⁻¹' closure (D.ins C)ᶜ)).vertexSet, v ∈ tilde g := by + have : ConnectedSpace Shat := cap.connected + have hi := D.ins_spec hC hlt + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + intro v hv + have hvU := (disc_facts hS h3 D.rad hC hi.2.2.1 hi.2.2.2.1).2.1 v hv + have hvV : v ∈ D.P.Γ.V := hv.1.1 + refine hV v hvV (mem_V_of_mem_U hC.1 hvU ?_) + exact D.rad.isPreRadial.2.1 (mem_image_of_mem _ hvV) + +omit [T2Space S] [T2Space Shat] in +/-- An edge of `Γ` in the inside of a circuit is an edge of the part of `Γ` there. -/ +theorem edge_mem_ins (D : TangleDatum cap χ) {e : Set S} (he : e ∈ D.P.Γ.E) {Δ : Set Shat} + (hΔ : IsClosed Δ) (h : cap.emb '' e ⊆ Δ) : + e ∈ (D.P.Γ.restrict (cap.emb ⁻¹' Δ)).edgeSet := by + refine ⟨he, fun x hx ↦ h (mem_image_of_mem _ hx), fun v hv ↦ ?_⟩ + have h₁ : cap.emb v ∈ closure (cap.emb '' e) := + image_closure_subset_closure_image cap.isEmbedding.continuous (mem_image_of_mem _ hv.1.1) + exact closure_minimal h hΔ h₁ + +/-- **The circuit around an edge.** Let `s` be the region of `Γ*` that contains the edge `g` of `Γ`. +Then +some circuit of `Γ*` of length at most 6 has `s` in its inside. -/ +theorem exists_circuit_around (D : TangleDatum cap χ) (hrep : 4 ≤ D.rep) {g : Set S} + (hg : g ∈ D.P.Γ.E) {s : Set Shat} (hs : s ∈ D.rad.G.R) (hgs : cap.emb '' g ⊆ s) : + ∃ F : Drawing Shat, F.IsCircuitOf D.rad.G ∧ F.E.ncard ≤ 6 ∧ s ⊆ D.ins F := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hS := χ.isSurface + have h3 := D.P.fits.internally_three_connected + set Γ := D.P.Γ with hΓ + set G := D.rad.G with hG + have hsl : IsSlope G (2 * D.rep) D.ins := D.isSlope (by omega) + obtain ⟨hf₁, hf₂, hf₃⟩ := D.rad.region_facts hS h3 + obtain ⟨Sk, hSk⟩ := exists_isSkHat hS cap Γ + have hbip := D.rad.bipartite hSk.hV + have hVG : Sk.V ⊆ G.V := by + rw [hSk.hV] + exact D.rad.isPreRadial.2.1 + have hw : IsWeighting G (2 * D.rep) Sk.V D.rep := + isWeighting_radial (Γ := PaintingOrDrawing.drawing Sk) (by omega) hVG hbip + -- A vertex of `Γ` on the boundary of `s` is an end of `g`. + have hend : ∀ {x}, x ∈ Sk.V → x ∈ closure s → ∃ v ∈ tilde g, cap.emb v = x := by + intro x hx hcl + rw [hSk.hV] at hx + obtain ⟨v, hv, rfl⟩ := hx + exact ⟨v, ⟨hf₃ s hs g hg hgs v hv hcl, fun h ↦ Γ.disjoint_V hg h hv⟩, rfl⟩ + have hNV : ∀ {x}, x ∈ Sk.V ∩ (boundaryDrawing G {s}).V → ∃ v ∈ tilde g, cap.emb v = x := by + rintro x ⟨hx, hxN⟩ + obtain ⟨⟨r, hr, hir⟩, -⟩ := (mem_boundaryDrawing_V hT).mp hxN + obtain rfl : r = s := hr + exact hend hx hir.2.2 + have hNV' : ∀ {x}, x ∈ Sk.V ∩ (boundaryDrawing G (G.R \ {s})).V → + ∃ v ∈ tilde g, cap.emb v = x := by + rintro x ⟨hx, hxN⟩ + obtain ⟨-, r, ⟨hr, hrZ⟩, hir⟩ := (mem_boundaryDrawing_V hT).mp hxN + have hrs : r = s := by + by_contra hne + exact hrZ ⟨hr, hne⟩ + obtain rfl := hrs + exact hend hx hir.2.2 + have hfinT : (cap.emb '' tilde g).Finite := ((Γ.tilde_subset_V hg |>.trans Subset.rfl) |> + Γ.finite_V.subset).image _ + have hcard : (cap.emb '' tilde g).ncard ≤ 3 := + (ncard_image_le (Γ.finite_V.subset (Γ.tilde_subset_V hg))).trans (Γ.ncard_tilde_le hg) + have hlt : (Sk.V ∩ (boundaryDrawing G {s}).V).ncard < D.rep := by + refine lt_of_le_of_lt (ncard_le_ncard ?_ hfinT) (by omega) + intro x hx + obtain ⟨v, hv, rfl⟩ := hNV hx + exact mem_image_of_mem _ hv + rcases (theorem_5_2_proof hT hsl hw (Z := {s}) + (singleton_subset_iff.mpr hs) hlt).1 with hsm | hsm + · obtain ⟨C, hC, hCN, hl, hin⟩ := hsm.2 s rfl + refine ⟨C, ⟨hCN.trans (Drawing.span_isSubdrawing G _ _), hC⟩, ?_, hin⟩ + have halt : ∀ e x y, C.toGraph.IsLink e x y → (x ∈ Sk.V ↔ y ∉ Sk.V) := by + intro e x y hl' + have hCG := hCN.trans (Drawing.span_isSubdrawing G _ _) + refine hbip e x y ⟨hCG.2 hl'.1, hCG.1 hl'.2.1, hCG.1 hl'.2.2.1, ?_⟩ + rw [← hCG.closure_inter_V hl'.1] + exact hl'.2.2.2 + have h₁ := IsCircuit.ncard_le hC halt + have h₂ : (C.V ∩ Sk.V).ncard ≤ (cap.emb '' tilde g).ncard := by + refine ncard_le_ncard ?_ hfinT + rintro x ⟨hxC, hxS⟩ + obtain ⟨v, hv, rfl⟩ := hNV ⟨hxS, hCN.1 hxC⟩ + exact mem_image_of_mem _ hv + omega + exfalso + obtain ⟨hsep, hmid⟩ := Γ.isSeparation_edge hg + have hord : Hypergraph.separationOrder (Γ.restrict (closure g)) (Γ.deleteEdge g) < D.ord := by + have h₁ : Hypergraph.separationOrder (Γ.restrict (closure g)) (Γ.deleteEdge g) ≤ 3 := by + rw [Hypergraph.separationOrder, hmid] + exact Γ.ncard_tilde_le hg + have h₂ := (tangleRep_spec D.rad D.ord D.𝒯).1 + change D.rep ≤ D.ord at h₂ + omega + have hAB : (Γ.restrict (closure g), Γ.deleteEdge g) ∈ D.𝒯 := by + rcases D.isTangle.axiom1 hsep hord with h | h + · exact h + · exact (D.isTangle.axiom3 h rfl).elim + -- The region of each other edge has a circuit around it. + have hcirc : ∀ e : Set S, e ∈ Γ.E \ {g} → ∃ C : Drawing Shat, C.IsCircuitOf G ∧ + C.E.ncard < 2 * D.rep ∧ (∀ v ∈ Γ.V, cap.emb v ∈ C.V → v ∈ tilde g) ∧ + cap.emb '' e ⊆ D.ins C := by + rintro e ⟨he, heg⟩ + have hoff : Disjoint (cap.emb '' e) G.U := disc_edge_disjoint D.rad ⟨subset_rfl, subset_rfl⟩ he + obtain ⟨x, hx⟩ := he.1 + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem + (disjoint_left.mp hoff (mem_image_of_mem _ hx)) + have her : cap.emb '' e ⊆ r := subset_region hr (he.2.2.1.isConnected.isPreconnected.image _ + cap.isEmbedding.continuous.continuousOn) hoff (mem_image_of_mem _ hx) hxr + have hrs : r ≠ s := fun h ↦ heg (hf₂ s hs e he g hg (h ▸ her) hgs) + obtain ⟨C, hC, hCN, hl, hin⟩ := hsm.2 r ⟨hr, hrs⟩ + refine ⟨C, ⟨hCN.trans (Drawing.span_isSubdrawing G _ _), hC⟩, hl, fun v hv hvC ↦ ?_, + her.trans hin⟩ + have hvS : cap.emb v ∈ Sk.V := by + rw [hSk.hV] + exact mem_image_of_mem _ hv + obtain ⟨v', hv', hvv⟩ := hNV' ⟨hvS, hCN.1 hvC⟩ + obtain rfl := cap.isEmbedding.injective hvv + exact hv' + have : Nonempty (Drawing Shat) := ⟨G⟩ + choose! C hC using hcirc + let sepOf : Set S → Hypergraph S (Set S) × Hypergraph S (Set S) := fun e ↦ + (Γ.restrict (cap.emb ⁻¹' D.ins (C e)), Γ.restrict (cap.emb ⁻¹' closure (D.ins (C e))ᶜ)) + let L : List (Hypergraph S (Set S) × Hypergraph S (Set S)) := + (Γ.restrict (closure g), Γ.deleteEdge g) :: + ((Γ.finite_edges.subset (sdiff_subset (t := {g}))).toFinset.toList.map sepOf) + have hmem : ∀ {e}, e ∈ Γ.E \ {g} → sepOf e ∈ L := fun he ↦ + List.mem_cons_of_mem _ (List.mem_map.mpr ⟨_, Finset.mem_toList.mpr + ((Set.Finite.mem_toFinset _).mpr he), rfl⟩) + have hspec : ∀ {e}, e ∈ Γ.E \ {g} → IsInsOf D.rad D.ord D.𝒯 (C e) (D.ins (C e)) := fun he ↦ + D.ins_spec (hC _ he).1 (hC _ he).2.1 + refine theorem_6_2_proof D.isTangle.toPretangle hAB L ?_ ?_ ?_ ?_ + · intro p hp + rcases List.mem_cons.mp hp with rfl | hp + · exact hAB + · obtain ⟨e, he, rfl⟩ := List.mem_map.mp hp + have he' : e ∈ Γ.E \ {g} := (Set.Finite.mem_toFinset _).mp (Finset.mem_toList.mp he) + exact (hspec he').2.2.2.2 + · intro p hp x hx + rcases List.mem_cons.mp hp with rfl | hp + · exact hx + · obtain ⟨e, he, rfl⟩ := List.mem_map.mp hp + have he' : e ∈ Γ.E \ {g} := (Set.Finite.mem_toFinset _).mp (Finset.mem_toList.mp he) + rw [hmid] + exact D.ins_middle (hC _ he').1 (hC _ he').2.1 (hC _ he').2.2.1 x hx + · intro v hv + by_cases hvg : v ∈ tilde g + · exact ⟨_, List.mem_cons_self .., ⟨hv, hvg.1⟩⟩ + obtain ⟨c, hc, hvc⟩ := exists_edge_incident hS h3 D.rad hv + have hcg : c ≠ g := fun h ↦ hvg ⟨h ▸ hvc, fun hxg ↦ Γ.disjoint_V hg hxg hv⟩ + have hc' : c ∈ Γ.E \ {g} := ⟨hc, hcg⟩ + refine ⟨_, hmem hc', hv, ?_⟩ + have h₁ : cap.emb v ∈ closure (cap.emb '' c) := + image_closure_subset_closure_image cap.isEmbedding.continuous (mem_image_of_mem _ hvc) + exact closure_minimal (hC _ hc').2.2.2 (hspec hc').2.2.1.isClosed h₁ + · intro e he + exact ⟨_, hmem he, D.edge_mem_ins he.1 (hspec he).2.2.1.isClosed (hC _ he).2.2.2⟩ + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section7d.lean b/LeanPool/GraphMinor/GM19/Section7d.lean new file mode 100644 index 0000000000..0b64469ff7 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section7d.lean @@ -0,0 +1,237 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section7c +public import LeanPool.GraphMinor.GM11.Section91 +public import LeanPool.GraphMinor.GM11.Section810 +public import LeanPool.GraphMinor.GM14.Section5 + +/-! +# Closed walks of the radial drawing, and restraints + +Graph Minors XIX, Section 7, defines the metric of a tangle by closed walks of `Γ*`. Graph Minors XI +works +with restraints. This file connects the two. A closed walk of length `< 2 rep(𝒯)` gives a restraint, +by +(8.5) of XI, and each restraint comes from a closed walk, by (8.3) of XI. The paper uses the ties of +(9.2) +of XI at this point, and (8.3) makes that detour unnecessary. + +The results used later are `ClosedWalkIns.ins_eq_insWalk`, `TangleDatum.exists_walk_of_restraint`, +`TangleDatum.dist_le`, `TangleDatum.exists_of_dist_lt`, and the facts about atoms at the end. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +/-- Along a walk of a graph with two sides, the number of steps is even if and only if the two ends +are on +the same side. -/ +theorem even_length_iff {α β : Type*} {G : Graph α β} (X : Set α) + (hb : ∀ e x y, G.IsLink e x y → (x ∈ X ↔ y ∉ X)) {u v : α} (W : GraphWalk G u v) : + Even W.length ↔ (u ∈ X ↔ v ∈ X) := by + induction W with + | nil _ => simp [GraphWalk.length, GraphWalk.edges] + | @cons a y b e hl r ih => + have h₁ := hb e a y hl + have hlen : (GraphWalk.cons hl r).length = r.length + 1 := rfl + rw [hlen, Nat.even_add_one, ih] + tauto + +section Radial + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} + +omit [T2Space Shat] in +/-- If an edge of `Γ*` meets a region of `Γ`, then the vertex of `Γ*` in that region is an end of +the +edge. -/ +theorem RadialDrawing.center_mem_closure (hS : IsSurface S) (rad : RadialDrawing cap Γ) {e ρ : Set + Shat} + {w : Shat} (he : e ∈ rad.G.E) (hρ : ρ ∈ Γ.hatRegions cap) (hm : (e ∩ ρ).Nonempty) (hw : w ∈ ρ) + (hwG : w ∈ rad.G.V) : w ∈ closure e := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + obtain ⟨hG1, hG2, hG3, hG4, hG5, -⟩ := id rad.isPreRadial + obtain ⟨v, hv, w', ⟨hw'G, hw'n⟩, hcap⟩ := hG5 e he + obtain ⟨r', hr', hw'r⟩ := hG4 w' ⟨hw'G, hw'n⟩ + obtain ⟨Sk, hSk⟩ := exists_isSkHat hS cap Γ + have hρD := hSk.hatRegion_mem_R hρ + have hrD := hSk.hatRegion_mem_R hr' + have hdis : ∀ y ∈ e, y ∉ Γ.hatU cap := by + intro y hy hyU + have hyG : y ∈ rad.G.U := by + rw [rad.G.U_eq] + exact Or.inr (mem_iUnion₂.mpr ⟨e, he, subset_closure hy⟩) + have : y ∈ Γ.hatU cap ∩ rad.G.U := ⟨hyU, hyG⟩ + rw [hG1] at this + exact (he.2.1 hy).2 (hG2 this) + have hpre : IsPreconnected e := he.2.2.1.isConnected.isPreconnected + have hin : ∀ {r : Set Shat}, r ∈ Γ.hatRegions cap → (e ∩ r).Nonempty → e ⊆ r := by + rintro r ⟨x, hx, rfl⟩ ⟨y, hye, hyr⟩ + rw [connectedComponentIn_eq hyr] + exact hpre.subset_connectedComponentIn hye hdis + have hw'cl : w' ∈ closure e := by + have : w' ∈ closure e ∩ rad.G.V := by rw [hcap]; exact Or.inr rfl + exact this.1 + obtain ⟨y, hyO, hye⟩ := mem_closure_iff.mp hw'cl r' (region_isOpen hrD) hw'r + have h₁ := hin hr' ⟨y, hye, hyO⟩ + have h₂ := hin hρ hm + have hreq : r' = ρ := region_eq_of_mem hrD hρD (h₁ hye) (h₂ hye) + subst hreq + rw [(hG3 r' hr').unique ⟨hw, hwG⟩ ⟨hw'r, hw'G⟩] + exact hw'cl + +/-- A region of `Γ*` that meets a region `ρ` of `Γ` has the vertex of `Γ*` in `ρ` on its closure. -/ +theorem RadialDrawing.center_mem_closure_region (hS : IsSurface S) (rad : RadialDrawing cap Γ) + {s ρ : Set Shat} {w : Shat} (hs : s ∈ rad.G.R) (hρ : ρ ∈ Γ.hatRegions cap) + (hm : (s ∩ ρ).Nonempty) (hw : w ∈ ρ) (hwG : w ∈ rad.G.V) : w ∈ closure s := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + obtain ⟨Sk, hSk⟩ := exists_isSkHat hS cap Γ + have hρD := hSk.hatRegion_mem_R hρ + by_contra hn + let Z : Set (Set Shat) := {r | r ∈ rad.G.R ∧ w ∈ closure r} + obtain ⟨r₁, hr₁, -, hwr₁⟩ := exists_region_outside (Γ := rad.G) hT (T := ∅) isClosed_empty + ⟨∅, empty_subset _, sUnion_empty.symm⟩ (b := w) (by simp) + obtain ⟨y, hyρ, hyr⟩ := mem_closure_iff.mp hwr₁ ρ (region_isOpen hρD) hw + obtain ⟨e, he, hm'⟩ := exists_boundary_edge hT (region_isOpen hρD) (region_isPreconnected hρD) + (Z := Z) ⟨hr₁, hwr₁⟩ (fun _ h ↦ h.1) ⟨hs, fun h ↦ hn h.2⟩ ⟨y, hyr, hyρ⟩ hm + obtain ⟨-, r, hr, hinc⟩ := mem_boundaryDrawing_E.mp he + have hsub := edge_subset_closure_of_incident hT hinc.1 hinc.2.1 hinc.2.2 + have hc := center_mem_closure hS rad hinc.1 hρ hm' hw hwG + exact hr.2 ⟨hr.1, closure_minimal hsub isClosed_closure hc⟩ + +/-- Each point of the closure of a region `ρ` of `Γ` is on the closure of a region of `Γ*` that +meets +`ρ`. -/ +theorem RadialDrawing.exists_region_at (hS : IsSurface S) (rad : RadialDrawing cap Γ) {ρ : Set Shat} + (hρ : ρ ∈ Γ.hatRegions cap) {q : Shat} (hq : q ∈ closure ρ) : + ∃ s ∈ rad.G.R, (s ∩ ρ).Nonempty ∧ q ∈ closure s := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + obtain ⟨Sk, hSk⟩ := exists_isSkHat hS cap Γ + have hρD := hSk.hatRegion_mem_R hρ + have hRfin := finite_R hT rad.G + have hcov : ρ ⊆ closure (⋃ s ∈ {s | s ∈ rad.G.R ∧ (s ∩ ρ).Nonempty}, s) := by + intro x hx + refine mem_closure_iff.mpr fun O hO hxO ↦ ?_ + obtain ⟨y, ⟨hyO, hyρ⟩, hyU⟩ := exists_notMem_U (Γ := rad.G) hT + (hO.inter (region_isOpen hρD)) ⟨x, hxO, hx⟩ + obtain ⟨s, hs, hys⟩ := exists_region_of_notMem hyU + exact ⟨y, hyO, mem_iUnion₂.mpr ⟨s, ⟨hs, y, hys, hyρ⟩, hys⟩⟩ + have hq' := closure_minimal hcov isClosed_closure hq + have hfin : {s | s ∈ rad.G.R ∧ (s ∩ ρ).Nonempty}.Finite := hRfin.subset fun _ h ↦ h.1 + rw [hfin.closure_biUnion] at hq' + obtain ⟨s, ⟨hs, hm⟩, hqs⟩ := mem_iUnion₂.mp hq' + exact ⟨s, hs, hm, hqs⟩ + +end Radial + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +namespace TangleDatum + +omit [T2Space S] in +/-- The inside of a short circuit is unique. -/ +theorem eq_ins_of_isInsOf (D : TangleDatum cap χ) {F : Drawing Shat} {Δ : Set Shat} + (h : IsInsOf D.rad D.ord D.𝒯 F Δ) : Δ = D.ins F := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hs := D.ins_spec h.1 h.2.1 + by_contra hne + have hcov := cover_of_discBd_eq hT h.2.2.1 hs.2.2.1 (h.2.2.2.1.trans hs.2.2.2.1.symm) hne + exact D.not_cover h hs hs (by rw [Set.union_assoc, Set.union_self, hcov]) + +omit [T2Space S] in +/-- `ins(W)` of Graph Minors XIX is `ins(W)` of Graph Minors XI. -/ +theorem ins_eq_insWalk (D : TangleDatum cap χ) (T : ClosedWalkIns D.rad D.ord D.𝒯) : + T.ins = insWalk D.ins D.rad.G T.walk := by + have hlen : T.walk.length < 2 * D.rep := by + rw [T.walk_len] + have := T.halfLen_lt + change T.halfLen < D.rep at this + omega + rw [T.ins_eq, T.sub_eq, insWalk, insOf] + congr 1 + apply Subset.antisymm + · refine iUnion_subset fun F ↦ iUnion_subset fun hF ↦ iUnion_subset fun Δ ↦ iUnion_subset fun h ↦ + ?_ + rw [D.eq_ins_of_isInsOf h] + exact subset_biUnion_of_mem (u := D.ins) (show F ∈ _ from ⟨h.1.2, hF⟩) + · refine iUnion₂_subset fun C hC ↦ ?_ + have hl := isConfined_walk T.walk hlen C hC.1 hC.2 + have hi := D.ins_spec (F := C) ⟨hC.2.trans (walkDrawing_isSubdrawing _ _), hC.1⟩ hl + exact subset_iUnion_of_subset C (subset_iUnion_of_subset hC.2 + (subset_iUnion_of_subset _ (subset_iUnion_of_subset hi subset_rfl))) + +/-- A closed walk of `Γ*` of length `< 2 rep(𝒯)` is one of the walks of the metric. -/ +theorem exists_closedWalkIns (D : TangleDatum cap χ) {u : Shat} + (W : GraphWalk D.rad.G.toGraph u u) (hlt : W.length < 2 * D.rep) : + ∃ T : ClosedWalkIns D.rad D.ord D.𝒯, T.ins = insWalk D.ins D.rad.G W ∧ 2 * T.halfLen = W.length + := by + obtain ⟨n, hn⟩ : Even W.length := by + obtain ⟨Sk, hSk⟩ := exists_isSkHat χ.isSurface cap D.P.Γ + exact (even_length_iff Sk.V (D.rad.bipartite hSk.hV) W).mpr Iff.rfl + let T : ClosedWalkIns D.rad D.ord D.𝒯 := + { base := u + walk := W + sub := walkDrawing D.rad.G W + halfLen := n + ins := _ + sub_eq := rfl + walk_len := by omega + halfLen_lt := by change n < D.rep; omega + ins_eq := rfl } + exact ⟨T, D.ins_eq_insWalk T, by change 2 * n = _; omega⟩ + +omit [T2Space S] in +/-- A bound for the metric from one closed walk. -/ +theorem dist_le (D : TangleDatum cap χ) {a b : Set Shat} (T : ClosedWalkIns D.rad D.ord D.𝒯) + (ha : (a ∩ T.ins).Nonempty) (hb : (b ∩ T.ins).Nonempty) : D.dist a b ≤ T.halfLen := by + classical + unfold dist tangleMetric + split_ifs with h₁ h₂ + · exact Nat.zero_le _ + · exact Nat.sInf_le ⟨T, ha, hb, rfl⟩ + · exact absurd ⟨T, ha, hb⟩ h₂ + +omit [T2Space S] in +/-- Two different atoms at distance `< rep(𝒯)` lie in a closed walk that attains the distance. -/ +theorem exists_of_dist_lt (D : TangleDatum cap χ) {a b : Set Shat} (hne : a ≠ b) + (hlt : D.dist a b < D.rep) : + ∃ T : ClosedWalkIns D.rad D.ord D.𝒯, (a ∩ T.ins).Nonempty ∧ (b ∩ T.ins).Nonempty ∧ + T.halfLen = D.dist a b := by + classical + unfold dist tangleMetric at * + rw [ite_eq_right hne] at * + split_ifs at * with h₂ + · obtain ⟨T, h₁, h₂', h₃⟩ := Nat.sInf_mem (s := {k : ℕ | ∃ W : ClosedWalkIns D.rad D.ord D.𝒯, + (a ∩ W.ins).Nonempty ∧ (b ∩ W.ins).Nonempty ∧ W.halfLen = k}) (by + obtain ⟨T, h₁, h₂'⟩ := h₂ + exact ⟨_, T, h₁, h₂', rfl⟩) + exact ⟨T, h₁, h₂', h₃⟩ + · exact absurd hlt (lt_irrefl _) + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section7e.lean b/LeanPool/GraphMinor/GM19/Section7e.lean new file mode 100644 index 0000000000..8f40634e5d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section7e.lean @@ -0,0 +1,441 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Epstein +public import LeanPool.GraphMinor.GM19.Section7d +import LeanPool.GraphMinor.GM11.Solid + +import LeanPool.GraphMinor.GM07.Bridge + +/-! +# Graph Minors XIX, (7.1) + +The proof of the paper works with the sets `Z(i)`, the unions of `ins(W)` over closed walks `W` with +`z* ⊆ ins(W)`. We use `TangleDatum.reach c k`, the union of all restraints that contain the point +`c` and +have length at most `k`. This is the set of (8.10) of Graph Minors XI. By +`TangleDatum.exists_walk_of_restraint` +it is also a union of sets `ins(W)`, so that `Z(i)` is `reach c (2 i - 2)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {α : Type w} {cap : IsCappedSurface S Shat} {χ : ColourScheme S α} + +theorem isOArc_nonempty {T : Type} [TopologicalSpace T] {F : Set T} (hF : IsOArc F) : F.Nonempty + := by + obtain ⟨φ⟩ := hF + exact ⟨(φ 1).1, (φ 1).2⟩ + +namespace TangleDatum + +/-- The union of all restraints that contain `c`, of length at most `k`. -/ +noncomputable def reach (D : TangleDatum cap χ) (c : Shat) (k : ℕ) : Set Shat := + restraintUnion D.rad.G D.ins (2 * D.rep) c k + +omit [T2Space S] in +theorem mem_reach {D : TangleDatum cap χ} {c x : Shat} {k : ℕ} : + x ∈ D.reach c k ↔ ∃ X, IsRestraint D.rad.G D.ins (2 * D.rep) X ∧ + perimeterWalkLength D.rad.G X ≤ k ∧ c ∈ X ∧ x ∈ X := by + simp only [reach, restraintUnion, mem_iUnion, exists_prop, mem_ofPred_eq] + constructor + · rintro ⟨X, ⟨h₁, h₂, h₃⟩, hx⟩ + exact ⟨X, h₁, h₂, h₃, hx⟩ + · rintro ⟨X, h₁, h₂, h₃, hx⟩ + exact ⟨X, ⟨h₁, h₂, h₃⟩, hx⟩ + +omit [T2Space S] in +theorem reach_mono (D : TangleDatum cap χ) (c : Shat) {a b : ℕ} (h : a ≤ b) : + D.reach c a ⊆ D.reach c b := fun _ hx ↦ by + obtain ⟨X, h₁, h₂, h₃⟩ := mem_reach.mp hx + exact mem_reach.mpr ⟨X, h₁, h₂.trans h, h₃⟩ + +omit [T2Space S] in +theorem subset_reach {D : TangleDatum cap χ} {c : Shat} {k : ℕ} {X : Set Shat} + (hX : IsRestraint D.rad.G D.ins (2 * D.rep) X) (hl : perimeterWalkLength D.rad.G X ≤ k) + (hc : c ∈ X) : X ⊆ D.reach c k := fun _ hx ↦ mem_reach.mpr ⟨X, hX, hl, hc, hx⟩ + +omit [T2Space S] in +theorem dist_self (D : TangleDatum cap χ) (a : Set Shat) : D.dist a a = 0 := by + simp [dist, tangleMetric] + +omit [T2Space S] [T2Space Shat] in +/-- Each edge of `Γ` lies in a region of `Γ*`. -/ +theorem exists_region_of_edge (D : TangleDatum cap χ) {e : Set S} (he : e ∈ D.P.Γ.E) : + ∃ s ∈ D.rad.G.R, cap.emb '' e ⊆ s := by + have hoff : Disjoint (cap.emb '' e) D.rad.G.U := + disc_edge_disjoint D.rad ⟨subset_rfl, subset_rfl⟩ he + obtain ⟨x, hx⟩ := he.1 + obtain ⟨r, hr, hxr⟩ := exists_region_of_notMem (disjoint_left.mp hoff (mem_image_of_mem _ hx)) + exact ⟨r, hr, subset_region hr (he.2.2.1.isConnected.isPreconnected.image _ + cap.isEmbedding.continuous.continuousOn) hoff (mem_image_of_mem _ hx) hxr⟩ + +omit [T2Space S] [T2Space Shat] in +/-- The three kinds of atoms. -/ +theorem atom_cases {Γ : Painting S} {z : Set Shat} (hz : z ∈ Γ.atoms cap) : + (∃ v ∈ Γ.V, z = {cap.emb v}) ∨ (∃ e ∈ Γ.E, z = cap.emb '' e) ∨ z ∈ Γ.hatRegions cap := by + rcases hz with (⟨v, hv, rfl⟩ | ⟨e, he, rfl⟩) | h + · exact Or.inl ⟨v, hv, rfl⟩ + · exact Or.inr (Or.inl ⟨e, he, rfl⟩) + · exact Or.inr (Or.inr h) + +section Main + + + +omit [T2Space S] in +/-- `ins(W)` is a restraint, by (8.5) of Graph Minors XI. -/ +theorem isRestraint_ins (D : TangleDatum cap χ) (hrep : 1 ≤ D.rep) + (T : ClosedWalkIns D.rad D.ord D.𝒯) : + IsRestraint D.rad.G D.ins (2 * D.rep) T.ins ∧ + perimeterWalkLength D.rad.G T.ins ≤ 2 * T.halfLen := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hlen : T.walk.length < 2 * D.rep := by + rw [T.walk_len] + have := T.halfLen_lt + change T.halfLen < D.rep at this + omega + have h := GM11.theorem_8_5_proof hT (D.isSlope hrep) T.walk hlen + rw [D.ins_eq_insWalk] + exact ⟨h.1, h.2.trans T.walk_len.le⟩ + +/-- Each restraint is `ins(W)` for a closed walk `W` of its length, by (8.3) of Graph Minors XI. -/ +theorem exists_walk_of_restraint (D : TangleDatum cap χ) (hrep : 1 ≤ D.rep) {X : Set Shat} + (hX : IsRestraint D.rad.G D.ins (2 * D.rep) X) : + ∃ T : ClosedWalkIns D.rad D.ord D.𝒯, T.ins = X ∧ + 2 * T.halfLen = perimeterWalkLength D.rad.G X := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + obtain ⟨u, W, -, hl, hlt, -, hd⟩ := hX.exists_walk hT + have h₁ := insWalk_eq hT (D.isSlope hrep) hX hd + obtain ⟨T, h₂, h₃⟩ := D.exists_closedWalkIns W hlt + exact ⟨T, h₂.trans h₁, h₃.trans hl⟩ + +omit [T2Space S] in +/-- A restraint that meets `reach c a` lies in a larger `reach`, by the step of (9.1) of Graph +Minors XI. -/ +theorem reach_grow (D : TangleDatum cap χ) (hrep : 1 ≤ D.rep) {c x : Shat} {a b : ℕ} + (hx : x ∈ D.reach c a) {X : Set Shat} (hX : IsRestraint D.rad.G D.ins (2 * D.rep) X) + (hxX : x ∈ X) (hl : perimeterWalkLength D.rad.G X ≤ b) (hab : a + b < 2 * D.rep) : + X ⊆ D.reach c (a + b) := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + obtain ⟨Y, hY, hlY, hc, hxY⟩ := mem_reach.mp hx + obtain ⟨T, h₁, h₂, h₃, h₄⟩ := exists_restraint_union hT (D.isSlope hrep) hY hX + ⟨x, hxY, hxX⟩ (by omega) + exact h₃.trans (subset_reach h₁ (by omega) (h₂ hc)) + +omit [T2Space S] in +/-- A short circuit of `Γ*` lies in a restraint of its length. -/ +theorem exists_restraint_of_circuit (D : TangleDatum cap χ) (hrep : 1 ≤ D.rep) {F : Drawing Shat} + (hF : F.IsCircuitOf D.rad.G) (hlt : F.E.ncard < 2 * D.rep) : + ∃ X, IsRestraint D.rad.G D.ins (2 * D.rep) X ∧ perimeterWalkLength D.rad.G X ≤ F.E.ncard ∧ + D.ins F ⊆ X ∧ F.U ⊆ X := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + obtain ⟨u, W, ⟨hnd, hed⟩, -, hV, hE⟩ := hF.2 + obtain ⟨W', hs, he⟩ := hF.1.exists_walk_up W + have hlen : W'.length = F.E.ncard := by + have h : {e | e ∈ W.edges} = (W.edges.toFinset : Set (Set Shat)) := by + ext x + simp + rw [hE, h, ncard_coe_finset, List.toFinset_card_of_nodup hed] + change W'.edges.length = _ + rw [he] + have hsub : F.IsSubdrawing (walkDrawing D.rad.G W') := by + refine ⟨?_, ?_⟩ + · rw [walkDrawing_V, hV, hs] + · rw [walkDrawing_E, hE, he] + have h := GM11.theorem_8_5_proof hT (D.isSlope hrep) W' (by omega) + refine ⟨_, h.1, h.2.trans hlen.le, ?_, ?_⟩ + · exact fun y hy ↦ Or.inr (mem_iUnion₂.mpr ⟨F, ⟨hF.2, hsub⟩, hy⟩) + · exact hsub.U_subset.trans subset_union_left + +/-- The closure of each region of `Γ*` lies in a restraint of length at most 6. -/ +theorem exists_tie (D : TangleDatum cap χ) (hrep : 4 ≤ D.rep) {s : Set Shat} (hs : s ∈ D.rad.G.R) : + ∃ X, IsRestraint D.rad.G D.ins (2 * D.rep) X ∧ perimeterWalkLength D.rad.G X ≤ 6 ∧ + closure s ⊆ X := by + obtain ⟨g, hg, hgs⟩ := (D.rad.region_facts χ.isSurface D.P.fits.internally_three_connected).1 s hs + obtain ⟨F, hF, hle, hin⟩ := D.exists_circuit_around hrep hg hs hgs + obtain ⟨X, hX, hl, hi, -⟩ := exists_restraint_of_circuit D (by omega) hF (by omega) + exact ⟨X, hX, by omega, closure_minimal (hin.trans hi) hX.isClosed⟩ + +omit [T2Space S] in +/-- A vertex of `Γ*` is in a restraint of length 0. -/ +theorem exists_point_restraint (D : TangleDatum cap χ) (hrep : 1 ≤ D.rep) {x : Shat} + (hx : x ∈ D.rad.G.V) : + ∃ X, IsRestraint D.rad.G D.ins (2 * D.rep) X ∧ perimeterWalkLength D.rad.G X ≤ 0 ∧ x ∈ X := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hx' : x ∈ D.rad.G.toGraph.vertexSet := hx + have hW : (GraphWalk.nil hx' : GraphWalk D.rad.G.toGraph x x).length < 2 * D.rep := by + change 0 < _ + omega + have h := GM11.theorem_8_5_proof hT (D.isSlope hrep) (GraphWalk.nil hx') hW + refine ⟨_, h.1, h.2, Or.inl ?_⟩ + exact (walkDrawing D.rad.G _).V_subset_U (by rw [walkDrawing_V]; simp [GraphWalk.support]) + +/-- Each atom `z` has a point `c` with these properties: if `ins(W)` meets `z` then `c ∈ ins(W)`, +and +`z` lies in `reach c 6`. -/ +theorem exists_anchor (D : TangleDatum cap χ) (hrep : 4 ≤ D.rep) {z : Set Shat} + (hz : z ∈ D.P.Γ.atoms cap) : + ∃ c ∈ z, (∀ T : ClosedWalkIns D.rad D.ord D.𝒯, (z ∩ T.ins).Nonempty → c ∈ T.ins) ∧ + z ⊆ D.reach c 6 := by + have hS := χ.isSurface + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hR := fun T ↦ isRestraint_ins D (by omega) T + obtain ⟨hG1, hG2, hG3, -⟩ := id D.rad.isPreRadial + rcases atom_cases hz with ⟨v, hv, rfl⟩ | ⟨e, he, rfl⟩ | hρ + · refine ⟨_, mem_singleton _, ?_, ?_⟩ + · rintro T ⟨y, rfl, hy⟩ + exact hy + · rintro _ rfl + have hx := hG2 (mem_image_of_mem cap.emb hv) + obtain ⟨X, hX, hl, hxX⟩ := exists_point_restraint D (by omega) hx + exact subset_reach hX (by omega) hxX hxX + · obtain ⟨s, hs, hes⟩ := D.exists_region_of_edge he + obtain ⟨x, hx⟩ := he.1 + refine ⟨_, mem_image_of_mem _ hx, ?_, ?_⟩ + · rintro T ⟨y, hye, hy⟩ + exact nice_region (hR T).1.isGammaNice hs ⟨y, hes hye, hy⟩ (hes (mem_image_of_mem _ hx)) + · obtain ⟨X, hX, hl, hsX⟩ := exists_tie D hrep hs + have hsub := hes.trans (subset_closure.trans hsX) + exact hsub.trans (subset_reach hX hl (hsub (mem_image_of_mem _ hx))) + · obtain ⟨w, ⟨hw, hwG⟩, huniq⟩ := hG3 z hρ + refine ⟨w, hw, ?_, ?_⟩ + · rintro T ⟨y, hyz, hy⟩ + have hX := (hR T).1 + by_cases hyU : y ∈ D.rad.G.U + · by_cases hyV : y ∈ D.rad.G.V + · rw [huniq y ⟨hyz, hyV⟩] at hy + exact hy + · obtain ⟨e, he, hye⟩ := D.rad.G.exists_edge_of_mem hyU hyV + have hsub : e ⊆ T.ins := nice_atom hX.isGammaNice (Or.inl (Or.inr he)) ⟨y, hye, hy⟩ + exact closure_minimal hsub hX.isClosed + (D.rad.center_mem_closure hS he hρ ⟨y, hye, hyz⟩ hw hwG) + · obtain ⟨s, hs, hys⟩ := exists_region_of_notMem hyU + have hsub := nice_region hX.isGammaNice hs ⟨y, hys, hy⟩ + exact closure_minimal hsub hX.isClosed + (D.rad.center_mem_closure_region hS hs hρ ⟨y, hys, hyz⟩ hw hwG) + · intro q hq + obtain ⟨s, hs, hm, hqs⟩ := D.rad.exists_region_at hS hρ (subset_closure hq) + obtain ⟨X, hX, hl, hsX⟩ := exists_tie D hrep hs + exact subset_reach hX hl + (hsX (D.rad.center_mem_closure_region hS hs hρ hm hw hwG)) (hsX hqs) + +/-- If `reach c a` meets the closure of a region `r` of `sk(Γ)` in `Σ̂`, then a slightly larger +`reach` +includes that closure. This is claim (1) of the paper's proof of (7.1). -/ +theorem closure_sk_region (D : TangleDatum cap χ) (hrep : 4 ≤ D.rep) {Sk : Drawing Shat} + (hSk : IsSkHat cap D.P.Γ Sk) {c : Shat} {a : ℕ} {r : Set Shat} (hr : r ∈ Sk.R) + (hm : (closure r ∩ D.reach c a).Nonempty) (ha : a + 12 < 2 * D.rep) : + closure r ⊆ D.reach c (a + 12) := by + have hS := χ.isSurface + have hT := cap.isClosedSurface + obtain ⟨p, hpr, hpa⟩ := hm + rcases hSk.region_cases hr with hρ | ⟨c₀, hc₀, -, hrsub⟩ + · obtain ⟨w, ⟨hw, hwG⟩, -⟩ := D.rad.isPreRadial.2.2.1 r hρ + obtain ⟨s₁, hs₁, hm₁, hp₁⟩ := D.rad.exists_region_at hS hρ hpr + obtain ⟨X₁, hX₁, hl₁, hsX₁⟩ := exists_tie D hrep hs₁ + have h₁ := reach_grow D (by omega) hpa hX₁ (hsX₁ hp₁) hl₁ (by omega) + have hw₁ := h₁ (hsX₁ (D.rad.center_mem_closure_region hS hs₁ hρ hm₁ hw hwG)) + intro q hq + obtain ⟨s₂, hs₂, hm₂, hq₂⟩ := D.rad.exists_region_at hS hρ hq + obtain ⟨X₂, hX₂, hl₂, hsX₂⟩ := exists_tie D hrep hs₂ + have hw₂ := hsX₂ (D.rad.center_mem_closure_region hS hs₂ hρ hm₂ hw hwG) + exact reach_grow D (by omega) hw₁ hX₂ hw₂ hl₂ (by omega) (hsX₂ hq₂) + · obtain ⟨s, hs, hcs⟩ := D.exists_region_of_edge hc₀ + have hsub : closure r ⊆ closure s := by + refine closure_minimal (hrsub.trans ?_) isClosed_closure + rw [← (cap.isClosedEmbedding hS).closure_image_eq] + exact closure_mono hcs + obtain ⟨X, hX, hl, hsX⟩ := exists_tie D hrep hs + have h₁ := reach_grow D (by omega) hpa hX (hsX (hsub hpr)) hl (by omega) + exact (hsub.trans hsX).trans (h₁.trans (D.reach_mono c (by omega))) + +/-- **Graph Minors XIX, (7.1).** "**7.1.** *Let $\Gamma$ be a 2-cell painting with +$E(\Gamma)\ne \emptyset$ in a surface $\Sigma$, and let $\mathscr{T}$ be a tangle in $\Gamma$ with +metric $d$. Let $z\in A(\Gamma)$, and let $\kappa$ be an integer with +$4\le \kappa\le rep(\mathscr{T}) - 6$. Then there is a circuit $C$ of $sk(\Gamma)$, bounding an +open disc $\Lambda\subseteq \hat{\Sigma}$ with $z\subseteq \Lambda$, such that*" the four listed +assertions hold. + +The print calls the open disc `Λ` throughout, as the Lean does. The bound `d(x, {v}) ≤ 1` in the +paper's proof of the third assertion is not needed, since +`d(z, x) < κ` already puts `x` in `ins(W)` for a walk `W` with `ins(W) ⊆ Z(κ)`. -/ +theorem theorem_7_1_proof (D : TangleDatum cap χ) {z : Set Shat} (hz : z ∈ D.P.Γ.atoms cap) {κ : ℕ} + (h4 : 4 ≤ κ) (hκ : κ + 6 ≤ D.rep) {Sk : Drawing Shat} (hSk : IsSkHat cap D.P.Γ Sk) : + ∃ (C : Drawing Shat) (Λ : Set Shat), C.IsSubdrawing Sk ∧ C.IsCircuit ∧ IsOpenDisc Λ ∧ + IsClosedDisc (closure Λ) ∧ subBd (closure Λ) = C.U ∧ closure Λ \ C.U = Λ ∧ z ⊆ Λ ∧ + (∀ x ∈ D.P.Γ.atoms cap, (x ∩ closure Λ).Nonempty → D.dist z x ≤ κ + 5) ∧ + (∀ x ∈ D.P.Γ.atoms cap, Disjoint x Λ → κ ≤ D.dist z x) ∧ + (∀ x ∈ D.P.Γ.atoms cap, D.dist z x ≤ κ - 2 → x ⊆ Λ) ∧ + ∀ F : Drawing Shat, F.IsCircuitOf D.rad.G → F.U ⊆ closure Λ → + F.E.ncard + 2 * (κ + 5) < 2 * D.rep → D.ins F ⊆ closure Λ := by + have hS := χ.isSurface + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have hrep : 4 ≤ D.rep := by omega + have hsl := D.isSlope (by omega) + have hR := fun T ↦ isRestraint_ins D (by omega) T + obtain ⟨c, hcz, hanchor, hzreach⟩ := exists_anchor D hrep hz + have hcreach : c ∈ D.reach c 6 := hzreach hcz + obtain ⟨r₀, hr₀, hno⟩ := GM11.theorem_8_12_proof hT hsl c + have hdisj : ∀ k, Disjoint r₀ (D.reach c k) := by + intro k + refine disjoint_left.mpr fun y hy hyk ↦ ?_ + obtain ⟨X, hX, -, hc, hyX⟩ := mem_reach.mp hyk + exact hno X hX ⟨hc, nice_region hX.isGammaNice hr₀ ⟨y, hy, hyX⟩⟩ + have hsc : ∀ k, 6 ≤ k → IsSimplyConnectedSet (D.reach c k) := fun k hk ↦ + GM11.theorem_8_10_proof hT hsl ⟨c, D.reach_mono c hk hcreach⟩ + have hcl : ∀ k, IsClosed (D.reach c k) := fun k ↦ isClosed_restraintUnion hT c k + -- A closed disc around all of the restraints through `c`. + set Full := D.reach c (2 * D.rep) with hFull + have hFu : Full ≠ univ := by + obtain ⟨y, hy⟩ := region_nonempty hr₀ + exact fun h ↦ disjoint_left.mp (hdisj _) hy (h ▸ mem_univ y) + have hflat : IsFlat Full := fun φ hφ ↦ by + obtain ⟨b, hb, hhom⟩ := (hsc _ (by omega)).2 φ hφ + exact ⟨b, mem_univ _, hhom.mono (subset_univ _)⟩ + obtain ⟨Δ, hΔ, hsub⟩ := (GraphMinor.GM07.gm07_theorem_11_10.{0} Shat + (IsClosedSurface.isSurface hT) inferInstance Full + (isSolid_of_nice hT (hcl _) (isGammaNice_restraintUnion c _)) hflat).resolve_left hFu + obtain ⟨Δ', hΔ', h₁, -⟩ := Surface.exists_disc_around hman hΔ (fun x _ ↦ hT.2.2 x) isOpen_univ + (subset_univ _) + have hFullint : Full ⊆ Δ' \ subBd Δ' := by + rw [subBd_eq_frontier, IsClosedDisc.frontier_eq_discBd hT hΔ'] + exact hsub.trans h₁ + have hZle : ∀ a, a ≤ 2 * D.rep → D.reach c a ⊆ Full := fun a h ↦ D.reach_mono c h + have hrule : ∀ r ∈ Sk.R, (closure r ∩ D.reach c (2 * κ - 2)).Nonempty → + closure r ⊆ D.reach c (2 * κ + 10) := by + intro r hr hm + have := closure_sk_region D hrep hSk hr hm (by omega) + rwa [show 2 * κ - 2 + 12 = 2 * κ + 10 by omega] at this + obtain ⟨C, Λ, hCS, hC, -, hΛo, hclΛ, hcld, hbdΛ, hbdcl, hdiff, hZΛ, heR⟩ := + GM14.theorem_5_2_full hT Sk hΔ' ⟨c, D.reach_mono c (by omega) hcreach⟩ + (hsc (2 * κ - 2) (by omega)).1.isConnected.isPreconnected fun r hr hm ↦ + (subset_closure.trans (hrule r hr hm)).trans ((hZle _ (by omega)).trans hFullint) + set L := D.reach c (2 * κ + 10) with hL + have hsubΛ : ∀ {a}, a ≤ 2 * κ - 2 → D.reach c a ⊆ Λ := fun h ↦ (D.reach_mono c h).trans hZΛ + have hzΛ : z ⊆ Λ := hzreach.trans (hsubΛ (by omega)) + -- `U(C)` lies in `L`, and so does `ΛBar`, since `L` is simply-connected. + have hedgeL : ∀ e ∈ C.E, closure e ⊆ L := by + intro e he + obtain ⟨r, hr, hinc, hm⟩ := heR e he + have := edge_subset_closure_of_incident hT (hCS.2 he) hr hinc.2.2 + exact closure_minimal (this.trans (hrule r hr hm)) (hcl _) + have hUL : C.U ⊆ L := by + rw [C.U_eq] + refine union_subset (fun v hv ↦ ?_) (iUnion₂_subset hedgeL) + obtain ⟨e, he, hve⟩ := exists_edge_at_vertex hC hv + exact hedgeL e he hve + have hO := GM14.isOArc_of_isCircuit hC + have hnull : IsNullHomotopicOArcIn L C.U := by + obtain ⟨ψ⟩ := id hO + refine ⟨ψ, (hsc _ (by omega)).2 _ ?_⟩ + rintro _ ⟨x, rfl⟩ + exact hUL (ψ x).2 + obtain ⟨Δ₁, hΔ₁L, hd₁, hb₁⟩ := GM11.theorem_7_2_proof hT hO hUL hnull + have hb₁' : discBd Δ₁ = C.U := by + rw [← IsClosedDisc.frontier_eq_discBd hT hd₁, ← subBd_eq_frontier, hb₁] + have hb₂' : discBd (closure Λ) = C.U := by + rw [← IsClosedDisc.frontier_eq_discBd hT hcld, ← subBd_eq_frontier, hbdcl] + obtain ⟨y₀, hy₀⟩ : ∃ y, y ∉ Δ' := by + by_contra hall + push Not at hall + have huniv : Δ' = univ := eq_univ_of_forall hall + obtain ⟨y, hy⟩ := isOArc_nonempty hΔ'.isOArc_discBd + rw [← IsClosedDisc.frontier_eq_discBd hT hΔ', huniv, frontier_univ] at hy + exact hy + have hclsub : closure Λ = Δ₁ := disc_unique hT hO hcld hd₁ hb₂' hb₁' (fun h ↦ hy₀ (hclΛ h)) + fun h ↦ hy₀ (sdiff_subset (hFullint (hZle _ (by omega) (hΔ₁L h)))) + have hclL : closure Λ ⊆ L := hclsub ▸ hΔ₁L + refine ⟨C, Λ, hCS, hC, hΛo, hcld, hbdcl, hdiff, hzΛ, ?_, ?_, ?_, ?_⟩ + · -- The first assertion. + rintro x - ⟨p, hpx, hpcl⟩ + by_cases hzx : z = x + · rw [hzx, D.dist_self] + omega + obtain ⟨X, hX, hl, hc, hpX⟩ := mem_reach.mp (hclL hpcl) + obtain ⟨T, hTi, hTl⟩ := exists_walk_of_restraint D (by omega) hX + have := D.dist_le T ⟨c, hcz, hTi ▸ hc⟩ ⟨p, hpx, hTi ▸ hpX⟩ + omega + · -- The second assertion. + rintro x - hdis + by_contra hlt + push Not at hlt + have hne : z ≠ x := fun h ↦ disjoint_left.mp hdis (h ▸ hcz) (hzΛ hcz) + obtain ⟨T, h₁', ⟨y, hyx, hyT⟩, h₃⟩ := D.exists_of_dist_lt hne (by omega) + have hsubT := subset_reach (k := 2 * κ - 2) (hR T).1 (by have := (hR T).2; omega) + (hanchor T h₁') + exact disjoint_left.mp hdis hyx (hZΛ (hsubT hyT)) + · -- The third assertion. + intro x hx hle + by_cases hzx : z = x + · exact hzx ▸ hzΛ + obtain ⟨T, h₁', ⟨y, hyx, hyT⟩, h₃⟩ := D.exists_of_dist_lt hzx (by omega) + have hsubT : T.ins ⊆ Λ := (subset_reach (k := 2 * κ - 2) (hR T).1 (by have := (hR T).2; omega) + (hanchor T h₁')).trans hZΛ + rcases atom_cases hx with ⟨v, hv, rfl⟩ | ⟨e, he, rfl⟩ | hρ + · rintro _ rfl + exact hsubT (mem_singleton_iff.mp hyx ▸ hyT) + · obtain ⟨s, hs, hes⟩ := D.exists_region_of_edge he + exact (hes.trans (nice_region (hR T).1.isGammaNice hs ⟨y, hes hyx, hyT⟩)).trans hsubT + · have hpre : IsPreconnected x := by + obtain ⟨u, -, rfl⟩ := hρ + exact isPreconnected_connectedComponentIn + have hoff : Disjoint x (frontier (closure Λ)) := by + refine disjoint_left.mpr fun q hq hqf ↦ ?_ + rw [← subBd_eq_frontier, hbdcl] at hqf + have hqS := hCS.U_subset hqf + rw [hSk.hU] at hqS + have hqU : q ∈ D.P.Γ.hatU cap := image_mono D.P.Γ.skU_subset hqS + obtain ⟨u, -, rfl⟩ := hρ + exact (connectedComponentIn_subset _ _ hq) hqU + rcases subset_or_disjoint_of_frontier isClosed_closure hpre hoff with h | h + · refine fun q hq ↦ hdiff ▸ ⟨h hq, fun hqC ↦ disjoint_left.mp hoff hq ?_⟩ + rw [← subBd_eq_frontier, hbdcl] + exact hqC + · exact absurd (subset_closure (hsubT hyT)) (disjoint_left.mp h hyx) + · -- The fourth assertion. + intro F hF hFU hlen + have hlt : F.E.ncard < 2 * D.rep := by omega + obtain ⟨X, hX, hl, hi, hU⟩ := exists_restraint_of_circuit D (by omega) hF hlt + obtain ⟨p, hp⟩ := isOArc_nonempty (GM14.isOArc_of_isCircuit hF.2) + have hgrow := reach_grow D (by omega) (hclL (hFU hp)) hX (hU hp) hl (by omega) + have hy₁ : ∃ y ∈ r₀, y ∉ D.ins F ∧ y ∉ closure Λ := by + obtain ⟨y, hy⟩ := region_nonempty hr₀ + refine ⟨y, hy, fun h ↦ disjoint_left.mp (hdisj _) hy (hgrow (hi h)), fun h ↦ + disjoint_left.mp (hdisj _) hy (hclL h)⟩ + obtain ⟨y, -, hyi, hycl⟩ := hy₁ + have hd := D.ins_spec hF hlt + obtain ⟨Δ₂, ⟨hΔ₂D, dΔ₂, bΔ₂, -⟩, -⟩ := disc_oArc (closure Λ) F.U hcld hFU + (GM14.isOArc_of_isCircuit hF.2) + have := disc_unique hT (GM14.isOArc_of_isCircuit hF.2) hd.2.2.1 dΔ₂ hd.2.2.2.1 bΔ₂ hyi + fun h ↦ hycl (hΔ₂D h) + exact this ▸ hΔ₂D + +end Main + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section8a.lean b/LeanPool/GraphMinor/GM19/Section8a.lean new file mode 100644 index 0000000000..30e7239f4f --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section8a.lean @@ -0,0 +1,139 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Defs2 +public import Mathlib.LinearAlgebra.Countable +public import Mathlib.LinearAlgebra.Dimension.Free +public import Mathlib.LinearAlgebra.Dimension.Finrank +public import Mathlib.Analysis.Real.Cardinality + +/-! +# Tie-breakers exist + +Graph Minors XIX, Section 8 (pages 346–347), takes a tie-breaker in a painting as given. A real +vector +space over the rationals has infinite dimension, so finitely many positive rationally independent +reals +exist, and we can shrink the weights of the edges outside `Σ` by a rational factor. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface + +universe u + +/-- Finitely many positive reals that are rationally independent. -/ +theorem exists_independent (ι : Type*) [Finite ι] : + ∃ x : ι → ℝ, (∀ i, 0 < x i) ∧ LinearIndependent ℚ x := by + classical + let := Fintype.ofFinite ι + have hrank : ((Fintype.card ι : ℕ) : Cardinal) ≤ Module.rank ℚ ℝ := by + have hnf : ¬ Module.Finite ℚ ℝ := fun _ ↦ by + have h : Countable ℝ := Countable.of_moduleFinite (R := ℚ) (M := ℝ) + exact not_countable (α := ℝ) h + have h₀ : Cardinal.aleph0 ≤ Module.rank ℚ ℝ := not_lt.1 fun h ↦ + hnf (Module.rank_lt_aleph0_iff.1 h) + exact (Cardinal.natCast_lt_aleph0).le.trans h₀ + obtain ⟨s, hs, hli⟩ := le_rank_iff_exists_linearIndependent_finset.1 hrank + let e : ι ≃ s := Fintype.equivOfCardEq (by simpa using hs.symm) + have h₁ : LinearIndependent ℚ fun i ↦ ((e i : s) : ℝ) := hli.comp e e.injective + have hne : ∀ i, ((e i : s) : ℝ) ≠ 0 := fun i ↦ h₁.ne_zero i + let u : ι → ℚˣ := fun i ↦ if 0 < ((e i : s) : ℝ) then 1 else -1 + refine ⟨fun i ↦ u i • ((e i : s) : ℝ), fun i ↦ ?_, h₁.units_smul u⟩ + by_cases h : 0 < ((e i : s) : ℝ) + · simp [u, h] + · have hneg : ((e i : s) : ℝ) < 0 := lt_of_le_of_ne (not_lt.1 h) (hne i) + simpa [u, h, Units.smul_def] using hneg + +variable {S : Type u} [TopologicalSpace S] {Shat : Type u} [TopologicalSpace Shat] + +/-- **A tie-breaker exists** for every radial drawing. -/ +theorem nonempty_tieBreaker {cap : IsCappedSurface S Shat} {Γ : Painting S} + (rad : RadialDrawing cap Γ) : Nonempty (TieBreaker rad) := by + classical + have : Fintype rad.G.E := rad.G.finite_edges.fintype + have : Fintype Γ.V := Γ.finite_V.fintype + obtain ⟨x, hpos, hli⟩ := exists_independent (rad.G.E ⊕ Γ.V) + obtain ⟨q, hq0, hq⟩ : ∃ q : ℚ, 0 < q ∧ ∀ i j, (q : ℝ) * x i < x j := by + by_cases hne : Nonempty (rad.G.E ⊕ Γ.V) + · obtain ⟨i₀, hi₀⟩ := Finite.exists_min x + obtain ⟨i₁, hi₁⟩ := Finite.exists_max x + have h₁ : 0 < x i₀ / (x i₁) := div_pos (hpos _) (hpos _) + obtain ⟨q, hq0, hq1⟩ := exists_rat_btwn h₁ + refine ⟨q, by exact_mod_cast hq0, fun i j ↦ ?_⟩ + have hq' : (q : ℝ) * x i₁ < x i₀ := (lt_div_iff₀ (hpos _)).1 hq1 + calc (q : ℝ) * x i ≤ q * x i₁ := mul_le_mul_of_nonneg_left (hi₁ i) hq0.le + _ < x i₀ := hq' + _ ≤ x j := hi₀ j + · exact ⟨1, one_pos, fun i ↦ absurd ⟨i⟩ hne⟩ + let c : rad.G.E ⊕ Γ.V → ℚˣ := fun i ↦ match i with + | Sum.inl e => if Disjoint e.1 (range cap.emb) then Units.mk0 q hq0.ne' else 1 + | Sum.inr _ => 1 + let y : rad.G.E ⊕ Γ.V → ℝ := fun i ↦ c i • x i + have hy : LinearIndependent ℚ y := hli.units_smul c + have hcoe : ∀ i, c i • x i = ((c i : ℚˣ) : ℚ) * x i := fun i ↦ by + rw [Units.smul_def, Rat.smul_def] + have hypos : ∀ i, 0 < y i := fun i ↦ by + change 0 < c i • x i + rw [hcoe] + refine mul_pos ?_ (hpos i) + rcases i with e | v + · by_cases h : Disjoint e.1 (range cap.emb) + · simpa [c, h] using hq0 + · simp [c, h] + · simp [c] + refine ⟨{ wtE := fun e ↦ if h : e ∈ rad.G.E then y (Sum.inl ⟨e, h⟩) else 1 + wtV := fun v ↦ if h : v ∈ Γ.V then y (Sum.inr ⟨v, h⟩) else 1 + wtE_pos := fun e he ↦ by + rw [dite_eq_left he] + have := hypos (Sum.inl ⟨e, he⟩) + exact_mod_cast this + wtV_pos := fun v hv ↦ by + rw [dite_eq_left hv] + have := hypos (Sum.inr ⟨v, hv⟩) + exact_mod_cast this + rationally_independent := ?_ + cuff_lt_internal := ?_ }⟩ + · intro α β hsum + have hE : ∑ᶠ e ∈ rad.G.E, (α e : ℝ) * (if h : e ∈ rad.G.E then y (Sum.inl ⟨e, h⟩) else 1) = + ∑ e : rad.G.E, (α e.1 : ℝ) * y (Sum.inl e) := by + rw [← finsum_subtype_eq_finsum_cond, finsum_eq_sum_of_fintype] + refine Finset.sum_congr rfl fun e _ ↦ ?_ + simp + have hV : ∑ᶠ v ∈ Γ.V, (β v : ℝ) * (if h : v ∈ Γ.V then y (Sum.inr ⟨v, h⟩) else 1) = + ∑ v : Γ.V, (β v.1 : ℝ) * y (Sum.inr v) := by + rw [← finsum_subtype_eq_finsum_cond, finsum_eq_sum_of_fintype] + refine Finset.sum_congr rfl fun e _ ↦ ?_ + simp + rw [hE, hV] at hsum + let g : rad.G.E ⊕ Γ.V → ℚ := fun i ↦ match i with + | Sum.inl e => α e.1 + | Sum.inr v => - β v.1 + have hzero : ∑ i, g i • y i = 0 := by + rw [Fintype.sum_sum_type] + simp only [g, Rat.smul_def, Rat.cast_neg, neg_mul, Finset.sum_neg_distrib] + linarith + have hall := Fintype.linearIndependent_iff.1 hy g hzero + refine ⟨fun e he ↦ hall (Sum.inl ⟨e, he⟩), fun v hv ↦ ?_⟩ + have := hall (Sum.inr ⟨v, hv⟩) + simpa [g] using this + · intro e he f hf hd hsub + have hne : ¬ Disjoint f (range cap.emb) := fun h ↦ by + obtain ⟨z, hz⟩ := hf.1 + exact disjoint_left.1 h hz (hsub hz) + simp only [dite_eq_left he, dite_eq_left hf] + change c (Sum.inl ⟨e, he⟩) • x (Sum.inl ⟨e, he⟩) < c (Sum.inl ⟨f, hf⟩) • x (Sum.inl ⟨f, hf⟩) + rw [hcoe (Sum.inl ⟨e, he⟩), hcoe (Sum.inl ⟨f, hf⟩)] + simpa [c, hd, hne] using hq _ _ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section8b.lean b/LeanPool/GraphMinor/GM19/Section8b.lean new file mode 100644 index 0000000000..d989e57528 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section8b.lean @@ -0,0 +1,503 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Spokes +public import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# Graph Minors XIX, Section 8: walking around a painting + +This file gives the facts about `sk(Γ)` and `Γ*` behind (8.2) and (8.3). Each edge `e` of `Γ*` is +split according to a single pair `(c₁, c₂)` of edges of `Γ` (`PairOf.unique`). The pairs connect all +of `E(Γ)` (`edges_same`): around a vertex, consecutive edges of `sk(Γ)` are in one edge of `Γ` or +form +a pair, and `U(sk(Γ))` is connected because the regions of `sk(Γ)` are discs. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface unitInterval + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] + +/-- A point of an `O`-arc is a limit of points of the `O`-arc outside a given finite set. -/ +theorem mem_closure_sdiff_finite {T : Type} [TopologicalSpace T] {F W : Set T} + (hF : IsOArc F) (hW : W.Finite) {v : T} (hv : v ∈ F) : v ∈ closure (F \ W) := by + obtain ⟨φ⟩ := id hF + have hinf : Infinite Circle := by + have hn : Nontrivial Circle := ⟨1, Circle.exp Real.pi, fun h ↦ by + have := congrArg (fun z : Circle ↦ (z : ℂ)) h + simp at this + norm_num at this⟩ + exact Set.infinite_univ_iff.mp (isPreconnected_univ.infinite_of_nontrivial Set.nontrivial_univ) + rw [mem_closure_iff] + intro O hO hvO + by_contra hne + have hsub : ∀ z : Circle, (φ z).1 ∈ O → (φ z).1 ∈ W := fun z hz ↦ by + by_contra hn + exact hne ⟨_, hz, (φ z).2, hn⟩ + let V : Set Circle := {z | (φ z).1 ∈ O} + have hVo : IsOpen V := hO.preimage (continuous_subtype_val.comp φ.continuous) + have hVf : V.Finite := by + refine Set.Finite.of_finite_image (f := fun z ↦ (φ z).1) (hW.subset ?_) ?_ + · rintro _ ⟨z, hz, rfl⟩ + exact hsub z hz + · exact fun a _ b _ h ↦ φ.injective (Subtype.ext h) + have hVc : IsClopen V := ⟨hVf.isClosed, hVo⟩ + have hVne : V.Nonempty := ⟨φ.symm ⟨v, hv⟩, by simpa [V] using hvO⟩ + have := hVc.eq_univ hVne + rw [this] at hVf + exact Set.infinite_univ hVf + +namespace Painting + +variable (Γ : Painting S) + +omit [T2Space S] in +theorem IsSkEdgeIn.mem {Γ : Painting S} {f c : Set S} (h : Γ.IsSkEdgeIn f c) : + f ∈ arcComponentsIn (Γ.skU \ Γ.V) := by + obtain ⟨hc, ⟨h2, rfl⟩ | ⟨h3, hf⟩⟩ := h + · exact Γ.two_mem_sk hc h2 + · obtain ⟨hdisc, hT, hfin⟩ := Γ.isDisc_of_three hc h3 + have hfsub : f ⊆ Γ.skU \ Γ.V := fun x hx ↦ by + have hxb := (hf.2.1 hx) + refine ⟨Or.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h3⟩, hxb.1⟩), fun hxV ↦ hxb.2 ?_⟩ + exact ⟨discBd_subset _ hxb.1, fun hxc ↦ Γ.disjoint_V hc hxc hxV⟩ + refine ⟨hf.1, hfsub, hf.2.2.1, fun D hD hp hsub ↦ ?_⟩ + have hDc : D ⊆ c := by + obtain ⟨c', hc', hDc'⟩ := exists_arcComp_superset hp + (hD.trans (sdiff_subset_sdiff_left Γ.skU_subset)) + obtain ⟨x, hx⟩ := hf.1 + have hxc : x ∈ c := by + have hxb := hf.2.1 hx + by_contra hn + exact hxb.2 ⟨discBd_subset _ hxb.1, hn⟩ + rwa [arcComp_eq_of_mem hc hc' hxc (hDc' (hsub hx))] + refine hf.2.2.2 D (fun x hx ↦ ⟨Γ.mem_discBd_of_skU hc h3 (hDc hx) (hD hx).1, + fun ht ↦ ?_⟩) hp hsub + exact (hD hx).2 (Γ.tilde_subset_V hc ht) + +omit [T2Space S] in +theorem IsSkEdgeIn.subset {Γ : Painting S} {f c : Set S} (h : Γ.IsSkEdgeIn f c) : f ⊆ c := by + obtain ⟨hc, ⟨h2, rfl⟩ | ⟨h3, hf⟩⟩ := h + · exact subset_rfl + · intro x hx + have hxb := hf.2.1 hx + by_contra hn + exact hxb.2 ⟨discBd_subset _ hxb.1, hn⟩ + +omit [T2Space S] in +theorem IsSkEdgeIn.unique {Γ : Painting S} {f c c' : Set S} (h : Γ.IsSkEdgeIn f c) + (h' : Γ.IsSkEdgeIn f c') : c = c' := by + obtain ⟨x, hx⟩ := (h.mem).1 + exact arcComp_eq_of_mem h.1 h'.1 (h.subset hx) (h'.subset hx) + +omit [T2Space S] in +theorem exists_isSkEdgeIn {f : Set S} (hf : f ∈ arcComponentsIn (Γ.skU \ Γ.V)) : + ∃ c, Γ.IsSkEdgeIn f c := by + rcases Γ.sk_cases hf with ⟨h, h2⟩ | ⟨c, hc, h3, hsub, hbd⟩ + · exact ⟨f, h, Or.inl ⟨h2, rfl⟩⟩ + · refine ⟨c, hc, Or.inr ⟨h3, hf.1, fun x hx ↦ ⟨hbd hx, fun ht ↦ (hf.2.1 hx).2 ?_⟩, hf.2.2.1, + fun D hD hp hs ↦ hf.2.2.2 D (fun x hx ↦ ?_) hp hs⟩⟩ + · exact Γ.tilde_subset_V hc ht + · have hx' := hD hx + refine ⟨Or.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h3⟩, hx'.1⟩), fun hxV ↦ hx'.2 ?_⟩ + exact ⟨discBd_subset _ hx'.1, fun hxc ↦ Γ.disjoint_V hc hxc hxV⟩ + +/-- An end of an edge of `Γ` is an end of an edge of `sk(Γ)` inside it. -/ +theorem exists_sk_at {c : Set S} (hc : c ∈ Γ.E) {v : S} (hv : v ∈ tilde c) : + ∃ f, Γ.IsSkEdgeIn f c ∧ v ∈ tilde f := by + rcases Γ.size_cases hc with h2 | h3 + · exact ⟨c, ⟨hc, Or.inl ⟨h2, rfl⟩⟩, hv⟩ + obtain ⟨hdisc, hT, hfin⟩ := Γ.isDisc_of_three hc h3 + have hvF : v ∈ discBd (closure c) := hT hv + have hclA : v ∈ closure (discBd (closure c) \ tilde c) := mem_closure_sdiff_finite + hdisc.isOArc_discBd + hfin hvF + obtain ⟨D, hDU, hDV⟩ := Γ.exists_skDrawing + have hEfin : (arcComponentsIn (Γ.skU \ Γ.V)).Finite := by + have := D.finite_edges + rwa [hDU, hDV] at this + let 𝓕 : Set (Set S) := {f | f ∈ arcComponentsIn (Γ.skU \ Γ.V) ∧ Γ.IsSkEdgeIn f c} + have h𝓕 : 𝓕.Finite := hEfin.subset fun _ h ↦ h.1 + have hcover : discBd (closure c) \ tilde c ⊆ ⋃ f ∈ 𝓕, f := by + rintro x ⟨hxF, hxt⟩ + have hxc : x ∈ c := by + by_contra hn + exact hxt ⟨discBd_subset _ hxF, hn⟩ + have hx : x ∈ Γ.skU \ Γ.V := ⟨Or.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h3⟩, hxF⟩), Γ.disjoint_V hc hxc⟩ + obtain ⟨f, hf, hxf⟩ := exists_arcComp_superset (isPathConnected_singleton x) + (singleton_subset_iff.2 hx) + obtain ⟨c', hc'⟩ := Γ.exists_isSkEdgeIn hf + have : c' = c := arcComp_eq_of_mem hc'.1 hc (hc'.subset (hxf rfl)) hxc + exact mem_biUnion (x := f) ⟨hf, this ▸ hc'⟩ (hxf rfl) + have hcl := closure_mono hcover hclA + rw [h𝓕.closure_biUnion] at hcl + obtain ⟨f, hf, hvf⟩ := mem_iUnion₂.mp hcl + exact ⟨f, hf.2, hvf, fun hc' ↦ (hf.1.2.1 hc').2 (Γ.tilde_subset_V hc hv)⟩ + +end Painting + +section Regions + +variable {cap : IsCappedSurface S Shat} {Γ : Painting S} {D : Drawing Shat} + +omit [T2Space S] in +/-- A region of `sk(Γ)` in `Σ̂` is a region of `Γ`, or the inside of the disc of an edge of size 3. +-/ +theorem IsSkHat.region_cases (h : IsSkHat cap Γ D) {r : Set Shat} + (hr : r ∈ D.R) : + r ∈ Γ.hatRegions cap ∨ ∃ c ∈ Γ.E, (tilde c).ncard = 3 ∧ r ⊆ cap.emb '' closure c := by + have hT := cap.isClosedSurface + have : T2Space Shat := hT.2.1 + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hsub : D.U ⊆ Γ.hatU cap := by + rw [h.hU] + exact image_mono Γ.skU_subset + obtain ⟨x, hx, rfl⟩ := hr + by_cases hxU : x ∈ Γ.hatU cap + · right + obtain ⟨z, hzU, rfl⟩ := hxU + have hzsk : z ∉ Γ.skU := fun hc ↦ hx.2 (by rw [h.hU]; exact mem_image_of_mem _ hc) + have hzV : z ∉ Γ.V := fun hc ↦ hzsk (Or.inl (Or.inl hc)) + obtain ⟨c, hc, hzc⟩ := exists_arcComp_superset (F := Γ.U \ Γ.V) + (isPathConnected_singleton z) (singleton_subset_iff.2 ⟨hzU, hzV⟩) + have hzc' : z ∈ c := hzc rfl + have h3 : (tilde c).ncard = 3 := by + rcases Γ.size_cases hc with h2 | h3 + · exact absurd (Or.inl (Or.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h2⟩, hzc'⟩))) hzsk + · exact h3 + obtain ⟨hdisc, -⟩ := Γ.isDisc_of_three hc h3 + obtain ⟨hC, hCbd⟩ := isClosedDisc_image hdisc cap.isEmbedding + have hopen := hC.isOpen_discInt hman + have hbdU : discBd (cap.emb '' closure c) ⊆ D.U := by + rw [hCbd, h.hU] + exact image_mono fun w hw ↦ Or.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h3⟩, hw⟩) + have hyB : cap.emb z ∈ discInt (cap.emb '' closure c) := + ⟨mem_image_of_mem _ (subset_closure hzc'), fun hc' ↦ hx.2 (hbdU hc')⟩ + refine ⟨c, hc, h3, ?_⟩ + have hin : connectedComponentIn (univ \ D.U) (cap.emb z) ⊆ discInt (cap.emb '' closure c) := by + refine isPreconnected_connectedComponentIn.subset_left_of_subset_union hopen + hC.isClosed.isOpen_compl ?_ (fun w hw ↦ ?_) ⟨_, mem_connectedComponentIn hx, hyB⟩ + · exact disjoint_left.2 fun w hw hn ↦ hn hw.1 + · by_cases hwC : w ∈ cap.emb '' closure c + · exact Or.inl ⟨hwC, fun hb ↦ (connectedComponentIn_subset _ _ hw).2 (hbdU hb)⟩ + · exact Or.inr hwC + exact fun w hw ↦ (hin hw).1 + · left + have hhat : connectedComponentIn (Γ.hatU cap)ᶜ x ∈ Γ.hatRegions cap := ⟨x, hxU, rfl⟩ + have hR := h.hatRegion_mem_R hhat + have hxm : x ∈ connectedComponentIn (Γ.hatU cap)ᶜ x := mem_connectedComponentIn hxU + have : connectedComponentIn (univ \ D.U) x = connectedComponentIn (Γ.hatU cap)ᶜ x := + GM11.region_eq_of_mem ⟨x, hx, rfl⟩ hR (mem_connectedComponentIn hx) hxm + rw [this] + exact hhat + +end Regions + +section Pairs + +variable {cap : IsCappedSurface S Shat} {Γ : Painting S} + +/-- `(c₁, c₂)` is the pair of edges of `Γ` that decides whether a separation splits `e ∈ E(Γ*)`. -/ +def RadialDrawing.PairOf (rad : RadialDrawing cap Γ) (e : Set Shat) (c₁ c₂ : Set S) : Prop := + ∃ (v : S) (w : Shat), v ∈ Γ.V ∧ w ∈ rad.Rstar ∧ closure e ∩ rad.G.V = {cap.emb v, w} ∧ + ∃ f₁ f₂ : Set S, f₁ ≠ f₂ ∧ Γ.IsSkEdgeIn f₁ c₁ ∧ Γ.IsSkEdgeIn f₂ c₂ ∧ + v ∈ tilde f₁ ∧ v ∈ tilde f₂ ∧ + cap.emb '' f₁ ⊆ frontier (rad.regionOf w) ∧ cap.emb '' f₂ ⊆ frontier (rad.regionOf w) + +omit [T2Space S] in +theorem RadialDrawing.splits_iff (rad : RadialDrawing cap Γ) {A B : Hypergraph S (Set S)} + {e : Set Shat} : rad.Splits A B e ↔ ∃ c₁ c₂, rad.PairOf e c₁ c₂ ∧ + ((c₁ ∈ A.edgeSet ∧ c₂ ∈ B.edgeSet) ∨ (c₁ ∈ B.edgeSet ∧ c₂ ∈ A.edgeSet)) := by + constructor + · rintro ⟨v, w, hv, hw, hset, f₁, f₂, c₁, c₂, hne, h₁, h₂, h₃, h₄, h₅, h₆, h⟩ + exact ⟨c₁, c₂, ⟨v, w, hv, hw, hset, f₁, f₂, hne, h₁, h₂, h₃, h₄, h₅, h₆⟩, h⟩ + · rintro ⟨c₁, c₂, ⟨v, w, hv, hw, hset, f₁, f₂, hne, h₁, h₂, h₃, h₄, h₅, h₆⟩, h⟩ + exact ⟨v, w, hv, hw, hset, f₁, f₂, c₁, c₂, hne, h₁, h₂, h₃, h₄, h₅, h₆, h⟩ + +omit [T2Space S] in +theorem RadialDrawing.regionOf_mem (rad : RadialDrawing cap Γ) {w : Shat} (hw : w ∈ rad.Rstar) : + rad.regionOf w ∈ Γ.hatRegions cap ∧ w ∈ rad.regionOf w := by + obtain ⟨r₀, ⟨y, hy, rfl⟩, hwr₀⟩ := rad.isPreRadial.2.2.2.1 w hw + have hwU : w ∈ (Γ.hatU cap)ᶜ := connectedComponentIn_subset _ _ hwr₀ + exact ⟨⟨w, hwU, rfl⟩, mem_connectedComponentIn hwU⟩ + +theorem RadialDrawing.PairOf.unique (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + {rad : RadialDrawing cap Γ} {e : Set Shat} {c₁ c₂ c₁' c₂' : Set S} (h : rad.PairOf e c₁ c₂) + (h' : rad.PairOf e c₁' c₂') : (c₁' = c₁ ∧ c₂' = c₂) ∨ (c₁' = c₂ ∧ c₂' = c₁) := by + obtain ⟨v, w, hv, hw, hset, f₁, f₂, hne, h₁, h₂, h₃, h₄, h₅, h₆⟩ := h + obtain ⟨v', w', hv', hw', hset', f₁', f₂', hne', h₁', h₂', h₃', h₄', h₅', h₆'⟩ := h' + have heq : ({cap.emb v, w} : Set Shat) = {cap.emb v', w'} := hset.symm.trans hset' + have hm₁ : cap.emb v ∈ ({cap.emb v', w'} : Set Shat) := heq ▸ Or.inl rfl + have hm₂ : w ∈ ({cap.emb v', w'} : Set Shat) := heq ▸ Or.inr rfl + have hvv : v = v' := by + rcases hm₁ with h | h + · exact cap.isEmbedding.injective h + · exact absurd (h ▸ mem_image_of_mem _ hv) hw'.2 + subst hvv + have hww : w = w' := by + rcases hm₂ with h | h + · exact absurd (h ▸ mem_image_of_mem _ hv) hw.2 + · exact h + subst hww + obtain ⟨g₁, g₂, hg⟩ := sk_frontier_pair hS h3 (rad.regionOf_mem hw).1 hv + have a₁ := hg f₁ h₁.mem h₃ h₅ + have a₂ := hg f₂ h₂.mem h₄ h₆ + have a₃ := hg f₁' h₁'.mem h₃' h₅' + have a₄ := hg f₂' h₂'.mem h₄' h₆' + have hcase : (f₁' = f₁ ∧ f₂' = f₂) ∨ (f₁' = f₂ ∧ f₂' = f₁) := by + rcases a₁ with a₁ | a₁ <;> rcases a₂ with a₂ | a₂ <;> rcases a₃ with a₃ | a₃ <;> + rcases a₄ with a₄ | a₄ <;> subst_vars <;> simp_all + rcases hcase with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl ⟨h₁'.unique h₁, h₂'.unique h₂⟩ + · exact Or.inr ⟨h₁'.unique h₂, h₂'.unique h₁⟩ + +/-- Going around a vertex, a property of edges of `Γ` that the pairs do not change stays the same. +-/ +theorem vertex_step (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (rad : RadialDrawing cap Γ) (t : Set S → Prop) + (ht : ∀ e ∈ rad.G.E, ∀ c₁ c₂, rad.PairOf e c₁ c₂ → (t c₁ ↔ t c₂)) {v₀ : S} (hv₀ : v₀ ∈ Γ.V) + {c c' : Set S} (hc : c ∈ Γ.E) (hc' : c' ∈ Γ.E) (hv : v₀ ∈ tilde c) (hv' : v₀ ∈ tilde c') : + t c ↔ t c' := by + classical + obtain ⟨D, hD⟩ := exists_isSkHat hS cap Γ + have hT := cap.isClosedSurface + have : T2Space Shat := hT.2.1 + have : Nonempty Shat := ⟨cap.emb v₀⟩ + have hlc : LocallyConnectedSpace Shat := GM11.IsClosedSurface.locallyConnectedSpace hT + have h2 := h3.hatRegions_isOpenDisc hS cap + have hvD : cap.emb v₀ ∈ D.V := by + rw [hD.hV] + exact mem_image_of_mem _ hv₀ + obtain ⟨γ, hγ⟩ := GM11.exists_edgePar D + have hclv : ∀ f : Set S, cap.emb v₀ ∈ closure (cap.emb '' f) → v₀ ∈ closure f := fun f h ↦ by + rw [(cap.isClosedEmbedding hS).closure_image_eq] at h + obtain ⟨x, hx, hxe⟩ := h + exact cap.isEmbedding.injective hxe ▸ hx + have hk : ∀ k : GM11.halfEdges D γ (cap.emb v₀), ∃ f c, cap.emb '' f = k.1.1 ∧ + Γ.IsSkEdgeIn f c ∧ v₀ ∈ tilde f := by + rintro ⟨⟨E, b⟩, hE, hb⟩ + obtain ⟨f, hf, rfl⟩ := hD.edge_iff.mp hE + obtain ⟨c, hc⟩ := Γ.exists_isSkEdgeIn hf + refine ⟨f, c, rfl, hc, ?_⟩ + have := GM11.end_mem_closure hγ hE b + rw [hb] at this + exact ⟨hclv f this, fun hvf ↦ (hf.2.1 hvf).2 hv₀⟩ + choose g cl hgi hgc hgv using hk + have hfind : ∀ f c, Γ.IsSkEdgeIn f c → v₀ ∈ tilde f → + ∃ k, cl k = c := by + intro f c hc hvf + have hE : cap.emb '' f ∈ D.E := hD.edge_iff.mpr ⟨f, hc.mem, rfl⟩ + have hcl : cap.emb v₀ ∈ closure (cap.emb '' f) := + image_closure_subset_closure_image cap.isEmbedding.continuous (mem_image_of_mem _ hvf.1) + obtain ⟨b, hb⟩ := GM11.exists_end_eq hγ hE hvD hcl + let k : GM11.halfEdges D γ (cap.emb v₀) := ⟨(cap.emb '' f, b), hE, hb⟩ + refine ⟨k, ?_⟩ + have : g k = f := cap.isEmbedding.injective.image_injective (hgi k) + have h₁ := hgc k + rw [this] at h₁ + exact h₁.unique hc + have hall : ∀ a b, t (cl a) ↔ t (cl b) := by + have hfin : Finite (GM11.halfEdges D γ (cap.emb v₀)) := + (GM11.finite_halfEdges D γ _).to_subtype + by_cases hc2 : 2 ≤ Nat.card (GM11.halfEdges D γ (cap.emb v₀)) + swap + · have hsub : Subsingleton (GM11.halfEdges D γ (cap.emb v₀)) := by + rw [← Finite.card_le_one_iff_subsingleton] + omega + intro a b + rw [Subsingleton.elim a b] + obtain ⟨next, ρ, P, W, Q, τ, hsec, -, -⟩ := exists_sectors' hT D hγ hvD hc2 + have hsurj : Function.Surjective next := Finite.injective_iff_surjective.mp hsec.corners.inj + have hstep : ∀ k, t (cl k) ↔ t (cl (next k)) := by + intro k + by_cases hgg : g k = g (next k) + · have h₁ := hgc k + rw [hgg] at h₁ + rw [h₁.unique (hgc (next k))] + have hrD := hsec.corners.region k + have hk₁ : (next k).1.1 ⊆ closure (ρ k) := hsec.corners.left k + have hk₂ : k.1.1 ⊆ closure (ρ k) := by + obtain ⟨k', rfl⟩ := hsurj k + exact hsec.corners.right k' + rcases hD.region_cases hrD with hhat | ⟨c₀, hc₀, h₃₀, hsubr⟩ + · obtain ⟨w, ⟨hwr, hwV⟩, -⟩ := rad.isPreRadial.2.2.1 _ hhat + have hdis : Disjoint (ρ k) (Γ.hatU cap) := by + obtain ⟨y, hy, hyr⟩ := hhat + refine disjoint_left.mpr fun z hz hzU ↦ ?_ + rw [← hyr] at hz + exact connectedComponentIn_subset (Γ.hatU cap)ᶜ y hz hzU + have hwR : w ∈ rad.Rstar := + ⟨hwV, fun hc ↦ disjoint_left.mp hdis hwr (image_mono Γ.V_subset hc)⟩ + have hreg : rad.regionOf w = ρ k := by + obtain ⟨y, hy, hyr⟩ := hhat + change connectedComponentIn (Γ.hatU cap)ᶜ w = ρ k + rw [← hyr] at hwr ⊢ + exact (connectedComponentIn_eq hwr).symm + have hfr : ∀ j, j.1.1 ⊆ closure (ρ k) → cap.emb '' g j ⊆ frontier (rad.regionOf w) := by + intro j hj + rw [hgi, hreg, (GM11.region_isOpen hrD).frontier_eq] + intro x hx + refine ⟨hj hx, fun hxr ↦ GM11.region_subset hrD hxr ?_⟩ + exact D.closure_subset_U j.2.1 (subset_closure hx) + have hcl : cap.emb v₀ ∈ closure (rad.regionOf w) := by + rw [hreg] + refine closure_minimal ?_ isClosed_closure (image_closure_subset_closure_image + cap.isEmbedding.continuous (mem_image_of_mem _ (hgv k).1)) + rw [hgi] + exact hk₂ + obtain ⟨e, he, hset⟩ := rad.exists_spoke hS h2 h3.1 hwR hv₀ hcl + exact ht e he _ _ ⟨v₀, w, hv₀, hwR, hset, g k, g (next k), hgg, hgc k, hgc _, hgv k, hgv _, + hfr k hk₂, hfr _ hk₁⟩ + · have hC : IsClosed (cap.emb '' closure c₀) := + (cap.isClosedEmbedding hS).isClosedMap _ isClosed_closure + have hcl : closure (ρ k) ⊆ cap.emb '' closure c₀ := closure_minimal hsubr hC + have hcell : ∀ j, j.1.1 ⊆ closure (ρ k) → cl j = c₀ := by + intro j hj + have hm := hgc j + obtain ⟨x, hx⟩ := hm.mem.1 + obtain ⟨y, hy, hyx⟩ := hcl (hj (hgi j ▸ mem_image_of_mem _ hx)) + obtain rfl := cap.isEmbedding.injective hyx + have hxc : y ∈ c₀ := by + by_contra hn + exact (hm.mem.2.1 hx).2 (Γ.tilde_subset_V hc₀ ⟨hy, hn⟩) + exact arcComp_eq_of_mem hm.1 hc₀ (hm.subset hx) hxc + rw [hcell k hk₂, hcell _ hk₁] + intro a b + have hre := hsec.corners.reach a b + induction hre with + | refl => exact Iff.rfl + | tail _ h ih => + subst h + exact ih.trans (hstep _) + obtain ⟨f, hf, hvf⟩ := Γ.exists_sk_at hc hv + obtain ⟨f', hf', hvf'⟩ := Γ.exists_sk_at hc' hv' + obtain ⟨k, rfl⟩ := hfind f c hf hvf + obtain ⟨k', rfl⟩ := hfind f' c' hf' hvf' + exact hall k k' + +/-- Each vertex of `Γ` is an end of an edge of `Γ`, since the regions of `sk(Γ)` in `Σ̂` are discs. +-/ +theorem exists_edge_incident (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (rad : RadialDrawing cap Γ) {y : S} (hyV : y ∈ Γ.V) : ∃ c ∈ Γ.E, y ∈ closure c := by + have hT := cap.isClosedSurface + have : T2Space Shat := hT.2.1 + have : ConnectedSpace Shat := cap.connected + have h2 := h3.hatRegions_isOpenDisc hS cap + obtain ⟨D, W, hDU, hDV, hD2, -, hG'⟩ := Γ.exists_hubDrawing hS cap h2 + have hD : IsSkHat cap Γ D := ⟨hDU, hDV⟩ + have hvD : cap.emb y ∈ D.V := by + rw [hDV] + exact mem_image_of_mem _ hyV + obtain ⟨G', hpreG, -⟩ := hG' rad.G rad.isPreRadial + have hrad : GM11.PreRad (GM11.PaintingOrDrawing.drawing D) G' := ⟨hD2, hpreG⟩ + obtain ⟨e, he, hye⟩ := GM11.exists_edge_at hrad hT (hD.E_nonempty h3.1) hvD + obtain ⟨f, hf, rfl⟩ := hD.edge_iff.mp he + obtain ⟨c, hc⟩ := Γ.exists_isSkEdgeIn hf + rw [(cap.isClosedEmbedding hS).closure_image_eq] at hye + obtain ⟨y', hy', hyy⟩ := hye + obtain rfl := cap.isEmbedding.injective hyy + exact ⟨c, hc.1, closure_mono hc.subset hy'⟩ + +/-- **The pairs connect `E(Γ)`.** A property of edges of `Γ` that the pairs do not change holds for +all +edges or for none. If it held for some and not others, then by `vertex_step` the two sets of edges +have no common end, so they split `U(sk(Γ))` into two disjoint closed sets, and that set is +connected +because its regions in `Σ̂` are discs. -/ +theorem edges_same (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (rad : RadialDrawing cap Γ) (t : Set S → Prop) + (ht : ∀ e ∈ rad.G.E, ∀ c₁ c₂, rad.PairOf e c₁ c₂ → (t c₁ ↔ t c₂)) {c c' : Set S} (hc : c ∈ Γ.E) + (hc' : c' ∈ Γ.E) : t c ↔ t c' := by + classical + have hT := cap.isClosedSurface + have : T2Space Shat := hT.2.1 + have : ConnectedSpace Shat := cap.connected + have h2 := h3.hatRegions_isOpenDisc hS cap + obtain ⟨D, W, hDU, hDV, hD2, -, -⟩ := Γ.exists_hubDrawing hS cap h2 + have hnon : ∀ c ∈ Γ.E, (Γ.skU ∩ closure c).Nonempty := by + intro c hc + obtain ⟨x, hx⟩ := hc.1 + obtain ⟨f, hf, hv⟩ : ∃ f, Γ.IsSkEdgeIn f c ∧ True := by + rcases Γ.size_cases hc with h2' | h3' + · exact ⟨c, ⟨hc, Or.inl ⟨h2', rfl⟩⟩, trivial⟩ + · obtain ⟨hdisc, hT', hfin⟩ := Γ.isDisc_of_three hc h3' + obtain ⟨a, b, z, hab, -, -, hset⟩ := Set.ncard_eq_three.mp h3' + obtain ⟨f, hf, -⟩ := Γ.exists_sk_at hc (show a ∈ tilde c from hset ▸ Or.inl rfl) + exact ⟨f, hf, trivial⟩ + obtain ⟨y, hy⟩ := hf.mem.1 + exact ⟨y, (hf.mem.2.1 hy).1, subset_closure (hf.subset hy)⟩ + have hvertex : ∀ y ∈ Γ.skU, ∃ c ∈ Γ.E, y ∈ Γ.skU ∩ closure c := by + intro y hy + by_cases hyV : y ∈ Γ.V + · obtain ⟨c, hc, hyc⟩ := exists_edge_incident hS h3 rad hyV + exact ⟨c, hc, hy, hyc⟩ + · obtain ⟨f, hf, hyf⟩ := exists_arcComp_superset (F := Γ.skU \ Γ.V) + (isPathConnected_singleton y) (singleton_subset_iff.2 ⟨hy, hyV⟩) + obtain ⟨c, hc⟩ := Γ.exists_isSkEdgeIn hf + exact ⟨c, hc.1, hy, subset_closure (hc.subset (hyf rfl))⟩ + let C₁ : Set Shat := cap.emb '' (⋃ c ∈ {c ∈ Γ.E | t c}, Γ.skU ∩ closure c) + let C₂ : Set Shat := cap.emb '' (⋃ c ∈ {c ∈ Γ.E | ¬ t c}, Γ.skU ∩ closure c) + have hcl : ∀ X : Set (Set S), X ⊆ Γ.E → IsClosed (cap.emb '' (⋃ c ∈ X, Γ.skU ∩ closure c)) := by + intro X hX + refine (cap.isClosedEmbedding hS).isClosedMap _ ?_ + exact (Γ.finite_edges.subset hX).isClosed_biUnion fun c _ ↦ Γ.isClosed_skU.inter + isClosed_closure + have hdis : Disjoint C₁ C₂ := by + refine disjoint_left.mpr ?_ + rintro _ ⟨x, hx, rfl⟩ ⟨x', hx', hxx⟩ + obtain rfl : x = x' := (cap.isEmbedding.injective hxx).symm + obtain ⟨a, ⟨haE, hta⟩, -, hxa⟩ := mem_iUnion₂.mp hx + obtain ⟨b, ⟨hbE, htb⟩, -, hxb⟩ := mem_iUnion₂.mp hx' + have hab : a ≠ b := fun h ↦ htb (h ▸ hta) + have hsplit : ∀ {a b : Set S}, a ∈ Γ.E → b ∈ Γ.E → a ≠ b → x ∈ closure a → x ∈ closure b → + x ∉ a := by + intro a b ha hb hne hxa hxb hxin + rcases Γ.closure_subset hb hxb with h | h + · exact hne (arcComp_eq_of_mem ha hb hxin h) + · exact Γ.disjoint_V ha hxin h + have hna := hsplit haE hbE hab hxa hxb + have hnb := hsplit hbE haE hab.symm hxb hxa + have hxV : x ∈ Γ.V := Γ.tilde_subset_V haE ⟨hxa, hna⟩ + exact htb ((vertex_step hS h3 rad t ht hxV haE hbE ⟨hxa, hna⟩ ⟨hxb, hnb⟩).mp hta) + have hU : C₁ ∪ C₂ = D.U := by + rw [hDU] + apply Subset.antisymm + · rintro _ (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩) + · obtain ⟨a, -, ha, -⟩ := mem_iUnion₂.mp hx + exact mem_image_of_mem _ ha + · obtain ⟨a, -, ha, -⟩ := mem_iUnion₂.mp hx + exact mem_image_of_mem _ ha + · rintro _ ⟨y, hy, rfl⟩ + obtain ⟨a, ha, hya⟩ := hvertex y hy + by_cases hta : t a + · exact Or.inl ⟨y, mem_iUnion₂.mpr ⟨a, ⟨ha, hta⟩, hya⟩, rfl⟩ + · exact Or.inr ⟨y, mem_iUnion₂.mpr ⟨a, ⟨ha, hta⟩, hya⟩, rfl⟩ + have key : ∀ a ∈ Γ.E, ∀ b ∈ Γ.E, t a → t b := by + intro a ha b hb hta + by_contra htb + obtain ⟨x, hx⟩ := hnon a ha + obtain ⟨y, hy⟩ := hnon b hb + have hne : C₁.Nonempty := ⟨_, x, mem_iUnion₂.mpr ⟨a, ⟨ha, hta⟩, hx⟩, rfl⟩ + have hcl₁ : IsClosed C₁ := hcl {c ∈ Γ.E | t c} fun _ h => h.1 + have hcl₂ : IsClosed C₂ := hcl {c ∈ Γ.E | ¬t c} fun _ h => h.1 + have hempty := GM11.eq_empty_of_split hT hD2.2 hcl₁ hcl₂ hdis hU hne + have hmem : cap.emb y ∈ C₂ := ⟨y, mem_iUnion₂.mpr ⟨b, ⟨hb, htb⟩, hy⟩, rfl⟩ + have hC₂ : C₂ = ∅ := hempty + rw [hC₂] at hmem + exact hmem + exact ⟨key c hc c' hc', key c' hc' c hc⟩ + +end Pairs + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section8c.lean b/LeanPool/GraphMinor/GM19/Section8c.lean new file mode 100644 index 0000000000..86d3633ca5 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section8c.lean @@ -0,0 +1,391 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section8b +public import LeanPool.GraphMinor.GM10.Section8 +public import LeanPool.GraphMinor.GM10.Section9 + +/-! +# Graph Minors XIX, (8.2) and (8.3) + +The tie-breakers of Section 8 are tie-breakers in the sense of Graph Minors X. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} + +section Sep + +variable {A B : Hypergraph S (Set S)} + +omit [T2Space S] in +theorem edge_cases (h : Γ.toHypergraph.IsSeparation A B) {c : Set S} (hc : c ∈ Γ.E) : + (c ∈ A.edgeSet ∧ c ∉ B.edgeSet) ∨ (c ∉ A.edgeSet ∧ c ∈ B.edgeSet) := by + have h₁ : c ∈ (A ∪ B).edgeSet := by + rw [h.union_eq] + exact hc + have h₂ : ∀ {x}, x ∈ A.edgeSet → x ∈ B.edgeSet → False := fun hA hB ↦ by + have : _ ∈ (A ∩ B).edgeSet := ⟨hA, hB⟩ + rw [h.edgeSet_inter_eq] at this + exact this + rcases h₁ with h₁ | h₁ + · exact Or.inl ⟨h₁, fun hB ↦ h₂ h₁ hB⟩ + · exact Or.inr ⟨fun hA ↦ h₂ hA h₁, h₁⟩ + +/-- A pair decides whether a separation splits an edge of `Γ*`. -/ +theorem splits_of_pair (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + {rad : RadialDrawing cap Γ} {e : Set Shat} {c₁ c₂ : Set S} (hp : rad.PairOf e c₁ c₂) + (h : Γ.toHypergraph.IsSeparation A B) : + rad.Splits A B e ↔ ¬ (c₁ ∈ A.edgeSet ↔ c₂ ∈ A.edgeSet) := by + obtain ⟨hc₁, hc₂⟩ : c₁ ∈ Γ.E ∧ c₂ ∈ Γ.E := by + obtain ⟨_, _, _, _, _, _, _, _, h₁, h₂, _⟩ := hp + exact ⟨h₁.1, h₂.1⟩ + have h₁ := edge_cases h hc₁ + have h₂ := edge_cases h hc₂ + rw [rad.splits_iff] + constructor + · rintro ⟨d₁, d₂, hd, hs⟩ + rcases hp.unique hS h3 hd with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> tauto + · intro hn + refine ⟨c₁, c₂, hp, ?_⟩ + tauto + +end Sep + +/-- The pure order fact behind the second tie-breaker axiom. -/ +theorem lex_axiom2 {n₁ n₂ n₃ n₄ : ℕ} {x₁ x₂ x₃ x₄ y₁ y₂ y₃ y₄ : ℝ} (hn : n₃ + n₄ = n₁ + n₂) + (hx : x₃ + x₄ ≤ x₁ + x₂) (hy : y₃ + y₄ = y₁ + y₂) : + (toLex (n₃, toLex (x₃, y₃)) ≤ toLex (n₁, toLex (x₁, y₁)) ∨ + toLex (n₄, toLex (x₄, y₄)) < toLex (n₂, toLex (x₂, y₂))) ∧ + (toLex (n₃, toLex (x₃, y₃)) < toLex (n₁, toLex (x₁, y₁)) ∨ + toLex (n₄, toLex (x₄, y₄)) ≤ toLex (n₂, toLex (x₂, y₂))) := by + constructor + · by_contra! h + obtain ⟨h₁, h₂⟩ := h + rw [Prod.Lex.lt_iff] at h₁ + rw [Prod.Lex.le_iff] at h₂ + simp only [ofLex_toLex] at h₁ h₂ + rcases h₁ with a | ⟨a, b⟩ + · rcases h₂ with c | ⟨c, -⟩ <;> omega + · rcases h₂ with c | ⟨c, d⟩ + · omega + · rw [Prod.Lex.lt_iff] at b + rw [Prod.Lex.le_iff] at d + simp only [ofLex_toLex] at b d + rcases b with b | ⟨b, e⟩ + · rcases d with d | ⟨d, -⟩ <;> linarith + · rcases d with d | ⟨-, d⟩ <;> linarith + · by_contra! h + obtain ⟨h₁, h₂⟩ := h + rw [Prod.Lex.le_iff] at h₁ + rw [Prod.Lex.lt_iff] at h₂ + simp only [ofLex_toLex] at h₁ h₂ + rcases h₁ with a | ⟨a, b⟩ + · rcases h₂ with c | ⟨c, -⟩ <;> omega + · rcases h₂ with c | ⟨c, d⟩ + · omega + · rw [Prod.Lex.le_iff] at b + rw [Prod.Lex.lt_iff] at d + simp only [ofLex_toLex] at b d + rcases d with d | ⟨d, e⟩ + · rcases b with b | ⟨b, -⟩ <;> linarith + · rcases b with b | ⟨-, b⟩ <;> linarith + +theorem ite_cast (p q : Prop) [Decidable p] [Decidable q] (x : ℝ) : + (((if p then 1 else 0) - (if q then 1 else 0) : ℚ) : ℝ) * x = + (if p then x else 0) - (if q then x else 0) := by + by_cases hp : p <;> by_cases hq : q <;> simp [hp, hq] + +theorem ite_zero {p q : Prop} [Decidable p] [Decidable q] + (h : ((if p then 1 else 0) - (if q then 1 else 0) : ℚ) = 0) : p ↔ q := by + by_cases hp : p <;> by_cases hq : q <;> simp_all + +/-- A sum over a finite set, written as a sum over a larger one. -/ +theorem finsum_eq_sum_ite {T : Type*} {s : Set T} (F : Finset T) (hs : s ⊆ F) (f : T → ℝ) + [DecidablePred (· ∈ s)] : ∑ᶠ x ∈ s, f x = ∑ x ∈ F, if x ∈ s then f x else 0 := by + rw [← Finset.sum_filter] + have : s = ↑(F.filter (· ∈ s)) := by + ext x + simp only [Finset.coe_filter, mem_ofPred_eq] + exact ⟨fun h ↦ ⟨hs h, h⟩, fun h ↦ h.2⟩ + conv_lhs => rw [this] + exact finsum_mem_coe_finset _ _ + +/-- A separation is decided by its middle and its edges, when each vertex is an end of an edge. -/ +theorem side_le {α β : Type*} {G A B C D : Hypergraph α β} (hAB : G.IsSeparation A B) + (hCD : G.IsSeparation C D) (hV : (A ∩ B).vertexSet ⊆ (C ∩ D).vertexSet) + (hE : A.edgeSet ⊆ C.edgeSet) (hinc : ∀ v ∈ G.vertexSet, ∃ c, G.Inc c v) : A ≤ C := by + refine ⟨fun v hv ↦ ?_, hE, fun e he ↦ ?_⟩ + · by_cases hvB : v ∈ B.vertexSet + · exact (hV ⟨hv, hvB⟩).1 + · obtain ⟨c, hc⟩ := hinc v (hAB.left_le.vertexSet_subset hv) + have hcG := G.edge_mem_of_inc hc + rw [← hAB.union_eq] at hcG + rcases hcG with hcA | hcB + · have h₁ : v ∈ G.ends c := hc + rw [hCD.left_le.ends_eq c (hE hcA)] at h₁ + exact C.vertex_mem_of_inc h₁ + · have h₁ : v ∈ G.ends c := hc + rw [hAB.right_le.ends_eq c hcB] at h₁ + exact absurd (B.vertex_mem_of_inc h₁) hvB + · rw [← hCD.left_le.ends_eq e (hE he), hAB.left_le.ends_eq e he] + +section TieBreaker + +variable [T2Space Shat] {rad : RadialDrawing cap Γ} + +omit [T2Space Shat] in +omit [T2Space S] in +theorem splits_comm {A B : Hypergraph S (Set S)} {e : Set Shat} : + rad.Splits A B e ↔ rad.Splits B A e := by + simp only [rad.splits_iff, or_comm] + +omit [T2Space Shat] [T2Space S] in +theorem TieBreaker.lambdaOrder_comm (tb : TieBreaker rad) (A B : Hypergraph S (Set S)) : + tb.lambdaOrder (A, B) = tb.lambdaOrder (B, A) := by + have hi : (A ∩ B).vertexSet = (B ∩ A).vertexSet := Set.inter_comm _ _ + have h₁ : tb.N1 (A, B) = tb.N1 (B, A) := by + simp only [TieBreaker.N1, Hypergraph.separationOrder, hi] + have h₂ : tb.N2 (A, B) = tb.N2 (B, A) := by + simp only [TieBreaker.N2, splits_comm (A := A)] + have h₃ : tb.N3 (A, B) = tb.N3 (B, A) := by + simp only [TieBreaker.N3, hi] + simp only [TieBreaker.lambdaOrder, h₁, h₂, h₃] + +open Classical in +omit [T2Space Shat] in +theorem TieBreaker.N2_le (tb : TieBreaker rad) (hS : IsSurface S) + (h3 : Γ.IsInternallyThreeConnected) {A B C D : Hypergraph S (Set S)} + (hAB : Γ.toHypergraph.IsSeparation A B) (hCD : Γ.toHypergraph.IsSeparation C D) : + tb.N2 (A ∪ C, B ∩ D) + tb.N2 (A ∩ C, B ∪ D) ≤ tb.N2 (A, B) + tb.N2 (C, D) := by + have hEfin : rad.G.E.Finite := rad.G.finite_edges + have hfs : ∀ A' B' : Hypergraph S (Set S), {e ∈ rad.G.E | rad.Splits A' B' e} ⊆ + ↑hEfin.toFinset := fun _ _ e he ↦ by simpa using he.1 + simp only [TieBreaker.N2, finsum_eq_sum_ite _ (hfs _ _), ← Finset.sum_add_distrib] + refine Finset.sum_le_sum fun e he ↦ ?_ + have heE : e ∈ rad.G.E := by simpa using he + have hpos := tb.wtE_pos e heE + have hs₁ := hAB.union_inter hCD + have hs₂ := (hAB.symm.union_inter hCD.symm).symm + by_cases hp : ∃ c₁ c₂, rad.PairOf e c₁ c₂ + · obtain ⟨c₁, c₂, hp⟩ := hp + have e₁ := splits_of_pair hS h3 hp hAB + have e₂ := splits_of_pair hS h3 hp hCD + have e₃ := splits_of_pair hS h3 hp hs₁ + have e₄ := splits_of_pair hS h3 hp hs₂ + have hA₁ : c₁ ∈ (A ∪ C).edgeSet ↔ (c₁ ∈ A.edgeSet ∨ c₁ ∈ C.edgeSet) := Iff.rfl + have hA₂ : c₂ ∈ (A ∪ C).edgeSet ↔ (c₂ ∈ A.edgeSet ∨ c₂ ∈ C.edgeSet) := Iff.rfl + have hB₁ : c₁ ∈ (A ∩ C).edgeSet ↔ (c₁ ∈ A.edgeSet ∧ c₁ ∈ C.edgeSet) := Iff.rfl + have hB₂ : c₂ ∈ (A ∩ C).edgeSet ↔ (c₂ ∈ A.edgeSet ∧ c₂ ∈ C.edgeSet) := Iff.rfl + simp only [mem_ofPred_eq, mem_ofPred_eq, heE, true_and, e₁, e₂, e₃, e₄, hA₁, hA₂, hB₁, hB₂] + by_cases a₁ : c₁ ∈ A.edgeSet <;> by_cases a₂ : c₂ ∈ A.edgeSet <;> + by_cases b₁ : c₁ ∈ C.edgeSet <;> by_cases b₂ : c₂ ∈ C.edgeSet <;> + simp [a₁, a₂, b₁, b₂, hpos.le] + · have hno : ∀ A' B' : Hypergraph S (Set S), ¬ rad.Splits A' B' e := fun A' B' h ↦ by + obtain ⟨c₁, c₂, h, -⟩ := rad.splits_iff.mp h + exact hp ⟨c₁, c₂, h⟩ + simp [hno] + +open Classical in +omit [T2Space S] [T2Space Shat] in +theorem TieBreaker.N3_eq (tb : TieBreaker rad) {A B C D : Hypergraph S (Set S)} + (hAB : Γ.toHypergraph.IsSeparation A B) (hCD : Γ.toHypergraph.IsSeparation C D) : + tb.N3 (A ∪ C, B ∩ D) + tb.N3 (A ∩ C, B ∪ D) = tb.N3 (A, B) + tb.N3 (C, D) := by + have hle : ∀ {P Q : Hypergraph S (Set S)}, Γ.toHypergraph.IsSeparation P Q → + (P ∩ Q).vertexSet ⊆ ↑Γ.finite_V.toFinset := fun h v hv ↦ by + exact Γ.finite_V.mem_toFinset.mpr (h.left_le.vertexSet_subset hv.1) + have hs₁ := hAB.union_inter hCD + have hs₂ := (hAB.symm.union_inter hCD.symm).symm + simp only [TieBreaker.N3, finsum_eq_sum_ite _ (hle hAB), finsum_eq_sum_ite _ (hle hCD), + finsum_eq_sum_ite _ (hle hs₁), finsum_eq_sum_ite _ (hle hs₂), ← Finset.sum_add_distrib] + refine Finset.sum_congr rfl fun v hv ↦ ?_ + have hvV : v ∈ Γ.toHypergraph.vertexSet := Γ.finite_V.mem_toFinset.mp hv + have h₁ : v ∈ (A ∪ B).vertexSet := hAB.union_eq ▸ hvV + have h₂ : v ∈ (C ∪ D).vertexSet := hCD.union_eq ▸ hvV + have h₁' : v ∈ A.vertexSet ∨ v ∈ B.vertexSet := h₁ + have h₂' : v ∈ C.vertexSet ∨ v ∈ D.vertexSet := h₂ + have m₁ : v ∈ (A ∩ B).vertexSet ↔ (v ∈ A.vertexSet ∧ v ∈ B.vertexSet) := Iff.rfl + have m₂ : v ∈ (C ∩ D).vertexSet ↔ (v ∈ C.vertexSet ∧ v ∈ D.vertexSet) := Iff.rfl + have m₃ : v ∈ ((A ∪ C) ∩ (B ∩ D)).vertexSet ↔ + ((v ∈ A.vertexSet ∨ v ∈ C.vertexSet) ∧ (v ∈ B.vertexSet ∧ v ∈ D.vertexSet)) := Iff.rfl + have m₄ : v ∈ ((A ∩ C) ∩ (B ∪ D)).vertexSet ↔ + ((v ∈ A.vertexSet ∧ v ∈ C.vertexSet) ∧ (v ∈ B.vertexSet ∨ v ∈ D.vertexSet)) := Iff.rfl + simp only [m₁, m₂, m₃, m₄] + by_cases a : v ∈ A.vertexSet <;> by_cases b : v ∈ B.vertexSet <;> + by_cases c : v ∈ C.vertexSet <;> by_cases d : v ∈ D.vertexSet <;> simp_all + +omit [T2Space Shat] in +/-- **Graph Minors XIX, (8.3)**, in the form of the second tie-breaker axiom of Graph Minors X. -/ +theorem TieBreaker.lambda_sum (tb : TieBreaker rad) (hS : IsSurface S) + (h3 : Γ.IsInternallyThreeConnected) {A B C D : Hypergraph S (Set S)} + (hAB : Γ.toHypergraph.IsSeparation A B) (hCD : Γ.toHypergraph.IsSeparation C D) : + (tb.lambdaOrder (A ∪ C, B ∩ D) ≤ tb.lambdaOrder (A, B) ∨ + tb.lambdaOrder (A ∩ C, B ∪ D) < tb.lambdaOrder (C, D)) ∧ + (tb.lambdaOrder (A ∪ C, B ∩ D) < tb.lambdaOrder (A, B) ∨ + tb.lambdaOrder (A ∩ C, B ∪ D) ≤ tb.lambdaOrder (C, D)) := by + refine lex_axiom2 ?_ (tb.N2_le hS h3 hAB hCD) (tb.N3_eq hAB hCD) + have := separationOrder_add_separationOrder hAB hCD + simp only [TieBreaker.N1] + omega + +omit [T2Space Shat] in +/-- **Graph Minors XIX, (8.2).** Separations with the same `λ`-order are equal, up to swapping. -/ +theorem TieBreaker.eq_of_lambda_eq (tb : TieBreaker rad) (hS : IsSurface S) + (h3 : Γ.IsInternallyThreeConnected) {A B C D : Hypergraph S (Set S)} + (hAB : Γ.toHypergraph.IsSeparation A B) (hCD : Γ.toHypergraph.IsSeparation C D) + (h : tb.lambdaOrder (A, B) = tb.lambdaOrder (C, D)) : (A = C ∧ B = D) ∨ (A = D ∧ B = C) := by + classical + have h' := congrArg ofLex h + simp only [TieBreaker.lambdaOrder, ofLex_toLex, Prod.mk.injEq] at h' + obtain ⟨-, h'⟩ := h' + have h'' := congrArg ofLex h' + simp only [ofLex_toLex, Prod.mk.injEq] at h'' + obtain ⟨hN₂, hN₃⟩ := h'' + have hEfin : rad.G.E.Finite := rad.G.finite_edges + have hfs : ∀ A' B' : Hypergraph S (Set S), {e ∈ rad.G.E | rad.Splits A' B' e} ⊆ + ↑hEfin.toFinset := fun _ _ e he ↦ hEfin.mem_toFinset.mpr he.1 + have hspl : ∀ e ∈ rad.G.E, rad.Splits A B e ↔ rad.Splits C D e := by + let α : Set Shat → ℚ := fun e ↦ + (if rad.Splits A B e then 1 else 0) - (if rad.Splits C D e then 1 else 0) + have hsum : ∑ᶠ e ∈ rad.G.E, (α e : ℝ) * tb.wtE e = + ∑ᶠ v ∈ Γ.V, (((0 : S → ℚ) v : ℚ) : ℝ) * tb.wtV v := by + have hl : ∑ᶠ e ∈ rad.G.E, (α e : ℝ) * tb.wtE e = tb.N2 (A, B) - tb.N2 (C, D) := by + simp only [TieBreaker.N2, finsum_eq_sum_ite _ (hfs _ _), + finsum_eq_sum_ite hEfin.toFinset (fun e he ↦ hEfin.mem_toFinset.mpr he), + ← Finset.sum_sub_distrib] + refine Finset.sum_congr rfl fun e he ↦ ?_ + have heE : e ∈ rad.G.E := hEfin.mem_toFinset.mp he + simp only [heE, mem_ofPred_eq, true_and, ite_true, α] + exact ite_cast _ _ _ + rw [hl, hN₂] + simp + have hz := (tb.rationally_independent α 0 hsum).1 + intro e he + have := hz e he + exact ite_zero this + have hvert : (A ∩ B).vertexSet = (C ∩ D).vertexSet := by + have hle : ∀ {P Q : Hypergraph S (Set S)}, Γ.toHypergraph.IsSeparation P Q → + (P ∩ Q).vertexSet ⊆ ↑Γ.finite_V.toFinset := fun h v hv ↦ + Γ.finite_V.mem_toFinset.mpr (h.left_le.vertexSet_subset hv.1) + let β : S → ℚ := fun v ↦ + (if v ∈ (A ∩ B).vertexSet then 1 else 0) - (if v ∈ (C ∩ D).vertexSet then 1 else 0) + have hsum : ∑ᶠ e ∈ rad.G.E, (((0 : Set Shat → ℚ) e : ℚ) : ℝ) * tb.wtE e = + ∑ᶠ v ∈ Γ.V, (β v : ℝ) * tb.wtV v := by + have hl : ∑ᶠ v ∈ Γ.V, (β v : ℝ) * tb.wtV v = tb.N3 (A, B) - tb.N3 (C, D) := by + simp only [TieBreaker.N3, finsum_eq_sum_ite _ (hle hAB), finsum_eq_sum_ite _ (hle hCD), + finsum_eq_sum_ite Γ.finite_V.toFinset (fun v hv ↦ Γ.finite_V.mem_toFinset.mpr hv), + ← Finset.sum_sub_distrib] + refine Finset.sum_congr rfl fun v hv ↦ ?_ + have hvV : v ∈ Γ.V := Γ.finite_V.mem_toFinset.mp hv + simp only [hvV, ite_true, β] + exact ite_cast _ _ _ + rw [hl, hN₃] + simp + have hz := (tb.rationally_independent 0 β hsum).2 + ext v + by_cases hv : v ∈ Γ.V + · exact ite_zero (hz v hv) + · exact ⟨fun h ↦ absurd (hAB.left_le.vertexSet_subset h.1) hv, + fun h ↦ absurd (hCD.left_le.vertexSet_subset h.1) hv⟩ + have hsame : ∀ {c c' : Set S}, c ∈ Γ.E → c' ∈ Γ.E → + ((c ∈ A.edgeSet ↔ c ∈ C.edgeSet) ↔ (c' ∈ A.edgeSet ↔ c' ∈ C.edgeSet)) := by + intro c c' hc hc' + refine edges_same hS h3 rad (fun c ↦ c ∈ A.edgeSet ↔ c ∈ C.edgeSet) ?_ hc hc' + intro e he c₁ c₂ hp + have e₁ := splits_of_pair hS h3 hp hAB + have e₂ := splits_of_pair hS h3 hp hCD + have := hspl e he + rw [e₁, e₂] at this + tauto + have hinc : ∀ v ∈ Γ.toHypergraph.vertexSet, ∃ c, Γ.toHypergraph.Inc c v := fun v hv ↦ by + obtain ⟨c, hc, hvc⟩ := exists_edge_incident hS h3 rad hv + exact ⟨c, hc, hv, hvc, fun h ↦ Γ.disjoint_V hc h hv⟩ + have hdecide : ∀ {P Q R T : Hypergraph S (Set S)}, Γ.toHypergraph.IsSeparation P Q → + Γ.toHypergraph.IsSeparation R T → (P ∩ Q).vertexSet = (R ∩ T).vertexSet → + (∀ c ∈ Γ.E, (c ∈ P.edgeSet ↔ c ∈ R.edgeSet)) → P = R ∧ Q = T := by + intro P Q R T hPQ hRT hV hE + have hE' : ∀ c ∈ Γ.E, (c ∈ Q.edgeSet ↔ c ∈ T.edgeSet) := fun c hc ↦ by + have := hE c hc + have h₁ := edge_cases hPQ hc + have h₂ := edge_cases hRT hc + tauto + have hVc : (Q ∩ P).vertexSet = (T ∩ R).vertexSet := by + have e₁ : (Q ∩ P).vertexSet = (P ∩ Q).vertexSet := Set.inter_comm _ _ + have e₂ : (T ∩ R).vertexSet = (R ∩ T).vertexSet := Set.inter_comm _ _ + rw [e₁, e₂, hV] + exact ⟨le_antisymm + (side_le hPQ hRT hV.subset (fun c hc ↦ (hE c (hPQ.left_le.edgeSet_subset hc)).mp hc) hinc) + (side_le hRT hPQ hV.symm.subset + (fun c hc ↦ (hE c (hRT.left_le.edgeSet_subset hc)).mpr hc) hinc), + le_antisymm + (side_le hPQ.symm hRT.symm hVc.subset + (fun c hc ↦ (hE' c (hPQ.right_le.edgeSet_subset hc)).mp hc) hinc) + (side_le hRT.symm hPQ.symm hVc.symm.subset + (fun c hc ↦ (hE' c (hRT.right_le.edgeSet_subset hc)).mpr hc) hinc)⟩ + obtain ⟨c₀, hc₀⟩ := h3.1 + by_cases ht : c₀ ∈ A.edgeSet ↔ c₀ ∈ C.edgeSet + · exact Or.inl (hdecide hAB hCD hvert fun c hc ↦ (hsame hc₀ hc).mp ht) + · refine Or.inr ?_ + have hvert' : (A ∩ B).vertexSet = (D ∩ C).vertexSet := by + rw [hvert] + exact Set.inter_comm _ _ + refine hdecide hAB hCD.symm hvert' fun c hc ↦ ?_ + have h₁ : ¬ (c ∈ A.edgeSet ↔ c ∈ C.edgeSet) := fun h ↦ ht ((hsame hc hc₀).mp h) + have h₂ := edge_cases hCD hc + tauto + +omit [T2Space Shat] in +/-- The `λ`-order of a tie-breaker of a painting is a tie-breaker of Graph Minors X. -/ +theorem TieBreaker.isTieBreaker (tb : TieBreaker rad) (hS : IsSurface S) + (h3 : Γ.IsInternallyThreeConnected) : IsTieBreaker Γ.toHypergraph tb.lambdaOrder where + axiom1 A B C D hAB hCD := by + constructor + · exact tb.eq_of_lambda_eq hS h3 hAB hCD + · rintro (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) + · rfl + · exact tb.lambdaOrder_comm _ _ + axiom2 A B C D hAB hCD := (tb.lambda_sum hS h3 hAB hCD).1 + axiom3 A B C D _ _ h := by + simp only [TieBreaker.lambdaOrder] + exact Prod.Lex.toLex_lt_toLex.mpr (Or.inl h) + +end TieBreaker + +/-- **Graph Minors XIX, (8.2).** "If $(A, B), (A', B')$ are separations with the same +$\lambda$-order, then $(A, B) = (A', +B')$ or $(B', A')$." -/ +theorem theorem_8_2_proof {rad : RadialDrawing cap Γ} (tb : TieBreaker rad) + (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) {A B A' B' : Hypergraph S (Set S)} + (hAB : Γ.toHypergraph.IsSeparation A B) (hAB' : Γ.toHypergraph.IsSeparation A' B') + (h : tb.lambdaOrder (A, B) = tb.lambdaOrder (A', B')) : + (A = A' ∧ B = B') ∨ (A = B' ∧ B = A') := + tb.eq_of_lambda_eq hS h3 hAB hAB' h + +/-- **Graph Minors XIX, (8.3).** "If $(A, B), (A', B')$ are separations then so are $(A \cup A', B +\cap B')$, $(A \cap A', B +\cup B')$, and either $(A \cup A', B \cap B')$ has smaller $\lambda$-order than $(A, B)$, or +$(A \cap A', B \cup B')$ has $\lambda$-order at most that of $(A', B')$." -/ +theorem theorem_8_3_proof {rad : RadialDrawing cap Γ} (tb : TieBreaker rad) + (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) {A B A' B' : Hypergraph S (Set S)} + (hAB : Γ.toHypergraph.IsSeparation A B) (hAB' : Γ.toHypergraph.IsSeparation A' B') : + Γ.toHypergraph.IsSeparation (A ∪ A') (B ∩ B') ∧ + Γ.toHypergraph.IsSeparation (A ∩ A') (B ∪ B') ∧ + (tb.lambdaOrder (A ∪ A', B ∩ B') < tb.lambdaOrder (A, B) ∨ + tb.lambdaOrder (A ∩ A', B ∪ B') ≤ tb.lambdaOrder (A', B')) := + ⟨hAB.union_inter hAB', (hAB.symm.union_inter hAB'.symm).symm, + (tb.lambda_sum hS h3 hAB hAB').2⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section8d.lean b/LeanPool/GraphMinor/GM19/Section8d.lean new file mode 100644 index 0000000000..494359aa6f --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section8d.lean @@ -0,0 +1,67 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section8c +public import LeanPool.GraphMinor.GM18.Section7 + +/-! +# Graph Minors XIX, (8.8) + +A rooted location linked to a tangle isolates it, by (7.1) of Graph Minors XVIII. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} + +omit [T2Space S] in +theorem Arm.order_le_ord {L : RootedLocation Γ} {A : Arm Γ} (hA : A ∈ L.arms) : A.order ≤ L.ord := + le_csSup (L.finite_arms.image _).bddAbove (mem_image_of_mem _ hA) + +/-- **Graph Minors XIX, (8.8).** "If $\mathscr{T}$ is a tangle in $\Gamma$, and $\mathscr{L}$ is a +rooted location with +$\mathscr{L}^- \subseteq \mathscr{T}$, and $ord(\mathscr{L}) < \theta \le ord(\mathscr{T})$, +and $\mathscr{L}$ is $\lambda$-linked to $\mathscr{T}$, then $\mathscr{L}$ $\theta$-isolates +$\mathscr{T}$." +The paper applies (7.1) of Graph Minors XVIII to `ℒ⁻`. We apply it to each `(A⁻, Aᶜ)` alone, since +two arms with the same `A⁻` and different `πBar(A)` do not form a location of Graph Minors X. -/ +theorem theorem_8_8_proof {rad : RadialDrawing cap Γ} (tb : TieBreaker rad) + (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) {ord θ : ℕ} + {𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} (h𝒯 : IsTangle Γ.toHypergraph ord 𝒯) + {L : RootedLocation Γ} (hlink : L.IsLambdaLinked tb 𝒯) (hlt : L.ord < θ) (hle : θ ≤ ord) : + L.Isolates tb θ ord 𝒯 where + seps_subset := hlink.1 + ord_lt := hlt + le_ord := hle + distinction_le A hA ord' 𝒯' h𝒯' hθ' hswap C D hCD := by + have hmem : A.sep ∈ 𝒯 := hlink.1 (mem_image_of_mem _ hA) + have hloc : IsLocation Γ.toHypergraph {A.sep} := + ⟨fun p hp ↦ by + rw [mem_singleton_iff.mp hp] + exact A.isSeparation, + fun p₁ h₁ p₂ h₂ hne ↦ absurd ((mem_singleton_iff.mp h₁).trans + (mem_singleton_iff.mp h₂).symm) hne⟩ + have hord : GM18.locationOrder {A.sep} < θ := by + have h₁ : GM18.locationOrder {A.sep} = A.order := by + simp [GM18.locationOrder, Arm.order, Arm.sep] + rw [h₁] + exact (Arm.order_le_ord hA).trans_lt hlt + have hiso := GM18.theorem_7_1_proof (tb.isTieBreaker hS h3) h𝒯 hle hloc + (singleton_subset_iff.2 hmem) hord (fun C' D' hp ↦ by + obtain ⟨rfl, rfl⟩ := Prod.mk.inj (mem_singleton_iff.mp hp) + exact hlink.2 A hA) + exact hiso.distinction_le (C := A.sep.1) (D := A.sep.2) (mem_singleton A.sep) h𝒯' hθ' hswap hCD + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section8e.lean b/LeanPool/GraphMinor/GM19/Section8e.lean new file mode 100644 index 0000000000..f6a5e0703a --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section8e.lean @@ -0,0 +1,858 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Epstein +public import LeanPool.GraphMinor.GM19.Section8c +public import LeanPool.GraphMinor.GM11.Section5b +public import LeanPool.GraphMinor.GM11.RadialFacts +public import LeanPool.GraphMinor.GM11.CircuitRegions +public import LeanPool.GraphMinor.GM14.DiscSlope + +/-! +# Graph Minors XIX, (8.1): the edges of `Γ*` split by a separation + +Let `(A, B)` be a separation of `Γ`. We extend `Γ*` to a radial drawing `G₃` of `sk(Γ)`, which adds +spokes only inside the discs of the edges of size 3. Each region of `G₃` contains one edge of +`sk(Γ)`, +and so one edge of `Γ`, and we colour the region by whether that edge is in `A`. The edges of `G₃` +between regions of different colours are the edges of `Γ*` split by `(A, B)` (`boundary_split`). +So these edges form the drawing `N(Z)` of Graph Minors XI, and its vertices have even valency. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} + +omit [T2Space S] in +/-- **`Γ*` extends to a radial drawing of `sk(Γ)`**, with no new spokes in the regions of `Γ`. -/ +theorem RadialDrawing.exists_full (rad : RadialDrawing cap Γ) (hS : IsSurface S) + (h2 : ∀ r ∈ Γ.hatRegions cap, IsOpenDisc r) (_hE : Γ.E.Nonempty) : + ∃ D G₃ : Drawing Shat, IsSkHat cap Γ D ∧ PreRad (PaintingOrDrawing.drawing D) G₃ ∧ + RadMax (PaintingOrDrawing.drawing D) G₃ ∧ rad.G.IsSubdrawing G₃ ∧ + ∀ e ∈ G₃.E, ∀ r ∈ Γ.hatRegions cap, e ⊆ r → e ∈ rad.G.E := by + classical + have hT := cap.isClosedSurface + have : T2Space Shat := hT.2.1 + have : ConnectedSpace Shat := cap.connected + obtain ⟨D, W, hDU, hDV, hD2, -, hG'⟩ := Γ.exists_hubDrawing hS cap h2 + have hD : IsSkHat cap Γ D := ⟨hDU, hDV⟩ + obtain ⟨G', hpre, hU', hV', hE'⟩ := hG' rad.G rad.isPreRadial + obtain ⟨hG1, hG2, hG3, hG4, hG5, hG6⟩ := id rad.isPreRadial + have hGsub : rad.G.IsSubdrawing G' := ⟨by rw [hV']; exact subset_union_left, by rw [hE']⟩ + let A : Set ℕ := {n | ∃ G₄ : Drawing Shat, (PaintingOrDrawing.drawing D).IsPreRadialDrawing G₄ ∧ + G'.IsSubdrawing G₄ ∧ G₄.E.ncard = n} + have hAne : A.Nonempty := ⟨_, G', hpre, ⟨subset_rfl, subset_rfl⟩, rfl⟩ + have hAb : BddAbove A := ⟨D.V.ncard + 2 * D.E.ncard, by + rintro _ ⟨G₄, h₄, -, rfl⟩ + exact ncard_spokes_le (Γ := D) (Γ' := G₄) ⟨hD2, h₄⟩ hT⟩ + obtain ⟨G₃, hpre₃, hsub₃, hc₃⟩ := Nat.sSup_mem hAne hAb + have hrad : PreRad (PaintingOrDrawing.drawing D) G₃ := ⟨hD2, hpre₃⟩ + have hmax : RadMax (PaintingOrDrawing.drawing D) G₃ := by + intro G₄ h₄ hs + refine ⟨fun y hy ↦ ?_, ?_⟩ + · by_cases hyV : y ∈ D.V + · exact hpre₃.2.1 hyV + obtain ⟨p, hp, hyp⟩ := h₄.2.2.2.1 y ⟨hy, hyV⟩ + obtain ⟨y', ⟨hy'p, hy'⟩, -⟩ := hpre₃.2.2.1 p hp + rw [(h₄.2.2.1 p hp).unique ⟨hyp, hy⟩ ⟨hy'p, hs.1 hy'⟩] + exact hy' + · have hle : G₄.E.ncard ≤ G₃.E.ncard := by + rw [hc₃] + exact le_csSup hAb ⟨G₄, h₄, ⟨hsub₃.1.trans hs.1, hsub₃.2.trans hs.2⟩, rfl⟩ + exact (eq_of_subset_of_ncard_le hs.2 hle G₄.finite_edges).ge + have hsub : rad.G.IsSubdrawing G₃ := ⟨hGsub.1.trans hsub₃.1, hGsub.2.trans hsub₃.2⟩ + refine ⟨D, G₃, hD, hrad, hmax, hsub, ?_⟩ + have hhat : ∀ x ∈ Γ.hatRegions cap, Disjoint x (Γ.hatU cap) := by + rintro _ ⟨y, hy, rfl⟩ + exact disjoint_left.mpr fun z hz hzU ↦ connectedComponentIn_subset _ _ hz hzU + let E₄ : Set (Set Shat) := {e | e ∈ G₃.E ∧ ∃ r ∈ Γ.hatRegions cap, e ⊆ r} + let G₄ : Drawing Shat := G₃.span rad.G.V E₄ + have hends : ∀ e ∈ E₄, ∃ v ∈ Γ.hatV cap, ∃ w ∈ rad.G.V \ Γ.hatV cap, + closure e ∩ G₃.V = {v, w} := by + rintro e ⟨he, r, hr, her⟩ + obtain ⟨v, hv, r', hr', w, hw, hwV, hset, hsubr⟩ := spoke_ends hrad hT he + obtain ⟨x, hx⟩ := he.1 + have hrD := hD.hatRegion_mem_R hr + obtain rfl : r' = r := region_eq_of_mem hr' hrD (hsubr hx) (her hx) + obtain ⟨w₀, ⟨hw₀r, hw₀⟩, -⟩ := hG3 r' hr + have hww : w = w₀ := (hpre₃.2.2.1 r' hrD).unique ⟨hw, hwV⟩ ⟨hw₀r, hsub.1 hw₀⟩ + subst hww + refine ⟨v, ?_, w, ⟨hw₀, fun hc ↦ disjoint_left.mp (hhat _ hr) hw (image_mono Γ.V_subset hc)⟩, + hset⟩ + rw [hD.hV] at hv + exact hv + have hG4V : G₄.V = rad.G.V := by + apply Subset.antisymm + · rw [Drawing.span_V] + rintro y (hy | hy) + · exact hy.1 + · obtain ⟨e, he, hye⟩ := mem_iUnion₂.mp hy + obtain ⟨v, hv, w, hw, hset⟩ := hends e he.1 + have : y ∈ closure e ∩ G₃.V := hye + rw [hset] at this + rcases this with rfl | rfl + · exact hG2 hv + · exact hw.1 + · intro y hy + rw [Drawing.span_V] + exact Or.inl ⟨hy, hsub.1 hy⟩ + have hG4E : G₄.E = E₄ := by + rw [Drawing.span_E] + exact inter_eq_left.mpr fun _ h ↦ h.1 + have hcap : ∀ e ∈ E₄, closure e ∩ G₄.V = closure e ∩ G₃.V := by + intro e he + obtain ⟨v, hv, w, hw, hset⟩ := hends e he + apply Subset.antisymm + · rintro y ⟨hy, hyV⟩ + exact ⟨hy, hsub.1 (hG4V ▸ hyV)⟩ + · rintro y hy + refine ⟨hy.1, ?_⟩ + rw [hset] at hy + rw [hG4V] + rcases hy with rfl | rfl + · exact hG2 hv + · exact hw.1 + have hpre₄ : IsPreRadial (Γ.hatU cap) (Γ.hatV cap) G₄ := by + refine ⟨?_, hG4V ▸ hG2, hG4V ▸ hG3, hG4V ▸ hG4, ?_, ?_⟩ + · apply Subset.antisymm + · rintro y ⟨hyU, hyG⟩ + by_cases hyV : y ∈ G₄.V + · rw [← hG1] + exact ⟨hyU, rad.G.V_subset_U (hG4V ▸ hyV)⟩ + · obtain ⟨e, he, hye⟩ := G₄.exists_edge_of_mem hyG hyV + rw [hG4E] at he + obtain ⟨-, r, hr, her⟩ := he + exact absurd hyU (disjoint_left.mp (hhat r hr) (her hye)) + · intro y hy + exact ⟨image_mono Γ.V_subset hy, G₄.V_subset_U (hG4V ▸ hG2 hy)⟩ + · intro e he + rw [hG4E] at he + obtain ⟨v, hv, w, hw, hset⟩ := hends e he + exact ⟨v, hv, w, hG4V ▸ hw, by rw [hcap e he, hset]⟩ + · intro e he f hf hne v hv r hr w hw h₁ h₂ + rw [hG4E] at he hf + rw [hcap e he] at h₁ + rw [hcap f hf] at h₂ + refine hpre₃.2.2.2.2.2 e he.1 f hf.1 hne v ?_ r (hD.hatRegion_mem_R hr) w + ⟨hw.1, hsub.1 (hG4V ▸ hw.2)⟩ h₁ h₂ + change v ∈ D.V + rw [hD.hV] + exact hv + have hup : rad.G.IsSubdrawing G₄ := by + refine ⟨hG4V.ge, fun e he ↦ ?_⟩ + rw [hG4E] + refine ⟨hsub.2 he, ?_⟩ + obtain ⟨x, hx⟩ := he.1 + have hdis : ∀ y ∈ e, y ∉ Γ.hatU cap := by + intro y hy hyU + have : y ∈ Γ.hatU cap ∩ rad.G.U := ⟨hyU, (he.2.1 hy).1⟩ + rw [hG1] at this + exact (he.2.1 hy).2 (hG2 this) + have hxc : x ∈ (Γ.hatU cap)ᶜ := hdis x hx + refine ⟨connectedComponentIn (Γ.hatU cap)ᶜ x, ⟨x, hxc, rfl⟩, ?_⟩ + exact he.2.2.1.isConnected.isPreconnected.subset_connectedComponentIn hx hdis + intro e he r hr her + have := (rad.maximal G₄ hpre₄ hup).2 + exact this (hG4E ▸ ⟨he, r, hr, her⟩) + +section Colour + +variable {D G₃ : Drawing Shat} + +/-- The regions of `G₃` coloured by a property `t` of the edges of `Γ`. -/ +def colourSet (cap : IsCappedSurface S Shat) (Γ : Painting S) (G₃ : Drawing Shat) + (t : Set S → Prop) : Set (Set Shat) := + {s | s ∈ G₃.R ∧ ∃ f c, Γ.IsSkEdgeIn f c ∧ cap.emb '' f ⊆ s ∧ t c} + +variable [ConnectedSpace Shat] [T2Space Shat] + +omit [T2Space S] in +/-- Each region of `G₃` contains an edge of `sk(Γ)`. -/ +theorem exists_colour (hD : IsSkHat cap Γ D) + (hrad : PreRad (PaintingOrDrawing.drawing D) G₃) + (hmax : RadMax (PaintingOrDrawing.drawing D) G₃) (hE : D.E.Nonempty) {s : Set Shat} + (hs : s ∈ G₃.R) : + ∃ f c, Γ.IsSkEdgeIn f c ∧ cap.emb '' f ⊆ s := by + have hF := regionFacts_of_radial hrad cap.isClosedSurface hmax hE + obtain ⟨g, hg, hgs⟩ := hF.1 s hs + obtain ⟨f, hf, rfl⟩ := hD.edge_iff.mp hg + obtain ⟨c, hc⟩ := Γ.exists_isSkEdgeIn hf + exact ⟨f, c, hc, hgs⟩ + +omit [T2Space S] in +theorem colour_unique (hD : IsSkHat cap Γ D) + (hrad : PreRad (PaintingOrDrawing.drawing D) G₃) + (hmax : RadMax (PaintingOrDrawing.drawing D) G₃) (hE : D.E.Nonempty) {s : Set Shat} + (hs : s ∈ G₃.R) + {f f' c c' : Set S} (h : Γ.IsSkEdgeIn f c) (h' : Γ.IsSkEdgeIn f' c') (hf : cap.emb '' f ⊆ s) + (hf' : cap.emb '' f' ⊆ s) : f = f' ∧ c = c' := by + have hF := regionFacts_of_radial hrad cap.isClosedSurface hmax hE + have hg := hD.edge_iff.mpr ⟨f, h.mem, rfl⟩ + have hg' := hD.edge_iff.mpr ⟨f', h'.mem, rfl⟩ + have := hF.2.1 s hs _ hg _ hg' hf hf' + obtain rfl : f = f' := cap.isEmbedding.injective.image_injective this + exact ⟨rfl, h.unique h'⟩ + +omit [T2Space S] in +theorem notMem_colourSet (hD : IsSkHat cap Γ D) + (hrad : PreRad (PaintingOrDrawing.drawing D) G₃) + (hmax : RadMax (PaintingOrDrawing.drawing D) G₃) (hE : D.E.Nonempty) {t : Set S + → Prop} {s : Set Shat} + (hs : s ∈ G₃.R \ colourSet cap Γ G₃ t) : ∃ f c, Γ.IsSkEdgeIn f c ∧ cap.emb '' f ⊆ s ∧ ¬ t c + := by + obtain ⟨f, c, hc, hf⟩ := exists_colour hD hrad hmax hE hs.1 + exact ⟨f, c, hc, hf, fun ht ↦ hs.2 ⟨hs.1, f, c, hc, hf, ht⟩⟩ + +/-- An edge of `sk(Γ)` in a region of `G₃` with `e` on its boundary lies in the closure of the +region +of `sk(Γ)` that contains `e`. -/ +theorem sub_closure_region (hE : D.E.Nonempty) (hrad : PreRad (PaintingOrDrawing.drawing D) G₃) + (hmax : RadMax (PaintingOrDrawing.drawing D) G₃) (hT : IsClosedSurface Shat) {e g s r : Set + Shat} (hs : s ∈ G₃.R) (hg : g ∈ D.E) (hgs : g ⊆ s) + (hr : r ∈ D.R) (her : e ⊆ r) (hes : e ⊆ closure s) (hne : e.Nonempty) : g ⊆ closure r := by + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + obtain ⟨y, hy⟩ := hne + have hsub := region_eq_faceUnion hrad hT hmax hE hs hg hgs + obtain ⟨z, hzr, hzs⟩ := mem_closure_iff.mp (hes hy) r (region_isOpen hr) (her hy) + rcases hsub hzs with hzg | hzp + · have : z ∈ D.U := (hg.2.1 hzg).1 + exact absurd this (region_subset hr hzr) + · obtain ⟨p, hp, hzp⟩ := mem_iUnion₂.mp hzp + obtain ⟨hpR, -, hgp⟩ := hp + obtain ⟨x, hx, rfl⟩ := hpR + have hdis : Disjoint (connectedComponentIn (univ \ (radialUnion hrad).U) x) D.U := by + refine disjoint_left.mpr fun w hw hwD ↦ ?_ + have := connectedComponentIn_subset _ _ hw + exact this.2 (Or.inl hwD) + have hsubr := subset_region hr isPreconnected_connectedComponentIn hdis hzp hzr + exact hgp.trans (closure_mono hsubr) + +omit [ConnectedSpace Shat] [T2Space Shat] in +omit [T2Space S] in +/-- An edge of `sk(Γ)` in the disc of an edge `c₀` of `Γ` is inside `c₀`. -/ +theorem Painting.IsSkEdgeIn.eq_of_subset {f c c₀ : Set S} (h : Γ.IsSkEdgeIn f c) (hc₀ : c₀ ∈ Γ.E) + (hsub : cap.emb '' f ⊆ cap.emb '' closure c₀) : c = c₀ := by + obtain ⟨x, hx⟩ := h.mem.1 + obtain ⟨y, hy, hyx⟩ := hsub (mem_image_of_mem _ hx) + obtain rfl := cap.isEmbedding.injective hyx + have hxc : y ∈ c₀ := by + by_contra hn + exact (h.mem.2.1 hx).2 (Γ.tilde_subset_V hc₀ ⟨hy, hn⟩) + exact arcComp_eq_of_mem h.1 hc₀ (h.subset hx) hxc + +omit [T2Space S] in +/-- **The edges of `G₃` between regions of different colours are split.** -/ +theorem boundary_split (hS : IsSurface S) (hE : D.E.Nonempty) (rad : RadialDrawing cap Γ) + (hD : IsSkHat cap Γ D) (hrad : PreRad (PaintingOrDrawing.drawing D) G₃) + (hmax : RadMax (PaintingOrDrawing.drawing D) G₃) (hsub : rad.G.IsSubdrawing G₃) + (hhat : ∀ e ∈ G₃.E, ∀ r ∈ Γ.hatRegions cap, e ⊆ r → e ∈ rad.G.E) {t : Set S → Prop} + {e : Set Shat} (he : e ∈ (boundaryDrawing G₃ (colourSet cap Γ G₃ t)).E) : + e ∈ rad.G.E ∧ ∃ (v₀ : S) (w : Shat), v₀ ∈ Γ.V ∧ w ∈ rad.Rstar ∧ + closure e ∩ G₃.V = {cap.emb v₀, w} ∧ ∃ f₁ f₂ c₁ c₂ : Set S, + rad.PairOf e c₁ c₂ ∧ Γ.IsSkEdgeIn f₁ c₁ ∧ Γ.IsSkEdgeIn f₂ c₂ ∧ v₀ ∈ tilde f₁ + ∧ v₀ ∈ tilde f₂ ∧ + ¬ (t c₁ ↔ t c₂) := by + have hT := cap.isClosedSurface + have : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + have hF := regionFacts_of_radial hrad hT hmax hE + obtain ⟨⟨s, hsZ, hinc⟩, ⟨s', hs', hinc'⟩⟩ := mem_boundaryDrawing_E.mp he + have heG := hinc.1 + have hes : e ⊆ closure s := edge_subset_closure_of_incident hT heG hinc.2.1 hinc.2.2 + have hes' : e ⊆ closure s' := edge_subset_closure_of_incident hT heG hinc'.2.1 hinc'.2.2 + obtain ⟨f, c, hc, hfs, ht⟩ := hsZ.2 + obtain ⟨f', c', hc', hfs', ht'⟩ := notMem_colourSet hD hrad hmax hE hs' + obtain ⟨v, hv, r, hr, w, hw, hwV, hset, her⟩ := spoke_ends hrad hT heG + have hne : e.Nonempty := heG.1 + have hg := hD.edge_iff.mpr ⟨f, hc.mem, rfl⟩ + have hg' := hD.edge_iff.mpr ⟨f', hc'.mem, rfl⟩ + have h₁ := sub_closure_region hE hrad hmax hT hsZ.1 hg hfs hr her hes hne + have h₂ := sub_closure_region hE hrad hmax hT hs'.1 hg' hfs' hr her hes' hne + have hcc : c ≠ c' := fun h ↦ ht' (h ▸ ht) + rcases hD.region_cases hr with hhr | ⟨c₀, hc₀, -, hrsub⟩ + · have heR := hhat e heG r hhr her + obtain ⟨hG1, hG2, hG3, hG4, hG5, hG6⟩ := id rad.isPreRadial + have hvhat : v ∈ Γ.hatV cap := by + have : v ∈ D.V := hv + rwa [hD.hV] at this + obtain ⟨v₀, hv₀, rfl⟩ := hvhat + have hdis : Disjoint r (Γ.hatU cap) := by + obtain ⟨y, hy, rfl⟩ := hhr + exact disjoint_left.mpr fun z hz hzU ↦ connectedComponentIn_subset _ _ hz hzU + obtain ⟨w₀, ⟨hw₀r, hw₀⟩, -⟩ := hG3 r hhr + obtain rfl : w = w₀ := (hrad.2.2.2.1 r hr).unique ⟨hw, hwV⟩ ⟨hw₀r, hsub.1 hw₀⟩ + have hwR : w ∈ rad.Rstar := + ⟨hw₀, fun h ↦ disjoint_left.mp hdis hw (image_mono Γ.V_subset h)⟩ + have hsetG : closure e ∩ rad.G.V = {cap.emb v₀, w} := by + apply Subset.antisymm + · rintro y ⟨hy, hyG⟩ + rw [← hset] + exact ⟨hy, hsub.1 hyG⟩ + · intro y hy + have hy' : y ∈ closure e ∩ G₃.V := by rw [hset]; exact hy + refine ⟨hy'.1, ?_⟩ + rcases hy with rfl | rfl + · exact hG2 (mem_image_of_mem _ hv₀) + · exact hw₀ + have hvcl : cap.emb v₀ ∈ closure e := by + have : cap.emb v₀ ∈ closure e ∩ G₃.V := by rw [hset]; exact Or.inl rfl + exact this.1 + have htil : ∀ {g : Set S} {s₀ : Set Shat}, s₀ ∈ G₃.R → g ∈ arcComponentsIn (Γ.skU \ Γ.V) → + cap.emb '' g ⊆ s₀ → e ⊆ closure s₀ → v₀ ∈ tilde g := by + intro g s₀ hs₀ hgm hgs he₀ + have hcl : cap.emb v₀ ∈ closure s₀ := by + have : closure e ⊆ closure s₀ := closure_minimal he₀ isClosed_closure + exact this hvcl + have := hF.2.2 s₀ hs₀ _ (hD.edge_iff.mpr ⟨g, hgm, rfl⟩) hgs _ hv hcl + rw [(cap.isClosedEmbedding hS).closure_image_eq] at this + obtain ⟨x, hx, hxe⟩ := this + obtain rfl := cap.isEmbedding.injective hxe + exact ⟨hx, fun hxg ↦ (hgm.2.1 hxg).2 hv₀⟩ + have hregion : rad.regionOf w = r := by + obtain ⟨y, hy, hyr⟩ := hhr + change connectedComponentIn (Γ.hatU cap)ᶜ w = r + rw [← hyr] at hw ⊢ + exact (connectedComponentIn_eq hw).symm + have hfr : ∀ {g : Set S}, g ∈ arcComponentsIn (Γ.skU \ Γ.V) → cap.emb '' g ⊆ closure r → + cap.emb '' g ⊆ frontier (rad.regionOf w) := by + intro g hgm hg + rw [hregion, (region_isOpen hr).frontier_eq] + intro x hx + refine ⟨hg hx, fun hxr ↦ region_subset hr hxr ?_⟩ + rw [hD.hU] + obtain ⟨z, hz, rfl⟩ := hx + exact mem_image_of_mem _ (hgm.2.1 hz).1 + have hff : f ≠ f' := fun h ↦ hcc (hc.unique (h ▸ hc')) + refine ⟨heR, v₀, w, hv₀, hwR, hset, f, f', c, c', ⟨v₀, w, hv₀, hwR, hsetG, f, f', hff, hc, hc', + htil hsZ.1 hc.mem hfs hes, htil hs'.1 hc'.mem hfs' hes', hfr hc.mem h₁, hfr hc'.mem h₂⟩, hc, + hc', + htil hsZ.1 hc.mem hfs hes, htil hs'.1 hc'.mem hfs' hes', fun h ↦ ht' (h.mp ht)⟩ + · have hcl : closure r ⊆ cap.emb '' closure c₀ := closure_minimal hrsub + ((cap.isClosedEmbedding hS).isClosedMap _ isClosed_closure) + exact absurd ((hc.eq_of_subset hc₀ (h₁.trans hcl)).trans + (hc'.eq_of_subset hc₀ (h₂.trans hcl)).symm) hcc + +end Colour + +section Counting + +/-- A walk that alternates between `P` and its complement has at most about twice as many edges as +vertices in `P`. -/ +theorem walk_bound {α β : Type*} {G : Graph α β} (P : α → Prop) [DecidablePred P] + (halt : ∀ e x y, G.IsLink e x y → (P x ↔ ¬ P y)) {a b : α} (W : GraphWalk G a b) : + W.length + (if P a then 1 else 0) + (if P b then 1 else 0) ≤ 2 * W.support.countP P := by + induction W with + | @nil v h => + by_cases hp : P v <;> simp [hp, GraphWalk.support_nil] + | @cons u v w e h r ih => + have hx := halt _ _ _ h + rw [GraphWalk.length_cons, GraphWalk.support_cons, List.countP_cons] + by_cases hu : P u <;> by_cases hv : P v + · exact absurd hv (hx.mp hu) + · simp only [hu, hv, ite_true, ite_false, decide_true] at ih ⊢ + omega + · simp only [hu, hv, ite_true, ite_false, decide_false] at ih ⊢ + omega + · exact absurd (hx.mpr hv) hu + +/-- A circuit in a bipartite drawing has at most twice as many edges as vertices on one side. -/ +theorem IsCircuit.ncard_le {T : Type} [TopologicalSpace T] {C : Drawing T} + (hC : C.IsCircuit) + {P : Set T} (halt : ∀ e x y, C.toGraph.IsLink e x y → (x ∈ P ↔ y ∉ P)) : + C.E.ncard ≤ 2 * (C.V ∩ P).ncard := by + classical + obtain ⟨u, W, ⟨hnd, hed⟩, hpos, hV, hE⟩ := hC + have hl : C.E.ncard = W.length := by + have h : {e | e ∈ W.edges} = (W.edges.toFinset : Set (Set T)) := by + ext x + simp + rw [hE, h, ncard_coe_finset, List.toFinset_card_of_nodup hed] + rfl + have hb := walk_bound (· ∈ P) halt W + have hsupp := W.support_eq_cons + have hcount : W.support.countP (· ∈ P) = (if u ∈ P then 1 else 0) + + W.support.tail.countP (· ∈ P) := by + conv_lhs => rw [hsupp, List.countP_cons] + by_cases hu : u ∈ P <;> simp [hu, add_comm] + have hsub : (((W.support.tail.filter (· ∈ P)).toFinset : Finset T) : Set T) ⊆ C.V ∩ P := by + intro x hx + have hx' : x ∈ W.support.tail ∧ x ∈ P := by simpa using hx + exact ⟨by rw [hV]; exact List.mem_of_mem_tail hx'.1, hx'.2⟩ + have hle := ncard_le_ncard hsub (C.finite_V.subset inter_subset_left) + rw [ncard_coe_finset, List.toFinset_card_of_nodup (hnd.filter _), ← List.countP_eq_length_filter] + at hle + rw [hl] + by_cases hu : u ∈ P <;> simp only [hu, ite_true, ite_false] at hb hcount <;> omega + +end Counting + +section Mono + +variable {T : Type} [TopologicalSpace T] [T2Space T] [ConnectedSpace T] {G : Drawing T} + +/-- **A colour change inside a connected open set.** -/ +theorem exists_boundary_edge (hT : IsClosedSurface T) {Z : Set (Set T)} {X : Set T} + (hX : IsOpen X) (hXc : IsPreconnected X) {s₁ s₂ : Set T} (h₁ : s₁ ∈ Z) (hZ : Z ⊆ G.R) + (h₂ : s₂ ∈ G.R \ Z) (hm₁ : (s₁ ∩ X).Nonempty) (hm₂ : (s₂ ∩ X).Nonempty) : + ∃ e ∈ (boundaryDrawing G Z).E, (e ∩ X).Nonempty := by + classical + have hlc : LocallyConnectedSpace T := IsClosedSurface.locallyConnectedSpace hT + have hRfin : G.R.Finite := finite_R hT G + have hconn := isPreconnected_sdiff_finite hT hX hXc G.finite_V + let A : Set T := closure (⋃₀ Z) + let B : Set T := closure (⋃₀ (G.R \ Z)) + have hcov : X \ G.V ⊆ A ∪ B := by + intro y hy + have hdense : y ∈ closure (⋃₀ G.R) := by + rw [mem_closure_iff] + intro O hO hyO + obtain ⟨z, hzO, hzU⟩ := exists_notMem_U (Γ := G) hT hO ⟨y, hyO⟩ + obtain ⟨r, hr, hzr⟩ := exists_region_of_notMem hzU + exact ⟨z, hzO, r, hr, hzr⟩ + have hsplit : ⋃₀ G.R = ⋃₀ Z ∪ ⋃₀ (G.R \ Z) := by + rw [← sUnion_union, union_sdiff_cancel hZ] + rw [hsplit, closure_union] at hdense + exact hdense + have hne₁ : ((X \ G.V) ∩ A).Nonempty := by + obtain ⟨z, hzs, hzX⟩ := hm₁ + exact ⟨z, ⟨hzX, fun hc ↦ region_subset (hZ h₁) hzs (G.V_subset_U hc)⟩, + subset_closure ⟨s₁, h₁, hzs⟩⟩ + have hne₂ : ((X \ G.V) ∩ B).Nonempty := by + obtain ⟨z, hzs, hzX⟩ := hm₂ + exact ⟨z, ⟨hzX, fun hc ↦ region_subset h₂.1 hzs (G.V_subset_U hc)⟩, + subset_closure ⟨s₂, h₂, hzs⟩⟩ + obtain ⟨y, hyX, hyA, hyB⟩ := isPreconnected_closed_iff.mp hconn A B isClosed_closure + isClosed_closure hcov hne₁ hne₂ + have hAe : y ∈ ⋃ s ∈ Z, closure s := by + have hf : Z.Finite := hRfin.subset hZ + change y ∈ closure (⋃₀ Z) at hyA + rwa [sUnion_eq_biUnion, hf.closure_biUnion] at hyA + have hBe : y ∈ ⋃ s ∈ G.R \ Z, closure s := by + have hf : (G.R \ Z).Finite := hRfin.subset sdiff_subset + change y ∈ closure (⋃₀ (G.R \ Z)) at hyB + rwa [sUnion_eq_biUnion, hf.closure_biUnion] at hyB + obtain ⟨s, hs, hys⟩ := mem_iUnion₂.mp hAe + obtain ⟨s', hs', hys'⟩ := mem_iUnion₂.mp hBe + have hne : s ≠ s' := fun h ↦ hs'.2 (h ▸ hs) + by_cases hyU : y ∈ G.U + · obtain ⟨e, he, hye⟩ := G.exists_edge_of_mem hyU hyX.2 + refine ⟨e, mem_boundaryDrawing_E.mpr ⟨⟨s, hs, he, hZ hs, y, hye, hys⟩, + ⟨s', hs', he, hs'.1, y, hye, hys'⟩⟩, y, hye, hyX.1⟩ + · exfalso + obtain ⟨q, hq, hyq⟩ := exists_region_of_notMem hyU + obtain ⟨z, hzq, hzs⟩ := mem_closure_iff.mp hys q (region_isOpen hq) hyq + obtain ⟨z', hzq', hzs'⟩ := mem_closure_iff.mp hys' q (region_isOpen hq) hyq + have e₁ := region_eq_of_mem hq (hZ hs) hzq hzs + have e₂ := region_eq_of_mem hq hs'.1 hzq' hzs' + exact hne (e₁.symm.trans e₂) + +omit [ConnectedSpace T] in +/-- A region with a point of the inside of a disc in its closure lies inside the disc, when the +boundary of the disc lies in `U(G)`. -/ +theorem region_in (hT : IsClosedSurface T) {Δ : Set T} (hΔ : IsClosedDisc Δ) + (hbd : discBd Δ ⊆ G.U) {s : Set T} (hs : s ∈ G.R) {p : T} (hp : p ∈ closure s) + (hpi : p ∈ discInt Δ) : s ⊆ discInt Δ := by + have hman : ∀ x : T, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hopen := hΔ.isOpen_discInt hman + obtain ⟨z, hzΔ, hzs⟩ := mem_closure_iff.mp hp _ hopen hpi + obtain ⟨x, hx, rfl⟩ := id hs + refine isPreconnected_connectedComponentIn.subset_left_of_subset_union hopen + hΔ.isClosed.isOpen_compl (disjoint_left.mpr fun w hw hn ↦ hn hw.1) (fun w hw ↦ ?_) + ⟨z, hzs, hzΔ⟩ + by_cases hwΔ : w ∈ Δ + · exact Or.inl ⟨hwΔ, fun hb ↦ region_subset hs hw (hbd hb)⟩ + · exact Or.inr hwΔ + +/-- A disc whose boundary is a circuit of `N(Z)`, with an edge of `N(Z)` inside, contains a smaller +such disc. The regions of `Z` in the disc give an `N(Z'')` with an edge inside, and that edge is in +a circuit because the valencies are even. -/ +theorem exists_smaller (hT : IsClosedSurface T) {Z : Set (Set T)} (hZ : Z ⊆ G.R) {F : Drawing T} + (_hF : F.IsCircuit) (hFs : F.IsSubdrawing (boundaryDrawing G Z)) {Δ : Set T} + (hΔ : IsClosedDisc Δ) (hbd : discBd Δ = F.U) {e : Set T} (he : e ∈ (boundaryDrawing G Z).E) + (hmeet : (e ∩ discInt Δ).Nonempty) : + ∃ (C : Drawing T) (Δ' : Set T), C.IsCircuit ∧ C.IsSubdrawing (boundaryDrawing G Z) ∧ + IsClosedDisc Δ' ∧ discBd Δ' = C.U ∧ + {s ∈ G.R | s ⊆ Δ'}.ncard < {s ∈ G.R | s ⊆ Δ}.ncard := by + classical + have hlc : LocallyConnectedSpace T := IsClosedSurface.locallyConnectedSpace hT + have hman : ∀ x : T, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hRfin : G.R.Finite := finite_R hT G + have hNs : (boundaryDrawing G Z).IsSubdrawing G := Drawing.span_isSubdrawing G _ _ + have hFG := hFs.trans hNs + have hbdU : discBd Δ ⊆ G.U := hbd ▸ hFG.U_subset + let Z' : Set (Set T) := {s | s ∈ Z ∧ s ⊆ Δ} + let N' : Drawing T := boundaryDrawing G Z' + have hN's : N'.IsSubdrawing G := Drawing.span_isSubdrawing G _ _ + have hedgeN := hNs.2 + have heG : e ∈ G.E := hedgeN he + have hinc : ∀ {a}, G.EdgeRegionIncident e a → e ⊆ closure a := fun h ↦ + edge_subset_closure_of_incident hT h.1 h.2.1 h.2.2 + obtain ⟨y, hye, hyΔ⟩ := hmeet + obtain ⟨⟨s, hsZ, hsi⟩, ⟨s', hs', hsi'⟩⟩ := mem_boundaryDrawing_E.mp he + have heN' : e ∈ N'.E := by + refine mem_boundaryDrawing_E.mpr ⟨⟨s, ⟨hsZ, ?_⟩, hsi⟩, ⟨s', ⟨hs'.1, fun h ↦ hs'.2 h.1⟩, hsi'⟩⟩ + exact (region_in hT hΔ hbdU (hZ hsZ) (hinc hsi hye) hyΔ).trans (discInt_subset Δ) + have : Nonempty T := ⟨y⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar G + obtain ⟨C, hC, hCs, heC⟩ := exists_circuit_of_even hγ hN's + (fun v hv ↦ even_nHalf hT G hγ hv Z') heN' + have hCG := hCs.trans hN's + have hedge : ∀ g ∈ C.E, g ∈ (boundaryDrawing G Z).E ∧ g ⊆ Δ := by + intro g hg + obtain ⟨⟨a, haZ, hai⟩, ⟨b, hb, hbi⟩⟩ := mem_boundaryDrawing_E.mp (hCs.2 hg) + have hgG := hCG.2 hg + have hga : g ⊆ closure a := edge_subset_closure_of_incident hT hgG + hai.2.1 hai.2.2 + have hgb : g ⊆ closure b := edge_subset_closure_of_incident hT hgG + hbi.2.1 hbi.2.2 + have hgΔ : g ⊆ Δ := hga.trans (closure_minimal haZ.2 hΔ.isClosed) + refine ⟨?_, hgΔ⟩ + by_cases hbZ : b ∈ Z + · have hbn : ¬ b ⊆ Δ := fun h ↦ hb.2 ⟨hbZ, h⟩ + have hno : ∀ x ∈ g, x ∉ discInt Δ := fun x hx hxi ↦ + hbn ((region_in hT hΔ hbdU hb.1 (hgb hx) hxi).trans (discInt_subset Δ)) + by_cases hgF : g ∈ F.E + · exact hFs.2 hgF + · exfalso + obtain ⟨x, hx⟩ := hgG.1 + have hd := edge_disjoint_U hFG hgG hgF + refine hno x hx ⟨hgΔ hx, fun hxb ↦ disjoint_left.mp hd hx ?_⟩ + rwa [hbd] at hxb + · exact mem_boundaryDrawing_E.mpr ⟨⟨a, haZ.1, hai⟩, ⟨b, ⟨hb.1, hbZ⟩, hbi⟩⟩ + have hCN : C.IsSubdrawing (boundaryDrawing G Z) := + circuit_isSubdrawing_of_E hC hCG hNs fun g hg ↦ (hedge g hg).1 + have hCU : C.U ⊆ Δ := by + have hclo : ∀ g ∈ C.E, closure g ⊆ Δ := fun g hg ↦ + closure_minimal (hedge g hg).2 hΔ.isClosed + intro x hx + by_cases hxV : x ∈ C.V + · obtain ⟨g, hg, hxg⟩ := exists_edge_at_vertex hC hxV + exact hclo g hg hxg + · obtain ⟨g, hg, hxg⟩ := C.exists_edge_of_mem hx hxV + exact (hedge g hg).2 hxg + obtain ⟨Δ', ⟨hΔ'Δ, hΔ', hbd', -⟩, -⟩ := disc_oArc.{0} Δ C.U hΔ hCU (GM14.isOArc_of_isCircuit hC) + refine ⟨C, Δ', hC, hCN, hΔ', hbd', ?_⟩ + have hne : Δ' ≠ Δ := by + rintro rfl + obtain ⟨x, hx⟩ := heG.1 + have hmem : x ∈ F.U := hbd ▸ hbd' ▸ (show x ∈ C.U from (heC.2.1 hx).1) + have heF : e ∉ F.E := fun hc ↦ by + have : y ∈ F.U := (hc.2.1 hye).1 + exact hyΔ.2 (hbd ▸ this) + exact disjoint_left.mp (edge_disjoint_U hFG heG heF) hx hmem + obtain ⟨z, hzΔ, hzn⟩ : ∃ z ∈ Δ, z ∉ Δ' := by + by_contra hall + push Not at hall + exact hne (Subset.antisymm hΔ'Δ hall) + have hO : IsOpen (Δ'ᶜ ∩ discInt Δ) := hΔ'.isClosed.isOpen_compl.inter (hΔ.isOpen_discInt hman) + have hOne : (Δ'ᶜ ∩ discInt Δ).Nonempty := by + obtain ⟨w, hw, hwi⟩ := mem_closure_iff.mp (hΔ.subset_closure_discInt hzΔ) _ + hΔ'.isClosed.isOpen_compl hzn + exact ⟨w, hw, hwi⟩ + obtain ⟨w, hwO, hwU⟩ := exists_notMem_U (Γ := G) hT hO hOne + obtain ⟨q, hq, hwq⟩ := exists_region_of_notMem hwU + have hsubs : {s ∈ G.R | s ⊆ Δ'} ⊂ {s ∈ G.R | s ⊆ Δ} := by + refine ⟨fun s hs ↦ ⟨hs.1, hs.2.trans hΔ'Δ⟩, fun hc ↦ ?_⟩ + have hqΔ : q ⊆ Δ := (region_in hT hΔ hbdU hq (subset_closure hwq) hwO.2).trans + (discInt_subset Δ) + exact hwO.1 ((hc ⟨hq, hqΔ⟩).2 hwq) + exact ncard_lt_ncard hsubs (hRfin.subset fun _ h ↦ h.1) + +/-- A disc bounded by a circuit of `N(Z)` contains one with no edge of `N(Z)` inside. -/ +theorem exists_clean (hT : IsClosedSurface T) {Z : Set (Set T)} (hZ : Z ⊆ G.R) {F₀ : Drawing T} + (hF₀ : F₀.IsCircuit) (hFs₀ : F₀.IsSubdrawing (boundaryDrawing G Z)) {Δ₀ : Set T} + (hΔ₀ : IsClosedDisc Δ₀) (hbd₀ : discBd Δ₀ = F₀.U) : + ∃ (F : Drawing T) (Δ : Set T), F.IsCircuit ∧ F.IsSubdrawing (boundaryDrawing G Z) ∧ + IsClosedDisc Δ ∧ discBd Δ = F.U ∧ ∀ e ∈ (boundaryDrawing G Z).E, Disjoint e (discInt Δ) := by + induction hn : {s ∈ G.R | s ⊆ Δ₀}.ncard using Nat.strong_induction_on generalizing F₀ Δ₀ with + | _ n ih => + by_cases hall : ∀ e ∈ (boundaryDrawing G Z).E, Disjoint e (discInt Δ₀) + · exact ⟨F₀, Δ₀, hF₀, hFs₀, hΔ₀, hbd₀, hall⟩ + · push Not at hall + obtain ⟨e, he, hne⟩ := hall + obtain ⟨C, Δ', hC, hCs, hΔ', hbd', hlt⟩ := + exists_smaller hT hZ hF₀ hFs₀ hΔ₀ hbd₀ he (not_disjoint_iff_nonempty_inter.mp hne) + exact ih _ (hn ▸ hlt) hC hCs hΔ' hbd' rfl + +end Mono + +/-- Each edge of `Γ` contains an edge of `sk(Γ)`. -/ +theorem Painting.exists_sk_in {c : Set S} (hc : c ∈ Γ.E) : ∃ f, Γ.IsSkEdgeIn f c := by + rcases Γ.size_cases hc with h2' | h3' + · exact ⟨c, hc, Or.inl ⟨h2', rfl⟩⟩ + · obtain ⟨a, b, z, hab, -, -, hset⟩ := Set.ncard_eq_three.mp h3' + obtain ⟨f, hf, -⟩ := Γ.exists_sk_at hc (show a ∈ tilde c from hset ▸ Or.inl rfl) + exact ⟨f, hf⟩ + +private theorem edges_on_one_side_of_internal_disc + {S : Type} + {Shat : Type} + [TopologicalSpace S] + [TopologicalSpace Shat] + {cap : IsCappedSurface S Shat} + {Γ : Painting S} + {A : Hypergraph S (Set S)} + {B : Hypergraph S (Set S)} + (hAB : Γ.toHypergraph.IsSeparation A B) + (G₃ : Drawing Shat) + (Z : Set (Set Shat)) + (hreg : ∀ f ∈ arcComponentsIn (Γ.skU \ Γ.V), ∃ s ∈ Drawing.R G₃, cap.emb '' f ⊆ s) + (hcol : ∀ {f c : Set S} {s : Set Shat}, Γ.IsSkEdgeIn f c → s ∈ Drawing.R G₃ → cap.emb '' f ⊆ s + → (s ∈ Z ↔ c ∈ A.edgeSet)) + (Δ : Set Shat) + (hno : ∀ s₁ ∈ Z, ∀ s₂ ∈ Drawing.R G₃ \ Z, (s₁ ∩ discInt Δ).Nonempty → (s₂ ∩ discInt + Δ).Nonempty → False) : + (∀ (f c : Set S), Γ.IsSkEdgeIn f c → (cap.emb '' f ∩ discInt Δ).Nonempty → c ∈ A.edgeSet) ∨ ∀ + (f c : Set S), Γ.IsSkEdgeIn f c → (cap.emb '' f ∩ discInt Δ).Nonempty → c ∈ B.edgeSet := by + by_cases hcase : ∃ s ∈ Z, (s ∩ discInt Δ).Nonempty + · obtain ⟨s₁, h₁, m₁⟩ := hcase + left + intro f c hfc hm + obtain ⟨s, hs, hfs⟩ := hreg f hfc.mem + by_contra hc + have : s ∈ G₃.R \ Z := ⟨hs, fun h ↦ hc ((hcol hfc hs hfs).mp h)⟩ + exact hno s₁ h₁ s this m₁ (hm.mono (inter_subset_inter_left _ hfs)) + · right + intro f c hfc hm + obtain ⟨s, hs, hfs⟩ := hreg f hfc.mem + have hsn : s ∉ Z := fun h ↦ hcase ⟨s, h, hm.mono (inter_subset_inter_left _ hfs)⟩ + have hc : c ∉ A.edgeSet := fun h ↦ hsn ((hcol hfc hs hfs).mpr h) + rcases edge_cases hAB hfc.1 with ⟨h, -⟩ | ⟨-, h⟩ + · exact absurd h hc + · exact h + +/-- (8.1), with what the proof gives about `F`: all vertices of `Γ` on `F` are in `V(A ∩ B)`. -/ +theorem theorem_8_1' (hS : IsSurface S) + (h3 : Γ.IsInternallyThreeConnected) (rad : RadialDrawing cap Γ) {A B : Hypergraph S (Set S)} + (hAB : Γ.toHypergraph.IsSeparation A B) + [T2Space Shat] (hlt : (Hypergraph.separationOrder A B : ℕ∞) < Painting.rep rad) + (hA : A.edgeSet.Nonempty) (hB : B.edgeSet.Nonempty) : + ∃ (F : Drawing Shat) (Δ : Set Shat), F.IsCircuitOf rad.G ∧ (∀ e ∈ F.E, rad.Splits A B e) ∧ + IsClosedDisc Δ ∧ discBd Δ = F.U ∧ + (Γ.restrict (cap.emb ⁻¹' Δ) ≤ A ∨ Γ.restrict (cap.emb ⁻¹' Δ) ≤ B) ∧ + F.E.ncard / 2 ≤ Hypergraph.separationOrder A B ∧ + (∀ v, cap.emb v ∈ F.U → v ∈ Γ.V → v ∈ (A ∩ B).vertexSet) := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have h2 := h3.hatRegions_isOpenDisc hS cap + obtain ⟨D, G₃, hD, hrad, hmax, hsub, hhat⟩ := rad.exists_full hS h2 h3.1 + have hDE := hD.E_nonempty h3.1 + obtain ⟨hG1, hG2, hG3, hG4, hG5, hG6⟩ := id rad.isPreRadial + let t : Set S → Prop := (· ∈ A.edgeSet) + let Z : Set (Set Shat) := colourSet cap Γ G₃ t + have hZ : Z ⊆ G₃.R := fun _ h ↦ h.1 + let N : Drawing Shat := boundaryDrawing G₃ Z + have hNs : N.IsSubdrawing G₃ := Drawing.span_isSubdrawing G₃ _ _ + have hreg : ∀ f, f ∈ arcComponentsIn (Γ.skU \ Γ.V) → ∃ s ∈ G₃.R, cap.emb '' f ⊆ s := by + intro f hf + have hg := hD.edge_iff.mpr ⟨f, hf, rfl⟩ + have hdis : Disjoint (cap.emb '' f) G₃.U := by + refine disjoint_left.mpr fun y hy hyU ↦ ?_ + have hyD := hg.2.1 hy + have : y ∈ D.U ∩ G₃.U := ⟨hyD.1, hyU⟩ + rw [show D.U ∩ G₃.U = D.V from hrad.2.1] at this + exact hyD.2 this + obtain ⟨y, hy⟩ := hg.1 + obtain ⟨s, hs, hys⟩ := exists_region_of_notMem (disjoint_left.mp hdis hy) + exact ⟨s, hs, subset_region hs hg.2.2.1.isConnected.isPreconnected hdis hy hys⟩ + have hcol : ∀ {f c s}, Γ.IsSkEdgeIn f c → s ∈ G₃.R → cap.emb '' f ⊆ s → (s ∈ Z ↔ c ∈ A.edgeSet) + := by + intro f c s hfc hs hfs + constructor + · rintro ⟨-, f', c', h', hf', ht⟩ + rw [(colour_unique hD hrad hmax hDE hs hfc h' hfs hf').2] + exact ht + · exact fun h ↦ ⟨hs, f, c, hfc, hfs, h⟩ + obtain ⟨ca, hca⟩ := hA + obtain ⟨cb, hcb⟩ := hB + have hcaE : ca ∈ Γ.E := hAB.left_le.edgeSet_subset hca + have hcbE : cb ∈ Γ.E := hAB.right_le.edgeSet_subset hcb + have hcbA : cb ∉ A.edgeSet := fun h ↦ by + rcases edge_cases hAB hcbE with ⟨-, h'⟩ | ⟨h', -⟩ + · exact h' hcb + · exact h' h + obtain ⟨e₀, he₀⟩ : ∃ e, e ∈ N.E := by + obtain ⟨fa, hfa⟩ := Γ.exists_sk_in hcaE + obtain ⟨fb, hfb⟩ := Γ.exists_sk_in hcbE + obtain ⟨sa, hsa, hfsa⟩ := hreg fa hfa.mem + obtain ⟨sb, hsb, hfsb⟩ := hreg fb hfb.mem + have h₁ : sa ∈ Z := (hcol hfa hsa hfsa).mpr hca + have h₂ : sb ∈ G₃.R \ Z := ⟨hsb, fun h ↦ hcbA ((hcol hfb hsb hfsb).mp h)⟩ + obtain ⟨xa, hxa⟩ : sa.Nonempty := region_nonempty hsa + obtain ⟨xb, hxb⟩ : sb.Nonempty := region_nonempty hsb + obtain ⟨e, he, -⟩ := exists_boundary_edge hT isOpen_univ isPreconnected_univ h₁ hZ h₂ + ⟨xa, hxa, mem_univ _⟩ ⟨xb, hxb, mem_univ _⟩ + exact ⟨e, he⟩ + have hbs : ∀ {e}, e ∈ N.E → _ := fun {e} he ↦ + boundary_split hS hDE rad hD hrad hmax hsub hhat (t := t) (e := e) he + have hincX : ∀ {X : Hypergraph S (Set S)}, X ≤ Γ.toHypergraph → ∀ {c v}, c ∈ X.edgeSet → + v ∈ Γ.V → v ∈ tilde c → v ∈ X.vertexSet := by + intro X hX c v hc hv hvc + have h₁ : v ∈ Γ.toHypergraph.ends c := ⟨hX.edgeSet_subset hc, hv, hvc⟩ + rw [hX.ends_eq c hc] at h₁ + exact X.vertex_mem_of_inc h₁ + have hcirc : ∀ C : Drawing Shat, C.IsCircuit → C.IsSubdrawing N → + C.IsSubdrawing rad.G ∧ (∀ e ∈ C.E, rad.Splits A B e) ∧ C.E.ncard / 2 ≤ + Hypergraph.separationOrder A B ∧ + ∀ x ∈ C.V, x ∈ D.V → ∃ v₀, x = cap.emb v₀ ∧ v₀ ∈ (A ∩ B).vertexSet := by + intro C hC hCs + have hCG := hCs.trans hNs + have hat : ∀ x ∈ C.V, ∃ g ∈ C.E, x ∈ closure g ∩ G₃.V := fun x hx ↦ by + obtain ⟨g, hg, hxg⟩ := exists_edge_at_vertex hC hx + exact ⟨g, hg, hxg, hCG.1 hx⟩ + have hmid : ∀ x ∈ C.V, x ∈ D.V → ∃ v₀, x = cap.emb v₀ ∧ v₀ ∈ (A ∩ B).vertexSet := by + intro x hx hxD + obtain ⟨g, hg, hxg⟩ := hat x hx + obtain ⟨-, v₀, w, hv₀, hw, hset, f₁, f₂, c₁, c₂, hp, h₁, h₂, ht₁, ht₂, hnt⟩ := hbs (hCs.2 hg) + rw [hset] at hxg + have hxv : x = cap.emb v₀ := by + rcases hxg with h | h + · exact h + · exact absurd (by rw [hD.hV] at hxD; exact h ▸ hxD) hw.2 + have hc₁ : v₀ ∈ tilde c₁ := + ⟨closure_mono h₁.subset ht₁.1, fun h ↦ Γ.disjoint_V h₁.1 h hv₀⟩ + have hc₂ : v₀ ∈ tilde c₂ := + ⟨closure_mono h₂.subset ht₂.1, fun h ↦ Γ.disjoint_V h₂.1 h hv₀⟩ + refine ⟨v₀, hxv, ?_⟩ + have e₁ := edge_cases hAB h₁.1 + have e₂ := edge_cases hAB h₂.1 + have hnt' : ¬ (c₁ ∈ A.edgeSet ↔ c₂ ∈ A.edgeSet) := hnt + by_cases ha₁ : c₁ ∈ A.edgeSet + · have hb₂ : c₂ ∈ B.edgeSet := by tauto + exact ⟨hincX hAB.left_le ha₁ hv₀ hc₁, hincX hAB.right_le hb₂ hv₀ hc₂⟩ + · have hb₁ : c₁ ∈ B.edgeSet := by tauto + have ha₂ : c₂ ∈ A.edgeSet := by tauto + exact ⟨hincX hAB.left_le ha₂ hv₀ hc₂, hincX hAB.right_le hb₁ hv₀ hc₁⟩ + refine ⟨⟨fun x hx ↦ ?_, fun e he ↦ (hbs (hCs.2 he)).1⟩, fun e he ↦ ?_, ?_, hmid⟩ + · obtain ⟨g, hg, hxg⟩ := hat x hx + obtain ⟨-, v₀, w, hv₀, hw, hset, -⟩ := hbs (hCs.2 hg) + rw [hset] at hxg + rcases hxg with rfl | rfl + · exact hG2 (mem_image_of_mem _ hv₀) + · exact hw.1 + · obtain ⟨-, v₀, w, hv₀, hw, hset, f₁, f₂, c₁, c₂, hp, h₁, h₂, ht₁, ht₂, hnt⟩ := hbs (hCs.2 he) + exact (splits_of_pair hS h3 hp hAB).mpr hnt + · have hb := IsCircuit.ncard_le hC (P := D.V) fun e x y hl ↦ + bipartite_of_preRadial hrad.2 e x y ((hCG.isLink_iff hl.1).mp hl) + have hsubs : C.V ∩ D.V ⊆ cap.emb '' (A ∩ B).vertexSet := by + rintro x ⟨hx, hxD⟩ + obtain ⟨v₀, rfl, hv₀⟩ := hmid x hx hxD + exact mem_image_of_mem _ hv₀ + have hle₁ := ncard_le_ncard hsubs ((A ∩ B).vertexSet_finite.image _) + have hle₂ := ncard_image_le (f := cap.emb) (A ∩ B).vertexSet_finite + have : (C.V ∩ D.V).ncard ≤ Hypergraph.separationOrder A B := hle₁.trans hle₂ + omega + have : Nonempty Shat := ⟨cap.emb (Classical.choose (show (tilde ca).Nonempty from by + obtain ⟨f, hf⟩ := Γ.exists_sk_in hcaE + rcases Γ.size_cases hcaE with h | h <;> + exact Set.nonempty_of_ncard_ne_zero (by omega)))⟩ + obtain ⟨γ, hγ⟩ := exists_edgePar G₃ + obtain ⟨C₀, hC₀, hC₀s, -⟩ := exists_circuit_of_even hγ hNs + (fun v hv ↦ even_nHalf hT G₃ hγ hv Z) he₀ + obtain ⟨hC₀G, -, hcount, -⟩ := hcirc C₀ hC₀ hC₀s + have hnull : IsNullHomotopicOArc C₀.U := by + by_contra hn + have hle : Painting.rep rad ≤ ((C₀.E.ncard / 2 : ℕ) : ℕ∞) := + sInf_le ⟨C₀, ⟨hC₀G, hC₀⟩, hn, rfl⟩ + have h₁ : ((C₀.E.ncard / 2 : ℕ) : ℕ∞) ≤ (Hypergraph.separationOrder A B : ℕ∞) := by + exact_mod_cast hcount + exact absurd (hlt.trans_le (hle.trans h₁)) (lt_irrefl _) + have hbdS : Disjoint C₀.U (bd Shat) := + disjoint_left.mpr fun x _ hx ↦ hx (hT.2.2 x) + obtain ⟨Δ₀, -, hΔ₀, hbd₀⟩ := (epstein Shat univ C₀.U (Surface.IsClosedSurface.isSurface hT) + inferInstance + (GM14.isOArc_of_isCircuit hC₀) (subset_univ _) hbdS).1 hnull + obtain ⟨F, Δ, hFc, hFs, hΔ, hbd, hclean⟩ := exists_clean hT hZ hC₀ hC₀s hΔ₀ hbd₀ + obtain ⟨hFG, hFsplit, hFcount, hmid⟩ := hcirc F hFc hFs + have hopen := hΔ.isOpen_discInt hman + have hno : ∀ s₁ ∈ Z, ∀ s₂ ∈ G₃.R \ Z, (s₁ ∩ discInt Δ).Nonempty → + (s₂ ∩ discInt Δ).Nonempty → False := by + intro s₁ h₁ s₂ h₂ m₁ m₂ + obtain ⟨e, he, y, hye, hyi⟩ := + exists_boundary_edge hT hopen hΔ.isPreconnected_discInt h₁ hZ h₂ m₁ m₂ + exact disjoint_left.mp (hclean e he) hye hyi + have hside : (∀ f c, Γ.IsSkEdgeIn f c → (cap.emb '' f ∩ discInt Δ).Nonempty → c ∈ A.edgeSet) ∨ + (∀ f c, Γ.IsSkEdgeIn f c → (cap.emb '' f ∩ discInt Δ).Nonempty → c ∈ B.edgeSet) := by + exact edges_on_one_side_of_internal_disc (S := S) (Shat := Shat) (cap := cap) (Γ := Γ) (A := + A) (B := B) hAB G₃ Z hreg hcol Δ hno + have hFU : ∀ {x}, x ∈ F.U → x ∈ rad.G.U := fun h ↦ hFG.U_subset h + have hfinal : ∀ X : Hypergraph S (Set S), X ≤ Γ.toHypergraph → + (∀ v, cap.emb v ∈ F.U → v ∈ Γ.V → v ∈ X.vertexSet) → + (∀ f c, Γ.IsSkEdgeIn f c → (cap.emb '' f ∩ discInt Δ).Nonempty → c ∈ X.edgeSet) → + Γ.restrict (cap.emb ⁻¹' Δ) ≤ X := by + intro X hX hXm hXc + have hedge : ∀ e ∈ (Γ.restrict (cap.emb ⁻¹' Δ)).edgeSet, e ∈ X.edgeSet := by + rintro c ⟨hc, hsubc, -⟩ + obtain ⟨f, hf⟩ := Γ.exists_sk_in hc + obtain ⟨x, hx⟩ := hf.mem.1 + refine hXc f c hf ⟨_, mem_image_of_mem _ hx, hsubc (hf.subset hx), fun hb ↦ ?_⟩ + rw [hbd] at hb + have : cap.emb x ∈ Γ.hatU cap ∩ rad.G.U := + ⟨mem_image_of_mem _ (Γ.skU_subset (hf.mem.2.1 hx).1), hFU hb⟩ + rw [hG1] at this + obtain ⟨z, hz, hzx⟩ := this + obtain rfl := cap.isEmbedding.injective hzx + exact (hf.mem.2.1 hx).2 hz + refine ⟨?_, hedge, ?_⟩ + · rintro v ⟨hv, hvΔ⟩ + by_cases hvF : cap.emb v ∈ F.U + · exact hXm v hvF hv + · have hvi : cap.emb v ∈ discInt Δ := ⟨hvΔ, fun hb ↦ hvF (hbd ▸ hb)⟩ + obtain ⟨c, hc, hvc⟩ := exists_edge_incident hS h3 rad hv + have hvt : v ∈ tilde c := ⟨hvc, fun h ↦ Γ.disjoint_V hc h hv⟩ + obtain ⟨f, hf, hvf⟩ := Γ.exists_sk_at hc hvt + have hcl : cap.emb v ∈ closure (cap.emb '' f) := + image_closure_subset_closure_image cap.isEmbedding.continuous (mem_image_of_mem _ hvf.1) + obtain ⟨w, hwi, hwf⟩ := mem_closure_iff.mp hcl _ hopen hvi + exact hincX hX (hXc f c hf ⟨w, hwf, hwi⟩) hv hvt + · intro e he + rw [← hX.ends_eq e (hedge e he), (Γ.restrict_le _).ends_eq e he] + have hmidF : ∀ v, cap.emb v ∈ F.U → v ∈ Γ.V → v ∈ (A ∩ B).vertexSet := by + intro v hvF hv + have hvG : cap.emb v ∈ rad.G.V := hG2 (mem_image_of_mem _ hv) + have hvFV : cap.emb v ∈ F.V := by + by_contra hn + obtain ⟨e, he, hve⟩ := F.exists_edge_of_mem hvF hn + exact ((hFG.2 he).2.1 hve).2 hvG + obtain ⟨v₀, hv₀, hm⟩ := hmid _ hvFV (by rw [hD.hV]; exact mem_image_of_mem _ hv) + obtain rfl := cap.isEmbedding.injective hv₀ + exact hm + refine ⟨F, Δ, ⟨hFG, hFc⟩, hFsplit, hΔ, hbd, ?_, hFcount, hmidF⟩ + rcases hside with h | h + · exact Or.inl (hfinal A hAB.left_le (fun v h₁ h₂ ↦ (hmidF v h₁ h₂).1) h) + · exact Or.inr (hfinal B hAB.right_le (fun v h₁ h₂ ↦ (hmidF v h₁ h₂).2) h) + +/-- **Graph Minors XIX, (8.1).** "**8.1.** *Let $(A, B)$ be a separation of $\Gamma$ of order +$< rep(\Gamma)$, with $E(A), E(B) \ne \emptyset$. Then there is a circuit $F$ of $\Gamma^*$ such +that $(A, B)$ splits every edge of $F$ and there is a disc $\Delta \subseteq \hat{\Sigma}$ bounded +by $U(F)$ such that either $\Gamma \cap \Delta \subseteq A$ or $\Gamma \cap \Delta \subseteq B$.*" + +The paper counts valencies in the drawing of split edges. We use `N(Z)` of Graph Minors XI for the +regions `Z` of the colouring of this file, which has the same edges. Epstein's theorem gives the +first disc, from `rep(Γ)`. -/ +theorem theorem_8_1_proof (hS : IsSurface S) + (h3 : Γ.IsInternallyThreeConnected) (rad : RadialDrawing cap Γ) {A B : Hypergraph S (Set S)} + (hAB : Γ.toHypergraph.IsSeparation A B) + [T2Space Shat] (hlt : (Hypergraph.separationOrder A B : ℕ∞) < Painting.rep rad) + (hA : A.edgeSet.Nonempty) (hB : B.edgeSet.Nonempty) : + ∃ (F : Drawing Shat) (Δ : Set Shat), F.IsCircuitOf rad.G ∧ (∀ e ∈ F.E, rad.Splits A B e) ∧ + IsClosedDisc Δ ∧ discBd Δ = F.U ∧ + (Γ.restrict (cap.emb ⁻¹' Δ) ≤ A ∨ Γ.restrict (cap.emb ⁻¹' Δ) ≤ B) := by + obtain ⟨F, Δ, h₁, h₂, h₃, h₄, h₅, -⟩ := theorem_8_1' hS h3 rad hAB hlt hA hB + exact ⟨F, Δ, h₁, h₂, h₃, h₄, h₅⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section8f.lean b/LeanPool/GraphMinor/GM19/Section8f.lean new file mode 100644 index 0000000000..dbd5604dd5 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section8f.lean @@ -0,0 +1,888 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Epstein +public import LeanPool.GraphMinor.GM19.Section8e +public import LeanPool.GraphMinor.GM19.Section8d + +/-! +# Graph Minors XIX, (8.4) + +The part of the proof of (8.4) that uses only tangles is `distinction_cases`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +section Abstract + +variable {α β Λ : Type*} [LinearOrder Λ] {G A B H H' : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} {θ θ' : ℕ} + {𝒯 𝒯' : Set (Hypergraph α β × Hypergraph α β)} + +theorem eq_of_cover (hHH' : G.IsSeparation H H') {X : Hypergraph α β} (h₁ : H ≤ X) (h₂ : H' ≤ X) + (hX : X ≤ G) : X = G := + le_antisymm hX (hHH'.union_eq ▸ GM10.union_le h₁ h₂) + +theorem cover_three (hAB : G.IsSeparation A B) (hHH' : G.IsSeparation H H') : + H ∪ B ∪ (A ∩ H') = G := by + have hle : H ∪ B ∪ (A ∩ H') ≤ G := GM10.union_le (GM10.union_le hHH'.left_le hAB.right_le) + (GM10.inter_le hAB.left_le hHH'.right_le) + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle le_rfl ?_ ?_ + · apply Subset.antisymm hle.vertexSet_subset + intro v hv + have h₁ : v ∈ (H ∪ H').vertexSet := hHH'.union_eq ▸ hv + have h₂ : v ∈ (A ∪ B).vertexSet := hAB.union_eq ▸ hv + rcases h₁ with h₁ | h₁ + · exact Or.inl (Or.inl h₁) + · rcases h₂ with h₂ | h₂ + · exact Or.inr ⟨h₂, h₁⟩ + · exact Or.inl (Or.inr h₂) + · apply Subset.antisymm hle.edgeSet_subset + intro v hv + have h₁ : v ∈ (H ∪ H').edgeSet := hHH'.union_eq ▸ hv + have h₂ : v ∈ (A ∪ B).edgeSet := hAB.union_eq ▸ hv + rcases h₁ with h₁ | h₁ + · exact Or.inl (Or.inl h₁) + · rcases h₂ with h₂ | h₂ + · exact Or.inr ⟨h₂, h₁⟩ + · exact Or.inl (Or.inr h₂) + +/-- The tangle argument of the proof of (8.4). Let `(A, B)` be the `(𝒯, 𝒯')`-distinction, and let +`(H, H')` be a separation with `E(H) ≠ ∅` and `H ⊆ A` or `H ⊆ B`, such that `(H, H')`, +`(A ∩ H', B ∪ H)`, `(A ∪ H, B ∩ H')` all have `λ`-order at most that of `(A, B)`. Then `(H, H')` is +`(A, B)`, or it is `(B, A)` and it is not in `𝒯`. -/ +theorem distinction_cases (hlam : IsTieBreaker G lam) (h𝒯 : IsTangle G θ 𝒯) + (h𝒯' : IsTangle G θ' 𝒯') (hd : IsDistinction lam 𝒯 𝒯' A B) (hHH' : G.IsSeparation H H') + (hle₁ : lam (H, H') ≤ lam (A, B)) (hle₂ : lam (A ∩ H', B ∪ H) ≤ lam (A, B)) + (hle₃ : lam (A ∪ H, B ∩ H') ≤ lam (A, B)) (hsub : H ≤ A ∨ H ≤ B) + (hne : H.edgeSet.Nonempty) : + (H = A ∧ H' = B) ∨ (H = B ∧ H' = A ∧ (H, H') ∉ 𝒯) := by + obtain ⟨⟨hABT, hBAT⟩, hmin⟩ := hd + have hAB := h𝒯.isSeparation hABT + have hs₂ : G.IsSeparation (A ∩ H') (B ∪ H) := (hAB.symm.union_inter hHH').symm + have hs₃ : G.IsSeparation (A ∪ H) (B ∩ H') := hAB.union_inter hHH' + have hord : ∀ {P Q}, G.IsSeparation P Q → lam (P, Q) ≤ lam (A, B) → + Hypergraph.separationOrder P Q ≤ Hypergraph.separationOrder A B := by + intro P Q hPQ hle + by_contra hn + exact absurd (hlam.axiom3 hAB hPQ (not_le.mp hn)) (not_lt.mpr hle) + have hlt : Hypergraph.separationOrder A B < θ := h𝒯.order_lt hABT + have hlt' : Hypergraph.separationOrder A B < θ' := by + have h := h𝒯'.order_lt hBAT + have e : Hypergraph.separationOrder B A = Hypergraph.separationOrder A B := by + simp only [Hypergraph.separationOrder, GM10.inter_comm B A] + omega + have hnotboth : (B, A) ∉ 𝒯 := fun h ↦ by + refine h𝒯.axiom2 hABT h hABT ?_ + exact eq_of_cover hAB (le_trans (GM10.le_union_left hAB.left_le hAB.right_le) + (GM10.le_union_left (GM10.union_le hAB.left_le hAB.right_le) hAB.left_le)) + (le_trans (GM10.le_union_right hAB.left_le hAB.right_le) + (GM10.le_union_left (GM10.union_le hAB.left_le hAB.right_le) hAB.left_le)) + (GM10.union_le (GM10.union_le hAB.left_le hAB.right_le) hAB.left_le) + have heq : ∀ {P Q}, G.IsSeparation P Q → Distinguishes 𝒯 𝒯' P Q → lam (P, Q) ≤ lam (A, B) → + P = A ∧ Q = B := by + intro P Q hPQ hdis hle + have he : lam (P, Q) = lam (A, B) := le_antisymm hle (hmin hdis) + rcases (hlam.axiom1 hPQ hAB).mp he with h | ⟨rfl, rfl⟩ + · exact h + · exact absurd hdis.1 hnotboth + have hcomm : lam (H', H) = lam (H, H') := (hlam.axiom1 hHH'.symm hHH').mpr (Or.inr ⟨rfl, rfl⟩) + have hordH := hord hHH' hle₁ + have hmem : (H, H') ∈ 𝒯 ∨ (H, H') ∈ 𝒯' := by + rcases hsub with h | h + · left + refine (h𝒯.axiom1 hHH' (hordH.trans_lt hlt)).resolve_right fun hc ↦ ?_ + refine h𝒯.axiom2 hABT hc hABT (eq_of_cover hHH' ?_ ?_ ?_) + · exact h.trans (le_trans (GM10.le_union_left hAB.left_le hHH'.right_le) + (GM10.le_union_left (GM10.union_le hAB.left_le hHH'.right_le) hAB.left_le)) + · exact le_trans (GM10.le_union_right hAB.left_le hHH'.right_le) + (GM10.le_union_left (GM10.union_le hAB.left_le hHH'.right_le) hAB.left_le) + · exact GM10.union_le (GM10.union_le hAB.left_le hHH'.right_le) hAB.left_le + · right + refine (h𝒯'.axiom1 hHH' (hordH.trans_lt hlt')).resolve_right fun hc ↦ ?_ + refine h𝒯'.axiom2 hBAT hc hBAT (eq_of_cover hHH' ?_ ?_ ?_) + · exact h.trans (le_trans (GM10.le_union_left hAB.right_le hHH'.right_le) + (GM10.le_union_left (GM10.union_le hAB.right_le hHH'.right_le) hAB.right_le)) + · exact le_trans (GM10.le_union_right hAB.right_le hHH'.right_le) + (GM10.le_union_left (GM10.union_le hAB.right_le hHH'.right_le) hAB.right_le) + · exact GM10.union_le (GM10.union_le hAB.right_le hHH'.right_le) hAB.right_le + have hnb : ¬ ((H, H') ∈ 𝒯 ∧ (H, H') ∈ 𝒯') := by + rintro ⟨h₁, h₂⟩ + have hn₂ : (A ∩ H', B ∪ H) ∉ 𝒯' := fun hc ↦ h𝒯'.axiom2 h₂ hBAT hc (cover_three hAB hHH') + have hm₂ : (B ∪ H, A ∩ H') ∈ 𝒯' := + (h𝒯'.axiom1 hs₂ ((hord hs₂ hle₂).trans_lt hlt')).resolve_left hn₂ + have hT₂ : (A ∩ H', B ∪ H) ∈ 𝒯 := GraphMinor.GM10.theorem_2_9_proof h𝒯 hABT hs₂ + ((hord hs₂ hle₂).trans_lt hlt) + (Or.inr (Or.inl inter_subset_left)) + obtain ⟨-, hB⟩ := heq hs₂ ⟨hT₂, hm₂⟩ hle₂ + have hn₃ : (B ∩ H', A ∪ H) ∉ 𝒯 := fun hc ↦ h𝒯.axiom2 h₁ hABT hc (cover_three hAB.symm hHH') + have hs₃' := hs₃.symm + have hcomm₃ : Hypergraph.separationOrder (B ∩ H') (A ∪ H) = + Hypergraph.separationOrder (A ∪ H) (B ∩ H') := by + simp only [Hypergraph.separationOrder, GM10.inter_comm (B ∩ H') (A ∪ H)] + have hlt₃ := hord hs₃ hle₃ + have hm₃ : (A ∪ H, B ∩ H') ∈ 𝒯 := + (h𝒯.axiom1 hs₃' (by omega)).resolve_left hn₃ + have hT₃ : (B ∩ H', A ∪ H) ∈ 𝒯' := GraphMinor.GM10.theorem_2_9_proof h𝒯' hBAT hs₃' (by omega) + (Or.inr (Or.inl inter_subset_left)) + obtain ⟨hA, -⟩ := heq hs₃ ⟨hm₃, hT₃⟩ hle₃ + obtain ⟨c, hc⟩ := hne + have hcA : c ∈ A.edgeSet := hA ▸ Or.inr hc + have hcB : c ∈ B.edgeSet := hB ▸ Or.inr hc + have : c ∈ (A ∩ B).edgeSet := ⟨hcA, hcB⟩ + rw [hAB.edgeSet_inter_eq] at this + exact this + rcases hmem with h | h + · have hn : (H, H') ∉ 𝒯' := fun hc ↦ hnb ⟨h, hc⟩ + have hm := (h𝒯'.axiom1 hHH' (hordH.trans_lt hlt')).resolve_left hn + exact Or.inl (heq hHH' ⟨h, hm⟩ hle₁) + · have hn : (H, H') ∉ 𝒯 := fun hc ↦ hnb ⟨hc, h⟩ + have hm := (h𝒯.axiom1 hHH' (hordH.trans_lt hlt)).resolve_left hn + obtain ⟨h₁, h₂⟩ := heq hHH'.symm ⟨hm, h⟩ (hcomm ▸ hle₁) + exact Or.inr ⟨h₂, h₁, hn⟩ + +end Abstract + +section Geometry + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {D G₃ : Drawing Shat} + +/-- Two edges of `G₃` with the same ends, in a region of `Γ`, are equal. -/ +theorem spoke_unique (hS : IsSurface S) (hD : IsSkHat cap Γ D) + (h3 : Γ.IsInternallyThreeConnected) + (hrad : PreRad (PaintingOrDrawing.drawing D) G₃) {e₁ e₂ r : Set Shat} (he₁ : e₁ ∈ G₃.E) + (he₂ : e₂ ∈ G₃.E) (hr : r ∈ Γ.hatRegions cap) (h₁r : e₁ ⊆ r) (h₂r : e₂ ⊆ r) {v₀ : S} + (hv₀ : v₀ ∈ Γ.V) {w : Shat} (hw : w ∈ r) (hwG : w ∈ G₃.V) + (h₁ : closure e₁ ∩ G₃.V = {cap.emb v₀, w}) (h₂ : closure e₂ ∩ G₃.V = {cap.emb v₀, w}) : + e₁ = e₂ := by + by_contra hne + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + have hrD := hD.hatRegion_mem_R hr + have hdis : Disjoint r D.U := by + refine disjoint_left.mpr fun x hx hxU ↦ region_subset hrD hx hxU + have hvne : cap.emb v₀ ≠ w := fun h ↦ disjoint_left.mp hdis hw + (D.V_subset_U (by rw [hD.hV]; exact h ▸ mem_image_of_mem _ hv₀)) + have hL₁ : IsLineWithEnds (closure e₁) (cap.emb v₀) w := isLine_closure he₁ hvne h₁ + have hL₂ : IsLineWithEnds (closure e₂) (cap.emb v₀) w := isLine_closure he₂ hvne h₂ + have hcl : ∀ {e}, e ∈ G₃.E → closure e ∩ G₃.V = {cap.emb v₀, w} → closure e ⊆ e ∪ {cap.emb v₀, w} + := by + intro e he hset x hx + rcases closure_edge_subset he hx with h | h + · exact Or.inl h + · exact Or.inr (hset ▸ ⟨hx, h⟩) + have hcap : closure e₁ ∩ closure e₂ ⊆ {cap.emb v₀, w} := by + rintro x ⟨hx₁, hx₂⟩ + rcases hcl he₁ h₁ hx₁ with h | h + · rcases hcl he₂ h₂ hx₂ with h' | h' + · exact absurd (arcComp_eq_of_mem he₁ he₂ h h') hne + · exact h' + · exact h + have hO := isOArc_union hL₁ hL₂ hcap + have hsubr : (closure e₁ ∪ closure e₂) \ {cap.emb v₀} ⊆ r := by + have hc : ∀ {e}, e ∈ G₃.E → e ⊆ r → closure e ∩ G₃.V = {cap.emb v₀, w} → + closure e \ {cap.emb v₀} ⊆ r := by + intro e he her hset x hx + rcases hcl he hset hx.1 with h | h | h + · exact her h + · exact absurd h hx.2 + · exact h ▸ hw + rintro x ⟨hx | hx, hxn⟩ + · exact hc he₁ h₁r h₁ ⟨hx, hxn⟩ + · exact hc he₂ h₂r h₂ ⟨hx, hxn⟩ + have hvm : cap.emb v₀ ∈ closure e₁ := by + have : cap.emb v₀ ∈ closure e₁ ∩ G₃.V := by rw [h₁]; exact Or.inl rfl + exact this.1 + have hclv : cap.emb v₀ ∈ closure ((closure e₁ ∪ closure e₂) \ {cap.emb v₀}) := by + have : e₁ ⊆ (closure e₁ ∪ closure e₂) \ {cap.emb v₀} := fun x hx ↦ + ⟨Or.inl (subset_closure hx), fun h ↦ hdis.le_bot ⟨h₁r hx, D.V_subset_U (by + rw [hD.hV, mem_singleton_iff.mp h] + exact mem_image_of_mem _ hv₀)⟩⟩ + exact closure_mono this hvm + obtain ⟨Δ, hΔ, hbd, hΔU⟩ := pinch hS hD h3 hr hv₀ hO (Or.inl hvm) hclv hsubr + have hsubΔ : Δ ⊆ r ∪ {cap.emb v₀} := by + have hopen := hΔ.isOpen_discInt hman + obtain ⟨x, hx⟩ := he₁.1 + have hxb : x ∈ discBd Δ := by rw [hbd]; exact Or.inl (subset_closure hx) + have hxΔ : x ∈ closure (discInt Δ) := hΔ.subset_closure_discInt (Surface.discBd_subset _ hxb) + obtain ⟨y, hyr, hyi⟩ := mem_closure_iff.mp hxΔ r (region_isOpen hrD) (h₁r hx) + have hdI : Disjoint (discInt Δ) D.U := by + refine disjoint_left.mpr fun z hz hzU ↦ ?_ + have hzv : z = cap.emb v₀ := hΔU ⟨hz.1, hzU⟩ + apply hz.2 + rw [hbd, hzv] + exact Or.inl hvm + have hIr := subset_region hrD hΔ.isPreconnected_discInt hdI hyi hyr + intro z hz + by_cases hzb : z ∈ discBd Δ + · rw [hbd] at hzb + by_cases hzv : z = cap.emb v₀ + · exact Or.inr hzv + · exact Or.inl (hsubr ⟨hzb, hzv⟩) + · exact Or.inl (hIr ⟨hz, hzb⟩) + refine hrad.2.2.2.2.2.2 e₁ he₁ e₂ he₂ hne (cap.emb v₀) ?_ r hrD w ⟨hw, hwG⟩ h₁ h₂ + ⟨Δ, hΔ, hsubΔ, ?_⟩ + · change cap.emb v₀ ∈ D.V + rw [hD.hV] + exact mem_image_of_mem _ hv₀ + · rw [← hbd, ← subBd_eq_frontier', IsClosedDisc.frontier_eq_discBd hT hΔ] + +omit [T2Space S] [T2Space Shat] in +/-- The endpoints and region of an original radial edge agree with those in a maximal radial +drawing containing it. -/ +theorem RadialDrawing.pair_spoke_ends (rad : RadialDrawing cap Γ) + (hD : IsSkHat cap Γ D) (hrad : PreRad (PaintingOrDrawing.drawing D) G₃) + (hsub : rad.G.IsSubdrawing G₃) {e : Set Shat} (heG : e ∈ G₃.E) + {v₀ : S} {w : Shat} (hv₀ : v₀ ∈ Γ.V) (hw : w ∈ rad.Rstar) + (hsetG : closure e ∩ rad.G.V = {cap.emb v₀, w}) : + rad.regionOf w ∈ Γ.hatRegions cap ∧ w ∈ rad.regionOf w ∧ w ∈ G₃.V ∧ + closure e ∩ G₃.V = {cap.emb v₀, w} ∧ e ⊆ rad.regionOf w := by + have hT := cap.isClosedSurface + obtain ⟨v', hv', r, hr, w', hw', hw'G, hset', her⟩ := spoke_ends hrad hT heG + have hvhat : cap.emb v₀ ∈ D.V := by + rw [hD.hV] + exact mem_image_of_mem _ hv₀ + have hwD : w ∉ D.V := fun h ↦ hw.2 (by rwa [hD.hV] at h) + have hwc : w ∈ closure e ∩ G₃.V := by + have : w ∈ closure e ∩ rad.G.V := by rw [hsetG]; exact Or.inr rfl + exact ⟨this.1, hsub.1 this.2⟩ + have hvc : cap.emb v₀ ∈ closure e ∩ G₃.V := by + have : cap.emb v₀ ∈ closure e ∩ rad.G.V := by rw [hsetG]; exact Or.inl rfl + exact ⟨this.1, hsub.1 this.2⟩ + rw [hset'] at hwc hvc + have hww : w = w' := by + rcases hwc with h | h + · exact absurd (h ▸ hv') hwD + · exact h + subst hww + have hvv : cap.emb v₀ = v' := by + rcases hvc with h | h + · exact h + · exact absurd (D.V_subset_U hvhat) (h ▸ region_subset hr hw') + subst hvv + obtain ⟨hrO, hwO⟩ := rad.regionOf_mem hw + have hrr : rad.regionOf w = r := region_eq_of_mem (hD.hatRegion_mem_R hrO) hr hwO hw' + exact ⟨hrO, hrr.symm ▸ hw', hw'G, hset', hrr.symm ▸ her⟩ + +/-- **The two sides of a spoke.** An edge `f` of `sk(Γ)` on the boundary of a region `r` at `v` and +the +spoke from `v` into `r` lie on the boundary of one region of `H = sk(Γ) ∪ G₃`. -/ +theorem pair_side [ConnectedSpace Shat] (hS : IsSurface S) (hD : IsSkHat cap Γ D) + (h3 : Γ.IsInternallyThreeConnected) (hrad : PreRad (PaintingOrDrawing.drawing D) G₃) + (hmax : RadMax (PaintingOrDrawing.drawing D) G₃) {f : Set S} + (hf : f ∈ arcComponentsIn (Γ.skU \ Γ.V)) {v₀ : S} (hv₀ : v₀ ∈ Γ.V) (hvf : v₀ ∈ tilde f) + {r : Set Shat} (hr : r ∈ Γ.hatRegions cap) (hfr : cap.emb '' f ⊆ frontier r) + {e : Set Shat} (he : e ∈ G₃.E) (her : e ⊆ r) {w : Shat} (hw : w ∈ r) (hwG : w ∈ G₃.V) + (hset : closure e ∩ G₃.V = {cap.emb v₀, w}) : + ∃ p ∈ (radialUnion hrad).R, e ⊆ closure p ∧ cap.emb '' f ⊆ closure p := by + classical + have hT := cap.isClosedSurface + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + have hrD := hD.hatRegion_mem_R hr + have hDE : D.E.Nonempty := hD.E_nonempty h3.1 + have hg : cap.emb '' f ∈ D.E := hD.edge_iff.mpr ⟨f, hf, rfl⟩ + have : Nonempty Shat := ⟨w⟩ + let H := radialUnion hrad + have hE : H.E = D.E ∪ G₃.E := radialUnion_E hrad + have hV : H.V = G₃.V := radialUnion_V hrad + have hvD : cap.emb v₀ ∈ D.V := by + rw [hD.hV] + exact mem_image_of_mem _ hv₀ + have hvG : cap.emb v₀ ∈ G₃.V := hrad.2.2.1 hvD + have hvH : cap.emb v₀ ∈ H.V := hV ▸ hvG + obtain ⟨γ, hγ⟩ := exists_edgePar H + have hgH : cap.emb '' f ∈ H.E := hE ▸ Or.inl hg + have hcl : cap.emb v₀ ∈ closure (cap.emb '' f) := + image_closure_subset_closure_image cap.isEmbedding.continuous (mem_image_of_mem _ hvf.1) + obtain ⟨b, hb⟩ := exists_end_eq hγ hgH hvH hcl + let j : halfEdges H γ (cap.emb v₀) := ⟨(cap.emb '' f, b), hgH, hb⟩ + have hfin : Finite (halfEdges H γ (cap.emb v₀)) := (finite_halfEdges H γ _).to_subtype + obtain ⟨next, ρ, P, W, Q, τ, hsec, -, -⟩ := exists_sectors' hT H hγ hvH + (two_half_edges hrad hT hmax hDE hγ hvD) + have hsurj : Function.Surjective next := Finite.injective_iff_surjective.mp hsec.corners.inj + obtain ⟨k, hk⟩ := hsurj j + -- A region of `H` inside `r` with `f` on its boundary. + obtain ⟨x, hxf⟩ := hg.1 + have hxr : x ∈ closure r := frontier_subset_closure (hfr hxf) + have hRfin : H.R.Finite := finite_R hT H + have hHsub : ∀ p ∈ H.R, (p ∩ r).Nonempty → p ⊆ r := by + intro p hp ⟨z, hzp, hzr⟩ + obtain ⟨y, hy, rfl⟩ := id hp + refine subset_region hrD isPreconnected_connectedComponentIn ?_ hzp hzr + refine disjoint_left.mpr fun a ha haD ↦ ?_ + exact (connectedComponentIn_subset _ _ ha).2 (Or.inl haD) + have hxdense : x ∈ closure (⋃ p ∈ {p ∈ H.R | p ⊆ r}, p) := by + rw [mem_closure_iff] + intro O hO hxO + obtain ⟨y, hyO, hyr⟩ := mem_closure_iff.mp hxr O hO hxO + obtain ⟨z, ⟨hzO, hzr⟩, hzU⟩ := exists_notMem_U (Γ := H) hT + (hO.inter (region_isOpen hrD)) ⟨y, hyO, hyr⟩ + obtain ⟨p, hp, hzp⟩ := exists_region_of_notMem hzU + exact ⟨z, hzO, mem_biUnion (x := p) ⟨hp, hHsub p hp ⟨z, hzp, hzr⟩⟩ hzp⟩ + have hfinite : {p ∈ H.R | p ⊆ r}.Finite := hRfin.subset fun _ hp => hp.1 + rw [hfinite.closure_biUnion] at hxdense + obtain ⟨p, ⟨hp, hpr⟩, hxp⟩ := mem_iUnion₂.mp hxdense + have hfp : cap.emb '' f ⊆ closure p := + edge_subset_closure_of_incident hT hgH hp ⟨x, hxf, hxp⟩ + refine ⟨p, hp, ?_, hfp⟩ + have hjp : (next k).1.1 ⊆ closure p := by rw [hk]; exact hfp + -- The half-edge on the other side of the corner. + obtain ⟨i, hine, hip⟩ : ∃ i : halfEdges H γ (cap.emb v₀), i ≠ j ∧ i.1.1 ⊆ closure p := by + rcases hsec.corners.sides k p hp hjp with rfl | rfl + · obtain ⟨k', hk'⟩ := hsurj k + refine ⟨k, ?_, ?_⟩ + · rw [← hk] + exact (hsec.next_ne k).symm + · have := hsec.corners.right k' + rwa [hk'] at this + · refine ⟨next (next k), ?_, hsec.corners.left (next k)⟩ + rw [← hk] + exact hsec.next_ne (next k) + have hiE : i.1.1 ∈ H.E := i.2.1 + have hidisj : i.1.1 ∉ D.E := by + intro hiD + obtain ⟨e', -, -, huniq, -⟩ := face_edge hrad hT hmax hDE hp + have h₁ : i.1.1 = cap.emb '' f := (huniq _ hiD hip).trans (huniq _ hg hfp).symm + have hbne : i.1.2 ≠ b := by + intro hbb + exact hine (Subtype.ext (Prod.ext h₁ hbb)) + have hend : γ (cap.emb '' f) (endOf i.1.2) = cap.emb v₀ := by + have := i.2.2 + rwa [h₁] at this + obtain ⟨u, u', huu, hset'⟩ := hD.no_loops hS _ hg + have hforall : ∀ c : Bool, γ (cap.emb '' f) (endOf c) = cap.emb v₀ := by + intro c + by_cases hc : c = b + · rw [hc]; exact hb + · have : c = i.1.2 := by cases c <;> cases b <;> cases hi : i.1.2 <;> simp_all + rw [this]; exact hend + have hm : ∀ {y}, y ∈ closure (cap.emb '' f) ∩ D.V → y = cap.emb v₀ := by + rintro y ⟨hy, hyD⟩ + obtain ⟨c, hc⟩ := exists_end_eq hγ hgH (hV ▸ hrad.2.2.1 hyD) hy + rw [← hc, hforall] + have h₁' : u ∈ closure (cap.emb '' f) ∩ D.V := by rw [hset']; exact Or.inl rfl + have h₂' : u' ∈ closure (cap.emb '' f) ∩ D.V := by rw [hset']; exact Or.inr rfl + exact huu ((hm h₁').trans (hm h₂').symm) + have hiG : i.1.1 ∈ G₃.E := by + have := hiE + rw [hE] at this + exact this.resolve_left hidisj + obtain ⟨v', hv', r', hr', w', hw', hw'G, hset', hsubr'⟩ := spoke_ends hrad hT hiG + have hvi : cap.emb v₀ ∈ closure i.1.1 := by + have := end_mem_closure hγ hiE i.1.2 + rwa [i.2.2] at this + obtain ⟨y, hy⟩ := hiG.1 + obtain ⟨z, hzr', hzp⟩ := mem_closure_iff.mp (hip hy) r' (region_isOpen hr') (hsubr' hy) + have hrr : r' = r := region_eq_of_mem hr' hrD hzr' (hpr hzp) + subst hrr + have hww : w' = w := (hrad.2.2.2.1 r' hr').unique ⟨hw', hw'G⟩ ⟨hw, hwG⟩ + subst hww + have hvv : v' = cap.emb v₀ := by + have h₁ : cap.emb v₀ ∈ closure i.1.1 ∩ G₃.V := ⟨hvi, hvG⟩ + rw [hset'] at h₁ + rcases h₁ with h₁ | h₁ + · exact h₁.symm + · exact absurd (D.V_subset_U hvD) (region_subset hr' (h₁ ▸ hw')) + subst hvv + have := spoke_unique hS hD h3 hrad hiG he hr hsubr' her hv₀ hw hwG hset' hset + rw [← this] + exact hip + +/-- Two closed discs with the same boundary, in a surface, are equal or have disjoint insides. -/ +theorem discInt_disjoint {T : Type} [TopologicalSpace T] [T2Space T] (hT : IsClosedSurface T) + {Δ Δ₂ : Set T} (hΔ : IsClosedDisc Δ) (hΔ₂ : IsClosedDisc Δ₂) (hbd : discBd Δ = discBd Δ₂) + (hne : Δ ≠ Δ₂) : Disjoint (discInt Δ) (discInt Δ₂) := by + have hman : ∀ x : T, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have key : ∀ {X Y : Set T}, IsClosedDisc X → IsClosedDisc Y → discBd X = discBd Y → + (discInt X ∩ discInt Y).Nonempty → X ⊆ Y := by + intro X Y hX hY hb hm + have hsub : discInt X ⊆ discInt Y := by + refine hX.isPreconnected_discInt.subset_left_of_subset_union (hY.isOpen_discInt hman) + hY.isClosed.isOpen_compl (disjoint_left.mpr fun w hw hn ↦ hn hw.1) (fun w hw ↦ ?_) hm + by_cases hwY : w ∈ Y + · exact Or.inl ⟨hwY, fun h ↦ hw.2 (hb ▸ h)⟩ + · exact Or.inr hwY + exact hX.subset_closure_discInt.trans + (closure_minimal (hsub.trans (discInt_subset Y)) hY.isClosed) + refine disjoint_left.mpr fun y h₁ h₂ ↦ hne (Subset.antisymm ?_ ?_) + · exact key hΔ hΔ₂ hbd ⟨y, h₁, h₂⟩ + · exact key hΔ₂ hΔ hbd.symm ⟨y, h₂, h₁⟩ + +omit [T2Space S] [T2Space Shat] in +theorem disc_edge_disjoint (rad : RadialDrawing cap Γ) {F : Drawing Shat} + (hF : F.IsSubdrawing rad.G) {c : Set S} (hc : c ∈ Γ.E) : Disjoint (cap.emb '' c) F.U := by + refine disjoint_left.mpr ?_ + rintro _ ⟨x, hx, rfl⟩ hxF + have hm : cap.emb x ∈ Γ.hatU cap ∩ rad.G.U := + ⟨mem_image_of_mem _ (hc.2.1 hx).1, hF.U_subset hxF⟩ + rw [rad.isPreRadial.1] at hm + obtain ⟨z, hz, hzx⟩ := hm + obtain rfl := cap.isEmbedding.injective hzx + exact (hc.2.1 hx).2 hz + +omit [T2Space S] in +/-- An edge of `Γ` lies inside `Δ` or outside `Δ`, when the boundary of `Δ` is a circuit of `Γ*`. -/ +theorem disc_edge_side (rad : RadialDrawing cap Γ) {F : Drawing Shat} (hF : F.IsSubdrawing rad.G) + (hman : ∀ x : Shat, IsManifoldPoint x) {Δ : Set Shat} (hΔ : IsClosedDisc Δ) + (hbd : discBd Δ = F.U) {c : Set S} (hc : c ∈ Γ.E) : + cap.emb '' c ⊆ discInt Δ ∨ cap.emb '' c ⊆ Δᶜ := by + have hconn : IsPreconnected (cap.emb '' c) := hc.2.2.1.isConnected.isPreconnected.image _ + cap.isEmbedding.continuous.continuousOn + refine hconn.subset_or_subset (hΔ.isOpen_discInt hman) hΔ.isClosed.isOpen_compl + (disjoint_left.mpr fun w hw hn ↦ hn hw.1) fun y hy ↦ ?_ + by_cases hyΔ : y ∈ Δ + · refine Or.inl ⟨hyΔ, fun hb ↦ disjoint_left.mp (disc_edge_disjoint rad hF hc) hy ?_⟩ + rwa [hbd] at hb + · exact Or.inr hyΔ + +theorem disjoint_discInt_closure {T : Type} [TopologicalSpace T] (hman : ∀ x : T, IsManifoldPoint x) + {Δ : Set T} (hΔ : IsClosedDisc Δ) : Disjoint (discInt Δ) (closure Δᶜ) := by + refine disjoint_left.mpr fun y hy hyc ↦ ?_ + obtain ⟨z, hz, hzi⟩ := mem_closure_iff.mp hyc _ (hΔ.isOpen_discInt hman) hy + exact hzi hz.1 + +omit [T2Space S] in +theorem restrict_in (_hman : ∀ x : Shat, IsManifoldPoint x) {Δ : Set Shat} (hΔ : IsClosedDisc Δ) + {c : Set S} (hc : c ∈ Γ.E) (h : cap.emb '' c ⊆ discInt Δ) : + c ∈ (Γ.restrict (cap.emb ⁻¹' Δ)).edgeSet := by + refine ⟨hc, fun x hx ↦ (h (mem_image_of_mem _ hx)).1, fun v hv ↦ ?_⟩ + have h₁ : cap.emb v ∈ closure (cap.emb '' c) := + image_closure_subset_closure_image cap.isEmbedding.continuous (mem_image_of_mem _ hv.1.1) + exact closure_minimal (h.trans (discInt_subset Δ)) hΔ.isClosed h₁ + +omit [T2Space S] [T2Space Shat] in +theorem restrict_out {Δ : Set Shat} {c : Set S} (hc : c ∈ Γ.E) (h : cap.emb '' c ⊆ Δᶜ) : + c ∈ (Γ.restrict (cap.emb ⁻¹' closure Δᶜ)).edgeSet := by + refine ⟨hc, fun x hx ↦ subset_closure (h (mem_image_of_mem _ hx)), fun v hv ↦ ?_⟩ + exact closure_mono h (image_closure_subset_closure_image cap.isEmbedding.continuous + (mem_image_of_mem _ hv.1.1)) + +/-- **What a disc bounded by a circuit of `Γ*` does to `Γ`.** -/ +theorem disc_facts (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (rad : RadialDrawing cap Γ) {F : Drawing Shat} (hF : F.IsCircuitOf rad.G) {Δ : Set Shat} + (hΔ : IsClosedDisc Δ) (hbd : discBd Δ = F.U) : + Γ.toHypergraph.IsSeparation (Γ.restrict (cap.emb ⁻¹' Δ)) (Γ.restrict (cap.emb ⁻¹' closure Δᶜ)) ∧ + (∀ v ∈ (Γ.restrict (cap.emb ⁻¹' Δ) ∩ Γ.restrict (cap.emb ⁻¹' closure Δᶜ)).vertexSet, + cap.emb v ∈ F.U) ∧ + (Γ.restrict (cap.emb ⁻¹' Δ)).edgeSet.Nonempty ∧ + ∀ e ∈ rad.G.E, rad.Splits (Γ.restrict (cap.emb ⁻¹' Δ)) + (Γ.restrict (cap.emb ⁻¹' closure Δᶜ)) e → e ∈ F.E := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have hFG := hF.1 + have hdd := disjoint_discInt_closure hman hΔ + have hopen := hΔ.isOpen_discInt hman + have hmid : ∀ v ∈ (Γ.restrict (cap.emb ⁻¹' Δ) ∩ Γ.restrict (cap.emb ⁻¹' closure Δᶜ)).vertexSet, + cap.emb v ∈ F.U := by + rintro v ⟨⟨-, h₁⟩, ⟨-, h₂⟩⟩ + by_contra hn + exact disjoint_left.mp hdd ⟨h₁, fun hb ↦ hn (hbd ▸ hb)⟩ h₂ + have hinter : ∀ c, c ∈ (Γ.restrict (cap.emb ⁻¹' Δ)).edgeSet → + c ∈ (Γ.restrict (cap.emb ⁻¹' closure Δᶜ)).edgeSet → False := by + rintro c ⟨hc, h₁, -⟩ ⟨-, h₂, -⟩ + obtain ⟨x, hx⟩ := hc.1 + refine disjoint_left.mp hdd ⟨h₁ hx, fun hb ↦ ?_⟩ (h₂ hx) + exact disjoint_left.mp (disc_edge_disjoint rad hFG hc) (mem_image_of_mem _ hx) (hbd ▸ hb) + have hsep : Γ.toHypergraph.IsSeparation (Γ.restrict (cap.emb ⁻¹' Δ)) + (Γ.restrict (cap.emb ⁻¹' closure Δᶜ)) := by + rw [isSeparation_iff_of_le (Γ.restrict_le _) (Γ.restrict_le _)] + refine ⟨?_, ?_, ?_⟩ + · apply Subset.antisymm + · exact union_subset (Γ.restrict_le _).vertexSet_subset (Γ.restrict_le _).vertexSet_subset + · intro v hv + by_cases hvΔ : cap.emb v ∈ Δ + · exact Or.inl ⟨hv, hvΔ⟩ + · exact Or.inr ⟨hv, subset_closure hvΔ⟩ + · apply Subset.antisymm + · exact union_subset (Γ.restrict_le _).edgeSet_subset (Γ.restrict_le _).edgeSet_subset + · intro c hc + rcases disc_edge_side rad hFG hman hΔ hbd hc with h | h + · exact Or.inl (restrict_in hman hΔ hc h) + · exact Or.inr (restrict_out hc h) + · exact eq_empty_of_forall_notMem fun c hc ↦ hinter c hc.1 hc.2 + have hsub' : F.U ⊆ rad.G.U := hFG.U_subset + obtain ⟨D, G₃, hD, hrad, hmax, hsub, hhat⟩ := + rad.exists_full hS (h3.hatRegions_isOpenDisc hS cap) h3.1 + have hDE := hD.E_nonempty h3.1 + have hbU : discBd Δ ⊆ G₃.U := by + rw [hbd] + exact hFG.U_subset.trans hsub.U_subset + refine ⟨hsep, hmid, ?_, ?_⟩ + · obtain ⟨y, hyO, hyU⟩ := exists_notMem_U (Γ := G₃) hT hopen + hΔ.nonempty_discInt + obtain ⟨s, hs, hys⟩ := exists_region_of_notMem hyU + have hsI := region_in hT hΔ hbU hs (subset_closure hys) hyO + obtain ⟨f, c, hfc, hfs⟩ := exists_colour hD hrad hmax hDE hs + obtain ⟨x, hx⟩ := hfc.mem.1 + refine ⟨c, restrict_in hman hΔ hfc.1 ?_⟩ + rcases disc_edge_side rad hFG hman hΔ hbd hfc.1 with h | h + · exact h + · exact absurd (hsI (hfs (mem_image_of_mem _ hx))).1 (h (mem_image_of_mem _ (hfc.subset hx))) + · intro e he hsp + by_contra heF + obtain ⟨c₁, c₂, ⟨v₀, w, hv₀, hw, hsetG, f₁, f₂, hne, h₁, h₂, ht₁, ht₂, hfr₁, hfr₂⟩, hcase⟩ := + rad.splits_iff.mp hsp + have heG := hsub.2 he + obtain ⟨hrO, hw', hw'G, hset', her⟩ := rad.pair_spoke_ends hD hrad hsub heG hv₀ hw hsetG + obtain ⟨p₁, hp₁, hep₁, hfp₁⟩ := pair_side hS hD h3 hrad hmax h₁.mem hv₀ ht₁ hrO hfr₁ heG her hw' + hw'G hset' + obtain ⟨p₂, hp₂, hep₂, hfp₂⟩ := pair_side hS hD h3 hrad hmax h₂.mem hv₀ ht₂ hrO hfr₂ heG her hw' + hw'G hset' + have hedis := edge_disjoint_U hFG he heF + have hbH : discBd Δ ⊆ (radialUnion hrad).U := fun x hx ↦ Or.inr (hbU hx) + have heconn : IsPreconnected e := he.2.2.1.isConnected.isPreconnected + obtain ⟨y, hye⟩ := he.1 + have hcases : e ⊆ discInt Δ ∨ e ⊆ Δᶜ := by + refine heconn.subset_or_subset hopen hΔ.isClosed.isOpen_compl + (disjoint_left.mpr fun w hw hn ↦ hn hw.1) fun z hz ↦ ?_ + by_cases hzΔ : z ∈ Δ + · exact Or.inl ⟨hzΔ, fun hb ↦ disjoint_left.mp hedis hz (hbd ▸ hb)⟩ + · exact Or.inr hzΔ + rcases hcases with hein | heout + · have key : ∀ {f c p}, Γ.IsSkEdgeIn f c → p ∈ (radialUnion hrad).R → e ⊆ closure p → + cap.emb '' f ⊆ closure p → c ∈ (Γ.restrict (cap.emb ⁻¹' Δ)).edgeSet := by + intro f c p hfc hp hep hfp + have hpI := region_in hT hΔ hbH hp (hep hye) (hein hye) + have hcl : closure p ⊆ Δ := + closure_minimal (hpI.trans (discInt_subset Δ)) hΔ.isClosed + obtain ⟨x, hx⟩ := hfc.mem.1 + have hxc := mem_image_of_mem cap.emb (hfc.subset hx) + refine restrict_in hman hΔ hfc.1 ?_ + rcases disc_edge_side rad hFG hman hΔ hbd hfc.1 with h | h + · exact h + · exact absurd (hcl (hfp (mem_image_of_mem _ hx))) (h hxc) + rcases hcase with ⟨-, hb⟩ | ⟨hb, -⟩ + · exact hinter c₂ (key h₂ hp₂ hep₂ hfp₂) hb + · exact hinter c₁ (key h₁ hp₁ hep₁ hfp₁) hb + · have key : ∀ {f c p}, Γ.IsSkEdgeIn f c → p ∈ (radialUnion hrad).R → e ⊆ closure p → + cap.emb '' f ⊆ closure p → c ∈ (Γ.restrict (cap.emb ⁻¹' closure Δᶜ)).edgeSet := by + intro f c p hfc hp hep hfp + have hpO : p ⊆ Δᶜ := by + obtain ⟨z, hzO, hzp⟩ := mem_closure_iff.mp (hep hye) _ hΔ.isClosed.isOpen_compl + (heout hye) + obtain ⟨q, hq, rfl⟩ := id hp + refine isPreconnected_connectedComponentIn.subset_right_of_subset_union hopen + hΔ.isClosed.isOpen_compl (disjoint_left.mpr fun w hw hn ↦ hn hw.1) (fun a ha ↦ ?_) + ⟨z, hzp, hzO⟩ + by_cases haΔ : a ∈ Δ + · exact Or.inl ⟨haΔ, fun hb ↦ region_subset hp ha (hbH hb)⟩ + · exact Or.inr haΔ + obtain ⟨x, hx⟩ := hfc.mem.1 + have hxc := mem_image_of_mem cap.emb (hfc.subset hx) + refine restrict_out hfc.1 ?_ + rcases disc_edge_side rad hFG hman hΔ hbd hfc.1 with h | h + · exact absurd (closure_mono hpO (hfp (mem_image_of_mem _ hx))) + (disjoint_left.mp hdd (h hxc)) + · exact h + rcases hcase with ⟨ha, -⟩ | ⟨-, ha⟩ + · exact hinter c₁ ha (key h₁ hp₁ hep₁ hfp₁) + · exact hinter c₂ ha (key h₂ hp₂ hep₂ hfp₂) + +end Geometry + +theorem prop_inter {a₁ a₂ p₁ p₂ q₁ q₂ : Prop} (h₁ : (p₁ ∧ ¬ q₁) ∨ (¬ p₁ ∧ q₁)) + (h₂ : (p₂ ∧ ¬ q₂) ∨ (¬ p₂ ∧ q₂)) (ha : a₁ ↔ a₂) (hp : p₁ ↔ p₂) : (a₁ ∧ q₁) ↔ (a₂ ∧ q₂) := by + tauto + +section Main + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {rad : RadialDrawing cap Γ} + +open Classical in +omit [T2Space S] [T2Space Shat] in +/-- A separation with a smaller middle and fewer split edges has at most the same `λ`-order. -/ +theorem TieBreaker.lambda_le (tb : TieBreaker rad) {P Q A B : Hypergraph S (Set S)} + (hV : (P ∩ Q).vertexSet ⊆ (A ∩ B).vertexSet) + (hE : ∀ e ∈ rad.G.E, rad.Splits P Q e → rad.Splits A B e) + (_hAB : Γ.toHypergraph.IsSeparation A B) : + tb.lambdaOrder (P, Q) ≤ tb.lambdaOrder (A, B) := by + have hfAB : (A ∩ B).vertexSet.Finite := (A ∩ B).vertexSet_finite + have h₁ : tb.N1 (P, Q) ≤ tb.N1 (A, B) := ncard_le_ncard hV hfAB + have hEfin : rad.G.E.Finite := rad.G.finite_edges + have hfs : ∀ A' B' : Hypergraph S (Set S), {e ∈ rad.G.E | rad.Splits A' B' e} ⊆ + ↑hEfin.toFinset := fun _ _ e he ↦ hEfin.mem_toFinset.mpr he.1 + have h₂ : tb.N2 (P, Q) ≤ tb.N2 (A, B) := by + simp only [TieBreaker.N2, finsum_eq_sum_ite _ (hfs _ _)] + refine Finset.sum_le_sum fun e he ↦ ?_ + have heE : e ∈ rad.G.E := hEfin.mem_toFinset.mp he + have hpos := (tb.wtE_pos e heE).le + by_cases a : rad.Splits P Q e + · simp [heE, a, hE e heE a] + · by_cases b : rad.Splits A B e <;> simp [heE, a, b, hpos] + simp only [TieBreaker.lambdaOrder] + rw [Prod.Lex.toLex_le_toLex] + rcases h₁.lt_or_eq with h | h + · exact Or.inl h + · have heqV : (P ∩ Q).vertexSet = (A ∩ B).vertexSet := + eq_of_subset_of_ncard_le hV h.ge hfAB + refine Or.inr ⟨h, ?_⟩ + rw [Prod.Lex.toLex_le_toLex] + rcases h₂.lt_or_eq with h' | h' + · exact Or.inl h' + · refine Or.inr ⟨h', le_of_eq ?_⟩ + simp only [TieBreaker.N3, heqV] + +open Classical in +omit [T2Space S] [T2Space Shat] in +/-- A separation with a smaller middle that splits only edges split by `(A, B)`, but not all of +them, +has smaller `λ`-order. -/ +theorem TieBreaker.lambda_lt (tb : TieBreaker rad) {P Q A B : Hypergraph S (Set S)} + (hV : (P ∩ Q).vertexSet ⊆ (A ∩ B).vertexSet) + (hE : ∀ e ∈ rad.G.E, rad.Splits P Q e → rad.Splits A B e) {e₀ : Set Shat} (he₀ : e₀ ∈ rad.G.E) + (h₁ : rad.Splits A B e₀) (h₂ : ¬ rad.Splits P Q e₀) : + tb.lambdaOrder (P, Q) < tb.lambdaOrder (A, B) := by + have hfAB : (A ∩ B).vertexSet.Finite := (A ∩ B).vertexSet_finite + have hN : tb.N1 (P, Q) ≤ tb.N1 (A, B) := ncard_le_ncard hV hfAB + have hEfin : rad.G.E.Finite := rad.G.finite_edges + have hfs : ∀ A' B' : Hypergraph S (Set S), {e ∈ rad.G.E | rad.Splits A' B' e} ⊆ + ↑hEfin.toFinset := fun _ _ e he ↦ hEfin.mem_toFinset.mpr he.1 + have hlt : tb.N2 (P, Q) < tb.N2 (A, B) := by + simp only [TieBreaker.N2, finsum_eq_sum_ite _ (hfs _ _)] + refine Finset.sum_lt_sum (fun e he ↦ ?_) ⟨e₀, hEfin.mem_toFinset.mpr he₀, ?_⟩ + · have heE : e ∈ rad.G.E := hEfin.mem_toFinset.mp he + have hpos := (tb.wtE_pos e heE).le + by_cases a : rad.Splits P Q e + · simp [heE, a, hE e heE a] + · by_cases b : rad.Splits A B e <;> simp [heE, a, b, hpos] + · simp [he₀, h₁, h₂, tb.wtE_pos e₀ he₀] + simp only [TieBreaker.lambdaOrder] + rw [Prod.Lex.toLex_lt_toLex] + rcases hN.lt_or_eq with h | h + · exact Or.inl h + · refine Or.inr ⟨h, ?_⟩ + rw [Prod.Lex.toLex_lt_toLex] + exact Or.inl hlt + +omit [T2Space S] in +omit [T2Space Shat] in +theorem tangleRep_spec (rad : RadialDrawing cap Γ) (ord : ℕ) + (𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) : + tangleRep rad ord 𝒯 ≤ ord ∧ ∀ F : Drawing Shat, F.IsCircuitOf rad.G → + F.E.ncard < 2 * tangleRep rad ord 𝒯 → ∃ Δ : Set Shat, IsClosedDisc Δ ∧ discBd Δ = F.U ∧ + (Γ.restrict (cap.emb ⁻¹' Δ), Γ.restrict (cap.emb ⁻¹' closure Δᶜ)) ∈ 𝒯 := by + have hne : {k : ℕ | k ≤ ord ∧ ∀ F : Drawing Shat, F.IsCircuitOf rad.G → F.E.ncard < 2 * k → + ∃ Δ : Set Shat, IsClosedDisc Δ ∧ discBd Δ = F.U ∧ + (Γ.restrict (cap.emb ⁻¹' Δ), Γ.restrict (cap.emb ⁻¹' closure Δᶜ)) ∈ 𝒯}.Nonempty := + ⟨0, Nat.zero_le _, fun F _ h ↦ absurd h (Nat.not_lt_zero _)⟩ + exact Nat.sSup_mem hne ⟨ord, fun _ h ↦ h.1⟩ + +omit [T2Space S] in +/-- `rep(𝒯) ≤ rep(Γ)`: a circuit of half-length less than `rep(𝒯)` bounds a disc and is consequently +null-homotopic. -/ +theorem tangleRep_le_rep (rad : RadialDrawing cap Γ) (ord : ℕ) + (𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))) : + (tangleRep rad ord 𝒯 : ℕ∞) ≤ Painting.rep rad := by + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + refine le_sInf ?_ + rintro _ ⟨F, hF, hn, rfl⟩ + by_contra hlt + have hlt' : F.E.ncard / 2 < tangleRep rad ord 𝒯 := by + exact_mod_cast not_le.mp hlt + obtain ⟨Δ, hΔ, hbd, -⟩ := (tangleRep_spec rad ord 𝒯).2 F hF (by omega) + have hbdS : Disjoint F.U (bd Shat) := disjoint_left.mpr fun x _ hx ↦ hx (hT.2.2 x) + have hO := GM14.isOArc_of_isCircuit hF.2 + refine hn ((epstein Shat univ F.U (Surface.IsClosedSurface.isSurface hT) inferInstance hO + (subset_univ _) hbdS).2.1 ⟨Δ, subset_univ _, hΔ, ?_⟩) + rw [← hbd] + exact Surface.discBd_subset Δ + +omit [T2Space S] in +theorem Painting.restrict_le_of {Y : Hypergraph S (Set S)} {W : Set S} + (hY : Y ≤ Γ.toHypergraph) (hV : Γ.V ∩ W ⊆ Y.vertexSet) + (hE : (Γ.restrict W).edgeSet ⊆ Y.edgeSet) : Γ.restrict W ≤ Y := by + refine ⟨hV, hE, fun e he ↦ ?_⟩ + rw [← hY.ends_eq e (hE he), (Γ.restrict_le _).ends_eq e he] + +omit [T2Space Shat] in +theorem eq_of_all_edges (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (rad : RadialDrawing cap Γ) {X : Hypergraph S (Set S)} (hX : X ≤ Γ.toHypergraph) + (hall : ∀ c ∈ Γ.E, c ∈ X.edgeSet) : X = Γ.toHypergraph := by + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hX le_rfl ?_ ?_ + · apply Subset.antisymm hX.vertexSet_subset + intro v hv + obtain ⟨c, hc, hvc⟩ := exists_edge_incident hS h3 rad hv + have h₁ : v ∈ Γ.toHypergraph.ends c := + ⟨hc, hv, hvc, fun h ↦ Γ.disjoint_V hc h hv⟩ + rw [hX.ends_eq c (hall c hc)] at h₁ + exact X.vertex_mem_of_inc h₁ + · exact Subset.antisymm hX.edgeSet_subset hall + +omit [TopologicalSpace S] [T2Space S] in +theorem left_ne_of_mem {G : Hypergraph S (Set S)} {θ : ℕ} + {𝒰 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} (h𝒰 : IsTangle G θ 𝒰) {P Q} + (hm : (P, Q) ∈ 𝒰) : P ≠ G := by + intro heq + refine h𝒰.axiom2 hm hm hm ?_ + rw [heq] + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (GM10.union_le (GM10.union_le le_rfl le_rfl) le_rfl) le_rfl + (by simp) (by simp) + +omit [T2Space Shat] in +/-- If `(P, P')` has its middle in the middle of `(A, B)`, and splits only edges that `(A, B)` +splits, +then the same holds for the two separations obtained by uncrossing. -/ +theorem mix_facts (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + {A B P P' : Hypergraph S (Set S)} (hAB : Γ.toHypergraph.IsSeparation A B) + (hPP : Γ.toHypergraph.IsSeparation P P') + (hV : ∀ v ∈ (P ∩ P').vertexSet, v ∈ (A ∩ B).vertexSet) + (hspAB : ∀ e ∈ rad.G.E, rad.Splits P P' e → rad.Splits A B e) : + ((A ∩ P') ∩ (B ∪ P)).vertexSet ⊆ (A ∩ B).vertexSet ∧ + (∀ e ∈ rad.G.E, rad.Splits (A ∩ P') (B ∪ P) e → rad.Splits A B e) ∧ + ((A ∪ P) ∩ (B ∩ P')).vertexSet ⊆ (A ∩ B).vertexSet ∧ + (∀ e ∈ rad.G.E, rad.Splits (A ∪ P) (B ∩ P') e → rad.Splits A B e) := by + have hs₂ : Γ.toHypergraph.IsSeparation (A ∩ P') (B ∪ P) := (hAB.symm.union_inter hPP).symm + have hs₃ : Γ.toHypergraph.IsSeparation (A ∪ P) (B ∩ P') := hAB.union_inter hPP + refine ⟨?_, ?_, ?_, ?_⟩ + · rintro v ⟨⟨ha, hp'⟩, hb | hp⟩ + · exact ⟨ha, hb⟩ + · exact hV v ⟨hp, hp'⟩ + · intro e he hsp + obtain ⟨c₁, c₂, hp, -⟩ := rad.splits_iff.mp hsp + obtain ⟨hc₁, hc₂⟩ : c₁ ∈ Γ.E ∧ c₂ ∈ Γ.E := by + obtain ⟨_, _, _, _, _, _, _, _, h₁, h₂, _⟩ := hp + exact ⟨h₁.1, h₂.1⟩ + have e₁ := splits_of_pair hS h3 hp hs₂ + have e₂ := splits_of_pair hS h3 hp hAB + have e₃ := splits_of_pair hS h3 hp hPP + by_contra hn + have hn' : ¬ rad.Splits P P' e := fun h ↦ hn (hspAB e he h) + have p₁ := edge_cases hPP hc₁ + have p₂ := edge_cases hPP hc₂ + have ha : c₁ ∈ A.edgeSet ↔ c₂ ∈ A.edgeSet := not_not.mp fun h ↦ hn (e₂.mpr h) + have hq : c₁ ∈ P.edgeSet ↔ c₂ ∈ P.edgeSet := not_not.mp fun h ↦ hn' (e₃.mpr h) + exact e₁.mp hsp (prop_inter p₁ p₂ ha hq) + · rintro v ⟨ha | hp, hb, hp'⟩ + · exact ⟨ha, hb⟩ + · exact hV v ⟨hp, hp'⟩ + · intro e he hsp + obtain ⟨c₁, c₂, hp, -⟩ := rad.splits_iff.mp hsp + have e₁ := splits_of_pair hS h3 hp hs₃ + have e₂ := splits_of_pair hS h3 hp hAB + have e₃ := splits_of_pair hS h3 hp hPP + by_contra hn + have hn' : ¬ rad.Splits P P' e := fun h ↦ hn (hspAB e he h) + have ha : c₁ ∈ A.edgeSet ↔ c₂ ∈ A.edgeSet := not_not.mp fun h ↦ hn (e₂.mpr h) + have hq : c₁ ∈ P.edgeSet ↔ c₂ ∈ P.edgeSet := not_not.mp fun h ↦ hn' (e₃.mpr h) + exact e₁.mp hsp (or_congr ha hq) + +/-- **Graph Minors XIX, (8.4).** "Let $\mathscr{T}, \mathscr{T}'$ be tangles in $\Gamma$ and let +$(A, B)$ be the +$(\mathscr{T}, \mathscr{T}')$-distinction. Suppose that $|V(A \cap B)| < rep(\mathscr{T})$. +Then there is a circuit $F$ in $\Gamma^*$ such that $A = \Gamma \cap ins(F)$, $B = \Gamma +\cap out(F)$." -/ +theorem theorem_8_4_proof (hS : IsSurface S) + (h3 : Γ.IsInternallyThreeConnected) (tb : TieBreaker rad) {ord ord' : ℕ} + {𝒯 𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (h𝒯 : IsTangle Γ.toHypergraph ord 𝒯) (h𝒯' : IsTangle Γ.toHypergraph ord' 𝒯') + {A B : Hypergraph S (Set S)} (hd : IsDistinction tb.lambdaOrder 𝒯 𝒯' A B) + (hlt : Hypergraph.separationOrder A B < tangleRep rad ord 𝒯) : + ∃ (F : Drawing Shat) (Δ : Set Shat), IsInsOf rad ord 𝒯 F Δ ∧ + A = Γ.restrict (cap.emb ⁻¹' Δ) ∧ B = Γ.restrict (cap.emb ⁻¹' closure Δᶜ) := by + classical + have hT := cap.isClosedSurface + have : ConnectedSpace Shat := cap.connected + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have htie := tb.isTieBreaker hS h3 + have hABT := hd.1.1 + have hBAT := hd.1.2 + have hAB := h𝒯.isSeparation hABT + have hinc : ∀ {X : Hypergraph S (Set S)}, X ≤ Γ.toHypergraph → (∀ c ∈ Γ.E, c ∈ X.edgeSet) → + X = Γ.toHypergraph := fun hX hall ↦ eq_of_all_edges hS h3 rad hX hall + have hnotfull : ∀ {θ : ℕ} {𝒰 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))}, + IsTangle Γ.toHypergraph θ 𝒰 → ∀ {P Q}, (P, Q) ∈ 𝒰 → P ≠ Γ.toHypergraph := fun h𝒰 _ _ hm ↦ + left_ne_of_mem h𝒰 hm + have hA : A.edgeSet.Nonempty := by + by_contra hn + refine hnotfull h𝒯' hBAT (hinc hAB.right_le fun c hc ↦ ?_) + rcases edge_cases hAB hc with ⟨h, -⟩ | ⟨-, h⟩ + · exact absurd ⟨c, h⟩ hn + · exact h + have hB : B.edgeSet.Nonempty := by + by_contra hn + refine hnotfull h𝒯 hABT (hinc hAB.left_le fun c hc ↦ ?_) + rcases edge_cases hAB hc with ⟨h, -⟩ | ⟨-, h⟩ + · exact h + · exact absurd ⟨c, h⟩ hn + have hlt' : (Hypergraph.separationOrder A B : ℕ∞) < Painting.rep rad := + lt_of_lt_of_le (by exact_mod_cast hlt) (tangleRep_le_rep rad ord 𝒯) + obtain ⟨F, Δ, hF, hsplit, hΔ, hbd, hsub, hcount, hmid⟩ := + theorem_8_1' hS h3 rad hAB hlt' hA hB + have hsmall : F.E.ncard < 2 * tangleRep rad ord 𝒯 := by omega + have hbound : ∀ {P P' : Hypergraph S (Set S)}, Γ.toHypergraph.IsSeparation P P' → + (∀ v ∈ (P ∩ P').vertexSet, cap.emb v ∈ F.U) → + (∀ e ∈ rad.G.E, rad.Splits P P' e → e ∈ F.E) → + tb.lambdaOrder (P, P') ≤ tb.lambdaOrder (A, B) ∧ + tb.lambdaOrder (A ∩ P', B ∪ P) ≤ tb.lambdaOrder (A, B) ∧ + tb.lambdaOrder (A ∪ P, B ∩ P') ≤ tb.lambdaOrder (A, B) := by + intro P P' hPP hmidP hsplP + have hV : ∀ v ∈ (P ∩ P').vertexSet, v ∈ (A ∩ B).vertexSet := fun v hv ↦ + hmid v (hmidP v hv) (hPP.left_le.vertexSet_subset hv.1) + have hspAB : ∀ e ∈ rad.G.E, rad.Splits P P' e → rad.Splits A B e := fun e he h ↦ + hsplit e (hsplP e he h) + obtain ⟨m₁, m₂, m₃, m₄⟩ := mix_facts hS h3 hAB hPP hV hspAB + exact ⟨tb.lambda_le (fun v hv ↦ hV v hv) hspAB hAB, tb.lambda_le m₁ m₂ hAB, + tb.lambda_le m₃ m₄ hAB⟩ + obtain ⟨hsep, hmidH, hne, hspl⟩ := disc_facts hS h3 rad hF hΔ hbd + obtain ⟨b₁, b₂, b₃⟩ := hbound hsep hmidH hspl + rcases distinction_cases htie h𝒯 h𝒯' hd hsep b₁ b₂ b₃ hsub hne with ⟨h₁, h₂⟩ | ⟨h₁, h₂, hnT⟩ + · refine ⟨F, Δ, ⟨hF, hsmall, hΔ, hbd, ?_⟩, h₁.symm, h₂.symm⟩ + rw [h₁, h₂] + exact hABT + · obtain ⟨Δ₂, hΔ₂, hbd₂, hmem⟩ := (tangleRep_spec rad ord 𝒯).2 F hF hsmall + have hne₂ : Δ ≠ Δ₂ := by + rintro rfl + exact hnT hmem + have hdis := discInt_disjoint hT hΔ hΔ₂ (hbd.trans hbd₂.symm) hne₂ + obtain ⟨hsep₂, hmid₂, hne₂', hspl₂⟩ := disc_facts hS h3 rad hF hΔ₂ hbd₂ + obtain ⟨d₁, d₂, d₃⟩ := hbound hsep₂ hmid₂ hspl₂ + have hle : Γ.restrict (cap.emb ⁻¹' Δ₂) ≤ A := by + have hA' : A = Γ.restrict (cap.emb ⁻¹' closure Δᶜ) := h₂.symm + refine Painting.restrict_le_of hAB.left_le ?_ ?_ + · rintro v ⟨hv, hvΔ⟩ + rw [hA'] + refine ⟨hv, ?_⟩ + by_cases hvF : cap.emb v ∈ F.U + · have hfr : discBd Δ ⊆ frontier Δ := (IsClosedDisc.frontier_eq_discBd hT hΔ).ge + have := hfr (hbd ▸ hvF) + rw [frontier_eq_closure_inter_closure] at this + exact this.2 + · have hvI : cap.emb v ∈ discInt Δ₂ := ⟨hvΔ, fun hb ↦ hvF (hbd₂ ▸ hb)⟩ + refine subset_closure fun hc ↦ ?_ + exact disjoint_left.mp hdis ⟨hc, fun hb ↦ hvF (hbd ▸ hb)⟩ hvI + · rintro c ⟨hc, hsubc, -⟩ + rw [hA'] + refine restrict_out hc ?_ + rcases disc_edge_side rad hF.1 hman hΔ hbd hc with h | h + · exfalso + obtain ⟨x, hx⟩ := hc.1 + have hx₁ := mem_image_of_mem cap.emb hx + refine disjoint_left.mp hdis (h hx₁) ⟨hsubc hx, fun hb ↦ ?_⟩ + exact disjoint_left.mp (disc_edge_disjoint rad hF.1 hc) hx₁ (hbd₂ ▸ hb) + · exact h + rcases distinction_cases htie h𝒯 h𝒯' hd hsep₂ d₁ d₂ d₃ (Or.inl hle) hne₂' with + ⟨h₃, h₄⟩ | ⟨-, -, hn⟩ + · exact ⟨F, Δ₂, ⟨hF, hsmall, hΔ₂, hbd₂, hmem⟩, h₃.symm, h₄.symm⟩ + · exact absurd hmem hn + +end Main + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section8g.lean b/LeanPool/GraphMinor/GM19/Section8g.lean new file mode 100644 index 0000000000..ecab9b23f1 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section8g.lean @@ -0,0 +1,411 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Sides + +/-! +# Graph Minors XIX, (8.5) + +A circuit `F` of `Γ*` that bounds a closed disc gives a separation of `Γ`. Its first `λ`-term is +`½|E(F)|`, and it splits exactly the edges of `F` (`disc_split`, `disc_order`). So a shorter or +lighter circuit gives a separation of smaller `λ`-order (`disc_lambda_lt`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {Γ : Painting S} {rad : RadialDrawing cap Γ} + +/-- The part of `Γ` in a subset `X` of `Σ̂`. -/ +abbrev partIn (cap : IsCappedSurface S Shat) (Γ : Painting S) (X : Set Shat) : Hypergraph S (Set S) + := + Γ.restrict (cap.emb ⁻¹' X) + +omit [T2Space S] [T2Space Shat] in +theorem restrict_side {Ω : Set Shat} {c : Set S} (hc : c ∈ Γ.E) (h : cap.emb '' c ⊆ Ω) : + c ∈ (partIn cap Γ (closure Ω)).edgeSet := by + refine ⟨hc, fun x hx ↦ subset_closure (h (mem_image_of_mem _ hx)), fun v hv ↦ ?_⟩ + exact closure_mono h (image_closure_subset_closure_image cap.isEmbedding.continuous + (mem_image_of_mem _ hv.1.1)) + +variable [ConnectedSpace Shat] + +omit [T2Space S] [T2Space Shat] [ConnectedSpace Shat] in +theorem side_edge (rad : RadialDrawing cap Γ) {F : Drawing Shat} (hF : F.IsSubdrawing rad.G) + {Ω : Set Shat} (hΩ : IsSide Ω F) {c : Set S} (hc : c ∈ Γ.E) + (hm : (cap.emb '' c ∩ Ω).Nonempty) : cap.emb '' c ⊆ Ω := by + have hconn : IsPreconnected (cap.emb '' c) := hc.2.2.1.isConnected.isPreconnected.image _ + cap.isEmbedding.continuous.continuousOn + exact hΩ.subset hconn (disc_edge_disjoint rad hF hc) hm + +omit [T2Space S] [T2Space Shat] [ConnectedSpace Shat] in +/-- Parts of `Γ` in the closures of three sides that cover `Σ̂` have union `Γ`. -/ +theorem part_cover (rad : RadialDrawing cap Γ) {F₁ F₂ F₃ : Drawing Shat} {Ω₁ Ω₂ Ω₃ : Set Shat} + (h₁ : F₁.IsSubdrawing rad.G) (h₂ : F₂.IsSubdrawing rad.G) (h₃ : F₃.IsSubdrawing rad.G) + (s₁ : IsSide Ω₁ F₁) (s₂ : IsSide Ω₂ F₂) (s₃ : IsSide Ω₃ F₃) + (hcov : ∀ x, x ∈ closure Ω₁ ∨ x ∈ closure Ω₂ ∨ x ∈ closure Ω₃) : + partIn cap Γ (closure Ω₁) ∪ partIn cap Γ (closure Ω₂) ∪ partIn cap Γ (closure Ω₃) = + Γ.toHypergraph := by + have hle := GM10.union_le (GM10.union_le (Γ.restrict_le (cap.emb ⁻¹' closure Ω₁)) + (Γ.restrict_le (cap.emb ⁻¹' closure Ω₂))) (Γ.restrict_le (cap.emb ⁻¹' closure Ω₃)) + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hle le_rfl ?_ ?_ + · refine Subset.antisymm hle.vertexSet_subset fun v hv ↦ ?_ + rcases hcov (cap.emb v) with h | h | h + · exact Or.inl (Or.inl ⟨hv, h⟩) + · exact Or.inl (Or.inr ⟨hv, h⟩) + · exact Or.inr ⟨hv, h⟩ + · refine Subset.antisymm hle.edgeSet_subset fun c hc ↦ ?_ + have hc' : c ∈ Γ.E := hc + obtain ⟨x, hx⟩ := hc'.1 + have hxi := mem_image_of_mem cap.emb hx + have key : ∀ {K : Drawing Shat} {Ω : Set Shat}, K.IsSubdrawing rad.G → IsSide Ω K → + cap.emb x ∈ closure Ω → c ∈ (partIn cap Γ (closure Ω)).edgeSet := by + intro K Ω hK hΩ hxcl + have hxΩ : cap.emb x ∈ Ω := hΩ.mem_of_closure hxcl (disjoint_left.mp + (disc_edge_disjoint rad hK hc') hxi) + exact restrict_side hc' (side_edge rad hK hΩ hc' ⟨_, hxi, hxΩ⟩) + rcases hcov (cap.emb x) with h | h | h + · exact Or.inl (Or.inl (key h₁ s₁ h)) + · exact Or.inl (Or.inr (key h₂ s₂ h)) + · exact Or.inr (key h₃ s₃ h) + +variable {F : Drawing Shat} {Δ : Set Shat} + +/-- Every edge of a circuit that bounds a closed disc is split by the separation of the disc. -/ +theorem disc_split (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (rad : RadialDrawing cap Γ) (hF : F.IsCircuitOf rad.G) (hΔ : IsClosedDisc Δ) + (hbd : discBd Δ = F.U) {e : Set Shat} (he : e ∈ F.E) : + rad.Splits (partIn cap Γ Δ) (partIn cap Γ (closure Δᶜ)) e := by + classical + have hT := cap.isClosedSurface + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + obtain ⟨D, G₃, hD, hrad, hmax, hsub, hhat⟩ := + rad.exists_full hS (h3.hatRegions_isOpenDisc hS cap) h3.1 + have hDE := hD.E_nonempty h3.1 + have hFG₃ : F.IsSubdrawing G₃ := hF.1.trans hsub + have hin := isSide_int hT hΔ hbd + have hout := isSide_out hT hΔ hbd + have heG := hsub.2 (hF.1.2 he) + obtain ⟨z, hz⟩ := heG.1 + have hzU : z ∈ F.U := F.closure_subset_U he (subset_closure hz) + obtain ⟨s, hs, hzs, hm⟩ := exists_region_near hT G₃ hin.isOpen (hin.U_subset_closure hzU) + obtain ⟨s', hs', hzs', hm'⟩ := exists_region_near hT G₃ hout.isOpen (hout.U_subset_closure hzU) + have hsI := hin.region_subset hFG₃ hs hm + have hsO := hout.region_subset hFG₃ hs' hm' + let t : Set S → Prop := fun c ↦ cap.emb '' c ⊆ discInt Δ + have hside : ∀ {c}, c ∈ Γ.E → cap.emb '' c ⊆ discInt Δ ∨ cap.emb '' c ⊆ Δᶜ := fun hc ↦ + disc_edge_side rad hF.1 hman hΔ hbd hc + have hcol : s ∈ colourSet cap Γ G₃ t := by + obtain ⟨f, c, hfc, hfs⟩ := exists_colour hD hrad hmax hDE hs + refine ⟨hs, f, c, hfc, hfs, ?_⟩ + obtain ⟨x, hx⟩ := hfc.mem.1 + rcases hside hfc.1 with h | h + · exact h + · exact absurd (hsI (hfs (mem_image_of_mem _ hx))).1 (h (mem_image_of_mem _ (hfc.subset hx))) + have hnot : s' ∉ colourSet cap Γ G₃ t := by + rintro ⟨-, f, c, hfc, hfs, ht⟩ + obtain ⟨x, hx⟩ := hfc.mem.1 + exact hsO (hfs (mem_image_of_mem _ hx)) (ht (mem_image_of_mem _ (hfc.subset hx))).1 + have hb : e ∈ (boundaryDrawing G₃ (colourSet cap Γ G₃ t)).E := + mem_boundaryDrawing_E.mpr ⟨⟨s, hcol, heG, hs, z, hz, hzs⟩, ⟨s', ⟨hs', hnot⟩, heG, hs', z, hz, + hzs'⟩⟩ + obtain ⟨-, -, -, -, -, -, f₁, f₂, c₁, c₂, hp, h₁, h₂, -, -, hnt⟩ := + boundary_split hS hDE rad hD hrad hmax hsub hhat hb + refine rad.splits_iff.mpr ⟨c₁, c₂, hp, ?_⟩ + have hinside : ∀ {c}, c ∈ Γ.E → t c → c ∈ (partIn cap Γ Δ).edgeSet := fun hc ht ↦ + restrict_in hman hΔ hc ht + have houtside : ∀ {c}, c ∈ Γ.E → ¬ t c → c ∈ (partIn cap Γ (closure Δᶜ)).edgeSet := fun hc ht ↦ + restrict_out hc ((hside hc).resolve_left ht) + by_cases ht₁ : t c₁ + · exact Or.inl ⟨hinside h₁.1 ht₁, houtside h₂.1 fun h ↦ hnt ⟨fun _ ↦ h, fun _ ↦ ht₁⟩⟩ + · have ht₂ : t c₂ := by + by_contra h + exact hnt ⟨fun h' ↦ absurd h' ht₁, fun h' ↦ absurd h' h⟩ + exact Or.inr ⟨houtside h₁.1 ht₁, hinside h₂.1 ht₂⟩ + +omit [ConnectedSpace Shat] in +/-- The order of the separation of a disc bounded by a circuit is half the length of the circuit. -/ +theorem disc_order (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (rad : RadialDrawing cap Γ) (hF : F.IsCircuitOf rad.G) (hΔ : IsClosedDisc Δ) + (hbd : discBd Δ = F.U) : + F.E.ncard = 2 * Hypergraph.separationOrder (partIn cap Γ Δ) (partIn cap Γ (closure Δᶜ)) := by + have hT := cap.isClosedSurface + obtain ⟨D, G₃, hD, hrad, hmax, hsub, hhat⟩ := + rad.exists_full hS (h3.hatRegions_isOpenDisc hS cap) h3.1 + have hFG₃ : F.IsSubdrawing G₃ := hF.1.trans hsub + have hb := IsCircuit.ncard_E_eq hF.2 (P := D.V) fun e x y hl ↦ + bipartite_of_preRadial hrad.2 e x y ((hFG₃.isLink_iff hl.1).mp hl) + have himage : F.V ∩ D.V = cap.emb '' (partIn cap Γ Δ ∩ partIn cap Γ (closure Δᶜ)).vertexSet := by + apply Subset.antisymm + · rintro x ⟨hx, hxD⟩ + rw [hD.hV] at hxD + obtain ⟨v, hv, rfl⟩ := hxD + have hxU := F.V_subset_U hx + have hfr : cap.emb v ∈ frontier Δ := by + rw [IsClosedDisc.frontier_eq_discBd hT hΔ, hbd] + exact hxU + rw [frontier_eq_closure_inter_closure, hΔ.isClosed.closure_eq] at hfr + exact mem_image_of_mem _ ⟨⟨hv, hfr.1⟩, ⟨hv, hfr.2⟩⟩ + · rintro _ ⟨v, hv, rfl⟩ + have hU := (disc_facts hS h3 rad hF hΔ hbd).2.1 v hv + refine ⟨mem_V_of_mem_U hF.1 hU (rad.isPreRadial.2.1 (mem_image_of_mem _ hv.1.1)), ?_⟩ + rw [hD.hV] + exact mem_image_of_mem _ hv.1.1 + rw [hb, himage, ncard_image_of_injective _ cap.isEmbedding.injective] + rfl + +/-- The second term of the `λ`-order of the separation of a disc is the weight of the circuit. -/ +theorem disc_N2 (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) (tb : TieBreaker rad) + (hF : F.IsCircuitOf rad.G) (hΔ : IsClosedDisc Δ) (hbd : discBd Δ = F.U) : + tb.N2 (partIn cap Γ Δ, partIn cap Γ (closure Δᶜ)) = tb.weightSub F := by + have : {e ∈ rad.G.E | rad.Splits (partIn cap Γ Δ) (partIn cap Γ (closure Δᶜ)) e} = F.E := + Subset.antisymm (fun e he ↦ (disc_facts hS h3 rad hF hΔ hbd).2.2.2 e he.1 he.2) + fun e he ↦ ⟨hF.1.2 he, disc_split hS h3 rad hF hΔ hbd he⟩ + simp only [TieBreaker.N2, TieBreaker.weightSub] + rw [this] + +/-- A shorter circuit, or a lighter circuit of the same length, gives a smaller `λ`-order. -/ +theorem disc_lambda_lt (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) (tb : TieBreaker rad) + {C : Drawing Shat} {Δ' : Set Shat} (hC : C.IsCircuitOf rad.G) (hΔ' : IsClosedDisc Δ') + (hbd' : discBd Δ' = C.U) (hF : F.IsCircuitOf rad.G) (hΔ : IsClosedDisc Δ) + (hbd : discBd Δ = F.U) + (h : C.E.ncard < F.E.ncard ∨ (C.E.ncard = F.E.ncard ∧ tb.weightSub C < tb.weightSub F)) : + tb.lambdaOrder (partIn cap Γ Δ', partIn cap Γ (closure Δ'ᶜ)) < + tb.lambdaOrder (partIn cap Γ Δ, partIn cap Γ (closure Δᶜ)) := by + have o₁ := disc_order hS h3 rad hC hΔ' hbd' + have o₂ := disc_order hS h3 rad hF hΔ hbd + simp only [TieBreaker.lambdaOrder] + rw [Prod.Lex.toLex_lt_toLex] + rcases h with h | ⟨h, h'⟩ + · exact Or.inl (by simp only [TieBreaker.N1]; omega) + · refine Or.inr ⟨by simp only [TieBreaker.N1]; omega, ?_⟩ + rw [Prod.Lex.toLex_lt_toLex] + left + rw [disc_N2 hS h3 tb hC hΔ' hbd', disc_N2 hS h3 tb hF hΔ hbd] + exact h' + +omit [T2Space S] [T2Space Shat] [ConnectedSpace Shat] in +/-- Two disjoint sets of edges of `Γ*`, the second nonempty, have different weights, because the +weights are rationally independent. -/ +theorem TieBreaker.weight_ne (tb : TieBreaker rad) {X Y : Set (Set Shat)} (hX : X ⊆ rad.G.E) + (hY : Y ⊆ rad.G.E) (hd : Disjoint X Y) (hne : Y.Nonempty) : + ∑ᶠ e ∈ X, tb.wtE e ≠ ∑ᶠ e ∈ Y, tb.wtE e := by + classical + intro heq + have hfin : rad.G.E.Finite := rad.G.finite_edges + let t := hfin.toFinset + have ht : ∀ {Z : Set (Set Shat)}, Z ⊆ rad.G.E → Z ⊆ ↑t := fun hZ _ h ↦ hfin.mem_toFinset.mpr + (hZ h) + rw [finsum_eq_sum_ite _ (ht hX), finsum_eq_sum_ite _ (ht hY)] at heq + let α : Set Shat → ℚ := fun e ↦ (if e ∈ X then 1 else 0) - (if e ∈ Y then 1 else 0) + have hsum : ∑ᶠ e ∈ rad.G.E, (α e : ℝ) * tb.wtE e = ∑ᶠ v ∈ Γ.V, (((0 : S + → ℚ) v : ℚ) : ℝ) * tb.wtV v := by + have hr : ∑ᶠ v ∈ Γ.V, (((0 : S → ℚ) v : ℚ) : ℝ) * tb.wtV v = 0 := by simp + rw [hr, finsum_eq_sum_ite _ (ht subset_rfl)] + have hsplit : ∀ e ∈ t, (if e ∈ rad.G.E then (α e : ℝ) * tb.wtE e else 0) = + (if e ∈ X then tb.wtE e else 0) - (if e ∈ Y then tb.wtE e else 0) := by + intro e he + have heE : e ∈ rad.G.E := hfin.mem_toFinset.mp he + by_cases a : e ∈ X <;> by_cases b : e ∈ Y <;> simp [α, heE, a, b] + rw [Finset.sum_congr rfl hsplit, Finset.sum_sub_distrib, heq, sub_self] + obtain ⟨e, he⟩ := hne + have := (tb.rationally_independent α 0 hsum).1 e (hY he) + simp [α, he, disjoint_right.mp hd he] at this + +variable {F₁ F₂ P : Drawing Shat} {u v : Shat} {ord ord' : ℕ} + {𝒯 𝒯' : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + +omit [T2Space S] [T2Space Shat] [ConnectedSpace Shat] in +theorem TieBreaker.weightSub_sup (tb : TieBreaker rad) {C X Y : Drawing Shat} (hE : C.E = X.E ∪ Y.E) + (hd : Disjoint X.E Y.E) : tb.weightSub C = tb.weightSub X + tb.weightSub Y := by + simp only [TieBreaker.weightSub] + rw [hE, finsum_mem_union hd X.finite_edges Y.finite_edges] + +/-- The first assertion of (8.5), from the bound on `P` against `F₁`. -/ +theorem step_8_5 (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) (tb : TieBreaker rad) + (h𝒯' : IsTangle Γ.toHypergraph ord' 𝒯') (hins : IsInsOf rad ord 𝒯 F Δ) + (hd : IsDistinction tb.lambdaOrder 𝒯 𝒯' (partIn cap Γ Δ) (partIn cap Γ (closure Δᶜ))) + (ht : TwoPaths rad.G F F₁ F₂ P u v) (hle : P.E.ncard ≤ F₁.E.ncard) + (heq : P.E.ncard = F₁.E.ncard → tb.weightSub P ≤ tb.weightSub F₁) : + ∃ Δ₂ : Set Shat, IsInsOf rad ord 𝒯 (rad.G.sup P F₂) Δ₂ ∧ + (partIn cap Γ Δ₂, partIn cap Γ (closure Δ₂ᶜ)) ∈ 𝒯' := by + obtain ⟨hF, hsmall, hΔ, hbd, -⟩ := hins + have hC : Drawing.IsCircuitOf (rad.G.sup P F₂) rad.G := ⟨rad.G.sup_isSubdrawing P F₂, + ht.left_circuit⟩ + have hE : (rad.G.sup P F₂).E = P.E ∪ F₂.E := Drawing.sup_E ht.path.1 ht.sub₂ + have hdis : Disjoint P.E F₂.E := disjoint_left.mpr fun e he he' ↦ + disjoint_left.mp ht.meet_E he (ht.right.1.2 he') + have hc₁ : (rad.G.sup P F₂).E.ncard = P.E.ncard + F₂.E.ncard := by + rw [hE, ncard_union_eq hdis P.finite_edges F₂.finite_edges] + have hc₂ : F.E.ncard = F₁.E.ncard + F₂.E.ncard := by + rw [ht.union_E, ncard_union_eq ht.disj_E F₁.finite_edges F₂.finite_edges] + obtain ⟨Δ₂, hΔ₂, hbd₂, hmem⟩ := (tangleRep_spec rad ord 𝒯).2 _ hC (by omega) + refine ⟨Δ₂, ⟨hC, by omega, hΔ₂, hbd₂, hmem⟩, ?_⟩ + have hlt := disc_lambda_lt hS h3 tb hC hΔ₂ hbd₂ hF hΔ hbd (by + rcases hle.lt_or_eq with h | h + · exact Or.inl (by omega) + · refine Or.inr ⟨by omega, ?_⟩ + rw [tb.weightSub_sup hE hdis, tb.weightSub_sup ht.union_E ht.disj_E] + have hne := tb.weight_ne (ht.path.1.2) ht.sub₁.2 + (disjoint_right.mpr fun e he he' ↦ disjoint_left.mp ht.meet_E he' (ht.left.1.2 he)) + ht.exists_edge + have := lt_of_le_of_ne (heq h) hne + simp only [TieBreaker.weightSub] + simp only [TieBreaker.weightSub] at this + linarith) + have o₁ := disc_order hS h3 rad hC hΔ₂ hbd₂ + have o₂ := disc_order hS h3 rad hF hΔ hbd + have hBA := h𝒯'.order_lt hd.1.2 + have hcomm : Hypergraph.separationOrder (partIn cap Γ (closure Δᶜ)) (partIn cap Γ Δ) = + Hypergraph.separationOrder (partIn cap Γ Δ) (partIn cap Γ (closure Δᶜ)) := by + simp only [Hypergraph.separationOrder, GM10.inter_comm] + have hord : Hypergraph.separationOrder (partIn cap Γ Δ₂) (partIn cap Γ (closure Δ₂ᶜ)) < ord' := by + omega + rcases h𝒯'.axiom1 (disc_facts hS h3 rad hC hΔ₂ hbd₂).1 hord with h | h + · exact h + · exact absurd (hd.2 ⟨hmem, h⟩) (not_le.mpr hlt) + +/-- **Graph Minors XIX, (8.5).** "Let $\mathscr{T}$ be a tangle in $\Gamma$, and let $F$ be a +$\mathscr{T}$-enclave around +$\mathscr{T}'$, and let $u, v \in V(F)$ be distinct. Let $F_1, F_2$ be the two paths of $F$ +between $u$ and $v$, and let $P$ be a path of $\Gamma^*$ between $u$ and $v$ with no other +vertex or edge in common with $F$. Suppose that $|E(P)| \le |E(F_1)|$, and if equality holds +then $\lambda(P) \le \lambda(F_1)$." -/ +theorem theorem_8_5_proof (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (tb : TieBreaker rad) + (h𝒯 : IsTangle Γ.toHypergraph ord 𝒯) (h𝒯' : IsTangle Γ.toHypergraph ord' 𝒯') + (hins : IsInsOf rad ord 𝒯 F Δ) + (hd : IsDistinction tb.lambdaOrder 𝒯 𝒯' (partIn cap Γ Δ) (partIn cap Γ (closure Δᶜ))) + (ht : TwoPaths rad.G F F₁ F₂ P u v) (hle : P.E.ncard ≤ F₁.E.ncard) + (heq : P.E.ncard = F₁.E.ncard → tb.weightSub P ≤ tb.weightSub F₁) : + ∃ Δ₂ : Set Shat, IsInsOf rad ord 𝒯 (rad.G.sup P F₂) Δ₂ ∧ + (partIn cap Γ Δ₂, partIn cap Γ (closure Δ₂ᶜ)) ∈ 𝒯' ∧ + (¬ P.U ⊆ Δ → Δ₂ ∩ Δ = F₂.U) ∧ + F₂.E.ncard ≤ P.E.ncard ∧ (P.E.ncard = F₂.E.ncard → tb.weightSub F₂ < tb.weightSub P) := by + have hT := cap.isClosedSurface + obtain ⟨Δ₂, hins₂, hmem₂⟩ := step_8_5 hS h3 tb h𝒯' hins hd ht hle heq + obtain ⟨hF, -, hΔ, hbd, hABT⟩ := id hins + have hBA := hd.1.2 + have hin := isSide_int hT hΔ hbd + have hout := isSide_out hT hΔ hbd + have hdis : Disjoint (discInt Δ) Δᶜ := disjoint_left.mpr fun x hx hx' ↦ hx' hx.1 + have hcov : F.Uᶜ ⊆ discInt Δ ∪ Δᶜ := fun x hx ↦ by + by_cases hxΔ : x ∈ Δ + · exact Or.inl ⟨hxΔ, fun hb ↦ hx (hbd ▸ hb)⟩ + · exact Or.inr hxΔ + have hnotA : ∀ {C : Drawing Shat} {Δ' : Set Shat}, C.IsSubdrawing rad.G → IsClosedDisc Δ' → + discBd Δ' = C.U → (partIn cap Γ Δ', partIn cap Γ (closure Δ'ᶜ)) ∈ 𝒯' → + ¬ discInt Δ ⊆ discInt Δ' := by + intro C Δ' hCs hΔ' hb' hm hsub + have hO := isSide_int hT hΔ' hb' + have hc := part_cover rad hF.1 hCs hCs hout hO hO (fun x ↦ by + by_cases hx : x ∈ Δᶜ + · exact Or.inl (subset_closure hx) + · refine Or.inr (Or.inl ?_) + rw [closure_discInt hΔ'] + have : Δ ⊆ Δ' := hΔ.subset_closure_discInt.trans + (closure_minimal (hsub.trans (discInt_subset _)) hΔ'.isClosed) + exact this (not_not.mp hx)) + rw [closure_discInt hΔ'] at hc + exact h𝒯'.axiom2 hBA hm hm hc + have hnotB : ∀ {C : Drawing Shat} {Δ' : Set Shat}, C.IsSubdrawing rad.G → IsClosedDisc Δ' → + discBd Δ' = C.U → (partIn cap Γ Δ', partIn cap Γ (closure Δ'ᶜ)) ∈ 𝒯 → + ¬ Δᶜ ⊆ discInt Δ' := by + intro C Δ' hCs hΔ' hb' hm hsub + have hO := isSide_int hT hΔ' hb' + have hc := part_cover rad hF.1 hCs hCs hin hO hO (fun x ↦ by + rw [closure_discInt hΔ, closure_discInt hΔ'] + by_cases hx : x ∈ Δ + · exact Or.inl hx + · exact Or.inr (Or.inl (discInt_subset _ (hsub hx)))) + rw [closure_discInt hΔ, closure_discInt hΔ'] at hc + exact h𝒯.axiom2 hABT hm hm hc + have hpath := path_side ht.sub hin hout hdis hcov ht.path.1 ht.path.2 ht.ne ht.meet_V ht.meet_E + have huv := ht.mem_V + have huvΔ : u ∈ Δ ∧ v ∈ Δ := by + have : F.V ⊆ Δ := fun x hx ↦ Surface.discBd_subset _ (hbd ▸ F.V_subset_U hx) + exact ⟨this huv.1, this huv.2⟩ + have hC₂s : (rad.G.sup P F₂).IsSubdrawing rad.G := rad.G.sup_isSubdrawing P F₂ + have hC₁s : (rad.G.sup P F₁).IsSubdrawing rad.G := rad.G.sup_isSubdrawing P F₁ + refine ⟨Δ₂, hins₂, hmem₂, ?_, ?_⟩ + · intro hnP + have hPo : ∀ x ∈ P.U, x ∈ Δᶜ ∨ x = u ∨ x = v := by + rcases hpath with h | h + · exfalso + refine hnP fun x hx ↦ ?_ + rcases h x hx with h' | rfl | rfl + · exact h'.1 + · exact huvΔ.1 + · exact huvΔ.2 + · exact h + obtain ⟨-, -, hΔ₂, hbd₂, -⟩ := hins₂ + have hO₂ := isSide_int hT hΔ₂ hbd₂ + have hd₂ := disjoint_disc hT hin hΔ₂ hbd₂ (ht.side_disjoint hin hdis hPo) + (hnotA hC₂s hΔ₂ hbd₂ hmem₂) + have huv₂ := ht.swap.mem_V₁ + apply Subset.antisymm + · rintro x ⟨hx₂, hx⟩ + by_cases hxF : x ∈ F.U + · by_contra hxn + have hxC : x ∉ (rad.G.sup P F₂).U := by + rw [ht.U_right] + rintro (hxP | hxP) + · rcases hPo x hxP with h' | rfl | rfl + · exact h' hx + · exact hxn (F₂.V_subset_U huv₂.1) + · exact hxn (F₂.V_subset_U huv₂.2) + · exact hxn hxP + have hxI : x ∈ discInt Δ₂ := ⟨hx₂, fun hb ↦ hxC (hbd₂ ▸ hb)⟩ + obtain ⟨z, hzO, hzI⟩ := mem_closure_iff.mp (hΔ.subset_closure_discInt hx) _ hO₂.isOpen hxI + exact disjoint_left.mp hd₂ hzI (discInt_subset _ hzO) + · exact absurd hx₂ (disjoint_left.mp hd₂ ⟨hx, fun hb ↦ hxF (hbd ▸ hb)⟩) + · intro x hx + refine ⟨Surface.discBd_subset _ (hbd₂ ▸ ht.U_right ▸ Or.inr hx), ?_⟩ + exact Surface.discBd_subset _ (hbd ▸ ht.U_eq ▸ Or.inr hx) + · by_contra hn + have hn' : P.E.ncard ≤ F₂.E.ncard ∧ + (P.E.ncard = F₂.E.ncard → tb.weightSub P ≤ tb.weightSub F₂) := by + by_cases h₁ : F₂.E.ncard ≤ P.E.ncard + · have h₂ : ¬ (P.E.ncard = F₂.E.ncard → tb.weightSub F₂ < tb.weightSub P) := + fun h ↦ hn ⟨h₁, h⟩ + push Not at h₂ + exact ⟨h₂.1.le, fun _ ↦ h₂.2⟩ + · exact ⟨(not_le.mp h₁).le, fun h ↦ by omega⟩ + obtain ⟨Δ₁, hins₁, hmem₁⟩ := step_8_5 hS h3 tb h𝒯' hins hd ht.swap hn'.1 hn'.2 + obtain ⟨-, -, hΔ₂, hbd₂, hT₂⟩ := hins₂ + obtain ⟨-, -, hΔ₁, hbd₁, hT₁⟩ := hins₁ + have hO₁ := isSide_int hT hΔ₁ hbd₁ + have hO₂ := isSide_int hT hΔ₂ hbd₂ + rcases hpath with hPi | hPo + · have d₁ := disjoint_disc hT hout hΔ₁ hbd₁ (ht.swap.side_disjoint hout hdis.symm hPi) + (hnotB hC₁s hΔ₁ hbd₁ hT₁) + have d₂ := disjoint_disc hT hout hΔ₂ hbd₂ (ht.side_disjoint hout hdis.symm hPi) + (hnotB hC₂s hΔ₂ hbd₂ hT₂) + have hc := part_cover rad hF.1 hC₁s hC₂s hout hO₁ hO₂ fun x ↦ by + rw [closure_discInt hΔ₁, closure_discInt hΔ₂] + exact ht.theta_cover hT hout hΔ₁ hΔ₂ hbd₁ hbd₂ d₁ d₂ x + rw [closure_discInt hΔ₁, closure_discInt hΔ₂] at hc + exact h𝒯'.axiom2 hBA hmem₁ hmem₂ hc + · have d₁ := disjoint_disc hT hin hΔ₁ hbd₁ (ht.swap.side_disjoint hin hdis hPo) + (hnotA hC₁s hΔ₁ hbd₁ hmem₁) + have d₂ := disjoint_disc hT hin hΔ₂ hbd₂ (ht.side_disjoint hin hdis hPo) + (hnotA hC₂s hΔ₂ hbd₂ hmem₂) + have hc := part_cover rad hF.1 hC₁s hC₂s hin hO₁ hO₂ fun x ↦ by + rw [closure_discInt hΔ₁, closure_discInt hΔ₂] + exact ht.theta_cover hT hin hΔ₁ hΔ₂ hbd₁ hbd₂ d₁ d₂ x + rw [closure_discInt hΔ, closure_discInt hΔ₁, closure_discInt hΔ₂] at hc + exact h𝒯.axiom2 hABT hT₁ hT₂ hc + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section8h.lean b/LeanPool/GraphMinor/GM19/Section8h.lean new file mode 100644 index 0000000000..5715da00df --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section8h.lean @@ -0,0 +1,209 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section8g + +/-! +# Graph Minors XIX, (8.6) and (8.7) +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + [ConnectedSpace Shat] {cap : IsCappedSurface S Shat} {Γ : Painting S} {rad : RadialDrawing cap Γ} + {ord : ℕ} {𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + +/-- **Both edges of the pair of an edge `e` of `Γ*` lie on the side of `e`.** The two edges `c₁, c₂` +of `Γ` next to `e` share a region of `sk(Γ) ∪ G₃` with `e`, by `pair_side`. -/ +theorem pair_in_side (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (rad : RadialDrawing cap Γ) {K : Drawing Shat} (hK : K.IsSubdrawing rad.G) {Ω : Set Shat} + (hΩ : IsSide Ω K) {e : Set Shat} {c₁ c₂ : Set S} (he : e ∈ rad.G.E) (hp : rad.PairOf e c₁ c₂) + (heΩ : e ⊆ Ω) : cap.emb '' c₁ ⊆ Ω ∧ cap.emb '' c₂ ⊆ Ω := by + have hT := cap.isClosedSurface + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + obtain ⟨D, G₃, hD, hrad, hmax, hsub, hhat⟩ := + rad.exists_full hS (h3.hatRegions_isOpenDisc hS cap) h3.1 + obtain ⟨v₀, w, hv₀, hw, hsetG, f₁, f₂, hne, h₁, h₂, ht₁, ht₂, hfr₁, hfr₂⟩ := hp + have heG := hsub.2 he + obtain ⟨hrO, hw', hw'G, hset', her⟩ := rad.pair_spoke_ends hD hrad hsub heG hv₀ hw hsetG + have key : ∀ {f c : Set S} , Γ.IsSkEdgeIn f c → v₀ ∈ tilde f → + cap.emb '' f ⊆ frontier (rad.regionOf w) → cap.emb '' c ⊆ Ω := by + intro f c hfc htf hfr + obtain ⟨p, hp, hep, hfp⟩ := pair_side hS hD h3 hrad hmax hfc.mem hv₀ htf hrO hfr heG her hw' + hw'G hset' + obtain ⟨y, hye⟩ := heG.1 + obtain ⟨z, hzΩ, hzp⟩ := mem_closure_iff.mp (hep hye) _ hΩ.isOpen (heΩ hye) + have hconn : IsPreconnected p := by + obtain ⟨q, hq, rfl⟩ := id hp + exact isPreconnected_connectedComponentIn + have hpΩ : p ⊆ Ω := hΩ.subset hconn (disjoint_left.mpr fun a ha haK ↦ + region_subset hp ha (Or.inr (hsub.U_subset (hK.U_subset haK)))) ⟨z, hzp, hzΩ⟩ + obtain ⟨x, hx⟩ := hfc.mem.1 + have hxi : cap.emb x ∈ cap.emb '' c := mem_image_of_mem _ (hfc.subset hx) + have hxΩ : cap.emb x ∈ Ω := hΩ.mem_of_closure (closure_mono hpΩ (hfp (mem_image_of_mem _ hx))) + (disjoint_left.mp (disc_edge_disjoint rad hK hfc.1) hxi) + exact side_edge rad hK hΩ hfc.1 ⟨_, hxi, hxΩ⟩ + exact ⟨key h₁ ht₁ hfr₁, key h₂ ht₂ hfr₂⟩ + +variable {F₁ F₂ : Drawing Shat} {Δ₁ Δ₂ : Set Shat} + +/-- Every edge of a circuit bounding `Δ₁` has an edge of `Γ ∩ Δ₁` next to it. -/ +theorem exists_pair_in (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (rad : RadialDrawing cap Γ) (hF₁ : F₁.IsCircuitOf rad.G) (hΔ₁ : IsClosedDisc Δ₁) + (hbd₁ : discBd Δ₁ = F₁.U) {e : Set Shat} (he : e ∈ F₁.E) : + ∃ c₁ c₂, rad.PairOf e c₁ c₂ ∧ c₁ ∈ (partIn cap Γ Δ₁).edgeSet := by + obtain ⟨c₁, c₂, hp, h | h⟩ := rad.splits_iff.mp (disc_split hS h3 rad hF₁ hΔ₁ hbd₁ he) + · exact ⟨c₁, c₂, hp, h.1⟩ + · refine ⟨c₂, c₁, ?_, h.2⟩ + obtain ⟨v, w, hv, hw, hs, f₁, f₂, hne, a, b, c, d, x, y⟩ := hp + exact ⟨v, w, hv, hw, hs, f₂, f₁, hne.symm, b, a, d, c, y, x⟩ + +omit [T2Space Shat] [ConnectedSpace Shat] in +theorem U_of_edges (hF : F₁.IsCircuit) {X : Set Shat} (hX : IsClosed X) (h : ∀ e ∈ F₁.E, e ⊆ X) : + F₁.U ⊆ X := by + intro x hx + by_cases hxV : x ∈ F₁.V + · obtain ⟨g, hg, hxg⟩ := exists_edge_at_vertex hF hxV + exact closure_minimal (h g hg) hX hxg + · obtain ⟨g, hg, hxg⟩ := F₁.exists_edge_of_mem hx hxV + exact h g hg hxg + +/-- A circuit edge outside `Δ₂` has its pair outside `Δ₂`. So if `Γ ∩ Δ₁ ⊆ Γ ∩ Δ₂` then `Δ₁ ⊆ Δ₂`. +-/ +theorem nest_of_le (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (h𝒯 : IsTangle Γ.toHypergraph ord 𝒯) (hins₁ : IsInsOf rad ord 𝒯 F₁ Δ₁) + (hins₂ : IsInsOf rad ord 𝒯 F₂ Δ₂) (hle : partIn cap Γ Δ₁ ≤ partIn cap Γ Δ₂) : Δ₁ ⊆ Δ₂ := by + have hT := cap.isClosedSurface + obtain ⟨hF₁, -, hΔ₁, hbd₁, hm₁⟩ := hins₁ + obtain ⟨hF₂, -, hΔ₂, hbd₂, hm₂⟩ := hins₂ + have hout := isSide_out hT hΔ₂ hbd₂ + have hO₁ := isSide_int hT hΔ₁ hbd₁ + have hO₂ := isSide_int hT hΔ₂ hbd₂ + have hedge : ∀ e ∈ F₁.E, e ⊆ Δ₂ := by + intro e he + by_contra hn + obtain ⟨y, hy, hyn⟩ := not_subset.mp hn + have heG := hF₁.1.2 he + have heF : e ∉ F₂.E := fun h ↦ hn fun z hz ↦ + Surface.discBd_subset _ (hbd₂ ▸ F₂.closure_subset_U h (subset_closure hz)) + have hd := edge_disjoint_U hF₂.1 heG heF + have heO : e ⊆ Δ₂ᶜ := hout.subset heG.2.2.1.isConnected.isPreconnected hd ⟨y, hy, hyn⟩ + obtain ⟨c₁, c₂, hp, hc⟩ := exists_pair_in hS h3 rad hF₁ hΔ₁ hbd₁ he + have hcO := (pair_in_side hS h3 rad hF₂.1 hout heG hp heO).1 + obtain ⟨x, hx⟩ := hc.1.1 + exact hcO (mem_image_of_mem _ hx) ((hle.edgeSet_subset hc).2.1 hx) + have hUsub : F₁.U ⊆ Δ₂ := U_of_edges hF₁.2 hΔ₂.isClosed hedge + have hnot : ¬ Δ₂ᶜ ⊆ discInt Δ₁ := fun hsub ↦ by + have hc := part_cover rad hF₂.1 hF₁.1 hF₁.1 hO₂ hO₁ hO₁ fun x ↦ by + rw [closure_discInt hΔ₁, closure_discInt hΔ₂] + by_cases hx : x ∈ Δ₂ + · exact Or.inl hx + · exact Or.inr (Or.inl (discInt_subset _ (hsub hx))) + rw [closure_discInt hΔ₁, closure_discInt hΔ₂] at hc + exact h𝒯.axiom2 hm₂ hm₁ hm₁ hc + have hd := disjoint_disc hT hout hΔ₁ hbd₁ + (disjoint_left.mpr fun x hx hxU ↦ hx (hUsub hxU)) hnot + exact fun x hx ↦ by + by_contra hn + exact disjoint_left.mp hd hn hx + +/-- If `Γ ∩ Δ₁ ⊆ Γ ∩ out(Δ₂)` then `U(F₁)` misses the inside of `Δ₂`. -/ +theorem apart_of_le (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (hins₁ : IsInsOf rad ord 𝒯 F₁ Δ₁) (hins₂ : IsInsOf rad ord 𝒯 F₂ Δ₂) + (hle : partIn cap Γ Δ₁ ≤ partIn cap Γ (closure Δ₂ᶜ)) : Disjoint (discInt Δ₂) F₁.U := by + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + obtain ⟨hF₁, -, hΔ₁, hbd₁, hm₁⟩ := hins₁ + obtain ⟨hF₂, -, hΔ₂, hbd₂, hm₂⟩ := hins₂ + have hO₂ := isSide_int hT hΔ₂ hbd₂ + have hedge : ∀ e ∈ F₁.E, e ⊆ (discInt Δ₂)ᶜ := by + intro e he + by_contra hn + obtain ⟨y, hy, hyn⟩ := not_subset.mp hn + have hyI : y ∈ discInt Δ₂ := not_not.mp hyn + have heG := hF₁.1.2 he + have heF : e ∉ F₂.E := fun h ↦ disjoint_left.mp hO₂.disjoint_U hyI + (F₂.closure_subset_U h (subset_closure hy)) + have hd := edge_disjoint_U hF₂.1 heG heF + have heI : e ⊆ discInt Δ₂ := hO₂.subset heG.2.2.1.isConnected.isPreconnected hd ⟨y, hy, hyI⟩ + obtain ⟨c₁, c₂, hp, hc⟩ := exists_pair_in hS h3 rad hF₁ hΔ₁ hbd₁ he + have hcI := (pair_in_side hS h3 rad hF₂.1 hO₂ heG hp heI).1 + obtain ⟨x, hx⟩ := hc.1.1 + have h₂ := (hle.edgeSet_subset hc).2.1 hx + exact disjoint_left.mp (disjoint_discInt_closure hman hΔ₂) (hcI (mem_image_of_mem _ hx)) h₂ + have := U_of_edges hF₁.2 (hO₂.isOpen.isClosed_compl) hedge + exact disjoint_left.mpr fun x hx hxU ↦ this hxU hx + +/-- **Graph Minors XIX, (8.6).** "Let $\mathscr{T}$ be a tangle in $\Gamma$, and let $F_1, F_2$ be +$\mathscr{T}$-enclaves. +Then either $ins(F_1) \subseteq ins(F_2)$, or $ins(F_2) \subseteq ins(F_1)$, or $ins(F_1) +\cap ins(F_2) = U(F_1) \cap U(F_2)$." -/ +theorem theorem_8_6_proof (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (tb : TieBreaker rad) + (h𝒯 : IsTangle Γ.toHypergraph ord 𝒯) {ord₁ ord₂ : ℕ} + {𝒯₁ 𝒯₂ : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} + (h𝒯₁ : IsTangle Γ.toHypergraph ord₁ 𝒯₁) (h𝒯₂ : IsTangle Γ.toHypergraph ord₂ 𝒯₂) + (hins₁ : IsInsOf rad ord 𝒯 F₁ Δ₁) (hins₂ : IsInsOf rad ord 𝒯 F₂ Δ₂) + (hd₁ : IsDistinction tb.lambdaOrder 𝒯 𝒯₁ (partIn cap Γ Δ₁) (partIn cap Γ (closure Δ₁ᶜ))) + (hd₂ : IsDistinction tb.lambdaOrder 𝒯 𝒯₂ (partIn cap Γ Δ₂) (partIn cap Γ (closure Δ₂ᶜ))) : + Δ₁ ⊆ Δ₂ ∨ Δ₂ ⊆ Δ₁ ∨ Δ₁ ∩ Δ₂ = F₁.U ∩ F₂.U := by + have hT := cap.isClosedSurface + have htie := tb.isTieBreaker hS h3 + have hr₁ := GraphMinor.GM10.theorem_10_2_proof _ _ _ _ _ _ _ _ htie h𝒯 h𝒯₁ hd₁ + have hr₂ := GraphMinor.GM10.theorem_10_2_proof _ _ _ _ _ _ _ _ htie h𝒯 h𝒯₂ hd₂ + have hnc := GraphMinor.GM10.theorem_9_4_proof htie hr₁ hr₂ + rw [SeparationsCross, not_not] at hnc + have hs₂ := h𝒯.isSeparation hd₂.1.1 + obtain ⟨hF₁, -, hΔ₁, hbd₁, hm₁⟩ := id hins₁ + obtain ⟨hF₂, -, hΔ₂, hbd₂, hm₂⟩ := id hins₂ + rcases hnc with ⟨h, -⟩ | ⟨h, h'⟩ | ⟨h, h'⟩ | ⟨-, h⟩ + · exact Or.inl (nest_of_le hS h3 h𝒯 hins₁ hins₂ h) + · have a₁ := apart_of_le hS h3 hins₁ hins₂ h + have a₂ := apart_of_le hS h3 hins₂ hins₁ h' + have hO₁ := isSide_int hT hΔ₁ hbd₁ + have hO₂ := isSide_int hT hΔ₂ hbd₂ + by_cases hm : (discInt Δ₁ ∩ discInt Δ₂).Nonempty + · refine Or.inl ?_ + have hsub := hO₂.subset hO₁.conn a₂ hm + exact hΔ₁.subset_closure_discInt.trans + (closure_minimal (hsub.trans (discInt_subset _)) hΔ₂.isClosed) + · refine Or.inr (Or.inr ?_) + have hdis : Disjoint (discInt Δ₁) (discInt Δ₂) := + disjoint_iff_inter_eq_empty.mpr (not_nonempty_iff_eq_empty.mp hm) + apply Subset.antisymm + · rintro x ⟨hx₁, hx₂⟩ + refine ⟨?_, ?_⟩ + · by_contra hn + have hxI : x ∈ discInt Δ₁ := ⟨hx₁, fun hb ↦ hn (hbd₁ ▸ hb)⟩ + obtain ⟨z, hzO, hzI⟩ := mem_closure_iff.mp (hΔ₂.subset_closure_discInt hx₂) _ hO₁.isOpen + hxI + exact disjoint_left.mp hdis hzO hzI + · by_contra hn + have hxI : x ∈ discInt Δ₂ := ⟨hx₂, fun hb ↦ hn (hbd₂ ▸ hb)⟩ + obtain ⟨z, hzO, hzI⟩ := mem_closure_iff.mp (hΔ₁.subset_closure_discInt hx₁) _ hO₂.isOpen + hxI + exact disjoint_left.mp hdis hzI hzO + · rintro x ⟨hx₁, hx₂⟩ + exact ⟨Surface.discBd_subset _ (hbd₁ ▸ hx₁), Surface.discBd_subset _ (hbd₂ ▸ hx₂)⟩ + · exfalso + refine h𝒯.axiom2 hd₂.1.1 hd₁.1.1 hd₂.1.1 ?_ + have l₂ := hs₂.left_le + have l₁ := (h𝒯.isSeparation hd₁.1.1).left_le + have l₃ := GM10.union_le l₂ l₁ + exact eq_of_cover hs₂ (le_trans (GM10.le_union_left l₂ l₁) (GM10.le_union_left l₃ l₂)) + (le_trans h' (le_trans (GM10.le_union_right l₂ l₁) (GM10.le_union_left l₃ l₂))) + (GM10.union_le l₃ l₂) + · exact Or.inr (Or.inl (nest_of_le hS h3 h𝒯 hins₂ hins₁ h)) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section8i.lean b/LeanPool/GraphMinor/GM19/Section8i.lean new file mode 100644 index 0000000000..df684f4ada --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section8i.lean @@ -0,0 +1,478 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Epstein +public import LeanPool.GraphMinor.GM19.Section8h + +/-! +# Graph Minors XIX, (8.7) +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +section Sided + +variable {T : Type} [TopologicalSpace T] [T2Space T] [ConnectedSpace T] {F : Drawing T} + {Ω₁ Ω₂ : Set T} + +/-- `Ω₁, Ω₂` are the two components of the complement of `U(F)`, for a drawing `F` that bounds a +closed disc. -/ +def Sided (F : Drawing T) (Ω₁ Ω₂ : Set T) : Prop := + ∃ Δ : Set T, IsClosedDisc Δ ∧ discBd Δ = F.U ∧ + ((Ω₁ = discInt Δ ∧ Ω₂ = Δᶜ) ∨ (Ω₁ = Δᶜ ∧ Ω₂ = discInt Δ)) + +omit [T2Space T] [ConnectedSpace T] in +theorem Sided.symm (h : Sided F Ω₁ Ω₂) : Sided F Ω₂ Ω₁ := by + obtain ⟨Δ, hΔ, hbd, h | h⟩ := h + · exact ⟨Δ, hΔ, hbd, Or.inr h.symm⟩ + · exact ⟨Δ, hΔ, hbd, Or.inl h.symm⟩ + +theorem Sided.left (hT : IsClosedSurface T) (h : Sided F Ω₁ Ω₂) : IsSide Ω₁ F := by + obtain ⟨Δ, hΔ, hbd, ⟨rfl, -⟩ | ⟨rfl, -⟩⟩ := h + · exact isSide_int hT hΔ hbd + · exact isSide_out hT hΔ hbd + +theorem Sided.right (hT : IsClosedSurface T) (h : Sided F Ω₁ Ω₂) : IsSide Ω₂ F := + h.symm.left hT + +omit [T2Space T] [ConnectedSpace T] in +theorem Sided.disjoint (h : Sided F Ω₁ Ω₂) : Disjoint Ω₁ Ω₂ := by + obtain ⟨Δ, hΔ, hbd, ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩⟩ := h + · exact disjoint_left.mpr fun x hx hx' ↦ hx' hx.1 + · exact disjoint_left.mpr fun x hx hx' ↦ hx hx'.1 + +omit [T2Space T] [ConnectedSpace T] in +theorem Sided.cover (h : Sided F Ω₁ Ω₂) : F.Uᶜ ⊆ Ω₁ ∪ Ω₂ := by + obtain ⟨Δ, hΔ, hbd, ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩⟩ := h + · intro x hx + by_cases hxΔ : x ∈ Δ + · exact Or.inl ⟨hxΔ, fun hb ↦ hx (hbd ▸ hb)⟩ + · exact Or.inr hxΔ + · intro x hx + by_cases hxΔ : x ∈ Δ + · exact Or.inr ⟨hxΔ, fun hb ↦ hx (hbd ▸ hb)⟩ + · exact Or.inl hxΔ + +theorem Sided.compl_subset (hT : IsClosedSurface T) (h : Sided F Ω₁ Ω₂) : Ω₁ᶜ ⊆ closure Ω₂ := by + intro x hx + by_cases hxU : x ∈ F.U + · exact (h.right hT).U_subset_closure hxU + · exact subset_closure ((h.cover hxU).resolve_left hx) + +theorem isSide_component (hT : IsClosedSurface T) (h : Sided F Ω₁ Ω₂) {y : T} (hy : y ∈ Ω₁) : + connectedComponentIn F.Uᶜ y = Ω₁ := by + have hs := h.left hT + have hsub : Ω₁ ⊆ F.Uᶜ := fun x hx hxU ↦ disjoint_left.mp hs.disjoint_U hx hxU + refine Subset.antisymm ?_ (hs.conn.subset_connectedComponentIn hy hsub) + refine hs.subset isPreconnected_connectedComponentIn + (disjoint_left.mpr fun x hx hxU ↦ connectedComponentIn_subset _ _ hx hxU) + ⟨y, mem_connectedComponentIn (hsub hy), hy⟩ + +theorem Sided.components (hT : IsClosedSurface T) (h : Sided F Ω₁ Ω₂) : + componentsIn F.Uᶜ = {Ω₁, Ω₂} := by + have h₁ := h.left hT + have h₂ := h.right hT + apply Subset.antisymm + · rintro _ ⟨y, hy, rfl⟩ + rcases h.cover hy with hy' | hy' + · exact Or.inl (isSide_component hT h hy') + · exact Or.inr (isSide_component hT h.symm hy') + · rintro _ (rfl | rfl) + · obtain ⟨y, hy⟩ := h₁.nonempty + exact ⟨y, fun hyU ↦ disjoint_left.mp h₁.disjoint_U hy hyU, isSide_component hT h hy⟩ + · obtain ⟨y, hy⟩ := h₂.nonempty + exact ⟨y, fun hyU ↦ disjoint_left.mp h₂.disjoint_U hy hyU, isSide_component hT h.symm hy⟩ + +theorem Sided.isSidesOf (hT : IsClosedSurface T) (h : Sided F Ω₁ Ω₂) : + IsSidesOf F (closure Ω₁) (closure Ω₂) := by + refine ⟨Ω₁, Ω₂, ?_, h.components hT, rfl, rfl⟩ + intro heq + obtain ⟨y, hy⟩ := (h.left hT).nonempty + exact disjoint_left.mp h.disjoint hy (heq ▸ hy) + +/-- The sides of a circuit that bounds a closed disc are the disc and the closure of its +complement. -/ +theorem exists_sided_of_isSidesOf (hT : IsClosedSurface T) {Δ S₁ S₂ : Set T} (hΔ : IsClosedDisc Δ) + (hbd : discBd Δ = F.U) (hs : IsSidesOf F S₁ S₂) : + ∃ Ω₁ Ω₂, Sided F Ω₁ Ω₂ ∧ S₁ = closure Ω₁ ∧ S₂ = closure Ω₂ := by + obtain ⟨C₁, C₂, hne, hset, rfl, rfl⟩ := hs + have h₀ : Sided F (discInt Δ) Δᶜ := ⟨Δ, hΔ, hbd, Or.inl ⟨rfl, rfl⟩⟩ + have hset' : componentsIn F.Uᶜ = {discInt Δ, Δᶜ} := Sided.components hT h₀ + have hC₁ : C₁ ∈ componentsIn F.Uᶜ := by rw [hset]; exact Or.inl rfl + have hC₂ : C₂ ∈ componentsIn F.Uᶜ := by rw [hset]; exact Or.inr rfl + rw [hset'] at hC₁ hC₂ + rcases hC₁ with rfl | rfl + · rcases hC₂ with rfl | rfl + · exact absurd rfl hne + · exact ⟨_, _, h₀, rfl, rfl⟩ + · rcases hC₂ with rfl | rfl + · exact ⟨_, _, h₀.symm, rfl, rfl⟩ + · exact absurd rfl hne + +omit [T2Space T] [ConnectedSpace T] in +theorem IsCircuit.E_nonempty {C : Drawing T} (hC : C.IsCircuit) : C.E.Nonempty := by + obtain ⟨u, W, -, hpos, -, hE⟩ := hC + cases W with + | nil h => simp [GraphWalk.length, GraphWalk.edges] at hpos + | @cons _ x _ e h r => exact ⟨e, by rw [hE]; simp [GraphWalk.edges]⟩ + +end Sided + +section Main + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + [ConnectedSpace Shat] {cap : IsCappedSurface S Shat} {Γ : Painting S} {rad : RadialDrawing cap Γ} + {ord : ℕ} {𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} {F : Drawing Shat} + {Ω₁ Ω₂ : Set Shat} + +omit [T2Space S] [T2Space Shat] [ConnectedSpace Shat] in +theorem part_mono {X Y : Set Shat} (h : X ⊆ Y) : partIn cap Γ X ≤ partIn cap Γ Y := by + refine (le_iff_of_le (Γ.restrict_le _) (Γ.restrict_le _)).2 ⟨?_, ?_⟩ + · exact fun v hv ↦ ⟨hv.1, h hv.2⟩ + · exact fun c hc ↦ ⟨hc.1, fun x hx ↦ h (hc.2.1 hx), fun v hv ↦ h (hc.2.2 hv)⟩ + +/-- The facts about the separation of the two sides of a circuit. -/ +theorem Sided.facts (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (hF : F.IsCircuitOf rad.G) (h : Sided F Ω₁ Ω₂) : + Γ.toHypergraph.IsSeparation (partIn cap Γ (closure Ω₁)) (partIn cap Γ (closure Ω₂)) ∧ + (∀ v ∈ (partIn cap Γ (closure Ω₁) ∩ partIn cap Γ (closure Ω₂)).vertexSet, cap.emb v ∈ F.U) ∧ + F.E.ncard = 2 * Hypergraph.separationOrder (partIn cap Γ (closure Ω₁)) + (partIn cap Γ (closure Ω₂)) ∧ + ∀ e ∈ rad.G.E, rad.Splits (partIn cap Γ (closure Ω₁)) (partIn cap Γ (closure Ω₂)) e ↔ + e ∈ F.E := by + obtain ⟨Δ, hΔ, hbd, ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩⟩ := h + · rw [closure_discInt hΔ] + obtain ⟨h₁, h₂, -, h₄⟩ := disc_facts hS h3 rad hF hΔ hbd + exact ⟨h₁, h₂, disc_order hS h3 rad hF hΔ hbd, fun e he ↦ ⟨h₄ e he, + disc_split hS h3 rad hF hΔ hbd⟩⟩ + · rw [closure_discInt hΔ] + obtain ⟨h₁, h₂, -, h₄⟩ := disc_facts hS h3 rad hF hΔ hbd + refine ⟨h₁.symm, fun v hv ↦ h₂ v ⟨hv.2, hv.1⟩, ?_, fun e he ↦ ⟨fun hs ↦ h₄ e he + (splits_comm.mp hs), fun hm ↦ splits_comm.mp (disc_split hS h3 rad hF hΔ hbd hm)⟩⟩ + rw [disc_order hS h3 rad hF hΔ hbd] + simp only [Hypergraph.separationOrder, GM10.inter_comm] + +/-- Each side of a circuit contains an edge of `Γ`. -/ +theorem Sided.edge_nonempty (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) + (hF : F.IsCircuitOf rad.G) (h : Sided F Ω₁ Ω₂) : + (partIn cap Γ (closure Ω₁)).edgeSet.Nonempty := by + have hT := cap.isClosedSurface + have hlc : LocallyConnectedSpace Shat := IsClosedSurface.locallyConnectedSpace hT + obtain ⟨D, G₃, hD, hrad, hmax, hsub, hhat⟩ := + rad.exists_full hS (h3.hatRegions_isOpenDisc hS cap) h3.1 + have hDE := hD.E_nonempty h3.1 + have hs := h.left hT + obtain ⟨y, hy⟩ := hs.nonempty + obtain ⟨s, hs₁, -, hm⟩ := exists_region_near hT G₃ hs.isOpen (subset_closure hy) + have hsΩ := hs.region_subset (hF.1.trans hsub) hs₁ hm + obtain ⟨f, c, hfc, hfs⟩ := exists_colour hD hrad hmax hDE hs₁ + obtain ⟨x, hx⟩ := hfc.mem.1 + have hxc := mem_image_of_mem cap.emb (hfc.subset hx) + exact ⟨c, restrict_side hfc.1 (side_edge rad hF.1 hs hfc.1 ⟨_, hxc, hsΩ (hfs + (mem_image_of_mem _ hx))⟩)⟩ + +omit [T2Space S] in +/-- A circuit shorter than twice `rep(Γ)` bounds a closed disc. -/ +theorem exists_disc_of_lt_rep (hF : F.IsCircuitOf rad.G) + (hlt : (F.E.ncard : ℕ∞) < 2 * Painting.rep rad) : ∃ Δ, IsClosedDisc Δ ∧ discBd Δ = F.U := by + have hT := cap.isClosedSurface + have hnull : IsNullHomotopicOArc F.U := by + by_contra hn + have hle : Painting.rep rad ≤ ((F.E.ncard / 2 : ℕ) : ℕ∞) := sInf_le ⟨F, hF, hn, rfl⟩ + have h₂ : 2 * Painting.rep rad ≤ 2 * ((F.E.ncard / 2 : ℕ) : ℕ∞) := by gcongr + have h₃ : (2 : ℕ∞) * ((F.E.ncard / 2 : ℕ) : ℕ∞) ≤ (F.E.ncard : ℕ∞) := by + exact_mod_cast Nat.mul_div_le _ _ + exact absurd (lt_of_lt_of_le hlt (h₂.trans h₃)) (lt_irrefl _) + have hbdS : Disjoint F.U (bd Shat) := disjoint_left.mpr fun x _ hx ↦ hx (hT.2.2 x) + obtain ⟨Δ, -, hΔ, hbd⟩ := (epstein Shat univ F.U (Surface.IsClosedSurface.isSurface hT) + inferInstance + (GM14.isOArc_of_isCircuit hF.2) (subset_univ _) hbdS).1 hnull + exact ⟨Δ, hΔ, hbd⟩ + +omit [ConnectedSpace Shat] in +omit [T2Space Shat] in +/-- The contradiction in the proof of (8.7): if the two sides of `F'` could be used to improve +`(A, B)`, then `(A, B)` was not minimal. -/ +theorem uncross_absurd (hS : IsSurface S) (h3 : Γ.IsInternallyThreeConnected) (tb : TieBreaker rad) + (h𝒯 : IsTangle Γ.toHypergraph ord 𝒯) {A B P₁ P₂ Q₁ Q₂ : Hypergraph S (Set S)} + (hAB : (A, B) ∈ 𝒯) (hQ : (Q₁, Q₂) ∈ 𝒯) + (hV : ∀ v ∈ (Q₁ ∩ Q₂).vertexSet, v ∈ (A ∩ B).vertexSet) + (hE : ∀ e ∈ rad.G.E, rad.Splits Q₁ Q₂ e → rad.Splits A B e) {e₀ : Set Shat} + (he₀ : e₀ ∈ rad.G.E) (hs₀ : rad.Splits Q₁ Q₂ e₀) (hsub : Q₁ ≤ A ∨ Q₁ ≤ B) + (hP₁A : P₁ ≤ A) (hBP₂ : B ≤ P₂) (hP₁Q₂ : P₁ ≤ Q₂) (hQ₁P₂ : Q₁ ≤ P₂) + (hmin : ∀ ⦃A' B'⦄, (A', B') ∈ 𝒯 → P₁ ≤ A' → B' ≤ P₂ → + tb.lambdaOrder (A, B) ≤ tb.lambdaOrder (A', B')) : False := by + have hsAB := h𝒯.isSeparation hAB + have hsQ := h𝒯.isSeparation hQ + have hordAB := h𝒯.order_lt hAB + obtain ⟨m₁, m₂, m₃, m₄⟩ := mix_facts hS h3 hsAB hsQ hV hE + have hX : Γ.toHypergraph.IsSeparation (A ∩ Q₂) (B ∪ Q₁) := (hsAB.symm.union_inter hsQ).symm + have hY : Γ.toHypergraph.IsSeparation (A ∪ Q₁) (B ∩ Q₂) := hsAB.union_inter hsQ + have hfin := (A ∩ B).vertexSet_finite + have hXo : Hypergraph.separationOrder (A ∩ Q₂) (B ∪ Q₁) < ord := + lt_of_le_of_lt (ncard_le_ncard m₁ hfin) hordAB + have hYo : Hypergraph.separationOrder (A ∪ Q₁) (B ∩ Q₂) < ord := + lt_of_le_of_lt (ncard_le_ncard m₃ hfin) hordAB + have l₁ := hsAB.left_le + have l₂ := hsAB.right_le + have l₃ := hsQ.left_le + have l₄ := hsQ.right_le + have hXT : (A ∩ Q₂, B ∪ Q₁) ∈ 𝒯 := by + refine (h𝒯.axiom1 hX hXo).resolve_right fun hr ↦ h𝒯.axiom2 hAB hQ hr ?_ + have l₅ := GM10.union_le l₂ l₃ + have l₆ := GM10.union_le l₁ l₃ + exact eq_of_cover hsAB (le_trans (GM10.le_union_left l₁ l₃) (GM10.le_union_left l₆ l₅)) + (le_trans (GM10.le_union_left l₂ l₃) (GM10.le_union_right l₆ l₅)) (GM10.union_le l₆ l₅) + have hYT : (A ∪ Q₁, B ∩ Q₂) ∈ 𝒯 := by + refine (h𝒯.axiom1 hY hYo).resolve_right fun hr ↦ h𝒯.axiom2 hQ hAB hr ?_ + exact cover_three hsAB.symm hsQ + have hPΓ : P₁ ≤ Γ.toHypergraph := le_trans hP₁A l₁ + have cX := hmin hXT + ((le_iff_of_le hPΓ (GM10.inter_le l₁ l₄)).2 + ⟨subset_inter hP₁A.vertexSet_subset hP₁Q₂.vertexSet_subset, + subset_inter hP₁A.edgeSet_subset hP₁Q₂.edgeSet_subset⟩) + (GM10.union_le hBP₂ hQ₁P₂) + have cY := hmin hYT (le_trans hP₁A (GM10.le_union_left l₁ l₃)) + (le_trans (GM10.inter_le_left l₂ l₄) hBP₂) + have hsp₀ := hE e₀ he₀ hs₀ + obtain ⟨q, q', hp, hq, hq'⟩ : ∃ q q', rad.PairOf e₀ q q' ∧ q ∈ Q₁.edgeSet ∧ q' ∈ Q₂.edgeSet := by + obtain ⟨c₁, c₂, hp, h | h⟩ := rad.splits_iff.mp hs₀ + · exact ⟨c₁, c₂, hp, h⟩ + · refine ⟨c₂, c₁, ?_, h.2, h.1⟩ + obtain ⟨v, w, hv, hw, hs, f₁, f₂, hne, a, b, c, d, x, y⟩ := hp + exact ⟨v, w, hv, hw, hs, f₂, f₁, hne.symm, b, a, d, c, y, x⟩ + have hiff := (splits_of_pair hS h3 hp hsAB).mp hsp₀ + have hqΓ : q ∈ Γ.E := l₃.edgeSet_subset hq + have hqn : q ∉ Q₂.edgeSet := fun h ↦ (edge_cases hsQ hqΓ).elim (fun h' ↦ h'.2 h) fun h' ↦ h'.1 hq + rcases hsub with hle | hle + · have hqA : q ∈ A.edgeSet := hle.edgeSet_subset hq + have hqn' : q' ∉ A.edgeSet := fun h ↦ hiff ⟨fun _ ↦ h, fun _ ↦ hqA⟩ + have hns : ¬ rad.Splits (A ∩ Q₂) (B ∪ Q₁) e₀ := fun h ↦ + (splits_of_pair hS h3 hp hX).mp h ⟨fun h' ↦ absurd h'.2 hqn, fun h' ↦ absurd h'.1 hqn'⟩ + exact absurd cX (not_le.mpr (tb.lambda_lt m₁ m₂ he₀ hsp₀ hns)) + · have hqB : q ∈ B.edgeSet := hle.edgeSet_subset hq + have hqn₁ : q ∉ A.edgeSet := fun h ↦ (edge_cases hsAB hqΓ).elim (fun h' ↦ h'.2 hqB) + fun h' ↦ h'.1 h + have hq'A : q' ∈ A.edgeSet := by + by_contra h' + exact hiff ⟨fun h ↦ absurd h hqn₁, fun h ↦ absurd h h'⟩ + have hns : ¬ rad.Splits (A ∪ Q₁) (B ∩ Q₂) e₀ := fun h ↦ + (splits_of_pair hS h3 hp hY).mp h ⟨fun _ ↦ Or.inl hq'A, fun _ ↦ Or.inr hq⟩ + exact absurd cY (not_le.mpr (tb.lambda_lt m₃ m₄ he₀ hsp₀ hns)) + +omit [T2Space S] [T2Space Shat] [ConnectedSpace Shat] in +theorem N1_le_of_lambda_le (tb : TieBreaker rad) {x y : Hypergraph S (Set S) × Hypergraph S (Set S)} + (h : tb.lambdaOrder x ≤ tb.lambdaOrder y) : + tb.N1 x ≤ tb.N1 y ∧ (tb.N1 x = tb.N1 y → tb.N2 x ≤ tb.N2 y) := by + simp only [TieBreaker.lambdaOrder] at h + rw [Prod.Lex.toLex_le_toLex] at h + rcases h with h | ⟨h, h'⟩ + · exact ⟨h.le, fun h'' ↦ absurd h'' h.ne⟩ + · refine ⟨h.le, fun _ ↦ ?_⟩ + rw [Prod.Lex.toLex_le_toLex] at h' + rcases h' with h' | ⟨h', -⟩ + · exact h'.le + · exact h'.le + +/-- **Graph Minors XIX, (8.7).** "**8.7.** *Let $\mathscr{T}$ be a tangle in $\Gamma$, let $F$ be a +circuit of $\Gamma^*$ with $\frac{1}{2} |E(F)| < \min(ord(\mathscr{T}), rep(\Gamma))$, and let +$\Sigma_1, \Sigma_2$ be the closures of the two components of $\hat{\Sigma} \setminus U(F)$, where +$(\Gamma \cap \Sigma_1, \Gamma \cap \Sigma_2) \in \mathscr{T}$. Then there is a $\lambda$-linked +circuit $F'$ in $\Gamma^*$ such that* +• *$|E(F')| \le |E(F)|$ and if equality holds then $\lambda(F') \le \lambda(F)$,* +• *$\Sigma_1 \subseteq \Sigma'_1$ and $\Sigma'_2 \subseteq \Sigma_2$, where $\Sigma'_1, \Sigma'_2$ + are the closures of the two components of $\hat{\Sigma} \setminus U(F')$ and + $(\Gamma \cap \Sigma'_1, \Gamma \cap \Sigma'_2) \in \mathscr{T}$.*" -/ +theorem theorem_8_7_proof (hS : IsSurface S) + (h3 : Γ.IsInternallyThreeConnected) (tb : TieBreaker rad) (h𝒯 : IsTangle Γ.toHypergraph ord 𝒯) + (hF : F.IsCircuitOf rad.G) (hlt : (F.E.ncard : ℕ∞) < 2 * min (ord : ℕ∞) (Painting.rep rad)) + {S₁ S₂ : Set Shat} (hs : IsSidesOf F S₁ S₂) (hm : (partIn cap Γ S₁, partIn cap Γ S₂) ∈ 𝒯) : + ∃ (F' : Drawing Shat) (S₁' S₂' : Set Shat), IsLambdaLinkedCircuit tb ord 𝒯 F' ∧ + IsSidesOf F' S₁' S₂' ∧ + GM18.IsLambdaLinkedTo tb.lambdaOrder 𝒯 (partIn cap Γ S₁') (partIn cap Γ S₂') ∧ + F'.E.ncard ≤ F.E.ncard ∧ (F'.E.ncard = F.E.ncard → tb.weightSub F' ≤ tb.weightSub F) ∧ + S₁ ⊆ S₁' ∧ S₂' ⊆ S₂ := by + classical + have hT := cap.isClosedSurface + have hlord : (F.E.ncard : ℕ∞) < 2 * (ord : ℕ∞) := + lt_of_lt_of_le hlt (by gcongr; exact min_le_left _ _) + have hlrep : (F.E.ncard : ℕ∞) < 2 * Painting.rep rad := + lt_of_lt_of_le hlt (by gcongr; exact min_le_right _ _) + have hlord' : F.E.ncard < 2 * ord := by exact_mod_cast hlord + obtain ⟨Δ, hΔ, hbd⟩ := exists_disc_of_lt_rep hF hlrep + obtain ⟨Ω₁, Ω₂, hsd, rfl, rfl⟩ := exists_sided_of_isSidesOf hT hΔ hbd hs + obtain ⟨hPs, hPm, hPo, hPe⟩ := hsd.facts hS h3 hF + let P₁ := partIn cap Γ (closure Ω₁) + let P₂ := partIn cap Γ (closure Ω₂) + -- Choose `(A, B)` of minimum `λ`-order. + let C : Set (Hypergraph S (Set S) × Hypergraph S (Set S)) := {p | p ∈ 𝒯 ∧ P₁ ≤ p.1 ∧ p.2 ≤ P₂} + have hCfin : C.Finite := finite_of_forall_isSeparation fun p hp ↦ h𝒯.isSeparation hp.1 + have hCne : hCfin.toFinset.Nonempty := + ⟨(P₁, P₂), hCfin.mem_toFinset.2 ⟨hm, le_rfl, le_rfl⟩⟩ + obtain ⟨⟨A, B⟩, hmem, hmin'⟩ := hCfin.toFinset.exists_min_image tb.lambdaOrder hCne + obtain ⟨hABT, hP₁A, hBP₂⟩ := hCfin.mem_toFinset.1 hmem + change P₁ ≤ A at hP₁A + change B ≤ P₂ at hBP₂ + have hmin : ∀ ⦃A' B'⦄, (A', B') ∈ 𝒯 → P₁ ≤ A' → B' ≤ P₂ → + tb.lambdaOrder (A, B) ≤ tb.lambdaOrder (A', B') := fun A' B' h₁ h₂ h₃ ↦ + hmin' (A', B') (hCfin.mem_toFinset.2 ⟨h₁, h₂, h₃⟩) + have hsAB := h𝒯.isSeparation hABT + have hleP := hmin hm le_rfl le_rfl + obtain ⟨hNP, -⟩ := N1_le_of_lambda_le tb hleP + have hP₁ne := hsd.edge_nonempty hS h3 hF + have hA : A.edgeSet.Nonempty := hP₁ne.mono hP₁A.edgeSet_subset + have hB : B.edgeSet.Nonempty := by + by_contra hn + refine left_ne_of_mem h𝒯 hABT (eq_of_all_edges hS h3 rad hsAB.left_le fun c hc ↦ ?_) + rcases edge_cases hsAB hc with ⟨h, -⟩ | ⟨-, h⟩ + · exact h + · exact absurd ⟨c, h⟩ hn + have hordAB : 2 * Hypergraph.separationOrder A B ≤ F.E.ncard := by + have : Hypergraph.separationOrder A B ≤ Hypergraph.separationOrder P₁ P₂ := hNP + rw [hPo] + exact Nat.mul_le_mul_left 2 this + have hrepAB : (Hypergraph.separationOrder A B : ℕ∞) < Painting.rep rad := by + by_contra hn + have h₁ : Painting.rep rad ≤ (Hypergraph.separationOrder A B : ℕ∞) := not_lt.mp hn + have h₂ : 2 * Painting.rep rad ≤ 2 * (Hypergraph.separationOrder A B : ℕ∞) := by gcongr + have h₃ : (2 : ℕ∞) * (Hypergraph.separationOrder A B : ℕ∞) ≤ (F.E.ncard : ℕ∞) := by + exact_mod_cast hordAB + exact absurd (lt_of_lt_of_le hlrep (h₂.trans h₃)) (lt_irrefl _) + obtain ⟨F', Δ', hF', hsplit, hΔ', hbd', hsub, hcount, hmid⟩ := + theorem_8_1' hS h3 rad hsAB hrepAB hA hB + -- Orient the sides of `F'`. + have hordΔ' := disc_order hS h3 rad hF' hΔ' hbd' + obtain ⟨hsep', -, -, -⟩ := disc_facts hS h3 rad hF' hΔ' hbd' + have hordlt : Hypergraph.separationOrder (partIn cap Γ Δ') (partIn cap Γ (closure Δ'ᶜ)) < ord := + by have := h𝒯.order_lt hABT; omega + obtain ⟨Ω₁', Ω₂', hsd', hQT, hor⟩ : ∃ Ω₁' Ω₂', Sided F' Ω₁' Ω₂' ∧ + (partIn cap Γ (closure Ω₁'), partIn cap Γ (closure Ω₂')) ∈ 𝒯 ∧ + ((partIn cap Γ (closure Ω₁') ≤ A ∨ partIn cap Γ (closure Ω₁') ≤ B) ∨ + (partIn cap Γ (closure Ω₂') ≤ A ∨ partIn cap Γ (closure Ω₂') ≤ B)) := by + rcases h𝒯.axiom1 hsep' hordlt with h | h + · refine ⟨discInt Δ', Δ'ᶜ, ⟨Δ', hΔ', hbd', Or.inl ⟨rfl, rfl⟩⟩, ?_, Or.inl ?_⟩ + · rwa [closure_discInt hΔ'] + · rwa [closure_discInt hΔ'] + · refine ⟨Δ'ᶜ, discInt Δ', ⟨Δ', hΔ', hbd', Or.inr ⟨rfl, rfl⟩⟩, ?_, Or.inr ?_⟩ + · rwa [closure_discInt hΔ'] + · rwa [closure_discInt hΔ'] + obtain ⟨hQs, hQm, hQo, hQe⟩ := hsd'.facts hS h3 hF' + let Q₁ := partIn cap Γ (closure Ω₁') + let Q₂ := partIn cap Γ (closure Ω₂') + have hV : ∀ v ∈ (Q₁ ∩ Q₂).vertexSet, v ∈ (A ∩ B).vertexSet := fun v hv ↦ + hmid v (hQm v hv) (hQs.left_le.vertexSet_subset hv.1) + have hE : ∀ e ∈ rad.G.E, rad.Splits Q₁ Q₂ e → rad.Splits A B e := fun e he h ↦ + hsplit e ((hQe e he).mp h) + have hlQ : tb.lambdaOrder (Q₁, Q₂) ≤ tb.lambdaOrder (A, B) := tb.lambda_le hV hE hsAB + obtain ⟨e₀, he₀⟩ := IsCircuit.E_nonempty hF'.2 + have he₀G := hF'.1.2 he₀ + have hs₀ : rad.Splits Q₁ Q₂ e₀ := (hQe e₀ he₀G).mpr he₀ + have hs₁ := hsd.left hT + have hs₂ := hsd.right hT + have hs₁' := hsd'.left hT + have hs₂' := hsd'.right hT + have hordF' : F'.E.ncard = 2 * Hypergraph.separationOrder Q₁ Q₂ := hQo + have hordQ : Hypergraph.separationOrder Q₁ Q₂ < ord := h𝒯.order_lt hQT + have h2 : 2 ≤ ord := by + obtain ⟨c, hc⟩ := IsCircuit.E_nonempty hF.2 + have : 0 < F.E.ncard := (ncard_pos F.finite_edges).mpr ⟨c, hc⟩ + omega + -- The side `Σ₁` is not in `Σ₂'`. + have hnot : ¬ closure Ω₁ ⊆ closure Ω₂' := by + intro hc + have hP₁Q₂ : P₁ ≤ Q₂ := part_mono hc + have hQ₁P₂ : Q₁ ≤ P₂ := by + apply part_mono + refine closure_minimal (fun y hy ↦ hsd.compl_subset hT fun hyΩ ↦ ?_) isClosed_closure + obtain ⟨z, hz₁, hz₂⟩ := mem_closure_iff.mp (hc (subset_closure hyΩ)) _ hs₁'.isOpen hy + exact disjoint_left.mp hsd'.disjoint hz₁ hz₂ + rcases hor with hsub' | hsub' + · exact uncross_absurd hS h3 tb h𝒯 hABT hQT hV hE he₀G hs₀ hsub' hP₁A hBP₂ hP₁Q₂ hQ₁P₂ hmin + · obtain ⟨c, hc'⟩ := hP₁ne + have hcA : c ∈ A.edgeSet := hP₁A.edgeSet_subset hc' + have hcQ : c ∈ Q₂.edgeSet := hP₁Q₂.edgeSet_subset hc' + have hcΓ : c ∈ Γ.E := hsAB.left_le.edgeSet_subset hcA + rcases hsub' with hle | hle + · have hT' : (Q₂, Q₁) ∈ 𝒯 := GraphMinor.GM10.theorem_2_9_proof h𝒯 hABT hQs.symm + (by simp only [Hypergraph.separationOrder, GM10.inter_comm] at hordQ ⊢; exact hordQ) + (Or.inr (Or.inr ⟨h2, hle.edgeSet_subset⟩)) + refine h𝒯.axiom2 hQT hT' hQT ?_ + have l₁ := hQs.left_le + have l₂ := hQs.right_le + have l₃ := GM10.union_le l₁ l₂ + exact eq_of_cover hQs (le_trans (GM10.le_union_left l₁ l₂) (GM10.le_union_left l₃ l₁)) + (le_trans (GM10.le_union_right l₁ l₂) (GM10.le_union_left l₃ l₁)) (GM10.union_le l₃ l₁) + · exact (edge_cases hsAB hcΓ).elim (fun h ↦ h.2 (hle.edgeSet_subset hcQ)) fun h ↦ h.1 hcA + -- No edge of `F'` meets the inside of `Σ₁`. + have hedge : ∀ e ∈ F'.E, e ⊆ Ω₁ᶜ := by + intro e he + by_contra hn + obtain ⟨y, hy, hyn⟩ := not_subset.mp hn + have hyΩ : y ∈ Ω₁ := not_not.mp hyn + have heG := hF'.1.2 he + have heF : e ∉ F.E := fun h ↦ disjoint_left.mp hs₁.disjoint_U hyΩ + (F.closure_subset_U h (subset_closure hy)) + have hd := edge_disjoint_U hF.1 heG heF + have heΩ : e ⊆ Ω₁ := hs₁.subset heG.2.2.1.isConnected.isPreconnected hd ⟨y, hy, hyΩ⟩ + obtain ⟨c₁, c₂, hp, hcase⟩ := rad.splits_iff.mp (hsplit e he) + obtain ⟨hc₁, hc₂⟩ := pair_in_side hS h3 rad hF.1 hs₁ heG hp heΩ + have hΓ₁ : c₁ ∈ Γ.E := by + obtain ⟨_, _, _, _, _, _, _, _, h₁, _⟩ := hp + exact h₁.1 + have hΓ₂ : c₂ ∈ Γ.E := by + obtain ⟨_, _, _, _, _, _, _, _, _, h₂, _⟩ := hp + exact h₂.1 + have m₁ : c₁ ∈ A.edgeSet := hP₁A.edgeSet_subset (restrict_side hΓ₁ hc₁) + have m₂ : c₂ ∈ A.edgeSet := hP₁A.edgeSet_subset (restrict_side hΓ₂ hc₂) + rcases hcase with h | h + · exact (edge_cases hsAB hΓ₂).elim (fun h' ↦ h'.2 h.2) fun h' ↦ h'.1 m₂ + · exact (edge_cases hsAB hΓ₁).elim (fun h' ↦ h'.2 h.1) fun h' ↦ h'.1 m₁ + have hUd : Disjoint Ω₁ F'.U := by + have := U_of_edges hF'.2 hs₁.isOpen.isClosed_compl hedge + exact disjoint_left.mpr fun x hx hxU ↦ this hxU hx + have hΩsub : Ω₁ ⊆ Ω₁' := by + rcases hs₁.conn.subset_or_subset hs₁'.isOpen hs₂'.isOpen hsd'.disjoint + (fun x hx ↦ hsd'.cover (disjoint_left.mp hUd hx)) with h | h + · exact h + · exact absurd (closure_mono h) hnot + have hS₁ : closure Ω₁ ⊆ closure Ω₁' := closure_mono hΩsub + have hS₂ : closure Ω₂' ⊆ closure Ω₂ := by + refine closure_minimal (fun y hy ↦ hsd.compl_subset hT fun hyΩ ↦ ?_) isClosed_closure + exact disjoint_left.mp hsd'.disjoint (hΩsub hyΩ) hy + have hP₁Q₁ : P₁ ≤ Q₁ := part_mono hS₁ + have hQ₂P₂ : Q₂ ≤ P₂ := part_mono hS₂ + have hlinked : GM18.IsLambdaLinkedTo tb.lambdaOrder 𝒯 Q₁ Q₂ := + ⟨hQT, fun A' B' hT' h₁ h₂ ↦ hlQ.trans (hmin hT' (le_trans hP₁Q₁ h₁) (le_trans h₂ hQ₂P₂))⟩ + have hcmp := N1_le_of_lambda_le tb (hlQ.trans hleP) + have hN : Hypergraph.separationOrder Q₁ Q₂ ≤ Hypergraph.separationOrder P₁ P₂ := hcmp.1 + have hordF : F.E.ncard = 2 * Hypergraph.separationOrder P₁ P₂ := hPo + have hcard : F'.E.ncard ≤ F.E.ncard := by omega + have hN2 : ∀ {K : Drawing Shat} {X Y : Hypergraph S (Set S)}, + (∀ e ∈ rad.G.E, rad.Splits X Y e ↔ e ∈ K.E) → K.E ⊆ rad.G.E → + tb.N2 (X, Y) = tb.weightSub K := by + intro K X Y hiff hsub' + have : {e ∈ rad.G.E | rad.Splits X Y e} = K.E := + Subset.antisymm (fun e he ↦ (hiff e he.1).mp he.2) fun e he ↦ ⟨hsub' he, (hiff _ + (hsub' he)).mpr he⟩ + simp only [TieBreaker.N2, TieBreaker.weightSub] + rw [this] + refine ⟨F', closure Ω₁', closure Ω₂', ⟨hF', ?_, _, _, hsd'.isSidesOf hT, hlinked⟩, + hsd'.isSidesOf hT, hlinked, hcard, fun heq ↦ ?_, hS₁, hS₂⟩ + · exact lt_of_le_of_lt (by exact_mod_cast hcard) hlt + · have := hcmp.2 (by simp only [TieBreaker.N1]; omega) + rwa [hN2 hQe hF'.1.2, hN2 hPe hF.1.2] at this + +end Main + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section9a.lean b/LeanPool/GraphMinor/GM19/Section9a.lean new file mode 100644 index 0000000000..5ffc31cba1 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section9a.lean @@ -0,0 +1,110 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Defs3 +public import LeanPool.GraphMinor.GM19.RadialExists + +/-! +# Graph Minors XIX, (9.1) +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface + +universe u w + +variable {S : Type u} [TopologicalSpace S] {α : Type w} + +/-- A border edge of a painting that fits a frame lies in a side. -/ +theorem Painting.Fits.exists_side {Γ : Painting S} {Φ : Frame S} (hf : Γ.Fits Φ) {e : Set S} + (he : e ∈ Γ.E) (hb : Painting.IsBorder e) : ∃ s ∈ Φ.sides, e ⊆ s := by + have hsub : e ⊆ bd S \ Φ.V := fun x hx ↦ + ⟨(Γ.border_edge e he hb).2 hx, fun hV ↦ (he.2.1 hx).2 (hf.V_subset hV)⟩ + obtain ⟨t, ht, het⟩ := exists_arcComp_superset he.2.2.1 hsub + exact ⟨t, ht, het⟩ + +theorem side_unique {Φ : Frame S} {e s t : Set S} (hne : e.Nonempty) (hs : s ∈ Φ.sides) + (ht : t ∈ Φ.sides) (hes : e ⊆ s) (het : e ⊆ t) : s = t := by + obtain ⟨x, hx⟩ := hne + exact arcComp_eq_of_mem hs ht (hes hx) (het hx) + +/-- The kind of an edge of a coloured painting. -/ +theorem ColouredPainting.cases {χ : ColourScheme S α} (P : ColouredPainting χ) {e : Set S} + (he : e ∈ P.Γ.E) : + (Painting.IsInternal e ∧ (tilde e).ncard = 2 ∧ P.φ e ∈ χ.Ω2.E) ∨ + (Painting.IsInternal e ∧ (tilde e).ncard = 3 ∧ P.φ e ∈ χ.Ω3.E) ∨ + (Painting.IsBorder e ∧ ∃ s ∈ χ.Φ.sides, e ⊆ s ∧ P.φ e ∈ (χ.ΩS s).E) := by + by_cases hb : Painting.IsBorder e + · obtain ⟨s, hs, hes⟩ := P.fits.exists_side he hb + exact Or.inr (Or.inr ⟨hb, s, hs, hes, P.border_mem e he s hs ⟨hb, hes⟩⟩) + · have hi : Painting.IsInternal e := by + rw [Painting.IsInternal, disjoint_iff_inter_eq_empty] + exact not_nonempty_iff_eq_empty.1 hb + rcases P.Γ.size_cases he with h | h + · exact Or.inl ⟨hi, h, P.internal_2_mem e he hi h⟩ + · exact Or.inr (Or.inl ⟨hi, h, P.internal_3_mem e he hi h⟩) + +/-- **Graph Minors XIX, (9.1).** "Let $(\Gamma, \phi), (\Gamma', \phi')$ be $\chi$-coloured +paintings, where $\chi$ is +disjoint. Let $\sigma$ be an inflation of $\Gamma$ in $\Gamma'$, such that $\phi(e) \le +\phi'(\sigma(e))$ (in $\Omega_{\chi}$) for every $e \in E(\Gamma)$. Then $\sigma$ is an +inflation of $(\Gamma, \phi)$ in $(\Gamma', \phi')$." -/ +theorem theorem_9_1_proof {χ : ColourScheme S α} (hd : χ.IsDisjoint) (P P' : ColouredPainting χ) + {σv : S → Set S} {σe : Set S → Set S} (hσ : IsInflation P.Γ P'.Γ σv σe) + (hle : ∀ e ∈ P.Γ.E, (χ.unionWQO hd).le (P.φ e) (P'.φ (σe e))) : + IsColouredInflation χ P P' σv σe := by + have h23 := disjoint_left.1 hd.disj_2_3 + have h2S := fun s hs ↦ disjoint_left.1 (hd.disj_2_S s hs) + have h3S := fun s hs ↦ disjoint_left.1 (hd.disj_3_S s hs) + have hSS := fun s hs t ht hne ↦ disjoint_left.1 (hd.disj_S_S s hs t ht hne) + have hsideeq : ∀ {x s t}, s ∈ χ.Φ.sides → t ∈ χ.Φ.sides → x ∈ (χ.ΩS s).E → x ∈ (χ.ΩS t).E → + s = t := fun {x s t} hs ht h₁ h₂ ↦ by + by_contra hne + exact hSS s hs t ht hne h₁ h₂ + have hle2 : ∀ {x y}, x ∈ χ.Ω2.E → (χ.unionWQO hd).le x y → χ.Ω2.le x y := by + rintro x y hx (⟨-, -, h⟩ | ⟨h, -, -⟩ | ⟨s, hs, h, -, -⟩) + · exact h + · exact absurd h (h23 hx) + · exact absurd h (h2S s hs hx) + have hle3 : ∀ {x y}, x ∈ χ.Ω3.E → (χ.unionWQO hd).le x y → χ.Ω3.le x y := by + rintro x y hx (⟨h, -, -⟩ | ⟨-, -, h⟩ | ⟨s, hs, h, -, -⟩) + · exact absurd hx (h23 h) + · exact h + · exact absurd h (h3S s hs hx) + have hleS : ∀ {x y s}, s ∈ χ.Φ.sides → x ∈ (χ.ΩS s).E → (χ.unionWQO hd).le x y → + y ∈ (χ.ΩS s).E ∧ (χ.ΩS s).le x y := by + rintro x y s hs hx (⟨h, -, -⟩ | ⟨h, -, -⟩ | ⟨t, ht, h₁, h₂, h₃⟩) + · exact absurd hx (h2S s hs h) + · exact absurd hx (h3S s hs h) + · obtain rfl := hsideeq hs ht hx h₁ + exact ⟨h₂, h₃⟩ + refine ⟨hσ, ?_, ?_, ?_, ?_⟩ + · intro e he hb + obtain ⟨s, hs, hes⟩ := P.fits.exists_side he hb + have hx := P.border_mem e he s hs ⟨hb, hes⟩ + have hy := (hleS hs hx (hle e he)).1 + have hne : (σe e).Nonempty := (hσ.edge_mem e he).1 + rcases P'.cases (hσ.edge_mem e he) with ⟨-, -, h⟩ | ⟨-, -, h⟩ | ⟨hb', t, ht, hzt, hyt⟩ + · exact absurd hy (h2S s hs h) + · exact absurd hy (h3S s hs h) + · obtain rfl := hsideeq hs ht hy hyt + refine ⟨hb', fun t ht' ↦ ⟨fun het ↦ ?_, fun hzt' ↦ ?_⟩⟩ + · rw [← side_unique he.1 hs ht' hes het] + exact hzt + · rw [← side_unique hne hs ht' hzt hzt'] + exact hes + · exact fun e he hi h2 ↦ hle2 (P.internal_2_mem e he hi h2) (hle e he) + · exact fun e he hi h3 ↦ hle3 (P.internal_3_mem e he hi h3) (hle e he) + · exact fun e he s hs hb ↦ (hleS hs (P.border_mem e he s hs hb) (hle e he)).2 + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section9b.lean b/LeanPool/GraphMinor/GM19/Section9b.lean new file mode 100644 index 0000000000..a1717feffe --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section9b.lean @@ -0,0 +1,231 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.PaintingPatchwork +public import LeanPool.GraphMinor.GM18.Section6Part2 + +/-! +# Rooted locations of paintings as rooted locations of patchworks + +The arms of a rooted location of a painting are rooted hypergraphs, and the rooted location is one +in the sense of Graph Minors XVIII. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface +open GraphMinor.GM04 (Patchwork freePatch IsGrouping IsComponent) + +universe u w + +variable {S : Type u} [TopologicalSpace S] {α : Type w} + +namespace Arm + +variable {Γ : Painting S} (A : Arm Γ) + +theorem mem_π {v : S} : v ∈ A.π ↔ v ∈ A.minus.vertexSet ∧ v ∈ A.compl.vertexSet := by + have h : v ∈ {v | v ∈ A.π} ↔ v ∈ (A.minus ∩ A.compl).vertexSet := by rw [A.π_set] + exact h + +theorem mem_or {v : S} (hv : v ∈ Γ.V) : v ∈ A.minus.vertexSet ∨ v ∈ A.compl.vertexSet := by + have h : v ∈ (A.minus ∪ A.compl).vertexSet := by + rw [A.isSeparation.union_eq] + exact hv + exact h + +theorem edge_or {e : Set S} (he : e ∈ Γ.E) : e ∈ A.minus.edgeSet ∨ e ∈ A.compl.edgeSet := by + have h : e ∈ (A.minus ∪ A.compl).edgeSet := by + rw [A.isSeparation.union_eq] + exact he + exact h + +theorem edge_not {e : Set S} (h₁ : e ∈ A.minus.edgeSet) (h₂ : e ∈ A.compl.edgeSet) : False := by + have h : e ∈ (A.minus ∩ A.compl).edgeSet := ⟨h₁, h₂⟩ + rw [A.isSeparation.edgeSet_inter_eq] at h + exact h + +theorem edge_mem {e : Set S} (h : e ∈ A.minus.edgeSet) : e ∈ Γ.E := + A.isSeparation.left_le.edgeSet_subset h + +theorem compl_edge_mem {e : Set S} (h : e ∈ A.compl.edgeSet) : e ∈ Γ.E := + A.isSeparation.right_le.edgeSet_subset h + +theorem minus_ends {e : Set S} (h : e ∈ A.minus.edgeSet) : A.minus.ends e = tilde e := + (A.isSeparation.left_le.ends_eq e h).symm.trans (Γ.ends_eq (A.edge_mem h)) + +theorem compl_ends {e : Set S} (h : e ∈ A.compl.edgeSet) : A.compl.ends e = tilde e := + (A.isSeparation.right_le.ends_eq e h).symm.trans (Γ.ends_eq (A.compl_edge_mem h)) + +theorem minus_end {e : Set S} (h : e ∈ A.minus.edgeSet) {v : S} (hv : v ∈ tilde e) : + v ∈ A.minus.vertexSet := + A.minus.vertex_mem_of_inc (e := e) (by + have : v ∈ A.minus.ends e := by rw [A.minus_ends h]; exact hv + exact this) + +theorem compl_end {e : Set S} (h : e ∈ A.compl.edgeSet) {v : S} (hv : v ∈ tilde e) : + v ∈ A.compl.vertexSet := + A.compl.vertex_mem_of_inc (e := e) (by + have : v ∈ A.compl.ends e := by rw [A.compl_ends h]; exact hv + exact this) + +theorem compl_eq : A.compl = + GM18.complementHypergraph Γ.toHypergraph.toRooted A.toRootedHypergraph := by + apply Hypergraph.ext + · ext v + constructor + · intro hv + have hvG : v ∈ Γ.V := A.isSeparation.right_le.vertexSet_subset hv + by_cases hm : v ∈ A.minus.vertexSet + · exact Or.inr ⟨hvG, A.mem_π.2 ⟨hm, hv⟩⟩ + · exact Or.inl ⟨hvG, hm⟩ + · rintro (⟨hv, hn⟩ | ⟨-, hr⟩) + · exact (A.mem_or hv).resolve_left hn + · exact (A.mem_π.1 hr).2 + · ext e + constructor + · exact fun he ↦ ⟨A.compl_edge_mem he, fun h ↦ A.edge_not h he⟩ + · exact fun he ↦ (A.edge_or he.1).resolve_left he.2 + · funext e v + apply propext + constructor + · intro h + have he : e ∈ A.compl.edgeSet := A.compl.edge_mem_of_inc h + have hv : v ∈ A.compl.ends e := h + rw [A.compl_ends he] at hv + have heG := A.compl_edge_mem he + have hvG := Γ.tilde_subset_V heG hv + have hvc := A.compl_end he hv + refine ⟨⟨heG, fun h' ↦ A.edge_not h' he⟩, ⟨heG, hvG, hv⟩, ?_⟩ + by_cases hm : v ∈ A.minus.vertexSet + · exact Or.inr ⟨hvG, A.mem_π.2 ⟨hm, hvc⟩⟩ + · exact Or.inl ⟨hvG, hm⟩ + · rintro ⟨⟨heG, heA⟩, ⟨-, -, hv⟩, -⟩ + have he : e ∈ A.compl.edgeSet := (A.edge_or heG).resolve_left heA + have : v ∈ A.compl.ends e := by rw [A.compl_ends he]; exact hv + exact this + +theorem isComplemented : + GM18.IsComplemented Γ.toHypergraph.toRooted A.toRootedHypergraph where + le := A.isSeparation.left_le + roots_mem _ _ h := absurd h List.not_mem_nil + inc_diff_mem v e hv he hinc := by + have hc : e ∈ A.compl.edgeSet := (A.edge_or he.1).resolve_left he.2 + exact A.mem_π.2 ⟨hv, A.compl_end hc hinc.2.2⟩ + +theorem toRooted_injective {A B : Arm Γ} + (h : A.toRootedHypergraph = B.toRootedHypergraph) : A = B := by + have hm : A.minus = B.minus := congrArg RootedHypergraph.toHypergraph h + have hπ : A.π = B.π := congrArg RootedHypergraph.roots h + have hc : A.compl = B.compl := by rw [A.compl_eq, B.compl_eq, h] + obtain ⟨m, c, s, p, n, ps⟩ := A + obtain ⟨m', c', s', p', n', ps'⟩ := B + simp only at hm hπ hc + subst hm hπ hc + rfl + +end Arm + +namespace RootedLocation + +variable {Γ : Painting S} (L : RootedLocation Γ) + +/-- The rooted hypergraphs of a rooted location. -/ +def rooted : Set (RootedHypergraph S (Set S)) := Arm.toRootedHypergraph '' L.arms + +theorem location_eq : + GM18.rootedLocationToLocation Γ.toHypergraph.toRooted L.rooted = L.seps := by + ext p + constructor + · rintro ⟨_, ⟨A, hA, rfl⟩, rfl⟩ + refine ⟨A, hA, ?_⟩ + simp only [Arm.sep, A.compl_eq] + rfl + · rintro ⟨A, hA, rfl⟩ + refine ⟨_, ⟨A, hA, rfl⟩, ?_⟩ + simp only [Arm.sep, A.compl_eq] + rfl + +theorem isRootedLocation : GM18.IsRootedLocation Γ.toHypergraph.toRooted L.rooted where + isComplemented := by + rintro _ ⟨A, -, rfl⟩ + exact A.isComplemented + le_complement := by + rintro _ ⟨A₁, hA₁, rfl⟩ _ ⟨A₂, hA₂, rfl⟩ hne + rw [← GM18.complementHypergraph_eq_of_isComplemented, ← A₂.compl_eq] + exact L.disjoint_arms A₁ hA₁ A₂ hA₂ fun h ↦ hne (h ▸ rfl) + +theorem isLocation : GM10.IsLocation Γ.toHypergraph L.seps where + isSeparation := by + rintro _ ⟨A, -, rfl⟩ + exact A.isSeparation + left_le_right := by + rintro _ ⟨A₁, hA₁, rfl⟩ _ ⟨A₂, hA₂, rfl⟩ hne + exact L.disjoint_arms A₁ hA₁ A₂ hA₂ fun h ↦ hne (h ▸ rfl) + +theorem core_eq : GM18.rootedLocationCore Γ.toHypergraph.toRooted L.rooted = L.M := by + unfold GM18.rootedLocationCore + rw [L.location_eq] + have hall : ∀ {x : Hypergraph S (Set S) × Hypergraph S (Set S) → Prop}, + (∀ p ∈ L.seps, x p) ↔ ∀ A ∈ L.arms, x A.sep := by + intro x + exact ⟨fun h A hA ↦ h _ ⟨A, hA, rfl⟩, fun h _ ⟨A, hA, e⟩ ↦ e ▸ h A hA⟩ + apply Hypergraph.ext + · ext v + exact and_congr_right fun _ ↦ hall + · ext e + exact and_congr_right fun _ ↦ hall + · funext e v + apply propext + constructor + · rintro ⟨h₁, -, h₃⟩ + exact ⟨⟨h₁.1, hall.1 h₃⟩, h₁.2⟩ + · rintro ⟨⟨h₁, h₂⟩, h₃, h₄⟩ + exact ⟨⟨h₁, h₃, h₄⟩, hall.2 fun A hA ↦ A.compl_end (h₂ A hA) h₄, hall.2 h₂⟩ + +variable {L} + +theorem mem_M_V {v : S} : v ∈ L.M.vertexSet ↔ v ∈ Γ.V ∧ ∀ A ∈ L.arms, v ∈ A.compl.vertexSet := + Iff.rfl + +theorem mem_M_E {e : Set S} : e ∈ L.M.edgeSet ↔ e ∈ Γ.E ∧ ∀ A ∈ L.arms, e ∈ A.compl.edgeSet := + Iff.rfl + +theorem π_mem_M {A : Arm Γ} (hA : A ∈ L.arms) {v : S} (hv : v ∈ A.π) : v ∈ L.M.vertexSet := by + have h := A.mem_π.1 hv + refine ⟨A.isSeparation.left_le.vertexSet_subset h.1, fun B hB ↦ ?_⟩ + by_cases hAB : A = B + · exact hAB ▸ h.2 + · exact (L.disjoint_arms A hA B hB hAB).vertexSet_subset h.1 + +theorem tilde_mem_M {e : Set S} (he : e ∈ L.M.edgeSet) {v : S} (hv : v ∈ tilde e) : + v ∈ L.M.vertexSet := + ⟨Γ.tilde_subset_V he.1 hv, fun A hA ↦ A.compl_end (he.2 A hA) hv⟩ + +theorem exists_arm_of_notMem {e : Set S} (he : e ∈ Γ.E) (hn : e ∉ L.M.edgeSet) : + ∃ A ∈ L.arms, e ∈ A.minus.edgeSet := by + by_contra hno + refine hn ⟨he, fun A hA ↦ (A.edge_or he).resolve_left fun h ↦ hno ⟨A, hA, h⟩⟩ + +theorem mem_π_of_M {A : Arm Γ} (hA : A ∈ L.arms) {v : S} (hM : v ∈ L.M.vertexSet) + (hv : v ∈ A.minus.vertexSet) : v ∈ A.π := + A.mem_π.2 ⟨hv, hM.2 A hA⟩ + +/-- An edge of `A⁻` at a vertex of `A` outside `πBar(A)` lies only in `A⁻`. -/ +theorem eq_of_edge {A B : Arm Γ} (hA : A ∈ L.arms) (hB : B ∈ L.arms) {e : Set S} + (heA : e ∈ A.minus.edgeSet) (heB : e ∈ B.minus.edgeSet) : A = B := by + by_contra hne + exact B.edge_not heB ((L.disjoint_arms A hA B hB hne).edgeSet_subset heA) + +end RootedLocation + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section9c.lean b/LeanPool/GraphMinor/GM19/Section9c.lean new file mode 100644 index 0000000000..a28770e504 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section9c.lean @@ -0,0 +1,565 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section9b + +/-! +# An outline gives a simulation of hearts + +The inflation in an outline may use edges inside the arms of the larger painting that the outline +misses. These become groupings of the new edges of those arms. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface +open GraphMinor.GM04 (Patchwork freePatch IsGrouping IsComponent) +open GraphMinor.GM18 (ConnectedIn connectedIn_iff connectedIn_of_adj) + +universe u w + +variable {S : Type u} [TopologicalSpace S] {α : Type w} + +/-- The grouping on `U` in which two vertices are adjacent if they are related both ways. -/ +def rGroup (U : Set S) (r : S → S → Prop) : (⊤ : SimpleGraph S).Subgraph where + verts := U + Adj x y := x ∈ U ∧ y ∈ U ∧ x ≠ y ∧ r x y ∧ r y x + adj_sub h := h.2.2.1 + edge_vert h := h.1 + symm := ⟨fun _ _ h ↦ ⟨h.2.1, h.1, h.2.2.1.symm, h.2.2.2.2, h.2.2.2.1⟩⟩ + +omit [TopologicalSpace S] in +theorem rGroup_isGrouping {U : Set S} {r : S → S → Prop} + (ht : ∀ a b c, r a b → r b c → r a c) : IsGrouping U (rGroup U r) := + GM04.isGrouping_iff.mpr ⟨Subset.rfl, fun _ _ _ hac hab hbc ↦ + ⟨hab.1, hbc.2.1, hac, ht _ _ _ hab.2.2.2.1 hbc.2.2.2.1, ht _ _ _ hbc.2.2.2.2 hab.2.2.2.2⟩⟩ + +omit [TopologicalSpace S] in +/-- Induction along connectivity in a subgraph. -/ +theorem connectedIn_induct {H : (⊤ : SimpleGraph S).Subgraph} {T : S → S → Prop} + (hrefl : ∀ a, T a a) (htrans : ∀ a b c, T a b → T b c → T a c) + (hadj : ∀ a b, H.Adj a b → T a b) {x y : S} (h : ConnectedIn H x y) : T x y := by + obtain ⟨hx, hy, ⟨w⟩⟩ := connectedIn_iff.1 h + have key : ∀ (a b : H.verts) (w : H.coe.Walk a b), T a b := by + intro a b w + induction w with + | nil => exact hrefl _ + | cons hac _ ih => exact htrans _ _ _ (hadj _ _ hac) ih + exact key _ _ w + +namespace Arm + +variable {Γ : Painting S} (A : Arm Γ) (r : S → S → Prop) + +/-- The realization of `A⁻` grouping the ends of each edge by `r`. -/ +def real : (⊤ : SimpleGraph S).Subgraph := + GM04.realizationOf A.minus fun f ↦ rGroup (tilde f) r + +theorem real_verts : (A.real r).verts = A.minus.vertexSet := + GM04.realizationOf_verts fun _ he ↦ (A.minus_ends he).symm + +theorem real_adj {x y : S} : (A.real r).Adj x y ↔ + ∃ f ∈ A.minus.edgeSet, (rGroup (tilde f) r).Adj x y := + GM04.realizationOf_adj + +/-- The grouping on `πBar(A)` by connectivity in `A.real r`. -/ +def group : (⊤ : SimpleGraph S).Subgraph := rGroup {v | v ∈ A.π} (ConnectedIn (A.real r)) + +variable {χ : ColourScheme S α} + +theorem group_feasible {hd : χ.IsDisjoint} {P : ColouredPainting χ} (A : Arm P.Γ) + (r : S → S → Prop) (ht : ∀ a b c, r a b → r b c → r a c) : + GM18.IsFeasibleGrouping + ((GM18.toPartialPatchwork (P.toPatchwork hd)).restrict A.toRootedHypergraph) + (A.group r) := by + classical + refine ⟨rGroup_isGrouping fun _ _ _ ↦ GM18.ConnectedIn.trans, rfl, A.real r, ?_, ?_⟩ + · refine ⟨fun f ↦ rGroup (tilde f) r, fun e he ↦ ?_, rfl⟩ + have heG : e ∈ P.Γ.E := A.edge_mem he + have hends : A.minus.ends e = tilde e := A.minus_ends he + change rGroup (tilde e) r ∈ (if _ then _ else _ : GM04.Patch S) + have hg : IsGrouping (tilde e) (rGroup (tilde e) r) := rGroup_isGrouping ht + split_ifs with h + · change _ ∈ freePatch _ + rw [P.Γ.ends_eq heG] + exact ⟨hg, rfl⟩ + · change _ ∈ freePatch _ + change rGroup (tilde e) r ∈ freePatch (A.minus.ends e) + rw [hends] + exact ⟨hg, rfl⟩ + · intro x hx y hy hne + refine ⟨fun h ↦ ⟨hx, hy, hne, h, h.symm⟩, fun h ↦ h.2.2.2.1⟩ + +end Arm + +variable {χ : ColourScheme S α} + +/-- `Q` is a completion of the heart of the `χ`-place `X`, with new edges `new`. -/ +structure IsCompletedHeart (hd : χ.IsDisjoint) (X : Place χ) {Ω' : Type*} [Preorder Ω'] + (ι : ColourScheme.Colour hd ↪o Ω') (new : RootedHypergraph S (Set S) → Set S) + (Q : Patchwork Ω' S (Set S)) : Prop where + V_eq : Q.G.vertexSet = X.L.M.vertexSet + E_eq : Q.G.edgeSet = X.L.M.edgeSet ∪ new '' X.L.rooted + inj : InjOn new X.L.rooted + fresh : ∀ A ∈ X.L.rooted, new A ∉ X.L.M.edgeSet + roots : Q.G.roots = [] + ends_core : ∀ f ∈ X.L.M.edgeSet, Q.G.ends f = tilde f + dom_eq : Q.dom = Q.G.edgeSet + μ_core : ∀ f ∈ X.L.M.edgeSet, Q.μ f = X.P.Γ.γ f + μ_new : ∀ A ∈ X.L.rooted, Q.μ (new A) = A.roots + Δ_core : ∀ f ∈ X.L.M.edgeSet, Q.Δ f = freePatch (tilde f) + Δ_new : ∀ A ∈ X.L.rooted, Q.Δ (new A) = + GM18.feasibleGroupings ((GM18.toPartialPatchwork (X.P.toPatchwork hd)).restrict A) + φ_core : ∀ f ∈ X.L.M.edgeSet, Q.φ f = ι (X.P.colour hd f) + +/-- A completion of a heart of a place has the form recorded by `IsCompletedHeart`. -/ +theorem isCompletedHeart_of (hd : χ.IsDisjoint) {X : Place χ} {Ω' : Type*} [Preorder Ω'] + {ι : ColourScheme.Colour hd ↪o Ω'} {new : RootedHypergraph S (Set S) → Set S} + {H : GM18.PartialPatchwork (ColourScheme.Colour hd) S (Set S)} {Q : Patchwork Ω' S (Set S)} + (hh : GM18.IsPlaceHeart (GM18.toPartialPatchwork (X.P.toPatchwork hd)) X.L.rooted new H) + (hc : GM18.IsCompletion ι H Q) : IsCompletedHeart hd X ι new Q := by + have hcore : GM18.rootedLocationCore (GM18.toPartialPatchwork (X.P.toPatchwork hd)).G + X.L.rooted = X.L.M := X.L.core_eq + have hV := hh.vertexSet_eq + have hE := hh.edgeSet_eq + have hdom := hh.dom_eq + rw [hcore] at hV hE hdom + have hdomG : (GM18.toPartialPatchwork (X.P.toPatchwork hd)).dom = X.P.Γ.E := rfl + have hEdge : X.L.M.edgeSet ⊆ X.P.Γ.E := fun _ he => he.1 + rw [hdomG, inter_eq_left.mpr hEdge] at hdom + have hmem : ∀ {f}, f ∈ X.L.M.edgeSet → + f ∈ (GM18.rootedLocationCore (GM18.toPartialPatchwork (X.P.toPatchwork hd)).G + X.L.rooted).edgeSet := fun {f} hf ↦ by rw [hcore]; exact hf + have hHG : ∀ {f}, f ∈ X.L.M.edgeSet → f ∈ H.G.edgeSet := fun {f} hf ↦ by + rw [hE]; exact Or.inl hf + have hHN : ∀ {A}, A ∈ X.L.rooted → new A ∈ H.G.edgeSet := fun {A} hA ↦ by + rw [hE]; exact Or.inr ⟨A, hA, rfl⟩ + refine ⟨?_, ?_, hh.injOn_newEdge, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [hc.G_eq, hV] + · rw [hc.G_eq, hE] + · intro A hA h + exact hh.newEdge_notMem_core hA (hmem h) + · rw [hc.G_eq, hh.roots_eq] + rfl + · intro f hf + rw [hc.G_eq, hh.ends_core (hmem hf)] + exact X.P.Γ.ends_eq hf.1 + · rw [hc.dom_eq, hc.G_eq, hdom, hE] + · intro f hf + rw [hc.μ_eq (by rw [hdom]; exact Or.inl hf), hh.μ_core ⟨hmem hf, hf.1⟩] + rfl + · intro A hA + rw [hc.μ_eq (by rw [hdom]; exact Or.inr ⟨A, hA, rfl⟩), hh.μ_newEdge hA] + · intro f hf + rw [hc.Δ_eq (hHG hf), hh.Δ_core (hmem hf)] + change freePatch (X.P.Γ.toHypergraph.ends f) = _ + rw [X.P.Γ.ends_eq hf.1] + · intro A hA + rw [hc.Δ_eq (hHN hA), hh.Δ_newEdge hA] + · intro f hf + exact hc.φ_eq (hHG hf) (hh.φ_core (hmem hf)) + +omit [TopologicalSpace S] in +/-- The march map from a free patch lands in the free patch. -/ +theorem marchMap_free {π π' : List S} (hπ : π.Nodup) (hπ' : π'.Nodup) + (hlen : π.length = π'.length) {U U' : Set S} (hU : {v | v ∈ π} = U) + (hU' : {v | v ∈ π'} = U') : MapsTo (GM04.marchMapSubgraph π π') (freePatch U).groupings + (freePatch U').groupings := by + intro δ hδ + have hδv : δ.verts = U := hδ.2 + have hcorr : ∀ {x x' y}, GM04.MarchCorresponds π π' x y → GM04.MarchCorresponds π π' x' y → + x = x' := by + rintro x x' y ⟨i, hi, hi', rfl, h⟩ ⟨j, hj, hj', rfl, h'⟩ + have hij : i = j := (List.Nodup.getElem_inj_iff hπ').1 (h.trans h'.symm) + subst hij + rfl + have hv : (GM04.marchMapSubgraph π π' δ).verts = U' := by + ext y + constructor + · rintro ⟨x, -, i, hi, hi', -, rfl⟩ + rw [← hU'] + exact List.getElem_mem hi' + · intro hy + rw [← hU'] at hy + obtain ⟨i, hi', rfl⟩ := List.mem_iff_getElem.1 hy + have hi : i < π.length := hlen ▸ hi' + refine ⟨π[i], ?_, i, hi, hi', rfl, rfl⟩ + rw [hδv, ← hU] + exact List.getElem_mem hi + refine ⟨GM04.isGrouping_iff.mpr ⟨hv.subset, ?_⟩, hv⟩ + rintro a b c hac ⟨hab, x₁, x₂, h₁, h₂, hadj⟩ ⟨hbc, x₂', x₃, h₂', h₃, hadj'⟩ + have hx : x₂ = x₂' := hcorr h₂ h₂' + subst hx + have hne : x₁ ≠ x₃ := by + rintro rfl + obtain ⟨i, hi, hi', rfl, rfl⟩ := h₁ + obtain ⟨j, hj, hj', hij, rfl⟩ := h₃ + have : j = i := (List.Nodup.getElem_inj_iff hπ).1 hij + subst this + exact hac rfl + exact ⟨hac, x₁, x₃, h₁, h₃, (GM04.isGrouping_iff.1 hδ.1).2 _ _ _ hne hadj hadj'⟩ + +private theorem realization_of_outline {X Y : Place χ} {τ : Arm X.P.Γ → Arm Y.P.Γ} + {hd : χ.IsDisjoint} {Ω' : Type*} [Preorder Ω'] {ι : ColourScheme.Colour hd ↪o Ω'} + {new₂ : RootedHypergraph S (Set S) → Set S} {Q₁ Q₂ : Patchwork Ω' S (Set S)} + (h₂ : IsCompletedHeart hd Y ι new₂ Q₂) + {σv : S → Set S} {σe ηe : Set S → Set S} + (hσ : IsSubInflationIn X.P.Γ X.L.M Y.P.Γ σv σe) + (hmem : ∀ A ∈ X.L.arms, τ A ∈ Y.L.arms) + (hEM : ∀ f ∈ X.L.M.edgeSet, σe f ∈ Y.L.M.edgeSet) + (hcap : ∀ A ∈ X.L.arms, ∀ v ∈ X.L.M.vertexSet, (σv v ∩ (τ A).V).ncard ≤ 1) + {new₁ : RootedHypergraph S (Set S) → Set S} + (hηc : ∀ f ∈ X.L.M.edgeSet, ηe f = σe f) + (hηn : ∀ A ∈ X.L.arms, ηe (new₁ A.toRootedHypergraph) = new₂ (τ A).toRootedHypergraph) + (hE₁ : ∀ {P : Set S → Prop}, (∀ f ∈ X.L.M.edgeSet, P f) → + (∀ A ∈ X.L.arms, P (new₁ A.toRootedHypergraph)) → ∀ f ∈ Q₁.G.edgeSet, P f) + (hlen : ∀ g ∈ X.L.M.edgeSet, (X.P.Γ.γ g).length = (Y.P.Γ.γ (σe g)).length) + (hhave : ∀ v ∈ X.L.M.vertexSet, ∃ x₀, x₀ ∈ σv v ∧ x₀ ∈ Y.L.M.vertexSet) : + ∃ H, (Q₂.deleteEdges (ηe '' Q₁.G.edgeSet)).IsRealization H ∧ + ∀ v ∈ X.L.M.vertexSet, ∃ D, IsComponent H D ∧ D.verts = σv v ∩ Y.L.M.vertexSet := by + classical + let r : S → S → Prop := fun x y ↦ ∃ v ∈ X.L.M.vertexSet, x ∈ σv v ∧ y ∈ σv v + have hdisj : ∀ {x v v'}, v ∈ X.L.M.vertexSet → v' ∈ X.L.M.vertexSet → x ∈ σv v → x ∈ σv v' → + v = v' := by + intro x v v' hv hv' hx hx' + by_contra hne + exact disjoint_left.1 (hσ.vertex_disjoint v hv v' hv' hne) hx hx' + have hrt : ∀ a b c, r a b → r b c → r a c := by + rintro a b c ⟨v, hv, ha, hb⟩ ⟨v', hv', hb', hc⟩ + obtain rfl := hdisj hv hv' hb hb' + exact ⟨v, hv, ha, hc⟩ + have hrs : ∀ a b, r a b → r b a := fun a b ⟨v, hv, ha, hb⟩ ↦ ⟨v, hv, hb, ha⟩ + let F : Set (Set S) := ηe '' Q₁.G.edgeSet + let U : Set (Arm Y.P.Γ) := {A' ∈ Y.L.arms | ∀ A ∈ X.L.arms, τ A ≠ A'} + let δ : Set S → (⊤ : SimpleGraph S).Subgraph := fun f ↦ + if h : ∃ A' ∈ Y.L.arms, new₂ A'.toRootedHypergraph = f then h.choose.group r + else rGroup (tilde f) r + have hδc : ∀ f ∈ Y.L.M.edgeSet, δ f = rGroup (tilde f) r := by + intro f hf + refine dite_eq_right ?_ + rintro ⟨A', hA', rfl⟩ + exact h₂.fresh _ ⟨A', hA', rfl⟩ hf + have hδn : ∀ A' ∈ Y.L.arms, δ (new₂ A'.toRootedHypergraph) = A'.group r := by + intro A' hA' + have hex : ∃ B ∈ Y.L.arms, new₂ B.toRootedHypergraph = new₂ A'.toRootedHypergraph := + ⟨A', hA', rfl⟩ + have hch := hex.choose_spec + have hc : hex.choose = A' := + Arm.toRooted_injective (h₂.inj ⟨_, hch.1, rfl⟩ ⟨_, hA', rfl⟩ hch.2) + simp only [δ, dite_eq_left hex, hc] + have hreal : (Q₂.deleteEdges F).IsRealization + (GM04.realizationOf (Q₂.deleteEdges F).G.toHypergraph δ) := by + refine ⟨δ, fun e he ↦ ?_, rfl⟩ + have he' : e ∈ Q₂.G.edgeSet := he.1 + change δ e ∈ Q₂.Δ e + rw [h₂.E_eq] at he' + rcases he' with hc | ⟨_, ⟨A', hA', rfl⟩, rfl⟩ + · rw [hδc e hc, h₂.Δ_core e hc] + exact ⟨rGroup_isGrouping hrt, rfl⟩ + · rw [hδn A' hA', h₂.Δ_new _ ⟨A', hA', rfl⟩] + exact A'.group_feasible r hrt + set H := GM04.realizationOf (Q₂.deleteEdges F).G.toHypergraph δ with hHdef + have hHverts : H.verts = Y.L.M.vertexSet := hreal.verts_eq.trans h₂.V_eq + have hnewF : ∀ A' ∈ U, new₂ A'.toRootedHypergraph ∉ F := by + rintro A' hA' ⟨f, hf, hfe⟩ + refine (hE₁ (P := fun f ↦ ηe f ≠ new₂ A'.toRootedHypergraph) ?_ ?_ f hf) hfe + · intro f hf h + rw [hηc f hf] at h + exact h₂.fresh _ ⟨A', hA'.1, rfl⟩ (h ▸ hEM f hf) + · intro A hA h + rw [hηn A hA] at h + exact hA'.2 A hA (Arm.toRooted_injective + (h₂.inj ⟨_, hmem A hA, rfl⟩ ⟨_, hA'.1, rfl⟩ h)) + have hcoreF : ∀ f ∈ Y.L.M.edgeSet, ∀ x y, x ∈ tilde f → y ∈ tilde f → x ≠ y → r x y → + f ∉ F := by + rintro f hf x y hx hy hne ⟨v, hv, hxv, hyv⟩ ⟨g, hg, rfl⟩ + refine hE₁ (P := fun g ↦ x ∈ tilde (ηe g) → y ∈ tilde (ηe g) → ηe g ∈ Y.L.M.edgeSet → False) + ?_ ?_ g hg hx hy hf + · intro g hg hx hy _ + rw [hηc g hg] at hx hy + have hgE := hσ.edge_mem g hg + have hxm : x ∈ Y.P.Γ.γ (σe g) := by + have : x ∈ {v | v ∈ Y.P.Γ.γ (σe g)} := by rw [Y.P.Γ.γ_set _ hgE]; exact hx + exact this + have hym : y ∈ Y.P.Γ.γ (σe g) := by + have : y ∈ {v | v ∈ Y.P.Γ.γ (σe g)} := by rw [Y.P.Γ.γ_set _ hgE]; exact hy + exact this + obtain ⟨i, hi', rfl⟩ := List.mem_iff_getElem.1 hxm + obtain ⟨j, hj', rfl⟩ := List.mem_iff_getElem.1 hym + have hi : i < (X.P.Γ.γ g).length := by rw [hlen g hg]; exact hi' + have hj : j < (X.P.Γ.γ g).length := by rw [hlen g hg]; exact hj' + have hγ : ∀ {k} (hk : k < (X.P.Γ.γ g).length), (X.P.Γ.γ g)[k] ∈ X.L.M.vertexSet := by + intro k hk + refine RootedLocation.tilde_mem_M hg ?_ + rw [← X.P.Γ.γ_set g hg.1] + exact List.getElem_mem hk + have h₁' := hdisj (hγ hi) hv (hσ.ends g hg i hi hi') hxv + have h₂' := hdisj (hγ hj) hv (hσ.ends g hg j hj hj') hyv + have hij : i = j := (List.Nodup.getElem_inj_iff (X.P.Γ.γ_nodup g hg.1)).1 (h₁'.trans h₂'.symm) + subst hij + exact hne rfl + · intro A hA _ _ h + rw [hηn A hA] at h + exact h₂.fresh _ ⟨_, hmem A hA, rfl⟩ h + have hHadj₁ : ∀ f ∈ Y.L.M.edgeSet, ∀ x y, x ∈ tilde f → y ∈ tilde f → x ≠ y → r x y → + H.Adj x y := by + intro f hf x y hx hy hne hr + refine GM04.realizationOf_adj.2 ⟨f, ⟨?_, hcoreF f hf x y hx hy hne hr⟩, ?_⟩ + · rw [h₂.E_eq] + exact Or.inl hf + · rw [hδc f hf] + exact ⟨hx, hy, hne, hr, hrs _ _ hr⟩ + have hHadj₂ : ∀ A' ∈ U, ∀ x y, x ∈ A'.π → y ∈ A'.π → x ≠ y → + ConnectedIn (A'.real r) x y → H.Adj x y := by + intro A' hA' x y hx hy hne hc + refine GM04.realizationOf_adj.2 ⟨new₂ A'.toRootedHypergraph, ⟨?_, hnewF A' hA'⟩, ?_⟩ + · rw [h₂.E_eq] + exact Or.inr ⟨_, ⟨A', hA'.1, rfl⟩, rfl⟩ + · rw [hδn A' hA'.1] + exact ⟨hx, hy, hne, hc, hc.symm⟩ + let T : S → S → Prop := fun a b ↦ a = b ∨ r a b + have hTr : ∀ a, T a a := fun _ ↦ Or.inl rfl + have hTt : ∀ a b c, T a b → T b c → T a c := by + rintro a b c (rfl | h₁') h₂' + · exact h₂' + · exact Or.inr (h₂'.elim (fun h => h ▸ h₁') (hrt _ _ _ h₁')) + have hHT : ∀ a b, H.Adj a b → T a b := by + intro a b hab + obtain ⟨f, hf, hAdj⟩ := GM04.realizationOf_adj.1 hab + have hf' : f ∈ Q₂.G.edgeSet := hf.1 + rw [h₂.E_eq] at hf' + rcases hf' with hc | ⟨_, ⟨A', hA', rfl⟩, rfl⟩ + · rw [hδc f hc] at hAdj + exact Or.inr hAdj.2.2.2.1 + · rw [hδn A' hA'] at hAdj + refine connectedIn_induct hTr hTt (fun a b h ↦ ?_) hAdj.2.2.2.1 + obtain ⟨f, -, hg⟩ := (A'.real_adj r).1 h + exact Or.inr hg.2.2.2.1 + have hup : ∀ A' ∈ U, ∀ z x, z ∈ A'.π → x ∈ A'.π → ConnectedIn (A'.real r) z x → + ConnectedIn H z x := by + intro A' hA' z x hz hx hc + by_cases hzx : z = x + · subst hzx + refine GM18.ConnectedIn.refl ?_ + rw [hHverts] + exact RootedLocation.π_mem_M hA'.1 hz + · exact connectedIn_of_adj (hHadj₂ A' hA' z x hz hx hzx hc) + have hfinσ : ∀ v ∈ X.L.M.vertexSet, (σv v).Finite := fun v hv ↦ + Y.P.Γ.finite_V.subset (hσ.vertex_subset v hv) + have hclaim : ∀ v ∈ X.L.M.vertexSet, ∀ x₀ ∈ σv v, x₀ ∈ Y.L.M.vertexSet → + ∀ y ∈ σv v, y ∈ Y.L.M.vertexSet → ConnectedIn H x₀ y := by + intro v hv x₀ hx₀ hx₀M y hy hyM + let Inv : S → Prop := fun x ↦ (x ∈ Y.L.M.vertexSet ∧ ConnectedIn H x₀ x) ∨ + ∃ A' ∈ U, x ∈ A'.minus.vertexSet ∧ ∃ z ∈ A'.π, ConnectedIn H x₀ z ∧ + ConnectedIn (A'.real r) z x + have hsimp : ∀ {x}, Inv x → x ∈ Y.L.M.vertexSet → ConnectedIn H x₀ x := by + rintro x (h | ⟨A', hA', hxA, z, hz, hc₁, hc₂⟩) hxM + · exact h.2 + · exact hc₁.trans (hup A' hA' z x hz (RootedLocation.mem_π_of_M hA'.1 hxM hxA) hc₂) + have hstep : ∀ a b, a ∈ σv v → b ∈ σv v → Y.P.Γ.skAdj.Adj a b → Inv a → Inv b := by + rintro a b ha hb ⟨hne, -, -, e, he, hae, hbe⟩ hInv + have hrab : r a b := ⟨v, hv, ha, hb⟩ + by_cases heM : e ∈ Y.L.M.edgeSet + · have haM := RootedLocation.tilde_mem_M heM hae + have hbM := RootedLocation.tilde_mem_M heM hbe + exact Or.inl ⟨hbM, (hsimp hInv haM).trans + (connectedIn_of_adj (hHadj₁ e heM a b hae hbe hne hrab))⟩ + · obtain ⟨A', hA', heA'⟩ := RootedLocation.exists_arm_of_notMem he heM + have haA := A'.minus_end heA' hae + have hbA := A'.minus_end heA' hbe + have hU : A' ∈ U := by + refine ⟨hA', fun A hA hEq ↦ hne ?_⟩ + subst hEq + exact (ncard_le_one ((hfinσ v hv).subset inter_subset_left)).1 (hcap A hA v hv) + a ⟨ha, haA⟩ b ⟨hb, hbA⟩ + have hab : ConnectedIn (A'.real r) a b := connectedIn_of_adj + ((A'.real_adj r).2 ⟨e, heA', hae, hbe, hne, hrab, hrs _ _ hrab⟩) + have hleft : a ∈ Y.L.M.vertexSet → ConnectedIn H x₀ a → Inv b := fun haM hc ↦ + Or.inr ⟨A', hU, hbA, a, RootedLocation.mem_π_of_M hA' haM haA, hc, hab⟩ + rcases hInv with ⟨haM, hc⟩ | ⟨A'', hA'', haA'', z, hz, hc₁, hc₂⟩ + · exact hleft haM hc + · by_cases haπ : a ∈ A''.π + · have haM := RootedLocation.π_mem_M hA''.1 haπ + exact hleft haM (hc₁.trans (hup A'' hA'' z a hz haπ hc₂)) + · have heA'' : e ∈ A''.minus.edgeSet := (A''.edge_or he).resolve_right fun hc ↦ + haπ (A''.mem_π.2 ⟨haA'', A''.compl_end hc hae⟩) + obtain rfl := RootedLocation.eq_of_edge hA' hA''.1 heA' heA'' + exact Or.inr ⟨A', hU, hbA, z, hz, hc₁, hc₂.trans hab⟩ + have hwalk : ∀ (a b : σv v) (w : (Y.P.Γ.skAdj.induce (σv v)).Walk a b), Inv a → Inv b := by + intro a b w + induction w with + | nil => exact id + | cons hac _ ih => exact fun h ↦ ih (hstep _ _ (Subtype.coe_prop _) + (Subtype.coe_prop _) hac h) + obtain ⟨w⟩ := hσ.vertex_connected v hv ⟨x₀, hx₀⟩ ⟨y, hy⟩ + refine hsimp (hwalk _ _ w (Or.inl ⟨hx₀M, GM18.ConnectedIn.refl ?_⟩)) hyM + rw [hHverts] + exact hx₀M + have hcomp : ∀ v ∈ X.L.M.vertexSet, ∃ D, IsComponent H D ∧ D.verts = σv v ∩ Y.L.M.vertexSet := by + intro v hv + obtain ⟨x₀, hx, hxM⟩ := hhave v hv + let x : H.verts := ⟨x₀, by rw [hHverts]; exact hxM⟩ + refine ⟨GM04.component H x, ⟨x, rfl⟩, ?_⟩ + ext y + constructor + · rintro ⟨hy, hre⟩ + have hyM : y ∈ Y.L.M.vertexSet := hHverts ▸ hy + refine ⟨?_, hyM⟩ + have hc : ConnectedIn H x₀ y := connectedIn_iff.2 ⟨x.2, hy, hre⟩ + rcases connectedIn_induct hTr hTt hHT hc with rfl | ⟨v', hv', h₁', h₂'⟩ + · exact hx + · obtain rfl := hdisj hv hv' hx h₁' + exact h₂' + · rintro ⟨hy, hyM⟩ + obtain ⟨hx', hy', hre⟩ := connectedIn_iff.1 (hclaim v hv x₀ hx hxM y hy hyM) + exact ⟨hy', hre⟩ + exact ⟨H, hreal, hcomp⟩ + +/-- **An outline gives a simulation.** An outline of `X` in `Y` whose arms are matched in colour and +in their patches gives a simulation of a completion of the heart of `X` in one of the heart of +`Y`. -/ +theorem simulated_of_outline (hd : χ.IsDisjoint) {X Y : Place χ} {τ : Arm X.P.Γ → Arm Y.P.Γ} + (hτ : IsOutline X Y τ) {Ω' : Type*} [Preorder Ω'] {ι : ColourScheme.Colour hd ↪o Ω'} + {new₁ new₂ : RootedHypergraph S (Set S) → Set S} {Q₁ Q₂ : Patchwork Ω' S (Set S)} + (h₁ : IsCompletedHeart hd X ι new₁ Q₁) (h₂ : IsCompletedHeart hd Y ι new₂ Q₂) + (hinc : ∀ v ∈ X.P.Γ.V, ∃ c ∈ X.P.Γ.E, v ∈ tilde c) + (hφ : ∀ A ∈ X.L.arms, Q₁.φ (new₁ A.toRootedHypergraph) ≤ Q₂.φ (new₂ (τ A).toRootedHypergraph)) + (hΔ : ∀ A ∈ X.L.arms, MapsTo (GM04.marchMapSubgraph A.π (τ A).π) + (Q₁.Δ (new₁ A.toRootedHypergraph)).groupings + (Q₂.Δ (new₂ (τ A).toRootedHypergraph)).groupings) : + GM04.Simulated Q₁ Q₂ := by + classical + obtain ⟨hmem, hinj, σv, σe, hσ, hEM, hπ, hcap, hcol⟩ := hτ + let ηe : Set S → Set S := fun f ↦ + if f ∈ X.L.M.edgeSet then σe f else + if h : ∃ A ∈ X.L.arms, new₁ A.toRootedHypergraph = f then + new₂ (τ h.choose).toRootedHypergraph else f + have hηc : ∀ f ∈ X.L.M.edgeSet, ηe f = σe f := fun f hf ↦ ite_eq_left hf + have hηn : ∀ A ∈ X.L.arms, ηe (new₁ A.toRootedHypergraph) = + new₂ (τ A).toRootedHypergraph := by + intro A hA + have hn := h₁.fresh _ ⟨A, hA, rfl⟩ + have hex : ∃ B ∈ X.L.arms, new₁ B.toRootedHypergraph = new₁ A.toRootedHypergraph := + ⟨A, hA, rfl⟩ + have hch := hex.choose_spec + have hc : hex.choose = A := + Arm.toRooted_injective (h₁.inj ⟨_, hch.1, rfl⟩ ⟨_, hA, rfl⟩ hch.2) + simp only [ηe, ite_eq_right hn, dite_eq_left hex, hc] + have hE₁ : ∀ {P : Set S → Prop}, (∀ f ∈ X.L.M.edgeSet, P f) → + (∀ A ∈ X.L.arms, P (new₁ A.toRootedHypergraph)) → ∀ f ∈ Q₁.G.edgeSet, P f := by + intro P h₁' h₂' f hf + rw [h₁.E_eq] at hf + rcases hf with hf | ⟨_, ⟨A, hA, rfl⟩, rfl⟩ + · exact h₁' f hf + · exact h₂' A hA + have hlen : ∀ g ∈ X.L.M.edgeSet, (X.P.Γ.γ g).length = (Y.P.Γ.γ (σe g)).length := by + intro g hg + rw [X.P.Γ.length_γ hg.1, Y.P.Γ.length_γ (hσ.edge_mem g hg), hσ.edge_size g hg] + have hhave : ∀ v ∈ X.L.M.vertexSet, ∃ x₀, x₀ ∈ σv v ∧ x₀ ∈ Y.L.M.vertexSet := by + intro v hv + obtain ⟨c, hc, hvc⟩ := hinc v hv.1 + by_cases hcM : c ∈ X.L.M.edgeSet + · have hvm : v ∈ X.P.Γ.γ c := by + have : v ∈ {v | v ∈ X.P.Γ.γ c} := by rw [X.P.Γ.γ_set c hc]; exact hvc + exact this + obtain ⟨i, hi, rfl⟩ := List.mem_iff_getElem.1 hvm + have hi' : i < (Y.P.Γ.γ (σe c)).length := by rw [← hlen c hcM]; exact hi + refine ⟨_, hσ.ends c hcM i hi hi', RootedLocation.tilde_mem_M (hEM c hcM) ?_⟩ + rw [← Y.P.Γ.γ_set _ (hσ.edge_mem c hcM)] + exact List.getElem_mem hi' + · obtain ⟨A, hA, hcA⟩ := RootedLocation.exists_arm_of_notMem hc hcM + have hvπ : v ∈ A.π := RootedLocation.mem_π_of_M hA hv (A.minus_end hcA hvc) + obtain ⟨i, hi, rfl⟩ := List.mem_iff_getElem.1 hvπ + have hi' : i < (τ A).π.length := by rw [(hπ A hA).1]; exact hi + exact ⟨_, (hπ A hA).2 i hi hi', RootedLocation.π_mem_M (hmem A hA) (List.getElem_mem hi')⟩ + obtain ⟨H, hreal, hcomp⟩ := + realization_of_outline h₂ hσ hmem hEM hcap hηc hηn hE₁ hlen hhave + have hedge : ∀ e ∈ Q₁.G.edgeSet, ηe e ∈ Q₂.G.edgeSet := by + refine hE₁ (fun f hf ↦ ?_) fun A hA ↦ ?_ + · rw [hηc f hf, h₂.E_eq] + exact Or.inl (hEM f hf) + · rw [hηn A hA, h₂.E_eq] + exact Or.inr ⟨_, ⟨_, hmem A hA, rfl⟩, rfl⟩ + have hexp : GM04.IsExpansion Q₁ Q₂ (fun v ↦ σv v ∩ Y.L.M.vertexSet) ηe := by + refine ⟨fun v hv ↦ ?_, fun v hv x hx ↦ ?_, hedge, fun v₁ h₁' v₂ h₂' hne ↦ ?_, ?_, + fun e he ↦ ?_, fun e he hn ↦ ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [h₁.V_eq] at hv + exact hhave v hv + · rw [h₂.V_eq] + exact hx.2 + · rw [h₁.V_eq] at h₁' h₂' + exact (hσ.vertex_disjoint v₁ h₁' v₂ h₂' hne).mono inter_subset_left inter_subset_left + · intro e₁ he₁ e₂ he₂ heq + have hη : ∀ {f}, f ∈ X.L.M.edgeSet → ∀ {A}, A ∈ X.L.arms → + ηe f ≠ ηe (new₁ A.toRootedHypergraph) := by + intro f hf A hA h + rw [hηc f hf, hηn A hA] at h + exact h₂.fresh _ ⟨_, hmem A hA, rfl⟩ (h ▸ hEM f hf) + rw [h₁.E_eq] at he₁ he₂ + rcases he₁ with he₁ | ⟨_, ⟨A₁, hA₁, rfl⟩, rfl⟩ <;> + rcases he₂ with he₂ | ⟨_, ⟨A₂, hA₂, rfl⟩, rfl⟩ + · rw [hηc _ he₁, hηc _ he₂] at heq + exact hσ.edge_injOn he₁ he₂ heq + · exact absurd heq (hη he₁ hA₂) + · exact absurd heq.symm (hη he₂ hA₁) + · rw [hηn _ hA₁, hηn _ hA₂] at heq + have := Arm.toRooted_injective + (h₂.inj ⟨_, hmem _ hA₁, rfl⟩ ⟨_, hmem _ hA₂, rfl⟩ heq) + rw [hinj hA₁ hA₂ this] + · rw [h₁.dom_eq, h₂.dom_eq] + exact iff_of_true he (hedge e he) + · exact absurd (h₁.dom_eq ▸ he : e ∈ Q₁.dom) hn + · rw [h₁.dom_eq] + refine hE₁ (fun f hf ↦ ?_) fun A hA ↦ ?_ + · rw [hηc f hf, h₁.μ_core f hf, h₂.μ_core _ (hEM f hf)] + exact hlen f hf + · rw [hηn A hA, h₁.μ_new _ ⟨A, hA, rfl⟩, h₂.μ_new _ ⟨_, hmem A hA, rfl⟩] + exact (hπ A hA).1.symm + · rw [h₁.dom_eq] + refine hE₁ (fun f hf i hi hi' ↦ ?_) fun A hA i hi hi' ↦ ?_ + · have hμ₁ := h₁.μ_core f hf + have hμ₂ : Q₂.μ (ηe f) = Y.P.Γ.γ (σe f) := by + rw [hηc f hf] + exact h₂.μ_core _ (hEM f hf) + simp only [hμ₁, hμ₂] at hi hi' ⊢ + refine ⟨hσ.ends f hf i hi hi', RootedLocation.tilde_mem_M (hEM f hf) ?_⟩ + rw [← Y.P.Γ.γ_set _ (hσ.edge_mem f hf)] + exact List.getElem_mem hi' + · have hμ₁ : Q₁.μ (new₁ A.toRootedHypergraph) = A.π := h₁.μ_new _ ⟨A, hA, rfl⟩ + have hμ₂ : Q₂.μ (ηe (new₁ A.toRootedHypergraph)) = (τ A).π := by + rw [hηn A hA] + exact h₂.μ_new _ ⟨_, hmem A hA, rfl⟩ + simp only [hμ₁, hμ₂] at hi hi' ⊢ + exact ⟨(hπ A hA).2 i hi hi', RootedLocation.π_mem_M (hmem A hA) (List.getElem_mem hi')⟩ + · rw [h₁.roots, h₂.roots] + · intro i hi + simp [h₁.roots] at hi + · rw [h₁.dom_eq] + refine hE₁ (fun f hf ↦ ?_) fun A hA ↦ ?_ + · rw [hηc f hf, h₁.μ_core f hf, h₂.μ_core _ (hEM f hf), h₁.Δ_core f hf, + h₂.Δ_core _ (hEM f hf)] + exact marchMap_free (X.P.Γ.γ_nodup f hf.1) (Y.P.Γ.γ_nodup _ (hσ.edge_mem f hf)) (hlen f hf) + (X.P.Γ.γ_set f hf.1) (Y.P.Γ.γ_set _ (hσ.edge_mem f hf)) + · rw [hηn A hA, h₁.μ_new _ ⟨A, hA, rfl⟩, h₂.μ_new _ ⟨_, hmem A hA, rfl⟩] + exact hΔ A hA + · refine hE₁ (fun f hf ↦ ?_) fun A hA ↦ ?_ + · rw [hηc f hf, h₁.φ_core f hf, h₂.φ_core _ (hEM f hf)] + refine ι.le_iff_le.2 ?_ + change (χ.unionWQO hd).le (X.P.colour hd f).1 (Y.P.colour hd (σe f)).1 + rw [X.P.colour_val hd hf.1, Y.P.colour_val hd (hσ.edge_mem f hf)] + exact hcol f hf + · rw [hηn A hA] + exact hφ A hA + exact ⟨fun v ↦ σv v ∩ Y.L.M.vertexSet, ηe, hexp, H, hreal, fun v hv ↦ + hcomp v (h₁.V_eq ▸ hv)⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section9d.lean b/LeanPool/GraphMinor/GM19/Section9d.lean new file mode 100644 index 0000000000..ebd5b2a5ce --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section9d.lean @@ -0,0 +1,260 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section9c +public import LeanPool.GraphMinor.GM19.Section8d + +/-! +# Graph Minors XIX, (9.2) + +The new edge of an arm of a heart carries a patch on its march. There are finitely many patches on +a march of bounded length up to the names of the vertices, so these can be put into the +well-quasi-order that a well-behaved set of places lets us choose. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface +open GraphMinor.GM04 (Patchwork freePatch IsGrouping IsComponent) + +universe u w + +variable {S : Type u} [TopologicalSpace S] {α : Type w} + +/-- The adjacency of a grouping `δ`, read off by positions in the march `π`. -/ +def marchAdj (π : List S) (δ : (⊤ : SimpleGraph S).Subgraph) : Set (ℕ × ℕ) := + {p | ∃ (h₁ : p.1 < π.length) (h₂ : p.2 < π.length), δ.Adj π[p.1] π[p.2]} + +/-- A patch on the terms of a march, read off by positions in the march. -/ +def marchPattern (π : List S) (Δ : GM04.Patch S) : Set (Set (ℕ × ℕ)) := + marchAdj π '' Δ.groupings + +omit [TopologicalSpace S] in +/-- Two patches with the same pattern on marches of the same length correspond. -/ +theorem mapsTo_of_pattern {π π' : List S} (_hπ : π.Nodup) (_hπ' : π'.Nodup) + (hlen : π.length = π'.length) {Δ Δ' : GM04.Patch S} (hV : Δ.verts = {v | v ∈ π}) + (hV' : Δ'.verts = {v | v ∈ π'}) (h : marchPattern π Δ = marchPattern π' Δ') : + MapsTo (GM04.marchMapSubgraph π π') Δ.groupings Δ'.groupings := by + intro δ hδ + obtain ⟨δ', hδ', hEq⟩ : marchAdj π δ ∈ marchPattern π' Δ' := h ▸ ⟨δ, hδ, rfl⟩ + have hδv : δ.verts = {v | v ∈ π} := (Δ.verts_eq δ hδ).trans hV + have hδv' : δ'.verts = {v | v ∈ π'} := (Δ'.verts_eq δ' hδ').trans hV' + have hval : GM04.marchMapSubgraph π π' δ = δ' := by + ext y y' + · constructor + · rintro ⟨x, -, i, hi, hi', -, rfl⟩ + rw [hδv'] + exact List.getElem_mem hi' + · intro hy + rw [hδv'] at hy + obtain ⟨i, hi', rfl⟩ := List.mem_iff_getElem.1 hy + have hi : i < π.length := hlen ▸ hi' + refine ⟨π[i], ?_, i, hi, hi', rfl, rfl⟩ + rw [hδv] + exact List.getElem_mem hi + · constructor + · rintro ⟨-, x₁, x₂, ⟨i, hi, hi', rfl, rfl⟩, ⟨j, hj, hj', rfl, rfl⟩, hadj⟩ + have hm : (i, j) ∈ marchAdj π' δ' := by + rw [hEq] + exact ⟨hi, hj, hadj⟩ + obtain ⟨hh₁, hh₂, hg⟩ := hm + exact hg + · intro hadj + have hy : y ∈ δ'.verts := δ'.edge_vert hadj + have hy' : y' ∈ δ'.verts := δ'.edge_vert hadj.symm + rw [hδv'] at hy hy' + obtain ⟨i, hi', rfl⟩ := List.mem_iff_getElem.1 hy + obtain ⟨j, hj', rfl⟩ := List.mem_iff_getElem.1 hy' + have hm : (i, j) ∈ marchAdj π δ := by + rw [← hEq] + exact ⟨hi', hj', hadj⟩ + obtain ⟨hi, hj, hg⟩ := hm + exact ⟨hadj.ne, _, _, ⟨i, hi, hi', rfl, rfl⟩, ⟨j, hj, hj', rfl, rfl⟩, hg⟩ + rw [← hval] at hδ' + exact hδ' + +/-- The finitely many values of `marchPattern` on marches shorter than `θ`. -/ +def patternBox (θ : ℕ) : Set (Set (Set (ℕ × ℕ))) := + {C | C ⊆ {c | c ⊆ Iio θ ×ˢ Iio θ}} + +theorem finite_patternBox (θ : ℕ) : (patternBox θ).Finite := + (((finite_Iio θ).prod (finite_Iio θ)).finite_subsets).finite_subsets + +omit [TopologicalSpace S] in +theorem marchPattern_mem {π : List S} {θ : ℕ} (hlt : π.length < θ) (Δ : GM04.Patch S) : + marchPattern π Δ ∈ patternBox θ := by + rintro _ ⟨δ, -, rfl⟩ p ⟨h₁, h₂, -⟩ + exact ⟨h₁.trans hlt, h₂.trans hlt⟩ + +/-- A well-quasi-order with a finite tag that must agree. -/ +def taggedOrder (Ω' : Type*) [Preorder Ω'] (θ : ℕ) : QuasiOrder (Ω' × Set (Set (ℕ × ℕ))) where + E := {p | p.2 ∈ patternBox θ} + le p q := p.1 ≤ q.1 ∧ p.2 = q.2 + refl _ _ := ⟨le_rfl, rfl⟩ + trans _ _ _ _ _ _ h₁ h₂ := ⟨h₁.1.trans h₂.1, h₁.2.trans h₂.2⟩ + +theorem isWQO_taggedOrder (Ω' : Type*) [Preorder Ω'] [WellQuasiOrderedLE Ω'] (θ : ℕ) : + (taggedOrder Ω' θ).IsWQO := by + intro f hf + have hfin : Finite (patternBox θ) := (finite_patternBox θ).to_subtype + obtain ⟨C, hC⟩ := Finite.exists_infinite_fiber (fun n ↦ (⟨(f n).2, hf n⟩ : patternBox θ)) + have hI : ((fun n ↦ (⟨(f n).2, hf n⟩ : patternBox θ)) ⁻¹' {C}).Infinite := + infinite_coe_iff.mp hC + have hO : (QuasiOrder.ofPreorder Ω').IsWQO := + (QuasiOrder.isWQO_ofPreorder_iff Ω').2 inferInstance + obtain ⟨i, hi, j, hj, hij, hle⟩ := hO.exists_pair (f := fun n ↦ (f n).1) hI fun _ _ ↦ mem_univ _ + exact ⟨i, j, hij, hle, congrArg Subtype.val (hi.trans hj.symm)⟩ + +theorem Arm.order_eq {Γ : Painting S} (A : Arm Γ) : A.order = A.π.length := by + classical + have h : (A.minus ∩ A.compl).vertexSet = (A.π.toFinset : Set S) := by + rw [← A.π_set] + ext v + simp + rw [Arm.order, Hypergraph.separationOrder, h, ncard_coe_finset, + List.toFinset_card_of_nodup A.π_nodup] + +theorem RootedLocation.order_le {Γ : Painting S} (L : RootedLocation Γ) {A : Arm Γ} + (hA : A ∈ L.arms) : A.order ≤ L.ord := + le_csSup (L.finite_arms.image _).bddAbove (mem_image_of_mem _ hA) + +variable {χ : ColourScheme S α} + +/-- The hearts of the places of `Pl` of order less than `θ`. -/ +def heartClass (hd : χ.IsDisjoint) (Pl : Set (Place χ)) (θ : ℕ) : + Set (GM18.PartialPatchwork (ColourScheme.Colour hd) S (Set S)) := + {H | ∃ X ∈ Pl, X.L.ord < θ ∧ + GM18.HasPlaceHeart (GM18.toPartialPatchwork (X.P.toPatchwork hd)) X.L.rooted H} + +theorem wellBehaved_heartClass (hd : χ.IsDisjoint) {Pl : Set (Place χ)} (θ : ℕ) + (hPl : IsWellBehavedPlaces Pl) (hinc : ∀ X ∈ Pl, ∀ v ∈ X.P.Γ.V, ∃ c ∈ X.P.Γ.E, v ∈ tilde c) : + GM18.WellBehaved (heartClass hd Pl θ) := by + intro Ω' _ ι hwqo Q hQ + choose H hH hcomp using hQ + choose X hX hord hheart using hH + choose new hnew using hheart + have hcq : ∀ i, IsCompletedHeart hd (X i) ι (new i) (Q i) := fun i ↦ + isCompletedHeart_of hd (hnew i) (hcomp i) + have hlt : ∀ i, ∀ A ∈ (X i).L.arms, A.π.length < θ := fun i A hA ↦ by + rw [← A.order_eq] + exact ((X i).L.order_le hA).trans_lt (hord i) + let ξ : ∀ i, Arm (X i).P.Γ → Ω' × Set (Set (ℕ × ℕ)) := fun i A ↦ + (((Q i).φ (new i A.toRootedHypergraph)), + marchPattern A.π ((Q i).Δ (new i A.toRootedHypergraph))) + obtain ⟨i, j, hij, τ, hτ, hle⟩ := hPl (taggedOrder Ω' θ) (isWQO_taggedOrder Ω' θ) X hX ξ + fun i A hA ↦ marchPattern_mem (hlt i A hA) _ + refine ⟨i, j, hij, simulated_of_outline hd hτ (hcq i) (hcq j) (hinc _ (hX i)) + (fun A hA ↦ (hle A hA).1) fun A hA ↦ ?_⟩ + obtain ⟨hmem, -, σv, σe, -, -, hπ, -⟩ := hτ + have hV : ∀ k, ∀ B ∈ (X k).L.arms, ((Q k).Δ (new k B.toRootedHypergraph)).verts = {v | v ∈ B.π} := + fun k B hB ↦ by + rw [(hcq k).Δ_new _ ⟨B, hB, rfl⟩] + rfl + exact mapsTo_of_pattern A.π_nodup (τ A).π_nodup (hπ A hA).1.symm (hV i A hA) + (hV j _ (hmem A hA)) (hle A hA).2 + +/-- A set of places inside a well-behaved set is well-behaved. -/ +theorem IsWellBehavedPlaces.mono {Pl Pl' : Set (Place χ)} (h : IsWellBehavedPlaces Pl) + (hsub : Pl' ⊆ Pl) : IsWellBehavedPlaces Pl' := + fun Ω hΩ seq hseq ξ hξ ↦ h Ω hΩ seq (fun i ↦ hsub (hseq i)) ξ hξ + +theorem RootedLocation.Isolates.toGM18 {S : Type} [TopologicalSpace S] {Γ : Painting S} + {Shat : Type} [TopologicalSpace Shat] {cap : IsCappedSurface S Shat} + {rad : RadialDrawing cap Γ} {tb : TieBreaker rad} {L : RootedLocation Γ} {θ ord : ℕ} + {𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))} (h : L.Isolates tb θ ord 𝒯) : + GM18.Isolates Γ.toHypergraph tb.lambdaOrder θ 𝒯 + (GM18.rootedLocationToLocation Γ.toHypergraph.toRooted L.rooted) := by + rw [L.location_eq] + refine ⟨L.isLocation, h.seps_subset, ?_, ?_, ?_⟩ + · have : GM18.locationOrder L.seps = L.ord := by + unfold GM18.locationOrder RootedLocation.ord RootedLocation.seps + rw [image_image] + rfl + rw [this] + exact h.ord_lt + · rintro C D ⟨A, hA, hEq⟩ + obtain ⟨rfl, rfl⟩ := Prod.mk.inj hEq + exact (L.order_le hA).trans_lt h.ord_lt + · rintro C D ⟨A, hA, hEq⟩ θ' 𝒯' h𝒯' hθ' hswap A' B' hdist + obtain ⟨rfl, rfl⟩ := Prod.mk.inj hEq + exact h.distinction_le A hA θ' 𝒯' h𝒯' hθ' hswap A' B' hdist + +/-- A connected surface carrying two points has infinitely many points. -/ +theorem infinite_of_edge {S : Type} [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + {x y : S} (hne : x ≠ y) : Infinite S := by + by_contra h + have hfin : Finite S := not_infinite_iff_finite.mp h + have hdis : DiscreteTopology S := Finite.instDiscreteTopology + exact hne (isPreconnected_univ.subsingleton (mem_univ x) (mem_univ y)) + +/-- **Graph Minors XIX, (9.2).** "Let $\chi$ be a disjoint colour scheme, let $(\Gamma_i, \phi_i)$ +($i = 1, 2, \ldots$) be a +countable sequence of $\chi$-coloured paintings and for each $i \ge 1$ let $\lambda_i$ be a +tie-breaker in $\Gamma_i$. Let $\theta \ge 1$, and for each $i \ge 1$ and every tangle +$\mathscr{T}$ in $\Gamma_i$ of order $\ge \theta$, let $\mathscr{L}(\mathscr{T})$ be a +rooted location in $\Gamma_i$ which $\theta$-isolates $\mathscr{T}$. Let the set of all +these $(\Gamma_i, \phi_i, \mathscr{L}(\mathscr{T}))$ (over all $i$ and $\mathscr{T}$) be +well-behaved. Then there exist $j > i \ge 1$ such that there is an inflation of $(\Gamma_i, +\phi_i)$ in $(\Gamma_j, \phi_j)$." -/ +theorem theorem_9_2_proof {S Shat : Type} {α : Type w} [TopologicalSpace S] [T2Space S] + [TopologicalSpace Shat] {χ : ColourScheme S α} + {cap : IsCappedSurface S Shat} (hd : χ.IsDisjoint) (seq : ℕ → ColouredPainting χ) + (rad : ∀ i, RadialDrawing cap (seq i).Γ) (tb : ∀ i, TieBreaker (rad i)) {θ : ℕ} (hθ : 1 ≤ θ) + {Pl : Set (Place χ)} (hPl : IsWellBehavedPlaces Pl) + (hloc : ∀ i ord (𝒯 : Set (Hypergraph S (Set S) × Hypergraph S (Set S))), + GM10.IsTangle (seq i).Γ.toHypergraph ord 𝒯 → θ ≤ ord → + ∃ L : RootedLocation (seq i).Γ, (⟨hd, seq i, L⟩ : Place χ) ∈ Pl ∧ + L.Isolates (tb i) θ ord 𝒯) : + ∃ i j, i < j ∧ ∃ σv σe, IsColouredInflation χ (seq i) (seq j) σv σe := by + classical + have hS := χ.isSurface + have h3 : ∀ i, (seq i).Γ.IsInternallyThreeConnected := fun i ↦ + (seq i).fits.internally_three_connected + have hincseq : ∀ i, ∀ v ∈ (seq i).Γ.V, ∃ c ∈ (seq i).Γ.E, v ∈ tilde c := by + intro i v hv + obtain ⟨c, hc, hvc⟩ := exists_edge_incident hS (h3 i) (rad i) hv + exact ⟨c, hc, hvc, fun hvc' ↦ (hc.2.1 hvc').2 hv⟩ + let Pl' : Set (Place χ) := Pl ∩ {X | ∃ i, X.P = seq i} + have hPl' : IsWellBehavedPlaces Pl' := hPl.mono inter_subset_left + have hinc : ∀ X ∈ Pl', ∀ v ∈ X.P.Γ.V, ∃ c ∈ X.P.Γ.E, v ∈ tilde c := by + rintro X ⟨-, i, hi⟩ + rw [hi] + exact hincseq i + have hS2 : Infinite (Set S) := by + have : ConnectedSpace S := χ.connected + obtain ⟨e, he⟩ := (h3 0).1 + have htw : 1 < (tilde e).ncard := by + rcases (seq 0).Γ.edge_shape e he with h | h <;> rw [h.1] <;> norm_num + have hfin : (tilde e).Finite := ((seq 0).Γ.edge_shape e he).elim (·.2.1) (·.2.1) + obtain ⟨x, y, -, -, hne⟩ := (one_lt_ncard_iff hfin).1 htw + have := infinite_of_edge hne + exact Infinite.of_injective (fun x : S ↦ ({x} : Set S)) singleton_injective + have hmain := GM18.theorem_6_7_proof (Ω := ColourScheme.Colour hd) (α := S) (β := Set S) + inferInstance (wellBehaved_heartClass hd θ hPl' hinc) hθ + (𝒟 := range fun i ↦ (seq i).toPatchwork hd) ?_ (fun i ↦ (seq i).toPatchwork hd) + (fun i ↦ ⟨i, rfl⟩) + · obtain ⟨i, j, hij, h⟩ := hmain + exact ⟨i, j, hij, inflation_of_simulated hd h⟩ + · rintro _ ⟨i, rfl⟩ + refine ⟨?_, (seq i).toPatchwork_isRobust hd, _, inferInstance, (tb i).lambdaOrder, + (tb i).isTieBreaker hS (h3 i), ?_⟩ + · ext v + simp [RootedHypergraph.rootSet, ColouredPainting.toPatchwork, + Hypergraph.toRooted] + · intro θ' 𝒯 hle h𝒯 + obtain ⟨L, hL, hiso⟩ := hloc i θ' 𝒯 h𝒯 hle + obtain ⟨new, Q, hheart, -⟩ := GM18.exists_fresh_isPlaceHeart + (GM18.toPartialPatchwork ((seq i).toPatchwork hd)) L.isRootedLocation + exact ⟨L.rooted, Q, ⟨fun e _ ↦ WithBot.coe_ne_bot, L.isRootedLocation⟩, ⟨new, hheart⟩, + ⟨⟨hd, seq i, L⟩, ⟨hL, i, rfl⟩, hiso.ord_lt, ⟨new, hheart⟩⟩, hiso.toGM18⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Section9e.lean b/LeanPool/GraphMinor/GM19/Section9e.lean new file mode 100644 index 0000000000..a706402f93 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Section9e.lean @@ -0,0 +1,476 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section9d +public import LeanPool.GraphMinor.GM19.Section5a +public import Mathlib.Data.Set.Finite.List + +/-! +# Graph Minors XIX, (9.3) and (9.4) + +The paper omits both proofs. For (9.3) we number the arms of each place and pass to a subsequence +on which the arms look alike: the same number of arms, and the march of each arm in the same +positions of `π(ℒ)`. Then we use the second hypothesis on a subsequence along which the labels +increase. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface + +universe u w v + +variable {S : Type u} [TopologicalSpace S] {α : Type w} + +namespace QuasiOrder + +variable {β : Type v} + +/-- A sequence in a well-quasi-order has an increasing subsequence. -/ +theorem IsWQO.exists_mono_subseq {Ω : QuasiOrder β} (h : Ω.IsWQO) (f : ℕ → β) + (hf : ∀ i, f i ∈ Ω.E) : + ∃ g : ℕ → ℕ, StrictMono g ∧ ∀ m n, m ≤ n → Ω.le (f (g m)) (f (g n)) := by + let : Preorder {x // x ∈ Ω.E} := + { le := fun a b ↦ Ω.le a.1 b.1 + le_refl := fun a ↦ Ω.refl a.1 a.2 + le_trans := fun a b c h₁ h₂ ↦ Ω.trans a.1 a.2 b.1 b.2 c.1 c.2 h₁ h₂ } + have hw : WellQuasiOrdered (α := {x // x ∈ Ω.E}) (· ≤ ·) := fun F ↦ h (fun n ↦ (F n).1) fun n ↦ + (F n).2 + obtain ⟨g, hg⟩ := hw.exists_monotone_subseq (fun n ↦ ⟨f n, hf n⟩) + exact ⟨g, g.strictMono, fun m n hmn ↦ hg m n hmn⟩ + +/-- Sequences of `k`-tuples in a well-quasi-order have a subsequence that increases in each +coordinate. -/ +theorem IsWQO.exists_mono_tuple {Ω : QuasiOrder β} (h : Ω.IsWQO) (k : ℕ) (x : ℕ → ℕ → β) + (hx : ∀ i, ∀ t < k, x i t ∈ Ω.E) : + ∃ g : ℕ → ℕ, StrictMono g ∧ ∀ m n, m ≤ n → ∀ t < k, Ω.le (x (g m) t) (x (g n) t) := by + induction k with + | zero => exact ⟨id, strictMono_id, fun _ _ _ _ ht ↦ absurd ht (Nat.not_lt_zero _)⟩ + | succ k ih => + obtain ⟨g, hg, hle⟩ := ih fun i t ht ↦ hx i t (ht.trans (Nat.lt_succ_self k)) + obtain ⟨g', hg', hle'⟩ := h.exists_mono_subseq (fun n ↦ x (g n) k) + fun i ↦ hx _ _ (Nat.lt_succ_self k) + refine ⟨g ∘ g', hg.comp hg', fun m n hmn t ht ↦ ?_⟩ + rcases Nat.lt_succ_iff_lt_or_eq.1 ht with ht | rfl + · exact hle _ _ (hg'.monotone hmn) t ht + · exact hle' m n hmn + +end QuasiOrder + +/-- The arm with `A⁻ = Γ` and no complement. -/ +def Arm.top (Γ : Painting S) : Arm Γ where + minus := Γ.toHypergraph + compl := + { vertexSet := ∅ + edgeSet := ∅ + Inc := fun _ _ ↦ False + vertex_mem_of_inc := fun _ _ h ↦ h.elim + edge_mem_of_inc := fun _ _ h ↦ h.elim + vertexSet_finite := finite_empty + edgeSet_finite := finite_empty } + isSeparation := + { left_le := le_rfl + right_le := ⟨empty_subset _, empty_subset _, fun _ h ↦ h.elim⟩ + union_eq := by + apply Hypergraph.ext + · exact union_empty _ + · exact union_empty _ + · funext e v + exact propext (or_iff_left id) + edgeSet_inter_eq := inter_empty _ } + π := [] + π_nodup := List.nodup_nil + π_set := by + ext v + simp only [mem_ofPred_eq, List.not_mem_nil, false_iff] + exact fun h ↦ h.2 + +section + +variable {χ : ColourScheme S α} + +/-- **Graph Minors XIX, (9.3).** "**9.3.** *Let $\chi$ be a disjoint colour scheme, and let +$\mathscr{P}$ be a set of $\chi$-places. For each $(\Gamma, \phi, \mathscr{L}) \in \mathscr{P}$ let +$\pi(\mathscr{L})$ be a march with +$\bar{\pi}(\mathscr{L}) = \bigcup (\bar{\pi}(A) : A \in \mathscr{L})$. Suppose that* +• *there exist $m, n$ such that $|\mathscr{L}| \le m$ and $|\bar{\pi}(\mathscr{L})| \le n$ for all + $(\Gamma, \phi, \mathscr{L}) \in \mathscr{P}$,* ... +• *for every countable sequence $(\Gamma_i, \phi_i, \mathscr{L}_i)$ $(i = 1, 2, \dots)$ of members + of $\mathscr{P}$ there exist $j > i \ge 1$ and an inflation $\sigma$ of $M(\Gamma_i, + \mathscr{L}_i)$ + in $\Gamma_j$, such that* + ◦ *for each $v \in V(M(\Gamma_i, \mathscr{L}_i)), V(\sigma(v)) \subseteq V(M(\Gamma_j, + \mathscr{L}_j))$,* + ◦ *for each $e \in E(M(\Gamma_i, \mathscr{L}_i)), \sigma(e) \in E(M(\Gamma_j, \mathscr{L}_j))$ and + $\phi_i(e) \le \phi_j(\sigma(e))$,* + ◦ $|\bar{\pi}(\mathscr{L}_i)| = |\bar{\pi}(\mathscr{L}_j)|$, *and for* + $1 \le h \le |\bar{\pi}(\mathscr{L}_i)|$ *if* $v$ *is the* $h$th *term of* $\pi(\mathscr{L}_i)$ + *then* $\sigma(v)$ *contains the* $h$th *term of* $\pi(\mathscr{L}_j)$. +*Then $\mathscr{P}$ is well-behaved.*" -/ +theorem theorem_9_3_proof {Pl : Set (Place χ)} (πL : Place χ → List S) + (hsub : ∀ X ∈ Pl, ∀ A ∈ X.L.arms, ∀ v ∈ A.π, v ∈ πL X) {m n : ℕ} + (hm : ∀ X ∈ Pl, X.L.arms.ncard ≤ m) (hn : ∀ X ∈ Pl, (πL X).length ≤ n) + (hseq : ∀ seq : ℕ → Place χ, (∀ i, seq i ∈ Pl) → ∃ i j, i < j ∧ ∃ σv σe, + IsSubInflationIn (seq i).P.Γ (seq i).L.M (seq j).P.Γ σv σe ∧ + (∀ v ∈ (seq i).L.M.vertexSet, σv v ⊆ (seq j).L.M.vertexSet) ∧ + (∀ e ∈ (seq i).L.M.edgeSet, σe e ∈ (seq j).L.M.edgeSet ∧ + χ.unionLE ((seq i).P.φ e) ((seq j).P.φ (σe e))) ∧ + (πL (seq i)).length = (πL (seq j)).length ∧ + ∀ (h : ℕ) (h₁ : h < (πL (seq i)).length) (h₂ : h < (πL (seq j)).length), + (πL (seq j))[h] ∈ σv (πL (seq i))[h]) : + IsWellBehavedPlaces Pl := by + classical + intro β Ω hΩ seq hPl ξ hξ + let Code : Type := {c : List (Fin (n + 1)) // c.length ≤ n} + have : Finite Code := (List.finite_length_le (Fin (n + 1)) n).to_subtype + let toFin : ℕ → Fin (n + 1) := fun x ↦ ⟨min x n, by omega⟩ + let code : ∀ i, Arm (seq i).P.Γ → Code := fun i A ↦ + ⟨(A.π.map fun v ↦ toFin ((πL (seq i)).idxOf v)).take n, List.length_take_le _ _⟩ + let as : ∀ i, List (Arm (seq i).P.Γ) := fun i ↦ (seq i).L.finite_arms.toFinset.toList + have has_nd : ∀ i, (as i).Nodup := fun i ↦ Finset.nodup_toList _ + have has_mem : ∀ i (A : Arm (seq i).P.Γ), A ∈ as i ↔ A ∈ (seq i).L.arms := fun i A ↦ by + simp [as] + have has_len : ∀ i, (as i).length ≤ m := fun i ↦ by + have h := hm _ (hPl i) + rw [ncard_eq_toFinset_card _ (seq i).L.finite_arms] at h + simpa [as] using h + let Lst : Type := {l : List Code // l.length ≤ m} + have : Finite Lst := (List.finite_length_le Code m).to_subtype + let l : ℕ → Lst := fun i ↦ ⟨((as i).map (code i)).take m, List.length_take_le _ _⟩ + obtain ⟨l₀, hl₀⟩ := Finite.exists_infinite_fiber l + have hI : (l ⁻¹' {l₀}).Infinite := infinite_coe_iff.mp hl₀ + let g₀ : ℕ → ℕ := Nat.nth (· ∈ l ⁻¹' {l₀}) + have hg₀ : StrictMono g₀ := Nat.nth_strictMono hI + have hg₀l : ∀ i, l (g₀ i) = l₀ := fun i ↦ Nat.nth_mem_of_infinite hI i + have hlval : ∀ i, l i = ⟨(as i).map (code i), by simpa using has_len i⟩ := fun i ↦ + Subtype.ext (List.take_of_length_le (by simpa using has_len i)) + let k := l₀.1.length + have hlen : ∀ i, (as (g₀ i)).length = k := fun i ↦ by + have h := congrArg (fun c : Lst ↦ c.1.length) ((hlval _).symm.trans (hg₀l i)) + simpa using h + let y₀ : β := ξ 0 (Arm.top _) + let x : ℕ → ℕ → β := fun i t ↦ + if h : t < (as (g₀ i)).length then ξ (g₀ i) (as (g₀ i))[t] else y₀ + have hx : ∀ i, ∀ t < k, x i t ∈ Ω.E := fun i t ht ↦ by + have h : t < (as (g₀ i)).length := (hlen i).symm ▸ ht + simp only [x, dite_eq_left h] + exact hξ _ _ ((has_mem _ _).1 (List.getElem_mem h)) + obtain ⟨g₁, hg₁, hmono⟩ := hΩ.exists_mono_tuple k x hx + obtain ⟨a, b, hab, σv, σe, hinf, hV, hE, hlenπ, hroots⟩ := + hseq (fun i ↦ seq (g₀ (g₁ i))) fun i ↦ hPl _ + have hlenπA : ∀ i, ∀ A ∈ (seq i).L.arms, A.π.length ≤ (πL (seq i)).length := fun i A hA ↦ + (A.π_nodup.subperm fun v hv ↦ hsub _ (hPl i) A hA v hv).length_le + have hidx : ∀ i, ∀ A ∈ (seq i).L.arms, ∀ v ∈ A.π, (πL (seq i)).idxOf v < (πL (seq i)).length := + fun i A hA v hv ↦ List.idxOf_lt_length_iff.2 (hsub _ (hPl i) A hA v hv) + have hdisj : ∀ {x v v'}, v ∈ (seq (g₀ (g₁ a))).L.M.vertexSet → + v' ∈ (seq (g₀ (g₁ a))).L.M.vertexSet → x ∈ σv v → x ∈ σv v' → v = v' := by + intro x v v' hv hv' hx hx' + by_contra hne + exact disjoint_left.1 (hinf.vertex_disjoint v hv v' hv' hne) hx hx' + generalize hIdef : g₀ (g₁ a) = I at * + generalize hJdef : g₀ (g₁ b) = J at * + have hIJ : I < J := hIdef ▸ hJdef ▸ hg₀ (hg₁ hab) + have hlenI : (as I).length = k := hIdef ▸ hlen _ + have hlenJ : (as J).length = k := hJdef ▸ hlen _ + have hll : (as I).map (code I) = (as J).map (code J) := by + have h₁ : l I = l₀ := hIdef ▸ hg₀l _ + have h₂ : l J = l₀ := hJdef ▸ hg₀l _ + exact congrArg Subtype.val ((hlval I).symm.trans (h₁.trans (h₂.symm.trans (hlval J)))) + let τ : Arm (seq I).P.Γ → Arm (seq J).P.Γ := fun A ↦ + if h : (as I).idxOf A < (as J).length then (as J)[(as I).idxOf A] else Arm.top _ + have hτ : ∀ A ∈ (seq I).L.arms, ∃ (h₁ : (as I).idxOf A < (as I).length) + (h₂ : (as I).idxOf A < (as J).length), (as I)[(as I).idxOf A] = A ∧ + τ A = (as J)[(as I).idxOf A] := by + intro A hA + have h₁ : (as I).idxOf A < (as I).length := List.idxOf_lt_length_iff.2 ((has_mem _ _).2 hA) + have h₂ : (as I).idxOf A < (as J).length := by omega + exact ⟨h₁, h₂, List.getElem_idxOf h₁, dite_eq_left h₂⟩ + have hτmem : ∀ A ∈ (seq I).L.arms, τ A ∈ (seq J).L.arms := by + intro A hA + obtain ⟨h₁, h₂, -, hEq⟩ := hτ A hA + rw [hEq] + exact (has_mem _ _).1 (List.getElem_mem h₂) + have hcode : ∀ A ∈ (seq I).L.arms, code I A = code J (τ A) := by + intro A hA + obtain ⟨h₁, h₂, hA', hEq⟩ := hτ A hA + have h := List.getElem_of_eq hll (i := (as I).idxOf A) (by simpa using h₁) + rw [List.getElem_map, List.getElem_map, hA', ← hEq] at h + exact h + have hmaps : ∀ A ∈ (seq I).L.arms, + A.π.map (fun v ↦ toFin ((πL (seq I)).idxOf v)) = + (τ A).π.map fun v ↦ toFin ((πL (seq J)).idxOf v) := by + intro A hA + have h := congrArg Subtype.val (hcode A hA) + have hl₁ : A.π.length ≤ n := (hlenπA I A hA).trans (hn _ (hPl I)) + have hl₂ : (τ A).π.length ≤ n := (hlenπA J _ (hτmem A hA)).trans (hn _ (hPl J)) + simp only [code] at h + rwa [List.take_of_length_le (by simpa using hl₁), + List.take_of_length_le (by simpa using hl₂)] at h + have hlenτ : ∀ A ∈ (seq I).L.arms, (τ A).π.length = A.π.length := by + intro A hA + simpa using (congrArg List.length (hmaps A hA)).symm + have hterm : ∀ A ∈ (seq I).L.arms, ∀ (s : ℕ) (h₁ : s < A.π.length) (h₂ : s < (τ A).π.length), + (τ A).π[s] ∈ σv A.π[s] := by + intro A hA s h₁ h₂ + have h := List.getElem_of_eq (hmaps A hA) (i := s) (by simpa using h₁) + rw [List.getElem_map, List.getElem_map] at h + have hv₁ := List.getElem_mem h₁ + have hv₂ := List.getElem_mem h₂ + have hp₁ := hidx I A hA _ hv₁ + have hp₂ := hidx J _ (hτmem A hA) _ hv₂ + have hn₁ := hn _ (hPl I) + have hn₂ := hn _ (hPl J) + have hval : (πL (seq I)).idxOf A.π[s] = (πL (seq J)).idxOf (τ A).π[s] := by + have h' := congrArg Fin.val h + simp only [toFin] at h' + omega + have hr := hroots _ hp₁ (by rw [← hlenπ]; exact hp₁) + rw [List.getElem_idxOf hp₁] at hr + simp only [hval, List.getElem_idxOf hp₂] at hr + exact hr + refine ⟨I, J, hIJ, τ, ⟨hτmem, ?_, σv, σe, hinf, fun e he ↦ (hE e he).1, + fun A hA ↦ ⟨hlenτ A hA, hterm A hA⟩, fun A hA v hv ↦ ?_, fun e he ↦ (hE e he).2⟩, + fun A hA ↦ ?_⟩ + · intro A₁ hA₁ A₂ hA₂ heq + obtain ⟨h₁, h₂, hA₁', hEq₁⟩ := hτ A₁ hA₁ + obtain ⟨h₃, h₄, hA₂', hEq₂⟩ := hτ A₂ hA₂ + rw [hEq₁, hEq₂] at heq + have hij := (List.Nodup.getElem_inj_iff (has_nd J)).1 heq + rw [← hA₁', ← hA₂'] + simp only [hij] + · have hfin : (σv v ∩ (τ A).V).Finite := + ((seq J).P.Γ.finite_V.subset (hinf.vertex_subset v hv)).subset inter_subset_left + refine (ncard_le_one hfin).2 ?_ + rintro x ⟨hx, hxV⟩ y ⟨hy, hyV⟩ + have hτA := hτmem A hA + have hxπ := RootedLocation.mem_π_of_M hτA (hV v hv hx) hxV + have hyπ := RootedLocation.mem_π_of_M hτA (hV v hv hy) hyV + obtain ⟨s, hs', rfl⟩ := List.mem_iff_getElem.1 hxπ + obtain ⟨t, ht', rfl⟩ := List.mem_iff_getElem.1 hyπ + have hs : s < A.π.length := by rw [← hlenτ A hA]; exact hs' + have ht : t < A.π.length := by rw [← hlenτ A hA]; exact ht' + have h₁ := hdisj hv (RootedLocation.π_mem_M hA (List.getElem_mem hs)) hx (hterm A hA s hs hs') + have h₂ := hdisj hv (RootedLocation.π_mem_M hA (List.getElem_mem ht)) hy (hterm A hA t ht ht') + have hst : s = t := (List.Nodup.getElem_inj_iff A.π_nodup).1 (h₁.symm.trans h₂) + subst hst + rfl + · obtain ⟨h₁, h₂, hA', hEq⟩ := hτ A hA + have ht : (as I).idxOf A < k := by omega + subst hIdef hJdef + have hle := hmono a b hab.le _ ht + simp only [x, dite_eq_left h₁, dite_eq_left h₂, hA', ← hEq] at hle + exact hle + +end + +section + +variable {S : Type} [TopologicalSpace S] [T2Space S] {α : Type w} {χ : ColourScheme S α} + +omit [T2Space S] in +theorem IsPlaceHomeoImage.coloured {X Y : Place χ} {f : S ≃ₜ S} (h : IsPlaceHomeoImage X Y f) : + IsColouredImage f X.P Y.P := + ⟨h.2.1.symm, h.2.2.1.symm, fun e he ↦ (h.2.2.2.1 e he).1, fun e he ↦ (h.2.2.2.1 e he).2⟩ + +omit [T2Space S] in +theorem IsPlaceHomeoImage.M_V {X Y : Place χ} {f : S ≃ₜ S} {g : Arm X.P.Γ → Arm Y.P.Γ} + (hV : Y.P.Γ.V = f '' X.P.Γ.V) (hg : BijOn g X.L.arms Y.L.arms) + (hc : ∀ A ∈ X.L.arms, (g A).compl.vertexSet = f '' A.compl.vertexSet) : + Y.L.M.vertexSet = f '' X.L.M.vertexSet := by + ext v + constructor + · rintro ⟨hv, hall⟩ + rw [hV] at hv + obtain ⟨v₀, hv₀, rfl⟩ := hv + refine ⟨v₀, ⟨hv₀, fun A hA ↦ ?_⟩, rfl⟩ + have h := hall _ (hg.mapsTo hA) + rw [hc A hA] at h + obtain ⟨w, hw, hEq⟩ := h + exact f.injective hEq ▸ hw + · rintro ⟨v₀, ⟨hv₀, hall⟩, rfl⟩ + refine ⟨hV ▸ mem_image_of_mem _ hv₀, fun B hB ↦ ?_⟩ + obtain ⟨A, hA, rfl⟩ := hg.surjOn hB + rw [hc A hA] + exact mem_image_of_mem _ (hall A hA) + +omit [T2Space S] in +theorem IsPlaceHomeoImage.M_E {X Y : Place χ} {f : S ≃ₜ S} {g : Arm X.P.Γ → Arm Y.P.Γ} + (hE : Y.P.Γ.E = (fun e ↦ f '' e) '' X.P.Γ.E) (hg : BijOn g X.L.arms Y.L.arms) + (hc : ∀ A ∈ X.L.arms, (g A).compl.edgeSet = (fun e ↦ f '' e) '' A.compl.edgeSet) : + Y.L.M.edgeSet = (fun e ↦ f '' e) '' X.L.M.edgeSet := by + have hinj : Injective fun e : Set S ↦ f '' e := f.injective.image_injective + ext v + constructor + · rintro ⟨hv, hall⟩ + rw [hE] at hv + obtain ⟨v₀, hv₀, rfl⟩ := hv + refine ⟨v₀, ⟨hv₀, fun A hA ↦ ?_⟩, rfl⟩ + have h := hall _ (hg.mapsTo hA) + rw [hc A hA] at h + obtain ⟨w, hw, hEq⟩ := h + exact hinj hEq ▸ hw + · rintro ⟨v₀, ⟨hv₀, hall⟩, rfl⟩ + refine ⟨hE ▸ mem_image_of_mem _ hv₀, fun B hB ↦ ?_⟩ + obtain ⟨A, hA, rfl⟩ := hg.surjOn hB + rw [hc A hA] + exact mem_image_of_mem _ (hall A hA) + +omit [T2Space S] in +/-- An inflation of `M(Γ, ℒ)` carried over by homeomorphisms. -/ +theorem IsSubInflationIn.image {X₁ X₂ Y₁ Y₂ : Place χ} {f₁ f₂ : S ≃ₜ S} + (I₁ : IsColouredImage f₁ X₁.P Y₁.P) (I₂ : IsColouredImage f₂ X₂.P Y₂.P) + (hV : Y₁.L.M.vertexSet = f₁ '' X₁.L.M.vertexSet) + (hE : Y₁.L.M.edgeSet = (fun e ↦ f₁ '' e) '' X₁.L.M.edgeSet) {σv : S → Set S} + {σe : Set S → Set S} (h : IsSubInflationIn X₁.P.Γ X₁.L.M X₂.P.Γ σv σe) : + IsSubInflationIn Y₁.P.Γ Y₁.L.M Y₂.P.Γ (imgV f₁ f₂ σv) (imgE f₁ f₂ σe) := by + refine + { H_le := Y₁.L.M_le + edge_mem := ?_ + edge_size := ?_ + edge_injOn := ?_ + vertex_nonempty := ?_ + vertex_subset := ?_ + vertex_connected := ?_ + vertex_disjoint := ?_ + ends := ?_ } + · intro e he + rw [hE] at he + obtain ⟨c, hc, rfl⟩ := he + simp only + rw [imgE_image, I₂.E_eq] + exact mem_image_of_mem _ (h.edge_mem c hc) + · intro e he + rw [hE] at he + obtain ⟨c, hc, rfl⟩ := he + simp only + rw [imgE_image, ncard_tilde_image, ncard_tilde_image, h.edge_size c hc] + · intro e he e' he' heq + rw [hE] at he he' + obtain ⟨c, hc, rfl⟩ := he + obtain ⟨c', hc', rfl⟩ := he' + simp only [imgE_image] at heq + have := h.edge_injOn hc hc' (f₂.injective.image_injective heq) + rw [this] + · intro v hv + rw [hV] at hv + obtain ⟨v₀, hv₀, rfl⟩ := hv + rw [imgV_image] + exact (h.vertex_nonempty v₀ hv₀).image _ + · intro v hv + rw [hV] at hv + obtain ⟨v₀, hv₀, rfl⟩ := hv + rw [imgV_image, I₂.V] + exact image_mono (h.vertex_subset v₀ hv₀) + · intro v hv + rw [hV] at hv + obtain ⟨v₀, hv₀, rfl⟩ := hv + rw [imgV_image] + let F : X₂.P.Γ.skAdj.induce (σv v₀) →g Y₂.P.Γ.skAdj.induce (f₂ '' σv v₀) := + ⟨fun x ↦ ⟨f₂ x.1, mem_image_of_mem _ x.2⟩, fun hxy ↦ skAdj_image I₂ hxy⟩ + refine (h.vertex_connected v₀ hv₀).map F ?_ + rintro ⟨_, x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + · intro v hv w hw hne + rw [hV] at hv hw + obtain ⟨v₀, hv₀, rfl⟩ := hv + obtain ⟨w₀, hw₀, rfl⟩ := hw + rw [imgV_image, imgV_image] + exact (disjoint_image_iff f₂.injective).mpr + (h.vertex_disjoint v₀ hv₀ w₀ hw₀ fun he ↦ hne (by rw [he])) + · intro e he i hi hi' + rw [hE] at he + obtain ⟨c, hc, rfl⟩ := he + have hcE := (X₁.L.M_le.edgeSet_subset hc : c ∈ X₁.P.Γ.E) + simp only [imgE_image] at hi' ⊢ + have h₁ := I₁.γ c hcE + have h₂ := I₂.γ _ (h.edge_mem c hc) + simp only [h₁, h₂, List.length_map] at hi hi' ⊢ + simp only [List.getElem_map] + rw [imgV_image] + exact mem_image_of_mem _ (h.ends c hc i hi hi') + +omit [T2Space S] in +/-- **Graph Minors XIX, (9.4).** "Let $\chi$ be a disjoint colour scheme, and let $\mathscr{C}$ be a +well-behaved set of +$\chi$-places. Let $\mathscr{C}'$ be the set of all images of members of $\mathscr{C}$ under +$\Phi_\chi$-preserving homeomorphisms of $\Sigma_\chi$. Then $\mathscr{C}'$ is well-behaved." -/ +theorem theorem_9_4_proof {C : Set (Place χ)} (h : IsWellBehavedPlaces C) : + IsWellBehavedPlaces {Y | ∃ X ∈ C, ∃ f, IsPlaceHomeoImage X Y f} := by + classical + intro β Ω hΩ seq hseq ξ hξ + choose X hX f hf using hseq + have I : ∀ i, IsColouredImage (f i) (X i).P (seq i).P := fun i ↦ IsPlaceHomeoImage.coloured (hf i) + choose g hbij hg using fun i ↦ (hf i).2.2.2.2 + obtain ⟨i, j, hij, τ, ⟨hmem, hinj, σv, σe, hσ, hEM, hπ, hcap, hcol⟩, hle⟩ := + h Ω hΩ X hX (fun i A ↦ ξ i (g i A)) fun i A hA ↦ hξ i _ ((hbij i).mapsTo hA) + have hMV : ∀ k, (seq k).L.M.vertexSet = f k '' (X k).L.M.vertexSet := fun k ↦ + IsPlaceHomeoImage.M_V (I k).V (hbij k) fun A hA ↦ (hg k A hA).2.2.1 + have hME : ∀ k, (seq k).L.M.edgeSet = (fun e ↦ f k '' e) '' (X k).L.M.edgeSet := fun k ↦ + IsPlaceHomeoImage.M_E (I k).E_eq (hbij k) fun A hA ↦ (hg k A hA).2.2.2.1 + let τ' : Arm (seq i).P.Γ → Arm (seq j).P.Γ := fun B ↦ + if hB : ∃ A ∈ (X i).L.arms, g i A = B then g j (τ hB.choose) else Arm.top _ + have hτ' : ∀ A ∈ (X i).L.arms, τ' (g i A) = g j (τ A) := by + intro A hA + have hex : ∃ A' ∈ (X i).L.arms, g i A' = g i A := ⟨A, hA, rfl⟩ + have hch := hex.choose_spec + have heq : hex.choose = A := (hbij i).injOn hch.1 hA hch.2 + simp only [τ', dite_eq_left hex, heq] + have hsurj : ∀ B ∈ (seq i).L.arms, ∃ A ∈ (X i).L.arms, g i A = B := fun B hB ↦ (hbij i).surjOn hB + refine ⟨i, j, hij, τ', ⟨?_, ?_, imgV (f i) (f j) σv, imgE (f i) (f j) σe, + IsSubInflationIn.image (I i) (I j) (hMV i) (hME i) hσ, ?_, fun B hB ↦ ?_, ?_, ?_⟩, ?_⟩ + · intro B hB + obtain ⟨A, hA, rfl⟩ := hsurj B hB + rw [hτ' A hA] + exact (hbij j).mapsTo (hmem A hA) + · intro B hB B' hB' heq + obtain ⟨A, hA, rfl⟩ := hsurj B hB + obtain ⟨A', hA', rfl⟩ := hsurj B' hB' + rw [hτ' A hA, hτ' A' hA'] at heq + rw [hinj hA hA' ((hbij j).injOn (hmem A hA) (hmem A' hA') heq)] + · intro e he + rw [hME i] at he + obtain ⟨c, hc, rfl⟩ := he + simp only + rw [imgE_image, hME j] + exact mem_image_of_mem _ (hEM c hc) + · obtain ⟨A, hA, rfl⟩ := hsurj B hB + rw [hτ' A hA] + have h₁ := (hg i A hA).2.2.2.2 + have h₂ := (hg j _ (hmem A hA)).2.2.2.2 + refine ⟨by simp [h₁, h₂, (hπ A hA).1], fun s hs hs' ↦ ?_⟩ + simp only [h₁, h₂, List.length_map] at hs hs' ⊢ + simp only [List.getElem_map] + rw [imgV_image] + exact mem_image_of_mem _ ((hπ A hA).2 s hs hs') + · intro B hB v hv + obtain ⟨A, hA, rfl⟩ := hsurj B hB + rw [hMV i] at hv + obtain ⟨v₀, hv₀, rfl⟩ := hv + rw [hτ' A hA, imgV_image] + have hVeq : (g j (τ A)).V = f j '' (τ A).V := (hg j _ (hmem A hA)).1 + rw [hVeq, ← image_inter (f j).injective, ncard_image_of_injective _ (f j).injective] + exact hcap A hA v₀ hv₀ + · intro e he + rw [hME i] at he + obtain ⟨c, hc, rfl⟩ := he + have hcE : c ∈ (X i).P.Γ.E := (X i).L.M_le.edgeSet_subset hc + simp only + rw [imgE_image, (I i).φ c hcE, (I j).φ _ (hσ.edge_mem c hc)] + exact hcol c hc + · intro B hB + obtain ⟨A, hA, rfl⟩ := hsurj B hB + rw [hτ' A hA] + exact hle A hA + +end + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/SideCoord.lean b/LeanPool/GraphMinor/GM19/SideCoord.lean new file mode 100644 index 0000000000..1b690f7a1e --- /dev/null +++ b/LeanPool/GraphMinor/GM19/SideCoord.lean @@ -0,0 +1,331 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.PadFlower +public import LeanPool.GraphMinor.GM19.Defs + +/-! +# Coordinates on lines in a circle + +The sides of a frame are lines in a cuff. To compare the order of the ends of the edges of `Γ` with +the order of the vertices of `Γ₀` around a cuff, for step (2) of the proof of Graph Minors XIX, +(15.2), page 381, we read each side by a coordinate in `[0, 1]`. A line in the circle that avoids a +base point lifts to an interval of the line (`exists_side_lift`). The order "in order on the cuff" +of the +paper is then the order of the coordinate along the side (`lineCoord_le_of_inOrder`), and two sides +have intervals that do not overlap (`false_of_overlap`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +local notation "𝕀" => unitInterval + +/-- A continuous injective map of `[0, 1]` to the circle that avoids `1` between its ends lifts to +`[0, 1]`. -/ +theorem exists_side_lift {f : ℝ → Circle} (hf : ContinuousOn f (Icc 0 1)) (hi : InjOn f (Icc 0 1)) + (hne : ∀ t ∈ Ioo (0 : ℝ) 1, f t ≠ 1) : + ∃ l : ℝ → ℝ, ContinuousOn l (Icc 0 1) ∧ (StrictMonoOn l (Icc 0 1) ∨ StrictAntiOn l (Icc 0 1)) + ∧ ∀ t ∈ Icc (0 : ℝ) 1, l t ∈ Icc (0 : ℝ) 1 ∧ ee (l t) = f t := by + have hpi := Real.pi_pos + let c : ℝ → ℝ := fun t => projIcc 0 1 zero_le_one t + have hcc : Continuous c := continuous_subtype_val.comp continuous_projIcc + have hcm : ∀ t, c t ∈ Icc (0 : ℝ) 1 := fun t => (projIcc 0 1 zero_le_one t).2 + have hce : ∀ t ∈ Icc (0 : ℝ) 1, c t = t := fun t ht => by simp [c, projIcc_of_mem zero_le_one ht] + let g : ℝ → ℂ := fun t => f (c t) + have hgc : Continuous g := continuous_induced_dom.comp (hf.comp_continuous hcc hcm) + obtain ⟨L, hL⟩ := exists_isAngle hgc fun t => Circle.coe_ne_zero _ + have hLe : ∀ t ∈ Icc (0 : ℝ) 1, ee (L t / (2 * Real.pi)) = f t := fun t ht => by + have h1 := hL.2 t + have h2 : g t = f t := by simp only [g, hce t ht] + apply Circle.ext + rw [ee, mul_div_cancel₀ _ (by positivity), Circle.coe_exp, ← h2, h1] + simp [g] + let l₀ : ℝ → ℝ := fun t => L t / (2 * Real.pi) + have hl₀c : Continuous l₀ := hL.1.div_const _ + have hint : ∀ t ∈ Ioo (0 : ℝ) 1, ∀ n : ℤ, l₀ t ≠ n := fun t ht n h => by + have h1 := hLe t ⟨ht.1.le, ht.2.le⟩ + have h2 : ee (n : ℝ) = 1 := by + rw [ee, show 2 * Real.pi * (n : ℝ) = n * (2 * Real.pi) by ring, Circle.exp_int_mul_two_pi] + exact hne t ht (by rw [← h1]; change ee (l₀ t) = 1; rw [h, h2]) + let k : ℤ := ⌊l₀ (1 / 2)⌋ + let l : ℝ → ℝ := fun t => l₀ t - k + have hmid : l (1 / 2) ∈ Ioo (0 : ℝ) 1 := by + have h1 : (k : ℝ) ≤ l₀ (1 / 2) := Int.floor_le _ + have h2 : l₀ (1 / 2) < k + 1 := Int.lt_floor_add_one _ + have h3 := hint (1 / 2) (by norm_num) k + exact ⟨sub_pos.mpr (lt_of_le_of_ne h1 (Ne.symm h3)), by simp only [l]; linarith⟩ + have hlc : Continuous l := hl₀c.sub continuous_const + have hnot : ∀ t ∈ Ioo (0 : ℝ) 1, l t ≠ 0 ∧ l t ≠ 1 := fun t ht => by + constructor + · intro h + exact hint t ht k (by simp only [l] at h; linarith) + · intro h + refine hint t ht (k + 1) ?_ + simp only [l] at h + push_cast + linarith + have hcross : ∀ t ∈ Ioo (0 : ℝ) 1, ∀ v : ℝ, (v = 0 ∨ v = 1) → v ∉ uIcc (l t) (l (1 / 2)) + := fun t ht v hv hm => by + obtain ⟨s, hs, hsv⟩ := intermediate_value_uIcc (hlc.continuousOn (s := uIcc t (1 / 2))) hm + have hsI : s ∈ Ioo (0 : ℝ) 1 := by + have h1 : (1 / 2 : ℝ) ∈ Ioo (0 : ℝ) 1 := by norm_num + exact (ordConnected_Ioo.uIcc_subset ht h1) hs + obtain ⟨h1, h2⟩ := hnot s hsI + rcases hv with rfl | rfl + · exact h1 hsv + · exact h2 hsv + have hIoo : ∀ t ∈ Ioo (0 : ℝ) 1, l t ∈ Ioo (0 : ℝ) 1 := fun t ht => by + constructor + · by_contra hn + exact hcross t ht 0 (Or.inl rfl) (by rw [mem_uIcc]; exact Or.inl ⟨not_lt.mp hn, hmid.1.le⟩) + · by_contra hn + exact hcross t ht 1 (Or.inr rfl) (by rw [mem_uIcc]; exact Or.inr ⟨hmid.2.le, not_lt.mp hn⟩) + have hIcc : ∀ t ∈ Icc (0 : ℝ) 1, l t ∈ Icc (0 : ℝ) 1 := by + have hs : Icc (0 : ℝ) 1 ⊆ closure (Ioo 0 1) := by rw [closure_Ioo (by norm_num)] + intro t ht + have h1 := map_mem_closure hlc (hs ht) (t := Icc 0 1) fun x hx => ⟨(hIoo x hx).1.le, + (hIoo x hx).2.le⟩ + rwa [isClosed_Icc.closure_eq] at h1 + have hee : ∀ t ∈ Icc (0 : ℝ) 1, ee (l t) = f t := fun t ht => by + have h1 := ee_add (l t) k + have h2 : ee (k : ℝ) = 1 := by + rw [ee, show 2 * Real.pi * (k : ℝ) = k * (2 * Real.pi) by ring, Circle.exp_int_mul_two_pi] + rw [sub_add_cancel, h2, mul_one] at h1 + rw [← h1] + exact hLe t ht + have hli : InjOn l (Icc 0 1) := fun x hx y hy he => hi hx hy (by rw [← hee x hx, ← hee y hy, he]) + exact ⟨l, hlc.continuousOn, ContinuousOn.strictMonoOn_of_injOn_Icc' zero_le_one hlc.continuousOn + hli, fun t ht => ⟨hIcc t ht, hee t ht⟩⟩ + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +open Classical in +/-- The coordinate of a point on a line. -/ +noncomputable def lineCoord {L : Set S} (σ : 𝕀 ≃ₜ L) (x : S) : ℝ := + if h : x ∈ L then (σ.symm ⟨x, h⟩).1 else 0 + +/-- The point of a line at a coordinate. -/ +noncomputable def linePoint {L : Set S} (σ : 𝕀 ≃ₜ L) (t : ℝ) : S := (σ + (projIcc 0 1 zero_le_one t)).1 + +omit [T2Space S] in +theorem continuous_linePoint {L : Set S} (σ : 𝕀 ≃ₜ L) : Continuous (linePoint σ) := + continuous_subtype_val.comp (σ.continuous.comp continuous_projIcc) + +omit [T2Space S] in +theorem lineCoord_coe {L : Set S} (σ : 𝕀 ≃ₜ L) (t : 𝕀) : lineCoord σ (σ t).1 = t := by + simp [lineCoord] + +omit [T2Space S] in +theorem lineCoord_mem {L : Set S} (σ : 𝕀 ≃ₜ L) (x : S) : lineCoord σ x ∈ Icc (0 : ℝ) 1 := by + unfold lineCoord + split_ifs with h + · exact (σ.symm ⟨x, h⟩).2 + · exact ⟨le_rfl, zero_le_one⟩ + +omit [T2Space S] in +theorem linePoint_coord {L : Set S} (σ : 𝕀 ≃ₜ L) {x : S} (h : x ∈ L) : linePoint σ (lineCoord σ x) + = x := by + simp only [linePoint, lineCoord, dite_eq_left h] + simp + +omit [T2Space S] in +theorem linePoint_mem {L : Set S} (σ : 𝕀 ≃ₜ L) (t : ℝ) : linePoint σ t ∈ L := (σ _).2 + +omit [T2Space S] in +theorem lineCoord_point {L : Set S} (σ : 𝕀 ≃ₜ L) {t : ℝ} (h : t ∈ Icc (0 : ℝ) 1) : lineCoord σ + (linePoint σ t) = t := by + have : projIcc 0 1 zero_le_one t = ⟨t, h⟩ := projIcc_of_mem _ h + simp only [linePoint, this] + exact lineCoord_coe σ ⟨t, h⟩ + +omit [T2Space S] in +theorem injOn_linePoint {L : Set S} (σ : 𝕀 ≃ₜ L) : InjOn (linePoint σ) (Icc 0 1) + := fun x hx y hy he => by + rw [← lineCoord_point σ hx, ← lineCoord_point σ hy, he] + +omit [T2Space S] in +theorem continuousOn_lineCoord {L : Set S} (σ : 𝕀 ≃ₜ L) : ContinuousOn (lineCoord σ) L := by + rw [continuousOn_iff_continuous_domRestrict] + have : L.domRestrict (lineCoord σ) = fun x : L => (σ.symm x).1 := by + funext x + change lineCoord σ x.1 = _ + rw [lineCoord, dite_eq_left x.2] + rw [this] + exact continuous_subtype_val.comp σ.symm.continuous + +omit [T2Space S] in +/-- Two parametrizations of a line with the same ends run the same way. -/ +theorem lineCoord_lt_of_ends {L : Set S} (σ f : 𝕀 ≃ₜ L) (h0 : f 0 = σ 0) (h1 : f 1 + = σ 1) {t₁ t₂ : 𝕀} (ht : t₁ < t₂) : lineCoord σ (f t₁).1 < lineCoord σ (f t₂).1 := by + let k : ℝ → ℝ := fun t => lineCoord σ (linePoint f t) + have hk : ContinuousOn k (Icc 0 1) := (continuousOn_lineCoord σ).comp + (continuous_linePoint f).continuousOn fun t _ => linePoint_mem f t + have hi : InjOn k (Icc 0 1) := fun x hx y hy he => by + have h2 : linePoint f x = linePoint f y := by + rw [← linePoint_coord σ (linePoint_mem f x), ← linePoint_coord σ (linePoint_mem f y)] + exact congrArg _ he + exact injOn_linePoint f hx hy h2 + have hval : ∀ t : 𝕀, k t = lineCoord σ (f t).1 := fun t => by + have : projIcc (0 : ℝ) 1 zero_le_one t.1 = t := projIcc_val _ t + simp only [k, linePoint, this] + have hk0 : k 0 = 0 := by + have := hval 0 + rw [h0, lineCoord_coe] at this + simpa using this + have hk1 : k 1 = 1 := by + have := hval 1 + rw [h1, lineCoord_coe] at this + simpa using this + rw [← hval, ← hval] + rcases ContinuousOn.strictMonoOn_of_injOn_Icc' zero_le_one hk hi with hm | hm + · exact hm t₁.2 t₂.2 ht + · have := hm (left_mem_Icc.mpr zero_le_one) (right_mem_Icc.mpr zero_le_one) zero_lt_one + rw [hk0, hk1] at this + linarith + +omit [T2Space S] in +/-- **In order on a cuff is in order along a side.** If `x` and `y` lie on the line from `u₀` to +`u₁` in a circle `Θ`, and `u₀, x, y, u₁` occur in order on `Θ`, then the coordinate of `x` is at +most that of `y`. -/ +theorem lineCoord_le_of_inOrder {Θ L : Set S} (hsub : L ⊆ Θ) (σ : 𝕀 ≃ₜ L) {u₀ u₁ x y : S} + (h : InOrderOn Θ u₀ x y u₁) (hu₀ : (σ 0).1 = u₀) (hu₁ : (σ 1).1 = u₁) (hne : u₀ ≠ u₁) + (hx : x ∈ L) (hy : y ∈ L) + (hx0 : x ≠ u₀) (hx1 : x ≠ u₁) (hy0 : y ≠ u₀) : lineCoord σ x ≤ lineCoord σ y := by + obtain ⟨F, t₁, t₂, t₃, t₄, h12, h23, h34, h41, e₁, e₂, e₃, e₄⟩ := h + have hpi := Real.pi_pos + have hP : ∀ t, F (Circle.exp t) = ⟨cuffPoint F t, (F (Circle.exp t)).2⟩ := fun t => rfl + let G : ℝ → Circle := fun t => (Circle.exp t₁)⁻¹ * F.symm ⟨linePoint σ t, hsub + (linePoint_mem σ t)⟩ + have hGc : Continuous G := continuous_const.mul (F.symm.continuous.comp + ((continuous_linePoint σ).subtype_mk _)) + have hGv : ∀ t' z (hz : z ∈ L), cuffPoint F t' = z → G (lineCoord σ z) = ee ((t' - t₁) / + (2 * Real.pi)) := fun t' z hz he => by + have h1 : (⟨linePoint σ (lineCoord σ z), hsub (linePoint_mem σ _)⟩ : Θ) = F (Circle.exp t') + := Subtype.ext ((linePoint_coord σ hz).trans he.symm) + simp only [G] + rw [h1, Homeomorph.symm_apply_apply, ee, mul_div_cancel₀ _ (by positivity), sub_eq_neg_add, + Circle.exp_add, Circle.exp_neg] + have hG0 : G 0 = 1 := by + have hz : u₀ ∈ L := hu₀ ▸ (σ 0).2 + have h0 : lineCoord σ u₀ = 0 := by rw [← hu₀, lineCoord_coe]; rfl + have := hGv t₁ u₀ hz e₁ + rw [h0] at this + rw [this] + simp [ee] + have hGi : InjOn G (Icc 0 1) := fun a ha b hb he => by + have h1 := F.symm.injective (mul_left_cancel he) + have h2 : linePoint σ a = linePoint σ b := congrArg (fun x : Θ => x.1) h1 + exact injOn_linePoint σ ha hb h2 + have hGne : ∀ t ∈ Ioc (0 : ℝ) 1, G t ≠ 1 := fun t ht he => by + have := hGi ⟨ht.1.le, ht.2⟩ (left_mem_Icc.mpr zero_le_one) (he.trans hG0.symm) + linarith [ht.1] + obtain ⟨l, -, hm, hl⟩ := exists_side_lift hGc.continuousOn hGi fun t ht => hGne t ⟨ht.1, ht.2.le⟩ + have hu0 : lineCoord σ u₀ = 0 := by rw [← hu₀, lineCoord_coe]; rfl + have hu1 : lineCoord σ u₁ = 1 := by rw [← hu₁, lineCoord_coe]; rfl + have hu₀m : u₀ ∈ L := hu₀ ▸ (σ 0).2 + have hu₁m : u₁ ∈ L := hu₁ ▸ (σ 1).2 + have hpos : ∀ z ∈ L, z ≠ u₀ → 0 < lineCoord σ z := fun z hz hne => by + refine lt_of_le_of_ne (lineCoord_mem σ z).1 fun h => hne ?_ + rw [← linePoint_coord σ hz, ← h, ← linePoint_coord σ hu₀m, hu0] + have hd4 : (t₄ - t₁) / (2 * Real.pi) < 1 := by + rw [div_lt_one (by positivity)] + refine lt_of_le_of_ne (by linarith) fun he => hne ?_ + have : t₄ = t₁ + 2 * Real.pi := by linarith + rw [← e₄, ← e₁, this] + simp [cuffPoint] + have hval : ∀ t' z (hz : z ∈ L), z ≠ u₀ → cuffPoint F t' = z → t₁ ≤ t' → t' ≤ t₄ → l + (lineCoord σ z) = (t' - t₁) / (2 * Real.pi) := fun t' z hz hz0 he h1 h2 => by + have hd0 : 0 ≤ (t' - t₁) / (2 * Real.pi) := div_nonneg (by linarith) (by positivity) + have hd1 : (t' - t₁) / (2 * Real.pi) < 1 := by + refine lt_of_le_of_lt ?_ hd4 + exact div_le_div_of_nonneg_right (by linarith) (by positivity) + have hc := hpos z hz hz0 + have hm' := lineCoord_mem σ z + have hl' := hl _ hm' + have hne1 : ee (l (lineCoord σ z)) ≠ 1 := by + rw [hl'.2] + exact hGne _ ⟨hc, hm'.2⟩ + have h0 : l (lineCoord σ z) ≠ 0 := fun h => hne1 (by rw [h]; simp [ee]) + have h1' : l (lineCoord σ z) ≠ 1 := fun h => hne1 (by rw [h]; simp [ee]) + have hlt : l (lineCoord σ z) < 1 := lt_of_le_of_ne hl'.1.2 h1' + have hgt : 0 < l (lineCoord σ z) := lt_of_le_of_ne hl'.1.1 (Ne.symm h0) + by_contra hdiff + refine ee_ne_of_window hdiff ?_ (by rw [hl'.2]; exact hGv t' z hz he) + rw [abs_lt] + constructor <;> linarith + have hu₁0 : u₁ ≠ u₀ := hne.symm + have v2 := hval t₂ x hx hx0 e₂ h12 (h23.trans h34) + have v3 := hval t₃ y hy hy0 e₃ (h12.trans h23) h34 + have v4 := hval t₄ u₁ hu₁m hu₁0 e₄ (h12.trans (h23.trans h34)) le_rfl + have hd23 : (t₂ - t₁) / (2 * Real.pi) ≤ (t₃ - t₁) / (2 * Real.pi) := div_le_div_of_nonneg_right + (by linarith) (by positivity) + have hd24 : (t₂ - t₁) / (2 * Real.pi) ≤ (t₄ - t₁) / (2 * Real.pi) := div_le_div_of_nonneg_right + (by linarith) (by positivity) + rcases hm with hm | hm + · by_contra hn + have := hm (lineCoord_mem σ y) (lineCoord_mem σ x) (not_le.mp hn) + rw [v2, v3] at this + linarith + · exfalso + have hlt : lineCoord σ x < 1 := by + refine lt_of_le_of_ne (lineCoord_mem σ x).2 fun h => hx1 ?_ + rw [← linePoint_coord σ hx, h, ← linePoint_coord σ hu₁m, hu1] + have := hm (lineCoord_mem σ x) (right_mem_Icc.mpr zero_le_one) hlt + rw [v2, ← hu1, v4] at this + linarith + +/-- Two lines in the circle that lift to the line and do not meet between their ends have intervals +that do not overlap. -/ +theorem false_of_overlap {l l' : ℝ → ℝ} {f f' : ℝ → Circle} (hc : ContinuousOn l (Icc 0 1)) + (hc' : ContinuousOn l' (Icc 0 1)) (hm : StrictMonoOn l (Icc 0 1) ∨ StrictAntiOn l (Icc 0 1)) + (hm' : StrictMonoOn l' (Icc 0 1) ∨ StrictAntiOn l' (Icc 0 1)) (he : ∀ t ∈ Icc (0 : ℝ) 1, ee + (l t) = f t) (he' : ∀ t ∈ Icc (0 : ℝ) 1, ee (l' t) = f' t) + (hd : ∀ t ∈ Ioo (0 : ℝ) 1, ∀ t' ∈ Ioo (0 : ℝ) 1, f t ≠ f' t') {a b a' b' : ℝ} (ha : a ∈ Icc + (0 : ℝ) 1) (hb : b ∈ Icc (0 : ℝ) 1) (ha' : a' ∈ Icc (0 : ℝ) 1) (hb' : b' ∈ Icc (0 : ℝ) 1) + (h1 : l a < l' b') (h2 : l' a' < l b) : False := by + have key : ∀ {m : ℝ → ℝ}, ContinuousOn m (Icc 0 1) → (StrictMonoOn m (Icc 0 1) ∨ StrictAntiOn m + (Icc 0 1)) → ∃ A B : ℝ, A < B ∧ (∀ t ∈ Icc (0 : ℝ) 1, A ≤ m t ∧ m t ≤ B) ∧ ∀ p, A < p → p < B + → ∃ t ∈ Ioo (0 : ℝ) 1, m t = p := by + intro m hmc hmm + have h0 := left_mem_Icc.mpr (zero_le_one' ℝ) + have h1 := right_mem_Icc.mpr (zero_le_one' ℝ) + rcases hmm with hmm | hmm + · refine ⟨m 0, m 1, hmm h0 h1 zero_lt_one, fun t ht => ⟨hmm.monotoneOn h0 ht ht.1, + hmm.monotoneOn ht h1 ht.2⟩, fun p hA hB => ?_⟩ + obtain ⟨t, ht, htp⟩ := intermediate_value_Icc zero_le_one hmc ⟨hA.le, hB.le⟩ + exact ⟨t, ⟨lt_of_le_of_ne ht.1 fun h => hA.ne (by rw [h, htp]), + lt_of_le_of_ne ht.2 fun h => hB.ne (by rw [← h, htp])⟩, htp⟩ + · refine ⟨m 1, m 0, hmm h0 h1 zero_lt_one, fun t ht => ⟨hmm.antitoneOn ht h1 ht.2, + hmm.antitoneOn h0 ht ht.1⟩, fun p hA hB => ?_⟩ + obtain ⟨t, ht, htp⟩ := intermediate_value_Icc' zero_le_one hmc ⟨hA.le, hB.le⟩ + exact ⟨t, ⟨lt_of_le_of_ne ht.1 fun h => hB.ne (by rw [h, htp]), + lt_of_le_of_ne ht.2 fun h => hA.ne (by rw [← h, htp])⟩, htp⟩ + obtain ⟨A, B, hAB, hb1, hs⟩ := key hc hm + obtain ⟨A', B', hAB', hb1', hs'⟩ := key hc' hm' + have h3 : A < B' := by linarith [(hb1 a ha).1, (hb1' b' hb').2] + have h4 : A' < B := by linarith [(hb1' a' ha').1, (hb1 b hb).2] + let lo := max A A' + let hi := min B B' + have hlh : lo < hi := max_lt (lt_min hAB h3) (lt_min h4 hAB') + let p := (lo + hi) / 2 + have hp1 : lo < p := by simp only [p]; linarith + have hp2 : p < hi := by simp only [p]; linarith + obtain ⟨t, ht, htp⟩ := hs p ((le_max_left _ _).trans_lt hp1) (hp2.trans_le (min_le_left _ _)) + obtain ⟨t', ht', htp'⟩ := hs' p ((le_max_right _ _).trans_lt hp1) (hp2.trans_le + (min_le_right _ _)) + refine hd t ht t' ht' ?_ + rw [← he t ⟨ht.1.le, ht.2.le⟩, ← he' t' ⟨ht'.1.le, ht'.2.le⟩, htp, htp'] + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/SideDisc.lean b/LeanPool/GraphMinor/GM19/SideDisc.lean new file mode 100644 index 0000000000..c4f2bbcaf8 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/SideDisc.lean @@ -0,0 +1,235 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FreeTopology +public import LeanPool.GraphMinor.GM19.LineCut +import LeanPool.GraphMinor.GM19.Section6Cuff + +/-! +# A disc around a cuff disc and finitely many bites + +Let `E` be a closed disc, and let `Δ i` be closed discs, each with a chord `β i` of `E` on its +boundary. If two of the `Δ i` meet only inside `E`, then `E` and all the `Δ i` make one closed +disc `Z`. This is `exists_outer_half` used once for each `i`, and the result is `exists_disc_union`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +variable {T : Type} [TopologicalSpace T] [T2Space T] {ι : Type} + +/-- A closed disc with a chord of `E` on its boundary, as in `exists_outer_half`. -/ +structure IsChordDisc (E Δ β : Set T) (s t : T) : Prop where + disc : IsClosedDisc Δ + ne : s ≠ t + line : IsLineWithEnds β s t + on_bd : β ⊆ discBd Δ + in_E : β ⊆ E + meet : β ∩ discBd E = {s, t} + off : discInt E ∩ discBd Δ ⊆ β + touch : ∀ x ∈ discBd E ∩ discBd Δ, x ∉ β → ∃ C, C ⊆ discInt E \ β ∧ C ⊆ Δ ∧ C.Nonempty + ∧ IsPreconnected C ∧ x ∈ closure C + +/-- **The disc around `E` and the `Δ i`.** -/ +theorem exists_disc_union (hT : IsClosedSurface T) {E : Set T} + (hE : IsClosedDisc E) (ℐ : Finset ι) (Δ β : ι → Set T) (s t : ι → T) + (h : ∀ i ∈ ℐ, IsChordDisc E (Δ i) (β i) (s i) (t i)) (hsep : ∀ i ∈ ℐ, ∀ j ∈ ℐ, i ≠ j + → Δ i ∩ Δ j ⊆ discInt E) : + ∃ Z, IsClosedDisc Z ∧ E ⊆ Z ∧ (∀ i ∈ ℐ, Δ i ⊆ Z) ∧ Z ⊆ E ∪ ⋃ i ∈ ℐ, Δ i ∧ discInt E ⊆ discInt Z + ∧ (∀ x, x ∉ discInt E → (x ∈ discInt Z ↔ ∃ i ∈ ℐ, x ∈ discInt (Δ i))) ∧ + discBd Z ⊆ discBd E ∪ ⋃ i ∈ ℐ, discBd (Δ i) \ discInt E ∧ discBd E \ + (⋃ i ∈ ℐ, Δ i) ⊆ discBd Z ∧ ∀ i ∈ ℐ, discBd (Δ i) \ (β i \ {s i, t i}) ⊆ discBd Z := by + classical + induction ℐ using Finset.induction_on with + | empty => + refine ⟨E, hE, Subset.rfl, by simp, by simp, Subset.rfl, fun x hx ↦ ?_, by simp, by simp, + by simp⟩ + simpa using hx + | insert a ℐ ha ih => + obtain ⟨Y, hY, hEY, hΔY, hYc, hintY, hJ3, hJ1, hJ2, hJ4⟩ := ih (fun i hi ↦ h i + (Finset.mem_insert_of_mem hi)) + (fun i hi j hj hne ↦ hsep i (Finset.mem_insert_of_mem hi) j (Finset.mem_insert_of_mem hj) hne) + have hA := h a (Finset.mem_insert_self _ _) + have hbdsub : ∀ {D : Set T}, discBd D ⊆ D := fun {D} ↦ Surface.discBd_subset D + have hne : ∀ j ∈ ℐ, a ≠ j := fun j hj he ↦ ha (he ▸ hj) + have hsepa : ∀ j ∈ ℐ, Δ a ∩ Δ j ⊆ discInt E := fun j hj ↦ hsep a (Finset.mem_insert_self _ _) j + (Finset.mem_insert_of_mem hj) (hne j hj) + have hoffE : ∀ {x}, x ∈ β a → x ∈ discBd Y → x ∈ ({s a, t a} : Set T) := by + intro x hxβ hxY + rcases hJ1 hxY with h' | h' + · exact hA.meet ▸ ⟨hxβ, h'⟩ + · obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.1 h' + exact absurd (hsepa j hj ⟨hbdsub (hA.on_bd hxβ), hbdsub hxj.1⟩) hxj.2 + have hendβ : ∀ {x}, x ∈ ({s a, t a} : Set T) → x ∈ β a ∩ discBd E := fun hx ↦ hA.meet ▸ hx + have hend : ∀ {x}, x ∈ ({s a, t a} : Set T) → x ∈ discBd Y := by + intro x hx + obtain ⟨h₁, h₂⟩ := hendβ hx + refine hJ2 ⟨h₂, fun hu ↦ ?_⟩ + obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.1 hu + exact (hsepa j hj ⟨hbdsub (hA.on_bd h₁), hxj⟩).2 h₂ + have hmeet : β a ∩ discBd Y = {s a, t a} := + Subset.antisymm (fun x hx ↦ hoffE hx.1 hx.2) fun x hx ↦ ⟨(hendβ hx).1, hend hx⟩ + have hoff : discInt Y ∩ discBd (Δ a) ⊆ β a := by + rintro x ⟨hxY, hxb⟩ + by_cases hxE : x ∈ discInt E + · exact hA.off ⟨hxE, hxb⟩ + · obtain ⟨j, hj, hxj⟩ := (hJ3 x hxE).1 hxY + exact absurd (hsepa j hj ⟨hbdsub hxb, discInt_subset _ hxj⟩) hxE + have htouch : ∀ x ∈ discBd Y ∩ discBd (Δ a), x ∉ β a → ∃ C, C ⊆ discInt Y \ β a ∧ C ⊆ Δ a + ∧ C.Nonempty ∧ IsPreconnected C ∧ x ∈ closure C := by + rintro x ⟨hxY, hxb⟩ hxβ + rcases hJ1 hxY with h' | h' + · obtain ⟨C, h₁, h₂, h₃⟩ := hA.touch x ⟨h', hxb⟩ hxβ + exact ⟨C, fun y hy ↦ ⟨hintY (h₁ hy).1, (h₁ hy).2⟩, h₂, h₃⟩ + · obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.1 h' + exact absurd (hsepa j hj ⟨hbdsub hxb, hbdsub hxj.1⟩) hxj.2 + obtain ⟨Z, A', hZ, hA'b, -, hbZ, hA'd, hAc, hYZ, hΔZ, hZΔ, hiff⟩ := exists_outer_half hT + hA.disc hY hA.ne hA.line hA.on_bd (hA.in_E.trans hEY) hmeet hoff htouch + have hIY : discInt Y ⊆ discInt Z := by + intro x hx + refine ⟨hYZ (discInt_subset _ hx), fun hb ↦ ?_⟩ + rw [hbZ] at hb + rcases hb with ⟨hb, hn⟩ | hb + · have hxβ := hoff ⟨hx, hb⟩ + have hm : x ∈ ({s a, t a} : Set T) := by + by_contra hn' + exact hn ⟨hxβ, hn'⟩ + exact hx.2 (hend hm) + · exact hx.2 (hA'b hb) + have hnotE : ∀ {i}, i ∈ insert a ℐ → ∀ {x}, x ∈ discBd (Δ i) \ (β i \ {s i, t i}) + → x ∉ discInt E := by + intro i hi x hx hxE + have hi' := h i hi + have hxβ := hi'.off ⟨hxE, hx.1⟩ + have hend' : x ∈ ({s i, t i} : Set T) := by + by_contra hn + exact hx.2 ⟨hxβ, hn⟩ + exact hxE.2 (hi'.meet ▸ hend' : x ∈ β i ∩ discBd E).2 + refine ⟨Z, hZ, hEY.trans hYZ, fun i hi ↦ ?_, fun x hx ↦ ?_, hintY.trans hIY, + fun x hxE ↦ ⟨fun hx ↦ ?_, ?_⟩, fun x hx ↦ ?_, ?_, fun i hi ↦ ?_⟩ + · rcases Finset.mem_insert.1 hi with rfl | hi' + · exact hΔZ + · exact (hΔY i hi').trans hYZ + · by_cases hxa : x ∈ Δ a + · exact Or.inr (mem_biUnion (Finset.mem_coe.2 (Finset.mem_insert_self _ _)) hxa) + · rcases hYc (hZΔ ⟨hx, hxa⟩) with h' | h' + · exact Or.inl h' + · obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.1 h' + exact Or.inr (mem_biUnion (Finset.mem_coe.2 (Finset.mem_insert_of_mem hj)) hxj) + · by_cases hxY : x ∈ discInt Y + · obtain ⟨j, hj, hxj⟩ := (hJ3 x hxE).1 hxY + exact ⟨j, Finset.mem_insert_of_mem hj, hxj⟩ + · exact ⟨a, Finset.mem_insert_self _ _, (hiff x hxY).1 hx⟩ + · rintro ⟨i, hi, hxi⟩ + rcases Finset.mem_insert.1 hi with rfl | hi' + · by_cases hxY : x ∈ discInt Y + · exact hIY hxY + · exact (hiff x hxY).2 hxi + · exact hIY ((hJ3 x hxE).2 ⟨i, hi', hxi⟩) + · rw [hbZ] at hx + rcases hx with hx | hx + · exact Or.inr (mem_biUnion (Finset.mem_coe.2 (Finset.mem_insert_self _ _)) ⟨hx.1, + hnotE (Finset.mem_insert_self _ _) hx⟩) + · rcases hJ1 (hA'b hx) with h' | h' + · exact Or.inl h' + · obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.1 h' + exact Or.inr (mem_biUnion (Finset.mem_coe.2 (Finset.mem_insert_of_mem hj)) hxj) + · rintro x ⟨hxb, hxn⟩ + have hxY : x ∈ discBd Y := hJ2 ⟨hxb, fun hu ↦ hxn (by + obtain ⟨j, hj, hxj⟩ := mem_iUnion₂.1 hu + exact mem_biUnion (Finset.mem_coe.2 (Finset.mem_insert_of_mem hj)) hxj)⟩ + rw [hbZ] + refine Or.inr (by_contra fun hn ↦ hxn (mem_biUnion (Finset.mem_coe.2 + (Finset.mem_insert_self _ _)) (hAc ⟨hxY, hn⟩))) + · rcases Finset.mem_insert.1 hi with rfl | hi' + · rw [hbZ] + exact subset_union_left + · rw [hbZ] + intro x hx + refine Or.inr (by_contra fun hn ↦ ?_) + have hxa := hAc ⟨hJ4 i hi' hx, hn⟩ + exact hnotE hi hx (hsep a (Finset.mem_insert_self _ _) i hi (hne i hi') ⟨hxa, hbdsub hx.1⟩) + +omit [T2Space T] in +/-- **Finitely many disjoint lines, cut at a finite set holding their ends.** -/ +theorem finite_lines_union [T2Space T] {𝓛 : Set (Set T)} (h𝓛 : 𝓛.Finite) {N : Set T} + (hN : N.Finite) (hl : ∀ L ∈ 𝓛, ∃ a b, IsLineWithEnds L a b ∧ a ∈ N ∧ b ∈ N) + (hd : ∀ L ∈ 𝓛, ∀ L' ∈ 𝓛, L ≠ L' → Disjoint L L') : + IsClosed (⋃₀ 𝓛) ∧ (arcComponentsIn (⋃₀ 𝓛 \ (⋃₀ 𝓛 ∩ N))).Finite ∧ (arcComponentsIn (⋃₀ 𝓛 \ + (⋃₀ 𝓛 ∩ N))).ncard + 𝓛.ncard = (⋃₀ 𝓛 ∩ N).ncard ∧ + ∀ e ∈ arcComponentsIn (⋃₀ 𝓛 \ (⋃₀ 𝓛 ∩ N)), IsMarkedArc (⋃₀ 𝓛 ∩ N) e := by + classical + induction 𝓛, h𝓛 using Set.Finite.induction_on with + | empty => + have : arcComponentsIn (∅ : Set T) = ∅ := by + ext C + simp only [mem_empty_iff_false, iff_false] + rintro ⟨hne, hs, -⟩ + obtain ⟨x, hx⟩ := hne + exact hs hx + simp [this] + | @insert L₀ 𝓛 hL₀ h𝓛 ih => + obtain ⟨hc, hfe, hcard, hm⟩ := ih (fun L hL ↦ hl L (mem_insert_of_mem _ hL)) fun L hL L' hL' ↦ + hd L (mem_insert_of_mem _ hL) L' (mem_insert_of_mem _ hL') + obtain ⟨a, b, hL, ha, hb⟩ := hl L₀ (mem_insert _ _) + set W := ⋃₀ 𝓛 with hW + have hdis : Disjoint L₀ W := by + refine disjoint_sUnion_right.2 fun L hL' ↦ hd L₀ (mem_insert _ _) L + (mem_insert_of_mem _ hL') ?_ + rintro rfl + exact hL₀ hL' + have hun : ⋃₀ insert L₀ 𝓛 = L₀ ∪ W := sUnion_insert _ _ + rw [hun] + have hcL : IsClosed L₀ := isClosed_of_cuffLine hL + set M := (L₀ ∪ W) ∩ N with hM + have hM₁ : L₀ \ M = L₀ \ (L₀ ∩ N) := by + ext x + simp only [mem_sdiff, hM, mem_inter_iff, mem_union, not_and] + tauto + have hM₂ : W \ M = W \ (W ∩ N) := by + ext x + simp only [mem_sdiff, hM, mem_inter_iff, mem_union, not_and] + tauto + have hsplit : arcComponentsIn ((L₀ ∪ W) \ M) = arcComponentsIn (L₀ \ + (L₀ ∩ N)) ∪ arcComponentsIn (W \ (W ∩ N)) := by + have hLW : L₀ ∩ W ⊆ M := by + rw [disjoint_iff_inter_eq_empty.1 hdis] + exact empty_subset _ + rw [arcComponentsIn_union_sdiff hcL hc hLW, hM₁, hM₂] + have hNL : (L₀ ∩ N).Finite := hN.subset inter_subset_right + obtain ⟨f₁, c₁, m₁⟩ := arcs_of_line _ hNL rfl hL ⟨(ends_of_line hL).1, ha⟩ ⟨(ends_of_line + hL).2.1, hb⟩ inter_subset_left + have hdarc : Disjoint (arcComponentsIn (L₀ \ (L₀ ∩ N))) (arcComponentsIn (W \ (W ∩ N))) := by + refine disjoint_left.2 fun C h₁ h₂ ↦ ?_ + obtain ⟨x, hx⟩ := h₁.1 + exact disjoint_left.1 hdis (h₁.2.1 hx).1 (h₂.2.1 hx).1 + have hMs : M = (L₀ ∩ N) ∪ (W ∩ N) := by rw [hM, union_inter_distrib_right] + have hdN : Disjoint (L₀ ∩ N) (W ∩ N) := hdis.mono inter_subset_left inter_subset_left + refine ⟨hcL.union hc, by rw [hsplit]; exact f₁.union hfe, ?_, ?_⟩ + · rw [hsplit, ncard_union_eq hdarc f₁ hfe, ncard_insert_of_notMem hL₀ h𝓛, hMs, + ncard_union_eq hdN hNL (hN.subset inter_subset_right)] + omega + · have conv : ∀ {P e : Set T}, IsClosed P → IsMarkedArc (P ∩ N) e → e ∈ arcComponentsIn (P \ + (P ∩ N)) → P ⊆ L₀ ∪ W → IsMarkedArc M e := by + rintro P e hP ⟨u, v, huv, hs, hl'⟩ he hsub + have hclo : closure e ⊆ P := closure_minimal (fun z hz ↦ (he.2.1 hz).1) hP + refine ⟨u, v, huv, ?_, hl'⟩ + rw [← hs] + ext z + exact ⟨fun h ↦ ⟨h.1, hclo h.1, h.2.2⟩, fun h ↦ ⟨h.1, hsub h.2.1, h.2.2⟩⟩ + rw [hsplit] + rintro e (he | he) + · exact conv hcL (m₁ e he).1 he subset_union_left + · exact conv hc (hm e he) he subset_union_right + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/SideEdges.lean b/LeanPool/GraphMinor/GM19/SideEdges.lean new file mode 100644 index 0000000000..24e3d57dcc --- /dev/null +++ b/LeanPool/GraphMinor/GM19/SideEdges.lean @@ -0,0 +1,1006 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.CuffAngle +public import LeanPool.GraphMinor.GM19.FreeFrame + +/-! +# The edges along a long side + +We read the cuff of a long side `S` through angles, with `S` at the angles from `0` to `π`. The +edges of `Γ` along `S` then come in order +`e₁, …, e_k`, and `e₀, e_{k+1}` are the short sides next to `S` (`exists_sideEdges`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 Real + +universe w + +variable {S : Type} [TopologicalSpace S] [T2Space S] {β : Type w} + +/-- A finite set of reals in `[x, y]` that holds `x` and `y`, in order. -/ +theorem exists_sorted {T : Set ℝ} (hT : T.Finite) {x y : ℝ} (hxy : x < y) (hx : x ∈ T) (hy : y ∈ T) + (hs : T ⊆ Icc x y) : + ∃ (k : ℕ) (t : ℕ → ℝ), 1 ≤ k ∧ t 0 = x ∧ t k = y ∧ (∀ i < k, t i < t (i + 1)) + ∧ ∀ z, z ∈ T ↔ ∃ i ≤ k, z = t i := by + classical + set F := hT.toFinset with hF + have hmem : ∀ z, z ∈ F ↔ z ∈ T := fun z ↦ hT.mem_toFinset + have hcard : 2 ≤ F.card := by + have : ({x, y} : Finset ℝ) ⊆ F := by + intro z hz + simp only [Finset.mem_insert, Finset.mem_singleton] at hz + rcases hz with rfl | rfl + · exact (hmem _).2 hx + · exact (hmem _).2 hy + have h₂ := Finset.card_le_card this + rwa [Finset.card_pair hxy.ne] at h₂ + obtain ⟨k, hk⟩ : ∃ k, F.card = k + 1 := ⟨F.card - 1, by omega⟩ + let o := F.orderEmbOfFin hk + let t : ℕ → ℝ := fun i ↦ o ⟨min i k, by omega⟩ + have hto : ∀ i : Fin (k + 1), t i.1 = o i := fun i ↦ by + simp only [t] + congr 1 + exact Fin.ext (Nat.min_eq_left (by omega)) + have hmemt : ∀ i ≤ k, t i ∈ T := fun i hi ↦ by + rw [hto ⟨i, by omega⟩] + exact (hmem _).1 (Finset.orderEmbOfFin_mem F hk _) + have hlast : t k = y := by + apply le_antisymm (hs (hmemt k le_rfl)).2 + have hr : y ∈ range o := by + rw [Finset.range_orderEmbOfFin] + exact (hmem y).2 hy + obtain ⟨j, rfl⟩ := hr + rw [hto ⟨k, by omega⟩] + exact o.monotone (by simp only [Fin.le_def]; omega) + have h0 : t 0 = x := by + apply le_antisymm _ (hs (hmemt 0 (by omega))).1 + have hr : x ∈ range o := by + rw [Finset.range_orderEmbOfFin] + exact (hmem x).2 hx + obtain ⟨j, rfl⟩ := hr + rw [hto ⟨0, by omega⟩] + exact o.monotone (by simp only [Fin.le_def]; omega) + refine ⟨k, t, by omega, h0, hlast, fun i hi ↦ ?_, fun z ↦ ?_⟩ + · refine o.strictMono ?_ + simp only [Fin.lt_def] + omega + · constructor + · intro hz + have hr : z ∈ range o := by + rw [Finset.range_orderEmbOfFin] + exact (hmem z).2 hz + obtain ⟨i, rfl⟩ := hr + refine ⟨i.1, by omega, ?_⟩ + simp only [t] + congr 1 + ext + simp only + omega + · rintro ⟨i, hi, rfl⟩ + exact (hmem _).1 (Finset.orderEmbOfFin_mem F hk _) + +/-- A sorted sequence is increasing. -/ +theorem sorted_lt {t : ℕ → ℝ} {k : ℕ} (h : ∀ i < k, t i < t (i + 1)) {i j : ℕ} (hij : i < j) + (hj : j ≤ k) : t i < t j := by + induction j with + | zero => omega + | succ j ih => + rcases Nat.lt_succ_iff_lt_or_eq.1 hij with h' | rfl + · exact (ih h' (by omega)).trans (h j (by omega)) + · exact h i (by omega) + +theorem sorted_le {t : ℕ → ℝ} {k : ℕ} (h : ∀ i < k, t i < t (i + 1)) {i j : ℕ} (hij : i ≤ j) + (hj : j ≤ k) : t i ≤ t j := by + rcases Nat.lt_or_eq_of_le hij with h' | rfl + · exact (sorted_lt h h' hj).le + · exact le_rfl + +/-- A point of `[t 0, t k]` is some `t i` or lies between two neighbours. -/ +theorem sorted_cases {t : ℕ → ℝ} {k : ℕ} {y : ℝ} (hy₀ : t 0 ≤ y) (hy₁ : y ≤ t k) : (∃ i ≤ k, y + = t i) ∨ ∃ i < k, y ∈ Ioo (t i) (t (i + 1)) := by + induction k with + | zero => exact Or.inl ⟨0, le_rfl, le_antisymm hy₁ hy₀⟩ + | succ k ih => + by_cases h : y ≤ t k + · rcases ih h with ⟨i, hi, he⟩ | ⟨i, hi, hm⟩ + · exact Or.inl ⟨i, by omega, he⟩ + · exact Or.inr ⟨i, by omega, hm⟩ + · by_cases h' : y = t (k + 1) + · exact Or.inl ⟨k + 1, le_rfl, h'⟩ + · exact Or.inr ⟨k, by omega, not_le.1 h, lt_of_le_of_ne hy₁ h'⟩ + +/-- **An arc of a cuff between two marked points with no marked point between is an arc component.** +-/ +theorem ioo_mem_arcComponents {c W N : Set S} (f : Circle ≃ₜ c) {x₁ x₂ : ℝ} (h₁₂ : x₁ < x₂) + (h₁ : cuffPoint f x₁ ∈ N) (h₂ : cuffPoint f x₂ ∈ N) + (hmid : ∀ y ∈ Ioo x₁ x₂, cuffPoint f y ∈ W \ N) (hlocal : ∀ D, D ⊆ W \ N → IsPathConnected D → + (D ∩ c).Nonempty → D ⊆ c) : + cuffPoint f '' Ioo x₁ x₂ ∈ arcComponentsIn (W \ N) := by + have hg := continuous_cuffAngle f + have hne : (Ioo x₁ x₂).Nonempty := nonempty_Ioo.2 h₁₂ + have hpc : IsPathConnected (cuffPoint f '' Ioo x₁ x₂) := ((convex_Ioo x₁ x₂).isPathConnected + hne).image hg + refine ⟨hne.image _, ?_, hpc, fun Y hY hYp hsub ↦ ?_⟩ + · rintro _ ⟨y, hy, rfl⟩ + exact hmid y hy + · apply Subset.antisymm _ hsub + have hm : (x₁ + x₂) / 2 ∈ Ioo x₁ x₂ := ⟨by linarith, by linarith⟩ + have hmY : cuffPoint f ((x₁ + x₂) / 2) ∈ Y := hsub (mem_image_of_mem _ hm) + have hYc : Y ⊆ c := hlocal Y hY hYp ⟨_, hmY, cuffAngle_mem f _⟩ + intro z hz + obtain ⟨y, hy, rfl⟩ := exists_cuffAngle_eq f x₁ (hYc hz) + have hNo : ∀ {u}, cuffPoint f u ∈ N → cuffPoint f u ∉ Y := fun hu hY' ↦ (hY hY').2 hu + have hy₁ : x₁ < y := lt_of_le_of_ne hy.1 (by rintro rfl; exact hNo h₁ hz) + by_cases hy₂ : y < x₂ + · exact mem_image_of_mem _ ⟨hy₁, hy₂⟩ + · exfalso + have hy₃ : x₂ ≤ y := not_lt.1 hy₂ + rcases arc_of_preconnected f hYp.isConnected.isPreconnected hYc (x₁ := (x₁ + x₂) / 2) (x₂ + := y) (by linarith) (by linarith [hy.2]) hmY hz with h' | h' + · exact hNo h₂ (h' x₂ ⟨hm.2.le, hy₃⟩) + · have := h' (x₁ + 2 * π) ⟨hy.2.le, by linarith⟩ + rw [cuffAngle_add_two_pi] at this + exact hNo h₁ this + +/-- The edges along a long side, with the short sides next to it. -/ +structure IsSideEdges (χ : ColourScheme S β) (Γ : Painting S) (side Θ : Set S) (f : Circle ≃ₜ Θ) + (a b : S) (k : ℕ) (t : ℕ → ℝ) (e : ℕ → Set S) : Prop where + head : (χ.Φ.γ side).head? = some a + last : (χ.Φ.γ side).getLast? = some b + ga : cuffPoint f 0 = a + gb : cuffPoint f π = b + side_eq : side = cuffPoint f '' Ioo 0 π + k_pos : 1 ≤ k + t0 : t 0 = 0 + tk : t k = π + mono : ∀ i < k, t i < t (i + 1) + e_eq : ∀ i < k, e (i + 1) = cuffPoint f '' Ioo (t i) (t (i + 1)) + mem : ∀ i ≤ k + 1, e i ∈ Γ.E + all : ∀ c ∈ Γ.E, c ⊆ side → ∃ i, 1 ≤ i ∧ i ≤ k ∧ c = e i + e_zero : ∃ d, π ≤ d ∧ d < 2 * π ∧ e 0 = cuffPoint f '' Ioo d (2 * π) + e_last : ∃ c', π < c' ∧ c' ≤ 2 * π ∧ e (k + 1) = cuffPoint f '' Ioo π c' + short : ∀ s ∈ χ.Φ.shortSides, (closure s ∩ closure side).Nonempty → s = e 0 ∨ s = e (k + 1) + rest : ∀ s ∈ χ.Φ.shortSides, s ⊆ Θ → s ⊆ cuffPoint f '' Ioo π (2 * π) + short_zero : e 0 ∈ χ.Φ.shortSides + +private theorem frame_side_endpoints_follow_orientation + {S : Type} + [TopologicalSpace S] + {β : Type w} + (χ : ColourScheme S β) + {side : Set S} + (Θ : Set S) + (u : S) + (v : S) + (huv : u ≠ v) + (hset : closure side ∩ (χ.Φ.V ∩ Θ) = {u, v}) + (hline : IsLineWithEnds (closure side) u v) + (hn2 : (tilde side).ncard = 2) + (hnd : (χ.Φ.γ side).Nodup) + (hgs : {v | v ∈ χ.Φ.γ side} = tilde side) + (hu : u ∈ tilde side) + (hv : v ∈ tilde side) + (hts : tilde side = {u, v}) : + ∃ a b, χ.Φ.γ side = [a, b] ∧ IsLineWithEnds (closure side) a b := by + classical + have hlen : (χ.Φ.γ side).length = 2 := by + have h₁ : (χ.Φ.γ side).toFinset.card = 2 := by + have hco : {v | v ∈ χ.Φ.γ side} = ((χ.Φ.γ side).toFinset : Set S) := by + ext z + simp + rw [← hn2, ← hgs, hco, ncard_coe_finset] + rw [← h₁] + exact (List.toFinset_card_of_nodup hnd).symm + obtain ⟨a, b, hl⟩ := List.length_eq_two.1 hlen + refine ⟨a, b, hl, ?_⟩ + have hgs' : ({a, b} : Set S) = {u, v} := by + rw [← hts, ← hgs, hl] + ext z + simp + rcases Set.pair_eq_pair_iff.1 hgs' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hline + · exact hline.symm + +private theorem oriented_endpoints_are_tilde + {S : Type} + [TopologicalSpace S] + {β : Type w} + (χ : ColourScheme S β) + {side : Set S} + (hgs : {v | v ∈ χ.Φ.γ side} = tilde side) + (a : S) + (b : S) + (hγ : χ.Φ.γ side = [a, b]) : + tilde side = {a, b} := by + rw [← hgs, hγ] + ext z + simp + +private theorem side_equals_first_open_semicircle + {S : Type} + [TopologicalSpace S] + {side : Set S} + (a : S) + (b : S) + (htab : tilde side = {a, b}) + (g : ℝ → S) + (ha : g 0 = a) + (hb : g π = b) + (himg : g '' Icc 0 π = closure side) + (hpos : 0 < π) + (hinj : ∀ {x y : ℝ}, x ∈ Ico 0 (2 * π) → y ∈ Ico 0 (2 * π) → g x = g y → x = y) : + side = g '' Ioo 0 π := by + ext z + constructor + · intro hz + have hzc : z ∈ g '' Icc 0 π := himg ▸ subset_closure hz + obtain ⟨y, hy, rfl⟩ := hzc + have hna : ∀ {w}, w ∈ tilde side → g y ≠ w := fun hw he ↦ hw.2 (he ▸ hz) + have hy₀ : y ≠ 0 := by + rintro rfl + exact hna (show a ∈ tilde side by rw [htab]; exact mem_insert _ _) ha + have hy₁ : y ≠ π := by + rintro rfl + exact hna (show b ∈ tilde side by rw [htab]; exact mem_insert_of_mem _ rfl) hb + exact ⟨y, ⟨lt_of_le_of_ne hy.1 hy₀.symm, lt_of_le_of_ne hy.2 hy₁⟩, rfl⟩ + · rintro ⟨y, hy, rfl⟩ + have hyc : g y ∈ closure side := himg ▸ mem_image_of_mem g ⟨hy.1.le, hy.2.le⟩ + by_contra hn + have : g y ∈ tilde side := ⟨hyc, hn⟩ + rw [htab] at this + have hyo : y ∈ Ico 0 (2 * π) := ⟨hy.1.le, by linarith [hy.2]⟩ + rcases this with h' | h' + · have := hinj hyo ⟨le_rfl, by linarith⟩ (h'.trans ha.symm) + linarith [hy.1] + · have := hinj hyo ⟨hpos.le, by linarith⟩ ((mem_singleton_iff.1 h').trans hb.symm) + linarith [hy.2] + +private theorem connected_boundary_set_stays_on_cuff + {S : Type} + [TopologicalSpace S] + (Θ : Set S) + (hΘ : Θ ∈ cuffs S) : + ∀ {Y : Set S}, Y ⊆ bd S → IsPreconnected Y → (Y ∩ Θ).Nonempty → Y ⊆ Θ := by + rintro Y hY hYc ⟨z, hzY, hzΘ⟩ + obtain ⟨x₀, hx₀, he⟩ := hΘ + have hzΘ' : z ∈ connectedComponentIn (bd S) x₀ := by rwa [he] + have h₁ := connectedComponentIn_eq hzΘ' + rw [he] at h₁ + have h₂ := hYc.subset_connectedComponentIn hzY hY + rwa [← h₁] at h₂ + +private theorem drawing_interior_component_stays_on_cuff + {S : Type} + [TopologicalSpace S] + {Γ : Painting S} + (Θ : Set S) + (hΘb : Θ ⊆ bd S) + (hconnΘ : ∀ {Y : Set S}, Y ⊆ bd S → IsPreconnected Y → (Y ∩ Θ).Nonempty → Y ⊆ Θ) : + ∀ Y ⊆ Γ.U \ Γ.V, IsPathConnected Y → (Y ∩ Θ).Nonempty → Y ⊆ Θ := by + rintro Y hY hYp ⟨z, hzY, hzΘ⟩ + obtain ⟨c, hc, hYc⟩ := exists_arcComp_superset hYp hY + have hbdr := (Γ.border_edge c hc ⟨z, hYc hzY, hΘb hzΘ⟩).2 + exact hYc.trans (hconnΘ hbdr hc.2.2.1.isConnected.isPreconnected ⟨z, hYc hzY, hzΘ⟩) + +private theorem finite_angles_of_drawing_vertices + {S : Type} + [TopologicalSpace S] + {Γ : Painting S} + (g : ℝ → S) + (hpos : 0 < π) + (hinj : ∀ {x y : ℝ}, x ∈ Ico 0 (2 * π) → y ∈ Ico 0 (2 * π) → g x = g y → x = y) : + ({y | y ∈ Icc 0 π ∧ g y ∈ Γ.V}).Finite := by + let T := {y | y ∈ Icc 0 π ∧ g y ∈ Γ.V} + refine Set.Finite.of_finite_image (f := g) (Γ.finite_V.subset ?_) ?_ + · rintro _ ⟨y, hy, rfl⟩ + exact hy.2 + · intro x hx y hy he + exact hinj ⟨hx.1.1, by linarith [hx.1.2]⟩ ⟨hy.1.1, by linarith [hy.1.2]⟩ he + +private theorem finite_angles_of_frame_vertices + {S : Type} + [TopologicalSpace S] + {β : Type w} + (χ : ColourScheme S β) + (g : ℝ → S) + (hpos : 0 < π) + (hinj : ∀ {x y : ℝ}, x ∈ Ico 0 (2 * π) → y ∈ Ico 0 (2 * π) → g x = g y → x = y) : + ({y | y ∈ Icc π (2 * π) ∧ g y ∈ χ.Φ.V}).Finite := by + let T' := {y | y ∈ Icc π (2 * π) ∧ g y ∈ χ.Φ.V} + have hTo : (T' \ {2 * π}).Finite := by + refine Set.Finite.of_finite_image (f := g) (χ.Φ.finite_V.subset ?_) ?_ + · rintro _ ⟨y, hy, rfl⟩ + exact hy.1.2 + · intro x hx y hy he + have hx' : x ∈ Ico 0 (2 * π) := ⟨by linarith [hx.1.1.1], lt_of_le_of_ne hx.1.1.2 hx.2⟩ + have hy' : y ∈ Ico 0 (2 * π) := ⟨by linarith [hy.1.1.1], lt_of_le_of_ne hy.1.1.2 hy.2⟩ + exact hinj hx' hy' he + exact (hTo.union (finite_singleton _)).subset fun z hz ↦ by + by_cases h' : z = 2 * π + · exact Or.inr h' + · exact Or.inl ⟨hz, h'⟩ + +private theorem extreme_intervals_are_short_sides + {S : Type} + [TopologicalSpace S] + {β : Type w} + (χ : ColourScheme S β) + {side : Set S} + (hside : side ∈ χ.Φ.longSides) + (a : S) + (b : S) + (htab : tilde side = {a, b}) + (g : ℝ → S) + (hb : g π = b) + (hgc : Continuous g) + (hside_eq : side = g '' Ioo 0 π) + (haV : a ∈ χ.Φ.V) + (hbV : b ∈ χ.Φ.V) + (hg2 : g (2 * π) = a) + (q : ℕ) + (w : ℕ → ℝ) + (hw0 : w 0 = π) + (hwq : w q = 2 * π) + (hwm : ∀ i < q, w i < w (i + 1)) + (hwr : ∀ {i : ℕ}, i ≤ q → w i ∈ Icc π (2 * π)) + (hsidesR : ∀ {i : ℕ}, i < q → g '' Ioo (w i) (w (i + 1)) ∈ χ.Φ.sides) + (hdisjR : ∀ {x y : ℝ}, x ∈ Ioo 0 π → y ∈ Ioo π (2 * π) → g x ≠ g y) : + ∀ {i : ℕ}, i < q → i = 0 ∨ i + 1 = q → g '' Ioo (w i) (w (i + 1)) ∈ χ.Φ.shortSides := by + intro i hi he + refine ⟨hsidesR hi, fun hlong ↦ ?_⟩ + have hRne : g '' Ioo (w i) (w (i + 1)) ≠ side := by + intro heq + obtain ⟨y, hy⟩ := nonempty_Ioo.2 (hwm i hi) + have hyR : y ∈ Ioo π (2 * π) := ⟨lt_of_le_of_lt (hwr (i := i) (by omega)).1 hy.1, + lt_of_lt_of_le hy.2 (hwr (i := i + 1) (by omega)).2⟩ + have : g y ∈ side := heq ▸ mem_image_of_mem g hy + rw [hside_eq] at this + obtain ⟨x, hx, hxy⟩ := this + exact hdisjR hx hyR hxy + have hdis := χ.Φ.long_disjoint _ (hsidesR hi) _ hside.1 hRne hlong hside.2 + have hclI : ∀ {x y}, x < y → closure (g '' Ioo x y) ⊇ g '' Icc x y := fun {x y} hxy ↦ by + rw [← closure_Ioo hxy.ne] + exact image_closure_subset_closure_image hgc + have hnotin : ∀ {z}, z ∈ χ.Φ.V → z ∉ g '' Ioo (w i) (w (i + 1)) := fun hz hzm ↦ by + have hsi := hsidesR hi + exact (hsi.2.1 hzm).2 hz + rcases he with rfl | he + · have hbt : b ∈ tilde (g '' Ioo (w 0) (w (0 + 1))) := by + refine ⟨hclI (hwm 0 hi) ⟨w 0, ⟨le_rfl, (hwm 0 hi).le⟩, ?_⟩, hnotin hbV⟩ + rw [hw0] + exact hb + exact disjoint_left.1 hdis hbt (by rw [htab]; exact mem_insert_of_mem _ rfl) + · have hat : a ∈ tilde (g '' Ioo (w i) (w (i + 1))) := by + refine ⟨hclI (hwm i hi) ⟨w (i + 1), ⟨(hwm i hi).le, le_rfl⟩, ?_⟩, hnotin haV⟩ + rw [he, hwq] + exact hg2 + exact disjoint_left.1 hdis hat (by rw [htab]; exact mem_insert _ _) + +private theorem short_sides_on_cuff_are_intervals + {S : Type} + [TopologicalSpace S] + {β : Type w} + (χ : ColourScheme S β) + {side : Set S} + (hside : side ∈ χ.Φ.longSides) + (Θ : Set S) + (a : S) + (b : S) + (f : Circle ≃ₜ ↑Θ) + (g : ℝ → S) (hg : g = cuffPoint f) + (ha : g 0 = a) + (hb : g π = b) + (hside_eq : side = g '' Ioo 0 π) + (haV : a ∈ χ.Φ.V) + (hbV : b ∈ χ.Φ.V) + (q : ℕ) + (w : ℕ → ℝ) + (hw0 : w 0 = π) + (hwq : w q = 2 * π) + (hmemT' : ∀ (z : ℝ), z ∈ ({y | y ∈ Icc π (2 * π) ∧ g y ∈ χ.Φ.V}) ↔ ∃ i ≤ q, z = w i) + (hsidesR : ∀ {i : ℕ}, i < q → g '' Ioo (w i) (w (i + 1)) ∈ χ.Φ.sides) : + ∀ s ∈ χ.Φ.shortSides, s ⊆ Θ → s ⊆ g '' Ioo π (2 * π) ∧ ∃ i < q, s = g '' Ioo (w i) (w (i + 1)) + := by + subst g + let g : ℝ → S := cuffPoint f + let T' := {y | y ∈ Icc π (2 * π) ∧ g y ∈ χ.Φ.V} + intro s hs hsub + have hsne : s ≠ side := fun h ↦ hs.2 (h ▸ hside.2) + have hsv : ∀ {z}, z ∈ s → z ∉ χ.Φ.V := fun hz ↦ (hs.1.2.1 hz).2 + have hang : ∀ {z}, z ∈ s → ∃ y ∈ Ioo π (2 * π), g y = z := by + intro z hz + obtain ⟨y, hy, rfl⟩ := exists_cuffAngle_eq f 0 (hsub hz) + rw [zero_add] at hy + have hy₀ : y ≠ 0 := by + rintro rfl + exact hsv hz (ha.symm ▸ haV) + have hyπ : y ≠ π := by + rintro rfl + exact hsv hz (hb.symm ▸ hbV) + by_cases hle : y < π + · exfalso + have hyside : g y ∈ side := hside_eq ▸ mem_image_of_mem g ⟨lt_of_le_of_ne hy.1 hy₀.symm, hle⟩ + exact hsne (GM11.arcComponent_eq hs.1 hside.1 hz hyside) + · exact ⟨y, ⟨lt_of_le_of_ne (not_lt.1 hle) hyπ.symm, hy.2⟩, rfl⟩ + refine ⟨fun z hz ↦ by + obtain ⟨y, hy, rfl⟩ := hang hz + exact mem_image_of_mem g hy, ?_⟩ + obtain ⟨z, hz⟩ := hs.1.1 + obtain ⟨y, hy, rfl⟩ := hang hz + rcases sorted_cases (t := w) (k := q) (y := y) (hw0.trans_le hy.1.le) + (by rw [hwq]; exact hy.2.le) with ⟨i, hi, rfl⟩ | ⟨i, hi, hm⟩ + · exact absurd ((hmemT' _).2 ⟨i, hi, rfl⟩ : w i ∈ T').2 (hsv hz) + · exact ⟨i, hi, GM11.arcComponent_eq hs.1 (hsidesR hi) hz (mem_image_of_mem g hm)⟩ + +private theorem successive_drawing_vertex_angles_bound_edge + {S : Type} + [TopologicalSpace S] + [T2Space S] + {Γ : Painting S} + (Θ : Set S) + (f : Circle ≃ₜ ↑Θ) + (g : ℝ → S) (hg : g = cuffPoint f) + (hΘb : Θ ⊆ bd S) + (hlocalU : ∀ Y ⊆ Γ.U \ Γ.V, IsPathConnected Y → (Y ∩ Θ).Nonempty → Y ⊆ Θ) + (k : ℕ) + (t : ℕ → ℝ) + (hmono : ∀ i < k, t i < t (i + 1)) + (hmemT : ∀ (z : ℝ), z ∈ ({y | y ∈ Icc 0 π ∧ g y ∈ Γ.V}) ↔ ∃ i ≤ k, z = t i) + (hrange : ∀ {i : ℕ}, i ≤ k → t i ∈ Icc 0 π) + (hgapT : ∀ {i : ℕ}, i < k → ∀ y ∈ Ioo (t i) (t (i + 1)), y ∉ ({y | y ∈ Icc 0 π ∧ g y ∈ Γ.V})) + (e : ℕ → Set S) + (hei : ∀ i < k, e (i + 1) = g '' Ioo (t i) (t (i + 1))) + (i : ℕ) + (hi : i < k) : + e (i + 1) ∈ Γ.E := by + subst g + let g : ℝ → S := cuffPoint f + let T := {y | y ∈ Icc 0 π ∧ g y ∈ Γ.V} + rw [hei i hi] + have h₁ : g (t i) ∈ Γ.V := ((hmemT _).2 ⟨i, by omega, rfl⟩ : t i ∈ T).2 + have h₂ : g (t (i + 1)) ∈ Γ.V := ((hmemT _).2 ⟨i + 1, by omega, rfl⟩ : t (i + 1) ∈ T).2 + refine ioo_mem_arcComponents f (hmono i hi) h₁ h₂ (fun y hy ↦ ?_) hlocalU + have hyr : y ∈ Icc 0 π := ⟨(hrange (i := i) (by omega)).1.trans hy.1.le, hy.2.le.trans (hrange (i + := i + 1) (by omega)).2⟩ + exact ⟨Γ.bd_subset (hΘb (cuffAngle_mem f y)), fun hV ↦ hgapT hi y hy ⟨hyr, hV⟩⟩ + +private theorem short_side_touching_long_side_is_extreme + {S : Type} + [TopologicalSpace S] + [T2Space S] + {β : Type w} + (hS : IsSurface S) + (χ : ColourScheme S β) + {side : Set S} + (Θ : Set S) + (hΘ : Θ ∈ cuffs S) + (hLΘ : closure side ⊆ Θ) + (g : ℝ → S) + (himg : g '' Icc 0 π = closure side) + (hpos : 0 < π) + (hgc : Continuous g) + (hinj : ∀ {x y : ℝ}, x ∈ Ico 0 (2 * π) → y ∈ Ico 0 (2 * π) → g x = g y → x = y) + (k : ℕ) + (q : ℕ) + (w : ℕ → ℝ) + (hw0 : w 0 = π) + (hwq : w q = 2 * π) + (hwm : ∀ i < q, w i < w (i + 1)) + (hwr : ∀ {i : ℕ}, i ≤ q → w i ∈ Icc π (2 * π)) + (hshorts : ∀ s ∈ χ.Φ.shortSides, s ⊆ Θ → s ⊆ g '' Ioo π (2 * π) ∧ ∃ i < q, s = g '' Ioo (w i) + (w (i + 1))) + (e : ℕ → Set S) + (he0 : e 0 = g '' Ioo (w (q - 1)) (w (q - 1 + 1))) + (hek : e (k + 1) = g '' Ioo (w 0) (w (0 + 1))) + (s : Set S) + (hs : s ∈ χ.Φ.shortSides) + (hne : (closure s ∩ closure side).Nonempty) : + s = e 0 ∨ s = e (k + 1) := by + obtain ⟨x, hx₁, hx₂⟩ := hne + obtain ⟨Θ', hΘ', hsΘ', -⟩ := Frame.side_on_cuff hS χ.Φ hs.1 + have hxΘ' : x ∈ Θ' := closure_minimal hsΘ' (isClosed_cuff hS ⟨Θ', hΘ'⟩) hx₁ + have hsame : Θ' = Θ := cuffs_eq_of_mem hΘ' hΘ hxΘ' (hLΘ hx₂) + subst hsame + obtain ⟨-, i, hi, rfl⟩ := hshorts s hs hsΘ' + have hcl : closure (g '' Ioo (w i) (w (i + 1))) ⊆ g '' Icc (w i) (w (i + 1)) := + closure_minimal (image_mono Ioo_subset_Icc_self) (isCompact_Icc.image hgc).isClosed + obtain ⟨y', hy', rfl⟩ := hcl hx₁ + rw [← himg] at hx₂ + obtain ⟨y'', hy'', he⟩ := hx₂ + have hy'r : y' ∈ Icc π (2 * π) := ⟨(hwr (i := i) (by omega)).1.trans hy'.1, hy'.2.trans (hwr (i + := i + 1) (by omega)).2⟩ + by_cases hy2 : y' = 2 * π + · left + have hiq : i + 1 = q := by + by_contra hne + have := sorted_lt hwm (show i + 1 < q by omega) le_rfl + rw [hwq] at this + linarith [hy'.2] + have : i = q - 1 := by omega + rw [he0, this] + · right + have heq := hinj ⟨by linarith [hy''.1, hpos], by linarith [hy''.2]⟩ ⟨by linarith [hy'r.1], + lt_of_le_of_ne hy'r.2 hy2⟩ he + have hy'π : y' = π := le_antisymm (by rw [← heq]; exact hy''.2) hy'r.1 + have hi0 : i = 0 := by + by_contra hne + have := sorted_lt hwm (show 0 < i by omega) (by omega) + rw [hw0] at this + linarith [hy'.1] + rw [hek, hi0] + +section + +variable (hS : IsSurface S) +include hS + +/-- **The edges along a long side.** -/ +theorem exists_sideEdges (χ : ColourScheme S β) {Γ : Painting S} (hfit : Γ.Fits χ.Φ) {side : Set S} + (hside : side ∈ χ.Φ.longSides) : + ∃ (Θ : Set S) (_ : Θ ∈ cuffs S) (f : Circle ≃ₜ Θ) (a b : S) (k : ℕ) (t : ℕ → ℝ) (e : ℕ + → Set S), side ⊆ Θ ∧ IsSideEdges χ Γ side Θ f a b k t e := by + classical + obtain ⟨Θ, hΘ, hsΘ, u, v, huv, hset, hline⟩ := Frame.side_on_cuff hS χ.Φ hside.1 + have hO : IsOArc Θ := ⟨cuffPar hS ⟨Θ, hΘ⟩⟩ + have hclΘ : IsClosed Θ := isClosed_cuff hS ⟨Θ, hΘ⟩ + have hLΘ : closure side ⊆ Θ := closure_minimal hsΘ hclΘ + obtain ⟨hn2, -, -, hends⟩ := χ.Φ.side_shape side hside.1 + obtain ⟨x, y, hxy, hxyset⟩ := Set.ncard_eq_two.1 hn2 + have hnd := χ.Φ.γ_nodup side hside.1 + have hgs := χ.Φ.γ_set side hside.1 + have hu : u ∈ tilde side := by + rw [← hends] + exact ⟨v, hline⟩ + have hv : v ∈ tilde side := by + rw [← hends] + exact ⟨u, hline.symm⟩ + have hts : tilde side = {u, v} := by + rw [hxyset] at hu hv ⊢ + rcases hu with rfl | hu <;> rcases hv with rfl | hv + · exact absurd rfl huv + · rw [mem_singleton_iff.1 hv] + · rw [mem_singleton_iff.1 hu, pair_comm] + · exact absurd ((mem_singleton_iff.1 hu).trans (mem_singleton_iff.1 hv).symm) huv + have orderedEnds : ∃ a b, χ.Φ.γ side = [a, b] ∧ IsLineWithEnds (closure side) a b := by + exact frame_side_endpoints_follow_orientation (S := S) (β := β) χ (side := side) Θ u v huv + hset hline hn2 hnd hgs hu hv hts + obtain ⟨a, b, hγ, hab⟩ := orderedEnds + have htab : tilde side = {a, b} := by + exact oriented_endpoints_are_tilde (S := S) (β := β) χ (side := side) hgs a b hγ + obtain ⟨f, ha, hb, himg⟩ := exists_angle_of_line hO hab hLΘ + set g := cuffPoint f with hg + have hpos := Real.pi_pos + have hgc : Continuous g := continuous_cuffAngle f + have hinj : ∀ {x y}, x ∈ Ico 0 (2 * π) → y ∈ Ico 0 (2 * π) → g x = g y → x = y := fun hx hy he ↦ + cuffAngle_injOn f (a := 0) (by simpa using hx) (by simpa using hy) he + have hab' : a ≠ b := (ends_of_line hab).2.2 + have hside_eq : side = g '' Ioo 0 π := by + exact side_equals_first_open_semicircle (S := S) (side := side) a b htab g ha hb himg hpos + hinj + have haV : a ∈ χ.Φ.V := by + have : a ∈ ({u, v} : Set S) := by rw [← hts, htab]; exact mem_insert _ _ + have h₂ : a ∈ closure side ∩ (χ.Φ.V ∩ Θ) := by rw [hset]; exact this + exact h₂.2.1 + have hbV : b ∈ χ.Φ.V := by + have : b ∈ ({u, v} : Set S) := by rw [← hts, htab]; exact mem_insert_of_mem _ rfl + have h₂ : b ∈ closure side ∩ (χ.Φ.V ∩ Θ) := by rw [hset]; exact this + exact h₂.2.1 + have hg2 : g (2 * π) = a := by + have h₀ : g (2 * π) = g 0 := by + have := cuffAngle_add_two_pi f 0 + rwa [zero_add] at this + exact h₀.trans ha + have hΘb : Θ ⊆ bd S := fun z hz ↦ cuff_subset_bd ⟨Θ, hΘ⟩ hz + have hconnΘ : ∀ {Y : Set S}, Y ⊆ bd S → IsPreconnected Y → (Y ∩ Θ).Nonempty → Y ⊆ Θ := by + exact connected_boundary_set_stays_on_cuff (S := S) Θ hΘ + have hlocalU : ∀ Y, Y ⊆ Γ.U \ Γ.V → IsPathConnected Y → (Y ∩ Θ).Nonempty → Y ⊆ Θ := by + exact drawing_interior_component_stays_on_cuff (S := S) (Γ := Γ) Θ hΘb hconnΘ + have hlocalB : ∀ Y, Y ⊆ bd S \ χ.Φ.V → IsPathConnected Y → (Y ∩ Θ).Nonempty → Y ⊆ Θ + := fun Y hY hYp hne ↦ + hconnΘ (fun w hw ↦ (hY hw).1) hYp.isConnected.isPreconnected hne + -- The vertices of `Γ` along the side. + set T : Set ℝ := {y ∈ Icc 0 π | g y ∈ Γ.V} with hT + have hTf : T.Finite := by + exact finite_angles_of_drawing_vertices (S := S) (Γ := Γ) g hpos hinj + have h0T : 0 ∈ T := ⟨⟨le_rfl, hpos.le⟩, ha.symm ▸ hfit.V_subset haV⟩ + have hπT : π ∈ T := ⟨⟨hpos.le, le_rfl⟩, hb.symm ▸ hfit.V_subset hbV⟩ + obtain ⟨k, t, hk, h0, hkt, hmono, hmemT⟩ := exists_sorted hTf hpos h0T hπT (fun _ h => h.1) + have hrange : ∀ {i}, i ≤ k → t i ∈ Icc 0 π := fun {i} hi ↦ by + have : t i ∈ T := (hmemT _).2 ⟨i, hi, rfl⟩ + exact this.1 + have hgapT : ∀ {i}, i < k → ∀ y ∈ Ioo (t i) (t (i + 1)), y ∉ T := by + intro i hi y hy hyT + obtain ⟨j, hj, rfl⟩ := (hmemT y).1 hyT + rcases Nat.lt_or_ge j (i + 1) with h' | h' + · have := sorted_le hmono (show j ≤ i by omega) (by omega) + linarith [hy.1] + · have := sorted_le hmono h' hj + linarith [hy.2] + have hsubside : ∀ {i}, i < k → Ioo (t i) (t (i + 1)) ⊆ Ioo 0 π := fun {i} hi y hy ↦ + ⟨lt_of_le_of_lt (hrange (by omega)).1 hy.1, lt_of_lt_of_le hy.2 (hrange (by omega)).2⟩ + -- The vertices of the frame on the rest of the cuff. + set T' : Set ℝ := {y ∈ Icc π (2 * π) | g y ∈ χ.Φ.V} with hT' + have hT'f : T'.Finite := by + exact finite_angles_of_frame_vertices (S := S) (β := β) χ g hpos hinj + have hπT' : π ∈ T' := ⟨⟨le_rfl, by linarith⟩, hb.symm ▸ hbV⟩ + have h2πT' : 2 * π ∈ T' := ⟨⟨by linarith, le_rfl⟩, hg2.symm ▸ haV⟩ + obtain ⟨q, w, hq, hw0, hwq, hwm, hmemT'⟩ := + exists_sorted hT'f (by linarith : π < 2 * π) hπT' h2πT' (fun _ h => h.1) + have hwr : ∀ {i}, i ≤ q → w i ∈ Icc π (2 * π) := fun {i} hi ↦ by + have : w i ∈ T' := (hmemT' _).2 ⟨i, hi, rfl⟩ + exact this.1 + have hgapT' : ∀ {i}, i < q → ∀ y ∈ Ioo (w i) (w (i + 1)), y ∉ T' := by + intro i hi y hy hyT + obtain ⟨j, hj, rfl⟩ := (hmemT' y).1 hyT + rcases Nat.lt_or_ge j (i + 1) with h' | h' + · have := sorted_le hwm (show j ≤ i by omega) (by omega) + linarith [hy.1] + · have := sorted_le hwm h' hj + linarith [hy.2] + have hsidesR : ∀ {i}, i < q → g '' Ioo (w i) (w (i + 1)) ∈ χ.Φ.sides := fun {i} hi ↦ by + have h₁ : g (w i) ∈ χ.Φ.V := ((hmemT' _).2 ⟨i, by omega, rfl⟩ : w i ∈ T').2 + have h₂ : g (w (i + 1)) ∈ χ.Φ.V := ((hmemT' _).2 ⟨i + 1, by omega, rfl⟩ : w (i + 1) ∈ T').2 + refine ioo_mem_arcComponents f (hwm i hi) h₁ h₂ (fun y hy ↦ ?_) hlocalB + have hyr : y ∈ Icc π (2 * π) := ⟨(hwr (i := i) (by omega)).1.trans hy.1.le, hy.2.le.trans (hwr + (i := i + 1) (by omega)).2⟩ + exact ⟨hΘb (cuffAngle_mem f y), fun hV ↦ hgapT' hi y hy ⟨hyr, hV⟩⟩ + have hdisjR : ∀ {x y}, x ∈ Ioo 0 π → y ∈ Ioo π (2 * π) → g x ≠ g y := fun hx hy he ↦ by + have := hinj ⟨hx.1.le, by linarith [hx.2]⟩ ⟨by linarith [hy.1], hy.2⟩ he + linarith [hx.2, hy.1] + have hshortR : ∀ {i}, i < q → (i = 0 ∨ i + 1 = q) → g '' Ioo (w i) (w (i + 1)) ∈ χ.Φ.shortSides + := by + exact extreme_intervals_are_short_sides (S := S) (β := β) χ (side := side) hside a b htab g hb + hgc hside_eq haV hbV hg2 q w hw0 hwq hwm hwr hsidesR hdisjR + have hshorts : ∀ s ∈ χ.Φ.shortSides, s ⊆ Θ → s ⊆ g '' Ioo π (2 * π) ∧ ∃ i < q, s = g '' Ioo (w i) + (w (i + 1)) := by + exact short_sides_on_cuff_are_intervals (S := S) (β := β) χ (side + := side) hside Θ a b f g rfl ha + hb hside_eq haV hbV q w hw0 hwq hmemT' hsidesR + let e : ℕ → Set S := fun i ↦ if i = 0 then g '' Ioo (w (q - 1)) (w (q - 1 + 1)) else if i + = k + 1 then g '' Ioo (w 0) (w (0 + 1)) else g '' Ioo (t (i - 1)) (t i) + have he0 : e 0 = g '' Ioo (w (q - 1)) (w (q - 1 + 1)) := ite_eq_left rfl + have hek : e (k + 1) = g '' Ioo (w 0) (w (0 + 1)) := by + change (if k + 1 = 0 then _ else if k + 1 = k + 1 then _ else _) = _ + rw [ite_eq_right (by omega), ite_eq_left rfl] + have hei : ∀ i < k, e (i + 1) = g '' Ioo (t i) (t (i + 1)) := fun i hi ↦ by + change (if i + 1 = 0 then _ else if i + 1 = k + 1 then _ else _) = _ + rw [ite_eq_right (by omega), ite_eq_right (by omega), Nat.add_sub_cancel] + have hq1 : q - 1 + 1 = q := by omega + have hmemE : ∀ i < k, e (i + 1) ∈ Γ.E := fun i hi ↦ by + exact successive_drawing_vertex_angles_bound_edge (S := S) (Γ := Γ) Θ f g rfl hΘb + hlocalU k t hmono hmemT hrange hgapT e hei i hi + refine ⟨Θ, hΘ, f, a, b, k, t, e, hsΘ, ?_⟩ + refine + { head := by rw [hγ]; rfl + last := by rw [hγ]; rfl + ga := ha + gb := hb + side_eq := hside_eq + k_pos := hk + t0 := h0 + tk := hkt + mono := hmono + e_eq := hei + mem := fun i hi ↦ ?_ + all := fun c hc hsub ↦ ?_ + e_zero := ⟨w (q - 1), (hwr (by omega)).1, ?_, ?_⟩ + e_last := ⟨w 1, ?_, (hwr (i := 1) (by omega)).2, ?_⟩ + short := fun s hs hne ↦ ?_ + rest := fun s hs hsub ↦ (hshorts s hs hsub).1 + short_zero := by + rw [he0] + exact hshortR (by omega) (Or.inr hq1) } + · rcases Nat.eq_zero_or_pos i with rfl | hi₀ + · rw [he0] + exact hfit.short_sides (hshortR (by omega) (Or.inr hq1)) + · rcases eq_or_ne i (k + 1) with rfl | hik + · rw [hek] + exact hfit.short_sides (hshortR (by omega) (Or.inl rfl)) + · obtain ⟨j, rfl⟩ : ∃ j, i = j + 1 := ⟨i - 1, by omega⟩ + exact hmemE j (by omega) + · obtain ⟨z, hz⟩ := hc.1 + have hzs := hsub hz + rw [hside_eq] at hzs + obtain ⟨y, hy, rfl⟩ := hzs + rcases sorted_cases (t := t) (k := k) (y := y) (h0.trans_le hy.1.le) + (by rw [hkt]; exact hy.2.le) with ⟨i, hi, rfl⟩ | ⟨i, hi, hm⟩ + · exact absurd ((hmemT _).2 ⟨i, hi, rfl⟩ : t i ∈ T).2 fun hV ↦ Γ.disjoint_V hc hz hV + · have hm' : g y ∈ e (i + 1) := by + rw [hei i hi] + exact mem_image_of_mem g hm + exact ⟨i + 1, by omega, by omega, GM11.arcComponent_eq hc (hmemE i hi) hz hm'⟩ + · have := hwm (q - 1) (by omega) + rw [hq1, hwq] at this + exact this + · rw [he0, hq1, hwq] + · have := hwm 0 (by omega) + rw [hw0] at this + exact this + · rw [hek, hw0] + · exact short_side_touching_long_side_is_extreme (S := S) (β := β) hS χ (side := side) Θ hΘ hLΘ + g himg hpos hgc hinj k q w hw0 hwq hwm hwr hshorts e he0 hek s hs hne + +end + +namespace IsSideEdges + +variable {χ : ColourScheme S β} {Γ : Painting S} {side Θ : Set S} {f : Circle ≃ₜ Θ} {a b : S} {k : + ℕ} {t : ℕ → ℝ} {e : ℕ → Set S} + +omit [T2Space S] in +theorem e_eq' (h : IsSideEdges χ Γ side Θ f a b k t e) {l : ℕ} (h₁ : 1 ≤ l) (h₂ : l ≤ k) : e l + = cuffPoint f '' Ioo (t (l - 1)) (t l) := by + obtain ⟨j, rfl⟩ : ∃ j, l = j + 1 := ⟨l - 1, by omega⟩ + simpa using h.e_eq j (by omega) + +omit [T2Space S] in +theorem t_range (h : IsSideEdges χ Γ side Θ f a b k t e) {i : ℕ} (hi : i ≤ k) : t i ∈ Icc 0 π := by + constructor + · rw [← h.t0] + exact sorted_le h.mono (by omega) hi + · rw [← h.tk] + exact sorted_le h.mono hi le_rfl + +omit [T2Space S] in +theorem ioo_subset (h : IsSideEdges χ Γ side Θ f a b k t e) {l : ℕ} (h₁ : 1 ≤ l) (h₂ : l ≤ k) : Ioo + (t (l - 1)) (t l) ⊆ Ioo 0 π := fun _ hy ↦ + ⟨lt_of_le_of_lt (h.t_range (by omega)).1 hy.1, lt_of_lt_of_le hy.2 (h.t_range h₂).2⟩ + +omit [T2Space S] in +theorem subset_side (h : IsSideEdges χ Γ side Θ f a b k t e) {l : ℕ} (h₁ : 1 ≤ l) (h₂ : l + ≤ k) : e l ⊆ side := by + rw [h.e_eq' h₁ h₂, h.side_eq] + exact image_mono (h.ioo_subset h₁ h₂) + +omit [T2Space S] in +theorem lt_gap (h : IsSideEdges χ Γ side Θ f a b k t e) {l : ℕ} (h₁ : 1 ≤ l) (h₂ : l ≤ k) : t + (l - 1) < t l := by + obtain ⟨j, rfl⟩ : ∃ j, l = j + 1 := ⟨l - 1, by omega⟩ + simpa using h.mono j (by omega) + +omit [T2Space S] in +/-- A point of each edge, at the middle of its angles. -/ +theorem exists_point (h : IsSideEdges χ Γ side Θ f a b k t e) {l : ℕ} (h₁ : 1 ≤ l) (h₂ : l + ≤ k) : ∃ x ∈ Ioo (t (l - 1)) (t l), cuffPoint f x ∈ e l := by + obtain ⟨x, hx⟩ := nonempty_Ioo.2 (h.lt_gap h₁ h₂) + exact ⟨x, hx, h.e_eq' h₁ h₂ ▸ mem_image_of_mem _ hx⟩ + +omit [T2Space S] in +theorem angle_of_mem (h : IsSideEdges χ Γ side Θ f a b k t e) {l : ℕ} (h₁ : 1 ≤ l) (h₂ : l + ≤ k) {z : S} (hz : z ∈ e l) : ∃ x ∈ Ioo (t (l - 1)) (t l), cuffPoint f x = z := by + rw [h.e_eq' h₁ h₂] at hz + exact hz + +omit [T2Space S] in +theorem pos_angle (h : IsSideEdges χ Γ side Θ f a b k t e) {l : ℕ} (h₁ : 1 ≤ l) (h₂ : l + ≤ k) {x : ℝ} (hx : x ∈ Ioo (t (l - 1)) (t l)) : x ∈ Ioo 0 π := + h.ioo_subset h₁ h₂ hx + +omit [T2Space S] in +/-- Two edges along the side in order have angles in order. -/ +theorem lt_of_lt (h : IsSideEdges χ Γ side Θ f a b k t e) {l l' : ℕ} (hl : 1 ≤ l) (h₂ : l < l') + (hl' : l' ≤ k) {x y : ℝ} (hx : x ∈ Ioo (t (l - 1)) (t l)) + (hy : y ∈ Ioo (t (l' - 1)) (t l')) : x < y := by + have := sorted_le h.mono (show l ≤ l' - 1 by omega) (by omega) + linarith [hx.2, hy.1] + +omit [T2Space S] in +theorem injOn_edges (h : IsSideEdges χ Γ side Θ f a b k t e) {l l' : ℕ} (hl : 1 ≤ l) (h₂ : l < l') + (hl' : l' ≤ k) : e l ≠ e l' := by + intro he + obtain ⟨x, hx, hxe⟩ := h.exists_point hl (by omega) + rw [he] at hxe + obtain ⟨y, hy, hye⟩ := h.angle_of_mem (by omega) hl' hxe + have hlt := h.lt_of_lt hl h₂ hl' hx hy + have hx₀ := h.pos_angle hl (by omega) hx + have hy₀ := h.pos_angle (by omega) hl' hy + have := cuffAngle_injOn f (a := 0) (x := y) (y := x) ⟨hy₀.1.le, by linarith [hy₀.2, Real.pi_pos]⟩ + ⟨hx₀.1.le, by linarith [hx₀.2, Real.pi_pos]⟩ hye + linarith + +omit [T2Space S] in +theorem inOrder (h : IsSideEdges χ Γ side Θ f a b k t e) {l l' : ℕ} (hl : 1 ≤ l) (h₂ : l < l') + (hl' : l' ≤ k) {x y : S} (hx : x ∈ e l) (hy : y ∈ e l') : InOrderOn Θ a x y b := by + obtain ⟨s₁, hs₁, rfl⟩ := h.angle_of_mem hl (by omega) hx + obtain ⟨s₂, hs₂, rfl⟩ := h.angle_of_mem (by omega) hl' hy + have h₁ := h.pos_angle hl (by omega) hs₁ + have h₃ := h.pos_angle (by omega) hl' hs₂ + exact ⟨f, 0, s₁, s₂, π, h₁.1.le, (h.lt_of_lt hl h₂ hl' hs₁ hs₂).le, h₃.2.le, + by linarith [Real.pi_pos], h.ga, rfl, rfl, h.gb⟩ + +omit [T2Space S] in +/-- Each point of `side` lies on the closure of an edge of the side. -/ +theorem side_subset_of_closed (h : IsSideEdges χ Γ side Θ f a b k t e) {J : Set S} + (hJ : IsClosed J) (hsub : ∀ l, 1 ≤ l → l ≤ k → e l ⊆ J) : side ⊆ J := by + have hg := continuous_cuffAngle f + have hcl : ∀ l, 1 ≤ l → l ≤ k → cuffPoint f '' Icc (t (l - 1)) (t l) ⊆ J := by + intro l h₁ h₂ + have hne := (h.lt_gap h₁ h₂).ne + rw [← closure_Ioo hne] + refine (image_closure_subset_closure_image hg).trans (closure_minimal ?_ hJ) + rw [← h.e_eq' h₁ h₂] + exact hsub l h₁ h₂ + rw [h.side_eq] + rintro _ ⟨y, hy, rfl⟩ + rcases sorted_cases (t := t) (k := k) (y := y) (by rw [h.t0]; exact hy.1.le) + (by rw [h.tk]; exact hy.2.le) with ⟨i, hi, rfl⟩ | ⟨i, hi, hm⟩ + · rcases Nat.eq_zero_or_pos i with rfl | hi₀ + · rw [h.t0] at hy + exact absurd hy.1 (lt_irrefl _) + · exact hcl i hi₀ hi (mem_image_of_mem _ ⟨(h.lt_gap hi₀ hi).le, le_rfl⟩) + · refine hsub (i + 1) (by omega) (by omega) ?_ + rw [h.e_eq i hi] + exact mem_image_of_mem _ hm + +/-- **A connected set with points on two edges of the side holds the edges between them, or those +around the other way.** -/ +theorem between (h : IsSideEdges χ Γ side Θ f a b k t e) {J : Set S} (hJ : IsPreconnected J) + (hJΘ : J ⊆ Θ) {i j : ℕ} (hi : 1 ≤ i) (hij : i < j) (hj : j ≤ k) (h₁ : e i ⊆ J) + (h₂ : e j ⊆ J) : (∀ l, i ≤ l → l ≤ j → e l ⊆ J) ∨ ((∀ l, l ≤ i → e l ⊆ J) ∧ ∀ l, j ≤ l → l + ≤ k + 1 → e l ⊆ J) := by + obtain ⟨x, hx, hxe⟩ := h.exists_point hi (by omega) + obtain ⟨y, hy, hye⟩ := h.exists_point (by omega) hj + have hlt := h.lt_of_lt hi hij hj hx hy + have hx₀ := h.pos_angle hi (by omega) hx + have hy₀ := h.pos_angle (by omega) hj hy + have hpos := Real.pi_pos + rcases arc_of_preconnected f hJ hJΘ hlt.le (by linarith [hy₀.2, hx₀.1]) (h₁ hxe) + (h₂ hye) with hc | hc + · left + intro l hl₁ hl₂ + rcases eq_or_lt_of_le hl₁ with rfl | hl₁ + · exact h₁ + rcases eq_or_lt_of_le hl₂ with rfl | hl₂ + · exact h₂ + rw [h.e_eq' (by omega) (by omega)] + rintro _ ⟨z, hz, rfl⟩ + have h₃ := sorted_le h.mono (show i ≤ l - 1 by omega) (by omega) + have h₄ := sorted_le h.mono (show l ≤ j - 1 by omega) (by omega) + exact hc z ⟨by linarith [hx.2, hz.1], by linarith [hz.2, hy.1]⟩ + · right + constructor + · intro l hl + rcases eq_or_lt_of_le hl with rfl | hl + · exact h₁ + rcases Nat.eq_zero_or_pos l with rfl | hl₀ + · obtain ⟨d, hd₁, hd₂, hd⟩ := h.e_zero + rw [hd] + rintro _ ⟨z, hz, rfl⟩ + exact hc z ⟨by linarith [hz.1, hy₀.2], by linarith [hz.2, hx₀.1]⟩ + · rw [h.e_eq' hl₀ (by omega)] + rintro _ ⟨z, hz, rfl⟩ + have hzp := h.pos_angle hl₀ (by omega) hz + rw [← cuffAngle_add_two_pi] + have h₃ := sorted_le h.mono (show l ≤ i - 1 by omega) (by omega) + exact hc _ ⟨by linarith [hy₀.2, hzp.1], by linarith [hz.2, hx.1]⟩ + · intro l hl₁ hl₂ + rcases eq_or_lt_of_le hl₁ with rfl | hl₁ + · exact h₂ + rcases eq_or_lt_of_le hl₂ with rfl | hl₂ + · obtain ⟨c', hc₁, hc₂, hd⟩ := h.e_last + rw [hd] + rintro _ ⟨z, hz, rfl⟩ + exact hc z ⟨by linarith [hz.1, hy₀.2], by linarith [hz.2, hx₀.1]⟩ + · rw [h.e_eq' (by omega) (by omega)] + rintro _ ⟨z, hz, rfl⟩ + have hzp := h.pos_angle (by omega) (by omega) hz + have h₃ := sorted_le h.mono (show j ≤ l - 1 by omega) (by omega) + exact hc z ⟨by linarith [hy.2, hz.1], by linarith [hzp.2, hx₀.1]⟩ + +/-- **A connected set with a point on an edge of the side and a short side holds what lies on one +way around.** -/ +theorem between_short (h : IsSideEdges χ Γ side Θ f a b k t e) {J : Set S} (hJ : IsPreconnected J) + (hJΘ : J ⊆ Θ) {i : ℕ} (hi : 1 ≤ i) (hik : i ≤ k) (h₁ : e i ⊆ J) {s : Set S} + (hs : s ∈ χ.Φ.shortSides) (hsΓ : s ∈ Γ.E) (hsΘ : s ⊆ Θ) (h₂ : s ⊆ J) : (∀ l, i ≤ l → l ≤ k + 1 + → e l ⊆ J) ∨ ∀ l, l ≤ i → e l ⊆ J := by + obtain ⟨x, hx, hxe⟩ := h.exists_point hi hik + have hx₀ := h.pos_angle hi hik hx + obtain ⟨z₀, hz₀⟩ := hs.1.1 + obtain ⟨y, hy, hye⟩ := h.rest s hs hsΘ hz₀ + have hpos := Real.pi_pos + have hy₂ : cuffPoint f y ∈ J := by rw [hye]; exact h₂ hz₀ + have hlast := h.mem (k + 1) le_rfl + have hzero := h.mem 0 (by omega) + rcases arc_of_preconnected f hJ hJΘ (x₁ := x) (x₂ := y) (by linarith [hx₀.2, hy.1]) + (by linarith [hy.2, hx₀.1]) (h₁ hxe) hy₂ with hc | hc + · left + intro l hl₁ hl₂ + rcases eq_or_lt_of_le hl₁ with rfl | hl₁ + · exact h₁ + rcases eq_or_lt_of_le hl₂ with rfl | hl₂ + · obtain ⟨c', hc₁, hc₂, hd⟩ := h.e_last + by_cases hin : y < c' + · have hyl : cuffPoint f y ∈ e (k + 1) := by + rw [hd] + exact mem_image_of_mem _ ⟨hy.1, hin⟩ + have heq : e (k + 1) = s := GM11.arcComponent_eq hlast hsΓ hyl (hye ▸ hz₀) + rw [heq] + exact h₂ + · rw [hd] + rintro _ ⟨z, hz, rfl⟩ + exact hc z ⟨by linarith [hz.1, hx₀.2], by linarith [hz.2, not_lt.1 hin]⟩ + · rw [h.e_eq' (by omega) (by omega)] + rintro _ ⟨z, hz, rfl⟩ + have hzp := h.pos_angle (by omega) (by omega) hz + have h₃ := sorted_le h.mono (show i ≤ l - 1 by omega) (by omega) + exact hc z ⟨by linarith [hx.2, hz.1], by linarith [hzp.2, hy.1]⟩ + · right + intro l hl + rcases eq_or_lt_of_le hl with rfl | hl + · exact h₁ + rcases Nat.eq_zero_or_pos l with rfl | hl₀ + · obtain ⟨d, hd₁, hd₂, hd⟩ := h.e_zero + by_cases hin : d < y + · have hyl : cuffPoint f y ∈ e 0 := by + rw [hd] + exact mem_image_of_mem _ ⟨hin, hy.2⟩ + have heq : e 0 = s := GM11.arcComponent_eq hzero hsΓ hyl (hye ▸ hz₀) + rw [heq] + exact h₂ + · rw [hd] + rintro _ ⟨z, hz, rfl⟩ + exact hc z ⟨by linarith [hz.1, not_lt.1 hin], by linarith [hz.2, hx₀.1]⟩ + · rw [h.e_eq' hl₀ (by omega)] + rintro _ ⟨z, hz, rfl⟩ + have hzp := h.pos_angle hl₀ (by omega) hz + rw [← cuffAngle_add_two_pi] + have h₃ := sorted_le h.mono (show l ≤ i - 1 by omega) (by omega) + exact hc _ ⟨by linarith [hy.2, hzp.1], by linarith [hz.2, hx.1]⟩ + +/-- A connected subset of the side with points on two edges holds the edges between them. -/ +theorem between_of_side (h : IsSideEdges χ Γ side Θ f a b k t e) {X : Set S} + (hX : IsPreconnected X) (hXs : X ⊆ side) (hsΘ : side ⊆ Θ) {i j : ℕ} (hi : 1 ≤ i) (hij : i < j) + (hj : j ≤ k) (h₁ : e i ⊆ X) (h₂ : e j ⊆ X) : ∀ l, i ≤ l → l ≤ j → e l ⊆ X := by + rcases h.between hX (hXs.trans hsΘ) hi hij hj h₁ h₂ with hc | ⟨-, hc⟩ + · exact hc + · exfalso + obtain ⟨c', hc₁, hc₂, hd⟩ := h.e_last + obtain ⟨y, hy⟩ := nonempty_Ioo.2 hc₁ + have hy' : cuffPoint f y ∈ e (k + 1) := by + rw [hd] + exact mem_image_of_mem _ hy + have hys := hXs (hc (k + 1) (by omega) le_rfl hy') + rw [h.side_eq] at hys + obtain ⟨x, hx, he⟩ := hys + have hpos := Real.pi_pos + have := cuffAngle_injOn f (a := 0) (x := x) (y := y) ⟨hx.1.le, by linarith [hx.2]⟩ ⟨by linarith + [hy.1], by rw [zero_add]; linarith [hy.2]⟩ he + linarith [hx.2, hy.1] + +end IsSideEdges + +/-- **A long side touches a short side.** -/ +theorem exists_short_touching (hS : IsSurface S) (χ : ColourScheme S β) {Γ : Painting S} + (hfit : Γ.Fits χ.Φ) {side : Set S} (hside : side ∈ χ.Φ.longSides) : + ∃ s ∈ χ.Φ.shortSides, (closure s ∩ closure side).Nonempty := by + obtain ⟨Θ, -, f, a, b, k, t, e, -, hE⟩ := exists_sideEdges hS χ hfit hside + obtain ⟨d, -, hd, he⟩ := hE.e_zero + refine ⟨_, hE.short_zero, a, ?_, ?_⟩ + · have h₁ : (2 * π : ℝ) ∈ closure (Ioo d (2 * π)) := by + rw [closure_Ioo hd.ne] + exact ⟨hd.le, le_rfl⟩ + have h₂ := image_closure_subset_closure_image (continuous_cuffAngle f) (mem_image_of_mem _ h₁) + have h₃ : cuffPoint f (2 * π) = a := by + have := cuffAngle_add_two_pi f 0 + rw [zero_add] at this + rw [this, hE.ga] + rwa [← he, h₃] at h₂ + · have h₁ : (0 : ℝ) ∈ closure (Ioo 0 π) := by + rw [closure_Ioo pi_pos.ne] + exact ⟨le_rfl, pi_pos.le⟩ + have h₂ := image_closure_subset_closure_image (continuous_cuffAngle f) (mem_image_of_mem _ h₁) + rwa [← hE.side_eq, hE.ga] at h₂ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/SideEnds.lean b/LeanPool/GraphMinor/GM19/SideEnds.lean new file mode 100644 index 0000000000..41c3dae3be --- /dev/null +++ b/LeanPool/GraphMinor/GM19/SideEnds.lean @@ -0,0 +1,233 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.SideCoord +public import LeanPool.GraphMinor.GM19.Section15o + +/-! +# The ends along a side + +Step (1) of the proof of Graph Minors XIX, (15.2) gives edges of `Γ` along each long side, in the +order of the edges of `Γ₀`. Here we turn this into what step (2) needs. Each end `y` of `β(e)` has a +vertex `endVertex y` of `e`, and along a side the vertices come in the order of the ends +(`lineCoord_endVertex_le`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe w + +local notation "𝕀" => unitInterval + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + {cap : IsCappedSurface S Shat} {β : Type w} {χ : ColourScheme S β} + +namespace TangleDatum + +/-- The end `y` of `β(e)` corresponds to the vertex `v` of `e`. -/ +def IsEndOf (P₀ P : ColouredPainting χ) (b : Set S → Set S) (y v : S) : Prop := + ∃ e ∈ P₀.Γ.E, ∃ (i : ℕ) (hi : i < (P₀.Γ.γ e).length) (hi' : i < (P.Γ.γ (b e)).length), + (P₀.Γ.γ e)[i] = v ∧ (P.Γ.γ (b e))[i] = y + +open Classical in +/-- The vertex of `Γ₀` of an end. -/ +noncomputable def endVertex (P₀ P : ColouredPainting χ) (b : Set S → Set S) (y : S) : S := + if h : ∃ v, IsEndOf P₀ P b y v then h.choose else y + +variable {D : TangleDatum cap χ} {P₀ : ColouredPainting χ} {n : ℕ} {b : Set S → Set S} + +omit [T2Space S] in +theorem exists_isEndOf (hb : D.IsEdgeMap P₀ n b) {e : Set S} (he : e ∈ P₀.Γ.E) {y : S} + (hy : y ∈ tilde (b e)) : ∃ v ∈ tilde e, IsEndOf P₀ D.P b y v := by + have hbe := hb.mem e he + have hy' : y ∈ {v | v ∈ D.P.Γ.γ (b e)} := by rw [D.P.Γ.γ_set _ hbe]; exact hy + obtain ⟨i, hi', rfl⟩ := List.mem_iff_getElem.mp hy' + have hlen : (P₀.Γ.γ e).length = (D.P.Γ.γ (b e)).length := by + rw [P₀.Γ.length_γ_eq he, D.P.Γ.length_γ_eq hbe, hb.size e he] + have hi : i < (P₀.Γ.γ e).length := hlen ▸ hi' + refine ⟨(P₀.Γ.γ e)[i], ?_, e, he, i, hi, hi', rfl, rfl⟩ + have : (P₀.Γ.γ e)[i] ∈ {v | v ∈ P₀.Γ.γ e} := List.getElem_mem hi + rwa [P₀.Γ.γ_set _ he] at this + +theorem IsMatchSetting.isEndOf_unique (hM : D.IsMatchSetting P₀ n b) (hS : IsSurface S) {y v v' : + S} (h : IsEndOf P₀ D.P b y v) (h' : IsEndOf P₀ D.P b y v') : v = v' := by + by_contra hne + exact Set.disjoint_left.mp (hM.disjoint_endClass hS hne) ⟨y, h, rfl⟩ ⟨y, h', rfl⟩ + +theorem IsMatchSetting.endVertex_eq (hM : D.IsMatchSetting P₀ n b) (hS : IsSurface S) {y v : S} + (h : IsEndOf P₀ D.P b y v) : endVertex P₀ D.P b y = v := by + have hex : ∃ v, IsEndOf P₀ D.P b y v := ⟨v, h⟩ + rw [endVertex, dite_eq_left hex] + exact hM.isEndOf_unique hS hex.choose_spec h + +end TangleDatum + +omit [T2Space S] in +/-- A border edge lies along its side in the direction of the side. -/ +theorem exists_march_of_side {P : ColouredPainting χ} {s e : Set S} (hs : s ∈ χ.Φ.sides) {u w : S} + (hγ : χ.Φ.γ s = [u, w]) (σ : 𝕀 ≃ₜ closure s) (h0 : (σ 0).1 = u) (h1 : (σ 1).1 = w) + (he : e ∈ P.Γ.E) (hes : e ⊆ s) + (hbd : s ⊆ bd S) : ∃ a a', P.Γ.γ e = [a, a'] ∧ lineCoord σ a < lineCoord σ a' := by + have hb : Painting.IsBorder e := by + obtain ⟨x, hx⟩ : e.Nonempty := he.1 + exact ⟨x, hx, hbd (hes hx)⟩ + have h2 := (P.Γ.border_edge e he hb).1 + have hlen : (P.Γ.γ e).length = 2 := by rw [P.Γ.length_γ_eq he, h2] + obtain ⟨a, a', hl⟩ := List.length_eq_two.mp hlen + obtain ⟨f, t₁, t₂, ht, -, h3, h4, h5, h6⟩ := P.fits.border_dir e he hb s hs hes + rw [hl] at h5 h6 + rw [hγ] at h3 h4 + simp only [List.head?_cons, Option.some.injEq, List.getLast?_cons_cons, + List.getLast?_singleton] at h3 h4 h5 h6 + refine ⟨a, a', hl, ?_⟩ + rw [h5, h6] + exact lineCoord_lt_of_ends σ f (Subtype.ext (h3.symm.trans h0.symm)) (Subtype.ext + (h4.symm.trans h1.symm)) ht + +omit [T2Space S] in +/-- Edges along a side, in order, have closures in order. -/ +theorem lineCoord_le_of_borders {Γ : Painting S} {s c : Set S} {m : ℕ} {f : Fin m + → Set S} {u₀ u₁ : S} (h : TangleDatum.BordersInOrder χ Γ s c f u₀ u₁) (hs : s ∈ χ.Φ.sides) + (hc : IsClosed c) (hsc : s ⊆ c) {u w : S} + (hγ : χ.Φ.γ s = [u, w]) (σ : 𝕀 ≃ₜ closure s) (h0 : (σ 0).1 = u) (h1 : (σ 1).1 + = w) {i j : Fin m} (hij : i < j) {x y : S} (hx : x ∈ closure (f i)) (hy : y ∈ closure + (f j)) : lineCoord σ x ≤ lineCoord σ y := by + obtain ⟨h₁, h₂, -, h₄, h₅⟩ := h + rw [hγ] at h₁ h₂ + simp only [List.head?_cons, Option.some.injEq, List.getLast?_cons_cons, + List.getLast?_singleton] at h₁ h₂ + subst h₁ h₂ + have hnd := χ.Φ.γ_nodup s hs + rw [hγ] at hnd + have hne : u ≠ w := by simpa using hnd + have hset := χ.Φ.γ_set s hs + have huS : u ∉ s := by + have : u ∈ {v | v ∈ χ.Φ.γ s} := by rw [hγ]; simp + rw [hset] at this + exact this.2 + have hwS : w ∉ s := by + have : w ∈ {v | v ∈ χ.Φ.γ s} := by rw [hγ]; simp + rw [hset] at this + exact this.2 + have hLc : closure s ⊆ c := closure_minimal hsc hc + have hcl := continuousOn_lineCoord σ + have base : ∀ x ∈ f i, ∀ y ∈ f j, lineCoord σ x ≤ lineCoord σ y := fun x hx y hy => by + have hxs := (h₄ i).2 hx + have hys := (h₄ j).2 hy + exact lineCoord_le_of_inOrder hLc σ (h₅ i j hij x hx y hy) h0 h1 hne (subset_closure hxs) + (subset_closure hys) (fun e => huS (e ▸ hxs)) (fun e => hwS (e ▸ hxs)) (fun e => huS + (e ▸ hys)) + have step1 : ∀ y ∈ f j, lineCoord σ x ≤ lineCoord σ y := fun y hy => by + have hclosed : IsClosed (closure s ∩ lineCoord σ ⁻¹' Iic (lineCoord σ y)) + := hcl.preimage_isClosed_of_isClosed isClosed_closure isClosed_Iic + have hsub : f i ⊆ closure s ∩ lineCoord σ ⁻¹' Iic (lineCoord σ y) := fun x' hx' + => ⟨subset_closure ((h₄ i).2 hx'), base x' hx' y hy⟩ + exact (closure_minimal hsub hclosed hx).2 + have hclosed : IsClosed (closure s ∩ lineCoord σ ⁻¹' Ici (lineCoord σ x)) + := hcl.preimage_isClosed_of_isClosed isClosed_closure isClosed_Ici + have hsub : f j ⊆ closure s ∩ lineCoord σ ⁻¹' Ici (lineCoord σ x) := fun y' hy' + => ⟨subset_closure ((h₄ j).2 hy'), step1 y' hy'⟩ + exact (closure_minimal hsub hclosed hy).2 + +namespace TangleDatum + +variable {D : TangleDatum cap χ} {P₀ : ColouredPainting χ} {n : ℕ} {b : Set S → Set S} + +/-- **The vertices come in the order of the ends.** If `y` comes before `y'` along a side, then the +vertex of `y` is not after the vertex of `y'`. On a long side this is the order of step (1) together +with the +direction of each edge. On a short side the end and its vertex are the same point. -/ +theorem IsMatchSetting.lineCoord_endVertex_le (hM : D.IsMatchSetting P₀ n b) + (hS : IsSurface S) {s : Set S} (hs : s ∈ χ.Φ.sides) {u w : S} (hγ : χ.Φ.γ s = [u, w]) + (σ : 𝕀 ≃ₜ closure s) (h0 : (σ 0).1 = u) + (h1 : (σ 1).1 = w) {Θ : Set S} (hΘ : Θ ∈ cuffs S) (hsΘ : s ⊆ Θ) {e e' : Set S} + (he : e ∈ P₀.Γ.E) (he' : e' ∈ P₀.Γ.E) (hes : e ⊆ s) (hes' : e' ⊆ s) (hbs : b e ⊆ s) + (hbs' : b e' ⊆ s) + (hsh : s ∉ χ.Φ.longSides → b e = s) (hsh' : s ∉ χ.Φ.longSides → b e' = s) {y y' : S} + (hy : y ∈ tilde (b e)) (hy' : y' ∈ tilde (b e')) (hlt : lineCoord σ y < lineCoord σ y') : + lineCoord σ (endVertex P₀ D.P b y) ≤ lineCoord σ (endVertex P₀ D.P b y') := by + have hbd : s ⊆ bd S := hsΘ.trans (cuff_subset_bd ⟨Θ, hΘ⟩) + obtain ⟨v, hv, hv'⟩ := exists_isEndOf hM.edge he hy + obtain ⟨v₁, hv₁, hv₁'⟩ := exists_isEndOf hM.edge he' hy' + rw [hM.endVertex_eq hS hv', hM.endVertex_eq hS hv₁'] + by_cases hl : s ∈ χ.Φ.longSides + · obtain ⟨m, f, g, c, r, u₀, u₁, u₀', u₁', hX⟩ := hM.edge.side s hl + obtain ⟨p, rfl⟩ := hX.all₀ e he hes + obtain ⟨q, rfl⟩ := hX.all₀ e' he' hes' + rw [hX.map] at hy hbs + rw [hX.map] at hy' hbs' + have hcc : IsClosed c := ((cuff_statement S hS).2.2 _ hX.cuff).isCompact.isClosed + rcases lt_trichotomy p q with hpq | rfl | hpq + · exact lineCoord_le_of_borders hX.order₀ hs hcc hX.side_cuff hγ σ h0 h1 hpq hv.1 hv₁.1 + · obtain ⟨a, a', hl₁, hlt₁⟩ := exists_march_of_side (P := P₀) hs hγ σ h0 h1 he hes hbd + have hge := hM.edge.mem _ he + rw [hX.map] at hge + obtain ⟨c₀, c₁, hl₂, hlt₂⟩ := exists_march_of_side (P := D.P) hs hγ σ h0 h1 hge hbs hbd + have hset : ∀ {z}, z ∈ tilde (g p) → z = c₀ ∨ z = c₁ := fun {z} hz => by + have : z ∈ {v | v ∈ D.P.Γ.γ (g p)} := by rw [D.P.Γ.γ_set _ hge]; exact hz + rw [hl₂] at this + simpa using this + have hyc : y = c₀ := by + rcases hset hy with h | h + · exact h + · exfalso + rcases hset hy' with h' | h' + · rw [h, h'] at hlt + linarith + · rw [h, h'] at hlt + exact lt_irrefl _ hlt + have hyc' : y' = c₁ := by + rcases hset hy' with h | h + · exfalso + rw [hyc, h] at hlt + exact lt_irrefl _ hlt + · exact h + have hbl : b (f p) = g p := hX.map p + have e₀ : IsEndOf P₀ D.P b y a := + ⟨f p, he, 0, by simp [hl₁], by simp [hbl, hl₂], + by simp [hl₁], by simp [hbl, hl₂, hyc]⟩ + have e₁ : IsEndOf P₀ D.P b y' a' := + ⟨f p, he, 1, by simp [hl₁], by simp [hbl, hl₂], + by simp [hl₁], by simp [hbl, hl₂, hyc']⟩ + rw [hM.isEndOf_unique hS hv' e₀, hM.isEndOf_unique hS hv₁' e₁] + exact hlt₁.le + · exfalso + exact absurd hlt (not_lt.mpr (lineCoord_le_of_borders hX.order hs hcc hX.side_cuff hγ σ h0 h1 + hpq hy'.1 hy.1)) + · have hsh₁ : s ∈ χ.Φ.shortSides := ⟨hs, fun h => hl ⟨hs, h⟩⟩ + have hsE₀ := P₀.fits.short_sides hsh₁ + have heq : ∀ {e : Set S}, e ∈ P₀.Γ.E → e ⊆ s → e = s := fun {e} he hes => by + obtain ⟨x, hx⟩ : e.Nonempty := he.1 + exact arcComponent_eq he hsE₀ hx (hes hx) + have hbss : b s = s := hM.edge.short s hsh₁ + have hself : ∀ {z}, z ∈ tilde s → IsEndOf P₀ D.P b z z := fun {z} hz => by + have hγ₀ := short_γ_eq P₀ hsh₁ + have hγ₁ := short_γ_eq D.P hsh₁ + have hz' : z ∈ {v | v ∈ χ.Φ.γ s} := by rw [χ.Φ.γ_set s hs]; exact hz + obtain ⟨i, hi, rfl⟩ := List.mem_iff_getElem.mp hz' + have h1' : i < (P₀.Γ.γ s).length := by rw [hγ₀]; exact hi + have h2' : i < (D.P.Γ.γ (b s)).length := by rw [hbss, hγ₁]; exact hi + refine ⟨s, hsE₀, i, h1', h2', ?_, ?_⟩ + · simp only [hγ₀] + · simp only [hbss, hγ₁] + have hes₁ := heq he hes + have hes₂ := heq he' hes' + rw [hes₁, hbss] at hy + rw [hes₂, hbss] at hy' + rw [hM.isEndOf_unique hS hv' (hself hy), hM.isEndOf_unique hS hv₁' (hself hy')] + exact hlt.le + +end TangleDatum + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/SideScheme.lean b/LeanPool/GraphMinor/GM19/SideScheme.lean new file mode 100644 index 0000000000..fe7070265e --- /dev/null +++ b/LeanPool/GraphMinor/GM19/SideScheme.lean @@ -0,0 +1,276 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FreeFrame + +import LeanPool.GraphMinor.GM19.FragmentOrient + +/-! +# The colour scheme of the proof of (11.1) + +For the pieces `X₁, …, X_t` of the long side `S` the proof of (11.1) takes smaller ideals `{x : x ≱ +ω'ᵢ}`. Here `lab` says which element each side leaves out, and +`ColourScheme.restrictSides` is the colour scheme with these ideals. It has the same frame and order +as the scheme it comes from, so an inflation for it is one for that scheme +(`IsColouredLinearInflation.of_restrictSides`). The result used later is `wellBehaved_side`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +universe w + +variable {S S₁ : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace S₁] [T2Space S₁] {β : + Type w} + +/-- The ideal of the elements that are not above `w`. -/ +def QuasiOrder.withoutAbove (Ω : QuasiOrder β) (w : β) : QuasiOrder β where + E := {x ∈ Ω.E | ¬ Ω.le w x} + le := Ω.le + refl x hx := Ω.refl x hx.1 + trans x hx y hy z hz := Ω.trans x hx.1 y hy.1 z hz.1 + +theorem QuasiOrder.isWQO_withoutAbove {Ω : QuasiOrder β} (h : Ω.IsWQO) (w : β) : + (Ω.withoutAbove w).IsWQO := fun f hf ↦ h f fun i ↦ (hf i).1 + +theorem QuasiOrder.isStrictSubIdeal_withoutAbove {Ω : QuasiOrder β} {w : β} (hw : w ∈ Ω.E) : + (Ω.withoutAbove w).IsStrictSubIdeal Ω := by + refine ⟨⟨fun _ h ↦ h.1, fun x' hx' x hx hle ↦ ⟨hx, fun hl ↦ hx'.2 (Ω.trans w hw x hx x' hx'.1 hl + hle)⟩, fun _ _ _ _ ↦ Iff.rfl⟩, fun he ↦ ?_⟩ + have : w ∈ (Ω.withoutAbove w).E := he ▸ hw + exact this.2 (Ω.refl w hw) + +/-- The order of a side, with the elements above `lab R` left out. -/ +def restrictΩ (χ' : ColourScheme S₁ β) (lab : Set S₁ → Option β) (R : Set S₁) : QuasiOrder β := + match lab R with + | some w => (χ'.ΩS R).withoutAbove w + | none => χ'.ΩS R + +omit [T2Space S₁] in +theorem restrictΩ_none {χ' : ColourScheme S₁ β} {lab : Set S₁ → Option β} {R : Set S₁} (h : lab R + = none) : restrictΩ χ' lab R = χ'.ΩS R := by + simp [restrictΩ, h] + +omit [T2Space S₁] in +theorem restrictΩ_some {χ' : ColourScheme S₁ β} {lab : Set S₁ → Option β} {R : Set S₁} {w : β} + (h : lab R = some w) : restrictΩ χ' lab R = (χ'.ΩS R).withoutAbove w := by + simp [restrictΩ, h] + +/-- The colour scheme with the smaller orders. -/ +def ColourScheme.restrictSides (χ' : ColourScheme S₁ β) (lab : Set S₁ → Option β) + (hlab : ∀ R ∈ χ'.Φ.shortSides, lab R = none) : ColourScheme S₁ β where + isSurface := χ'.isSurface + connected := χ'.connected + Φ := χ'.Φ + Ω2 := χ'.Ω2 + Ω3 := χ'.Ω3 + ΩS := restrictΩ χ' lab + shortElem := χ'.shortElem + isWQO_2 := χ'.isWQO_2 + isWQO_3 := χ'.isWQO_3 + isWQO_S R hR := by + cases h : lab R with + | none => rw [restrictΩ_none h]; exact χ'.isWQO_S R hR + | some w => rw [restrictΩ_some h]; exact QuasiOrder.isWQO_withoutAbove (χ'.isWQO_S R hR) w + short_singleton R hR := by + rw [restrictΩ_none (hlab R hR)] + exact χ'.short_singleton R hR + +/-- A coloured painting whose colours avoid what `lab` leaves out, as a painting of the smaller +scheme. -/ +def ColouredPainting.restrictSides {χ' : ColourScheme S₁ β} (P : ColouredPainting χ') (lab : Set S₁ + → Option β) (hlab : ∀ R ∈ χ'.Φ.shortSides, lab R = none) + (hc : ∀ e ∈ P.Γ.E, ∀ R ∈ χ'.Φ.sides, BordersSide e R → ∀ w, lab R = some w → ¬ (χ'.ΩS R).le w + (P.φ e)) : ColouredPainting (χ'.restrictSides lab hlab) where + Γ := P.Γ + φ := P.φ + fits := P.fits + internal_2_mem := P.internal_2_mem + internal_3_mem := P.internal_3_mem + border_mem e he R hR hb := by + change P.φ e ∈ (restrictΩ χ' lab R).E + cases h : lab R with + | none => rw [restrictΩ_none h]; exact P.border_mem e he R hR hb + | some w => rw [restrictΩ_some h]; exact ⟨P.border_mem e he R hR hb, hc e he R hR hb w h⟩ + +omit [T2Space S₁] in +theorem IsColouredLinearInflation.of_restrictSides {χ' : ColourScheme S₁ β} {P Q : ColouredPainting + χ'} {lab : Set S₁ → Option β} {hlab : ∀ R ∈ χ'.Φ.shortSides, lab R = none} + {hP : ∀ e ∈ P.Γ.E, ∀ R ∈ χ'.Φ.sides, BordersSide e R → ∀ w, lab R = some w → ¬ (χ'.ΩS R).le w + (P.φ e)} + {hQ : ∀ e ∈ Q.Γ.E, ∀ R ∈ χ'.Φ.sides, BordersSide e R → ∀ w, lab R = some w → ¬ (χ'.ΩS R).le w + (Q.φ e)} {σv : S₁ → Set S₁} {σe : Set S₁ → Set S₁} + (h : IsColouredLinearInflation (χ'.restrictSides lab hlab) (P.restrictSides lab hlab hP) + (Q.restrictSides lab hlab hQ) σv σe) : IsColouredLinearInflation χ' P Q σv σe := by + refine ⟨⟨h.isInflation, h.respects, h.le_internal_2, h.le_internal_3, fun e he R hR hb ↦ ?_⟩, + h.isLinear⟩ + have := h.le_border e he R hR hb + change (restrictΩ χ' lab R).le _ _ at this + cases hl : lab R with + | none => rwa [restrictΩ_none hl] at this + | some w => rwa [restrictΩ_some hl] at this + + +variable [Nonempty S₁] {χ : ColourScheme S β} {K : Drawing S} {ψ : S₁ → S} {Γ : Painting S} + +omit [Nonempty S₁] in +/-- A label is missing on each short side, if labels sit only over `side`. -/ +theorem lab_short (D : FrameData χ.Φ Γ K ψ) (hF : IsFeature χ.Φ K) (flip : Set S₁ → Bool) + (a₀ : β) {side : Set S} (hside : side ∈ χ.Φ.longSides) {lab : Set S₁ → Option β} + (hnone : ∀ R, ¬ ψ '' R ⊆ side → lab R = none) : ∀ R ∈ (fragScheme χ a₀ D hF flip).Φ.shortSides, + lab R = none := fun R hR ↦ by + refine hnone R fun hsub ↦ hR.2 ⟨side, hside, hsub⟩ + +open Classical in +omit [Nonempty S₁] in +/-- **The colour scheme of (11.1) is a refinement of `χ`.** -/ +theorem restrictSides_isRefinement (D : FrameData χ.Φ Γ K ψ) (hF : IsFeature χ.Φ K) (flip : Set S₁ + → Bool) (a₀ : β) (hhom : Nonempty (S₁ ≃ₜ S)) (hinj : Function.Injective ψ) {side : Set S} + (hside : side ∈ χ.Φ.longSides) {lab : Set S₁ → Option β} (hnone : ∀ R, ¬ ψ '' R ⊆ side → lab R + = none) + (hsome : ∀ R ∈ arcComponentsIn (bd S₁ \ pullFrameV χ.Φ K ψ), ψ '' R ⊆ side → ∃ w ∈ + (χ.ΩS side).E, lab R = some w) + (hkeep : ∀ s ∈ χ.Φ.longSides, s ≠ side → (s ∩ range ψ) \ K.U = ∅ ∨ IsPathConnected + ((s ∩ range ψ) \ K.U)) : + ((fragScheme χ a₀ D hF flip).restrictSides lab (lab_short D hF flip a₀ hside + hnone)).IsRefinement χ := by + set χ₁ := fragScheme χ a₀ D hF flip with hχ₁ + have hlongs : ∀ R, R ∈ χ₁.Φ.longSides ↔ R ∈ arcComponentsIn (bd S₁ \ pullFrameV χ.Φ K ψ) + ∧ ∃ s ∈ χ.Φ.longSides, ψ '' R ⊆ s := fun R ↦ Iff.rfl + let f : Set S₁ → Set S := fun R ↦ if h : ∃ s ∈ χ.Φ.longSides, ψ '' R ⊆ s then h.choose else ∅ + have hf : ∀ {R}, (∃ s ∈ χ.Φ.longSides, ψ '' R ⊆ s) → f R ∈ χ.Φ.longSides ∧ ψ '' R ⊆ f R + := fun {R} h ↦ by + simp only [f, dite_eq_left h] + exact h.choose_spec + have hoffK : ∀ {R s}, R ∈ arcComponentsIn (bd S₁ \ pullFrameV χ.Φ K ψ) → s ∈ χ.Φ.longSides + → ψ '' R ⊆ s → ψ '' R ⊆ (s ∩ range ψ) \ K.U := by + rintro R s hR hs hsub _ ⟨x, hx, rfl⟩ + refine ⟨⟨hsub (mem_image_of_mem _ hx), mem_range_self x⟩, fun hk ↦ ?_⟩ + have hb : ψ x ∈ bd S := (hs.1.2.1 (hsub (mem_image_of_mem _ hx))).1 + exact (hR.2.1 hx).2 (Or.inr (D.K_bd ⟨hk, hb⟩)) + have hfside : ∀ {R}, R ∈ χ₁.Φ.longSides → f R = side → ψ '' R ⊆ side := fun {R} hR he ↦ by + have := (hf ((hlongs R).1 hR).2).2 + rwa [he] at this + have hΩ : ∀ {R}, R ∈ χ₁.Φ.longSides → χ₁.ΩS R = χ.ΩS (f R) := fun {R} hR ↦ by + obtain ⟨hRs, hl⟩ := (hlongs R).1 hR + obtain ⟨m, sub⟩ := hf hl + exact fragScheme_ΩS hRs.1 m.1 sub + have hstrict : ∀ {R}, R ∈ χ₁.Φ.longSides → f R = side → (restrictΩ χ₁ lab R).IsStrictSubIdeal + (χ.ΩS (f R)) := fun {R} hR he ↦ by + obtain ⟨w, hw, hl⟩ := hsome R ((hlongs R).1 hR).1 (hfside hR he) + rw [restrictΩ_some hl, hΩ hR, he] + exact QuasiOrder.isStrictSubIdeal_withoutAbove hw + have huniq : ∀ {R₁ R₂}, R₁ ∈ χ₁.Φ.longSides → R₂ ∈ χ₁.Φ.longSides → f R₁ = f R₂ → f R₁ ≠ side + → R₁ = R₂ := by + intro R₁ R₂ h₁ h₂ he hne + obtain ⟨h₁s, h₁l⟩ := (hlongs R₁).1 h₁ + obtain ⟨h₂s, h₂l⟩ := (hlongs R₂).1 h₂ + obtain ⟨m₁, s₁⟩ := hf h₁l + obtain ⟨m₂, s₂⟩ := hf h₂l + rw [← he] at m₂ s₂ + have b₁ := hoffK h₁s m₁ s₁ + have b₂' := hoffK h₂s m₁ s₂ + obtain ⟨x, hx⟩ := h₁s.1 + have hne' : ((f R₁ ∩ range ψ) \ K.U).Nonempty := ⟨_, b₁ (mem_image_of_mem _ hx)⟩ + rcases hkeep _ m₁ hne with h₀ | hp + · exact absurd hne' (by rw [h₀]; exact not_nonempty_empty) + · refine D.side_eq_of_isPathConnected hinj hp (fun z hz ↦ hz.1.2) (fun z hz ↦ + (m₁.1.2.1 hz.1.1).1) ?_ h₁s h₂s b₁ b₂' + refine disjoint_left.2 fun z hz hv ↦ ?_ + rcases hv with hv | hv + · exact (m₁.1.2.1 hz.1.1).2 hv + · exact hz.2 (K.V_subset_U hv) + refine ⟨hhom, rfl, rfl, f, fun R hR ↦ (hf ((hlongs R).1 hR).2).1, fun R hR ↦ ?_, + fun R₁ h₁ R₂ h₂ hne he ↦ ?_, fun hall ↦ ?_⟩ + · by_cases he : f R = side + · exact (hstrict hR he).1 + · have hl : lab R = none := hnone R fun hsub ↦ by + obtain ⟨hRs, hl⟩ := (hlongs R).1 hR + obtain ⟨m, sub⟩ := hf hl + obtain ⟨x, hx⟩ := hRs.1 + exact he (GM11.arcComponent_eq m.1 hside.1 (sub (mem_image_of_mem _ hx)) (hsub + (mem_image_of_mem _ hx))) + change (restrictΩ χ₁ lab R).IsSubIdeal _ + rw [restrictΩ_none hl, hΩ hR] + exact QuasiOrder.isSubIdeal_refl _ + · by_cases hs : f R₁ = side + · exact hstrict h₁ hs + · exact absurd (huniq h₁ h₂ he hs) hne + · exfalso + obtain ⟨R, hR, hfR, hE⟩ := hall side hside + have hs := hstrict (R := R) hR hfR + rw [hfR] at hs + exact hs.2 hE + +variable {𝒮 : Set (ColouredPainting χ)} + +/-- **The places with colours off the labels are well-behaved by `S₄`.** -/ +theorem wellBehaved_side (hS : IsSurface S) (hF : IsFeature χ.Φ K) (hcl : IsPaintingClass χ 𝒮) + (hlines : ∀ e ∈ arcComponentsIn (K.U \ K.V), ∃ u v, u ≠ v ∧ closure e ∩ K.V = {u, v} + ∧ IsLineWithEnds (closure e) u v) + {Y : Type} [TopologicalSpace Y] [T2Space Y] {ψ : Y → S} (hY : IsSurface Y) + (hψ : IsCutMap ψ K.U) (hsheet : HasSheets ψ K) + (y : Y) (l : List S) (m : ℕ) (a₀ : β) (hS4 : ConditionS4 χ) (hhom : Nonempty + (connectedComponent y ≃ₜ S)) (hinj : InjOn ψ (connectedComponent y)) + (hO : IsOrientableSurface (connectedComponent y) → IsOrientableSurface S) {side : Set S} + (hside : side ∈ χ.Φ.longSides) {lab : Set (connectedComponent y) → Option β} + (hnone : ∀ R, ¬ (fun x : connectedComponent y ↦ ψ x.1) '' R ⊆ side → lab R = none) + (hsome : ∀ R ∈ arcComponentsIn (bd (connectedComponent y) \ pullFrameV χ.Φ K + (fun x : connectedComponent y ↦ ψ x.1)), (fun x : connectedComponent y ↦ ψ x.1) '' R ⊆ side → + ∃ w ∈ (χ.ΩS side).E, lab R = some w) + (hkeep : ∀ s ∈ χ.Φ.longSides, s ≠ side → (s ∩ (ψ '' connectedComponent y)) \ K.U = ∅ + ∨ IsPathConnected ((s ∩ (ψ '' connectedComponent y)) \ K.U)) : + IsWellBehavedPlaces {X | IsCutPlace χ K (fun x : connectedComponent y ↦ ψ x.1) l m X ∧ X.P ∈ 𝒮 ∧ + ∀ R w, lab R = some w → ∀ e ∈ X.P.Γ.E, e ⊆ (fun x : connectedComponent y ↦ ψ x.1) '' R → ¬ + (χ.ΩS side).le w (X.P.φ e)} := by + have : Nonempty (connectedComponent y) := ⟨⟨y, mem_connectedComponent⟩⟩ + have hr : range (fun x : connectedComponent y ↦ ψ x.1) = ψ '' connectedComponent y := by + ext z + simp + apply wellBehaved_of_fragment (fun x : connectedComponent y ↦ ψ x.1) hF l m a₀ + (fun a b hab hoff ↦ Subtype.ext (hψ.2.2.1 hoff (fun h ↦ hoff (hab ▸ h)) hab)) + (fun X hX ↦ frameData_of_cut hS X.P.fits hX.inter hlines hY hψ hsheet y) + intro seq hq h flip hflip + set D := fun i ↦ frameData_of_cut hS (seq i).P.fits (h i).inter hlines hY hψ hsheet y with hDdef + set χ₁ := fragScheme χ a₀ (D 0) hF flip with hχ₁ + have hl := lab_short (D 0) hF flip a₀ hside hnone + have hc : ∀ i, ∀ e ∈ ((fragPainting (a₀ := a₀) (D 0) hF flip (seq i).P (D i) + (h i).anchored).Γ).E, ∀ R ∈ χ₁.Φ.sides, BordersSide e R → ∀ w, lab R = some w → + ¬ (χ₁.ΩS R).le w ((fragPainting (a₀ := a₀) (D 0) hF flip (seq i).P (D i) (h i).anchored).φ e) + := by + intro i e₁ he₁ R hR hbs w hw + have hRs : (fun x : connectedComponent y ↦ ψ x.1) '' R ⊆ side := by + by_contra hn + rw [hnone R hn] at hw + exact absurd hw (by simp) + have ha := (D i).mem_arcs_of_border flip he₁ hbs.1 + obtain ⟨x, hx⟩ := ha.1 + have hxb : ψ x.1 ∈ bd S := (hside.1.2.1 (hRs (mem_image_of_mem _ (hbs.2 hx)))).1 + obtain ⟨hE, -⟩ := (D i).pull.image_border_edge ha hx hxb + have hΩ : χ₁.ΩS R = χ.ΩS side := fragScheme_ΩS ⟨x, hbs.2 hx⟩ hside.1 hRs + rw [hΩ] + change ¬ (χ.ΩS side).le w (fragφ (seq i).P (fun x : connectedComponent y ↦ ψ x.1) a₀ e₁) + rw [fragφ_eq hE] + exact (hq i).2 R w hw _ hE (image_mono hbs.2) + have hnb := hS4 _ (χ₁.restrictSides lab hl) (restrictSides_isRefinement (D 0) hF flip a₀ hhom + (fun a b hab ↦ Subtype.ext (hinj a.2 b.2 hab)) hside hnone hsome + (fun s hs hne ↦ by rw [hr]; exact hkeep s hs hne)) + have hsim := frag_similarly hcl hS hF a₀ (D 0) (fun i ↦ (seq i).P) (fun i ↦ (hq i).1) D (fun i ↦ + (h i).anchored) flip hO + by_contra hno + push Not at hno + exact hnb ⟨fun i ↦ (fragPainting (a₀ := a₀) (D 0) hF flip (seq i).P (D i) + (h i).anchored).restrictSides lab hl (hc i), fun i j hij ⟨σv, σe, hσ⟩ ↦ + hno i j hij σv σe hσ.of_restrictSides, hsim⟩ + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/SideShape.lean b/LeanPool/GraphMinor/GM19/SideShape.lean new file mode 100644 index 0000000000..fda268222c --- /dev/null +++ b/LeanPool/GraphMinor/GM19/SideShape.lean @@ -0,0 +1,287 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FreeShape +public import LeanPool.GraphMinor.GM19.SideScheme + +/-! +# The fragment outside a side flaw + +`IsSideShape cap Φ side K Z` says what the proof of (11.1) needs of the closed disc `Z`. It holds +one cuff disc and misses the others, so the fragment outside `Z` has as many cuffs as `Σ` +(`le_numCuffs_fragment`). So it is a copy of `Σ` on which `ψ` is one to one (`outer_fragment`). +Unlike (10.5), this case needs no use of `S₃`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 GraphMinor.GM10 + +universe w + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] [T2Space Shat] + + +/-- The closed disc `Z` around a flaw on a side. -/ +structure IsSideShape (cap : IsCappedSurface S Shat) (Φ : Frame S) (side : Set S) (K : Drawing S) + (Z : Set Shat) : Prop where + disc : IsClosedDisc Z + sub : cap.emb '' K.U ⊆ discBd Z + rest : discBd Z ⊆ cap.discs ∪ cap.emb '' K.U + cuff : ∃ Θ ∈ cuffs S, closure (cap.cuffDisc Θ) ⊆ Z ∧ ∀ Θ' ∈ cuffs S, Θ' ≠ Θ → Disjoint (closure + (cap.cuffDisc Θ')) Z + ne : K.U.Nonempty + keep : ∀ s ∈ Φ.longSides, s ≠ side → s \ (cap.emb ⁻¹' discInt Z ∪ K.U) = ∅ ∨ IsPathConnected (s \ + (cap.emb ⁻¹' discInt Z ∪ K.U)) + +/-- What makes a fragment good for (11.1). -/ +def OuterGood {Y : Type} [TopologicalSpace Y] (Φ : Frame S) (side : Set S) (K : Drawing S) (ψ : Y + → S) (c : Set Y) : Prop := + (IsOrientableSurface c → IsOrientableSurface S) ∧ Nonempty (c ≃ₜ S) ∧ InjOn ψ c ∧ + ∀ s ∈ Φ.longSides, s ≠ side → (s ∩ (ψ '' c)) \ K.U = ∅ ∨ IsPathConnected ((s ∩ (ψ '' c)) \ K.U) + +/-- **The fragment keeps its cuffs.** If `K` meets only the cuff `Θ₀`, and the fragment holds all +the other cuffs and a point of `K`, then it has as many cuffs as `Σ`: the +other cuffs lift, and the point of `K` lies on one more. -/ +theorem le_numCuffs_fragment {Y : Type} [TopologicalSpace Y] + (hS : IsSurface S) {K : Drawing S} {ψ : Y → S} (hY : IsSurface Y) (hψ : IsCutMap ψ K.U) (y : Y) + {Θ₀ : Set S} (hΘ₀ : Θ₀ ∈ cuffs S) (hoth : ∀ Θ' ∈ cuffs S, Θ' ≠ Θ₀ → Disjoint Θ' K.U) + (hmem : ∀ Θ' ∈ cuffs S, Θ' ≠ Θ₀ → Θ' ⊆ ψ '' connectedComponent y) {p : S} (hp : p ∈ K.U) + (hpm : p ∈ ψ '' connectedComponent y) : numCuffs S ≤ numCuffs (connectedComponent y) := by + classical + have hfrag := isCuttingFragment_of_cut hS hY hψ (K := K) rfl y + have hfc : (cuffs S).Finite := (cuff_statement S hS).2.1 + have hfc' : (cuffs (connectedComponent y)).Finite := (cuff_statement _ hfrag.isSurface).2.1 + have : Nonempty (connectedComponent y) := ⟨⟨y, mem_connectedComponent⟩⟩ + let ψ' : connectedComponent y → S := fun x ↦ ψ x.1 + have hbdc : ∀ x : connectedComponent y, ψ' x ∈ bd S ∪ K.U → x ∈ bd (connectedComponent y) + := fun x hx ↦ by + by_contra hn + exact disjoint_left.1 hfrag.maps_interior_disjoint (mem_image_of_mem _ hn) hx + have hlift : ∀ {z}, z ∈ ψ '' connectedComponent y → ∃ x : connectedComponent y, ψ' x = z := by + rintro _ ⟨x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + set A := cuffs S \ {Θ₀} with hA + have hex : ∀ Θ', ∃ x : connectedComponent y, Θ' ∈ A → ψ' x ∈ Θ' := fun Θ' ↦ by + by_cases h : Θ' ∈ A + · obtain ⟨z, hzb, hzc⟩ := h.1 + have hz : z ∈ Θ' := hzc ▸ mem_connectedComponentIn hzb + obtain ⟨x, hx⟩ := hlift (hmem Θ' h.1 h.2 hz) + exact ⟨x, fun _ ↦ hx ▸ hz⟩ + · exact ⟨Classical.arbitrary _, fun h' ↦ absurd h' h⟩ + choose l hl using hex + obtain ⟨p', hp'⟩ := hlift hpm + have hpb : p' ∈ bd (connectedComponent y) := hbdc p' (Or.inr (hp' ▸ hp)) + let G : Set S → Set (connectedComponent y) := fun Θ' ↦ connectedComponentIn (bd + (connectedComponent y)) (l Θ') + let H : Set (connectedComponent y) := connectedComponentIn (bd (connectedComponent y)) p' + have hbl : ∀ {Θ'}, Θ' ∈ A → l Θ' ∈ bd (connectedComponent y) := fun h ↦ hbdc _ (Or.inl + (cuff_subset_bd ⟨_, h.1⟩ (hl _ h))) + have hstay : ∀ {Θ'}, Θ' ∈ A → ψ' '' G Θ' ⊆ Θ' := by + intro Θ' hΘ' + have hcΘ : IsClosed Θ' := isClosed_cuff hS ⟨Θ', hΘ'.1⟩ + have hrest : IsClosed (⋃₀ (cuffs S \ {Θ'}) ∪ K.U) := by + refine IsClosed.union ((hfc.subset sdiff_subset).isClosed_sUnion fun D hD ↦ isClosed_cuff hS + ⟨D, hD.1⟩) K.isClosed_U + have hconn : IsPreconnected (ψ' '' G Θ') := isPreconnected_connectedComponentIn.image _ + hfrag.continuous_ψ.continuousOn + have hcov : ψ' '' G Θ' ⊆ Θ' ∪ (⋃₀ (cuffs S \ {Θ'}) ∪ K.U) := by + rintro _ ⟨x, hx, rfl⟩ + have hxb : x ∈ bd (connectedComponent y) := connectedComponentIn_subset _ _ hx + rcases hfrag.maps_bd (mem_image_of_mem _ hxb) with h | h + · rw [← sUnion_cuffs (S := S)] at h + obtain ⟨D, hD, hxD⟩ := h + by_cases he : D = Θ' + · exact Or.inl (he ▸ hxD) + · exact Or.inr (Or.inl ⟨D, ⟨hD, he⟩, hxD⟩) + · exact Or.inr (Or.inr h) + have hnone : ψ' '' G Θ' ∩ (Θ' ∩ (⋃₀ (cuffs S \ {Θ'}) ∪ K.U)) = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro x ⟨-, hx, h | h⟩ + · obtain ⟨D, hD, hxD⟩ := h + exact hD.2 (cuffs_eq_of_mem hD.1 hΘ'.1 hxD hx) + · exact disjoint_left.1 (hoth Θ' hΘ'.1 hΘ'.2) hx h + rcases isPreconnected_iff_subset_of_disjoint_closed.1 hconn _ _ hcΘ hrest hcov hnone with h | h + · exact h + · exfalso + have hm : ψ' (l Θ') ∈ ψ' '' G Θ' := mem_image_of_mem _ (mem_connectedComponentIn (hbl hΘ')) + rcases h hm with ⟨D, hD, hxD⟩ | h' + · exact hD.2 (cuffs_eq_of_mem hD.1 hΘ'.1 hxD (hl _ hΘ')) + · exact disjoint_left.1 (hoth Θ' hΘ'.1 hΘ'.2) (hl _ hΘ') h' + have hinj : InjOn G A := by + intro Θ₁ h₁ Θ₂ h₂ he + have hm : l Θ₁ ∈ G Θ₂ := he ▸ mem_connectedComponentIn (hbl h₁) + exact cuffs_eq_of_mem h₁.1 h₂.1 (hl _ h₁) (hstay h₂ (mem_image_of_mem _ hm)) + have hGc : ∀ {Θ'}, Θ' ∈ A → G Θ' ∈ cuffs (connectedComponent y) := fun h ↦ ⟨_, hbl h, rfl⟩ + have hHc : H ∈ cuffs (connectedComponent y) := ⟨_, hpb, rfl⟩ + have hHn : H ∉ G '' A := by + rintro ⟨Θ', h, he⟩ + have hm : p' ∈ G Θ' := he ▸ mem_connectedComponentIn hpb + have := hstay h (mem_image_of_mem _ hm) + rw [hp'] at this + exact disjoint_left.1 (hoth Θ' h.1 h.2) this hp + have hsub : insert H (G '' A) ⊆ cuffs (connectedComponent y) := by + rintro _ (rfl | ⟨Θ', h, rfl⟩) + · exact hHc + · exact hGc h + have h₁ := ncard_le_ncard hsub hfc' + rw [ncard_insert_of_notMem hHn ((hfc.subset sdiff_subset).image _), hinj.ncard_image] at h₁ + have h₂ := ncard_sdiff_add_ncard_of_subset (singleton_subset_iff.2 hΘ₀) hfc + rw [ncard_singleton, ← hA] at h₂ + change (cuffs S).ncard ≤ (cuffs (connectedComponent y)).ncard + omega + +/-- **The fragment outside `Z`.** -/ +theorem outer_fragment {Y : Type} [TopologicalSpace Y] [T2Space Y] [ConnectedSpace S] + (hS : IsSurface S) (cap : IsCappedSurface S Shat) + {Φ : Frame S} {side : Set S} {K : Drawing S} {Z : Set Shat} (h : IsSideShape cap Φ side K Z) {ψ + : Y → S} (hY : IsSurface Y) (hψ : IsCutMap ψ K.U) : + ∃ y : Y, ψ '' connectedComponent y = (cap.emb ⁻¹' discInt Z)ᶜ ∧ OuterGood Φ side K ψ + (connectedComponent y) := by + classical + have hT := cap.isClosedSurface + have hman : ∀ x : Shat, IsManifoldPoint x := fun x ↦ (hT.2.2 x).isManifoldPoint + have hD := h.disc + have : ConnectedSpace Shat := cap.connected + have hfc : (cuffs S).Finite := (cuff_statement S hS).2.1 + have hbd : Z \ discInt Z ⊆ discBd Z := by + rintro x ⟨hx, hn⟩ + by_contra hb + exact hn ⟨hx, hb⟩ + obtain ⟨Θ₁, hΘ₁, hin, hdis⟩ := h.cuff + have htouch : ∀ Θ ∈ cuffs S, ¬ closure (cap.cuffDisc Θ) ⊆ Z → (closure + (cap.cuffDisc Θ) ∩ Z).Subsingleton := fun Θ hΘ hn ↦ by + have hne : Θ ≠ Θ₁ := fun he ↦ hn (he ▸ hin) + rw [disjoint_iff_inter_eq_empty.1 (hdis Θ hΘ hne)] + exact subsingleton_empty + obtain ⟨y, hy, hcap, hnum, T', _, e, P, hT', ⟨hom⟩, hP, hs, ht⟩ := exists_outer_fragment_core hS + cap hY hψ hD.isClosed + (hD.isOpen_discInt hman) (discInt_subset Z) (fun c hc ↦ isCell_disc hT + (isClosedDisc_image_injOn hD c.continuous.continuousOn hc).1) + (h.sub.trans (Surface.discBd_subset Z)) (hbd.trans h.rest) (hbd.trans + (discBd_subset_closure_compl hT hD)) htouch + have hy' : ψ '' connectedComponent y = (cap.emb ⁻¹' discInt Z)ᶜ := by rw [hy, preimage_compl] + refine ⟨y, hy', fun ⟨ω⟩ ↦ ?_, ?_⟩ + · have : T2Space T' := hT'.2.1 + have : ConnectedSpace Shat := cap.connected + have : ConnectedSpace T' := hom.symm.surjective.connectedSpace hom.symm.continuous + have h₁ := isOrientable_of_inside hT' hP e hs ht (ω.isPartial _) + exact isOrientable_of_embedding cap.isEmbedding (isOrientable_of_embedding hom.symm.isEmbedding + h₁) + have hall : ∀ Θ ∈ cuffs S, closure (cap.cuffDisc Θ) ⊆ Z ∨ Disjoint (closure (cap.cuffDisc Θ)) Z + := fun Θ hΘ ↦ by + by_cases hne : Θ = Θ₁ + · exact Or.inl (hne ▸ hin) + · exact Or.inr (hdis Θ hΘ hne) + have hnotin : ∀ {x}, x ∈ K.U → cap.emb x ∉ discInt Z := fun hx hi ↦ hi.2 (h.sub + (mem_image_of_mem _ hx)) + obtain ⟨p, hp⟩ := h.ne + have hfrag := isCuttingFragment_of_cut hS hY hψ (K := K) rfl y + have hconn := hfrag.connected + obtain ⟨Shat₁, _, ⟨cap₁⟩⟩ := exists_cappedSurface _ (connectedComponent y) hfrag.isSurface hconn + rfl + have hle : numCuffs S ≤ numCuffs (connectedComponent y) := by + refine le_numCuffs_fragment hS hY hψ y hΘ₁ (fun Θ' hΘ' hne ↦ disjoint_left.2 fun x hx hxK ↦ ?_) + (fun Θ' hΘ' hne x hx ↦ ?_) hp (by rw [hy']; exact hnotin hp) + · exact disjoint_left.1 (hdis Θ' hΘ' hne) (cap.mem_closure_emb hΘ' hx) + (Surface.discBd_subset _ (h.sub (mem_image_of_mem _ hxK))) + · rw [hy'] + exact fun hi ↦ disjoint_left.1 (hdis Θ' hΘ' hne) (cap.mem_closure_emb hΘ' hx) + (discInt_subset _ hi) + have hcard : numCuffs (connectedComponent y) = numCuffs S := by + refine le_antisymm ?_ hle + have hE₁ : (closure (cap.cuffDisc Θ₁)).Nonempty := (cap.cuffDisc_closedDisc _ + hΘ₁).nonempty_discInt.mono (discInt_subset _) + have hsub : {Θ ∈ cuffs S | Disjoint (closure (cap.cuffDisc Θ)) Z} ⊆ cuffs S \ {Θ₁} := by + rintro Θ ⟨hΘ, hd⟩ + refine ⟨hΘ, ?_⟩ + intro h' + rw [mem_singleton_iff.1 h'] at hd + obtain ⟨x, hx⟩ := hE₁ + exact disjoint_left.1 hd hx (hin hx) + have h₁ := ncard_le_ncard hsub (hfc.subset sdiff_subset) + have h₂ : (cuffs S \ {Θ₁}).ncard + ({Θ₁} : Set (Set S)).ncard = (cuffs S).ncard := + ncard_sdiff_add_ncard_of_subset (singleton_subset_iff.2 hΘ₁) hfc + rw [ncard_singleton] at h₂ + change _ ≤ (cuffs S).ncard + omega + have hset : ∀ s : Set S, (s ∩ (ψ '' connectedComponent y)) \ K.U = s \ + (cap.emb ⁻¹' discInt Z ∪ K.U) := fun s ↦ by + rw [hy'] + ext x + simp only [mem_sdiff, mem_inter_iff, mem_compl_iff, mem_union, not_or] + tauto + refine ⟨nonempty_homeomorph_of_cap hfrag.isSurface hconn hS ‹_› cap₁ cap (hcap _ cap₁) hcard, + ?_, ?_⟩ + · refine injOn_of_outside hS cap hY hψ y hD h.sub h.rest hall ?_ + rw [hy'] + · intro s hs' hne + rw [hset] + exact h.keep s hs' hne + +omit [T2Space S] [T2Space Shat] in +/-- The shape moves to the cap twisted by a homeomorphism that keeps the frame. -/ +theorem IsSideShape.ofHomeo {cap : IsCappedSurface S Shat} {Φ : Frame S} {side : Set + S} {K K' : Drawing S} {Z : Set Shat} + (h : IsSideShape cap Φ side K' Z) (f : S ≃ₜ S) (hf : IsFramePreservingHomeo Φ f) (hU : f '' K.U + = K'.U) : + IsSideShape (cap.ofHomeo f) Φ side K Z := by + have hKU : (cap.ofHomeo f).emb '' K.U = cap.emb '' K'.U := by rw [cap.ofHomeo_emb_image, hU] + refine ⟨h.disc, ?_, ?_, ?_, ?_, ?_⟩ + · rw [hKU] + exact h.sub + · rw [hKU, cap.ofHomeo_discs] + exact h.rest + · obtain ⟨Θ, hΘ, hin, hdis⟩ := h.cuff + obtain ⟨hΘ', hDisc⟩ := cap.ofHomeo_cuffDisc_symm f hΘ + refine ⟨_, hΘ', hDisc.symm ▸ hin, fun Θ' hΘ' hne ↦ ?_⟩ + rw [(cap.ofHomeo_cuffDisc f hΘ').2] + refine hdis _ (cap.ofHomeo_cuffDisc f hΘ').1 fun he ↦ hne ?_ + rw [← he] + ext x + simp + · have : K'.U.Nonempty := h.ne + rw [← hU] at this + exact this.of_image + · intro s hs hne + set In' := cap.emb ⁻¹' discInt Z ∪ K'.U with hIn' + have hmem : ∀ x, x ∈ (cap.ofHomeo f).emb ⁻¹' discInt Z ∪ K.U ↔ f x ∈ In' := fun x ↦ by + refine or_congr Iff.rfl ?_ + rw [← hU] + exact (f.injective.mem_set_image).symm + have hside : ∀ x, f x ∈ s ↔ x ∈ s := fun x ↦ by + have := hf.preserve_sides s hs.1 + constructor + · intro hx + rw [← this] at hx + obtain ⟨y, hy, he⟩ := hx + exact f.injective he ▸ hy + · intro hx + rw [← this] + exact mem_image_of_mem _ hx + have heq : s \ ((cap.ofHomeo f).emb ⁻¹' discInt Z ∪ K.U) = f.symm '' (s \ In') := by + ext x + simp only [mem_sdiff, hmem] + constructor + · rintro ⟨h₁, h₂⟩ + exact ⟨f x, ⟨(hside x).2 h₁, h₂⟩, f.symm_apply_apply x⟩ + · rintro ⟨y, ⟨h₁, h₂⟩, rfl⟩ + refine ⟨?_, by rwa [f.apply_symm_apply]⟩ + rw [← hside, f.apply_symm_apply] + exact h₁ + rw [heq] + rcases h.keep s hs hne with h' | h' + · left + rw [h', image_empty] + · exact Or.inr (h'.image f.symm.continuous) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Sides.lean b/LeanPool/GraphMinor/GM19/Sides.lean new file mode 100644 index 0000000000..072deaf1bf --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Sides.lean @@ -0,0 +1,613 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.DiscSides + +/-! +# Sides of circuits + +These are the facts about circuits of a radial drawing that the proofs of (8.5), (8.6) and (8.7) +use. +A *side* of a drawing `F` is a connected open set with frontier `U(F)`. The inside of a closed disc +bounded by `F` is a side, and so is the complement of that disc. + +* `cover_sides`: sides that are pairwise disjoint along the edges of their drawings cover the + surface. +* `path_side`: a path that meets a circuit only in its ends has all its interior on one side. +* `circuit_sup`: two paths with the same ends and nothing else in common form a circuit. +* `disc_split`, `disc_lambda`: the `λ`-order of the separation of a disc bounded by a circuit. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM10 GraphMinor.GM11 + +section Walks + +variable {T : Type} [TopologicalSpace T] [T2Space T] + +/-- Two paths with the same ends and nothing else in common form a circuit. -/ +theorem circuit_sup {G P Q : Drawing T} {u v : T} (hPG : P.IsSubdrawing G) (hQG : Q.IsSubdrawing G) + (hp : P.IsPathBetween u v) (hq : Q.IsPathBetween u v) (huv : u ≠ v) + (hV : P.V ∩ Q.V ⊆ {u, v}) (hE : Disjoint P.E Q.E) : (G.sup P Q).IsCircuit := by + obtain ⟨W, hW, hWV, hWE⟩ := hp + obtain ⟨X, hX, hXV, hXE⟩ := hq + obtain ⟨W', hs, he⟩ := (Drawing.le_sup_left hPG hQG).exists_walk_up W + obtain ⟨X', hs', he'⟩ := (Drawing.le_sup_right hPG hQG).exists_walk_up X + have h₁ : W'.IsSimple := by + change W'.support.Nodup + rw [hs] + exact hW + have h₂ : X'.IsSimple := by + change X'.support.Nodup + rw [hs'] + exact hX + have hc := GraphWalk.isSimpleClosed_append h₁ h₂.reverse (fun x hx hy ↦ by + rw [GraphWalk.support_reverse, List.mem_reverse] at hy + rw [hs] at hx + rw [hs'] at hy + have : x ∈ P.V ∩ Q.V := ⟨by rw [hWV]; exact hx, by rw [hXV]; exact hy⟩ + exact hV this) (fun e he₁ he₂ ↦ by + rw [GraphWalk.edges_reverse, List.mem_reverse, he'] at he₂ + rw [he] at he₁ + exact disjoint_left.mp hE (by rw [hWE]; exact he₁) (by rw [hXE]; exact he₂)) + refine ⟨u, W'.append X'.reverse, hc, ?_, ?_, ?_⟩ + · rw [GraphWalk.length_append] + by_contra hn + have : W'.length = 0 := by omega + exact huv (GraphWalk.eq_of_length_eq_zero this) + · rw [Drawing.sup_V hPG hQG, hWV, hXV] + ext x + simp [GraphWalk.mem_support_append, GraphWalk.support_reverse, hs, hs'] + · rw [Drawing.sup_E hPG hQG, hWE, hXE] + ext x + simp [GraphWalk.edges_append, GraphWalk.edges_reverse, he, he'] + +omit [T2Space T] in +theorem U_union {C A B : Drawing T} (hV : C.V = A.V ∪ B.V) (hE : C.E = A.E ∪ B.E) : + C.U = A.U ∪ B.U := by + rw [Drawing.U_eq C, Drawing.U_eq A, Drawing.U_eq B, hV, hE] + ext x + simp only [mem_union, mem_iUnion, exists_prop] + constructor + · rintro ((h | h) | ⟨e, he | he, h⟩) + · exact Or.inl (Or.inl h) + · exact Or.inr (Or.inl h) + · exact Or.inl (Or.inr ⟨e, he, h⟩) + · exact Or.inr (Or.inr ⟨e, he, h⟩) + · rintro ((h | ⟨e, he, h⟩) | (h | ⟨e, he, h⟩)) + · exact Or.inl (Or.inl h) + · exact Or.inr ⟨e, Or.inl he, h⟩ + · exact Or.inl (Or.inr h) + · exact Or.inr ⟨e, Or.inr he, h⟩ + +theorem length_support {α β : Type*} {G : Graph α β} {a b : α} (W : GraphWalk G a b) : + W.support.length = W.length + 1 := by + induction W with + | nil h => simp [GraphWalk.length, GraphWalk.edges, GraphWalk.support] + | cons h r ih => + simp only [GraphWalk.support, List.length_cons, ih, GraphWalk.length, GraphWalk.edges] + +omit [T2Space T] in +theorem IsCircuit.ncard_V {C : Drawing T} (hC : C.IsCircuit) : C.V.ncard = C.E.ncard := by + classical + obtain ⟨u, W, ⟨hnd, hed⟩, hpos, hV, hE⟩ := hC + have hl : C.E.ncard = W.length := by + have h : {e | e ∈ W.edges} = (W.edges.toFinset : Set (Set T)) := by + ext x + simp + rw [hE, h, ncard_coe_finset, List.toFinset_card_of_nodup hed] + rfl + have hVt : C.V = (W.support.tail.toFinset : Set T) := by + rw [hV] + ext x + simp only [mem_ofPred_eq, List.coe_toFinset] + constructor + · intro hx + rw [W.support_eq_cons] at hx + rcases List.mem_cons.mp hx with rfl | hx + · cases W with + | nil h => simp [GraphWalk.length] at hpos + | cons h r => simpa using r.end_mem_support + · exact hx + · exact List.mem_of_mem_tail + have hlen : W.support.tail.length = W.length := by + rw [List.length_tail, length_support] + rfl + rw [hVt, ncard_coe_finset, List.toFinset_card_of_nodup hnd, hlen, hl] + +omit [T2Space T] in +/-- A circuit in a bipartite drawing has exactly twice as many edges as vertices on one side. -/ +theorem IsCircuit.ncard_E_eq {C : Drawing T} (hC : C.IsCircuit) {P : Set T} + (halt : ∀ e x y, C.toGraph.IsLink e x y → (x ∈ P ↔ y ∉ P)) : + C.E.ncard = 2 * (C.V ∩ P).ncard := by + have h₁ := IsCircuit.ncard_le hC halt + have h₂ := IsCircuit.ncard_le hC (P := Pᶜ) fun e x y hl ↦ by + have := halt e x y hl + simp only [mem_compl_iff, not_not] + tauto + have hsum : (C.V ∩ P).ncard + (C.V ∩ Pᶜ).ncard = C.V.ncard := by + rw [← ncard_union_eq (disjoint_left.mpr fun x (hx : x ∈ C.V ∩ P) (hx' : x ∈ C.V ∩ Pᶜ) ↦ hx'.2 + hx.2) (C.finite_V.subset + inter_subset_left) (C.finite_V.subset inter_subset_left), ← inter_union_distrib_left] + simp + have := IsCircuit.ncard_V hC + omega + +end Walks + +section SideFacts + +variable {T : Type} [TopologicalSpace T] [T2Space T] [ConnectedSpace T] + +/-- A connected open set with frontier `U(F)`. -/ +structure IsSide (Ω : Set T) (F : Drawing T) : Prop where + isOpen : IsOpen Ω + frontier_eq : frontier Ω = F.U + nonempty : Ω.Nonempty + conn : IsPreconnected Ω + +omit [ConnectedSpace T] in +theorem closure_discInt {Δ : Set T} (hΔ : IsClosedDisc Δ) : closure (discInt Δ) = Δ := + Subset.antisymm (closure_minimal (discInt_subset Δ) hΔ.isClosed) hΔ.subset_closure_discInt + +omit [ConnectedSpace T] in +theorem isSide_int (hT : IsClosedSurface T) {Δ : Set T} {F : Drawing T} (hΔ : IsClosedDisc Δ) + (hbd : discBd Δ = F.U) : IsSide (discInt Δ) F := by + have hman : ∀ x : T, IsManifoldPoint x := (Surface.IsClosedSurface.isSurface hT).2.2 + have ho := hΔ.isOpen_discInt hman + refine ⟨ho, ?_, hΔ.nonempty_discInt, hΔ.isPreconnected_discInt⟩ + rw [ho.frontier_eq, closure_discInt hΔ, ← hbd] + ext x + constructor + · rintro ⟨h₁, h₂⟩ + by_contra hn + exact h₂ ⟨h₁, hn⟩ + · intro h + exact ⟨Surface.discBd_subset _ h, fun h' ↦ h'.2 h⟩ + +theorem isSide_out (hT : IsClosedSurface T) {Δ : Set T} {F : Drawing T} (hΔ : IsClosedDisc Δ) + (hbd : discBd Δ = F.U) : IsSide Δᶜ F := by + have hfr : frontier Δᶜ = F.U := by + rw [frontier_compl, ← hbd, IsClosedDisc.frontier_eq_discBd hT hΔ] + refine ⟨hΔ.isClosed.isOpen_compl, hfr, ?_, isPreconnected_compl_disc hT hΔ⟩ + by_contra hn + have hemp : Δᶜ = ∅ := not_nonempty_iff_eq_empty.mp hn + rw [hemp, frontier_empty, ← hbd] at hfr + obtain ⟨φ⟩ := hΔ.isOArc_discBd + exact eq_empty_iff_forall_notMem.mp hfr.symm _ (φ 1).2 + +variable {Ω : Set T} {F : Drawing T} + +omit [T2Space T] [ConnectedSpace T] in +theorem IsSide.disjoint_U (h : IsSide Ω F) : Disjoint Ω F.U := by + rw [← h.frontier_eq, h.isOpen.frontier_eq] + exact disjoint_left.mpr fun x hx hx' ↦ hx'.2 hx + +omit [T2Space T] [ConnectedSpace T] in +theorem IsSide.mem_of_closure (h : IsSide Ω F) {x : T} (hx : x ∈ closure Ω) (hn : x ∉ F.U) : + x ∈ Ω := by + by_contra hxΩ + exact hn (h.frontier_eq ▸ (by rw [h.isOpen.frontier_eq]; exact ⟨hx, hxΩ⟩)) + +omit [T2Space T] [ConnectedSpace T] in +theorem IsSide.U_subset_closure (h : IsSide Ω F) : F.U ⊆ closure Ω := by + rw [← h.frontier_eq] + exact frontier_subset_closure + +omit [T2Space T] [ConnectedSpace T] in +/-- A connected set that misses the frontier and meets `Ω` lies in `Ω`. -/ +theorem IsSide.subset (h : IsSide Ω F) {s : Set T} (hs : IsPreconnected s) + (hd : Disjoint s F.U) (hm : (s ∩ Ω).Nonempty) : s ⊆ Ω := by + obtain ⟨y, hys, hyΩ⟩ := hm + have := hs.subset_left_of_subset_union h.isOpen isClosed_closure.isOpen_compl + (disjoint_left.mpr fun w hw hn ↦ hn (subset_closure hw)) (fun x hx ↦ ?_) ⟨y, hys, hyΩ⟩ + · exact this + · by_cases hxc : x ∈ closure Ω + · exact Or.inl (h.mem_of_closure hxc (disjoint_left.mp hd hx)) + · exact Or.inr hxc + +variable {G : Drawing T} + +theorem exists_region_near (hT : IsClosedSurface T) (G : Drawing T) {O : Set T} (hO : IsOpen O) + {x : T} (hx : x ∈ closure O) : ∃ p ∈ G.R, x ∈ closure p ∧ (p ∩ O).Nonempty := by + have hRfin : G.R.Finite := finite_R hT G + have hd : x ∈ closure (⋃ p ∈ {p ∈ G.R | (p ∩ O).Nonempty}, p) := by + rw [mem_closure_iff] + intro Q hQ hxQ + obtain ⟨y, hyQ, hyO⟩ := mem_closure_iff.mp hx Q hQ hxQ + obtain ⟨z, ⟨hzQ, hzO⟩, hzU⟩ := exists_notMem_U (Γ := G) hT + (hQ.inter hO) ⟨y, hyQ, hyO⟩ + obtain ⟨p, hp, hzp⟩ := exists_region_of_notMem hzU + exact ⟨z, hzQ, mem_biUnion (x := p) ⟨hp, z, hzp, hzO⟩ hzp⟩ + have hfinite : {p ∈ G.R | (p ∩ O).Nonempty}.Finite := hRfin.subset fun _ hp => hp.1 + rw [hfinite.closure_biUnion] at hd + obtain ⟨p, ⟨hp, hpO⟩, hxp⟩ := mem_iUnion₂.mp hd + exact ⟨p, hp, hxp, hpO⟩ + +omit [T2Space T] [ConnectedSpace T] in +theorem IsSide.region_subset (hΩ : IsSide Ω F) (hF : F.IsSubdrawing G) {s : Set T} (hs : s ∈ G.R) + (hm : (s ∩ Ω).Nonempty) : s ⊆ Ω := by + refine hΩ.subset ?_ ?_ hm + · obtain ⟨y, hy, rfl⟩ := id hs + exact isPreconnected_connectedComponentIn + · exact disjoint_left.mpr fun x hx hxU ↦ GM11.region_subset hs hx (hF.U_subset hxU) + +/-- **Sides that fit along their edges cover the surface.** Let `𝒪` be a finite set of sides of +subdrawings of `G`. Suppose that each edge of the drawing of a member is an edge of the drawing of a +member disjoint from it. An edge has only two regions next to it, and so a region of `G` in `𝒪` and +a region not in `𝒪` are never next to each other. So every region of `G` lies in a member. -/ +theorem cover_sides (hT : IsClosedSurface T) {𝒪 : Set (Set T × Drawing T)} (hfin : 𝒪.Finite) + (hne : 𝒪.Nonempty) (hs : ∀ o ∈ 𝒪, IsSide o.1 o.2 ∧ o.2.IsSubdrawing G) + (hpair : ∀ o ∈ 𝒪, ∀ e ∈ o.2.E, ∃ o' ∈ 𝒪, e ∈ o'.2.E ∧ Disjoint o.1 o'.1) (x : T) : + ∃ o ∈ 𝒪, x ∈ closure o.1 := by + classical + let Z : Set (Set T) := {s | s ∈ G.R ∧ ∃ o ∈ 𝒪, s ⊆ o.1} + have hsub : ∀ s ∈ G.R, ∀ o ∈ 𝒪, (s ∩ o.1).Nonempty → s ∈ Z := fun s hs' o ho hm ↦ + ⟨hs', o, ho, (hs o ho).1.region_subset (hs o ho).2 hs' hm⟩ + have hall : ∀ s ∈ G.R, s ∈ Z := by + intro s' hs' + by_contra hnZ + obtain ⟨o₀, ho₀⟩ := hne + obtain ⟨y₀, hy₀⟩ := (hs o₀ ho₀).1.nonempty + obtain ⟨s₀, hs₀, -, hm₀⟩ := exists_region_near hT G (hs o₀ ho₀).1.isOpen (subset_closure hy₀) + obtain ⟨y₁, hy₁⟩ := region_nonempty hs₀ + obtain ⟨y₂, hy₂⟩ := region_nonempty hs' + obtain ⟨e, he, -⟩ := exists_boundary_edge hT (X := univ) isOpen_univ isPreconnected_univ + (hsub s₀ hs₀ o₀ ho₀ hm₀) (fun _ h ↦ h.1) ⟨hs', hnZ⟩ ⟨y₁, hy₁, mem_univ _⟩ ⟨y₂, hy₂, mem_univ + _⟩ + obtain ⟨⟨s₁, hs₁Z, hi₁⟩, ⟨s₂, hs₂, hi₂⟩⟩ := mem_boundaryDrawing_E.mp he + have heG := hi₁.1 + have he₁ := edge_subset_closure_of_incident hT heG hi₁.2.1 hi₁.2.2 + have he₂ := edge_subset_closure_of_incident hT heG hi₂.2.1 hi₂.2.2 + obtain ⟨hs₁, o, ho, hs₁o⟩ := hs₁Z + obtain ⟨hside, hoG⟩ := hs o ho + obtain ⟨z, hz⟩ := heG.1 + by_cases heo : e ∈ o.2.E + · obtain ⟨o', ho', heo', hdis⟩ := hpair o ho e heo + obtain ⟨hside', hoG'⟩ := hs o' ho' + have hzcl : z ∈ closure o'.1 := hside'.U_subset_closure (o'.2.closure_subset_U heo' + (subset_closure hz)) + obtain ⟨s₃, hs₃, hzs₃, hm₃⟩ := exists_region_near hT G hside'.isOpen hzcl + have he₃ := edge_subset_closure_of_incident hT heG hs₃ ⟨z, hz, hzs₃⟩ + have hs₃o := hside'.region_subset hoG' hs₃ hm₃ + rcases region_incident_two hT heG hs₁ hs₃ hs₂.1 he₁ he₃ he₂ with + h | h | h + · obtain ⟨y, hy⟩ := region_nonempty hs₁ + exact disjoint_left.mp hdis (hs₁o hy) (hs₃o (h ▸ hy)) + · exact hs₂.2 ⟨hs₂.1, o, ho, h ▸ hs₁o⟩ + · exact hs₂.2 ⟨hs₂.1, o', ho', h ▸ hs₃o⟩ + · have hd := edge_disjoint_U hoG heG heo + have hzo : z ∈ o.1 := hside.mem_of_closure (closure_mono hs₁o (he₁ hz)) + (disjoint_left.mp hd hz) + obtain ⟨w, hwo, hws⟩ := mem_closure_iff.mp (he₂ hz) _ hside.isOpen hzo + exact hs₂.2 (hsub s₂ hs₂.1 o ho ⟨w, hws, hwo⟩) + have hd : x ∈ closure (⋃ o ∈ 𝒪, o.1) := by + obtain ⟨s, hs₁, hxs, -⟩ := exists_region_near (O := univ) hT G isOpen_univ (by simp) + obtain ⟨-, o, ho, hso⟩ := hall s hs₁ + exact closure_mono ((hso).trans (subset_biUnion_of_mem (u := fun o : Set T × Drawing T ↦ o.1) + ho)) hxs + rw [hfin.closure_biUnion] at hd + obtain ⟨o, ho, hx⟩ := mem_iUnion₂.mp hd + exact ⟨o, ho, hx⟩ + +theorem simple_self {α β : Type*} {H : Graph α β} {a : α} {r : GraphWalk H a a} (hs : r.IsSimple) : + r.edges = [] ∧ r.support = [a] := by + have hl := hs.length_eq_zero + refine ⟨List.length_eq_zero_iff.mp hl, ?_⟩ + have hlen := length_support r + rw [hl] at hlen + have h := r.support_eq_cons + rw [h] at hlen ⊢ + simp only [List.length_cons, zero_add, Nat.add_eq_right, List.length_eq_zero_iff] at hlen + rw [hlen] + +omit [T2Space T] [ConnectedSpace T] in +/-- A path that meets the frontier only in its ends lies on one side. -/ +theorem walk_side (hF : F.IsSubdrawing G) (hΩ : IsSide Ω F) {P : Drawing T} + (hP : P.IsSubdrawing G) (hE : Disjoint P.E F.E) {a b : T} (W : GraphWalk P.toGraph a b) + (hs : W.IsSimple) (ha : a ∈ Ω) (hb : ∀ y ∈ W.support, y ∈ F.U → y = b) : + (∀ e ∈ W.edges, e ⊆ Ω) ∧ ∀ y ∈ W.support, y ∈ Ω ∨ y = b := by + induction W with + | nil h => + simp only [GraphWalk.edges, GraphWalk.support, List.not_mem_nil, List.mem_singleton] + exact ⟨fun e h ↦ h.elim, fun y hy ↦ Or.inr hy⟩ + | @cons a y b e h r ih => + have heP : e ∈ P.E := h.1 + have hed : Disjoint e F.U := edge_disjoint_U hF (hP.2 heP) (disjoint_left.mp hE heP) + have hcl : closure e ∩ P.V = {a, y} := h.2.2.2 + have hac : a ∈ closure e := (hcl.symm ▸ Or.inl rfl : a ∈ closure e ∩ P.V).1 + have hyc : y ∈ closure e := (hcl.symm ▸ Or.inr rfl : y ∈ closure e ∩ P.V).1 + obtain ⟨z, hzΩ, hze⟩ := mem_closure_iff.mp hac _ hΩ.isOpen ha + have heΩ : e ⊆ Ω := hΩ.subset heP.2.2.1.isConnected.isPreconnected hed ⟨z, hze, hzΩ⟩ + have hs' : r.IsSimple := hs.of_cons + by_cases hyU : y ∈ F.U + · have hyb : y = b := hb y (by simp [GraphWalk.support, r.start_mem_support]) hyU + subst hyb + obtain ⟨hre, hrs⟩ := simple_self hs' + simp only [GraphWalk.edges, GraphWalk.support, hre, hrs, List.mem_cons, List.not_mem_nil, + or_false] + refine ⟨fun e' he' ↦ he' ▸ heΩ, ?_⟩ + rintro x (rfl | rfl) + · exact Or.inl ha + · exact Or.inr rfl + · have hyΩ : y ∈ Ω := hΩ.mem_of_closure (closure_mono heΩ hyc) hyU + obtain ⟨h₁, h₂⟩ := ih hs' hyΩ fun x hx ↦ hb x (by simp [GraphWalk.support, hx]) + simp only [GraphWalk.edges, GraphWalk.support, List.mem_cons] + refine ⟨?_, ?_⟩ + · rintro e' (rfl | he') + · exact heΩ + · exact h₁ e' he' + · rintro x (rfl | hx) + · exact Or.inl ha + · exact h₂ x hx + +omit [T2Space T] [ConnectedSpace T] in +theorem mem_V_of_mem_U (hF : F.IsSubdrawing G) {x : T} (hxU : x ∈ F.U) (hxV : x ∈ G.V) : x ∈ F.V + := by + by_contra hn + obtain ⟨e, he, hxe⟩ := F.exists_edge_of_mem hxU hn + exact ((hF.2 he).2.1 hxe).2 hxV + +omit [T2Space T] [ConnectedSpace T] in +/-- **A path meets only one side of a circuit.** Let `P` be a path between distinct vertices that +meets `F` only in its ends, and with no edge in `F`. Then all of `P` other than its ends lies in one +of two disjoint sides of `F` that cover the complement of `U(F)`. -/ +theorem path_side (hF : F.IsSubdrawing G) {Ω Ω' : Set T} (hΩ : IsSide Ω F) (hΩ' : IsSide Ω' F) + (hdis : Disjoint Ω Ω') (hcov : F.Uᶜ ⊆ Ω ∪ Ω') {P : Drawing T} (hP : P.IsSubdrawing G) {u v : T} + (hpath : P.IsPathBetween u v) (huv : u ≠ v) (hV : P.V ∩ F.V ⊆ {u, v}) (hE : Disjoint P.E F.E) : + (∀ x ∈ P.U, x ∈ Ω ∨ x = u ∨ x = v) ∨ ∀ x ∈ P.U, x ∈ Ω' ∨ x = u ∨ x = v := by + obtain ⟨W, hW, hWV, hWE⟩ := hpath + have hPF : ∀ y ∈ W.support, y ∈ F.U → y = u ∨ y = v := fun y hy hyU ↦ by + have hyV : y ∈ P.V := by rw [hWV]; exact hy + exact hV ⟨hyV, mem_V_of_mem_U hF hyU (hP.1 hyV)⟩ + cases W with + | nil h => exact absurd rfl huv + | @cons _ x _ e h r => + have heP : e ∈ P.E := h.1 + have hed : Disjoint e F.U := edge_disjoint_U hF (hP.2 heP) (disjoint_left.mp hE heP) + have hcl : closure e ∩ P.V = {u, x} := h.2.2.2 + have hxc : x ∈ closure e := (hcl.symm ▸ Or.inr rfl : x ∈ closure e ∩ P.V).1 + have hs' : r.IsSimple := GraphWalk.IsSimple.of_cons hW + have hunot : u ∉ r.support := (List.nodup_cons.mp hW).1 + have hb : ∀ y ∈ r.support, y ∈ F.U → y = v := fun y hy hyU ↦ + (hPF y (List.mem_cons_of_mem _ hy) hyU).resolve_left fun h ↦ hunot (h ▸ hy) + have key : ∀ {Ξ : Set T}, IsSide Ξ F → e ⊆ Ξ → ∀ x' ∈ P.U, x' ∈ Ξ ∨ x' = u ∨ x' = v := by + intro Ξ hΞ heΞ + have hrest : (∀ e' ∈ r.edges, e' ⊆ Ξ) ∧ ∀ y ∈ r.support, y ∈ Ξ ∨ y = v := by + by_cases hxU : x ∈ F.U + · have hxv : x = v := hb x r.start_mem_support hxU + subst hxv + rw [(simple_self hs').1, (simple_self hs').2] + simp + · exact walk_side hF hΞ hP hE r hs' (hΞ.mem_of_closure (closure_mono heΞ hxc) hxU) hb + intro y hy + by_cases hyV : y ∈ P.V + · rw [hWV] at hyV + rcases List.mem_cons.mp hyV with rfl | hy' + · exact Or.inr (Or.inl rfl) + · rcases hrest.2 y hy' with h' | h' + · exact Or.inl h' + · exact Or.inr (Or.inr h') + · obtain ⟨e', he', hye'⟩ := P.exists_edge_of_mem hy hyV + rw [hWE] at he' + rcases List.mem_cons.mp he' with rfl | he'' + · exact Or.inl (heΞ hye') + · exact Or.inl (hrest.1 e' he'' hye') + rcases heP.2.2.1.isConnected.isPreconnected.subset_or_subset hΩ.isOpen hΩ'.isOpen hdis + (fun y hy ↦ hcov (disjoint_left.mp hed hy)) with h' | h' + · exact Or.inl (key hΩ h') + · exact Or.inr (key hΩ' h') + +end SideFacts + +section Theta + +variable {T : Type} [TopologicalSpace T] [T2Space T] [ConnectedSpace T] + +/-- Graph Minors XIX, (8.5): `F₁, F₂` are the two paths of the circuit `F` between `u` and `v`, and +`P` is a path of `G` between `u` and `v` with no other vertex or edge in common with `F`. -/ +structure TwoPaths (G F F₁ F₂ P : Drawing T) (u v : T) : Prop where + ne : u ≠ v + sub : F.IsSubdrawing G + left : F₁.IsPathOf F u v + right : F₂.IsPathOf F u v + union_V : F.V = F₁.V ∪ F₂.V + union_E : F.E = F₁.E ∪ F₂.E + inter_V : F₁.V ∩ F₂.V ⊆ {u, v} + disj_E : Disjoint F₁.E F₂.E + path : P.IsPathOf G u v + meet_V : P.V ∩ F.V ⊆ {u, v} + meet_E : Disjoint P.E F.E + +variable {G F F₁ F₂ P : Drawing T} {u v : T} + +omit [ConnectedSpace T] in +omit [T2Space T] in +theorem TwoPaths.swap (h : TwoPaths G F F₁ F₂ P u v) : TwoPaths G F F₂ F₁ P u v := + ⟨h.ne, h.sub, h.right, h.left, by rw [h.union_V, Set.union_comm], + by rw [h.union_E, Set.union_comm], + by simpa only [Set.inter_comm] using h.inter_V, + h.disj_E.symm, h.path, h.meet_V, h.meet_E⟩ + +omit [ConnectedSpace T] in +omit [T2Space T] in +theorem TwoPaths.sub₁ (h : TwoPaths G F F₁ F₂ P u v) : F₁.IsSubdrawing G := h.left.1.trans h.sub + +omit [ConnectedSpace T] in +omit [T2Space T] in +theorem TwoPaths.sub₂ (h : TwoPaths G F F₁ F₂ P u v) : F₂.IsSubdrawing G := h.right.1.trans h.sub + +omit [ConnectedSpace T] in +theorem TwoPaths.left_circuit (h : TwoPaths G F F₁ F₂ P u v) : (G.sup P F₂).IsCircuit := by + refine circuit_sup h.path.1 h.sub₂ h.path.2 h.right.2 h.ne ?_ ?_ + · rintro x ⟨hx, hx'⟩ + exact h.meet_V ⟨hx, h.right.1.1 hx'⟩ + · exact disjoint_left.mpr fun e he he' ↦ disjoint_left.mp h.meet_E he (h.right.1.2 he') + +omit [ConnectedSpace T] in +theorem TwoPaths.U_right (h : TwoPaths G F F₁ F₂ P u v) : (G.sup P F₂).U = P.U ∪ F₂.U := + U_union (Drawing.sup_V h.path.1 h.sub₂) (Drawing.sup_E h.path.1 h.sub₂) + +omit [ConnectedSpace T] in +omit [T2Space T] in +theorem TwoPaths.U_eq (h : TwoPaths G F F₁ F₂ P u v) : F.U = F₁.U ∪ F₂.U := + U_union h.union_V h.union_E + +omit [ConnectedSpace T] in +omit [T2Space T] in +theorem TwoPaths.exists_edge (h : TwoPaths G F F₁ F₂ P u v) : F₁.E.Nonempty := by + obtain ⟨W, -, -, hWE⟩ := h.left.2 + cases W with + | nil h' => exact absurd rfl h.ne + | @cons _ x _ e h' r => exact ⟨e, h'.1⟩ + +omit [ConnectedSpace T] in +omit [T2Space T] in +theorem TwoPaths.mem_V (h : TwoPaths G F F₁ F₂ P u v) : u ∈ F.V ∧ v ∈ F.V := by + obtain ⟨W, -, hWV, -⟩ := h.left.2 + have h₁ : u ∈ F₁.V := by rw [hWV]; exact W.start_mem_support + have h₂ : v ∈ F₁.V := by rw [hWV]; exact W.end_mem_support + exact ⟨h.left.1.1 h₁, h.left.1.1 h₂⟩ + +omit [ConnectedSpace T] in +omit [T2Space T] in +theorem TwoPaths.mem_V₁ (h : TwoPaths G F F₁ F₂ P u v) : u ∈ F₁.V ∧ v ∈ F₁.V := by + obtain ⟨W, -, hWV, -⟩ := h.left.2 + exact ⟨by rw [hWV]; exact W.start_mem_support, by rw [hWV]; exact W.end_mem_support⟩ + +omit [ConnectedSpace T] in +/-- If `P` lies on one side of `F`, then the other side misses the circuit `P ∪ F₂`. -/ +theorem TwoPaths.side_disjoint (h : TwoPaths G F F₁ F₂ P u v) {Ω Ω' : Set T} (hΩ : IsSide Ω F) + (hdis : Disjoint Ω Ω') (hP : ∀ x ∈ P.U, x ∈ Ω' ∨ x = u ∨ x = v) : + Disjoint Ω (G.sup P F₂).U := by + refine disjoint_left.mpr fun x hx hxU ↦ ?_ + have hFU := disjoint_left.mp hΩ.disjoint_U hx + rw [h.U_right] at hxU + rcases hxU with hxP | hxF + · rcases hP x hxP with h' | rfl | rfl + · exact disjoint_left.mp hdis hx h' + · exact hFU (F.V_subset_U h.mem_V.1) + · exact hFU (F.V_subset_U h.mem_V.2) + · exact hFU (h.U_eq ▸ Or.inr hxF) + +omit [ConnectedSpace T] in +/-- A side that misses the boundary of a disc, and is not inside the disc, misses the disc. -/ +theorem disjoint_disc (hT : IsClosedSurface T) {Ω Δ' : Set T} {F' C : Drawing T} (hΩ : IsSide Ω F') + (hΔ' : IsClosedDisc Δ') (hbd : discBd Δ' = C.U) (hd : Disjoint Ω C.U) + (hn : ¬ Ω ⊆ discInt Δ') : Disjoint Ω Δ' := by + have hO := isSide_int hT hΔ' hbd + refine disjoint_left.mpr fun x hx hxΔ ↦ ?_ + by_cases hxb : x ∈ discBd Δ' + · exact disjoint_left.mp hd hx (hbd ▸ hxb) + · exact hn (hO.subset hΩ.conn hd ⟨x, hx, hxΔ, hxb⟩) + +/-- **The theta graph.** Suppose that `P` lies on one side `Ω'` of `F`, and that the other side `Ω` +misses both discs `Δ₁, Δ₂` bounded by `P ∪ F₁` and `P ∪ F₂`. Then `Ω` and the two discs cover the +surface. -/ +theorem TwoPaths.theta_cover (hT : IsClosedSurface T) (h : TwoPaths G F F₁ F₂ P u v) + {Ω : Set T} (hΩ : IsSide Ω F) {Δ₁ Δ₂ : Set T} (hΔ₁ : IsClosedDisc Δ₁) (hΔ₂ : IsClosedDisc Δ₂) + (hbd₁ : discBd Δ₁ = (G.sup P F₁).U) (hbd₂ : discBd Δ₂ = (G.sup P F₂).U) + (hd₁ : Disjoint Ω Δ₁) (hd₂ : Disjoint Ω Δ₂) (x : T) : + x ∈ closure Ω ∨ x ∈ Δ₁ ∨ x ∈ Δ₂ := by + have h' := h.swap + have hO₁ := isSide_int hT hΔ₁ hbd₁ + have hO₂ := isSide_int hT hΔ₂ hbd₂ + have hcross : ∀ {F₃ Δ₃ : Set T} {K : Drawing T}, IsSide (discInt Δ₃) (G.sup P K) → + Disjoint Ω Δ₃ → F₃ ⊆ F.U → Disjoint (discInt Δ₃) F₃ := by + intro F₃ Δ₃ K hO hd hsub + refine disjoint_left.mpr fun y hy hyF ↦ ?_ + obtain ⟨z, hzO, hzΩ⟩ := mem_closure_iff.mp (hΩ.U_subset_closure (hsub hyF)) _ hO.isOpen hy + exact disjoint_left.mp hd hzΩ (discInt_subset _ hzO) + have h₁₂ : Disjoint (discInt Δ₁) (G.sup P F₂).U := by + rw [h.U_right] + refine disjoint_union_right.mpr ⟨?_, hcross hO₁ hd₁ (h.U_eq ▸ subset_union_right)⟩ + have := hO₁.disjoint_U + rw [h'.U_right] at this + exact this.mono_right subset_union_left + have h₂₁ : Disjoint (discInt Δ₂) (G.sup P F₁).U := by + rw [h'.U_right] + refine disjoint_union_right.mpr ⟨?_, hcross hO₂ hd₂ (h.U_eq ▸ subset_union_left)⟩ + have := hO₂.disjoint_U + rw [h.U_right] at this + exact this.mono_right subset_union_left + have hne : (G.sup P F₁).U ≠ (G.sup P F₂).U := by + intro heq + obtain ⟨e, he⟩ := h.exists_edge + have heG := h.sub₁.2 he + have hnot : e ∉ (G.sup P F₂).E := by + rw [Drawing.sup_E h.path.1 h.sub₂] + rintro (hp | hr) + · exact disjoint_left.mp h.meet_E hp (h.left.1.2 he) + · exact disjoint_left.mp h.disj_E he hr + have hd := edge_disjoint_U (G.sup_isSubdrawing P F₂) heG hnot + obtain ⟨y, hy⟩ := heG.1 + have hyU : y ∈ (G.sup P F₁).U := by + have heC : e ∈ (G.sup P F₁).E := by + rw [Drawing.sup_E h.path.1 h.sub₁] + exact Or.inr he + exact Drawing.closure_subset_U _ heC (subset_closure hy) + exact disjoint_left.mp hd hy (heq ▸ hyU) + have hOO : Disjoint (discInt Δ₁) (discInt Δ₂) := by + refine disjoint_left.mpr fun y hy₁ hy₂ ↦ hne ?_ + have s₁ := hO₂.subset hO₁.conn h₁₂ ⟨y, hy₁, hy₂⟩ + have s₂ := hO₁.subset hO₂.conn h₂₁ ⟨y, hy₂, hy₁⟩ + rw [← hO₁.frontier_eq, ← hO₂.frontier_eq, Subset.antisymm s₁ s₂] + have hs₁ : Disjoint Ω (discInt Δ₁) := hd₁.mono_right (discInt_subset _) + have hs₂ : Disjoint Ω (discInt Δ₂) := hd₂.mono_right (discInt_subset _) + let 𝒪 : Set (Set T × Drawing T) := + {(Ω, F), (discInt Δ₁, G.sup P F₁), (discInt Δ₂, G.sup P F₂)} + have hfin : 𝒪.Finite := by simp [𝒪] + have mem₀ : (Ω, F) ∈ 𝒪 := Or.inl rfl + have mem₁ : (discInt Δ₁, G.sup P F₁) ∈ 𝒪 := Or.inr (Or.inl rfl) + have mem₂ : (discInt Δ₂, G.sup P F₂) ∈ 𝒪 := Or.inr (Or.inr rfl) + have hC₁ : ∀ e, e ∈ F₁.E → e ∈ (G.sup P F₁).E := fun e he ↦ by + rw [Drawing.sup_E h.path.1 h.sub₁] + exact Or.inr he + have hC₂ : ∀ e, e ∈ F₂.E → e ∈ (G.sup P F₂).E := fun e he ↦ by + rw [Drawing.sup_E h.path.1 h.sub₂] + exact Or.inr he + have hP₁ : ∀ e, e ∈ P.E → e ∈ (G.sup P F₁).E := fun e he ↦ by + rw [Drawing.sup_E h.path.1 h.sub₁] + exact Or.inl he + have hP₂ : ∀ e, e ∈ P.E → e ∈ (G.sup P F₂).E := fun e he ↦ by + rw [Drawing.sup_E h.path.1 h.sub₂] + exact Or.inl he + have hcov := cover_sides (G := G) hT hfin ⟨_, mem₀⟩ (by + rintro o (rfl | rfl | rfl) + · exact ⟨hΩ, h.sub⟩ + · exact ⟨hO₁, G.sup_isSubdrawing P F₁⟩ + · exact ⟨hO₂, G.sup_isSubdrawing P F₂⟩) (by + rintro o (rfl | rfl | rfl) e he + · rw [h.union_E] at he + rcases he with he | he + · exact ⟨_, mem₁, hC₁ e he, hs₁⟩ + · exact ⟨_, mem₂, hC₂ e he, hs₂⟩ + · have he' : e ∈ P.E ∪ F₁.E := by + rwa [← Drawing.sup_E h.path.1 h.sub₁] + rcases he' with he' | he' + · exact ⟨_, mem₂, hP₂ e he', hOO⟩ + · exact ⟨_, mem₀, h.left.1.2 he', hs₁.symm⟩ + · have he' : e ∈ P.E ∪ F₂.E := by + rwa [← Drawing.sup_E h.path.1 h.sub₂] + rcases he' with he' | he' + · exact ⟨_, mem₁, hP₁ e he', hOO.symm⟩ + · exact ⟨_, mem₀, h.right.1.2 he', hs₂.symm⟩) x + obtain ⟨o, ho, hx⟩ := hcov + rcases ho with rfl | rfl | rfl + · exact Or.inl hx + · exact Or.inr (Or.inl (by rwa [closure_discInt hΔ₁] at hx)) + · exact Or.inr (Or.inr (by rwa [closure_discInt hΔ₂] at hx)) + +end Theta + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/SkeletonTangle.lean b/LeanPool/GraphMinor/GM19/SkeletonTangle.lean new file mode 100644 index 0000000000..3b3fd79ccd --- /dev/null +++ b/LeanPool/GraphMinor/GM19/SkeletonTangle.lean @@ -0,0 +1,280 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Defs2 +public import LeanPool.GraphMinor.GM11.Section6 + +/-! +# A tangle in a hypergraph with the same adjacencies + +Graph Minors XIX, proof of (15.2), page 382, uses (14.1) of Graph Minors XVII to pass from a tangle +in `Γ` to a tangle in `sk(Γ)`. +There `G*` is a simple graph, and `sk(Γ)` is a drawing that may have parallel edges. So we show that +a tangle moves from `G*` to +any hypergraph on the same vertices (up to an injection `ι`) in which every adjacent pair of `G*` +lies in an edge. The result used +later is `isTangle_skeletonTangle`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Hypergraph GraphMinor.GM10 GraphMinor.GM17 + +universe u v u' v' + +variable {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} + +/-- The set `𝒯'` of the proof of (15.2) (page 382): "the set of all separations $(A', B')$ of +$sk(\Gamma)$ of order $\le n$ such that there +exists $(A, B) \in \mathscr{T}$ with $V(A) = V(A')$ and $V(B) = V(B')$". -/ +def skeletonTangle (ι : α → α') (H : Hypergraph α' β') (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (m : ℕ) : Set (Hypergraph α' β' × Hypergraph α' β') := + {p | H.IsSeparation p.1 p.2 ∧ separationOrder p.1 p.2 < m ∧ ∃ q ∈ 𝒯, ι '' q.1.vertexSet + = p.1.vertexSet ∧ ι '' q.2.vertexSet = p.2.vertexSet} + +/-- The part of `G*` with vertex set `P` and edge set `E`. -/ +def skeletonPart (G : Hypergraph α β) (P : Set α) (E : Set (Sym2 α)) (hP : P ⊆ G.vertexSet) + (hE : E ⊆ (oneSkeletonHypergraph G).edgeSet) (hEP : ∀ e ∈ E, ∀ v ∈ e, v ∈ P) : Hypergraph α + (Sym2 α) where + vertexSet := P + edgeSet := E + Inc e v := e ∈ E ∧ v ∈ e + vertex_mem_of_inc := fun e v h ↦ hEP e h.1 v h.2 + edge_mem_of_inc := fun _ _ h ↦ h.1 + vertexSet_finite := G.vertexSet_finite.subset hP + edgeSet_finite := (oneSkeletonHypergraph G).edgeSet_finite.subset hE + +variable {ι : α → α'} {H : Hypergraph α' β'} {G : Hypergraph α β} + +/-- A separation of `H` gives a separation of `G*` with the same vertex sets. An edge of `G*` goes +to the first side if an edge of +the first side of `H` contains it, and to the second side otherwise. -/ +theorem exists_skeleton_separation (hV : H.vertexSet = ι '' G.vertexSet) + (hadj : ∀ x y, G.skeleton.Adj x y → ∃ f ∈ H.edgeSet, H.Inc f (ι x) ∧ H.Inc f + (ι y)) {A B : Hypergraph α' β'} + (hsep : H.IsSeparation A B) : ∃ A' B' : Hypergraph α (Sym2 α), (oneSkeletonHypergraph + G).IsSeparation A' B' ∧ A'.vertexSet = ι ⁻¹' A.vertexSet ∩ G.vertexSet ∧ + B'.vertexSet = ι ⁻¹' B.vertexSet ∩ G.vertexSet ∧ ∀ e ∈ (oneSkeletonHypergraph G).edgeSet, + (∃ f ∈ A.edgeSet, ∀ v ∈ e, H.Inc f (ι v)) → e ∈ A'.edgeSet := by + classical + let E₁ : Set (Sym2 α) := {e | e ∈ (oneSkeletonHypergraph G).edgeSet + ∧ ∃ f ∈ A.edgeSet, ∀ v ∈ e, H.Inc f (ι v)} + let E₂ : Set (Sym2 α) := (oneSkeletonHypergraph G).edgeSet \ E₁ + have hE₀ : ∀ e ∈ (oneSkeletonHypergraph G).edgeSet, ∀ v ∈ e, v ∈ G.vertexSet := fun e he v hv ↦ + (oneSkeletonHypergraph G).vertex_mem_of_inc ⟨he, hv⟩ + have hinc : ∀ {X : Hypergraph α' β'}, X ≤ H → ∀ {f a}, f ∈ X.edgeSet → H.Inc f a + → a ∈ X.vertexSet := by + intro X hX f a hf ha + have h₁ : a ∈ H.ends f := ha + rw [hX.ends_eq f hf] at h₁ + exact X.vertex_mem_of_inc h₁ + have hP₁ : ∀ e ∈ E₁, ∀ v ∈ e, v ∈ ι ⁻¹' A.vertexSet ∩ G.vertexSet := by + rintro e ⟨he, f, hf, hall⟩ v hv + exact ⟨hinc hsep.left_le hf (hall v hv), hE₀ e he v hv⟩ + have hP₂ : ∀ e ∈ E₂, ∀ v ∈ e, v ∈ ι ⁻¹' B.vertexSet ∩ G.vertexSet := by + rintro e ⟨he, hn⟩ v hv + induction e using Sym2.ind with + | _ x y => + obtain ⟨f, hf, hx, hy⟩ := hadj x y he + have hall : ∀ w ∈ s(x, y), H.Inc f (ι w) := fun w hw ↦ by + rcases Sym2.mem_iff.mp hw with rfl | rfl + · exact hx + · exact hy + have hfU : f ∈ (A ∪ B).edgeSet := by + rw [hsep.union_eq] + exact hf + rcases hfU with hfA | hfB + · exact absurd ⟨he, f, hfA, hall⟩ hn + · exact ⟨hinc hsep.right_le hfB (hall v hv), hE₀ _ he v hv⟩ + let A' := skeletonPart G (ι ⁻¹' A.vertexSet ∩ G.vertexSet) E₁ inter_subset_right + (fun _ h ↦ h.1) hP₁ + let B' := skeletonPart G (ι ⁻¹' B.vertexSet ∩ G.vertexSet) E₂ inter_subset_right + (fun _ h ↦ h.1) hP₂ + have hle : ∀ {P E h₁ h₂ h₃}, skeletonPart G P E h₁ h₂ h₃ ≤ oneSkeletonHypergraph G + := fun {P E h₁ h₂ h₃} ↦ ⟨h₁, h₂, fun e he ↦ by + ext v + exact ⟨fun h ↦ ⟨he, h.2⟩, fun h ↦ ⟨h₂ he, h.2⟩⟩⟩ + refine ⟨A', B', ⟨hle, hle, ?_, ?_⟩, rfl, rfl, fun e he hx ↦ ⟨he, hx⟩⟩ + · refine Hypergraph.ext ?_ ?_ ?_ + · change (ι ⁻¹' A.vertexSet ∩ G.vertexSet) ∪ (ι ⁻¹' B.vertexSet ∩ G.vertexSet) = G.vertexSet + refine Subset.antisymm (union_subset inter_subset_right inter_subset_right) fun x hx ↦ ?_ + have h₁ : ι x ∈ H.vertexSet := hV ▸ mem_image_of_mem _ hx + rw [← hsep.union_eq] at h₁ + rcases h₁ with h | h + · exact Or.inl ⟨h, hx⟩ + · exact Or.inr ⟨h, hx⟩ + · change E₁ ∪ E₂ = _ + exact union_sdiff_cancel fun _ h ↦ h.1 + · ext e v + constructor + · rintro (h | h) + · exact ⟨h.1.1, h.2⟩ + · exact ⟨h.1.1, h.2⟩ + · rintro ⟨he, hv⟩ + by_cases h : e ∈ E₁ + · exact Or.inl ⟨h, hv⟩ + · exact Or.inr ⟨⟨he, h⟩, hv⟩ + · ext e + constructor + · rintro ⟨h₁, h₂⟩ + exact absurd h₁ h₂.2 + · exact fun h ↦ absurd h (notMem_empty e) + +/-- **`𝒯'` is a tangle.** -/ +theorem isTangle_skeletonTangle (hι : Function.Injective ι) (hV : H.vertexSet = ι '' G.vertexSet) + (hadj : ∀ x y, G.skeleton.Adj x y → ∃ f ∈ H.edgeSet, H.Inc f (ι x) ∧ H.Inc f (ι y)) + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {m : ℕ} (h𝒯 : ∀ q ∈ 𝒯, G.IsSeparation q.1 q.2) + (hT : IsTangle (oneSkeletonHypergraph G) m (oneSkeletonTangle G 𝒯 m)) : IsTangle H m + (skeletonTangle ι H 𝒯 m) := by + have hord : ∀ {A B A' B'}, H.IsSeparation A B → (A' : Hypergraph α (Sym2 α)).vertexSet + = ι ⁻¹' A.vertexSet ∩ G.vertexSet → (B' : Hypergraph α (Sym2 α)).vertexSet + = ι ⁻¹' B.vertexSet ∩ G.vertexSet → + separationOrder A' B' = separationOrder A B := by + intro A B A' B' hsep hA hB + have hset : (A ∩ B).vertexSet = ι '' (A' ∩ B').vertexSet := by + ext x + constructor + · rintro ⟨h₁, h₂⟩ + have hx : x ∈ ι '' G.vertexSet := hV ▸ hsep.left_le.vertexSet_subset h₁ + obtain ⟨y, hy, rfl⟩ := hx + exact ⟨y, ⟨hA ▸ ⟨h₁, hy⟩, hB ▸ ⟨h₂, hy⟩⟩, rfl⟩ + · rintro ⟨y, ⟨h₁, h₂⟩, rfl⟩ + rw [hA] at h₁ + rw [hB] at h₂ + exact ⟨h₁.1, h₂.1⟩ + rw [separationOrder, separationOrder, hset, ncard_image_of_injective _ hι] + have hVeq : ∀ {A}, A ≤ H → ι '' (ι ⁻¹' A.vertexSet ∩ G.vertexSet) = A.vertexSet := by + intro A hA + ext x + constructor + · rintro ⟨y, ⟨h, -⟩, rfl⟩ + exact h + · intro hx + have hx' : x ∈ ι '' G.vertexSet := hV ▸ hA.vertexSet_subset hx + obtain ⟨y, hy, rfl⟩ := hx' + exact ⟨y, ⟨hx, hy⟩, rfl⟩ + have hback : ∀ {Q : Set α}, Q ⊆ G.vertexSet → ι ⁻¹' (ι '' Q) ∩ G.vertexSet = Q := fun {Q} hQ ↦ by + rw [preimage_image_eq _ hι, inter_eq_left.mpr hQ] + refine ⟨hT.one_le, fun _ _ h ↦ h.1, fun _ _ h ↦ h.2.1, fun A B hsep ho ↦ ?_, + fun A₁ B₁ A₂ B₂ A₃ B₃ h₁ h₂ h₃ hU ↦ ?_, fun A B h hAV ↦ ?_⟩ + · obtain ⟨A', B', hs, hA, hB, -⟩ := exists_skeleton_separation hV hadj hsep + have ho' : separationOrder A' B' < m := by rwa [hord hsep hA hB] + rcases hT.axiom1 hs ho' with ⟨-, -, q, hq, h₁, h₂⟩ | ⟨-, -, q, hq, h₁, h₂⟩ + · exact Or.inl ⟨hsep, ho, q, hq, by rw [h₁, hA, hVeq hsep.left_le], by rw [h₂, hB, + hVeq hsep.right_le]⟩ + · refine Or.inr ⟨hsep.symm, by rwa [separationOrder_comm], q, hq, ?_, ?_⟩ + · change ι '' q.1.vertexSet = B.vertexSet + rw [h₁, hB, hVeq hsep.right_le] + · change ι '' q.2.vertexSet = A.vertexSet + rw [h₂, hA, hVeq hsep.left_le] + · have hmem : ∀ {A B}, (A, B) ∈ skeletonTangle ι H 𝒯 m → ∃ A' B' : Hypergraph α (Sym2 α), + (A', B') ∈ oneSkeletonTangle G 𝒯 m ∧ A'.vertexSet = ι ⁻¹' A.vertexSet ∩ G.vertexSet ∧ + ∀ e ∈ (oneSkeletonHypergraph G).edgeSet, (∃ f ∈ A.edgeSet, ∀ v ∈ e, H.Inc f (ι v)) + → e ∈ A'.edgeSet := fun {A B} h ↦ by + obtain ⟨hs, ho, hc⟩ := h + obtain ⟨A', B', hs', hA, hB, hE⟩ := exists_skeleton_separation hV hadj hs + exact ⟨A', B', ⟨hs', by rwa [hord hs hA hB], Exists.elim hc fun q hq ↦ ⟨q, hq.1, by rw [hA, ← + hq.2.1, hback (h𝒯 q hq.1).left_le.vertexSet_subset], by rw [hB, ← hq.2.2, hback + (h𝒯 q hq.1).right_le.vertexSet_subset]⟩⟩, hA, hE⟩ + obtain ⟨X₁, Y₁, m₁, hX₁, hE₁⟩ := hmem h₁ + obtain ⟨X₂, Y₂, m₂, hX₂, hE₂⟩ := hmem h₂ + obtain ⟨X₃, Y₃, m₃, hX₃, hE₃⟩ := hmem h₃ + refine hT.axiom2 m₁ m₂ m₃ ?_ + have hs₁ := hT.isSeparation m₁ + have hs₂ := hT.isSeparation m₂ + have hs₃ := hT.isSeparation m₃ + set U := X₁ ∪ X₂ ∪ X₃ with hUdef + have hincI : ∀ {X : Hypergraph α (Sym2 α)}, X ≤ oneSkeletonHypergraph G → ∀ {e v}, X.Inc e v → + (oneSkeletonHypergraph G).Inc e v := fun {X} hX {e v} h ↦ by + have h₀ : v ∈ X.ends e := h + rw [← hX.ends_eq e (X.edge_mem_of_inc h)] at h₀ + exact h₀ + have hincE : ∀ {X : Hypergraph α (Sym2 α)}, X ≤ oneSkeletonHypergraph G + → ∀ {e v}, e ∈ X.edgeSet → (oneSkeletonHypergraph G).Inc e v → X.Inc e v + := fun {X} hX {e v} he h ↦ by + have h₀ : v ∈ (oneSkeletonHypergraph G).ends e := h + rw [hX.ends_eq e he] at h₀ + exact h₀ + have hends : ∀ e ∈ U.edgeSet, (oneSkeletonHypergraph G).ends e = U.ends e := by + intro e he + ext v + constructor + · intro hv + rcases he with (h | h) | h + · exact Or.inl (Or.inl (hincE hs₁.left_le h hv)) + · exact Or.inl (Or.inr (hincE hs₂.left_le h hv)) + · exact Or.inr (hincE hs₃.left_le h hv) + · rintro ((h | h) | h) + · exact hincI hs₁.left_le h + · exact hincI hs₂.left_le h + · exact hincI hs₃.left_le h + refine le_antisymm (Hypergraph.IsSubhypergraph.mk ?_ ?_ hends) (Hypergraph.IsSubhypergraph.mk + ?_ ?_ fun e he ↦ ?_) + · rintro x ((h | h) | h) + · exact hs₁.left_le.vertexSet_subset h + · exact hs₂.left_le.vertexSet_subset h + · exact hs₃.left_le.vertexSet_subset h + · rintro x ((h | h) | h) + · exact hs₁.left_le.edgeSet_subset h + · exact hs₂.left_le.edgeSet_subset h + · exact hs₃.left_le.edgeSet_subset h + · intro x hx + have h₀ : ι x ∈ H.vertexSet := hV ▸ mem_image_of_mem _ hx + rw [← hU] at h₀ + rcases h₀ with (h | h) | h + · exact Or.inl (Or.inl (hX₁ ▸ ⟨h, hx⟩)) + · exact Or.inl (Or.inr (hX₂ ▸ ⟨h, hx⟩)) + · exact Or.inr (hX₃ ▸ ⟨h, hx⟩) + · have key : ∀ e ∈ (oneSkeletonHypergraph G).edgeSet, e ∈ U.edgeSet := by + intro e he + induction e using Sym2.ind with + | _ x y => + obtain ⟨f, hf, hx, hy⟩ := hadj x y he + have hall : ∀ w ∈ s(x, y), H.Inc f (ι w) := fun w hw ↦ by + rcases Sym2.mem_iff.mp hw with rfl | rfl + · exact hx + · exact hy + have hf' : f ∈ (A₁ ∪ A₂ ∪ A₃).edgeSet := by + rw [hU] + exact hf + rcases hf' with (h | h) | h + · exact Or.inl (Or.inl (hE₁ _ he ⟨f, h, hall⟩)) + · exact Or.inl (Or.inr (hE₂ _ he ⟨f, h, hall⟩)) + · exact Or.inr (hE₃ _ he ⟨f, h, hall⟩) + exact key + · have he' : e ∈ U.edgeSet := by + induction e using Sym2.ind with + | _ x y => + obtain ⟨f, hf, hx, hy⟩ := hadj x y he + have hall : ∀ w ∈ s(x, y), H.Inc f (ι w) := fun w hw ↦ by + rcases Sym2.mem_iff.mp hw with rfl | rfl + · exact hx + · exact hy + have hf' : f ∈ (A₁ ∪ A₂ ∪ A₃).edgeSet := by + rw [hU] + exact hf + rcases hf' with (h | h) | h + · exact Or.inl (Or.inl (hE₁ _ he ⟨f, h, hall⟩)) + · exact Or.inl (Or.inr (hE₂ _ he ⟨f, h, hall⟩)) + · exact Or.inr (hE₃ _ he ⟨f, h, hall⟩) + exact (hends e he').symm + · have hs := h.1 + obtain ⟨A', B', hs', hA, hB, -⟩ := exists_skeleton_separation hV hadj hs + obtain ⟨q, hq, h₁, h₂⟩ := h.2.2 + refine hT.axiom3 (A := A') (B := B') ⟨hs', (hord hs hA hB).trans_lt h.2.1, q, hq, by rw [hA, ← + h₁, hback (h𝒯 q hq).left_le.vertexSet_subset], by rw [hB, ← h₂, hback + (h𝒯 q hq).right_le.vertexSet_subset]⟩ ?_ + change _ = G.vertexSet + rw [hA, hAV] + rw [hV, preimage_image_eq _ hι, Set.inter_self] + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Spokes.lean b/LeanPool/GraphMinor/GM19/Spokes.lean new file mode 100644 index 0000000000..0bfe68c7b5 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Spokes.lean @@ -0,0 +1,217 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Perimeter +public import LeanPool.GraphMinor.GM11.RadialCorners +public import LeanPool.GraphMinor.GM11.RadialExists +import LeanPool.GraphMinor.GM11.RadialChord +public import Mathlib.Topology.Separation.Connected + +/-! +# Each vertex in the closure of a region has a spoke to the centre of the region + +`GM11.exists_spoke_at` says this for a radial drawing of a drawing of Graph Minors XI. A radial +drawing of a painting of XIX has no spokes in the discs of the edges of size 3, so it is not a +radial +drawing of `sk(Γ)`. We add the missing centres and extend to a radial drawing of `sk(Γ)`. A spoke of +that in a region of `Γ` can be added to the first drawing, so by maximality that drawing has a spoke +with the same ends. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface unitInterval + +/-- A maximal pre-radial drawing contains a spoke that bounds no disc with another spoke. -/ +theorem mem_spoke_line_of_no_bounded_disc {T : Type} [TopologicalSpace T] [T2Space T] + {U V : Set T} {G : Drawing T} + (hpre : IsPreRadial U V G) + (hmax : ∀ G' : Drawing T, IsPreRadial U V G' → G.IsSubdrawing G' → G'.IsSubdrawing G) + {r : Set T} {c x : T} (hcr : c ∈ r) (hc : c ∈ G.V) (hx : x ∈ V) + {K : Set T} (hK : IsLineWithEnds K c x) (hcx : c ≠ x) (hKr : K \ {c, x} ⊆ r) + (hKU : Disjoint (K \ {c, x}) G.U) (hrU : Disjoint r U) (hVU : V ⊆ U) + (hiv : ∀ f ∈ G.E, K \ {c, x} ≠ f → ∀ v ∈ V, ∀ r' ∈ componentsIn Uᶜ, ∀ w ∈ r' ∩ G.V, + K ∩ G.V = {v, w} → closure f ∩ G.V = {v, w} → + ¬ ∃ Δ : Set T, IsClosedDisc Δ ∧ Δ ⊆ r' ∪ {v} ∧ subBd Δ = K ∪ closure f) : + K \ {c, x} ∈ G.E := by + obtain ⟨G₂, hpre', hGV, hGE, _⟩ := + GM11.exists_glue_spoke_of_no_bounded_disc (R := componentsIn Uᶜ) hpre hcr hc hx hK hcx + hKr hKU hrU hVU hiv + have hsub : G.IsSubdrawing G₂ := ⟨by rw [hGV], by rw [hGE]; exact subset_union_left⟩ + exact (hmax G₂ hpre' hsub).2 (by rw [hGE]; exact Or.inr rfl) + +/-- A spoke can be added unless there is already one with the same ends. The proof follows +`GM11.exists_parallel_spoke`. -/ +theorem exists_spoke_of_line {T : Type} [TopologicalSpace T] [T2Space T] {U V : Set T} {G : Drawing + T} + (hpre : IsPreRadial U V G) + (hmax : ∀ G' : Drawing T, IsPreRadial U V G' → G.IsSubdrawing G' → G'.IsSubdrawing G) + {r : Set T} (_hr : r ∈ componentsIn Uᶜ) {c x : T} (hcr : c ∈ r) (hc : c ∈ G.V) (hx : x ∈ V) + {K : Set T} (hK : IsLineWithEnds K c x) (hcx : c ≠ x) (hKr : K \ {c, x} ⊆ r) + (hKU : Disjoint (K \ {c, x}) G.U) (hrU : Disjoint r U) (hVU : V ⊆ U) : + ∃ h ∈ G.E, closure h ∩ G.V = {x, c} := by + by_contra hno + have hKV := GM11.line_inter_spoke_vertices hc (hpre.2.1 hx) hK hcx hKU + have hmem := mem_spoke_line_of_no_bounded_disc hpre hmax hcr hc hx hK hcx hKr hKU hrU hVU + (fun f hf _ v _ _ _ w _ hKe hfe _ => hno ⟨f, hf, hfe.trans (hKe.symm.trans hKV)⟩) + obtain ⟨y, hy⟩ := (GM11.isPathConnected_sdiff_pair hK).nonempty + exact disjoint_left.mp hKU hy (G.closure_subset_U hmem (subset_closure hy)) + +variable {S Shat : Type} [TopologicalSpace S] [T2Space S] [TopologicalSpace Shat] + +theorem IsSkHat.E_nonempty {cap : IsCappedSurface S Shat} {Γ : Painting S} {D : Drawing Shat} + (hD : IsSkHat cap Γ D) (hE : Γ.E.Nonempty) : D.E.Nonempty := by + obtain ⟨c, hc⟩ := hE + have hy : ∃ y, y ∈ Γ.skU \ Γ.V := by + rcases Γ.size_cases hc with h2 | h3 + · obtain ⟨y, hy⟩ := hc.1 + exact ⟨y, Or.inl (Or.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h2⟩, hy⟩)), Γ.disjoint_V hc hy⟩ + · obtain ⟨hdisc, hT, hfin⟩ := Γ.isDisc_of_three hc h3 + have htl : tilde c ⊆ discBd (closure c) := hT + have hnt : (discBd (closure c)).Nontrivial := by + obtain ⟨a, b, z, hab, -, -, hset⟩ := Set.ncard_eq_three.mp h3 + exact ⟨a, htl (hset ▸ Or.inl rfl), b, htl (hset ▸ Or.inr (Or.inl rfl)), hab⟩ + have hinf : (discBd (closure c)).Infinite := by + obtain ⟨φ⟩ := hdisc.isOArc_discBd + have hconn : IsPreconnected (discBd (closure c)) := by + have : discBd (closure c) = range fun z ↦ (φ z).1 := by + ext x + exact ⟨fun hx ↦ ⟨φ.symm ⟨x, hx⟩, by simp⟩, by rintro ⟨z, rfl⟩; exact (φ z).2⟩ + rw [this] + exact isPreconnected_range (continuous_subtype_val.comp φ.continuous) + exact IsPreconnected.infinite_of_nontrivial hconn hnt + obtain ⟨y, hy, hyn⟩ := hinf.exists_notMem_finite hfin + refine ⟨y, Or.inr (mem_iUnion₂.2 ⟨c, ⟨hc, h3⟩, hy⟩), fun hyV ↦ hyn ?_⟩ + have := discBd_subset _ hy + exact ⟨this, fun hyc ↦ Γ.disjoint_V hc hyc hyV⟩ + obtain ⟨y, hy⟩ := hy + obtain ⟨e, he, -⟩ := exists_arcComp_superset (isPathConnected_singleton y) + (singleton_subset_iff.2 hy) + exact ⟨_, hD.edge_iff.mpr ⟨e, he, rfl⟩⟩ + +theorem closure_edge_subset {T : Type} [TopologicalSpace T] [T2Space T] {G : Drawing T} {e : Set T} + (he : e ∈ G.E) : closure e ⊆ e ∪ G.V := by + have hne : Nonempty T := he.1.to_subtype.map Subtype.val + obtain ⟨γ, hγ⟩ := GM11.exists_edgePar G + have hcl : closure e ⊆ range (γ e) := by + refine closure_minimal ?_ (isCompact_range (hγ.cont e he)).isClosed + intro x hx + rw [← hγ.image e he] at hx + obtain ⟨t, -, rfl⟩ := hx + exact mem_range_self t + intro x hx + obtain ⟨t, rfl⟩ := hcl hx + by_cases h0 : t = 0 + · exact Or.inr (h0 ▸ hγ.zero e he) + by_cases h1 : t = 1 + · exact Or.inr (h1 ▸ hγ.one e he) + refine Or.inl ((hγ.image e he).subset ?_) + exact ⟨t, ⟨unitInterval.pos_iff_ne_zero.mpr h0, unitInterval.lt_one_iff_ne_one.mpr h1⟩, rfl⟩ + +/-- **A spoke at each vertex in the closure of a region.** -/ +theorem RadialDrawing.exists_spoke {cap : IsCappedSurface S Shat} {Γ : Painting S} + (rad : RadialDrawing cap Γ) (hS : IsSurface S) (h2 : ∀ r ∈ Γ.hatRegions cap, IsOpenDisc r) + (hE : Γ.E.Nonempty) {w : Shat} (hw : w ∈ rad.Rstar) {v : S} (hv : v ∈ Γ.V) + (hcl : cap.emb v ∈ closure (rad.regionOf w)) : + ∃ e ∈ rad.G.E, closure e ∩ rad.G.V = {cap.emb v, w} := by + classical + have hT := cap.isClosedSurface + have : T2Space Shat := hT.2.1 + have : ConnectedSpace Shat := cap.connected + obtain ⟨D, W, hDU, hDV, hD2, -, hG'⟩ := Γ.exists_hubDrawing hS cap h2 + have hD : IsSkHat cap Γ D := ⟨hDU, hDV⟩ + obtain ⟨G', hpre, hU', hV', hE'⟩ := hG' rad.G rad.isPreRadial + obtain ⟨hG1, hG2, hG3, hG4, hG5, hG6⟩ := id rad.isPreRadial + have hhat : ∀ x ∈ Γ.hatRegions cap, Disjoint x (Γ.hatU cap) := by + rintro _ ⟨y, hy, rfl⟩ + exact disjoint_left.mpr fun z hz hzU ↦ connectedComponentIn_subset _ _ hz hzU + obtain ⟨r₀, hr₀, hwr₀⟩ := hG4 w hw + have hwU : w ∈ (Γ.hatU cap)ᶜ := fun hc ↦ disjoint_left.mp (hhat r₀ hr₀) hwr₀ hc + set r := rad.regionOf w with hrdef + have hrhat : r ∈ Γ.hatRegions cap := ⟨w, hwU, rfl⟩ + have hwr : w ∈ r := mem_connectedComponentIn hwU + have hrD := hD.hatRegion_mem_R hrhat + have hvhat : cap.emb v ∈ Γ.hatV cap := mem_image_of_mem _ hv + have hvD : cap.emb v ∈ D.V := by + rw [hDV] + exact hvhat + have hGsub : rad.G.IsSubdrawing G' := ⟨by rw [hV']; exact subset_union_left, by rw [hE']⟩ + let A : Set ℕ := {n | ∃ G₄ : Drawing Shat, (GM11.PaintingOrDrawing.drawing D).IsPreRadialDrawing + G₄ ∧ + G'.IsSubdrawing G₄ ∧ G₄.E.ncard = n} + have hAne : A.Nonempty := ⟨_, G', hpre, ⟨subset_rfl, subset_rfl⟩, rfl⟩ + have hAb : BddAbove A := ⟨D.V.ncard + 2 * D.E.ncard, by + rintro _ ⟨G₄, h₄, -, rfl⟩ + exact GM11.ncard_spokes_le (Γ := D) (Γ' := G₄) ⟨hD2, h₄⟩ hT⟩ + obtain ⟨G₃, hpre₃, hsub₃, hc₃⟩ := Nat.sSup_mem hAne hAb + have hrad : GM11.PreRad (GM11.PaintingOrDrawing.drawing D) G₃ := ⟨hD2, hpre₃⟩ + have hmax : GM11.RadMax (GM11.PaintingOrDrawing.drawing D) G₃ := by + intro G₄ h₄ hs + refine ⟨fun y hy ↦ ?_, ?_⟩ + · by_cases hyV : y ∈ D.V + · exact hpre₃.2.1 hyV + obtain ⟨p, hp, hyp⟩ := h₄.2.2.2.1 y ⟨hy, hyV⟩ + obtain ⟨y', ⟨hy'p, hy'⟩, -⟩ := hpre₃.2.2.1 p hp + rw [(h₄.2.2.1 p hp).unique ⟨hyp, hy⟩ ⟨hy'p, hs.1 hy'⟩] + exact hy' + · have hle : G₄.E.ncard ≤ G₃.E.ncard := by + rw [hc₃] + exact le_csSup hAb ⟨G₄, h₄, ⟨hsub₃.1.trans hs.1, hsub₃.2.trans hs.2⟩, rfl⟩ + exact (eq_of_subset_of_ncard_le hs.2 hle G₄.finite_edges).ge + have hsub : rad.G.IsSubdrawing G₃ := ⟨hGsub.1.trans hsub₃.1, hGsub.2.trans hsub₃.2⟩ + have hw₃ : w ∈ G₃.V := hsub.1 hw.1 + obtain ⟨h, hh, hcap⟩ := GM11.exists_spoke_at hrad hmax hT (hD.E_nonempty hE) hrD hwr hw₃ hvD + hcl + have hwv : w ≠ cap.emb v := fun he ↦ hw.2 (he ▸ hvhat) + have hvG : cap.emb v ∈ rad.G.V := hG2 hvhat + by_cases hhG : h ∈ rad.G.E + · refine ⟨h, hhG, Subset.antisymm ?_ ?_⟩ + · rintro y ⟨hy, hyG⟩ + have : y ∈ closure h ∩ G₃.V := ⟨hy, hsub.1 hyG⟩ + rwa [hcap] at this + · rintro y (rfl | rfl) + · have : cap.emb v ∈ closure h ∩ G₃.V := by rw [hcap]; exact Or.inl rfl + exact ⟨this.1, hvG⟩ + · have : y ∈ closure h ∩ G₃.V := by rw [hcap]; exact Or.inr rfl + exact ⟨this.1, hw.1⟩ + have hK : IsLineWithEnds (closure h) w (cap.emb v) := + GM11.isLine_closure hh hwv (by rw [hcap, pair_comm]) + obtain ⟨v', hv', r', hr', w', hw', hw'V, hset, hsubr⟩ := GM11.spoke_ends hrad hT hh + have hw'D : w' ∉ D.V := fun hc ↦ GM11.region_subset hr' hw' (D.V_subset_U hc) + have hwD : w ∉ D.V := fun hc ↦ hw.2 (by rw [hDV] at hc; exact hc) + have hww : w' = w := by + have h₁ : w' ∈ closure h ∩ G₃.V := by rw [hset]; exact Or.inr rfl + rw [hcap] at h₁ + rcases h₁ with h₁ | h₁ + · exact absurd (h₁ ▸ hvD) hw'D + · exact h₁ + subst hww + have hrr : r' = r := GM11.region_eq_of_mem hr' hrD hw' hwr + subst hrr + have hKsd : closure h \ {w', cap.emb v} ⊆ h := by + rintro y ⟨hy, hyn⟩ + rcases closure_edge_subset hh hy with h₁ | h₁ + · exact h₁ + · have h₂ : y ∈ closure h ∩ G₃.V := ⟨hy, h₁⟩ + rw [hcap] at h₂ + exact absurd (show y ∈ ({w', cap.emb v} : Set Shat) by rw [pair_comm]; exact h₂) hyn + have hKU : Disjoint (closure h \ {w', cap.emb v}) rad.G.U := by + refine disjoint_left.mpr fun y hy hyG ↦ ?_ + have hyh := hKsd hy + have hyV : y ∉ rad.G.V := fun hc ↦ (hh.2.1 hyh).2 (hsub.1 hc) + obtain ⟨e, he, hye⟩ := exists_arcComp_superset (F := rad.G.U \ rad.G.V) + (isPathConnected_singleton y) (singleton_subset_iff.2 ⟨hyG, hyV⟩) + exact hhG (arcComp_eq_of_mem hh (hsub.2 he) hyh (hye rfl) ▸ he) + exact exists_spoke_of_line rad.isPreRadial rad.maximal hrhat hwr hw.1 hvhat hK hwv + (hKsd.trans hsubr) hKU (hhat _ hrhat) (image_mono Γ.V_subset) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Theta.lean b/LeanPool/GraphMinor/GM19/Theta.lean new file mode 100644 index 0000000000..736445953d --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Theta.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM14.DiscSlope +public import LeanPool.GraphMinor.Surface.Epstein +import LeanPool.GraphMinor.GM11.DrawingTopology + +/-! +# Three paths with the same ends + +Let three lines with the same ends be otherwise disjoint. If two of the three `O`-arcs they form are +null-homotopic, so +is the third. The proof of (5.5) uses this to shorten a circuit of `Γ*` through a pole. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface GraphMinor.GM11 + +variable {T : Type} [TopologicalSpace T] + +/-- If `A₁ ∪ A₂` and `A₂ ∪ A₀` are null-homotopic, then so is `A₀ ∪ A₁`. -/ +theorem null_of_theta [ConnectedSpace T] (hT : IsClosedSurface T) {A₀ A₁ A₂ : Set T} {a b : T} + (l₀ : IsLineWithEnds A₀ a b) (l₁ : IsLineWithEnds A₁ a b) (l₂ : IsLineWithEnds A₂ a b) + (i₀₁ : A₀ ∩ A₁ = {a, b}) (i₁₂ : A₁ ∩ A₂ = {a, b}) (i₂₀ : A₂ ∩ A₀ = {a, b}) + (hO : IsOArc (A₀ ∪ A₁)) (hO₁ : IsOArc (A₁ ∪ A₂)) (hO₂ : IsOArc (A₂ ∪ A₀)) + (n₀ : IsNullHomotopicOArc (A₁ ∪ A₂)) (n₁ : IsNullHomotopicOArc (A₂ ∪ A₀)) : + IsNullHomotopicOArc (A₀ ∪ A₁) := by + have hS := IsClosedSurface.isSurface hT + have : T2Space T := hT.2.1 + have hbd : ∀ F : Set T, Disjoint F (bd T) := fun F ↦ by + rw [show bd T = ∅ from eq_empty_of_forall_notMem fun x hx ↦ hx (hT.2.2 x)] + exact disjoint_empty _ + obtain ⟨Δ₀, -, d₀, f₀'⟩ := (epstein T univ _ hS inferInstance hO₁ (subset_univ _) (hbd _)).1 n₀ + obtain ⟨Δ₁, -, d₁, f₁'⟩ := (epstein T univ _ hS inferInstance hO₂ (subset_univ _) (hbd _)).1 n₁ + have f₀ : frontier Δ₀ = A₁ ∪ A₂ := by rw [IsClosedDisc.frontier_eq_discBd hT d₀, f₀'] + have f₁ : frontier Δ₁ = A₂ ∪ A₀ := by rw [IsClosedDisc.frontier_eq_discBd hT d₁, f₁'] + have hnull : ∀ Δ : Set T, IsClosedDisc Δ → A₀ ∪ A₁ ⊆ Δ → IsNullHomotopicOArc (A₀ ∪ A₁) + := fun Δ hΔ hsub ↦ + (epstein T univ _ hS inferInstance hO (subset_univ _) (hbd _)).2.1 ⟨Δ, subset_univ _, hΔ, hsub⟩ + have c₀ : IsClosed Δ₀ := d₀.isCompact.isClosed + have c₁ : IsClosed Δ₁ := d₁.isCompact.isClosed + have sub₀ : A₁ ∪ A₂ ⊆ Δ₀ := f₀ ▸ c₀.frontier_subset + have sub₁ : A₂ ∪ A₀ ⊆ Δ₁ := f₁ ▸ c₁.frontier_subset + by_cases h₀ : A₀ ⊆ Δ₀ + · exact hnull Δ₀ d₀ (union_subset h₀ (subset_union_left.trans sub₀)) + by_cases h₁ : A₁ ⊆ Δ₁ + · exact hnull Δ₁ d₁ (union_subset (subset_union_right.trans sub₁) h₁) + obtain ⟨dU, -, -, -, -⟩ := + GM11.theta_glue_discs hT l₀ l₁ l₂ i₀₁ i₁₂ i₂₀ d₀ d₁ f₀ f₁ h₀ h₁ + exact hnull _ dU (union_subset (subset_union_right.trans sub₁ |>.trans subset_union_right) + (subset_union_left.trans sub₀ |>.trans subset_union_left)) + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/ThinFits.lean b/LeanPool/GraphMinor/GM19/ThinFits.lean new file mode 100644 index 0000000000..ac93655642 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/ThinFits.lean @@ -0,0 +1,404 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.ThinPainting + +/-! +# The narrow painting is internally 3-connected + +We keep the setting of `GraphMinor.GM19.ThinPainting`, with the small disc `Δ(c)` taken from +`GraphMinor.GM19.exists_lenses`. Between `Δ(c)` and the boundary of `cBar` lie three lenses. A +closed curve that +misses the new painting away from its vertices can be pushed off the lenses, by `push_off_side`. +After that +it misses the old painting too. So the old painting says what we need of the curve. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +/-- The small disc `Δ` and the lenses of a disc `D` with three marked boundary points `T`. -/ +structure LensAt (D Δ T : Set S) (L R : Fin 3 → Set S) : Prop where + disc : IsClosedDisc Δ + sub : Δ ⊆ D + T_bd : T ⊆ discBd Δ + cap : Δ ∩ discBd D = T + bdΔ : discBd Δ ⊆ ⋃ i, L i + lens : ∀ i, ∃ a b d, T = {a, b, d} ∧ a ≠ b ∧ a ≠ d ∧ b ≠ d ∧ IsLens D Δ (L i) (R i) a b d + inter : ∀ i j, i ≠ j → R i ∩ R j ⊆ T + cover : D = Δ ∪ ⋃ i, R i + +theorem exists_lensAt {D T : Set S} (hD : IsClosedDisc D) (hT : T ⊆ discBd D) (h3 : T.ncard = 3) : + ∃ Δ, ∃ L R : Fin 3 → Set S, LensAt D Δ T L R := by + obtain ⟨a, b, c, hab, hac, hbc, rfl⟩ := ncard_eq_three.mp h3 + have ha : a ∈ discBd D := hT (by simp) + have hb : b ∈ discBd D := hT (by simp) + have hc : c ∈ discBd D := hT (by simp) + obtain ⟨Δ, L₁, L₂, L₃, R₁, R₂, R₃, h₁, h₂, h₃, h₄, h₅, h₆, h₇, l₁, l₂, l₃, i₁, i₂, i₃, hcov⟩ := + exists_lenses hD ha hb hc hab hac hbc + refine ⟨Δ, ![L₁, L₂, L₃], ![R₁, R₂, R₃], ⟨h₁, h₂, ?_, h₆, ?_, ?_, ?_, ?_⟩⟩ + · rintro x (rfl | rfl | rfl) + · exact h₃ + · exact h₄ + · exact h₅ + · intro x hx + rcases h₇ hx with (h | h) | h + · exact mem_iUnion.2 ⟨0, h⟩ + · exact mem_iUnion.2 ⟨1, h⟩ + · exact mem_iUnion.2 ⟨2, h⟩ + · intro i + fin_cases i + · exact ⟨a, b, c, rfl, hab, hac, hbc, l₁⟩ + · refine ⟨b, c, a, ?_, hbc, hab.symm, hac.symm, l₂⟩ + ext x + simp only [mem_insert_iff, mem_singleton_iff] + tauto + · refine ⟨c, a, b, ?_, hac.symm, hbc.symm, hab, l₃⟩ + ext x + simp only [mem_insert_iff, mem_singleton_iff] + tauto + · intro i j hij + fin_cases i <;> fin_cases j <;> first + | exact absurd rfl hij + | exact i₁ + | exact i₂ + | exact i₃ + | (rw [inter_comm]; first | exact i₁ | exact i₂ | exact i₃) + · rw [hcov] + ext x + simp only [mem_union, mem_iUnion, Fin.exists_fin_succ] + simp + tauto + +namespace LensAt + +variable {D Δ T : Set S} {L R : Fin 3 → Set S} + +omit [T2Space S] in +theorem line_mem {M : Set S} {u v : S} (h : IsLineWithEnds M u v) : u ∈ M ∧ v ∈ M := by + obtain ⟨f, h0, h1⟩ := h + exact ⟨h0 ▸ (f 0).2, h1 ▸ (f 1).2⟩ + +omit [T2Space S] in +/-- A lens holds exactly two marked points, the ends of its line. -/ +theorem inter_T (h : LensAt D Δ T L R) (i : Fin 3) : + ∃ a b, IsLineWithEnds (L i) a b ∧ R i ∩ T = {a, b} ∧ a ≠ b := by + obtain ⟨a, b, d, rfl, hab, had, hbd, hl⟩ := h.lens i + refine ⟨a, b, hl.line, ?_, hab⟩ + have hsub : L i ⊆ R i := hl.L_bd.trans (discBd_subset _) + obtain ⟨ha, hb⟩ := line_mem hl.line + ext x + constructor + · rintro ⟨hx, rfl | rfl | rfl⟩ + · exact Or.inl rfl + · exact Or.inr rfl + · exact absurd hx hl.third + · rintro (rfl | rfl) + · exact ⟨hsub ha, by simp⟩ + · exact ⟨hsub hb, by simp⟩ + +end LensAt + +/-- Each edge of size 3 of `Γ` has a small disc and lenses. -/ +def IsLensed (Γ : Painting S) (Δ : Set S → Set S) (L R : Set S → Fin 3 → Set S) : Prop := + ∀ c ∈ Γ.E, (tilde c).ncard = 3 → LensAt (closure c) (Δ c) (tilde c) (L c) (R c) + +theorem exists_isLensed (Γ : Painting S) : ∃ Δ L R, IsLensed Γ Δ L R := by + classical + have h : ∀ c : Set S, ∃ Δ, ∃ L R : Fin 3 → Set S, c ∈ Γ.E → (tilde c).ncard = 3 → + LensAt (closure c) Δ (tilde c) L R := by + intro c + by_cases hc : c ∈ Γ.E ∧ (tilde c).ncard = 3 + · obtain ⟨hD, hT, -⟩ := Γ.isDisc_of_three hc.1 hc.2 + obtain ⟨Δ, L, R, h⟩ := exists_lensAt hD hT hc.2 + exact ⟨Δ, L, R, fun _ _ ↦ h⟩ + · exact ⟨∅, fun _ ↦ ∅, fun _ ↦ ∅, fun h₁ h₂ ↦ absurd ⟨h₁, h₂⟩ hc⟩ + choose Δ L R h using h + exact ⟨Δ, L, R, h⟩ + +section + +variable {Γ : Painting S} {Δ : Set S → Set S} {L R : Set S → Fin 3 → Set S} + +omit [T2Space S] in +theorem IsLensed.isCore (hl : IsLensed Γ Δ L R) : IsCore Γ Δ := fun c hc h3 ↦ + ⟨(hl c hc h3).disc, (hl c hc h3).sub, (hl c hc h3).T_bd, (hl c hc h3).cap⟩ + +omit [T2Space S] in +theorem closure_inter_closure_subset {c c' : Set S} (hc : c ∈ Γ.E) (hc' : c' ∈ Γ.E) (hne : c ≠ c') : + closure c ∩ closure c' ⊆ Γ.V := by + rintro x ⟨h₁, h₂⟩ + by_contra hn + rcases Γ.closure_subset hc h₁ with h₃ | h₃ + · rcases Γ.closure_subset hc' h₂ with h₄ | h₄ + · exact hne (arcComp_eq_of_mem hc hc' h₃ h₄) + · exact hn h₄ + · exact hn h₃ + +/-- The closed set that stays fixed: the vertices, the edges of size 2, and the small discs. -/ +def fixedZ (Γ : Painting S) (Δ : Set S → Set S) : Set S := + Γ.V ∪ (⋃ e ∈ {e ∈ Γ.E | (tilde e).ncard = 2}, closure e) ∪ + ⋃ c ∈ {c ∈ Γ.E | (tilde c).ncard = 3}, Δ c + +theorem isClosed_fixedZ (hΔ : IsCore Γ Δ) : IsClosed (fixedZ Γ Δ) := by + have htwo : {e ∈ Γ.E | (tilde e).ncard = 2}.Finite := + Γ.finite_edges.subset fun _ h => h.1 + have hthree : {c ∈ Γ.E | (tilde c).ncard = 3}.Finite := + Γ.finite_edges.subset fun _ h => h.1 + exact (Γ.finite_V.isClosed.union (htwo.isClosed_biUnion fun _ _ => isClosed_closure)).union + (hthree.isClosed_biUnion fun c hc => (hΔ c hc.1 hc.2).1.isClosed) + +omit [T2Space S] in +theorem fixedZ_subset : fixedZ Γ Δ ⊆ thinU Γ Δ := by + rintro x ((hx | hx) | hx) + · exact Or.inl (Or.inl (Or.inl hx)) + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hx + rcases Γ.closure_subset he.1 hxe with h | h + · exact Or.inl (Or.inl (Or.inr (mem_iUnion₂.2 ⟨e, he, h⟩))) + · exact Or.inl (Or.inl (Or.inl h)) + · exact Or.inr hx + +omit [T2Space S] in +theorem lens_inter_fixedZ (hl : IsLensed Γ Δ L R) {c : Set S} (hc : c ∈ Γ.E) + (h3 : (tilde c).ncard = 3) (i : Fin 3) : R c i ∩ fixedZ Γ Δ ⊆ L c i := by + obtain ⟨a, b, d, ht, -, -, -, hlens⟩ := (hl c hc h3).lens i + have hV : ∀ x ∈ R c i, x ∈ Γ.V → x ∈ L c i := fun x hx hxV ↦ by + have h₁ : x ∈ closure c ∩ Γ.V := ⟨hlens.sub hx, hxV⟩ + rw [Γ.closure_inter_V hc] at h₁ + obtain ⟨u, v, hline, hset, -⟩ := (hl c hc h3).inter_T i + have h₂ : x ∈ R c i ∩ tilde c := ⟨hx, h₁⟩ + rw [hset] at h₂ + obtain ⟨hu, hv⟩ := LensAt.line_mem hline + rcases h₂ with rfl | rfl + · exact hu + · exact hv + rintro x ⟨hx, (hz | hz) | hz⟩ + · exact hV x hx hz + · obtain ⟨e, he, hxe⟩ := mem_iUnion₂.mp hz + have hne : c ≠ e := fun h ↦ by + have := he.2 + rw [← h] at this + omega + exact hV x hx (closure_inter_closure_subset hc he.1 hne ⟨hlens.sub hx, hxe⟩) + · obtain ⟨c', hc', hxc⟩ := mem_iUnion₂.mp hz + by_cases hcc : c = c' + · subst hcc + rw [← hlens.inter] + exact ⟨hx, hxc⟩ + · exact hV x hx (closure_inter_closure_subset hc hc'.1 hcc + ⟨hlens.sub hx, (hl c' hc'.1 hc'.2).sub hxc⟩) + +/-- A closed curve that misses the narrow painting away from its vertices can be moved so that it +misses `Γ` away from its vertices, with all vertices fixed. -/ +theorem exists_push (hS : IsSurface S) (hl : IsLensed Γ Δ L R) {F : Set S} (hF : IsOArc F) + (hFU : F ∩ thinU Γ Δ ⊆ Γ.V) : + ∃ h : S ≃ₜ S, (∀ n ∈ Γ.V, h n = n) ∧ (h '' F) ∩ Γ.U ⊆ Γ.V := by + let Z3 : Type := {c : Set S // c ∈ Γ.E ∧ (tilde c).ncard = 3} + have hfin : {c ∈ Γ.E | (tilde c).ncard = 3}.Finite := + Γ.finite_edges.subset fun _ h => h.1 + have : Finite Z3 := hfin.to_subtype + let ι : Type := Z3 × Fin 3 + obtain ⟨h, hfix, hZ', hD'⟩ := push_off_side (ι := ι) hS (N := Γ.V) (Z := fixedZ Γ Δ) + (D := fun i ↦ R i.1.1 i.2) (L := fun i ↦ L i.1.1 i.2) Γ.finite_V (isClosed_fixedZ hl.isCore) + (fun i ↦ by + obtain ⟨a, b, d, ht, -, -, -, hlens⟩ := (hl _ i.1.2.1 i.1.2.2).lens i.2 + exact hlens.disc) + (fun i ↦ by + rcases i with ⟨⟨c, hc, h3⟩, i⟩ + obtain ⟨a, b, hline, hset, -⟩ := (hl c hc h3).inter_T i + obtain ⟨a', b', d', ht, -, -, -, hlens⟩ := (hl c hc h3).lens i + refine ⟨a, b, hline, ?_, hlens.L_bd, ?_⟩ + · have heq : R c i ∩ Γ.V = R c i ∩ tilde c := by + rw [← Γ.closure_inter_V hc] + ext x + exact ⟨fun hx ↦ ⟨hx.1, hlens.sub hx.1, hx.2⟩, fun hx ↦ ⟨hx.1, hx.2.2⟩⟩ + exact heq.trans hset + · rintro x ⟨hx, hxb⟩ + rcases Γ.closure_subset hc (hlens.sub hx) with h | h + · have := size_two_of_border Γ hc ⟨x, h, hxb⟩ + omega + · exact h) + (fun i j hij ↦ by + obtain ⟨⟨c, hc, h3⟩, i'⟩ := i + obtain ⟨⟨c', hc', h3'⟩, j'⟩ := j + obtain ⟨_, _, _, -, -, -, -, l₁⟩ := (hl c hc h3).lens i' + obtain ⟨_, _, _, -, -, -, -, l₂⟩ := (hl c' hc' h3').lens j' + by_cases hcc : c = c' + · subst hcc + have hne : i' ≠ j' := fun he ↦ hij (by rw [he]) + exact ((hl c hc h3).inter _ _ hne).trans (Γ.tilde_subset_V hc) + · exact (inter_subset_inter l₁.sub l₂.sub).trans (closure_inter_closure_subset hc hc' hcc)) + (fun i ↦ lens_inter_fixedZ hl i.1.2.1 i.1.2.2 i.2) + hF (fun x hx ↦ hFU ⟨hx.1, fixedZ_subset hx.2⟩) + (fun i x hx ↦ by + rcases i with ⟨⟨c, hc, h3⟩, i⟩ + obtain ⟨_, _, _, -, -, -, -, l₁⟩ := (hl c hc h3).lens i + exact hFU ⟨hx.1, Or.inr (mem_biUnion (show c ∈ {c ∈ Γ.E | (tilde c).ncard = 3} from ⟨hc, h3⟩) + (l₁.sub_Δ hx.2))⟩) + refine ⟨h, hfix, ?_⟩ + rintro x ⟨hxF, hxU⟩ + by_contra hn + have hm : x ∈ Γ.U \ Γ.V := ⟨hxU, hn⟩ + have hc : pathComponentIn (Γ.U \ Γ.V) x ∈ Γ.E := Surface.mem_arcComponentsIn_of_mem hm + have hxc : x ∈ pathComponentIn (Γ.U \ Γ.V) x := mem_pathComponentIn_self hm + rcases Γ.size_cases hc with h2 | h3 + · exact hn (hZ' ⟨hxF, Or.inl (Or.inr (mem_iUnion₂.2 ⟨_, ⟨hc, h2⟩, subset_closure hxc⟩))⟩) + · have hcov := (hl _ hc h3).cover + have hx' : x ∈ closure (pathComponentIn (Γ.U \ Γ.V) x) := subset_closure hxc + rw [hcov] at hx' + rcases hx' with hx' | hx' + · exact hn (hZ' ⟨hxF, Or.inr (mem_biUnion (show _ ∈ {c ∈ Γ.E | (tilde c).ncard = 3} from ⟨hc, + h3⟩) hx')⟩) + · obtain ⟨i, hi⟩ := mem_iUnion.mp hx' + exact hn (hD' (⟨⟨_, hc, h3⟩, i⟩ : ι) ⟨hxF, hi⟩) + +/-- The narrow painting is internally 3-connected. -/ +theorem thin_internally (hS : IsSurface S) (hΓ : Γ.IsInternallyThreeConnected) + (hl : IsLensed Γ Δ L R) (g : Set S → List S) + (hg : ∀ e ∈ Γ.E, (tilde e).ncard = 2 → g e = Γ.γ e ∨ g e = (Γ.γ e).reverse) : + (thinP hl.isCore g hg).IsInternallyThreeConnected := by + have hΔ := hl.isCore + refine ⟨?_, ?_⟩ + · change (arcComponentsIn (thinU Γ Δ \ Γ.V)).Nonempty + rw [pieces_eq hΔ] + obtain ⟨e, he⟩ := hΓ.1 + rcases Γ.size_cases he with h2 | h3 + · exact ⟨e, Or.inl (Γ.two_mem_sk he h2)⟩ + · exact ⟨_, Or.inr ⟨e, ⟨he, h3⟩, rfl⟩⟩ + · intro F hF hFU hfin hcard + change F ∩ thinU Γ Δ ⊆ Γ.V at hFU + change (F ∩ Γ.V).ncard + _ ≤ 2 at hcard + obtain ⟨h, hfix, hnorm⟩ := exists_push hS hl hF hFU + have hsymm : ∀ n ∈ Γ.V, h.symm n = n := fun n hn ↦ by + rw [Homeomorph.symm_apply_eq, hfix n hn] + have hF' : (h '' F) ∩ Γ.V ⊆ F ∩ Γ.V := by + rintro _ ⟨⟨y, hy, rfl⟩, hn⟩ + have h₁ := hsymm _ hn + rw [h.symm_apply_apply] at h₁ + rw [← h₁] at hn ⊢ + exact ⟨hy, hn⟩ + have hbd : (h '' F) ∩ bd S = h '' (F ∩ bd S) := by + rw [image_inter h.injective, image_bd h] + have hcard' : ((h '' F) ∩ bd S).ncard = (F ∩ bd S).ncard := by + rw [hbd, ncard_image_of_injective _ h.injective] + have hle : ((h '' F) ∩ Γ.V).ncard + ((h '' F) ∩ bd S).ncard ≤ 2 := by + have := Set.ncard_le_ncard hF' (Γ.finite_V.inter_of_right _) + rw [hcard'] + omega + obtain ⟨D, h₁, h₂, h₄⟩ := hΓ.2 _ (GM20.image_isOArc h hF) hnorm + (by rw [hbd]; exact hfin.image _) hle + refine ⟨h.symm '' D, GM20.image_isClosedDisc h.symm h₁, ?_, ?_⟩ + · rw [GM20.image_discBd, h₂, ← image_comp] + simp + · rintro _ ⟨⟨y, hy, rfl⟩, hn⟩ + have h₅ : h.symm y ∈ Γ.V := hn + have hyN : y = h (h.symm y) := by simp + rw [hfix _ h₅] at hyN + have h₆ : y ∈ Γ.V := by rw [hyN]; exact h₅ + rw [hsymm y h₆] + exact (hF' ⟨h₄ ⟨hy, h₆⟩, h₆⟩).1 + +/-- The fifth condition of a frame: the only regions next to a new disc are lenses, and a lens has +two +vertices. -/ +theorem thin_region (hS : IsSurface S) (hl : IsLensed Γ Δ L R) (g : Set S → List S) + (hg : ∀ e ∈ Γ.E, (tilde e).ncard = 2 → g e = Γ.γ e ∨ g e = (Γ.γ e).reverse) : + ∀ e ∈ (thinP hl.isCore g hg).E, (tilde e).ncard = 3 → ∀ r ∈ (thinP hl.isCore g hg).regions, + 3 ≤ (closure r ∩ (thinP hl.isCore g hg).V).ncard → + ∀ f ∈ componentsIn (e ∩ closure r), (closure f ∩ bd S).Nonempty := by + have hΔ := hl.isCore + obtain ⟨-, -, hman⟩ := id hS + intro e he h3e r hr hcard f hf + exfalso + change e ∈ arcComponentsIn (thinU Γ Δ \ Γ.V) at he + rw [pieces_eq hΔ] at he + obtain ⟨y₀, hy₀, rfl⟩ := id hf + obtain ⟨c, hc, rfl⟩ : ∃ c, (c ∈ Γ.E ∧ (tilde c).ncard = 3) ∧ core Δ c = e := by + rcases he with he | ⟨c, hc, rfl⟩ + · have := (Γ.sk_size he).1 + omega + · exact ⟨c, hc, rfl⟩ + obtain ⟨hc, h3⟩ := hc + obtain ⟨hxc, hxr⟩ := hy₀ + obtain ⟨r₀, hr₀, hrr⟩ := id hr + have hrU : r ⊆ (thinU Γ Δ)ᶜ := hrr ▸ connectedComponentIn_subset _ _ + have hrc : IsPreconnected r := hrr ▸ isPreconnected_connectedComponentIn + have hlc := hl c hc h3 + have hΔU : Δ c ⊆ thinU Γ Δ := fun x hx ↦ Or.inr (mem_biUnion (show c ∈ {c ∈ Γ.E | (tilde c).ncard + = 3} + from ⟨hc, h3⟩) hx) + have hbdU : discBd (closure c) ⊆ thinU Γ Δ := fun x hx ↦ Or.inl (Or.inr (mem_biUnion + (show c ∈ {c ∈ Γ.E | (tilde c).ncard = 3} from ⟨hc, h3⟩) hx)) + have hopen : ∀ {W : Set S}, IsOpen W → y₀ ∈ W → (W ∩ r).Nonempty := fun hW hy ↦ + mem_closure_iff.mp hxr _ hW hy + by_cases hint : y₀ ∈ discBd (Δ c) + · obtain ⟨i, hi⟩ := mem_iUnion.mp (hlc.bdΔ hint) + obtain ⟨a, b, d, ht, -, -, -, hlens⟩ := hlc.lens i + have hyT : y₀ ∉ tilde c := hxc.2 + have hyR : y₀ ∈ R c i := hlens.L_bd.trans (discBd_subset _) hi + have hyD : y₀ ∉ discBd (closure c) := fun h ↦ hyT (by + rw [← hlc.cap] + exact ⟨hlens.sub_Δ hi, h⟩) + let W : Set S := discInt (closure c) \ ⋃ j ∈ ({i}ᶜ : Set (Fin 3)), R c j + have hW : IsOpen W := by + refine ((Γ.isDisc_of_three hc h3).1.isOpen_discInt hman).sdiff ?_ + refine (Set.toFinite _).isClosed_biUnion fun j _ ↦ ?_ + obtain ⟨_, _, _, -, -, -, -, hlj⟩ := hlc.lens j + exact hlj.disc.isClosed + have hyW : y₀ ∈ W := by + refine ⟨⟨hlens.sub hyR, hyD⟩, fun hm ↦ ?_⟩ + obtain ⟨j, hj, hyj⟩ := mem_iUnion₂.mp hm + exact hyT (hlc.inter i j (Ne.symm hj) ⟨hyR, hyj⟩) + obtain ⟨y, hyw, hyr⟩ := hopen hW hyW + have hyR' : y ∈ R c i := by + have hyD' : y ∈ closure c := hyw.1.1 + rw [hlc.cover] at hyD' + rcases hyD' with h | h + · exact absurd (hΔU h) (hrU hyr) + · obtain ⟨j, hj⟩ := mem_iUnion.mp h + by_cases hji : j = i + · exact hji ▸ hj + · exact absurd (mem_biUnion (show j ∈ ({i}ᶜ : Set (Fin 3)) from hji) hj) hyw.2 + have hdisj : Disjoint r (discBd (R c i)) := disjoint_left.mpr fun x hxr hxb ↦ by + rcases hlens.bd hxb with h | h + · exact hrU hxr (hΔU (hlens.sub_Δ h)) + · exact hrU hxr (hbdU h) + have hsubR : r ⊆ discInt (R c i) := by + have hcover : r ⊆ discInt (R c i) ∪ (R c i)ᶜ := fun x hx ↦ by + by_cases hxR : x ∈ R c i + · exact Or.inl ⟨hxR, disjoint_left.mp hdisj hx⟩ + · exact Or.inr hxR + refine hrc.subset_left_of_subset_union (hlens.disc.isOpen_discInt hman) + hlens.disc.isClosed.isOpen_compl ?_ hcover ?_ + · exact disjoint_left.mpr fun x hx hxn ↦ hxn hx.1 + · exact ⟨y, hyr, hyR', disjoint_left.mp hdisj hyr⟩ + have hclR : closure r ⊆ R c i := + closure_minimal (hsubR.trans sdiff_subset) hlens.disc.isClosed + obtain ⟨u, v, -, hset, -⟩ := hlc.inter_T i + have hsub : closure r ∩ Γ.V ⊆ {u, v} := fun x hx ↦ by + rw [← hset] + refine ⟨hclR hx.1, ?_⟩ + rw [← Γ.closure_inter_V hc] + exact ⟨hlens.sub (hclR hx.1), hx.2⟩ + have hle := Set.ncard_le_ncard hsub (toFinite _) + have h2 : ({u, v} : Set S).ncard ≤ 2 := (Set.ncard_insert_le u {v}).trans (by simp) + change 3 ≤ (closure r ∩ Γ.V).ncard at hcard + omega + · obtain ⟨y, hyw, hyr⟩ := hopen (hlc.disc.isOpen_discInt hman) ⟨hxc.1, hint⟩ + exact hrU hyr (hΔU hyw.1) + +end + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/ThinPainting.lean b/LeanPool/GraphMinor/GM19/ThinPainting.lean new file mode 100644 index 0000000000..fb9f90dc27 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/ThinPainting.lean @@ -0,0 +1,508 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Section2 +public import LeanPool.GraphMinor.GM19.Lens +public import LeanPool.GraphMinor.GM19.PushSide +public import LeanPool.GraphMinor.GM19.RadialExists +public import LeanPool.GraphMinor.GM20.Section10j +public import Mathlib.Analysis.Convex.Strict +public import Mathlib.Analysis.Normed.Module.Convex + +/-! +# The narrow painting in the proof of Graph Minors XIX, (2.1) + +Each edge `c` of size 3 of a painting `Γ` is replaced by the arcs of its boundary and a small disc +`Δ(c)` +that meets the boundary of `cBar` in `cTilde` only. We show that the result is a painting. Its edges +are the edges of +the 1-skeleton, and the sets `Δ(c) \ cTilde`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology Metric GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +/-! ### Arc components from pieces -/ + +omit [T2Space S] in +/-- If a set is cut into finitely many disjoint path connected pieces, each closed in the set, then +the +pieces are its arc-wise components. -/ +theorem arcComponentsIn_of_pieces {W : Set S} {P : Set (Set S)} (hP : P.Finite) + (hpc : ∀ p ∈ P, IsPathConnected p) (hd : ∀ p ∈ P, ∀ q ∈ P, p ≠ q → Disjoint p q) + (hcl : ∀ p ∈ P, closure p ∩ W ⊆ p) (hW : W = ⋃₀ P) : arcComponentsIn W = P := by + have hsub : ∀ p ∈ P, p ⊆ W := fun p hp ↦ hW ▸ subset_sUnion_of_mem hp + have hmem : ∀ p ∈ P, p ∈ arcComponentsIn W := by + intro p hp + refine ⟨(hpc p hp).nonempty, hsub p hp, hpc p hp, fun D hD hDc hpD ↦ ?_⟩ + let Q : Set S := ⋃ q ∈ P \ {p}, closure q + have hQ : IsClosed Q := (hP.subset sdiff_subset).isClosed_biUnion fun _ _ ↦ isClosed_closure + have hcov : D ⊆ closure p ∪ Q := fun x hx ↦ by + have hxW := hD hx + rw [hW] at hxW + obtain ⟨q, hq, hxq⟩ := hxW + by_cases hqp : q = p + · exact Or.inl (subset_closure (hqp ▸ hxq)) + · exact Or.inr (mem_biUnion (show q ∈ P \ {p} from ⟨hq, hqp⟩) (subset_closure hxq)) + refine Subset.antisymm (fun x hx ↦ ?_) hpD + by_contra hxp + have hxQ : x ∈ Q := (hcov hx).resolve_left fun h ↦ hxp (hcl p hp ⟨h, hD hx⟩) + obtain ⟨y₀, hy₀⟩ := (hpc p hp).nonempty + obtain ⟨y, hyD, hy₁, hy₂⟩ := isPreconnected_closed_iff.mp hDc.isConnected.isPreconnected _ _ + isClosed_closure hQ hcov ⟨y₀, hpD hy₀, subset_closure hy₀⟩ ⟨x, hx, hxQ⟩ + have hyp := hcl p hp ⟨hy₁, hD hyD⟩ + obtain ⟨q, hq, hyq⟩ := mem_iUnion₂.mp hy₂ + have hyq' := hcl q hq.1 ⟨hyq, hD hyD⟩ + exact disjoint_left.mp (hd p hp q hq.1 (Ne.symm hq.2)) hyp hyq' + ext C + refine ⟨fun hC ↦ ?_, hmem C⟩ + obtain ⟨x, hx⟩ := hC.1 + have hxW := hC.2.1 hx + rw [hW] at hxW + obtain ⟨p, hp, hxp⟩ := hxW + rw [arcComp_eq_of_mem hC (hmem p hp) hx hxp] + exact hp + +/-! ### A disc without finitely many boundary points -/ + +omit [T2Space S] in +theorem isPathConnected_disc_sdiff {D T : Set S} (hD : IsClosedDisc D) (hT : T ⊆ discBd D) : + IsPathConnected (D \ T) := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + let B : Set ℂ := closedBall 0 1 \ h '' T + have hTs : h '' T ⊆ sphere 0 1 := c.bd ▸ image_mono hT + have hB : Convex ℝ B := by + intro x hx y hy a b ha hb hab + by_cases hxy : x = y + · have : a • x + b • y = x := by + rw [← hxy, ← add_smul, hab, one_smul] + rwa [this] + rcases eq_or_lt_of_le ha with rfl | ha' + · have hb1 : b = 1 := by linarith + subst hb1 + simpa using hy + rcases eq_or_lt_of_le hb with rfl | hb' + · have ha1 : a = 1 := by linarith + subst ha1 + simpa using hx + have hin := (strictConvex_closedBall ℝ (0 : ℂ) 1) hx.1 hy.1 hxy ha' hb' hab + rw [interior_closedBall _ one_ne_zero] at hin + refine ⟨ball_subset_closedBall hin, fun hmem ↦ ?_⟩ + have := hTs hmem + rw [mem_sphere_zero_iff_norm] at this + rw [mem_ball_zero_iff] at hin + linarith + have hB0 : (0 : ℂ) ∈ B := ⟨by simp, fun hmem ↦ by + have := hTs hmem + simp at this⟩ + have heq : D \ T = g '' B := by + ext x + constructor + · rintro ⟨hx, hxT⟩ + refine ⟨h x, ⟨c.hm hx, ?_⟩, c.gh hx⟩ + rintro ⟨y, hy, he⟩ + have hyD := discBd_subset _ (hT hy) + exact hxT (by rw [← c.gh hx, ← he, c.gh hyD]; exact hy) + · rintro ⟨z, ⟨hz, hzT⟩, rfl⟩ + refine ⟨c.gm hz, fun hg ↦ hzT ⟨_, hg, c.hg hz⟩⟩ + rw [heq] + exact (hB.isPathConnected ⟨0, hB0⟩).image' (c.gc.mono sdiff_subset) + +theorem closure_disc_sdiff {D T : Set S} (hD : IsClosedDisc D) (hT : T ⊆ discBd D) : + closure (D \ T) = D := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hcl : IsClosed D := hD.isClosed + refine Subset.antisymm (closure_minimal sdiff_subset hcl) ?_ + have hTs : h '' T ⊆ sphere 0 1 := c.bd ▸ image_mono hT + have hsub : g '' ball 0 1 ⊆ D \ T := by + rintro _ ⟨z, hz, rfl⟩ + have hz' := ball_subset_closedBall hz + refine ⟨c.gm hz', fun hg ↦ ?_⟩ + have := hTs ⟨_, hg, c.hg hz'⟩ + rw [mem_sphere_zero_iff_norm] at this + rw [mem_ball_zero_iff] at hz + linarith + intro x hx + have hz := c.hm hx + have hzc : h x ∈ closure (ball (0 : ℂ) 1) := by + rw [closure_ball _ one_ne_zero] + exact hz + have : g (h x) ∈ closure (g '' ball 0 1) := + ((c.gc _ hz).mono ball_subset_closedBall).mem_closure_image hzc + rw [c.gh hx] at this + exact closure_mono hsub this + +omit [T2Space S] in +/-- An `O`-arc in an `O`-arc is all of it: otherwise the first one would embed in the real line. -/ +theorem not_oArc_subset {E F : Set S} (hE : IsOArc E) (hF : IsOArc F) (hEF : E ⊆ F) {w : S} + (hw : w ∈ F) (hwE : w ∉ E) : False := by + obtain ⟨ψ⟩ := hE + obtain ⟨φ⟩ := hF + let z₀ : Circle := φ.symm ⟨w, hw⟩ + let u : Circle → Circle := fun t ↦ φ.symm ⟨(ψ t).1, hEF (ψ t).2⟩ + have hu : Continuous u := + φ.symm.continuous.comp ((continuous_subtype_val.comp ψ.continuous).subtype_mk _) + have hne : ∀ t, u t ≠ z₀ := fun t he ↦ by + have : (⟨(ψ t).1, hEF (ψ t).2⟩ : F) = ⟨w, hw⟩ := φ.symm.injective he + have h : (ψ t).1 = w := congrArg Subtype.val this + exact hwE (h ▸ (ψ t).2) + let v : Circle → Circle := fun t ↦ Circle.exp Real.pi * (u t * z₀⁻¹) + have hv : Continuous v := by fun_prop + have hvne : ∀ t, v t ≠ Circle.exp Real.pi := fun t he ↦ by + have h1 : u t * z₀⁻¹ = 1 := mul_left_cancel (he.trans (mul_one _).symm) + exact hne t (mul_inv_eq_one.mp h1) + have hvi : Function.Injective v := fun a b he ↦ by + have h1 : u a = u b := mul_right_cancel (mul_left_cancel he) + have h2 := φ.symm.injective h1 + have h3 : (ψ a).1 = (ψ b).1 := Subtype.mk.inj h2 + exact ψ.injective (Subtype.ext h3) + refine not_injective_circle_real (f := fun t ↦ Complex.arg (v t)) ?_ + (Circle.injective_arg.comp hvi) + refine continuous_iff_continuousAt.mpr fun t ↦ ?_ + have hslit : (v t : ℂ) ∈ Complex.slitPlane := by + rw [Complex.mem_slitPlane_iff_arg] + refine ⟨fun h ↦ hvne t ?_, (v t).coe_ne_zero⟩ + rw [← Circle.exp_arg (v t), h] + exact ContinuousAt.comp (f := fun t ↦ (v t : ℂ)) (Complex.continuousAt_arg hslit) + (continuous_subtype_val.comp hv).continuousAt + +/-! ### The 1-skeleton -/ + +namespace Painting + +variable (Γ : Painting S) + +omit [T2Space S] in +theorem bd_subset_skU : bd S ⊆ Γ.skU := by + intro x hx + by_cases hV : x ∈ Γ.V + · exact Or.inl (Or.inl hV) + have hm : x ∈ Γ.U \ Γ.V := ⟨Γ.bd_subset hx, hV⟩ + have hc : pathComponentIn (Γ.U \ Γ.V) x ∈ Γ.E := Surface.mem_arcComponentsIn_of_mem hm + have hxc : x ∈ pathComponentIn (Γ.U \ Γ.V) x := mem_pathComponentIn_self hm + have h2 := size_two_of_border Γ hc ⟨x, hxc, hx⟩ + exact Or.inl (Or.inr (mem_iUnion₂.2 ⟨_, ⟨hc, h2⟩, hxc⟩)) + +theorem isClosed_skU : IsClosed Γ.skU := by + obtain ⟨D, h₁, -⟩ := Γ.exists_skDrawing + exact h₁ ▸ D.isClosed_U + +omit [T2Space S] in +/-- An edge of size 2 is an arc-wise component of the 1-skeleton without the vertices. -/ +theorem two_mem_sk {e : Set S} (he : e ∈ Γ.E) (h2 : (tilde e).ncard = 2) : + e ∈ arcComponentsIn (Γ.skU \ Γ.V) := by + refine ⟨he.1, fun x hx ↦ ⟨Or.inl (Or.inr (mem_iUnion₂.2 ⟨e, ⟨he, h2⟩, hx⟩)), Γ.disjoint_V he hx⟩, + he.2.2.1, fun D hD hc hsub ↦ ?_⟩ + exact he.2.2.2 D (hD.trans (sdiff_subset_sdiff_left Γ.skU_subset)) hc hsub + +omit [T2Space S] in +theorem sk_cases {e : Set S} (he : e ∈ arcComponentsIn (Γ.skU \ Γ.V)) : + (e ∈ Γ.E ∧ (tilde e).ncard = 2) ∨ + ∃ c ∈ Γ.E, (tilde c).ncard = 3 ∧ e ⊆ c ∧ e ⊆ discBd (closure c) := by + obtain ⟨c, hc, hsub⟩ := exists_arcComp_superset he.2.2.1 + (he.2.1.trans (sdiff_subset_sdiff_left Γ.skU_subset)) + rcases Γ.size_cases hc with h2 | h3 + · left + have heq : e = c := arcComp_eq_of_mem he (Γ.two_mem_sk hc h2) (he.1.some_mem) + (hsub he.1.some_mem) + exact heq ▸ ⟨hc, h2⟩ + · exact Or.inr ⟨c, hc, h3, hsub, fun x hx ↦ Γ.mem_discBd_of_skU hc h3 (hsub hx) (he.2.1 hx).1⟩ + +/-- An edge of the 1-skeleton is the inside of a line with two vertices as its ends. -/ +theorem sk_line {e : Set S} (he : e ∈ arcComponentsIn (Γ.skU \ Γ.V)) : + ∃ u v, u ≠ v ∧ tilde e = {u, v} ∧ tilde e ⊆ Γ.V ∧ IsLineWithEnds (closure e) u v := by + obtain ⟨D, hU, hV⟩ := Γ.exists_skDrawing + have he' : e ∈ arcComponentsIn (D.U \ D.V) := by rw [hU, hV]; exact he + have hline : ∃ u v, u ≠ v ∧ closure e ∩ Γ.V = {u, v} ∧ IsLineWithEnds (closure e) u v := by + rcases D.edge_cond e he' with ⟨u, v, h₁, h₂, h₃⟩ | ⟨u, h₁, h₂⟩ + · exact ⟨u, v, h₁, hV ▸ h₂, h₃⟩ + · exfalso + rw [hV] at h₁ + rcases Γ.sk_cases he with ⟨h, h2⟩ | ⟨c, hc, h3, hsub, hbd⟩ + · have := h₁ ▸ Γ.closure_inter_V h + have hcard : ({u} : Set S).ncard = 2 := by rw [this]; exact h2 + simp at hcard + · obtain ⟨hdisc, hT, hfin⟩ := Γ.isDisc_of_three hc h3 + have hF := hdisc.isOArc_discBd + have hsub' : closure e ⊆ discBd (closure c) := + closure_minimal hbd (IsOArc.isCompact hF).isClosed + obtain ⟨w, hw, hne⟩ : ∃ w ∈ tilde c, w ≠ u := by + by_contra hn + push Not at hn + have : tilde c ⊆ {u} := hn + have := ncard_le_ncard this (finite_singleton u) + simp at this + omega + refine not_oArc_subset h₂ hF hsub' (hT hw) fun hwe ↦ hne ?_ + have : w ∈ closure e ∩ Γ.V := ⟨hwe, Γ.tilde_subset_V hc hw⟩ + rw [h₁] at this + exact this + obtain ⟨u, v, huv, hset, hL⟩ := hline + suffices h : tilde e = {u, v} from + ⟨u, v, huv, h, by rw [h, ← hset]; exact inter_subset_right, hL⟩ + obtain ⟨-, hpc, -, -⟩ := GM20.line_facts hL + have hsub : e ⊆ closure e \ {u, v} := fun x hx ↦ ⟨subset_closure hx, fun hm ↦ by + rw [← hset] at hm + exact (he.2.1 hx).2 hm.2⟩ + have hin : closure e \ {u, v} ⊆ Γ.skU \ Γ.V := fun x hx ↦ by + refine ⟨closure_minimal (he.2.1.trans sdiff_subset) Γ.isClosed_skU hx.1, fun hV' ↦ hx.2 ?_⟩ + rw [← hset] + exact ⟨hx.1, hV'⟩ + have heq : closure e \ {u, v} = e := he.2.2.2 _ hin hpc hsub + rw [tilde, ← hset] + ext x + constructor + · rintro ⟨hx, hxe⟩ + by_contra hn + exact hxe (heq ▸ ⟨hx, fun h ↦ hn (hset ▸ h)⟩) + · rintro ⟨hx, hxV⟩ + exact ⟨hx, fun h ↦ (he.2.1 h).2 hxV⟩ + +theorem sk_size {e : Set S} (he : e ∈ arcComponentsIn (Γ.skU \ Γ.V)) : + (tilde e).ncard = 2 ∧ (tilde e).Finite := by + obtain ⟨u, v, huv, ht, -, -⟩ := Γ.sk_line he + exact ⟨by rw [ht, ncard_pair huv], by rw [ht]; exact (finite_singleton v).insert u⟩ + +end Painting + +/-! ### The small discs -/ + +/-- `Δ` picks a small disc in each edge of size 3 (Graph Minors XIX, page 330: "choose a disc +$\Delta\subseteq \bar{e}$ with $\Delta\cap bd(\bar{e})=\tilde{e}$"). -/ +def IsCore (Γ : Painting S) (Δ : Set S → Set S) : Prop := + ∀ c ∈ Γ.E, (tilde c).ncard = 3 → IsClosedDisc (Δ c) ∧ Δ c ⊆ closure c ∧ tilde c ⊆ discBd (Δ c) ∧ + Δ c ∩ discBd (closure c) = tilde c + +/-- The new edge inside `c`. -/ +def core (Δ : Set S → Set S) (c : Set S) : Set S := Δ c \ tilde c + +/-- The march of a line: any order of its ends. -/ +noncomputable def anyMarch (e : Set S) : List S := + open Classical in if h : (tilde e).Finite then h.toFinset.toList else [] + +omit [T2Space S] in +theorem anyMarch_set {e : Set S} (h : (tilde e).Finite) : {v | v ∈ anyMarch e} = tilde e := by + ext x + simp [anyMarch, h] + +omit [T2Space S] in +theorem anyMarch_nodup (e : Set S) : (anyMarch e).Nodup := by + classical + unfold anyMarch + split_ifs + · exact Finset.nodup_toList _ + · exact List.nodup_nil + +section Thin + +variable {Γ : Painting S} {Δ : Set S → Set S} + +omit [T2Space S] in +theorem IsCore.core_subset (hΔ : IsCore Γ Δ) {c : Set S} (hc : c ∈ Γ.E) (h3 : (tilde c).ncard = 3) : + core Δ c ⊆ c := by + rintro x ⟨hx, hn⟩ + by_contra hxc + exact hn ⟨(hΔ c hc h3).2.1 hx, hxc⟩ + +omit [T2Space S] in +theorem IsCore.isPathConnected (hΔ : IsCore Γ Δ) {c : Set S} (hc : c ∈ Γ.E) + (h3 : (tilde c).ncard = 3) : IsPathConnected (core Δ c) := + isPathConnected_disc_sdiff (hΔ c hc h3).1 (hΔ c hc h3).2.2.1 + +theorem IsCore.closure_core (hΔ : IsCore Γ Δ) {c : Set S} (hc : c ∈ Γ.E) + (h3 : (tilde c).ncard = 3) : closure (core Δ c) = Δ c := + closure_disc_sdiff (hΔ c hc h3).1 (hΔ c hc h3).2.2.1 + +theorem IsCore.tilde_core (hΔ : IsCore Γ Δ) {c : Set S} (hc : c ∈ Γ.E) + (h3 : (tilde c).ncard = 3) : tilde (core Δ c) = tilde c := by + rw [tilde, hΔ.closure_core hc h3] + ext x + constructor + · rintro ⟨hx, hn⟩ + by_contra hxc + exact hn ⟨hx, hxc⟩ + · intro hx + exact ⟨discBd_subset _ ((hΔ c hc h3).2.2.1 hx), fun h ↦ h.2 hx⟩ + +/-- The pieces of the narrow painting. -/ +def pieces (Γ : Painting S) (Δ : Set S → Set S) : Set (Set S) := + arcComponentsIn (Γ.skU \ Γ.V) ∪ core Δ '' {c ∈ Γ.E | (tilde c).ncard = 3} + +/-- The closed set of the narrow painting. -/ +def thinU (Γ : Painting S) (Δ : Set S → Set S) : Set S := + Γ.skU ∪ ⋃ c ∈ {c ∈ Γ.E | (tilde c).ncard = 3}, Δ c + +theorem finite_pieces : (pieces Γ Δ).Finite := by + obtain ⟨D, hU, hV⟩ := Γ.exists_skDrawing + have hfinite : {c ∈ Γ.E | (tilde c).ncard = 3}.Finite := + Γ.finite_edges.subset fun _ h => h.1 + refine Finite.union ?_ (hfinite.image _) + have := D.finite_edges + rwa [hU, hV] at this + +omit [T2Space S] in +theorem disjoint_sk_core (hΔ : IsCore Γ Δ) {e c : Set S} (he : e ∈ arcComponentsIn (Γ.skU \ Γ.V)) + (hc : c ∈ Γ.E) (h3 : (tilde c).ncard = 3) : Disjoint e (core Δ c) := by + refine disjoint_left.mpr fun x hxe hxc ↦ ?_ + have hb := Γ.mem_discBd_of_skU hc h3 (hΔ.core_subset hc h3 hxc) (he.2.1 hxe).1 + have : x ∈ Δ c ∩ discBd (closure c) := ⟨hxc.1, hb⟩ + rw [(hΔ c hc h3).2.2.2] at this + exact hxc.2 this + +theorem pieces_eq (hΔ : IsCore Γ Δ) : arcComponentsIn (thinU Γ Δ \ Γ.V) = pieces Γ Δ := by + have hpc : ∀ p ∈ pieces Γ Δ, IsPathConnected p := by + rintro p (hp | ⟨c, hc, rfl⟩) + · exact hp.2.2.1 + · exact hΔ.isPathConnected hc.1 hc.2 + refine arcComponentsIn_of_pieces finite_pieces hpc ?_ ?_ ?_ + · rintro p (hp | ⟨c, hc, rfl⟩) q (hq | ⟨c', hc', rfl⟩) hne + · exact disjoint_iff_forall_ne.mpr fun x hx y hy he ↦ hne + (arcComp_eq_of_mem hp hq hx (he ▸ hy)) + · exact disjoint_sk_core hΔ hp hc'.1 hc'.2 + · exact (disjoint_sk_core hΔ hq hc.1 hc.2).symm + · refine disjoint_iff_forall_ne.mpr fun x hx y hy he ↦ hne ?_ + have := arcComp_eq_of_mem hc.1 hc'.1 (hΔ.core_subset hc.1 hc.2 hx) + (hΔ.core_subset hc'.1 hc'.2 (he ▸ hy)) + rw [this] + · rintro p (hp | ⟨c, hc, rfl⟩) x ⟨hx, hxW⟩ + · obtain ⟨u, v, -, -, htl, -⟩ := Γ.sk_line hp + by_contra hn + exact hxW.2 (htl ⟨hx, hn⟩) + · rw [hΔ.closure_core hc.1 hc.2] at hx + exact ⟨hx, fun h ↦ hxW.2 (Γ.tilde_subset_V hc.1 h)⟩ + · ext x + constructor + · rintro ⟨hx | hx, hV⟩ + · exact ⟨_, Or.inl (Surface.mem_arcComponentsIn_of_mem ⟨hx, hV⟩), + mem_pathComponentIn_self ⟨hx, hV⟩⟩ + · obtain ⟨c, hc, hxc⟩ := mem_iUnion₂.mp hx + exact ⟨_, Or.inr ⟨c, hc, rfl⟩, hxc, fun h ↦ hV (Γ.tilde_subset_V hc.1 h)⟩ + · rintro ⟨p, hp | ⟨c, hc, rfl⟩, hx⟩ + · exact ⟨Or.inl (hp.2.1 hx).1, (hp.2.1 hx).2⟩ + · exact ⟨Or.inr (mem_biUnion hc hx.1), Γ.disjoint_V hc.1 (hΔ.core_subset hc.1 hc.2 hx)⟩ + +/-- The march of an edge of the narrow painting. On edges of size 3 and edges of `Γ` it is what we +want. -/ +noncomputable def thinγ (Γ : Painting S) (Δ : Set S → Set S) (g : Set S → List S) + (e : Set S) : List S := + open Classical in + if h : ∃ c ∈ Γ.E, (tilde c).ncard = 3 ∧ core Δ c = e then Γ.γ h.choose + else if e ∈ Γ.E then g e else anyMarch e + +omit [T2Space S] in +theorem core_injOn (hΔ : IsCore Γ Δ) : InjOn (core Δ) {c ∈ Γ.E | (tilde c).ncard = 3} := by + intro c hc c' hc' he + obtain ⟨x, hx⟩ := (hΔ.isPathConnected hc.1 hc.2).nonempty + exact arcComp_eq_of_mem hc.1 hc'.1 (hΔ.core_subset hc.1 hc.2 hx) + (hΔ.core_subset hc'.1 hc'.2 (he ▸ hx)) + +omit [T2Space S] in +theorem thinγ_core (hΔ : IsCore Γ Δ) (g : Set S → List S) {c : Set S} (hc : c ∈ Γ.E) + (h3 : (tilde c).ncard = 3) : thinγ Γ Δ g (core Δ c) = Γ.γ c := by + have h : ∃ c' ∈ Γ.E, (tilde c').ncard = 3 ∧ core Δ c' = core Δ c := ⟨c, hc, h3, rfl⟩ + rw [thinγ, dite_eq_left h] + obtain ⟨h₁, h₂, h₃⟩ := h.choose_spec + rw [core_injOn hΔ ⟨h₁, h₂⟩ ⟨hc, h3⟩ h₃] + +omit [T2Space S] in +theorem not_core_of_two (hΔ : IsCore Γ Δ) {e : Set S} (he : e ∈ arcComponentsIn (Γ.skU \ Γ.V)) : + ¬ ∃ c ∈ Γ.E, (tilde c).ncard = 3 ∧ core Δ c = e := by + rintro ⟨c, hc, h3, rfl⟩ + obtain ⟨x, hx⟩ := (hΔ.isPathConnected hc h3).nonempty + exact disjoint_left.mp (disjoint_sk_core hΔ he hc h3) hx hx + +omit [T2Space S] in +theorem thinγ_two (hΔ : IsCore Γ Δ) (g : Set S → List S) {e : Set S} (he : e ∈ Γ.E) + (h2 : (tilde e).ncard = 2) : thinγ Γ Δ g e = g e := by + rw [thinγ, dite_eq_right (not_core_of_two hΔ (Γ.two_mem_sk he h2)), ite_eq_left he] + +omit [T2Space S] in +theorem thinγ_new (hΔ : IsCore Γ Δ) (g : Set S → List S) {e : Set S} + (he : e ∈ arcComponentsIn (Γ.skU \ Γ.V)) (hn : e ∉ Γ.E) : thinγ Γ Δ g e = anyMarch e := by + rw [thinγ, dite_eq_right (not_core_of_two hΔ he), ite_eq_right hn] + +/-- The narrow painting of `Γ`, with march `g` on edges of size 2 that stay. -/ +noncomputable def thinP (hΔ : IsCore Γ Δ) (g : Set S → List S) + (hg : ∀ e ∈ Γ.E, (tilde e).ncard = 2 → g e = Γ.γ e ∨ g e = (Γ.γ e).reverse) : Painting S where + U := thinU Γ Δ + V := Γ.V + γ := thinγ Γ Δ g + isClosed_U := by + refine Γ.isClosed_skU.union ?_ + have hfinite : {c ∈ Γ.E | (tilde c).ncard = 3}.Finite := + Γ.finite_edges.subset fun _ h => h.1 + refine hfinite.isClosed_biUnion fun c hc ↦ ?_ + exact (hΔ c hc.1 hc.2).1.isClosed + V_subset := fun x hx ↦ Or.inl (Or.inl (Or.inl hx)) + finite_V := Γ.finite_V + bd_subset := fun x hx ↦ Or.inl (Γ.bd_subset_skU hx) + finite_edges := by + rw [pieces_eq hΔ] + exact finite_pieces + edge_shape := by + rw [pieces_eq hΔ] + rintro e (he | ⟨c, hc, rfl⟩) + · obtain ⟨u, v, huv, ht, -, hL⟩ := Γ.sk_line he + left + obtain ⟨f, hf⟩ := id hL + refine ⟨by rw [ht, ncard_pair huv], by rw [ht]; exact (finite_singleton v).insert u, ⟨f⟩, ?_⟩ + rw [ht] + exact (GM20.line_facts hL).2.2.2 + · right + rw [hΔ.tilde_core hc.1 hc.2, hΔ.closure_core hc.1 hc.2] + exact ⟨hc.2, (Γ.isDisc_of_three hc.1 hc.2).2.2, (hΔ c hc.1 hc.2).1, (hΔ c hc.1 hc.2).2.2.1⟩ + γ_nodup := by + rw [pieces_eq hΔ] + rintro e (he | ⟨c, hc, rfl⟩) + · by_cases hE : e ∈ Γ.E + · rw [thinγ_two hΔ g hE (Γ.sk_size he).1] + rcases hg e hE (Γ.sk_size he).1 with h | h + · exact h ▸ Γ.γ_nodup e hE + · exact h ▸ List.nodup_reverse.mpr (Γ.γ_nodup e hE) + · rw [thinγ_new hΔ g he hE] + exact anyMarch_nodup _ + · rw [thinγ_core hΔ g hc.1 hc.2] + exact Γ.γ_nodup c hc.1 + γ_set := by + rw [pieces_eq hΔ] + rintro e (he | ⟨c, hc, rfl⟩) + · by_cases hE : e ∈ Γ.E + · rw [thinγ_two hΔ g hE (Γ.sk_size he).1] + rcases hg e hE (Γ.sk_size he).1 with h | h + · rw [h] + exact Γ.γ_set e hE + · rw [h] + simpa using Γ.γ_set e hE + · rw [thinγ_new hΔ g he hE] + exact anyMarch_set (Γ.sk_size he).2 + · rw [thinγ_core hΔ g hc.1 hc.2, hΔ.tilde_core hc.1 hc.2] + exact Γ.γ_set c hc.1 + border_edge := by + rw [pieces_eq hΔ] + rintro e (he | ⟨c, hc, rfl⟩) hb + · refine ⟨(Γ.sk_size he).1, ?_⟩ + obtain ⟨x, hxe, hxb⟩ := id hb + rcases Γ.sk_cases he with ⟨h, -⟩ | ⟨c, hc, h3, hsub, -⟩ + · exact (Γ.border_edge e h hb).2 + · have := size_two_of_border Γ hc ⟨x, hsub hxe, hxb⟩ + omega + · obtain ⟨x, hxe, hxb⟩ := id hb + have := size_two_of_border Γ hc.1 ⟨x, hΔ.core_subset hc.1 hc.2 hxe, hxb⟩ + have := hc.2 + omega + +end Thin + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Thinning.lean b/LeanPool/GraphMinor/GM19/Thinning.lean new file mode 100644 index 0000000000..4d6f5c76db --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Thinning.lean @@ -0,0 +1,323 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.FrameMove + +/-! +# The topology in the proof of Graph Minors XIX, (2.1) + +Here we prove `Theorem21TopologyStatement`, for surfaces in `Type`. The frame is `stdFrame`. For a +painting `Γ`, +the homeomorphism `h` of `exists_move` puts an edge on each short side. Then `thinP` makes the image +of `Γ` +narrow, with border edges directed along the sides of the frame. +The deductions that use later proofs are in `ThinningProved`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Topology GraphMinor.Surface + +universe w + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +omit [T2Space S] in +theorem symm_image_image' (h : S ≃ₜ S) (e : Set S) : h.symm '' (h '' e) = e := by + rw [← image_comp] + simp + +/-- The image of a painting under a homeomorphism of the surface. -/ +noncomputable def Painting.push (h : S ≃ₜ S) (Γ : Painting S) : Painting S where + U := h '' Γ.U + V := h '' Γ.V + γ e := (Γ.γ (h.symm '' e)).map h + isClosed_U := h.isClosed_image.mpr Γ.isClosed_U + V_subset := image_mono Γ.V_subset + finite_V := Γ.finite_V.image _ + bd_subset := by + rw [← image_bd h] + exact image_mono Γ.bd_subset + finite_edges := by + rw [← image_sdiff h.injective, GM20.image_arcComponentsIn] + exact Γ.finite_edges.image _ + edge_shape := by + rw [← image_sdiff h.injective, GM20.image_arcComponentsIn] + rintro _ ⟨c, hc, rfl⟩ + simp only + rw [GM20.image_tilde, ncard_image_of_injective _ h.injective, ← h.image_closure] + rcases Γ.edge_shape c hc with ⟨h₁, h₂, h₃, h₄⟩ | ⟨h₁, h₂, h₃, h₄⟩ + · refine Or.inl ⟨h₁, h₂.image _, GM20.image_isLine h h₃, ?_⟩ + rw [GM20.image_lineEnds, h₄] + · refine Or.inr ⟨h₁, h₂.image _, GM20.image_isClosedDisc h h₃, ?_⟩ + rw [GM20.image_discBd] + exact image_mono h₄ + γ_nodup := by + rw [← image_sdiff h.injective, GM20.image_arcComponentsIn] + rintro _ ⟨c, hc, rfl⟩ + simp only + rw [symm_image_image' h] + exact (Γ.γ_nodup c hc).map h.injective + γ_set := by + rw [← image_sdiff h.injective, GM20.image_arcComponentsIn] + rintro _ ⟨c, hc, rfl⟩ + simp only + rw [symm_image_image' h, GM20.image_tilde, ← Γ.γ_set c hc] + ext x + simp + border_edge := by + rw [← image_sdiff h.injective, GM20.image_arcComponentsIn] + rintro _ ⟨c, hc, rfl⟩ hb + simp only at hb ⊢ + have hb' : Painting.IsBorder c := (isBorder_image h).mp hb + obtain ⟨h₁, h₂⟩ := Γ.border_edge c hc hb' + refine ⟨by rw [GM20.image_tilde, ncard_image_of_injective _ h.injective, h₁], ?_⟩ + rw [← image_bd h] + exact image_mono h₂ + +section Push + +variable (h : S ≃ₜ S) (Γ : Painting S) + +omit [T2Space S] in +theorem push_E : (Γ.push h).E = (fun c ↦ h '' c) '' Γ.E := by + change arcComponentsIn (h '' Γ.U \ h '' Γ.V) = _ + rw [← image_sdiff h.injective, GM20.image_arcComponentsIn] + rfl + +omit [T2Space S] in +theorem push_mem {e : Set S} (he : e ∈ Γ.E) : h '' e ∈ (Γ.push h).E := by + rw [push_E] + exact ⟨e, he, rfl⟩ + +omit [T2Space S] in +theorem push_γ (e : Set S) : (Γ.push h).γ (h '' e) = (Γ.γ e).map h := by + change (Γ.γ (h.symm '' (h '' e))).map h = _ + rw [symm_image_image' h] + +omit [T2Space S] in +theorem push_internally (hΓ : Γ.IsInternallyThreeConnected) : + (Γ.push h).IsInternallyThreeConnected := by + refine ⟨?_, ?_⟩ + · obtain ⟨e, he⟩ := hΓ.1 + exact ⟨_, push_mem h Γ he⟩ + · intro F hF hFU hfin hcard + change F ∩ h '' Γ.U ⊆ h '' Γ.V at hFU + change (F ∩ h '' Γ.V).ncard + _ ≤ 2 at hcard + have himg : ∀ A : Set S, h.symm '' (F ∩ h '' A) = (h.symm '' F) ∩ A := fun A ↦ by + rw [image_inter h.symm.injective, symm_image_image' h] + have hbd : h.symm '' (F ∩ bd S) = (h.symm '' F) ∩ bd S := by + rw [image_inter h.symm.injective, image_bd h.symm] + obtain ⟨D, h₁, h₂, h₃⟩ := hΓ.2 (h.symm '' F) (GM20.image_isOArc h.symm hF) + (by + rw [← himg] + rintro _ ⟨y, hy, rfl⟩ + obtain ⟨v, hv, rfl⟩ := hFU hy + simpa using hv) + (by rw [← hbd]; exact hfin.image _) + (by + rw [← himg, ← hbd, ncard_image_of_injective _ h.symm.injective, + ncard_image_of_injective _ h.symm.injective] + exact hcard) + refine ⟨h '' D, GM20.image_isClosedDisc h h₁, ?_, ?_⟩ + · rw [GM20.image_discBd, h₂, ← image_comp] + simp + · rintro _ ⟨⟨y, hy, rfl⟩, ⟨v, hv, he⟩⟩ + have hyv : y = v := h.injective he.symm + subst hyv + obtain ⟨z, hz, hzy⟩ := h₃ ⟨hy, hv⟩ + have : h y = z := by rw [← hzy]; simp + rw [this] + exact hz + +end Push + +omit [T2Space S] in +theorem list_two (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) (h2 : (tilde e).ncard = 2) : + ∃ x y, Γ.γ e = [x, y] ∧ x ≠ y := by + classical + have h1 : ((Γ.γ e).toFinset : Set S) = tilde e := by + rw [← Γ.γ_set e he] + ext x + simp + have hl : (Γ.γ e).length = 2 := by + rw [← List.toFinset_card_of_nodup (Γ.γ_nodup e he), ← Set.ncard_coe_finset, h1, h2] + obtain ⟨x, y, hxy⟩ := List.length_eq_two.mp hl + refine ⟨x, y, hxy, ?_⟩ + have := Γ.γ_nodup e he + rw [hxy] at this + simpa using this + +/-- **The topology in the proof of Graph Minors XIX, (2.1).** -/ +theorem theorem21Topology : Theorem21TopologyStatement.{0} := by + classical + intro S _ hS _ + have : T2Space S := hS.2.1 + have hpar : ∀ C : cuffs S, Nonempty (Circle ≃ₜ C.1) := fun C ↦ (cuff_statement S hS).2.2 C.1 C.2 + let par : ∀ C : cuffs S, Circle ≃ₜ C.1 := fun C ↦ (hpar C).some + let Φ := stdFrame par hS + refine ⟨Φ, fun Γ hΓ ↦ ?_⟩ + obtain ⟨h, hm, hedge⟩ := exists_move par hS Γ + let Γ₁ := Γ.push h + obtain ⟨Δ, L, R, hl⟩ := exists_isLensed Γ₁ + have hΔ := hl.isCore + let g : Set S → List S := fun e ↦ + if Painting.IsBorder e ∧ ¬ ∀ s ∈ Φ.sides, e ⊆ s → DirAgrees s (Φ.γ s) e (Γ₁.γ e) + then (Γ₁.γ e).reverse else Γ₁.γ e + have hg : ∀ e ∈ Γ₁.E, (tilde e).ncard = 2 → g e = Γ₁.γ e ∨ g e = (Γ₁.γ e).reverse := by + intro e _ _ + by_cases hc : Painting.IsBorder e ∧ ¬ ∀ s ∈ Φ.sides, e ⊆ s → DirAgrees s (Φ.γ s) e (Γ₁.γ e) + · exact Or.inr (ite_eq_left hc) + · exact Or.inl (ite_eq_right hc) + let Γ' := thinP hΔ g hg + have hE' : Γ'.E = pieces Γ₁ Δ := pieces_eq hΔ + have hint₁ := push_internally h Γ hΓ + have hbcase : ∀ e' ∈ Γ'.E, Painting.IsBorder e' → e' ∈ Γ₁.E ∧ (tilde e').ncard = 2 := by + intro e' he' hb + rw [hE'] at he' + obtain ⟨x, hxe, hxb⟩ := id hb + rcases he' with he' | ⟨c, hc, rfl⟩ + · rcases Γ₁.sk_cases he' with h' | ⟨c, hc, h3, hsub, -⟩ + · exact h' + · have := size_two_of_border Γ₁ hc ⟨x, hsub hxe, hxb⟩ + omega + · have := size_two_of_border Γ₁ hc.1 ⟨x, hΔ.core_subset hc.1 hc.2 hxe, hxb⟩ + have := hc.2 + omega + have hthree : ∀ e ∈ Γ.E, (tilde e).ncard = 3 → h '' e ∈ Γ₁.E ∧ (tilde (h '' e)).ncard = 3 := by + intro e he h3 + exact ⟨push_mem h Γ he, by rw [ncard_tilde_image, h3]⟩ + have htwo : ∀ e ∈ Γ.E, (tilde e).ncard = 2 → h '' e ∈ Γ₁.E ∧ (tilde (h '' e)).ncard = 2 := by + intro e he h2 + exact ⟨push_mem h Γ he, by rw [ncard_tilde_image, h2]⟩ + refine ⟨h, Γ', fun e ↦ core Δ (h '' e), ?_⟩ + refine + { null := hasNullSignature_of_moves hm + null_symm := hasNullSignature_of_moves fun C ↦ (hm C).symm + V_eq := rfl + fits := ?_ + three := ?_ + three_inj := ?_ + three_surj := ?_ + two := ?_ + internal_γ := ?_ + border_γ := ?_ + rest := ?_ + short := ?_ } + · refine + { V_subset := ?_ + short_sides := ?_ + border_dir := ?_ + internally_three_connected := thin_internally hS hint₁ hl g hg + size_three_region := thin_region hS hl g hg } + · refine iUnion_subset fun C x hx ↦ ?_ + obtain ⟨e, he, -, -, heq⟩ := hedge C + have hxt : x ∈ tilde (upSide par C) := by + rw [tilde_up] + exact hx + rw [← heq, tilde_image_homeo] at hxt + exact image_mono (Γ.tilde_subset_V he) hxt + · intro t ht + obtain ⟨C, rfl⟩ := stdFrame_short par hS ht + obtain ⟨e, he, -, h2, heq⟩ := hedge C + rw [hE', ← heq] + exact Or.inl (Γ₁.two_mem_sk (htwo e he h2).1 (htwo e he h2).2) + · intro e' he' hb s hs hes + obtain ⟨h₁, h₂⟩ := hbcase e' he' hb + change DirAgrees s (Φ.γ s) e' (thinγ Γ₁ Δ g e') + rw [thinγ_two hΔ g h₁ h₂] + by_cases hall : ∀ s ∈ Φ.sides, e' ⊆ s → DirAgrees s (Φ.γ s) e' (Γ₁.γ e') + · have hgq : g e' = Γ₁.γ e' := ite_eq_right fun hc ↦ hc.2 hall + rw [hgq] + exact hall s hs hes + · have hgq : g e' = (Γ₁.γ e').reverse := ite_eq_left ⟨hb, hall⟩ + rw [hgq] + push Not at hall + obtain ⟨s', hs', hes', hn⟩ := hall + obtain ⟨z, hz⟩ := h₁.1 + have hss : s' = s := arcComp_eq_of_mem hs' hs (hes' hz) (hes hz) + subst hss + obtain ⟨x, y, hγ, hxy⟩ := list_two Γ₁ h₁ h₂ + have hset := Γ₁.γ_set e' h₁ + rw [hγ] at hset + have hxt : x ∈ tilde e' := hset ▸ (by simp) + have hyt : y ∈ tilde e' := hset ▸ (by simp) + have hcl : closure e' ⊆ closure s' := closure_mono hes + rw [hγ] at hn ⊢ + rcases dirAgrees_or par hS hs hxy hes (hcl hxt.1) (hcl hyt.1) with h' | h' + · exact absurd h' hn + · simpa using h' + · intro e he h3 + obtain ⟨h₁, h₂⟩ := hthree e he h3 + refine ⟨?_, ?_, ?_⟩ + · rw [hE'] + exact Or.inr ⟨_, ⟨h₁, h₂⟩, rfl⟩ + · rw [hΔ.tilde_core h₁ h₂, tilde_image_homeo] + · change thinγ Γ₁ Δ g _ = _ + rw [thinγ_core hΔ g h₁ h₂, push_γ] + · intro e he e' he' heq + have := core_injOn hΔ ⟨(hthree e he.1 he.2).1, (hthree e he.1 he.2).2⟩ + ⟨(hthree e' he'.1 he'.2).1, (hthree e' he'.1 he'.2).2⟩ heq + exact h.injective.image_injective this + · intro e' he' h3 + rw [hE'] at he' + rcases he' with he' | ⟨c, hc, rfl⟩ + · have := (Γ₁.sk_size he').1 + omega + · obtain ⟨e, he, rfl⟩ := (push_E h Γ) ▸ hc.1 + have h3' := hc.2 + simp only [] at h3' + rw [ncard_tilde_image] at h3' + exact ⟨e, he, h3', rfl⟩ + · intro e he h2 + rw [hE'] + exact Or.inl (Γ₁.two_mem_sk (htwo e he h2).1 (htwo e he h2).2) + · intro e he h2 hi + change thinγ Γ₁ Δ g _ = _ + rw [thinγ_two hΔ g (htwo e he h2).1 (htwo e he h2).2] + have hnb : ¬ Painting.IsBorder (h '' e) := fun hb ↦ + (isInternal_iff_not_border.mp hi) ((isBorder_image h).mp hb) + change (if _ then _ else _) = _ + rw [ite_eq_right (fun hc ↦ hnb hc.1), push_γ] + · intro e he hb + have h2 := size_two_of_border Γ he hb + change thinγ Γ₁ Δ g _ = _ ∨ thinγ Γ₁ Δ g _ = _ + rw [thinγ_two hΔ g (htwo e he h2).1 (htwo e he h2).2, ← push_γ h Γ e] + exact hg _ (htwo e he h2).1 (htwo e he h2).2 + · intro e' he' h2 + rw [hE'] at he' + rcases he' with he' | ⟨c, hc, rfl⟩ + · rcases Γ₁.sk_cases he' with ⟨h₁, -⟩ | ⟨c, hc, h3, hsub, -⟩ + · obtain ⟨e, he, rfl⟩ := (push_E h Γ) ▸ h₁ + refine Or.inl ⟨e, he, ?_, rfl⟩ + rw [← ncard_tilde_image h] + exact h2 + · obtain ⟨e, he, rfl⟩ := (push_E h Γ) ▸ hc + have h3' : (tilde e).ncard = 3 := by + rw [← ncard_tilde_image h] + exact h3 + right + refine ⟨?_, e, he, h3', ?_⟩ + · exact (internal_of_three Γ₁ hc h3).mono_left hsub + · obtain ⟨u, v, -, -, hV, -⟩ := Γ₁.sk_line he' + rw [← tilde_image_homeo, ← Γ₁.closure_inter_V hc] + exact fun x hx ↦ ⟨closure_mono hsub hx.1, hV hx⟩ + · have := hc.2 + rw [hΔ.tilde_core hc.1 hc.2] at h2 + omega + · intro t ht + obtain ⟨C, rfl⟩ := stdFrame_short par hS ht + obtain ⟨e, he, -, -, heq⟩ := hedge C + exact ⟨e, he, heq⟩ + + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/ThinningProved.lean b/LeanPool/GraphMinor/GM19/ThinningProved.lean new file mode 100644 index 0000000000..79497f5ab8 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/ThinningProved.lean @@ -0,0 +1,33 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Thinning +import LeanPool.GraphMinor.GM19.Section2Proved +public import LeanPool.GraphMinor.GM19.FrameMove + +import LeanPool.GraphMinor.GM19.Section15b + +/-! +# Graph Minors XIX: proved deductions from Thinning + +The deductions use existing proofs after the preliminary geometry has been defined. +-/ + +public section +namespace GraphMinor.GM19 +open Set Topology GraphMinor.Surface +universe w + +/-- Graph Minors XIX, (2.1), using the proved colouring and topology results. -/ +theorem gm19Theorem21' : + GM20.GM19Theorem21Statement.{w} := + gm19Theorem21 + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/UniverseLift1.lean b/LeanPool/GraphMinor/GM19/UniverseLift1.lean new file mode 100644 index 0000000000..03f3801ee2 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/UniverseLift1.lean @@ -0,0 +1,649 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.Thinning +public import LeanPool.GraphMinor.Surface.Classification +public import LeanPool.GraphMinor.Surface.AddCrosscap +import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! +# Universe-polymorphic transport of paintings, frames, thinnings, and inflations + +This file transports paintings, frames, thinnings, and inflations along a homeomorphism +`ψ : S ≃ₜ S'` between surfaces in arbitrary universes `Type u₁` and `Type u₂`. Using +`Surface.classification.{u}`, this immediately lifts `Theorem21TopologyStatement.{0}` to +`Theorem21TopologyStatement.{u}`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface + +universe u u₁ u₂ w + +section BasicHomeo + +variable {S : Type u₁} {S' : Type u₂} [TopologicalSpace S] [TopologicalSpace S'] (ψ : S ≃ₜ S') + +theorem symm_image_image_u (A : Set S) : ψ.symm '' (ψ '' A) = A := by + rw [← image_comp] + simp + +theorem image_symm_image_u (A : Set S') : ψ '' (ψ.symm '' A) = A := by + rw [← image_comp] + simp + +theorem image_tilde_u (c : Set S) : tilde (ψ '' c) = ψ '' tilde c := + Surface.image_tilde_homeomorph ψ c + +theorem ncard_tilde_image_u (c : Set S) : (tilde (ψ '' c)).ncard = (tilde c).ncard := by + rw [image_tilde_u, ncard_image_of_injective _ ψ.injective] + +theorem image_arcComponentsIn_u (F : Set S) : + arcComponentsIn (ψ '' F) = (fun c ↦ ψ '' c) '' arcComponentsIn F := + GM07.arcComponentsIn_image_homeo ψ F + +theorem image_componentsIn_u (F : Set S) : + componentsIn (ψ '' F) = (fun c ↦ ψ '' c) '' componentsIn F := + componentsIn_image (f' := ψ.symm) ψ.continuous.continuousOn ψ.symm.continuous.continuousOn + (fun x _ ↦ by simp) + +theorem image_isClosedDisc_u {Δ : Set S} (h : IsClosedDisc Δ) : IsClosedDisc (ψ '' Δ) := + Surface.image_isClosedDisc_homeomorph ψ h + +theorem image_isOArc_u {F : Set S} (h : IsOArc F) : IsOArc (ψ '' F) := + Surface.image_isOArc_homeomorph ψ h + +theorem image_isLine_u {F : Set S} (h : IsLine F) : IsLine (ψ '' F) := + Surface.image_isLine_homeomorph ψ h + +theorem image_discBd_u (Δ : Set S) : discBd (ψ '' Δ) = ψ '' discBd Δ := + Surface.image_discBd_homeomorph ψ Δ + +theorem image_lineEnds_subset_u (F : Set S) : ψ '' lineEnds F ⊆ lineEnds (ψ '' F) := + Surface.image_lineEnds_subset_homeomorph ψ F + +theorem image_lineEnds_u {S : Type u₁} {S' : Type u₂} [TopologicalSpace S] [TopologicalSpace S'] + (ψ : S ≃ₜ S') (F : Set S) : lineEnds (ψ '' F) = ψ '' lineEnds F := + Surface.image_lineEnds_homeomorph ψ F + +theorem cuffs_eq_image_u : cuffs S' = (fun C ↦ ψ '' C) '' cuffs S := + Surface.image_cuffs_homeomorph ψ + +include ψ in +theorem numCuffs_eq_u : numCuffs S = numCuffs S' := by + have hinj : Injective fun C : Set S ↦ ψ '' C := image_injective.2 ψ.injective + unfold numCuffs + rw [cuffs_eq_image_u ψ, ncard_image_of_injective _ hinj] + +theorem isBorder_image_u {e : Set S} : Painting.IsBorder (ψ '' e) ↔ Painting.IsBorder e := by + have hset : ψ '' e ∩ bd S' = ψ '' (e ∩ bd S) := by + conv_lhs => rw [← image_bd ψ] + exact (image_inter ψ.injective).symm + simp only [Painting.IsBorder, hset, image_nonempty] + +theorem isInternal_image_u {e : Set S} : Painting.IsInternal (ψ '' e) ↔ Painting.IsInternal e := by + rw [isInternal_iff_not_border, isInternal_iff_not_border, isBorder_image_u] + +end BasicHomeo + +section PaintingAndFrame + +variable {S : Type u₁} {S' : Type u₂} [TopologicalSpace S] [TopologicalSpace S'] (ψ : S ≃ₜ S') + +/-- The image of a painting `Γ` under a homeomorphism `ψ : S ≃ₜ S'`. -/ +noncomputable def Painting.mapHomeo (Γ : Painting S) : Painting S' where + U := ψ '' Γ.U + V := ψ '' Γ.V + γ e := (Γ.γ (ψ.symm '' e)).map ψ + isClosed_U := ψ.isClosed_image.mpr Γ.isClosed_U + V_subset := image_mono Γ.V_subset + finite_V := Γ.finite_V.image _ + bd_subset := by + rw [← image_bd ψ] + exact image_mono Γ.bd_subset + finite_edges := by + rw [← image_sdiff ψ.injective, image_arcComponentsIn_u] + exact Γ.finite_edges.image _ + edge_shape := by + rw [← image_sdiff ψ.injective, image_arcComponentsIn_u] + rintro _ ⟨c, hc, rfl⟩ + simp only + rw [image_tilde_u, ncard_image_of_injective _ ψ.injective, ← ψ.image_closure] + rcases Γ.edge_shape c hc with ⟨h₁, h₂, h₃, h₄⟩ | ⟨h₁, h₂, h₃, h₄⟩ + · refine Or.inl ⟨h₁, h₂.image _, image_isLine_u ψ h₃, ?_⟩ + rw [image_lineEnds_u, h₄] + · refine Or.inr ⟨h₁, h₂.image _, image_isClosedDisc_u ψ h₃, ?_⟩ + rw [image_discBd_u] + exact image_mono h₄ + γ_nodup := by + rw [← image_sdiff ψ.injective, image_arcComponentsIn_u] + rintro _ ⟨c, hc, rfl⟩ + simp only + rw [symm_image_image_u ψ] + exact (Γ.γ_nodup c hc).map ψ.injective + γ_set := by + rw [← image_sdiff ψ.injective, image_arcComponentsIn_u] + rintro _ ⟨c, hc, rfl⟩ + simp only + rw [symm_image_image_u ψ, image_tilde_u, ← Γ.γ_set c hc] + ext x + simp + border_edge := by + rw [← image_sdiff ψ.injective, image_arcComponentsIn_u] + rintro _ ⟨c, hc, rfl⟩ hb + simp only at hb ⊢ + have hb' : Painting.IsBorder c := (isBorder_image_u ψ).mp hb + obtain ⟨h₁, h₂⟩ := Γ.border_edge c hc hb' + refine ⟨by rw [image_tilde_u, ncard_image_of_injective _ ψ.injective, h₁], ?_⟩ + rw [← image_bd ψ] + exact image_mono h₂ + +theorem Painting.mapHomeo_E (Γ : Painting S) : (Γ.mapHomeo ψ).E = (fun c ↦ ψ '' c) '' Γ.E := by + change arcComponentsIn (ψ '' Γ.U \ ψ '' Γ.V) = (fun c ↦ ψ '' c) '' arcComponentsIn (Γ.U \ Γ.V) + rw [← image_sdiff ψ.injective, image_arcComponentsIn_u] + +theorem Painting.mapHomeo_mem (Γ : Painting S) {e : Set S} (he : e ∈ Γ.E) : + ψ '' e ∈ (Γ.mapHomeo ψ).E := by + rw [Γ.mapHomeo_E ψ] + exact ⟨e, he, rfl⟩ + +theorem Painting.mapHomeo_γ (Γ : Painting S) (e : Set S) : + (Γ.mapHomeo ψ).γ (ψ '' e) = (Γ.γ e).map ψ := by + change (Γ.γ (ψ.symm '' (ψ '' e))).map ψ = _ + rw [symm_image_image_u ψ] + +theorem Painting.mapHomeo_regions (Γ : Painting S) : + (Γ.mapHomeo ψ).regions = (fun r ↦ ψ '' r) '' Γ.regions := by + change componentsIn (ψ '' Γ.U)ᶜ = (fun r ↦ ψ '' r) '' componentsIn Γ.Uᶜ + rw [← image_compl_eq ψ.bijective] + exact image_componentsIn_u ψ Γ.Uᶜ + +@[ext] +theorem Painting.ext {Γ₁ Γ₂ : Painting S} (hU : Γ₁.U = Γ₂.U) (hV : Γ₁.V = Γ₂.V) + (hγ : Γ₁.γ = Γ₂.γ) : Γ₁ = Γ₂ := by + cases Γ₁; cases Γ₂; congr + +theorem Painting.mapHomeo_symm_mapHomeo (Γ : Painting S) : + (Γ.mapHomeo ψ).mapHomeo ψ.symm = Γ := by + apply Painting.ext + · exact symm_image_image_u ψ _ + · exact symm_image_image_u ψ _ + · funext e + change List.map ψ.symm (List.map ψ (Γ.γ (ψ.symm '' (ψ '' e)))) = Γ.γ e + rw [symm_image_image_u ψ, List.map_map, + show (ψ.symm ∘ ψ : S → S) = id from funext (by simp), List.map_id] + +theorem Painting.mapHomeo_internally {Γ : Painting S} (hΓ : Γ.IsInternallyThreeConnected) : + (Γ.mapHomeo ψ).IsInternallyThreeConnected := by + refine ⟨?_, ?_⟩ + · obtain ⟨e, he⟩ := hΓ.1 + exact ⟨_, Γ.mapHomeo_mem ψ he⟩ + · intro F hF hFU hfin hcard + change F ∩ ψ '' Γ.U ⊆ ψ '' Γ.V at hFU + change (F ∩ ψ '' Γ.V).ncard + _ ≤ 2 at hcard + have himg : ∀ A : Set S, ψ.symm '' (F ∩ ψ '' A) = (ψ.symm '' F) ∩ A := fun A ↦ by + rw [image_inter ψ.symm.injective, symm_image_image_u ψ] + have hbd : ψ.symm '' (F ∩ bd S') = (ψ.symm '' F) ∩ bd S := by + rw [image_inter ψ.symm.injective, image_bd ψ.symm] + obtain ⟨D, h₁, h₂, h₃⟩ := hΓ.2 (ψ.symm '' F) (image_isOArc_u ψ.symm hF) + (by + rw [← himg] + rintro _ ⟨y, hy, rfl⟩ + obtain ⟨v, hv, rfl⟩ := hFU hy + simpa using hv) + (by rw [← hbd]; exact hfin.image _) + (by + rw [← himg, ← hbd, ncard_image_of_injective _ ψ.symm.injective, + ncard_image_of_injective _ ψ.symm.injective] + exact hcard) + refine ⟨ψ '' D, image_isClosedDisc_u ψ h₁, ?_, ?_⟩ + · rw [image_discBd_u, h₂, image_symm_image_u] + · rintro _ ⟨⟨y, hy, rfl⟩, ⟨v, hv, he⟩⟩ + obtain rfl : y = v := ψ.injective he.symm + obtain ⟨z, hz, hzy⟩ := h₃ ⟨hy, hv⟩ + have : ψ y = z := by rw [← hzy]; simp + rw [this] + exact hz + +/-- The image of a frame `Φ` under a homeomorphism `ψ : S ≃ₜ S'`. -/ +noncomputable def Frame.mapHomeo (Φ : Frame S) : Frame S' where + V := ψ '' Φ.V + γ s := (Φ.γ (ψ.symm '' s)).map ψ + isLong s := Φ.isLong (ψ.symm '' s) + V_subset := by + rw [← image_bd ψ] + exact image_mono Φ.V_subset + finite_V := Φ.finite_V.image _ + finite_sides := by + rw [← image_bd ψ, ← image_sdiff ψ.injective, image_arcComponentsIn_u] + exact Φ.finite_sides.image _ + side_shape := by + rw [← image_bd ψ, ← image_sdiff ψ.injective, image_arcComponentsIn_u] + rintro _ ⟨s, hs, rfl⟩ + obtain ⟨h₁, h₂, h₃, h₄⟩ := Φ.side_shape s hs + rw [image_tilde_u, ncard_image_of_injective _ ψ.injective, ← ψ.image_closure, + image_lineEnds_u, h₄] + exact ⟨h₁, h₂.image _, image_isLine_u ψ h₃, rfl⟩ + γ_nodup := by + rw [← image_bd ψ, ← image_sdiff ψ.injective, image_arcComponentsIn_u] + rintro _ ⟨s, hs, rfl⟩ + simp only [symm_image_image_u] + exact (Φ.γ_nodup s hs).map ψ.injective + γ_set := by + rw [← image_bd ψ, ← image_sdiff ψ.injective, image_arcComponentsIn_u] + rintro _ ⟨s, hs, rfl⟩ + simp only [symm_image_image_u, image_tilde_u, ← Φ.γ_set s hs] + ext x + simp + long_disjoint := by + rw [← image_bd ψ, ← image_sdiff ψ.injective, image_arcComponentsIn_u] + rintro _ ⟨s₁, hs₁, rfl⟩ _ ⟨s₂, hs₂, rfl⟩ hne hl₁ hl₂ + simp only [symm_image_image_u] at hl₁ hl₂ + rw [image_tilde_u, image_tilde_u] + exact (disjoint_image_iff ψ.injective).mpr + (Φ.long_disjoint s₁ hs₁ s₂ hs₂ (fun h ↦ hne (by rw [h])) hl₁ hl₂) + +theorem Frame.mapHomeo_sides (Φ : Frame S) : + (Φ.mapHomeo ψ).sides = (fun s ↦ ψ '' s) '' Φ.sides := by + change arcComponentsIn (bd S' \ ψ '' Φ.V) = (fun s ↦ ψ '' s) '' arcComponentsIn (bd S \ Φ.V) + rw [← image_bd ψ, ← image_sdiff ψ.injective, image_arcComponentsIn_u] + +theorem Frame.mapHomeo_longSides (Φ : Frame S) : + (Φ.mapHomeo ψ).longSides = (fun s ↦ ψ '' s) '' Φ.longSides := by + ext s' + simp only [Frame.longSides, mem_ofPred_eq, Φ.mapHomeo_sides ψ, mem_image] + constructor + · rintro ⟨⟨s, hs, rfl⟩, hl⟩ + change Φ.isLong (ψ.symm '' (ψ '' s)) at hl + rw [symm_image_image_u] at hl + exact ⟨s, ⟨hs, hl⟩, rfl⟩ + · rintro ⟨s, ⟨hs, hl⟩, rfl⟩ + refine ⟨⟨s, hs, rfl⟩, ?_⟩ + change Φ.isLong (ψ.symm '' (ψ '' s)) + rwa [symm_image_image_u] + +theorem Frame.mapHomeo_shortSides (Φ : Frame S) : + (Φ.mapHomeo ψ).shortSides = (fun s ↦ ψ '' s) '' Φ.shortSides := by + ext s' + simp only [Frame.shortSides, mem_ofPred_eq, Φ.mapHomeo_sides ψ, mem_image] + constructor + · rintro ⟨⟨s, hs, rfl⟩, hl⟩ + change ¬ Φ.isLong (ψ.symm '' (ψ '' s)) at hl + rw [symm_image_image_u] at hl + exact ⟨s, ⟨hs, hl⟩, rfl⟩ + · rintro ⟨s, ⟨hs, hl⟩, rfl⟩ + refine ⟨⟨s, hs, rfl⟩, ?_⟩ + change ¬ Φ.isLong (ψ.symm '' (ψ '' s)) + rwa [symm_image_image_u] + +theorem Frame.mapHomeo_γ (Φ : Frame S) (s : Set S) : + (Φ.mapHomeo ψ).γ (ψ '' s) = (Φ.γ s).map ψ := by + change (Φ.γ (ψ.symm '' (ψ '' s))).map ψ = _ + rw [symm_image_image_u ψ] + +@[ext] +theorem Frame.ext {Φ₁ Φ₂ : Frame S} (hV : Φ₁.V = Φ₂.V) (hγ : Φ₁.γ = Φ₂.γ) + (hl : Φ₁.isLong = Φ₂.isLong) : Φ₁ = Φ₂ := by + cases Φ₁; cases Φ₂; congr + +theorem Frame.mapHomeo_symm_mapHomeo (Φ : Frame S) : + (Φ.mapHomeo ψ).mapHomeo ψ.symm = Φ := by + apply Frame.ext + · exact symm_image_image_u ψ _ + · funext s + change List.map ψ.symm (List.map ψ (Φ.γ (ψ.symm '' (ψ '' s)))) = Φ.γ s + rw [symm_image_image_u ψ, List.map_map, + show (ψ.symm ∘ ψ : S → S) = id from funext (by simp), List.map_id] + · funext s + change Φ.isLong (ψ.symm '' (ψ '' s)) = Φ.isLong s + rw [symm_image_image_u ψ] + +theorem dirAgrees_image_u {s : Set S} {γs : List S} {e : Set S} {γe : List S} + (h : DirAgrees s γs e γe) : + DirAgrees (ψ '' s) (γs.map ψ) (ψ '' e) (γe.map ψ) := by + obtain ⟨f, t₁, t₂, hlt, hsub, h₁, h₂, h₃, h₄⟩ := h + have hcl : closure (ψ '' s) = ψ '' closure s := (ψ.image_closure s).symm + let f' : Icc (0 : ℝ) 1 ≃ₜ closure (ψ '' s) := + f.trans ((ψ.image (closure s)).trans (Homeomorph.setCongr hcl.symm)) + refine ⟨f', t₁, t₂, hlt, image_mono hsub, ?_, ?_, ?_, ?_⟩ + · rw [List.head?_map, h₁] + rfl + · rw [List.getLast?_map, h₂] + rfl + · rw [List.head?_map, h₃] + rfl + · rw [List.getLast?_map, h₄] + rfl + +theorem Painting.Fits.mapHomeo {Γ : Painting S} {Φ : Frame S} (hf : Γ.Fits Φ) : + (Γ.mapHomeo ψ).Fits (Φ.mapHomeo ψ) := by + refine + { V_subset := image_mono hf.V_subset + short_sides := by + rw [Φ.mapHomeo_shortSides ψ, Γ.mapHomeo_E ψ] + exact image_mono hf.short_sides + border_dir := ?_ + internally_three_connected := Γ.mapHomeo_internally ψ hf.internally_three_connected + size_three_region := ?_ } + · rw [Γ.mapHomeo_E ψ, Φ.mapHomeo_sides ψ] + rintro _ ⟨e, he, rfl⟩ hb _ ⟨s, hs, rfl⟩ hes + rw [Φ.mapHomeo_γ ψ, Γ.mapHomeo_γ ψ] + exact dirAgrees_image_u ψ (hf.border_dir e he ((isBorder_image_u ψ).mp hb) s hs + ((image_subset_image_iff ψ.injective).mp hes)) + · rw [Γ.mapHomeo_E ψ, Γ.mapHomeo_regions ψ] + rintro _ ⟨e, he, rfl⟩ h3 _ ⟨r, hr, rfl⟩ hcard f' hf' + rw [ncard_tilde_image_u ψ] at h3 + have hcard₀ : 3 ≤ (closure r ∩ Γ.V).ncard := by + have : closure (ψ '' r) ∩ (Γ.mapHomeo ψ).V = ψ '' (closure r ∩ Γ.V) := by + change closure (ψ '' r) ∩ ψ '' Γ.V = _ + rw [← ψ.image_closure, image_inter ψ.injective] + rw [this, ncard_image_of_injective _ ψ.injective] at hcard + exact hcard + have hf₀ : f' ∈ (fun c ↦ ψ '' c) '' componentsIn (e ∩ closure r) := by + rw [← image_componentsIn_u ψ, image_inter ψ.injective, ψ.image_closure] + exact hf' + obtain ⟨f, hf_mem, rfl⟩ := hf₀ + obtain ⟨x, hx⟩ := hf.size_three_region e he h3 r hr hcard₀ f hf_mem + refine ⟨ψ x, ?_⟩ + rw [← ψ.image_closure, ← image_bd ψ, ← image_inter ψ.injective] + exact mem_image_of_mem _ hx + +end PaintingAndFrame + +section Thinning + +variable {S : Type u₁} {S₀ : Type u₂} [TopologicalSpace S] [TopologicalSpace S₀] (ψ : S ≃ₜ S₀) + +theorem hasNullSignature_conj {h₀ : S₀ ≃ₜ S₀} (hh₀ : HasNullSignature h₀) : + HasNullSignature (ψ.trans (h₀.trans ψ.symm)) := by + intro C φ hC + have hC₀ : ψ '' C ∈ cuffs S₀ := by + rw [cuffs_eq_image_u ψ] + exact mem_image_of_mem _ hC + let φ₀ : Circle ≃ₜ ↥(ψ '' C) := φ.trans (ψ.image C) + obtain ⟨g, hg₁, hg₂⟩ := hh₀ (ψ '' C) φ₀ hC₀ + refine ⟨g, hg₁, fun x ↦ ?_⟩ + have hx := hg₂ x + change h₀ (ψ (φ x).1) = ψ (φ (g x)).1 at hx + change ψ.symm (h₀ (ψ (φ x).1)) = (φ (g x)).1 + rw [hx, ψ.symm_apply_apply] + +theorem IsThinning.pull {Φ₀ : Frame S₀} {Γ : Painting S} {h₀ : S₀ ≃ₜ S₀} {Γ₀' : Painting S₀} + {s₀ : Set S₀ → Set S₀} (T₀ : IsThinning Φ₀ (Γ.mapHomeo ψ) h₀ Γ₀' s₀) : + IsThinning (Φ₀.mapHomeo ψ.symm) Γ (ψ.trans (h₀.trans ψ.symm)) (Γ₀'.mapHomeo ψ.symm) + (fun e ↦ ψ.symm '' s₀ (ψ '' e)) := by + set h : S ≃ₜ S := ψ.trans (h₀.trans ψ.symm) + have h_img : ∀ A : Set S, h '' A = ψ.symm '' (h₀ '' (ψ '' A)) := fun A ↦ by + ext x + simp [h] + have h_map : ∀ l : List S, l.map h = ((l.map ψ).map h₀).map ψ.symm := fun l ↦ by + simp [h, List.map_map, Function.comp_def] + have hsymm_eq : h.symm = ψ.trans (h₀.symm.trans ψ.symm) := by + ext x + rfl + refine + { null := hasNullSignature_conj ψ T₀.null + null_symm := hsymm_eq ▸ hasNullSignature_conj ψ T₀.null_symm + V_eq := by + change ψ.symm '' Γ₀'.V = h '' Γ.V + rw [T₀.V_eq, h_img] + rfl + fits := T₀.fits.mapHomeo ψ.symm + three := ?_ + three_inj := ?_ + three_surj := ?_ + two := ?_ + internal_γ := ?_ + border_γ := ?_ + rest := ?_ + short := ?_ } + · intro e he h3 + obtain ⟨h₁, h₂, h₃⟩ := T₀.three (ψ '' e) (Γ.mapHomeo_mem ψ he) + (by rw [ncard_tilde_image_u, h3]) + refine ⟨Γ₀'.mapHomeo_mem ψ.symm h₁, ?_, ?_⟩ + · rw [image_tilde_u, h₂, image_tilde_u, ← h_img] + · rw [Γ₀'.mapHomeo_γ ψ.symm, h₃, Γ.mapHomeo_γ ψ, h_map] + · intro e₁ he₁ e₂ he₂ heq + have hs := image_injective.2 ψ.symm.injective heq + have h₁ : ψ '' e₁ ∈ {e' ∈ (Γ.mapHomeo ψ).E | (tilde e').ncard = 3} := + ⟨Γ.mapHomeo_mem ψ he₁.1, by rw [ncard_tilde_image_u, he₁.2]⟩ + have h₂ : ψ '' e₂ ∈ {e' ∈ (Γ.mapHomeo ψ).E | (tilde e').ncard = 3} := + ⟨Γ.mapHomeo_mem ψ he₂.1, by rw [ncard_tilde_image_u, he₂.2]⟩ + exact image_injective.2 ψ.injective (T₀.three_inj h₁ h₂ hs) + · intro e' he' h3 + rw [Γ₀'.mapHomeo_E ψ.symm] at he' + obtain ⟨c₀, hc₀, rfl⟩ := he' + rw [ncard_tilde_image_u] at h3 + obtain ⟨e₀, he₀, h3₀, rfl⟩ := T₀.three_surj c₀ hc₀ h3 + rw [Γ.mapHomeo_E ψ] at he₀ + obtain ⟨e, he, rfl⟩ := he₀ + rw [ncard_tilde_image_u] at h3₀ + exact ⟨e, he, h3₀, rfl⟩ + · intro e he h2 + rw [h_img] + exact Γ₀'.mapHomeo_mem ψ.symm (T₀.two (ψ '' e) (Γ.mapHomeo_mem ψ he) + (by rw [ncard_tilde_image_u, h2])) + · intro e he h2 hi + rw [h_img, Γ₀'.mapHomeo_γ ψ.symm, T₀.internal_γ (ψ '' e) (Γ.mapHomeo_mem ψ he) + (by rw [ncard_tilde_image_u, h2]) ((isInternal_image_u ψ).mpr hi), + Γ.mapHomeo_γ ψ, h_map] + · intro e he hb + rw [h_img, Γ₀'.mapHomeo_γ ψ.symm] + rcases T₀.border_γ (ψ '' e) (Γ.mapHomeo_mem ψ he) ((isBorder_image_u ψ).mpr hb) with hγ | hγ + · left + rw [hγ, Γ.mapHomeo_γ ψ, h_map] + · right + rw [hγ, Γ.mapHomeo_γ ψ, h_map] + exact List.map_reverse + · intro e' he' h2 + rw [Γ₀'.mapHomeo_E ψ.symm] at he' + obtain ⟨c₀, hc₀, rfl⟩ := he' + rw [ncard_tilde_image_u] at h2 + rcases T₀.rest c₀ hc₀ h2 with ⟨e₀, he₀, h2₀, rfl⟩ | ⟨hi₀, d₀, hd₀, h3₀, hsub₀⟩ + · rw [Γ.mapHomeo_E ψ] at he₀ + obtain ⟨e, he, rfl⟩ := he₀ + rw [ncard_tilde_image_u] at h2₀ + dsimp only + exact Or.inl ⟨e, he, h2₀, h_img e⟩ + · rw [Γ.mapHomeo_E ψ] at hd₀ + obtain ⟨d, hd, rfl⟩ := hd₀ + rw [ncard_tilde_image_u] at h3₀ + refine Or.inr ⟨(isInternal_image_u ψ.symm).mpr hi₀, d, hd, h3₀, ?_⟩ + rw [image_tilde_u, h_img, ← image_tilde_u ψ] + exact image_mono hsub₀ + · intro t ht + rw [Φ₀.mapHomeo_shortSides ψ.symm] at ht + obtain ⟨t₀, ht₀, rfl⟩ := ht + obtain ⟨e₀, he₀, rfl⟩ := T₀.short t₀ ht₀ + rw [Γ.mapHomeo_E ψ] at he₀ + obtain ⟨e, he, rfl⟩ := he₀ + dsimp only + exact ⟨e, he, h_img e⟩ + +/-- `Theorem21TopologyStatement` in universe `0` implies `Theorem21TopologyStatement` in any +universe `u`, via `Surface.classification`. -/ +theorem theorem21Topology_of_zero (h0 : Theorem21TopologyStatement.{0}) : + Theorem21TopologyStatement.{u} := by + intro S _ hS hc + obtain ⟨a, b, c, ⟨ψ⟩⟩ := classification.{u} S hS hc + have hS₀ : IsSurface (SurfaceModel a b c) := isSurface_of_homeo ψ hS + have hc₀ : ConnectedSpace (SurfaceModel a b c) := ψ.surjective.connectedSpace ψ.continuous + obtain ⟨Φ₀, hΦ₀⟩ := h0 (SurfaceModel a b c) hS₀ hc₀ + refine ⟨Φ₀.mapHomeo ψ.symm, fun Γ hΓ ↦ ?_⟩ + obtain ⟨h₀, Γ₀', s₀, T₀⟩ := hΦ₀ (Γ.mapHomeo ψ) (Γ.mapHomeo_internally ψ hΓ) + exact ⟨_, _, _, T₀.pull ψ⟩ + +/-- **The topology in the proof of Graph Minors XIX, (2.1), in any universe `u`.** -/ +theorem theorem21Topology_u : Theorem21TopologyStatement.{u} := + theorem21Topology_of_zero theorem21Topology + +end Thinning + +section Inflation + +variable {S : Type u₁} {S' : Type u₂} [TopologicalSpace S] [TopologicalSpace S'] (ψ : S ≃ₜ S') + +theorem skAdj_mapHomeo (Γ : Painting S) {x y : S} : + (Γ.mapHomeo ψ).skAdj.Adj (ψ x) (ψ y) ↔ Γ.skAdj.Adj x y := by + constructor + · rintro ⟨hne, hx, hy, e', he', hxe, hye⟩ + change ψ x ∈ ψ '' Γ.V at hx + change ψ y ∈ ψ '' Γ.V at hy + rw [Γ.mapHomeo_E ψ] at he' + obtain ⟨e, he, rfl⟩ := he' + rw [image_tilde_u] at hxe hye + exact ⟨fun h ↦ hne (congrArg ψ h), (ψ.injective.mem_set_image).mp hx, + (ψ.injective.mem_set_image).mp hy, e, he, + (ψ.injective.mem_set_image).mp hxe, (ψ.injective.mem_set_image).mp hye⟩ + · rintro ⟨hne, hx, hy, e, he, hxe, hye⟩ + refine ⟨fun h ↦ hne (ψ.injective h), mem_image_of_mem _ hx, mem_image_of_mem _ hy, + ψ '' e, Γ.mapHomeo_mem ψ he, ?_, ?_⟩ <;> + · rw [image_tilde_u] + exact mem_image_of_mem _ ‹_› + +theorem preconnected_induce_mapHomeo (Γ : Painting S) {A : Set S} + (h : (Γ.skAdj.induce A).Preconnected) : + ((Γ.mapHomeo ψ).skAdj.induce (ψ '' A)).Preconnected := by + rintro ⟨_, ⟨x, hx, rfl⟩⟩ ⟨_, ⟨y, hy, rfl⟩⟩ + have hwalk : ∀ {a b : A}, (Γ.skAdj.induce A).Walk a b → + ((Γ.mapHomeo ψ).skAdj.induce (ψ '' A)).Reachable + ⟨ψ a.1, mem_image_of_mem _ a.2⟩ ⟨ψ b.1, mem_image_of_mem _ b.2⟩ := by + intro a b w + induction w with + | nil => exact SimpleGraph.Reachable.refl _ + | @cons u v w hadj _ ih => + have hadj' : ((Γ.mapHomeo ψ).skAdj.induce (ψ '' A)).Adj + ⟨ψ u.1, mem_image_of_mem _ u.2⟩ ⟨ψ v.1, mem_image_of_mem _ v.2⟩ := + (skAdj_mapHomeo ψ Γ).mpr hadj + exact hadj'.reachable.trans ih + obtain ⟨w⟩ := h ⟨x, hx⟩ ⟨y, hy⟩ + exact hwalk w + +theorem IsInflation.mapHomeo {Γ₁ Γ₂ : Painting S} {σv : S → Set S} {σe : Set S → Set S} + (h : IsInflation Γ₁ Γ₂ σv σe) : + IsInflation (Γ₁.mapHomeo ψ) (Γ₂.mapHomeo ψ) + (fun v' ↦ ψ '' σv (ψ.symm v')) (fun e' ↦ ψ '' σe (ψ.symm '' e')) where + edge_mem := by + rw [Γ₁.mapHomeo_E ψ] + rintro _ ⟨e, he, rfl⟩ + rw [symm_image_image_u] + exact Γ₂.mapHomeo_mem ψ (h.edge_mem e he) + edge_size := by + rw [Γ₁.mapHomeo_E ψ] + rintro _ ⟨e, he, rfl⟩ + rw [symm_image_image_u, ncard_tilde_image_u, ncard_tilde_image_u] + exact h.edge_size e he + edge_injOn := by + rw [Γ₁.mapHomeo_E ψ] + rintro _ ⟨e₁, he₁, rfl⟩ _ ⟨e₂, he₂, rfl⟩ heq + dsimp only at heq ⊢ + rw [symm_image_image_u, symm_image_image_u] at heq + rw [h.edge_injOn he₁ he₂ (image_injective.2 ψ.injective heq)] + vertex_nonempty := by + rintro _ ⟨v, hv, rfl⟩ + rw [ψ.symm_apply_apply] + exact (h.vertex_nonempty v hv).image _ + vertex_subset := by + rintro _ ⟨v, hv, rfl⟩ + rw [ψ.symm_apply_apply] + exact image_mono (h.vertex_subset v hv) + vertex_connected := by + rintro _ ⟨v, hv, rfl⟩ + rw [ψ.symm_apply_apply] + exact preconnected_induce_mapHomeo ψ Γ₂ (h.vertex_connected v hv) + vertex_disjoint := by + rintro _ ⟨v₁, hv₁, rfl⟩ _ ⟨v₂, hv₂, rfl⟩ hne + rw [ψ.symm_apply_apply, ψ.symm_apply_apply] + exact (disjoint_image_iff ψ.injective).mpr + (h.vertex_disjoint v₁ hv₁ v₂ hv₂ (fun he ↦ hne (congrArg ψ he))) + ends := by + rw [Γ₁.mapHomeo_E ψ] + rintro _ ⟨e, he, rfl⟩ i hi hi' + simp only [symm_image_image_u, Γ₁.mapHomeo_γ ψ, Γ₂.mapHomeo_γ ψ, List.length_map] at hi hi' ⊢ + simp only [List.getElem_map, ψ.symm_apply_apply] + exact mem_image_of_mem _ (h.ends e he i hi hi') + +theorem RespectsFrame.mapHomeo {Φ : Frame S} {Γ₁ : Painting S} {σe : Set S → Set S} + (h : RespectsFrame Φ Γ₁ σe) : + RespectsFrame (Φ.mapHomeo ψ) (Γ₁.mapHomeo ψ) (fun e' ↦ ψ '' σe (ψ.symm '' e')) := by + intro e' he' hb + rw [Γ₁.mapHomeo_E ψ] at he' + obtain ⟨e, he, rfl⟩ := he' + dsimp only at hb ⊢ + rw [symm_image_image_u] + obtain ⟨hb', hs'⟩ := h e he ((isBorder_image_u ψ).mp hb) + refine ⟨(isBorder_image_u ψ).mpr hb', ?_⟩ + rw [Φ.mapHomeo_sides ψ] + rintro _ ⟨s, hs, rfl⟩ + rw [image_subset_image_iff ψ.injective, image_subset_image_iff ψ.injective] + exact hs' s hs + +theorem immediatelyPrecedes_image_u {Θ : Set S} (f : Circle ≃ₜ Θ) {n : S} {A : Set S} : + ImmediatelyPrecedes (f.trans (ψ.image Θ)) (ψ n) (ψ '' A) ↔ ImmediatelyPrecedes f n A := by + have hcp : ∀ t : ℝ, cuffPoint (f.trans (ψ.image Θ)) t = ψ (cuffPoint f t) := fun _ ↦ rfl + constructor + · rintro ⟨t₀, t₁, h01, h02, hn, hA⟩ + rw [hcp] at hn + refine ⟨t₀, t₁, h01, h02, ψ.injective hn, ?_⟩ + apply image_injective.2 ψ.injective + rw [hA, ← image_comp] + rfl + · rintro ⟨t₀, t₁, h01, h02, rfl, rfl⟩ + refine ⟨t₀, t₁, h01, h02, hcp t₀, ?_⟩ + rw [← image_comp] + rfl + +theorem IsLinearInflation.mapHomeo {Γ₁ Γ₂ : Painting S} {σv : S → Set S} {σe : Set S → Set S} + (h : IsLinearInflation Γ₁ Γ₂ σv σe) : + IsLinearInflation (Γ₁.mapHomeo ψ) (Γ₂.mapHomeo ψ) + (fun v' ↦ ψ '' σv (ψ.symm v')) (fun e' ↦ ψ '' σe (ψ.symm '' e')) where + toIsInflation := h.toIsInflation.mapHomeo ψ + borders_iff := by + rw [Γ₁.mapHomeo_E ψ, cuffs_eq_image_u ψ] + rintro _ ⟨e, he, rfl⟩ _ ⟨Θ, hΘ, rfl⟩ + dsimp only + rw [symm_image_image_u, ← image_inter ψ.injective, ← image_inter ψ.injective, + image_nonempty, image_nonempty] + exact h.borders_iff e he Θ hΘ + border_edge := by + rw [Γ₂.mapHomeo_E ψ] + rintro _ ⟨e', he', rfl⟩ hb hnot + have hnot₀ : e' ∉ σe '' Γ₁.E := by + rintro ⟨e, he, rfl⟩ + refine hnot ⟨ψ '' e, Γ₁.mapHomeo_mem ψ he, ?_⟩ + simp [symm_image_image_u] + obtain ⟨v, hv, hsub⟩ := h.border_edge e' he' ((isBorder_image_u ψ).mp hb) hnot₀ + refine ⟨ψ v, mem_image_of_mem _ hv, ?_⟩ + rw [ψ.symm_apply_apply, image_tilde_u] + exact image_mono hsub + orientation := by + rw [Γ₁.mapHomeo_E ψ, cuffs_eq_image_u ψ] + rintro _ ⟨e, he, rfl⟩ _ ⟨Θ, hΘ, rfl⟩ hne f' n₁' n₂' hn₁' hn₂' hip + dsimp only at hne hn₁' hn₂' hip ⊢ + simp only [symm_image_image_u, Γ₁.mapHomeo_γ ψ, Γ₂.mapHomeo_γ ψ, + List.head?_map] at hn₁' hn₂' ⊢ + obtain ⟨n₁, hn₁, rfl⟩ := Option.map_eq_some_iff.mp hn₁' + obtain ⟨n₂, hn₂, rfl⟩ := Option.map_eq_some_iff.mp hn₂' + have hne₀ : (e ∩ Θ).Nonempty := by + rw [← image_inter ψ.injective, image_nonempty] at hne + exact hne + let f : Circle ≃ₜ Θ := f'.trans (ψ.image Θ).symm + have hf' : f' = f.trans (ψ.image Θ) := by + ext x + simp [f] + rw [hf', immediatelyPrecedes_image_u] at hip ⊢ + exact h.orientation e he Θ hΘ hne₀ f n₁ n₂ hn₁ hn₂ hip + +end Inflation + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/UniverseLift2.lean b/LeanPool/GraphMinor/GM19/UniverseLift2.lean new file mode 100644 index 0000000000..34c8d5ed67 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/UniverseLift2.lean @@ -0,0 +1,623 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.UniverseLift1 +public import LeanPool.GraphMinor.GM12.Section3HomeoWalks + +/-! +# Universe-polymorphic transport of capped surfaces, radial drawings, and colour schemes + +This file transports capped surfaces, radial drawings, `Painting.rep`, colour schemes, coloured +paintings, surface orientations, refinements, and conditions `S₁`–`S₄` across homeomorphisms +between surfaces in arbitrary universes `Type u₁` and `Type u₂`. Using `Surface.classification.{u}`, +this lifts `Theorem62Statement.{0}` to `Theorem62Statement.{u}`, `Theorem55Statement.{0, w}` to +`Theorem55Statement.{u, w}`, and `Theorem41Statement.{0, w}` to `Theorem41Statement.{u, w}`. +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Function Topology GraphMinor.Surface GraphMinor.GM07 GraphMinor.GM11 GraphMinor.GM12 + +universe u u₁ u₂ w + +/-! ### Capped surfaces and radial drawings under homeomorphisms -/ + +section CappedAndRadial + +variable {S : Type u₁} {Shat : Type u₁} {S' : Type u₂} {Shat' : Type u₂} + [TopologicalSpace S] [TopologicalSpace Shat] [TopologicalSpace S'] [TopologicalSpace Shat'] + (eS : S ≃ₜ S') (eShat : Shat ≃ₜ Shat') + +theorem image_subBd_u {X : Type u₁} {Y : Type u₂} [TopologicalSpace X] [TopologicalSpace Y] + (ψ : X ≃ₜ Y) (Δ : Set X) : subBd (ψ '' Δ) = ψ '' subBd Δ := by + have h1 : univ \ ψ '' Δ = ψ '' (univ \ Δ) := by + rw [image_sdiff ψ.injective, image_univ_of_surjective ψ.surjective] + rw [subBd, subBd, h1, image_inter ψ.injective, ψ.image_closure, ψ.image_closure] + +/-- Transport an `IsCappedSurface` along homeomorphisms `eS : S ≃ₜ S'` and `eShat : Shat ≃ₜ Shat'`. +-/ +noncomputable def IsCappedSurface.mapHomeo (cap : IsCappedSurface S Shat) : + IsCappedSurface S' Shat' where + isSurface := isSurface_of_homeo eShat cap.isSurface + connected := by + have := cap.connected + exact eShat.surjective.connectedSpace eShat.continuous + bd_empty := by + rw [← image_bd eShat, cap.bd_empty, image_empty] + emb := eShat ∘ cap.emb ∘ eS.symm + isEmbedding := eShat.isEmbedding.comp (cap.isEmbedding.comp eS.symm.isEmbedding) + cuffDisc Θ' := eShat '' cap.cuffDisc (eS.symm '' Θ') + cuffDisc_closedDisc Θ' hΘ' := by + have hΘ : eS.symm '' Θ' ∈ cuffs S := by + rw [cuffs_eq_image_u eS.symm] + exact mem_image_of_mem _ hΘ' + rw [← eShat.image_closure] + exact image_isClosedDisc_u eShat (cap.cuffDisc_closedDisc _ hΘ) + cuffDisc_bd Θ' hΘ' := by + have hΘ : eS.symm '' Θ' ∈ cuffs S := by + rw [cuffs_eq_image_u eS.symm] + exact mem_image_of_mem _ hΘ' + rw [← eShat.image_closure, image_discBd_u, cap.cuffDisc_bd _ hΘ, image_comp, image_comp] + cuffDisc_disjoint Θ₁' hΘ₁' Θ₂' hΘ₂' hne := by + have hΘ₁ : eS.symm '' Θ₁' ∈ cuffs S := by + rw [cuffs_eq_image_u eS.symm] + exact mem_image_of_mem _ hΘ₁' + have hΘ₂ : eS.symm '' Θ₂' ∈ cuffs S := by + rw [cuffs_eq_image_u eS.symm] + exact mem_image_of_mem _ hΘ₂' + rw [← eShat.image_closure, ← eShat.image_closure] + exact (disjoint_image_iff eShat.injective).mpr + (cap.cuffDisc_disjoint _ hΘ₁ _ hΘ₂ (fun h ↦ hne (image_injective.2 eS.symm.injective h))) + compl_eq := by + have hrange : range (eShat ∘ cap.emb ∘ eS.symm) = eShat '' range cap.emb := by + rw [range_comp, (Function.Surjective.range_comp eS.symm.surjective cap.emb)] + rw [hrange, ← image_compl_eq eShat.bijective, cap.compl_eq, image_iUnion₂, + cuffs_eq_image_u eS, biUnion_image] + ext x + simp [symm_image_image_u] + +theorem Painting.hatU_mapHomeo (cap : IsCappedSurface S Shat) (Γ : Painting S) : + (Γ.mapHomeo eS).hatU (cap.mapHomeo eS eShat) = eShat '' (Γ.hatU cap) := by + change (eShat ∘ cap.emb ∘ eS.symm) '' (eS '' Γ.U) = eShat '' (cap.emb '' Γ.U) + rw [image_comp, image_comp, symm_image_image_u] + +theorem Painting.hatV_mapHomeo (cap : IsCappedSurface S Shat) (Γ : Painting S) : + (Γ.mapHomeo eS).hatV (cap.mapHomeo eS eShat) = eShat '' (Γ.hatV cap) := by + change (eShat ∘ cap.emb ∘ eS.symm) '' (eS '' Γ.V) = eShat '' (cap.emb '' Γ.V) + rw [image_comp, image_comp, symm_image_image_u] + +theorem isPreRadial_mapHomeo {U V : Set Shat} {G : Drawing Shat} + (h : IsPreRadial U V G) : + IsPreRadial (eShat '' U) (eShat '' V) (mapDrawingHomeo eShat G) := by + obtain ⟨h₁, h₂, h₃, h₄, h₅, h₆⟩ := h + have hcomp : componentsIn (eShat '' U)ᶜ = (fun r ↦ eShat '' r) '' componentsIn Uᶜ := by + rw [← image_compl_eq eShat.bijective, image_componentsIn_u] + refine ⟨?_, image_mono h₂, ?_, ?_, ?_, ?_⟩ + · change eShat '' U ∩ eShat '' G.U = eShat '' V + rw [← image_inter eShat.injective, h₁] + · rw [hcomp] + rintro _ ⟨r, hr, rfl⟩ + obtain ⟨w, ⟨hwr, hwV⟩, huniq⟩ := h₃ r hr + refine ⟨eShat w, ⟨mem_image_of_mem _ hwr, mem_image_of_mem _ hwV⟩, ?_⟩ + rintro _ ⟨⟨y, hyr, rfl⟩, hyV⟩ + have hyV' : y ∈ G.V := (eShat.injective.mem_set_image).mp hyV + rw [huniq y ⟨hyr, hyV'⟩] + · rintro _ ⟨⟨w, hwV, rfl⟩, hwU⟩ + have hwU' : w ∉ V := fun h ↦ hwU (mem_image_of_mem _ h) + obtain ⟨r, hr, hwr⟩ := h₄ w ⟨hwV, hwU'⟩ + rw [hcomp] + exact ⟨eShat '' r, ⟨r, hr, rfl⟩, mem_image_of_mem _ hwr⟩ + · rw [mapDrawingHomeo_edges] + rintro _ ⟨e, he, rfl⟩ + obtain ⟨v, hv, w, ⟨hwV, hwU⟩, hcl⟩ := h₅ e he + refine ⟨eShat v, mem_image_of_mem _ hv, eShat w, + ⟨mem_image_of_mem _ hwV, fun h ↦ hwU ((eShat.injective.mem_set_image).mp h)⟩, ?_⟩ + change closure (eShat '' e) ∩ eShat '' G.V = {eShat v, eShat w} + rw [← eShat.image_closure, ← image_inter eShat.injective, hcl, image_pair] + · rw [mapDrawingHomeo_edges, hcomp] + rintro _ ⟨e, he, rfl⟩ _ ⟨f, hf, rfl⟩ hne _ ⟨v, hv, rfl⟩ _ ⟨r, hr, rfl⟩ + _ ⟨⟨w, hwr, rfl⟩, hwV⟩ hcle hclf ⟨Δ', hΔ', hsub', hbd'⟩ + have hwV' : w ∈ G.V := (eShat.injective.mem_set_image).mp hwV + have hne₀ : e ≠ f := fun h ↦ hne (by rw [h]) + have hcle₀ : closure e ∩ G.V = {v, w} := by + apply image_injective.2 eShat.injective + rw [image_inter eShat.injective, eShat.image_closure, image_pair] + exact hcle + have hclf₀ : closure f ∩ G.V = {v, w} := by + apply image_injective.2 eShat.injective + rw [image_inter eShat.injective, eShat.image_closure, image_pair] + exact hclf + refine h₆ e he f hf hne₀ v hv r hr w ⟨hwr, hwV'⟩ hcle₀ hclf₀ + ⟨eShat.symm '' Δ', image_isClosedDisc_u eShat.symm hΔ', ?_, ?_⟩ + · rw [← image_subset_image_iff eShat.injective, image_symm_image_u, image_union, + image_singleton] + exact hsub' + · apply image_injective.2 eShat.injective + rw [← image_subBd_u eShat, image_symm_image_u, hbd', image_union, + ← eShat.image_closure, ← eShat.image_closure] + +theorem isSubdrawing_mapDrawingHomeo {G₁ G₂ : Drawing Shat} (h : G₁.IsSubdrawing G₂) : + (mapDrawingHomeo eShat G₁).IsSubdrawing (mapDrawingHomeo eShat G₂) := by + refine ⟨image_mono h.1, ?_⟩ + rw [mapDrawingHomeo_edges, mapDrawingHomeo_edges] + exact image_mono h.2 + +/-- Transport a `RadialDrawing` along homeomorphisms `eS : S ≃ₜ S'` and `eShat : Shat ≃ₜ Shat'`. -/ +noncomputable def RadialDrawing.mapHomeo {cap : IsCappedSurface S Shat} {Γ : Painting S} + (rad : RadialDrawing cap Γ) : + RadialDrawing (cap.mapHomeo eS eShat) (Γ.mapHomeo eS) where + G := mapDrawingHomeo eShat rad.G + isPreRadial := by + rw [Painting.hatU_mapHomeo, Painting.hatV_mapHomeo] + exact isPreRadial_mapHomeo eShat rad.isPreRadial + maximal G' hpre hsub := by + rw [Painting.hatU_mapHomeo, Painting.hatV_mapHomeo] at hpre + have hpre₀ := isPreRadial_mapHomeo eShat.symm hpre + rw [symm_image_image_u, symm_image_image_u] at hpre₀ + have hsub₀ : rad.G.IsSubdrawing (mapDrawingHomeo eShat.symm G') := by + have := isSubdrawing_mapDrawingHomeo eShat.symm hsub + rwa [mapDrawingHomeo_symm] at this + have hmax₀ := rad.maximal (mapDrawingHomeo eShat.symm G') hpre₀ hsub₀ + have := isSubdrawing_mapDrawingHomeo eShat.symm.symm hmax₀ + rwa [mapDrawingHomeo_symm eShat.symm] at this + +theorem exists_walk_mapDrawingHomeo_edges (H : Drawing Shat) {x y : Shat} + (W : GraphWalk H.toGraph x y) : + ∃ W' : GraphWalk (mapDrawingHomeo eShat H).toGraph (eShat x) (eShat y), + W'.support = W.support.map eShat ∧ W'.edges = W.edges.map (image eShat) := by + induction W with + | nil hx => exact ⟨.nil ⟨_, hx, rfl⟩, rfl, rfl⟩ + | cons hl rest ih => + obtain ⟨R, h1, h2⟩ := ih + exact ⟨.cons (isLink_mapDrawingHomeo eShat H hl) R, + congrArg (List.cons _) h1, congrArg (List.cons _) h2⟩ + +theorem isCircuit_mapDrawingHomeo {F : Drawing Shat} (h : F.IsCircuit) : + (mapDrawingHomeo eShat F).IsCircuit := by + obtain ⟨u, W, ⟨htail, hedges⟩, hlen, hV, hE⟩ := h + obtain ⟨W', hsupp, hedg⟩ := exists_walk_mapDrawingHomeo_edges eShat F W + refine ⟨eShat u, W', ⟨?_, ?_⟩, ?_, ?_, ?_⟩ + · rw [hsupp, ← List.map_tail] + exact htail.map eShat.injective + · rw [hedg] + exact hedges.map (image_injective.2 eShat.injective) + · change 0 < W'.edges.length + rw [hedg, List.length_map] + exact hlen + · change eShat '' F.V = {x | x ∈ W'.support} + rw [hV, hsupp] + ext x; simp + · rw [mapDrawingHomeo_edges, hE, hedg] + ext e; simp + +theorem isCircuitOf_mapDrawingHomeo + {F G : Drawing Shat} (h : IsCircuitOf F G) : + IsCircuitOf (mapDrawingHomeo eShat F) (mapDrawingHomeo eShat G) := + ⟨isSubdrawing_mapDrawingHomeo eShat h.1, isCircuit_mapDrawingHomeo eShat h.2⟩ + +theorem isNullHomotopicOArc_image_u {F : Set Shat} (h : IsNullHomotopicOArc F) : + IsNullHomotopicOArc (eShat '' F) := by + obtain ⟨φ, c, -, H, -, h0, h1⟩ := h + refine ⟨φ.trans (eShat.image F), eShat c, trivial, + ⟨fun p ↦ eShat (H p), eShat.continuous.comp H.continuous⟩, + fun _ ↦ trivial, fun x ↦ ?_, fun x ↦ ?_⟩ + · change eShat (H (x, 0)) = eShat (φ x).1 + rw [h0]; rfl + · change eShat (H (x, 1)) = eShat c + rw [h1]; rfl + +theorem isNullHomotopicOArc_image_iff_u {F : Set Shat} : + IsNullHomotopicOArc (eShat '' F) ↔ IsNullHomotopicOArc F := by + constructor + · intro h + have := isNullHomotopicOArc_image_u eShat.symm h + rwa [symm_image_image_u] at this + · exact isNullHomotopicOArc_image_u eShat + +theorem Painting.rep_mapHomeo + {cap : IsCappedSurface S Shat} {Γ : Painting S} (rad : RadialDrawing cap Γ) : + Painting.rep (rad.mapHomeo eS eShat) = Painting.rep rad := by + unfold Painting.rep + congr 1 + ext n + simp only [mem_ofPred_eq] + constructor + · rintro ⟨F', hcirc', hnull', rfl⟩ + refine ⟨mapDrawingHomeo eShat.symm F', ?_, ?_, ?_⟩ + · have := isCircuitOf_mapDrawingHomeo eShat.symm hcirc' + change IsCircuitOf _ (mapDrawingHomeo eShat.symm (mapDrawingHomeo eShat rad.G)) at this + rwa [mapDrawingHomeo_symm] at this + · change ¬ IsNullHomotopicOArc (eShat.symm '' F'.U) + rw [isNullHomotopicOArc_image_iff_u] + exact hnull' + · rw [mapDrawingHomeo_edges, ncard_image_of_injective _ (image_injective.2 + eShat.symm.injective)] + · rintro ⟨F, hcirc, hnull, rfl⟩ + refine ⟨mapDrawingHomeo eShat F, isCircuitOf_mapDrawingHomeo eShat hcirc, ?_, ?_⟩ + · change ¬ IsNullHomotopicOArc (eShat '' F.U) + rw [isNullHomotopicOArc_image_iff_u] + exact hnull + · rw [mapDrawingHomeo_edges, ncard_image_of_injective _ (image_injective.2 eShat.injective)] + +end CappedAndRadial + +/-! ### Lifting `Theorem62Statement` from universe `0` to universe `u` -/ + +/-- `Theorem62Statement` in universe `0` implies `Theorem62Statement` in any universe `u`. -/ +theorem theorem_6_2_lift (h0 : Theorem62Statement.{0}) : Theorem62Statement.{u} := by + intro S Shat _ _ _ _ cap hS + have := cap.connected + obtain ⟨a, b, c, ⟨eShat⟩⟩ := classification.{u} Shat cap.isSurface cap.connected + let Shat₀ : Type 0 := SurfaceModel a b c + have : T2Space Shat₀ := (isSurface_model a b c).1.2.1 + let S₀ : Type 0 := ↥(eShat '' range cap.emb) + let eS : S ≃ₜ S₀ := cap.isEmbedding.toHomeomorph.trans (eShat.image (range cap.emb)) + have hS₀ : IsSurface S₀ := isSurface_of_homeo eS hS + let cap₀ : IsCappedSurface S₀ Shat₀ := cap.mapHomeo eS eShat + obtain ⟨n, hn⟩ := h0 S₀ Shat₀ cap₀ hS₀ + refine ⟨n, fun Φ Γ₁ Γ₂ rad hfit₁ hfit₂ hrep σv σe hinf hresp ↦ ?_⟩ + have hrep₀ : (n : ℕ∞) ≤ Painting.rep (rad.mapHomeo eS eShat) := by + rwa [Painting.rep_mapHomeo] + obtain ⟨σv₀', hlin₀, hsub₀⟩ := hn (Φ.mapHomeo eS) (Γ₁.mapHomeo eS) (Γ₂.mapHomeo eS) + (rad.mapHomeo eS eShat) (hfit₁.mapHomeo eS) (hfit₂.mapHomeo eS) hrep₀ + _ _ (hinf.mapHomeo eS) (hresp.mapHomeo eS) + refine ⟨fun v ↦ eS.symm '' σv₀' (eS v), ?_, ?_⟩ + · have hlin := hlin₀.mapHomeo eS.symm + rw [Γ₁.mapHomeo_symm_mapHomeo eS, Γ₂.mapHomeo_symm_mapHomeo eS] at hlin + have hσe : (fun e' ↦ eS.symm '' (eS '' σe (eS.symm '' (eS.symm.symm '' e')))) = σe := by + funext e + change eS.symm '' (eS '' σe (eS.symm '' (eS '' e))) = σe e + rw [symm_image_image_u, symm_image_image_u] + rwa [hσe] at hlin + · intro v hv + have h₁ := hsub₀ (eS v) (mem_image_of_mem _ hv) + rw [eS.symm_apply_apply] at h₁ + have h₂ := image_mono (f := eS.symm) h₁ + rwa [symm_image_image_u] at h₂ + +/-! ### Colour schemes, orientations, refinements, and conditions `S₁`–`S₄` under homeomorphisms -/ + +section ColourSchemeAndOrientation + +variable {S : Type u₁} {S' : Type u₂} [TopologicalSpace S] [TopologicalSpace S'] + {α : Type w} (ψ : S ≃ₜ S') + +/-- Transport a `ColourScheme` along a homeomorphism `ψ : S ≃ₜ S'`. -/ +noncomputable def ColourScheme.mapHomeo (χ : ColourScheme S α) : ColourScheme S' α where + isSurface := isSurface_of_homeo ψ χ.isSurface + connected := by + have := χ.connected + exact ψ.surjective.connectedSpace ψ.continuous + Φ := χ.Φ.mapHomeo ψ + Ω2 := χ.Ω2 + Ω3 := χ.Ω3 + ΩS s' := χ.ΩS (ψ.symm '' s') + shortElem s' := χ.shortElem (ψ.symm '' s') + isWQO_2 := χ.isWQO_2 + isWQO_3 := χ.isWQO_3 + isWQO_S := by + rw [χ.Φ.mapHomeo_sides ψ] + rintro _ ⟨s, hs, rfl⟩ + rw [symm_image_image_u] + exact χ.isWQO_S s hs + short_singleton := by + rw [χ.Φ.mapHomeo_shortSides ψ] + rintro _ ⟨s, hs, rfl⟩ + rw [symm_image_image_u] + exact χ.short_singleton s hs + +/-- Transport a `ColouredPainting` along a homeomorphism `ψ : S ≃ₜ S'`. -/ +noncomputable def ColouredPainting.mapHomeo {χ : ColourScheme S α} (P : ColouredPainting χ) : + ColouredPainting (χ.mapHomeo ψ) where + Γ := P.Γ.mapHomeo ψ + φ e' := P.φ (ψ.symm '' e') + fits := P.fits.mapHomeo ψ + internal_2_mem := by + rw [P.Γ.mapHomeo_E ψ] + rintro _ ⟨e, he, rfl⟩ hi h2 + rw [symm_image_image_u] + exact P.internal_2_mem e he ((isInternal_image_u ψ).mp hi) (by rwa [ncard_tilde_image_u] at h2) + internal_3_mem := by + rw [P.Γ.mapHomeo_E ψ] + rintro _ ⟨e, he, rfl⟩ hi h3 + rw [symm_image_image_u] + exact P.internal_3_mem e he ((isInternal_image_u ψ).mp hi) (by rwa [ncard_tilde_image_u] at h3) + border_mem := by + change ∀ e ∈ (P.Γ.mapHomeo ψ).E, ∀ s ∈ (χ.Φ.mapHomeo ψ).sides, _ + rw [P.Γ.mapHomeo_E ψ, χ.Φ.mapHomeo_sides ψ] + rintro _ ⟨e, he, rfl⟩ _ ⟨s, hs, rfl⟩ ⟨hb, hsub⟩ + dsimp only [ColourScheme.mapHomeo] + rw [symm_image_image_u, symm_image_image_u] + exact P.border_mem e he s hs ⟨(isBorder_image_u ψ).mp hb, + (image_subset_image_iff ψ.injective).mp hsub⟩ + +theorem IsColouredLinearInflation.mapHomeo {χ : ColourScheme S α} + {P₁ P₂ : ColouredPainting χ} {σv : S → Set S} {σe : Set S → Set S} + (h : IsColouredLinearInflation χ P₁ P₂ σv σe) : + IsColouredLinearInflation (χ.mapHomeo ψ) (P₁.mapHomeo ψ) (P₂.mapHomeo ψ) + (fun v' ↦ ψ '' σv (ψ.symm v')) (fun e' ↦ ψ '' σe (ψ.symm '' e')) where + isInflation := h.isInflation.mapHomeo ψ + respects := h.respects.mapHomeo ψ + le_internal_2 := by + change ∀ e ∈ (P₁.Γ.mapHomeo ψ).E, _ + rw [P₁.Γ.mapHomeo_E ψ] + rintro _ ⟨e, he, rfl⟩ hi h2 + dsimp only [ColouredPainting.mapHomeo, ColourScheme.mapHomeo] + rw [symm_image_image_u, symm_image_image_u] + exact h.le_internal_2 e he ((isInternal_image_u ψ).mp hi) (by rwa [ncard_tilde_image_u] at h2) + le_internal_3 := by + change ∀ e ∈ (P₁.Γ.mapHomeo ψ).E, _ + rw [P₁.Γ.mapHomeo_E ψ] + rintro _ ⟨e, he, rfl⟩ hi h3 + dsimp only [ColouredPainting.mapHomeo, ColourScheme.mapHomeo] + rw [symm_image_image_u, symm_image_image_u] + exact h.le_internal_3 e he ((isInternal_image_u ψ).mp hi) (by rwa [ncard_tilde_image_u] at h3) + le_border := by + change ∀ e ∈ (P₁.Γ.mapHomeo ψ).E, ∀ s ∈ (χ.Φ.mapHomeo ψ).sides, _ + rw [P₁.Γ.mapHomeo_E ψ, χ.Φ.mapHomeo_sides ψ] + rintro _ ⟨e, he, rfl⟩ _ ⟨s, hs, rfl⟩ ⟨hb, hsub⟩ + dsimp only [ColouredPainting.mapHomeo, ColourScheme.mapHomeo] + rw [symm_image_image_u, symm_image_image_u, symm_image_image_u] + exact h.le_border e he s hs ⟨(isBorder_image_u ψ).mp hb, + (image_subset_image_iff ψ.injective).mp hsub⟩ + isLinear := h.isLinear.mapHomeo ψ + +theorem IsColouredLinearInflation.unmapHomeo {χ : ColourScheme S α} + {P₁ P₂ : ColouredPainting χ} {σv' : S' → Set S'} {σe' : Set S' → Set S'} + (h : IsColouredLinearInflation (χ.mapHomeo ψ) (P₁.mapHomeo ψ) (P₂.mapHomeo ψ) σv' σe') : + IsColouredLinearInflation χ P₁ P₂ + (fun v ↦ ψ.symm '' σv' (ψ v)) (fun e ↦ ψ.symm '' σe' (ψ '' e)) := by + have h₁ := h.mapHomeo ψ.symm + have hΓ₁ : (P₁.mapHomeo ψ).Γ.mapHomeo ψ.symm = P₁.Γ := P₁.Γ.mapHomeo_symm_mapHomeo ψ + have hΓ₂ : (P₂.mapHomeo ψ).Γ.mapHomeo ψ.symm = P₂.Γ := P₂.Γ.mapHomeo_symm_mapHomeo ψ + have hΦ : (χ.mapHomeo ψ).Φ.mapHomeo ψ.symm = χ.Φ := χ.Φ.mapHomeo_symm_mapHomeo ψ + refine + { isInflation := hΓ₁ ▸ hΓ₂ ▸ h.isInflation.mapHomeo ψ.symm + respects := hΦ ▸ hΓ₁ ▸ h.respects.mapHomeo ψ.symm + le_internal_2 := fun e he hi h2 ↦ by + have := h.le_internal_2 (ψ '' e) (P₁.Γ.mapHomeo_mem ψ he) + ((isInternal_image_u ψ).mpr hi) (by rwa [ncard_tilde_image_u]) + dsimp only [ColouredPainting.mapHomeo, ColourScheme.mapHomeo] at this + rwa [symm_image_image_u] at this + le_internal_3 := fun e he hi h3 ↦ by + have := h.le_internal_3 (ψ '' e) (P₁.Γ.mapHomeo_mem ψ he) + ((isInternal_image_u ψ).mpr hi) (by rwa [ncard_tilde_image_u]) + dsimp only [ColouredPainting.mapHomeo, ColourScheme.mapHomeo] at this + rwa [symm_image_image_u] at this + le_border := fun e he s hs ⟨hb, hsub⟩ ↦ by + have hs' : ψ '' s ∈ (χ.mapHomeo ψ).Φ.sides := by + change ψ '' s ∈ (χ.Φ.mapHomeo ψ).sides + rw [χ.Φ.mapHomeo_sides ψ] + exact ⟨s, hs, rfl⟩ + have := h.le_border (ψ '' e) (P₁.Γ.mapHomeo_mem ψ he) (ψ '' s) hs' + ⟨(isBorder_image_u ψ).mpr hb, image_mono hsub⟩ + dsimp only [ColouredPainting.mapHomeo, ColourScheme.mapHomeo] at this + rwa [symm_image_image_u, symm_image_image_u] at this + isLinear := hΓ₁ ▸ hΓ₂ ▸ h.isLinear.mapHomeo ψ.symm } + +theorem IsBadSequence.mapHomeo {χ : ColourScheme S α} {P : ℕ → ColouredPainting χ} + (h : IsBadSequence χ P) : + IsBadSequence (χ.mapHomeo ψ) (fun i ↦ (P i).mapHomeo ψ) := by + intro i j hij ⟨σv', σe', hlin⟩ + exact h i j hij ⟨_, _, hlin.unmapHomeo ψ⟩ + +theorem IsBadSequence.unmapHomeo {χ : ColourScheme S α} {P' : ℕ → ColouredPainting (χ.mapHomeo ψ)} + (h : IsBadSequence (χ.mapHomeo ψ) P') : + IsBadSequence (χ.mapHomeo ψ |>.mapHomeo ψ.symm) (fun i ↦ (P' i).mapHomeo ψ.symm) := + h.mapHomeo ψ.symm + +theorem ColourScheme.IsBad.mapHomeo {χ : ColourScheme S α} (h : χ.IsBad) : + (χ.mapHomeo ψ).IsBad := by + obtain ⟨P, hP⟩ := h + exact ⟨fun i ↦ (P i).mapHomeo ψ, hP.mapHomeo ψ⟩ + +/-- Transport a `SurfaceOrientation` along a homeomorphism `ψ : S ≃ₜ S'`. -/ +def SurfaceOrientation.mapHomeo (ω : SurfaceOrientation S) : SurfaceOrientation S' where + pos Δ' a' b' c' := ω.pos (ψ.symm '' Δ') (ψ.symm a') (ψ.symm b') (ψ.symm c') + isDirection Δ' hΔ' := by + obtain ⟨φ, hcont, hinj, hrange, hpos⟩ := + ω.isDirection (ψ.symm '' Δ') (image_isClosedDisc_u ψ.symm hΔ') + refine ⟨ψ ∘ φ, ψ.continuous.comp hcont, ψ.injective.comp hinj, ?_, ?_⟩ + · rw [range_comp, hrange, ← image_discBd_u, image_symm_image_u] + · intro a b c hab hbc hac + dsimp only [Function.comp_apply] + rw [ψ.symm_apply_apply, ψ.symm_apply_apply, ψ.symm_apply_apply] + exact hpos a b c hab hbc hac + agree Δ₁' Δ₂' h₁ h₂ hsub a' b' c' ha' hb' hc' hab hbc hac := by + have hbd : ∀ {x' : S'} {D' : Set S'}, x' ∈ discBd D' → ψ.symm x' ∈ discBd (ψ.symm '' D') := by + intro x' D' hx' + rw [image_discBd_u] + exact mem_image_of_mem _ hx' + exact ω.agree (ψ.symm '' Δ₁') (ψ.symm '' Δ₂') + (image_isClosedDisc_u ψ.symm h₁) (image_isClosedDisc_u ψ.symm h₂) (image_mono hsub) + (ψ.symm a') (ψ.symm b') (ψ.symm c') + ⟨hbd ha'.1, hbd ha'.2⟩ ⟨hbd hb'.1, hbd hb'.2⟩ ⟨hbd hc'.1, hbd hc'.2⟩ + (fun h ↦ hab (ψ.symm.injective h)) + (fun h ↦ hbc (ψ.symm.injective h)) + (fun h ↦ hac (ψ.symm.injective h)) + +include ψ in +theorem isOrientableSurface_iff_u : IsOrientableSurface S' ↔ IsOrientableSurface S := + ⟨fun ⟨ω'⟩ ↦ ⟨ω'.mapHomeo ψ.symm⟩, fun ⟨ω⟩ ↦ ⟨ω.mapHomeo ψ⟩⟩ + +theorem IsSimilarlyOriented.mapHomeo {χ : ColourScheme S α} {P : ℕ → ColouredPainting χ} + (h : IsSimilarlyOriented χ P) : + IsSimilarlyOriented (χ.mapHomeo ψ) (fun i ↦ (P i).mapHomeo ψ) := by + rcases h with hno | ⟨ω, hω⟩ + · exact Or.inl (mt (isOrientableSurface_iff_u ψ).mp hno) + · refine Or.inr ⟨ω.mapHomeo ψ, fun i e' he' h3 a' b' c' hγ' ↦ ?_⟩ + change e' ∈ ((P i).Γ.mapHomeo ψ).E at he' + rw [(P i).Γ.mapHomeo_E ψ] at he' + obtain ⟨e, he, rfl⟩ := he' + rw [ncard_tilde_image_u] at h3 + change ((P i).Γ.mapHomeo ψ).γ (ψ '' e) = [a', b', c'] at hγ' + rw [(P i).Γ.mapHomeo_γ ψ] at hγ' + have hγ : (P i).Γ.γ e = [ψ.symm a', ψ.symm b', ψ.symm c'] := by + have := congrArg (List.map ψ.symm) hγ' + rw [List.map_map, show (ψ.symm ∘ ψ : S → S) = id from funext (by simp), List.map_id] at this + exact this + change ω.pos (ψ.symm '' closure (ψ '' e)) (ψ.symm a') (ψ.symm b') (ψ.symm c') + rw [ψ.symm.image_closure, symm_image_image_u] + exact hω i e he h3 (ψ.symm a') (ψ.symm b') (ψ.symm c') hγ + +theorem ColourScheme.IsOrientedlyBad.mapHomeo {χ : ColourScheme S α} (h : χ.IsOrientedlyBad) : + (χ.mapHomeo ψ).IsOrientedlyBad := by + obtain ⟨P, hbad, hor⟩ := h + exact ⟨fun i ↦ (P i).mapHomeo ψ, hbad.mapHomeo ψ, hor.mapHomeo ψ⟩ + +end ColourSchemeAndOrientation + +/-! ### Transporting conditions `S₁`–`S₄` to `Type 0` and lifting `(5.5)` and `(4.1)` -/ + +section ConditionsAndLifts + +variable {S Shat : Type u} [TopologicalSpace S] [TopologicalSpace Shat] + {S₀ Shat₀ : Type 0} [TopologicalSpace S₀] [TopologicalSpace Shat₀] + {β : Type w} (eS : S ≃ₜ S₀) (eShat : Shat ≃ₜ Shat₀) + +theorem isSimplerThan_of_homeo_both {X : Type u₁} {Y : Type u₂} {X' : Type*} {Y' : Type*} + [TopologicalSpace X] [TopologicalSpace Y] [TopologicalSpace X'] [TopologicalSpace Y'] + (eX : X ≃ₜ X') (eY : Y ≃ₜ Y') (h : IsSimplerThan X Y) : IsSimplerThan X' Y' := by + obtain ⟨a, b, c, a', b', c', ⟨hX⟩, ⟨hY⟩, h1, h2, h3⟩ := h + exact ⟨a, b, c, a', b', c', ⟨eX.symm.trans hX⟩, ⟨eY.symm.trans hY⟩, h1, h2, h3⟩ + +include eShat in +theorem ConditionS1.mapHomeo (h1 : ConditionS1.{u, w} Shat) : + ConditionS1.{0, w} Shat₀ := by + intro S' Shat' _ _ γ χ' ⟨cap'⟩ hsimp hbad + let uS : S' ≃ₜ ULift.{u} S' := Homeomorph.ulift.symm + let uShat : Shat' ≃ₜ ULift.{u} Shat' := Homeomorph.ulift.symm + exact h1 (ULift.{u} S') (ULift.{u} Shat') γ (χ'.mapHomeo uS) + ⟨cap'.mapHomeo uS uShat⟩ + (isSimplerThan_of_homeo_both uShat eShat.symm hsimp) + (hbad.mapHomeo uS) + +theorem ConditionS2.mapHomeo {cap : IsCappedSurface S Shat} {χ : ColourScheme S β} + (h2 : ConditionS2 χ cap) : + ConditionS2 (χ.mapHomeo eS) (cap.mapHomeo eS eShat) := by + intro S' Shat' _ _ χ' ⟨cap'⟩ ⟨hiso⟩ h3sub h2sub hstrict hobad + let uS : S' ≃ₜ ULift.{u} S' := Homeomorph.ulift.symm + let uShat : Shat' ≃ₜ ULift.{u} Shat' := Homeomorph.ulift.symm + exact h2 (ULift.{u} S') (ULift.{u} Shat') (χ'.mapHomeo uS) + ⟨cap'.mapHomeo uS uShat⟩ + ⟨uShat.symm.trans (hiso.trans eShat.symm)⟩ + h3sub h2sub hstrict (hobad.mapHomeo uS) + +theorem ConditionS3.mapHomeo {cap : IsCappedSurface S Shat} {χ : ColourScheme S β} + (h3 : ConditionS3 χ cap) : + ConditionS3 (χ.mapHomeo eS) (cap.mapHomeo eS eShat) := by + intro S' Shat' _ _ χ' ⟨cap'⟩ ⟨hiso⟩ hΩ2 hΩ3 hcuffs hobad + let uS : S' ≃ₜ ULift.{u} S' := Homeomorph.ulift.symm + let uShat : Shat' ≃ₜ ULift.{u} Shat' := Homeomorph.ulift.symm + have hcuffs' : numCuffs (ULift.{u} S') < numCuffs S := by + rw [← numCuffs_eq_u uS, numCuffs_eq_u eS] + exact hcuffs + exact h3 (ULift.{u} S') (ULift.{u} Shat') (χ'.mapHomeo uS) + ⟨cap'.mapHomeo uS uShat⟩ + ⟨uShat.symm.trans (hiso.trans eShat.symm)⟩ + hΩ2 hΩ3 hcuffs' (hobad.mapHomeo uS) + +theorem ConditionS4.mapHomeo {χ : ColourScheme S β} (h4 : ConditionS4 χ) : + ConditionS4 (χ.mapHomeo eS) := by + intro S' _ χ' href hobad + let uS : S' ≃ₜ ULift.{u} S' := Homeomorph.ulift.symm + obtain ⟨⟨hiso⟩, hΩ2, hΩ3, f, hmaps, hsub, hstrict, hshort⟩ := href + have href_u : (χ'.mapHomeo uS).IsRefinement χ := by + refine ⟨⟨uS.symm.trans (hiso.trans eS.symm)⟩, hΩ2, hΩ3, + fun R_u ↦ eS.symm '' f (uS.symm '' R_u), ?_, ?_, ?_, ?_⟩ + · intro R_u hR_u + change R_u ∈ (χ'.Φ.mapHomeo uS).longSides at hR_u + rw [χ'.Φ.mapHomeo_longSides uS] at hR_u + obtain ⟨R, hR, rfl⟩ := hR_u + dsimp only + rw [symm_image_image_u] + have hfR := hmaps hR + change f R ∈ (χ.Φ.mapHomeo eS).longSides at hfR + rw [χ.Φ.mapHomeo_longSides eS] at hfR + obtain ⟨s, hs, hs_eq⟩ := hfR + rw [← hs_eq, symm_image_image_u] + exact hs + · intro R_u hR_u + change R_u ∈ (χ'.Φ.mapHomeo uS).longSides at hR_u + rw [χ'.Φ.mapHomeo_longSides uS] at hR_u + obtain ⟨R, hR, rfl⟩ := hR_u + dsimp only [ColourScheme.mapHomeo] + rw [symm_image_image_u] + exact hsub R hR + · intro R₁_u hR₁_u R₂_u hR₂_u hne heq + change R₁_u ∈ (χ'.Φ.mapHomeo uS).longSides at hR₁_u + change R₂_u ∈ (χ'.Φ.mapHomeo uS).longSides at hR₂_u + rw [χ'.Φ.mapHomeo_longSides uS] at hR₁_u hR₂_u + obtain ⟨R₁, hR₁, rfl⟩ := hR₁_u + obtain ⟨R₂, hR₂, rfl⟩ := hR₂_u + dsimp only [ColourScheme.mapHomeo] at heq ⊢ + rw [symm_image_image_u, symm_image_image_u] at heq + rw [symm_image_image_u] + exact hstrict R₁ hR₁ R₂ hR₂ (fun h ↦ hne (by rw [h])) + (image_injective.2 eS.symm.injective heq) + · intro hall + have hcard₁ : (χ'.mapHomeo uS).Φ.shortSides.ncard = χ'.Φ.shortSides.ncard := by + change (χ'.Φ.mapHomeo uS).shortSides.ncard = _ + rw [χ'.Φ.mapHomeo_shortSides uS, + ncard_image_of_injective _ (image_injective.2 uS.injective)] + have hcard₂ : (χ.mapHomeo eS).Φ.shortSides.ncard = χ.Φ.shortSides.ncard := by + change (χ.Φ.mapHomeo eS).shortSides.ncard = _ + rw [χ.Φ.mapHomeo_shortSides eS, + ncard_image_of_injective _ (image_injective.2 eS.injective)] + rw [hcard₁, ← hcard₂] + refine hshort (fun s₀ hs₀ ↦ ?_) + change s₀ ∈ (χ.Φ.mapHomeo eS).longSides at hs₀ + rw [χ.Φ.mapHomeo_longSides eS] at hs₀ + obtain ⟨s, hs, rfl⟩ := hs₀ + obtain ⟨R_u, hR_u, hf_eq, hE_eq⟩ := hall s hs + change R_u ∈ (χ'.Φ.mapHomeo uS).longSides at hR_u + rw [χ'.Φ.mapHomeo_longSides uS] at hR_u + obtain ⟨R, hR, rfl⟩ := hR_u + dsimp only [ColourScheme.mapHomeo] at hf_eq hE_eq ⊢ + rw [symm_image_image_u] at hf_eq hE_eq + refine ⟨R, hR, ?_, ?_⟩ + · rw [← hf_eq, image_symm_image_u] + · rw [symm_image_image_u] + exact hE_eq + exact h4 (ULift.{u} S') (χ'.mapHomeo uS) href_u (hobad.mapHomeo uS) + +/-- `Theorem55Statement` in universe `0` implies `Theorem55Statement` in any universe `u`. -/ +theorem theorem_5_5_lift (h0 : Theorem55Statement.{0, w}) : Theorem55Statement.{u, w} := by + intro S Shat _ _ _ _ β _ cap χ hS1 hS3 P hbad hor rad n + have := χ.connected + have := cap.connected + obtain ⟨a, b, c, ⟨eS⟩⟩ := classification.{u} S χ.isSurface χ.connected + obtain ⟨a', b', c', ⟨eShat⟩⟩ := classification.{u} Shat cap.isSurface cap.connected + have : T2Space (SurfaceModel a b c) := (isSurface_model a b c).1.2.1 + have : T2Space (SurfaceModel a' b' c') := (isSurface_model a' b' c').1.2.1 + obtain ⟨h, hh⟩ := h0 (SurfaceModel a b c) (SurfaceModel a' b' c') β + (cap.mapHomeo eS eShat) (χ.mapHomeo eS) + (hS1.mapHomeo eShat) (hS3.mapHomeo eS eShat) + (fun i ↦ (P i).mapHomeo eS) (hbad.mapHomeo eS) (hor.mapHomeo eS) + (fun i ↦ (rad i).mapHomeo eS eShat) n + exact ⟨h, fun i hi ↦ (Painting.rep_mapHomeo eS eShat (rad i)) ▸ hh i hi⟩ + +/-- `Theorem41Statement` in universe `0` implies `Theorem41Statement` in any universe `u`. -/ +theorem theorem_4_1_lift (h0 : Theorem41Statement.{0, w}) : Theorem41Statement.{u, w} := by + intro S Shat _ _ β _ cap χ hS1 hS2 hS3 hS4 hobad + have := χ.connected + have := cap.connected + obtain ⟨a, b, c, ⟨eS⟩⟩ := classification.{u} S χ.isSurface χ.connected + obtain ⟨a', b', c', ⟨eShat⟩⟩ := classification.{u} Shat cap.isSurface cap.connected + exact h0 (SurfaceModel a b c) (SurfaceModel a' b' c') β + (cap.mapHomeo eS eShat) (χ.mapHomeo eS) + (hS1.mapHomeo eShat) (hS2.mapHomeo eS eShat) (hS3.mapHomeo eS eShat) (hS4.mapHomeo eS) + (hobad.mapHomeo eS) + +end ConditionsAndLifts + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM19/Winding.lean b/LeanPool/GraphMinor/GM19/Winding.lean new file mode 100644 index 0000000000..de7a66f173 --- /dev/null +++ b/LeanPool/GraphMinor/GM19/Winding.lean @@ -0,0 +1,322 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM19.CircleLift + +/-! +# Winding of plane curves + +We measure how far a curve in the punctured plane turns around the origin, as the change of a +continuous angle along the curve. No part of +Mathlib gives this for curves that are only continuous, and the orientation of the plane in +`GM19/PlaneOrientation.lean` needs it. + +Three facts carry the weight. A loop near a loop turns as far (`turn_eq_of_near`), so the turning of +a loop does not change along a +homotopy (`turn_eq_of_homotopy`). A loop far from the point does not turn (`turn_eq_zero_of_far`). +And two arcs with the same ends turn +equally around a point that can be joined to a far point without meeting them (`turn_eq_of_path`). +-/ + +@[expose] public section + +namespace GraphMinor.GM19 + +open Set Metric Topology Filter + +/-- `L` is a continuous angle of the curve `g`. -/ +def IsAngle (g : ℝ → ℂ) (L : ℝ → ℝ) : Prop := + Continuous L ∧ ∀ t, g t = ‖g t‖ * Complex.exp (L t * Complex.I) + +theorem exists_isAngle {g : ℝ → ℂ} (hg : Continuous g) (h0 : ∀ t, g t ≠ 0) : ∃ L, IsAngle g L := by + have hn : ∀ t, ‖g t‖ ≠ 0 := fun t => norm_ne_zero_iff.mpr (h0 t) + let f : ℝ → Circle := fun t => ⟨((‖g t‖ : ℝ) : ℂ)⁻¹ * g t, by + rw [Submonoid.unitSphere, Submonoid.mem_mk, Subsemigroup.mem_mk] + change _ ∈ sphere (0 : ℂ) 1 + rw [mem_sphere_zero_iff_norm, norm_mul, norm_inv, Complex.norm_real, norm_norm, + inv_mul_cancel₀ (hn t)]⟩ + have hf : Continuous f := by + refine continuous_induced_rng.mpr ?_ + change Continuous fun t => ((‖g t‖ : ℝ) : ℂ)⁻¹ * g t + exact (Continuous.inv₀ (Complex.continuous_ofReal.comp hg.norm) fun t + => Complex.ofReal_ne_zero.mpr (hn t)).mul hg + obtain ⟨L, hL, hl⟩ := exists_circle_lift_map ⟨f, hf⟩ + refine ⟨L, hL, fun t => ?_⟩ + have h1 := congrArg (fun c : Circle => (c : ℂ)) (hl t) + simp only [Circle.coe_exp, ContinuousMap.coe_mk] at h1 + rw [h1] + change g t = _ * (((‖g t‖ : ℝ) : ℂ)⁻¹ * g t) + rw [← mul_assoc, mul_inv_cancel₀ (Complex.ofReal_ne_zero.mpr (hn t)), one_mul] + +theorem IsAngle.exp_eq {g : ℝ → ℂ} {L M : ℝ → ℝ} (hL : IsAngle g L) (hM : IsAngle g M) + (h0 : ∀ t, g t ≠ 0) (t : ℝ) : + Circle.exp (L t) = Circle.exp (M t) := by + apply Circle.ext + rw [Circle.coe_exp, Circle.coe_exp] + have hn : ((‖g t‖ : ℝ) : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr (norm_ne_zero_iff.mpr (h0 t)) + exact mul_left_cancel₀ hn ((hL.2 t).symm.trans (hM.2 t)) + +theorem IsAngle.diff {g : ℝ → ℂ} {L M : ℝ → ℝ} (hL : IsAngle g L) (hM : IsAngle g M) + (h0 : ∀ t, g t ≠ 0) (s t : ℝ) : + L t - L s = M t - M s := by + have := lift_diff_const hL.1 hM.1 (hL.exp_eq hM h0) s t + linarith + +/-- How far the curve `g` turns from time `s` to time `t`. -/ +noncomputable def turn (g : ℝ → ℂ) (s t : ℝ) : ℝ := + open Classical in if h : ∃ L, IsAngle g L then h.choose t - h.choose s else 0 + +theorem IsAngle.turn_eq {g : ℝ → ℂ} {L : ℝ → ℝ} (hL : IsAngle g L) (h0 : ∀ t, g t ≠ 0) (s t : ℝ) : + turn g s t = L t - L s := by + have h : ∃ L, IsAngle g L := ⟨L, hL⟩ + rw [turn, dite_eq_left h] + exact h.choose_spec.diff hL h0 s t + +theorem IsAngle.comp {g : ℝ → ℂ} {L f : ℝ → ℝ} (hL : IsAngle g L) (hf : Continuous f) : IsAngle + (fun t => g (f t)) fun t => L (f t) := + ⟨hL.1.comp hf, fun t => hL.2 (f t)⟩ + +theorem IsAngle.mul {g k : ℝ → ℂ} {L M : ℝ → ℝ} (hL : IsAngle g L) (hM : IsAngle k M) : + IsAngle (fun t => g t * k t) fun t => L t + M t := by + refine ⟨hL.1.add hM.1, fun t => ?_⟩ + change g t * k t = ((‖g t * k t‖ : ℝ) : ℂ) * Complex.exp (((L t + M t : ℝ) : ℂ) * Complex.I) + rw [norm_mul, Complex.ofReal_mul, Complex.ofReal_add, add_mul, Complex.exp_add] + conv_lhs => rw [hL.2 t, hM.2 t] + ring + +theorem isAngle_const {c : ℂ} (_hc : c ≠ 0) : ∃ α : ℝ, IsAngle (fun _ => c) fun _ => α := + ⟨Complex.arg c, continuous_const, fun _ => (Complex.norm_mul_exp_arg_mul_I c).symm⟩ + +theorem turn_comp {g : ℝ → ℂ} (hg : Continuous g) (h0 : ∀ t, g t ≠ 0) {f : ℝ → ℝ} + (hf : Continuous f) (s t : ℝ) : + turn (fun x => g (f x)) s t = turn g (f s) (f t) := by + obtain ⟨L, hL⟩ := exists_isAngle hg h0 + rw [(hL.comp hf).turn_eq (fun x => h0 _), hL.turn_eq h0] + +theorem turn_add {g : ℝ → ℂ} (hg : Continuous g) (h0 : ∀ t, g t ≠ 0) (s t u : ℝ) : turn g s t + + turn g t u = turn g s u := by + obtain ⟨L, hL⟩ := exists_isAngle hg h0 + rw [hL.turn_eq h0, hL.turn_eq h0, hL.turn_eq h0] + ring + +theorem turn_self {g : ℝ → ℂ} (hg : Continuous g) (h0 : ∀ t, g t ≠ 0) (s : ℝ) : turn g s s = 0 := by + obtain ⟨L, hL⟩ := exists_isAngle hg h0 + rw [hL.turn_eq h0, sub_self] + +/-- A loop turns through a multiple of `2π`. -/ +theorem exists_turn_eq_mul {g : ℝ → ℂ} (hg : Continuous g) (h0 : ∀ t, g t ≠ 0) {s t : ℝ} (hst : g s + = g t) : + ∃ m : ℤ, turn g s t = m * (2 * Real.pi) := by + obtain ⟨L, hL⟩ := exists_isAngle hg h0 + have hn : ((‖g s‖ : ℝ) : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr (norm_ne_zero_iff.mpr (h0 s)) + have h1 : Circle.exp (L s) = Circle.exp (L t) := by + apply Circle.ext + rw [Circle.coe_exp, Circle.coe_exp] + have h2 := hL.2 s + have h3 := hL.2 t + rw [← hst] at h3 + exact mul_left_cancel₀ hn (h2.symm.trans h3) + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h1 + refine ⟨-m, ?_⟩ + rw [hL.turn_eq h0, hm] + push_cast + ring + +/-- A loop near a loop turns as far. -/ +theorem turn_eq_of_near {g k : ℝ → ℂ} (hg : Continuous g) (hk : Continuous k) (h0 : ∀ t, g t ≠ 0) + (hn : ∀ t, ‖k t - g t‖ < ‖g t‖) + {s t : ℝ} (hgs : g s = g t) (hks : k s = k t) : turn k s t = turn g s t := by + have h0k : ∀ t, k t ≠ 0 := fun t ht => by + have := hn t + rw [ht, zero_sub, norm_neg] at this + exact lt_irrefl _ this + let r : ℝ → ℂ := fun t => k t / g t + have hr : Continuous r := hk.div hg h0 + have hre : ∀ t, r t ∈ Complex.slitPlane := fun t => by + left + have h1 : ‖r t - 1‖ < 1 := by + have : r t - 1 = (k t - g t) / g t := by + simp only [r] + field_simp [h0 t] + rw [this, norm_div, div_lt_one (norm_pos_iff.mpr (h0 t))] + exact hn t + have h2 := Complex.abs_re_le_norm (r t - 1) + have h3 := abs_lt.mp (lt_of_le_of_lt h2 h1) + simp only [Complex.sub_re, Complex.one_re] at h3 + linarith [h3.1] + have ha : IsAngle r fun t => Complex.arg (r t) := + ⟨continuous_iff_continuousAt.mpr fun t => (Complex.continuousAt_arg + (hre t)).comp hr.continuousAt, + fun t => (Complex.norm_mul_exp_arg_mul_I (r t)).symm⟩ + obtain ⟨L, hL⟩ := exists_isAngle hg h0 + have hm := hL.mul ha + have he : (fun t => g t * r t) = k := by + funext t + simp only [r] + field_simp [h0 t] + rw [he] at hm + rw [hm.turn_eq h0k, hL.turn_eq h0] + have : r s = r t := by simp only [r, hgs, hks] + rw [this] + ring + +/-- A loop far from the origin does not turn around the point `p`. -/ +theorem turn_eq_zero_of_far {d : ℝ → ℂ} (hd : Continuous d) {p : ℂ} (hb : ∀ t, ‖d t‖ < ‖p‖) {s t : + ℝ} (hst : d s = d t) : + turn (fun x => d x - p) s t = 0 := by + have hp : -p ≠ 0 := neg_ne_zero.mpr fun h => by + have := hb 0 + rw [h, norm_zero] at this + exact absurd this (not_lt.mpr (norm_nonneg _)) + obtain ⟨α, hα⟩ := isAngle_const hp + have h1 := turn_eq_of_near (g := fun _ => -p) (k := fun x => d x - p) continuous_const + (hd.sub continuous_const) (fun _ => hp) + (fun t => by + have : d t - p - -p = d t := by ring + rw [this, norm_neg] + exact hb t) (s := s) (t := t) rfl (by simp only [hst]) + rw [h1, hα.turn_eq (fun _ => hp), sub_self] + +/-- The turning of a loop does not change along a homotopy. The compact set `K` of times sees all +values of each loop. -/ +theorem turn_eq_of_homotopy {H : ℝ → ℝ → ℂ} (hH : Continuous fun q : ℝ × ℝ => H q.1 q.2) + (h0 : ∀ u t, H u t ≠ 0) {K : Set ℝ} (hK : IsCompact K) + (hv : ∀ t, ∃ t' ∈ K, ∀ u, H u t = H u t') {s t : ℝ} (hl : ∀ u, H u s = H u t) (a b : ℝ) : turn + (H a) s t = turn (H b) s t := by + have hcts : ∀ u, Continuous (H u) := fun u => hH.comp (Continuous.prodMk_right u) + have hloc : IsLocallyConstant fun u => turn (H u) s t := by + refine (IsLocallyConstant.iff_eventually_eq _).mpr fun u₀ => ?_ + by_cases hne : K.Nonempty + swap + · refine Filter.Eventually.of_forall fun u => ?_ + obtain ⟨t', ht', -⟩ := hv 0 + exact absurd ⟨t', ht'⟩ hne + obtain ⟨t₀, ht₀, hmin⟩ := hK.exists_isMinOn hne (hcts u₀).norm.continuousOn + have hδ : 0 < ‖H u₀ t₀‖ := norm_pos_iff.mpr (h0 _ _) + have hev : ∀ᶠ u in 𝓝 u₀, ∀ t' ∈ K, ‖H u t' - H u₀ t'‖ < ‖H u₀ t₀‖ := by + refine hK.eventually_forall_of_forall_eventually fun t' _ => ?_ + have hc : Continuous fun q : ℝ × ℝ => ‖H q.1 q.2 - H u₀ q.2‖ := (hH.sub + ((hcts u₀).comp continuous_snd)).norm + have h1 : Tendsto (fun q : ℝ × ℝ => ‖H q.1 q.2 - H u₀ q.2‖) (𝓝 (u₀, t')) + (𝓝 ‖H u₀ t' - H u₀ t'‖) := hc.tendsto (u₀, t') + rw [sub_self, norm_zero] at h1 + exact h1.eventually (gt_mem_nhds hδ) + filter_upwards [hev] with u hu + refine turn_eq_of_near (hcts u₀) (hcts u) (h0 u₀) (fun y => ?_) (hl u₀) (hl u) + obtain ⟨t', ht', e⟩ := hv y + rw [e u, e u₀] + exact lt_of_lt_of_le (hu t' ht') (hmin ht') + exact hloc.apply_eq_of_preconnectedSpace a b + +/-- Two arcs with the same ends turn equally around `p 0`, when the path `p` runs from `p 0` to a +far point without meeting the arcs. -/ +theorem turn_eq_of_path {g k : ℝ → ℂ} (hg : Continuous g) (hk : Continuous k) {a b c d : ℝ} + (hab : a ≤ b) (hcd : c ≤ d) (hs : g a = k c) (he : g b = k d) + {p : ℝ → ℂ} (hp : Continuous p) (hg0 : ∀ t, g t ≠ p 0) (hk0 : ∀ t, k t ≠ p 0) + (hgp : ∀ u, ∀ t ∈ Icc a b, g t ≠ p u) (hkp : ∀ u, ∀ t ∈ Icc c d, k t ≠ p u) + (hgf : ∀ t ∈ Icc a b, ‖g t‖ < ‖p 1‖) (hkf : ∀ t ∈ Icc c d, ‖k t‖ < ‖p 1‖) : + turn (fun t => g t - p 0) a b = turn (fun t => k t - p 0) c d := by + have hc01 : ∀ x : ℝ, max 0 (min x 1) ∈ Icc (0 : ℝ) 1 := fun x => ⟨le_max_left _ _, max_le + zero_le_one (min_le_right _ _)⟩ + let c₁ : ℝ → ℝ := fun x => a + (b - a) * max 0 (min x 1) + let c₂ : ℝ → ℝ := fun x => d - (d - c) * max 0 (min (x - 1) 1) + have hc₁ : Continuous c₁ := by fun_prop + have hc₂ : Continuous c₂ := by fun_prop + have hm₁ : ∀ x, c₁ x ∈ Icc a b := fun x => by + obtain ⟨h1, h2⟩ := hc01 x + refine ⟨by nlinarith [mul_nonneg (sub_nonneg.mpr hab) h1], ?_⟩ + simp only [c₁] + nlinarith [mul_nonneg (sub_nonneg.mpr hab) (sub_nonneg.mpr h2)] + have hm₂ : ∀ x, c₂ x ∈ Icc c d := fun x => by + obtain ⟨h1, h2⟩ := hc01 (x - 1) + refine ⟨?_, ?_⟩ + · simp only [c₂]; nlinarith [mul_nonneg (sub_nonneg.mpr hcd) (sub_nonneg.mpr h2)] + · simp only [c₂]; nlinarith [mul_nonneg (sub_nonneg.mpr hcd) h1] + have hc₁0 : c₁ 0 = a := by simp [c₁] + have hc₁1 : c₁ 1 = b := by simp [c₁] + have hc₂1 : c₂ 1 = d := by simp [c₂] + have hc₂2 : c₂ 2 = c := by + have : (2 : ℝ) - 1 = 1 := by norm_num + simp [c₂, this] + let D : ℝ → ℂ := fun x => if x ≤ 1 then g (c₁ x) else k (c₂ x) + have hD : Continuous D := Continuous.if_le (hg.comp hc₁) (hk.comp hc₂) continuous_id + continuous_const fun x hx => by + subst hx + show g (c₁ 1) = k (c₂ 1) + rw [hc₁1, hc₂1, he] + have hDle : ∀ {x : ℝ}, x ≤ 1 → D x = g (c₁ x) := fun h => ite_eq_left h + have hDge : ∀ {x : ℝ}, 1 ≤ x → D x = k (c₂ x) := fun {x} h => by + rcases h.eq_or_lt with h | h + · subst h + rw [hDle le_rfl, hc₁1, hc₂1, he] + · exact ite_eq_right (not_le.mpr h) + have hD02 : D 0 = D 2 := by + rw [hDle zero_le_one, hDge one_le_two, hc₁0, hc₂2, hs] + have hDp : ∀ u x, D x ≠ p u := fun u x => by + rcases le_total x 1 with h | h + · rw [hDle h]; exact hgp u _ (hm₁ x) + · rw [hDge h]; exact hkp u _ (hm₂ x) + have hDf : ∀ x, ‖D x‖ < ‖p 1‖ := fun x => by + rcases le_total x 1 with h | h + · rw [hDle h]; exact hgf _ (hm₁ x) + · rw [hDge h]; exact hkf _ (hm₂ x) + have hclamp : ∀ x, ∃ x' ∈ Icc (0 : ℝ) 2, ∀ u, D x - p u = D x' - p u := fun x => by + rcases le_total x 0 with h0 | h0 + · refine ⟨0, ⟨le_rfl, zero_le_two⟩, fun u => ?_⟩ + rw [hDle (h0.trans zero_le_one), hDle zero_le_one, hc₁0] + have : c₁ x = a := by simp [c₁, min_eq_left (h0.trans zero_le_one), max_eq_left h0] + rw [this] + rcases le_total x 2 with h2 | h2 + · exact ⟨x, ⟨h0, h2⟩, fun _ => rfl⟩ + · refine ⟨2, ⟨zero_le_two, le_rfl⟩, fun u => ?_⟩ + rw [hDge (one_le_two.trans h2), hDge one_le_two, hc₂2] + have h3 : (1 : ℝ) ≤ x - 1 := by linarith + have : c₂ x = c := by simp [c₂, min_eq_right h3] + rw [this] + have h0H : ∀ u x, D x - p u ≠ 0 := fun u x => sub_ne_zero.mpr (hDp u x) + have hcH : Continuous fun q : ℝ × ℝ => D q.2 - p q.1 := (hD.comp continuous_snd).sub + (hp.comp continuous_fst) + have hhom : turn (fun x => D x - p 0) 0 2 = turn (fun x => D x - p 1) 0 2 := + turn_eq_of_homotopy (H := fun u x => D x - p u) hcH h0H isCompact_Icc hclamp (s := 0) (t := 2) + (fun u => by rw [hD02]) 0 1 + rw [turn_eq_zero_of_far hD hDf hD02] at hhom + have hgc : Continuous fun t => g t - p 0 := hg.sub continuous_const + have hkc : Continuous fun t => k t - p 0 := hk.sub continuous_const + have hg0' : ∀ t, g t - p 0 ≠ 0 := fun t => sub_ne_zero.mpr (hg0 t) + have hk0' : ∀ t, k t - p 0 ≠ 0 := fun t => sub_ne_zero.mpr (hk0 t) + obtain ⟨L, hL⟩ := exists_isAngle (g := fun x => D x - p 0) (hD.sub continuous_const) (h0H 0) + obtain ⟨L₁, hL₁⟩ := exists_isAngle (g := fun t => g t - p 0) hgc hg0' + obtain ⟨L₂, hL₂⟩ := exists_isAngle (g := fun t => k t - p 0) hkc hk0' + rw [hL.turn_eq (h0H 0)] at hhom + rw [hL₁.turn_eq hg0', hL₂.turn_eq hk0'] + have hpi : 0 < 2 * Real.pi := by positivity + have hmult : ∀ {f f' : ℝ → ℂ} {A A' : ℝ → ℝ}, IsAngle f A → IsAngle f' A' → ∀ t t', f t = f' t' + → f t ≠ 0 → ∃ m : ℤ, A t - A' t' = m * (2 * Real.pi) := by + intro f f' A A' hA hA' t t' he hne + have hn : ((‖f t‖ : ℝ) : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr (norm_ne_zero_iff.mpr hne) + have h1 : Circle.exp (A t) = Circle.exp (A' t') := by + apply Circle.ext + rw [Circle.coe_exp, Circle.coe_exp] + have h2 := hA.2 t + have h3 := hA'.2 t' + rw [← he] at h3 + exact mul_left_cancel₀ hn (h2.symm.trans h3) + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h1 + exact ⟨m, by rw [hm]; ring⟩ + have e1 := eq_of_multiples (g := fun t => L t - L₁ (c₁ t)) hpi zero_le_one (hL.1.sub + (hL₁.1.comp hc₁)).continuousOn fun t ht => + hmult hL hL₁ t (c₁ t) (by rw [hDle ht.2]) (h0H 0 t) + have e2 := eq_of_multiples (g := fun t => L t - L₂ (c₂ t)) hpi one_le_two (hL.1.sub + (hL₂.1.comp hc₂)).continuousOn fun t ht => + hmult hL hL₂ t (c₂ t) (by rw [hDge ht.1]) (h0H 0 t) + simp only [hc₁0, hc₁1, hc₂1, hc₂2] at e1 e2 + linarith + +end GraphMinor.GM19 diff --git a/LeanPool/GraphMinor/GM20/Assembled.lean b/LeanPool/GraphMinor/GM20/Assembled.lean new file mode 100644 index 0000000000..2b90230435 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Assembled.lean @@ -0,0 +1,69 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM07.Section9 +public import LeanPool.GraphMinor.GM09.Bridge +public import LeanPool.GraphMinor.GM12.Bridge +public import LeanPool.GraphMinor.GM12.Section5Final +public import LeanPool.GraphMinor.GM12.Section6 +public import LeanPool.GraphMinor.GM12.Section710 +public import LeanPool.GraphMinor.GM14.Bridge +public import LeanPool.GraphMinor.GM14.Section8Core +public import LeanPool.GraphMinor.GM12.Section75Proof +public import LeanPool.GraphMinor.GM15.Section3Parallel +public import LeanPool.GraphMinor.GM16.MainProof +public import LeanPool.GraphMinor.GM16.Section4Proof +public import LeanPool.GraphMinor.GM16.Section5Five +public import LeanPool.GraphMinor.GM16.Theorem35Bridge +public import LeanPool.GraphMinor.GM17.PushNode +public import LeanPool.GraphMinor.GM17.RegionBoundary +public import LeanPool.GraphMinor.GM17.RegionDisc +public import LeanPool.GraphMinor.GM19.FragmentSimpler +public import LeanPool.GraphMinor.GM19.Section14ah +public import LeanPool.GraphMinor.GM19.Section15b +public import LeanPool.GraphMinor.GM19.Section15q +public import LeanPool.GraphMinor.GM19.Section6Two +public import LeanPool.GraphMinor.GM20.Main + +import LeanPool.GraphMinor.GM16.InductionsProved + +import LeanPool.GraphMinor.GM17.Section8Proved + +import LeanPool.GraphMinor.GM19.Section2Proved + +import LeanPool.GraphMinor.GM19.Section5oProved + +import LeanPool.GraphMinor.GM19.Section6aProved + +/-! +# The graph minor theorem, assembled + +`GM20.graph_minor_theorem_assembled` proves that in every infinite sequence of finite multigraphs, +an earlier graph is isomorphic to a minor of a later one. The proof discharges the statements used +from the preceding papers, including the dependence of Graph Minors XX on XVII and XIX. + +The preceding results are assembled at universe level `0`. The final theorem holds for vertex and +edge types at arbitrary universe levels. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Graph + +/-- **The graph minor theorem** for a sequence of finite multigraphs. +This is the undirected consequence of (10.5) in Graph Minors XX. -/ +theorem graph_minor_theorem_assembled + {α β : Type*} (G : ℕ → Graph α β) (hV : ∀ n, V(G n).Finite) (hE : ∀ n, E(G n).Finite) : + ∃ i j, i < j ∧ IsIsoMinor (G i) (G j) := by + exact graph_minor_theorem_of_cited G hV hE + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Bag.lean b/LeanPool/GraphMinor/GM20/Bag.lean new file mode 100644 index 0000000000..9ef0d7dc0d --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Bag.lean @@ -0,0 +1,107 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Codes +import LeanPool.GraphMinor.GM04.Higman + +/-! +# Bags of labelled edges + +The proof of (4.10) of Graph Minors XX labels an edge of a condensation with a small patchwork, all +of +whose vertices are roots. For such a patchwork only the following matters: for each of the finitely +many codes of edges, the list of labels of the edges with that code. That data is a `Bag`. By +Higman's +lemma bags are well-quasi-ordered (`wqo_bag`), and two comparable bags give an injection of the +edges +which keeps codes and does not lower labels (`exists_edgeMap`). +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- For each code, a list of labels. -/ +def Bag (Ω : Type*) (k : ℕ) := EdgeCode k → List Ω + +instance {Ω : Type*} [Preorder Ω] (k : ℕ) : Preorder (Bag Ω k) where + le f g := ∀ c, List.SublistForall₂ (· ≤ ·) (f c) (g c) + le_refl f c := refl_of (List.SublistForall₂ (· ≤ ·)) (f c) + le_trans _ _ _ hfg hgh c := _root_.trans (hfg c) (hgh c) + +/-- Bags are well-quasi-ordered, by Higman's lemma for each of the finitely many codes. -/ +theorem wqo_bag {Ω : Type*} [Preorder Ω] (hΩ : WellQuasiOrderedLE Ω) (k : ℕ) : + WellQuasiOrderedLE (Bag Ω k) := by + have hU : (univ : Set Ω).PartiallyWellOrderedOn (· ≤ ·) := fun f ↦ hΩ.wqo fun i ↦ (f i).1 + have hL := hU.partiallyWellOrderedOn_sublistForall₂ + have hp : IsPreorder (List Ω) (List.SublistForall₂ (· ≤ ·)) := ⟨⟩ + have hl : WellQuasiOrdered (List.SublistForall₂ (· ≤ ·) : List Ω → List Ω → Prop) := by + intro f + obtain ⟨m, n, hmn, h⟩ := hL fun i ↦ ⟨f i, fun _ _ ↦ mem_univ _⟩ + exact ⟨m, n, hmn, h⟩ + exact ⟨WellQuasiOrdered.pi (r := fun _ : EdgeCode k ↦ List.SublistForall₂ (· ≤ ·)) fun _ ↦ hl⟩ + +/-- A sublist relation between duplicate-free lists gives an injection between them. -/ +theorem exists_inj_of_sublistForall₂ {κ Ω : Type*} {r : Ω → Ω → Prop} {l₁ l₂ : List κ} + {ℓ₁ ℓ₂ : κ → Ω} (hnd₁ : l₁.Nodup) (hnd₂ : l₂.Nodup) + (h : List.SublistForall₂ (fun x y ↦ r (ℓ₁ x) (ℓ₂ y)) l₁ l₂) : + ∃ g : κ → κ, (∀ x ∈ l₁, ∀ y ∈ l₁, g x = g y → x = y) ∧ + (∀ x ∈ l₁, g x ∈ l₂) ∧ (∀ x ∈ l₁, r (ℓ₁ x) (ℓ₂ (g x))) := + GM04.exists_inj_of_sublistForall₂ hnd₁ hnd₂ h + +variable {Ω : Type*} + +open Classical in +/-- The edges of `R` with code `c`, in some order. -/ +noncomputable def edgesOfCode (k : ℕ) (R : Patchwork Ω α β) (c : EdgeCode k) : List β := + (R.G.edgeSet_finite.toFinset.filter fun e ↦ edgeCode k R.G.roots R e = c).toList + +theorem mem_edgesOfCode {k : ℕ} {R : Patchwork Ω α β} {c : EdgeCode k} {e : β} : + e ∈ edgesOfCode k R c ↔ e ∈ R.G.edgeSet ∧ edgeCode k R.G.roots R e = c := by + classical + simp [edgesOfCode] + +/-- The bag of a patchwork. -/ +noncomputable def bag (k : ℕ) (R : Patchwork Ω α β) : Bag Ω k := + fun c ↦ (edgesOfCode k R c).map R.φ + +/-- Comparable bags give an injection of the edges that keeps codes and does not lower labels. -/ +theorem exists_edgeMap [Preorder Ω] {k : ℕ} {R R' : Patchwork Ω α β} (h : bag k R ≤ bag k R') : + ∃ g : β → β, InjOn g R.G.edgeSet ∧ MapsTo g R.G.edgeSet R'.G.edgeSet ∧ + ∀ f ∈ R.G.edgeSet, R.φ f ≤ R'.φ (g f) ∧ + edgeCode k R.G.roots R f = edgeCode k R'.G.roots R' (g f) := by + classical + have hc : ∀ c, _ := fun c ↦ by + have hsub : List.SublistForall₂ (· ≤ ·) (bag k R c) (bag k R' c) := h c + simp only [bag, List.sublistForall₂_map_left_iff, List.sublistForall₂_map_right_iff] at hsub + exact exists_inj_of_sublistForall₂ (Finset.nodup_toList _) (Finset.nodup_toList _) hsub + choose G hinj hmem hle using hc + have hself : ∀ f ∈ R.G.edgeSet, f ∈ edgesOfCode k R (edgeCode k R.G.roots R f) := fun f hf ↦ + mem_edgesOfCode.mpr ⟨hf, rfl⟩ + have hcode : ∀ f ∈ R.G.edgeSet, + edgeCode k R'.G.roots R' (G (edgeCode k R.G.roots R f) f) = edgeCode k R.G.roots R f := + fun f hf ↦ (mem_edgesOfCode.mp (hmem _ f (hself f hf))).2 + refine ⟨fun f ↦ G (edgeCode k R.G.roots R f) f, ?_, ?_, ?_⟩ + · intro f₁ h₁ f₂ h₂ heq + have heq' : G (edgeCode k R.G.roots R f₁) f₁ = G (edgeCode k R.G.roots R f₂) f₂ := heq + have hcc : edgeCode k R.G.roots R f₁ = edgeCode k R.G.roots R f₂ := by + rw [← hcode f₁ h₁, ← hcode f₂ h₂, heq'] + rw [hcc] at heq' + exact hinj _ f₁ (hcc ▸ hself f₁ h₁) f₂ (hself f₂ h₂) heq' + · exact fun f hf ↦ (mem_edgesOfCode.mp (hmem _ f (hself f hf))).1 + · exact fun f hf ↦ ⟨hle _ f (hself f hf), (hcode f hf).symm⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Basic.lean b/LeanPool/GraphMinor/GM20/Basic.lean new file mode 100644 index 0000000000..710626b9b6 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Basic.lean @@ -0,0 +1,310 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section2 +public import LeanPool.GraphMinor.GM04.Patchwork.Expansion + +/-! +# Tools for the sets of patchworks of Graph Minors XX + +The paper changes one part of a patchwork at a time and keeps the rest. This file provides the +matching tools: +- `Patchwork.IsRealization.congr`: a realization depends only on `V(G)`, `E(G)` and `Δ`. +- `SameBase P Q`: `P` and `Q` have the same hypergraph, and the same `dom(μ)`, `μ` and `Δ`. +- `Patchwork.relabel`: the same patchwork with new labels `φ`. +- `Patchwork.reroot`: the same patchwork with a new march of roots. +- `realizable_transfer`: a realizable expansion stays one when the roots and labels of + the two patchworks change, if the conditions on roots and labels still hold. +- `completions`, and `wellBehaved_of_encoding`, the form of (4.2) used in the proofs. +- `Discrete`, a set ordered by equality, and `wqo_disjointUnion`, that `Ω₁ ∪ Ω₂` is a + well-quasi-order. +- `WellBehaved.union`: the union of two well-behaved sets is well-behaved. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v w + +variable {α : Type u} {β : Type v} {Ω Ω' Ω₁ Ω₂ : Type*} + +/-- `P` and `Q` have the same hypergraph, and the same `dom(μ)`, `μ` and `Δ`: they differ at most in +their roots and labels. -/ +structure SameBase (P : Patchwork Ω α β) (Q : Patchwork Ω' α β) : Prop where + hyper : Q.G.toHypergraph = P.G.toHypergraph + dom_eq : Q.dom = P.dom + μ_eq : ∀ ⦃e⦄, e ∈ P.dom → Q.μ e = P.μ e + Δ_eq : ∀ ⦃e⦄, e ∈ P.G.edgeSet → Q.Δ e = P.Δ e + +theorem SameBase.refl (P : Patchwork Ω α β) : SameBase P P := ⟨rfl, rfl, fun _ _ ↦ rfl, fun _ _ ↦ + rfl⟩ + +theorem SameBase.vertexSet_eq {P : Patchwork Ω α β} {Q : Patchwork Ω' α β} (h : SameBase P Q) : + Q.G.vertexSet = P.G.vertexSet := congrArg Hypergraph.vertexSet h.hyper + +theorem SameBase.edgeSet_eq {P : Patchwork Ω α β} {Q : Patchwork Ω' α β} (h : SameBase P Q) : + Q.G.edgeSet = P.G.edgeSet := congrArg Hypergraph.edgeSet h.hyper + +theorem SameBase.inc_eq {P : Patchwork Ω α β} {Q : Patchwork Ω' α β} (h : SameBase P Q) : + Q.G.Inc = P.G.Inc := congrArg Hypergraph.Inc h.hyper + +theorem SameBase.symm {P : Patchwork Ω α β} {Q : Patchwork Ω' α β} (h : SameBase P Q) : + SameBase Q P where + hyper := h.hyper.symm + dom_eq := h.dom_eq.symm + μ_eq _ he := (h.μ_eq (h.dom_eq ▸ he)).symm + Δ_eq _ he := (h.Δ_eq (h.edgeSet_eq ▸ he)).symm + +theorem SameBase.trans {P : Patchwork Ω α β} {Q : Patchwork Ω' α β} {R : Patchwork Ω₁ α β} + (h : SameBase P Q) (h' : SameBase Q R) : SameBase P R where + hyper := h'.hyper.trans h.hyper + dom_eq := h'.dom_eq.trans h.dom_eq + μ_eq _ he := (h'.μ_eq (h.dom_eq ▸ he)).trans (h.μ_eq he) + Δ_eq _ he := (h'.Δ_eq (h.edgeSet_eq ▸ he)).trans (h.Δ_eq he) + +theorem IsCompletionOf.sameBase {P : Patchwork Ω α β} {Q : Patchwork Ω' α β} + (h : IsCompletionOf P Q) : SameBase P Q := + ⟨congrArg RootedHypergraph.toHypergraph h.G_eq, h.dom_eq, h.μ_eq, h.Δ_eq⟩ + +/-- The patchwork `P` with labels `φ`. -/ +def _root_.GraphMinor.GM04.Patchwork.relabel (P : Patchwork Ω α β) (φ : β → Ω') : + Patchwork Ω' α β where + G := P.G + dom := P.dom + μ := P.μ + Δ := P.Δ + φ := φ + dom_subset := P.dom_subset + μ_nodup := P.μ_nodup + μ_set := P.μ_set + Δ_verts := P.Δ_verts + Δ_free := P.Δ_free + +theorem isCompletionOf_relabel (P : Patchwork Ω α β) (φ : β → Ω') : + IsCompletionOf P (P.relabel φ) := + ⟨rfl, rfl, fun _ _ ↦ rfl, fun _ _ ↦ rfl⟩ + +/-- The rooted hypergraph `G` with roots the march `r`. -/ +def _root_.GraphMinor.RootedHypergraph.reroot (G : RootedHypergraph α β) (r : List α) + (hr : r.Nodup) (hs : ∀ v ∈ r, v ∈ G.vertexSet) : RootedHypergraph α β where + toHypergraph := G.toHypergraph + roots := r + roots_nodup := hr + roots_subset := hs + +/-- The patchwork `P` with roots the march `r`. -/ +def _root_.GraphMinor.GM04.Patchwork.reroot (P : Patchwork Ω α β) (r : List α) (hr : r.Nodup) + (hs : ∀ v ∈ r, v ∈ P.G.vertexSet) : Patchwork Ω α β where + G := P.G.reroot r hr hs + dom := P.dom + μ := P.μ + Δ := P.Δ + φ := P.φ + dom_subset := P.dom_subset + μ_nodup := P.μ_nodup + μ_set := P.μ_set + Δ_verts := P.Δ_verts + Δ_free := P.Δ_free + +theorem _root_.GraphMinor.GM04.Patchwork.IsRealization.congr {P : Patchwork Ω α β} + {Q : Patchwork Ω' α β} {H : (⊤ : SimpleGraph α).Subgraph} (hH : P.IsRealization H) + (hV : Q.G.vertexSet = P.G.vertexSet) (hE : Q.G.edgeSet = P.G.edgeSet) + (hΔ : ∀ e ∈ P.G.edgeSet, Q.Δ e = P.Δ e) : Q.IsRealization H := by + obtain ⟨δ, hδ, rfl⟩ := hH + refine ⟨δ, fun e he ↦ ?_, ?_⟩ + · rw [hE] at he + change δ e ∈ (Q.Δ e).groupings + rw [hΔ e he] + exact hδ e he + · simp only [realizationOf, hV, hE] + +theorem SameBase.realization {P : Patchwork Ω α β} {Q : Patchwork Ω' α β} (h : SameBase P Q) + (F : Set β) {H : (⊤ : SimpleGraph α).Subgraph} (hH : (P.deleteEdges F).IsRealization H) : + (Q.deleteEdges F).IsRealization H := by + obtain ⟨δ, hδ, rfl⟩ := hH + refine ⟨δ, fun e he ↦ ?_, ?_⟩ + · have he' : e ∈ P.G.edgeSet \ F := by + have : e ∈ Q.G.edgeSet \ F := he + rwa [h.edgeSet_eq] at this + have := hδ e he' + change δ e ∈ Q.Δ e + rw [h.Δ_eq he'.1] + exact this + · have : (Q.deleteEdges F).G.toHypergraph = (P.deleteEdges F).G.toHypergraph := by + change Q.G.toHypergraph.deleteEdges F = P.G.toHypergraph.deleteEdges F + rw [h.hyper] + rw [this] + +/-- A realizable expansion of `P` in `P'` is a realizable expansion of `Q` in `Q'`, if `Q`, `Q'` +differ from `P`, `P'` only in roots and labels, and the conditions on roots and labels hold for +`Q` and `Q'`. -/ +theorem realizable_transfer [Preorder Ω₁] [Preorder Ω₂] + {P P' : Patchwork Ω₁ α β} {Q Q' : Patchwork Ω₂ α β} {ηv : α → Set α} {ηe : β → β} + (h : IsRealizableExpansion P P' ηv ηe) (hP : SameBase P Q) (hP' : SameBase P' Q') + (hφ : ∀ e ∈ Q.G.edgeSet, Q.φ e ≤ Q'.φ (ηe e)) + (hlen : Q.G.roots.length = Q'.G.roots.length) + (hroots : ∀ (i : ℕ) (hi : i < Q.G.roots.length) (hi' : i < Q'.G.roots.length), + Q'.G.roots[i] ∈ ηv Q.G.roots[i]) : + IsRealizableExpansion Q Q' ηv ηe := by + obtain ⟨hη, H, hH, hcomp⟩ := h + have hV := hP.vertexSet_eq + have hE := hP.edgeSet_eq + have hV' := hP'.vertexSet_eq + have hE' := hP'.edgeSet_eq + have hD := hP.dom_eq + have hD' := hP'.dom_eq + have hI := hP.inc_eq + have hI' := hP'.inc_eq + refine ⟨?_, H, ?_, ?_⟩ + · refine + { vertex_nonempty := fun v hv ↦ hη.vertex_nonempty v (hV ▸ hv) + vertex_subset := fun v hv ↦ hV' ▸ hη.vertex_subset v (hV ▸ hv) + edge_mem := fun e he ↦ hE' ▸ hη.edge_mem e (hE ▸ he) + vertex_disjoint := fun v₁ h₁ v₂ h₂ hne ↦ hη.vertex_disjoint v₁ (hV ▸ h₁) v₂ (hV ▸ h₂) hne + edge_injOn := hE ▸ hη.edge_injOn + mem_dom_iff := fun e he ↦ by rw [hD, hD']; exact hη.mem_dom_iff e (hE ▸ he) + ends_nonempty := fun e he hd v hv ↦ by + rw [hI] at hv + simp only [hI'] + exact hη.ends_nonempty e (hE ▸ he) (hD ▸ hd) v hv + μ_length := fun e he ↦ by + have he₁ : e ∈ P.dom := hD ▸ he + have he₂ : ηe e ∈ P'.dom := (hη.mem_dom_iff e (P.dom_subset he₁)).mp he₁ + rw [hP.μ_eq he₁, hP'.μ_eq he₂] + exact hη.μ_length e he₁ + μ_mem := fun e he i hi hi' ↦ by + have he₁ : e ∈ P.dom := hD ▸ he + have he₂ : ηe e ∈ P'.dom := (hη.mem_dom_iff e (P.dom_subset he₁)).mp he₁ + simp only [hP.μ_eq he₁, hP'.μ_eq he₂] at hi hi' ⊢ + exact hη.μ_mem e he₁ i hi hi' + roots_length := hlen + roots_mem := hroots + maps_Δ := fun e he ↦ by + have he₁ : e ∈ P.dom := hD ▸ he + have he₂ : ηe e ∈ P'.dom := (hη.mem_dom_iff e (P.dom_subset he₁)).mp he₁ + rw [hP.μ_eq he₁, hP'.μ_eq he₂, hP.Δ_eq (P.dom_subset he₁), hP'.Δ_eq (P'.dom_subset he₂)] + exact hη.maps_Δ e he₁ + φ_le := hφ } + · rw [hE] + exact hP'.realization _ hH + · intro v hv + exact hcomp v (hV ▸ hv) + +/-- All `Ω`-completions of members of `𝓕`. -/ +def completions (Ω : Type*) (𝓕 : Set (UnlabeledPatchwork α β)) : Set (Patchwork Ω α β) := + {Q | ∃ P ∈ 𝓕, IsCompletionOf P Q} + +/-- Graph Minors XX, (4.2) (page 331), in the form used in the proofs: instead of an encoding `γ` we +have a relation `R`, which lets the choice of `γ(Q)` be made in the proof that `R` is total. -/ +theorem wellBehaved_of_encoding {𝓕₁ 𝓕₂ : Set (UnlabeledPatchwork α β)} (h₁ : WellBehaved 𝓕₁) + (h : ∀ (Ω₂ : Type (max u v)) [Preorder Ω₂], WellQuasiOrderedLE Ω₂ → + ∃ (Ω₁ : Type (max u v)) (_ : Preorder Ω₁) (_ : WellQuasiOrderedLE Ω₁) + (R : Patchwork Ω₂ α β → Patchwork Ω₁ α β → Prop), + (∀ Q ∈ completions Ω₂ 𝓕₂, ∃ Q' ∈ completions Ω₁ 𝓕₁, R Q Q') ∧ + ∀ Q ∈ completions Ω₂ 𝓕₂, ∀ Q' ∈ completions Ω₂ 𝓕₂, ∀ S S', R Q S → R Q' S' → + Simulated S S' → Simulated Q Q') : + WellBehaved 𝓕₂ := by + intro Ω₂ _ hΩ₂ Q hQ + obtain ⟨Ω₁, _, hΩ₁, R, hR, henc⟩ := h Ω₂ hΩ₂ + choose S hS hQS using fun i ↦ hR (Q i) (hQ i) + obtain ⟨i, j, hij, hsim⟩ := h₁ Ω₁ hΩ₁ S hS + exact ⟨i, j, hij, henc _ (hQ i) _ (hQ j) _ _ (hQS i) (hQS j) hsim⟩ + +/-- Graph Minors XX, (4.2) (page 331): "Let $\mathcal{F}_1, \mathcal{F}_2$ be sets of patchworks +where $\mathcal{F}_1$ is +well-behaved. Suppose that for every well-quasi-order $\Omega_2$ there is a well-quasi-order +$\Omega_1$ and an encoding of the set of all $\Omega_2$-completions of members of +$\mathcal{F}_2$ in the set of all $\Omega_1$-completions of members of $\mathcal{F}_1$. Then +$\mathcal{F}_2$ is well-behaved." -/ +theorem theorem_4_2_proof {𝓕₁ 𝓕₂ : Set (UnlabeledPatchwork α β)} (h₁ : WellBehaved 𝓕₁) + (h : ∀ (Ω₂ : Type (max u v)) [Preorder Ω₂], WellQuasiOrderedLE Ω₂ → + ∃ (Ω₁ : Type (max u v)) (_ : Preorder Ω₁) (_ : WellQuasiOrderedLE Ω₁) + (γ : Patchwork Ω₂ α β → Patchwork Ω₁ α β), + IsEncoding (completions Ω₁ 𝓕₁) (completions Ω₂ 𝓕₂) γ) : + WellBehaved 𝓕₂ := by + refine wellBehaved_of_encoding h₁ fun Ω₂ _ hΩ₂ ↦ ?_ + obtain ⟨Ω₁, i₁, i₂, γ, hγ₁, hγ₂⟩ := h Ω₂ hΩ₂ + refine ⟨Ω₁, i₁, i₂, fun Q S ↦ γ Q = S, fun Q hQ ↦ ⟨_, hγ₁ Q hQ, rfl⟩, ?_⟩ + rintro Q hQ Q' hQ' _ _ rfl rfl hsim + exact hγ₂ Q hQ Q' hQ' hsim + +/-- A set ordered by equality, such as the two-element antichain of the proof of (4.1). -/ +def Discrete (X : Type*) := X + +instance {X : Type*} : Preorder (Discrete X) where + le := Eq + le_refl _ := rfl + le_trans _ _ _ := Eq.trans + +theorem wqo_discrete (X : Type*) [Finite X] : WellQuasiOrderedLE (Discrete X) := by + have : Finite (Discrete X) := ‹Finite X› + exact ⟨Finite.wellQuasiOrdered _⟩ + +/-- From a function `ℕ → Prop`, one of the value sets is infinite: either `p` holds infinitely often +or it fails infinitely often. -/ +theorem exists_strictMono_of_or (p q : ℕ → Prop) (h : ∀ n, p n ∨ q n) : + ∃ g : ℕ → ℕ, StrictMono g ∧ ((∀ n, p (g n)) ∨ ∀ n, q (g n)) := by + by_cases hp : ∀ N, ∃ n > N, p n + · obtain ⟨g, hg, hpg⟩ := Nat.exists_strictMono_subsequence hp + exact ⟨g, hg, Or.inl hpg⟩ + · push Not at hp + obtain ⟨N, hN⟩ := hp + obtain ⟨g, hg, hqg⟩ := Nat.exists_strictMono_subsequence (P := q) + fun M ↦ ⟨max M N + 1, by omega, (h _).resolve_left (hN _ (by omega))⟩ + exact ⟨g, hg, Or.inr hqg⟩ + +/-- `Ω₁ ∪ Ω₂` is a well-quasi-order when `Ω₁` and `Ω₂` are. -/ +theorem wqo_disjointUnion {Ω₁ Ω₂ : Type*} [Preorder Ω₁] [Preorder Ω₂] (h₁ : WellQuasiOrderedLE Ω₁) + (h₂ : WellQuasiOrderedLE Ω₂) : WellQuasiOrderedLE (DisjointUnionQuasiOrder Ω₁ Ω₂) := + GM18.wellQuasiOrderedLE_disjointUnion h₁ h₂ + +/-- The union of two well-behaved sets of patchworks is well-behaved (used in the proofs of (4.3) +and +(4.8)). A sequence of completions has a subsequence of completions of members of one of the two. -/ +theorem WellBehaved.union {𝓕₁ 𝓕₂ : Set (UnlabeledPatchwork α β)} (h₁ : WellBehaved 𝓕₁) + (h₂ : WellBehaved 𝓕₂) : WellBehaved (𝓕₁ ∪ 𝓕₂) := by + intro Ω _ hΩ Q hQ + obtain ⟨g, hg, hor⟩ := exists_strictMono_of_or (fun n ↦ ∃ P ∈ 𝓕₁, IsCompletionOf P (Q n)) + (fun n ↦ ∃ P ∈ 𝓕₂, IsCompletionOf P (Q n)) fun n ↦ by + obtain ⟨P, hP | hP, hc⟩ := hQ n + · exact Or.inl ⟨P, hP, hc⟩ + · exact Or.inr ⟨P, hP, hc⟩ + rcases hor with h | h + · obtain ⟨i, j, hij, hs⟩ := h₁ Ω hΩ (fun n ↦ Q (g n)) h + exact ⟨g i, g j, hg hij, hs⟩ + · obtain ⟨i, j, hij, hs⟩ := h₂ Ω hΩ (fun n ↦ Q (g n)) h + exact ⟨g i, g j, hg hij, hs⟩ + +/-- A subset of a well-behaved set is well-behaved. -/ +theorem WellBehaved.mono {𝓕₁ 𝓕₂ : Set (UnlabeledPatchwork α β)} (h₁ : WellBehaved 𝓕₁) + (hs : 𝓕₂ ⊆ 𝓕₁) : WellBehaved 𝓕₂ := fun Ω _ hΩ Q hQ ↦ + h₁ Ω hΩ Q fun i ↦ (hQ i).imp fun _ h ↦ ⟨hs h.1, h.2⟩ + +/-- The union of finitely many well-behaved sets is well-behaved. -/ +theorem WellBehaved.iUnion_lt {𝓕 : ℕ → Set (UnlabeledPatchwork α β)} (n : ℕ) + (h : ∀ i < n, WellBehaved (𝓕 i)) : WellBehaved (⋃ i, ⋃ _ : i < n, 𝓕 i) := by + induction n with + | zero => + intro Ω _ _ Q hQ + obtain ⟨P, hP, _⟩ := hQ 0 + simp at hP + | succ n ih => + refine ((ih fun i hi ↦ h i (Nat.lt_succ_of_lt hi)).union (h n n.lt_succ_self)).mono ?_ + intro P hP + simp only [mem_iUnion, exists_prop] at hP + obtain ⟨i, hi, hP⟩ := hP + rcases Nat.lt_succ_iff_lt_or_eq.mp hi with hi | rfl + · exact Or.inl (by simp only [mem_iUnion, exists_prop]; exact ⟨i, hi, hP⟩) + · exact Or.inr hP + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Cited.lean b/LeanPool/GraphMinor/GM20/Cited.lean new file mode 100644 index 0000000000..03b4c7ed43 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Cited.lean @@ -0,0 +1,269 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Defs2 +public import LeanPool.GraphMinor.GM18.Cited +public import LeanPool.GraphMinor.GM20.Defs + +/-! +# Results cited in Graph Minors XX + +This file states as `Prop`s the results of other papers of the series that the proof of Graph Minors +XX cites. Each is the statement of the cited paper, over the actual objects, and each is proved in +another file. + +From Graph Minors XVIII: +* `GM18Theorem67Statement`, (6.7) (page 106), which is (3.1) of XX. It is proved as `gm18Theorem67` + in + `Section3.lean`. + +From Graph Minors XIX: +* `GM19Theorem21Statement`, (2.1) (page 328), used for (8.1) of XX. + +From Graph Minors XVII, used for (10.3) of XX. All but the last hold under the standing hypotheses +of the section of that paper (`GM17.Standing`): +* `GM17Theorem82Statement`, (8.2) (page 181); +* `GM17Theorem83Statement`, (8.3) (page 182); +* `GM17Theorem84Statement`, (8.4) (page 182); +* `GM17Theorem85Statement`, (8.5) (page 182); +* `GM17Theorem87Statement`, (8.7) (page 182); +* `GM17Theorem88Statement`, (8.8) (page 183); +* `GM17Theorem91Statement`, (9.1) (page 183); +* `GM17Theorem98Statement`, (9.8) (pages 187–188); +* `GM17Theorem117Statement`, (11.7) (page 195); +* `GM17Theorem142Statement`, (14.2) (page 209). +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface GraphMinor.GM18 GraphMinor.GM10 Hypergraph + +universe u v w + +/-! ### Graph Minors XVIII -/ + +/-- Graph Minors XVIII, (6.7) (page 106): +"**6.7.** *Let $\Omega$ be a well-quasi-order, let $\mathscr{C}$ be a well-behaved class of rootless +partial $\Omega$-patchworks, and let $\theta \ge 1$ be an integer. Let $\mathscr{D}$ be a class of +rootless, robust $\Omega$-patchworks and suppose that for each $P \in \mathscr{D}$ there is a +tie-breaker $\lambda$ in $\|P\|^-$ such that for every tangle $\mathscr{T}$ in $G^-$ of order $\ge +\theta$, there is an $\Omega$-place $(P, \mathscr{L})$ with heart in $\mathscr{C}$ such that +$\mathscr{L}^-$ $\theta$-isolates $\mathscr{T}$. Then $\mathscr{D}$ is well-quasi-ordered by +simulation.*" + +Lean uses an infinite ambient edge type to provide fresh edge labels. -/ +def GM18Theorem67Statement : Prop := + ∀ {Ω : Type (max u v)} [Preorder Ω] {α : Type u} {β : Type v} [Infinite β] (𝒞 : Set + (PartialPatchwork Ω α β)) + (θ : ℕ) (𝒟 : Set (GM04.Patchwork Ω α β)), + WellQuasiOrderedLE Ω → GM18.WellBehaved 𝒞 → (∀ P ∈ 𝒞, IsRootless P) → 1 ≤ θ → + (∀ P ∈ 𝒟, IsRootless P ∧ P.IsRobust) → + (∀ P ∈ 𝒟, ∃ (Λ : Type) (_ : LinearOrder Λ) (lam : Hypergraph α β × Hypergraph α β → Λ), + IsTieBreaker P.G.toHypergraph lam ∧ + ∀ (θ' : ℕ) (𝒯 : Set (Hypergraph α β × Hypergraph α β)), IsTangle P.G.toHypergraph θ' 𝒯 → + θ ≤ θ' → ∃ ℒ : Set (RootedHypergraph α β), + IsOmegaPlace (PartialPatchwork.ofPatchwork P) ℒ ∧ + (∃ Q ∈ 𝒞, HasPlaceHeart (PartialPatchwork.ofPatchwork P) ℒ Q) ∧ + GM18.Isolates P.G.toHypergraph lam θ 𝒯 (rootedLocationToLocation P.G ℒ)) → + ∀ Q : ℕ → GM04.Patchwork Ω α β, (∀ i, Q i ∈ 𝒟) → ∃ i j, i < j ∧ GM04.Simulated (Q i) (Q j) + +/-! ### Graph Minors XIX -/ + +/-- Graph Minors XIX, (2.1) (page 328): +"**2.1.** *Let $\Sigma$ be a surface, and let $\Omega$ be a well-quasi-order. Let $\Gamma_i$ ($i = +1, 2, \dots$) be a countable sequence of internally 3-connected paintings in $\Sigma$, and for each +$i \ge 1$ let $\phi_i \colon E(\Gamma_i) \to E(\Omega)$ be some function. Then there exist $j > i +\ge 1$ and a linear inflation $\sigma$ of $\Gamma_i$ in $\Gamma_j$ satisfying $\phi_i \le \phi_j +\circ \sigma$.*" +Surfaces of Graph Minors XIX are compact and connected. -/ +def GM19Theorem21Statement : Prop := + ∀ (S : Type) [TopologicalSpace S] {Ω : Type w} [Preorder Ω], IsSurface S → ConnectedSpace S → + WellQuasiOrderedLE Ω → ∀ (Γ : ℕ → GM19.Painting S) (φ : ℕ → Set S → Ω), + (∀ i, (Γ i).IsInternallyThreeConnected) → + ∃ i j, i < j ∧ ∃ (σv : S → Set S) (σe : Set S → Set S), + GM19.IsLinearInflation (Γ i) (Γ j) σv σe ∧ ∀ e ∈ (Γ i).E, φ i e ≤ φ j (σe e) + +/-! ### Graph Minors XVII -/ + +namespace GM17 + +open GraphMinor.GM17 + +variable {α : Type u} {β : Type v} + +/-- The standing hypothesis of Graph Minors XVII, Sections 8 (page 181) and 9 (page 183), with +`r = 2p + 3`, and of Section 11 (page 189) with `r = 2p + 4` and `t = 6p + 8`. The portrayal `π` is +true, `r`-redundant, and `𝒯`-central, +with warp `≤ p` and `ord(𝒯) > t`. -/ +structure Standing {G : Hypergraph α β} (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (θ p r t : ℕ) (π : Portrayal G) : Prop where + isTangle : IsTangle G θ 𝒯 + isTrue : π.IsTrue 𝒯 + isRedundant : π.IsRedundant 𝒯 θ r + warp_le : π.warp ≤ p + lt : t < θ + +/-- `α(Δ)`, the union of the `α(c)` over cells `c ⊆ Δ` (Graph Minors XVII, Section 5). It is small +when `(A, B) ∈ 𝒯` for some `B` and `A` has the same vertices and edges as the union; its vertex and +edge sets are `areaVertices`, `areaEdges`. -/ +def areaVertices {G : Hypergraph α β} (π : Portrayal G) (Δ : Set π.S) : Set α := + ⋃ c ∈ {c ∈ π.Γ.C | c ⊆ Δ}, (π.cellGraph c).vertexSet + +/-- The edges of `α(Δ)`. -/ +def areaEdges {G : Hypergraph α β} (π : Portrayal G) (Δ : Set π.S) : Set β := + ⋃ c ∈ {c ∈ π.Γ.C | c ⊆ Δ}, (π.cellGraph c).edgeSet + +end GM17 + +open GraphMinor.GM17 + +/-- Graph Minors XVII, (8.3) (page 182): "For every $\Gamma$-normal $I$-arc $F$ with $|F \cap +N(\Gamma)| = 2$, there is a disc $\Delta +\subseteq \Sigma$ with $F \subseteq bd(\Delta) \subseteq F \cup bd(\Sigma)$ such that +$\Delta \cap N(\Gamma) \subseteq F$ and $\Delta$ includes exactly one cell of $\Gamma$." Standing +hypothesis: `π` is true, `(2p + 3)`-redundant, `𝒯`-central, of warp `≤ p`, +with `ord(𝒯) > 4p + 5`. -/ +def GM17Theorem83Statement : Prop := + ∀ {α : Type u} {β : Type v} {G : Hypergraph α β} (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (θ p : ℕ) (π : Portrayal G), GM17.Standing 𝒯 θ p (2 * p + 3) (4 * p + 5) π → + ∀ F : Set π.S, IsLine F → F ∩ π.Γ.U ⊆ π.Γ.N → F ∩ bd π.S = lineEnds F → + (F ∩ π.Γ.N).ncard = 2 → + ∃ Δ : Set π.S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd π.S ∧ Δ ∩ π.Γ.N ⊆ F ∧ + {c ∈ π.Γ.C | c ⊆ Δ}.ncard = 1 + +/-- Graph Minors XVII, (8.5) (page 182): +"(8.5) *For every $\Gamma$-normal $O$-arc $F \subseteq \Sigma$ with $|F \cap N(\Gamma)| \le 3$, +there is a disc $\Delta \subseteq \Sigma$ with $F = bd(\Delta)$ such that $\alpha(\Delta)$ is small, +and either* +(i) *$\Delta \cap N(\Gamma) \subseteq F$ and $\Delta$ includes at most one cell of $\Gamma$, or* +(ii) *$|F \cap N(\Gamma)| = 3$, and $|\tilde{c}| = 2$ for every cell $c \subseteq \Delta$.*" -/ +def GM17Theorem85Statement : Prop := + ∀ {α : Type u} {β : Type v} {G : Hypergraph α β} (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (θ p : ℕ) (π : Portrayal G), GM17.Standing 𝒯 θ p (2 * p + 3) (4 * p + 5) π → + ∀ F : Set π.S, IsOArc F → F ∩ π.Γ.U ⊆ π.Γ.N → (F ∩ π.Γ.N).ncard ≤ 3 → + ∃ Δ : Set π.S, IsClosedDisc Δ ∧ discBd Δ = F ∧ + (∃ A B, (A, B) ∈ 𝒯 ∧ A.vertexSet = GM17.areaVertices π Δ ∧ + A.edgeSet = GM17.areaEdges π Δ) ∧ + ((Δ ∩ π.Γ.N ⊆ F ∧ {c ∈ π.Γ.C | c ⊆ Δ}.ncard ≤ 1) ∨ + ((F ∩ π.Γ.N).ncard = 3 ∧ ∀ c ∈ π.Γ.C, c ⊆ Δ → (tilde c).ncard = 2)) + +/-- Graph Minors XVII, (8.2) (page 181): +"(8.2) *The boundary of every region is an $O$-arc, and in particular, $|\tilde{c}| \ge 2$ for every +cell $c$.*" +A region is an arcwise connected component of `Σ \ U(Γ)`. Standing hypothesis as in +`GM17Theorem83Statement`. -/ +def GM17Theorem82Statement : Prop := + ∀ {α : Type u} {β : Type v} {G : Hypergraph α β} (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (θ p : ℕ) (π : Portrayal G), GM17.Standing 𝒯 θ p (2 * p + 3) (4 * p + 5) π → + (∀ R ∈ arcComponentsIn (π.Γ.U)ᶜ, IsOArc (closure R \ R)) ∧ + ∀ c ∈ π.Γ.C, 2 ≤ (tilde c).ncard + +/-- Graph Minors XVII, (8.4) (page 182): "`dom(γ) = N(Γ)`." Standing hypothesis as in +`GM17Theorem83Statement`. -/ +def GM17Theorem84Statement : Prop := + ∀ {α : Type u} {β : Type v} {G : Hypergraph α β} (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (θ p : ℕ) (π : Portrayal G), GM17.Standing 𝒯 θ p (2 * p + 3) (4 * p + 5) π → + π.domγ = π.Γ.N + +/-- `C*(Γ)`, "the set of all $c \in C(\Gamma)$ such that there is no $c' \in C(\Gamma)$ with $c' \ne +c$ and $\tilde{c} \subseteq \tilde{c}'$" (Graph Minors XVII, Section 8, page 182). -/ +def GM17.starCells {S : Type} [TopologicalSpace S] (Γ : GM17.Painting S) : Set (Set S) := + Γ.CStar + +/-- Graph Minors XVII, (8.7) (page 182): +"(8.7) *For every node $n$ there are at least two cells $c \in C^*(\Gamma)$ with $n \in \tilde{c}$, +and if there are only two and $|\tilde{c}| = 2$ for one of them, then $c$ is a border cell.*" +Standing hypothesis as in `GM17Theorem83Statement`. -/ +def GM17Theorem87Statement : Prop := + ∀ {α : Type u} {β : Type v} {G : Hypergraph α β} (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (θ p : ℕ) (π : Portrayal G), GM17.Standing 𝒯 θ p (2 * p + 3) (4 * p + 5) π → + ∀ n ∈ π.Γ.N, 2 ≤ {c ∈ GM17.starCells π.Γ | n ∈ tilde c}.ncard ∧ + ({c ∈ GM17.starCells π.Γ | n ∈ tilde c}.ncard = 2 → + ∀ c ∈ GM17.starCells π.Γ, n ∈ tilde c → (tilde c).ncard = 2 → (c ∩ bd π.S).Nonempty) + +/-- Graph Minors XVII, (8.8) (page 183): +"(8.8) *If $c_1, c_2$ are distinct cells with $\tilde{c}_1 \subseteq \tilde{c}_2$, then $c_1$ is a +border cell, and $|\tilde{c}_2| = 3$.*" +Standing hypothesis as in `GM17Theorem83Statement`. -/ +def GM17Theorem88Statement : Prop := + ∀ {α : Type u} {β : Type v} {G : Hypergraph α β} (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (θ p : ℕ) (π : Portrayal G), GM17.Standing 𝒯 θ p (2 * p + 3) (4 * p + 5) π → + ∀ c₁ ∈ π.Γ.C, ∀ c₂ ∈ π.Γ.C, c₁ ≠ c₂ → tilde c₁ ⊆ tilde c₂ → + (c₁ ∩ bd π.S).Nonempty ∧ (tilde c₂).ncard = 3 + +/-- Graph Minors XVII, (9.1) (page 183): +"(9.1) *Let $c_0$ be an internal cell, and let $v_1, v_2 \in \gamma(\tilde{c}_0)$. Then there is a +path in $\alpha(c_0)^*$ from $v_1$ to $v_2$ with no other vertex in $\gamma(\tilde{c}_0)$.*" -/ +def GM17Theorem91Statement : Prop := + ∀ {α : Type u} {β : Type v} {G : Hypergraph α β} (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (θ p : ℕ) (π : Portrayal G), GM17.Standing 𝒯 θ p (2 * p + 3) (4 * p + 5) π → + ∀ c₀ ∈ π.Γ.C, ¬ (c₀ ∩ bd π.S).Nonempty → ∀ n₁ ∈ tilde c₀, ∀ n₂ ∈ tilde c₀, n₁ ≠ n₂ → + ∃ L : PathFromTo (π.cellGraph c₀).skeleton {π.nodeVertex n₁} {π.nodeVertex n₂}, + ∀ z ∈ L.walk.support, z ∈ π.nodeVertex '' tilde c₀ → + z = π.nodeVertex n₁ ∨ z = π.nodeVertex n₂ + +/-- Graph Minors XVII, (9.8) (pages 187–188): +"(9.8) *Let $c_0$ be a border cell with $c_0 = \{n_1, n_2\}$. Then* +(i) *$|\beta(n_1)| = |\beta(n_2)| = q$ and $\beta(n_1) \cap \gamma(N(\Gamma)), \beta(n_2) \cap +\gamma(N(\Gamma)) = \emptyset$;* ... +(ii) *there is a linkage $\{P_1, \dots, P_q\}$ in $\alpha(c_0) \setminus \{\gamma(n_1), +\gamma(n_2)\}$ from $\beta(n_1)$ to $\beta(n_2)$ such that either there is a path $P_0$ such that +$\{P_0, P_1, \dots, P_q\}$ is a linkage in $\alpha(c_0)$ from $\beta(n_1 +)$ to $\beta(n_2 +)$, or +there is an internal cell $c$ with $|\tilde{c}| = 3$ and $\tilde{c}_0 \subseteq \tilde{c}$.*" +(Here $c_0 = \{n_1, n_2\}$ is a misprint in the paper for $\tilde{c}_0 = \{n_1, n_2\}$, and `q` is +the warp of `π` at the cuff `Θ`, as in (9.3).) -/ +def GM17Theorem98Statement : Prop := + ∀ {α : Type u} {β : Type v} {G : Hypergraph α β} (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (θ p : ℕ) (π : Portrayal G), GM17.Standing 𝒯 θ p (2 * p + 3) (4 * p + 5) π → + ∀ Θ ∈ cuffs π.S, ∀ c₀ ∈ π.Γ.C, (c₀ ∩ Θ).Nonempty → ∀ n₁ ∈ tilde c₀, ∀ n₂ ∈ tilde c₀, n₁ ≠ n₂ → + (π.borderSet n₁).ncard = π.warpAt Θ ∧ (π.borderSet n₂).ncard = π.warpAt Θ ∧ + Disjoint (π.borderSet n₁) (π.nodeVertex '' π.Γ.N) ∧ + Disjoint (π.borderSet n₂) (π.nodeVertex '' π.Γ.N) ∧ + ∃ L : Fin (π.warpAt Θ) → + PathFromTo (π.cellGraph c₀).skeleton (π.borderSet n₁) (π.borderSet n₂), + (Pairwise fun i j ↦ Disjoint {z | z ∈ (L i).walk.support} {z | z ∈ (L j).walk.support}) ∧ + (∀ i, π.nodeVertex n₁ ∉ (L i).walk.support ∧ π.nodeVertex n₂ ∉ (L i).walk.support) ∧ + ((∃ L₀ : PathFromTo (π.cellGraph c₀).skeleton {π.nodeVertex n₁} {π.nodeVertex n₂}, + ∀ i, Disjoint {z | z ∈ L₀.walk.support} {z | z ∈ (L i).walk.support}) ∨ + ∃ c ∈ π.Γ.C, ¬ (c ∩ bd π.S).Nonempty ∧ (tilde c).ncard = 3 ∧ tilde c₀ ⊆ tilde c) + +/-- Graph Minors XVII, (11.7) (page 195), with the hypotheses of that part of Section 11: +"$\pi = (\Sigma, \Gamma, \alpha, \beta, \gamma)$ is a true, $(2p + 4)$-redundant, +$\mathcal{T}$-central portrayal of a hypergraph $G$, with warp $\le p$, and +$\operatorname{ord}(\mathcal{T}) > 6p + 8$" and "$c_0 \in C(\Gamma)$ and $(A, B) \in \mathscr{T}$ +with $\alpha(c_0) \subseteq A$, satisfying +$$|V(A \cap B)| \le |V(\alpha(c_0) \cap \alpha(-c_0))|". Conclusion: "$(11.7) $|V(A \cap B)| = +|V(\alpha(c_0) \cap \alpha(-c_0))|.$" -/ +def GM17Theorem117Statement : Prop := + ∀ {α : Type u} {β : Type v} {G : Hypergraph α β} (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (θ p : ℕ) (π : Portrayal G), GM17.Standing 𝒯 θ p (2 * p + 4) (6 * p + 8) π → + ∀ c₀ ∈ π.Γ.C, ∀ ⦃A B⦄, (A, B) ∈ 𝒯 → π.cellGraph c₀ ≤ A → + separationOrder A B ≤ ((π.cellGraph c₀).vertexSet ∩ π.otherVertices c₀).ncard → + separationOrder A B = ((π.cellGraph c₀).vertexSet ∩ π.otherVertices c₀).ncard + +/-- Graph Minors XVII, (14.2) (page 209): "For any graph $H$ there are numbers $p, q, z$ and $\theta +> z$, such that for every +hypergraph $G$ and every tangle $\mathscr{T}$ in $G$ of order $\ge \theta$, either* (i) +$\mathscr{T}$ *controls an $H$-minor of $G^*$, or* (ii) *there exists $Z \subseteq V(G)$ +with $|Z| \le z$ and a $\mathscr{T}/Z$-central portrayal $\pi = (\Sigma, \Gamma, \alpha, +\beta, \gamma)$ of $G/Z$ with warp $\le p$, such that $\Sigma$ has $\le q$ cuffs and $H$ +cannot be drawn in $\Sigma$, and $\pi$ is true and $(2p + 7)$-redundant." -/ +def GM17Theorem142Statement : Prop := + ∀ {α' : Type} {β' : Type} (H : Hypergraph α' β'), H.IsGraph → + ∃ p q z θ : ℕ, z < θ ∧ ∀ {α : Type u} {β : Type v} (G : Hypergraph α β) (θ' : ℕ) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)), IsTangle G θ' 𝒯 → θ ≤ θ' → + ControlsMinor G 𝒯 H ∨ ∃ Z ⊆ G.vertexSet, Z.ncard ≤ z ∧ + ∃ π : Portrayal (quotientVertices G Z), π.warp ≤ p ∧ (cuffs π.S).encard ≤ q ∧ + ¬ CanBeDrawn π.S H ∧ π.IsTrue (quotientTangle G 𝒯 Z) ∧ + π.IsRedundant (quotientTangle G 𝒯 Z) (θ' - Z.ncard) (2 * p + 7) + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Codes.lean b/LeanPool/GraphMinor/GM20/Codes.lean new file mode 100644 index 0000000000..acadf1efac --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Codes.lean @@ -0,0 +1,191 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Basic +public import Mathlib.Data.Set.Finite.Basic + +/-! +# Finite codes of edges + +Several proofs of Graph Minors XX, Section 4 say that some finite set of data is "evidently" a +well-quasi-order: an edge whose ends lie on a march of bounded length has only finitely many shapes. +This file makes that precise. Given a march `r` of length `k`, the data of an edge with ends on `r`, +namely its march `m` and its patch `Δ`, is recorded through positions in `r`, as a member of a +finite +type (`marchCode`, `patchCode`). If two edges have the same code, the bijection `m → m'` maps `Δ` to +`Δ'` (`mapsTo_of_code`). +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM04 + +universe u + +variable {α : Type u} + +/-- The positions in `r`, below `k`, of members of `X`. -/ +def indexSet (k : ℕ) (r : List α) (X : Set α) : Set (Fin k) := + {i | ∃ x ∈ X, r[i.1]? = some x} + +/-- The pairs `(p, i)` such that the `p`th term of `m` is the `i`th term of `r`. -/ +def marchCode (k : ℕ) (r m : List α) : Set (Fin k × Fin k) := + {c | ∃ x, m[c.1.1]? = some x ∧ r[c.2.1]? = some x} + +/-- The code of a grouping: its vertices and adjacent pairs, as positions in `r`. -/ +def groupingCode (k : ℕ) (r : List α) (δ : (⊤ : SimpleGraph α).Subgraph) : + Set (Fin k) × Set (Fin k × Fin k) := + (indexSet k r δ.verts, {c | ∃ x y, r[c.1.1]? = some x ∧ r[c.2.1]? = some y ∧ δ.Adj x y}) + +/-- The code of a patch: the codes of its groupings. -/ +def patchCode (k : ℕ) (r : List α) (Δ : Patch α) : Set (Set (Fin k) × Set (Fin k × Fin k)) := + groupingCode k r '' Δ.groupings + +/-- The type of codes of edges, which is finite. -/ +abbrev EdgeCode (k : ℕ) : Type := + Prop × Set (Fin k) × Set (Fin k × Fin k) × Set (Set (Fin k) × Set (Fin k × Fin k)) + +open Classical in +instance (k : ℕ) : Finite (EdgeCode k) := inferInstance + +/-- The code of an edge of a patchwork with respect to a march `r`: whether it lies in `dom(μ)`, and +the positions on `r` of its ends, its march and its patch. -/ +def edgeCode {Ω β : Type*} (k : ℕ) (r : List α) (P : Patchwork Ω α β) (e : β) : EdgeCode k := + (e ∈ P.dom, indexSet k r (P.G.ends e), marchCode k r (P.μ e), patchCode k r (P.Δ e)) + +theorem exists_index {r : List α} {k : ℕ} (hk : r.length ≤ k) {x : α} (hx : x ∈ r) : + ∃ i : Fin k, r[i.1]? = some x := by + obtain ⟨i, hi, h⟩ := List.getElem_of_mem hx + exact ⟨⟨i, hi.trans_le hk⟩, List.getElem?_eq_some_iff.mpr ⟨hi, h⟩⟩ + +theorem marchCorresponds_of_getElem? {m m' : List α} {p : ℕ} {x y : α} (h : m[p]? = some x) + (h' : m'[p]? = some y) : MarchCorresponds m m' x y := by + obtain ⟨h₁, h₂⟩ := List.getElem?_eq_some_iff.mp h + obtain ⟨h₁', h₂'⟩ := List.getElem?_eq_some_iff.mp h' + exact ⟨p, h₁, h₁', h₂, h₂'⟩ + +theorem getElem?_of_marchCorresponds {m m' : List α} {x y : α} (h : MarchCorresponds m m' x y) : + ∃ p : ℕ, m[p]? = some x ∧ m'[p]? = some y := by + obtain ⟨p, h₁, h₁', h₂, h₂'⟩ := h + exact ⟨p, List.getElem?_eq_some_iff.mpr ⟨h₁, h₂⟩, List.getElem?_eq_some_iff.mpr ⟨h₁', h₂'⟩⟩ + +/-- Under equal march codes, a term of `m` at position `p` and of `r` at position `i` gives a common +term of `m'` at `p` and `r'` at `i`. -/ +theorem marchCode_forward {k : ℕ} {r r' m m' : List α} (hc : marchCode k r m = marchCode k r' m') + {x : α} {i : Fin k} {p : ℕ} (hk : m.length ≤ k) (hm : m[p]? = some x) + (hi : r[i.1]? = some x) : ∃ y, m'[p]? = some y ∧ r'[i.1]? = some y := by + have hp : p < k := (List.getElem?_eq_some_iff.mp hm).1.trans_le hk + have : ((⟨p, hp⟩, i) : Fin k × Fin k) ∈ marchCode k r m := ⟨x, hm, hi⟩ + rw [hc] at this + exact this + +/-- A nodup march with all terms in `r` is no longer than `r`. -/ +theorem length_le_of_subset {r m : List α} (hm : m.Nodup) (h : ∀ x ∈ m, x ∈ r) : + m.length ≤ r.length := + (hm.subperm h).length_le + +/-- Two marches with equal codes, each with terms on its `r`, have the same length. -/ +theorem length_eq_of_code {k : ℕ} {r r' m m' : List α} (hr : r.length ≤ k) (hr' : r'.length ≤ k) + (hm : m.Nodup) (hm' : m'.Nodup) (hs : ∀ x ∈ m, x ∈ r) (hs' : ∀ x ∈ m', x ∈ r') + (hc : marchCode k r m = marchCode k r' m') : m.length = m'.length := by + have key : ∀ {r r' m m' : List α}, r.length ≤ k → m.Nodup → (∀ x ∈ m, x ∈ r) → + marchCode k r m = marchCode k r' m' → m.length ≤ m'.length := by + intro r r' m m' hr hm hs hc + by_contra hlt + push Not at hlt + have hp : m'.length < m.length := hlt + have hx := List.getElem_mem hp + obtain ⟨i, hi⟩ := exists_index hr (hs _ hx) + have hle : m.length ≤ k := (length_le_of_subset hm hs).trans hr + obtain ⟨y, hy, -⟩ := marchCode_forward hc hle (List.getElem?_eq_getElem hp) hi + have := (List.getElem?_eq_some_iff.mp hy).1 + omega + exact le_antisymm (key hr hm hs hc) (key hr' hm' hs' hc.symm) + +/-- If an edge with march `m` and patch `Δ` and an edge with march `m'` and patch `Δ'`, both with +all +ends on marches of length `k`, have the same codes, then `m → m'` maps `Δ` to `Δ'`. -/ +theorem mapsTo_of_code {k : ℕ} {r r' m m' : List α} {Δ Δ' : Patch α} (hr : r.length ≤ k) + (hr' : r'.length ≤ k) (hm : m.Nodup) (hm' : m'.Nodup) (hs : ∀ x ∈ m, x ∈ r) + (hs' : ∀ x ∈ m', x ∈ r') (hV : Δ.verts = {x | x ∈ m}) (hV' : Δ'.verts = {x | x ∈ m'}) + (hc : marchCode k r m = marchCode k r' m') (hpc : patchCode k r Δ = patchCode k r' Δ') : + MapsTo (marchMapSubgraph m m') Δ.groupings Δ'.groupings := by + intro δ hδ + have hmem : groupingCode k r δ ∈ patchCode k r' Δ' := hpc ▸ mem_image_of_mem _ hδ + obtain ⟨δ', hδ', hcode⟩ := hmem + have hle : m.length ≤ k := (length_le_of_subset hm hs).trans hr + have hle' : m'.length ≤ k := (length_le_of_subset hm' hs').trans hr' + have hvδ : δ.verts = {x | x ∈ m} := (Δ.verts_eq δ hδ).trans hV + have hvδ' : δ'.verts = {x | x ∈ m'} := (Δ'.verts_eq δ' hδ').trans hV' + have hvm : ∀ {x}, x ∈ δ.verts → x ∈ m := fun {x} hx ↦ by + rw [hvδ] at hx + exact hx + have hvm' : ∀ {x}, x ∈ δ'.verts → x ∈ m' := fun {x} hx ↦ by + rw [hvδ'] at hx + exact hx + have hI : indexSet k r' δ'.verts = indexSet k r δ.verts := congrArg Prod.fst hcode + have hA : ∀ c : Fin k × Fin k, (∃ x y, r'[c.1.1]? = some x ∧ r'[c.2.1]? = some y ∧ δ'.Adj x y) ↔ + ∃ x y, r[c.1.1]? = some x ∧ r[c.2.1]? = some y ∧ δ.Adj x y := fun c ↦ + Set.ext_iff.mp (congrArg Prod.snd hcode) c + -- A corresponding pair `x, y` sits at a common position of `r` and `r'`. + have fwd : ∀ {x y}, x ∈ δ.verts → MarchCorresponds m m' x y → + ∃ i : Fin k, r[i.1]? = some x ∧ r'[i.1]? = some y := by + intro x y hx hxy + obtain ⟨p, h₁, h₂⟩ := getElem?_of_marchCorresponds hxy + obtain ⟨i, hi⟩ := exists_index hr (hs x (hvm hx)) + obtain ⟨y', h₃, h₄⟩ := marchCode_forward hc hle h₁ hi + have : y' = y := by rw [h₂] at h₃; exact (Option.some.inj h₃).symm + exact ⟨i, hi, this ▸ h₄⟩ + have bwd : ∀ {y}, y ∈ δ'.verts → ∃ x ∈ δ.verts, MarchCorresponds m m' x y ∧ + ∃ i : Fin k, r[i.1]? = some x ∧ r'[i.1]? = some y := by + intro y hy + obtain ⟨i, hi⟩ := exists_index hr' (hs' y (hvm' hy)) + have hmem : i ∈ indexSet k r δ.verts := hI ▸ (⟨y, hy, hi⟩ : i ∈ indexSet k r' δ'.verts) + obtain ⟨x, hx, hxi⟩ := hmem + have hxm : x ∈ m := hvm hx + obtain ⟨p, hp, hpx⟩ := List.getElem_of_mem hxm + have hpx' : m[p]? = some x := List.getElem?_eq_some_iff.mpr ⟨hp, hpx⟩ + obtain ⟨y', h₃, h₄⟩ := marchCode_forward hc hle hpx' hxi + have : y' = y := by rw [hi] at h₄; exact (Option.some.inj h₄).symm + exact ⟨x, hx, marchCorresponds_of_getElem? hpx' (this ▸ h₃), i, hxi, hi⟩ + suffices marchMapSubgraph m m' δ = δ' from this ▸ hδ' + apply SimpleGraph.Subgraph.ext + · ext y + constructor + · rintro ⟨x, hx, hxy⟩ + obtain ⟨i, hi, hi'⟩ := fwd hx hxy + have hmem : i ∈ indexSet k r' δ'.verts := hI ▸ (⟨x, hx, hi⟩ : i ∈ indexSet k r δ.verts) + obtain ⟨y', hy', hyi⟩ := hmem + have : y' = y := by rw [hi'] at hyi; exact (Option.some.inj hyi).symm + exact this ▸ hy' + · intro hy + obtain ⟨x, hx, hxy, -⟩ := bwd hy + exact ⟨x, hx, hxy⟩ + · funext y₁ y₂ + apply propext + constructor + · rintro ⟨-, x₁, x₂, h₁, h₂, hadj⟩ + obtain ⟨i₁, hi₁, hi₁'⟩ := fwd (δ.edge_vert hadj) h₁ + obtain ⟨i₂, hi₂, hi₂'⟩ := fwd (δ.edge_vert hadj.symm) h₂ + obtain ⟨u, v, hu, hv, huv⟩ := (hA (i₁, i₂)).mpr ⟨x₁, x₂, hi₁, hi₂, hadj⟩ + have e₁ : u = y₁ := by rw [hi₁'] at hu; exact (Option.some.inj hu).symm + have e₂ : v = y₂ := by rw [hi₂'] at hv; exact (Option.some.inj hv).symm + exact e₁ ▸ e₂ ▸ huv + · intro hadj + obtain ⟨x₁, -, h₁, i₁, hi₁, hi₁'⟩ := bwd (δ'.edge_vert hadj) + obtain ⟨x₂, -, h₂, i₂, hi₂, hi₂'⟩ := bwd (δ'.edge_vert hadj.symm) + obtain ⟨u, v, hu, hv, huv⟩ := (hA (i₁, i₂)).mp ⟨y₁, y₂, hi₁', hi₂', hadj⟩ + have e₁ : u = x₁ := by rw [hi₁] at hu; exact (Option.some.inj hu).symm + have e₂ : v = x₂ := by rw [hi₂] at hv; exact (Option.some.inj hv).symm + exact ⟨hadj.ne, x₁, x₂, h₁, h₂, e₁ ▸ e₂ ▸ huv⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Defs.lean b/LeanPool/GraphMinor/GM20/Defs.lean new file mode 100644 index 0000000000..e30c47bd4b --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Defs.lean @@ -0,0 +1,548 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM18.Defs +public import LeanPool.GraphMinor.GM19.Defs +public import Mathlib.Algebra.Module.Basic +public import Mathlib.Basic.Real.Basic + +/-! +# Definitions for Graph Minors XX: Wagner's conjecture + +This file formalizes the definitions of N. Robertson and P. D. Seymour, *Graph Minors. XX. Wagner's +conjecture*, J. Combin. Theory Ser. B 92 (2004) 325–357, that are not already in the interface +files. Hypergraphs, separations, tangles, tie-breakers, distinctions, patches and patchworks are +those of `GraphMinor.Hypergraph.Basic`, `GraphMinor.GM10.Defs`, `GraphMinor.GM10.Defs2`, +`GraphMinor.GM04.Patchwork.Defs` and `GraphMinor.GM18.Defs`. In particular: + +- a patchwork `(G, μ, Δ)` is a `GM18.UnlabeledPatchwork`, a partial `Ω`-patchwork is a + `GM18.PartialPatchwork`, and an `Ω`-patchwork is a `GM04.Patchwork`; +- a rooted location is a set `ℒ` with `GM18.IsRootedLocation G ℒ`. The paper's condition + "there exists $B \subseteq G$ such that $(A, B)$ is a separation of $G$" for `A` to be + complemented, and its condition on + `A₁, A₂`, are the conditions of Graph Minors XVIII, Section 5, in another wording; +- `ℒ⁻` is `GM18.rootedLocationToLocation G ℒ` and `M(G, ℒ)` is `GM18.rootedLocationCore G ℒ`; +- `G/W` is `GM10.quotientVertices G W` and `𝒯/W` is `GM10.quotientTangle G 𝒯 W`; +- "`ℒ` `θ`-isolates `𝒯`" is `GM18.Isolates G⁻ λ θ 𝒯 ℒ⁻`; +- "`(P, ℒ)` has heart `P'`" is `GM18.HasPatchworkHeart P ℒ P'`. + +The functions `μ`, `Δ`, `φ` of a `GM04.Patchwork` are total, and only their values on `dom(μ)` and +on `E(G)` have a meaning. Every statement about sets of patchworks below sees only those values: +`IsCompletionOf` and the relations on patchworks compare them there. + +New definitions, in the paper's order: +- Section 4: `IsCompletionOf`, `WellBehaved`, `IsEncoding`, `IsActive`, `IsOneVertexExtension`, + `RootedHypergraph.slash`, `Patchwork.slash`, `IsCondensation`. +- Section 5: `zSet` (`Z(G)`), `InM` (`ℳ(𝒯, W, θ)`), `IsolatesModulo`, `IsFine`, `IsSuitable`. +- Section 6: `edgeBasedLam`, `IsEdgeBased`, `IsLinkedTo`, `locationSlash`. +- Section 7: `IsFree`. +- Section 8: `Painting`, `Painting.IsThreeConnected`, `Painting.sk`, `IsLinearInflation`. +- Section 9: `GradedSurface`, `Hull`, `IsHulled`. +- Section 10: `IsShelled`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface GraphMinor.GM18 GraphMinor.GM10 Hypergraph + +universe u v w + +variable {α : Type u} {β : Type v} + +/-! ## Section 4: well-behaved sets of patchworks -/ + +/-- `Q` is an `Ω`-completion of the patchwork `P` (Graph Minors XX, Section 4, page 330): "If $P = +(G, \mu, \Delta)$ is a patchwork and $\Omega$ is a quasi-order, we call every +$\Omega$-patchwork $(G, \mu, \Delta, \phi)$ an $\Omega$*-completion* of $P$." -/ +structure IsCompletionOf {Ω Ω' : Type*} (P : GM04.Patchwork Ω' α β) (Q : GM04.Patchwork Ω α β) : + Prop where + G_eq : Q.G = P.G + dom_eq : Q.dom = P.dom + μ_eq : ∀ ⦃e⦄, e ∈ P.dom → Q.μ e = P.μ e + Δ_eq : ∀ ⦃e⦄, e ∈ P.G.edgeSet → Q.Δ e = P.Δ e + +/-- A set `𝓕` of patchworks is well-behaved (Graph Minors XX, Section 4, page 330): "for every +well-quasi-order $\Omega$ and every countable sequence $P_i$ ($i = 1, 2, \dots$) +of $\Omega$-completions of members of $\mathcal{F}$ there exist $j > i \ge 1$ such that +$P_i$ is simulated in $P_j$." Here `Ω` ranges over +`Type (max u v)`, which is closed under the constructions of the paper. + +This uses the IV simulation relation. On each marked edge it sends source groupings into the +target patch. XX §3 requires equality with the target patch. -/ +def WellBehaved (𝓕 : Set (UnlabeledPatchwork α β)) : Prop := + ∀ (Ω : Type (max u v)) [Preorder Ω], WellQuasiOrderedLE Ω → + ∀ Q : ℕ → GM04.Patchwork Ω α β, (∀ i, ∃ P ∈ 𝓕, IsCompletionOf P (Q i)) → + ∃ i j, i < j ∧ GM04.Simulated (Q i) (Q j) + +/-- `γ` is an encoding of `𝓕₂` in `𝓕₁` (Graph Minors XX, Section 4, page 331): "A function $\gamma : +\mathcal{F}_2 \to \mathcal{F}_1$ is an *encoding* of $\mathcal{F}_2$ in +$\mathcal{F}_1$ if $P$ is simulated in $P'$ for all $P, P' \in \mathcal{F}_2$ such that +$\gamma(P)$ is simulated in $\gamma(P')$." + +Both simulations here use the IV relation, which permits inclusion of transported patches. +XX §3 uses equality for those patches. -/ +def IsEncoding {Ω₁ Ω₂ : Type*} [Preorder Ω₁] [Preorder Ω₂] (𝓕₁ : Set (GM04.Patchwork Ω₁ α β)) + (𝓕₂ : Set (GM04.Patchwork Ω₂ α β)) (γ : GM04.Patchwork Ω₂ α β → GM04.Patchwork Ω₁ α β) : Prop := + (∀ P ∈ 𝓕₂, γ P ∈ 𝓕₁) ∧ + ∀ P ∈ 𝓕₂, ∀ P' ∈ 𝓕₂, GM04.Simulated (γ P) (γ P') → GM04.Simulated P P' + +/-- A patchwork is active if every vertex of `G` is incident with some `e ∈ dom(μ)` (Graph Minors +XX, Section 4, page 332). -/ +def IsActive {Ω : Type*} (P : GM04.Patchwork Ω α β) : Prop := + ∀ v ∈ P.G.vertexSet, ∃ e ∈ P.dom, P.G.Inc e v + +/-- The relation "`P₂` is a 1-vertex extension of `P₁`" (Graph Minors XX, Section 4, page 332): `P₂` +is `P₁` with a new vertex `v`, incident with `f` only, where `μ₂(f)` and `Δ₂(f)` are arbitrary on +the +new set of ends of `f`. -/ +structure IsOneVertexExtension (P₁ P₂ : UnlabeledPatchwork α β) (f : β) (v : α) : Prop where + f_mem : f ∈ P₁.dom + v_notMem : v ∉ P₁.G.vertexSet + roots_eq : P₂.G.roots = P₁.G.roots + edgeSet_eq : P₂.G.edgeSet = P₁.G.edgeSet + vertexSet_eq : P₂.G.vertexSet = P₁.G.vertexSet ∪ {v} + ends_f : P₂.G.ends f = P₁.G.ends f ∪ {v} + ends_ne : ∀ e ∈ P₁.G.edgeSet, e ≠ f → P₂.G.ends e = P₁.G.ends e + dom_eq : P₂.dom = P₁.dom + μ_ne : ∀ e ∈ P₁.dom, e ≠ f → P₂.μ e = P₁.μ e + Δ_ne : ∀ e ∈ P₁.G.edgeSet, e ≠ f → P₂.Δ e = P₁.Δ e + +/-- `π/W`: the march obtained by omitting all terms in `W` (Graph Minors XX, Section 4, page 333). +-/ +noncomputable def marchSlash (π : List α) (W : Set α) : List α := + open Classical in π.filter (· ∉ W) + +theorem mem_marchSlash {π : List α} {W : Set α} {v : α} : + v ∈ marchSlash π W ↔ v ∈ π ∧ v ∉ W := by + classical + simp [marchSlash] + +theorem nodup_marchSlash {π : List α} (h : π.Nodup) (W : Set α) : (marchSlash π W).Nodup := by + classical + exact h.filter _ + +/-- `G/W` for a rooted hypergraph (Graph Minors XX, Section 4, page 333): "`G/W` denotes +`(G⁻/W, π(G)/W)`." -/ +noncomputable def _root_.GraphMinor.RootedHypergraph.slash (G : RootedHypergraph α β) (W : Set α) : + RootedHypergraph α β where + toHypergraph := quotientVertices G.toHypergraph W + roots := marchSlash G.roots W + roots_nodup := nodup_marchSlash G.roots_nodup W + roots_subset v hv := by + obtain ⟨h₁, h₂⟩ := mem_marchSlash.mp hv + exact ⟨G.roots_subset v h₁, h₂⟩ + +/-- The patch `Δ'` of `P/W` obtained from `Δ` (Graph Minors XX, Section 4, page 333): "$\Delta'(e)$ +consists of all groupings $K'$ with vertex set $Z \setminus W$ such that $K' +\cup N_{W \cap Z} \in \Delta(e)$." -/ +def patchSlash (Δ : GM04.Patch α) (W : Set α) : GM04.Patch α where + verts := Δ.verts \ W + groupings := {K | GM04.IsGrouping (Δ.verts \ W) K ∧ K.verts = Δ.verts \ W ∧ + K ⊔ GM04.emptySubgraph (W ∩ Δ.verts) ∈ Δ} + isGrouping _ h := h.1 + verts_eq _ h := h.2.1 + +/-- `N_{W ∩ Z}` together with a grouping `K` on `Z \ W` is a grouping on `Z`, the only grouping- +theoretic fact needed to see that `P/W` is a patchwork. -/ +theorem isGrouping_sup_emptySubgraph {Z W : Set α} {K : (⊤ : SimpleGraph α).Subgraph} + (hK : GM04.IsGrouping (Z \ W) K) : + GM04.IsGrouping Z (K ⊔ GM04.emptySubgraph (W ∩ Z)) := by + rw [GM04.isGrouping_iff] at hK ⊢ + refine ⟨?_, fun a b c hac hab hbc ↦ ?_⟩ + · rintro x (hx | hx) + · exact (hK.1 hx).1 + · exact hx.2 + · simp only [SimpleGraph.Subgraph.sup_adj, GM04.not_emptySubgraph_adj, or_false] at hab hbc ⊢ + exact hK.2 a b c hac hab hbc + +/-- `P/W` for an `Ω`-patchwork (Graph Minors XX, Section 4, page 333): "If $P = (G, \mu, \Delta)$ is +a patchwork and $W \subseteq V(G)$, $P/W$ denotes the patchwork +$(G/W, \mu', \Delta')$ where for $e \in dom(\mu)$, $\mu'(e) = \mu(e)/W$, and for $e \in +E(G)$, if $Z$ denotes the set of ends of $e$ in $G$ then $\Delta'(e)$ consists of all +groupings $K'$ with vertex set $Z \setminus W$ such that $K' \cup N_{W \cap Z} \in +\Delta(e)$. If $P = (G, \mu, \Delta, \phi)$ is an $\Omega$-patchwork and $W \subseteq V(G)$, +$P/W$ denotes the $\Omega$-patchwork $(G/W, \mu', \Delta', \phi)$" -/ +noncomputable def _root_.GraphMinor.GM04.Patchwork.slash {Ω : Type*} (P : GM04.Patchwork Ω α β) + (W : Set α) : GM04.Patchwork Ω α β where + G := P.G.slash W + dom := P.dom + μ e := marchSlash (P.μ e) W + Δ e := patchSlash (P.Δ e) W + φ := P.φ + dom_subset := P.dom_subset + μ_nodup e he := nodup_marchSlash (P.μ_nodup e he) W + μ_set e he := by + ext v + have h := Set.ext_iff.mp (P.μ_set e he) v + simp only [mem_ofPred_eq, mem_marchSlash] at h ⊢ + exact ⟨fun ⟨h₁, h₂⟩ ↦ ⟨h.mp h₁, h₂⟩, fun ⟨h₁, h₂⟩ ↦ ⟨h.mpr h₁, h₂⟩⟩ + Δ_verts e he := by + change (P.Δ e).verts \ W = _ + rw [P.Δ_verts e he] + ext v + exact ⟨fun h ↦ h, fun h ↦ h⟩ + Δ_free e he hnd := by + intro δ hδ hV + exact ⟨hδ, hV, P.Δ_free e he hnd _ (isGrouping_sup_emptySubgraph hδ) (by + ext x + simp only [SimpleGraph.Subgraph.verts_sup, GM04.emptySubgraph_verts, hV, patchSlash] + by_cases hx : x ∈ W <;> simp [hx])⟩ + +/-- `P₁` is a condensation of `P₂` (Graph Minors XX, Section 4, page 334): "$V(G_1) = V(G_2)$, +$\pi(G_1) = \pi(G_2)$, $dom(\mu_1) = E(G_1)$, $dom(\mu_2) = E(G_2)$, for +each $e \in E(G_1)$ there is a rooted subhypergraph $A_e \subseteq G_2$ with the following +properties: - $V(A_e)$ is the set of ends of $e$ in $G_1$, and $\pi(A_e) = \mu_1(e)$, - +$\bigcup_{e \in E(G_1)} E(A_e) = E(G_2)$, - for distinct $e, e' \in E(G_1)$, $E(A_e) \cap +E(A_{e'}) = \emptyset$, - for each $e \in E(G_1)$ and $K \in \Delta_1(e)$, $K$ is feasible +in $P_2|A_e$." -/ +def IsCondensation (P₁ P₂ : UnlabeledPatchwork α β) : Prop := + P₁.G.vertexSet = P₂.G.vertexSet ∧ P₁.G.roots = P₂.G.roots ∧ P₁.dom = P₁.G.edgeSet ∧ + P₂.dom = P₂.G.edgeSet ∧ ∃ A : β → RootedHypergraph α β, + (∀ e ∈ P₁.G.edgeSet, (A e).toHypergraph ≤ P₂.G.toHypergraph ∧ + (A e).vertexSet = P₁.G.ends e ∧ (A e).roots = P₁.μ e) ∧ + (⋃ e ∈ P₁.G.edgeSet, (A e).edgeSet) = P₂.G.edgeSet ∧ + (∀ e ∈ P₁.G.edgeSet, ∀ e' ∈ P₁.G.edgeSet, e ≠ e' → Disjoint (A e).edgeSet (A e').edgeSet) ∧ + ∀ e ∈ P₁.G.edgeSet, ∀ K ∈ P₁.Δ e, IsFeasibleGrouping (P₂.restrict (A e)) K + +/-! ## Section 5: isolation modulo a subset -/ + +/-- `Z(G) = V(G) ∪ E(G)` (Graph Minors XX, Section 5, page 336). -/ +def zSet (G : Hypergraph α β) : Set (α ⊕ β) := Sum.inl '' G.vertexSet ∪ Sum.inr '' G.edgeSet + +section Distinction + +variable {Λ : Type*} [LE Λ] (lam : Hypergraph α β × Hypergraph α β → Λ) + (G : Hypergraph α β) (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (W : Set (α ⊕ β)) (θ : ℕ) + +/-- The first two conditions in the definition of `ℳ(𝒯, W, θ)` (Graph Minors XX, Section 5, +page 336): `(A, B) ∈ 𝒯` has order `< θ`, `W ⊈ Z(B)`, and `(A, B)` is the `(𝒯, 𝒯')`-distinction for +some tangle `𝒯'` in `G`. -/ +def InMPre (A B : Hypergraph α β) : Prop := + (A, B) ∈ 𝒯 ∧ separationOrder A B < θ ∧ ¬ W ⊆ zSet B ∧ + ∃ (θ' : ℕ) (𝒯' : Set (Hypergraph α β × Hypergraph α β)), IsTangle G θ' 𝒯' ∧ + IsDistinction lam 𝒯 𝒯' A B + +/-- `(A, B) ∈ ℳ(𝒯, W, θ)` (Graph Minors XX, Section 5, page 336). -/ +def InM (A B : Hypergraph α β) : Prop := + InMPre lam G 𝒯 W θ A B ∧ ∀ ⦃A' B' : Hypergraph α β⦄, InMPre lam G 𝒯 W θ A' B' → + (A', B') ≠ (A, B) → ¬ (A ≤ A' ∧ B' ≤ B) + +/-- `ℒ` `θ`-isolates `𝒯` modulo `W` (Graph Minors XX, Section 5, page 337): "{L}$ has order $< +\theta$, $\mathcal{L}^- \subseteq \mathcal{T}$, and for each $A \in +\mathcal{L}$ and every tangle $\mathcal{T}'$ in $G$ of order $\ge \theta$ with $((G +\setminus A)^-, A^-) \in \mathcal{T}'$, if $(C, D)$ is the $(\mathcal{T}, +\mathcal{T}')$-distinction then either $C \subseteq A^-$ and $(G \setminus A)^- \subseteq +D$, or $W \nsubseteq Z(D)$." -/ +structure IsolatesModulo (G : RootedHypergraph α β) (ℒ : Set (RootedHypergraph α β)) : Prop where + isRootedLocation : IsRootedLocation G ℒ + order_lt : ∀ ⦃A⦄, A ∈ ℒ → A.rootSet.ncard < θ + subset : rootedLocationToLocation G ℒ ⊆ 𝒯 + distinction : ∀ ⦃A⦄, A ∈ ℒ → ∀ ⦃θ' : ℕ⦄ ⦃𝒯' : Set (Hypergraph α β × Hypergraph α β)⦄, + IsTangle G.toHypergraph θ' 𝒯' → θ ≤ θ' → (complementHypergraph G A, A.toHypergraph) ∈ 𝒯' → + ∀ ⦃C D⦄, IsDistinction lam 𝒯 𝒯' C D → + (C ≤ A.toHypergraph ∧ complementHypergraph G A ≤ D) ∨ ¬ W ⊆ zSet D + +/-- `ℒ` is `W`-suitable (Graph Minors XX, Section 5, page 337), with respect to `θ`, `𝒯` and `λ`: +- `ℒ` is fine, and `ℒ⁻ ⊆ 𝒯`, and `ℒ` has order `< θ²`, +- for each tangle `𝒯'` in `G` of order `≥ θ²`, if `(C, D) ∈ ℒ⁻` and `(D, C) ∈ 𝒯'` and `(A, B)` is + the `(𝒯, 𝒯')`-distinction then either `A ⊆ C` and `D ⊆ B`, or `A ⊆ A*` and `B* ⊆ B` for some + `(A*, B*) ∈ ℳ(𝒯, W, θ)`. -/ +structure IsSuitable (G : RootedHypergraph α β) (ℒ : Set (RootedHypergraph α β)) : Prop where + isRootedLocation : IsRootedLocation G ℒ + fine : (∀ v ∈ G.vertexSet, ∃ A ∈ ℒ, v ∈ A.vertexSet) ∧ ∀ e ∈ G.edgeSet, ∃ A ∈ ℒ, e ∈ A.edgeSet + subset : rootedLocationToLocation G ℒ ⊆ 𝒯 + order_lt : ∀ ⦃A⦄, A ∈ ℒ → A.rootSet.ncard < θ ^ 2 + distinction : ∀ ⦃θ' : ℕ⦄ ⦃𝒯' : Set (Hypergraph α β × Hypergraph α β)⦄, + IsTangle G.toHypergraph θ' 𝒯' → θ ^ 2 ≤ θ' → ∀ ⦃C D⦄, (C, D) ∈ rootedLocationToLocation G ℒ → + (D, C) ∈ 𝒯' → ∀ ⦃A B⦄, IsDistinction lam 𝒯 𝒯' A B → + (A ≤ C ∧ D ≤ B) ∨ ∃ A' B', InM lam G.toHypergraph 𝒯 W θ A' B' ∧ A ≤ A' ∧ B' ≤ B + +end Distinction + +/-- A rooted location `ℒ` is fine if `⋃ (A⁻ : A ∈ ℒ) = G⁻` (Graph Minors XX, Section 5, page 337). +-/ +def IsFine (G : RootedHypergraph α β) (ℒ : Set (RootedHypergraph α β)) : Prop := + (∀ v ∈ G.vertexSet, ∃ A ∈ ℒ, v ∈ A.vertexSet) ∧ ∀ e ∈ G.edgeSet, ∃ A ∈ ℒ, e ∈ A.edgeSet + +/-! ## Section 6: eliminating the tie-breaker -/ + +/-- The weight `Σ (v(x) : x ∈ X)` of a set `X ⊆ Z(G)`. -/ +noncomputable def weight (G : Hypergraph α β) (v : α ⊕ β → ℝ) (X : Set (α ⊕ β)) : ℝ := + ∑ᶠ x ∈ X ∩ zSet G, v x + +/-- The triple `(|V(A ∩ B)|, Σ(v(x) : x ∈ Z(G) \ Z(A)), Σ(v(x) : x ∈ V(A ∩ B)))` (Graph Minors XX, +Section 6, page 342), for a separation `(A, B)` with `f ∈ E(A)`. -/ +noncomputable def edgeBasedTriple (G : Hypergraph α β) (v : α ⊕ β → ℝ) (A B : Hypergraph α β) : + ℝ ×ₗ ℝ ×ₗ ℝ := + toLex ((separationOrder A B : ℝ), + toLex (weight G v (zSet G \ zSet A), weight G v (Sum.inl '' (A ∩ B).vertexSet))) + +/-- The tie-breaker defined by `f, v` (Graph Minors XX, Section 6, page 342): `λ(A, B)` is the +triple +above for `f ∈ E(A)`, and "If $(A, B)$ is a separation with $f \in E(B)$, we define $\lambda(A, B) = +\lambda(B, A)$." -/ +noncomputable def edgeBasedLam (G : Hypergraph α β) (f : β) (v : α ⊕ β → ℝ) + (p : Hypergraph α β × Hypergraph α β) : ℝ ×ₗ ℝ ×ₗ ℝ := + open Classical in + if f ∈ p.1.edgeSet then edgeBasedTriple G v p.1 p.2 else edgeBasedTriple G v p.2 p.1 + +/-- `v` assigns positive, rationally independent reals to the members of `Z(G)` (Graph Minors XX, +Section 6, page 342). -/ +def IsIndependentWeight (G : Hypergraph α β) (v : α ⊕ β → ℝ) : Prop := + (∀ x ∈ zSet G, 0 < v x) ∧ LinearIndependent ℚ (fun x : zSet G ↦ v x) + +/-- `lam` is an edge-based tie-breaker in `G`, defined by `f, v` (Graph Minors XX, Section 6, +page 344). -/ +def IsDefinedBy (G : Hypergraph α β) (lam : Hypergraph α β × Hypergraph α β → ℝ ×ₗ ℝ ×ₗ ℝ) (f : β) + (v : α ⊕ β → ℝ) : Prop := + f ∈ G.edgeSet ∧ IsIndependentWeight G v ∧ ∀ A B, G.IsSeparation A B → lam (A, B) = + edgeBasedLam G f v (A, B) + +/-- `lam` is an edge-based tie-breaker in `G` (Graph Minors XX, Section 6, page 344). -/ +def IsEdgeBased (G : Hypergraph α β) (lam : Hypergraph α β × Hypergraph α β → ℝ ×ₗ ℝ ×ₗ ℝ) : Prop := + ∃ f v, IsDefinedBy G lam f v + +/-- `ℒ` is linked to `𝒯` (Graph Minors XX, Section 6, page 344): "{L}^- \subseteq \mathcal{T}$ and +for each $A \in \mathcal{L}$ there is no $(A', B') \in +\mathcal{T}$ of order less than $|\bar{\pi}(A)|$ with $A^- \subseteq A'$ and $B' \subseteq +(G \setminus A)^-$." -/ +def IsLinkedTo (G : RootedHypergraph α β) (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (ℒ : Set (RootedHypergraph α β)) : Prop := + rootedLocationToLocation G ℒ ⊆ 𝒯 ∧ ∀ ⦃A⦄, A ∈ ℒ → ∀ ⦃A' B'⦄, (A', B') ∈ 𝒯 → + A.toHypergraph ≤ A' → B' ≤ complementHypergraph G A → A.rootSet.ncard ≤ separationOrder A' B' + +/-- `ℒ/W = {A/W : A ∈ ℒ}` (Graph Minors XX, Section 6, page 344). -/ +noncomputable def locationSlash (ℒ : Set (RootedHypergraph α β)) (W : Set α) : + Set (RootedHypergraph α β) := + (fun A ↦ A.slash W) '' ℒ + +/-! ## Section 7: another adjustment -/ + +/-- A patchwork or `Ω`-patchwork is free if `Δ(e)` is free for all `e ∈ E(G)` (Graph Minors XX, +Section 7, page 346). -/ +def IsFree {Ω : Type*} (P : GM04.Patchwork Ω α β) : Prop := ∀ e ∈ P.G.edgeSet, (P.Δ e).IsFree + +/-! ## Section 8: surfaces and paintings -/ + +/-- A painting in a surface (Graph Minors XX, Section 8, page 347): +"A *painting* $\Gamma$ in a surface $\Sigma$ is a triple $(U, N, \gamma)$, where $U \subseteq +\Sigma$ is closed, $N \subseteq U$ is finite, and +- $bd(\Sigma) \subseteq U$, and $U \setminus N$ has only finitely many arc-wise connected +components, called *cells*, +- for each cell $c$, $\bar{c}$ is a closed disc and $|\tilde{c}| = 2$ or 3 and $\bar{c} \cap N = +\tilde{c} \subseteq bd(\bar{c})$, +- for each cell $c$, if $c \cap bd(\Sigma) \ne \emptyset$ then $|\tilde{c}| = 2$, and $\bar{c} \cap +bd(\Sigma)$ is a line and its ends are the members of $\tilde{c}$, +- for each cell $c$, $\gamma(c)$ is a march $\mu$ with $\bar{\mu} = \tilde{c}$," -/ +structure Painting (S : Type) [TopologicalSpace S] where + /-- The set `U(Γ)`. -/ + U : Set S + /-- The set `N(Γ)` of nodes. -/ + N : Set S + /-- The march `γ(c)` of a cell. -/ + γ : Set S → List S + isClosed_U : IsClosed U + N_subset : N ⊆ U + finite_N : N.Finite + bd_subset : bd S ⊆ U + finite_cells : (arcComponentsIn (U \ N)).Finite + cell_disc : ∀ c ∈ arcComponentsIn (U \ N), IsClosedDisc (closure c) + cell_size : ∀ c ∈ arcComponentsIn (U \ N), (tilde c).Finite ∧ + ((tilde c).ncard = 2 ∨ (tilde c).ncard = 3) + closure_inter : ∀ c ∈ arcComponentsIn (U \ N), closure c ∩ N = tilde c + tilde_subset : ∀ c ∈ arcComponentsIn (U \ N), tilde c ⊆ discBd (closure c) + border_cell : ∀ c ∈ arcComponentsIn (U \ N), (c ∩ bd S).Nonempty → + (tilde c).ncard = 2 ∧ IsLine (closure c ∩ bd S) ∧ lineEnds (closure c ∩ bd S) = tilde c + γ_nodup : ∀ c ∈ arcComponentsIn (U \ N), (γ c).Nodup + γ_set : ∀ c ∈ arcComponentsIn (U \ N), {n | n ∈ γ c} = tilde c + +namespace Painting + +variable {S : Type} [TopologicalSpace S] + +/-- The set `𝒞(Γ)` of cells. -/ +def C (Γ : Painting S) : Set (Set S) := arcComponentsIn (Γ.U \ Γ.N) + +/-- A cell `c` is a border cell if `c ∩ bd(Σ) ≠ ∅` (Graph Minors XX, Section 8, page 348). -/ +def IsBorder (c : Set S) : Prop := (c ∩ bd S).Nonempty + +/-- `Γ` is 3-connected (Graph Minors XX, Section 8, page 348): "- for every $\Gamma$-normal O-arc +$F$ in $\Sigma$ with $|F \cap N(\Gamma)| \le 2$ there is a +closed disc $\Delta \subseteq \Sigma$ with $bd(\Delta) = F$ which includes at most one cell +of $\Gamma$ and with $\Delta \cap N(\Gamma) \subseteq F$, - for every $\Gamma$-normal line +$F$ in $\Sigma$ with $|F \cap N(\Gamma)| \le 2$ and with both ends in $bd(\Sigma)$ and with +no other point in $bd(\Sigma)$, there is a closed disc $\Delta \subseteq \Sigma$ with $F +\subseteq bd(\Delta) \subseteq F \cup bd(\Sigma)$ which includes at most one cell of +$\Gamma$ and with $\Delta \cap N(\Gamma) \subseteq F$." -/ +def IsThreeConnected (Γ : Painting S) : Prop := + (∀ F : Set S, IsOArc F → F ∩ Γ.U ⊆ Γ.N → (F ∩ Γ.N).ncard ≤ 2 → + ∃ Δ : Set S, IsClosedDisc Δ ∧ discBd Δ = F ∧ {c ∈ Γ.C | c ⊆ Δ}.ncard ≤ 1 ∧ Δ ∩ Γ.N ⊆ F) ∧ + (∀ F : Set S, IsLine F → F ∩ Γ.U ⊆ Γ.N → (F ∩ Γ.N).ncard ≤ 2 → F ∩ bd S = lineEnds F → + ∃ Δ : Set S, IsClosedDisc Δ ∧ F ⊆ discBd Δ ∧ discBd Δ ⊆ F ∪ bd S ∧ + {c ∈ Γ.C | c ⊆ Δ}.ncard ≤ 1 ∧ Δ ∩ Γ.N ⊆ F) + +/-- The skeleton `sk(Γ)` (Graph Minors XX, Section 8, page 348): for distinct `n₁, n₂ ∈ N(Γ)`, they +are adjacent if and only if there is a cell `c` with `n₁, n₂ ∈ cTilde`. -/ +def sk (Γ : Painting S) : SimpleGraph S where + Adj x y := x ≠ y ∧ x ∈ Γ.N ∧ y ∈ Γ.N ∧ ∃ c ∈ Γ.C, x ∈ tilde c ∧ y ∈ tilde c + symm := ⟨fun _ _ ⟨h, hx, hy, c, hc, hxc, hyc⟩ ↦ ⟨h.symm, hy, hx, c, hc, hyc, hxc⟩⟩ + loopless := ⟨fun _ h ↦ h.1 rfl⟩ + +end Painting + +/-- A linear inflation of `Γ` in `Γ'` (Graph Minors XX, Section 8, page 348), the seven conditions +of +the paper. The non-null induced connected subgraph `ζ(n)` of `sk(Γ')` is given by its vertex set +`ζn n`. -/ +structure IsLinearInflation {S : Type} [TopologicalSpace S] (Γ Γ' : Painting S) (ζn : S → Set S) + (ζc : Set S → Set S) : Prop where + /-- First condition. -/ + cell_mem : ∀ c ∈ Γ.C, ζc c ∈ Γ'.C + cell_size : ∀ c ∈ Γ.C, (tilde (ζc c)).ncard = (tilde c).ncard + borders_iff : ∀ c ∈ Γ.C, ∀ Θ ∈ cuffs S, (c ∩ Θ).Nonempty ↔ (ζc c ∩ Θ).Nonempty + /-- Second condition. -/ + cell_injOn : InjOn ζc Γ.C + /-- Third condition. -/ + orientation : ∀ c ∈ Γ.C, ∀ Θ ∈ cuffs S, (c ∩ Θ).Nonempty → ∀ f : Circle ≃ₜ Θ, + ∀ n n', (Γ.γ c).head? = some n → (Γ'.γ (ζc c)).head? = some n' → + GM19.ImmediatelyPrecedes f n (c ∩ Θ) → GM19.ImmediatelyPrecedes f n' (ζc c ∩ Θ) + /-- Fourth condition. -/ + node_nonempty : ∀ n ∈ Γ.N, (ζn n).Nonempty + node_subset : ∀ n ∈ Γ.N, ζn n ⊆ Γ'.N + node_connected : ∀ n ∈ Γ.N, (Γ'.sk.induce (ζn n)).Preconnected + /-- Fifth condition. -/ + node_disjoint : ∀ n₁ ∈ Γ.N, ∀ n₂ ∈ Γ.N, n₁ ≠ n₂ → Disjoint (ζn n₁) (ζn n₂) + /-- Sixth condition: "$n$ is the $i$th node of $c$ if and only if $\zeta(n)$ contains the $i$th + node of $\zeta(c)$". -/ + nodes : ∀ n ∈ Γ.N, ∀ c ∈ Γ.C, ∀ (i : ℕ) (hi : i < (Γ.γ c).length) + (hi' : i < (Γ'.γ (ζc c)).length), (Γ.γ c)[i] = n ↔ (Γ'.γ (ζc c))[i] ∈ ζn n + /-- Seventh condition. -/ + border_cell : ∀ c' ∈ Γ'.C, Painting.IsBorder c' → c' ∉ ζc '' Γ.C → ∃ n ∈ Γ.N, tilde c' ⊆ ζn n + +/-! ## Section 9: patchworks from a surface -/ + +/-- A graded surface `(Σ, ρ)` (Graph Minors XX, Section 9, page 348): a surface `Σ` (compact and +connected, with possibly null boundary) and an integer `ρ(Θ) ≥ 0` for each cuff `Θ`. -/ +structure GradedSurface where + /-- The surface `Σ`. -/ + S : Type + /-- The topology of `Σ`. -/ + [top : TopologicalSpace S] + isSurface : IsSurface S + connected : ConnectedSpace S + /-- The grading `ρ`. -/ + ρ : Set S → ℕ + +attribute [instance] GradedSurface.top + +/-- `(Γ, β)` is a `(Σ, ρ)`-hull for a hypergraph `G` (Graph Minors XX, Section 9, pages 348–349). +The paper has `N(Γ) ⊆ V(G)` and `𝒞(Γ) = E(G)`. Here vertices of `G` lie in `α` and edges in `β`, so +the identification is given by an injection `node` of `N(Γ)` into `V(G)` and a bijection `cell` from +`𝒞(Γ)` onto `E(G)`. -/ +structure Hull {X : GradedSurface} (Γ : Painting X.S) (G : Hypergraph α β) where + /-- The vertex of `G` that is a node of `Γ`. -/ + node : X.S → α + /-- The edge of `G` that is a cell of `Γ`. -/ + cell : Set X.S → β + /-- The set `β(n)` for a border node `n`. -/ + border : X.S → Set α + node_injOn : InjOn node Γ.N + node_mem : ∀ n ∈ Γ.N, node n ∈ G.vertexSet + cell_bijOn : BijOn cell Γ.C G.edgeSet + /-- "for each $n \in N(\Gamma)$ and $c \in C(\Gamma)$, $n \in \tilde{c}$ if and only if $n$ is + incident with $c$ in $G$". -/ + inc_iff : ∀ n ∈ Γ.N, ∀ c ∈ Γ.C, n ∈ tilde c ↔ G.Inc (cell c) (node n) + border_subset : ∀ n ∈ Γ.N ∩ bd X.S, border n ⊆ G.vertexSet + /-- "`β(n) ∩ N(Γ) = ∅`". -/ + border_disjoint : ∀ n ∈ Γ.N ∩ bd X.S, Disjoint (border n) (node '' Γ.N) + /-- "$|\beta(n)| = \rho(\Theta)$, where $\Theta$ is the cuff bordered by $n$". -/ + border_ncard : ∀ Θ ∈ cuffs X.S, ∀ n ∈ Γ.N ∩ Θ, (border n).ncard = X.ρ Θ + /-- "for nodes $n_1, n_2$ bordering distinct cuffs, $\beta(n_1) \cap \beta(n_2) = \emptyset$". -/ + border_cuffs : ∀ Θ₁ ∈ cuffs X.S, ∀ Θ₂ ∈ cuffs X.S, Θ₁ ≠ Θ₂ → ∀ n₁ ∈ Γ.N ∩ Θ₁, ∀ n₂ ∈ Γ.N ∩ Θ₂, + Disjoint (border n₁) (border n₂) + /-- "V(G) = N(\Gamma) \cup \bigcup (\beta(n) : n \in N(\Gamma) \cap bd(\Sigma))". -/ + vertexSet_eq : G.vertexSet = node '' Γ.N ∪ ⋃ n ∈ Γ.N ∩ bd X.S, border n + /-- "for each internal cell $c$, the set of ends of $c$ in $G$ is $\tilde{c}$". -/ + ends_internal : ∀ c ∈ Γ.C, ¬ Painting.IsBorder c → G.ends (cell c) = node '' tilde c + /-- "for each border cell $c$ with $n_1, n_2$ the set of ends of $c$ in $G$ is $\beta(n_1) \cup + \beta(n_2) \cup \{n_1, n_2". -/ + ends_border : ∀ c ∈ Γ.C, Painting.IsBorder c → + G.ends (cell c) = node '' tilde c ∪ ⋃ n ∈ tilde c, border n + /-- "if $n_1, n_2, n_3, n_4 \in N(\Gamma)$ border the same cuff in order, then $\beta(n_1) \cap + \beta(n_3) \subseteq \beta(n_2) \cup \beta(n_4)$". -/ + border_order : ∀ Θ ∈ cuffs X.S, ∀ n₁ ∈ Γ.N ∩ Θ, ∀ n₂ ∈ Γ.N ∩ Θ, ∀ n₃ ∈ Γ.N ∩ Θ, ∀ n₄ ∈ Γ.N ∩ Θ, + GM19.InOrderOn Θ n₁ n₂ n₃ n₄ → border n₁ ∩ border n₃ ⊆ border n₂ ∪ border n₄ + +/-- `M` is a pairing as in the second part of the definition of `(Σ, ρ)`-hulled (Graph Minors XX, +Section 9, page 349): a pairing `M_c` with `V(M_c) = β(n₁) ∪ β(n₂) ∪ {n₁, n₂}`, such that `n₁, n₂` +are +adjacent in `M_c`, and `M_c` has `|β(n₁)| + 1 = |β(n₂)| + 1` components, each containing one vertex +of `β(n₁) ∪ {n₁}` and one of `β(n₂) ∪ {n₂}` (possibly the same). -/ +structure IsCellPairing {X : GradedSurface} {Γ : Painting X.S} {G : Hypergraph α β} + (h : Hull Γ G) (n₁ n₂ : X.S) (M : (⊤ : SimpleGraph α).Subgraph) : Prop where + isPairing : GM04.IsPairing M.verts M + verts_eq : M.verts = h.border n₁ ∪ h.border n₂ ∪ {h.node n₁, h.node n₂} + adj : M.Adj (h.node n₁) (h.node n₂) + components : ∀ D, GM04.IsComponent M D → + (D.verts ∩ (h.border n₁ ∪ {h.node n₁})).ncard = 1 ∧ + (D.verts ∩ (h.border n₂ ∪ {h.node n₂})).ncard = 1 + +/-- The patchwork `P = (G, μ, Δ)` is `(Σ, ρ)`-hulled by `(Γ, h)` (Graph Minors XX, Section 9, +page 349). -/ +structure IsHulledBy {X : GradedSurface} {Γ : Painting X.S} (P : UnlabeledPatchwork α β) + (h : Hull Γ P.G.toHypergraph) : Prop where + three_connected : Γ.IsThreeConnected + /-- "for each internal cell $c \in C(\Gamma)$, $\Delta(c)$ is free". -/ + free_internal : ∀ c ∈ Γ.C, ¬ Painting.IsBorder c → (P.Δ (h.cell c)).IsFree + /-- The second condition: the pairing `M_c`. -/ + border_pairing : ∀ c ∈ Γ.C, Painting.IsBorder c → ∀ n₁ ∈ tilde c, ∀ n₂ ∈ tilde c, n₁ ≠ n₂ → + ∃ M, IsCellPairing h n₁ n₂ M ∧ (M ∈ P.Δ (h.cell c) ∨ + (M.deleteEdges {s(h.node n₁, h.node n₂)} ∈ P.Δ (h.cell c) ∧ + ∃ c' ∈ Γ.C, ¬ Painting.IsBorder c' ∧ n₁ ∈ tilde c' ∧ n₂ ∈ tilde c')) + /-- "`π(G) = 0` and `dom(μ) = E(G)`". -/ + roots_nil : P.G.roots = [] + dom_eq : P.dom = P.G.edgeSet + /-- "for each internal cell $c$, and for $1 \le i \le |\tilde{c}|$ the $i$th term of $\mu(c)$ is + the $i$th node of $c$". -/ + μ_internal : ∀ c ∈ Γ.C, ¬ Painting.IsBorder c → P.μ (h.cell c) = (Γ.γ c).map h.node + +/-- `P` is `(Σ, ρ)`-hulled (Graph Minors XX, Section 9, page 349). -/ +def IsHulled (X : GradedSurface) (P : UnlabeledPatchwork α β) : Prop := + ∃ (Γ : Painting X.S) (h : Hull Γ P.G.toHypergraph), IsHulledBy P h + +/-! ## Section 10: excluding a minor -/ + +/-- `(P, ℒ)` is `(Σ, ρ)`-shelled (Graph Minors XX, Section 10, pages 353–354), for a free rootless +patchwork `P`: `ℒ` is fine and there is a heart `P'` of `(P, ℒ)` with `E(G') = {e(A) : A ∈ ℒ}`, and +a +`(Σ, ρ)`-hull `(Γ, h)` for `G'⁻`, such that the two conditions on cells hold. -/ +def IsShelled (X : GradedSurface) (P : UnlabeledPatchwork α β) (ℒ : Set (RootedHypergraph α β)) : + Prop := + IsFine P.G ℒ ∧ ∃ (newEdge : RootedHypergraph α β → β) (P' : UnlabeledPatchwork α β) + (Γ : Painting X.S) (h : Hull Γ P'.G.toHypergraph), + IsPatchworkHeart P ℒ newEdge P' ∧ P'.G.edgeSet = newEdge '' ℒ ∧ Γ.IsThreeConnected ∧ + (∀ c ∈ Γ.C, ∀ A ∈ ℒ, h.cell c = newEdge A → ¬ Painting.IsBorder c → + A.roots = (Γ.γ c).map h.node ∧ + ∀ K : (⊤ : SimpleGraph α).Subgraph, GM04.IsGrouping (h.node '' tilde c) K → + K.verts = h.node '' tilde c → + ∃ C : SimpleGraph α, C ≤ A.toHypergraph.skeleton ∧ ∀ x ∈ K.verts, ∀ y ∈ K.verts, x ≠ y → + (C.Reachable x y ↔ K.Adj x y)) ∧ + (∀ c ∈ Γ.C, ∀ A ∈ ℒ, h.cell c = newEdge A → ∀ Θ ∈ cuffs X.S, (c ∩ Θ).Nonempty → + ∀ n₁ ∈ tilde c, ∀ n₂ ∈ tilde c, n₁ ≠ n₂ → + ∃ L : Fin (X.ρ Θ) → PathFromTo A.toHypergraph.skeleton (h.border n₁) (h.border n₂), + (Pairwise fun i j ↦ Disjoint {z | z ∈ (L i).walk.support} {z | z ∈ (L j).walk.support}) ∧ + (∀ i, h.node n₁ ∉ (L i).walk.support ∧ h.node n₂ ∉ (L i).walk.support) ∧ + ((∃ L₀ : PathFromTo A.toHypergraph.skeleton {h.node n₁} {h.node n₂}, + ∀ i, Disjoint {z | z ∈ L₀.walk.support} {z | z ∈ (L i).walk.support}) ∨ + ∃ c' ∈ Γ.C, ¬ Painting.IsBorder c' ∧ n₁ ∈ tilde c' ∧ n₂ ∈ tilde c')) + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Directed.lean b/LeanPool/GraphMinor/GM20/Directed.lean new file mode 100644 index 0000000000..a35879bb51 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Directed.lean @@ -0,0 +1,936 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section10c +public import LeanPool.GraphMinor.GM04.Patchwork.Main +public import LeanPool.GraphMinor.Minor.Basic + +/-! +# Directed graphs, directed minors, and directed patchworks for Graph Minors XX, (10.5) + +This file formalizes directed graphs, directed minors ("A directed graph is a minor of another if +the first can be obtained from a subgraph of the second by contracting edges.", Graph Minors XX, +Section 10, page 355), and the directed patchwork and minor-model lemmas used in the proof of +`GM20.theorem_10_5_proof`: + +* `Digraph`: a directed multigraph consisting of an underlying `Graph α β` (`toGraph`) together with + `tail` and `head` maps on `E(toGraph)` such that `toGraph.IsLink e.1 (tail e) (head e)` for every + `e : E(toGraph)`. +* `Digraph.ofSubgraph`, `Digraph.contract`, `Digraph.Iso`, `Digraph.IsIsoMinor`: subgraphs, edge + contractions, isomorphisms, and the minor relation for directed graphs. +* `IsDirMinorModel` and `isIsoMinor_of_isDirMinorModel`: directed minor models (Graph Minors IV, + Section 7, pages 242–243, with tail and head preserved) and the construction of a directed minor + from a model. +* `isDirMinorModel_of_hasCliqueMinor` and `isIsoMinor_of_hasCliqueMinor`: "Let $p = 2|E(G_1)| + + |V(G_1)|$; then every tournament with $p$ vertices has a minor isomorphic to $G_1$." (Graph Minors + XX, page 355). +* `digraphPatchwork`, `isFree_digraphPatchwork`, and `isDirMinorModel_of_simulated`: the free + `Unit`-patchwork of a finite directed graph where `μ(e)` lists the ends of `e` tail first, and the + deduction of a directed minor model from simulation. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Graph Relation GraphMinor.GM18 GraphMinor.GM04 + +universe u v u' v' u'' v'' + +variable {α : Type u} {β : Type v} {α' : Type u'} {β' : Type v'} {α'' : Type u''} {β'' : Type v''} + +/-! ### Directed graphs, subgraphs, contractions, and minors -/ + +/-- A directed graph (allowing loops and multiple edges), represented by its underlying undirected +graph `toGraph : Graph α β` together with `tail` and `head` functions assigning to each edge +`e : E(toGraph)` its tail and head. -/ +structure Digraph (α : Type u) (β : Type v) where + /-- The underlying undirected graph $G'$ of $G$. -/ + toGraph : Graph α β + /-- The tail of each edge of `toGraph`. -/ + tail : E(toGraph) → α + /-- The head of each edge of `toGraph`. -/ + head : E(toGraph) → α + /-- Every edge `e : E(toGraph)` links `tail e` and `head e` in `toGraph`. -/ + isLink_of_mem : ∀ e : E(toGraph), toGraph.IsLink e.1 (tail e) (head e) + +namespace Digraph + +theorem tail_mem (G : Digraph α β) (e : E(G.toGraph)) : G.tail e ∈ V(G.toGraph) := + (G.isLink_of_mem e).left_mem + +theorem head_mem (G : Digraph α β) (e : E(G.toGraph)) : G.head e ∈ V(G.toGraph) := + (G.isLink_of_mem e).right_mem + +theorem inc_tail (G : Digraph α β) (e : E(G.toGraph)) : G.toGraph.Inc e.1 (G.tail e) := + (G.isLink_of_mem e).inc_left + +theorem inc_head (G : Digraph α β) (e : E(G.toGraph)) : G.toGraph.Inc e.1 (G.head e) := + (G.isLink_of_mem e).inc_right + +/-- A subgraph `H ≤ G.toGraph` of the underlying undirected graph inherits the edge orientations of +`G` to form a directed subgraph of `G`. -/ +def ofSubgraph (G : Digraph α β) (H : Graph α β) (hH : H ≤ G.toGraph) : Digraph α β where + toGraph := H + tail e := G.tail ⟨e.1, hH.edgeSet_mono e.2⟩ + head e := G.head ⟨e.1, hH.edgeSet_mono e.2⟩ + isLink_of_mem e := (hH.isLink_iff e.2).2 (G.isLink_of_mem ⟨e.1, hH.edgeSet_mono e.2⟩) + +@[simp] +theorem ofSubgraph_toGraph (G : Digraph α β) (H : Graph α β) (hH : H ≤ G.toGraph) : + (G.ofSubgraph H hH).toGraph = H := rfl + +@[simp] +theorem ofSubgraph_tail (G : Digraph α β) (H : Graph α β) (hH : H ≤ G.toGraph) (e : E(H)) : + (G.ofSubgraph H hH).tail e = G.tail ⟨e.1, hH.edgeSet_mono e.2⟩ := rfl + +@[simp] +theorem ofSubgraph_head (G : Digraph α β) (H : Graph α β) (hH : H ≤ G.toGraph) (e : E(H)) : + (G.ofSubgraph H hH).head e = G.head ⟨e.1, hH.edgeSet_mono e.2⟩ := rfl + +/-- The vertex set of the component of `v` used by `GraphMinor.contract`. -/ +abbrev comp (G : Graph α β) (C : Set β) (v : α) : Set α := + contractComponent G C v + +theorem contract_isLink (G : Graph α β) (C : Set β) (e : β) (X Y : Set α) : + (GraphMinor.contract G C).IsLink e X Y ↔ + e ∉ C ∧ ∃ x y, G.IsLink e x y ∧ comp G C x = X ∧ comp G C y = Y := + GraphMinor.contract_isLink G C e X Y + +theorem vertexSet_contract (G : Graph α β) (C : Set β) : + V(GraphMinor.contract G C) = comp G C '' V(G) := + GraphMinor.vertexSet_contract G C + +theorem edgeSet_contract (G : Graph α β) (C : Set β) : + E(GraphMinor.contract G C) = E(G) \ C := + GraphMinor.edgeSet_contract G C + +theorem mem_vertexSet_contract {G : Graph α β} {C : Set β} {X : Set α} : + X ∈ V(GraphMinor.contract G C) ↔ ∃ v ∈ V(G), comp G C v = X := + GraphMinor.mem_vertexSet_contract + +theorem mem_edgeSet_contract {G : Graph α β} {C : Set β} {e : β} : + e ∈ E(GraphMinor.contract G C) ↔ e ∈ E(G) ∧ e ∉ C := + GraphMinor.mem_edgeSet_contract + +/-- The directed graph obtained from `G` by contracting the edges in `C`. Its underlying undirected +graph is `GraphMinor.contract G.toGraph C`, and each uncontracted edge `e` has tail and head equal +to +the `C`-components of `G.tail` and `G.head`. -/ +def contract (G : Digraph α β) (C : Set β) : Digraph (Set α) β where + toGraph := GraphMinor.contract G.toGraph C + tail e := comp G.toGraph C (G.tail ⟨e.1, (mem_edgeSet_contract.1 e.2).1⟩) + head e := comp G.toGraph C (G.head ⟨e.1, (mem_edgeSet_contract.1 e.2).1⟩) + isLink_of_mem e := by + have he := mem_edgeSet_contract.1 e.2 + rw [contract_isLink] + exact ⟨he.2, _, _, G.isLink_of_mem ⟨e.1, he.1⟩, rfl, rfl⟩ + +@[simp] +theorem contract_toGraph (G : Digraph α β) (C : Set β) : + (G.contract C).toGraph = GraphMinor.contract G.toGraph C := rfl + +@[simp] +theorem contract_tail (G : Digraph α β) (C : Set β) (e : E((G.contract C).toGraph)) : + (G.contract C).tail e = comp G.toGraph C (G.tail ⟨e.1, (mem_edgeSet_contract.1 e.2).1⟩) := rfl + +@[simp] +theorem contract_head (G : Digraph α β) (C : Set β) (e : E((G.contract C).toGraph)) : + (G.contract C).head e = comp G.toGraph C (G.head ⟨e.1, (mem_edgeSet_contract.1 e.2).1⟩) := rfl + +/-- An isomorphism of directed graphs: an isomorphism of the underlying undirected graphs that +preserves the tail and head of every edge. -/ +structure Iso (H : Digraph α' β') (G : Digraph α β) extends GraphMinor.Iso H.toGraph G.toGraph where + /-- The vertex equivalence preserves the tail of every edge. -/ + tail_eq (e : E(H.toGraph)) : + (vertexEquiv ⟨H.tail e, H.tail_mem e⟩).1 = G.tail (edgeEquiv e) + /-- The vertex equivalence preserves the head of every edge. -/ + head_eq (e : E(H.toGraph)) : + (vertexEquiv ⟨H.head e, H.head_mem e⟩).1 = G.head (edgeEquiv e) + +/-- The identity isomorphism of a directed graph. -/ +def Iso.refl (G : Digraph α β) : Iso G G where + vertexEquiv := Equiv.refl _ + edgeEquiv := Equiv.refl _ + isLink_iff _ _ _ := Iff.rfl + tail_eq _ := rfl + head_eq _ := rfl + +/-- The inverse of a directed graph isomorphism. -/ +def Iso.symm {H : Digraph α' β'} {G : Digraph α β} (φ : Iso H G) : Iso G H where + vertexEquiv := φ.vertexEquiv.symm + edgeEquiv := φ.edgeEquiv.symm + isLink_iff e x y := by + have h := φ.isLink_iff (φ.edgeEquiv.symm e) (φ.vertexEquiv.symm x) (φ.vertexEquiv.symm y) + simp only [Equiv.apply_symm_apply] at h + exact h.symm + tail_eq e := by + have h := φ.tail_eq (φ.edgeEquiv.symm e) + have hsub : ⟨G.tail e, G.tail_mem e⟩ = + φ.vertexEquiv ⟨H.tail (φ.edgeEquiv.symm e), H.tail_mem (φ.edgeEquiv.symm e)⟩ := by + apply Subtype.ext + rw [h, Equiv.apply_symm_apply] + exact congrArg Subtype.val (φ.vertexEquiv.symm_apply_eq.2 hsub) + head_eq e := by + have h := φ.head_eq (φ.edgeEquiv.symm e) + have hsub : ⟨G.head e, G.head_mem e⟩ = + φ.vertexEquiv ⟨H.head (φ.edgeEquiv.symm e), H.head_mem (φ.edgeEquiv.symm e)⟩ := by + apply Subtype.ext + rw [h, Equiv.apply_symm_apply] + exact congrArg Subtype.val (φ.vertexEquiv.symm_apply_eq.2 hsub) + +/-- The composition of two directed graph isomorphisms. -/ +def Iso.trans {H : Digraph α'' β''} {K : Digraph α' β'} {G : Digraph α β} + (φ : Iso H K) (ψ : Iso K G) : Iso H G where + vertexEquiv := φ.vertexEquiv.trans ψ.vertexEquiv + edgeEquiv := φ.edgeEquiv.trans ψ.edgeEquiv + isLink_iff e x y := (φ.isLink_iff e x y).trans (ψ.isLink_iff _ _ _) + tail_eq e := by + have h₁ : φ.vertexEquiv ⟨H.tail e, H.tail_mem e⟩ = + ⟨K.tail (φ.edgeEquiv e), K.tail_mem (φ.edgeEquiv e)⟩ := Subtype.ext (φ.tail_eq e) + change (ψ.vertexEquiv (φ.vertexEquiv ⟨H.tail e, H.tail_mem e⟩)).1 = + G.tail (ψ.edgeEquiv (φ.edgeEquiv e)) + rw [h₁, ψ.tail_eq] + head_eq e := by + have h₁ : φ.vertexEquiv ⟨H.head e, H.head_mem e⟩ = + ⟨K.head (φ.edgeEquiv e), K.head_mem (φ.edgeEquiv e)⟩ := Subtype.ext (φ.head_eq e) + change (ψ.vertexEquiv (φ.vertexEquiv ⟨H.head e, H.head_mem e⟩)).1 = + G.head (ψ.edgeEquiv (φ.edgeEquiv e)) + rw [h₁, ψ.head_eq] + +/-- Graph Minors XX, Section 10 (page 355): "A directed graph is a minor of another if the first can +be obtained from a subgraph of the second by contracting edges." +`H.IsIsoMinor G` means that `H` is isomorphic to a directed minor of `G`. -/ +def IsIsoMinor (H : Digraph α' β') (G : Digraph α β) : Prop := + ∃ (G' : Graph α β) (hG' : G' ≤ G.toGraph) (C : Set β), + C ⊆ E(G') ∧ Nonempty (Iso H ((G.ofSubgraph G' hG').contract C)) + +/-- Any undirected graph `G` can be given an orientation of its edges to form a directed graph with +underlying graph `G`. -/ +noncomputable def ofGraph (G : Graph α β) : Digraph α β where + toGraph := G + tail e := (exists_isLink_of_mem_edgeSet e.2).choose + head e := (exists_isLink_of_mem_edgeSet e.2).choose_spec.choose + isLink_of_mem e := (exists_isLink_of_mem_edgeSet e.2).choose_spec.choose_spec + +@[simp] +theorem ofGraph_toGraph (G : Graph α β) : (ofGraph G).toGraph = G := rfl + +/-- If `H` is isomorphic to a directed minor of `G`, then the underlying undirected graph +`H.toGraph` +is isomorphic to an undirected minor of `G.toGraph`. -/ +theorem IsIsoMinor.toGraph {H : Digraph α' β'} {G : Digraph α β} + (h : H.IsIsoMinor G) : GraphMinor.IsIsoMinor H.toGraph G.toGraph := by + obtain ⟨G', hG', C, hC, ⟨φ⟩⟩ := h + exact ⟨G', hG', C, hC, ⟨φ.toIso⟩⟩ + +theorem Iso.isIsoMinor_left {H₁ : Digraph α'' β''} {H₂ : Digraph α' β'} {G : Digraph α β} + (φ : Iso H₁ H₂) (h : H₂.IsIsoMinor G) : H₁.IsIsoMinor G := by + obtain ⟨G', hG', C, hC, ⟨ψ⟩⟩ := h + exact ⟨G', hG', C, hC, ⟨Iso.trans φ ψ⟩⟩ + +end Digraph + +/-! ### Directed minor models and construction of a directed minor from a model -/ + +/-- A model `(ηv, ηe)` of a directed graph `H` in a directed graph `G` (Graph Minors IV, Section 7, +pages 242–243): a model of `H.toGraph` in `G.toGraph` such that for every edge `e` of `H`, the tail +of `ηe e` in `G` belongs to `ηv (H.tail e)` and the head of `ηe e` in `G` belongs to +`ηv (H.head e)`. -/ +structure IsDirMinorModel (H : Digraph α' β') (G : Digraph α β) (ηv : α' → Set α) (ηe : β' → β) : + Prop extends IsMinorModel H.toGraph G.toGraph ηv ηe where + /-- The tail of `ηe e` lies in the branch set of the tail of `e`. -/ + tail_mem : ∀ e : E(H.toGraph), G.tail ⟨ηe e.1, edge_mem e.1 e.2⟩ ∈ ηv (H.tail e) + /-- The head of `ηe e` lies in the branch set of the head of `e`. -/ + head_mem : ∀ e : E(H.toGraph), G.head ⟨ηe e.1, edge_mem e.1 e.2⟩ ∈ ηv (H.head e) + +section DirModelToMinor + +variable {H : Digraph α' β'} {G : Digraph α β} {ηv : α' → Set α} {ηe : β' → β} + +/-- A directed minor model gives a directed minor. This is the step in the proof of Graph Minors XX, +(10.5), page 356, that invokes Graph Minors IV, Section 7, pages 242–243 (reference [1] in XX, +misprinted as [2] on page 356). -/ +theorem isIsoMinor_of_isDirMinorModel (h : IsDirMinorModel H G ηv ηe) : H.IsIsoMinor G := by + let hm := h.toIsMinorModel + refine ⟨modelSubgraph hm, modelSubgraph_le hm, modelContractEdges hm, + modelContractEdges_subset hm, ⟨?_⟩⟩ + exact + { toIso := modelContractionIso hm + tail_eq := fun e ↦ + (comp_modelSubgraph_eq hm (H.tail_mem e) (h.tail_mem e)).symm + head_eq := fun e ↦ + (comp_modelSubgraph_eq hm (H.head_mem e) (h.head_mem e)).symm } + +end DirModelToMinor + +/-! ### Tournaments with $p = 2|E(G_1)| + |V(G_1)|$ vertices have $G_1$ as a minor -/ + +private theorem isLink_of_inc_of_ne_aux {G : Graph α β} {e : β} {x y : α} (hx : G.Inc e x) + (hy : G.Inc e y) (hne : x ≠ y) : G.IsLink e x y := by + have h₁ := hx.isLink_other + rcases hy.eq_or_eq_of_isLink h₁ with h | h + · exact absurd h.symm hne + · rw [h] + exact h₁ + +/-- Graph Minors XX, proof of (10.5) (page 355): "Let $p = 2|E(G_1)| + |V(G_1)|$; then every +tournament with $p$ vertices has a minor isomorphic to $G_1$.", in minor-model form. -/ +theorem isDirMinorModel_of_hasCliqueMinor [Nonempty β] {H : Digraph α' β'} {G : Digraph α β} + (hVH : V(H.toGraph).Finite) (hEH : E(H.toGraph).Finite) + (hVG : V(G.toGraph).Finite) (hEG : E(G.toGraph).Finite) {p : ℕ} + (hp : V(H.toGraph).ncard + 2 * E(H.toGraph).ncard ≤ p) + (hc : HasCliqueMinor (Hypergraph.ofGraph G.toGraph hVG hEG) p) : + ∃ (ηv : α' → Set α) (ηe : β' → β), IsDirMinorModel H G ηv ηe := by + classical + obtain ⟨a, h₁, h₂, h₃⟩ := hc + have : Finite V(H.toGraph) := hVH + have : Finite E(H.toGraph) := hEH + let ι := V(H.toGraph) ⊕ (E(H.toGraph) × Bool) + have : Fintype ι := Fintype.ofFinite ι + have hcard : Fintype.card ι ≤ Fintype.card (Fin p) := by + have h₄ : Nat.card ι = V(H.toGraph).ncard + E(H.toGraph).ncard * 2 := by + rw [show Nat.card ι = _ + _ from Nat.card_sum, Nat.card_prod, Nat.card_coe_set_eq, + Nat.card_coe_set_eq, Nat.card_eq_fintype_card (α := Bool), Fintype.card_bool] + rw [Fintype.card_fin, ← Nat.card_eq_fintype_card, h₄] + omega + obtain ⟨j⟩ := Function.Embedding.nonempty_of_card_le hcard + let b : ι → Set α := fun i ↦ a (j i) + have hne' : ∀ {i i' : ι}, i ≠ i' → j i ≠ j i' := fun h h' ↦ h (j.injective h') + have huniq : ∀ {i i' x}, x ∈ b i → x ∈ b i' → i = i' := by + intro i i' x hi hi' + by_contra hne + exact Set.disjoint_left.mp (h₂ _ _ (hne' hne)) hi hi' + have hlink : ∀ (i i' : ι), i ≠ i' → ∃ u ∈ b i, ∃ w ∈ b i', ∃ f, G.toGraph.IsLink f u w := by + intro i i' hne + obtain ⟨u, hu, w, hw, huw, f, hf₁, hf₂⟩ := h₃ _ _ (hne' hne) + exact ⟨u, hu, w, hw, f, isLink_of_inc_of_ne_aux hf₁ hf₂ huw⟩ + choose cu hcu cw hcw cf hcf using hlink + have hbne : ∀ e : E(H.toGraph), (Sum.inr (e, true) : ι) ≠ Sum.inr (e, false) := fun e ↦ by + simp + let dir : E(H.toGraph) → Prop := fun e ↦ + G.tail ⟨cf _ _ (hbne e), (hcf _ _ (hbne e)).edge_mem⟩ = cu _ _ (hbne e) + let tl : E(H.toGraph) → V(H.toGraph) := fun e ↦ + if dir e then ⟨H.tail e, H.tail_mem e⟩ else ⟨H.head e, H.head_mem e⟩ + let hd : E(H.toGraph) → V(H.toGraph) := fun e ↦ + if dir e then ⟨H.head e, H.head_mem e⟩ else ⟨H.tail e, H.tail_mem e⟩ + have htl : ∀ e : E(H.toGraph), H.toGraph.IsLink e.1 (tl e).1 (hd e).1 := fun e ↦ by + dsimp [tl, hd] + split_ifs + · exact H.isLink_of_mem e + · exact (H.isLink_of_mem e).symm + let en : E(H.toGraph) × Bool → V(H.toGraph) := fun e ↦ if e.2 then tl e.1 else hd e.1 + let own : ι → α' := fun i ↦ Sum.elim (fun v ↦ v.1) (fun e ↦ (en e).1) i + let ηv : α' → Set α := fun v ↦ ⋃ i ∈ {i | own i = v}, b i + let ηe : β' → β := fun e ↦ + if h : e ∈ E(H.toGraph) then cf _ _ (hbne ⟨e, h⟩) else Classical.arbitrary β + have hηe : ∀ e : E(H.toGraph), + G.toGraph.IsLink (ηe e.1) (cu _ _ (hbne e)) (cw _ _ (hbne e)) := fun e ↦ by + simp only [ηe, dite_eq_left e.2] + exact hcf _ _ (hbne e) + have hmemv : ∀ {i x}, x ∈ b i → x ∈ ηv (own i) := fun {i x} hx ↦ + mem_biUnion (x := i) rfl hx + have hownv : ∀ {v x}, x ∈ ηv v → ∃ i, own i = v ∧ x ∈ b i := fun {v x} hx ↦ by + obtain ⟨i, hi, hxi⟩ := mem_iUnion₂.mp hx + exact ⟨i, hi, hxi⟩ + have hsubV : ∀ {i}, b i ⊆ V(G.toGraph) := fun {i} ↦ (h₁ (j i)).2.1 + have hnot : ∀ {f s t i i'}, G.toGraph.IsLink f s t → s ∈ b i → t ∈ b i' → + (∀ e : E(H.toGraph), ¬ (i = Sum.inr (e, true) ∧ i' = Sum.inr (e, false)) ∧ + ¬ (i = Sum.inr (e, false) ∧ i' = Sum.inr (e, true))) → + f ∉ ηe '' E(H.toGraph) := by + rintro f s t i i' hf hs ht hno ⟨e, he, rfl⟩ + have hl := hηe ⟨e, he⟩ + rcases hf.eq_and_eq_or_eq_and_eq hl with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact (hno ⟨e, he⟩).1 ⟨huniq hs (hcu _ _ _), huniq ht (hcw _ _ _)⟩ + · exact (hno ⟨e, he⟩).2 ⟨huniq hs (hcw _ _ _), huniq ht (hcu _ _ _)⟩ + have hadjK : ∀ {v f s t}, G.toGraph.IsLink f s t → f ∉ ηe '' E(H.toGraph) → + s ∈ ηv v → t ∈ ηv v → + ((G.toGraph.deleteEdges (ηe '' E(H.toGraph))).induce (ηv v)).Adj s t := + fun hf hn hs ht ↦ ⟨_, ⟨(deleteEdges_isLink ..).mpr ⟨hf, hn⟩, hs, ht⟩⟩ + have hblock : ∀ {v i}, own i = v → ∀ x ∈ b i, ∀ y ∈ b i, Relation.ReflTransGen + ((G.toGraph.deleteEdges (ηe '' E(H.toGraph))).induce (ηv v)).Adj x y := by + rintro v i rfl x hx y hy + refine Relation.ReflTransGen.mono (fun u w huw ↦ ?_) _ _ ((h₁ (j i)).2.2 x hx y hy) + obtain ⟨⟨hne, f, hf₁, hf₂⟩, hu, hw⟩ := huw + have hl := isLink_of_inc_of_ne_aux hf₁ hf₂ hne + refine hadjK hl (hnot hl hu hw fun e ↦ ⟨?_, ?_⟩) (hmemv hu) (hmemv hw) + · rintro ⟨rfl, h₄⟩ + exact hbne e h₄ + · rintro ⟨rfl, h₄⟩ + exact hbne e h₄.symm + have hsubη : ∀ {v}, ηv v ⊆ V(G.toGraph) := fun {v} x hx ↦ by + obtain ⟨i, -, hxi⟩ := hownv hx + exact hsubV hxi + have hconnected : ∀ v ∈ V(H.toGraph), + ∃ K ≤ G.toGraph.deleteEdges (ηe '' E(H.toGraph)), V(K) = ηv v ∧ GraphConnected K := by + intro v hv + set K := (G.toGraph.deleteEdges (ηe '' E(H.toGraph))).induce (ηv v) + have hsymm : ∀ ⦃a b⦄, K.Adj a b → K.Adj b a := fun _ _ h ↦ h.symm + let i₀ : ι := Sum.inl ⟨v, hv⟩ + obtain ⟨r, hr⟩ := (h₁ (j i₀)).1 + have hto : ∀ i, own i = v → ∀ y ∈ b i, Relation.ReflTransGen K.Adj y r := by + rintro (w | e) hown y hy + · have hw : w = ⟨v, hv⟩ := Subtype.ext hown + subst hw + exact hblock rfl y hy r hr + · have hne : (i₀ : ι) ≠ Sum.inr e := Sum.inl_ne_inr + have hl := hcf _ _ hne + have hnt : cf _ _ hne ∉ ηe '' E(H.toGraph) := hnot hl (hcu _ _ hne) (hcw _ _ hne) fun e' ↦ + ⟨fun h ↦ Sum.inl_ne_inr h.1, fun h ↦ Sum.inl_ne_inr h.1⟩ + have hm₁ : cu _ _ hne ∈ ηv v := hmemv (i := i₀) (hcu _ _ hne) + have hm₂ : cw _ _ hne ∈ ηv v := by + have := hmemv (hcw _ _ hne) + rwa [hown] at this + have hadj : K.Adj (cw _ _ hne) (cu _ _ hne) := (hadjK hl hnt hm₁ hm₂).symm + exact (hblock hown y hy _ (hcw _ _ hne)).trans + (Relation.ReflTransGen.head hadj (hblock (i := i₀) rfl _ (hcu _ _ hne) r hr)) + refine ⟨K, Graph.induce_le hsubη, rfl, ⟨r, hmemv (i := i₀) hr⟩, fun x hx y hy ↦ ?_⟩ + obtain ⟨i, hi, hxi⟩ := hownv hx + obtain ⟨i', hi', hyi⟩ := hownv hy + have hrev : ∀ {a b}, Relation.ReflTransGen K.Adj a b → Relation.ReflTransGen K.Adj b a := by + intro a b h + induction h with + | refl => exact .refl + | tail _ hbc ih => exact .head (hsymm hbc) ih + exact (hto i hi x hxi).trans (hrev (hto i' hi' y hyi)) + have hownT : ∀ e : E(H.toGraph), own (Sum.inr (e, true)) = (tl e).1 := fun e ↦ by simp [own, en] + have hownF : ∀ e : E(H.toGraph), own (Sum.inr (e, false)) = (hd e).1 := fun e ↦ by simp [own, en] + have hmemT : ∀ e : E(H.toGraph), cu _ _ (hbne e) ∈ ηv (tl e).1 := fun e ↦ by + rw [← hownT] + exact hmemv (hcu _ _ _) + have hmemF : ∀ e : E(H.toGraph), cw _ _ (hbne e) ∈ ηv (hd e).1 := fun e ↦ by + rw [← hownF] + exact hmemv (hcw _ _ _) + have hownT' : ∀ {e : E(H.toGraph)} {v}, cu _ _ (hbne e) ∈ ηv v → (tl e).1 = v := fun {e v} h ↦ by + obtain ⟨i, hi, hxi⟩ := hownv h + rw [← hownT, ← hi, huniq (hcu _ _ (hbne e)) hxi] + have hownF' : ∀ {e : E(H.toGraph)} {v}, cw _ _ (hbne e) ∈ ηv v → (hd e).1 = v := fun {e v} h ↦ by + obtain ⟨i, hi, hxi⟩ := hownv h + rw [← hownF, ← hi, huniq (hcw _ _ (hbne e)) hxi] + have hm : IsMinorModel H.toGraph G.toGraph ηv ηe := + { vertex_nonempty := fun v hv ↦ by + obtain ⟨r, hr⟩ := (h₁ (j (Sum.inl ⟨v, hv⟩))).1 + exact ⟨r, hmemv (i := Sum.inl ⟨v, hv⟩) hr⟩ + vertex_subset := fun v _ ↦ hsubη + edge_mem := fun e he ↦ (hηe ⟨e, he⟩).edge_mem + vertex_disjoint := fun v₁ _ v₂ _ hne ↦ Set.disjoint_left.mpr fun x h₄ h₅ ↦ by + obtain ⟨i, rfl, hxi⟩ := hownv h₄ + obtain ⟨i', rfl, hxi'⟩ := hownv h₅ + exact hne (congrArg own (huniq hxi hxi')) + edge_injOn := fun e₁ h₄ e₂ h₅ heq ↦ by + by_contra hne + have hl₁ := hηe ⟨e₁, h₄⟩ + have hl₂ := hηe ⟨e₂, h₅⟩ + rw [heq] at hl₁ + have hE : ∀ {t t' : Bool} {z}, z ∈ b (Sum.inr (⟨e₁, h₄⟩, t)) → + z ∈ b (Sum.inr (⟨e₂, h₅⟩, t')) → False := fun {t t' z} hz hz' ↦ by + have h₇ : ((⟨e₁, h₄⟩, t) : E(H.toGraph) × Bool) = (⟨e₂, h₅⟩, t') := + Sum.inr_injective (huniq hz hz') + exact hne (congrArg Subtype.val (congrArg Prod.fst h₇)) + rcases hl₁.eq_and_eq_or_eq_and_eq hl₂ with ⟨h₆, -⟩ | ⟨h₆, -⟩ + · exact hE (t := true) (t' := true) (hcu _ _ _) (by rw [h₆]; exact hcu _ _ _) + · exact hE (t := true) (t' := false) (hcu _ _ _) (by rw [h₆]; exact hcw _ _ _) + inc_iff := fun v hv e he ↦ by + have hl := hηe ⟨e, he⟩ + constructor + · intro hinc + rcases hinc.eq_or_eq_of_isLink (htl ⟨e, he⟩) with rfl | rfl + · exact ⟨_, hmemT _, hl.inc_left⟩ + · exact ⟨_, hmemF _, hl.inc_right⟩ + · rintro ⟨x, hx, hinc⟩ + rcases hinc.eq_or_eq_of_isLink hl with rfl | rfl + · rw [← hownT' hx] + exact (htl ⟨e, he⟩).inc_left + · rw [← hownF' hx] + exact (htl ⟨e, he⟩).inc_right + isLoopAt_iff := fun v hv e he ↦ by + have hl := hηe ⟨e, he⟩ + have hL := htl ⟨e, he⟩ + constructor + · intro hloop x hinc + have h₄ := hloop.eq_of_inc hL.inc_left + have h₅ := hloop.eq_of_inc hL.inc_right + rcases hinc.eq_or_eq_of_isLink hl with rfl | rfl + · have := hmemT ⟨e, he⟩ + rwa [← h₄] at this + · have := hmemF ⟨e, he⟩ + rwa [← h₅] at this + · intro hall + have h₄ := hownT' (hall _ hl.inc_left) + have h₅ := hownF' (hall _ hl.inc_right) + rw [h₄, h₅] at hL + exact hL + connected := hconnected } + have hends (e : E(H.toGraph)) : + G.tail ⟨ηe e.1, hm.edge_mem e.1 e.2⟩ ∈ ηv (H.tail e) ∧ + G.head ⟨ηe e.1, hm.edge_mem e.1 e.2⟩ ∈ ηv (H.head e) := by + let f : E(G.toGraph) := ⟨cf _ _ (hbne e), (hcf _ _ (hbne e)).edge_mem⟩ + have hf : (⟨ηe e.1, hm.edge_mem e.1 e.2⟩ : E(G.toGraph)) = f := + Subtype.ext (by simp [ηe, e.2, f]) + rw [hf] + rcases (G.isLink_of_mem f).eq_and_eq_or_eq_and_eq (hcf _ _ (hbne e)) with + ⟨ht, hh⟩ | ⟨ht, hh⟩ + · have hdir : dir e := ht + simpa [ht, hh, tl, hd, hdir] using And.intro (hmemT e) (hmemF e) + · have hdir : ¬ dir e := fun h ↦ hbne e (huniq (hcu _ _ _) ((h.symm.trans ht) ▸ hcw _ _ _)) + simpa [ht, hh, tl, hd, hdir] using And.intro (hmemF e) (hmemT e) + exact ⟨ηv, ηe, hm, fun e ↦ (hends e).1, fun e ↦ (hends e).2⟩ + +/-- Graph Minors XX, proof of (10.5) (page 355): "Let $p = 2|E(G_1)| + |V(G_1)|$; then every +tournament with $p$ vertices has a minor isomorphic to $G_1$." -/ +theorem isIsoMinor_of_hasCliqueMinor [Nonempty β] {H : Digraph α' β'} {G : Digraph α β} + (hVH : V(H.toGraph).Finite) (hEH : E(H.toGraph).Finite) + (hVG : V(G.toGraph).Finite) (hEG : E(G.toGraph).Finite) {p : ℕ} + (hp : V(H.toGraph).ncard + 2 * E(H.toGraph).ncard ≤ p) + (hc : HasCliqueMinor (Hypergraph.ofGraph G.toGraph hVG hEG) p) : + H.IsIsoMinor G := by + obtain ⟨ηv, ηe, hm⟩ := isDirMinorModel_of_hasCliqueMinor hVH hEH hVG hEG hp hc + exact isIsoMinor_of_isDirMinorModel hm + +/-! ### Directed patchworks and simulation -/ + +/-- The `Unit`-patchwork $P_i = (H_i, \mu, \Delta, \phi)$ of a finite directed graph $G_i$ from the +proof of (10.5) (Graph Minors XX, Section 10, pages 355–356): +"for $e \in E(G_i)$, $\mu(e)$ is the one- or two-vertex sequence enumerating the ends of $e$ in +$G_i$ (tail first)". -/ +noncomputable def digraphPatchwork (G : Digraph α β) (hV : V(G.toGraph).Finite) + (hE : E(G.toGraph).Finite) : Patchwork Unit α β where + G := (Hypergraph.ofGraph G.toGraph hV hE).toRooted + dom := E(G.toGraph) + μ e := open Classical in + if he : e ∈ E(G.toGraph) then + if G.tail ⟨e, he⟩ = G.head ⟨e, he⟩ then [G.tail ⟨e, he⟩] + else [G.tail ⟨e, he⟩, G.head ⟨e, he⟩] + else [] + Δ e := graphPatch ((Hypergraph.ofGraph G.toGraph hV hE).ends e) + φ _ := () + dom_subset := le_rfl + μ_nodup e he := by + rw [dite_eq_left he] + split_ifs with h + · simp + · simp [h] + μ_set e he := by + rw [dite_eq_left he] + ext v + have hl := G.isLink_of_mem ⟨e, he⟩ + split_ifs with h + · simp only [mem_ofPred_eq, List.mem_singleton] + change v = G.tail ⟨e, he⟩ ↔ G.toGraph.Inc e v + refine ⟨?_, fun hinc ↦ ?_⟩ + · rintro rfl + exact hl.inc_left + · rcases hinc.eq_or_eq_of_isLink hl with rfl | rfl + · rfl + · exact h.symm + · simp only [mem_ofPred_eq, List.mem_cons, List.not_mem_nil, or_false] + change (v = G.tail ⟨e, he⟩ ∨ v = G.head ⟨e, he⟩) ↔ G.toGraph.Inc e v + refine ⟨?_, fun hinc ↦ hinc.eq_or_eq_of_isLink hl⟩ + rintro (rfl | rfl) + · exact hl.inc_left + · exact hl.inc_right + Δ_verts _ _ := rfl + Δ_free _ he hne := absurd he hne + +@[simp] +theorem digraphPatchwork_G (G : Digraph α β) (hV : V(G.toGraph).Finite) + (hE : E(G.toGraph).Finite) : + (digraphPatchwork G hV hE).G = (Hypergraph.ofGraph G.toGraph hV hE).toRooted := rfl + +theorem digraphPatchwork_vertexSet (G : Digraph α β) (hV : V(G.toGraph).Finite) + (hE : E(G.toGraph).Finite) : + (digraphPatchwork G hV hE).G.vertexSet = V(G.toGraph) := rfl + +theorem digraphPatchwork_edgeSet (G : Digraph α β) (hV : V(G.toGraph).Finite) + (hE : E(G.toGraph).Finite) : + (digraphPatchwork G hV hE).G.edgeSet = E(G.toGraph) := rfl + +theorem digraphPatchwork_ends (G : Digraph α β) (hV : V(G.toGraph).Finite) + (hE : E(G.toGraph).Finite) (e : β) : + (digraphPatchwork G hV hE).G.ends e = {v | G.toGraph.Inc e v} := rfl + +@[simp] +theorem digraphPatchwork_dom (G : Digraph α β) (hV : V(G.toGraph).Finite) + (hE : E(G.toGraph).Finite) : + (digraphPatchwork G hV hE).dom = E(G.toGraph) := rfl + +@[simp] +theorem digraphPatchwork_Δ (G : Digraph α β) (hV : V(G.toGraph).Finite) + (hE : E(G.toGraph).Finite) (e : β) : + (digraphPatchwork G hV hE).Δ e = graphPatch {v | G.toGraph.Inc e v} := rfl + +/-- Graph Minors XX, proof of (10.5) (page 356): "Then $P_i$ is a free $\Omega$-patchwork." -/ +theorem isFree_digraphPatchwork (G : Digraph α β) (hV : V(G.toGraph).Finite) + (hE : E(G.toGraph).Finite) : IsFree (digraphPatchwork G hV hE) := by + intro e _ δ hg hv + replace hv : δ.verts = (Hypergraph.ofGraph G.toGraph hV hE).ends e := hv + replace hg : IsGrouping ((Hypergraph.ofGraph G.toGraph hV hE).ends e) δ := hg + change δ = emptySubgraph _ ∨ δ = completeSubgraph _ + by_cases h : ∃ a b, δ.Adj a b + · right + obtain ⟨a, b, hab⟩ := h + have hin : ∀ {x}, x ∈ δ.verts → G.toGraph.Inc e x := fun {x} hx ↦ by + rw [hv] at hx + exact hx + have ha : G.toGraph.Inc e a := hin (δ.edge_vert hab) + have hb : G.toGraph.Inc e b := hin (δ.edge_vert hab.symm) + refine SimpleGraph.Subgraph.ext hv ?_ + ext x y + rw [completeSubgraph_adj] + constructor + · intro hxy + exact ⟨hv ▸ δ.edge_vert hxy, hv ▸ δ.edge_vert hxy.symm, hxy.ne⟩ + · rintro ⟨hx, hy, hne⟩ + have hx' : G.toGraph.Inc e x := hx + have hy' : G.toGraph.Inc e y := hy + have hl := isLink_of_inc_of_ne_aux ha hb hab.ne + rcases hx'.eq_or_eq_of_isLink hl with rfl | rfl <;> + rcases hy'.eq_or_eq_of_isLink hl with rfl | rfl + · exact absurd rfl hne + · exact hab + · exact hab.symm + · exact absurd rfl hne + · left + refine SimpleGraph.Subgraph.ext hv ?_ + ext x y + exact ⟨fun hxy ↦ h ⟨x, y, hxy⟩, fun hxy ↦ (not_emptySubgraph_adj hxy).elim⟩ + +/-- If `digraphPatchwork H hVH hEH` is simulated in `digraphPatchwork G hVG hEG`, then there is a +directed minor model of `H` in `G`. This uses the discussion in Graph Minors IV, Section 7, +pages 242–243, cited in Graph Minors XX, proof of (10.5), page 356 (reference [1], misprinted as +[2] there). -/ +theorem isDirMinorModel_of_simulated {H G : Digraph α β} + {hVH : V(H.toGraph).Finite} {hEH : E(H.toGraph).Finite} + {hVG : V(G.toGraph).Finite} {hEG : E(G.toGraph).Finite} + (hsim : Simulated (digraphPatchwork H hVH hEH) (digraphPatchwork G hVG hEG)) : + ∃ (ηv : α → Set α) (ηe : β → β), IsDirMinorModel H G ηv ηe := by + let PH := digraphPatchwork H hVH hEH + let PG := digraphPatchwork G hVG hEG + obtain ⟨ηv, ηe, hexp, R, hreal⟩ := hsim + have hdomH : ∀ e, e ∈ PH.dom ↔ e ∈ E(H.toGraph) := fun _ ↦ Iff.rfl + have hm : IsMinorModel H.toGraph G.toGraph ηv ηe := + isMinorModel_of_realized_graph_expansion + (PH := PH) (PG := PG) (hVH := hVH) (hEH := hEH) (hVG := hVG) (hEG := hEG) + rfl rfl rfl rfl (fun _ _ => rfl) hexp hreal + have hends (e : E(H.toGraph)) : + G.tail ⟨ηe e.1, hm.edge_mem e.1 e.2⟩ ∈ ηv (H.tail e) ∧ + G.head ⟨ηe e.1, hm.edge_mem e.1 e.2⟩ ∈ ηv (H.head e) := by + classical + have he' : ηe e.1 ∈ E(G.toGraph) := hm.edge_mem e.1 e.2 + have hμH : PH.μ e.1 = + (if H.tail e = H.head e then [H.tail e] else [H.tail e, H.head e]) := by + change (if he : e.1 ∈ E(H.toGraph) then _ else _) = _ + rw [dite_eq_left e.2] + have hμG : PG.μ (ηe e.1) = + (if G.tail ⟨ηe e.1, he'⟩ = G.head ⟨ηe e.1, he'⟩ then [G.tail ⟨ηe e.1, he'⟩] + else [G.tail ⟨ηe e.1, he'⟩, G.head ⟨ηe e.1, he'⟩]) := by + change (if he : ηe e.1 ∈ E(G.toGraph) then _ else _) = _ + rw [dite_eq_left he'] + have hr : 0 < (PH.μ e.1).length := by rw [hμH]; split_ifs <;> simp + have hr' : 0 < (PG.μ (ηe e.1)).length := hexp.μ_length e.1 ((hdomH e.1).mpr e.2) ▸ hr + have h0H : (PH.μ e.1)[0] = H.tail e := by + revert hr; rw [hμH]; split_ifs <;> intro _ <;> rfl + have h0G : (PG.μ (ηe e.1))[0] = G.tail ⟨ηe e.1, he'⟩ := by + revert hr'; rw [hμG]; split_ifs <;> intro _ <;> rfl + have hmem0 := hexp.μ_mem e.1 ((hdomH e.1).mpr e.2) 0 hr hr' + have htail : G.tail ⟨ηe e.1, he'⟩ ∈ ηv (H.tail e) := by rwa [h0H, h0G] at hmem0 + refine ⟨htail, ?_⟩ + have hlen : (PH.μ e.1).length = (PG.μ (ηe e.1)).length := + hexp.μ_length e.1 ((hdomH e.1).mpr e.2) + by_cases hH : H.tail e = H.head e + · have hlenH : (PH.μ e.1).length = 1 := by simp [hμH, hH] + have hG : G.tail ⟨ηe e.1, he'⟩ = G.head ⟨ηe e.1, he'⟩ := by + simpa [hμG, apply_ite List.length] using hlen.symm.trans hlenH + simpa only [hH, hG] using htail + · have hlenH : (PH.μ e.1).length = 2 := by simp [hμH, hH] + have hG : G.tail ⟨ηe e.1, he'⟩ ≠ G.head ⟨ηe e.1, he'⟩ := by + simpa [hμG, apply_ite List.length] using hlen.symm.trans hlenH + have hr : 1 < (PH.μ e.1).length := by omega + have hr' : 1 < (PG.μ (ηe e.1)).length := hlen ▸ hr + have h1H : (PH.μ e.1)[1] = H.head e := by + revert hr; rw [hμH, ite_eq_right hH]; intro _; rfl + have h1G : (PG.μ (ηe e.1))[1] = G.head ⟨ηe e.1, he'⟩ := by + revert hr'; rw [hμG, ite_eq_right hG]; intro _; rfl + have hmem1 := hexp.μ_mem e.1 ((hdomH e.1).mpr e.2) 1 hr hr' + rwa [h1H, h1G] at hmem1 + exact ⟨ηv, ηe, hm, fun e ↦ (hends e).1, fun e ↦ (hends e).2⟩ + +/-! ### Isomorphism with a finite directed graph on `ℕ` and transport of `IsIsoMinor` -/ + +/-- Every finite directed graph is isomorphic to a finite directed graph on `ℕ`. -/ +theorem exists_digraph_iso_nat (G : Digraph α β) (hV : V(G.toGraph).Finite) + (hE : E(G.toGraph).Finite) : + ∃ G' : Digraph ℕ ℕ, V(G'.toGraph).Finite ∧ E(G'.toGraph).Finite ∧ + Nonempty (Digraph.Iso G G') := by + obtain ⟨f, hf⟩ := Set.countable_iff_exists_injOn.mp hV.countable + obtain ⟨g, hg⟩ := Set.countable_iff_exists_injOn.mp hE.countable + let G₀ : Graph ℕ ℕ := + { vertexSet := f '' V(G.toGraph) + IsLink := fun e x y ↦ + ∃ e₀ x₀ y₀, G.toGraph.IsLink e₀ x₀ y₀ ∧ g e₀ = e ∧ f x₀ = x ∧ f y₀ = y + isLink_symm := fun _ _ ↦ + ⟨fun _ _ ⟨e₀, x₀, y₀, h, h₁, h₂, h₃⟩ ↦ ⟨e₀, y₀, x₀, h.symm, h₁, h₃, h₂⟩⟩ + eq_or_eq_of_isLink_of_isLink := by + rintro _ _ _ _ _ ⟨e₀, x₀, y₀, h, rfl, rfl, rfl⟩ ⟨e₁, x₁, y₁, h', he, rfl, rfl⟩ + obtain rfl := hg h'.edge_mem h.edge_mem he + rcases h.left_eq_or_eq h' with rfl | rfl + · exact Or.inl rfl + · exact Or.inr rfl + left_mem_of_isLink := by + rintro _ _ _ ⟨e₀, x₀, y₀, h, -, rfl, -⟩ + exact ⟨x₀, h.left_mem, rfl⟩ } + have hEG₀ : E(G₀) = g '' E(G.toGraph) := by + ext e + change (∃ x y, G₀.IsLink e x y) ↔ _ + constructor + · rintro ⟨_, _, e₀, x₀, y₀, h, rfl, -⟩ + exact ⟨e₀, h.edge_mem, rfl⟩ + · rintro ⟨e₀, he, rfl⟩ + obtain ⟨x, y, h⟩ := exists_isLink_of_mem_edgeSet he + exact ⟨_, _, e₀, x, y, h, rfl, rfl, rfl⟩ + have hbijE : BijOn g E(G.toGraph) E(G₀) := hEG₀ ▸ hg.bijOn_image + let eE : E(G.toGraph) ≃ E(G₀) := hbijE.equiv g + let eV : V(G.toGraph) ≃ V(G₀) := (hf.bijOn_image).equiv f + let G' : Digraph ℕ ℕ := + { toGraph := G₀ + tail := fun e ↦ f (G.tail (eE.symm e)) + head := fun e ↦ f (G.head (eE.symm e)) + isLink_of_mem := fun e ↦ by + let e₀ := eE.symm e + have he₀ : g e₀.1 = e.1 := congrArg Subtype.val (eE.apply_symm_apply e) + exact ⟨e₀.1, G.tail e₀, G.head e₀, G.isLink_of_mem e₀, he₀, rfl, rfl⟩ } + refine ⟨G', hV.image f, hEG₀ ▸ hE.image g, ⟨?_⟩⟩ + refine + { vertexEquiv := eV + edgeEquiv := eE + isLink_iff := by + rintro ⟨e, he⟩ ⟨x, hx⟩ ⟨y, hy⟩ + constructor + · intro h + exact ⟨e, x, y, h, rfl, rfl, rfl⟩ + · rintro ⟨e₀, x₀, y₀, h, h₁, h₂, h₃⟩ + have h₄ : e₀ = e := hg h.edge_mem he h₁ + have h₅ : x₀ = x := hf h.left_mem hx h₂ + have h₆ : y₀ = y := hf h.right_mem hy h₃ + subst h₄ h₅ h₆ + exact h + tail_eq := fun e ↦ by + change f (G.tail e) = f (G.tail (eE.symm (eE e))) + rw [Equiv.symm_apply_apply] + head_eq := fun e ↦ by + change f (G.head e) = f (G.head (eE.symm (eE e))) + rw [Equiv.symm_apply_apply] } + +/-- Transport a directed minor model `(ηv', ηe')` of `H'` in `G'` along isomorphisms +`φH : H.Iso H'` and `φG : G.Iso G'` when `H` and `G` share the same edge type `β`. -/ +theorem IsDirMinorModel.transport_iso {H G : Digraph α β} {H' G' : Digraph α' β'} + {ηv' : α' → Set α'} {ηe' : β' → β'} (hm : IsDirMinorModel H' G' ηv' ηe') + (φH : Digraph.Iso H H') (φG : Digraph.Iso G G') : + ∃ (ηv : α → Set α) (ηe : β → β), IsDirMinorModel H G ηv ηe := by + classical + let ηv : α → Set α := fun v ↦ + if hv : v ∈ V(H.toGraph) then + {x ∈ V(G.toGraph) | ∃ hx : x ∈ V(G.toGraph), + (φG.vertexEquiv ⟨x, hx⟩).1 ∈ ηv' (φH.vertexEquiv ⟨v, hv⟩).1} + else ∅ + let ηe : β → β := fun e ↦ + if he : e ∈ E(H.toGraph) then + (φG.edgeEquiv.symm ⟨ηe' (φH.edgeEquiv ⟨e, he⟩).1, + hm.edge_mem _ (φH.edgeEquiv ⟨e, he⟩).2⟩).1 + else e + have hηv_mem : ∀ {v : α} (hv : v ∈ V(H.toGraph)) {x : α}, + x ∈ ηv v ↔ ∃ hx : x ∈ V(G.toGraph), + (φG.vertexEquiv ⟨x, hx⟩).1 ∈ ηv' (φH.vertexEquiv ⟨v, hv⟩).1 := by + intro v hv x + simp [ηv, hv] + have hηe_eq : ∀ (e : E(H.toGraph)), + (⟨ηe e.1, by + simp only [ηe, dite_eq_left e.2] + exact (φG.edgeEquiv.symm _).2⟩ : E(G.toGraph)) = + φG.edgeEquiv.symm ⟨ηe' (φH.edgeEquiv e).1, hm.edge_mem _ (φH.edgeEquiv e).2⟩ := by + intro e + apply Subtype.ext + simp [ηe, e.2] + have hηe_mem : ∀ e ∈ E(H.toGraph), ηe e ∈ E(G.toGraph) := by + intro e he + simp only [ηe, dite_eq_left he] + exact (φG.edgeEquiv.symm _).2 + have hφG_ηe : ∀ (e : E(H.toGraph)), + φG.edgeEquiv ⟨ηe e.1, hηe_mem e.1 e.2⟩ = + ⟨ηe' (φH.edgeEquiv e).1, hm.edge_mem _ (φH.edgeEquiv e).2⟩ := by + intro e + rw [hηe_eq e, Equiv.apply_symm_apply] + have hinc_G : ∀ {f : β} {x : α} (hf : f ∈ E(G.toGraph)) (hx : x ∈ V(G.toGraph)), + G.toGraph.Inc f x ↔ G'.toGraph.Inc (φG.edgeEquiv ⟨f, hf⟩).1 (φG.vertexEquiv ⟨x, hx⟩).1 := by + intro f x hf hx + constructor + · rintro ⟨y, hl⟩ + exact ⟨(φG.vertexEquiv ⟨y, hl.right_mem⟩).1, + (φG.isLink_iff ⟨f, hf⟩ ⟨x, hx⟩ ⟨y, hl.right_mem⟩).1 hl⟩ + · rintro ⟨y', hl'⟩ + obtain ⟨⟨y, hy⟩, hy_eq⟩ := φG.vertexEquiv.surjective ⟨y', hl'.right_mem⟩ + have hl'' : G'.toGraph.IsLink (φG.edgeEquiv ⟨f, hf⟩).1 (φG.vertexEquiv ⟨x, hx⟩).1 + (φG.vertexEquiv ⟨y, hy⟩).1 := by + rwa [congrArg Subtype.val hy_eq] + exact ⟨y, (φG.isLink_iff ⟨f, hf⟩ ⟨x, hx⟩ ⟨y, hy⟩).2 hl''⟩ + have hinc_H : ∀ {e : β} {v : α} (he : e ∈ E(H.toGraph)) (hv : v ∈ V(H.toGraph)), + H.toGraph.Inc e v ↔ H'.toGraph.Inc (φH.edgeEquiv ⟨e, he⟩).1 (φH.vertexEquiv ⟨v, hv⟩).1 := by + intro e v he hv + constructor + · rintro ⟨w, hl⟩ + exact ⟨(φH.vertexEquiv ⟨w, hl.right_mem⟩).1, + (φH.isLink_iff ⟨e, he⟩ ⟨v, hv⟩ ⟨w, hl.right_mem⟩).1 hl⟩ + · rintro ⟨w', hl'⟩ + obtain ⟨⟨w, hw⟩, hw_eq⟩ := φH.vertexEquiv.surjective ⟨w', hl'.right_mem⟩ + have hl'' : H'.toGraph.IsLink (φH.edgeEquiv ⟨e, he⟩).1 (φH.vertexEquiv ⟨v, hv⟩).1 + (φH.vertexEquiv ⟨w, hw⟩).1 := by + rwa [congrArg Subtype.val hw_eq] + exact ⟨w, (φH.isLink_iff ⟨e, he⟩ ⟨v, hv⟩ ⟨w, hw⟩).2 hl''⟩ + refine ⟨ηv, ηe, + { vertex_nonempty := fun v hv ↦ by + obtain ⟨x', hx'⟩ := hm.vertex_nonempty _ (φH.vertexEquiv ⟨v, hv⟩).2 + have hx'G' : x' ∈ V(G'.toGraph) := + hm.vertex_subset _ (φH.vertexEquiv ⟨v, hv⟩).2 hx' + obtain ⟨⟨x, hx⟩, hx_eq⟩ := φG.vertexEquiv.surjective ⟨x', hx'G'⟩ + refine ⟨x, (hηv_mem hv).2 ⟨hx, ?_⟩⟩ + rwa [congrArg Subtype.val hx_eq] + vertex_subset := fun v hv x hx ↦ ((hηv_mem hv).1 hx).1 + edge_mem := hηe_mem + vertex_disjoint := fun v₁ hv₁ v₂ hv₂ hne ↦ by + rw [disjoint_left] + intro x hx₁ hx₂ + obtain ⟨hx, hx₁'⟩ := (hηv_mem hv₁).1 hx₁ + obtain ⟨_, hx₂'⟩ := (hηv_mem hv₂).1 hx₂ + have hne' : (φH.vertexEquiv ⟨v₁, hv₁⟩).1 ≠ (φH.vertexEquiv ⟨v₂, hv₂⟩).1 := fun h ↦ + hne (Subtype.mk.inj (φH.vertexEquiv.injective (Subtype.ext h))) + exact (hm.vertex_disjoint _ (φH.vertexEquiv ⟨v₁, hv₁⟩).2 + _ (φH.vertexEquiv ⟨v₂, hv₂⟩).2 hne').notMem_of_mem_left hx₁' hx₂' + edge_injOn := fun e₁ he₁ e₂ he₂ heq ↦ by + have hsub : (⟨ηe e₁, hηe_mem e₁ he₁⟩ : E(G.toGraph)) = ⟨ηe e₂, hηe_mem e₂ he₂⟩ := + Subtype.ext heq + have h₁ := congrArg φG.edgeEquiv hsub + rw [hφG_ηe ⟨e₁, he₁⟩, hφG_ηe ⟨e₂, he₂⟩] at h₁ + have h₂ := hm.edge_injOn (φH.edgeEquiv ⟨e₁, he₁⟩).2 (φH.edgeEquiv ⟨e₂, he₂⟩).2 + (congrArg Subtype.val h₁) + exact Subtype.mk.inj (φH.edgeEquiv.injective (Subtype.ext h₂)) + inc_iff := fun v hv e he ↦ by + rw [hinc_H he hv, + hm.inc_iff _ (φH.vertexEquiv ⟨v, hv⟩).2 _ (φH.edgeEquiv ⟨e, he⟩).2] + constructor + · rintro ⟨x', hx', hinc'⟩ + have hx'G' : x' ∈ V(G'.toGraph) := + hm.vertex_subset _ (φH.vertexEquiv ⟨v, hv⟩).2 hx' + obtain ⟨⟨x, hx⟩, hx_eq⟩ := φG.vertexEquiv.surjective ⟨x', hx'G'⟩ + have hx_val : (φG.vertexEquiv ⟨x, hx⟩).1 = x' := congrArg Subtype.val hx_eq + refine ⟨x, (hηv_mem hv).2 ⟨hx, hx_val.symm ▸ hx'⟩, ?_⟩ + rw [hinc_G (hηe_mem e he) hx, hφG_ηe ⟨e, he⟩, hx_val] + exact hinc' + · rintro ⟨x, hx, hinc⟩ + obtain ⟨hxG, hx'⟩ := (hηv_mem hv).1 hx + refine ⟨(φG.vertexEquiv ⟨x, hxG⟩).1, hx', ?_⟩ + have := (hinc_G (hηe_mem e he) hxG).1 hinc + rwa [hφG_ηe ⟨e, he⟩] at this + isLoopAt_iff := fun v hv e he ↦ by + have hloop_H : H.toGraph.IsLoopAt e v ↔ + H'.toGraph.IsLoopAt (φH.edgeEquiv ⟨e, he⟩).1 (φH.vertexEquiv ⟨v, hv⟩).1 := + φH.isLink_iff ⟨e, he⟩ ⟨v, hv⟩ ⟨v, hv⟩ + rw [hloop_H, + hm.isLoopAt_iff _ (φH.vertexEquiv ⟨v, hv⟩).2 _ (φH.edgeEquiv ⟨e, he⟩).2] + constructor + · intro hall x hinc + have hxG : x ∈ V(G.toGraph) := hinc.vertex_mem + have hinc' := (hinc_G (hηe_mem e he) hxG).1 hinc + rw [hφG_ηe ⟨e, he⟩] at hinc' + exact (hηv_mem hv).2 ⟨hxG, hall _ hinc'⟩ + · intro hall x' hinc' + have hx'G' : x' ∈ V(G'.toGraph) := hinc'.vertex_mem + obtain ⟨⟨x, hx⟩, hx_eq⟩ := φG.vertexEquiv.surjective ⟨x', hx'G'⟩ + have hx_val : (φG.vertexEquiv ⟨x, hx⟩).1 = x' := congrArg Subtype.val hx_eq + have hinc : G.toGraph.Inc (ηe e) x := by + rw [hinc_G (hηe_mem e he) hx, hφG_ηe ⟨e, he⟩, hx_val] + exact hinc' + obtain ⟨_, hx'⟩ := (hηv_mem hv).1 (hall x hinc) + rwa [← hx_val] + connected := fun v hv ↦ by + obtain ⟨K', hK'_le, hK'_V, hK'_conn⟩ := + hm.connected _ (φH.vertexEquiv ⟨v, hv⟩).2 + let K : Graph α β := (G.toGraph.deleteEdges (ηe '' E(H.toGraph))).induce (ηv v) + have hK_le : K ≤ G.toGraph.deleteEdges (ηe '' E(H.toGraph)) := + Graph.induce_le fun x hx ↦ ((hηv_mem hv).1 hx).1 + obtain ⟨r', hr'⟩ := hK'_conn.1 + have hr'η : r' ∈ ηv' (φH.vertexEquiv ⟨v, hv⟩).1 := hK'_V ▸ hr' + have hr'G' : r' ∈ V(G'.toGraph) := + hm.vertex_subset _ (φH.vertexEquiv ⟨v, hv⟩).2 hr'η + obtain ⟨⟨r, hrG⟩, hr_eq⟩ := φG.vertexEquiv.surjective ⟨r', hr'G'⟩ + have hr_val : (φG.vertexEquiv ⟨r, hrG⟩).1 = r' := congrArg Subtype.val hr_eq + have hrη : r ∈ ηv v := (hηv_mem hv).2 ⟨hrG, hr_val.symm ▸ hr'η⟩ + refine ⟨K, hK_le, rfl, ⟨r, hrη⟩, fun x hx y hy ↦ ?_⟩ + obtain ⟨hxG, hx'⟩ := (hηv_mem hv).1 hx + obtain ⟨hyG, hy'⟩ := (hηv_mem hv).1 hy + have hwalk := hK'_conn.2 (φG.vertexEquiv ⟨x, hxG⟩).1 (hK'_V.symm ▸ hx') + (φG.vertexEquiv ⟨y, hyG⟩).1 (hK'_V.symm ▸ hy') + have hstep : ∀ {a' b' : α'}, ReflTransGen K'.Adj a' b' → + ∀ {a b : α} (ha : a ∈ V(G.toGraph)) (hb : b ∈ V(G.toGraph)), + (φG.vertexEquiv ⟨a, ha⟩).1 = a' → (φG.vertexEquiv ⟨b, hb⟩).1 = b' → + ReflTransGen K.Adj a b := by + intro a' b' hab' + induction hab' with + | refl => + intro a b ha hb ha_eq hb_eq + have hsub : (⟨a, ha⟩ : V(G.toGraph)) = ⟨b, hb⟩ := + φG.vertexEquiv.injective (Subtype.ext (ha_eq.trans hb_eq.symm)) + exact Subtype.mk.inj hsub ▸ .refl + | @tail c' d' h₁ hcd' ih => + intro a b ha hb ha_eq hb_eq + obtain ⟨f', hlK'⟩ := hcd' + have hc'η : c' ∈ ηv' (φH.vertexEquiv ⟨v, hv⟩).1 := hK'_V ▸ hlK'.left_mem + have hd'η : d' ∈ ηv' (φH.vertexEquiv ⟨v, hv⟩).1 := hK'_V ▸ hlK'.right_mem + have hc'G' : c' ∈ V(G'.toGraph) := + hm.vertex_subset _ (φH.vertexEquiv ⟨v, hv⟩).2 hc'η + obtain ⟨⟨c, hcG⟩, hc_eq⟩ := φG.vertexEquiv.surjective ⟨c', hc'G'⟩ + have hc_val : (φG.vertexEquiv ⟨c, hcG⟩).1 = c' := congrArg Subtype.val hc_eq + have hlD' := hlK'.mono hK'_le + rw [deleteEdges_isLink] at hlD' + obtain ⟨hlG', hf'_not⟩ := hlD' + obtain ⟨⟨f, hfG⟩, hf_eq⟩ := φG.edgeEquiv.surjective ⟨f', hlG'.edge_mem⟩ + have hf_val : (φG.edgeEquiv ⟨f, hfG⟩).1 = f' := congrArg Subtype.val hf_eq + have hlG : G.toGraph.IsLink f c b := by + apply (φG.isLink_iff ⟨f, hfG⟩ ⟨c, hcG⟩ ⟨b, hb⟩).2 + rwa [hf_val, hc_val, hb_eq] + have hf_not : f ∉ ηe '' E(H.toGraph) := by + rintro ⟨e, he, rfl⟩ + apply hf'_not + refine ⟨(φH.edgeEquiv ⟨e, he⟩).1, (φH.edgeEquiv ⟨e, he⟩).2, ?_⟩ + have := congrArg Subtype.val (hφG_ηe ⟨e, he⟩) + exact this.symm.trans hf_val + have hcη : c ∈ ηv v := (hηv_mem hv).2 ⟨hcG, hc_val.symm ▸ hc'η⟩ + have hbη : b ∈ ηv v := (hηv_mem hv).2 ⟨hb, hb_eq.symm ▸ hd'η⟩ + have hadj : K.Adj c b := ⟨f, (deleteEdges_isLink ..).mpr ⟨hlG, hf_not⟩, hcη, hbη⟩ + exact (ih ha hcG ha_eq hc_val).tail hadj + exact hstep hwalk hxG hyG rfl rfl }, + fun e ↦ ?_, fun e ↦ ?_⟩ + · refine (hηv_mem (H.tail_mem e)).2 ⟨G.tail_mem ⟨ηe e.1, hηe_mem e.1 e.2⟩, ?_⟩ + rw [φG.tail_eq ⟨ηe e.1, hηe_mem e.1 e.2⟩, φH.tail_eq e] + have h₁ : G'.tail (φG.edgeEquiv ⟨ηe e.1, hηe_mem e.1 e.2⟩) = + G'.tail ⟨ηe' (φH.edgeEquiv e).1, hm.edge_mem _ (φH.edgeEquiv e).2⟩ := by + congr 1 + exact hφG_ηe e + rw [h₁] + exact hm.tail_mem (φH.edgeEquiv e) + · refine (hηv_mem (H.head_mem e)).2 ⟨G.head_mem ⟨ηe e.1, hηe_mem e.1 e.2⟩, ?_⟩ + rw [φG.head_eq ⟨ηe e.1, hηe_mem e.1 e.2⟩, φH.head_eq e] + have h₁ : G'.head (φG.edgeEquiv ⟨ηe e.1, hηe_mem e.1 e.2⟩) = + G'.head ⟨ηe' (φH.edgeEquiv e).1, hm.edge_mem _ (φH.edgeEquiv e).2⟩ := by + congr 1 + exact hφG_ηe e + rw [h₁] + exact hm.head_mem (φH.edgeEquiv e) + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Draw1.lean b/LeanPool/GraphMinor/GM20/Draw1.lean new file mode 100644 index 0000000000..1089eff56d --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Draw1.lean @@ -0,0 +1,244 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.TopologyStatements + +/-! +# Drawing a graph in a surface of large genus: points of the model surfaces + +The proof of (10.3) needs that every graph can be drawn in `Σ(a, b, c)` once `2a + b` is large. We +draw the graph as curves in the plane that avoid the deleted discs and that may jump across the +pasted +circles. This file gives the map `qq` from points of the plane to the model, and the invariant +`keyOf` that says when two points of the plane have the same image: two points outside all the +circles have the same image only if they are equal, and points of different handles have different +images. +-/ + +@[expose] public section + +namespace GraphMinor.GM20.Draw + +open Set Topology GraphMinor.Surface + +variable (a b c : ℕ) + +/-- The point `(z.1, z.2)` of the plane. -/ +noncomputable def pl (z : ℝ × ℝ) : EuclideanPlane := !₂[z.1, z.2] + +theorem continuous_pl : Continuous pl := by + unfold pl + fun_prop + +theorem norm_sq (u : EuclideanPlane) : ‖u‖ ^ 2 = u 0 ^ 2 + u 1 ^ 2 := by + rw [EuclideanSpace.norm_sq_eq] + simp [Fin.sum_univ_two] + +theorem dist_centre_sq (z : ℝ × ℝ) (i : ℕ) : + dist (pl z) (modelCentre i) ^ 2 = (z.1 - 3 * i) ^ 2 + z.2 ^ 2 := by + rw [dist_eq_norm, norm_sq] + simp [pl, modelCentre] + +/-- `z` is outside the open discs. -/ +def Ok (z : ℝ × ℝ) : Prop := ∀ i < 2 * a + b + c, 1 ≤ (z.1 - 3 * i) ^ 2 + z.2 ^ 2 + +/-- `z` is outside the closed discs. -/ +def Clear (z : ℝ × ℝ) : Prop := ∀ i < 2 * a + b + c, 1 < (z.1 - 3 * i) ^ 2 + z.2 ^ 2 + +variable {a b c} + +theorem Clear.ok {z : ℝ × ℝ} (h : Clear a b c z) : Ok a b c z := fun i hi ↦ (h i hi).le + +theorem mem_base {z : ℝ × ℝ} (h : Ok a b c z) : + ((pl z : EuclideanPlane) : OnePoint EuclideanPlane) ∈ modelBase (2 * a + b + c) := by + intro i hi x hx + obtain rfl := OnePoint.coe_injective hx + have h₁ := h i hi + rw [← dist_centre_sq] at h₁ + have h₂ : 0 ≤ dist (pl z) (modelCentre i) := dist_nonneg + nlinarith + +variable (a b c) + +theorem infty_mem_base : (OnePoint.infty : OnePoint EuclideanPlane) ∈ modelBase (2 * a + b + c) + := by + intro i _ x hx + exact absurd hx (OnePoint.infty_ne_coe x) + +/-- The point of the model given by a point of the plane outside the open discs. -/ +noncomputable def qq (z : ℝ × ℝ) : SurfaceModel a b c := + open Classical in + if h : Ok a b c z then Quot.mk _ ⟨_, mem_base h⟩ else Quot.mk _ ⟨_, infty_mem_base a b c⟩ + +variable {a b c} + +theorem qq_of_ok {z : ℝ × ℝ} (h : Ok a b c z) : qq a b c z = Quot.mk _ ⟨_, mem_base h⟩ := + dite_eq_left h + +theorem continuous_mk : Continuous + (Quot.mk _ : modelBase (2 * a + b + c) → SurfaceModel a b c) := + continuous_quot_mk + +theorem continuousOn_qq : ContinuousOn (qq a b c) {z | Ok a b c z} := by + rw [continuousOn_iff_continuous_domRestrict] + have : ({z | Ok a b c z}.domRestrict (qq a b c)) = + fun z ↦ Quot.mk _ ⟨_, mem_base z.2⟩ := by + funext z + exact qq_of_ok z.2 + rw [this] + refine continuous_mk.comp (Continuous.subtype_mk ?_ _) + exact OnePoint.continuous_coe.comp (continuous_pl.comp continuous_subtype_val) + +/-! ### The invariant -/ + +variable (a b) + +/-- The handle or cross-cap of the `i`th circle. -/ +def grp (i : ℕ) : ℕ := if i < 2 * a then i / 2 else i + +/-- A number that separates the pairs of antipodal points of a cross-cap. -/ +noncomputable def tw (i : ℕ) (u : EuclideanPlane) : ℝ := + open Classical in if 2 * a ≤ i ∧ i < 2 * a + b then u 0 * u 1 else 0 + +variable (c) + +/-- The invariant of a point of the plane. -/ +noncomputable def keyPl (x : EuclideanPlane) : (ℕ × ℝ) ⊕ EuclideanPlane := + open Classical in + if h : ∃ i < 2 * a + b + c, ‖x - modelCentre i‖ = 1 then + Sum.inl (grp a h.choose, tw a b h.choose (x - modelCentre h.choose)) + else Sum.inr x + +/-- The invariant of a point of the sphere. -/ +noncomputable def keyS (p : OnePoint EuclideanPlane) : Option ((ℕ × ℝ) ⊕ EuclideanPlane) := + OnePoint.elim p none (fun x ↦ some (keyPl a b c x)) + +variable {a b c} + +theorem modelCentre_dist {i j : ℕ} (hij : i ≠ j) {x : EuclideanPlane} + (hi : ‖x - modelCentre i‖ = 1) (hj : ‖x - modelCentre j‖ = 1) : False := by + have h₁ : ‖modelCentre i - modelCentre j‖ ≤ 2 := by + calc ‖modelCentre i - modelCentre j‖ + = ‖(x - modelCentre j) - (x - modelCentre i)‖ := by congr 1; abel + _ ≤ ‖x - modelCentre j‖ + ‖x - modelCentre i‖ := norm_sub_le _ _ + _ = 2 := by rw [hi, hj]; norm_num + have h₂ : ‖modelCentre i - modelCentre j‖ ^ 2 = (3 * (i : ℝ) - 3 * j) ^ 2 := by + rw [norm_sq] + simp [modelCentre] + have h₃ : (1 : ℝ) ≤ ((i : ℝ) - j) ^ 2 := by + have : (i : ℤ) - j ≠ 0 := sub_ne_zero.mpr (by exact_mod_cast hij) + have h₄ : (1 : ℤ) ≤ ((i : ℤ) - j) ^ 2 := by + have := sq_pos_of_ne_zero this + omega + exact_mod_cast h₄ + have h₅ := norm_nonneg (modelCentre i - modelCentre j) + nlinarith + +theorem keyPl_of_mem {i : ℕ} (hi : i < 2 * a + b + c) {x : EuclideanPlane} + (h : ‖x - modelCentre i‖ = 1) : + keyPl a b c x = Sum.inl (grp a i, tw a b i (x - modelCentre i)) := by + classical + have hex : ∃ i < 2 * a + b + c, ‖x - modelCentre i‖ = 1 := ⟨i, hi, h⟩ + have hspec := hex.choose_spec + have heq : hex.choose = i := by + by_contra hne + exact modelCentre_dist hne hspec.2 h + unfold keyPl + rw [dite_eq_left hex, heq] + +theorem keyPl_of_notMem {x : EuclideanPlane} + (h : ∀ i < 2 * a + b + c, ‖x - modelCentre i‖ ≠ 1) : keyPl a b c x = Sum.inr x := by + classical + unfold keyPl + rw [dite_eq_right] + rintro ⟨i, hi, h'⟩ + exact h i hi h' + +theorem keyS_glue {p q : modelBase (2 * a + b + c)} (h : ModelGlue a b (2 * a + b + c) p q) : + keyS a b c p.1 = keyS a b c q.1 := by + have hmir : ∀ u : EuclideanPlane, ‖modelMirror u‖ = ‖u‖ := fun u ↦ by + have h₁ : ‖modelMirror u‖ ^ 2 = ‖u‖ ^ 2 := by + rw [norm_sq, norm_sq] + simp [modelMirror] + exact (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp h₁ + cases h with + | handle i hi u hu p q hp hq => + rw [hp, hq] + simp only [keyS, OnePoint.elim_some] + rw [keyPl_of_mem (i := 2 * i) (by omega) (by simpa using hu), + keyPl_of_mem (i := 2 * i + 1) (by omega) (by simpa [hmir] using hu)] + have h₁ : grp a (2 * i) = i := by simp only [grp]; rw [ite_eq_left (by omega)]; omega + have h₂ : grp a (2 * i + 1) = i := by simp only [grp]; rw [ite_eq_left (by omega)]; omega + have h₃ : tw a b (2 * i) (modelCentre (2 * i) + u - modelCentre (2 * i)) = 0 := by + simp only [tw]; rw [ite_eq_right (by omega)] + have h₄ : tw a b (2 * i + 1) (modelCentre (2 * i + 1) + modelMirror u - + modelCentre (2 * i + 1)) = 0 := by + simp only [tw]; rw [ite_eq_right (by omega)] + rw [h₁, h₂, h₃, h₄] + | crosscap i hi u hu p q hp hq => + rw [hp, hq] + simp only [keyS, OnePoint.elim_some] + have hi' : 2 * a + i < 2 * a + b + c := by omega + rw [keyPl_of_mem hi' (by simpa using hu), + keyPl_of_mem hi' (by simpa [sub_eq_add_neg, add_assoc] using hu)] + have h₃ : ∀ v : EuclideanPlane, tw a b (2 * a + i) v = v 0 * v 1 := fun v ↦ by + simp only [tw]; rw [ite_eq_left (by omega)] + rw [h₃, h₃] + simp + +/-- The invariant of a point of the model. -/ +noncomputable def keyM : SurfaceModel a b c → Option ((ℕ × ℝ) ⊕ EuclideanPlane) := + Quot.lift (fun p ↦ keyS a b c p.1) fun _ _ h ↦ keyS_glue h + +theorem keyM_qq {z : ℝ × ℝ} (h : Ok a b c z) : + keyM (qq a b c z) = some (keyPl a b c (pl z)) := by + rw [qq_of_ok h] + rfl + +theorem norm_sub_centre_sq (z : ℝ × ℝ) (i : ℕ) : + ‖pl z - modelCentre i‖ ^ 2 = (z.1 - 3 * i) ^ 2 + z.2 ^ 2 := by + rw [← dist_eq_norm, dist_centre_sq] + +theorem keyPl_clear {z : ℝ × ℝ} (h : Clear a b c z) : keyPl a b c (pl z) = Sum.inr (pl z) := by + refine keyPl_of_notMem fun i hi h₁ ↦ ?_ + have h₂ := h i hi + rw [← norm_sub_centre_sq, h₁] at h₂ + norm_num at h₂ + +theorem pl_injective : Function.Injective pl := by + intro z z' h + have h₀ := congrFun (congrArg (fun v : EuclideanPlane ↦ (v : Fin 2 → ℝ)) h) 0 + have h₁ := congrFun (congrArg (fun v : EuclideanPlane ↦ (v : Fin 2 → ℝ)) h) 1 + simp only [pl] at h₀ h₁ + exact Prod.ext (by simpa using h₀) (by simpa using h₁) + +/-- A point outside the closed discs has only itself as a preimage. -/ +theorem eq_of_qq_eq {z z' : ℝ × ℝ} (h : Clear a b c z) (h' : Ok a b c z') + (heq : qq a b c z = qq a b c z') : z = z' := by + have h₁ := congrArg keyM heq + rw [keyM_qq h.ok, keyM_qq h', keyPl_clear h] at h₁ + have h₂ := Option.some.inj h₁ + by_cases hc : ∃ i < 2 * a + b + c, ‖pl z' - modelCentre i‖ = 1 + · obtain ⟨i, hi, h₃⟩ := hc + rw [keyPl_of_mem hi h₃] at h₂ + cases h₂ + · rw [keyPl_of_notMem fun i hi h' ↦ hc ⟨i, hi, h'⟩] at h₂ + exact pl_injective (Sum.inr.inj h₂) + +/-- A point on a circle has key given by that circle. -/ +theorem keyM_circle {z : ℝ × ℝ} {i : ℕ} (hi : i < 2 * a + b + c) (h : Ok a b c z) + (hz : (z.1 - 3 * i) ^ 2 + z.2 ^ 2 = 1) : + keyM (qq a b c z) = some (Sum.inl (grp a i, tw a b i (pl z - modelCentre i))) := by + rw [keyM_qq h, keyPl_of_mem hi] + have h₁ := norm_sub_centre_sq z i + rw [hz] at h₁ + exact (pow_eq_one_iff_of_nonneg (norm_nonneg _) two_ne_zero).mp h₁ + +end GraphMinor.GM20.Draw diff --git a/LeanPool/GraphMinor/GM20/Draw10.lean b/LeanPool/GraphMinor/GM20/Draw10.lean new file mode 100644 index 0000000000..38aafb5cad --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Draw10.lean @@ -0,0 +1,277 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Draw9 + +/-! +# Counting the cuffs of a model surface, continued + +Here we finish the proof that `SurfaceModel a b c` has at least `c` cuffs, and we move drawings +along +homeomorphisms. +-/ + +@[expose] public section + +namespace GraphMinor.GM20.Draw + +open Set Topology GraphMinor.Surface Metric GraphMinor.GM17 + +variable {a b c : ℕ} + +/-- The centre of a circle, as a complex number. -/ +noncomputable def cz (i : ℕ) : ℂ := ((3 * (i : ℝ) : ℝ) : ℂ) + +theorem nsq (ζ : ℂ) (i : ℕ) : ‖ζ - cz i‖ ^ 2 = ((cp ζ).1 - 3 * i) ^ 2 + (cp ζ).2 ^ 2 := by + rw [Complex.sq_norm, Complex.normSq_apply] + simp only [cz, cp, Complex.sub_re, Complex.sub_im, Complex.ofReal_re, Complex.ofReal_im] + ring + +theorem three_le {i j : ℕ} (h : i ≠ j) : 3 ≤ ‖cz i - cz j‖ := by + have h₁ : cz i - cz j = ((3 * ((i : ℝ) - j) : ℝ) : ℂ) := by + simp only [cz] + push_cast + ring + rw [h₁, Complex.norm_real, Real.norm_eq_abs, abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 3)] + have h₂ : (1 : ℤ) ≤ |(i : ℤ) - j| := Int.one_le_abs (sub_ne_zero.mpr (by exact_mod_cast h)) + have h₃ : (1 : ℝ) ≤ |(i : ℝ) - j| := by exact_mod_cast h₂ + linarith + +theorem one_lt_far {i I : ℕ} (h : i ≠ I) {ζ : ℂ} (hζ : ‖ζ - cz I‖ < 2) : 1 < ‖ζ - cz i‖ := by + have h₁ := three_le h + have h₂ : ‖cz i - cz I‖ ≤ ‖ζ - cz i‖ + ‖ζ - cz I‖ := by + have h₃ : cz i - cz I = (ζ - cz I) - (ζ - cz i) := by ring + rw [h₃, add_comm] + exact norm_sub_le _ _ + linarith + +theorem sq_of_one_lt {r : ℝ} (h : 1 < r) : 1 < r ^ 2 := by nlinarith + +/-- A point near the `I`th circle, but not inside it, is clear. -/ +theorem clear_near {I : ℕ} {ζ : ℂ} (h₁ : 1 < ‖ζ - cz I‖) (h₂ : ‖ζ - cz I‖ < 2) : + Clear a b c (cp ζ) := fun i _ ↦ by + rw [← nsq] + rcases eq_or_ne i I with rfl | hne + · exact sq_of_one_lt h₁ + · exact sq_of_one_lt (one_lt_far hne h₂) + +/-- A point near a circle that is not pasted is off the pasted circles. -/ +theorem free_near {I : ℕ} (hI : 2 * a + b ≤ I) {ζ : ℂ} (h : ‖ζ - cz I‖ < 2) : + Free a b (cp ζ) := fun i hi ↦ by + rw [← nsq] + exact sq_of_one_lt (one_lt_far (by omega) h) + +theorem cp_cz (I : ℕ) : cp (cz I + 1) = (3 * (I : ℝ) + 1, 0) := by + simp [cp, cz] + +theorem ok_cz (I : ℕ) : Ok a b c (3 * (I : ℝ) + 1, 0) := + ok_circle (x := 1) (y := 0) (by norm_num) + +/-- The points of the circles that are not pasted are boundary points. -/ +theorem qq_mem_bd {I : ℕ} (hI : 2 * a + b ≤ I) (hI' : I < 2 * a + b + c) : + qq a b c (3 * (I : ℝ) + 1, 0) ∈ bd (SurfaceModel a b c) := by + have hB : ∀ ζ ∈ ball (cz I + 1) (1 / 2), ‖ζ - cz I‖ < 3 / 2 := fun ζ hζ ↦ by + have h₁ : ‖ζ - (cz I + 1)‖ < 1 / 2 := by simpa [dist_eq_norm] using hζ + have h₂ : ζ - cz I = (ζ - (cz I + 1)) + 1 := by ring + rw [h₂] + have h₃ := norm_add_le (ζ - (cz I + 1)) 1 + rw [norm_one] at h₃ + linarith + have hj := isOpenEmbedding_chart (a := a) (b := b) (c := c) (B := ball (cz I + 1) (1 / 2)) + isOpen_ball fun ζ hζ _ ↦ free_near hI (by linarith [hB ζ hζ]) + have hw : cz I + 1 ∈ chartDom a b c (ball (cz I + 1) (1 / 2)) := + ⟨mem_ball_self (by norm_num), by + change Ok a b c (cp (cz I + 1)) + rw [cp_cz] + exact ok_cz I⟩ + have h₁ := not_interior_of_chart hj ⟨_, hw⟩ ?_ + · have h₂ : chart a b c (ball (cz I + 1) (1 / 2)) ⟨_, hw⟩ = qq a b c (3 * (I : ℝ) + 1, 0) := by + change qq a b c (cp (cz I + 1)) = _ + rw [cp_cz] + rw [h₂] at h₁ + exact h₁ + · intro hint + obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.mp (mem_interior_iff_mem_nhds.mp hint) + set t : ℝ := min ε 1 / 2 with ht + have ht₀ : 0 < t := by positivity + have ht₁ : t ≤ 1 / 2 := by + have := min_le_right ε 1 + rw [ht] + linarith + have ht₂ : t < ε := by + have := min_le_left ε 1 + rw [ht] + linarith [lt_min hε one_pos] + have hmem : cz I + 1 - (t : ℂ) ∈ ball (cz I + 1) ε := by + rw [mem_ball, dist_eq_norm, sub_sub_cancel_left, norm_neg, Complex.norm_real, + Real.norm_eq_abs, abs_of_pos ht₀] + exact ht₂ + have hok := (hball hmem).2 I hI' + change 1 ≤ ((cp _).1 - 3 * (I : ℝ)) ^ 2 + (cp _).2 ^ 2 at hok + rw [← nsq] at hok + have h₂ : cz I + 1 - (t : ℂ) - cz I = ((1 - t : ℝ) : ℂ) := by + push_cast + ring + rw [h₂, Complex.norm_real, Real.norm_eq_abs, sq_abs] at hok + nlinarith + +/-- The points at distance `3/2` from a circle centre are interior points. -/ +theorem interior_sphere {I : ℕ} {ζ₀ : ℂ} (h : ‖ζ₀ - cz I‖ = 3 / 2) : + IsInteriorPoint (qq a b c (cp ζ₀)) := by + have hB : ∀ ζ ∈ ball ζ₀ (1 / 4), 1 < ‖ζ - cz I‖ ∧ ‖ζ - cz I‖ < 2 := fun ζ hζ ↦ by + have h₁ : ‖ζ - ζ₀‖ < 1 / 4 := by simpa [dist_eq_norm] using hζ + have h₂ : ‖ζ - cz I‖ ≤ ‖ζ - ζ₀‖ + ‖ζ₀ - cz I‖ := by + have h₃ : ζ - cz I = (ζ - ζ₀) + (ζ₀ - cz I) := by ring + rw [h₃] + exact norm_add_le _ _ + have h₃ : ‖ζ₀ - cz I‖ ≤ ‖ζ - ζ₀‖ + ‖ζ - cz I‖ := by + have h₄ : ζ₀ - cz I = (ζ - cz I) - (ζ - ζ₀) := by ring + rw [h₄, add_comm] + exact norm_sub_le _ _ + constructor <;> linarith + have hcl : ∀ ζ ∈ ball ζ₀ (1 / 4), Clear a b c (cp ζ) := fun ζ hζ ↦ + clear_near (hB ζ hζ).1 (hB ζ hζ).2 + have hj := isOpenEmbedding_chart (a := a) (b := b) (c := c) (B := ball ζ₀ (1 / 4)) + isOpen_ball fun ζ hζ _ i _ ↦ hcl ζ hζ i (by omega) + have hdom : chartDom a b c (ball ζ₀ (1 / 4)) = ball ζ₀ (1 / 4) := + Set.inter_eq_left.mpr fun ζ hζ ↦ (hcl ζ hζ).ok + have hw : ζ₀ ∈ chartDom a b c (ball ζ₀ (1 / 4)) := by + rw [hdom] + exact mem_ball_self (by norm_num) + exact interior_of_chart hj + ⟨(Homeomorph.setCongr hdom).trans (ballHomeo ζ₀ (by norm_num))⟩ ⟨ζ₀, hw⟩ + +theorem isClosed_ok : IsClosed {ζ : ℂ | Ok a b c (cp ζ)} := by + have : {ζ : ℂ | Ok a b c (cp ζ)} = + ⋂ i ∈ Finset.range (2 * a + b + c), {ζ : ℂ | 1 ≤ ‖ζ - cz i‖ ^ 2} := by + ext ζ + simp only [mem_ofPred_eq, mem_iInter, Finset.mem_range, nsq] + rfl + rw [this] + refine isClosed_biInter fun i _ ↦ isClosed_le continuous_const ?_ + fun_prop + +/-- The circles that are not pasted lie in different components of the boundary. -/ +theorem not_connected [T2Space (SurfaceModel a b c)] {I J : ℕ} (hI : 2 * a + b ≤ I) + (hJ : 2 * a + b ≤ J) (_hJ' : J < 2 * a + b + c) (hne : I ≠ J) + {K : Set (SurfaceModel a b c)} (hK : IsPreconnected K) (hbd : K ⊆ bd _) + (h₁ : qq a b c (3 * (I : ℝ) + 1, 0) ∈ K) (h₂ : qq a b c (3 * (J : ℝ) + 1, 0) ∈ K) : False := by + have hf : ∀ ζ ∈ ball (cz I) (3 / 2), Ok a b c (cp ζ) → Free a b (cp ζ) := fun ζ hζ _ ↦ + free_near hI (by + have : ‖ζ - cz I‖ < 3 / 2 := by simpa [dist_eq_norm] using hζ + linarith) + have hV₁ : IsOpen (range (chart a b c (ball (cz I) (3 / 2)))) := + (isOpenEmbedding_chart isOpen_ball hf).isOpen_range + let E : Set ℂ := closedBall (cz I) (3 / 2) ∩ {ζ : ℂ | Ok a b c (cp ζ)} + have hE : IsCompact E := (isCompact_closedBall _ _).inter_right isClosed_ok + have hEc : ContinuousOn (fun ζ ↦ qq a b c (cp ζ)) E := + continuousOn_qq.comp continuous_cp.continuousOn fun ζ hζ ↦ hζ.2 + have hV₂ : IsOpen ((fun ζ ↦ qq a b c (cp ζ)) '' E)ᶜ := + (hE.image_of_continuousOn hEc).isClosed.isOpen_compl + have hcover : K ⊆ range (chart a b c (ball (cz I) (3 / 2))) ∪ + ((fun ζ ↦ qq a b c (cp ζ)) '' E)ᶜ := by + intro x hx + by_cases hxE : x ∈ (fun ζ ↦ qq a b c (cp ζ)) '' E + · left + obtain ⟨ζ, hζ, rfl⟩ := hxE + have h₃ : ‖ζ - cz I‖ ≤ 3 / 2 := by simpa [dist_eq_norm] using hζ.1 + rcases h₃.lt_or_eq with h₄ | h₄ + · exact ⟨⟨ζ, by simpa [dist_eq_norm] using h₄, hζ.2⟩, rfl⟩ + · exact absurd (interior_sphere h₄) (hbd hx) + · exact Or.inr hxE + have hcI : ‖(cz I + 1) - cz I‖ = 1 := by simp + have hmem₁ : (K ∩ range (chart a b c (ball (cz I) (3 / 2)))).Nonempty := by + refine ⟨_, h₁, ⟨cz I + 1, ?_, ?_⟩, ?_⟩ + · rw [mem_ball, dist_eq_norm, hcI] + norm_num + · change Ok a b c (cp (cz I + 1)) + rw [cp_cz] + exact ok_cz I + · change qq a b c (cp (cz I + 1)) = _ + rw [cp_cz] + have hdist : 2 ≤ ‖(cz J + 1) - cz I‖ := by + have h₃ := three_le hne.symm + have h₄ : cz J - cz I = ((cz J + 1) - cz I) - 1 := by ring + have h₅ := norm_sub_le ((cz J + 1) - cz I) 1 + rw [← h₄, norm_one] at h₅ + linarith + have hfJ : Free a b (3 * (J : ℝ) + 1, 0) := by + rw [← cp_cz] + exact free_near hJ (by simp) + have hmem₂ : (K ∩ ((fun ζ ↦ qq a b c (cp ζ)) '' E)ᶜ).Nonempty := by + refine ⟨_, h₂, ?_⟩ + rintro ⟨ζ, hζ, heq⟩ + have h₃ : ‖ζ - cz I‖ ≤ 3 / 2 := by simpa [dist_eq_norm] using hζ.1 + have h₄ := eq_of_free hζ.2 (free_near hI (by linarith)) (ok_cz J) hfJ heq + rw [← cp_cz] at h₄ + have h₅ := cp_injective h₄ + subst h₅ + linarith + obtain ⟨x, -, hx₁, hx₂⟩ := hK _ _ hV₁ hV₂ hcover hmem₁ hmem₂ + obtain ⟨ζ, rfl⟩ := hx₁ + refine hx₂ ⟨ζ.1, ⟨?_, ζ.2.2⟩, rfl⟩ + exact mem_closedBall.mpr (mem_ball.mp ζ.2.1).le + +/-- A model has at least `c` cuffs. -/ +theorem le_encard_cuffs [T2Space (SurfaceModel a b c)] : + (c : ℕ∞) ≤ (cuffs (SurfaceModel a b c)).encard := by + classical + let w : Fin c → SurfaceModel a b c := fun i ↦ qq a b c (3 * ((2 * a + b + i : ℕ) : ℝ) + 1, 0) + have hw : ∀ i, w i ∈ bd (SurfaceModel a b c) := fun i ↦ + qq_mem_bd (by omega) (by omega) + let f : Fin c → Set (SurfaceModel a b c) := fun i ↦ connectedComponentIn (bd _) (w i) + have hf : ∀ i, f i ∈ cuffs (SurfaceModel a b c) := fun i ↦ ⟨w i, hw i, rfl⟩ + have hinj : Function.Injective f := by + intro i j hij + by_contra hne + have hne' : 2 * a + b + (i : ℕ) ≠ 2 * a + b + (j : ℕ) := fun h ↦ + hne (Fin.ext (by omega)) + refine not_connected (I := 2 * a + b + i) (J := 2 * a + b + j) (by omega) (by omega) (by omega) + hne' (K := f i) isPreconnected_connectedComponentIn (connectedComponentIn_subset _ _) + (mem_connectedComponentIn (hw i)) ?_ + change w j ∈ f i + rw [hij] + exact mem_connectedComponentIn (hw j) + have h₁ : (f '' univ).encard = (c : ℕ∞) := by + rw [hinj.injOn.encard_image, Set.encard_univ] + simp + rw [← h₁] + exact Set.encard_le_encard (by + rintro _ ⟨i, -, rfl⟩ + exact hf i) + +/-- A homeomorphism carries a line to a line with the corresponding ends. -/ +theorem image_isLineWithEnds {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] (ψ : S ≃ₜ T) + {L : Set S} {u v : S} (h : IsLineWithEnds L u v) : IsLineWithEnds (ψ '' L) (ψ u) (ψ v) := by + obtain ⟨f, rfl, rfl⟩ := h + exact ⟨f.trans (ψ.image L), rfl, rfl⟩ + +/-- A homeomorphism carries a drawing to a drawing. -/ +theorem CanBeDrawn.map {α' : Type*} {β' : Type*} {S T : Type} [TopologicalSpace S] + [TopologicalSpace T] (ψ : S ≃ₜ T) {H : Hypergraph α' β'} (h : CanBeDrawn S H) : + CanBeDrawn T H := by + obtain ⟨ν, F, h₁, h₂, h₃, h₄, h₅⟩ := h + refine ⟨ψ ∘ ν, fun e ↦ ψ '' F e, ψ.injective.comp_injOn h₁, ?_, ?_, ?_, ?_⟩ + · intro e he u v hu hv huv + exact image_isLineWithEnds ψ (h₂ e he u v hu hv huv) + · intro e he v hv + obtain ⟨h₆, h₇⟩ := h₃ e he v hv + obtain ⟨g⟩ := h₆ + exact ⟨⟨g.trans (ψ.image _)⟩, mem_image_of_mem _ h₇⟩ + · intro e he f hf hef w hw + rw [← image_inter ψ.injective] at hw + obtain ⟨x, hx, rfl⟩ := hw + obtain ⟨v, hv, rfl⟩ := h₄ e he f hf hef hx + exact ⟨v, hv, rfl⟩ + · rintro e he v hv ⟨x, hx, hxv⟩ + obtain rfl := ψ.injective hxv + exact h₅ e he v hv hx + +end GraphMinor.GM20.Draw diff --git a/LeanPool/GraphMinor/GM20/Draw2.lean b/LeanPool/GraphMinor/GM20/Draw2.lean new file mode 100644 index 0000000000..fba5f824d5 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Draw2.lean @@ -0,0 +1,184 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Draw1 +public import LeanPool.GraphMinor.GM11.Forest +public import LeanPool.GraphMinor.GM11.Fan + +/-! +# Drawing a graph in a surface of large genus: slabs + +We draw `n` disjoint curves that run from left to right across a vertical strip of the model. A +`Slab` from `x₁` to `x₂` with permutation `s` is such a family: the curve from height `p` at `x₁` +ends at +height `s p` at `x₂`. Two slabs compose (`Slab.comp`). So it is enough to have a slab for each swap +of two +neighbouring heights, and that is done in the next file with one handle or one cross-cap. +-/ + +@[expose] public section + +namespace GraphMinor.GM20.Draw + +open Set Topology GraphMinor.Surface unitInterval + +variable {a b c : ℕ} + +/-- The part of the model between the vertical lines at `x₁` and `x₂`. -/ +noncomputable def Zone (a b c : ℕ) (x₁ x₂ : ℝ) : Set (SurfaceModel a b c) := + qq a b c '' {z | Ok a b c z ∧ x₁ ≤ z.1 ∧ z.1 ≤ x₂} + +/-- A family of `n` disjoint lines across the strip from `x₁` to `x₂`, from `(x₁, p)` to `(x₂, s +p)`, +which touch the two sides only at their ends. -/ +def Slab (a b c n : ℕ) (x₁ x₂ : ℝ) (s : Equiv.Perm (Fin n)) : Prop := + ∃ P : Fin n → Set (SurfaceModel a b c), + (∀ p, IsLineWithEnds (P p) (qq a b c (x₁, p)) (qq a b c (x₂, s p))) ∧ + (Pairwise fun p p' ↦ Disjoint (P p) (P p')) ∧ + (∀ p, P p ⊆ Zone a b c x₁ x₂) ∧ + (∀ p z, Ok a b c z → z.1 ≤ x₁ → qq a b c z ∈ P p → qq a b c z = qq a b c (x₁, p)) ∧ + (∀ p z, Ok a b c z → x₂ ≤ z.1 → qq a b c z ∈ P p → qq a b c z = qq a b c (x₂, s p)) + +theorem mem_of_line {S : Type*} [TopologicalSpace S] {L : Set S} {u v : S} + (h : IsLineWithEnds L u v) : u ∈ L ∧ v ∈ L := by + obtain ⟨f, rfl, rfl⟩ := h + exact ⟨(f 0).2, (f 1).2⟩ + +/-- Two slabs side by side form a slab. -/ +theorem Slab.comp [T2Space (SurfaceModel a b c)] {n : ℕ} {x₁ x₂ x₃ : ℝ} + {s t : Equiv.Perm (Fin n)} (h₁ : Slab a b c n x₁ x₂ s) (h₂ : Slab a b c n x₂ x₃ t) + (h₁₂ : x₁ ≤ x₂) (h₂₃ : x₂ ≤ x₃) : Slab a b c n x₁ x₃ (t * s) := by + obtain ⟨P, hP, hPd, hPz, hPl, hPr⟩ := h₁ + obtain ⟨Q, hQ, hQd, hQz, hQl, hQr⟩ := h₂ + have hPQ : ∀ {p p' w}, w ∈ P p → w ∈ Q p' → w = qq a b c (x₂, s p) ∧ w = qq a b c (x₂, p') := by + intro p p' w hw hw' + obtain ⟨z, ⟨hz₁, hz₂, hz₃⟩, rfl⟩ := hPz p hw + obtain ⟨z', ⟨hz₁', hz₂', hz₃'⟩, heq⟩ := hQz p' hw' + exact ⟨heq ▸ hPr p z' hz₁' hz₂' (heq ▸ hw), hQl p' z hz₁ hz₃ hw'⟩ + refine ⟨fun p ↦ P p ∪ Q (s p), fun p ↦ ?_, ?_, fun p ↦ ?_, fun p z hz hzl hmem ↦ ?_, + fun p z hz hzr hmem ↦ ?_⟩ + · refine GM11.IsLineWithEnds.union (GM11.IsLineWithEnds.symm (hP p)) (hQ (s p)) ?_ + ext w + constructor + · rintro ⟨h₃, h₄⟩ + exact (hPQ h₃ h₄).1 + · rintro rfl + exact ⟨(mem_of_line (hP p)).2, (mem_of_line (hQ (s p))).1⟩ + · intro p p' hne + have hne' : s p ≠ s p' := fun h ↦ hne (s.injective h) + rw [Set.disjoint_left] + rintro w (h₃ | h₃) (h₄ | h₄) + · exact Set.disjoint_left.mp (hPd hne) h₃ h₄ + · have h₅ := (hPQ h₃ h₄) + refine Set.disjoint_left.mp (hQd hne') (mem_of_line (hQ (s p))).1 ?_ + rw [← h₅.1, h₅.2] + exact (mem_of_line (hQ (s p'))).1 + · have h₅ := (hPQ h₄ h₃) + refine Set.disjoint_left.mp (hQd hne') (mem_of_line (hQ (s p))).1 ?_ + rw [← h₅.2, h₅.1] + exact (mem_of_line (hQ (s p'))).1 + · exact Set.disjoint_left.mp (hQd hne') h₃ h₄ + · rintro w (h₃ | h₃) + · obtain ⟨z, ⟨h₄, h₅, h₆⟩, rfl⟩ := hPz p h₃ + exact ⟨z, ⟨h₄, h₅, h₆.trans h₂₃⟩, rfl⟩ + · obtain ⟨z, ⟨h₄, h₅, h₆⟩, rfl⟩ := hQz _ h₃ + exact ⟨z, ⟨h₄, h₁₂.trans h₅, h₆⟩, rfl⟩ + · rcases hmem with h₃ | h₃ + · exact hPl p z hz hzl h₃ + · have h₄ := hQl (s p) z hz (hzl.trans h₁₂) h₃ + exact hPl p z hz hzl (h₄ ▸ (mem_of_line (hP p)).2) + · rcases hmem with h₃ | h₃ + · have h₄ := hPr p z hz (h₂₃.trans hzr) h₃ + exact hQr (s p) z hz hzr (h₄ ▸ (mem_of_line (hQ (s p))).1) + · exact hQr (s p) z hz hzr h₃ + +/-! ### Curves in the plane -/ + +/-- The graph of `f` over `[l, r]` in the plane. -/ +def gr (f : ℝ → ℝ) (l r : ℝ) : Set (ℝ × ℝ) := (fun x ↦ (x, f x)) '' Icc l r + +/-- The graph of a continuous function is a line in the model, if the graph is outside the open +discs +and at most one point `e` is on a circle. -/ +theorem isLine_gr [T2Space (SurfaceModel a b c)] {f : ℝ → ℝ} {l r e : ℝ} (hlr : l < r) + (hf : ContinuousOn f (Icc l r)) (hok : ∀ x ∈ Icc l r, Ok a b c (x, f x)) + (hc : ∀ x ∈ Icc l r, x ≠ e → Clear a b c (x, f x)) : + IsLineWithEnds (qq a b c '' gr f l r) (qq a b c (l, f l)) (qq a b c (r, f r)) := by + have hmem : ∀ t : I, l + t.1 * (r - l) ∈ Icc l r := fun t ↦ by + have h₁ := t.2.1 + have h₂ := t.2.2 + constructor <;> nlinarith + let g : I → SurfaceModel a b c := fun t ↦ qq a b c (l + t.1 * (r - l), f (l + t.1 * (r - l))) + have hline : Continuous fun t : I ↦ l + t.1 * (r - l) := by fun_prop + have hg : Continuous g := by + have h₁ : Continuous fun t : I ↦ ((l + t.1 * (r - l), f (l + t.1 * (r - l))) : ℝ × ℝ) := by + refine hline.prodMk ?_ + exact hf.comp_continuous hline hmem + exact continuousOn_qq.comp_continuous h₁ fun t ↦ hok _ (hmem t) + have hinj : Function.Injective g := by + intro s t hst + have hpar : ∀ {s t : I}, l + s.1 * (r - l) = l + t.1 * (r - l) → s = t := by + intro s t h + apply Subtype.ext + have h₁ : r - l ≠ 0 := by linarith + exact mul_right_cancel₀ h₁ (by linarith) + by_cases h₁ : l + s.1 * (r - l) = e + · by_cases h₂ : l + t.1 * (r - l) = e + · exact hpar (h₁.trans h₂.symm) + · have := eq_of_qq_eq (hc _ (hmem t) h₂) (hok _ (hmem s)) hst.symm + exact hpar (congrArg Prod.fst this).symm + · have := eq_of_qq_eq (hc _ (hmem s) h₁) (hok _ (hmem t)) hst + exact hpar (congrArg Prod.fst this) + have hrange : range g = qq a b c '' gr f l r := by + ext w + constructor + · rintro ⟨t, rfl⟩ + exact ⟨_, ⟨_, hmem t, rfl⟩, rfl⟩ + · rintro ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + have hd : 0 < r - l := by linarith + refine ⟨⟨(x - l) / (r - l), div_nonneg (by linarith [hx.1]) hd.le, + (div_le_one hd).mpr (by linarith [hx.2])⟩, ?_⟩ + have : l + (x - l) / (r - l) * (r - l) = x := by field_simp; ring + simp only [g, this] + have := GM11.isLineWithEnds_range ⟨g, hg⟩ hinj + have h₀ : g 0 = qq a b c (l, f l) := by simp [g] + have h₁ : g 1 = qq a b c (r, f r) := by simp [g] + simp only [ContinuousMap.coe_mk] at this + rwa [hrange, h₀, h₁] at this + +theorem clear_of_abs {x y : ℝ} (h : 1 < |y|) : Clear a b c (x, y) := by + intro i _ + have h₁ : 1 < y ^ 2 := by + rw [← sq_abs] + nlinarith + have h₂ := sq_nonneg (x - 3 * i) + simp only + linarith + +theorem clear_of_gap {x y : ℝ} (m : ℤ) (h₁ : 3 * (m : ℝ) + 1 < x) (h₂ : x < 3 * m + 2) : + Clear a b c (x, y) := by + intro i _ + have h₃ := sq_nonneg y + simp only + rcases le_or_gt (i : ℤ) m with h | h + · have h₄ : (i : ℝ) ≤ m := by exact_mod_cast h + nlinarith + · have h₄ : (m : ℝ) + 1 ≤ i := by exact_mod_cast h + nlinarith + +/-- A plane set `S` of a strand: all its points are clear but for the listed points on circles. -/ +theorem disjoint_of_below {S S' : Set (ℝ × ℝ)} (hS : ∀ z ∈ S, Ok a b c z) + (hS' : ∀ z ∈ S', Clear a b c z) (h : Disjoint S S') : + Disjoint (qq a b c '' S) (qq a b c '' S') := by + rw [Set.disjoint_left] + rintro _ ⟨z, hz, rfl⟩ ⟨z', hz', heq⟩ + exact Set.disjoint_left.mp h hz ((eq_of_qq_eq (hS' _ hz') (hS _ hz) heq) ▸ hz') + +end GraphMinor.GM20.Draw diff --git a/LeanPool/GraphMinor/GM20/Draw3.lean b/LeanPool/GraphMinor/GM20/Draw3.lean new file mode 100644 index 0000000000..3f6ea447e9 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Draw3.lean @@ -0,0 +1,332 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Draw2 + +/-! +# Drawing a graph in a surface of large genus: slabs for a swap + +A slab that swaps the neighbouring heights `t` and `t + 1`. All curves but two run from left to +right +and keep their height order. They are pushed up or down, in the first and last quarter unit of the +strip, so that they stay away from the axis in the middle. The two other curves stay in a band +around +the axis. `slab_of_band` reduces the slab to these two curves. The band is the region between the +curves +with `g = -5/4` from height `t` and `g = 5/4` from height `t + 1`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20.Draw + +open Set Topology GraphMinor.Surface + +variable {a b c : ℕ} + +/-- The ramp: `0` at `l` and `r`, and `1` from `l + 1/4` to `r - 1/4`. -/ +noncomputable def lam (l r x : ℝ) : ℝ := max 0 (min 1 (min (4 * (x - l)) (4 * (r - x)))) + +theorem continuous_lam (l r : ℝ) : Continuous (lam l r) := by + unfold lam + fun_prop + +theorem lam_nonneg (l r x : ℝ) : 0 ≤ lam l r x := le_max_left _ _ + +theorem lam_le_one (l r x : ℝ) : lam l r x ≤ 1 := max_le zero_le_one (min_le_left _ _) + +theorem lam_left {l r : ℝ} (_h : l ≤ r) : lam l r l = 0 := by + unfold lam + rw [max_eq_left] + exact (min_le_right _ _).trans ((min_le_left _ _).trans (by simp)) + +theorem lam_right {l r : ℝ} (_h : l ≤ r) : lam l r r = 0 := by + unfold lam + rw [max_eq_left] + exact (min_le_right _ _).trans ((min_le_right _ _).trans (by simp)) + +theorem lam_eq_one {l r x : ℝ} (h₁ : l + 1 / 4 ≤ x) (h₂ : x ≤ r - 1 / 4) : lam l r x = 1 := by + unfold lam + rw [min_eq_left (le_min (by linarith) (by linarith))] + exact max_eq_right zero_le_one + +theorem lam_lt_one {l r x : ℝ} (h : lam l r x < 1) : x < l + 1 / 4 ∨ r - 1 / 4 < x := by + by_contra hc + rw [not_or, not_lt, not_lt] at hc + exact absurd (lam_eq_one hc.1 hc.2) h.ne + +/-- The height in the middle of the strip of the curve starting at height `p`. -/ +noncomputable def gg (t p : ℕ) : ℝ := + if p < t then 3 * ((p : ℝ) - t) - 5 / 4 + else if p = t then -5 / 4 + else if p = t + 1 then 5 / 4 + else 3 * ((p : ℝ) - t - 1) + 5 / 4 + +theorem gg_lt {t p : ℕ} (h : p < t) : gg t p ≤ -17 / 4 := by + have h₁ : (p : ℝ) + 1 ≤ t := by exact_mod_cast h + simp only [gg, ite_eq_left h] + linarith + +theorem gg_gt {t p : ℕ} (h : t + 1 < p) : 17 / 4 ≤ gg t p := by + have h₁ : (t : ℝ) + 2 ≤ p := by exact_mod_cast h + simp only [gg] + rw [ite_eq_right (by omega), ite_eq_right (by omega), ite_eq_right (by omega)] + linarith + +theorem gg_strictMono (t : ℕ) : StrictMono (gg t) := by + refine strictMono_nat_of_lt_succ fun p ↦ ?_ + have hcast : ((p + 1 : ℕ) : ℝ) = p + 1 := by push_cast; ring + rcases lt_trichotomy (p + 1) t with h | h | h + · simp only [gg, ite_eq_left h, ite_eq_left (show p < t by omega)] + rw [hcast] + linarith + · have h₁ : (p : ℝ) + 1 = t := by exact_mod_cast h + simp only [gg] + rw [ite_eq_left (by omega), ite_eq_right (by omega), ite_eq_left (by omega)] + linarith + · by_cases h₂ : p = t + · subst h₂ + have h₃ : gg p p = -5 / 4 := by simp [gg] + have h₄ : gg p (p + 1) = 5 / 4 := by simp [gg] + rw [h₃, h₄] + norm_num + · by_cases h₃ : p = t + 1 + · subst h₃ + have h₄ : gg t (t + 1) = 5 / 4 := by simp [gg] + have h₅ : gg t (t + 1 + 1) = 3 * (((t + 1 + 1 : ℕ) : ℝ) - t - 1) + 5 / 4 := by + simp only [gg] + rw [ite_eq_right (by omega), ite_eq_right (by omega), ite_eq_right (by omega)] + rw [h₄, h₅] + push_cast + linarith + · simp only [gg] + rw [ite_eq_right (by omega), ite_eq_right (by omega), ite_eq_right (by omega), ite_eq_right + (by omega), + ite_eq_right (by omega), ite_eq_right (by omega), hcast] + linarith + +/-- The height over `x` of the curve from height `p`. -/ +noncomputable def yy (l r : ℝ) (t p : ℕ) (x : ℝ) : ℝ := + (1 - lam l r x) * p + lam l r x * gg t p + +theorem interp_lt {u A B A' B' : ℝ} (h₀ : 0 ≤ u) (h₁ : u ≤ 1) (hA : A < A') (hB : B < B') : + (1 - u) * A + u * B < (1 - u) * A' + u * B' := by + rcases h₀.eq_or_lt with rfl | h₀ + · simpa using hA + · nlinarith [mul_lt_mul_of_pos_left hB h₀, mul_le_mul_of_nonneg_left hA.le (sub_nonneg.mpr h₁)] + +/-- A slab for the swap of `t` and `t + 1`, from two curves that stay in the band. -/ +theorem slab_of_band [T2Space (SurfaceModel a b c)] {n : ℕ} (i : Fin n) {l r : ℝ} (hlr : l < r) + (hgap : ∀ x ∈ Icc l r, lam l r x < 1 → ∀ y, Clear a b c (x, y)) + {Su Sv : Set (ℝ × ℝ)} + (hu : IsLineWithEnds (qq a b c '' Su) (qq a b c (l, (i : ℕ))) + (qq a b c (r, ((i : ℕ) + 1 : ℕ)))) + (hv : IsLineWithEnds (qq a b c '' Sv) (qq a b c (l, ((i : ℕ) + 1 : ℕ))) + (qq a b c (r, (i : ℕ)))) + (hok : ∀ z ∈ Su ∪ Sv, Ok a b c z ∧ l ≤ z.1 ∧ z.1 ≤ r) + (hband : ∀ z ∈ Su ∪ Sv, (1 - lam l r z.1) * ((i : ℕ) : ℝ) + lam l r z.1 * (-5 / 4) ≤ z.2 ∧ + z.2 ≤ (1 - lam l r z.1) * (((i : ℕ) + 1 : ℕ) : ℝ) + lam l r z.1 * (5 / 4)) + (hd : Disjoint (qq a b c '' Su) (qq a b c '' Sv)) + (hul : ∀ z, Ok a b c z → z.1 ≤ l → qq a b c z ∈ qq a b c '' Su → + qq a b c z = qq a b c (l, (i : ℕ))) + (hur : ∀ z, Ok a b c z → r ≤ z.1 → qq a b c z ∈ qq a b c '' Su → + qq a b c z = qq a b c (r, ((i : ℕ) + 1 : ℕ))) + (hvl : ∀ z, Ok a b c z → z.1 ≤ l → qq a b c z ∈ qq a b c '' Sv → + qq a b c z = qq a b c (l, ((i : ℕ) + 1 : ℕ))) + (hvr : ∀ z, Ok a b c z → r ≤ z.1 → qq a b c z ∈ qq a b c '' Sv → + qq a b c z = qq a b c (r, (i : ℕ))) : + Slab a b c (n + 1) l r (Equiv.swap i.castSucc i.succ) := by + classical + set t : ℕ := (i : ℕ) with ht + have hcont : ∀ p : ℕ, ContinuousOn (yy l r t p) (Icc l r) := fun p ↦ by + unfold yy + have := continuous_lam l r + exact Continuous.continuousOn (by fun_prop) + have hgen : ∀ p : ℕ, p ≠ t → p ≠ t + 1 → ∀ x ∈ Icc l r, Clear a b c (x, yy l r t p x) := by + intro p h₁ h₂ x hx + rcases (lam_le_one l r x).lt_or_eq with h | h + · exact hgap x hx h _ + · refine clear_of_abs ?_ + simp only [yy, h] + rcases lt_or_gt_of_ne h₁ with h₃ | h₃ + · have := gg_lt h₃ + rw [abs_of_neg (by linarith)] + linarith + · have := gg_gt (show t + 1 < p by omega) + rw [abs_of_pos (by linarith)] + linarith + have hyl : ∀ p : ℕ, yy l r t p l = p := fun p ↦ by simp [yy, lam_left hlr.le] + have hyr : ∀ p : ℕ, yy l r t p r = p := fun p ↦ by simp [yy, lam_right hlr.le] + let G : ℕ → Set (ℝ × ℝ) := fun p ↦ gr (yy l r t p) l r + have hGline : ∀ p : ℕ, p ≠ t → p ≠ t + 1 → + IsLineWithEnds (qq a b c '' G p) (qq a b c (l, p)) (qq a b c (r, p)) := by + intro p h₁ h₂ + have := isLine_gr (a := a) (b := b) (c := c) (e := l - 1) hlr (hcont p) + (fun x hx ↦ (hgen p h₁ h₂ x hx).ok) (fun x hx _ ↦ hgen p h₁ h₂ x hx) + rwa [hyl, hyr] at this + have hGclear : ∀ p : ℕ, p ≠ t → p ≠ t + 1 → ∀ z ∈ G p, Clear a b c z := by + rintro p h₁ h₂ _ ⟨x, hx, rfl⟩ + exact hgen p h₁ h₂ x hx + have hGend : ∀ p : ℕ, p ≠ t → p ≠ t + 1 → ∀ z, Ok a b c z → (z.1 ≤ l ∨ r ≤ z.1) → + qq a b c z ∈ qq a b c '' G p → qq a b c z = qq a b c (z.1, p) ∧ (z.1 = l ∨ z.1 = r) := by + rintro p h₁ h₂ z hz hside ⟨_, ⟨x, hx, rfl⟩, heq⟩ + have h₃ := eq_of_qq_eq (hgen p h₁ h₂ x hx) hz heq + subst h₃ + rcases hside with h₄ | h₄ + · have h₅ : x = l := le_antisymm h₄ hx.1 + subst h₅ + exact ⟨by simp [hyl], Or.inl rfl⟩ + · have h₅ : x = r := le_antisymm hx.2 h₄ + subst h₅ + exact ⟨by simp [hyr], Or.inr rfl⟩ + have hGG : ∀ p p' : ℕ, p < p' → Disjoint (G p) (G p') := by + intro p p' hpp + rw [Set.disjoint_left] + rintro _ ⟨x, -, rfl⟩ ⟨x', -, h⟩ + obtain ⟨rfl, h₂⟩ := Prod.ext_iff.mp h + have h₃ : yy l r t p x' < yy l r t p' x' := + interp_lt (lam_nonneg _ _ _) (lam_le_one _ _ _) (by exact_mod_cast hpp) (gg_strictMono t hpp) + simp only at h₂ + exact h₃.ne h₂.symm + have hband' : ∀ p : ℕ, p ≠ t → p ≠ t + 1 → Disjoint (Su ∪ Sv) (G p) := by + intro p h₁ h₂ + rw [Set.disjoint_left] + rintro z hz ⟨x, -, rfl⟩ + obtain ⟨h₃, h₄⟩ := hband _ hz + simp only at h₃ h₄ + have hu₀ := lam_nonneg l r x + have hu₁ := lam_le_one l r x + rcases lt_or_gt_of_ne h₁ with h₅ | h₅ + · have := interp_lt (A := p) (A' := t) (B := gg t p) (B' := -5 / 4) hu₀ hu₁ + (by exact_mod_cast h₅) (by have := gg_lt h₅; linarith) + simp only [yy] at * + linarith + · have := interp_lt (A := ((t + 1 : ℕ) : ℝ)) (A' := p) (B := 5 / 4) (B' := gg t p) hu₀ hu₁ + (by exact_mod_cast (show t + 1 < p by omega)) + (by have := gg_gt (show t + 1 < p by omega); linarith) + simp only [yy] at * + linarith + have hGdisj : ∀ (S : Set (ℝ × ℝ)), S ⊆ Su ∪ Sv → ∀ p : ℕ, p ≠ t → p ≠ t + 1 → + Disjoint (qq a b c '' S) (qq a b c '' G p) := fun S hS p h₁ h₂ ↦ + disjoint_of_below (fun z hz ↦ (hok z (hS hz)).1) (hGclear p h₁ h₂) + ((hband' p h₁ h₂).mono_left hS) + have hGzone : ∀ p : ℕ, p ≠ t → p ≠ t + 1 → qq a b c '' G p ⊆ Zone a b c l r := by + rintro p h₁ h₂ _ ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + exact ⟨_, ⟨(hgen p h₁ h₂ x hx).ok, hx.1, hx.2⟩, rfl⟩ + have hSzone : ∀ S : Set (ℝ × ℝ), S ⊆ Su ∪ Sv → qq a b c '' S ⊆ Zone a b c l r := by + rintro S hS _ ⟨z, hz, rfl⟩ + exact ⟨z, hok z (hS hz), rfl⟩ + have hival : (i.castSucc : ℕ) = t := rfl + have hsval : (i.succ : ℕ) = t + 1 := rfl + have hne : i.castSucc ≠ i.succ := fun h ↦ by + have := congrArg Fin.val h + simp only [Fin.val_castSucc, Fin.val_succ] at this + omega + have hnet : ∀ {p : Fin (n + 1)}, p ≠ i.castSucc → (p : ℕ) ≠ t := fun h h' ↦ h (Fin.ext h') + have hnes : ∀ {p : Fin (n + 1)}, p ≠ i.succ → (p : ℕ) ≠ t + 1 := fun h h' ↦ h (Fin.ext h') + let P : Fin (n + 1) → Set (SurfaceModel a b c) := fun p ↦ + if p = i.castSucc then qq a b c '' Su else if p = i.succ then qq a b c '' Sv + else qq a b c '' G p + have hP₁ : P i.castSucc = qq a b c '' Su := ite_eq_left rfl + have hP₂ : P i.succ = qq a b c '' Sv := by + simp [P, hne.symm] + have hP₃ : ∀ {p}, p ≠ i.castSucc → p ≠ i.succ → P p = qq a b c '' G p := fun h₁ h₂ ↦ by + simp only [P] + rw [ite_eq_right h₁, ite_eq_right h₂] + refine ⟨P, fun p ↦ ?_, ?_, fun p ↦ ?_, fun p z hz hzl hm ↦ ?_, fun p z hz hzr hm ↦ ?_⟩ + · by_cases h₁ : p = i.castSucc + · subst h₁ + rw [hP₁, Equiv.swap_apply_left] + exact hu + by_cases h₂ : p = i.succ + · subst h₂ + rw [hP₂, Equiv.swap_apply_right] + exact hv + · rw [hP₃ h₁ h₂, Equiv.swap_apply_of_ne_of_ne h₁ h₂] + exact hGline p (hnet h₁) (hnes h₂) + · have key : ∀ p p' : Fin (n + 1), (p : ℕ) < p' → Disjoint (P p) (P p') := by + intro p p' hpp + by_cases h₁ : p = i.castSucc + · subst h₁ + by_cases h₂ : p' = i.succ + · subst h₂ + rw [hP₁, hP₂] + exact hd + · have h₃ : p' ≠ i.castSucc := fun h ↦ by subst h; omega + rw [hP₁, hP₃ h₃ h₂] + exact hGdisj _ subset_union_left p' (hnet h₃) (hnes h₂) + by_cases h₂ : p = i.succ + · subst h₂ + have h₃ : p' ≠ i.castSucc := fun h ↦ by + subst h + simp only [Fin.val_castSucc, Fin.val_succ] at hpp + omega + have h₄ : p' ≠ i.succ := fun h ↦ by subst h; omega + rw [hP₂, hP₃ h₃ h₄] + exact hGdisj _ subset_union_right p' (hnet h₃) (hnes h₄) + rw [hP₃ h₁ h₂] + by_cases h₃ : p' = i.castSucc + · subst h₃ + rw [hP₁] + exact (hGdisj _ subset_union_left p (hnet h₁) (hnes h₂)).symm + by_cases h₄ : p' = i.succ + · subst h₄ + rw [hP₂] + exact (hGdisj _ subset_union_right p (hnet h₁) (hnes h₂)).symm + rw [hP₃ h₃ h₄] + exact disjoint_of_below (fun z hz ↦ (hGclear p (hnet h₁) (hnes h₂) z hz).ok) + (hGclear p' (hnet h₃) (hnes h₄)) (hGG _ _ hpp) + intro p p' hne' + rcases lt_or_gt_of_ne (fun h ↦ hne' (Fin.ext h) : (p : ℕ) ≠ p') with h | h + · exact key p p' h + · exact (key p' p h).symm + · by_cases h₁ : p = i.castSucc + · subst h₁ + rw [hP₁] + exact hSzone _ subset_union_left + by_cases h₂ : p = i.succ + · subst h₂ + rw [hP₂] + exact hSzone _ subset_union_right + · rw [hP₃ h₁ h₂] + exact hGzone p (hnet h₁) (hnes h₂) + · by_cases h₁ : p = i.castSucc + · subst h₁ + rw [hP₁] at hm + exact hul z hz hzl hm + by_cases h₂ : p = i.succ + · subst h₂ + rw [hP₂] at hm + exact hvl z hz hzl hm + · rw [hP₃ h₁ h₂] at hm + obtain ⟨h₃, h₄⟩ := hGend p (hnet h₁) (hnes h₂) z hz (Or.inl hzl) hm + rcases h₄ with h₄ | h₄ + · rwa [h₄] at h₃ + · exfalso + linarith + · by_cases h₁ : p = i.castSucc + · subst h₁ + rw [hP₁] at hm + rw [Equiv.swap_apply_left] + exact hur z hz hzr hm + by_cases h₂ : p = i.succ + · subst h₂ + rw [hP₂] at hm + rw [Equiv.swap_apply_right] + exact hvr z hz hzr hm + · rw [hP₃ h₁ h₂] at hm + rw [Equiv.swap_apply_of_ne_of_ne h₁ h₂] + obtain ⟨h₃, h₄⟩ := hGend p (hnet h₁) (hnes h₂) z hz (Or.inr hzr) hm + rcases h₄ with h₄ | h₄ + · exfalso + linarith + · rwa [h₄] at h₃ + +end GraphMinor.GM20.Draw diff --git a/LeanPool/GraphMinor/GM20/Draw4.lean b/LeanPool/GraphMinor/GM20/Draw4.lean new file mode 100644 index 0000000000..a6b323f48b --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Draw4.lean @@ -0,0 +1,431 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Draw3 + +/-! +# Drawing a graph in a surface of large genus: a swap with a handle + +The `k`th handle pastes the circles around `(6k, 0)` and `(6k + 3, 0)`. The top point of the first +circle is +pasted to the bottom point of the second. One curve passes below the first circle, up through the +gap +between the circles, and above the second circle. The other curve comes in above, goes into the top +point of the first circle, and leaves from the bottom point of the second circle. So the two curves +swap heights and do not meet. +-/ + +@[expose] public section + +namespace GraphMinor.GM20.Draw + +open Set Topology GraphMinor.Surface + +variable {a b c : ℕ} + +theorem ok_of_abs {x y : ℝ} (h : 1 ≤ |y|) : Ok a b c (x, y) := by + intro i _ + have h₁ : 1 ≤ y ^ 2 := by + rw [← sq_abs] + nlinarith + have h₂ := sq_nonneg (x - 3 * i) + simp only + linarith + +/-- If a point is outside the open discs but not outside the closed discs, it is on a circle. -/ +theorem exists_circle {z : ℝ × ℝ} (h : Ok a b c z) (hc : ¬ Clear a b c z) : + ∃ j < 2 * a + b + c, (z.1 - 3 * j) ^ 2 + z.2 ^ 2 = 1 := by + unfold Clear at hc + simp only [not_forall, not_lt] at hc + obtain ⟨j, hj, h₁⟩ := hc + exact ⟨j, hj, le_antisymm h₁ (h j hj)⟩ + +theorem bound_of_circle {z : ℝ × ℝ} {j : ℕ} (hz : (z.1 - 3 * j) ^ 2 + z.2 ^ 2 = 1) : + 3 * (j : ℝ) - 1 ≤ z.1 ∧ z.1 ≤ 3 * j + 1 := by + have h₁ := sq_nonneg z.2 + constructor <;> nlinarith + +theorem grp_of_lt {j : ℕ} (h : j < 2 * a) : grp a j = j / 2 := ite_eq_left h + +theorem grp_of_ge {j : ℕ} (h : 2 * a ≤ j) : grp a j = j := ite_eq_right (by omega) + +/-- A point of the model on a handle circle has preimages only near that handle. -/ +theorem handle_side {k I : ℕ} (hk : k < a) (hI : I = 2 * k ∨ I = 2 * k + 1) {w z : ℝ × ℝ} + (hw : (w.1 - 3 * I) ^ 2 + w.2 ^ 2 = 1) (hwok : Ok a b c w) (hz : Ok a b c z) + (heq : qq a b c z = qq a b c w) : + 6 * (k : ℝ) - 1 ≤ z.1 ∧ z.1 ≤ 6 * k + 4 := by + have hIc : (I : ℝ) = 2 * k ∨ (I : ℝ) = 2 * k + 1 := by + rcases hI with rfl | rfl + · left; push_cast; ring + · right; push_cast; ring + have hIlt : I < 2 * a + b + c := by omega + by_cases hc : Clear a b c z + · have h₁ := eq_of_qq_eq hc hwok heq + subst h₁ + obtain ⟨h₂, h₃⟩ := bound_of_circle hw + rcases hIc with h₄ | h₄ <;> rw [h₄] at h₂ h₃ <;> constructor <;> linarith + · obtain ⟨j, hj, hzj⟩ := exists_circle hz hc + have h₁ := congrArg keyM heq + rw [keyM_circle hj hz hzj, keyM_circle hIlt hwok hw] at h₁ + have h₂ : grp a j = grp a I := by + have := Sum.inl.inj (Option.some.inj h₁) + exact (Prod.ext_iff.mp this).1 + rw [grp_of_lt (show I < 2 * a by omega)] at h₂ + have hI2 : I / 2 = k := by omega + rw [hI2] at h₂ + have hj' : j < 2 * a := by + by_contra hge + rw [grp_of_ge (by omega)] at h₂ + omega + rw [grp_of_lt hj'] at h₂ + have hjc : (j : ℝ) = 2 * k ∨ (j : ℝ) = 2 * k + 1 := by + have : j = 2 * k ∨ j = 2 * k + 1 := by omega + rcases this with rfl | rfl + · left; push_cast; ring + · right; push_cast; ring + obtain ⟨h₃, h₄⟩ := bound_of_circle hzj + rcases hjc with h₅ | h₅ <;> rw [h₅] at h₃ h₄ <;> constructor <;> linarith + +/-- The top point of the first circle of a handle has the same image as the bottom point of the +second. -/ +theorem qq_handle {k : ℕ} (hk : k < a) : + qq a b c (6 * (k : ℝ), 1) = qq a b c (6 * (k : ℝ) + 3, -1) := by + have h₁ : Ok a b c (6 * (k : ℝ), 1) := ok_of_abs (by simp) + have h₂ : Ok a b c (6 * (k : ℝ) + 3, -1) := ok_of_abs (by simp) + rw [qq_of_ok h₁, qq_of_ok h₂] + refine Quot.sound (ModelGlue.handle k hk !₂[0, 1] ?_ _ _ ?_ ?_) + · have : ‖(!₂[0, 1] : EuclideanPlane)‖ ^ 2 = 1 := by + rw [norm_sq] + simp + exact (pow_eq_one_iff_of_nonneg (norm_nonneg _) two_ne_zero).mp this + · refine congrArg (fun x : EuclideanPlane ↦ (x : OnePoint EuclideanPlane)) ?_ + ext j + fin_cases j + · simp [pl, modelCentre] + ring + · simp [pl, modelCentre] + · refine congrArg (fun x : EuclideanPlane ↦ (x : OnePoint EuclideanPlane)) ?_ + ext j + fin_cases j + · simp [pl, modelCentre, modelMirror] + ring + · simp [pl, modelCentre, modelMirror] + +/-- The slope of the strand as it goes up across the gap of the handle. -/ +noncomputable def mu (k : ℕ) (x : ℝ) : ℝ := max 0 (min 1 (x - (6 * k + 1))) + +theorem continuous_mu (k : ℕ) : Continuous (mu k) := by + unfold mu + fun_prop + +theorem mu_nonneg (k : ℕ) (x : ℝ) : 0 ≤ mu k x := le_max_left _ _ + +theorem mu_le_one (k : ℕ) (x : ℝ) : mu k x ≤ 1 := max_le zero_le_one (min_le_left _ _) + +theorem mu_zero {k : ℕ} {x : ℝ} (h : x ≤ 6 * k + 1) : mu k x = 0 := by + unfold mu + exact max_eq_left ((min_le_right _ _).trans (by linarith)) + +theorem mu_one {k : ℕ} {x : ℝ} (h : 6 * (k : ℝ) + 2 ≤ x) : mu k x = 1 := by + unfold mu + rw [min_eq_left (by linarith)] + exact max_eq_right zero_le_one + +theorem band_interp {v t A' y : ℝ} (h₀ : 0 ≤ v) (h₁ : v ≤ 1) (hA₁ : t ≤ A') (hA₂ : A' ≤ t + 1) + (hy₁ : -5 / 4 ≤ y) (hy₂ : y ≤ 5 / 4) : + (1 - v) * t + v * (-5 / 4) ≤ (1 - v) * A' + v * y ∧ + (1 - v) * A' + v * y ≤ (1 - v) * (t + 1) + v * (5 / 4) := by + have h₂ := mul_le_mul_of_nonneg_left hA₁ (sub_nonneg.mpr h₁) + have h₃ := mul_le_mul_of_nonneg_left hA₂ (sub_nonneg.mpr h₁) + have h₄ := mul_le_mul_of_nonneg_left hy₁ h₀ + have h₅ := mul_le_mul_of_nonneg_left hy₂ h₀ + constructor <;> linarith + +theorem mix_bounds {m s t : ℝ} (h₀ : 0 ≤ m) (h₁ : m ≤ 1) (h : s ≤ t) : + s ≤ (1 - m) * s + m * t ∧ (1 - m) * s + m * t ≤ t := by + constructor <;> nlinarith + +private theorem handle_bands_disjoint {l r t : ℝ} {k : ℕ} : + let u : ℝ → ℝ := lam l r + let Q : ℝ → ℝ := fun x ↦ (1 - u x) * ((1 - mu k x) * t + mu k x * (t + 1)) + + u x * ((1 - mu k x) * (-5 / 4) + mu k x * (5 / 4)) + let A : ℝ → ℝ := fun x ↦ (1 - u x) * (t + 1) + u x * (1 + (6 * k - x) / 6) + let B : ℝ → ℝ := fun x ↦ (1 - u x) * t + u x * (-1 - (x - 6 * k - 3) / 6) + (∀ x ∈ Icc l r, Clear a b c (x, Q x)) → + (∀ x ∈ Icc l (6 * (k : ℝ)), Ok a b c (x, A x)) → + (∀ x ∈ Icc (6 * (k : ℝ) + 3) r, Ok a b c (x, B x)) → + Disjoint (qq a b c '' gr Q l r) + (qq a b c '' (gr A l (6 * (k : ℝ)) ∪ gr B (6 * (k : ℝ) + 3) r)) := by + intro u Q A B hQclear hAok hBok + have hu₀ : ∀ x, 0 ≤ u x := lam_nonneg l r + have hu₁ : ∀ x, u x ≤ 1 := lam_le_one l r + refine Disjoint.symm (disjoint_of_below ?_ ?_ ?_) + · rintro z (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩) + · exact hAok x hx + · exact hBok x hx + · rintro _ ⟨x, hx, rfl⟩ + exact hQclear x hx + · rw [Set.disjoint_left] + rintro z (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩) ⟨x', hx', h⟩ + · obtain ⟨rfl, h₂⟩ := Prod.ext_iff.mp h + simp only at h₂ + have hm : mu k x' = 0 := mu_zero (by linarith [hx.2]) + have h₃ : Q x' < A x' := by + have h₄ := interp_lt (A := t) (A' := t + 1) (B := -5 / 4) + (B' := 1 + (6 * k - x') / 6) (hu₀ x') (hu₁ x') (by linarith) + (by linarith [hx.2]) + have h₅ : Q x' = (1 - u x') * t + u x' * (-5 / 4) := by + change (1 - u x') * ((1 - mu k x') * t + mu k x' * (t + 1)) + + u x' * ((1 - mu k x') * (-5 / 4) + mu k x' * (5 / 4)) = _ + rw [hm] + ring + rw [h₅] + exact h₄ + exact h₃.ne h₂ + · obtain ⟨rfl, h₂⟩ := Prod.ext_iff.mp h + simp only at h₂ + have hm : mu k x' = 1 := mu_one (by linarith [hx.1]) + have hb₁ : (-1 - (x' - 6 * k - 3) / 6 : ℝ) ≤ -1 := by linarith [hx.1] + have h₃ : B x' < Q x' := by + have h₄ := interp_lt (A := t) (A' := t + 1) (B := -1 - (x' - 6 * k - 3) / 6) + (B' := 5 / 4) (hu₀ x') (hu₁ x') (by linarith) (by linarith) + have h₅ : Q x' = (1 - u x') * (t + 1) + u x' * (5 / 4) := by + change (1 - u x') * ((1 - mu k x') * t + mu k x' * (t + 1)) + + u x' * ((1 - mu k x') * (-5 / 4) + mu k x' * (5 / 4)) = _ + rw [hm] + ring + rw [h₅] + exact h₄ + exact h₃.ne' h₂ + +private theorem handle_bands_intersection {l r : ℝ} {k : ℕ} (hk : k < a) {A B : ℝ → ℝ} + (hA6 : A (6 * (k : ℝ)) = 1) (hB6 : B (6 * (k : ℝ) + 3) = -1) + (hAok : ∀ x ∈ Icc l (6 * (k : ℝ)), Ok a b c (x, A x)) + (hBclear : ∀ x ∈ Icc (6 * (k : ℝ) + 3) r, x ≠ 6 * (k : ℝ) + 3 → Clear a b c (x, B x)) + (hLin : qq a b c (6 * (k : ℝ), 1) ∈ qq a b c '' gr A l (6 * (k : ℝ))) + (hRin : qq a b c (6 * (k : ℝ), 1) ∈ qq a b c '' gr B (6 * (k : ℝ) + 3) r) : + (qq a b c '' gr A l (6 * (k : ℝ))) ∩ (qq a b c '' gr B (6 * (k : ℝ) + 3) r) = + {qq a b c (6 * (k : ℝ), 1)} := by + ext w + constructor + · rintro ⟨⟨_, ⟨x, hx, rfl⟩, rfl⟩, ⟨_, ⟨x', hx', rfl⟩, heq⟩⟩ + by_cases h₁ : x = 6 * (k : ℝ) + · subst h₁ + simp [hA6] + by_cases h₂ : x' = 6 * (k : ℝ) + 3 + · subst h₂ + have heq' : qq a b c (6 * (k : ℝ) + 3, B (6 * (k : ℝ) + 3)) = qq a b c (x, A x) := heq + rw [hB6] at heq' + change qq a b c (x, A x) = qq a b c (6 * (k : ℝ), 1) + rw [← heq', ← qq_handle hk] + · have := eq_of_qq_eq (hBclear x' hx' h₂) (hAok x hx) heq + have h₃ := congrArg Prod.fst this + simp only at h₃ + linarith [hx.2, hx'.1] + · rintro rfl + exact ⟨hLin, hRin⟩ + +/-- The swap of heights `i` and `i + 1` with the `k`th handle. -/ +theorem slab_handle [T2Space (SurfaceModel a b c)] {n k : ℕ} (hk : k < a) (i : Fin n) : + Slab a b c (n + 1) (6 * k - 3 / 2) (6 * k + 9 / 2) + (Equiv.swap i.castSucc i.succ) := by + classical + set l : ℝ := 6 * k - 3 / 2 with hl + set r : ℝ := 6 * k + 9 / 2 with hr + set t : ℝ := ((i : ℕ) : ℝ) with ht + have hlr : l < r := by rw [hl, hr]; linarith + have hcl := continuous_lam l r + have hcm := continuous_mu k + let u : ℝ → ℝ := lam l r + have hu₀ : ∀ x, 0 ≤ u x := lam_nonneg l r + have hu₁ : ∀ x, u x ≤ 1 := lam_le_one l r + have hum : ∀ {x}, 6 * (k : ℝ) - 5 / 4 ≤ x → x ≤ 6 * k + 17 / 4 → u x = 1 := fun h₁ h₂ ↦ + lam_eq_one (by rw [hl]; linarith) (by rw [hr]; linarith) + have hgap : ∀ x ∈ Icc l r, lam l r x < 1 → ∀ y, Clear a b c (x, y) := by + intro x hx hlt y + rw [hl, hr] at hx + rcases lam_lt_one hlt with h | h + · refine clear_of_gap (2 * (k : ℤ) - 1) ?_ ?_ <;> push_cast <;> rw [hl] at h <;> linarith [hx.1] + · refine clear_of_gap (2 * (k : ℤ) + 1) ?_ ?_ <;> push_cast <;> rw [hr] at h <;> linarith [hx.2] + let Q : ℝ → ℝ := fun x ↦ (1 - u x) * ((1 - mu k x) * t + mu k x * (t + 1)) + + u x * ((1 - mu k x) * (-5 / 4) + mu k x * (5 / 4)) + let A : ℝ → ℝ := fun x ↦ (1 - u x) * (t + 1) + u x * (1 + (6 * k - x) / 6) + let B : ℝ → ℝ := fun x ↦ (1 - u x) * t + u x * (-1 - (x - 6 * k - 3) / 6) + have hu_l : u l = 0 := lam_left hlr.le + have hu_r : u r = 0 := lam_right hlr.le + have hQl : Q l = t := by + have : mu k l = 0 := mu_zero (by rw [hl]; linarith) + simp [Q, hu_l, this] + have hQr : Q r = t + 1 := by + have : mu k r = 1 := mu_one (by rw [hr]; linarith) + simp [Q, hu_r, this] + have hAl : A l = t + 1 := by simp [A, hu_l] + have hBr : B r = t := by simp [B, hu_r] + have hA6 : A (6 * (k : ℝ)) = 1 := by + have : u (6 * (k : ℝ)) = 1 := hum (by linarith) (by linarith) + simp [A, this] + have hB6 : B (6 * (k : ℝ) + 3) = -1 := by + have : u (6 * (k : ℝ) + 3) = 1 := hum (by linarith) (by linarith) + simp [B, this] + have hQc : ContinuousOn Q (Icc l r) := Continuous.continuousOn (by simp only [Q, u]; fun_prop) + have hAc : ContinuousOn A (Icc l (6 * (k : ℝ))) := + Continuous.continuousOn (by simp only [A, u]; fun_prop) + have hBc : ContinuousOn B (Icc (6 * (k : ℝ) + 3) r) := + Continuous.continuousOn (by simp only [B, u]; fun_prop) + have hQclear : ∀ x ∈ Icc l r, Clear a b c (x, Q x) := by + intro x hx + rcases (hu₁ x).lt_or_eq with h | h + · exact hgap x hx h _ + · simp only [Q, h] + by_cases h₁ : x ≤ 6 * k + 1 + · rw [mu_zero h₁] + exact clear_of_abs (by norm_num) + by_cases h₂ : 6 * (k : ℝ) + 2 ≤ x + · rw [mu_one h₂] + exact clear_of_abs (by norm_num) + · refine clear_of_gap (2 * (k : ℤ)) ?_ ?_ <;> push_cast <;> linarith + have hAclear : ∀ x ∈ Icc l (6 * (k : ℝ)), x ≠ 6 * (k : ℝ) → Clear a b c (x, A x) := by + intro x hx hne + have hx' : x ∈ Icc l r := ⟨hx.1, hx.2.trans (by rw [hr]; linarith)⟩ + rcases (hu₁ x).lt_or_eq with h | h + · exact hgap x hx' h _ + · simp only [A, h] + refine clear_of_abs ?_ + have : x < 6 * k := lt_of_le_of_ne hx.2 hne + rw [abs_of_pos] <;> linarith + have hBclear : ∀ x ∈ Icc (6 * (k : ℝ) + 3) r, x ≠ 6 * (k : ℝ) + 3 → Clear a b c (x, B x) := by + intro x hx hne + have hx' : x ∈ Icc l r := ⟨by rw [hl]; linarith [hx.1], hx.2⟩ + rcases (hu₁ x).lt_or_eq with h | h + · exact hgap x hx' h _ + · simp only [B, h] + refine clear_of_abs ?_ + have : 6 * (k : ℝ) + 3 < x := lt_of_le_of_ne hx.1 (Ne.symm hne) + rw [abs_of_neg] <;> linarith + have hAok : ∀ x ∈ Icc l (6 * (k : ℝ)), Ok a b c (x, A x) := fun x hx ↦ by + by_cases h : x = 6 * (k : ℝ) + · subst h + rw [hA6] + exact ok_of_abs (by simp) + · exact (hAclear x hx h).ok + have hBok : ∀ x ∈ Icc (6 * (k : ℝ) + 3) r, Ok a b c (x, B x) := fun x hx ↦ by + by_cases h : x = 6 * (k : ℝ) + 3 + · subst h + rw [hB6] + exact ok_of_abs (by simp) + · exact (hBclear x hx h).ok + have hlin₁ := isLine_gr (e := l - 1) hlr hQc (fun x hx ↦ (hQclear x hx).ok) + (fun x hx _ ↦ hQclear x hx) + have hlin₂ := isLine_gr (e := 6 * (k : ℝ)) (show l < 6 * (k : ℝ) by rw [hl]; linarith) hAc hAok + hAclear + have hlin₃ := isLine_gr (e := 6 * (k : ℝ) + 3) (show 6 * (k : ℝ) + 3 < r by rw [hr]; linarith) + hBc hBok hBclear + rw [hQl, hQr] at hlin₁ + rw [hAl, hA6] at hlin₂ + rw [hB6, hBr, ← qq_handle (b := b) (c := c) hk] at hlin₃ + have hport₁ : ((6 * (k : ℝ), 1).1 - 3 * ((2 * k : ℕ) : ℝ)) ^ 2 + (6 * (k : ℝ), (1 : ℝ)).2 ^ 2 = 1 + := by + simp only; push_cast; ring + have hport₂ : ((6 * (k : ℝ) + 3, -1).1 - 3 * ((2 * k + 1 : ℕ) : ℝ)) ^ 2 + + (6 * (k : ℝ) + 3, (-1 : ℝ)).2 ^ 2 = 1 := by + simp only; push_cast; ring + have hok₁ : Ok a b c (6 * (k : ℝ), 1) := ok_of_abs (by simp) + have hok₂ : Ok a b c (6 * (k : ℝ) + 3, -1) := ok_of_abs (by simp) + have hinter := handle_bands_intersection hk hA6 hB6 hAok hBclear + (mem_of_line hlin₂).2 (mem_of_line hlin₃).1 + have hSv := GM11.IsLineWithEnds.union (GM11.IsLineWithEnds.symm hlin₂) hlin₃ hinter + rw [← image_union] at hSv + have hcast : (((i : ℕ) + 1 : ℕ) : ℝ) = t + 1 := by rw [ht]; push_cast; ring + refine slab_of_band i hlr hgap (Su := gr Q l r) (Sv := gr A l (6 * (k : ℝ)) ∪ gr B (6 * + (k : ℝ) + 3) r) + (by rw [hcast]; exact hlin₁) (by rw [hcast]; exact hSv) ?_ ?_ ?_ ?_ ?_ ?_ ?_ + · rintro z (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩) + · exact ⟨(hQclear x hx).ok, hx.1, hx.2⟩ + · exact ⟨hAok x hx, hx.1, hx.2.trans (by rw [hr]; linarith)⟩ + · exact ⟨hBok x hx, by rw [hl]; linarith [hx.1], hx.2⟩ + · rw [hcast] + rintro z (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩) <;> simp only + · obtain ⟨h₂, h₃⟩ := mix_bounds (mu_nonneg k x) (mu_le_one k x) (show t ≤ t + 1 by linarith) + obtain ⟨h₄, h₅⟩ := mix_bounds (mu_nonneg k x) (mu_le_one k x) + (show (-5 / 4 : ℝ) ≤ 5 / 4 by norm_num) + exact band_interp (hu₀ x) (hu₁ x) h₂ h₃ h₄ h₅ + · have h₂ : (-5 / 4 : ℝ) ≤ 1 + (6 * k - x) / 6 := by linarith [hx.2] + have h₃ : 1 + (6 * (k : ℝ) - x) / 6 ≤ 5 / 4 := by rw [hl] at hx; linarith [hx.1] + exact band_interp (hu₀ x) (hu₁ x) (by linarith) le_rfl h₂ h₃ + · have h₂ : -1 - (x - 6 * k - 3) / 6 ≤ (5 / 4 : ℝ) := by linarith [hx.1] + have h₃ : (-5 / 4 : ℝ) ≤ -1 - (x - 6 * k - 3) / 6 := by rw [hr] at hx; linarith [hx.2] + exact band_interp (hu₀ x) (hu₁ x) le_rfl (by linarith) h₃ h₂ + · exact handle_bands_disjoint hQclear hAok hBok + · rintro z hz hzl ⟨_, ⟨x, hx, rfl⟩, heq⟩ + have h₁ := eq_of_qq_eq (hQclear x hx) hz heq + subst h₁ + have h₂ : x = l := le_antisymm hzl hx.1 + subst h₂ + rw [hQl] + · rintro z hz hzr ⟨_, ⟨x, hx, rfl⟩, heq⟩ + have h₁ := eq_of_qq_eq (hQclear x hx) hz heq + subst h₁ + have h₂ : x = r := le_antisymm hx.2 hzr + subst h₂ + rw [hQr, hcast] + · rintro z hz hzl ⟨_, (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩), heq⟩ + · by_cases h₁ : x = 6 * (k : ℝ) + · subst h₁ + replace heq : qq a b c (6 * (k : ℝ), A (6 * (k : ℝ))) = qq a b c z := heq + rw [hA6] at heq + have := (handle_side hk (Or.inl rfl) hport₁ hok₁ hz heq.symm).1 + rw [hl] at hzl + linarith + · have h₃ := eq_of_qq_eq (hAclear x hx h₁) hz heq + subst h₃ + have h₂ : x = l := le_antisymm hzl hx.1 + subst h₂ + rw [hAl, hcast] + · by_cases h₁ : x = 6 * (k : ℝ) + 3 + · subst h₁ + replace heq : qq a b c (6 * (k : ℝ) + 3, B (6 * (k : ℝ) + 3)) = qq a b c z := heq + rw [hB6] at heq + have := (handle_side hk (Or.inr rfl) hport₂ hok₂ hz heq.symm).1 + rw [hl] at hzl + linarith + · have h₃ := eq_of_qq_eq (hBclear x hx h₁) hz heq + subst h₃ + rw [hl] at hzl + have := hx.1 + simp only at hzl + linarith + · rintro z hz hzr ⟨_, (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩), heq⟩ + · by_cases h₁ : x = 6 * (k : ℝ) + · subst h₁ + replace heq : qq a b c (6 * (k : ℝ), A (6 * (k : ℝ))) = qq a b c z := heq + rw [hA6] at heq + have := (handle_side hk (Or.inl rfl) hport₁ hok₁ hz heq.symm).2 + rw [hr] at hzr + linarith + · have h₃ := eq_of_qq_eq (hAclear x hx h₁) hz heq + subst h₃ + rw [hr] at hzr + have := hx.2 + simp only at hzr + linarith + · by_cases h₁ : x = 6 * (k : ℝ) + 3 + · subst h₁ + replace heq : qq a b c (6 * (k : ℝ) + 3, B (6 * (k : ℝ) + 3)) = qq a b c z := heq + rw [hB6] at heq + have := (handle_side hk (Or.inr rfl) hport₂ hok₂ hz heq.symm).2 + rw [hr] at hzr + linarith + · have h₃ := eq_of_qq_eq (hBclear x hx h₁) hz heq + subst h₃ + have h₂ : x = r := le_antisymm hx.2 hzr + subst h₂ + rw [hBr] + +end GraphMinor.GM20.Draw diff --git a/LeanPool/GraphMinor/GM20/Draw5.lean b/LeanPool/GraphMinor/GM20/Draw5.lean new file mode 100644 index 0000000000..6f63b70f68 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Draw5.lean @@ -0,0 +1,587 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Draw4 + +/-! +# Drawing a graph in a surface of large genus: a swap with a cross-cap + +Two curves that cross at the centre of a cross-cap do not meet in the surface: each one goes into +the +circle at a point and comes back at the antipodal point. So two straight lines through the centre, +of +slopes `4/3` and `-4/3`, swap two heights. +-/ + +@[expose] public section + +namespace GraphMinor.GM20.Draw + +open Set Topology GraphMinor.Surface + +variable {a b c : ℕ} + +/-- A curve in two parts, whose inner ends have the same image. -/ +theorem two_part [T2Space (SurfaceModel a b c)] {f₁ f₂ : ℝ → ℝ} {l e₁ e₂ r : ℝ} (hl : l < e₁) + (h₁₂ : e₁ < e₂) (hr : e₂ < r) (hc₁ : ContinuousOn f₁ (Icc l e₁)) + (hc₂ : ContinuousOn f₂ (Icc e₂ r)) (ok₁ : ∀ x ∈ Icc l e₁, Ok a b c (x, f₁ x)) + (ok₂ : ∀ x ∈ Icc e₂ r, Ok a b c (x, f₂ x)) + (cl₁ : ∀ x ∈ Icc l e₁, x ≠ e₁ → Clear a b c (x, f₁ x)) + (cl₂ : ∀ x ∈ Icc e₂ r, x ≠ e₂ → Clear a b c (x, f₂ x)) + (hj : qq a b c (e₁, f₁ e₁) = qq a b c (e₂, f₂ e₂)) + (hs : ∀ z, Ok a b c z → qq a b c z = qq a b c (e₁, f₁ e₁) → l < z.1 ∧ z.1 < r) : + IsLineWithEnds (qq a b c '' (gr f₁ l e₁ ∪ gr f₂ e₂ r)) (qq a b c (l, f₁ l)) + (qq a b c (r, f₂ r)) ∧ + (∀ z, Ok a b c z → z.1 ≤ l → qq a b c z ∈ qq a b c '' (gr f₁ l e₁ ∪ gr f₂ e₂ r) → + qq a b c z = qq a b c (l, f₁ l)) ∧ + (∀ z, Ok a b c z → r ≤ z.1 → qq a b c z ∈ qq a b c '' (gr f₁ l e₁ ∪ gr f₂ e₂ r) → + qq a b c z = qq a b c (r, f₂ r)) := by + have hL₁ := isLine_gr hl hc₁ ok₁ cl₁ + have hL₂ := isLine_gr hr hc₂ ok₂ cl₂ + have hinter : (qq a b c '' gr f₁ l e₁) ∩ (qq a b c '' gr f₂ e₂ r) = + {qq a b c (e₁, f₁ e₁)} := by + ext w + constructor + · rintro ⟨⟨_, ⟨x, hx, rfl⟩, rfl⟩, ⟨_, ⟨x', hx', rfl⟩, heq⟩⟩ + replace heq : qq a b c (x', f₂ x') = qq a b c (x, f₁ x) := heq + by_cases h₁ : x = e₁ + · subst h₁ + rfl + by_cases h₂ : x' = e₂ + · subst h₂ + change qq a b c (x, f₁ x) = _ + rw [← heq, hj] + · have h₃ := congrArg Prod.fst (eq_of_qq_eq (cl₂ x' hx' h₂) (ok₁ x hx) heq) + simp only at h₃ + linarith [hx.2, hx'.1] + · rintro rfl + exact ⟨(mem_of_line hL₁).2, hj ▸ (mem_of_line hL₂).1⟩ + have hL₂' : IsLineWithEnds (qq a b c '' gr f₂ e₂ r) (qq a b c (e₁, f₁ e₁)) + (qq a b c (r, f₂ r)) := hj ▸ hL₂ + have hline := GM11.IsLineWithEnds.union (GM11.IsLineWithEnds.symm hL₁) hL₂' hinter + rw [← image_union] at hline + refine ⟨hline, ?_, ?_⟩ + · rintro z hz hzl ⟨_, (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩), heq⟩ + · replace heq : qq a b c (x, f₁ x) = qq a b c z := heq + by_cases h₁ : x = e₁ + · subst h₁ + have := (hs z hz heq.symm).1 + linarith + · have h₃ := eq_of_qq_eq (cl₁ x hx h₁) hz heq + subst h₃ + have h₂ : x = l := le_antisymm hzl hx.1 + subst h₂ + rfl + · replace heq : qq a b c (x, f₂ x) = qq a b c z := heq + by_cases h₁ : x = e₂ + · subst h₁ + have := (hs z hz (heq.symm.trans hj.symm)).1 + linarith + · have h₃ := eq_of_qq_eq (cl₂ x hx h₁) hz heq + subst h₃ + have := hx.1 + simp only at hzl + linarith + · rintro z hz hzr ⟨_, (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩), heq⟩ + · replace heq : qq a b c (x, f₁ x) = qq a b c z := heq + by_cases h₁ : x = e₁ + · subst h₁ + have := (hs z hz heq.symm).2 + linarith + · have h₃ := eq_of_qq_eq (cl₁ x hx h₁) hz heq + subst h₃ + have := hx.2 + simp only at hzr + linarith + · replace heq : qq a b c (x, f₂ x) = qq a b c z := heq + by_cases h₁ : x = e₂ + · subst h₁ + have := (hs z hz (heq.symm.trans hj.symm)).2 + linarith + · have h₃ := eq_of_qq_eq (cl₂ x hx h₁) hz heq + subst h₃ + have h₂ : x = r := le_antisymm hx.2 hzr + subst h₂ + rfl + +/-- A point of the model on a cross-cap circle has preimages only on that circle. -/ +theorem crosscap_side {k : ℕ} (hk : k < b) {w z : ℝ × ℝ} + (hw : (w.1 - 3 * ((2 * a + k : ℕ) : ℝ)) ^ 2 + w.2 ^ 2 = 1) (hwok : Ok a b c w) + (hz : Ok a b c z) (heq : qq a b c z = qq a b c w) : + 3 * ((2 * a + k : ℕ) : ℝ) - 1 ≤ z.1 ∧ z.1 ≤ 3 * ((2 * a + k : ℕ) : ℝ) + 1 := by + have hI : 2 * a + k < 2 * a + b + c := by omega + by_cases hc : Clear a b c z + · have h₁ := eq_of_qq_eq hc hwok heq + subst h₁ + exact bound_of_circle hw + · obtain ⟨j, hj, hzj⟩ := exists_circle hz hc + have h₁ := congrArg keyM heq + rw [keyM_circle hj hz hzj, keyM_circle hI hwok hw] at h₁ + have h₂ : grp a j = grp a (2 * a + k) := by + have := Sum.inl.inj (Option.some.inj h₁) + exact (Prod.ext_iff.mp this).1 + have h₃ : grp a (2 * a + k) = 2 * a + k := grp_of_ge (by omega) + rw [h₃] at h₂ + have hj' : 2 * a ≤ j := by + by_contra hlt + have h₄ : grp a j = j / 2 := grp_of_lt (by omega) + rw [h₄] at h₂ + omega + have h₄ : grp a j = j := grp_of_ge hj' + rw [h₄] at h₂ + subst h₂ + exact bound_of_circle hzj + +/-- A point of the circle around the `k`th centre is outside every open disc. -/ +theorem dist_sq_ge {k i : ℕ} {x y : ℝ} (hu : x ^ 2 + y ^ 2 = 1) : + 1 ≤ (3 * (k : ℝ) + x - 3 * i) ^ 2 + y ^ 2 := by + rcases eq_or_ne k i with rfl | hne + · have : 3 * (k : ℝ) + x - 3 * k = x := by ring + rw [this, hu] + · have h₁ : (1 : ℝ) ≤ ((k : ℝ) - i) ^ 2 := by + have h₂ : (k : ℤ) - i ≠ 0 := sub_ne_zero.mpr (by exact_mod_cast hne) + have h₃ : (1 : ℤ) ≤ ((k : ℤ) - i) ^ 2 := by + have := sq_pos_of_ne_zero h₂ + omega + exact_mod_cast h₃ + have h₂ : x ^ 2 ≤ 1 := by linarith only [hu, sq_nonneg y] + have h₃ : |x| ≤ 1 := by + rw [← sq_le_one_iff_abs_le_one] + exact h₂ + obtain ⟨h₄, h₅⟩ := abs_le.mp h₃ + have h₆ : 3 ≤ |3 * ((k : ℝ) - i)| := by + rw [abs_mul, abs_of_pos (by norm_num : (0 : ℝ) < 3)] + have : 1 ≤ |(k : ℝ) - i| := by + rw [← one_le_sq_iff_one_le_abs] + exact h₁ + linarith + have h₇ : 2 ≤ |3 * (k : ℝ) + x - 3 * i| := by + have : |3 * ((k : ℝ) - i)| ≤ |3 * (k : ℝ) + x - 3 * i| + |x| := by + have h₈ : 3 * ((k : ℝ) - i) = (3 * (k : ℝ) + x - 3 * i) - x := by ring + rw [h₈] + exact abs_sub _ _ + linarith + have hsq : 1 ≤ (3 * (k : ℝ) + x - 3 * i) ^ 2 := + (one_le_sq_iff_one_le_abs _).mpr (le_trans (by norm_num) h₇) + exact hsq.trans (le_add_of_nonneg_right (sq_nonneg y)) + +/-- Antipodal points of a cross-cap circle have the same image. -/ +theorem qq_crosscap {k : ℕ} (hk : k < b) {u₁ u₂ : ℝ} (hu : u₁ ^ 2 + u₂ ^ 2 = 1) : + qq a b c (3 * ((2 * a + k : ℕ) : ℝ) + u₁, u₂) = + qq a b c (3 * ((2 * a + k : ℕ) : ℝ) - u₁, -u₂) := by + have h₁ : Ok a b c (3 * ((2 * a + k : ℕ) : ℝ) + u₁, u₂) := by + intro i hi + have hne := dist_sq_ge (k := 2 * a + k) (i := i) (x := u₁) (y := u₂) hu + exact hne + have h₂ : Ok a b c (3 * ((2 * a + k : ℕ) : ℝ) - u₁, -u₂) := by + intro i hi + have hne := dist_sq_ge (k := 2 * a + k) (i := i) (x := -u₁) (y := -u₂) + (by simpa only [neg_sq] using hu) + simpa [sub_eq_add_neg] using hne + rw [qq_of_ok h₁, qq_of_ok h₂] + refine Quot.sound (ModelGlue.crosscap k hk !₂[u₁, u₂] ?_ _ _ ?_ ?_) + · have : ‖(!₂[u₁, u₂] : EuclideanPlane)‖ ^ 2 = 1 := by + rw [norm_sq] + simpa using hu + exact (pow_eq_one_iff_of_nonneg (norm_nonneg _) two_ne_zero).mp this + · refine congrArg (fun x : EuclideanPlane ↦ (x : OnePoint EuclideanPlane)) ?_ + ext j + fin_cases j <;> simp [pl, modelCentre] + · refine congrArg (fun x : EuclideanPlane ↦ (x : OnePoint EuclideanPlane)) ?_ + ext j + fin_cases j <;> simp [pl, modelCentre, sub_eq_add_neg] + +/-- Saturation at `±5/4`. -/ +noncomputable def sat (v : ℝ) : ℝ := max (-5 / 4) (min (5 / 4) v) + +theorem continuous_sat : Continuous sat := by + unfold sat + fun_prop + +theorem sat_le (v : ℝ) : sat v ≤ 5 / 4 := max_le (by norm_num) (min_le_left _ _) + +theorem le_sat (v : ℝ) : -5 / 4 ≤ sat v := le_max_left _ _ + +/-- A point on the line of slope `4/3` or `-4/3`, outside the circle around `C = 3I`, and at most +`5/4` +to the side of `C`, is clear. -/ +theorem clear_slope {I : ℕ} {x y : ℝ} + (h₁ : 9 / 25 < (x - 3 * I) ^ 2) (h₂ : (x - 3 * I) ^ 2 ≤ 25 / 16) + (h₃ : y ^ 2 = 16 / 9 * (x - 3 * I) ^ 2 ∨ y ^ 2 = 25 / 16) : Clear a b c (x, y) := by + intro i _ + simp only + rcases eq_or_ne i I with rfl | hne + · rcases h₃ with h₃ | h₃ + · linarith only [h₁, h₃] + · linarith only [h₃, sq_nonneg (x - 3 * (i : ℝ))] + · have h₄ : (1 : ℝ) ≤ ((I : ℝ) - i) ^ 2 := by + have h₂' : (I : ℤ) - i ≠ 0 := sub_ne_zero.mpr (by exact_mod_cast hne.symm) + have h₃' : (1 : ℤ) ≤ ((I : ℤ) - i) ^ 2 := by + have := sq_pos_of_ne_zero h₂' + omega + exact_mod_cast h₃' + have h₅ : |x - 3 * I| ≤ 5 / 4 := by + rw [← abs_of_pos (by norm_num : (0 : ℝ) < 5 / 4), ← sq_le_sq] + linarith + obtain ⟨h₆, h₇⟩ := abs_le.mp h₅ + have h₈ : 1 ≤ |(I : ℝ) - i| := by + rw [← one_le_sq_iff_one_le_abs] + exact h₄ + have h₉ := sq_nonneg y + rcases le_abs'.mp h₈ with h₁₀ | h₁₀ + · have hdist : 1 < 3 * (i : ℝ) - x := by linarith only [h₇, h₁₀] + have hsq' : (1 : ℝ) ^ 2 < (3 * (i : ℝ) - x) ^ 2 := + (sq_lt_sq₀ zero_le_one (zero_le_one.trans hdist.le)).mpr hdist + rw [← neg_sub, neg_sq] + linarith only [hsq', h₉] + · have hdist : 1 < x - 3 * i := by linarith only [h₆, h₁₀] + have hsq' : (1 : ℝ) ^ 2 < (x - 3 * i) ^ 2 := + (sq_lt_sq₀ zero_le_one (zero_le_one.trans hdist.le)).mpr hdist + linarith only [hsq', h₉] + +theorem sat_sq (v : ℝ) : sat v ^ 2 = v ^ 2 ∨ sat v ^ 2 = 25 / 16 := by + unfold sat + rcases le_total (5 / 4) v with h | h + · rw [min_eq_left h, max_eq_right (by norm_num)] + right + norm_num + · rw [min_eq_right h] + rcases le_total (-5 / 4) v with h' | h' + · rw [max_eq_right h'] + exact Or.inl rfl + · rw [max_eq_left h'] + right + norm_num + +theorem sat_eq {v : ℝ} (h₁ : -5 / 4 ≤ v) (h₂ : v ≤ 5 / 4) : sat v = v := by + unfold sat + rw [min_eq_right h₂, max_eq_right h₁] + +theorem sat_neg {v : ℝ} (h : v ≤ 0) : sat v ≤ 0 := + max_le (by norm_num) ((min_le_right _ _).trans h) + +theorem sat_lt_zero {v : ℝ} (h : v < 0) : sat v < 0 := + max_lt (by norm_num) ((min_le_right _ _).trans_lt h) + +theorem sat_pos {v : ℝ} (h : 0 < v) : 0 < sat v := + lt_max_of_lt_right (lt_min (by norm_num) h) + +theorem ok_circle {k : ℕ} {x y : ℝ} (hu : x ^ 2 + y ^ 2 = 1) : + Ok a b c (3 * (k : ℝ) + x, y) := fun _ _ ↦ dist_sq_ge hu + +private theorem crosscap_bands_disjoint {k : ℕ} (hk : k < b) {l r t : ℝ} : + let I : ℕ := 2 * a + k + let C : ℝ := 3 * (I : ℝ) + let u : ℝ → ℝ := lam l r + let v : ℝ → ℝ := fun x ↦ sat (4 / 3 * (x - C)) + let F : ℝ → ℝ → ℝ → ℝ := fun P s x ↦ (1 - u x) * P + u x * (s * v x) + (∀ P s, (s = 1 ∨ s = -1) → ∀ x ∈ Icc l r, 9 / 25 < (x - C) ^ 2 → + Clear a b c (x, F P s x)) → + (Icc l (C - 3 / 5) ⊆ Icc l r) → + (Icc (C + 3 / 5) r ⊆ Icc l r) → + (∀ x ∈ Icc l (C - 3 / 5), x ≠ C - 3 / 5 → 9 / 25 < (x - C) ^ 2) → + (∀ x ∈ Icc (C + 3 / 5) r, x ≠ C + 3 / 5 → 9 / 25 < (x - C) ^ 2) → + (∀ P s, F P s (C - 3 / 5) = s * (-4 / 5)) → + (∀ P s, F P s (C + 3 / 5) = s * (4 / 5)) → + (∀ P s, (s = 1 ∨ s = -1) → ∀ x ∈ Icc l (C - 3 / 5), Ok a b c (x, F P s x)) → + (∀ P s, (s = 1 ∨ s = -1) → ∀ x ∈ Icc (C + 3 / 5) r, Ok a b c (x, F P s x)) → + Disjoint (qq a b c '' (gr (F t 1) l (C - 3 / 5) ∪ gr (F (t + 1) 1) (C + 3 / 5) r)) + (qq a b c '' (gr (F (t + 1) (-1)) l (C - 3 / 5) ∪ gr (F t (-1)) (C + 3 / 5) r)) := by + intro I C u v F hclear hIcl hIcr hsql hsqr hFm hFp hOkL hOkR + have hIdef : I = 2 * a + k := rfl + have hIlt : I < 2 * a + b + c := by omega + have hC : C = 3 * (I : ℝ) := rfl + have hu₀ : ∀ x, 0 ≤ u x := lam_nonneg l r + have hu₁ : ∀ x, u x ≤ 1 := lam_le_one l r + have hport : ∀ {u₁ u₂ : ℝ}, u₁ ^ 2 + u₂ ^ 2 = 1 → Ok a b c (C + u₁, u₂) := fun h ↦ ok_circle h + have hglue : ∀ {u₁ u₂ : ℝ}, u₁ ^ 2 + u₂ ^ 2 = 1 → + qq a b c (C + u₁, u₂) = qq a b c (C - u₁, -u₂) := fun h ↦ qq_crosscap hk h + have hsqs : ∀ s : ℝ, (s = 1 ∨ s = -1) → (-3 / 5 : ℝ) ^ 2 + (s * (-4 / 5)) ^ 2 = 1 := by + rintro s (rfl | rfl) <;> norm_num + have ep₁ : ∀ s : ℝ, (C - 3 / 5, s * (-4 / 5)) = (C + (-3 / 5), s * (-4 / 5)) := fun s ↦ + Prod.ext (by simp only; ring) rfl + have ep₂ : ∀ s : ℝ, (C + 3 / 5, s * (4 / 5)) = (C - (-3 / 5), -(s * (-4 / 5))) := fun s ↦ + Prod.ext (by simp only; ring) (by simp only; ring) + have hcu : ∀ P s, (s = 1 ∨ s = -1) → ∀ z ∈ gr (F P s) l (C - 3 / 5), + Clear a b c z ∨ z = (C - 3 / 5, s * (-4 / 5)) := by + rintro P s hs _ ⟨x, hx, rfl⟩ + by_cases h : x = C - 3 / 5 + · subst h + right + simp only [hFm] + · exact Or.inl (hclear P s hs x (hIcl hx) (hsql x hx h)) + have hcv : ∀ P s, (s = 1 ∨ s = -1) → ∀ z ∈ gr (F P s) (C + 3 / 5) r, + Clear a b c z ∨ z = (C + 3 / 5, s * (4 / 5)) := by + rintro P s hs _ ⟨x, hx, rfl⟩ + by_cases h : x = C + 3 / 5 + · subst h + right + simp only [hFp] + · exact Or.inl (hclear P s hs x (hIcr hx) (hsqr x hx h)) + have htw : ∀ z : ℝ × ℝ, tw a b I (pl z - modelCentre I) = (z.1 - 3 * I) * z.2 := by + intro z + simp only [tw] + rw [ite_eq_left (by omega)] + simp [pl, modelCentre] + have hP₁ : Ok a b c (C - 3 / 5, (1 : ℝ) * (-4 / 5)) := by + rw [ep₁] + exact hport (hsqs 1 (Or.inl rfl)) + have hP₃ : Ok a b c (C - 3 / 5, (-1 : ℝ) * (-4 / 5)) := by + rw [ep₁] + exact hport (hsqs (-1) (Or.inr rfl)) + have hkey : qq a b c (C - 3 / 5, (1 : ℝ) * (-4 / 5)) ≠ + qq a b c (C - 3 / 5, (-1 : ℝ) * (-4 / 5)) := by + intro heq + have h₁ := congrArg keyM heq + rw [keyM_circle hIlt hP₁ (by simp only [hC]; ring), keyM_circle hIlt hP₃ + (by simp only [hC]; ring), htw, htw] at h₁ + have h₂ := (Prod.ext_iff.mp (Sum.inl.inj (Option.some.inj h₁))).2 + simp only [hC] at h₂ + have h₃ : ((3 * (I : ℝ) - 3 / 5 - 3 * I) * (1 * (-4 / 5)) : ℝ) = 12 / 25 := by ring + have h₄ : ((3 * (I : ℝ) - 3 / 5 - 3 * I) * (-1 * (-4 / 5)) : ℝ) = -12 / 25 := by ring + rw [h₃, h₄] at h₂ + norm_num at h₂ + have hg₁ : qq a b c (C + 3 / 5, (1 : ℝ) * (4 / 5)) = + qq a b c (C - 3 / 5, (1 : ℝ) * (-4 / 5)) := by + rw [ep₁ 1, ep₂ 1] + exact (hglue (hsqs 1 (Or.inl rfl))).symm + have hg₂ : qq a b c (C + 3 / 5, (-1 : ℝ) * (4 / 5)) = + qq a b c (C - 3 / 5, (-1 : ℝ) * (-4 / 5)) := by + rw [ep₁ (-1), ep₂ (-1)] + exact (hglue (hsqs (-1) (Or.inr rfl))).symm + have hclass₁ : ∀ z ∈ gr (F t 1) l (C - 3 / 5) ∪ gr (F (t + 1) 1) (C + 3 / 5) r, + Clear a b c z ∨ qq a b c z = qq a b c (C - 3 / 5, (1 : ℝ) * (-4 / 5)) := by + rintro z (hz | hz) + · rcases hcu _ _ (Or.inl rfl) z hz with h | rfl + · exact Or.inl h + · exact Or.inr rfl + · rcases hcv _ _ (Or.inl rfl) z hz with h | rfl + · exact Or.inl h + · exact Or.inr hg₁ + have hclass₂ : ∀ z ∈ gr (F (t + 1) (-1)) l (C - 3 / 5) ∪ gr (F t (-1)) (C + 3 / 5) r, + Clear a b c z ∨ qq a b c z = qq a b c (C - 3 / 5, (-1 : ℝ) * (-4 / 5)) := by + rintro z (hz | hz) + · rcases hcu _ _ (Or.inr rfl) z hz with h | rfl + · exact Or.inl h + · exact Or.inr rfl + · rcases hcv _ _ (Or.inr rfl) z hz with h | rfl + · exact Or.inl h + · exact Or.inr hg₂ + have hvneg : ∀ x, x ≤ C - 3 / 5 → v x < 0 := fun x hx ↦ + sat_lt_zero (by linarith) + have hvpos : ∀ x, C + 3 / 5 ≤ x → 0 < v x := fun x hx ↦ sat_pos (by linarith) + have hsep : ∀ z ∈ gr (F t 1) l (C - 3 / 5) ∪ gr (F (t + 1) 1) (C + 3 / 5) r, + ∀ z' ∈ gr (F (t + 1) (-1)) l (C - 3 / 5) ∪ gr (F t (-1)) (C + 3 / 5) r, z ≠ z' := by + rintro _ (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩) _ (⟨x', hx', rfl⟩ | ⟨x', hx', rfl⟩) h + · obtain ⟨rfl, h₂⟩ := Prod.ext_iff.mp h + simp only at h₂ + have h₃ := hvneg x hx.2 + have := interp_lt (A := t) (A' := t + 1) (B := 1 * v x) (B' := -1 * v x) (hu₀ x) + (hu₁ x) (by linarith) (by linarith) + exact this.ne h₂ + · have := congrArg Prod.fst h + simp only at this + linarith [hx.2, hx'.1] + · have := congrArg Prod.fst h + simp only at this + linarith [hx.1, hx'.2] + · obtain ⟨rfl, h₂⟩ := Prod.ext_iff.mp h + simp only at h₂ + have h₃ := hvpos x hx.1 + have := interp_lt (A := t) (A' := t + 1) (B := -1 * v x) (B' := 1 * v x) (hu₀ x) + (hu₁ x) (by linarith) (by linarith) + exact this.ne h₂.symm + have hOkU : ∀ z ∈ gr (F t 1) l (C - 3 / 5) ∪ gr (F (t + 1) 1) (C + 3 / 5) r, Ok a b c z := by + rintro _ (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩) + · exact hOkL _ _ (Or.inl rfl) x hx + · exact hOkR _ _ (Or.inl rfl) x hx + have hOkV : ∀ z ∈ gr (F (t + 1) (-1)) l (C - 3 / 5) ∪ gr (F t (-1)) (C + 3 / 5) r, + Ok a b c z := by + rintro _ (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩) + · exact hOkL _ _ (Or.inr rfl) x hx + · exact hOkR _ _ (Or.inr rfl) x hx + rw [Set.disjoint_left] + rintro _ ⟨z, hz, rfl⟩ ⟨z', hz', heq⟩ + rcases hclass₁ z hz with h₁ | h₁ + · exact hsep z hz z' hz' (eq_of_qq_eq h₁ (hOkV z' hz') heq.symm) + rcases hclass₂ z' hz' with h₂ | h₂ + · exact hsep z hz z' hz' (eq_of_qq_eq h₂ (hOkU z hz) heq).symm + · exact hkey (h₁.symm.trans (heq.symm.trans h₂)) + +/-- The swap of heights `i` and `i + 1` with the `k`th cross-cap. -/ +theorem slab_crosscap [T2Space (SurfaceModel a b c)] {n k : ℕ} (hk : k < b) (i : Fin n) : + Slab a b c (n + 1) (3 * ((2 * a + k : ℕ) : ℝ) - 3 / 2) (3 * ((2 * a + k : ℕ) : ℝ) + 3 / 2) + (Equiv.swap i.castSucc i.succ) := by + classical + set I : ℕ := 2 * a + k with hIdef + have hIlt : I < 2 * a + b + c := by omega + set C : ℝ := 3 * (I : ℝ) with hC + set l : ℝ := C - 3 / 2 with hl + set r : ℝ := C + 3 / 2 with hr + set t : ℝ := ((i : ℕ) : ℝ) with ht + have hlr : l < r := by rw [hl, hr]; linarith + have hcl := continuous_lam l r + have hcs := continuous_sat + let u : ℝ → ℝ := lam l r + have hu₀ : ∀ x, 0 ≤ u x := lam_nonneg l r + have hu₁ : ∀ x, u x ≤ 1 := lam_le_one l r + have hum : ∀ {x}, C - 5 / 4 ≤ x → x ≤ C + 5 / 4 → u x = 1 := fun h₁ h₂ ↦ + lam_eq_one (by rw [hl]; linarith) (by rw [hr]; linarith) + have hgap : ∀ x ∈ Icc l r, lam l r x < 1 → ∀ y, Clear a b c (x, y) := by + intro x hx hlt y + have hx₁ := hx.1 + have hx₂ := hx.2 + rcases lam_lt_one hlt with h | h + · refine clear_of_gap ((I : ℤ) - 1) ?_ ?_ <;> push_cast <;> linarith + · refine clear_of_gap ((I : ℤ)) ?_ ?_ <;> push_cast <;> linarith + let v : ℝ → ℝ := fun x ↦ sat (4 / 3 * (x - C)) + have hvc : Continuous v := by simp only [v]; fun_prop + let F : ℝ → ℝ → ℝ → ℝ := fun P s x ↦ (1 - u x) * P + u x * (s * v x) + have hFc : ∀ P s, Continuous (F P s) := fun P s ↦ by + simp only [F, u] + fun_prop + have hout : ∀ x ∈ Icc l r, ¬ (C - 5 / 4 ≤ x ∧ x ≤ C + 5 / 4) → ∀ y, Clear a b c (x, y) := by + intro x hx hn y + have hx₁ := hx.1 + have hx₂ := hx.2 + rw [not_and_or, not_le, not_le] at hn + rcases hn with h | h + · refine clear_of_gap ((I : ℤ) - 1) ?_ ?_ <;> push_cast <;> linarith + · refine clear_of_gap ((I : ℤ)) ?_ ?_ <;> push_cast <;> linarith + have hclear : ∀ P s, (s = 1 ∨ s = -1) → ∀ x ∈ Icc l r, 9 / 25 < (x - C) ^ 2 → + Clear a b c (x, F P s x) := by + intro P s hs x hx hsq + rcases (hu₁ x).lt_or_eq with h | h + · exact hgap x hx h _ + by_cases hmid : C - 5 / 4 ≤ x ∧ x ≤ C + 5 / 4 + · have hFx : F P s x = s * v x := by simp only [F, h]; ring + rw [hFx] + have hle : (x - C) ^ 2 ≤ 25 / 16 := by nlinarith [hmid.1, hmid.2] + have hs2 : s ^ 2 = 1 := by rcases hs with rfl | rfl <;> norm_num + refine clear_slope (I := I) hsq hle ?_ + rcases sat_sq (4 / 3 * (x - C)) with h₁ | h₁ + · left + simp only [v, mul_pow, hs2, h₁] + ring + · right + simp only [v, mul_pow, hs2, h₁] + ring + · exact hout x hx hmid _ + have hu_l : u l = 0 := lam_left hlr.le + have hu_r : u r = 0 := lam_right hlr.le + have hFl : ∀ P s, F P s l = P := fun P s ↦ by simp [F, hu_l] + have hFr : ∀ P s, F P s r = P := fun P s ↦ by simp [F, hu_r] + have hvm : v (C - 3 / 5) = -4 / 5 := by + simp only [v] + rw [show (4 / 3 * (C - 3 / 5 - C) : ℝ) = -4 / 5 by ring] + exact sat_eq (by norm_num) (by norm_num) + have hvp : v (C + 3 / 5) = 4 / 5 := by + simp only [v] + rw [show (4 / 3 * (C + 3 / 5 - C) : ℝ) = 4 / 5 by ring] + exact sat_eq (by norm_num) (by norm_num) + have hum' : u (C - 3 / 5) = 1 := hum (by linarith) (by linarith) + have hup' : u (C + 3 / 5) = 1 := hum (by linarith) (by linarith) + have hFm : ∀ P s, F P s (C - 3 / 5) = s * (-4 / 5) := fun P s ↦ by + simp only [F, hum', hvm]; ring + have hFp : ∀ P s, F P s (C + 3 / 5) = s * (4 / 5) := fun P s ↦ by + simp only [F, hup', hvp]; ring + have hIcl : Icc l (C - 3 / 5) ⊆ Icc l r := fun x hx ↦ ⟨hx.1, hx.2.trans (by rw [hr]; linarith)⟩ + have hIcr : Icc (C + 3 / 5) r ⊆ Icc l r := fun x hx ↦ ⟨by rw [hl]; linarith [hx.1], hx.2⟩ + have hsql : ∀ x ∈ Icc l (C - 3 / 5), x ≠ C - 3 / 5 → 9 / 25 < (x - C) ^ 2 := by + intro x hx hne + have : x < C - 3 / 5 := lt_of_le_of_ne hx.2 hne + nlinarith + have hsqr : ∀ x ∈ Icc (C + 3 / 5) r, x ≠ C + 3 / 5 → 9 / 25 < (x - C) ^ 2 := by + intro x hx hne + have : C + 3 / 5 < x := lt_of_le_of_ne hx.1 (Ne.symm hne) + nlinarith + have hport : ∀ {u₁ u₂ : ℝ}, u₁ ^ 2 + u₂ ^ 2 = 1 → Ok a b c (C + u₁, u₂) := fun h ↦ ok_circle h + have hglue : ∀ {u₁ u₂ : ℝ}, u₁ ^ 2 + u₂ ^ 2 = 1 → + qq a b c (C + u₁, u₂) = qq a b c (C - u₁, -u₂) := fun h ↦ qq_crosscap hk h + have hside : ∀ {u₁ u₂ : ℝ}, u₁ ^ 2 + u₂ ^ 2 = 1 → ∀ z, Ok a b c z → + qq a b c z = qq a b c (C + u₁, u₂) → l < z.1 ∧ z.1 < r := by + intro u₁ u₂ h z hz heq + obtain ⟨h₁, h₂⟩ := crosscap_side hk (w := (C + u₁, u₂)) (by simp only [hC]; nlinarith) + (hport h) hz heq + rw [hl, hr] + constructor <;> linarith + have hsqs : ∀ s : ℝ, (s = 1 ∨ s = -1) → (-3 / 5 : ℝ) ^ 2 + (s * (-4 / 5)) ^ 2 = 1 := by + rintro s (rfl | rfl) <;> norm_num + have hsqs' : ∀ s : ℝ, (s = 1 ∨ s = -1) → (3 / 5 : ℝ) ^ 2 + (s * (4 / 5)) ^ 2 = 1 := by + rintro s (rfl | rfl) <;> norm_num + have ep₁ : ∀ s : ℝ, (C - 3 / 5, s * (-4 / 5)) = (C + (-3 / 5), s * (-4 / 5)) := fun s ↦ + Prod.ext (by simp only; ring) rfl + have ep₂ : ∀ s : ℝ, (C + 3 / 5, s * (4 / 5)) = (C - (-3 / 5), -(s * (-4 / 5))) := fun s ↦ + Prod.ext (by simp only; ring) (by simp only; ring) + have hOkL : ∀ P s, (s = 1 ∨ s = -1) → ∀ x ∈ Icc l (C - 3 / 5), Ok a b c (x, F P s x) := by + intro P s hs x hx + by_cases h : x = C - 3 / 5 + · subst h + rw [hFm, ep₁] + exact hport (hsqs s hs) + · exact (hclear P s hs x (hIcl hx) (hsql x hx h)).ok + have hOkR : ∀ P s, (s = 1 ∨ s = -1) → ∀ x ∈ Icc (C + 3 / 5) r, Ok a b c (x, F P s x) := by + intro P s hs x hx + by_cases h : x = C + 3 / 5 + · subst h + rw [hFp] + exact hport (hsqs' s hs) + · exact (hclear P s hs x (hIcr hx) (hsqr x hx h)).ok + have hpart : ∀ P P' s, (s = 1 ∨ s = -1) → + IsLineWithEnds (qq a b c '' (gr (F P s) l (C - 3 / 5) ∪ gr (F P' s) (C + 3 / 5) r)) + (qq a b c (l, P)) (qq a b c (r, P')) ∧ + (∀ z, Ok a b c z → z.1 ≤ l → + qq a b c z ∈ qq a b c '' (gr (F P s) l (C - 3 / 5) ∪ gr (F P' s) (C + 3 / 5) r) → + qq a b c z = qq a b c (l, P)) ∧ + (∀ z, Ok a b c z → r ≤ z.1 → + qq a b c z ∈ qq a b c '' (gr (F P s) l (C - 3 / 5) ∪ gr (F P' s) (C + 3 / 5) r) → + qq a b c z = qq a b c (r, P')) := by + intro P P' s hs + have hsq' := hsqs s hs + have := two_part (a := a) (b := b) (c := c) (f₁ := F P s) (f₂ := F P' s) (l := l) + (e₁ := C - 3 / 5) (e₂ := C + 3 / 5) (r := r) (by rw [hl]; linarith) (by linarith) + (by rw [hr]; linarith) (hFc _ _).continuousOn (hFc _ _).continuousOn (hOkL P s hs) + (hOkR P' s hs) + (fun x hx h ↦ hclear P s hs x (hIcl hx) (hsql x hx h)) + (fun x hx h ↦ hclear P' s hs x (hIcr hx) (hsqr x hx h)) + (by rw [hFm, hFp, ep₁, ep₂]; exact hglue hsq') + (fun z hz heq ↦ by + rw [hFm, ep₁] at heq + exact hside hsq' z hz heq) + rw [hFl, hFr] at this + exact this + have hcast : (((i : ℕ) + 1 : ℕ) : ℝ) = t + 1 := by rw [ht]; push_cast; ring + obtain ⟨hA, hAl, hAr⟩ := hpart t (t + 1) 1 (Or.inl rfl) + obtain ⟨hB, hBl, hBr⟩ := hpart (t + 1) t (-1) (Or.inr rfl) + refine slab_of_band i hlr hgap + (Su := gr (F t 1) l (C - 3 / 5) ∪ gr (F (t + 1) 1) (C + 3 / 5) r) + (Sv := gr (F (t + 1) (-1)) l (C - 3 / 5) ∪ gr (F t (-1)) (C + 3 / 5) r) + (by rw [hcast]; exact hA) (by rw [hcast]; exact hB) ?_ ?_ ?_ hAl (by rw [hcast]; exact hAr) + (by rw [hcast]; exact hBl) hBr + · rintro z ((⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩) | (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩)) + · exact ⟨hOkL _ _ (Or.inl rfl) x hx, (hIcl hx).1, (hIcl hx).2⟩ + · exact ⟨hOkR _ _ (Or.inl rfl) x hx, (hIcr hx).1, (hIcr hx).2⟩ + · exact ⟨hOkL _ _ (Or.inr rfl) x hx, (hIcl hx).1, (hIcl hx).2⟩ + · exact ⟨hOkR _ _ (Or.inr rfl) x hx, (hIcr hx).1, (hIcr hx).2⟩ + · rw [hcast] + have hv₁ : ∀ x, -5 / 4 ≤ v x := fun x ↦ le_sat _ + have hv₂ : ∀ x, v x ≤ 5 / 4 := fun x ↦ sat_le _ + rintro z ((⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩) | (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩)) + · exact band_interp (hu₀ x) (hu₁ x) le_rfl (by linarith) (by linarith [hv₁ x]) + (by linarith [hv₂ x]) + · exact band_interp (hu₀ x) (hu₁ x) (by linarith) le_rfl (by linarith [hv₁ x]) + (by linarith [hv₂ x]) + · exact band_interp (hu₀ x) (hu₁ x) (by linarith) le_rfl (by linarith [hv₂ x]) + (by linarith [hv₁ x]) + · exact band_interp (hu₀ x) (hu₁ x) le_rfl (by linarith) (by linarith [hv₂ x]) + (by linarith [hv₁ x]) + · exact crosscap_bands_disjoint hk hclear hIcl hIcr hsql hsqr hFm hFp hOkL hOkR + +end GraphMinor.GM20.Draw diff --git a/LeanPool/GraphMinor/GM20/Draw6.lean b/LeanPool/GraphMinor/GM20/Draw6.lean new file mode 100644 index 0000000000..cc451dacf3 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Draw6.lean @@ -0,0 +1,234 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Draw5 +public import LeanPool.GraphMinor.Surface.CrossCut + +/-! +# Drawing a graph in a surface of large genus: any permutation + +Every permutation is a product of swaps of neighbouring heights. So a row of handles, or a row of +cross-caps, carries a set of disjoint curves from any order of heights on the left to any other +order +on the right. Straight segments in the strips between the circles join these curves to each other +and +to the vertices. +-/ + +@[expose] public section + +namespace GraphMinor.GM20.Draw + +open Set Topology GraphMinor.Surface + +variable {a b c : ℕ} + +/-- The curves for a permutation of `m + 1` heights, for `m` positive. -/ +theorem wiring {m : ℕ} (hm : 0 < m) (σ : Equiv.Perm (Fin (m + 1))) : + ∃ L, 1 ≤ L ∧ ∀ (a b c : ℕ) [T2Space (SurfaceModel a b c)] (x : ℕ → ℝ) (s : ℕ), Monotone x → + (∀ j, s ≤ j → j < s + L → ∀ i : Fin m, + Slab a b c (m + 1) (x j) (x (j + 1)) (Equiv.swap i.castSucc i.succ)) → + Slab a b c (m + 1) (x s) (x (s + L)) σ := by + have hσ : σ ∈ Submonoid.closure (Set.range fun i : Fin m ↦ + Equiv.swap i.castSucc i.succ) := by + rw [Equiv.Perm.mclosure_swap_castSucc_succ] + exact Submonoid.mem_top _ + induction hσ using Submonoid.closure_induction with + | mem τ hτ => + obtain ⟨i, rfl⟩ := hτ + exact ⟨1, le_rfl, fun a b c _ x s _ h ↦ h s le_rfl (by omega) i⟩ + | one => + refine ⟨2, by omega, fun a b c _ x s hx h ↦ ?_⟩ + have h₀ := h s le_rfl (by omega) ⟨0, hm⟩ + have h₁ := h (s + 1) (by omega) (by omega) ⟨0, hm⟩ + have h₂ := h₀.comp h₁ (hx (by omega)) (hx (by omega)) + rw [Equiv.swap_mul_self] at h₂ + exact h₂ + | mul τ τ' _ _ h₁ h₂ => + obtain ⟨L₁, hL₁, h₁⟩ := h₁ + obtain ⟨L₂, hL₂, h₂⟩ := h₂ + refine ⟨L₂ + L₁, by omega, fun a b c _ x s hx h ↦ ?_⟩ + have h₃ := h₂ a b c x s hx fun j hj hj' ↦ h j hj (by omega) + have h₄ := h₁ a b c x (s + L₂) hx fun j hj hj' ↦ h j (by omega) (by omega) + rw [← add_assoc] + exact h₃.comp h₄ (hx (by omega)) (hx (by omega)) + +/-- The curves for a permutation of an even number of heights. -/ +theorem wiring_even {n : ℕ} (hn : Even n) (σ : Equiv.Perm (Fin n)) : + ∃ L, 1 ≤ L ∧ ∀ (a b c : ℕ) [T2Space (SurfaceModel a b c)] (x : ℕ → ℝ) (s : ℕ), Monotone x → + (∀ j, s ≤ j → j < s + L → ∀ (m : ℕ) (i : Fin m), + Slab a b c (m + 1) (x j) (x (j + 1)) (Equiv.swap i.castSucc i.succ)) → + Slab a b c n (x s) (x (s + L)) σ := by + obtain ⟨k, rfl⟩ := hn + rcases Nat.eq_zero_or_pos k with rfl | hk + · refine ⟨1, le_rfl, fun a b c _ x s _ _ ↦ ?_⟩ + exact ⟨fun p ↦ p.elim0, fun p ↦ p.elim0, fun p ↦ p.elim0, fun p ↦ p.elim0, fun p ↦ p.elim0, + fun p ↦ p.elim0⟩ + · obtain ⟨m, hm⟩ : ∃ m, k + k = m + 1 := ⟨k + k - 1, by omega⟩ + have hm0 : 0 < m := by omega + revert σ + rw [hm] + intro σ + obtain ⟨L, hL, h⟩ := wiring hm0 σ + exact ⟨L, hL, fun a b c _ x s hx hs ↦ h a b c x s hx fun j hj hj' i ↦ hs j hj hj' m i⟩ + +/-- A permutation is carried by a row of handles. -/ +theorem wiring_handles {n : ℕ} (hn : Even n) (σ : Equiv.Perm (Fin n)) : + ∃ L, 1 ≤ L ∧ ∀ (a b c : ℕ) [T2Space (SurfaceModel a b c)], L ≤ a → + Slab a b c n (3 * ((-1 : ℤ) : ℝ) + 3 / 2) (3 * (((2 * L : ℕ) : ℤ) - 1 : ℤ) + 3 / 2) σ := by + obtain ⟨L, hL, h⟩ := wiring_even hn σ + refine ⟨L, hL, fun a b c _ hLa ↦ ?_⟩ + have h₁ := h a b c (fun j ↦ 6 * (j : ℝ) - 3 / 2) 0 + (fun i j hij ↦ by + have : (i : ℝ) ≤ j := by exact_mod_cast hij + simp only + linarith) + (fun j _ hj m i ↦ by + have := slab_handle (a := a) (b := b) (c := c) (n := m) (k := j) (by omega) i + convert this using 1 + push_cast + ring) + convert h₁ using 1 + · push_cast + ring + · push_cast + ring + +/-- A permutation is carried by a row of cross-caps. -/ +theorem wiring_crosscaps {n : ℕ} (hn : Even n) (σ : Equiv.Perm (Fin n)) : + ∃ L, 1 ≤ L ∧ ∀ (a b c : ℕ) [T2Space (SurfaceModel a b c)], L ≤ b → + Slab a b c n (3 * (((2 * a : ℕ) : ℤ) - 1 : ℤ) + 3 / 2) + (3 * (((2 * a + L : ℕ) : ℤ) - 1 : ℤ) + 3 / 2) σ := by + obtain ⟨L, hL, h⟩ := wiring_even hn σ + refine ⟨L, hL, fun a b c _ hLb ↦ ?_⟩ + have h₁ := h a b c (fun j ↦ 3 * ((2 * a + j : ℕ) : ℝ) - 3 / 2) 0 + (fun i j hij ↦ by + have : (i : ℝ) ≤ j := by exact_mod_cast hij + simp only + push_cast + linarith) + (fun j _ hj m i ↦ by + have := slab_crosscap (a := a) (b := b) (c := c) (n := m) (k := j) (by omega) i + convert this using 1 + push_cast + ring) + convert h₁ using 1 + · push_cast + ring + · push_cast + ring + +/-- The straight segment between two points of the plane. -/ +def sg (z z' : ℝ × ℝ) : Set (ℝ × ℝ) := + (fun s : ℝ ↦ ((1 - s) * z.1 + s * z'.1, (1 - s) * z.2 + s * z'.2)) '' Icc 0 1 + +theorem mem_sg_left (z z' : ℝ × ℝ) : z ∈ sg z z' := ⟨0, by simp, by simp⟩ + +theorem mem_sg_right (z z' : ℝ × ℝ) : z' ∈ sg z z' := ⟨1, by simp, by simp⟩ + +theorem sg_fst {z z' w : ℝ × ℝ} (h : w ∈ sg z z') {l r : ℝ} (h₁ : l ≤ z.1) (h₂ : z.1 ≤ r) + (h₃ : l ≤ z'.1) (h₄ : z'.1 ≤ r) : l ≤ w.1 ∧ w.1 ≤ r := by + obtain ⟨s, hs, rfl⟩ := h + have h₅ := mul_nonneg (sub_nonneg.mpr hs.2) (sub_nonneg.mpr h₁) + have h₆ := mul_nonneg hs.1 (sub_nonneg.mpr h₃) + have h₇ := mul_nonneg (sub_nonneg.mpr hs.2) (sub_nonneg.mpr h₂) + have h₈ := mul_nonneg hs.1 (sub_nonneg.mpr h₄) + simp only + constructor <;> nlinarith + +/-- A segment in a strip between two circles is a line of the model. -/ +theorem isLine_sg [T2Space (SurfaceModel a b c)] (m : ℤ) {z z' : ℝ × ℝ} + (h₁ : 3 * (m : ℝ) + 5 / 4 ≤ z.1) (h₂ : z.1 ≤ 3 * m + 7 / 4) + (h₃ : 3 * (m : ℝ) + 5 / 4 ≤ z'.1) (h₄ : z'.1 ≤ 3 * m + 7 / 4) (hne : z ≠ z') : + IsLineWithEnds (qq a b c '' sg z z') (qq a b c z) (qq a b c z') ∧ + ∀ w ∈ sg z z', Clear a b c w := by + have hcl : ∀ w ∈ sg z z', Clear a b c w := fun w hw ↦ by + obtain ⟨h₅, h₆⟩ := sg_fst hw h₁ h₂ h₃ h₄ + exact clear_of_gap m (by linarith) (by linarith) + refine ⟨?_, hcl⟩ + let pt : ℝ → ℝ × ℝ := fun s ↦ ((1 - s) * z.1 + s * z'.1, (1 - s) * z.2 + s * z'.2) + have hpt : ∀ t : unitInterval, pt t.1 ∈ sg z z' := fun t ↦ ⟨t.1, ⟨t.2.1, t.2.2⟩, rfl⟩ + have hc : Continuous fun t : unitInterval ↦ pt t.1 := by + simp only [pt] + fun_prop + let g : C(unitInterval, SurfaceModel a b c) := + ⟨fun t ↦ qq a b c (pt t.1), continuousOn_qq.comp_continuous hc fun t ↦ (hcl _ (hpt t)).ok⟩ + have hinj : Function.Injective g := by + intro s t hst + have h₅ : pt s.1 = pt t.1 := eq_of_qq_eq (hcl _ (hpt s)) (hcl _ (hpt t)).ok hst + apply Subtype.ext + obtain ⟨h₆, h₇⟩ := Prod.ext_iff.mp h₅ + simp only [pt] at h₆ h₇ + have h₈ : (s.1 - t.1) * (z'.1 - z.1) = 0 := by linarith + have h₉ : (s.1 - t.1) * (z'.2 - z.2) = 0 := by linarith + by_contra hst' + have h₁₀ : s.1 - t.1 ≠ 0 := sub_ne_zero.mpr hst' + have h₁₁ := (mul_eq_zero.mp h₈).resolve_left h₁₀ + have h₁₂ := (mul_eq_zero.mp h₉).resolve_left h₁₀ + exact hne (Prod.ext (by linarith) (by linarith)) + have hL := GM11.isLineWithEnds_range g hinj + have hr : range g = qq a b c '' sg z z' := by + ext w + constructor + · rintro ⟨t, rfl⟩ + exact ⟨_, hpt t, rfl⟩ + · rintro ⟨_, ⟨s, hs, rfl⟩, rfl⟩ + exact ⟨⟨s, hs.1, hs.2⟩, rfl⟩ + have h0 : g 0 = qq a b c z := by + change qq a b c (pt 0) = _ + simp [pt] + have h1 : g 1 = qq a b c z' := by + change qq a b c (pt 1) = _ + simp [pt] + rw [hr, h0, h1] at hL + exact hL + +/-- Two lines with the same ends, meeting only at the ends, form an `O`-arc. -/ +theorem isOArc_of_lines {S : Type*} [TopologicalSpace S] [T2Space S] {L L' : Set S} {u v : S} + (h : IsLineWithEnds L u v) (h' : IsLineWithEnds L' u v) (huv : L ∩ L' ⊆ {u, v}) : + IsOArc (L ∪ L') := by + obtain ⟨f, rfl, rfl⟩ := h + obtain ⟨f', hf₀, hf₁⟩ := h' + have hinj : ∀ {x y : unitInterval}, (f x).1 = (f y).1 → x = y := fun h ↦ + f.injective (Subtype.ext h) + have hinj' : ∀ {x y : unitInterval}, (f' x).1 = (f' y).1 → x = y := fun h ↦ + f'.injective (Subtype.ext h) + have hra : range (fun t ↦ (f t).1) = L := by + ext w + constructor + · rintro ⟨t, rfl⟩ + exact (f t).2 + · intro hw + exact ⟨f.symm ⟨w, hw⟩, by simp⟩ + have hrb : range (fun t ↦ (f' t).1) = L' := by + ext w + constructor + · rintro ⟨t, rfl⟩ + exact (f' t).2 + · intro hw + exact ⟨f'.symm ⟨w, hw⟩, by simp⟩ + have := GraphMinor.Surface.oArc_of_two_arcs (a := fun t ↦ (f t).1) (b := fun t ↦ (f' t).1) + ⟨continuous_subtype_val.comp f.continuous, fun _ _ h ↦ hinj h⟩ + ⟨continuous_subtype_val.comp f'.continuous, fun _ _ h ↦ hinj' h⟩ hf₀.symm hf₁.symm + (fun s t hst ↦ by + have hm : (f s).1 ∈ L ∩ L' := ⟨(f s).2, hst ▸ (f' t).2⟩ + rcases huv hm with h | h + · left + have hs : s = 0 := hinj h + have ht : t = 0 := hinj' (by rw [hf₀, ← h, ← hst]) + exact ⟨hs, ht⟩ + · right + have hs : s = 1 := hinj (mem_singleton_iff.mp h) + have ht : t = 1 := hinj' (by rw [hf₁, ← mem_singleton_iff.mp h, ← hst]) + exact ⟨hs, ht⟩) + rw [hra, hrb] at this + exact this + +end GraphMinor.GM20.Draw diff --git a/LeanPool/GraphMinor/GM20/Draw7.lean b/LeanPool/GraphMinor/GM20/Draw7.lean new file mode 100644 index 0000000000..c66f8fa461 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Draw7.lean @@ -0,0 +1,142 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Draw6 + +/-! +# Drawing a graph in a surface of large genus: fans + +To the left of a set of disjoint curves there is a strip free of circles. In this strip straight +segments join the left ends of the curves to points on a vertical line, one point for each vertex. +If +the heights of these points increase with the heights of the left ends, then the segments meet only +at +the points on the vertical line. +-/ + +@[expose] public section + +namespace GraphMinor.GM20.Draw + +open Set Topology GraphMinor.Surface + +variable {a b c : ℕ} + +/-- Disjoint curves with left ends sorted by height extend to a common vertical line on the left. -/ +theorem exists_fans [T2Space (SurfaceModel a b c)] {n : ℕ} {π : Equiv.Perm (Fin n)} {m₀ : ℤ} + {r : ℝ} (hr : 3 * (m₀ : ℝ) + 3 / 2 < r) (hS : Slab a b c n (3 * (m₀ : ℝ) + 3 / 2) r π) + {h : Fin n → ℝ} (hh : Monotone h) : + ∃ A : Fin n → Set (SurfaceModel a b c), + (∀ p, IsLineWithEnds (A p) (qq a b c (3 * (m₀ : ℝ) + 5 / 4, h p)) (qq a b c (r, π p))) ∧ + (∀ p p', p ≠ p' → ∀ w ∈ A p, w ∈ A p' → + w = qq a b c (3 * (m₀ : ℝ) + 5 / 4, h p) ∧ h p = h p') ∧ + (∀ p y, qq a b c (3 * (m₀ : ℝ) + 5 / 4, y) ∈ A p → y = h p) ∧ + (∀ p z, Ok a b c z → r ≤ z.1 → qq a b c z ∈ A p → qq a b c z = qq a b c (r, π p)) := by + obtain ⟨P, hP, hPd, hPz, hPl, hPr⟩ := hS + set X : ℝ := 3 * (m₀ : ℝ) + 5 / 4 with hX + set Y : ℝ := 3 * (m₀ : ℝ) + 3 / 2 with hY + let S : Fin n → Set (ℝ × ℝ) := fun p ↦ sg (X, h p) (Y, ((p : ℕ) : ℝ)) + have hseg := fun p : Fin n ↦ isLine_sg (a := a) (b := b) (c := c) m₀ (z := (X, h p)) + (z' := (Y, ((p : ℕ) : ℝ))) (by simp only [hX]; linarith) (by simp only [hX]; linarith) + (by simp only [hY]; linarith) (by simp only [hY]; linarith) + (fun he ↦ by + have := congrArg Prod.fst he + simp only [hX, hY] at this + linarith) + have hcl : ∀ p, ∀ z ∈ S p, Clear a b c z := fun p ↦ (hseg p).2 + have hfst : ∀ p, ∀ z ∈ S p, X ≤ z.1 ∧ z.1 ≤ Y := fun p z hz ↦ + sg_fst hz le_rfl (by simp only [hX, hY]; linarith) (by simp only [hX, hY]; linarith) le_rfl + have hright : ∀ p, ∀ z ∈ S p, z.1 = Y → z.2 = ((p : ℕ) : ℝ) := by + rintro p _ ⟨s, hs, rfl⟩ h₁ + simp only at h₁ ⊢ + have h₂ : (1 - s) * (Y - X) = 0 := by linarith + have h₃ : 1 - s = 0 := (mul_eq_zero.mp h₂).resolve_right (by simp only [hX, hY]; linarith) + have h₄ : s = 1 := by linarith + subst h₄ + simp + have hleft : ∀ p, ∀ z ∈ S p, z.1 = X → z.2 = h p := by + rintro p _ ⟨s, hs, rfl⟩ h₁ + simp only at h₁ ⊢ + have h₂ : s * (Y - X) = 0 := by linarith + have h₃ : s = 0 := (mul_eq_zero.mp h₂).resolve_right (by simp only [hX, hY]; linarith) + subst h₃ + simp + have hsegs : ∀ p p', p < p' → ∀ z ∈ S p, z ∈ S p' → z = (X, h p) ∧ h p = h p' := by + rintro p p' hlt _ ⟨s, hs, rfl⟩ ⟨s', hs', heq⟩ + obtain ⟨h₁, h₂⟩ := Prod.ext_iff.mp heq + simp only at h₁ h₂ + have h₃ : (s' - s) * (Y - X) = 0 := by linarith + have h₄ : s' - s = 0 := (mul_eq_zero.mp h₃).resolve_right (by simp only [hX, hY]; linarith) + have h₅ : s' = s := by linarith + subst h₅ + have h₆ : ((p : ℕ) : ℝ) + 1 ≤ ((p' : ℕ) : ℝ) := by exact_mod_cast hlt + have h₇ : h p ≤ h p' := hh hlt.le + have h₈ := mul_nonneg (sub_nonneg.mpr hs.2) (sub_nonneg.mpr h₇) + have h₉ : s' * (((p' : ℕ) : ℝ) - p) + (1 - s') * (h p' - h p) = 0 := by linarith + have h₁₀ : s' * ((p' : ℕ) - p : ℝ) ≥ 0 := mul_nonneg hs.1 (by linarith) + have h₁₁ : s' * ((p' : ℕ) - p : ℝ) = 0 := by linarith + have h₁₂ : s' = 0 := (mul_eq_zero.mp h₁₁).resolve_right (by linarith) + subst h₁₂ + exact ⟨by simp, (by simpa using h₂ : h p' = h p).symm⟩ + have hsegP : ∀ p p', ∀ z ∈ S p, qq a b c z ∈ P p' → p = p' := by + intro p p' z hz hzP + have h₁ := hPl p' z (hcl p z hz).ok (hfst p z hz).2 hzP + have h₂ : Ok a b c (Y, (((p' : ℕ) : ℝ))) := + (clear_of_gap m₀ (by simp only [hY]; linarith) (by simp only [hY]; linarith)).ok + have h₃ := eq_of_qq_eq (hcl p z hz) h₂ h₁ + have h₄ := hright p z hz (by rw [h₃]) + rw [h₃] at h₄ + simp only at h₄ + exact (Fin.ext (by exact_mod_cast h₄)).symm + refine ⟨fun p ↦ qq a b c '' S p ∪ P p, ?_, ?_, ?_, ?_⟩ + · intro p + refine GM11.IsLineWithEnds.union (GM11.IsLineWithEnds.symm (hseg p).1) (hP p) ?_ + ext w + constructor + · rintro ⟨⟨z, hz, rfl⟩, hzP⟩ + exact hPl p z (hcl p z hz).ok (hfst p z hz).2 hzP + · rintro rfl + exact ⟨(mem_of_line (hseg p).1).2, (mem_of_line (hP p)).1⟩ + · intro p p' hne w hw hw' + rcases hw with ⟨z, hz, rfl⟩ | hw + · rcases hw' with ⟨z', hz', heq⟩ | hw' + · have h₁ := eq_of_qq_eq (hcl p' z' hz') (hcl p z hz).ok heq + subst h₁ + rcases lt_or_gt_of_ne hne with h₂ | h₂ + · obtain ⟨h₃, h₄⟩ := hsegs p p' h₂ z' hz hz' + exact ⟨by rw [h₃], h₄⟩ + · obtain ⟨h₃, h₄⟩ := hsegs p' p h₂ z' hz' hz + exact ⟨by rw [h₃, h₄], h₄.symm⟩ + · exact absurd (hsegP p p' z hz hw') hne + · rcases hw' with ⟨z', hz', rfl⟩ | hw' + · exact absurd (hsegP p' p z' hz' hw) hne.symm + · exact absurd hw' (Set.disjoint_left.mp (hPd hne) hw) + · rintro p y (⟨z, hz, heq⟩ | hw) + · have h₁ := eq_of_qq_eq (hcl p z hz) + (clear_of_gap (y := y) m₀ (by simp only [hX]; linarith) + (by simp only [hX]; linarith)).ok heq + have h₂ := hleft p z hz (by rw [h₁]) + rw [h₁] at h₂ + exact h₂ + · obtain ⟨z, ⟨_, h₂, _⟩, heq⟩ := hPz p hw + have h₃ := eq_of_qq_eq (clear_of_gap (y := y) (a := a) (b := b) (c := c) m₀ + (by simp only [hX]; linarith) (by simp only [hX]; linarith)) (by assumption) heq.symm + have h₄ := congrArg Prod.fst h₃ + simp only at h₄ + simp only [hX] at h₄ + linarith + · rintro p z hz hzr (⟨z', hz', heq⟩ | hw) + · have h₁ := eq_of_qq_eq (hcl p z' hz') hz heq + subst h₁ + have := (hfst p z' hz').2 + linarith + · exact hPr p z hz hzr hw + +end GraphMinor.GM20.Draw diff --git a/LeanPool/GraphMinor/GM20/Draw8.lean b/LeanPool/GraphMinor/GM20/Draw8.lean new file mode 100644 index 0000000000..18ea8118f9 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Draw8.lean @@ -0,0 +1,340 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Draw7 +public import LeanPool.GraphMinor.GM17.Defs +public import Mathlib.Data.Fin.Tuple.Sort + +/-! +# Drawing a graph in a surface of large genus + +Each edge of a finite graph has two half-edges. We list the half-edges in order of the vertices they +start from, and we run one curve for each half-edge across a row of handles or of cross-caps. The +curves come out on the right in the order of the edges. Short vertical segments then join the two +halves of each edge. This draws the graph in any model with many handles or with many cross-caps. +-/ + +@[expose] public section + +namespace GraphMinor.GM20.Draw + +open Set Topology GraphMinor.Surface GraphMinor.GM17 + +universe u v + +variable {a b c : ℕ} {α' : Type u} {β' : Type v} + +theorem exists_ends (H : Hypergraph α' β') (hH : H.IsGraph) {e : β'} (he : e ∈ H.edgeSet) : + ∃ u v, H.ends e = {u, v} := by + obtain ⟨h₁, h₂⟩ := hH e he + have hfin : (H.ends e).Finite := H.vertexSet_finite.subset fun v hv ↦ H.vertex_mem_of_inc hv + have h₃ : 0 < (H.ends e).ncard := (Set.ncard_pos hfin).mpr h₁ + have h₄ : (H.ends e).ncard = 1 ∨ (H.ends e).ncard = 2 := by omega + rcases h₄ with h₄ | h₄ + · obtain ⟨u, hu⟩ := Set.ncard_eq_one.mp h₄ + exact ⟨u, u, by simpa using hu⟩ + · obtain ⟨u, v, _, huv⟩ := Set.ncard_eq_two.mp h₄ + exact ⟨u, v, huv⟩ + +private theorem cap_intersections {a b c m : ℕ} {R : ℝ} + {A : Fin (2 * m) → Set (SurfaceModel a b c)} {Z : Fin m → Set (ℝ × ℝ)} + (π : Equiv.Perm (Fin (2 * m))) (blk : Fin (2 * m) → Fin m) + (hblk : ∀ d, (blk d : ℕ) = (d : ℕ) / 2) + (hA₄ : ∀ p z, Ok a b c z → R ≤ z.1 → qq a b c z ∈ A p → + qq a b c z = qq a b c (R, ((π p : ℕ) : ℝ))) + (hclR : ∀ y, Clear a b c (R, y)) + (hcapClear : ∀ j z, z ∈ Z j → Clear a b c z) + (hZ : ∀ j, ∀ z ∈ Z j, z.1 = R ∧ 2 * ((j : ℕ) : ℝ) ≤ z.2 ∧ z.2 ≤ 2 * (j : ℕ) + 1) : + let q : Fin m → Set (SurfaceModel a b c) := fun j ↦ qq a b c '' Z j + (∀ j p w, w ∈ q j → w ∈ A p → blk (π p) = j ∧ + w = qq a b c (R, ((π p : ℕ) : ℝ))) ∧ + (∀ j j' w, j ≠ j' → w ∈ q j → w ∈ q j' → False) := by + intro q + have hcapA : ∀ j p w, w ∈ q j → w ∈ A p → blk (π p) = j ∧ + w = qq a b c (R, ((π p : ℕ) : ℝ)) := by + rintro j p _ ⟨z, hz, rfl⟩ hw + have zc : Clear a b c z := hcapClear j z hz + obtain ⟨hz₁, hz₂, hz₃⟩ := hZ j z hz + have h₁ := hA₄ p z zc.ok hz₁.ge hw + have h₂ := eq_of_qq_eq zc (hclR _).ok h₁ + refine ⟨?_, h₁⟩ + rw [h₂] at hz₂ hz₃ + simp only at hz₂ hz₃ + have h₃ : 2 * (j : ℕ) ≤ ((π p : Fin (2 * m)) : ℕ) := by exact_mod_cast hz₂ + have h₄ : ((π p : Fin (2 * m)) : ℕ) ≤ 2 * (j : ℕ) + 1 := by exact_mod_cast hz₃ + exact Fin.ext (by simp only [hblk]; omega) + have hcapcap : ∀ j j' w, j ≠ j' → w ∈ q j → w ∈ q j' → False := by + rintro j j' _ hjj ⟨z, hz, rfl⟩ ⟨z', hz', heq⟩ + have h₁ := eq_of_qq_eq (hcapClear j' z' hz') (hcapClear j z hz).ok heq + subst h₁ + obtain ⟨_, h₂, h₃⟩ := hZ j z' hz + obtain ⟨_, h₄, h₅⟩ := hZ j' z' hz' + rcases lt_or_gt_of_ne hjj with h | h + · have h₆ : (((j : ℕ) + 1 : ℕ) : ℝ) ≤ ((j' : ℕ) : ℝ) := by exact_mod_cast h + push_cast at h₆ + linarith + · have h₆ : (((j' : ℕ) + 1 : ℕ) : ℝ) ≤ ((j : ℕ) : ℝ) := by exact_mod_cast h + push_cast at h₆ + linarith + exact ⟨hcapA, hcapcap⟩ + +private theorem isLine_or_isOArc_of_joined_pieces + {T : Type*} [TopologicalSpace T] [T2Space T] {ι : Type*} {s t : ι} + (ν : ι → T) {left cap right : Set T} {p : T} + (hleft : IsLineWithEnds (left ∪ cap) (ν s) p) + (hright : IsLineWithEnds right (ν t) p) + (hmeet : ∀ w, w ∈ left → w ∈ right → w = ν s ∧ s = t) + (htop : ∀ w, w ∈ cap → w ∈ right → w = p) : + (s ≠ t → IsLineWithEnds ((left ∪ cap) ∪ right) (ν s) (ν t)) ∧ + (s = t → IsOArc ((left ∪ cap) ∪ right)) := by + constructor + · intro hst + refine GM11.IsLineWithEnds.union (GM11.IsLineWithEnds.symm hleft) + (GM11.IsLineWithEnds.symm hright) ?_ + ext w + constructor + · rintro ⟨hw | hw, hw'⟩ + · exact absurd (hmeet w hw hw').2 hst + · exact htop w hw hw' + · rintro rfl + exact ⟨(mem_of_line hleft).2, (mem_of_line hright).2⟩ + · intro hst + have h := hright + rw [← hst] at h + refine isOArc_of_lines hleft h ?_ + rintro w ⟨hw | hw, hw'⟩ + · exact Or.inl (hmeet w hw hw').1 + · exact Or.inr (htop w hw hw') + +/-- A finite graph has a list of half-edges such that any set of curves that reorders the list as +needed gives a drawing of the graph. -/ +theorem exists_perm (H : Hypergraph α' β') (hH : H.IsGraph) : + ∃ (n : ℕ) (_ : Even n) (π : Equiv.Perm (Fin n)), ∀ (a b c : ℕ) + [T2Space (SurfaceModel a b c)] (m₀ m₁ : ℤ), m₀ < m₁ → + Slab a b c n (3 * (m₀ : ℝ) + 3 / 2) (3 * (m₁ : ℝ) + 3 / 2) π → + CanBeDrawn (SurfaceModel a b c) H := by + classical + have hEf : Finite H.edgeSet := H.edgeSet_finite.to_subtype + obtain ⟨m, ⟨Eq⟩⟩ := Finite.exists_equiv_fin H.edgeSet + let e : Fin m → β' := fun j ↦ (Eq.symm j).1 + have hem : ∀ j, e j ∈ H.edgeSet := fun j ↦ (Eq.symm j).2 + choose s t hst using fun j ↦ exists_ends H hH (hem j) + have hsm : ∀ j, s j ∈ H.ends (e j) := fun j ↦ by rw [hst]; exact Or.inl rfl + have htm : ∀ j, t j ∈ H.ends (e j) := fun j ↦ by rw [hst]; exact Or.inr rfl + have hsV : ∀ j, s j ∈ H.vertexSet := fun j ↦ H.vertex_mem_of_inc (hsm j) + have htV : ∀ j, t j ∈ H.vertexSet := fun j ↦ H.vertex_mem_of_inc (htm j) + obtain ⟨idx, hidx⟩ := Set.countable_iff_exists_injOn.mp H.vertexSet_finite.countable + have hdiv : ∀ d : Fin (2 * m), (d : ℕ) / 2 < m := fun d ↦ by omega + let blk : Fin (2 * m) → Fin m := fun d ↦ ⟨d / 2, hdiv d⟩ + let hv : Fin (2 * m) → α' := fun d ↦ if (d : ℕ) % 2 = 0 then s (blk d) else t (blk d) + have hvm : ∀ d, hv d ∈ H.ends (e (blk d)) := fun d ↦ by + simp only [hv] + split_ifs + · exact hsm _ + · exact htm _ + let f : Fin (2 * m) → ℕ := fun d ↦ idx (hv d) + let π : Equiv.Perm (Fin (2 * m)) := Tuple.sort f + have hmono : Monotone fun p ↦ ((f (π p) : ℕ) : ℝ) := fun p p' hpp ↦ + Nat.cast_le.mpr (Tuple.monotone_sort f hpp) + refine ⟨2 * m, even_two_mul m, π, fun a b c _ m₀ m₁ hm hS ↦ ?_⟩ + have hm' : (m₀ : ℝ) + 1 ≤ m₁ := by exact_mod_cast hm + set X : ℝ := 3 * (m₀ : ℝ) + 5 / 4 with hX + set R : ℝ := 3 * (m₁ : ℝ) + 3 / 2 with hR + have hXR : X + 1 < R := by simp only [hX, hR]; linarith + obtain ⟨A, hA₁, hA₂, hA₃, hA₄⟩ := exists_fans (by simp only [hR]; linarith) hS hmono + let d₀ : Fin m → Fin (2 * m) := fun j ↦ ⟨2 * j, by omega⟩ + let d₁ : Fin m → Fin (2 * m) := fun j ↦ ⟨2 * j + 1, by omega⟩ + have hb₀ : ∀ j, blk (d₀ j) = j := fun j ↦ Fin.ext (by simp only [blk, d₀]; omega) + have hb₁ : ∀ j, blk (d₁ j) = j := fun j ↦ Fin.ext (by simp only [blk, d₁]; omega) + have hv₀ : ∀ j, hv (d₀ j) = s j := fun j ↦ by + simp only [hv, hb₀] + rw [ite_eq_left (by simp only [d₀]; omega)] + have hv₁ : ∀ j, hv (d₁ j) = t j := fun j ↦ by + simp only [hv, hb₁] + rw [ite_eq_right (by simp only [d₁]; omega)] + let ν : α' → SurfaceModel a b c := fun v ↦ qq a b c (X, ((idx v : ℕ) : ℝ)) + have hclX : ∀ y, Clear a b c (X, y) := fun y ↦ + clear_of_gap m₀ (by simp only [hX]; linarith) (by simp only [hX]; linarith) + have hclR : ∀ y, Clear a b c (R, y) := fun y ↦ + clear_of_gap m₁ (by simp only [hR]; linarith) (by simp only [hR]; linarith) + let Z : Fin m → Set (ℝ × ℝ) := fun j ↦ sg (R, (2 * (j : ℕ) : ℝ)) (R, (2 * (j : ℕ) + 1 : ℝ)) + have hcap := fun j : Fin m ↦ isLine_sg (a := a) (b := b) (c := c) m₁ + (z := (R, (2 * (j : ℕ) : ℝ))) (z' := (R, (2 * (j : ℕ) + 1 : ℝ))) + (by simp only [hR]; linarith) (by simp only [hR]; linarith) + (by simp only [hR]; linarith) (by simp only [hR]; linarith) + (fun he ↦ by + have := congrArg Prod.snd he + simp only at this + linarith) + have hZ : ∀ j, ∀ z ∈ Z j, z.1 = R ∧ 2 * ((j : ℕ) : ℝ) ≤ z.2 ∧ z.2 ≤ 2 * (j : ℕ) + 1 := by + rintro j _ ⟨u, hu, rfl⟩ + simp only + have h₁ := hu.1 + have h₂ := hu.2 + refine ⟨by ring, ?_, ?_⟩ <;> nlinarith + let q : Fin m → Set (SurfaceModel a b c) := fun j ↦ qq a b c '' Z j + let p₀ : Fin m → Fin (2 * m) := fun j ↦ π.symm (d₀ j) + let p₁ : Fin m → Fin (2 * m) := fun j ↦ π.symm (d₁ j) + have hπ₀ : ∀ j, π (p₀ j) = d₀ j := fun j ↦ π.apply_symm_apply _ + have hπ₁ : ∀ j, π (p₁ j) = d₁ j := fun j ↦ π.apply_symm_apply _ + have hne : ∀ j, p₀ j ≠ p₁ j := fun j he ↦ by + have h₁ : d₀ j = d₁ j := by rw [← hπ₀, ← hπ₁, he] + have h₂ := congrArg Fin.val h₁ + simp only [d₀, d₁] at h₂ + omega + have hL₀ : ∀ j, IsLineWithEnds (A (p₀ j)) (ν (s j)) (qq a b c (R, (2 * (j : ℕ) : ℝ))) := by + intro j + have h₁ := hA₁ (p₀ j) + have h₂ : f (π (p₀ j)) = idx (s j) := by + rw [hπ₀] + simp only [f, hv₀] + have h₃ : (((π (p₀ j) : Fin (2 * m)) : ℕ) : ℝ) = 2 * (j : ℕ) := by + rw [hπ₀] + simp only [d₀] + push_cast + rfl + simp only [h₂, h₃] at h₁ + exact h₁ + have hL₁ : ∀ j, IsLineWithEnds (A (p₁ j)) (ν (t j)) (qq a b c (R, (2 * (j : ℕ) + 1 : ℝ))) := by + intro j + have h₁ := hA₁ (p₁ j) + have h₂ : f (π (p₁ j)) = idx (t j) := by + rw [hπ₁] + simp only [f, hv₁] + have h₃ : (((π (p₁ j) : Fin (2 * m)) : ℕ) : ℝ) = 2 * (j : ℕ) + 1 := by + rw [hπ₁] + simp only [d₁] + push_cast + rfl + simp only [h₂, h₃] at h₁ + exact h₁ + obtain ⟨hcapA, hcapcap⟩ := + cap_intersections π blk (fun _ ↦ rfl) hA₄ hclR (fun j ↦ (hcap j).2) hZ + have hT : ∀ j, IsLineWithEnds (A (p₀ j) ∪ q j) (ν (s j)) + (qq a b c (R, (2 * (j : ℕ) + 1 : ℝ))) := by + intro j + refine GM11.IsLineWithEnds.union (GM11.IsLineWithEnds.symm (hL₀ j)) (hcap j).1 ?_ + ext w + constructor + · rintro ⟨hw, hw'⟩ + have h₁ := (hcapA j (p₀ j) w hw' hw).2 + rw [hπ₀] at h₁ + rw [mem_singleton_iff, h₁] + simp only [d₀] + push_cast + rfl + · rintro rfl + exact ⟨(mem_of_line (hL₀ j)).2, (mem_of_line (hcap j).1).1⟩ + have htop : ∀ j w, w ∈ q j → w ∈ A (p₁ j) → w = qq a b c (R, (2 * (j : ℕ) + 1 : ℝ)) := by + intro j w hw hw' + have h₁ := (hcapA j (p₁ j) w hw hw').2 + rw [hπ₁] at h₁ + rw [h₁] + simp only [d₁] + push_cast + rfl + have hvert₀ : ∀ j, qq a b c (X, ((f (π (p₀ j)) : ℕ) : ℝ)) = ν (s j) := fun j ↦ by + simp only [hπ₀, f, hv₀, ν] + have hmeet : ∀ j w, w ∈ A (p₀ j) → w ∈ A (p₁ j) → w = ν (s j) ∧ s j = t j := by + intro j w hw hw' + obtain ⟨h₁, h₂⟩ := hA₂ _ _ (hne j) w hw hw' + rw [hvert₀] at h₁ + refine ⟨h₁, hidx (hsV j) (htV j) ?_⟩ + have h₃ : idx (s j) = idx (t j) := by + have h₄ : f (π (p₀ j)) = f (π (p₁ j)) := by exact_mod_cast h₂ + rw [hπ₀, hπ₁] at h₄ + simpa only [f, hv₀, hv₁] using h₄ + exact h₃ + let B : Fin m → Set (SurfaceModel a b c) := fun j ↦ (A (p₀ j) ∪ q j) ∪ A (p₁ j) + have hjoined := fun j => isLine_or_isOArc_of_joined_pieces ν (hT j) (hL₁ j) (hmeet j) (htop j) + have hBline := fun j => (hjoined j).1 + have hBloop := fun j => (hjoined j).2 + have hBcases : ∀ j w, w ∈ B j → (∃ p, blk (π p) = j ∧ w ∈ A p) ∨ w ∈ q j := by + rintro j w ((hw | hw) | hw) + · exact Or.inl ⟨p₀ j, by rw [hπ₀, hb₀], hw⟩ + · exact Or.inr hw + · exact Or.inl ⟨p₁ j, by rw [hπ₁, hb₁], hw⟩ + have hE : ∀ b (hb : b ∈ H.edgeSet), e (Eq ⟨b, hb⟩) = b := fun b hb ↦ by simp [e] + refine ⟨ν, fun b ↦ if hb : b ∈ H.edgeSet then B (Eq ⟨b, hb⟩) else ∅, ?_, ?_, ?_, ?_, ?_⟩ + · intro u hu v hv' heq + have h₁ := eq_of_qq_eq (hclX _) (hclX _).ok heq + have h₂ := congrArg Prod.snd h₁ + simp only at h₂ + exact hidx hu hv' (by exact_mod_cast h₂) + · intro b hb u v hu hv' huv + simp only [dite_eq_left hb] + have h₁ := hst (Eq ⟨b, hb⟩) + rw [hE] at h₁ + have hu' : u ∈ H.ends b := hu + have hv'' : v ∈ H.ends b := hv' + rw [h₁] at hu' hv'' + rcases hu' with rfl | rfl + · rcases hv'' with rfl | rfl + · exact absurd rfl huv + · exact hBline _ huv + · rcases hv'' with rfl | rfl + · have h₂ := hBline _ huv.symm + exact GM11.IsLineWithEnds.symm h₂ + · exact absurd rfl huv + · intro b hb v hv' + simp only [dite_eq_left hb] + have h₁ := hsm (Eq ⟨b, hb⟩) + have h₂ := htm (Eq ⟨b, hb⟩) + rw [hE, hv'] at h₁ h₂ + have h₃ : s (Eq ⟨b, hb⟩) = v := h₁ + have h₄ : t (Eq ⟨b, hb⟩) = v := h₂ + refine ⟨hBloop _ (h₃.trans h₄.symm), ?_⟩ + rw [← h₃] + exact Or.inl (Or.inl (mem_of_line (hL₀ _)).1) + · intro b hb b' hb' hne' w hw + simp only [dite_eq_left hb, dite_eq_left hb'] at hw + have hjj : Eq ⟨b, hb⟩ ≠ Eq ⟨b', hb'⟩ := fun h ↦ hne' (congrArg Subtype.val (Eq.injective h)) + rcases hBcases _ _ hw.1 with ⟨p, hp, hwp⟩ | hwq + · rcases hBcases _ _ hw.2 with ⟨p', hp', hwp'⟩ | hwq' + · have hpp : p ≠ p' := fun h ↦ hjj (by rw [← hp, ← hp', h]) + have h₁ := (hA₂ p p' hpp w hwp hwp').1 + exact ⟨hv (π p), H.vertex_mem_of_inc (hvm (π p)), h₁.symm⟩ + · exact absurd ((hcapA _ p w hwq' hwp).1.symm.trans hp) hjj.symm + · rcases hBcases _ _ hw.2 with ⟨p', hp', hwp'⟩ | hwq' + · exact absurd ((hcapA _ p' w hwq hwp').1.symm.trans hp') hjj + · exact (hcapcap _ _ w hjj hwq hwq').elim + · intro b hb v hvV hw + simp only [dite_eq_left hb] at hw + rcases hBcases _ _ hw with ⟨p, hp, hwp⟩ | ⟨z, hz, heq⟩ + · have h₁ := hA₃ p _ hwp + have h₂ : idx v = idx (hv (π p)) := by exact_mod_cast h₁ + have h₃ := hidx hvV (H.vertex_mem_of_inc (hvm (π p))) h₂ + have h₄ := hvm (π p) + rw [hp, hE, ← h₃] at h₄ + exact h₄ + · have h₁ := eq_of_qq_eq ((hcap _).2 z hz) (hclX _).ok heq + have h₂ := (hZ _ z hz).1 + rw [h₁] at h₂ + simp only at h₂ + linarith + +/-- **A surface of large genus has a drawing of a finite graph.** Given a graph `H`, some `L` is +such +that `H` can be drawn in every model surface with at least `L` handles or at least `L` cross-caps. +-/ +theorem exists_canBeDrawn (H : Hypergraph α' β') (hH : H.IsGraph) : + ∃ L, ∀ (a b c : ℕ) [T2Space (SurfaceModel a b c)], L ≤ a ∨ L ≤ b → + CanBeDrawn (SurfaceModel a b c) H := by + obtain ⟨n, hn, π, h⟩ := exists_perm H hH + obtain ⟨L₁, hL₁, h₁⟩ := wiring_handles hn π + obtain ⟨L₂, hL₂, h₂⟩ := wiring_crosscaps hn π + refine ⟨max L₁ L₂, fun a b c _ hab ↦ ?_⟩ + rcases hab with hab | hab + · exact h a b c (-1) ((2 * L₁ : ℕ) - 1) (by push_cast; omega) + (h₁ a b c ((le_max_left _ _).trans hab)) + · exact h a b c ((2 * a : ℕ) - 1) ((2 * a + L₂ : ℕ) - 1) (by push_cast; omega) + (h₂ a b c ((le_max_right _ _).trans hab)) + +end GraphMinor.GM20.Draw diff --git a/LeanPool/GraphMinor/GM20/Draw9.lean b/LeanPool/GraphMinor/GM20/Draw9.lean new file mode 100644 index 0000000000..ce73ad019e --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Draw9.lean @@ -0,0 +1,251 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Draw8 +public import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import Mathlib.Topology.LocalAtTarget + +/-! +# Counting the cuffs of a model surface + +A model `SurfaceModel a b c` has at least `c` cuffs. The last `c` circles are not pasted to +anything, +so near them the model looks like the plane outside a disc. So their points are not interior points +of +the model, by invariance of domain. A circle of radius `3/2` around one of them consists of interior +points, and it separates this circle from the others. So the `c` circles lie in different components +of the boundary. +-/ + +@[expose] public section + +namespace GraphMinor.GM20.Draw + +open Set Topology GraphMinor.Surface Metric + +variable {a b c : ℕ} + +/-- `z` is off the closed discs whose circles are pasted. -/ +def Free (a b : ℕ) (z : ℝ × ℝ) : Prop := ∀ i < 2 * a + b, 1 < (z.1 - 3 * i) ^ 2 + z.2 ^ 2 + +/-- The points on circles that are pasted. -/ +def glued (a b : ℕ) : Set (OnePoint EuclideanPlane) := + {p | ∃ i < 2 * a + b, ∃ v : EuclideanPlane, p = v ∧ dist v (modelCentre i) = 1} + +/-- The map that sends the points of pasted circles to infinity, and fixes the other points. -/ +noncomputable def kap (a b : ℕ) (p : OnePoint EuclideanPlane) : OnePoint EuclideanPlane := + open Classical in if p ∈ glued a b then OnePoint.infty else p + +theorem kap_glue {n : ℕ} {p q : modelBase n} (h : ModelGlue a b n p q) : + kap a b p.1 = kap a b q.1 := by + have key : p.1 ∈ glued a b ∧ q.1 ∈ glued a b := by + cases h with + | handle i hi u hu p q hp hq => + have hm : ‖modelMirror u‖ = 1 := by + have h₁ : ‖modelMirror u‖ ^ 2 = 1 := by + rw [norm_sq] + have h₂ := norm_sq u + rw [hu] at h₂ + simp only [modelMirror] + simp + linarith + exact (pow_eq_one_iff_of_nonneg (norm_nonneg _) two_ne_zero).mp h₁ + exact ⟨⟨2 * i, by omega, _, hp, by simp [dist_eq_norm, hu]⟩, + ⟨2 * i + 1, by omega, _, hq, by simp [dist_eq_norm, hm]⟩⟩ + | crosscap i hi u hu p q hp hq => + exact ⟨⟨2 * a + i, by omega, _, hp, by simp [dist_eq_norm, hu]⟩, + ⟨2 * a + i, by omega, _, hq, by simp [hu]⟩⟩ + simp only [kap, ite_eq_left key.1, ite_eq_left key.2] + +/-- The map `kap` on the model. -/ +noncomputable def keyK : SurfaceModel a b c → OnePoint EuclideanPlane := + Quot.lift (fun p ↦ kap a b p.1) fun _ _ h ↦ kap_glue h + +theorem notMem_glued {z : ℝ × ℝ} (hf : Free a b z) : + ((pl z : EuclideanPlane) : OnePoint EuclideanPlane) ∉ glued a b := by + rintro ⟨i, hi, v, hv, hd⟩ + obtain rfl := OnePoint.coe_injective hv + have h₁ := hf i hi + rw [← dist_centre_sq, hd] at h₁ + norm_num at h₁ + +theorem keyK_qq {z : ℝ × ℝ} (hz : Ok a b c z) (hf : Free a b z) : + keyK (qq a b c z) = ((pl z : EuclideanPlane) : OnePoint EuclideanPlane) := by + rw [qq_of_ok hz] + exact ite_eq_right (notMem_glued hf) + +theorem eq_of_free {z z' : ℝ × ℝ} (hz : Ok a b c z) (hf : Free a b z) (hz' : Ok a b c z') + (hf' : Free a b z') (h : qq a b c z = qq a b c z') : z = z' := by + have h₁ := congrArg keyK h + rw [keyK_qq hz hf, keyK_qq hz' hf'] at h₁ + exact pl_injective (OnePoint.coe_injective h₁) + +theorem base_eq {z : ℝ × ℝ} (hz : Ok a b c z) (hf : Free a b z) + {x : modelBase (2 * a + b + c)} (h : Quot.mk _ x = qq a b c z) : + x.1 = ((pl z : EuclideanPlane) : OnePoint EuclideanPlane) := by + have h₁ := congrArg keyK h + rw [keyK_qq hz hf] at h₁ + change kap a b x.1 = _ at h₁ + unfold kap at h₁ + split_ifs at h₁ with h₂ + · exact absurd h₁ (OnePoint.infty_ne_coe _) + · exact h₁ + +/-- A complex number as a point of the plane. -/ +def cp (ζ : ℂ) : ℝ × ℝ := (ζ.re, ζ.im) + +/-- The domain of a chart. -/ +def chartDom (a b c : ℕ) (B : Set ℂ) : Set ℂ := B ∩ {ζ | Ok a b c (cp ζ)} + +/-- A chart of the model. -/ +noncomputable def chart (a b c : ℕ) (B : Set ℂ) : chartDom a b c B → SurfaceModel a b c := + fun ζ ↦ qq a b c (cp ζ.1) + +theorem continuous_cp : Continuous cp := by + unfold cp + fun_prop + +theorem cp_injective : Function.Injective cp := fun ζ ζ' h ↦ by + obtain ⟨h₁, h₂⟩ := Prod.ext_iff.mp h + exact Complex.ext h₁ h₂ + +/-- A chart off the pasted circles is an open embedding. -/ +theorem isOpenEmbedding_chart {B : Set ℂ} (hB : IsOpen B) + (hf : ∀ ζ ∈ B, Ok a b c (cp ζ) → Free a b (cp ζ)) : IsOpenEmbedding (chart a b c B) := by + refine .of_continuous_injective_isOpenMap ?_ ?_ ?_ + · exact continuousOn_qq.comp_continuous (continuous_cp.comp continuous_subtype_val) + fun ζ ↦ ζ.2.2 + · intro ζ ζ' h + exact Subtype.ext (cp_injective (eq_of_free ζ.2.2 (hf _ ζ.2.1 ζ.2.2) ζ'.2.2 + (hf _ ζ'.2.1 ζ'.2.2) h)) + · intro A hA + obtain ⟨A', hA', rfl⟩ := isOpen_induced_iff.mp hA + let ip : EuclideanPlane → ℂ := fun v ↦ (v 0 : ℂ) + (v 1 : ℂ) * Complex.I + have hip : Continuous ip := by + simp only [ip] + fun_prop + have hre : ∀ v, (ip v).re = v 0 := fun v ↦ by simp [ip] + have him : ∀ v, (ip v).im = v 1 := fun v ↦ by simp [ip] + have hpl : ∀ v, pl (cp (ip v)) = v := fun v ↦ by + ext j + fin_cases j + · simp [pl, cp, hre] + · simp [pl, cp, him] + have hip' : ∀ ζ, ip (pl (cp ζ)) = ζ := fun ζ ↦ cp_injective (by + apply pl_injective + exact hpl _) + let P : Set EuclideanPlane := ip ⁻¹' (A' ∩ B) + have hP : IsOpen P := (hA'.inter hB).preimage hip + have hO : IsOpen ((↑) '' P : Set (OnePoint EuclideanPlane)) := + OnePoint.isOpenEmbedding_coe.isOpenMap _ hP + have hset : Quot.mk (ModelGlue a b (2 * a + b + c)) ⁻¹' + (chart a b c B '' (Subtype.val ⁻¹' A')) = Subtype.val ⁻¹' ((↑) '' P) := by + ext x + constructor + · rintro ⟨ζ, hζ, heq⟩ + have h₁ := base_eq ζ.2.2 (hf _ ζ.2.1 ζ.2.2) heq.symm + refine ⟨pl (cp ζ.1), ?_, h₁.symm⟩ + change ip (pl (cp ζ.1)) ∈ A' ∩ B + rw [hip'] + exact ⟨hζ, ζ.2.1⟩ + · rintro ⟨v, hv, hxv⟩ + have hok : Ok a b c (cp (ip v)) := fun i hi ↦ by + have h₁ := x.2 i hi v hxv.symm + have h₂ := dist_centre_sq (cp (ip v)) i + rw [hpl] at h₂ + rw [← h₂] + nlinarith + refine ⟨⟨ip v, hv.2, hok⟩, hv.1, ?_⟩ + change qq a b c (cp (ip v)) = Quot.mk _ x + rw [qq_of_ok hok] + refine congrArg _ (Subtype.ext ?_) + change ((pl (cp (ip v)) : EuclideanPlane) : OnePoint EuclideanPlane) = x.1 + rw [hpl, hxv] + have h₂ : IsOpen (Quot.mk (ModelGlue a b (2 * a + b + c)) ⁻¹' + (chart a b c B '' (Subtype.val ⁻¹' A'))) := by + rw [hset] + exact hO.preimage continuous_subtype_val + exact h₂ + +/-- A point of a chart domain that is not interior in the plane is not an interior point. -/ +theorem not_interior_of_chart {X : Type*} [TopologicalSpace X] {W : Set ℂ} {j : W → X} + (hj : IsOpenEmbedding j) (w₀ : W) (hw : w₀.1 ∉ interior W) : ¬ IsInteriorPoint (j w₀) := by + rintro ⟨U, hU, hxU, ⟨f⟩⟩ + let Y : Set W := j ⁻¹' U + have h₁ : IsOpenEmbedding (U.restrictPreimage j) := hj.restrictPreimage U + let φ : Y → ℂ := fun y ↦ complexPlane.symm (f (U.restrictPreimage j y)).1 + have hφ : IsOpenEmbedding φ := + complexPlane.symm.toHomeomorph.isOpenEmbedding.comp + ((isOpen_ball.isOpenEmbedding_subtypeVal).comp (f.isOpenEmbedding.comp h₁)) + have : Nonempty Y := ⟨⟨w₀, hxU⟩⟩ + let Φ := hφ.toOpenPartialHomeomorph φ + let k : ℂ → ℂ := fun ζ ↦ (Φ.symm ζ).1.1 + have hkc : ContinuousOn k Φ.target := + (continuous_subtype_val.comp continuous_subtype_val).comp_continuousOn Φ.continuousOn_symm + have hki : InjOn k Φ.target := fun ζ hζ ζ' hζ' h ↦ + Φ.symm.injOn hζ hζ' (Subtype.ext (Subtype.ext h)) + have hopen := isOpen_image_of_injOn Φ.open_target hkc hki + have hmem : w₀.1 ∈ k '' Φ.target := by + refine ⟨φ ⟨w₀, hxU⟩, ?_, ?_⟩ + · exact Φ.map_source (mem_univ _ : _ ∈ Φ.source) + · simp only [k] + rw [show Φ.symm (φ ⟨w₀, hxU⟩) = ⟨w₀, hxU⟩ from + Φ.left_inv (mem_univ _ : _ ∈ Φ.source)] + have hsub : k '' Φ.target ⊆ W := by + rintro _ ⟨ζ, _, rfl⟩ + exact (Φ.symm ζ).1.2 + exact hw (mem_interior.mpr ⟨_, hsub, hopen, hmem⟩) + +theorem interior_of_chart {X : Type*} [TopologicalSpace X] {W : Set ℂ} {j : W → X} + (hj : IsOpenEmbedding j) (he : Nonempty (W ≃ₜ OpenUnitDisc)) (w₀ : W) : + IsInteriorPoint (j w₀) := by + obtain ⟨e⟩ := he + exact ⟨range j, hj.isOpen_range, mem_range_self _, + ⟨(hj.isEmbedding.toHomeomorph).symm.trans e⟩⟩ + +/-- An open ball of the complex plane is homeomorphic to the open unit disc. -/ +noncomputable def ballHomeo (ζ₀ : ℂ) {r : ℝ} (hr : 0 < r) : ball ζ₀ r ≃ₜ OpenUnitDisc where + toFun ζ := ⟨complexPlane (((r⁻¹ : ℝ) : ℂ) * (ζ.1 - ζ₀)), by + refine mem_ball_zero_iff.mpr ?_ + rw [LinearIsometryEquiv.norm_map, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (inv_pos.mpr hr)] + have h₁ : ‖ζ.1 - ζ₀‖ < r := by + have h₂ := ζ.2 + rwa [mem_ball, dist_eq_norm] at h₂ + rw [inv_mul_lt_iff₀ hr] + linarith⟩ + invFun v := ⟨ζ₀ + (r : ℂ) * complexPlane.symm v.1, by + have h₁ : ‖v.1‖ < 1 := mem_ball_zero_iff.mp v.2 + rw [mem_ball, dist_eq_norm, add_sub_cancel_left, norm_mul, Complex.norm_real, + Real.norm_eq_abs, abs_of_pos hr, LinearIsometryEquiv.norm_map] + nlinarith⟩ + left_inv ζ := by + apply Subtype.ext + have h₁ : (r : ℂ) ≠ 0 := by exact_mod_cast hr.ne' + simp only [LinearIsometryEquiv.symm_apply_apply] + push_cast + field_simp + ring + right_inv v := by + apply Subtype.ext + have h₁ : (r : ℂ) ≠ 0 := by exact_mod_cast hr.ne' + simp only [add_sub_cancel_left] + push_cast + rw [inv_mul_cancel_left₀ h₁] + simp + continuous_toFun := by + refine Continuous.subtype_mk (complexPlane.continuous.comp ?_) _ + fun_prop + continuous_invFun := by + refine Continuous.subtype_mk ?_ _ + have := complexPlane.symm.continuous + fun_prop + +end GraphMinor.GM20.Draw diff --git a/LeanPool/GraphMinor/GM20/Main.lean b/LeanPool/GraphMinor/GM20/Main.lean new file mode 100644 index 0000000000..42e36c68b9 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Main.lean @@ -0,0 +1,41 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section10d +public import LeanPool.GraphMinor.GM20.Section10l +public import LeanPool.GraphMinor.GM20.Section8b +public import LeanPool.GraphMinor.Surface.Classification +public import LeanPool.GraphMinor.Surface.PushOff + +import LeanPool.GraphMinor.GM17.Bridge + +import LeanPool.GraphMinor.GM19.Main + +/-! +# Graph Minors XX: the graph minor theorem from the cited results + +`GM20.graph_minor_theorem_of_cited` derives the graph minor theorem from the cited results. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Graph + +/-- The graph minor theorem (Graph Minors XX, Section 10, page 355: "As a corollary, we deduce the +following form of Wagner’s conjecture for directed graphs (which immediately implies the standard +form of the conjecture for undirected graphs).") using the proved XVII and XIX results. -/ +theorem graph_minor_theorem_of_cited + {α β : Type*} (G : ℕ → Graph α β) (hV : ∀ n, V(G n).Finite) (hE : ∀ n, E(G n).Finite) : + ∃ i j, i < j ∧ IsIsoMinor (G i) (G j) := + wagner_conjecture_undirected_proof G hV hE + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Retag.lean b/LeanPool/GraphMinor/GM20/Retag.lean new file mode 100644 index 0000000000..ce61ba7272 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Retag.lean @@ -0,0 +1,311 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section4b + +/-! +# Moving patchworks to a larger edge type + +The paper gets (4.13) from `w` uses of (4.12) (Graph Minors XX, page 336). The patchworks in between +have some of the new edges `f` and some of the pieces `A_f`. The statement does not say that the +new edges are not edges of the pieces, so in a fixed edge type `β` a new edge `f` may have the same +name as an edge of another piece `A_{f'}`. We avoid this by moving to the edge type `ℕ × β`: the +edge +`e` becomes `(t e, e)` for a tag `t e`. The edges of `G₁` get the tag `0` and the new edges get the +tag `1`. + +A patchwork and its tagged copy are each simulated in the other (`simulated_retag` and +`simulated_of_retag`), so tagging keeps sets well-behaved (`WellBehaved.retag_zero`), and a set +whose tagged copies lie in a well-behaved set is well-behaved (`wellBehaved_of_retag`). The rest of +the file shows that tagging commutes with the operations of (4.13): subhypergraphs, complements, +rooted locations, deletion of edges and restriction. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ### Tagged hypergraphs and patchworks -/ + +/-- The hypergraph `G` with each edge `e` renamed `(t e, e)`. -/ +def retagHyper (t : β → ℕ) (G : Hypergraph α β) : Hypergraph α (ℕ × β) where + vertexSet := G.vertexSet + edgeSet := (fun e ↦ (t e, e)) '' G.edgeSet + Inc p v := p.1 = t p.2 ∧ G.Inc p.2 v + vertex_mem_of_inc _ _ h := G.vertex_mem_of_inc h.2 + edge_mem_of_inc p _ h := ⟨p.2, G.edge_mem_of_inc h.2, Prod.ext h.1.symm rfl⟩ + vertexSet_finite := G.vertexSet_finite + edgeSet_finite := G.edgeSet_finite.image _ + +/-- The rooted hypergraph `G` with each edge `e` renamed `(t e, e)`. -/ +def retagRooted (t : β → ℕ) (G : RootedHypergraph α β) : RootedHypergraph α (ℕ × β) where + toHypergraph := retagHyper t G.toHypergraph + roots := G.roots + roots_nodup := G.roots_nodup + roots_subset := G.roots_subset + +theorem mem_retagHyper_edgeSet {t : β → ℕ} {G : Hypergraph α β} {p : ℕ × β} : + p ∈ (retagHyper t G).edgeSet ↔ p.1 = t p.2 ∧ p.2 ∈ G.edgeSet := by + constructor + · rintro ⟨e, he, rfl⟩ + exact ⟨rfl, he⟩ + · rintro ⟨h, he⟩ + exact ⟨p.2, he, Prod.ext h.symm rfl⟩ + +theorem retagHyper_ends (t : β → ℕ) (G : Hypergraph α β) (e : β) : + (retagHyper t G).ends (t e, e) = G.ends e := by + ext v + exact ⟨fun h ↦ h.2, fun h ↦ ⟨rfl, h⟩⟩ + +/-- The patchwork `P` with each edge `e` renamed `(t e, e)`. -/ +def retagPatchwork {Ω : Type*} (t : β → ℕ) (P : Patchwork Ω α β) : Patchwork Ω α (ℕ × β) where + G := retagRooted t P.G + dom := (fun e ↦ (t e, e)) '' P.dom + μ p := P.μ p.2 + Δ p := P.Δ p.2 + φ p := P.φ p.2 + dom_subset := image_mono P.dom_subset + μ_nodup := by + rintro _ ⟨e, he, rfl⟩ + exact P.μ_nodup e he + μ_set := by + rintro _ ⟨e, he, rfl⟩ + rw [P.μ_set e he] + exact (retagHyper_ends t P.G.toHypergraph e).symm + Δ_verts := by + rintro _ ⟨e, he, rfl⟩ + rw [P.Δ_verts e he] + exact (retagHyper_ends t P.G.toHypergraph e).symm + Δ_free := by + rintro _ ⟨e, he, rfl⟩ hnd + exact P.Δ_free e he fun hd ↦ hnd ⟨e, hd, rfl⟩ + +theorem IsActive.retag {Ω : Type*} {P : Patchwork Ω α β} (h : IsActive P) (t : β → ℕ) : + IsActive (retagPatchwork t P) := by + intro v hv + obtain ⟨e, he, hinc⟩ := h v hv + exact ⟨(t e, e), ⟨e, he, rfl⟩, rfl, hinc⟩ + +/-! ### Renaming edges keeps simulation -/ + +/-- If `P'` is `P` with the edges renamed by `ηe`, then `(v ↦ {v}, ηe)` is a realizable expansion of +`P` in `P'`. The proof is that of `GM04.IsRealizableExpansion.id`. -/ +theorem isRealizableExpansion_of_rename {Ω : Type*} [Preorder Ω] {β' : Type*} + {P : Patchwork Ω α β} {P' : Patchwork Ω α β'} (ηe : β → β') + (hV : P'.G.vertexSet = P.G.vertexSet) (hroots : P'.G.roots = P.G.roots) + (hE : ηe '' P.G.edgeSet = P'.G.edgeSet) (hinj : InjOn ηe P.G.edgeSet) + (hinc : ∀ e ∈ P.G.edgeSet, ∀ v, P'.G.Inc (ηe e) v ↔ P.G.Inc e v) + (hdom : ∀ e ∈ P.G.edgeSet, e ∈ P.dom ↔ ηe e ∈ P'.dom) + (hμ : ∀ e ∈ P.dom, P'.μ (ηe e) = P.μ e) (hΔ : ∀ e ∈ P.dom, P'.Δ (ηe e) = P.Δ e) + (hφ : ∀ e ∈ P.G.edgeSet, P'.φ (ηe e) = P.φ e) : + IsRealizableExpansion P P' (fun v ↦ {v}) ηe := by + have hexp : IsExpansion P P' (fun v ↦ {v}) ηe := + { vertex_nonempty := fun v _ ↦ Set.singleton_nonempty v + vertex_subset := fun v hv w hw ↦ by + obtain rfl : w = v := hw + rw [hV] + exact hv + edge_mem := fun e he ↦ hE ▸ mem_image_of_mem ηe he + vertex_disjoint := fun _ _ _ _ hne ↦ Set.disjoint_singleton.mpr hne + edge_injOn := hinj + mem_dom_iff := hdom + ends_nonempty := fun e he _ v hv ↦ ⟨v, rfl, (hinc e he v).mpr hv⟩ + μ_length := fun e he ↦ by rw [hμ e he] + μ_mem := fun e he i hi hi' ↦ List.getElem_of_eq (hμ e he) hi' + roots_length := by rw [hroots] + roots_mem := fun i hi hi' ↦ List.getElem_of_eq hroots hi' + maps_Δ := fun e he δ hδ ↦ by + have heE : e ∈ P.G.edgeSet := P.dom_subset he + have hverts : δ.verts ⊆ {x | x ∈ P.μ e} := by + rw [((P.Δ e).verts_eq δ hδ).trans (P.Δ_verts e heE), P.μ_set e he] + rw [hμ e he, hΔ e he, marchMapSubgraph_id hverts] + exact hδ + φ_le := fun e he ↦ by rw [hφ e he] } + have hnoE : ∀ e, e ∉ (P'.deleteEdges (ηe '' P.G.edgeSet)).G.edgeSet := by + rintro e ⟨he, hnot⟩ + rw [← hE] at he + exact hnot he + refine ⟨hexp, emptySubgraph P.G.vertexSet, ?_, fun v hv ↦ ?_⟩ + · refine ⟨fun _ ↦ emptySubgraph ∅, fun e he ↦ absurd he (hnoE e), ?_⟩ + ext u w + · simp only [emptySubgraph_verts, realizationOf, SimpleGraph.Subgraph.verts_sup, + SimpleGraph.Subgraph.verts_iSup, mem_union, mem_iUnion, exists_prop] + change u ∈ P.G.vertexSet ↔ u ∈ P'.G.vertexSet ∨ _ + rw [hV] + simp + · simp only [not_emptySubgraph_adj, realizationOf_adj, false_iff, not_exists] + rintro e ⟨he, _⟩ + exact hnoE e he + · let x : (emptySubgraph P.G.vertexSet).verts := ⟨v, hv⟩ + refine ⟨component (emptySubgraph P.G.vertexSet) x, ⟨x, rfl⟩, ?_⟩ + ext w + simp only [component_verts, mem_componentVerts_iff, emptySubgraph_verts, + Set.mem_singleton_iff] + refine ⟨?_, fun hEq ↦ hEq ▸ ⟨hv, SimpleGraph.Reachable.refl x⟩⟩ + rintro ⟨hw, hr⟩ + suffices ∀ y : (emptySubgraph P.G.vertexSet).verts, + (emptySubgraph P.G.vertexSet).coe.Reachable x y → y.1 = x.1 from + this ⟨w, hw⟩ hr + intro y hy + rw [SimpleGraph.reachable_iff_reflTransGen] at hy + induction hy with + | refl => rfl + | @tail _ _ _ hab => exact False.elim hab + +/-- A patchwork is simulated in its tagged copy. -/ +theorem simulated_retag {Ω : Type*} [Preorder Ω] (t : β → ℕ) (P : Patchwork Ω α β) : + Simulated P (retagPatchwork t P) := + ⟨_, _, isRealizableExpansion_of_rename (P' := retagPatchwork t P) (fun e ↦ (t e, e)) rfl rfl rfl + (fun _ _ _ _ h ↦ congrArg Prod.snd h) (fun _ _ _ ↦ ⟨fun h ↦ h.2, fun h ↦ ⟨rfl, h⟩⟩) + (fun e _ ↦ ⟨fun h ↦ ⟨e, h, rfl⟩, fun ⟨e', h, hEq⟩ ↦ by + obtain rfl : e' = e := congrArg Prod.snd hEq + exact h⟩) + (fun _ _ ↦ rfl) (fun _ _ ↦ rfl) (fun _ _ ↦ rfl)⟩ + +/-- A patchwork `Q` whose edges are tagged `(t e, e)` is simulated in any patchwork `P` with the +same data under `e ↦ (t e, e)`. -/ +theorem simulated_of_retag' {Ω : Type*} [Preorder Ω] {t : β → ℕ} {Q : Patchwork Ω α (ℕ × β)} + {P : Patchwork Ω α β} (hG : Q.G = retagRooted t P.G) + (hdom : Q.dom = (fun e ↦ (t e, e)) '' P.dom) + (hμ : ∀ e ∈ P.dom, Q.μ (t e, e) = P.μ e) (hΔ : ∀ e ∈ P.dom, Q.Δ (t e, e) = P.Δ e) + (hφ : ∀ e ∈ P.G.edgeSet, Q.φ (t e, e) = P.φ e) : Simulated Q P := by + have hE : ∀ p ∈ Q.G.edgeSet, p = (t p.2, p.2) := fun p hp ↦ by + rw [hG] at hp + obtain ⟨e, -, rfl⟩ := hp + rfl + have hE' : ∀ p ∈ Q.G.edgeSet, p.2 ∈ P.G.edgeSet := fun p hp ↦ by + rw [hG] at hp + obtain ⟨e, he, rfl⟩ := hp + exact he + refine ⟨_, _, isRealizableExpansion_of_rename (P := Q) (P' := P) Prod.snd ?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_ + ?_⟩ + · rw [hG] + rfl + · rw [hG] + rfl + · rw [hG] + ext e + exact ⟨fun ⟨_, ⟨e', he', hEq⟩, h⟩ ↦ h ▸ hEq ▸ he', fun he ↦ ⟨(t e, e), ⟨e, he, rfl⟩, rfl⟩⟩ + · intro p hp q hq h + rw [hE p hp, hE q hq, h] + · intro p hp v + have h1 : p.1 = t p.2 := congrArg Prod.fst (hE p hp) + rw [hG] + exact ⟨fun h ↦ ⟨h1, h⟩, fun h ↦ h.2⟩ + · intro p hp + rw [hdom] + constructor + · rintro ⟨e, he, rfl⟩ + exact he + · intro h + exact ⟨p.2, h, (hE p hp).symm⟩ + · intro p hp + rw [hdom] at hp + obtain ⟨e, he, rfl⟩ := hp + exact (hμ e he).symm + · intro p hp + rw [hdom] at hp + obtain ⟨e, he, rfl⟩ := hp + exact (hΔ e he).symm + · intro p hp + rw [hE p hp] + exact (hφ p.2 (hE' p hp)).symm + +/-- The tagged copy of a patchwork is simulated in it. -/ +theorem simulated_of_retag {Ω : Type*} [Preorder Ω] (t : β → ℕ) (P : Patchwork Ω α β) : + Simulated (retagPatchwork t P) P := + simulated_of_retag' rfl rfl (fun _ _ ↦ rfl) (fun _ _ ↦ rfl) (fun _ _ ↦ rfl) + +/-- A patchwork `Q` whose edges are tagged `(t e, e)` simulates any patchwork `P` with the same data +under `e ↦ (t e, e)`. -/ +theorem simulated_retag' {Ω : Type*} [Preorder Ω] {t : β → ℕ} {Q : Patchwork Ω α (ℕ × β)} + {P : Patchwork Ω α β} (hG : Q.G = retagRooted t P.G) + (hdom : Q.dom = (fun e ↦ (t e, e)) '' P.dom) + (hμ : ∀ e ∈ P.dom, Q.μ (t e, e) = P.μ e) (hΔ : ∀ e ∈ P.dom, Q.Δ (t e, e) = P.Δ e) + (hφ : ∀ e ∈ P.G.edgeSet, Q.φ (t e, e) = P.φ e) : Simulated P Q := by + refine ⟨_, _, isRealizableExpansion_of_rename (P := P) (P' := Q) (fun e ↦ (t e, e)) ?_ ?_ ?_ + (fun _ _ _ _ h ↦ congrArg Prod.snd h) ?_ ?_ hμ hΔ hφ⟩ + · rw [hG] + rfl + · rw [hG] + rfl + · rw [hG] + rfl + · intro e _ v + rw [hG] + exact ⟨fun h ↦ h.2, fun h ↦ ⟨rfl, h⟩⟩ + · intro e _ + rw [hdom] + exact ⟨fun h ↦ ⟨e, h, rfl⟩, fun ⟨e', h, hEq⟩ ↦ by + obtain rfl : e' = e := congrArg Prod.snd hEq + exact h⟩ + +theorem IsCompletionOf.retag {Ω Ω' : Type*} {P : Patchwork Ω α β} {Q : Patchwork Ω' α β} + (h : IsCompletionOf P Q) (t : β → ℕ) : + IsCompletionOf (retagPatchwork t P) (retagPatchwork t Q) where + G_eq := by + change retagRooted t Q.G = retagRooted t P.G + rw [h.G_eq] + dom_eq := by + change (fun e ↦ (t e, e)) '' Q.dom = (fun e ↦ (t e, e)) '' P.dom + rw [h.dom_eq] + μ_eq := by + rintro _ ⟨e, he, rfl⟩ + exact h.μ_eq he + Δ_eq := by + rintro _ ⟨e, he, rfl⟩ + exact h.Δ_eq he + +/-! ### Well-behaved sets and tags -/ + +/-- Tagging every edge with `0` keeps a set well-behaved. -/ +theorem WellBehaved.retag_zero {𝓕 : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕) : + WellBehaved (retagPatchwork (fun _ ↦ 0) '' 𝓕) := by + intro Ω _ hΩ Q hQ + choose P hP hc using hQ + choose P₀ hP₀ hPeq using hP + let R : ℕ → Patchwork Ω α β := fun i ↦ (P₀ i).relabel fun e ↦ (Q i).φ (0, e) + obtain ⟨i, j, hij, hsim⟩ := h Ω hΩ R fun i ↦ ⟨P₀ i, hP₀ i, isCompletionOf_relabel _ _⟩ + have hc' : ∀ i, IsCompletionOf (retagPatchwork (fun _ ↦ 0) (P₀ i)) (Q i) := fun i ↦ + (hPeq i).symm ▸ hc i + have h₁ : ∀ i, Simulated (Q i) (R i) := fun i ↦ + simulated_of_retag' (t := fun _ ↦ 0) (hc' i).G_eq (hc' i).dom_eq + (fun e he ↦ (hc' i).μ_eq ⟨e, he, rfl⟩) (fun e he ↦ (hc' i).Δ_eq ⟨e, + (P₀ i).dom_subset he, rfl⟩) + (fun _ _ ↦ rfl) + have h₂ : ∀ i, Simulated (R i) (Q i) := fun i ↦ + simulated_retag' (t := fun _ ↦ 0) (hc' i).G_eq (hc' i).dom_eq + (fun e he ↦ (hc' i).μ_eq ⟨e, he, rfl⟩) (fun e he ↦ (hc' i).Δ_eq ⟨e, + (P₀ i).dom_subset he, rfl⟩) + (fun _ _ ↦ rfl) + exact ⟨i, j, hij, ((h₁ i).trans hsim).trans (h₂ j)⟩ + +/-- If every member of `𝓕` has a tagged copy among the completions of a well-behaved set, then `𝓕` +is +well-behaved. -/ +theorem wellBehaved_of_retag {𝓕 : Set (UnlabeledPatchwork α β)} + {𝓢 : Set (UnlabeledPatchwork α (ℕ × β))} (h : WellBehaved 𝓢) + (hF : ∀ P ∈ 𝓕, ∃ t : β → ℕ, retagPatchwork t P ∈ completions Unit 𝓢) : WellBehaved 𝓕 := by + intro Ω _ hΩ Q hQ + choose P hP hc using hQ + choose t ht using fun i ↦ hF (P i) (hP i) + obtain ⟨i, j, hij, hsim⟩ := h Ω hΩ (fun i ↦ retagPatchwork (t i) (Q i)) fun i ↦ by + obtain ⟨S, hS, hcS⟩ := ht i + exact ⟨S, hS, hcS.trans ((hc i).retag (t i))⟩ + exact ⟨i, j, hij, ((simulated_retag (t i) (Q i)).trans hsim).trans + (simulated_of_retag (t j) (Q j))⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section10a.lean b/LeanPool/GraphMinor/GM20/Section10a.lean new file mode 100644 index 0000000000..21d32017df --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section10a.lean @@ -0,0 +1,220 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section7b + +/-! +# Graph Minors XX, Section 10, (10.1) + +For a free patchwork and a subgraph `C` of the 1-skeleton there is a realization that has exactly +the +connections of `C`. So every grouping given by the connections of such a `C` is feasible. This is +what (10.2) uses. + +The second part of the file proves that disjoint paths between the two sides of a border cell give +the pairing that the definition of hulled patchworks asks for. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} {Ω : Type*} + +/-- The grouping on `U` in which two distinct vertices are adjacent if `C` connects them. -/ +def reachGrouping (C : SimpleGraph α) (U : Set α) : (⊤ : SimpleGraph α).Subgraph where + verts := U + Adj x y := x ∈ U ∧ y ∈ U ∧ x ≠ y ∧ C.Reachable x y + adj_sub h := h.2.2.1 + edge_vert h := h.1 + symm := ⟨fun _ _ h ↦ ⟨h.2.1, h.1, h.2.2.1.symm, h.2.2.2.symm⟩⟩ + +theorem isGrouping_reachGrouping (C : SimpleGraph α) (U : Set α) : + IsGrouping U (reachGrouping C U) := + isGrouping_iff.mpr ⟨le_rfl, fun _ _ _ hac hab hbc ↦ + ⟨hab.1, hbc.2.1, hac, hab.2.2.2.trans hbc.2.2.2⟩⟩ + +theorem reachable_of_sameComponent {H : (⊤ : SimpleGraph α).Subgraph} {C : SimpleGraph α} + (h : ∀ a b, H.Adj a b → C.Reachable a b) {x y : α} (hxy : sameComponent H x y) : + C.Reachable x y := by + obtain ⟨hp, hq, hr⟩ := sameComponent_iff.mp hxy + rw [SimpleGraph.reachable_iff_reflTransGen] at hr + suffices ∀ z : H.verts, Relation.ReflTransGen H.coe.Adj ⟨x, hp⟩ z → C.Reachable x z.1 from + this ⟨y, hq⟩ hr + intro z hz + induction hz with + | refl => exact SimpleGraph.Reachable.refl _ + | @tail a b _ hab ih => exact ih.trans (h a.1 b.1 hab) + +/-- Graph Minors XX, (10.1) (page 353): "Let* $P = (G, \mu, \Delta)$ *be a free patchwork, and let* +$C$ *be a subgraph of* $sk(G)$. +*Then there is a realization* $H$ *of* $P$ *such that for all* $x, y \in V(C)$, $x$ *and* +$y$ *are connected in* $C$ *if and only if they are connected in* $H$." A vertex of `G` outside +`V(C)` is +here a vertex of `C` with no edges, so the statement covers all of `V(G)`. -/ +theorem theorem_10_1_proof {P : Patchwork Ω α β} (hfree : IsFree P) {C : SimpleGraph α} + (hC : C ≤ P.G.toHypergraph.skeleton) : + ∃ H, P.IsRealization H ∧ ∀ x ∈ P.G.vertexSet, ∀ y ∈ P.G.vertexSet, + sameComponent H x y ↔ C.Reachable x y := by + let δ : β → (⊤ : SimpleGraph α).Subgraph := fun e ↦ reachGrouping C (P.G.ends e) + have hδ : ∀ e ∈ P.G.edgeSet, δ e ∈ P.Δ e := fun e he ↦ by + refine hfree e he _ ?_ ?_ + · rw [P.Δ_verts e he] + exact isGrouping_reachGrouping C _ + · rw [P.Δ_verts e he] + rfl + have hreal : P.IsRealization (realizationOf P.G.toHypergraph δ) := ⟨δ, hδ, rfl⟩ + refine ⟨_, hreal, fun x hx y hy ↦ ⟨reachable_of_sameComponent fun a b hab ↦ ?_, fun h ↦ ?_⟩⟩ + · obtain ⟨e, -, h₁⟩ := realizationOf_adj.mp hab + exact h₁.2.2.2 + · have hv : (realizationOf P.G.toHypergraph δ).verts = P.G.vertexSet := hreal.verts_eq + rw [SimpleGraph.reachable_iff_reflTransGen] at h + induction h with + | refl => exact sameComponent_iff.mpr ⟨hv ▸ hx, hv ▸ hx, SimpleGraph.Reachable.refl _⟩ + | @tail a b _ hab ih => + obtain ⟨hne, e, h₁, h₂⟩ := hC hab + have ih' := ih + refine (ih' (P.G.vertex_mem_of_inc h₁)).trans (sameComponent_of_adj ?_) + exact realizationOf_adj.mpr ⟨e, P.G.edge_mem_of_inc h₁, h₁, h₂, hne, hab.reachable⟩ + +/-- A grouping given by the connections of a subgraph of `sk(A⁻)` is feasible in `P|A`. -/ +theorem feasible_reachGrouping {P : Patchwork Ω α β} (hfree : IsFree P) {A : RootedHypergraph α β} + (hA : A.toHypergraph ≤ P.G.toHypergraph) {C : SimpleGraph α} + (hC : C ≤ A.toHypergraph.skeleton) : + IsFeasibleGrouping (P.restrict A) (reachGrouping C A.rootSet) := by + obtain ⟨H, hH, hc⟩ := theorem_10_1_proof (isFree_restrict hfree hA) hC + refine ⟨isGrouping_reachGrouping C _, rfl, H, hH, fun x hx y hy hne ↦ ?_⟩ + rw [← sameComponent_iff_connectedIn, hc x (A.roots_subset x hx) y (A.roots_subset y hy)] + exact ⟨fun h ↦ ⟨hx, hy, hne, h⟩, fun h ↦ h.2.2.2⟩ + +/-! ### Disjoint paths give a pairing -/ + +section Paths + +variable {K : SimpleGraph α} {X Y : Set α} {ι : Type*} + +/-- The union of a family of paths, as a graph on `α`. -/ +def unionPaths (L : ι → PathFromTo K X Y) : SimpleGraph α where + Adj x y := ∃ i, s(x, y) ∈ (L i).walk.edges + symm := ⟨fun x y ⟨i, h⟩ ↦ ⟨i, by rwa [Sym2.eq_swap]⟩⟩ + loopless := ⟨fun x ⟨i, h⟩ ↦ (L i).walk.adj_of_mem_edges h |>.ne rfl⟩ + +variable {L : ι → PathFromTo K X Y} + +theorem unionPaths_le : unionPaths L ≤ K := fun _ _ ⟨i, h⟩ ↦ (L i).walk.adj_of_mem_edges h + +/-- Two vertices of one path are connected in the union. -/ +theorem reachable_of_mem_support (i : ι) {x y : α} (hx : x ∈ (L i).walk.support) + (hy : y ∈ (L i).walk.support) : (unionPaths L).Reachable x y := by + classical + have hfirst : ∀ z ∈ (L i).walk.support, (unionPaths L).Reachable (L i).first z := by + intro z hz + have hmem : ∀ e ∈ ((L i).walk.takeUntil z hz).edges, e ∈ (unionPaths L).edgeSet := by + intro e he + induction e using Sym2.ind with + | _ a b => + exact ⟨i, (L i).walk.edges_takeUntil_subset_edges hz he⟩ + exact ⟨((L i).walk.takeUntil z hz).transfer _ hmem⟩ + exact (hfirst x hx).symm.trans (hfirst y hy) + +/-- Vertices connected in the union of disjoint paths are on one path. -/ +theorem eq_or_mem_support_of_reachable + (hL : Pairwise fun i j ↦ Disjoint {z | z ∈ (L i).walk.support} {z | z ∈ (L j).walk.support}) + {x y : α} (h : (unionPaths L).Reachable x y) : + x = y ∨ ∃ i, x ∈ (L i).walk.support ∧ y ∈ (L i).walk.support := by + rw [SimpleGraph.reachable_iff_reflTransGen] at h + induction h with + | refl => exact Or.inl rfl + | @tail a b _ hab ih => + obtain ⟨j, hj⟩ := hab + have ha := (L j).walk.fst_mem_support_of_mem_edges hj + have hb := (L j).walk.snd_mem_support_of_mem_edges hj + rcases ih with rfl | ⟨i, hx, hai⟩ + · exact Or.inr ⟨j, ha, hb⟩ + · have hij : i = j := by + by_contra hne + exact Set.disjoint_left.mp (hL hne) hai ha + subst hij + exact Or.inr ⟨i, hx, hb⟩ + +theorem first_mem_support (i : ι) : (L i).first ∈ (L i).walk.support := + (L i).walk.start_mem_support + +theorem last_mem_support (i : ι) : (L i).last ∈ (L i).walk.support := + (L i).walk.end_mem_support + +/-- With as many disjoint paths as `X` has members, every member of `X` starts a path. -/ +theorem exists_first_eq + (hL : Pairwise fun i j ↦ Disjoint {z | z ∈ (L i).walk.support} {z | z ∈ (L j).walk.support}) + (hX : X.Finite) (hcard : X.ncard ≤ Nat.card ι) {x : α} (hx : x ∈ X) : + ∃ i, (L i).first = x := by + have hinj : Function.Injective fun i ↦ (L i).first := fun i j h ↦ by + by_contra hne + refine Set.disjoint_left.mp (hL hne) (first_mem_support i) ?_ + change (L i).first ∈ (L j).walk.support + rw [show (L i).first = (L j).first from h] + exact first_mem_support j + have hsub : range (fun i ↦ (L i).first) ⊆ X := by + rintro _ ⟨i, rfl⟩ + exact (L i).first_mem + have hc : (range fun i ↦ (L i).first).ncard = Nat.card ι := by + rw [← image_univ, Set.ncard_image_of_injective _ hinj, Set.ncard_univ] + have heq := Set.eq_of_subset_of_ncard_le hsub (by rw [hc]; exact hcard) hX + rw [← heq] at hx + exact hx + +theorem exists_last_eq + (hL : Pairwise fun i j ↦ Disjoint {z | z ∈ (L i).walk.support} {z | z ∈ (L j).walk.support}) + (hY : Y.Finite) (hcard : Y.ncard ≤ Nat.card ι) {x : α} (hx : x ∈ Y) : + ∃ i, (L i).last = x := by + have hinj : Function.Injective fun i ↦ (L i).last := fun i j h ↦ by + by_contra hne + refine Set.disjoint_left.mp (hL hne) (last_mem_support i) ?_ + change (L i).last ∈ (L j).walk.support + rw [show (L i).last = (L j).last from h] + exact last_mem_support j + have hsub : range (fun i ↦ (L i).last) ⊆ Y := by + rintro _ ⟨i, rfl⟩ + exact (L i).last_mem + have hc : (range fun i ↦ (L i).last).ncard = Nat.card ι := by + rw [← image_univ, Set.ncard_image_of_injective _ hinj, Set.ncard_univ] + have heq := Set.eq_of_subset_of_ncard_le hsub (by rw [hc]; exact hcard) hY + rw [← heq] at hx + exact hx + +/-- A vertex of `X` on a path is the first vertex of that path, when every member of `X` starts a +path. -/ +theorem eq_first_of_mem + (hL : Pairwise fun i j ↦ Disjoint {z | z ∈ (L i).walk.support} {z | z ∈ (L j).walk.support}) + (hX : X.Finite) (hcard : X.ncard ≤ Nat.card ι) {x : α} (hx : x ∈ X) {i : ι} + (hi : x ∈ (L i).walk.support) : x = (L i).first := by + obtain ⟨j, rfl⟩ := exists_first_eq hL hX hcard hx + have hij : j = i := by + by_contra hne + exact Set.disjoint_left.mp (hL hne) (first_mem_support j) hi + rw [hij] + +theorem eq_last_of_mem + (hL : Pairwise fun i j ↦ Disjoint {z | z ∈ (L i).walk.support} {z | z ∈ (L j).walk.support}) + (hY : Y.Finite) (hcard : Y.ncard ≤ Nat.card ι) {x : α} (hx : x ∈ Y) {i : ι} + (hi : x ∈ (L i).walk.support) : x = (L i).last := by + obtain ⟨j, rfl⟩ := exists_last_eq hL hY hcard hx + have hij : j = i := by + by_contra hne + exact Set.disjoint_left.mp (hL hne) (last_mem_support j) hi + rw [hij] + +end Paths + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section10b.lean b/LeanPool/GraphMinor/GM20/Section10b.lean new file mode 100644 index 0000000000..250994230a --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section10b.lean @@ -0,0 +1,406 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section10a + +/-! +# Graph Minors XX, Section 10, (10.2) + +A shelled place has a hulled heart. Inside the heart every patch of an internal cell is free, by +(10.1), since each grouping there comes from connections of `sk(A⁻)`. For a border cell the disjoint +paths of the definition of shelled give the pairing `M_c`, and (10.1) makes it feasible. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} {Ω : Type*} + +section Pairing + +variable {K : SimpleGraph α} {X Y : Set α} {ι : Type*} [Finite ι] {L : ι → PathFromTo K X Y} + +omit [Finite ι] in +/-- Facts about the grouping given by `|X| = |Y| = |ι|` disjoint paths from `X` to `Y`. -/ +theorem reachGrouping_paths + (hL : Pairwise fun i j ↦ Disjoint {z | z ∈ (L i).walk.support} {z | z ∈ (L j).walk.support}) + (hX : X.Finite) (hY : Y.Finite) (hcX : X.ncard ≤ Nat.card ι) (hcY : Y.ncard ≤ Nat.card ι) : + (∀ a b c, (reachGrouping (unionPaths L) (X ∪ Y)).Adj a b → + (reachGrouping (unionPaths L) (X ∪ Y)).Adj a c → b = c) ∧ + ∀ D, IsComponent (reachGrouping (unionPaths L) (X ∪ Y)) D → + (D.verts ∩ X).ncard = 1 ∧ (D.verts ∩ Y).ncard = 1 := by + have hends : ∀ {z i}, z ∈ X ∪ Y → z ∈ (L i).walk.support → z = (L i).first ∨ z = (L i).last := by + rintro z i (hz | hz) hi + · exact Or.inl (eq_first_of_mem hL hX hcX hz hi) + · exact Or.inr (eq_last_of_mem hL hY hcY hz hi) + have hsame : ∀ {a b}, (reachGrouping (unionPaths L) (X ∪ Y)).Adj a b → + ∃ i, a ∈ (L i).walk.support ∧ b ∈ (L i).walk.support := fun {a b} h ↦ + (eq_or_mem_support_of_reachable hL h.2.2.2).resolve_left h.2.2.1 + have huniq : ∀ {z i j}, z ∈ (L i).walk.support → z ∈ (L j).walk.support → i = j := by + intro z i j hi hj + by_contra hne + exact Set.disjoint_left.mp (hL hne) hi hj + constructor + · intro a b c hab hac + obtain ⟨i, hai, hbi⟩ := hsame hab + obtain ⟨j, haj, hcj⟩ := hsame hac + obtain rfl := huniq hai haj + have hne₁ := hab.2.2.1 + have hne₂ := hac.2.2.1 + rcases hends hab.1 hai with h₁ | h₁ <;> rcases hends hab.2.1 hbi with h₂ | h₂ <;> + rcases hends hac.2.1 hcj with h₃ | h₃ + all_goals first + | exact h₂.trans h₃.symm + | exact absurd (h₁.trans h₂.symm) hne₁ + | exact absurd (h₁.trans h₃.symm) hne₂ + · rintro D ⟨x, rfl⟩ + have hx : x.1 ∈ X ∪ Y := x.2 + have hxsupp : ∃ i, x.1 ∈ (L i).walk.support := by + rcases hx with h | h + · obtain ⟨i, hi⟩ := exists_first_eq hL hX hcX h + exact ⟨i, hi ▸ first_mem_support i⟩ + · obtain ⟨i, hi⟩ := exists_last_eq hL hY hcY h + exact ⟨i, hi ▸ last_mem_support i⟩ + obtain ⟨i, hi⟩ := hxsupp + have hmem : ∀ {y}, y ∈ (component (reachGrouping (unionPaths L) (X ∪ Y)) x).verts → + y ∈ (L i).walk.support := by + intro y hy + have hsc : sameComponent (reachGrouping (unionPaths L) (X ∪ Y)) x.1 y := by + rw [sameComponent_iff_connectedIn] + exact ⟨_, ⟨x, rfl⟩, self_mem_componentVerts _ x, hy⟩ + rcases eq_or_mem_support_of_reachable hL + (reachable_of_sameComponent (H := reachGrouping (unionPaths L) (X ∪ Y)) + (fun a b h ↦ h.2.2.2) hsc) with h | ⟨j, h₁, h₂⟩ + · exact h ▸ hi + · obtain rfl := huniq hi h₁ + exact h₂ + have hin : ∀ {y}, y ∈ X ∪ Y → y ∈ (L i).walk.support → + y ∈ (component (reachGrouping (unionPaths L) (X ∪ Y)) x).verts := by + intro y hy hyi + have hsc : sameComponent (reachGrouping (unionPaths L) (X ∪ Y)) x.1 y := by + by_cases hxy : x.1 = y + · rw [← hxy, sameComponent_iff] + exact ⟨x.2, x.2, SimpleGraph.Reachable.refl _⟩ + · exact sameComponent_of_adj ⟨hx, hy, hxy, reachable_of_mem_support i hi hyi⟩ + obtain ⟨hp, hq, hr⟩ := sameComponent_iff.mp hsc + exact ⟨hq, hr⟩ + constructor + · rw [show _ ∩ X = {(L i).first} from ?_, Set.ncard_singleton] + ext y + refine ⟨fun h ↦ eq_first_of_mem hL hX hcX h.2 (hmem h.1), ?_⟩ + rintro rfl + exact ⟨hin (Or.inl (L i).first_mem) (first_mem_support i), (L i).first_mem⟩ + · rw [show _ ∩ Y = {(L i).last} from ?_, Set.ncard_singleton] + ext y + refine ⟨fun h ↦ eq_last_of_mem hL hY hcY h.2 (hmem h.1), ?_⟩ + rintro rfl + exact ⟨hin (Or.inr (L i).last_mem) (last_mem_support i), (L i).last_mem⟩ + +end Pairing + +section Cuff + +variable {S : Type} [TopologicalSpace S] + +/-- A node of a border cell lies on every cuff that the cell meets. -/ +theorem node_mem_cuff (Γ : Painting S) {c : Set S} (hc : c ∈ Γ.C) {Θ : Set S} (hΘ : Θ ∈ cuffs S) + (hcΘ : (c ∩ Θ).Nonempty) {n : S} (hn : n ∈ tilde c) : n ∈ Θ := by + obtain ⟨x, hxc, hxΘ⟩ := hcΘ + obtain ⟨p, hp, rfl⟩ := hΘ + have hxbd : x ∈ bd S := connectedComponentIn_subset _ _ hxΘ + obtain ⟨hcard, ⟨hL⟩, hends⟩ := Γ.border_cell c hc ⟨x, hxc, hxbd⟩ + have hnL : n ∈ closure c ∩ bd S := by + rw [← hends] at hn + obtain ⟨v, f, hf, -⟩ := hn + exact hf ▸ (f 0).2 + have hconn : IsPreconnected (closure c ∩ bd S) := by + have := (isPreconnected_univ (α := unitInterval)).image (fun t ↦ (hL t).1) + (continuous_subtype_val.comp hL.continuous).continuousOn + have himg : (fun t ↦ (hL t).1) '' univ = closure c ∩ bd S := by + ext y + constructor + · rintro ⟨t, -, rfl⟩ + exact (hL t).2 + · intro hy + exact ⟨hL.symm ⟨y, hy⟩, trivial, by simp⟩ + rwa [himg] at this + rw [connectedComponentIn_eq hxΘ] + exact hconn.subset_connectedComponentIn ⟨subset_closure hxc, hxbd⟩ inter_subset_right hnL + +theorem exists_cuff_of_isBorder {c : Set S} (hb : Painting.IsBorder c) : + ∃ Θ ∈ cuffs S, (c ∩ Θ).Nonempty := by + obtain ⟨x, hxc, hx⟩ := hb + exact ⟨_, ⟨x, hx, rfl⟩, x, hxc, mem_connectedComponentIn hx⟩ + +end Cuff + +/-- A path from `X` to `Y` is also a path from a larger `X'` to a larger `Y'`, in a larger graph. -/ +def _root_.GraphMinor.PathFromTo.widen {K K' : SimpleGraph α} {X Y X' Y' : Set α} + (L : PathFromTo K X Y) + (hK : K ≤ K') (hX : X ⊆ X') (hY : Y ⊆ Y') : PathFromTo K' X' Y' where + first := L.first + last := L.last + walk := L.walk.mapLe hK + isPath := L.isPath.mapLe hK + first_mem := hX L.first_mem + last_mem := hY L.last_mem + +section Cell + +variable {X : GradedSurface} {Γ : Painting X.S} {G : Hypergraph α β} (h : Hull Γ G) + +/-- Disjoint paths between the two sides of a cell give a pairing as in the definition of hulled. -/ +theorem isCellPairing_of_paths {K : SimpleGraph α} {n₁ n₂ : X.S} {r : ℕ} + (hne : h.node n₁ ≠ h.node n₂) + (hc₁ : h.border n₁ ⊆ G.vertexSet) (hc₂ : h.border n₂ ⊆ G.vertexSet) + (hr₁ : (h.border n₁).ncard = r) (hr₂ : (h.border n₂).ncard = r) + (L : Option (Fin r) → PathFromTo K (h.border n₁ ∪ {h.node n₁}) (h.border n₂ ∪ {h.node n₂})) + (hL : Pairwise fun i j ↦ Disjoint {z | z ∈ (L i).walk.support} {z | z ∈ (L j).walk.support}) + (h₁ : (L none).first = h.node n₁) (h₂ : (L none).last = h.node n₂) : + IsCellPairing h n₁ n₂ (reachGrouping (unionPaths L) + ((h.border n₁ ∪ {h.node n₁}) ∪ (h.border n₂ ∪ {h.node n₂}))) := by + have hf₁ : (h.border n₁).Finite := G.vertexSet_finite.subset hc₁ + have hf₂ : (h.border n₂).Finite := G.vertexSet_finite.subset hc₂ + have hcard : Nat.card (Option (Fin r)) = r + 1 := by simp + have hX : (h.border n₁ ∪ {h.node n₁}).ncard ≤ Nat.card (Option (Fin r)) := by + rw [hcard, ← hr₁, ← Set.ncard_singleton (h.node n₁)] + exact Set.ncard_union_le _ _ + have hY : (h.border n₂ ∪ {h.node n₂}).ncard ≤ Nat.card (Option (Fin r)) := by + rw [hcard, ← hr₂, ← Set.ncard_singleton (h.node n₂)] + exact Set.ncard_union_le _ _ + obtain ⟨hp, hcomp⟩ := reachGrouping_paths hL (hf₁.union (finite_singleton _)) + (hf₂.union (finite_singleton _)) hX hY + have hfin : ((h.border n₁ ∪ {h.node n₁}) ∪ (h.border n₂ ∪ {h.node n₂})).Finite := + (hf₁.union (finite_singleton _)).union (hf₂.union (finite_singleton _)) + refine ⟨(isPairing_iff hfin).mpr ⟨le_rfl, hp⟩, ?_, ?_, hcomp⟩ + · ext v + change v ∈ (h.border n₁ ∪ {h.node n₁}) ∪ (h.border n₂ ∪ {h.node n₂}) ↔ _ + simp only [mem_union, mem_singleton_iff, mem_insert_iff] + tauto + · have hm₁ : ∀ z, z = (L none).first → z ∈ (L none).walk.support := by + rintro _ rfl + exact first_mem_support none + have hm₂ : ∀ z, z = (L none).last → z ∈ (L none).walk.support := by + rintro _ rfl + exact last_mem_support none + exact ⟨Or.inl (Or.inr rfl), Or.inr (Or.inr rfl), hne, + reachable_of_mem_support none (hm₁ _ h₁.symm) (hm₂ _ h₂.symm)⟩ + +end Cell + +theorem _root_.GraphMinor.PathFromTo.support_widen {K K' : SimpleGraph α} {X Y X' Y' : Set α} + (L : PathFromTo K X Y) + (hK : K ≤ K') (hX : X ⊆ X') (hY : Y ⊆ Y') : + (L.widen hK hX hY).walk.support = L.walk.support := + SimpleGraph.Walk.support_mapLe_eq_support _ _ + +theorem _root_.GraphMinor.PathFromTo.edges_widen {K K' : SimpleGraph α} {X Y X' Y' : Set α} + (L : PathFromTo K X Y) + (hK : K ≤ K') (hX : X ⊆ X') (hY : Y ⊆ Y') : + (L.widen hK hX hY).walk.edges = L.walk.edges := + SimpleGraph.Walk.edges_mapLe_eq_edges _ _ + +/-- The path of one edge joining `a` and `b` in the complete graph. -/ +def edgePath {X Y : Set α} {a b : α} (hab : a ≠ b) (ha : a ∈ X) (hb : b ∈ Y) : + PathFromTo (⊤ : SimpleGraph α) X Y where + first := a + last := b + walk := SimpleGraph.Walk.cons hab SimpleGraph.Walk.nil + isPath := by simpa [SimpleGraph.Walk.cons_isPath_iff] using hab + first_mem := ha + last_mem := hb + +/-- A heart of a free patchwork: the patch of `e(A)` is free if every grouping comes from `sk(A⁻)`. +-/ +theorem isFree_feasibleGroupings {P : UnlabeledPatchwork α β} (hfree : IsFree P) + {A : RootedHypergraph α β} (hA : A.toHypergraph ≤ P.G.toHypergraph) + (hK : ∀ K : (⊤ : SimpleGraph α).Subgraph, IsGrouping A.rootSet K → K.verts = A.rootSet → + ∃ C : SimpleGraph α, C ≤ A.toHypergraph.skeleton ∧ ∀ x ∈ K.verts, ∀ y ∈ K.verts, x ≠ y → + (C.Reachable x y ↔ K.Adj x y)) : + (feasibleGroupings (P.restrict A)).IsFree := by + intro K hg hv + replace hv : K.verts = A.rootSet := hv + obtain ⟨C, hC, hc⟩ := hK K hg hv + have hfe := feasible_reachGrouping hfree hA hC + have hKeq : K = reachGrouping C A.rootSet := by + refine SimpleGraph.Subgraph.ext hv ?_ + ext x y + constructor + · intro h + have h₁ := K.edge_vert h + have h₂ := K.edge_vert h.symm + have hne : x ≠ y := h.ne + exact ⟨hv ▸ h₁, hv ▸ h₂, hne, (hc x h₁ y h₂ hne).mpr h⟩ + · rintro ⟨h₁, h₂, hne, hr⟩ + exact (hc x (hv ▸ h₁) y (hv ▸ h₂) hne).mp hr + rw [hKeq] + exact hfe + +/-- Graph Minors XX, (10.2) (page 354): "Let* $(P, \mathcal{L})$ *be* $(\Sigma, \rho)$*-shelled. +Then it has a heart which is* +$(\Sigma, \rho)$*-hulled." -/ +theorem theorem_10_2_proof {X : GradedSurface} {P : UnlabeledPatchwork α β} (hfree : IsFree P) + (hroot : P.G.roots = []) {ℒ : Set (RootedHypergraph α β)} (hs : IsShelled X P ℒ) : + ∃ P', HasPatchworkHeart P ℒ P' ∧ IsHulled X P' := by + obtain ⟨hfine, e, P', Γ, h, hheart, hE, h3, hint, hbord⟩ := hs + refine ⟨P', ⟨e, hheart⟩, Γ, h, ?_⟩ + have hcell : ∀ c ∈ Γ.C, ∃ A ∈ ℒ, h.cell c = e A := fun c hc ↦ by + have h₁ := h.cell_bijOn.mapsTo hc + rw [hE] at h₁ + obtain ⟨A, hA, hAe⟩ := h₁ + exact ⟨A, hA, hAe.symm⟩ + have hle : ∀ {A}, A ∈ ℒ → A.toHypergraph ≤ P.G.toHypergraph := fun hA ↦ + (hheart.isRootedLocation.isComplemented hA).le + have hends : ∀ {A}, A ∈ ℒ → P'.G.ends (e A) = A.rootSet := fun hA ↦ hheart.ends_newEdge hA + refine ⟨h3, fun c hc hb ↦ ?_, fun c hc hb n₁ hn₁ n₂ hn₂ hne ↦ ?_, ?_, ?_, fun c hc hb ↦ ?_⟩ + · obtain ⟨A, hA, hcA⟩ := hcell c hc + rw [hcA, hheart.Δ_newEdge hA] + obtain ⟨-, hK⟩ := hint c hc A hA hcA hb + have hZ : A.rootSet = h.node '' tilde c := by + rw [← hends hA, ← hcA, h.ends_internal c hc hb] + exact isFree_feasibleGroupings hfree (hle hA) fun K hg hv ↦ hK K (hZ ▸ hg) (hZ ▸ hv) + · obtain ⟨A, hA, hcA⟩ := hcell c hc + obtain ⟨Θ, hΘ, hcΘ⟩ := exists_cuff_of_isBorder hb + obtain ⟨L, hd, hnot, hor⟩ := hbord c hc A hA hcA Θ hΘ hcΘ n₁ hn₁ n₂ hn₂ hne + have hN : ∀ {n}, n ∈ tilde c → n ∈ Γ.N := fun {n} hn ↦ by + rw [← Γ.closure_inter c hc] at hn + exact hn.2 + have hbdΘ : Θ ⊆ bd X.S := by + obtain ⟨p, -, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + have hmem₁ : n₁ ∈ Γ.N ∩ Θ := ⟨hN hn₁, node_mem_cuff Γ hc hΘ hcΘ hn₁⟩ + have hmem₂ : n₂ ∈ Γ.N ∩ Θ := ⟨hN hn₂, node_mem_cuff Γ hc hΘ hcΘ hn₂⟩ + have hr₁ := h.border_ncard Θ hΘ n₁ hmem₁ + have hr₂ := h.border_ncard Θ hΘ n₂ hmem₂ + have hsub₁ := h.border_subset n₁ ⟨hmem₁.1, hbdΘ hmem₁.2⟩ + have hsub₂ := h.border_subset n₂ ⟨hmem₂.1, hbdΘ hmem₂.2⟩ + have hnode : h.node n₁ ≠ h.node n₂ := fun h' ↦ hne (h.node_injOn (hN hn₁) (hN hn₂) h') + have hfint := (Γ.cell_size c hc).1 + have hb' : (c ∩ bd X.S).Nonempty := hb + have hsize := (Γ.border_cell c hc hb').1 + have htilde : tilde c = {n₁, n₂} := (Set.eq_of_subset_of_ncard_le + (by rintro x (rfl | rfl) <;> assumption) (by rw [Set.ncard_pair hne, hsize]) hfint).symm + have hZ : A.rootSet = (h.border n₁ ∪ {h.node n₁}) ∪ (h.border n₂ ∪ {h.node n₂}) := by + rw [← hends hA, ← hcA, h.ends_border c hc hb, htilde] + ext v + simp only [image_insert_eq, image_singleton, mem_union, mem_insert_iff, mem_singleton_iff, + mem_iUnion, exists_prop, exists_eq_or_imp, exists_eq_left] + tauto + have hfe : ∀ {C : SimpleGraph α}, C ≤ A.toHypergraph.skeleton → reachGrouping C + ((h.border n₁ ∪ {h.node n₁}) ∪ (h.border n₂ ∪ {h.node n₂})) ∈ P'.Δ (h.cell c) := by + intro C hC + have h₁ := feasible_reachGrouping hfree (hle hA) hC + rw [hZ] at h₁ + rw [hcA, hheart.Δ_newEdge hA] + exact h₁ + let W : Fin (X.ρ Θ) → PathFromTo A.toHypergraph.skeleton (h.border n₁ ∪ {h.node n₁}) + (h.border n₂ ∪ {h.node n₂}) := fun i ↦ + (L i).widen le_rfl subset_union_left subset_union_left + have hWs : ∀ i, (W i).walk.support = (L i).walk.support := fun i ↦ + PathFromTo.support_widen _ _ subset_union_left subset_union_left + rcases hor with ⟨L₀, hd₀⟩ | ⟨c', hc', hbc', h₁', h₂'⟩ + · let L' : Option (Fin (X.ρ Θ)) → PathFromTo A.toHypergraph.skeleton + (h.border n₁ ∪ {h.node n₁}) (h.border n₂ ∪ {h.node n₂}) := fun o ↦ + o.elim (L₀.widen le_rfl subset_union_right subset_union_right) W + have hLs : ∀ i, (L' (some i)).walk.support = (L i).walk.support := hWs + have hLn : (L' none).walk.support = L₀.walk.support := + PathFromTo.support_widen _ _ subset_union_right subset_union_right + have hdis : Pairwise fun i j ↦ + Disjoint {z | z ∈ (L' i).walk.support} {z | z ∈ (L' j).walk.support} := by + rintro (_ | i) (_ | j) hij + · exact absurd rfl hij + · simp only [hLn, hLs] + exact hd₀ j + · simp only [hLn, hLs] + exact (hd₀ i).symm + · simp only [hLs] + exact hd (fun h ↦ hij (congrArg some h)) + refine ⟨_, isCellPairing_of_paths h hnode hsub₁ hsub₂ hr₁ hr₂ L' hdis + (mem_singleton_iff.mp L₀.first_mem) (mem_singleton_iff.mp L₀.last_mem), Or.inl + (hfe unionPaths_le)⟩ + · let L' : Option (Fin (X.ρ Θ)) → PathFromTo (⊤ : SimpleGraph α) + (h.border n₁ ∪ {h.node n₁}) (h.border n₂ ∪ {h.node n₂}) := fun o ↦ + o.elim (edgePath hnode (Or.inr rfl) (Or.inr rfl)) + fun i ↦ (W i).widen le_top subset_rfl subset_rfl + have hLs : ∀ i, (L' (some i)).walk.support = (L i).walk.support := fun i ↦ + (PathFromTo.support_widen _ _ subset_rfl subset_rfl).trans (hWs i) + have hLn : ∀ z, z ∈ (L' none).walk.support ↔ z = h.node n₁ ∨ z = h.node n₂ := fun z ↦ by + change z ∈ [h.node n₁, h.node n₂] ↔ _ + simp + have hdis : Pairwise fun i j ↦ + Disjoint {z | z ∈ (L' i).walk.support} {z | z ∈ (L' j).walk.support} := by + rintro (_ | i) (_ | j) hij + · exact absurd rfl hij + · simp only [hLs] + refine Set.disjoint_left.mpr fun z hz hzj ↦ ?_ + rcases (hLn z).mp hz with rfl | rfl + · exact (hnot j).1 hzj + · exact (hnot j).2 hzj + · simp only [hLs] + refine Set.disjoint_left.mpr fun z hzj hz ↦ ?_ + rcases (hLn z).mp hz with rfl | rfl + · exact (hnot i).1 hzj + · exact (hnot i).2 hzj + · simp only [hLs] + exact hd (fun h ↦ hij (congrArg some h)) + refine ⟨_, isCellPairing_of_paths h hnode hsub₁ hsub₂ hr₁ hr₂ L' hdis rfl rfl, Or.inr ?_⟩ + refine ⟨?_, c', hc', hbc', h₁', h₂'⟩ + have hdisW : Pairwise fun i j ↦ + Disjoint {z | z ∈ (W i).walk.support} {z | z ∈ (W j).walk.support} := by + intro i j hij + simp only [hWs] + exact hd hij + have heq : (reachGrouping (unionPaths L') + ((h.border n₁ ∪ {h.node n₁}) ∪ (h.border n₂ ∪ {h.node n₂}))).deleteEdges + {s(h.node n₁, h.node n₂)} = reachGrouping (unionPaths W) + ((h.border n₁ ∪ {h.node n₁}) ∪ (h.border n₂ ∪ {h.node n₂})) := by + refine SimpleGraph.Subgraph.ext rfl ?_ + ext x y + rw [SimpleGraph.Subgraph.deleteEdges_adj] + constructor + · rintro ⟨⟨hx, hy, hxy, hr⟩, hns⟩ + refine ⟨hx, hy, hxy, ?_⟩ + obtain ⟨(_ | i), h₁, h₂⟩ := (eq_or_mem_support_of_reachable hdis hr).resolve_left hxy + · exfalso + apply hns + rcases (hLn x).mp h₁ with rfl | rfl <;> rcases (hLn y).mp h₂ with rfl | rfl + · exact absurd rfl hxy + · rfl + · exact Sym2.eq_swap + · exact absurd rfl hxy + · rw [hLs, ← hWs] at h₁ h₂ + exact reachable_of_mem_support i h₁ h₂ + · rintro ⟨hx, hy, hxy, hr⟩ + obtain ⟨i, h₁, h₂⟩ := (eq_or_mem_support_of_reachable hdisW hr).resolve_left hxy + have h₁' := h₁ + have h₂' := h₂ + rw [hWs] at h₁' h₂' + have hx' : x ∈ (L' (some i)).walk.support := by rw [hLs]; exact h₁' + have hy' : y ∈ (L' (some i)).walk.support := by rw [hLs]; exact h₂' + refine ⟨⟨hx, hy, hxy, reachable_of_mem_support (some i) hx' hy'⟩, ?_⟩ + intro hs + have hs' := Sym2.eq_iff.mp hs + rcases hs' with ⟨rfl, -⟩ | ⟨rfl, -⟩ + · exact (hnot i).1 h₁' + · exact (hnot i).2 h₁' + rw [heq] + exact hfe (unionPaths_le) + · rw [hheart.roots_eq, hroot] + · rw [hheart.dom_eq_image hfine, hheart.edgeSet_eq_image hfine] + · obtain ⟨A, hA, hcA⟩ := hcell c hc + rw [hcA, hheart.μ_newEdge hA] + exact (hint c hc A hA hcA hb).1 + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section10c.lean b/LeanPool/GraphMinor/GM20/Section10c.lean new file mode 100644 index 0000000000..61e8deadd0 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section10c.lean @@ -0,0 +1,119 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section9h + +/-! +# Graph Minors XX, Section 10, (10.4) + +This file deduces (10.4) from (7.3), (9.1), (10.2) and (10.3). If `sk(G)` has no `K_p` minor then no +tangle controls one, so (10.3) applies to every tangle, and (10.2) and (9.1) give a well-behaved set +that contains a heart. +The deductions using other proved results are in `Section10cProved`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface GraphMinor.GM17 GraphMinor.GM18 GraphMinor.GM10 Hypergraph + GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- The complete graph on `p` vertices, as a hypergraph. -/ +def completeHypergraph (p : ℕ) : Hypergraph (Fin p) (Sym2 (Fin p)) where + vertexSet := univ + edgeSet := {e | ¬ e.IsDiag} + Inc e v := ¬ e.IsDiag ∧ v ∈ e + vertex_mem_of_inc _ _ _ := trivial + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := finite_univ + edgeSet_finite := toFinite _ + +/-- `sk(G)` has a `K_p` minor: there are `p` non-null connected subgraphs of `sk(G)`, mutually +disjoint, with an edge of `sk(G)` between any two of them. A connected subgraph is given by its +vertex set `a i`. -/ +def HasCliqueMinor (G : Hypergraph α β) (p : ℕ) : Prop := + ∃ a : Fin p → Set α, (∀ i, (a i).Nonempty ∧ a i ⊆ G.vertexSet ∧ ∀ x ∈ a i, ∀ y ∈ a i, + Relation.ReflTransGen (fun u v ↦ G.skeleton.Adj u v ∧ u ∈ a i ∧ v ∈ a i) x y) ∧ + (∀ i j, i ≠ j → Disjoint (a i) (a j)) ∧ + ∀ i j, i ≠ j → ∃ x ∈ a i, ∃ y ∈ a j, G.skeleton.Adj x y + +theorem isGraph_completeHypergraph (p : ℕ) : (completeHypergraph p).IsGraph := by + intro e he + induction e using Sym2.ind with + | _ a b => + have hends : (completeHypergraph p).ends s(a, b) = {a, b} := by + ext v + constructor + · intro h + simpa using h.2 + · intro h + exact ⟨he, by simpa using h⟩ + rw [hends] + exact ⟨⟨a, mem_insert _ _⟩, Set.ncard_insert_le _ _ |>.trans (by simp)⟩ + +/-- If a tangle controls a `K_p` minor of `sk(G)` then `sk(G)` has a `K_p` minor. -/ +theorem hasCliqueMinor_of_controlsMinor {G : Hypergraph α β} {p : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h : ControlsMinor G 𝒯 (completeHypergraph p)) : + HasCliqueMinor G p := by + obtain ⟨-, av, ae', ae, h₁, h₂, h₃, -, h₅, -, -⟩ := h + refine ⟨av, fun i ↦ ⟨(h₁ i trivial).1, (h₁ i trivial).2.1, fun x hx y hy ↦ ?_⟩, + fun i j hij ↦ h₂ i trivial j trivial hij, + fun i j hij ↦ ?_⟩ + · obtain ⟨-, -, h₆, h₇, h₈⟩ := h₁ i trivial + refine Relation.ReflTransGen.mono (fun u v huv ↦ ?_) _ _ (h₈ x hx y hy) + exact ⟨h₆ huv, h₇ u v huv⟩ + · have hdiag : ¬ s(i, j).IsDiag := by simpa using hij + have hmem : s(i, j) ∈ (completeHypergraph p).edgeSet := hdiag + obtain ⟨x, hx, y, hy, hxy⟩ := h₅ _ hmem i j hij ⟨hdiag, by simp⟩ ⟨hdiag, by simp⟩ + have hadj : s(x, y) ∈ G.skeleton.edgeSet := hxy ▸ h₃ _ hmem + exact ⟨x, hx, y, hy, hadj⟩ + +/-- The statement of (10.3) of Graph Minors XX. + +Lean uses an infinite ambient edge type to provide fresh edge labels. -/ +def Theorem103Statement : Prop := + ∀ {α' β' : Type} (H : Hypergraph α' β'), H.IsGraph → ∃ (θ : ℕ) (𝒮 : Set GradedSurface), 1 ≤ θ ∧ + 𝒮.Finite ∧ ∀ {α : Type u} {β : Type v} [Infinite β] (P : UnlabeledPatchwork α β), IsFree P → + P.G.roots = [] → ∀ (θ' : ℕ) (𝒯 : Set (Hypergraph α β × Hypergraph α β)), + IsTangle P.G.toHypergraph θ' 𝒯 → θ ≤ θ' → ¬ ControlsMinor P.G.toHypergraph 𝒯 H → + ∃ W ⊆ P.G.vertexSet, W.ncard < θ ∧ ∃ ℒ : Set (RootedHypergraph α β), + IsFine (P.G.slash W) ℒ ∧ (∃ X ∈ 𝒮, IsShelled X (P.slash W) ℒ) ∧ + IsLinkedTo (P.G.slash W) (quotientTangle P.G.toHypergraph 𝒯 W) ℒ + +theorem wellBehaved_empty : WellBehaved (∅ : Set (UnlabeledPatchwork α β)) := by + intro Ω _ _ Q hQ + obtain ⟨P, hP, -⟩ := hQ 0 + exact hP.elim + +theorem wellBehaved_biUnion {ι : Type*} {𝒮 : Set ι} (h𝒮 : 𝒮.Finite) + {𝓕 : ι → Set (UnlabeledPatchwork α β)} (h : ∀ X ∈ 𝒮, WellBehaved (𝓕 X)) : + WellBehaved (⋃ X ∈ 𝒮, 𝓕 X) := by + induction 𝒮, h𝒮 using Set.Finite.induction_on with + | empty => simpa using wellBehaved_empty + | @insert a s _ _ ih => + rw [Set.biUnion_insert] + exact (h a (mem_insert _ _)).union (ih fun X hX ↦ h X (mem_insert_of_mem _ hX)) + +theorem isFree_slash {Ω : Type*} {P : Patchwork Ω α β} (hfree : IsFree P) (W : Set α) : + IsFree (P.slash W) := by + intro e he δ hδ hV + exact ⟨hδ, hV, hfree e he _ (isGrouping_sup_emptySubgraph hδ) (by + ext x + simp only [SimpleGraph.Subgraph.verts_sup, emptySubgraph_verts, hV] + change (x ∈ (P.Δ e).verts \ W ∨ x ∈ W ∩ (P.Δ e).verts) ↔ x ∈ (P.Δ e).verts + by_cases hx : x ∈ W <;> simp [hx])⟩ + + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section10cProved.lean b/LeanPool/GraphMinor/GM20/Section10cProved.lean new file mode 100644 index 0000000000..d14f07893d --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section10cProved.lean @@ -0,0 +1,63 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section10c + +import LeanPool.GraphMinor.GM20.Section9hProved + +import LeanPool.GraphMinor.GM20.Section10l + +import LeanPool.GraphMinor.GM20.Section8b + +/-! +# Graph Minors XX: deductions from Section10c + +The deductions apply the proved results after their geometric prerequisites. +-/ + +public section +namespace GraphMinor.GM20 +open Set Topology GraphMinor.Surface GraphMinor.GM17 GraphMinor.GM18 GraphMinor.GM10 Hypergraph + GraphMinor.GM04 +universe u v +variable {α : Type u} {β : Type v} + +/-- Graph Minors XX, (10.4) (page 355): "Let* $\Omega$ *be a well-quasi-order and let* $p \ge 0$. +*Let* $P_i = (G_i, \mu_i, \Delta_i, +\phi_i)$ $(i = 1, 2, \dots)$ *be a countable sequence of free rootless* $\Omega$*-patchworks +such that for all* $i \ge 1$, $sk(G_i^-)$ *has no* $K_p$ *minor. Then there exist* $j > i +\ge 1$ *such that* $P_i$ *is simulated in* $P_j$." + +Lean uses an infinite ambient edge type to provide fresh edge labels. -/ +theorem theorem_10_4_proof [Infinite β] + {Ω : Type (max u v)} [Preorder Ω] (hΩ : WellQuasiOrderedLE Ω) (p : ℕ) + (P : ℕ → GM04.Patchwork Ω α β) (hfree : ∀ i, IsFree (P i)) (hroot : ∀ i, IsRootless (P i)) + (hmin : ∀ i, ¬ HasCliqueMinor (P i).G.toHypergraph p) : + ∃ i j, i < j ∧ GM04.Simulated (P i) (P j) := by + obtain ⟨θ, 𝒮, hθ, hfin, h⟩ := GraphMinor.GM20.theorem_10_3_proof.{u, v} (completeHypergraph p) + (isGraph_completeHypergraph p) + have hroots : ∀ i, (P i).G.roots = [] := fun i ↦ by + refine List.eq_nil_iff_forall_not_mem.mpr fun x hx ↦ ?_ + have h₁ : x ∈ (P i).G.rootSet := hx + rw [show (P i).G.rootSet = ∅ from hroot i] at h₁ + exact h₁ + refine theorem_7_3_proof hΩ (wellBehaved_biUnion hfin fun X _ ↦ theorem_9_1_proof X) hθ P hfree + hroot + fun i θ' 𝒯 h𝒯 hθ' ↦ ?_ + have hfree' : IsFree ((P i).relabel fun _ ↦ ()) := fun e he ↦ hfree i e he + obtain ⟨W, hWV, hWθ, ℒ, hfine, ⟨X, hX, hs⟩, hlink⟩ := h ((P i).relabel fun _ ↦ ()) hfree' + (hroots i) θ' 𝒯 h𝒯 hθ' fun hc ↦ hmin i (hasCliqueMinor_of_controlsMinor hc) + obtain ⟨Q, hQ, hul⟩ := theorem_10_2_proof (isFree_slash hfree' W) (by + change marchSlash (P i).G.roots W = [] + rw [hroots i] + rfl) hs + exact ⟨W, ℒ, hWV, hWθ, hfine, hlink, Q, mem_biUnion hX hul, hQ⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section10d.lean b/LeanPool/GraphMinor/GM20/Section10d.lean new file mode 100644 index 0000000000..626b9e3533 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section10d.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Directed + +import LeanPool.GraphMinor.GM20.Section10cProved + +import LeanPool.GraphMinor.GM20.Section10l + +import LeanPool.GraphMinor.GM20.Section8b + +/-! +# Graph Minors XX, Section 10, (10.5) + +This file proves (10.5) of Graph Minors XX (`GM20.theorem_10_5_proof`, pages 355–356): for every +countable +sequence $G_i$ of finite directed graphs, there exist $j > i$ such that $G_i$ is isomorphic to a +directed minor of $G_j$. + +Following the proof on pages 355–356: +- Let $p = 2|E(G_1)| + |V(G_1)|$; if for some $i \ge 2$ the underlying undirected graph $G_i'$ of + $G_i$ has a minor isomorphic to $K_p$, then $G_i$ has a directed minor isomorphic to $G_1$ + (`isDirMinorModel_of_hasCliqueMinor` in `GraphMinor/GM20/Directed.lean`). +- Otherwise, for $i \ge 2$ let $P_i = (H_i, \mu, \Delta, \phi)$ be `digraphPatchwork (G i)`, where + $\mu(e)$ enumerates the ends of $e$ tail first, $\Delta(e) = \{N_X, K_X\}$, and $\phi(e) = ()$. + Then each $P_i$ is a free rootless $\Omega$-patchwork (`isFree_digraphPatchwork`), so + `theorem_10_4` + gives $j > i \ge 2$ such that $P_i$ is simulated in $P_j$, and `isDirMinorModel_of_simulated` and + `isIsoMinor_of_isDirMinorModel` turn that simulation into a directed minor. +- Finally, `wagner_conjecture_undirected_proof` follows immediately by orienting each undirected + graph via + `Digraph.ofGraph` and projecting the directed minor to the underlying undirected graphs via + `Digraph.IsIsoMinor.toGraph`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Graph GraphMinor.GM18 GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- Proof of (10.5) of Graph Minors XX (pages 355–356) for finite directed graphs on `ℕ`, producing +a directed minor model of `G i` in `G j` for some `i < j`. -/ +theorem exists_isDirMinorModel_nat + (G : ℕ → Digraph ℕ ℕ) (hV : ∀ n, V((G n).toGraph).Finite) + (hE : ∀ n, E((G n).toGraph).Finite) : + ∃ i j, i < j ∧ ∃ (ηv : ℕ → Set ℕ) (ηe : ℕ → ℕ), IsDirMinorModel (G i) (G j) ηv ηe := by + let p := V((G 0).toGraph).ncard + 2 * E((G 0).toGraph).ncard + by_cases hc : ∃ i, HasCliqueMinor (Hypergraph.ofGraph (G (i + 1)).toGraph (hV _) (hE _)) p + · obtain ⟨i, hi⟩ := hc + obtain ⟨ηv, ηe, hm⟩ := + isDirMinorModel_of_hasCliqueMinor (hV 0) (hE 0) (hV _) (hE _) le_rfl hi + exact ⟨0, i + 1, Nat.succ_pos i, ηv, ηe, hm⟩ + · push Not at hc + obtain ⟨i, j, hij, hsim⟩ := theorem_10_4_proof wellQuasiOrderedLE_unit p + (fun i ↦ digraphPatchwork (G (i + 1)) (hV _) (hE _)) + (fun i ↦ isFree_digraphPatchwork _ _ _) + (fun i ↦ Set.eq_empty_of_forall_notMem fun x hx ↦ List.not_mem_nil hx) hc + obtain ⟨ηv, ηe, hm⟩ := isDirMinorModel_of_simulated hsim + exact ⟨i + 1, j + 1, by omega, ηv, ηe, hm⟩ + +/-- Graph Minors XX, (10.5) (page 355): +"**10.5.** *Let* $G_i$ $(i = 1, 2, \dots)$ *be a countable sequence of directed graphs. Then there +exist* $j > i \ge 1$ *such that* $G_i$ *is isomorphic to a minor of* $G_j$." -/ +theorem theorem_10_5_proof + (G : ℕ → Digraph α β) (hV : ∀ n, V((G n).toGraph).Finite) + (hE : ∀ n, E((G n).toGraph).Finite) : + ∃ i j, i < j ∧ (G i).IsIsoMinor (G j) := by + choose G' hV' hE' hiso using fun n ↦ exists_digraph_iso_nat (G n) (hV n) (hE n) + obtain ⟨i, j, hij, ηv', ηe', hm'⟩ := exists_isDirMinorModel_nat G' hV' hE' + obtain ⟨φᵢ⟩ := hiso i + obtain ⟨φⱼ⟩ := hiso j + obtain ⟨ηv, ηe, hm⟩ := hm'.transport_iso φᵢ φⱼ + exact ⟨i, j, hij, isIsoMinor_of_isDirMinorModel hm⟩ + +/-- Graph Minors XX, Section 10 (page 355), the standard form of Wagner's conjecture for undirected +graphs ("As a corollary, we deduce the following form of Wagner’s conjecture for directed graphs +(which immediately implies the standard form of the conjecture for undirected graphs)."): +for every countable sequence `Gᵢ` of finite undirected graphs, there exist `j > i` such that `Gᵢ` is +isomorphic to a minor of `Gⱼ`. -/ +theorem wagner_conjecture_undirected_proof + (G : ℕ → Graph α β) (hV : ∀ n, V(G n).Finite) (hE : ∀ n, E(G n).Finite) : + ∃ i j, i < j ∧ IsIsoMinor (G i) (G j) := by + obtain ⟨i, j, hij, h⟩ := theorem_10_5_proof (fun n ↦ Digraph.ofGraph (G n)) hV hE + exact ⟨i, j, hij, h.toGraph⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section10e.lean b/LeanPool/GraphMinor/GM20/Section10e.lean new file mode 100644 index 0000000000..60abab69b8 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section10e.lean @@ -0,0 +1,140 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section10c +public import LeanPool.GraphMinor.GM17.Defs +public import LeanPool.GraphMinor.Surface.InvarianceOfDomain +public import LeanPool.GraphMinor.Surface.Disc + +/-! +# Graph Minors XX, Section 10: paintings from portrayals + +The proof of (10.3) starts with a portrayal from Graph Minors XVII, whose painting has no marches of +cells. This file makes it a painting in the sense of Graph Minors XX. The one fact that needs proof +is +that `cTilde ⊆ N(Γ)` for a cell `c`. If `x ∈ cTilde` were not a node, then `c ∪ {x}` would be a +larger arcwise +connected subset of `U(Γ) \ N(Γ)` (`isPathConnected_of_ball_subset`). +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +/-- A set between the open and the closed unit disc is arcwise connected, since it is star-shaped +around the origin. -/ +theorem isPathConnected_of_ball_subset {Z : Set EuclideanPlane} (h₁ : OpenUnitDisc ⊆ Z) + (h₂ : Z ⊆ ClosedUnitDisc) : IsPathConnected Z := by + have hstar : StarConvex ℝ 0 Z := by + intro y hy a b _ hb hab + have hy' : ‖y‖ ≤ 1 := by simpa [ClosedUnitDisc] using h₂ hy + rcases hb.eq_or_lt with hb₀ | hb₀ + · apply h₁ + subst hb₀ + simp [OpenUnitDisc] + by_cases hb₁ : b = 1 + · subst hb₁ + have ha : a = 0 := by linarith + simpa [ha] using hy + · apply h₁ + have hb₂ : b < 1 := lt_of_le_of_ne (by linarith) hb₁ + simp only [OpenUnitDisc, Metric.mem_ball, dist_zero_right, smul_zero, zero_add, norm_smul, + Real.norm_eq_abs, abs_of_pos hb₀] + nlinarith [norm_nonneg y] + exact hstar.isPathConnected (h₁ (by simp [OpenUnitDisc])) + +/-- In a painting of Graph Minors XVII, the attachments of a cell are nodes. -/ +theorem tilde_subset_nodes (Γ : GM17.Painting S) {c : Set S} (hc : c ∈ Γ.C) : tilde c ⊆ Γ.N := by + intro x hx + by_contra hxN + obtain ⟨⟨φ⟩, hsub, -, -⟩ := Γ.cell_disc c hc + have hbdy := disc_boundary (closure c) φ + have hcU : c ⊆ Γ.U \ Γ.N := hc.2.1 + have hclU : closure c ⊆ Γ.U := closure_minimal (hcU.trans sdiff_subset) Γ.isClosed_U + let Z : Set EuclideanPlane := {z | ∃ hz : z ∈ ClosedUnitDisc, (φ ⟨z, hz⟩).1 ∈ insert x c} + have hZ : IsPathConnected Z := by + refine isPathConnected_of_ball_subset (fun z hz ↦ ?_) fun z hz ↦ hz.1 + have hzc : z ∈ ClosedUnitDisc := Metric.ball_subset_closedBall hz + refine ⟨hzc, Or.inr ?_⟩ + by_contra hnc + have hmem : (φ ⟨z, hzc⟩).1 ∈ tilde c := ⟨(φ ⟨z, hzc⟩).2, hnc⟩ + have hm₂ := hsub hmem + rw [hbdy] at hm₂ + obtain ⟨w, hw, hwe⟩ := hm₂ + have heq : w = ⟨z, hzc⟩ := φ.injective (Subtype.ext hwe) + subst heq + have h₁ : z ∈ UnitCircle := hw + have h₂ : z ∈ OpenUnitDisc := hz + simp only [UnitCircle, OpenUnitDisc, Metric.mem_sphere, Metric.mem_ball] at h₁ h₂ + linarith + have hZ' : IsPathConnected (Subtype.val ⁻¹' Z : Set ClosedUnitDisc) := by + rw [IsInducing.subtypeVal.isPathConnected_iff] + have hZsub : Z ⊆ ClosedUnitDisc := fun _ hz ↦ hz.1 + rwa [Subtype.image_preimage_coe, inter_eq_right.mpr hZsub] + have hY : (fun z ↦ (φ z).1) '' (Subtype.val ⁻¹' Z : Set ClosedUnitDisc) = insert x c := by + ext y + constructor + · rintro ⟨z, ⟨_, hz⟩, rfl⟩ + exact hz + · intro hy + have hyc : y ∈ closure c := by + rcases hy with rfl | hy + · exact hx.1 + · exact subset_closure hy + refine ⟨φ.symm ⟨y, hyc⟩, ⟨(φ.symm ⟨y, hyc⟩).2, ?_⟩, by simp⟩ + simpa using hy + have hpath : IsPathConnected (insert x c) := by + rw [← hY] + exact hZ'.image (continuous_subtype_val.comp φ.continuous) + have hsub₂ : insert x c ⊆ Γ.U \ Γ.N := by + rintro y (rfl | hy) + · exact ⟨hclU hx.1, hxN⟩ + · exact hcU hy + have heq := hc.2.2.2 _ hsub₂ hpath (subset_insert _ _) + exact hx.2 (heq ▸ mem_insert _ _) + +/-- A painting of Graph Minors XVII with marches on its cells, and with every cell of size at least +two, +is a painting of Graph Minors XX. -/ +noncomputable def paintingOf (Γ : GM17.Painting S) (g : Set S → List S) + (hsize : ∀ c ∈ Γ.C, 2 ≤ (tilde c).ncard) (hg : ∀ c ∈ Γ.C, (g c).Nodup) + (hset : ∀ c ∈ Γ.C, {n | n ∈ g c} = tilde c) : Painting S where + U := Γ.U + N := Γ.N + γ := g + isClosed_U := Γ.isClosed_U + N_subset := Γ.N_subset + finite_N := Γ.finite_N + bd_subset := Γ.bd_subset + finite_cells := Γ.finite_cells + cell_disc c hc := (Γ.cell_disc c hc).1 + cell_size c hc := by + obtain ⟨-, -, h₁, h₂⟩ := Γ.cell_disc c hc + have h₃ := hsize c hc + exact ⟨h₁, by omega⟩ + closure_inter c hc := by + ext x + constructor + · rintro ⟨h₁, h₂⟩ + exact ⟨h₁, fun h₃ ↦ (hc.2.1 h₃).2 h₂⟩ + · intro h₁ + exact ⟨h₁.1, tilde_subset_nodes Γ hc h₁⟩ + tilde_subset c hc := (Γ.cell_disc c hc).2.1 + border_cell c hc hb := by + obtain ⟨h₁, -, h₂, h₃⟩ := Γ.border_cell c hc hb + exact ⟨h₁, h₂, h₃⟩ + γ_nodup := hg + γ_set := hset + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section10f.lean b/LeanPool/GraphMinor/GM20/Section10f.lean new file mode 100644 index 0000000000..c4b1cd0202 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section10f.lean @@ -0,0 +1,250 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section10e +public import LeanPool.GraphMinor.GM20.Section5d + +/-! +# Graph Minors XX, Section 10: the location of a portrayal + +The proof of (10.3) takes a portrayal `π = (Σ, Γ, α, β, γ)` of a rootless hypergraph `G` and makes a +rooted hypergraph `A_c` for each cell `c`. It has `A_c⁻ = α(c)`. Its march lists `γ(cTilde)` for an +internal +cell, and `γ(cTilde) ∪ β(n₁) ∪ β(n₂)` for a border cell with nodes `n₁, n₂`. This file shows that +the set of +all `A_c` is a fine rooted location. The axioms (P1), (P2), (P3), (P5), (P6) of a portrayal give +this: a vertex of `α(c)` that lies in another `α(c')` is a root of `A_c`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface GraphMinor.GM17 GraphMinor.GM18 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- A list of the members of a set, if the set is finite. -/ +noncomputable def listOf {X : Type*} (s : Set X) : List X := + open Classical in if h : s.Finite then h.toFinset.toList else [] + +theorem nodup_listOf {X : Type*} (s : Set X) : (listOf s).Nodup := by + classical + unfold listOf + split_ifs with h + · exact Finset.nodup_toList _ + · exact List.nodup_nil + +theorem mem_listOf {X : Type*} {s : Set X} (h : s.Finite) {x : X} : x ∈ listOf s ↔ x ∈ s := by + classical + simp [listOf, h] + +end GraphMinor.GM20 + +namespace GraphMinor.GM17.Portrayal + +open Set Topology GraphMinor.Surface GraphMinor.GM18 GraphMinor.GM20 + +universe u v + +variable {α : Type u} {β : Type v} + +variable {G₀ : RootedHypergraph α β} (π : Portrayal G₀.toHypergraph) + +/-- The set `πBar(A_c)` of roots of the rooted hypergraph of a cell `c`. -/ +def rootsOf (c : Set π.S) : Set α := + π.nodeVertex '' tilde c ∪ {v | (c ∩ bd π.S).Nonempty ∧ ∃ n ∈ tilde c, v ∈ π.borderSet n} + +/-- The march of a cell before removing the terms outside `V(α(c))`: the list `γ(n)` for `n` in the +march of `c` if `c` is internal, and any list of the roots if `c` is a border cell. -/ +noncomputable def rawMarch (c : Set π.S) : List α := + open Classical in + if (c ∩ bd π.S).Nonempty then listOf (π.rootsOf c) else (listOf (tilde c)).map π.nodeVertex + +/-- The rooted hypergraph `A_c` of a cell `c`. The filter and `dedup` do nothing for a cell, by +`rootSet_cellRooted`. They only make the definition total. -/ +noncomputable def cellRooted (c : Set π.S) : RootedHypergraph α β where + toHypergraph := π.cellGraph c + roots := open Classical in ((π.rawMarch c).filter (· ∈ (π.cellGraph c).vertexSet)).dedup + roots_nodup := by + classical + exact List.nodup_dedup _ + roots_subset v hv := by + classical + have h := List.mem_dedup.mp hv + simpa using (List.mem_filter.mp h).2 + +/-- The rooted location `ℒ = {A_c : c ∈ C(Γ)}`. -/ +noncomputable def cellLocation : Set (RootedHypergraph α β) := π.cellRooted '' π.Γ.C + +variable {π} + +theorem tilde_finite {c : Set π.S} (hc : c ∈ π.Γ.C) : (tilde c).Finite := + (π.Γ.cell_disc c hc).2.2.1 + +/-- (P2), (P3): the roots of a cell are vertices of `α(c)`. -/ +theorem rootsOf_subset (hdom : π.domγ = π.Γ.N) {c : Set π.S} (hc : c ∈ π.Γ.C) : + π.rootsOf c ⊆ (π.cellGraph c).vertexSet := by + rintro v (⟨n, hn, rfl⟩ | ⟨hb, n, hn, hv⟩) + · exact π.p2 c hc n ⟨hn, hdom ▸ tilde_subset_nodes π.Γ hc hn⟩ + · exact π.p3_subset c hc hb n hn hv + +theorem rootsOf_finite (hdom : π.domγ = π.Γ.N) {c : Set π.S} (hc : c ∈ π.Γ.C) : + (π.rootsOf c).Finite := + (π.cellGraph c).vertexSet_finite.subset (rootsOf_subset hdom hc) + +theorem rootSet_cellRooted (hdom : π.domγ = π.Γ.N) {c : Set π.S} (hc : c ∈ π.Γ.C) : + (π.cellRooted c).rootSet = π.rootsOf c := by + classical + ext v + change v ∈ ((π.rawMarch c).filter (· ∈ (π.cellGraph c).vertexSet)).dedup ↔ _ + rw [List.mem_dedup, List.mem_filter] + have hsub := rootsOf_subset hdom hc + have key : v ∈ π.rawMarch c ↔ v ∈ π.rootsOf c := by + unfold rawMarch + split_ifs with hb + · exact mem_listOf (rootsOf_finite hdom hc) + · simp only [List.mem_map, mem_listOf (tilde_finite hc)] + constructor + · rintro ⟨n, hn, rfl⟩ + exact Or.inl ⟨n, hn, rfl⟩ + · rintro (⟨n, hn, rfl⟩ | ⟨hb', -⟩) + · exact ⟨n, hn, rfl⟩ + · exact absurd hb' hb + rw [key] + simp only [decide_eq_true_eq] + exact ⟨fun h ↦ h.1, fun h ↦ ⟨h, hsub h⟩⟩ + +/-- An internal cell has the march `γ(n)`, for `n` in the chosen march of `c`. -/ +theorem roots_cellRooted_internal (hdom : π.domγ = π.Γ.N) {c : Set π.S} (hc : c ∈ π.Γ.C) + (hb : ¬ (c ∩ bd π.S).Nonempty) : + (π.cellRooted c).roots = (listOf (tilde c)).map π.nodeVertex := by + classical + change ((π.rawMarch c).filter (· ∈ (π.cellGraph c).vertexSet)).dedup = _ + have hraw : π.rawMarch c = (listOf (tilde c)).map π.nodeVertex := by + unfold rawMarch + rw [ite_eq_right hb] + have hsub : tilde c ⊆ π.domγ := hdom ▸ tilde_subset_nodes π.Γ hc + have hnd : ((listOf (tilde c)).map π.nodeVertex).Nodup := by + refine (nodup_listOf _).map_on fun x hx y hy hxy ↦ ?_ + exact π.nodeVertex_injOn (hsub ((mem_listOf (tilde_finite hc)).mp hx)) + (hsub ((mem_listOf (tilde_finite hc)).mp hy)) hxy + rw [hraw, List.filter_eq_self.mpr, List.dedup_eq_self.mpr hnd] + intro v hv + obtain ⟨n, hn, rfl⟩ := List.mem_map.mp hv + have := rootsOf_subset hdom hc (Or.inl ⟨n, (mem_listOf (tilde_finite hc)).mp hn, rfl⟩) + simpa using this + +/-- (P5), (P6): a vertex of `α(c)` that lies in `α(c')` for another cell `c'` is a root of `A_c`. -/ +theorem mem_rootsOf_of_other (_hdom : π.domγ = π.Γ.N) {c c' : Set π.S} (hc : c ∈ π.Γ.C) + (hc' : c' ∈ π.Γ.C) (hne : c' ≠ c) {v : α} (hv : v ∈ (π.cellGraph c).vertexSet) + (hv' : v ∈ (π.cellGraph c').vertexSet) : v ∈ π.rootsOf c := by + by_cases hb : (c ∩ bd π.S).Nonempty + · obtain ⟨n, hn, h | ⟨-, rfl⟩⟩ := π.p6 c hc hb v hv ⟨c', hc', hne, hv'⟩ + · exact Or.inr ⟨hb, n, hn, h⟩ + · exact Or.inl ⟨n, hn, rfl⟩ + · obtain ⟨n, ⟨hn, -⟩, rfl⟩ := π.p5 c hc hb v hv ⟨c', hc', hne, hv'⟩ + exact Or.inl ⟨n, hn, rfl⟩ + +/-- If an edge of `G` lies in `α(c')`, each of its ends in `G` lies in `α(c')`. -/ +theorem vertex_mem_of_inc {c' : Set π.S} (hc' : c' ∈ π.Γ.C) {e : β} {v : α} + (he : e ∈ (π.cellGraph c').edgeSet) (hv : G₀.Inc e v) : + v ∈ (π.cellGraph c').vertexSet := by + have hle := π.cellGraph_le c' hc' + have h : v ∈ (π.cellGraph c').ends e := by + rw [← hle.ends_eq e he] + exact hv + exact (π.cellGraph c').vertex_mem_of_inc h + +theorem isComplemented_cellRooted (hdom : π.domγ = π.Γ.N) (hr : G₀.rootSet = ∅) {c : Set π.S} + (hc : c ∈ π.Γ.C) : IsComplemented G₀ (π.cellRooted c) where + le := π.cellGraph_le c hc + roots_mem v _ hv := by + rw [hr] at hv + exact hv.elim + inc_diff_mem v e hv he hinc := by + obtain ⟨c', hc', hec'⟩ := π.p1_edge e he.1 + have hne : c' ≠ c := by + rintro rfl + exact he.2 hec' + rw [rootSet_cellRooted hdom hc] + exact mem_rootsOf_of_other hdom hc hc' hne hv (vertex_mem_of_inc hc' hec' hinc) + +/-- `ℒ = {A_c}` is a rooted location: for distinct `c, c'` the vertices shared by `α(c')` and +`α(c)` are roots of `A_c` and the edges of `α(c)`, `α(c')` are disjoint by (P1). -/ +theorem isRootedLocation (hdom : π.domγ = π.Γ.N) (hr : G₀.rootSet = ∅) : + IsRootedLocation G₀ π.cellLocation where + isComplemented := by + rintro _ ⟨c, hc, rfl⟩ + exact isComplemented_cellRooted hdom hr hc + le_complement := by + rintro _ ⟨c₁, hc₁, rfl⟩ _ ⟨c₂, hc₂, rfl⟩ hne + have hc₁₂ : c₁ ≠ c₂ := fun h ↦ hne (by rw [h]) + have hle₁ := π.cellGraph_le c₁ hc₁ + have hedge : ∀ e ∈ (π.cellGraph c₁).edgeSet, e ∉ (π.cellGraph c₂).edgeSet := fun e he he₂ ↦ + Set.disjoint_left.mp (π.p1_disjoint c₁ hc₁ c₂ hc₂ hc₁₂) he he₂ + refine ⟨?_, ?_, ?_⟩ + · intro v hv + by_cases hv₂ : v ∈ (π.cellGraph c₂).vertexSet + · refine Or.inr ?_ + rw [rootSet_cellRooted hdom hc₂] + exact mem_rootsOf_of_other hdom hc₂ hc₁ hc₁₂ hv₂ hv + · exact Or.inl ⟨hle₁.vertexSet_subset hv, hv₂⟩ + · exact fun e he ↦ ⟨hle₁.edgeSet_subset he, hedge e he⟩ + · intro e he + have hE : ∀ v, v ∈ G₀.ends e ↔ v ∈ (π.cellGraph c₁).ends e := fun v ↦ by + rw [hle₁.ends_eq e he] + ext v + exact ⟨fun ⟨_, h⟩ ↦ (hE v).mp h, fun h ↦ ⟨⟨hle₁.edgeSet_subset he, hedge e he⟩, (hE v).mpr h⟩⟩ + +/-- (P1): `ℒ` is fine. -/ +theorem isFine_cellLocation : IsFine G₀ π.cellLocation := by + refine ⟨fun v hv ↦ ?_, fun e he ↦ ?_⟩ + · obtain ⟨c, hc, h⟩ := π.p1_vertex v hv + exact ⟨_, ⟨c, hc, rfl⟩, h⟩ + · obtain ⟨c, hc, h⟩ := π.p1_edge e he + exact ⟨_, ⟨c, hc, rfl⟩, h⟩ + +theorem cellLocation_finite : π.cellLocation.Finite := π.Γ.finite_cells.image _ + +/-- The rooted hypergraphs of distinct cells are different. The roots that are images of nodes +determine `cTilde`, and two cells with the same `cTilde` are excluded by (8.8) of Graph Minors XVII. +This is where +the hypotheses `h₂`, `h₃` are used. -/ +theorem injOn_cellRooted (hdom : π.domγ = π.Γ.N) + (hbd : ∀ c ∈ π.Γ.C, (c ∩ bd π.S).Nonempty → ∀ n ∈ tilde c, + Disjoint (π.borderSet n) (π.nodeVertex '' π.Γ.N)) + (hsize : ∀ c ∈ π.Γ.C, (c ∩ bd π.S).Nonempty → (tilde c).ncard = 2) + (h₈₈ : ∀ c₁ ∈ π.Γ.C, ∀ c₂ ∈ π.Γ.C, c₁ ≠ c₂ → tilde c₁ ⊆ tilde c₂ → + (c₁ ∩ bd π.S).Nonempty ∧ (tilde c₂).ncard = 3) : + InjOn π.cellRooted π.Γ.C := by + intro c₁ hc₁ c₂ hc₂ heq + by_contra hne + have hroots : π.rootsOf c₁ = π.rootsOf c₂ := by + rw [← rootSet_cellRooted hdom hc₁, ← rootSet_cellRooted hdom hc₂, heq] + have hsub : ∀ {c c' : Set π.S}, c ∈ π.Γ.C → c' ∈ π.Γ.C → π.rootsOf c = π.rootsOf c' → + tilde c ⊆ tilde c' := by + intro c c' hc hc' h n hn + have hnN := tilde_subset_nodes π.Γ hc hn + have hmem : π.nodeVertex n ∈ π.rootsOf c' := h ▸ Or.inl ⟨n, hn, rfl⟩ + rcases hmem with ⟨m, hm, hmn⟩ | ⟨hb, m, hm, hv⟩ + · have hmN := tilde_subset_nodes π.Γ hc' hm + rw [π.nodeVertex_injOn (hdom ▸ hmN) (hdom ▸ hnN) hmn] at hm + exact hm + · exact (Set.disjoint_left.mp (hbd c' hc' hb m hm) hv ⟨n, hnN, rfl⟩).elim + obtain ⟨hb, h₃⟩ := h₈₈ c₁ hc₁ c₂ hc₂ hne (hsub hc₁ hc₂ hroots) + have heq' : tilde c₁ = tilde c₂ := (hsub hc₁ hc₂ hroots).antisymm (hsub hc₂ hc₁ hroots.symm) + have := hsize c₁ hc₁ hb + rw [heq'] at this + omega + +end GraphMinor.GM17.Portrayal diff --git a/LeanPool/GraphMinor/GM20/Section10g.lean b/LeanPool/GraphMinor/GM20/Section10g.lean new file mode 100644 index 0000000000..bbf3b168c2 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section10g.lean @@ -0,0 +1,168 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section10f +public import LeanPool.GraphMinor.GM20.Section9h + +/-! +# Graph Minors XX, Section 10: the hull of a portrayal + +We go on with the proof of (10.3). From a portrayal `π` with the properties that Graph Minors XVII +proves for true portrayals, we build the hypergraph `G'` with `V(G') = N(Γ) ∪ ⋃ β(n)` and with one +edge for each cell. It is a heart of `(G, ℒ)`, and `(Γ, β)` is a hull for it (`isHull`). The final +result `isShelled_of_portrayal` says that `(P, ℒ)` is shelled. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface GraphMinor.GM17 GraphMinor.GM18 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- For a cuff `Θ`, each node `n` on `Θ` lies in `cTilde` for two different cells that meet `Θ`. +These are +the two cells of the cycle around `Θ` next to `n`. -/ +theorem exists_two_cells {S : Type} [TopologicalSpace S] (hS : IsSurface S) (Γ : Painting S) + {Θ : Set S} (hΘ : Θ ∈ cuffs S) {n : S} (hn : n ∈ Γ.N ∩ Θ) : + ∃ c₁ ∈ Γ.C, ∃ c₂ ∈ Γ.C, c₁ ≠ c₂ ∧ n ∈ tilde c₁ ∧ n ∈ tilde c₂ ∧ (c₁ ∩ Θ).Nonempty ∧ + (c₂ ∩ Θ).Nonempty := by + obtain ⟨-, -, harc⟩ := cuff_statement.{0} S hS + obtain ⟨f⟩ := harc Θ hΘ + obtain ⟨C⟩ := exists_cuffCycle Γ hΘ f + obtain ⟨m, hm, rfl⟩ := C.exists_pos n hn + have hk := C.two_le + have hne : ∀ l, (C.cell l ∩ Θ).Nonempty := fun l ↦ by + rw [C.cell_inter] + exact (nonempty_Ioo.mpr (C.strictMono (Nat.lt_succ_self l))).image _ + have hl : m + C.k - 1 + 1 = m + C.k := by omega + refine ⟨C.cell m, C.cell_mem m, C.cell (m + C.k - 1), C.cell_mem _, + C.cell_ne m _ (by omega) (by omega), ?_, ?_, hne _, hne _⟩ + · rw [C.tilde_eq] + exact Or.inl rfl + · rw [C.tilde_eq, hl, C.T_add, cuffPoint_add] + exact Or.inr rfl + +/-- If `V` has at most three members and any two are joined by a path that has no other member of +`V`, then each grouping `K` with `V(K) = V` is realized in the subgraph `C` given by the paths for +the adjacent pairs of `K`. At most one component of `K` has two or more members, so a nonadjacent +pair has a member isolated in `K`, and no path meets that member. -/ +theorem exists_realizing_subgraph {K₀ : SimpleGraph α} {V : Set α} (hfin : V.Finite) + (h₃ : V.ncard ≤ 3) + (hL : ∀ x ∈ V, ∀ y ∈ V, x ≠ y → ∃ L : PathFromTo K₀ {x} {y}, + ∀ z ∈ L.walk.support, z ∈ V → z = x ∨ z = y) + {K : (⊤ : SimpleGraph α).Subgraph} (hK : GM04.IsGrouping V K) (hverts : K.verts = V) : + ∃ C : SimpleGraph α, C ≤ K₀ ∧ ∀ x ∈ V, ∀ y ∈ V, x ≠ y → (C.Reachable x y ↔ K.Adj x y) := by + classical + obtain ⟨-, htrans⟩ := GM04.isGrouping_iff.mp hK + let good : α → α → α → α → Prop := fun x y u v ↦ K.Adj x y ∧ ∃ L : PathFromTo K₀ {x} {y}, + (∀ z ∈ L.walk.support, z ∈ V → z = x ∨ z = y) ∧ s(u, v) ∈ L.walk.edges + let C : SimpleGraph α := + { Adj := fun u v ↦ ∃ x y, good x y u v + symm := ⟨fun u v ⟨x, y, h, L, h₁, h₂⟩ ↦ ⟨x, y, h, L, h₁, Sym2.eq_swap ▸ h₂⟩⟩ + loopless := ⟨fun u ⟨_, _, _, L, _, h₂⟩ ↦ (L.walk.adj_of_mem_edges h₂).ne rfl⟩ } + have hCle : C ≤ K₀ := fun u v ⟨_, _, _, L, _, h₂⟩ ↦ L.walk.adj_of_mem_edges h₂ + have hmemV : ∀ {x y}, K.Adj x y → x ∈ V ∧ y ∈ V := fun h ↦ + ⟨hverts ▸ K.edge_vert h, hverts ▸ K.edge_vert h.symm⟩ + have hiso : ∀ {u v}, u ∈ V → C.Adj u v → ∃ w, K.Adj u w := by + rintro u v hu ⟨x, y, hxy, L, h₁, h₂⟩ + rcases h₁ u (L.walk.fst_mem_support_of_mem_edges h₂) hu with rfl | rfl + · exact ⟨y, hxy⟩ + · exact ⟨x, hxy.symm⟩ + have hnotreach : ∀ {u v}, u ∈ V → u ≠ v → (¬ ∃ w, K.Adj u w) → ¬ C.Reachable u v := by + rintro u v hu hne hno ⟨p⟩ + cases p with + | nil => exact hne rfl + | cons h _ => exact hno (hiso hu h) + refine ⟨C, hCle, fun x hx y hy hxy ↦ ⟨fun hreach ↦ ?_, fun hadj ↦ ?_⟩⟩ + · by_contra hnadj + have hxno : ∃ w, K.Adj x w := by + by_contra h + exact hnotreach hx hxy h hreach + have hyno : ∃ w, K.Adj y w := by + by_contra h + exact hnotreach hy hxy.symm h hreach.symm + obtain ⟨a, ha⟩ := hxno + obtain ⟨b, hb⟩ := hyno + have hax : a ≠ x := ha.ne.symm + have hby : b ≠ y := hb.ne.symm + have hay : a ≠ y := fun h ↦ hnadj (h ▸ ha) + have hbx : b ≠ x := fun h ↦ hnadj (h ▸ hb.symm) + have hab : a ≠ b := fun h ↦ hnadj (htrans x a y hxy ha (h ▸ hb.symm)) + have hsub : (({x, y, a, b} : Finset α) : Set α) ⊆ V := by + intro z hz + simp only [Finset.coe_insert, Finset.coe_singleton, mem_insert_iff, mem_singleton_iff] at hz + rcases hz with rfl | rfl | rfl | rfl + · exact hx + · exact hy + · exact (hmemV ha).2 + · exact (hmemV hb).2 + have hcard : ({x, y, a, b} : Finset α).card = 4 := by + rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, + Finset.card_singleton] <;> simp [hxy, hab, hay.symm, hby.symm, hax.symm, hbx.symm] + have hle := Set.ncard_le_ncard hsub hfin + rw [Set.ncard_coe_finset, hcard] at hle + omega + · obtain ⟨L, hL'⟩ := hL x hx y hy hxy + have hfirst : L.first = x := L.first_mem + have hlast : L.last = y := L.last_mem + have hC : ∀ e ∈ L.walk.edges, e ∈ C.edgeSet := by + intro e he + induction e with + | _ u v => exact ⟨x, y, hadj, L, hL', he⟩ + have := (L.walk.transfer C hC).reachable + rwa [hfirst, hlast] at this + +end GraphMinor.GM20 + +namespace GraphMinor.GM17.Portrayal + +open Set Topology GraphMinor.Surface GraphMinor.GM18 GraphMinor.GM20 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- The graded surface `(Σ, ρ)` of a portrayal, with `ρ(Θ)` the warp of `π` at `Θ`. -/ +noncomputable abbrev gradedOf {G : Hypergraph α β} (π : Portrayal G) : GradedSurface where + S := π.S + isSurface := π.isSurface + connected := π.connected + ρ := π.warpAt + +/-- The painting of a portrayal, in the sense of Graph Minors XX, with the marches chosen freely. -/ +noncomputable def paintingOf' {G : Hypergraph α β} (π : Portrayal G) + (h₂ : ∀ c ∈ π.Γ.C, 2 ≤ (tilde c).ncard) : GM20.Painting π.S := + paintingOf π.Γ (fun c ↦ listOf (tilde c)) h₂ (fun _ _ ↦ nodup_listOf _) + (fun _ hc ↦ by + ext x + exact mem_listOf (π.Γ.cell_disc _ hc).2.2.1) + +variable {P : UnlabeledPatchwork α β} {π : Portrayal P.G.toHypergraph} + +/-- Each cell `c` bordering the boundary has `cTilde ⊆ bd(Σ)`. -/ +theorem tilde_subset_bd {c : Set π.S} (hc : c ∈ π.Γ.C) (hb : (c ∩ bd π.S).Nonempty) : + tilde c ⊆ bd π.S := by + intro n hn + obtain ⟨-, -, -, h⟩ := π.Γ.border_cell c hc hb + rw [← h] at hn + obtain ⟨v, f, h₀, -⟩ := hn + have := (f 0).2 + rw [h₀] at this + exact this.2 + +/-- A cell meeting the boundary meets some cuff. -/ +theorem exists_cuff_of_bd {x : π.S} (hx : x ∈ bd π.S) : ∃ Θ ∈ cuffs π.S, x ∈ Θ := + ⟨connectedComponentIn (bd π.S) x, ⟨x, hx, rfl⟩, mem_connectedComponentIn hx⟩ + +end GraphMinor.GM17.Portrayal diff --git a/LeanPool/GraphMinor/GM20/Section10h.lean b/LeanPool/GraphMinor/GM20/Section10h.lean new file mode 100644 index 0000000000..1fa19c01d8 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section10h.lean @@ -0,0 +1,164 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section10g + +/-! +# Graph Minors XX, Section 10: the hull of a portrayal, continued + +Let `π` be a portrayal of a rootless hypergraph `G`, with the properties that Graph Minors XVII +proves +for a true portrayal, and let `G'` be the heart of `(G, ℒ)`, for the location `ℒ` of Section10f. +Then `(Γ, β)` is a hull for `G'` (`hullOf`), and `(P, ℒ)` is shelled (`isShelled_of_portrayal`). +-/ + +@[expose] public section + +namespace GraphMinor.GM17.Portrayal + +open Set Topology GraphMinor.Surface GraphMinor.GM18 GraphMinor.GM20 + +universe u v + +variable {α : Type u} {β : Type v} {P : UnlabeledPatchwork α β} {π : Portrayal P.G.toHypergraph} + {e : RootedHypergraph α β → β} {Q : UnlabeledPatchwork α β} + +theorem ends_cell (hdom : π.domγ = π.Γ.N) (hQ : IsPatchworkHeart P π.cellLocation e Q) + {c : Set π.S} (hc : c ∈ π.Γ.C) : Q.G.ends (e (π.cellRooted c)) = π.rootsOf c := by + rw [hQ.ends_newEdge ⟨c, hc, rfl⟩, rootSet_cellRooted hdom hc] + +/-- A node's vertex is a vertex of the heart, since by (8.7) of Graph Minors XVII it is a root of +each +`A_c` that contains it. -/ +theorem node_mem_heart (hdom : π.domγ = π.Γ.N) + (h₈₇ : ∀ n ∈ π.Γ.N, ∃ c₁ ∈ π.Γ.C, ∃ c₂ ∈ π.Γ.C, c₁ ≠ c₂ ∧ n ∈ tilde c₁ ∧ n ∈ tilde c₂) + (hQ : IsPatchworkHeart P π.cellLocation e Q) {n : π.S} (hn : n ∈ π.Γ.N) : + π.nodeVertex n ∈ Q.G.vertexSet := by + rw [hQ.vertexSet_eq, mem_core_iff] + refine ⟨π.nodeVertex_mem n (hdom ▸ hn), ?_⟩ + rintro _ ⟨c, hc, rfl⟩ hv + rw [rootSet_cellRooted hdom hc] + obtain ⟨c₁, hc₁, c₂, hc₂, hne, h₁, h₂⟩ := h₈₇ n hn + by_cases h : c₁ = c + · have hne' : c₂ ≠ c := fun h' ↦ hne (h.trans h'.symm) + exact mem_rootsOf_of_other hdom hc hc₂ hne' hv (π.p2 c₂ hc₂ n ⟨h₂, hdom ▸ hn⟩) + · exact mem_rootsOf_of_other hdom hc hc₁ h hv (π.p2 c₁ hc₁ n ⟨h₁, hdom ▸ hn⟩) + +/-- For a node `n` on the boundary, `β(n)` lies in `V(G')`, since `n ∈ cTilde` for a border cell +`c`. -/ +theorem border_mem_heart (hdom : π.domγ = π.Γ.N) (hr : P.G.rootSet = ∅) + (h₂ : ∀ c ∈ π.Γ.C, 2 ≤ (tilde c).ncard) (hQ : IsPatchworkHeart P π.cellLocation e Q) + {n : π.S} (hn : n ∈ π.Γ.N ∩ bd π.S) : π.borderSet n ⊆ Q.G.vertexSet := by + intro v hv + obtain ⟨Θ, hΘ, hnΘ⟩ := exists_cuff_of_bd hn.2 + obtain ⟨c, hc, -, -, -, hnc, -, hcΘ, -⟩ := + exists_two_cells π.isSurface (π.paintingOf' h₂) hΘ ⟨hn.1, hnΘ⟩ + rw [hQ.vertexSet_eq] + have hroot : v ∈ (π.cellRooted c).rootSet := by + rw [rootSet_cellRooted hdom hc] + obtain ⟨x, hxc, hxΘ⟩ := hcΘ + exact Or.inr ⟨⟨x, hxc, cuff_subset_bd hΘ hxΘ⟩, n, hnc, hv⟩ + exact root_mem_core (isRootedLocation hdom hr) ⟨c, hc, rfl⟩ hroot + +/-- `(Γ, β)` is a `(Σ, ρ)`-hull for the heart `G'`. -/ +noncomputable def hullOf (hdom : π.domγ = π.Γ.N) (hr : P.G.rootSet = ∅) + (h₂ : ∀ c ∈ π.Γ.C, 2 ≤ (tilde c).ncard) + (h₈₇ : ∀ n ∈ π.Γ.N, ∃ c₁ ∈ π.Γ.C, ∃ c₂ ∈ π.Γ.C, c₁ ≠ c₂ ∧ n ∈ tilde c₁ ∧ n ∈ tilde c₂) + (hbd : ∀ c ∈ π.Γ.C, (c ∩ bd π.S).Nonempty → ∀ n ∈ tilde c, + Disjoint (π.borderSet n) (π.nodeVertex '' π.Γ.N)) + (hρ : ∀ Θ ∈ cuffs π.S, ∀ c ∈ π.Γ.C, (c ∩ Θ).Nonempty → ∀ n ∈ tilde c, + (π.borderSet n).ncard = π.warpAt Θ) + (he : InjOn e π.cellLocation) (hinj : InjOn π.cellRooted π.Γ.C) + (hQ : IsPatchworkHeart P π.cellLocation e Q) (hE : Q.G.edgeSet = e '' π.cellLocation) : + Hull (X := π.gradedOf) (π.paintingOf' h₂) Q.G.toHypergraph where + node := π.nodeVertex + cell := fun c ↦ e (π.cellRooted c) + border := π.borderSet + node_injOn := by + have h := π.nodeVertex_injOn + rw [hdom] at h + exact h + node_mem _ hn := node_mem_heart hdom h₈₇ hQ hn + cell_bijOn := by + refine ⟨fun c hc ↦ ?_, fun c₁ h₁ c₂ h₂' h ↦ hinj h₁ h₂' (he ⟨c₁, h₁, rfl⟩ ⟨c₂, h₂', rfl⟩ h), ?_⟩ + · rw [hE] + exact ⟨_, ⟨c, hc, rfl⟩, rfl⟩ + · intro f hf + rw [hE] at hf + obtain ⟨_, ⟨c, hc, rfl⟩, rfl⟩ := hf + exact ⟨c, hc, rfl⟩ + inc_iff n hn c hc := by + have h := ends_cell hdom hQ hc + change n ∈ tilde c ↔ π.nodeVertex n ∈ Q.G.ends (e (π.cellRooted c)) + rw [h] + refine ⟨fun h ↦ Or.inl ⟨n, h, rfl⟩, ?_⟩ + rintro (⟨m, hm, hmn⟩ | ⟨hb, m, hm, hv⟩) + · have hmN : m ∈ π.Γ.N := tilde_subset_nodes π.Γ hc hm + rwa [π.nodeVertex_injOn (hdom ▸ hmN) (hdom ▸ hn) hmn] at hm + · exact (Set.disjoint_left.mp (hbd c hc hb m hm) hv ⟨n, hn, rfl⟩).elim + border_subset _ hn := border_mem_heart hdom hr h₂ hQ hn + border_disjoint n hn := by + obtain ⟨Θ, hΘ, hnΘ⟩ := exists_cuff_of_bd hn.2 + obtain ⟨c, hc, -, -, -, hnc, -, ⟨x, hxc, hxΘ⟩, -⟩ := + exists_two_cells π.isSurface (π.paintingOf' h₂) hΘ ⟨hn.1, hnΘ⟩ + exact hbd c hc ⟨x, hxc, cuff_subset_bd hΘ hxΘ⟩ n hnc + border_ncard Θ hΘ n hn := by + obtain ⟨c, hc, -, -, -, hnc, -, hcΘ, -⟩ := + exists_two_cells π.isSurface (π.paintingOf' h₂) hΘ hn + exact hρ Θ hΘ c hc hcΘ n hnc + border_cuffs := π.p4_disjoint + vertexSet_eq := by + apply Subset.antisymm + · intro v hv + rw [hQ.vertexSet_eq, mem_core_iff] at hv + obtain ⟨hvG, hroot⟩ := hv + obtain ⟨c, hc, hvc⟩ := π.p1_vertex v hvG + have h := hroot _ ⟨c, hc, rfl⟩ hvc + rw [rootSet_cellRooted hdom hc] at h + rcases h with ⟨n, hn, rfl⟩ | ⟨hb, n, hn, hv⟩ + · exact Or.inl ⟨n, tilde_subset_nodes π.Γ hc hn, rfl⟩ + · exact Or.inr (mem_biUnion (x := n) ⟨tilde_subset_nodes π.Γ hc hn, + tilde_subset_bd hc hb hn⟩ hv) + · rintro v (⟨n, hn, rfl⟩ | hv) + · exact node_mem_heart hdom h₈₇ hQ hn + · obtain ⟨n, hn, hv⟩ := mem_iUnion₂.mp hv + exact border_mem_heart hdom hr h₂ hQ hn hv + ends_internal c hc hb := by + rw [ends_cell hdom hQ hc] + ext v + constructor + · rintro (h | ⟨h, -⟩) + · exact h + · exact (hb h).elim + · exact Or.inl + ends_border c hc hb := by + rw [ends_cell hdom hQ hc] + ext v + constructor + · rintro (h | ⟨-, n, hn, hv⟩) + · exact Or.inl h + · exact Or.inr (mem_biUnion hn hv) + · rintro (h | h) + · exact Or.inl h + · obtain ⟨n, hn, hv⟩ := mem_iUnion₂.mp h + exact Or.inr ⟨hb, n, hn, hv⟩ + border_order Θ hΘ n₁ h₁ n₂ h₂' n₃ h₃ n₄ h₄ hord v hv := by + have hdisj : v ∉ π.nodeVertex '' π.Γ.N := by + obtain ⟨c, hc, -, -, -, hnc, -, ⟨x, hxc, hxΘ⟩, -⟩ := + exists_two_cells π.isSurface (π.paintingOf' h₂) hΘ h₁ + exact Set.disjoint_left.mp (hbd c hc ⟨x, hxc, cuff_subset_bd hΘ hxΘ⟩ n₁ hnc) hv.1 + rcases π.p7 Θ hΘ n₁ h₁ n₂ h₂' n₃ h₃ n₄ h₄ hord v (Or.inl hv.1) (Or.inl hv.2) with + (h | ⟨-, h⟩) | (h | ⟨-, h⟩) + · exact Or.inl h + · exact (hdisj ⟨n₂, h₂'.1, h.symm⟩).elim + · exact Or.inr h + · exact (hdisj ⟨n₄, h₄.1, h.symm⟩).elim + +end GraphMinor.GM17.Portrayal diff --git a/LeanPool/GraphMinor/GM20/Section10i.lean b/LeanPool/GraphMinor/GM20/Section10i.lean new file mode 100644 index 0000000000..ea11afffbf --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section10i.lean @@ -0,0 +1,76 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section10h + +/-! +# Graph Minors XX, Section 10: the properties of the location of a true portrayal + +We finish the part of the proof of (10.3) that uses Graph Minors XVII. For a portrayal `π` that +meets +the standing hypothesis of Section 8 of that paper, `(P, ℒ)` is shelled (`isShelled_of_standing`). +With the +stronger standing hypothesis of Section 11, `ℒ` is linked to `𝒯` (`isLinkedTo_of_standing`). +The deductions using other proved results are in `Section10iProved`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20.GM17.Standing + +open GraphMinor.GM17 + +variable {α : Type*} {β : Type*} {G : Hypergraph α β} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} + {θ p r t r' t' : ℕ} {π : Portrayal G} + +/-- The standing hypothesis gets weaker when `r` and `t` decrease. -/ +theorem mono (h : Standing 𝒯 θ p r t π) (hr : r' ≤ r) (ht : t' ≤ t) : + Standing 𝒯 θ p r' t' π where + isTangle := h.isTangle + isTrue := h.isTrue + isRedundant := ⟨by have := h.isRedundant.1; omega, + fun Z hZ hZc ↦ h.isRedundant.2 Z hZ (hZc.trans hr)⟩ + warp_le := h.warp_le + lt := by have := h.lt; omega + +end GraphMinor.GM20.GM17.Standing + +namespace GraphMinor.GM17.Portrayal + +open Set Topology GraphMinor.Surface GraphMinor.GM18 GraphMinor.GM20 GraphMinor.GM10 + GraphMinor.GM20.GM17 + +universe u v + +variable {α : Type u} {β : Type v} {P : UnlabeledPatchwork α β} {π : Portrayal P.G.toHypergraph} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + +/-- The warp at a cuff is at most the warp. -/ +theorem warpAt_le_warp_of_mem {G : Hypergraph α β} (π : Portrayal G) {Θ : Set π.S} + (hΘ : Θ ∈ cuffs π.S) : π.warpAt Θ ≤ π.warp := by + classical + obtain ⟨-, hfin, -⟩ := cuff_statement.{0} π.S π.isSurface + unfold warp + rw [ite_eq_left ⟨Θ, hΘ⟩] + apply le_trans _ (le_max_right 1 _) + refine le_csSup ?_ ⟨Θ, hΘ, rfl⟩ + refine (hfin.image π.warpAt).bddAbove.mono ?_ + rintro _ ⟨Θ', h, rfl⟩ + exact ⟨Θ', h, rfl⟩ + +/-- A second attachment of a cell. -/ +theorem exists_other_end {G : Hypergraph α β} {π : Portrayal G} + (h₂ : ∀ c ∈ π.Γ.C, 2 ≤ (tilde c).ncard) {c : Set π.S} (hc : c ∈ π.Γ.C) (n : π.S) : + ∃ m ∈ tilde c, m ≠ n := by + have h : 1 < (tilde c).ncard := h₂ c hc + exact Set.exists_ne_of_one_lt_ncard h n + + +end GraphMinor.GM17.Portrayal diff --git a/LeanPool/GraphMinor/GM20/Section10iProved.lean b/LeanPool/GraphMinor/GM20/Section10iProved.lean new file mode 100644 index 0000000000..73393b72ce --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section10iProved.lean @@ -0,0 +1,247 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section10i + +import LeanPool.GraphMinor.GM17.Bridge + +/-! +# Graph Minors XX: deductions from Section10i + +The deductions apply the proved results after their geometric prerequisites. +-/ + +public section +namespace GraphMinor.GM17.Portrayal +open Set Topology GraphMinor.Surface GraphMinor.GM18 GraphMinor.GM20 GraphMinor.GM10 + GraphMinor.GM20.GM17 +universe u v +variable {α : Type u} {β : Type v} {P : UnlabeledPatchwork α β} {π : Portrayal P.G.toHypergraph} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {θ p : ℕ} + +/-- A consequence of (8.7) of Graph Minors XVII: two cells at each node. -/ +theorem two_cells_of_87 {G : Hypergraph α β} {π : Portrayal G} + (h₈₇ : ∀ n ∈ π.Γ.N, 2 ≤ {c ∈ starCells π.Γ | n ∈ tilde c}.ncard) : + ∀ n ∈ π.Γ.N, ∃ c₁ ∈ π.Γ.C, ∃ c₂ ∈ π.Γ.C, c₁ ≠ c₂ ∧ n ∈ tilde c₁ ∧ n ∈ tilde c₂ := by + intro n hn + have hfinite : {c ∈ starCells π.Γ | n ∈ tilde c}.Finite := + π.Γ.finite_cells.subset fun _ hc ↦ hc.1.1 + obtain ⟨c₁, c₂, h₁, h₂, hne⟩ := (Set.one_lt_ncard_iff hfinite).mp (h₈₇ n hn) + exact ⟨c₁, h₁.1.1, c₂, h₂.1.1, hne, h₁.2, h₂.2⟩ + +variable {r t : ℕ} + +theorem isThreeConnected_of_standing + (hs : Standing 𝒯 θ p (2 * p + 3) (4 * p + 5) π) (h₂ : ∀ c ∈ π.Γ.C, 2 ≤ (tilde c).ncard) : + (π.paintingOf' h₂).IsThreeConnected := by + refine ⟨fun F hF hU hN ↦ ?_, fun F hF hU hN hbd ↦ ?_⟩ + · have hcount : (F ∩ π.Γ.N).ncard ≤ 2 := hN + obtain ⟨Δ, h₁, h₃, -, h₄⟩ := + GraphMinor.GM17.gm17Theorem85.{u, v} 𝒯 θ p π hs F hF hU (by omega) + rcases h₄ with ⟨h₅, h₆⟩ | ⟨h₅, -⟩ + · exact ⟨Δ, h₁, h₃, h₆, h₅⟩ + · have : (F ∩ π.Γ.N).ncard ≤ 2 := hN + omega + · obtain ⟨f⟩ := hF + have hend : ∀ {x : F}, (∃ t, IsLineWithEnds F x.1 t) → x.1 ∈ F ∩ π.Γ.N := by + intro x hx + have h₁ : x.1 ∈ F ∩ bd π.S := by + rw [hbd] + exact hx + exact ⟨x.2, hU ⟨x.2, π.Γ.bd_subset h₁.2⟩⟩ + have h₀ := hend (x := f 0) ⟨(f 1).1, f, rfl, rfl⟩ + have h₁ := hend (x := f 1) ⟨(f 0).1, unitInterval.symmHomeomorph.trans f, + by simp, by simp⟩ + have hne : (f 0).1 ≠ (f 1).1 := fun h ↦ zero_ne_one (f.injective (Subtype.ext h)) + have hfin : (F ∩ π.Γ.N).Finite := π.Γ.finite_N.subset inter_subset_right + have h₂' : 1 < (F ∩ π.Γ.N).ncard := (Set.one_lt_ncard_iff hfin).mpr ⟨_, _, h₀, h₁, hne⟩ + have hle : (F ∩ π.Γ.N).ncard ≤ 2 := hN + obtain ⟨Δ, h₃, h₄, h₅, h₆, h₇⟩ := GraphMinor.GM17.gm17Theorem83.{u, v} 𝒯 θ p π hs F ⟨f⟩ hU hbd + (by omega) + exact ⟨Δ, h₃, h₄, h₅, h₇.le, h₆⟩ + +/-- `(P, ℒ)` is shelled, by (8.2)-(8.5), (8.7), (8.8), (9.1) and (9.8) of Graph Minors XVII. -/ +theorem isShelled_of_standing [Infinite β] + (hr : P.G.rootSet = ∅) + (hs : Standing 𝒯 θ p (2 * p + 3) (4 * p + 5) π) : + IsShelled π.gradedOf P π.cellLocation := by + have hdom := GraphMinor.GM17.gm17Theorem84.{u, v} 𝒯 θ p π hs + have h₂ := (GraphMinor.GM17.gm17Theorem82.{u, v} 𝒯 θ p π hs).2 + have h₈₇ := two_cells_of_87 fun n hn ↦ (GraphMinor.GM17.gm17Theorem87.{u, v} 𝒯 θ p π hs n hn).1 + have h₉₈ := GraphMinor.GM17.gm17Theorem98.{u, v} 𝒯 θ p π hs + have hsize : ∀ c ∈ π.Γ.C, (c ∩ bd π.S).Nonempty → (tilde c).ncard = 2 := fun c hc hb ↦ + (π.Γ.border_cell c hc hb).1 + have hbd : ∀ c ∈ π.Γ.C, (c ∩ bd π.S).Nonempty → ∀ n ∈ tilde c, + Disjoint (π.borderSet n) (π.nodeVertex '' π.Γ.N) := by + rintro c hc ⟨x, hxc, hxb⟩ n hn + obtain ⟨Θ, hΘ, hxΘ⟩ := exists_cuff_of_bd hxb + obtain ⟨m, hm, hne⟩ := exists_other_end h₂ hc n + exact (h₉₈ Θ hΘ c hc ⟨x, hxc, hxΘ⟩ n hn m hm hne.symm).2.2.1 + have hρ : ∀ Θ ∈ cuffs π.S, ∀ c ∈ π.Γ.C, (c ∩ Θ).Nonempty → ∀ n ∈ tilde c, + (π.borderSet n).ncard = π.warpAt Θ := by + intro Θ hΘ c hc hcΘ n hn + obtain ⟨m, hm, hne⟩ := exists_other_end h₂ hc n + exact (h₉₈ Θ hΘ c hc hcΘ n hn m hm hne.symm).1 + have hinj := injOn_cellRooted hdom hbd hsize (GraphMinor.GM17.gm17Theorem88.{u, v} 𝒯 θ p π hs) + have hloc := isRootedLocation (π := π) hdom hr + have hfine : IsFine P.G π.cellLocation := isFine_cellLocation + have hne : Nonempty β := inferInstance + obtain ⟨e, he⟩ := exists_injOn_of_finite (δ := β) (cellLocation_finite (π := π)) + obtain ⟨Q, hQ⟩ := exists_heart hloc hfine cellLocation_finite he + have hE : Q.G.edgeSet = e '' π.cellLocation := by + rw [hQ.edgeSet_eq, core_edgeSet_eq_empty hfine, empty_union] + have hA : ∀ {c : Set π.S} {A}, c ∈ π.Γ.C → A ∈ π.cellLocation → e (π.cellRooted c) = e A → + π.cellRooted c = A := fun {c} {_} hc hA h ↦ he ⟨c, hc, rfl⟩ hA h + refine ⟨hfine, e, Q, π.paintingOf' h₂, hullOf hdom hr h₂ h₈₇ hbd hρ he hinj hQ hE, hQ, hE, + isThreeConnected_of_standing hs h₂, ?_, ?_⟩ + · intro c hc A hAmem hcell hb + obtain rfl := hA hc hAmem hcell + refine ⟨roots_cellRooted_internal hdom hc hb, fun K hK hverts ↦ ?_⟩ + have hfin : (π.nodeVertex '' tilde c).Finite := (tilde_finite hc).image _ + have h₃ : (π.nodeVertex '' tilde c).ncard ≤ 3 := + (Set.ncard_image_le (tilde_finite hc)).trans (π.Γ.cell_disc c hc).2.2.2 + rw [hverts] + refine exists_realizing_subgraph hfin h₃ ?_ hK hverts + rintro _ ⟨n₁, h₁, rfl⟩ _ ⟨n₂, h₂', rfl⟩ hne + exact GraphMinor.GM17.gm17Theorem91.{u, v} 𝒯 θ p π hs c hc hb n₁ h₁ n₂ h₂' fun h ↦ hne + (by rw [h]) + · intro c hc A hAmem hcell Θ hΘ hcΘ n₁ h₁ n₂ h₂' hne + obtain rfl := hA hc hAmem hcell + obtain ⟨-, -, -, -, L, h₃, h₄, h₅⟩ := h₉₈ Θ hΘ c hc hcΘ n₁ h₁ n₂ h₂' hne + refine ⟨L, h₃, h₄, ?_⟩ + rcases h₅ with h₅ | ⟨c', hc', hb', -, hsub⟩ + · exact Or.inl h₅ + · exact Or.inr ⟨c', hc', hb', hsub h₁, hsub h₂'⟩ + +/-- A cell has at most `2p + 3` roots: at most three nodes for an internal cell, and two nodes with +their +sets `β(n)` of size at most `p` for a border cell. -/ +theorem ncard_rootsOf_le + (hs : Standing 𝒯 θ p (2 * p + 3) (4 * p + 5) π) + {c : Set π.S} (hc : c ∈ π.Γ.C) : (π.rootsOf c).ncard ≤ 2 * p + 3 := by + have hdom := GraphMinor.GM17.gm17Theorem84.{u, v} 𝒯 θ p π hs + have hfinr := rootsOf_finite hdom hc + by_cases hb : (c ∩ bd π.S).Nonempty + · obtain ⟨n₁, n₂, hne, hti⟩ := Set.ncard_eq_two.mp (π.Γ.border_cell c hc hb).1 + obtain ⟨x, hxc, hxb⟩ := hb + obtain ⟨Θ, hΘ, hxΘ⟩ := exists_cuff_of_bd hxb + have h₁ : n₁ ∈ tilde c := hti ▸ Or.inl rfl + have h₂ : n₂ ∈ tilde c := hti ▸ Or.inr rfl + obtain ⟨hq₁, hq₂, -⟩ := GraphMinor.GM17.gm17Theorem98.{u, v} 𝒯 θ p π hs Θ hΘ c hc ⟨x, hxc, hxΘ⟩ + n₁ h₁ n₂ h₂ hne + have hq : π.warpAt Θ ≤ p := (warpAt_le_warp_of_mem π hΘ).trans hs.warp_le + have hf₁ : (π.borderSet n₁).Finite := hfinr.subset fun v hv ↦ Or.inr ⟨⟨x, hxc, hxb⟩, n₁, h₁, hv⟩ + have hf₂ : (π.borderSet n₂).Finite := hfinr.subset fun v hv ↦ Or.inr ⟨⟨x, hxc, hxb⟩, n₂, h₂, hv⟩ + have hsub : π.rootsOf c ⊆ ({π.nodeVertex n₁, π.nodeVertex n₂} ∪ π.borderSet n₁) ∪ + π.borderSet n₂ := by + rintro v (⟨n, hn, rfl⟩ | ⟨-, n, hn, hv⟩) + · rw [hti] at hn + rcases hn with rfl | rfl + · exact Or.inl (Or.inl (Or.inl rfl)) + · exact Or.inl (Or.inl (Or.inr rfl)) + · rw [hti] at hn + rcases hn with rfl | rfl + · exact Or.inl (Or.inr hv) + · exact Or.inr hv + have hfp : ({π.nodeVertex n₁, π.nodeVertex n₂} : Set α).Finite := by simp + have h₃ := Set.ncard_le_ncard hsub ((hfp.union hf₁).union hf₂) + have h₄ := Set.ncard_union_le ({π.nodeVertex n₁, π.nodeVertex n₂} ∪ π.borderSet n₁) + (π.borderSet n₂) + have h₅ := Set.ncard_union_le ({π.nodeVertex n₁, π.nodeVertex n₂} : Set α) (π.borderSet n₁) + have h₆ : ({π.nodeVertex n₁, π.nodeVertex n₂} : Set α).ncard ≤ 2 := by + have := Set.ncard_insert_le (π.nodeVertex n₁) ({π.nodeVertex n₂} : Set α) + rwa [Set.ncard_singleton] at this + omega + · have hsub : π.rootsOf c ⊆ π.nodeVertex '' tilde c := by + rintro v (h | ⟨h, -⟩) + · exact h + · exact (hb h).elim + have h₁ := Set.ncard_le_ncard hsub ((tilde_finite hc).image _) + have h₂ := Set.ncard_image_le (f := π.nodeVertex) (tilde_finite hc) + have h₃ := (π.Γ.cell_disc c hc).2.2.2 + omega + +/-- Each root of `A_c` lies in another cell. For `γ(n)` this is (8.7) of Graph Minors XVII. For +`v ∈ β(n)` with `n` on a cuff, take the other cell of the cuff at `n`. -/ +theorem rootsOf_subset_other + (hs : Standing 𝒯 θ p (2 * p + 3) (4 * p + 5) π) {c : Set π.S} (hc : c ∈ π.Γ.C) : + π.rootsOf c ⊆ (π.cellGraph c).vertexSet ∩ π.otherVertices c := by + have hdom := GraphMinor.GM17.gm17Theorem84.{u, v} 𝒯 θ p π hs + have h₂ := (GraphMinor.GM17.gm17Theorem82.{u, v} 𝒯 θ p π hs).2 + have h₈₇ := two_cells_of_87 fun n hn ↦ (GraphMinor.GM17.gm17Theorem87.{u, v} 𝒯 θ p π hs n hn).1 + intro v hv + refine ⟨rootsOf_subset hdom hc hv, ?_⟩ + rcases hv with ⟨n, hn, rfl⟩ | ⟨hb, n, hn, hv⟩ + · have hnN := tilde_subset_nodes π.Γ hc hn + obtain ⟨c₁, hc₁, c₂, hc₂, hne, h₁, h₃⟩ := h₈₇ n hnN + by_cases h : c₁ = c + · exact ⟨c₂, hc₂, fun h' ↦ hne (h.trans h'.symm), π.p2 c₂ hc₂ n ⟨h₃, hdom ▸ hnN⟩⟩ + · exact ⟨c₁, hc₁, h, π.p2 c₁ hc₁ n ⟨h₁, hdom ▸ hnN⟩⟩ + · have hnN := tilde_subset_nodes π.Γ hc hn + obtain ⟨Θ, hΘ, hnΘ⟩ := exists_cuff_of_bd (tilde_subset_bd hc hb hn) + obtain ⟨c₁, hc₁, c₂, hc₂, hne, h₁, h₃, ⟨x₁, h₄, h₅⟩, ⟨x₂, h₆, h₇⟩⟩ := + exists_two_cells π.isSurface (π.paintingOf' h₂) hΘ ⟨hnN, hnΘ⟩ + by_cases h : c₁ = c + · exact ⟨c₂, hc₂, fun h' ↦ hne (h.trans h'.symm), + π.p3_subset c₂ hc₂ ⟨x₂, h₆, cuff_subset_bd hΘ h₇⟩ n h₃ hv⟩ + · exact ⟨c₁, hc₁, h, π.p3_subset c₁ hc₁ ⟨x₁, h₄, cuff_subset_bd hΘ h₅⟩ n h₁ hv⟩ + +/-- `ℒ` is linked to `𝒯`. Since `π` is `𝒯`-central, `α(c)` is the small side of a member of `𝒯`, and +so +`(A_c⁻, (G \ A_c)⁻)` is in `𝒯`, by the first two tangle axioms. The second part is (11.7) of Graph +Minors XVII, since every root of `A_c` lies in `α(c) ∩ α(-c)`. -/ +theorem isLinkedTo_of_standing + (hr : P.G.rootSet = ∅) (hs : Standing 𝒯 θ p (2 * p + 4) (6 * p + 8) π) : + IsLinkedTo P.G 𝒯 π.cellLocation := by + have hs₈ : Standing 𝒯 θ p (2 * p + 3) (4 * p + 5) π := hs.mono (by omega) (by omega) + have hdom := GraphMinor.GM17.gm17Theorem84.{u, v} 𝒯 θ p π hs₈ + have h𝒯 := hs.isTangle + constructor + · rintro _ ⟨_, ⟨c, hc, rfl⟩, rfl⟩ + have hcomp := isComplemented_cellRooted hdom hr hc + have hsep := isSeparation_complement hcomp + have hord : Hypergraph.separationOrder (π.cellRooted c).toHypergraph + (complementHypergraph P.G (π.cellRooted c)) < θ := by + have h₁ := separationOrder_complement_le (G := P.G) (A := π.cellRooted c) + rw [rootSet_cellRooted hdom hc] at h₁ + have h₂ := ncard_rootsOf_le hs₈ hc + have h₃ := hs.lt + omega + rcases h𝒯.axiom1 hsep hord with h | h + · exact h + · exfalso + obtain ⟨B, hB⟩ := hs.isTrue.1 c hc + have heq := hsep.union_eq + refine h𝒯.axiom2 hB h h ?_ + have hu : (π.cellGraph c ∪ complementHypergraph P.G (π.cellRooted c)) ∪ + complementHypergraph P.G (π.cellRooted c) = + π.cellGraph c ∪ complementHypergraph P.G (π.cellRooted c) := by + refine Hypergraph.ext ?_ ?_ ?_ + · exact Set.union_eq_left.mpr subset_union_right + · exact Set.union_eq_left.mpr subset_union_right + · funext e v + exact propext ⟨fun h ↦ h.elim id Or.inr, Or.inl⟩ + rw [hu] + exact heq + · rintro _ ⟨c, hc, rfl⟩ A' B' hmem hle - + have hsub := rootsOf_subset_other hs₈ hc + have hfin : ((π.cellGraph c).vertexSet ∩ π.otherVertices c).Finite := + (π.cellGraph c).vertexSet_finite.subset inter_subset_left + have hk := Set.ncard_le_ncard hsub hfin + rw [rootSet_cellRooted hdom hc] + by_contra hlt + have hlt' := not_le.mp hlt + have hle' : Hypergraph.separationOrder A' B' ≤ ((π.cellGraph c).vertexSet ∩ π.otherVertices + c).ncard := by + omega + have heq := GraphMinor.GM17.gm17Theorem117.{u, v} 𝒯 θ p π hs c hc hmem hle hle' + omega + +end GraphMinor.GM17.Portrayal diff --git a/LeanPool/GraphMinor/GM20/Section10j.lean b/LeanPool/GraphMinor/GM20/Section10j.lean new file mode 100644 index 0000000000..0be37f35ac --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section10j.lean @@ -0,0 +1,187 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section10i +public import LeanPool.GraphMinor.Surface.PlaneDisc +import LeanPool.GraphMinor.GM07.Defs + +/-! +# Graph Minors XX, Section 10: paintings move along homeomorphisms + +The set `𝒮` of (10.3) is finite only up to homeomorphism. So the proof needs that a homeomorphism +`ψ : Σ → Σ'` carries a shelled patchwork over `Σ` to one over `Σ'`. This file carries a painting and +its +3-connectivity. Every notion here is topological, and each lemma says that `ψ` respects one of them. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface + +variable {S T : Type} [TopologicalSpace S] [TopologicalSpace T] (ψ : S ≃ₜ T) + +theorem image_tilde (c : Set S) : tilde (ψ '' c) = ψ '' tilde c := + Surface.image_tilde_homeomorph ψ c + +theorem image_arcComponentsIn (F : Set S) : + arcComponentsIn (ψ '' F) = (fun c ↦ ψ '' c) '' arcComponentsIn F := + GM07.arcComponentsIn_image_homeo ψ F + +theorem image_isClosedDisc {Δ : Set S} (h : IsClosedDisc Δ) : IsClosedDisc (ψ '' Δ) := + Surface.image_isClosedDisc_homeomorph ψ h + +theorem image_isOArc {F : Set S} (h : IsOArc F) : IsOArc (ψ '' F) := + Surface.image_isOArc_homeomorph ψ h + +theorem image_isLine {F : Set S} (h : IsLine F) : IsLine (ψ '' F) := + Surface.image_isLine_homeomorph ψ h + +theorem image_discBd (Δ : Set S) : discBd (ψ '' Δ) = ψ '' discBd Δ := + Surface.image_discBd_homeomorph ψ Δ + +theorem image_lineEnds_subset (F : Set S) : ψ '' lineEnds F ⊆ lineEnds (ψ '' F) := + Surface.image_lineEnds_subset_homeomorph ψ F + +theorem image_lineEnds (F : Set S) : lineEnds (ψ '' F) = ψ '' lineEnds F := + Surface.image_lineEnds_homeomorph ψ F + +theorem image_cuffs : cuffs T = (fun c ↦ ψ '' c) '' cuffs S := + Surface.image_cuffs_homeomorph ψ + +theorem image_inOrderOn {Θ : Set S} {n₁ n₂ n₃ n₄ : S} (h : GM19.InOrderOn Θ n₁ n₂ n₃ n₄) : + GM19.InOrderOn (ψ '' Θ) (ψ n₁) (ψ n₂) (ψ n₃) (ψ n₄) := by + obtain ⟨f, t₁, t₂, t₃, t₄, h₁, h₂, h₃, h₄, rfl, rfl, rfl, rfl⟩ := h + refine ⟨f.trans (ψ.image Θ), t₁, t₂, t₃, t₄, h₁, h₂, h₃, h₄, ?_, ?_, ?_, ?_⟩ <;> rfl + +theorem preimage_image_symm (F : Set T) : ψ '' (ψ.symm '' F) = F := by + rw [← image_comp] + simp + +/-- The painting `ψ(Γ)` in `T`. -/ +noncomputable def Painting.map (Γ : Painting S) : Painting T where + U := ψ '' Γ.U + N := ψ '' Γ.N + γ c := (Γ.γ (ψ.symm '' c)).map ψ + isClosed_U := ψ.isClosed_image.mpr Γ.isClosed_U + N_subset := image_mono Γ.N_subset + finite_N := Γ.finite_N.image _ + bd_subset := by + rw [← image_bd_homeomorph ψ] + exact image_mono Γ.bd_subset + finite_cells := by + rw [← image_sdiff ψ.injective, image_arcComponentsIn] + exact Γ.finite_cells.image _ + cell_disc := by + rw [← image_sdiff ψ.injective, image_arcComponentsIn] + rintro _ ⟨c, hc, rfl⟩ + change IsClosedDisc (closure (ψ '' c)) + rw [← ψ.image_closure] + exact image_isClosedDisc ψ (Γ.cell_disc c hc) + cell_size := by + rw [← image_sdiff ψ.injective, image_arcComponentsIn] + rintro _ ⟨c, hc, rfl⟩ + change (tilde (ψ '' c)).Finite ∧ _ + rw [image_tilde, Set.ncard_image_of_injective _ ψ.injective] + exact ⟨(Γ.cell_size c hc).1.image _, (Γ.cell_size c hc).2⟩ + closure_inter := by + rw [← image_sdiff ψ.injective, image_arcComponentsIn] + rintro _ ⟨c, hc, rfl⟩ + change closure (ψ '' c) ∩ ψ '' Γ.N = tilde (ψ '' c) + rw [← ψ.image_closure, image_tilde, ← image_inter ψ.injective, Γ.closure_inter c hc] + tilde_subset := by + rw [← image_sdiff ψ.injective, image_arcComponentsIn] + rintro _ ⟨c, hc, rfl⟩ + change tilde (ψ '' c) ⊆ discBd (closure (ψ '' c)) + rw [← ψ.image_closure, image_tilde, image_discBd] + exact image_mono (Γ.tilde_subset c hc) + border_cell := by + rw [← image_sdiff ψ.injective, image_arcComponentsIn] + rintro _ ⟨c, hc, rfl⟩ hb + change ((ψ '' c) ∩ bd T).Nonempty at hb + change (tilde (ψ '' c)).ncard = 2 ∧ IsLine (closure (ψ '' c) ∩ bd T) ∧ + lineEnds (closure (ψ '' c) ∩ bd T) = tilde (ψ '' c) + rw [← image_bd_homeomorph ψ, ← image_inter ψ.injective] at hb + have hb' := hb.of_image + obtain ⟨h₁, h₂, h₃⟩ := Γ.border_cell c hc hb' + rw [← ψ.image_closure, image_tilde, ← image_bd_homeomorph ψ, ← image_inter ψ.injective, + Set.ncard_image_of_injective _ ψ.injective, image_lineEnds, h₃] + exact ⟨h₁, image_isLine ψ h₂, rfl⟩ + γ_nodup := by + rw [← image_sdiff ψ.injective, image_arcComponentsIn] + rintro _ ⟨c, hc, rfl⟩ + change ((Γ.γ (ψ.symm '' (ψ '' c))).map ψ).Nodup + rw [show ψ.symm '' (ψ '' c) = c by simpa using preimage_image_symm ψ.symm c] + exact (Γ.γ_nodup c hc).map ψ.injective + γ_set := by + rw [← image_sdiff ψ.injective, image_arcComponentsIn] + rintro _ ⟨c, hc, rfl⟩ + change {n | n ∈ (Γ.γ (ψ.symm '' (ψ '' c))).map ψ} = tilde (ψ '' c) + rw [show ψ.symm '' (ψ '' c) = c by simpa using preimage_image_symm ψ.symm c, image_tilde, + ← Γ.γ_set c hc] + ext x + simp + +theorem symm_image_image (F : Set S) : ψ.symm '' (ψ '' F) = F := by + simpa using preimage_image_symm ψ.symm F + +theorem Painting.map_C (Γ : Painting S) : (Γ.map ψ).C = (fun c ↦ ψ '' c) '' Γ.C := by + change arcComponentsIn (ψ '' Γ.U \ ψ '' Γ.N) = _ + rw [← image_sdiff ψ.injective, image_arcComponentsIn] + rfl + +theorem image_cells_ncard (Γ : Painting S) (Δ : Set S) : + {c ∈ (Γ.map ψ).C | c ⊆ ψ '' Δ}.ncard = {c ∈ Γ.C | c ⊆ Δ}.ncard := by + have h : {c ∈ (Γ.map ψ).C | c ⊆ ψ '' Δ} = (fun c ↦ ψ '' c) '' {c ∈ Γ.C | c ⊆ Δ} := by + rw [Painting.map_C] + ext c + constructor + · rintro ⟨⟨c₀, hc₀, rfl⟩, h⟩ + exact ⟨c₀, ⟨hc₀, (image_subset_image_iff ψ.injective).mp h⟩, rfl⟩ + · rintro ⟨c₀, ⟨hc₀, h⟩, rfl⟩ + exact ⟨⟨c₀, hc₀, rfl⟩, image_mono h⟩ + rw [h, Set.ncard_image_of_injective _ (image_injective.mpr ψ.injective)] + +theorem Painting.IsThreeConnected.map {Γ : Painting S} (h : Γ.IsThreeConnected) : + (Γ.map ψ).IsThreeConnected := by + have hU : ∀ F : Set S, ψ '' F ∩ (Γ.map ψ).U ⊆ (Γ.map ψ).N → F ∩ Γ.U ⊆ Γ.N := by + intro F hF + change ψ '' F ∩ ψ '' Γ.U ⊆ ψ '' Γ.N at hF + rw [← image_inter ψ.injective, image_subset_image_iff ψ.injective] at hF + exact hF + have hN : ∀ F : Set S, (ψ '' F ∩ (Γ.map ψ).N).ncard = (F ∩ Γ.N).ncard := by + intro F + change (ψ '' F ∩ ψ '' Γ.N).ncard = _ + rw [← image_inter ψ.injective, Set.ncard_image_of_injective _ ψ.injective] + have hΔ : ∀ F Δ : Set S, Δ ∩ Γ.N ⊆ F → ψ '' Δ ∩ (Γ.map ψ).N ⊆ ψ '' F := by + intro F Δ hsub + change ψ '' Δ ∩ ψ '' Γ.N ⊆ _ + rw [← image_inter ψ.injective] + exact image_mono hsub + refine ⟨fun F hF h₁ h₂ ↦ ?_, fun F hF h₁ h₂ h₃ ↦ ?_⟩ + · obtain ⟨F, rfl⟩ : ∃ G, F = ψ '' G := ⟨ψ.symm '' F, (preimage_image_symm ψ F).symm⟩ + have hG : IsOArc F := by simpa [symm_image_image] using image_isOArc ψ.symm hF + obtain ⟨Δ, h₄, h₅, h₆, h₇⟩ := h.1 F hG (hU F h₁) (by rwa [hN] at h₂) + exact ⟨ψ '' Δ, image_isClosedDisc ψ h₄, by rw [image_discBd, h₅], + by rwa [image_cells_ncard], hΔ F Δ h₇⟩ + · obtain ⟨F, rfl⟩ : ∃ G, F = ψ '' G := ⟨ψ.symm '' F, (preimage_image_symm ψ F).symm⟩ + have hG : IsLine F := by simpa [symm_image_image] using image_isLine ψ.symm hF + have hbd : F ∩ bd S = lineEnds F := by + rw [← image_bd_homeomorph ψ, ← image_inter ψ.injective, image_lineEnds] at h₃ + exact image_injective.mpr ψ.injective h₃ + obtain ⟨Δ, h₄, h₅, h₆, h₇, h₈⟩ := h.2 F hG (hU F h₁) (by rwa [hN] at h₂) hbd + refine ⟨ψ '' Δ, image_isClosedDisc ψ h₄, ?_, ?_, by rwa [image_cells_ncard], hΔ F Δ h₈⟩ + · rw [image_discBd] + exact image_mono h₅ + · rw [image_discBd, ← image_bd_homeomorph ψ, ← image_union] + exact image_mono h₆ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section10k.lean b/LeanPool/GraphMinor/GM20/Section10k.lean new file mode 100644 index 0000000000..57db984f23 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section10k.lean @@ -0,0 +1,205 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section10j + +/-! +# Graph Minors XX, Section 10: hulls and shelled places move along homeomorphisms + +Let `ψ : Σ → Σ'` be a homeomorphism that respects the gradings of `X = (Σ, ρ)` and `Y = (Σ', ρ')`. +This +file carries a hull in `X` to a hull in `Y`, and shows that shelled over `X` gives shelled over `Y`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface GraphMinor.GM18 + +universe u v + +variable {α : Type u} {β : Type v} {X Y : GradedSurface} (ψ : X.S ≃ₜ Y.S) + +theorem mem_bd_image {x : X.S} : ψ x ∈ bd Y.S ↔ x ∈ bd X.S := by + rw [← image_bd_homeomorph ψ] + exact ψ.injective.mem_set_image + +theorem isBorder_image {c : Set X.S} : + Painting.IsBorder (ψ '' c) ↔ Painting.IsBorder c := by + unfold Painting.IsBorder + rw [← image_bd_homeomorph ψ, ← image_inter ψ.injective, image_nonempty] + +variable {ψ} {G : Hypergraph α β} {Γ : Painting X.S} + +/-- The hull in `Y` given by a hull in `X`. -/ +def Hull.map (hρ : ∀ Θ ∈ cuffs X.S, Y.ρ (ψ '' Θ) = X.ρ Θ) (h : Hull Γ G) : + Hull (X := Y) (Γ.map ψ) G where + node n := h.node (ψ.symm n) + cell c := h.cell (ψ.symm '' c) + border n := h.border (ψ.symm n) + node_injOn := by + rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ hab + simp only [Homeomorph.symm_apply_apply] at hab + rw [h.node_injOn ha hb hab] + node_mem := by + rintro _ ⟨a, ha, rfl⟩ + simpa using h.node_mem a ha + cell_bijOn := by + rw [Painting.map_C] + refine ⟨?_, ?_, ?_⟩ + · rintro _ ⟨c, hc, rfl⟩ + change h.cell (ψ.symm '' (ψ '' c)) ∈ _ + rw [symm_image_image] + exact h.cell_bijOn.mapsTo hc + · rintro _ ⟨a, ha, rfl⟩ _ ⟨b, hb, rfl⟩ hab + change h.cell (ψ.symm '' (ψ '' a)) = h.cell (ψ.symm '' (ψ '' b)) at hab + rw [symm_image_image, symm_image_image] at hab + rw [h.cell_bijOn.injOn ha hb hab] + · intro f hf + obtain ⟨c, hc, rfl⟩ := h.cell_bijOn.surjOn hf + exact ⟨ψ '' c, ⟨c, hc, rfl⟩, by + change h.cell (ψ.symm '' (ψ '' c)) = _ + rw [symm_image_image]⟩ + inc_iff := by + rintro _ ⟨n, hn, rfl⟩ c' hc' + rw [Painting.map_C] at hc' + obtain ⟨c, hc, rfl⟩ := hc' + rw [image_tilde, ψ.injective.mem_set_image, symm_image_image, Homeomorph.symm_apply_apply] + exact h.inc_iff n hn c hc + border_subset := by + rintro _ ⟨⟨n, hn, rfl⟩, hb⟩ + simpa using h.border_subset n ⟨hn, (mem_bd_image ψ).mp hb⟩ + border_disjoint := by + rintro _ ⟨⟨n, hn, rfl⟩, hb⟩ + have : (fun n ↦ h.node (ψ.symm n)) '' (ψ '' Γ.N) = h.node '' Γ.N := by + rw [← image_comp] + exact image_congr fun x _ ↦ by simp + change Disjoint (h.border (ψ.symm (ψ n))) ((fun n ↦ h.node (ψ.symm n)) '' (ψ '' Γ.N)) + rw [this, Homeomorph.symm_apply_apply] + exact h.border_disjoint n ⟨hn, (mem_bd_image ψ).mp hb⟩ + border_ncard := by + intro Θ' hΘ' _ hn + rw [image_cuffs ψ] at hΘ' + obtain ⟨Θ, hΘ, rfl⟩ := hΘ' + obtain ⟨⟨n, hn₁, rfl⟩, hn₂⟩ := hn + have hn₃ : n ∈ Θ := ψ.injective.mem_set_image.mp hn₂ + rw [Homeomorph.symm_apply_apply, hρ Θ hΘ] + exact h.border_ncard Θ hΘ n ⟨hn₁, hn₃⟩ + border_cuffs := by + intro Θ₁' h₁' Θ₂' h₂' hne _ hn₁ _ hn₂ + rw [image_cuffs ψ] at h₁' h₂' + obtain ⟨Θ₁, h₁, rfl⟩ := h₁' + obtain ⟨Θ₂, h₂, rfl⟩ := h₂' + obtain ⟨⟨a, ha, rfl⟩, ha'⟩ := hn₁ + obtain ⟨⟨b, hb, rfl⟩, hb'⟩ := hn₂ + simp only [Homeomorph.symm_apply_apply] + exact h.border_cuffs Θ₁ h₁ Θ₂ h₂ (fun e ↦ hne (by rw [e])) a + ⟨ha, ψ.injective.mem_set_image.mp ha'⟩ b ⟨hb, ψ.injective.mem_set_image.mp hb'⟩ + vertexSet_eq := by + rw [h.vertexSet_eq] + congr 1 + · change h.node '' Γ.N = (fun n ↦ h.node (ψ.symm n)) '' (ψ '' Γ.N) + rw [← image_comp] + exact image_congr fun x _ ↦ by simp + · ext v + simp only [mem_iUnion, exists_prop] + constructor + · rintro ⟨n, ⟨h₁, h₂⟩, hv⟩ + exact ⟨ψ n, ⟨⟨n, h₁, rfl⟩, (mem_bd_image ψ).mpr h₂⟩, by simpa using hv⟩ + · rintro ⟨_, ⟨⟨n, h₁, rfl⟩, h₂⟩, hv⟩ + exact ⟨n, ⟨h₁, (mem_bd_image ψ).mp h₂⟩, by simpa using hv⟩ + ends_internal := by + intro c' hc' hb + rw [Painting.map_C] at hc' + obtain ⟨c, hc, rfl⟩ := hc' + rw [symm_image_image, h.ends_internal c hc fun h' ↦ hb ((isBorder_image ψ).mpr h'), + image_tilde, ← image_comp] + exact image_congr fun x _ ↦ by simp + ends_border := by + intro c' hc' hb + rw [Painting.map_C] at hc' + obtain ⟨c, hc, rfl⟩ := hc' + rw [symm_image_image, h.ends_border c hc ((isBorder_image ψ).mp hb), image_tilde, + ← image_comp] + congr 1 + · exact image_congr fun x _ ↦ by simp + · ext v + simp only [mem_iUnion, exists_prop, mem_image] + constructor + · rintro ⟨n, h₁, hv⟩ + exact ⟨ψ n, ⟨n, h₁, rfl⟩, by simpa using hv⟩ + · rintro ⟨_, ⟨n, h₁, rfl⟩, hv⟩ + exact ⟨n, h₁, by simpa using hv⟩ + border_order := by + intro Θ' hΘ' _ h₁ _ h₂ _ h₃ _ h₄ hord + rw [image_cuffs ψ] at hΘ' + obtain ⟨Θ, hΘ, rfl⟩ := hΘ' + obtain ⟨⟨a, ha, rfl⟩, ha'⟩ := h₁ + obtain ⟨⟨b, hb, rfl⟩, hb'⟩ := h₂ + obtain ⟨⟨c, hc, rfl⟩, hc'⟩ := h₃ + obtain ⟨⟨d, hd, rfl⟩, hd'⟩ := h₄ + have := image_inOrderOn ψ.symm hord + simp only [symm_image_image, Homeomorph.symm_apply_apply] at this ⊢ + exact h.border_order Θ hΘ a ⟨ha, ψ.injective.mem_set_image.mp ha'⟩ b + ⟨hb, ψ.injective.mem_set_image.mp hb'⟩ c ⟨hc, ψ.injective.mem_set_image.mp hc'⟩ d + ⟨hd, ψ.injective.mem_set_image.mp hd'⟩ this + +/-- Shelled over `X` gives shelled over `Y`, for a homeomorphism that respects the gradings. -/ +theorem IsShelled.map {P : UnlabeledPatchwork α β} {ℒ : Set (RootedHypergraph α β)} + (hρ : ∀ Θ ∈ cuffs X.S, Y.ρ (ψ '' Θ) = X.ρ Θ) (hS : IsShelled X P ℒ) : IsShelled Y P ℒ := by + obtain ⟨hfine, e, P', Γ, h, hheart, hE, h₃, hint, hbor⟩ := hS + refine ⟨hfine, e, P', Γ.map ψ, h.map hρ, hheart, hE, h₃.map ψ, ?_, ?_⟩ + · intro c' hc' A hA hcell hb + rw [Painting.map_C] at hc' + obtain ⟨c, hc, rfl⟩ := hc' + change h.cell (ψ.symm '' (ψ '' c)) = _ at hcell + rw [symm_image_image] at hcell + obtain ⟨h₁, h₂⟩ := hint c hc A hA hcell fun h' ↦ hb ((isBorder_image ψ).mpr h') + have himg : (fun n ↦ h.node (ψ.symm n)) '' tilde (ψ '' c) = h.node '' tilde c := by + rw [image_tilde, ← image_comp] + exact image_congr fun x _ ↦ by simp + refine ⟨?_, ?_⟩ + · change A.roots = ((Γ.γ (ψ.symm '' (ψ '' c))).map ψ).map fun n ↦ h.node (ψ.symm n) + rw [symm_image_image, List.map_map, h₁] + exact (List.map_congr_left fun x _ ↦ by simp).symm + · intro K hK hverts + change GM04.IsGrouping ((fun n ↦ h.node (ψ.symm n)) '' tilde (ψ '' c)) K at hK + change K.verts = (fun n ↦ h.node (ψ.symm n)) '' tilde (ψ '' c) at hverts + rw [himg] at hK hverts + exact h₂ K hK hverts + · intro c' hc' A hA hcell Θ' hΘ' hne n₁' h₁' n₂' h₂' hn + rw [Painting.map_C] at hc' + obtain ⟨c, hc, rfl⟩ := hc' + rw [image_cuffs ψ] at hΘ' + obtain ⟨Θ, hΘ, rfl⟩ := hΘ' + change h.cell (ψ.symm '' (ψ '' c)) = _ at hcell + rw [symm_image_image] at hcell + rw [image_tilde] at h₁' h₂' + obtain ⟨n₁, h₁, rfl⟩ := h₁' + obtain ⟨n₂, h₂, rfl⟩ := h₂' + rw [← image_inter ψ.injective, image_nonempty] at hne + obtain ⟨L, h₃', h₄, h₅⟩ := hbor c hc A hA hcell Θ hΘ hne n₁ h₁ n₂ h₂ + (fun e' ↦ hn (by rw [e'])) + simp only [Hull.map, Homeomorph.symm_apply_apply] + rw [hρ Θ hΘ] + rw [ψ.symm_apply_apply n₁, ψ.symm_apply_apply n₂] + refine ⟨L, h₃', h₄, ?_⟩ + rcases h₅ with h₅ | ⟨c₀, hc₀, hb, h₆, h₇⟩ + · exact Or.inl h₅ + · refine Or.inr ⟨ψ '' c₀, ?_, fun h' ↦ hb ((isBorder_image ψ).mp h'), ?_, ?_⟩ + · rw [Painting.map_C] + exact ⟨c₀, hc₀, rfl⟩ + · rw [image_tilde] + exact ⟨n₁, h₆, rfl⟩ + · rw [image_tilde] + exact ⟨n₂, h₇, rfl⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section10l.lean b/LeanPool/GraphMinor/GM20/Section10l.lean new file mode 100644 index 0000000000..a3cc29ebc5 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section10l.lean @@ -0,0 +1,199 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section10k +public import LeanPool.GraphMinor.GM20.Draw10 + +import LeanPool.GraphMinor.GM20.Section10iProved + +import LeanPool.GraphMinor.GM17.Bridge + +import LeanPool.GraphMinor.Surface.Classification + +/-! +# Graph Minors XX, (10.3) + +This file proves (10.3), from (14.2) of Graph Minors XVII and the results of Section 8, 9 and 11 of +that +paper. The proof takes the portrayal given by (14.2) and uses Section10f-Section10i. + +The paper says that the set `𝒮` of graded surfaces with at most `q` cuffs, in which `H` cannot be +drawn, +and with `ρ ≤ p`, "is finite up to homeomorphism". We state this for surfaces as +`FiniteSurfaceTypesStatement`, and we prove it from the classification of surfaces: by `Draw8` a +surface +of large genus has a drawing of `H`, and by `Draw10` a surface with few cuffs is a model with small +`c`. +The gradings are counted here. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface GraphMinor.GM17 GraphMinor.GM18 GraphMinor.GM10 +open GraphMinor.GM20.GM17 + +universe u v + +/-- For a graph `H` and an integer `q`, the connected surfaces with at most `q` cuffs in which `H` +cannot be drawn are finite in number up to homeomorphism. (Graph Minors XX, Section 10, page 354: +"Thus `𝒮` is finite up to homeomorphism.") It follows from the classification of surfaces, since a +surface of large genus has a drawing of `H`. -/ +def FiniteSurfaceTypesStatement : Prop := + ∀ {α' β' : Type} (H : Hypergraph α' β'), H.IsGraph → ∀ q : ℕ, + ∃ 𝒮₀ : Set GradedSurface, 𝒮₀.Finite ∧ ∀ (S : Type) [TopologicalSpace S], IsSurface S → + ConnectedSpace S → (cuffs S).encard ≤ q → ¬ CanBeDrawn S H → + ∃ X ∈ 𝒮₀, Nonempty (S ≃ₜ X.S) + +/-- The surface of `X` with the grading `ρ`. -/ +def GradedSurface.withGrading (X : GradedSurface) (ρ : Set X.S → ℕ) : GradedSurface where + S := X.S + isSurface := X.isSurface + connected := X.connected + ρ := ρ + +/-- The gradings of the surface of `X` with values at most `p` on the cuffs, and `0` off the cuffs. +-/ +def GradedSurface.gradings (X : GradedSurface) (p : ℕ) : Set GradedSurface := + X.withGrading '' {ρ | ∀ Θ, ρ Θ ≤ p ∧ (Θ ∉ cuffs X.S → ρ Θ = 0)} + +theorem GradedSurface.finite_gradings (X : GradedSurface) (p : ℕ) : (X.gradings p).Finite := by + obtain ⟨-, hfin, -⟩ := cuff_statement.{0} X.S X.isSurface + have : Finite (cuffs X.S) := hfin + refine Set.Finite.image _ ?_ + let f : (Set X.S → ℕ) → (cuffs X.S → Fin (p + 1)) := fun ρ Θ ↦ Fin.ofNat (p + 1) (ρ Θ.1) + refine Set.Finite.of_finite_image (f := f) (Set.toFinite _) ?_ + intro ρ hρ ρ' hρ' h + funext Θ + by_cases hΘ : Θ ∈ cuffs X.S + · have h₁ := congrArg Fin.val (congrFun h ⟨Θ, hΘ⟩) + simp only [f, Fin.val_ofNat] at h₁ + rwa [Nat.mod_eq_of_lt (Nat.lt_succ_of_le (hρ Θ).1), + Nat.mod_eq_of_lt (Nat.lt_succ_of_le (hρ' Θ).1)] at h₁ + · rw [(hρ Θ).2 hΘ, (hρ' Θ).2 hΘ] + +/-- `FiniteSurfaceTypesStatement` holds. By the classification of surfaces, a connected surface `S` +is +homeomorphic to some model `Σ(a, b, c)`. If `a` or `b` is large then `H` can be drawn in the model, +and +so in `S`. A model has at least `c` cuffs, so `c` is at most the number of cuffs of `S`. So there +are +finitely many possible triples `(a, b, c)`, and for each we keep one surface homeomorphic to the +model, if there is one. -/ +theorem finiteSurfaceTypes : FiniteSurfaceTypesStatement := by + classical + intro α' β' H hH q + obtain ⟨L, hL⟩ := Draw.exists_canBeDrawn H hH + let T : Set (ℕ × ℕ × ℕ) := Iio L ×ˢ Iio L ×ˢ Iic q + have hT : T.Finite := (finite_Iio L).prod ((finite_Iio L).prod (finite_Iic q)) + let rep : ℕ × ℕ × ℕ → Set GradedSurface := fun t ↦ + if h : ∃ X : GradedSurface, Nonempty (X.S ≃ₜ SurfaceModel t.1 t.2.1 t.2.2) then {h.choose} + else ∅ + have hrep : ∀ t, (rep t).Finite := fun t ↦ by + simp only [rep] + split_ifs + · exact finite_singleton _ + · exact finite_empty + refine ⟨⋃ t ∈ T, rep t, hT.biUnion fun t _ ↦ hrep t, ?_⟩ + intro S _ hS hc hcuffs hdraw + obtain ⟨a, b, c, ⟨ψ⟩⟩ := GraphMinor.Surface.classification.{0} S hS hc + have : T2Space S := hS.2.1 + have : T2Space (SurfaceModel a b c) := ψ.t2Space + have hab : a < L ∧ b < L := by + by_contra hn + refine hdraw (Draw.CanBeDrawn.map ψ.symm (hL a b c ?_)) + omega + have hcq : c ≤ q := by + have h₁ : (c : ℕ∞) ≤ (cuffs (SurfaceModel a b c)).encard := Draw.le_encard_cuffs + rw [image_cuffs ψ] at h₁ + have h₂ := h₁.trans ((Set.encard_image_le _ _).trans hcuffs) + exact_mod_cast h₂ + have h : ∃ X : GradedSurface, Nonempty (X.S ≃ₜ SurfaceModel a b c) := + ⟨{ S := S, isSurface := hS, connected := hc, ρ := fun _ ↦ 0 }, ⟨ψ⟩⟩ + refine ⟨h.choose, mem_biUnion (x := (a, b, c)) ⟨hab.1, hab.2, hcq⟩ ?_, + ⟨ψ.trans h.choose_spec.some.symm⟩⟩ + simp only [rep] + rw [dite_eq_left h] + exact mem_singleton _ + +variable {α : Type u} {β : Type v} + +/-- Graph Minors XX, (10.3) (page 354): "For every graph* $H$ *there exist* $\theta \ge 1$ *and a +set* $\mathcal{S}$ *of graded +surfaces, finite up to homeomorphism, with the following property. Let* $P = (G, \mu, +\Delta)$ *be a rootless free patchwork, and let* $\mathcal{T}$ *be a tangle in* $G$ *of +order* $\ge \theta$ *controlling no* $H$*-minor of* $sk(G)$. *Then there exist* $W \subseteq +V(G)$ *with* $|W| < \theta$ *and a fine rooted location* $\mathcal{L}$ *in* $G/W$, *such +that* * $(P/W, \mathcal{L})$ *is* $(\Sigma, \rho)$*-shelled for some* $(\Sigma, \rho) \in +\mathcal{S}$, *and* * $\mathcal{L}$ *is linked to* $\mathcal{T}/W$." Here `𝒮` is a finite set of +representatives, and the order `θ` is at least `z + 6p + 9`, so that the standing hypotheses of +Sections +8, 9, 11 of Graph Minors XVII hold. + +Lean uses an infinite ambient edge type to provide fresh edge labels. -/ +theorem theorem_10_3_proof + : Theorem103Statement.{u, v} := by + classical + intro α' β' H hH + obtain ⟨p, q, z, θ₀, hz, h⟩ := GraphMinor.GM17.gm17Theorem142.{u, v} H hH + obtain ⟨𝒮₀, h𝒮₀, hrep⟩ := finiteSurfaceTypes H hH q + refine ⟨max θ₀ (z + 6 * p + 9), ⋃ X ∈ 𝒮₀, X.gradings p, by omega, + h𝒮₀.biUnion fun X _ ↦ X.finite_gradings p, ?_⟩ + intro α β _ P _ hroot θ' 𝒯 h𝒯 hθ' hnc + have hθ₀ : θ₀ ≤ θ' := (le_max_left _ _).trans hθ' + have hθ₁ : z + 6 * p + 9 ≤ θ' := (le_max_right _ _).trans hθ' + obtain hctrl | ⟨Z, hZ, hZc, π, hw, hc, hnd, ht, hred⟩ := h P.G.toHypergraph θ' 𝒯 h𝒯 hθ₀ + · exact (hnc hctrl).elim + have hZlt : Z.ncard < θ' := by omega + have h𝒯' : IsTangle (quotientVertices P.G.toHypergraph Z) (θ' - Z.ncard) + (quotientTangle P.G.toHypergraph 𝒯 Z) := GM10.theorem_6_2_proof h𝒯 hZ hZlt + let π' : Portrayal (P.slash Z).G.toHypergraph := π + have hs : Standing (quotientTangle P.G.toHypergraph 𝒯 Z) (θ' - Z.ncard) p (2 * p + 4) + (6 * p + 8) π' := + { isTangle := h𝒯' + isTrue := ht + isRedundant := ⟨by have := hred.1; omega, fun Y hY hYc ↦ hred.2 Y hY (hYc.trans (by omega))⟩ + warp_le := hw + lt := by omega } + have hr : (P.slash Z).G.rootSet = ∅ := by + apply Set.eq_empty_of_forall_notMem + intro v hv + have := (mem_slash_rootSet.mp hv).1 + change v ∈ P.G.roots at this + rw [hroot] at this + simp at this + have hs₈ := hs.mono (r' := 2 * p + 3) (t' := 4 * p + 5) (by omega) (by omega) + have hshell := Portrayal.isShelled_of_standing hr hs₈ + have hlink := Portrayal.isLinkedTo_of_standing hr hs + obtain ⟨X₀, hX₀, ⟨ψ⟩⟩ := hrep π.S π.isSurface π.connected + (hc.trans (by norm_cast)) hnd + let ρ : Set X₀.S → ℕ := fun Θ ↦ if Θ ∈ cuffs X₀.S then π.warpAt (ψ.symm '' Θ) else 0 + have hρ : ∀ Θ ∈ cuffs π.S, ρ (ψ '' Θ) = π.warpAt Θ := by + intro Θ hΘ + have hmem : ψ '' Θ ∈ cuffs X₀.S := by + rw [image_cuffs ψ] + exact ⟨Θ, hΘ, rfl⟩ + simp only [ρ, ite_eq_left hmem] + rw [symm_image_image] + have hY : X₀.withGrading ρ ∈ ⋃ X ∈ 𝒮₀, X.gradings p := by + refine mem_biUnion hX₀ ⟨ρ, fun Θ ↦ ⟨?_, fun hΘ ↦ ite_eq_right hΘ⟩, rfl⟩ + by_cases hΘ : Θ ∈ cuffs X₀.S + · simp only [ρ, ite_eq_left hΘ] + have hmem : ψ.symm '' Θ ∈ cuffs π.S := by + rw [image_cuffs ψ.symm] + exact ⟨Θ, hΘ, rfl⟩ + exact (Portrayal.warpAt_le_warp_of_mem π hmem).trans hw + · simp only [ρ, ite_eq_right hΘ] + exact Nat.zero_le _ + exact ⟨Z, hZ, by omega, π'.cellLocation, Portrayal.isFine_cellLocation, ⟨_, hY, + IsShelled.map (X := π'.gradedOf) (Y := X₀.withGrading ρ) (ψ := ψ) hρ hshell⟩, hlink⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section2.lean b/LeanPool/GraphMinor/GM20/Section2.lean new file mode 100644 index 0000000000..0b803afe34 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section2.lean @@ -0,0 +1,111 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Cited +public import LeanPool.GraphMinor.GM10.TangleLemmas + +/-! +# Graph Minors XX, Section 2 + +This file proves (2.1), that a tangle in a subhypergraph induces a tangle in the whole hypergraph. + +(2.1) is proved by checking the three tangle axioms, after seeing that intersecting a separation of +`G` with `G'` gives a separation of `G'` of no larger order. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph + +universe u v + +variable {α : Type u} {β : Type v} + +/-- Intersecting a separation of `G` with `G' ⊆ G` gives a separation of `G'`. -/ +theorem isSeparation_inter {G G' A B : Hypergraph α β} (hG' : G' ≤ G) (h : G.IsSeparation A B) : + G'.IsSeparation (A ∩ G') (B ∩ G') := by + have hA : A ∩ G' ≤ G' := inter_le_right h.left_le hG' + have hB : B ∩ G' ≤ G' := inter_le_right h.right_le hG' + refine (isSeparation_iff_of_le hA hB).mpr ⟨?_, ?_, ?_⟩ + · refine Set.Subset.antisymm (fun v hv ↦ hv.elim (·.2) (·.2)) fun v hv ↦ ?_ + have : v ∈ A.vertexSet ∪ B.vertexSet := h.vertexSet_union ▸ hG'.vertexSet_subset hv + exact this.elim (fun h ↦ Or.inl ⟨h, hv⟩) fun h ↦ Or.inr ⟨h, hv⟩ + · refine Set.Subset.antisymm (fun e he ↦ he.elim (·.2) (·.2)) fun e he ↦ ?_ + have : e ∈ A.edgeSet ∪ B.edgeSet := h.edgeSet_union ▸ hG'.edgeSet_subset he + exact this.elim (fun h ↦ Or.inl ⟨h, he⟩) fun h ↦ Or.inr ⟨h, he⟩ + · refine Set.eq_empty_of_forall_notMem fun e he ↦ ?_ + exact Set.disjoint_left.mp h.disjoint_edgeSet he.1.1 he.2.1 + +/-- The order of `(A ∩ G', B ∩ G')` is at most that of `(A, B)`. -/ +theorem separationOrder_inter_le {G' A B : Hypergraph α β} (hG : (A ∩ B).vertexSet.Finite) : + separationOrder (A ∩ G') (B ∩ G') ≤ separationOrder A B := + Set.ncard_le_ncard (fun _ hv ↦ ⟨hv.1.1, hv.2.1⟩) hG + +/-- Graph Minors XX, (2.1) (page 327): "Let $G$ be a hypergraph, let $G' \subseteq G$ and let +$\mathcal{T}'$ be a tangle in $G'$ of +order $\theta$. Let $\mathcal{T}$ be the set of all separations $(A, B)$ of $G$ of order $< +\theta$ such that $(A \cap G', B \cap G') \in \mathcal{T}'$. Then $\mathcal{T}$ is a tangle +in $G$ of order $\theta$." -/ +theorem theorem_2_1_proof {G G' : Hypergraph α β} {θ : ℕ} (hG' : G' ≤ G) + {𝒯' : Set (Hypergraph α β × Hypergraph α β)} (h𝒯' : IsTangle G' θ 𝒯') : + IsTangle G θ {p | G.IsSeparation p.1 p.2 ∧ separationOrder p.1 p.2 < θ ∧ + (p.1 ∩ G', p.2 ∩ G') ∈ 𝒯'} where + one_le := h𝒯'.one_le + isSeparation _ _ h := h.1 + order_lt _ _ h := h.2.1 + axiom1 A B hsep hord := by + have hfin : (A ∩ B).vertexSet.Finite := (A ∩ B).vertexSet_finite + have hlt := (separationOrder_inter_le (G' := G') hfin).trans_lt hord + rcases h𝒯'.axiom1 (isSeparation_inter hG' hsep) hlt with h | h + · exact Or.inl ⟨hsep, hord, h⟩ + · refine Or.inr ⟨hsep.symm, by rwa [separationOrder_comm], h⟩ + axiom2 A₁ B₁ A₂ B₂ A₃ B₃ h₁ h₂ h₃ hU := by + refine h𝒯'.axiom2 h₁.2.2 h₂.2.2 h₃.2.2 ?_ + have hA₁ := h₁.1.left_le + have hA₂ := h₂.1.left_le + have hA₃ := h₃.1.left_le + have hV : A₁.vertexSet ∪ A₂.vertexSet ∪ A₃.vertexSet = G.vertexSet := by + rw [← hU]; rfl + have hE : A₁.edgeSet ∪ A₂.edgeSet ∪ A₃.edgeSet = G.edgeSet := by + rw [← hU]; rfl + have l₁ := inter_le_right hA₁ hG' + have l₂ := inter_le_right hA₂ hG' + have l₃ := inter_le_right hA₃ hG' + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq (G := G') (union_le (union_le l₁ l₂) l₃) le_rfl + ?_ ?_ + · apply Set.Subset.antisymm + · rintro v (⟨hv | hv⟩ | hv) <;> exact hv.2 + · intro v hv + have : v ∈ A₁.vertexSet ∪ A₂.vertexSet ∪ A₃.vertexSet := + hV ▸ hG'.vertexSet_subset hv + rcases this with (h | h) | h + · exact Or.inl (Or.inl ⟨h, hv⟩) + · exact Or.inl (Or.inr ⟨h, hv⟩) + · exact Or.inr ⟨h, hv⟩ + · apply Set.Subset.antisymm + · rintro v (⟨hv | hv⟩ | hv) <;> exact hv.2 + · intro v hv + have : v ∈ A₁.edgeSet ∪ A₂.edgeSet ∪ A₃.edgeSet := + hE ▸ hG'.edgeSet_subset hv + rcases this with (h | h) | h + · exact Or.inl (Or.inl ⟨h, hv⟩) + · exact Or.inl (Or.inr ⟨h, hv⟩) + · exact Or.inr ⟨h, hv⟩ + axiom3 A B h hV := by + refine h𝒯'.axiom3 h.2.2 ?_ + refine Set.Subset.antisymm ?_ ?_ + · intro v hv + exact (show v ∈ A.vertexSet ∧ v ∈ G'.vertexSet from hv).2 + · intro v hv + exact ⟨hV ▸ hG'.vertexSet_subset hv, hv⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section3.lean b/LeanPool/GraphMinor/GM20/Section3.lean new file mode 100644 index 0000000000..c04faedc56 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section3.lean @@ -0,0 +1,74 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section2 +import LeanPool.GraphMinor.GM18.Section6 + +/-! +# Graph Minors XX, Section 3 + +This file proves (3.1) of Graph Minors XX, which is (6.7) of Graph Minors XVIII for a sequence of +patchworks. The import of Graph Minors XVIII is private, since that file has many names in common +with +those of Graph Minors X that the rest of this directory opens. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph + +universe u v + +variable {α : Type u} {β : Type v} + +/-- (6.7) of Graph Minors XVIII holds in the form of `GM18Theorem67Statement`. -/ +theorem gm18Theorem67 : GM18Theorem67Statement.{u, v} := by + intro Ω _ α β _ 𝒞 θ 𝒟 hΩ h𝒞 _ hθ h₁ h₂ Q hQ + refine GM18.theorem_6_7_proof.{u, v, max u v, 0} hΩ h𝒞 hθ (fun P hP ↦ ⟨(h₁ P hP).1, + (h₁ P hP).2, ?_⟩) Q hQ + obtain ⟨Λ, inst, lam, hl, h⟩ := h₂ P hP + refine ⟨Λ, inst, lam, hl, fun θ' 𝒯 hθ' h𝒯 ↦ ?_⟩ + obtain ⟨ℒ, hp, ⟨Q', hQ', hh⟩, hi⟩ := h θ' 𝒯 h𝒯 hθ' + exact ⟨ℒ, Q', hp, hh, hQ', hi⟩ + +/-- Graph Minors XX, (3.1) (page 330), which is (6.7) of Graph Minors XVIII: "Let $\Omega$ be a +well-quasi-order, let $\mathcal{F}$ be a well-behaved set of rootless +partial $\Omega$-patchworks, and let $\theta \ge 1$ be an integer. Let $P_i = (G_i, \mu_i, +\Delta_i, \phi_i)$ ($i = 1, 2, \dots$) be a countable sequence of rootless robust +$\Omega$-patchworks. For each $i \ge 1$ let $\lambda_i$ be a tie-breaker in $G_i$; and +suppose that for every tangle $\mathcal{T}$ in $G_i$ of order $\ge \theta$ there is a rooted +location $\mathcal{L}$ in $G_i$ such that $\mathcal{L}$ $\theta$-isolates $\mathcal{T}$ and +$(P_i, \mathcal{L})$ has a heart in $\mathcal{F}$. Then there exist $j > i \ge 1$ such that +$P_i$ is simulated in $P_j$." + +Lean uses an infinite ambient edge type to provide fresh edge labels. +The simulation is the IV relation described in `WellBehaved`. -/ +theorem theorem_3_1_proof [Infinite β] {Ω : Type (max u v)} [Preorder Ω] + (hΩ : WellQuasiOrderedLE Ω) {𝓕 : Set (PartialPatchwork Ω α β)} (h𝓕 : GM18.WellBehaved 𝓕) + (hroot : ∀ P ∈ 𝓕, IsRootless P) {θ : ℕ} (hθ : 1 ≤ θ) (P : ℕ → GM04.Patchwork Ω α β) + (hP : ∀ i, IsRootless (P i) ∧ (P i).IsRobust) (Λ : ℕ → Type) [∀ i, LinearOrder (Λ i)] + (lam : ∀ i, Hypergraph α β × Hypergraph α β → Λ i) + (hlam : ∀ i, IsTieBreaker (P i).G.toHypergraph (lam i)) + (h : ∀ i (θ' : ℕ) (𝒯 : Set (Hypergraph α β × Hypergraph α β)), + IsTangle (P i).G.toHypergraph θ' 𝒯 → θ ≤ θ' → ∃ ℒ : Set (RootedHypergraph α β), + IsOmegaPlace (PartialPatchwork.ofPatchwork (P i)) ℒ ∧ + (∃ Q ∈ 𝓕, HasPlaceHeart (PartialPatchwork.ofPatchwork (P i)) ℒ Q) ∧ + GM18.Isolates (P i).G.toHypergraph (lam i) θ 𝒯 + (rootedLocationToLocation (P i).G ℒ)) : + ∃ i j, i < j ∧ GM04.Simulated (P i) (P j) := by + refine gm18Theorem67 𝓕 θ (Set.range P) hΩ h𝓕 hroot hθ ?_ ?_ P fun i ↦ ⟨i, rfl⟩ + · rintro _ ⟨i, rfl⟩ + exact hP i + · rintro _ ⟨i, rfl⟩ + exact ⟨Λ i, inferInstance, lam i, hlam i, h i⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section4a.lean b/LeanPool/GraphMinor/GM20/Section4a.lean new file mode 100644 index 0000000000..3f53beb472 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section4a.lean @@ -0,0 +1,245 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Basic + +/-! +# Graph Minors XX, Section 4, (4.1) and (4.3)–(4.6) + +This file proves the bound (4.1) on the number of ends of edges in `dom(μ)` in a well-behaved set, +and the results (4.3)–(4.6), which change the roots of the members of a well-behaved set. + +For (4.1), an unbounded set would give a sequence in which one edge gets a label incomparable to all +others, and an expansion would have to match two such edges with different numbers of ends. For +(4.3), we record the new root `v` by giving a distinguished edge `f` with `v` as its `r`th term a +label from a disjoint copy of `Ω`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +open Classical in +/-- Graph Minors XX, (4.1) (page 330): "If $\mathcal{F}$ is well-behaved, then there exists $N \ge +0$ such that if $(G, \mu, \Delta) +\in \mathcal{F}$ and $e \in dom(\mu)$ then $|\bar{\mu}(e)| \le N$." We bound the length of the march +`μ(e)`, which +is `|μBar(e)|`. -/ +theorem theorem_4_1_proof {𝓕 : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕) : + ∃ N, ∀ P ∈ 𝓕, ∀ e ∈ P.dom, (P.μ e).length ≤ N := by + by_contra hcon + push Not at hcon + choose P hP E hE hL using hcon + -- The numbers `g k` make the lengths `L (g k) = g (k + 1)` strictly increase. + let g : ℕ → ℕ := fun k ↦ Nat.rec 0 (fun _ m ↦ ((P m).μ (E m)).length) k + have hg : StrictMono g := strictMono_nat_of_lt_succ fun k ↦ hL (g k) + let Ω := ULift.{max u v} (Discrete Bool) + let _ : Preorder Ω := Preorder.lift ULift.down + have hΩ : WellQuasiOrderedLE Ω := by + have h₀ := wqo_discrete Bool + exact ⟨fun f ↦ h₀.wqo (fun n ↦ (f n).down)⟩ + let Q : ℕ → Patchwork Ω α β := fun k ↦ + (P (g k)).relabel fun e ↦ ⟨if e = E (g k) then true else false⟩ + obtain ⟨i, j, hij, ηv, ηe, hη, -⟩ := h Ω hΩ Q fun k ↦ + ⟨P (g k), hP _, isCompletionOf_relabel _ _⟩ + have hei : E (g i) ∈ (Q i).G.edgeSet := (P (g i)).dom_subset (hE _) + have hle := hη.φ_le _ hei + have hval : ((Q j).φ (ηe (E (g i)))).down = true := by + have h₁ : ((Q i).φ (E (g i))).down = true := ite_eq_left rfl + rw [← h₁] + exact hle.symm + have heq : ηe (E (g i)) = E (g j) := by + by_contra hne + simp [Q, Patchwork.relabel, hne] at hval + have hlen := hη.μ_length _ (hE (g i)) + rw [heq] at hlen + have h₃ : g (i + 1) = g (j + 1) := hlen + have h₄ : g (i + 1) < g (j + 1) := hg (Nat.succ_lt_succ hij) + exact h₄.ne h₃ + +/-- The set `𝓕₂` of (4.3), for a fixed `r`: the patchworks `P₂ = (G₂, μ, Δ)` with +`(G₁, μ, Δ) ∈ 𝓕₁`, `G₂⁻ = G₁⁻`, and `π(G₂)` the concatenation of `π(G₁)` with a new last term `v`, +where `v` is the `r`th term of `μ(f)` for some `f ∈ dom(μ)`. -/ +def addRootSet (𝓕₁ : Set (UnlabeledPatchwork α β)) (r : ℕ) : Set (UnlabeledPatchwork α β) := + {P₂ | ∃ P₁ ∈ 𝓕₁, SameBase P₁ P₂ ∧ ∃ v f, P₂.G.roots = P₁.G.roots ++ [v] ∧ f ∈ P₁.dom ∧ + (P₁.μ f)[r]? = some v} + +open Classical in +/-- The fixed-`r` part of the proof of (4.3). -/ +theorem wellBehaved_addRootSet {𝓕₁ : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕₁) (r : ℕ) : + WellBehaved (addRootSet 𝓕₁ r) := by + refine wellBehaved_of_encoding h fun Ω₂ _ hΩ₂ ↦ ?_ + refine ⟨DisjointUnionQuasiOrder Ω₂ Ω₂, inferInstance, wqo_disjointUnion hΩ₂ hΩ₂, ?_⟩ + -- `R Q₂ Q₁`: `Q₁` is `Q₂` with the last root removed and the label of `f` moved to the copy. + let R : Patchwork Ω₂ α β → Patchwork (DisjointUnionQuasiOrder Ω₂ Ω₂) α β → Prop := fun Q₂ Q₁ ↦ + ∃ v f, Q₂.G.roots = Q₁.G.roots ++ [v] ∧ SameBase Q₂ Q₁ ∧ f ∈ Q₁.dom ∧ + (Q₁.μ f)[r]? = some v ∧ + (∀ e, Q₁.φ e = if e = f then Sum.inr (Q₂.φ e) else Sum.inl (Q₂.φ e)) + refine ⟨R, ?_, ?_⟩ + · rintro Q₂ ⟨P₂, ⟨P₁, hP₁, hb, v, f, hr, hf, hμ⟩, hQ⟩ + have hb' : SameBase P₁ Q₂ := hb.trans hQ.sameBase + refine ⟨P₁.relabel fun e ↦ if e = f then Sum.inr (Q₂.φ e) else Sum.inl (Q₂.φ e), + ⟨P₁, hP₁, isCompletionOf_relabel _ _⟩, v, f, ?_, + hb'.symm.trans (isCompletionOf_relabel _ _).sameBase, hf, hμ, fun e ↦ rfl⟩ + rw [hQ.G_eq, hr] + rfl + · rintro Q₂ - Q₂' - S S' ⟨v, f, hr, hb, hf, hμ, hφ⟩ ⟨v', f', hr', hb', hf', hμ', hφ'⟩ + ⟨ηv, ηe, hη⟩ + have hfE : f ∈ S.G.edgeSet := S.dom_subset hf + -- `η(f) = f'`, since `f'` is the only edge with a label in the copy. + have hηf : ηe f = f' := by + have hle := hη.1.φ_le f hfE + rw [hφ f, hφ' (ηe f)] at hle + by_contra hne + simp only [ite_true, hne, ite_false] at hle + exact nomatch hle + -- The other labels stay in `Ω₂`. + have hle : ∀ e ∈ S.G.edgeSet, Q₂.φ e ≤ Q₂'.φ (ηe e) := by + intro e he + have hl := hη.1.φ_le e he + rw [hφ e, hφ' (ηe e)] at hl + by_cases hef : e = f + · subst hef + rw [hηf] at hl ⊢ + simp only [ite_true] at hl + cases hl with + | inr h => exact h + · have hne : ηe e ≠ f' := fun heq ↦ hef (hη.1.edge_injOn he hfE (heq.trans hηf.symm)) + simp only [hef, hne, ite_false] at hl + cases hl with + | inl h => exact h + have hlen : S.G.roots.length = S'.G.roots.length := hη.1.roots_length + refine ⟨ηv, ηe, realizable_transfer hη hb.symm hb'.symm (fun e he ↦ hle e + (hb.edgeSet_eq ▸ he)) ?_ ?_⟩ + · simp [hr, hr', hlen] + · intro i hi hi' + simp only [hr, hr'] at hi hi' ⊢ + by_cases his : i < S.G.roots.length + · have his' : i < S'.G.roots.length := hlen ▸ his + rw [List.getElem_append_left his, List.getElem_append_left his'] + exact hη.1.roots_mem i his his' + · have hieq : i = S.G.roots.length := by + simp at hi + omega + have hi'' : ¬ i < S'.G.roots.length := hlen ▸ his + rw [List.getElem_append_right (by omega), List.getElem_append_right (by omega)] + simp only [List.getElem_singleton] + -- `v'` is the `r`th term of `μ'(f') = μ'(η(f))`, so it lies in `η(v)`. + obtain ⟨hr₁, hr₂⟩ := List.getElem?_eq_some_iff.mp hμ + obtain ⟨hr₁', hr₂'⟩ := List.getElem?_eq_some_iff.mp hμ' + have hm := hη.1.μ_mem f hf r hr₁ (by rw [hηf]; exact hr₁') + simp only [hηf, hr₂, hr₂'] at hm + exact hm + +/-- Graph Minors XX, (4.3) (page 331): "Let $\mathcal{F}_1$ be a well-behaved set of patchworks. Let +$\mathcal{F}_2$ be the set of +all patchworks $P_2 = (G_2, \mu, \Delta)$ such that there exist $(G_1, \mu, \Delta) \in +\mathcal{F}_1$ and $v \in V(G_1) \setminus \bar{\pi}(G_1)$ such that $G_2^- = G_1^-$ and +$\pi(G_2)$ is the concatenation of $\pi(G_1)$ with a new last term $v$ and $v$ is incident +with some edge $e \in dom(\mu)$. Then $\mathcal{F}_2$ is well-behaved." -/ +theorem theorem_4_3_proof {𝓕₁ : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕₁) : + WellBehaved {P₂ | ∃ P₁ ∈ 𝓕₁, SameBase P₁ P₂ ∧ ∃ v e, P₂.G.roots = P₁.G.roots ++ [v] ∧ + e ∈ P₁.dom ∧ P₁.G.Inc e v} := by + obtain ⟨N, hN⟩ := theorem_4_1_proof h + refine (WellBehaved.iUnion_lt (𝓕 := addRootSet 𝓕₁) N + fun r _ ↦ wellBehaved_addRootSet h r).mono ?_ + rintro P₂ ⟨P₁, hP₁, hb, v, e, hr, he, hinc⟩ + have hmem : v ∈ P₁.μ e := by + have : v ∈ {v | v ∈ P₁.μ e} := (P₁.μ_set e he).symm ▸ hinc + exact this + obtain ⟨r, hr₁, hr₂⟩ := List.getElem_of_mem hmem + simp only [mem_iUnion, exists_prop] + exact ⟨r, (hr₁.trans_le (hN P₁ hP₁ e he)), P₁, hP₁, hb, v, e, hr, he, + List.getElem?_eq_some_iff.mpr ⟨hr₁, hr₂⟩⟩ + +/-- Graph Minors XX, (4.4) (page 332): "Let $\mathcal{F}_1$ be a well-behaved set of patchworks, and +let $\mathcal{F}_2$ be the set +of all rootless patchworks $P_2 = (G_2, \mu, \Delta)$ such that there exists $(G_1, \mu, +\Delta) \in \mathcal{F}_1$ with $G_1^- = G_2^-$. Then $\mathcal{F}_2$ is well-behaved." The paper's +reason: "any realization expansion of one +patchwork in another is a realizable expansion of the corresponding patchworks with roots +forgotten". -/ +theorem theorem_4_4_proof {𝓕₁ : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕₁) : + WellBehaved {P₂ | P₂.G.roots = [] ∧ ∃ P₁ ∈ 𝓕₁, SameBase P₁ P₂} := by + refine wellBehaved_of_encoding h fun Ω₂ _ hΩ₂ ↦ ⟨Ω₂, inferInstance, hΩ₂, ?_⟩ + let R : Patchwork Ω₂ α β → Patchwork Ω₂ α β → Prop := fun Q S ↦ + Q.G.roots = [] ∧ SameBase Q S ∧ ∀ e, S.φ e = Q.φ e + refine ⟨R, ?_, ?_⟩ + · rintro Q ⟨P₂, ⟨hr, P₁, hP₁, hb⟩, hQ⟩ + refine ⟨P₁.relabel Q.φ, ⟨P₁, hP₁, isCompletionOf_relabel _ _⟩, ?_, ?_, fun _ ↦ rfl⟩ + · rw [hQ.G_eq, hr] + · exact (hb.trans hQ.sameBase).symm.trans (isCompletionOf_relabel _ _).sameBase + · rintro Q - Q' - S S' ⟨hr, hb, hφ⟩ ⟨hr', hb', hφ'⟩ ⟨ηv, ηe, hη⟩ + refine ⟨ηv, ηe, realizable_transfer hη hb.symm hb'.symm (fun e he ↦ ?_) (by simp [hr, hr']) ?_⟩ + · have := hη.1.φ_le e (hb.edgeSet_eq ▸ he) + rwa [hφ, hφ'] at this + · intro i hi + simp [hr] at hi + +/-- The patchworks of (4.5) with exactly `k` roots. -/ +def rootedSet (𝓕₁ : Set (UnlabeledPatchwork α β)) (k : ℕ) : Set (UnlabeledPatchwork α β) := + {P₂ | P₂.G.roots.length = k ∧ ∃ P₁ ∈ 𝓕₁, SameBase P₁ P₂} + +/-- Graph Minors XX, (4.5) (page 332): "Let $\mathcal{F}_1$ be a well-behaved set of active +patchworks, let $k \ge 0$ and let +$\mathcal{F}_2$ be the set of all patchworks $(G_2, \mu, \Delta)$ such that +$|\bar{\pi}(G_2)| \le k$ and there exists $(G_1, \mu, \Delta) \in \mathcal{F}_1$ with $G_1^- += G_2^-$. Then $\mathcal{F}_2$ is well-behaved." -/ +theorem theorem_4_5_proof {𝓕₁ : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕₁) + (ha : ∀ P ∈ 𝓕₁, IsActive P) (k : ℕ) : + WellBehaved {P₂ | P₂.G.roots.length ≤ k ∧ ∃ P₁ ∈ 𝓕₁, SameBase P₁ P₂} := by + -- By induction on `k'`, using (4.4) for `k' = 0` and (4.3) for the step. + have hk : ∀ k', WellBehaved (rootedSet 𝓕₁ k') := by + intro k' + induction k' with + | zero => + refine (theorem_4_4_proof h).mono ?_ + rintro P₂ ⟨hl, P₁, hP₁, hb⟩ + exact ⟨List.length_eq_zero_iff.mp hl, P₁, hP₁, hb⟩ + | succ k' ih => + refine (theorem_4_3_proof ih).mono ?_ + rintro P₂ ⟨hl, P₁, hP₁, hb⟩ + -- Remove the last root. + obtain ⟨r, v, hr⟩ : ∃ r v, P₂.G.roots = r ++ [v] := by + rcases List.eq_nil_or_concat P₂.G.roots with h0 | ⟨r, v, hr⟩ + · simp [h0] at hl + · exact ⟨r, v, by simpa using hr⟩ + have hnd : r.Nodup := by + have := P₂.G.roots_nodup + rw [hr] at this + exact (List.nodup_append.mp this).1 + have hs : ∀ w ∈ r, w ∈ P₂.G.vertexSet := fun w hw ↦ P₂.G.roots_subset w (by simp [hr, hw]) + have hbp : SameBase P₂ (P₂.reroot r hnd hs) := ⟨rfl, rfl, fun _ _ ↦ rfl, fun _ _ ↦ rfl⟩ + have hvmem : v ∈ P₁.G.vertexSet := by + have := P₂.G.roots_subset v (by simp [hr]) + rwa [hb.vertexSet_eq] at this + obtain ⟨e, he, hinc⟩ := ha P₁ hP₁ v hvmem + refine ⟨P₂.reroot r hnd hs, ⟨?_, P₁, hP₁, hb.trans hbp⟩, hbp.symm, v, e, hr, ?_, ?_⟩ + · change r.length = k' + have := congrArg List.length hr + simp at this + omega + · exact (hb.trans hbp).dom_eq ▸ he + · have hI := (hb.trans hbp).inc_eq + change (P₂.reroot r hnd hs).G.Inc e v + rw [hI] + exact hinc + refine (WellBehaved.iUnion_lt (𝓕 := rootedSet 𝓕₁) (k + 1) fun i _ ↦ hk i).mono ?_ + rintro P₂ ⟨hl, hex⟩ + simp only [mem_iUnion, exists_prop] + exact ⟨_, Nat.lt_succ_of_le hl, rfl, hex⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section4b.lean b/LeanPool/GraphMinor/GM20/Section4b.lean new file mode 100644 index 0000000000..d87801d984 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section4b.lean @@ -0,0 +1,273 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section4a +public import LeanPool.GraphMinor.GM20.Codes + +/-! +# Graph Minors XX, Section 4, (4.6) + +This file proves (4.6): adding one edge with all ends among the roots keeps a set well-behaved. The +paper calls the proof clear. Members of a well-behaved set have boundedly many roots, so the new +edge +has one of finitely many codes (`edgeCode`) relative to the roots. Along a sequence of completions +we +pass to a subsequence on which that code is constant and the label of the new edge increases. Then +an +expansion of the patchworks without the new edges extends by sending new edge to new edge +(`simulated_add_edge`). +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +theorem IsCompletionOf.trans {Ω₁ Ω₂ Ω₃ : Type*} {P : Patchwork Ω₁ α β} {Q : Patchwork Ω₂ α β} + {R : Patchwork Ω₃ α β} (h : IsCompletionOf P Q) (h' : IsCompletionOf Q R) : + IsCompletionOf P R where + G_eq := h'.G_eq.trans h.G_eq + dom_eq := h'.dom_eq.trans h.dom_eq + μ_eq _ he := (h'.μ_eq (h.dom_eq ▸ he)).trans (h.μ_eq he) + Δ_eq _ he := by + have hE : Q.G.edgeSet = P.G.edgeSet := congrArg (·.edgeSet) h.G_eq + exact (h'.Δ_eq (hE ▸ he)).trans (h.Δ_eq he) + +theorem IsCompletionOf.symm {Ω₁ Ω₂ : Type*} {P : Patchwork Ω₁ α β} {Q : Patchwork Ω₂ α β} + (h : IsCompletionOf P Q) : IsCompletionOf Q P where + G_eq := h.G_eq.symm + dom_eq := h.dom_eq.symm + μ_eq _ he := (h.μ_eq (h.dom_eq ▸ he)).symm + Δ_eq _ he := (h.Δ_eq ((congrArg (·.edgeSet) h.G_eq) ▸ he)).symm + +theorem IsCompletionOf.deleteEdges {Ω₁ Ω₂ : Type*} {P : Patchwork Ω₁ α β} {Q : Patchwork Ω₂ α β} + (h : IsCompletionOf P Q) (F : Set β) : IsCompletionOf (P.deleteEdges F) (Q.deleteEdges F) where + G_eq := by + change Q.G.deleteEdges F = P.G.deleteEdges F + rw [h.G_eq] + dom_eq := by + change Q.dom \ F = P.dom \ F + rw [h.dom_eq] + μ_eq _ he := h.μ_eq he.1 + Δ_eq _ he := h.Δ_eq he.1 + +/-- Members of a well-behaved set have boundedly many roots: an expansion keeps the number of roots, +so a sequence with strictly increasing numbers of roots has no simulated pair. -/ +theorem WellBehaved.exists_roots_le {𝓕 : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕) : + ∃ N, ∀ P ∈ 𝓕, P.G.roots.length ≤ N := by + by_contra hcon + push Not at hcon + choose P hP hL using hcon + let g : ℕ → ℕ := fun k ↦ Nat.rec 0 (fun _ m ↦ (P m).G.roots.length) k + have hg : StrictMono g := strictMono_nat_of_lt_succ fun k ↦ hL (g k) + let Ω := ULift.{max u v} (Discrete Unit) + let _ : Preorder Ω := Preorder.lift ULift.down + have hΩ : WellQuasiOrderedLE Ω := by + have h₀ := wqo_discrete Unit + exact ⟨fun f ↦ h₀.wqo (fun n ↦ (f n).down)⟩ + obtain ⟨i, j, hij, ηv, ηe, hη, -⟩ := h Ω hΩ (fun k ↦ (P (g k)).relabel fun _ ↦ ⟨()⟩) fun k ↦ + ⟨P (g k), hP _, isCompletionOf_relabel _ _⟩ + have h₃ : g (i + 1) = g (j + 1) := hη.roots_length + exact (hg (Nat.succ_lt_succ hij)).ne h₃ + +variable {Ω : Type*} [Preorder Ω] + +/-- A realizable expansion of `Q \ f` in `Q' \ f'` extends to one of `Q` in `Q'` by `f ↦ f'`, when +the +ends of `f` and `f'` are roots, the edges have the same code relative to the roots, and the label +does +not go down. -/ +theorem simulated_add_edge {k : ℕ} {Q Q' : Patchwork Ω α β} {f f' : β} (hf : f ∈ Q.G.edgeSet) + (hf' : f' ∈ Q'.G.edgeSet) (hr : Q.G.roots.length ≤ k) (hr' : Q'.G.roots.length ≤ k) + (hends : ∀ v, Q.G.Inc f v → v ∈ Q.G.roots) (hends' : ∀ v, Q'.G.Inc f' v → v ∈ Q'.G.roots) + (hc : edgeCode k Q.G.roots Q f = edgeCode k Q'.G.roots Q' f') (hφ : Q.φ f ≤ Q'.φ f') + (h : Simulated (Q.deleteEdges {f}) (Q'.deleteEdges {f'})) : Simulated Q Q' := by + classical + obtain ⟨ηv, ηe, hη, H, hH, hcomp⟩ := h + obtain ⟨hcd, hci, hcm, hcp⟩ : (f ∈ Q.dom ↔ f' ∈ Q'.dom) ∧ + indexSet k Q.G.roots (Q.G.ends f) = indexSet k Q'.G.roots (Q'.G.ends f') ∧ + marchCode k Q.G.roots (Q.μ f) = marchCode k Q'.G.roots (Q'.μ f') ∧ + patchCode k Q.G.roots (Q.Δ f) = patchCode k Q'.G.roots (Q'.Δ f') := by + simp only [edgeCode, Prod.mk.injEq] at hc + exact ⟨iff_of_eq hc.1, hc.2.1, hc.2.2.1, hc.2.2.2⟩ + have hE : ∀ e ∈ Q.G.edgeSet, e ≠ f → e ∈ (Q.deleteEdges {f}).G.edgeSet := + fun e he hne ↦ ⟨he, hne⟩ + have hEη : ∀ e ∈ Q.G.edgeSet, e ≠ f → ηe e ∈ Q'.G.edgeSet ∧ ηe e ≠ f' := fun e he hne ↦ + hη.edge_mem e (hE e he hne) + have hroot : ∀ (i : Fin k) (x y : α), Q.G.roots[i.1]? = some x → Q'.G.roots[i.1]? = some y → + y ∈ ηv x := by + intro i x y hx hy + obtain ⟨h₁, h₂⟩ := List.getElem?_eq_some_iff.mp hx + obtain ⟨h₁', h₂'⟩ := List.getElem?_eq_some_iff.mp hy + have := hη.roots_mem i.1 h₁ h₁' + change Q'.G.roots[i.1] ∈ ηv Q.G.roots[i.1] at this + rwa [h₂, h₂'] at this + have hμ : ∀ (hd : f ∈ Q.dom), (Q.μ f).length = (Q'.μ f').length ∧ + (∀ x ∈ Q.μ f, x ∈ Q.G.roots) ∧ (∀ x ∈ Q'.μ f', x ∈ Q'.G.roots) := by + intro hd + have hd' := hcd.mp hd + have hs : ∀ x ∈ Q.μ f, x ∈ Q.G.roots := fun x hx ↦ hends x + (by have : x ∈ {x | x ∈ Q.μ f} := hx + rw [Q.μ_set f hd] at this + exact this) + have hs' : ∀ x ∈ Q'.μ f', x ∈ Q'.G.roots := fun x hx ↦ hends' x + (by have : x ∈ {x | x ∈ Q'.μ f'} := hx + rw [Q'.μ_set f' hd'] at this + exact this) + exact ⟨length_eq_of_code hr hr' (Q.μ_nodup f hd) (Q'.μ_nodup f' hd') hs hs' hcm, hs, hs'⟩ + refine ⟨ηv, fun e ↦ if e = f then f' else ηe e, ?_, H, ?_, hcomp⟩ + · refine + { vertex_nonempty := hη.vertex_nonempty + vertex_subset := hη.vertex_subset + edge_mem := fun e he ↦ ?_ + vertex_disjoint := hη.vertex_disjoint + edge_injOn := ?_ + mem_dom_iff := fun e he ↦ ?_ + ends_nonempty := fun e he hd v hv ↦ ?_ + μ_length := fun e he ↦ ?_ + μ_mem := fun e he i hi hi' ↦ ?_ + roots_length := hη.roots_length + roots_mem := hη.roots_mem + maps_Δ := fun e he ↦ ?_ + φ_le := fun e he ↦ ?_ } + · by_cases hef : e = f + · simpa [hef] using hf' + · simpa [hef] using (hEη e he hef).1 + · intro e₁ h₁ e₂ h₂ heq + by_cases h₃ : e₁ = f <;> by_cases h₄ : e₂ = f + · exact h₃.trans h₄.symm + · simp only [h₃, h₄, ite_true, ite_false] at heq + exact absurd heq.symm (hEη e₂ h₂ h₄).2 + · simp only [h₃, h₄, ite_true, ite_false] at heq + exact absurd heq (hEη e₁ h₁ h₃).2 + · simp only [h₃, h₄, ite_false] at heq + exact hη.edge_injOn (hE e₁ h₁ h₃) (hE e₂ h₂ h₄) heq + · by_cases hef : e = f + · simpa [hef] using hcd + · have := hη.mem_dom_iff e (hE e he hef) + simp only [hef, ite_false] + exact ⟨fun hd ↦ (this.mp ⟨hd, hef⟩).1, fun hd ↦ (this.mpr ⟨hd, (hEη e he hef).2⟩).1⟩ + · by_cases hef : e = f + · subst hef + obtain ⟨i, hi⟩ := exists_index hr (hends v hv) + have hmem : i ∈ indexSet k Q'.G.roots (Q'.G.ends f') := + hci ▸ (⟨v, hv, hi⟩ : i ∈ indexSet k Q.G.roots (Q.G.ends e)) + obtain ⟨y, hy, hyi⟩ := hmem + simp only [ite_true] + exact ⟨y, hroot i v y hi hyi, hy⟩ + · obtain ⟨y, hy, hinc⟩ := hη.ends_nonempty e (hE e he hef) (fun h ↦ hd h.1) v ⟨hv, hef⟩ + simp only [hef, ite_false] + exact ⟨y, hy, hinc.1⟩ + · by_cases hef : e = f + · subst hef + simpa using (hμ he).1 + · simp only [hef, ite_false] + exact hη.μ_length e ⟨he, hef⟩ + · by_cases hef : e = f + · subst hef + obtain ⟨hlen, hs, hs'⟩ := hμ he + simp only [ite_true] at hi' ⊢ + have hx := List.getElem_mem hi + obtain ⟨j, hj⟩ := exists_index hr (hs _ hx) + obtain ⟨y, hy, hyj⟩ := marchCode_forward hcm + ((length_le_of_subset (Q.μ_nodup e he) hs).trans hr) + (List.getElem?_eq_getElem hi) hj + have h₀ : (Q'.μ f')[i] = y := by + rw [List.getElem?_eq_getElem hi'] at hy + exact Option.some.inj hy + rw [h₀] + exact hroot j _ y hj hyj + · have := hη.μ_mem e ⟨he, hef⟩ i + simp only [hef, ite_false] at hi' ⊢ + exact this hi hi' + · by_cases hef : e = f + · subst hef + obtain ⟨hlen, hs, hs'⟩ := hμ he + have hd' := hcd.mp he + have hEe := Q.dom_subset he + have hEf := Q'.dom_subset hd' + simp only [ite_true] + refine mapsTo_of_code hr hr' (Q.μ_nodup e he) (Q'.μ_nodup f' hd') hs hs' ?_ ?_ hcm hcp + · rw [Q.Δ_verts e hEe, Q.μ_set e he] + · rw [Q'.Δ_verts f' hEf, Q'.μ_set f' hd'] + · simp only [hef, ite_false] + exact hη.maps_Δ e ⟨he, hef⟩ + · by_cases hef : e = f + · subst hef + simpa using hφ + · simp only [hef, ite_false] + exact hη.φ_le e ⟨he, hef⟩ + · have himg : (fun e ↦ if e = f then f' else ηe e) '' Q.G.edgeSet = + insert f' (ηe '' (Q.G.edgeSet \ {f})) := by + ext y + constructor + · rintro ⟨e, he, rfl⟩ + by_cases hef : e = f + · simp [hef] + · exact Or.inr ⟨e, ⟨he, hef⟩, by simp [hef]⟩ + · rintro (rfl | ⟨e, he, rfl⟩) + · exact ⟨f, hf, by simp⟩ + · exact ⟨e, he.1, by simp [show e ≠ f from he.2]⟩ + refine hH.congr rfl ?_ fun _ _ ↦ rfl + change Q'.G.edgeSet \ _ = (Q'.G.edgeSet \ {f'}) \ ηe '' (Q.G.edgeSet \ {f}) + rw [himg, Set.sdiff_sdiff, Set.singleton_union] + +variable (Ω) in +/-- The data of the new edge of (4.6) along a sequence. -/ +abbrev EdgeData (k : ℕ) : Type _ := Discrete (EdgeCode k) × Ω + +/-- Graph Minors XX, (4.6) (page 332): "Let $\mathcal{F}_1$ be a well-behaved set of patchworks, and +let $\mathcal{F}_2$ be a set of +patchworks such that for each $P_2 = (G_2, \mu_2, \Delta_2) \in \mathcal{F}_2$ there exists +$f \in E(G_2)$ such that $P_2 \setminus \{f\} \in \mathcal{F}_1$ and every end of $f$ +belongs to $\bar{\pi}(G_2)$. Then $\mathcal{F}_2$ is well-behaved." -/ +theorem theorem_4_6_proof {𝓕₁ 𝓕₂ : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕₁) + (h₂ : ∀ P₂ ∈ 𝓕₂, ∃ f ∈ P₂.G.edgeSet, P₂.deleteEdges {f} ∈ completions Unit 𝓕₁ ∧ + ∀ v, P₂.G.Inc f v → v ∈ P₂.G.roots) : WellBehaved 𝓕₂ := by + intro Ω _ hΩ Q hQ + classical + obtain ⟨k, hk⟩ := h.exists_roots_le + choose P hP hPQ using hQ + choose f hf hdel hends using fun n ↦ h₂ (P n) (hP n) + -- Each `Q n \ f n` is a completion of a member of `𝓕₁`. + have hcompl : ∀ n, ∃ P₁ ∈ 𝓕₁, IsCompletionOf P₁ ((Q n).deleteEdges {f n}) := by + intro n + obtain ⟨P₁, hP₁, hc⟩ := hdel n + exact ⟨P₁, hP₁, hc.trans ((hPQ n).deleteEdges _)⟩ + have hbase : ∀ n, SameBase (P n) (Q n) := fun n ↦ (hPQ n).sameBase + have hrb : ∀ n, (Q n).G.roots.length ≤ k := by + intro n + obtain ⟨P₁, hP₁, hc⟩ := hcompl n + have := hk P₁ hP₁ + have hr : ((Q n).deleteEdges {f n}).G.roots = P₁.G.roots := congrArg (·.roots) hc.G_eq + change (Q n).G.roots.length ≤ k + have hr' : (Q n).G.roots = P₁.G.roots := hr + rwa [hr'] + have hG : ∀ n, (Q n).G = (P n).G := fun n ↦ (hPQ n).G_eq + have hcodeWqo : WellQuasiOrderedLE (Discrete (EdgeCode k)) := wqo_discrete _ + have hwqo : WellQuasiOrdered (α := EdgeData Ω k) (· ≤ ·) := + (inferInstance : WellQuasiOrderedLE (EdgeData Ω k)).wqo + obtain ⟨g, hg⟩ := hwqo.exists_monotone_subseq + (fun n ↦ ((edgeCode k (Q n).G.roots (Q n) (f n) : EdgeCode k), (Q n).φ (f n))) + obtain ⟨i, j, hij, hsim⟩ := h Ω hΩ (fun n ↦ (Q (g n)).deleteEdges {f (g n)}) fun n ↦ hcompl _ + refine ⟨g i, g j, g.strictMono hij, ?_⟩ + obtain ⟨hc, hφ⟩ := hg i j hij.le + refine simulated_add_edge (k := k) ?_ ?_ (hrb _) (hrb _) ?_ ?_ hc hφ hsim + · rw [hG]; exact hf _ + · rw [hG]; exact hf _ + · rw [hG]; exact hends _ + · rw [hG]; exact hends _ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section4c.lean b/LeanPool/GraphMinor/GM20/Section4c.lean new file mode 100644 index 0000000000..f92bf84955 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section4c.lean @@ -0,0 +1,414 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section4b +public import LeanPool.GraphMinor.GM04.Patchwork.VerifyAxioms +public import LeanPool.GraphMinor.GM04.Patchwork.Menger + +/-! +# Graph Minors XX, Section 4, (4.7) and (4.8) + +The proofs of (4.7) and (4.9) have the same core. A patchwork `Q` arises from a patchwork `S` by +adding one vertex `v`, and changing a set `A` of edges of `dom(μ)` to have `v` as an end +(`VertexStep`). Each edge of `A` carries in its label a code of its new march and patch, in terms of +its march in `S` followed by `v`. If `S` is simulated in `S'` then `Q` is simulated in `Q'` +(`simulated_of_vertexStep`): we send `v` to `v'` and keep the rest. + +The paper orders the labels of the new edges by simulation of one-edge patchworks. We use finite +codes and equality instead, which is enough and gives the well-quasi-order directly. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +theorem sup_emptySubgraph_empty (δ : (⊤ : SimpleGraph α).Subgraph) : + δ ⊔ emptySubgraph ∅ = δ := by + apply le_antisymm (sup_le le_rfl _) le_sup_left + exact ⟨by simp, fun _ _ h ↦ h.elim⟩ + +/-- Adding isolated vertices `X` to a realization `H` of `P` gives a realization of `Q`, if `Q` has +the extra vertices and the groupings of `P` with `X` added are groupings of `Q`. -/ +theorem realization_sup_emptySubgraph {Ω Ω' : Type*} {P : Patchwork Ω α β} {Q : Patchwork Ω' α β} + {H : (⊤ : SimpleGraph α).Subgraph} (X : Set α) (hH : P.IsRealization H) + (hV : Q.G.vertexSet = P.G.vertexSet ∪ X) (hE : Q.G.edgeSet = P.G.edgeSet) + (hΔ : ∀ e ∈ P.G.edgeSet, ∀ δ ∈ P.Δ e, δ ⊔ emptySubgraph (X ∩ Q.G.ends e) ∈ Q.Δ e) : + Q.IsRealization (H ⊔ emptySubgraph X) := by + have hv := hH.verts_eq + obtain ⟨δ, hδ, rfl⟩ := hH + refine ⟨fun e ↦ δ e ⊔ emptySubgraph (X ∩ Q.G.ends e), fun e he ↦ hΔ e (hE ▸ he) _ (hδ e + (hE ▸ he)), + ?_⟩ + have hv' := realizationOf_verts (G := Q.G.toHypergraph) + (δ := fun e ↦ δ e ⊔ emptySubgraph (X ∩ Q.G.ends e)) fun e he ↦ + ((Q.Δ e).verts_eq _ (hΔ e (hE ▸ he) _ (hδ e (hE ▸ he)))).trans (Q.Δ_verts e he) + apply SimpleGraph.Subgraph.ext + · rw [hv'] + simp only [SimpleGraph.Subgraph.verts_sup, emptySubgraph_verts, hv, hV] + · funext a b + apply propext + rw [realizationOf_adj] + simp only [SimpleGraph.Subgraph.sup_adj, not_emptySubgraph_adj, or_false, realizationOf_adj, hE] + +/-- `Q` arises from `S` by adding the vertex `v` and changing the edges in `A`. -/ +structure VertexStep {Ω Ω' : Type*} (Q : Patchwork Ω α β) (S : Patchwork Ω' α β) (v : α) (A : Set β) + (k : ℕ) : Prop where + v_notMem : v ∉ S.G.vertexSet + vertexSet_eq : Q.G.vertexSet = S.G.vertexSet ∪ {v} + edgeSet_eq : Q.G.edgeSet = S.G.edgeSet + dom_eq : Q.dom = S.dom + A_subset : A ⊆ S.dom + ends_ne : ∀ e ∈ S.G.edgeSet, e ∉ A → Q.G.ends e = S.G.ends e + μ_ne : ∀ e ∈ S.dom, e ∉ A → Q.μ e = S.μ e + Δ_ne : ∀ e ∈ S.G.edgeSet, e ∉ A → Q.Δ e = S.Δ e + μ_subset : ∀ e ∈ A, ∀ x ∈ Q.μ e, x ∈ S.μ e ++ [v] + length_le : ∀ e ∈ A, (S.μ e ++ [v]).length ≤ k + +/-- The expansion `η` with the new vertex `v` sent to `{v'}`. -/ +noncomputable def addVertex (ηv : α → Set α) (v v' : α) : α → Set α := by + classical exact fun x ↦ if x = v then {v'} else ηv x + +theorem addVertex_self (ηv : α → Set α) (v v' : α) : addVertex ηv v v' v = {v'} := by + simp [addVertex] + +theorem addVertex_of_ne {ηv : α → Set α} {v v' x : α} (h : x ≠ v) : + addVertex ηv v v' x = ηv x := by + simp [addVertex, h] + +/-- The core of (4.7) and (4.9): a realizable expansion of `S` in `S'` gives a simulation of `Q` in +`Q'`, when edges of `A` go to edges of `A'` with the same codes. -/ +theorem simulated_of_vertexStep {Ω Ω₁ : Type*} [Preorder Ω] [Preorder Ω₁] {Q Q' : Patchwork Ω α β} + {S S' : Patchwork Ω₁ α β} {v v' : α} {A A' : Set β} {k : ℕ} (hS : VertexStep Q S v A k) + (hS' : VertexStep Q' S' v' A' k) {ηv : α → Set α} {ηe : β → β} + (hη : IsRealizableExpansion S S' ηv ηe) (hA : ∀ e ∈ S.G.edgeSet, e ∈ A ↔ ηe e ∈ A') + (hcode : ∀ e ∈ A, edgeCode k (S.μ e ++ [v]) Q e = edgeCode k (S'.μ (ηe e) ++ [v']) Q' (ηe e)) + (hφ : ∀ e ∈ S.G.edgeSet, Q.φ e ≤ Q'.φ (ηe e)) + (hlen : Q.G.roots.length = Q'.G.roots.length) + (hroots : ∀ (i : ℕ) (hi : i < Q.G.roots.length) (hi' : i < Q'.G.roots.length), + Q'.G.roots[i] ∈ addVertex ηv v v' Q.G.roots[i]) + (hΔ' : ∀ e ∈ S'.G.edgeSet \ ηe '' S.G.edgeSet, ∀ δ ∈ S'.Δ e, + δ ⊔ emptySubgraph ({v'} ∩ Q'.G.ends e) ∈ Q'.Δ e) : + Simulated Q Q' := by + obtain ⟨hex, H, hH, hcomp⟩ := hη + have hne : ∀ {x}, x ∈ S.G.vertexSet → x ≠ v := fun hx h ↦ hS.v_notMem (h ▸ hx) + have hne' : ∀ {x}, x ∈ S'.G.vertexSet → x ≠ v' := fun hx h ↦ hS'.v_notMem (h ▸ hx) + have hη₂ : ∀ {x}, x ∈ S.G.vertexSet → addVertex ηv v v' x = ηv x := fun hx ↦ + addVertex_of_ne (hne hx) + have hV : ∀ {x}, x ∈ Q.G.vertexSet → x ∈ S.G.vertexSet ∨ x = v := fun {x} hx ↦ by + rw [hS.vertexSet_eq] at hx + exact hx + have hincA : ∀ {e x}, e ∉ A → Q.G.Inc e x → S.G.Inc e x := by + intro e x heA hx + have heS : e ∈ S.G.edgeSet := hS.edgeSet_eq ▸ Q.G.edge_mem_of_inc hx + have : x ∈ Q.G.ends e := hx + rw [hS.ends_ne e heS heA] at this + exact this + have hμmem : ∀ {R : Patchwork Ω₁ α β} {e x}, e ∈ R.dom → x ∈ R.μ e → x ∈ R.G.vertexSet := by + intro R e x he hx + have h₁ : x ∈ {x | x ∈ R.μ e} := hx + rw [R.μ_set e he] at h₁ + exact R.G.vertex_mem_of_inc h₁ + have hdomA : ∀ {e}, e ∈ A → e ∈ S.G.edgeSet := fun he ↦ S.dom_subset (hS.A_subset he) + have hμlen : ∀ e ∈ A, (Q.μ e).length = (Q'.μ (ηe e)).length := by + intro e he + have he' := (hA e (hdomA he)).mp he + have h₁ := hcode e he + simp only [edgeCode, Prod.mk.injEq] at h₁ + have hd : e ∈ Q.dom := hS.dom_eq ▸ hS.A_subset he + have hd' : ηe e ∈ Q'.dom := hS'.dom_eq ▸ hS'.A_subset he' + exact length_eq_of_code (hS.length_le e he) (hS'.length_le _ he') (Q.μ_nodup e hd) + (Q'.μ_nodup _ hd') (hS.μ_subset e he) (hS'.μ_subset _ he') h₁.2.2.1 + have hposition : ∀ e ∈ A, ∀ (i : Fin k) (x y : α), (S.μ e ++ [v])[i.1]? = some x → + (S'.μ (ηe e) ++ [v'])[i.1]? = some y → y ∈ addVertex ηv v v' x := by + intro e he i x y hx hy + have hSd := hS.A_subset he + have hL := hex.μ_length e hSd + by_cases hi : i.1 < (S.μ e).length + · have hi' : i.1 < (S'.μ (ηe e)).length := hL ▸ hi + rw [List.getElem?_append_left hi] at hx + rw [List.getElem?_append_left hi'] at hy + obtain ⟨hl, h₂⟩ := List.getElem?_eq_some_iff.mp hx + obtain ⟨hl', h₂'⟩ := List.getElem?_eq_some_iff.mp hy + have hm := hex.μ_mem e hSd i.1 hl hl' + rw [h₂, h₂'] at hm + rw [hη₂ (hμmem hSd (h₂ ▸ List.getElem_mem hl))] + exact hm + · have hi' : ¬ i.1 < (S'.μ (ηe e)).length := hL ▸ hi + rw [List.getElem?_append_right (by omega)] at hx + rw [List.getElem?_append_right (by omega)] at hy + have h₁ : i.1 - (S.μ e).length = 0 := by + have := (List.getElem?_eq_some_iff.mp hx).1 + simp only [List.length_singleton] at this + omega + have h₂ : i.1 - (S'.μ (ηe e)).length = 0 := by rw [← hL]; exact h₁ + rw [h₁] at hx + rw [h₂] at hy + have e₁ : v = x := by simpa using hx + have e₂ : v' = y := by simpa using hy + rw [← e₁, ← e₂, addVertex_self] + rfl + refine ⟨addVertex ηv v v', ηe, ?_, H ⊔ emptySubgraph {v'}, ?_, ?_⟩ + · refine + { vertex_nonempty := fun x hx ↦ ?_ + vertex_subset := fun x hx y hy ↦ ?_ + edge_mem := fun e he ↦ ?_ + vertex_disjoint := fun x₁ h₁ x₂ h₂ hx ↦ ?_ + edge_injOn := hS.edgeSet_eq ▸ hex.edge_injOn + mem_dom_iff := fun e he ↦ ?_ + ends_nonempty := fun e he hd x hx ↦ ?_ + μ_length := fun e he ↦ ?_ + μ_mem := fun e he i hi hi' ↦ ?_ + roots_length := hlen + roots_mem := hroots + maps_Δ := fun e he ↦ ?_ + φ_le := fun e he ↦ hφ e (hS.edgeSet_eq ▸ he) } + · rcases hV hx with hx | rfl + · rw [hη₂ hx] + exact hex.vertex_nonempty x hx + · rw [addVertex_self] + exact singleton_nonempty _ + · rw [hS'.vertexSet_eq] + rcases hV hx with hx | rfl + · rw [hη₂ hx] at hy + exact Or.inl (hex.vertex_subset x hx hy) + · rw [addVertex_self] at hy + exact Or.inr hy + · rw [hS'.edgeSet_eq] + exact hex.edge_mem e (hS.edgeSet_eq ▸ he) + · rcases hV h₁ with h₁ | rfl <;> rcases hV h₂ with h₂ | rfl + · rw [hη₂ h₁, hη₂ h₂] + exact hex.vertex_disjoint x₁ h₁ x₂ h₂ hx + · rw [hη₂ h₁, addVertex_self, Set.disjoint_singleton_right] + exact fun hmem ↦ hS'.v_notMem (hex.vertex_subset x₁ h₁ hmem) + · rw [hη₂ h₂, addVertex_self, Set.disjoint_singleton_left] + exact fun hmem ↦ hS'.v_notMem (hex.vertex_subset x₂ h₂ hmem) + · exact absurd rfl hx + · rw [hS.dom_eq, hS'.dom_eq] + exact hex.mem_dom_iff e (hS.edgeSet_eq ▸ he) + · have heS : e ∈ S.G.edgeSet := hS.edgeSet_eq ▸ he + have hdS : e ∉ S.dom := hS.dom_eq ▸ hd + have heA : e ∉ A := fun h ↦ hdS (hS.A_subset h) + have hxS := hincA heA hx + obtain ⟨y, hy, hinc⟩ := hex.ends_nonempty e heS hdS x hxS + rw [hη₂ (S.G.vertex_mem_of_inc hxS)] + have heA' : ηe e ∉ A' := fun h ↦ heA ((hA e heS).mpr h) + refine ⟨y, hy, ?_⟩ + have : y ∈ Q'.G.ends (ηe e) := by + rw [hS'.ends_ne _ (hex.edge_mem e heS) heA'] + exact hinc + exact this + · by_cases heA : e ∈ A + · exact hμlen e heA + · have hdS : e ∈ S.dom := hS.dom_eq ▸ he + have heA' : ηe e ∉ A' := fun h ↦ heA ((hA e (S.dom_subset hdS)).mpr h) + rw [hS.μ_ne e hdS heA, hS'.μ_ne _ ((hex.mem_dom_iff e (S.dom_subset hdS)).mp hdS) heA'] + exact hex.μ_length e hdS + · by_cases heA : e ∈ A + · have h₁ := hcode e heA + simp only [edgeCode, Prod.mk.injEq] at h₁ + have heA' := (hA e (hdomA heA)).mp heA + have hx := hS.μ_subset e heA _ (List.getElem_mem hi) + obtain ⟨j, hj⟩ := exists_index (hS.length_le e heA) hx + have hdQ : e ∈ Q.dom := hS.dom_eq ▸ hS.A_subset heA + obtain ⟨y, hy, hyj⟩ := marchCode_forward h₁.2.2.1 + ((length_le_of_subset (Q.μ_nodup e hdQ) (hS.μ_subset e heA)).trans (hS.length_le e heA)) + (List.getElem?_eq_getElem hi) hj + rw [List.getElem?_eq_getElem hi'] at hy + rw [Option.some.inj hy] + exact hposition e heA j _ y hj hyj + · have hdS : e ∈ S.dom := hS.dom_eq ▸ he + have heA' : ηe e ∉ A' := fun h ↦ heA ((hA e (S.dom_subset hdS)).mpr h) + have hd' := (hex.mem_dom_iff e (S.dom_subset hdS)).mp hdS + have e₁ := hS.μ_ne e hdS heA + have e₂ := hS'.μ_ne _ hd' heA' + simp only [e₁, e₂] at hi hi' ⊢ + rw [hη₂ (hμmem hdS (List.getElem_mem hi))] + exact hex.μ_mem e hdS i hi hi' + · by_cases heA : e ∈ A + · have h₁ := hcode e heA + simp only [edgeCode, Prod.mk.injEq] at h₁ + have heA' := (hA e (hdomA heA)).mp heA + have hdQ : e ∈ Q.dom := hS.dom_eq ▸ hS.A_subset heA + have hdQ' : ηe e ∈ Q'.dom := hS'.dom_eq ▸ hS'.A_subset heA' + refine mapsTo_of_code (hS.length_le e heA) (hS'.length_le _ heA') (Q.μ_nodup e hdQ) + (Q'.μ_nodup _ hdQ') (hS.μ_subset e heA) (hS'.μ_subset _ heA') ?_ ?_ h₁.2.2.1 h₁.2.2.2 + · rw [Q.Δ_verts e (Q.dom_subset hdQ), Q.μ_set e hdQ] + · rw [Q'.Δ_verts _ (Q'.dom_subset hdQ'), Q'.μ_set _ hdQ'] + · have hdS : e ∈ S.dom := hS.dom_eq ▸ he + have heS := S.dom_subset hdS + have heA' : ηe e ∉ A' := fun h ↦ heA ((hA e heS).mpr h) + have hd' := (hex.mem_dom_iff e heS).mp hdS + rw [hS.μ_ne e hdS heA, hS'.μ_ne _ hd' heA', hS.Δ_ne e heS heA, + hS'.Δ_ne _ (S'.dom_subset hd') heA'] + exact hex.maps_Δ e hdS + · have himg : ηe '' Q.G.edgeSet = ηe '' S.G.edgeSet := by rw [hS.edgeSet_eq] + rw [himg] + refine realization_sup_emptySubgraph {v'} hH ?_ ?_ ?_ + · exact hS'.vertexSet_eq + · change Q'.G.edgeSet \ _ = S'.G.edgeSet \ _ + rw [hS'.edgeSet_eq] + · intro e he δ hδ + have hends : (Q'.deleteEdges (ηe '' S.G.edgeSet)).G.ends e = Q'.G.ends e := by + ext x + exact ⟨fun h ↦ h.1, fun h ↦ ⟨h, he.2⟩⟩ + change _ ∈ Q'.Δ e + rw [hends] + exact hΔ' e he δ hδ + · intro x hx + have hHv : H.verts = S'.G.vertexSet := hH.verts_eq + rcases hV hx with hx | rfl + · obtain ⟨D, hD, hDv⟩ := hcomp x hx + exact ⟨D, hD.sup_emptySubgraph _, by rw [hDv, hη₂ hx]⟩ + · refine ⟨_, ⟨⟨v', Or.inr rfl⟩, rfl⟩, ?_⟩ + rw [addVertex_self] + exact component_sup_emptySubgraph_verts_of_notMem H (Set.mem_singleton v') + (hHv ▸ hS'.v_notMem) + +/-- The order on labels in the proofs of (4.7) and (4.9): the old labels, and a new copy for the +edges in `A`, which also carries a code. -/ +abbrev StepLabel (Ω : Type*) (k : ℕ) := DisjointUnionQuasiOrder Ω (Discrete (EdgeCode k) × Ω) + +theorem wqo_stepLabel {Ω : Type*} [Preorder Ω] (hΩ : WellQuasiOrderedLE Ω) (k : ℕ) : + WellQuasiOrderedLE (StepLabel Ω k) := by + have := wqo_discrete (EdgeCode k) + exact wqo_disjointUnion hΩ inferInstance + +open Classical in +/-- The label of an edge of `Q`, as a label of the matching edge of `S`. -/ +noncomputable def stepLabel {Ω Ω' : Type*} (Q : Patchwork Ω α β) (S : Patchwork Ω' α β) (v : α) + (A : Set β) (k : ℕ) (e : β) : StepLabel Ω k := + if e ∈ A then Sum.inr (edgeCode k (S.μ e ++ [v]) Q e, Q.φ e) else Sum.inl (Q.φ e) + +/-- An inequality of step labels says that the edges are both in `A` and `A'` or neither, that the +old +labels do not go down, and that the codes agree. -/ +theorem stepLabel_le {Ω Ω' Ω'' : Type*} [Preorder Ω] {Q Q' : Patchwork Ω α β} {S : Patchwork Ω' α β} + {S' : Patchwork Ω'' α β} {v v' : α} {A A' : Set β} {k : ℕ} {e e' : β} + (h : stepLabel Q S v A k e ≤ stepLabel Q' S' v' A' k e') : + (e ∈ A ↔ e' ∈ A') ∧ Q.φ e ≤ Q'.φ e' ∧ + (e ∈ A → edgeCode k (S.μ e ++ [v]) Q e = edgeCode k (S'.μ e' ++ [v']) Q' e') := by + classical + by_cases he : e ∈ A <;> by_cases he' : e' ∈ A' <;> + simp only [stepLabel, he, he', ↓reduceIte] at h + · have hle : DisjointUnionLE _ _ := h + cases hle with + | inr h => exact ⟨iff_of_true he he', h.2, fun _ ↦ h.1⟩ + · exact nomatch (show DisjointUnionLE _ _ from h) + · exact nomatch (show DisjointUnionLE _ _ from h) + · have hle : DisjointUnionLE _ _ := h + cases hle with + | inl h => exact ⟨iff_of_false he he', h, fun h' ↦ absurd h' he⟩ + +/-- Graph Minors XX, (4.7) (page 332): "Let $\mathcal{F}_1$ be a well-behaved set of patchworks and +let $\mathcal{F}_2$ be a set of +patchworks each of which is a 1-vertex extension of a member of $\mathcal{F}_1$. Then +$\mathcal{F}_2$ is well-behaved." -/ +theorem theorem_4_7_proof {𝓕₁ 𝓕₂ : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕₁) + (h₂ : ∀ P₂ ∈ 𝓕₂, ∃ P₁ ∈ 𝓕₁, ∃ f v, IsOneVertexExtension P₁ P₂ f v) : WellBehaved 𝓕₂ := by + classical + obtain ⟨N, hN⟩ := theorem_4_1_proof h + refine wellBehaved_of_encoding h fun Ω₂ _ hΩ₂ ↦ + ⟨StepLabel Ω₂ (N + 1), inferInstance, wqo_stepLabel hΩ₂ _, fun Q S ↦ ∃ f v, + VertexStep Q S v {f} (N + 1) ∧ Q.G.roots = S.G.roots ∧ + ∀ e, S.φ e = stepLabel Q S v {f} (N + 1) e, ?_, ?_⟩ + · rintro Q ⟨P₂, hP₂, hQ⟩ + obtain ⟨P₁, hP₁, f, v, hx⟩ := h₂ P₂ hP₂ + have hb : SameBase P₂ Q := hQ.sameBase + have hends : ∀ e, Q.G.ends e = P₂.G.ends e := fun e ↦ by simp only [Hypergraph.ends, hb.inc_eq] + refine ⟨P₁.relabel (stepLabel Q P₁ v {f} (N + 1)), ⟨P₁, hP₁, isCompletionOf_relabel _ _⟩, f, v, + ?_, ?_, fun _ ↦ rfl⟩ + · refine + { v_notMem := hx.v_notMem + vertexSet_eq := hb.vertexSet_eq.trans hx.vertexSet_eq + edgeSet_eq := hb.edgeSet_eq.trans hx.edgeSet_eq + dom_eq := hb.dom_eq.trans hx.dom_eq + A_subset := singleton_subset_iff.mpr hx.f_mem + ends_ne := fun e he hef ↦ (hends e).trans (hx.ends_ne e he hef) + μ_ne := fun e he hef ↦ (hb.μ_eq (hx.dom_eq ▸ he)).trans (hx.μ_ne e he hef) + Δ_ne := fun e he hef ↦ (hb.Δ_eq (hx.edgeSet_eq ▸ he)).trans (hx.Δ_ne e he hef) + μ_subset := ?_ + length_le := ?_ } + · rintro e rfl x hxm + have hfd : e ∈ Q.dom := by rw [hb.dom_eq, hx.dom_eq]; exact hx.f_mem + have h₁ : x ∈ {x | x ∈ Q.μ e} := hxm + rw [Q.μ_set e hfd, hends, hx.ends_f, ← P₁.μ_set e hx.f_mem] at h₁ + rcases h₁ with h₁ | rfl + · exact List.mem_append_left _ h₁ + · simp + · rintro e rfl + have := hN P₁ hP₁ e hx.f_mem + simp only [List.length_append, List.length_singleton] + exact Nat.succ_le_succ this + · rw [hQ.G_eq, hx.roots_eq] + rfl + · rintro Q - Q' - S S' ⟨f, v, hS, hr, hφ⟩ ⟨f', v', hS', hr', hφ'⟩ ⟨ηv, ηe, hη⟩ + have hl : ∀ e ∈ S.G.edgeSet, _ := fun e he ↦ by + have := hη.1.φ_le e he + rw [hφ, hφ'] at this + exact stepLabel_le this + have hf : f ∈ S.G.edgeSet := S.dom_subset (hS.A_subset rfl) + have hηf : ηe f = f' := (hl f hf).1.mp rfl + refine simulated_of_vertexStep hS hS' hη (fun e he ↦ (hl e he).1) ?_ (fun e he ↦ (hl e he).2.1) + ?_ ?_ ?_ + · rintro e rfl + exact (hl e hf).2.2 rfl + · rw [hr, hr'] + exact hη.1.roots_length + · intro i hi hi' + simp only [hr, hr'] at hi hi' ⊢ + rw [addVertex_of_ne fun h ↦ hS.v_notMem (by + rw [← h] + exact S.G.roots_subset _ (List.getElem_mem hi))] + exact hη.1.roots_mem i hi hi' + · rintro e ⟨he, hne⟩ δ hδ + have hef : e ∉ ({f'} : Set β) := fun h ↦ hne ⟨f, hf, hηf.trans h.symm⟩ + rw [hS'.ends_ne e he hef, hS'.Δ_ne e he hef] + have : ({v'} : Set α) ∩ S'.G.ends e = ∅ := by + rw [Set.singleton_inter_eq_empty] + exact fun h ↦ hS'.v_notMem (S'.G.vertex_mem_of_inc h) + rw [this, sup_emptySubgraph_empty] + exact hδ + +/-- The members of `𝓕` extended `n` times by one vertex. -/ +def extensions (𝓕 : Set (UnlabeledPatchwork α β)) : ℕ → Set (UnlabeledPatchwork α β) + | 0 => 𝓕 + | n + 1 => {P₂ | ∃ P₁ ∈ extensions 𝓕 n, ∃ f v, IsOneVertexExtension P₁ P₂ f v} + +/-- Graph Minors XX, (4.8) (page 333): "Let $\mathcal{F}_1$ be a well-behaved set of patchworks, let +$k \ge 0$, and let +$\mathcal{F}_2$ be the set of all patchworks $P_2$ such that there exist $P_1 \in +\mathcal{F}_1$ and a sequence* $$ P_1 = P^0, P^1, \dots, P^{k'} = P_2 $$ *where $k' \le k$ +and for $1 \le i \le k'$, $P^i$ is a 1-vertex extension of $P^{i-1}$. Then $\mathcal{F}_2$ +is well-behaved." -/ +theorem theorem_4_8_proof {𝓕₁ : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕₁) (k : ℕ) : + WellBehaved {P₂ | ∃ s : ℕ → UnlabeledPatchwork α β, ∃ k' ≤ k, s 0 ∈ 𝓕₁ ∧ s k' = P₂ ∧ + ∀ i < k', ∃ f v, IsOneVertexExtension (s i) (s (i + 1)) f v} := by + have hn : ∀ n, WellBehaved (extensions 𝓕₁ n) := by + intro n + induction n with + | zero => exact h + | succ n ih => exact theorem_4_7_proof ih fun _ hP ↦ hP + refine (WellBehaved.iUnion_lt (𝓕 := extensions 𝓕₁) (k + 1) fun i _ ↦ hn i).mono ?_ + rintro P₂ ⟨s, k', hk', h0, rfl, hs⟩ + have hmem : ∀ i ≤ k', s i ∈ extensions 𝓕₁ i := by + intro i + induction i with + | zero => exact fun _ ↦ h0 + | succ i ih => exact fun hi ↦ ⟨s i, ih (by omega), hs i (by omega)⟩ + simp only [mem_iUnion, exists_prop] + exact ⟨k', by omega, hmem k' le_rfl⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section4d.lean b/LeanPool/GraphMinor/GM20/Section4d.lean new file mode 100644 index 0000000000..6a754cd8e7 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section4d.lean @@ -0,0 +1,384 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section4c + +/-! +# Graph Minors XX, Section 4, (4.9) + +This file proves (4.9): if deleting at most `θ` vertices from each member of `𝓕₂` gives a member of +a +well-behaved set `𝓕₁`, then `𝓕₂` is well-behaved. By induction on `θ` it suffices to take one vertex +`v`. The edges at `v` then carry codes as in (4.7), and `simulated_of_vertexStep` applies. + +The encoding of the paper records nothing about roots, but `v` may be a root, and an expansion must +preserve its position. We fix this as follows. Members of `𝓕₁` have boundedly many roots, so `𝓕₂` +splits into finitely many sets according to the position of `v` in `π(G₂)`, and we treat each set +separately (`wellBehaved_oneSlash`). +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +theorem Patch.ext_of {Δ Δ' : Patch α} (h : Δ.verts = Δ'.verts) (h' : Δ.groupings = Δ'.groupings) : + Δ = Δ' := by + cases Δ + cases Δ' + cases h + cases h' + rfl + +theorem emptySubgraph_sup (X Y : Set α) : + (emptySubgraph X ⊔ emptySubgraph Y : (⊤ : SimpleGraph α).Subgraph) = emptySubgraph (X ∪ Y) := by + apply SimpleGraph.Subgraph.ext + · rfl + · funext a b + simp + +theorem patchSlash_of_disjoint {Δ : Patch α} {W : Set α} (h : Disjoint W Δ.verts) : + patchSlash Δ W = Δ := by + have hV : Δ.verts \ W = Δ.verts := h.symm.sdiff_eq_left + have hI : W ∩ Δ.verts = ∅ := h.inter_eq + refine Patch.ext_of hV ?_ + ext K + constructor + · rintro ⟨-, -, hK⟩ + rw [hI, sup_emptySubgraph_empty] at hK + exact hK + · intro hK + refine ⟨by rw [hV]; exact Δ.isGrouping K hK, by rw [hV]; exact Δ.verts_eq K hK, ?_⟩ + rw [hI, sup_emptySubgraph_empty] + exact hK + +theorem marchSlash_of_disjoint {π : List α} {W : Set α} (h : ∀ x ∈ π, x ∉ W) : + marchSlash π W = π := by + classical + simpa [marchSlash] using h + +theorem marchSlash_marchSlash (π : List α) (W₁ W₂ : Set α) : + marchSlash (marchSlash π W₁) W₂ = marchSlash π (W₁ ∪ W₂) := by + classical + simp only [marchSlash, List.filter_filter] + apply List.filter_congr + intro x _ + by_cases h₁ : x ∈ W₁ <;> by_cases h₂ : x ∈ W₂ <;> simp [h₁, h₂] + +theorem patchSlash_patchSlash (Δ : Patch α) (W₁ W₂ : Set α) : + patchSlash (patchSlash Δ W₁) W₂ = patchSlash Δ (W₁ ∪ W₂) := by + have hV : (Δ.verts \ W₁) \ W₂ = Δ.verts \ (W₁ ∪ W₂) := by + ext x + simp [not_or, and_assoc] + have hI : (W₂ ∩ (Δ.verts \ W₁)) ∪ (W₁ ∩ Δ.verts) = (W₁ ∪ W₂) ∩ Δ.verts := by + ext x + by_cases h₁ : x ∈ W₁ <;> simp [h₁, and_comm] + have hsup : ∀ K : (⊤ : SimpleGraph α).Subgraph, + K ⊔ emptySubgraph (W₂ ∩ (Δ.verts \ W₁)) ⊔ emptySubgraph (W₁ ∩ Δ.verts) = + K ⊔ emptySubgraph ((W₁ ∪ W₂) ∩ Δ.verts) := fun K ↦ by + rw [sup_assoc, emptySubgraph_sup, hI] + refine Patch.ext_of hV ?_ + ext K + change (IsGrouping ((Δ.verts \ W₁) \ W₂) K ∧ K.verts = (Δ.verts \ W₁) \ W₂ ∧ + K ⊔ emptySubgraph (W₂ ∩ (Δ.verts \ W₁)) ∈ patchSlash Δ W₁) ↔ + (IsGrouping (Δ.verts \ (W₁ ∪ W₂)) K ∧ K.verts = Δ.verts \ (W₁ ∪ W₂) ∧ + K ⊔ emptySubgraph ((W₁ ∪ W₂) ∩ Δ.verts) ∈ Δ) + rw [hV] + constructor + · rintro ⟨h₁, h₂, -, -, h₃⟩ + exact ⟨h₁, h₂, (hsup K) ▸ h₃⟩ + · rintro ⟨h₁, h₂, h₃⟩ + refine ⟨h₁, h₂, ?_, ?_, (hsup K).symm ▸ h₃⟩ + · apply isGrouping_sup_emptySubgraph + rwa [hV] + · ext x + simp only [SimpleGraph.Subgraph.verts_sup, emptySubgraph_verts, h₂, ← hV] + by_cases hx : x ∈ W₂ <;> simp [hx] + +theorem RootedHypergraph.ext_of {G G' : RootedHypergraph α β} (hV : G.vertexSet = G'.vertexSet) + (hE : G.edgeSet = G'.edgeSet) (hI : G.Inc = G'.Inc) (hr : G.roots = G'.roots) : G = G' := by + obtain ⟨⟨_, _, _, _, _, _, _⟩, _, _, _⟩ := G + obtain ⟨⟨_, _, _, _, _, _, _⟩, _, _, _⟩ := G' + cases hV + cases hE + cases hI + cases hr + rfl + +theorem IsCompletionOf.refl {Ω : Type*} (P : Patchwork Ω α β) : IsCompletionOf P P := + ⟨rfl, rfl, fun _ _ ↦ rfl, fun _ _ ↦ rfl⟩ + +theorem IsCompletionOf.slash {Ω Ω' : Type*} {P : Patchwork Ω α β} {Q : Patchwork Ω' α β} + (h : IsCompletionOf P Q) (W : Set α) : IsCompletionOf (P.slash W) (Q.slash W) where + G_eq := by + change Q.G.slash W = P.G.slash W + rw [h.G_eq] + dom_eq := h.dom_eq + μ_eq _ he := congrArg (marchSlash · W) (h.μ_eq he) + Δ_eq _ he := congrArg (patchSlash · W) (h.Δ_eq he) + +theorem slash_slash {Ω : Type*} (P : Patchwork Ω α β) (W₁ W₂ : Set α) : + IsCompletionOf ((P.slash W₁).slash W₂) (P.slash (W₁ ∪ W₂)) where + G_eq := by + refine RootedHypergraph.ext_of ?_ rfl ?_ (marchSlash_marchSlash _ _ _).symm + · change P.G.vertexSet \ (W₁ ∪ W₂) = (P.G.vertexSet \ W₁) \ W₂ + ext x + simp [not_or, and_assoc] + · funext e x + apply propext + change (P.G.Inc e x ∧ x ∉ W₁ ∪ W₂) ↔ ((P.G.Inc e x ∧ x ∉ W₁) ∧ x ∉ W₂) + simp [not_or, and_assoc] + dom_eq := rfl + μ_eq _ _ := (marchSlash_marchSlash _ _ _).symm + Δ_eq _ _ := (patchSlash_patchSlash _ _ _).symm + +theorem slash_empty {Ω : Type*} (P : Patchwork Ω α β) : IsCompletionOf (P.slash ∅) P where + G_eq := by + refine RootedHypergraph.ext_of ?_ rfl ?_ (marchSlash_of_disjoint fun _ _ ↦ id).symm + · exact (Set.sdiff_empty).symm + · funext e x + apply propext + exact ⟨fun h ↦ ⟨h, id⟩, fun h ↦ h.1⟩ + dom_eq := rfl + μ_eq _ _ := (marchSlash_of_disjoint fun _ _ ↦ id).symm + Δ_eq _ _ := (patchSlash_of_disjoint (Set.empty_disjoint _)).symm + +theorem WellBehaved.completions {𝓕 : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕) : + WellBehaved (completions Unit 𝓕) := by + intro Ω _ hΩ Q hQ + refine h Ω hΩ Q fun i ↦ ?_ + obtain ⟨P, ⟨P₁, hP₁, hc⟩, hc'⟩ := hQ i + exact ⟨P₁, hP₁, hc.trans hc'⟩ + +theorem marchSlash_eq_eraseIdx {r : List α} {v : α} {p : ℕ} (hr : r.Nodup) + (hp : r[p]? = some v) : marchSlash r {v} = r.eraseIdx p := by + classical + obtain ⟨hl, rfl⟩ := List.getElem?_eq_some_iff.mp hp + rw [← hr.erase_getElem p hl, hr.erase_eq_filter] + simp only [marchSlash] + apply List.filter_congr + intro x _ + by_cases hx : x = r[p] <;> simp [hx] + +/-- The numbers of roots and the positions of roots compare well between `r` and `r'` when `v` and +`v'` have the same position in them. -/ +theorem roots_transfer {r r' : List α} {v v' : α} {p K : ℕ} (nd : r.Nodup) (nd' : r'.Nodup) + {η : α → Set α} (hr : r.length ≤ K) (hr' : r'.length ≤ K) + (hpos : r[p]? = some v ∨ (p = K ∧ v ∉ r)) (hpos' : r'[p]? = some v' ∨ (p = K ∧ v' ∉ r')) + (hlen : (marchSlash r {v}).length = (marchSlash r' {v'}).length) + (hmem : ∀ (i : ℕ) (hi : i < (marchSlash r {v}).length) + (hi' : i < (marchSlash r' {v'}).length), (marchSlash r' {v'})[i] ∈ η (marchSlash r {v})[i]) : + r.length = r'.length ∧ ∀ (i : ℕ) (hi : i < r.length) (hi' : i < r'.length), + r'[i] ∈ addVertex η v v' r[i] := by + have hbig : ∀ {s : List α} {x}, s.length ≤ K → p = K → s[p]? = some x → False := by + intro s x hs hp h + have := (List.getElem?_eq_some_iff.mp h).1 + omega + rcases hpos with hp | ⟨hK, hv⟩ <;> rcases hpos' with hp' | ⟨hK', hv'⟩ + · have hl := (List.getElem?_eq_some_iff.mp hp).1 + have hl' := (List.getElem?_eq_some_iff.mp hp').1 + rw [marchSlash_eq_eraseIdx nd hp, marchSlash_eq_eraseIdx nd' hp'] at hmem hlen + rw [List.length_eraseIdx_of_lt hl, List.length_eraseIdx_of_lt hl'] at hlen + have hL : r.length = r'.length := by omega + refine ⟨hL, fun i hi hi' ↦ ?_⟩ + have hv : r[p] = v := (List.getElem?_eq_some_iff.mp hp).2 + have hv' : r'[p] = v' := (List.getElem?_eq_some_iff.mp hp').2 + rcases lt_trichotomy i p with hip | rfl | hip + · have := hmem i (by rw [List.length_eraseIdx_of_lt hl]; omega) + (by rw [List.length_eraseIdx_of_lt hl']; omega) + simp only [List.getElem_eraseIdx, hip] at this + rw [addVertex_of_ne fun h ↦ hip.ne ((nd.getElem_inj_iff).mp (h.trans hv.symm))] + exact this + · rw [hv, hv', addVertex_self] + rfl + · obtain ⟨j, rfl⟩ : ∃ j, i = j + 1 := ⟨i - 1, by omega⟩ + have := hmem j (by rw [List.length_eraseIdx_of_lt hl]; omega) + (by rw [List.length_eraseIdx_of_lt hl']; omega) + have hnot : ¬ j < p := by omega + simp only [List.getElem_eraseIdx, hnot] at this + rw [addVertex_of_ne fun h ↦ hip.ne' ((nd.getElem_inj_iff).mp (h.trans hv.symm))] + exact this + · exact (hbig hr hK' hp).elim + · exact (hbig hr' hK hp').elim + · have e₁ : marchSlash r {v} = r := + marchSlash_of_disjoint fun x hx (h : x = v) ↦ hv (h ▸ hx) + have e₂ : marchSlash r' {v'} = r' := + marchSlash_of_disjoint fun x hx (h : x = v') ↦ hv' (h ▸ hx) + simp only [e₁, e₂] at hmem hlen + refine ⟨hlen, fun i hi hi' ↦ ?_⟩ + rw [addVertex_of_ne fun h ↦ hv (by rw [← h]; exact List.getElem_mem hi)] + exact hmem i hi hi' + +/-- `Q` arises from `Q / {v}` by a `VertexStep` in which `A` is the set of edges at `v`. -/ +theorem vertexStep_slash {Ω Ω' : Type*} (Q : Patchwork Ω α β) (φ : β → Ω') {v : α} + (hv : v ∈ Q.G.vertexSet) (hdom : Q.dom = Q.G.edgeSet) {k : ℕ} + (hk : ∀ e ∈ Q.dom, (marchSlash (Q.μ e) {v}).length + 1 ≤ k) : + VertexStep Q ((Q.slash {v}).relabel φ) v {e | Q.G.Inc e v} k where + v_notMem h := h.2 rfl + vertexSet_eq := by + change _ = (Q.G.vertexSet \ {v}) ∪ {v} + rw [Set.sdiff_union_self, Set.union_eq_self_of_subset_right (singleton_subset_iff.mpr hv)] + edgeSet_eq := rfl + dom_eq := rfl + A_subset e he := hdom.symm ▸ Q.G.edge_mem_of_inc he + ends_ne e _ he := by + ext x + refine ⟨fun hx ↦ ⟨hx, fun h ↦ he ?_⟩, fun hx ↦ hx.1⟩ + have h' : x = v := h + exact h' ▸ hx + μ_ne e he hne := (marchSlash_of_disjoint fun x hx (h : x = v) ↦ hne (by + have h₁ : x ∈ {x | x ∈ Q.μ e} := hx + rw [Q.μ_set e he, h] at h₁ + exact h₁)).symm + Δ_ne e he hne := (patchSlash_of_disjoint (by + rw [Q.Δ_verts e he] + exact Set.disjoint_singleton_left.mpr hne)).symm + μ_subset e _ x hx := by + change x ∈ marchSlash (Q.μ e) {v} ++ [v] + by_cases hxv : x = v + · simp [hxv] + · exact List.mem_append_left _ (mem_marchSlash.mpr ⟨hx, hxv⟩) + length_le e he := by + have := hk e (hdom.symm ▸ Q.G.edge_mem_of_inc he) + change (marchSlash (Q.μ e) {v} ++ [v]).length ≤ k + simpa using this + +theorem length_le_of_marchSlash {r : List α} (nd : r.Nodup) (v : α) : + r.length ≤ (marchSlash r {v}).length + 1 := by + by_cases hv : v ∈ r + · obtain ⟨p, hl, rfl⟩ := List.getElem_of_mem hv + rw [marchSlash_eq_eraseIdx nd (List.getElem?_eq_some_iff.mpr ⟨hl, rfl⟩), + List.length_eraseIdx_of_lt hl] + omega + · rw [marchSlash_of_disjoint (W := {v}) fun x hx (h : x = v) ↦ hv (h ▸ hx)] + omega + +/-- The members of `𝓕₂` in the one-vertex case of (4.9) in which the vertex `v` is at position `p` +of +the roots, or is not a root if `p = K`. -/ +def oneSlash (𝓕 : Set (UnlabeledPatchwork α β)) (p K : ℕ) : Set (UnlabeledPatchwork α β) := + {P₂ | P₂.dom = P₂.G.edgeSet ∧ ∃ v ∈ P₂.G.vertexSet, P₂.slash {v} ∈ completions Unit 𝓕 ∧ + (P₂.G.roots[p]? = some v ∨ (p = K ∧ v ∉ P₂.G.roots))} + +/-- The proof of the one-vertex case of (4.9), for a fixed position of `v`. -/ +theorem wellBehaved_oneSlash {𝓕 : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕) (p K : ℕ) + (hK : ∀ P ∈ 𝓕, P.G.roots.length + 1 ≤ K) : WellBehaved (oneSlash 𝓕 p K) := by + classical + obtain ⟨N, hN⟩ := theorem_4_1_proof h + refine wellBehaved_of_encoding h fun Ω₂ _ hΩ₂ ↦ + ⟨StepLabel Ω₂ (N + 1), inferInstance, wqo_stepLabel hΩ₂ _, fun Q S ↦ Q.dom = Q.G.edgeSet ∧ + ∃ v ∈ Q.G.vertexSet, (Q.G.roots[p]? = some v ∨ (p = K ∧ v ∉ Q.G.roots)) ∧ + Q.G.roots.length ≤ K ∧ (∀ e ∈ Q.dom, (marchSlash (Q.μ e) {v}).length + 1 ≤ N + 1) ∧ + S = (Q.slash {v}).relabel + (stepLabel Q (Q.slash {v}) v {e | Q.G.Inc e v} (N + 1)), ?_, ?_⟩ + · rintro Q ⟨P₂, ⟨hdom, v, hv, ⟨P₁, hP₁, hc⟩, hpos⟩, hQ⟩ + have hc' : IsCompletionOf P₁ (Q.slash {v}) := hc.trans (hQ.slash _) + have hr : Q.G.roots = P₂.G.roots := congrArg (·.roots) hQ.G_eq + have hE : Q.G.edgeSet = P₂.G.edgeSet := hQ.sameBase.edgeSet_eq + have hV : Q.G.vertexSet = P₂.G.vertexSet := hQ.sameBase.vertexSet_eq + refine ⟨_, ⟨P₁, hP₁, hc'.trans (isCompletionOf_relabel _ _)⟩, hQ.dom_eq.trans + (hdom.trans hE.symm), + v, hV ▸ hv, hr ▸ hpos, ?_, ?_, rfl⟩ + · have h₁ := length_le_of_marchSlash Q.G.roots_nodup v + have h₂ : (Q.slash {v}).G.roots = P₁.G.roots := congrArg (·.roots) hc'.G_eq + have h₃ := hK P₁ hP₁ + rw [← h₂] at h₃ + exact h₁.trans h₃ + · intro e he + have hd : e ∈ P₁.dom := by + have : (Q.slash {v}).dom = P₁.dom := hc'.dom_eq + rw [← this] + exact he + have h₂ : (Q.slash {v}).μ e = P₁.μ e := hc'.μ_eq hd + have h₃ := hN P₁ hP₁ e hd + rw [← h₂] at h₃ + exact Nat.succ_le_succ h₃ + · rintro Q - Q' - S S' ⟨hdom, v, hv, hpos, hlen, hb, rfl⟩ ⟨hdom', v', hv', hpos', hlen', hb', rfl⟩ + ⟨ηv, ηe, hη⟩ + have hl : ∀ e ∈ Q.G.edgeSet, _ := fun e he ↦ stepLabel_le (hη.1.φ_le e he) + obtain ⟨hL, hm⟩ := roots_transfer Q.G.roots_nodup Q'.G.roots_nodup hlen hlen' hpos hpos' + hη.1.roots_length hη.1.roots_mem + refine simulated_of_vertexStep (vertexStep_slash Q _ hv hdom hb) + (vertexStep_slash Q' _ hv' hdom' hb') hη (fun e he ↦ (hl e he).1) ?_ + (fun e he ↦ (hl e he).2.1) hL hm ?_ + · intro e he + exact (hl e (Q.G.edge_mem_of_inc he)).2.2 he + · rintro e ⟨he, -⟩ δ ⟨-, -, hδ⟩ + rw [Q'.Δ_verts e he] at hδ + exact hδ + +/-- The members of `𝓕₂` in the proof of (4.9) with `|W|` exactly `n`. -/ +def slashSet (𝓕 : Set (UnlabeledPatchwork α β)) (n : ℕ) : Set (UnlabeledPatchwork α β) := + {P₂ | P₂.dom = P₂.G.edgeSet ∧ ∃ W : Set α, W.Finite ∧ W.ncard = n ∧ W ⊆ P₂.G.vertexSet ∧ + P₂.slash W ∈ completions Unit 𝓕} + +/-- Graph Minors XX, (4.9) (page 333): "Let $\mathcal{F}_1$ be a well-behaved set of patchworks, let +$\theta \ge 0$, and let +$\mathcal{F}_2$ be the set of all patchworks $P_2 = (G_2, \mu_2, \Delta_2)$ such that +$dom(\mu_2) = E(G_2)$ and there exists $W \subseteq V(G_2)$ with $|W| \le \theta$ and $P_2/W +\in \mathcal{F}_1$. Then $\mathcal{F}_2$ is well-behaved." -/ +theorem theorem_4_9_proof {𝓕₁ : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕₁) (θ : ℕ) : + WellBehaved {P₂ | P₂.dom = P₂.G.edgeSet ∧ ∃ W : Set α, W.Finite ∧ W.ncard ≤ θ ∧ + W ⊆ P₂.G.vertexSet ∧ P₂.slash W ∈ completions Unit 𝓕₁} := by + have hn : ∀ n, WellBehaved (slashSet 𝓕₁ n) := by + intro n + induction n with + | zero => + refine h.completions.mono ?_ + rintro P₂ ⟨-, W, hW, hc, -, P₁, hP₁, hc'⟩ + have hW0 : W = ∅ := (Set.ncard_eq_zero hW).mp hc + subst hW0 + exact ⟨P₁, hP₁, hc'.trans (slash_empty P₂)⟩ + | succ n ih => + -- `K` bounds the number of roots, and we split according to the position of `v`. + obtain ⟨K₀, hK₀⟩ := ih.completions.exists_roots_le + refine (WellBehaved.iUnion_lt (𝓕 := fun p ↦ oneSlash (slashSet 𝓕₁ n) p (K₀ + 1)) (K₀ + 2) + fun p _ ↦ wellBehaved_oneSlash ih p _ fun P hP ↦ ?_).mono ?_ + · exact Nat.succ_le_succ (hK₀ P ⟨P, hP, IsCompletionOf.refl P⟩) + · rintro P₂ ⟨hdom, W, hW, hc, hsub, P₁, hP₁, hc'⟩ + obtain ⟨v, hvW⟩ : W.Nonempty := by + rw [← Set.ncard_pos hW, hc] + omega + have hmem : P₂.slash {v} ∈ slashSet 𝓕₁ n := by + refine ⟨hdom, W \ {v}, hW.subset sdiff_subset, ?_, ?_, P₁, hP₁, ?_⟩ + · rw [Set.ncard_sdiff (singleton_subset_iff.mpr hvW) (Set.finite_singleton v), hc, + Set.ncard_singleton] + rfl + · exact fun x hx ↦ ⟨hsub hx.1, hx.2⟩ + · have e : ({v} : Set α) ∪ W \ {v} = W := by + rw [Set.union_sdiff_self, Set.union_eq_self_of_subset_left + (singleton_subset_iff.mpr hvW)] + have := (slash_slash P₂ {v} (W \ {v})).symm + rw [e] at this + exact hc'.trans this + have hslash : P₂.slash {v} ∈ completions Unit (slashSet 𝓕₁ n) := + ⟨_, hmem, IsCompletionOf.refl _⟩ + have hlen : P₂.G.roots.length ≤ K₀ + 1 := by + have h₁ := length_le_of_marchSlash P₂.G.roots_nodup v + have h₂ := hK₀ _ hslash + exact h₁.trans (Nat.succ_le_succ h₂) + have hv : v ∈ P₂.G.vertexSet := hsub hvW + simp only [mem_iUnion, exists_prop] + by_cases hroot : v ∈ P₂.G.roots + · obtain ⟨p, hp, hpv⟩ := List.getElem_of_mem hroot + exact ⟨p, by omega, hdom, v, hv, hslash, + Or.inl (List.getElem?_eq_some_iff.mpr ⟨hp, hpv⟩)⟩ + · exact ⟨K₀ + 1, by omega, hdom, v, hv, hslash, Or.inr ⟨rfl, hroot⟩⟩ + refine (WellBehaved.iUnion_lt (𝓕 := slashSet 𝓕₁) (θ + 1) fun i _ ↦ hn i).mono ?_ + rintro P₂ ⟨hdom, W, hW, hc, hsub, hmem⟩ + simp only [mem_iUnion, exists_prop] + exact ⟨W.ncard, Nat.lt_succ_of_le hc, hdom, W, hW, rfl, hsub, hmem⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section4e.lean b/LeanPool/GraphMinor/GM20/Section4e.lean new file mode 100644 index 0000000000..106df216ac --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section4e.lean @@ -0,0 +1,417 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section4d +public import LeanPool.GraphMinor.GM20.Bag + +/-! +# Graph Minors XX, Section 4, (4.10) + +Each edge `e` of a condensation `P₁` of `P₂` stands for a piece `A_e` of `P₂`, all of whose vertices +are roots of `A_e`. As in the paper, we give `e` a label recording `Q₂|A_e`. Since `P₁` is +removable, +each piece is removable (`Pieces.emptySubgraph_mem`): the grouping with no adjacencies is feasible +in +it, and all vertices of the piece are roots, so each edge of the piece has that grouping. + +Differences from the paper: +- The paper labels `e` by the patchwork `Q₂|A_e` ordered by simulation, and says that this order is + a + well-quasi-order by a proof like that of (8.4) of Graph Minors IV. That claim is proved in + `Section4eOmega.lean` (`wqo_omega₁`), by (8.4) of Graph Minors IV applied to a star with one + vertex. Here we use the `bag` of the piece instead, with the order of Higman's lemma. +- The paper derives the encoding from (5.7) of Graph Minors XVIII. That result needs `{A_e}` to be a + set with a new edge for each member, but two edges of `P₁` can have equal pieces with no edges, + and + it needs an expansion of the two hearts, whose patches `gr(Q₂|A_e)` are larger than `Δ₁(e)`. All + pieces here have only roots as vertices, so we prove the needed case directly + (`simulated_of_pieces`): an edge `f` of `A_e` goes to the matching edge of `A_{η(e)}`, and a + realization is assembled from realizations of the pieces that `η` misses. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} {Ω Ω' : Type*} + +theorem sameComponent_iff_connectedIn {K : (⊤ : SimpleGraph α).Subgraph} {p q : α} : + sameComponent K p q ↔ ConnectedIn K p q := by + rw [sameComponent_iff] + constructor + · rintro ⟨hp, hq, hr⟩ + exact ⟨component K ⟨p, hp⟩, ⟨⟨p, hp⟩, rfl⟩, self_mem_componentVerts K ⟨p, hp⟩, ⟨hq, hr⟩⟩ + · rintro ⟨_, ⟨x, rfl⟩, ⟨hp, hxp⟩, ⟨hq, hxq⟩⟩ + exact ⟨hp, hq, hxp.symm.trans hxq⟩ + +theorem sameComponent_of_forall_adj {K H : (⊤ : SimpleGraph α).Subgraph} (hv : K.verts ⊆ H.verts) + (h : ∀ a b, K.Adj a b → sameComponent H a b) {p q : α} (hpq : sameComponent K p q) : + sameComponent H p q := by + obtain ⟨hp, hq, hr⟩ := sameComponent_iff.mp hpq + rw [SimpleGraph.reachable_iff_reflTransGen] at hr + suffices ∀ y : K.verts, Relation.ReflTransGen K.coe.Adj ⟨p, hp⟩ y → sameComponent H p y.1 from + this ⟨q, hq⟩ hr + intro y hy + induction hy with + | refl => exact sameComponent_iff.mpr ⟨hv hp, hv hp, SimpleGraph.Reachable.refl _⟩ + | tail _ hab ih => exact ih.trans (h _ _ hab) + +/-- The relation that `S` is a condensation of `Q` with pieces `A` (Graph Minors XX, Section 4, +page 335), where `S` and `Q` may have labels. -/ +structure Pieces (N : ℕ) (Q : Patchwork Ω α β) (S : Patchwork Ω' α β) + (A : β → RootedHypergraph α β) : Prop where + vertexSet_eq : S.G.vertexSet = Q.G.vertexSet + roots_eq : S.G.roots = Q.G.roots + dom_S : S.dom = S.G.edgeSet + dom_Q : Q.dom = Q.G.edgeSet + le : ∀ e ∈ S.G.edgeSet, (A e).toHypergraph ≤ Q.G.toHypergraph + vertexSet_A : ∀ e ∈ S.G.edgeSet, (A e).vertexSet = S.G.ends e + roots_A : ∀ e ∈ S.G.edgeSet, (A e).roots = S.μ e + iUnion_eq : ⋃ e ∈ S.G.edgeSet, (A e).edgeSet = Q.G.edgeSet + disjoint : ∀ e ∈ S.G.edgeSet, ∀ e' ∈ S.G.edgeSet, e ≠ e' → Disjoint (A e).edgeSet (A e').edgeSet + feasible : ∀ e ∈ S.G.edgeSet, ∀ K ∈ S.Δ e, IsFeasibleGrouping (Q.restrict (A e)) K + removable : S.IsRemovable + roots_le : ∀ e ∈ S.G.edgeSet, (A e).roots.length ≤ N + +namespace Pieces + +variable {N : ℕ} {Q : Patchwork Ω α β} {S : Patchwork Ω' α β} {A : β → RootedHypergraph α β} + +/-- Every vertex of a piece is a root of it. -/ +theorem mem_roots (h : Pieces N Q S A) {e : β} (he : e ∈ S.G.edgeSet) {x : α} + (hx : x ∈ (A e).vertexSet) : x ∈ (A e).roots := by + have hd : e ∈ S.dom := h.dom_S ▸ he + rw [h.vertexSet_A e he, ← S.μ_set e hd] at hx + rw [h.roots_A e he] + exact hx + +/-- The ends of an edge of a piece are roots of that piece. -/ +theorem end_mem_roots (h : Pieces N Q S A) {e f : β} (he : e ∈ S.G.edgeSet) + (hf : f ∈ (A e).edgeSet) {x : α} (hx : Q.G.Inc f x) : x ∈ (A e).roots := by + have hinc := (inc_iff_of_le (h.le e he) hf).mpr hx + exact h.mem_roots he ((A e).vertex_mem_of_inc hinc) + +theorem eq_of_mem (h : Pieces N Q S A) {e e' f : β} (he : e ∈ S.G.edgeSet) + (he' : e' ∈ S.G.edgeSet) (hf : f ∈ (A e).edgeSet) (hf' : f ∈ (A e').edgeSet) : e = e' := by + by_contra hne + exact Set.disjoint_left.mp (h.disjoint e he e' he' hne) hf hf' + +theorem exists_mem (h : Pieces N Q S A) {f : β} (hf : f ∈ Q.G.edgeSet) : + ∃ e ∈ S.G.edgeSet, f ∈ (A e).edgeSet := by + rw [← h.iUnion_eq] at hf + simpa using hf + +/-- Each edge of a piece has the grouping with no adjacencies. The reason is that this grouping is +feasible in the piece, because `S` is removable, and the vertices of the piece are roots. -/ +theorem emptySubgraph_mem (h : Pieces N Q S A) {e f : β} (he : e ∈ S.G.edgeSet) + (hf : f ∈ (A e).edgeSet) : emptySubgraph (Q.G.ends f) ∈ Q.Δ f := by + obtain ⟨-, -, H, hH, hconn⟩ := h.feasible e he _ (h.removable e he) + have hle := h.le e he + have hverts : H.verts = (A e).vertexSet := hH.verts_eq + obtain ⟨δ, hδ, rfl⟩ := id hH + have hfm := hδ f hf + rw [Patchwork.restrict_Δ hle hf] at hfm + have hV := ((Q.Δ f).verts_eq _ hfm).trans (Q.Δ_verts f (hle.edgeSet_subset hf)) + have hadj : ∀ a b, ¬ (δ f).Adj a b := by + intro a b hab + have hH' : (realizationOf (Q.restrict (A e)).G.toHypergraph δ).Adj a b := + realizationOf_adj.mpr ⟨f, hf, hab⟩ + have ha := (realizationOf (Q.restrict (A e)).G.toHypergraph δ).edge_vert hH' + have hb := (realizationOf (Q.restrict (A e)).G.toHypergraph δ).edge_vert hH'.symm + rw [hverts] at ha hb + have := (hconn a (h.mem_roots he ha) b (h.mem_roots he hb) hH'.ne).mp + (sameComponent_iff_connectedIn.mp (sameComponent_of_adj hH')) + exact not_emptySubgraph_adj this + have : δ f = emptySubgraph (Q.G.ends f) := by + apply SimpleGraph.Subgraph.ext + · exact hV + · funext a b + exact propext ⟨fun h' ↦ absurd h' (hadj a b), fun h' ↦ absurd h' not_emptySubgraph_adj⟩ + rw [← this] + exact hfm + +/-- A grouping in the patch of `e` is the connection pattern of a choice of groupings on the edges +of +the piece. -/ +theorem exists_choice (h : Pieces N Q S A) {e : β} (he : e ∈ S.G.edgeSet) {K} (hK : K ∈ S.Δ e) : + ∃ d : β → (⊤ : SimpleGraph α).Subgraph, (∀ f ∈ (A e).edgeSet, d f ∈ Q.Δ f) ∧ + (∀ a b, ∀ f ∈ (A e).edgeSet, (d f).Adj a b → K.Adj a b) ∧ + ∀ a b, K.Adj a b → sameComponent (realizationOf (A e).toHypergraph d) a b := by + obtain ⟨hgrp, hverts, H, hH, hconn⟩ := h.feasible e he K hK + have hle := h.le e he + have hvH : H.verts = (A e).vertexSet := hH.verts_eq + obtain ⟨δ, hδ, rfl⟩ := id hH + refine ⟨δ, fun f hf ↦ ?_, fun a b f hf hab ↦ ?_, fun a b hab ↦ ?_⟩ + · have := hδ f hf + rwa [Patchwork.restrict_Δ hle hf] at this + · have hH' : (realizationOf (Q.restrict (A e)).G.toHypergraph δ).Adj a b := + realizationOf_adj.mpr ⟨f, hf, hab⟩ + have ha := (realizationOf (Q.restrict (A e)).G.toHypergraph δ).edge_vert hH' + have hb := (realizationOf (Q.restrict (A e)).G.toHypergraph δ).edge_vert hH'.symm + rw [hvH] at ha hb + exact (hconn a (h.mem_roots he ha) b (h.mem_roots he hb) hH'.ne).mp + (sameComponent_iff_connectedIn.mp (sameComponent_of_adj hH')) + · have ha : a ∈ K.verts := K.edge_vert hab + have hb : b ∈ K.verts := K.edge_vert hab.symm + rw [hverts] at ha hb + exact sameComponent_iff_connectedIn.mpr ((hconn a ha b hb hab.ne).mpr hab) + +end Pieces + +/-- The core of (4.10): a realizable expansion of the condensation `S` of `Q` in the condensation +`S'` +of `Q'`, with edge maps between the pieces, gives a simulation of `Q` in `Q'`. -/ +theorem simulated_of_pieces {Ω₁ : Type*} [Preorder Ω] [Preorder Ω₁] {N : ℕ} {Q Q' : Patchwork Ω α β} + {S S' : Patchwork Ω₁ α β} {A A' : β → RootedHypergraph α β} (hP : Pieces N Q S A) + (hP' : Pieces N Q' S' A') {ηv : α → Set α} {ηe : β → β} (hη : IsRealizableExpansion S S' ηv ηe) + (hmap : ∀ e ∈ S.G.edgeSet, ∃ g : β → β, InjOn g (A e).edgeSet ∧ + MapsTo g (A e).edgeSet (A' (ηe e)).edgeSet ∧ ∀ f ∈ (A e).edgeSet, Q.φ f ≤ Q'.φ (g f) ∧ + edgeCode N (A e).roots (Q.restrict (A e)) f = + edgeCode N (A' (ηe e)).roots (Q'.restrict (A' (ηe e))) (g f)) : + Simulated Q Q' := by + classical + obtain ⟨hex, H, hH, hcomp⟩ := hη + choose! G hinj hmaps hgood using hmap + have hcov : ∀ f ∈ Q.G.edgeSet, ∃ e ∈ S.G.edgeSet, f ∈ (A e).edgeSet := fun f hf ↦ hP.exists_mem hf + choose! pc hpcE hpcA using hcov + have hcov' : ∀ f ∈ Q'.G.edgeSet, ∃ e ∈ S'.G.edgeSet, f ∈ (A' e).edgeSet := + fun f hf ↦ hP'.exists_mem hf + choose! pc' hpcE' hpcA' using hcov' + have hVS : S.G.vertexSet = Q.G.vertexSet := hP.vertexSet_eq + have hVS' : S'.G.vertexSet = Q'.G.vertexSet := hP'.vertexSet_eq + have hunique' : ∀ {e f}, e ∈ S'.G.edgeSet → f ∈ (A' e).edgeSet → pc' f = e := fun {e f} he hf ↦ + hP'.eq_of_mem (hpcE' f ((hP'.le _ he).edgeSet_subset hf)) he + (hpcA' f ((hP'.le _ he).edgeSet_subset hf)) hf + -- Facts about one edge `f` of `Q`, in the piece of `e = pc f`. + have hpiece : ∀ f ∈ Q.G.edgeSet, ∃ e ∈ S.G.edgeSet, f ∈ (A e).edgeSet ∧ pc f = e ∧ + G e f ∈ (A' (ηe e)).edgeSet ∧ ηe e ∈ S'.G.edgeSet ∧ + (Q.μ f).Nodup ∧ (∀ x ∈ Q.μ f, x ∈ (A e).roots) ∧ + (Q'.μ (G e f)).Nodup ∧ (∀ x ∈ Q'.μ (G e f), x ∈ (A' (ηe e)).roots) ∧ + marchCode N (A e).roots (Q.μ f) = marchCode N (A' (ηe e)).roots (Q'.μ (G e f)) ∧ + patchCode N (A e).roots (Q.Δ f) = patchCode N (A' (ηe e)).roots (Q'.Δ (G e f)) := by + intro f hf + have he := hpcE f hf + have hfA := hpcA f hf + have hee := hex.edge_mem _ he + have hg := hmaps _ he hfA + have hg' : G (pc f) f ∈ Q'.G.edgeSet := (hP'.le _ hee).edgeSet_subset hg + have hd : f ∈ Q.dom := hP.dom_Q ▸ hf + have hd' : G (pc f) f ∈ Q'.dom := hP'.dom_Q ▸ hg' + have hc := (hgood _ he f hfA).2 + simp only [edgeCode, Prod.mk.injEq] at hc + refine ⟨pc f, he, hfA, rfl, hg, hee, Q.μ_nodup f hd, fun x hx ↦ ?_, + Q'.μ_nodup _ hd', fun x hx ↦ ?_, hc.2.2.1, ?_⟩ + · have h₁ : x ∈ {x | x ∈ Q.μ f} := hx + rw [Q.μ_set f hd] at h₁ + exact hP.end_mem_roots he hfA h₁ + · have h₁ : x ∈ {x | x ∈ Q'.μ (G (pc f) f)} := hx + rw [Q'.μ_set _ hd'] at h₁ + exact hP'.end_mem_roots hee hg h₁ + · have h₂ := hc.2.2.2 + rwa [Patchwork.restrict_Δ (hP.le _ he) hfA, Patchwork.restrict_Δ (hP'.le _ hee) hg] at h₂ + have hpos : ∀ e ∈ S.G.edgeSet, ∀ (i : Fin N) (x y : α), (A e).roots[i.1]? = some x → + (A' (ηe e)).roots[i.1]? = some y → y ∈ ηv x := by + intro e he i x y hx hy + have hd : e ∈ S.dom := hP.dom_S ▸ he + have hee := hex.edge_mem e he + rw [hP.roots_A e he] at hx + rw [hP'.roots_A _ hee] at hy + obtain ⟨h₁, h₂⟩ := List.getElem?_eq_some_iff.mp hx + obtain ⟨h₁', h₂'⟩ := List.getElem?_eq_some_iff.mp hy + have := hex.μ_mem e hd i.1 h₁ h₁' + rwa [h₂, h₂'] at this + let ηe₂ : β → β := fun f ↦ G (pc f) f + have himg : ∀ f ∈ Q.G.edgeSet, ηe₂ f ∈ (A' (ηe (pc f))).edgeSet := by + intro f hf + exact hmaps _ (hpcE f hf) (hpcA f hf) + have hexp : IsExpansion Q Q' ηv ηe₂ := by + refine + { vertex_nonempty := fun v hv ↦ hex.vertex_nonempty v (hVS ▸ hv) + vertex_subset := fun v hv ↦ hVS' ▸ hex.vertex_subset v (hVS ▸ hv) + edge_mem := fun f hf ↦ (hP'.le _ (hex.edge_mem _ (hpcE f hf))).edgeSet_subset (himg f hf) + vertex_disjoint := fun v₁ h₁ v₂ h₂ hne ↦ hex.vertex_disjoint v₁ (hVS ▸ h₁) v₂ (hVS ▸ h₂) hne + edge_injOn := ?_ + mem_dom_iff := fun f hf ↦ ?_ + ends_nonempty := fun f hf hd ↦ absurd (hP.dom_Q ▸ hf) hd + μ_length := fun f hf ↦ ?_ + μ_mem := fun f hf i hi hi' ↦ ?_ + roots_length := ?_ + roots_mem := fun i hi hi' ↦ ?_ + maps_Δ := fun f hf ↦ ?_ + φ_le := fun f hf ↦ (hgood _ (hpcE f hf) f (hpcA f hf)).1 } + · intro f₁ h₁ f₂ h₂ heq + have he₁ := hpcE f₁ h₁ + have he₂ := hpcE f₂ h₂ + have h₃ := himg f₁ h₁ + rw [show ηe₂ f₁ = ηe₂ f₂ from heq] at h₃ + have hee : ηe (pc f₁) = ηe (pc f₂) := + hP'.eq_of_mem (hex.edge_mem _ he₁) (hex.edge_mem _ he₂) h₃ (himg f₂ h₂) + have hpp : pc f₁ = pc f₂ := hex.edge_injOn he₁ he₂ hee + have heq' : G (pc f₂) f₁ = G (pc f₂) f₂ := by + have : G (pc f₁) f₁ = G (pc f₂) f₂ := heq + rwa [hpp] at this + exact hinj _ he₂ (hpp ▸ hpcA f₁ h₁) (hpcA f₂ h₂) heq' + · have h₁ : ηe₂ f ∈ Q'.G.edgeSet := + (hP'.le _ (hex.edge_mem _ (hpcE f hf))).edgeSet_subset (himg f hf) + rw [hP.dom_Q, hP'.dom_Q] + exact iff_of_true hf h₁ + · have hf' : f ∈ Q.G.edgeSet := Q.dom_subset hf + obtain ⟨e, he, -, rfl, -, hee, h₁, h₂, h₃, h₄, h₅, -⟩ := hpiece f hf' + exact length_eq_of_code (hP.roots_le _ he) (hP'.roots_le _ hee) h₁ h₃ h₂ h₄ h₅ + · have hf' : f ∈ Q.G.edgeSet := Q.dom_subset hf + obtain ⟨e, he, -, rfl, -, hee, h₁, h₂, h₃, h₄, h₅, -⟩ := hpiece f hf' + have hx := h₂ _ (List.getElem_mem hi) + obtain ⟨j, hj⟩ := exists_index (hP.roots_le _ he) hx + obtain ⟨y, hy, hyj⟩ := marchCode_forward h₅ + ((length_le_of_subset h₁ h₂).trans (hP.roots_le _ he)) (List.getElem?_eq_getElem hi) hj + have h₀ : (Q'.μ (ηe₂ f))[i] = y := + Option.some.inj ((List.getElem?_eq_getElem hi').symm.trans hy) + rw [h₀] + exact hpos _ he j _ y hj hyj + · rw [← hP.roots_eq, ← hP'.roots_eq] + exact hex.roots_length + · simp only [← hP.roots_eq, ← hP'.roots_eq] at hi hi' ⊢ + exact hex.roots_mem i hi hi' + · have hf' : f ∈ Q.G.edgeSet := Q.dom_subset hf + obtain ⟨e, he, hfA, rfl, -, hee, h₁, h₂, h₃, h₄, h₅, h₆⟩ := hpiece f hf' + have hd' : ηe₂ f ∈ Q'.dom := by + rw [hP'.dom_Q] + exact (hP'.le _ hee).edgeSet_subset (himg f hf') + refine mapsTo_of_code (hP.roots_le _ he) (hP'.roots_le _ hee) h₁ h₃ h₂ h₄ ?_ ?_ h₅ h₆ + · rw [Q.Δ_verts f hf', Q.μ_set f hf] + · rw [Q'.Δ_verts _ (Q'.dom_subset hd'), Q'.μ_set _ hd'] + obtain ⟨δ, hδ, hHeq⟩ := id hH + have hfree : ∀ e' ∈ S'.G.edgeSet, e' ∉ ηe '' S.G.edgeSet → _ := fun e' he' hne ↦ + hP'.exists_choice he' (hδ e' ⟨he', hne⟩) + choose! D hD₁ hD₂ hD₃ using hfree + let d₂ : β → (⊤ : SimpleGraph α).Subgraph := fun f' ↦ + if pc' f' ∈ ηe '' S.G.edgeSet then emptySubgraph (Q'.G.ends f') else D (pc' f') f' + have hd₂in : ∀ {f'}, pc' f' ∈ ηe '' S.G.edgeSet → d₂ f' = emptySubgraph (Q'.G.ends f') := + fun hi ↦ ite_eq_left hi + have hd₂out : ∀ {f'}, pc' f' ∉ ηe '' S.G.edgeSet → d₂ f' = D (pc' f') f' := + fun hi ↦ ite_eq_right hi + let F : Set β := ηe₂ '' Q.G.edgeSet + let H₂ := realizationOf (Q'.deleteEdges F).G.toHypergraph d₂ + have hH₂ : (Q'.deleteEdges F).IsRealization H₂ := by + refine ⟨d₂, fun f' hf' ↦ ?_, rfl⟩ + have hE : f' ∈ Q'.G.edgeSet := hf'.1 + change d₂ f' ∈ Q'.Δ f' + by_cases hi : pc' f' ∈ ηe '' S.G.edgeSet + · rw [hd₂in hi] + exact hP'.emptySubgraph_mem (hpcE' _ hE) (hpcA' _ hE) + · rw [hd₂out hi] + exact hD₁ _ (hpcE' _ hE) hi _ (hpcA' _ hE) + have hvH : H.verts = Q'.G.vertexSet := hH.verts_eq.trans hVS' + have hvH₂ : H₂.verts = Q'.G.vertexSet := hH₂.verts_eq + have claimA : ∀ a b, H₂.Adj a b → sameComponent H a b := by + intro a b hab + obtain ⟨f', hf', hadj⟩ := realizationOf_adj.mp hab + have hE : f' ∈ Q'.G.edgeSet := hf'.1 + by_cases hi : pc' f' ∈ ηe '' S.G.edgeSet + · rw [hd₂in hi] at hadj + exact absurd hadj not_emptySubgraph_adj + · rw [hd₂out hi] at hadj + have h₁ := hD₂ _ (hpcE' _ hE) hi a b f' (hpcA' _ hE) hadj + apply sameComponent_of_adj + rw [hHeq] + exact realizationOf_adj.mpr ⟨pc' f', ⟨hpcE' _ hE, hi⟩, h₁⟩ + have claimB : ∀ a b, H.Adj a b → sameComponent H₂ a b := by + intro a b hab + rw [hHeq] at hab + obtain ⟨e', he', hadj⟩ := realizationOf_adj.mp hab + have he₁ : e' ∈ S'.G.edgeSet := he'.1 + have he₂ : e' ∉ ηe '' S.G.edgeSet := he'.2 + refine sameComponent.mono ⟨?_, ?_⟩ (hD₃ e' he₁ he₂ a b hadj) + · rw [realizationOf_verts, hvH₂] + · exact (hP'.le e' he₁).vertexSet_subset + · intro f hf + have hE := (hP'.le e' he₁).edgeSet_subset hf + rw [(Q'.Δ f).verts_eq _ (hD₁ e' he₁ he₂ f hf), Q'.Δ_verts f hE, + (hP'.le e' he₁).ends_eq f hf] + · intro x y hxy + obtain ⟨f', hf', hadj'⟩ := realizationOf_adj.mp hxy + have hE := (hP'.le e' he₁).edgeSet_subset hf' + have hpc : pc' f' = e' := hunique' he₁ hf' + have hnot : f' ∉ F := by + rintro ⟨f, hf, rfl⟩ + have hee := hP'.eq_of_mem he₁ (hex.edge_mem _ (hpcE f hf)) hf' (himg f hf) + exact he₂ ⟨pc f, hpcE f hf, hee.symm⟩ + refine realizationOf_adj.mpr ⟨f', ⟨hE, hnot⟩, ?_⟩ + rw [hd₂out (by rwa [hpc]), hpc] + exact hadj' + refine ⟨ηv, ηe₂, hexp, H₂, hH₂, fun v hv ↦ ?_⟩ + have hv' : v ∈ S.G.vertexSet := hVS ▸ hv + obtain ⟨D₀, hD₀, hDv⟩ := hcomp v hv' + have hsub : ηv v ⊆ H₂.verts := by + rw [hvH₂, ← hVS'] + exact hex.vertex_subset v hv' + rw [exists_isComponent_verts_eq_iff (hex.vertex_nonempty v hv') hsub] + refine ⟨fun a ha b hab ↦ ?_, fun a ha b hb ↦ ?_⟩ + · obtain ⟨D₁, hD₁', ha', hb'⟩ := sameComponent_iff_connectedIn.mp (claimA a b hab) + have heq := hD₁'.eq_of_mem hD₀ ha' (hDv ▸ ha) + rw [← hDv, ← heq] + exact hb' + · refine sameComponent_of_forall_adj (by rw [hvH, hvH₂]) claimB + (sameComponent_iff_connectedIn.mpr ⟨D₀, hD₀, hDv ▸ ha, hDv ▸ hb⟩) + +/-- A grouping feasible in a restriction of `P₂` is feasible in the same restriction of a completion +of `P₂`. -/ +theorem feasible_transfer {Ω₂ : Type*} {P : Patchwork Ω α β} {Q : Patchwork Ω₂ α β} + (hb : SameBase P Q) {B : RootedHypergraph α β} (hB : B.toHypergraph ≤ P.G.toHypergraph) + {K : (⊤ : SimpleGraph α).Subgraph} (hK : IsFeasibleGrouping (P.restrict B) K) : + IsFeasibleGrouping (Q.restrict B) K := by + obtain ⟨h₁, h₂, H, hH, hc⟩ := hK + refine ⟨h₁, h₂, H, hH.congr rfl rfl fun e he ↦ ?_, hc⟩ + have hB' : B.toHypergraph ≤ Q.G.toHypergraph := hb.hyper ▸ hB + rw [Patchwork.restrict_Δ hB he, Patchwork.restrict_Δ hB' he] + exact hb.Δ_eq (hB.edgeSet_subset he) + +/-- Graph Minors XX, (4.10) (page 334): "Let $\mathcal{F}_1$ be a well-behaved set of removable +patchworks and let $\mathcal{F}_2$ be +a set of patchworks such that for each $P_2 \in \mathcal{F}_2$ some $P_1 \in \mathcal{F}_1$ +is a condensation of $P_2$. Then $\mathcal{F}_2$ is well-behaved." -/ +theorem theorem_4_10_proof {𝓕₁ 𝓕₂ : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕₁) + (hrem : ∀ P ∈ 𝓕₁, P.IsRemovable) (h₂ : ∀ P₂ ∈ 𝓕₂, ∃ P₁ ∈ 𝓕₁, IsCondensation P₁ P₂) : + WellBehaved 𝓕₂ := by + obtain ⟨N, hN⟩ := theorem_4_1_proof h + refine wellBehaved_of_encoding h fun Ω₂ _ hΩ₂ ↦ ⟨Bag Ω₂ N, inferInstance, wqo_bag hΩ₂ N, + fun Q S ↦ ∃ A, Pieces N Q S A ∧ ∀ e ∈ S.G.edgeSet, S.φ e = bag N (Q.restrict (A e)), ?_, ?_⟩ + · rintro Q ⟨P₂, hP₂, hQ⟩ + obtain ⟨P₁, hP₁, hV, hr, hd₁, hd₂, A, hA, hU, hdis, hfeas⟩ := h₂ P₂ hP₂ + have hb := hQ.sameBase + refine ⟨P₁.relabel fun e ↦ bag N (Q.restrict (A e)), ⟨P₁, hP₁, isCompletionOf_relabel _ _⟩, A, + ?_, fun _ _ ↦ rfl⟩ + exact + { vertexSet_eq := hV.trans hb.vertexSet_eq.symm + roots_eq := hr.trans (congrArg (·.roots) hQ.G_eq).symm + dom_S := hd₁ + dom_Q := hb.dom_eq.trans (hd₂.trans hb.edgeSet_eq.symm) + le := fun e he ↦ hb.hyper ▸ (hA e he).1 + vertexSet_A := fun e he ↦ (hA e he).2.1 + roots_A := fun e he ↦ (hA e he).2.2 + iUnion_eq := hU.trans hb.edgeSet_eq.symm + disjoint := hdis + feasible := fun e he K hK ↦ feasible_transfer hb (hA e he).1 (hfeas e he K hK) + removable := fun e he ↦ hrem P₁ hP₁ e he + roots_le := fun e he ↦ by + rw [(hA e he).2.2] + exact hN P₁ hP₁ e (hd₁ ▸ he) } + · rintro Q - Q' - S S' ⟨A, hP, hφ⟩ ⟨A', hP', hφ'⟩ ⟨ηv, ηe, hη⟩ + refine simulated_of_pieces hP hP' hη fun e he ↦ ?_ + have hle := hη.1.φ_le e he + rw [hφ e he, hφ' _ (hη.1.edge_mem e he)] at hle + obtain ⟨g, hi, hm, hg⟩ := exists_edgeMap hle + exact ⟨g, hi, hm, hg⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section4f.lean b/LeanPool/GraphMinor/GM20/Section4f.lean new file mode 100644 index 0000000000..2085159c11 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section4f.lean @@ -0,0 +1,328 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section4e + +/-! +# Graph Minors XX, Section 4, (4.11) + +(4.11) says that passing to a complemented part `G₂` of `G₁` with the same roots keeps a set of +active +patchworks well-behaved. Edges outside `G₂` get a new incomparable label `*`, so an expansion keeps +`G₂` apart from the rest. The main point of the proof is `sameComponent_of_sides`: a component of a +realization of the whole meets the rest of the graph in vertices that are roots, and it has at most +one root, so its part inside `G₂` stays connected. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- The key step of (4.11). Let `H₁` be a graph whose edges lie either on the side `W`, where they +are +edges of `H₂`, or on the side `V₃`. If a set `C`, closed under adjacency in `H₁`, has at most one +vertex in both sides, then two vertices of `W` joined by a walk in `C` are in one component of `H₂`. +-/ +theorem sameComponent_of_sides {H₁ H₂ : (⊤ : SimpleGraph α).Subgraph} {W V₃ C : Set α} + (hWH : W ⊆ H₂.verts) + (hadj : ∀ x y, H₁.Adj x y → (x ∈ W ∧ y ∈ W ∧ H₂.Adj x y) ∨ (x ∈ V₃ ∧ y ∈ V₃)) + (hC : ∀ x y, x ∈ C → H₁.Adj x y → y ∈ C) + (hone : ∀ x ∈ C, ∀ y ∈ C, x ∈ W → y ∈ W → x ∈ V₃ → y ∈ V₃ → x = y) + {a b : α} (ha : a ∈ W) (haC : a ∈ C) (hb : b ∈ W) (hab : sameComponent H₁ a b) : + sameComponent H₂ a b := by + obtain ⟨hp, hq, hr⟩ := sameComponent_iff.mp hab + rw [SimpleGraph.reachable_iff_reflTransGen] at hr + have hrefl : sameComponent H₂ a a := + sameComponent_iff.mpr ⟨hWH ha, hWH ha, SimpleGraph.Reachable.refl _⟩ + suffices ∀ y : H₁.verts, Relation.ReflTransGen H₁.coe.Adj ⟨a, hp⟩ y → y.1 ∈ C ∧ + ((y.1 ∈ W ∧ sameComponent H₂ a y.1) ∨ + (y.1 ∈ V₃ ∧ ∃ z ∈ C, z ∈ W ∧ z ∈ V₃ ∧ sameComponent H₂ a z)) by + obtain ⟨hbC, h | ⟨hb₃, z, hz, hzW, hz₃, hc⟩⟩ := this ⟨b, hq⟩ hr + · exact h.2 + · exact hone b hbC z hz hb hzW hb₃ hz₃ ▸ hc + intro y hy + induction hy with + | refl => exact ⟨haC, Or.inl ⟨ha, hrefl⟩⟩ + | @tail x y _ hxy ih => + obtain ⟨hxC, ih⟩ := ih + have hxy' : H₁.Adj x.1 y.1 := hxy + have hyC := hC _ _ hxC hxy' + refine ⟨hyC, ?_⟩ + rcases hadj _ _ hxy' with ⟨hxW, hyW, hadj₂⟩ | ⟨hx₃, hy₃⟩ + · refine Or.inl ⟨hyW, ?_⟩ + rcases ih with ⟨-, hc⟩ | ⟨hx₃, z, hz, hzW, hz₃, hc⟩ + · exact hc.trans (sameComponent_of_adj hadj₂) + · have : x.1 = z := hone _ hxC z hz hxW hzW hx₃ hz₃ + exact (this ▸ hc).trans (sameComponent_of_adj hadj₂) + · rcases ih with ⟨hxW, hc⟩ | ⟨-, hz⟩ + · exact Or.inr ⟨hy₃, x.1, hxC, hxW, hx₃, hc⟩ + · exact Or.inr ⟨hy₃, hz⟩ + +/-- The label order of the proof of (4.11): `Ω` with a new element `*`, comparable only to itself. +-/ +abbrev StarLabel (Ω : Type*) := DisjointUnionQuasiOrder Ω (Discrete Unit) + +theorem wqo_starLabel {Ω : Type*} [Preorder Ω] (hΩ : WellQuasiOrderedLE Ω) : + WellQuasiOrderedLE (StarLabel Ω) := + wqo_disjointUnion hΩ (wqo_discrete Unit) + +theorem IsCompletionOf.mem_dom_iff {Ω Ω₁ : Type*} {P₁ : Patchwork Ω₁ α β} {Q : Patchwork Ω α β} + (h : IsCompletionOf P₁ Q) {e : β} : e ∈ Q.dom ↔ e ∈ P₁.dom := by rw [h.dom_eq] + +/-- `Q` is the complemented part of `S` of the proof of (4.11). -/ +structure StarStep {Ω Ω₁ : Type*} (Q : Patchwork Ω α β) (S : Patchwork Ω₁ α β) : Prop where + compl : IsComplemented S.G Q.G + roots_eq : Q.G.roots = S.G.roots + restr : IsCompletionOf (S.restrict Q.G) Q + active : IsActive S + +open Classical in +/-- The label of an edge of `S`: its label in `Q`, or `*` for an edge outside `Q`. -/ +noncomputable def starLabel {Ω : Type*} (Q : Patchwork Ω α β) (e : β) : StarLabel Ω := + if e ∈ Q.G.edgeSet then Sum.inl (Q.φ e) else Sum.inr () + +theorem starLabel_le {Ω : Type*} [Preorder Ω] {Q Q' : Patchwork Ω α β} {e e' : β} + (h : starLabel Q e ≤ starLabel Q' e') : + (e ∈ Q.G.edgeSet ↔ e' ∈ Q'.G.edgeSet) ∧ (e ∈ Q.G.edgeSet → Q.φ e ≤ Q'.φ e') := by + classical + by_cases he : e ∈ Q.G.edgeSet <;> by_cases he' : e' ∈ Q'.G.edgeSet <;> + simp only [starLabel, he, he', ↓reduceIte] at h + · have hle : DisjointUnionLE _ _ := h + cases hle with + | inl h => exact ⟨iff_of_true he he', fun _ ↦ h⟩ + · exact nomatch (show DisjointUnionLE _ _ from h) + · exact nomatch (show DisjointUnionLE _ _ from h) + · exact ⟨iff_of_false he he', fun h' ↦ absurd h' he⟩ + +/-- The core of (4.11): a realizable expansion `η` of `S` in `S'` which keeps edges of `Q` and edges +outside `Q` apart gives a simulation of `Q` in `Q'`. -/ +theorem simulated_of_starStep {Ω Ω₁ : Type*} [Preorder Ω] [Preorder Ω₁] {Q Q' : Patchwork Ω α β} + {S S' : Patchwork Ω₁ α β} (hS : StarStep Q S) (hS' : StarStep Q' S') {ηv : α → Set α} + {ηe : β → β} (hη : IsRealizableExpansion S S' ηv ηe) + (hE : ∀ e ∈ S.G.edgeSet, e ∈ Q.G.edgeSet ↔ ηe e ∈ Q'.G.edgeSet) + (hφ : ∀ e ∈ Q.G.edgeSet, Q.φ e ≤ Q'.φ (ηe e)) : Simulated Q Q' := by + classical + obtain ⟨hex, H, hH, hcomp⟩ := hη + have hle := hS.compl.le + have hle' := hS'.compl.le + have hdom : Q.dom = S.dom ∩ Q.G.edgeSet := hS.restr.dom_eq.trans (Patchwork.restrict_dom hle) + have hdom' : Q'.dom = S'.dom ∩ Q'.G.edgeSet := hS'.restr.dom_eq.trans + (Patchwork.restrict_dom hle') + have hμ : ∀ e ∈ Q.dom, Q.μ e = S.μ e := fun e he ↦ hS.restr.μ_eq (hS.restr.dom_eq ▸ he) + have hμ' : ∀ e ∈ Q'.dom, Q'.μ e = S'.μ e := fun e he ↦ hS'.restr.μ_eq (hS'.restr.dom_eq ▸ he) + have hΔ : ∀ e ∈ Q.G.edgeSet, Q.Δ e = S.Δ e := fun e he ↦ + (hS.restr.Δ_eq he).trans (Patchwork.restrict_Δ hle he) + have hΔ' : ∀ e ∈ Q'.G.edgeSet, Q'.Δ e = S'.Δ e := fun e he ↦ + (hS'.restr.Δ_eq he).trans (Patchwork.restrict_Δ hle' he) + have hsub : Q.G.edgeSet ⊆ S.G.edgeSet := hle.edgeSet_subset + have hsub' : Q'.G.edgeSet ⊆ S'.G.edgeSet := hle'.edgeSet_subset + have hinc : ∀ {e x}, e ∈ Q.G.edgeSet → (Q.G.Inc e x ↔ S.G.Inc e x) := fun he ↦ + inc_iff_of_le hle he + have hinc' : ∀ {e x}, e ∈ Q'.G.edgeSet → (Q'.G.Inc e x ↔ S'.G.Inc e x) := fun he ↦ + inc_iff_of_le hle' he + have hrl : Q.G.roots = S.G.roots := hS.roots_eq + have hrl' : Q'.G.roots = S'.G.roots := hS'.roots_eq + -- The new vertices of a term of a march of an edge of `Q` lie in `V(Q')`. + have hμV : ∀ e ∈ Q.dom, ∀ y ∈ S'.μ (ηe e), y ∈ Q'.G.vertexSet := by + intro e he y hy + have heE : e ∈ Q.G.edgeSet := Q.dom_subset he + have hd : ηe e ∈ S'.dom := (hex.mem_dom_iff e (hsub heE)).mp (hdom ▸ he).1 + have h₁ : y ∈ {x | x ∈ S'.μ (ηe e)} := hy + rw [S'.μ_set _ hd] at h₁ + exact Q'.G.vertex_mem_of_inc ((hinc' ((hE e (hsub heE)).mp heE)).mpr h₁) + have hrootV : ∀ (i : ℕ) (hi' : i < S'.G.roots.length), S'.G.roots[i] ∈ Q'.G.vertexSet := by + intro i hi' + have hm : ∀ r : List α, r = S'.G.roots → S'.G.roots[i] ∈ r := fun r hr ↦ by + rw [hr] + exact List.getElem_mem hi' + exact Q'.G.roots_subset _ (hm _ hrl') + -- This is (2) of the paper. + have hne : ∀ v ∈ Q.G.vertexSet, (ηv v ∩ Q'.G.vertexSet).Nonempty := by + intro v hv + have hvS : v ∈ S.G.vertexSet := hle.vertexSet_subset hv + by_cases hr : v ∈ Q.G.roots + · obtain ⟨i, hi, rfl⟩ := List.getElem_of_mem hr + have hi₁ : i < S.G.roots.length := hrl ▸ hi + have hi₂ : i < S'.G.roots.length := hex.roots_length ▸ hi₁ + have h₁ := hex.roots_mem i hi₁ hi₂ + simp only [hrl] at h₁ ⊢ + exact ⟨_, h₁, hrootV i hi₂⟩ + · obtain ⟨e, he, hinc₁⟩ := hS.active v hvS + have heQ : e ∈ Q.G.edgeSet := by + by_contra hn + exact hr (hS.compl.inc_diff_mem hv ⟨S.dom_subset he, hn⟩ hinc₁) + have hdQ : e ∈ Q.dom := hdom ▸ ⟨he, heQ⟩ + have hm : v ∈ S.μ e := by + have : v ∈ S.G.ends e := hinc₁ + rw [← S.μ_set e he] at this + exact this + obtain ⟨i, hi, rfl⟩ := List.getElem_of_mem hm + have hi₂ : i < (S'.μ (ηe e)).length := hex.μ_length e he ▸ hi + exact ⟨_, hex.μ_mem e he i hi hi₂, hμV e hdQ _ (List.getElem_mem hi₂)⟩ + have hdomiff : ∀ e ∈ Q.G.edgeSet, e ∈ Q.dom ↔ e ∈ S.dom := fun e he ↦ by + rw [hdom] + exact ⟨fun h ↦ h.1, fun h ↦ ⟨h, he⟩⟩ + have hdomiff' : ∀ e ∈ Q'.G.edgeSet, e ∈ Q'.dom ↔ e ∈ S'.dom := fun e he ↦ by + rw [hdom'] + exact ⟨fun h ↦ h.1, fun h ↦ ⟨h, he⟩⟩ + have hexp : IsExpansion Q Q' (fun v ↦ ηv v ∩ Q'.G.vertexSet) ηe := by + refine + { vertex_nonempty := hne + vertex_subset := fun v _ ↦ inter_subset_right + edge_mem := fun e he ↦ (hE e (hsub he)).mp he + vertex_disjoint := fun v₁ h₁ v₂ h₂ hne' ↦ + (hex.vertex_disjoint v₁ (hle.vertexSet_subset h₁) v₂ (hle.vertexSet_subset h₂) hne').mono + inter_subset_left inter_subset_left + edge_injOn := hex.edge_injOn.mono hsub + mem_dom_iff := fun e he ↦ ?_ + ends_nonempty := fun e he hd x hx ↦ ?_ + μ_length := fun e he ↦ ?_ + μ_mem := fun e he i hi hi' ↦ ?_ + roots_length := ?_ + roots_mem := fun i hi hi' ↦ ?_ + maps_Δ := fun e he ↦ ?_ + φ_le := hφ } + · rw [hdomiff e he, hdomiff' _ ((hE e (hsub he)).mp he)] + exact hex.mem_dom_iff e (hsub he) + · have hη' := (hE e (hsub he)).mp he + obtain ⟨y, hy, hyinc⟩ := hex.ends_nonempty e (hsub he) (fun h ↦ hd ((hdomiff e he).mpr h)) x + ((hinc he).mp hx) + have h₁ := (hinc' hη').mpr hyinc + exact ⟨y, ⟨hy, Q'.G.vertex_mem_of_inc h₁⟩, h₁⟩ + · have heE := Q.dom_subset he + have hdS := (hdomiff e heE).mp he + have hd' : ηe e ∈ Q'.dom := + (hdomiff' _ ((hE e (hsub heE)).mp heE)).mpr ((hex.mem_dom_iff e (hsub heE)).mp hdS) + rw [hμ e he, hμ' _ hd'] + exact hex.μ_length e hdS + · have heE := Q.dom_subset he + have hdS := (hdomiff e heE).mp he + have hd' : ηe e ∈ Q'.dom := + (hdomiff' _ ((hE e (hsub heE)).mp heE)).mpr ((hex.mem_dom_iff e (hsub heE)).mp hdS) + simp only [hμ e he, hμ' _ hd'] at hi hi' ⊢ + exact ⟨hex.μ_mem e hdS i hi hi', hμV e he _ (List.getElem_mem hi')⟩ + · rw [hrl, hrl'] + exact hex.roots_length + · simp only [hrl, hrl'] at hi hi' ⊢ + exact ⟨hex.roots_mem i hi hi', hrootV i hi'⟩ + · have heE := Q.dom_subset he + have hdS := (hdomiff e heE).mp he + have hηE := (hE e (hsub heE)).mp heE + have hd' : ηe e ∈ Q'.dom := + (hdomiff' _ hηE).mpr ((hex.mem_dom_iff e (hsub heE)).mp hdS) + rw [hμ e he, hμ' _ hd', hΔ e heE, hΔ' _ hηE] + exact hex.maps_Δ e hdS + obtain ⟨δ, hδ, hHeq⟩ := id hH + let H₂ := realizationOf (Q'.deleteEdges (ηe '' Q.G.edgeSet)).G.toHypergraph δ + have hmemS : ∀ e' ∈ Q'.G.edgeSet, e' ∉ ηe '' Q.G.edgeSet → e' ∉ ηe '' S.G.edgeSet := by + rintro e' he' hn ⟨e, he, rfl⟩ + exact hn ⟨e, (hE e he).mpr he', rfl⟩ + have hH₂ : (Q'.deleteEdges (ηe '' Q.G.edgeSet)).IsRealization H₂ := by + refine ⟨δ, fun e' he' ↦ ?_, rfl⟩ + change δ e' ∈ Q'.Δ e' + rw [hΔ' e' he'.1] + exact hδ e' ⟨hsub' he'.1, hmemS e' he'.1 he'.2⟩ + have hvH₂ : H₂.verts = Q'.G.vertexSet := hH₂.verts_eq + have hδverts : ∀ e' ∈ S'.G.edgeSet \ ηe '' S.G.edgeSet, (δ e').verts = S'.G.ends e' + := fun e' he' ↦ + ((S'.Δ e').verts_eq _ (hδ e' he')).trans (S'.Δ_verts e' he'.1) + have hH₂le : ∀ a b, H₂.Adj a b → H.Adj a b := by + intro a b hab + obtain ⟨e', he', hadj⟩ := realizationOf_adj.mp hab + rw [hHeq] + exact realizationOf_adj.mpr ⟨e', ⟨hsub' he'.1, hmemS e' he'.1 he'.2⟩, hadj⟩ + refine ⟨fun v ↦ ηv v ∩ Q'.G.vertexSet, ηe, hexp, H₂, hH₂, fun v hv ↦ ?_⟩ + have hvS := hle.vertexSet_subset hv + obtain ⟨D₀, hD₀, hDv⟩ := hcomp v hvS + have hclosed : ∀ x y, x ∈ ηv v → H.Adj x y → y ∈ ηv v := by + intro x y hx hxy + obtain ⟨D₁, hD₁, hx₁, hy₁⟩ := sameComponent_iff_connectedIn.mp (sameComponent_of_adj hxy) + have heq := hD₁.eq_of_mem hD₀ hx₁ (hDv ▸ hx) + rw [← hDv, ← heq] + exact hy₁ + rw [exists_isComponent_verts_eq_iff (hne v hv) (by rw [hvH₂]; exact inter_subset_right)] + refine ⟨fun a ha b hab ↦ ⟨hclosed a b ha.1 (hH₂le a b hab), ?_⟩, fun a ha b hb ↦ ?_⟩ + · have := H₂.edge_vert hab.symm + rwa [hvH₂] at this + · refine sameComponent_of_sides (H₁ := H) (W := Q'.G.vertexSet) (C := ηv v) + (V₃ := {x | ∃ e ∈ S'.G.edgeSet \ Q'.G.edgeSet, S'.G.Inc e x}) hvH₂.ge ?_ hclosed ?_ ha.2 ha.1 + hb.2 (sameComponent_iff_connectedIn.mpr ⟨D₀, hD₀, hDv ▸ ha.1, hDv ▸ hb.1⟩) + · intro x y hxy + rw [hHeq] at hxy + obtain ⟨e', he', hadj⟩ := realizationOf_adj.mp hxy + have hx : x ∈ S'.G.ends e' := hδverts e' he' ▸ (δ e').edge_vert hadj + have hy : y ∈ S'.G.ends e' := hδverts e' he' ▸ (δ e').edge_vert hadj.symm + by_cases heQ : e' ∈ Q'.G.edgeSet + · refine Or.inl ⟨Q'.G.vertex_mem_of_inc ((hinc' heQ).mpr hx), + Q'.G.vertex_mem_of_inc ((hinc' heQ).mpr hy), realizationOf_adj.mpr ⟨e', ⟨heQ, ?_⟩, hadj⟩⟩ + rintro ⟨e, he, rfl⟩ + exact he'.2 ⟨e, hsub he, rfl⟩ + · exact Or.inr ⟨⟨e', ⟨he'.1, heQ⟩, hx⟩, ⟨e', ⟨he'.1, heQ⟩, hy⟩⟩ + · -- Both vertices are roots of `Q'` in `η(v)`, and an expansion gives `η(v)` one root. + have hroot : ∀ x ∈ ηv v, x ∈ Q'.G.vertexSet → + (∃ e ∈ S'.G.edgeSet \ Q'.G.edgeSet, S'.G.Inc e x) → + ∃ (i : ℕ) (hi : i < S'.G.roots.length) (hi₀ : i < S.G.roots.length), + S'.G.roots[i] = x ∧ S.G.roots[i] = v := by + rintro x hx hxV ⟨e, he, hinc₁⟩ + have hm : x ∈ Q'.G.roots := hS'.compl.inc_diff_mem hxV he hinc₁ + rw [hrl'] at hm + obtain ⟨i, hi, rfl⟩ := List.getElem_of_mem hm + have hi₀ : i < S.G.roots.length := hex.roots_length ▸ hi + refine ⟨i, hi, hi₀, rfl, ?_⟩ + by_contra hnv + have hrV : S.G.roots[i] ∈ S.G.vertexSet := S.G.roots_subset _ (List.getElem_mem hi₀) + exact Set.disjoint_left.mp (hex.vertex_disjoint _ hrV v hvS hnv) + (hex.roots_mem i hi₀ hi) hx + intro x hx y hy hxW hyW hx₃ hy₃ + obtain ⟨i, hi, hi₀, rfl, h₁⟩ := hroot x hx hxW hx₃ + obtain ⟨j, hj, hj₀, rfl, h₂⟩ := hroot y hy hyW hy₃ + have hij : i = j := (S.G.roots_nodup.getElem_inj_iff).mp (h₁.trans h₂.symm) + subst hij + rfl + +/-- Graph Minors XX, (4.11) (page 334): "Let $\mathcal{F}_1$ be a well-behaved set of active +patchworks, and let $\mathcal{F}_2$ be +the set of all patchworks $P_2 = (G_2, \mu_2, \Delta_2)$ such that there exists $P_1 = (G_1, +\mu_1, \Delta_1) \in \mathcal{F}_1$ with $G_2 \subseteq G_1$, $\pi(G_2) = \pi(G_1)$, $G_2$ +complemented in $G_1$ and $P_2 = P_1|G_2$. Then $\mathcal{F}_2$ is well-behaved." -/ +theorem theorem_4_11_proof {𝓕₁ : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕₁) + (ha : ∀ P ∈ 𝓕₁, IsActive P) : + WellBehaved {P₂ | ∃ P₁ ∈ 𝓕₁, IsComplemented P₁.G P₂.G ∧ P₂.G.roots = P₁.G.roots ∧ + IsCompletionOf (P₁.restrict P₂.G) P₂} := by + refine wellBehaved_of_encoding h fun Ω₂ _ hΩ₂ ↦ ⟨StarLabel Ω₂, inferInstance, wqo_starLabel hΩ₂, + fun Q S ↦ StarStep Q S ∧ ∀ e, S.φ e = starLabel Q e, ?_, ?_⟩ + · rintro Q ⟨P₂, ⟨P₁, hP₁, hc, hr, hres⟩, hQ⟩ + have hG : Q.G = P₂.G := hQ.G_eq + have hrel : IsCompletionOf (P₁.restrict P₂.G) + ((P₁.relabel (starLabel Q)).restrict P₂.G) := + ⟨rfl, rfl, fun _ _ ↦ rfl, fun _ _ ↦ rfl⟩ + refine ⟨P₁.relabel (starLabel Q), ⟨P₁, hP₁, isCompletionOf_relabel _ _⟩, + ⟨?_, ?_, ?_, ha P₁ hP₁⟩, fun _ ↦ rfl⟩ + · rw [hG] + exact hc + · rw [hG] + exact hr + · rw [hG] + exact hrel.symm.trans (hres.trans hQ) + · rintro Q - Q' - S S' ⟨hS, hφ⟩ ⟨hS', hφ'⟩ ⟨ηv, ηe, hη⟩ + have hl : ∀ e ∈ S.G.edgeSet, _ := fun e he ↦ by + have := hη.1.φ_le e he + rw [hφ, hφ'] at this + exact starLabel_le this + exact simulated_of_starStep hS hS' hη (fun e he ↦ (hl e he).1) + fun e he ↦ (hl e (hS.compl.le.edgeSet_subset he)).2 he + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section4g.lean b/LeanPool/GraphMinor/GM20/Section4g.lean new file mode 100644 index 0000000000..3f2ff76405 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section4g.lean @@ -0,0 +1,259 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section4f + +/-! +# Graph Minors XX, Section 4, (4.12) + +(4.12) replaces a piece `A` of a member of `𝓕₁` by a single edge `f`. We follow the paper's proof, +which uses (4.5), (4.11) and (4.6) in turn. + +The paper's proof has one gap (see the correction to the proof of (4.12) in `corrections/GM20.md`). +It uses the roots `μ₂(f)` for the +patchwork without `f`, while `P₂ \ f` has the roots `π(G₁)`. And (4.6) needs the ends of `f` to be +roots. So we use the roots `π(G₁)` followed by the terms of `μ₂(f)` that are not yet roots, and at +the end we return to the roots of `P₂` by a further use of (4.5). + +The file also has facts about `M(G, ℒ)` used for (4.13) and in Section 5. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +theorem deleteEdges_deleteEdges {Ω : Type*} (P : Patchwork Ω α β) (F F' : Set β) : + IsCompletionOf ((P.deleteEdges F).deleteEdges F') (P.deleteEdges (F ∪ F')) where + G_eq := by + refine RootedHypergraph.ext_of rfl ?_ ?_ rfl + · change P.G.edgeSet \ (F ∪ F') = (P.G.edgeSet \ F) \ F' + rw [Set.sdiff_sdiff] + · funext e x + apply propext + change (P.G.Inc e x ∧ e ∉ F ∪ F') ↔ ((P.G.Inc e x ∧ e ∉ F) ∧ e ∉ F') + simp [not_or, and_assoc] + dom_eq := by + change P.dom \ (F ∪ F') = (P.dom \ F) \ F' + rw [Set.sdiff_sdiff] + μ_eq _ _ := rfl + Δ_eq _ _ := rfl + +theorem ncard_march {m : List α} (hm : m.Nodup) : ({x | x ∈ m} : Set α).ncard = m.length := by + classical + have : ({x | x ∈ m} : Set α) = ↑m.toFinset := by + ext x + simp + rw [this, Set.ncard_coe_finset, List.toFinset_card_of_nodup hm] + +section Core + +variable {G : RootedHypergraph α β} {ℒ : Set (RootedHypergraph α β)} + +theorem mem_core_vertexSet {v : α} : v ∈ (rootedLocationCore G ℒ).vertexSet ↔ v ∈ G.vertexSet ∧ + ∀ A ∈ ℒ, v ∈ (complementHypergraph G A).vertexSet := by + constructor + · rintro ⟨h₁, h₂⟩ + exact ⟨h₁, fun A hA ↦ h₂ _ ⟨A, hA, rfl⟩⟩ + · rintro ⟨h₁, h₂⟩ + refine ⟨h₁, ?_⟩ + rintro _ ⟨A, hA, rfl⟩ + exact h₂ A hA + +theorem mem_core_edgeSet {e : β} : e ∈ (rootedLocationCore G ℒ).edgeSet ↔ e ∈ G.edgeSet ∧ + ∀ A ∈ ℒ, e ∉ A.edgeSet := by + constructor + · rintro ⟨h₁, h₂⟩ + exact ⟨h₁, fun A hA ↦ (h₂ _ ⟨A, hA, rfl⟩).2⟩ + · rintro ⟨h₁, h₂⟩ + refine ⟨h₁, ?_⟩ + rintro _ ⟨A, hA, rfl⟩ + exact ⟨h₁, h₂ A hA⟩ + +/-- A vertex in `V(M(G, ℒ))` and in `V(A)` is a root of `A`. -/ +theorem root_of_mem_core {A : RootedHypergraph α β} (hA : A ∈ ℒ) {v : α} + (hv : v ∈ (rootedLocationCore G ℒ).vertexSet) (hvA : v ∈ A.vertexSet) : v ∈ A.rootSet := by + rcases (mem_core_vertexSet.mp hv).2 A hA with h | h + · exact absurd hvA h.2 + · exact h.2 + +/-- `M(G, ℒ)` is a subhypergraph of `G⁻`. -/ +theorem core_le (hℒ : IsRootedLocation G ℒ) : rootedLocationCore G ℒ ≤ G.toHypergraph := by + refine ⟨fun v h ↦ h.1, fun e h ↦ h.1, fun e he ↦ ?_⟩ + ext v + constructor + · intro hinc + have hG : G.Inc e v := hinc + refine ⟨hinc, ?_, ?_⟩ + · rintro _ ⟨A, hA, rfl⟩ + by_cases hvA : v ∈ A.vertexSet + · have heA := (mem_core_edgeSet.mp he).2 A hA + exact Or.inr ⟨G.vertex_mem_of_inc hG, (hℒ.isComplemented hA).inc_diff_mem hvA + ⟨(mem_core_edgeSet.mp he).1, heA⟩ hG⟩ + · exact Or.inl ⟨G.vertex_mem_of_inc hG, hvA⟩ + · exact he.2 + · exact fun h ↦ h.1 + +end Core + +/-- `G \ A ⊆ G` for a complemented `A ⊆ G`. -/ +theorem complement_le {G A : RootedHypergraph α β} (hA : IsComplemented G A) : + (complement G A hA).toHypergraph ≤ G.toHypergraph := by + refine ⟨fun v hv ↦ ?_, fun e he ↦ he.1, fun e he ↦ ?_⟩ + · rcases hv with hv | hv + · exact hv.1 + · exact hA.le.vertexSet_subset (A.roots_subset v hv) + · ext v + exact ⟨fun h ↦ ⟨he, h⟩, fun h ↦ h.2⟩ + +/-- Graph Minors XX, (4.12) (pages 335–336): "Let $\mathcal{F}_1$ be a well-behaved set of active +patchworks, let $k \ge 0$, and let +$\mathcal{F}_2$ be a set of patchworks such that for each $P_2 = (G_2, \mu_2, \Delta_2) \in +\mathcal{F}_2$ there exists $f \in dom(\mu_2)$ with* ... *$\le k$ ends and $P_1 = (G_1, \mu_1, +\Delta_1) \in \mathcal{F}_1$ so that $G_2 \setminus f = G_1 \setminus A$ and $\pi(A) = +\mu_2(f)$ for some complemented rooted hypergraph $A \subseteq G_1$, and $P_2 \setminus +\{f\} = P_1|(G_2 \setminus \{f\})$. Then $\mathcal{F}_2$ is well-behaved." + +The proof is the paper's, with the roots changed as in the module docstring. -/ +theorem theorem_4_12_proof {𝓕₁ 𝓕₂ : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕₁) + (ha : ∀ P ∈ 𝓕₁, IsActive P) (k : ℕ) + (h₂ : ∀ P₂ ∈ 𝓕₂, ∃ f ∈ P₂.dom, (P₂.G.ends f).ncard ≤ k ∧ ∃ P₁ ∈ 𝓕₁, + ∃ (A : RootedHypergraph α β) (hA : IsComplemented P₁.G A), + P₂.G.deleteEdges {f} = complement P₁.G A hA ∧ A.roots = P₂.μ f ∧ + IsCompletionOf (P₁.restrict (P₂.G.deleteEdges {f})) (P₂.deleteEdges {f})) : + WellBehaved 𝓕₂ := by + classical + obtain ⟨K, hK⟩ := h.exists_roots_le + -- `𝓕₃`: members of `𝓕₁` with other roots, at most `K + k` of them. Well-behaved by (4.5). + have h₃ := theorem_4_5_proof h ha (K + k) + set 𝓕₃ : Set (UnlabeledPatchwork α β) := + {P₂ | P₂.G.roots.length ≤ K + k ∧ ∃ P₁ ∈ 𝓕₁, SameBase P₁ P₂} with h𝓕₃ + have ha₃ : ∀ P ∈ 𝓕₃, IsActive P := by + rintro P ⟨-, P₁, hP₁, hb⟩ v hv + obtain ⟨e, he, hinc⟩ := ha P₁ hP₁ v (hb.vertexSet_eq ▸ hv) + refine ⟨e, hb.dom_eq ▸ he, ?_⟩ + rw [hb.inc_eq] + exact hinc + -- `𝓕₄`: the complemented parts of members of `𝓕₃`. Well-behaved by (4.11). + have h₄ := theorem_4_11_proof h₃ ha₃ + set 𝓕₄ : Set (UnlabeledPatchwork α β) := {P₂ | ∃ P₁ ∈ 𝓕₃, IsComplemented P₁.G P₂.G ∧ + P₂.G.roots = P₁.G.roots ∧ IsCompletionOf (P₁.restrict P₂.G) P₂} with h𝓕₄ + -- `𝓕₅`: one edge added to a member of `𝓕₄` by (4.6), with the active members kept. + let 𝓕₅ : Set (UnlabeledPatchwork α β) := + {P | (∃ f ∈ P.G.edgeSet, P.deleteEdges {f} ∈ completions Unit 𝓕₄ ∧ + ∀ v, P.G.Inc f v → v ∈ P.G.roots) ∧ IsActive P} + have h₅ : WellBehaved 𝓕₅ := + (theorem_4_6_proof h₄ (𝓕₂ := {P | ∃ f ∈ P.G.edgeSet, P.deleteEdges {f} ∈ completions Unit 𝓕₄ ∧ + ∀ v, P.G.Inc f v → v ∈ P.G.roots}) fun _ hP ↦ hP).mono fun _ hP ↦ hP.1 + -- `𝓕₂` lies in the set of members of `𝓕₅` with other roots, at most `K` of them, which is + -- well-behaved by (4.5). + refine (theorem_4_5_proof h₅ (fun _ hP ↦ hP.2) K).mono ?_ + intro P₂ hP₂ + obtain ⟨f, hf, hk, P₁, hP₁, A, hA, heq, hroots, hres⟩ := h₂ P₂ hP₂ + have hfE : f ∈ P₂.G.edgeSet := P₂.dom_subset hf + have hG : P₂.G.roots = P₁.G.roots := congrArg (·.roots) heq + have hV : P₂.G.vertexSet = (P₁.G.vertexSet \ A.vertexSet) ∪ A.rootSet := + congrArg (·.vertexSet) heq + have hE : P₂.G.edgeSet \ {f} = P₁.G.edgeSet \ A.edgeSet := congrArg (·.edgeSet) heq + have hInc : ∀ e v, (P₂.G.Inc e v ∧ e ∉ ({f} : Set β)) ↔ + (e ∈ P₁.G.edgeSet \ A.edgeSet ∧ P₁.G.Inc e v) := fun e v ↦ by + have := congrArg (·.Inc) heq + exact Iff.of_eq (congrFun (congrFun this e) v) + have hAμ : A.rootSet = {x | x ∈ P₂.μ f} := by + rw [← hroots] + rfl + have hμf : {x | x ∈ P₂.μ f} = P₂.G.ends f := P₂.μ_set f hf + -- The roots `r`: the roots of `P₂`, followed by the terms of `μ₂(f)` that are not roots. + let r : List α := P₂.G.roots ++ marchSlash (P₂.μ f) {x | x ∈ P₂.G.roots} + have hrn : r.Nodup := by + refine List.Nodup.append P₂.G.roots_nodup (nodup_marchSlash (P₂.μ_nodup f hf) _) ?_ + intro x hx hx' + exact (mem_marchSlash.mp hx').2 hx + have hrμ : ∀ x ∈ P₂.μ f, x ∈ r := fun x hx ↦ by + by_cases hxr : x ∈ P₂.G.roots + · exact List.mem_append_left _ hxr + · exact List.mem_append_right _ (mem_marchSlash.mpr ⟨hx, hxr⟩) + have hrs₂ : ∀ x ∈ r, x ∈ P₂.G.vertexSet := fun x hx ↦ by + rcases List.mem_append.mp hx with hx | hx + · exact P₂.G.roots_subset x hx + · have h₁ : x ∈ {x | x ∈ P₂.μ f} := (mem_marchSlash.mp hx).1 + rw [hμf] at h₁ + exact P₂.G.vertex_mem_of_inc h₁ + have hrs₁ : ∀ x ∈ r, x ∈ P₁.G.vertexSet := fun x hx ↦ by + rcases List.mem_append.mp hx with hx | hx + · exact P₁.G.roots_subset x (hG ▸ hx) + · have h₁ : x ∈ A.rootSet := hAμ ▸ (mem_marchSlash.mp hx).1 + exact hA.le.vertexSet_subset (A.roots_subset x h₁) + have hlen : P₂.G.roots.length ≤ K := hG ▸ hK P₁ hP₁ + have hrlen : r.length ≤ K + k := by + have h₁ : (marchSlash (P₂.μ f) {x | x ∈ P₂.G.roots}).length ≤ (P₂.μ f).length := + List.length_filter_le _ _ + have h₂ : (P₂.μ f).length ≤ k := by + rw [← ncard_march (P₂.μ_nodup f hf), hμf] + exact hk + simp only [r, List.length_append] + omega + let P₅ := P₂.reroot r hrn hrs₂ + let P₃ := P₁.reroot r hrn hrs₁ + have hP₃ : P₃ ∈ 𝓕₃ := ⟨hrlen, P₁, hP₁, rfl, rfl, fun _ _ ↦ rfl, fun _ _ ↦ rfl⟩ + have hle : (P₂.G.deleteEdges {f}).toHypergraph ≤ P₁.G.toHypergraph := by + rw [heq] + exact complement_le hA + -- "`((G₁⁻, μ₂(f)), μ₁, Δ₁) ∈ 𝓕₃`, and so `P₂ \ f ∈ 𝓕₄`", with the roots `r`. + have hP₄ : P₅.deleteEdges {f} ∈ 𝓕₄ := by + refine ⟨P₃, hP₃, ⟨hle, fun _ _ hv ↦ hv, ?_⟩, rfl, ?_⟩ + · intro v e hv he hinc + have heA : e ∈ A.edgeSet := by + by_contra heA + have : e ∈ P₂.G.edgeSet \ {f} := hE ▸ ⟨he.1, heA⟩ + exact he.2 this + have hvA : v ∈ A.vertexSet := A.vertex_mem_of_inc ((inc_iff_of_le hA.le heA).mpr hinc) + have hv' : v ∈ P₂.G.vertexSet := hv + rw [hV] at hv' + rcases hv' with hv' | hv' + · exact absurd hvA hv'.2 + · rw [hAμ] at hv' + exact hrμ v hv' + · exact + { G_eq := rfl + dom_eq := hres.dom_eq + μ_eq := hres.μ_eq + Δ_eq := hres.Δ_eq } + have hends : ∀ v, P₅.G.Inc f v → v ∈ P₅.G.roots := fun v hv ↦ by + have hm : v ∈ {x | x ∈ P₂.μ f} := by + rw [hμf] + exact hv + exact hrμ v hm + -- `P₂` is active, since `P₁` is. + have hact : IsActive P₅ := by + intro v hv + have hv' : v ∈ P₂.G.vertexSet := hv + rw [hV] at hv' + rcases hv' with hv' | hv' + · obtain ⟨e, he, hinc⟩ := ha P₁ hP₁ v hv'.1 + have heA : e ∉ A.edgeSet := fun heA ↦ + hv'.2 (A.vertex_mem_of_inc ((inc_iff_of_le hA.le heA).mpr hinc)) + have h₂ := (hInc e v).mpr ⟨⟨P₁.dom_subset he, heA⟩, hinc⟩ + have hdom : e ∈ (P₂.deleteEdges {f}).dom := by + rw [hres.dom_eq, Patchwork.restrict_dom hle] + exact ⟨he, ⟨P₂.G.edge_mem_of_inc h₂.1, h₂.2⟩⟩ + exact ⟨e, hdom.1, h₂.1⟩ + · rw [hAμ, hμf] at hv' + exact ⟨f, hf, hv'⟩ + -- "and therefore `P₂ ∈ 𝓕₅`", with the roots `r`; then (4.5) restores the roots of `P₂`. + refine ⟨hlen, P₅, ⟨⟨f, hfE, ⟨_, hP₄, IsCompletionOf.refl _⟩, hends⟩, hact⟩, ?_⟩ + exact ⟨rfl, rfl, fun _ _ ↦ rfl, fun _ _ ↦ rfl⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section4h.lean b/LeanPool/GraphMinor/GM20/Section4h.lean new file mode 100644 index 0000000000..36f490bd5e --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section4h.lean @@ -0,0 +1,654 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section4g +import LeanPool.GraphMinor.GM18.Section5 + +/-! +# Graph Minors XX, Section 4, (4.13) by `w` uses of (4.12) + +The paper deduces (4.13) "by $w$ applications of 4.12" (page 336). This file does that when the +new edges `f ∈ F` are not edges of `G₁` (`wellBehaved_replaceSet`). `GraphMinor.GM20.Section4i` +removes this condition by moving to a larger edge type. + +`replaceSet 𝓕₁ k w` is the set of (4.13) for `𝓕₁`, `k` and `w`, with that condition. The proof is +by induction on `w`. Let `P₂` be a member with `|F| = w + 1`, and choose `f ∈ F`. We put the piece +`A_f` back in place of the edge `f` (`putBack`). The result `P'` lies in `replaceSet 𝓕₁ k w`, and +`P₂` comes from `P'` by (4.12) with the piece `A_f`. The new edges are not edges of `G₁`, so they +are not edges of `A_f` either, and `P'` is a patchwork. + +One case is different. If `A_{f'} = A_f` for some other `f' ∈ F`, then `A_f` is no longer a piece of +the rest, and we take `P' = P₂ \ f` instead. Then `P₂` comes from `P'` by (4.12) with the piece that +has vertex set `πBar(A_f)` and no edges (`rootPiece`). +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- The patchworks of (4.13) for `𝓕₁`, `k` and `w`, when the edges of `F` are not edges of +`G₁`. -/ +def replaceSet (𝓕₁ : Set (UnlabeledPatchwork α β)) (k w : ℕ) : Set (UnlabeledPatchwork α β) := + {P₂ | ∃ F ⊆ P₂.dom, F.ncard ≤ w ∧ ∃ P₁ ∈ 𝓕₁, Disjoint F P₁.G.edgeSet ∧ + ∃ A : β → RootedHypergraph α β, + IsRootedLocation P₁.G (A '' F) ∧ P₂.G.roots = P₁.G.roots ∧ + P₂.G.toHypergraph.deleteEdges F = rootedLocationCore P₁.G (A '' F) ∧ + IsCompletionOf (P₁.restrict (P₂.G.deleteEdges F)) (P₂.deleteEdges F) ∧ + ∀ f ∈ F, (A f).roots = P₂.μ f ∧ (P₂.G.ends f).ncard ≤ k} + +/-- The set of (4.12) for `𝓕₁` and `k`. -/ +def replaceOne (𝓕₁ : Set (UnlabeledPatchwork α β)) (k : ℕ) : Set (UnlabeledPatchwork α β) := + {P₂ | ∃ f ∈ P₂.dom, (P₂.G.ends f).ncard ≤ k ∧ ∃ P₁ ∈ 𝓕₁, + ∃ (A : RootedHypergraph α β) (hA : IsComplemented P₁.G A), + P₂.G.deleteEdges {f} = complement P₁.G A hA ∧ A.roots = P₂.μ f ∧ + IsCompletionOf (P₁.restrict (P₂.G.deleteEdges {f})) (P₂.deleteEdges {f})} + +theorem core_empty (G : RootedHypergraph α β) : rootedLocationCore G ∅ = G.toHypergraph := by + refine Hypergraph.ext ?_ ?_ ?_ + · ext v + simp [rootedLocationCore, locationCore, rootedLocationToLocation] + · ext e + simp [rootedLocationCore, locationCore, rootedLocationToLocation] + · funext e v + simp [rootedLocationCore, locationCore, rootedLocationToLocation] + +theorem hyper_deleteEdges_empty (G : Hypergraph α β) : G.deleteEdges ∅ = G := by + refine Hypergraph.ext rfl (Set.sdiff_empty) ?_ + funext e v + simp [Hypergraph.deleteEdges] + +theorem hyper_deleteEdges_deleteEdges (G : Hypergraph α β) (F F' : Set β) : + (G.deleteEdges F).deleteEdges F' = G.deleteEdges (F ∪ F') := by + refine Hypergraph.ext rfl ?_ ?_ + · change (G.edgeSet \ F) \ F' = G.edgeSet \ (F ∪ F') + rw [Set.sdiff_sdiff] + · funext e v + simp [Hypergraph.deleteEdges, not_or, and_assoc] + +theorem deleteEdges_ends_of_notMem {G : Hypergraph α β} {F : Set β} {e : β} (he : e ∉ F) : + (G.deleteEdges F).ends e = G.ends e := by + ext v + exact ⟨fun h ↦ h.1, fun h ↦ ⟨h, he⟩⟩ + +/-- Facts about a member of `replaceSet`, in the notation of (4.13). -/ +structure ReplaceData (P₁ P₂ : UnlabeledPatchwork α β) (F : Set β) (A : β → RootedHypergraph α β) + (k : ℕ) : Prop where + dom : F ⊆ P₂.dom + disj : Disjoint F P₁.G.edgeSet + loc : IsRootedLocation P₁.G (A '' F) + roots : P₂.G.roots = P₁.G.roots + core : P₂.G.toHypergraph.deleteEdges F = rootedLocationCore P₁.G (A '' F) + res : IsCompletionOf (P₁.restrict (P₂.G.deleteEdges F)) (P₂.deleteEdges F) + piece : ∀ f ∈ F, (A f).roots = P₂.μ f ∧ (P₂.G.ends f).ncard ≤ k + +namespace ReplaceData + +variable {P₁ P₂ : UnlabeledPatchwork α β} {F : Set β} {A : β → RootedHypergraph α β} {k : ℕ} + +theorem edgeSet (h : ReplaceData P₁ P₂ F A k) : F ⊆ P₂.G.edgeSet := h.dom.trans P₂.dom_subset + +theorem vertexSet_eq (h : ReplaceData P₁ P₂ F A k) : + P₂.G.vertexSet = (rootedLocationCore P₁.G (A '' F)).vertexSet := + (congrArg Hypergraph.vertexSet h.core : (P₂.G.toHypergraph.deleteEdges F).vertexSet = _) + +theorem mem_core_edgeSet_iff (h : ReplaceData P₁ P₂ F A k) {e : β} : + e ∈ (rootedLocationCore P₁.G (A '' F)).edgeSet ↔ e ∈ P₂.G.edgeSet ∧ e ∉ F := by + rw [← h.core] + rfl + +theorem le (h : ReplaceData P₁ P₂ F A k) : + (P₂.G.deleteEdges F).toHypergraph ≤ P₁.G.toHypergraph := by + change P₂.G.toHypergraph.deleteEdges F ≤ P₁.G.toHypergraph + rw [h.core] + exact core_le h.loc + +theorem inc_iff (h : ReplaceData P₁ P₂ F A k) {e : β} (he : e ∈ P₂.G.edgeSet) (heF : e ∉ F) + (v : α) : P₂.G.Inc e v ↔ P₁.G.Inc e v := by + have h₁ : e ∈ (P₂.G.toHypergraph.deleteEdges F).edgeSet := ⟨he, heF⟩ + rw [← GM10.inc_iff_of_le h.le h₁] + exact ⟨fun h' ↦ ⟨h', heF⟩, fun h' ↦ h'.1⟩ + +theorem ends_eq (h : ReplaceData P₁ P₂ F A k) {f : β} (hf : f ∈ F) : + P₂.G.ends f = (A f).rootSet := by + rw [← P₂.μ_set f (h.dom hf), ← (h.piece f hf).1] + rfl + +theorem isComplemented (h : ReplaceData P₁ P₂ F A k) {f : β} (hf : f ∈ F) : + IsComplemented P₁.G (A f) := + h.loc.isComplemented (mem_image_of_mem A hf) + +/-- A vertex of `G₂` in `A_f` is a root of `A_f`. -/ +theorem root_of_mem (h : ReplaceData P₁ P₂ F A k) {f : β} (hf : f ∈ F) {v : α} + (hv : v ∈ P₂.G.vertexSet) (hvA : v ∈ (A f).vertexSet) : v ∈ (A f).rootSet := + root_of_mem_core (mem_image_of_mem A hf) (h.vertexSet_eq ▸ hv) hvA + +/-- An edge of a piece is not an edge of `G₂`. -/ +theorem notMem_edgeSet (h : ReplaceData P₁ P₂ F A k) {f : β} (hf : f ∈ F) {e : β} + (he : e ∈ (A f).edgeSet) : e ∉ P₂.G.edgeSet := by + intro he₂ + have heG : e ∈ P₁.G.edgeSet := (h.isComplemented hf).le.edgeSet_subset he + by_cases heF : e ∈ F + · exact Set.disjoint_left.mp h.disj heF heG + · exact (mem_core_edgeSet.mp (h.mem_core_edgeSet_iff.mpr ⟨he₂, heF⟩)).2 _ + (mem_image_of_mem A hf) he + +theorem dom_iff (h : ReplaceData P₁ P₂ F A k) {e : β} (he : e ∈ P₂.G.edgeSet) (heF : e ∉ F) : + e ∈ P₂.dom ↔ e ∈ P₁.dom := by + have := h.res.dom_eq + rw [Patchwork.restrict_dom h.le] at this + constructor + · intro hd + have : e ∈ (P₂.deleteEdges F).dom := ⟨hd, heF⟩ + rw [h.res.dom_eq, Patchwork.restrict_dom h.le] at this + exact this.1 + · intro hd + have : e ∈ P₁.dom ∩ (P₂.G.deleteEdges F).edgeSet := ⟨hd, he, heF⟩ + rw [← Patchwork.restrict_dom h.le, ← h.res.dom_eq] at this + exact this.1 + +theorem μ_eq (h : ReplaceData P₁ P₂ F A k) {e : β} (he : e ∈ P₂.G.edgeSet) (heF : e ∉ F) + (hd : e ∈ P₁.dom) : P₂.μ e = P₁.μ e := by + have : e ∈ (P₁.restrict (P₂.G.deleteEdges F)).dom := by + rw [Patchwork.restrict_dom h.le] + exact ⟨hd, he, heF⟩ + exact h.res.μ_eq this + +theorem Δ_eq (h : ReplaceData P₁ P₂ F A k) {e : β} (he : e ∈ P₂.G.edgeSet) (heF : e ∉ F) : + P₂.Δ e = P₁.Δ e := by + have h₁ : e ∈ (P₂.G.deleteEdges F).edgeSet := ⟨he, heF⟩ + rw [← Patchwork.restrict_Δ h.le h₁] + exact h.res.Δ_eq h₁ + +/-- Members of `replaceSet` are active if the members of `𝓕₁` are. -/ +theorem isActive (h : ReplaceData P₁ P₂ F A k) (ha : IsActive P₁) : IsActive P₂ := by + intro v hv + by_cases hin : ∃ f ∈ F, v ∈ (A f).vertexSet + · obtain ⟨f, hf, hvf⟩ := hin + have hroot := h.root_of_mem hf hv hvf + rw [← h.ends_eq hf] at hroot + exact ⟨f, h.dom hf, hroot⟩ + · push Not at hin + have hvc : v ∈ (rootedLocationCore P₁.G (A '' F)).vertexSet := h.vertexSet_eq ▸ hv + obtain ⟨e, he, hinc⟩ := ha v ((core_le h.loc).vertexSet_subset hvc) + have heA : ∀ f ∈ F, e ∉ (A f).edgeSet := fun f hf hef ↦ + hin f hf ((A f).vertex_mem_of_inc + ((GM10.inc_iff_of_le (h.isComplemented hf).le hef).mpr hinc)) + have hec : e ∈ (rootedLocationCore P₁.G (A '' F)).edgeSet := by + refine mem_core_edgeSet.mpr ⟨P₁.dom_subset he, ?_⟩ + rintro _ ⟨f, hf, rfl⟩ + exact heA f hf + obtain ⟨he₂, heF⟩ := h.mem_core_edgeSet_iff.mp hec + exact ⟨e, (h.dom_iff he₂ heF).mpr he, (h.inc_iff he₂ heF v).mpr hinc⟩ + +end ReplaceData + +theorem mem_replaceSet_iff {𝓕₁ : Set (UnlabeledPatchwork α β)} {k w : ℕ} + {P₂ : UnlabeledPatchwork α β} : + P₂ ∈ replaceSet 𝓕₁ k w ↔ ∃ F, F.ncard ≤ w ∧ ∃ P₁ ∈ 𝓕₁, ∃ A, ReplaceData P₁ P₂ F A k := by + constructor + · rintro ⟨F, hF, hw, P₁, hP₁, hd, A, hl, hr, hc, hres, hp⟩ + exact ⟨F, hw, P₁, hP₁, A, ⟨hF, hd, hl, hr, hc, hres, hp⟩⟩ + · rintro ⟨F, hw, P₁, hP₁, A, h⟩ + exact ⟨F, h.dom, hw, P₁, hP₁, h.disj, A, h.loc, h.roots, h.core, h.res, h.piece⟩ + +/-- The case `w = 0`: `G₂ = G₁`, so `P₂` is a completion of `P₁`. -/ +theorem replaceSet_zero_subset (𝓕₁ : Set (UnlabeledPatchwork α β)) (k : ℕ) : + replaceSet 𝓕₁ k 0 ⊆ completions Unit 𝓕₁ := by + intro P₂ hP₂ + obtain ⟨F, hw, P₁, hP₁, A, h⟩ := mem_replaceSet_iff.mp hP₂ + have hF : F = ∅ := (Set.ncard_eq_zero (P₂.G.edgeSet_finite.subset h.edgeSet)).mp + (Nat.le_zero.mp hw) + subst hF + have hcore := h.core + rw [image_empty, core_empty, hyper_deleteEdges_empty] at hcore + have hG : P₂.G = P₁.G := RootedHypergraph.ext_of (congrArg (·.vertexSet) hcore) + (congrArg (·.edgeSet) hcore) (congrArg (·.Inc) hcore) h.roots + have hE : ∀ e, e ∈ P₂.G.edgeSet ↔ e ∈ P₁.G.edgeSet := fun e ↦ by rw [hG] + refine ⟨P₁, hP₁, ⟨hG, ?_, fun e he ↦ ?_, fun e he ↦ ?_⟩⟩ + · ext e + constructor + · intro hd + exact (h.dom_iff (P₂.dom_subset hd) (notMem_empty e)).mp hd + · intro hd + exact (h.dom_iff ((hE e).mpr (P₁.dom_subset hd)) (notMem_empty e)).mpr hd + · exact h.μ_eq ((hE e).mpr (P₁.dom_subset he)) (notMem_empty e) he + · exact h.Δ_eq ((hE e).mpr he) (notMem_empty e) + +/-! ### The piece with no edges -/ + +/-- The rooted hypergraph with vertex set `πBar(A)`, no edges and roots `π(A)`. -/ +def rootPiece (A : RootedHypergraph α β) : RootedHypergraph α β where + vertexSet := A.rootSet + edgeSet := ∅ + Inc _ _ := False + vertex_mem_of_inc _ _ h := h.elim + edge_mem_of_inc _ _ h := h.elim + vertexSet_finite := A.roots.finite_toSet + edgeSet_finite := finite_empty + roots := A.roots + roots_nodup := A.roots_nodup + roots_subset _ hv := hv + +theorem isComplemented_rootPiece {G A : RootedHypergraph α β} (h : A.rootSet ⊆ G.vertexSet) : + IsComplemented G (rootPiece A) := + ⟨⟨h, empty_subset _, fun _ he ↦ he.elim⟩, fun _ hv _ ↦ hv, fun _ _ hv _ _ ↦ hv⟩ + +theorem complement_rootPiece {G A : RootedHypergraph α β} (h : A.rootSet ⊆ G.vertexSet) : + complement G (rootPiece A) (isComplemented_rootPiece h) = G := by + refine RootedHypergraph.ext_of ?_ ?_ ?_ rfl + · ext v + constructor + · rintro (hv | hv) + · exact hv.1 + · exact h hv + · intro hv + by_cases hvA : v ∈ A.rootSet + · exact Or.inr hvA + · exact Or.inl ⟨hv, hvA⟩ + · exact Set.sdiff_empty + · funext e v + apply propext + exact ⟨fun h' ↦ h'.2, fun h' ↦ ⟨⟨G.edge_mem_of_inc h', notMem_empty e⟩, h'⟩⟩ + +/-! ### Putting a piece back -/ + +section PutBack + +variable (P₂ P₁ : UnlabeledPatchwork α β) (A₀ : RootedHypergraph α β) (f : β) + +/-- `P₂` with the edge `f` replaced by the piece `A₀` of `P₁`, for the induction step. -/ +noncomputable def putBack (hdisj : Disjoint A₀.edgeSet P₂.G.edgeSet) + (hle : A₀.toHypergraph ≤ P₁.G.toHypergraph) : UnlabeledPatchwork α β := + open Classical in + { G := + { vertexSet := P₂.G.vertexSet ∪ A₀.vertexSet + edgeSet := (P₂.G.edgeSet \ {f}) ∪ A₀.edgeSet + Inc := fun e v ↦ (P₂.G.Inc e v ∧ e ≠ f) ∨ A₀.Inc e v + vertex_mem_of_inc := fun _ _ h ↦ h.elim (fun h ↦ Or.inl (P₂.G.vertex_mem_of_inc h.1)) + fun h ↦ Or.inr (A₀.vertex_mem_of_inc h) + edge_mem_of_inc := fun _ _ h ↦ h.elim (fun h ↦ Or.inl ⟨P₂.G.edge_mem_of_inc h.1, h.2⟩) + fun h ↦ Or.inr (A₀.edge_mem_of_inc h) + vertexSet_finite := P₂.G.vertexSet_finite.union A₀.vertexSet_finite + edgeSet_finite := (P₂.G.edgeSet_finite.subset sdiff_subset).union A₀.edgeSet_finite + roots := P₂.G.roots + roots_nodup := P₂.G.roots_nodup + roots_subset := fun v hv ↦ Or.inl (P₂.G.roots_subset v hv) } + dom := (P₂.dom \ {f}) ∪ (P₁.dom ∩ A₀.edgeSet) + μ := fun e ↦ if e ∈ A₀.edgeSet then P₁.μ e else P₂.μ e + Δ := fun e ↦ if e ∈ A₀.edgeSet then P₁.Δ e else P₂.Δ e + φ := fun _ ↦ () + dom_subset := by + rintro e (⟨hd, hf⟩ | ⟨-, he⟩) + · exact Or.inl ⟨P₂.dom_subset hd, hf⟩ + · exact Or.inr he + μ_nodup := by + rintro e (⟨hd, -⟩ | ⟨hd, he⟩) + · have he : e ∉ A₀.edgeSet := fun he ↦ + Set.disjoint_left.mp hdisj he (P₂.dom_subset hd) + simp only [he, ite_false] + exact P₂.μ_nodup e hd + · simp only [he, ite_true] + exact P₁.μ_nodup e hd + μ_set := by + rintro e (⟨hd, hf⟩ | ⟨hd, he⟩) + · have he : e ∉ A₀.edgeSet := fun he ↦ + Set.disjoint_left.mp hdisj he (P₂.dom_subset hd) + simp only [he, ite_false] + rw [P₂.μ_set e hd] + ext v + exact ⟨fun h ↦ Or.inl ⟨h, hf⟩, fun h ↦ h.elim (fun h ↦ h.1) + fun h ↦ absurd (A₀.edge_mem_of_inc h) he⟩ + · simp only [he, ite_true] + rw [P₁.μ_set e hd, hle.ends_eq e he] + ext v + exact ⟨fun h ↦ Or.inr h, fun h ↦ h.elim (fun h ↦ absurd (P₂.G.edge_mem_of_inc h.1) + (Set.disjoint_left.mp hdisj he)) id⟩ + Δ_verts := by + rintro e (⟨he₂, hf⟩ | he) + · have he : e ∉ A₀.edgeSet := fun he ↦ Set.disjoint_left.mp hdisj he he₂ + simp only [he, ite_false] + rw [P₂.Δ_verts e he₂] + ext v + exact ⟨fun h ↦ Or.inl ⟨h, hf⟩, fun h ↦ h.elim (fun h ↦ h.1) + fun h ↦ absurd (A₀.edge_mem_of_inc h) he⟩ + · simp only [he, ite_true] + rw [P₁.Δ_verts e (hle.edgeSet_subset he), hle.ends_eq e he] + ext v + exact ⟨fun h ↦ Or.inr h, fun h ↦ h.elim (fun h ↦ absurd (P₂.G.edge_mem_of_inc h.1) + (Set.disjoint_left.mp hdisj he)) id⟩ + Δ_free := by + rintro e (⟨he₂, hf⟩ | he) hnd + · have he : e ∉ A₀.edgeSet := fun he ↦ Set.disjoint_left.mp hdisj he he₂ + simp only [he, ite_false] + exact P₂.Δ_free e he₂ fun hd ↦ hnd (Or.inl ⟨hd, hf⟩) + · simp only [he, ite_true] + exact P₁.Δ_free e (hle.edgeSet_subset he) fun hd ↦ hnd (Or.inr ⟨hd, he⟩) } + +variable {P₂ P₁ A₀ f} +variable (hdisj : Disjoint A₀.edgeSet P₂.G.edgeSet) (hle : A₀.toHypergraph ≤ P₁.G.toHypergraph) + +theorem putBack_inc_iff {e : β} {v : α} : + (putBack P₂ P₁ A₀ f hdisj hle).G.Inc e v ↔ (P₂.G.Inc e v ∧ e ≠ f) ∨ A₀.Inc e v := Iff.rfl + +theorem putBack_ends_of_mem {e : β} (he : e ∈ A₀.edgeSet) : + (putBack P₂ P₁ A₀ f hdisj hle).G.ends e = A₀.ends e := by + ext v + exact ⟨fun h ↦ h.elim (fun h ↦ absurd (P₂.G.edge_mem_of_inc h.1) + (Set.disjoint_left.mp hdisj he)) id, fun h ↦ Or.inr h⟩ + +theorem putBack_ends_of_notMem {e : β} (he : e ∉ A₀.edgeSet) (hf : e ≠ f) : + (putBack P₂ P₁ A₀ f hdisj hle).G.ends e = P₂.G.ends e := by + ext v + exact ⟨fun h ↦ h.elim (fun h ↦ h.1) fun h ↦ absurd (A₀.edge_mem_of_inc h) he, + fun h ↦ Or.inl ⟨h, hf⟩⟩ + +theorem putBack_μ_of_notMem {e : β} (he : e ∉ A₀.edgeSet) : + (putBack P₂ P₁ A₀ f hdisj hle).μ e = P₂.μ e := by + simp [putBack, he] + +theorem putBack_μ_of_mem {e : β} (he : e ∈ A₀.edgeSet) : + (putBack P₂ P₁ A₀ f hdisj hle).μ e = P₁.μ e := by + simp [putBack, he] + +theorem putBack_Δ_of_notMem {e : β} (he : e ∉ A₀.edgeSet) : + (putBack P₂ P₁ A₀ f hdisj hle).Δ e = P₂.Δ e := by + simp [putBack, he] + +theorem putBack_Δ_of_mem {e : β} (he : e ∈ A₀.edgeSet) : + (putBack P₂ P₁ A₀ f hdisj hle).Δ e = P₁.Δ e := by + simp [putBack, he] + +end PutBack + +/-! ### The induction step -/ + +private theorem mem_replaceOne_of_repeated_piece {𝓕₁ : Set (UnlabeledPatchwork α β)} + (ha : ∀ P ∈ 𝓕₁, IsActive P) {P₁ P₂ : UnlabeledPatchwork α β} + (hP₁ : P₁ ∈ 𝓕₁) {F : Set β} {A : β → RootedHypergraph α β} {f : β} + (hf : f ∈ F) {k w : ℕ} (h : ReplaceData P₁ P₂ F A k) : + let F' := F \ {f} + F'.ncard ≤ w → (∃ f' ∈ F', A f' = A f) → + P₂ ∈ replaceOne (replaceSet 𝓕₁ k w ∩ {P | IsActive P}) k := by + classical + intro F' hF'card hdup + have hF' : F' = F \ {f} := rfl + have hF'F : F' ⊆ F := sdiff_subset + have hrootA₀ : (A f).rootSet ⊆ P₂.G.vertexSet := fun v hv ↦ by + rw [← h.ends_eq hf] at hv + exact P₂.G.vertex_mem_of_inc hv + obtain ⟨f', hf', hAf'⟩ := hdup + set X := P₂.deleteEdges {f} with hX + have hset : A '' F' = A '' F := by + refine (image_mono hF'F).antisymm ?_ + rintro _ ⟨g, hg, rfl⟩ + by_cases hgf : g = f + · subst hgf + exact ⟨f', hf', hAf'⟩ + · exact ⟨g, ⟨hg, hgf⟩, rfl⟩ + have hFeq : {f} ∪ F' = F := by + rw [hF', Set.union_sdiff_self, Set.union_eq_right.mpr (singleton_subset_iff.mpr hf)] + have hdel : X.G.deleteEdges F' = P₂.G.deleteEdges F := by + refine RootedHypergraph.ext_of rfl ?_ ?_ rfl + · change (P₂.G.edgeSet \ {f}) \ F' = P₂.G.edgeSet \ F + rw [Set.sdiff_sdiff, hFeq] + · have := hyper_deleteEdges_deleteEdges P₂.G.toHypergraph {f} F' + rw [hFeq] at this + exact congrArg (·.Inc) this + have hXd : ReplaceData P₁ X F' A k := by + refine ⟨fun g hg ↦ ⟨h.dom (hF'F hg), hg.2⟩, h.disj.mono_left hF'F, hset ▸ h.loc, h.roots, + ?_, ?_, fun g hg ↦ ?_⟩ + · rw [hset, ← h.core] + have := hyper_deleteEdges_deleteEdges P₂.G.toHypergraph {f} F' + rw [hFeq] at this + exact this + · rw [hdel] + have := deleteEdges_deleteEdges P₂ {f} F' + rw [hFeq] at this + exact h.res.trans this.symm + · refine ⟨(h.piece g (hF'F hg)).1, ?_⟩ + have : X.G.ends g = P₂.G.ends g := deleteEdges_ends_of_notMem hg.2 + rw [this] + exact (h.piece g (hF'F hg)).2 + have hXmem : X ∈ replaceSet 𝓕₁ k w := mem_replaceSet_iff.mpr ⟨F', hF'card, P₁, hP₁, A, hXd⟩ + have hrootX : (A f).rootSet ⊆ X.G.vertexSet := hrootA₀ + refine ⟨f, h.dom hf, (h.piece f hf).2, X, ⟨hXmem, hXd.isActive (ha P₁ hP₁)⟩, rootPiece (A f), + isComplemented_rootPiece hrootX, ?_, (h.piece f hf).1, ?_⟩ + · rw [complement_rootPiece hrootX] + rfl + · refine ⟨rfl, ?_, fun _ _ ↦ rfl, fun e he ↦ ?_⟩ + · change X.dom = (X.restrict X.G).dom + rw [Patchwork.restrict_dom le_rfl, Set.inter_eq_left.mpr X.dom_subset] + · exact (Patchwork.restrict_Δ (P := X) (G' := X.G) le_rfl he).symm + +/-- The induction step: a member of `replaceSet 𝓕₁ k (w + 1)` lies in `replaceSet 𝓕₁ k w` or comes +by (4.12) from an active member of `replaceSet 𝓕₁ k w`. -/ +theorem replaceSet_succ_subset {𝓕₁ : Set (UnlabeledPatchwork α β)} (ha : ∀ P ∈ 𝓕₁, IsActive P) + (k w : ℕ) : replaceSet 𝓕₁ k (w + 1) ⊆ + replaceSet 𝓕₁ k w ∪ replaceOne (replaceSet 𝓕₁ k w ∩ {P | IsActive P}) k := by + classical + intro P₂ hP₂ + obtain ⟨F, hw, P₁, hP₁, A, h⟩ := mem_replaceSet_iff.mp hP₂ + by_cases hcard : F.ncard ≤ w + · exact Or.inl (mem_replaceSet_iff.mpr ⟨F, hcard, P₁, hP₁, A, h⟩) + have hFfin : F.Finite := P₂.G.edgeSet_finite.subset h.edgeSet + obtain ⟨f, hf⟩ : F.Nonempty := by + rw [← Set.ncard_pos hFfin] + omega + set F' := F \ {f} with hF' + have hF'card : F'.ncard ≤ w := by + rw [hF', Set.ncard_sdiff (singleton_subset_iff.mpr hf) (Set.finite_singleton f), + Set.ncard_singleton] + omega + have hF'F : F' ⊆ F := sdiff_subset + have hfE : f ∈ P₂.G.edgeSet := h.edgeSet hf + have hA₀ := h.isComplemented hf + have hrootA₀ : (A f).rootSet ⊆ P₂.G.vertexSet := fun v hv ↦ by + rw [← h.ends_eq hf] at hv + exact P₂.G.vertex_mem_of_inc hv + right + by_cases hdup : ∃ f' ∈ F', A f' = A f + · exact mem_replaceOne_of_repeated_piece ha hP₁ hf h hF'card hdup + · -- Otherwise put `A_f` back in place of `f`. + push Not at hdup + set A₀ := A f with hA₀def + have hdisj : Disjoint A₀.edgeSet P₂.G.edgeSet := + Set.disjoint_left.mpr fun _ he ↦ h.notMem_edgeSet hf he + set X := putBack P₂ P₁ A₀ f hdisj hA₀.le with hX + have hA₀mem : A₀ ∈ A '' F := mem_image_of_mem A hf + -- `A₀` lies in the complement of every other piece. + have hA₀le : ∀ g (hg : g ∈ F'), A₀.toHypergraph ≤ (complement P₁.G (A g) + (h.isComplemented (hF'F hg))).toHypergraph := fun g hg ↦ + h.loc.le_complement hA₀mem (mem_image_of_mem A (hF'F hg)) (hdup g hg).symm + have hF'G : ∀ g ∈ F', g ∉ P₁.G.edgeSet := fun g hg ↦ + Set.disjoint_left.mp h.disj (hF'F hg) + have hF'A : ∀ g ∈ F', g ∉ A₀.edgeSet := fun g hg hgA ↦ + hF'G g hg (hA₀.le.edgeSet_subset hgA) + have hloc' : IsRootedLocation P₁.G (A '' F') := h.loc.mono (image_mono hF'F) + have hXle : (X.G.toHypergraph.deleteEdges F') ≤ P₁.G.toHypergraph := by + refine ⟨?_, ?_, ?_⟩ + · rintro v (hv | hv) + · exact (core_le h.loc).vertexSet_subset (h.vertexSet_eq ▸ hv) + · exact hA₀.le.vertexSet_subset hv + · rintro e ⟨(⟨he, hef⟩ | he), heF'⟩ + · have heF : e ∉ F := fun heF ↦ heF' ⟨heF, hef⟩ + exact (core_le h.loc).edgeSet_subset (h.mem_core_edgeSet_iff.mpr ⟨he, heF⟩) + · exact hA₀.le.edgeSet_subset he + · rintro e ⟨(⟨he, hef⟩ | he), heF'⟩ + · have heF : e ∉ F := fun heF ↦ heF' ⟨heF, hef⟩ + have heA : e ∉ A₀.edgeSet := fun heA ↦ Set.disjoint_left.mp hdisj heA he + rw [deleteEdges_ends_of_notMem heF', putBack_ends_of_notMem (f := f) hdisj hA₀.le heA hef] + ext v + exact (h.inc_iff he heF v).symm + · rw [deleteEdges_ends_of_notMem heF', putBack_ends_of_mem (f := f) hdisj hA₀.le he] + exact hA₀.le.ends_eq e he + have hXcore : X.G.toHypergraph.deleteEdges F' = rootedLocationCore P₁.G (A '' F') := by + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hXle (core_le hloc') ?_ ?_ + · ext v + rw [mem_core_vertexSet] + constructor + · rintro (hv | hv) + · have := mem_core_vertexSet.mp (h.vertexSet_eq ▸ hv) + exact ⟨this.1, fun B hB ↦ this.2 B (image_mono hF'F hB)⟩ + · refine ⟨hA₀.le.vertexSet_subset hv, ?_⟩ + rintro _ ⟨g, hg, rfl⟩ + have hvc := (hA₀le g hg).vertexSet_subset hv + rcases hvc with hvc | hvc + · exact Or.inl hvc + · exact Or.inr ⟨hA₀.le.vertexSet_subset hv, hvc⟩ + · rintro ⟨hvG, hall⟩ + by_cases hvA : v ∈ A₀.vertexSet + · exact Or.inr hvA + · left + refine h.vertexSet_eq ▸ mem_core_vertexSet.mpr ⟨hvG, ?_⟩ + rintro _ ⟨g, hg, rfl⟩ + by_cases hgf : g = f + · subst hgf + exact Or.inl ⟨hvG, hvA⟩ + · exact hall _ ⟨g, ⟨hg, hgf⟩, rfl⟩ + · ext e + rw [mem_core_edgeSet] + constructor + · rintro ⟨(⟨he, hef⟩ | he), heF'⟩ + · have heF : e ∉ F := fun heF ↦ heF' ⟨heF, hef⟩ + have := mem_core_edgeSet.mp (h.mem_core_edgeSet_iff.mpr ⟨he, heF⟩) + exact ⟨this.1, fun B hB ↦ this.2 B (image_mono hF'F hB)⟩ + · refine ⟨hA₀.le.edgeSet_subset he, ?_⟩ + rintro _ ⟨g, hg, rfl⟩ + exact ((hA₀le g hg).edgeSet_subset he).2 + · rintro ⟨heG, hall⟩ + by_cases heA : e ∈ A₀.edgeSet + · exact ⟨Or.inr heA, fun heF' ↦ hF'A e heF' heA⟩ + · have hcore : e ∈ (rootedLocationCore P₁.G (A '' F)).edgeSet := by + refine mem_core_edgeSet.mpr ⟨heG, ?_⟩ + rintro _ ⟨g, hg, rfl⟩ + by_cases hgf : g = f + · subst hgf + exact heA + · exact hall _ ⟨g, ⟨hg, hgf⟩, rfl⟩ + obtain ⟨he, heF⟩ := h.mem_core_edgeSet_iff.mp hcore + exact ⟨Or.inl ⟨he, fun hef ↦ heF (hef ▸ hf)⟩, fun heF' ↦ heF heF'.1⟩ + have hXd : ReplaceData P₁ X F' A k := by + refine ⟨fun g hg ↦ Or.inl ⟨h.dom (hF'F hg), hg.2⟩, h.disj.mono_left hF'F, hloc', h.roots, + hXcore, ?_, fun g hg ↦ ?_⟩ + · have hXle' : (X.G.deleteEdges F').toHypergraph ≤ P₁.G.toHypergraph := hXle + refine ⟨rfl, ?_, fun e he ↦ ?_, fun e he ↦ ?_⟩ + · rw [Patchwork.restrict_dom hXle'] + ext e + constructor + · rintro ⟨(⟨hd, hef⟩ | ⟨hd, he⟩), heF'⟩ + · have heF : e ∉ F := fun heF ↦ heF' ⟨heF, hef⟩ + exact ⟨(h.dom_iff (P₂.dom_subset hd) heF).mp hd, + Or.inl ⟨P₂.dom_subset hd, hef⟩, heF'⟩ + · exact ⟨hd, Or.inr he, heF'⟩ + · rintro ⟨hd, (⟨he, hef⟩ | he), heF'⟩ + · have heF : e ∉ F := fun heF ↦ heF' ⟨heF, hef⟩ + exact ⟨Or.inl ⟨(h.dom_iff he heF).mpr hd, hef⟩, heF'⟩ + · exact ⟨Or.inr ⟨hd, he⟩, heF'⟩ + · rw [Patchwork.restrict_dom hXle'] at he + obtain ⟨hd, (⟨he, hef⟩ | he), heF'⟩ := he + · have heF : e ∉ F := fun heF ↦ heF' ⟨heF, hef⟩ + have heA : e ∉ A₀.edgeSet := fun heA ↦ Set.disjoint_left.mp hdisj heA he + change X.μ e = P₁.μ e + rw [putBack_μ_of_notMem (f := f) hdisj hA₀.le heA] + exact h.μ_eq he heF hd + · change X.μ e = P₁.μ e + exact putBack_μ_of_mem (f := f) hdisj hA₀.le he + · change X.Δ e = (P₁.restrict (X.G.deleteEdges F')).Δ e + rw [Patchwork.restrict_Δ hXle' he] + obtain ⟨(⟨he, hef⟩ | he), heF'⟩ := he + · have heF : e ∉ F := fun heF ↦ heF' ⟨heF, hef⟩ + have heA : e ∉ A₀.edgeSet := fun heA ↦ Set.disjoint_left.mp hdisj heA he + rw [putBack_Δ_of_notMem (f := f) hdisj hA₀.le heA] + exact h.Δ_eq he heF + · exact putBack_Δ_of_mem (f := f) hdisj hA₀.le he + · have hgA := hF'A g hg + refine ⟨?_, ?_⟩ + · rw [putBack_μ_of_notMem (f := f) hdisj hA₀.le hgA] + exact (h.piece g (hF'F hg)).1 + · rw [putBack_ends_of_notMem (f := f) hdisj hA₀.le hgA hg.2] + exact (h.piece g (hF'F hg)).2 + have hXmem : X ∈ replaceSet 𝓕₁ k w := mem_replaceSet_iff.mpr ⟨F', hF'card, P₁, hP₁, A, hXd⟩ + -- `A₀` is complemented in `X`. + have hB : IsComplemented X.G A₀ := by + refine ⟨⟨fun v hv ↦ Or.inr hv, fun e he ↦ Or.inr he, fun e he ↦ + putBack_ends_of_mem (f := f) hdisj hA₀.le he⟩, fun v hv hvr ↦ ?_, fun v e hv he hinc ↦ ?_⟩ + · have hvr' : v ∈ P₁.G.roots := h.roots ▸ hvr + exact hA₀.roots_mem hv hvr' + · rcases hinc with hinc | hinc + · exact h.root_of_mem hf (P₂.G.vertex_mem_of_inc hinc.1) hv + · exact absurd (A₀.edge_mem_of_inc hinc) he.2 + have hcompl : P₂.G.deleteEdges {f} = complement X.G A₀ hB := by + refine RootedHypergraph.ext_of ?_ ?_ ?_ rfl + · ext v + constructor + · intro hv + by_cases hvA : v ∈ A₀.vertexSet + · exact Or.inr (h.root_of_mem hf hv hvA) + · exact Or.inl ⟨Or.inl hv, hvA⟩ + · rintro (⟨hv | hv, hvA⟩ | hv) + · exact hv + · exact absurd hv hvA + · exact hrootA₀ hv + · ext e + constructor + · rintro ⟨he, hef⟩ + exact ⟨Or.inl ⟨he, hef⟩, fun heA ↦ Set.disjoint_left.mp hdisj heA he⟩ + · rintro ⟨(⟨he, hef⟩ | he), heA⟩ + · exact ⟨he, hef⟩ + · exact absurd he heA + · funext e v + apply propext + constructor + · rintro ⟨hinc, hef⟩ + have he := P₂.G.edge_mem_of_inc hinc + exact ⟨⟨Or.inl ⟨he, hef⟩, fun heA ↦ Set.disjoint_left.mp hdisj heA he⟩, + Or.inl ⟨hinc, hef⟩⟩ + · rintro ⟨⟨-, heA⟩, hinc | hinc⟩ + · exact hinc + · exact absurd (A₀.edge_mem_of_inc hinc) heA + have hle₃ : (P₂.G.deleteEdges {f}).toHypergraph ≤ X.G.toHypergraph := by + rw [hcompl] + exact complement_le hB + refine ⟨f, h.dom hf, (h.piece f hf).2, X, ⟨hXmem, hXd.isActive (ha P₁ hP₁)⟩, A₀, hB, hcompl, + (h.piece f hf).1, ⟨rfl, ?_, fun e he ↦ ?_, fun e he ↦ ?_⟩⟩ + · rw [Patchwork.restrict_dom hle₃] + ext e + constructor + · rintro ⟨hd, hef⟩ + exact ⟨Or.inl ⟨hd, hef⟩, P₂.dom_subset hd, hef⟩ + · rintro ⟨(hd | ⟨-, heA⟩), he, -⟩ + · exact hd + · exact absurd he (Set.disjoint_left.mp hdisj heA) + · rw [Patchwork.restrict_dom hle₃] at he + have heA : e ∉ A₀.edgeSet := fun heA ↦ Set.disjoint_left.mp hdisj heA he.2.1 + exact (putBack_μ_of_notMem (f := f) hdisj hA₀.le heA).symm + · change P₂.Δ e = (X.restrict (P₂.G.deleteEdges {f})).Δ e + rw [Patchwork.restrict_Δ hle₃ he] + have heA : e ∉ A₀.edgeSet := fun heA ↦ Set.disjoint_left.mp hdisj heA he.1 + exact (putBack_Δ_of_notMem (f := f) hdisj hA₀.le heA).symm + +/-- Graph Minors XX, (4.13) (page 336), when the new edges are not edges of `G₁`: by `w` uses of +(4.12). -/ +theorem wellBehaved_replaceSet {𝓕₁ : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕₁) + (ha : ∀ P ∈ 𝓕₁, IsActive P) (k : ℕ) : ∀ w, WellBehaved (replaceSet 𝓕₁ k w) + | 0 => h.completions.mono (replaceSet_zero_subset 𝓕₁ k) + | w + 1 => by + have ih := wellBehaved_replaceSet h ha k w + exact (ih.union (theorem_4_12_proof (ih.mono inter_subset_left) (fun _ hP ↦ hP.2) k + (𝓕₂ := replaceOne (replaceSet 𝓕₁ k w ∩ {P | IsActive P}) k) fun _ hP ↦ hP)).mono + (replaceSet_succ_subset ha k w) + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section4i.lean b/LeanPool/GraphMinor/GM20/Section4i.lean new file mode 100644 index 0000000000..4abf76d355 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section4i.lean @@ -0,0 +1,252 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section4h +public import LeanPool.GraphMinor.GM20.Retag + +/-! +# Graph Minors XX, Section 4, (4.13) + +`GraphMinor.GM20.Section4h` proves (4.13) by `w` uses of (4.12) when the new edges are not edges of +`G₁`. Here we remove that condition. We tag the edges of `G₁` and of the pieces with `0`, the new +edges with `1`, and the other edges of `G₂` with `0` (`GraphMinor.GM20.Retag`). After tagging, the +new edges are not edges of `G₁`, and tagging keeps sets well-behaved. + +The statement of (4.13) in the paper leaves `π(G₂)` free, since `G₁⁻ ∩ ⋂ (G₁ \ A)⁻` has no roots. +With `π(G₂)` free the result is false, because expansions keep the number of roots +(see the correction to (4.13) in `corrections/GM20.md`). As in (4.12) we take `π(G₂) = π(G₁)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +/-! ### Tagging commutes with the operations of (4.13) -/ + +theorem retag_injective (t : β → ℕ) : Function.Injective fun e ↦ (t e, e) := + fun _ _ h ↦ congrArg Prod.snd h + +theorem retagHyper_le {t : β → ℕ} {H G : Hypergraph α β} (h : H ≤ G) : + retagHyper t H ≤ retagHyper t G := by + refine ⟨h.vertexSet_subset, image_mono h.edgeSet_subset, ?_⟩ + rintro _ ⟨e, he, rfl⟩ + rw [retagHyper_ends, retagHyper_ends] + exact h.ends_eq e he + +theorem _root_.GraphMinor.GM18.IsComplemented.retag {G A : RootedHypergraph α β} + (h : IsComplemented G A) (t : β → ℕ) : + IsComplemented (retagRooted t G) (retagRooted t A) := by + refine ⟨retagHyper_le h.le, fun _ hv hr ↦ h.roots_mem hv hr, fun v p hv hp hinc ↦ ?_⟩ + obtain ⟨hpG, hpA⟩ := hp + obtain ⟨-, he⟩ := mem_retagHyper_edgeSet.mp hpG + exact h.inc_diff_mem hv ⟨he, fun heA ↦ hpA (mem_retagHyper_edgeSet.mpr ⟨hinc.1, heA⟩)⟩ hinc.2 + +theorem complement_retag {G A : RootedHypergraph α β} (h : IsComplemented G A) (t : β → ℕ) + (h' : IsComplemented (retagRooted t G) (retagRooted t A)) : + (complement (retagRooted t G) (retagRooted t A) h').toHypergraph = + retagHyper t (complement G A h).toHypergraph := by + refine Hypergraph.ext rfl ?_ ?_ + · exact (Set.image_sdiff (retag_injective t) _ _).symm + · funext p v + apply propext + change (p ∈ (retagHyper t G.toHypergraph).edgeSet \ (retagHyper t A.toHypergraph).edgeSet ∧ + p.1 = t p.2 ∧ G.Inc p.2 v) ↔ (p.1 = t p.2 ∧ p.2 ∈ G.edgeSet \ A.edgeSet ∧ G.Inc p.2 v) + simp only [mem_sdiff, mem_retagHyper_edgeSet] + constructor + · rintro ⟨⟨⟨-, he⟩, hA⟩, ht, hinc⟩ + exact ⟨ht, ⟨he, fun heA ↦ hA ⟨ht, heA⟩⟩, hinc⟩ + · rintro ⟨ht, ⟨he, hA⟩, hinc⟩ + exact ⟨⟨⟨ht, he⟩, fun h ↦ hA h.2⟩, ht, hinc⟩ + +theorem _root_.GraphMinor.GM18.IsRootedLocation.retag {G : RootedHypergraph α β} + {ℒ : Set (RootedHypergraph α β)} + (h : IsRootedLocation G ℒ) (t : β → ℕ) : + IsRootedLocation (retagRooted t G) (retagRooted t '' ℒ) := by + refine ⟨?_, ?_⟩ + · rintro _ ⟨A, hA, rfl⟩ + exact (h.isComplemented hA).retag t + · rintro _ ⟨A₁, h₁, rfl⟩ _ ⟨A₂, h₂, rfl⟩ hne + rw [complement_retag (h.isComplemented h₂)] + exact retagHyper_le (h.le_complement h₁ h₂ fun heq ↦ hne (heq ▸ rfl)) + +theorem core_retag {G : RootedHypergraph α β} {ℒ : Set (RootedHypergraph α β)} + (h : IsRootedLocation G ℒ) (t : β → ℕ) : + rootedLocationCore (retagRooted t G) (retagRooted t '' ℒ) = + retagHyper t (rootedLocationCore G ℒ) := by + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq (core_le (h.retag t)) (retagHyper_le (core_le h)) + ?_ ?_ + · ext v + rw [mem_core_vertexSet] + change _ ↔ v ∈ (rootedLocationCore G ℒ).vertexSet + rw [mem_core_vertexSet] + constructor + · rintro ⟨h₁, h₂⟩ + exact ⟨h₁, fun A hA ↦ h₂ _ ⟨A, hA, rfl⟩⟩ + · rintro ⟨h₁, h₂⟩ + refine ⟨h₁, ?_⟩ + rintro _ ⟨A, hA, rfl⟩ + exact h₂ A hA + · ext p + rw [mem_core_edgeSet, mem_retagHyper_edgeSet, mem_core_edgeSet] + change (p ∈ (retagHyper t G.toHypergraph).edgeSet ∧ _) ↔ _ + rw [mem_retagHyper_edgeSet] + constructor + · rintro ⟨⟨ht, he⟩, h₂⟩ + exact ⟨ht, he, fun A hA heA ↦ h₂ _ ⟨A, hA, rfl⟩ (mem_retagHyper_edgeSet.mpr ⟨ht, heA⟩)⟩ + · rintro ⟨ht, he, h₂⟩ + refine ⟨⟨ht, he⟩, ?_⟩ + rintro _ ⟨A, hA, rfl⟩ hpA + exact h₂ A hA (mem_retagHyper_edgeSet.mp hpA).2 + +theorem retagHyper_deleteEdges (t : β → ℕ) (G : Hypergraph α β) (F : Set β) : + (retagHyper t G).deleteEdges ((fun e ↦ (t e, e)) '' F) = retagHyper t (G.deleteEdges F) := by + refine Hypergraph.ext rfl ?_ ?_ + · exact (Set.image_sdiff (retag_injective t) _ _).symm + · funext p v + apply propext + change ((p.1 = t p.2 ∧ G.Inc p.2 v) ∧ p ∉ (fun e ↦ (t e, e)) '' F) ↔ + (p.1 = t p.2 ∧ G.Inc p.2 v ∧ p.2 ∉ F) + constructor + · rintro ⟨⟨ht, hinc⟩, hF⟩ + exact ⟨ht, hinc, fun hF' ↦ hF ⟨p.2, hF', Prod.ext ht.symm rfl⟩⟩ + · rintro ⟨ht, hinc, hF⟩ + refine ⟨⟨ht, hinc⟩, ?_⟩ + rintro ⟨e, he, rfl⟩ + exact hF he + +theorem retagHyper_congr {t t' : β → ℕ} {G : Hypergraph α β} (h : ∀ e ∈ G.edgeSet, t e = t' e) : + retagHyper t G = retagHyper t' G := by + refine Hypergraph.ext rfl ?_ ?_ + · change (fun e ↦ (t e, e)) '' G.edgeSet = (fun e ↦ (t' e, e)) '' G.edgeSet + exact Set.image_congr fun e he ↦ by rw [h e he] + · funext p v + apply propext + change (p.1 = t p.2 ∧ G.Inc p.2 v) ↔ (p.1 = t' p.2 ∧ G.Inc p.2 v) + constructor + · rintro ⟨ht, hinc⟩ + exact ⟨ht.trans (h _ (G.edge_mem_of_inc hinc)), hinc⟩ + · rintro ⟨ht, hinc⟩ + exact ⟨ht.trans (h _ (G.edge_mem_of_inc hinc)).symm, hinc⟩ + +theorem retag_deleteEdges {Ω : Type*} (t : β → ℕ) (P : Patchwork Ω α β) (F : Set β) : + IsCompletionOf (retagPatchwork t (P.deleteEdges F)) + ((retagPatchwork t P).deleteEdges ((fun e ↦ (t e, e)) '' F)) where + G_eq := by + have := retagHyper_deleteEdges t P.G.toHypergraph F + exact RootedHypergraph.ext_of (congrArg (·.vertexSet) this) (congrArg (·.edgeSet) this) + (congrArg (·.Inc) this) rfl + dom_eq := (Set.image_sdiff (retag_injective t) _ _).symm + μ_eq _ _ := rfl + Δ_eq _ _ := rfl + +theorem retag_congr {Ω : Type*} {t t' : β → ℕ} {P : Patchwork Ω α β} + (h : ∀ e ∈ P.G.edgeSet, t e = t' e) : + IsCompletionOf (retagPatchwork t P) (retagPatchwork t' P) where + G_eq := by + have := retagHyper_congr (G := P.G.toHypergraph) h + exact RootedHypergraph.ext_of (congrArg (·.vertexSet) this.symm) + (congrArg (·.edgeSet) this.symm) (congrArg (·.Inc) this.symm) rfl + dom_eq := Set.image_congr fun e he ↦ by rw [h e (P.dom_subset he)] + μ_eq _ _ := rfl + Δ_eq _ _ := rfl + +theorem restrict_retag {Ω : Type*} {t : β → ℕ} {P : Patchwork Ω α β} {H : RootedHypergraph α β} + (h : H.toHypergraph ≤ P.G.toHypergraph) : + IsCompletionOf ((retagPatchwork t P).restrict (retagRooted t H)) + (retagPatchwork t (P.restrict H)) where + G_eq := rfl + dom_eq := by + change (fun e ↦ (t e, e)) '' (P.restrict H).dom = _ + rw [Patchwork.restrict_dom h, Patchwork.restrict_dom (retagHyper_le h)] + exact Set.image_inter (retag_injective t) + μ_eq _ _ := rfl + Δ_eq p hp := by + obtain ⟨e, he, rfl⟩ := hp + change (P.restrict H).Δ e = ((retagPatchwork t P).restrict (retagRooted t H)).Δ (t e, e) + have hp : (t e, e) ∈ (retagRooted t H).edgeSet := ⟨e, he, rfl⟩ + rw [Patchwork.restrict_Δ h he, Patchwork.restrict_Δ (retagHyper_le h) hp] + rfl + +/-! ### (4.13) -/ + +/-- Graph Minors XX, (4.13) (page 336), with `π(G₂) = π(G₁)`, see the module docstring: "Let +$\mathcal{F}_1$ be a well-behaved set of active patchworks, let $k, w \ge 0$ and let +$\mathcal{F}_2$ be a set of patchworks such that for each $P_2 = (G_2, \mu_2, \Delta_2) \in +\mathcal{F}_2$ there exists $F \subseteq dom(\mu_2)$ with $|F| \le w$ and $P_1 = (G_1, +\mu_1, \Delta_1) \in \mathcal{F}_1$, and a rooted location $\mathcal{L} = \{A_f : f \in F\}$ +in $G_1$, such that* - $G_2^- \setminus F = G_1^- \cap \bigcap((G_1 \setminus A)^- : A \in +\mathcal{L})$, - $P_2 \setminus F = P_1|(G_2 \setminus F)$, and - for each $f \in F$, +$\pi(A_f) = \mu_2(f)$ and $f$ has $\le k$ ends. *Then $\mathcal{F}_2$ is well-behaved." + +The corrected form adds equality of the root marches of `G₂` and `G₁`. Apply +`wellBehaved_replaceSet` after tagging the new edges. -/ +theorem theorem_4_13_proof {𝓕₁ 𝓕₂ : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕₁) + (ha : ∀ P ∈ 𝓕₁, IsActive P) (k w : ℕ) + (h₂ : ∀ P₂ ∈ 𝓕₂, ∃ F ⊆ P₂.dom, F.ncard ≤ w ∧ ∃ P₁ ∈ 𝓕₁, ∃ A : β → RootedHypergraph α β, + IsRootedLocation P₁.G (A '' F) ∧ P₂.G.roots = P₁.G.roots ∧ + P₂.G.toHypergraph.deleteEdges F = rootedLocationCore P₁.G (A '' F) ∧ + IsCompletionOf (P₁.restrict (P₂.G.deleteEdges F)) (P₂.deleteEdges F) ∧ + ∀ f ∈ F, (A f).roots = P₂.μ f ∧ (P₂.G.ends f).ncard ≤ k) : + WellBehaved 𝓕₂ := by + classical + let z : β → ℕ := fun _ ↦ 0 + refine wellBehaved_of_retag (𝓢 := replaceSet (retagPatchwork z '' 𝓕₁) k w) + (wellBehaved_replaceSet h.retag_zero (by rintro _ ⟨P, hP, rfl⟩; exact (ha P hP).retag z) k w) + fun P₂ hP₂ ↦ ?_ + obtain ⟨F, hF, hw, P₁, hP₁, A, hℒ, hroots, hcore, hres, hA⟩ := h₂ P₂ hP₂ + -- The new edges get the tag `1`, all other edges the tag `0`. + let t : β → ℕ := fun e ↦ if e ∈ F then 1 else 0 + let ι : β → ℕ × β := fun e ↦ (t e, e) + refine ⟨t, retagPatchwork t P₂, ?_, IsCompletionOf.refl _⟩ + have himg : (fun p : ℕ × β ↦ retagRooted z (A p.2)) '' (ι '' F) = retagRooted z '' (A '' F) := by + rw [image_image, image_image] + have htz : ∀ e ∈ (P₂.G.toHypergraph.deleteEdges F).edgeSet, z e = t e := fun e he ↦ + (ite_eq_right_iff.mpr fun h ↦ absurd h he.2).symm + have hdel : (retagPatchwork t P₂).G.toHypergraph.deleteEdges (ι '' F) = + retagHyper z (P₂.G.toHypergraph.deleteEdges F) := by + change (retagHyper t P₂.G.toHypergraph).deleteEdges (ι '' F) = _ + rw [retagHyper_deleteEdges, retagHyper_congr htz] + have hle : (P₂.G.deleteEdges F).toHypergraph ≤ P₁.G.toHypergraph := by + change P₂.G.toHypergraph.deleteEdges F ≤ P₁.G.toHypergraph + rw [hcore] + exact core_le hℒ + refine mem_replaceSet_iff.mpr ⟨ι '' F, ?_, retagPatchwork z P₁, ⟨P₁, hP₁, rfl⟩, + fun p ↦ retagRooted z (A p.2), ⟨?_, ?_, himg ▸ hℒ.retag z, hroots, ?_, ?_, ?_⟩⟩ + · rw [Set.ncard_image_of_injective _ (retag_injective t)] + exact hw + · rintro _ ⟨f, hf, rfl⟩ + exact ⟨f, hF hf, rfl⟩ + · refine Set.disjoint_left.mpr ?_ + rintro _ ⟨f, hf, rfl⟩ hp + have h₁ : t f = 0 := (mem_retagHyper_edgeSet.mp hp).1 + have h₂ : t f = 1 := by simp [t, hf] + omega + · rw [himg, show (retagPatchwork z P₁).G = retagRooted z P₁.G from rfl, core_retag hℒ, hdel, + hcore] + · have hG' : (retagPatchwork t P₂).G.deleteEdges (ι '' F) = + retagRooted z (P₂.G.deleteEdges F) := + RootedHypergraph.ext_of (congrArg (·.vertexSet) hdel) (congrArg (·.edgeSet) hdel) + (congrArg (·.Inc) hdel) rfl + rw [hG'] + exact (((restrict_retag hle).trans (hres.retag z)).trans (retag_congr htz)).trans + (retag_deleteEdges t P₂ F) + · rintro _ ⟨f, hf, rfl⟩ + refine ⟨(hA f hf).1, ?_⟩ + change ((retagHyper t P₂.G.toHypergraph).ends (t f, f)).ncard ≤ k + rw [retagHyper_ends] + exact (hA f hf).2 + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section5a.lean b/LeanPool/GraphMinor/GM20/Section5a.lean new file mode 100644 index 0000000000..b9c111ca26 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section5a.lean @@ -0,0 +1,142 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section4i +public import LeanPool.GraphMinor.GM10.Section9 +public import LeanPool.GraphMinor.GM10.Section10 + +/-! +# Graph Minors XX, Section 5, (5.1) and (5.2) + +These two results describe the set `ℳ(𝒯, W, θ)`. Distinctions of tangles do not cross, by (9.4) and +(10.2) of Graph Minors X, and this gives (5.1). Members of `ℳ(𝒯, W, θ)` are then nearly disjoint, +and +each misses its own member of `W`, which gives (5.2). +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph + +universe u v + +variable {α : Type u} {β : Type v} {Λ : Type*} [LinearOrder Λ] + {lam : Hypergraph α β × Hypergraph α β → Λ} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {W : Set (α ⊕ β)} {θ : ℕ} + +theorem zSet_mono {A B : Hypergraph α β} (h : A ≤ B) : zSet A ⊆ zSet B := + union_subset_union (image_mono h.vertexSet_subset) (image_mono h.edgeSet_subset) + +theorem mem_zSet_of_separation {A B : Hypergraph α β} (h : G.IsSeparation A B) {z : α ⊕ β} + (hz : z ∈ zSet G) : z ∈ zSet A ∨ z ∈ zSet B := by + rcases hz with ⟨v, hv, rfl⟩ | ⟨e, he, rfl⟩ + · rw [← h.vertexSet_union] at hv + exact hv.imp (fun h ↦ Or.inl ⟨v, h, rfl⟩) fun h ↦ Or.inl ⟨v, h, rfl⟩ + · rw [← h.edgeSet_union] at he + exact he.imp (fun h ↦ Or.inr ⟨e, h, rfl⟩) fun h ↦ Or.inr ⟨e, h, rfl⟩ + +/-- `(A, B)` and `(C, D)` of a tangle cannot have `D ⊆ A`, because then `A ∪ C = G`, contrary to the +second tangle axiom. -/ +theorem not_le_of_mem_tangle {θ₀ : ℕ} (h𝒯 : IsTangle G θ₀ 𝒯) {A B C D : Hypergraph α β} + (hAB : (A, B) ∈ 𝒯) (hCD : (C, D) ∈ 𝒯) (hDA : D ≤ A) : False := by + have hsep := h𝒯.isSeparation hAB + have hsep' := h𝒯.isSeparation hCD + refine h𝒯.axiom2 hAB hCD hCD ?_ + have hu : A ∪ C = G := by + refine le_antisymm (union_le hsep.left_le hsep'.left_le) ?_ + rw [← hsep'.union_eq] + have h₁ : C ≤ A ∪ C := le_union_right hsep.left_le hsep'.left_le + have h₂ : A ≤ A ∪ C := le_union_left hsep.left_le hsep'.left_le + exact union_le h₁ (hDA.trans h₂) + rw [hu] + have h₁ : G ∪ C = G := le_antisymm (union_le le_rfl hsep'.left_le) + (le_union_left le_rfl hsep'.left_le) + exact h₁ + +/-- Graph Minors XX, (5.1) (page 336), first part: "Let $(C, D) \in \mathcal{M}(\mathcal{T}, W, +\theta)$, and let $(A, B)$ be the $(\mathcal{T}, +\mathcal{T}')$-distinction for some tangle $\mathcal{T}'$. Then either $A \subseteq C$ and +$D \subseteq B$, or $A \subseteq D$ and $C \subseteq B$, or $C \subseteq A$ and $B \subseteq +D$" -/ +theorem theorem_5_1_proof {θ₀ θ' : ℕ} {𝒯' : Set (Hypergraph α β × Hypergraph α β)} + (hTB : IsTieBreaker G lam) (h𝒯 : IsTangle G θ₀ 𝒯) (h𝒯' : IsTangle G θ' 𝒯') + {A B C D : Hypergraph α β} (hM : InM lam G 𝒯 W θ C D) (hAB : IsDistinction lam 𝒯 𝒯' A B) : + (A ≤ C ∧ D ≤ B) ∨ (A ≤ D ∧ C ≤ B) ∨ (C ≤ A ∧ B ≤ D) := by + obtain ⟨hCD, -, -, θ'', 𝒯'', h𝒯'', hdist⟩ := hM.1 + have h₁ := GraphMinor.GM10.theorem_10_2_proof G lam θ₀ θ' 𝒯 𝒯' A B hTB h𝒯 h𝒯' hAB + have h₂ := GraphMinor.GM10.theorem_10_2_proof G lam θ₀ θ'' 𝒯 𝒯'' C D hTB h𝒯 h𝒯'' hdist + have hnc := GraphMinor.GM10.theorem_9_4_proof hTB h₁ h₂ + rw [SeparationsCross, not_not] at hnc + rcases hnc with h | h | h | h + · exact Or.inl h + · exact Or.inr (Or.inl h) + · exact (not_le_of_mem_tangle h𝒯 hAB.1.1 hCD h.2).elim + · exact Or.inr (Or.inr ⟨h.2, h.1⟩) + +/-- Graph Minors XX, (5.1) (page 336), second part: "if $(A, B)$ has order $< \theta$ then one of +the first two alternatives holds." -/ +theorem theorem_5_1_of_lt {θ₀ θ' : ℕ} {𝒯' : Set (Hypergraph α β × Hypergraph α β)} + (hTB : IsTieBreaker G lam) (h𝒯 : IsTangle G θ₀ 𝒯) (h𝒯' : IsTangle G θ' 𝒯') + {A B C D : Hypergraph α β} (hM : InM lam G 𝒯 W θ C D) (hAB : IsDistinction lam 𝒯 𝒯' A B) + (hlt : separationOrder A B < θ) : (A ≤ C ∧ D ≤ B) ∨ (A ≤ D ∧ C ≤ B) := by + rcases theorem_5_1_proof hTB h𝒯 h𝒯' hM hAB with h | h | ⟨hCA, hBD⟩ + · exact Or.inl h + · exact Or.inr h + · obtain ⟨⟨-, -, hW, -⟩, hmax⟩ := hM + have hpre : InMPre lam G 𝒯 W θ A B := + ⟨hAB.1.1, hlt, fun h ↦ hW (h.trans (zSet_mono hBD)), θ', 𝒯', h𝒯', hAB⟩ + by_cases heq : (A, B) = (C, D) + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj heq + exact Or.inl ⟨le_rfl, le_rfl⟩ + · exact absurd ⟨hCA, hBD⟩ (hmax hpre heq) + +/-- Graph Minors XX, (5.2) (page 337), first part: "If $(A, B), (A', B') \in +\mathcal{M}(\mathcal{T}, W, \theta)$ are distinct then $A \subseteq +B'$" -/ +theorem theorem_5_2_proof {θ₀ : ℕ} (hTB : IsTieBreaker G lam) (h𝒯 : IsTangle G θ₀ 𝒯) + {A B A' B' : Hypergraph α β} (hM : InM lam G 𝒯 W θ A B) (hM' : InM lam G 𝒯 W θ A' B') + (hne : (A, B) ≠ (A', B')) : A ≤ B' := by + obtain ⟨⟨-, hlt, -, θ₁, 𝒯₁, h𝒯₁, hd⟩, -⟩ := id hM + obtain ⟨⟨-, hlt', -, θ₂, 𝒯₂, h𝒯₂, hd'⟩, -⟩ := id hM' + rcases theorem_5_1_of_lt hTB h𝒯 h𝒯₁ hM' hd hlt with h | h + · rcases theorem_5_1_of_lt hTB h𝒯 h𝒯₂ hM hd' hlt' with h' | h' + · exact absurd (by rw [le_antisymm h.1 h'.1, le_antisymm h'.2 h.2]) hne + · exact h'.2 + · exact h.1 + +/-- Graph Minors XX, (5.2) (page 337), second part: "`ℳ(𝒯, W, θ)` has cardinality `≤ |W|`." -/ +theorem theorem_5_2_card {θ₀ : ℕ} (hTB : IsTieBreaker G lam) (h𝒯 : IsTangle G θ₀ 𝒯) + (hW : W.Finite) (hWG : W ⊆ zSet G) : + {p : Hypergraph α β × Hypergraph α β | InM lam G 𝒯 W θ p.1 p.2}.ncard ≤ W.ncard := by + classical + have hz : ∀ p : Hypergraph α β × Hypergraph α β, InM lam G 𝒯 W θ p.1 p.2 → + ∃ z ∈ W, z ∉ zSet p.2 := fun p hp ↦ not_subset.mp hp.1.2.2.1 + obtain hemp | ⟨p₀, hp₀⟩ := Set.eq_empty_or_nonempty + {p : Hypergraph α β × Hypergraph α β | InM lam G 𝒯 W θ p.1 p.2} + · rw [hemp, Set.ncard_empty] + exact Nat.zero_le _ + have hne : Nonempty (α ⊕ β) := ⟨(hz p₀ hp₀).choose⟩ + choose! z hzW hzB using hz + refine Set.ncard_le_ncard_of_injOn z (fun p hp ↦ hzW p hp) ?_ hW + rintro ⟨A, B⟩ hp ⟨A', B'⟩ hp' heq + by_contra hne + have hle := theorem_5_2_proof hTB h𝒯 hp hp' hne + have hsep : G.IsSeparation A B := h𝒯.isSeparation hp.1.1 + have h₁ := hzB _ hp + have h₂ := hzB _ hp' + rcases mem_zSet_of_separation hsep (hWG (hzW _ hp)) with h | h + · refine h₂ ?_ + rw [← heq] + exact zSet_mono hle h + · exact h₁ h + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section5b.lean b/LeanPool/GraphMinor/GM20/Section5b.lean new file mode 100644 index 0000000000..cdc7811d72 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section5b.lean @@ -0,0 +1,471 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section5a + +/-! +# Hearts of fine rooted locations + +The results of Section 5 of Graph Minors XX replace a fine rooted location `ℒ` by another one `ℒ'`, +and +compare the hearts. This file gives the tools. +- `exists_heart`: a fine rooted location has a heart, for any injective choice of new edges. +- `mem_chain`: the patchwork `Q'` is reached from `Q₀` by a chain of 1-vertex extensions, if `Q'` + has + the same edges and each extra vertex is on one edge. The patchworks in the chain need not be + hearts, since a 1-vertex extension allows any march and patch on the changed edge. +- `addRoots`: the rooted hypergraph `f(C)` of the proof of (5.3), with the vertices of `X` made + roots, + and `isRootedLocation_addRoots`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- The patchworks of `s` in (4.8), up to agreement with the start and the end. -/ +def chainSet (𝓕 : Set (UnlabeledPatchwork α β)) (k : ℕ) : Set (UnlabeledPatchwork α β) := + completions Unit {P₂ | ∃ s : ℕ → UnlabeledPatchwork α β, ∃ k' ≤ k, s 0 ∈ completions Unit 𝓕 ∧ + s k' = P₂ ∧ ∀ i < k', ∃ f v, IsOneVertexExtension (s i) (s (i + 1)) f v} + +theorem wellBehaved_chainSet {𝓕 : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕) (k : ℕ) : + WellBehaved (chainSet 𝓕 k) := + (theorem_4_8_proof h.completions k).completions + +/-- Two patchworks which `mem_chain` connects. -/ +structure ChainData (Q₀ Q' : UnlabeledPatchwork α β) (X : Set α) : Prop where + roots_eq : Q'.G.roots = Q₀.G.roots + edgeSet_eq : Q'.G.edgeSet = Q₀.G.edgeSet + dom_eq : Q'.dom = Q₀.dom + vertexSet_eq : Q'.G.vertexSet = Q₀.G.vertexSet ∪ X + disjoint : Disjoint X Q₀.G.vertexSet + inc_iff : ∀ e v, v ∈ Q₀.G.vertexSet → (Q₀.G.Inc e v ↔ Q'.G.Inc e v) + exists_edge : ∀ x ∈ X, ∃ f ∈ Q₀.dom, Q'.G.Inc f x ∧ ∀ e, Q'.G.Inc e x → e = f + same_of_ends : ∀ e ∈ Q₀.G.edgeSet, Q'.G.ends e = Q₀.G.ends e → e ∈ Q₀.dom → + Q'.μ e = Q₀.μ e + sameΔ_of_ends : ∀ e ∈ Q₀.G.edgeSet, Q'.G.ends e = Q₀.G.ends e → Q'.Δ e = Q₀.Δ e + +open Classical in +/-- The stage `T ⊆ X` between `Q₀` and `Q'`. -/ +noncomputable def chainStage {Q₀ Q' : UnlabeledPatchwork α β} {X : Set α} (h : ChainData Q₀ Q' X) + (T : Set α) (hT : T ⊆ X) : UnlabeledPatchwork α β := + let V := Q₀.G.vertexSet ∪ T + let hV : V ⊆ Q'.G.vertexSet := fun v hv ↦ by + rw [h.vertexSet_eq] + exact hv.imp id fun h' ↦ hT h' + let ends : β → Set α := fun e ↦ Q'.G.ends e ∩ V + { G := + { vertexSet := V + edgeSet := Q'.G.edgeSet + Inc := fun e v ↦ Q'.G.Inc e v ∧ v ∈ V + vertex_mem_of_inc := fun _ _ h' ↦ h'.2 + edge_mem_of_inc := fun _ _ h' ↦ Q'.G.edge_mem_of_inc h'.1 + vertexSet_finite := Q'.G.vertexSet_finite.subset hV + edgeSet_finite := Q'.G.edgeSet_finite + roots := Q'.G.roots + roots_nodup := Q'.G.roots_nodup + roots_subset := fun v hv ↦ Or.inl (Q₀.G.roots_subset v (h.roots_eq ▸ hv)) } + dom := Q'.dom + μ := fun e ↦ if ends e = Q₀.G.ends e then Q₀.μ e else marchSlash (Q'.μ e) (Vᶜ) + Δ := fun e ↦ if ends e = Q₀.G.ends e then Q₀.Δ e else if ends e = Q'.G.ends e then Q'.Δ e else + freePatch (ends e) + φ := Q'.φ + dom_subset := Q'.dom_subset + μ_nodup := fun e he ↦ by + split_ifs + · exact Q₀.μ_nodup e (h.dom_eq ▸ he) + · exact nodup_marchSlash (Q'.μ_nodup e he) _ + μ_set := fun e he ↦ by + change _ = ends e + split_ifs with h₁ + · rw [Q₀.μ_set e (h.dom_eq ▸ he), h₁] + · ext v + have h₂ := Set.ext_iff.mp (Q'.μ_set e he) v + simp only [mem_ofPred_eq, mem_marchSlash, mem_compl_iff, not_not] at h₂ ⊢ + exact ⟨fun h' ↦ ⟨h₂.mp h'.1, h'.2⟩, fun h' ↦ ⟨h₂.mpr h'.1, h'.2⟩⟩ + Δ_verts := fun e he ↦ by + change _ = ends e + split_ifs with h₁ h₂ + · rw [Q₀.Δ_verts e (h.edgeSet_eq ▸ he), h₁] + · rw [Q'.Δ_verts e he, h₂] + · rfl + Δ_free := fun e he hd ↦ by + split_ifs with h₁ h₂ + · exact Q₀.Δ_free e (h.edgeSet_eq ▸ he) (fun h' ↦ hd (h.dom_eq ▸ h')) + · exact Q'.Δ_free e he hd + · exact freePatch_isFree _ } + +section Chain + +variable {Q₀ Q' : UnlabeledPatchwork α β} {X : Set α} (h : ChainData Q₀ Q' X) + +include h in +theorem chainStage_extension {T : Set α} (hT : T ⊆ X) {x : α} (hx : x ∈ X) (hxT : x ∉ T) + (hT' : insert x T ⊆ X) : + ∃ f, IsOneVertexExtension (chainStage h T hT) (chainStage h (insert x T) hT') f x := by + classical + obtain ⟨f, hf, hinc, hone⟩ := h.exists_edge x hx + have hx₀ : x ∉ Q₀.G.vertexSet := Set.disjoint_left.mp h.disjoint hx + have hends : ∀ e, e ≠ f → Q'.G.ends e ∩ (Q₀.G.vertexSet ∪ insert x T) = + Q'.G.ends e ∩ (Q₀.G.vertexSet ∪ T) := by + intro e he + ext y + constructor + · rintro ⟨h₁, h₂ | rfl | h₂⟩ + · exact ⟨h₁, Or.inl h₂⟩ + · exact absurd (hone e h₁) he + · exact ⟨h₁, Or.inr h₂⟩ + · rintro ⟨h₁, h₂ | h₂⟩ + · exact ⟨h₁, Or.inl h₂⟩ + · exact ⟨h₁, Or.inr (Or.inr h₂)⟩ + refine ⟨f, ?_⟩ + refine + { f_mem := h.dom_eq ▸ hf + v_notMem := fun h₁ ↦ h₁.elim hx₀ hxT + roots_eq := rfl + edgeSet_eq := rfl + vertexSet_eq := ?_ + ends_f := ?_ + ends_ne := fun e _ he ↦ hends e he + dom_eq := rfl + μ_ne := fun e he hne ↦ ?_ + Δ_ne := fun e he hne ↦ ?_ } + · change Q₀.G.vertexSet ∪ insert x T = (Q₀.G.vertexSet ∪ T) ∪ {x} + ext y + simp only [mem_union, mem_insert_iff, mem_singleton_iff] + tauto + · change Q'.G.ends f ∩ (Q₀.G.vertexSet ∪ insert x T) = + (Q'.G.ends f ∩ (Q₀.G.vertexSet ∪ T)) ∪ {x} + ext y + constructor + · rintro ⟨h₁, h₂ | rfl | h₂⟩ + · exact Or.inl ⟨h₁, Or.inl h₂⟩ + · exact Or.inr rfl + · exact Or.inl ⟨h₁, Or.inr h₂⟩ + · rintro (⟨h₁, h₂ | h₂⟩ | rfl) + · exact ⟨h₁, Or.inl h₂⟩ + · exact ⟨h₁, Or.inr (Or.inr h₂)⟩ + · exact ⟨hinc, Or.inr (Or.inl rfl)⟩ + · simp only [chainStage, hends e hne] + split_ifs + · rfl + · classical + apply List.filter_congr + intro y hy + have hend : y ∈ {y | y ∈ Q'.μ e} := hy + rw [Q'.μ_set e he] at hend + have hyx : y ≠ x := fun heq ↦ hne (hone e (heq ▸ hend)) + simp [hyx] + · simp only [chainStage, hends e hne] + +include h in +theorem chainStage_empty : IsCompletionOf Q₀ (chainStage h ∅ (empty_subset _)) := by + classical + have hends : ∀ e, Q'.G.ends e ∩ (Q₀.G.vertexSet ∪ ∅) = Q₀.G.ends e := by + intro e + ext v + constructor + · rintro ⟨h₁, h₂⟩ + exact (h.inc_iff e v (by simpa using h₂)).mpr h₁ + · intro h₁ + have hv : v ∈ Q₀.G.vertexSet := Q₀.G.vertex_mem_of_inc h₁ + exact ⟨(h.inc_iff e v hv).mp h₁, Or.inl hv⟩ + refine ⟨?_, h.dom_eq, fun e _ ↦ ?_, fun e _ ↦ ?_⟩ + · refine RootedHypergraph.ext_of (Set.union_empty _) h.edgeSet_eq ?_ h.roots_eq + funext e v + exact propext (Set.ext_iff.mp (hends e) v) + · simp only [chainStage, hends, ↓reduceIte] + · simp only [chainStage, hends, ↓reduceIte] + +include h in +theorem chainStage_top : IsCompletionOf Q' (chainStage h X subset_rfl) := by + classical + have hends : ∀ e, Q'.G.ends e ∩ (Q₀.G.vertexSet ∪ X) = Q'.G.ends e := by + intro e + rw [← h.vertexSet_eq] + exact inter_eq_left.mpr fun v hv ↦ Q'.G.vertex_mem_of_inc hv + refine ⟨?_, rfl, fun e he ↦ ?_, fun e he ↦ ?_⟩ + · refine RootedHypergraph.ext_of h.vertexSet_eq.symm rfl ?_ rfl + funext e v + exact propext (Set.ext_iff.mp (hends e) v) + · simp only [chainStage, hends] + split_ifs with h₁ + · exact (h.same_of_ends e (Q'.dom_subset he |> fun h₂ ↦ h.edgeSet_eq ▸ h₂) h₁ + (h.dom_eq ▸ he)).symm + · refine marchSlash_of_disjoint fun x hx hxc ↦ hxc ?_ + have h₂ : x ∈ {y | y ∈ Q'.μ e} := hx + rw [Q'.μ_set e he] at h₂ + rw [← h.vertexSet_eq] + exact Q'.G.vertex_mem_of_inc h₂ + · simp only [chainStage, hends, ↓reduceIte] + split_ifs with h₁ + · exact (h.sameΔ_of_ends e (h.edgeSet_eq ▸ he) h₁).symm + · rfl + +end Chain + +theorem chain_snoc {s : ℕ → UnlabeledPatchwork α β} {n : ℕ} + {A : UnlabeledPatchwork α β} (hs : s n = A) (hc : ∀ i < n, ∃ f v, + IsOneVertexExtension (s i) (s (i + 1)) f v) {B : UnlabeledPatchwork α β} + (hAB : ∃ f v, IsOneVertexExtension A B f v) : + ∃ s' : ℕ → UnlabeledPatchwork α β, s' 0 = s 0 ∧ s' (n + 1) = B ∧ ∀ i < n + 1, ∃ f v, + IsOneVertexExtension (s' i) (s' (i + 1)) f v := by + classical + refine ⟨fun i ↦ if i ≤ n then s i else B, by simp, by simp, fun i hi ↦ ?_⟩ + by_cases hin : i < n + · have h₁ : i ≤ n := hin.le + have h₂ : i + 1 ≤ n := hin + simp only [h₁, h₂, ↓reduceIte] + exact hc i hin + · have hie : i = n := by omega + subst hie + simp only [le_refl, ↓reduceIte, add_le_iff_nonpos_right, nonpos_iff_eq_zero, one_ne_zero] + rw [hs] + exact hAB + +/-- `Q'` is reached from `Q₀` by at most `k` extensions. -/ +theorem mem_chain {𝓕 : Set (UnlabeledPatchwork α β)} {Q₀ Q' : UnlabeledPatchwork α β} {X : Set α} + (hQ₀ : Q₀ ∈ completions Unit 𝓕) (h : ChainData Q₀ Q' X) (hX : X.Finite) {k : ℕ} + (hk : X.ncard ≤ k) : Q' ∈ chainSet 𝓕 k := by + have key : ∀ T : Set α, T.Finite → ∀ hT : T ⊆ X, ∃ s : ℕ → UnlabeledPatchwork α β, + s 0 = chainStage h ∅ (empty_subset _) ∧ s T.ncard = chainStage h T hT ∧ + ∀ i < T.ncard, ∃ f v, IsOneVertexExtension (s i) (s (i + 1)) f v := by + intro T hfin + induction T, hfin using Set.Finite.induction_on with + | empty => + intro hT + exact ⟨fun _ ↦ chainStage h ∅ (empty_subset _), rfl, by simp, by simp⟩ + | @insert x T hxT hfin ih => + intro hT + have hT₀ : T ⊆ X := (subset_insert x T).trans hT + obtain ⟨s, h₀, h₁, h₂⟩ := ih hT₀ + obtain ⟨f, hf⟩ := chainStage_extension h hT₀ (hT (mem_insert x T)) hxT hT + obtain ⟨s', h₀', h₁', h₂'⟩ := chain_snoc h₁ h₂ ⟨f, x, hf⟩ + rw [Set.ncard_insert_of_notMem hxT hfin] + exact ⟨s', h₀'.trans h₀, h₁', h₂'⟩ + obtain ⟨s, h₀, h₁, h₂⟩ := key X hX subset_rfl + obtain ⟨P₀, hP₀, hc₀⟩ := hQ₀ + refine ⟨chainStage h X subset_rfl, ⟨s, X.ncard, hk, ⟨P₀, hP₀, ?_⟩, h₁, h₂⟩, + (chainStage_top h).symm⟩ + rw [h₀] + exact hc₀.trans (chainStage_empty h) + +/-! ### Hearts of fine locations -/ + +section Heart + +variable {P : UnlabeledPatchwork α β} {ℒ : Set (RootedHypergraph α β)} + +theorem core_edgeSet_eq_empty (hfine : IsFine P.G ℒ) : + (rootedLocationCore P.G ℒ).edgeSet = ∅ := by + apply Set.eq_empty_of_forall_notMem + intro e he + obtain ⟨he₁, he₂⟩ := mem_core_edgeSet.mp he + obtain ⟨A, hA, heA⟩ := hfine.2 e he₁ + exact he₂ A hA heA + +/-- A vertex is in `V(M(G, ℒ))` if and only if it is a root of each member of `ℒ` that contains it. +-/ +theorem mem_core_iff {G : RootedHypergraph α β} {v : α} : + v ∈ (rootedLocationCore G ℒ).vertexSet ↔ v ∈ G.vertexSet ∧ + ∀ A ∈ ℒ, v ∈ A.vertexSet → v ∈ A.rootSet := by + rw [mem_core_vertexSet] + refine and_congr_right fun hv ↦ forall₂_congr fun A hA ↦ ?_ + constructor + · rintro (h | h) hvA + · exact absurd hvA h.2 + · exact h.2 + · intro h + by_cases hvA : v ∈ A.vertexSet + · exact Or.inr ⟨hv, h hvA⟩ + · exact Or.inl ⟨hv, hvA⟩ + +/-- Roots of a member of a rooted location are in `V(M(G, ℒ))`. -/ +theorem root_mem_core {G : RootedHypergraph α β} (hℒ : IsRootedLocation G ℒ) {A} (hA : A ∈ ℒ) + {v : α} (hv : v ∈ A.rootSet) : v ∈ (rootedLocationCore G ℒ).vertexSet := by + have hvV : v ∈ A.vertexSet := A.roots_subset v hv + refine mem_core_iff.mpr ⟨(hℒ.isComplemented hA).le.vertexSet_subset hvV, fun B hB hvB ↦ ?_⟩ + by_cases hAB : A = B + · exact hAB ▸ hv + · have hle := hℒ.le_complement hA hB hAB + rcases hle.vertexSet_subset hvV with h | h + · exact absurd hvB h.2 + · exact h + +/-- A fine rooted location has a heart, for any injective choice of new edges. -/ +theorem exists_heart (hℒ : IsRootedLocation P.G ℒ) (hfine : IsFine P.G ℒ) (hfin : ℒ.Finite) + {e : RootedHypergraph α β → β} (he : InjOn e ℒ) : + ∃ Q, IsPatchworkHeart P ℒ e Q := by + classical + have : Nonempty (RootedHypergraph α β) := ⟨P.G⟩ + have hinv : ∀ {A}, A ∈ ℒ → Function.invFunOn e ℒ (e A) = A := fun hA ↦ + he (Function.invFunOn_mem ⟨_, hA, rfl⟩) hA (Function.invFunOn_eq ⟨_, hA, rfl⟩) + have hemp := core_edgeSet_eq_empty hfine + let G : RootedHypergraph α β := + { vertexSet := (rootedLocationCore P.G ℒ).vertexSet + edgeSet := e '' ℒ + Inc := fun f v ↦ ∃ A ∈ ℒ, e A = f ∧ v ∈ A.rootSet + vertex_mem_of_inc := fun _ _ ⟨_, hA, _, hv⟩ ↦ root_mem_core hℒ hA hv + edge_mem_of_inc := fun _ _ ⟨A, hA, h₁, _⟩ ↦ ⟨A, hA, h₁⟩ + vertexSet_finite := (rootedLocationCore P.G ℒ).vertexSet_finite + edgeSet_finite := hfin.image e + roots := P.G.roots + roots_nodup := P.G.roots_nodup + roots_subset := fun v hv ↦ mem_core_iff.mpr ⟨P.G.roots_subset v hv, + fun A hA hvA ↦ (hℒ.isComplemented hA).roots_mem hvA hv⟩ } + have hends : ∀ {A}, A ∈ ℒ → G.ends (e A) = A.rootSet := fun {A} hA ↦ by + ext v + constructor + · rintro ⟨B, hB, h₁, h₂⟩ + exact (he hB hA h₁) ▸ h₂ + · exact fun h ↦ ⟨A, hA, rfl, h⟩ + let Q : UnlabeledPatchwork α β := + { G := G + dom := e '' ℒ + μ := fun f ↦ (Function.invFunOn e ℒ f).roots + Δ := fun f ↦ feasibleGroupings (P.restrict (Function.invFunOn e ℒ f)) + φ := fun _ ↦ () + dom_subset := subset_rfl + μ_nodup := fun _ _ ↦ RootedHypergraph.roots_nodup _ + μ_set := by + rintro _ ⟨A, hA, rfl⟩ + rw [hinv hA, hends hA] + rfl + Δ_verts := by + rintro _ ⟨A, hA, rfl⟩ + rw [hinv hA, hends hA] + rfl + Δ_free := fun f hf hf' ↦ absurd hf hf' } + refine ⟨Q, ?_⟩ + refine + { isRootedLocation := hℒ + injOn_newEdge := he + newEdge_notMem_core := fun A _ h ↦ by rw [hemp] at h; exact h + vertexSet_eq := rfl + edgeSet_eq := by rw [hemp, Set.empty_union] + roots_eq := rfl + ends_core := fun f hf ↦ by rw [hemp] at hf; exact hf.elim + ends_newEdge := fun A hA ↦ hends hA + dom_eq := by rw [hemp, Set.empty_inter, Set.empty_union] + μ_core := fun f hf ↦ by rw [hemp] at hf; exact hf.1.elim + μ_newEdge := fun A hA ↦ by + change (Function.invFunOn e ℒ (e A)).roots = _ + rw [hinv hA] + Δ_core := fun f hf ↦ by rw [hemp] at hf; exact hf.elim + Δ_newEdge := fun A hA ↦ by + change feasibleGroupings (P.restrict (Function.invFunOn e ℒ (e A))) = _ + rw [hinv hA] } + +end Heart + +/-! ### Making vertices roots -/ + +/-- The rooted hypergraph `C` with the terms of `l` in `V(C)` made roots. -/ +noncomputable def addRoots {l : List α} (hl : l.Nodup) (C : RootedHypergraph α β) : + RootedHypergraph α β := + C.reroot (C.roots ++ marchSlash l (C.vertexSetᶜ ∪ C.rootSet)) + (List.Nodup.append C.roots_nodup (nodup_marchSlash hl _) + fun _ hx hx' ↦ (mem_marchSlash.mp hx').2 (Or.inr hx)) + fun x hx ↦ (List.mem_append.mp hx).elim (C.roots_subset x) fun h ↦ by + have h₂ := (mem_marchSlash.mp h).2 + by_contra hn + exact h₂ (Or.inl hn) + +section AddRoots + +variable {l : List α} (hl : l.Nodup) (C : RootedHypergraph α β) + +theorem addRoots_toHypergraph : (addRoots hl C).toHypergraph = C.toHypergraph := rfl + +theorem mem_addRoots_rootSet {x : α} : + x ∈ (addRoots hl C).rootSet ↔ x ∈ C.rootSet ∨ (x ∈ l ∧ x ∈ C.vertexSet) := by + change x ∈ C.roots ++ marchSlash l (C.vertexSetᶜ ∪ C.rootSet) ↔ _ + rw [List.mem_append, mem_marchSlash] + constructor + · rintro (h | ⟨h₁, h₂⟩) + · exact Or.inl h + · refine Or.inr ⟨h₁, ?_⟩ + by_contra hn + exact h₂ (Or.inl hn) + · rintro (h | ⟨h₁, h₂⟩) + · exact Or.inl h + · by_cases hr : x ∈ C.rootSet + · exact Or.inl hr + · exact Or.inr ⟨h₁, fun h ↦ h.elim (fun h₃ ↦ h₃ h₂) hr⟩ + +theorem addRoots_eq (h : ∀ x ∈ l, x ∈ C.vertexSet → x ∈ C.rootSet) : addRoots hl C = C := by + refine RootedHypergraph.ext_of rfl rfl rfl ?_ + change C.roots ++ marchSlash l (C.vertexSetᶜ ∪ C.rootSet) = C.roots + have : marchSlash l (C.vertexSetᶜ ∪ C.rootSet) = [] := by + apply List.eq_nil_iff_forall_not_mem.mpr + intro x hx + obtain ⟨h₁, h₂⟩ := mem_marchSlash.mp hx + by_cases hv : x ∈ C.vertexSet + · exact h₂ (Or.inr (h x h₁ hv)) + · exact h₂ (Or.inl hv) + rw [this, List.append_nil] + +variable {G : RootedHypergraph α β} + +theorem isComplemented_addRoots (h : IsComplemented G C) : IsComplemented G (addRoots hl C) where + le := h.le + roots_mem _ hv hr := (mem_addRoots_rootSet hl C).mpr (Or.inl (h.roots_mem hv hr)) + inc_diff_mem _ _ hv he hinc := (mem_addRoots_rootSet hl C).mpr (Or.inl + (h.inc_diff_mem hv he hinc)) + +theorem complementHypergraph_mono {A B : RootedHypergraph α β} (hB : IsComplemented G B) + (h : A.toHypergraph ≤ (complement G B hB).toHypergraph) : + A.toHypergraph ≤ (complement G (addRoots hl B) (isComplemented_addRoots hl B hB)).toHypergraph + := by + refine ⟨fun v hv ↦ ?_, h.edgeSet_subset, fun e he ↦ h.ends_eq e he⟩ + rcases h.vertexSet_subset hv with h₁ | h₁ + · exact Or.inl h₁ + · exact Or.inr ((mem_addRoots_rootSet hl B).mpr (Or.inl h₁)) + +end AddRoots + +variable {ℒ : Set (RootedHypergraph α β)} {G : RootedHypergraph α β} + +/-- `f` is injective on a rooted location: two members with the same hypergraph have all vertices as +roots, and so `addRoots` does nothing to them. -/ +theorem injOn_addRoots {l : List α} (hl : l.Nodup) (hℒ : IsRootedLocation G ℒ) : + InjOn (addRoots hl) ℒ := by + intro A hA B hB heq + by_contra hne + have hH : A.toHypergraph = B.toHypergraph := congrArg (·.toHypergraph) heq + have hroot : ∀ {A B : RootedHypergraph α β}, A ∈ ℒ → B ∈ ℒ → A ≠ B → + A.toHypergraph = B.toHypergraph → ∀ x ∈ B.vertexSet, x ∈ B.rootSet := by + intro A B hA hB hne hH x hx + have hxA : x ∈ A.vertexSet := by rw [hH]; exact hx + rcases (hℒ.le_complement hA hB hne).vertexSet_subset hxA with h | h + · exact absurd hx h.2 + · exact h + have h₁ := addRoots_eq hl A fun x _ hx ↦ hroot hB hA (Ne.symm hne) hH.symm x hx + have h₂ := addRoots_eq hl B fun x _ hx ↦ hroot hA hB hne hH x hx + exact hne (by rw [← h₁, ← h₂]; exact heq) + +/-- Making vertices roots keeps a rooted location. -/ +theorem isRootedLocation_addRoots {l : List α} (hl : l.Nodup) (hℒ : IsRootedLocation G ℒ) : + IsRootedLocation G (addRoots hl '' ℒ) where + isComplemented := by + rintro _ ⟨C, hC, rfl⟩ + exact isComplemented_addRoots hl C (hℒ.isComplemented hC) + le_complement := by + rintro _ ⟨A, hA, rfl⟩ _ ⟨B, hB, rfl⟩ hne + have hne' : A ≠ B := fun h ↦ hne (by rw [h]) + exact complementHypergraph_mono hl (hℒ.isComplemented hB) (hℒ.le_complement hA hB hne') + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section5c.lean b/LeanPool/GraphMinor/GM20/Section5c.lean new file mode 100644 index 0000000000..a9341c4a96 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section5c.lean @@ -0,0 +1,162 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section5b + +/-! +# Tools for tangles and rooted locations + +The proofs of (5.3)–(5.5) of Graph Minors XX use a few plain facts about the separation +`(A⁻, (G \ A)⁻)` of a complemented `A`, and about `ℳ(𝒯, W, θ)`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +theorem complement_toHypergraph {G A : RootedHypergraph α β} (hA : IsComplemented G A) : + (complement G A hA).toHypergraph = complementHypergraph G A := by + have hsub : ∀ {v}, v ∈ A.rootSet → v ∈ G.vertexSet := fun hv ↦ + hA.le.vertexSet_subset (A.roots_subset _ hv) + have hV : (G.vertexSet \ A.vertexSet) ∪ (G.vertexSet ∩ A.rootSet) = + (G.vertexSet \ A.vertexSet) ∪ A.rootSet := by + ext v + exact or_congr_right ⟨fun h ↦ h.2, fun h ↦ ⟨hsub h, h⟩⟩ + apply Hypergraph.ext + · exact hV.symm + · rfl + · funext e v + apply propext + constructor + · intro h + refine ⟨h.1, h.2, ?_⟩ + rw [hV] + exact (complement G A hA).vertex_mem_of_inc h + · exact fun h ↦ ⟨h.1, h.2.1⟩ + +theorem complementHypergraph_le {G A : RootedHypergraph α β} (hA : IsComplemented G A) : + complementHypergraph G A ≤ G.toHypergraph := by + refine ⟨?_, fun _ h ↦ h.1, fun e he ↦ ?_⟩ + · rintro v (h | h) + · exact h.1 + · exact h.1 + · ext v + constructor + · intro hinc + have hG : G.Inc e v := hinc + refine ⟨he, hG, ?_⟩ + by_cases hvA : v ∈ A.vertexSet + · exact Or.inr ⟨G.vertex_mem_of_inc hG, hA.inc_diff_mem hvA he hG⟩ + · exact Or.inl ⟨G.vertex_mem_of_inc hG, hvA⟩ + · exact fun h ↦ h.2.1 + +/-- `(A⁻, (G \ A)⁻)` is a separation of `G⁻`. -/ +theorem isSeparation_complement {G A : RootedHypergraph α β} (hA : IsComplemented G A) : + G.toHypergraph.IsSeparation A.toHypergraph (complementHypergraph G A) := by + rw [isSeparation_iff_of_le hA.le (complementHypergraph_le hA)] + refine ⟨?_, ?_, ?_⟩ + · ext v + constructor + · rintro (h | h | h) + · exact hA.le.vertexSet_subset h + · exact h.1 + · exact h.1 + · intro h + by_cases hvA : v ∈ A.vertexSet + · exact Or.inl hvA + · exact Or.inr (Or.inl ⟨h, hvA⟩) + · ext e + constructor + · rintro (h | h) + · exact hA.le.edgeSet_subset h + · exact h.1 + · intro h + by_cases heA : e ∈ A.edgeSet + · exact Or.inl heA + · exact Or.inr ⟨h, heA⟩ + · ext e + simp only [mem_inter_iff, mem_empty_iff_false, iff_false, not_and] + exact fun h₁ h₂ ↦ h₂.2 h₁ + +/-- The order of `(A⁻, (G \ A)⁻)` is at most `|πBar(A)|`. -/ +theorem separationOrder_complement_le {G A : RootedHypergraph α β} : + separationOrder A.toHypergraph (complementHypergraph G A) ≤ A.rootSet.ncard := by + refine Set.ncard_le_ncard ?_ (List.finite_toSet _) + rintro v ⟨h₁, h₂ | h₂⟩ + · exact absurd h₁ h₂.2 + · exact h₂.2 + +theorem order_le_of_lam_le {Λ : Type*} [LinearOrder Λ] {G : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → Λ} (hTB : IsTieBreaker G lam) + {A B C D : Hypergraph α β} (h₁ : G.IsSeparation A B) (h₂ : G.IsSeparation C D) + (h : lam (A, B) ≤ lam (C, D)) : separationOrder A B ≤ separationOrder C D := by + by_contra hlt + push Not at hlt + exact absurd h (not_le.mpr (hTB.axiom3 h₂ h₁ hlt)) + +/-- There are finitely many subhypergraphs of `G`. -/ +theorem finite_le (G : Hypergraph α β) : {H | H ≤ G}.Finite := by + have hfin : ((G.vertexSet.powerset ×ˢ G.edgeSet.powerset : + Set (Set α × Set β))).Finite := + G.vertexSet_finite.finite_subsets.prod G.edgeSet_finite.finite_subsets + refine Set.Finite.of_finite_image (f := fun H ↦ (H.vertexSet, H.edgeSet)) (hfin.subset ?_) ?_ + · rintro _ ⟨H, hH, rfl⟩ + exact ⟨hH.vertexSet_subset, hH.edgeSet_subset⟩ + · intro H₁ h₁ H₂ h₂ heq + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq h₁ h₂ (congrArg Prod.fst heq) + (congrArg Prod.snd heq) + +variable {Λ : Type*} [LinearOrder Λ] {lam : Hypergraph α β × Hypergraph α β → Λ} + {G : Hypergraph α β} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {W : Set (α ⊕ β)} {θ θ₀ : ℕ} + +theorem finite_inM (h𝒯 : IsTangle G θ₀ 𝒯) : + {p : Hypergraph α β × Hypergraph α β | InM lam G 𝒯 W θ p.1 p.2}.Finite := by + refine ((finite_le G).prod (finite_le G)).subset ?_ + intro p hp + have hsep : G.IsSeparation p.1 p.2 := h𝒯.isSeparation hp.1.1 + exact ⟨hsep.left_le, hsep.right_le⟩ + +/-- Every `(A, B)` satisfying the first two conditions of `ℳ(𝒯, W, θ)` lies below a member of +`ℳ(𝒯, W, θ)`, since there are finitely many separations of `G`. -/ +theorem exists_inM_above (h𝒯 : IsTangle G θ₀ 𝒯) {A B : Hypergraph α β} + (h : InMPre lam G 𝒯 W θ A B) : ∃ A' B', InM lam G 𝒯 W θ A' B' ∧ A ≤ A' ∧ B' ≤ B := by + classical + let S : Set (Hypergraph α β × (Hypergraph α β)ᵒᵈ) := + {p | InMPre lam G 𝒯 W θ p.1 (OrderDual.ofDual p.2)} + have hfin : S.Finite := by + refine (((finite_le G).prod (finite_le G)).image + (fun p ↦ (p.1, OrderDual.toDual p.2))).subset ?_ + intro p hp + have hsep : G.IsSeparation p.1 (OrderDual.ofDual p.2) := h𝒯.isSeparation hp.1 + exact ⟨(p.1, OrderDual.ofDual p.2), ⟨hsep.left_le, hsep.right_le⟩, rfl⟩ + obtain ⟨m, hle, hmax⟩ := hfin.exists_le_maximal (a := (A, OrderDual.toDual B)) h + refine ⟨m.1, OrderDual.ofDual m.2, ⟨hmax.prop, ?_⟩, hle.1, hle.2⟩ + rintro A' B' hpre hne ⟨h₁, h₂⟩ + have hm : (A', OrderDual.toDual B') ∈ S := hpre + have hlem : m ≤ (A', OrderDual.toDual B') := ⟨h₁, h₂⟩ + have hge := hmax.le_of_ge hm hlem + exact hne (Prod.ext (le_antisymm hge.1 h₁) (le_antisymm h₂ hge.2)) + +/-- If `(C, D)` has `D ⊆ B'` and `(B', A')` is in a tangle of order `> ` the order of `(C, D)`, then +`(D, C)` is in the tangle. -/ +theorem mem_tangle_of_le {θ' : ℕ} {𝒯' : Set (Hypergraph α β × Hypergraph α β)} + (h𝒯' : IsTangle G θ' 𝒯') {A' B' C D : Hypergraph α β} (hsep : G.IsSeparation C D) + (hlt : separationOrder C D < θ') (hmem : (B', A') ∈ 𝒯') (hle : D ≤ B') : (D, C) ∈ 𝒯' := by + rcases h𝒯'.axiom1 hsep hlt with h | h + · exact (not_le_of_mem_tangle h𝒯' hmem h hle).elim + · exact h + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section5d.lean b/LeanPool/GraphMinor/GM20/Section5d.lean new file mode 100644 index 0000000000..1d1ae4fef2 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section5d.lean @@ -0,0 +1,491 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section5c + +/-! +# Graph Minors XX, Section 5, (5.3) + +We start with a fine rooted location which `θ`-isolates `𝒯` modulo `W`, and we want one which is +`W'`-suitable, for some `W' ⊆ W`. We take `W'` minimal, and we make each vertex of the separators of +`ℳ(𝒯, W', θ)` into a root. There are at most `θ (θ - 1)` such vertices, so the new heart is reached +from the old one by few 1-vertex extensions, and (4.8) applies. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v w + +variable {α : Type u} {β : Type v} + +section Addroots + +variable {G : RootedHypergraph α β} {C : RootedHypergraph α β} {l : List α} (hl : l.Nodup) + +theorem complementHypergraph_le_addRoots (hC : IsComplemented G C) : + complementHypergraph G C ≤ complementHypergraph G (addRoots hl C) := by + rw [le_iff_of_le (complementHypergraph_le hC) + (complementHypergraph_le (isComplemented_addRoots hl C hC))] + refine ⟨?_, subset_rfl⟩ + rintro v (h | h) + · exact Or.inl h + · exact Or.inr ⟨h.1, (mem_addRoots_rootSet hl C).mpr (Or.inl h.2)⟩ + +theorem mem_of_mem_complement_addRoots {v : α} + (h : v ∈ (complementHypergraph G (addRoots hl C)).vertexSet) : + v ∈ (complementHypergraph G C).vertexSet ∨ (v ∈ l ∧ v ∈ C.vertexSet ∧ v ∉ C.rootSet) := by + rcases h with h | ⟨h₁, h₂⟩ + · exact Or.inl (Or.inl h) + · rcases (mem_addRoots_rootSet hl C).mp h₂ with h₃ | ⟨h₃, h₄⟩ + · exact Or.inl (Or.inr ⟨h₁, h₃⟩) + · by_cases hr : v ∈ C.rootSet + · exact Or.inl (Or.inr ⟨h₁, hr⟩) + · exact Or.inr ⟨h₃, h₄, hr⟩ + +end Addroots + +section Tangle + +variable {Λ : Type*} [LinearOrder Λ] {lam : Hypergraph α β × Hypergraph α β → Λ} + {G : RootedHypergraph α β} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {W : Set + (α ⊕ β)} {θ θ₀ : ℕ} + {ℒ : Set (RootedHypergraph α β)} + +/-- The order of a distinction is at most the order of any separation which distinguishes. -/ +theorem order_le_of_distinction {θ₁ θ₂ : ℕ} {𝒯' : Set (Hypergraph α β × Hypergraph α β)} + (hTB : IsTieBreaker G.toHypergraph lam) (h𝒯 : IsTangle G.toHypergraph θ₁ 𝒯) + (_h𝒯' : IsTangle G.toHypergraph θ₂ 𝒯') {A B C D : Hypergraph α β} + (hd : IsDistinction lam 𝒯 𝒯' A B) (hC : (C, D) ∈ 𝒯) (hD : (D, C) ∈ 𝒯') : + separationOrder A B ≤ separationOrder C D := + order_le_of_lam_le hTB (h𝒯.isSeparation hd.1.1) (h𝒯.isSeparation hC) (hd.2 ⟨hC, hD⟩) + +/-- Subproof (1) of (5.3): if `W'` is minimal such that `ℒ` `θ`-isolates `𝒯` modulo `W'`, then for +each `(A, B) ∈ ℳ(𝒯, W', θ)` there is no `(C, D) ∈ ℒ⁻` with `A ⊆ C` and `D ⊆ B`. -/ +theorem no_location_above (hTB : IsTieBreaker G.toHypergraph lam) + (h𝒯 : IsTangle G.toHypergraph θ₀ 𝒯) (hW : W ⊆ zSet G.toHypergraph) + (hiso : IsolatesModulo lam 𝒯 W θ G ℒ) + (hmin : ∀ z ∈ W, ¬ IsolatesModulo lam 𝒯 (W \ {z}) θ G ℒ) + {A B : Hypergraph α β} (hM : InM lam G.toHypergraph 𝒯 W θ A B) + {C₀ : RootedHypergraph α β} (hC₀ : C₀ ∈ ℒ) + (hAC : A ≤ C₀.toHypergraph) (hDB : complementHypergraph G C₀ ≤ B) : False := by + obtain ⟨z, hzW, hzB⟩ := not_subset.mp hM.1.2.2.1 + have hnot : ¬ ∀ ⦃A : RootedHypergraph α β⦄, A ∈ ℒ → ∀ ⦃θ' : ℕ⦄ + ⦃𝒯' : Set (Hypergraph α β × Hypergraph α β)⦄, IsTangle G.toHypergraph θ' 𝒯' → θ ≤ θ' → + (complementHypergraph G A, A.toHypergraph) ∈ 𝒯' → ∀ ⦃C D⦄, IsDistinction lam 𝒯 𝒯' C D → + (C ≤ A.toHypergraph ∧ complementHypergraph G A ≤ D) ∨ ¬ (W \ {z}) ⊆ zSet D := fun h ↦ + hmin z hzW ⟨hiso.isRootedLocation, hiso.order_lt, hiso.subset, h⟩ + push Not at hnot + obtain ⟨C', hC', θ'', 𝒯'', h𝒯'', hθ'', hmem, A', B', hd, hne, hsub⟩ := hnot + -- `(A', B')` misses `z`, since `ℒ` does `θ`-isolate `𝒯` modulo `W`. + have hzB' : z ∉ zSet B' := by + intro hz + rcases hiso.distinction hC' h𝒯'' hθ'' hmem hd with h | h + · exact hne h.1 h.2 + · refine h fun y hy ↦ ?_ + by_cases hyz : y = z + · exact hyz ▸ hz + · exact hsub ⟨hy, hyz⟩ + have hloc := hiso.isRootedLocation + have hsep₁ := isSeparation_complement (hloc.isComplemented hC₀) + have hsep₂ := isSeparation_complement (hloc.isComplemented hC') + have hmemC : (C₀.toHypergraph, complementHypergraph G C₀) ∈ 𝒯 := + hiso.subset ⟨C₀, hC₀, rfl⟩ + have hmemC' : (C'.toHypergraph, complementHypergraph G C') ∈ 𝒯 := + hiso.subset ⟨C', hC', rfl⟩ + have hordC : ∀ {X}, X ∈ ℒ → + separationOrder X.toHypergraph (complementHypergraph G X) < θ := fun hX ↦ + separationOrder_complement_le.trans_lt (hiso.order_lt hX) + have hlt' : separationOrder A' B' < θ := + (order_le_of_distinction hTB h𝒯 h𝒯'' hd hmemC' hmem).trans_lt (hordC hC') + obtain ⟨hA'B', hB'A'⟩ := hd.1 + have hzG : z ∈ zSet G.toHypergraph := hW hzW + have hle : A' ≤ A ∧ B ≤ B' := by + rcases theorem_5_1_proof hTB h𝒯 h𝒯'' hM hd with h | ⟨-, h⟩ | h + · exact h + · -- Here `A ⊆ B'`, and then `A ∪ B = G` puts `z` in `Z(B)` or in `Z(B')`. + have hsep : G.toHypergraph.IsSeparation A B := h𝒯.isSeparation hM.1.1 + rcases mem_zSet_of_separation hsep hzG with h₁ | h₁ + · exact absurd (zSet_mono h h₁) hzB' + · exact absurd h₁ hzB + · -- Here the third condition of `ℳ(𝒯, W, θ)` gives `(A', B') = (A, B)`. + by_cases heq : (A', B') = (A, B) + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj heq + exact ⟨le_rfl, le_rfl⟩ + · have hpre : InMPre lam G.toHypergraph 𝒯 W θ A' B' := + ⟨hA'B', hlt', fun h' ↦ hzB' (h' hzW), θ'', 𝒯'', h𝒯'', hd⟩ + exact absurd h (hM.2 hpre heq) + have hA'C : A' ≤ C₀.toHypergraph := hle.1.trans hAC + have hDB' : complementHypergraph G C₀ ≤ B' := hDB.trans hle.2 + have hneC : C' ≠ C₀ := by + rintro rfl + exact hne hA'C hDB' + have hDC : (complementHypergraph G C₀, C₀.toHypergraph) ∈ 𝒯'' := + mem_tangle_of_le h𝒯'' hsep₁ ((hordC hC₀).trans_le hθ'') hB'A' hDB' + have hle' := hloc.le_complement hC' hC₀ hneC + rw [complement_toHypergraph] at hle' + exact not_le_of_mem_tangle h𝒯'' hDC hmem hle' + +/-- The set `X` of the proof of (5.3): the union of the separators of `ℳ(𝒯, W, θ)`. -/ +def separatorSet (lam : Hypergraph α β × Hypergraph α β → Λ) (G : Hypergraph α β) + (𝒯 : Set (Hypergraph α β × Hypergraph α β)) (W : Set (α ⊕ β)) (θ : ℕ) : Set α := + ⋃ p ∈ {p : Hypergraph α β × Hypergraph α β | InM lam G 𝒯 W θ p.1 p.2}, (p.1 ∩ p.2).vertexSet + +theorem finite_zSet (G : Hypergraph α β) : (zSet G).Finite := + (G.vertexSet_finite.image _).union (G.edgeSet_finite.image _) + +/-- `X` has at most `|W| (θ - 1)` members, by (5.2). -/ +theorem separatorSet_finite_ncard {G : Hypergraph α β} (hTB : IsTieBreaker G lam) + (h𝒯 : IsTangle G θ₀ 𝒯) (hW : W ⊆ zSet G) : + (separatorSet lam G 𝒯 W θ).Finite ∧ + (separatorSet lam G 𝒯 W θ).ncard ≤ W.ncard * (θ - 1) := by + classical + have hfin := finite_inM (lam := lam) (W := W) (θ := θ) h𝒯 + have hsep : ∀ p ∈ hfin.toFinset, ((p.1 ∩ p.2).vertexSet).Finite := fun p _ ↦ + (p.1 ∩ p.2).vertexSet_finite + let F : Finset α := hfin.toFinset.biUnion fun p ↦ (p.1 ∩ p.2).vertexSet_finite.toFinset + have hF : (F : Set α) = separatorSet lam G 𝒯 W θ := by + ext v + simp [F, separatorSet] + rw [← hF] + refine ⟨F.finite_toSet, ?_⟩ + rw [Set.ncard_coe_finset] + calc F.card ≤ hfin.toFinset.card * (θ - 1) := by + refine Finset.card_biUnion_le_card_mul _ _ _ fun p hp ↦ ?_ + have hp' : InM lam G 𝒯 W θ p.1 p.2 := hfin.mem_toFinset.mp hp + have hlt : separationOrder p.1 p.2 < θ := hp'.1.2.1 + have : ((p.1 ∩ p.2).vertexSet_finite.toFinset).card = separationOrder p.1 p.2 := by + rw [separationOrder, Set.ncard_eq_toFinset_card _ (p.1 ∩ p.2).vertexSet_finite] + omega + _ ≤ W.ncard * (θ - 1) := by + refine Nat.mul_le_mul_right _ ?_ + rw [← Set.ncard_eq_toFinset_card _ hfin] + exact theorem_5_2_card hTB h𝒯 ((finite_zSet G).subset hW) hW + +end Tangle + +section Heart + +variable {P : UnlabeledPatchwork α β} {ℒ : Set (RootedHypergraph α β)} + {Q : UnlabeledPatchwork α β} {e : RootedHypergraph α β → β} + +theorem _root_.GraphMinor.GM18.IsPatchworkHeart.edgeSet_eq_image (h : IsPatchworkHeart P ℒ e Q) + (hfine : IsFine P.G ℒ) : + Q.G.edgeSet = e '' ℒ := by + rw [h.edgeSet_eq, core_edgeSet_eq_empty hfine, Set.empty_union] + +theorem _root_.GraphMinor.GM18.IsPatchworkHeart.dom_eq_image (h : IsPatchworkHeart P ℒ e Q) + (hfine : IsFine P.G ℒ) : + Q.dom = e '' ℒ := by + rw [h.dom_eq, core_edgeSet_eq_empty hfine, Set.empty_inter, Set.empty_union] + +theorem _root_.GraphMinor.GM18.IsPatchworkHeart.inc_iff (h : IsPatchworkHeart P ℒ e Q) + (hfine : IsFine P.G ℒ) {g : β} + {v : α} : Q.G.Inc g v ↔ ∃ C ∈ ℒ, e C = g ∧ v ∈ C.rootSet := by + constructor + · intro hinc + have hg := Q.G.edge_mem_of_inc hinc + rw [h.edgeSet_eq_image hfine] at hg + obtain ⟨C, hC, rfl⟩ := hg + have hv : v ∈ Q.G.ends (e C) := hinc + rw [h.ends_newEdge hC] at hv + exact ⟨C, hC, rfl, hv⟩ + · rintro ⟨C, hC, rfl, hv⟩ + have hv' : v ∈ Q.G.ends (e C) := by + rw [h.ends_newEdge hC] + exact hv + exact hv' + +theorem _root_.GraphMinor.GM18.IsPatchworkHeart.finite (h : IsPatchworkHeart P ℒ e Q) + (hfine : IsFine P.G ℒ) : + ℒ.Finite := by + refine Set.Finite.of_finite_image ?_ h.injOn_newEdge + rw [← h.edgeSet_eq_image hfine] + exact Q.G.edgeSet_finite + +/-- Replacing each `C ∈ ℒ` by `addRoots hl C` moves a heart along a chain of 1-vertex extensions. -/ +theorem heart_addRoots {l : List α} (hl : l.Nodup) (hfine : IsFine P.G ℒ) + (h : IsPatchworkHeart P ℒ e Q) (hfine' : IsFine P.G (addRoots hl '' ℒ)) : + ∃ Q', HasPatchworkHeart P (addRoots hl '' ℒ) Q' ∧ + ChainData Q Q' {v | v ∈ P.G.vertexSet ∧ v ∈ l ∧ v ∉ (rootedLocationCore P.G ℒ).vertexSet} + := by + classical + have hloc := h.isRootedLocation + have : Nonempty (RootedHypergraph α β) := ⟨P.G⟩ + have hinj := injOn_addRoots hl hloc + set f := addRoots (β := β) hl with hf + let e' : RootedHypergraph α β → β := fun C ↦ e (Function.invFunOn f ℒ C) + have hinv : ∀ {C}, C ∈ ℒ → Function.invFunOn f ℒ (f C) = C := fun hC ↦ + hinj (Function.invFunOn_mem ⟨_, hC, rfl⟩) hC (Function.invFunOn_eq ⟨_, hC, rfl⟩) + have he' : ∀ {C}, C ∈ ℒ → e' (f C) = e C := fun hC ↦ congrArg e (hinv hC) + have hinj' : InjOn e' (f '' ℒ) := by + rintro _ ⟨A, hA, rfl⟩ _ ⟨B, hB, rfl⟩ heq + rw [he' hA, he' hB] at heq + rw [h.injOn_newEdge hA hB heq] + have hfin := h.finite hfine + obtain ⟨Q', hQ'⟩ := exists_heart (isRootedLocation_addRoots hl hloc) hfine' (hfin.image f) hinj' + refine ⟨Q', ⟨e', hQ'⟩, ?_⟩ + have himage : e' '' (f '' ℒ) = e '' ℒ := by + ext g + constructor + · rintro ⟨_, ⟨C, hC, rfl⟩, rfl⟩ + exact ⟨C, hC, (he' hC).symm⟩ + · rintro ⟨C, hC, rfl⟩ + exact ⟨f C, ⟨C, hC, rfl⟩, he' hC⟩ + have hinc' : ∀ {g v}, Q'.G.Inc g v ↔ ∃ C ∈ ℒ, e C = g ∧ v ∈ (f C).rootSet := by + intro g v + rw [hQ'.inc_iff hfine'] + constructor + · rintro ⟨_, ⟨C, hC, rfl⟩, h₁, h₂⟩ + exact ⟨C, hC, (he' hC).symm.trans h₁, h₂⟩ + · rintro ⟨C, hC, h₁, h₂⟩ + exact ⟨f C, ⟨C, hC, rfl⟩, (he' hC).trans h₁, h₂⟩ + have hsame : ∀ {C}, C ∈ ℒ → Q'.G.ends (e C) = Q.G.ends (e C) → f C = C := by + intro C hC hends + refine addRoots_eq hl C fun x hxl hxV ↦ ?_ + have h₁ : x ∈ Q'.G.ends (e C) := hinc'.mpr + ⟨C, hC, rfl, (mem_addRoots_rootSet hl C).mpr (Or.inr ⟨hxl, hxV⟩)⟩ + rw [hends] at h₁ + obtain ⟨C', hC', h₂, h₃⟩ := (h.inc_iff hfine).mp h₁ + exact h.injOn_newEdge hC' hC h₂ ▸ h₃ + refine + { roots_eq := hQ'.roots_eq.trans h.roots_eq.symm + edgeSet_eq := by + rw [hQ'.edgeSet_eq_image hfine', h.edgeSet_eq_image hfine, himage] + dom_eq := by + rw [hQ'.dom_eq_image hfine', h.dom_eq_image hfine, himage] + vertexSet_eq := ?_ + disjoint := ?_ + inc_iff := ?_ + exists_edge := ?_ + same_of_ends := ?_ + sameΔ_of_ends := ?_ } + · rw [hQ'.vertexSet_eq, h.vertexSet_eq] + ext v + rw [mem_core_iff, mem_union, mem_core_iff] + constructor + · rintro ⟨hv, hall⟩ + by_cases hc : ∀ A ∈ ℒ, v ∈ A.vertexSet → v ∈ A.rootSet + · exact Or.inl ⟨hv, hc⟩ + · refine Or.inr ⟨hv, ?_, fun h' ↦ hc (mem_core_iff.mp h').2⟩ + push Not at hc + obtain ⟨C, hC, h₁, h₂⟩ := hc + rcases (mem_addRoots_rootSet hl C).mp (hall (f C) ⟨C, hC, rfl⟩ h₁) with h₃ | h₃ + · exact absurd h₃ h₂ + · exact h₃.1 + · rintro (⟨hv, hall⟩ | ⟨hv, hl', -⟩) + · refine ⟨hv, ?_⟩ + rintro _ ⟨C, hC, rfl⟩ hvC + exact (mem_addRoots_rootSet hl C).mpr (Or.inl (hall C hC hvC)) + · refine ⟨hv, ?_⟩ + rintro _ ⟨C, hC, rfl⟩ hvC + exact (mem_addRoots_rootSet hl C).mpr (Or.inr ⟨hl', hvC⟩) + · rw [Set.disjoint_left, h.vertexSet_eq] + exact fun x hx hx' ↦ hx.2.2 hx' + · intro g v hv + rw [h.vertexSet_eq] at hv + rw [h.inc_iff hfine, hinc'] + constructor + · rintro ⟨C, hC, h₁, h₂⟩ + exact ⟨C, hC, h₁, (mem_addRoots_rootSet hl C).mpr (Or.inl h₂)⟩ + · rintro ⟨C, hC, h₁, h₂⟩ + refine ⟨C, hC, h₁, ?_⟩ + rcases (mem_addRoots_rootSet hl C).mp h₂ with h₃ | h₃ + · exact h₃ + · exact (mem_core_iff.mp hv).2 C hC h₃.2 + · rintro x ⟨hxG, hxl, hxc⟩ + have hc : ¬ ∀ A ∈ ℒ, x ∈ A.vertexSet → x ∈ A.rootSet := fun h' ↦ + hxc (mem_core_iff.mpr ⟨hxG, h'⟩) + push Not at hc + obtain ⟨C, hC, h₁, h₂⟩ := hc + refine ⟨e C, ?_, hinc'.mpr ⟨C, hC, rfl, (mem_addRoots_rootSet hl C).mpr (Or.inr ⟨hxl, h₁⟩)⟩, + ?_⟩ + · rw [h.dom_eq_image hfine] + exact ⟨C, hC, rfl⟩ + · intro g hg + obtain ⟨C', hC', rfl, h₃⟩ := hinc'.mp hg + by_cases hCC : C' = C + · rw [hCC] + · exfalso + have hxC' : x ∈ C'.vertexSet := by + rcases (mem_addRoots_rootSet hl C').mp h₃ with h₄ | h₄ + · exact C'.roots_subset x h₄ + · exact h₄.2 + rcases (hloc.le_complement hC' hC hCC).vertexSet_subset hxC' with h₄ | h₄ + · exact h₄.2 h₁ + · exact h₂ h₄ + · intro g hg hends hd + rw [h.edgeSet_eq_image hfine] at hg + obtain ⟨C, hC, rfl⟩ := hg + have hs := hsame hC hends + have hfC : f C ∈ f '' ℒ := ⟨C, hC, rfl⟩ + rw [← he' hC, hQ'.μ_newEdge hfC, he' hC, h.μ_newEdge hC, hs] + · intro g hg hends + rw [h.edgeSet_eq_image hfine] at hg + obtain ⟨C, hC, rfl⟩ := hg + have hs := hsame hC hends + have hfC : f C ∈ f '' ℒ := ⟨C, hC, rfl⟩ + rw [← he' hC, hQ'.Δ_newEdge hfC, he' hC, h.Δ_newEdge hC, hs] + +end Heart + +variable {ℒ : Set (RootedHypergraph α β)} + +/-- A vertex of a separator of `ℳ(𝒯, W, θ)`. The set `X` of (5.3) as a list. -/ +theorem mem_separatorSet_iff {Λ : Type*} [LinearOrder Λ] + {lam : Hypergraph α β × Hypergraph α β → Λ} {G : Hypergraph α β} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {W : Set (α ⊕ β)} {θ : ℕ} {v : α} : + v ∈ separatorSet lam G 𝒯 W θ ↔ ∃ A B, InM lam G 𝒯 W θ A B ∧ v ∈ (A ∩ B).vertexSet := by + simp only [separatorSet, mem_iUnion, exists_prop, Prod.exists, mem_ofPred_eq] + +/-- Graph Minors XX, (5.3) (page 337): "Let $\mathcal{F}$ be a well-behaved set of patchworks and +let $\theta \ge 1$. Then there is +a well-behaved set of patchworks $\mathcal{F}'$ with the following property. Let $P = (G, +\mu, \Delta)$ be a patchwork, let $\lambda$ be a tie-breaker in $G$, let $\mathcal{T}$ be a +tangle in $G$ of order $\ge \theta^2$, let $W \subseteq Z(G)$ with $|W| \le \theta$, let +$\mathcal{L}$ be a fine rooted location in $G$ that $\theta$-isolates $\mathcal{T}$ modulo +$W$, and let $\mathcal{F}$ contain a heart of $(P, \mathcal{L})$. Then there is a rooted +location $\mathcal{L}'$ in $G$ and $W' \subseteq W$ such that* * *$\mathcal{L}'$ is +$W'$-suitable and $\mathcal{F}'$ contains a heart of $(P, \mathcal{L}')$,* * *for each $(A, +B) \in \mathcal{M}(\mathcal{T}, W', \theta)$,* * *$V(A \cap B) \cap V(C) \subseteq +\bar{\pi}(C)$ for each $C \in \mathcal{L}'$, and* * *there is no $(C, D) \in \mathcal{L}'^-$ +with $A \subseteq C$ and $D \subseteq B$." -/ +theorem theorem_5_3_proof {𝓕 : Set (UnlabeledPatchwork α β)} (h𝓕 : WellBehaved 𝓕) {θ : ℕ} (hθ : 1 + ≤ θ) : + ∃ 𝓕' : Set (UnlabeledPatchwork α β), WellBehaved 𝓕' ∧ + ∀ (P : UnlabeledPatchwork α β) (Λ : Type w) [LinearOrder Λ] + (lam : Hypergraph α β × Hypergraph α β → Λ) (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (θ₀ : ℕ) (W : Set (α ⊕ β)) (ℒ : Set (RootedHypergraph α β)), + IsTieBreaker P.G.toHypergraph lam → IsTangle P.G.toHypergraph θ₀ 𝒯 → θ ^ 2 ≤ θ₀ → + W ⊆ zSet P.G.toHypergraph → W.ncard ≤ θ → IsFine P.G ℒ → + IsolatesModulo lam 𝒯 W θ P.G ℒ → (∃ Q ∈ 𝓕, HasPatchworkHeart P ℒ Q) → + ∃ (ℒ' : Set (RootedHypergraph α β)) (W' : Set (α ⊕ β)), W' ⊆ W ∧ + IsSuitable lam 𝒯 W' θ P.G ℒ' ∧ (∃ Q ∈ 𝓕', HasPatchworkHeart P ℒ' Q) ∧ + ∀ ⦃A B⦄, InM lam P.G.toHypergraph 𝒯 W' θ A B → + (∀ C ∈ ℒ', (A ∩ B).vertexSet ∩ C.vertexSet ⊆ C.rootSet) ∧ + ∀ C ∈ ℒ', ¬ (A ≤ C.toHypergraph ∧ complementHypergraph P.G C ≤ B) := by + classical + refine ⟨chainSet 𝓕 (θ ^ 2), wellBehaved_chainSet h𝓕 _, ?_⟩ + intro P Λ _ lam 𝒯 θ₀ W ℒ hTB h𝒯 hθ₀ hWG hWθ hfine hiso hheart + obtain ⟨Q₀, hQ₀, e, hQ₀e⟩ := hheart + have hloc := hiso.isRootedLocation + -- Choose `W'` minimal. + have hWfin : W.Finite := (finite_zSet _).subset hWG + have hSfin : {W' | W' ⊆ W ∧ IsolatesModulo lam 𝒯 W' θ P.G ℒ}.Finite := + hWfin.finite_subsets.subset fun _ h ↦ h.1 + obtain ⟨W', -, hmin⟩ := hSfin.exists_le_minimal (a := W) ⟨subset_rfl, hiso⟩ + obtain ⟨⟨hW'W, hiso'⟩, hmin'⟩ := hmin + have hW'G : W' ⊆ zSet P.G.toHypergraph := hW'W.trans hWG + have hno : ∀ z ∈ W', ¬ IsolatesModulo lam 𝒯 (W' \ {z}) θ P.G ℒ := by + intro z hz hI + have hle := hmin' (y := W' \ {z}) ⟨sdiff_subset.trans hW'W, hI⟩ sdiff_subset + exact (hle hz).2 rfl + obtain ⟨hXfin, hXcard⟩ := separatorSet_finite_ncard (lam := lam) (W := W') (θ := θ) hTB h𝒯 hW'G + set X := separatorSet lam P.G.toHypergraph 𝒯 W' θ with hX + have hW'θ : W'.ncard ≤ θ := (Set.ncard_le_ncard hW'W hWfin).trans hWθ + have hXθ : X.ncard ≤ θ * (θ - 1) := + hXcard.trans (Nat.mul_le_mul_right _ hW'θ) + have hsq : θ * (θ - 1) + θ = θ ^ 2 := by + obtain ⟨t, rfl⟩ : ∃ t, θ = t + 1 := ⟨θ - 1, by omega⟩ + simp only [Nat.add_sub_cancel] + ring + let l : List α := hXfin.toFinset.toList + have hl : l.Nodup := Finset.nodup_toList _ + have hlX : ∀ {v}, v ∈ l ↔ v ∈ X := fun {v} ↦ by simp [l] + set f := addRoots (β := β) hl with hf + have hC : ∀ {C}, C ∈ ℒ → IsComplemented P.G C := fun hC ↦ hloc.isComplemented hC + have hfine' : IsFine P.G (f '' ℒ) := by + refine ⟨fun v hv ↦ ?_, fun e he ↦ ?_⟩ + · obtain ⟨C, hC, hvC⟩ := hfine.1 v hv + exact ⟨f C, ⟨C, hC, rfl⟩, hvC⟩ + · obtain ⟨C, hC, heC⟩ := hfine.2 e he + exact ⟨f C, ⟨C, hC, rfl⟩, heC⟩ + obtain ⟨Q', hQ'heart, hchain⟩ := heart_addRoots hl hfine hQ₀e hfine' + have hsub : {v | v ∈ P.G.vertexSet ∧ v ∈ l ∧ + v ∉ (rootedLocationCore P.G ℒ).vertexSet} ⊆ X := fun _ hv ↦ hlX.mp hv.2.1 + have hmem := mem_chain (𝓕 := 𝓕) (k := θ ^ 2) ⟨Q₀, hQ₀, IsCompletionOf.refl _⟩ hchain + (hXfin.subset hsub) ((Set.ncard_le_ncard hsub hXfin).trans (by nlinarith)) + have hordC : ∀ {X : RootedHypergraph α β}, X ∈ ℒ → + separationOrder X.toHypergraph (complementHypergraph P.G X) < θ := fun hX ↦ + separationOrder_complement_le.trans_lt (hiso.order_lt hX) + have hθθ : θ ≤ θ ^ 2 := Nat.le_self_pow two_ne_zero _ + have hroots : ∀ {C}, C ∈ ℒ → (f C).rootSet.ncard < θ ^ 2 := by + intro C hCℒ + have hsub : (f C).rootSet ⊆ C.rootSet ∪ X := by + intro v hv + rcases (mem_addRoots_rootSet hl C).mp hv with h | h + · exact Or.inl h + · exact Or.inr (hlX.mp h.1) + have h₁ := Set.ncard_le_ncard hsub ((List.finite_toSet _).union hXfin) + have h₂ := Set.ncard_union_le C.rootSet X + have h₃ := hiso.order_lt hCℒ + omega + refine ⟨f '' ℒ, W', hW'W, ?_, ⟨Q', hmem, hQ'heart⟩, ?_⟩ + · refine + { isRootedLocation := isRootedLocation_addRoots hl hloc + fine := hfine' + subset := ?_ + order_lt := ?_ + distinction := ?_ } + · rintro _ ⟨_, ⟨C, hCℒ, rfl⟩, rfl⟩ + have hCT : (C.toHypergraph, complementHypergraph P.G C) ∈ 𝒯 := hiso.subset ⟨C, hCℒ, rfl⟩ + have hc : IsComplemented P.G (f C) := isComplemented_addRoots hl C (hC hCℒ) + rcases h𝒯.axiom1 (isSeparation_complement hc) + (separationOrder_complement_le.trans_lt ((hroots hCℒ).trans_le hθ₀)) with h | h + · exact h + · exact (not_le_of_mem_tangle h𝒯 h hCT + (complementHypergraph_le_addRoots hl (hC hCℒ))).elim + · rintro _ ⟨C, hCℒ, rfl⟩ + exact hroots hCℒ + · rintro θ' 𝒯' h𝒯' hθ' C' D' ⟨_, ⟨C, hCℒ, rfl⟩, heq⟩ hD A B hd + obtain ⟨rfl, rfl⟩ := Prod.mk.inj heq + by_cases h3 : ∃ A' B', InM lam P.G.toHypergraph 𝒯 W' θ A' B' ∧ A ≤ A' ∧ B' ≤ B + · exact Or.inr h3 + refine Or.inl ?_ + have hCT : (C.toHypergraph, complementHypergraph P.G C) ∈ 𝒯 := hiso.subset ⟨C, hCℒ, rfl⟩ + have hDC : (complementHypergraph P.G C, C.toHypergraph) ∈ 𝒯' := + mem_tangle_of_le h𝒯' (isSeparation_complement (hC hCℒ)) + ((hordC hCℒ).trans_le (hθθ.trans hθ')) hD + (complementHypergraph_le_addRoots hl (hC hCℒ)) + have hlt : separationOrder A B < θ := + (order_le_of_distinction hTB h𝒯 h𝒯' hd hCT hDC).trans_lt (hordC hCℒ) + have hW'B : W' ⊆ zSet B := by + by_contra hn + obtain ⟨A', B', h₁, h₂, h₃⟩ := exists_inM_above h𝒯 + (show InMPre lam P.G.toHypergraph 𝒯 W' θ A B from + ⟨hd.1.1, hlt, hn, θ', 𝒯', h𝒯', hd⟩) + exact h3 ⟨A', B', h₁, h₂, h₃⟩ + obtain ⟨h₁, h₂⟩ : A ≤ C.toHypergraph ∧ complementHypergraph P.G C ≤ B := by + rcases hiso'.distinction hCℒ h𝒯' (hθθ.trans hθ') hDC hd with h | h + · exact h + · exact absurd hW'B h + refine ⟨h₁, ?_⟩ + have hBG : B ≤ P.G.toHypergraph := (h𝒯.isSeparation hd.1.1).right_le + rw [le_iff_of_le (complementHypergraph_le (isComplemented_addRoots hl C (hC hCℒ))) hBG] + refine ⟨fun v hv ↦ ?_, h₂.edgeSet_subset⟩ + rcases mem_of_mem_complement_addRoots hl hv with h | ⟨hvl, -, -⟩ + · exact h₂.vertexSet_subset h + · obtain ⟨A', B', hM, hvs⟩ := mem_separatorSet_iff.mp (hlX.mp hvl) + rcases theorem_5_1_of_lt hTB h𝒯 h𝒯' hM hd hlt with h | h + · exact absurd ⟨A', B', hM, h⟩ h3 + · exact h.2.vertexSet_subset hvs.1 + · intro A B hM + refine ⟨?_, ?_⟩ + · rintro _ ⟨C, hCℒ, rfl⟩ v ⟨hv, hvC⟩ + exact (mem_addRoots_rootSet hl C).mpr + (Or.inr ⟨hlX.mpr (mem_separatorSet_iff.mpr ⟨A, B, hM, hv⟩), hvC⟩) + · rintro _ ⟨C, hCℒ, rfl⟩ ⟨h₁, h₂⟩ + exact no_location_above hTB h𝒯 hW'G hiso' hno hM hCℒ h₁ + ((complementHypergraph_le_addRoots hl (hC hCℒ)).trans h₂) + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section5e.lean b/LeanPool/GraphMinor/GM20/Section5e.lean new file mode 100644 index 0000000000..72e242779b --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section5e.lean @@ -0,0 +1,235 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section5d + +/-! +# Splitting a member of a rooted location + +In the proof of (5.4) of Graph Minors XX, each member `C` of a rooted location is cut into pieces. A +grouping feasible in `P | C` should then be feasible in the part of the new heart that has one edge +for each piece. + +The file proves this in `feasible_of_split`. Take a realization `H` of `P | C`. Replace the part of +`H` in each piece `L` by the grouping `K_L` on `πBar(L)` that records which roots are connected in +that +part. Two roots of `C` connected in `H` are still connected: follow a path in `H`, and each time it +leaves a piece it does so at a root of that piece, where `K_L` gives a jump. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 SimpleGraph + +universe u v + +variable {α : Type u} {β : Type v} + +/-- The grouping on `V` in which distinct vertices are adjacent if and only if they are connected +in `H`. -/ +def connGrouping (H : (⊤ : SimpleGraph α).Subgraph) (V : Set α) : (⊤ : SimpleGraph α).Subgraph where + verts := V + Adj u v := u ∈ V ∧ v ∈ V ∧ u ≠ v ∧ sameComponent H u v + adj_sub h := h.2.2.1 + edge_vert h := h.1 + symm := ⟨fun _ _ h ↦ ⟨h.2.1, h.1, h.2.2.1.symm, h.2.2.2.symm⟩⟩ + +theorem isGrouping_connGrouping (H : (⊤ : SimpleGraph α).Subgraph) (V : Set α) : + IsGrouping V (connGrouping H V) := + isGrouping_iff.mpr ⟨subset_rfl, fun _ _ _ hac hab hbc ↦ + ⟨hab.1, hbc.2.1, hac, hab.2.2.2.trans hbc.2.2.2⟩⟩ + +theorem feasible_connGrouping {Ω : Type*} {P : Patchwork Ω α β} {H : (⊤ : SimpleGraph α).Subgraph} + (hH : P.IsRealization H) : IsFeasibleGrouping P (connGrouping H P.G.rootSet) := by + refine ⟨isGrouping_connGrouping _ _, rfl, H, hH, fun x hx y hy hne ↦ ?_⟩ + rw [← sameComponent_iff_connectedIn] + exact ⟨fun h ↦ ⟨hx, hy, hne, h⟩, fun h ↦ h.2.2.2⟩ + +theorem sameComponent_emptySubgraph {V : Set α} {p q : α} + (h : sameComponent (emptySubgraph V) p q) : p = q := by + obtain ⟨hp, hq, hr⟩ := sameComponent_iff.mp h + rw [SimpleGraph.reachable_iff_reflTransGen] at hr + suffices ∀ y : (emptySubgraph V).verts, Relation.ReflTransGen (emptySubgraph V).coe.Adj ⟨p, hp⟩ y + → + p = y.1 from this ⟨q, hq⟩ hr + intro y hy + induction hy with + | refl => rfl + | @tail b c _ hab _ => exact (not_emptySubgraph_adj (V := V) (u := b.1) (v := c.1) hab).elim + +/-- Graph Minors XX, proof of (5.4), last paragraph: the heart of a removable patchwork at a fine +location is removable. -/ +theorem heart_isRemovable {P Q : UnlabeledPatchwork α β} {ℒ : Set (RootedHypergraph α β)} + {e : RootedHypergraph α β → β} (hP : P.IsRemovable) (hfine : IsFine P.G ℒ) + (h : IsPatchworkHeart P ℒ e Q) : Q.IsRemovable := by + intro g hg + rw [h.edgeSet_eq_image hfine] at hg + obtain ⟨C, hC, rfl⟩ := hg + have hc := h.isRootedLocation.isComplemented hC + rw [Patchwork.IsRemovableEdge, h.ends_newEdge hC, h.Δ_newEdge hC] + have hrem : (P.restrict C).IsRemovable := hP.restrict hc.le + refine ⟨isGrouping_iff.mpr ⟨subset_rfl, fun a _ _ _ hab _ ↦ ?_⟩, rfl, _, + hrem.emptySubgraph_isRealization, fun x _ y _ hne ↦ ?_⟩ + · exact (not_emptySubgraph_adj hab).elim + · rw [← sameComponent_iff_connectedIn] + exact ⟨fun h' ↦ absurd (sameComponent_emptySubgraph h') hne, + fun h' ↦ (not_emptySubgraph_adj h').elim⟩ + +section Split + +variable {P Q' : UnlabeledPatchwork α β} {C R : RootedHypergraph α β} + {𝒮 : Set (RootedHypergraph α β)} {e' : RootedHypergraph α β → β} + +/-- A grouping feasible in `P | C` is feasible in the part `R` of the heart that has one edge for +each piece of `C`. -/ +theorem feasible_of_split (hRroots : R.roots = C.roots) (hRE : R.edgeSet = e' '' 𝒮) + (hle : R.toHypergraph ≤ Q'.G.toHypergraph) + (hΔ : ∀ L ∈ 𝒮, Q'.Δ (e' L) = feasibleGroupings (P.restrict L)) (hinj : InjOn e' 𝒮) + (hC : C.toHypergraph ≤ P.G.toHypergraph) (hL : ∀ L ∈ 𝒮, L.toHypergraph ≤ C.toHypergraph) + (hroot : ∀ L ∈ 𝒮, ∀ v, v ∈ L.rootSet ↔ v ∈ C.rootSet ∧ v ∈ L.vertexSet) + (hsep : ∀ L ∈ 𝒮, ∀ L' ∈ 𝒮, L ≠ L' → ∀ v, v ∈ L.vertexSet → v ∈ L'.vertexSet → v ∈ L.rootSet) + (hedge : ∀ g ∈ C.edgeSet, ∃ L ∈ 𝒮, g ∈ L.edgeSet) (hVR : R.vertexSet = C.rootSet) + {K : (⊤ : SimpleGraph α).Subgraph} (hK : IsFeasibleGrouping (P.restrict C) K) : + IsFeasibleGrouping (Q'.restrict R) K := by + classical + obtain ⟨hg, hv, H, ⟨δ, hδ, rfl⟩, hconn₀⟩ := hK + have hconn : ∀ x ∈ C.rootSet, ∀ y ∈ C.rootSet, x ≠ y → + (ConnectedIn (realizationOf C.toHypergraph δ) x y ↔ K.Adj x y) := hconn₀ + have hrs : R.rootSet = C.rootSet := by + change {v | v ∈ R.roots} = {v | v ∈ C.roots} + rw [hRroots] + have : Nonempty (RootedHypergraph α β) := ⟨C⟩ + have hLG : ∀ L ∈ 𝒮, L.toHypergraph ≤ P.G.toHypergraph := fun L h ↦ (hL L h).trans hC + set HL : RootedHypergraph α β → (⊤ : SimpleGraph α).Subgraph := + fun L ↦ realizationOf L.toHypergraph δ with hHL + have hreal : ∀ L ∈ 𝒮, (P.restrict L).IsRealization (HL L) := by + intro L hLm + refine ⟨δ, fun g hg' ↦ ?_, rfl⟩ + rw [Patchwork.restrict_Δ (hLG L hLm) hg'] + have hgC : g ∈ C.edgeSet := (hL L hLm).edgeSet_subset hg' + have := hδ g hgC + rwa [Patchwork.restrict_Δ hC hgC] at this + have hHLverts : ∀ L ∈ 𝒮, (HL L).verts = L.vertexSet := fun L h ↦ (hreal L h).verts_eq + let inv : β → RootedHypergraph α β := Function.invFunOn e' 𝒮 + have hinv : ∀ {L}, L ∈ 𝒮 → inv (e' L) = L := fun hm ↦ + hinj (Function.invFunOn_mem ⟨_, hm, rfl⟩) hm (Function.invFunOn_eq ⟨_, hm, rfl⟩) + let δ' : β → (⊤ : SimpleGraph α).Subgraph := + fun g ↦ connGrouping (HL (inv g)) (inv g).rootSet + have hδ'' : ∀ {L}, L ∈ 𝒮 → δ' (e' L) = connGrouping (HL L) L.rootSet := fun hm ↦ by + simp only [δ', hinv hm] + have hmemE : ∀ {L}, L ∈ 𝒮 → e' L ∈ R.edgeSet := fun {L} hm ↦ by + rw [hRE] + exact ⟨L, hm, rfl⟩ + have hreal' : (Q'.restrict R).IsRealization (realizationOf R.toHypergraph δ') := by + refine ⟨δ', fun g hg' ↦ ?_, rfl⟩ + have hg₂ := hg' + rw [Patchwork.restrict_G, hRE] at hg₂ + obtain ⟨L, hm, rfl⟩ := hg₂ + rw [Patchwork.restrict_Δ hle hg', hΔ L hm, hδ'' hm] + exact feasible_connGrouping (hreal L hm) + set H' := realizationOf R.toHypergraph δ' with hH' + have hH'verts : H'.verts = C.rootSet := by + rw [hreal'.verts_eq, Patchwork.restrict_G, hVR] + -- A jump inside a piece. + have hjump : ∀ {L}, L ∈ 𝒮 → ∀ {a b}, a ∈ L.rootSet → b ∈ L.rootSet → + sameComponent (HL L) a b → sameComponent H' a b := by + intro L hm a b ha hb hab + by_cases hne : a = b + · subst hne + have haC : a ∈ H'.verts := by + rw [hH'verts] + exact ((hroot L hm a).mp ha).1 + exact sameComponent_iff.mpr ⟨haC, haC, SimpleGraph.Reachable.refl _⟩ + · refine sameComponent_of_adj ?_ + rw [hH', realizationOf_adj] + exact ⟨e' L, hmemE hm, by rw [hδ'' hm]; exact ⟨ha, hb, hne, hab⟩⟩ + have hHLadj : ∀ {L}, L ∈ 𝒮 → ∀ {a b}, (HL L).Adj a b → + (realizationOf C.toHypergraph δ).Adj a b := by + intro L hm a b hab + rw [hHL, realizationOf_adj] at hab + obtain ⟨g, hg', h'⟩ := hab + exact realizationOf_adj.mpr ⟨g, (hL L hm).edgeSet_subset hg', h'⟩ + have hreal₀ : (P.restrict C).IsRealization (realizationOf C.toHypergraph δ) := ⟨δ, hδ, rfl⟩ + have hHverts : (realizationOf C.toHypergraph δ).verts = C.vertexSet := hreal₀.verts_eq + have hsub : ∀ {L}, L ∈ 𝒮 → ∀ {a b}, sameComponent (HL L) a b → + sameComponent (realizationOf C.toHypergraph δ) a b := by + intro L hm a b hab + refine sameComponent_of_forall_adj ?_ (fun _ _ h' ↦ sameComponent_of_adj (hHLadj hm h')) hab + rw [hHLverts L hm, hHverts] + exact (hL L hm).vertexSet_subset + refine ⟨?_, ?_, H', hreal', ?_⟩ + · rw [Patchwork.restrict_G, hrs] + exact hg + · rw [Patchwork.restrict_G, hrs] + exact hv + intro x hx y hy hne + rw [Patchwork.restrict_G, hrs] at hx hy + rw [← hconn x hx y hy hne, ← sameComponent_iff_connectedIn, ← sameComponent_iff_connectedIn] + constructor + · intro hxy + refine sameComponent_of_forall_adj ?_ ?_ hxy + · rw [hH'verts] + intro v hv' + rw [hHverts] + exact C.roots_subset v hv' + · intro a b hab + rw [hH', realizationOf_adj, hRE] at hab + obtain ⟨_, ⟨L, hm, rfl⟩, h'⟩ := hab + rw [hδ'' hm] at h' + exact hsub hm h'.2.2.2 + · intro hxy + obtain ⟨hxV, hyV, hr⟩ := sameComponent_iff.mp hxy + rw [SimpleGraph.reachable_iff_reflTransGen] at hr + have hxH' : x ∈ H'.verts := by rw [hH'verts]; exact hx + suffices hS : ∀ w : (realizationOf C.toHypergraph δ).verts, + Relation.ReflTransGen (realizationOf C.toHypergraph δ).coe.Adj ⟨x, hxV⟩ w → + ∃ r, r ∈ C.rootSet ∧ sameComponent H' x r ∧ + (w.1 = r ∨ ∃ L ∈ 𝒮, r ∈ L.vertexSet ∧ sameComponent (HL L) r w.1) by + obtain ⟨r, hrC, hxr, h'⟩ := hS ⟨y, hyV⟩ hr + rcases h' with h' | ⟨L, hm, hrL, h'⟩ + · exact (show y = r from h') ▸ hxr + · have hyL : y ∈ L.vertexSet := by + rw [← hHLverts L hm] + exact (sameComponent_iff.mp h').2.1 + exact hxr.trans (hjump hm ((hroot L hm r).mpr ⟨hrC, hrL⟩) + ((hroot L hm y).mpr ⟨hy, hyL⟩) h') + intro w hw + induction hw with + | refl => exact ⟨x, hx, sameComponent_iff.mpr ⟨hxH', hxH', SimpleGraph.Reachable.refl _⟩, + Or.inl rfl⟩ + | @tail w w' _ hadj ih => + obtain ⟨r, hrC, hxr, h'⟩ := ih + have hadj' : (realizationOf C.toHypergraph δ).Adj w.1 w'.1 := hadj + obtain ⟨g, hgC, hg'⟩ := realizationOf_adj.mp hadj' + obtain ⟨L', hm', hgL'⟩ := hedge g hgC + have hadjL' : (HL L').Adj w.1 w'.1 := realizationOf_adj.mpr ⟨g, hgL', hg'⟩ + have hwL' : w.1 ∈ L'.vertexSet := by + rw [← hHLverts L' hm'] + exact (HL L').edge_vert hadjL' + rcases h' with h' | ⟨L, hm, hrL, h'⟩ + · refine ⟨r, hrC, hxr, Or.inr ⟨L', hm', h' ▸ hwL', ?_⟩⟩ + rw [← h'] + exact sameComponent_of_adj hadjL' + · by_cases hLL : L = L' + · subst hLL + exact ⟨r, hrC, hxr, Or.inr ⟨L, hm, hrL, h'.trans (sameComponent_of_adj hadjL')⟩⟩ + · have hwL : w.1 ∈ L.vertexSet := by + rw [← hHLverts L hm] + exact (sameComponent_iff.mp h').2.1 + have hwroot : w.1 ∈ L.rootSet := hsep L hm L' hm' hLL _ hwL hwL' + refine ⟨w.1, ((hroot L hm _).mp hwroot).1, + hxr.trans (hjump hm ((hroot L hm r).mpr ⟨hrC, hrL⟩) hwroot h'), + Or.inr ⟨L', hm', hwL', sameComponent_of_adj hadjL'⟩⟩ + +end Split + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section5f.lean b/LeanPool/GraphMinor/GM20/Section5f.lean new file mode 100644 index 0000000000..f1af8d6bb0 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section5f.lean @@ -0,0 +1,342 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section5e + +/-! +# Cutting a rooted location along a family of subhypergraphs + +The proof of (5.4) of Graph Minors XX cuts each `C ∈ ℒ` into the pieces `f_i(C) = C ∩ A_i`. This +file +treats a general family `(A_i : i ∈ ι)` with the properties that the proof uses, in `SplitFamily`. +The new set `splitSet ℒ A` is a fine rooted location with the same core, and the heart of `ℒ` is a +condensation of the heart of `splitSet ℒ A` (`exists_condensation`). + +A set of rooted hypergraphs cannot hold the same piece twice, and two pairs `(C, i)` can give the +same piece. So each piece gets one owner `C`, and in the condensation an edge `e(C)` stands for the +pieces that `C` owns. Such a clash can only happen to a piece without edges, so nothing is lost. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} {ι : Type*} + +/-- The rooted hypergraph `f(C)` with `f(C)⁻ = C⁻ ∩ A` and `πBar(f(C)) = πBar(C) ∩ V(A)`. -/ +noncomputable def piece (C : RootedHypergraph α β) (A : Hypergraph α β) : RootedHypergraph α β where + toHypergraph := C.toHypergraph ∩ A + roots := marchSlash C.roots A.vertexSetᶜ + roots_nodup := nodup_marchSlash C.roots_nodup _ + roots_subset v hv := by + obtain ⟨h₁, h₂⟩ := mem_marchSlash.mp hv + exact ⟨C.roots_subset v h₁, not_not.mp h₂⟩ + +theorem mem_piece_rootSet {C : RootedHypergraph α β} {A : Hypergraph α β} {v : α} : + v ∈ (piece C A).rootSet ↔ v ∈ C.rootSet ∧ v ∈ A.vertexSet := by + change v ∈ marchSlash C.roots A.vertexSetᶜ ↔ _ + rw [mem_marchSlash, mem_compl_iff, not_not] + rfl + +/-- The properties of the family `(A_i)` in the proof of (5.4). -/ +structure SplitFamily (G : RootedHypergraph α β) (ℒ : Set (RootedHypergraph α β)) + (A : ι → Hypergraph α β) : Prop where + le : ∀ i, A i ≤ G.toHypergraph + cover_v : ∀ v ∈ G.vertexSet, ∃ i, v ∈ (A i).vertexSet + cover_e : ∀ e ∈ G.edgeSet, ∃ i, e ∈ (A i).edgeSet + disj : ∀ i j, i ≠ j → ∀ e, e ∈ (A i).edgeSet → e ∉ (A j).edgeSet + sep : ∀ C ∈ ℒ, ∀ i j, i ≠ j → ∀ v ∈ C.vertexSet, v ∈ (A i).vertexSet → v ∈ (A j).vertexSet → + v ∈ C.rootSet + +/-- The set `ℒ'` of the proof of (5.4). -/ +def splitSet (ℒ : Set (RootedHypergraph α β)) (A : ι → Hypergraph α β) : + Set (RootedHypergraph α β) := + {L | ∃ C ∈ ℒ, ∃ i, L = piece C (A i)} + +variable {G : RootedHypergraph α β} {ℒ : Set (RootedHypergraph α β)} {A : ι → Hypergraph α β} + +theorem piece_le {C : RootedHypergraph α β} {B : Hypergraph α β} (hC : C.toHypergraph + ≤ G.toHypergraph) (hA : B ≤ G.toHypergraph) : + (piece C B).toHypergraph ≤ C.toHypergraph := + inter_le_left hC hA + +theorem piece_le_right {C : RootedHypergraph α β} {B : Hypergraph α β} + (hC : C.toHypergraph ≤ G.toHypergraph) (hA : B ≤ G.toHypergraph) : + (piece C B).toHypergraph ≤ B := + inter_le_right hC hA + +theorem isComplemented_piece (hS : SplitFamily G ℒ A) (hloc : IsRootedLocation G ℒ) {C} (hC : C ∈ ℒ) + (i : ι) : IsComplemented G (piece C (A i)) := by + have hc := hloc.isComplemented hC + refine ⟨inter_le hc.le (hS.le i), ?_, ?_⟩ + · intro v hv hr + exact mem_piece_rootSet.mpr ⟨hc.roots_mem hv.1 hr, hv.2⟩ + · intro v e hv he hinc + refine mem_piece_rootSet.mpr ⟨?_, hv.2⟩ + by_cases heC : e ∈ C.edgeSet + · obtain ⟨j, hj⟩ := hS.cover_e e he.1 + have hij : i ≠ j := by + rintro rfl + exact he.2 ⟨heC, hj⟩ + have hvj : v ∈ (A j).vertexSet := by + have h₁ : v ∈ G.ends e := hinc + rw [(hS.le j).ends_eq e hj] at h₁ + exact (A j).vertex_mem_of_inc h₁ + exact hS.sep C hC i j hij v hv.1 hv.2 hvj + · exact hc.inc_diff_mem hv.1 ⟨he.1, heC⟩ hinc + +/-- Each `X ⊆ G` that shares no edge with `L = f(C)`, and meets it only in roots of `C`, lies in +`G \ L`. -/ +theorem le_complementHypergraph_piece {C : RootedHypergraph α β} {B X : Hypergraph α β} + (hL : IsComplemented G (piece C B)) (hX : X ≤ G.toHypergraph) + (he : ∀ e ∈ X.edgeSet, e ∉ (piece C B).edgeSet) + (hv : ∀ v ∈ X.vertexSet, v ∈ (piece C B).vertexSet → v ∈ C.rootSet) : + X ≤ complementHypergraph G (piece C B) := by + rw [le_iff_of_le hX (complementHypergraph_le hL)] + refine ⟨fun v hvX ↦ ?_, fun e heX ↦ ⟨hX.edgeSet_subset heX, he e heX⟩⟩ + by_cases hvL : v ∈ (piece C B).vertexSet + · exact Or.inr ⟨hX.vertexSet_subset hvX, mem_piece_rootSet.mpr ⟨hv v hvX hvL, hvL.2⟩⟩ + · exact Or.inl ⟨hX.vertexSet_subset hvX, hvL⟩ + +theorem complementHypergraph_le_piece {C : RootedHypergraph α β} {B : Hypergraph α β} + (hC : IsComplemented G C) (hL : IsComplemented G (piece C B)) : + complementHypergraph G C ≤ complementHypergraph G (piece C B) := by + refine le_complementHypergraph_piece hL (complementHypergraph_le hC) ?_ ?_ + · exact fun e he he' ↦ he.2 he'.1 + · rintro v (h | h) hv + · exact absurd hv.1 h.2 + · exact h.2 + +theorem isRootedLocation_splitSet (hS : SplitFamily G ℒ A) (hloc : IsRootedLocation G ℒ) : + IsRootedLocation G (splitSet ℒ A) := by + have hcomp : ∀ ⦃L⦄, L ∈ splitSet ℒ A → IsComplemented G L := by + rintro _ ⟨C, hC, i, rfl⟩ + exact isComplemented_piece hS hloc hC i + refine ⟨hcomp, ?_⟩ + rintro _ ⟨C, hC, i, rfl⟩ _ ⟨C', hC', j, rfl⟩ hne + rw [complement_toHypergraph] + have hc := hloc.isComplemented hC + have hc' := hloc.isComplemented hC' + refine le_complementHypergraph_piece (hcomp ⟨C', hC', j, rfl⟩) (inter_le hc.le (hS.le i)) ?_ ?_ + · intro e he he' + by_cases hCC : C = C' + · subst hCC + have hij : i ≠ j := fun h ↦ hne (by rw [h]) + exact hS.disj i j hij e he.2 he'.2 + · exact ((hloc.le_complement hC hC' hCC).edgeSet_subset he.1).2 he'.1 + · intro v hv hv' + by_cases hCC : C = C' + · subst hCC + have hij : i ≠ j := fun h ↦ hne (by rw [h]) + exact hS.sep C hC i j hij v hv.1 hv.2 hv'.2 + · rcases (hloc.le_complement hC hC' hCC).vertexSet_subset hv.1 with h | h + · exact absurd hv'.1 h.2 + · exact h + +theorem isFine_splitSet (hS : SplitFamily G ℒ A) (hfine : IsFine G ℒ) : + IsFine G (splitSet ℒ A) := by + refine ⟨fun v hv ↦ ?_, fun e he ↦ ?_⟩ + · obtain ⟨C, hC, hvC⟩ := hfine.1 v hv + obtain ⟨i, hi⟩ := hS.cover_v v hv + exact ⟨_, ⟨C, hC, i, rfl⟩, hvC, hi⟩ + · obtain ⟨C, hC, heC⟩ := hfine.2 e he + obtain ⟨i, hi⟩ := hS.cover_e e he + exact ⟨_, ⟨C, hC, i, rfl⟩, heC, hi⟩ + +theorem core_splitSet (hS : SplitFamily G ℒ A) : + (rootedLocationCore G (splitSet ℒ A)).vertexSet = (rootedLocationCore G ℒ).vertexSet := by + ext v + rw [mem_core_iff, mem_core_iff] + refine and_congr_right fun hv ↦ ⟨fun h C hC hvC ↦ ?_, ?_⟩ + · obtain ⟨i, hi⟩ := hS.cover_v v hv + exact (mem_piece_rootSet.mp (h _ ⟨C, hC, i, rfl⟩ ⟨hvC, hi⟩)).1 + · rintro h _ ⟨C, hC, i, rfl⟩ hvL + exact mem_piece_rootSet.mpr ⟨h C hC hvL.1, hvL.2⟩ + +theorem ncard_piece_rootSet_le (C : RootedHypergraph α β) (B : Hypergraph α β) : + (piece C B).rootSet.ncard ≤ C.rootSet.ncard := + Set.ncard_le_ncard (fun _ h ↦ (mem_piece_rootSet.mp h).1) (List.finite_toSet _) + +theorem finite_splitSet [Finite ι] (h : ℒ.Finite) : (splitSet ℒ A).Finite := by + have hfin : ((fun p : RootedHypergraph α β × ι ↦ piece p.1 (A p.2)) '' (ℒ ×ˢ univ)).Finite := + (h.prod finite_univ).image _ + refine hfin.subset ?_ + rintro _ ⟨C, hC, i, rfl⟩ + exact ⟨(C, i), ⟨hC, mem_univ _⟩, rfl⟩ + +/-- A finite set has an injective map into an infinite type. -/ +theorem exists_injOn_of_finite {γ δ : Type*} [Infinite δ] [Nonempty δ] {s : Set γ} (hs : s.Finite) : + ∃ f : γ → δ, InjOn f s := by + classical + have : Finite s := hs + let g : s ↪ δ := ((Finite.equivFin s).toEmbedding.trans Fin.valEmbedding).trans + (Infinite.natEmbedding δ) + refine ⟨fun x ↦ if h : x ∈ s then g ⟨x, h⟩ else Classical.arbitrary δ, ?_⟩ + intro x hx y hy hxy + simp only [hx, hy, ↓reduceDIte] at hxy + exact congrArg Subtype.val (g.injective hxy) + +/-- The rooted part of `Q'` with edges `E`, and with the march of `C`. -/ +noncomputable def heartPart (Q' : UnlabeledPatchwork α β) (E : Set β) (C : RootedHypergraph α β) : + RootedHypergraph α β where + vertexSet := C.rootSet ∪ {v | ∃ f ∈ E, Q'.G.Inc f v} + edgeSet := E ∩ Q'.G.edgeSet + Inc f v := f ∈ E ∧ Q'.G.Inc f v + vertex_mem_of_inc _ _ h := Or.inr ⟨_, h.1, h.2⟩ + edge_mem_of_inc _ _ h := ⟨h.1, Q'.G.edge_mem_of_inc h.2⟩ + vertexSet_finite := (List.finite_toSet _).union + (Q'.G.vertexSet_finite.subset fun _ ⟨_, _, h⟩ ↦ Q'.G.vertex_mem_of_inc h) + edgeSet_finite := Q'.G.edgeSet_finite.subset inter_subset_right + roots := C.roots + roots_nodup := C.roots_nodup + roots_subset _ h := Or.inl h + +variable [Finite ι] + +/-- The heart of `(P, ℒ)` is a condensation of a heart of `(P, splitSet ℒ A)`. -/ +theorem exists_condensation [Infinite β] {P Q : UnlabeledPatchwork α β} + {e : RootedHypergraph α β → β} (hS : SplitFamily P.G ℒ A) (hfine : IsFine P.G ℒ) + (hQ : IsPatchworkHeart P ℒ e Q) : + ∃ Q', HasPatchworkHeart P (splitSet ℒ A) Q' ∧ IsCondensation Q Q' := by + classical + have hloc := hQ.isRootedLocation + have hne : Nonempty (RootedHypergraph α β) := ⟨P.G⟩ + have hne' : Nonempty β := inferInstance + have hfin := hQ.finite hfine + have hfine' := isFine_splitSet hS hfine + have hloc' := isRootedLocation_splitSet hS hloc + obtain ⟨e', he'⟩ := exists_injOn_of_finite (δ := β) (finite_splitSet (A := A) hfin) + obtain ⟨Q', hQ'⟩ := exists_heart hloc' hfine' (finite_splitSet hfin) he' + refine ⟨Q', ⟨e', hQ'⟩, ?_⟩ + -- Each piece has one owner. + have hown : ∀ L : RootedHypergraph α β, ∃ C, L ∈ splitSet ℒ A → + C ∈ ℒ ∧ ∃ i, L = piece C (A i) := by + intro L + by_cases hL : L ∈ splitSet ℒ A + · obtain ⟨C, hC, i, h⟩ := hL + exact ⟨C, fun _ ↦ ⟨hC, i, h⟩⟩ + · exact ⟨L, fun h ↦ absurd h hL⟩ + choose own hown using hown + let part : RootedHypergraph α β → Set (RootedHypergraph α β) := + fun C ↦ {L ∈ splitSet ℒ A | own L = C} + have hpart : ∀ {C L}, L ∈ part C → C ∈ ℒ ∧ ∃ i, L = piece C (A i) := by + rintro C L ⟨h₁, rfl⟩ + exact hown L h₁ + let inv : β → RootedHypergraph α β := Function.invFunOn e ℒ + have hinv : ∀ {C}, C ∈ ℒ → inv (e C) = C := fun hC ↦ + hQ.injOn_newEdge (Function.invFunOn_mem ⟨_, hC, rfl⟩) hC (Function.invFunOn_eq ⟨_, hC, rfl⟩) + let R : β → RootedHypergraph α β := fun g ↦ heartPart Q' (e' '' part (inv g)) (inv g) + have hsubE : ∀ C, e' '' part C ⊆ Q'.G.edgeSet := by + rintro C _ ⟨L, hL, rfl⟩ + rw [hQ'.edgeSet_eq_image hfine'] + exact ⟨L, hL.1, rfl⟩ + have hRE : ∀ C, (heartPart Q' (e' '' part C) C).edgeSet = e' '' part C := fun C ↦ + inter_eq_left.mpr (hsubE C) + have hRV : ∀ {C}, C ∈ ℒ → (heartPart Q' (e' '' part C) C).vertexSet = C.rootSet := by + intro C hC + refine subset_antisymm ?_ subset_union_left + rintro v (h | ⟨_, ⟨L, hL, rfl⟩, hinc⟩) + · exact h + · obtain ⟨-, i, rfl⟩ := hpart hL + obtain ⟨L', hL', h₁, h₂⟩ := (hQ'.inc_iff hfine').mp hinc + have := he' hL' hL.1 h₁ + subst this + exact (mem_piece_rootSet.mp h₂).1 + have hRle : ∀ {C}, C ∈ ℒ → (heartPart Q' (e' '' part C) C).toHypergraph ≤ Q'.G.toHypergraph := by + intro C hC + refine ⟨?_, inter_subset_right, fun f hf ↦ ?_⟩ + · intro v hv + rw [hRV hC] at hv + rw [hQ'.vertexSet_eq, core_splitSet hS] + exact root_mem_core hloc hC hv + · ext v + exact ⟨fun h ↦ ⟨hf.1, h⟩, fun h ↦ h.2⟩ + refine ⟨?_, hQ'.roots_eq.trans hQ.roots_eq.symm |>.symm, ?_, ?_, R, ?_, ?_, ?_, ?_⟩ + · rw [hQ.vertexSet_eq, hQ'.vertexSet_eq, core_splitSet hS] + · rw [hQ.dom_eq_image hfine, hQ.edgeSet_eq_image hfine] + · rw [hQ'.dom_eq_image hfine', hQ'.edgeSet_eq_image hfine'] + · intro g hg + rw [hQ.edgeSet_eq_image hfine] at hg + obtain ⟨C, hC, rfl⟩ := hg + simp only [R, hinv hC] + refine ⟨hRle hC, ?_, ?_⟩ + · rw [hRV hC, hQ.ends_newEdge hC] + · rw [hQ.μ_newEdge hC] + rfl + · rw [hQ'.edgeSet_eq_image hfine'] + ext f + simp only [mem_iUnion, exists_prop] + constructor + · rintro ⟨g, -, hf⟩ + obtain ⟨⟨L, hL, rfl⟩, -⟩ := hf + exact ⟨L, hL.1, rfl⟩ + · rintro ⟨L, hL, rfl⟩ + have hC := (hown L hL).1 + refine ⟨e (own L), ?_, ?_⟩ + · rw [hQ.edgeSet_eq_image hfine] + exact ⟨_, hC, rfl⟩ + · have hR : R (e (own L)) = heartPart Q' (e' '' part (own L)) (own L) := by + simp only [R, hinv hC] + rw [hR, hRE] + exact ⟨L, ⟨hL, rfl⟩, rfl⟩ + · intro g hg g' hg' hne + rw [hQ.edgeSet_eq_image hfine] at hg hg' + obtain ⟨C, hC, rfl⟩ := hg + obtain ⟨C', hC', rfl⟩ := hg' + have hCC : C ≠ C' := fun h ↦ hne (by rw [h]) + simp only [R, hinv hC, hinv hC', hRE] + rw [Set.disjoint_left] + rintro _ ⟨L, hL, rfl⟩ ⟨L', hL', heq⟩ + have := he' hL'.1 hL.1 heq + subst this + exact hCC (hL.2.symm.trans hL'.2) + · intro g hg K hK + rw [hQ.edgeSet_eq_image hfine] at hg + obtain ⟨C, hC, rfl⟩ := hg + have hK' : IsFeasibleGrouping (P.restrict C) K := by + rw [hQ.Δ_newEdge hC] at hK + exact hK + have hR : R (e C) = heartPart Q' (e' '' part C) C := by + simp only [R, hinv hC] + rw [hR] + have hcC := hloc.isComplemented hC + refine feasible_of_split (C := C) (R := heartPart Q' (e' '' part C) C) rfl (hRE C) (hRle hC) ?_ + (he'.mono fun L hL ↦ hL.1) hcC.le ?_ ?_ ?_ ?_ (hRV hC) hK' + · exact fun L hL ↦ hQ'.Δ_newEdge hL.1 + · intro L hL + obtain ⟨-, i, rfl⟩ := hpart hL + exact inter_le_left hcC.le (hS.le i) + · intro L hL v + obtain ⟨-, i, rfl⟩ := hpart hL + rw [mem_piece_rootSet] + exact and_congr_right fun hv ↦ ⟨fun h ↦ ⟨C.roots_subset v hv, h⟩, fun h ↦ h.2⟩ + · intro L hL L' hL' hLL v hv hv' + obtain ⟨-, i, rfl⟩ := hpart hL + obtain ⟨-, j, rfl⟩ := hpart hL' + have hij : i ≠ j := fun h ↦ hLL (by rw [h]) + exact mem_piece_rootSet.mpr ⟨hS.sep C hC i j hij v hv.1 hv.2 hv'.2, hv.2⟩ + · intro f hf + obtain ⟨i, hi⟩ := hS.cover_e f (hcC.le.edgeSet_subset hf) + have hL : piece C (A i) ∈ splitSet ℒ A := ⟨C, hC, i, rfl⟩ + refine ⟨piece C (A i), ⟨hL, ?_⟩, hf, hi⟩ + obtain ⟨hown₁, j, hj⟩ := hown _ hL + by_contra hCC + have key : ∀ X, X = piece (own (piece C (A i))) (A j) → f ∈ X.edgeSet → + f ∈ (own (piece C (A i))).edgeSet := by + rintro _ rfl h + exact h.1 + have hf' := key _ hj ⟨hf, hi⟩ + exact ((hloc.le_complement hC hown₁ (Ne.symm hCC)).edgeSet_subset hf).2 hf' + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section5g.lean b/LeanPool/GraphMinor/GM20/Section5g.lean new file mode 100644 index 0000000000..7e3d01a5ef --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section5g.lean @@ -0,0 +1,317 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section5f + +/-! +# Graph Minors XX, Section 5, (5.4) + +Now each member of `ℒ` is cut along the separations of `ℳ(𝒯, W, θ)`, using `(A_i : 1 ≤ i ≤ k)` and +`A_0 = G⁻ ∩ B_1 ∩ ⋯ ∩ B_k`. The new location is still `W`-suitable, and its members each lie on one +side of each member of `ℳ(𝒯, W, θ)`. The heart of the old location is a condensation of the new +heart, so (4.10) applies. + +We ask for `β` to be infinite, since the new location may have more members than the old one and the +new heart needs one new edge for each. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v w + +variable {α : Type u} {β : Type v} + +/-- The hypergraph `A_0 = G⁻ ∩ B_1 ∩ ⋯ ∩ B_k`, for `ℳ = {(A_i, B_i)}`. -/ +def commonPart (G : Hypergraph α β) (ℳ : Set (Hypergraph α β × Hypergraph α β)) : + Hypergraph α β where + vertexSet := {v ∈ G.vertexSet | ∀ p ∈ ℳ, v ∈ p.2.vertexSet} + edgeSet := {e ∈ G.edgeSet | ∀ p ∈ ℳ, e ∈ p.2.edgeSet} + Inc e v := e ∈ {e ∈ G.edgeSet | ∀ p ∈ ℳ, e ∈ p.2.edgeSet} ∧ G.Inc e v ∧ + v ∈ {v ∈ G.vertexSet | ∀ p ∈ ℳ, v ∈ p.2.vertexSet} + vertex_mem_of_inc _ _ h := h.2.2 + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := G.vertexSet_finite.subset fun _ h ↦ h.1 + edgeSet_finite := G.edgeSet_finite.subset fun _ h ↦ h.1 + +section + +variable {G : Hypergraph α β} {ℳ : Set (Hypergraph α β × Hypergraph α β)} + +theorem commonPart_le (h : ∀ p ∈ ℳ, p.2 ≤ G) : commonPart G ℳ ≤ G := by + refine ⟨fun _ hv ↦ hv.1, fun _ he ↦ he.1, fun e he ↦ ?_⟩ + ext v + constructor + · intro hinc + refine ⟨he, hinc, G.vertex_mem_of_inc hinc, fun p hp ↦ ?_⟩ + have h₁ : v ∈ G.ends e := hinc + rw [(h p hp).ends_eq e (he.2 p hp)] at h₁ + exact p.2.vertex_mem_of_inc h₁ + · exact fun h' ↦ h'.2.1 + +theorem le_commonPart {X : Hypergraph α β} (h : ∀ p ∈ ℳ, p.2 ≤ G) (hX : X ≤ G) + (hle : ∀ p ∈ ℳ, X ≤ p.2) : X ≤ commonPart G ℳ := by + rw [le_iff_of_le hX (commonPart_le h)] + exact ⟨fun v hv ↦ ⟨hX.vertexSet_subset hv, fun p hp ↦ (hle p hp).vertexSet_subset hv⟩, + fun e he ↦ ⟨hX.edgeSet_subset he, fun p hp ↦ (hle p hp).edgeSet_subset he⟩⟩ + +end + +/-- The family `(A_i : 0 ≤ i ≤ k)`. -/ +def splitParts (G : Hypergraph α β) (ℳ : Set (Hypergraph α β × Hypergraph α β)) : + Option ℳ → Hypergraph α β + | none => commonPart G ℳ + | some p => p.1.1 + +theorem IsSeparation.not_mem_of_mem {G A B : Hypergraph α β} (h : G.IsSeparation A B) {e : β} + (he : e ∈ A.edgeSet) : e ∉ B.edgeSet := fun he' ↦ by + have : e ∈ (A ∩ B).edgeSet := ⟨he, he'⟩ + rw [h.edgeSet_inter_eq] at this + exact this + +variable {Λ : Type*} [LinearOrder Λ] {lam : Hypergraph α β × Hypergraph α β → Λ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {W : Set (α ⊕ β)} {θ θ₀ : ℕ} + {G : RootedHypergraph α β} {ℒ : Set (RootedHypergraph α β)} + +/-- The sets `InM` of (5.4) give a `SplitFamily`. -/ +theorem splitFamily_splitParts (hTB : IsTieBreaker G.toHypergraph lam) + (h𝒯 : IsTangle G.toHypergraph θ₀ 𝒯) + (hV : ∀ ⦃A B⦄, InM lam G.toHypergraph 𝒯 W θ A B → ∀ C ∈ ℒ, + (A ∩ B).vertexSet ∩ C.vertexSet ⊆ C.rootSet) : + SplitFamily G ℒ (splitParts G.toHypergraph + {p | InM lam G.toHypergraph 𝒯 W θ p.1 p.2}) := by + classical + set ℳ : Set (Hypergraph α β × Hypergraph α β) := {p | InM lam G.toHypergraph 𝒯 W θ p.1 p.2} + with hℳ + have hsep : ∀ p ∈ ℳ, G.toHypergraph.IsSeparation p.1 p.2 := fun p hp ↦ h𝒯.isSeparation hp.1.1 + have hBle : ∀ p ∈ ℳ, p.2 ≤ G.toHypergraph := fun p hp ↦ (hsep p hp).right_le + have hle52 : ∀ p ∈ ℳ, ∀ q ∈ ℳ, p ≠ q → p.1 ≤ q.2 := fun p hp q hq hne ↦ + theorem_5_2_proof hTB h𝒯 hp hq hne + refine ⟨?_, ?_, ?_, ?_, ?_⟩ + · rintro (_ | ⟨p, hp⟩) + · exact commonPart_le hBle + · exact (hsep p hp).left_le + · intro v hv + by_cases h : ∀ p ∈ ℳ, v ∈ p.2.vertexSet + · exact ⟨none, hv, h⟩ + · push Not at h + obtain ⟨p, hp, hvp⟩ := h + have h₁ : v ∈ p.1.vertexSet ∪ p.2.vertexSet := by + rw [(hsep p hp).vertexSet_union] + exact hv + exact ⟨some ⟨p, hp⟩, h₁.resolve_right hvp⟩ + · intro e he + by_cases h : ∀ p ∈ ℳ, e ∈ p.2.edgeSet + · exact ⟨none, he, h⟩ + · push Not at h + obtain ⟨p, hp, hep⟩ := h + have h₁ : e ∈ p.1.edgeSet ∪ p.2.edgeSet := by + rw [(hsep p hp).edgeSet_union] + exact he + exact ⟨some ⟨p, hp⟩, h₁.resolve_right hep⟩ + · rintro (_ | ⟨p, hp⟩) (_ | ⟨q, hq⟩) hij e he he' + · exact hij rfl + · exact IsSeparation.not_mem_of_mem (hsep q hq) he' (he.2 q hq) + · exact IsSeparation.not_mem_of_mem (hsep p hp) he (he'.2 p hp) + · have hpq : p ≠ q := fun h ↦ hij (by subst h; rfl) + exact IsSeparation.not_mem_of_mem (hsep q hq) he' + ((hle52 p hp q hq hpq).edgeSet_subset he) + · rintro C hC (_ | ⟨p, hp⟩) (_ | ⟨q, hq⟩) hij v hvC hv hv' + · exact absurd rfl hij + · exact hV (A := q.1) (B := q.2) hq C hC ⟨⟨hv', hv.2 q hq⟩, hvC⟩ + · exact hV (A := p.1) (B := p.2) hp C hC ⟨⟨hv, hv'.2 p hp⟩, hvC⟩ + · have hpq : p ≠ q := fun h ↦ hij (by subst h; rfl) + exact hV (A := q.1) (B := q.2) hq C hC + ⟨⟨hv', (hle52 p hp q hq hpq).vertexSet_subset hv⟩, hvC⟩ + +/-- `ℒ'` lies in `𝒯` and is `W`-suitable, in the proof of (5.4). -/ +theorem isSuitable_splitSet (hTB : IsTieBreaker G.toHypergraph lam) + (h𝒯 : IsTangle G.toHypergraph θ₀ 𝒯) (hθ₀ : θ ^ 2 ≤ θ₀) + (hS : IsSuitable lam 𝒯 W θ G ℒ) + (hV : ∀ ⦃A B⦄, InM lam G.toHypergraph 𝒯 W θ A B → ∀ C ∈ ℒ, + (A ∩ B).vertexSet ∩ C.vertexSet ⊆ C.rootSet) + (hno : ∀ ⦃A B⦄, InM lam G.toHypergraph 𝒯 W θ A B → ∀ C ∈ ℒ, + ¬ (A ≤ C.toHypergraph ∧ complementHypergraph G C ≤ B)) : + IsSuitable lam 𝒯 W θ G (splitSet ℒ (splitParts G.toHypergraph + {p | InM lam G.toHypergraph 𝒯 W θ p.1 p.2})) := by + classical + have hF := splitFamily_splitParts hTB h𝒯 hV + set ℳ : Set (Hypergraph α β × Hypergraph α β) := {p | InM lam G.toHypergraph 𝒯 W θ p.1 p.2} + with hℳ + have hloc := hS.isRootedLocation + have hcomp : ∀ {C}, C ∈ ℒ → ∀ i, IsComplemented G (piece C (splitParts G.toHypergraph ℳ i)) := + fun hC i ↦ isComplemented_piece hF hloc hC i + have hsep : ∀ p ∈ ℳ, G.toHypergraph.IsSeparation p.1 p.2 := fun p hp ↦ h𝒯.isSeparation hp.1.1 + have hBle : ∀ p ∈ ℳ, p.2 ≤ G.toHypergraph := fun p hp ↦ (hsep p hp).right_le + have hordC : ∀ {X}, X ∈ ℒ → + separationOrder X.toHypergraph (complementHypergraph G X) < θ ^ 2 := fun hX ↦ + separationOrder_complement_le.trans_lt (hS.order_lt hX) + refine + { isRootedLocation := isRootedLocation_splitSet hF hloc + fine := isFine_splitSet hF hS.fine + subset := ?_ + order_lt := ?_ + distinction := ?_ } + · rintro _ ⟨_, ⟨C, hC, i, rfl⟩, rfl⟩ + have hCT : (C.toHypergraph, complementHypergraph G C) ∈ 𝒯 := hS.subset ⟨C, hC, rfl⟩ + have hL := hcomp hC i + have hc := hloc.isComplemented hC + have hlt : separationOrder (piece C (splitParts G.toHypergraph ℳ i)).toHypergraph + (complementHypergraph G (piece C (splitParts G.toHypergraph ℳ i))) < θ₀ := + separationOrder_complement_le.trans_lt + (((ncard_piece_rootSet_le _ _).trans_lt (hS.order_lt hC)).trans_le hθ₀) + rcases h𝒯.axiom1 (isSeparation_complement hL) hlt with h | h + · exact h + · exact (not_le_of_mem_tangle h𝒯 h hCT (complementHypergraph_le_piece hc hL)).elim + · rintro _ ⟨C, hC, i, rfl⟩ + exact (ncard_piece_rootSet_le _ _).trans_lt (hS.order_lt hC) + · rintro θ' 𝒯' h𝒯' hθ' C' D' ⟨_, ⟨C, hC, h, rfl⟩, heq⟩ hD a b hd + obtain ⟨rfl, rfl⟩ := Prod.mk.inj heq + have hL := hcomp hC h + have hc := hloc.isComplemented hC + have hDC : (complementHypergraph G C, C.toHypergraph) ∈ 𝒯' := + mem_tangle_of_le h𝒯' (isSeparation_complement hc) ((hordC hC).trans_le hθ') hD + (complementHypergraph_le_piece hc hL) + by_cases hstar : ∃ A' B', InM lam G.toHypergraph 𝒯 W θ A' B' ∧ a ≤ A' ∧ B' ≤ b + · exact Or.inr hstar + obtain ⟨hac, hcb⟩ : a ≤ C.toHypergraph ∧ complementHypergraph G C ≤ b := by + rcases hS.distinction h𝒯' hθ' ⟨C, hC, rfl⟩ hDC hd with h' | h' + · exact h' + · exact absurd h' hstar + have hside : ∀ p ∈ ℳ, a ≤ p.2 ∧ p.1 ≤ b := by + intro p hp + rcases theorem_5_1_proof hTB h𝒯 h𝒯' (C := p.1) (D := p.2) hp hd with h' | h' | h' + · exact absurd ⟨p.1, p.2, hp, h'⟩ hstar + · exact h' + · exact absurd ⟨h'.1.trans hac, hcb.trans h'.2⟩ (hno (A := p.1) (B := p.2) hp C hC) + have haG : a ≤ G.toHypergraph := (h𝒯.isSeparation hd.1.1).left_le + have hbG : b ≤ G.toHypergraph := (h𝒯.isSeparation hd.1.1).right_le + -- The piece is not inside `b`, so it is the piece of `A_0`. + have hnotb : ¬ (piece C (splitParts G.toHypergraph ℳ h)).toHypergraph ≤ b := fun hle ↦ + not_le_of_mem_tangle h𝒯' hd.1.2 hD hle + rcases h with _ | ⟨p, hp⟩ + · refine Or.inl ⟨?_, ?_⟩ + · have ha₀ := le_commonPart hBle haG fun p hp ↦ (hside p hp).1 + exact (le_iff_of_le haG (inter_le hc.le (commonPart_le hBle))).mpr + ⟨fun v hv ↦ ⟨hac.vertexSet_subset hv, ha₀.vertexSet_subset hv⟩, + fun e he ↦ ⟨hac.edgeSet_subset he, ha₀.edgeSet_subset he⟩⟩ + · rw [le_iff_of_le (complementHypergraph_le hL) hbG] + refine ⟨?_, ?_⟩ + · rintro v (⟨hvG, hv⟩ | ⟨hvG, hv⟩) + · by_cases hvC : v ∈ C.vertexSet + · have hv₀ : v ∉ (commonPart G.toHypergraph ℳ).vertexSet := fun h' ↦ hv ⟨hvC, h'⟩ + have : ¬ ∀ p ∈ ℳ, v ∈ p.2.vertexSet := fun h' ↦ hv₀ ⟨hvG, h'⟩ + push Not at this + obtain ⟨p, hp, hvp⟩ := this + have h₁ : v ∈ p.1.vertexSet ∪ p.2.vertexSet := by + rw [(hsep p hp).vertexSet_union] + exact hvG + exact (hside p hp).2.vertexSet_subset (h₁.resolve_right hvp) + · exact hcb.vertexSet_subset (Or.inl ⟨hvG, hvC⟩) + · exact hcb.vertexSet_subset (Or.inr ⟨hvG, (mem_piece_rootSet.mp hv).1⟩) + · rintro e ⟨heG, he⟩ + by_cases heC : e ∈ C.edgeSet + · have he₀ : e ∉ (commonPart G.toHypergraph ℳ).edgeSet := fun h' ↦ he ⟨heC, h'⟩ + have : ¬ ∀ p ∈ ℳ, e ∈ p.2.edgeSet := fun h' ↦ he₀ ⟨heG, h'⟩ + push Not at this + obtain ⟨p, hp, hep⟩ := this + have h₁ : e ∈ p.1.edgeSet ∪ p.2.edgeSet := by + rw [(hsep p hp).edgeSet_union] + exact heG + exact (hside p hp).2.edgeSet_subset (h₁.resolve_right hep) + · exact hcb.edgeSet_subset ⟨heG, heC⟩ + · exact absurd ((inter_le_right hc.le (hsep p hp).left_le).trans (hside p hp).2) hnotb + +/-- Graph Minors XX, (5.4) (page 339): +"**5.4.** *Let $\mathcal{F}$ be a well-behaved set of patchworks, and let $\theta \ge 1$. Then there +is a well-behaved set of patchworks $\mathcal{F}'$ with the following property. Let $P = (G, \mu, +\Delta)$ be a patchwork, let $\lambda$ be a tie-breaker in $G$, let $\mathcal{T}$ be a tangle in $G$ +of order $\ge \theta^2$, and let $W \subseteq Z(G)$ with $|W| \le \theta$. Suppose that:* +* *$P$ is removable,* +* *$\mathcal{L}$ is a $W$-suitable rooted location in $G$, such that $\mathcal{F}$ contains a heart + of $(P, \mathcal{L})$,* +* *for each $(A^*, B^*) \in \mathcal{M}(\mathcal{T}, W, \theta)$,* + * *$V(A^* \cap B^*) \cap V(C) \subseteq \bar{\pi}(C)$ for each $C \in \mathcal{L}$, and* + * *there is no $(C, D) \in \mathcal{L}^-$ with $A^* \subseteq C$ and $D \subseteq B^*$.* +*Then there is a $W$-suitable rooted location $\mathcal{L}'$ in $G$ such that $\mathcal{F}'$ +contains a heart of $(P, \mathcal{L}')$, and for each $C \in \mathcal{L}'$ and each $(A^*, B^*) \in +\mathcal{M}(\mathcal{T}, W, \theta)$, either $C^- \subseteq A^*$ and $B^* \subseteq (G \setminus +C)^-$, or $C^- \subseteq B^*$ and $A^* \subseteq (G \setminus C)^-$.*" + +Lean uses an infinite ambient edge type to provide fresh edge labels. Under the remaining +hypotheses, the Lean statement applies to every natural number `θ` and every `W`, including +the printed case `1 ≤ θ`, `W ⊆ zSet P.G.toHypergraph` and `W.ncard ≤ θ`. -/ +theorem theorem_5_4_proof [Infinite β] {𝓕 : Set (UnlabeledPatchwork α β)} (h𝓕 : WellBehaved 𝓕) + (θ : ℕ) : + ∃ 𝓕' : Set (UnlabeledPatchwork α β), WellBehaved 𝓕' ∧ + ∀ (P : UnlabeledPatchwork α β) (Λ : Type w) [LinearOrder Λ] + (lam : Hypergraph α β × Hypergraph α β → Λ) (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (θ₀ : ℕ) (W : Set (α ⊕ β)) (ℒ : Set (RootedHypergraph α β)), + IsTieBreaker P.G.toHypergraph lam → IsTangle P.G.toHypergraph θ₀ 𝒯 → θ ^ 2 ≤ θ₀ → + P.IsRemovable → IsSuitable lam 𝒯 W θ P.G ℒ → (∃ Q ∈ 𝓕, HasPatchworkHeart P ℒ Q) → + (∀ ⦃A B⦄, InM lam P.G.toHypergraph 𝒯 W θ A B → + (∀ C ∈ ℒ, (A ∩ B).vertexSet ∩ C.vertexSet ⊆ C.rootSet) ∧ + ∀ C ∈ ℒ, ¬ (A ≤ C.toHypergraph ∧ complementHypergraph P.G C ≤ B)) → + ∃ ℒ' : Set (RootedHypergraph α β), IsSuitable lam 𝒯 W θ P.G ℒ' ∧ + (∃ Q ∈ 𝓕', HasPatchworkHeart P ℒ' Q) ∧ + ∀ C ∈ ℒ', ∀ ⦃A B⦄, InM lam P.G.toHypergraph 𝒯 W θ A B → + (C.toHypergraph ≤ A ∧ B ≤ complementHypergraph P.G C) ∨ + (C.toHypergraph ≤ B ∧ A ≤ complementHypergraph P.G C) := by + classical + have hrem : WellBehaved {P ∈ 𝓕 | P.IsRemovable} := h𝓕.mono fun _ h ↦ h.1 + refine ⟨{P₂ | ∃ P₁ ∈ {P ∈ 𝓕 | P.IsRemovable}, IsCondensation P₁ P₂}, + theorem_4_10_proof hrem (fun _ h ↦ h.2) (fun _ h ↦ h), ?_⟩ + intro P Λ _ lam 𝒯 θ₀ W ℒ hTB h𝒯 hθ₀ hremP hS hheart hM + obtain ⟨Q, hQ, e, hQe⟩ := hheart + have hV : ∀ ⦃A B⦄, InM lam P.G.toHypergraph 𝒯 W θ A B → ∀ C ∈ ℒ, + (A ∩ B).vertexSet ∩ C.vertexSet ⊆ C.rootSet := fun _ _ h ↦ (hM h).1 + have hF := splitFamily_splitParts hTB h𝒯 hV + have hfinM := finite_inM (lam := lam) (W := W) (θ := θ) h𝒯 + have : Finite {p : Hypergraph α β × Hypergraph α β | + InM lam P.G.toHypergraph 𝒯 W θ p.1 p.2} := hfinM + obtain ⟨Q', hQ', hcond⟩ := exists_condensation hF hS.fine hQe + refine ⟨_, isSuitable_splitSet hTB h𝒯 hθ₀ hS hV (fun _ _ h ↦ (hM h).2), + ⟨Q', ⟨Q, ⟨hQ, heart_isRemovable hremP hS.fine hQe⟩, hcond⟩, hQ'⟩, ?_⟩ + have hloc := hS.isRootedLocation + rintro _ ⟨C, hC, i, rfl⟩ A B hAB + have hc := hloc.isComplemented hC + have hL := isComplemented_piece hF hloc hC i + have hsep : P.G.toHypergraph.IsSeparation A B := h𝒯.isSeparation hAB.1.1 + have hle52 : ∀ {A' B'}, InM lam P.G.toHypergraph 𝒯 W θ A' B' → (A', B') ≠ (A, B) → A' ≤ B := + fun h hne ↦ theorem_5_2_proof hTB h𝒯 h hAB hne + by_cases hi : i = some ⟨(A, B), hAB⟩ + · subst hi + refine Or.inl ⟨inter_le_right hc.le hsep.left_le, ?_⟩ + refine le_complementHypergraph_piece hL hsep.right_le ?_ ?_ + · exact fun e he he' ↦ IsSeparation.not_mem_of_mem hsep he'.2 he + · exact fun v hv hv' ↦ (hM hAB).1 C hC ⟨⟨hv'.2, hv⟩, hv'.1⟩ + · have hAi : (splitParts P.G.toHypergraph {p | InM lam P.G.toHypergraph 𝒯 W θ p.1 p.2} i) ≤ B + := by + rcases i with _ | ⟨⟨A', B'⟩, hp⟩ + · have hBle : ∀ p ∈ {p : Hypergraph α β × Hypergraph α β | + InM lam P.G.toHypergraph 𝒯 W θ p.1 p.2}, p.2 ≤ P.G.toHypergraph := fun p hp ↦ + (h𝒯.isSeparation hp.1.1).right_le + exact (le_iff_of_le (commonPart_le hBle) hsep.right_le).mpr + ⟨fun v hv ↦ hv.2 (A, B) hAB, fun e he ↦ he.2 (A, B) hAB⟩ + · refine hle52 hp fun h ↦ hi ?_ + obtain ⟨rfl, rfl⟩ := Prod.mk.inj h + rfl + have hLB : (piece C (splitParts P.G.toHypergraph + {p | InM lam P.G.toHypergraph 𝒯 W θ p.1 p.2} i)).toHypergraph ≤ B := + (inter_le_right hc.le (hF.le i)).trans hAi + refine Or.inr ⟨hLB, ?_⟩ + refine le_complementHypergraph_piece hL hsep.left_le ?_ ?_ + · exact fun e he he' ↦ IsSeparation.not_mem_of_mem hsep he (hLB.edgeSet_subset he') + · exact fun v hv hv' ↦ (hM hAB).1 C hC ⟨⟨hv, hLB.vertexSet_subset hv'⟩, hv'.1⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section5h.lean b/LeanPool/GraphMinor/GM20/Section5h.lean new file mode 100644 index 0000000000..fc3f37ccbf --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section5h.lean @@ -0,0 +1,234 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section5g + +/-! +# Tools for (5.5) of Graph Minors XX + +Here each member of `ℒ` lies on one side of each member of a set `ℳ` of separations. The location +`ℒ' = ℒ₁ ∪ {f(A, B) : (A, B) ∈ ℳ}` swallows each member of `ℒ` lying on the side `A` of some +`(A, B) ∈ ℳ`. This file does the part that needs no tangles: `ℒ'` is a fine rooted location, and its +heart is obtained from the heart of `ℒ` as in (4.13). + +A member of `ℒ` may lie on the small side of several members of `ℳ`, when it has no edges. Each such +member gets one owner in `ℳ`, as the edges of a rooted location in the heart must be disjoint. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +open Classical in +/-- The rooted hypergraph `f(A, B)`, with `f(A, B)⁻ = A` and `πBar(f(A, B)) = V(A ∩ B)`. -/ +noncomputable def sepRooted (A B : Hypergraph α β) : RootedHypergraph α β where + toHypergraph := A + roots := (A ∩ B).vertexSet_finite.toFinset.toList + roots_nodup := Finset.nodup_toList _ + roots_subset v hv := by + have h : v ∈ (A ∩ B).vertexSet := by simpa using hv + exact h.1 + +theorem mem_sepRooted_rootSet {A B : Hypergraph α β} {v : α} : + v ∈ (sepRooted A B).rootSet ↔ v ∈ (A ∩ B).vertexSet := by + classical + change v ∈ (A ∩ B).vertexSet_finite.toFinset.toList ↔ _ + simp + +/-- The data of (5.5). -/ +structure SideData (G : RootedHypergraph α β) (ℒ : Set (RootedHypergraph α β)) + (ℳ : Set (Hypergraph α β × Hypergraph α β)) : Prop where + rootless : G.rootSet = ∅ + sep : ∀ p ∈ ℳ, G.toHypergraph.IsSeparation p.1 p.2 + cross : ∀ p ∈ ℳ, ∀ q ∈ ℳ, p ≠ q → p.1 ≤ q.2 + loc : IsRootedLocation G ℒ + fine : IsFine G ℒ + side : ∀ C ∈ ℒ, ∀ p ∈ ℳ, (C.toHypergraph ≤ p.1 ∧ p.2 ≤ complementHypergraph G C) ∨ + (C.toHypergraph ≤ p.2 ∧ p.1 ≤ complementHypergraph G C) + inj : ∀ p ∈ ℳ, ∀ q ∈ ℳ, p.1 = q.1 → p = q + +/-- The set `ℒ₁`. -/ +def mainSet (G : RootedHypergraph α β) (ℒ : Set (RootedHypergraph α β)) + (ℳ : Set (Hypergraph α β × Hypergraph α β)) : Set (RootedHypergraph α β) := + {C ∈ ℒ | ¬ ∃ p ∈ ℳ, C.toHypergraph ≤ p.1 ∧ p.2 ≤ complementHypergraph G C} + +/-- The set `ℒ' = ℒ₁ ∪ {f(A, B) : (A, B) ∈ ℳ}`. -/ +noncomputable def sideSet (G : RootedHypergraph α β) (ℒ : Set (RootedHypergraph α β)) + (ℳ : Set (Hypergraph α β × Hypergraph α β)) : Set (RootedHypergraph α β) := + mainSet G ℒ ℳ ∪ (fun p ↦ sepRooted p.1 p.2) '' ℳ + +variable {G : RootedHypergraph α β} {ℒ : Set (RootedHypergraph α β)} + {ℳ : Set (Hypergraph α β × Hypergraph α β)} + +theorem isComplemented_sepRooted (hr : G.rootSet = ∅) {A B : Hypergraph α β} + (h : G.toHypergraph.IsSeparation A B) : IsComplemented G (sepRooted A B) := by + refine ⟨h.left_le, fun v _ hv ↦ ?_, fun v e hv he hinc ↦ ?_⟩ + · rw [hr] at hv + exact hv.elim + · refine mem_sepRooted_rootSet.mpr ⟨hv, ?_⟩ + have heB : e ∈ A.edgeSet ∪ B.edgeSet := by + rw [h.edgeSet_union] + exact he.1 + have heB' := heB.resolve_left he.2 + have h₁ : v ∈ G.ends e := hinc + rw [h.right_le.ends_eq e heB'] at h₁ + exact B.vertex_mem_of_inc h₁ + +theorem complementHypergraph_sepRooted (hr : G.rootSet = ∅) {A B : Hypergraph α β} + (h : G.toHypergraph.IsSeparation A B) : complementHypergraph G (sepRooted A B) = B := by + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq + (complementHypergraph_le (isComplemented_sepRooted hr h)) h.right_le ?_ ?_ + · ext v + constructor + · rintro (⟨h₁, h₂⟩ | ⟨h₁, h₂⟩) + · have : v ∈ A.vertexSet ∪ B.vertexSet := by + rw [h.vertexSet_union] + exact h₁ + exact this.resolve_left h₂ + · exact (mem_sepRooted_rootSet.mp h₂).2 + · intro hv + have hvG : v ∈ G.vertexSet := h.right_le.vertexSet_subset hv + by_cases hvA : v ∈ A.vertexSet + · exact Or.inr ⟨hvG, mem_sepRooted_rootSet.mpr ⟨hvA, hv⟩⟩ + · exact Or.inl ⟨hvG, hvA⟩ + · ext e + constructor + · rintro ⟨h₁, h₂⟩ + have : e ∈ A.edgeSet ∪ B.edgeSet := by + rw [h.edgeSet_union] + exact h₁ + exact this.resolve_left h₂ + · exact fun he ↦ ⟨h.right_le.edgeSet_subset he, fun he' ↦ + IsSeparation.not_mem_of_mem h he' he⟩ + +theorem mem_rootSet_of_le_complement {C : RootedHypergraph α β} {X : Hypergraph α β} + (hX : X ≤ complementHypergraph G C) {v : α} (hv : v ∈ X.vertexSet) (hvC : v ∈ C.vertexSet) : + v ∈ C.rootSet := by + rcases hX.vertexSet_subset hv with h | h + · exact absurd hvC h.2 + · exact h.2 + +namespace SideData + +variable (hD : SideData G ℒ ℳ) + +include hD + +theorem main_side {C} (hC : C ∈ mainSet G ℒ ℳ) {p} (hp : p ∈ ℳ) : + C.toHypergraph ≤ p.2 ∧ p.1 ≤ complementHypergraph G C := by + rcases hD.side C hC.1 p hp with h | h + · exact absurd ⟨p, hp, h⟩ hC.2 + · exact h + +theorem sep_notMem_main {p} (hp : p ∈ ℳ) : sepRooted p.1 p.2 ∉ mainSet G ℒ ℳ := fun h ↦ + h.2 ⟨p, hp, le_rfl, (complementHypergraph_sepRooted hD.rootless (hD.sep p hp)).ge⟩ + +theorem isComplemented {L} (hL : L ∈ sideSet G ℒ ℳ) : IsComplemented G L := by + rcases hL with h | ⟨p, hp, rfl⟩ + · exact hD.loc.isComplemented h.1 + · exact isComplemented_sepRooted hD.rootless (hD.sep p hp) + +theorem isRootedLocation : IsRootedLocation G (sideSet G ℒ ℳ) := by + refine ⟨fun _ h ↦ hD.isComplemented h, ?_⟩ + intro L₁ h₁ L₂ h₂ hne + rw [complement_toHypergraph] + rcases h₁ with h₁ | ⟨p, hp, rfl⟩ <;> rcases h₂ with h₂ | ⟨q, hq, rfl⟩ + · have := hD.loc.le_complement h₁.1 h₂.1 hne + rwa [complement_toHypergraph] at this + · rw [complementHypergraph_sepRooted hD.rootless (hD.sep q hq)] + exact (hD.main_side h₁ hq).1 + · exact (hD.main_side h₂ hp).2 + · rw [complementHypergraph_sepRooted hD.rootless (hD.sep q hq)] + exact hD.cross p hp q hq fun h ↦ hne (by rw [h]) + +theorem isFine : IsFine G (sideSet G ℒ ℳ) := by + refine ⟨fun v hv ↦ ?_, fun e he ↦ ?_⟩ + · obtain ⟨C, hC, hvC⟩ := hD.fine.1 v hv + by_cases hm : C ∈ mainSet G ℒ ℳ + · exact ⟨C, Or.inl hm, hvC⟩ + · have : ∃ p ∈ ℳ, C.toHypergraph ≤ p.1 ∧ p.2 ≤ complementHypergraph G C := by + by_contra hn + exact hm ⟨hC, hn⟩ + obtain ⟨p, hp, h₁, -⟩ := this + exact ⟨_, Or.inr ⟨p, hp, rfl⟩, h₁.vertexSet_subset hvC⟩ + · obtain ⟨C, hC, hvC⟩ := hD.fine.2 e he + by_cases hm : C ∈ mainSet G ℒ ℳ + · exact ⟨C, Or.inl hm, hvC⟩ + · have : ∃ p ∈ ℳ, C.toHypergraph ≤ p.1 ∧ p.2 ≤ complementHypergraph G C := by + by_contra hn + exact hm ⟨hC, hn⟩ + obtain ⟨p, hp, h₁, -⟩ := this + exact ⟨_, Or.inr ⟨p, hp, rfl⟩, h₁.edgeSet_subset hvC⟩ + +/-- `V(A ∩ B) ⊆ V(M(G, ℒ))`, since each member of `ℒ` lies on one side of `(A, B)`. -/ +theorem sep_mem_core {p} (hp : p ∈ ℳ) {v : α} (hv : v ∈ (p.1 ∩ p.2).vertexSet) : + v ∈ (rootedLocationCore G ℒ).vertexSet := by + refine mem_core_iff.mpr ⟨(hD.sep p hp).left_le.vertexSet_subset hv.1, fun C hC hvC ↦ ?_⟩ + rcases hD.side C hC p hp with h | h + · exact mem_rootSet_of_le_complement h.2 hv.2 hvC + · exact mem_rootSet_of_le_complement h.2 hv.1 hvC + +omit hD in +theorem core_subset : (rootedLocationCore G (sideSet G ℒ ℳ)).vertexSet ⊆ + (rootedLocationCore G ℒ).vertexSet := by + intro v hv + obtain ⟨hvG, hall⟩ := mem_core_iff.mp hv + refine mem_core_iff.mpr ⟨hvG, fun C hC hvC ↦ ?_⟩ + by_cases hm : C ∈ mainSet G ℒ ℳ + · exact hall C (Or.inl hm) hvC + · have : ∃ p ∈ ℳ, C.toHypergraph ≤ p.1 ∧ p.2 ≤ complementHypergraph G C := by + by_contra hn + exact hm ⟨hC, hn⟩ + obtain ⟨p, hp, h₁, h₂⟩ := this + have hr := hall _ (Or.inr ⟨p, hp, rfl⟩) (h₁.vertexSet_subset hvC) + exact mem_rootSet_of_le_complement h₂ (mem_sepRooted_rootSet.mp hr).2 hvC + +end SideData + +/-- A heart of a fine rooted location is active. -/ +theorem heart_isActive {P Q : UnlabeledPatchwork α β} {e : RootedHypergraph α β → β} + (hfine : IsFine P.G ℒ) (hQ : IsPatchworkHeart P ℒ e Q) : IsActive Q := by + intro v hv + rw [hQ.vertexSet_eq] at hv + obtain ⟨hvG, hall⟩ := mem_core_iff.mp hv + obtain ⟨C, hC, hvC⟩ := hfine.1 v hvG + refine ⟨e C, ?_, (hQ.inc_iff hfine).mpr ⟨C, hC, rfl, hall C hC hvC⟩⟩ + rw [hQ.dom_eq_image hfine] + exact ⟨C, hC, rfl⟩ + +/-- The set of the relation in (4.13): `P₂` comes from `P₁ ∈ 𝓕₁` by replacing at most `w` disjoint +parts by single edges with at most `k` ends. -/ +def locationReplaced (𝓕₁ : Set (UnlabeledPatchwork α β)) (k w : ℕ) : + Set (UnlabeledPatchwork α β) := + {P₂ | ∃ F ⊆ P₂.dom, F.ncard ≤ w ∧ ∃ P₁ ∈ 𝓕₁, ∃ A : β → RootedHypergraph α β, + IsRootedLocation P₁.G (A '' F) ∧ P₂.G.roots = P₁.G.roots ∧ + P₂.G.toHypergraph.deleteEdges F = rootedLocationCore P₁.G (A '' F) ∧ + IsCompletionOf (P₁.restrict (P₂.G.deleteEdges F)) (P₂.deleteEdges F) ∧ + ∀ f ∈ F, (A f).roots = P₂.μ f ∧ (P₂.G.ends f).ncard ≤ k} + +theorem wellBehaved_locationReplaced {𝓕₁ : Set (UnlabeledPatchwork α β)} (h : WellBehaved 𝓕₁) + (ha : ∀ P ∈ 𝓕₁, IsActive P) (k w : ℕ) : WellBehaved (locationReplaced 𝓕₁ k w) := + theorem_4_13_proof h ha k w fun _ h ↦ h + +/-- A finite set has an injective map into an infinite type which avoids a given finite set. -/ +theorem exists_injOn_avoid {γ δ : Type*} [Infinite δ] {s : Set γ} (hs : s.Finite) {T : Set δ} + (hT : T.Finite) : ∃ f : γ → δ, InjOn f s ∧ ∀ x, f x ∉ T := by + have : Infinite (Tᶜ : Set δ) := hT.infinite_compl.to_subtype + have : Nonempty (Tᶜ : Set δ) := inferInstance + obtain ⟨f, hf⟩ := exists_injOn_of_finite (δ := (Tᶜ : Set δ)) hs + exact ⟨fun x ↦ (f x).1, fun x hx y hy h ↦ hf hx hy (Subtype.ext h), fun x ↦ (f x).2⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section5i.lean b/LeanPool/GraphMinor/GM20/Section5i.lean new file mode 100644 index 0000000000..5ecca1ebdf --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section5i.lean @@ -0,0 +1,311 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section5h + +/-! +# The heart in (5.5) of Graph Minors XX + +The heart of `ℒ' = ℒ₁ ∪ {f(A, B) : (A, B) ∈ ℳ}` comes from the heart `Q` of `ℒ` by replacing, for +each `(A, B) ∈ ℳ`, the edges `e(C)` of the members `C` that lie in `A` by one edge with ends `V(A ∩ +B)`. +So (4.13) applies. The proof below gives the rooted location in `Q` that (4.13) asks for. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +variable {ℒ : Set (RootedHypergraph α β)} {ℳ : Set (Hypergraph α β × Hypergraph α β)} + +private theorem deleted_heart_core_sets + {P Q Q' : UnlabeledPatchwork α β} {e e' : RootedHypergraph α β → β} + (hD : SideData P.G ℒ ℳ) (hQ : IsPatchworkHeart P ℒ e Q) + (hQ' : IsPatchworkHeart P (sideSet P.G ℒ ℳ) e' Q') {F : Set β} + {own : RootedHypergraph α β → Hypergraph α β × Hypergraph α β} + (hown : ∀ C, C ∈ ℒ → C ∉ mainSet P.G ℒ ℳ → + own C ∈ ℳ ∧ C.toHypergraph ≤ (own C).1 ∧ + (own C).2 ≤ complementHypergraph P.G C) : + let part (p : Hypergraph α β × Hypergraph α β) : Set (RootedHypergraph α β) := + {C ∈ ℒ | C ∉ mainSet P.G ℒ ℳ ∧ own C = p} + let Ap (p : Hypergraph α β × Hypergraph α β) : RootedHypergraph α β := + heartPart Q (e '' part p) (sepRooted p.1 p.2) + (∀ {p}, p ∈ ℳ → (Ap p).vertexSet ⊆ p.1.vertexSet) → + (∀ p, (Ap p).edgeSet = e '' part p) → + (∀ {p}, p ∈ ℳ → ∀ {C}, C ∈ ℒ → C ∉ part p → C.toHypergraph ≤ p.2) → + (∀ {g}, g ∈ Q'.G.edgeSet \ F ↔ ∃ C ∈ mainSet P.G ℒ ℳ, e C = g) → + (Q'.G.deleteEdges F).vertexSet = (rootedLocationCore Q.G (Ap '' ℳ)).vertexSet ∧ + (Q'.G.deleteEdges F).edgeSet = (rootedLocationCore Q.G (Ap '' ℳ)).edgeSet := by + classical + intro part Ap hApV hApE hother hedge' + have hfine := hD.fine + let f : Hypergraph α β × Hypergraph α β → RootedHypergraph α β := fun p ↦ sepRooted p.1 p.2 + have hcoreV : (Q'.G.deleteEdges F).vertexSet = + (rootedLocationCore Q.G (Ap '' ℳ)).vertexSet := by + change Q'.G.vertexSet = _ + rw [hQ'.vertexSet_eq] + ext v + rw [mem_core_iff, mem_core_iff] + constructor + · rintro ⟨hvG, hall⟩ + have hvc : v ∈ (rootedLocationCore P.G ℒ).vertexSet := + SideData.core_subset (mem_core_iff.mpr ⟨hvG, hall⟩) + refine ⟨by rw [hQ.vertexSet_eq]; exact hvc, ?_⟩ + rintro _ ⟨p, hp, rfl⟩ hv + exact hall (f p) (Or.inr ⟨p, hp, rfl⟩) (hApV hp hv) + · rintro ⟨hvQ, hall⟩ + rw [hQ.vertexSet_eq] at hvQ + obtain ⟨hvG, hrt⟩ := mem_core_iff.mp hvQ + refine ⟨hvG, ?_⟩ + rintro L (hL | ⟨p, hp, rfl⟩) hvL + · exact hrt L hL.1 hvL + · obtain ⟨C, hC, hvC⟩ := hfine.1 v hvG + have hvr := hrt C hC hvC + by_cases hCp : C ∈ part p + · refine hall (Ap p) ⟨p, hp, rfl⟩ (Or.inr ⟨e C, ⟨C, hCp, rfl⟩, ?_⟩) + exact (hQ.inc_iff hfine).mpr ⟨C, hC, rfl, hvr⟩ + · exact mem_sepRooted_rootSet.mpr ⟨hvL, + (hother hp hC hCp).vertexSet_subset hvC⟩ + have hcoreE : (Q'.G.deleteEdges F).edgeSet = + (rootedLocationCore Q.G (Ap '' ℳ)).edgeSet := by + ext g + rw [mem_core_edgeSet] + change g ∈ Q'.G.edgeSet \ F ↔ _ + rw [hedge', hQ.edgeSet_eq_image hfine] + constructor + · rintro ⟨C, hC, rfl⟩ + refine ⟨⟨C, hC.1, rfl⟩, ?_⟩ + rintro _ ⟨p, hp, rfl⟩ hg + rw [hApE] at hg + obtain ⟨C', hC', heq⟩ := hg + have := hQ.injOn_newEdge hC'.1 hC.1 heq + subst this + exact hC'.2.1 hC + · rintro ⟨⟨C, hC, rfl⟩, hall⟩ + refine ⟨C, ⟨hC, ?_⟩, rfl⟩ + intro hex + have hm : C ∉ mainSet P.G ℒ ℳ := fun h ↦ h.2 hex + have hp := (hown C hC hm).1 + refine hall _ ⟨own C, hp, rfl⟩ ?_ + rw [hApE] + exact ⟨C, ⟨hC, hm, rfl⟩, rfl⟩ + exact ⟨hcoreV, hcoreE⟩ + +/-- If `(P, ℒ)` has heart `Q` then `(P, ℒ')` has a heart got from `Q` as in (4.13). -/ +theorem exists_sideSet_heart [Infinite β] {P Q : UnlabeledPatchwork α β} + {e : RootedHypergraph α β → β} (hD : SideData P.G ℒ ℳ) (hQ : IsPatchworkHeart P ℒ e Q) + (hfinM : ℳ.Finite) {k : ℕ} (hk : ∀ p ∈ ℳ, separationOrder p.1 p.2 ≤ k) : + ∃ Q', HasPatchworkHeart P (sideSet P.G ℒ ℳ) Q' ∧ + Q' ∈ locationReplaced {Q} k ℳ.ncard := by + classical + have hfine := hD.fine + have hfin : ℒ.Finite := hQ.finite hfine + have hfine' := hD.isFine + have hloc' := hD.isRootedLocation + have hne : Nonempty (RootedHypergraph α β) := ⟨P.G⟩ + let f : Hypergraph α β × Hypergraph α β → RootedHypergraph α β := fun p ↦ sepRooted p.1 p.2 + have hfinj : InjOn f ℳ := fun p hp q hq h ↦ hD.inj p hp q hq (congrArg (·.toHypergraph) h) + have hmainfin : (mainSet P.G ℒ ℳ).Finite := hfin.subset fun _ h ↦ h.1 + obtain ⟨fresh, hfresh, havoid⟩ := exists_injOn_avoid (δ := β) (hfinM.image f) + (hmainfin.image e) + let e' : RootedHypergraph α β → β := fun L ↦ if L ∈ mainSet P.G ℒ ℳ then e L else fresh L + have he₁ : ∀ {C}, C ∈ mainSet P.G ℒ ℳ → e' C = e C := fun hC ↦ ite_eq_left hC + have he₂ : ∀ {p}, p ∈ ℳ → e' (f p) = fresh (f p) := fun hp ↦ ite_eq_right (hD.sep_notMem_main hp) + have hinj' : InjOn e' (sideSet P.G ℒ ℳ) := by + rintro L₁ (h₁ | ⟨p, hp, rfl⟩) L₂ (h₂ | ⟨q, hq, rfl⟩) heq + · rw [he₁ h₁, he₁ h₂] at heq + exact hQ.injOn_newEdge h₁.1 h₂.1 heq + · rw [he₁ h₁, he₂ hq] at heq + exact absurd (heq ▸ ⟨L₁, h₁, rfl⟩) (havoid (f q)) + · rw [he₂ hp, he₁ h₂] at heq + exact absurd (heq ▸ ⟨L₂, h₂, rfl⟩) (havoid (f p)) + · rw [he₂ hp, he₂ hq] at heq + exact hfresh ⟨p, hp, rfl⟩ ⟨q, hq, rfl⟩ heq + have hfinS : (sideSet P.G ℒ ℳ).Finite := hmainfin.union (hfinM.image f) + obtain ⟨Q', hQ'⟩ := exists_heart hloc' hfine' hfinS hinj' + refine ⟨Q', ⟨e', hQ'⟩, ?_⟩ + -- Each member of `ℒ` outside `ℒ₁` has one owner. + have hown : ∀ C, ∃ p : Hypergraph α β × Hypergraph α β, C ∈ ℒ → C ∉ mainSet P.G ℒ ℳ → + p ∈ ℳ ∧ C.toHypergraph ≤ p.1 ∧ p.2 ≤ complementHypergraph P.G C := by + intro C + by_cases h : C ∈ ℒ ∧ C ∉ mainSet P.G ℒ ℳ + · have : ∃ p ∈ ℳ, C.toHypergraph ≤ p.1 ∧ p.2 ≤ complementHypergraph P.G C := by + by_contra hn + exact h.2 ⟨h.1, hn⟩ + obtain ⟨p, hp⟩ := this + exact ⟨p, fun _ _ ↦ hp⟩ + · exact ⟨(P.G.toHypergraph, P.G.toHypergraph), fun h₁ h₂ ↦ absurd ⟨h₁, h₂⟩ h⟩ + choose own hown using hown + let part : Hypergraph α β × Hypergraph α β → Set (RootedHypergraph α β) := + fun p ↦ {C ∈ ℒ | C ∉ mainSet P.G ℒ ℳ ∧ own C = p} + let Ap : Hypergraph α β × Hypergraph α β → RootedHypergraph α β := + fun p ↦ heartPart Q (e '' part p) (f p) + have hsubE : ∀ p, e '' part p ⊆ Q.G.edgeSet := by + rintro p _ ⟨C, hC, rfl⟩ + rw [hQ.edgeSet_eq_image hfine] + exact ⟨C, hC.1, rfl⟩ + have hApE : ∀ p, (Ap p).edgeSet = e '' part p := fun p ↦ inter_eq_left.mpr (hsubE p) + have hrootsQ : Q.G.rootSet = ∅ := by + have h₁ : Q.G.roots = P.G.roots := hQ.roots_eq + change {v | v ∈ Q.G.roots} = ∅ + rw [h₁] + exact hD.rootless + have hApV : ∀ {p}, p ∈ ℳ → (Ap p).vertexSet ⊆ p.1.vertexSet := by + rintro p hp v (h | ⟨_, ⟨C, hC, rfl⟩, hinc⟩) + · exact (mem_sepRooted_rootSet.mp h).1 + · obtain ⟨C', hC', h₁, h₂⟩ := (hQ.inc_iff hfine).mp hinc + have heq := hQ.injOn_newEdge hC' hC.1 h₁ + subst heq + have hC₂ := hown C' hC.1 hC.2.1 + rw [hC.2.2] at hC₂ + exact hC₂.2.1.vertexSet_subset (C'.roots_subset v h₂) + have hApQ : ∀ {p}, p ∈ ℳ → (Ap p).vertexSet ⊆ Q.G.vertexSet := by + rintro p hp v (h | ⟨_, h₁, hinc⟩) + · rw [hQ.vertexSet_eq] + exact hD.sep_mem_core hp (mem_sepRooted_rootSet.mp h) + · exact Q.G.vertex_mem_of_inc hinc + have hApLe : ∀ {p}, p ∈ ℳ → (Ap p).toHypergraph ≤ Q.G.toHypergraph := by + intro p hp + refine ⟨hApQ hp, inter_subset_right, fun g hg ↦ ?_⟩ + ext v + exact ⟨fun h ↦ ⟨hg.1, h⟩, fun h ↦ h.2⟩ + have hother : ∀ {p}, p ∈ ℳ → ∀ {C}, C ∈ ℒ → C ∉ part p → C.toHypergraph ≤ p.2 := by + intro p hp C hC hn + by_cases hm : C ∈ mainSet P.G ℒ ℳ + · exact (hD.main_side hm hp).1 + · obtain ⟨h₁, h₂, -⟩ := hown C hC hm + have hne : own C ≠ p := fun h ↦ hn ⟨hC, hm, h⟩ + exact h₂.trans (hD.cross _ h₁ p hp hne) + have hApC : ∀ {p}, p ∈ ℳ → IsComplemented Q.G (Ap p) := by + intro p hp + refine ⟨hApLe hp, fun v _ hr ↦ ?_, fun v g hv hg hinc ↦ ?_⟩ + · rw [hrootsQ] at hr + exact hr.elim + · obtain ⟨C, hC, rfl, hvC⟩ := (hQ.inc_iff hfine).mp hinc + have hnot : C ∉ part p := fun h ↦ hg.2 (by rw [hApE]; exact ⟨C, h, rfl⟩) + exact mem_sepRooted_rootSet.mpr ⟨hApV hp hv, + (hother hp hC hnot).vertexSet_subset (C.roots_subset v hvC)⟩ + have hApLoc : IsRootedLocation Q.G (Ap '' ℳ) := by + have hcomp : ∀ ⦃X⦄, X ∈ Ap '' ℳ → IsComplemented Q.G X := by + rintro _ ⟨p, hp, rfl⟩ + exact hApC hp + refine ⟨hcomp, ?_⟩ + rintro _ ⟨p, hp, rfl⟩ _ ⟨q, hq, rfl⟩ hne + have hpq : p ≠ q := fun h ↦ hne (by rw [h]) + rw [complement_toHypergraph] + rw [le_iff_of_le (hApLe hp) (complementHypergraph_le (hApC hq))] + refine ⟨fun v hv ↦ ?_, fun g hg ↦ ⟨(hApLe hp).edgeSet_subset hg, fun hg' ↦ ?_⟩⟩ + · by_cases hvq : v ∈ (Ap q).vertexSet + · exact Or.inr ⟨hApQ hp hv, mem_sepRooted_rootSet.mpr ⟨hApV hq hvq, + (hD.cross p hp q hq hpq).vertexSet_subset (hApV hp hv)⟩⟩ + · exact Or.inl ⟨hApQ hp hv, hvq⟩ + · rw [hApE] at hg hg' + obtain ⟨C, hC, rfl⟩ := hg + obtain ⟨C', hC', heq⟩ := hg' + have := hQ.injOn_newEdge hC'.1 hC.1 heq + subst this + exact hpq (hC.2.2.symm.trans hC'.2.2) + let g₀ : Hypergraph α β × Hypergraph α β → β := fun p ↦ fresh (f p) + have hg₀ : InjOn g₀ ℳ := fun p hp q hq h ↦ hfinj hp hq (hfresh ⟨p, hp, rfl⟩ ⟨q, hq, rfl⟩ h) + let A : β → RootedHypergraph α β := fun g ↦ Ap (Function.invFunOn g₀ ℳ g) + have hA : ∀ {p}, p ∈ ℳ → A (g₀ p) = Ap p := fun {p} hp ↦ by + change Ap (Function.invFunOn g₀ ℳ (g₀ p)) = _ + rw [hg₀ (Function.invFunOn_mem ⟨_, hp, rfl⟩) hp (Function.invFunOn_eq ⟨_, hp, rfl⟩)] + set F : Set β := g₀ '' ℳ with hF + have hAF : A '' F = Ap '' ℳ := by + ext X + constructor + · rintro ⟨_, ⟨p, hp, rfl⟩, rfl⟩ + exact ⟨p, hp, (hA hp).symm⟩ + · rintro ⟨p, hp, rfl⟩ + exact ⟨g₀ p, ⟨p, hp, rfl⟩, hA hp⟩ + have hedge' : ∀ {g}, g ∈ Q'.G.edgeSet \ F ↔ ∃ C ∈ mainSet P.G ℒ ℳ, e C = g := by + intro g + rw [hQ'.edgeSet_eq_image hfine'] + constructor + · rintro ⟨⟨L, hL | ⟨p, hp, rfl⟩, rfl⟩, h₂⟩ + · exact ⟨L, hL, (he₁ hL).symm⟩ + · exact absurd ⟨p, hp, (he₂ hp).symm⟩ h₂ + · rintro ⟨C, hC, rfl⟩ + refine ⟨⟨C, Or.inl hC, he₁ hC⟩, ?_⟩ + rintro ⟨p, -, h⟩ + exact havoid (f p) ⟨C, hC, h.symm⟩ + have hdelLe : (Q'.G.deleteEdges F).toHypergraph ≤ Q.G.toHypergraph := by + refine ⟨?_, ?_, fun g hg ↦ ?_⟩ + · intro v hv + have hv' : v ∈ Q'.G.vertexSet := hv + rw [hQ'.vertexSet_eq] at hv' + rw [hQ.vertexSet_eq] + exact SideData.core_subset hv' + · intro g hg + obtain ⟨C, hC, rfl⟩ := hedge'.mp hg + rw [hQ.edgeSet_eq_image hfine] + exact ⟨C, hC.1, rfl⟩ + · obtain ⟨C, hC, rfl⟩ := hedge'.mp hg + have h₁ : (Q'.G.deleteEdges F).ends (e C) = Q'.G.ends (e C) := by + ext v + exact ⟨fun h ↦ h.1, fun h ↦ ⟨h, hg.2⟩⟩ + have hC' : C ∈ sideSet P.G ℒ ℳ := Or.inl hC + rw [h₁, hQ.ends_newEdge hC.1, ← he₁ hC, hQ'.ends_newEdge hC'] + obtain ⟨hcoreV, hcoreE⟩ := deleted_heart_core_sets hD hQ hQ' hown hApV hApE hother hedge' + refine ⟨F, ?_, ?_, Q, rfl, A, ?_, ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨p, hp, rfl⟩ + rw [hQ'.dom_eq_image hfine'] + exact ⟨f p, Or.inr ⟨p, hp, rfl⟩, he₂ hp⟩ + · exact Set.ncard_image_le hfinM + · rw [hAF] + exact hApLoc + · exact hQ'.roots_eq.trans hQ.roots_eq.symm + · rw [hAF] + exact eq_of_le_of_vertexSet_eq_of_edgeSet_eq hdelLe (core_le hApLoc) hcoreV hcoreE + · refine ⟨rfl, ?_, ?_, ?_⟩ + · rw [Patchwork.restrict_dom hdelLe] + ext g + change g ∈ Q'.dom \ F ↔ _ + rw [hQ'.dom_eq_image hfine', hQ.dom_eq_image hfine, ← hQ'.edgeSet_eq_image hfine', + hedge'] + constructor + · rintro ⟨C, hC, rfl⟩ + exact ⟨⟨C, hC.1, rfl⟩, hedge'.mpr ⟨C, hC, rfl⟩⟩ + · exact fun h ↦ hedge'.mp h.2 + · intro g hg + have hg' : g ∈ Q'.G.edgeSet \ F := by + rw [Patchwork.restrict_dom hdelLe] at hg + exact hg.2 + obtain ⟨C, hC, rfl⟩ := hedge'.mp hg' + have hC' : C ∈ sideSet P.G ℒ ℳ := Or.inl hC + change Q'.μ (e C) = Q.μ (e C) + rw [hQ.μ_newEdge hC.1, ← he₁ hC, hQ'.μ_newEdge hC'] + · intro g hg + obtain ⟨C, hC, rfl⟩ := hedge'.mp hg + have hC' : C ∈ sideSet P.G ℒ ℳ := Or.inl hC + rw [Patchwork.restrict_Δ hdelLe hg] + change Q'.Δ (e C) = Q.Δ (e C) + rw [hQ.Δ_newEdge hC.1, ← he₁ hC, hQ'.Δ_newEdge hC'] + · rintro _ ⟨p, hp, rfl⟩ + have hL : f p ∈ sideSet P.G ℒ ℳ := Or.inr ⟨p, hp, rfl⟩ + have hgp : g₀ p = e' (f p) := (he₂ hp).symm + constructor + · rw [hA hp, hgp, hQ'.μ_newEdge hL] + rfl + · rw [hgp, hQ'.ends_newEdge hL] + have : (f p).rootSet = (p.1 ∩ p.2).vertexSet := by + ext v + exact mem_sepRooted_rootSet + rw [this] + exact hk p hp + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section5j.lean b/LeanPool/GraphMinor/GM20/Section5j.lean new file mode 100644 index 0000000000..20c0e532b8 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section5j.lean @@ -0,0 +1,215 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section5i + +/-! +# Graph Minors XX, Section 5, (5.5) and (5.6) + +(5.5) replaces the members of a suitable location on the small side of a member of `ℳ(𝒯, W, θ)` by +that small side, using the heart step of `Section5i`. The new location isolates `𝒯` outright. (5.6) +applies (5.3), (5.4) and (5.5) in turn. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v w + +variable {α : Type u} {β : Type v} + +theorem locationReplaced_mono {𝓕₁ 𝓕₂ : Set (UnlabeledPatchwork α β)} (h : 𝓕₁ ⊆ 𝓕₂) {k k' w w' : ℕ} + (hk : k ≤ k') (hw : w ≤ w') : locationReplaced 𝓕₁ k w ⊆ locationReplaced 𝓕₂ k' w' := by + rintro P₂ ⟨F, hF, hn, P₁, hP₁, A, h₁, h₂, h₃, h₄, h₅⟩ + exact ⟨F, hF, hn.trans hw, P₁, h hP₁, A, h₁, h₂, h₃, h₄, fun f hf ↦ + ⟨(h₅ f hf).1, (h₅ f hf).2.trans hk⟩⟩ + +/-- `ℒ⁻` is a location, for a rooted location `ℒ`. -/ +theorem isLocation_of_isRootedLocation {G : RootedHypergraph α β} {ℒ : Set (RootedHypergraph α β)} + (h : IsRootedLocation G ℒ) : IsLocation G.toHypergraph (rootedLocationToLocation G ℒ) := by + refine ⟨?_, ?_⟩ + · rintro _ ⟨A, hA, rfl⟩ + exact isSeparation_complement (h.isComplemented hA) + · rintro _ ⟨A, hA, rfl⟩ _ ⟨B, hB, rfl⟩ hne + have := h.le_complement hA hB fun h' ↦ hne (by rw [h']) + rwa [complement_toHypergraph] at this + +section + +variable {Λ : Type*} [LinearOrder Λ] {lam : Hypergraph α β × Hypergraph α β → Λ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {W : Set (α ⊕ β)} {θ θ₀ : ℕ} + {G : RootedHypergraph α β} {ℒ : Set (RootedHypergraph α β)} + +/-- Subproof (2) of (5.5): `ℒ'` `θ²`-isolates `𝒯`. -/ +theorem isolates_sideSet (hTB : IsTieBreaker G.toHypergraph lam) + (h𝒯 : IsTangle G.toHypergraph θ₀ 𝒯) (hθ : 1 ≤ θ) + (hS : IsSuitable lam 𝒯 W θ G ℒ) + (hD : SideData G ℒ {p | InM lam G.toHypergraph 𝒯 W θ p.1 p.2}) : + Isolates G.toHypergraph lam (θ ^ 2) 𝒯 (rootedLocationToLocation G + (sideSet G ℒ {p | InM lam G.toHypergraph 𝒯 W θ p.1 p.2})) := by + set ℳ : Set (Hypergraph α β × Hypergraph α β) := {p | InM lam G.toHypergraph 𝒯 W θ p.1 p.2} + with hℳ + have hθθ : θ ≤ θ ^ 2 := Nat.le_self_pow two_ne_zero _ + have hpos : 1 ≤ θ ^ 2 := hθ.trans hθθ + have hcompl : ∀ {p}, p ∈ ℳ → complementHypergraph G (sepRooted p.1 p.2) = p.2 := fun {p} hp ↦ + complementHypergraph_sepRooted hD.rootless (hD.sep p hp) + have hordM : ∀ {p}, p ∈ ℳ → separationOrder p.1 p.2 < θ := fun hp ↦ hp.1.2.1 + have hord : ∀ ⦃C D⦄, (C, D) ∈ rootedLocationToLocation G + (sideSet G ℒ ℳ) → separationOrder C D < θ ^ 2 := by + rintro C D ⟨L, hL | ⟨p, hp, rfl⟩, heq⟩ + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj heq + exact separationOrder_complement_le.trans_lt (hS.order_lt hL.1) + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj heq + simp only + rw [hcompl hp] + exact (hordM hp).trans_le hθθ + refine ⟨isLocation_of_isRootedLocation hD.isRootedLocation, ?_, ?_, hord, ?_⟩ + · rintro _ ⟨L, hL | ⟨p, hp, rfl⟩, rfl⟩ + · exact hS.subset ⟨L, hL.1, rfl⟩ + · simp only + rw [hcompl hp] + exact hp.1.1 + · have hle : locationOrder (rootedLocationToLocation G (sideSet G ℒ ℳ)) ≤ θ ^ 2 - 1 := by + refine csSup_le' ?_ + rintro _ ⟨p, hp, rfl⟩ + have := hord (C := p.1) (D := p.2) hp + simp only + omega + omega + · rintro C D ⟨L, hL | ⟨p, hp, rfl⟩, heq⟩ θ' 𝒯' h𝒯' hθ' hmem a b hd + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj heq + rcases hS.distinction h𝒯' hθ' ⟨L, hL.1, rfl⟩ hmem hd with h | ⟨A', B', hM, h₁, h₂⟩ + · exact h + · exfalso + have hsep : G.toHypergraph.IsSeparation A' B' := h𝒯.isSeparation hM.1.1 + have hB'A' : (B', A') ∈ 𝒯' := mem_tangle_of_le h𝒯' hsep + (hM.1.2.1.trans_le (hθθ.trans hθ')) hd.1.2 h₂ + have hle := (hD.main_side (p := (A', B')) hL hM).1 + exact not_le_of_mem_tangle h𝒯' hB'A' hmem hle + · obtain ⟨rfl, hD'⟩ := Prod.mk.inj heq + have hDeq : D = p.2 := by + rw [← hD'] + exact hcompl hp + subst hDeq + have hlt : separationOrder a b < θ := + (order_le_of_distinction hTB h𝒯 h𝒯' hd hp.1.1 hmem).trans_lt (hordM hp) + rcases theorem_5_1_of_lt hTB h𝒯 h𝒯' hp hd hlt with h | h + · exact h + · exact (not_le_of_mem_tangle h𝒯' hd.1.2 hmem h.2).elim + +/-- The data of (5.5) come from (5.2). -/ +theorem sideData_of_tangle (hTB : IsTieBreaker G.toHypergraph lam) + (h𝒯 : IsTangle G.toHypergraph θ₀ 𝒯) (hWG : W ⊆ zSet G.toHypergraph) (hr : G.rootSet = ∅) + (hS : IsSuitable lam 𝒯 W θ G ℒ) + (hside : ∀ C ∈ ℒ, ∀ ⦃A B⦄, InM lam G.toHypergraph 𝒯 W θ A B → + (C.toHypergraph ≤ A ∧ B ≤ complementHypergraph G C) ∨ + (C.toHypergraph ≤ B ∧ A ≤ complementHypergraph G C)) : + SideData G ℒ {p | InM lam G.toHypergraph 𝒯 W θ p.1 p.2} := by + refine ⟨hr, fun p hp ↦ h𝒯.isSeparation hp.1.1, fun p hp q hq hne ↦ theorem_5_2_proof hTB h𝒯 hp hq + hne, + hS.isRootedLocation, hS.fine, fun C hC p hp ↦ hside C hC hp, fun p hp q hq heq ↦ ?_⟩ + by_contra hne + have hsep : G.toHypergraph.IsSeparation q.1 q.2 := h𝒯.isSeparation hq.1.1 + have hle : q.1 ≤ q.2 := heq ▸ theorem_5_2_proof hTB h𝒯 hp hq hne + refine hq.1.2.2.1 fun z hz ↦ ?_ + rcases mem_zSet_of_separation hsep (hWG hz) with h | h + · exact zSet_mono hle h + · exact h + +end + +/-- Graph Minors XX, (5.5) (page 340): "Let $\mathcal{F}$ be a well-behaved set of patchworks and +let $\theta \ge 1$. Then there is +a well-behaved set of patchworks $\mathcal{F}'$ with the following property. Let $P = (G, +\mu, \Delta)$ be a patchwork, let $\lambda$ be a tie-breaker in $G$, let $\mathcal{T}$ be a +tangle in $G$ of order $\ge \theta^2$, and let $W \subseteq Z(G)$ with $|W| \le \theta$. +Suppose that* * *$P$ is rootless,* * *$\mathcal{L}$ is a $W$-suitable rooted location in $G$ +such that $\mathcal{F}$ contains a heart of $(P, \mathcal{L})$, and* * *for each $C \in +\mathcal{L}$ and each $(A^*, B^*) \in \mathcal{M}(\mathcal{T}, W, \theta)$, either* * *$C^- +\subseteq A^*$ and $B^* \subseteq (G \setminus C)^-$ or* * *$C^- \subseteq B^*$ and $A^* +\subseteq (G \setminus C)^-$.* *Then there is a fine rooted location $\mathcal{L}'$ such +that $\mathcal{L}'$ $\theta^2$-isolates $\mathcal{T}$ and $\mathcal{F}'$ contains a heart of +$(P, \mathcal{L}')$." + +Lean uses an infinite ambient edge type to provide fresh edge labels. -/ +theorem theorem_5_5_proof [Infinite β] {𝓕 : Set (UnlabeledPatchwork α β)} + (h𝓕 : WellBehaved 𝓕) {θ : ℕ} + (hθ : 1 ≤ θ) : + ∃ 𝓕' : Set (UnlabeledPatchwork α β), WellBehaved 𝓕' ∧ + ∀ (P : UnlabeledPatchwork α β) (Λ : Type w) [LinearOrder Λ] + (lam : Hypergraph α β × Hypergraph α β → Λ) (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (θ₀ : ℕ) (W : Set (α ⊕ β)) (ℒ : Set (RootedHypergraph α β)), + IsTieBreaker P.G.toHypergraph lam → IsTangle P.G.toHypergraph θ₀ 𝒯 → θ ^ 2 ≤ θ₀ → + W ⊆ zSet P.G.toHypergraph → W.ncard ≤ θ → IsRootless P → + IsSuitable lam 𝒯 W θ P.G ℒ → (∃ Q ∈ 𝓕, HasPatchworkHeart P ℒ Q) → + (∀ C ∈ ℒ, ∀ ⦃A B⦄, InM lam P.G.toHypergraph 𝒯 W θ A B → + (C.toHypergraph ≤ A ∧ B ≤ complementHypergraph P.G C) ∨ + (C.toHypergraph ≤ B ∧ A ≤ complementHypergraph P.G C)) → + ∃ ℒ' : Set (RootedHypergraph α β), IsFine P.G ℒ' ∧ IsRootedLocation P.G ℒ' ∧ + Isolates P.G.toHypergraph lam (θ ^ 2) 𝒯 (rootedLocationToLocation P.G ℒ') ∧ + ∃ Q ∈ 𝓕', HasPatchworkHeart P ℒ' Q := by + let active : Set (UnlabeledPatchwork α β) := {P ∈ 𝓕 | IsActive P} + have hsub : active ⊆ 𝓕 := fun _ h ↦ h.1 + have hactive : ∀ P ∈ active, IsActive P := fun _ h ↦ h.2 + refine ⟨locationReplaced active θ θ, + wellBehaved_locationReplaced (h𝓕.mono hsub) hactive θ θ, ?_⟩ + intro P Λ _ lam 𝒯 θ₀ W ℒ hTB h𝒯 _ hWG hWθ hr hS hheart hside + obtain ⟨Q, hQ, e, hQe⟩ := hheart + have hD := sideData_of_tangle hTB h𝒯 hWG hr hS hside + have hfinM := finite_inM (lam := lam) (W := W) (θ := θ) h𝒯 + have hWfin : W.Finite := (finite_zSet _).subset hWG + have hcard := theorem_5_2_card (θ := θ) hTB h𝒯 hWfin hWG + obtain ⟨Q', hQ', hrep⟩ := exists_sideSet_heart hD hQe hfinM (k := θ) fun p hp ↦ hp.1.2.1.le + refine ⟨_, hD.isFine, hD.isRootedLocation, isolates_sideSet hTB h𝒯 hθ hS hD, Q', ?_, hQ'⟩ + refine locationReplaced_mono ?_ le_rfl (hcard.trans hWθ) hrep + rintro _ rfl + exact ⟨hQ, heart_isActive hS.fine hQe⟩ + +/-- Graph Minors XX, (5.6) (page 342): +"**5.6.** *Let $\mathcal{F}$ be a well-behaved set of patchworks, and let $\theta \ge 1$. Then there +is a well-behaved set of patchworks $\mathcal{F}'$ with the following property. Let $P = (G, \mu, +\Delta)$ be a rootless removable patchwork, let $\lambda$ be a tie-breaker in $G$, let $\mathcal{T}$ +be a tangle in $G$ of order $\ge \theta^2$, and let $W \subseteq Z(G)$ with $|W| \le \theta$. +Suppose that $\mathcal{L}$ is a fine rooted location in $G$ such that $\mathcal{L}$ +$\theta$-isolates $\mathcal{T}$ modulo $W$, and $\mathcal{F}$ contains a heart of $(P, +\mathcal{L})$. Then there is a fine rooted location $\mathcal{L}'$ in $G$ such that $\mathcal{L}$ +$\theta^2$-isolates $\mathcal{T}$ and $\mathcal{F}'$ contains a heart of $(P, \mathcal{L}')$.*" +(Here "$\mathcal{L}$ $\theta^2$-isolates $\mathcal{T}$" is a misprint in the paper for +"$\mathcal{L}'$ $\theta^2$-isolates $\mathcal{T}$".) + +Lean uses an infinite ambient edge type to provide fresh edge labels. -/ +theorem theorem_5_6_proof [Infinite β] {𝓕 : Set (UnlabeledPatchwork α β)} + (h𝓕 : WellBehaved 𝓕) {θ : ℕ} + (hθ : 1 ≤ θ) : + ∃ 𝓕' : Set (UnlabeledPatchwork α β), WellBehaved 𝓕' ∧ + ∀ (P : UnlabeledPatchwork α β) (Λ : Type w) [LinearOrder Λ] + (lam : Hypergraph α β × Hypergraph α β → Λ) (𝒯 : Set (Hypergraph α β × Hypergraph α β)) + (θ₀ : ℕ) (W : Set (α ⊕ β)) (ℒ : Set (RootedHypergraph α β)), + IsTieBreaker P.G.toHypergraph lam → IsTangle P.G.toHypergraph θ₀ 𝒯 → θ ^ 2 ≤ θ₀ → + W ⊆ zSet P.G.toHypergraph → W.ncard ≤ θ → IsRootless P → P.IsRemovable → IsFine P.G ℒ → + IsolatesModulo lam 𝒯 W θ P.G ℒ → (∃ Q ∈ 𝓕, HasPatchworkHeart P ℒ Q) → + ∃ ℒ' : Set (RootedHypergraph α β), IsFine P.G ℒ' ∧ IsRootedLocation P.G ℒ' ∧ + Isolates P.G.toHypergraph lam (θ ^ 2) 𝒯 (rootedLocationToLocation P.G ℒ') ∧ + ∃ Q ∈ 𝓕', HasPatchworkHeart P ℒ' Q := by + obtain ⟨𝓕₁, h₁, H₁⟩ := theorem_5_3_proof.{u, v, w} h𝓕 hθ + obtain ⟨𝓕₂, h₂, H₂⟩ := theorem_5_4_proof.{u, v, w} h₁ θ + obtain ⟨𝓕₃, h₃, H₃⟩ := theorem_5_5_proof.{u, v, w} h₂ hθ + refine ⟨𝓕₃, h₃, ?_⟩ + intro P Λ _ lam 𝒯 θ₀ W ℒ hTB h𝒯 hθ₀ hWG hWθ hr hrem hfine hiso hheart + obtain ⟨ℒ₁, W', hW', hS₁, hh₁, hM₁⟩ := H₁ P Λ lam 𝒯 θ₀ W ℒ hTB h𝒯 hθ₀ hWG hWθ hfine hiso hheart + obtain ⟨ℒ₂, hS₂, hh₂, hM₂⟩ := H₂ P Λ lam 𝒯 θ₀ W' ℒ₁ hTB h𝒯 hθ₀ hrem hS₁ hh₁ hM₁ + have hWfin : W.Finite := (finite_zSet _).subset hWG + exact H₃ P Λ lam 𝒯 θ₀ W' ℒ₂ hTB h𝒯 hθ₀ (hW'.trans hWG) + ((Set.ncard_le_ncard hW' hWfin).trans hWθ) hr hS₂ hh₂ hM₂ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section5k.lean b/LeanPool/GraphMinor/GM20/Section5k.lean new file mode 100644 index 0000000000..b51c9ca656 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section5k.lean @@ -0,0 +1,127 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section3 +public import LeanPool.GraphMinor.GM20.Section5j +public import LeanPool.GraphMinor.GM20.Section2 +public import LeanPool.GraphMinor.GM04.Patchwork.Menger + +/-! +# Graph Minors XX, Section 5, (5.7) + +This is the main result of Section 5: (3.1) with the weaker hypothesis about isolation modulo a set +`W`. We apply (5.6) to each tangle, and then (3.1) with `θ²`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} {Ω : Type*} + +theorem feasibleGroupings_congr {Ω₁ Ω₂ : Type*} {P : Patchwork Ω₁ α β} {Q : Patchwork Ω₂ α β} + (hb : SameBase P Q) {B : RootedHypergraph α β} (hB : B.toHypergraph ≤ P.G.toHypergraph) : + feasibleGroupings (P.restrict B) = feasibleGroupings (Q.restrict B) := by + refine Patch.ext_of rfl ?_ + ext K + exact ⟨fun h ↦ feasible_transfer hb hB h, + fun h ↦ feasible_transfer hb.symm (hb.hyper ▸ hB) h⟩ + +/-- The heart of the underlying patchwork gives a place heart with no labels. -/ +theorem placeHeart_of_patchworkHeart {P : Patchwork Ω α β} + {ℒ : Set (RootedHypergraph α β)} {e : RootedHypergraph α β → β} + {Q : UnlabeledPatchwork α β} (hfine : IsFine P.G ℒ) + (h : IsPatchworkHeart (P.relabel fun _ ↦ ()) ℒ e Q) : + IsPlaceHeart (PartialPatchwork.ofPatchwork P) ℒ e (Q.relabel fun _ ↦ ⊥) := by + have hb : SameBase (P.relabel fun _ ↦ ()) (PartialPatchwork.ofPatchwork P) := + ⟨rfl, rfl, fun _ _ ↦ rfl, fun _ _ ↦ rfl⟩ + have hemp : (rootedLocationCore P.G ℒ).edgeSet = ∅ := + core_edgeSet_eq_empty (P := P.relabel fun _ ↦ ()) hfine + refine + { isRootedLocation := h.isRootedLocation + injOn_newEdge := h.injOn_newEdge + newEdge_notMem_core := h.newEdge_notMem_core + vertexSet_eq := h.vertexSet_eq + edgeSet_eq := h.edgeSet_eq + roots_eq := h.roots_eq + ends_core := h.ends_core + ends_newEdge := h.ends_newEdge + dom_eq := h.dom_eq + μ_core := h.μ_core + μ_newEdge := h.μ_newEdge + Δ_core := h.Δ_core + Δ_newEdge := fun A hA ↦ ?_ + φ_core := fun f hf ↦ ?_ + φ_newEdge := fun _ _ ↦ rfl } + · refine (h.Δ_newEdge hA).trans (feasibleGroupings_congr hb ?_) + exact (h.isRootedLocation.isComplemented hA).le + · change f ∈ (rootedLocationCore P.G ℒ).edgeSet at hf + rw [hemp] at hf + exact hf.elim + +/-- Graph Minors XX, (5.7) (page 342): "Let $\Omega$ be a well-quasi-order, let $\mathcal{F}$ be a +well-behaved set of patchworks, +and let $\theta \ge 1$. Let $P_i = (G_i, \mu_i, \Delta_i, \phi_i)$ ($i = 1, 2, \dots$) be a +countable sequence of rootless robust $\Omega$-patchworks. For each $i \ge 1$ let +$\lambda_i$ be a tie-breaker in $G_i$; and suppose that for each tangle $\mathcal{T}$ in +$G_i$ of order $\ge \theta$, there exist $W \subseteq Z(G_i)$ with $|W| \le \theta$ and a +fine rooted location $\mathcal{L}$ in $G_i$, such that $\mathcal{L}$ $\theta$-isolates +$\mathcal{T}$ modulo $W$, and $\mathcal{F}$ contains a heart of $((G_i, \mu_i, \Delta_i), +\mathcal{L})$. Then there exist $j > i \ge 1$ such that $P_i$ is simulated in $P_j$." + +Lean uses an infinite ambient edge type to provide fresh edge labels. +The simulation is the IV relation described in `WellBehaved`. -/ +theorem theorem_5_7_proof [Infinite β] {Ω : Type (max u v)} + [Preorder Ω] (hΩ : WellQuasiOrderedLE Ω) {𝓕 : Set (UnlabeledPatchwork α β)} + (h𝓕 : WellBehaved 𝓕) {θ : ℕ} (hθ : 1 ≤ θ) (P : ℕ → GM04.Patchwork Ω α β) + (hP : ∀ i, IsRootless (P i) ∧ (P i).IsRobust) (Λ : ℕ → Type) [∀ i, LinearOrder (Λ i)] + (lam : ∀ i, Hypergraph α β × Hypergraph α β → Λ i) + (hlam : ∀ i, IsTieBreaker (P i).G.toHypergraph (lam i)) + (h : ∀ i (θ' : ℕ) (𝒯 : Set (Hypergraph α β × Hypergraph α β)), + IsTangle (P i).G.toHypergraph θ' 𝒯 → θ ≤ θ' → ∃ (W : Set (α ⊕ β)) + (ℒ : Set (RootedHypergraph α β)), W ⊆ zSet (P i).G.toHypergraph ∧ W.ncard ≤ θ ∧ + IsFine (P i).G ℒ ∧ IsolatesModulo (lam i) 𝒯 W θ (P i).G ℒ ∧ + ∃ Q ∈ 𝓕, HasPatchworkHeart ((P i).relabel fun _ ↦ ()) ℒ Q) : + ∃ i j, i < j ∧ GM04.Simulated (P i) (P j) := by + classical + obtain ⟨𝓕', h𝓕', H⟩ := theorem_5_6_proof.{u, v, 0} h𝓕 hθ + let 𝓕'' : Set (PartialPatchwork Ω α β) := + {R | IsRootless R ∧ (∀ e ∈ R.G.edgeSet, R.φ e = ⊥) ∧ ∃ Q ∈ 𝓕', IsCompletionOf Q R} + have hwb : GM18.WellBehaved 𝓕'' := by + intro Ω' _ ι hΩ' Q hQ + refine h𝓕' Ω' hΩ' Q fun i ↦ ?_ + obtain ⟨R, ⟨-, -, Q₀, hQ₀, hc⟩, hR⟩ := hQ i + refine ⟨Q₀, hQ₀, hR.G_eq.trans hc.G_eq, hR.dom_eq.trans hc.dom_eq, fun e he ↦ ?_, + fun e he ↦ ?_⟩ + · have he' : e ∈ R.dom := hc.dom_eq ▸ he + exact (hR.μ_eq he').trans (hc.μ_eq he) + · have he' : e ∈ R.G.edgeSet := by + rw [hc.G_eq] + exact he + exact (hR.Δ_eq he').trans (hc.Δ_eq he) + have hθθ : θ ≤ θ ^ 2 := Nat.le_self_pow two_ne_zero _ + refine theorem_3_1_proof hΩ hwb (fun R hR ↦ hR.1) (hθ.trans hθθ) P hP Λ lam hlam ?_ + intro i θ' 𝒯 h𝒯 hθ' + obtain ⟨W, ℒ, hWG, hWθ, hfine, hiso, hheart⟩ := h i θ' 𝒯 h𝒯 (hθθ.trans hθ') + obtain ⟨ℒ', hfine', hloc', hiso', Q, hQ, e, hQe⟩ := H ((P i).relabel fun _ ↦ ()) (Λ i) + (lam i) 𝒯 θ' + W ℒ (hlam i) h𝒯 hθ' hWG hWθ (hP i).1 (hP i).2.isRemovable hfine hiso hheart + refine ⟨ℒ', ⟨fun e _ ↦ WithBot.coe_ne_bot, hloc'⟩, ⟨Q.relabel fun _ ↦ ⊥, ⟨?_, fun _ _ ↦ rfl, Q, + hQ, + isCompletionOf_relabel _ _⟩, e, placeHeart_of_patchworkHeart hfine' hQe⟩, hiso'⟩ + change {v | v ∈ Q.G.roots} = ∅ + rw [hQe.roots_eq] + exact (hP i).1 + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section6a.lean b/LeanPool/GraphMinor/GM20/Section6a.lean new file mode 100644 index 0000000000..8c44701f4d --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section6a.lean @@ -0,0 +1,313 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section5k + +/-! +# Graph Minors XX, Section 6, (6.1) + +The edge-based tie-breaker compares a separation first by its order, then by the weight of what lies +outside the side `A` with `f ∈ E(A)`, and last by the weight of the separator. The file first +collects the facts about weights: they grow with the set, and they are injective on subsets of +`Z(G)` by rational independence. Then the three axioms are checked as in the paper. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +section Weight + +variable {G : Hypergraph α β} {v : α ⊕ β → ℝ} + +open Classical in +theorem weight_eq_sum (G : Hypergraph α β) (v : α ⊕ β → ℝ) (X : Set (α ⊕ β)) : + weight G v X = ∑ x ∈ (finite_zSet G).toFinset, if x ∈ X then v x else 0 := by + have hfin : (X ∩ zSet G).Finite := (finite_zSet G).subset inter_subset_right + rw [weight, finsum_mem_eq_finite_toFinset_sum _ hfin, ← Finset.sum_filter] + refine Finset.sum_congr ?_ fun _ _ ↦ rfl + ext x + simp [and_comm] + +theorem weight_le (hv : ∀ x ∈ zSet G, 0 < v x) {X Y : Set (α ⊕ β)} (h : X ∩ zSet G ⊆ Y) : + weight G v X ≤ weight G v Y := by + classical + rw [weight_eq_sum, weight_eq_sum] + refine Finset.sum_le_sum fun x hx ↦ ?_ + have hxZ : x ∈ zSet G := (finite_zSet G).mem_toFinset.mp hx + by_cases hX : x ∈ X + · rw [ite_eq_left hX, ite_eq_left (h ⟨hX, hxZ⟩)] + · rw [ite_eq_right hX] + split_ifs + · exact (hv x hxZ).le + · exact le_rfl + +/-- If `X ⊆ Y` and `Y` weighs no more than `X`, then `Y` has no more members of `Z(G)` than `X`. -/ +theorem subset_of_weight_le (hv : ∀ x ∈ zSet G, 0 < v x) {X Y : Set (α ⊕ β)} (h : X ∩ zSet G ⊆ Y) + (hw : weight G v Y ≤ weight G v X) : Y ∩ zSet G ⊆ X := by + classical + by_contra hn + obtain ⟨x, ⟨hxY, hxZ⟩, hxX⟩ := not_subset.mp hn + rw [weight_eq_sum, weight_eq_sum] at hw + refine absurd hw (not_le.mpr (Finset.sum_lt_sum (fun y hy ↦ ?_) ⟨x, ?_, ?_⟩)) + · have hyZ : y ∈ zSet G := (finite_zSet G).mem_toFinset.mp hy + by_cases hX : y ∈ X + · rw [ite_eq_left hX, ite_eq_left (h ⟨hX, hyZ⟩)] + · rw [ite_eq_right hX] + split_ifs + · exact (hv y hyZ).le + · exact le_rfl + · exact (finite_zSet G).mem_toFinset.mpr hxZ + · rw [ite_eq_right hxX, ite_eq_left hxY] + exact hv x hxZ + +/-- Rational independence: the weight is injective on subsets of `Z(G)`. -/ +theorem eq_of_weight_eq (hv : IsIndependentWeight G v) {X Y : Set (α ⊕ β)} (hX : X ⊆ zSet G) + (hY : Y ⊆ zSet G) (h : weight G v X = weight G v Y) : X = Y := by + classical + have : Fintype (zSet G) := (finite_zSet G).fintype + let g : zSet G → ℚ := fun x ↦ (if x.1 ∈ X then 1 else 0) - (if x.1 ∈ Y then 1 else 0) + have hsum : ∑ x : zSet G, g x • v x.1 = 0 := by + rw [weight_eq_sum, weight_eq_sum, ← sub_eq_zero, ← Finset.sum_sub_distrib, + Finset.sum_subtype (finite_zSet G).toFinset (p := (· ∈ zSet G)) + (fun x ↦ (finite_zSet G).mem_toFinset)] at h + focus rw [← h] + refine Finset.sum_congr rfl fun x _ ↦ ?_ + simp only [g, Rat.smul_def] + by_cases h₁ : x.1 ∈ X <;> by_cases h₂ : x.1 ∈ Y <;> simp [h₁, h₂] + have hg := linearIndependent_iff'.mp hv.2 Finset.univ g hsum + have hiff : ∀ x (hx : x ∈ zSet G), x ∈ X ↔ x ∈ Y := by + intro x hx + have h₀ := hg ⟨x, hx⟩ (Finset.mem_univ _) + simp only [g] at h₀ + by_cases h₁ : x ∈ X <;> by_cases h₂ : x ∈ Y <;> simp_all + ext x + exact ⟨fun h ↦ (hiff x (hX h)).mp h, fun h ↦ (hiff x (hY h)).mpr h⟩ + +end Weight + +section Tie + +variable {G A B C D : Hypergraph α β} + +theorem le_of_zSet_subset (hA : A ≤ G) (hB : B ≤ G) (h : zSet A ⊆ zSet B) : A ≤ B := by + rw [le_iff_of_le hA hB] + refine ⟨fun x hx ↦ ?_, fun e he ↦ ?_⟩ + · rcases h (Or.inl ⟨x, hx, rfl⟩) with ⟨y, hy, hxy⟩ | ⟨y, _, hxy⟩ + · exact Sum.inl_injective hxy ▸ hy + · exact absurd hxy (by simp) + · rcases h (Or.inr ⟨e, he, rfl⟩) with ⟨y, _, hxy⟩ | ⟨y, hy, hxy⟩ + · exact absurd hxy (by simp) + · exact Sum.inr_injective hxy ▸ hy + +theorem zSet_subset (h : A ≤ G) : zSet A ⊆ zSet G := zSet_mono h + +/-- The sum of the orders of `(A ∪ C, B ∩ D)` and `(A ∩ C, B ∪ D)` equals the sum of the orders of +`(A, B)` and `(C, D)`. -/ +theorem order_add_order (h₁ : G.IsSeparation A B) (h₂ : G.IsSeparation C D) : + separationOrder (A ∪ C) (B ∩ D) + separationOrder (A ∩ C) (B ∪ D) = + separationOrder A B + separationOrder C D := by + set X := ((A ∪ C) ∩ (B ∩ D)).vertexSet with hX + set Y := ((A ∩ C) ∩ (B ∪ D)).vertexSet with hY + set U := (A ∩ B).vertexSet with hU + set W := (C ∩ D).vertexSet with hW + have hUW : X ∪ Y = U ∪ W := by + ext v + constructor + · rintro (⟨h | h, h₃, h₄⟩ | ⟨⟨h₃, h₄⟩, h | h⟩) + · exact Or.inl ⟨h, h₃⟩ + · exact Or.inr ⟨h, h₄⟩ + · exact Or.inl ⟨h₃, h⟩ + · exact Or.inr ⟨h₄, h⟩ + · rintro (⟨h₃, h₄⟩ | ⟨h₃, h₄⟩) + · by_cases hd : v ∈ D.vertexSet + · exact Or.inl ⟨Or.inl h₃, h₄, hd⟩ + · have hvG : v ∈ C.vertexSet ∪ D.vertexSet := by + rw [h₂.vertexSet_union, ← h₁.vertexSet_union] + exact Or.inl h₃ + exact Or.inr ⟨⟨h₃, hvG.resolve_right hd⟩, Or.inl h₄⟩ + · by_cases hd : v ∈ B.vertexSet + · exact Or.inl ⟨Or.inr h₃, hd, h₄⟩ + · have hvG : v ∈ A.vertexSet ∪ B.vertexSet := by + rw [h₁.vertexSet_union, ← h₂.vertexSet_union] + exact Or.inl h₃ + exact Or.inr ⟨⟨hvG.resolve_right hd, h₃⟩, Or.inr h₄⟩ + have hIJ : X ∩ Y = U ∩ W := by + ext v + constructor + · rintro ⟨⟨-, h₃, h₄⟩, ⟨h₅, h₆⟩, -⟩ + exact ⟨⟨h₅, h₃⟩, h₆, h₄⟩ + · rintro ⟨⟨h₃, h₄⟩, h₅, h₆⟩ + exact ⟨⟨Or.inl h₃, h₄, h₆⟩, ⟨h₃, h₅⟩, Or.inl h₄⟩ + have hfX : X.Finite := ((A ∪ C) ∩ (B ∩ D)).vertexSet_finite + have hfY : Y.Finite := ((A ∩ C) ∩ (B ∪ D)).vertexSet_finite + have hfU : U.Finite := (A ∩ B).vertexSet_finite + have hfW : W.Finite := (C ∩ D).vertexSet_finite + have e₁ := Set.ncard_union_add_ncard_inter X Y hfX hfY + have e₂ := Set.ncard_union_add_ncard_inter U W hfU hfW + rw [hUW, hIJ] at e₁ + change X.ncard + Y.ncard = U.ncard + W.ncard + omega + +/-- Comparing triples: equal first terms pass to the second. -/ +theorem lex_snd_le {a a' b b' c c' : ℝ} (h : toLex (a, toLex (b, c)) ≤ toLex (a', toLex (b', c'))) + (ha : a = a') : b ≤ b' := by + subst ha + have h₁ := Prod.Lex.toLex_le_toLex.mp h + rcases h₁ with h₁ | ⟨-, h₁⟩ + · exact absurd h₁ (lt_irrefl _) + · rcases Prod.Lex.toLex_le_toLex.mp h₁ with h₂ | ⟨h₂, -⟩ + · exact h₂.le + · exact h₂.le + +theorem lex_thd_le {a a' b b' c c' : ℝ} (h : toLex (a, toLex (b, c)) ≤ toLex (a', toLex (b', c'))) + (ha : a = a') (hb : b = b') : c ≤ c' := by + subst ha + subst hb + have h₁ := Prod.Lex.toLex_le_toLex.mp h + rcases h₁ with h₁ | ⟨-, h₁⟩ + · exact absurd h₁ (lt_irrefl _) + · rcases Prod.Lex.toLex_le_toLex.mp h₁ with h₂ | ⟨-, h₂⟩ + · exact absurd h₂ (lt_irrefl _) + · exact h₂ + +theorem lex_fst_le {a a' b b' c c' : ℝ} (h : toLex (a, toLex (b, c)) ≤ toLex (a', toLex (b', c'))) : + a ≤ a' := by + rcases Prod.Lex.toLex_le_toLex.mp h with h₁ | ⟨h₁, -⟩ + · exact h₁.le + · exact h₁.le + +variable {v : α ⊕ β → ℝ} {f : β} + +theorem edgeBasedLam_of_mem (hf : f ∈ A.edgeSet) : edgeBasedLam G f v (A, B) + = edgeBasedTriple G v A B := by + simp [edgeBasedLam, hf] + +theorem edgeBasedLam_of_notMem (hf : f ∉ A.edgeSet) : + edgeBasedLam G f v (A, B) = edgeBasedTriple G v B A := by + simp [edgeBasedLam, hf] + +theorem mem_or_mem (h : G.IsSeparation A B) (hf : f ∈ G.edgeSet) : + f ∈ A.edgeSet ∨ f ∈ B.edgeSet := by + rw [← h.edgeSet_union] at hf + exact hf + +theorem zSet_sdiff_antitone {X Y : Hypergraph α β} (h : zSet X ⊆ zSet Y) : + (zSet G \ zSet Y) ∩ zSet G ⊆ zSet G \ zSet X := fun _ hz ↦ ⟨hz.1.1, fun h' ↦ hz.1.2 (h h')⟩ + +/-- `u(X)` determines `Z(X)` for `X` on one side of `Y`. -/ +theorem zSet_subset_of_le_weight (hv : ∀ x ∈ zSet G, 0 < v x) {X Y : Hypergraph α β} + (hY : Y ≤ G) (hXY : zSet X ⊆ zSet Y) + (h : weight G v (zSet G \ zSet X) ≤ weight G v (zSet G \ zSet Y)) : + zSet Y ⊆ zSet X := by + have hs := subset_of_weight_le hv (zSet_sdiff_antitone hXY) h + intro z hz + by_contra hzX + exact (hs ⟨⟨zSet_mono hY hz, hzX⟩, zSet_mono hY hz⟩).2 hz + +/-- The triple determines the separation, when `(A, B)` and `(C, D)` are separations. -/ +theorem eq_of_triple_eq (hv : IsIndependentWeight G v) (h₁ : G.IsSeparation A B) + (h₂ : G.IsSeparation C D) + (h : edgeBasedTriple G v A B = edgeBasedTriple G v C D) : A = C ∧ B = D := by + have h' := congrArg (fun t ↦ (ofLex t).2) h + have h₃ : weight G v (zSet G \ zSet A) = weight G v (zSet G \ zSet C) := + congrArg (fun t ↦ (ofLex t).1) h' + have h₄ : weight G v (Sum.inl '' (A ∩ B).vertexSet) = weight G v (Sum.inl '' (C ∩ D).vertexSet) := + congrArg (fun t ↦ (ofLex t).2) h' + have hZ := eq_of_weight_eq hv sdiff_subset sdiff_subset h₃ + have hAZ : zSet A ⊆ zSet C := fun z hz ↦ by + by_contra hn + have : z ∈ zSet G \ zSet C := ⟨zSet_mono h₁.left_le hz, hn⟩ + rw [← hZ] at this + exact this.2 hz + have hCZ : zSet C ⊆ zSet A := fun z hz ↦ by + by_contra hn + have : z ∈ zSet G \ zSet A := ⟨zSet_mono h₂.left_le hz, hn⟩ + rw [hZ] at this + exact this.2 hz + have hAC : A = C := le_antisymm (le_of_zSet_subset h₁.left_le h₂.left_le hAZ) + (le_of_zSet_subset h₂.left_le h₁.left_le hCZ) + subst hAC + have hsub : ∀ {X Y : Set α}, X ⊆ G.vertexSet → Y ⊆ G.vertexSet → + weight G v (Sum.inl '' X) = weight G v (Sum.inl '' Y) → X = Y := by + intro X Y hX hY hw + have := eq_of_weight_eq hv (X := Sum.inl '' X) (Y := Sum.inl '' Y) + (image_subset_iff.mpr fun x hx ↦ Or.inl ⟨x, hX hx, rfl⟩) + (image_subset_iff.mpr fun x hx ↦ Or.inl ⟨x, hY hx, rfl⟩) hw + exact (Sum.inl_injective.image_injective) this + have hAB : A.vertexSet ∩ B.vertexSet ⊆ G.vertexSet := + Set.inter_subset_left.trans h₁.left_le.vertexSet_subset + have hAD : A.vertexSet ∩ D.vertexSet ⊆ G.vertexSet := + Set.inter_subset_left.trans h₂.left_le.vertexSet_subset + have hV := hsub hAB hAD h₄ + refine ⟨rfl, eq_of_le_of_vertexSet_eq_of_edgeSet_eq h₁.right_le h₂.right_le ?_ ?_⟩ + · ext x + constructor + · intro hx + have hxG := h₁.right_le.vertexSet_subset hx + rw [← h₂.vertexSet_union] at hxG + rcases hxG with h' | h' + · have : x ∈ A.vertexSet ∩ B.vertexSet := ⟨h', hx⟩ + rw [hV] at this + exact this.2 + · exact h' + · intro hx + have hxG := h₂.right_le.vertexSet_subset hx + rw [← h₁.vertexSet_union] at hxG + rcases hxG with h' | h' + · have : x ∈ A.vertexSet ∩ D.vertexSet := ⟨h', hx⟩ + rw [← hV] at this + exact this.2 + · exact h' + · ext e + constructor + · intro he + have heG := h₁.right_le.edgeSet_subset he + rw [← h₂.edgeSet_union] at heG + exact heG.resolve_left fun h' ↦ IsSeparation.not_mem_of_mem h₁ h' he + · intro he + have heG := h₂.right_le.edgeSet_subset he + rw [← h₁.edgeSet_union] at heG + exact heG.resolve_left fun h' ↦ IsSeparation.not_mem_of_mem h₂ h' he + +/-- The first axiom. -/ +theorem edgeBased_axiom1 (hf : f ∈ G.edgeSet) (hv : IsIndependentWeight G v) : + TieBreakerAxiom1 G (edgeBasedLam G f v) := by + intro A B C D h₁ h₂ + have hnot : ∀ {X Y}, G.IsSeparation X Y → f ∈ X.edgeSet → f ∉ Y.edgeSet := fun h hX ↦ + IsSeparation.not_mem_of_mem h hX + constructor + · intro h + rcases mem_or_mem h₁ hf with ha | ha <;> rcases mem_or_mem h₂ hf with hc | hc + · rw [edgeBasedLam_of_mem ha, edgeBasedLam_of_mem hc] at h + exact Or.inl (eq_of_triple_eq hv h₁ h₂ h) + · rw [edgeBasedLam_of_mem ha, edgeBasedLam_of_notMem (hnot h₂.symm hc)] at h + exact Or.inr (eq_of_triple_eq hv h₁ h₂.symm h) + · rw [edgeBasedLam_of_notMem (hnot h₁.symm ha), edgeBasedLam_of_mem hc] at h + obtain ⟨h₃, h₄⟩ := eq_of_triple_eq hv h₁.symm h₂ h + exact Or.inr ⟨h₄, h₃⟩ + · rw [edgeBasedLam_of_notMem (hnot h₁.symm ha), edgeBasedLam_of_notMem (hnot h₂.symm hc)] at h + obtain ⟨h₃, h₄⟩ := eq_of_triple_eq hv h₁.symm h₂.symm h + exact Or.inl ⟨h₄, h₃⟩ + · rintro (⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) + · rfl + · rcases mem_or_mem h₁ hf with ha | ha + · rw [edgeBasedLam_of_mem ha, edgeBasedLam_of_notMem (hnot h₁ ha)] + · rw [edgeBasedLam_of_notMem (hnot h₁.symm ha), edgeBasedLam_of_mem ha] + +end Tie + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section6b.lean b/LeanPool/GraphMinor/GM20/Section6b.lean new file mode 100644 index 0000000000..178db7f68e --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section6b.lean @@ -0,0 +1,231 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section6a +public import Mathlib.LinearAlgebra.Complex.FiniteDimensional + +/-! +# Graph Minors XX, Section 6, (6.1), the second and third axioms + +The third axiom is immediate from the order on triples. The second axiom has three cases, according +to which sides contain `f`, as in the paper. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} {G A B C D : Hypergraph α β} {v : α ⊕ β → ℝ} {f : β} + +theorem lex_thd_lt {a a' b b' c c' : ℝ} (h : toLex (a, toLex (b, c)) < toLex (a', toLex (b', c'))) + (ha : a = a') (hb : b = b') : c < c' := by + subst ha + subst hb + rcases Prod.Lex.toLex_lt_toLex.mp h with h₁ | ⟨-, h₁⟩ + · exact absurd h₁ (lt_irrefl _) + · rcases Prod.Lex.toLex_lt_toLex.mp h₁ with h₂ | ⟨-, h₂⟩ + · exact absurd h₂ (lt_irrefl _) + · exact h₂ + +/-- The first term of `λ(A, B)` is the order of `(A, B)`. -/ +theorem edgeBasedLam_eq (A B : Hypergraph α β) : ∃ b c : ℝ, edgeBasedLam G f v (A, B) = + toLex ((separationOrder A B : ℝ), toLex (b, c)) := by + by_cases hf : f ∈ A.edgeSet + · rw [edgeBasedLam_of_mem hf] + exact ⟨_, _, rfl⟩ + · rw [edgeBasedLam_of_notMem hf, separationOrder_comm A B] + exact ⟨_, _, rfl⟩ + +/-- The third axiom. -/ +theorem edgeBased_axiom3 : TieBreakerAxiom3 G (edgeBasedLam G f v) := by + intro A B C D _ _ hlt + obtain ⟨b, c, h₁⟩ := edgeBasedLam_eq (G := G) (f := f) (v := v) A B + obtain ⟨b', c', h₂⟩ := edgeBasedLam_eq (G := G) (f := f) (v := v) C D + rw [h₁, h₂] + exact Prod.Lex.toLex_lt_toLex.mpr (Or.inl (Nat.cast_lt.mpr hlt)) + +theorem triple_congr {X Y X' Y' : Hypergraph α β} (ho : separationOrder X Y = separationOrder X' Y') + (hz : zSet X = zSet X') (hV : (X ∩ Y).vertexSet = (X' ∩ Y').vertexSet) : + edgeBasedTriple G v X Y = edgeBasedTriple G v X' Y' := by + rw [edgeBasedTriple, edgeBasedTriple, ho, hz, hV] + +theorem vertexSet_of_zSet_eq {X X' : Hypergraph α β} (h : zSet X = zSet X') : + X.vertexSet = X'.vertexSet := by + have key : ∀ {X X' : Hypergraph α β}, zSet X = zSet X' → X.vertexSet ⊆ X'.vertexSet := by + intro X X' h x hx + have : Sum.inl x ∈ zSet X' := h ▸ Or.inl ⟨x, hx, rfl⟩ + rcases this with ⟨y, hy, hxy⟩ | ⟨y, _, hxy⟩ + · exact Sum.inl_injective hxy ▸ hy + · exact absurd hxy (by simp) + exact (key h).antisymm (key h.symm) + +/-- The step shared by the first two cases: if `X ⊆ X'`, `Y' ⊆ Y` with the same order and the triple +of `(X, Y)` is at most the triple of `(X', Y')`, then they are equal. -/ +theorem tie_step (hv : IsIndependentWeight G v) {X Y X' Y' : Hypergraph α β} (hX' : X' ≤ G) + (hz : zSet X ⊆ zSet X') (hY : Y' ≤ Y) (ho : separationOrder X Y = separationOrder X' Y') + (h : edgeBasedTriple G v X Y ≤ edgeBasedTriple G v X' Y') : + edgeBasedTriple G v X Y = edgeBasedTriple G v X' Y' := by + have hs := lex_snd_le h (by exact_mod_cast ho) + have hz' := hz.antisymm (zSet_subset_of_le_weight hv.1 hX' hz hs) + refine triple_congr ho hz' ?_ + refine (Set.eq_of_subset_of_ncard_le (s := (X' ∩ Y').vertexSet) (t := (X ∩ Y).vertexSet) ?_ ho.le + (X ∩ Y).vertexSet_finite).symm + intro x hx + exact ⟨by rw [vertexSet_of_zSet_eq hz']; exact hx.1, hY.vertexSet_subset hx.2⟩ + +/-- The second axiom. -/ +theorem edgeBased_axiom2 (hf : f ∈ G.edgeSet) (hv : IsIndependentWeight G v) : + TieBreakerAxiom2 G (edgeBasedLam G f v) := by + intro A B C D h₁ h₂ + by_contra hcon + rw [not_or, not_le, not_lt] at hcon + obtain ⟨hl₁, hl₂⟩ := hcon + have h₃ : G.IsSeparation (A ∪ C) (B ∩ D) := h₁.union_inter h₂ + have h₄ : G.IsSeparation (A ∩ C) (B ∪ D) := (h₁.symm.union_inter h₂.symm).symm + have hax3 := edgeBased_axiom3 (G := G) (f := f) (v := v) + have ho₁ : separationOrder A B ≤ separationOrder (A ∪ C) (B ∩ D) := by + by_contra hn + exact absurd hl₁ (not_lt.mpr (hax3 h₃ h₁ (not_le.mp hn)).le) + have ho₂ : separationOrder C D ≤ separationOrder (A ∩ C) (B ∪ D) := by + by_contra hn + exact absurd hl₂ (not_le.mpr (hax3 h₄ h₂ (not_le.mp hn))) + have hsum := order_add_order h₁ h₂ + have ho₃ : separationOrder A B = separationOrder (A ∪ C) (B ∩ D) := by omega + have ho₄ : separationOrder C D = separationOrder (A ∩ C) (B ∪ D) := by omega + have hzA : zSet A ⊆ zSet (A ∪ C) := zSet_mono (le_union_left h₁.left_le h₂.left_le) + have hzC : zSet C ⊆ zSet (A ∪ C) := zSet_mono (le_union_right h₁.left_le h₂.left_le) + have hzB : zSet B ⊆ zSet (B ∪ D) := zSet_mono (le_union_left h₁.right_le h₂.right_le) + have hzD : zSet D ⊆ zSet (B ∪ D) := zSet_mono (le_union_right h₁.right_le h₂.right_le) + have hleA : A ≤ A ∪ C := le_union_left h₁.left_le h₂.left_le + have hleCU : C ≤ A ∪ C := le_union_right h₁.left_le h₂.left_le + have hleB : B ≤ B ∪ D := le_union_left h₁.right_le h₂.right_le + have hleDU : D ≤ B ∪ D := le_union_right h₁.right_le h₂.right_le + have hBD : B ∩ D ≤ B := inter_le_left h₁.right_le h₂.right_le + have hAC : A ∩ C ≤ C := inter_le_right h₁.left_le h₂.left_le + have hnot : ∀ {X Y}, G.IsSeparation X Y → f ∈ X.edgeSet → f ∉ Y.edgeSet := fun h hX ↦ + IsSeparation.not_mem_of_mem h hX + by_cases ha : f ∈ A.edgeSet + · -- First case: `f ∈ E(A)`. + have hu : f ∈ (A ∪ C).edgeSet := Or.inl ha + rw [edgeBasedLam_of_mem ha, edgeBasedLam_of_mem hu] at hl₁ + exact absurd (tie_step hv h₃.left_le hzA hBD ho₃ hl₁.le) hl₁.ne + have hb : f ∈ B.edgeSet := (mem_or_mem h₁ hf).resolve_left ha + have hnac : f ∉ (A ∩ C).edgeSet := fun h ↦ ha h.1 + by_cases hd : f ∈ D.edgeSet + · -- Second case: `f ∈ E(B) ∩ E(D)`. + have hc : f ∉ C.edgeSet := hnot h₂.symm hd + rw [edgeBasedLam_of_notMem hc, edgeBasedLam_of_notMem hnac] at hl₂ + have hBDC := inter_comm A C + have heq := tie_step hv h₄.right_le hzD (Y' := A ∩ C) hAC + (by rw [separationOrder_comm D C, separationOrder_comm (B ∪ D) _]; exact ho₄) hl₂ + obtain ⟨h₅, h₆⟩ := eq_of_triple_eq hv h₂.symm h₄.symm heq + have hCA : C ≤ A := by rw [h₆]; exact inter_le_left h₁.left_le h₂.left_le + have hBleD : B ≤ D := by rw [h₅]; exact hleB + have e₁ : A ∪ C = A := le_antisymm (union_le le_rfl hCA) hleA + have e₂ : B ∩ D = B := le_antisymm hBD + ((le_iff_of_le h₁.right_le (inter_le h₁.right_le h₂.right_le)).mpr + ⟨fun _ hx ↦ ⟨hx, hBleD.vertexSet_subset hx⟩, fun _ hx ↦ ⟨hx, hBleD.edgeSet_subset hx⟩⟩) + rw [e₁, e₂] at hl₁ + exact lt_irrefl _ hl₁ + · -- Third case: `f ∈ E(B ∩ C)`. + have hc : f ∈ C.edgeSet := (mem_or_mem h₂ hf).resolve_right hd + have hu : f ∈ (A ∪ C).edgeSet := Or.inr hc + rw [edgeBasedLam_of_notMem ha, edgeBasedLam_of_mem hu] at hl₁ + rw [edgeBasedLam_of_mem hc, edgeBasedLam_of_notMem hnac] at hl₂ + have ho₅ : (separationOrder B A : ℝ) = separationOrder (A ∪ C) (B ∩ D) := by + rw [separationOrder_comm B A] + exact_mod_cast ho₃ + have ho₆ : (separationOrder C D : ℝ) = separationOrder (B ∪ D) (A ∩ C) := by + rw [separationOrder_comm (B ∪ D) (A ∩ C)] + exact_mod_cast ho₄ + have s₁ := lex_snd_le hl₁.le ho₅ + have s₂ := lex_snd_le hl₂ ho₆ + have m₁ : weight G v (zSet G \ zSet (A ∪ C)) ≤ weight G v (zSet G \ zSet C) := + weight_le hv.1 (zSet_sdiff_antitone hzC) + have m₂ : weight G v (zSet G \ zSet (B ∪ D)) ≤ weight G v (zSet G \ zSet B) := + weight_le hv.1 (zSet_sdiff_antitone hzB) + have hzAC : zSet (A ∪ C) ⊆ zSet C := zSet_subset_of_le_weight hv.1 h₃.left_le hzC (by linarith) + have hzBD : zSet (B ∪ D) ⊆ zSet B := + zSet_subset_of_le_weight hv.1 h₄.right_le hzB (by linarith) + have huBC : weight G v (zSet G \ zSet B) = weight G v (zSet G \ zSet C) := by linarith + have hBC : B = C := by + have hZ := eq_of_weight_eq hv sdiff_subset sdiff_subset huBC + have hBZ : zSet B ⊆ zSet C := fun z hz ↦ by + by_contra hn + have : z ∈ zSet G \ zSet C := ⟨zSet_mono h₁.right_le hz, hn⟩ + rw [← hZ] at this + exact this.2 hz + have hCZ : zSet C ⊆ zSet B := fun z hz ↦ by + by_contra hn + have : z ∈ zSet G \ zSet B := ⟨zSet_mono h₂.left_le hz, hn⟩ + rw [hZ] at this + exact this.2 hz + exact le_antisymm (le_of_zSet_subset h₁.right_le h₂.left_le hBZ) + (le_of_zSet_subset h₂.left_le h₁.right_le hCZ) + have hAleC : A ≤ C := hleA.trans (le_of_zSet_subset h₃.left_le h₂.left_le hzAC) + have hDleB : D ≤ B := hleDU.trans (le_of_zSet_subset h₄.right_le h₁.right_le hzBD) + have t₁ := lex_thd_lt hl₁ ho₅ (by linarith) + have t₂ := lex_thd_le hl₂ ho₆ (by linarith) + have e₁ : ((B ∪ D) ∩ (A ∩ C)).vertexSet = (B ∩ A).vertexSet := by + ext x + constructor + · rintro ⟨h₅ | h₅, h₆, h₇⟩ + · exact ⟨h₅, h₆⟩ + · exact ⟨hDleB.vertexSet_subset h₅, h₆⟩ + · rintro ⟨h₅, h₆⟩ + exact ⟨Or.inl h₅, h₆, hAleC.vertexSet_subset h₆⟩ + have e₂ : ((A ∪ C) ∩ (B ∩ D)).vertexSet = (C ∩ D).vertexSet := by + ext x + constructor + · rintro ⟨-, h₅, h₆⟩ + exact ⟨hBC ▸ h₅, h₆⟩ + · rintro ⟨h₅, h₆⟩ + exact ⟨Or.inr h₅, hDleB.vertexSet_subset h₆, h₆⟩ + rw [e₁] at t₂ + rw [e₂] at t₁ + exact absurd t₁ (not_lt.mpr t₂) + +/-- Graph Minors XX, (6.1) (page 342): "`λ` is a tie-breaker." -/ +theorem theorem_6_1_proof (hf : f ∈ G.edgeSet) (hv : IsIndependentWeight G v) : + IsTieBreaker G (edgeBasedLam G f v) := + ⟨edgeBased_axiom1 hf hv, edgeBased_axiom2 hf hv, edgeBased_axiom3⟩ + +/-- There is a weight as in (6.1), since `ℝ` has infinite dimension over `ℚ`. -/ +theorem exists_isIndependentWeight (G : Hypergraph α β) : ∃ v, IsIndependentWeight G v := by + classical + let b := Module.Basis.ofVectorSpace ℚ ℝ + let ι := Module.Basis.ofVectorSpaceIndex ℚ ℝ + have hinf : Infinite ι := by + rw [← not_finite_iff_infinite] + intro hfin + have h₁ : Module.rank ℚ ℝ = Cardinal.mk ι := b.mk_eq_rank''.symm + have h₂ : Cardinal.mk ι < Cardinal.aleph0 := Cardinal.lt_aleph0_iff_finite.mpr hfin + rw [← h₁, Real.rank_rat_real] at h₂ + exact absurd h₂ (not_lt.mpr Cardinal.aleph0_le_continuum) + obtain ⟨g, hg⟩ := exists_injOn_of_finite (δ := ι) (finite_zSet G) + let v : α ⊕ β → ℝ := fun x ↦ |b (g x)| + have hpos : ∀ x, 0 < v x := fun x ↦ abs_pos.mpr (b.ne_zero _) + refine ⟨v, fun x _ ↦ hpos x, ?_⟩ + have hli : LinearIndependent ℚ (fun x : zSet G ↦ b (g x.1)) := + b.linearIndependent.comp _ fun x y h ↦ Subtype.ext (hg x.2 y.2 h) + let s : zSet G → ℚˣ := fun x ↦ if 0 ≤ b (g x.1) then 1 else -1 + have := hli.units_smul s + convert this using 1 + ext x + simp only [Pi.smul_apply', s, v] + split_ifs with h + · simp [abs_of_nonneg h] + · simp [abs_of_neg (not_le.mp h)] + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section6c.lean b/LeanPool/GraphMinor/GM20/Section6c.lean new file mode 100644 index 0000000000..3dbf011263 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section6c.lean @@ -0,0 +1,304 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section6b +public import LeanPool.GraphMinor.GM10.Section6 + +/-! +# Graph Minors XX, Section 6, (6.2) + +Let `𝒯` have order `θ₀` and let the rooted location `ℒ` have order below `θ`. When `ℒ/W` is linked +to `𝒯/W` and the tie-breaker is edge-based, `ℒ` isolates `𝒯` at threshold `θ` modulo `W ∪ {f}`. +Uncrossing a member `(A, B)` of `ℒ⁻` with a distinction `(C, D)` keeps the order by linkage. +The tie-breaker then forces `B ⊆ D` and `C ⊆ A`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +theorem isTieBreaker_of_isDefinedBy {G : Hypergraph α β} + {lam : Hypergraph α β × Hypergraph α β → ℝ ×ₗ ℝ ×ₗ ℝ} {f : β} {v : α ⊕ β → ℝ} + (h : IsDefinedBy G lam f v) : IsTieBreaker G lam := by + obtain ⟨hf, hv, heq⟩ := h + have hT := theorem_6_1_proof hf hv + refine ⟨fun A B C D h₁ h₂ ↦ ?_, fun A B C D h₁ h₂ ↦ ?_, fun A B C D h₁ h₂ hlt ↦ ?_⟩ + · rw [heq A B h₁, heq C D h₂] + exact hT.axiom1 h₁ h₂ + · have h₃ : G.IsSeparation (A ∪ C) (B ∩ D) := h₁.union_inter h₂ + have h₄ : G.IsSeparation (A ∩ C) (B ∪ D) := (h₁.symm.union_inter h₂.symm).symm + rw [heq A B h₁, heq C D h₂, heq _ _ h₃, heq _ _ h₄] + exact hT.axiom2 h₁ h₂ + · rw [heq A B h₁, heq C D h₂] + exact hT.axiom3 h₁ h₂ hlt + +/-- Three subhypergraphs covering `G` have union `G`. -/ +theorem union3_eq {G X Y Z : Hypergraph α β} (hX : X ≤ G) (hY : Y ≤ G) (hZ : Z ≤ G) + (hV : ∀ x ∈ G.vertexSet, x ∈ X.vertexSet ∨ x ∈ Y.vertexSet ∨ x ∈ Z.vertexSet) + (hE : ∀ e ∈ G.edgeSet, e ∈ X.edgeSet ∨ e ∈ Y.edgeSet ∨ e ∈ Z.edgeSet) : X ∪ Y ∪ Z = G := by + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq (union_le (union_le hX hY) hZ) le_rfl ?_ ?_ + · refine subset_antisymm (union_le (union_le hX hY) hZ).vertexSet_subset fun x hx ↦ ?_ + rcases hV x hx with h | h | h + · exact Or.inl (Or.inl h) + · exact Or.inl (Or.inr h) + · exact Or.inr h + · refine subset_antisymm (union_le (union_le hX hY) hZ).edgeSet_subset fun x hx ↦ ?_ + rcases hE x hx with h | h | h + · exact Or.inl (Or.inl h) + · exact Or.inl (Or.inr h) + · exact Or.inr h + +theorem quotient_le {A B : Hypergraph α β} (h : A ≤ B) (W : Set α) : + quotientVertices A W ≤ quotientVertices B W := by + refine ⟨fun v hv ↦ ⟨h.vertexSet_subset hv.1, hv.2⟩, h.edgeSet_subset, fun e he ↦ ?_⟩ + ext v + have h₁ : (v ∈ B.ends e) ↔ v ∈ A.ends e := by rw [h.ends_eq e he] + exact and_congr_left fun _ ↦ h₁ + +theorem eq_of_quotient_eq {G A B : Hypergraph α β} (hA : A ≤ G) (hB : B ≤ G) {W : Set α} + (hWA : W ⊆ A.vertexSet) (hWB : W ⊆ B.vertexSet) + (h : quotientVertices A W = quotientVertices B W) : A = B := by + have hV : ∀ {x}, x ∉ W → (x ∈ A.vertexSet ↔ x ∈ B.vertexSet) := fun {x} hx ↦ by + have h₁ : (quotientVertices A W).vertexSet = (quotientVertices B W).vertexSet := by rw [h] + exact ⟨fun h' ↦ (h₁ ▸ (⟨h', hx⟩ : x ∈ (quotientVertices A W).vertexSet) : + x ∈ (quotientVertices B W).vertexSet).1, + fun h' ↦ (h₁.symm ▸ (⟨h', hx⟩ : x ∈ (quotientVertices B W).vertexSet) : + x ∈ (quotientVertices A W).vertexSet).1⟩ + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq hA hB ?_ ?_ + · ext x + by_cases hx : x ∈ W + · exact ⟨fun _ ↦ hWB hx, fun _ ↦ hWA hx⟩ + · exact hV hx + · have h₁ : (quotientVertices A W).edgeSet = (quotientVertices B W).edgeSet := by rw [h] + exact h₁ + +theorem mem_slash_rootSet {A : RootedHypergraph α β} {W : Set α} {v : α} : + v ∈ (A.slash W).rootSet ↔ v ∈ A.rootSet ∧ v ∉ W := + mem_marchSlash + +/-- `(G/W) \ (A/W) = (G \ A)/W`. -/ +theorem complementHypergraph_slash {G A : RootedHypergraph α β} {W : Set α} + (hc : IsComplemented G A) (hcW : IsComplemented (G.slash W) (A.slash W)) : + complementHypergraph (G.slash W) (A.slash W) = quotientVertices (complementHypergraph G A) W + := by + have hle : quotientVertices (complementHypergraph G A) W ≤ quotientVertices G.toHypergraph W := + quotient_le (complementHypergraph_le hc) W + refine eq_of_le_of_vertexSet_eq_of_edgeSet_eq (complementHypergraph_le hcW) hle ?_ rfl + ext v + constructor + · rintro (⟨h₁, h₂⟩ | ⟨h₁, h₂⟩) + · exact ⟨Or.inl ⟨h₁.1, fun h ↦ h₂ ⟨h, h₁.2⟩⟩, h₁.2⟩ + · exact ⟨Or.inr ⟨h₁.1, (mem_slash_rootSet.mp h₂).1⟩, h₁.2⟩ + · rintro ⟨⟨h₁, h₂⟩ | ⟨h₁, h₂⟩, h₃⟩ + · exact Or.inl ⟨⟨h₁, h₃⟩, fun h ↦ h₂ h.1⟩ + · exact Or.inr ⟨⟨h₁, h₃⟩, mem_slash_rootSet.mpr ⟨h₂, h₃⟩⟩ + +/-- `A/W` is complemented in `G/W`. -/ +theorem isComplemented_slash {G A : RootedHypergraph α β} (W : Set α) + (hc : IsComplemented G A) : IsComplemented (G.slash W) (A.slash W) := by + refine ⟨quotient_le hc.le W, fun v hv hr ↦ ?_, fun v e hv he hinc ↦ ?_⟩ + · exact mem_slash_rootSet.mpr ⟨hc.roots_mem hv.1 (mem_slash_rootSet.mp hr).1, hv.2⟩ + · exact mem_slash_rootSet.mpr ⟨hc.inc_diff_mem hv.1 he hinc.1, hv.2⟩ + +variable {G : RootedHypergraph α β} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {W : Set α} + {ℒ : Set (RootedHypergraph α β)} + +/-- What linkage of `ℒ/W` to `𝒯/W` gives for `A ∈ ℒ`. -/ +theorem linked_mem {θ₀ : ℕ} (h𝒯 : IsTangle G.toHypergraph θ₀ 𝒯) (hloc : IsRootedLocation G ℒ) + (hW : ∀ A ∈ ℒ, W ⊆ A.rootSet) + (hlink : IsLinkedTo (G.slash W) (quotientTangle G.toHypergraph 𝒯 W) (locationSlash ℒ W)) + {A} (hA : A ∈ ℒ) : (A.toHypergraph, complementHypergraph G A) ∈ 𝒯 := by + have hc := hloc.isComplemented hA + have hmem := hlink.1 ⟨A.slash W, ⟨A, hA, rfl⟩, rfl⟩ + obtain ⟨-, p, hp, hWp, h₁, h₂⟩ := hmem + have hsep := h𝒯.isSeparation hp + simp only at h₁ h₂ + rw [complementHypergraph_slash hc (isComplemented_slash W hc)] at h₂ + have hAeq := eq_of_quotient_eq hsep.left_le hc.le (fun _ h ↦ (hWp h).1) + (fun _ h ↦ A.roots_subset _ (hW A hA h)) h₁ + have hBeq := eq_of_quotient_eq hsep.right_le (complementHypergraph_le hc) (fun _ h ↦ (hWp h).2) + (fun _ h ↦ Or.inr ⟨hc.le.vertexSet_subset (A.roots_subset _ (hW A hA h)), hW A hA h⟩) h₂ + rw [← hAeq, ← hBeq] + exact hp + +/-- The order of `(A⁻, (G \ A)⁻)` is at most that of any `(A', B') ∈ 𝒯` between it and `G` with +`W ⊆ V(A' ∩ B')`. -/ +theorem linked_order {θ₀ : ℕ} (h𝒯 : IsTangle G.toHypergraph θ₀ 𝒯) (hloc : IsRootedLocation G ℒ) + (hW : ∀ A ∈ ℒ, W ⊆ A.rootSet) + (hlink : IsLinkedTo (G.slash W) (quotientTangle G.toHypergraph 𝒯 W) (locationSlash ℒ W)) + {A} (hA : A ∈ ℒ) {A' B' : Hypergraph α β} (hmem : (A', B') ∈ 𝒯) + (hWp : W ⊆ (A' ∩ B').vertexSet) (h₁ : A.toHypergraph ≤ A') + (h₂ : B' ≤ complementHypergraph G A) : + separationOrder A.toHypergraph (complementHypergraph G A) ≤ separationOrder A' B' := by + have hc := hloc.isComplemented hA + have hsep := h𝒯.isSeparation hmem + have hA' : A.slash W ∈ locationSlash ℒ W := ⟨A, hA, rfl⟩ + have hq : (quotientVertices A' W, quotientVertices B' W) ∈ + quotientTangle G.toHypergraph 𝒯 W := + ⟨GraphMinor.GM10.IsSeparation.quotientVertices hsep W, (A', B'), hmem, hWp, rfl, rfl⟩ + have hbound := hlink.2 hA' hq (quotient_le h₁ W) (by + rw [complementHypergraph_slash hc (isComplemented_slash W hc)] + exact quotient_le h₂ W) + rw [separationOrder_quotientVertices] at hbound + have hfW : W.Finite := (A' ∩ B').vertexSet_finite.subset hWp + have hroot : (A.slash W).rootSet = A.rootSet \ W := by + ext v + exact mem_slash_rootSet + rw [hroot, Set.ncard_sdiff (hW A hA) hfW, Set.ncard_sdiff hWp hfW] at hbound + have h₃ : W.ncard ≤ A.rootSet.ncard := Set.ncard_le_ncard (hW A hA) (List.finite_toSet _) + have h₄ : W.ncard ≤ (A' ∩ B').vertexSet.ncard := + Set.ncard_le_ncard hWp (A' ∩ B').vertexSet_finite + have h₅ := separationOrder_complement_le (G := G) (A := A) + change _ ≤ (A' ∩ B').vertexSet.ncard + omega + +/-- Graph Minors XX, (6.2) (page 344): "Let $G$ be a rooted hypergraph, and let $\mathcal{T}$ be a +tangle in $G$ of order $\theta \ge 1$. +Let $\lambda$ be an edge-based tie-breaker in $G$ defined by $f, v$ say. Let $\mathcal{L}$ +be a rooted location in $G$ with order $< \theta$, and let $W \subseteq V(G)$ be such that +$W \subseteq \bar{\pi}(A)$ for all $A \in \mathcal{L}$. Let $\mathcal{L}/W$ be linked to +$\mathcal{T}/W$. Then $\mathcal{L}$ $\theta$-isolates $\mathcal{T}$ modulo $W \cup \{f\}$." +The Lean theorem takes the order `θ₀` of `𝒯` and the isolation threshold `θ` independently. +The location has order below `θ`, and setting `θ₀ = θ` gives the printed case. -/ +theorem theorem_6_2_proof {θ₀ θ : ℕ} (h𝒯 : IsTangle G.toHypergraph θ₀ 𝒯) + {lam : Hypergraph α β × Hypergraph α β → ℝ ×ₗ ℝ ×ₗ ℝ} {f : β} {v : α ⊕ β → ℝ} + (hlam : IsDefinedBy G.toHypergraph lam f v) (hloc : IsRootedLocation G ℒ) + (hord : ∀ A ∈ ℒ, A.rootSet.ncard < θ) (hW : ∀ A ∈ ℒ, W ⊆ A.rootSet) + (hlink : IsLinkedTo (G.slash W) (quotientTangle G.toHypergraph 𝒯 W) (locationSlash ℒ W)) : + IsolatesModulo lam 𝒯 (Sum.inl '' W ∪ {Sum.inr f}) θ G ℒ := by + have hTB := isTieBreaker_of_isDefinedBy hlam + have hmemA := fun {A} hA ↦ linked_mem (A := A) h𝒯 hloc hW hlink hA + refine ⟨hloc, fun A hA ↦ hord A hA, ?_, ?_⟩ + · rintro _ ⟨A, hA, rfl⟩ + exact hmemA hA + intro A hA θ' 𝒯' h𝒯' hθ' hBA C D hd + by_cases hsub : (Sum.inl '' W ∪ {Sum.inr f} : Set (α ⊕ β)) ⊆ zSet D + swap + · exact Or.inr hsub + refine Or.inl ?_ + have hc := hloc.isComplemented hA + set B := complementHypergraph G A with hB + have hsepAB : G.toHypergraph.IsSeparation A.toHypergraph B := isSeparation_complement hc + have hAT := hmemA hA + have hsepCD : G.toHypergraph.IsSeparation C D := h𝒯.isSeparation hd.1.1 + have hfD : f ∈ D.edgeSet := by + rcases hsub (Or.inr rfl) with ⟨_, _, h⟩ | ⟨e, he, h⟩ + · exact absurd h (by simp) + · exact Sum.inr_injective h ▸ he + have hWD : W ⊆ D.vertexSet := by + intro x hx + rcases hsub (Or.inl ⟨x, hx, rfl⟩) with ⟨y, hy, h⟩ | ⟨_, _, h⟩ + · exact Sum.inl_injective h ▸ hy + · exact absurd h (by simp) + have hordAB : separationOrder A.toHypergraph B < θ := + separationOrder_complement_le.trans_lt (hord A hA) + have hordCD : separationOrder C D < θ := + (order_le_of_distinction hTB h𝒯 h𝒯' hd hAT hBA).trans_lt hordAB + have hordCD₀ : separationOrder C D < θ₀ := h𝒯.order_lt hd.1.1 + have hordAB₀ : separationOrder A.toHypergraph B < θ₀ := h𝒯.order_lt hAT + have h₃ : G.toHypergraph.IsSeparation (A.toHypergraph ∪ C) (B ∩ D) := hsepAB.union_inter hsepCD + have h₄ : G.toHypergraph.IsSeparation (A.toHypergraph ∩ C) (B ∪ D) := + (hsepAB.symm.union_inter hsepCD.symm).symm + -- Subproof (1). + have hone : lam (C, D) ≤ lam (A.toHypergraph ∩ C, B ∪ D) := by + by_cases hle : separationOrder (A.toHypergraph ∩ C) (B ∪ D) ≤ separationOrder C D + · have h₅ : (A.toHypergraph ∩ C, B ∪ D) ∈ 𝒯 := by + rcases h𝒯.axiom1 h₄ (hle.trans_lt hordCD₀) with h | h + · exact h + · exact (not_le_of_mem_tangle h𝒯 h hAT + (le_union_left hsepAB.right_le hsepCD.right_le)).elim + have h₆ : (B ∪ D, A.toHypergraph ∩ C) ∈ 𝒯' := by + rcases h𝒯'.axiom1 h₄ (hle.trans_lt (hordCD.trans_le hθ')) with h | h + · exfalso + refine h𝒯'.axiom2 h hBA hd.1.2 (union3_eq (inter_le hsepAB.left_le hsepCD.left_le) + hsepAB.right_le hsepCD.right_le (fun x hx ↦ ?_) fun e he ↦ ?_) + · rw [← hsepAB.vertexSet_union] at hx + have hx' := hx + rw [hsepAB.vertexSet_union, ← hsepCD.vertexSet_union] at hx' + rcases hx with h₁ | h₁ + · rcases hx' with h₂ | h₂ + · exact Or.inl ⟨h₁, h₂⟩ + · exact Or.inr (Or.inr h₂) + · exact Or.inr (Or.inl h₁) + · rw [← hsepAB.edgeSet_union] at he + have he' := he + rw [hsepAB.edgeSet_union, ← hsepCD.edgeSet_union] at he' + rcases he with h₁ | h₁ + · rcases he' with h₂ | h₂ + · exact Or.inl ⟨h₁, h₂⟩ + · exact Or.inr (Or.inr h₂) + · exact Or.inr (Or.inl h₁) + · exact h + exact hd.2 ⟨h₅, h₆⟩ + · exact (hTB.axiom3 hsepCD h₄ (not_le.mp hle)).le + have hlam₃ : lam (A.toHypergraph ∪ C, B ∩ D) ≤ lam (A.toHypergraph, B) := by + rcases hTB.axiom2 hsepAB hsepCD with h | h + · exact h + · exact absurd h (not_lt.mpr hone) + have hordU : separationOrder (A.toHypergraph ∪ C) (B ∩ D) ≤ separationOrder A.toHypergraph B := + order_le_of_lam_le hTB h₃ hsepAB hlam₃ + have hmemU : (A.toHypergraph ∪ C, B ∩ D) ∈ 𝒯 := by + rcases h𝒯.axiom1 h₃ (hordU.trans_lt hordAB₀) with h | h + · exact h + · exfalso + refine h𝒯.axiom2 hAT hd.1.1 h (union3_eq hsepAB.left_le hsepCD.left_le + (inter_le hsepAB.right_le hsepCD.right_le) (fun x hx ↦ ?_) fun e he ↦ ?_) + · have hx' := hx + rw [← hsepCD.vertexSet_union] at hx' + rw [← hsepAB.vertexSet_union] at hx + rcases hx with h₁ | h₁ + · exact Or.inl h₁ + · rcases hx' with h₂ | h₂ + · exact Or.inr (Or.inl h₂) + · exact Or.inr (Or.inr ⟨h₁, h₂⟩) + · have he' := he + rw [← hsepCD.edgeSet_union] at he' + rw [← hsepAB.edgeSet_union] at he + rcases he with h₁ | h₁ + · exact Or.inl h₁ + · rcases he' with h₂ | h₂ + · exact Or.inr (Or.inl h₂) + · exact Or.inr (Or.inr ⟨h₁, h₂⟩) + have hWU : W ⊆ ((A.toHypergraph ∪ C) ∩ (B ∩ D)).vertexSet := fun x hx ↦ + ⟨Or.inl (A.roots_subset x (hW A hA hx)), + Or.inr ⟨hc.le.vertexSet_subset (A.roots_subset x (hW A hA hx)), hW A hA hx⟩, hWD hx⟩ + have hordL : separationOrder A.toHypergraph B ≤ + separationOrder (A.toHypergraph ∪ C) (B ∩ D) := linked_order h𝒯 hloc hW hlink hA hmemU hWU + (le_union_left hsepAB.left_le hsepCD.left_le) (inter_le_left hsepAB.right_le hsepCD.right_le) + have hsum := order_add_order hsepAB hsepCD + have hordI : separationOrder C D = separationOrder (A.toHypergraph ∩ C) (B ∪ D) := by omega + have hfC : f ∉ C.edgeSet := IsSeparation.not_mem_of_mem hsepCD.symm hfD + have hfI : f ∉ (A.toHypergraph ∩ C).edgeSet := fun h ↦ hfC h.2 + have htr : edgeBasedTriple G.toHypergraph v D C ≤ + edgeBasedTriple G.toHypergraph v (B ∪ D) (A.toHypergraph ∩ C) := by + have := hone + rw [hlam.2.2 _ _ hsepCD, hlam.2.2 _ _ h₄, edgeBasedLam_of_notMem hfC, + edgeBasedLam_of_notMem hfI] at this + exact this + have heq := tie_step hlam.2.1 h₄.right_le + (zSet_mono (le_union_right hsepAB.right_le hsepCD.right_le)) + (inter_le_right hsepAB.left_le hsepCD.left_le) + (by rw [separationOrder_comm D C, separationOrder_comm (B ∪ D) _]; exact hordI) htr + obtain ⟨h₅, h₆⟩ := eq_of_triple_eq hlam.2.1 hsepCD.symm h₄.symm heq + have hCA : C ≤ A.toHypergraph := by + rw [h₆] + exact inter_le_left hsepAB.left_le hsepCD.left_le + have hBD : B ≤ D := by + rw [h₅] + exact le_union_left hsepAB.right_le hsepCD.right_le + exact ⟨hCA, hBD⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section6d.lean b/LeanPool/GraphMinor/GM20/Section6d.lean new file mode 100644 index 0000000000..67b5e8d68d --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section6d.lean @@ -0,0 +1,211 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section6c +public import Mathlib.Data.Nat.Nth + +/-! +# Graph Minors XX, Section 6, (6.3) + +Using an edge-based tie-breaker, (6.2) turns the hypothesis of (6.3) into the hypothesis of (5.7). +If +some `Gᵢ` has no edges there is no such tie-breaker, and the paper notes that two such patchworks +are +compared by their numbers of vertices, which `simulated_of_edgeless` does. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +/-- A rootless edgeless patchwork is simulated in one with at least as many vertices. -/ +theorem simulated_of_edgeless {Ω : Type*} [Preorder Ω] {P Q : Patchwork Ω α β} + (hP : IsRootless P) (hQ : IsRootless Q) (hPe : P.G.edgeSet = ∅) (hQe : Q.G.edgeSet = ∅) + (hcard : P.G.vertexSet.ncard ≤ Q.G.vertexSet.ncard) : Simulated P Q := by + classical + have hf₁ : Fintype P.G.vertexSet := P.G.vertexSet_finite.fintype + have hf₂ : Fintype Q.G.vertexSet := Q.G.vertexSet_finite.fintype + have hc : Fintype.card P.G.vertexSet ≤ Fintype.card Q.G.vertexSet := by + rw [← Nat.card_eq_fintype_card, ← Nat.card_eq_fintype_card, Nat.card_coe_set_eq, + Nat.card_coe_set_eq] + exact hcard + obtain ⟨g⟩ := Function.Embedding.nonempty_of_card_le hc + let ηv : α → Set α := fun v ↦ if h : v ∈ P.G.vertexSet then {(g ⟨v, h⟩).1} else ∅ + have hη : ∀ {v} (h : v ∈ P.G.vertexSet), ηv v = {(g ⟨v, h⟩).1} := fun h ↦ dite_eq_left h + have hroots : ∀ {R : Patchwork Ω α β}, IsRootless R → R.G.roots = [] := by + intro R hR + refine List.eq_nil_iff_forall_not_mem.mpr fun x hx ↦ ?_ + have : x ∈ R.G.rootSet := hx + rw [show R.G.rootSet = ∅ from hR] at this + exact this + have hdom : ∀ {e}, e ∉ P.dom := fun {e} h ↦ by + have := P.dom_subset h + rw [hPe] at this + exact this + have hnot : ∀ {e}, e ∉ P.G.edgeSet := fun {e} h ↦ by + rw [hPe] at h + exact h + have hexp : IsExpansion P Q ηv id := + { vertex_nonempty := fun v hv ↦ by rw [hη hv]; exact singleton_nonempty _ + vertex_subset := fun v hv ↦ by + rw [hη hv] + exact singleton_subset_iff.mpr (g ⟨v, hv⟩).2 + edge_mem := fun e he ↦ absurd he hnot + vertex_disjoint := fun v₁ h₁ v₂ h₂ hne ↦ by + rw [hη h₁, hη h₂, Set.disjoint_singleton] + intro h + exact hne (congrArg Subtype.val (g.injective (Subtype.ext h))) + edge_injOn := fun e he ↦ absurd he hnot + mem_dom_iff := fun e he ↦ absurd he hnot + ends_nonempty := fun e he ↦ absurd he hnot + μ_length := fun e he ↦ absurd he hdom + μ_mem := fun e he ↦ absurd he hdom + roots_length := by rw [hroots hP, hroots hQ] + roots_mem := fun i hi ↦ absurd hi (by rw [hroots hP]; simp) + maps_Δ := fun e he ↦ absurd he hdom + φ_le := fun e he ↦ absurd he hnot } + refine ⟨ηv, id, hexp, emptySubgraph Q.G.vertexSet, ?_, fun v hv ↦ ?_⟩ + · have hrem : (Q.deleteEdges (id '' P.G.edgeSet)).IsRemovable := fun e he ↦ by + have h₁ : e ∈ Q.G.edgeSet := he.1 + rw [hQe] at h₁ + exact h₁.elim + exact hrem.emptySubgraph_isRealization + · rw [hη hv] + have hgv := (g ⟨v, hv⟩).2 + exact (exists_isComponent_verts_eq_iff (singleton_nonempty _) + (singleton_subset_iff.mpr hgv)).mpr ⟨fun a _ b hab ↦ (not_emptySubgraph_adj hab).elim, + fun a ha b hb ↦ by + rw [mem_singleton_iff.mp ha, mem_singleton_iff.mp hb] + exact sameComponent_iff.mpr ⟨hgv, hgv, SimpleGraph.Reachable.refl _⟩⟩ + +variable {G : RootedHypergraph α β} {𝒯 : Set (Hypergraph α β × Hypergraph α β)} {W : Set α} + {ℒ : Set (RootedHypergraph α β)} + +theorem quotientTangle_mono {𝒯₁ 𝒯₂ : Set (Hypergraph α β × Hypergraph α β)} (h : 𝒯₁ ⊆ 𝒯₂) + (G : Hypergraph α β) (W : Set α) : quotientTangle G 𝒯₁ W ⊆ quotientTangle G 𝒯₂ W := by + rintro p ⟨h₁, q, hq, h₂⟩ + exact ⟨h₁, q, h hq, h₂⟩ + +theorem rootSet_ncard_le_order {A : RootedHypergraph α β} (hc : IsComplemented G A) : + A.rootSet.ncard ≤ separationOrder A.toHypergraph (complementHypergraph G A) := by + refine Set.ncard_le_ncard (fun v hv ↦ ?_) (A.toHypergraph ∩ _).vertexSet_finite + exact ⟨A.roots_subset v hv, Or.inr ⟨hc.le.vertexSet_subset (A.roots_subset v hv), hv⟩⟩ + +/-- If `ℒ/W` is linked to the truncation of `𝒯` to order `θ` then the order of `ℒ` is `< θ` and +`ℒ/W` is linked to `𝒯/W`. -/ +theorem linked_truncation {θ₀ θ : ℕ} (h𝒯 : IsTangle G.toHypergraph θ₀ (truncation 𝒯 θ)) + (hloc : IsRootedLocation G ℒ) (hW : ∀ A ∈ ℒ, W ⊆ A.rootSet) + (hlink : IsLinkedTo (G.slash W) (quotientTangle G.toHypergraph (truncation 𝒯 θ) W) + (locationSlash ℒ W)) : + (∀ A ∈ ℒ, A.rootSet.ncard < θ) ∧ + IsLinkedTo (G.slash W) (quotientTangle G.toHypergraph 𝒯 W) (locationSlash ℒ W) := by + have hsub : truncation 𝒯 θ ⊆ 𝒯 := fun _ h ↦ h.1 + have hord : ∀ A ∈ ℒ, A.rootSet.ncard < θ := fun A hA ↦ + (rootSet_ncard_le_order (hloc.isComplemented hA)).trans_lt + (linked_mem h𝒯 hloc hW hlink hA).2 + refine ⟨hord, (hlink.1.trans (quotientTangle_mono hsub _ _)), ?_⟩ + rintro _ ⟨A, hA, rfl⟩ A' B' ⟨hsep, p, hp, hWp, h₁, h₂⟩ h₃ h₄ + by_cases hlt : separationOrder p.1 p.2 < θ + · exact hlink.2 ⟨A, hA, rfl⟩ ⟨hsep, p, ⟨hp, hlt⟩, hWp, h₁, h₂⟩ h₃ h₄ + · simp only at h₁ h₂ hlt + rw [← h₁, ← h₂, separationOrder_quotientVertices] + have hfW : W.Finite := (p.1 ∩ p.2).vertexSet_finite.subset hWp + have hroot : (A.slash W).rootSet = A.rootSet \ W := by + ext v + exact mem_slash_rootSet + rw [hroot, Set.ncard_sdiff (hW A hA) hfW, Set.ncard_sdiff hWp hfW] + have h₅ := hord A hA + have h₆ : separationOrder p.1 p.2 = (p.1 ∩ p.2).vertexSet.ncard := rfl + omega + +/-- (6.3) when each `Gᵢ` has an edge. -/ +theorem theorem_6_3_of_edges [Infinite β] {Ω : Type (max u v)} [Preorder Ω] + (hΩ : WellQuasiOrderedLE Ω) + {𝓕 : Set (UnlabeledPatchwork α β)} (h𝓕 : WellBehaved 𝓕) {θ : ℕ} (hθ : 1 ≤ θ) + (P : ℕ → GM04.Patchwork Ω α β) (hP : ∀ i, IsRootless (P i) ∧ (P i).IsRobust) + (hE : ∀ i, (P i).G.edgeSet.Nonempty) + (h : ∀ i (θ' : ℕ) (𝒯 : Set (Hypergraph α β × Hypergraph α β)), + IsTangle (P i).G.toHypergraph θ' 𝒯 → θ ≤ θ' → ∃ (W : Set α) + (ℒ : Set (RootedHypergraph α β)), W ⊆ (P i).G.vertexSet ∧ W.ncard < θ ∧ + IsFine (P i).G ℒ ∧ IsRootedLocation (P i).G ℒ ∧ (∀ A ∈ ℒ, W ⊆ A.rootSet) ∧ + IsLinkedTo ((P i).G.slash W) (quotientTangle (P i).G.toHypergraph 𝒯 W) + (locationSlash ℒ W) ∧ + ∃ Q ∈ 𝓕, HasPatchworkHeart ((P i).relabel fun _ ↦ ()) ℒ Q) : + ∃ i j, i < j ∧ GM04.Simulated (P i) (P j) := by + classical + choose f hf using hE + choose v hv using fun i ↦ exists_isIndependentWeight (P i).G.toHypergraph + have hdef : ∀ i, IsDefinedBy (P i).G.toHypergraph (edgeBasedLam (P i).G.toHypergraph (f i) (v i)) + (f i) (v i) := fun i ↦ ⟨hf i, hv i, fun _ _ _ ↦ rfl⟩ + refine theorem_5_7_proof hΩ h𝓕 hθ P hP (fun _ ↦ ℝ ×ₗ ℝ ×ₗ ℝ) + (fun i ↦ edgeBasedLam (P i).G.toHypergraph (f i) (v i)) + (fun i ↦ isTieBreaker_of_isDefinedBy (hdef i)) ?_ + intro i θ' 𝒯 h𝒯 hθ' + have h𝒯₀ := h𝒯.truncation hθ hθ' + obtain ⟨W, ℒ, hWV, hWθ, hfine, hloc, hWA, hlink, hheart⟩ := h i θ _ h𝒯₀ le_rfl + obtain ⟨hord, hlink'⟩ := linked_truncation h𝒯₀ hloc hWA hlink + refine ⟨Sum.inl '' W ∪ {Sum.inr (f i)}, ℒ, ?_, ?_, hfine, + theorem_6_2_proof h𝒯 (hdef i) hloc hord hWA hlink', hheart⟩ + · rintro x (⟨y, hy, rfl⟩ | rfl) + · exact Or.inl ⟨y, hWV hy, rfl⟩ + · exact Or.inr ⟨f i, hf i, rfl⟩ + · have hfin : W.Finite := (P i).G.vertexSet_finite.subset hWV + have h₁ := Set.ncard_union_le (Sum.inl '' W : Set (α ⊕ β)) {Sum.inr (f i)} + have h₂ := Set.ncard_image_le (f := (Sum.inl : α → α ⊕ β)) hfin + rw [Set.ncard_singleton] at h₁ + omega + +/-- Graph Minors XX, (6.3) (page 345): "Let $\Omega$ be a well-quasi-order, let $\mathcal{F}$ be a +well-behaved set of patchworks, +and let $\theta \ge 1$. Let $P_i = (G_i, \mu_i, \Delta_i, \phi_i)$ ($i = 1, 2, \ldots$) be a +countable sequence of rootless robust $\Omega$-patchworks. Suppose that for each tangle +$\mathcal{T}$ in $G_i$ of order $\ge \theta$, there exist $W \subseteq V(G_i)$ with $|W| < +\theta$ and a fine rooted location $\mathcal{L}$ in $G_i$, such that* - *$W \subseteq +\bar{\pi}(A)$ for all $A \in \mathcal{L}$,* - *$\mathcal{L}/W$ is linked to $\mathcal{T}/W$, +and* - *$\mathcal{F}$ contains a heart of $((G_i, \mu_i, \Delta_i), \mathcal{L})$.* *Then +there exist $j > i \ge 1$ such that $P_i$ is simulated in $P_j$." + +Lean uses an infinite ambient edge type to provide fresh edge labels. +The simulation is the IV relation described in `WellBehaved`. -/ +theorem theorem_6_3_proof [Infinite β] {Ω : Type (max u v)} [Preorder Ω] (hΩ : WellQuasiOrderedLE Ω) + {𝓕 : Set (UnlabeledPatchwork α β)} (h𝓕 : WellBehaved 𝓕) {θ : ℕ} (hθ : 1 ≤ θ) + (P : ℕ → GM04.Patchwork Ω α β) (hP : ∀ i, IsRootless (P i) ∧ (P i).IsRobust) + (h : ∀ i (θ' : ℕ) (𝒯 : Set (Hypergraph α β × Hypergraph α β)), + IsTangle (P i).G.toHypergraph θ' 𝒯 → θ ≤ θ' → ∃ (W : Set α) + (ℒ : Set (RootedHypergraph α β)), W ⊆ (P i).G.vertexSet ∧ W.ncard < θ ∧ + IsFine (P i).G ℒ ∧ IsRootedLocation (P i).G ℒ ∧ (∀ A ∈ ℒ, W ⊆ A.rootSet) ∧ + IsLinkedTo ((P i).G.slash W) (quotientTangle (P i).G.toHypergraph 𝒯 W) + (locationSlash ℒ W) ∧ + ∃ Q ∈ 𝓕, HasPatchworkHeart ((P i).relabel fun _ ↦ ()) ℒ Q) : + ∃ i j, i < j ∧ GM04.Simulated (P i) (P j) := by + by_cases hS : {i | (P i).G.edgeSet = ∅}.Infinite + · -- Two of the edgeless patchworks compare by their numbers of vertices. + let e := Nat.nth (· ∈ {i | (P i).G.edgeSet = ∅}) + have he : StrictMono e := Nat.nth_strictMono hS + have hmem : ∀ k, (P (e k)).G.edgeSet = ∅ := fun k ↦ Nat.nth_mem_of_infinite hS k + have hw : WellQuasiOrderedLE ℕ := inferInstance + obtain ⟨k, l, hkl, hc⟩ := hw.wqo fun k ↦ (P (e k)).G.vertexSet.ncard + exact ⟨e k, e l, he hkl, simulated_of_edgeless (hP _).1 (hP _).1 (hmem k) (hmem l) hc⟩ + · have hfin : {i | (P i).G.edgeSet = ∅}.Finite := Set.not_infinite.mp hS + obtain ⟨N, hN⟩ := hfin.bddAbove + obtain ⟨i, j, hij, hsim⟩ := theorem_6_3_of_edges hΩ h𝓕 hθ (fun i ↦ P (i + N + 1)) + (fun i ↦ hP _) (fun i ↦ by + by_contra hn + have h₁ := hN (Set.not_nonempty_iff_eq_empty.mp hn) + omega) (fun i ↦ h _) + exact ⟨i + N + 1, j + N + 1, by omega, hsim⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section7a.lean b/LeanPool/GraphMinor/GM20/Section7a.lean new file mode 100644 index 0000000000..c8ea8d5aca --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section7a.lean @@ -0,0 +1,221 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section6d + +/-! +# Graph Minors XX, Section 7, (7.1) + +For a free patchwork `P` and a set `W` of roots, the groupings feasible in `P/W` are those `K` with +`K ∪ N_W` feasible in `P`. One direction adds the vertices of `W` as isolated vertices. For the +other, +take a realization `H` of `P`. No root outside `W` is connected to `W` in `H`, so deleting `W` keeps +the connections between the roots outside `W`, and the free patches allow the deletion. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} {Ω : Type*} + +/-- Feasibility depends only on the base and the march of the roots. -/ +theorem feasible_of_sameBase {Ω₂ : Type*} {P : Patchwork Ω α β} {Q : Patchwork Ω₂ α β} + (hb : SameBase P Q) (hr : P.G.roots = Q.G.roots) {K : (⊤ : SimpleGraph α).Subgraph} + (hK : IsFeasibleGrouping P K) : IsFeasibleGrouping Q K := by + have hrs : P.G.rootSet = Q.G.rootSet := by + change {v | v ∈ P.G.roots} = {v | v ∈ Q.G.roots} + rw [hr] + obtain ⟨h₁, h₂, H, hH, hc⟩ := hK + refine ⟨hrs ▸ h₁, hrs ▸ h₂, H, hH.congr hb.vertexSet_eq hb.edgeSet_eq fun e he ↦ hb.Δ_eq he, ?_⟩ + rw [← hrs] + exact hc + +theorem sameComponent_of_adj_imp {T H : (⊤ : SimpleGraph α).Subgraph} + (hadj : ∀ a b, T.Adj a b → H.Adj a b) {x y : α} (hx : x ∈ H.verts) + (h : sameComponent T x y) : sameComponent H x y := by + obtain ⟨hp, hq, hr⟩ := sameComponent_iff.mp h + rw [SimpleGraph.reachable_iff_reflTransGen] at hr + suffices ∀ w : T.verts, Relation.ReflTransGen T.coe.Adj ⟨x, hp⟩ w → sameComponent H x w.1 from + this ⟨y, hq⟩ hr + intro w hw + induction hw with + | refl => exact sameComponent_iff.mpr ⟨hx, hx, SimpleGraph.Reachable.refl _⟩ + | @tail a b _ hab ih => exact ih.trans (sameComponent_of_adj (hadj a.1 b.1 hab)) + +theorem eq_of_sameComponent_of_isolated {T : (⊤ : SimpleGraph α).Subgraph} {w y : α} + (hiso : ∀ b, ¬ T.Adj w b) (h : sameComponent T w y) : w = y := by + obtain ⟨hp, hq, hr⟩ := sameComponent_iff.mp h + rw [SimpleGraph.reachable_iff_reflTransGen] at hr + suffices ∀ z : T.verts, Relation.ReflTransGen T.coe.Adj ⟨w, hp⟩ z → w = z.1 from + this ⟨y, hq⟩ hr + intro z hz + induction hz with + | refl => rfl + | @tail a b _ hab ih => + have h₁ : T.Adj a.1 b.1 := hab + rw [← ih] at h₁ + exact absurd h₁ (hiso _) + +/-- Removing the vertices of `W` from a subgraph. -/ +def dropVerts (δ : (⊤ : SimpleGraph α).Subgraph) (W : Set α) : (⊤ : SimpleGraph α).Subgraph where + verts := δ.verts \ W + Adj a b := δ.Adj a b ∧ a ∉ W ∧ b ∉ W + adj_sub h := δ.adj_sub h.1 + edge_vert h := ⟨δ.edge_vert h.1, h.2.1⟩ + symm := ⟨fun _ _ h ↦ ⟨h.1.symm, h.2.2, h.2.1⟩⟩ + +theorem isGrouping_dropVerts {V W : Set α} {δ : (⊤ : SimpleGraph α).Subgraph} + (h : IsGrouping V δ) : IsGrouping (V \ W) (dropVerts δ W) := by + rw [isGrouping_iff] at h ⊢ + refine ⟨fun x hx ↦ ⟨h.1 hx.1, hx.2⟩, fun a b c hac hab hbc ↦ ?_⟩ + exact ⟨h.2 a b c hac hab.1 hbc.1, hab.2.1, hbc.2.2⟩ + +/-- Graph Minors XX, (7.1), the direction from `P/W` to `P`. -/ +theorem feasible_of_feasible_slash {P : Patchwork Ω α β} {W : Set α} (hW : W ⊆ P.G.rootSet) + {K : (⊤ : SimpleGraph α).Subgraph} (hK : IsFeasibleGrouping (P.slash W) K) : + IsFeasibleGrouping P (K ⊔ emptySubgraph W) := by + obtain ⟨hg, hv, H, hH, hc⟩ := hK + have hrs : (P.slash W).G.rootSet = P.G.rootSet \ W := by + ext x + exact mem_slash_rootSet + rw [hrs] at hg hv hc + have hWV : W ⊆ P.G.vertexSet := fun x hx ↦ P.G.roots_subset x (hW hx) + have hKW : W ∩ P.G.rootSet = W := inter_eq_left.mpr hW + have hgr : IsGrouping P.G.rootSet (K ⊔ emptySubgraph W) := by + have := isGrouping_sup_emptySubgraph (Z := P.G.rootSet) hg + rwa [hKW] at this + have hreal : P.IsRealization (H ⊔ emptySubgraph W) := by + refine realization_sup_emptySubgraph W hH ?_ rfl fun e he δ hδ ↦ ?_ + · change P.G.vertexSet = (P.G.vertexSet \ W) ∪ W + rw [Set.sdiff_union_of_subset hWV] + · have h₂ := hδ.2.2 + rwa [P.Δ_verts e he] at h₂ + have hHv : H.verts = P.G.vertexSet \ W := hH.verts_eq + have hadj : ∀ a b, (H ⊔ emptySubgraph W).Adj a b → H.Adj a b := fun a b h ↦ by + simpa [not_emptySubgraph_adj] using h + have hiso : ∀ {w}, w ∈ W → ∀ {y}, sameComponent (H ⊔ emptySubgraph W) w y → w = y := by + intro w hw y h + refine eq_of_sameComponent_of_isolated (fun b hb ↦ ?_) h + have := H.edge_vert (hadj w b hb) + rw [hHv] at this + exact this.2 hw + refine ⟨hgr, ?_, _, hreal, fun x hx y hy hne ↦ ?_⟩ + · change K.verts ∪ W = _ + rw [hv, Set.sdiff_union_of_subset hW] + rw [← sameComponent_iff_connectedIn] + have hsup : (K ⊔ emptySubgraph W).Adj x y ↔ K.Adj x y := by + simp [not_emptySubgraph_adj] + rw [hsup] + have hKW : ∀ {a b}, K.Adj a b → a ∉ W ∧ b ∉ W := fun {a b} h ↦ by + have h₁ := K.edge_vert h + have h₂ := K.edge_vert h.symm + rw [hv] at h₁ h₂ + exact ⟨h₁.2, h₂.2⟩ + by_cases hxW : x ∈ W + · exact ⟨fun h ↦ absurd (hiso hxW h) hne, fun h ↦ absurd hxW (hKW h).1⟩ + by_cases hyW : y ∈ W + · exact ⟨fun h ↦ absurd (hiso hyW h.symm) hne.symm, fun h ↦ absurd hyW (hKW h).2⟩ + have hxV : x ∈ H.verts := by + rw [hHv] + exact ⟨P.G.roots_subset x hx, hxW⟩ + rw [← hc x ⟨hx, hxW⟩ y ⟨hy, hyW⟩ hne, ← sameComponent_iff_connectedIn] + exact ⟨sameComponent_of_adj_imp hadj hxV, sameComponent.mono le_sup_left⟩ + +/-- Graph Minors XX, (7.1), the direction from `P` to `P/W`, where `P` is free. -/ +theorem feasible_slash_of_feasible {P : Patchwork Ω α β} (hfree : IsFree P) {W : Set α} + (hW : W ⊆ P.G.rootSet) {K : (⊤ : SimpleGraph α).Subgraph} (hg : IsGrouping (P.G.rootSet \ W) K) + (hv : K.verts = P.G.rootSet \ W) (hK : IsFeasibleGrouping P (K ⊔ emptySubgraph W)) : + IsFeasibleGrouping (P.slash W) K := by + obtain ⟨-, -, H, ⟨δ, hδ, rfl⟩, hc⟩ := hK + have hrs : (P.slash W).G.rootSet = P.G.rootSet \ W := by + ext x + exact mem_slash_rootSet + have hmem : ∀ e ∈ (P.slash W).G.edgeSet, dropVerts (δ e) W ∈ (P.slash W).Δ e := by + intro e he + have hgr := (P.Δ e).isGrouping _ (hδ e he) + have hvt := (P.Δ e).verts_eq _ (hδ e he) + have hdg : IsGrouping ((P.Δ e).verts \ W) (dropVerts (δ e) W) := isGrouping_dropVerts hgr + have hdv : (dropVerts (δ e) W).verts = (P.Δ e).verts \ W := by + change (δ e).verts \ W = _ + rw [hvt] + refine ⟨hdg, hdv, hfree e he _ (isGrouping_sup_emptySubgraph hdg) ?_⟩ + change (dropVerts (δ e) W).verts ∪ (W ∩ (P.Δ e).verts) = _ + rw [hdv] + ext x + by_cases hx : x ∈ W <;> simp [hx] + have hreal : (P.slash W).IsRealization + (realizationOf (P.slash W).G.toHypergraph fun e ↦ dropVerts (δ e) W) := ⟨_, hmem, rfl⟩ + set H' := realizationOf (P.slash W).G.toHypergraph fun e ↦ dropVerts (δ e) W with hH' + set H := realizationOf P.G.toHypergraph δ with hH + have hHr : P.IsRealization H := ⟨δ, hδ, rfl⟩ + have hsup : ∀ {x y}, (K ⊔ emptySubgraph W).Adj x y ↔ K.Adj x y := by + intro x y + simp [not_emptySubgraph_adj] + have hH'H : ∀ a b, H'.Adj a b → H.Adj a b := by + intro a b h + obtain ⟨e, he, h₁⟩ := realizationOf_adj.mp h + exact realizationOf_adj.mpr ⟨e, he, h₁.1⟩ + refine ⟨hrs ▸ hg, hrs ▸ hv, H', hreal, fun x hx y hy hne ↦ ?_⟩ + rw [hrs] at hx hy + have hxr := hx.1 + have hyr := hy.1 + rw [← sameComponent_iff_connectedIn] + have hcon := hc x hxr y hyr hne + rw [← sameComponent_iff_connectedIn, hsup] at hcon + rw [← hcon] + constructor + · refine sameComponent_of_forall_adj ?_ (fun a b h ↦ sameComponent_of_adj (hH'H a b h)) + rw [hreal.verts_eq, hHr.verts_eq] + exact fun z hz ↦ hz.1 + · intro hxy + -- No vertex connected to `x` in `H` lies in `W`. + have hnoW : ∀ {w}, sameComponent H x w → w ∉ W := by + intro w hw hwW + have hne' : x ≠ w := fun h ↦ hx.2 (h ▸ hwW) + have h₁ := hc x hxr w (hW hwW) hne' + rw [← sameComponent_iff_connectedIn, hsup] at h₁ + have h₂ := K.edge_vert (h₁.mp hw).symm + rw [hv] at h₂ + exact h₂.2 hwW + have hxH' : x ∈ H'.verts := by + rw [hreal.verts_eq] + exact ⟨P.G.roots_subset x hxr, hx.2⟩ + obtain ⟨hxV, hyV, hr⟩ := sameComponent_iff.mp hxy + rw [SimpleGraph.reachable_iff_reflTransGen] at hr + suffices hS : ∀ w : H.verts, Relation.ReflTransGen H.coe.Adj ⟨x, hxV⟩ w → + sameComponent H x w.1 ∧ sameComponent H' x w.1 from (hS ⟨y, hyV⟩ hr).2 + intro w hw + induction hw with + | refl => exact ⟨sameComponent_iff.mpr ⟨hxV, hxV, SimpleGraph.Reachable.refl _⟩, + sameComponent_iff.mpr ⟨hxH', hxH', SimpleGraph.Reachable.refl _⟩⟩ + | @tail a b _ hab ih => + have hab' : H.Adj a.1 b.1 := hab + have h₁ := ih.1.trans (sameComponent_of_adj hab') + refine ⟨h₁, ih.2.trans (sameComponent_of_adj ?_)⟩ + obtain ⟨e, he, h₂⟩ := realizationOf_adj.mp hab' + exact realizationOf_adj.mpr ⟨e, he, h₂, hnoW ih.1, hnoW h₁⟩ + +/-- Graph Minors XX, (7.1) (page 346): "Let $P = (G, \mu, \Delta)$ be a free patchwork and $W +\subseteq \bar{\pi}(G)$. Let $K$ be a +grouping with $V(K) = \bar{\pi}(G) \setminus W$. Then $K$ is feasible in $P/W$ if and only +if $K \cup N_W$ is feasible in $P$." -/ +theorem theorem_7_1_proof {P : Patchwork Ω α β} (hfree : IsFree P) {W : Set α} + (hW : W ⊆ P.G.rootSet) + {K : (⊤ : SimpleGraph α).Subgraph} (hg : IsGrouping (P.G.rootSet \ W) K) + (hv : K.verts = P.G.rootSet \ W) : + IsFeasibleGrouping (P.slash W) K ↔ IsFeasibleGrouping P (K ⊔ emptySubgraph W) := + ⟨feasible_of_feasible_slash hW, feasible_slash_of_feasible hfree hW hg hv⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section7b.lean b/LeanPool/GraphMinor/GM20/Section7b.lean new file mode 100644 index 0000000000..81831dca81 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section7b.lean @@ -0,0 +1,457 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section7a + +/-! +# Graph Minors XX, Section 7, (7.2) and (7.3) + +A rooted location `ℒ` in `G/W` lifts to a rooted location `ℒ'` in `G`, by putting `W` into each +member +as roots. For free `P`, (7.1) shows that a heart of `(P, ℒ')`, slashed by `W`, is a heart of +`(P/W, ℒ)`, and so (4.9) applies. Together with (6.3) this gives (7.3). +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set GraphMinor.GM18 GraphMinor.GM10 Hypergraph GraphMinor.GM04 + +universe u v + +variable {α : Type u} {β : Type v} + +section Lift + +variable (G : RootedHypergraph α β) {l : List α} (hl : l.Nodup) + +/-- `A` with the terms of `l` added as roots, with the incidences of `G`. -/ +noncomputable def liftRooted (A : RootedHypergraph α β) : RootedHypergraph α β where + vertexSet := A.vertexSet ∪ {v | v ∈ l} + edgeSet := A.edgeSet + Inc e v := e ∈ A.edgeSet ∧ G.Inc e v ∧ v ∈ A.vertexSet ∪ {v | v ∈ l} + vertex_mem_of_inc _ _ h := h.2.2 + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := A.vertexSet_finite.union (List.finite_toSet _) + edgeSet_finite := A.edgeSet_finite + roots := A.roots ++ marchSlash l A.vertexSet + roots_nodup := by + refine List.Nodup.append A.roots_nodup (nodup_marchSlash hl _) fun x hx hx' ↦ ?_ + exact (mem_marchSlash.mp hx').2 (A.roots_subset x hx) + roots_subset x hx := by + rcases List.mem_append.mp hx with h | h + · exact Or.inl (A.roots_subset x h) + · exact Or.inr (mem_marchSlash.mp h).1 + +variable {G hl} {A : RootedHypergraph α β} + +theorem mem_liftRooted_rootSet {v : α} (hA : Disjoint A.vertexSet {v | v ∈ l}) : + v ∈ (liftRooted G hl A).rootSet ↔ v ∈ A.rootSet ∨ v ∈ l := by + change v ∈ A.roots ++ marchSlash l A.vertexSet ↔ _ + rw [List.mem_append, mem_marchSlash] + constructor + · rintro (h | h) + · exact Or.inl h + · exact Or.inr h.1 + · rintro (h | h) + · exact Or.inl h + · exact Or.inr ⟨h, Set.disjoint_right.mp hA h⟩ + +variable {W : Set α} + +theorem disjoint_of_le_slash (hA : A.toHypergraph ≤ quotientVertices G.toHypergraph W) + (hset : ∀ v, v ∈ l ↔ v ∈ W) : Disjoint A.vertexSet {v | v ∈ l} := + Set.disjoint_left.mpr fun _ hv hl ↦ (hA.vertexSet_subset hv).2 ((hset _).mp hl) + +theorem marchSlash_lift_eq (hA : A.toHypergraph ≤ quotientVertices G.toHypergraph W) + (hset : ∀ v, v ∈ l ↔ v ∈ W) : marchSlash l A.vertexSet = l := + marchSlash_of_disjoint fun _ hx hv ↦ (hA.vertexSet_subset hv).2 ((hset _).mp hx) + +theorem liftRooted_vertexSet : (liftRooted G hl A).vertexSet = A.vertexSet ∪ {v | v ∈ l} := rfl + +theorem liftRooted_edgeSet : (liftRooted G hl A).edgeSet = A.edgeSet := rfl + +theorem inc_mem_of_le (hA : A.toHypergraph ≤ quotientVertices G.toHypergraph W) {e : β} {v : α} + (he : e ∈ A.edgeSet) (hinc : G.Inc e v) : + A.Inc e v ∨ v ∈ W := by + by_cases hv : v ∈ W + · exact Or.inr hv + · have h₁ : v ∈ (quotientVertices G.toHypergraph W).ends e := ⟨hinc, hv⟩ + rw [hA.ends_eq e he] at h₁ + exact Or.inl h₁ + +theorem liftRooted_le (hA : A.toHypergraph ≤ quotientVertices G.toHypergraph W) + (hset : ∀ v, v ∈ l ↔ v ∈ W) (hWV : W ⊆ G.vertexSet) : + (liftRooted G hl A).toHypergraph ≤ G.toHypergraph := by + refine ⟨?_, hA.edgeSet_subset, fun e he ↦ ?_⟩ + · rintro v (hv | hv) + · exact (hA.vertexSet_subset hv).1 + · exact hWV ((hset v).mp hv) + · ext v + refine ⟨fun h ↦ ⟨he, h, ?_⟩, fun h ↦ h.2.1⟩ + rcases inc_mem_of_le hA he h with h₁ | h₁ + · exact Or.inl (A.vertex_mem_of_inc h₁) + · exact Or.inr ((hset v).mpr h₁) + +theorem slash_liftRooted (hA : A.toHypergraph ≤ quotientVertices G.toHypergraph W) + (hset : ∀ v, v ∈ l ↔ v ∈ W) : (liftRooted G hl A).slash W = A := by + refine RootedHypergraph.ext_of ?_ rfl ?_ ?_ + · ext v + refine ⟨?_, fun h ↦ ⟨Or.inl h, (hA.vertexSet_subset h).2⟩⟩ + rintro ⟨h₁ | h₁, h₂⟩ + · exact h₁ + · exact absurd ((hset v).mp h₁) h₂ + · ext e v + constructor + · rintro ⟨⟨he, hinc, -⟩, hv⟩ + exact (inc_mem_of_le hA he hinc).resolve_right hv + · intro h + have hv := A.vertex_mem_of_inc h + have he := A.edge_mem_of_inc h + have h₁ : v ∈ (quotientVertices G.toHypergraph W).ends e := by + rw [hA.ends_eq e he] + exact h + exact ⟨⟨he, h₁.1, Or.inl hv⟩, h₁.2⟩ + · change marchSlash (A.roots ++ marchSlash l A.vertexSet) W = A.roots + rw [marchSlash_lift_eq hA hset] + have hn : ∀ x ∈ A.roots, x ∉ W := fun x hx ↦ (hA.vertexSet_subset (A.roots_subset x hx)).2 + classical + simp only [marchSlash, List.filter_append] + rw [List.filter_eq_self.mpr (by simpa using hn), List.filter_eq_nil_iff.mpr (by + intro x hx + simpa using (hset x).mp hx), List.append_nil] + +theorem mem_liftRooted_rootSet' (hA : A.toHypergraph ≤ quotientVertices G.toHypergraph W) + (hset : ∀ v, v ∈ l ↔ v ∈ W) {v : α} : + v ∈ (liftRooted G hl A).rootSet ↔ v ∈ A.rootSet ∨ v ∈ W := by + rw [mem_liftRooted_rootSet (disjoint_of_le_slash hA hset), hset] + +theorem isComplemented_liftRooted (hA : IsComplemented (G.slash W) A) + (hset : ∀ v, v ∈ l ↔ v ∈ W) (hWV : W ⊆ G.vertexSet) : + IsComplemented G (liftRooted G hl A) := by + have hle := hA.le + refine ⟨liftRooted_le hle hset hWV, fun v hv hr ↦ ?_, fun v e hv he hinc ↦ ?_⟩ + all_goals + rw [mem_liftRooted_rootSet' hle hset] + by_cases hvW : v ∈ W + · exact Or.inr hvW + refine Or.inl ?_ + have hvA : v ∈ A.vertexSet := hv.resolve_right fun h ↦ hvW ((hset v).mp h) + · exact hA.roots_mem hvA (mem_slash_rootSet.mpr ⟨hr, hvW⟩) + · exact hA.inc_diff_mem hvA he ⟨hinc, hvW⟩ + +theorem isRootedLocation_lift {ℒ : Set (RootedHypergraph α β)} + (hℒ : IsRootedLocation (G.slash W) ℒ) (hset : ∀ v, v ∈ l ↔ v ∈ W) (hWV : W ⊆ G.vertexSet) : + IsRootedLocation G (liftRooted G hl '' ℒ) := by + have hc : ∀ ⦃B⦄, B ∈ liftRooted G hl '' ℒ → IsComplemented G B := by + rintro _ ⟨A, hA, rfl⟩ + exact isComplemented_liftRooted (hℒ.isComplemented hA) hset hWV + refine ⟨hc, ?_⟩ + rintro _ ⟨A₁, hA₁, rfl⟩ _ h₂ hne + obtain ⟨A₂, hA₂, rfl⟩ := id h₂ + have hne' : A₁ ≠ A₂ := fun h ↦ hne (by rw [h]) + have hle := hℒ.le_complement hA₁ hA₂ hne' + have hle₁ := (hℒ.isComplemented hA₁).le + have hle₂ := (hℒ.isComplemented hA₂).le + have hV : (liftRooted G hl A₁).vertexSet ⊆ + (complement G _ (hc h₂)).vertexSet := by + rintro v (hv | hv) + · have hvG := (hle₁.vertexSet_subset hv).1 + rcases hle.vertexSet_subset hv with h | h + · refine Or.inl ⟨hvG, ?_⟩ + rintro (h₃ | h₃) + · exact h.2 h₃ + · exact (hle₁.vertexSet_subset hv).2 ((hset v).mp h₃) + · exact Or.inr ((mem_liftRooted_rootSet' hle₂ hset).mpr (Or.inl h)) + · exact Or.inr ((mem_liftRooted_rootSet' hle₂ hset).mpr (Or.inr ((hset v).mp hv))) + have hE : (liftRooted G hl A₁).edgeSet ⊆ (complement G _ (hc h₂)).edgeSet := fun e he ↦ by + have h₃ := hle.edgeSet_subset he + exact ⟨h₃.1, h₃.2⟩ + exact (le_iff_of_le (hc ⟨A₁, hA₁, rfl⟩).le (by + rw [complement_toHypergraph] + exact complementHypergraph_le (hc h₂))).mpr ⟨hV, hE⟩ + +end Lift + +variable {W : Set α} {P : UnlabeledPatchwork α β} {l : List α} {hl : l.Nodup} + {A : RootedHypergraph α β} + +/-- `(P|A')/W` has the same base as `(P/W)|A`, where `A'` is `A` lifted. -/ +theorem sameBase_slash_restrict (hA : A.toHypergraph ≤ quotientVertices P.G.toHypergraph W) + (hset : ∀ v, v ∈ l ↔ v ∈ W) (hWV : W ⊆ P.G.vertexSet) : + SameBase ((P.restrict (liftRooted P.G hl A)).slash W) ((P.slash W).restrict A) := by + have hle := liftRooted_le (hl := hl) hA hset hWV + have hends : ∀ e ∈ A.edgeSet, (liftRooted P.G hl A).ends e = P.G.ends e := fun e he ↦ + (hle.ends_eq e he).symm + have hends' : ∀ e ∈ A.edgeSet, A.ends e = (quotientVertices P.G.toHypergraph W).ends e := + fun e he ↦ (hA.ends_eq e he).symm + have hslash := slash_liftRooted (hl := hl) hA hset + refine ⟨?_, ?_, fun _ _ ↦ rfl, fun e he ↦ ?_⟩ + · exact (congrArg RootedHypergraph.toHypergraph hslash).symm + · ext e + constructor + · rintro ⟨⟨h₁, h₂⟩, -⟩ + exact ⟨⟨h₁, h₂⟩, hends e h₂⟩ + · rintro ⟨⟨h₁, h₂⟩, -⟩ + exact ⟨⟨h₁, h₂⟩, hends' e h₂⟩ + · classical + have he' : e ∈ A.edgeSet := he + have h₁ : e ∈ P.G.edgeSet := hle.edgeSet_subset he' + change (if e ∈ (P.slash W).G.edgeSet ∧ A.ends e = (P.slash W).G.ends e then _ else _) = + patchSlash (if e ∈ P.G.edgeSet ∧ (liftRooted P.G hl A).ends e = P.G.ends e then _ else _) W + rw [ite_eq_left ⟨h₁, hends' e he'⟩, ite_eq_left ⟨h₁, hends e he'⟩] + rfl + +theorem isFree_restrict {Ω : Type*} {P : Patchwork Ω α β} (hfree : IsFree P) + {B : RootedHypergraph α β} (hB : B.toHypergraph ≤ P.G.toHypergraph) : + IsFree (P.restrict B) := fun e he ↦ by + classical + have h₁ : e ∈ P.G.edgeSet := hB.edgeSet_subset he + change (if e ∈ P.G.edgeSet ∧ B.ends e = P.G.ends e then P.Δ e else _).IsFree + rw [ite_eq_left ⟨h₁, (hB.ends_eq e he).symm⟩] + exact hfree e h₁ + +/-- The key step of (7.2): the patch of a lifted member, slashed by `W`, is the patch of the member +in `P/W`. This comes from (7.1). -/ +theorem patchSlash_feasibleGroupings (hfree : IsFree P) + (hA : A.toHypergraph ≤ quotientVertices P.G.toHypergraph W) + (hset : ∀ v, v ∈ l ↔ v ∈ W) (hWV : W ⊆ P.G.vertexSet) : + patchSlash (feasibleGroupings (P.restrict (liftRooted P.G hl A))) W = + feasibleGroupings ((P.slash W).restrict A) := by + have hle := liftRooted_le (hl := hl) hA hset hWV + set R := P.restrict (liftRooted P.G hl A) with hR + have hfreeR : IsFree R := isFree_restrict hfree hle + have hWR : W ⊆ R.G.rootSet := fun v hv ↦ + (mem_liftRooted_rootSet' (hl := hl) hA hset).mpr (Or.inr hv) + have hb := sameBase_slash_restrict (hl := hl) hA hset hWV + have hroots : (R.slash W).G.roots = ((P.slash W).restrict A).G.roots := by + change (((liftRooted P.G hl A).slash W).roots) = A.roots + rw [slash_liftRooted hA hset] + have hrs : (R.slash W).G.rootSet = R.G.rootSet \ W := by + ext x + exact mem_slash_rootSet + have hrs' : R.G.rootSet \ W = A.rootSet := by + ext x + refine ⟨fun h ↦ ((mem_liftRooted_rootSet' (hl := hl) hA hset).mp h.1).resolve_right h.2, + fun h ↦ ?_⟩ + exact ⟨(mem_liftRooted_rootSet' (hl := hl) hA hset).mpr (Or.inl h), + (hA.vertexSet_subset (A.roots_subset x h)).2⟩ + refine Patch.ext_of hrs' ?_ + ext K + constructor + · rintro ⟨hg, hv, hK⟩ + exact feasible_of_sameBase hb hroots + ((theorem_7_1_proof hfreeR hWR hg hv).mpr (by + have : W ∩ R.G.rootSet = W := inter_eq_left.mpr hWR + rw [show (feasibleGroupings R).verts = R.G.rootSet from rfl, this] at hK + exact hK)) + · intro hK + have hK' := feasible_of_sameBase hb.symm hroots.symm hK + have hg : IsGrouping (R.G.rootSet \ W) K := by + have := hK'.1 + rwa [hrs] at this + have hv : K.verts = R.G.rootSet \ W := by + have := hK'.2.1 + rwa [hrs] at this + refine ⟨hg, hv, ?_⟩ + have : W ∩ R.G.rootSet = W := inter_eq_left.mpr hWR + rw [show (feasibleGroupings R).verts = R.G.rootSet from rfl, this] + exact (theorem_7_1_proof hfreeR hWR hg hv).mp hK' + +/-- A tangle of order `> |W|` needs vertices or edges outside `W`. -/ +theorem not_tangle_of_vertexSet_subset {G : Hypergraph α β} {θ : ℕ} + {𝒯 : Set (Hypergraph α β × Hypergraph α β)} (h𝒯 : IsTangle G θ 𝒯) (hW : W.ncard < θ) + (hWfin : W.Finite) (hV : G.vertexSet ⊆ W) (hE : G.edgeSet = ∅) : False := by + have hsep : IsSeparation G G G := + ⟨le_rfl, le_rfl, union_self G, by + apply Set.eq_empty_of_forall_notMem + intro e he + have : e ∈ G.edgeSet := he.1 + rw [hE] at this + exact this⟩ + have hord : separationOrder G G < θ := lt_of_le_of_lt (Set.ncard_le_ncard + (fun x hx ↦ hV hx.1) hWfin) hW + have hmem : (G, G) ∈ 𝒯 := by + rcases h𝒯.axiom1 hsep hord with h | h <;> exact h + exact h𝒯.axiom3 hmem rfl + +/-- Graph Minors XX, (7.2) (page 346): "Let $\mathcal{F}$ be a well-behaved set of patchworks and +let $\theta \ge 1$. Then there is +a well-behaved set of patchworks $\mathcal{F}'$ with the following property. Let $P = (G, +\mu, \Delta)$ be a free patchwork, let $\mathcal{T}$ be a tangle in $G$ of order $\ge +\theta$, let $W \subseteq V(G)$ with $|W| < \theta$, and let $\mathcal{L}$ be a fine rooted +location in $G/W$ such that $\mathcal{L}$ is linked to $\mathcal{T}/W$, and $\mathcal{F}$ +contains a heart of $(P/W, \mathcal{L})$. Then there is a fine rooted location +$\mathcal{L}'$ in $G$ such that* - *$W \subseteq \bar{\pi}(A)$ for all $A \in +\mathcal{L}'$,* - *$\mathcal{L}'/W = \mathcal{L}$ and hence is linked to $\mathcal{T}/W$, +and* - *$\mathcal{F}'$ contains a heart of $(P, \mathcal{L}')$." + +The Lean result lifts any fine location with the stated heart. In the linked case, +`locationSlash ℒ' W = ℒ` transfers linkage of the input to the quotient of the lifted +location, as in (7.3). The bound `W.ncard < θ` entails `1 ≤ θ`. -/ +theorem theorem_7_2_proof {𝓕 : Set (UnlabeledPatchwork α β)} (h𝓕 : WellBehaved 𝓕) (θ : ℕ) : + ∃ 𝓕' : Set (UnlabeledPatchwork α β), WellBehaved 𝓕' ∧ + ∀ (P : UnlabeledPatchwork α β), IsFree P → + ∀ (θ' : ℕ) (𝒯 : Set (Hypergraph α β × Hypergraph α β)), IsTangle P.G.toHypergraph θ' 𝒯 → + θ ≤ θ' → ∀ W : Set α, W ⊆ P.G.vertexSet → W.ncard < θ → + ∀ ℒ : Set (RootedHypergraph α β), IsFine (P.G.slash W) ℒ → + (∃ Q ∈ 𝓕, HasPatchworkHeart (P.slash W) ℒ Q) → + ∃ ℒ' : Set (RootedHypergraph α β), IsFine P.G ℒ' ∧ IsRootedLocation P.G ℒ' ∧ + (∀ A ∈ ℒ', W ⊆ A.rootSet) ∧ locationSlash ℒ' W = ℒ ∧ + ∃ Q ∈ 𝓕', HasPatchworkHeart P ℒ' Q := by + refine ⟨_, theorem_4_9_proof h𝓕 θ, fun P hfree θ' 𝒯 h𝒯 hθ' W hWV hWθ ℒ hfine ⟨Q, hQ, e, + hheart⟩ ↦ ?_⟩ + have hWfin : W.Finite := P.G.vertexSet_finite.subset hWV + have hℒ : IsRootedLocation (P.G.slash W) ℒ := hheart.isRootedLocation + have hfin : ℒ.Finite := hheart.finite hfine + have hle : ∀ {A}, A ∈ ℒ → A.toHypergraph ≤ quotientVertices P.G.toHypergraph W := fun hA ↦ + (hℒ.isComplemented hA).le + obtain ⟨l, hl, hset⟩ : ∃ l : List α, l.Nodup ∧ ∀ v, v ∈ l ↔ v ∈ W := + ⟨hWfin.toFinset.toList, Finset.nodup_toList _, fun v ↦ by simp⟩ + have hs : ∀ {A}, A ∈ ℒ → (liftRooted P.G hl A).slash W = A := fun hA ↦ + slash_liftRooted (hle hA) hset + have hne : ℒ.Nonempty := by + by_contra hn + rw [Set.not_nonempty_iff_eq_empty] at hn + subst hn + refine not_tangle_of_vertexSet_subset h𝒯 (hWθ.trans_le hθ') hWfin (fun v hv ↦ ?_) ?_ + · by_contra hvW + obtain ⟨A, hA, -⟩ := hfine.1 v ⟨hv, hvW⟩ + exact hA + · apply Set.eq_empty_of_forall_notMem + intro f hf + obtain ⟨A, hA, -⟩ := hfine.2 f hf + exact hA + obtain ⟨A₀, hA₀⟩ := hne + have hroot : ∀ {A}, A ∈ ℒ → W ⊆ (liftRooted P.G hl A).rootSet := fun hA v hv ↦ + (mem_liftRooted_rootSet' (hle hA) hset).mpr (Or.inr hv) + have hloc := isRootedLocation_lift (hl := hl) hℒ hset hWV + have hfine' : IsFine P.G (liftRooted P.G hl '' ℒ) := by + constructor + · intro v hv + by_cases hvW : v ∈ W + · exact ⟨_, ⟨A₀, hA₀, rfl⟩, Or.inr ((hset v).mpr hvW)⟩ + · obtain ⟨A, hA, hvA⟩ := hfine.1 v ⟨hv, hvW⟩ + exact ⟨_, ⟨A, hA, rfl⟩, Or.inl hvA⟩ + · intro f hf + obtain ⟨A, hA, hfA⟩ := hfine.2 f hf + exact ⟨_, ⟨A, hA, rfl⟩, hfA⟩ + let e' : RootedHypergraph α β → β := fun B ↦ e (B.slash W) + have he' : ∀ {A}, A ∈ ℒ → e' (liftRooted P.G hl A) = e A := fun hA ↦ congrArg e (hs hA) + have hinj : InjOn e' (liftRooted P.G hl '' ℒ) := by + rintro _ ⟨A, hA, rfl⟩ _ ⟨B, hB, rfl⟩ h + rw [he' hA, he' hB] at h + rw [hheart.injOn_newEdge hA hB h] + obtain ⟨Q', hQ'⟩ := exists_heart hloc hfine' (hfin.image _) hinj + have himg : e' '' (liftRooted P.G hl '' ℒ) = e '' ℒ := by + ext g + constructor + · rintro ⟨_, ⟨A, hA, rfl⟩, rfl⟩ + exact ⟨A, hA, (he' hA).symm⟩ + · rintro ⟨A, hA, rfl⟩ + exact ⟨_, ⟨A, hA, rfl⟩, he' hA⟩ + have hE' := hQ'.edgeSet_eq_image hfine' + have hD' := hQ'.dom_eq_image hfine' + have hE := hheart.edgeSet_eq_image hfine + have hD := hheart.dom_eq_image hfine + refine ⟨_, ⟨hfine', hloc, ?_, ?_, Q', ⟨hD'.trans hE'.symm, W, hWfin, hWθ.le, ?_, Q, hQ, ?_⟩, + e', hQ'⟩⟩ + · rintro _ ⟨A, hA, rfl⟩ + exact hroot hA + · ext B + constructor + · rintro ⟨_, ⟨A, hA, rfl⟩, rfl⟩ + change (liftRooted P.G hl A).slash W ∈ ℒ + rw [hs hA] + exact hA + · intro hB + exact ⟨_, ⟨B, hB, rfl⟩, hs hB⟩ + · intro v hv + rw [hQ'.vertexSet_eq] + exact root_mem_core hloc ⟨A₀, hA₀, rfl⟩ (hroot hA₀ hv) + · refine ⟨RootedHypergraph.ext_of ?_ (hE'.trans (himg.trans hE.symm)) ?_ ?_, + hD'.trans (himg.trans hD.symm), ?_, ?_⟩ + · ext v + change v ∈ Q'.G.vertexSet \ W ↔ _ + rw [mem_sdiff, hQ'.vertexSet_eq, hheart.vertexSet_eq, mem_core_iff, mem_core_iff] + constructor + · rintro ⟨⟨hv, h⟩, hvW⟩ + refine ⟨⟨hv, hvW⟩, fun A hA hvA ↦ ?_⟩ + exact ((mem_liftRooted_rootSet' (hl := hl) (hle hA) hset).mp + (h _ ⟨A, hA, rfl⟩ (Or.inl hvA))).resolve_right hvW + · rintro ⟨⟨hv, hvW⟩, h⟩ + refine ⟨⟨hv, ?_⟩, hvW⟩ + rintro _ ⟨A, hA, rfl⟩ (hvA | hvA) + · exact (mem_liftRooted_rootSet' (hle hA) hset).mpr (Or.inl (h A hA hvA)) + · exact absurd ((hset v).mp hvA) hvW + · ext g v + change Q'.G.Inc g v ∧ v ∉ W ↔ _ + rw [hQ'.inc_iff hfine', hheart.inc_iff hfine] + constructor + · rintro ⟨⟨_, ⟨A, hA, rfl⟩, rfl, hv⟩, hvW⟩ + exact ⟨A, hA, (he' hA).symm, ((mem_liftRooted_rootSet' (hl := hl) (hle hA) hset).mp + hv).resolve_right hvW⟩ + · rintro ⟨A, hA, rfl, hv⟩ + exact ⟨⟨_, ⟨A, hA, rfl⟩, he' hA, (mem_liftRooted_rootSet' (hle hA) hset).mpr (Or.inl hv)⟩, + (hle hA |>.vertexSet_subset (A.roots_subset v hv)).2⟩ + · change marchSlash Q'.G.roots W = Q.G.roots + rw [hQ'.roots_eq, hheart.roots_eq] + rfl + · intro g hg + rw [hD] at hg + obtain ⟨A, hA, rfl⟩ := hg + change marchSlash (Q'.μ (e A)) W = Q.μ (e A) + have h₁ := hQ'.μ_newEdge (A := liftRooted P.G hl A) ⟨A, hA, rfl⟩ + rw [he' hA] at h₁ + rw [h₁, hheart.μ_newEdge hA] + exact congrArg RootedHypergraph.roots (hs hA) + · intro g hg + rw [hE] at hg + obtain ⟨A, hA, rfl⟩ := hg + change patchSlash (Q'.Δ (e A)) W = Q.Δ (e A) + have h₁ := hQ'.Δ_newEdge (A := liftRooted P.G hl A) ⟨A, hA, rfl⟩ + rw [he' hA] at h₁ + rw [h₁, hheart.Δ_newEdge hA] + exact patchSlash_feasibleGroupings hfree (hle hA) hset hWV + +/-- Graph Minors XX, (7.3) (page 347): "Let $\Omega$ be a well-quasi-order, let $\mathcal{F}$ be a +well-behaved set of patchworks, +and let $\theta \ge 1$. Let $P_i = (G_i, \mu_i, \Delta_i, \phi_i)$ ($i = 1, 2, \ldots$) be a +countable sequence of free rootless $\Omega$-patchworks. Suppose that for each tangle +$\mathcal{T}$ in $G_i$ of order $\ge \theta$, there exist $W \subseteq V(G_i)$ with $|W| < +\theta$ and a fine rooted location $\mathcal{L}$ in $G/W$, such that $\mathcal{L}$ is linked +to $\mathcal{T}/W$, and $\mathcal{F}$ contains a heart of $((G_i, \mu_i, \Delta_i)/W, +\mathcal{L})$. Then there exist $j > i \ge 1$ such that $P_i$ is simulated in $P_j$." + +Lean uses an infinite ambient edge type to provide fresh edge labels. -/ +theorem theorem_7_3_proof [Infinite β] {Ω : Type (max u v)} [Preorder Ω] (hΩ : WellQuasiOrderedLE Ω) + {𝓕 : Set (UnlabeledPatchwork α β)} (h𝓕 : WellBehaved 𝓕) {θ : ℕ} (hθ : 1 ≤ θ) + (P : ℕ → GM04.Patchwork Ω α β) (hfree : ∀ i, IsFree (P i)) (hroot : ∀ i, IsRootless (P i)) + (h : ∀ i (θ' : ℕ) (𝒯 : Set (Hypergraph α β × Hypergraph α β)), + IsTangle (P i).G.toHypergraph θ' 𝒯 → θ ≤ θ' → ∃ (W : Set α) + (ℒ : Set (RootedHypergraph α β)), W ⊆ (P i).G.vertexSet ∧ W.ncard < θ ∧ + IsFine ((P i).G.slash W) ℒ ∧ + IsLinkedTo ((P i).G.slash W) (quotientTangle (P i).G.toHypergraph 𝒯 W) ℒ ∧ + ∃ Q ∈ 𝓕, HasPatchworkHeart (((P i).relabel fun _ ↦ ()).slash W) ℒ Q) : + ∃ i j, i < j ∧ GM04.Simulated (P i) (P j) := by + obtain ⟨𝓕', h𝓕', hprop⟩ := theorem_7_2_proof h𝓕 θ + refine theorem_6_3_proof hΩ h𝓕' hθ P (fun i ↦ ⟨hroot i, fun e he ↦ ?_⟩) fun i θ' 𝒯 h𝒯 hθ' ↦ ?_ + · refine Patch.IsFree.isRobust ?_ (hfree i e he) + rw [(P i).Δ_verts e he] + exact (P i).G.vertexSet_finite.subset fun v hv ↦ (P i).G.vertex_mem_of_inc hv + · obtain ⟨W, ℒ, hWV, hWθ, hfine, hlink, hheart⟩ := h i θ' 𝒯 h𝒯 hθ' + obtain ⟨ℒ', hfine', hloc, hWA, hslash, hh⟩ := hprop ((P i).relabel fun _ ↦ ()) + (fun e he ↦ hfree i e he) θ' 𝒯 h𝒯 hθ' W hWV hWθ ℒ hfine hheart + refine ⟨W, ℒ', hWV, hWθ, hfine', hloc, hWA, ?_, hh⟩ + rw [hslash] + exact hlink + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section8a.lean b/LeanPool/GraphMinor/GM20/Section8a.lean new file mode 100644 index 0000000000..e568a11ef5 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section8a.lean @@ -0,0 +1,418 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section9a +public import LeanPool.GraphMinor.GM20.Cited +public import LeanPool.GraphMinor.GM20.Draw6 +public import LeanPool.GraphMinor.Surface.InvarianceOfDomain +public import LeanPool.GraphMinor.Surface.TopologyStatements +public import Mathlib.Analysis.Convex.StrictConvexSpace +public import Mathlib.Analysis.InnerProductSpace.Convex +import LeanPool.GraphMinor.Surface.Fan + +/-! +# Graph Minors XX, Section 8: making the discs narrow + +A cell of size 2 of a painting of Graph Minors XX is a disc, and an edge of size 2 of a painting of +Graph Minors XIX is a line. The paper says "it is easy to convert from one version to the other; +make +the discs narrow and the lines thick". Here we pick in each cell of size 2 a line with the same two +ends. +For a border cell it is the part of the closure in the boundary. For an internal cell it is a chord +of the +disc. Replacing the cells of size 2 by these lines gives a painting in the sense of Graph Minors XIX +with +the same nodes. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +/-- Basic facts on a line with ends `a` and `b`. -/ +theorem line_facts [T2Space S] {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : + a ≠ b ∧ IsPathConnected (L \ {a, b}) ∧ closure (L \ {a, b}) = L ∧ lineEnds L = {a, b} := by + have hab : a ≠ b := by + obtain ⟨f, rfl, rfl⟩ := h + intro he + have := f.injective (Subtype.ext he) + exact zero_ne_one this + obtain ⟨f, ha, hb⟩ := id h + have hcomp : IsCompact L := isCompact_iff_compactSpace.mpr f.compactSpace + refine ⟨hab, h.isPathConnected_interior, + Subset.antisymm (closure_minimal sdiff_subset hcomp.isClosed) + h.subset_closure_interior, ?_⟩ + · ext u + constructor + · rintro ⟨v, g', h₀, -⟩ + let φ : unitInterval ≃ₜ unitInterval := g'.trans f.symm + have hφ : Continuous fun s ↦ (φ s).1 := continuous_subtype_val.comp φ.continuous + have hinj : Function.Injective fun s ↦ (φ s).1 := fun s s' h ↦ φ.injective (Subtype.ext h) + have hu : u = (f (φ 0)).1 := by simp [φ, h₀] + rcases Continuous.strictMono_of_inj hφ hinj with hm | hm + · have h₁ : φ 0 = 0 := by + apply Subtype.ext + apply le_antisymm _ (φ 0).2.1 + have h₂ := hm.monotone (show (0 : unitInterval) ≤ φ.symm 0 from (φ.symm 0).2.1) + simpa using h₂ + left + rw [hu, h₁, ha] + · have h₁ : φ 0 = 1 := by + apply Subtype.ext + apply le_antisymm (φ 0).2.2 + have h₂ := hm.antitone (show (0 : unitInterval) ≤ φ.symm 1 from (φ.symm 1).2.1) + simpa using h₂ + exact Or.inr (by rw [mem_singleton_iff, hu, h₁, hb]) + · rintro (rfl | rfl) + · exact ⟨b, h⟩ + · exact ⟨a, GM11.IsLineWithEnds.symm h⟩ + +/-- A chord of a closed disc between two points of its boundary. -/ +theorem exists_chord [T2Space S] {D : Set S} (hD : IsClosedDisc D) {a b : S} (ha : a ∈ discBd D) + (hb : b ∈ discBd D) (hab : a ≠ b) : + ∃ L, IsLineWithEnds L a b ∧ L ⊆ D ∧ L \ {a, b} ⊆ D \ discBd D := by + obtain ⟨L, hL, hLD, hbd⟩ := Surface.exists_chord hD ha hb hab + refine ⟨L, hL, hLD, fun x hx => ⟨hLD hx.1, fun hxb => hx.2 ?_⟩⟩ + exact hbd ▸ ⟨hx.1, hxb⟩ + +/-- `L` gives for each cell of size 2 a line in its closure with the same two ends. For a border +cell this +is the part of the closure in the boundary. For an internal cell it is a chord of the disc. -/ +def IsChordData (Γ : Painting S) (L : Set S → Set S) : Prop := + ∀ c ∈ Γ.C, (tilde c).ncard = 2 → ∃ a b, IsLineWithEnds (L c) a b ∧ tilde c = {a, b} ∧ + L c ⊆ closure c ∧ + ((¬ Painting.IsBorder c ∧ L c \ {a, b} ⊆ closure c \ discBd (closure c)) ∨ + (Painting.IsBorder c ∧ L c = closure c ∩ bd S)) + +theorem exists_chordData [T2Space S] (Γ : Painting S) : ∃ L, IsChordData Γ L := by + classical + have key : ∀ c, ∃ Lc : Set S, c ∈ Γ.C → (tilde c).ncard = 2 → ∃ a b, IsLineWithEnds Lc a b ∧ + tilde c = {a, b} ∧ Lc ⊆ closure c ∧ + ((¬ Painting.IsBorder c ∧ Lc \ {a, b} ⊆ closure c \ discBd (closure c)) ∨ + (Painting.IsBorder c ∧ Lc = closure c ∩ bd S)) := by + intro c + by_cases hc : c ∈ Γ.C ∧ (tilde c).ncard = 2 + · obtain ⟨hc, h₂⟩ := hc + obtain ⟨a, b, hab, hset⟩ := Set.ncard_eq_two.mp h₂ + by_cases hb : Painting.IsBorder c + · obtain ⟨-, ⟨f⟩, h₄⟩ := Γ.border_cell c hc hb + refine ⟨closure c ∩ bd S, fun _ _ ↦ ?_⟩ + have hend : IsLineWithEnds (closure c ∩ bd S) (f 0).1 (f 1).1 := ⟨f, rfl, rfl⟩ + have h₅ := (line_facts hend).2.2.2 + rw [h₄, hset] at h₅ + exact ⟨(f 0).1, (f 1).1, hend, by rw [hset, h₅], inter_subset_left, + Or.inr ⟨hb, rfl⟩⟩ + · have ha' : a ∈ discBd (closure c) := Γ.tilde_subset c hc (by rw [hset]; exact Or.inl rfl) + have hb' : b ∈ discBd (closure c) := Γ.tilde_subset c hc (by rw [hset]; exact Or.inr rfl) + obtain ⟨Lc, h₃, h₄, h₅⟩ := exists_chord (Γ.cell_disc c hc) ha' hb' hab + exact ⟨Lc, fun _ _ ↦ ⟨a, b, h₃, hset, h₄, Or.inl ⟨hb, h₅⟩⟩⟩ + · exact ⟨∅, fun h₁ h₂ ↦ absurd ⟨h₁, h₂⟩ hc⟩ + choose L hL using key + exact ⟨L, hL⟩ + +namespace Thin + +open Classical in +/-- The part of the cell `c` that remains. -/ +noncomputable def τ (L : Set S → Set S) (c : Set S) : Set S := + if (tilde c).ncard = 2 then L c \ tilde c else c + +open Classical in +/-- The closure of `τ L c`. -/ +noncomputable def W (L : Set S → Set S) (c : Set S) : Set S := + if (tilde c).ncard = 2 then L c else closure c + +variable [T2Space S] {Γ : Painting S} {L : Set S → Set S} {c : Set S} + +omit [T2Space S] in +theorem closure_diff (hc : c ∈ Γ.C) : closure c \ Γ.N = c := by + ext x + constructor + · rintro ⟨h₁, h₂⟩ + by_contra h₃ + exact h₂ (tilde_subset_N Γ hc ⟨h₁, h₃⟩) + · intro hx + exact ⟨subset_closure hx, (hc.2.1 hx).2⟩ + +omit [T2Space S] in +theorem closure_subset_U (hc : c ∈ Γ.C) : closure c ⊆ Γ.U := + closure_minimal (hc.2.1.trans sdiff_subset) Γ.isClosed_U + +omit [T2Space S] in +theorem τ_subset (hL : IsChordData Γ L) (hc : c ∈ Γ.C) : τ L c ⊆ c := by + unfold τ + split_ifs with h + · obtain ⟨a, b, -, -, h₃, -⟩ := hL c hc h + rintro x ⟨hx, hxn⟩ + by_contra h₄ + exact hxn ⟨h₃ hx, h₄⟩ + · exact subset_rfl + +omit [T2Space S] in +theorem W_subset (hL : IsChordData Γ L) (hc : c ∈ Γ.C) : W L c ⊆ closure c := by + unfold W + split_ifs with h + · obtain ⟨a, b, -, -, h₃, -⟩ := hL c hc h + exact h₃ + · exact subset_rfl + +theorem closure_τ (hL : IsChordData Γ L) (hc : c ∈ Γ.C) : closure (τ L c) = W L c := by + unfold τ W + split_ifs with h + · obtain ⟨a, b, h₁, h₂, -, -⟩ := hL c hc h + rw [h₂] + exact (line_facts h₁).2.2.1 + · rfl + +theorem tilde_τ (hL : IsChordData Γ L) (hc : c ∈ Γ.C) : tilde (τ L c) = tilde c := by + unfold τ + split_ifs with h + · obtain ⟨a, b, h₁, h₂, -, -⟩ := hL c hc h + obtain ⟨h₃, -, h₄, -⟩ := line_facts h₁ + rw [h₂] + unfold tilde + rw [h₄] + ext x + constructor + · rintro ⟨h₅, h₆⟩ + by_contra h₇ + exact h₆ ⟨h₅, h₇⟩ + · intro h₅ + exact ⟨by + rcases h₅ with rfl | rfl + · exact (Draw.mem_of_line h₁).1 + · exact (Draw.mem_of_line h₁).2, fun h₆ ↦ h₆.2 h₅⟩ + · rfl + +theorem isPathConnected_τ (hL : IsChordData Γ L) (hc : c ∈ Γ.C) : IsPathConnected (τ L c) := by + unfold τ + split_ifs with h + · obtain ⟨a, b, h₁, h₂, -, -⟩ := hL c hc h + rw [h₂] + exact (line_facts h₁).2.1 + · exact hc.2.2.1 + +theorem W_diff (hL : IsChordData Γ L) (hc : c ∈ Γ.C) : W L c \ Γ.N = τ L c := by + ext x + constructor + · rintro ⟨h₁, h₂⟩ + have h₃ : x ∈ c := by + rw [← closure_diff hc] + exact ⟨W_subset hL hc h₁, h₂⟩ + unfold W at h₁ + unfold τ + split_ifs at h₁ ⊢ with h + · exact ⟨h₁, fun h₄ ↦ h₄.2 h₃⟩ + · exact h₃ + · intro hx + refine ⟨?_, (hc.2.1 (τ_subset hL hc hx)).2⟩ + rw [← closure_τ hL hc] + exact subset_closure hx + +/-- The new set `U`. -/ +noncomputable def U' (Γ : Painting S) (L : Set S → Set S) : Set S := Γ.N ∪ ⋃ c ∈ Γ.C, W L c + +theorem isClosed_W (hL : IsChordData Γ L) (hc : c ∈ Γ.C) : IsClosed (W L c) := by + rw [← closure_τ hL hc] + exact isClosed_closure + +omit [T2Space S] in +theorem U'_subset (hL : IsChordData Γ L) : U' Γ L ⊆ Γ.U := by + rintro x (hx | hx) + · exact Γ.N_subset hx + · simp only [mem_iUnion, exists_prop] at hx + obtain ⟨c, hc, hx⟩ := hx + exact closure_subset_U hc (W_subset hL hc hx) + +theorem mem_U'_diff {x : S} (hL : IsChordData Γ L) (hx : x ∈ U' Γ L \ Γ.N) : + ∃ c ∈ Γ.C, x ∈ τ L c := by + obtain ⟨hx | hx, hn⟩ := hx + · exact absurd hx hn + · simp only [mem_iUnion, exists_prop] at hx + obtain ⟨c, hc, hx⟩ := hx + exact ⟨c, hc, by rw [← W_diff hL hc]; exact ⟨hx, hn⟩⟩ + +theorem τ_subset_U' (hL : IsChordData Γ L) (hc : c ∈ Γ.C) : τ L c ⊆ U' Γ L \ Γ.N := by + intro x hx + have h₁ := hx + rw [← W_diff hL hc] at h₁ + exact ⟨Or.inr (mem_biUnion hc h₁.1), h₁.2⟩ + +theorem τ_mem (hL : IsChordData Γ L) (hc : c ∈ Γ.C) : τ L c ∈ arcComponentsIn (U' Γ L \ Γ.N) := by + have hp := isPathConnected_τ hL hc + refine ⟨hp.nonempty, τ_subset_U' hL hc, hp, ?_⟩ + intro D hD hDp hsub + have hne := hp.nonempty + have hDc : D ⊆ c := by + have h₁ : c ∪ D = c := by + refine hc.2.2.2 _ ?_ (hc.2.2.1.union hDp ?_) subset_union_left + · rintro x (hx | hx) + · exact hc.2.1 hx + · exact ⟨U'_subset hL (hD hx).1, (hD hx).2⟩ + · obtain ⟨x, hx⟩ := hne + exact ⟨x, τ_subset hL hc hx, hsub hx⟩ + exact subset_union_right.trans h₁.subset + refine subset_antisymm ?_ hsub + intro x hx + obtain ⟨c', hc', hxc'⟩ := mem_U'_diff hL (hD hx) + have h₂ : c = c' := arcComponent_eq hc hc' (hDc hx) (τ_subset hL hc' hxc') + rw [h₂] + exact hxc' + +theorem arcComponents_eq (hL : IsChordData Γ L) : + arcComponentsIn (U' Γ L \ Γ.N) = τ L '' Γ.C := by + ext e + constructor + · intro he + obtain ⟨x, hx⟩ := he.1 + obtain ⟨c, hc, hxc⟩ := mem_U'_diff hL (he.2.1 hx) + exact ⟨c, hc, arcComponent_eq (τ_mem hL hc) he hxc hx⟩ + · rintro ⟨c, hc, rfl⟩ + exact τ_mem hL hc + +theorem τ_injOn (hL : IsChordData Γ L) : InjOn (τ L) Γ.C := by + intro c hc c' hc' h + obtain ⟨x, hx⟩ := (isPathConnected_τ hL hc).nonempty + exact arcComponent_eq hc hc' (τ_subset hL hc hx) (τ_subset hL hc' (h ▸ hx)) + +omit [T2Space S] in +/-- The cells of the new painting are in the cell `c`, and for a border cell equal to the part in +the +boundary. -/ +theorem inter_bd (hL : IsChordData Γ L) (hc : c ∈ Γ.C) : c ∩ bd S = τ L c ∩ bd S := by + apply subset_antisymm _ (inter_subset_inter_left _ (τ_subset hL hc)) + rintro x ⟨hx, hb⟩ + refine ⟨?_, hb⟩ + have hb' : Painting.IsBorder c := ⟨x, hx, hb⟩ + have h₂ := (Γ.border_cell c hc hb').1 + unfold τ + rw [ite_eq_left h₂] + obtain ⟨a, b, -, h₄, -, h₅⟩ := hL c hc h₂ + rcases h₅ with h₅ | ⟨-, h₅⟩ + · exact absurd hb' h₅.1 + · rw [h₅] + exact ⟨⟨subset_closure hx, hb⟩, fun h₆ ↦ h₆.2 hx⟩ + +omit [T2Space S] in +theorem τ_subset_bd (hL : IsChordData Γ L) (hc : c ∈ Γ.C) (hb : (τ L c ∩ bd S).Nonempty) : + τ L c ⊆ bd S ∧ (tilde c).ncard = 2 := by + have hb' : Painting.IsBorder c := by + obtain ⟨x, hx, hxb⟩ := hb + exact ⟨x, τ_subset hL hc hx, hxb⟩ + have h₂ := (Γ.border_cell c hc hb').1 + refine ⟨?_, h₂⟩ + unfold τ + rw [ite_eq_left h₂] + obtain ⟨a, b, -, h₄, -, h₅⟩ := hL c hc h₂ + rcases h₅ with h₅ | ⟨-, h₅⟩ + · exact absurd hb' h₅.1 + · rw [h₅] + exact fun x hx ↦ hx.1.2 + +/-- The cell of `Γ` that gives an edge of the new painting. -/ +noncomputable def back (Γ : Painting S) (L : Set S → Set S) (e : Set S) : Set S := + Function.invFunOn (τ L) Γ.C e + +theorem back_τ (hL : IsChordData Γ L) (hc : c ∈ Γ.C) : back Γ L (τ L c) = c := + (τ_injOn hL).leftInvOn_invFunOn hc + +/-- The painting of Graph Minors XIX that we get from `Γ` by making the discs narrow. -/ +noncomputable def painting (Γ : Painting S) (L : Set S → Set S) (hL : IsChordData Γ L) : + GM19.Painting S where + U := U' Γ L + V := Γ.N + γ e := Γ.γ (back Γ L e) + isClosed_U := by + have h₁ : IsClosed (⋃ c ∈ Γ.C, W L c) := + Set.Finite.isClosed_biUnion Γ.finite_cells fun c hc ↦ isClosed_W hL hc + exact Γ.finite_N.isClosed.union h₁ + V_subset := subset_union_left + finite_V := Γ.finite_N + bd_subset := by + intro x hx + by_cases hn : x ∈ Γ.N + · exact Or.inl hn + · have hc : pathComponentIn (Γ.U \ Γ.N) x ∈ Γ.C := + mem_arcComponentsIn_pathComponentIn ⟨Γ.bd_subset hx, hn⟩ + have hxc : x ∈ pathComponentIn (Γ.U \ Γ.N) x := mem_pathComponentIn_self ⟨Γ.bd_subset hx, hn⟩ + have h₁ : x ∈ τ L (pathComponentIn (Γ.U \ Γ.N) x) := by + have h₂ := inter_bd hL hc + have h₃ : x ∈ pathComponentIn (Γ.U \ Γ.N) x ∩ bd S := ⟨hxc, hx⟩ + rw [h₂] at h₃ + exact h₃.1 + exact (τ_subset_U' hL hc h₁).1 + finite_edges := by + rw [arcComponents_eq hL] + exact Γ.finite_cells.image _ + edge_shape := by + intro e he + rw [arcComponents_eq hL] at he + obtain ⟨c, hc, rfl⟩ := he + rw [tilde_τ hL hc, closure_τ hL hc] + have hf := (Γ.cell_size c hc).1 + by_cases h : (tilde c).ncard = 2 + · left + obtain ⟨a, b, h₁, h₂, -, -⟩ := hL c hc h + refine ⟨h, hf, ?_, ?_⟩ + · simp only [W, ite_eq_left h] + obtain ⟨g, -, -⟩ := h₁ + exact ⟨g⟩ + · simp only [W, ite_eq_left h] + rw [h₂] + exact (line_facts h₁).2.2.2 + · right + have h₃ := (Γ.cell_size c hc).2.resolve_left h + refine ⟨h₃, hf, ?_, ?_⟩ + · simp only [W, ite_eq_right h] + exact Γ.cell_disc c hc + · simp only [W, ite_eq_right h] + exact Γ.tilde_subset c hc + γ_nodup := by + intro e he + rw [arcComponents_eq hL] at he + obtain ⟨c, hc, rfl⟩ := he + rw [back_τ hL hc] + exact Γ.γ_nodup c hc + γ_set := by + intro e he + rw [arcComponents_eq hL] at he + obtain ⟨c, hc, rfl⟩ := he + rw [back_τ hL hc, tilde_τ hL hc] + exact Γ.γ_set c hc + border_edge := by + intro e he hb + rw [arcComponents_eq hL] at he + obtain ⟨c, hc, rfl⟩ := he + obtain ⟨h₁, h₂⟩ := τ_subset_bd hL hc hb + rw [tilde_τ hL hc] + exact ⟨h₂, h₁⟩ + +@[simp] theorem painting_E (hL : IsChordData Γ L) : (painting Γ L hL).E = τ L '' Γ.C := + arcComponents_eq hL + +theorem painting_skAdj (hL : IsChordData Γ L) : (painting Γ L hL).skAdj = Γ.sk := by + ext x y + change (x ≠ y ∧ x ∈ Γ.N ∧ y ∈ Γ.N ∧ ∃ e ∈ (painting Γ L hL).E, x ∈ tilde e ∧ y ∈ tilde e) ↔ + (x ≠ y ∧ x ∈ Γ.N ∧ y ∈ Γ.N ∧ ∃ c ∈ Γ.C, x ∈ tilde c ∧ y ∈ tilde c) + rw [painting_E] + constructor + · rintro ⟨h₁, h₂, h₃, _, ⟨c, hc, rfl⟩, h₄, h₅⟩ + rw [tilde_τ hL hc] at h₄ h₅ + exact ⟨h₁, h₂, h₃, c, hc, h₄, h₅⟩ + · rintro ⟨h₁, h₂, h₃, c, hc, h₄, h₅⟩ + exact ⟨h₁, h₂, h₃, _, ⟨c, hc, rfl⟩, by rwa [tilde_τ hL hc], by rwa [tilde_τ hL hc]⟩ + +end Thin + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section8b.lean b/LeanPool/GraphMinor/GM20/Section8b.lean new file mode 100644 index 0000000000..ec26965ee7 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section8b.lean @@ -0,0 +1,328 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section8a +public import LeanPool.GraphMinor.GM20.Section9h +public import LeanPool.GraphMinor.GM20.Section10j + +import LeanPool.GraphMinor.GM19.Main + +import LeanPool.GraphMinor.Surface.PushOff + +/-! +# Graph Minors XX, (8.1) + +We deduce (8.1) from (2.1) of Graph Minors XIX. Each painting is made narrow as in `Section8a`. The +new +paintings are internally 3-connected, since by `PushOffStatement` an `O`-arc that misses the new set +`U` moves to an `O`-arc that misses the old one. A linear inflation between the new paintings gives +one between the old paintings, with the same map on the nodes. A painting with no cell is not +internally +3-connected, so we treat paintings with no cells apart, by counting nodes. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface + +universe w + +variable {S : Type} [TopologicalSpace S] [T2Space S] + +open Thin + +/-- The narrow painting of a 3-connected painting with a cell is internally 3-connected. -/ +theorem isInternallyThreeConnected (hS : IsSurface S) {Γ : Painting S} + {L : Set S → Set S} (hL : IsChordData Γ L) (h3 : Γ.IsThreeConnected) (hne : Γ.C.Nonempty) : + (Thin.painting Γ L hL).IsInternallyThreeConnected := by + refine ⟨by rw [painting_E]; exact hne.image _, ?_⟩ + intro F hF hFU _ hcard + change F ∩ U' Γ L ⊆ Γ.N at hFU + change (F ∩ Γ.N).ncard + _ ≤ 2 at hcard + let ι : Set (Set S) := {c | c ∈ Γ.C ∧ (tilde c).ncard = 2} + have hι : ι.Finite := Γ.finite_cells.subset fun _ h ↦ h.1 + have := hι.to_subtype + let T : Set (Set S) := {c | c ∈ Γ.C ∧ (tilde c).ncard ≠ 2} + have hT : T.Finite := Γ.finite_cells.subset fun _ h ↦ h.1 + let Z : Set S := Γ.N ∪ ⋃ c ∈ T, closure c + have hZ : IsClosed Z := + Γ.finite_N.isClosed.union (hT.isClosed_biUnion fun _ _ ↦ isClosed_closure) + have hZU : Z ⊆ U' Γ L := by + rintro x (hx | hx) + · exact Or.inl hx + · simp only [mem_iUnion, exists_prop] at hx + obtain ⟨c, hc, hx⟩ := hx + refine Or.inr (mem_biUnion hc.1 ?_) + simp only [W, ite_eq_right hc.2] + exact hx + have hmeet : ∀ {c c' : Set S}, c ∈ Γ.C → c' ∈ Γ.C → c ≠ c' → closure c ∩ closure c' ⊆ Γ.N := by + intro c c' hc hc' hne x hx + by_contra hn + have h₁ : x ∈ c := by + rw [← closure_diff hc] + exact ⟨hx.1, hn⟩ + have h₂ : x ∈ c' := by + rw [← closure_diff hc'] + exact ⟨hx.2, hn⟩ + exact hne (arcComponent_eq hc hc' h₁ h₂) + obtain ⟨h, hfix, hZ', hD'⟩ := GraphMinor.Surface.push_off S hS ι Γ.N Z (fun i ↦ closure i.1) + (fun i ↦ L i.1) Γ.finite_N + hZ (fun i ↦ Γ.cell_disc _ i.2.1) + (fun i ↦ by + obtain ⟨a, b, h₁, h₂, h₃, h₄⟩ := hL i.1 i.2.1 i.2.2 + have ha : a ∈ tilde i.1 := by rw [h₂]; exact Or.inl rfl + have hb : b ∈ tilde i.1 := by rw [h₂]; exact Or.inr rfl + refine ⟨a, b, h₁, ?_, Γ.tilde_subset _ i.2.1 ha, Γ.tilde_subset _ i.2.1 hb, h₃, ?_⟩ + · rw [Γ.closure_inter _ i.2.1, h₂] + · rcases h₄ with ⟨h₅, h₆⟩ | ⟨-, h₅⟩ + · refine Or.inl ⟨h₆, ?_⟩ + rintro x ⟨hx, hxb⟩ + by_contra hn + have : x ∈ i.1 := by + rw [← closure_diff i.2.1] + exact ⟨hx, hn⟩ + exact h₅ ⟨x, this, hxb⟩ + · exact Or.inr h₅) + (fun i j hij ↦ hmeet i.2.1 j.2.1 fun he ↦ hij (Subtype.ext he)) + (fun i ↦ by + rintro x ⟨hx, hx' | hx'⟩ + · exact hx' + · simp only [mem_iUnion, exists_prop] at hx' + obtain ⟨c, hc, hx'⟩ := hx' + exact hmeet i.2.1 hc.1 (fun he ↦ hc.2 (he ▸ i.2.2)) ⟨hx, hx'⟩) + F hF (fun x hx ↦ hFU ⟨hx.1, hZU hx.2⟩) + (fun i x hx ↦ by + refine hFU ⟨hx.1, Or.inr (mem_biUnion i.2.1 ?_)⟩ + simp only [W, ite_eq_left i.2.2] + exact hx.2) + have hnorm : (h '' F) ∩ Γ.U ⊆ Γ.N := by + rintro x ⟨hxF, hxU⟩ + by_contra hn + have hc : pathComponentIn (Γ.U \ Γ.N) x ∈ Γ.C := + mem_arcComponentsIn_pathComponentIn ⟨hxU, hn⟩ + have hxc : x ∈ closure (pathComponentIn (Γ.U \ Γ.N) x) := + subset_closure (mem_pathComponentIn_self ⟨hxU, hn⟩) + by_cases h₂ : (tilde (pathComponentIn (Γ.U \ Γ.N) x)).ncard = 2 + · exact hn (hD' ⟨_, hc, h₂⟩ ⟨hxF, hxc⟩) + · exact hn (hZ' ⟨hxF, Or.inr (mem_biUnion (show _ ∈ T from ⟨hc, h₂⟩) hxc)⟩) + have hsymm : ∀ n ∈ Γ.N, h.symm n = n := fun n hn ↦ by + rw [Homeomorph.symm_apply_eq, hfix n hn] + have hF' : (h '' F) ∩ Γ.N ⊆ F ∩ Γ.N := by + rintro _ ⟨⟨y, hy, rfl⟩, hn⟩ + have h₁ := hsymm _ hn + rw [h.symm_apply_apply] at h₁ + rw [← h₁] at hn ⊢ + exact ⟨hy, hn⟩ + have hle : ((h '' F) ∩ Γ.N).ncard ≤ 2 := + (Set.ncard_le_ncard hF' (Γ.finite_N.inter_of_right _)).trans (by omega) + obtain ⟨Δ, h₁, h₂, -, h₄⟩ := h3.1 _ (image_isOArc h hF) hnorm hle + refine ⟨h.symm '' Δ, image_isClosedDisc h.symm h₁, ?_, ?_⟩ + · rw [image_discBd, h₂, symm_image_image] + · rintro _ ⟨⟨y, hy, rfl⟩, hn⟩ + have hyN : y = h (h.symm y) := by simp + have h₅ : h.symm y ∈ Γ.N := hn + rw [hfix _ h₅] at hyN + have h₆ : y ∈ Γ.N := by rw [hyN]; exact h₅ + have h₇ := hF' ⟨h₄ ⟨hy, h₆⟩, h₆⟩ + rw [hsymm y h₆] + exact h₇.1 + +/-- In a cell that borders a cuff, the part of the cell in the cuff is the part kept. -/ +theorem inter_cuff {Γ : Painting S} {L : Set S → Set S} (hL : IsChordData Γ L) {c Θ : Set S} + (hc : c ∈ Γ.C) (hΘ : Θ ∈ cuffs S) (hne : (c ∩ Θ).Nonempty) : c ∩ Θ = τ L c := by + obtain ⟨x, hxb, rfl⟩ := hΘ + have hΘb : connectedComponentIn (bd S) x ⊆ bd S := connectedComponentIn_subset _ _ + have h₁ := inter_bd hL hc + have hsub : ∀ y ∈ c ∩ connectedComponentIn (bd S) x, y ∈ τ L c := fun y hy ↦ by + have h₂ : y ∈ c ∩ bd S := ⟨hy.1, hΘb hy.2⟩ + rw [h₁] at h₂ + exact h₂.1 + obtain ⟨y, hy⟩ := hne + have hyτ := hsub y hy + have hbd := (τ_subset_bd hL hc ⟨y, hyτ, hΘb hy.2⟩).1 + have hτ : τ L c ⊆ connectedComponentIn (bd S) x := by + have h₂ := (isPathConnected_τ hL hc).isConnected.isPreconnected + rw [connectedComponentIn_eq hy.2] + exact h₂.subset_connectedComponentIn hyτ hbd + exact subset_antisymm hsub fun z hz ↦ ⟨τ_subset hL hc hz, hτ hz⟩ + +/-- A linear inflation of the narrow paintings is a linear inflation of the paintings. -/ +theorem isLinearInflation_of_narrow {Γ Γ' : Painting S} {L L' : Set S → Set S} + (hL : IsChordData Γ L) (hL' : IsChordData Γ' L') {σv : S → Set S} {σe : Set S → Set S} + (hσ : GM19.IsLinearInflation (Thin.painting Γ L hL) (Thin.painting Γ' L' hL') σv σe) : + IsLinearInflation Γ Γ' σv (fun c ↦ back Γ' L' (σe (τ L c))) := by + have hmem : ∀ c ∈ Γ.C, τ L c ∈ (Thin.painting Γ L hL).E := fun c hc ↦ by + rw [painting_E] + exact ⟨c, hc, rfl⟩ + have key : ∀ c ∈ Γ.C, ∃ c' ∈ Γ'.C, σe (τ L c) = τ L' c' ∧ back Γ' L' (σe (τ L c)) = c' := by + intro c hc + have h₁ := hσ.edge_mem _ (hmem c hc) + rw [painting_E] at h₁ + obtain ⟨c', hc', h₂⟩ := h₁ + exact ⟨c', hc', h₂.symm, by rw [← h₂, back_τ hL' hc']⟩ + have hγ : ∀ c ∈ Γ.C, (Thin.painting Γ L hL).γ (τ L c) = Γ.γ c := fun c hc ↦ by + change Γ.γ (back Γ L (τ L c)) = _ + rw [back_τ hL hc] + have hγ' : ∀ e, (Thin.painting Γ' L' hL').γ e = Γ'.γ (back Γ' L' e) := fun _ ↦ rfl + have hnode : ∀ c ∈ Γ.C, ∀ (i : ℕ) (hi : i < (Γ.γ c).length), (Γ.γ c)[i] ∈ Γ.N := by + intro c hc i hi + have h₁ : (Γ.γ c)[i] ∈ {n | n ∈ Γ.γ c} := List.getElem_mem hi + rw [Γ.γ_set c hc] at h₁ + exact tilde_subset_N Γ hc h₁ + have hends : ∀ c ∈ Γ.C, ∀ (i : ℕ) (hi : i < (Γ.γ c).length) + (hi' : i < (Γ'.γ (back Γ' L' (σe (τ L c)))).length), + (Γ'.γ (back Γ' L' (σe (τ L c))))[i] ∈ σv (Γ.γ c)[i] := by + intro c hc i hi hi' + have h₁ := hσ.ends _ (hmem c hc) i (by rw [hγ c hc]; exact hi) hi' + rwa [List.getElem_of_eq (hγ c hc)] at h₁ + refine + { cell_mem := ?_, cell_size := ?_, borders_iff := ?_, cell_injOn := ?_, orientation := ?_, + node_nonempty := hσ.vertex_nonempty, node_subset := hσ.vertex_subset, node_connected := ?_, + node_disjoint := hσ.vertex_disjoint, nodes := ?_, border_cell := ?_ } + · intro c hc + obtain ⟨c', hc', -, h₂⟩ := key c hc + simpa only [h₂] using hc' + · intro c hc + obtain ⟨c', hc', h₁, h₂⟩ := key c hc + have h₃ := hσ.edge_size _ (hmem c hc) + rw [h₁, tilde_τ hL' hc', tilde_τ hL hc] at h₃ + simpa only [h₂] using h₃ + · intro c hc Θ hΘ + obtain ⟨c', hc', h₁, h₂⟩ := key c hc + have h₃ := hσ.borders_iff _ (hmem c hc) Θ hΘ + rw [h₁] at h₃ + simp only [h₂] + have hb : ∀ {Γ₀ : Painting S} {L₀ : Set S → Set S} (_ : IsChordData Γ₀ L₀) {c₀ : Set S}, + c₀ ∈ Γ₀.C → ((c₀ ∩ Θ).Nonempty ↔ (τ L₀ c₀ ∩ Θ).Nonempty) := by + intro Γ₀ L₀ h₀ c₀ hc₀ + constructor + · intro h₄ + have h₅ := inter_cuff h₀ hc₀ hΘ h₄ + obtain ⟨y, hy⟩ := h₄ + exact ⟨y, h₅ ▸ hy, hy.2⟩ + · rintro ⟨y, hy, hy'⟩ + exact ⟨y, τ_subset h₀ hc₀ hy, hy'⟩ + rw [hb hL hc, h₃, ← hb hL' hc'] + · intro c₁ h₁ c₂ h₂ he + obtain ⟨c₁', -, h₃, h₄⟩ := key c₁ h₁ + obtain ⟨c₂', -, h₅, h₆⟩ := key c₂ h₂ + have h₇ : c₁' = c₂' := by rw [← h₄, ← h₆]; exact he + have h₈ : σe (τ L c₁) = σe (τ L c₂) := by rw [h₃, h₅, h₇] + exact τ_injOn hL h₁ h₂ (hσ.edge_injOn (hmem _ h₁) (hmem _ h₂) h₈) + · intro c hc Θ hΘ hne f n n' hn hn' hpre + obtain ⟨c', hc', h₁, h₂⟩ := key c hc + simp only [h₂] at hn' ⊢ + have hne' : (τ L c ∩ Θ).Nonempty := by + have h₃ := inter_cuff hL hc hΘ hne + obtain ⟨y, hy⟩ := hne + exact ⟨y, h₃ ▸ hy, hy.2⟩ + have h₃ := hσ.orientation _ (hmem c hc) Θ hΘ hne' f n n' (by rw [hγ c hc]; exact hn) + (by rw [hγ', h₁, back_τ hL' hc']; exact hn') (by rw [← inter_cuff hL hc hΘ hne]; exact hpre) + have hb := (hσ.borders_iff _ (hmem c hc) Θ hΘ).mp hne' + rw [h₁] at hb h₃ + have hne'' : (c' ∩ Θ).Nonempty := by + obtain ⟨y, hy, hy'⟩ := hb + exact ⟨y, τ_subset hL' hc' hy, hy'⟩ + rw [inter_cuff hL' hc' hΘ hne''] + exact h₃ + · intro n hn + have h₁ := hσ.vertex_connected n hn + rw [painting_skAdj] at h₁ + exact h₁ + · intro n hn c hc i hi hi' + have h₁ := hends c hc i hi hi' + constructor + · rintro rfl + exact h₁ + · intro h₂ + by_contra hne + exact Set.disjoint_left.mp (hσ.vertex_disjoint _ (hnode c hc i hi) n hn hne) h₁ h₂ + · intro c' hc' hb hni + have hb' : GM19.Painting.IsBorder (τ L' c') := by + obtain ⟨x, hx, hx'⟩ := hb + have h₁ : x ∈ c' ∩ bd S := ⟨hx, hx'⟩ + rw [inter_bd hL' hc'] at h₁ + exact ⟨x, h₁⟩ + have hni' : τ L' c' ∉ σe '' (Thin.painting Γ L hL).E := by + rintro ⟨_, he, h₁⟩ + rw [painting_E] at he + obtain ⟨c, hc, rfl⟩ := he + refine hni ⟨c, hc, ?_⟩ + change back Γ' L' (σe (τ L c)) = c' + rw [h₁, back_τ hL' hc'] + obtain ⟨v, hv, h₁⟩ := hσ.border_edge _ (by rw [painting_E]; exact ⟨c', hc', rfl⟩) hb' hni' + rw [tilde_τ hL' hc'] at h₁ + exact ⟨v, hv, h₁⟩ + +omit [T2Space S] in +/-- Paintings with no cells, with `|N(Γ)| ≤ |N(Γ')|`: a linear inflation is an injection of the +nodes. -/ +theorem isLinearInflation_of_empty [Nonempty S] {Γ Γ' : Painting S} (hC : Γ.C = ∅) (hC' : Γ'.C = ∅) + (hle : Γ.N.ncard ≤ Γ'.N.ncard) : + ∃ ζn : S → Set S, IsLinearInflation Γ Γ' ζn id := by + have hle' : Γ.N.encard ≤ Γ'.N.encard := by + rw [← Γ.finite_N.cast_ncard_eq, ← Γ'.finite_N.cast_ncard_eq] + exact_mod_cast hle + obtain ⟨g, hg, hinj⟩ := Γ.finite_N.exists_injOn_of_encard_le hle' + refine ⟨fun n ↦ {g n}, ?_⟩ + refine + { cell_mem := ?_, cell_size := ?_, borders_iff := ?_, cell_injOn := ?_, orientation := ?_, + node_nonempty := fun n _ ↦ singleton_nonempty _, node_subset := ?_, node_connected := ?_, + node_disjoint := ?_, nodes := ?_, border_cell := ?_ } + · simp [hC] + · simp [hC] + · simp [hC] + · simp [hC] + · simp [hC] + · intro n hn _ hx + obtain rfl := mem_singleton_iff.mp hx + exact hg hn + · intro n _ x y + have : x = y := Subtype.ext (by rw [mem_singleton_iff.mp x.2, mem_singleton_iff.mp y.2]) + rw [this] + · intro n₁ h₁ n₂ h₂ hne + exact Set.disjoint_singleton.mpr fun he ↦ hne (hinj h₁ h₂ he) + · simp [hC] + · simp [hC'] + +/-- Graph Minors XX, (8.1) (page 348), from (2.1) of Graph Minors XIX and `PushOffStatement`. -/ +theorem theorem_8_1_proof : Theorem81Statement.{w} := by + classical + intro S _ Ω _ hS hc hΩ Γ φ h3 + have : T2Space S := hS.2.1 + choose L hL using fun i ↦ exists_chordData (Γ i) + by_cases hinf : {i | (Γ i).C.Nonempty}.Infinite + · let g : ℕ → ℕ := Nat.nth fun i ↦ (Γ i).C.Nonempty + have hg : StrictMono g := Nat.nth_strictMono hinf + have hgm : ∀ k, (Γ (g k)).C.Nonempty := fun k ↦ Nat.nth_mem_of_infinite hinf k + obtain ⟨k, l, hkl, σv, σe, hσ, hφ⟩ := GraphMinor.GM19.gm19_main.{w} S hS hc hΩ + (fun k ↦ Thin.painting (Γ (g k)) (L (g k)) (hL (g k))) + (fun k e ↦ φ (g k) (back (Γ (g k)) (L (g k)) e)) + (fun k ↦ isInternallyThreeConnected hS (hL _) (h3 _) (hgm k)) + refine ⟨g k, g l, hg hkl, σv, _, isLinearInflation_of_narrow (hL _) (hL _) hσ, fun c hc ↦ ?_⟩ + have h₁ := hφ (τ (L (g k)) c) (by rw [painting_E]; exact ⟨c, hc, rfl⟩) + simp only [back_τ (hL _) hc] at h₁ + exact h₁ + · obtain ⟨B, hB⟩ := (Set.not_infinite.mp hinf).bddAbove + have hemp : ∀ n, (Γ (B + 1 + n)).C = ∅ := fun n ↦ by + by_contra hne + have := hB (nonempty_iff_ne_empty.mpr hne) + omega + obtain ⟨k, l, hkl, hle⟩ := (wellQuasiOrdered_le (α := ℕ)) + (fun n ↦ (Γ (B + 1 + n)).N.ncard) + have : Nonempty S := hc.toNonempty + obtain ⟨ζn, hζ⟩ := isLinearInflation_of_empty (hemp k) (hemp l) hle + refine ⟨B + 1 + k, B + 1 + l, by omega, ζn, id, hζ, fun c hc' ↦ ?_⟩ + rw [hemp k] at hc' + exact hc'.elim + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section9a.lean b/LeanPool/GraphMinor/GM20/Section9a.lean new file mode 100644 index 0000000000..258688f64a --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section9a.lean @@ -0,0 +1,503 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section10b +public import Mathlib.Analysis.SpecialFunctions.Complex.Circle +public import Mathlib.Order.Interval.Finset.Nat + +/-! +# Graph Minors XX, Section 9: the cells around a cuff + +The proof of (9.1) walks around each cuff. This file shows that the nodes on a cuff `Θ` and the +cells +that border `Θ` form a cycle (`CuffCycle`): the nodes are `pos 0, …, pos (k-1)`, with `k ≥ 2`, the +border cells are `cell 0, …, cell (k-1)`, and `cell m` has the nodes `pos m` and `pos (m+1)`. All +these +indices run over `ℕ`, with period `k`, and the order of the nodes on `Θ` is the order of the +indices. + +We take the angles of the nodes under a parametrization of `Θ` by the circle, and sort them. Between +two consecutive nodes `Θ` has an open arc which contains no node, so it lies in one cell. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface + +/-- The sorted angles of a finite set, continued periodically. -/ +theorem exists_angle_seq (s : Finset ℝ) (hs : s.Nonempty) + (h : ∀ x ∈ s, ∀ y ∈ s, x - y < 2 * Real.pi) : + ∃ (k : ℕ) (T : ℕ → ℝ), 0 < k ∧ StrictMono T ∧ (∀ m, T (m + k) = T m + 2 * Real.pi) ∧ + (∀ x ∈ s, ∃ m < k, T m = x) ∧ ∀ m < k, T m ∈ s := by + set k := s.card with hk + have hk0 : 0 < k := Finset.card_pos.mpr hs + let L := s.orderEmbOfFin hk.symm + let T : ℕ → ℝ := fun m ↦ L ⟨m % k, Nat.mod_lt _ hk0⟩ + (m / k : ℕ) * (2 * Real.pi) + have hpi := Real.pi_pos + have hmem : ∀ i, L i ∈ s := fun i ↦ Finset.orderEmbOfFin_mem _ _ _ + have hT : ∀ m (hm : m < k), T m = L ⟨m, hm⟩ := by + intro m hm + simp only [T, Nat.mod_eq_of_lt hm, Nat.div_eq_of_lt hm] + simp + refine ⟨k, T, hk0, strictMono_nat_of_lt_succ fun m ↦ ?_, fun m ↦ ?_, fun x hx ↦ ?_, + fun m hm ↦ ?_⟩ + · by_cases hm : (m + 1) % k = 0 + · have h₁ : (m + 1) / k = m / k + 1 := by + rw [Nat.succ_div] + rw [ite_eq_left ((Nat.dvd_iff_mod_eq_zero).mpr hm)] + simp only [T, h₁] + have h₂ := h _ (hmem ⟨m % k, Nat.mod_lt _ hk0⟩) _ (hmem ⟨(m + 1) % k, Nat.mod_lt _ hk0⟩) + push_cast + nlinarith + · have hdiv : (m + 1) / k = m / k := by + rw [Nat.succ_div, ite_eq_right (fun h' ↦ hm (Nat.dvd_iff_mod_eq_zero.mp h'))] + rfl + have hk1 : 1 < k := by + by_contra hc + have hk2 : k = 1 := by omega + exact hm (by rw [hk2, Nat.mod_one]) + have hmod : (m + 1) % k = m % k + 1 := by + have h₄ := Nat.mod_lt m hk0 + have h₅ : (m + 1) % k = (m % k + 1) % k := by + rw [Nat.add_mod, Nat.mod_eq_of_lt hk1] + by_cases h' : m % k + 1 = k + · exact absurd (by rw [h₅, h', Nat.mod_self]) hm + · rw [h₅, Nat.mod_eq_of_lt (by omega)] + simp only [T, hdiv] + have h₃ : L ⟨m % k, Nat.mod_lt _ hk0⟩ < L ⟨(m + 1) % k, Nat.mod_lt _ hk0⟩ := + L.strictMono (by simp [Fin.lt_def, hmod]) + linarith + · simp only [T, Nat.add_mod_right, Nat.add_div_right _ hk0] + push_cast + ring + · have hx' : x ∈ Set.range L := by + rw [Finset.range_orderEmbOfFin] + exact hx + obtain ⟨i, rfl⟩ := hx' + exact ⟨i.1, i.2, hT _ i.2⟩ + · rw [hT m hm] + exact hmem _ + +theorem exists_exp_eq_Ico (a : ℝ) (x : Circle) : + ∃ t ∈ Ico a (a + 2 * Real.pi), Circle.exp t = x := + GraphMinor.Surface.exists_circleExp_mem_Ico a x + +/-- Two angles less than a full turn apart with the same image are equal. -/ +theorem eq_of_exp_eq {s t : ℝ} (h : Circle.exp s = Circle.exp t) (h₁ : s ≤ t) + (h₂ : t < s + 2 * Real.pi) : s = t := by + have hle : t ∈ Ico s (s + 2 * Real.pi) := ⟨h₁, h₂⟩ + exact Circle.exp_injOn_Ico (a := s) (b := s + 2 * Real.pi) (by simp) + ⟨le_rfl, by linarith⟩ hle h + +/-- The circle is not homeomorphic to the interval: removing a middle point of the interval +disconnects it, and removing a point from the circle does not. -/ +theorem not_homeomorph_circle_unitInterval (g : Circle ≃ₜ unitInterval) : False := by + have hpi : 0 < 2 * Real.pi := by positivity + let m : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + let a : ℝ := Complex.arg (g.symm m) + have hconn : IsPreconnected ((fun t ↦ g (Circle.exp t)) '' Ioo a (a + 2 * Real.pi)) := + isPreconnected_Ioo.image _ (g.continuous.comp Circle.exp.continuous).continuousOn + have hmem : ∀ y : unitInterval, y ≠ m → y ∈ (fun t ↦ g (Circle.exp t)) '' Ioo a (a + 2 * Real.pi) + := by + intro y hy + obtain ⟨t, ht, hte⟩ := exists_exp_eq_Ico a (g.symm y) + have hne : t ≠ a := by + rintro rfl + apply hy + have : g.symm y = g.symm m := by rw [← hte, Circle.exp_arg] + exact g.symm.injective this + refine ⟨t, ⟨lt_of_le_of_ne ht.1 hne.symm, ht.2⟩, ?_⟩ + simp only [hte, Homeomorph.apply_symm_apply] + have h0 : (0 : unitInterval) ≠ m := fun h ↦ by + have := congrArg Subtype.val h + norm_num [m] at this + have h1 : (1 : unitInterval) ≠ m := fun h ↦ by + have := congrArg Subtype.val h + norm_num [m] at this + obtain ⟨t, ht, hte⟩ := hconn.Icc_subset (hmem 0 h0) (hmem 1 h1) + (show m ∈ Icc 0 1 from ⟨unitInterval.nonneg _, unitInterval.le_one _⟩) + have h₂ : Circle.exp t = Circle.exp a := by + rw [Circle.exp_arg] + exact (g.symm_apply_eq.mpr hte.symm).symm + exact absurd (eq_of_exp_eq h₂.symm ht.1.le (by linarith [ht.2])) ht.1.ne + +variable {S : Type} [TopologicalSpace S] + +theorem mem_arcComponentsIn_pathComponentIn {F : Set S} {x : S} (hx : x ∈ F) : + pathComponentIn F x ∈ arcComponentsIn F := + GraphMinor.Surface.mem_arcComponentsIn_of_mem hx + +theorem eq_pathComponentIn {F c : Set S} (hc : c ∈ arcComponentsIn F) {x : S} (hx : x ∈ c) : + c = pathComponentIn F x := by + have hsub := hc.2.2.1.subset_pathComponentIn hx hc.2.1 + exact (hc.2.2.2 _ pathComponentIn_subset (isPathConnected_pathComponentIn (hc.2.1 hx)) hsub).symm + +theorem arcComponent_eq {F c c' : Set S} (hc : c ∈ arcComponentsIn F) + (hc' : c' ∈ arcComponentsIn F) {x : S} (hx : x ∈ c) (hx' : x ∈ c') : c = c' := + (eq_pathComponentIn hc hx).trans (eq_pathComponentIn hc' hx').symm + +/-- The cycle of nodes and border cells around a cuff `Θ`, under the parametrization `f`. All +indices +have period `k`. The nodes are `pos m`, at the angles `T m`, and `cell m` is the cell between `pos +m` +and `pos (m + 1)`. -/ +structure CuffCycle (Γ : Painting S) {Θ : Set S} (f : Circle ≃ₜ Θ) where + /-- The number of nodes on `Θ`. -/ + k : ℕ + two_le : 2 ≤ k + /-- The angles of the nodes, in order. -/ + T : ℕ → ℝ + strictMono : StrictMono T + T_add : ∀ m, T (m + k) = T m + 2 * Real.pi + /-- The cells bordering `Θ`, in order. -/ + cell : ℕ → Set S + cell_add : ∀ m, cell (m + k) = cell m + pos_mem : ∀ m, GM19.cuffPoint f (T m) ∈ Γ.N + exists_pos : ∀ n ∈ Γ.N ∩ Θ, ∃ m < k, GM19.cuffPoint f (T m) = n + cell_mem : ∀ m, cell m ∈ Γ.C + cell_inter : ∀ m, cell m ∩ Θ = GM19.cuffPoint f '' Ioo (T m) (T (m + 1)) + tilde_eq : ∀ m, tilde (cell m) = {GM19.cuffPoint f (T m), GM19.cuffPoint f (T (m + 1))} + cell_ne : ∀ m m', m < m' → m' < m + k → cell m ≠ cell m' + exists_cell : ∀ c ∈ Γ.C, (c ∩ Θ).Nonempty → ∃ m < k, cell m = c + +theorem cuffPoint_mem {Θ : Set S} (f : Circle ≃ₜ Θ) (t : ℝ) : GM19.cuffPoint f t ∈ Θ := + (f (Circle.exp t)).2 + +theorem continuous_cuffPoint {Θ : Set S} (f : Circle ≃ₜ Θ) : + Continuous (GM19.cuffPoint f) := + continuous_subtype_val.comp (f.continuous.comp Circle.exp.continuous) + +theorem cuffPoint_add {Θ : Set S} (f : Circle ≃ₜ Θ) (t : ℝ) : + GM19.cuffPoint f (t + 2 * Real.pi) = GM19.cuffPoint f t := by + simp only [GM19.cuffPoint, Circle.exp_add_two_pi] + +theorem cuffPoint_eq_iff {Θ : Set S} (f : Circle ≃ₜ Θ) {s t : ℝ} : + GM19.cuffPoint f s = GM19.cuffPoint f t ↔ Circle.exp s = Circle.exp t := by + simp only [GM19.cuffPoint] + exact ⟨fun h ↦ f.injective (Subtype.ext h), fun h ↦ by rw [h]⟩ + +theorem exists_cuffPoint_eq {Θ : Set S} (f : Circle ≃ₜ Θ) (a : ℝ) {x : S} (hx : x ∈ Θ) : + ∃ t ∈ Ico a (a + 2 * Real.pi), GM19.cuffPoint f t = x := by + obtain ⟨t, ht, hte⟩ := exists_exp_eq_Ico a (f.symm ⟨x, hx⟩) + exact ⟨t, ht, by simp [GM19.cuffPoint, hte]⟩ + +theorem Painting.cuff_subset_U (Γ : Painting S) {Θ : Set S} (hΘ : Θ ∈ cuffs S) : Θ ⊆ Γ.U := by + obtain ⟨p, hp, rfl⟩ := hΘ + exact (connectedComponentIn_subset _ _).trans Γ.bd_subset + +theorem tilde_subset_N (Γ : Painting S) {c : Set S} (hc : c ∈ Γ.C) : tilde c ⊆ Γ.N := by + rw [← Γ.closure_inter c hc] + exact inter_subset_right + +/-- The closure of a cell meets the boundary of `Σ` inside the cuffs that it borders. -/ +theorem closure_inter_bd_subset (Γ : Painting S) {c : Set S} (hc : c ∈ Γ.C) {Θ : Set S} + (hΘ : Θ ∈ cuffs S) (hcΘ : (c ∩ Θ).Nonempty) : closure c ∩ bd S ⊆ Θ := by + obtain ⟨x, hxc, hxΘ⟩ := hcΘ + obtain ⟨p, hp, rfl⟩ := hΘ + have hxbd : x ∈ bd S := connectedComponentIn_subset _ _ hxΘ + obtain ⟨hcard, ⟨hL⟩, hends⟩ := Γ.border_cell c hc ⟨x, hxc, hxbd⟩ + have hconn : IsPreconnected (closure c ∩ bd S) := by + have := (isPreconnected_univ (α := unitInterval)).image (fun t ↦ (hL t).1) + (continuous_subtype_val.comp hL.continuous).continuousOn + have himg : (fun t ↦ (hL t).1) '' univ = closure c ∩ bd S := by + ext y + constructor + · rintro ⟨t, -, rfl⟩ + exact (hL t).2 + · intro hy + exact ⟨hL.symm ⟨y, hy⟩, trivial, by simp⟩ + rwa [himg] at this + rw [connectedComponentIn_eq hxΘ] + exact hconn.subset_connectedComponentIn ⟨subset_closure hxc, hxbd⟩ inter_subset_right + +/-- The closure of a border cell does not contain the whole cuff, since it meets `bd(Σ)` in a line. +-/ +theorem not_cuff_subset_closure (Γ : Painting S) {c : Set S} (hc : c ∈ Γ.C) {Θ : Set S} + (hΘ : Θ ∈ cuffs S) (hcΘ : (c ∩ Θ).Nonempty) (f : Circle ≃ₜ Θ) : ¬ Θ ⊆ closure c := by + intro hsub + have hbd : Θ ⊆ bd S := by + obtain ⟨p, hp, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + have heq : closure c ∩ bd S = Θ := + subset_antisymm (closure_inter_bd_subset Γ hc hΘ hcΘ) (subset_inter hsub hbd) + obtain ⟨x, hxc, hxΘ⟩ := hcΘ + obtain ⟨-, ⟨hL⟩, -⟩ := Γ.border_cell c hc ⟨x, hxc, hbd hxΘ⟩ + rw [heq] at hL + exact not_homeomorph_circle_unitInterval (f.trans hL.symm) + +/-- A point of `Θ` that is not at a node lies on one of the arcs between consecutive nodes. -/ +theorem exists_mem_Ioo_of_seq {T : ℕ → ℝ} {a b : ℕ} (hab : a ≤ b) {t : ℝ} + (h₁ : T a ≤ t) (h₂ : t < T b) : ∃ j, a ≤ j ∧ j < b ∧ T j ≤ t ∧ t < T (j + 1) := by + induction b, hab using Nat.le_induction with + | base => exact absurd h₂ (not_lt.mpr h₁) + | succ b hab ih => + by_cases h : t < T b + · obtain ⟨j, h₃, h₄, h₅, h₆⟩ := ih h + exact ⟨j, h₃, by omega, h₅, h₆⟩ + · exact ⟨b, hab, by omega, not_lt.mp h, h₂⟩ + +theorem T_add_mul {k : ℕ} {T : ℕ → ℝ} (h : ∀ m, T (m + k) = T m + 2 * Real.pi) (m q : ℕ) : + T (m + q * k) = T m + q * (2 * Real.pi) := by + induction q with + | zero => simp + | succ q ih => + rw [Nat.succ_mul, ← Nat.add_assoc, h, ih] + push_cast + ring + +/-- Every angle of a node is a term of the sequence `T`, if it is at least `T 0`. -/ +theorem exists_T_eq {k : ℕ} {T : ℕ → ℝ} (_hk : 0 < k) (hT : StrictMono T) + (h : ∀ m, T (m + k) = T m + 2 * Real.pi) {m : ℕ} (hm : m < k) {t : ℝ} + (ht : Circle.exp t = Circle.exp (T m)) (h₀ : T 0 ≤ t) : ∃ j, T j = t := by + obtain ⟨z, hz⟩ := Circle.exp_eq_exp.mp ht + have hpi := Real.pi_pos + have hT0 : T m < T 0 + 2 * Real.pi := by + have := hT (show m < 0 + k by omega) + rwa [h] at this + have hz0 : 0 ≤ z := by + by_contra hc + have hle : (z : ℝ) ≤ -1 := by exact_mod_cast (by omega : z ≤ -1) + nlinarith + obtain ⟨q, rfl⟩ := Int.eq_ofNat_of_zero_le hz0 + refine ⟨m + q * k, ?_⟩ + rw [T_add_mul h, hz] + simp + +theorem cuffPoint_add_mul {Θ : Set S} (f : Circle ≃ₜ Θ) (t : ℝ) (q : ℕ) : + GM19.cuffPoint f (t + q * (2 * Real.pi)) = GM19.cuffPoint f t := by + induction q with + | zero => simp + | succ q ih => + rw [← ih, ← cuffPoint_add f (t + q * (2 * Real.pi))] + congr 1 + push_cast + ring + +private theorem exists_distinct_cuff_nodes (Γ : Painting S) {Θ : Set S} + (hΘ : Θ ∈ cuffs S) (f : Circle ≃ₜ Θ) (hbd : Θ ⊆ bd S) (hU : Θ ⊆ Γ.U) : + ∃ a b : S, a ∈ Γ.N ∩ Θ ∧ b ∈ Γ.N ∩ Θ ∧ a ≠ b := by + have hpi := Real.pi_pos + have hinj : InjOn (GM19.cuffPoint f) (Ico 0 (0 + 2 * Real.pi)) := fun a ha b hb hab ↦ + Circle.exp_injOn_Ico (a := 0) (b := 0 + 2 * Real.pi) (by simp) ha hb + ((cuffPoint_eq_iff f).mp hab) + have hinf : (GM19.cuffPoint f '' Ico 0 (0 + 2 * Real.pi)).Infinite := + (Ico_infinite (by linarith)).image hinj + obtain ⟨x, ⟨⟨t, -, rfl⟩, hxN⟩⟩ := (hinf.sdiff Γ.finite_N).nonempty + have hxΘ := cuffPoint_mem f t + set x := GM19.cuffPoint f t with hx + have hxc₀ : pathComponentIn (Γ.U \ Γ.N) x ∈ Γ.C := mem_arcComponentsIn_pathComponentIn ⟨hU hxΘ, + hxN⟩ + have hxm₀ : x ∈ pathComponentIn (Γ.U \ Γ.N) x := mem_pathComponentIn_self ⟨hU hxΘ, hxN⟩ + obtain ⟨hcard₀, -, -⟩ := Γ.border_cell _ hxc₀ ⟨x, hxm₀, hbd hxΘ⟩ + obtain ⟨a, b, hab, hti⟩ := Set.ncard_eq_two.mp hcard₀ + have hmemN : ∀ {y}, y ∈ tilde (pathComponentIn (Γ.U \ Γ.N) x) → y ∈ Γ.N ∩ Θ := fun hy ↦ + ⟨tilde_subset_N Γ hxc₀ hy, node_mem_cuff Γ hxc₀ hΘ ⟨x, hxm₀, hxΘ⟩ hy⟩ + have ha : a ∈ Γ.N ∩ Θ := hmemN (by rw [hti]; exact Or.inl rfl) + have hb : b ∈ Γ.N ∩ Θ := hmemN (by rw [hti]; exact Or.inr rfl) + exact ⟨a, b, ha, hb, hab⟩ + +/-- The nodes and border cells around a cuff form a cycle. We sort the angles of the nodes. Between +consecutive nodes the cuff has an open arc with no node, which lies in one cell. Since the closure +of +a border cell has exactly two nodes, and does not contain the cuff, that cell has exactly these two +nodes, and distinct arcs lie in distinct cells. -/ +theorem exists_cuffCycle (Γ : Painting S) {Θ : Set S} (hΘ : Θ ∈ cuffs S) (f : Circle ≃ₜ Θ) : + Nonempty (CuffCycle Γ f) := by + classical + have hpi := Real.pi_pos + have h2pi : 0 < 2 * Real.pi := by positivity + have hbd : Θ ⊆ bd S := by + obtain ⟨p, hp, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + have hU := Γ.cuff_subset_U hΘ + have hfin : (Γ.N ∩ Θ).Finite := Γ.finite_N.inter_of_left _ + choose! g hg hgf using fun x (hx : x ∈ Γ.N ∩ Θ) ↦ exists_cuffPoint_eq f 0 hx.2 + obtain ⟨a, b, ha, hb, hab⟩ := exists_distinct_cuff_nodes Γ hΘ f hbd hU + let s : Finset ℝ := hfin.toFinset.image g + have hmems : ∀ {y}, y ∈ Γ.N ∩ Θ → g y ∈ s := fun hy ↦ + Finset.mem_image_of_mem _ (hfin.mem_toFinset.mpr hy) + have hdiff : ∀ y ∈ s, ∀ z ∈ s, y - z < 2 * Real.pi := by + intro y hy z hz + obtain ⟨y', hy', rfl⟩ := Finset.mem_image.mp hy + obtain ⟨z', hz', rfl⟩ := Finset.mem_image.mp hz + have h₁ := (hg _ (hfin.mem_toFinset.mp hy')).2 + have h₂ := (hg _ (hfin.mem_toFinset.mp hz')).1 + linarith + obtain ⟨k, T, hk, hT, hadd, hsurj, hins⟩ := exists_angle_seq s ⟨_, hmems ha⟩ hdiff + have htwo : 2 ≤ k := by + by_contra hc + have hk1 : k = 1 := by omega + subst hk1 + obtain ⟨m, hm, hTm⟩ := hsurj _ (hmems ha) + obtain ⟨m', hm', hTm'⟩ := hsurj _ (hmems hb) + have : m = m' := by omega + subst this + apply hab + rw [← hgf a ha, ← hgf b hb, ← hTm, ← hTm'] + let P := GM19.cuffPoint f + have hposN : ∀ m, P (T m) ∈ Γ.N ∩ Θ := by + intro m + have hm : m = m % k + (m / k) * k := by + rw [Nat.mul_comm] + exact (Nat.mod_add_div m k).symm + have h₁ : P (T m) = P (T (m % k)) := by + rw [hm, T_add_mul hadd, Nat.add_mul_mod_self_right, Nat.mod_mod] + exact cuffPoint_add_mul f _ _ + obtain ⟨n, hn, hne⟩ := Finset.mem_image.mp (hins _ (Nat.mod_lt m hk)) + have hn' := hfin.mem_toFinset.mp hn + rw [h₁, ← hne, show P (g n) = n from hgf n hn'] + exact hn' + have hnone : ∀ m t, T m < t → t < T (m + 1) → P t ∉ Γ.N := by + intro m t h₁ h₂ hN + have hn : P t ∈ Γ.N ∩ Θ := ⟨hN, cuffPoint_mem f t⟩ + obtain ⟨j, hj, hTj⟩ := hsurj _ (hmems hn) + have hexp : Circle.exp t = Circle.exp (T j) := by + refine (cuffPoint_eq_iff f).mp ?_ + rw [hTj] + exact (hgf _ hn).symm + obtain ⟨j', hj'⟩ := exists_T_eq hk hT hadd hj hexp + ((hT.monotone (Nat.zero_le m)).trans h₁.le) + rw [← hj'] at h₁ h₂ + have h₃ := hT.lt_iff_lt.mp h₁ + have h₄ := hT.lt_iff_lt.mp h₂ + omega + have hpos_ne : ∀ m m', m < m' → m' < m + k → P (T m) ≠ P (T m') := by + intro m m' h₁ h₂ heq + have h₃ : T m' < T m + 2 * Real.pi := by + rw [← hadd] + exact hT h₂ + exact (hT h₁).ne (eq_of_exp_eq ((cuffPoint_eq_iff f).mp heq) (hT h₁).le h₃) + let mid : ℕ → ℝ := fun m ↦ (T m + T (m + 1)) / 2 + have hmid : ∀ m, mid m ∈ Ioo (T m) (T (m + 1)) := fun m ↦ by + have := hT (Nat.lt_succ_self m) + exact ⟨by simp only [mid]; linarith, by simp only [mid]; linarith⟩ + let cell : ℕ → Set S := fun m ↦ pathComponentIn (Γ.U \ Γ.N) (P (mid m)) + have hAU : ∀ m, P '' Ioo (T m) (T (m + 1)) ⊆ Γ.U \ Γ.N := by + rintro m _ ⟨t, ht, rfl⟩ + exact ⟨hU (cuffPoint_mem f t), hnone m t ht.1 ht.2⟩ + have hmidU : ∀ m, P (mid m) ∈ Γ.U \ Γ.N := fun m ↦ hAU m ⟨_, hmid m, rfl⟩ + have hAconn : ∀ m, IsPathConnected (P '' Ioo (T m) (T (m + 1))) := fun m ↦ + ((convex_Ioo _ _).isPathConnected ⟨_, hmid m⟩).image (continuous_cuffPoint f) + have hAsub : ∀ m, P '' Ioo (T m) (T (m + 1)) ⊆ cell m := fun m ↦ + (hAconn m).subset_pathComponentIn ⟨_, hmid m, rfl⟩ (hAU m) + have hcell : ∀ m, cell m ∈ Γ.C := fun m ↦ mem_arcComponentsIn_pathComponentIn (hmidU m) + have hmeet : ∀ m, (cell m ∩ Θ).Nonempty := fun m ↦ + ⟨_, hAsub m ⟨_, hmid m, rfl⟩, cuffPoint_mem f _⟩ + have hcl : ∀ m, P (T m) ∈ closure (cell m) ∧ P (T (m + 1)) ∈ closure (cell m) := by + intro m + have hlt := hT (Nat.lt_succ_self m) + have hcont := continuous_cuffPoint f + have hmaps : MapsTo P (Ioo (T m) (T (m + 1))) (cell m) := fun t ht ↦ hAsub m ⟨t, ht, rfl⟩ + refine ⟨map_mem_closure hcont ?_ hmaps, map_mem_closure hcont ?_ hmaps⟩ + · rw [closure_Ioo hlt.ne] + exact ⟨le_rfl, hlt.le⟩ + · rw [closure_Ioo hlt.ne] + exact ⟨hlt.le, le_rfl⟩ + have htilde : ∀ m, tilde (cell m) = {P (T m), P (T (m + 1))} := by + intro m + obtain ⟨y, hy, hyΘ⟩ := hmeet m + obtain ⟨hcard, -, -⟩ := Γ.border_cell _ (hcell m) ⟨y, hy, hbd hyΘ⟩ + have hsub : ({P (T m), P (T (m + 1))} : Set S) ⊆ tilde (cell m) := by + rw [← Γ.closure_inter _ (hcell m)] + rintro z (rfl | rfl) + · exact ⟨(hcl m).1, (hposN m).1⟩ + · exact ⟨(hcl m).2, (hposN _).1⟩ + refine (Set.eq_of_subset_of_ncard_le hsub ?_ (Γ.cell_size _ (hcell m)).1).symm + rw [Set.ncard_pair (hpos_ne m (m + 1) (by omega) (by omega)), hcard] + have hcell_ne : ∀ m m', m < m' → m' < m + k → cell m ≠ cell m' := by + intro m m' h₁ h₂ heq + have ht : ({P (T m), P (T (m + 1))} : Set S) = {P (T m'), P (T (m' + 1))} := by + rw [← htilde, ← htilde, heq] + have h₃ : P (T m) ∈ ({P (T m'), P (T (m' + 1))} : Set S) := ht ▸ Or.inl rfl + have h₄ : P (T (m + 1)) ∈ ({P (T m'), P (T (m' + 1))} : Set S) := ht ▸ Or.inr rfl + have h₅ : m' + 1 = m + k := by + rcases h₃ with h₃ | h₃ + · exact absurd h₃ (hpos_ne _ _ h₁ h₂) + · by_contra hc + exact hpos_ne _ _ (by omega) (by omega) h₃ + have h₆ : m' = m + 1 := by + rcases h₄ with h₄ | h₄ + · by_contra hc + exact hpos_ne _ _ (by omega) (by omega) h₄ + · have h₇ : P (T (m + 1)) = P (T m) := by + have h₈ : P (T (m' + 1)) = P (T m) := by + rw [h₅, hadd] + exact cuffPoint_add f _ + exact (show P (T (m + 1)) = P (T (m' + 1)) from h₄).trans h₈ + exact absurd h₇.symm (hpos_ne _ _ (by omega) (by omega)) + subst h₆ + have hk2 : k = 2 := by omega + subst hk2 + refine not_cuff_subset_closure Γ (hcell m) hΘ (hmeet m) f fun y hy ↦ ?_ + obtain ⟨t, ht₀, rfl⟩ := exists_cuffPoint_eq f (T m) hy + have ht₁ : t < T (m + 2) := by + rw [hadd] + exact ht₀.2 + obtain ⟨j, h₇, h₈, h₉, h₁₀⟩ := exists_mem_Ioo_of_seq (by omega) ht₀.1 ht₁ + have hj : j = m ∨ j = m + 1 := by omega + have hcj : cell j = cell m := by + rcases hj with rfl | rfl + · rfl + · exact heq.symm + rcases h₉.eq_or_lt with h₁₁ | h₁₁ + · rw [← h₁₁] + rcases hj with rfl | rfl + · exact (hcl _).1 + · exact (hcl _).2 + · exact subset_closure (hcj ▸ hAsub j ⟨t, ⟨h₁₁, h₁₀⟩, rfl⟩) + have hfind : ∀ a b, a < b → ∀ t, T a ≤ t → t < T b → P t ∉ Γ.N → + ∃ j, a ≤ j ∧ j < b ∧ P t ∈ cell j ∧ t ∈ Ioo (T j) (T (j + 1)) := by + intro a b hab t h₁ h₂ hN + obtain ⟨j, h₃, h₄, h₅, h₆⟩ := exists_mem_Ioo_of_seq hab.le h₁ h₂ + have h₇ : T j < t := by + refine lt_of_le_of_ne h₅ fun heq ↦ hN ?_ + rw [← heq] + exact (hposN j).1 + exact ⟨j, h₃, h₄, hAsub j ⟨t, ⟨h₇, h₆⟩, rfl⟩, h₇, h₆⟩ + refine ⟨⟨k, htwo, T, hT, hadd, cell, fun m ↦ ?_, fun m ↦ (hposN m).1, fun n hn ↦ ?_, hcell, + fun m ↦ ?_, htilde, hcell_ne, fun c hc hcΘ ↦ ?_⟩⟩ + · have h₁ : T (m + k + 1) = T (m + 1) + 2 * Real.pi := by + rw [show m + k + 1 = m + 1 + k by omega, hadd] + have h₂ : mid (m + k) = mid m + 2 * Real.pi := by + simp only [mid] + rw [h₁, hadd] + ring + change pathComponentIn _ (P (mid (m + k))) = pathComponentIn _ (P (mid m)) + rw [h₂] + exact congrArg _ (cuffPoint_add f _) + · obtain ⟨m, hm, hTm⟩ := hsurj _ (hmems hn) + exact ⟨m, hm, by rw [hTm]; exact hgf n hn⟩ + · refine subset_antisymm ?_ fun y hy ↦ ?_ + · rintro y ⟨hy, hyΘ⟩ + have hyN : y ∉ Γ.N := (pathComponentIn_subset hy).2 + obtain ⟨t, ht, rfl⟩ := exists_cuffPoint_eq f (T m) hyΘ + have ht₂ : t < T (m + k) := by + rw [hadd] + exact ht.2 + obtain ⟨j, h₁, h₂, h₃, h₄⟩ := hfind m (m + k) (by omega) t ht.1 ht₂ hyN + have heq : cell m = cell j := arcComponent_eq (hcell m) (hcell j) hy h₃ + have hjm : j = m := by + by_contra hc + exact hcell_ne m j (by omega) h₂ heq + subst hjm + exact ⟨t, h₄, rfl⟩ + · exact ⟨hAsub m hy, by obtain ⟨t, -, rfl⟩ := hy; exact cuffPoint_mem f t⟩ + · obtain ⟨y, hy, hyΘ⟩ := hcΘ + have hyN : y ∉ Γ.N := (hc.2.1 hy).2 + obtain ⟨t, ht, rfl⟩ := exists_cuffPoint_eq f (T 0) hyΘ + have ht₂ : t < T (0 + k) := by + rw [hadd] + exact ht.2 + obtain ⟨j, h₁, h₂, h₃, h₄⟩ := hfind 0 (0 + k) (by omega) t ht.1 ht₂ hyN + exact ⟨j, by omega, arcComponent_eq (hcell j) hc h₃ hy⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section9b.lean b/LeanPool/GraphMinor/GM20/Section9b.lean new file mode 100644 index 0000000000..bfc6e5514c --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section9b.lean @@ -0,0 +1,457 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section9a + +/-! +# Graph Minors XX, Section 9: a linear inflation around a cuff + +The proof of (9.1) uses that for each node `n` on a cuff `Θ`, the nodes of `ζ(n)` on `Θ` form an +interval of `Θ`, in the same cyclic order as the nodes of `Γ`. This file proves it. + +An arc of `Θ` determines the angle where it starts (`eq_of_immediatelyPrecedes`). Hence the third +condition of a linear inflation says that if `ζ(cell m) = cell' m'`, then `pos' m'` lies in `ζ(pos +m)` +and `pos' (m' + 1)` lies in `ζ(pos (m + 1))` (`image_cell`). We use the orientation of `Θ` given by +`f` or its reverse, according to which node of `cell m` is the tail. + +Assume `ζ` maps the last cell of one cycle to the last cell of the other. We walk around the cycle +of +`Γ'` and count the image cells passed so far, which gives a function `L = liftIdx` from the indices +of `Γ'` to the indices of `Γ`. Then `pos' m'` lies in `ζ(pos (L m'))` for each `m'` +(`IsLift.pos_mem`), and `L` goes once around (`IsLift.lift_last`). +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface + +variable {S : Type} [TopologicalSpace S] + +/-- The node `pos m` of a cycle. -/ +noncomputable def CuffCycle.pos {Γ : Painting S} {Θ : Set S} {f : Circle ≃ₜ Θ} (C : CuffCycle Γ f) + (m : ℕ) : S := + GM19.cuffPoint f (C.T m) + +/-- An arc of a cuff determines the point where it starts. -/ +theorem eq_of_immediatelyPrecedes {Θ : Set S} {f : Circle ≃ₜ Θ} {n : S} {a b : ℝ} (hab : a < b) + (hb : b ≤ a + 2 * Real.pi) (h : GM19.ImmediatelyPrecedes f n (GM19.cuffPoint f '' Ioo a b)) : + n = GM19.cuffPoint f a := by + obtain ⟨t₀, t₁, h₀, h₁, rfl, hA⟩ := h + by_contra hne + have hpi := Real.pi_pos + obtain ⟨r, hr, hre⟩ := exists_cuffPoint_eq f t₀ (cuffPoint_mem f a) + have hnot : GM19.cuffPoint f a ∉ GM19.cuffPoint f '' Ioo a b := by + rintro ⟨t, ht, hte⟩ + have := eq_of_exp_eq ((cuffPoint_eq_iff f).mp hte.symm) ht.1.le (by linarith [ht.2]) + exact absurd this ht.1.ne + have hrt : t₁ ≤ r := by + by_contra hc + have hr₀ : t₀ < r := lt_of_le_of_ne hr.1 fun heq ↦ hne (by rw [heq, hre]) + exact hnot (hA ▸ ⟨r, ⟨hr₀, not_le.mp hc⟩, hre⟩) + obtain ⟨ε, hε₀, hε₁, hε₂⟩ : ∃ ε : ℝ, 0 < ε ∧ ε < b - a ∧ ε < t₀ + 2 * Real.pi - r := + ⟨min (b - a) (t₀ + 2 * Real.pi - r) / 2, by + have h₃ : 0 < b - a := by linarith + have h₄ : 0 < t₀ + 2 * Real.pi - r := by linarith [hr.2] + constructor + · positivity + · constructor + · have := min_le_left (b - a) (t₀ + 2 * Real.pi - r) + have : 0 < min (b - a) (t₀ + 2 * Real.pi - r) := lt_min h₃ h₄ + linarith + · have := min_le_right (b - a) (t₀ + 2 * Real.pi - r) + have : 0 < min (b - a) (t₀ + 2 * Real.pi - r) := lt_min h₃ h₄ + linarith⟩ + have hmem : GM19.cuffPoint f (a + ε) ∈ GM19.cuffPoint f '' Ioo t₀ t₁ := + hA ▸ ⟨a + ε, ⟨by linarith, by linarith⟩, rfl⟩ + obtain ⟨u, hu, hue⟩ := hmem + have hexp : Circle.exp (a + ε) = Circle.exp (r + ε) := by + rw [Circle.exp_add, Circle.exp_add, (cuffPoint_eq_iff f).mp hre] + have hu' : Circle.exp u = Circle.exp (r + ε) := ((cuffPoint_eq_iff f).mp hue).trans hexp + have huIco : u ∈ Ico t₀ (t₀ + 2 * Real.pi) := ⟨hu.1.le, by linarith [hu.2]⟩ + have hrIco : r + ε ∈ Ico t₀ (t₀ + 2 * Real.pi) := ⟨by linarith [hr.1], by linarith⟩ + have heq : u = r + ε := Circle.exp_injOn_Ico (a := t₀) (b := t₀ + 2 * Real.pi) (by simp) + huIco hrIco hu' + linarith [hu.2] + +/-- The reverse parametrization of a cuff. -/ +noncomputable def revParam {Θ : Set S} (f : Circle ≃ₜ Θ) : Circle ≃ₜ Θ := + (Homeomorph.inv Circle).trans f + +theorem cuffPoint_revParam {Θ : Set S} (f : Circle ≃ₜ Θ) (t : ℝ) : + GM19.cuffPoint (revParam f) t = GM19.cuffPoint f (-t) := by + simp [GM19.cuffPoint, revParam, Circle.exp_neg] + +theorem image_revParam {Θ : Set S} (f : Circle ≃ₜ Θ) (a b : ℝ) : + GM19.cuffPoint (revParam f) '' Ioo (-b) (-a) = GM19.cuffPoint f '' Ioo a b := by + ext x + constructor + · rintro ⟨t, ht, rfl⟩ + exact ⟨-t, ⟨by linarith [ht.2], by linarith [ht.1]⟩, (cuffPoint_revParam f t).symm⟩ + · rintro ⟨t, ht, rfl⟩ + exact ⟨-t, ⟨by linarith [ht.2], by linarith [ht.1]⟩, by + rw [cuffPoint_revParam, neg_neg]⟩ + +section Cycle + +variable {Γ : Painting S} {Θ : Set S} {f : Circle ≃ₜ Θ} (C : CuffCycle Γ f) + +namespace CuffCycle + +theorem pos_add (m : ℕ) : C.pos (m + C.k) = C.pos m := by + simp only [pos, C.T_add] + exact cuffPoint_add f _ + +theorem pos_mod (m : ℕ) : C.pos (m % C.k) = C.pos m := by + have hm : m = m % C.k + (m / C.k) * C.k := by + rw [Nat.mul_comm] + exact (Nat.mod_add_div m C.k).symm + conv_rhs => rw [hm] + simp only [pos, T_add_mul C.T_add] + exact (cuffPoint_add_mul f _ _).symm + +theorem cell_mod (m : ℕ) : C.cell (m % C.k) = C.cell m := by + have key : ∀ a q, C.cell (a + q * C.k) = C.cell a := by + intro a q + induction q with + | zero => simp + | succ q ih => rw [Nat.succ_mul, ← Nat.add_assoc, C.cell_add, ih] + have hm : m = m % C.k + (m / C.k) * C.k := by + rw [Nat.mul_comm] + exact (Nat.mod_add_div m C.k).symm + conv_rhs => rw [hm] + exact (key _ _).symm + +theorem k_pos : 0 < C.k := by + have := C.two_le + omega + +theorem pos_ne {m m' : ℕ} (h₁ : m < m') (h₂ : m' < m + C.k) : C.pos m ≠ C.pos m' := by + intro heq + have h₃ : C.T m' < C.T m + 2 * Real.pi := by + rw [← C.T_add] + exact C.strictMono h₂ + exact (C.strictMono h₁).ne (eq_of_exp_eq ((cuffPoint_eq_iff f).mp heq) (C.strictMono h₁).le h₃) + +theorem mod_eq_of_pos_eq {a b : ℕ} (h : C.pos a = C.pos b) : a % C.k = b % C.k := by + have hk := C.k_pos + have h₁ : C.pos (a % C.k) = C.pos (b % C.k) := by rw [pos_mod, pos_mod, h] + have ha := Nat.mod_lt a hk + have hb := Nat.mod_lt b hk + rcases lt_trichotomy (a % C.k) (b % C.k) with h₂ | h₂ | h₂ + · exact absurd h₁ (C.pos_ne h₂ (by omega)) + · exact h₂ + · exact absurd h₁.symm (C.pos_ne h₂ (by omega)) + +theorem cell_eq_of_pos_eq {a b : ℕ} (h : C.pos a = C.pos b) : C.cell a = C.cell b := by + rw [← C.cell_mod a, ← C.cell_mod b, C.mod_eq_of_pos_eq h] + +theorem mem_N (m : ℕ) : C.pos m ∈ Γ.N := C.pos_mem m + +theorem mem_cuff (m : ℕ) : C.pos m ∈ Θ := cuffPoint_mem f _ + +theorem pos_ne_succ (m : ℕ) : C.pos m ≠ C.pos (m + 1) := + C.pos_ne (Nat.lt_succ_self m) (by have := C.two_le; omega) + +theorem meets (m : ℕ) : (C.cell m ∩ Θ).Nonempty := by + have hlt := C.strictMono (Nat.lt_succ_self m) + rw [C.cell_inter] + obtain ⟨t, ht⟩ := nonempty_Ioo.mpr hlt + exact ⟨_, t, ht, rfl⟩ + +theorem T_succ_le (m : ℕ) : C.T (m + 1) ≤ C.T m + 2 * Real.pi := by + rw [← C.T_add] + exact C.strictMono.monotone (by have := C.two_le; omega) + +theorem inOrder {m₁ m₂ m₃ m₄ : ℕ} (h₁ : m₁ ≤ m₂) (h₂ : m₂ ≤ m₃) (h₃ : m₃ ≤ m₄) (h₄ : m₄ + ≤ m₁ + C.k) : + GM19.InOrderOn Θ (C.pos m₁) (C.pos m₂) (C.pos m₃) (C.pos m₄) := + ⟨f, C.T m₁, C.T m₂, C.T m₃, C.T m₄, C.strictMono.monotone h₁, C.strictMono.monotone h₂, + C.strictMono.monotone h₃, by rw [← C.T_add]; exact C.strictMono.monotone h₄, rfl, rfl, rfl, rfl⟩ + +theorem precedes (m : ℕ) : GM19.ImmediatelyPrecedes f (C.pos m) (C.cell m ∩ Θ) := + ⟨C.T m, C.T (m + 1), C.strictMono (Nat.lt_succ_self m), C.T_succ_le m, rfl, C.cell_inter m⟩ + +theorem precedes_rev (m : ℕ) : + GM19.ImmediatelyPrecedes (revParam f) (C.pos (m + 1)) (C.cell m ∩ Θ) := by + refine ⟨-C.T (m + 1), -C.T m, ?_, ?_, ?_, ?_⟩ + · linarith [C.strictMono (Nat.lt_succ_self m)] + · linarith [C.T_succ_le m] + · rw [cuffPoint_revParam, neg_neg] + rfl + · rw [image_revParam] + exact C.cell_inter m + +/-- The march of the cell `cell m` is `pos m, pos (m + 1)`, or the reverse. -/ +theorem γ_eq (m : ℕ) : Γ.γ (C.cell m) = [C.pos m, C.pos (m + 1)] ∨ + Γ.γ (C.cell m) = [C.pos (m + 1), C.pos m] := by + have hset := Γ.γ_set _ (C.cell_mem m) + have hnd := Γ.γ_nodup _ (C.cell_mem m) + have hne := C.pos_ne_succ m + have ht : {n | n ∈ Γ.γ (C.cell m)} = {C.pos m, C.pos (m + 1)} := hset.trans (C.tilde_eq m) + have h₁ : C.pos m ∈ Γ.γ (C.cell m) := by + have : C.pos m ∈ {n | n ∈ Γ.γ (C.cell m)} := ht ▸ Or.inl rfl + exact this + have h₂ : C.pos (m + 1) ∈ Γ.γ (C.cell m) := by + have : C.pos (m + 1) ∈ {n | n ∈ Γ.γ (C.cell m)} := ht ▸ Or.inr rfl + exact this + have hsub : ∀ n ∈ Γ.γ (C.cell m), n = C.pos m ∨ n = C.pos (m + 1) := fun n hn ↦ by + have : n ∈ {n | n ∈ Γ.γ (C.cell m)} := hn + rw [ht] at this + exact this + generalize Γ.γ (C.cell m) = l at * + match l, hnd, h₁, h₂, hsub with + | [], _, h₁, _, _ => simp at h₁ + | [x], _, h₁, h₂, _ => + simp only [List.mem_singleton] at h₁ h₂ + exact absurd (h₁.trans h₂.symm) hne + | [x, y], hnd, h₁, h₂, _ => + simp only [List.mem_cons, List.not_mem_nil, or_false] at h₁ h₂ + rcases h₁ with h₁ | h₁ <;> rcases h₂ with h₂ | h₂ + · exact absurd (h₁.trans h₂.symm) hne + · exact Or.inl (by rw [h₁, h₂]) + · exact Or.inr (by rw [h₁, h₂]) + · exact absurd (h₁.trans h₂.symm) hne + | x :: y :: z :: l, hnd, _, _, hsub => + exfalso + have hxy := (List.nodup_cons.mp hnd).1 + have hyz := (List.nodup_cons.mp (List.nodup_cons.mp hnd).2).1 + simp only [List.mem_cons, not_or] at hxy hyz + have hx := hsub x (by simp) + have hy := hsub y (by simp) + have hz := hsub z (by simp) + rcases hx with hx | hx <;> rcases hy with hy | hy <;> rcases hz with hz | hz <;> + first + | exact hxy.1 (hx.trans hy.symm) + | exact hxy.2.1 (hx.trans hz.symm) + | exact hyz.1 (hy.trans hz.symm) + +end CuffCycle + +end Cycle + +section Inflation + +variable {Γ Γ' : Painting S} {ζn : S → Set S} {ζc : Set S → Set S} {Θ : Set S} {f : Circle ≃ₜ Θ} + (hζ : IsLinearInflation Γ Γ' ζn ζc) (hΘ : Θ ∈ cuffs S) (C : CuffCycle Γ f) (C' : CuffCycle Γ' f) + +include hζ hΘ in +/-- If `ζ(cell m) = cell' m'`, the nodes `pos' m'` and `pos' (m' + 1)` lie in `ζ(pos m)` and +`ζ(pos (m + 1))`. -/ +theorem image_cell {m m' : ℕ} (h : ζc (C.cell m) = C'.cell m') : + C'.pos m' ∈ ζn (C.pos m) ∧ C'.pos (m' + 1) ∈ ζn (C.pos (m + 1)) := by + have hc := C.cell_mem m + have hne := C.pos_ne_succ m + have hne' := C'.pos_ne_succ m' + have hstart : ∀ {g : Circle ≃ₜ Θ} {n n' : S}, (Γ.γ (C.cell m)).head? = some n → + (Γ'.γ (C'.cell m')).head? = some n' → GM19.ImmediatelyPrecedes g n (C.cell m ∩ Θ) → + GM19.ImmediatelyPrecedes g n' (C'.cell m' ∩ Θ) := by + intro g n n' h₁ h₂ h₃ + have := hζ.orientation _ hc Θ hΘ (C.meets m) g n n' h₁ (h ▸ h₂) h₃ + rwa [h] at this + have hnodes : ∀ (a b a' b' : S), Γ.γ (C.cell m) = [a, b] → Γ'.γ (C'.cell m') = [a', b'] → + a ∈ Γ.N → b ∈ Γ.N → a' ∈ ζn a ∧ b' ∈ ζn b := by + intro a b a' b' h₁ h₂ ha hb + have h₃ := hζ.nodes a ha _ hc 0 (by rw [h₁]; simp) (by rw [h, h₂]; simp) + have h₄ := hζ.nodes b hb _ hc 1 (by rw [h₁]; simp) (by rw [h, h₂]; simp) + simp only [h, h₁, h₂] at h₃ h₄ + exact ⟨h₃.mp (by simp), h₄.mp (by simp)⟩ + have hN := C.mem_N m + have hN' := C.mem_N (m + 1) + rcases C.γ_eq m with h₁ | h₁ + · rcases C'.γ_eq m' with h₂ | h₂ + · exact hnodes _ _ _ _ h₁ h₂ hN hN' + · have h₃ := hstart (n := C.pos m) (n' := C'.pos (m' + 1)) (g := f) (by rw [h₁]; rfl) + (by rw [h₂]; rfl) (C.precedes m) + rw [C'.cell_inter] at h₃ + exact absurd (eq_of_immediatelyPrecedes (C'.strictMono (Nat.lt_succ_self m')) + (C'.T_succ_le m') h₃).symm hne' + · have hlt := C'.strictMono (Nat.lt_succ_self m') + have hrev : C'.cell m' ∩ Θ = + GM19.cuffPoint (revParam f) '' Ioo (-C'.T (m' + 1)) (-C'.T m') := by + rw [image_revParam] + exact C'.cell_inter m' + rcases C'.γ_eq m' with h₂ | h₂ + · have h₃ := hstart (n := C.pos (m + 1)) (n' := C'.pos m') (g := revParam f) + (by rw [h₁]; rfl) (by rw [h₂]; rfl) (C.precedes_rev m) + rw [hrev] at h₃ + have h₄ := eq_of_immediatelyPrecedes (by linarith) (by linarith [C'.T_succ_le m']) h₃ + rw [cuffPoint_revParam, neg_neg] at h₄ + exact absurd h₄ hne' + · obtain ⟨h₃, h₄⟩ := hnodes _ _ _ _ h₁ h₂ hN' hN + exact ⟨h₄, h₃⟩ + +open Classical in +/-- The number of image cells among the first `m` cells of the cycle of `Γ'`. -/ +noncomputable def liftIdx (Γ : Painting S) (ζc : Set S → Set S) (C' : CuffCycle Γ' f) : ℕ → ℕ + | 0 => 0 + | m + 1 => if C'.cell m ∈ ζc '' Γ.C then liftIdx Γ ζc C' m + 1 else liftIdx Γ ζc C' m + +include hζ in +/-- Two nodes in one `ζ(n)` are over the same node. -/ +theorem pos_eq_of_mem {m₁ m₂ : ℕ} {n' : S} (h₁ : n' ∈ ζn (C.pos m₁)) (h₂ : n' ∈ ζn (C.pos m₂)) : + C.pos m₁ = C.pos m₂ := by + by_contra hne + exact Set.disjoint_left.mp (hζ.node_disjoint _ (C.mem_N m₁) _ (C.mem_N m₂) hne) h₁ h₂ + +theorem CuffCycle.pos_succ_eq_of_pos_eq {Γ : Painting S} {f : Circle ≃ₜ Θ} (C : CuffCycle Γ f) + {a b : ℕ} (h : C.pos a = C.pos b) : C.pos (a + 1) = C.pos (b + 1) := by + have h₁ := C.mod_eq_of_pos_eq h + rw [← C.pos_mod (a + 1), ← C.pos_mod (b + 1), Nat.add_mod, h₁, ← Nat.add_mod] + +include hΘ in +theorem cuff_subset_bd : Θ ⊆ bd S := by + obtain ⟨p, hp, rfl⟩ := hΘ + exact connectedComponentIn_subset _ _ + +include hζ hΘ in +/-- A cell of the cycle of `Γ'` that lies in the image of `ζ` is the image of a cell of the cycle of +`Γ`. -/ +theorem exists_cell_of_image {m' : ℕ} (h : C'.cell m' ∈ ζc '' Γ.C) : + ∃ l < C.k, ζc (C.cell l) = C'.cell m' := by + obtain ⟨c, hc, hcz⟩ := h + obtain ⟨l, hl, rfl⟩ := C.exists_cell c hc + ((hζ.borders_iff c hc Θ hΘ).mpr (by rw [hcz]; exact C'.meets m')) + exact ⟨l, hl, hcz⟩ + +include hζ hΘ in +/-- The walk around the cycle of `Γ'`, for an inflation that maps the last cell of the cycle of `Γ` +to +the last cell of the cycle of `Γ'`. -/ +theorem exists_lift (hcut : ζc (C.cell (C.k - 1)) = C'.cell (C'.k - 1)) : + ∃ L : ℕ → ℕ, L 0 = 0 ∧ Monotone L ∧ (∀ m', C'.pos m' ∈ ζn (C.pos (L m'))) ∧ + (∀ m', (L (m' + 1) = L m' ∧ C'.cell m' ∉ ζc '' Γ.C) ∨ + (L (m' + 1) = L m' + 1 ∧ ζc (C.cell (L m')) = C'.cell m')) ∧ + (∀ m' < C'.k, L m' < C.k) ∧ (∀ l < C.k, ∃ m' < C'.k, L m' = l) := by + classical + have hk := C.two_le + have hk' := C'.two_le + let L := liftIdx Γ ζc C' + have hsucc : ∀ m, L (m + 1) = if C'.cell m ∈ ζc '' Γ.C then L m + 1 else L m := fun _ ↦ rfl + have hbase : C'.pos 0 ∈ ζn (C.pos 0) := by + have h₁ := (image_cell hζ hΘ C C' hcut).2 + rw [show C'.k - 1 + 1 = 0 + C'.k by omega, show C.k - 1 + 1 = 0 + C.k by omega, C'.pos_add, + C.pos_add] at h₁ + exact h₁ + have hstep : ∀ m', C'.pos m' ∈ ζn (C.pos (L m')) → C'.cell m' ∈ ζc '' Γ.C → + ζc (C.cell (L m')) = C'.cell m' ∧ C'.pos (m' + 1) ∈ ζn (C.pos (L m' + 1)) := by + intro m' h₁ h₂ + obtain ⟨l, -, hl⟩ := exists_cell_of_image hζ hΘ C C' h₂ + obtain ⟨h₃, h₄⟩ := image_cell hζ hΘ C C' hl + have heq := pos_eq_of_mem hζ C h₃ h₁ + exact ⟨by rw [← hl, C.cell_eq_of_pos_eq heq], C.pos_succ_eq_of_pos_eq heq ▸ h₄⟩ + have hpos : ∀ m', C'.pos m' ∈ ζn (C.pos (L m')) := by + intro m' + induction m' with + | zero => exact hbase + | succ m' ih => + rw [hsucc] + split_ifs with himg + · exact (hstep m' ih himg).2 + · obtain ⟨y, hy, hyΘ⟩ := C'.meets m' + obtain ⟨n, hn, hsub⟩ := hζ.border_cell _ (C'.cell_mem m') ⟨y, hy, cuff_subset_bd hΘ hyΘ⟩ + himg + have h₁ : C'.pos m' ∈ tilde (C'.cell m') := by + rw [C'.tilde_eq] + exact Or.inl rfl + have h₂ : C'.pos (m' + 1) ∈ tilde (C'.cell m') := by + rw [C'.tilde_eq] + exact Or.inr rfl + have heq : n = C.pos (L m') := by + by_contra hne + exact Set.disjoint_left.mp (hζ.node_disjoint _ hn _ (C.mem_N _) hne) (hsub h₁) ih + exact heq ▸ hsub h₂ + have hmono : Monotone L := monotone_nat_of_le_succ fun m ↦ by + rw [hsucc] + split_ifs <;> omega + have hcard : ∀ n, L n = ((Finset.range n).filter fun m ↦ C'.cell m ∈ ζc '' Γ.C).card := by + intro n + induction n with + | zero => rfl + | succ n ih => + rw [hsucc, Finset.range_add_one, Finset.filter_insert] + split_ifs with himg + · rw [Finset.card_insert_of_notMem (by simp), ih] + · exact ih + have hle : L C'.k ≤ C.k := by + rw [hcard] + refine (Finset.card_le_card_of_injOn (fun m ↦ L m % C.k) (fun m _ ↦ ?_) ?_).trans_eq + (Finset.card_range C.k) + · exact Finset.mem_coe.mpr (Finset.mem_range.mpr (Nat.mod_lt _ C.k_pos)) + · intro a ha b hb hab + obtain ⟨ha₁, ha₂⟩ := Finset.mem_filter.mp (Finset.mem_coe.mp ha) + obtain ⟨hb₁, hb₂⟩ := Finset.mem_filter.mp (Finset.mem_coe.mp hb) + have ha₃ := Finset.mem_range.mp ha₁ + have hb₃ := Finset.mem_range.mp hb₁ + have h₁ := (hstep a (hpos a) ha₂).1 + have h₂ := (hstep b (hpos b) hb₂).1 + have h₃ : C'.cell a = C'.cell b := by + rw [← h₁, ← h₂, ← C.cell_mod (L a), ← C.cell_mod (L b)] + exact congrArg (fun i ↦ ζc (C.cell i)) hab + rcases lt_trichotomy a b with h₄ | h₄ | h₄ + · exact absurd h₃ (C'.cell_ne a b h₄ (by omega)) + · exact h₄ + · exact absurd h₃.symm (C'.cell_ne b a h₄ (by omega)) + have hcutimg : C'.cell (C'.k - 1) ∈ ζc '' Γ.C := ⟨_, C.cell_mem _, hcut⟩ + have hlast : L C'.k = L (C'.k - 1) + 1 := by + conv_lhs => rw [show C'.k = C'.k - 1 + 1 by omega] + rw [hsucc, ite_eq_left hcutimg] + have hfull : L C'.k = C.k := by + have h₁ : C.pos (L C'.k) = C.pos 0 := by + have h₂ := hpos C'.k + have h₃ : C'.pos C'.k = C'.pos 0 := by + have := C'.pos_add 0 + rwa [Nat.zero_add] at this + rw [h₃] at h₂ + exact pos_eq_of_mem hζ C h₂ hbase + have h₂ := C.mod_eq_of_pos_eq h₁ + rw [Nat.zero_mod] at h₂ + obtain ⟨q, hq⟩ := Nat.dvd_of_mod_eq_zero h₂ + rcases q with _ | q + · omega + · have : C.k * (q + 1) = C.k * q + C.k := by ring + have h₄ : 0 ≤ C.k * q := Nat.zero_le _ + have : q = 0 := by + by_contra hq0 + have : C.k * 1 ≤ C.k * q := Nat.mul_le_mul_left _ (by omega) + omega + subst this + omega + have hreach : ∀ n l, l ≤ L n → ∃ m' ≤ n, L m' = l := by + intro n l + induction n with + | zero => exact fun h ↦ ⟨0, le_rfl, by have : L 0 = 0 := rfl; omega⟩ + | succ n ih => + intro h + by_cases h₁ : l ≤ L n + · obtain ⟨m', h₂, h₃⟩ := ih h₁ + exact ⟨m', by omega, h₃⟩ + · have h₂ : L (n + 1) ≤ L n + 1 := by + rw [hsucc] + split_ifs <;> omega + exact ⟨n + 1, le_rfl, by omega⟩ + refine ⟨L, rfl, hmono, hpos, fun m' ↦ ?_, fun m' hm' ↦ ?_, fun l hl ↦ ?_⟩ + · by_cases himg : C'.cell m' ∈ ζc '' Γ.C + · exact Or.inr ⟨by rw [hsucc, ite_eq_left himg], (hstep m' (hpos m') himg).1⟩ + · exact Or.inl ⟨by rw [hsucc, ite_eq_right himg], himg⟩ + · have := hmono (show m' ≤ C'.k - 1 by omega) + omega + · obtain ⟨m', h₁, h₂⟩ := hreach C'.k l (by omega) + refine ⟨m', ?_, h₂⟩ + rcases h₁.eq_or_lt with h₃ | h₃ + · subst h₃ + omega + · exact h₃ + +end Inflation + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section9c.lean b/LeanPool/GraphMinor/GM20/Section9c.lean new file mode 100644 index 0000000000..a0a1f54a50 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section9c.lean @@ -0,0 +1,427 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section9b + +/-! +# Graph Minors XX, Section 9: the marches of a hull + +This file carries out the first step of the proof of (9.1). In a `(Σ, ρ)`-hulled patchwork, every +border cell `c` with nodes `n₁, n₂` has a pairing `M_c`. Away from the two nodes, `M_c` matches +`β(n₁)` +with `β(n₂)`. So after we order `β(pos 0)` for a cuff `Θ`, we can order `β(pos 1)`, `β(pos 2)`, … in +turn, +such that the `i`th terms of `β(pos m)` and `β(pos (m + 1))` belong to the same component of the +pairing (`exists_cuffLabels`). This can fail only for the last cell, which joins `pos (k - 1)` to +`pos 0`, and this is the cell `c_Θ` of the paper. + +`Side` collects all this data for a patchwork. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface GraphMinor.GM04 GraphMinor.GM18 GraphMinor.GM10 Hypergraph + +universe u v + +variable {α : Type u} {β : Type v} + +/-- `x` and `y` lie in the same component of a pairing. -/ +def Linked (M : (⊤ : SimpleGraph α).Subgraph) (x y : α) : Prop := x = y ∨ M.Adj x y + +theorem Linked.symm {M : (⊤ : SimpleGraph α).Subgraph} {x y : α} (h : Linked M x y) : Linked M y x + := + h.elim (fun h ↦ Or.inl h.symm) fun h ↦ Or.inr h.symm + +section Pairing + +variable {X : GradedSurface} {Γ : Painting X.S} {G : Hypergraph α β} {h : Hull Γ G} {n₁ n₂ : X.S} + {M : (⊤ : SimpleGraph α).Subgraph} + +/-- The relation of a pairing does not depend on the order of the two nodes. -/ +theorem IsCellPairing.symm (hM : IsCellPairing h n₁ n₂ M) : IsCellPairing h n₂ n₁ M where + isPairing := hM.isPairing + verts_eq := by + rw [hM.verts_eq, Set.union_comm (h.border n₁), Set.pair_comm] + adj := hM.adj.symm + components D hD := (hM.components D hD).symm + +theorem isPairing_verts_finite (hfin : (h.border n₁).Finite) (hfin' : (h.border n₂).Finite) + (hM : IsCellPairing h n₁ n₂ M) : M.verts.Finite := by + rw [hM.verts_eq] + exact (hfin.union hfin').union (Set.toFinite _) + +/-- In a pairing, the component of `x` is `x` and its neighbour. -/ +theorem mem_component_iff (hfin : M.verts.Finite) (hp : IsPairing M.verts M) (x : M.verts) (y : α) : + y ∈ (component M x).verts ↔ y ∈ M.verts ∧ Linked M x.1 y := by + have huniq := ((isPairing_iff hfin).mp hp).2 + constructor + · rintro ⟨hy, hr⟩ + refine ⟨hy, ?_⟩ + have key : ∀ b : M.verts, M.coe.Reachable x b → Linked M x.1 b.1 := by + intro b hb + rw [SimpleGraph.reachable_iff_reflTransGen] at hb + induction hb with + | refl => exact Or.inl rfl + | @tail z w _ hzw ih => + rcases ih with hzx | hxz + · right + rw [hzx] + exact hzw + · left + exact huniq z.1 x.1 w.1 hxz.symm hzw + exact key ⟨y, hy⟩ hr + · rintro ⟨hy, hl⟩ + refine ⟨hy, ?_⟩ + rcases hl with heq | hadj + · subst heq + exact SimpleGraph.Reachable.refl _ + · exact SimpleGraph.Adj.reachable (show M.coe.Adj x ⟨y, hy⟩ from hadj) + +/-- Every vertex of the pairing is linked to exactly one vertex of `β(n₂) ∪ {n₂}`. -/ +theorem IsCellPairing.existsUnique (hM : IsCellPairing h n₁ n₂ M) (hfin : M.verts.Finite) {x : α} + (hx : x ∈ M.verts) : ∃ y, y ∈ h.border n₂ ∪ {h.node n₂} ∧ Linked M x y ∧ + ∀ y' ∈ h.border n₂ ∪ {h.node n₂}, Linked M x y' → y' = y := by + have hp : IsPairing M.verts M := hM.isPairing + have hD : IsComponent M (component M ⟨x, hx⟩) := ⟨_, rfl⟩ + obtain ⟨y, hy⟩ := Set.ncard_eq_one.mp (hM.components _ hD).2 + have hmem : y ∈ (component M ⟨x, hx⟩).verts ∩ (h.border n₂ ∪ {h.node n₂}) := by + rw [hy] + exact rfl + refine ⟨y, hmem.2, ((mem_component_iff hfin hp _ _).mp hmem.1).2, fun y' hy' hl ↦ ?_⟩ + have hv : y' ∈ M.verts := by + rcases hl with heq | hadj + · exact heq ▸ hx + · exact M.edge_vert hadj.symm + have : y' ∈ (component M ⟨x, hx⟩).verts ∩ (h.border n₂ ∪ {h.node n₂}) := + ⟨(mem_component_iff hfin hp _ _).mpr ⟨hv, hl⟩, hy'⟩ + rw [hy] at this + exact this + +open Classical in +/-- The vertex of `B` linked to `x`. -/ +noncomputable def partner (M : (⊤ : SimpleGraph α).Subgraph) (B : Set α) (x : α) : α := + if h : ∃ y ∈ B, Linked M x y then h.choose else x + +theorem partner_spec {B : Set α} {x : α} (hx : ∃ y ∈ B, Linked M x y) : + partner M B x ∈ B ∧ Linked M x (partner M B x) := by + classical + simp only [partner, dite_eq_left hx] + exact hx.choose_spec + +/-- If `x ∈ β(n₁)`, the vertex linked to `x` is not `n₂`, since `n₂` is linked to `n₁`. -/ +theorem IsCellPairing.linked_ne (hM : IsCellPairing h n₁ n₂ M) (hfin : M.verts.Finite) {x : α} + (hx : x ∈ h.border n₁) (hn : h.node n₁ ∉ h.border n₁) (hl : Linked M x (h.node n₂)) : False + := by + have hv : h.node n₂ ∈ M.verts := M.edge_vert hM.adj.symm + obtain ⟨y, -, -, hu⟩ := hM.symm.existsUnique hfin hv + have h₁ := hu x (Or.inl hx) hl.symm + have h₂ := hu (h.node n₁) (Or.inr rfl) (Or.inr hM.adj.symm) + exact hn (h₂.trans h₁.symm ▸ hx) + +/-- `M` maps `β(n₁)` onto `β(n₂)`. -/ +theorem IsCellPairing.partner_mapsTo (hM : IsCellPairing h n₁ n₂ M) (hfin : M.verts.Finite) + (hn : h.node n₁ ∉ h.border n₁) {x : α} (hx : x ∈ h.border n₁) : + partner M (h.border n₂ ∪ {h.node n₂}) x ∈ h.border n₂ ∧ + Linked M x (partner M (h.border n₂ ∪ {h.node n₂}) x) := by + have hv : x ∈ M.verts := by + rw [hM.verts_eq] + exact Or.inl (Or.inl hx) + obtain ⟨y, hy, hl, -⟩ := hM.existsUnique hfin hv + obtain ⟨h₁, h₂⟩ := partner_spec (M := M) ⟨y, hy, hl⟩ + refine ⟨h₁.resolve_right fun h₃ ↦ ?_, h₂⟩ + rw [Set.mem_singleton_iff] at h₃ + exact hM.linked_ne hfin hx hn (h₃ ▸ h₂) + +theorem IsCellPairing.partner_injOn (hM : IsCellPairing h n₁ n₂ M) (hfin : M.verts.Finite) + (hn : h.node n₁ ∉ h.border n₁) : + InjOn (partner M (h.border n₂ ∪ {h.node n₂})) (h.border n₁) := by + intro x hx x' hx' heq + have h₁ := (hM.partner_mapsTo hfin hn hx) + have h₂ := (hM.partner_mapsTo hfin hn hx') + rw [← heq] at h₂ + have hv : partner M (h.border n₂ ∪ {h.node n₂}) x ∈ M.verts := by + rw [hM.verts_eq] + exact Or.inl (Or.inr h₁.1) + obtain ⟨y, -, -, hu⟩ := hM.symm.existsUnique hfin hv + rw [hu x (Or.inl hx) h₁.2.symm, hu x' (Or.inl hx') h₂.2.symm] + +theorem IsCellPairing.partner_surjOn (hM : IsCellPairing h n₁ n₂ M) (hfin : M.verts.Finite) + (hn₂ : h.node n₂ ∉ h.border n₂) {y : α} (hy : y ∈ h.border n₂) : + ∃ x ∈ h.border n₁, partner M (h.border n₂ ∪ {h.node n₂}) x = y := by + have hv : y ∈ M.verts := by + rw [hM.verts_eq] + exact Or.inl (Or.inr hy) + obtain ⟨x, hx, hl, -⟩ := hM.symm.existsUnique hfin hv + have hx' : x ∈ h.border n₁ := hx.resolve_right fun h₃ ↦ by + rw [Set.mem_singleton_iff] at h₃ + exact hM.symm.linked_ne hfin hy hn₂ (h₃ ▸ hl) + refine ⟨x, hx', ?_⟩ + have hvx : x ∈ M.verts := by + rw [hM.verts_eq] + exact Or.inl (Or.inl hx') + obtain ⟨z, -, -, hu⟩ := hM.existsUnique hfin hvx + obtain ⟨h₁, h₂⟩ := partner_spec (M := M) (x := x) (B := h.border n₂ ∪ {h.node n₂}) + ⟨y, Or.inl hy, hl.symm⟩ + rw [hu _ h₁ h₂, hu y (Or.inl hy) hl.symm] + +end Pairing + +/-- The ordering of the sets `β(n)` around a cuff, as in the proof of (9.1). -/ +structure IsLabelled {X : GradedSurface} {Γ : Painting X.S} {G : Hypergraph α β} (h : Hull Γ G) + {Θ : Set X.S} {f : Circle ≃ₜ Θ} (C : CuffCycle Γ f) (ρ : ℕ) (π : X.S → List α) + (M : Set X.S → (⊤ : SimpleGraph α).Subgraph) : Prop where + nodup : ∀ m, (π (C.pos m)).Nodup + set_eq : ∀ m, {x | x ∈ π (C.pos m)} = h.border (C.pos m) + length_eq : ∀ m, (π (C.pos m)).length = ρ + pair : ∀ m, IsCellPairing h (C.pos m) (C.pos (m + 1)) (M (C.cell m)) + link : ∀ m, m + 1 < C.k → ∀ (i : ℕ) (x y : α), (π (C.pos m))[i]? = some x → (π (C.pos + (m + 1)))[i]? = some y → + Linked (M (C.cell m)) x y + +section Labels + +variable {X : GradedSurface} {Γ : Painting X.S} {G : Hypergraph α β} (h : Hull Γ G) + {Θ : Set X.S} {f : Circle ≃ₜ Θ} (C : CuffCycle Γ f) + +/-- The march of `β(pos m)`, for the march `l` of `β(pos 0)`. -/ +noncomputable def labelSeq (M : Set X.S → (⊤ : SimpleGraph α).Subgraph) (l : List α) : ℕ → List α + | 0 => l + | m + 1 => (labelSeq M l m).map + (partner (M (C.cell m)) (h.border (C.pos (m + 1)) ∪ {h.node (C.pos (m + 1))})) + +/-- The orderings around one cuff exist, as a sequence of marches. -/ +theorem exists_cuffLabels {ρ : ℕ} (M : Set X.S → (⊤ : SimpleGraph α).Subgraph) + (hfin : ∀ m, (h.border (C.pos m)).Finite) (hcard : ∀ m, (h.border (C.pos m)).ncard = ρ) + (hn : ∀ m, h.node (C.pos m) ∉ h.border (C.pos m)) + (hpair : ∀ m, IsCellPairing h (C.pos m) (C.pos (m + 1)) (M (C.cell m))) : + ∃ s : ℕ → List α, (∀ m, (s m).Nodup) ∧ (∀ m, {x | x ∈ s m} = h.border (C.pos m)) ∧ + (∀ m, (s m).length = ρ) ∧ ∀ m (i : ℕ) (x y : α), (s m)[i]? = some x → (s (m + 1))[i]? + = some y → + Linked (M (C.cell m)) x y := by + classical + let l := (hfin 0).toFinset.toList + have hl₀ : {x | x ∈ l} = h.border (C.pos 0) := by + ext x + simp [l] + have hfinM : ∀ m, (M (C.cell m)).verts.Finite := fun m ↦ + isPairing_verts_finite (hfin _) (hfin _) (hpair m) + have hset : ∀ m, {x | x ∈ labelSeq h C M l m} = h.border (C.pos m) := by + intro m + induction m with + | zero => exact hl₀ + | succ m ih => + ext y + simp only [labelSeq, mem_ofPred_eq, List.mem_map] + constructor + · rintro ⟨x, hx, rfl⟩ + have hx' : x ∈ h.border (C.pos m) := ih ▸ hx + exact ((hpair m).partner_mapsTo (hfinM m) (hn m) hx').1 + · intro hy + obtain ⟨x, hx, hxy⟩ := (hpair m).partner_surjOn (hfinM m) (hn _) hy + have hx' : x ∈ {x | x ∈ labelSeq h C M l m} := ih ▸ hx + exact ⟨x, hx', hxy⟩ + have hnd : ∀ m, (labelSeq h C M l m).Nodup := by + intro m + induction m with + | zero => exact Finset.nodup_toList _ + | succ m ih => + refine ih.map_on fun x hx y hy heq ↦ ?_ + have hx' : x ∈ h.border (C.pos m) := hset m ▸ hx + have hy' : y ∈ h.border (C.pos m) := hset m ▸ hy + exact (hpair m).partner_injOn (hfinM m) (hn m) hx' hy' heq + have hlen : ∀ m, (labelSeq h C M l m).length = ρ := by + intro m + have h₁ : {x | x ∈ labelSeq h C M l m} = ↑(labelSeq h C M l m).toFinset := by + ext x + simp + rw [← hcard m, ← hset m, h₁, Set.ncard_coe_finset, List.toFinset_card_of_nodup (hnd m)] + refine ⟨labelSeq h C M l, hnd, hset, hlen, fun m i x y hx hy ↦ ?_⟩ + simp only [labelSeq, List.getElem?_map, hx, Option.map_some, Option.some.injEq] at hy + have hxm : x ∈ h.border (C.pos m) := by + have : x ∈ labelSeq h C M l m := List.mem_of_getElem? hx + exact hset m ▸ this + rw [← hy] + exact ((hpair m).partner_mapsTo (hfinM m) (hn m) hxm).2 + +end Labels + +/-- A hull for `G` is also a hull for an equal hypergraph. -/ +def Hull.transfer {X : GradedSurface} {Γ : Painting X.S} {G G' : Hypergraph α β} (h : Hull Γ G) + (e : G = G') : Hull Γ G' where + node := h.node + cell := h.cell + border := h.border + node_injOn := h.node_injOn + node_mem := by subst e; exact h.node_mem + cell_bijOn := by subst e; exact h.cell_bijOn + inc_iff := by subst e; exact h.inc_iff + border_subset := by subst e; exact h.border_subset + border_disjoint := h.border_disjoint + border_ncard := h.border_ncard + border_cuffs := h.border_cuffs + vertexSet_eq := by subst e; exact h.vertexSet_eq + ends_internal := by subst e; exact h.ends_internal + ends_border := by subst e; exact h.ends_border + border_order := h.border_order + +/-- A cuff of `Σ`, with a parametrization for each one. All the patchworks of the proof of (9.1) use +the same parametrizations. -/ +abbrev CuffParam (S : Type) [TopologicalSpace S] := ∀ Θ ∈ cuffs S, Circle ≃ₜ Θ + +/-- All that the proof of (9.1) uses about a patchwork `Q` that is an `Ω`-completion of a hulled +patchwork, with the choices of the proof. -/ +structure Side {Ω : Type*} (X : GradedSurface) (F : CuffParam X.S) (Q : Patchwork Ω α β) where + /-- The painting. -/ + Γ : Painting X.S + /-- The hull. -/ + h : Hull Γ Q.G.toHypergraph + /-- The pairings `M_c`. -/ + M : Set X.S → (⊤ : SimpleGraph α).Subgraph + /-- The marches `π(n)`. -/ + π : X.S → List α + /-- The cycles of nodes and cells around the cuffs. -/ + C : ∀ Θ (hΘ : Θ ∈ cuffs X.S), CuffCycle Γ (F Θ hΘ) + three_connected : Γ.IsThreeConnected + free_internal : ∀ c ∈ Γ.C, ¬ Painting.IsBorder c → (Q.Δ (h.cell c)).IsFree + M_mem : ∀ c ∈ Γ.C, Painting.IsBorder c → ∀ n₁ n₂, Γ.γ c = [n₁, n₂] → (M c ∈ Q.Δ (h.cell c) ∨ + ((M c).deleteEdges {s(h.node n₁, h.node n₂)} ∈ Q.Δ (h.cell c) ∧ + ∃ c' ∈ Γ.C, ¬ Painting.IsBorder c' ∧ n₁ ∈ tilde c' ∧ n₂ ∈ tilde c')) + roots_nil : Q.G.roots = [] + dom_eq : Q.dom = Q.G.edgeSet + μ_internal : ∀ c ∈ Γ.C, ¬ Painting.IsBorder c → Q.μ (h.cell c) = (Γ.γ c).map h.node + labelled : ∀ Θ (hΘ : Θ ∈ cuffs X.S), IsLabelled h (C Θ hΘ) (X.ρ Θ) π M + +theorem cuff_eq_of_mem {S : Type} [TopologicalSpace S] {Θ₁ Θ₂ : Set S} (h₁ : Θ₁ ∈ cuffs S) + (h₂ : Θ₂ ∈ cuffs S) {x : S} (hx₁ : x ∈ Θ₁) (hx₂ : x ∈ Θ₂) : Θ₁ = Θ₂ := by + obtain ⟨p, hp, rfl⟩ := h₁ + obtain ⟨q, hq, rfl⟩ := h₂ + rw [connectedComponentIn_eq hx₁, connectedComponentIn_eq hx₂] + +/-- Each completion of a hulled patchwork has the data of `Side`. -/ +theorem exists_side {Ω : Type*} (X : GradedSurface) (F : CuffParam X.S) {P : UnlabeledPatchwork α β} + {Q : Patchwork Ω α β} (hP : IsHulled X P) (hQ : IsCompletionOf P Q) : Nonempty (Side X F Q) + := by + classical + obtain ⟨Γ, h, hb⟩ := hP + have hG : P.G.toHypergraph = Q.G.toHypergraph := by rw [hQ.G_eq] + have hEe : ∀ e ∈ Q.G.edgeSet, e ∈ P.G.edgeSet := fun e he ↦ by + rw [hQ.G_eq] at he + exact he + let h' : Hull Γ Q.G.toHypergraph := h.transfer hG + have hcell : ∀ c ∈ Γ.C, h'.cell c ∈ Q.G.edgeSet := fun c hc ↦ h'.cell_bijOn.mapsTo hc + have hΔ : ∀ c ∈ Γ.C, Q.Δ (h.cell c) = P.Δ (h.cell c) := fun c hc ↦ + hQ.Δ_eq (hEe _ (hcell c hc)) + have hpm : ∀ {n₁ n₂ M}, IsCellPairing h n₁ n₂ M → IsCellPairing h' n₁ n₂ M := fun hM ↦ + ⟨hM.isPairing, hM.verts_eq, hM.adj, hM.components⟩ + obtain ⟨C⟩ : Nonempty (∀ Θ (hΘ : Θ ∈ cuffs X.S), CuffCycle Γ (F Θ hΘ)) := + ⟨fun Θ hΘ ↦ (exists_cuffCycle Γ hΘ (F Θ hΘ)).some⟩ + have hbΘ : ∀ {Θ}, Θ ∈ cuffs X.S → Θ ⊆ bd X.S := fun hΘ ↦ cuff_subset_bd hΘ + have hborder : ∀ {Θ} (hΘ : Θ ∈ cuffs X.S) m, Painting.IsBorder ((C Θ hΘ).cell m) := by + intro Θ hΘ m + obtain ⟨y, hy, hyΘ⟩ := (C Θ hΘ).meets m + exact ⟨y, hy, hbΘ hΘ hyΘ⟩ + let R : Set X.S → (⊤ : SimpleGraph α).Subgraph → Prop := fun c M ↦ + ∀ n₁ n₂, Γ.γ c = [n₁, n₂] → IsCellPairing h' n₁ n₂ M ∧ (M ∈ Q.Δ (h.cell c) ∨ + (M.deleteEdges {s(h.node n₁, h.node n₂)} ∈ Q.Δ (h.cell c) ∧ + ∃ c' ∈ Γ.C, ¬ Painting.IsBorder c' ∧ n₁ ∈ tilde c' ∧ n₂ ∈ tilde c')) + have hR : ∀ c, c ∈ Γ.C ∧ Painting.IsBorder c → ∃ M, R c M := by + rintro c ⟨hc, hbc⟩ + obtain ⟨Θ, hΘ, hcΘ⟩ := exists_cuff_of_isBorder hbc + obtain ⟨m, -, rfl⟩ := (C Θ hΘ).exists_cell c hc hcΘ + have hsome : ∃ a b, Γ.γ ((C Θ hΘ).cell m) = [a, b] ∧ a ≠ b ∧ + a ∈ tilde ((C Θ hΘ).cell m) ∧ b ∈ tilde ((C Θ hΘ).cell m) := by + have h₁ : (C Θ hΘ).pos m ∈ tilde ((C Θ hΘ).cell m) := by + rw [(C Θ hΘ).tilde_eq] + exact Or.inl rfl + have h₂ : (C Θ hΘ).pos (m + 1) ∈ tilde ((C Θ hΘ).cell m) := by + rw [(C Θ hΘ).tilde_eq] + exact Or.inr rfl + have hne := (C Θ hΘ).pos_ne_succ m + rcases (C Θ hΘ).γ_eq m with h₃ | h₃ + · exact ⟨_, _, h₃, hne, h₁, h₂⟩ + · exact ⟨_, _, h₃, hne.symm, h₂, h₁⟩ + obtain ⟨a, b, hab, hne, ha, hb'⟩ := hsome + obtain ⟨M, h₁, h₂⟩ := hb.border_pairing _ hc hbc a ha b hb' hne + refine ⟨M, fun n₁ n₂ hn ↦ ?_⟩ + rw [hab] at hn + simp only [List.cons.injEq, and_true] at hn + obtain ⟨rfl, rfl⟩ := hn + rw [hΔ _ hc] + exact ⟨hpm h₁, h₂⟩ + choose! M hM using hR + have hpair : ∀ Θ (hΘ : Θ ∈ cuffs X.S) m, IsCellPairing h' ((C Θ hΘ).pos m) ((C Θ hΘ).pos (m + 1)) + (M ((C Θ hΘ).cell m)) := by + intro Θ hΘ m + have h₁ := hM _ ⟨(C Θ hΘ).cell_mem m, hborder hΘ m⟩ + rcases (C Θ hΘ).γ_eq m with h₂ | h₂ + · exact (h₁ _ _ h₂).1 + · exact (h₁ _ _ h₂).1.symm + have hdisj : ∀ Θ (hΘ : Θ ∈ cuffs X.S) m, h'.node ((C Θ hΘ).pos m) ∉ h'.border ((C Θ hΘ).pos m) + := by + intro Θ hΘ m hmem + have hN := (C Θ hΘ).mem_N m + exact Set.disjoint_left.mp (h'.border_disjoint _ ⟨hN, hbΘ hΘ ((C Θ hΘ).mem_cuff m)⟩) hmem + ⟨_, hN, rfl⟩ + have hfin : ∀ Θ (hΘ : Θ ∈ cuffs X.S) m, (h'.border ((C Θ hΘ).pos m)).Finite := fun Θ hΘ m ↦ + Q.G.vertexSet_finite.subset (h'.border_subset _ ⟨(C Θ hΘ).mem_N m, hbΘ hΘ + ((C Θ hΘ).mem_cuff m)⟩) + have hseq := fun Θ (hΘ : Θ ∈ cuffs X.S) ↦ exists_cuffLabels (ρ := X.ρ Θ) h' (C Θ hΘ) M (hfin Θ hΘ) + (fun m ↦ h'.border_ncard Θ hΘ _ ⟨(C Θ hΘ).mem_N m, (C Θ hΘ).mem_cuff m⟩) (hdisj Θ hΘ) + (hpair Θ hΘ) + choose s hs₁ hs₂ hs₃ hs₄ using hseq + let π : X.S → List α := fun n ↦ + if hn : ∃ (Θ : Set X.S) (hΘ : Θ ∈ cuffs X.S) (m : ℕ), m < (C Θ hΘ).k ∧ (C Θ hΘ).pos m = n then + s hn.choose hn.choose_spec.choose hn.choose_spec.choose_spec.choose else [] + have huniq : ∀ Θ₁ (h₁ : Θ₁ ∈ cuffs X.S) m₁ Θ₂ (h₂ : Θ₂ ∈ cuffs X.S) m₂, m₁ < (C Θ₁ h₁).k → + m₂ < (C Θ₂ h₂).k → (C Θ₁ h₁).pos m₁ = (C Θ₂ h₂).pos m₂ → s Θ₁ h₁ m₁ = s Θ₂ h₂ m₂ := by + intro Θ₁ h₁ m₁ Θ₂ h₂ m₂ hm₁ hm₂ heq + obtain rfl := cuff_eq_of_mem h₁ h₂ ((C Θ₁ h₁).mem_cuff m₁) (heq ▸ (C Θ₂ h₂).mem_cuff m₂) + rcases lt_trichotomy m₁ m₂ with h₃ | h₃ | h₃ + · exact absurd heq ((C Θ₁ h₁).pos_ne h₃ (by omega)) + · rw [h₃] + · exact absurd heq.symm ((C Θ₁ h₁).pos_ne h₃ (by omega)) + have hπ : ∀ Θ (hΘ : Θ ∈ cuffs X.S) m, m < (C Θ hΘ).k → π ((C Θ hΘ).pos m) = s Θ hΘ m := by + intro Θ hΘ m hm + have hn : ∃ (Θ' : Set X.S) (hΘ' : Θ' ∈ cuffs X.S) (m' : ℕ), m' < (C Θ' hΘ').k ∧ + (C Θ' hΘ').pos m' = (C Θ hΘ).pos m := ⟨Θ, hΘ, m, hm, rfl⟩ + simp only [π, dite_eq_left hn] + have h₂ := hn.choose_spec.choose_spec.choose_spec + exact huniq _ _ _ _ _ _ h₂.1 hm h₂.2 + have hπ' : ∀ Θ (hΘ : Θ ∈ cuffs X.S) m, π ((C Θ hΘ).pos m) = s Θ hΘ (m % (C Θ hΘ).k) := by + intro Θ hΘ m + rw [← (C Θ hΘ).pos_mod m] + exact hπ Θ hΘ _ (Nat.mod_lt _ (C Θ hΘ).k_pos) + refine ⟨⟨Γ, h', M, π, C, hb.three_connected, fun c hc hbc ↦ ?_, + fun c hc hbc n₁ n₂ hn ↦ (hM c ⟨hc, hbc⟩ n₁ n₂ hn).2, + ?_, ?_, fun c hc hbc ↦ ?_, fun Θ hΘ ↦ ⟨fun m ↦ ?_, fun m ↦ ?_, fun m ↦ ?_, hpair Θ hΘ, ?_⟩⟩⟩ + · change (Q.Δ (h.cell c)).IsFree + rw [hΔ c hc] + exact hb.free_internal c hc hbc + · rw [hQ.G_eq] + exact hb.roots_nil + · rw [hQ.dom_eq, hb.dom_eq, hQ.G_eq] + · have hmem : h.cell c ∈ P.dom := by + rw [hb.dom_eq] + exact hEe _ (hcell c hc) + exact (hQ.μ_eq hmem).trans (hb.μ_internal c hc hbc) + · rw [hπ'] + exact hs₁ Θ hΘ _ + · rw [hπ', hs₂, (C Θ hΘ).pos_mod] + · rw [hπ'] + exact hs₃ Θ hΘ _ + · intro m hm i x y hx hy + rw [hπ Θ hΘ m (by omega)] at hx + rw [hπ Θ hΘ (m + 1) hm] at hy + exact hs₄ Θ hΘ m i x y hx hy + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section9d.lean b/LeanPool/GraphMinor/GM20/Section9d.lean new file mode 100644 index 0000000000..f5afb3e5ab --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section9d.lean @@ -0,0 +1,271 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section9c +public import LeanPool.GraphMinor.GM20.Codes + +/-! +# Graph Minors XX, Section 9: the labels of cells + +This file gives the well-quasi-order `Ω₁` of the proof of (9.1), and the label `ψ(c)` of each cell +of a +hull. An internal cell keeps its label `φ(c)`. A border cell gets `φ(c)` and a finite code, which +records +through positions in `μ(c)` the two nodes of `c`, the marches of `β(n₁)` and `β(n₂)`, the patch +`Δ(c)`, +and whether `c = c_Θ`. + +From now on `ζ` is a linear inflation with `ψ(c) ≤ ψ'(ζ(c))` for all `c`. We deduce claim (1) of the +paper, +and that a cell and its image are aligned (`Aligned`): the bijection from `μ(c)` to `μ'(ζ(c))` +respects +everything in the code. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface GraphMinor.GM04 GraphMinor.GM18 GraphMinor.GM10 Hypergraph + +universe u v + +variable {α : Type u} {β : Type v} + +/-- The type of finite codes of border cells. -/ +abbrev CellCode (K : ℕ) : Type := + Prop × Set (Fin K × Fin K) × Set (Fin K × Fin K) × Set (Fin K × Fin K) × Set (Fin K × Fin K) × + Set (Set (Fin K) × Set (Fin K × Fin K)) + +instance (K : ℕ) : Finite (CellCode K) := inferInstance + +/-- The well-quasi-order `Ω₁` of the proof of (9.1). -/ +abbrev LabelOrder (Ω : Type*) (K : ℕ) : Type _ := + DisjointUnionQuasiOrder Ω (Ω × Discrete (CellCode K)) + +theorem wqo_labelOrder {Ω : Type*} [Preorder Ω] (hΩ : WellQuasiOrderedLE Ω) (K : ℕ) : + WellQuasiOrderedLE (LabelOrder Ω K) := by + have h₂ : WellQuasiOrderedLE (Discrete (CellCode K)) := wqo_discrete _ + exact wqo_disjointUnion hΩ inferInstance + +section Label + +variable {Ω : Type*} {X : GradedSurface} {F : CuffParam X.S} {Q : Patchwork Ω α β} + (A : Side X F Q) + +/-- `c` is the cell `c_Θ` for some cuff `Θ`. -/ +def Side.IsCut (c : Set X.S) : Prop := + ∃ Θ, ∃ hΘ : Θ ∈ cuffs X.S, c = (A.C Θ hΘ).cell ((A.C Θ hΘ).k - 1) + +/-- The march of the `i`th node of `c`. -/ +def Side.termπ (c : Set X.S) (i : ℕ) : List α := ((A.Γ.γ c)[i]?).elim [] A.π + +/-- The code of a border cell. -/ +noncomputable def Side.code (K : ℕ) (c : Set X.S) : CellCode K := + (A.IsCut c, + marchCode K (Q.μ (A.h.cell c)) (Q.μ (A.h.cell c)), + marchCode K (Q.μ (A.h.cell c)) ((A.Γ.γ c).map A.h.node), + marchCode K (Q.μ (A.h.cell c)) (A.termπ c 0), + marchCode K (Q.μ (A.h.cell c)) (A.termπ c 1), + patchCode K (Q.μ (A.h.cell c)) (Q.Δ (A.h.cell c))) + +open Classical in +/-- The label `ψ(c)`. -/ +noncomputable def Side.ψ (K : ℕ) (c : Set X.S) : LabelOrder Ω K := + if Painting.IsBorder c then Sum.inr (Q.φ (A.h.cell c), A.code K c) else Sum.inl (Q.φ (A.h.cell c)) + +theorem Side.ψ_border (K : ℕ) {c : Set X.S} (hb : Painting.IsBorder c) : + A.ψ K c = Sum.inr (Q.φ (A.h.cell c), A.code K c) := by + classical + exact ite_eq_left hb + +theorem Side.ψ_internal (K : ℕ) {c : Set X.S} (hb : ¬ Painting.IsBorder c) : + A.ψ K c = Sum.inl (Q.φ (A.h.cell c)) := by + classical + exact ite_eq_right hb + +end Label + +theorem Painting.isBorder_image {S : Type} [TopologicalSpace S] {Γ Γ' : Painting S} {ζn : S → Set S} + {ζc : Set S → Set S} (hζ : IsLinearInflation Γ Γ' ζn ζc) {c : Set S} (hc : c ∈ Γ.C) : + Painting.IsBorder (ζc c) ↔ Painting.IsBorder c := by + constructor + · intro h + obtain ⟨Θ, hΘ, hm⟩ := exists_cuff_of_isBorder h + obtain ⟨y, hy, hyΘ⟩ := (hζ.borders_iff c hc Θ hΘ).mpr hm + exact ⟨y, hy, cuff_subset_bd hΘ hyΘ⟩ + · intro h + obtain ⟨Θ, hΘ, hm⟩ := exists_cuff_of_isBorder h + obtain ⟨y, hy, hyΘ⟩ := (hζ.borders_iff c hc Θ hΘ).mp hm + exact ⟨y, hy, cuff_subset_bd hΘ hyΘ⟩ + +/-- Two equal marches of positions give the same position of a common vertex. -/ +theorem term_of_code {K : ℕ} {r r' m₁ m₂ m₁' m₂' : List α} (hr : r.length ≤ K) + (h₁ : marchCode K r m₁ = marchCode K r' m₁') (h₂ : marchCode K r m₂ = marchCode K r' m₂') + (hl₁ : m₁.length ≤ K) (hl₂ : m₂.length ≤ K) {i j : ℕ} {x : α} (hx : x ∈ r) + (hm₁ : m₁[i]? = some x) (hm₂ : m₂[j]? = some x) : + ∃ x', m₁'[i]? = some x' ∧ m₂'[j]? = some x' := by + obtain ⟨q, hq⟩ := exists_index hr hx + obtain ⟨y₁, hy₁, hq₁⟩ := marchCode_forward h₁ hl₁ hm₁ hq + obtain ⟨y₂, hy₂, hq₂⟩ := marchCode_forward h₂ hl₂ hm₂ hq + have : y₁ = y₂ := by + rw [hq₁] at hq₂ + exact Option.some.inj hq₂ + subst this + exact ⟨y₁, hy₁, hy₂⟩ + +section Inflation + +variable {Ω : Type*} [Preorder Ω] {X : GradedSurface} {F : CuffParam X.S} {Q Q' : Patchwork Ω α β} + (A : Side X F Q) (A' : Side X F Q') {ζn : X.S → Set X.S} {ζc : Set X.S → Set X.S} {K : ℕ} + +/-- The relation of `ψ` gives the relation of labels. -/ +theorem φ_le_of_ψ {c : Set X.S} (hc : c ∈ A.Γ.C) (hζ : IsLinearInflation A.Γ A'.Γ ζn ζc) + (h : A.ψ K c ≤ A'.ψ K (ζc c)) : Q.φ (A.h.cell c) ≤ Q'.φ (A'.h.cell (ζc c)) := by + classical + by_cases hb : Painting.IsBorder c + · have hb' := (Painting.isBorder_image hζ hc).mpr hb + rw [A.ψ_border K hb, A'.ψ_border K hb'] at h + cases h with + | inr h₁ => exact h₁.1 + · have hb' : ¬ Painting.IsBorder (ζc c) := fun h₁ ↦ hb ((Painting.isBorder_image hζ hc).mp h₁) + rw [A.ψ_internal K hb, A'.ψ_internal K hb'] at h + cases h with + | inl h₁ => exact h₁ + +/-- The relation of `ψ` gives the equality of codes. -/ +theorem code_eq_of_ψ {c : Set X.S} (hc : c ∈ A.Γ.C) (hb : Painting.IsBorder c) + (hζ : IsLinearInflation A.Γ A'.Γ ζn ζc) (h : A.ψ K c ≤ A'.ψ K (ζc c)) : + A.code K c = A'.code K (ζc c) := by + classical + have hb' := (Painting.isBorder_image hζ hc).mpr hb + rw [A.ψ_border K hb, A'.ψ_border K hb'] at h + cases h with + | inr h₁ => exact h₁.2 + +/-- Claim (1) of the proof of (9.1): `ζ(c_Θ) = c'_Θ`. -/ +theorem cut_image (hζ : IsLinearInflation A.Γ A'.Γ ζn ζc) + (hψ : ∀ c ∈ A.Γ.C, A.ψ K c ≤ A'.ψ K (ζc c)) {Θ : Set X.S} (hΘ : Θ ∈ cuffs X.S) : + ζc ((A.C Θ hΘ).cell ((A.C Θ hΘ).k - 1)) = (A'.C Θ hΘ).cell ((A'.C Θ hΘ).k - 1) := by + set c := (A.C Θ hΘ).cell ((A.C Θ hΘ).k - 1) with hcdef + have hc : c ∈ A.Γ.C := (A.C Θ hΘ).cell_mem _ + have hm : (c ∩ Θ).Nonempty := (A.C Θ hΘ).meets _ + obtain ⟨y₀, hy₀, hy₀Θ⟩ := hm + have hb : Painting.IsBorder c := ⟨y₀, hy₀, cuff_subset_bd hΘ hy₀Θ⟩ + have hcode := code_eq_of_ψ A A' hc hb hζ (hψ c hc) + have hcut : A.IsCut c := ⟨Θ, hΘ, rfl⟩ + have hiff : A.IsCut c = A'.IsCut (ζc c) := congrArg Prod.fst hcode + obtain ⟨Θ₂, hΘ₂, heq⟩ := (hiff ▸ hcut : A'.IsCut (ζc c)) + have hmeet := (hζ.borders_iff c hc Θ hΘ).mp ⟨y₀, hy₀, hy₀Θ⟩ + have hmeet₂ : (ζc c ∩ Θ₂).Nonempty := by + rw [heq] + exact (A'.C Θ₂ hΘ₂).meets _ + obtain ⟨y, hy, hyΘ₂⟩ := hmeet₂ + have hyΘ : y ∈ Θ := closure_inter_bd_subset A'.Γ (hζ.cell_mem c hc) hΘ hmeet + ⟨subset_closure hy, cuff_subset_bd hΘ₂ hyΘ₂⟩ + obtain rfl := cuff_eq_of_mem hΘ hΘ₂ hyΘ hyΘ₂ + exact heq + +/-- `c` and `c'` are aligned: the bijection from `μ(c)` to `μ'(c')` maps the nodes `a, b` of `c` to +the +nodes `a', b'` of `c'`, and the marches `π(a), π(b)` to `π'(a'), π'(b')`. -/ +structure Aligned (K : ℕ) (c c' : Set X.S) (a b a' b' : X.S) : Prop where + length_eq : (Q.μ (A.h.cell c)).length = (Q'.μ (A'.h.cell c')).length + code₁ : marchCode K (Q.μ (A.h.cell c)) (A.π a) = marchCode K (Q'.μ (A'.h.cell c')) (A'.π a') + code₂ : marchCode K (Q.μ (A.h.cell c)) (A.π b) = marchCode K (Q'.μ (A'.h.cell c')) (A'.π b') + node₁ : ∀ q : Fin K, (Q.μ (A.h.cell c))[q.1]? = some (A.h.node a) → + (Q'.μ (A'.h.cell c'))[q.1]? = some (A'.h.node a') + node₂ : ∀ q : Fin K, (Q.μ (A.h.cell c))[q.1]? = some (A.h.node b) → + (Q'.μ (A'.h.cell c'))[q.1]? = some (A'.h.node b') + +variable {A A'} + +omit [Preorder Ω] in +theorem Aligned.swap {c c' : Set X.S} {a b a' b' : X.S} (h : Aligned A A' K c c' a b a' b') : + Aligned A A' K c c' b a b' a' := + ⟨h.length_eq, h.code₂, h.code₁, h.node₂, h.node₁⟩ + +variable (A A') + +omit [Preorder Ω] in +/-- For a border cell `c` with march `[a, b]`, whose image has march `[a', b']`, the two cells are +aligned. -/ +theorem aligned_of_code {c c' : Set X.S} {a b a' b' : X.S} (hγ : A.Γ.γ c = [a, b]) + (hγ' : A'.Γ.γ c' = [a', b']) (hcode : A.code K c = A'.code K c') (hK : 2 ≤ K) + (hr : (Q.μ (A.h.cell c)).length ≤ K) (hr' : (Q'.μ (A'.h.cell c')).length ≤ K) + (hnd : (Q.μ (A.h.cell c)).Nodup) (hnd' : (Q'.μ (A'.h.cell c')).Nodup) : + Aligned A A' K c c' a b a' b' := by + simp only [Side.code, Prod.mk.injEq] at hcode + obtain ⟨-, h₀, h₁, h₂, h₃, -⟩ := hcode + have hl : (A.Γ.γ c).map A.h.node = [A.h.node a, A.h.node b] := by rw [hγ]; rfl + have hl' : (A'.Γ.γ c').map A'.h.node = [A'.h.node a', A'.h.node b'] := by rw [hγ']; rfl + have ht₀ : A.termπ c 0 = A.π a := by simp [Side.termπ, hγ] + have ht₁ : A.termπ c 1 = A.π b := by simp [Side.termπ, hγ] + have ht₀' : A'.termπ c' 0 = A'.π a' := by simp [Side.termπ, hγ'] + have ht₁' : A'.termπ c' 1 = A'.π b' := by simp [Side.termπ, hγ'] + rw [hl, hl'] at h₁ + rw [ht₀, ht₀'] at h₂ + rw [ht₁, ht₁'] at h₃ + refine ⟨length_eq_of_code hr hr' hnd hnd' (fun _ h ↦ h) (fun _ h ↦ h) h₀, h₂, h₃, + fun q hq ↦ ?_, fun q hq ↦ ?_⟩ + · obtain ⟨y, hy, hq'⟩ := marchCode_forward h₁ (p := 0) (by simpa using hK) rfl hq + simp only [List.getElem?_cons_zero, Option.some.injEq] at hy + rwa [← hy] at hq' + · obtain ⟨y, hy, hq'⟩ := marchCode_forward h₁ (p := 1) (by simpa using hK) rfl hq + simp only [List.getElem?_cons_succ, List.getElem?_cons_zero, Option.some.injEq] at hy + rwa [← hy] at hq' + +/-- The marches `μ(c)` of border cells have at most `K` terms. -/ +def Side.Bounded (K : ℕ) : Prop := + ∀ c ∈ A.Γ.C, Painting.IsBorder c → (Q.μ (A.h.cell c)).length ≤ K + +omit [Preorder Ω] in +theorem Side.μ_nodup {c : Set X.S} (hc : c ∈ A.Γ.C) : (Q.μ (A.h.cell c)).Nodup := by + refine Q.μ_nodup _ ?_ + rw [A.dom_eq] + exact A.h.cell_bijOn.mapsTo hc + +/-- If `ζ(cell m) = cell' m'` then the two cells are aligned, with `pos m, pos (m + 1)` going to +`pos' m', pos' (m' + 1)`. -/ +theorem aligned_cell (hζ : IsLinearInflation A.Γ A'.Γ ζn ζc) + (hψ : ∀ c ∈ A.Γ.C, A.ψ K c ≤ A'.ψ K (ζc c)) (hK : 2 ≤ K) (hB : A.Bounded K) (hB' : A'.Bounded K) + {Θ : Set X.S} (hΘ : Θ ∈ cuffs X.S) {m m' : ℕ} + (h : ζc ((A.C Θ hΘ).cell m) = (A'.C Θ hΘ).cell m') : + Aligned A A' K ((A.C Θ hΘ).cell m) ((A'.C Θ hΘ).cell m') ((A.C Θ hΘ).pos m) + ((A.C Θ hΘ).pos (m + 1)) ((A'.C Θ hΘ).pos m') ((A'.C Θ hΘ).pos (m' + 1)) := by + set C := A.C Θ hΘ + set C' := A'.C Θ hΘ + have hc := C.cell_mem m + obtain ⟨y, hy, hyΘ⟩ := C.meets m + have hb : Painting.IsBorder (C.cell m) := ⟨y, hy, cuff_subset_bd hΘ hyΘ⟩ + have hb' : Painting.IsBorder (C'.cell m') := h ▸ (Painting.isBorder_image hζ hc).mpr hb + have hcode : A.code K (C.cell m) = A'.code K (C'.cell m') := + h ▸ code_eq_of_ψ A A' hc hb hζ (hψ _ hc) + have hr := hB _ hc hb + have hr' := hB' _ (C'.cell_mem m') hb' + have hnd := A.μ_nodup hc + have hnd' := A'.μ_nodup (C'.cell_mem m') + obtain ⟨h₁, h₂⟩ := image_cell hζ hΘ C C' h + have hdis := hζ.node_disjoint _ (C.mem_N m) _ (C.mem_N (m + 1)) (C.pos_ne_succ m) + have hnode : ∀ (u v u' v' : X.S), A.Γ.γ (C.cell m) = [u, v] → A'.Γ.γ (C'.cell m') = [u', v'] → + u ∈ A.Γ.N → u' ∈ ζn u := by + intro u v u' v' hu hu' hN + have h₃ := hζ.nodes u hN _ hc 0 (by rw [hu]; simp) (by rw [h, hu']; simp) + simp only [h, hu, hu'] at h₃ + exact h₃.mp (by simp) + rcases C.γ_eq m with h₃ | h₃ <;> rcases C'.γ_eq m' with h₄ | h₄ + · exact aligned_of_code A A' h₃ h₄ hcode hK hr hr' hnd hnd' + · exact absurd h₂ (Set.disjoint_left.mp hdis (hnode _ _ _ _ h₃ h₄ (C.mem_N m))) + · exact absurd h₁ (Set.disjoint_right.mp hdis (hnode _ _ _ _ h₃ h₄ (C.mem_N (m + 1)))) + · exact (aligned_of_code A A' h₃ h₄ hcode hK hr hr' hnd hnd').swap + +end Inflation + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section9e.lean b/LeanPool/GraphMinor/GM20/Section9e.lean new file mode 100644 index 0000000000..e767e32646 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section9e.lean @@ -0,0 +1,417 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section9d + +/-! +# Graph Minors XX, Section 9: the vertices of the expansion + +Let `ζ` be a linear inflation of `Γ` in `Γ'` with `ψ(c) ≤ ψ'(ζ(c))` for all `c`. This file defines +the sets +`η(v)` of the proof of (9.1), and proves its claims (2), (3), (4). + +The third condition of a hull says that the nodes `n` of a cuff with `v ∈ β(n)` form an interval of +the +cuff (`Side.interval`). So a property can be carried along these nodes, from each one to the next +(`Side.walk`). This is how the paper proves (3) and (10), and we use `walk` for both. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface GraphMinor.GM04 GraphMinor.GM18 GraphMinor.GM10 Hypergraph + +universe u v + +variable {α : Type u} {β : Type v} + +theorem eq_of_getElem?_eq {l : List α} (hnd : l.Nodup) {i j : ℕ} {x : α} (h₁ : l[i]? = some x) + (h₂ : l[j]? = some x) : i = j := by + obtain ⟨hi, hx⟩ := List.getElem?_eq_some_iff.mp h₁ + obtain ⟨hj, hy⟩ := List.getElem?_eq_some_iff.mp h₂ + exact (hnd.getElem_inj_iff (hi := hi) (hj := hj)).mp (hx.trans hy.symm) + +section SideLemmas + +variable {Ω : Type*} {X : GradedSurface} {F : CuffParam X.S} {Q : Patchwork Ω α β} + (A : Side X F Q) {Θ : Set X.S} (hΘ : Θ ∈ cuffs X.S) + +namespace Side + +theorem isBorder_cell (m : ℕ) : Painting.IsBorder ((A.C Θ hΘ).cell m) := by + obtain ⟨y, hy, hyΘ⟩ := (A.C Θ hΘ).meets m + exact ⟨y, hy, cuff_subset_bd hΘ hyΘ⟩ + +theorem mem_of_getElem? {n : ℕ} {i : ℕ} {x : α} + (h : (A.π ((A.C Θ hΘ).pos n))[i]? = some x) : x ∈ A.h.border ((A.C Θ hΘ).pos n) := by + have h₁ : x ∈ A.π ((A.C Θ hΘ).pos n) := List.mem_of_getElem? h + have h₂ := (A.labelled Θ hΘ).set_eq n + rw [← h₂] + exact h₁ + +theorem exists_getElem? {n : ℕ} {x : α} (h : x ∈ A.h.border ((A.C Θ hΘ).pos n)) : + ∃ i : ℕ, (A.π ((A.C Θ hΘ).pos n))[i]? = some x := by + rw [← (A.labelled Θ hΘ).set_eq n] at h + obtain ⟨i, hi, hx⟩ := List.getElem_of_mem h + exact ⟨i, List.getElem?_eq_some_iff.mpr ⟨hi, hx⟩⟩ + +theorem exists_term {m m' i : ℕ} {x : α} (h : (A.π ((A.C Θ hΘ).pos m))[i]? = some x) : + ∃ y, (A.π ((A.C Θ hΘ).pos m'))[i]? = some y := by + have hi := (List.getElem?_eq_some_iff.mp h).1 + rw [(A.labelled Θ hΘ).length_eq m, ← (A.labelled Θ hΘ).length_eq m'] at hi + exact ⟨_, List.getElem?_eq_getElem hi⟩ + +theorem border_finite (m : ℕ) : (A.h.border ((A.C Θ hΘ).pos m)).Finite := + Q.G.vertexSet_finite.subset (A.h.border_subset _ + ⟨(A.C Θ hΘ).mem_N m, cuff_subset_bd hΘ ((A.C Θ hΘ).mem_cuff m)⟩) + +theorem pair_finite (m : ℕ) : (A.M ((A.C Θ hΘ).cell m)).verts.Finite := + isPairing_verts_finite (A.border_finite hΘ m) (A.border_finite hΘ (m + 1)) + ((A.labelled Θ hΘ).pair m) + +/-- If two terms of `π(pos m), π(pos (m + 1))` are linked, and `x` lies in both sets, then both +terms are +`x`. -/ +theorem eq_of_linked_left {m : ℕ} {x y : α} (hl : Linked (A.M ((A.C Θ hΘ).cell m)) x y) + (hx : x ∈ A.h.border ((A.C Θ hΘ).pos (m + 1))) + (hy : y ∈ A.h.border ((A.C Θ hΘ).pos (m + 1))) : y = x := by + have hp := (A.labelled Θ hΘ).pair m + have hv : x ∈ (A.M ((A.C Θ hΘ).cell m)).verts := by + rw [hp.verts_eq] + exact Or.inl (Or.inr hx) + obtain ⟨z, -, -, hu⟩ := hp.existsUnique (A.pair_finite hΘ m) hv + rw [hu y (Or.inl hy) hl, hu x (Or.inl hx) (Or.inl rfl)] + +theorem eq_of_linked_right {m : ℕ} {x y : α} (hl : Linked (A.M ((A.C Θ hΘ).cell m)) x y) + (hx : x ∈ A.h.border ((A.C Θ hΘ).pos m)) (hy : y ∈ A.h.border ((A.C Θ hΘ).pos m)) : x = y := by + have hp := ((A.labelled Θ hΘ).pair m).symm + have hv : y ∈ (A.M ((A.C Θ hΘ).cell m)).verts := by + rw [hp.verts_eq] + exact Or.inl (Or.inr hy) + obtain ⟨z, -, -, hu⟩ := hp.existsUnique (A.pair_finite hΘ m) hv + rw [hu x (Or.inl hx) hl.symm, hu y (Or.inl hy) (Or.inl rfl)] + +/-- The link of `IsLabelled` for every cell but `c_Θ`, with indices beyond `k`. -/ +theorem link_of_ne {m : ℕ} (hm : (A.C Θ hΘ).cell m ≠ (A.C Θ hΘ).cell ((A.C Θ hΘ).k - 1)) {i : ℕ} + {x y : α} (hx : (A.π ((A.C Θ hΘ).pos m))[i]? = some x) + (hy : (A.π ((A.C Θ hΘ).pos (m + 1)))[i]? = some y) : + Linked (A.M ((A.C Θ hΘ).cell m)) x y := by + set C := A.C Θ hΘ + have hk := C.k_pos + have hlt : m % C.k + 1 < C.k := by + have h₁ := Nat.mod_lt m hk + by_contra hc + have h₂ : m % C.k = C.k - 1 := by omega + exact hm (by rw [← C.cell_mod m, h₂]) + have h₁ : C.pos m = C.pos (m % C.k) := (C.pos_mod m).symm + have h₂ : C.pos (m + 1) = C.pos (m % C.k + 1) := C.pos_succ_eq_of_pos_eq h₁ + rw [h₁] at hx + rw [h₂] at hy + rw [← C.cell_mod m] + exact (A.labelled Θ hΘ).link _ hlt i x y hx hy + +/-- The nodes `n` on a cuff with `v ∈ β(n)` form an interval, by the third condition of a hull. -/ +theorem interval {v : α} {a b : ℕ} (ha : v ∈ A.h.border ((A.C Θ hΘ).pos a)) + (hb : v ∈ A.h.border ((A.C Θ hΘ).pos b)) (_hab : a ≤ b) (_hb₂ : b ≤ a + (A.C Θ hΘ).k) : + (∀ j, a ≤ j → j ≤ b → v ∈ A.h.border ((A.C Θ hΘ).pos j)) ∨ + ∀ j, b ≤ j → j ≤ a + (A.C Θ hΘ).k → v ∈ A.h.border ((A.C Θ hΘ).pos j) := by + by_contra hc + push Not at hc + obtain ⟨⟨j₁, h₁, h₂, h₃⟩, j₂, h₄, h₅, h₆⟩ := hc + set C := A.C Θ hΘ + have hmem : ∀ j, C.pos j ∈ A.Γ.N ∩ Θ := fun j ↦ ⟨C.mem_N j, C.mem_cuff j⟩ + rcases A.h.border_order Θ hΘ _ (hmem a) _ (hmem j₁) _ (hmem b) _ (hmem j₂) + (C.inOrder h₁ h₂ h₄ h₅) ⟨ha, hb⟩ with h₇ | h₇ + · exact h₃ h₇ + · exact h₆ h₇ + +theorem walk_fwd (R : X.S → Prop) {v : α} + (hs : ∀ j, v ∈ A.h.border ((A.C Θ hΘ).pos j) → v ∈ A.h.border ((A.C Θ hΘ).pos (j + 1)) → + R ((A.C Θ hΘ).pos j) → R ((A.C Θ hΘ).pos (j + 1))) {a b : ℕ} (hab : a ≤ b) + (hv : ∀ j, a ≤ j → j ≤ b → v ∈ A.h.border ((A.C Θ hΘ).pos j)) (hR : R ((A.C Θ hΘ).pos a)) : + R ((A.C Θ hΘ).pos b) := by + induction b, hab using Nat.le_induction with + | base => exact hR + | succ b hab ih => + exact hs b (hv b hab (by omega)) (hv _ (by omega) le_rfl) + (ih fun j h₁ h₂ ↦ hv j h₁ (by omega)) + +theorem walk_bwd (R : X.S → Prop) {v : α} + (hs : ∀ j, v ∈ A.h.border ((A.C Θ hΘ).pos j) → v ∈ A.h.border ((A.C Θ hΘ).pos (j + 1)) → + R ((A.C Θ hΘ).pos (j + 1)) → R ((A.C Θ hΘ).pos j)) {a b : ℕ} (hab : a ≤ b) + (hv : ∀ j, a ≤ j → j ≤ b → v ∈ A.h.border ((A.C Θ hΘ).pos j)) (hR : R ((A.C Θ hΘ).pos b)) : + R ((A.C Θ hΘ).pos a) := by + induction b, hab using Nat.le_induction with + | base => exact hR + | succ b hab ih => + exact ih (fun j h₁ h₂ ↦ hv j h₁ (by omega)) + (hs b (hv b hab (by omega)) (hv _ (by omega) le_rfl) hR) + +/-- A property that passes between consecutive nodes `n` of a cuff with `v ∈ β(n)` holds for all +such +nodes if it holds for one. -/ +theorem walk (R : X.S → Prop) {v : α} + (hs₁ : ∀ j, v ∈ A.h.border ((A.C Θ hΘ).pos j) → v ∈ A.h.border ((A.C Θ hΘ).pos (j + 1)) → + R ((A.C Θ hΘ).pos j) → R ((A.C Θ hΘ).pos (j + 1))) + (hs₂ : ∀ j, v ∈ A.h.border ((A.C Θ hΘ).pos j) → v ∈ A.h.border ((A.C Θ hΘ).pos (j + 1)) → + R ((A.C Θ hΘ).pos (j + 1)) → R ((A.C Θ hΘ).pos j)) {a b : ℕ} + (ha : v ∈ A.h.border ((A.C Θ hΘ).pos a)) (hb : v ∈ A.h.border ((A.C Θ hΘ).pos b)) + (hR : R ((A.C Θ hΘ).pos a)) : R ((A.C Θ hΘ).pos b) := by + set C := A.C Θ hΘ + have hk := C.k_pos + have ha' := Nat.mod_lt a hk + have hb' := Nat.mod_lt b hk + rw [← C.pos_mod a] at ha hR + rw [← C.pos_mod b] at hb ⊢ + generalize a % C.k = a at ha hR ha' + generalize b % C.k = b at hb hb' ⊢ + rcases le_total a b with hab | hab + · have hab₂ : b ≤ a + C.k := by omega + rcases A.interval hΘ ha hb hab hab₂ with h₁ | h₁ + · exact A.walk_fwd hΘ R hs₁ hab h₁ hR + · refine A.walk_bwd hΘ R hs₂ hab₂ h₁ ?_ + rwa [C.pos_add] + · have hab₂ : a ≤ b + C.k := by omega + rcases A.interval hΘ hb ha hab hab₂ with h₁ | h₁ + · exact A.walk_bwd hΘ R hs₂ hab h₁ hR + · have := A.walk_fwd hΘ R hs₁ hab₂ h₁ hR + rwa [C.pos_add] at this + +theorem mem_μ {c : Set X.S} (hc : c ∈ A.Γ.C) (hb : Painting.IsBorder c) {n : X.S} (hn : n ∈ tilde c) + {x : α} (hx : x ∈ A.h.border n) : x ∈ Q.μ (A.h.cell c) := by + have hd : A.h.cell c ∈ Q.dom := by + rw [A.dom_eq] + exact A.h.cell_bijOn.mapsTo hc + have h₁ : x ∈ {v | v ∈ Q.μ (A.h.cell c)} := by + rw [Q.μ_set _ hd] + refine (A.h.ends_border c hc hb).symm ▸ Or.inr ?_ + exact Set.mem_biUnion hn hx + exact h₁ + +theorem mem_tilde_left (m : ℕ) : (A.C Θ hΘ).pos m ∈ tilde ((A.C Θ hΘ).cell m) := by + rw [(A.C Θ hΘ).tilde_eq] + exact Or.inl rfl + +theorem mem_tilde_right (m : ℕ) : (A.C Θ hΘ).pos (m + 1) ∈ tilde ((A.C Θ hΘ).cell m) := by + rw [(A.C Θ hΘ).tilde_eq] + exact Or.inr rfl + +theorem length_π_le {K : ℕ} (hB : A.Bounded K) (m : ℕ) : (A.π ((A.C Θ hΘ).pos m)).length ≤ K := by + have hc := (A.C Θ hΘ).cell_mem m + have hb := A.isBorder_cell hΘ m + refine (length_le_of_subset ((A.labelled Θ hΘ).nodup m) fun x hx ↦ ?_).trans (hB _ hc hb) + exact A.mem_μ hc hb (A.mem_tilde_left hΘ m) (by + rw [← (A.labelled Θ hΘ).set_eq m] + exact hx) + +theorem length_π_le' {K : ℕ} (hB : A.Bounded K) (m : ℕ) : + (A.π ((A.C Θ hΘ).pos (m + 1))).length ≤ K := A.length_π_le hΘ hB (m + 1) + +/-- A term of the march of a node on `Θ` lies in the set `β` of this node. -/ +theorem mem_border_of_term (hΘ : Θ ∈ cuffs X.S) {n : X.S} (hn : n ∈ A.Γ.N ∩ Θ) {i : ℕ} {x : α} + (h : (A.π n)[i]? = some x) : x ∈ A.h.border n := by + obtain ⟨m, -, rfl⟩ := (A.C Θ hΘ).exists_pos n hn + exact A.mem_of_getElem? hΘ h + +end Side + +end SideLemmas + +/-- The hypotheses of the main step of the proof of (9.1). -/ +structure InflationHyp {Ω : Type*} [Preorder Ω] {X : GradedSurface} {F : CuffParam X.S} + {Q Q' : Patchwork Ω α β} (A : Side X F Q) (A' : Side X F Q') (ζn : X.S → Set X.S) + (ζc : Set X.S → Set X.S) (K : ℕ) : Prop where + infl : IsLinearInflation A.Γ A'.Γ ζn ζc + ψ_le : ∀ c ∈ A.Γ.C, A.ψ K c ≤ A'.ψ K (ζc c) + two_le : 2 ≤ K + bounded : A.Bounded K + bounded' : A'.Bounded K + +/-- The set `η(v)`. For `v = n ∈ N(Γ)` it is `ζ(n)`, and for other `v` it is the set of terms `v'` +of +`π'(n')` where `v` is the same term of `π(n)` and `n'` is in `ζ(n)`, on the same cuff as `n`. -/ +def etaVert {Ω : Type*} {X : GradedSurface} {F : CuffParam X.S} {Q Q' : Patchwork Ω α β} + (A : Side X F Q) (A' : Side X F Q') (ζn : X.S → Set X.S) (v : α) : Set α := + {v' | (∃ n ∈ A.Γ.N, A.h.node n = v ∧ ∃ n' ∈ ζn n, A'.h.node n' = v') ∨ + ∃ Θ ∈ cuffs X.S, ∃ n ∈ A.Γ.N ∩ Θ, ∃ n' ∈ ζn n ∩ Θ, ∃ i : ℕ, + (A.π n)[i]? = some v ∧ (A'.π n')[i]? = some v'} + +section Main + +variable {Ω : Type*} [Preorder Ω] {X : GradedSurface} {F : CuffParam X.S} {Q Q' : Patchwork Ω α β} + {A : Side X F Q} {A' : Side X F Q'} {ζn : X.S → Set X.S} {ζc : Set X.S → Set X.S} {K : ℕ} + (H : InflationHyp A A' ζn ζc K) + +namespace InflationHyp + +include H + +theorem exists_lift' {Θ : Set X.S} (hΘ : Θ ∈ cuffs X.S) : + ∃ L : ℕ → ℕ, L 0 = 0 ∧ Monotone L ∧ + (∀ m', (A'.C Θ hΘ).pos m' ∈ ζn ((A.C Θ hΘ).pos (L m'))) ∧ + (∀ m', (L (m' + 1) = L m' ∧ (A'.C Θ hΘ).cell m' ∉ ζc '' A.Γ.C) ∨ + (L (m' + 1) = L m' + 1 ∧ ζc ((A.C Θ hΘ).cell (L m')) = (A'.C Θ hΘ).cell m')) ∧ + (∀ m' < (A'.C Θ hΘ).k, L m' < (A.C Θ hΘ).k) ∧ + (∀ l < (A.C Θ hΘ).k, ∃ m' < (A'.C Θ hΘ).k, L m' = l) := + exists_lift H.infl hΘ _ _ (cut_image A A' H.infl H.ψ_le hΘ) + +theorem cell_ne_cut {Θ : Set X.S} (hΘ : Θ ∈ cuffs X.S) {j : ℕ} + (hj : (A'.C Θ hΘ).cell j ∉ ζc '' A.Γ.C) : + (A'.C Θ hΘ).cell j ≠ (A'.C Θ hΘ).cell ((A'.C Θ hΘ).k - 1) := fun heq ↦ + hj ⟨_, (A.C Θ hΘ).cell_mem _, (cut_image A A' H.infl H.ψ_le hΘ).trans heq.symm⟩ + +/-- The terms of `π` on a cell determine the terms of `π'` on its image. -/ +theorem transfer_fwd {Θ : Set X.S} (hΘ : Θ ∈ cuffs X.S) {m m' : ℕ} + (h : ζc ((A.C Θ hΘ).cell m) = (A'.C Θ hΘ).cell m') {i j : ℕ} {x : α} + (h₁ : (A.π ((A.C Θ hΘ).pos m))[i]? = some x) + (h₂ : (A.π ((A.C Θ hΘ).pos (m + 1)))[j]? = some x) : + ∃ x', (A'.π ((A'.C Θ hΘ).pos m'))[i]? = some x' ∧ + (A'.π ((A'.C Θ hΘ).pos (m' + 1)))[j]? = some x' := by + have ha := aligned_cell A A' H.infl H.ψ_le H.two_le H.bounded H.bounded' hΘ h + have hc := (A.C Θ hΘ).cell_mem m + have hb := A.isBorder_cell hΘ m + refine term_of_code (H.bounded _ hc hb) ha.code₁ ha.code₂ (A.length_π_le hΘ H.bounded m) + (A.length_π_le hΘ H.bounded (m + 1)) ?_ h₁ h₂ + exact A.mem_μ hc hb (A.mem_tilde_left hΘ m) (A.mem_of_getElem? hΘ h₁) + +theorem transfer_bwd {Θ : Set X.S} (hΘ : Θ ∈ cuffs X.S) {m m' : ℕ} + (h : ζc ((A.C Θ hΘ).cell m) = (A'.C Θ hΘ).cell m') {i j : ℕ} {x : α} + (h₁ : (A'.π ((A'.C Θ hΘ).pos m'))[i]? = some x) + (h₂ : (A'.π ((A'.C Θ hΘ).pos (m' + 1)))[j]? = some x) : + ∃ x', (A.π ((A.C Θ hΘ).pos m))[i]? = some x' ∧ + (A.π ((A.C Θ hΘ).pos (m + 1)))[j]? = some x' := by + have ha := aligned_cell A A' H.infl H.ψ_le H.two_le H.bounded H.bounded' hΘ h + have hc := (A'.C Θ hΘ).cell_mem m' + have hb := A'.isBorder_cell hΘ m' + refine term_of_code (H.bounded' _ hc hb) ha.code₁.symm ha.code₂.symm + (A'.length_π_le hΘ H.bounded' m') (A'.length_π_le hΘ H.bounded' (m' + 1)) ?_ h₁ h₂ + exact A'.mem_μ hc hb (A'.mem_tilde_left hΘ m') (A'.mem_of_getElem? hΘ h₁) + +theorem pos_eq_of_mem' {Θ : Set X.S} (hΘ : Θ ∈ cuffs X.S) {n : X.S} (hn : n ∈ A.Γ.N) {l : ℕ} + {n' : X.S} (h₁ : n' ∈ ζn n) (h₂ : n' ∈ ζn ((A.C Θ hΘ).pos l)) : n = (A.C Θ hΘ).pos l := by + by_contra hne + exact Set.disjoint_left.mp (H.infl.node_disjoint _ hn _ ((A.C Θ hΘ).mem_N l) hne) h₁ h₂ + +/-- Claim (3) of the proof of (9.1). -/ +theorem claim_3 {Θ : Set X.S} (hΘ : Θ ∈ cuffs X.S) {n₁ n₂ n₁' n₂' : X.S} (hn₁ : n₁ ∈ A.Γ.N) + (hn₂ : n₂ ∈ A.Γ.N) (h₁ : n₁' ∈ ζn n₁ ∩ Θ) (h₂ : n₂' ∈ ζn n₂ ∩ Θ) {i j : ℕ} {v v' : α} + (hv : (A.π n₁)[i]? = some v) (hv' : (A'.π n₁')[i]? = some v') (hj : (A'.π n₂')[j]? = some v') : + (A.π n₂)[j]? = some v := by + obtain ⟨L, -, -, hpos, hstep, -, -⟩ := H.exists_lift' hΘ + set C := A.C Θ hΘ + set C' := A'.C Θ hΘ + let R : X.S → Prop := fun n' ↦ ∃ n ∈ A.Γ.N, n' ∈ ζn n ∧ ∃ i : ℕ, (A'.π n')[i]? = some v' ∧ + (A.π n)[i]? = some v + obtain ⟨a, -, rfl⟩ := C'.exists_pos n₁' ⟨H.infl.node_subset _ hn₁ h₁.1, h₁.2⟩ + obtain ⟨b, -, rfl⟩ := C'.exists_pos n₂' ⟨H.infl.node_subset _ hn₂ h₂.1, h₂.2⟩ + change (A'.π (C'.pos a))[i]? = some v' at hv' + change (A'.π (C'.pos b))[j]? = some v' at hj + have hR : R (C'.pos b) := by + refine A'.walk hΘ R (a := a) ?_ ?_ (A'.mem_of_getElem? hΘ hv') (A'.mem_of_getElem? hΘ hj) + ⟨n₁, hn₁, h₁.1, i, hv', hv⟩ + · rintro k hk₁ hk₂ ⟨n, hn, hkn, i₀, hi₀, hi₀'⟩ + obtain rfl := H.pos_eq_of_mem' hΘ hn hkn (hpos k) + rcases hstep k with ⟨hL, hni⟩ | ⟨hL, hz⟩ + · obtain ⟨y, hy⟩ := A'.exists_term hΘ (m' := k + 1) hi₀ + have hl := A'.link_of_ne hΘ (H.cell_ne_cut hΘ hni) hi₀ hy + obtain rfl := A'.eq_of_linked_left hΘ hl hk₂ (A'.mem_of_getElem? hΘ hy) + exact ⟨_, hn, hL ▸ hpos (k + 1), i₀, hy, hi₀'⟩ + · obtain ⟨i₂, hi₂⟩ := A'.exists_getElem? hΘ hk₂ + obtain ⟨x, hx₁, hx₂⟩ := H.transfer_bwd hΘ hz hi₀ hi₂ + obtain rfl : x = v := by + rw [hi₀'] at hx₁ + exact (Option.some.inj hx₁).symm + exact ⟨_, C.mem_N _, hL ▸ hpos (k + 1), i₂, hi₂, hx₂⟩ + · rintro k hk₁ hk₂ ⟨n, hn, hkn, i₀, hi₀, hi₀'⟩ + obtain rfl := H.pos_eq_of_mem' hΘ hn hkn (hpos (k + 1)) + rcases hstep k with ⟨hL, hni⟩ | ⟨hL, hz⟩ + · obtain ⟨y, hy⟩ := A'.exists_term hΘ (m' := k) hi₀ + have hl := A'.link_of_ne hΘ (H.cell_ne_cut hΘ hni) hy hi₀ + have heq := A'.eq_of_linked_right hΘ hl (A'.mem_of_getElem? hΘ hy) hk₁ + subst heq + exact ⟨_, hn, hL.symm ▸ hpos k, i₀, hy, hi₀'⟩ + · obtain ⟨i₂, hi₂⟩ := A'.exists_getElem? hΘ hk₁ + obtain ⟨x, hx₁, hx₂⟩ := H.transfer_bwd hΘ hz hi₂ hi₀ + obtain rfl : x = v := by + rw [hL, hx₂] at hi₀' + exact Option.some.inj hi₀' + exact ⟨_, C.mem_N _, hpos k, i₂, hi₂, hx₁⟩ + obtain ⟨n, hn, hkn, i₀, hi₀, hi₀'⟩ := hR + obtain rfl := (H.pos_eq_of_mem' (Θ := Θ) hΘ hn hkn (hpos b)).trans + (H.pos_eq_of_mem' hΘ hn₂ h₂.1 (hpos b)).symm + obtain rfl := eq_of_getElem?_eq ((A'.labelled Θ hΘ).nodup b) hi₀ hj + exact hi₀' + +/-- Claim (2) of the proof of (9.1), and `η(v) ⊆ V(G')`. -/ +theorem claim_2 {v : α} (hv : v ∈ Q.G.vertexSet) : (etaVert A A' ζn v).Nonempty := by + have hvs := hv + rw [show Q.G.vertexSet = _ from A.h.vertexSet_eq] at hvs + rcases hvs with ⟨n, hn, rfl⟩ | hvs + · obtain ⟨n', hn'⟩ := H.infl.node_nonempty n hn + exact ⟨_, Or.inl ⟨n, hn, rfl, n', hn', rfl⟩⟩ + · simp only [mem_iUnion, exists_prop] at hvs + obtain ⟨n, ⟨hnN, hnb⟩, hvn⟩ := hvs + obtain ⟨Θ, hΘ, hnΘ⟩ : ∃ Θ ∈ cuffs X.S, n ∈ Θ := + ⟨_, ⟨n, hnb, rfl⟩, mem_connectedComponentIn hnb⟩ + obtain ⟨L, -, -, hpos, -, -, hsurj⟩ := H.exists_lift' hΘ + obtain ⟨a, ha, rfl⟩ := (A.C Θ hΘ).exists_pos n ⟨hnN, hnΘ⟩ + obtain ⟨m', -, hm'⟩ := hsurj a ha + obtain ⟨i, hi⟩ := A.exists_getElem? hΘ hvn + have hlen : i < (A'.π ((A'.C Θ hΘ).pos m')).length := by + rw [(A'.labelled Θ hΘ).length_eq, ← (A.labelled Θ hΘ).length_eq a] + exact (List.getElem?_eq_some_iff.mp hi).1 + exact ⟨_, Or.inr ⟨Θ, hΘ, _, ⟨hnN, hnΘ⟩, (A'.C Θ hΘ).pos m', ⟨hm' ▸ hpos m', + (A'.C Θ hΘ).mem_cuff m'⟩, i, hi, List.getElem?_eq_getElem hlen⟩⟩ + +theorem eta_subset (v : α) : etaVert A A' ζn v ⊆ Q'.G.vertexSet := by + rintro v' (⟨n, hn, -, n', hn', rfl⟩ | ⟨Θ, hΘ, n, hn, n', hn', i, -, hi⟩) + · exact A'.h.node_mem _ (H.infl.node_subset _ hn hn') + · have hN' : n' ∈ A'.Γ.N ∩ Θ := ⟨H.infl.node_subset _ hn.1 hn'.1, hn'.2⟩ + exact A'.h.border_subset _ ⟨hN'.1, cuff_subset_bd hΘ hN'.2⟩ (A'.mem_border_of_term hΘ hN' hi) + +/-- Claim (4) of the proof of (9.1). -/ +theorem claim_4 {v₁ v₂ : α} (hne : v₁ ≠ v₂) : + Disjoint (etaVert A A' ζn v₁) (etaVert A A' ζn v₂) := by + have hnodes : ∀ {a : α} {n n' : X.S} {Θ : Set X.S}, Θ ∈ cuffs X.S → n ∈ A'.Γ.N ∩ Θ → n' ∈ A'.Γ.N → + A'.h.node n' = a → ∀ i : ℕ, (A'.π n)[i]? = some a → False := by + intro a n n' Θ hΘ hn hn' hna i hi + have h₁ := A'.mem_border_of_term hΘ hn hi + exact Set.disjoint_left.mp (A'.h.border_disjoint _ ⟨hn.1, cuff_subset_bd hΘ hn.2⟩) h₁ + ⟨n', hn', hna⟩ + rw [Set.disjoint_left] + rintro a (⟨n₁, h₁, rfl, n₁', h₃, h₄⟩ | ⟨Θ₁, hΘ₁, n₁, h₁, n₁', h₃, i, h₅, h₆⟩) + (⟨n₂, h₁', hv, n₂', h₃', h₄'⟩ | ⟨Θ₂, hΘ₂, n₂, h₁', n₂', h₃', j, h₅', h₆'⟩) + · have hN₁ := H.infl.node_subset _ h₁ h₃ + have hN₂ := H.infl.node_subset _ h₁' h₃' + have heq : n₁' = n₂' := A'.h.node_injOn hN₁ hN₂ (h₄.trans h₄'.symm) + subst heq + have hnn : n₁ = n₂ := by + by_contra hc + exact Set.disjoint_left.mp (H.infl.node_disjoint _ h₁ _ h₁' hc) h₃ h₃' + exact hne (by rw [hnn, hv]) + · exact hnodes hΘ₂ ⟨H.infl.node_subset _ h₁'.1 h₃'.1, h₃'.2⟩ (H.infl.node_subset _ h₁ h₃) h₄ j h₆' + · exact hnodes hΘ₁ ⟨H.infl.node_subset _ h₁.1 h₃.1, h₃.2⟩ (H.infl.node_subset _ h₁' h₃') h₄' i h₆ + · have hN₁ : n₁' ∈ A'.Γ.N ∩ Θ₁ := ⟨H.infl.node_subset _ h₁.1 h₃.1, h₃.2⟩ + have hN₂ : n₂' ∈ A'.Γ.N ∩ Θ₂ := ⟨H.infl.node_subset _ h₁'.1 h₃'.1, h₃'.2⟩ + have hm₁ := A'.mem_border_of_term hΘ₁ hN₁ h₆ + have hm₂ := A'.mem_border_of_term hΘ₂ hN₂ h₆' + by_cases hΘ : Θ₁ = Θ₂ + · subst hΘ + have := H.claim_3 hΘ₁ h₁.1 h₁'.1 h₃ h₃' h₅ h₆ h₆' + rw [h₅'] at this + exact hne (Option.some.inj this).symm + · exact Set.disjoint_left.mp (A'.h.border_cuffs _ hΘ₁ _ hΘ₂ hΘ _ hN₁ _ hN₂) hm₁ hm₂ + +end InflationHyp + +end Main + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section9f.lean b/LeanPool/GraphMinor/GM20/Section9f.lean new file mode 100644 index 0000000000..c0c808fba5 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section9f.lean @@ -0,0 +1,280 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section9e + +/-! +# Graph Minors XX, Section 9: the expansion + +This file proves claims (5), (6) and (7) of the proof of (9.1): the sets `η(v)` of `Section9e` and +the map +`η(c) = ζ(c)` form an expansion of `P` in `P'`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface GraphMinor.GM04 GraphMinor.GM18 GraphMinor.GM10 Hypergraph + +universe u v + +variable {α : Type u} {β : Type v} + +/-- The bijection between two marches maps a free patch to a free patch, since it maps a grouping to +a +grouping. -/ +theorem marchMap_mem_of_isFree {α' : Type*} {μ : List α} {μ' : List α'} {Δ : Patch α} {Δ' : Patch + α'} + (hnd : μ.Nodup) (hnd' : μ'.Nodup) (hlen : μ.length = μ'.length) (hV : Δ.verts = {x | x ∈ μ}) + (hV' : Δ'.verts = {x | x ∈ μ'}) (hfree : Δ'.IsFree) {δ : (⊤ : SimpleGraph α).Subgraph} + (hδ : δ ∈ Δ) : marchMapSubgraph μ μ' δ ∈ Δ' := by + have hverts := Δ.verts_eq δ hδ + have huniq₁ : ∀ {x y y'}, MarchCorresponds μ μ' x y → MarchCorresponds μ μ' x y' → y = y' := + fun h₁ h₂ ↦ marchCorresponds_unique_right hnd h₁ h₂ + have huniq₂ : ∀ {x x' y}, MarchCorresponds μ μ' x y → MarchCorresponds μ μ' x' y → x = x' := + fun h₁ h₂ ↦ marchCorresponds_unique_left hnd' h₁ h₂ + have hset : (marchMapSubgraph μ μ' δ).verts = Δ'.verts := by + rw [hV'] + ext y + constructor + · rintro ⟨x, -, p, -, h₂, -, rfl⟩ + exact List.getElem_mem h₂ + · intro hy + obtain ⟨i, hi, rfl⟩ := List.getElem_of_mem hy + have hi' : i < μ.length := hlen ▸ hi + refine ⟨μ[i], ?_, i, hi', hi, rfl, rfl⟩ + rw [hverts, hV] + exact List.getElem_mem hi' + refine hfree _ ?_ hset + have hg := isGrouping_iff.mp (Δ.isGrouping δ hδ) + refine isGrouping_iff.mpr ⟨hset.le, ?_⟩ + rintro a b c hac ⟨-, x₁, x₂, h₁, h₂, h₃⟩ ⟨-, x₃, x₄, h₄, h₅, h₆⟩ + obtain rfl := huniq₂ h₂ h₄ + have hne : x₁ ≠ x₄ := fun heq ↦ hac (huniq₁ h₁ (heq ▸ h₅)) + exact ⟨hac, x₁, x₄, h₁, h₅, hg.2 _ _ _ hne h₃ h₆⟩ + +section Main + +variable {Ω : Type*} [Preorder Ω] {X : GradedSurface} {F : CuffParam X.S} {Q Q' : Patchwork Ω α β} + {A : Side X F Q} {A' : Side X F Q'} {ζn : X.S → Set X.S} {ζc : Set X.S → Set X.S} {K : ℕ} + (H : InflationHyp A A' ζn ζc K) + +open Classical in +/-- The map `η` on edges. -/ +noncomputable def etaEdge (A : Side X F Q) (A' : Side X F Q') (ζc : Set X.S → Set X.S) (e : β) : β + := + A'.h.cell (ζc (Function.invFunOn A.h.cell A.Γ.C e)) + +omit [Preorder Ω] in +theorem etaEdge_cell {c : Set X.S} (hc : c ∈ A.Γ.C) : + etaEdge A A' ζc (A.h.cell c) = A'.h.cell (ζc c) := by + have h₁ : Function.invFunOn A.h.cell A.Γ.C (A.h.cell c) = c := + A.h.cell_bijOn.injOn (Function.invFunOn_mem ⟨c, hc, rfl⟩) hc + (Function.invFunOn_eq ⟨c, hc, rfl⟩) + simp only [etaEdge, h₁] + +theorem Side.length_γ {Γ : Painting X.S} {c : Set X.S} (hc : c ∈ Γ.C) : + (Γ.γ c).length = (tilde c).ncard := by + classical + rw [← Γ.γ_set c hc] + have h₁ : {n | n ∈ Γ.γ c} = ↑(Γ.γ c).toFinset := by + ext x + simp + rw [h₁, Set.ncard_coe_finset, List.toFinset_card_of_nodup (Γ.γ_nodup c hc)] + +namespace InflationHyp + +include H + +theorem length_γ_image {c : Set X.S} (hc : c ∈ A.Γ.C) : + (A.Γ.γ c).length = (A'.Γ.γ (ζc c)).length := by + rw [Side.length_γ hc, Side.length_γ (H.infl.cell_mem c hc), H.infl.cell_size c hc] + +theorem isBorder_image {c : Set X.S} (hc : c ∈ A.Γ.C) : + Painting.IsBorder (ζc c) ↔ Painting.IsBorder c := Painting.isBorder_image H.infl hc + +/-- Claims (5) and the case of a border cell in (6). -/ +theorem border_cell_facts {Θ : Set X.S} (hΘ : Θ ∈ cuffs X.S) (m : ℕ) : + ∃ m', ζc ((A.C Θ hΘ).cell m) = (A'.C Θ hΘ).cell m' ∧ + (A'.C Θ hΘ).pos m' ∈ ζn ((A.C Θ hΘ).pos m) ∧ + (A'.C Θ hΘ).pos (m' + 1) ∈ ζn ((A.C Θ hΘ).pos (m + 1)) := by + have hc := (A.C Θ hΘ).cell_mem m + obtain ⟨m', -, hm'⟩ := (A'.C Θ hΘ).exists_cell _ (H.infl.cell_mem _ hc) + ((H.infl.borders_iff _ hc Θ hΘ).mp ((A.C Θ hΘ).meets m)) + obtain ⟨h₁, h₂⟩ := image_cell H.infl hΘ _ _ hm'.symm + exact ⟨m', hm'.symm, h₁, h₂⟩ + +/-- Claim (5) of the proof of (9.1), for an internal cell. -/ +theorem μ_mem_internal {c : Set X.S} (hc : c ∈ A.Γ.C) (hb : ¬ Painting.IsBorder c) (i : ℕ) + (hi : i < (Q.μ (A.h.cell c)).length) (hi' : i < (Q'.μ (A'.h.cell (ζc c))).length) : + (Q'.μ (A'.h.cell (ζc c)))[i] ∈ etaVert A A' ζn (Q.μ (A.h.cell c))[i] := by + have hc' := H.infl.cell_mem c hc + have hb' : ¬ Painting.IsBorder (ζc c) := fun h₁ ↦ hb ((H.isBorder_image hc).mp h₁) + have hμ := A.μ_internal c hc hb + have hμ' := A'.μ_internal _ hc' hb' + have hlen : i < (A.Γ.γ c).length := by + rw [hμ] at hi + simpa using hi + have hlen' : i < (A'.Γ.γ (ζc c)).length := by + rw [hμ'] at hi' + simpa using hi' + have hn : (A.Γ.γ c)[i] ∈ A.Γ.N := by + have h₁ : (A.Γ.γ c)[i] ∈ {n | n ∈ A.Γ.γ c} := List.getElem_mem hlen + rw [A.Γ.γ_set c hc] at h₁ + exact tilde_subset_N A.Γ hc h₁ + refine Or.inl ⟨_, hn, ?_, _, (H.infl.nodes _ hn c hc i hlen hlen').mp rfl, ?_⟩ + · simp only [hμ, List.getElem_map] + · simp only [hμ', List.getElem_map] + +/-- Claim (5) of the proof of (9.1), for a border cell. -/ +theorem μ_mem_border {c : Set X.S} (hc : c ∈ A.Γ.C) (hb : Painting.IsBorder c) (i : ℕ) + (hi : i < (Q.μ (A.h.cell c)).length) (hi' : i < (Q'.μ (A'.h.cell (ζc c))).length) : + (Q'.μ (A'.h.cell (ζc c)))[i] ∈ etaVert A A' ζn (Q.μ (A.h.cell c))[i] := by + obtain ⟨Θ, hΘ, hcΘ⟩ := exists_cuff_of_isBorder hb + obtain ⟨m, -, rfl⟩ := (A.C Θ hΘ).exists_cell c hc hcΘ + obtain ⟨m', hm', h₁, h₂⟩ := H.border_cell_facts hΘ m + have ha := aligned_cell A A' H.infl H.ψ_le H.two_le H.bounded H.bounded' hΘ hm' + revert hi' + rw [hm'] + intro hi' + set r := Q.μ (A.h.cell ((A.C Θ hΘ).cell m)) + set r' := Q'.μ (A'.h.cell ((A'.C Θ hΘ).cell m')) + have hbk := H.bounded _ hc hb + have hq : i < K := hi.trans_le hbk + have hri : r[(⟨i, hq⟩ : Fin K).1]? = some r[i] := List.getElem?_eq_getElem hi + have hri' : r'[(⟨i, hq⟩ : Fin K).1]? = some r'[i] := List.getElem?_eq_getElem hi' + have hd : A.h.cell ((A.C Θ hΘ).cell m) ∈ Q.dom := by + rw [A.dom_eq] + exact A.h.cell_bijOn.mapsTo hc + have hvs : r[i] ∈ Q.G.ends (A.h.cell ((A.C Θ hΘ).cell m)) := by + rw [← Q.μ_set _ hd] + exact List.getElem_mem hi + rw [show Q.G.ends (A.h.cell ((A.C Θ hΘ).cell m)) = _ from A.h.ends_border _ hc hb, + (A.C Θ hΘ).tilde_eq] at hvs + have hN₁ := (A.C Θ hΘ).mem_N m + have hN₂ := (A.C Θ hΘ).mem_N (m + 1) + have hΘ₁ := (A.C Θ hΘ).mem_cuff m + have hΘ₂ := (A.C Θ hΘ).mem_cuff (m + 1) + have hlab : ∀ {n n' : X.S} {code : Prop} (_ : n ∈ A.Γ.N ∩ Θ) (_ : n' ∈ ζn n ∩ Θ) + (_ : marchCode K r (A.π n) = marchCode K r' (A'.π n')) (_ : (A.π n).length ≤ K) + (_ : r[i] ∈ A.h.border n) (_ : code), r'[i] ∈ etaVert A A' ζn r[i] := by + intro n n' code hn hn' hcd hlen hmem _ + obtain ⟨a, -, rfl⟩ := (A.C Θ hΘ).exists_pos n hn + change r[i] ∈ A.h.border ((A.C Θ hΘ).pos a) at hmem + obtain ⟨j, hj⟩ := A.exists_getElem? hΘ hmem + obtain ⟨y, hy, hy'⟩ := marchCode_forward hcd hlen hj hri + have : r'[i] = y := by + rw [hri'] at hy' + exact Option.some.inj hy' + rw [this] + exact Or.inr ⟨Θ, hΘ, _, hn, n', hn', j, hj, hy⟩ + rcases hvs with ⟨n, hn, hnv⟩ | hvs + · rcases hn with rfl | rfl + · have heq : r[i] = A.h.node ((A.C Θ hΘ).pos m) := hnv.symm + have h₃ := ha.node₁ ⟨i, hq⟩ (by rw [hri, heq]) + rw [hri'] at h₃ + exact Or.inl ⟨_, hN₁, hnv, _, h₁, (Option.some.inj h₃).symm⟩ + · have heq : r[i] = A.h.node ((A.C Θ hΘ).pos (m + 1)) := hnv.symm + have h₃ := ha.node₂ ⟨i, hq⟩ (by rw [hri, heq]) + rw [hri'] at h₃ + exact Or.inl ⟨_, hN₂, hnv, _, h₂, (Option.some.inj h₃).symm⟩ + · simp only [mem_iUnion, exists_prop] at hvs + obtain ⟨n, hn, hvn⟩ := hvs + rcases hn with rfl | rfl + · exact hlab (code := True) ⟨hN₁, hΘ₁⟩ ⟨h₁, (A'.C Θ hΘ).mem_cuff m'⟩ ha.code₁ + (A.length_π_le hΘ H.bounded m) hvn trivial + · exact hlab (code := True) ⟨hN₂, hΘ₂⟩ ⟨h₂, (A'.C Θ hΘ).mem_cuff (m' + 1)⟩ ha.code₂ + (A.length_π_le hΘ H.bounded (m + 1)) hvn trivial + +/-- Claim (7) of the proof of (9.1): `η` is an expansion of `P` in `P'`. -/ +theorem isExpansion : IsExpansion Q Q' (etaVert A A' ζn) (etaEdge A A' ζc) := by + have hdom : ∀ {c}, c ∈ A.Γ.C → A.h.cell c ∈ Q.dom := fun hc ↦ by + rw [A.dom_eq] + exact A.h.cell_bijOn.mapsTo hc + have hdom' : ∀ {c}, c ∈ A'.Γ.C → A'.h.cell c ∈ Q'.dom := fun hc ↦ by + rw [A'.dom_eq] + exact A'.h.cell_bijOn.mapsTo hc + have hsurj : ∀ {e}, e ∈ Q.G.edgeSet → ∃ c ∈ A.Γ.C, A.h.cell c = e := fun he ↦ + A.h.cell_bijOn.surjOn he + have hsurjd : ∀ {e}, e ∈ Q.dom → ∃ c ∈ A.Γ.C, A.h.cell c = e := fun he ↦ by + rw [A.dom_eq] at he + exact hsurj he + have hlength : ∀ c ∈ A.Γ.C, (Q.μ (A.h.cell c)).length = (Q'.μ (A'.h.cell (ζc c))).length := by + intro c hc + have hc' := H.infl.cell_mem c hc + by_cases hb : Painting.IsBorder c + · obtain ⟨Θ, hΘ, hcΘ⟩ := exists_cuff_of_isBorder hb + obtain ⟨m, -, rfl⟩ := (A.C Θ hΘ).exists_cell c hc hcΘ + obtain ⟨m', hm', -, -⟩ := H.border_cell_facts hΘ m + rw [hm'] + exact (aligned_cell A A' H.infl H.ψ_le H.two_le H.bounded H.bounded' hΘ hm').length_eq + · have hb' : ¬ Painting.IsBorder (ζc c) := fun h₁ ↦ hb ((H.isBorder_image hc).mp h₁) + rw [A.μ_internal c hc hb, A'.μ_internal _ hc' hb', List.length_map, List.length_map] + exact H.length_γ_image hc + refine ⟨fun v hv ↦ H.claim_2 hv, fun v _ ↦ H.eta_subset v, fun e he ↦ ?_, + fun v₁ _ v₂ _ hne ↦ H.claim_4 hne, ?_, fun e he ↦ ?_, fun e he hnd ↦ ?_, fun e he ↦ ?_, + fun e he i hi hi' ↦ ?_, ?_, ?_, fun e he ↦ ?_, fun e he ↦ ?_⟩ + · obtain ⟨c, hc, rfl⟩ := hsurj he + rw [etaEdge_cell hc] + exact A'.h.cell_bijOn.mapsTo (H.infl.cell_mem c hc) + · intro e₁ he₁ e₂ he₂ heq + obtain ⟨c₁, hc₁, rfl⟩ := hsurj he₁ + obtain ⟨c₂, hc₂, rfl⟩ := hsurj he₂ + rw [etaEdge_cell hc₁, etaEdge_cell hc₂] at heq + exact congrArg _ (H.infl.cell_injOn hc₁ hc₂ (A'.h.cell_bijOn.injOn (H.infl.cell_mem _ hc₁) + (H.infl.cell_mem _ hc₂) heq)) + · obtain ⟨c, hc, rfl⟩ := hsurj he + rw [etaEdge_cell hc] + exact ⟨fun _ ↦ hdom' (H.infl.cell_mem c hc), fun _ ↦ hdom hc⟩ + · exact absurd (by rw [A.dom_eq]; exact he) hnd + · obtain ⟨c, hc, rfl⟩ := hsurjd he + rw [etaEdge_cell hc] + exact hlength c hc + · obtain ⟨c, hc, rfl⟩ := hsurjd he + revert hi' + rw [etaEdge_cell hc] + intro hi' + by_cases hb : Painting.IsBorder c + · exact H.μ_mem_border hc hb i hi hi' + · exact H.μ_mem_internal hc hb i hi hi' + · rw [A.roots_nil, A'.roots_nil] + · intro i hi + rw [A.roots_nil] at hi + exact absurd hi (Nat.not_lt_zero i) + · obtain ⟨c, hc, rfl⟩ := hsurjd he + rw [etaEdge_cell hc] + have hc' := H.infl.cell_mem c hc + have hE := A.h.cell_bijOn.mapsTo hc + have hE' := A'.h.cell_bijOn.mapsTo hc' + have hV : (Q.Δ (A.h.cell c)).verts = {x | x ∈ Q.μ (A.h.cell c)} := by + rw [Q.Δ_verts _ hE, Q.μ_set _ (hdom hc)] + have hV' : (Q'.Δ (A'.h.cell (ζc c))).verts = {x | x ∈ Q'.μ (A'.h.cell (ζc c))} := by + rw [Q'.Δ_verts _ hE', Q'.μ_set _ (hdom' hc')] + by_cases hb : Painting.IsBorder c + · have hb' := (H.isBorder_image hc).mpr hb + have hcode := code_eq_of_ψ A A' hc hb H.infl (H.ψ_le c hc) + simp only [Side.code, Prod.mk.injEq] at hcode + obtain ⟨-, h₀, -, -, -, hp⟩ := hcode + exact mapsTo_of_code (H.bounded _ hc hb) (H.bounded' _ hc' hb') (A.μ_nodup hc) + (A'.μ_nodup hc') (fun _ h ↦ h) (fun _ h ↦ h) hV hV' h₀ hp + · have hb' : ¬ Painting.IsBorder (ζc c) := fun h₁ ↦ hb ((H.isBorder_image hc).mp h₁) + intro δ hδ + exact marchMap_mem_of_isFree (A.μ_nodup hc) (A'.μ_nodup hc') (hlength c hc) hV hV' + (A'.free_internal _ hc' hb') hδ + · obtain ⟨c, hc, rfl⟩ := hsurj he + rw [etaEdge_cell hc] + exact φ_le_of_ψ A A' hc H.infl (H.ψ_le c hc) + +end InflationHyp + +end Main + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section9g.lean b/LeanPool/GraphMinor/GM20/Section9g.lean new file mode 100644 index 0000000000..26853df0e3 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section9g.lean @@ -0,0 +1,315 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section9f + +/-! +# Graph Minors XX, Section 9: the realization + +This file proves the rest of the proof of (9.1). For each cell `c'` of `Γ'` outside the image of `ζ` +we +choose `δ_{c'} ∈ Δ'(c')` as in the paper (`exists_delta`), and `H` is the union of these groupings +(`realizationGraph`). Every edge of `H` either joins two nodes of one `ζ(n)`, or joins the two `i`th +terms of +the marches at the ends of a border cell outside the image of `ζ` (`adj_cases`). This gives claims +(8) and +(12). Claims (9), (10) and (11) show that each `η(v)` is connected in `H`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface GraphMinor.GM04 GraphMinor.GM18 GraphMinor.GM10 Hypergraph + +universe u v + +variable {α : Type u} {β : Type v} + +section Main + +variable {Ω : Type*} [Preorder Ω] {X : GradedSurface} {F : CuffParam X.S} {Q Q' : Patchwork Ω α β} + {A : Side X F Q} {A' : Side X F Q'} {ζn : X.S → Set X.S} {ζc : Set X.S → Set X.S} {K : ℕ} + +/-- The grouping `K` of an internal cell `c'`: two of its nodes are adjacent if they lie in one +`ζ(n)`. -/ +def innerGrouping (A : Side X F Q) (A' : Side X F Q') (ζn : X.S → Set X.S) (c' : Set X.S) : + (⊤ : SimpleGraph α).Subgraph where + verts := A'.h.node '' tilde c' + Adj x y := x ≠ y ∧ ∃ n ∈ A.Γ.N, ∃ a ∈ ζn n ∩ tilde c', ∃ b ∈ ζn n ∩ tilde c', + x = A'.h.node a ∧ y = A'.h.node b + adj_sub h := h.1 + edge_vert := by + rintro x y ⟨-, n, -, a, ha, b, -, rfl, -⟩ + exact ⟨a, ha.2, rfl⟩ + symm := ⟨by + rintro x y ⟨hne, n, hn, a, ha, b, hb, rfl, rfl⟩ + exact ⟨hne.symm, n, hn, b, hb, a, ha, rfl, rfl⟩⟩ + +variable (H : InflationHyp A A' ζn ζc K) + +include H + +theorem innerGrouping_mem {c' : Set X.S} (hc' : c' ∈ A'.Γ.C) (hb : ¬ Painting.IsBorder c') : + innerGrouping A A' ζn c' ∈ Q'.Δ (A'.h.cell c') := by + have hE := A'.h.cell_bijOn.mapsTo hc' + have hV : (Q'.Δ (A'.h.cell c')).verts = A'.h.node '' tilde c' := by + rw [Q'.Δ_verts _ hE] + exact A'.h.ends_internal c' hc' hb + refine A'.free_internal c' hc' hb _ ?_ hV.symm + rw [hV] + refine isGrouping_iff.mpr ⟨subset_rfl, ?_⟩ + rintro x y z hxz ⟨-, n, hn, a, ha, b, hb₁, rfl, rfl⟩ ⟨-, n₂, hn₂, a₂, ha₂, b₂, hb₂, h₁, rfl⟩ + have hsub := tilde_subset_N A'.Γ hc' + have heq : b = a₂ := A'.h.node_injOn (hsub hb₁.2) (hsub ha₂.2) h₁ + subst heq + have hnn : n = n₂ := by + by_contra hc + exact Set.disjoint_left.mp (H.infl.node_disjoint _ hn _ hn₂ hc) hb₁.1 ha₂.1 + subst hnn + exact ⟨hxz, n, hn, a, ha, b₂, hb₂, rfl, rfl⟩ + +/-- The choice of `δ_{c'}`. -/ +theorem exists_delta {c' : Set X.S} (hc' : c' ∈ A'.Γ.C) : + ∃ δ, δ ∈ Q'.Δ (A'.h.cell c') ∧ + (¬ Painting.IsBorder c' → δ = innerGrouping A A' ζn c') ∧ + (Painting.IsBorder c' → (∀ x y, δ.Adj x y → (A'.M c').Adj x y) ∧ + (∀ x y, (A'.M c').Adj x y → x ∉ A'.h.node '' A'.Γ.N → δ.Adj x y) ∧ + ∀ a b, a ≠ b → a ∈ tilde c' → b ∈ tilde c' → δ.Adj (A'.h.node a) (A'.h.node b) ∨ + ∃ c'' ∈ A'.Γ.C, ¬ Painting.IsBorder c'' ∧ a ∈ tilde c'' ∧ b ∈ tilde c'') := by + by_cases hb : Painting.IsBorder c' + · obtain ⟨Θ, hΘ, hcΘ⟩ := exists_cuff_of_isBorder hb + obtain ⟨m, -, rfl⟩ := (A'.C Θ hΘ).exists_cell c' hc' hcΘ + have hp := (A'.labelled Θ hΘ).pair m + have hsym : ∀ a b, a ≠ b → a ∈ tilde ((A'.C Θ hΘ).cell m) → b ∈ tilde ((A'.C Θ hΘ).cell m) → + (a = (A'.C Θ hΘ).pos m ∧ b = (A'.C Θ hΘ).pos (m + 1)) ∨ + (a = (A'.C Θ hΘ).pos (m + 1) ∧ b = (A'.C Θ hΘ).pos m) := by + intro a b hne ha hb + rw [(A'.C Θ hΘ).tilde_eq] at ha hb + rcases ha with rfl | rfl <;> rcases hb with rfl | rfl + · exact absurd rfl hne + · exact Or.inl ⟨rfl, rfl⟩ + · exact Or.inr ⟨rfl, rfl⟩ + · exact absurd rfl hne + have hmain : ∀ u v, A'.Γ.γ ((A'.C Θ hΘ).cell m) = [u, v] → + (u = (A'.C Θ hΘ).pos m ∧ v = (A'.C Θ hΘ).pos (m + 1)) ∨ + (u = (A'.C Θ hΘ).pos (m + 1) ∧ v = (A'.C Θ hΘ).pos m) → + ∃ δ, δ ∈ Q'.Δ (A'.h.cell ((A'.C Θ hΘ).cell m)) ∧ + (¬ Painting.IsBorder ((A'.C Θ hΘ).cell m) → δ = innerGrouping A A' ζn ((A'.C Θ hΘ).cell m)) + ∧ + (Painting.IsBorder ((A'.C Θ hΘ).cell m) → (∀ x y, δ.Adj x y → (A'.M + ((A'.C Θ hΘ).cell m)).Adj x y) ∧ + (∀ x y, (A'.M ((A'.C Θ hΘ).cell m)).Adj x y → x ∉ A'.h.node '' A'.Γ.N → δ.Adj x y) ∧ + ∀ a b, a ≠ b → a ∈ tilde ((A'.C Θ hΘ).cell m) → b ∈ tilde ((A'.C Θ hΘ).cell m) → + δ.Adj (A'.h.node a) (A'.h.node b) ∨ + ∃ c'' ∈ A'.Γ.C, ¬ Painting.IsBorder c'' ∧ a ∈ tilde c'' ∧ b ∈ tilde c'') := by + intro u v hγ huv + rcases A'.M_mem _ hc' hb u v hγ with h₁ | ⟨h₁, c'', hc'', hin, hu, hv⟩ + · refine ⟨_, h₁, fun h₂ ↦ absurd hb h₂, fun _ ↦ ⟨fun _ _ h ↦ h, fun _ _ h _ ↦ h, ?_⟩⟩ + intro a b hne ha hb₂ + left + rcases hsym a b hne ha hb₂ with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hp.adj + · exact hp.adj.symm + · refine ⟨_, h₁, fun h₂ ↦ absurd hb h₂, fun _ ↦ ⟨fun _ _ h ↦ h.1, fun x y h hx ↦ ⟨h, ?_⟩, ?_⟩⟩ + · intro hmem + have h₂ : s(x, y) = s(A'.h.node u, A'.h.node v) := hmem + have hN : ∀ {n}, n = (A'.C Θ hΘ).pos m ∨ n = (A'.C Θ hΘ).pos (m + 1) → + A'.h.node n ∈ A'.h.node '' A'.Γ.N := by + rintro n (rfl | rfl) + · exact ⟨_, (A'.C Θ hΘ).mem_N _, rfl⟩ + · exact ⟨_, (A'.C Θ hΘ).mem_N _, rfl⟩ + have hu' : A'.h.node u ∈ A'.h.node '' A'.Γ.N := + hN (huv.elim (fun h ↦ Or.inl h.1) fun h ↦ Or.inr h.1) + have hv' : A'.h.node v ∈ A'.h.node '' A'.Γ.N := + hN (huv.elim (fun h ↦ Or.inr h.2) fun h ↦ Or.inl h.2) + rcases Sym2.eq_iff.mp h₂ with ⟨rfl, -⟩ | ⟨rfl, -⟩ + · exact hx hu' + · exact hx hv' + · intro a b hne ha hb₂ + right + refine ⟨c'', hc'', hin, ?_⟩ + rcases hsym a b hne ha hb₂ with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ <;> + rcases huv with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨hu, hv⟩ + · exact ⟨hv, hu⟩ + · exact ⟨hv, hu⟩ + · exact ⟨hu, hv⟩ + rcases (A'.C Θ hΘ).γ_eq m with h₁ | h₁ + · exact hmain _ _ h₁ (Or.inl ⟨rfl, rfl⟩) + · exact hmain _ _ h₁ (Or.inr ⟨rfl, rfl⟩) + · exact ⟨_, innerGrouping_mem H hc' hb, fun _ ↦ rfl, fun h₂ ↦ absurd h₂ hb⟩ + +/-- A cell with two nodes in one `ζ(n)` is not in the image of `ζ`, by the sixth condition of a +linear +inflation. -/ +theorem not_image_of_two_nodes {c' : Set X.S} {n a b : X.S} (hn : n ∈ A.Γ.N) (hne : a ≠ b) + (ha : a ∈ ζn n ∩ tilde c') (hb : b ∈ ζn n ∩ tilde c') : c' ∉ ζc '' A.Γ.C := by + rintro ⟨c, hc, rfl⟩ + have hc' := H.infl.cell_mem c hc + have hset := A'.Γ.γ_set _ hc' + have ha₁ : a ∈ A'.Γ.γ (ζc c) := by + have : a ∈ {n | n ∈ A'.Γ.γ (ζc c)} := hset ▸ ha.2 + exact this + have hb₁ : b ∈ A'.Γ.γ (ζc c) := by + have : b ∈ {n | n ∈ A'.Γ.γ (ζc c)} := hset ▸ hb.2 + exact this + obtain ⟨i, hi, rfl⟩ := List.getElem_of_mem ha₁ + obtain ⟨j, hj, rfl⟩ := List.getElem_of_mem hb₁ + have hlen := H.length_γ_image hc + have hi' : i < (A.Γ.γ c).length := hlen ▸ hi + have hj' : j < (A.Γ.γ c).length := hlen ▸ hj + have h₁ := (H.infl.nodes n hn c hc i hi' hi).mpr ha.1 + have h₂ := (H.infl.nodes n hn c hc j hj' hj).mpr hb.1 + have hij : i = j := (A.Γ.γ_nodup c hc).getElem_inj_iff.mp (h₁.trans h₂.symm) + subst hij + exact hne rfl + +/-- The two kinds of edges of `H`: an edge between two nodes of one `ζ(n)`. -/ +def NodeEdge (A : Side X F Q) (A' : Side X F Q') (ζn : X.S → Set X.S) (x y : α) : Prop := + ∃ n ∈ A.Γ.N, ∃ a ∈ ζn n, ∃ b ∈ ζn n, x = A'.h.node a ∧ y = A'.h.node b + +/-- The two kinds of edges of `H`: an edge between the `i`th terms of the marches at the ends of a +border cell outside the image of `ζ`. -/ +def TermEdge (A : Side X F Q) (A' : Side X F Q') (ζc : Set X.S → Set X.S) (x y : α) : Prop := + ∃ Θ, ∃ hΘ : Θ ∈ cuffs X.S, ∃ (j i : ℕ), (A'.C Θ hΘ).cell j ∉ ζc '' A.Γ.C ∧ + (((A'.π ((A'.C Θ hΘ).pos j))[i]? = some x ∧ (A'.π ((A'.C Θ hΘ).pos (j + 1)))[i]? = some y) ∨ + ((A'.π ((A'.C Θ hΘ).pos j))[i]? = some y ∧ (A'.π ((A'.C Θ hΘ).pos (j + 1)))[i]? = some x)) + +/-- An edge of the pairing of a border cell outside the image of `ζ` has one of the two kinds. -/ +theorem adj_border {c' : Set X.S} (hc' : c' ∈ A'.Γ.C) (hb : Painting.IsBorder c') + (hni : c' ∉ ζc '' A.Γ.C) {x y : α} (hadj : (A'.M c').Adj x y) : + NodeEdge A A' ζn x y ∨ TermEdge A A' ζc x y := by + obtain ⟨Θ, hΘ, hcΘ⟩ := exists_cuff_of_isBorder hb + obtain ⟨j, -, rfl⟩ := (A'.C Θ hΘ).exists_cell c' hc' hcΘ + have hp := (A'.labelled Θ hΘ).pair j + have hfin := A'.pair_finite hΘ j + have huniq := ((isPairing_iff hfin).mp hp.isPairing).2 + obtain ⟨n, hn, hsub⟩ := H.infl.border_cell _ hc' hb hni + set C' := A'.C Θ hΘ + have h₁ : C'.pos j ∈ ζn n := hsub (A'.mem_tilde_left hΘ j) + have h₂ : C'.pos (j + 1) ∈ ζn n := hsub (A'.mem_tilde_right hΘ j) + have hterm : ∀ {u w : α}, (A'.M (C'.cell j)).Adj u w → u ∈ A'.h.border (C'.pos j) → + w ∈ A'.h.border (C'.pos (j + 1)) → + ∃ i : ℕ, (A'.π (C'.pos j))[i]? = some u ∧ (A'.π (C'.pos (j + 1)))[i]? = some w := by + intro u w huw hu hw + obtain ⟨i, hi⟩ := A'.exists_getElem? hΘ hu + obtain ⟨y₀, hy₀⟩ := A'.exists_term hΘ (m' := j + 1) hi + have hl := A'.link_of_ne hΘ (H.cell_ne_cut hΘ hni) hi hy₀ + have hy₀m := A'.mem_of_getElem? hΘ hy₀ + have hv : u ∈ (A'.M (C'.cell j)).verts := (A'.M (C'.cell j)).edge_vert huw + obtain ⟨z, -, -, hu₂⟩ := hp.existsUnique hfin hv + have : y₀ = w := (hu₂ y₀ (Or.inl hy₀m) hl).trans (hu₂ w (Or.inl hw) (Or.inr huw)).symm + subst this + exact ⟨i, hi, hy₀⟩ + have hvx : x ∈ (A'.M (C'.cell j)).verts := (A'.M (C'.cell j)).edge_vert hadj + have hvy : y ∈ (A'.M (C'.cell j)).verts := (A'.M (C'.cell j)).edge_vert hadj.symm + rw [hp.verts_eq] at hvx hvy + have hnodeL : ∀ {u w : α}, (A'.M (C'.cell j)).Adj u w → + (u = A'.h.node (C'.pos j) ∨ u = A'.h.node (C'.pos (j + 1))) → + (u = A'.h.node (C'.pos j) ∧ w = A'.h.node (C'.pos (j + 1))) ∨ + (u = A'.h.node (C'.pos (j + 1)) ∧ w = A'.h.node (C'.pos j)) := by + rintro u w huw (rfl | rfl) + · exact Or.inl ⟨rfl, huniq _ _ _ huw hp.adj⟩ + · exact Or.inr ⟨rfl, huniq _ _ _ huw hp.adj.symm⟩ + by_cases hxn : x = A'.h.node (C'.pos j) ∨ x = A'.h.node (C'.pos (j + 1)) + · left + rcases hnodeL hadj hxn with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨n, hn, _, h₁, _, h₂, rfl, rfl⟩ + · exact ⟨n, hn, _, h₂, _, h₁, rfl, rfl⟩ + by_cases hyn : y = A'.h.node (C'.pos j) ∨ y = A'.h.node (C'.pos (j + 1)) + · left + rcases hnodeL hadj.symm hyn with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨n, hn, _, h₂, _, h₁, rfl, rfl⟩ + · exact ⟨n, hn, _, h₁, _, h₂, rfl, rfl⟩ + have hxb : x ∈ A'.h.border (C'.pos j) ∪ A'.h.border (C'.pos (j + 1)) := + hvx.resolve_right hxn + have hyb : y ∈ A'.h.border (C'.pos j) ∪ A'.h.border (C'.pos (j + 1)) := + hvy.resolve_right hyn + right + refine ⟨Θ, hΘ, j, ?_⟩ + rcases hxb with hx | hx + · rcases hyb with hy | hy + · exact absurd (A'.eq_of_linked_right hΘ (Or.inr hadj) hx hy) hadj.ne + · obtain ⟨i, h₃, h₄⟩ := hterm hadj hx hy + exact ⟨i, hni, Or.inl ⟨h₃, h₄⟩⟩ + · rcases hyb with hy | hy + · obtain ⟨i, h₃, h₄⟩ := hterm hadj.symm hy hx + exact ⟨i, hni, Or.inr ⟨h₃, h₄⟩⟩ + · exact absurd (A'.eq_of_linked_left hΘ (Or.inr hadj) hx hy).symm hadj.ne + +/-- The graph `H` of the proof of (9.1), with what we use about it. -/ +theorem exists_realization : ∃ R : (⊤ : SimpleGraph α).Subgraph, + (Q'.deleteEdges (etaEdge A A' ζc '' Q.G.edgeSet)).IsRealization R ∧ + (∀ x y, R.Adj x y → NodeEdge A A' ζn x y ∨ TermEdge A A' ζc x y) ∧ + (∀ n ∈ A.Γ.N, ∀ a ∈ ζn n, ∀ b ∈ ζn n, A'.Γ.sk.Adj a b → R.Adj (A'.h.node a) (A'.h.node b)) ∧ + (∀ c' ∈ A'.Γ.C, Painting.IsBorder c' → c' ∉ ζc '' A.Γ.C → ∀ x y, (A'.M c').Adj x y → + x ∉ A'.h.node '' A'.Γ.N → R.Adj x y) := by + classical + choose! δ hδ₁ hδ₂ hδ₃ using fun c' (hc' : c' ∈ A'.Γ.C) ↦ exists_delta H hc' + let g : β → (⊤ : SimpleGraph α).Subgraph := fun e ↦ δ (Function.invFunOn A'.h.cell A'.Γ.C e) + have hg : ∀ {c'}, c' ∈ A'.Γ.C → g (A'.h.cell c') = δ c' := fun {c'} hc' ↦ by + have h₁ : Function.invFunOn A'.h.cell A'.Γ.C (A'.h.cell c') = c' := + A'.h.cell_bijOn.injOn (Function.invFunOn_mem ⟨c', hc', rfl⟩) hc' + (Function.invFunOn_eq ⟨c', hc', rfl⟩) + simp only [g, h₁] + have hedge : ∀ {c'}, c' ∈ A'.Γ.C → c' ∉ ζc '' A.Γ.C → + A'.h.cell c' ∉ etaEdge A A' ζc '' Q.G.edgeSet := by + rintro c' hc' hni ⟨e, he, heq⟩ + obtain ⟨c, hc, rfl⟩ := A.h.cell_bijOn.surjOn he + rw [etaEdge_cell hc] at heq + exact hni ⟨c, hc, A'.h.cell_bijOn.injOn (H.infl.cell_mem c hc) hc' heq⟩ + have hedge₂ : ∀ {e}, e ∈ Q'.G.edgeSet → e ∉ etaEdge A A' ζc '' Q.G.edgeSet → + ∃ c' ∈ A'.Γ.C, c' ∉ ζc '' A.Γ.C ∧ A'.h.cell c' = e := by + intro e he hne + obtain ⟨c', hc', rfl⟩ := A'.h.cell_bijOn.surjOn he + refine ⟨c', hc', ?_, rfl⟩ + rintro ⟨c, hc, rfl⟩ + exact hne ⟨A.h.cell c, A.h.cell_bijOn.mapsTo hc, etaEdge_cell hc⟩ + let P₀ := Q'.deleteEdges (etaEdge A A' ζc '' Q.G.edgeSet) + refine ⟨realizationOf P₀.G.toHypergraph g, ⟨g, ?_, rfl⟩, ?_, ?_, ?_⟩ + · rintro e ⟨he, hne⟩ + obtain ⟨c', hc', -, rfl⟩ := hedge₂ he hne + rw [hg hc'] + exact hδ₁ c' hc' + · intro x y hadj + obtain ⟨e, ⟨he, hne⟩, hxy⟩ := realizationOf_adj.mp hadj + obtain ⟨c', hc', hni, rfl⟩ := hedge₂ he hne + rw [hg hc'] at hxy + by_cases hb : Painting.IsBorder c' + · exact adj_border H hc' hb hni ((hδ₃ c' hc' hb).1 x y hxy) + · rw [hδ₂ c' hc' hb] at hxy + obtain ⟨-, n, hn, a, ha, b, hb₂, rfl, rfl⟩ := hxy + exact Or.inl ⟨n, hn, a, ha.1, b, hb₂.1, rfl, rfl⟩ + · rintro n hn a ha b hb ⟨hne, haN, hbN, c', hc', hac, hbc⟩ + have hni := not_image_of_two_nodes H hn hne ⟨ha, hac⟩ ⟨hb, hbc⟩ + have hrel : ∀ {c}, c ∈ A'.Γ.C → ¬ Painting.IsBorder c → a ∈ tilde c → b ∈ tilde c → + (realizationOf P₀.G.toHypergraph g).Adj (A'.h.node a) (A'.h.node b) := by + intro c hc hbc₂ ha₂ hb₂ + have hni₂ := not_image_of_two_nodes H hn hne ⟨ha, ha₂⟩ ⟨hb, hb₂⟩ + refine realizationOf_adj.mpr ⟨A'.h.cell c, ⟨A'.h.cell_bijOn.mapsTo hc, hedge hc hni₂⟩, ?_⟩ + rw [hg hc, hδ₂ c hc hbc₂] + exact ⟨fun heq ↦ hne (A'.h.node_injOn haN hbN heq), n, hn, a, ⟨ha, ha₂⟩, b, ⟨hb, hb₂⟩, rfl, + rfl⟩ + by_cases hbc' : Painting.IsBorder c' + · rcases (hδ₃ c' hc' hbc').2.2 a b hne hac hbc with h₁ | ⟨c'', hc'', hin, ha₂, hb₂⟩ + · refine realizationOf_adj.mpr ⟨A'.h.cell c', ⟨A'.h.cell_bijOn.mapsTo hc', hedge hc' hni⟩, ?_⟩ + rw [hg hc'] + exact h₁ + · exact hrel hc'' hin ha₂ hb₂ + · exact hrel hc' hbc' hac hbc + · intro c' hc' hb hni x y hadj hx + refine realizationOf_adj.mpr ⟨A'.h.cell c', ⟨A'.h.cell_bijOn.mapsTo hc', hedge hc' hni⟩, ?_⟩ + rw [hg hc'] + exact (hδ₃ c' hc' hb).2.1 x y hadj hx + +end Main + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section9h.lean b/LeanPool/GraphMinor/GM20/Section9h.lean new file mode 100644 index 0000000000..856e9fa269 --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section9h.lean @@ -0,0 +1,282 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section9g +public import LeanPool.GraphMinor.Surface.Cuffs + +/-! +# Graph Minors XX, Section 9: the proof of (9.1) + +This file proves claims (9), (10), (11) and (12) of the proof of (9.1), and so that `H` realizes +`η`. Then +`P` is simulated in `P'` (`InflationHyp.simulated`), and (9.1) follows from (8.1). +The deductions using other proved results are in `Section9hProved`. +-/ + +@[expose] public section + +namespace GraphMinor.GM20 + +open Set Topology GraphMinor.Surface GraphMinor.GM04 GraphMinor.GM18 GraphMinor.GM10 Hypergraph + +universe u v w + +variable {α : Type u} {β : Type v} + +section Main + +variable {Ω : Type*} [Preorder Ω] {X : GradedSurface} {F : CuffParam X.S} {Q Q' : Patchwork Ω α β} + {A : Side X F Q} {A' : Side X F Q'} {ζn : X.S → Set X.S} {ζc : Set X.S → Set X.S} {K : ℕ} + (H : InflationHyp A A' ζn ζc K) {R : (⊤ : SimpleGraph α).Subgraph} + (hR : (Q'.deleteEdges (etaEdge A A' ζc '' Q.G.edgeSet)).IsRealization R) + (hadj : ∀ x y, R.Adj x y → NodeEdge A A' ζn x y ∨ TermEdge A A' ζc x y) + (hnode : ∀ n ∈ A.Γ.N, ∀ a ∈ ζn n, ∀ b ∈ ζn n, A'.Γ.sk.Adj a b → + R.Adj (A'.h.node a) (A'.h.node b)) + (hterm : ∀ c' ∈ A'.Γ.C, Painting.IsBorder c' → c' ∉ ζc '' A.Γ.C → ∀ x y, (A'.M c').Adj x y → + x ∉ A'.h.node '' A'.Γ.N → R.Adj x y) + +include H in +/-- Claim (12) of the proof of (9.1). -/ +theorem claim_12 {x y : α} (h : NodeEdge A A' ζn x y ∨ TermEdge A A' ζc x y) : + ∃ u, x ∈ etaVert A A' ζn u ∧ y ∈ etaVert A A' ζn u := by + rcases h with ⟨n, hn, a, ha, b, hb, rfl, rfl⟩ | ⟨Θ, hΘ, j, i, hni, hor⟩ + · exact ⟨A.h.node n, Or.inl ⟨n, hn, rfl, a, ha, rfl⟩, Or.inl ⟨n, hn, rfl, b, hb, rfl⟩⟩ + · obtain ⟨L, -, -, hpos, hstep, -, -⟩ := H.exists_lift' hΘ + set C := A.C Θ hΘ + set C' := A'.C Θ hΘ + have hL : L (j + 1) = L j := by + rcases hstep j with ⟨h₁, -⟩ | ⟨-, h₂⟩ + · exact h₁ + · exact absurd ⟨_, C.cell_mem _, h₂⟩ hni + have hN : C.pos (L j) ∈ A.Γ.N ∩ Θ := ⟨C.mem_N _, C.mem_cuff _⟩ + have h₁ : C'.pos j ∈ ζn (C.pos (L j)) ∩ Θ := ⟨hpos j, C'.mem_cuff _⟩ + have h₂ : C'.pos (j + 1) ∈ ζn (C.pos (L j)) ∩ Θ := ⟨hL ▸ hpos (j + 1), C'.mem_cuff _⟩ + have hterm : ∀ {z : α}, (A'.π (C'.pos j))[i]? = some z → + ∃ u, (A.π (C.pos (L j)))[i]? = some u := by + intro z hz + have hi := (List.getElem?_eq_some_iff.mp hz).1 + rw [(A'.labelled Θ hΘ).length_eq, ← (A.labelled Θ hΘ).length_eq (L j)] at hi + exact ⟨_, List.getElem?_eq_getElem hi⟩ + rcases hor with ⟨h₃, h₄⟩ | ⟨h₃, h₄⟩ + · obtain ⟨u, hu⟩ := hterm h₃ + exact ⟨u, Or.inr ⟨Θ, hΘ, _, hN, _, h₁, i, hu, h₃⟩, Or.inr ⟨Θ, hΘ, _, hN, _, h₂, i, hu, h₄⟩⟩ + · obtain ⟨u, hu⟩ := hterm h₃ + exact ⟨u, Or.inr ⟨Θ, hΘ, _, hN, _, h₂, i, hu, h₄⟩, Or.inr ⟨Θ, hΘ, _, hN, _, h₁, i, hu, h₃⟩⟩ + +include hR hterm H in +/-- Two `i`th terms at the ends of a border cell outside the image of `ζ` are connected in `H`. -/ +theorem same_of_step {Θ : Set X.S} (hΘ : Θ ∈ cuffs X.S) {j i : ℕ} + (hni : (A'.C Θ hΘ).cell j ∉ ζc '' A.Γ.C) {x y : α} + (hx : (A'.π ((A'.C Θ hΘ).pos j))[i]? = some x) + (hy : (A'.π ((A'.C Θ hΘ).pos (j + 1)))[i]? = some y) : sameComponent R x y := by + have hl := A'.link_of_ne hΘ (H.cell_ne_cut hΘ hni) hx hy + have hxm := A'.mem_of_getElem? hΘ hx + rcases hl with rfl | hl + · have hV : x ∈ R.verts := by + rw [hR.verts_eq] + exact A'.h.border_subset _ ⟨(A'.C Θ hΘ).mem_N j, cuff_subset_bd hΘ + ((A'.C Θ hΘ).mem_cuff j)⟩ hxm + exact sameComponent_iff.mpr ⟨hV, hV, SimpleGraph.Reachable.refl _⟩ + · refine sameComponent_of_adj (hterm _ ((A'.C Θ hΘ).cell_mem j) (A'.isBorder_cell hΘ j) hni x y + hl ?_) + intro hmem + exact Set.disjoint_left.mp (A'.h.border_disjoint _ ⟨(A'.C Θ hΘ).mem_N j, + cuff_subset_bd hΘ ((A'.C Θ hΘ).mem_cuff j)⟩) hxm hmem + +include hR hterm H in +/-- Claim (9) of the proof of (9.1). -/ +theorem claim_9 {Θ : Set X.S} (hΘ : Θ ∈ cuffs X.S) {n n₁' n₂' : X.S} (hn : n ∈ A.Γ.N ∩ Θ) + (h₁ : n₁' ∈ ζn n ∩ Θ) (h₂ : n₂' ∈ ζn n ∩ Θ) {i : ℕ} {x y : α} (hx : (A'.π n₁')[i]? = some x) + (hy : (A'.π n₂')[i]? = some y) : sameComponent R x y := by + obtain ⟨L, -, hmono, hpos, hstep, hlt, -⟩ := H.exists_lift' hΘ + set C := A.C Θ hΘ + set C' := A'.C Θ hΘ + have hchain : ∀ {m₁ m₂ : ℕ}, m₁ ≤ m₂ → L m₁ = L m₂ → ∀ {x y : α}, + (A'.π (C'.pos m₁))[i]? = some x → (A'.π (C'.pos m₂))[i]? = some y → sameComponent R x y := by + intro m₁ m₂ hm + induction m₂, hm using Nat.le_induction with + | base => + intro _ x y hx hy + rw [hx] at hy + obtain rfl := Option.some.inj hy + have hV : x ∈ R.verts := by + rw [hR.verts_eq] + exact A'.h.border_subset _ ⟨C'.mem_N m₁, cuff_subset_bd hΘ (C'.mem_cuff m₁)⟩ + (A'.mem_of_getElem? hΘ hx) + exact sameComponent_iff.mpr ⟨hV, hV, SimpleGraph.Reachable.refl _⟩ + | succ m hm ih => + intro hL x y hx hy + have h₃ : L m = L m₁ := le_antisymm (hL ▸ hmono (Nat.le_succ m)) (hmono hm) + obtain ⟨z, hz⟩ := A'.exists_term hΘ (m' := m) hx + have hni : C'.cell m ∉ ζc '' A.Γ.C := by + rcases hstep m with ⟨-, h₄⟩ | ⟨h₄, -⟩ + · exact h₄ + · omega + exact (ih h₃.symm hx hz).trans (same_of_step H hR hterm hΘ hni hz hy) + obtain ⟨m₁, hm₁, rfl⟩ := C'.exists_pos n₁' ⟨H.infl.node_subset _ hn.1 h₁.1, h₁.2⟩ + obtain ⟨m₂, hm₂, rfl⟩ := C'.exists_pos n₂' ⟨H.infl.node_subset _ hn.1 h₂.1, h₂.2⟩ + have heq : L m₁ = L m₂ := by + have h₃ := H.pos_eq_of_mem' hΘ hn.1 h₁.1 (hpos m₁) + have h₄ := H.pos_eq_of_mem' hΘ hn.1 h₂.1 (hpos m₂) + have h₅ := C.mod_eq_of_pos_eq (h₃.symm.trans h₄) + rwa [Nat.mod_eq_of_lt (hlt m₁ hm₁), Nat.mod_eq_of_lt (hlt m₂ hm₂)] at h₅ + rcases le_total m₁ m₂ with h₃ | h₃ + · exact hchain h₃ heq hx hy + · exact (hchain h₃ heq.symm hy hx).symm + +include hR hterm H in +/-- Claim (10) of the proof of (9.1), for all marches around the cuff. -/ +theorem claim_10 {Θ : Set X.S} (hΘ : Θ ∈ cuffs X.S) {n₁ n₂ n₁' n₂' : X.S} (hn₁ : n₁ ∈ A.Γ.N ∩ Θ) + (hn₂ : n₂ ∈ A.Γ.N ∩ Θ) (h₁ : n₁' ∈ ζn n₁ ∩ Θ) (h₂ : n₂' ∈ ζn n₂ ∩ Θ) {i j : ℕ} {v x y : α} + (hv₁ : (A.π n₁)[i]? = some v) (hv₂ : (A.π n₂)[j]? = some v) (hx : (A'.π n₁')[i]? = some x) + (hy : (A'.π n₂')[j]? = some y) : sameComponent R x y := by + set C := A.C Θ hΘ + set C' := A'.C Θ hΘ + let G : X.S → Prop := fun n ↦ ∀ n' ∈ ζn n ∩ Θ, ∀ (i : ℕ) (y : α), (A.π n)[i]? = some v → + (A'.π n')[i]? = some y → sameComponent R x y + obtain ⟨a, -, rfl⟩ := C.exists_pos n₁ hn₁ + obtain ⟨b, -, rfl⟩ := C.exists_pos n₂ hn₂ + have hb₁ := A.mem_of_getElem? hΘ hv₁ + have hb₂ := A.mem_of_getElem? hΘ hv₂ + have hmem : ∀ m, C.pos m ∈ A.Γ.N ∩ Θ := fun m ↦ ⟨C.mem_N m, C.mem_cuff m⟩ + have hbase : G (C.pos a) := by + intro n' hn' i₂ y hi₂ hy₂ + obtain rfl := eq_of_getElem?_eq ((A.labelled Θ hΘ).nodup a) hi₂ hv₁ + exact claim_9 H hR hterm hΘ (hmem a) h₁ hn' hx hy₂ + have hG : G (C.pos b) := by + refine A.walk hΘ G (a := a) ?_ ?_ hb₁ hb₂ hbase + · intro k hk₁ hk₂ hk n' hn' i₂ y₂ hi₂ hy₂ + obtain ⟨i₁, hi₁⟩ := A.exists_getElem? hΘ hk₁ + obtain ⟨m', hm', hp₁, hp₂⟩ := H.border_cell_facts hΘ k + obtain ⟨w, hw₁, hw₂⟩ := H.transfer_fwd hΘ hm' hi₁ hi₂ + exact (hk _ ⟨hp₁, C'.mem_cuff m'⟩ i₁ w hi₁ hw₁).trans + (claim_9 H hR hterm hΘ (hmem _) ⟨hp₂, C'.mem_cuff _⟩ hn' hw₂ hy₂) + · intro k hk₁ hk₂ hk n' hn' i₁ y₂ hi₁ hy₂ + obtain ⟨i₂, hi₂⟩ := A.exists_getElem? hΘ hk₂ + obtain ⟨m', hm', hp₁, hp₂⟩ := H.border_cell_facts hΘ k + obtain ⟨w, hw₁, hw₂⟩ := H.transfer_fwd hΘ hm' hi₁ hi₂ + exact (hk _ ⟨hp₂, C'.mem_cuff _⟩ i₂ w hi₂ hw₂).trans + (claim_9 H hR hterm hΘ (hmem _) ⟨hp₁, C'.mem_cuff m'⟩ hn' hw₁ hy₂) + exact hG _ h₂ j y hv₂ hy + +include hR hnode H in +/-- The nodes of one `ζ(n)` are connected in `H`, which is part of claim (8) of the proof of (9.1). +-/ +theorem claim_8 {n a b : X.S} (hn : n ∈ A.Γ.N) (ha : a ∈ ζn n) (hb : b ∈ ζn n) : + sameComponent R (A'.h.node a) (A'.h.node b) := by + have key : ∀ w : ζn n, (A'.Γ.sk.induce (ζn n)).Reachable ⟨a, ha⟩ w → + sameComponent R (A'.h.node a) (A'.h.node w.1) := by + intro w hw + rw [SimpleGraph.reachable_iff_reflTransGen] at hw + induction hw with + | refl => + have hV : A'.h.node a ∈ R.verts := by + rw [hR.verts_eq] + exact A'.h.node_mem _ (H.infl.node_subset _ hn ha) + exact sameComponent_iff.mpr ⟨hV, hV, SimpleGraph.Reachable.refl _⟩ + | @tail z w _ hzw ih => + exact ih.trans (sameComponent_of_adj (hnode n hn _ z.2 _ w.2 hzw)) + exact key ⟨b, hb⟩ (H.infl.node_connected n hn _ _) + +include hR hnode hterm H in +/-- Claim (11) of the proof of (9.1). -/ +theorem claim_11 {v : α} (hv : v ∈ Q.G.vertexSet) {a b : α} (ha : a ∈ etaVert A A' ζn v) + (hb : b ∈ etaVert A A' ζn v) : sameComponent R a b := by + have hnot : ∀ {n n₀ : X.S} {Θ : Set X.S} {i : ℕ}, Θ ∈ cuffs X.S → n ∈ A.Γ.N → n₀ ∈ A.Γ.N ∩ Θ → + (A.π n₀)[i]? = some (A.h.node n) → False := by + intro n n₀ Θ i hΘ hn hn₀ hi + exact Set.disjoint_left.mp (A.h.border_disjoint _ ⟨hn₀.1, cuff_subset_bd hΘ hn₀.2⟩) + (A.mem_border_of_term hΘ hn₀ hi) ⟨n, hn, rfl⟩ + rcases ha with ⟨n₁, h₁, rfl, n₁', h₃, rfl⟩ | ⟨Θ₁, hΘ₁, n₁, h₁, n₁', h₃, i, h₅, h₆⟩ <;> + rcases hb with ⟨n₂, h₁', hv', n₂', h₃', rfl⟩ | ⟨Θ₂, hΘ₂, n₂, h₁', n₂', h₃', j, h₅', h₆'⟩ + · obtain rfl := A.h.node_injOn h₁ h₁' hv'.symm + exact claim_8 H hR hnode h₁ h₃ h₃' + · exact (hnot hΘ₂ h₁ h₁' h₅').elim + · subst hv' + exact (hnot hΘ₁ h₁' h₁ h₅).elim + · have hm₁ := A.mem_border_of_term hΘ₁ h₁ h₅ + have hm₂ := A.mem_border_of_term hΘ₂ h₁' h₅' + by_cases hΘ : Θ₁ = Θ₂ + · subst hΘ + exact claim_10 H hR hterm hΘ₁ h₁ h₁' h₃ h₃' h₅ h₅' h₆ h₆' + · exact (Set.disjoint_left.mp (A.h.border_cuffs _ hΘ₁ _ hΘ₂ hΘ _ h₁ _ h₁') hm₁ hm₂).elim + +include H in +/-- The main step of the proof of (9.1): `P` is simulated in `P'`. -/ +theorem InflationHyp.simulated : Simulated Q Q' := by + obtain ⟨R, hR, hadj, hnode, hterm⟩ := exists_realization H + refine ⟨_, _, H.isExpansion, R, hR, fun v hv ↦ ?_⟩ + have hsub : etaVert A A' ζn v ⊆ R.verts := by + rw [hR.verts_eq] + exact H.eta_subset v + refine (exists_isComponent_verts_eq_iff (H.claim_2 hv) hsub).mpr + ⟨fun a ha b hab ↦ ?_, fun a ha b hb ↦ claim_11 H hR hnode hterm hv ha hb⟩ + obtain ⟨u, h₁, h₂⟩ := claim_12 H (hadj a b hab) + by_cases huv : u = v + · exact huv ▸ h₂ + · exact absurd ha (Set.disjoint_left.mp (H.claim_4 huv) h₁) + +end Main + +/-- Graph Minors XX, (8.1) (page 348), to be derived from (2.1) of Graph Minors XIX: "Let $\Sigma$ +be a surface and let $\Omega$ be a well-quasi-order. For each $i \ge 1$ let +$\Gamma_i$ be a 3-connected painting in $\Sigma$ and let $\phi_i : \mathcal{C}(\Gamma_i) \to +E(\Omega)$ be a function. Then there exist $j > i \ge 1$ and a linear inflation $\zeta$ of +$\Gamma_i$ in $\Gamma_j$ such that $\phi_i(c) \le \phi_j(\zeta(c))$ for each $c \in +\mathcal{C}(\Gamma_i)$." -/ +def Theorem81Statement : Prop := + ∀ (S : Type) [TopologicalSpace S] {Ω : Type w} [Preorder Ω], IsSurface S → ConnectedSpace S → + WellQuasiOrderedLE Ω → ∀ (Γ : ℕ → Painting S) (φ : ℕ → Set S → Ω), + (∀ i, (Γ i).IsThreeConnected) → + ∃ i j, i < j ∧ ∃ (ζn : S → Set S) (ζc : Set S → Set S), IsLinearInflation (Γ i) (Γ j) ζn ζc ∧ + ∀ c ∈ (Γ i).C, φ i c ≤ φ j (ζc c) + +/-- A bound for the marches of border cells. -/ +theorem Side.bounded {Ω : Type*} {X : GradedSurface} {F : CuffParam X.S} {Q : + Patchwork Ω α β} + (A : Side X F Q) {r : ℕ} (hr : ∀ Θ ∈ cuffs X.S, X.ρ Θ ≤ r) : A.Bounded (2 * r + 2) := by + intro c hc hb + obtain ⟨Θ, hΘ, hcΘ⟩ := exists_cuff_of_isBorder hb + obtain ⟨m, -, rfl⟩ := (A.C Θ hΘ).exists_cell c hc hcΘ + set C := A.C Θ hΘ + let l : List α := [A.h.node (C.pos m), A.h.node (C.pos (m + 1))] ++ A.π (C.pos m) ++ + A.π (C.pos (m + 1)) + have hl : l.length = 2 + X.ρ Θ + X.ρ Θ := by + have h₁ : (A.π (C.pos m)).length = X.ρ Θ := (A.labelled Θ hΘ).length_eq m + have h₂ : (A.π (C.pos (m + 1))).length = X.ρ Θ := (A.labelled Θ hΘ).length_eq (m + 1) + simp only [l, List.length_append, List.length_cons, List.length_nil] + omega + have hsub : ∀ x ∈ Q.μ (A.h.cell (C.cell m)), x ∈ l := by + intro x hx + have hd : A.h.cell (C.cell m) ∈ Q.dom := by + rw [A.dom_eq] + exact A.h.cell_bijOn.mapsTo hc + have h₁ : x ∈ {v | v ∈ Q.μ (A.h.cell (C.cell m))} := hx + rw [Q.μ_set _ hd, show Q.G.ends (A.h.cell (C.cell m)) = _ from A.h.ends_border _ hc hb, + C.tilde_eq] at h₁ + have hmem : ∀ k, x ∈ A.h.border (C.pos k) → x ∈ A.π (C.pos k) := fun k hk ↦ by + rw [← (A.labelled Θ hΘ).set_eq k] at hk + exact hk + simp only [l, List.mem_append, List.mem_cons, List.not_mem_nil, or_false] + rcases h₁ with ⟨n, hn, rfl⟩ | h₁ + · rcases hn with rfl | rfl + · exact Or.inl (Or.inl (Or.inl rfl)) + · exact Or.inl (Or.inl (Or.inr rfl)) + · simp only [mem_iUnion, exists_prop] at h₁ + obtain ⟨n, hn, hx₂⟩ := h₁ + rcases hn with rfl | rfl + · exact Or.inl (Or.inr (hmem _ hx₂)) + · exact Or.inr (hmem _ hx₂) + have := length_le_of_subset (A.μ_nodup hc) hsub + have h₂ := hr Θ hΘ + omega + + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/GM20/Section9hProved.lean b/LeanPool/GraphMinor/GM20/Section9hProved.lean new file mode 100644 index 0000000000..1121181dad --- /dev/null +++ b/LeanPool/GraphMinor/GM20/Section9hProved.lean @@ -0,0 +1,47 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM20.Section9h + +import LeanPool.GraphMinor.GM20.Section8b + +/-! +# Graph Minors XX: deductions from Section9h + +The deductions apply the proved results after their geometric prerequisites. +-/ + +public section +namespace GraphMinor.GM20 +open Set Topology GraphMinor.Surface GraphMinor.GM04 GraphMinor.GM18 GraphMinor.GM10 Hypergraph +universe u v +variable {α : Type u} {β : Type v} + +/-- Graph Minors XX, (9.1) (page 349): "For every graded surface $(\Sigma, \rho)$, the set of all +$(\Sigma, \rho)$-hulled patchworks is well-behaved." -/ +theorem theorem_9_1_proof + (X : GradedSurface) : WellBehaved {P : UnlabeledPatchwork α β | IsHulled X P} := by + classical + intro Ω _ hΩ Q hQ + obtain ⟨-, hfin, harc⟩ := cuff_statement.{0} X.S X.isSurface + have hF : ∀ Θ ∈ cuffs X.S, Nonempty (Circle ≃ₜ Θ) := fun Θ hΘ ↦ harc Θ hΘ + let F : CuffParam X.S := fun Θ hΘ ↦ (hF Θ hΘ).some + obtain ⟨r, hr⟩ := (hfin.image X.ρ).bddAbove + have hr' : ∀ Θ ∈ cuffs X.S, X.ρ Θ ≤ r := fun Θ hΘ ↦ hr ⟨Θ, hΘ, rfl⟩ + choose P hP hPc using hQ + let A : ∀ i, Side X F (Q i) := fun i ↦ (exists_side X F (hP i) (hPc i)).some + obtain ⟨i, j, hij, ζn, ζc, hζ, hle⟩ := GraphMinor.GM20.theorem_8_1_proof.{max u v} X.S + X.isSurface X.connected + (wqo_labelOrder hΩ (2 * r + 2)) (fun i ↦ (A i).Γ) (fun i c ↦ (A i).ψ (2 * r + 2) c) + fun i ↦ (A i).three_connected + exact ⟨i, j, hij, InflationHyp.simulated ⟨hζ, hle, by omega, (A i).bounded hr', + (A j).bounded hr'⟩⟩ + +end GraphMinor.GM20 diff --git a/LeanPool/GraphMinor/Hypergraph/Basic.lean b/LeanPool/GraphMinor/Hypergraph/Basic.lean new file mode 100644 index 0000000000..8fcdb8321d --- /dev/null +++ b/LeanPool/GraphMinor/Hypergraph/Basic.lean @@ -0,0 +1,281 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Combinatorics.SimpleGraph.Paths +public import Mathlib.Data.Set.Card +public import Mathlib.Data.Set.Finite.Lattice + +/-! +# Hypergraphs, separations and rooted hypergraphs + +This file gives the basic definitions of Graph Minors IV, Section 3 (page 233), which Graph Minors +XVIII and XX repeat: + +> A hypergraph `G` consists of a finite set `V(G)` of vertices, a finite set `E(G)` of edges with +> `E(G) ∩ V(G) = ∅`, and an incidence relation, a subset of `V(G) × E(G)`. The vertices incident +> with an edge `e` are its *ends*, and the set of ends of `e` in `G` is denoted by `V(e)`. If `G`, +> `G'` are hypergraphs and `V(G') ⊆ V(G)` and `E(G') ⊆ E(G)`, and `V_G(e) = V_{G'}(e)` for every +> `e ∈ E(G')`, then we call `G'` a *subhypergraph* of `G` and write `G' ⊆ G`. If `G₁, G₂ ⊆ G` we +> define `G₁ ∩ G₂`, `G₁ ∪ G₂` in the natural way. A *separation* of `G` is a pair `(G₁, G₂)` of +> subhypergraphs of `G` with `G₁ ∪ G₂ = G` and `E(G₁ ∩ G₂) = ∅`; its *order* is +> `|V(G₁ ∩ G₂)|`. +> +> A march in a set `V` is a finite sequence of distinct elements of `V`. ... A *rooted +> hypergraph* `G = (G⁻, π(G))` consists of a hypergraph `G⁻` and a march `π(G)` in `V(G⁻)`. ... +> A separation of a rooted hypergraph `G` is a pair `(G₁, G₂)` of rooted hypergraphs such that +> `(G₁⁻, G₂⁻)` is a separation of `G⁻`, and `π(G₂) = π(G)`, and `πBar(G₁) = V(G₁⁻ ∩ G₂⁻)`. + +Vertices lie in a type `α` and edges in a type `β`, so the condition `E(G) ∩ V(G) = ∅` is +automatic. A march is a `List` without duplicates. + +It also defines paths, which the papers use in Menger's theorem: a hypergraph `G` has the simple +graph `G.skeleton` on its vertices, in which two distinct vertices are adjacent when some edge is +incident with both (the *1-skeleton* of Graph Minors XX, Section 10, and the graph `K` in the proof +of Graph Minors IV, (6.1)). For a graph, the paths of `G` and of `G.skeleton` have the same vertex +sequences, so disjoint paths of `G` are disjoint paths of `G.skeleton`. `MengerStatement` is +Menger's theorem in the form that Graph Minors IV uses in the proof of (6.1). +-/ + +@[expose] public section + +namespace GraphMinor + +variable {α β : Type*} + +/-- A hypergraph (Graph Minors IV, Section 3): a finite set of vertices, a finite set of edges, and +an incidence relation between them. `G.Inc e v` says that the vertex `v` is an end of the edge `e`. +An edge may have any number of ends. -/ +@[ext] +structure Hypergraph (α β : Type*) where + /-- The vertex set `V(G)`. -/ + vertexSet : Set α + /-- The edge set `E(G)`. -/ + edgeSet : Set β + /-- The incidence relation: `Inc e v` when `v` is an end of `e`. -/ + Inc : β → α → Prop + /-- Incidence is a relation between vertices of `G` and edges of `G`. -/ + vertex_mem_of_inc : ∀ ⦃e : β⦄ ⦃v : α⦄, Inc e v → v ∈ vertexSet + /-- Incidence is a relation between vertices of `G` and edges of `G`. -/ + edge_mem_of_inc : ∀ ⦃e : β⦄ ⦃v : α⦄, Inc e v → e ∈ edgeSet + /-- The vertex set is finite. -/ + vertexSet_finite : vertexSet.Finite + /-- The edge set is finite. -/ + edgeSet_finite : edgeSet.Finite + +namespace Hypergraph + +/-- `V(e)`, the set of ends of the edge `e`. -/ +def ends (G : Hypergraph α β) (e : β) : Set α := {v | G.Inc e v} + +/-- `H ⊆ G`: `H` is a subhypergraph of `G`. That is, `V(H) ⊆ V(G)`, `E(H) ⊆ E(G)`, and every edge of +`H` has the same ends in `H` as in `G`. -/ +structure IsSubhypergraph (H G : Hypergraph α β) : Prop where + vertexSet_subset : H.vertexSet ⊆ G.vertexSet + edgeSet_subset : H.edgeSet ⊆ G.edgeSet + ends_eq : ∀ e ∈ H.edgeSet, G.ends e = H.ends e + +/-- Subhypergraphs, written `H ≤ G` (the paper writes `H ⊆ G`). -/ +instance : PartialOrder (Hypergraph α β) where + le H G := IsSubhypergraph H G + le_refl G := ⟨subset_rfl, subset_rfl, fun _ _ ↦ rfl⟩ + le_trans G₁ G₂ G₃ h₁₂ h₂₃ := + ⟨h₁₂.vertexSet_subset.trans h₂₃.vertexSet_subset, + h₁₂.edgeSet_subset.trans h₂₃.edgeSet_subset, + fun e he ↦ (h₂₃.ends_eq e (h₁₂.edgeSet_subset he)).trans (h₁₂.ends_eq e he)⟩ + le_antisymm G H hGH hHG := by + have hE : G.edgeSet = H.edgeSet := hGH.edgeSet_subset.antisymm hHG.edgeSet_subset + refine Hypergraph.ext (hGH.vertexSet_subset.antisymm hHG.vertexSet_subset) hE ?_ + funext e v + apply propext + by_cases he : e ∈ G.edgeSet + · have h := congrArg (v ∈ ·) (hGH.ends_eq e he) + exact h.to_iff.symm + · constructor + · intro h + exact absurd (G.edge_mem_of_inc h) he + · intro h + exact absurd (hE ▸ H.edge_mem_of_inc h) he + +/-- The union `G₁ ∪ G₂`. For subhypergraphs `G₁, G₂` of a hypergraph `G` it is the subhypergraph of +`G` with vertex set `V(G₁) ∪ V(G₂)` and edge set `E(G₁) ∪ E(G₂)`. -/ +instance : Union (Hypergraph α β) where + union G₁ G₂ := + { vertexSet := G₁.vertexSet ∪ G₂.vertexSet + edgeSet := G₁.edgeSet ∪ G₂.edgeSet + Inc := fun e v ↦ G₁.Inc e v ∨ G₂.Inc e v + vertex_mem_of_inc := fun _ _ h ↦ + h.elim (fun h ↦ Or.inl (G₁.vertex_mem_of_inc h)) (fun h ↦ Or.inr (G₂.vertex_mem_of_inc h)) + edge_mem_of_inc := fun _ _ h ↦ + h.elim (fun h ↦ Or.inl (G₁.edge_mem_of_inc h)) (fun h ↦ Or.inr (G₂.edge_mem_of_inc h)) + vertexSet_finite := G₁.vertexSet_finite.union G₂.vertexSet_finite + edgeSet_finite := G₁.edgeSet_finite.union G₂.edgeSet_finite } + +/-- The intersection `G₁ ∩ G₂`. For subhypergraphs `G₁, G₂` of a hypergraph `G` it is the +subhypergraph of `G` with vertex set `V(G₁) ∩ V(G₂)` and edge set `E(G₁) ∩ E(G₂)`. -/ +instance : Inter (Hypergraph α β) where + inter G₁ G₂ := + { vertexSet := G₁.vertexSet ∩ G₂.vertexSet + edgeSet := G₁.edgeSet ∩ G₂.edgeSet + Inc := fun e v ↦ G₁.Inc e v ∧ G₂.Inc e v + vertex_mem_of_inc := fun _ _ h ↦ ⟨G₁.vertex_mem_of_inc h.1, G₂.vertex_mem_of_inc h.2⟩ + edge_mem_of_inc := fun _ _ h ↦ ⟨G₁.edge_mem_of_inc h.1, G₂.edge_mem_of_inc h.2⟩ + vertexSet_finite := G₁.vertexSet_finite.subset Set.inter_subset_left + edgeSet_finite := G₁.edgeSet_finite.subset Set.inter_subset_left } + +theorem union_vertexSet_eq (G₁ G₂ : Hypergraph α β) : + (G₁ ∪ G₂).vertexSet = G₁.vertexSet ∪ G₂.vertexSet := rfl + +theorem union_edgeSet_eq (G₁ G₂ : Hypergraph α β) : + (G₁ ∪ G₂).edgeSet = G₁.edgeSet ∪ G₂.edgeSet := rfl + +theorem union_inc_iff (G₁ G₂ : Hypergraph α β) (e : β) (v : α) : + (G₁ ∪ G₂).Inc e v ↔ G₁.Inc e v ∨ G₂.Inc e v := Iff.rfl + +theorem inter_vertexSet_eq (G₁ G₂ : Hypergraph α β) : + (G₁ ∩ G₂).vertexSet = G₁.vertexSet ∩ G₂.vertexSet := rfl + +theorem inter_edgeSet_eq (G₁ G₂ : Hypergraph α β) : + (G₁ ∩ G₂).edgeSet = G₁.edgeSet ∩ G₂.edgeSet := rfl + +theorem inter_inc_iff (G₁ G₂ : Hypergraph α β) (e : β) (v : α) : + (G₁ ∩ G₂).Inc e v ↔ G₁.Inc e v ∧ G₂.Inc e v := Iff.rfl + +/-- The union `⋃ (G i : i ∈ s)` of finitely many hypergraphs. For subhypergraphs of a hypergraph +`G` it is the subhypergraph of `G` whose vertices and edges are those of the `G i`. -/ +def biUnion {ι : Type*} (s : Finset ι) (G : ι → Hypergraph α β) : Hypergraph α β where + vertexSet := ⋃ i ∈ s, (G i).vertexSet + edgeSet := ⋃ i ∈ s, (G i).edgeSet + Inc e v := ∃ i ∈ s, (G i).Inc e v + vertex_mem_of_inc _ _ h := by + obtain ⟨i, hi, h⟩ := h + exact Set.mem_biUnion hi ((G i).vertex_mem_of_inc h) + edge_mem_of_inc _ _ h := by + obtain ⟨i, hi, h⟩ := h + exact Set.mem_biUnion hi ((G i).edge_mem_of_inc h) + vertexSet_finite := Set.Finite.biUnion s.finite_toSet fun i _ ↦ (G i).vertexSet_finite + edgeSet_finite := Set.Finite.biUnion s.finite_toSet fun i _ ↦ (G i).edgeSet_finite + +/-- `G \ F`: the subhypergraph of `G` with the same vertex set and edge set `E(G) - F`. -/ +def deleteEdges (G : Hypergraph α β) (F : Set β) : Hypergraph α β where + vertexSet := G.vertexSet + edgeSet := G.edgeSet \ F + Inc e v := G.Inc e v ∧ e ∉ F + vertex_mem_of_inc _ _ h := G.vertex_mem_of_inc h.1 + edge_mem_of_inc _ _ h := ⟨G.edge_mem_of_inc h.1, h.2⟩ + vertexSet_finite := G.vertexSet_finite + edgeSet_finite := G.edgeSet_finite.subset Set.sdiff_subset + +/-- `G` is a graph: every edge has one or two ends. -/ +def IsGraph (G : Hypergraph α β) : Prop := + ∀ e ∈ G.edgeSet, (G.ends e).Nonempty ∧ (G.ends e).ncard ≤ 2 + +/-- `(G₁, G₂)` is a separation of `G`: `G₁` and `G₂` are subhypergraphs of `G`, `G₁ ∪ G₂ = G`, and +`E(G₁ ∩ G₂) = ∅`. -/ +structure IsSeparation (G G₁ G₂ : Hypergraph α β) : Prop where + left_le : G₁ ≤ G + right_le : G₂ ≤ G + union_eq : G₁ ∪ G₂ = G + edgeSet_inter_eq : (G₁ ∩ G₂).edgeSet = ∅ + +/-- The order `|V(G₁ ∩ G₂)|` of a separation `(G₁, G₂)`. -/ +noncomputable def separationOrder (G₁ G₂ : Hypergraph α β) : ℕ := (G₁ ∩ G₂).vertexSet.ncard + +/-- The 1-skeleton of `G`: the simple graph on `α` in which distinct vertices are adjacent when +some edge of `G` is incident with both. Its edges join vertices of `G` only. -/ +def skeleton (G : Hypergraph α β) : SimpleGraph α where + Adj x y := x ≠ y ∧ ∃ e, G.Inc e x ∧ G.Inc e y + symm := ⟨fun _ _ ⟨hxy, e, hx, hy⟩ ↦ ⟨hxy.symm, e, hy, hx⟩⟩ + loopless := ⟨fun _ h ↦ h.1 rfl⟩ + +/-- A skeleton walk with initial vertex in the hypergraph stays in its vertex set. -/ +theorem skeleton_walk_support_subset_vertexSet {G : Hypergraph α β} {u v : α} + (w : G.skeleton.Walk u v) (hu : u ∈ G.vertexSet) : + ∀ z ∈ w.support, z ∈ G.vertexSet := by + induction w with + | nil => + intro z hz + simp only [SimpleGraph.Walk.support_nil, List.mem_cons, List.not_mem_nil, or_false] at hz + exact hz ▸ hu + | @cons u u' v hadj rest ih => + obtain ⟨_, e, _, heu'⟩ := id hadj + have hu' : u' ∈ G.vertexSet := G.vertex_mem_of_inc heu' + intro z hz + rw [SimpleGraph.Walk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · exact hu + · exact ih hu' z hz + +/-- The vertices incident with edges on both sides of an edge subset. -/ +abbrev edgeBoundary (G : Hypergraph α β) (X : Set β) : Set α := + {v ∈ G.vertexSet | (∃ e ∈ X, G.Inc e v) ∧ (∃ e ∈ G.edgeSet \ X, G.Inc e v)} + +end Hypergraph + +/-- A path of the simple graph `K` from `X` to `Y`: a path of `K` whose first vertex is in `X` and +whose last vertex is in `Y`. It may have a single vertex, in `X ∩ Y`. -/ +structure PathFromTo (K : SimpleGraph α) (X Y : Set α) where + /-- The first vertex. -/ + first : α + /-- The last vertex. -/ + last : α + /-- The path. -/ + walk : K.Walk first last + isPath : walk.IsPath + first_mem : first ∈ X + last_mem : last ∈ Y + +/-- There are `k` mutually vertex-disjoint paths of `K` from `X` to `Y`. -/ +def HasDisjointPaths (K : SimpleGraph α) (X Y : Set α) (k : ℕ) : Prop := + ∃ P : Fin k → PathFromTo K X Y, + Pairwise fun i j ↦ Disjoint {x | x ∈ (P i).walk.support} {x | x ∈ (P j).walk.support} + +/-- **Menger's theorem**, in the form used in the proof of Graph Minors IV, (6.1): for sets `X, Y` +of vertices of a hypergraph `G` and `k ≥ 0`, every separation `(G₁, G₂)` of `G` with `X ⊆ V(G₁)` +and `Y ⊆ V(G₂)` has order at least `k` if and only if there are `k` mutually vertex-disjoint paths +of the 1-skeleton of `G` from `X` to `Y`. -/ +def MengerStatement : Prop := + ∀ {α β : Type*} (G : Hypergraph α β) (X Y : Set α), X ⊆ G.vertexSet → Y ⊆ G.vertexSet → + ∀ k : ℕ, + (∀ G₁ G₂ : Hypergraph α β, G.IsSeparation G₁ G₂ → X ⊆ G₁.vertexSet → Y ⊆ G₂.vertexSet → + k ≤ Hypergraph.separationOrder G₁ G₂) ↔ + HasDisjointPaths G.skeleton X Y k + +/-- A rooted hypergraph `G = (G⁻, π(G))` (Graph Minors IV, Section 3): a hypergraph `G⁻`, here +`G.toHypergraph`, and a march `π(G)` in `V(G⁻)`, here `G.roots`, a list of distinct vertices. +`V(G) = V(G⁻)` and `E(G) = E(G⁻)`. -/ +structure RootedHypergraph (α β : Type*) extends Hypergraph α β where + /-- The march `π(G)`. -/ + roots : List α + roots_nodup : roots.Nodup + roots_subset : ∀ v ∈ roots, v ∈ vertexSet + +namespace RootedHypergraph + +/-- `πBar(G)`, the set of terms of the march `π(G)`. -/ +def rootSet (G : RootedHypergraph α β) : Set α := {v | v ∈ G.roots} + +/-- `(G₁, G₂)` is a separation of the rooted hypergraph `G`: `(G₁⁻, G₂⁻)` is a separation of `G⁻`, +`π(G₂) = π(G)` and `πBar(G₁) = V(G₁⁻ ∩ G₂⁻)`. Its order is +`Hypergraph.separationOrder G₁.toHypergraph G₂.toHypergraph`. -/ +structure IsSeparation (G G₁ G₂ : RootedHypergraph α β) : Prop where + isSeparation : G.toHypergraph.IsSeparation G₁.toHypergraph G₂.toHypergraph + roots_right : G₂.roots = G.roots + rootSet_left : G₁.rootSet = (G₁.toHypergraph ∩ G₂.toHypergraph).vertexSet + +end RootedHypergraph + +/-- The rooted hypergraph `(G, 0)`, where `0` is the null march. -/ +def Hypergraph.toRooted (G : Hypergraph α β) : RootedHypergraph α β where + toHypergraph := G + roots := [] + roots_nodup := List.nodup_nil + roots_subset _ h := absurd h List.not_mem_nil + +end GraphMinor diff --git a/LeanPool/GraphMinor/Imports.lean b/LeanPool/GraphMinor/Imports.lean new file mode 100644 index 0000000000..bdc282c265 --- /dev/null +++ b/LeanPool/GraphMinor/Imports.lean @@ -0,0 +1,2234 @@ +/- +Copyright (c) 2026 Lean Pool contributors. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Lean Pool contributors +-/ +module -- shake: keep-all --deprecated_module: ignore + +-- Generated project imports; run `lake exe mk_all`. +public import LeanPool.GraphMinor +public import LeanPool.GraphMinor.GM01.Defs +public import LeanPool.GraphMinor.GM04.Axioms +public import LeanPool.GraphMinor.GM04.Decomposition.Basic +public import LeanPool.GraphMinor.GM04.Decomposition.Contraction +public import LeanPool.GraphMinor.GM04.Decomposition.Linked +public import LeanPool.GraphMinor.GM04.Decomposition.Rotund +public import LeanPool.GraphMinor.GM04.Decomposition.SubtreeHelly +public import LeanPool.GraphMinor.GM04.Decomposition.TreeWidth +public import LeanPool.GraphMinor.GM04.Higman +public import LeanPool.GraphMinor.GM04.HigmanProof +public import LeanPool.GraphMinor.GM04.Main +public import LeanPool.GraphMinor.GM04.NumberedDecomposition +public import LeanPool.GraphMinor.GM04.Patchwork.Defs +public import LeanPool.GraphMinor.GM04.Patchwork.Expansion +public import LeanPool.GraphMinor.GM04.Patchwork.Main +public import LeanPool.GraphMinor.GM04.Patchwork.Menger +public import LeanPool.GraphMinor.GM04.Patchwork.StarWQO +public import LeanPool.GraphMinor.GM04.Patchwork.Stars +public import LeanPool.GraphMinor.GM04.Patchwork.VerifyAxioms +public import LeanPool.GraphMinor.GM04.Tree +public import LeanPool.GraphMinor.GM04.TreeDecomposition +public import LeanPool.GraphMinor.GM04.TreeLemma.Basic +public import LeanPool.GraphMinor.GM04.TreeLemma.Lemma21 +public import LeanPool.GraphMinor.GM04.TreeLemma.Lemma22 +public import LeanPool.GraphMinor.GM05.Defs +public import LeanPool.GraphMinor.GM06.Defs +public import LeanPool.GraphMinor.GM06.DiscRegions +public import LeanPool.GraphMinor.GM06.DualExists +public import LeanPool.GraphMinor.GM06.EdgeChart +public import LeanPool.GraphMinor.GM06.Euler +public import LeanPool.GraphMinor.GM06.RegionCurve +public import LeanPool.GraphMinor.GM06.RegionLocal +public import LeanPool.GraphMinor.GM06.Section2Count +public import LeanPool.GraphMinor.GM06.Section2Dual +public import LeanPool.GraphMinor.GM06.Section3Basic +public import LeanPool.GraphMinor.GM06.Section3Dual +public import LeanPool.GraphMinor.GM06.Section3Induce +public import LeanPool.GraphMinor.GM06.Section3InduceSingleton +public import LeanPool.GraphMinor.GM06.Section3Main +public import LeanPool.GraphMinor.GM07.AlphaExists +public import LeanPool.GraphMinor.GM07.ArcPlace +public import LeanPool.GraphMinor.GM07.BdChart +public import LeanPool.GraphMinor.GM07.Bridge +public import LeanPool.GraphMinor.GM07.CapMap +public import LeanPool.GraphMinor.GM07.CollarPush +public import LeanPool.GraphMinor.GM07.CuffArc +public import LeanPool.GraphMinor.GM07.CuffArcWalk +public import LeanPool.GraphMinor.GM07.CuffBoxBuild +public import LeanPool.GraphMinor.GM07.CuffBoxes +public import LeanPool.GraphMinor.GM07.CuffCells +public import LeanPool.GraphMinor.GM07.CuffChart +public import LeanPool.GraphMinor.GM07.CuffCollapse +public import LeanPool.GraphMinor.GM07.CuffCollar +public import LeanPool.GraphMinor.GM07.CuffCollarBuild +public import LeanPool.GraphMinor.GM07.CuffCore +public import LeanPool.GraphMinor.GM07.CuffFinal +public import LeanPool.GraphMinor.GM07.CuffFinger +public import LeanPool.GraphMinor.GM07.CuffForest +public import LeanPool.GraphMinor.GM07.CuffFrame +public import LeanPool.GraphMinor.GM07.CuffGlue +public import LeanPool.GraphMinor.GM07.CuffGrid +public import LeanPool.GraphMinor.GM07.CuffIncidences +public import LeanPool.GraphMinor.GM07.CuffLayers +public import LeanPool.GraphMinor.GM07.CuffLift +public import LeanPool.GraphMinor.GM07.CuffLines +public import LeanPool.GraphMinor.GM07.CuffMenger +public import LeanPool.GraphMinor.GM07.CuffNest +public import LeanPool.GraphMinor.GM07.CuffOrder +public import LeanPool.GraphMinor.GM07.CuffReach +public import LeanPool.GraphMinor.GM07.CuffSegments +public import LeanPool.GraphMinor.GM07.CuffShift +public import LeanPool.GraphMinor.GM07.CuffSlide +public import LeanPool.GraphMinor.GM07.CuffStep +public import LeanPool.GraphMinor.GM07.CuffTouch +public import LeanPool.GraphMinor.GM07.CuffTree +public import LeanPool.GraphMinor.GM07.CuffWalk +public import LeanPool.GraphMinor.GM07.CutBounds +public import LeanPool.GraphMinor.GM07.CutBuild +public import LeanPool.GraphMinor.GM07.CutConnected +public import LeanPool.GraphMinor.GM07.CutDraw +public import LeanPool.GraphMinor.GM07.CutEdge +public import LeanPool.GraphMinor.GM07.CutEdges +public import LeanPool.GraphMinor.GM07.CutFeasible +public import LeanPool.GraphMinor.GM07.CutForest +public import LeanPool.GraphMinor.GM07.CutLines +public import LeanPool.GraphMinor.GM07.CutStages +public import LeanPool.GraphMinor.GM07.CylinderCap +public import LeanPool.GraphMinor.GM07.CylinderGrid +public import LeanPool.GraphMinor.GM07.CylinderPaths +public import LeanPool.GraphMinor.GM07.CylinderTrim +public import LeanPool.GraphMinor.GM07.CylinderWheel +public import LeanPool.GraphMinor.GM07.Defs +public import LeanPool.GraphMinor.GM07.DiscChain +public import LeanPool.GraphMinor.GM07.DiscPlace +public import LeanPool.GraphMinor.GM07.DiscPrune +public import LeanPool.GraphMinor.GM07.DiscPush +public import LeanPool.GraphMinor.GM07.FiniteCross +public import LeanPool.GraphMinor.GM07.FlatEdges +public import LeanPool.GraphMinor.GM07.FlatMinimal +public import LeanPool.GraphMinor.GM07.ForestFlat +public import LeanPool.GraphMinor.GM07.ForestParts +public import LeanPool.GraphMinor.GM07.ForestPeel +public import LeanPool.GraphMinor.GM07.ForestQuotient +public import LeanPool.GraphMinor.GM07.GoodEdge +public import LeanPool.GraphMinor.GM07.GrowForest +public import LeanPool.GraphMinor.GM07.JoinDiscs +public import LeanPool.GraphMinor.GM07.LoopLift +public import LeanPool.GraphMinor.GM07.LoopSides +public import LeanPool.GraphMinor.GM07.MatchDiscs +public import LeanPool.GraphMinor.GM07.Matched +public import LeanPool.GraphMinor.GM07.MinimalNet +public import LeanPool.GraphMinor.GM07.MoveHomotopy +public import LeanPool.GraphMinor.GM07.MoveOff +public import LeanPool.GraphMinor.GM07.MultiCut +public import LeanPool.GraphMinor.GM07.NetExists +public import LeanPool.GraphMinor.GM07.NetExistsCut +public import LeanPool.GraphMinor.GM07.NetExistsCycle +public import LeanPool.GraphMinor.GM07.NetExistsFamily +public import LeanPool.GraphMinor.GM07.NetExistsGlue +public import LeanPool.GraphMinor.GM07.NetExistsHole +public import LeanPool.GraphMinor.GM07.NetExistsLines +public import LeanPool.GraphMinor.GM07.NetExistsMerge +public import LeanPool.GraphMinor.GM07.NetExistsWord +public import LeanPool.GraphMinor.GM07.NetRefine +public import LeanPool.GraphMinor.GM07.NetRefineArcs +public import LeanPool.GraphMinor.GM07.NetSeparate +public import LeanPool.GraphMinor.GM07.NetSeparateAssembly +public import LeanPool.GraphMinor.GM07.NetSeparateCount +public import LeanPool.GraphMinor.GM07.NetSeparateEquivalence +public import LeanPool.GraphMinor.GM07.NetSeparateExchange +public import LeanPool.GraphMinor.GM07.NetSeparateFamily +public import LeanPool.GraphMinor.GM07.NetSeparateFibers +public import LeanPool.GraphMinor.GM07.NetSwap +public import LeanPool.GraphMinor.GM07.NetSwapArcs +public import LeanPool.GraphMinor.GM07.NetSwapAssembly +public import LeanPool.GraphMinor.GM07.NetSwapBasic +public import LeanPool.GraphMinor.GM07.NetSwapBoundary +public import LeanPool.GraphMinor.GM07.NetSwapContactBalance +public import LeanPool.GraphMinor.GM07.NetSwapCounts +public import LeanPool.GraphMinor.GM07.NetSwapCut +public import LeanPool.GraphMinor.GM07.NetSwapDisc +public import LeanPool.GraphMinor.GM07.NetSwapEquivalence +public import LeanPool.GraphMinor.GM07.NetSwapFamily +public import LeanPool.GraphMinor.GM07.NetSwapFibers +public import LeanPool.GraphMinor.GM07.NetSwapFrontier +public import LeanPool.GraphMinor.GM07.NetSwapNormal +public import LeanPool.GraphMinor.GM07.NetSwapPair +public import LeanPool.GraphMinor.GM07.NetSwapPasting +public import LeanPool.GraphMinor.GM07.NetSwapPastingCounts +public import LeanPool.GraphMinor.GM07.NetSwapReplacement +public import LeanPool.GraphMinor.GM07.NetSwapSides +public import LeanPool.GraphMinor.GM07.Open +public import LeanPool.GraphMinor.GM07.PullForest +public import LeanPool.GraphMinor.GM07.PushForest +public import LeanPool.GraphMinor.GM07.RegionNest +public import LeanPool.GraphMinor.GM07.Reroute +public import LeanPool.GraphMinor.GM07.RootedCut +public import LeanPool.GraphMinor.GM07.Section11 +public import LeanPool.GraphMinor.GM07.Section11a +public import LeanPool.GraphMinor.GM07.Section11b +public import LeanPool.GraphMinor.GM07.Section11c +public import LeanPool.GraphMinor.GM07.Section11d +public import LeanPool.GraphMinor.GM07.Section11e +public import LeanPool.GraphMinor.GM07.Section11f +public import LeanPool.GraphMinor.GM07.Section11g +public import LeanPool.GraphMinor.GM07.Section2 +public import LeanPool.GraphMinor.GM07.Section26 +public import LeanPool.GraphMinor.GM07.Section26Edges +public import LeanPool.GraphMinor.GM07.Section26Path +public import LeanPool.GraphMinor.GM07.Section2Base +public import LeanPool.GraphMinor.GM07.Section2Euler +public import LeanPool.GraphMinor.GM07.Section2MinVal +public import LeanPool.GraphMinor.GM07.Section2Seam +public import LeanPool.GraphMinor.GM07.Section3 +public import LeanPool.GraphMinor.GM07.Section35 +public import LeanPool.GraphMinor.GM07.Section4 +public import LeanPool.GraphMinor.GM07.Section41 +public import LeanPool.GraphMinor.GM07.Section43 +public import LeanPool.GraphMinor.GM07.Section44 +public import LeanPool.GraphMinor.GM07.Section46BoundaryComponents +public import LeanPool.GraphMinor.GM07.Section46BoundaryEdges +public import LeanPool.GraphMinor.GM07.Section46BoundaryPaths +public import LeanPool.GraphMinor.GM07.Section46CappedCircle +public import LeanPool.GraphMinor.GM07.Section46CentralEnds +public import LeanPool.GraphMinor.GM07.Section46CentralLift +public import LeanPool.GraphMinor.GM07.Section46ChooseLift +public import LeanPool.GraphMinor.GM07.Section46CircleCuff +public import LeanPool.GraphMinor.GM07.Section46ClaimOne +public import LeanPool.GraphMinor.GM07.Section46ClaimTwo +public import LeanPool.GraphMinor.GM07.Section46ClosedComponents +public import LeanPool.GraphMinor.GM07.Section46ComponentsMeetVertices +public import LeanPool.GraphMinor.GM07.Section46Constants +public import LeanPool.GraphMinor.GM07.Section46ConstructAndCount +public import LeanPool.GraphMinor.GM07.Section46CuffBound +public import LeanPool.GraphMinor.GM07.Section46CuffComponents +public import LeanPool.GraphMinor.GM07.Section46CuffIncidences +public import LeanPool.GraphMinor.GM07.Section46Deficient +public import LeanPool.GraphMinor.GM07.Section46DeficientCap +public import LeanPool.GraphMinor.GM07.Section46DeficientDisc +public import LeanPool.GraphMinor.GM07.Section46DeficientPath +public import LeanPool.GraphMinor.GM07.Section46DeficientSeam +public import LeanPool.GraphMinor.GM07.Section46DeficientSide +public import LeanPool.GraphMinor.GM07.Section46Descend +public import LeanPool.GraphMinor.GM07.Section46DiscApproach +public import LeanPool.GraphMinor.GM07.Section46DiscSides +public import LeanPool.GraphMinor.GM07.Section46DiscSlide +public import LeanPool.GraphMinor.GM07.Section46DrawingContactCount +public import LeanPool.GraphMinor.GM07.Section46EdgeContacts +public import LeanPool.GraphMinor.GM07.Section46EdgeIncidence +public import LeanPool.GraphMinor.GM07.Section46EdgeLift +public import LeanPool.GraphMinor.GM07.Section46EdgeSegments +public import LeanPool.GraphMinor.GM07.Section46FibreCount +public import LeanPool.GraphMinor.GM07.Section46FibreValency +public import LeanPool.GraphMinor.GM07.Section46Fibres +public import LeanPool.GraphMinor.GM07.Section46Final +public import LeanPool.GraphMinor.GM07.Section46FirstEdge +public import LeanPool.GraphMinor.GM07.Section46InteriorIncidences +public import LeanPool.GraphMinor.GM07.Section46IntervalSlide +public import LeanPool.GraphMinor.GM07.Section46JPlus +public import LeanPool.GraphMinor.GM07.Section46LContactBounds +public import LeanPool.GraphMinor.GM07.Section46LCoverage +public import LeanPool.GraphMinor.GM07.Section46Lambda +public import LeanPool.GraphMinor.GM07.Section46LongCutParameters +public import LeanPool.GraphMinor.GM07.Section46LongEdges +public import LeanPool.GraphMinor.GM07.Section46LongPieces +public import LeanPool.GraphMinor.GM07.Section46MatchedId +public import LeanPool.GraphMinor.GM07.Section46Matching +public import LeanPool.GraphMinor.GM07.Section46NoArcs +public import LeanPool.GraphMinor.GM07.Section46NullCircle +public import LeanPool.GraphMinor.GM07.Section46OldVertexCoverage +public import LeanPool.GraphMinor.GM07.Section46OldVertices +public import LeanPool.GraphMinor.GM07.Section46OrderedContacts +public import LeanPool.GraphMinor.GM07.Section46ProperSubarc +public import LeanPool.GraphMinor.GM07.Section46Psi +public import LeanPool.GraphMinor.GM07.Section46PsiFibres +public import LeanPool.GraphMinor.GM07.Section46PullGraph +public import LeanPool.GraphMinor.GM07.Section46Reduce +public import LeanPool.GraphMinor.GM07.Section46Refine +public import LeanPool.GraphMinor.GM07.Section46RefinedEdges +public import LeanPool.GraphMinor.GM07.Section46RetainedArcs +public import LeanPool.GraphMinor.GM07.Section46RetainedCircles +public import LeanPool.GraphMinor.GM07.Section46RetainedLinking +public import LeanPool.GraphMinor.GM07.Section46SeamComplement +public import LeanPool.GraphMinor.GM07.Section46SeamEdgeCounts +public import LeanPool.GraphMinor.GM07.Section46SeamParts +public import LeanPool.GraphMinor.GM07.Section46SeamPartsDefs +public import LeanPool.GraphMinor.GM07.Section46SeamRefinement +public import LeanPool.GraphMinor.GM07.Section46ShortEdges +public import LeanPool.GraphMinor.GM07.Section46SideParam +public import LeanPool.GraphMinor.GM07.Section46SlideDescent +public import LeanPool.GraphMinor.GM07.Section46SlideWrap +public import LeanPool.GraphMinor.GM07.Section46SplitEdges +public import LeanPool.GraphMinor.GM07.Section46SurfaceApproach +public import LeanPool.GraphMinor.GM07.Section46ThreePieces +public import LeanPool.GraphMinor.GM07.Section46UniqueLiftLimit +public import LeanPool.GraphMinor.GM07.Section46Universe +public import LeanPool.GraphMinor.GM07.Section46Valency +public import LeanPool.GraphMinor.GM07.Section46W +public import LeanPool.GraphMinor.GM07.Section46WIntersections +public import LeanPool.GraphMinor.GM07.Section46WTransport +public import LeanPool.GraphMinor.GM07.Section46WalkOfConnected +public import LeanPool.GraphMinor.GM07.Section5 +public import LeanPool.GraphMinor.GM07.Section5a +public import LeanPool.GraphMinor.GM07.Section5b +public import LeanPool.GraphMinor.GM07.Section6 +public import LeanPool.GraphMinor.GM07.Section7 +public import LeanPool.GraphMinor.GM07.Section8 +public import LeanPool.GraphMinor.GM07.Section9 +public import LeanPool.GraphMinor.GM07.Section9CoreProved +public import LeanPool.GraphMinor.GM07.Section9Cylinder +public import LeanPool.GraphMinor.GM07.Section9CylinderProved +public import LeanPool.GraphMinor.GM07.Section9DiscSphere +public import LeanPool.GraphMinor.GM07.Section9Grid +public import LeanPool.GraphMinor.GM07.Section9MoveOff +public import LeanPool.GraphMinor.GM07.ShrinkForest +public import LeanPool.GraphMinor.GM07.SideDisc +public import LeanPool.GraphMinor.GM07.Slit +public import LeanPool.GraphMinor.GM07.SlitPlane +public import LeanPool.GraphMinor.GM07.SplitForest +public import LeanPool.GraphMinor.GM07.StarDisc +public import LeanPool.GraphMinor.GM07.TameDisc +public import LeanPool.GraphMinor.GM07.TameLines +public import LeanPool.GraphMinor.GM07.Taper +public import LeanPool.GraphMinor.GM07.ThickForest +public import LeanPool.GraphMinor.GM07.TreeChart +public import LeanPool.GraphMinor.GM07.TreeStep +public import LeanPool.GraphMinor.GM07.Whisker +public import LeanPool.GraphMinor.GM09.ArcSides +public import LeanPool.GraphMinor.GM09.Basic +public import LeanPool.GraphMinor.GM09.Bridge +public import LeanPool.GraphMinor.GM09.CircleCut +public import LeanPool.GraphMinor.GM09.CliqueDiscs +public import LeanPool.GraphMinor.GM09.Defs +public import LeanPool.GraphMinor.GM09.DiscDrawing +public import LeanPool.GraphMinor.GM09.DiscPlacement +public import LeanPool.GraphMinor.GM09.EarCompare +public import LeanPool.GraphMinor.GM09.EarDisc +public import LeanPool.GraphMinor.GM09.EarUnion +public import LeanPool.GraphMinor.GM09.GraphCircuits +public import LeanPool.GraphMinor.GM09.Lawns +public import LeanPool.GraphMinor.GM09.NestEdgeCount +public import LeanPool.GraphMinor.GM09.NestUncrossing +public import LeanPool.GraphMinor.GM09.Park +public import LeanPool.GraphMinor.GM09.PlanarNests +public import LeanPool.GraphMinor.GM09.Restriction +public import LeanPool.GraphMinor.GM09.RuralAdd +public import LeanPool.GraphMinor.GM09.RuralClean +public import LeanPool.GraphMinor.GM09.RuralExtend +public import LeanPool.GraphMinor.GM09.Section10 +public import LeanPool.GraphMinor.GM09.Section10b +public import LeanPool.GraphMinor.GM09.Section10c +public import LeanPool.GraphMinor.GM09.Section10d +public import LeanPool.GraphMinor.GM09.Section10e +public import LeanPool.GraphMinor.GM09.Section10f +public import LeanPool.GraphMinor.GM09.Section10g +public import LeanPool.GraphMinor.GM09.Section11a +public import LeanPool.GraphMinor.GM09.Section11b +public import LeanPool.GraphMinor.GM09.Section11c +public import LeanPool.GraphMinor.GM09.Section11d +public import LeanPool.GraphMinor.GM09.Section2a +public import LeanPool.GraphMinor.GM09.Section2b +public import LeanPool.GraphMinor.GM09.Section2c +public import LeanPool.GraphMinor.GM09.Section2d +public import LeanPool.GraphMinor.GM09.Section2e +public import LeanPool.GraphMinor.GM09.Section3a +public import LeanPool.GraphMinor.GM09.Section3b +public import LeanPool.GraphMinor.GM09.Section3c +public import LeanPool.GraphMinor.GM09.Section4a +public import LeanPool.GraphMinor.GM09.Section4b +public import LeanPool.GraphMinor.GM09.Section4c +public import LeanPool.GraphMinor.GM09.Section5a +public import LeanPool.GraphMinor.GM09.Section5b +public import LeanPool.GraphMinor.GM09.Section6 +public import LeanPool.GraphMinor.GM09.Section6b +public import LeanPool.GraphMinor.GM09.Section6c +public import LeanPool.GraphMinor.GM09.Section7 +public import LeanPool.GraphMinor.GM09.Section8 +public import LeanPool.GraphMinor.GM09.Section9 +public import LeanPool.GraphMinor.GM10.BranchWidth +public import LeanPool.GraphMinor.GM10.Defs +public import LeanPool.GraphMinor.GM10.Defs2 +public import LeanPool.GraphMinor.GM10.GraphSubhypergraph +public import LeanPool.GraphMinor.GM10.Section10 +public import LeanPool.GraphMinor.GM10.Section11 +public import LeanPool.GraphMinor.GM10.Section12 +public import LeanPool.GraphMinor.GM10.Section6 +public import LeanPool.GraphMinor.GM10.Section7 +public import LeanPool.GraphMinor.GM10.Section8 +public import LeanPool.GraphMinor.GM10.Section9 +public import LeanPool.GraphMinor.GM10.Statements +public import LeanPool.GraphMinor.GM10.Submodular +public import LeanPool.GraphMinor.GM10.SubmodularBasic +public import LeanPool.GraphMinor.GM10.SubmodularTree +public import LeanPool.GraphMinor.GM10.TangleLemmas +public import LeanPool.GraphMinor.GM10.TreeWidth +public import LeanPool.GraphMinor.GM10.TreeWidthBasic +public import LeanPool.GraphMinor.GM10.TreeWidthClaims +public import LeanPool.GraphMinor.GM11.ArcDrawings +public import LeanPool.GraphMinor.GM11.CircuitRegions +public import LeanPool.GraphMinor.GM11.Cited +public import LeanPool.GraphMinor.GM11.CitedResults +public import LeanPool.GraphMinor.GM11.CollarCut +public import LeanPool.GraphMinor.GM11.Corners +public import LeanPool.GraphMinor.GM11.CurveArc +public import LeanPool.GraphMinor.GM11.CutEdges +public import LeanPool.GraphMinor.GM11.Cylinder +public import LeanPool.GraphMinor.GM11.Defs +public import LeanPool.GraphMinor.GM11.DrawingConnectivity +public import LeanPool.GraphMinor.GM11.DrawingOps +public import LeanPool.GraphMinor.GM11.DrawingTopology +public import LeanPool.GraphMinor.GM11.EdgeChart +public import LeanPool.GraphMinor.GM11.EdgeSides +public import LeanPool.GraphMinor.GM11.EvenCircuit +public import LeanPool.GraphMinor.GM11.Fan +public import LeanPool.GraphMinor.GM11.FlatCover +public import LeanPool.GraphMinor.GM11.Forest +public import LeanPool.GraphMinor.GM11.ForestRegions +public import LeanPool.GraphMinor.GM11.GlueDiscs +public import LeanPool.GraphMinor.GM11.GlueFaces +public import LeanPool.GraphMinor.GM11.HubCollar +public import LeanPool.GraphMinor.GM11.HubCycle +public import LeanPool.GraphMinor.GM11.HubWalk +public import LeanPool.GraphMinor.GM11.LeafNbhd +public import LeanPool.GraphMinor.GM11.LocalCone +public import LeanPool.GraphMinor.GM11.Nice73 +public import LeanPool.GraphMinor.GM11.NicePush +public import LeanPool.GraphMinor.GM11.NiceSets +public import LeanPool.GraphMinor.GM11.NiceStatements +public import LeanPool.GraphMinor.GM11.NormalNoncover +public import LeanPool.GraphMinor.GM11.OArcCircuit +public import LeanPool.GraphMinor.GM11.OpenAround +public import LeanPool.GraphMinor.GM11.PaintingCells +public import LeanPool.GraphMinor.GM11.PaintingFacts +public import LeanPool.GraphMinor.GM11.PaintingFlat +public import LeanPool.GraphMinor.GM11.PaintingPerimeter +public import LeanPool.GraphMinor.GM11.PaintingRadial +public import LeanPool.GraphMinor.GM11.PaintingRegions +public import LeanPool.GraphMinor.GM11.PaintingStars +public import LeanPool.GraphMinor.GM11.PaintingTwoCell +public import LeanPool.GraphMinor.GM11.PathClasses +public import LeanPool.GraphMinor.GM11.PerimeterBound +public import LeanPool.GraphMinor.GM11.PerimeterCount +public import LeanPool.GraphMinor.GM11.PerimeterExists +public import LeanPool.GraphMinor.GM11.PerimeterPull +public import LeanPool.GraphMinor.GM11.PerimeterWalk +public import LeanPool.GraphMinor.GM11.PlaneFacts +public import LeanPool.GraphMinor.GM11.PolarChart +public import LeanPool.GraphMinor.GM11.RadialAccess +public import LeanPool.GraphMinor.GM11.RadialBasics +public import LeanPool.GraphMinor.GM11.RadialCap +public import LeanPool.GraphMinor.GM11.RadialChord +public import LeanPool.GraphMinor.GM11.RadialCorners +public import LeanPool.GraphMinor.GM11.RadialExists +public import LeanPool.GraphMinor.GM11.RadialFaces +public import LeanPool.GraphMinor.GM11.RadialFacts +public import LeanPool.GraphMinor.GM11.RadialPrescribed +public import LeanPool.GraphMinor.GM11.RadialRegions +public import LeanPool.GraphMinor.GM11.RadialTwoCell +public import LeanPool.GraphMinor.GM11.RegionCount +public import LeanPool.GraphMinor.GM11.RegionWalk +public import LeanPool.GraphMinor.GM11.Regions +public import LeanPool.GraphMinor.GM11.Restraints +public import LeanPool.GraphMinor.GM11.Rings +public import LeanPool.GraphMinor.GM11.Rotation +public import LeanPool.GraphMinor.GM11.Section3 +public import LeanPool.GraphMinor.GM11.Section4 +public import LeanPool.GraphMinor.GM11.Section4b +public import LeanPool.GraphMinor.GM11.Section4c +public import LeanPool.GraphMinor.GM11.Section5 +public import LeanPool.GraphMinor.GM11.Section5b +public import LeanPool.GraphMinor.GM11.Section5c +public import LeanPool.GraphMinor.GM11.Section6 +public import LeanPool.GraphMinor.GM11.Section64 +public import LeanPool.GraphMinor.GM11.Section64b +public import LeanPool.GraphMinor.GM11.Section6Pretangle +public import LeanPool.GraphMinor.GM11.Section7 +public import LeanPool.GraphMinor.GM11.Section79 +public import LeanPool.GraphMinor.GM11.Section7b +public import LeanPool.GraphMinor.GM11.Section8 +public import LeanPool.GraphMinor.GM11.Section81 +public import LeanPool.GraphMinor.GM11.Section810 +public import LeanPool.GraphMinor.GM11.Section810Connected +public import LeanPool.GraphMinor.GM11.Section810Paths +public import LeanPool.GraphMinor.GM11.Section85 +public import LeanPool.GraphMinor.GM11.Section87 +public import LeanPool.GraphMinor.GM11.Section88 +public import LeanPool.GraphMinor.GM11.Section89 +public import LeanPool.GraphMinor.GM11.Section91 +public import LeanPool.GraphMinor.GM11.Section92 +public import LeanPool.GraphMinor.GM11.Separate +public import LeanPool.GraphMinor.GM11.Solid +public import LeanPool.GraphMinor.GM11.SphereRegion +public import LeanPool.GraphMinor.GM11.SplitEdge +public import LeanPool.GraphMinor.GM11.SquareChart +public import LeanPool.GraphMinor.GM11.StarChart +public import LeanPool.GraphMinor.GM11.Theorem61 +public import LeanPool.GraphMinor.GM11.Theorem63 +public import LeanPool.GraphMinor.GM11.Theorem64 +public import LeanPool.GraphMinor.GM11.Theorem65 +public import LeanPool.GraphMinor.GM11.Theorem66 +public import LeanPool.GraphMinor.GM11.Theorem75 +public import LeanPool.GraphMinor.GM11.ThreeCircuits +public import LeanPool.GraphMinor.GM11.Ties +public import LeanPool.GraphMinor.GM11.Walks +public import LeanPool.GraphMinor.GM12.Bridge +public import LeanPool.GraphMinor.GM12.Cited +public import LeanPool.GraphMinor.GM12.Defs +public import LeanPool.GraphMinor.GM12.Induced +public import LeanPool.GraphMinor.GM12.MetricRadial +public import LeanPool.GraphMinor.GM12.Section1 +public import LeanPool.GraphMinor.GM12.Section1b +public import LeanPool.GraphMinor.GM12.Section2 +public import LeanPool.GraphMinor.GM12.Section2ApproachShrink +public import LeanPool.GraphMinor.GM12.Section2ArcComponents +public import LeanPool.GraphMinor.GM12.Section2ArcGermChart +public import LeanPool.GraphMinor.GM12.Section2ArcHomotopy +public import LeanPool.GraphMinor.GM12.Section2BacktrackInside +public import LeanPool.GraphMinor.GM12.Section2Case1 +public import LeanPool.GraphMinor.GM12.Section2Case2Induction +public import LeanPool.GraphMinor.GM12.Section2Case2Inside +public import LeanPool.GraphMinor.GM12.Section2Case2Trace +public import LeanPool.GraphMinor.GM12.Section2ChordGap +public import LeanPool.GraphMinor.GM12.Section2ChordTraceRestriction +public import LeanPool.GraphMinor.GM12.Section2CirclePeriod +public import LeanPool.GraphMinor.GM12.Section2CommonCornerEntry +public import LeanPool.GraphMinor.GM12.Section2CommonPatchSpokes +public import LeanPool.GraphMinor.GM12.Section2ConnectedRegionArc +public import LeanPool.GraphMinor.GM12.Section2CornerAccumulation +public import LeanPool.GraphMinor.GM12.Section2Corners +public import LeanPool.GraphMinor.GM12.Section2CurveCounts +public import LeanPool.GraphMinor.GM12.Section2CyclicDeformation +public import LeanPool.GraphMinor.GM12.Section2CyclicEmbedding +public import LeanPool.GraphMinor.GM12.Section2CyclicHitParameters +public import LeanPool.GraphMinor.GM12.Section2CyclicReparametrization +public import LeanPool.GraphMinor.GM12.Section2DeformationConclusion +public import LeanPool.GraphMinor.GM12.Section2DeformationInside +public import LeanPool.GraphMinor.GM12.Section2DiscChordSplit +public import LeanPool.GraphMinor.GM12.Section2DistinctRegionPaths +public import LeanPool.GraphMinor.GM12.Section2DistinctVisits +public import LeanPool.GraphMinor.GM12.Section2EntryAtPath +public import LeanPool.GraphMinor.GM12.Section2EntryAtPathInSubspace +public import LeanPool.GraphMinor.GM12.Section2EntryComparison +public import LeanPool.GraphMinor.GM12.Section2EntryConstruction +public import LeanPool.GraphMinor.GM12.Section2EntryEnds +public import LeanPool.GraphMinor.GM12.Section2EntryExistence +public import LeanPool.GraphMinor.GM12.Section2EntryImageRestriction +public import LeanPool.GraphMinor.GM12.Section2EntryIndependence +public import LeanPool.GraphMinor.GM12.Section2EntryNormalization +public import LeanPool.GraphMinor.GM12.Section2EntryPatch +public import LeanPool.GraphMinor.GM12.Section2EntryPaths +public import LeanPool.GraphMinor.GM12.Section2EntryUnique +public import LeanPool.GraphMinor.GM12.Section2EntryWitness +public import LeanPool.GraphMinor.GM12.Section2FreeSectorChord +public import LeanPool.GraphMinor.GM12.Section2HalfEdgeNeighbourhood +public import LeanPool.GraphMinor.GM12.Section2HitOrder +public import LeanPool.GraphMinor.GM12.Section2ImageGermCover +public import LeanPool.GraphMinor.GM12.Section2InsideHomotopy +public import LeanPool.GraphMinor.GM12.Section2IntervalCoverage +public import LeanPool.GraphMinor.GM12.Section2LeafArcData +public import LeanPool.GraphMinor.GM12.Section2LeafEntryEquality +public import LeanPool.GraphMinor.GM12.Section2LeafEntryExistence +public import LeanPool.GraphMinor.GM12.Section2LeafEntryPatchProof +public import LeanPool.GraphMinor.GM12.Section2LeafPatch +public import LeanPool.GraphMinor.GM12.Section2LeafSlitPatch +public import LeanPool.GraphMinor.GM12.Section2LeafTraceRestriction +public import LeanPool.GraphMinor.GM12.Section2LocalImageRestriction +public import LeanPool.GraphMinor.GM12.Section2MinimalChord +public import LeanPool.GraphMinor.GM12.Section2NonemptyEdges +public import LeanPool.GraphMinor.GM12.Section2NormalEntry +public import LeanPool.GraphMinor.GM12.Section2NormalEntryExistence +public import LeanPool.GraphMinor.GM12.Section2NormalNoncover +public import LeanPool.GraphMinor.GM12.Section2PartitionDeformation +public import LeanPool.GraphMinor.GM12.Section2PatchEntersLike +public import LeanPool.GraphMinor.GM12.Section2PatchEntryComparison +public import LeanPool.GraphMinor.GM12.Section2PathHomotopy +public import LeanPool.GraphMinor.GM12.Section2PeriodGermSelection +public import LeanPool.GraphMinor.GM12.Section2PeriodicHits +public import LeanPool.GraphMinor.GM12.Section2RayChartPatch +public import LeanPool.GraphMinor.GM12.Section2RegionComponents +public import LeanPool.GraphMinor.GM12.Section2RegionIntervals +public import LeanPool.GraphMinor.GM12.Section2RegionPathDeformation +public import LeanPool.GraphMinor.GM12.Section2RegionVisitHomotopy +public import LeanPool.GraphMinor.GM12.Section2SectorContraction +public import LeanPool.GraphMinor.GM12.Section2SectorCover +public import LeanPool.GraphMinor.GM12.Section2SectorEntry +public import LeanPool.GraphMinor.GM12.Section2SectorEntryEquality +public import LeanPool.GraphMinor.GM12.Section2SectorExistence +public import LeanPool.GraphMinor.GM12.Section2SectorHomotopy +public import LeanPool.GraphMinor.GM12.Section2SectorPatch +public import LeanPool.GraphMinor.GM12.Section2SectorSpoke +public import LeanPool.GraphMinor.GM12.Section2Simple +public import LeanPool.GraphMinor.GM12.Section2SingleVisitDeformation +public import LeanPool.GraphMinor.GM12.Section2SlitBall +public import LeanPool.GraphMinor.GM12.Section2SpokePairTopology +public import LeanPool.GraphMinor.GM12.Section2SpokePaths +public import LeanPool.GraphMinor.GM12.Section2SpokeUniqueness +public import LeanPool.GraphMinor.GM12.Section2StarChart +public import LeanPool.GraphMinor.GM12.Section2StraightArcChart +public import LeanPool.GraphMinor.GM12.Section2TangleTraceExistence +public import LeanPool.GraphMinor.GM12.Section2TerminalPatch +public import LeanPool.GraphMinor.GM12.Section2TerminalSectors +public import LeanPool.GraphMinor.GM12.Section2Theorem +public import LeanPool.GraphMinor.GM12.Section2ThetaConstruction +public import LeanPool.GraphMinor.GM12.Section2ThetaDiscs +public import LeanPool.GraphMinor.GM12.Section2TraceComposition +public import LeanPool.GraphMinor.GM12.Section2TraceConstruction +public import LeanPool.GraphMinor.GM12.Section2TraceDeterminacy +public import LeanPool.GraphMinor.GM12.Section2TraceEdgeRestriction +public import LeanPool.GraphMinor.GM12.Section2TraceExistence +public import LeanPool.GraphMinor.GM12.Section2TraceGerms +public import LeanPool.GraphMinor.GM12.Section2TraceImage +public import LeanPool.GraphMinor.GM12.Section2TraceParameters +public import LeanPool.GraphMinor.GM12.Section2TracePartition +public import LeanPool.GraphMinor.GM12.Section2TracePartitionCarrier +public import LeanPool.GraphMinor.GM12.Section2TraceReverse +public import LeanPool.GraphMinor.GM12.Section2TraceSubdivision +public import LeanPool.GraphMinor.GM12.Section2TraceTranslation +public import LeanPool.GraphMinor.GM12.Section2TraceVertexRestriction +public import LeanPool.GraphMinor.GM12.Section2TraceVisits +public import LeanPool.GraphMinor.GM12.Section2VisitCarrier +public import LeanPool.GraphMinor.GM12.Section2WalkCarriers +public import LeanPool.GraphMinor.GM12.Section2WalkInside +public import LeanPool.GraphMinor.GM12.Section2Zero +public import LeanPool.GraphMinor.GM12.Section3AddNormalCircle +public import LeanPool.GraphMinor.GM12.Section3Alpha +public import LeanPool.GraphMinor.GM12.Section3AlphaEmptyClasses +public import LeanPool.GraphMinor.GM12.Section3AlphaReduction +public import LeanPool.GraphMinor.GM12.Section3AmbientDrawing +public import LeanPool.GraphMinor.GM12.Section3AmbientFeasibilityForest +public import LeanPool.GraphMinor.GM12.Section3AmbientTransfer +public import LeanPool.GraphMinor.GM12.Section3AuxiliaryDisc +public import LeanPool.GraphMinor.GM12.Section3BarbellCircles +public import LeanPool.GraphMinor.GM12.Section3BarbellSchismatic +public import LeanPool.GraphMinor.GM12.Section3BoundaryEquality +public import LeanPool.GraphMinor.GM12.Section3BoundaryLinked +public import LeanPool.GraphMinor.GM12.Section3BranchRelabel +public import LeanPool.GraphMinor.GM12.Section3BridgeSeparation +public import LeanPool.GraphMinor.GM12.Section3CandidateExistence +public import LeanPool.GraphMinor.GM12.Section3CapComparison +public import LeanPool.GraphMinor.GM12.Section3CapOneDisc +public import LeanPool.GraphMinor.GM12.Section3CapTopology +public import LeanPool.GraphMinor.GM12.Section3ChordDichotomy +public import LeanPool.GraphMinor.GM12.Section3CircleCoordinates +public import LeanPool.GraphMinor.GM12.Section3CircleCount +public import LeanPool.GraphMinor.GM12.Section3CircleExterior +public import LeanPool.GraphMinor.GM12.Section3CircleInclusion +public import LeanPool.GraphMinor.GM12.Section3CircleLoops +public import LeanPool.GraphMinor.GM12.Section3CircleObstructions +public import LeanPool.GraphMinor.GM12.Section3CirclePairGraph +public import LeanPool.GraphMinor.GM12.Section3CircleSchismatic +public import LeanPool.GraphMinor.GM12.Section3ClosedComponents +public import LeanPool.GraphMinor.GM12.Section3ClosedCoverPaths +public import LeanPool.GraphMinor.GM12.Section3CollarChart +public import LeanPool.GraphMinor.GM12.Section3CollarComplement +public import LeanPool.GraphMinor.GM12.Section3CollarManifold +public import LeanPool.GraphMinor.GM12.Section3CompleteChordCarrier +public import LeanPool.GraphMinor.GM12.Section3Components +public import LeanPool.GraphMinor.GM12.Section3ConvexPatch +public import LeanPool.GraphMinor.GM12.Section3CuffSurrounds +public import LeanPool.GraphMinor.GM12.Section3CurveMultiplicity +public import LeanPool.GraphMinor.GM12.Section3DiscBoundaryExtension +public import LeanPool.GraphMinor.GM12.Section3DiscChainBoundary +public import LeanPool.GraphMinor.GM12.Section3DiscChainCarrier +public import LeanPool.GraphMinor.GM12.Section3DiscChainChord +public import LeanPool.GraphMinor.GM12.Section3DiscChainRedundancy +public import LeanPool.GraphMinor.GM12.Section3DiscChordDivision +public import LeanPool.GraphMinor.GM12.Section3DiscCrossFree +public import LeanPool.GraphMinor.GM12.Section3DiscInteriorPush +public import LeanPool.GraphMinor.GM12.Section3DiscRegion +public import LeanPool.GraphMinor.GM12.Section3DiscStarForest +public import LeanPool.GraphMinor.GM12.Section3DiscStarLines +public import LeanPool.GraphMinor.GM12.Section3DiscUniqueness +public import LeanPool.GraphMinor.GM12.Section3DiscVI +public import LeanPool.GraphMinor.GM12.Section3DiscVIEmpty +public import LeanPool.GraphMinor.GM12.Section3DisjointEnclosingDiscs +public import LeanPool.GraphMinor.GM12.Section3DisjointFamilyWalks +public import LeanPool.GraphMinor.GM12.Section3DistinctCompleteChords +public import LeanPool.GraphMinor.GM12.Section3DivisionArcCount +public import LeanPool.GraphMinor.GM12.Section3DualPointSet +public import LeanPool.GraphMinor.GM12.Section3EmptyBoundaryDisc +public import LeanPool.GraphMinor.GM12.Section3EmptyClasses +public import LeanPool.GraphMinor.GM12.Section3EnclosingBranches +public import LeanPool.GraphMinor.GM12.Section3Extraction +public import LeanPool.GraphMinor.GM12.Section3ExtractionReduction +public import LeanPool.GraphMinor.GM12.Section3FeasibilityDiscs +public import LeanPool.GraphMinor.GM12.Section3FeasibilityForest +public import LeanPool.GraphMinor.GM12.Section3FeasibilityForests +public import LeanPool.GraphMinor.GM12.Section3FillOneDisc +public import LeanPool.GraphMinor.GM12.Section3FillingConnected +public import LeanPool.GraphMinor.GM12.Section3FiniteChordHomotopy +public import LeanPool.GraphMinor.GM12.Section3FiniteDrawingUnion +public import LeanPool.GraphMinor.GM12.Section3FiniteGraphSolid +public import LeanPool.GraphMinor.GM12.Section3FiniteReroute +public import LeanPool.GraphMinor.GM12.Section3ForestAlphaReduction +public import LeanPool.GraphMinor.GM12.Section3ForestBound +public import LeanPool.GraphMinor.GM12.Section3ForestConnections +public import LeanPool.GraphMinor.GM12.Section3ForestEmptyClasses +public import LeanPool.GraphMinor.GM12.Section3ForestTransport +public import LeanPool.GraphMinor.GM12.Section3FreeBoundary +public import LeanPool.GraphMinor.GM12.Section3GeometricAlpha +public import LeanPool.GraphMinor.GM12.Section3GeometricReduction +public import LeanPool.GraphMinor.GM12.Section3GlueHomeomorph +public import LeanPool.GraphMinor.GM12.Section3HalfPlaneCharts +public import LeanPool.GraphMinor.GM12.Section3HomeoWalks +public import LeanPool.GraphMinor.GM12.Section3IntermediateRegion +public import LeanPool.GraphMinor.GM12.Section3InternalRegionCurve +public import LeanPool.GraphMinor.GM12.Section3JoinedCircleCondition +public import LeanPool.GraphMinor.GM12.Section3JoinedCircleLoops +public import LeanPool.GraphMinor.GM12.Section3JoiningCircles +public import LeanPool.GraphMinor.GM12.Section3LocalReroute +public import LeanPool.GraphMinor.GM12.Section3LoopCuffClassification +public import LeanPool.GraphMinor.GM12.Section3LoopSchismaticCount +public import LeanPool.GraphMinor.GM12.Section3ManifoldPatch +public import LeanPool.GraphMinor.GM12.Section3MeetingCircleCondition +public import LeanPool.GraphMinor.GM12.Section3MeetingCircleExtraction +public import LeanPool.GraphMinor.GM12.Section3MeetingDiscBoundaries +public import LeanPool.GraphMinor.GM12.Section3MeetingDiscs +public import LeanPool.GraphMinor.GM12.Section3MeetingLoopCount +public import LeanPool.GraphMinor.GM12.Section3MeetingLoopSchismatic +public import LeanPool.GraphMinor.GM12.Section3MeetingSurrounding +public import LeanPool.GraphMinor.GM12.Section3ModelComplexity +public import LeanPool.GraphMinor.GM12.Section3NearPlanarAmbient +public import LeanPool.GraphMinor.GM12.Section3NearPlanarCircle +public import LeanPool.GraphMinor.GM12.Section3NormalEssentialCircle +public import LeanPool.GraphMinor.GM12.Section3NormalPathConnected +public import LeanPool.GraphMinor.GM12.Section3NormalPuncturedPaths +public import LeanPool.GraphMinor.GM12.Section3NormalRegionPaths +public import LeanPool.GraphMinor.GM12.Section3OneCuffCandidate +public import LeanPool.GraphMinor.GM12.Section3OneDisc +public import LeanPool.GraphMinor.GM12.Section3OneDiscComplement +public import LeanPool.GraphMinor.GM12.Section3OutsideDiscRegions +public import LeanPool.GraphMinor.GM12.Section3ParameterGaps +public import LeanPool.GraphMinor.GM12.Section3PartialPlanarity +public import LeanPool.GraphMinor.GM12.Section3PathConcatenation +public import LeanPool.GraphMinor.GM12.Section3PathIntoCircle +public import LeanPool.GraphMinor.GM12.Section3PlanarChordHomotopy +public import LeanPool.GraphMinor.GM12.Section3PlanarHomotopicCircle +public import LeanPool.GraphMinor.GM12.Section3PlanarityMaps +public import LeanPool.GraphMinor.GM12.Section3ProperDiscForest +public import LeanPool.GraphMinor.GM12.Section3Punctured +public import LeanPool.GraphMinor.GM12.Section3PuncturedBoundary +public import LeanPool.GraphMinor.GM12.Section3PuncturedCuffs +public import LeanPool.GraphMinor.GM12.Section3PuncturedForest +public import LeanPool.GraphMinor.GM12.Section3PuncturedModel +public import LeanPool.GraphMinor.GM12.Section3PuncturedSurface +public import LeanPool.GraphMinor.GM12.Section3PushPathOutside +public import LeanPool.GraphMinor.GM12.Section3RadialLines +public import LeanPool.GraphMinor.GM12.Section3ReplaceChordHomotopy +public import LeanPool.GraphMinor.GM12.Section3RerouteCarrier +public import LeanPool.GraphMinor.GM12.Section3RerouteContacts +public import LeanPool.GraphMinor.GM12.Section3RerouteCover +public import LeanPool.GraphMinor.GM12.Section3RestrictedCharts +public import LeanPool.GraphMinor.GM12.Section3SchismaticBounds +public import LeanPool.GraphMinor.GM12.Section3SchismaticCandidate +public import LeanPool.GraphMinor.GM12.Section3SelectedSmallDisc +public import LeanPool.GraphMinor.GM12.Section3SeparatedDiscs +public import LeanPool.GraphMinor.GM12.Section3SeparatedMetric +public import LeanPool.GraphMinor.GM12.Section3ShortCurve +public import LeanPool.GraphMinor.GM12.Section3ShortTrace +public import LeanPool.GraphMinor.GM12.Section3SmallCircleConditions +public import LeanPool.GraphMinor.GM12.Section3SmallDiscUnique +public import LeanPool.GraphMinor.GM12.Section3SolidConnections +public import LeanPool.GraphMinor.GM12.Section3SolidEmbedding +public import LeanPool.GraphMinor.GM12.Section3SolidPlanarity +public import LeanPool.GraphMinor.GM12.Section3SolidUnion +public import LeanPool.GraphMinor.GM12.Section3SphereChordBound +public import LeanPool.GraphMinor.GM12.Section3SphereChordTransfer +public import LeanPool.GraphMinor.GM12.Section3SphereSeparatorCount +public import LeanPool.GraphMinor.GM12.Section3SphereSideDisc +public import LeanPool.GraphMinor.GM12.Section3StarDrawing +public import LeanPool.GraphMinor.GM12.Section3StarDrawingForest +public import LeanPool.GraphMinor.GM12.Section3StarForest +public import LeanPool.GraphMinor.GM12.Section3SubcircleSelection +public import LeanPool.GraphMinor.GM12.Section3SubgraphDrawing +public import LeanPool.GraphMinor.GM12.Section3SubpathIntervals +public import LeanPool.GraphMinor.GM12.Section3SubspaceArcs +public import LeanPool.GraphMinor.GM12.Section3SubspaceDrawing +public import LeanPool.GraphMinor.GM12.Section3SubtypeComponents +public import LeanPool.GraphMinor.GM12.Section3SurfaceForestUnion +public import LeanPool.GraphMinor.GM12.Section3SurroundingDisc +public import LeanPool.GraphMinor.GM12.Section3SurroundingUnique +public import LeanPool.GraphMinor.GM12.Section3Theorem +public import LeanPool.GraphMinor.GM12.Section3ThetaCircles +public import LeanPool.GraphMinor.GM12.Section3ThetaClassification +public import LeanPool.GraphMinor.GM12.Section3ThetaCondition +public import LeanPool.GraphMinor.GM12.Section3ThetaCover +public import LeanPool.GraphMinor.GM12.Section3ThetaCuffs +public import LeanPool.GraphMinor.GM12.Section3ThetaFaceIntersection +public import LeanPool.GraphMinor.GM12.Section3ThetaHomotopy +public import LeanPool.GraphMinor.GM12.Section3ThetaPlanarity +public import LeanPool.GraphMinor.GM12.Section3ThetaProperPairs +public import LeanPool.GraphMinor.GM12.Section3ThetaSchismatic +public import LeanPool.GraphMinor.GM12.Section3ThetaSchismaticCount +public import LeanPool.GraphMinor.GM12.Section3ThetaSphere +public import LeanPool.GraphMinor.GM12.Section3ThetaSurrounding +public import LeanPool.GraphMinor.GM12.Section3ThirdDisc +public import LeanPool.GraphMinor.GM12.Section3ThreeBranchCount +public import LeanPool.GraphMinor.GM12.Section3ThreeDiscsForest +public import LeanPool.GraphMinor.GM12.Section3TwoCircleCuffs +public import LeanPool.GraphMinor.GM12.Section3TwoCuffCandidate +public import LeanPool.GraphMinor.GM12.Section3TwoDiscs +public import LeanPool.GraphMinor.GM12.Section3TwoLoopCount +public import LeanPool.GraphMinor.GM12.Section3UniformAlphaReduction +public import LeanPool.GraphMinor.GM12.Section3UnselectedBoundary +public import LeanPool.GraphMinor.GM12.Section3VIConnections +public import LeanPool.GraphMinor.GM12.Section4 +public import LeanPool.GraphMinor.GM12.Section4AdjacentSubdivisionPieces +public import LeanPool.GraphMinor.GM12.Section4AmbientMotion +public import LeanPool.GraphMinor.GM12.Section4ArcComplement +public import LeanPool.GraphMinor.GM12.Section4ArcMeetingParameters +public import LeanPool.GraphMinor.GM12.Section4ArcMotion +public import LeanPool.GraphMinor.GM12.Section4ArcSubdivision +public import LeanPool.GraphMinor.GM12.Section4ArcSubintervals +public import LeanPool.GraphMinor.GM12.Section4AttachedBranches +public import LeanPool.GraphMinor.GM12.Section4BranchImage +public import LeanPool.GraphMinor.GM12.Section4BranchUnions +public import LeanPool.GraphMinor.GM12.Section4ChordAvoidance +public import LeanPool.GraphMinor.GM12.Section4ChordCrossing +public import LeanPool.GraphMinor.GM12.Section4ChordFamily +public import LeanPool.GraphMinor.GM12.Section4ChordGeometry +public import LeanPool.GraphMinor.GM12.Section4ChordSeparation +public import LeanPool.GraphMinor.GM12.Section4CircleAvoidance +public import LeanPool.GraphMinor.GM12.Section4CircleInterpolation +public import LeanPool.GraphMinor.GM12.Section4CirclePortIntervals +public import LeanPool.GraphMinor.GM12.Section4CircleQuad +public import LeanPool.GraphMinor.GM12.Section4CircleQuadTransfer +public import LeanPool.GraphMinor.GM12.Section4CircleSubsetArc +public import LeanPool.GraphMinor.GM12.Section4CircuitAtomDistance +public import LeanPool.GraphMinor.GM12.Section4CircuitMeet +public import LeanPool.GraphMinor.GM12.Section4CircuitWalk +public import LeanPool.GraphMinor.GM12.Section4ClippedHalfEdges +public import LeanPool.GraphMinor.GM12.Section4CliqueControlMonotone +public import LeanPool.GraphMinor.GM12.Section4CliqueCrossingArcs +public import LeanPool.GraphMinor.GM12.Section4CliqueCrossingLabels +public import LeanPool.GraphMinor.GM12.Section4CliqueCrossingSource +public import LeanPool.GraphMinor.GM12.Section4CliqueEdges +public import LeanPool.GraphMinor.GM12.Section4CliqueHamiltonArcs +public import LeanPool.GraphMinor.GM12.Section4CliqueLabels +public import LeanPool.GraphMinor.GM12.Section4CliquePortCoordinates +public import LeanPool.GraphMinor.GM12.Section4CliquePortGraph +public import LeanPool.GraphMinor.GM12.Section4CliquePortMatrix +public import LeanPool.GraphMinor.GM12.Section4CliquePorts +public import LeanPool.GraphMinor.GM12.Section4CollarRadius +public import LeanPool.GraphMinor.GM12.Section4ConnectedSideBound +public import LeanPool.GraphMinor.GM12.Section4ContactDiscUniverses +public import LeanPool.GraphMinor.GM12.Section4ContactPartitionImage +public import LeanPool.GraphMinor.GM12.Section4ControlComposition +public import LeanPool.GraphMinor.GM12.Section4ConvexBoundaryParam +public import LeanPool.GraphMinor.GM12.Section4Counting +public import LeanPool.GraphMinor.GM12.Section4Cover +public import LeanPool.GraphMinor.GM12.Section4CrossDiscFamily +public import LeanPool.GraphMinor.GM12.Section4CrossDiscMarks +public import LeanPool.GraphMinor.GM12.Section4CrossDiscParam +public import LeanPool.GraphMinor.GM12.Section4CrossDiscQuadrants +public import LeanPool.GraphMinor.GM12.Section4CrossingContactLocation +public import LeanPool.GraphMinor.GM12.Section4CrossingCount +public import LeanPool.GraphMinor.GM12.Section4CrossingEndClasses +public import LeanPool.GraphMinor.GM12.Section4CrossingFeasibility +public import LeanPool.GraphMinor.GM12.Section4CrossingFeasibilityUniverses +public import LeanPool.GraphMinor.GM12.Section4CrossingLineModel +public import LeanPool.GraphMinor.GM12.Section4CrossingMultiplicity +public import LeanPool.GraphMinor.GM12.Section4CrossingPairEquiv +public import LeanPool.GraphMinor.GM12.Section4CrossingPoints +public import LeanPool.GraphMinor.GM12.Section4CrossingVertexDiscs +public import LeanPool.GraphMinor.GM12.Section4DiscCompression +public import LeanPool.GraphMinor.GM12.Section4DiscConnections +public import LeanPool.GraphMinor.GM12.Section4DiscEnlargement +public import LeanPool.GraphMinor.GM12.Section4DiscFamilyMatch +public import LeanPool.GraphMinor.GM12.Section4DiscMatch +public import LeanPool.GraphMinor.GM12.Section4DiscTangency +public import LeanPool.GraphMinor.GM12.Section4DiscTwist +public import LeanPool.GraphMinor.GM12.Section4DisjointArcDiscs +public import LeanPool.GraphMinor.GM12.Section4DisjointDiscs +public import LeanPool.GraphMinor.GM12.Section4Distance +public import LeanPool.GraphMinor.GM12.Section4DistantEdges +public import LeanPool.GraphMinor.GM12.Section4DistinctCrossDirections +public import LeanPool.GraphMinor.GM12.Section4DrawingControl +public import LeanPool.GraphMinor.GM12.Section4DrawnGraph +public import LeanPool.GraphMinor.GM12.Section4EdgeCircuit +public import LeanPool.GraphMinor.GM12.Section4EdgeEmptyDisc +public import LeanPool.GraphMinor.GM12.Section4EdgeLabels +public import LeanPool.GraphMinor.GM12.Section4EdgeRegionDistance +public import LeanPool.GraphMinor.GM12.Section4EmbeddedContactDiscs +public import LeanPool.GraphMinor.GM12.Section4EmbeddedOppositeContacts +public import LeanPool.GraphMinor.GM12.Section4EmptyDiscsDisjoint +public import LeanPool.GraphMinor.GM12.Section4EndPartition +public import LeanPool.GraphMinor.GM12.Section4ExternalPathBranches +public import LeanPool.GraphMinor.GM12.Section4EyeBoundaryParameters +public import LeanPool.GraphMinor.GM12.Section4EyeBranchControl +public import LeanPool.GraphMinor.GM12.Section4EyeConnections +public import LeanPool.GraphMinor.GM12.Section4EyeContactFamily +public import LeanPool.GraphMinor.GM12.Section4EyePathReindex +public import LeanPool.GraphMinor.GM12.Section4EyeRegionDistance +public import LeanPool.GraphMinor.GM12.Section4FamilyCuts +public import LeanPool.GraphMinor.GM12.Section4FamilySubdivision +public import LeanPool.GraphMinor.GM12.Section4FeasibilityTransport +public import LeanPool.GraphMinor.GM12.Section4FeasibleControl +public import LeanPool.GraphMinor.GM12.Section4FiniteLabels +public import LeanPool.GraphMinor.GM12.Section4FiniteLineDrawing +public import LeanPool.GraphMinor.GM12.Section4FiniteMarkedDiscJoin +public import LeanPool.GraphMinor.GM12.Section4FiniteSourceDiscs +public import LeanPool.GraphMinor.GM12.Section4FirstThreshold +public import LeanPool.GraphMinor.GM12.Section4FourContactBoundary +public import LeanPool.GraphMinor.GM12.Section4FreeEdgeDiscs +public import LeanPool.GraphMinor.GM12.Section4FreePathEdge +public import LeanPool.GraphMinor.GM12.Section4FreeSingleton +public import LeanPool.GraphMinor.GM12.Section4GeneralPositionPorts +public import LeanPool.GraphMinor.GM12.Section4HalfEdgeFeasibility +public import LeanPool.GraphMinor.GM12.Section4HamiltonChordCrossing +public import LeanPool.GraphMinor.GM12.Section4HamiltonChordSeparation +public import LeanPool.GraphMinor.GM12.Section4HamiltonCrossingWitness +public import LeanPool.GraphMinor.GM12.Section4HamiltonPorts +public import LeanPool.GraphMinor.GM12.Section4IncidentEdges +public import LeanPool.GraphMinor.GM12.Section4InducedEmbedding +public import LeanPool.GraphMinor.GM12.Section4IsoIncidence +public import LeanPool.GraphMinor.GM12.Section4JoinedCollars +public import LeanPool.GraphMinor.GM12.Section4JoinedStarFamily +public import LeanPool.GraphMinor.GM12.Section4LinearCrossCoordinates +public import LeanPool.GraphMinor.GM12.Section4LocalCrossDiscs +public import LeanPool.GraphMinor.GM12.Section4MarkedDiscJoin +public import LeanPool.GraphMinor.GM12.Section4MarkedDiscMatch +public import LeanPool.GraphMinor.GM12.Section4MeetingImages +public import LeanPool.GraphMinor.GM12.Section4MetricExistence +public import LeanPool.GraphMinor.GM12.Section4Minor +public import LeanPool.GraphMinor.GM12.Section4Model +public import LeanPool.GraphMinor.GM12.Section4ModelBack +public import LeanPool.GraphMinor.GM12.Section4ModelComposition +public import LeanPool.GraphMinor.GM12.Section4Monotone +public import LeanPool.GraphMinor.GM12.Section4NoIsolated +public import LeanPool.GraphMinor.GM12.Section4NonfreeEdgeCircuit +public import LeanPool.GraphMinor.GM12.Section4NormalArcDisc +public import LeanPool.GraphMinor.GM12.Section4NormalizedTarget +public import LeanPool.GraphMinor.GM12.Section4OneCrossingContactDiscs +public import LeanPool.GraphMinor.GM12.Section4OneCrossingDiscSystem +public import LeanPool.GraphMinor.GM12.Section4OneCrossingHalfEdges +public import LeanPool.GraphMinor.GM12.Section4OneMeetingSubdivision +public import LeanPool.GraphMinor.GM12.Section4OrderedEyeContactFamily +public import LeanPool.GraphMinor.GM12.Section4OrderedPortIntervals +public import LeanPool.GraphMinor.GM12.Section4OuterPorts +public import LeanPool.GraphMinor.GM12.Section4PairEnumeration +public import LeanPool.GraphMinor.GM12.Section4ParallelAugment +public import LeanPool.GraphMinor.GM12.Section4ParallelFamily +public import LeanPool.GraphMinor.GM12.Section4ParallelLine +public import LeanPool.GraphMinor.GM12.Section4ParametrizedContactDisc +public import LeanPool.GraphMinor.GM12.Section4PartitionControl +public import LeanPool.GraphMinor.GM12.Section4PathCircuitSeparation +public import LeanPool.GraphMinor.GM12.Section4PathEdgeSplit +public import LeanPool.GraphMinor.GM12.Section4PathExists +public import LeanPool.GraphMinor.GM12.Section4PathFacts +public import LeanPool.GraphMinor.GM12.Section4PathInside +public import LeanPool.GraphMinor.GM12.Section4PathThreshold +public import LeanPool.GraphMinor.GM12.Section4PathTruncation +public import LeanPool.GraphMinor.GM12.Section4PendantAugment +public import LeanPool.GraphMinor.GM12.Section4PendantLine +public import LeanPool.GraphMinor.GM12.Section4PieceNeighborhood +public import LeanPool.GraphMinor.GM12.Section4PinchedDisc +public import LeanPool.GraphMinor.GM12.Section4PlaneChart +public import LeanPool.GraphMinor.GM12.Section4PortDrawing +public import LeanPool.GraphMinor.GM12.Section4PortEdgeArc +public import LeanPool.GraphMinor.GM12.Section4PortIntersections +public import LeanPool.GraphMinor.GM12.Section4PortNeighborhoods +public import LeanPool.GraphMinor.GM12.Section4PortOrdering +public import LeanPool.GraphMinor.GM12.Section4ProtectedArc +public import LeanPool.GraphMinor.GM12.Section4ProtectedCrossDiscFamily +public import LeanPool.GraphMinor.GM12.Section4ProtectedDiscMatch +public import LeanPool.GraphMinor.GM12.Section4ProtectedMotion +public import LeanPool.GraphMinor.GM12.Section4QuadDiscFamilyMatch +public import LeanPool.GraphMinor.GM12.Section4QuadDiscMatch +public import LeanPool.GraphMinor.GM12.Section4QuadPartitionTransport +public import LeanPool.GraphMinor.GM12.Section4RadialResize +public import LeanPool.GraphMinor.GM12.Section4RegionArc +public import LeanPool.GraphMinor.GM12.Section4RegionContactDisc +public import LeanPool.GraphMinor.GM12.Section4RegionContactFamily +public import LeanPool.GraphMinor.GM12.Section4RegionContactSeparation +public import LeanPool.GraphMinor.GM12.Section4RegionFrontier +public import LeanPool.GraphMinor.GM12.Section4ResidualArc +public import LeanPool.GraphMinor.GM12.Section4ResidualStarDiscs +public import LeanPool.GraphMinor.GM12.Section4Separation +public import LeanPool.GraphMinor.GM12.Section4ShortestChain +public import LeanPool.GraphMinor.GM12.Section4SingletonDiscs +public import LeanPool.GraphMinor.GM12.Section4SingletonFeasibility +public import LeanPool.GraphMinor.GM12.Section4SmallClique +public import LeanPool.GraphMinor.GM12.Section4SmallCrossDiscs +public import LeanPool.GraphMinor.GM12.Section4SmallSurface +public import LeanPool.GraphMinor.GM12.Section4SmallSurfaceCopy +public import LeanPool.GraphMinor.GM12.Section4SourceDiscs +public import LeanPool.GraphMinor.GM12.Section4SourceHalfEdges +public import LeanPool.GraphMinor.GM12.Section4SourceResiduals +public import LeanPool.GraphMinor.GM12.Section4SpacedFreeEdges +public import LeanPool.GraphMinor.GM12.Section4SpanBranchBound +public import LeanPool.GraphMinor.GM12.Section4SpanControl +public import LeanPool.GraphMinor.GM12.Section4SpanSeparation +public import LeanPool.GraphMinor.GM12.Section4SplitBranch +public import LeanPool.GraphMinor.GM12.Section4SplitBranchConnected +public import LeanPool.GraphMinor.GM12.Section4SplitDrawing +public import LeanPool.GraphMinor.GM12.Section4SplitMinorModel +public import LeanPool.GraphMinor.GM12.Section4StripMotion +public import LeanPool.GraphMinor.GM12.Section4StripRectangle +public import LeanPool.GraphMinor.GM12.Section4SubdivisionArcIncidence +public import LeanPool.GraphMinor.GM12.Section4SubdivisionBranchConnected +public import LeanPool.GraphMinor.GM12.Section4SubdivisionBranches +public import LeanPool.GraphMinor.GM12.Section4SubdivisionCover +public import LeanPool.GraphMinor.GM12.Section4SubdivisionCrossingModel +public import LeanPool.GraphMinor.GM12.Section4SubdivisionCuts +public import LeanPool.GraphMinor.GM12.Section4SubdivisionGraph +public import LeanPool.GraphMinor.GM12.Section4SubdivisionIncidence +public import LeanPool.GraphMinor.GM12.Section4SubdivisionIntersections +public import LeanPool.GraphMinor.GM12.Section4SubdivisionMeetings +public import LeanPool.GraphMinor.GM12.Section4SubdivisionMinor +public import LeanPool.GraphMinor.GM12.Section4SubdivisionNoncrossing +public import LeanPool.GraphMinor.GM12.Section4SubdivisionPositions +public import LeanPool.GraphMinor.GM12.Section4SubdivisionStraightness +public import LeanPool.GraphMinor.GM12.Section4TargetOrientation +public import LeanPool.GraphMinor.GM12.Section4TargetReplacement +public import LeanPool.GraphMinor.GM12.Section4TerminalIndexing +public import LeanPool.GraphMinor.GM12.Section4Theorem43 +public import LeanPool.GraphMinor.GM12.Section4Theorem44 +public import LeanPool.GraphMinor.GM12.Section4Theorem44Large +public import LeanPool.GraphMinor.GM12.Section4Theorem45 +public import LeanPool.GraphMinor.GM12.Section4Theorem45Large +public import LeanPool.GraphMinor.GM12.Section4ThinArcDisc +public import LeanPool.GraphMinor.GM12.Section4ThinPlaneDisc +public import LeanPool.GraphMinor.GM12.Section4ThinStripDisc +public import LeanPool.GraphMinor.GM12.Section4TopologicalFeasibility +public import LeanPool.GraphMinor.GM12.Section4UnitDiscContacts +public import LeanPool.GraphMinor.GM12.Section4VertexConnections +public import LeanPool.GraphMinor.GM12.Section4VertexDiscs +public import LeanPool.GraphMinor.GM12.Section4VertexRegion +public import LeanPool.GraphMinor.GM12.Section4VertexRegionDistance +public import LeanPool.GraphMinor.GM12.Section4WalkMetric +public import LeanPool.GraphMinor.GM12.Section4WrappedChordCrossing +public import LeanPool.GraphMinor.GM12.Section5Band +public import LeanPool.GraphMinor.GM12.Section5Cap +public import LeanPool.GraphMinor.GM12.Section5Collar +public import LeanPool.GraphMinor.GM12.Section5Curve +public import LeanPool.GraphMinor.GM12.Section5Final +public import LeanPool.GraphMinor.GM12.Section5Piece +public import LeanPool.GraphMinor.GM12.Section5Replace +public import LeanPool.GraphMinor.GM12.Section5Respect +public import LeanPool.GraphMinor.GM12.Section5Side +public import LeanPool.GraphMinor.GM12.Section5Tangle +public import LeanPool.GraphMinor.GM12.Section6 +public import LeanPool.GraphMinor.GM12.Section6Chain +public import LeanPool.GraphMinor.GM12.Section6Claims +public import LeanPool.GraphMinor.GM12.Section6Order +public import LeanPool.GraphMinor.GM12.Section6Regions +public import LeanPool.GraphMinor.GM12.Section6Sides +public import LeanPool.GraphMinor.GM12.Section6Special +public import LeanPool.GraphMinor.GM12.Section6Walk +public import LeanPool.GraphMinor.GM12.Section7 +public import LeanPool.GraphMinor.GM12.Section710 +public import LeanPool.GraphMinor.GM12.Section711 +public import LeanPool.GraphMinor.GM12.Section711Cited +public import LeanPool.GraphMinor.GM12.Section711a +public import LeanPool.GraphMinor.GM12.Section72 +public import LeanPool.GraphMinor.GM12.Section72BigonSides +public import LeanPool.GraphMinor.GM12.Section72BoundaryCompare +public import LeanPool.GraphMinor.GM12.Section72ChordBigon +public import LeanPool.GraphMinor.GM12.Section72CirclePatch +public import LeanPool.GraphMinor.GM12.Section72Circuit +public import LeanPool.GraphMinor.GM12.Section72CornerCaps +public import LeanPool.GraphMinor.GM12.Section72DiscGluing +public import LeanPool.GraphMinor.GM12.Section72DiscMap +public import LeanPool.GraphMinor.GM12.Section72DiscSides +public import LeanPool.GraphMinor.GM12.Section72Divert +public import LeanPool.GraphMinor.GM12.Section72InitialLine +public import LeanPool.GraphMinor.GM12.Section72LocalDiversion +public import LeanPool.GraphMinor.GM12.Section72LostAtoms +public import LeanPool.GraphMinor.GM12.Section72MaximalCriterion +public import LeanPool.GraphMinor.GM12.Section72MergedParallel +public import LeanPool.GraphMinor.GM12.Section72MixedCaps +public import LeanPool.GraphMinor.GM12.Section72MixedCorners +public import LeanPool.GraphMinor.GM12.Section72NoBigon +public import LeanPool.GraphMinor.GM12.Section72OpenDisc +public import LeanPool.GraphMinor.GM12.Section72OtherParallel +public import LeanPool.GraphMinor.GM12.Section72ParallelInside +public import LeanPool.GraphMinor.GM12.Section72ParallelReplacement +public import LeanPool.GraphMinor.GM12.Section72PatchHalves +public import LeanPool.GraphMinor.GM12.Section72PreRadial +public import LeanPool.GraphMinor.GM12.Section72PushAway +public import LeanPool.GraphMinor.GM12.Section72PushCaps +public import LeanPool.GraphMinor.GM12.Section72PushSpoke +public import LeanPool.GraphMinor.GM12.Section72Radial +public import LeanPool.GraphMinor.GM12.Section72RadialDeletion +public import LeanPool.GraphMinor.GM12.Section72RadialExists +public import LeanPool.GraphMinor.GM12.Section72RadialHubs +public import LeanPool.GraphMinor.GM12.Section72Regions +public import LeanPool.GraphMinor.GM12.Section72RespectAway +public import LeanPool.GraphMinor.GM12.Section72Respectful +public import LeanPool.GraphMinor.GM12.Section72RetainedBoundary +public import LeanPool.GraphMinor.GM12.Section72Slope +public import LeanPool.GraphMinor.GM12.Section72Tangle +public import LeanPool.GraphMinor.GM12.Section72Trace +public import LeanPool.GraphMinor.GM12.Section72TwoCell +public import LeanPool.GraphMinor.GM12.Section73 +public import LeanPool.GraphMinor.GM12.Section73ArcCollapse +public import LeanPool.GraphMinor.GM12.Section73ArcCollapseCircle +public import LeanPool.GraphMinor.GM12.Section73BigonChord +public import LeanPool.GraphMinor.GM12.Section73CellularContraction +public import LeanPool.GraphMinor.GM12.Section73CircleArcFibres +public import LeanPool.GraphMinor.GM12.Section73CircleComplement +public import LeanPool.GraphMinor.GM12.Section73CircleFibreParameters +public import LeanPool.GraphMinor.GM12.Section73CircuitJoin +public import LeanPool.GraphMinor.GM12.Section73CircuitLift +public import LeanPool.GraphMinor.GM12.Section73CircuitPath +public import LeanPool.GraphMinor.GM12.Section73CircuitSplice +public import LeanPool.GraphMinor.GM12.Section73CircuitVisitCount +public import LeanPool.GraphMinor.GM12.Section73CircuitWalks +public import LeanPool.GraphMinor.GM12.Section73CollapseComplement +public import LeanPool.GraphMinor.GM12.Section73CollapseComposition +public import LeanPool.GraphMinor.GM12.Section73CollapseHomotopy +public import LeanPool.GraphMinor.GM12.Section73CollapseInterval +public import LeanPool.GraphMinor.GM12.Section73CollapseRectangle +public import LeanPool.GraphMinor.GM12.Section73CommonCircuitInside +public import LeanPool.GraphMinor.GM12.Section73ComparisonConstruction +public import LeanPool.GraphMinor.GM12.Section73ConnectorVisits +public import LeanPool.GraphMinor.GM12.Section73ContractDrawing +public import LeanPool.GraphMinor.GM12.Section73ContractedFaces +public import LeanPool.GraphMinor.GM12.Section73DeleteRadialEdge +public import LeanPool.GraphMinor.GM12.Section73DeletedRegions +public import LeanPool.GraphMinor.GM12.Section73DerivedContraction +public import LeanPool.GraphMinor.GM12.Section73DiscAttachment +public import LeanPool.GraphMinor.GM12.Section73DiscComparison +public import LeanPool.GraphMinor.GM12.Section73DiscInterpolation +public import LeanPool.GraphMinor.GM12.Section73DiscOrientation +public import LeanPool.GraphMinor.GM12.Section73DiscPreprocess +public import LeanPool.GraphMinor.GM12.Section73DiscSupportedHomotopy +public import LeanPool.GraphMinor.GM12.Section73DrawingImages +public import LeanPool.GraphMinor.GM12.Section73EdgeContraction +public import LeanPool.GraphMinor.GM12.Section73EdgeWalkLift +public import LeanPool.GraphMinor.GM12.Section73EmptyBigon +public import LeanPool.GraphMinor.GM12.Section73FaceRefinement +public import LeanPool.GraphMinor.GM12.Section73HubCircuitInside +public import LeanPool.GraphMinor.GM12.Section73HubInside +public import LeanPool.GraphMinor.GM12.Section73HubWalkImage +public import LeanPool.GraphMinor.GM12.Section73ImageArc +public import LeanPool.GraphMinor.GM12.Section73ImageIncidence +public import LeanPool.GraphMinor.GM12.Section73InnermostBigon +public import LeanPool.GraphMinor.GM12.Section73LiftedSpokeEdges +public import LeanPool.GraphMinor.GM12.Section73LoopParameter +public import LeanPool.GraphMinor.GM12.Section73MergedHub +public import LeanPool.GraphMinor.GM12.Section73MetricComparison +public import LeanPool.GraphMinor.GM12.Section73MetricVisits +public import LeanPool.GraphMinor.GM12.Section73MinimalCircle +public import LeanPool.GraphMinor.GM12.Section73NoParallel +public import LeanPool.GraphMinor.GM12.Section73OldSpoke +public import LeanPool.GraphMinor.GM12.Section73OrderOne +public import LeanPool.GraphMinor.GM12.Section73PeriodNull +public import LeanPool.GraphMinor.GM12.Section73PieceWalk +public import LeanPool.GraphMinor.GM12.Section73PointRestraintVisits +public import LeanPool.GraphMinor.GM12.Section73PreRadialContraction +public import LeanPool.GraphMinor.GM12.Section73ProperArcCircle +public import LeanPool.GraphMinor.GM12.Section73RadialCleanup +public import LeanPool.GraphMinor.GM12.Section73RadialContraction +public import LeanPool.GraphMinor.GM12.Section73RadialMaximal +public import LeanPool.GraphMinor.GM12.Section73RadialSpliceFibre +public import LeanPool.GraphMinor.GM12.Section73RadialStar +public import LeanPool.GraphMinor.GM12.Section73RadialStarDrawing +public import LeanPool.GraphMinor.GM12.Section73RealPath +public import LeanPool.GraphMinor.GM12.Section73ReplacementEdges +public import LeanPool.GraphMinor.GM12.Section73Representativity +public import LeanPool.GraphMinor.GM12.Section73Respectfulness +public import LeanPool.GraphMinor.GM12.Section73RestraintVisits +public import LeanPool.GraphMinor.GM12.Section73SelectedDiscDeletion +public import LeanPool.GraphMinor.GM12.Section73Separator +public import LeanPool.GraphMinor.GM12.Section73SharedAtoms +public import LeanPool.GraphMinor.GM12.Section73ShortWalkNull +public import LeanPool.GraphMinor.GM12.Section73SpliceFibre +public import LeanPool.GraphMinor.GM12.Section73SplicedCircuit +public import LeanPool.GraphMinor.GM12.Section73SplicedSeparation +public import LeanPool.GraphMinor.GM12.Section73SpokeImages +public import LeanPool.GraphMinor.GM12.Section73StarCollapse +public import LeanPool.GraphMinor.GM12.Section73StarDrawing +public import LeanPool.GraphMinor.GM12.Section73StripCollapse +public import LeanPool.GraphMinor.GM12.Section73SupportedCollapse +public import LeanPool.GraphMinor.GM12.Section73SupportedRadialContraction +public import LeanPool.GraphMinor.GM12.Section73Tangle +public import LeanPool.GraphMinor.GM12.Section73ThetaNull +public import LeanPool.GraphMinor.GM12.Section73ThinStripCollapse +public import LeanPool.GraphMinor.GM12.Section73TieBoundary +public import LeanPool.GraphMinor.GM12.Section73TraceHubCount +public import LeanPool.GraphMinor.GM12.Section73TracePath +public import LeanPool.GraphMinor.GM12.Section73TraceVisitPath +public import LeanPool.GraphMinor.GM12.Section73TwoArcLoop +public import LeanPool.GraphMinor.GM12.Section73UnchangedCircuit +public import LeanPool.GraphMinor.GM12.Section73VertexReduction +public import LeanPool.GraphMinor.GM12.Section73WalkInside +public import LeanPool.GraphMinor.GM12.Section73WalkLift +public import LeanPool.GraphMinor.GM12.Section73WalkLiftEdges +public import LeanPool.GraphMinor.GM12.Section73WalkPathLift +public import LeanPool.GraphMinor.GM12.Section73WalkPaths +public import LeanPool.GraphMinor.GM12.Section73WalkPointSets +public import LeanPool.GraphMinor.GM12.Section73WalkSubstitution +public import LeanPool.GraphMinor.GM12.Section73WalkSubstitutionEdges +public import LeanPool.GraphMinor.GM12.Section74 +public import LeanPool.GraphMinor.GM12.Section74Base +public import LeanPool.GraphMinor.GM12.Section74BaseCellularity +public import LeanPool.GraphMinor.GM12.Section74BoundaryParam +public import LeanPool.GraphMinor.GM12.Section74Bridge +public import LeanPool.GraphMinor.GM12.Section74Components +public import LeanPool.GraphMinor.GM12.Section74CornerEdges +public import LeanPool.GraphMinor.GM12.Section74CornerRegions +public import LeanPool.GraphMinor.GM12.Section74DeletedRegion +public import LeanPool.GraphMinor.GM12.Section74DiscRegion +public import LeanPool.GraphMinor.GM12.Section74EdgeDeletion +public import LeanPool.GraphMinor.GM12.Section74FiniteGluing +public import LeanPool.GraphMinor.GM12.Section74Induction +public import LeanPool.GraphMinor.GM12.Section74LeafAccess +public import LeanPool.GraphMinor.GM12.Section74LeafDiscGlue +public import LeanPool.GraphMinor.GM12.Section74LeafLens +public import LeanPool.GraphMinor.GM12.Section74LeafRegion +public import LeanPool.GraphMinor.GM12.Section74LeafSegment +public import LeanPool.GraphMinor.GM12.Section74LeafTwoCell +public import LeanPool.GraphMinor.GM12.Section74LensUniverses +public import LeanPool.GraphMinor.GM12.Section74NoParallel +public import LeanPool.GraphMinor.GM12.Section74RegionMerge +public import LeanPool.GraphMinor.GM12.Section74SlitDisc +public import LeanPool.GraphMinor.GM12.Section74SlitEnclosure +public import LeanPool.GraphMinor.GM12.Section74VertexWalk +public import LeanPool.GraphMinor.GM12.Section75 +public import LeanPool.GraphMinor.GM12.Section75Case2 +public import LeanPool.GraphMinor.GM12.Section75Case2Atoms +public import LeanPool.GraphMinor.GM12.Section75Case2Lift +public import LeanPool.GraphMinor.GM12.Section75Defs +public import LeanPool.GraphMinor.GM12.Section75OrderTwo +public import LeanPool.GraphMinor.GM12.Section75Proof +public import LeanPool.GraphMinor.GM12.Section75TwoCell +public import LeanPool.GraphMinor.GM12.Section76 +public import LeanPool.GraphMinor.GM12.Section77 +public import LeanPool.GraphMinor.GM12.Section78 +public import LeanPool.GraphMinor.GM12.Section79 +public import LeanPool.GraphMinor.GM12.Section7Proved +public import LeanPool.GraphMinor.GM12.SurfaceDual +public import LeanPool.GraphMinor.GM12.SurfaceDualContract +public import LeanPool.GraphMinor.GM12.SurfaceDualContractBase +public import LeanPool.GraphMinor.GM12.SurfaceDualContractDefs +public import LeanPool.GraphMinor.GM12.SurfaceDualContractFix +public import LeanPool.GraphMinor.GM12.SurfaceDualContractLines +public import LeanPool.GraphMinor.GM12.SurfaceDualContractStar +public import LeanPool.GraphMinor.GM12.SurfaceDualCount +public import LeanPool.GraphMinor.GM12.SurfaceDualCurves +public import LeanPool.GraphMinor.GM12.SurfaceDualCut +public import LeanPool.GraphMinor.GM12.SurfaceDualDraw +public import LeanPool.GraphMinor.GM12.SurfaceDualFace +public import LeanPool.GraphMinor.GM12.SurfaceDualFan +public import LeanPool.GraphMinor.GM12.SurfaceDualSplit +public import LeanPool.GraphMinor.GM12.SurfaceDualStar +public import LeanPool.GraphMinor.GM14.Adapted +public import LeanPool.GraphMinor.GM14.AnnulusRural +public import LeanPool.GraphMinor.GM14.Bridge +public import LeanPool.GraphMinor.GM14.BridgeFacts +public import LeanPool.GraphMinor.GM14.Cited +public import LeanPool.GraphMinor.GM14.ClaimOneReduction +public import LeanPool.GraphMinor.GM14.CylinderCut +public import LeanPool.GraphMinor.GM14.CylinderParts +public import LeanPool.GraphMinor.GM14.Defs +public import LeanPool.GraphMinor.GM14.DiscArrangement +public import LeanPool.GraphMinor.GM14.DiscBoundaryHomeomorphism +public import LeanPool.GraphMinor.GM14.DiscSlope +public import LeanPool.GraphMinor.GM14.DiscTangleSep +public import LeanPool.GraphMinor.GM14.FewCircuits +public import LeanPool.GraphMinor.GM14.FewCircuitsDrawing +public import LeanPool.GraphMinor.GM14.ForestClaim +public import LeanPool.GraphMinor.GM14.Form84 +public import LeanPool.GraphMinor.GM14.GraphTransport +public import LeanPool.GraphMinor.GM14.NaturalOrderArc +public import LeanPool.GraphMinor.GM14.PieceDrawing +public import LeanPool.GraphMinor.GM14.PieceFacts +public import LeanPool.GraphMinor.GM14.RadialAtoms +public import LeanPool.GraphMinor.GM14.RigidAccess +public import LeanPool.GraphMinor.GM14.RigidClaims +public import LeanPool.GraphMinor.GM14.RigidDisc +public import LeanPool.GraphMinor.GM14.RigidExtension +public import LeanPool.GraphMinor.GM14.RigidFinger +public import LeanPool.GraphMinor.GM14.RigidGood +public import LeanPool.GraphMinor.GM14.RigidMap +public import LeanPool.GraphMinor.GM14.RigidNoose +public import LeanPool.GraphMinor.GM14.RigidPoints +public import LeanPool.GraphMinor.GM14.RigidSegregation +public import LeanPool.GraphMinor.GM14.RigidSphere +public import LeanPool.GraphMinor.GM14.RigidThread +public import LeanPool.GraphMinor.GM14.RigidWheel +public import LeanPool.GraphMinor.GM14.Section10 +public import LeanPool.GraphMinor.GM14.Section10Translation1 +public import LeanPool.GraphMinor.GM14.Section10Translation2 +public import LeanPool.GraphMinor.GM14.Section10Translation3 +public import LeanPool.GraphMinor.GM14.Section10Translation4 +public import LeanPool.GraphMinor.GM14.Section3 +public import LeanPool.GraphMinor.GM14.Section3Proved +public import LeanPool.GraphMinor.GM14.Section3b +public import LeanPool.GraphMinor.GM14.Section5 +public import LeanPool.GraphMinor.GM14.Section6 +public import LeanPool.GraphMinor.GM14.Section6a +public import LeanPool.GraphMinor.GM14.Section6b +public import LeanPool.GraphMinor.GM14.Section6c +public import LeanPool.GraphMinor.GM14.Section7 +public import LeanPool.GraphMinor.GM14.Section7a +public import LeanPool.GraphMinor.GM14.Section7b +public import LeanPool.GraphMinor.GM14.Section8 +public import LeanPool.GraphMinor.GM14.Section83Proof +public import LeanPool.GraphMinor.GM14.Section8Core +public import LeanPool.GraphMinor.GM14.Section8a +public import LeanPool.GraphMinor.GM14.Section9 +public import LeanPool.GraphMinor.GM14.Section9Reroute +public import LeanPool.GraphMinor.GM14.Section9a +public import LeanPool.GraphMinor.GM14.Section9b +public import LeanPool.GraphMinor.GM14.SegregationDrawing +public import LeanPool.GraphMinor.GM14.SegregationReplace +public import LeanPool.GraphMinor.GM14.SpanRestriction +public import LeanPool.GraphMinor.GM14.SubDataSep +public import LeanPool.GraphMinor.GM14.Suppress +public import LeanPool.GraphMinor.GM14.Whitney +public import LeanPool.GraphMinor.GM14.WhitneyFaces +public import LeanPool.GraphMinor.GM14.WhitneyGraph +public import LeanPool.GraphMinor.GM14.WhitneyPeripheral +public import LeanPool.GraphMinor.GM15.ChordMove +public import LeanPool.GraphMinor.GM15.Cited +public import LeanPool.GraphMinor.GM15.ControllingTangle +public import LeanPool.GraphMinor.GM15.Defs +public import LeanPool.GraphMinor.GM15.EyeInductionParameters +public import LeanPool.GraphMinor.GM15.LineMove +public import LeanPool.GraphMinor.GM15.Section2 +public import LeanPool.GraphMinor.GM15.Section3 +public import LeanPool.GraphMinor.GM15.Section3Crosscap +public import LeanPool.GraphMinor.GM15.Section3Disc +public import LeanPool.GraphMinor.GM15.Section3Given +public import LeanPool.GraphMinor.GM15.Section3Handle +public import LeanPool.GraphMinor.GM15.Section3Parallel +public import LeanPool.GraphMinor.GM15.Section3SpanGlue +public import LeanPool.GraphMinor.GM15.Section4 +public import LeanPool.GraphMinor.GM15.Section5 +public import LeanPool.GraphMinor.GM15.Section6 +public import LeanPool.GraphMinor.GM15.Section7 +public import LeanPool.GraphMinor.GM15.Section8 +public import LeanPool.GraphMinor.GM16.AnnularComposition +public import LeanPool.GraphMinor.GM16.AnnularPathTrim +public import LeanPool.GraphMinor.GM16.AnnulusBreadth +public import LeanPool.GraphMinor.GM16.AnnulusConnected +public import LeanPool.GraphMinor.GM16.AnnulusCrossing +public import LeanPool.GraphMinor.GM16.AnnulusIncidentEdges +public import LeanPool.GraphMinor.GM16.AnnulusPathIntersection +public import LeanPool.GraphMinor.GM16.AnnulusPresentation +public import LeanPool.GraphMinor.GM16.Battlefields +public import LeanPool.GraphMinor.GM16.BoundaryNaturalOrder +public import LeanPool.GraphMinor.GM16.BranchArmsInPathSystem +public import LeanPool.GraphMinor.GM16.CircleListing +public import LeanPool.GraphMinor.GM16.Cited +public import LeanPool.GraphMinor.GM16.ClearedPathVertices +public import LeanPool.GraphMinor.GM16.ConnectedAttachment +public import LeanPool.GraphMinor.GM16.ConnectedBoundary +public import LeanPool.GraphMinor.GM16.ConnectedBranchArms +public import LeanPool.GraphMinor.GM16.ConnectedPathStar +public import LeanPool.GraphMinor.GM16.ConnectedSeparationSide +public import LeanPool.GraphMinor.GM16.ConnectedTripod +public import LeanPool.GraphMinor.GM16.ConnectedTwoBoundaries +public import LeanPool.GraphMinor.GM16.ControlFromInducedTangle +public import LeanPool.GraphMinor.GM16.ConvexFaceLines +public import LeanPool.GraphMinor.GM16.CyclicOrderTransport +public import LeanPool.GraphMinor.GM16.Defs +public import LeanPool.GraphMinor.GM16.DiscChartExtension +public import LeanPool.GraphMinor.GM16.DiscCoordinateBoundary +public import LeanPool.GraphMinor.GM16.DiscPlaneBoundary +public import LeanPool.GraphMinor.GM16.DiscPlaneCoordinates +public import LeanPool.GraphMinor.GM16.DrawingAtoms +public import LeanPool.GraphMinor.GM16.DrawingBoundaryOrders +public import LeanPool.GraphMinor.GM16.DrawingConnected +public import LeanPool.GraphMinor.GM16.DrawingFamilyCompatibility +public import LeanPool.GraphMinor.GM16.DrawingGraphPaths +public import LeanPool.GraphMinor.GM16.DrawingPointConnectivity +public import LeanPool.GraphMinor.GM16.DrawingSkeletonPaths +public import LeanPool.GraphMinor.GM16.DrawingTransportIso +public import LeanPool.GraphMinor.GM16.DrawingTransportPoints +public import LeanPool.GraphMinor.GM16.EmbeddedBrickOuterLines +public import LeanPool.GraphMinor.GM16.EmbeddedLineGraphDrawing +public import LeanPool.GraphMinor.GM16.EmptyDiscRegion +public import LeanPool.GraphMinor.GM16.EnvelopeAfterClearing +public import LeanPool.GraphMinor.GM16.EnvelopeAnimal +public import LeanPool.GraphMinor.GM16.EnvelopeExitPaths +public import LeanPool.GraphMinor.GM16.EnvelopeHair +public import LeanPool.GraphMinor.GM16.EnvelopeHairEnds +public import LeanPool.GraphMinor.GM16.EnvelopeHairMetric +public import LeanPool.GraphMinor.GM16.EnvelopeHorns +public import LeanPool.GraphMinor.GM16.EquivUnion +public import LeanPool.GraphMinor.GM16.ErdosSzekeres +public import LeanPool.GraphMinor.GM16.FaceSubdisc +public import LeanPool.GraphMinor.GM16.FiniteCircleCycle +public import LeanPool.GraphMinor.GM16.FiniteDrawingUnion +public import LeanPool.GraphMinor.GM16.FiniteLineDrawing +public import LeanPool.GraphMinor.GM16.FiniteLineGraphDrawing +public import LeanPool.GraphMinor.GM16.ForestMarked +public import LeanPool.GraphMinor.GM16.ForestPacking +public import LeanPool.GraphMinor.GM16.GraphDrawingControlledTangle +public import LeanPool.GraphMinor.GM16.GraphDrawingForwardMaps +public import LeanPool.GraphMinor.GM16.GraphDrawingSpanEmbedding +public import LeanPool.GraphMinor.GM16.GraphIsoEdgeEnds +public import LeanPool.GraphMinor.GM16.GraphIsoImage +public import LeanPool.GraphMinor.GM16.GraphIsoUnion +public import LeanPool.GraphMinor.GM16.GraphPathSystemUnion +public import LeanPool.GraphMinor.GM16.HairBetweenExits +public import LeanPool.GraphMinor.GM16.HornCongr +public import LeanPool.GraphMinor.GM16.HypergraphImage +public import LeanPool.GraphMinor.GM16.HypergraphImageComposition +public import LeanPool.GraphMinor.GM16.HypergraphImageReflection +public import LeanPool.GraphMinor.GM16.HypergraphImageTangle +public import LeanPool.GraphMinor.GM16.HypergraphPreimage +public import LeanPool.GraphMinor.GM16.HypergraphSupportedTangle +public import LeanPool.GraphMinor.GM16.InducedTangleEdgePatterns +public import LeanPool.GraphMinor.GM16.InductionsProved +public import LeanPool.GraphMinor.GM16.InnerOpenDisc +public import LeanPool.GraphMinor.GM16.IntervalTiling +public import LeanPool.GraphMinor.GM16.LatticeLineIntersections +public import LeanPool.GraphMinor.GM16.LatticeLines +public import LeanPool.GraphMinor.GM16.LeftBrickArcContainment +public import LeanPool.GraphMinor.GM16.LeftRectangleArc +public import LeanPool.GraphMinor.GM16.LineBoundarySide +public import LeanPool.GraphMinor.GM16.LineClosedExtension +public import LeanPool.GraphMinor.GM16.LineConnectedSubset +public import LeanPool.GraphMinor.GM16.LineDial +public import LeanPool.GraphMinor.GM16.LineDrawingPath +public import LeanPool.GraphMinor.GM16.LineImageEmbedding +public import LeanPool.GraphMinor.GM16.LineInFace +public import LeanPool.GraphMinor.GM16.LocalCoordinateBoundary +public import LeanPool.GraphMinor.GM16.MainProof +public import LeanPool.GraphMinor.GM16.MarkedPathSegments +public import LeanPool.GraphMinor.GM16.Metric +public import LeanPool.GraphMinor.GM16.MetricBounds +public import LeanPool.GraphMinor.GM16.MetricPoints +public import LeanPool.GraphMinor.GM16.MinorModelRestriction +public import LeanPool.GraphMinor.GM16.ModelBranchArms +public import LeanPool.GraphMinor.GM16.ModelBranchCentres +public import LeanPool.GraphMinor.GM16.ModelContractionMaps +public import LeanPool.GraphMinor.GM16.ModelFromBranchArms +public import LeanPool.GraphMinor.GM16.ModelInducedTangle +public import LeanPool.GraphMinor.GM16.NestedDiscContainment +public import LeanPool.GraphMinor.GM16.PathBoundaryIntersection +public import LeanPool.GraphMinor.GM16.PathCrossesZone +public import LeanPool.GraphMinor.GM16.PathDrawingOnLine +public import LeanPool.GraphMinor.GM16.PathEndSubpath +public import LeanPool.GraphMinor.GM16.PathIsoCard +public import LeanPool.GraphMinor.GM16.PathIsoWalks +public import LeanPool.GraphMinor.GM16.PathWalkCoordinates +public import LeanPool.GraphMinor.GM16.PathWalkEquivalences +public import LeanPool.GraphMinor.GM16.ProperArrangement +public import LeanPool.GraphMinor.GM16.ProperArrangementDefs +public import LeanPool.GraphMinor.GM16.ProperArrangementFacts +public import LeanPool.GraphMinor.GM16.ProperBridgeIntersections +public import LeanPool.GraphMinor.GM16.ProperDiscCoordinates +public import LeanPool.GraphMinor.GM16.ProperDiscExtension +public import LeanPool.GraphMinor.GM16.ProperDiscIntersection +public import LeanPool.GraphMinor.GM16.ProperDiscTransport +public import LeanPool.GraphMinor.GM16.ProperEyeInduction +public import LeanPool.GraphMinor.GM16.ProperEyeInductionStep +public import LeanPool.GraphMinor.GM16.ProperLocalAssembly +public import LeanPool.GraphMinor.GM16.RectangleStack +public import LeanPool.GraphMinor.GM16.RectangleStackDisc +public import LeanPool.GraphMinor.GM16.RectangleStackStep +public import LeanPool.GraphMinor.GM16.RectangularDisc +public import LeanPool.GraphMinor.GM16.RectangularGridDrawing +public import LeanPool.GraphMinor.GM16.RectangularGridLineIntersections +public import LeanPool.GraphMinor.GM16.RectangularGridLinePoints +public import LeanPool.GraphMinor.GM16.RectangularGridLines +public import LeanPool.GraphMinor.GM16.RectangularLines +public import LeanPool.GraphMinor.GM16.RigidDiscFaces +public import LeanPool.GraphMinor.GM16.RuralLinkage +public import LeanPool.GraphMinor.GM16.Section2 +public import LeanPool.GraphMinor.GM16.Section3 +public import LeanPool.GraphMinor.GM16.Section4 +public import LeanPool.GraphMinor.GM16.Section4Claim1 +public import LeanPool.GraphMinor.GM16.Section4Control +public import LeanPool.GraphMinor.GM16.Section4GridMinor +public import LeanPool.GraphMinor.GM16.Section4Proof +public import LeanPool.GraphMinor.GM16.Section4Wall +public import LeanPool.GraphMinor.GM16.Section4WallContraction +public import LeanPool.GraphMinor.GM16.Section4WallDrawing +public import LeanPool.GraphMinor.GM16.Section4WallModel +public import LeanPool.GraphMinor.GM16.Section4WallRowImages +public import LeanPool.GraphMinor.GM16.Section4WallRows +public import LeanPool.GraphMinor.GM16.Section4WallTangle +public import LeanPool.GraphMinor.GM16.Section5 +public import LeanPool.GraphMinor.GM16.Section5Connections +public import LeanPool.GraphMinor.GM16.Section5Degree +public import LeanPool.GraphMinor.GM16.Section5Five +public import LeanPool.GraphMinor.GM16.Section5Forest +public import LeanPool.GraphMinor.GM16.Section5Four +public import LeanPool.GraphMinor.GM16.Section5HornSelection +public import LeanPool.GraphMinor.GM16.Section5Linkage +public import LeanPool.GraphMinor.GM16.Section5Minimal +public import LeanPool.GraphMinor.GM16.Section5Packing +public import LeanPool.GraphMinor.GM16.Section5Paths +public import LeanPool.GraphMinor.GM16.Section5Proof +public import LeanPool.GraphMinor.GM16.Section5Reroute +public import LeanPool.GraphMinor.GM16.Section6 +public import LeanPool.GraphMinor.GM16.Section6ActiveBound +public import LeanPool.GraphMinor.GM16.Section6Animals +public import LeanPool.GraphMinor.GM16.Section6ClearedHairGraph +public import LeanPool.GraphMinor.GM16.Section6Clearing +public import LeanPool.GraphMinor.GM16.Section6CliqueLinkage +public import LeanPool.GraphMinor.GM16.Section6CliquePaths +public import LeanPool.GraphMinor.GM16.Section6ClusterProof +public import LeanPool.GraphMinor.GM16.Section6Clustering +public import LeanPool.GraphMinor.GM16.Section6Components +public import LeanPool.GraphMinor.GM16.Section6HairFamily +public import LeanPool.GraphMinor.GM16.Section6HairGraphs +public import LeanPool.GraphMinor.GM16.Section6HairUnion +public import LeanPool.GraphMinor.GM16.Section6Linkages +public import LeanPool.GraphMinor.GM16.Section6Proof +public import LeanPool.GraphMinor.GM16.Section6ZoneWalks +public import LeanPool.GraphMinor.GM16.Section7 +public import LeanPool.GraphMinor.GM16.Section7ProperProof +public import LeanPool.GraphMinor.GM16.Section8 +public import LeanPool.GraphMinor.GM16.Section8Animal +public import LeanPool.GraphMinor.GM16.Section8Hairs +public import LeanPool.GraphMinor.GM16.Section8HornSelection +public import LeanPool.GraphMinor.GM16.Section8Main +public import LeanPool.GraphMinor.GM16.Section8Paths +public import LeanPool.GraphMinor.GM16.Section8Proof +public import LeanPool.GraphMinor.GM16.Section8Rearrangement +public import LeanPool.GraphMinor.GM16.Section8Truncation +public import LeanPool.GraphMinor.GM16.Section9AnnularAttachment +public import LeanPool.GraphMinor.GM16.Section9AnnularSeparation +public import LeanPool.GraphMinor.GM16.Section9Annuli +public import LeanPool.GraphMinor.GM16.Section9Attachments +public import LeanPool.GraphMinor.GM16.Section9BadPath +public import LeanPool.GraphMinor.GM16.Section9BattlefieldFree +public import LeanPool.GraphMinor.GM16.Section9BattlefieldLinked +public import LeanPool.GraphMinor.GM16.Section9BattlefieldNeighborhood +public import LeanPool.GraphMinor.GM16.Section9BattlefieldNest +public import LeanPool.GraphMinor.GM16.Section9BoundaryVertices +public import LeanPool.GraphMinor.GM16.Section9CircleSelection +public import LeanPool.GraphMinor.GM16.Section9Circles +public import LeanPool.GraphMinor.GM16.Section9Claim10 +public import LeanPool.GraphMinor.GM16.Section9Claim11 +public import LeanPool.GraphMinor.GM16.Section9Claim4 +public import LeanPool.GraphMinor.GM16.Section9Claim9 +public import LeanPool.GraphMinor.GM16.Section9ClearFamily +public import LeanPool.GraphMinor.GM16.Section9Compressions +public import LeanPool.GraphMinor.GM16.Section9ConsecutiveVertices +public import LeanPool.GraphMinor.GM16.Section9Dials +public import LeanPool.GraphMinor.GM16.Section9FinalMetric +public import LeanPool.GraphMinor.GM16.Section9FreeClearing +public import LeanPool.GraphMinor.GM16.Section9FreeFamily +public import LeanPool.GraphMinor.GM16.Section9GlobalCut +public import LeanPool.GraphMinor.GM16.Section9HPathCuts +public import LeanPool.GraphMinor.GM16.Section9HandleLinkage +public import LeanPool.GraphMinor.GM16.Section9InitialVertices +public import LeanPool.GraphMinor.GM16.Section9InnerCapture +public import LeanPool.GraphMinor.GM16.Section9LastVertexBounds +public import LeanPool.GraphMinor.GM16.Section9Menger +public import LeanPool.GraphMinor.GM16.Section9NestedZones +public import LeanPool.GraphMinor.GM16.Section9NoAnnularSeparation +public import LeanPool.GraphMinor.GM16.Section9PairCount +public import LeanPool.GraphMinor.GM16.Section9Parameters +public import LeanPool.GraphMinor.GM16.Section9Proof +public import LeanPool.GraphMinor.GM16.Section9RadialBoundary +public import LeanPool.GraphMinor.GM16.Section9RadialObstruction +public import LeanPool.GraphMinor.GM16.Section9RadialRegions +public import LeanPool.GraphMinor.GM16.Section9Regions +public import LeanPool.GraphMinor.GM16.Section9Rigidity +public import LeanPool.GraphMinor.GM16.Section9SeparatedBoundaries +public import LeanPool.GraphMinor.GM16.Section9SeparatorPaths +public import LeanPool.GraphMinor.GM16.Section9ShortPaths +public import LeanPool.GraphMinor.GM16.Section9SpanClearing +public import LeanPool.GraphMinor.GM16.Section9Uncross +public import LeanPool.GraphMinor.GM16.Section9ZoneCuts +public import LeanPool.GraphMinor.GM16.Section9ZonePreservation +public import LeanPool.GraphMinor.GM16.Section9ZoneSeparation +public import LeanPool.GraphMinor.GM16.Section9Zones +public import LeanPool.GraphMinor.GM16.SeparatedHairsCut +public import LeanPool.GraphMinor.GM16.SimpleDrawingVertices +public import LeanPool.GraphMinor.GM16.SpanAttachment +public import LeanPool.GraphMinor.GM16.SpanCongr +public import LeanPool.GraphMinor.GM16.SpanMarkedSegments +public import LeanPool.GraphMinor.GM16.SpanPaths +public import LeanPool.GraphMinor.GM16.SpanSubdrawing +public import LeanPool.GraphMinor.GM16.SpanSurface +public import LeanPool.GraphMinor.GM16.SpanTransport +public import LeanPool.GraphMinor.GM16.SpanVertexPullback +public import LeanPool.GraphMinor.GM16.SphereComplementDisc +public import LeanPool.GraphMinor.GM16.SpherePlaneEmbedding +public import LeanPool.GraphMinor.GM16.SphereRespectful +public import LeanPool.GraphMinor.GM16.SubcubicArmIntersections +public import LeanPool.GraphMinor.GM16.SubcubicEdgePaths +public import LeanPool.GraphMinor.GM16.SubcubicSubdivision +public import LeanPool.GraphMinor.GM16.SubdivisionCentreCover +public import LeanPool.GraphMinor.GM16.SubdivisionDrawing +public import LeanPool.GraphMinor.GM16.SubdivisionPathDisjoint +public import LeanPool.GraphMinor.GM16.SubdivisionPathDrawings +public import LeanPool.GraphMinor.GM16.SublineBetween +public import LeanPool.GraphMinor.GM16.Theorem35Bridge +public import LeanPool.GraphMinor.GM16.Tower +public import LeanPool.GraphMinor.GM16.TwoBranchArmsPath +public import LeanPool.GraphMinor.GM16.TwoFaceDial +public import LeanPool.GraphMinor.GM16.VortexComparison +public import LeanPool.GraphMinor.GM16.WallBrickBoundary +public import LeanPool.GraphMinor.GM16.WallBrickCover +public import LeanPool.GraphMinor.GM16.WallBrickInterior +public import LeanPool.GraphMinor.GM16.WallBrickOuterLines +public import LeanPool.GraphMinor.GM16.WallBrickRegion +public import LeanPool.GraphMinor.GM16.WallDrawingEnclosed +public import LeanPool.GraphMinor.GM16.WallEdgeInDrawing +public import LeanPool.GraphMinor.GM16.WallEnclosedBoundary +public import LeanPool.GraphMinor.GM16.WallEnclosedCoordinates +public import LeanPool.GraphMinor.GM16.WallEnclosedDisc +public import LeanPool.GraphMinor.GM16.WallFaceDiscs +public import LeanPool.GraphMinor.GM16.WallHorizontalBoundary +public import LeanPool.GraphMinor.GM16.WallLeftBrickLines +public import LeanPool.GraphMinor.GM16.WallLeftEvenArc +public import LeanPool.GraphMinor.GM16.WallLeftOddArc +public import LeanPool.GraphMinor.GM16.WallMiddleBrickLines +public import LeanPool.GraphMinor.GM16.WallOuterRegion +public import LeanPool.GraphMinor.GM16.WallReflection +public import LeanPool.GraphMinor.GM16.WallRegions +public import LeanPool.GraphMinor.GM16.WallRigidDrawing +public import LeanPool.GraphMinor.GM16.WallRigidity +public import LeanPool.GraphMinor.GM16.WallRowBoundary +public import LeanPool.GraphMinor.GM16.WallRowsEnclosed +public import LeanPool.GraphMinor.GM16.WallSubdivisionRigidity +public import LeanPool.GraphMinor.GM16.WallSupportRigidity +public import LeanPool.GraphMinor.GM16.ZoneBoundaryLinkage +public import LeanPool.GraphMinor.GM17.AngleOrder +public import LeanPool.GraphMinor.GM17.ArcDisc +public import LeanPool.GraphMinor.GM17.Basic +public import LeanPool.GraphMinor.GM17.Bigon +public import LeanPool.GraphMinor.GM17.BorderArc +public import LeanPool.GraphMinor.GM17.BorderCells +public import LeanPool.GraphMinor.GM17.BorderNode +public import LeanPool.GraphMinor.GM17.Bridge +public import LeanPool.GraphMinor.GM17.CapSide +public import LeanPool.GraphMinor.GM17.CellLinkage +public import LeanPool.GraphMinor.GM17.CellNodes +public import LeanPool.GraphMinor.GM17.CellPartitionArc +public import LeanPool.GraphMinor.GM17.CellPartitionChord +public import LeanPool.GraphMinor.GM17.CellPartitionCount +public import LeanPool.GraphMinor.GM17.CellPartitionEnd +public import LeanPool.GraphMinor.GM17.CellPartitionFace +public import LeanPool.GraphMinor.GM17.CellPartitionMain +public import LeanPool.GraphMinor.GM17.CellPartitionSystem +public import LeanPool.GraphMinor.GM17.CliqueChord +public import LeanPool.GraphMinor.GM17.CliqueDisc +public import LeanPool.GraphMinor.GM17.CliquePaint +public import LeanPool.GraphMinor.GM17.CliqueSphere +public import LeanPool.GraphMinor.GM17.CuffOrder +public import LeanPool.GraphMinor.GM17.CutArcPaint +public import LeanPool.GraphMinor.GM17.CutCell +public import LeanPool.GraphMinor.GM17.CutPaint +public import LeanPool.GraphMinor.GM17.CutSide +public import LeanPool.GraphMinor.GM17.CycleOrder +public import LeanPool.GraphMinor.GM17.Defs +public import LeanPool.GraphMinor.GM17.Defs2 +public import LeanPool.GraphMinor.GM17.FreeLift +public import LeanPool.GraphMinor.GM17.IndentDisc +public import LeanPool.GraphMinor.GM17.IndentMain +public import LeanPool.GraphMinor.GM17.IndentPaint +public import LeanPool.GraphMinor.GM17.IndentPush +public import LeanPool.GraphMinor.GM17.IndentRegion +public import LeanPool.GraphMinor.GM17.MarkCross +public import LeanPool.GraphMinor.GM17.NodeRing +public import LeanPool.GraphMinor.GM17.PaintDiscs +public import LeanPool.GraphMinor.GM17.PaintTransfer +public import LeanPool.GraphMinor.GM17.PasteCuff +public import LeanPool.GraphMinor.GM17.PushNode +public import LeanPool.GraphMinor.GM17.ReEdge +public import LeanPool.GraphMinor.GM17.RegionBoundary +public import LeanPool.GraphMinor.GM17.RegionCycle +public import LeanPool.GraphMinor.GM17.RegionDegree +public import LeanPool.GraphMinor.GM17.RegionDisc +public import LeanPool.GraphMinor.GM17.RegionFrontier +public import LeanPool.GraphMinor.GM17.RegionTools +public import LeanPool.GraphMinor.GM17.ReplaceDisc +public import LeanPool.GraphMinor.GM17.Section10 +public import LeanPool.GraphMinor.GM17.Section10Proved +public import LeanPool.GraphMinor.GM17.Section11 +public import LeanPool.GraphMinor.GM17.Section11Proved +public import LeanPool.GraphMinor.GM17.Section12 +public import LeanPool.GraphMinor.GM17.Section12b +public import LeanPool.GraphMinor.GM17.Section12c +public import LeanPool.GraphMinor.GM17.Section12d +public import LeanPool.GraphMinor.GM17.Section13Proved +public import LeanPool.GraphMinor.GM17.Section13a +public import LeanPool.GraphMinor.GM17.Section13b +public import LeanPool.GraphMinor.GM17.Section13c +public import LeanPool.GraphMinor.GM17.Section13d +public import LeanPool.GraphMinor.GM17.Section14 +public import LeanPool.GraphMinor.GM17.Section14b +public import LeanPool.GraphMinor.GM17.Section2 +public import LeanPool.GraphMinor.GM17.Section4 +public import LeanPool.GraphMinor.GM17.Section5 +public import LeanPool.GraphMinor.GM17.Section5Proved +public import LeanPool.GraphMinor.GM17.Section6 +public import LeanPool.GraphMinor.GM17.Section6Proved +public import LeanPool.GraphMinor.GM17.Section7 +public import LeanPool.GraphMinor.GM17.Section7Proved +public import LeanPool.GraphMinor.GM17.Section8 +public import LeanPool.GraphMinor.GM17.Section8Proved +public import LeanPool.GraphMinor.GM17.Section9 +public import LeanPool.GraphMinor.GM17.Section9Proved +public import LeanPool.GraphMinor.GM17.Section9b +public import LeanPool.GraphMinor.GM17.Section9bProved +public import LeanPool.GraphMinor.GM17.Sector +public import LeanPool.GraphMinor.GM17.Sides +public import LeanPool.GraphMinor.GM17.Strip +public import LeanPool.GraphMinor.GM17.Subdivide +public import LeanPool.GraphMinor.GM17.SubdivideDraw +public import LeanPool.GraphMinor.GM17.Theta +public import LeanPool.GraphMinor.GM17.ThreeNodeReplace +public import LeanPool.GraphMinor.GM17.VortexAxioms +public import LeanPool.GraphMinor.GM17.VortexCells +public import LeanPool.GraphMinor.GM17.VortexCut +public import LeanPool.GraphMinor.GM17.VortexPaint +public import LeanPool.GraphMinor.GM17.VortexPortrayal +public import LeanPool.GraphMinor.GM18.Cited +public import LeanPool.GraphMinor.GM18.Defs +public import LeanPool.GraphMinor.GM18.Proved +public import LeanPool.GraphMinor.GM18.Section2 +public import LeanPool.GraphMinor.GM18.Section3 +public import LeanPool.GraphMinor.GM18.Section4 +public import LeanPool.GraphMinor.GM18.Section5 +public import LeanPool.GraphMinor.GM18.Section5Part1 +public import LeanPool.GraphMinor.GM18.Section5Part2 +public import LeanPool.GraphMinor.GM18.Section6 +public import LeanPool.GraphMinor.GM18.Section6Part1 +public import LeanPool.GraphMinor.GM18.Section6Part2 +public import LeanPool.GraphMinor.GM18.Section6Stars +public import LeanPool.GraphMinor.GM18.Section7 +public import LeanPool.GraphMinor.GM19.ArcDirection +public import LeanPool.GraphMinor.GM19.BiteArc +public import LeanPool.GraphMinor.GM19.CapExists +public import LeanPool.GraphMinor.GM19.CapModel +public import LeanPool.GraphMinor.GM19.CapOrient +public import LeanPool.GraphMinor.GM19.CapUnique +public import LeanPool.GraphMinor.GM19.CellFlat +public import LeanPool.GraphMinor.GM19.CircleLift +public import LeanPool.GraphMinor.GM19.CircleOrder +public import LeanPool.GraphMinor.GM19.Cited +public import LeanPool.GraphMinor.GM19.Conditional +public import LeanPool.GraphMinor.GM19.Conditional2 +public import LeanPool.GraphMinor.GM19.Conditional3 +public import LeanPool.GraphMinor.GM19.CuffAngle +public import LeanPool.GraphMinor.GM19.CuffOrder +public import LeanPool.GraphMinor.GM19.CuffPieces +public import LeanPool.GraphMinor.GM19.CutDrawing +public import LeanPool.GraphMinor.GM19.CutDrawing2 +public import LeanPool.GraphMinor.GM19.CutDrawing3 +public import LeanPool.GraphMinor.GM19.CutFragment +public import LeanPool.GraphMinor.GM19.CutMap +public import LeanPool.GraphMinor.GM19.CutTwo +public import LeanPool.GraphMinor.GM19.Defs +public import LeanPool.GraphMinor.GM19.Defs2 +public import LeanPool.GraphMinor.GM19.Defs3 +public import LeanPool.GraphMinor.GM19.DiscRealize +public import LeanPool.GraphMinor.GM19.DiscSide +public import LeanPool.GraphMinor.GM19.DiscSides +public import LeanPool.GraphMinor.GM19.DiscTouch +public import LeanPool.GraphMinor.GM19.Feasibility +public import LeanPool.GraphMinor.GM19.FeatureAccess +public import LeanPool.GraphMinor.GM19.FeatureCode +public import LeanPool.GraphMinor.GM19.FeatureCount +public import LeanPool.GraphMinor.GM19.FeatureCover +public import LeanPool.GraphMinor.GM19.FeatureCut +public import LeanPool.GraphMinor.GM19.FeatureDissect +public import LeanPool.GraphMinor.GM19.FeatureForm +public import LeanPool.GraphMinor.GM19.FeatureGenus +public import LeanPool.GraphMinor.GM19.FeatureLift +public import LeanPool.GraphMinor.GM19.FeatureLines +public import LeanPool.GraphMinor.GM19.FeatureOrient +public import LeanPool.GraphMinor.GM19.FeatureTile +public import LeanPool.GraphMinor.GM19.Flower +public import LeanPool.GraphMinor.GM19.FragmentBridge +public import LeanPool.GraphMinor.GM19.FragmentCapping +public import LeanPool.GraphMinor.GM19.FragmentChord +public import LeanPool.GraphMinor.GM19.FragmentCollapse +public import LeanPool.GraphMinor.GM19.FragmentCut +public import LeanPool.GraphMinor.GM19.FragmentDirection +public import LeanPool.GraphMinor.GM19.FragmentExtend +public import LeanPool.GraphMinor.GM19.FragmentForm +public import LeanPool.GraphMinor.GM19.FragmentOrient +public import LeanPool.GraphMinor.GM19.FragmentOuter +public import LeanPool.GraphMinor.GM19.FragmentRegion +public import LeanPool.GraphMinor.GM19.FragmentShape +public import LeanPool.GraphMinor.GM19.FragmentSides +public import LeanPool.GraphMinor.GM19.FragmentSimpler +public import LeanPool.GraphMinor.GM19.FrameExists +public import LeanPool.GraphMinor.GM19.FrameMove +public import LeanPool.GraphMinor.GM19.FreeData +public import LeanPool.GraphMinor.GM19.FreeFlaw +public import LeanPool.GraphMinor.GM19.FreeFrame +public import LeanPool.GraphMinor.GM19.FreeShape +public import LeanPool.GraphMinor.GM19.FreeTopology +public import LeanPool.GraphMinor.GM19.Lens +public import LeanPool.GraphMinor.GM19.LineCut +public import LeanPool.GraphMinor.GM19.Main +public import LeanPool.GraphMinor.GM19.MarkedMatch +public import LeanPool.GraphMinor.GM19.OrientOfHomeos +public import LeanPool.GraphMinor.GM19.PadData +public import LeanPool.GraphMinor.GM19.PadFlower +public import LeanPool.GraphMinor.GM19.PaintingPatchwork +public import LeanPool.GraphMinor.GM19.Perimeter +public import LeanPool.GraphMinor.GM19.PlaneOrientation +public import LeanPool.GraphMinor.GM19.Poles +public import LeanPool.GraphMinor.GM19.PullLift +public import LeanPool.GraphMinor.GM19.PullPainting +public import LeanPool.GraphMinor.GM19.PushSide +public import LeanPool.GraphMinor.GM19.RadialExists +public import LeanPool.GraphMinor.GM19.Relabel +public import LeanPool.GraphMinor.GM19.Section10a +public import LeanPool.GraphMinor.GM19.Section10b +public import LeanPool.GraphMinor.GM19.Section10c +public import LeanPool.GraphMinor.GM19.Section10d +public import LeanPool.GraphMinor.GM19.Section10e +public import LeanPool.GraphMinor.GM19.Section10f +public import LeanPool.GraphMinor.GM19.Section10g +public import LeanPool.GraphMinor.GM19.Section10h +public import LeanPool.GraphMinor.GM19.Section10i +public import LeanPool.GraphMinor.GM19.Section10j +public import LeanPool.GraphMinor.GM19.Section10k +public import LeanPool.GraphMinor.GM19.Section10l +public import LeanPool.GraphMinor.GM19.Section10m +public import LeanPool.GraphMinor.GM19.Section10n +public import LeanPool.GraphMinor.GM19.Section10o +public import LeanPool.GraphMinor.GM19.Section10p +public import LeanPool.GraphMinor.GM19.Section10q +public import LeanPool.GraphMinor.GM19.Section10r +public import LeanPool.GraphMinor.GM19.Section10s +public import LeanPool.GraphMinor.GM19.Section10t +public import LeanPool.GraphMinor.GM19.Section11a +public import LeanPool.GraphMinor.GM19.Section11b +public import LeanPool.GraphMinor.GM19.Section11c +public import LeanPool.GraphMinor.GM19.Section11d +public import LeanPool.GraphMinor.GM19.Section11e +public import LeanPool.GraphMinor.GM19.Section11f +public import LeanPool.GraphMinor.GM19.Section11g +public import LeanPool.GraphMinor.GM19.Section12a +public import LeanPool.GraphMinor.GM19.Section12b +public import LeanPool.GraphMinor.GM19.Section12c +public import LeanPool.GraphMinor.GM19.Section12d +public import LeanPool.GraphMinor.GM19.Section12e +public import LeanPool.GraphMinor.GM19.Section12f +public import LeanPool.GraphMinor.GM19.Section12g +public import LeanPool.GraphMinor.GM19.Section12h +public import LeanPool.GraphMinor.GM19.Section12i +public import LeanPool.GraphMinor.GM19.Section12j +public import LeanPool.GraphMinor.GM19.Section12k +public import LeanPool.GraphMinor.GM19.Section12l +public import LeanPool.GraphMinor.GM19.Section13a +public import LeanPool.GraphMinor.GM19.Section13b +public import LeanPool.GraphMinor.GM19.Section13c +public import LeanPool.GraphMinor.GM19.Section13d +public import LeanPool.GraphMinor.GM19.Section13e +public import LeanPool.GraphMinor.GM19.Section13f +public import LeanPool.GraphMinor.GM19.Section13g +public import LeanPool.GraphMinor.GM19.Section13h +public import LeanPool.GraphMinor.GM19.Section13i +public import LeanPool.GraphMinor.GM19.Section13j +public import LeanPool.GraphMinor.GM19.Section13k +public import LeanPool.GraphMinor.GM19.Section13l +public import LeanPool.GraphMinor.GM19.Section13m +public import LeanPool.GraphMinor.GM19.Section13n +public import LeanPool.GraphMinor.GM19.Section13o +public import LeanPool.GraphMinor.GM19.Section13p +public import LeanPool.GraphMinor.GM19.Section13q +public import LeanPool.GraphMinor.GM19.Section13r +public import LeanPool.GraphMinor.GM19.Section13s +public import LeanPool.GraphMinor.GM19.Section13t +public import LeanPool.GraphMinor.GM19.Section13u +public import LeanPool.GraphMinor.GM19.Section13v +public import LeanPool.GraphMinor.GM19.Section13w +public import LeanPool.GraphMinor.GM19.Section13x +public import LeanPool.GraphMinor.GM19.Section13y +public import LeanPool.GraphMinor.GM19.Section13z +public import LeanPool.GraphMinor.GM19.Section13za +public import LeanPool.GraphMinor.GM19.Section13zb +public import LeanPool.GraphMinor.GM19.Section13zc +public import LeanPool.GraphMinor.GM19.Section13zd +public import LeanPool.GraphMinor.GM19.Section13ze +public import LeanPool.GraphMinor.GM19.Section13zf +public import LeanPool.GraphMinor.GM19.Section14a +public import LeanPool.GraphMinor.GM19.Section14aa +public import LeanPool.GraphMinor.GM19.Section14ab +public import LeanPool.GraphMinor.GM19.Section14ac +public import LeanPool.GraphMinor.GM19.Section14ad +public import LeanPool.GraphMinor.GM19.Section14ae +public import LeanPool.GraphMinor.GM19.Section14af +public import LeanPool.GraphMinor.GM19.Section14ag +public import LeanPool.GraphMinor.GM19.Section14ah +public import LeanPool.GraphMinor.GM19.Section14b +public import LeanPool.GraphMinor.GM19.Section14c +public import LeanPool.GraphMinor.GM19.Section14d +public import LeanPool.GraphMinor.GM19.Section14e +public import LeanPool.GraphMinor.GM19.Section14f +public import LeanPool.GraphMinor.GM19.Section14g +public import LeanPool.GraphMinor.GM19.Section14h +public import LeanPool.GraphMinor.GM19.Section14i +public import LeanPool.GraphMinor.GM19.Section14j +public import LeanPool.GraphMinor.GM19.Section14l +public import LeanPool.GraphMinor.GM19.Section14m +public import LeanPool.GraphMinor.GM19.Section14n +public import LeanPool.GraphMinor.GM19.Section14o +public import LeanPool.GraphMinor.GM19.Section14p +public import LeanPool.GraphMinor.GM19.Section14q +public import LeanPool.GraphMinor.GM19.Section14r +public import LeanPool.GraphMinor.GM19.Section14s +public import LeanPool.GraphMinor.GM19.Section14t +public import LeanPool.GraphMinor.GM19.Section14u +public import LeanPool.GraphMinor.GM19.Section14v +public import LeanPool.GraphMinor.GM19.Section14w +public import LeanPool.GraphMinor.GM19.Section14x +public import LeanPool.GraphMinor.GM19.Section14y +public import LeanPool.GraphMinor.GM19.Section14z +public import LeanPool.GraphMinor.GM19.Section15a +public import LeanPool.GraphMinor.GM19.Section15b +public import LeanPool.GraphMinor.GM19.Section15c +public import LeanPool.GraphMinor.GM19.Section15d +public import LeanPool.GraphMinor.GM19.Section15e +public import LeanPool.GraphMinor.GM19.Section15f +public import LeanPool.GraphMinor.GM19.Section15g +public import LeanPool.GraphMinor.GM19.Section15h +public import LeanPool.GraphMinor.GM19.Section15i +public import LeanPool.GraphMinor.GM19.Section15j +public import LeanPool.GraphMinor.GM19.Section15k +public import LeanPool.GraphMinor.GM19.Section15l +public import LeanPool.GraphMinor.GM19.Section15m +public import LeanPool.GraphMinor.GM19.Section15n +public import LeanPool.GraphMinor.GM19.Section15o +public import LeanPool.GraphMinor.GM19.Section15p +public import LeanPool.GraphMinor.GM19.Section15q +public import LeanPool.GraphMinor.GM19.Section2 +public import LeanPool.GraphMinor.GM19.Section2Proved +public import LeanPool.GraphMinor.GM19.Section4a +public import LeanPool.GraphMinor.GM19.Section4b +public import LeanPool.GraphMinor.GM19.Section4c +public import LeanPool.GraphMinor.GM19.Section5a +public import LeanPool.GraphMinor.GM19.Section5b +public import LeanPool.GraphMinor.GM19.Section5c +public import LeanPool.GraphMinor.GM19.Section5d +public import LeanPool.GraphMinor.GM19.Section5e +public import LeanPool.GraphMinor.GM19.Section5f +public import LeanPool.GraphMinor.GM19.Section5g +public import LeanPool.GraphMinor.GM19.Section5h +public import LeanPool.GraphMinor.GM19.Section5i +public import LeanPool.GraphMinor.GM19.Section5j +public import LeanPool.GraphMinor.GM19.Section5k +public import LeanPool.GraphMinor.GM19.Section5l +public import LeanPool.GraphMinor.GM19.Section5m +public import LeanPool.GraphMinor.GM19.Section5n +public import LeanPool.GraphMinor.GM19.Section5o +public import LeanPool.GraphMinor.GM19.Section5oProved +public import LeanPool.GraphMinor.GM19.Section5p +public import LeanPool.GraphMinor.GM19.Section5q +public import LeanPool.GraphMinor.GM19.Section5r +public import LeanPool.GraphMinor.GM19.Section6Block +public import LeanPool.GraphMinor.GM19.Section6Bound +public import LeanPool.GraphMinor.GM19.Section6Comp +public import LeanPool.GraphMinor.GM19.Section6Contract +public import LeanPool.GraphMinor.GM19.Section6Cover +public import LeanPool.GraphMinor.GM19.Section6Cuff +public import LeanPool.GraphMinor.GM19.Section6Cut +public import LeanPool.GraphMinor.GM19.Section6Delete +public import LeanPool.GraphMinor.GM19.Section6Disc +public import LeanPool.GraphMinor.GM19.Section6Enl +public import LeanPool.GraphMinor.GM19.Section6Five +public import LeanPool.GraphMinor.GM19.Section6Graph +public import LeanPool.GraphMinor.GM19.Section6Hub +public import LeanPool.GraphMinor.GM19.Section6Max +public import LeanPool.GraphMinor.GM19.Section6Minor +public import LeanPool.GraphMinor.GM19.Section6Null +public import LeanPool.GraphMinor.GM19.Section6Path +public import LeanPool.GraphMinor.GM19.Section6Region +public import LeanPool.GraphMinor.GM19.Section6Rep +public import LeanPool.GraphMinor.GM19.Section6Reroute +public import LeanPool.GraphMinor.GM19.Section6Sector +public import LeanPool.GraphMinor.GM19.Section6Seven +public import LeanPool.GraphMinor.GM19.Section6Six +public import LeanPool.GraphMinor.GM19.Section6Tau +public import LeanPool.GraphMinor.GM19.Section6Tri +public import LeanPool.GraphMinor.GM19.Section6Two +public import LeanPool.GraphMinor.GM19.Section6Walk +public import LeanPool.GraphMinor.GM19.Section6a +public import LeanPool.GraphMinor.GM19.Section6aProved +public import LeanPool.GraphMinor.GM19.Section6b +public import LeanPool.GraphMinor.GM19.Section7a +public import LeanPool.GraphMinor.GM19.Section7b +public import LeanPool.GraphMinor.GM19.Section7c +public import LeanPool.GraphMinor.GM19.Section7d +public import LeanPool.GraphMinor.GM19.Section7e +public import LeanPool.GraphMinor.GM19.Section8a +public import LeanPool.GraphMinor.GM19.Section8b +public import LeanPool.GraphMinor.GM19.Section8c +public import LeanPool.GraphMinor.GM19.Section8d +public import LeanPool.GraphMinor.GM19.Section8e +public import LeanPool.GraphMinor.GM19.Section8f +public import LeanPool.GraphMinor.GM19.Section8g +public import LeanPool.GraphMinor.GM19.Section8h +public import LeanPool.GraphMinor.GM19.Section8i +public import LeanPool.GraphMinor.GM19.Section9a +public import LeanPool.GraphMinor.GM19.Section9b +public import LeanPool.GraphMinor.GM19.Section9c +public import LeanPool.GraphMinor.GM19.Section9d +public import LeanPool.GraphMinor.GM19.Section9e +public import LeanPool.GraphMinor.GM19.SideCoord +public import LeanPool.GraphMinor.GM19.SideDisc +public import LeanPool.GraphMinor.GM19.SideEdges +public import LeanPool.GraphMinor.GM19.SideEnds +public import LeanPool.GraphMinor.GM19.SideScheme +public import LeanPool.GraphMinor.GM19.SideShape +public import LeanPool.GraphMinor.GM19.Sides +public import LeanPool.GraphMinor.GM19.SkeletonTangle +public import LeanPool.GraphMinor.GM19.Spokes +public import LeanPool.GraphMinor.GM19.Theta +public import LeanPool.GraphMinor.GM19.ThinFits +public import LeanPool.GraphMinor.GM19.ThinPainting +public import LeanPool.GraphMinor.GM19.Thinning +public import LeanPool.GraphMinor.GM19.ThinningProved +public import LeanPool.GraphMinor.GM19.UniverseLift1 +public import LeanPool.GraphMinor.GM19.UniverseLift2 +public import LeanPool.GraphMinor.GM19.Winding +public import LeanPool.GraphMinor.GM20.Assembled +public import LeanPool.GraphMinor.GM20.Bag +public import LeanPool.GraphMinor.GM20.Basic +public import LeanPool.GraphMinor.GM20.Cited +public import LeanPool.GraphMinor.GM20.Codes +public import LeanPool.GraphMinor.GM20.Defs +public import LeanPool.GraphMinor.GM20.Directed +public import LeanPool.GraphMinor.GM20.Draw1 +public import LeanPool.GraphMinor.GM20.Draw10 +public import LeanPool.GraphMinor.GM20.Draw2 +public import LeanPool.GraphMinor.GM20.Draw3 +public import LeanPool.GraphMinor.GM20.Draw4 +public import LeanPool.GraphMinor.GM20.Draw5 +public import LeanPool.GraphMinor.GM20.Draw6 +public import LeanPool.GraphMinor.GM20.Draw7 +public import LeanPool.GraphMinor.GM20.Draw8 +public import LeanPool.GraphMinor.GM20.Draw9 +public import LeanPool.GraphMinor.GM20.Main +public import LeanPool.GraphMinor.GM20.Retag +public import LeanPool.GraphMinor.GM20.Section10a +public import LeanPool.GraphMinor.GM20.Section10b +public import LeanPool.GraphMinor.GM20.Section10c +public import LeanPool.GraphMinor.GM20.Section10cProved +public import LeanPool.GraphMinor.GM20.Section10d +public import LeanPool.GraphMinor.GM20.Section10e +public import LeanPool.GraphMinor.GM20.Section10f +public import LeanPool.GraphMinor.GM20.Section10g +public import LeanPool.GraphMinor.GM20.Section10h +public import LeanPool.GraphMinor.GM20.Section10i +public import LeanPool.GraphMinor.GM20.Section10iProved +public import LeanPool.GraphMinor.GM20.Section10j +public import LeanPool.GraphMinor.GM20.Section10k +public import LeanPool.GraphMinor.GM20.Section10l +public import LeanPool.GraphMinor.GM20.Section2 +public import LeanPool.GraphMinor.GM20.Section3 +public import LeanPool.GraphMinor.GM20.Section4a +public import LeanPool.GraphMinor.GM20.Section4b +public import LeanPool.GraphMinor.GM20.Section4c +public import LeanPool.GraphMinor.GM20.Section4d +public import LeanPool.GraphMinor.GM20.Section4e +public import LeanPool.GraphMinor.GM20.Section4f +public import LeanPool.GraphMinor.GM20.Section4g +public import LeanPool.GraphMinor.GM20.Section4h +public import LeanPool.GraphMinor.GM20.Section4i +public import LeanPool.GraphMinor.GM20.Section5a +public import LeanPool.GraphMinor.GM20.Section5b +public import LeanPool.GraphMinor.GM20.Section5c +public import LeanPool.GraphMinor.GM20.Section5d +public import LeanPool.GraphMinor.GM20.Section5e +public import LeanPool.GraphMinor.GM20.Section5f +public import LeanPool.GraphMinor.GM20.Section5g +public import LeanPool.GraphMinor.GM20.Section5h +public import LeanPool.GraphMinor.GM20.Section5i +public import LeanPool.GraphMinor.GM20.Section5j +public import LeanPool.GraphMinor.GM20.Section5k +public import LeanPool.GraphMinor.GM20.Section6a +public import LeanPool.GraphMinor.GM20.Section6b +public import LeanPool.GraphMinor.GM20.Section6c +public import LeanPool.GraphMinor.GM20.Section6d +public import LeanPool.GraphMinor.GM20.Section7a +public import LeanPool.GraphMinor.GM20.Section7b +public import LeanPool.GraphMinor.GM20.Section8a +public import LeanPool.GraphMinor.GM20.Section8b +public import LeanPool.GraphMinor.GM20.Section9a +public import LeanPool.GraphMinor.GM20.Section9b +public import LeanPool.GraphMinor.GM20.Section9c +public import LeanPool.GraphMinor.GM20.Section9d +public import LeanPool.GraphMinor.GM20.Section9e +public import LeanPool.GraphMinor.GM20.Section9f +public import LeanPool.GraphMinor.GM20.Section9g +public import LeanPool.GraphMinor.GM20.Section9h +public import LeanPool.GraphMinor.GM20.Section9hProved +public import LeanPool.GraphMinor.Hypergraph.Basic +public import LeanPool.GraphMinor.Menger.Basic +public import LeanPool.GraphMinor.Menger.SimpleGraph +public import LeanPool.GraphMinor.Minor.Basic +public import LeanPool.GraphMinor.Minor.CompleteGraph +public import LeanPool.GraphMinor.Minor.Model +public import LeanPool.GraphMinor.RST94.Basic +public import LeanPool.GraphMinor.RST94.Contract +public import LeanPool.GraphMinor.RST94.Rado +public import LeanPool.GraphMinor.RST94.Section2 +public import LeanPool.GraphMinor.RST94.Section3a +public import LeanPool.GraphMinor.RST94.Section3b +public import LeanPool.GraphMinor.RST94.Section3c +public import LeanPool.GraphMinor.RST94.Section3d +public import LeanPool.GraphMinor.RST94.Section4a +public import LeanPool.GraphMinor.RST94.Section4b +public import LeanPool.GraphMinor.RST94.Section4c +public import LeanPool.GraphMinor.RST94.Section4d +public import LeanPool.GraphMinor.RST94.Section4e +public import LeanPool.GraphMinor.RST94.Section5a +public import LeanPool.GraphMinor.RST94.Section5b +public import LeanPool.GraphMinor.RST94.Section5c +public import LeanPool.GraphMinor.RST94.Section5d +public import LeanPool.GraphMinor.RST94.Section5e +public import LeanPool.GraphMinor.RST94.Section5f +public import LeanPool.GraphMinor.RST94.Theorem23 +public import LeanPool.GraphMinor.RST94.Trees +public import LeanPool.GraphMinor.Statement +public import LeanPool.GraphMinor.Surface.AddCrosscap +public import LeanPool.GraphMinor.Surface.AddHandle +public import LeanPool.GraphMinor.Surface.Annulus +public import LeanPool.GraphMinor.Surface.ArcDisc +public import LeanPool.GraphMinor.Surface.ArcErase +public import LeanPool.GraphMinor.Surface.ArcInPath +public import LeanPool.GraphMinor.Surface.ArcPlane +public import LeanPool.GraphMinor.Surface.ArcTools +public import LeanPool.GraphMinor.Surface.Cap +public import LeanPool.GraphMinor.Surface.CapCoh +public import LeanPool.GraphMinor.Surface.CellFamily +public import LeanPool.GraphMinor.Surface.CellMap +public import LeanPool.GraphMinor.Surface.ChartCells +public import LeanPool.GraphMinor.Surface.Circle +public import LeanPool.GraphMinor.Surface.CircleMove +public import LeanPool.GraphMinor.Surface.CircleOrder +public import LeanPool.GraphMinor.Surface.Classification +public import LeanPool.GraphMinor.Surface.CohCard +public import LeanPool.GraphMinor.Surface.CohCount +public import LeanPool.GraphMinor.Surface.CohExist +public import LeanPool.GraphMinor.Surface.CohPrim +public import LeanPool.GraphMinor.Surface.Collapse +public import LeanPool.GraphMinor.Surface.Collar +public import LeanPool.GraphMinor.Surface.CrossCut +public import LeanPool.GraphMinor.Surface.Crossing +public import LeanPool.GraphMinor.Surface.Cuffs +public import LeanPool.GraphMinor.Surface.CutArc +public import LeanPool.GraphMinor.Surface.CutChain +public import LeanPool.GraphMinor.Surface.CutComp +public import LeanPool.GraphMinor.Surface.CutConn +public import LeanPool.GraphMinor.Surface.CutCyl +public import LeanPool.GraphMinor.Surface.CutEdges +public import LeanPool.GraphMinor.Surface.CutGlue +public import LeanPool.GraphMinor.Surface.CutGraph +public import LeanPool.GraphMinor.Surface.CutIArc +public import LeanPool.GraphMinor.Surface.CutLift +public import LeanPool.GraphMinor.Surface.CutLoop +public import LeanPool.GraphMinor.Surface.CutNull +public import LeanPool.GraphMinor.Surface.CutOArc +public import LeanPool.GraphMinor.Surface.CutParallel +public import LeanPool.GraphMinor.Surface.CutPieces +public import LeanPool.GraphMinor.Surface.CutRetract +public import LeanPool.GraphMinor.Surface.CutSimilar +public import LeanPool.GraphMinor.Surface.CutTree +public import LeanPool.GraphMinor.Surface.CutTwo +public import LeanPool.GraphMinor.Surface.CutTwoArc +public import LeanPool.GraphMinor.Surface.CutTwoWords +public import LeanPool.GraphMinor.Surface.CutWord +public import LeanPool.GraphMinor.Surface.CutWords +public import LeanPool.GraphMinor.Surface.Cylinder +public import LeanPool.GraphMinor.Surface.Defs +public import LeanPool.GraphMinor.Surface.Dihedral +public import LeanPool.GraphMinor.Surface.Disc +public import LeanPool.GraphMinor.Surface.DiscArcs +public import LeanPool.GraphMinor.Surface.DiscFan +public import LeanPool.GraphMinor.Surface.DiscGrow +public import LeanPool.GraphMinor.Surface.DiscMatch +public import LeanPool.GraphMinor.Surface.DiscMerge +public import LeanPool.GraphMinor.Surface.DiscNbhd +public import LeanPool.GraphMinor.Surface.DiscPolygon +public import LeanPool.GraphMinor.Surface.DiscRemove +public import LeanPool.GraphMinor.Surface.DiscTwist +public import LeanPool.GraphMinor.Surface.DiscUnion +public import LeanPool.GraphMinor.Surface.DiscsInSurface +public import LeanPool.GraphMinor.Surface.Dissection +public import LeanPool.GraphMinor.Surface.DomainHomeo +public import LeanPool.GraphMinor.Surface.DomainPair +public import LeanPool.GraphMinor.Surface.DrawCarry +public import LeanPool.GraphMinor.Surface.EdgeLens +public import LeanPool.GraphMinor.Surface.EdgeLoop +public import LeanPool.GraphMinor.Surface.Epstein +public import LeanPool.GraphMinor.Surface.Fan +public import LeanPool.GraphMinor.Surface.FanSquare +public import LeanPool.GraphMinor.Surface.FreeCover +public import LeanPool.GraphMinor.Surface.Gluing +public import LeanPool.GraphMinor.Surface.HandleModel +public import LeanPool.GraphMinor.Surface.HoleDisc +public import LeanPool.GraphMinor.Surface.HoleLoop +public import LeanPool.GraphMinor.Surface.InvarianceOfDomain +public import LeanPool.GraphMinor.Surface.JoinedCollar +public import LeanPool.GraphMinor.Surface.Jordan +public import LeanPool.GraphMinor.Surface.JordanDomain +public import LeanPool.GraphMinor.Surface.JordanPlane +public import LeanPool.GraphMinor.Surface.LocalCoh +public import LeanPool.GraphMinor.Surface.Lunes +public import LeanPool.GraphMinor.Surface.Mesh +public import LeanPool.GraphMinor.Surface.MeshLine +public import LeanPool.GraphMinor.Surface.Mobius +public import LeanPool.GraphMinor.Surface.ModelCriterion +public import LeanPool.GraphMinor.Surface.ModelDisc +public import LeanPool.GraphMinor.Surface.ModelHomeo +public import LeanPool.GraphMinor.Surface.ModelLoop +public import LeanPool.GraphMinor.Surface.ModelPresent +public import LeanPool.GraphMinor.Surface.ModelSides +public import LeanPool.GraphMinor.Surface.ModelWord +public import LeanPool.GraphMinor.Surface.MoveCuff +public import LeanPool.GraphMinor.Surface.NormalVolt +public import LeanPool.GraphMinor.Surface.NormalWord +public import LeanPool.GraphMinor.Surface.OneManifold +public import LeanPool.GraphMinor.Surface.OneWord +public import LeanPool.GraphMinor.Surface.OpenDisc +public import LeanPool.GraphMinor.Surface.PasteDisc +public import LeanPool.GraphMinor.Surface.PasteModel +public import LeanPool.GraphMinor.Surface.PlaneDisc +public import LeanPool.GraphMinor.Surface.PlaneLog +public import LeanPool.GraphMinor.Surface.PlaneOrientation +public import LeanPool.GraphMinor.Surface.PlaneSeparation +public import LeanPool.GraphMinor.Surface.PolyMoves +public import LeanPool.GraphMinor.Surface.Polygon +public import LeanPool.GraphMinor.Surface.PushOff +public import LeanPool.GraphMinor.Surface.RemoveDiscs +public import LeanPool.GraphMinor.Surface.Ring +public import LeanPool.GraphMinor.Surface.Schoenflies +public import LeanPool.GraphMinor.Surface.SideCut +public import LeanPool.GraphMinor.Surface.Skeleton +public import LeanPool.GraphMinor.Surface.SphereDisc +public import LeanPool.GraphMinor.Surface.SurfaceGraph +public import LeanPool.GraphMinor.Surface.SurfacePull +public import LeanPool.GraphMinor.Surface.TopologyStatements +public import LeanPool.GraphMinor.Surface.TriCoh +public import LeanPool.GraphMinor.Surface.TriCohGlue +public import LeanPool.GraphMinor.Surface.TriCount +public import LeanPool.GraphMinor.Surface.TriGraph +public import LeanPool.GraphMinor.Surface.TriLocal +public import LeanPool.GraphMinor.Surface.TriPath +public import LeanPool.GraphMinor.Surface.Triangulate +public import LeanPool.GraphMinor.Surface.VertexLink +public import LeanPool.GraphMinor.Surface.VoltWord +public import LeanPool.GraphMinor.Surface.Wedge +public import LeanPool.GraphMinor.Surface.WordCases +public import LeanPool.GraphMinor.Surface.WordCover +public import LeanPool.GraphMinor.Surface.WordFold +public import LeanPool.GraphMinor.Surface.WordGerm +public import LeanPool.GraphMinor.Surface.WordIso +public import LeanPool.GraphMinor.Surface.WordMoves +public import LeanPool.GraphMinor.Surface.WordNormal +public import LeanPool.GraphMinor.Surface.WordRules +public import LeanPool.GraphMinor.Surface.WordSide +public import LeanPool.GraphMinor.Surface.WordSlide +public import LeanPool.GraphMinor.Surface.WordSpace +public import LeanPool.GraphMinor.Surface.WordSurface +public import LeanPool.GraphMinor.Surface.WordTrack +public import LeanPool.GraphMinor.Thomas.Amalgamate +public import LeanPool.GraphMinor.Thomas.Basic +public import LeanPool.GraphMinor.Thomas.Claims +public import LeanPool.GraphMinor.Thomas.LeanDecomp +public import LeanPool.GraphMinor.Thomas.RootedTree +public import LeanPool.GraphMinor.Thomas.Separator +public import LeanPool.GraphMinor.Thomas.Translate +public import LeanPool.GraphMinor.TreePath diff --git a/LeanPool/GraphMinor/Menger/Basic.lean b/LeanPool/GraphMinor/Menger/Basic.lean new file mode 100644 index 0000000000..33c9ab625a --- /dev/null +++ b/LeanPool/GraphMinor/Menger/Basic.lean @@ -0,0 +1,271 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Hypergraph.Basic +import LeanPool.GraphMinor.Menger.SimpleGraph + +/-! +# Menger's theorem for hypergraphs + +This file proves `GraphMinor.menger` (`MengerStatement`): for a hypergraph `G`, sets +`X, Y ⊆ V(G)` and `k ≥ 0`, every separation `(G₁, G₂)` of `G` with `X ⊆ V(G₁)` and `Y ⊆ V(G₂)` has +order at least `k` if and only if the 1-skeleton of `G` has `k` mutually vertex-disjoint paths from +`X` to `Y`. + +The easy direction shows that every path from `X` to `Y` in `G.skeleton` meets `V(G₁ ∩ G₂)`, so `k` +disjoint paths require at least `k` vertices in `V(G₁ ∩ G₂)`. The converse constructs a separation +`(G₁, G₂)` of `G` of order `|S|` from any vertex separator `S ⊆ V(G)` between `X` and `Y` in +`G.skeleton`, by putting into `G₁` the vertices reachable from `X` in `G.skeleton` without meeting +`S`, together with `S`, and all edges whose ends lie in `V(G₁)`, and then applies Menger's theorem +for finite simple graphs (`GraphMinor.Menger.exists_disjointPaths`) to the induced subgraph of +`G.skeleton` on `V(G)`. +-/ + +public section + +namespace GraphMinor + +open SimpleGraph + +variable {α β : Type*} + +private lemma exists_mem_inter_of_walk {G G₁ G₂ : Hypergraph α β} + (hsep : G.IsSeparation G₁ G₂) {u v : α} (w : G.skeleton.Walk u v) + (hu : u ∈ G₁.vertexSet) (hv : v ∈ G₂.vertexSet) : + ∃ z ∈ w.support, z ∈ (G₁ ∩ G₂).vertexSet := by + induction w with + | nil => + exact ⟨_, Walk.start_mem_support _, hu, hv⟩ + | @cons u u' v hadj rest ih => + by_cases hu' : u' ∈ G₁.vertexSet + · obtain ⟨z, hz, hz_mem⟩ := ih hu' hv + exact ⟨z, List.mem_cons_of_mem _ hz, hz_mem⟩ + · obtain ⟨_, e, heu, heu'⟩ := id hadj + have he : e ∈ (G₁ ∪ G₂).edgeSet := by + rw [hsep.union_eq] + exact G.edge_mem_of_inc heu + rcases he with he₁ | he₂ + · have hends := hsep.left_le.ends_eq e he₁ + have hu'_inc : G₁.Inc e u' := by + change u' ∈ G₁.ends e + rw [← hends] + exact heu' + exact absurd (G₁.vertex_mem_of_inc hu'_inc) hu' + · have hends := hsep.right_le.ends_eq e he₂ + have hu_inc : G₂.Inc e u := by + change u ∈ G₂.ends e + rw [← hends] + exact heu + exact ⟨u, Walk.start_mem_support _, hu, G₂.vertex_mem_of_inc hu_inc⟩ + +private lemma separationOrder_ge_of_hasDisjointPaths {G : Hypergraph α β} {X Y : Set α} {k : ℕ} + (hP : HasDisjointPaths G.skeleton X Y k) {G₁ G₂ : Hypergraph α β} + (hsep : G.IsSeparation G₁ G₂) (hX : X ⊆ G₁.vertexSet) (hY : Y ⊆ G₂.vertexSet) : + k ≤ Hypergraph.separationOrder G₁ G₂ := by + obtain ⟨P, hP_disj⟩ := hP + have hex : ∀ i : Fin k, ∃ z ∈ (P i).walk.support, z ∈ (G₁ ∩ G₂).vertexSet := fun i ↦ + exists_mem_inter_of_walk hsep (P i).walk (hX (P i).first_mem) (hY (P i).last_mem) + choose z hz_supp hz_mem using hex + let f : Fin k → ↥(G₁ ∩ G₂).vertexSet := fun i ↦ ⟨z i, hz_mem i⟩ + have hf_inj : Function.Injective f := by + intro i j hij + by_contra hne + have hzij : z i = z j := congrArg Subtype.val hij + exact Set.disjoint_left.mp (hP_disj hne) (hz_supp i) (hzij ▸ hz_supp j) + have : Finite ↥(G₁ ∩ G₂).vertexSet := (G₁ ∩ G₂).vertexSet_finite.to_subtype + have hle := Nat.card_le_card_of_injective f hf_inj + rw [Nat.card_fin, Nat.card_coe_set_eq] at hle + exact hle + +private lemma walk_support_subset_vertexSet {G : Hypergraph α β} {u v : α} + (w : G.skeleton.Walk u v) (hu : u ∈ G.vertexSet) : + ∀ z ∈ w.support, z ∈ G.vertexSet := + Hypergraph.skeleton_walk_support_subset_vertexSet w hu + +/-- The vertices reachable from `X` in `G.skeleton` by walks avoiding `S`. -/ +private def reachableAvoiding (G : Hypergraph α β) (X S : Set α) : Set α := + {v | ∃ x ∈ X, ∃ w : G.skeleton.Walk x v, ∀ z ∈ w.support, z ∉ S} + +private lemma reachableAvoiding_subset {G : Hypergraph α β} {X S : Set α} + (hX : X ⊆ G.vertexSet) : reachableAvoiding G X S ⊆ G.vertexSet \ S := by + rintro v ⟨x, hxX, w, hw⟩ + exact ⟨walk_support_subset_vertexSet w (hX hxX) v (Walk.end_mem_support w), + hw v (Walk.end_mem_support w)⟩ + +private lemma not_mem_Y_of_mem_reachableAvoiding {G : Hypergraph α β} {X Y S : Set α} + (hS : ∀ P : PathFromTo G.skeleton X Y, ∃ x ∈ P.walk.support, x ∈ S) + {v : α} (hv : v ∈ reachableAvoiding G X S) : v ∉ Y := by + classical + rintro hvY + obtain ⟨x, hxX, w, hw⟩ := hv + obtain ⟨z, hz, hzS⟩ := hS ⟨x, v, w.bypass, w.bypass_isPath, hxX, hvY⟩ + exact hw z (w.support_bypass_subset_support hz) hzS + +private lemma adj_mem_reachableAvoiding {G : Hypergraph α β} {X S : Set α} {v u : α} + (hv : v ∈ reachableAvoiding G X S) (hadj : G.skeleton.Adj v u) (huS : u ∉ S) : + u ∈ reachableAvoiding G X S := by + obtain ⟨x, hxX, w, hw⟩ := hv + refine ⟨x, hxX, w.concat hadj, fun z hz ↦ ?_⟩ + simp only [Walk.support_concat, List.mem_append, List.mem_cons, List.not_mem_nil, + or_false] at hz + rcases hz with hz | rfl + · exact hw z hz + · exact huS + +private lemma exists_separation_of_separator {G : Hypergraph α β} {X Y S : Set α} + (hX : X ⊆ G.vertexSet) (hY : Y ⊆ G.vertexSet) (hS_sub : S ⊆ G.vertexSet) + (hS_sep : ∀ P : PathFromTo G.skeleton X Y, ∃ x ∈ P.walk.support, x ∈ S) : + ∃ G₁ G₂ : Hypergraph α β, + G.IsSeparation G₁ G₂ ∧ X ⊆ G₁.vertexSet ∧ Y ⊆ G₂.vertexSet ∧ + Hypergraph.separationOrder G₁ G₂ = S.ncard := by + let R := reachableAvoiding G X S + have hR_sub : R ⊆ G.vertexSet \ S := reachableAvoiding_subset hX + let V₁ : Set α := R ∪ S + let E₁ : Set β := {e ∈ G.edgeSet | G.ends e ⊆ V₁} + let V₂ : Set α := G.vertexSet \ R + let E₂ : Set β := G.edgeSet \ E₁ + have hV₁_sub : V₁ ⊆ G.vertexSet := + Set.union_subset (hR_sub.trans Set.sdiff_subset) hS_sub + have hV₂_sub : V₂ ⊆ G.vertexSet := Set.sdiff_subset + have hE₂_ends : ∀ ⦃e : β⦄ ⦃v : α⦄, e ∈ E₂ → G.Inc e v → v ∈ V₂ := by + intro e v he₂ hinc + refine ⟨G.vertex_mem_of_inc hinc, fun hvR ↦ he₂.2 ⟨he₂.1, fun u hu ↦ ?_⟩⟩ + by_contra huV₁ + have huR : u ∉ R := fun h ↦ huV₁ (Or.inl h) + have huS : u ∉ S := fun h ↦ huV₁ (Or.inr h) + have hvu : v ≠ u := fun h ↦ huR (h ▸ hvR) + have hadj : G.skeleton.Adj v u := ⟨hvu, e, hinc, hu⟩ + exact huR (adj_mem_reachableAvoiding hvR hadj huS) + let G₁ : Hypergraph α β := + { vertexSet := V₁ + edgeSet := E₁ + Inc := fun e v ↦ e ∈ E₁ ∧ G.Inc e v + vertex_mem_of_inc := fun _ _ h ↦ h.1.2 h.2 + edge_mem_of_inc := fun _ _ h ↦ h.1 + vertexSet_finite := G.vertexSet_finite.subset hV₁_sub + edgeSet_finite := G.edgeSet_finite.subset (fun _ h ↦ h.1) } + let G₂ : Hypergraph α β := + { vertexSet := V₂ + edgeSet := E₂ + Inc := fun e v ↦ e ∈ E₂ ∧ G.Inc e v + vertex_mem_of_inc := fun _ _ h ↦ hE₂_ends h.1 h.2 + edge_mem_of_inc := fun _ _ h ↦ h.1 + vertexSet_finite := G.vertexSet_finite.subset hV₂_sub + edgeSet_finite := G.edgeSet_finite.subset Set.sdiff_subset } + refine ⟨G₁, G₂, ?_, ?_, ?_, ?_⟩ + · refine ⟨⟨hV₁_sub, fun _ h ↦ h.1, fun e he ↦ ?_⟩, + ⟨hV₂_sub, Set.sdiff_subset, fun e he ↦ ?_⟩, ?_, ?_⟩ + · ext v + simp only [Hypergraph.ends, Set.mem_ofPred_eq, G₁] + exact ⟨fun h ↦ ⟨he, h⟩, fun h ↦ h.2⟩ + · ext v + simp only [Hypergraph.ends, Set.mem_ofPred_eq, G₂] + exact ⟨fun h ↦ ⟨he, h⟩, fun h ↦ h.2⟩ + · refine Hypergraph.ext ?_ ?_ ?_ + · ext v + change v ∈ (R ∪ S) ∪ (G.vertexSet \ R) ↔ v ∈ G.vertexSet + constructor + · rintro ((hvR | hvS) | hv₂) + · exact hV₁_sub (Or.inl hvR) + · exact hS_sub hvS + · exact hv₂.1 + · intro hv + by_cases hvR : v ∈ R + · exact Or.inl (Or.inl hvR) + · exact Or.inr ⟨hv, hvR⟩ + · ext e + change e ∈ E₁ ∪ (G.edgeSet \ E₁) ↔ e ∈ G.edgeSet + exact ⟨fun h ↦ h.elim (fun h₁ ↦ h₁.1) (fun h₂ ↦ h₂.1), + fun he ↦ by by_cases h₁ : e ∈ E₁ <;> [exact Or.inl h₁; exact Or.inr ⟨he, h₁⟩]⟩ + · funext e v + apply propext + change (e ∈ E₁ ∧ G.Inc e v) ∨ (e ∈ G.edgeSet \ E₁ ∧ G.Inc e v) ↔ G.Inc e v + constructor + · rintro (⟨_, h⟩ | ⟨_, h⟩) <;> exact h + · intro h + by_cases h₁ : e ∈ E₁ + · exact Or.inl ⟨h₁, h⟩ + · exact Or.inr ⟨⟨G.edge_mem_of_inc h, h₁⟩, h⟩ + · ext e + change e ∈ E₁ ∧ e ∈ G.edgeSet \ E₁ ↔ False + exact ⟨fun ⟨h₁, _, h₂⟩ ↦ h₂ h₁, False.elim⟩ + · intro x hxX + by_cases hxS : x ∈ S + · exact Or.inr hxS + · refine Or.inl ⟨x, hxX, .nil, fun z hz ↦ ?_⟩ + simp only [Walk.support_nil, List.mem_cons, List.not_mem_nil, or_false] at hz + exact hz ▸ hxS + · intro y hyY + exact ⟨hY hyY, fun hyR ↦ not_mem_Y_of_mem_reachableAvoiding hS_sep hyR hyY⟩ + · have h_inter : (G₁ ∩ G₂).vertexSet = S := by + ext v + change v ∈ (R ∪ S) ∧ v ∈ G.vertexSet \ R ↔ v ∈ S + constructor + · rintro ⟨hvR | hvS, _, hvnotR⟩ + · exact False.elim (hvnotR hvR) + · exact hvS + · intro hvS + exact ⟨Or.inr hvS, hS_sub hvS, fun hvR ↦ (hR_sub hvR).2 hvS⟩ + unfold Hypergraph.separationOrder + rw [h_inter] + +/-- Menger's theorem in the form of Graph Minors IV. -/ +theorem menger : MengerStatement := by + intro α β G X Y hX hY k + refine ⟨fun hsep_ord ↦ ?_, fun hP G₁ G₂ hsep hX₁ hY₂ ↦ + separationOrder_ge_of_hasDisjointPaths hP hsep hX₁ hY₂⟩ + let K₀ := G.skeleton.induce G.vertexSet + let X₀ : Set ↥G.vertexSet := Subtype.val ⁻¹' X + let Y₀ : Set ↥G.vertexSet := Subtype.val ⁻¹' Y + have hfin₀ : Finite ↥G.vertexSet := G.vertexSet_finite.to_subtype + have h0 : HasDisjointPaths K₀ X₀ Y₀ k := by + refine Menger.exists_disjointPaths K₀ X₀ Y₀ hfin₀ k fun S₀ hS₀ ↦ ?_ + let S : Set α := Subtype.val '' S₀ + have hS_sub : S ⊆ G.vertexSet := by + rintro _ ⟨v, _, rfl⟩ + exact v.2 + have hS_sep : ∀ P : PathFromTo G.skeleton X Y, ∃ x ∈ P.walk.support, x ∈ S := by + intro P + have hw : ∀ x ∈ P.walk.support, x ∈ G.vertexSet := + walk_support_subset_vertexSet P.walk (hX P.first_mem) + let w₀ := P.walk.induce G.vertexSet hw + have hw₀_path : w₀.IsPath := by + have hmap : (w₀.map (Embedding.induce G.vertexSet).toHom).IsPath := by + rw [Walk.map_induce] + exact P.isPath + exact hmap.of_map + let P₀ : PathFromTo K₀ X₀ Y₀ := + ⟨⟨P.first, hw _ (Walk.start_mem_support _)⟩, + ⟨P.last, hw _ (Walk.end_mem_support _)⟩, + w₀, hw₀_path, P.first_mem, P.last_mem⟩ + obtain ⟨x₀, hx₀_supp, hx₀_S₀⟩ := hS₀ P₀ + have hx₀_in_P : x₀.1 ∈ P.walk.support := by + change x₀ ∈ w₀.support at hx₀_supp + rw [Walk.support_induce, List.mem_attachWith] at hx₀_supp + exact hx₀_supp + exact ⟨x₀.1, hx₀_in_P, x₀, hx₀_S₀, rfl⟩ + obtain ⟨G₁, G₂, hsep, hX₁, hY₂, hord⟩ := + exists_separation_of_separator hX hY hS_sub hS_sep + have hk_le := hsep_ord G₁ G₂ hsep hX₁ hY₂ + rw [hord, Set.ncard_image_of_injective S₀ Subtype.val_injective] at hk_le + exact hk_le + obtain ⟨P₀, hP₀⟩ := h0 + let emb := (Embedding.induce G.vertexSet (G := G.skeleton)) + refine ⟨fun i ↦ ⟨emb.toHom (P₀ i).first, emb.toHom (P₀ i).last, + (P₀ i).walk.map emb.toHom, (P₀ i).isPath.map emb.injective, + (P₀ i).first_mem, (P₀ i).last_mem⟩, fun i j hij ↦ + Set.disjoint_left.mpr fun z hzi hzj ↦ ?_⟩ + simp only [Set.mem_ofPred_eq, Walk.support_map, List.mem_map] at hzi hzj + obtain ⟨xi, hxi, rfl⟩ := hzi + obtain ⟨xj, hxj, hxj_eq⟩ := hzj + have hxx : xi = xj := emb.injective hxj_eq.symm + exact Set.disjoint_left.mp (hP₀ hij) hxi (hxx ▸ hxj) + +end GraphMinor diff --git a/LeanPool/GraphMinor/Menger/SimpleGraph.lean b/LeanPool/GraphMinor/Menger/SimpleGraph.lean new file mode 100644 index 0000000000..998e9af904 --- /dev/null +++ b/LeanPool/GraphMinor/Menger/SimpleGraph.lean @@ -0,0 +1,570 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Hypergraph.Basic +import Mathlib.Combinatorics.SimpleGraph.DeleteEdges + +/-! +# Menger's theorem for finite simple graphs + +This file proves Menger's theorem for finite simple graphs +(`GraphMinor.Menger.exists_disjointPaths`). The induction follows F. Göring, +[*A proof of Menger's theorem by contraction*](https://doi.org/10.7151/dmgt.1161), +Discuss. Math. Graph Theory 22 (2002), 111–112. It tries contracting an edge and uses deletion +when the contraction admits a separator below the size bound. +-/ + +public section + +namespace GraphMinor.Menger + +open SimpleGraph + +variable {V : Type*} + +/-- `S` is an `A`-`B` separator in `K`: every path in `K` from `A` to `B` meets `S`. -/ +private def IsSeparator (K : SimpleGraph V) (A B S : Set V) : Prop := + ∀ P : PathFromTo K A B, ∃ x ∈ P.walk.support, x ∈ S + +private lemma IsSeparator.exists_mem_support_of_walk {K : SimpleGraph V} {A B S : Set V} + (hS : IsSeparator K A B S) {u v : V} (hu : u ∈ A) (hv : v ∈ B) (w : K.Walk u v) : + ∃ x ∈ w.support, x ∈ S := by + classical + obtain ⟨x, hx, hxS⟩ := hS ⟨u, v, w.bypass, w.bypass_isPath, hu, hv⟩ + exact ⟨x, w.support_bypass_subset_support hx, hxS⟩ + +private lemma hasDisjointPaths_of_edgeSet_eq_empty [Finite V] (K : SimpleGraph V) (A B : Set V) + (hE : K.edgeSet = ∅) (k : ℕ) (h : ∀ S : Set V, IsSeparator K A B S → k ≤ S.ncard) : + HasDisjointPaths K A B k := by + have hsep : IsSeparator K A B (A ∩ B) := by + intro P + rcases P with ⟨u, v, w, _, hu, hv⟩ + cases w with + | nil => + exact ⟨u, Walk.start_mem_support _, hu, hv⟩ + | cons hadj _ => + have he : s(u, _) ∈ K.edgeSet := K.mem_edgeSet.mpr hadj + rw [hE] at he + exact False.elim he + have hk : k ≤ (A ∩ B).ncard := h (A ∩ B) hsep + let _ : Fintype ↥(A ∩ B) := Fintype.ofFinite ↥(A ∩ B) + have hcard : k ≤ Fintype.card ↥(A ∩ B) := by + rwa [← Nat.card_eq_fintype_card, Nat.card_coe_set_eq] + let e := (Fintype.equivFin ↥(A ∩ B)).symm + let v : Fin k → ↥(A ∩ B) := fun i ↦ e (Fin.castLE hcard i) + refine ⟨fun i ↦ ⟨(v i).1, (v i).1, .nil, .nil, (v i).2.1, (v i).2.2⟩, ?_⟩ + intro i j hij + rw [Set.disjoint_left] + intro z hzi hzj + simp only [Set.mem_ofPred_eq, Walk.support_nil, List.mem_cons, List.not_mem_nil, + or_false] at hzi hzj + apply hij + have hv_eq : v i = v j := Subtype.ext (hzi.symm.trans hzj) + exact (Fin.castLE_injective hcard) (e.injective hv_eq) + +/-- The graph obtained from `K` by contracting the edge `x y` into `x` and isolating `y`. -/ +private def contractEdge (K : SimpleGraph V) (x y : V) : SimpleGraph V where + Adj u v := u ≠ v ∧ u ≠ y ∧ v ≠ y ∧ + (K.Adj u v ∨ (u = x ∧ K.Adj y v) ∨ (v = x ∧ K.Adj u y)) + symm := ⟨fun _ _ ⟨huv, huy, hvy, h⟩ ↦ ⟨huv.symm, hvy, huy, + h.elim (fun h ↦ Or.inl h.symm) + (fun h ↦ h.elim (fun ⟨rfl, h⟩ ↦ Or.inr (Or.inr ⟨rfl, h.symm⟩)) + (fun ⟨rfl, h⟩ ↦ Or.inr (Or.inl ⟨rfl, h.symm⟩)))⟩⟩ + loopless := ⟨fun _ h ↦ h.1 rfl⟩ + +/-- The image of a vertex set `A` when contracting `y` into `x`. -/ +private def contractSet (x y : V) (A : Set V) : Set V := + {u | u ≠ y ∧ (u ∈ A ∨ (u = x ∧ y ∈ A))} + +private lemma not_mem_support_of_contractEdge {K : SimpleGraph V} {x y u v : V} + (w : (contractEdge K x y).Walk u v) (hu : u ≠ y) : y ∉ w.support := by + induction w with + | nil => + simp [hu.symm] + | cons hadj rest ih => + rw [Walk.support_cons, List.mem_cons, not_or] + exact ⟨hu.symm, ih hadj.2.2.1⟩ + +private lemma ncard_edgeSet_contractEdge_lt [Finite V] {K : SimpleGraph V} {x y : V} + (hxy : K.Adj x y) : (contractEdge K x y).edgeSet.ncard < K.edgeSet.ncard := by + classical + let f : V → V := fun u ↦ if u = y then x else u + have hsub : (contractEdge K x y).edgeSet ⊆ Sym2.map f '' (K.edgeSet \ {s(x, y)}) := by + intro e he + induction e using Sym2.ind with + | _ u v => + rw [mem_edgeSet] at he + rcases he with ⟨huv, huy, hvy, h⟩ + rcases h with huv' | ⟨rfl, hyv⟩ | ⟨rfl, huy'⟩ + · refine ⟨s(u, v), ⟨K.mem_edgeSet.mpr huv', ?_⟩, ?_⟩ + · simp only [Set.mem_singleton_iff, Sym2.eq_iff] + rintro (⟨_, rfl⟩ | ⟨rfl, _⟩) <;> contradiction + · simp [f, huy, hvy] + · refine ⟨s(y, v), ⟨K.mem_edgeSet.mpr hyv, ?_⟩, ?_⟩ + · simp only [Set.mem_singleton_iff, Sym2.eq_iff] + rintro (⟨rfl, rfl⟩ | ⟨_, rfl⟩) + · exact hxy.ne rfl + · exact huv rfl + · simp [f, hvy] + · refine ⟨s(u, y), ⟨K.mem_edgeSet.mpr huy', ?_⟩, ?_⟩ + · simp only [Set.mem_singleton_iff, Sym2.eq_iff] + rintro (⟨rfl, _⟩ | ⟨rfl, rfl⟩) + · exact huv rfl + · exact hxy.ne rfl + · simp [f, huy] + have h1 : (contractEdge K x y).edgeSet.ncard ≤ + (Sym2.map f '' (K.edgeSet \ {s(x, y)})).ncard := + Set.ncard_le_ncard hsub (Set.toFinite _) + have h2 : (Sym2.map f '' (K.edgeSet \ {s(x, y)})).ncard ≤ (K.edgeSet \ {s(x, y)}).ncard := + Set.ncard_image_le (Set.toFinite _) + have h3 : (K.edgeSet \ {s(x, y)}).ncard + 1 = K.edgeSet.ncard := + Set.ncard_sdiff_singleton_add_one (K.mem_edgeSet.mpr hxy) (Set.toFinite _) + omega + +private lemma exists_liftWalk {K : SimpleGraph V} {x y : V} (hxy : K.Adj x y) {u v : V} + (w : (contractEdge K x y).Walk u v) : + ∃ w' : K.Walk u v, ∀ z ∈ w'.support, z ∈ w.support ∨ (z = y ∧ x ∈ w.support) := by + induction w with + | nil => + exact ⟨.nil, fun z hz ↦ Or.inl hz⟩ + | @cons u u' v hadj rest ih => + obtain ⟨w', hw'⟩ := ih + rcases hadj.2.2.2 with huu' | ⟨rfl, hyu'⟩ | ⟨rfl, huy⟩ + · refine ⟨.cons huu' w', fun z hz ↦ ?_⟩ + rw [Walk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · exact Or.inl (Walk.start_mem_support _) + · rcases hw' z hz with hz' | ⟨rfl, hx⟩ + · exact Or.inl (List.mem_cons_of_mem _ hz') + · exact Or.inr ⟨rfl, List.mem_cons_of_mem _ hx⟩ + · refine ⟨.cons hxy (.cons hyu' w'), fun z hz ↦ ?_⟩ + rw [Walk.support_cons, Walk.support_cons, List.mem_cons, List.mem_cons] at hz + rcases hz with rfl | rfl | hz + · exact Or.inl (Walk.start_mem_support _) + · exact Or.inr ⟨rfl, Walk.start_mem_support _⟩ + · rcases hw' z hz with hz' | ⟨rfl, _⟩ + · exact Or.inl (List.mem_cons_of_mem _ hz') + · exact Or.inr ⟨rfl, Walk.start_mem_support _⟩ + · refine ⟨.cons huy (.cons hxy.symm w'), fun z hz ↦ ?_⟩ + rw [Walk.support_cons, Walk.support_cons, List.mem_cons, List.mem_cons] at hz + have hxin : u' ∈ (Walk.cons hadj rest).support := + List.mem_cons_of_mem _ (Walk.start_mem_support _) + rcases hz with rfl | rfl | hz + · exact Or.inl (Walk.start_mem_support _) + · exact Or.inr ⟨rfl, hxin⟩ + · rcases hw' z hz with hz' | ⟨rfl, _⟩ + · exact Or.inl (List.mem_cons_of_mem _ hz') + · exact Or.inr ⟨rfl, hxin⟩ + +private lemma exists_liftStart {K : SimpleGraph V} {x y : V} (hxy : K.Adj x y) {A : Set V} + {u : V} (hu : u ∈ contractSet x y A) : + ∃ u₀ ∈ A, ∃ w : K.Walk u₀ u, ∀ z ∈ w.support, z = u ∨ (z = y ∧ u = x) := by + rcases hu.2 with huA | ⟨rfl, hyA⟩ + · refine ⟨u, huA, .nil, fun z hz ↦ ?_⟩ + simp only [Walk.support_nil, List.mem_cons, List.not_mem_nil, or_false] at hz + exact Or.inl hz + · refine ⟨y, hyA, hxy.symm.toWalk, fun z hz ↦ ?_⟩ + simp only [Adj.toWalk, Walk.support_cons, Walk.support_nil, List.mem_cons, + List.not_mem_nil, or_false] at hz + rcases hz with rfl | rfl + · exact Or.inr ⟨rfl, rfl⟩ + · exact Or.inl rfl + +private lemma exists_liftEnd {K : SimpleGraph V} {x y : V} (hxy : K.Adj x y) {B : Set V} + {v : V} (hv : v ∈ contractSet x y B) : + ∃ v₀ ∈ B, ∃ w : K.Walk v v₀, ∀ z ∈ w.support, z = v ∨ (z = y ∧ v = x) := by + rcases hv.2 with hvB | ⟨rfl, hyB⟩ + · refine ⟨v, hvB, .nil, fun z hz ↦ ?_⟩ + simp only [Walk.support_nil, List.mem_cons, List.not_mem_nil, or_false] at hz + exact Or.inl hz + · refine ⟨y, hyB, hxy.toWalk, fun z hz ↦ ?_⟩ + simp only [Adj.toWalk, Walk.support_cons, Walk.support_nil, List.mem_cons, + List.not_mem_nil, or_false] at hz + rcases hz with rfl | rfl + · exact Or.inl rfl + · exact Or.inr ⟨rfl, rfl⟩ + +private lemma hasDisjointPaths_of_contractEdge {K : SimpleGraph V} {x y : V} (hxy : K.Adj x y) + {A B : Set V} {k : ℕ} + (h : HasDisjointPaths (contractEdge K x y) (contractSet x y A) (contractSet x y B) k) : + HasDisjointPaths K A B k := by + classical + obtain ⟨P, hP⟩ := h + have hlift : ∀ i : Fin k, ∃ Q : PathFromTo K A B, + ∀ z ∈ Q.walk.support, z ∈ (P i).walk.support ∨ (z = y ∧ x ∈ (P i).walk.support) := by + intro i + obtain ⟨u₀, hu₀, w₁, hw₁⟩ := exists_liftStart hxy (P i).first_mem + obtain ⟨w₂, hw₂⟩ := exists_liftWalk hxy (P i).walk + obtain ⟨v₀, hv₀, w₃, hw₃⟩ := exists_liftEnd hxy (P i).last_mem + let w := (w₁.append w₂).append w₃ + refine ⟨⟨u₀, v₀, w.bypass, w.bypass_isPath, hu₀, hv₀⟩, fun z hz ↦ ?_⟩ + have hzw := w.support_bypass_subset_support hz + rw [Walk.mem_support_append_iff, Walk.mem_support_append_iff] at hzw + rcases hzw with (hz₁ | hz₂) | hz₃ + · rcases hw₁ z hz₁ with rfl | ⟨rfl, hux⟩ + · exact Or.inl (Walk.start_mem_support _) + · exact Or.inr ⟨rfl, Eq.mp (congrArg (· ∈ (P i).walk.support) hux) (Walk.start_mem_support _)⟩ + · exact hw₂ z hz₂ + · rcases hw₃ z hz₃ with rfl | ⟨rfl, hvx⟩ + · exact Or.inl (Walk.end_mem_support _) + · exact Or.inr ⟨rfl, Eq.mp (congrArg (· ∈ (P i).walk.support) hvx) (Walk.end_mem_support _)⟩ + choose Q hQ using hlift + refine ⟨Q, fun i j hij ↦ Set.disjoint_left.mpr fun z hzi hzj ↦ ?_⟩ + have hyi : y ∉ (P i).walk.support := + not_mem_support_of_contractEdge (P i).walk (P i).first_mem.1 + have hyj : y ∉ (P j).walk.support := + not_mem_support_of_contractEdge (P j).walk (P j).first_mem.1 + rcases hQ i z hzi with hzi' | ⟨rfl, hxi⟩ <;> rcases hQ j z hzj with hzj' | ⟨hzy, hxj⟩ + · exact Set.disjoint_left.mp (hP hij) hzi' hzj' + · exact hyi (hzy ▸ hzi') + · exact hyj hzj' + · exact Set.disjoint_left.mp (hP hij) hxi hxj + +private lemma exists_contractWalk {K : SimpleGraph V} {x y : V} (hxy : K.Adj x y) + [DecidableEq V] {u v : V} (w : K.Walk u v) : + let f : V → V := fun z ↦ if z = y then x else z + ∃ w' : (contractEdge K x y).Walk (f u) (f v), + ∀ z' ∈ w'.support, ∃ z ∈ w.support, f z = z' := by + intro f + induction w with + | nil => + refine ⟨.nil, fun z' hz' ↦ ?_⟩ + simp only [Walk.support_nil, List.mem_cons, List.not_mem_nil, or_false] at hz' + exact ⟨_, Walk.start_mem_support _, hz'.symm⟩ + | @cons u u' v hadj rest ih => + obtain ⟨w', hw'⟩ := ih + by_cases hfu : f u = f u' + · refine ⟨w'.copy hfu.symm rfl, fun z' hz' ↦ ?_⟩ + rw [Walk.support_copy] at hz' + obtain ⟨z, hz, rfl⟩ := hw' z' hz' + exact ⟨z, List.mem_cons_of_mem _ hz, rfl⟩ + · have hadj' : (contractEdge K x y).Adj (f u) (f u') := by + refine ⟨hfu, ?_, ?_, ?_⟩ + · dsimp [f]; split_ifs with h <;> [exact hxy.ne; exact h] + · dsimp [f]; split_ifs with h <;> [exact hxy.ne; exact h] + · by_cases hu : u = y <;> by_cases hu' : u' = y + · exact False.elim (hfu (by simp [f, hu, hu'])) + · subst hu + exact Or.inr (Or.inl ⟨by simp [f], by simpa [f, hu'] using hadj⟩) + · subst hu' + exact Or.inr (Or.inr ⟨by simp [f], by simpa [f, hu] using hadj⟩) + · exact Or.inl (by simpa [f, hu, hu'] using hadj) + refine ⟨.cons hadj' w', fun z' hz' ↦ ?_⟩ + rw [Walk.support_cons, List.mem_cons] at hz' + rcases hz' with rfl | hz' + · exact ⟨u, Walk.start_mem_support _, rfl⟩ + · obtain ⟨z, hz, rfl⟩ := hw' z' hz' + exact ⟨z, List.mem_cons_of_mem _ hz, rfl⟩ + +private lemma exists_separator_of_not_contractEdge [Finite V] {K : SimpleGraph V} {x y : V} + (hxy : K.Adj x y) {A B : Set V} {k : ℕ} + (h : ∀ S : Set V, IsSeparator K A B S → k ≤ S.ncard) + (hnot : ¬ ∀ S' : Set V, + IsSeparator (contractEdge K x y) (contractSet x y A) (contractSet x y B) S' → k ≤ S'.ncard) : + ∃ S : Set V, x ∈ S ∧ y ∈ S ∧ IsSeparator K A B S ∧ S.ncard = k := by + classical + push Not at hnot + obtain ⟨S₀, hS₀_sep, hS₀_lt⟩ := hnot + let S' : Set V := S₀ \ {y} + have hS'_sep : IsSeparator (contractEdge K x y) (contractSet x y A) (contractSet x y B) S' := by + intro P + obtain ⟨z, hz, hzS₀⟩ := hS₀_sep P + have hzy : z ≠ y := fun h ↦ + not_mem_support_of_contractEdge P.walk P.first_mem.1 (h ▸ hz) + exact ⟨z, hz, hzS₀, hzy⟩ + have hS'_lt : S'.ncard < k := + lt_of_le_of_lt (Set.ncard_le_ncard Set.sdiff_subset (Set.toFinite _)) hS₀_lt + let f : V → V := fun z ↦ if z = y then x else z + have hf_mem : ∀ P : PathFromTo K A B, ∃ z ∈ P.walk.support, f z ∈ S' := by + intro P + have hu : f P.first ∈ contractSet x y A := by + refine ⟨?_, ?_⟩ + · dsimp [f]; split_ifs with h <;> [exact hxy.ne; exact h] + · dsimp [f] + split_ifs with h + · subst h; exact Or.inr ⟨rfl, P.first_mem⟩ + · exact Or.inl P.first_mem + have hv : f P.last ∈ contractSet x y B := by + refine ⟨?_, ?_⟩ + · dsimp [f]; split_ifs with h <;> [exact hxy.ne; exact h] + · dsimp [f] + split_ifs with h + · subst h; exact Or.inr ⟨rfl, P.last_mem⟩ + · exact Or.inl P.last_mem + obtain ⟨w', hw'⟩ := exists_contractWalk hxy P.walk + obtain ⟨z', hz', hz'S'⟩ := hS'_sep.exists_mem_support_of_walk hu hv w' + obtain ⟨z, hz, rfl⟩ := hw' z' hz' + exact ⟨z, hz, hz'S'⟩ + have hxS' : x ∈ S' := by + by_contra hx + have hsep' : IsSeparator K A B S' := by + intro P + obtain ⟨z, hz, hfz⟩ := hf_mem P + have hzy : z ≠ y := by + intro hzy + have : f z = x := by simp [f, hzy] + exact hx (this ▸ hfz) + have : f z = z := by simp [f, hzy] + exact ⟨z, hz, this ▸ hfz⟩ + have := h S' hsep' + omega + let S : Set V := insert y S' + have hS_sep : IsSeparator K A B S := by + intro P + obtain ⟨z, hz, hfz⟩ := hf_mem P + by_cases hzy : z = y + · exact ⟨z, hz, Or.inl hzy⟩ + · have : f z = z := by simp [f, hzy] + exact ⟨z, hz, Or.inr (this ▸ hfz)⟩ + have hkS : k ≤ S.ncard := h S hS_sep + have hSy : y ∉ S' := fun hy ↦ hy.2 rfl + have hS_card_eq : S.ncard = S'.ncard + 1 := Set.ncard_insert_of_notMem hSy (Set.toFinite _) + exact ⟨S, Or.inr hxS', Or.inl rfl, hS_sep, by omega⟩ + +private lemma exists_prefix_walk {K : SimpleGraph V} {S : Set V} {u v : V} + (w : K.Walk u v) (hw : ∃ z ∈ w.support, z ∈ S) : + ∃ z ∈ S, ∃ q : K.Walk u z, + (∀ a ∈ q.support, a ∈ w.support) ∧ (∀ a ∈ q.support, a ∈ S → a = z) := by + induction w with + | nil => + obtain ⟨z, hz, hzS⟩ := hw + simp only [Walk.support_nil, List.mem_cons, List.not_mem_nil, or_false] at hz + subst hz + refine ⟨z, hzS, .nil, fun a ha ↦ ha, fun a ha _ ↦ ?_⟩ + simpa [Walk.support_nil] using ha + | @cons u u' v hadj rest ih => + by_cases huS : u ∈ S + · refine ⟨u, huS, .nil, fun a ha ↦ ?_, fun a ha _ ↦ ?_⟩ + · simp only [Walk.support_nil, List.mem_cons, List.not_mem_nil, or_false] at ha + subst ha + exact Walk.start_mem_support _ + · simpa [Walk.support_nil] using ha + · have hrest : ∃ z ∈ rest.support, z ∈ S := by + obtain ⟨z, hz, hzS⟩ := hw + rw [Walk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · exact absurd hzS huS + · exact ⟨z, hz, hzS⟩ + obtain ⟨z, hzS, q, hq_sub, hq_only⟩ := ih hrest + refine ⟨z, hzS, .cons hadj q, ?_, ?_⟩ + · intro a ha + rw [Walk.support_cons, List.mem_cons] at ha ⊢ + exact ha.imp_right (hq_sub a) + · intro a ha haS + rw [Walk.support_cons, List.mem_cons] at ha + rcases ha with rfl | ha + · exact absurd haS huS + · exact hq_only a ha haS + +private lemma not_mem_edges_of_only_end_in_S {K : SimpleGraph V} {S : Set V} {x y : V} + (hxy : K.Adj x y) (hxS : x ∈ S) (hyS : y ∈ S) {u z : V} (q : K.Walk u z) + (hq : ∀ a ∈ q.support, a ∈ S → a = z) : s(x, y) ∉ q.edges := by + intro he + have hx_mem : x ∈ q.support := q.fst_mem_support_of_mem_edges he + have hy_mem : y ∈ q.support := q.snd_mem_support_of_mem_edges he + have hxz : x = z := hq x hx_mem hxS + have hyz : y = z := hq y hy_mem hyS + exact hxy.ne (hxz.trans hyz.symm) + +private lemma isSeparator_of_deleteEdges_left {K : SimpleGraph V} {x y : V} (hxy : K.Adj x y) + {A B S T : Set V} (hxS : x ∈ S) (hyS : y ∈ S) (hS : IsSeparator K A B S) + (hT : IsSeparator (K.deleteEdges {s(x, y)}) A S T) : IsSeparator K A B T := by + intro P + obtain ⟨z, hzS, q, hq_sub, hq_only⟩ := exists_prefix_walk P.walk (hS P) + have hne : s(x, y) ∉ q.edges := not_mem_edges_of_only_end_in_S hxy hxS hyS q hq_only + let q' := q.toDeleteEdge s(x, y) hne + obtain ⟨t, ht, htT⟩ := hT.exists_mem_support_of_walk P.first_mem hzS q' + rw [Walk.support_transfer] at ht + exact ⟨t, hq_sub t ht, htT⟩ + +private lemma isSeparator_of_deleteEdges_right {K : SimpleGraph V} {x y : V} (hxy : K.Adj x y) + {A B S T : Set V} (hxS : x ∈ S) (hyS : y ∈ S) (hS : IsSeparator K A B S) + (hT : IsSeparator (K.deleteEdges {s(x, y)}) S B T) : IsSeparator K A B T := by + intro P + have hrev_S : ∃ z ∈ P.walk.reverse.support, z ∈ S := by + obtain ⟨z, hz, hzS⟩ := hS P + exact ⟨z, Walk.support_reverse P.walk ▸ List.mem_reverse.mpr hz, hzS⟩ + obtain ⟨z, hzS, q, hq_sub, hq_only⟩ := exists_prefix_walk P.walk.reverse hrev_S + have hne : s(x, y) ∉ q.reverse.edges := by + rw [Walk.edges_reverse, List.mem_reverse] + exact not_mem_edges_of_only_end_in_S hxy hxS hyS q hq_only + let q' := q.reverse.toDeleteEdge s(x, y) hne + obtain ⟨t, ht, htT⟩ := hT.exists_mem_support_of_walk hzS P.last_mem q' + rw [Walk.support_transfer, Walk.support_reverse, List.mem_reverse] at ht + have ht_rev := hq_sub t ht + rw [Walk.support_reverse, List.mem_reverse] at ht_rev + exact ⟨t, ht_rev, htT⟩ + +private lemma hasDisjointPaths_trans_of_separator [Finite V] {K : SimpleGraph V} + {A B S : Set V} {k : ℕ} (hS_sep : IsSeparator K A B S) (hS_card : S.ncard = k) + (hAS : HasDisjointPaths K A S k) (hSB : HasDisjointPaths K S B k) : + HasDisjointPaths K A B k := by + classical + obtain ⟨P, hP⟩ := hAS + obtain ⟨Q₀, hQ₀⟩ := hSB + have hcard_S : Nat.card ↥S = k := by rw [Nat.card_coe_set_eq, hS_card] + let p : Fin k → ↥S := fun i ↦ ⟨(P i).last, (P i).last_mem⟩ + have hp_inj : Function.Injective p := by + intro i j hij + by_contra hne + have hlast : (P i).last = (P j).last := congrArg Subtype.val hij + have h1 : (P i).last ∈ (P i).walk.support := Walk.end_mem_support _ + have h2 : (P i).last ∈ (P j).walk.support := by + rw [hlast] + exact Walk.end_mem_support _ + exact Set.disjoint_left.mp (hP hne) h1 h2 + have hp_bij : Function.Bijective p := + (Nat.bijective_iff_injective_and_card p).mpr ⟨hp_inj, by rw [Nat.card_fin, hcard_S]⟩ + let q₀ : Fin k → ↥S := fun j ↦ ⟨(Q₀ j).first, (Q₀ j).first_mem⟩ + have hq₀_inj : Function.Injective q₀ := by + intro i j hij + by_contra hne + have hfirst : (Q₀ i).first = (Q₀ j).first := congrArg Subtype.val hij + have h1 : (Q₀ i).first ∈ (Q₀ i).walk.support := Walk.start_mem_support _ + have h2 : (Q₀ i).first ∈ (Q₀ j).walk.support := by + rw [hfirst] + exact Walk.start_mem_support _ + exact Set.disjoint_left.mp (hQ₀ hne) h1 h2 + have hq₀_bij : Function.Bijective q₀ := + (Nat.bijective_iff_injective_and_card q₀).mpr ⟨hq₀_inj, by rw [Nat.card_fin, hcard_S]⟩ + let σ : Fin k ≃ Fin k := (Equiv.ofBijective p hp_bij).trans (Equiv.ofBijective q₀ hq₀_bij).symm + let Q : Fin k → PathFromTo K S B := fun i ↦ Q₀ (σ i) + have hQ : Pairwise fun i j ↦ + Disjoint {x | x ∈ (Q i).walk.support} {x | x ∈ (Q j).walk.support} := + fun i j hij ↦ hQ₀ (σ.injective.ne hij) + have hPQ_eq : ∀ i : Fin k, (Q i).first = (P i).last := by + intro i + have h1 : q₀ (σ i) = p i := + (Equiv.ofBijective q₀ hq₀_bij).apply_symm_apply (p i) + exact congrArg Subtype.val h1 + have hP_only : ∀ (i : Fin k) {z : V}, z ∈ (P i).walk.support → z ∈ S → z = (P i).last := by + intro i z hz hzS + obtain ⟨j, hj⟩ := hp_bij.surjective ⟨z, hzS⟩ + have hzj : z = (P j).last := (congrArg Subtype.val hj).symm + have h_eq : i = j := by + by_contra hne + have h2 : z ∈ (P j).walk.support := by + rw [hzj] + exact Walk.end_mem_support _ + exact Set.disjoint_left.mp (hP hne) hz h2 + subst h_eq + exact hzj + have hQ_only : ∀ (i : Fin k) {z : V}, z ∈ (Q i).walk.support → z ∈ S → z = (P i).last := by + intro i z hz hzS + obtain ⟨j, hj⟩ := hp_bij.surjective ⟨z, hzS⟩ + have hzj : z = (P j).last := (congrArg Subtype.val hj).symm + have h_eq : i = j := by + by_contra hne + have h2 : z ∈ (Q j).walk.support := by + rw [hzj, ← hPQ_eq j] + exact Walk.start_mem_support _ + exact Set.disjoint_left.mp (hQ hne) hz h2 + subst h_eq + exact hzj + have h_inter_in_S : ∀ (i j : Fin k) {z : V}, + z ∈ (P i).walk.support → z ∈ (Q j).walk.support → z ∈ S := by + intro i j z hzP hzQ + by_contra hzS + have hneP : (P i).last ≠ z := fun h ↦ hzS (h ▸ (P i).last_mem) + have hneQ : (Q j).first ≠ z := fun h ↦ hzS (h ▸ (Q j).first_mem) + have hzQ_rev : z ∈ (Q j).walk.reverse.support := + Walk.support_reverse (Q j).walk ▸ List.mem_reverse.mpr hzQ + let w₁ := (P i).walk.takeUntil z hzP + let w₂ := ((Q j).walk.reverse.takeUntil z hzQ_rev).reverse + have hw₁_not : (P i).last ∉ w₁.support := + Walk.endpoint_notMem_support_takeUntil (P i).isPath hzP hneP + have hw₂_not : (Q j).first ∉ w₂.support := by + rw [Walk.support_reverse, List.mem_reverse] + exact Walk.endpoint_notMem_support_takeUntil (Q j).isPath.reverse hzQ_rev hneQ + obtain ⟨s, hs, hsS⟩ := + hS_sep.exists_mem_support_of_walk (P i).first_mem (Q j).last_mem (w₁.append w₂) + rw [Walk.mem_support_append_iff] at hs + rcases hs with hs₁ | hs₂ + · have hs_eq : s = (P i).last := + hP_only i (Walk.support_takeUntil_subset_support _ _ hs₁) hsS + exact hw₁_not (hs_eq ▸ hs₁) + · rw [Walk.support_reverse, List.mem_reverse] at hs₂ + have hs_in_Q : s ∈ (Q j).walk.support := by + have := Walk.support_takeUntil_subset_support _ _ hs₂ + rwa [Walk.support_reverse, List.mem_reverse] at this + have hs_eq : s = (Q j).first := (hQ_only j hs_in_Q hsS).trans (hPQ_eq j).symm + rw [Walk.support_reverse, List.mem_reverse] at hw₂_not + exact hw₂_not (hs_eq ▸ hs₂) + let R : Fin k → PathFromTo K A B := fun i ↦ + let w := (P i).walk.append ((Q i).walk.copy (hPQ_eq i) rfl) + ⟨(P i).first, (Q i).last, w.bypass, w.bypass_isPath, (P i).first_mem, (Q i).last_mem⟩ + refine ⟨R, fun i j hij ↦ Set.disjoint_left.mpr fun z hzi hzj ↦ ?_⟩ + have hzi' := Walk.support_bypass_subset_support _ hzi + have hzj' := Walk.support_bypass_subset_support _ hzj + rw [Walk.mem_support_append_iff, Walk.support_copy] at hzi' hzj' + rcases hzi' with hziP | hziQ <;> rcases hzj' with hzjP | hzjQ + · exact Set.disjoint_left.mp (hP hij) hziP hzjP + · have hzS := h_inter_in_S i j hziP hzjQ + have h1 := hP_only i hziP hzS + have h2 := hQ_only j hzjQ hzS + exact hp_inj.ne hij (Subtype.ext (h1.symm.trans h2)) + · have hzS := h_inter_in_S j i hzjP hziQ + have h1 := hQ_only i hziQ hzS + have h2 := hP_only j hzjP hzS + exact hp_inj.ne hij (Subtype.ext (h1.symm.trans h2)) + · exact Set.disjoint_left.mp (hQ hij) hziQ hzjQ + +private lemma hasDisjointPaths_mono {K K' : SimpleGraph V} (hle : K ≤ K') {A B : Set V} {k : ℕ} + (h : HasDisjointPaths K A B k) : HasDisjointPaths K' A B k := by + obtain ⟨P, hP⟩ := h + refine ⟨fun i ↦ ⟨(P i).first, (P i).last, (P i).walk.mapLe hle, (P i).isPath.mapLe _, + (P i).first_mem, (P i).last_mem⟩, fun i j hij ↦ ?_⟩ + simpa using hP hij + +private lemma exists_disjointPaths_aux [Finite V] : + ∀ (n : ℕ) (K : SimpleGraph V) (A B : Set V), K.edgeSet.ncard = n → + ∀ (k : ℕ), (∀ S : Set V, IsSeparator K A B S → k ≤ S.ncard) → + HasDisjointPaths K A B k := by + intro n + induction n using Nat.strong_induction_on with + | _ n ih => + intro K A B hn k h + rcases K.edgeSet.eq_empty_or_nonempty with hE | ⟨e, he⟩ + · exact hasDisjointPaths_of_edgeSet_eq_empty K A B hE k h + · induction e using Sym2.ind with + | _ x y => + have hxy : K.Adj x y := K.mem_edgeSet.mp he + let K_con := contractEdge K x y + let A' := contractSet x y A + let B' := contractSet x y B + by_cases hcon : ∀ S' : Set V, IsSeparator K_con A' B' S' → k ≤ S'.ncard + · have hlt : K_con.edgeSet.ncard < n := hn ▸ ncard_edgeSet_contractEdge_lt hxy + exact hasDisjointPaths_of_contractEdge hxy (ih _ hlt K_con A' B' rfl k hcon) + · obtain ⟨S, hxS, hyS, hS_sep, hS_card⟩ := + exists_separator_of_not_contractEdge hxy h hcon + let K_del := K.deleteEdges {s(x, y)} + have hdel_lt : K_del.edgeSet.ncard < n := by + have h1 : (K.edgeSet \ {s(x, y)}).ncard + 1 = K.edgeSet.ncard := + Set.ncard_sdiff_singleton_add_one he (Set.toFinite _) + rw [edgeSet_deleteEdges] + omega + have hAS_sep : ∀ T : Set V, IsSeparator K_del A S T → k ≤ T.ncard := + fun T hT ↦ h T (isSeparator_of_deleteEdges_left hxy hxS hyS hS_sep hT) + have hSB_sep : ∀ T : Set V, IsSeparator K_del S B T → k ≤ T.ncard := + fun T hT ↦ h T (isSeparator_of_deleteEdges_right hxy hxS hyS hS_sep hT) + have hAS : HasDisjointPaths K A S k := + hasDisjointPaths_mono (K.deleteEdges_le _) (ih _ hdel_lt K_del A S rfl k hAS_sep) + have hSB : HasDisjointPaths K S B k := + hasDisjointPaths_mono (K.deleteEdges_le _) (ih _ hdel_lt K_del S B rfl k hSB_sep) + exact hasDisjointPaths_trans_of_separator hS_sep hS_card hAS hSB + +/-- Menger's theorem for finite simple graphs: if every set of vertices meeting every path from +`A` to `B` has at least `k` vertices, there are `k` disjoint paths from `A` to `B`. -/ +theorem exists_disjointPaths {V : Type*} (K : SimpleGraph V) + (A B : Set V) (hfin : Finite V) (k : ℕ) (h : ∀ S : Set V, (∀ P : PathFromTo K A B, + ∃ x ∈ P.walk.support, x ∈ S) → k ≤ S.ncard) : HasDisjointPaths K A B k := + exists_disjointPaths_aux K.edgeSet.ncard K A B rfl k h + +end GraphMinor.Menger diff --git a/LeanPool/GraphMinor/Minor/Basic.lean b/LeanPool/GraphMinor/Minor/Basic.lean new file mode 100644 index 0000000000..a5c25dba1f --- /dev/null +++ b/LeanPool/GraphMinor/Minor/Basic.lean @@ -0,0 +1,775 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Minor.Model +import Mathlib.Data.Set.Basic + +/-! +# Models of minors and basic properties of the minor relation + +This file proves the equivalence between the definition of a minor in `GraphMinor/Statement.lean` +(`IsIsoMinor`, by contracting a set of edges of a subgraph) and the description by a model of a +minor in Graph Minors IV, Section 7, conditions (i)–(iv) (pages 242–243, `IsMinorModel` in +`GraphMinor/Minor/Model.lean`), together with the basic properties of `Iso` and `IsIsoMinor`. + +## Main results + +* `GraphMinor.isIsoMinor_of_isMinorModel`: `MinorModelStatement`, stating that a model of a minor + gives a minor. We build the subgraph `G'` of `G` with vertex set `⋃ v ∈ V(H), ηv v` and edge set + consisting of `ηe '' E(H)` together with the edges of the connected subgraphs of condition (iv), + contract the latter edges, show that the components of the contracted edges are the sets `ηv v`, + and construct the isomorphism with `H`. +* `GraphMinor.exists_isMinorModel_of_isIsoMinor` (and + `GraphMinor.exists_isMinorModel_of_isIsoMinor_of_nonempty_or_isEmpty`): conversely, a minor has a + model, provided that a function `β' → β` exists (for example when `[Nonempty β]` or `[IsEmpty + β']`; + without such an assumption `β' → β` is empty when `β` is empty and `β'` is nonempty). +* `GraphMinor.Iso.refl`, `GraphMinor.Iso.symm`, `GraphMinor.Iso.trans`: graph isomorphisms form an + equivalence relation. +* `GraphMinor.IsIsoMinor.refl`, `GraphMinor.IsIsoMinor.trans`: the minor relation is a quasi-order + (Graph Minors IV, Section 1, page 228; composition of models follows Graph Minors IV, (7.1), + page 244). +* `GraphMinor.Iso.isIsoMinor_left`, `GraphMinor.Iso.isIsoMinor_right`, + `GraphMinor.Iso.isIsoMinor_congr`: `IsIsoMinor` is invariant under isomorphism on both sides. +-/ + +namespace GraphMinor + +open Graph Set Relation + +variable {α β α' β' α'' β'' : Type*} + +/-- The vertex set of the component of `v` used by `contract`. -/ +public abbrev contractComponent (G : Graph α β) (C : Set β) (v : α) : Set α := + {w | ReflTransGen (fun x y ↦ ∃ e ∈ C, G.IsLink e x y) v w} + +local notation "comp" => contractComponent + +public theorem contract_isLink (G : Graph α β) (C : Set β) (e : β) (X Y : Set α) : + (contract G C).IsLink e X Y ↔ e ∉ C ∧ ∃ x y, G.IsLink e x y ∧ comp G C x = X ∧ + comp G C y = Y := by + simp only [contract, deleteEdges_isLink, map_isLink, Relation.Map] + exact and_comm + +public theorem vertexSet_contract (G : Graph α β) (C : Set β) : + V(contract G C) = comp G C '' V(G) := by + simp [contract] + +public theorem edgeSet_contract (G : Graph α β) (C : Set β) : + E(contract G C) = E(G) \ C := by + simp [contract] + +public lemma mem_vertexSet_contract {G : Graph α β} {C : Set β} {X : Set α} : + X ∈ V(contract G C) ↔ ∃ v ∈ V(G), comp G C v = X := by + simp [contract] + +public lemma mem_edgeSet_contract {G : Graph α β} {C : Set β} {e : β} : + e ∈ E(contract G C) ↔ e ∈ E(G) ∧ e ∉ C := by + simp [contract] + +section ModelToMinor + +variable {H : Graph α' β'} {G : Graph α β} {ηv : α' → Set α} {ηe : β' → β} + +private noncomputable def chosenK (h : IsMinorModel H G ηv ηe) (v : α') (hv : v ∈ V(H)) : + Graph α β := + (h.connected v hv).choose + +private lemma chosenK_le (h : IsMinorModel H G ηv ηe) {v : α'} (hv : v ∈ V(H)) : + chosenK h v hv ≤ G.deleteEdges (ηe '' E(H)) := + (h.connected v hv).choose_spec.1 + +private lemma chosenK_le_G (h : IsMinorModel H G ηv ηe) {v : α'} (hv : v ∈ V(H)) : + chosenK h v hv ≤ G := + (chosenK_le h hv).trans deleteEdges_le + +private lemma chosenK_vertexSet (h : IsMinorModel H G ηv ηe) {v : α'} (hv : v ∈ V(H)) : + V(chosenK h v hv) = ηv v := + (h.connected v hv).choose_spec.2.1 + +private lemma chosenK_connected (h : IsMinorModel H G ηv ηe) {v : α'} (hv : v ∈ V(H)) : + GraphConnected (chosenK h v hv) := + (h.connected v hv).choose_spec.2.2 + +/-- The edges within the chosen connected branch subgraphs of a minor model. -/ +public noncomputable def modelContractEdges (h : IsMinorModel H G ηv ηe) : Set β := + ⋃ (v : α') (hv : v ∈ V(H)), E(chosenK h v hv) + +/-- The subgraph retaining the branch subgraphs and the images of the modeled edges. -/ +public noncomputable def modelSubgraph (h : IsMinorModel H G ηv ηe) : Graph α β := + (G.induce (⋃ v ∈ V(H), ηv v)).restrict (ηe '' E(H) ∪ modelContractEdges h) + +/-- The subgraph realizing a minor model is a subgraph of the host graph. -/ +public lemma modelSubgraph_le (h : IsMinorModel H G ηv ηe) : modelSubgraph h ≤ G := + restrict_le.trans (G.induce_le (iUnion₂_subset h.vertex_subset)) + +private lemma vertexSet_modelSubgraph (h : IsMinorModel H G ηv ηe) : + V(modelSubgraph h) = ⋃ v ∈ V(H), ηv v := rfl + +private lemma chosenK_edge_ends_mem (h : IsMinorModel H G ηv ηe) {v : α'} (hv : v ∈ V(H)) + {e : β} {x y : α} (hl : (chosenK h v hv).IsLink e x y) : x ∈ ηv v ∧ y ∈ ηv v := by + rw [← chosenK_vertexSet h hv] + exact ⟨hl.left_mem, hl.right_mem⟩ + +/-- Every edge to be contracted occurs in the subgraph realizing the model. -/ +public lemma modelContractEdges_subset (h : IsMinorModel H G ηv ηe) : + modelContractEdges h ⊆ E(modelSubgraph h) := by + rintro e ⟨_, ⟨v, rfl⟩, _, ⟨hv, rfl⟩, he⟩ + obtain ⟨x, y, hl⟩ := exists_isLink_of_mem_edgeSet he + obtain ⟨hx, hy⟩ := chosenK_edge_ends_mem h hv hl + have hlG : G.IsLink e x y := hl.mono (chosenK_le_G h hv) + have hxU : x ∈ ⋃ v ∈ V(H), ηv v := mem_biUnion hv hx + have hyU : y ∈ ⋃ v ∈ V(H), ηv v := mem_biUnion hv hy + have heI : e ∈ E(G.induce (⋃ v ∈ V(H), ηv v)) := ⟨x, y, hlG, hxU, hyU⟩ + exact ⟨heI, Or.inr (mem_iUnion₂_of_mem hv he)⟩ + +private lemma image_edge_subset (h : IsMinorModel H G ηv ηe) : + ηe '' E(H) ⊆ E(modelSubgraph h) := by + rintro _ ⟨e, he, rfl⟩ + obtain ⟨u, w, huw⟩ := exists_isLink_of_mem_edgeSet he + obtain ⟨x, hx, hincx⟩ := (h.inc_iff u huw.left_mem e he).1 huw.inc_left + obtain ⟨y, hy⟩ := hincx + have hxU : x ∈ ⋃ v ∈ V(H), ηv v := mem_biUnion huw.left_mem hx + have hyU : y ∈ ⋃ v ∈ V(H), ηv v := by + by_cases hloop : H.IsLoopAt e u + · have hyu := (h.isLoopAt_iff u huw.left_mem e he).1 hloop y hy.inc_right + exact mem_biUnion huw.left_mem hyu + · have huw_ne : u ≠ w := fun h' ↦ hloop (h' ▸ huw) + obtain ⟨z, hz, hincz⟩ := (h.inc_iff w huw.right_mem e he).1 huw.inc_right + have hxz : x ≠ z := + (h.vertex_disjoint u huw.left_mem w huw.right_mem huw_ne).ne_of_mem hx hz + have hzy : z = y := hincz.eq_of_isLink_of_ne_left hy hxz.symm + exact mem_biUnion huw.right_mem (hzy ▸ hz) + exact ⟨⟨x, y, hy, hxU, hyU⟩, Or.inl (mem_image_of_mem ηe he)⟩ + +private lemma disjoint_image_modelContractEdges (h : IsMinorModel H G ηv ηe) : + Disjoint (ηe '' E(H)) (modelContractEdges h) := by + rw [disjoint_left] + rintro _ ⟨e, he, rfl⟩ ⟨_, ⟨v, rfl⟩, _, ⟨hv, rfl⟩, heK⟩ + have heD := (chosenK_le h hv).edgeSet_mono heK + exact heD.2 (mem_image_of_mem ηe he) + +private lemma edgeSet_contract_modelSubgraph (h : IsMinorModel H G ηv ηe) : + E(contract (modelSubgraph h) (modelContractEdges h)) = ηe '' E(H) := by + rw [edgeSet_contract] + apply Subset.antisymm + · rintro e ⟨⟨_, he | he⟩, heC⟩ + · exact he + · exact absurd he heC + · intro e he + exact ⟨image_edge_subset h he, + (disjoint_image_modelContractEdges h).notMem_of_mem_left he⟩ + +/-- The contraction component of a branch vertex is its branch set. -/ +public lemma comp_modelSubgraph_eq (h : IsMinorModel H G ηv ηe) {v : α'} (hv : v ∈ V(H)) + {x : α} (hx : x ∈ ηv v) : + comp (modelSubgraph h) (modelContractEdges h) x = ηv v := by + ext y + simp only [mem_ofPred_eq] + constructor + · intro hxy + induction hxy with + | refl => exact hx + | @tail a b _ hab ih => + obtain ⟨e, ⟨_, ⟨w, rfl⟩, _, ⟨hw, rfl⟩, heK⟩, hl⟩ := hab + have hlG : G.IsLink e a b := hl.mono (modelSubgraph_le h) + have hlK : (chosenK h w hw).IsLink e a b := + ((chosenK_le_G h hw).isLink_iff heK).2 hlG + obtain ⟨ha_w, hb_w⟩ := chosenK_edge_ends_mem h hw hlK + by_cases hvw : v = w + · exact hvw ▸ hb_w + · exact absurd ha_w ((h.vertex_disjoint v hv w hw hvw).notMem_of_mem_left ih) + · intro hy + have hconn := (chosenK_connected h hv).2 x (by rwa [chosenK_vertexSet h hv]) + y (by rwa [chosenK_vertexSet h hv]) + induction hconn with + | refl => exact .refl + | @tail a b _ hab ih => + obtain ⟨e, hlK⟩ := hab + have heC : e ∈ modelContractEdges h := mem_iUnion₂_of_mem hv hlK.edge_mem + have hlG : G.IsLink e a b := hlK.mono (chosenK_le_G h hv) + obtain ⟨ha, hb⟩ := chosenK_edge_ends_mem h hv hlK + have haU : a ∈ ⋃ u ∈ V(H), ηv u := mem_biUnion hv ha + have hbU : b ∈ ⋃ u ∈ V(H), ηv u := mem_biUnion hv hb + exact (ih ha).tail ⟨e, heC, Or.inr heC, hlG, haU, hbU⟩ + +private lemma vertexSet_contract_modelSubgraph (h : IsMinorModel H G ηv ηe) : + V(contract (modelSubgraph h) (modelContractEdges h)) = ηv '' V(H) := by + rw [vertexSet_contract, vertexSet_modelSubgraph] + ext X + simp only [mem_image, mem_iUnion] + constructor + · rintro ⟨x, ⟨v, hv, hx⟩, rfl⟩ + exact ⟨v, hv, (comp_modelSubgraph_eq h hv hx).symm⟩ + · rintro ⟨v, hv, rfl⟩ + obtain ⟨x, hx⟩ := h.vertex_nonempty v hv + exact ⟨x, ⟨v, hv, hx⟩, comp_modelSubgraph_eq h hv hx⟩ + +/-- The branch sets of distinct model vertices are distinct. -/ +public lemma modelVertexMap_injOn (h : IsMinorModel H G ηv ηe) : InjOn ηv V(H) := by + intro v₁ hv₁ v₂ hv₂ heq + by_contra hne + obtain ⟨x, hx⟩ := h.vertex_nonempty v₁ hv₁ + exact (h.vertex_disjoint v₁ hv₁ v₂ hv₂ hne).notMem_of_mem_left hx (heq ▸ hx) + +/-- The contraction of the realizing subgraph preserves and reflects links of modeled edges. -/ +public lemma contract_modelSubgraph_isLink_iff (h : IsMinorModel H G ηv ηe) + {e : β'} (he : e ∈ E(H)) {u w : α'} (hu : u ∈ V(H)) (hw : w ∈ V(H)) : + H.IsLink e u w ↔ + (contract (modelSubgraph h) (modelContractEdges h)).IsLink (ηe e) (ηv u) (ηv w) := by + rw [contract_isLink] + constructor + · intro hl + have heC : ηe e ∉ modelContractEdges h := + (disjoint_image_modelContractEdges h).notMem_of_mem_left (mem_image_of_mem ηe he) + refine ⟨heC, ?_⟩ + obtain ⟨x, hx, hincx⟩ := (h.inc_iff u hu e he).1 hl.inc_left + obtain ⟨y, hy⟩ := hincx + have hxU : x ∈ ⋃ v ∈ V(H), ηv v := mem_biUnion hu hx + by_cases hloop : H.IsLoopAt e u + · have huw : u = w := hloop.eq_of_inc hl.inc_right + subst huw + have hy_u : y ∈ ηv u := (h.isLoopAt_iff u hu e he).1 hloop y hy.inc_right + have hyU : y ∈ ⋃ v ∈ V(H), ηv v := mem_biUnion hu hy_u + have hlM : (modelSubgraph h).IsLink (ηe e) x y := + ⟨Or.inl (mem_image_of_mem ηe he), hy, hxU, hyU⟩ + exact ⟨x, y, hlM, comp_modelSubgraph_eq h hu hx, comp_modelSubgraph_eq h hu hy_u⟩ + · have huw_ne : u ≠ w := fun h' ↦ hloop (h' ▸ hl) + obtain ⟨z, hz, hincz⟩ := (h.inc_iff w hw e he).1 hl.inc_right + have hxz : x ≠ z := (h.vertex_disjoint u hu w hw huw_ne).ne_of_mem hx hz + have hzy : z = y := hincz.eq_of_isLink_of_ne_left hy hxz.symm + have hy_w : y ∈ ηv w := hzy ▸ hz + have hyU : y ∈ ⋃ v ∈ V(H), ηv v := mem_biUnion hw hy_w + have hlM : (modelSubgraph h).IsLink (ηe e) x y := + ⟨Or.inl (mem_image_of_mem ηe he), hy, hxU, hyU⟩ + exact ⟨x, y, hlM, comp_modelSubgraph_eq h hu hx, comp_modelSubgraph_eq h hw hy_w⟩ + · rintro ⟨_, x, y, hlM, hcx, hcy⟩ + have hlG : G.IsLink (ηe e) x y := hlM.mono (modelSubgraph_le h) + obtain ⟨v₁, hv₁, hx₁⟩ := mem_iUnion₂.1 hlM.left_mem + obtain ⟨v₂, hv₂, hy₂⟩ := mem_iUnion₂.1 hlM.right_mem + have hvu : v₁ = u := + modelVertexMap_injOn h hv₁ hu ((comp_modelSubgraph_eq h hv₁ hx₁).symm.trans hcx) + have hvw : v₂ = w := + modelVertexMap_injOn h hv₂ hw ((comp_modelSubgraph_eq h hv₂ hy₂).symm.trans hcy) + have hx_u : x ∈ ηv u := hvu ▸ hx₁ + have hy_w : y ∈ ηv w := hvw ▸ hy₂ + have hinc_u : H.Inc e u := (h.inc_iff u hu e he).2 ⟨x, hx_u, hlG.inc_left⟩ + have hinc_w : H.Inc e w := (h.inc_iff w hw e he).2 ⟨y, hy_w, hlG.inc_right⟩ + rw [isLink_iff_inc] + refine ⟨hinc_u, hinc_w, fun z hz ↦ ?_⟩ + obtain ⟨a, ha_z, hinc_a⟩ := (h.inc_iff z hz.vertex_mem e he).1 hz + obtain rfl | rfl := hinc_a.eq_or_eq_of_isLink hlG + · left + by_contra hzu + exact (h.vertex_disjoint z hz.vertex_mem u hu hzu).notMem_of_mem_left ha_z hx_u + · right + by_contra hzw + exact (h.vertex_disjoint z hz.vertex_mem w hw hzw).notMem_of_mem_left ha_z hy_w + +@[expose] public section + +/-- The isomorphism from a minor model to the contraction of its realizing subgraph. Its vertex +and edge equivalences act by the model's maps. -/ +noncomputable def modelContractionIso (h : IsMinorModel H G ηv ηe) : + Iso H (contract (modelSubgraph h) (modelContractEdges h)) := + { vertexEquiv := + (Equiv.Set.imageOfInjOn ηv V(H) (modelVertexMap_injOn h)).trans + (Equiv.subtypeEquivRight fun _ ↦ by rw [vertexSet_contract_modelSubgraph]) + edgeEquiv := + (Equiv.Set.imageOfInjOn ηe E(H) h.edge_injOn).trans + (Equiv.subtypeEquivRight fun _ ↦ by rw [edgeSet_contract_modelSubgraph]) + isLink_iff := fun ⟨e, he⟩ ⟨u, hu⟩ ⟨w, hw⟩ ↦ + contract_modelSubgraph_isLink_iff h he hu hw } + +end + +/-- Realise a minor model by contraction, retaining both of its maps. -/ +public theorem exists_contraction_realizing_model + {H : Graph α' β'} {G : Graph α β} {ηv : α' → Set α} {ηe : β' → β} + (h : IsMinorModel H G ηv ηe) : + ∃ (G' : Graph α β) (_ : G' ≤ G) (C : Set β) (_ : C ⊆ E(G')) + (φ : Iso H (contract G' C)), + (∀ v : V(H), (φ.vertexEquiv v).val = ηv v.val) ∧ + (∀ e : E(H), (φ.edgeEquiv e).val = ηe e.val) := + ⟨modelSubgraph h, modelSubgraph_le h, modelContractEdges h, modelContractEdges_subset h, + modelContractionIso h, fun _ ↦ rfl, fun _ ↦ rfl⟩ + +private theorem isIsoMinor_of_isMinorModel_uncond {H : Graph α' β'} {G : Graph α β} + {ηv : α' → Set α} {ηe : β' → β} (h : IsMinorModel H G ηv ηe) : IsIsoMinor H G := + ⟨modelSubgraph h, modelSubgraph_le h, modelContractEdges h, modelContractEdges_subset h, + ⟨modelContractionIso h⟩⟩ + +end ModelToMinor + +section MinorToModel + +private lemma comp_self (G : Graph α β) (C : Set β) (v : α) : v ∈ comp G C v := + ReflTransGen.refl + +private lemma comp_subset_vertexSet (G : Graph α β) (C : Set β) {v : α} (hv : v ∈ V(G)) : + comp G C v ⊆ V(G) := by + intro w hw + induction hw with + | refl => exact hv + | tail _ hst _ => + obtain ⟨_, _, hl⟩ := hst + exact hl.right_mem + +private lemma comp_eq_of_mem (G : Graph α β) (C : Set β) {v w : α} (hw : w ∈ comp G C v) : + comp G C v = comp G C w := by + ext z + simp only [mem_ofPred_eq] + have hsymm : ∀ a b, ReflTransGen (fun x y ↦ ∃ e ∈ C, G.IsLink e x y) a b → + ReflTransGen (fun x y ↦ ∃ e ∈ C, G.IsLink e x y) b a := by + intro a b hab + induction hab with + | refl => exact .refl + | tail _ hst ih => + obtain ⟨e, he, hl⟩ := hst + exact ReflTransGen.head ⟨e, he, hl.symm⟩ ih + exact ⟨fun hvz ↦ (hsymm _ _ hw).trans hvz, fun hwz ↦ hw.trans hwz⟩ + +private lemma comp_connected (G' : Graph α β) (C : Set β) {X : Set α} + (hX : X ∈ V(contract G' C)) : + GraphConnected ((G'.restrict C).induce X) := by + rw [vertexSet_contract] at hX + obtain ⟨v₀, hv₀, rfl⟩ := hX + refine ⟨⟨v₀, comp_self G' C v₀⟩, fun x hx y hy ↦ ?_⟩ + have hvx : comp G' C v₀ = comp G' C x := comp_eq_of_mem G' C hx + have hxy : y ∈ comp G' C x := hvx ▸ hy + induction hxy with + | refl => exact .refl + | @tail a b hab hst ih => + have ha : a ∈ comp G' C v₀ := hvx.symm ▸ hab + have hb : b ∈ comp G' C v₀ := hvx.symm ▸ (hab.tail hst) + obtain ⟨e, heC, hl⟩ := hst + exact (ih ha).tail ⟨e, ⟨heC, hl⟩, ha, hb⟩ + +private theorem exists_isMinorModel_of_isIsoMinor_aux {H : Graph α' β'} {G : Graph α β} + (hβ : Nonempty β ∨ IsEmpty β') (h : IsIsoMinor H G) : + ∃ (ηv : α' → Set α) (ηe : β' → β), IsMinorModel H G ηv ηe := by + classical + obtain ⟨G', hle, C, _, ⟨φ⟩⟩ := h + let ηv : α' → Set α := fun v ↦ if hv : v ∈ V(H) then (φ.vertexEquiv ⟨v, hv⟩ : Set α) else ∅ + have hηe_ex : ∃ ηe : β' → β, ∀ e (he : e ∈ E(H)), ηe e = (φ.edgeEquiv ⟨e, he⟩ : β) := by + rcases hβ with hne | hEmpty + · obtain ⟨b₀⟩ := hne + exact ⟨fun e ↦ if he : e ∈ E(H) then (φ.edgeEquiv ⟨e, he⟩ : β) else b₀, + fun e he ↦ dite_eq_left he⟩ + · exact ⟨isEmptyElim, fun e ↦ hEmpty.elim e⟩ + obtain ⟨ηe, hηe⟩ := hηe_ex + have hηv : ∀ v (hv : v ∈ V(H)), ηv v = (φ.vertexEquiv ⟨v, hv⟩ : Set α) := + fun v hv ↦ dite_eq_left hv + have hηv_comp : ∀ v (hv : v ∈ V(H)), ∃ x ∈ V(G'), comp G' C x = ηv v := by + intro v hv + rw [hηv v hv] + exact mem_vertexSet_contract.1 (φ.vertexEquiv ⟨v, hv⟩).2 + have hηv_comp_of_mem : ∀ v (hv : v ∈ V(H)) {x : α}, x ∈ ηv v → comp G' C x = ηv v := by + intro v hv x hx + obtain ⟨a, _, hca⟩ := hηv_comp v hv + exact (comp_eq_of_mem G' C (hca.symm ▸ hx)).symm.trans hca + have hηe_mem : ∀ e (he : e ∈ E(H)), ηe e ∈ E(G') ∧ ηe e ∉ C := by + intro e he + rw [hηe e he] + exact mem_edgeSet_contract.1 (φ.edgeEquiv ⟨e, he⟩).2 + refine ⟨ηv, ηe, ?_⟩ + refine + { vertex_nonempty := fun v hv ↦ by + obtain ⟨x, _, hcx⟩ := hηv_comp v hv + exact ⟨x, hcx ▸ comp_self G' C x⟩ + vertex_subset := fun v hv ↦ by + obtain ⟨x, hx, hcx⟩ := hηv_comp v hv + exact hcx ▸ (comp_subset_vertexSet G' C hx).trans hle.vertexSet_mono + edge_mem := fun e he ↦ hle.edgeSet_mono (hηe_mem e he).1 + vertex_disjoint := fun v₁ hv₁ v₂ hv₂ hne ↦ by + rw [disjoint_left] + intro x hx₁ hx₂ + have heq : (φ.vertexEquiv ⟨v₁, hv₁⟩ : Set α) = (φ.vertexEquiv ⟨v₂, hv₂⟩ : Set α) := by + rw [← hηv v₁ hv₁, ← hηv v₂ hv₂, ← hηv_comp_of_mem v₁ hv₁ hx₁, + ← hηv_comp_of_mem v₂ hv₂ hx₂] + have := φ.vertexEquiv.injective (Subtype.ext heq) + exact hne (Subtype.mk.inj this) + edge_injOn := fun e₁ he₁ e₂ he₂ heq ↦ by + rw [hηe e₁ he₁, hηe e₂ he₂] at heq + have := φ.edgeEquiv.injective (Subtype.ext heq) + exact Subtype.mk.inj this + inc_iff := fun v hv e he ↦ by + constructor + · rintro ⟨w, hl⟩ + have hw : w ∈ V(H) := hl.right_mem + have hlc := (φ.isLink_iff ⟨e, he⟩ ⟨v, hv⟩ ⟨w, hw⟩).1 hl + rw [contract_isLink] at hlc + obtain ⟨_, x, y, hlG', hcx, _⟩ := hlc + rw [hηv v hv, hηe e he] + exact ⟨x, hcx ▸ comp_self G' C x, (hlG'.mono hle).inc_left⟩ + · rintro ⟨x, hx, y, hlG⟩ + have heG' := hηe_mem e he + have hlG' : G'.IsLink (ηe e) x y := (hle.isLink_iff heG'.1).2 hlG + have hcx : comp G' C x = (φ.vertexEquiv ⟨v, hv⟩ : Set α) := by + rw [← hηv v hv, hηv_comp_of_mem v hv hx] + have hcy_mem : comp G' C y ∈ V(contract G' C) := + mem_vertexSet_contract.2 ⟨y, hlG'.right_mem, rfl⟩ + obtain ⟨⟨w, hw⟩, hcw⟩ := φ.vertexEquiv.surjective ⟨comp G' C y, hcy_mem⟩ + have hcy : comp G' C y = (φ.vertexEquiv ⟨w, hw⟩ : Set α) := + (congrArg Subtype.val hcw).symm + have hlc : (contract G' C).IsLink (φ.edgeEquiv ⟨e, he⟩) + (φ.vertexEquiv ⟨v, hv⟩) (φ.vertexEquiv ⟨w, hw⟩) := by + rw [contract_isLink, ← hηe e he] + exact ⟨heG'.2, x, y, hlG', hcx, hcy⟩ + exact ⟨w, (φ.isLink_iff ⟨e, he⟩ ⟨v, hv⟩ ⟨w, hw⟩).2 hlc⟩ + isLoopAt_iff := fun v hv e he ↦ by + constructor + · intro hloop x hinc + have hlc := (φ.isLink_iff ⟨e, he⟩ ⟨v, hv⟩ ⟨v, hv⟩).1 hloop + rw [contract_isLink] at hlc + obtain ⟨_, a, b, hlG', hca, hcb⟩ := hlc + have hlG : G.IsLink (ηe e) a b := by + rw [hηe e he] + exact hlG'.mono hle + rw [hηv v hv] + obtain rfl | rfl := hinc.eq_or_eq_of_isLink hlG + · exact hca ▸ comp_self G' C x + · exact hcb ▸ comp_self G' C x + · intro hall + have heG' := hηe_mem e he + obtain ⟨a, b, hlG'⟩ := exists_isLink_of_mem_edgeSet heG'.1 + have hlG : G.IsLink (ηe e) a b := hlG'.mono hle + have ha_v : a ∈ ηv v := hall a hlG.inc_left + have hb_v : b ∈ ηv v := hall b hlG.inc_right + have hca : comp G' C a = (φ.vertexEquiv ⟨v, hv⟩ : Set α) := by + rw [← hηv v hv, hηv_comp_of_mem v hv ha_v] + have hcb : comp G' C b = (φ.vertexEquiv ⟨v, hv⟩ : Set α) := by + rw [← hηv v hv, hηv_comp_of_mem v hv hb_v] + have hlc : (contract G' C).IsLink (φ.edgeEquiv ⟨e, he⟩) + (φ.vertexEquiv ⟨v, hv⟩) (φ.vertexEquiv ⟨v, hv⟩) := by + rw [contract_isLink, ← hηe e he] + exact ⟨heG'.2, a, b, hlG', hca, hcb⟩ + exact (φ.isLink_iff ⟨e, he⟩ ⟨v, hv⟩ ⟨v, hv⟩).2 hlc + connected := fun v hv ↦ by + have hmem_v : ηv v ∈ V(contract G' C) := by + rw [hηv v hv] + exact (φ.vertexEquiv ⟨v, hv⟩).2 + refine ⟨(G'.restrict C).induce (ηv v), ?_, rfl, comp_connected G' C hmem_v⟩ + obtain ⟨x₀, hx₀, hcx₀⟩ := hηv_comp v hv + have hsub : ηv v ⊆ V(G'.restrict C) := hcx₀ ▸ comp_subset_vertexSet G' C hx₀ + refine (induce_le hsub).trans ?_ + refine ⟨hle.vertexSet_mono, fun e x y ⟨heC, hlG'⟩ ↦ ⟨hlG'.mono hle, ?_⟩⟩ + rintro ⟨e', he', heq⟩ + exact (hηe_mem e' he').2 (heq ▸ heC) } + +end MinorToModel + +section BasicProperties + +private theorem comp_empty (G : Graph α β) (v : α) : comp G ∅ v = {v} := by + ext w + simp only [mem_ofPred_eq, mem_singleton_iff] + constructor + · intro h + induction h with + | refl => rfl + | tail _ h _ => simp at h + · rintro rfl + exact .refl + +private lemma isIsoMinor_of_edgeSet_eq_empty {H : Graph α'' β''} {G : Graph α β} + {K : Graph α' β'} (hEK : E(K) = ∅) (hHK : IsIsoMinor H K) (hKG : IsIsoMinor K G) : + IsIsoMinor H G := by + obtain ⟨G₁, hle₁, C₁, hC₁_sub, ⟨φ₁⟩⟩ := hHK + obtain ⟨G₂, hle₂, C₂, _, ⟨φ₂⟩⟩ := hKG + have hE_G₁ : E(G₁) = ∅ := subset_empty_iff.1 (hEK ▸ hle₁.edgeSet_mono) + have hC₁ : C₁ = ∅ := subset_empty_iff.1 (hE_G₁ ▸ hC₁_sub) + have hE_H : E(H) = ∅ := by + rw [eq_empty_iff_forall_notMem] + intro e he + have hmem := mem_edgeSet_contract.1 (φ₁.edgeEquiv ⟨e, he⟩).2 + rw [hE_G₁] at hmem + exact hmem.1 + have hinj₁ : Function.Injective (comp G₁ ∅) := fun x y h ↦ by simpa [comp_empty] using h + have eV₁ : V(H) ≃ V(G₁) := + φ₁.vertexEquiv.trans + ((Equiv.subtypeEquivRight fun _ ↦ by rw [hC₁, vertexSet_contract]).trans + (Equiv.Set.image _ _ hinj₁).symm) + have hsub₁ : V(G₁) ⊆ V(K) := hle₁.vertexSet_mono + let emb₁ : V(H) → V(K) := Set.inclusion hsub₁ ∘ eV₁ + have hemb₁_inj : Function.Injective emb₁ := + (Set.inclusion_injective hsub₁).comp eV₁.injective + have hrep : ∀ x : V(K), ∃ w ∈ V(G₂), w ∈ (φ₂.vertexEquiv x : Set α) := by + intro x + obtain ⟨w, hw, hcw⟩ := mem_vertexSet_contract.1 (φ₂.vertexEquiv x).2 + exact ⟨w, hw, hcw ▸ comp_self G₂ C₂ w⟩ + choose rep hrep_mem hrep_in using hrep + have hrep_inj : Function.Injective rep := by + intro x y hxy + have hx := hrep_in x + have hy := hxy ▸ hrep_in y + obtain ⟨a₁, _, hc₁⟩ := mem_vertexSet_contract.1 (φ₂.vertexEquiv x).2 + obtain ⟨a₂, _, hc₂⟩ := mem_vertexSet_contract.1 (φ₂.vertexEquiv y).2 + have heq₁ : (φ₂.vertexEquiv x : Set α) = comp G₂ C₂ (rep x) := + hc₁.symm.trans (comp_eq_of_mem G₂ C₂ (hc₁.symm ▸ hx)) + have heq₂ : (φ₂.vertexEquiv y : Set α) = comp G₂ C₂ (rep x) := + hc₂.symm.trans (comp_eq_of_mem G₂ C₂ (hc₂.symm ▸ hy)) + exact φ₂.vertexEquiv.injective (Subtype.ext (heq₁.trans heq₂.symm)) + let f : V(H) → α := fun u ↦ rep (emb₁ u) + have hf_inj : Function.Injective f := hrep_inj.comp hemb₁_inj + let G' : Graph α β := Graph.noEdge (range f) β + have hG'_le : G' ≤ G := by + rw [noEdge_le_iff] + rintro _ ⟨u, rfl⟩ + exact hle₂.vertexSet_mono (hrep_mem (emb₁ u)) + refine ⟨G', hG'_le, ∅, empty_subset _, ⟨?_⟩⟩ + have hinj' : Function.Injective (comp G' ∅) := fun x y h ↦ by simpa [comp_empty] using h + have eV' : V(H) ≃ V(contract G' ∅) := + (Equiv.ofInjective f hf_inj).trans + ((Equiv.Set.image (comp G' ∅) (range f) hinj').trans + (Equiv.subtypeEquivRight fun _ ↦ by rw [vertexSet_contract, vertexSet_noEdge])) + have eE' : E(H) ≃ E(contract G' ∅) := + { toFun := fun ⟨e, he⟩ ↦ absurd he (by simp [hE_H]) + invFun := fun ⟨e, he⟩ ↦ absurd he (by simp [G', edgeSet_contract]) + left_inv := fun ⟨e, he⟩ ↦ absurd he (by simp [hE_H]) + right_inv := fun ⟨e, he⟩ ↦ absurd he (by simp [G', edgeSet_contract]) } + refine + { vertexEquiv := eV' + edgeEquiv := eE' + isLink_iff := fun ⟨e, he⟩ _ _ ↦ absurd he (by simp [hE_H]) } + +/-- Compose minor models by taking unions of branch sets and composing edge maps. -/ +public lemma isMinorModel_comp {H : Graph α'' β''} {K : Graph α' β'} {G : Graph α β} + {ηv : α'' → Set α'} {ηe : β'' → β'} {ηv' : α' → Set α} {ηe' : β' → β} + (h₁ : IsMinorModel H K ηv ηe) (h₂ : IsMinorModel K G ηv' ηe') : + IsMinorModel H G (fun v ↦ ⋃ v' ∈ ηv v, ηv' v') (ηe' ∘ ηe) where + vertex_nonempty v hv := by + obtain ⟨v', hv'⟩ := h₁.vertex_nonempty v hv + obtain ⟨x, hx⟩ := h₂.vertex_nonempty v' (h₁.vertex_subset v hv hv') + exact ⟨x, mem_biUnion hv' hx⟩ + vertex_subset v hv := by + rintro x ⟨_, ⟨v', rfl⟩, _, ⟨hv', rfl⟩, hx⟩ + exact h₂.vertex_subset v' (h₁.vertex_subset v hv hv') hx + edge_mem e he := h₂.edge_mem (ηe e) (h₁.edge_mem e he) + vertex_disjoint v₁ hv₁ v₂ hv₂ hne := by + rw [disjoint_left] + rintro x ⟨_, ⟨u₁, rfl⟩, _, ⟨hu₁, rfl⟩, hx₁⟩ ⟨_, ⟨u₂, rfl⟩, _, ⟨hu₂, rfl⟩, hx₂⟩ + have hu₁K := h₁.vertex_subset v₁ hv₁ hu₁ + have hu₂K := h₁.vertex_subset v₂ hv₂ hu₂ + have hu_eq : u₁ = u₂ := by + by_contra hne' + exact (h₂.vertex_disjoint u₁ hu₁K u₂ hu₂K hne').notMem_of_mem_left hx₁ hx₂ + exact (h₁.vertex_disjoint v₁ hv₁ v₂ hv₂ hne).notMem_of_mem_left hu₁ (hu_eq ▸ hu₂) + edge_injOn := h₂.edge_injOn.comp h₁.edge_injOn (mapsTo_iff_subset_preimage.2 h₁.edge_mem) + inc_iff v hv e he := by + rw [h₁.inc_iff v hv e he] + constructor + · rintro ⟨v', hv', hinc'⟩ + have hv'K := h₁.vertex_subset v hv hv' + obtain ⟨x, hx, hinc⟩ := (h₂.inc_iff v' hv'K (ηe e) (h₁.edge_mem e he)).1 hinc' + exact ⟨x, mem_biUnion hv' hx, hinc⟩ + · rintro ⟨x, ⟨_, ⟨v', rfl⟩, _, ⟨hv', rfl⟩, hx⟩, hinc⟩ + have hv'K := h₁.vertex_subset v hv hv' + exact ⟨v', hv', (h₂.inc_iff v' hv'K (ηe e) (h₁.edge_mem e he)).2 ⟨x, hx, hinc⟩⟩ + isLoopAt_iff v hv e he := by + rw [h₁.isLoopAt_iff v hv e he] + have heK := h₁.edge_mem e he + constructor + · intro hall x hinc + obtain ⟨a, b, hlK⟩ := exists_isLink_of_mem_edgeSet heK + have ha_v : a ∈ ηv v := hall a hlK.inc_left + have hb_v : b ∈ ηv v := hall b hlK.inc_right + by_cases hloop' : K.IsLoopAt (ηe e) a + · have hx_a := (h₂.isLoopAt_iff a hlK.left_mem (ηe e) heK).1 hloop' x hinc + exact mem_biUnion ha_v hx_a + · have hab_ne : a ≠ b := fun h' ↦ hloop' (h' ▸ hlK) + obtain ⟨x₁, hx₁, y₁, hlG₁⟩ := (h₂.inc_iff a hlK.left_mem (ηe e) heK).1 hlK.inc_left + obtain ⟨x₂, hx₂, hinc₂⟩ := (h₂.inc_iff b hlK.right_mem (ηe e) heK).1 hlK.inc_right + have hx₁x₂ : x₁ ≠ x₂ := + (h₂.vertex_disjoint a hlK.left_mem b hlK.right_mem hab_ne).ne_of_mem hx₁ hx₂ + have hx₂y₁ : x₂ = y₁ := hinc₂.eq_of_isLink_of_ne_left hlG₁ hx₁x₂.symm + obtain rfl | rfl := hinc.eq_or_eq_of_isLink hlG₁ + · exact mem_biUnion ha_v hx₁ + · exact mem_biUnion hb_v (hx₂y₁ ▸ hx₂) + · intro hall v' hinc' + have hv'K := hinc'.vertex_mem + obtain ⟨x, hx, hinc⟩ := (h₂.inc_iff v' hv'K (ηe e) heK).1 hinc' + obtain ⟨_, ⟨u, rfl⟩, _, ⟨hu, rfl⟩, hxu⟩ := hall x hinc + have huK := h₁.vertex_subset v hv hu + have huv' : u = v' := by + by_contra hne + exact (h₂.vertex_disjoint u huK v' hv'K hne).notMem_of_mem_left hxu hx + exact huv' ▸ hu + connected v hv := by + obtain ⟨K₁, hK₁_le, hK₁_V, hK₁_conn⟩ := h₁.connected v hv + let F₂ : Set β := (ηe' '' E(K₁)) ∪ + ⋃ (v' : α') (hv' : v' ∈ ηv v), E(chosenK h₂ v' (h₁.vertex_subset v hv hv')) + let K₂ : Graph α β := (G.induce (⋃ v' ∈ ηv v, ηv' v')).restrict F₂ + refine ⟨K₂, ?_, rfl, ?_⟩ + · refine ⟨?_, fun e x y ⟨heF₂, hlG, _, _⟩ ↦ ⟨hlG, ?_⟩⟩ + · rintro x ⟨_, ⟨v', rfl⟩, _, ⟨hv', rfl⟩, hx⟩ + exact h₂.vertex_subset v' (h₁.vertex_subset v hv hv') hx + · rintro ⟨e₀, he₀, rfl⟩ + rcases heF₂ with ⟨e₁, he₁, heq⟩ | ⟨_, ⟨v', rfl⟩, _, ⟨hv', rfl⟩, heK⟩ + · have he₁_mem : e₁ ∈ E(K) := (hK₁_le.trans deleteEdges_le).edgeSet_mono he₁ + have := h₂.edge_injOn he₁_mem (h₁.edge_mem e₀ he₀) heq + exact (hK₁_le.edgeSet_mono he₁).2 (this ▸ mem_image_of_mem ηe he₀) + · have heD := (chosenK_le h₂ (h₁.vertex_subset v hv hv')).edgeSet_mono heK + exact heD.2 (mem_image_of_mem ηe' (h₁.edge_mem e₀ he₀)) + · have hinner : ∀ {v' : α'} (hv' : v' ∈ ηv v) {x y : α}, + x ∈ ηv' v' → y ∈ ηv' v' → ReflTransGen K₂.Adj x y := by + intro v' hv' x y hx hy + have hv'K := h₁.vertex_subset v hv hv' + have hconn := (chosenK_connected h₂ hv'K).2 x (by rwa [chosenK_vertexSet h₂ hv'K]) + y (by rwa [chosenK_vertexSet h₂ hv'K]) + induction hconn with + | refl => exact .refl + | @tail a b _ hab ih => + obtain ⟨e, hlK⟩ := hab + have heF₂ : e ∈ F₂ := Or.inr (mem_iUnion₂_of_mem hv' hlK.edge_mem) + have hlG : G.IsLink e a b := hlK.mono (chosenK_le_G h₂ hv'K) + obtain ⟨ha, hb⟩ := chosenK_edge_ends_mem h₂ hv'K hlK + have haU : a ∈ ⋃ u ∈ ηv v, ηv' u := mem_biUnion hv' ha + have hbU : b ∈ ⋃ u ∈ ηv v, ηv' u := mem_biUnion hv' hb + exact (ih ha).tail ⟨e, heF₂, hlG, haU, hbU⟩ + obtain ⟨v₀', hv₀'⟩ := h₁.vertex_nonempty v hv + obtain ⟨x₀, hx₀⟩ := h₂.vertex_nonempty v₀' (h₁.vertex_subset v hv hv₀') + refine ⟨⟨x₀, mem_biUnion hv₀' hx₀⟩, ?_⟩ + rintro x ⟨_, ⟨u, rfl⟩, _, ⟨hu, rfl⟩, hxu⟩ y ⟨_, ⟨w, rfl⟩, _, ⟨hw, rfl⟩, hyw⟩ + have hwalk := hK₁_conn.2 u (hK₁_V.symm ▸ hu) w (hK₁_V.symm ▸ hw) + have hstep : ∀ {p q : α'}, ReflTransGen K₁.Adj p q → p ∈ ηv v → q ∈ ηv v → + ∀ {a b : α}, a ∈ ηv' p → b ∈ ηv' q → ReflTransGen K₂.Adj a b := by + intro p q hpq + induction hpq with + | refl => exact fun hp _ a b ha hb ↦ hinner hp ha hb + | @tail c d _ hcd ih => + intro hp hd a b ha hb + obtain ⟨e₁, hlK₁⟩ := hcd + have hc : c ∈ ηv v := hK₁_V ▸ hlK₁.left_mem + have hlK : K.IsLink e₁ c d := (hlK₁.mono hK₁_le).1 + obtain ⟨c', hc', hincc'⟩ := (h₂.inc_iff c (h₁.vertex_subset v hv hc) e₁ hlK.edge_mem).1 + hlK.inc_left + obtain ⟨d', hlG'⟩ := hincc' + have hd' : d' ∈ ηv' d := by + by_cases hloop : K.IsLoopAt e₁ c + · have hcd_eq : c = d := hloop.eq_of_inc hlK.inc_right + exact hcd_eq ▸ + (h₂.isLoopAt_iff c (h₁.vertex_subset v hv hc) e₁ hlK.edge_mem).1 hloop d' + hlG'.inc_right + · have hcd_ne : c ≠ d := fun h' ↦ hloop (h' ▸ hlK) + obtain ⟨z, hz, hincz⟩ := + (h₂.inc_iff d (h₁.vertex_subset v hv hd) e₁ hlK.edge_mem).1 hlK.inc_right + have hc'z : c' ≠ z := + (h₂.vertex_disjoint c (h₁.vertex_subset v hv hc) d + (h₁.vertex_subset v hv hd) hcd_ne).ne_of_mem hc' hz + have hzd' : z = d' := hincz.eq_of_isLink_of_ne_left hlG' hc'z.symm + exact hzd' ▸ hz + have heF₂ : ηe' e₁ ∈ F₂ := Or.inl (mem_image_of_mem ηe' hlK₁.edge_mem) + have hc'U : c' ∈ ⋃ u ∈ ηv v, ηv' u := mem_biUnion hc hc' + have hd'U : d' ∈ ⋃ u ∈ ηv v, ηv' u := mem_biUnion hd hd' + have hadj : K₂.Adj c' d' := ⟨ηe' e₁, heF₂, hlG', hc'U, hd'U⟩ + exact ((ih hp hc ha hc').tail hadj).trans (hinner hd hd' hb) + exact hstep hwalk hu hw hxu hyw + +end BasicProperties + +public section + +/-- A model of a minor gives a minor (Graph Minors IV, Section 7, pages 242–243). -/ +theorem isIsoMinor_of_isMinorModel : MinorModelStatement := + fun _ _ _ _ _ _ _ _ h ↦ isIsoMinor_of_isMinorModel_uncond h + +/-- A minor has a model when the ambient edge type of `G` is nonempty or the edge type of `H` is +empty (so that a function `β' → β` exists). -/ +theorem exists_isMinorModel_of_isIsoMinor_of_nonempty_or_isEmpty {α β α' β' : Type*} + {H : Graph α' β'} {G : Graph α β} + (hβ : Nonempty β ∨ IsEmpty β') (h : IsIsoMinor H G) : + ∃ (ηv : α' → Set α) (ηe : β' → β), IsMinorModel H G ηv ηe := + exists_isMinorModel_of_isIsoMinor_aux hβ h + +/-- A minor has a model (Graph Minors IV, Section 7, pages 242–243). -/ +theorem exists_isMinorModel_of_isIsoMinor {α β α' β' : Type*} [Nonempty β] + {H : Graph α' β'} {G : Graph α β} (h : IsIsoMinor H G) : + ∃ (ηv : α' → Set α) (ηe : β' → β), IsMinorModel H G ηv ηe := + exists_isMinorModel_of_isIsoMinor_of_nonempty_or_isEmpty (Or.inl ‹_›) h + +/-- The identity isomorphism of a graph. -/ +def Iso.refl (G : Graph α β) : Iso G G where + vertexEquiv := Equiv.refl _ + edgeEquiv := Equiv.refl _ + isLink_iff _ _ _ := Iff.rfl + +@[expose] public section + +/-- The inverse of a graph isomorphism. -/ +def Iso.symm {H : Graph α' β'} {G : Graph α β} (φ : Iso H G) : Iso G H where + vertexEquiv := φ.vertexEquiv.symm + edgeEquiv := φ.edgeEquiv.symm + isLink_iff e x y := by + have h := φ.isLink_iff (φ.edgeEquiv.symm e) (φ.vertexEquiv.symm x) (φ.vertexEquiv.symm y) + simp only [Equiv.apply_symm_apply] at h + exact h.symm + +end + +@[expose] public section + +/-- The composition of two graph isomorphisms. -/ +def Iso.trans {H : Graph α'' β''} {K : Graph α' β'} {G : Graph α β} + (φ : Iso H K) (ψ : Iso K G) : Iso H G where + vertexEquiv := φ.vertexEquiv.trans ψ.vertexEquiv + edgeEquiv := φ.edgeEquiv.trans ψ.edgeEquiv + isLink_iff e x y := (φ.isLink_iff e x y).trans (ψ.isLink_iff _ _ _) + +end + +/-- Every graph is isomorphic to a minor of itself (Graph Minors IV, Section 1, page 228). -/ +theorem IsIsoMinor.refl (G : Graph α β) : IsIsoMinor G G := by + refine ⟨G, le_rfl, ∅, empty_subset _, ⟨?_⟩⟩ + have hinj : Function.Injective (comp G ∅) := fun x y h ↦ by simpa [comp_empty] using h + refine + { vertexEquiv := + (Equiv.Set.image _ _ hinj).trans + (Equiv.subtypeEquivRight fun _ ↦ by rw [vertexSet_contract]) + edgeEquiv := Equiv.subtypeEquivRight fun _ ↦ by simp [contract] + isLink_iff := ?_ } + rintro ⟨e, he⟩ ⟨x, hx⟩ ⟨y, hy⟩ + simp [contract_isLink, comp_empty] + +/-- The minor relation is transitive (Graph Minors IV, Section 1, page 228, and (7.1), page 244). -/ +theorem IsIsoMinor.trans {H : Graph α'' β''} {K : Graph α' β'} {G : Graph α β} + (hHK : IsIsoMinor H K) (hKG : IsIsoMinor K G) : IsIsoMinor H G := by + by_cases hEK : E(K) = ∅ + · exact isIsoMinor_of_edgeSet_eq_empty hEK hHK hKG + · obtain ⟨eK, heK⟩ := nonempty_iff_ne_empty.2 hEK + have hβ' : Nonempty β' := ⟨eK⟩ + have hβ : Nonempty β := by + obtain ⟨G₂, _, C₂, _, ⟨φ₂⟩⟩ := hKG + exact ⟨(φ₂.edgeEquiv ⟨eK, heK⟩).1⟩ + obtain ⟨ηv, ηe, hm₁⟩ := exists_isMinorModel_of_isIsoMinor_aux (Or.inl hβ') hHK + obtain ⟨ηv', ηe', hm₂⟩ := exists_isMinorModel_of_isIsoMinor_aux (Or.inl hβ) hKG + exact isIsoMinor_of_isMinorModel_uncond (isMinorModel_comp hm₁ hm₂) + +/-- `IsIsoMinor` is invariant under isomorphism on the left. -/ +theorem Iso.isIsoMinor_left {H₁ : Graph α'' β''} {H₂ : Graph α' β'} {G : Graph α β} + (φ : Iso H₁ H₂) (h : IsIsoMinor H₂ G) : IsIsoMinor H₁ G := by + obtain ⟨G', hle, C, hC, ⟨ψ⟩⟩ := h + exact ⟨G', hle, C, hC, ⟨φ.trans ψ⟩⟩ + +/-- `IsIsoMinor` is invariant under isomorphism on the right. -/ +theorem Iso.isIsoMinor_right {H : Graph α'' β''} {G₁ : Graph α' β'} {G₂ : Graph α β} + (h : IsIsoMinor H G₁) (φ : Iso G₁ G₂) : IsIsoMinor H G₂ := + h.trans (φ.isIsoMinor_left (.refl G₂)) + +/-- `IsIsoMinor` is invariant under isomorphism on both sides. -/ +theorem Iso.isIsoMinor_congr {α₁ β₁ α₂ β₂ α₃ β₃ α₄ β₄ : Type*} + {H₁ : Graph α₁ β₁} {H₂ : Graph α₂ β₂} {G₁ : Graph α₃ β₃} {G₂ : Graph α₄ β₄} + (φH : Iso H₁ H₂) (φG : Iso G₁ G₂) : IsIsoMinor H₁ G₁ ↔ IsIsoMinor H₂ G₂ := + ⟨fun h ↦ (φH.symm.isIsoMinor_left h).trans (φG.isIsoMinor_left (.refl G₂)), + fun h ↦ (φH.isIsoMinor_left h).trans (φG.symm.isIsoMinor_left (.refl G₁))⟩ + +end + +end GraphMinor diff --git a/LeanPool/GraphMinor/Minor/CompleteGraph.lean b/LeanPool/GraphMinor/Minor/CompleteGraph.lean new file mode 100644 index 0000000000..0dbc58bc94 --- /dev/null +++ b/LeanPool/GraphMinor/Minor/CompleteGraph.lean @@ -0,0 +1,36 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + + +module + +public import Mathlib.Combinatorics.Graph.Basic + +/-! +# Complete graphs with unordered pairs as edges +-/ + +@[expose] public section + +namespace GraphMinor + +/-- The complete graph on `Fin n`, with distinct unordered pairs as edges. -/ +def completeGraph (n : ℕ) : Graph (Fin n) (Sym2 (Fin n)) where + vertexSet := Set.univ + edgeSet := {e : Sym2 (Fin n) | ∃ x y : Fin n, x ≠ y ∧ e = s(x, y)} + IsLink e x y := x ≠ y ∧ e = s(x, y) + isLink_symm _ _ := ⟨fun _ _ ⟨hne, he⟩ => ⟨hne.symm, he.trans Sym2.eq_swap⟩⟩ + eq_or_eq_of_isLink_of_isLink _ _ _ _ _ h1 h2 := by + have heq : s(_, _) = s(_, _) := h1.2.symm.trans h2.2 + rcases Sym2.eq_iff.mp heq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact Or.inl rfl + · exact Or.inr rfl + edge_mem_iff_exists_isLink _ := Iff.rfl + left_mem_of_isLink _ _ _ _ := Set.mem_univ _ + +end GraphMinor diff --git a/LeanPool/GraphMinor/Minor/Model.lean b/LeanPool/GraphMinor/Minor/Model.lean new file mode 100644 index 0000000000..a72f9d0e5c --- /dev/null +++ b/LeanPool/GraphMinor/Minor/Model.lean @@ -0,0 +1,98 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Statement +public import LeanPool.GraphMinor.Hypergraph.Basic + +/-! +# Models of minors, and graphs as hypergraphs + +Graph Minors IV, Section 7 (pages 242–243), describes when a graph `G` is isomorphic to a minor of +a graph `G'`: "each edge $e$ of $G$ is represented by an edge $\eta(e)$ of $G'$, and each vertex $v$ +of $G$ is “formed” by identifying under contraction a nonempty subset $\eta(v)$ of the vertex set of +$G'$. Moreover, there is a connected subgraph of $G'$ with vertex set $\eta(v)$ all edges of which +are +to be contracted in producing this minor. Thus, in summary: + +(i) $\eta$ is a function with domain $V(G) \cup E(G)$; for each $v \in V(G)$, $\eta(v)$ is a +non-empty subset +of $V(G')$ and for each $e \in E(G)$, $\eta(e) \in E(G')$ ... +(ii) $\eta(v_1) \cap \eta(v_2) = \emptyset$ for distinct $v_1, v_2 \in V(G)$, and $\eta(e_1) \neq +\eta(e_2)$ for distinct +$e_1, e_2 \in E(G)$ +(iii) for each $v \in V(G)$ and $e \in E(G)$, $e$ is incident with $v$ in $G$ if and only if +$\eta(v)$ +contains an end of $\eta(e)$ in $G'$, and $e$ is a loop of $G$ with end $v$ if and only if $\eta(v)$ +contains every end of $\eta(e)$ in $G'$ +(iv) for each $v \in V(G)$ there is a connected subgraph of $G' \setminus \eta(E(G))$ with vertex +set $\eta(v)$." + +`IsMinorModel H G ηv ηe` says that `ηv` (on vertices) and `ηe` (on edges) satisfy (i)–(iv), with +`H` in the role of the paper's `G` and `G` in the role of `G'`. `MinorModelStatement` says that a +model gives a minor; Graph Minors IV uses it to deduce (1.5) from (9.1), and Graph Minors XX uses +it for (10.5). + +`Hypergraph.ofGraph` views a finite graph (Mathlib's `Graph`) as a hypergraph whose edges have one +or two ends. +-/ + +@[expose] public section + +namespace GraphMinor + +open Graph + +variable {α β α' β' : Type*} + +/-- The graph `K` is connected: it has a vertex, and any two of its vertices are joined by a walk +of `K`. -/ +def GraphConnected (K : Graph α β) : Prop := + V(K).Nonempty ∧ ∀ x ∈ V(K), ∀ y ∈ V(K), Relation.ReflTransGen K.Adj x y + +/-- `ηv` and `ηe` form a model of `H` in `G`: conditions (i)–(iv) of Graph Minors IV, Section 7, +with `H` in the role of the paper's `G` and `G` in the role of `G'`. -/ +structure IsMinorModel (H : Graph α' β') (G : Graph α β) (ηv : α' → Set α) (ηe : β' → β) : + Prop where + /-- (i) -/ + vertex_nonempty : ∀ v ∈ V(H), (ηv v).Nonempty + /-- (i) -/ + vertex_subset : ∀ v ∈ V(H), ηv v ⊆ V(G) + /-- (i) -/ + edge_mem : ∀ e ∈ E(H), ηe e ∈ E(G) + /-- (ii) -/ + vertex_disjoint : ∀ v₁ ∈ V(H), ∀ v₂ ∈ V(H), v₁ ≠ v₂ → Disjoint (ηv v₁) (ηv v₂) + /-- (ii) -/ + edge_injOn : Set.InjOn ηe E(H) + /-- (iii), first part. -/ + inc_iff : ∀ v ∈ V(H), ∀ e ∈ E(H), H.Inc e v ↔ ∃ x ∈ ηv v, G.Inc (ηe e) x + /-- (iii), second part. -/ + isLoopAt_iff : ∀ v ∈ V(H), ∀ e ∈ E(H), H.IsLoopAt e v ↔ ∀ x, G.Inc (ηe e) x → x ∈ ηv v + /-- (iv) -/ + connected : ∀ v ∈ V(H), ∃ K ≤ G.deleteEdges (ηe '' E(H)), V(K) = ηv v ∧ GraphConnected K + +/-- A model of `H` in `G` makes `H` isomorphic to a minor of `G`, for finite graphs. -/ +def MinorModelStatement : Prop := + ∀ {α β α' β' : Type*} (H : Graph α' β') (G : Graph α β), V(H).Finite → E(H).Finite → + V(G).Finite → E(G).Finite → ∀ (ηv : α' → Set α) (ηe : β' → β), IsMinorModel H G ηv ηe → + IsIsoMinor H G + +/-- A finite graph as a hypergraph: the same vertices and edges, with `v` incident with `e` when +`v` is an end of `e`. -/ +def Hypergraph.ofGraph (G : Graph α β) (hV : V(G).Finite) (hE : E(G).Finite) : + Hypergraph α β where + vertexSet := V(G) + edgeSet := E(G) + Inc := G.Inc + vertex_mem_of_inc _ _ h := h.vertex_mem + edge_mem_of_inc _ _ h := h.edge_mem + vertexSet_finite := hV + edgeSet_finite := hE + +end GraphMinor diff --git a/LeanPool/GraphMinor/RST94/Basic.lean b/LeanPool/GraphMinor/RST94/Basic.lean new file mode 100644 index 0000000000..d31a5f4cb5 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Basic.lean @@ -0,0 +1,362 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Section8 +public import LeanPool.GraphMinor.GM10.Section12 +public import LeanPool.GraphMinor.GM10.TangleLemmas +public import LeanPool.GraphMinor.Menger.Basic + +/-! +# Subgraphs and separations for "Quickly excluding a planar graph" + +Robertson, Seymour and Thomas, *Quickly excluding a planar graph*, J. Combin. Theory Ser. B 62 +(1994), 323–348. +We work with a graph as a hypergraph `G` with `G.IsGraph`, since the tangles of Graph Minors X live +on hypergraphs. + +This file holds the tools for subgraphs that the paper uses without comment: `subOf` builds a +subgraph from its vertices +and edges, `IsSeparation.restrict` restricts a separation to a subgraph, and `addVerts` adds +vertices to a subgraph. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β : Type*} {G H A B C D : Hypergraph α β} + +/-- The subgraph of `G` with vertex set `V` and edge set `E`, when `E` consists of edges of `G` with +all ends in `V`. -/ +def subOf (G : Hypergraph α β) (V : Set α) (E : Set β) (hV : V ⊆ G.vertexSet) + (hE : ∀ e ∈ E, e ∈ G.edgeSet ∧ ∀ v, G.Inc e v → v ∈ V) : Hypergraph α β where + vertexSet := V + edgeSet := E + Inc e v := e ∈ E ∧ G.Inc e v + vertex_mem_of_inc _ _ h := (hE _ h.1).2 _ h.2 + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := G.vertexSet_finite.subset hV + edgeSet_finite := G.edgeSet_finite.subset fun e he => (hE e he).1 + +theorem subOf_le {V : Set α} {E : Set β} {hV : V ⊆ G.vertexSet} + {hE : ∀ e ∈ E, e ∈ G.edgeSet ∧ ∀ v, G.Inc e v → v ∈ V} : subOf G V E hV hE ≤ G := + ⟨hV, fun e he => (hE e he).1, fun e he => by + ext v + exact ⟨fun h => ⟨he, h⟩, fun h => h.2⟩⟩ + +/-- An edge of a subgraph has the same ends in the larger graph. -/ +theorem inc_le (h : H ≤ G) {e : β} (he : e ∈ H.edgeSet) {v : α} (hv : G.Inc e v) : H.Inc e v := + (inc_iff_of_le h he).2 hv + +theorem end_mem (h : H ≤ G) {e : β} (he : e ∈ H.edgeSet) {v : α} (hv : G.Inc e v) : v ∈ H.vertexSet + := + H.vertex_mem_of_inc (inc_le h he hv) + +/-- Two subgraphs of `G` are equal if they have the same vertices and edges. -/ +theorem sub_ext (h₁ : H ≤ G) (h₂ : A ≤ G) (hV : H.vertexSet = A.vertexSet) (hE : H.edgeSet + = A.edgeSet) : H = A := + eq_of_le_of_vertexSet_eq_of_edgeSet_eq h₁ h₂ hV hE + +theorem le_of_sets (h₁ : H ≤ G) (h₂ : A ≤ G) (hV : H.vertexSet ⊆ A.vertexSet) + (hE : H.edgeSet ⊆ A.edgeSet) : H ≤ A := + (le_iff_of_le h₁ h₂).2 ⟨hV, hE⟩ + +/-- A separation is a pair of subgraphs that together cover `G` and share no edge. -/ +theorem sep_of_sets (hA : A ≤ G) (hB : B ≤ G) (hV : ∀ v ∈ G.vertexSet, v ∈ A.vertexSet + ∨ v ∈ B.vertexSet) + (hE : ∀ e ∈ G.edgeSet, e ∈ A.edgeSet ∨ e ∈ B.edgeSet) (hd : ∀ e ∈ A.edgeSet, e ∉ B.edgeSet) : + G.IsSeparation A B := by + refine (isSeparation_iff_of_le hA hB).2 ⟨?_, ?_, ?_⟩ + · exact subset_antisymm (union_subset hA.vertexSet_subset hB.vertexSet_subset) hV + · exact subset_antisymm (union_subset hA.edgeSet_subset hB.edgeSet_subset) hE + · exact eq_empty_of_forall_notMem fun e he => hd e he.1 he.2 + +theorem mem_V_or (h : G.IsSeparation A B) {v : α} (hv : v ∈ G.vertexSet) : v ∈ A.vertexSet + ∨ v ∈ B.vertexSet := by + rw [← h.vertexSet_union] at hv + exact hv + +theorem mem_E_or (h : G.IsSeparation A B) {e : β} (he : e ∈ G.edgeSet) : e ∈ A.edgeSet + ∨ e ∈ B.edgeSet := by + rw [← h.edgeSet_union] at he + exact he + +/-- The order of a separation counts the vertices in both sides. -/ +theorem order_le_of_subset {X : Set α} (hf : X.Finite) (h : (A ∩ B).vertexSet ⊆ X) : + separationOrder A B ≤ X.ncard := + ncard_le_ncard h hf + +/-- Restricting a separation to a subgraph gives a separation of the subgraph. -/ +theorem _root_.GraphMinor.Hypergraph.IsSeparation.restrict (h : G.IsSeparation A B) (hH : H ≤ G) : + H.IsSeparation (A ∩ H) (B ∩ H) := by + have hA : A ∩ H ≤ H := inter_le_right h.left_le hH + have hB : B ∩ H ≤ H := inter_le_right h.right_le hH + refine sep_of_sets hA hB (fun v hv => ?_) (fun e he => ?_) (fun e he he' => ?_) + · exact (mem_V_or h (hH.vertexSet_subset hv)).imp (fun h' => ⟨h', hv⟩) fun h' => ⟨h', hv⟩ + · exact (mem_E_or h (hH.edgeSet_subset he)).imp (fun h' => ⟨h', he⟩) fun h' => ⟨h', he⟩ + · exact h.notMem_edgeSet_right he.1 he'.1 + +/-- Restricting a separation does not raise its order. -/ +theorem order_restrict_le (A B H : Hypergraph α β) : separationOrder (A ∩ H) (B ∩ H) + ≤ separationOrder A B := + ncard_le_ncard (fun _ hv => ⟨hv.1.1, hv.2.1⟩) (A.vertexSet_finite.subset fun _ hv => hv.1) + +/-- `(A ∩ H) ∩ H'` is `A ∩ H'` when `H' ≤ H`. -/ +theorem inter_inter_of_le {H' : Hypergraph α β} (hA : A ≤ G) (hH : H ≤ G) (hH' : H' ≤ H) : + (A ∩ H) ∩ H' = A ∩ H' := by + have hG' : H' ≤ G := hH'.trans hH + refine sub_ext (G := G) (inter_le (inter_le hA hH) hG') (inter_le hA hG') ?_ ?_ + · ext v + exact ⟨fun h => ⟨h.1.1, h.2⟩, fun h => ⟨⟨h.1, hH'.vertexSet_subset h.2⟩, h.2⟩⟩ + · ext e + exact ⟨fun h => ⟨h.1.1, h.2⟩, fun h => ⟨⟨h.1, hH'.edgeSet_subset h.2⟩, h.2⟩⟩ + +/-- `A ∩ G = A` for a subgraph `A` of `G`. -/ +theorem inter_eq_left_of_le (hA : A ≤ G) : A ∩ G = A := by + refine sub_ext (G := G) (inter_le hA le_rfl) hA ?_ ?_ + · ext v + exact ⟨fun h => h.1, fun h => ⟨h, hA.vertexSet_subset h⟩⟩ + · ext e + exact ⟨fun h => h.1, fun h => ⟨h, hA.edgeSet_subset h⟩⟩ + +/-- The subgraph `A` with the vertices `Z` added. -/ +def addVerts (G A : Hypergraph α β) (hA : A ≤ G) (Z : Set α) (hZ : Z ⊆ G.vertexSet) : Hypergraph α + β := + subOf G (A.vertexSet ∪ Z) A.edgeSet (union_subset hA.vertexSet_subset hZ) + fun _ he => ⟨hA.edgeSet_subset he, fun _ hv => Or.inl (end_mem hA he hv)⟩ + +theorem addVerts_le {hA : A ≤ G} {Z : Set α} {hZ : Z ⊆ G.vertexSet} : addVerts G A hA Z hZ ≤ G + := subOf_le + +theorem isSeparation_addVerts (h : G.IsSeparation A B) {Z : Set α} (hZ : Z ⊆ G.vertexSet) : + G.IsSeparation (addVerts G A h.left_le Z hZ) (addVerts G B h.right_le Z hZ) := + sep_of_sets addVerts_le addVerts_le (fun _ hv => (mem_V_or h hv).imp Or.inl Or.inl) + (fun _ he => mem_E_or h he) (fun _ he he' => h.notMem_edgeSet_right he he') + +theorem order_addVerts_le (h : G.IsSeparation A B) {Z : Set α} (hZ : Z ⊆ G.vertexSet) : + separationOrder (addVerts G A h.left_le Z hZ) (addVerts G B h.right_le Z hZ) + ≤ separationOrder A B + Z.ncard := by + have hf : Z.Finite := G.vertexSet_finite.subset hZ + have hsub : (addVerts G A h.left_le Z hZ ∩ addVerts G B h.right_le Z hZ).vertexSet ⊆ + (A ∩ B).vertexSet ∪ Z := by + rintro v ⟨h₁ | h₁, h₂ | h₂⟩ + · exact Or.inl ⟨h₁, h₂⟩ + · exact Or.inr h₂ + · exact Or.inr h₁ + · exact Or.inr h₁ + exact (ncard_le_ncard hsub (((A ∩ B).vertexSet_finite).union hf)).trans (ncard_union_le _ _) + +/-- A nonempty predicate has an element of least measure. -/ +theorem exists_min_measure {γ : Type*} {P : γ → Prop} (μ : γ → ℕ) (h : ∃ x, P x) : + ∃ x, P x ∧ ∀ y, P y → μ x ≤ μ y := by + classical + have hex : ∃ n, ∃ x, P x ∧ μ x = n := by + obtain ⟨x, hx⟩ := h + exact ⟨_, x, hx, rfl⟩ + obtain ⟨x, hx, hn⟩ := Nat.find_spec hex + exact ⟨x, hx, fun y hy => hn ▸ Nat.find_min' hex ⟨y, hy, rfl⟩⟩ + +/-- A nonempty predicate with bounded measure has an element of greatest measure. -/ +theorem exists_max_measure {γ : Type*} {P : γ → Prop} (μ : γ → ℕ) (N : ℕ) (hN : ∀ x, P x → μ x ≤ N) + (h : ∃ x, P x) : + ∃ x, P x ∧ ∀ y, P y → μ y ≤ μ x := by + obtain ⟨x, hx, hm⟩ := exists_min_measure (P := P) (fun y => N - μ y) h + refine ⟨x, hx, fun y hy => ?_⟩ + have := hm y hy + have := hN x hx + have := hN y hy + omega + +/-- The size `|V(A)| + |E(A)|` of a subgraph. -/ +noncomputable def size (A : Hypergraph α β) : ℕ := A.vertexSet.ncard + A.edgeSet.ncard + +theorem size_lt_of_lt (h : H ≤ G) (hne : H ≠ G) : size H < size G := by + have h₁ := ncard_le_ncard h.vertexSet_subset G.vertexSet_finite + have h₂ := ncard_le_ncard h.edgeSet_subset G.edgeSet_finite + by_contra hcon + have hV : H.vertexSet = G.vertexSet := eq_of_subset_of_ncard_le h.vertexSet_subset + (by unfold size at hcon; omega) + G.vertexSet_finite + have hE : H.edgeSet = G.edgeSet := eq_of_subset_of_ncard_le h.edgeSet_subset + (by unfold size at hcon; omega) + G.edgeSet_finite + exact hne (sub_ext h le_rfl hV hE) + +theorem size_le_of_le (h : H ≤ G) : size H ≤ size G := by + have h₁ := ncard_le_ncard h.vertexSet_subset G.vertexSet_finite + have h₂ := ncard_le_ncard h.edgeSet_subset G.edgeSet_finite + unfold size + omega + +/-- `X` is the vertex set of a connected subgraph of `G`: it is not empty, and any two of its +vertices are joined by a walk +of `G` with all vertices in `X`. -/ +def Conn (G : Hypergraph α β) (X : Set α) : Prop := + X.Nonempty ∧ ∀ x ∈ X, ∀ y ∈ X, ∃ w : G.skeleton.Walk x y, ∀ z ∈ w.support, z ∈ X + +theorem conn_singleton {x : α} : Conn G {x} := + ⟨⟨x, rfl⟩, fun a ha b hb => by + obtain rfl := ha + obtain rfl := hb + exact ⟨.nil, by simp⟩⟩ + +/-- Two connected sets that meet have a connected union. -/ +theorem Conn.union {X Y : Set α} (hX : Conn G X) (hY : Conn G Y) (h : (X ∩ Y).Nonempty) : Conn G + (X ∪ Y) := by + obtain ⟨c, hcX, hcY⟩ := h + have key : ∀ x ∈ X ∪ Y, ∃ w : G.skeleton.Walk x c, ∀ z ∈ w.support, z ∈ X ∪ Y := by + rintro x (hx | hx) + · obtain ⟨w, hw⟩ := hX.2 x hx c hcX + exact ⟨w, fun z hz => Or.inl (hw z hz)⟩ + · obtain ⟨w, hw⟩ := hY.2 x hx c hcY + exact ⟨w, fun z hz => Or.inr (hw z hz)⟩ + refine ⟨⟨c, Or.inl hcX⟩, fun x hx y hy => ?_⟩ + obtain ⟨w₁, h₁⟩ := key x hx + obtain ⟨w₂, h₂⟩ := key y hy + refine ⟨w₁.append w₂.reverse, fun z hz => ?_⟩ + rcases (SimpleGraph.Walk.mem_support_append_iff _ _).1 hz with h | h + · exact h₁ z h + · exact h₂ z (by simpa using h) + +/-- Two connected sets joined by an edge have a connected union. -/ +theorem Conn.union_adj {X Y : Set α} (hX : Conn G X) (hY : Conn G Y) {x y : α} (hx : x ∈ X) + (hy : y ∈ Y) + (h : G.skeleton.Adj x y) : Conn G (X ∪ Y) := by + have hp : Conn G ({x, y} : Set α) := by + refine ⟨⟨x, Or.inl rfl⟩, ?_⟩ + have hs : ∀ (a b : α) (hab : G.skeleton.Adj a b) z, + z ∈ (SimpleGraph.Walk.cons hab .nil).support → z ∈ ({a, b} : Set α) := fun a b hab z hz + => by + simpa using hz + rintro a (rfl | rfl) b (rfl | rfl) + · exact ⟨.nil, by simp⟩ + · exact ⟨_, hs _ _ h⟩ + · exact ⟨_, fun z hz => by simpa [or_comm] using hs _ _ h.symm z hz⟩ + · exact ⟨.nil, by simp⟩ + have h₁ := hX.union hp ⟨x, hx, Or.inl rfl⟩ + have h₂ := h₁.union hY ⟨y, Or.inr (Or.inr rfl), hy⟩ + refine (show (X ∪ {x, y}) ∪ Y = X ∪ Y from ?_) ▸ h₂ + ext z + simp only [mem_union, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ((h | rfl | rfl) | h) + · exact Or.inl h + · exact Or.inl hx + · exact Or.inr hy + · exact Or.inr h + · rintro (h | h) + · exact Or.inl (Or.inl h) + · exact Or.inr h + +/-- A walk gives a connected set. -/ +theorem conn_support {x y : α} (w : G.skeleton.Walk x y) : Conn G {z | z ∈ w.support} := by + classical + refine ⟨⟨x, w.start_mem_support⟩, fun a ha b hb => ?_⟩ + refine ⟨(w.dropUntil a ha).append (w.dropUntil b hb).reverse, fun z hz => ?_⟩ + rcases (SimpleGraph.Walk.mem_support_append_iff _ _).1 hz with h | h + · exact SimpleGraph.Walk.support_dropUntil_subset_support _ _ h + · exact SimpleGraph.Walk.support_dropUntil_subset_support _ _ (by simpa using h) + +/-- A set that is not connected, and not empty, splits into two nonempty parts with no edge between +them. -/ +theorem exists_split_of_not_conn {X : Set α} (hne : X.Nonempty) (h : ¬ Conn G X) : + ∃ X₁ X₂ : Set α, X₁.Nonempty ∧ X₂.Nonempty ∧ X₁ ∪ X₂ = X ∧ Disjoint X₁ X₂ ∧ + ∀ x ∈ X₁, ∀ y ∈ X₂, ¬ G.skeleton.Adj x y := by + classical + obtain ⟨x₀, hx₀⟩ := hne + let X₁ : Set α := {y | y ∈ X ∧ ∃ w : G.skeleton.Walk x₀ y, ∀ z ∈ w.support, z ∈ X} + have hx₁ : x₀ ∈ X₁ := ⟨hx₀, .nil, by simpa using hx₀⟩ + have hsplit : (X \ X₁).Nonempty := by + by_contra hn + have hall : ∀ y ∈ X, y ∈ X₁ := fun y hy => by + by_contra hy' + exact hn ⟨y, hy, hy'⟩ + refine h ⟨⟨x₀, hx₀⟩, fun a ha b hb => ?_⟩ + obtain ⟨-, wa, hwa⟩ := hall a ha + obtain ⟨-, wb, hwb⟩ := hall b hb + refine ⟨wa.reverse.append wb, fun z hz => ?_⟩ + rcases (SimpleGraph.Walk.mem_support_append_iff _ _).1 hz with h | h + · exact hwa z (by simpa using h) + · exact hwb z h + refine ⟨X₁, X \ X₁, ⟨x₀, hx₁⟩, hsplit, union_sdiff_cancel fun _ h => h.1, disjoint_sdiff_right, + ?_⟩ + rintro x ⟨hxX, w, hw⟩ y ⟨hyX, hy⟩ hadj + refine hy ⟨hyX, w.concat hadj, fun z hz => ?_⟩ + rw [SimpleGraph.Walk.support_concat, List.mem_append] at hz + rcases hz with hz | hz + · exact hw z hz + · exact (List.mem_singleton.1 hz) ▸ hyX + +/-- Two ends of an edge of a subgraph are adjacent in the larger graph. -/ +theorem skeleton_mono (h : H ≤ G) : H.skeleton ≤ G.skeleton := fun _ _ hadj => by + obtain ⟨hne, e, h₁, h₂⟩ := hadj + exact ⟨hne, e, inc_of_le h h₁, inc_of_le h h₂⟩ + +/-- A connected set of a subgraph is connected in the larger graph. -/ +theorem Conn.mono {X : Set α} (hX : Conn H X) (h : H ≤ G) : Conn G X := + ⟨hX.1, fun x hx y hy => by + obtain ⟨w, hw⟩ := hX.2 x hx y hy + exact ⟨w.mapLe (skeleton_mono h), fun z hz => hw z (by simpa using hz)⟩⟩ + +/-- Vertices of a path before a vertex `x` other than the last: the last vertex is not among them. +-/ +theorem notMem_takeUntil {K : SimpleGraph α} [DecidableEq α] {u v x : α} (w : K.Walk u v) + (hw : w.IsPath) (hx : x ∈ w.support) + (hne : x ≠ v) : v ∉ (w.takeUntil x hx).support := by + intro hv + have hn : ((w.takeUntil x hx).append (w.dropUntil x hx)).support.Nodup := by + rw [w.take_spec hx] + exact hw.support_nodup + rw [SimpleGraph.Walk.support_append, List.nodup_append] at hn + refine hn.2.2 v hv v ?_ rfl + have h₁ : v ∈ (w.dropUntil x hx).support := (w.dropUntil x hx).end_mem_support + rw [← SimpleGraph.Walk.cons_tail_support] at h₁ + exact (List.mem_cons.1 h₁).resolve_left hne.symm + +/-- A set in which every vertex has a walk to `b` is connected. -/ +theorem conn_of_reach {X : Set α} {b : α} (hb : b ∈ X) (h : ∀ x ∈ X, ∃ w : G.skeleton.Walk x b, ∀ z + ∈ w.support, z ∈ X) : + Conn G X := by + classical + refine ⟨⟨b, hb⟩, fun x hx y hy => ?_⟩ + obtain ⟨w₁, h₁⟩ := h x hx + obtain ⟨w₂, h₂⟩ := h y hy + refine ⟨w₁.append w₂.reverse, fun z hz => ?_⟩ + rcases (SimpleGraph.Walk.mem_support_append_iff _ _).1 hz with hz | hz + · exact h₁ z hz + · exact h₂ z (by simpa using hz) + +/-- A walk of the skeleton stays in `V(G)`. -/ +theorem support_mem {u v : α} (w : G.skeleton.Walk u v) (hu : u ∈ G.vertexSet) {x : α} + (hx : x ∈ w.support) : + x ∈ G.vertexSet := by + induction w with + | nil => + rw [SimpleGraph.Walk.support_nil, List.mem_singleton] at hx + exact hx ▸ hu + | cons hadj p ih => + rw [SimpleGraph.Walk.support_cons, List.mem_cons] at hx + rcases hx with rfl | h + · exact hu + · obtain ⟨-, e, -, h₂⟩ := hadj + exact ih (G.vertex_mem_of_inc h₂) h + +/-- `k` injective values in a set of size `k` fill the set. -/ +theorem exists_index {k : ℕ} {W : Set α} (f : Fin k → α) (hWf : W.Finite) (hWc : W.ncard = k) + (hfi : Function.Injective f) (hfW : ∀ i, f i ∈ W) {x : α} (hx : x ∈ W) : ∃ i, f i = x := by + have hsub : range f ⊆ W := range_subset_iff.2 hfW + have hc : W.ncard ≤ (range f).ncard := by + rw [← image_univ, ncard_image_of_injective _ hfi, ncard_univ, Nat.card_eq_fintype_card, + Fintype.card_fin, hWc] + exact (eq_of_subset_of_ncard_le hsub hc hWf ▸ hx : x ∈ range f) + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Contract.lean b/LeanPool/GraphMinor/RST94/Contract.lean new file mode 100644 index 0000000000..2ccd8d7c37 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Contract.lean @@ -0,0 +1,390 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section3a + +/-! +# Contracting an edge + +The graph `G/e` used in the proof of (4.1) of "Quickly excluding a planar graph" (page 335). We keep +the end `u` of `e` and remove the +end `v`. An edge at `v` becomes an edge at `u`. The paper uses `G/e` and lifts separations by hand, +and here `contract_lift_up` and +`contract_lift_down` are the paper's two lifts. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β : Type*} {G H A₀ B₀ X Y : Hypergraph α β} {e : β} {u v : α} + +/-- The graph `G/e` for an edge `e` with ends `u ≠ v`: it has the vertices of `G` other than `v` and +the edges of `G` other than `e`, and +an edge at `v` is an edge at `u`. -/ +def contract (G : Hypergraph α β) (e : β) (u v : α) (hu : u ∈ G.vertexSet) + (huv : u ≠ v) : Hypergraph α β where + vertexSet := G.vertexSet \ {v} + edgeSet := G.edgeSet \ {e} + Inc f x := f ≠ e ∧ x ≠ v ∧ (G.Inc f x ∨ (x = u ∧ G.Inc f v)) + vertex_mem_of_inc := by + rintro f x ⟨-, hx, h | ⟨rfl, -⟩⟩ + · exact ⟨G.vertex_mem_of_inc h, hx⟩ + · exact ⟨hu, hx⟩ + edge_mem_of_inc := by + rintro f x ⟨hf, -, h | ⟨-, h⟩⟩ + · exact ⟨G.edge_mem_of_inc h, hf⟩ + · exact ⟨G.edge_mem_of_inc h, hf⟩ + vertexSet_finite := G.vertexSet_finite.subset sdiff_subset + edgeSet_finite := G.edgeSet_finite.subset sdiff_subset + +variable {hu : u ∈ G.vertexSet} {huv : u ≠ v} + +open Classical in +/-- The map from `V(G)` to `V(G/e)`. -/ +noncomputable def contractMap (u v : α) (x : α) : α := if x = v then u else x + +omit hu huv in +theorem contractMap_of_ne {x : α} (h : x ≠ v) : contractMap u v x = x := by + simp [contractMap, h] + +omit hu huv in +theorem contractMap_self : contractMap u v v = u := by + simp [contractMap] + +theorem contractMap_inc {f : β} {x : α} (hf : f ≠ e) (h : G.Inc f x) : + (contract G e u v hu huv).Inc f (contractMap u v x) := by + by_cases hx : x = v + · subst hx + rw [contractMap_self] + exact ⟨hf, huv, Or.inr ⟨rfl, h⟩⟩ + · rw [contractMap_of_ne hx] + exact ⟨hf, hx, Or.inl h⟩ + +/-- `G/e` is a graph. -/ +theorem isGraph_contract (hG : G.IsGraph) : (contract G e u v hu huv).IsGraph := by + rintro f ⟨hf, hfe⟩ + obtain ⟨⟨x, hx⟩, h₂⟩ := hG f hf + refine ⟨⟨_, contractMap_inc (hu := hu) (huv := huv) hfe hx⟩, ?_⟩ + have hsub : (contract G e u v hu huv).ends f ⊆ contractMap u v '' G.ends f := by + rintro y ⟨-, hy, hi | ⟨rfl, hi⟩⟩ + · exact ⟨y, hi, contractMap_of_ne hy⟩ + · exact ⟨v, hi, contractMap_self⟩ + have hfin : (G.ends f).Finite := G.vertexSet_finite.subset fun _ h => G.vertex_mem_of_inc h + exact (ncard_le_ncard hsub (hfin.image _)).trans ((ncard_image_le hfin).trans h₂) + +/-- A subgraph of `G` that avoids `v` and `e` and the edges at `v` is a subgraph of `G/e`. -/ +theorem le_contract (hH : H ≤ G) (hv : v ∉ H.vertexSet) (he : e ∉ H.edgeSet) + (hno : ∀ f ∈ H.edgeSet, ¬ G.Inc f v) : + H ≤ contract G e u v hu huv := by + refine ⟨fun x hx => ⟨hH.vertexSet_subset hx, fun h => hv (h ▸ hx)⟩, + fun f hf => ⟨hH.edgeSet_subset hf, fun h => he (h ▸ hf)⟩, fun f hf => ?_⟩ + ext x + constructor + · rintro ⟨-, -, h | ⟨-, h⟩⟩ + · exact inc_le hH hf h + · exact absurd h (hno f hf) + · intro h + have hi := inc_of_le hH h + exact ⟨fun e' => he (e' ▸ hf), fun e' => hno f hf (e' ▸ hi), Or.inl hi⟩ + +/-- A subgraph of `G/e` that avoids `u` is a subgraph of `G`, and it avoids `v` and `e` and the +edges at `v`. -/ +theorem le_of_le_contract (hH : H ≤ contract G e u v hu huv) (huH : u ∉ H.vertexSet) : + H ≤ G ∧ v ∉ H.vertexSet ∧ e ∉ H.edgeSet ∧ ∀ f ∈ H.edgeSet, ¬ G.Inc f v := by + have hno : ∀ f ∈ H.edgeSet, ¬ G.Inc f v := fun f hf hi => by + have hfc := hH.edgeSet_subset hf + have : (contract G e u v hu huv).Inc f u := ⟨hfc.2, huv, Or.inr ⟨rfl, hi⟩⟩ + exact huH (end_mem hH hf this) + refine ⟨⟨fun x hx => (hH.vertexSet_subset hx).1, fun f hf => (hH.edgeSet_subset hf).1, fun f hf + => ?_⟩, + fun hv => (hH.vertexSet_subset hv).2 rfl, fun he => (hH.edgeSet_subset he).2 rfl, hno⟩ + ext x + constructor + · intro h + have hx : x ≠ v := fun e' => hno f hf (e' ▸ h) + exact inc_le hH hf ⟨(hH.edgeSet_subset hf).2, hx, Or.inl h⟩ + · intro h + obtain ⟨-, -, h' | ⟨-, h'⟩⟩ := inc_of_le hH h + · exact h' + · exact absurd h' (hno f hf) + +/-- Two subgraphs with the same vertices and edges inside `H` have the same intersection with `H`. +-/ +theorem inter_eq_of_agree {G₁ G₂ : Hypergraph α β} (hX : X ≤ G₁) (hY : Y ≤ G₂) (hH₁ : H ≤ G₁) + (hH₂ : H ≤ G₂) + (hV : ∀ x ∈ H.vertexSet, x ∈ X.vertexSet ↔ x ∈ Y.vertexSet) (hE : ∀ f ∈ H.edgeSet, f ∈ + X.edgeSet ↔ f ∈ Y.edgeSet) : + X ∩ H = Y ∩ H := by + refine sub_ext (G := H) (inter_le_right hX hH₁) (inter_le_right hY hH₂) ?_ ?_ + · ext x + exact ⟨fun h => ⟨(hV x h.2).1 h.1, h.2⟩, fun h => ⟨(hV x h.2).2 h.1, h.2⟩⟩ + · ext f + exact ⟨fun h => ⟨(hE f h.2).1 h.1, h.2⟩, fun h => ⟨(hE f h.2).2 h.1, h.2⟩⟩ + +/-- The first lift of the proof of (4.1) (pages 335–336): a separation of `G/e` gives a separation +of `G`, of order at most one more, and if +the order is one more then `e` is on the left. -/ +theorem contract_lift_up (hG : G.IsGraph) (heu : G.Inc e u) (hev : G.Inc e v) + (hs : (contract G e u v hu huv).IsSeparation A₀ B₀) : + ∃ A' B', G.IsSeparation A' B' ∧ A₀.vertexSet ⊆ A'.vertexSet ∧ + separationOrder A' B' ≤ separationOrder A₀ B₀ + 1 ∧ + (separationOrder A' B' = separationOrder A₀ B₀ + 1 → e ∈ A'.edgeSet) ∧ + (∀ x, x ≠ v → (x ∈ A'.vertexSet ↔ x ∈ A₀.vertexSet)) ∧ (∀ x, x ≠ v → + (x ∈ B'.vertexSet ↔ x ∈ B₀.vertexSet)) ∧ + (∀ f, f ≠ e → (f ∈ A'.edgeSet ↔ f ∈ A₀.edgeSet)) ∧ (∀ f, f ≠ e → + (f ∈ B'.edgeSet ↔ f ∈ B₀.edgeSet)) := by + classical + have hAc := hs.left_le + have hBc := hs.right_le + have huc : u ∈ (contract G e u v hu huv).vertexSet := ⟨hu, huv⟩ + have hsubV : ∀ {Y : Hypergraph α β}, Y ≤ contract G e u v hu huv → Y.vertexSet ∪ {x | x = v + ∧ u ∈ Y.vertexSet} ⊆ G.vertexSet := by + rintro Y hY x (hx | ⟨rfl, -⟩) + · exact (hY.vertexSet_subset hx).1 + · exact G.vertex_mem_of_inc hev + have hend : ∀ {Y : Hypergraph α β}, Y ≤ contract G e u v hu huv → ∀ f ∈ Y.edgeSet, ∀ x, G.Inc f x + → + x ∈ Y.vertexSet ∪ {x | x = v ∧ u ∈ Y.vertexSet} := by + intro Y hY f hf x hx + have hfe := (hY.edgeSet_subset hf).2 + by_cases hxv : x = v + · subst hxv + exact Or.inr ⟨rfl, end_mem hY hf ⟨hfe, huv, Or.inr ⟨rfl, hx⟩⟩⟩ + · exact Or.inl (end_mem hY hf ⟨hfe, hxv, Or.inl hx⟩) + have heE : e ∈ G.edgeSet := G.edge_mem_of_inc heu + have hee : ∀ {Y : Hypergraph α β}, u ∈ Y.vertexSet → ∀ x, G.Inc e x → x ∈ Y.vertexSet ∪ {x | x + = v ∧ u ∈ Y.vertexSet} := fun {Y} hY x hx => by + rcases end_eq_or hG heu hev huv hx with rfl | rfl + · exact Or.inl hY + · exact Or.inr ⟨rfl, hY⟩ + let A' := subOf G (A₀.vertexSet ∪ {x | x = v ∧ u ∈ A₀.vertexSet}) (A₀.edgeSet ∪ {f | f = e + ∧ u ∈ A₀.vertexSet}) (hsubV hAc) (by + rintro f (hf | ⟨rfl, hf⟩) + · exact ⟨(hAc.edgeSet_subset hf).1, hend hAc f hf⟩ + · exact ⟨heE, hee hf⟩) + have huB : u ∉ A₀.vertexSet → u ∈ B₀.vertexSet := fun h => (mem_V_or hs huc).resolve_left h + let B' := subOf G (B₀.vertexSet ∪ {x | x = v ∧ u ∈ B₀.vertexSet}) (B₀.edgeSet ∪ {f | f = e + ∧ u ∉ A₀.vertexSet}) (hsubV hBc) (by + rintro f (hf | ⟨rfl, hf⟩) + · exact ⟨(hBc.edgeSet_subset hf).1, hend hBc f hf⟩ + · exact ⟨heE, hee (huB hf)⟩) + have hsep : G.IsSeparation A' B' := by + refine sep_of_sets subOf_le subOf_le (fun x hx => ?_) (fun f hf => ?_) ?_ + · by_cases hxv : x = v + · subst hxv + exact (mem_V_or hs huc).imp (fun h => Or.inr ⟨rfl, h⟩) fun h => Or.inr ⟨rfl, h⟩ + · exact (mem_V_or hs ⟨hx, hxv⟩).imp Or.inl Or.inl + · by_cases hfe : f = e + · subst hfe + by_cases h : u ∈ A₀.vertexSet + · exact Or.inl (Or.inr ⟨rfl, h⟩) + · exact Or.inr (Or.inr ⟨rfl, h⟩) + · exact (mem_E_or hs ⟨hf, hfe⟩).imp Or.inl Or.inl + · rintro f (hf | ⟨h₁, hf⟩) (hf' | ⟨h₂, hf'⟩) + · exact hs.notMem_edgeSet_right hf hf' + · exact (hAc.edgeSet_subset hf).2 h₂ + · exact (hBc.edgeSet_subset hf').2 h₁ + · exact hf' hf + have hsub₁ : (A' ∩ B').vertexSet ⊆ insert v (A₀ ∩ B₀).vertexSet := by + rintro x ⟨hx | ⟨h₁, -⟩, hx' | ⟨h₂, -⟩⟩ + · exact Or.inr ⟨hx, hx'⟩ + · exact Or.inl h₂ + · exact Or.inl h₁ + · exact Or.inl h₁ + have hfin := (A₀ ∩ B₀).vertexSet_finite + have ho₁ : separationOrder A' B' ≤ separationOrder A₀ B₀ + 1 := + (ncard_le_ncard hsub₁ (hfin.insert v)).trans (ncard_insert_le _ _) + have hAv : ∀ x, x ≠ v → (x ∈ A'.vertexSet ↔ x ∈ A₀.vertexSet) := fun x hx => + ⟨fun h => h.resolve_right fun h' => hx h'.1, Or.inl⟩ + have hBv : ∀ x, x ≠ v → (x ∈ B'.vertexSet ↔ x ∈ B₀.vertexSet) := fun x hx => + ⟨fun h => h.resolve_right fun h' => hx h'.1, Or.inl⟩ + refine ⟨A', B', hsep, fun x hx => Or.inl hx, ho₁, fun heq => ?_, hAv, hBv, ?_, ?_⟩ + · -- If `e` is not on the left then `u ∉ V(A₀)`, and `v` is not on the left, so the order does + -- not grow. + by_contra hne + have hu' : u ∉ A₀.vertexSet := fun h => hne (Or.inr ⟨rfl, h⟩) + have hvA : v ∉ A'.vertexSet := by + rintro (hv | ⟨-, h⟩) + · exact (hAc.vertexSet_subset hv).2 rfl + · exact hu' h + have hsub₂ : (A' ∩ B').vertexSet ⊆ (A₀ ∩ B₀).vertexSet := fun x hx => by + have hxv : x ≠ v := fun e' => hvA (e' ▸ hx.1) + exact ⟨(hAv x hxv).1 hx.1, (hBv x hxv).1 hx.2⟩ + have := ncard_le_ncard hsub₂ hfin + change (A' ∩ B').vertexSet.ncard = (A₀ ∩ B₀).vertexSet.ncard + 1 at heq + omega + · intro f hf + exact ⟨fun h => h.resolve_right fun h' => hf h'.1, Or.inl⟩ + · intro f hf + exact ⟨fun h => h.resolve_right fun h' => hf h'.1, Or.inl⟩ + +/-- The second lift of the proof of (4.1) (page 336): a separation `(A', B')` of `G` gives a +separation `(A*, B*)` of `G/e`, of order at most that +of `(A', B')`. -/ +theorem contract_lift_down {A' B' : Hypergraph α β} (heu : G.Inc e u) (hev : G.Inc e v) + (hs : G.IsSeparation A' B') : + ∃ A₁ B₁, (contract G e u v hu huv).IsSeparation A₁ B₁ ∧ separationOrder A₁ B₁ + ≤ separationOrder A' B' ∧ + (∀ x, x ≠ v → x ≠ u → (x ∈ A₁.vertexSet ↔ x ∈ A'.vertexSet)) ∧ (∀ x, x ≠ v → x ≠ u → + (x ∈ B₁.vertexSet ↔ x ∈ B'.vertexSet)) ∧ + (∀ f, f ≠ e → (f ∈ A₁.edgeSet ↔ f ∈ A'.edgeSet)) ∧ (∀ f, f ≠ e → + (f ∈ B₁.edgeSet ↔ f ∈ B'.edgeSet)) := by + classical + have hsubV : ∀ {Y : Hypergraph α β}, Y ≤ G → {x | x ≠ v ∧ (x ∈ Y.vertexSet ∨ (x = u + ∧ v ∈ Y.vertexSet))} ⊆ (contract G e u v hu huv).vertexSet := by + rintro Y hY x ⟨hxv, hx | ⟨rfl, -⟩⟩ + · exact ⟨hY.vertexSet_subset hx, hxv⟩ + · exact ⟨hu, hxv⟩ + have hsubE : ∀ {Y : Hypergraph α β}, Y ≤ G → ∀ f ∈ Y.edgeSet \ {e}, f ∈ + (contract G e u v hu huv).edgeSet ∧ + ∀ x, (contract G e u v hu huv).Inc f x → x ∈ {x | x ≠ v ∧ (x ∈ Y.vertexSet ∨ (x = u + ∧ v ∈ Y.vertexSet))} := by + intro Y hY f hf + refine ⟨⟨hY.edgeSet_subset hf.1, hf.2⟩, ?_⟩ + rintro x ⟨-, hxv, hi | ⟨rfl, hi⟩⟩ + · exact ⟨hxv, Or.inl (end_mem hY hf.1 hi)⟩ + · exact ⟨hxv, Or.inr ⟨rfl, end_mem hY hf.1 hi⟩⟩ + have hAG := hs.left_le + have hBG := hs.right_le + let A₁ := subOf (contract G e u v hu huv) _ _ (hsubV hAG) (hsubE hAG) + let B₁ := subOf (contract G e u v hu huv) _ _ (hsubV hBG) (hsubE hBG) + have hsep : (contract G e u v hu huv).IsSeparation A₁ B₁ := by + refine sep_of_sets subOf_le subOf_le (fun x hx => ?_) (fun f hf => ?_) ?_ + · exact (mem_V_or hs hx.1).imp (fun h => ⟨hx.2, Or.inl h⟩) fun h => ⟨hx.2, Or.inl h⟩ + · exact (mem_E_or hs hf.1).imp (fun h => ⟨h, hf.2⟩) fun h => ⟨h, hf.2⟩ + · exact fun f hf hf' => hs.notMem_edgeSet_right hf.1 hf'.1 + have hside : (u ∈ A'.vertexSet ∧ v ∈ A'.vertexSet) ∨ (u ∈ B'.vertexSet ∧ v ∈ B'.vertexSet) := by + have heE : e ∈ G.edgeSet := G.edge_mem_of_inc heu + exact (mem_E_or hs heE).imp (fun h => ⟨end_mem hAG h heu, end_mem hAG h hev⟩) + fun h => ⟨end_mem hBG h heu, end_mem hBG h hev⟩ + have hsub : (A₁ ∩ B₁).vertexSet ⊆ contractMap u v '' (A' ∩ B').vertexSet := by + rintro x ⟨⟨hxv, hx⟩, -, hx'⟩ + by_cases hxu : x = u + · subst hxu + have hA : x ∈ A'.vertexSet ∨ v ∈ A'.vertexSet := hx.imp id fun h => h.2 + have hB : x ∈ B'.vertexSet ∨ v ∈ B'.vertexSet := hx'.imp id fun h => h.2 + have hcases : (x ∈ A'.vertexSet ∧ x ∈ B'.vertexSet) ∨ (v ∈ A'.vertexSet ∧ v ∈ B'.vertexSet) + := by + rcases hside with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · rcases hB with hB | hB + · exact Or.inl ⟨h₁, hB⟩ + · exact Or.inr ⟨h₂, hB⟩ + · rcases hA with hA | hA + · exact Or.inl ⟨hA, h₁⟩ + · exact Or.inr ⟨hA, h₂⟩ + rcases hcases with h | h + · exact ⟨x, h, contractMap_of_ne hxv⟩ + · exact ⟨v, h, contractMap_self⟩ + · exact ⟨x, ⟨hx.resolve_right fun h => hxu h.1, hx'.resolve_right fun h + => hxu h.1⟩, contractMap_of_ne hxv⟩ + have hfin := (A' ∩ B').vertexSet_finite + refine ⟨A₁, B₁, hsep, (ncard_le_ncard hsub (hfin.image _)).trans (ncard_image_le hfin), ?_, ?_, + ?_, ?_⟩ + · exact fun x hv' hu' => ⟨fun h => h.2.resolve_right fun h' => hu' h'.1, fun h => ⟨hv', Or.inl h⟩⟩ + · exact fun x hv' hu' => ⟨fun h => h.2.resolve_right fun h' => hu' h'.1, fun h => ⟨hv', Or.inl h⟩⟩ + · exact fun f hf => ⟨fun h => h.1, fun h => ⟨h, hf⟩⟩ + · exact fun f hf => ⟨fun h => h.1, fun h => ⟨h, hf⟩⟩ + +/-- Adjacent vertices of `G/e` are joined by a walk of `G` that may also use `v`, if one of them is +`u`. -/ +theorem exists_walk_of_adj (heu : G.Inc e u) (hev : G.Inc e v) {x y : α} (h : + (contract G e u v hu huv).skeleton.Adj x y) : + ∃ w : G.skeleton.Walk x y, ∀ z ∈ w.support, z = x ∨ z = y ∨ (z = v ∧ (x = u ∨ y = u)) := by + obtain ⟨hne, f, ⟨-, hx, h₁⟩, ⟨-, hy, h₂⟩⟩ := h + have hadjuv : G.skeleton.Adj u v := ⟨huv, e, heu, hev⟩ + rcases h₁ with h₁ | ⟨rfl, h₁⟩ <;> rcases h₂ with h₂ | ⟨rfl, h₂⟩ + · have hadj : G.skeleton.Adj x y := ⟨hne, f, h₁, h₂⟩ + refine ⟨SimpleGraph.Walk.cons hadj SimpleGraph.Walk.nil, fun z hz => ?_⟩ + simp only [SimpleGraph.Walk.support_cons, SimpleGraph.Walk.support_nil, List.mem_cons, + List.not_mem_nil, or_false] at hz + exact hz.imp id Or.inl + · have hadj : G.skeleton.Adj x v := ⟨hx, f, h₁, h₂⟩ + refine ⟨SimpleGraph.Walk.cons hadj (SimpleGraph.Walk.cons hadjuv.symm SimpleGraph.Walk.nil), + fun z hz => ?_⟩ + simp only [SimpleGraph.Walk.support_cons, SimpleGraph.Walk.support_nil, List.mem_cons, + List.not_mem_nil, or_false] at hz + rcases hz with rfl | rfl | rfl + · exact Or.inl rfl + · exact Or.inr (Or.inr ⟨rfl, Or.inr rfl⟩) + · exact Or.inr (Or.inl rfl) + · have hadj : G.skeleton.Adj v y := ⟨hy.symm, f, h₁, h₂⟩ + refine ⟨SimpleGraph.Walk.cons hadjuv (SimpleGraph.Walk.cons hadj SimpleGraph.Walk.nil), fun z + hz => ?_⟩ + simp only [SimpleGraph.Walk.support_cons, SimpleGraph.Walk.support_nil, List.mem_cons, + List.not_mem_nil, or_false] at hz + rcases hz with rfl | rfl | rfl + · exact Or.inl rfl + · exact Or.inr (Or.inr ⟨rfl, Or.inl rfl⟩) + · exact Or.inr (Or.inl rfl) + · exact absurd rfl hne + +/-- A walk of `G/e` lifts to a walk of `G` with the same ends. Its only new vertex is `v`, and only +if the walk passes through `u`. -/ +theorem exists_walk_lift (heu : G.Inc e u) (hev : G.Inc e v) {a b : α} (p : + (contract G e u v hu huv).skeleton.Walk a b) : + ∃ w : G.skeleton.Walk a b, ∀ z ∈ w.support, z ∈ p.support ∨ (z = v ∧ u ∈ p.support) := by + classical + induction p with + | nil => exact ⟨SimpleGraph.Walk.nil, fun z hz => Or.inl hz⟩ + | @cons x y c hadj q ih => + obtain ⟨w₁, h₁⟩ := exists_walk_of_adj heu hev hadj + obtain ⟨w₂, h₂⟩ := ih + refine ⟨w₁.append w₂, fun z hz => ?_⟩ + rcases (SimpleGraph.Walk.mem_support_append_iff _ _).1 hz with hz | hz + · rcases h₁ z hz with rfl | rfl | ⟨rfl, rfl | rfl⟩ + · exact Or.inl (by simp) + · exact Or.inl (by simp) + · exact Or.inr ⟨rfl, by simp⟩ + · exact Or.inr ⟨rfl, by simp⟩ + · rcases h₂ z hz with h | ⟨h₃, h₄⟩ + · exact Or.inl (by simp [h]) + · exact Or.inr ⟨h₃, by simp [h₄]⟩ + +/-- A walk of `G` projects to a walk of `G/e`. -/ +theorem exists_walk_project {a b : α} (w : G.skeleton.Walk a b) (heu : G.Inc e u) (hev : G.Inc e v) + (hG : G.IsGraph) : + ∃ p : (contract G e u v hu huv).skeleton.Walk (contractMap u v a) (contractMap u v b), + ∀ z ∈ p.support, ∃ y ∈ w.support, contractMap u v y = z := by + classical + induction w with + | @nil x => + refine ⟨SimpleGraph.Walk.nil, fun z hz => ?_⟩ + rw [SimpleGraph.Walk.support_nil, List.mem_singleton] at hz + exact ⟨x, by simp, hz.symm⟩ + | @cons x y c hadj q ih => + obtain ⟨p, hp⟩ := ih + by_cases heq : contractMap u v x = contractMap u v y + · refine ⟨p.copy heq.symm rfl, fun z hz => ?_⟩ + rw [SimpleGraph.Walk.support_copy] at hz + obtain ⟨t, ht, rfl⟩ := hp z hz + exact ⟨t, by simp [ht], rfl⟩ + · have hadj₂ := hadj + obtain ⟨-, f, h₁, h₂⟩ := hadj₂ + have hfe : f ≠ e := by + intro he' + rw [he'] at h₁ h₂ + have hc : ∀ t, G.Inc e t → contractMap u v t = u := fun t ht => by + rcases end_eq_or hG heu hev huv ht with rfl | rfl + · exact contractMap_of_ne huv + · exact contractMap_self + exact heq ((hc x h₁).trans (hc y h₂).symm) + have hadj' : (contract G e u v hu huv).skeleton.Adj (contractMap u v x) (contractMap u v y) := + ⟨heq, f, contractMap_inc hfe h₁, contractMap_inc hfe h₂⟩ + refine ⟨SimpleGraph.Walk.cons hadj' p, fun z hz => ?_⟩ + rw [SimpleGraph.Walk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · exact ⟨x, by simp, rfl⟩ + · obtain ⟨t, ht, rfl⟩ := hp z hz + exact ⟨t, by simp [ht], rfl⟩ + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Rado.lean b/LeanPool/GraphMinor/RST94/Rado.lean new file mode 100644 index 0000000000..9bdc42cba3 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Rado.lean @@ -0,0 +1,153 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM10.Defs2 + +/-! +# Rado's theorem on independent transversals + +R. Rado, *A theorem on independence relations*, Quart. J. Math. Oxford 13 (1942), 83–89. Quickly +excluding a planar graph +uses this in the proof of (2.10), page 329. We prove it for a rank function on a finite set, by the +usual reduction: a set +`Y i` with two elements can lose one of them. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Set GM10 + +variable {α ι : Type*} [Fintype ι] + +/-- The union of the sets `Y i`, `i ∈ I`. -/ +def unionOver (Y : ι → Set α) (I : Finset ι) : Set α := ⋃ i ∈ I, Y i + +omit [Fintype ι] in +theorem unionOver_subset {E : Set α} {Y : ι → Set α} (hY : ∀ i, Y i ⊆ E) + (I : Finset ι) : unionOver Y I ⊆ E := + iUnion₂_subset fun i _ => hY i + +/-- **Rado's theorem**, for a rank function `r` on a finite set `E`: if each `I` has `|I| ≤ r(⋃_{i ∈ +I} Y i)`, then there +are `y i ∈ Y i`, all different, whose set has rank `|ι|`. -/ +theorem rado {E : Set α} (hE : E.Finite) {r : Set α → ℕ} (hr : IsMatroidRankOn E r) (Y : ι → Set α) + (hY : ∀ i, Y i ⊆ E) (h : ∀ I : Finset ι, I.card ≤ r (unionOver Y I)) : + ∃ y : ι → α, (∀ i, y i ∈ Y i) ∧ Function.Injective y ∧ r (range y) = Fintype.card ι := by + classical + induction hn : ∑ i, (Y i).ncard using Nat.strong_induction_on generalizing Y with + | _ n ih => + have hfin : ∀ i, (Y i).Finite := fun i => hE.subset (hY i) + by_cases hall : ∀ i, (Y i).Subsingleton + · -- Every set has one element. + have hne : ∀ i, (Y i).Nonempty := fun i => by + have h₁ := h {i} + have h₂ := hr.le_ncard (unionOver_subset hY {i}) + simp only [unionOver, Finset.card_singleton, Finset.mem_singleton, iUnion_iUnion_eq_left] + at h₁ h₂ + exact (ncard_pos (hfin i)).1 (by omega) + choose y hy using hne + have hun : unionOver Y Finset.univ = range y := by + ext x + simp only [unionOver, Finset.mem_univ, iUnion_true, mem_iUnion, mem_range] + exact exists_congr fun i => ⟨fun hx => (hall i) (hy i) hx, fun hx => hx ▸ hy i⟩ + have hsub : range y ⊆ E := fun x ⟨i, hi⟩ => hi ▸ hY i (hy i) + have h₁ := h Finset.univ + rw [hun, Finset.card_univ] at h₁ + have h₂ := hr.le_ncard hsub + have hcard : (range y).ncard ≤ Fintype.card ι := by + rw [← image_univ, ← Finset.coe_univ, ← Finset.coe_image, ncard_coe_finset] + exact Finset.card_image_le + refine ⟨y, hy, ?_, by omega⟩ + have : (Finset.univ.image y).card = (Finset.univ : Finset ι).card := by + have h₃ : (range y).ncard = (Finset.univ.image y).card := by + rw [← image_univ, ← Finset.coe_univ, ← Finset.coe_image, ncard_coe_finset] + rw [← h₃, Finset.card_univ] + omega + exact fun a b e => (Finset.card_image_iff.1 this) (by simp) (by simp) e + · push Not at hall + obtain ⟨i, hi⟩ := hall + obtain ⟨x, hx, x', hx', hne⟩ := hi + -- The set `Y` with `a` removed from `Y i`. + let Yo : α → ι → Set α := fun a => Function.update Y i (Y i \ {a}) + have hYo : ∀ a j, Yo a j ⊆ E := fun a j => by + by_cases hj : j = i + · subst hj + simp only [Yo, Function.update_self] + exact sdiff_subset.trans (hY j) + · simpa [Yo, hj] using hY j + have hYoY : ∀ a j, Yo a j ⊆ Y j := fun a j => by + by_cases hj : j = i + · subst hj + simp [Yo, sdiff_subset] + · simp [Yo, hj] + have hsum : ∀ a ∈ Y i, ∑ j, (Yo a j).ncard < n := fun a ha => by + rw [← hn] + refine Finset.sum_lt_sum (fun j _ => ncard_le_ncard (hYoY a j) (hfin j)) ⟨i, Finset.mem_univ + _, ?_⟩ + simp only [Yo, Function.update_self] + exact ncard_sdiff_singleton_lt_of_mem ha (hfin i) + by_cases h₁ : ∀ I : Finset ι, I.card ≤ r (unionOver (Yo x) I) + · obtain ⟨y, hy, hinj, hrk⟩ := ih _ (hsum x hx) (Yo x) (hYo x) h₁ rfl + exact ⟨y, fun j => hYoY x j (hy j), hinj, hrk⟩ + by_cases h₂ : ∀ I : Finset ι, I.card ≤ r (unionOver (Yo x') I) + · obtain ⟨y, hy, hinj, hrk⟩ := ih _ (hsum x' hx') (Yo x') (hYo x') h₂ rfl + exact ⟨y, fun j => hYoY x' j (hy j), hinj, hrk⟩ + exfalso + push Not at h₁ h₂ + obtain ⟨I₁, hI₁⟩ := h₁ + obtain ⟨I₂, hI₂⟩ := h₂ + -- The sets that fail both contain `i`. + have hmem : ∀ a (I : Finset ι), r (unionOver (Yo a) I) < I.card → i ∈ I := fun a I hI => by + by_contra hn' + have : unionOver (Yo a) I = unionOver Y I := by + refine iUnion₂_congr fun j hj => ?_ + have : j ≠ i := fun e => hn' (e ▸ hj) + simp [Yo, this] + rw [this] at hI + exact absurd (h I) (by omega) + have hi₁ := hmem x I₁ hI₁ + have hi₂ := hmem x' I₂ hI₂ + let A₁ := unionOver (Yo x) I₁ + let A₂ := unionOver (Yo x') I₂ + have hA₁ : A₁ ⊆ E := unionOver_subset (hYo x) I₁ + have hA₂ : A₂ ⊆ E := unionOver_subset (hYo x') I₂ + have hsm := hr.submodular hA₁ hA₂ + have hI₁' : r A₁ < I₁.card := hI₁ + have hI₂' : r A₂ < I₂.card := hI₂ + have hU : unionOver Y (I₁ ∪ I₂) ⊆ A₁ ∪ A₂ := by + refine iUnion₂_subset fun j hj z hz => ?_ + by_cases hji : j = i + · subst hji + by_cases hzx : z = x + · refine Or.inr (mem_iUnion₂.2 ⟨j, hi₂, ?_⟩) + simp only [Yo, Function.update_self] + exact ⟨hzx ▸ hx, by simpa [hzx] using hne⟩ + · refine Or.inl (mem_iUnion₂.2 ⟨j, hi₁, ?_⟩) + simp only [Yo, Function.update_self] + exact ⟨hz, by simpa using hzx⟩ + · rcases Finset.mem_union.1 hj with hj | hj + · exact Or.inl (mem_iUnion₂.2 ⟨j, hj, by simpa [Yo, hji] using hz⟩) + · exact Or.inr (mem_iUnion₂.2 ⟨j, hj, by simpa [Yo, hji] using hz⟩) + have hI : unionOver Y ((I₁ ∩ I₂).erase i) ⊆ A₁ ∩ A₂ := by + refine iUnion₂_subset fun j hj z hz => ?_ + obtain ⟨hji, hj⟩ := Finset.mem_erase.1 hj + obtain ⟨hj₁, hj₂⟩ := Finset.mem_inter.1 hj + exact ⟨mem_iUnion₂.2 ⟨j, hj₁, by simpa [Yo, hji] using hz⟩, mem_iUnion₂.2 ⟨j, hj₂, by simpa + [Yo, hji] using hz⟩⟩ + have h₃ := (h (I₁ ∪ I₂)).trans (hr.mono hU (union_subset hA₁ hA₂)) + have h₄ := (h ((I₁ ∩ I₂).erase i)).trans (hr.mono hI (inter_subset_left.trans hA₁)) + have hcard := Finset.card_union_add_card_inter I₁ I₂ + rw [Finset.card_erase_of_mem (Finset.mem_inter.2 ⟨hi₁, hi₂⟩)] at h₄ + have hpos : 0 < (I₁ ∩ I₂).card := Finset.card_pos.2 ⟨i, Finset.mem_inter.2 ⟨hi₁, hi₂⟩⟩ + omega + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section2.lean b/LeanPool/GraphMinor/RST94/Section2.lean new file mode 100644 index 0000000000..e3ccc0fcc8 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section2.lean @@ -0,0 +1,642 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Basic +public import LeanPool.GraphMinor.RST94.Rado + +/-! +# Section 2 of "Quickly excluding a planar graph": tangles + +Robertson, Seymour and Thomas, J. Combin. Theory Ser. B 62 (1994), Section 2, pages 326–330. + +The paper's rank `rk_𝒯` is `GM10.tangleRank`, and its free sets are `GM10.IsFreeSet`. Its (2.4) is +(12.1), (12.2) of Graph +Minors X, and its (2.8) is `GM10.theorem_2_9`. This file proves (2.5), (2.6), (2.7), (2.9), (2.10), +(2.11), (2.12). +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β : Type*} {G H A B C D : Hypergraph α β} {θ θ' : ℕ} + {T T' : Set (Hypergraph α β × Hypergraph α β)} + +/-- The set of all separations `(A, B)` of `G` of order `< θ'` with `(A ∩ H, B ∩ H) ∈ T'` (page +327): the tangle in `G` +induced by a tangle `T'` in a subgraph `H`. -/ +abbrev inducedTangle (G H : Hypergraph α β) (T' : Set (Hypergraph α β × Hypergraph α β)) (θ' : ℕ) : + Set (Hypergraph α β × Hypergraph α β) := + GM10.inducedTangleFromSubgraph G H θ' T' + +/-- **(2.5)** (page 327): the induced set is a tangle in `G` of order `ord(T')`. -/ +theorem isTangle_inducedTangle (hH : H ≤ G) (hT' : IsTangle H θ' T') : IsTangle G θ' + (inducedTangle G H T' θ') := + GM10.isTangle_inducedTangleFromSubgraph hH hT' + +/-- `T'`, a tangle of order `θ'` in `H`, is *conformal* with the tangle `T` in `G` of order `θ` +(page 327): the tangle +in `G` induced by `T'` is a subset of `T`. The paper reads `ord(T') ≤ ord(T)` as part of this, see +the proof of (2.6). -/ +def Conformal (G H : Hypergraph α β) (T T' : Set (Hypergraph α β × Hypergraph α β)) + (θ θ' : ℕ) : Prop := + θ' ≤ θ ∧ inducedTangle G H T' θ' ⊆ T + +/-- At most one of `(A, B)`, `(B, A)` is in a tangle, by the second axiom. -/ +theorem not_mem_swap (hT : IsTangle G θ T) (h : (A, B) ∈ T) : (B, A) ∉ T := fun h' => + hT.axiom2 h h' h (by + rw [GM10.union_assoc, GM10.union_comm B A, ← GM10.union_assoc, GM10.union_self] + exact (hT.isSeparation h).union_eq) + +/-- **(2.6)** (page 327). -/ +theorem conformal_iff (hH : H ≤ G) (hT : IsTangle G θ T) (hT' : IsTangle H θ' T') : + Conformal G H T T' θ θ' ↔ θ' ≤ θ ∧ ∀ A B, (A, B) ∈ T → separationOrder A B < θ' → + (A ∩ H, B ∩ H) ∈ T' := by + have hsep := fun {A B} (h : (A, B) ∈ T) => (hT.isSeparation h).restrict hH + refine and_congr_right fun hle => ⟨fun h A B hAB ho => ?_, fun h p hp => ?_⟩ + · have hs := hT.isSeparation hAB + rcases hT'.axiom1 (hs.restrict hH) ((order_restrict_le A B H).trans_lt ho) with h₁ | h₁ + · exact h₁ + · have : (B, A) ∈ T := h ⟨hs.symm, by rwa [separationOrder_comm], h₁⟩ + exact absurd hAB (not_mem_swap hT this) + · obtain ⟨hs, ho, hm⟩ := hp + rcases hT.axiom1 hs (ho.trans_le hle) with h₁ | h₁ + · exact h₁ + · have h₂ : (p.2 ∩ H, p.1 ∩ H) ∈ T' := h _ _ h₁ (by rwa [separationOrder_comm]) + exact absurd hm (not_mem_swap hT' h₂) + +/-- Conformality is transitive. -/ +theorem Conformal.trans {H₂ : Hypergraph α β} {T₂ : Set (Hypergraph α β × Hypergraph α β)} {θ₂ : ℕ} + (hH : H ≤ G) (hH₂ : H₂ ≤ H) (hT : IsTangle G θ T) (hT' : IsTangle H θ' T') + (hT₂ : IsTangle H₂ θ₂ T₂) + (h : Conformal G H T T' θ θ') (h₂ : Conformal H H₂ T' T₂ θ' θ₂) : Conformal G H₂ T T₂ θ θ₂ := by + obtain ⟨hle, hc⟩ := (conformal_iff hH hT hT').1 h + obtain ⟨hle₂, hc₂⟩ := (conformal_iff hH₂ hT' hT₂).1 h₂ + refine (conformal_iff (hH₂.trans hH) hT hT₂).2 ⟨hle₂.trans hle, fun A B hAB ho => ?_⟩ + have hs := hT.isSeparation hAB + have := hc₂ _ _ (hc A B hAB (ho.trans_le hle₂)) ((order_restrict_le A B H).trans_lt ho) + rwa [inter_inter_of_le hs.left_le hH hH₂, inter_inter_of_le hs.right_le hH hH₂] at this + +/-- A tangle is conformal with its truncations in the sense that a tangle with the same separations +of small order +inside `T` stays conformal. A tangle `T₀` in `G` with `T₀ ⊆ T` is conformal with `T`. -/ +theorem conformal_of_subset (_hT₀ : IsTangle G θ' T') (hle : θ' ≤ θ) (h : T' ⊆ T) : Conformal G G T + T' θ θ' := by + refine ⟨hle, fun p hp => h ?_⟩ + have := hp.2.2 + rwa [inter_eq_left_of_le hp.1.left_le, inter_eq_left_of_le hp.1.right_le] at this + +/-- **(2.7)** (page 328). -/ +theorem rank_le_of_conformal (hH : H ≤ G) (hT : IsTangle G θ T) (hT' : IsTangle H θ' T') + (hc : Conformal G H T T' θ θ') {X : Set α} (hX₀ : X ⊆ H.vertexSet) : tangleRank T' θ' X + ≤ tangleRank T θ X := by + obtain ⟨hle, hm⟩ := (conformal_iff hH hT hT').1 hc + by_contra hlt + push Not at hlt + have h₁ : tangleRank T θ X < θ' := hlt.trans_le (tangleRank_le_order hT' X) + obtain ⟨A, B, hAB, hX, ho⟩ := exists_mem_of_tangleRank_lt (h₁.trans_le hle) + have hX' : X ⊆ (A ∩ H).vertexSet := subset_inter hX hX₀ + have := tangleRank_le_separationOrder (θ := θ') (hm A B hAB (ho ▸ h₁)) hX' + have := order_restrict_le A B H + omega + +/-- The rank is at least `g` exactly when no separation of `T` of order below `g` holds `X` on its +small side. -/ +theorem le_rank_iff {X : Set α} {g : ℕ} (hg : g ≤ θ) : + g ≤ tangleRank T θ X ↔ ∀ A B, (A, B) ∈ T → X ⊆ A.vertexSet → g ≤ separationOrder A B := by + constructor + · intro h A B hAB hX + exact h.trans (tangleRank_le_separationOrder hAB hX) + · intro h + by_contra hlt + push Not at hlt + obtain ⟨A, B, hAB, hX, ho⟩ := exists_mem_of_tangleRank_lt (hlt.trans_le hg) + have := h A B hAB hX + omega + +/-- `A ∩ (G \ Z)` for a subgraph `A` of `G` is `A⁺ \ Z`, where `A⁺` is `A` with `Z` added. -/ +theorem deleteVertices_addVerts (hA : A ≤ G) {Z : Set α} (hZ : Z ⊆ G.vertexSet) : + (addVerts G A hA Z hZ).deleteVertices Z = A ∩ G.deleteVertices Z := by + refine sub_ext (G := G) ((deleteVertices_le _ _).trans addVerts_le) (inter_le hA + (deleteVertices_le _ _)) ?_ ?_ + · ext v + constructor + · rintro ⟨h | h, h'⟩ + · exact ⟨h, hA.vertexSet_subset h, h'⟩ + · exact absurd h h' + · exact fun h => ⟨Or.inl h.1, h.2.2⟩ + · ext e + constructor + · rintro ⟨he, h⟩ + refine ⟨he, hA.edgeSet_subset he, fun v hv hi => h v hv ⟨he, hi⟩⟩ + · rintro ⟨he, -, h⟩ + exact ⟨he, fun v hv hi => h v hv hi.2⟩ + +/-- **(2.9)** (page 328): `T \ Z` is conformal with `T`. The first assertion of (2.9) is (8.5) of +Graph Minors X, +`GM10.theorem_8_5_proof`. -/ +theorem conformal_deleteVertices (hG : G.IsGraph) (hT : IsTangle G θ T) {Z : Set α} + (hZ : Z ⊆ G.vertexSet) + (hlt : Z.ncard < θ) : + Conformal G (G.deleteVertices Z) T (deleteVerticesTangle G Z T θ) θ (θ - Z.ncard) := by + refine (conformal_iff (deleteVertices_le _ _) hT (GraphMinor.GM10.theorem_8_5_proof hG hT hZ + hlt)).2 ⟨by omega, fun A B hAB ho => ?_⟩ + have hs := hT.isSeparation hAB + have hs₁ := isSeparation_addVerts hs hZ + have ho₁ := order_addVerts_le hs hZ + have hm := GraphMinor.GM10.theorem_2_9_proof hT hAB hs₁ (by omega) (Or.inl fun v hv => Or.inl hv) + refine ⟨hs.restrict (deleteVertices_le _ _), (order_restrict_le A B _).trans_lt ho, ⟨_, _⟩, hm, + ?_, + deleteVertices_addVerts hs.left_le hZ, deleteVertices_addVerts hs.right_le hZ⟩ + exact fun v hv => ⟨Or.inr hv, Or.inr hv⟩ + +/-- Moving a set `F` of edges of `B`, with all ends in `V(A)`, from `B` to `A` keeps a separation in +`T`, by (2.8). -/ +theorem exists_move (hT : IsTangle G θ T) (hAB : (A, B) ∈ T) {F : Set β} + (hF : ∀ e ∈ F, e ∈ B.edgeSet ∧ ∀ v, G.Inc e v → v ∈ A.vertexSet) : + ∃ A₁ B₁ : Hypergraph α β, (A₁, B₁) ∈ T ∧ A₁.vertexSet = A.vertexSet ∧ A₁.edgeSet + = A.edgeSet ∪ F ∧ + B₁.vertexSet = B.vertexSet ∧ B₁.edgeSet = B.edgeSet \ F := by + have hs := hT.isSeparation hAB + have hA := hs.left_le + have hB := hs.right_le + let A₁ := subOf G A.vertexSet (A.edgeSet ∪ F) hA.vertexSet_subset (by + rintro e (he | he) + · exact ⟨hA.edgeSet_subset he, fun v hv => end_mem hA he hv⟩ + · exact ⟨hB.edgeSet_subset (hF e he).1, (hF e he).2⟩) + let B₁ := subOf G B.vertexSet (B.edgeSet \ F) hB.vertexSet_subset + fun e he => ⟨hB.edgeSet_subset he.1, fun v hv => end_mem hB he.1 hv⟩ + have hs₁ : G.IsSeparation A₁ B₁ := by + refine sep_of_sets subOf_le subOf_le (fun v hv => mem_V_or hs hv) (fun e he => ?_) ?_ + · by_cases heF : e ∈ F + · exact Or.inl (Or.inr heF) + · exact (mem_E_or hs he).imp Or.inl fun h => ⟨h, heF⟩ + · rintro e (he | he) he' + · exact hs.notMem_edgeSet_right he he'.1 + · exact he'.2 he + have ho : separationOrder A₁ B₁ = separationOrder A B := rfl + exact ⟨A₁, B₁, GraphMinor.GM10.theorem_2_9_proof hT hAB hs₁ (lt_of_eq_of_lt ho (hT.order_lt hAB)) + (Or.inl subset_rfl), rfl, rfl, rfl, rfl⟩ + +/-- Deleting from `B` vertices of `A` with no edge of `B` at them keeps a separation in `T`, by +(2.8). -/ +theorem exists_trim (hT : IsTangle G θ T) (hAB : (A, B) ∈ T) {W : Set α} (hW : W ⊆ A.vertexSet) + (hno : ∀ e ∈ B.edgeSet, ∀ w ∈ W, ¬ G.Inc e w) : + ∃ B₁ : Hypergraph α β, (A, B₁) ∈ T ∧ B₁.vertexSet = B.vertexSet \ W ∧ B₁.edgeSet = B.edgeSet + := by + have hs := hT.isSeparation hAB + have hB := hs.right_le + let B₁ := subOf G (B.vertexSet \ W) B.edgeSet (sdiff_subset.trans hB.vertexSet_subset) + fun e he => ⟨hB.edgeSet_subset he, fun v hv => ⟨end_mem hB he hv, fun hw => hno e he v hw hv⟩⟩ + have hs₁ : G.IsSeparation A B₁ := by + refine sep_of_sets hs.left_le subOf_le (fun v hv => ?_) (fun e he => mem_E_or hs he) + fun e he he' => hs.notMem_edgeSet_right he he' + by_cases hvW : v ∈ W + · exact Or.inl (hW hvW) + · exact (mem_V_or hs hv).imp id fun h => ⟨h, hvW⟩ + have ho : separationOrder A B₁ ≤ separationOrder A B := + ncard_le_ncard (fun v hv => ⟨hv.1, hv.2.1⟩) (A ∩ B).vertexSet_finite + exact ⟨B₁, GraphMinor.GM10.theorem_2_9_proof hT hAB hs₁ (ho.trans_lt (hT.order_lt hAB)) (Or.inr + (Or.inl subset_rfl)), rfl, rfl⟩ + +/-- **(2.10)** (page 329). -/ +theorem theorem_2_10 {ι : Type*} [Fintype ι] (hG : G.IsGraph) (hT : IsTangle G θ T) (z : ι → α) + (hz : Function.Injective z) (hfree : IsFreeSet G T θ (range z)) (hord : 2 * Fintype.card ι + ≤ θ) : + ∃ y : ι → α, Function.Injective y ∧ (∀ i, y i ∈ (G.deleteVertices (range z)).vertexSet) ∧ + (∀ i, G.skeleton.Adj (z i) (y i)) ∧ + IsFreeSet (G.deleteVertices (range z)) (deleteVerticesTangle G (range z) T θ) (θ - + (range z).ncard) (range y) := by + classical + have hk : (range z).ncard = Fintype.card ι := by + rw [← image_univ, ncard_image_of_injective _ hz, ncard_univ, Nat.card_eq_fintype_card] + have hθ := hT.one_le + have hlt : (range z).ncard < θ := by omega + have hZ := hfree.1 + have hT' := GraphMinor.GM10.theorem_8_5_proof hG hT hZ hlt + set Z := range z with hZdef + let Y : ι → Set α := fun i => {y | y ∈ (G.deleteVertices Z).vertexSet ∧ G.skeleton.Adj (z i) y} + have hY : ∀ i, Y i ⊆ (G.deleteVertices Z).vertexSet := fun i y hy => hy.1 + have hclaim : ∀ I : Finset ι, I.card ≤ tangleRank (deleteVerticesTangle G Z T θ) (θ - Z.ncard) + (unionOver Y I) := by + intro I + have hI : I.card ≤ Fintype.card ι := Finset.card_le_univ I + refine (le_rank_iff (by omega)).2 fun A' B' hm hU => ?_ + by_contra hcon + push Not at hcon + obtain ⟨hs', ho', ⟨A, B⟩, hAB, hZAB, hA', hB'⟩ := hm + simp only at hZAB hA' hB' + have hZA : Z ⊆ A.vertexSet := fun v hv => (hZAB hv).1 + let Zi : Set α := z '' I + have hZi : Zi ⊆ Z := image_subset_range _ _ + let F : Set β := {e | e ∈ B.edgeSet ∧ ∃ w ∈ Zi, G.Inc e w} + have hs := hT.isSeparation hAB + have hF : ∀ e ∈ F, e ∈ B.edgeSet ∧ ∀ v, G.Inc e v → v ∈ A.vertexSet := by + rintro e ⟨he, w, ⟨i, hi, rfl⟩, hw⟩ + refine ⟨he, fun v hv => ?_⟩ + by_cases hvZ : v ∈ Z + · exact hZA hvZ + · have hne : z i ≠ v := fun h => hvZ (h ▸ mem_range_self i) + have hmem : v ∈ unionOver Y I := mem_iUnion₂.2 ⟨i, hi, ⟨G.vertex_mem_of_inc hv, hvZ⟩, hne, + e, hw, hv⟩ + have := hU hmem + rw [← hA'] at this + exact this.1 + obtain ⟨A₁, B₁, hm₁, hVA, hEA, hVB, hEB⟩ := exists_move hT hAB hF + have hno : ∀ e ∈ B₁.edgeSet, ∀ w ∈ Zi, ¬ G.Inc e w := by + intro e he w hw hi + rw [hEB] at he + exact he.2 ⟨he.1, w, hw, hi⟩ + obtain ⟨B₂, hm₂, hVB₂, -⟩ := exists_trim hT hm₁ (hVA ▸ hZi.trans hZA) hno + have hle := hfree.2.2 hm₂ (hVA ▸ hZA) + have hsub : (A₁ ∩ B₂).vertexSet ⊆ (A' ∩ B').vertexSet ∪ (Z \ Zi) := by + rintro v ⟨hv₁, hv₂⟩ + rw [hVB₂, hVB] at hv₂ + rw [hVA] at hv₁ + by_cases hvZ : v ∈ Z + · exact Or.inr ⟨hvZ, hv₂.2⟩ + · refine Or.inl ⟨?_, ?_⟩ + · rw [← hA'] + exact ⟨hv₁, hvZ⟩ + · rw [← hB'] + exact ⟨hv₂.1, hvZ⟩ + have hZf : Z.Finite := finite_range z + have hcard : separationOrder A₁ B₂ ≤ separationOrder A' B' + (Z \ Zi).ncard := + (ncard_le_ncard hsub ((A' ∩ B').vertexSet_finite.union hZf.sdiff)).trans (ncard_union_le _ _) + have hdiff : (Z \ Zi).ncard = Z.ncard - Zi.ncard := ncard_sdiff hZi (hZf.subset hZi) + have hZic : Zi.ncard = I.card := by + have : Zi = ((I.image z : Finset α) : Set α) := by simp [Zi] + rw [this, ncard_coe_finset, Finset.card_image_of_injective _ hz] + have hZle : Zi.ncard ≤ Z.ncard := ncard_le_ncard hZi hZf + omega + obtain ⟨y, hy, hinj, hrk⟩ := rado (G.deleteVertices Z).vertexSet_finite + (GraphMinor.GM10.theorem_12_1_proof _ hT') Y hY hclaim + refine ⟨y, hinj, fun i => (hy i).1, fun i => (hy i).2, (isFreeSet_iff_tangleRank_eq hT').2 ?_⟩ + refine ⟨?_, ?_⟩ + · rintro _ ⟨i, rfl⟩ + exact (hy i).1 + · rw [hrk, ← image_univ, ncard_image_of_injective _ hinj, ncard_univ, Nat.card_eq_fintype_card] + +/-- The tangle `{(A ∩ D, B ∩ D) : (A, B) ∈ T}` in `D`, of (2.11). -/ +def restrictTangle (T : Set (Hypergraph α β × Hypergraph α β)) (D : Hypergraph α β) : + Set (Hypergraph α β × Hypergraph α β) := + {p | ∃ A B, (A, B) ∈ T ∧ p = (A ∩ D, B ∩ D)} + +section S211 + +variable (hT : IsTangle G θ T) (hCD : (C, D) ∈ T) (h0 : separationOrder C D = 0) + +include hT hCD h0 + +omit hT hCD in +/-- `C` and `D` have no common vertex. -/ +theorem inter_empty : (C ∩ D).vertexSet = ∅ := + (ncard_eq_zero (C ∩ D).vertexSet_finite).1 h0 + +/-- In the proof of (2.11): `(A ∪ C, B ∩ D) ∈ T` for `(A, B) ∈ T`. -/ +theorem union_inter_mem (hAB : (A, B) ∈ T) : (A ∪ C, B ∩ D) ∈ T := by + have hs := hT.isSeparation hAB + have hs' := hT.isSeparation hCD + have hs₁ := hs.union_inter hs' + have ho : separationOrder (A ∪ C) (B ∩ D) ≤ separationOrder A B := by + refine ncard_le_ncard ?_ (A ∩ B).vertexSet_finite + rintro v ⟨hv | hv, hv₁, hv₂⟩ + · exact ⟨hv, hv₁⟩ + · have : v ∈ (C ∩ D).vertexSet := ⟨hv, hv₂⟩ + rw [inter_empty h0] at this + exact this.elim + have ho' := ho.trans_lt (hT.order_lt hAB) + rcases hT.axiom1 hs₁ ho' with h | h + · exact h + · exfalso + refine hT.axiom2 hAB hCD h ?_ + refine sub_ext (G := G) (union_le (union_le hs.left_le hs'.left_le) hs₁.right_le) le_rfl ?_ ?_ + · refine subset_antisymm (union_subset (union_subset hs.left_le.vertexSet_subset + hs'.left_le.vertexSet_subset) + hs₁.right_le.vertexSet_subset) fun v hv => ?_ + rcases mem_V_or hs hv with h₁ | h₁ + · exact Or.inl (Or.inl h₁) + · rcases mem_V_or hs' hv with h₂ | h₂ + · exact Or.inl (Or.inr h₂) + · exact Or.inr ⟨h₁, h₂⟩ + · refine subset_antisymm (union_subset (union_subset hs.left_le.edgeSet_subset + hs'.left_le.edgeSet_subset) + hs₁.right_le.edgeSet_subset) fun v hv => ?_ + rcases mem_E_or hs hv with h₁ | h₁ + · exact Or.inl (Or.inl h₁) + · rcases mem_E_or hs' hv with h₂ | h₂ + · exact Or.inl (Or.inr h₂) + · exact Or.inr ⟨h₁, h₂⟩ + +/-- **(2.11)** (page 329), the tangle. -/ +theorem isTangle_restrictTangle : IsTangle D θ (restrictTangle T D) where + one_le := hT.one_le + isSeparation := by + rintro _ _ ⟨A, B, hAB, heq⟩ + obtain ⟨rfl, rfl⟩ := Prod.mk.inj heq + exact (hT.isSeparation hAB).restrict (hT.isSeparation hCD).right_le + order_lt := by + rintro _ _ ⟨A, B, hAB, heq⟩ + obtain ⟨rfl, rfl⟩ := Prod.mk.inj heq + exact (order_restrict_le A B D).trans_lt (hT.order_lt hAB) + axiom1 A' B' hs ho := by + have hs' := hT.isSeparation hCD + have hD := hs'.right_le + have hemp := inter_empty h0 + have hA'G : A' ≤ G := hs.left_le.trans hD + have hB'G : B' ≤ G := hs.right_le.trans hD + have hAC : A' ∪ C ≤ G := union_le hA'G hs'.left_le + have hs₁ : G.IsSeparation (A' ∪ C) B' := by + refine sep_of_sets hAC hB'G (fun v hv => ?_) (fun e he => ?_) ?_ + · rcases mem_V_or hs' hv with h | h + · exact Or.inl (Or.inr h) + · exact (mem_V_or hs h).imp Or.inl id + · rcases mem_E_or hs' he with h | h + · exact Or.inl (Or.inr h) + · exact (mem_E_or hs h).imp Or.inl id + · rintro e (he | he) he' + · exact hs.notMem_edgeSet_right he he' + · exact hs'.notMem_edgeSet_right he (hs.right_le.edgeSet_subset he') + have ho₁ : separationOrder (A' ∪ C) B' ≤ separationOrder A' B' := by + refine ncard_le_ncard ?_ (A' ∩ B').vertexSet_finite + rintro v ⟨hv | hv, hv'⟩ + · exact ⟨hv, hv'⟩ + · have : v ∈ (C ∩ D).vertexSet := ⟨hv, hs.right_le.vertexSet_subset hv'⟩ + rw [hemp] at this + exact this.elim + have hA'eq : (A' ∪ C) ∩ D = A' := by + refine sub_ext (G := G) (inter_le hAC hD) hA'G ?_ ?_ + · refine subset_antisymm ?_ fun v hv => ⟨Or.inl hv, hs.left_le.vertexSet_subset hv⟩ + rintro v ⟨hv | hv, hv'⟩ + · exact hv + · have : v ∈ (C ∩ D).vertexSet := ⟨hv, hv'⟩ + rw [hemp] at this + exact this.elim + · refine subset_antisymm ?_ fun v hv => ⟨Or.inl hv, hs.left_le.edgeSet_subset hv⟩ + rintro e ⟨he | he, he'⟩ + · exact he + · exact absurd he' (hs'.notMem_edgeSet_right he) + have hB'eq : B' ∩ D = B' := inter_eq_left_of_le hs.right_le + rcases hT.axiom1 hs₁ (ho₁.trans_lt ho) with h | h + · exact Or.inl ⟨_, _, h, by rw [hA'eq, hB'eq]⟩ + · exact Or.inr ⟨_, _, h, by rw [hA'eq, hB'eq]⟩ + axiom2 := by + rintro _ _ _ _ _ _ ⟨A₁, B₁, h₁, e₁⟩ ⟨A₂, B₂, h₂, e₂⟩ ⟨A₃, B₃, h₃, e₃⟩ heq + obtain ⟨rfl, rfl⟩ := Prod.mk.inj e₁ + obtain ⟨rfl, rfl⟩ := Prod.mk.inj e₂ + obtain ⟨rfl, rfl⟩ := Prod.mk.inj e₃ + have m₁ := union_inter_mem hT hCD h0 h₁ + have m₂ := union_inter_mem hT hCD h0 h₂ + have m₃ := union_inter_mem hT hCD h0 h₃ + have hs' := hT.isSeparation hCD + refine hT.axiom2 m₁ m₂ m₃ (sub_ext (G := G) (union_le (union_le (hT.isSeparation m₁).left_le + (hT.isSeparation m₂).left_le) (hT.isSeparation m₃).left_le) le_rfl ?_ ?_) + · refine subset_antisymm (union_subset (union_subset (hT.isSeparation + m₁).left_le.vertexSet_subset + (hT.isSeparation m₂).left_le.vertexSet_subset) (hT.isSeparation + m₃).left_le.vertexSet_subset) fun v hv => ?_ + rcases mem_V_or hs' hv with h | h + · exact Or.inl (Or.inl (Or.inr h)) + · have : v ∈ ((A₁ ∩ D) ∪ (A₂ ∩ D) ∪ (A₃ ∩ D)).vertexSet := by rw [heq]; exact h + rcases this with (h | h) | h + · exact Or.inl (Or.inl (Or.inl h.1)) + · exact Or.inl (Or.inr (Or.inl h.1)) + · exact Or.inr (Or.inl h.1) + · refine subset_antisymm (union_subset (union_subset (hT.isSeparation m₁).left_le.edgeSet_subset + (hT.isSeparation m₂).left_le.edgeSet_subset) (hT.isSeparation m₃).left_le.edgeSet_subset) + fun v hv => ?_ + rcases mem_E_or hs' hv with h | h + · exact Or.inl (Or.inl (Or.inr h)) + · have : v ∈ ((A₁ ∩ D) ∪ (A₂ ∩ D) ∪ (A₃ ∩ D)).edgeSet := by rw [heq]; exact h + rcases this with (h | h) | h + · exact Or.inl (Or.inl (Or.inl h.1)) + · exact Or.inl (Or.inr (Or.inl h.1)) + · exact Or.inr (Or.inl h.1) + axiom3 := by + rintro _ _ ⟨A, B, hAB, heq⟩ hV + obtain ⟨rfl, rfl⟩ := Prod.mk.inj heq + have m := union_inter_mem hT hCD h0 hAB + have hs' := hT.isSeparation hCD + refine hT.axiom3 m (subset_antisymm (hT.isSeparation m).left_le.vertexSet_subset fun v hv => ?_) + rcases mem_V_or hs' hv with h | h + · exact Or.inr h + · have : v ∈ (A ∩ D).vertexSet := by rw [hV]; exact h + exact Or.inl this.1 + +/-- **(2.11)** (page 329): it is conformal with `T`. -/ +theorem conformal_restrictTangle : Conformal G D T (restrictTangle T D) θ θ := + (conformal_iff (hT.isSeparation hCD).right_le hT (isTangle_restrictTangle hT hCD h0)).2 + ⟨le_rfl, fun A B hAB _ => ⟨A, B, hAB, rfl⟩⟩ + +end S211 + +/-- **(2.12)** (page 330): the paper's component `C` of `G \ Z`, given as a connected set of +vertices outside `Z`. -/ +theorem theorem_2_12 (hT : IsTangle G θ T) {Z : Set α} (hfree : IsFreeSet G T θ Z) + (hlt : Z.ncard < θ) : + ∃ C : Set α, Conn G C ∧ C ⊆ G.vertexSet ∧ Disjoint C Z ∧ ∀ v ∈ Z, ∃ y ∈ C, G.skeleton.Adj v y + := by + classical + have hZ := hfree.1 + -- Choose `(A, B) ∈ T` with `V(A ∩ B) = Z` and with `B` minimal. + let P : Hypergraph α β × Hypergraph α β → Prop := fun p => p ∈ T ∧ (p.1 ∩ p.2).vertexSet = Z + have hex : ∃ p, P p := by + let K := subOf G Z ∅ hZ (fun _ he => he.elim) + have hK : K ≤ G := subOf_le + have hs : G.IsSeparation K G := sep_of_sets hK le_rfl (fun _ h => Or.inr h) (fun _ h + => Or.inr h) + fun _ he => he.elim + have hV : (K ∩ G).vertexSet = Z := subset_antisymm (fun _ h => h.1) fun v hv => ⟨hv, hZ hv⟩ + have ho : separationOrder K G < θ := by + unfold separationOrder + rwa [hV] + rcases hT.axiom1 hs ho with h | h + · exact ⟨(K, G), h, hV⟩ + · exact absurd rfl (hT.axiom3 h) + obtain ⟨⟨A, B⟩, ⟨hAB, hZeq⟩, hmin⟩ := exists_min_measure (fun p : Hypergraph α β × Hypergraph α β + => size p.2) hex + simp only at hZeq hmin + have hs := hT.isSeparation hAB + have hZA : Z ⊆ A.vertexSet := fun v hv => (hZeq ▸ hv : v ∈ (A ∩ B).vertexSet).1 + have hZB : Z ⊆ B.vertexSet := fun v hv => (hZeq ▸ hv : v ∈ (A ∩ B).vertexSet).2 + have hord : separationOrder A B = Z.ncard := by + unfold separationOrder + rw [hZeq] + -- Each edge of `B` has an end outside `Z`. + have hend : ∀ e ∈ B.edgeSet, ∃ y, G.Inc e y ∧ y ∉ Z := by + intro e he + by_contra hcon + push Not at hcon + obtain ⟨A₁, B₁, hm, hVA, hEA, hVB, hEB⟩ := exists_move (F := {e}) hT hAB (by + rintro f rfl + exact ⟨he, fun v hv => hZA (hcon v hv)⟩) + have hs₁ := hT.isSeparation hm + have hle : B₁ ≤ B := le_of_sets hs₁.right_le hs.right_le hVB.subset (hEB ▸ sdiff_subset) + have hne : B₁ ≠ B := fun h => (hEB ▸ h ▸ he : e ∈ B.edgeSet \ {e}).2 rfl + have := hmin (A₁, B₁) ⟨hm, by + change A₁.vertexSet ∩ B₁.vertexSet = Z + rw [hVA, hVB] + exact hZeq⟩ + simp only at this + exact absurd (size_lt_of_lt hle hne) (by omega) + let C : Set α := B.vertexSet \ Z + have hCne : C.Nonempty := by + by_contra hcon + have hsub : B.vertexSet ⊆ Z := fun v hv => by + by_contra hvZ + exact hcon ⟨v, hv, hvZ⟩ + refine hT.axiom3 hAB (subset_antisymm hs.left_le.vertexSet_subset fun v hv => ?_) + exact (mem_V_or hs hv).elim id fun h => hZA (hsub h) + have hCconn : Conn G C := by + by_contra hcon + obtain ⟨X₁, X₂, hX₁, hX₂, hun, hdis, hno⟩ := exists_split_of_not_conn hCne hcon + have hsubB : ∀ {X}, X ∪ Z ⊆ B.vertexSet ∨ X ⊆ C → X ∪ Z ⊆ G.vertexSet := fun {X} h => by + rcases h with h | h + · exact h.trans hs.right_le.vertexSet_subset + · exact union_subset (h.trans fun v hv => hs.right_le.vertexSet_subset hv.1) hZ + have hX₁C : X₁ ⊆ C := fun v hv => hun ▸ Or.inl hv + have hX₂C : X₂ ⊆ C := fun v hv => hun ▸ Or.inr hv + have hsplit : ∀ v, v ∈ B.vertexSet → v ∈ X₁ ∨ v ∈ X₂ ∨ v ∈ Z := fun v hv => by + by_cases hvZ : v ∈ Z + · exact Or.inr (Or.inr hvZ) + · have : v ∈ C := ⟨hv, hvZ⟩ + rw [← hun] at this + exact this.elim Or.inl (fun h => Or.inr (Or.inl h)) + let F₁ : Set β := {e | e ∈ B.edgeSet ∧ ∃ y ∈ X₁, G.Inc e y} + let F₂ : Set β := {e | e ∈ B.edgeSet ∧ ¬ ∃ y ∈ X₁, G.Inc e y} + let B₁ := subOf G (X₁ ∪ Z) F₁ (hsubB (Or.inr hX₁C)) (by + rintro e ⟨he, y, hy, hi⟩ + refine ⟨hs.right_le.edgeSet_subset he, fun v hv => ?_⟩ + rcases hsplit v (end_mem hs.right_le he hv) with h | h | h + · exact Or.inl h + · exact (hno y hy v h ⟨fun e' => disjoint_left.1 hdis hy (e' ▸ h), e, hi, hv⟩).elim + · exact Or.inr h) + let B₂ := subOf G (X₂ ∪ Z) F₂ (hsubB (Or.inr hX₂C)) (by + rintro e ⟨he, hn⟩ + refine ⟨hs.right_le.edgeSet_subset he, fun v hv => ?_⟩ + rcases hsplit v (end_mem hs.right_le he hv) with h | h | h + · exact (hn ⟨v, h, hv⟩).elim + · exact Or.inl h + · exact Or.inr h) + have hB₁ : B₁ ≤ G := subOf_le + have hB₂ : B₂ ≤ G := subOf_le + have hB₁B : B₁ ≤ B := le_of_sets hB₁ hs.right_le + (union_subset (hX₁C.trans fun _ h => h.1) hZB) fun _ h => h.1 + have hB₂B : B₂ ≤ B := le_of_sets hB₂ hs.right_le + (union_subset (hX₂C.trans fun _ h => h.1) hZB) fun _ h => h.1 + have hcover : ∀ e ∈ G.edgeSet, e ∉ A.edgeSet → e ∈ F₁ ∨ e ∈ F₂ := fun e he heA => by + have heB := (mem_E_or hs he).resolve_left heA + by_cases h : ∃ y ∈ X₁, G.Inc e y + · exact Or.inl ⟨heB, h⟩ + · exact Or.inr ⟨heB, h⟩ + have hcoverV : ∀ v ∈ G.vertexSet, v ∉ A.vertexSet → v ∈ X₁ ∨ v ∈ X₂ := fun v hv hvA => by + have hvB := (mem_V_or hs hv).resolve_left hvA + rcases hsplit v hvB with h | h | h + · exact Or.inl h + · exact Or.inr h + · exact absurd (hZA h) hvA + have hXA : ∀ {X}, X ⊆ C → ∀ v ∈ X, v ∉ A.vertexSet := fun {X} h v hv hvA => + (h hv).2 (hZeq ▸ ⟨hvA, (h hv).1⟩) + -- `(A ∪ B₁, B₂)` and `(A ∪ B₂, B₁)` are separations of order `|Z|`, with smaller right side + -- than `B`. + have hs₁ : G.IsSeparation (A ∪ B₁) B₂ := by + refine sep_of_sets (union_le hs.left_le hB₁) hB₂ (fun v hv => ?_) (fun e he => ?_) ?_ + · by_cases hvA : v ∈ A.vertexSet + · exact Or.inl (Or.inl hvA) + · exact (hcoverV v hv hvA).elim (fun h => Or.inl (Or.inr (Or.inl h))) + (fun h => Or.inr (Or.inl h)) + · by_cases heA : e ∈ A.edgeSet + · exact Or.inl (Or.inl heA) + · exact (hcover e he heA).elim (fun h => Or.inl (Or.inr h)) Or.inr + · rintro e (he | he) he' + · exact hs.notMem_edgeSet_right he he'.1 + · exact he'.2 he.2 + have hs₂ : G.IsSeparation (A ∪ B₂) B₁ := by + refine sep_of_sets (union_le hs.left_le hB₂) hB₁ (fun v hv => ?_) (fun e he => ?_) ?_ + · by_cases hvA : v ∈ A.vertexSet + · exact Or.inl (Or.inl hvA) + · exact (hcoverV v hv hvA).elim (fun h => Or.inr (Or.inl h)) fun h => Or.inl (Or.inr + (Or.inl h)) + · by_cases heA : e ∈ A.edgeSet + · exact Or.inl (Or.inl heA) + · exact (hcover e he heA).elim Or.inr fun h => Or.inl (Or.inr h) + · rintro e (he | he) he' + · exact hs.notMem_edgeSet_right he he'.1 + · exact he.2 he'.2 + have hV₁ : ((A ∪ B₁) ∩ B₂).vertexSet = Z := by + refine subset_antisymm ?_ fun v hv => ⟨Or.inl (hZA hv), Or.inr hv⟩ + rintro v ⟨hv | hv | hv, hv' | hv'⟩ + · exact absurd hv (hXA hX₂C v hv') + · exact hv' + · exact absurd hv' (disjoint_left.1 hdis hv) + · exact hv' + · exact hv + · exact hv + have hV₂ : ((A ∪ B₂) ∩ B₁).vertexSet = Z := by + refine subset_antisymm ?_ fun v hv => ⟨Or.inl (hZA hv), Or.inr hv⟩ + rintro v ⟨hv | hv | hv, hv' | hv'⟩ + · exact absurd hv (hXA hX₁C v hv') + · exact hv' + · exact absurd hv (disjoint_left.1 hdis hv') + · exact hv' + · exact hv + · exact hv + have ho₁ : separationOrder (A ∪ B₁) B₂ < θ := by + unfold separationOrder + rwa [hV₁] + have ho₂ : separationOrder (A ∪ B₂) B₁ < θ := by + unfold separationOrder + rwa [hV₂] + have hne₁ : B₁ ≠ B := fun h => by + obtain ⟨y, hy⟩ := hX₂ + have : y ∈ B₁.vertexSet := h ▸ (hX₂C hy).1 + rcases this with h' | h' + · exact disjoint_left.1 hdis h' hy + · exact (hX₂C hy).2 h' + have hne₂ : B₂ ≠ B := fun h => by + obtain ⟨y, hy⟩ := hX₁ + have : y ∈ B₂.vertexSet := h ▸ (hX₁C hy).1 + rcases this with h' | h' + · exact disjoint_left.1 hdis hy h' + · exact (hX₁C hy).2 h' + have hn₁ : (A ∪ B₁, B₂) ∉ T := fun hm => by + have := hmin (A ∪ B₁, B₂) ⟨hm, hV₁⟩ + exact absurd (size_lt_of_lt hB₂B hne₂) (by simp only at this; omega) + have hn₂ : (A ∪ B₂, B₁) ∉ T := fun hm => by + have := hmin (A ∪ B₂, B₁) ⟨hm, hV₂⟩ + exact absurd (size_lt_of_lt hB₁B hne₁) (by simp only at this; omega) + have hm₁ := (hT.axiom1 hs₁ ho₁).resolve_left hn₁ + have hm₂ := (hT.axiom1 hs₂ ho₂).resolve_left hn₂ + refine hT.axiom2 hAB hm₁ hm₂ ?_ + rw [← hs₁.union_eq, GM10.union_assoc, GM10.union_comm B₂ B₁, ← GM10.union_assoc] + refine ⟨C, hCconn, fun v hv => hs.right_le.vertexSet_subset hv.1, disjoint_sdiff_left, fun v hv + => ?_⟩ + by_contra hcon + push Not at hcon + have hno : ∀ e ∈ B.edgeSet, ∀ w ∈ ({v} : Set α), ¬ G.Inc e w := by + rintro e he w rfl hi + obtain ⟨y, hy, hyZ⟩ := hend e he + have hyC : y ∈ C := ⟨end_mem hs.right_le he hy, hyZ⟩ + exact hcon y hyC ⟨fun h => hyZ (h ▸ hv), e, hi, hy⟩ + obtain ⟨B₁, hm, hVB, -⟩ := exists_trim hT hAB (W := {v}) (singleton_subset_iff.2 (hZA hv)) hno + have hle := hfree.2.2 hm hZA + have hsub : (A ∩ B₁).vertexSet ⊆ Z \ {v} := by + rintro x ⟨h₁, h₂⟩ + rw [hVB] at h₂ + exact ⟨hZeq ▸ ⟨h₁, h₂.1⟩, h₂.2⟩ + have hfZ : Z.Finite := G.vertexSet_finite.subset hZ + have := ncard_le_ncard hsub hfZ.sdiff + have h₃ := ncard_sdiff_singleton_lt_of_mem hv hfZ + unfold separationOrder at hle + omega + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section3a.lean b/LeanPool/GraphMinor/RST94/Section3a.lean new file mode 100644 index 0000000000..2fce5c9067 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section3a.lean @@ -0,0 +1,265 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section2 + +/-! +# Section 3 of "Quickly excluding a planar graph": the lemma (3.1) + +Robertson, Seymour and Thomas, J. Combin. Theory Ser. B 62 (1994), (3.1), pages 330–332. Paths are +`PathFromTo` of the +skeleton of `G`, and the vertex set of a path is `pathV`. + +The paper phrases (3.1) with a tangle of order `6k`. The proof uses only that one side of a +separation of order `< 6k` +holds few vertices of `Z`, so we use `min_le_order` for that. The lemmas here are not used outside +this file, except for +`theorem_3_1` and `exists_lift`. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β : Type*} {G H A B C D : Hypergraph α β} + +/-- An edge of a graph has at most two ends. -/ +theorem end_eq_or (hG : G.IsGraph) {e : β} {w x v : α} (hw : G.Inc e w) (hx : G.Inc e x) + (hwx : w ≠ x) + (hv : G.Inc e v) : v = w ∨ v = x := by + classical + by_contra hcon + push Not at hcon + have he := G.edge_mem_of_inc hw + have hf : (G.ends e).Finite := G.vertexSet_finite.subset fun _ h => G.vertex_mem_of_inc h + have h₂ := (hG e he).2 + have hs : ({v, w, x} : Set α) ⊆ G.ends e := by + rintro y (rfl | rfl | rfl) + · exact hv + · exact hw + · exact hx + have h₃ : ({v, w, x} : Set α).ncard = 3 := ncard_eq_three.2 ⟨v, w, x, hcon.1, hcon.2, hwx, rfl⟩ + have := ncard_le_ncard hs hf + omega + +/-- Lifting a separation of `G \ W` to a separation of `G` with `W` on both sides. -/ +theorem exists_lift (hG : G.IsGraph) {W : Set α} (hW : W ⊆ G.vertexSet) {A' B' : Hypergraph α β} + (hs : (G.deleteVertices W).IsSeparation A' B') : + ∃ A B : Hypergraph α β, G.IsSeparation A B ∧ A.vertexSet = A'.vertexSet ∪ W ∧ B.vertexSet + = B'.vertexSet ∪ W ∧ + A'.edgeSet ⊆ A.edgeSet ∧ B'.edgeSet ⊆ B.edgeSet := by + classical + have hDG := deleteVertices_le G W + have hA' : A' ≤ G := hs.left_le.trans hDG + have hB' : B' ≤ G := hs.right_le.trans hDG + let F₁ : Set β := {e | e ∈ G.edgeSet ∧ e ∉ (G.deleteVertices W).edgeSet ∧ ∀ v, G.Inc e v + → v ∈ A'.vertexSet ∪ W} + let F₂ : Set β := {e | e ∈ G.edgeSet ∧ e ∉ (G.deleteVertices W).edgeSet ∧ ¬ ∀ v, G.Inc e v + → v ∈ A'.vertexSet ∪ W} + let A := subOf G (A'.vertexSet ∪ W) (A'.edgeSet ∪ F₁) (union_subset hA'.vertexSet_subset hW) (by + rintro e (he | he) + · exact ⟨hA'.edgeSet_subset he, fun v hv => Or.inl (end_mem hA' he hv)⟩ + · exact ⟨he.1, he.2.2⟩) + let B := subOf G (B'.vertexSet ∪ W) (B'.edgeSet ∪ F₂) (union_subset hB'.vertexSet_subset hW) (by + rintro e (he | ⟨heG, hn, hc⟩) + · exact ⟨hB'.edgeSet_subset he, fun v hv => Or.inl (end_mem hB' he hv)⟩ + · refine ⟨heG, fun v hv => ?_⟩ + -- The edge has an end in `W`, and an end `x` outside `V(A') ∪ W`, so these are all its ends. + have hw : ∃ w ∈ W, G.Inc e w := by + by_contra hno + push Not at hno + exact hn ⟨heG, hno⟩ + obtain ⟨w, hwW, hwi⟩ := hw + push Not at hc + obtain ⟨x, hxi, hx⟩ := hc + have hxW : x ∉ W := fun h => hx (Or.inr h) + have hne : w ≠ x := fun h => hxW (h ▸ hwW) + rcases end_eq_or hG hwi hxi hne hv with rfl | rfl + · exact Or.inr hwW + · refine Or.inl ((mem_V_or hs ?_).resolve_left fun h => hx (Or.inl h)) + exact ⟨G.vertex_mem_of_inc hxi, hxW⟩) + have hsep : G.IsSeparation A B := by + refine sep_of_sets subOf_le subOf_le (fun v hv => ?_) (fun e he => ?_) ?_ + · by_cases hvW : v ∈ W + · exact Or.inl (Or.inr hvW) + · exact (mem_V_or hs ⟨hv, hvW⟩).imp Or.inl Or.inl + · by_cases hed : e ∈ (G.deleteVertices W).edgeSet + · exact (mem_E_or hs hed).imp Or.inl Or.inl + · by_cases hc : ∀ v, G.Inc e v → v ∈ A'.vertexSet ∪ W + · exact Or.inl (Or.inr ⟨he, hed, hc⟩) + · exact Or.inr (Or.inr ⟨he, hed, hc⟩) + · rintro e (he | he) (he' | he') + · exact hs.notMem_edgeSet_right he he' + · exact he'.2.1 (hs.left_le.edgeSet_subset he) + · exact he.2.1 (hs.right_le.edgeSet_subset he') + · exact he'.2.2 he.2.2 + exact ⟨A, B, hsep, rfl, rfl, fun e he => Or.inl he, fun e he => Or.inl he⟩ + +/-- A connected set that meets `V(A) \ V(B)` and `V(B) \ V(A)` meets `V(A ∩ B)`. -/ +theorem Conn.meets_sep (hs : G.IsSeparation A B) {X : Set α} (hX : Conn G X) {a b : α} (ha : a ∈ X) + (hb : b ∈ X) + (haA : a ∈ A.vertexSet) (hbB : b ∈ B.vertexSet) : ∃ x ∈ X, x ∈ (A ∩ B).vertexSet := by + obtain ⟨w, hw⟩ := hX.2 a ha b hb + induction w with + | nil => exact ⟨_, ha, haA, hbB⟩ + | @cons u v t hadj p ih => + have hu := hw u (by simp) + have hrest : ∀ z ∈ p.support, z ∈ X := fun z hz => hw z (by simp [hz]) + by_cases hvA : v ∈ A.vertexSet + · exact ih (hrest v p.start_mem_support) hb hvA hbB hrest + · -- The edge from `u` to `v` is not in `A`, so it is in `B`. + obtain ⟨-, e, h₁, h₂⟩ := hadj + have heG := G.edge_mem_of_inc h₁ + have heB : e ∈ B.edgeSet := (mem_E_or hs heG).resolve_left fun he => hvA + (end_mem hs.left_le he h₂) + exact ⟨u, hu, haA, end_mem hs.right_le heB h₁⟩ + +/-- A separation with `X ⊆ V(A)`, `Y ⊆ V(B)` has order at least the number of disjoint paths from +`X` to `Y`. -/ +theorem le_order_of_paths (hs : G.IsSeparation A B) {X Y : Set α} {k : ℕ} (hX : X ⊆ A.vertexSet) + (hY : Y ⊆ B.vertexSet) + (hp : HasDisjointPaths G.skeleton X Y k) : k ≤ separationOrder A B := + (menger G X Y (hX.trans hs.left_le.vertexSet_subset) (hY.trans hs.right_le.vertexSet_subset) k).2 + hp A B hs hX hY + +variable {Z : Set α} {k : ℕ} + +/-- `Z` is *linked* in `G`: the hypothesis of (3.1). -/ +def Linked (G : Hypergraph α β) (Z : Set α) : Prop := + ∀ X Y : Set α, X ⊆ Z → Y ⊆ Z → X.ncard = Y.ncard → HasDisjointPaths G.skeleton X Y X.ncard + +/-- In (3.1): one side of a separation has at most as many vertices of `Z` as the order of the +separation. This is what +makes the paper's set of separations a tangle. -/ +theorem min_le_order (hZ : Z.Finite) (hl : Linked G Z) (hs : G.IsSeparation A B) : + (A.vertexSet ∩ Z).ncard ≤ separationOrder A B ∨ (B.vertexSet ∩ Z).ncard ≤ separationOrder A B + := by + have hA : (A.vertexSet ∩ Z).Finite := hZ.subset inter_subset_right + have hB : (B.vertexSet ∩ Z).Finite := hZ.subset inter_subset_right + rcases le_total (A.vertexSet ∩ Z).ncard (B.vertexSet ∩ Z).ncard with h | h + · obtain ⟨Y, hY, hc⟩ := exists_subset_card_eq h + exact Or.inl (le_order_of_paths hs inter_subset_left (hY.trans inter_subset_left) + (hl _ _ inter_subset_right (hY.trans inter_subset_right) hc.symm)) + · obtain ⟨X, hX, hc⟩ := exists_subset_card_eq h + have := le_order_of_paths hs (hX.trans inter_subset_left) inter_subset_left + (hl _ _ (hX.trans inter_subset_right) inter_subset_right hc) + exact Or.inr (hc ▸ this) + +/-- The vertex set `V(P)` of a path. -/ +def pathV {K : SimpleGraph α} {X Y : Set α} (p : PathFromTo K X Y) : Set α + := {x | x ∈ p.walk.support} + +/-- A vertex set is *light* if a separation of order at most `5k` holds it on the side with few +vertices of `Z`. Light is +the paper's `rk_𝒯(V(P)) ≤ 5k` for the tangle in the proof of (3.1). -/ +def Light (G : Hypergraph α β) (Z : Set α) (k : ℕ) (W : Set α) : Prop := + ∃ C D, G.IsSeparation C D ∧ W ⊆ C.vertexSet ∧ separationOrder C D ≤ 5 * k ∧ + (C.vertexSet ∩ Z).ncard ≤ separationOrder C D + +/-- The conclusion of (3.1) for the vertex set `W` of `P`. -/ +def Good (G : Hypergraph α β) (Z : Set α) (k : ℕ) (W : Set α) : Prop := + ∀ A B, (G.deleteVertices W).IsSeparation A B → separationOrder A B < k → + ¬ (6 * k ≤ (A.vertexSet ∩ Z).ncard ∧ 6 * k ≤ (B.vertexSet ∩ Z).ncard) + +/-- The end of the proof of (1) in (3.1). -/ +private theorem light_aux (hZ : Z.Finite) (hl : Linked G Z) (_hk : 1 ≤ k) (hs : G.IsSeparation A B) + (hCD : G.IsSeparation C D) {W : Set α} (hWC : W ⊆ C.vertexSet) + (ho : separationOrder C D ≤ 5 * k) (hR : ((A ∩ B).vertexSet \ W).ncard < k) + (hAD : 13 * k ≤ 2 * (A.vertexSet ∩ D.vertexSet ∩ Z).ncard) (hBZ : 6 * k + 2 ≤ + (B.vertexSet ∩ Z).ncard) : False := by + have hs₁ : G.IsSeparation (A ∩ D) (B ∪ C) := (hs.symm.union_inter hCD).symm + have hsub : ((A ∩ D) ∩ (B ∪ C)).vertexSet ⊆ (C ∩ D).vertexSet ∪ ((A ∩ B).vertexSet \ W) := by + rintro x ⟨⟨hxA, hxD⟩, hx | hx⟩ + · by_cases hxC : x ∈ C.vertexSet + · exact Or.inl ⟨hxC, hxD⟩ + · exact Or.inr ⟨⟨hxA, hx⟩, fun h => hxC (hWC h)⟩ + · exact Or.inl ⟨hx, hxD⟩ + have hfin : ((A ∩ B).vertexSet \ W).Finite := (A ∩ B).vertexSet_finite.sdiff + have ho₁ : separationOrder (A ∩ D) (B ∪ C) ≤ separationOrder C D + ((A ∩ B).vertexSet \ W).ncard + := + (ncard_le_ncard hsub ((C ∩ D).vertexSet_finite.union hfin)).trans (ncard_union_le _ _) + rcases min_le_order hZ hl hs₁ with h | h + · have : (A.vertexSet ∩ D.vertexSet ∩ Z).ncard ≤ ((A ∩ D).vertexSet ∩ Z).ncard := le_of_eq rfl + omega + · have : (B.vertexSet ∩ Z).ncard ≤ ((B ∪ C).vertexSet ∩ Z).ncard := + ncard_le_ncard (fun x hx => ⟨Or.inl hx.1, hx.2⟩) (hZ.subset inter_subset_right) + omega + +/-- If `P` does not satisfy (3.1), there is a separation `(A, B)` of `G` with `V(P) ⊆ V(A ∩ B)`, +`|V(A ∩ B) - V(P)| < k` and +`|V(A) ∩ Z|, |V(B) ∩ Z| ≥ 6k + 2`. These are the first lines of the proofs of (1) and of (3.1). -/ +theorem exists_sep_of_not_good (hG : G.IsGraph) (hZf : Z.Finite) {W : Set α} + (hW : W ⊆ G.vertexSet) {s t : α} + (hst : s ≠ t) (hs : s ∈ Z ∩ W) (ht : t ∈ Z ∩ W) (hg : ¬ Good G Z k W) : + ∃ A B A' B', G.IsSeparation A B ∧ W ⊆ A.vertexSet ∧ W ⊆ B.vertexSet ∧ + ((A ∩ B).vertexSet \ W).ncard < k ∧ + 6 * k + 2 ≤ (A.vertexSet ∩ Z).ncard ∧ 6 * k + 2 ≤ (B.vertexSet ∩ Z).ncard ∧ + (G.deleteVertices W).IsSeparation A' B' ∧ A.vertexSet = A'.vertexSet ∪ W ∧ B.vertexSet + = B'.vertexSet ∪ W ∧ + separationOrder A' B' < k := by + unfold Good at hg + push Not at hg + obtain ⟨A', B', hs', ho, hA6, hB6⟩ := hg + obtain ⟨A, B, hsep, hVA, hVB, -, -⟩ := exists_lift hG hW hs' + have hnotW : ∀ {X : Hypergraph α β}, X ≤ G.deleteVertices W → ∀ x ∈ X.vertexSet, x ∉ W + := fun h x hx => + (h.vertexSet_subset hx).2 + have hplus : ∀ {X X₁ : Hypergraph α β}, X ≤ G.deleteVertices W → X₁.vertexSet = X.vertexSet ∪ W → + (X.vertexSet ∩ Z).ncard + 2 ≤ (X₁.vertexSet ∩ Z).ncard := fun {X X₁} h hV => by + have hsub : (X.vertexSet ∩ Z) ∪ {s, t} ⊆ X₁.vertexSet ∩ Z := by + rintro x (hx | rfl | rfl) + · exact ⟨hV ▸ Or.inl hx.1, hx.2⟩ + · exact ⟨hV ▸ Or.inr hs.2, hs.1⟩ + · exact ⟨hV ▸ Or.inr ht.2, ht.1⟩ + have hdis : Disjoint (X.vertexSet ∩ Z) {s, t} := by + refine disjoint_left.2 fun x hx hx' => hnotW h x hx.1 ?_ + rcases hx' with rfl | rfl + · exact hs.2 + · exact ht.2 + have := ncard_le_ncard hsub (hZf.subset inter_subset_right) + rw [ncard_union_eq hdis (hZf.subset inter_subset_right) (toFinite _), ncard_pair hst] at this + exact this + have hAZ := hplus hs'.left_le hVA + have hBZ := hplus hs'.right_le hVB + have hR : ((A ∩ B).vertexSet \ W).ncard < k := by + have hsub : (A ∩ B).vertexSet \ W ⊆ (A' ∩ B').vertexSet := by + rintro x ⟨⟨h₁, h₂⟩, hxW⟩ + rw [hVA] at h₁ + rw [hVB] at h₂ + exact ⟨h₁.resolve_right hxW, h₂.resolve_right hxW⟩ + exact (ncard_le_ncard hsub (A' ∩ B').vertexSet_finite).trans_lt ho + exact ⟨A, B, A', B', hsep, hVA ▸ subset_union_right, hVB ▸ subset_union_right, hR, by omega, by + omega, hs', hVA, hVB, ho⟩ + +/-- **(1)** in the proof of (3.1) (page 331). -/ +theorem good_of_light (hG : G.IsGraph) (hZsub : Z ⊆ G.vertexSet) (hZf : Z.Finite) (hZc : Z.ncard + = 18 * k) + (hl : Linked G Z) (hk : 1 ≤ k) {W : Set α} (hW : W ⊆ G.vertexSet) {s t : α} (hst : s ≠ t) + (hs : s ∈ Z ∩ W) + (ht : t ∈ Z ∩ W) (hL : Light G Z k W) : Good G Z k W := by + by_contra hg + obtain ⟨A, B, -, -, hsep, -, -, hR, hAZ, hBZ, -⟩ := exists_sep_of_not_good hG hZf hW hst hs ht hg + obtain ⟨C, D, hCD, hWC, hoC, hCZ⟩ := hL + have hcov : Z ⊆ (C.vertexSet ∩ Z) ∪ (D.vertexSet ∩ Z) := fun x hx => + (mem_V_or hCD (hZsub hx)).imp (fun h => ⟨h, hx⟩) fun h => ⟨h, hx⟩ + have hfin : ∀ X : Set α, (X ∩ Z).Finite := fun X => hZf.subset inter_subset_right + have h₁ := (ncard_le_ncard hcov ((hfin _).union (hfin _))).trans (ncard_union_le _ _) + have hcov₂ : D.vertexSet ∩ Z ⊆ (A.vertexSet ∩ D.vertexSet ∩ Z) ∪ (B.vertexSet ∩ D.vertexSet ∩ Z) + := fun x hx => + (mem_V_or hsep (hZsub hx.2)).imp (fun h => ⟨⟨h, hx.1⟩, hx.2⟩) fun h => ⟨⟨h, hx.1⟩, hx.2⟩ + have h₂ := (ncard_le_ncard hcov₂ ((hfin _).union (hfin _))).trans (ncard_union_le _ _) + by_cases hcase : 13 * k ≤ 2 * (A.vertexSet ∩ D.vertexSet ∩ Z).ncard + · exact light_aux hZf hl hk hsep hCD hWC hoC hR hcase (by omega) + · exact light_aux hZf hl hk hsep.symm hCD hWC hoC + (by rw [GM10.inter_comm]; exact hR) (by omega) (by omega) + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section3b.lean b/LeanPool/GraphMinor/RST94/Section3b.lean new file mode 100644 index 0000000000..771a6dcf28 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section3b.lean @@ -0,0 +1,520 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section3a +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Ring + +/-! +# Section 3 of "Quickly excluding a planar graph": the proof of (3.1) + +The counting in the proof of (3.1), pages 331–332, and (3.1) itself, `theorem_3_1`. + +There are two small changes. +- The paper's proof of (2) counts paths. We use the same idea on separations (`not_both_splits`): + two separations, one of + `G \\ V(P₂)` and one of `G \\ V(P₃)`, combine to a separation of `G` of order less than `2k` + between `V(P₁)` and `V(P₂)`. + A path `P₂` splits `P₁` and `P₃` when `G \\ V(P₂)` has such a separation; by Menger's theorem this + is the paper's meaning. +- The paper counts `a` paths in `V(A)` and `b` paths in `V(B)`. A path may be in both, inside `V(A ∩ + B)`, and then the pairs + counted by `ab` are not all pairs of different paths. So we put in `b` only the paths not in + `V(A)`, and all the paper's + inequalities still hold. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β : Type*} {G H A B C D : Hypergraph α β} {Z : Set α} {k : ℕ} + +/-- **(2)** in the proof of (3.1) (page 331), in the form of separations. -/ +theorem not_both_splits (hG : G.IsGraph) (hZf : Z.Finite) (hl : Linked G Z) {a b c : Set α} + (hb : b ⊆ G.vertexSet) (hc : c ⊆ G.vertexSet) (hbc : Disjoint b c) (hLa : ¬ Light G Z k a) + (hLb : ¬ Light G Z k b) + (h₁ : ∃ A B, (G.deleteVertices b).IsSeparation A B ∧ a ⊆ A.vertexSet ∧ c ⊆ B.vertexSet ∧ + separationOrder A B < k) + (h₂ : ∃ A B, (G.deleteVertices c).IsSeparation A B ∧ a ⊆ A.vertexSet ∧ b ⊆ B.vertexSet ∧ + separationOrder A B < k) : False := by + obtain ⟨A₁', B₁', hs₁', ha₁, hc₁, ho₁⟩ := h₁ + obtain ⟨A₂', B₂', hs₂', ha₂, hb₂, ho₂⟩ := h₂ + obtain ⟨A₁, B₁, hs₁, hV₁, hW₁, -, -⟩ := exists_lift hG hb hs₁' + obtain ⟨A₂, B₂, hs₂, hV₂, hW₂, -, -⟩ := exists_lift hG hc hs₂' + have hs := (hs₁.symm.union_inter hs₂.symm).symm + have hsub : ((A₁ ∩ A₂) ∩ (B₁ ∪ B₂)).vertexSet ⊆ (A₁' ∩ B₁').vertexSet ∪ (A₂' ∩ B₂').vertexSet + := by + rintro x ⟨⟨hx₁, hx₂⟩, hx₃⟩ + rw [hV₁] at hx₁ + rw [hV₂] at hx₂ + have hx₃' : x ∈ B₁'.vertexSet ∪ b ∨ x ∈ B₂'.vertexSet ∪ c := by + rcases hx₃ with h | h + · exact Or.inl (hW₁ ▸ h) + · exact Or.inr (hW₂ ▸ h) + by_cases hxb : x ∈ b + · have hxc : x ∉ c := disjoint_left.1 hbc hxb + exact Or.inr ⟨hx₂.resolve_right hxc, hb₂ hxb⟩ + · by_cases hxc : x ∈ c + · exact Or.inl ⟨hx₁.resolve_right hxb, hc₁ hxc⟩ + · have h₁' := hx₁.resolve_right hxb + have h₂' := hx₂.resolve_right hxc + rcases hx₃' with (h | h) | (h | h) + · exact Or.inl ⟨h₁', h⟩ + · exact absurd h hxb + · exact Or.inr ⟨h₂', h⟩ + · exact absurd h hxc + have ho : separationOrder (A₁ ∩ A₂) (B₁ ∪ B₂) < 2 * k := by + have := (ncard_le_ncard hsub ((A₁' ∩ B₁').vertexSet_finite.union (A₂' ∩ + B₂').vertexSet_finite)).trans + (ncard_union_le _ _) + unfold separationOrder at ho₁ ho₂ ⊢ + omega + rcases min_le_order hZf hl hs with h | h + · exact hLa ⟨_, _, hs, fun x hx => ⟨hV₁ ▸ Or.inl (ha₁ hx), hV₂ ▸ Or.inl (ha₂ hx)⟩, by omega, h⟩ + · refine hLb ⟨_, _, hs.symm, fun x hx => Or.inl (hW₁ ▸ Or.inr hx), ?_, ?_⟩ + · rw [separationOrder_comm] + omega + · rwa [separationOrder_comm] + +section Count + +variable {n : ℕ} (R : Fin n → Fin n → Fin n → Prop) + +open Classical in +/-- The number of ordered pairs of different paths, other than `b`, split by `b`. -/ +noncomputable def splitCount (b : Fin n) : ℕ := + ((Finset.univ.erase b).offDiag.filter fun p => R b p.1 p.2).card + +private theorem card_fiber (Q : Fin n → Fin n → Fin n → Prop) [∀ a b c, Decidable (Q a b c)] : + (Finset.univ.filter fun t : Fin n × Fin n × Fin n => Q t.1 t.2.1 t.2.2).card = + ∑ b, (Finset.univ.filter fun p : Fin n × Fin n => Q b p.1 p.2).card := by + rw [Finset.card_eq_sum_card_fiberwise (f := Prod.fst) (t := Finset.univ) (fun _ _ + => Finset.mem_coe.2 (Finset.mem_univ _))] + refine Finset.sum_congr rfl fun b _ => ?_ + rw [← Finset.card_image_of_injective (Finset.univ.filter fun p : Fin n × Fin n => Q b p.1 p.2) + (f := fun p => (b, p.1, p.2)) (fun p q h => by simpa [Prod.ext_iff] using h)] + congr 1 + ext ⟨x, y, z⟩ + simp only [Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_image, Prod.mk.injEq, + Prod.exists] + constructor + · rintro ⟨h, rfl⟩ + exact ⟨y, z, h, rfl, rfl, rfl⟩ + · rintro ⟨a, c, h, rfl, rfl, rfl⟩ + exact ⟨h, rfl⟩ + +/-- The averaging step of (3.1) (page 332): if each triple has at most one member that splits the +other two, then some `b` +splits at most a third of the ordered pairs. -/ +theorem exists_few_splits (hn : 0 < n) (hsym : ∀ a b c, R b a c → R b c a) + (hasym : ∀ a b c, a ≠ b → b ≠ c → a ≠ c → R b a c → ¬ R c a b) : + ∃ b, 3 * splitCount R b ≤ (n - 1) * (n - 2) := by + classical + let dist : Fin n → Fin n → Fin n → Prop := fun b a c => a ≠ b ∧ c ≠ b ∧ a ≠ c + let Q : Fin n → Fin n → Fin n → Prop := fun b a c => dist b a c ∧ R b a c + let D := Finset.univ.filter fun t : Fin n × Fin n × Fin n => dist t.1 t.2.1 t.2.2 + let T := Finset.univ.filter fun t : Fin n × Fin n × Fin n => Q t.1 t.2.1 t.2.2 + let rot : Fin n × Fin n × Fin n → Fin n × Fin n × Fin n := fun t => (t.2.1, t.2.2, t.1) + have hrot : Function.Injective rot := fun s t h => by + obtain ⟨h₁, h₂, h₃⟩ := (by simpa [rot, Prod.ext_iff] using h : s.2.1 = t.2.1 ∧ s.2.2 = t.2.2 + ∧ s.1 = t.1) + exact Prod.ext h₃ (Prod.ext h₁ h₂) + have hrot' : Function.Injective (rot ∘ rot) := hrot.comp hrot + have hT₀ : T ⊆ D := fun t ht => by + simp only [T, D, Q, Finset.mem_filter, Finset.mem_univ, true_and] at ht ⊢ + exact ht.1 + have hrD : ∀ t ∈ D, rot t ∈ D := fun t ht => by + simp only [D, dist, rot, Finset.mem_filter, Finset.mem_univ, true_and] at ht ⊢ + exact ⟨ht.2.2.symm, ht.1.symm, ht.2.1⟩ + have hT₁ : T.image rot ⊆ D := by + intro t ht + obtain ⟨s, hs, rfl⟩ := Finset.mem_image.1 ht + exact hrD s (hT₀ hs) + have hT₂ : T.image (rot ∘ rot) ⊆ D := by + intro t ht + obtain ⟨s, hs, rfl⟩ := Finset.mem_image.1 ht + exact hrD _ (hrD s (hT₀ hs)) + have hmem : ∀ {t}, t ∈ T → (t.2.1 ≠ t.1 ∧ t.2.2 ≠ t.1 ∧ t.2.1 ≠ t.2.2) ∧ R t.1 t.2.1 t.2.2 + := fun {t} ht => by + simpa [T, Q, dist] using ht + -- Rotating a triple once or twice leaves `T`. + have hd₁ : ∀ t, t ∈ T → rot t ∉ T := by + rintro ⟨b, a, c⟩ h h' + obtain ⟨⟨hab, hcb, hac⟩, hR⟩ := hmem h + obtain ⟨-, hR'⟩ := hmem h' + have hR₂ : R b a c := hR + have hR₃ : R a c b := hR' + exact hasym c b a hcb (Ne.symm hab) (Ne.symm hac) (hsym _ _ _ hR₂) hR₃ + have hd₂ : ∀ t, t ∈ T → rot (rot t) ∉ T := by + rintro ⟨b, a, c⟩ h h' + obtain ⟨⟨hab, hcb, hac⟩, hR⟩ := hmem h + obtain ⟨-, hR'⟩ := hmem h' + have hR₂ : R b a c := hR + have hR₃ : R c b a := hR' + exact hasym a b c hab (Ne.symm hcb) hac hR₂ (hsym _ _ _ hR₃) + have hdis₁ : Disjoint T (T.image rot) := Finset.disjoint_left.2 fun t ht ht' => by + obtain ⟨s, hs, rfl⟩ := Finset.mem_image.1 ht' + exact hd₁ s hs ht + have hdis₂ : Disjoint (T ∪ T.image rot) (T.image (rot ∘ rot)) := Finset.disjoint_left.2 fun t ht + ht' => by + obtain ⟨s, hs, rfl⟩ := Finset.mem_image.1 ht' + rcases Finset.mem_union.1 ht with h | h + · exact hd₂ s hs h + · obtain ⟨s', hs', he⟩ := Finset.mem_image.1 h + exact hd₁ s hs (hrot he ▸ hs') + have hcard : 3 * T.card ≤ D.card := by + have := Finset.card_le_card (Finset.union_subset (Finset.union_subset hT₀ hT₁) hT₂) + rw [Finset.card_union_of_disjoint hdis₂, Finset.card_union_of_disjoint hdis₁, + Finset.card_image_of_injective _ hrot, Finset.card_image_of_injective _ hrot'] at this + omega + have hTs : T.card = ∑ b, splitCount R b := by + rw [show T = _ from rfl, card_fiber Q] + refine Finset.sum_congr rfl fun b _ => ?_ + unfold splitCount + congr 1 + ext ⟨a, c⟩ + simp [Q, dist, Finset.mem_offDiag] + have hDs : D.card = ∑ _b : Fin n, (n - 1) * (n - 2) := by + rw [show D = _ from rfl, card_fiber dist] + refine Finset.sum_congr rfl fun b _ => ?_ + have : (Finset.univ.filter fun p : Fin n × Fin n => dist b p.1 p.2) = + (Finset.univ.erase b).offDiag := by + ext ⟨a, c⟩ + simp [dist, Finset.mem_offDiag] + rw [this, Finset.offDiag_card, Finset.card_erase_of_mem (Finset.mem_univ b), Finset.card_univ, + Fintype.card_fin, + show n - 2 = n - 1 - 1 by omega, Nat.mul_sub_one (n - 1) (n - 1)] + have : Nonempty (Fin n) := ⟨⟨0, hn⟩⟩ + obtain ⟨b, -, hb⟩ := Finset.exists_le_of_sum_le (s := Finset.univ) Finset.univ_nonempty + (f := fun b => 3 * splitCount R b) (g := fun _ => (n - 1) * (n - 2)) (by + rw [← Finset.mul_sum, ← hTs, ← hDs] + exact hcard) + exact ⟨b, hb⟩ + +/-- Pairs from two disjoint sets give a lower bound for `splitCount`. -/ +theorem two_mul_le_splitCount {b : Fin n} (X Y : Finset (Fin n)) (hXY : Disjoint X Y) (hX : b ∉ X) + (hY : b ∉ Y) + (h : ∀ a ∈ X, ∀ c ∈ Y, R b a c) (hsym : ∀ a b c, R b a c → R b c a) : + 2 * (X.card * Y.card) ≤ splitCount R b := by + classical + have hdisj : Disjoint (X ×ˢ Y) (Y ×ˢ X) := Finset.disjoint_left.2 fun p h₁ h₂ => + Finset.disjoint_left.1 hXY (Finset.mem_product.1 h₁).1 (Finset.mem_product.1 h₂).1 + have hsub : (X ×ˢ Y) ∪ (Y ×ˢ X) ⊆ (Finset.univ.erase b).offDiag.filter fun p => R b p.1 p.2 := by + have hne : ∀ {a c}, a ∈ X → c ∈ Y → a ≠ c := fun h₁ h₂ e => Finset.disjoint_left.1 hXY h₁ + (e ▸ h₂) + have hne' : ∀ {a}, a ∈ X ∨ a ∈ Y → a ≠ b := fun h e => h.elim (fun h' => hX (e ▸ h')) fun h' + => hY (e ▸ h') + rintro ⟨a, c⟩ hp + rcases Finset.mem_union.1 hp with hp | hp + · obtain ⟨h₁, h₂⟩ := Finset.mem_product.1 hp + simp only [Finset.mem_filter, Finset.mem_offDiag, Finset.mem_erase, Finset.mem_univ, and_true] + exact ⟨⟨hne' (Or.inl h₁), hne' (Or.inr h₂), hne h₁ h₂⟩, h a h₁ c h₂⟩ + · obtain ⟨h₁, h₂⟩ := Finset.mem_product.1 hp + simp only [Finset.mem_filter, Finset.mem_offDiag, Finset.mem_erase, Finset.mem_univ, and_true] + exact ⟨⟨hne' (Or.inr h₁), hne' (Or.inl h₂), fun e => hne h₂ h₁ e.symm⟩, hsym _ _ _ + (h c h₂ a h₁)⟩ + have := Finset.card_le_card hsub + rw [Finset.card_union_of_disjoint hdisj, Finset.card_product, Finset.card_product] at this + unfold splitCount + convert this using 1 + rw [Nat.mul_comm Y.card, Nat.two_mul] + +end Count + +/-- A path that is not inside `V(A)` has at least as many vertices in `V(A ∩ B)` as it has ends in +`V(A)`. This is the +paper's count of the paths that leave `V(A)`, on page 332. -/ +theorem ends_le_of_leaves (hs : G.IsSeparation A B) {u v : α} (huv : u ≠ v) + (w : G.skeleton.Walk u v) (hw : w.IsPath) + (hV : {y | y ∈ w.support} ⊆ G.vertexSet) {x : α} (hx : x ∈ w.support) (hxA : x ∉ A.vertexSet) : + (({u, v} : Set α) ∩ A.vertexSet).ncard ≤ ({y | y ∈ w.support} ∩ (A ∩ B).vertexSet).ncard := by + classical + have hfin : ({y | y ∈ w.support} ∩ (A ∩ B).vertexSet).Finite := (A ∩ B).vertexSet_finite.subset + inter_subset_right + have hxB : x ∈ B.vertexSet := (mem_V_or hs (hV hx)).resolve_left hxA + have hmeet : ∀ {a : α} (q : G.skeleton.Walk a x), a ∈ A.vertexSet → ∃ y ∈ q.support, y ∈ + (A ∩ B).vertexSet := + fun q ha => (conn_support q).meets_sep hs q.start_mem_support q.end_mem_support ha hxB + have hsplit : ∀ y ∈ (w.takeUntil x hx).support, ∀ y' ∈ (w.dropUntil x hx).reverse.support, y' ≠ x + → y ≠ y' := by + intro y hy y' hy' hne + have hn : ((w.takeUntil x hx).append (w.dropUntil x hx)).support.Nodup := by + rw [w.take_spec hx] + exact hw.support_nodup + rw [SimpleGraph.Walk.support_append, List.nodup_append] at hn + refine hn.2.2 y hy y' ?_ + have h₁ : y' ∈ (w.dropUntil x hx).support := by simpa using hy' + rw [← SimpleGraph.Walk.cons_tail_support] at h₁ + exact (List.mem_cons.1 h₁).resolve_left hne + by_cases hu : u ∈ A.vertexSet + · obtain ⟨y, hy, hyS⟩ := hmeet (w.takeUntil x hx) hu + have hyw : y ∈ w.support := w.support_takeUntil_subset_support hx hy + by_cases hv' : v ∈ A.vertexSet + · obtain ⟨y', hy', hyS'⟩ := hmeet (w.dropUntil x hx).reverse hv' + have hyw' : y' ∈ w.support := w.support_dropUntil_subset_support hx (by simpa using hy') + have hne : y ≠ y' := hsplit y hy y' hy' fun h => hxA (h ▸ hyS'.1) + have hsub : ({y, y'} : Set α) ⊆ {y | y ∈ w.support} ∩ (A ∩ B).vertexSet := by + rintro z (rfl | rfl) + · exact ⟨hyw, hyS⟩ + · exact ⟨hyw', hyS'⟩ + have := ncard_le_ncard hsub hfin + rw [ncard_pair hne] at this + exact (ncard_le_ncard inter_subset_left (toFinite _)).trans ((ncard_pair huv).le.trans this) + · have hsub : ({u, v} : Set α) ∩ A.vertexSet ⊆ {u} := by + rintro z ⟨rfl | rfl, hz⟩ + · rfl + · exact absurd hz hv' + have h₁ := ncard_le_ncard hsub (toFinite _) + rw [ncard_singleton] at h₁ + exact h₁.trans ((ncard_pos hfin).2 ⟨y, hyw, hyS⟩) + · by_cases hv' : v ∈ A.vertexSet + · obtain ⟨y', hy', hyS'⟩ := hmeet (w.dropUntil x hx).reverse hv' + have hyw' : y' ∈ w.support := w.support_dropUntil_subset_support hx (by simpa using hy') + have hsub : ({u, v} : Set α) ∩ A.vertexSet ⊆ {v} := by + rintro z ⟨rfl | rfl, hz⟩ + · exact absurd hz hu + · rfl + have h₁ := ncard_le_ncard hsub (toFinite _) + rw [ncard_singleton] at h₁ + exact h₁.trans ((ncard_pos hfin).2 ⟨y', hyw', hyS'⟩) + · have : ({u, v} : Set α) ∩ A.vertexSet = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro z ⟨rfl | rfl, hz⟩ + · exact hu hz + · exact hv' hz + rw [this, ncard_empty] + exact Nat.zero_le _ + +/-- The sizes of disjoint finite sets add up to the size of their union. -/ +theorem sum_ncard_eq {ι : Type*} (s : Finset ι) (f : ι → Set α) (hf : ∀ i, (f i).Finite) + (hd : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → Disjoint (f i) (f j)) : ∑ i ∈ s, (f i).ncard = + (⋃ i ∈ s, f i).ncard := by + classical + induction s using Finset.induction_on with + | empty => simp + | insert a s ha ih => + have hfi : (⋃ x ∈ s, f x).Finite := s.finite_toSet.biUnion fun i _ => hf i + rw [Finset.sum_insert ha, Finset.set_biUnion_insert, ih fun i hi j hj => hd i + (Finset.mem_insert_of_mem hi) j + (Finset.mem_insert_of_mem hj), ncard_union_eq ?_ (hf a) hfi] + refine disjoint_left.2 fun x hx hx' => ?_ + obtain ⟨i, hi, hxi⟩ := mem_iUnion₂.1 hx' + exact disjoint_left.1 (hd a (Finset.mem_insert_self _ _) i (Finset.mem_insert_of_mem hi) + fun e => ha (e ▸ hi)) hx hxi + +/-- The numbers at the end of the proof of (3.1) (page 332). -/ +theorem count_contra {a b k : ℕ} (hk : 1 ≤ k) (ha : 5 * k + 1 ≤ 2 * a) (hb : 5 * k + 1 ≤ 2 * b) + (hab : 8 * k ≤ a + b) (h : 3 * (2 * (a * b)) ≤ (9 * k - 1) * (9 * k - 2)) : False := by + have h₁ : (9 * k - 1) * (9 * k - 2) ≤ (9 * k) * (9 * k) := Nat.mul_le_mul (by omega) (by omega) + obtain ⟨p, hp⟩ := Nat.exists_eq_add_of_le ha + obtain ⟨q, hq⟩ := Nat.exists_eq_add_of_le hb + have h₂ : (2 * a) * (2 * b) = (5 * k + 1 + p) * (5 * k + 1 + q) := by rw [hp, hq] + have hpq : 6 * k ≤ p + q + 2 := by omega + nlinarith [Nat.zero_le (p * q), Nat.zero_le (k * p), Nat.zero_le (k * q), Nat.mul_le_mul_left k + hpq] + +/-- The count on page 332: the vertices of `Z` on one side are at most the two on `P`, the two on +each path of `I`, and those on +the other paths, which cost one vertex of `V(A ∩ B) - V(P)` each. -/ +private theorem side_count {n : ℕ} {V : Fin n → Set α} (hVf : ∀ i, (V i).Finite) + (hd : Pairwise fun i j => Disjoint (V i) (V j)) {b : Fin n} {D U : Set α} (hUf : U.Finite) + (I : Finset (Fin n)) + (hI : b ∉ I) (hZV : D ∩ Z ⊆ ⋃ i, V i ∩ D ∩ Z) (h2 : ∀ i, (V i ∩ D ∩ Z).ncard ≤ 2) + (hrest : ∀ i, i ≠ b → i ∉ I → (V i ∩ D ∩ Z).ncard ≤ (V i ∩ U).ncard) : + (D ∩ Z).ncard ≤ 2 + 2 * I.card + U.ncard := by + classical + have hle₁ : (D ∩ Z).ncard ≤ ∑ i, (V i ∩ D ∩ Z).ncard := by + rw [sum_ncard_eq _ (fun i => V i ∩ D ∩ Z) (fun i => (hVf i).subset fun _ h + => h.1.1) fun i _ j _ hij => + (hd hij).mono (fun _ h => h.1.1) fun _ h => h.1.1] + refine ncard_le_ncard (hZV.trans fun x hx => ?_) ((Finset.univ.finite_toSet).biUnion fun i _ => + (hVf i).subset fun _ h => h.1.1) + obtain ⟨i, hi⟩ := mem_iUnion.1 hx + exact mem_iUnion₂.2 ⟨i, Finset.mem_univ i, hi⟩ + have hsum : ∑ i ∈ Finset.univ.erase b, (V i ∩ U).ncard ≤ U.ncard := by + rw [sum_ncard_eq _ (fun i => V i ∩ U) (fun i => (hVf i).subset inter_subset_left) fun i _ j _ + hij => + (hd hij).mono inter_subset_left inter_subset_left] + exact ncard_le_ncard (iUnion₂_subset fun _ _ => inter_subset_right) hUf + have hle₂ : ∑ i ∈ Finset.univ.erase b, (V i ∩ D ∩ Z).ncard ≤ + ∑ i ∈ Finset.univ.erase b, ((if i ∈ I then 2 else 0) + (V i ∩ U).ncard) := by + refine Finset.sum_le_sum fun i hi => ?_ + by_cases hiI : i ∈ I + · rw [ite_eq_left hiI] + exact (h2 i).trans (Nat.le_add_right _ _) + · rw [ite_eq_right hiI, Nat.zero_add] + exact hrest i (Finset.ne_of_mem_erase hi) hiI + have hI2 : ∑ i ∈ Finset.univ.erase b, (if i ∈ I then 2 else 0) = 2 * I.card := by + rw [Finset.sum_ite_mem, Finset.sum_const, smul_eq_mul, Nat.mul_comm] + congr 2 + ext i + simp only [Finset.mem_inter, Finset.mem_erase, Finset.mem_univ, and_true] + exact ⟨fun h => h.2, fun h => ⟨fun e => hI (e ▸ h), h⟩⟩ + rw [Finset.sum_add_distrib, hI2] at hle₂ + have hb := Finset.add_sum_erase Finset.univ (fun i => (V i ∩ D ∩ Z).ncard) (Finset.mem_univ b) + have := h2 b + omega + +/-- **(3.1)** (page 330). -/ +theorem theorem_3_1 (hG : G.IsGraph) (hk : 1 ≤ k) (hZ : Z ⊆ G.vertexSet) (hZc : Z.ncard = 18 * k) + (hl : Linked G Z) + {S T : Set α} (hST : S ∪ T = Z) (hd : Disjoint S T) (hS : S.ncard = 9 * k) (hT : T.ncard + = 9 * k) : + ∃ p : PathFromTo G.skeleton S T, (∀ x ∈ Z, x ∈ pathV p → x = p.first ∨ x = p.last) ∧ Good G Z k + (pathV p) := by + classical + have hZf : Z.Finite := G.vertexSet_finite.subset hZ + have hSZ : S ⊆ Z := hST ▸ subset_union_left + have hTZ : T ⊆ Z := hST ▸ subset_union_right + have hSf : S.Finite := hZf.subset hSZ + have hTf : T.Finite := hZf.subset hTZ + obtain ⟨P, hP⟩ : HasDisjointPaths G.skeleton S T (9 * k) := hS ▸ hl S T hSZ hTZ (hS.trans hT.symm) + let V : Fin (9 * k) → Set α := fun i => pathV (P i) + have hPdis : Pairwise fun i j => Disjoint (V i) (V j) := hP + have hVf : ∀ i, (V i).Finite := fun i => (P i).walk.support.finite_toSet + have hfirst : ∀ i, (P i).first ∈ V i := fun i => (P i).walk.start_mem_support + have hlast : ∀ i, (P i).last ∈ V i := fun i => (P i).walk.end_mem_support + have hne : ∀ i, (P i).first ≠ (P i).last := fun i e => + disjoint_left.1 hd (P i).first_mem (e ▸ (P i).last_mem) + have hinj₁ : Function.Injective fun i => (P i).first := fun i j h => by + by_contra hij + exact disjoint_left.1 (hPdis hij) (hfirst i) ((show (P i).first = + (P j).first from h) ▸ hfirst j) + have hinj₂ : Function.Injective fun i => (P i).last := fun i j h => by + by_contra hij + exact disjoint_left.1 (hPdis hij) (hlast i) ((show (P i).last = (P j).last from h) ▸ hlast j) + -- Each vertex of `S` and of `T` is an end of a path, since there are as many paths as vertices of + -- `S` and of `T`. + have hends : ∀ i, ∀ x ∈ Z, x ∈ V i → x = (P i).first ∨ x = (P i).last := fun i x hx hxi => by + rw [← hST] at hx + rcases hx with hx | hx + · obtain ⟨j, rfl⟩ := exists_index _ hSf hS hinj₁ (fun i => (P i).first_mem) hx + by_cases hij : i = j + · exact Or.inl (hij ▸ rfl) + · exact (disjoint_left.1 (hPdis hij) hxi (hfirst j)).elim + · obtain ⟨j, rfl⟩ := exists_index _ hTf hT hinj₂ (fun i => (P i).last_mem) hx + by_cases hij : i = j + · exact Or.inr (hij ▸ rfl) + · exact (disjoint_left.1 (hPdis hij) hxi (hlast j)).elim + have hVG : ∀ i, V i ⊆ G.vertexSet := fun i _ hx => support_mem (P i).walk (hZ (hSZ + (P i).first_mem)) hx + by_contra hno + push Not at hno + have hbad : ∀ i, ¬ Good G Z k (V i) := fun i h => hno (P i) (hends i) h + have hse : ∀ i, (P i).first ∈ Z ∩ V i := fun i => ⟨hSZ (P i).first_mem, hfirst i⟩ + have hte : ∀ i, (P i).last ∈ Z ∩ V i := fun i => ⟨hTZ (P i).last_mem, hlast i⟩ + have hlight : ∀ i, ¬ Light G Z k (V i) := fun i h => + hbad i (good_of_light hG hZ hZf hZc hl hk (hVG i) (hne i) (hse i) (hte i) h) + have hn : 0 < 9 * k := by omega + let R : Fin (9 * k) → Fin (9 * k) → Fin (9 * k) → Prop := fun b a c => ∃ A B, + (G.deleteVertices (V b)).IsSeparation A B ∧ V a ⊆ A.vertexSet ∧ V c ⊆ B.vertexSet + ∧ separationOrder A B < k + have hsym : ∀ a b c, R b a c → R b c a := by + rintro a b c ⟨A, B, h₁, h₂, h₃, h₄⟩ + exact ⟨B, A, h₁.symm, h₃, h₂, by rwa [separationOrder_comm]⟩ + have hasym : ∀ a b c, a ≠ b → b ≠ c → a ≠ c → R b a c → ¬ R c a b := fun a b c _ hbc _ h₁ h₂ => + not_both_splits hG hZf hl (hVG b) (hVG c) (hPdis hbc) (hlight a) (hlight b) h₁ h₂ + obtain ⟨b, hb⟩ := exists_few_splits R hn hsym hasym + obtain ⟨A, B, A', B', hs, hWA, hWB, hR, hAZ, hBZ, hs', hVA, hVB, ho⟩ := + exists_sep_of_not_good hG hZf (hVG b) (hne b) (hse b) (hte b) (hbad b) + let U : Set α := (A ∩ B).vertexSet \ V b + have hUf : U.Finite := (A ∩ B).vertexSet_finite.sdiff + let X : Finset (Fin (9 * k)) := Finset.univ.filter fun i => i ≠ b ∧ V i ⊆ A.vertexSet + let Y : Finset (Fin (9 * k)) := Finset.univ.filter fun i => i ≠ b ∧ ¬ V i ⊆ A.vertexSet + ∧ V i ⊆ B.vertexSet + let M : Finset (Fin (9 * k)) := Finset.univ.filter fun i => i ≠ b ∧ ¬ V i ⊆ A.vertexSet + ∧ ¬ V i ⊆ B.vertexSet + have hXY : Disjoint X Y := Finset.disjoint_filter.2 fun i _ h₁ h₂ => h₂.2.1 h₁.2 + have hbX : b ∉ X := fun h => (Finset.mem_filter.1 h).2.1 rfl + have hbY : b ∉ Y := fun h => (Finset.mem_filter.1 h).2.1 rfl + have hUV : ∀ i, i ≠ b → ∀ x ∈ V i, x ∈ (A ∩ B).vertexSet → x ∈ V i ∩ U := fun i hi x hx hxS => + ⟨hx, hxS, disjoint_left.1 (hPdis hi) hx⟩ + -- The ends count. + have hend : ∀ i (D : Set α), V i ∩ D ∩ Z ⊆ ({(P i).first, (P i).last} : Set α) ∩ D + := fun i D x hx => + ⟨(hends i x hx.2 hx.1.1).imp id id, hx.1.2⟩ + have h2 : ∀ i (D : Set α), (V i ∩ D ∩ Z).ncard ≤ 2 := fun i D => by + refine (ncard_le_ncard ((hend i D).trans inter_subset_left) (toFinite _)).trans ?_ + rw [ncard_pair (hne i)] + have hleave : ∀ {C E : Hypergraph α β}, G.IsSeparation C E → (C ∩ E).vertexSet = + (A ∩ B).vertexSet → ∀ i, i ≠ b → + ¬ V i ⊆ C.vertexSet → (V i ∩ C.vertexSet ∩ Z).ncard ≤ (V i ∩ U).ncard + := fun {C E} hCE hS i hi hn => by + obtain ⟨x, hx, hxC⟩ := not_subset.1 hn + have h₁ := ends_le_of_leaves hCE (hne i) (P i).walk (P i).isPath (hVG i) hx hxC + refine (ncard_le_ncard (hend i _) (toFinite _)).trans (h₁.trans (ncard_le_ncard ?_ + ((hVf i).subset inter_subset_left))) + rintro y ⟨hy, hyS⟩ + exact hUV i hi y hy (hS ▸ hyS) + have hZcov : ∀ D : Set α, D ∩ Z ⊆ ⋃ i, V i ∩ D ∩ Z := fun D x hx => by + have hxZ := hx.2 + rw [← hST] at hxZ + rcases hxZ with h | h + · obtain ⟨j, rfl⟩ := exists_index _ hSf hS hinj₁ (fun i => (P i).first_mem) h + exact mem_iUnion.2 ⟨j, ⟨hfirst j, hx.1⟩, hx.2⟩ + · obtain ⟨j, rfl⟩ := exists_index _ hTf hT hinj₂ (fun i => (P i).last_mem) h + exact mem_iUnion.2 ⟨j, ⟨hlast j, hx.1⟩, hx.2⟩ + have hcA := side_count (Z := Z) hVf hPdis (b := b) (D := A.vertexSet) hUf X hbX (hZcov _) (fun i + => h2 i _) fun i hi hiX => + hleave hs rfl i hi fun hsub => hiX (Finset.mem_filter.2 ⟨Finset.mem_univ i, hi, hsub⟩) + have hcB := side_count (Z := Z) hVf hPdis (b := b) (D := B.vertexSet) hUf Y hbY (hZcov _) (fun i + => h2 i _) fun i hi hiY => by + by_cases hsub : V i ⊆ B.vertexSet + · have hsubA : V i ⊆ A.vertexSet := by + by_contra hnA + exact hiY (Finset.mem_filter.2 ⟨Finset.mem_univ i, hi, hnA, hsub⟩) + exact ncard_le_ncard (fun x hx => hUV i hi x hx.1.1 ⟨hsubA hx.1.1, hsub hx.1.1⟩) + ((hVf i).subset inter_subset_left) + · exact hleave hs.symm (GM10.inter_comm B A ▸ rfl) i hi hsub + -- Each path in `M` meets `U`. + have hMU : ∀ i ∈ M, 1 ≤ (V i ∩ U).ncard := fun i hi => by + obtain ⟨-, hib, hnA, hnB⟩ := Finset.mem_filter.1 hi + obtain ⟨x, hx, hxA⟩ := not_subset.1 hnA + obtain ⟨y, hy, hyB⟩ := not_subset.1 hnB + have hyA := (mem_V_or hs (hVG i hy)).resolve_right hyB + have hxB := (mem_V_or hs (hVG i hx)).resolve_left hxA + obtain ⟨z, hz, hzS⟩ := (conn_support (P i).walk).meets_sep hs hy hx hyA hxB + exact (ncard_pos ((hVf i).subset inter_subset_left)).2 ⟨z, hUV i hib z hz hzS⟩ + have hMc : M.card ≤ U.ncard := by + calc M.card = ∑ _i ∈ M, 1 := by simp + _ ≤ ∑ i ∈ M, (V i ∩ U).ncard := Finset.sum_le_sum hMU + _ = (⋃ i ∈ M, V i ∩ U).ncard := sum_ncard_eq _ _ (fun i => (hVf i).subset inter_subset_left) + fun i _ j _ hij => + (hPdis hij).mono inter_subset_left inter_subset_left + _ ≤ U.ncard := ncard_le_ncard (iUnion₂_subset fun _ _ => inter_subset_right) hUf + have hall : Finset.univ.erase b ⊆ X ∪ Y ∪ M := fun i hi => by + have hib := Finset.ne_of_mem_erase hi + simp only [X, Y, M, Finset.mem_union, Finset.mem_filter, Finset.mem_univ, true_and] + by_cases h₁ : V i ⊆ A.vertexSet <;> by_cases h₂ : V i ⊆ B.vertexSet <;> simp [hib, h₁, h₂] + have hc₃ : 9 * k - 1 ≤ X.card + Y.card + M.card := by + have := Finset.card_le_card hall + rw [Finset.card_erase_of_mem (Finset.mem_univ b), Finset.card_univ, Fintype.card_fin] at this + exact this.trans ((Finset.card_union_le _ _).trans (Nat.add_le_add_right + (Finset.card_union_le _ _) _)) + have hsp : 2 * (X.card * Y.card) ≤ splitCount R b := two_mul_le_splitCount R X Y hXY hbX hbY + (fun a ha c hc => by + obtain ⟨-, hab, hA⟩ := Finset.mem_filter.1 ha + obtain ⟨-, hcb, -, hB⟩ := Finset.mem_filter.1 hc + refine ⟨A', B', hs', fun x hx => ?_, fun x hx => ?_, ho⟩ + · have := hA hx + rw [hVA] at this + exact this.resolve_right (disjoint_left.1 (hPdis hab) hx) + · have := hB hx + rw [hVB] at this + exact this.resolve_right (disjoint_left.1 (hPdis hcb) hx)) hsym + have hU : U.ncard < k := hR + have hAZ' : 6 * k + 2 ≤ (A.vertexSet ∩ Z).ncard := hAZ + refine count_contra hk (a := X.card) (b := Y.card) (by omega) (by omega) (by omega) ?_ + exact (Nat.mul_le_mul_left 3 hsp).trans hb + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section3c.lean b/LeanPool/GraphMinor/RST94/Section3c.lean new file mode 100644 index 0000000000..09d7d5d1df --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section3c.lean @@ -0,0 +1,521 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section3b + +/-! +# Section 3 of "Quickly excluding a planar graph": the first half of the proof of (3.2) + +The choice at the start of the proof of (3.2) (page 332), and its properties (5) and (6). Here `J` +and `K` are given by their +vertex sets, and are connected in `A` in the sense of `Conn`. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β : Type*} {G A B : Hypergraph α β} {θ k : ℕ} {T : Set (Hypergraph α β × Hypergraph α + β)} {s t : α} + +/-- The conditions (1)-(4) in the proof of (3.2) (page 332). `S` and `R` are the paper's `S` and +`T`, and `v`, `w` are the +vertices of `V(J) ∩ V(A ∩ B)` and `V(K) ∩ V(A ∩ B)`. The paper's condition (4) is stated for `v ∈ +V(A ∩ B) - V(J ∪ K)`, and +here for the vertices of `S` other than `v` and of `R` other than `w`, which are the same vertices. +-/ +structure Cand (G : Hypergraph α β) (T : Set (Hypergraph α β × Hypergraph α β)) (k : ℕ) (s t : α) + (A B : Hypergraph α β) (S R J K : Set α) (v w : α) : Prop where + mem : (A, B) ∈ T + no_lower : ∀ A' B', (A', B') ∈ T → separationOrder A' B' < separationOrder A B → A ≤ A' → B' ≤ B + → False + union_eq : S ∪ R = (A ∩ B).vertexSet + disj : Disjoint S R + cardS : S.ncard ≤ 9 * k + 1 + cardR : R.ncard ≤ 9 * k + 1 + s_mem : s ∈ J + t_mem : t ∈ K + connJ : Conn A J + connK : Conn A K + subJ : J ⊆ A.vertexSet + subK : K ⊆ A.vertexSet + disjJK : Disjoint J K + v_mem : v ∈ J + w_mem : w ∈ K + vS : v ∈ S + wR : w ∈ R + eqJ : ∀ x ∈ J, x ∈ B.vertexSet → x = v + eqK : ∀ x ∈ K, x ∈ B.vertexSet → x = w + adjS : ∀ x ∈ S, x ≠ v → ∃ y ∈ J, A.skeleton.Adj x y + adjR : ∀ x ∈ R, x ≠ w → ∃ y ∈ K, A.skeleton.Adj x y + +/-- The conditions are symmetric. -/ +theorem Cand.swap {S R J K : Set α} {v w : α} (h : Cand G T k s t A B S R J K v w) : Cand G T k t s + A B R S K J w v where + mem := h.mem + no_lower := h.no_lower + union_eq := by rw [Set.union_comm]; exact h.union_eq + disj := h.disj.symm + cardS := h.cardR + cardR := h.cardS + s_mem := h.t_mem + t_mem := h.s_mem + connJ := h.connK + connK := h.connJ + subJ := h.subK + subK := h.subJ + disjJK := h.disjJK.symm + v_mem := h.w_mem + w_mem := h.v_mem + vS := h.wR + wR := h.vS + eqJ := h.eqK + eqK := h.eqJ + adjS := h.adjR + adjR := h.adjS + +/-- `A` has the largest size among all candidates. This is the paper's choice of `A` maximal. -/ +def IsMaxCand (G : Hypergraph α β) (T : Set (Hypergraph α β × Hypergraph α β)) (k : ℕ) (s t : α) + (A : Hypergraph α β) : Prop := + ∀ A' B' S R J K v w, Cand G T k s t A' B' S R J K v w → size A' ≤ size A + +theorem IsMaxCand.swap (h : IsMaxCand G T k s t A) : IsMaxCand G T k t s A := + fun A' B' S R J K v w hc => h A' B' R S K J w v hc.swap + +section Side + +variable {A' B' D : Hypergraph α β} {n : ℕ} {P : Fin n → PathFromTo D.skeleton (A ∩ B).vertexSet + (A' ∩ B').vertexSet} + +/-- One side of the construction of `J'` in (5) (page 333). The set `I` holds the indices of the +paths that start in `S`, and +`i₀` is the index of the path that starts at `v`. -/ +theorem exists_extended_side (hA : A ≤ A') (hB' : B' ≤ B) (hD : D ≤ A') + (hZD : (A ∩ B).vertexSet ⊆ D.vertexSet) + (hP : Pairwise fun i j => Disjoint (pathV (P i)) (pathV (P j))) + (hlast : ∀ i, ∀ x ∈ pathV (P i), x ∈ (A' ∩ B').vertexSet → x = (P i).last) + {J S : Set α} {v : α} (hJ : Conn A J) (hJA : J ⊆ A.vertexSet) (hv : v ∈ J) + (heq : ∀ x ∈ J, x ∈ B.vertexSet → x = v) + (hadj : ∀ x ∈ S, x ≠ v → ∃ y ∈ J, A.skeleton.Adj x y) + (i₀ : Fin n) (hi₀ : (P i₀).first = v) : + ∃ J' : Set α, Conn A' J' ∧ J ⊆ J' ∧ J' ⊆ A'.vertexSet ∧ (P i₀).last ∈ J' ∧ + (∀ x ∈ J', x ∈ B'.vertexSet → x = (P i₀).last) ∧ + (∀ i, (P i).first ∈ S → i ≠ i₀ → ∃ y ∈ J', A'.skeleton.Adj (P i).last y) ∧ + (∀ x ∈ J', x ∈ J ∨ x ∈ pathV (P i₀) ∨ ∃ i, (P i).first ∈ S ∧ x ∈ pathV (P i)) := by + classical + have hV : ∀ i, pathV (P i) ⊆ D.vertexSet := fun i _ hx => support_mem (P i).walk (hZD + (P i).first_mem) hx + have hVA' : ∀ i, pathV (P i) ⊆ A'.vertexSet := fun i => (hV i).trans hD.vertexSet_subset + have hstart : ∀ i, (P i).first ∈ pathV (P i) := fun i => (P i).walk.start_mem_support + have hend : ∀ i, (P i).last ∈ pathV (P i) := fun i => (P i).walk.end_mem_support + let J' : Set α := J ∪ pathV (P i₀) ∪ {x | ∃ i, (P i).first ∈ S ∧ i ≠ i₀ ∧ x ∈ pathV (P i) ∧ x ≠ + (P i).last} + have hne : ∀ i, (P i).first ∈ S → i ≠ i₀ → (P i).first ≠ v := fun i _ hi e => + disjoint_left.1 (hP hi) (hstart i) (by rw [e, ← hi₀]; exact hstart i₀) + have hvM : v ∈ J' := Or.inl (Or.inl hv) + have hconn : Conn A' J' := by + refine conn_of_reach hvM ?_ + rintro x ((hx | hx) | ⟨i, hiS, hi, hx, hxl⟩) + · obtain ⟨w, hw⟩ := (hJ.mono hA).2 x hx v hv + exact ⟨w, fun z hz => Or.inl (Or.inl (hw z hz))⟩ + · obtain ⟨w, hw⟩ := ((conn_support (P i₀).walk).mono hD).2 x hx v + (by rw [← hi₀]; exact hstart i₀) + exact ⟨w, fun z hz => Or.inl (Or.inr (hw z hz))⟩ + · obtain ⟨y, hy, hadjy⟩ := hadj _ hiS (hne i hiS hi) + obtain ⟨w₂, hw₂⟩ := (hJ.mono hA).2 y hy v hv + refine ⟨(((P i).walk.takeUntil x hx).reverse.mapLe (skeleton_mono hD)).append + (SimpleGraph.Walk.cons (skeleton_mono hA hadjy) w₂), fun z hz => ?_⟩ + rcases (SimpleGraph.Walk.mem_support_append_iff _ _).1 hz with hz | hz + · have hz' : z ∈ ((P i).walk.takeUntil x hx).support := by simpa using hz + refine Or.inr ⟨i, hiS, hi, (P i).walk.support_takeUntil_subset_support hx hz', fun e => ?_⟩ + exact notMem_takeUntil (P i).walk (P i).isPath hx hxl (e ▸ hz') + · rw [SimpleGraph.Walk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · have hno : ∀ y ∈ ((P i).walk.takeUntil x hx).support, y ≠ (P i).last := fun y hy e => + notMem_takeUntil (P i).walk (P i).isPath hx hxl (e ▸ hy) + exact Or.inr ⟨i, hiS, hi, hstart i, hno _ ((P i).walk.takeUntil x hx).start_mem_support⟩ + · exact Or.inl (Or.inl (hw₂ z hz)) + refine ⟨J', hconn, fun x hx => Or.inl (Or.inl hx), ?_, Or.inl (Or.inr (hend i₀)), ?_, ?_, ?_⟩ + · rintro x ((hx | hx) | ⟨i, -, -, hx, -⟩) + · exact hA.vertexSet_subset (hJA hx) + · exact hVA' _ hx + · exact hVA' _ hx + · rintro x ((hx | hx) | ⟨i, -, -, hx, hxl⟩) hxB + · have hxv := heq x hx (hB'.vertexSet_subset hxB) + refine hlast i₀ x ?_ ⟨hA.vertexSet_subset (hJA hx), hxB⟩ + rw [hxv, ← hi₀] + exact hstart i₀ + · exact hlast i₀ x hx ⟨hVA' _ hx, hxB⟩ + · exact absurd (hlast i x hx ⟨hVA' _ hx, hxB⟩) hxl + · intro i hiS hi + by_cases hfl : (P i).first = (P i).last + · obtain ⟨y, hy, hadjy⟩ := hadj _ hiS (hne i hiS hi) + have h₁ := skeleton_mono hA hadjy + rw [hfl] at h₁ + exact ⟨y, Or.inl (Or.inl hy), h₁⟩ + · obtain ⟨y, hadjy, q, hq⟩ := SimpleGraph.Walk.exists_eq_cons_of_ne (Ne.symm hfl) + (P i).walk.reverse + have hy : y ∈ (P i).walk.reverse.support := by + rw [hq] + simp + exact ⟨y, Or.inr ⟨i, hiS, hi, (by simpa using hy : y ∈ (P i).walk.support), hadjy.ne.symm⟩, + skeleton_mono hD hadjy⟩ + · rintro x ((hx | hx) | ⟨i, hiS, -, hx, -⟩) + · exact Or.inl hx + · exact Or.inr (Or.inl hx) + · exact Or.inr (Or.inr ⟨i, hiS, hx⟩) + +end Side + +/-- **(5)** in the proof of (3.2) (page 332). -/ +theorem no_same_order (hT : IsTangle G θ T) {S R J K : Set α} {v w : α} + (h : Cand G T k s t A B S R J K v w) + (hmax : IsMaxCand G T k s t A) {A' B' : Hypergraph α β} (hm : (A', B') ∈ T) + (ho : separationOrder A' B' = separationOrder A B) (hA : A ≤ A') (hB : B' ≤ B) + (hne : A' ≠ A) : False := by + classical + have hs := hT.isSeparation h.mem + have hs' := hT.isSeparation hm + let D := B ∩ A' + have hDB : D ≤ B := inter_le_left hs.right_le hs'.left_le + have hDA' : D ≤ A' := inter_le_right hs.right_le hs'.left_le + have hDG : D ≤ G := hDB.trans hs.right_le + have hZD : (A ∩ B).vertexSet ⊆ D.vertexSet := fun x hx => ⟨hx.2, hA.vertexSet_subset hx.1⟩ + have hZ₂D : (A' ∩ B').vertexSet ⊆ D.vertexSet := fun x hx => ⟨hB.vertexSet_subset hx.2, hx.1⟩ + set n := separationOrder A B with hn + have hZc : (A ∩ B).vertexSet.ncard = n := rfl + have hZ₂c : (A' ∩ B').vertexSet.ncard = n := ho + -- There is no separation of `D` of order less than `n` between the two sets, so there are `n` + -- paths. + have hmenger : ∀ C E, D.IsSeparation C E → (A ∩ B).vertexSet ⊆ C.vertexSet → + (A' ∩ B').vertexSet ⊆ E.vertexSet → + n ≤ separationOrder C E := by + intro C E hCE hZC hZE + by_contra hlt + push Not at hlt + have hC := hCE.left_le + have hE := hCE.right_le + have hsep : G.IsSeparation (A ∪ C) (B' ∪ E) := by + refine sep_of_sets (union_le hs.left_le (hC.trans hDG)) (union_le hs'.right_le + (hE.trans hDG)) (fun x hx => ?_) + (fun e he => ?_) ?_ + · rcases mem_V_or hs hx with h₁ | h₁ + · exact Or.inl (Or.inl h₁) + · rcases mem_V_or hs' hx with h₂ | h₂ + · exact (mem_V_or hCE ⟨h₁, h₂⟩).imp Or.inr Or.inr + · exact Or.inr (Or.inl h₂) + · rcases mem_E_or hs he with h₁ | h₁ + · exact Or.inl (Or.inl h₁) + · rcases mem_E_or hs' he with h₂ | h₂ + · exact (mem_E_or hCE ⟨h₁, h₂⟩).imp Or.inr Or.inr + · exact Or.inr (Or.inl h₂) + · rintro e (he | he) (he' | he') + · exact hs.notMem_edgeSet_right he (hB.edgeSet_subset he') + · exact hs.notMem_edgeSet_right he (hDB.edgeSet_subset (hE.edgeSet_subset he')) + · exact hs'.notMem_edgeSet_right (hDA'.edgeSet_subset (hC.edgeSet_subset he)) he' + · exact hCE.notMem_edgeSet_right he he' + have hsub : ((A ∪ C) ∩ (B' ∪ E)).vertexSet ⊆ (C ∩ E).vertexSet := by + rintro x ⟨hx | hx, hx' | hx'⟩ + · exact ⟨hZC ⟨hx, hB.vertexSet_subset hx'⟩, hZE ⟨hA.vertexSet_subset hx, hx'⟩⟩ + · exact ⟨hZC ⟨hx, (hCE.right_le.trans hDB).vertexSet_subset hx'⟩, hx'⟩ + · exact ⟨hx, hZE ⟨(hC.trans hDA').vertexSet_subset hx, hx'⟩⟩ + · exact ⟨hx, hx'⟩ + have hlt' : separationOrder (A ∪ C) (B' ∪ E) < n := + (order_le_of_subset (C ∩ E).vertexSet_finite hsub).trans_lt hlt + have hnθ : n < θ := hT.order_lt h.mem + have hmem : (A ∪ C, B' ∪ E) ∈ T := GraphMinor.GM10.theorem_2_9_proof hT hm hsep + (hlt'.trans hnθ) (Or.inr (Or.inl + (union_subset hA.vertexSet_subset (hC.trans hDA').vertexSet_subset))) + exact h.no_lower _ _ hmem hlt' (le_union_left hs.left_le (hC.trans hDG)) (union_le hB + (hE.trans hDB)) + obtain ⟨P, hP⟩ : HasDisjointPaths D.skeleton (A ∩ B).vertexSet (A' ∩ B').vertexSet n := + (menger D _ _ hZD hZ₂D n).1 hmenger + have hfin₁ : (A ∩ B).vertexSet.Finite := (A ∩ B).vertexSet_finite + have hfin₂ : (A' ∩ B').vertexSet.Finite := (A' ∩ B').vertexSet_finite + have hstart : ∀ i, (P i).first ∈ pathV (P i) := fun i => (P i).walk.start_mem_support + have hend : ∀ i, (P i).last ∈ pathV (P i) := fun i => (P i).walk.end_mem_support + have hdis : Pairwise fun i j => Disjoint (pathV (P i)) (pathV (P j)) := hP + have hinj₁ : Function.Injective fun i => (P i).first := fun i j he => by + by_contra hij + exact disjoint_left.1 (hdis hij) (hstart i) ((show (P i).first = (P j).first from he) ▸ hstart + j) + have hinj₂ : Function.Injective fun i => (P i).last := fun i j he => by + by_contra hij + exact disjoint_left.1 (hdis hij) (hend i) ((show (P i).last = (P j).last from he) ▸ hend j) + have hidx₁ : ∀ {x}, x ∈ (A ∩ B).vertexSet → ∃ i, (P i).first = x := fun hx => + exists_index _ hfin₁ hZc hinj₁ (fun i => (P i).first_mem) hx + have hidx₂ : ∀ {x}, x ∈ (A' ∩ B').vertexSet → ∃ i, (P i).last = x := fun hx => + exists_index _ hfin₂ hZ₂c hinj₂ (fun i => (P i).last_mem) hx + have hfirst : ∀ i, ∀ x ∈ pathV (P i), x ∈ (A ∩ B).vertexSet → x = (P i).first := fun i x hx hxZ + => by + obtain ⟨j, rfl⟩ := hidx₁ hxZ + by_cases hij : i = j + · rw [hij] + · exact (disjoint_left.1 (hdis hij) hx (hstart j)).elim + have hlast : ∀ i, ∀ x ∈ pathV (P i), x ∈ (A' ∩ B').vertexSet → x = (P i).last := fun i x hx hxZ + => by + obtain ⟨j, rfl⟩ := hidx₂ hxZ + by_cases hij : i = j + · rw [hij] + · exact (disjoint_left.1 (hdis hij) hx (hend j)).elim + have hVZ : ∀ {y}, y ∈ S ∪ R → y ∈ (A ∩ B).vertexSet := fun hy => h.union_eq ▸ hy + obtain ⟨i₁, hi₁⟩ := hidx₁ (hVZ (Or.inl h.vS)) + obtain ⟨i₂, hi₂⟩ := hidx₁ (hVZ (Or.inr h.wR)) + obtain ⟨J', hconnJ, hJJ', hJA, hvJ, heqJ, hadjJ, hsubJ⟩ := exists_extended_side hA hB hDA' + hZD hdis hlast h.connJ + h.subJ h.v_mem h.eqJ h.adjS i₁ hi₁ + obtain ⟨K', hconnK, hKK', hKA, hwK, heqK, hadjK, hsubK⟩ := exists_extended_side hA hB hDA' + hZD hdis hlast h.connK + h.subK h.w_mem h.eqK h.adjR i₂ hi₂ + let I : Set (Fin n) := {i | (P i).first ∈ S} + let I' : Set (Fin n) := {i | (P i).first ∈ R} + have hdisII' : ∀ i, i ∈ I → i ∉ I' := fun i h₁ h₂ => disjoint_left.1 h.disj h₁ h₂ + have hcovI : ∀ i, i ∈ I ∨ i ∈ I' := fun i => by + have : (P i).first ∈ S ∪ R := by + rw [h.union_eq] + exact (P i).first_mem + exact this + have hcard : ∀ {W : Set α}, W ⊆ (A ∩ B).vertexSet → ((fun i => (P i).last) '' {i | + (P i).first ∈ W}).ncard ≤ W.ncard := fun {W} hW => by + refine (ncard_image_le (toFinite _)).trans ?_ + rw [← ncard_image_of_injective _ hinj₁] + exact ncard_le_ncard (by rintro _ ⟨i, hi, rfl⟩; exact hi) (hfin₁.subset hW) + have hPB : ∀ i, pathV (P i) ⊆ B.vertexSet := fun i _ hx => + hDB.vertexSet_subset (support_mem (P i).walk (hZD (P i).first_mem) hx) + have hPJ : ∀ i, (P i).first ∈ R → Disjoint J (pathV (P i)) := fun i hi + => disjoint_left.2 fun x hxJ hx => by + have hxv := h.eqJ x hxJ (hPB i hx) + have := hfirst i x hx (hxv ▸ hVZ (Or.inl h.vS)) + exact disjoint_left.1 h.disj (by rw [← this, hxv]; exact h.vS) hi + have hPK : ∀ i, (P i).first ∈ S → Disjoint K (pathV (P i)) := fun i hi + => disjoint_left.2 fun x hxK hx => by + have hxw := h.eqK x hxK (hPB i hx) + have := hfirst i x hx (hxw ▸ hVZ (Or.inr h.wR)) + exact disjoint_left.1 h.disj hi (by rw [← this, hxw]; exact h.wR) + have hi₁S : (P i₁).first ∈ S := hi₁ ▸ h.vS + have hi₂R : (P i₂).first ∈ R := hi₂ ▸ h.wR + have hdisJ' : Disjoint J' K' := by + refine disjoint_left.2 fun x hx hx' => ?_ + -- Each side reads as: in `J`, or on a path that starts in `S`. + have hx₁ : x ∈ J ∨ ∃ i, (P i).first ∈ S ∧ x ∈ pathV (P i) := by + rcases hsubJ x hx with h₁ | h₁ | h₁ + · exact Or.inl h₁ + · exact Or.inr ⟨i₁, hi₁S, h₁⟩ + · exact Or.inr h₁ + have hx₂ : x ∈ K ∨ ∃ i, (P i).first ∈ R ∧ x ∈ pathV (P i) := by + rcases hsubK x hx' with h₁ | h₁ | h₁ + · exact Or.inl h₁ + · exact Or.inr ⟨i₂, hi₂R, h₁⟩ + · exact Or.inr h₁ + rcases hx₁ with h₁ | ⟨i, hi, h₁⟩ <;> rcases hx₂ with h₂ | ⟨j, hj, h₂⟩ + · exact disjoint_left.1 h.disjJK h₁ h₂ + · exact disjoint_left.1 (hPJ j hj) h₁ h₂ + · exact disjoint_left.1 (hPK i hi) h₂ h₁ + · by_cases hij : i = j + · exact disjoint_left.1 h.disj hi (hij ▸ hj) + · exact disjoint_left.1 (hdis hij) h₁ h₂ + have hc : Cand G T k s t A' B' ((fun i => (P i).last) '' I) ((fun i => (P i).last) '' I') J' K' + (P i₁).last (P i₂).last := { + mem := hm + no_lower := fun A₁ B₁ hm₁ ho₁ hle₁ hle₂ => h.no_lower A₁ B₁ hm₁ (ho₁.trans_eq ho) + (hA.trans hle₁) (hle₂.trans hB) + union_eq := by + ext x + constructor + · rintro (⟨i, -, rfl⟩ | ⟨i, -, rfl⟩) <;> exact (P i).last_mem + · intro hx + obtain ⟨i, rfl⟩ := hidx₂ hx + exact (hcovI i).imp (fun hi => ⟨i, hi, rfl⟩) fun hi => ⟨i, hi, rfl⟩ + disj := by + refine disjoint_left.2 ?_ + rintro _ ⟨i, hi, rfl⟩ ⟨j, hj, he⟩ + obtain rfl := hinj₂ he + exact hdisII' _ hi hj + cardS := (hcard fun x hx => hVZ (Or.inl hx)).trans h.cardS + cardR := (hcard fun x hx => hVZ (Or.inr hx)).trans h.cardR + s_mem := hJJ' h.s_mem + t_mem := hKK' h.t_mem + connJ := hconnJ + connK := hconnK + subJ := hJA + subK := hKA + disjJK := hdisJ' + v_mem := hvJ + w_mem := hwK + vS := ⟨i₁, hi₁S, rfl⟩ + wR := ⟨i₂, hi₂R, rfl⟩ + eqJ := heqJ + eqK := heqK + adjS := by + rintro _ ⟨i, hi, rfl⟩ hne' + exact hadjJ i hi fun e => hne' (e ▸ rfl) + adjR := by + rintro _ ⟨i, hi, rfl⟩ hne' + exact hadjK i hi fun e => hne' (e ▸ rfl) } + have := hmax _ _ _ _ _ _ _ _ hc + exact absurd (size_lt_of_lt hA hne.symm) (by omega) + +/-- **(6)** in the proof of (3.2) (page 333). -/ +theorem card_S_eq (hG : G.IsGraph) (hT : IsTangle G θ T) (hθ : 18 * k + 3 + ≤ θ) {S R J K : Set α} {v w : α} + (h : Cand G T k s t A B S R J K v w) (hmax : IsMaxCand G T k s t A) : S.ncard = 9 * k + 1 := by + classical + by_contra hne + have hS : S.ncard ≤ 9 * k := by + have := h.cardS + omega + have hs := hT.isSeparation h.mem + have hAG := hs.left_le + have hBG := hs.right_le + have hZ : (A ∩ B).vertexSet.Finite := (A ∩ B).vertexSet_finite + have hZA : ∀ {x}, x ∈ S ∪ R → x ∈ (A ∩ B).vertexSet := fun hx => h.union_eq ▸ hx + have hvZ : v ∈ (A ∩ B).vertexSet := hZA (Or.inl h.vS) + have hn : separationOrder A B ≤ 18 * k + 1 := by + have h₁ : separationOrder A B = (S ∪ R).ncard := by + unfold separationOrder + rw [h.union_eq] + have h₂ := ncard_union_le S R + have h₃ := h.cardR + omega + have hvA : v ∈ A.vertexSet := hvZ.1 + -- There is an edge of `B` at `v`. + obtain ⟨e, heB, hev⟩ : ∃ e ∈ B.edgeSet, G.Inc e v := by + by_contra hno + push Not at hno + obtain ⟨B₁, hm, hVB, hEB⟩ := exists_trim hT h.mem (W := {v}) (singleton_subset_iff.2 hvA) + fun e he x hx => (show x = v from hx) ▸ hno e he + have hs₁ := hT.isSeparation hm + have hle : B₁ ≤ B := le_of_sets hs₁.right_le hBG (hVB ▸ sdiff_subset) hEB.subset + have hsub : (A ∩ B₁).vertexSet ⊆ (A ∩ B).vertexSet \ {v} := by + rintro x ⟨h₁, h₂⟩ + rw [hVB] at h₂ + exact ⟨⟨h₁, h₂.1⟩, h₂.2⟩ + have hlt : separationOrder A B₁ < separationOrder A B := + (ncard_le_ncard hsub hZ.sdiff).trans_lt (ncard_sdiff_singleton_lt_of_mem hvZ hZ) + exact h.no_lower A B₁ hm hlt le_rfl hle + -- One end of `e` is not in `V(A)`. + obtain ⟨u, heu, huA⟩ : ∃ u, G.Inc e u ∧ u ∉ A.vertexSet := by + by_contra hno + push Not at hno + obtain ⟨A₁, B₁, hm, hVA, hEA, hVB, hEB⟩ := exists_move (F := {e}) hT h.mem (by + rintro f rfl + exact ⟨heB, hno⟩) + have hs₁ := hT.isSeparation hm + have hle₁ : A ≤ A₁ := le_of_sets hAG hs₁.left_le hVA.symm.subset (hEA ▸ subset_union_left) + have hle₂ : B₁ ≤ B := le_of_sets hs₁.right_le hBG hVB.subset (hEB ▸ sdiff_subset) + refine no_same_order hT h hmax hm ?_ hle₁ hle₂ fun e' => ?_ + · unfold separationOrder + change (A₁.vertexSet ∩ B₁.vertexSet).ncard = (A.vertexSet ∩ B.vertexSet).ncard + rw [hVA, hVB] + · have : e ∈ A₁.edgeSet := hEA ▸ Or.inr rfl + exact hs.notMem_edgeSet_right (e' ▸ this) heB + have huv : v ≠ u := fun e' => huA (e' ▸ hvA) + have hends : ∀ x, G.Inc e x → x = v ∨ x = u := fun x hx => end_eq_or hG hev heu huv hx + have huG : u ∈ G.vertexSet := G.vertex_mem_of_inc heu + have heG : e ∈ G.edgeSet := G.edge_mem_of_inc hev + have huB : u ∈ B.vertexSet := end_mem hBG heB heu + let A' := subOf G (A.vertexSet ∪ {u}) (A.edgeSet ∪ {e}) (union_subset hAG.vertexSet_subset + (singleton_subset_iff.2 huG)) (by + rintro f (hf | rfl) + · exact ⟨hAG.edgeSet_subset hf, fun x hx => Or.inl (end_mem hAG hf hx)⟩ + · refine ⟨heG, fun x hx => ?_⟩ + rcases hends x hx with rfl | rfl + · exact Or.inl hvA + · exact Or.inr rfl) + let B' := subOf G B.vertexSet (B.edgeSet \ {e}) hBG.vertexSet_subset (fun f hf => + ⟨hBG.edgeSet_subset hf.1, fun x hx => end_mem hBG hf.1 hx⟩) + have hA'G : A' ≤ G := subOf_le + have hB'G : B' ≤ G := subOf_le + have hle₁ : A ≤ A' := le_of_sets hAG hA'G (fun _ hx => Or.inl hx) fun _ hx => Or.inl hx + have hle₂ : B' ≤ B := le_of_sets hB'G hBG subset_rfl fun _ hx => hx.1 + have hs' : G.IsSeparation A' B' := by + refine sep_of_sets hA'G hB'G (fun x hx => ?_) (fun f hf => ?_) ?_ + · exact (mem_V_or hs hx).imp Or.inl id + · by_cases hfe : f = e + · exact Or.inl (Or.inr hfe) + · exact (mem_E_or hs hf).imp Or.inl fun h₁ => ⟨h₁, hfe⟩ + · rintro f (hf | rfl) hf' + · exact hs.notMem_edgeSet_right hf hf'.1 + · exact hf'.2 rfl + have hVeq : (A' ∩ B').vertexSet = insert u (A ∩ B).vertexSet := by + ext x + constructor + · rintro ⟨h₁ | h₁, h₂⟩ + · exact Or.inr ⟨h₁, h₂⟩ + · exact Or.inl h₁ + · rintro (rfl | h₁) + · exact ⟨Or.inr rfl, huB⟩ + · exact ⟨Or.inl h₁.1, h₁.2⟩ + have huZ : u ∉ (A ∩ B).vertexSet := fun hx => huA hx.1 + have ho : separationOrder A' B' = separationOrder A B + 1 := by + unfold separationOrder + rw [hVeq, ncard_insert_of_notMem huZ hZ] + have hm' : (A', B') ∈ T := GraphMinor.GM10.theorem_2_9_proof hT h.mem hs' (by omega) + (Or.inl subset_rfl) + have hc : Cand G T k s t A' B' (insert u S) R J K v w := { + mem := hm' + no_lower := fun A₁ B₁ hm₁ ho₁ hle₃ hle₄ => by + have ha := hle₁.trans hle₃ + have hb := hle₄.trans hle₂ + by_cases hlt : separationOrder A₁ B₁ < separationOrder A B + · exact h.no_lower A₁ B₁ hm₁ hlt ha hb + · refine no_same_order hT h hmax hm₁ (by omega) ha hb fun e' => ?_ + have : e ∈ A₁.edgeSet := hle₃.edgeSet_subset (Or.inr rfl) + exact hs.notMem_edgeSet_right (e' ▸ this) heB + union_eq := by + rw [hVeq, ← h.union_eq, insert_union] + disj := by + refine disjoint_left.2 ?_ + rintro x (rfl | hx) hxR + · exact huZ (hZA (Or.inr hxR)) + · exact disjoint_left.1 h.disj hx hxR + cardS := (ncard_insert_le _ _).trans (by omega) + cardR := h.cardR + s_mem := h.s_mem + t_mem := h.t_mem + connJ := h.connJ.mono hle₁ + connK := h.connK.mono hle₁ + subJ := h.subJ.trans hle₁.vertexSet_subset + subK := h.subK.trans hle₁.vertexSet_subset + disjJK := h.disjJK + v_mem := h.v_mem + w_mem := h.w_mem + vS := Or.inr h.vS + wR := h.wR + eqJ := fun x hx hxB => h.eqJ x hx (hle₂.vertexSet_subset hxB) + eqK := fun x hx hxB => h.eqK x hx (hle₂.vertexSet_subset hxB) + adjS := by + rintro x (rfl | hx) hne' + · refine ⟨v, h.v_mem, huv.symm, e, ?_, ?_⟩ + · exact (inc_iff_of_le hA'G (Or.inr rfl)).2 heu + · exact (inc_iff_of_le hA'G (Or.inr rfl)).2 hev + · obtain ⟨y, hy, hadj⟩ := h.adjS x hx hne' + exact ⟨y, hy, skeleton_mono hle₁ hadj⟩ + adjR := fun x hx hne' => by + obtain ⟨y, hy, hadj⟩ := h.adjR x hx hne' + exact ⟨y, hy, skeleton_mono hle₁ hadj⟩ } + have hlt : size A < size A' := size_lt_of_lt hle₁ fun e' => huA (e' ▸ + (Or.inr rfl : u ∈ A'.vertexSet)) + have := hmax _ _ _ _ _ _ _ _ hc + omega + +/-- Paths of a subgraph are paths of the graph. -/ +theorem HasDisjointPaths.mono {K L : SimpleGraph α} (h : K ≤ L) {X Y : Set α} {n : ℕ} + (hp : HasDisjointPaths K X Y n) : + HasDisjointPaths L X Y n := by + obtain ⟨P, hP⟩ := hp + refine ⟨fun i => ⟨(P i).first, (P i).last, (P i).walk.mapLe h, (P i).isPath.mapLe h, + (P i).first_mem, (P i).last_mem⟩, ?_⟩ + intro i j hij + simpa using hP hij + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section3d.lean b/LeanPool/GraphMinor/RST94/Section3d.lean new file mode 100644 index 0000000000..2d8d852fb3 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section3d.lean @@ -0,0 +1,502 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section3c + +/-! +# Section 3 of "Quickly excluding a planar graph": the end of the proof of (3.2) + +The paper's (7), (8), (9) in the proof of (3.2), and (3.2) itself, `theorem_3_2`. + +As in the paper, the path `P` of (3.2) runs from `s` through `J` to `P'` and through `K` to `t`, so +that the vertices of `P` in `G'` +are exactly those of `P'` (`exists_path_through`), and the tangle `𝒯'` is defined on `G \ V(P)` +itself. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β : Type*} {G A B C E C' D' : Hypergraph α β} {θ k : ℕ} {T : Set + (Hypergraph α β × Hypergraph α β)} {s t : α} + +theorem IsGraph.of_le (hG : G.IsGraph) (hA : A ≤ G) : A.IsGraph := by + intro e he + have heq : A.ends e = G.ends e := by + ext v + exact inc_iff_of_le hA he + rw [heq] + exact hG e (hA.edgeSet_subset he) + +private theorem ncard_pair_le (a b : α) : ({a, b} : Set α).ncard ≤ 2 := + (ncard_insert_le a {b}).trans (by rw [ncard_singleton]) + +/-- A separation of `B` turns the separation `(A, B)` of `G` into the separation `(A ∪ C, E)` of +`G`. -/ +theorem sep_union_left (hs : G.IsSeparation A B) (hCE : B.IsSeparation C E) : G.IsSeparation + (A ∪ C) E := by + have hC := hCE.left_le.trans hs.right_le + have hE := hCE.right_le.trans hs.right_le + refine sep_of_sets (union_le hs.left_le hC) hE (fun x hx => ?_) (fun e he => ?_) ?_ + · rcases mem_V_or hs hx with h₁ | h₁ + · exact Or.inl (Or.inl h₁) + · exact (mem_V_or hCE h₁).imp Or.inr id + · rcases mem_E_or hs he with h₁ | h₁ + · exact Or.inl (Or.inl h₁) + · exact (mem_E_or hCE h₁).imp Or.inr id + · rintro e (he | he) he' + · exact hs.notMem_edgeSet_right he (hCE.right_le.edgeSet_subset he') + · exact hCE.notMem_edgeSet_right he he' + +/-- The order computation in (7) (page 333). -/ +theorem order_lift_lt {X Y W : Set α} (hW : W = (A ∩ B).vertexSet \ (X ∪ Y)) (hXZ : X ⊆ + (A ∩ B).vertexSet) + (hYZ : Y ⊆ (A ∩ B).vertexSet) (hVC : C.vertexSet = C'.vertexSet ∪ W) (hVE : E.vertexSet + = D'.vertexSet ∪ W) + (hD' : D'.vertexSet ⊆ B.vertexSet) (hXC : X ⊆ C'.vertexSet) + (ho : separationOrder C' D' < X.ncard) : separationOrder (A ∪ C) E < (A ∩ B).vertexSet.ncard + := by + have hZf : (A ∩ B).vertexSet.Finite := (A ∩ B).vertexSet_finite + have hXf : X.Finite := hZf.subset hXZ + have hYf : Y.Finite := hZf.subset hYZ + have hXYf : (X ∪ Y).Finite := hXf.union hYf + have hsub : ((A ∪ C) ∩ E).vertexSet ⊆ (W ∪ (C' ∩ D').vertexSet) ∪ ((X ∪ Y) \ X) := by + rintro x ⟨hx, hx'⟩ + rw [hVE] at hx' + by_cases hxW : x ∈ W + · exact Or.inl (Or.inl hxW) + have hxD : x ∈ D'.vertexSet := hx'.resolve_right hxW + rcases hx with hx | hx + · have hxZ : x ∈ (A ∩ B).vertexSet := ⟨hx, hD' hxD⟩ + have hxXY : x ∈ X ∪ Y := by + by_contra hn + exact hxW (hW ▸ ⟨hxZ, hn⟩) + by_cases hxX : x ∈ X + · exact Or.inl (Or.inr ⟨hXC hxX, hxD⟩) + · exact Or.inr ⟨hxXY, hxX⟩ + · rw [hVC] at hx + exact Or.inl (Or.inr ⟨hx.resolve_right hxW, hxD⟩) + have h₁ : separationOrder (A ∪ C) E ≤ W.ncard + separationOrder C' D' + ((X ∪ Y) \ X).ncard := by + have hWf : W.Finite := hW ▸ hZf.sdiff + refine (ncard_le_ncard hsub ((hWf.union (C' ∩ D').vertexSet_finite).union hXYf.sdiff)).trans ?_ + exact (ncard_union_le _ _).trans (Nat.add_le_add_right (ncard_union_le _ _) _) + have h₂ := ncard_sdiff_add_ncard_of_subset (subset_union_left : X ⊆ X ∪ Y) hXYf + have h₃ := ncard_sdiff_add_ncard_of_subset (union_subset hXZ hYZ) hZf + rw [← hW] at h₃ + omega + +/-- **(7)** in the proof of (3.2) (page 333), in the form in which it is used: the hypothesis of +(3.1) for `G'` and `Z'`. The paper's +(7) asks for paths with no internal vertex in `Z`, and the proof gives paths that avoid `Z - (X ∪ +Y)`, which is what (3.1) needs. -/ +theorem cand_linked (hG : G.IsGraph) (hT : IsTangle G θ T) {S R J K : Set α} {v w : α} + (h : Cand G T k s t A B S R J K v w) : + Linked (B.deleteVertices {v, w}) ((A ∩ B).vertexSet \ {v, w}) := by + classical + intro X Y hX hY hc + have hs := hT.isSeparation h.mem + have hBG : B.IsGraph := IsGraph.of_le hG hs.right_le + have hvZ : v ∈ (A ∩ B).vertexSet := h.union_eq ▸ Or.inl h.vS + have hwZ : w ∈ (A ∩ B).vertexSet := h.union_eq ▸ Or.inr h.wR + have hXZ : X ⊆ (A ∩ B).vertexSet := hX.trans sdiff_subset + have hYZ : Y ⊆ (A ∩ B).vertexSet := hY.trans sdiff_subset + let W : Set α := (A ∩ B).vertexSet \ (X ∪ Y) + have hWB : W ⊆ B.vertexSet := fun x hx => hx.1.2 + have hXH : X ⊆ (B.deleteVertices W).vertexSet := fun x hx => ⟨(hXZ hx).2, fun h' => h'.2 + (Or.inl hx)⟩ + have hYH : Y ⊆ (B.deleteVertices W).vertexSet := fun x hx => ⟨(hYZ hx).2, fun h' => h'.2 + (Or.inr hx)⟩ + have hvW : ∀ {x}, x ∈ ({v, w} : Set α) → x ∈ W := fun {x} hx => by + refine ⟨?_, ?_⟩ + · rcases hx with rfl | rfl + · exact hvZ + · exact hwZ + · rintro (h' | h') + · exact (hX h').2 hx + · exact (hY h').2 hx + by_cases hsep : ∀ C' D', (B.deleteVertices W).IsSeparation C' D' → X ⊆ C'.vertexSet + → Y ⊆ D'.vertexSet → + X.ncard ≤ separationOrder C' D' + · have hle : B.deleteVertices W ≤ B.deleteVertices {v, w} := + le_of_sets (deleteVertices_le _ _) (deleteVertices_le _ _) (fun x hx => ⟨hx.1, fun h' => hx.2 + (hvW h')⟩) + fun e he => ⟨he.1, fun x hx => he.2 x (hvW hx)⟩ + exact HasDisjointPaths.mono (skeleton_mono hle) ((menger _ X Y hXH hYH _).1 hsep) + exfalso + push Not at hsep + obtain ⟨C', D', hs', hXC, hYD, ho⟩ := hsep + obtain ⟨C, E, hCE, hVC, hVE, -, -⟩ := exists_lift hBG hWB hs' + have hD' : D'.vertexSet ⊆ B.vertexSet := (hs'.right_le.trans (deleteVertices_le _ + _)).vertexSet_subset + have hC' : C'.vertexSet ⊆ B.vertexSet := (hs'.left_le.trans (deleteVertices_le _ + _)).vertexSet_subset + have ho₁ := order_lift_lt (A := A) rfl hXZ hYZ hVC hVE hD' hXC ho + have ho₂ := order_lift_lt (A := A) (C := E) (E := C) (X := Y) (Y := X) (W := W) + (by simp only [W, Set.union_comm]) hYZ hXZ hVE hVC hC' hYD + (by rw [separationOrder_comm, ← hc]; exact ho) + have hnθ : (A ∩ B).vertexSet.ncard < θ := hT.order_lt h.mem + have hs₁ := sep_union_left hs hCE + have hs₂ := sep_union_left hs hCE.symm + have hAG := hs.left_le + have hm₁ : (E, A ∪ C) ∈ T := (hT.axiom1 hs₁ (ho₁.trans hnθ)).resolve_left fun hm => + h.no_lower _ _ hm ho₁ (le_union_left hAG (hCE.left_le.trans hs.right_le)) hCE.right_le + have hm₂ : (C, A ∪ E) ∈ T := (hT.axiom1 hs₂ (ho₂.trans hnθ)).resolve_left fun hm => + h.no_lower _ _ hm ho₂ (le_union_left hAG (hCE.right_le.trans hs.right_le)) hCE.left_le + refine hT.axiom2 h.mem hm₁ hm₂ ?_ + rw [← hs.union_eq, ← hCE.union_eq, GM10.union_assoc A E C, GM10.union_comm E C] + +/-- The start of the proof of (3.2) (page 332): the candidate with `B = G`, `V(A) = {s, t}` and +`E(A)` empty. -/ +theorem exists_cand (hT : IsTangle G θ T) (hk : 1 ≤ k) (hθ : 18 * k + 3 ≤ θ) (hst : s ≠ t) + (hfree : IsFreeSet G T θ {s, t}) : + ∃ A₀ B₀ S R J K v w, Cand G T k s t A₀ B₀ S R J K v w := by + classical + have hsub : ({s, t} : Set α) ⊆ G.vertexSet := hfree.1 + let A₀ := subOf G {s, t} ∅ hsub fun _ he => he.elim + have hle : A₀ ≤ G := subOf_le + have hsep : G.IsSeparation A₀ G := sep_of_sets hle le_rfl (fun _ h => Or.inr h) (fun _ h + => Or.inr h) fun _ he => he.elim + have hV : (A₀ ∩ G).vertexSet = {s, t} := subset_antisymm (fun _ h => h.1) fun x hx + => ⟨hx, hsub hx⟩ + have ho : separationOrder A₀ G = 2 := by + unfold separationOrder + rw [hV, ncard_pair hst] + have hm : (A₀, G) ∈ T := (hT.axiom1 hsep (by omega)).resolve_right fun h => hT.axiom3 h rfl + refine ⟨A₀, G, {s}, {t}, {s}, {t}, s, t, ?_⟩ + exact { + mem := hm + no_lower := fun A' B' hm' ho' hA _ => by + have := hfree.2.2 hm' (fun x hx => hA.vertexSet_subset hx) + rw [ncard_pair hst] at this + omega + union_eq := by + rw [hV] + rfl + disj := disjoint_singleton.2 hst + cardS := by rw [ncard_singleton]; omega + cardR := by rw [ncard_singleton]; omega + s_mem := rfl + t_mem := rfl + connJ := conn_singleton + connK := conn_singleton + subJ := singleton_subset_iff.2 (Or.inl rfl) + subK := singleton_subset_iff.2 (Or.inr rfl) + disjJK := disjoint_singleton.2 hst + v_mem := rfl + w_mem := rfl + vS := rfl + wR := rfl + eqJ := fun x hx _ => hx + eqK := fun x hx _ => hx + adjS := fun x hx hne => (hne hx).elim + adjR := fun x hx hne => (hne hx).elim } + +/-- The vertices of `Z'` that survive in `G \ V(P)`, and the tangle `𝒯'` of the proof of (3.2) (page +334). -/ +def pathTangle (H : Hypergraph α β) (Z' : Set α) (k : ℕ) : Set (Hypergraph α β × Hypergraph α β) := + {p | H.IsSeparation p.1 p.2 ∧ separationOrder p.1 p.2 < k ∧ (p.1.vertexSet ∩ Z').ncard < 6 * k} + +/-- The tangle `𝒯'` of the proof of (3.2) (page 334) is a tangle. Here `Z''` is the part of `Z'` in +`V(H)`, and `L` is `G' \ V(P')`. The +hypothesis `hgood` is (8). The paper has `< k` where the argument gives `< 6k`, as `𝒯'` is defined +with `6k`. -/ +theorem isTangle_pathTangle {H L : Hypergraph α β} {Z' Z'' : Set α} (hk : 1 ≤ k) (hL : L ≤ H) + (hZ'f : Z'.Finite) + (hZ'' : Z'' ⊆ Z') (hZ''H : Z'' ⊆ H.vertexSet) (hc : 18 * k - 2 ≤ Z''.ncard) + (hZL : ∀ x ∈ H.vertexSet, x ∈ Z' → x ∈ L.vertexSet) + (hgood : ∀ A B, L.IsSeparation A B → separationOrder A B < k → + ¬ (6 * k ≤ (A.vertexSet ∩ Z').ncard ∧ 6 * k ≤ (B.vertexSet ∩ Z').ncard)) : + IsTangle H k (pathTangle H Z' k) := by + have hZfin : ∀ X : Set α, (X ∩ Z').Finite := fun X => hZ'f.subset inter_subset_right + have hbig : ∀ {X : Set α}, Z'' ⊆ X → 18 * k - 2 ≤ (X ∩ Z').ncard := fun {X} hX => + hc.trans (ncard_le_ncard (fun x hx => ⟨hX hx, hZ'' hx⟩) (hZfin _)) + refine ⟨hk, fun _ _ h => h.1, fun _ _ h => h.2.1, ?_, ?_, ?_⟩ + · intro A₁ B₁ hs ho + have hsL := hs.restrict hL + have hoL := (order_restrict_le A₁ B₁ L).trans_lt ho + have hsize : ∀ {X : Hypergraph α β}, X ≤ H → (X.vertexSet ∩ Z').ncard ≤ + ((X ∩ L).vertexSet ∩ Z').ncard := fun {X} hX => + ncard_le_ncard (fun x hx => ⟨⟨hx.1, hZL x (hX.vertexSet_subset hx.1) hx.2⟩, hx.2⟩) (hZfin _) + by_cases h₁ : (A₁.vertexSet ∩ Z').ncard < 6 * k + · exact Or.inl ⟨hs, ho, h₁⟩ + · refine Or.inr ⟨hs.symm, by rwa [separationOrder_comm], ?_⟩ + by_contra h₂ + have h₂' : ¬ (B₁.vertexSet ∩ Z').ncard < 6 * k := h₂ + have h₃ := hsize hs.left_le + have h₄ := hsize hs.right_le + exact hgood _ _ hsL hoL ⟨by omega, by omega⟩ + · rintro A₁ B₁ A₂ B₂ A₃ B₃ ⟨-, -, h₁⟩ ⟨-, -, h₂⟩ ⟨-, -, h₃⟩ he + have h₁' : (A₁.vertexSet ∩ Z').ncard < 6 * k := h₁ + have h₂' : (A₂.vertexSet ∩ Z').ncard < 6 * k := h₂ + have h₃' : (A₃.vertexSet ∩ Z').ncard < 6 * k := h₃ + have hb := hbig (X := (A₁.vertexSet ∪ A₂.vertexSet) ∪ A₃.vertexSet) (fun x hx => by + have : x ∈ (A₁ ∪ A₂ ∪ A₃).vertexSet := he ▸ hZ''H hx + exact this) + have hle : (((A₁.vertexSet ∪ A₂.vertexSet) ∪ A₃.vertexSet) ∩ Z').ncard ≤ + ((A₁.vertexSet ∩ Z') ∪ (A₂.vertexSet ∩ Z') ∪ (A₃.vertexSet ∩ Z')).ncard := + le_of_eq (by rw [union_inter_distrib_right, union_inter_distrib_right]) + have h₄ := (ncard_union_le ((A₁.vertexSet ∩ Z') ∪ (A₂.vertexSet ∩ Z')) + (A₃.vertexSet ∩ Z')).trans + (Nat.add_le_add_right (ncard_union_le _ _) _) + omega + · rintro A₁ B₁ ⟨-, -, h₁⟩ he + have h₁' : (A₁.vertexSet ∩ Z').ncard < 6 * k := h₁ + have hb := hbig (X := A₁.vertexSet) (fun x hx => he ▸ hZ''H hx) + omega + +/-- **(9)** in the proof of (3.2) (page 334): `𝒯'` is conformal with `𝒯`. The hypothesis `hC` says +that `C` holds at most four vertices of `Z` outside `Z'` +or in `Z'`, in the form used in the paper: the vertices of `Z` in `C` or not in `Z'` are in a set +`F` of size at most `4`. -/ +theorem conformal_pathTangle (hT : IsTangle G θ T) (_hk : 1 ≤ k) {S R J K : Set α} {v w : α} + (h : Cand G T k s t A B S R J K v w) (hZc : (A ∩ B).vertexSet.ncard + = 18 * k + 2) {H : Hypergraph α β} {Z' F : Set α} + (_hH : H ≤ G) (hF : F.Finite) (hFc : F.ncard ≤ 4) + (hZF : ∀ x ∈ (A ∩ B).vertexSet, x ∈ H.vertexSet ∧ x ∈ Z' ∨ x ∈ F) : + Conformal G H T (pathTangle H Z' k) θ k := by + classical + have hs := hT.isSeparation h.mem + have hnθ : (A ∩ B).vertexSet.ncard < θ := hT.order_lt h.mem + refine ⟨by omega, ?_⟩ + rintro ⟨A₀, B₀⟩ ⟨hs₀, ho₀, -, -, hsmall⟩ + have hsmall' : ((A₀ ∩ H).vertexSet ∩ Z').ncard < 6 * k := hsmall + have ho₀' : separationOrder A₀ B₀ < k := ho₀ + by_contra hn + have hBA : (B₀, A₀) ∈ T := (hT.axiom1 hs₀ (by omega)).resolve_left hn + have hZf := (A ∩ B).vertexSet_finite + let Y : Set α := (A ∩ B).vertexSet \ B₀.vertexSet + have hY : Y ⊆ ((A₀ ∩ H).vertexSet ∩ Z') ∪ F := by + rintro x ⟨hxZ, hxB⟩ + have hxG : x ∈ G.vertexSet := hs.left_le.vertexSet_subset hxZ.1 + have hxA := (mem_V_or hs₀ hxG).resolve_right hxB + rcases hZF x hxZ with ⟨h₁, h₂⟩ | h₁ + · exact Or.inl ⟨⟨hxA, h₁⟩, h₂⟩ + · exact Or.inr h₁ + have hZ'f : ((A₀ ∩ H).vertexSet ∩ Z').Finite := (A₀ ∩ H).vertexSet_finite.subset inter_subset_left + have hYc : Y.ncard ≤ 6 * k + 3 := by + have := (ncard_le_ncard hY (hZ'f.union hF)).trans (ncard_union_le _ _) + omega + have hs₁ : G.IsSeparation (A ∪ B₀) (B ∩ A₀) := hs.union_inter hs₀.symm + have hsub : ((A ∪ B₀) ∩ (B ∩ A₀)).vertexSet ⊆ (A₀ ∩ B₀).vertexSet ∪ Y := by + rintro x ⟨hx, hxB, hxA⟩ + by_cases hxB₀ : x ∈ B₀.vertexSet + · exact Or.inl ⟨hxA, hxB₀⟩ + · exact Or.inr ⟨⟨hx.resolve_right hxB₀, hxB⟩, hxB₀⟩ + have ho₁ : separationOrder (A ∪ B₀) (B ∩ A₀) < (A ∩ B).vertexSet.ncard := by + have h₁ := (ncard_le_ncard hsub ((A₀ ∩ B₀).vertexSet_finite.union + (hZf.subset sdiff_subset))).trans (ncard_union_le _ _) + have h₂ : (A₀ ∩ B₀).vertexSet.ncard < k := ho₀' + change ((A ∪ B₀) ∩ (B ∩ A₀)).vertexSet.ncard < _ + omega + have hm₁ : (B ∩ A₀, A ∪ B₀) ∈ T := (hT.axiom1 hs₁ (ho₁.trans hnθ)).resolve_left fun hm => + h.no_lower _ _ hm ho₁ (le_union_left hs.left_le hs₀.right_le) (inter_le_left hs.right_le + hs₀.left_le) + refine hT.axiom2 h.mem hm₁ hBA ?_ + have hle : A ∪ (B ∩ A₀) ∪ B₀ ≤ G := union_le (union_le hs.left_le (inter_le hs.right_le + hs₀.left_le)) hs₀.right_le + refine sub_ext (G := G) hle le_rfl (subset_antisymm hle.vertexSet_subset fun x hx => ?_) + (subset_antisymm hle.edgeSet_subset fun e he => ?_) + · rcases mem_V_or hs hx with h₁ | h₁ + · exact Or.inl (Or.inl h₁) + · rcases mem_V_or hs₀ hx with h₂ | h₂ + · exact Or.inl (Or.inr ⟨h₁, h₂⟩) + · exact Or.inr h₂ + · rcases mem_E_or hs he with h₁ | h₁ + · exact Or.inl (Or.inl h₁) + · rcases mem_E_or hs₀ he with h₂ | h₂ + · exact Or.inl (Or.inr ⟨h₁, h₂⟩) + · exact Or.inr h₂ + +/-- The path `P` of the proof of (3.2) (page 334): "let $P$ be a path of $G$ from $s$ to $t$ with $P +\cap G' = P'$ (this exists +and can be chosen with $V(P) \subseteq V(J \cup K \cup P')$ because of (4))". Here a walk in `J` +from `s`, an edge into the path +`q` (which is `P'`), the path `q`, an edge out of it, and a walk in `K` to `t` give a path, when `q` +misses `J` and `K` and +these two are disjoint. Every vertex of `q` is on the path, and every other vertex of the path is in +`J` or `K`. -/ +theorem exists_path_through {Gs : SimpleGraph α} {J K : Set α} {s y₁ x y y₂ t : α} + (wJ : Gs.Walk s y₁) (hwJ : ∀ z ∈ wJ.support, z ∈ J) (q : Gs.Walk x y) (hq : q.IsPath) + (wK : Gs.Walk y₂ t) (hwK : ∀ z ∈ wK.support, z ∈ K) (h₁ : Gs.Adj y₁ x) (h₂ : Gs.Adj y y₂) + (hqJ : ∀ z ∈ q.support, z ∉ J) (hqK : ∀ z ∈ q.support, z ∉ K) (hJK : Disjoint J K) : + ∃ P : Gs.Walk s t, P.IsPath ∧ (∀ z ∈ P.support, z ∈ J ∨ z ∈ q.support ∨ z ∈ K) ∧ + ∀ z ∈ q.support, z ∈ P.support := by + classical + let PJ := wJ.bypass + let PK := wK.bypass + have hPJ : ∀ z ∈ PJ.support, z ∈ J := fun z hz => hwJ z (wJ.support_bypass_subset_support hz) + have hPK : ∀ z ∈ PK.support, z ∈ K := fun z hz => hwK z (wK.support_bypass_subset_support hz) + refine ⟨PJ.append (SimpleGraph.Walk.cons h₁ (q.append (SimpleGraph.Walk.cons h₂ PK))), ?_, ?_, ?_⟩ + · rw [SimpleGraph.Walk.isPath_def, SimpleGraph.Walk.support_append, + SimpleGraph.Walk.support_cons, List.tail_cons, + SimpleGraph.Walk.support_append, SimpleGraph.Walk.support_cons, List.tail_cons] + have n1 := (SimpleGraph.Walk.isPath_def _).mp wJ.bypass_isPath + have n2 := (SimpleGraph.Walk.isPath_def _).mp hq + have n3 := (SimpleGraph.Walk.isPath_def _).mp wK.bypass_isPath + rw [List.nodup_append, List.nodup_append] + refine ⟨n1, ⟨n2, n3, ?_⟩, ?_⟩ + · intro a ha b hb hab + subst hab + exact hqK a ha (hPK a hb) + · intro a ha b hb hab + subst hab + rcases List.mem_append.mp hb with hb | hb + · exact hqJ a hb (hPJ a ha) + · exact disjoint_left.mp hJK (hPJ a ha) (hPK a hb) + · intro z hz + rw [SimpleGraph.Walk.support_append, SimpleGraph.Walk.support_cons, List.tail_cons, + SimpleGraph.Walk.support_append, SimpleGraph.Walk.support_cons, List.tail_cons] at hz + rcases List.mem_append.mp hz with hz | hz + · exact Or.inl (hPJ z hz) + · rcases List.mem_append.mp hz with hz | hz + · exact Or.inr (Or.inl hz) + · exact Or.inr (Or.inr (hPK z hz)) + · intro z hz + rw [SimpleGraph.Walk.support_append, SimpleGraph.Walk.support_cons, List.tail_cons, + SimpleGraph.Walk.support_append, SimpleGraph.Walk.support_cons, List.tail_cons] + exact List.mem_append_right _ (List.mem_append_left _ hz) + +/-- **(3.2)** (page 332). The proof is the paper's (pages 332–334): `(A, B)`, `S`, `T`, `J`, `K` +chosen with `A` maximal, (5)–(7), +then (8) from (3.1), the path `P` with `P ∩ G' = P'`, the tangle `𝒯'` on `G \ V(P)`, and (9). -/ +theorem theorem_3_2 (hG : G.IsGraph) (hk : 1 ≤ k) (hst : s ≠ t) (hT : IsTangle G θ T) + (hθ : 18 * k + 3 ≤ θ) + (hfree : IsFreeSet G T θ {s, t}) : + ∃ P : G.skeleton.Walk s t, P.IsPath ∧ ∃ T', IsTangle (G.deleteVertices {x | x ∈ P.support}) k + T' ∧ + Conformal G (G.deleteVertices {x | x ∈ P.support}) T T' θ k := by + classical + obtain ⟨A₀, B₀, S₀, R₀, J₀, K₀, v₀, w₀, hc₀⟩ := exists_cand hT hk hθ hst hfree + obtain ⟨A, ⟨B, S, R, J, K, v, w, h⟩, hmaxA⟩ := exists_max_measure + (P := fun A => ∃ B S R J K v w, Cand G T k s t A B S R J K v w) size (size G) + (fun _ ⟨_, _, _, _, _, _, _, hc⟩ => size_le_of_le (hT.isSeparation hc.mem).left_le) + ⟨A₀, B₀, S₀, R₀, J₀, K₀, v₀, w₀, hc₀⟩ + have hmax : IsMaxCand G T k s t A := fun A' B' S' R' J' K' v' w' hc + => hmaxA A' ⟨B', S', R', J', K', v', w', hc⟩ + have hS := card_S_eq hG hT hθ h hmax + have hR := card_S_eq hG hT hθ h.swap hmax.swap + have hs := hT.isSeparation h.mem + have hAG := hs.left_le + have hBG := hs.right_le + have hZf : (A ∩ B).vertexSet.Finite := (A ∩ B).vertexSet_finite + have hmemZ : ∀ {x}, x ∈ S ∪ R → x ∈ (A ∩ B).vertexSet := fun hx => h.union_eq ▸ hx + have hSf : S.Finite := hZf.subset fun _ hx => hmemZ (Or.inl hx) + have hRf : R.Finite := hZf.subset fun _ hx => hmemZ (Or.inr hx) + have hZc : (A ∩ B).vertexSet.ncard = 18 * k + 2 := by + rw [← h.union_eq, ncard_union_eq h.disj hSf hRf, hS, hR] + omega + have hvR : v ∉ R := disjoint_left.1 h.disj h.vS + have hwS : w ∉ S := fun hw => disjoint_left.1 h.disj hw h.wR + have hunion : S \ {v} ∪ R \ {w} = (A ∩ B).vertexSet \ {v, w} := by + rw [← h.union_eq] + ext x + constructor + · rintro (⟨hx, hxv⟩ | ⟨hx, hxw⟩) + · refine ⟨Or.inl hx, ?_⟩ + rintro (rfl | rfl) + · exact hxv rfl + · exact hwS hx + · refine ⟨Or.inr hx, ?_⟩ + rintro (rfl | rfl) + · exact hvR hx + · exact hxw rfl + · rintro ⟨hx | hx, hne⟩ + · exact Or.inl ⟨hx, fun e => hne (Or.inl e)⟩ + · exact Or.inr ⟨hx, fun e => hne (Or.inr e)⟩ + have hdis : Disjoint (S \ {v}) (R \ {w}) := h.disj.mono sdiff_subset sdiff_subset + have hS' : (S \ {v}).ncard = 9 * k := by + rw [ncard_sdiff_singleton_of_mem h.vS, hS] + omega + have hR' : (R \ {w}).ncard = 9 * k := by + rw [ncard_sdiff_singleton_of_mem h.wR, hR] + omega + have hZ'c : ((A ∩ B).vertexSet \ {v, w}).ncard = 18 * k := by + rw [← hunion, ncard_union_eq hdis hSf.sdiff hRf.sdiff, hS', hR'] + omega + let G' := B.deleteVertices {v, w} + have hG'B : G' ≤ B := deleteVertices_le _ _ + have hG'G : G' ≤ G := hG'B.trans hBG + have hZ'sub : (A ∩ B).vertexSet \ {v, w} ⊆ G'.vertexSet := fun x hx => ⟨hx.1.2, hx.2⟩ + obtain ⟨p, hpends, hpgood⟩ := theorem_3_1 (IsGraph.of_le hG hG'G) hk hZ'sub hZ'c + (cand_linked hG hT h) hunion hdis hS' hR' + have hxS := p.first_mem + have hyR := p.last_mem + obtain ⟨y₁, hy₁, adj₁⟩ := h.adjS _ hxS.1 hxS.2 + obtain ⟨y₂, hy₂, adj₂⟩ := h.adjR _ hyR.1 hyR.2 + -- The path `P` of page 334, with `P ∩ G' = P'`. + have hG'J : ∀ z, z ∈ G'.vertexSet → z ∉ J := fun z hz hzJ => hz.2 (Or.inl (h.eqJ z hzJ hz.1)) + have hG'K : ∀ z, z ∈ G'.vertexSet → z ∉ K := fun z hz hzK => hz.2 (Or.inr (h.eqK z hzK hz.1)) + have hpG' : ∀ z ∈ p.walk.support, z ∈ G'.vertexSet := fun z hz => support_mem p.walk (hZ'sub + (hunion ▸ Or.inl hxS)) hz + obtain ⟨wJ, hwJ⟩ := h.connJ.2 s h.s_mem y₁ hy₁ + obtain ⟨wK, hwK⟩ := h.connK.2 y₂ hy₂ t h.t_mem + obtain ⟨P, hPpath, hPsub, hP'P⟩ := exists_path_through (wJ.mapLe (skeleton_mono hAG)) + (fun z hz => hwJ z (by simpa using hz)) (p.walk.mapLe (skeleton_mono hG'G)) (p.isPath.mapLe _) + (wK.mapLe (skeleton_mono hAG)) (fun z hz => hwK z (by simpa using hz)) + (skeleton_mono hAG adj₁).symm (skeleton_mono hAG adj₂) + (fun z hz => hG'J z (hpG' z (by simpa using hz))) (fun z hz => hG'K z (hpG' z + (by simpa using hz))) h.disjJK + -- `P ∩ G' = P'`, on vertices. + have hPG' : ∀ z ∈ P.support, z ∈ G'.vertexSet → z ∈ pathV p := by + intro z hz hzG' + rcases hPsub z hz with hzJ | hzp | hzK + · exact (hG'J z hzG' hzJ).elim + · simpa [pathV] using hzp + · exact (hG'K z hzG' hzK).elim + have hpP : ∀ z ∈ pathV p, z ∈ P.support := fun z hz => hP'P z (by simpa [pathV] using hz) + let C : Set α := {x | x ∈ P.support} + let H := G.deleteVertices C + let L := G'.deleteVertices (pathV p) + have hLG : L ≤ G := (deleteVertices_le _ _).trans hG'G + have hVL : ∀ u, u ∈ G'.vertexSet → u ∉ pathV p → u ∉ C := fun u hu hup huC => hup (hPG' u huC hu) + have hHG : H ≤ G := deleteVertices_le _ _ + have hL : L ≤ H := by + refine le_of_sets hLG hHG (fun u hu => ⟨hLG.vertexSet_subset hu, hVL u hu.1 hu.2⟩) fun e he + => ?_ + refine ⟨hLG.edgeSet_subset he, fun u huC hi => ?_⟩ + have hu := end_mem hLG he hi + exact hVL u hu.1 hu.2 huC + have hZ'f : ((A ∩ B).vertexSet \ {v, w}).Finite := hZf.sdiff + let Z'' := ((A ∩ B).vertexSet \ {v, w}) \ pathV p + have hZ''H : Z'' ⊆ H.vertexSet := fun u hu => + ⟨hAG.vertexSet_subset hu.1.1.1, hVL u (hZ'sub hu.1) hu.2⟩ + have hsub₂ : (A ∩ B).vertexSet \ {v, w} ⊆ Z'' ∪ {p.first, p.last} := fun u hu => by + by_cases hup : u ∈ pathV p + · exact Or.inr (hpends u hu hup) + · exact Or.inl ⟨hu, hup⟩ + have hZ''c : 18 * k - 2 ≤ Z''.ncard := by + have h₁ := (ncard_le_ncard hsub₂ (hZ'f.sdiff.union (toFinite _))).trans (ncard_union_le _ _) + have h₂ := ncard_pair_le p.first p.last + omega + have hZL : ∀ u ∈ H.vertexSet, u ∈ (A ∩ B).vertexSet \ {v, w} → u ∈ L.vertexSet := fun u hu huZ => + ⟨hZ'sub huZ, fun hup => hu.2 (hpP u hup)⟩ + have htan := isTangle_pathTangle hk hL hZ'f sdiff_subset hZ''H hZ''c hZL hpgood + have hFc : ({v, w, p.first, p.last} : Set α).ncard ≤ 4 := by + have h₁ := ncard_insert_le v ({w, p.first, p.last} : Set α) + have h₂ := ncard_insert_le w ({p.first, p.last} : Set α) + have h₃ := ncard_pair_le p.first p.last + omega + have hZF : ∀ x ∈ (A ∩ B).vertexSet, x ∈ H.vertexSet ∧ x ∈ (A ∩ B).vertexSet \ {v, w} ∨ x ∈ + ({v, w, p.first, p.last} : Set α) := by + intro x hx + by_cases hx₁ : x ∈ ({v, w} : Set α) + · rcases hx₁ with rfl | rfl + · exact Or.inr (Or.inl rfl) + · exact Or.inr (Or.inr (Or.inl rfl)) + · have hxZ' : x ∈ (A ∩ B).vertexSet \ {v, w} := ⟨hx, hx₁⟩ + by_cases hxp : x ∈ pathV p + · exact Or.inr (Or.inr (Or.inr (hpends x hxZ' hxp))) + · exact Or.inl ⟨⟨hAG.vertexSet_subset hx.1, hVL x (hZ'sub hxZ') hxp⟩, hxZ'⟩ + exact ⟨P, hPpath, _, htan, conformal_pathTangle hT hk h hZc hHG (toFinite _) hFc hZF⟩ + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section4a.lean b/LeanPool/GraphMinor/RST94/Section4a.lean new file mode 100644 index 0000000000..f55204f091 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section4a.lean @@ -0,0 +1,224 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section3d +public import LeanPool.GraphMinor.RST94.Contract + +/-! +# Section 4 of "Quickly excluding a planar graph": nodules, and Case 2 of (4.1) + +Robertson, Seymour and Thomas, J. Combin. Theory Ser. B 62 (1994), pages 334–337. A nodule `G, 𝒯, Z` +is written with an injective `z : ι → α` with +range `Z`, so that the linkage of a residual nodule joins `z i` to `z' i`. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β ι : Type*} {G A B : Hypergraph α β} {θ : ℕ} {T : Set (Hypergraph α β × Hypergraph α + β)} + +/-- A nodule of order `θ` (page 335): `Z` is free relative to the tangle `𝒯`. -/ +structure Nodule (G : Hypergraph α β) (T : Set (Hypergraph α β × Hypergraph α β)) (θ : ℕ) (z : ι + → α) : Prop where + tangle : IsTangle G θ T + inj : Function.Injective z + free : IsFreeSet G T θ (range z) + +/-- `G', 𝒯', Z'` is a residual nodule of `G, 𝒯, Z` (page 335). The paper's condition that `G'` is a +subgraph of `G \ Z` is the two conditions `le` +and `avoid`, since each end of an edge of `G'` is a vertex of `G'`. The paths `P i` from `z i` to +`z' i` are the linkage. -/ +structure Residual (G : Hypergraph α β) (T : Set (Hypergraph α β × Hypergraph α β)) (θ : ℕ) (z : ι + → α) + (G' : Hypergraph α β) (T' : Set (Hypergraph α β × Hypergraph α β)) (θ' : ℕ) (z' : ι + → α) : Prop where + nodule : Nodule G' T' θ' z' + le : G' ≤ G + avoid : ∀ i, z i ∉ G'.vertexSet + conformal : Conformal G G' T T' θ θ' + link : ∃ P : ∀ i, G.skeleton.Walk (z i) (z' i), (∀ i, (P i).IsPath) ∧ + (∀ i, ∀ x ∈ (P i).support, x ∈ G'.vertexSet → x = z' i) ∧ + Pairwise fun i j => Disjoint {x | x ∈ (P i).support} {x | x ∈ (P j).support} + +theorem ncard_range [Fintype ι] {z : ι → α} (hz : Function.Injective z) : (range z).ncard + = Fintype.card ι := by + rw [← image_univ, ncard_image_of_injective _ hz, ncard_univ, Nat.card_eq_fintype_card] + +variable [Fintype ι] + +/-- The claim in Case 2 of (4.1) (page 336): `X = V(A ∩ B)` is free relative to `𝒯₀`. -/ +theorem free_of_sep {Z : Set α} (hT : IsTangle G θ T) (hfree : IsFreeSet G T θ Z) (hAB : (A, B) ∈ T) + (ho : separationOrder A B = Z.ncard) (hZ : Z ⊆ A.vertexSet) : IsFreeSet G T θ (A ∩ B).vertexSet + := by + have hs := hT.isSeparation hAB + have hc : (A ∩ B).vertexSet.ncard = Z.ncard := ho + have hX : (A ∩ B).vertexSet ⊆ G.vertexSet := fun x hx => hs.left_le.vertexSet_subset hx.1 + refine ⟨hX, hc ▸ hfree.2.1, fun A₀ B₀ hm hXA => ?_⟩ + by_contra hlt + push Not at hlt + have hs₀ := hT.isSeparation hm + have hs₁ : G.IsSeparation (A ∪ A₀) (B ∩ B₀) := hs.union_inter hs₀ + have hsub : ((A ∪ A₀) ∩ (B ∩ B₀)).vertexSet ⊆ (A₀ ∩ B₀).vertexSet := by + rintro x ⟨hx | hx, hxB, hxB₀⟩ + · exact ⟨hXA ⟨hx, hxB⟩, hxB₀⟩ + · exact ⟨hx, hxB₀⟩ + have ho₁ : separationOrder (A ∪ A₀) (B ∩ B₀) < Z.ncard := + (order_le_of_subset (A₀ ∩ B₀).vertexSet_finite hsub).trans_lt (hc ▸ hlt) + have hθ := hT.order_lt hAB + have hn : (A ∪ A₀, B ∩ B₀) ∉ T := fun hm₁ => by + have := hfree.2.2 hm₁ fun x hx => Or.inl (hZ hx) + omega + have hm₂ := (hT.axiom1 hs₁ (by omega)).resolve_left hn + refine hT.axiom2 hAB hm hm₂ ?_ + rw [GM10.union_comm A A₀] at hs₁ + exact (GM10.union_comm A A₀) ▸ hs₁.union_eq + +/-- The other claim in Case 2 of (4.1) (page 337): there are `|Z|` disjoint paths of `A` between `Z` +and `X = V(A ∩ B)`. -/ +theorem paths_of_sep {Z : Set α} (hT : IsTangle G θ T) (hfree : IsFreeSet G T θ Z) (hAB : + (A, B) ∈ T) + (hZ : Z ⊆ A.vertexSet) : HasDisjointPaths A.skeleton Z (A ∩ B).vertexSet Z.ncard := by + have hs := hT.isSeparation hAB + refine (menger A Z (A ∩ B).vertexSet hZ (fun _ hx => hx.1) _).1 fun A₁ B₁ hs₁ hZ₁ hX₁ => ?_ + by_contra hlt + push Not at hlt + have hs₂ : G.IsSeparation A₁ (B ∪ B₁) := (sep_union_left hs.symm hs₁.symm).symm + have hsub : (A₁ ∩ (B ∪ B₁)).vertexSet ⊆ (A₁ ∩ B₁).vertexSet := by + rintro x ⟨hx, hx' | hx'⟩ + · exact ⟨hx, hX₁ ⟨hs₁.left_le.vertexSet_subset hx, hx'⟩⟩ + · exact ⟨hx, hx'⟩ + have ho := (order_le_of_subset (A₁ ∩ B₁).vertexSet_finite hsub).trans_lt hlt + have hθ : Z.ncard ≤ θ := hfree.2.1 + have hm : (A₁, B ∪ B₁) ∈ T := GraphMinor.GM10.theorem_2_9_proof hT hAB hs₂ (by omega) (Or.inr + (Or.inl hs₁.left_le.vertexSet_subset)) + have := hfree.2.2 hm hZ₁ + omega + +/-- `A \ X ≤ G \ X` for `A ≤ G`. -/ +theorem deleteVertices_mono (hA : A ≤ G) (X : Set α) : A.deleteVertices X ≤ G.deleteVertices X := + le_of_sets ((deleteVertices_le _ _).trans hA) (deleteVertices_le _ _) + (fun _ hx => ⟨hA.vertexSet_subset hx.1, hx.2⟩) + fun _f hf => ⟨hA.edgeSet_subset hf.1, fun v hv hi => hf.2 v hv (inc_le hA hf.1 hi)⟩ + +/-- A separation `(A, B)` of `G` gives a separation `(A \ X, B \ X)` of `G \ X`. -/ +theorem IsSeparation_deleteVertices (hs : G.IsSeparation A B) (X : Set α) : + (G.deleteVertices X).IsSeparation (A.deleteVertices X) (B.deleteVertices X) := by + refine sep_of_sets (deleteVertices_mono hs.left_le X) (deleteVertices_mono hs.right_le X) + (fun x hx => ?_) (fun f hf => ?_) ?_ + · exact (mem_V_or hs hx.1).imp (fun h => ⟨h, hx.2⟩) fun h => ⟨h, hx.2⟩ + · refine (mem_E_or hs hf.1).imp (fun h => ⟨h, fun v hv hi => hf.2 v hv (inc_of_le hs.left_le hi)⟩) + fun h => ⟨h, fun v hv hi => hf.2 v hv (inc_of_le hs.right_le hi)⟩ + · exact fun f hf hf' => hs.notMem_edgeSet_right hf.1 hf'.1 + +/-- Case 2 of the proof of (4.1) (pages 336–337): `(A, B)` of order `|Z|` with `Z ⊆ V(A)` gives the +residual nodule on `B \ V(A ∩ B)`. -/ +theorem residual_of_sep (hG : G.IsGraph) {z : ι → α} (hT : IsTangle G θ T) + (hz : Function.Injective z) + (hfree : IsFreeSet G T θ (range z)) (hθ : 2 * Fintype.card ι ≤ θ) (hAB : (A, B) ∈ T) + (ho : separationOrder A B = Fintype.card ι) (hZ : range z ⊆ A.vertexSet) : + ∃ T' z', Residual G T θ z (B.deleteVertices (A ∩ B).vertexSet) T' (θ - Fintype.card ι) z' := by + classical + have hs := hT.isSeparation hAB + have hZc := ncard_range hz + have hXfree := free_of_sep hT hfree hAB (ho.trans hZc.symm) hZ + have hθ₁ := hT.one_le + have hXc : (A ∩ B).vertexSet.ncard = Fintype.card ι := ho + obtain ⟨P, hP⟩ := paths_of_sep hT hfree hAB hZ + have hdis : Pairwise fun i j => Disjoint (pathV (P i)) (pathV (P j)) := hP + have hstart : ∀ i, (P i).first ∈ pathV (P i) := fun i => (P i).walk.start_mem_support + have hend : ∀ i, (P i).last ∈ pathV (P i) := fun i => (P i).walk.end_mem_support + have hinj₁ : Function.Injective fun i => (P i).first := fun i j he => by + by_contra hij + exact disjoint_left.1 (hdis hij) (hstart i) ((show (P i).first = (P j).first from he) ▸ hstart + j) + have hinj₂ : Function.Injective fun i => (P i).last := fun i j he => by + by_contra hij + exact disjoint_left.1 (hdis hij) (hend i) ((show (P i).last = (P j).last from he) ▸ hend j) + have hZfin : (range z).Finite := toFinite _ + have hZ' : ∀ i, (P i).first ∈ A.vertexSet := fun i => hZ (P i).first_mem + have hc : ∀ i, ∃ j, (P j).first = z i := fun i => + exists_index _ hZfin rfl hinj₁ (fun j => (P j).first_mem) (mem_range_self i) + choose c hc using hc + have hcinj : Function.Injective c := fun i j he => hz (by rw [← hc i, ← hc j, he]) + let x : ι → α := fun i => (P (c i)).last + have hxinj : Function.Injective x := hinj₂.comp hcinj + have hrx : range x = (A ∩ B).vertexSet := + eq_of_subset_of_ncard_le (range_subset_iff.2 fun i => (P (c i)).last_mem) + (by rw [ncard_range hxinj, hXc]) (A ∩ B).vertexSet_finite + have hXsub : (A ∩ B).vertexSet ⊆ G.vertexSet := fun t ht => hs.left_le.vertexSet_subset ht.1 + have hXlt : (A ∩ B).vertexSet.ncard < θ := by omega + obtain ⟨y, hyinj, hyV, hyadj, hyfree⟩ := theorem_2_10 hG hT x hxinj (by rw [hrx]; exact hXfree) hθ + rw [hrx, hXc] at hyfree + rw [hrx] at hyV + have hTx := GraphMinor.GM10.theorem_8_5_proof hG hT hXsub hXlt + have hcx := conformal_deleteVertices hG hT hXsub hXlt + rw [hXc] at hTx hcx + let X := (A ∩ B).vertexSet + let C₀ := A.deleteVertices X + let D := B.deleteVertices X + have hsep : (G.deleteVertices X).IsSeparation C₀ D := IsSeparation_deleteVertices hs X + have hempty : (C₀ ∩ D).vertexSet = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro t ⟨h₁, h₂⟩ + exact h₁.2 ⟨h₁.1, h₂.1⟩ + have h0 : separationOrder C₀ D = 0 := by + unfold separationOrder + rw [hempty, ncard_empty] + have hm : (C₀, D) ∈ deleteVerticesTangle G X T θ := by + refine ⟨hsep, ?_, (A, B), hAB, subset_rfl, rfl, rfl⟩ + change separationOrder C₀ D < θ - X.ncard + rw [h0, show X.ncard = Fintype.card ι from hXc] + omega + have hTr := isTangle_restrictTangle hTx hm h0 + have hcr := conformal_restrictTangle hTx hm h0 + have hconf := Conformal.trans (deleteVertices_le _ _) hsep.right_le hT hTx hTr hcx hcr + have hDG : D ≤ G := deleteVertices_le _ _ |>.trans hs.right_le + have hyA : ∀ i, y i ∉ A.vertexSet := fun i hi => by + have h₁ : IsFreeSet (G.deleteVertices X) (deleteVerticesTangle G X T θ) + (θ - Fintype.card ι) {y i} := + hyfree.subset hTx (singleton_subset_iff.2 (mem_range_self i)) + have h₂ := h₁.2.2 hm (singleton_subset_iff.2 ⟨hi, (hyV i).2⟩) + rw [ncard_singleton, h0] at h₂ + omega + have hyD : ∀ i, y i ∈ D.vertexSet := fun i => + ⟨(mem_V_or hs (hyV i).1).resolve_left (hyA i), (hyV i).2⟩ + have hDA : ∀ t ∈ A.vertexSet, t ∉ D.vertexSet := fun t ht ht' => ht'.2 ⟨ht, ht'.1⟩ + refine ⟨_, y, ⟨⟨hTr, hyinj, ?_⟩, hDG, fun i => hDA _ (hZ (mem_range_self i)), hconf, ?_⟩⟩ + · refine ⟨range_subset_iff.2 hyD, hyfree.2.1, ?_⟩ + rintro _ _ ⟨A₁, B₁, hm₁, heq⟩ hY + obtain ⟨rfl, rfl⟩ := Prod.mk.inj heq + have hmem := union_inter_mem hTx hm h0 hm₁ + have h₁ := hyfree.2.2 hmem fun t ht => Or.inl (hY ht).1 + refine h₁.trans (order_le_of_subset (((A₁ ∩ D) ∩ (B₁ ∩ D))).vertexSet_finite ?_) + rintro t ⟨ht | ht, ht', htD⟩ + · exact ⟨⟨ht, htD⟩, ht', htD⟩ + · exact (ht.2 ⟨ht.1, htD.1⟩).elim + · let R : ∀ i, G.skeleton.Walk (z i) (y i) := fun i => + (((P (c i)).walk.copy (hc i) rfl).mapLe (skeleton_mono hs.left_le)).concat (hyadj i) + have hRs : ∀ i t, t ∈ (R i).support → t ∈ pathV (P (c i)) ∨ t = y i := fun i t ht => by + simpa [R, pathV] using ht + have hPA : ∀ i, pathV (P i) ⊆ A.vertexSet := fun i _ ht => support_mem (P i).walk (hZ' i) ht + refine ⟨R, fun i => ?_, fun i t ht htD => ?_, fun i j hij => disjoint_left.2 fun t ht ht' => ?_⟩ + · have h₁ : (((P (c i)).walk.copy (hc i) rfl).mapLe (skeleton_mono hs.left_le)).IsPath := + ((SimpleGraph.Walk.isPath_copy ..).2 (P (c i)).isPath).mapLe _ + refine h₁.concat (fun hn => hyA i (hPA (c i) ?_)) (hyadj i) + simpa [pathV] using hn + · exact (hRs i t ht).resolve_left fun h => hDA t (hPA _ h) htD + · rcases hRs i t ht with h₁ | h₁ <;> rcases hRs j t ht' with h₂ | h₂ + · exact disjoint_left.1 (hdis fun e => hij (hcinj e)) h₁ h₂ + · exact hyA j (h₂ ▸ hPA _ h₁) + · exact hyA i (h₁ ▸ hPA _ h₂) + · exact hij (hyinj (h₁.symm.trans h₂)) + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section4b.lean b/LeanPool/GraphMinor/RST94/Section4b.lean new file mode 100644 index 0000000000..a1612cbb21 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section4b.lean @@ -0,0 +1,296 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section4a + +/-! +# Section 4 of "Quickly excluding a planar graph": (4.1) + +Robertson, Seymour and Thomas, J. Combin. Theory Ser. B 62 (1994), (4.1), pages 335–337. + +The paper's `C` is a connected subgraph, and here it is a connected set of vertices. The paper's +Case 1 is then: some edge outside `E(A)` has two +different ends in `C`. In the paper's form, a parallel edge of `C` becomes a loop of `C/e` at a +vertex outside `Z` that the induction cannot remove. In +the form here this cannot happen, since a loop has only one end. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β ι : Type*} {G H A B : Hypergraph α β} {θ : ℕ} {T : Set (Hypergraph α β × Hypergraph α + β)} + {e : β} {u v : α} {hu : u ∈ G.vertexSet} {huv : u ≠ v} + +/-- The claim in Case 1 of (4.1) (pages 335–336): `Z` stays free in `G/e`. -/ +theorem free_contract (hG : G.IsGraph) (heu : G.Inc e u) (hev : G.Inc e v) (hH : H ≤ G) + (hHc : H ≤ contract G e u v hu huv) (hvH : v ∉ H.vertexSet) (heH : e ∉ H.edgeSet) + (hT : IsTangle H θ T) {Z : Set α} + (hfree : IsFreeSet G (inducedTangle G H T θ) θ Z) (hvZ : v ∉ Z) (hlt : Z.ncard < θ) + (hAB : (A, B) ∈ inducedTangle G H T θ) (ho : separationOrder A B = Z.ncard) + (hZ : Z ⊆ A.vertexSet) + (heA : e ∉ A.edgeSet) + (hmax : ∀ A' B', (A', B') ∈ inducedTangle G H T θ → separationOrder A' B' = Z.ncard + → Z ⊆ A'.vertexSet → size A' ≤ size A) : + IsFreeSet (contract G e u v hu huv) (inducedTangle (contract G e u v hu huv) H T θ) θ Z := by + have hT₀ := isTangle_inducedTangle hH hT + have hs := hT₀.isSeparation hAB + refine ⟨fun x hx => ⟨hfree.1 hx, fun h => hvZ (h ▸ hx)⟩, hfree.2.1, ?_⟩ + rintro A₀ B₀ ⟨hs₀, ho₀, hm₀⟩ hZ₀ + by_contra hcon + push Not at hcon + have hcon' : separationOrder A₀ B₀ < Z.ncard := hcon + have ho₀' : separationOrder A₀ B₀ < θ := ho₀ + have hs₀' : (contract G e u v hu huv).IsSeparation A₀ B₀ := hs₀ + obtain ⟨A', B', hs', hsub, ho₁, ho₂, hVA, hVB, hEA, hEB⟩ := contract_lift_up hG heu hev hs₀' + have hagA : A' ∩ H = A₀ ∩ H := inter_eq_of_agree hs'.left_le hs₀'.left_le hH hHc + (fun x hx => hVA x fun h => hvH (h ▸ hx)) fun f hf => hEA f fun h => heH (h ▸ hf) + have hagB : B' ∩ H = B₀ ∩ H := inter_eq_of_agree hs'.right_le hs₀'.right_le hH hHc + (fun x hx => hVB x fun h => hvH (h ▸ hx)) fun f hf => hEB f fun h => heH (h ▸ hf) + have hm' : (A', B') ∈ inducedTangle G H T θ := by + refine ⟨hs', lt_of_le_of_lt ho₁ (by omega), ?_⟩ + change (A' ∩ H, B' ∩ H) ∈ T + rw [hagA, hagB] + exact hm₀ + have hle := hfree.2.2 hm' (hZ₀.trans hsub) + have heA' : e ∈ A'.edgeSet := ho₂ (by omega) + have hoeq : separationOrder A' B' = Z.ncard := by omega + have hsU : G.IsSeparation (A ∪ A') (B ∩ B') := hs.union_inter hs' + have hAU : A ≤ A ∪ A' := le_union_left hs.left_le hs'.left_le + have hneU : A ∪ A' ≠ A := fun h => heA (h ▸ (Or.inr heA' : e ∈ (A ∪ A').edgeSet)) + have hbig : Z.ncard < separationOrder (A ∪ A') (B ∩ B') := by + by_contra hsmall + push Not at hsmall + have hmU : (A ∪ A', B ∩ B') ∈ inducedTangle G H T θ := by + refine (hT₀.axiom1 hsU (by omega)).resolve_right fun hm => hT₀.axiom2 hAB hm' hm ?_ + rw [GM10.union_comm A A'] at hsU + exact (GM10.union_comm A A') ▸ hsU.union_eq + have h₁ := hfree.2.2 hmU fun x hx => Or.inl (hZ hx) + have h₂ := hmax _ _ hmU (by omega) fun x hx => Or.inl (hZ hx) + exact absurd (size_lt_of_lt hAU hneU.symm) (by omega) + have hsum := separationOrder_add_separationOrder hs hs' + have hsI : G.IsSeparation (A ∩ A') (B ∪ B') := (hs.symm.union_inter hs'.symm).symm + have hmI : (A ∩ A', B ∪ B') ∈ inducedTangle G H T θ := + GraphMinor.GM10.theorem_2_9_proof hT₀ hAB hsI (by omega) (Or.inr (Or.inl fun x hx => hx.1)) + have := hfree.2.2 hmI fun x hx => ⟨hZ hx, hsub (hZ₀ hx)⟩ + omega + +/-- The end of Case 1 of (4.1) (page 336): a residual nodule of `G/e` is a residual nodule of `G`. +-/ +theorem residual_of_contract [Finite ι] {z z' : ι → α} {G' : Hypergraph α β} {T' : Set + (Hypergraph α β × Hypergraph α β)} {θ' : ℕ} + (heu : G.Inc e u) (hev : G.Inc e v) (hH : H ≤ G) (hHc : H ≤ contract G e u v hu huv) + (hvH : v ∉ H.vertexSet) + (huH : u ∉ H.vertexSet) (heH : e ∉ H.edgeSet) (hzc : ∀ i, z i ∈ (contract G e u v hu + huv).vertexSet) + (hR : Residual (contract G e u v hu huv) (inducedTangle (contract G e u v hu huv) H T θ) θ z G' + T' θ' z') + (huG' : u ∉ G'.vertexSet) : Residual G (inducedTangle G H T θ) θ z G' T' θ' z' := by + classical + let fintypeIndices := Fintype.ofFinite ι + obtain ⟨hG'G, hvG', heG', -⟩ := le_of_le_contract hR.le huG' + have hθ' := hR.conformal.1 + refine ⟨hR.nodule, hG'G, hR.avoid, ⟨hθ', ?_⟩, ?_⟩ + · rintro ⟨A', B'⟩ ⟨hs', ho', hm'⟩ + obtain ⟨A₁, B₁, hs₁, ho₁, hVA, hVB, hEA, hEB⟩ := contract_lift_down (hu := hu) (huv + := huv) heu hev hs' + have hag : ∀ {K : Hypergraph α β}, K ≤ G → K ≤ contract G e u v hu huv → v ∉ K.vertexSet + → u ∉ K.vertexSet → e ∉ K.edgeSet → + A' ∩ K = A₁ ∩ K ∧ B' ∩ K = B₁ ∩ K := fun {K} h₁ h₂ h₃ h₄ h₅ => + ⟨inter_eq_of_agree hs'.left_le hs₁.left_le h₁ h₂ + (fun x hx => (hVA x (fun h => h₃ (h ▸ hx)) fun h => h₄ (h ▸ hx)).symm) fun f hf => + (hEA f fun h => h₅ (h ▸ hf)).symm, + inter_eq_of_agree hs'.right_le hs₁.right_le h₁ h₂ + (fun x hx => (hVB x (fun h => h₃ (h ▸ hx)) fun h => h₄ (h ▸ hx)).symm) fun f hf => + (hEB f fun h => h₅ (h ▸ hf)).symm⟩ + obtain ⟨hag₁, hag₂⟩ := hag hG'G hR.le hvG' huG' heG' + obtain ⟨hag₃, hag₄⟩ := hag hH hHc hvH huH heH + have hm₁ : (A₁, B₁) ∈ inducedTangle (contract G e u v hu huv) H T θ := hR.conformal.2 (by + refine ⟨hs₁, lt_of_le_of_lt ho₁ ho', ?_⟩ + change (A₁ ∩ G', B₁ ∩ G') ∈ T' + rw [← hag₁, ← hag₂] + exact hm') + refine ⟨hs', lt_of_lt_of_le ho' hθ', ?_⟩ + change (A' ∩ H, B' ∩ H) ∈ T + rw [hag₃, hag₄] + exact hm₁.2.2 + · obtain ⟨P, hpath, hlast, hdis⟩ := hR.link + have hlift := fun i => exists_walk_lift heu hev (P i) + choose w hw using hlift + have hQ : ∀ i t, t ∈ (w i).bypass.support → t ∈ (P i).support ∨ (t = v ∧ u ∈ (P i).support) + := fun i t ht => + hw i t ((w i).support_bypass_subset_support ht) + have hPv : ∀ i, v ∉ (P i).support := fun i hi => (support_mem (P i) (hzc i) hi).2 rfl + refine ⟨fun i => (w i).bypass, fun i => (w i).bypass_isPath, fun i t ht htG => ?_, fun i j hij + => disjoint_left.2 fun t ht ht' => ?_⟩ + · rcases hQ i t ht with h | ⟨rfl, -⟩ + · exact hlast i t h htG + · exact absurd htG hvG' + · rcases hQ i t ht with h₁ | ⟨rfl, h₁⟩ <;> rcases hQ j _ ht' with h₂ | ⟨h₃, h₂⟩ + · exact disjoint_left.1 (hdis hij) h₁ h₂ + · exact hPv i (h₃ ▸ h₁) + · exact hPv j h₂ + · exact disjoint_left.1 (hdis hij) h₁ h₂ + +/-- A connected set projects to a connected set of `G/e`. -/ +theorem conn_contract (hG : G.IsGraph) (heu : G.Inc e u) (hev : G.Inc e v) {C : Set α} + (hC : Conn G C) (huC : u ∈ C) : + Conn (contract G e u v hu huv) (C \ {v}) := by + classical + refine ⟨⟨u, huC, huv⟩, fun a ha b hb => ?_⟩ + obtain ⟨w, hw⟩ := hC.2 a ha.1 b hb.1 + have hproj := exists_walk_project (hu := hu) (huv := huv) w heu hev hG + rw [contractMap_of_ne ha.2, contractMap_of_ne hb.2] at hproj + obtain ⟨p, hp⟩ := hproj + refine ⟨p, fun t ht => ?_⟩ + obtain ⟨y, hy, rfl⟩ := hp t ht + by_cases hyv : y = v + · subst hyv + rw [contractMap_self] + exact ⟨huC, huv⟩ + · rw [contractMap_of_ne hyv] + exact ⟨hw y hy, hyv⟩ + +/-- **(4.1)** (page 335). `T` is a tangle of `H = G \ V(C)`, and `inducedTangle G H T θ` is the +paper's `𝒯₀`. The number `n` is the paper's `|V(C) - Z|`, +on which the proof is by induction. -/ +theorem theorem_4_1 [Fintype ι] (n : ℕ) : ∀ (G : Hypergraph α β), G.IsGraph → ∀ (z : ι + → α), Function.Injective z → + ∀ (C : Set α), Conn G C → C ⊆ G.vertexSet → (∃ i, z i ∈ C) → ∀ (H : Hypergraph α β) (θ : ℕ) + (T : Set (Hypergraph α β × Hypergraph α β)), + H ≤ G → (∀ x, x ∈ H.vertexSet ↔ x ∈ G.vertexSet ∧ x ∉ C) → (∀ f ∈ G.edgeSet, + (∀ x ∈ C, ¬ G.Inc f x) → f ∈ H.edgeSet) → + IsTangle H θ T → 2 * Fintype.card ι ≤ θ → IsFreeSet G (inducedTangle G H T θ) θ (range z) → + (C \ range z).ncard = n → + ∃ G' T' z', Residual G (inducedTangle G H T θ) θ z G' T' (θ - Fintype.card ι) z' + ∧ ∀ x ∈ C, x ∉ G'.vertexSet := by + classical + induction n using Nat.strong_induction_on with + | _ n ih => + intro G hG z hz C hC hCV hmeet H θ T hH hVH hEH hT hθ hfree hn + have hT₀ := isTangle_inducedTangle hH hT + obtain ⟨i₀, hi₀⟩ := hmeet + have hZc := ncard_range hz + have hh : 1 ≤ Fintype.card ι := Fintype.card_pos_iff.2 ⟨i₀⟩ + have hZlt : (range z).ncard < θ := by omega + -- The choice of `(A, B)`. + have hex : ∃ A B, (A, B) ∈ inducedTangle G H T θ ∧ separationOrder A B = (range z).ncard + ∧ range z ⊆ A.vertexSet := by + let A₀ := subOf G (range z) ∅ hfree.1 fun _ he => he.elim + have hle : A₀ ≤ G := subOf_le + have hsep : G.IsSeparation A₀ G := sep_of_sets hle le_rfl (fun _ h => Or.inr h) (fun _ h + => Or.inr h) fun _ he => he.elim + have hV : (A₀ ∩ G).vertexSet = range z := subset_antisymm (fun _ h => h.1) fun x hx + => ⟨hx, hfree.1 hx⟩ + have ho : separationOrder A₀ G = (range z).ncard := by + unfold separationOrder + rw [hV] + have hm : (A₀, G) ∈ inducedTangle G H T θ := (hT₀.axiom1 hsep (by omega)).resolve_right fun h + => hT₀.axiom3 h rfl + exact ⟨A₀, G, hm, ho, subset_rfl⟩ + obtain ⟨A, ⟨B, hAB, ho, hZ⟩, hmaxA⟩ := exists_max_measure + (P := fun A => ∃ B, (A, B) ∈ inducedTangle G H T θ ∧ separationOrder A B = (range z).ncard + ∧ range z ⊆ A.vertexSet) size (size G) + (fun _ ⟨_, h, _⟩ => size_le_of_le (hT₀.isSeparation h).left_le) (by + obtain ⟨A, B, h⟩ := hex + exact ⟨A, B, h⟩) + have hmax : ∀ A' B', (A', B') ∈ inducedTangle G H T θ → separationOrder A' B' = (range z).ncard + → range z ⊆ A'.vertexSet → + size A' ≤ size A := fun A' B' h₁ h₂ h₃ => hmaxA A' ⟨B', h₁, h₂, h₃⟩ + have hs := hT₀.isSeparation hAB + by_cases hcase : ∃ e ∈ G.edgeSet, e ∉ A.edgeSet ∧ ∃ u ∈ C, ∃ v ∈ C, u ≠ v ∧ G.Inc e u ∧ G.Inc e v + · -- Case 1. + obtain ⟨e, heG, heA, u₁, hu₁, v₁, hv₁, hne, hi₁, hi₂⟩ := hcase + have heB : e ∈ B.edgeSet := (mem_E_or hs heG).resolve_left heA + -- Not both ends of `e` are in `Z`, by the maximality of `A` and (2.8). + have hnotboth : ¬ (u₁ ∈ range z ∧ v₁ ∈ range z) := by + rintro ⟨h₁, h₂⟩ + obtain ⟨A₁, B₁, hm, hVA, hEA, hVB, -⟩ := exists_move (F := {e}) hT₀ hAB (by + rintro f rfl + refine ⟨heB, fun x hx => ?_⟩ + rcases end_eq_or hG hi₁ hi₂ hne hx with rfl | rfl + · exact hZ h₁ + · exact hZ h₂) + have hs₁ := hT₀.isSeparation hm + have hle : A ≤ A₁ := le_of_sets hs.left_le hs₁.left_le hVA.symm.subset + (hEA ▸ subset_union_left) + have hne₁ : A₁ ≠ A := fun h => heA (h ▸ (hEA ▸ Or.inr rfl : e ∈ A₁.edgeSet)) + have ho₁ : separationOrder A₁ B₁ = (range z).ncard := by + rw [← ho] + change (A₁.vertexSet ∩ B₁.vertexSet).ncard = (A.vertexSet ∩ B.vertexSet).ncard + rw [hVA, hVB] + have := hmax A₁ B₁ hm ho₁ (hVA ▸ hZ) + exact absurd (size_lt_of_lt hle hne₁.symm) (by omega) + obtain ⟨u, v, huC, hvC, huv, heu, hev, hvZ⟩ : ∃ u v, u ∈ C ∧ v ∈ C ∧ u ≠ v ∧ G.Inc e u + ∧ G.Inc e v ∧ v ∉ range z := by + by_cases h : v₁ ∈ range z + · exact ⟨v₁, u₁, hv₁, hu₁, hne.symm, hi₂, hi₁, fun h' => hnotboth ⟨h', h⟩⟩ + · exact ⟨u₁, v₁, hu₁, hv₁, hne, hi₁, hi₂, h⟩ + have hu : u ∈ G.vertexSet := hCV huC + have hvH : v ∉ H.vertexSet := fun h => ((hVH v).1 h).2 hvC + have huH : u ∉ H.vertexSet := fun h => ((hVH u).1 h).2 huC + have heH : e ∉ H.edgeSet := fun h => huH (end_mem hH h heu) + have hno : ∀ f ∈ H.edgeSet, ¬ G.Inc f v := fun f hf hi => hvH (end_mem hH hf hi) + have hHc : H ≤ contract G e u v hu huv := le_contract hH hvH heH hno + have hfree' := free_contract (hu := hu) (huv := huv) hG heu hev hH hHc hvH heH hT hfree hvZ + hZlt hAB ho hZ heA hmax + have hsubC : (C \ {v}) \ range z ⊂ C \ range z := by + refine ⟨fun x hx => ⟨hx.1.1, hx.2⟩, fun h => ?_⟩ + exact (h ⟨hvC, hvZ⟩).1.2 rfl + have hfinC : (C \ range z).Finite := (G.vertexSet_finite.subset hCV).sdiff + have hlt : ((C \ {v}) \ range z).ncard < n := hn ▸ ncard_lt_ncard hsubC hfinC + obtain ⟨G', T', z', hR, havoid⟩ := ih _ hlt (contract G e u v hu huv) + (isGraph_contract hG) z hz (C \ {v}) + (conn_contract hG heu hev hC huC) (fun x hx => ⟨hCV hx.1, hx.2⟩) + ⟨i₀, hi₀, fun h => hvZ (h ▸ mem_range_self i₀)⟩ H θ T hHc + (fun x => ⟨fun h => by + obtain ⟨h₁, h₂⟩ := (hVH x).1 h + exact ⟨⟨h₁, fun h' => hvH (h' ▸ h)⟩, fun h' => h₂ h'.1⟩, fun ⟨h₁, h₂⟩ => + (hVH x).2 ⟨h₁.1, fun h' => h₂ ⟨h', h₁.2⟩⟩⟩) + (fun f hf hno' => hEH f hf.1 fun x hx hi => by + by_cases hxv : x = v + · subst hxv + exact hno' u ⟨huC, huv⟩ ⟨hf.2, huv, Or.inr ⟨rfl, hi⟩⟩ + · exact hno' x ⟨hx, hxv⟩ ⟨hf.2, hxv, Or.inl hi⟩) + hT hθ hfree' rfl + have huG' : u ∉ G'.vertexSet := havoid u ⟨huC, huv⟩ + have hR' := residual_of_contract heu hev hH hHc hvH huH heH (fun i => hfree'.1 + (mem_range_self i)) hR huG' + refine ⟨G', T', z', hR', fun x hx => ?_⟩ + by_cases hxv : x = v + · subst hxv + exact (le_of_le_contract hR.le huG').2.1 + · exact havoid x ⟨hx, hxv⟩ + · -- Case 2. + push Not at hcase + have hCA : ∀ {a b : α} (w : G.skeleton.Walk a b), (∀ t ∈ w.support, t ∈ C) → a ∈ A.vertexSet + → b ∈ A.vertexSet := by + intro a b w + induction w with + | nil => exact fun _ h => h + | @cons x y c hadj q ih' => + intro hsup hx + apply ih' fun t ht => hsup t (by simp [ht]) + obtain ⟨hxy, f, h₁, h₂⟩ := id hadj + have hxC := hsup x (by simp) + have hyC := hsup y (by simp) + by_cases hfA : f ∈ A.edgeSet + · exact end_mem hs.left_le hfA h₂ + · exact (hcase f (G.edge_mem_of_inc h₁) hfA x hxC y hyC hxy h₁ h₂).elim + obtain ⟨T', z', hR⟩ := residual_of_sep hG hT₀ hz hfree hθ hAB (ho.trans hZc) hZ + refine ⟨_, T', z', hR, fun x hx hxG => ?_⟩ + obtain ⟨w, hw⟩ := hC.2 _ hi₀ x hx + have hxA := hCA w hw (hZ (mem_range_self i₀)) + exact hxG.2 ⟨hxA, hxG.1⟩ + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section4c.lean b/LeanPool/GraphMinor/RST94/Section4c.lean new file mode 100644 index 0000000000..5685397c47 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section4c.lean @@ -0,0 +1,247 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section4b + +/-! +# Section 4 of "Quickly excluding a planar graph": (4.2) + +Robertson, Seymour and Thomas, J. Combin. Theory Ser. B 62 (1994), (4.2), pages 337–338, and the +transitivity of residual nodules (page 335). + +The paper chooses `Q` and the linkage with `Q ∪ ⋃ 𝒫` minimal. We keep the linkage and choose `Q` +with the fewest edges not on a path of the linkage. What the +proofs of (5.3) use is that `Q` does not leave a path `P` and come back, and this is `NoReturn`. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β ι : Type*} {G A B : Hypergraph α β} {θ : ℕ} {T : Set (Hypergraph α β × Hypergraph α + β)} + +/-- The paths `P i` form a linkage from `z` to `z'` for `G'` (page 335). -/ +abbrev IsLinkage (G G' : Hypergraph α β) (z z' : ι → α) (P : ∀ i, G.skeleton.Walk (z i) + (z' i)) : Prop := + (∀ i, (P i).IsPath) ∧ (∀ i, ∀ x ∈ (P i).support, x ∈ G'.vertexSet → x = z' i) ∧ + Pairwise fun i j => Disjoint {x | x ∈ (P i).support} {x | x ∈ (P j).support} + +/-- The walk `w` does not leave `X` and come back: each segment of `w` with both ends in `X` lies in +`X`. This is what the paper's condition that `P ∩ Q` is null or a path +gives, for `X = V(P)`. -/ +def NoReturn {K : SimpleGraph α} {s t : α} (X : Set α) (w : K.Walk s t) : Prop := + ∀ (a b : α) (w₁ : K.Walk s a) (w₂ : K.Walk a b) (w₃ : K.Walk b t), w = w₁.append (w₂.append w₃) + → a ∈ X → b ∈ X → ∀ c ∈ w₂.support, c ∈ X + +theorem NoReturn.of_cons {K : SimpleGraph α} {X : Set α} {r s t : α} {h : K.Adj r s} {w : K.Walk s + t} (hw : NoReturn X (SimpleGraph.Walk.cons h w)) : + NoReturn X w := fun a b w₁ w₂ w₃ he ha hb c hc => + hw a b (SimpleGraph.Walk.cons h w₁) w₂ w₃ (by rw [he, SimpleGraph.Walk.cons_append]) ha hb c hc + +/-- A walk from `X` to a vertex outside `X` has an edge that leaves `X`. -/ +theorem exists_boundary_edge {K : SimpleGraph α} {X : Set α} {a c : α} (w : K.Walk a c) + (ha : a ∈ X) (hc : c ∉ X) : + ∃ x y, x ∈ X ∧ y ∉ X ∧ s(x, y) ∈ w.edges := by + induction w with + | nil => exact absurd ha hc + | @cons u v t h p ih => + by_cases hv : v ∈ X + · obtain ⟨x, y, h₁, h₂, h₃⟩ := ih hv hc + exact ⟨x, y, h₁, h₂, by simp [h₃]⟩ + · exact ⟨u, v, ha, hv, by simp⟩ + +/-- Rerouting the middle part of a path `Q` along a path `p`: this is the choice of `Q` at the end +of the proof of (4.2) (page 338). The set `F` holds the edges of the linkage. -/ +theorem reroute {K : SimpleGraph α} {s t a b f l c : α} (w₁ : K.Walk s a) (w₂ : K.Walk a b) + (w₃ : K.Walk b t) + (hQ : (w₁.append (w₂.append w₃)).IsPath) (p : K.Walk f l) (hp : p.IsPath) (ha : a ∈ p.support) + (hb : b ∈ p.support) + (hal : a ≠ l) (hbl : b ≠ l) (hc : c ∈ w₂.support) (hcp : c ∉ p.support) {F : Set (Sym2 α)} + (hpF : ∀ e ∈ p.edges, e ∈ F) + (hF : ∀ x y, x ∈ p.support → y ∉ p.support → s(x, y) ∉ F) : + ∃ Q' : K.Walk s t, Q'.IsPath ∧ (∀ v ∈ Q'.support, v ∈ w₁.support ∨ v ∈ w₃.support ∨ + (v ∈ p.support ∧ v ≠ l)) ∧ + (∀ e ∈ Q'.edges, e ∈ F ∨ e ∈ (w₁.append (w₂.append w₃)).edges) ∧ + ∃ e ∈ (w₁.append (w₂.append w₃)).edges, e ∉ F ∧ e ∉ Q'.edges := by + classical + let seg := (p.takeUntil a ha).reverse.append (p.takeUntil b hb) + let Q₀ := (w₁.append seg).append w₃ + have hsegS : ∀ v ∈ seg.support, v ∈ p.support ∧ v ≠ l := by + intro v hv + have h₁ : ∀ {y : α} (hy : y ∈ p.support), y ≠ l → v ∈ (p.takeUntil y hy).support + → v ∈ p.support ∧ v ≠ l := fun hy hne hv' => + ⟨p.support_takeUntil_subset_support hy hv', fun e => notMem_takeUntil p hp hy hne (e ▸ hv')⟩ + rcases (SimpleGraph.Walk.mem_support_append_iff _ _).1 hv with hv | hv + · exact h₁ ha hal (by simpa using hv) + · exact h₁ hb hbl hv + have hsegE : ∀ e ∈ seg.edges, e ∈ F := by + intro e he + rw [SimpleGraph.Walk.edges_append, List.mem_append] at he + rcases he with he | he + · rw [SimpleGraph.Walk.edges_reverse, List.mem_reverse] at he + exact hpF e (p.edges_takeUntil_subset_edges ha he) + · exact hpF e (p.edges_takeUntil_subset_edges hb he) + have hQ₀S : ∀ v ∈ Q₀.support, v ∈ w₁.support ∨ v ∈ w₃.support ∨ (v ∈ p.support ∧ v ≠ l) := by + intro v hv + rcases (SimpleGraph.Walk.mem_support_append_iff _ _).1 hv with hv | hv + · rcases (SimpleGraph.Walk.mem_support_append_iff _ _).1 hv with hv | hv + · exact Or.inl hv + · exact Or.inr (Or.inr (hsegS v hv)) + · exact Or.inr (Or.inl hv) + have hQ₀E : ∀ e ∈ Q₀.edges, e ∈ w₁.edges ∨ e ∈ F ∨ e ∈ w₃.edges := by + intro e he + simp only [Q₀, SimpleGraph.Walk.edges_append, List.mem_append] at he + rcases he with (he | he) | he + · exact Or.inl he + · exact Or.inr (Or.inl (hsegE e (by simpa [SimpleGraph.Walk.edges_append] using he))) + · exact Or.inr (Or.inr he) + obtain ⟨x, y, hx, hy, hxy⟩ := exists_boundary_edge (X := {v | v ∈ p.support}) + (w₂.takeUntil c hc) ha hcp + have hxy₂ : s(x, y) ∈ w₂.edges := w₂.edges_takeUntil_subset_edges hc hxy + have hnd := hQ.isTrail.edges_nodup + rw [SimpleGraph.Walk.edges_append, SimpleGraph.Walk.edges_append, List.nodup_append] at hnd + have hn₁ : s(x, y) ∉ w₁.edges := fun h => hnd.2.2 _ h _ (List.mem_append_left _ hxy₂) rfl + have hnd₂ := hnd.2.1 + rw [List.nodup_append] at hnd₂ + have hn₃ : s(x, y) ∉ w₃.edges := fun h => hnd₂.2.2 _ hxy₂ _ h rfl + refine ⟨Q₀.bypass, Q₀.bypass_isPath, fun v hv => hQ₀S v (Q₀.support_bypass_subset_support hv), + fun e he => ?_, + s(x, y), ?_, hF x y hx hy, fun h => ?_⟩ + · rcases hQ₀E e (Q₀.edges_bypass_subset_edges he) with h | h | h + · exact Or.inr (by simp [SimpleGraph.Walk.edges_append, h]) + · exact Or.inl h + · exact Or.inr (by simp [SimpleGraph.Walk.edges_append, h]) + · simp [SimpleGraph.Walk.edges_append, hxy₂] + · rcases hQ₀E _ (Q₀.edges_bypass_subset_edges h) with h' | h' | h' + · exact hn₁ h' + · exact hF x y hx hy h' + · exact hn₃ h' + +/-- Residual nodules are transitive (page 335). -/ +theorem Residual.trans {z z₁ z₂ : ι → α} {G₁ G₂ : Hypergraph α β} {T₁ T₂ : Set + (Hypergraph α β × Hypergraph α β)} {θ₁ θ₂ : ℕ} + (hT : IsTangle G θ T) (h₁ : Residual G T θ z G₁ T₁ θ₁ z₁) (h₂ : Residual G₁ T₁ θ₁ z₁ G₂ T₂ θ₂ + z₂) : Residual G T θ z G₂ T₂ θ₂ z₂ := by + classical + obtain ⟨P, hP₁, hP₂, hP₃⟩ := h₁.link + obtain ⟨Q, hQ₁, hQ₂, hQ₃⟩ := h₂.link + refine ⟨h₂.nodule, h₂.le.trans h₁.le, fun i hi => h₁.avoid i (h₂.le.vertexSet_subset hi), + Conformal.trans h₁.le h₂.le hT h₁.nodule.tangle h₂.nodule.tangle h₁.conformal h₂.conformal, ?_⟩ + let R : ∀ i, G.skeleton.Walk (z i) (z₂ i) := fun i => ((P i).append ((Q i).mapLe + (skeleton_mono h₁.le))).bypass + have hR : ∀ i t, t ∈ (R i).support → t ∈ (P i).support ∨ t ∈ (Q i).support := fun i t ht => by + have := ((P i).append ((Q i).mapLe (skeleton_mono h₁.le))).support_bypass_subset_support ht + rcases (SimpleGraph.Walk.mem_support_append_iff _ _).1 this with h | h + · exact Or.inl h + · exact Or.inr (by simpa using h) + have hPG₁ : ∀ i t, t ∈ (Q i).support → t ∈ G₁.vertexSet := fun i t ht => + support_mem (Q i) (h₁.nodule.free.1 (mem_range_self i)) ht + refine ⟨R, fun i => SimpleGraph.Walk.bypass_isPath _, fun i t ht htG => ?_, fun i j hij + => disjoint_left.2 fun t ht ht' => ?_⟩ + · rcases hR i t ht with h | h + · have := hP₂ i t h (h₂.le.vertexSet_subset htG) + exact absurd (this ▸ htG) (h₂.avoid i) + · exact hQ₂ i t h htG + · have hc : ∀ i j, i ≠ j → t ∈ (P i).support → t ∉ (Q j).support := fun i j hij hi hj => by + have := hP₂ i t hi (hPG₁ j t hj) + subst this + exact disjoint_left.1 (hQ₃ hij) (Q i).start_mem_support hj + rcases hR i t ht with h₁' | h₁' <;> rcases hR j t ht' with h₂' | h₂' + · exact disjoint_left.1 (hP₃ hij) h₁' h₂' + · exact hc i j hij h₁' h₂' + · exact hc j i hij.symm h₂' h₁' + · exact disjoint_left.1 (hQ₃ hij) h₁' h₂' + +/-- **(4.2)** (page 337). `Q` goes from `z i` to `z j`, and the condition on `P ∩ Q` is `NoReturn`. +The paper's bound is for `k ≥ h`. -/ +theorem theorem_4_2 [Fintype ι] (hG : G.IsGraph) {z : ι → α} (hN : Nodule G T θ z) {k : ℕ} + (hh : Fintype.card ι ≤ k) + (hθ : 18 * (Fintype.card ι + k) + 3 ≤ θ) {i j : ι} (hij : i ≠ j) : + ∃ (G' : Hypergraph α β) (T' : Set (Hypergraph α β × Hypergraph α β)) (z' : ι → α) + (P : ∀ i, G.skeleton.Walk (z i) (z' i)) + (Q : G.skeleton.Walk (z i) (z j)), Residual G T θ z G' T' k z' ∧ IsLinkage G G' z z' P + ∧ Q.IsPath ∧ + (∀ x ∈ Q.support, x ∉ G'.vertexSet) ∧ ∀ l, NoReturn {x | x ∈ (P l).support} Q := by + classical + have hcard := Fintype.one_lt_card_iff.2 ⟨i, j, hij⟩ + have hfree2 : IsFreeSet G T θ {z i, z j} := hN.free.subset hN.tangle (by + rintro x (rfl | rfl) <;> exact mem_range_self _) + obtain ⟨C, hC, T₁, hT₁, hc⟩ := theorem_3_2 (k := Fintype.card ι + k) hG (by omega) (fun e => hij + (hN.inj e)) hN.tangle hθ hfree2 + let H := G.deleteVertices {x | x ∈ C.support} + have hH : H ≤ G := deleteVertices_le _ _ + have hfree0 : IsFreeSet G (inducedTangle G H T₁ (Fintype.card ι + k)) (Fintype.card ι + k) + (range z) := + ⟨hN.free.1, by rw [ncard_range hN.inj]; omega, fun A B hm hX => hN.free.2.2 (hc.2 hm) hX⟩ + obtain ⟨G', T', z', hR₀, hav⟩ := theorem_4_1 _ G hG z hN.inj {x | x ∈ C.support} (conn_support C) + (fun x hx => support_mem C (hN.free.1 (mem_range_self i)) hx) ⟨i, C.start_mem_support⟩ H _ T₁ + hH (fun x => Iff.rfl) + (fun f hf hno => ⟨hf, hno⟩) hT₁ (by omega) hfree0 rfl + rw [Nat.add_sub_cancel_left] at hR₀ + have hR : Residual G T θ z G' T' k z' := { + nodule := hR₀.nodule + le := hR₀.le + avoid := hR₀.avoid + conformal := ⟨by omega, hR₀.conformal.2.trans hc.2⟩ + link := hR₀.link } + obtain ⟨P, hP⟩ := hR.link + obtain ⟨hP₁, hP₂, hP₃⟩ := id hP + let F : Set (Sym2 α) := {e | ∃ l, e ∈ (P l).edges} + let μ : G.skeleton.Walk (z i) (z j) → ℕ := fun Q => ({e | e ∈ Q.edges} \ F).ncard + obtain ⟨Q, ⟨hQ₁, hQ₂⟩, hmin⟩ := exists_min_measure (P := fun Q : G.skeleton.Walk (z i) (z j) + => Q.IsPath ∧ ∀ x ∈ Q.support, x ∉ G'.vertexSet) μ + ⟨C, hC, hav⟩ + refine ⟨G', T', z', P, Q, hR, hP, hQ₁, hQ₂, fun l a b w₁ w₂ w₃ he ha hb c hc' => ?_⟩ + by_contra hcX + have hz' : z' l ∈ G'.vertexSet := hR.nodule.free.1 (mem_range_self l) + have haQ : a ∈ Q.support := by + rw [he] + exact (SimpleGraph.Walk.mem_support_append_iff _ _).2 (Or.inl w₁.end_mem_support) + have hbQ : b ∈ Q.support := by + rw [he] + exact (SimpleGraph.Walk.mem_support_append_iff _ _).2 (Or.inr + ((SimpleGraph.Walk.mem_support_append_iff _ _).2 (Or.inr w₃.start_mem_support))) + have hal : a ≠ z' l := fun e => hQ₂ a haQ (e ▸ hz') + have hbl : b ≠ z' l := fun e => hQ₂ b hbQ (e ▸ hz') + have hF : ∀ x y, x ∈ (P l).support → y ∉ (P l).support → s(x, y) ∉ F := by + rintro x y hx hy ⟨m, hm⟩ + by_cases hml : m = l + · subst hml + exact hy ((P m).snd_mem_support_of_mem_edges hm) + · exact disjoint_left.1 (hP₃ hml) ((P m).fst_mem_support_of_mem_edges hm) hx + have hQ' := hQ₁ + rw [he] at hQ' + obtain ⟨Q', hQ'₁, hQ'₂, hQ'₃, e, he₁, he₂, he₃⟩ := reroute w₁ w₂ w₃ hQ' (P l) + (hP₁ l) ha hb hal hbl hc' hcX (F := F) + (fun e he' => ⟨l, he'⟩) hF + rw [← he] at hQ'₃ he₁ + have hav' : ∀ x ∈ Q'.support, x ∉ G'.vertexSet := by + intro x hx hxG + rcases hQ'₂ x hx with h | h | ⟨h, hne⟩ + · refine hQ₂ x ?_ hxG + rw [he] + exact (SimpleGraph.Walk.mem_support_append_iff _ _).2 (Or.inl h) + · refine hQ₂ x ?_ hxG + rw [he] + exact (SimpleGraph.Walk.mem_support_append_iff _ _).2 (Or.inr + ((SimpleGraph.Walk.mem_support_append_iff _ _).2 (Or.inr h))) + · exact hne (hP₂ l x h hxG) + have hle := hmin Q' ⟨hQ'₁, hav'⟩ + have hlt : μ Q' < μ Q := by + refine ncard_lt_ncard ⟨?_, fun hsub => ?_⟩ (List.finite_toSet _ |>.subset sdiff_subset) + · rintro f ⟨hf₁, hf₂⟩ + exact ⟨(hQ'₃ f hf₁).resolve_left hf₂, hf₂⟩ + · exact he₃ (hsub ⟨he₁, he₂⟩).1 + omega + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section4d.lean b/LeanPool/GraphMinor/RST94/Section4d.lean new file mode 100644 index 0000000000..1f259e44ef --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section4d.lean @@ -0,0 +1,173 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section4c + +/-! +# Section 4 of "Quickly excluding a planar graph": (4.3) + +Robertson, Seymour and Thomas, J. Combin. Theory Ser. B 62 (1994), (4.3), page 338. A component of +`G \ V(G')` that holds `Z` is given as a connected set that holds `Z` and avoids +`V(G')`. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β ι : Type*} {G : Hypergraph α β} {θ : ℕ} {T : Set (Hypergraph α β × Hypergraph α β)} + +/-- The vertices of `Z` lie in the union of at most `r` connected sets that avoid `V(G')`, as in the +proof of (4.3). -/ +def Cover (G G' : Hypergraph α β) (z : ι → α) (r : ℕ) : Prop := + ∃ 𝒟 : Finset (Set α), 𝒟.card ≤ r ∧ (∀ D ∈ 𝒟, Conn G D ∧ ∀ x ∈ D, x ∉ G'.vertexSet) + ∧ ∀ i, ∃ D ∈ 𝒟, z i ∈ D + +/-- The numbers in the proof of (4.3). -/ +theorem bound_4_3 {n k r : ℕ} (hn : 2 ≤ n) (hk : n ≤ 2 * k) (hr : 1 ≤ r) : + 18 * (n + k * 20 ^ r) + 3 ≤ k * 20 ^ (r + 1) ∧ n ≤ k * 20 ^ r := by + have h₁ : 20 ≤ 20 ^ r := by + calc 20 = 20 ^ 1 := rfl + _ ≤ 20 ^ r := Nat.pow_le_pow_right (by omega) hr + have h₂ : k * 20 ≤ k * 20 ^ r := Nat.mul_le_mul_left k h₁ + have h₃ : k * 20 ^ (r + 1) = k * 20 ^ r * 20 := by rw [pow_succ, Nat.mul_assoc] + rw [h₃] + omega + +variable [Fintype ι] + +/-- The connected set `M` in the proof of (4.3): the union of two connected sets that hold `z i`, `z +j`, the two paths of the linkage, and `Q`. -/ +theorem conn_merge {G₁ : Hypergraph α β} (hle : G₁ ≤ G) {a b c d : α} {D D' : Set α} + (hD : Conn G D) (hD' : Conn G D') + (ha : a ∈ D) (hb : b ∈ D') (p : G.skeleton.Walk a c) (p' : G.skeleton.Walk b d) + (Q : G₁.skeleton.Walk c d) : + Conn G (D ∪ {x | x ∈ p.support} ∪ {x | x ∈ Q.support} ∪ {x | x ∈ p'.support} ∪ D') := by + have h₁ := hD.union (conn_support p) ⟨a, ha, p.start_mem_support⟩ + have h₂ := h₁.union ((conn_support Q).mono hle) ⟨c, Or.inr p.end_mem_support, Q.start_mem_support⟩ + have h₃ := h₂.union (conn_support p') ⟨d, Or.inr Q.end_mem_support, p'.end_mem_support⟩ + exact h₃.union hD' ⟨b, Or.inr p'.start_mem_support, hb⟩ + +/-- **(4.3)** (page 338), by the induction on `r` of the paper. -/ +theorem cover_descent (hG : G.IsGraph) (hT : IsTangle G θ T) {z : ι → α} {k : ℕ} (hn : 2 + ≤ Fintype.card ι) (hk : Fintype.card ι ≤ 2 * k) (r : ℕ) : + ∀ (G₁ : Hypergraph α β) (T₁ : Set (Hypergraph α β × Hypergraph α β)) (θ₁ : ℕ) (z₁ : ι + → α), Residual G T θ z G₁ T₁ θ₁ z₁ → k * 20 ^ (r + 1) ≤ θ₁ → Cover G G₁ z (r + 1) → + ∃ (G' : Hypergraph α β) (T' : Set (Hypergraph α β × Hypergraph α β)) (θ' : ℕ) (z' : ι + → α), Residual G T θ z G' T' θ' z' ∧ k ≤ θ' ∧ + ∃ D, Conn G D ∧ range z ⊆ D ∧ ∀ x ∈ D, x ∉ G'.vertexSet := by + classical + have hne : Nonempty ι := Fintype.card_pos_iff.1 (by omega) + obtain ⟨i₀⟩ := hne + induction r with + | zero => + rintro G₁ T₁ θ₁ z₁ hR hθ ⟨𝒟, h𝒟, hmem, hcov⟩ + obtain ⟨D, hD, hzD⟩ := hcov i₀ + refine ⟨G₁, T₁, θ₁, z₁, hR, by omega, D, (hmem D hD).1, ?_, (hmem D hD).2⟩ + rintro _ ⟨i, rfl⟩ + obtain ⟨D', hD', hz⟩ := hcov i + have := Finset.card_le_one.1 h𝒟 D' hD' D hD + exact this ▸ hz + | succ r ih => + rintro G₁ T₁ θ₁ z₁ hR hθ ⟨𝒟, h𝒟, hmem, hcov⟩ + obtain ⟨D₀, hD₀, hz₀⟩ := hcov i₀ + by_cases hall : ∀ j, z j ∈ D₀ + · exact ih G₁ T₁ θ₁ z₁ hR (by + have h₁ : k * 20 ^ (r + 1) ≤ k * 20 ^ (r + 1 + 1) := Nat.mul_le_mul_left k + (Nat.pow_le_pow_right (by omega) (by omega)) + omega) ⟨{D₀}, by simp, by + intro D hD + rw [Finset.mem_singleton] at hD + exact hD ▸ hmem D₀ hD₀, fun i => ⟨D₀, by simp, hall i⟩⟩ + push Not at hall + obtain ⟨j₀, hj₀⟩ := hall + obtain ⟨D₁, hD₁, hz₁⟩ := hcov j₀ + have hij : i₀ ≠ j₀ := fun e => hj₀ (e ▸ hz₀) + have hDne : D₁ ≠ D₀ := fun e => hj₀ (e ▸ hz₁) + obtain ⟨hb₁, hb₂⟩ := bound_4_3 (r := r + 1) hn hk (by omega) + have hG₁ : G₁.IsGraph := IsGraph.of_le hG hR.le + obtain ⟨G₂, T₂, z₂, P, Q, hR₂, -, -, hQ, -⟩ := theorem_4_2 (k := k * 20 ^ + (r + 1)) hG₁ hR.nodule hb₂ (by omega) hij + obtain ⟨p, hp₁, hp₂, hp₃⟩ := hR.link + refine ih G₂ T₂ _ z₂ (hR.trans hT hR₂) le_rfl ?_ + have hG₂₁ : ∀ {x}, x ∈ G₂.vertexSet → x ∈ G₁.vertexSet := fun hx => hR₂.le.vertexSet_subset hx + have hpav : ∀ i, ∀ x ∈ (p i).support, x ∉ G₂.vertexSet := fun i x hx hxG => by + have := hp₂ i x hx (hG₂₁ hxG) + exact hR₂.avoid i (this ▸ hxG) + let M : Set α := D₀ ∪ {x | x ∈ (p i₀).support} ∪ {x | x ∈ Q.support} ∪ {x | x ∈ + (p j₀).support} ∪ D₁ + have hMconn : Conn G M := conn_merge hR.le (hmem D₀ hD₀).1 (hmem D₁ hD₁).1 hz₀ hz₁ (p i₀) + (p j₀) Q + have hMav : ∀ x ∈ M, x ∉ G₂.vertexSet := by + rintro x ((((hx | hx) | hx) | hx) | hx) hxG + · exact (hmem D₀ hD₀).2 x hx (hG₂₁ hxG) + · exact hpav _ x hx hxG + · exact hQ x hx hxG + · exact hpav _ x hx hxG + · exact (hmem D₁ hD₁).2 x hx (hG₂₁ hxG) + refine ⟨insert M ((𝒟.erase D₀).erase D₁), ?_, ?_, fun i => ?_⟩ + · have h₁ := Finset.card_insert_le M ((𝒟.erase D₀).erase D₁) + have h₂ : ((𝒟.erase D₀).erase D₁).card = 𝒟.card - 2 := by + rw [Finset.card_erase_of_mem (Finset.mem_erase.2 ⟨hDne, hD₁⟩), Finset.card_erase_of_mem hD₀] + omega + have h₃ : 2 ≤ 𝒟.card := Finset.one_lt_card.2 ⟨D₀, hD₀, D₁, hD₁, hDne.symm⟩ + omega + · intro D hD + rcases Finset.mem_insert.1 hD with rfl | hD + · exact ⟨hMconn, hMav⟩ + · have hD' := Finset.mem_of_mem_erase (Finset.mem_of_mem_erase hD) + exact ⟨(hmem D hD').1, fun x hx hxG => (hmem D hD').2 x hx (hG₂₁ hxG)⟩ + · obtain ⟨D, hD, hz⟩ := hcov i + by_cases h₀ : D = D₀ + · exact ⟨M, Finset.mem_insert_self _ _, Or.inl (Or.inl (Or.inl (Or.inl (h₀ ▸ hz))))⟩ + by_cases h₁ : D = D₁ + · exact ⟨M, Finset.mem_insert_self _ _, Or.inr (h₁ ▸ hz)⟩ + exact ⟨D, Finset.mem_insert_of_mem (Finset.mem_erase.2 ⟨h₁, Finset.mem_erase.2 ⟨h₀, hD⟩⟩), hz⟩ + +/-- **(4.3)** (page 338). -/ +theorem theorem_4_3 (hG : G.IsGraph) {z : ι → α} (hN : Nodule G T θ z) {k : ℕ} (hn : 2 + ≤ Fintype.card ι) (hk : Fintype.card ι ≤ 2 * k) + (hθ : k * 20 ^ Fintype.card ι ≤ θ) : + ∃ (G' : Hypergraph α β) (T' : Set (Hypergraph α β × Hypergraph α β)) (θ' : ℕ) (z' : ι + → α), Residual G T θ z G' T' θ' z' ∧ k ≤ θ' ∧ + ∃ D, Conn G D ∧ range z ⊆ D ∧ ∀ x ∈ D, x ∉ G'.vertexSet := by + classical + obtain ⟨i, j, hij⟩ := Fintype.exists_pair_of_one_lt_card (by omega : 1 < Fintype.card ι) + obtain ⟨r, hr⟩ : ∃ r, Fintype.card ι = r + 1 + 1 := ⟨Fintype.card ι - 2, by omega⟩ + obtain ⟨hb₁, hb₂⟩ := bound_4_3 (r := r + 1) hn hk (by omega) + rw [← hr] at hb₁ + obtain ⟨G₁, T₁, z₁, P, Q, hR, -, -, hQ, -⟩ := theorem_4_2 (k := k * 20 ^ (r + 1)) hG hN hb₂ + (by omega) hij + refine cover_descent hG hN.tangle hn hk r G₁ T₁ _ z₁ hR le_rfl ?_ + refine ⟨insert {x | x ∈ Q.support} ((Finset.univ.erase i).erase j |>.image fun l => + ({z l} : Set α)), ?_, ?_, fun l => ?_⟩ + · have h₁ := Finset.card_insert_le ({x | x ∈ Q.support} : Set α) (((Finset.univ.erase i).erase + j).image fun l => ({z l} : Set α)) + have h₂ := Finset.card_image_le (s := (Finset.univ.erase i).erase j) (f := fun l => + ({z l} : Set α)) + have h₃ : ((Finset.univ.erase i).erase j).card = Fintype.card ι - 2 := by + rw [Finset.card_erase_of_mem (Finset.mem_erase.2 ⟨hij.symm, Finset.mem_univ j⟩), + Finset.card_erase_of_mem (Finset.mem_univ i), Finset.card_univ] + omega + omega + · intro D hD + rcases Finset.mem_insert.1 hD with rfl | hD + · exact ⟨conn_support Q, hQ⟩ + · obtain ⟨l, -, rfl⟩ := Finset.mem_image.1 hD + exact ⟨conn_singleton, fun x hx => (show x = z l from hx) ▸ hR.avoid l⟩ + · by_cases hi : l = i + · exact ⟨_, Finset.mem_insert_self _ _, hi ▸ Q.start_mem_support⟩ + by_cases hj : l = j + · exact ⟨_, Finset.mem_insert_self _ _, hj ▸ Q.end_mem_support⟩ + exact ⟨{z l}, Finset.mem_insert_of_mem (Finset.mem_image.2 ⟨l, by simp [hi, hj], rfl⟩), rfl⟩ + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section4e.lean b/LeanPool/GraphMinor/RST94/Section4e.lean new file mode 100644 index 0000000000..9879d9e1f0 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section4e.lean @@ -0,0 +1,382 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section4d +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Positivity + +/-! +# Section 4 of "Quickly excluding a planar graph": (4.4) + +Robertson, Seymour and Thomas, J. Combin. Theory Ser. B 62 (1994), (4.4), pages 338–339. `Chain` +records the nodules `G_r, 𝒯_r, Z_r` of the proof after `r` steps. The paths `P c` are +the paper's paths `P_i`, and the sets `𝒞 s` are the components `C_r`. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β κ ι : Type*} {G : Hypergraph α β} {θ : ℕ} {T : Set (Hypergraph α β × Hypergraph α β)} + +/-- (2.4) used as in the proof of (4.4): a free set extends to a free set of any size up to the +order. -/ +theorem exists_free_superset (hT : IsTangle G θ T) {X : Set α} (hX : IsFreeSet G T θ X) {n : ℕ} + (h₁ : X.ncard ≤ n) (h₂ : n ≤ θ) : + ∃ Y, X ⊆ Y ∧ Y.ncard = n ∧ IsFreeSet G T θ Y := by + obtain ⟨M, hE, hind, hrk⟩ := GraphMinor.GM10.theorem_12_2_proof G hT + obtain ⟨B, hB, hXB⟩ := ((hind X).2 hX).exists_isBase_superset + have hBfree : IsFreeSet G T θ B := (hind B).1 hB.indep + have hrank : tangleRank T θ G.vertexSet = θ := by + refine le_antisymm (tangleRank_le_order hT _) ((le_rank_iff le_rfl).2 fun A B' hm hV => ?_) + exact absurd (subset_antisymm (hT.isSeparation hm).left_le.vertexSet_subset hV) (hT.axiom3 hm) + have hBfin : B.Finite := G.vertexSet_finite.subset hBfree.1 + have hBc : B.ncard = θ := by + have h₃ : M.eRk M.E = B.encard := by + rw [Matroid.eRk_ground, hB.encard_eq_eRank] + rw [hE, hrk _ subset_rfl, hrank, ← hBfin.cast_ncard_eq] at h₃ + exact (Nat.cast_inj.1 h₃).symm + obtain ⟨Y, hXY, hYB, hYc⟩ := exists_subsuperset_card_eq hXB h₁ (hBc ▸ h₂) + exact ⟨Y, hXY, hYc, hBfree.subset hT hYB⟩ + +/-- Two paths that share only their common vertex make a path. -/ +theorem isPath_append {K : SimpleGraph α} {a b c : α} {w₁ : K.Walk a b} {w₂ : K.Walk b c} + (h₁ : w₁.IsPath) (h₂ : w₂.IsPath) + (hd : ∀ x ∈ w₁.support, x ∈ w₂.support → x = b) : (w₁.append w₂).IsPath := by + rw [SimpleGraph.Walk.isPath_def, SimpleGraph.Walk.support_append, List.nodup_append] + have hn := h₂.support_nodup + rw [← SimpleGraph.Walk.cons_tail_support, List.nodup_cons] at hn + refine ⟨h₁.support_nodup, hn.2, fun x hx y hy he => ?_⟩ + subst he + have hxw : x ∈ w₂.support := by + rw [← SimpleGraph.Walk.cons_tail_support] + exact List.mem_cons_of_mem _ hy + exact hn.1 (hd x hx hxw ▸ hy) + +/-- Among disjoint sets, more of them than the size of `X`, one misses `X`. -/ +theorem exists_avoid {γ : Type*} (s : Finset γ) (U : γ → Set α) (hd : ∀ i ∈ s, ∀ j ∈ s, i ≠ j + → Disjoint (U i) (U j)) {X : Set α} (hX : X.Finite) + (hlt : X.ncard < s.card) : ∃ i ∈ s, Disjoint (U i) X := by + by_contra hcon + push Not at hcon + have hpos : ∀ i ∈ s, 1 ≤ (X ∩ U i).ncard := fun i hi => by + obtain ⟨x, hx₁, hx₂⟩ := not_disjoint_iff.1 (hcon i hi) + exact (ncard_pos (hX.subset inter_subset_left)).2 ⟨x, hx₂, hx₁⟩ + have h₁ : s.card ≤ ∑ i ∈ s, (X ∩ U i).ncard := by + calc s.card = ∑ _i ∈ s, 1 := by simp + _ ≤ _ := Finset.sum_le_sum hpos + rw [sum_ncard_eq _ _ (fun i => hX.subset inter_subset_left) fun i hi j hj hij => + (hd i hi j hj hij).mono inter_subset_right inter_subset_right] at h₁ + have h₂ := ncard_le_ncard (iUnion₂_subset fun i (_ : i ∈ s) => (inter_subset_left : X ∩ U i ⊆ X)) + hX + omega + +/-- A walk of `G` that avoids `W` is a walk of the graph `G \ W`. -/ +theorem exists_walk_delete (hG : G.IsGraph) {W : Set α} {a b : α} (w : G.skeleton.Walk a b) + (hw : ∀ x ∈ w.support, x ∉ W) : + ∃ w' : (G.deleteVertices W).skeleton.Walk a b, w'.support = w.support := by + induction w with + | nil => exact ⟨SimpleGraph.Walk.nil, rfl⟩ + | @cons x y c hadj q ih => + obtain ⟨q', hq'⟩ := ih fun t ht => hw t (by simp [ht]) + obtain ⟨hne, f, h₁, h₂⟩ := id hadj + have hno : ∀ v ∈ W, ¬ G.Inc f v := fun v hv hi => by + rcases end_eq_or hG h₁ h₂ hne hi with rfl | rfl + · exact hw _ (by simp) hv + · exact hw _ (by simp) hv + have hadj' : (G.deleteVertices W).skeleton.Adj x y := ⟨hne, f, ⟨h₁, hno⟩, ⟨h₂, hno⟩⟩ + exact ⟨SimpleGraph.Walk.cons hadj' q', by simp [hq']⟩ + +/-- A connected set that avoids `W` is connected in `G \ W`. -/ +theorem Conn.delete (hG : G.IsGraph) {W D : Set α} (hD : Conn G D) (hW : Disjoint D W) : Conn + (G.deleteVertices W) D := + ⟨hD.1, fun x hx y hy => by + obtain ⟨w, hw⟩ := hD.2 x hx y hy + obtain ⟨w', hw'⟩ := exists_walk_delete hG w fun t ht => disjoint_left.1 hW (hw t ht) + exact ⟨w', fun t ht => hw t (hw' ▸ ht)⟩⟩ + +/-- The nodules `G_r, 𝒯_r, Z_r` after `r` steps of the proof of (4.4). -/ +structure Chain (G : Hypergraph α β) (T : Set (Hypergraph α β × Hypergraph α β)) (θ : ℕ) (y₀ : κ + → α) (r : ℕ) (G' : Hypergraph α β) + (T' : Set (Hypergraph α β × Hypergraph α β)) (θ' : ℕ) (y' : κ → α) (P : ∀ c, G.skeleton.Walk + (y₀ c) (y' c)) (𝒞 : ℕ → Set α) : Prop where + nodule : Nodule G' T' θ' y' + le : G' ≤ G + conformal : Conformal G G' T T' θ θ' + link : IsLinkage G G' y₀ y' P + avoid : r ≠ 0 → ∀ c, y₀ c ∉ G'.vertexSet + fix : r = 0 → ∀ c, y' c = y₀ c + conn : ∀ s < r, Conn G (𝒞 s) + disj : ∀ s < r, ∀ s' < r, s ≠ s' → Disjoint (𝒞 s) (𝒞 s') + off : ∀ s < r, ∀ x ∈ 𝒞 s, x ∉ G'.vertexSet + hit : ∀ s < r, ∀ c, ∃ t ∈ (P c).support, t ∈ 𝒞 s ∧ t ≠ y' c + +/-- One step of the proof of (4.4). -/ +theorem Chain.step [Fintype κ] (hG : G.IsGraph) (hT : IsTangle G θ T) {y₀ y' : κ + → α} {r θ' b : ℕ} {G' : Hypergraph α β} {T' : Set (Hypergraph α β × Hypergraph α β)} + {P : ∀ c, G.skeleton.Walk (y₀ c) (y' c)} {𝒞 : ℕ → Set α} (hc : Chain G T θ y₀ r G' T' θ' y' P + 𝒞) (hn : 2 ≤ Fintype.card κ) (hk : Fintype.card κ ≤ 2 * b) + (hθ : b * 20 ^ Fintype.card κ ≤ θ') : + ∃ G₂ T₂ θ₂ y₂ P₂ 𝒞₂, Chain G T θ y₀ (r + 1) G₂ T₂ θ₂ y₂ P₂ 𝒞₂ ∧ b ≤ θ₂ := by + classical + have hG' : G'.IsGraph := IsGraph.of_le hG hc.le + obtain ⟨G₂, T₂, θ₂, y₂, hR, hb, D, hD, hyD, hDav⟩ := theorem_4_3 hG' hc.nodule hn hk hθ + obtain ⟨p, hp₁, hp₂, hp₃⟩ := hR.link + obtain ⟨hP₁, hP₂, hP₃⟩ := hc.link + let P₂ : ∀ c, G.skeleton.Walk (y₀ c) (y₂ c) := fun c => (P c).append ((p c).mapLe + (skeleton_mono hc.le)) + have hmem : ∀ c t, t ∈ (P₂ c).support ↔ t ∈ (P c).support ∨ t ∈ (p c).support := fun c t => by + simp [P₂, SimpleGraph.Walk.mem_support_append_iff] + have hpG : ∀ c t, t ∈ (p c).support → t ∈ G'.vertexSet := fun c t ht => + support_mem (p c) (hc.nodule.free.1 (mem_range_self c)) ht + have hG₂ : ∀ {x}, x ∈ G₂.vertexSet → x ∈ G'.vertexSet := fun hx => hR.le.vertexSet_subset hx + have hDG : D ⊆ G'.vertexSet := by + obtain ⟨c⟩ : Nonempty κ := Fintype.card_pos_iff.1 (by omega) + intro x hx + obtain ⟨w, hw⟩ := hD.2 (y' c) (hyD (mem_range_self c)) x hx + exact support_mem w (hc.nodule.free.1 (mem_range_self c)) w.end_mem_support + refine ⟨G₂, T₂, θ₂, y₂, P₂, Function.update 𝒞 r D, ?_, hb⟩ + have hup : ∀ s < r, Function.update 𝒞 r D s = 𝒞 s := fun s hs => Function.update_of_ne hs.ne _ _ + have hupr : Function.update 𝒞 r D r = D := Function.update_self _ _ _ + refine ⟨hR.nodule, hR.le.trans hc.le, Conformal.trans hc.le hR.le hT hc.nodule.tangle + hR.nodule.tangle hc.conformal hR.conformal, ⟨fun c => ?_, fun c t ht htG => ?_, + fun i j hij => disjoint_left.2 fun t ht ht' => ?_⟩, fun _ c hcG => ?_, fun h => absurd h + (Nat.succ_ne_zero r), fun s hs => ?_, fun s hs s' hs' hne => ?_, fun s hs x hx hxG + => ?_, fun s hs c => ?_⟩ + · refine isPath_append (hP₁ c) ((hp₁ c).mapLe _) fun x hx hx' => hP₂ c x hx (hpG c x + (by simpa using hx')) + · rcases (hmem c t).1 ht with h | h + · have := hP₂ c t h (hG₂ htG) + exact absurd (this ▸ htG) (hR.avoid c) + · exact hp₂ c t h htG + · have hx : ∀ i j, i ≠ j → t ∈ (P i).support → t ∉ (p j).support := fun i j hij hi hj => by + have := hP₂ i t hi (hpG j t hj) + subst this + exact disjoint_left.1 (hp₃ hij) (p i).start_mem_support hj + rcases (hmem i t).1 ht with h₁ | h₁ <;> rcases (hmem j t).1 ht' with h₂ | h₂ + · exact disjoint_left.1 (hP₃ hij) h₁ h₂ + · exact hx i j hij h₁ h₂ + · exact hx j i hij.symm h₂ h₁ + · exact disjoint_left.1 (hp₃ hij) h₁ h₂ + · by_cases hr : r = 0 + · subst hr + exact hR.avoid c (hc.fix rfl c ▸ hcG) + · exact hc.avoid hr c (hG₂ hcG) + · rcases Nat.lt_succ_iff_lt_or_eq.1 hs with hs | rfl + · rw [hup s hs] + exact hc.conn s hs + · rw [hupr] + exact hD.mono hc.le + · have hoff : ∀ s < r, ∀ s' ≤ r, s' = r → Disjoint (𝒞 s) D := fun s hs _ _ _ => + disjoint_left.2 fun x hx hxD => hc.off s hs x hx (hDG hxD) + rcases Nat.lt_succ_iff_lt_or_eq.1 hs with hs₁ | rfl <;> rcases Nat.lt_succ_iff_lt_or_eq.1 hs' + with hs₂ | rfl + · rw [hup s hs₁, hup s' hs₂] + exact hc.disj s hs₁ s' hs₂ hne + · rw [hup s hs₁, hupr] + exact hoff s hs₁ _ le_rfl rfl + · rw [hup s' hs₂, hupr] + exact (hoff s' hs₂ _ le_rfl rfl).symm + · exact absurd rfl hne + · rcases Nat.lt_succ_iff_lt_or_eq.1 hs with hs₁ | rfl + · rw [hup s hs₁] at hx + exact hc.off s hs₁ x hx (hG₂ hxG) + · rw [hupr] at hx + exact hDav x hx hxG + · rcases Nat.lt_succ_iff_lt_or_eq.1 hs with hs₁ | rfl + · obtain ⟨t, ht₁, ht₂, -⟩ := hc.hit s hs₁ c + rw [hup s hs₁] + refine ⟨t, (hmem c t).2 (Or.inl ht₁), ht₂, fun e => hc.off s hs₁ t ht₂ ?_⟩ + exact e ▸ hG₂ (hR.nodule.free.1 (mem_range_self c)) + · rw [hupr] + exact ⟨y' c, (hmem c _).2 (Or.inl (P c).end_mem_support), hyD (mem_range_self c), + fun e => hR.avoid c (e ▸ hR.nodule.free.1 (mem_range_self c))⟩ + +/-- `h` steps of the proof of (4.4), by induction. -/ +theorem exists_chain [Fintype κ] (hG : G.IsGraph) {y₀ : κ → α} (hN : Nodule G T θ y₀) {k h : ℕ} + (hn : 2 ≤ Fintype.card κ) (hk : Fintype.card κ ≤ 2 * k) + (hθ : k * 20 ^ (Fintype.card κ * h) ≤ θ) (r : ℕ) (hr : r ≤ h) : + ∃ G' T' θ' y' P 𝒞, Chain G T θ y₀ r G' T' θ' y' P 𝒞 ∧ k * 20 ^ (Fintype.card κ * (h - r)) ≤ θ' + := by + induction r with + | zero => + refine ⟨G, T, θ, y₀, fun c => SimpleGraph.Walk.nil, fun _ => ∅, ⟨hN, le_rfl, + conformal_of_subset hN.tangle le_rfl subset_rfl, ⟨fun _ => SimpleGraph.Walk.IsPath.nil, fun c + t ht _ => ?_, + fun i j hij => ?_⟩, fun h => absurd rfl h, fun _ _ => rfl, fun s hs => absurd hs + (Nat.not_lt_zero s), fun s hs => absurd hs (Nat.not_lt_zero s), fun s hs => absurd hs + (Nat.not_lt_zero s), + fun s hs => absurd hs (Nat.not_lt_zero s)⟩, hθ⟩ + · simpa using ht + · simpa using fun e => hij (hN.inj e) + | succ r ih => + obtain ⟨G', T', θ', y', P, 𝒞, hc, hb⟩ := ih (by omega) + have hpow : Fintype.card κ * (h - r) = Fintype.card κ * (h - (r + 1)) + Fintype.card κ := by + obtain ⟨m, hm⟩ : ∃ m, h - r = m + 1 := ⟨h - r - 1, by omega⟩ + rw [hm, show h - (r + 1) = m by omega, Nat.mul_succ] + have hb₂ : k * 20 ^ (Fintype.card κ * (h - (r + 1))) * 20 ^ Fintype.card κ ≤ θ' := by + rw [Nat.mul_assoc, ← pow_add, ← hpow] + exact hb + have hk₂ : Fintype.card κ ≤ 2 * (k * 20 ^ (Fintype.card κ * (h - (r + 1)))) := + hk.trans (Nat.mul_le_mul_left 2 (Nat.le_mul_of_pos_right k (by positivity))) + obtain ⟨G₂, T₂, θ₂, y₂, P₂, 𝒞₂, hc₂, hb₃⟩ := hc.step hG hN.tangle hn hk₂ hb₂ + exact ⟨G₂, T₂, θ₂, y₂, P₂, 𝒞₂, hc₂, hb₃⟩ + +/-- **(4.4)** (page 338). The set `Y₀` is the paper's `Z₀`, and it indexes `Y`. -/ +theorem theorem_4_4 [Fintype ι] (hG : G.IsGraph) {z : ι → α} (hN : Nodule G T θ z) {k n : ℕ} + (hh : 2 ≤ Fintype.card ι) (hhn : Fintype.card ι ≤ n) (hn : n ≤ 2 * k) + (hθ : k * 20 ^ (n * Fintype.card ι) ≤ θ) : + ∃ (Y₀ : Set α) (_ : Fintype Y₀) (G' : Hypergraph α β) (T' : Set (Hypergraph α β × Hypergraph α + β)) (θ' : ℕ) (y : Y₀ → α), Fintype.card Y₀ = n ∧ + Nodule G' T' θ' y ∧ k ≤ θ' ∧ G' ≤ G ∧ Conformal G G' T T' θ θ' ∧ (∀ i, z i ∉ G'.vertexSet) + ∧ ∀ Z' : Set α, Z' ⊆ range y → Z'.ncard = Fintype.card ι → + ∃ z' : ι → α, range z' = Z' ∧ Residual G T θ z G' T' θ' z' := by + classical + have hZc := ncard_range hN.inj + have h1 : n ≤ k * 20 ^ (n * Fintype.card ι) := by + have hk1 : 1 ≤ k := by omega + have h₂ : 2 * n ≤ 20 ^ (n * Fintype.card ι) := by + have h₃ : n * 2 ≤ 2 ^ n * 2 := Nat.mul_le_mul_right 2 n.lt_two_pow_self.le + have h₄ : 2 ^ (n + 1) ≤ 20 ^ (n + 1) := Nat.pow_le_pow_left (by omega) _ + have h₅ : 20 ^ (n + 1) ≤ 20 ^ (n * Fintype.card ι) := Nat.pow_le_pow_right (by omega) + (by nlinarith) + rw [pow_succ] at h₄ + omega + nlinarith + obtain ⟨Y₀, hZY, hYc, hYfree⟩ := exists_free_superset hN.tangle hN.free (by omega) (h1.trans hθ) + have hYf : Y₀.Finite := G.vertexSet_finite.subset hYfree.1 + have hF : Fintype Y₀ := hYf.fintype + have hcard : Fintype.card Y₀ = n := by + rw [← hYc, ← Nat.card_eq_fintype_card, Nat.card_coe_set_eq] + have hN₀ : Nodule G T θ (Subtype.val : Y₀ → α) := by + refine ⟨hN.tangle, Subtype.val_injective, ?_⟩ + rw [Subtype.range_coe] + exact hYfree + obtain ⟨G', T', θ', y, P, 𝒞, hc, hb⟩ := exists_chain (h := Fintype.card ι) (κ := Y₀) hG hN₀ (k + := k) (by omega) (by omega) (by rw [hcard]; exact hθ) _ le_rfl + rw [Nat.sub_self, Nat.mul_zero, pow_zero, Nat.mul_one] at hb + have hr0 : Fintype.card ι ≠ 0 := by omega + have hav := hc.avoid hr0 + obtain ⟨hP₁, hP₂, hP₃⟩ := hc.link + have hzav : ∀ i, z i ∉ G'.vertexSet := fun i => hav ⟨z i, hZY (mem_range_self i)⟩ + refine ⟨Y₀, hF, G', T', θ', y, hcard, hc.nodule, hb, hc.le, hc.conformal, hzav, fun Z' hZ' hZ'c + => ?_⟩ + have hyinj := hc.nodule.inj + let W : Set α := G'.vertexSet \ Z' + let J := G.deleteVertices W + have hJG : J ≤ G := deleteVertices_le _ _ + have hZ'V : Z' ⊆ G'.vertexSet := hZ'.trans hc.nodule.free.1 + have hzJ : range z ⊆ J.vertexSet := by + rintro _ ⟨i, rfl⟩ + exact ⟨hN.free.1 (mem_range_self i), fun h => hzav i h.1⟩ + have hZ'J : Z' ⊆ J.vertexSet := fun x hx => ⟨hc.le.vertexSet_subset (hZ'V hx), fun h => h.2 hx⟩ + have hZ'f : Z'.Finite := toFinite _ |>.subset hZ' + let eY : ι → Y₀ := fun i => ⟨z i, hZY (mem_range_self i)⟩ + have heY : Function.Injective eY := fun i j he => hN.inj (congrArg Subtype.val he) + have hsep : ∀ A₁ B₁, J.IsSeparation A₁ B₁ → range z ⊆ A₁.vertexSet → Z' ⊆ B₁.vertexSet → + (range z).ncard ≤ separationOrder A₁ B₁ := by + intro A₁ B₁ hs₁ hzA hZB + by_contra hlt + push Not at hlt + rw [hZc] at hlt + have hXf : (A₁ ∩ B₁).vertexSet.Finite := (A₁ ∩ B₁).vertexSet_finite + have hlt' : (A₁ ∩ B₁).vertexSet.ncard < Fintype.card ι := hlt + obtain ⟨c₁, hc₁, hd₁⟩ := exists_avoid (Finset.univ.image eY) (fun c => {x | x ∈ (P c).support}) + (fun i _ j _ hij => hP₃ hij) hXf (by + rw [Finset.card_image_of_injective _ heY, Finset.card_univ] + exact hlt') + obtain ⟨i, -, rfl⟩ := Finset.mem_image.1 hc₁ + have hs₂c : (Finset.univ.filter fun c => y c ∈ Z').card = Fintype.card ι := by + rw [← hZ'c, ← Finset.card_image_of_injective _ hyinj, ← ncard_coe_finset] + congr 1 + ext x + simp only [Finset.coe_image, Finset.coe_filter, Finset.mem_univ, true_and, mem_image, + mem_ofPred_eq] + constructor + · rintro ⟨c, hc', rfl⟩ + exact hc' + · intro hx + obtain ⟨c, rfl⟩ := hZ' hx + exact ⟨c, hx, rfl⟩ + obtain ⟨c₂, hc₂, hd₂⟩ := exists_avoid (Finset.univ.filter fun c => y c ∈ Z') (fun c => {x | x ∈ + (P c).support}) (fun i _ j _ hij => hP₃ hij) hXf (by + rw [hs₂c] + exact hlt') + have hc₂' : y c₂ ∈ Z' := (Finset.mem_filter.1 hc₂).2 + obtain ⟨s, hs, hd₃⟩ := exists_avoid (Finset.range (Fintype.card ι)) 𝒞 (fun i hi j hj hij + => hc.disj i (Finset.mem_range.1 hi) j (Finset.mem_range.1 hj) hij) hXf (by + rw [Finset.card_range] + exact hlt') + have hs' := Finset.mem_range.1 hs + obtain ⟨t₁, ht₁, ht₁C, ht₁ne⟩ := hc.hit s hs' (eY i) + obtain ⟨t₂, ht₂, ht₂C, -⟩ := hc.hit s hs' c₂ + let q := (P (eY i)).takeUntil t₁ ht₁ + have hqs : ∀ x ∈ q.support, x ∈ (P (eY i)).support ∧ x ≠ y (eY i) := fun x hx => + ⟨(P (eY i)).support_takeUntil_subset_support ht₁ hx, fun e => by + subst e + exact notMem_takeUntil (P (eY i)) (hP₁ _) ht₁ ht₁ne hx⟩ + have hU := ((conn_support q).union (hc.conn s hs') ⟨t₁, q.end_mem_support, ht₁C⟩).union + (conn_support (P c₂)) ⟨t₂, Or.inr ht₂C, ht₂⟩ + have hUW : Disjoint ({x | x ∈ q.support} ∪ 𝒞 s ∪ {x | x ∈ (P c₂).support}) W := by + refine disjoint_left.2 ?_ + rintro x ((hx | hx) | hx) ⟨hxG, hxZ⟩ + · obtain ⟨h₁, h₂⟩ := hqs x hx + exact h₂ (hP₂ _ x h₁ hxG) + · exact hc.off s hs' x hx hxG + · exact hxZ (hP₂ c₂ x hx hxG ▸ hc₂') + obtain ⟨x, hx, hxS⟩ := (hU.delete hG hUW).meets_sep hs₁ (a := z i) (b := y c₂) (Or.inl + (Or.inl q.start_mem_support)) (Or.inr (P c₂).end_mem_support) (hzA (mem_range_self i)) + (hZB hc₂') + rcases hx with (hx | hx) | hx + · exact disjoint_left.1 hd₁ (hqs x hx).1 hxS + · exact disjoint_left.1 hd₃ hx hxS + · exact disjoint_left.1 hd₂ hx hxS + obtain ⟨Q, hQ⟩ := (menger J (range z) Z' hzJ hZ'J _).1 hsep + have hdis : Pairwise fun i j => Disjoint (pathV (Q i)) (pathV (Q j)) := hQ + have hstart : ∀ i, (Q i).first ∈ pathV (Q i) := fun i => (Q i).walk.start_mem_support + have hend : ∀ i, (Q i).last ∈ pathV (Q i) := fun i => (Q i).walk.end_mem_support + have hinj₁ : Function.Injective fun i => (Q i).first := fun i j he => by + by_contra hij + exact disjoint_left.1 (hdis hij) (hstart i) ((show (Q i).first = (Q j).first from he) ▸ hstart + j) + have hinj₂ : Function.Injective fun i => (Q i).last := fun i j he => by + by_contra hij + exact disjoint_left.1 (hdis hij) (hend i) ((show (Q i).last = (Q j).last from he) ▸ hend j) + have hb' : ∀ i, ∃ j, (Q j).first = z i := fun i => + exists_index _ (toFinite _) rfl hinj₁ (fun j => (Q j).first_mem) (mem_range_self i) + choose b hb' using hb' + have hbinj : Function.Injective b := fun i j he => hN.inj (by rw [← hb' i, ← hb' j, he]) + let z' : ι → α := fun i => (Q (b i)).last + have hz'inj : Function.Injective z' := hinj₂.comp hbinj + have hrange : range z' = Z' := eq_of_subset_of_ncard_le (range_subset_iff.2 fun i => (Q + (b i)).last_mem) + (by rw [ncard_range hz'inj, hZ'c]) hZ'f + refine ⟨z', hrange, ⟨hc.nodule.tangle, hz'inj, hc.nodule.free.subset hc.nodule.tangle + (hrange ▸ hZ')⟩, hc.le, hzav, hc.conformal, ?_⟩ + let R : ∀ i, G.skeleton.Walk (z i) (z' i) := fun i => ((Q (b i)).walk.copy (hb' i) rfl).mapLe + (skeleton_mono hJG) + have hRs : ∀ i t, t ∈ (R i).support → t ∈ pathV (Q (b i)) := fun i t ht => by + simpa [R, pathV] using ht + refine ⟨R, fun i => ((SimpleGraph.Walk.isPath_copy ..).2 (Q (b i)).isPath).mapLe _, fun i t ht + htG => ?_, fun i j hij => disjoint_left.2 fun t ht ht' => ?_⟩ + · have htJ : t ∈ J.vertexSet := support_mem (Q (b i)).walk (hzJ (Q (b i)).first_mem) (hRs i t ht) + have htZ : t ∈ Z' := by + by_contra hn + exact htJ.2 ⟨htG, hn⟩ + have hrZ : t ∈ range z' := hrange ▸ htZ + obtain ⟨j, rfl⟩ := hrZ + by_cases hij : i = j + · rw [hij] + · exact absurd (hend (b j)) (disjoint_left.1 (hdis fun e => hij (hbinj e)) (hRs i _ ht)) + · exact disjoint_left.1 (hdis fun e => hij (hbinj e)) (hRs i t ht) (hRs j t ht') + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section5a.lean b/LeanPool/GraphMinor/RST94/Section5a.lean new file mode 100644 index 0000000000..4ec0c27b72 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section5a.lean @@ -0,0 +1,334 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section4e + +/-! +# Section 5 of "Quickly excluding a planar graph": walking along the path `Q` + +The step of the proof of (5.3) (pages 340–341). The paper's Case 3 says: if `Q` does not meet `P_g, +P_{g-1}, …, P_1` in order, and does not meet `P_g, …, P_{2g-1}` in order, then it jumps. +The sets `T i` are the paper's "all vertices of $Q_{r_j}$ which lie in $Q_{r_j}$ strictly between +the intersections with $P_{i-1}$ and $P_i$" (shifted to `P_i` and `P_{i+1}`), together with one +vertex of `P_i`. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β ι : Type*} {G : Hypergraph α β} + +/-- Starting at `s`, a walk reaches a vertex with a label after a part `q` with no label. -/ +theorem exists_run {K : SimpleGraph α} {L : Set α} {s e : α} (w : K.Walk s e) (he : e ∈ L) + (hne : s ≠ e) : + ∃ (t y : α) (q : K.Walk s t) (h : K.Adj t y) (w' : K.Walk y e), y ∈ L ∧ (∀ v ∈ q.support, v ≠ s + → v ∉ L) ∧ + w = q.append (SimpleGraph.Walk.cons h w') := by + induction w with + | nil => exact absurd rfl hne + | @cons u v f h₁ p ih => + by_cases hv : v ∈ L + · exact ⟨u, v, SimpleGraph.Walk.nil, h₁, p, hv, fun x hx hx' => absurd + (by simpa using hx) hx', rfl⟩ + · have hvf : v ≠ f := fun e' => hv (e' ▸ he) + obtain ⟨t, y, q, h, w', hy, hq, hw⟩ := ih he hvf + refine ⟨t, y, SimpleGraph.Walk.cons h₁ q, h, w', hy, fun x hx hx' => ?_, ?_⟩ + · rw [SimpleGraph.Walk.support_cons, List.mem_cons] at hx + rcases hx with rfl | hx + · exact absurd rfl hx' + · by_cases hxv : x = v + · exact hxv ▸ hv + · exact hq x hx hxv + · rw [hw, SimpleGraph.Walk.cons_append] + +theorem NoReturn.of_append {K : SimpleGraph α} {X : Set α} {r s t : α} {w₀ : K.Walk r s} {w : + K.Walk s t} (hw : NoReturn X (w₀.append w)) : + NoReturn X w := fun a b w₁ w₂ w₃ he ha hb c hc => + hw a b (w₀.append w₁) w₂ w₃ (by rw [he, SimpleGraph.Walk.append_assoc]) ha hb c hc + +/-- One hop along `Q`: from the path with label `a` to the next path it meets. -/ +theorem exists_hop {K : SimpleGraph α} {V : ι → Set α} (_hV : Pairwise fun i j => Disjoint (V i) + (V j)) {a : ι} {x e : α} (w : K.Walk x e) (hx : x ∈ V a) (he : e ∉ V a) + (hl : ∃ l, e ∈ V l) (hn : ∀ l, NoReturn (V l) w) : + ∃ (x' t y : α) (b : ι) (q : K.Walk x' t) (h : K.Adj t y) (w' : K.Walk y e) + (w₀ : K.Walk x x'), x' ∈ V a ∧ y ∈ V b ∧ b ≠ a ∧ + (∀ v ∈ q.support, v ≠ x' → ∀ l, v ∉ V l) ∧ w = w₀.append (q.append + (SimpleGraph.Walk.cons h w')) ∧ (∀ v ∈ w'.support, v ∉ V a) := by + classical + induction w with + | nil => exact absurd hx he + | @cons u v f h₁ p ih => + by_cases hv : v ∈ V a + · obtain ⟨x', t, y, b, q, h, w', w₀, h₁', h₂, h₃, h₄, h₅, h₆⟩ := ih hv he hl (fun l => + (hn l).of_cons) + exact ⟨x', t, y, b, q, h, w', SimpleGraph.Walk.cons h₁ w₀, h₁', h₂, h₃, h₄, by rw [h₅, + SimpleGraph.Walk.cons_append], h₆⟩ + · obtain ⟨l₀, hl₀⟩ := hl + have hne : u ≠ f := fun e' => he (e' ▸ hx) + obtain ⟨t, y, q, h, w', hy, hq, hw⟩ := exists_run (L := ⋃ l, V l) + (SimpleGraph.Walk.cons h₁ p) (mem_iUnion.2 ⟨l₀, hl₀⟩) hne + obtain ⟨b, hb⟩ := mem_iUnion.1 hy + have hsplit : ∀ {z : α} (r : K.Walk y z) (r' : K.Walk z f), w' = r.append r' → z ∈ V a + → False := by + intro z r r' hr hz + have hmem := hn a u z SimpleGraph.Walk.nil (q.append (SimpleGraph.Walk.cons h r)) r' (by + rw [SimpleGraph.Walk.nil_append, hw, hr, ← SimpleGraph.Walk.append_assoc, + SimpleGraph.Walk.cons_append]) hx hz + -- The next vertex after `u` is on the segment, and it is not in `V a`. + have hvmem : v ∈ (q.append (SimpleGraph.Walk.cons h r)).support := by + have hs : u ≠ v := h₁.ne + cases q with + | nil => + obtain ⟨rfl, -⟩ : y = v ∧ True := by + simp only [SimpleGraph.Walk.nil_append, SimpleGraph.Walk.cons.injEq] at hw + exact ⟨hw.1.symm, trivial⟩ + simp + | cons h' q' => + simp only [SimpleGraph.Walk.cons_append, SimpleGraph.Walk.cons.injEq] at hw + obtain ⟨rfl, -⟩ := hw + simp + exact hv (hmem v hvmem) + have hba : b ≠ a := by + rintro rfl + exact hsplit SimpleGraph.Walk.nil w' (by simp) hb + refine ⟨u, t, y, b, q, h, w', SimpleGraph.Walk.nil, hx, hb, hba, fun x hx₁ hx₂ l hl' + => hq x hx₁ hx₂ (mem_iUnion.2 ⟨l, hl'⟩), by simpa using hw, fun z hz hza => ?_⟩ + exact hsplit (w'.takeUntil z hz) (w'.dropUntil z hz) (by rw [w'.take_spec hz]) hza + +/-- The sets `T i` for `m ≤ i` and `i + 1 < g`. Each joins the path with label `f i` to the path +with label `f (i + 1)` along `Y`, and has no other vertex on the paths. -/ +structure Segs (Gr : Hypergraph α β) (V : ι → Set α) (f : ℕ → ι) (g m : ℕ) (Y : Set α) (T : ℕ + → Set α) (x y : ℕ → α) : Prop where + conn : ∀ i, m ≤ i → i + 1 < g → Conn Gr (T i) + x_T : ∀ i, m ≤ i → i + 1 < g → x i ∈ T i + x_V : ∀ i, m ≤ i → i + 1 < g → x i ∈ V (f i) + sub : ∀ i, m ≤ i → i + 1 < g → T i ⊆ Y + label : ∀ i, m ≤ i → i + 1 < g → ∀ t ∈ T i, t ≠ x i → ∀ l, t ∉ V l + disj : ∀ i j, m ≤ i → i + 1 < g → m ≤ j → j + 1 < g → i ≠ j → Disjoint (T i) (T j) + y_V : ∀ i, m ≤ i → i + 1 < g → y i ∈ V (f (i + 1)) + y_Y : ∀ i, m ≤ i → i + 1 < g → y i ∈ Y + touch : ∀ i, m ≤ i → i + 1 < g → ∃ t ∈ T i, Gr.skeleton.Adj t (y i) + +/-- There is a piece of `Y` from the path with label `a` to the path with label `b`, with no other +vertex on the paths. This is the paper's minimal subpath in Case 3 of (5.3). -/ +def JumpData (Gr : Hypergraph α β) (V : ι → Set α) (Y : Set α) (a b : ι) : Prop := + ∃ (x t y : α) (q : Gr.skeleton.Walk x t), Gr.skeleton.Adj t y ∧ x ∈ V a ∧ y ∈ V b ∧ + (∀ v ∈ q.support, v ≠ x → ∀ l, v ∉ V l) ∧ (∀ v ∈ q.support, v ∈ Y) ∧ y ∈ Y + +theorem JumpData.mono {Gr : Hypergraph α β} {V : ι → Set α} {Y Y' : Set α} {a b : ι} + (h : JumpData Gr V Y a b) (hY : Y ⊆ Y') : JumpData Gr V Y' a b := by + obtain ⟨x, t, y, q, h₁, h₂, h₃, h₄, h₅, h₆⟩ := h + exact ⟨x, t, y, q, h₁, h₂, h₃, h₄, fun v hv => hY (h₅ v hv), hY h₆⟩ + +/-- Adding one more set `T m` in front. -/ +theorem Segs.cons {Gr : Hypergraph α β} {V : ι → Set α} {f : ℕ → ι} {g m : ℕ} {Y Y' : Set α} {T : ℕ + → Set α} {x y : ℕ → α} (hS : Segs Gr V f g (m + 1) Y' T x y) + {x₀ t y₀ : α} (q : Gr.skeleton.Walk x₀ t) (h : Gr.skeleton.Adj t y₀) (hx : x₀ ∈ V (f m)) + (hy : y₀ ∈ V (f (m + 1))) (hl : ∀ v ∈ q.support, v ≠ x₀ → ∀ l, v ∉ V l) + (hq : ∀ v ∈ q.support, v ∈ Y) (hyY : y₀ ∈ Y) (hY : Y' ⊆ Y) (hd : ∀ v ∈ q.support, v ∉ Y') : + Segs Gr V f g m Y (Function.update T m {v | v ∈ q.support}) (Function.update x m x₀) + (Function.update y m y₀) := by + have hne : ∀ {i}, m ≤ i → i ≠ m → m + 1 ≤ i := fun h₁ h₂ => by omega + refine ⟨fun i h₁ h₂ => ?_, fun i h₁ h₂ => ?_, fun i h₁ h₂ => ?_, fun i h₁ h₂ => ?_, fun i h₁ h₂ + => ?_, fun i j h₁ h₂ h₃ h₄ h₅ => ?_, fun i h₁ h₂ => ?_, fun i h₁ h₂ => ?_, fun i h₁ h₂ => ?_⟩ + all_goals by_cases him : i = m + · subst him + rw [Function.update_self] + exact conn_support q + · rw [Function.update_of_ne him] + exact hS.conn i (hne h₁ him) h₂ + · subst him + rw [Function.update_self, Function.update_self] + exact q.start_mem_support + · rw [Function.update_of_ne him, Function.update_of_ne him] + exact hS.x_T i (hne h₁ him) h₂ + · subst him + rw [Function.update_self] + exact hx + · rw [Function.update_of_ne him] + exact hS.x_V i (hne h₁ him) h₂ + · subst him + rw [Function.update_self] + exact hq + · rw [Function.update_of_ne him] + exact (hS.sub i (hne h₁ him) h₂).trans hY + · subst him + rw [Function.update_self, Function.update_self] + exact hl + · rw [Function.update_of_ne him, Function.update_of_ne him] + exact hS.label i (hne h₁ him) h₂ + · subst him + rw [Function.update_self, Function.update_of_ne h₅.symm] + exact disjoint_left.2 fun v hv hv' => hd v hv (hS.sub j (hne h₃ h₅.symm) h₄ hv') + · rw [Function.update_of_ne him] + by_cases hjm : j = m + · subst hjm + rw [Function.update_self] + exact disjoint_right.2 fun v hv hv' => hd v hv (hS.sub i (hne h₁ him) h₂ hv') + · rw [Function.update_of_ne hjm] + exact hS.disj i j (hne h₁ him) h₂ (hne h₃ hjm) h₄ h₅ + · subst him + rw [Function.update_self] + exact hy + · rw [Function.update_of_ne him] + exact hS.y_V i (hne h₁ him) h₂ + · subst him + rw [Function.update_self] + exact hyY + · rw [Function.update_of_ne him] + exact hY (hS.y_Y i (hne h₁ him) h₂) + · subst him + rw [Function.update_self, Function.update_self] + exact ⟨t, q.end_mem_support, h⟩ + · rw [Function.update_of_ne him, Function.update_of_ne him] + exact hS.touch i (hne h₁ him) h₂ + +/-- Facts about the pieces of a hop. -/ +theorem hop_facts {K : SimpleGraph α} {x x' t y e : α} {w : K.Walk x e} {w₀ : K.Walk x + x'} {q : K.Walk x' t} {h : K.Adj t y} {w' : K.Walk y e} + (hw : w = w₀.append (q.append (SimpleGraph.Walk.cons h w'))) (hp : w.IsPath) : + w'.IsPath ∧ (∀ v ∈ q.support, v ∈ w.support) ∧ (∀ v ∈ w'.support, v ∈ w.support) ∧ + (∀ v ∈ q.support, v ∉ w'.support) := by + have h₁ : (q.append (SimpleGraph.Walk.cons h w')).IsPath := by + rw [hw] at hp + exact hp.of_append_right + have h₂ := h₁.support_nodup + rw [SimpleGraph.Walk.support_append, List.nodup_append] at h₂ + have htail : (SimpleGraph.Walk.cons h w').support.tail = w'.support := by simp + rw [htail] at h₂ + refine ⟨?_, fun v hv => ?_, fun v hv => ?_, fun v hv hv' => h₂.2.2 v hv v hv' rfl⟩ + · exact (h₁.of_append_right).of_cons + · rw [hw] + simp [SimpleGraph.Walk.mem_support_append_iff, hv] + · rw [hw] + simp [SimpleGraph.Walk.mem_support_append_iff, hv] + +/-- Walking along the labels `f m, f (m + 1), …`: either `w` meets them in order, or it jumps. -/ +theorem chain_or_jump {Gr : Hypergraph α β} {V : ι → Set α} (hV : Pairwise fun i j => Disjoint + (V i) (V j)) {f : ℕ → ι} {g : ℕ} {e : α} + (he : ∀ n, n + 1 < g → e ∉ V (f n)) (hl : ∃ l, e ∈ V l) (d : ℕ) : ∀ (m : ℕ), m + 1 + d = g → ∀ + (x : α) (w : Gr.skeleton.Walk x e), w.IsPath → (∀ l, NoReturn (V l) w) → + x ∈ V (f m) → (∀ n < m, ∀ t ∈ w.support, t ∉ V (f n)) → + (∃ T x' y', Segs Gr V f g m {t | t ∈ w.support} T x' y') ∨ + ∃ n b, m ≤ n ∧ n + 1 < g ∧ b ≠ f (n + 1) ∧ (∀ n' ≤ n, b ≠ f n') + ∧ JumpData Gr V {t | t ∈ w.support} (f n) b := by + induction d with + | zero => + intro m hm x w _ _ _ _ + refine Or.inl ⟨fun _ => ∅, fun _ => x, fun _ => x, ?_⟩ + constructor <;> intros <;> omega + | succ d ih => + intro m hm x w hp hn hx hprev + have he₁ := he m (by omega) + obtain ⟨x', t, y, b, q, h, w', w₀, hx', hy, hba, hq, hw, hw'⟩ := exists_hop hV w hx he₁ hl hn + obtain ⟨hp', hsq, hsw, hdis⟩ := hop_facts hw hp + have hyw : y ∈ w'.support := w'.start_mem_support + have hn' : ∀ l, NoReturn (V l) w' := fun l => by + have := hn l + rw [hw] at this + exact (NoReturn.of_cons (this.of_append.of_append)) + by_cases hb : b = f (m + 1) + · have hprev' : ∀ n < m + 1, ∀ t ∈ w'.support, t ∉ V (f n) := fun n hlt t ht => by + rcases Nat.lt_succ_iff_lt_or_eq.1 hlt with h₁ | rfl + · exact hprev n h₁ t (hsw t ht) + · exact hw' t ht + rcases ih (m + 1) (by omega) y w' hp' hn' (hb ▸ hy) hprev' with ⟨T, x₁, y₁, hS⟩ | ⟨n, b', h₁, + h₂, h₃, h₄, h₅⟩ + · exact Or.inl ⟨_, _, _, hS.cons q h hx' (hb ▸ hy) hq hsq (hsw y hyw) (fun v hv + => hsw v hv) hdis⟩ + · exact Or.inr ⟨n, b', by omega, h₂, h₃, h₄, h₅.mono fun v hv => hsw v hv⟩ + · refine Or.inr ⟨m, b, le_rfl, by omega, hb, fun n' hn' e' => ?_, x', t, y, q, h, hx', hy, hq, + hsq, hsw y hyw⟩ + rcases Nat.lt_or_ge n' m with h₁ | h₁ + · exact hprev n' h₁ y (hsw y hyw) (e' ▸ hy) + · obtain rfl : n' = m := by omega + exact hba e' + +/-- The three cases of the proof of (5.3) (pages 340–341). -/ +theorem walk_trichotomy {Gr : Hypergraph α β} {V : ι → Set α} (hV : Pairwise fun i j => Disjoint + (V i) (V j)) {g : ℕ} (hg : 2 ≤ g) {c : ℕ → ι} + (hc : ∀ a b, a < 2 * g - 1 → b < 2 * g - 1 → c a = c b → a = b) {x e : α} + (Q : Gr.skeleton.Walk x e) (hQ : Q.IsPath) (hn : ∀ l, NoReturn (V l) Q) + (hx : x ∈ V (c (g - 1))) (he : e ∈ V (c 0)) : + (∃ T x' y', Segs Gr V (fun i => c (g - 1 - i)) g 0 {t | t ∈ Q.support} T x' y') ∨ + (∃ T x' y', Segs Gr V (fun i => c (g - 1 + i)) g 0 {t | t ∈ Q.support} T x' y') ∨ + ∃ p b, 1 ≤ p ∧ p + 2 ≤ 2 * g - 1 ∧ b ≠ c (p - 1) ∧ b ≠ c p ∧ b ≠ c (p + 1) + ∧ JumpData Gr V {t | t ∈ Q.support} (c p) b := by + have hdis : ∀ {a b : ℕ}, a < 2 * g - 1 → b < 2 * g - 1 → a ≠ b → ∀ t, t ∈ V (c a) → t ∉ V (c b) + := fun ha hb hne t h₁ h₂ => + disjoint_left.1 (hV fun e' => hne (hc _ _ ha hb e')) h₁ h₂ + have he₁ : e ∉ V (c (g - 1)) := fun h => hdis (a := 0) (b := g - 1) (by omega) (by omega) + (by omega) e he h + obtain ⟨x', t, y, b, q, h, w', w₀, hx', hy, hba, hq, hw, hw'⟩ := exists_hop hV Q hx he₁ ⟨_, he⟩ hn + obtain ⟨hp', hsq, hsw, hdisj⟩ := hop_facts hw hQ + have hyw : y ∈ w'.support := w'.start_mem_support + have hn' : ∀ l, NoReturn (V l) w' := fun l => by + have := hn l + rw [hw] at this + exact (NoReturn.of_cons (this.of_append.of_append)) + by_cases hb₁ : b = c (g - 2) + · have hch := chain_or_jump (Gr := Gr) hV (f := fun i => c (g - 1 - i)) (g := g) (e := e) + (fun n hn₁ h' => hdis (a := 0) (b := g - 1 - n) (by omega) (by omega) + (by omega) e he h') ⟨_, he⟩ (g - 2) 1 (by omega) y w' hp' hn' + (by + have : g - 1 - 1 = g - 2 := by omega + simp only [this] + exact hb₁ ▸ hy) + (fun n hlt t ht => by + obtain rfl : n = 0 := by omega + exact hw' t ht) + rcases hch with ⟨T, x₁, y₁, hS⟩ | ⟨n, b', h₁, h₂, h₃, h₄, h₅⟩ + · exact Or.inl ⟨_, _, _, hS.cons q h hx' (by + have : g - 1 - (0 + 1) = g - 2 := by omega + simp only [this] + exact hb₁ ▸ hy) hq hsq (hsw y hyw) (fun v hv => hsw v hv) hdisj⟩ + · refine Or.inr (Or.inr ⟨g - 1 - n, b', by omega, by omega, ?_, h₄ n le_rfl, ?_, h₅.mono fun v + hv => hsw v hv⟩) + · have : g - 1 - n - 1 = g - 1 - (n + 1) := by omega + rw [this] + exact h₃ + · have : g - 1 - n + 1 = g - 1 - (n - 1) := by omega + rw [this] + exact h₄ _ (by omega) + by_cases hb₂ : b = c g + · have hch := chain_or_jump (Gr := Gr) hV (f := fun i => c (g - 1 + i)) (g := g) (e := e) + (fun n hn₁ h' => hdis (a := 0) (b := g - 1 + n) (by omega) (by omega) + (by omega) e he h') ⟨_, he⟩ (g - 2) 1 (by omega) y w' hp' hn' + (by + have : g - 1 + 1 = g := by omega + simp only [this] + exact hb₂ ▸ hy) + (fun n hlt t ht => by + obtain rfl : n = 0 := by omega + exact hw' t ht) + rcases hch with ⟨T, x₁, y₁, hS⟩ | ⟨n, b', h₁, h₂, h₃, h₄, h₅⟩ + · exact Or.inr (Or.inl ⟨_, _, _, hS.cons q h hx' (by + have : g - 1 + (0 + 1) = g := by omega + simp only [this] + exact hb₂ ▸ hy) hq hsq (hsw y hyw) (fun v hv => hsw v hv) hdisj⟩) + · refine Or.inr (Or.inr ⟨g - 1 + n, b', by omega, by omega, ?_, h₄ n le_rfl, ?_, h₅.mono fun v + hv => hsw v hv⟩) + · have : g - 1 + n - 1 = g - 1 + (n - 1) := by omega + rw [this] + exact h₄ _ (by omega) + · exact h₃ + · refine Or.inr (Or.inr ⟨g - 1, b, by omega, by omega, ?_, hba, ?_, x', t, y, q, h, hx', hy, hq, + hsq, hsw y hyw⟩) + · have : g - 1 - 1 = g - 2 := by omega + rw [this] + exact hb₁ + · have : g - 1 + 1 = g := by omega + rw [this] + exact hb₂ + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section5b.lean b/LeanPool/GraphMinor/RST94/Section5b.lean new file mode 100644 index 0000000000..6b147dcc35 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section5b.lean @@ -0,0 +1,533 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section5a +import Mathlib.Tactic.Positivity + +/-! +# Section 5 of "Quickly excluding a planar graph": grids + +A family of sets as in the hypothesis of (5.1) (page 339) is what we use for "a grid minor dominated +by the tangle": (5.1) turns the family into a grid minor, and in the proofs of (5.2) to (5.6) the +hypothesis that `𝒯` dominates no grid minor is used only through (5.1). So here `HasGrid G T θ g` +says that such a family exists, (5.2) becomes `HasGrid.of_conformal`, and the grid minor itself is +made in the last file. + +The proof of (5.3) picks `g` values of `r` at the end, once all `2g - 1` steps are known. We do the +same count by carrying the columns found so far (`Cols`) for each of the two directions. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β ι : Type*} {G : Hypergraph α β} + +/-- The sets `W i j` of (5.1) (page 339), with indices from `0`. -/ +structure IsGrid (G : Hypergraph α β) (T : Set (Hypergraph α β × Hypergraph α β)) (θ g : ℕ) (W : ℕ + → ℕ → Set α) : Prop where + sub : ∀ i < g, ∀ j < g, W i j ⊆ G.vertexSet + conn : ∀ i < g, ∀ j < g, Conn G (W i j) + disj : ∀ i < g, ∀ j < g, ∀ i' < g, ∀ j' < g, (i, j) ≠ (i', j') → Disjoint (W i j) (W i' j') + row : ∀ i < g, ∀ j, j + 1 < g → ∃ x ∈ W i j, ∃ y ∈ W i (j + 1), G.skeleton.Adj x y + col : ∀ i, i + 1 < g → ∀ j < g, ∃ x ∈ W i j, ∃ y ∈ W (i + 1) j, G.skeleton.Adj x y + rank : ∀ j < g, g ≤ tangleRank T θ (⋃ i ∈ {i | i < g}, W i j) + +/-- `𝒯` has a family of sets as in (5.1). -/ +def HasGrid (G : Hypergraph α β) (T : Set (Hypergraph α β × Hypergraph α β)) (θ g : ℕ) : Prop := + ∃ W, IsGrid G T θ g W + +/-- **(5.2)** (page 339), in the form we use: a family for a conformal tangle of a subgraph is a +family for `𝒯`. The rank goes up by (2.7). -/ +theorem HasGrid.of_conformal {H : Hypergraph α β} {T' : Set (Hypergraph α β × Hypergraph α β)} {θ + θ' g : ℕ} {T : Set (Hypergraph α β × Hypergraph α β)} (hH : H ≤ G) (hT : IsTangle G θ T) + (hT' : IsTangle H θ' T') (hc : Conformal G H T T' θ θ') (h : HasGrid H T' θ' g) : HasGrid G T θ + g := by + obtain ⟨W, hW⟩ := h + have hadj : ∀ {x y}, H.skeleton.Adj x y → G.skeleton.Adj x y := fun h => skeleton_mono hH h + refine ⟨W, ⟨fun i hi j hj => (hW.sub i hi j hj).trans hH.vertexSet_subset, fun i hi j hj => + (hW.conn i hi j hj).mono hH, hW.disj, fun i hi j hj => ?_, fun i hi j hj => ?_, fun j hj => ?_⟩⟩ + · obtain ⟨x, hx, y, hy, hxy⟩ := hW.row i hi j hj + exact ⟨x, hx, y, hy, hadj hxy⟩ + · obtain ⟨x, hx, y, hy, hxy⟩ := hW.col i hi j hj + exact ⟨x, hx, y, hy, hadj hxy⟩ + · exact (hW.rank j hj).trans (rank_le_of_conformal hH hT hT' hc (iUnion₂_subset fun i hi + => hW.sub i hi j hj)) + +/-- A path without its last vertex. -/ +theorem exists_butlast {K : SimpleGraph α} {a b : α} (p : K.Walk a b) (hp : p.IsPath) + (hab : a ≠ b) : + ∃ (c : α) (q : K.Walk a c), K.Adj c b ∧ ∀ x, x ∈ q.support ↔ x ∈ p.support ∧ x ≠ b := by + induction p with + | nil => exact absurd rfl hab + | @cons u v w h p ih => + have hp₂ := hp.of_cons + by_cases hvw : v = w + · subst hvw + have hnil : p = SimpleGraph.Walk.nil := (SimpleGraph.Walk.isPath_iff_nil.1 hp₂).eq_nil + subst hnil + refine ⟨u, SimpleGraph.Walk.nil, h, fun x => ?_⟩ + simp only [SimpleGraph.Walk.support_nil, SimpleGraph.Walk.support_cons, List.mem_cons, + List.not_mem_nil, or_false] + exact ⟨fun e => ⟨Or.inl e, e ▸ hab⟩, fun ⟨h₁, h₂⟩ => h₁.resolve_right h₂⟩ + · obtain ⟨c, q, hq, hx⟩ := ih hp₂ hvw + refine ⟨c, SimpleGraph.Walk.cons h q, hq, fun x => ?_⟩ + simp only [SimpleGraph.Walk.support_cons, List.mem_cons, hx] + constructor + · rintro (rfl | ⟨h₁, h₂⟩) + · exact ⟨Or.inl rfl, hab⟩ + · exact ⟨Or.inr h₁, h₂⟩ + · rintro ⟨h₁ | h₁, h₂⟩ + · exact Or.inl h₁ + · exact Or.inr ⟨h₁, h₂⟩ + +/-- The columns built so far in the proof of (5.3), and the heads `H i` of the next column. The +vertex `w i` is the current end of the `i`th path. -/ +structure Cols (G : Hypergraph α β) (T : Set (Hypergraph α β × Hypergraph α β)) (θ g a : ℕ) + (G' : Hypergraph α β) (w : ℕ → α) (W : ℕ → ℕ → Set α) (H : ℕ → Set α) : Prop where + sub : ∀ i < g, ∀ j < a, W i j ⊆ G.vertexSet + conn : ∀ i < g, ∀ j < a, Conn G (W i j) + disj : ∀ i < g, ∀ j < a, ∀ i' < g, ∀ j' < a, (i, j) ≠ (i', j') → Disjoint (W i j) (W i' j') + off : ∀ i < g, ∀ j < a, ∀ x ∈ W i j, x ∉ G'.vertexSet + row : ∀ i < g, ∀ j, j + 1 < a → ∃ x ∈ W i j, ∃ y ∈ W i (j + 1), G.skeleton.Adj x y + col : ∀ i, i + 1 < g → ∀ j < a, ∃ x ∈ W i j, ∃ y ∈ W (i + 1) j, G.skeleton.Adj x y + rank : ∀ j < a, g ≤ tangleRank T θ (⋃ i ∈ {i | i < g}, W i j) + hsub : ∀ i < g, H i ⊆ G.vertexSet + hconn : ∀ i < g, Conn G (H i) + hdisj : ∀ i < g, ∀ i' < g, i ≠ i' → Disjoint (H i) (H i') + hW : ∀ i < g, ∀ i' < g, ∀ j < a, Disjoint (H i) (W i' j) + hmem : ∀ i < g, w i ∈ H i + hoff : ∀ i < g, ∀ x ∈ H i, x ∈ G'.vertexSet → x = w i + hrank : g ≤ tangleRank T θ (⋃ i ∈ {i | i < g}, H i) + hadj : ∀ i < g, ∀ j, j + 1 = a → ∃ x ∈ W i j, ∃ y ∈ H i, G.skeleton.Adj x y + +/-- `g` columns make a grid. -/ +theorem Cols.hasGrid {T : Set (Hypergraph α β × Hypergraph α β)} {θ g a : ℕ} {G' : Hypergraph α β} + {w : ℕ → α} {W : ℕ → ℕ → Set α} {H : ℕ → Set α} + (h : Cols G T θ g a G' w W H) (ha : g ≤ a) : HasGrid G T θ g := + ⟨W, ⟨fun i hi j hj => h.sub i hi j (by omega), fun i hi j hj => h.conn i hi j + (by omega), fun i hi j hj i' hi' j' hj' => h.disj i hi j (by omega) i' hi' j' (by omega), + fun i hi j hj => h.row i hi j (by omega), fun i hi j hj => h.col i hi j (by omega), fun j hj + => h.rank j (by omega)⟩⟩ + +/-- A step that does not make a new column: the paths grow, and the heads with them. -/ +theorem Cols.extend {T : Set (Hypergraph α β × Hypergraph α β)} {θ g a : ℕ} + (hT : IsTangle G θ T) {G' G₂ : Hypergraph α β} {y y₂ : ι → α} {f : ℕ → ι} {W : ℕ → ℕ + → Set α} {H : ℕ → Set α} + (h : Cols G T θ g a G' (fun i => y (f i)) W H) (hle : G' ≤ G) (hle₂ : G₂ ≤ G') + (hy : range y ⊆ G'.vertexSet) (hf : ∀ i < g, ∀ i' < g, i ≠ i' → f i ≠ f i') {p : ∀ c, + G'.skeleton.Walk (y c) (y₂ c)} (hp : IsLinkage G' G₂ y y₂ p) + (hav : ∀ c, y c ∉ G₂.vertexSet) : + Cols G T θ g a G₂ (fun i => y₂ (f i)) W (fun i => H i ∪ {x | x ∈ (p (f i)).support}) := by + obtain ⟨hp₁, hp₂, hp₃⟩ := hp + have hG₂ : ∀ {x}, x ∈ G₂.vertexSet → x ∈ G'.vertexSet := fun hx => hle₂.vertexSet_subset hx + have hpG : ∀ c t, t ∈ (p c).support → t ∈ G'.vertexSet := fun c t ht => support_mem (p c) (hy + (mem_range_self c)) ht + refine ⟨h.sub, h.conn, h.disj, fun i hi j hj x hx hxG => h.off i hi j hj x hx + (hG₂ hxG), h.row, h.col, h.rank, fun i hi => ?_, fun i hi => ?_, fun i hi i' hi' hne + => ?_, fun i hi i' hi' j hj => ?_, + fun i hi => Or.inr (p (f i)).end_mem_support, fun i hi x hx hxG => ?_, ?_, fun i hi j hj => ?_⟩ + · exact union_subset (h.hsub i hi) fun t ht => hle.vertexSet_subset (hpG _ t ht) + · exact (h.hconn i hi).union ((conn_support (p (f i))).mono hle) ⟨y (f i), h.hmem i hi, (p + (f i)).start_mem_support⟩ + · have hc : ∀ i i', i < g → i' < g → i ≠ i' → Disjoint (H i) {x | x ∈ (p (f i')).support} + := fun i i' hi hi' hne => disjoint_left.2 fun x hx hx' => by + have := h.hoff i hi x hx (hpG _ x hx') + subst this + exact disjoint_left.1 (hp₃ (hf i hi i' hi' hne)) (p (f i)).start_mem_support hx' + refine disjoint_union_left.2 ⟨disjoint_union_right.2 ⟨h.hdisj i hi i' hi' hne, hc i i' hi hi' + hne⟩, disjoint_union_right.2 ⟨(hc i' i hi' hi hne.symm).symm, hp₃ (hf i hi i' hi' hne)⟩⟩ + · exact disjoint_union_left.2 ⟨h.hW i hi i' hi' j hj, disjoint_left.2 fun x hx hx' + => h.off i' hi' j hj x hx' (hpG _ x hx)⟩ + · rcases hx with hx | hx + · exact absurd ((h.hoff i hi x hx (hG₂ hxG)) ▸ hxG) (hav _) + · exact hp₂ _ x hx hxG + · exact h.hrank.trans (tangleRank_mono hT (iUnion₂_mono fun i _ => subset_union_left)) + · obtain ⟨x, hx, t, ht, hxt⟩ := h.hadj i hi j hj + exact ⟨x, hx, t, Or.inl ht, hxt⟩ + +/-- A step that makes a new column, from the sets `T' i` of `Segs`. -/ +theorem Cols.column {T : Set (Hypergraph α β × Hypergraph α β)} {θ g a : ℕ} + (hT : IsTangle G θ T) {G' G₂ : Hypergraph α β} {y y₂ : ι → α} {f : ℕ → ι} {W : ℕ → ℕ + → Set α} {H : ℕ → Set α} + (h : Cols G T θ g a G' (fun i => y (f i)) W H) (hle : G' ≤ G) (hle₂ : G₂ ≤ G') + (hy : range y ⊆ G'.vertexSet) (hy₂ : range y₂ ⊆ G₂.vertexSet) (hf : ∀ i < g, ∀ i' < g, i ≠ i' + → f i ≠ f i') {p : ∀ c, G'.skeleton.Walk (y c) (y₂ c)} (hp : IsLinkage G' G₂ y y₂ p) + (hav : ∀ c, y c ∉ G₂.vertexSet) {Y : Set α} {T' : ℕ → Set α} {x' y' : ℕ → α} (hS : Segs G' + (fun c => {t | t ∈ (p c).support}) f g 0 Y T' x' y') (hYG : Y ⊆ G'.vertexSet) + (hY : ∀ t ∈ Y, t ∉ G₂.vertexSet) + (hrank : g ≤ tangleRank T θ (⋃ i ∈ {i | i < g}, {y₂ (f i)})) : + ∃ W₂ H₂, Cols G T θ g (a + 1) G₂ (fun i => y₂ (f i)) W₂ H₂ := by + classical + obtain ⟨hp₁, hp₂, hp₃⟩ := hp + have hG₂ : ∀ {x}, x ∈ G₂.vertexSet → x ∈ G'.vertexSet := fun hx => hle₂.vertexSet_subset hx + have hpG : ∀ c t, t ∈ (p c).support → t ∈ G'.vertexSet := fun c t ht => support_mem (p c) (hy + (mem_range_self c)) ht + have hne : ∀ c, y c ≠ y₂ c := fun c e => hav c (e ▸ hy₂ (mem_range_self c)) + have hlast : ∀ c, ∃ (d : α) (q : G'.skeleton.Walk (y c) d), G'.skeleton.Adj d (y₂ c) + ∧ ∀ x, x ∈ q.support ↔ x ∈ (p c).support ∧ x ≠ y₂ c := fun c => + exists_butlast (p c) (hp₁ c) (hne c) + choose d q hd hq using hlast + let B : ℕ → Set α := fun i => {x | x ∈ (q (f i)).support} + let N : ℕ → Set α := fun i => H i ∪ B i ∪ {t | i + 1 < g ∧ t ∈ T' i} + have hBoff : ∀ i, ∀ x ∈ B i, x ∉ G₂.vertexSet := fun i x hx hxG => ((hq _ x).1 hx).2 (hp₂ _ x + ((hq _ x).1 hx).1 hxG) + have hNoff : ∀ i < g, ∀ x ∈ N i, x ∉ G₂.vertexSet := by + rintro i hi x ((hx | hx) | ⟨h₁, hx⟩) hxG + · exact hav _ ((h.hoff i hi x hx (hG₂ hxG)) ▸ hxG) + · exact hBoff i x hx hxG + · exact hY x (hS.sub i (Nat.zero_le _) h₁ hx) hxG + have hNconn : ∀ i < g, Conn G (N i) := fun i hi => by + have h₁ : Conn G (H i ∪ B i) := (h.hconn i hi).union ((conn_support (q (f i))).mono hle) ⟨y + (f i), h.hmem i hi, (q (f i)).start_mem_support⟩ + by_cases hi' : i + 1 < g + · have heq : N i = H i ∪ B i ∪ T' i := by + ext t + simp [N, hi'] + rw [heq] + refine h₁.union ((hS.conn i (Nat.zero_le _) hi').mono hle) ⟨x' i, Or.inr + ((hq _ _).2 ⟨hS.x_V i (Nat.zero_le _) hi', fun e => ?_⟩), hS.x_T i (Nat.zero_le _) hi'⟩ + exact hY _ (hS.sub i (Nat.zero_le _) hi' (hS.x_T i (Nat.zero_le _) hi')) (e ▸ hy₂ + (mem_range_self _)) + · have heq : N i = H i ∪ B i := by + ext t + simp [N, hi'] + rw [heq] + exact h₁ + -- A vertex of `N i` in `G'` is on the `i`th path, or it is on no path. + have hlab : ∀ i < g, ∀ x ∈ N i, x ∈ G'.vertexSet → x ∈ (p (f i)).support ∨ (x ∈ T' i ∧ i + 1 < g + ∧ ∀ l, x ∉ (p l).support) := by + rintro i hi x ((hx | hx) | ⟨h₁, hx⟩) hxG + · exact Or.inl (h.hoff i hi x hx hxG ▸ (p (f i)).start_mem_support) + · exact Or.inl ((hq _ x).1 hx).1 + · by_cases he : x = x' i + · exact Or.inl (he ▸ hS.x_V i (Nat.zero_le _) h₁) + · exact Or.inr ⟨hx, h₁, hS.label i (Nat.zero_le _) h₁ x hx he⟩ + have hNH : ∀ i < g, ∀ x ∈ N i, x ∉ G'.vertexSet → x ∈ H i := by + rintro i hi x ((hx | hx) | ⟨h₁, hx⟩) hxG + · exact hx + · exact absurd (hpG _ x ((hq _ x).1 hx).1) hxG + · exact absurd (hYG (hS.sub i (Nat.zero_le _) h₁ hx)) hxG + have hNN : ∀ i < g, ∀ i' < g, i ≠ i' → Disjoint (N i) (N i') := fun i hi i' hi' hii + => disjoint_left.2 fun x hx hx' => by + by_cases hxG : x ∈ G'.vertexSet + · rcases hlab i hi x hx hxG with h₁ | ⟨h₁, h₂, h₃⟩ <;> rcases hlab i' hi' x hx' hxG with h₄ | + ⟨h₄, h₅, h₆⟩ + · exact disjoint_left.1 (hp₃ (hf i hi i' hi' hii)) h₁ h₄ + · exact h₆ _ h₁ + · exact h₃ _ h₄ + · exact disjoint_left.1 (hS.disj i i' (Nat.zero_le _) h₂ (Nat.zero_le _) h₅ hii) h₁ h₄ + · exact disjoint_left.1 (h.hdisj i hi i' hi' hii) (hNH i hi x hx hxG) (hNH i' hi' x hx' hxG) + have hNW : ∀ i < g, ∀ i' < g, ∀ j < a, Disjoint (N i) (W i' j) := fun i hi i' hi' j hj + => disjoint_left.2 fun x hx hx' => by + by_cases hxG : x ∈ G'.vertexSet + · exact h.off i' hi' j hj x hx' hxG + · exact disjoint_left.1 (h.hW i hi i' hi' j hj) (hNH i hi x hx hxG) hx' + have hNsub : ∀ i < g, N i ⊆ G.vertexSet := fun i hi x hx => by + by_cases hxG : x ∈ G'.vertexSet + · exact hle.vertexSet_subset hxG + · exact h.hsub i hi (hNH i hi x hx hxG) + let W₂ : ℕ → ℕ → Set α := fun i j => if j = a then N i else W i j + have hW₂a : ∀ i, W₂ i a = N i := fun i => by simp [W₂] + have hW₂o : ∀ i j, j < a → W₂ i j = W i j := fun i j hj => by simp [W₂, hj.ne] + have hcases : ∀ j, j < a + 1 → j < a ∨ j = a := fun j hj => by omega + have hoff₂ : ∀ i < g, ∀ j < a + 1, ∀ x ∈ W₂ i j, x ∉ G₂.vertexSet := fun i hi j hj x hx hxG => by + rcases hcases j hj with h₁ | rfl + · rw [hW₂o _ _ h₁] at hx + exact h.off i hi j h₁ x hx (hG₂ hxG) + · rw [hW₂a] at hx + exact hNoff i hi x hx hxG + refine ⟨W₂, fun i => {y₂ (f i)}, ⟨fun i hi j hj => ?_, fun i hi j hj + => ?_, fun i hi j hj i' hi' j' hj' hij => ?_, fun i hi j hj x hx hxG => ?_, fun i hi j hj + => ?_, fun i hi j hj => ?_, fun j hj => ?_, + fun i hi => ?_, fun i hi => conn_singleton, fun i hi i' hi' hii => ?_, fun i hi i' hi' j hj + => ?_, fun i hi => rfl, fun i hi x hx _ => hx, hrank, fun i hi j hj => ?_⟩⟩ + · rcases hcases j hj with h₁ | rfl + · rw [hW₂o _ _ h₁] + exact h.sub i hi j h₁ + · rw [hW₂a] + exact hNsub i hi + · rcases hcases j hj with h₁ | rfl + · rw [hW₂o _ _ h₁] + exact h.conn i hi j h₁ + · rw [hW₂a] + exact hNconn i hi + · rcases hcases j hj with h₁ | rfl <;> rcases hcases j' hj' with h₂ | rfl + · rw [hW₂o _ _ h₁, hW₂o _ _ h₂] + exact h.disj i hi j h₁ i' hi' j' h₂ hij + · rw [hW₂o _ _ h₁, hW₂a] + exact (hNW i' hi' i hi j h₁).symm + · rw [hW₂a, hW₂o _ _ h₂] + exact hNW i hi i' hi' j' h₂ + · rw [hW₂a, hW₂a] + exact hNN i hi i' hi' fun e => hij (by rw [e]) + · exact hoff₂ i hi j hj x hx hxG + · rcases hcases (j + 1) hj with h₁ | h₁ + · rw [hW₂o _ _ h₁, hW₂o _ _ (by omega)] + exact h.row i hi j h₁ + · obtain ⟨x, hx, t, ht, hxt⟩ := h.hadj i hi j h₁ + subst h₁ + rw [hW₂a, hW₂o _ _ (by omega)] + exact ⟨x, hx, t, Or.inl (Or.inl ht), hxt⟩ + · rcases hcases j hj with h₁ | rfl + · rw [hW₂o _ _ h₁, hW₂o _ _ h₁] + exact h.col i hi j h₁ + · rw [hW₂a, hW₂a] + obtain ⟨t, ht, hadj⟩ := hS.touch i (Nat.zero_le _) hi + refine ⟨t, Or.inr ⟨hi, ht⟩, y' i, Or.inl (Or.inr ?_), skeleton_mono hle hadj⟩ + refine (hq _ _).2 ⟨hS.y_V i (Nat.zero_le _) hi, fun e => ?_⟩ + exact hY _ (hS.y_Y i (Nat.zero_le _) hi) (e ▸ hy₂ (mem_range_self _)) + · rcases hcases j hj with h₁ | rfl + · simp only [hW₂o _ _ h₁] + exact h.rank j h₁ + · simp only [hW₂a] + exact h.hrank.trans (tangleRank_mono hT (iUnion₂_mono fun i _ x hx => Or.inl (Or.inl hx))) + · rintro x rfl + exact hle.vertexSet_subset (hle₂.vertexSet_subset (hy₂ (mem_range_self _))) + · rw [disjoint_singleton_left, mem_singleton_iff] + intro e + have hmem : y₂ (f i) ∈ (p (f i')).support := by + rw [e] + exact (p (f i')).end_mem_support + exact disjoint_left.1 (hp₃ (hf i hi i' hi' hii)) (p (f i)).end_mem_support hmem + · rw [disjoint_singleton_left] + exact fun hx => hoff₂ i' hi' j hj _ hx (hy₂ (mem_range_self _)) + · obtain rfl : j = a := by omega + rw [hW₂a] + exact ⟨d (f i), Or.inl (Or.inr (q (f i)).end_mem_support), _, rfl, skeleton_mono hle (hd (f i))⟩ + +/-- The state after `r` steps of the proof of (5.3): `z'` is `z^r`, and `P` is the union of `P^1, …, +P^r`. -/ +structure Stage (G : Hypergraph α β) (T : Set (Hypergraph α β × Hypergraph α β)) (θ : ℕ) (z : ι + → α) (r : ℕ) (G' : Hypergraph α β) + (T' : Set (Hypergraph α β × Hypergraph α β)) (θ' : ℕ) (z' : ι → α) (P : ∀ c, G.skeleton.Walk + (z c) (z' c)) : Prop where + nodule : Nodule G' T' θ' z' + le : G' ≤ G + conformal : Conformal G G' T T' θ θ' + link : IsLinkage G G' z z' P + avoid : r ≠ 0 → ∀ c, z c ∉ G'.vertexSet + fix : r = 0 → ∀ c, z' c = z c + +/-- The start: `G` itself, with one-vertex paths. -/ +theorem stage_zero {T : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} {z : ι → α} + (hN : Nodule G T θ z) : + Stage G T θ z 0 G T θ z (fun _ => SimpleGraph.Walk.nil) := + ⟨hN, le_rfl, conformal_of_subset hN.tangle le_rfl subset_rfl, ⟨fun _ + => SimpleGraph.Walk.IsPath.nil, fun c t ht _ => by simpa using ht, + fun i j hij => by simpa using fun e => hij (hN.inj e)⟩, fun h => absurd rfl h, fun _ _ => rfl⟩ + +/-- Adding one residual nodule to a stage. -/ +theorem Stage.step {T T' T₂ : Set (Hypergraph α β × Hypergraph α β)} {θ θ' θ₂ r : ℕ} + (hT : IsTangle G θ T) {z z' z₂ : ι → α} {G' G₂ : Hypergraph α β} {P : ∀ c, G.skeleton.Walk (z c) + (z' c)} + {p : ∀ c, G'.skeleton.Walk (z' c) (z₂ c)} (hc : Stage G T θ z r G' T' θ' z' P) + (hR : Residual G' T' θ' z' G₂ T₂ θ₂ z₂) (hl : IsLinkage G' G₂ z' z₂ p) : + Stage G T θ z (r + 1) G₂ T₂ θ₂ z₂ (fun c => (P c).append ((p c).mapLe (skeleton_mono hc.le))) + := by + obtain ⟨hp₁, hp₂, hp₃⟩ := hl + obtain ⟨hP₁, hP₂, hP₃⟩ := hc.link + have hmem : ∀ c t, t ∈ ((P c).append ((p c).mapLe (skeleton_mono hc.le))).support ↔ t ∈ + (P c).support ∨ t ∈ (p c).support := fun c t => by + simp [SimpleGraph.Walk.mem_support_append_iff] + have hpG : ∀ c t, t ∈ (p c).support → t ∈ G'.vertexSet := fun c t ht => + support_mem (p c) (hc.nodule.free.1 (mem_range_self c)) ht + have hG₂ : ∀ {x}, x ∈ G₂.vertexSet → x ∈ G'.vertexSet := fun hx => hR.le.vertexSet_subset hx + refine ⟨hR.nodule, hR.le.trans hc.le, Conformal.trans hc.le hR.le hT hc.nodule.tangle + hR.nodule.tangle hc.conformal hR.conformal, ⟨fun c => ?_, fun c t ht htG => ?_, + fun i j hij => disjoint_left.2 fun t ht ht' => ?_⟩, fun _ c hcG => ?_, fun h => absurd h + (Nat.succ_ne_zero r)⟩ + · exact isPath_append (hP₁ c) ((hp₁ c).mapLe _) fun x hx hx' => hP₂ c x hx (hpG c x + (by simpa using hx')) + · rcases (hmem c t).1 ht with h | h + · have := hP₂ c t h (hG₂ htG) + exact absurd (this ▸ htG) (hR.avoid c) + · exact hp₂ c t h htG + · have hx : ∀ i j, i ≠ j → t ∈ (P i).support → t ∉ (p j).support := fun i j hij hi hj => by + have := hP₂ i t hi (hpG j t hj) + subst this + exact disjoint_left.1 (hp₃ hij) (p i).start_mem_support hj + rcases (hmem i t).1 ht with h₁ | h₁ <;> rcases (hmem j t).1 ht' with h₂ | h₂ + · exact disjoint_left.1 (hP₃ hij) h₁ h₂ + · exact hx i j hij h₁ h₂ + · exact hx j i hij.symm h₂ h₁ + · exact disjoint_left.1 (hp₃ hij) h₁ h₂ + · by_cases hr : r = 0 + · subst hr + exact hR.avoid c (hc.fix rfl c ▸ hcG) + · exact hc.avoid hr c (hG₂ hcG) + +/-- A stage after at least one step is a residual nodule. -/ +theorem Stage.residual {T T' : Set (Hypergraph α β × Hypergraph α β)} {θ θ' r : ℕ} {z z' : ι + → α} {G' : Hypergraph α β} {P : ∀ c, G.skeleton.Walk (z c) (z' c)} + (hc : Stage G T θ z r G' T' θ' z' P) (hr : r ≠ 0) : Residual G T θ z G' T' θ' z' := + ⟨hc.nodule, hc.le, hc.avoid hr, hc.conformal, P, hc.link⟩ + +/-- `g` vertices of a nodule keep rank `g` in `𝒯`, by (2.7). This is the display on page 340. -/ +theorem nodule_rank {T T' : Set (Hypergraph α β × Hypergraph α β)} {θ θ' g : ℕ} + (hT : IsTangle G θ T) {z' : ι → α} {G' : Hypergraph α β} {f : ℕ → ι} (hN : Nodule G' T' θ' z') + (hle : G' ≤ G) + (hc : Conformal G G' T T' θ θ') (hf : ∀ i < g, ∀ i' < g, i ≠ i' → f i ≠ f i') : g + ≤ tangleRank T θ (⋃ i ∈ {i | i < g}, {z' (f i)}) := by + have heq : (⋃ i ∈ {i | i < g}, ({z' (f i)} : Set α)) = (fun i => z' (f i)) '' {i | i < g} := by + ext x + simp [eq_comm] + have hsub : (⋃ i ∈ {i | i < g}, ({z' (f i)} : Set α)) ⊆ range z' := by + rw [heq] + rintro _ ⟨i, -, rfl⟩ + exact mem_range_self _ + have hfree := hN.free.subset hN.tangle hsub + have hcard : (⋃ i ∈ {i | i < g}, ({z' (f i)} : Set α)).ncard = g := by + rw [heq, InjOn.ncard_image] + · have : {i | i < g} = ((Finset.range g : Finset ℕ) : Set ℕ) := by + ext i + simp + rw [this, ncard_coe_finset, Finset.card_range] + · intro i hi i' hi' he + by_contra hne + exact hf i hi i' hi' hne (hN.inj he) + have h₂ := ((isFreeSet_iff_tangleRank_eq hN.tangle).1 hfree).2 + rw [hcard] at h₂ + exact h₂.symm.le.trans (rank_le_of_conformal hle hT hN.tangle hc hfree.1) + +/-- The columns at the start. -/ +theorem cols_zero {T : Set (Hypergraph α β × Hypergraph α β)} {θ g : ℕ} + (hT : IsTangle G θ T) {z : ι → α} {f : ℕ → ι} (hN : Nodule G T θ z) + (hf : ∀ i < g, ∀ i' < g, i ≠ i' → f i ≠ f i') : + ∃ W H, Cols G T θ g 0 G (fun i => z (f i)) W H := by + refine ⟨fun _ _ => ∅, fun i => {z (f i)}, ⟨fun i _ j hj => absurd hj + (Nat.not_lt_zero j), fun i _ j hj => absurd hj (Nat.not_lt_zero j), fun i _ j hj => absurd hj + (Nat.not_lt_zero j), + fun i _ j hj => absurd hj (Nat.not_lt_zero j), fun i _ j hj => absurd hj + (Nat.not_lt_zero _), fun i _ j hj => absurd hj (Nat.not_lt_zero j), fun j hj => absurd hj + (Nat.not_lt_zero j), + fun i _ => ?_, fun i _ => conn_singleton, fun i hi i' hi' hne => ?_, fun i _ i' _ j hj + => absurd hj (Nat.not_lt_zero j), fun _ _ => rfl, fun _ _ _ hx _ => hx, ?_, fun i _ j hj + => absurd hj (Nat.succ_ne_zero j)⟩⟩ + · rintro x rfl + exact hN.free.1 (mem_range_self _) + · rw [disjoint_singleton] + exact fun e => hf i hi i' hi' hne (hN.inj e) + · exact nodule_rank hT hN le_rfl (conformal_of_subset hN.tangle le_rfl subset_rfl) hf + +/-- The conclusion of (5.3): a residual nodule with a linkage, and a piece `q` of `Q` that joins +`P_{c p}` to `P_b`. -/ +def JumpEnd (G : Hypergraph α β) (T : Set (Hypergraph α β × Hypergraph α β)) (θ : ℕ) (z : ι → α) + (k g : ℕ) (c : ℕ → ι) : Prop := + ∃ (G' : Hypergraph α β) (T' : Set (Hypergraph α β × Hypergraph α β)) (θ' : ℕ) (z' : ι → α) + (P : ∀ c, G.skeleton.Walk (z c) (z' c)) (p : ℕ) (b : ι) (Y : Set α), + Residual G T θ z G' T' θ' z' ∧ k ≤ θ' ∧ IsLinkage G G' z z' P ∧ 1 ≤ p ∧ p + 2 ≤ 2 * g - 1 + ∧ b ≠ c (p - 1) ∧ b ≠ c p ∧ b ≠ c (p + 1) ∧ + JumpData G (fun l => {t | t ∈ (P l).support}) Y (c p) b ∧ ∀ t ∈ Y, t ∉ G'.vertexSet + +/-- The induction in the proof of (5.3): after `r` steps we have stopped with a jump, or we have `a` +columns of the first kind and `b` of the second, with `a + b = r`. -/ +theorem exists_stage [Fintype ι] (hG : G.IsGraph) {T : Set (Hypergraph α β × Hypergraph α β)} {θ : + ℕ} {z : ι → α} (hN : Nodule G T θ z) {g k : ℕ} (hg : 2 ≤ g) {c : ℕ → ι} + (hc : ∀ a b, a < 2 * g - 1 → b < 2 * g - 1 → c a = c b → a = b) (hn : Fintype.card ι ≤ 2 * k) + (hθ : k * 20 ^ (2 * g) ≤ θ) (r : ℕ) (hr : r ≤ 2 * g - 1) : + JumpEnd G T θ z k g c ∨ ∃ (G' : Hypergraph α β) (T' : Set (Hypergraph α β × Hypergraph α β)) + (θ' : ℕ) (z' : ι → α) (P : ∀ c, G.skeleton.Walk (z c) (z' c)) (W₁ W₂ : ℕ → ℕ → Set α) + (H₁ H₂ : ℕ → Set α) (a b : ℕ), + Stage G T θ z r G' T' θ' z' P ∧ k * 20 ^ (2 * g - r) ≤ θ' ∧ Cols G T θ g a G' (fun i => z' (c + (g - 1 - i))) W₁ H₁ ∧ Cols G T θ g b G' (fun i => z' (c (g - 1 + i))) W₂ H₂ ∧ a + b = r + := by + have hf₁ : ∀ i < g, ∀ i' < g, i ≠ i' → c (g - 1 - i) ≠ c (g - 1 - i') := fun i hi i' hi' hne e + => by + have := hc _ _ (by omega) (by omega) e + omega + have hf₂ : ∀ i < g, ∀ i' < g, i ≠ i' → c (g - 1 + i) ≠ c (g - 1 + i') := fun i hi i' hi' hne e + => by + have := hc _ _ (by omega) (by omega) e + omega + have hT := hN.tangle + induction r with + | zero => + obtain ⟨W₁, H₁, h₁⟩ := cols_zero hT hN hf₁ + obtain ⟨W₂, H₂, h₂⟩ := cols_zero hT hN hf₂ + exact Or.inr ⟨G, T, θ, z, _, W₁, W₂, H₁, H₂, 0, 0, stage_zero hN, hθ, h₁, h₂, rfl⟩ + | succ r ih => + rcases ih (by omega) with hj | ⟨G', T', θ', z', P, W₁, W₂, H₁, H₂, a, b, hS, hb, hC₁, hC₂, hab⟩ + · exact Or.inl hj + have hne : c (g - 1) ≠ c 0 := fun e => by + have := hc _ _ (by omega) (by omega) e + omega + have h2n : 2 ≤ Fintype.card ι := by + have : Nontrivial ι := ⟨_, _, hne⟩ + exact Fintype.one_lt_card + obtain ⟨e, he⟩ : ∃ e, 2 * g - (r + 1) = e + 1 := ⟨2 * g - (r + 1) - 1, by omega⟩ + have hsplit : 2 * g - r = e + 1 + 1 := by omega + set K := k * 20 ^ (2 * g - (r + 1)) with hK + have hK₂ : 20 * k ≤ K := by + rw [hK, he, pow_succ, Nat.mul_comm (20 ^ e), ← Nat.mul_assoc, Nat.mul_comm k] + exact Nat.le_mul_of_pos_right _ (by positivity) + have hK₃ : K * 20 ≤ θ' := by + have : k * 20 ^ (2 * g - r) = K * 20 := by + rw [hK, he, hsplit, pow_succ _ (e + 1), Nat.mul_assoc] + rwa [this] at hb + have hG' : G'.IsGraph := IsGraph.of_le hG hS.le + obtain ⟨G₂, T₂, z₂, p, Q, hR, hl, hQp, hQo, hQn⟩ := theorem_4_2 hG' hS.nodule (k := K) + (by omega) (by omega) hne + have hS₂ := hS.step hT hR hl + have hy : range z' ⊆ G'.vertexSet := hS.nodule.free.1 + have hy₂ : range z₂ ⊆ G₂.vertexSet := hR.nodule.free.1 + have hYG : {t | t ∈ Q.support} ⊆ G'.vertexSet := fun t ht => support_mem Q (hy + (mem_range_self _)) ht + have hr₁ : ∀ {f : ℕ → ι}, (∀ i < g, ∀ i' < g, i ≠ i' → f i ≠ f i') → g ≤ tangleRank T θ + (⋃ i ∈ {i | i < g}, {z₂ (f i)}) := fun hf => + nodule_rank hT hR.nodule hS₂.le hS₂.conformal hf + rcases walk_trichotomy (Gr := G') (V := fun l => {t | t ∈ (p l).support}) hl.2.2 hg hc Q hQp + hQn (p _).start_mem_support (p _).start_mem_support with ⟨T₁, x₁, y₁, hs⟩ | ⟨T₁, x₁, y₁, hs⟩ + | ⟨q, b', h₁, h₂, h₃, h₄, h₅, h₆⟩ + · obtain ⟨W, H, hC⟩ := hC₁.column hT hS.le hR.le hy hy₂ hf₁ hl hR.avoid hs hYG hQo (hr₁ hf₁) + exact Or.inr ⟨G₂, T₂, K, z₂, _, W, W₂, H, _, a + 1, b, hS₂, le_rfl, hC, + hC₂.extend hT hS.le hR.le hy hf₂ hl hR.avoid, by omega⟩ + · obtain ⟨W, H, hC⟩ := hC₂.column hT hS.le hR.le hy hy₂ hf₂ hl hR.avoid hs hYG hQo (hr₁ hf₂) + exact Or.inr ⟨G₂, T₂, K, z₂, _, W₁, W, _, H, a, b + 1, hS₂, le_rfl, + hC₁.extend hT hS.le hR.le hy hf₁ hl hR.avoid, hC, by omega⟩ + · refine Or.inl ⟨G₂, T₂, K, z₂, _, q, b', {t | t ∈ Q.support}, hS₂.residual + (Nat.succ_ne_zero r), by omega, + hS₂.link, h₁, h₂, h₃, h₄, h₅, ?_, hQo⟩ + obtain ⟨x, t, y, q', h₁', h₂', h₃', h₄', h₅', h₆'⟩ := h₆ + refine ⟨x, t, y, q'.mapLe (skeleton_mono hS.le), skeleton_mono hS.le h₁', ?_, ?_, + fun v hv hvx l hl' => ?_, fun v hv => h₅' v (by simpa using hv), h₆'⟩ + · simp only [SimpleGraph.Walk.mem_support_append_iff, SimpleGraph.Walk.support_map, + SimpleGraph.Hom.coe_ofLE, List.map_id_fun, id_eq, mem_ofPred_eq] + exact Or.inr h₂' + · simp only [SimpleGraph.Walk.mem_support_append_iff, SimpleGraph.Walk.support_map, + SimpleGraph.Hom.coe_ofLE, List.map_id_fun, id_eq, mem_ofPred_eq] + exact Or.inr h₃' + · have hv' : v ∈ q'.support := by simpa using hv + have hlab := h₄' v hv' hvx + have hl₂ : v ∈ (P l).support ∨ v ∈ (p l).support := by + simpa [SimpleGraph.Walk.mem_support_append_iff] using hl' + rcases hl₂ with h₇ | h₇ + · have hxG : x ∈ G'.vertexSet := support_mem (p _) (hy (mem_range_self _)) h₂' + have := hS.link.2.1 l v h₇ (support_mem q' hxG hv') + exact hlab l (this ▸ (p l).start_mem_support) + · exact hlab l h₇ + +/-- **(5.3)** (page 340). The numbers `i, j` of the paper are `c p` and `b`, and `{z_1, …, +z_{2g-1}}` are the values `c 0, c 1, …`. In place of the hypothesis on grid minors we have that no +family as in (5.1) exists. -/ +theorem theorem_5_3 [Fintype ι] (hG : G.IsGraph) {T : Set (Hypergraph α β × Hypergraph α β)} {θ : + ℕ} {z : ι → α} (hN : Nodule G T θ z) {g k : ℕ} (hg : 2 ≤ g) {c : ℕ → ι} + (hc : ∀ a b, a < 2 * g - 1 → b < 2 * g - 1 → c a = c b → a = b) (hn : Fintype.card ι ≤ 2 * k) + (hθ : k * 20 ^ (2 * g) ≤ θ) (hno : ¬ HasGrid G T θ g) : JumpEnd G T θ z k g c := by + rcases exists_stage hG hN hg hc hn hθ (2 * g - 1) le_rfl with hj | ⟨G', T', θ', z', P, W₁, W₂, + H₁, H₂, a, b, -, -, hC₁, hC₂, hab⟩ + · exact hj + · rcases Nat.lt_or_ge a g with h | h + · exact absurd (hC₂.hasGrid (by omega)) hno + · exact absurd (hC₁.hasGrid h) hno + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section5c.lean b/LeanPool/GraphMinor/RST94/Section5c.lean new file mode 100644 index 0000000000..f7b6b839e0 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section5c.lean @@ -0,0 +1,393 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section5b +public import LeanPool.GraphMinor.RST94.Trees +import Mathlib.Tactic.Positivity + +/-! +# Section 5 of "Quickly excluding a planar graph": shadows and (5.4) + +A shadow (page 341) is defined by connected sets `C_i`, each with one vertex `z_i` of `Z` and one +vertex `z'_i` of `Z'`, such that `C_i \ Z'` and `C_j \ Z'` touch when `z_i` and `z_j` are adjacent. +We ask a little more: that `C_i \ Z'` itself is connected. We write `D i` for `C_i \ Z'`, and `C_i` +is `D i` with `z'_i` attached. + +The reason is the last step of (5.5). There a leaf `C_ℓ` must touch the rest at a vertex that can be +joined to `z_ℓ` without using `z'_ℓ`, and the definition on page 341 does not give this: `C_ℓ \ Z'` +may touch the rest only in a part of `C_ℓ` that hangs from `z'_ℓ`. The stronger property holds for +the sets built in (1), and it survives the step of (2), so the proof of (5.4) on pages 341-342 goes +through unchanged. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β ι : Type*} {G : Hypergraph α β} + +/-- A shadow of a residual nodule (page 341), with `D i` for `C_i \ Z'`. -/ +structure Shadow (G G' : Hypergraph α β) (z z' : ι → α) (S : SimpleGraph ι) (D : ι + → Set α) : Prop where + conn : ∀ i, Conn G (D i) + mem : ∀ i, z i ∈ D i + attach : ∀ i, ∃ x ∈ D i, G.skeleton.Adj x (z' i) + off : ∀ i, ∀ x ∈ D i, x ∉ G'.vertexSet + disj : Pairwise fun i j => Disjoint (D i) (D j) + touch : ∀ i j, S.Adj i j → ∃ x ∈ D i, ∃ y ∈ D j, G.skeleton.Adj x y + +/-- A connected set is the disjoint union of connected sets around given disjoint connected seeds. +These are the sets `C_i` with maximal union in (1) of (5.4). -/ +theorem exists_partition [Nonempty ι] {J : Set α} (hJf : J.Finite) (hJ : Conn G J) {B : ι → Set α} + (hB : ∀ i, Conn G (B i)) (hBJ : ∀ i, B i ⊆ J) (hd : Pairwise fun i j => Disjoint (B i) (B j)) : + ∃ D : ι → Set α, (∀ i, Conn G (D i)) ∧ (∀ i, B i ⊆ D i) ∧ (∀ i, D i ⊆ J) ∧ (Pairwise fun i j + => Disjoint (D i) (D j)) ∧ ∀ x ∈ J, ∃ i, x ∈ D i := by + classical + let P : (ι → Set α) → Prop := fun D => (∀ i, Conn G (D i)) ∧ (∀ i, B i ⊆ D i) ∧ (∀ i, D i ⊆ J) + ∧ Pairwise fun i j => Disjoint (D i) (D j) + obtain ⟨D, hD, hmax⟩ := exists_max_measure (P := P) (fun D => (⋃ i, D i).ncard) J.ncard (fun D hD + => ncard_le_ncard (iUnion_subset hD.2.2.1) hJf) + ⟨B, hB, fun _ => subset_rfl, hBJ, hd⟩ + refine ⟨D, hD.1, hD.2.1, hD.2.2.1, hD.2.2.2, ?_⟩ + by_contra hcon + push Not at hcon + obtain ⟨x, hxJ, hx⟩ := hcon + obtain ⟨i₀⟩ := ‹Nonempty ι› + obtain ⟨y, hy⟩ := (hD.1 i₀).1 + obtain ⟨w, hw⟩ := hJ.2 y (hD.2.2.1 i₀ hy) x hxJ + have hyx : y ≠ x := fun e => hx i₀ (e ▸ hy) + have hxL : x ∈ {v | v ∈ J ∧ ∀ i, v ∉ D i} := ⟨hxJ, hx⟩ + obtain ⟨t, y', q, h, w', hy', hq, hwe⟩ := exists_run (L := {v | v ∈ J ∧ ∀ i, v ∉ D i}) w hxL hyx + have htq : t ∈ w.support := by + rw [hwe] + simp [SimpleGraph.Walk.mem_support_append_iff] + have ht : ∃ i, t ∈ D i := by + by_cases hts : t = y + · exact ⟨i₀, hts ▸ hy⟩ + · have := hq t q.end_mem_support hts + by_contra hno + push Not at hno + exact this ⟨hw t htq, hno⟩ + obtain ⟨i, hi⟩ := ht + have hc₁ : Conn G (D i ∪ {y'}) := (hD.1 i).union_adj conn_singleton hi rfl h + let D' : ι → Set α := Function.update D i (D i ∪ {y'}) + have hup : ∀ j, j ≠ i → D' j = D j := fun j hj => Function.update_of_ne hj _ _ + have hupi : D' i = D i ∪ {y'} := Function.update_self _ _ _ + have hP : P D' := by + refine ⟨fun j => ?_, fun j => ?_, fun j => ?_, fun j l hjl => ?_⟩ + · by_cases hj : j = i + · rw [hj, hupi] + exact hc₁ + · rw [hup j hj] + exact hD.1 j + · by_cases hj : j = i + · rw [hj, hupi] + exact (hD.2.1 i).trans subset_union_left + · rw [hup j hj] + exact hD.2.1 j + · by_cases hj : j = i + · rw [hj, hupi] + exact union_subset (hD.2.2.1 i) (singleton_subset_iff.2 hy'.1) + · rw [hup j hj] + exact hD.2.2.1 j + · change Disjoint (D' j) (D' l) + have hs : ∀ m, Disjoint ({y'} : Set α) (D m) := fun m => disjoint_singleton_left.2 (hy'.2 m) + by_cases hj : j = i + · subst hj + rw [hupi, hup l hjl.symm] + exact disjoint_union_left.2 ⟨hD.2.2.2 hjl, hs l⟩ + · by_cases hl : l = i + · subst hl + rw [hupi, hup j hj] + exact (disjoint_union_left.2 ⟨hD.2.2.2 hjl.symm, hs j⟩).symm + · rw [hup j hj, hup l hl] + exact hD.2.2.2 hjl + have hlt := hmax D' hP + have hsub : insert y' (⋃ j, D j) ⊆ ⋃ j, D' j := by + rintro v (rfl | hv) + · exact mem_iUnion.2 ⟨i, by rw [hupi]; exact Or.inr rfl⟩ + · obtain ⟨j, hj⟩ := mem_iUnion.1 hv + by_cases hji : j = i + · exact mem_iUnion.2 ⟨i, by rw [hupi]; exact Or.inl (hji ▸ hj)⟩ + · exact mem_iUnion.2 ⟨j, by rw [hup j hji]; exact hj⟩ + have hfin : (⋃ j, D' j).Finite := hJf.subset (iUnion_subset hP.2.2.1) + have h₃ := ncard_le_ncard hsub hfin + rw [ncard_insert_of_notMem (fun h' => hy'.2 _ (mem_iUnion.1 h').choose_spec) + (hfin.subset fun v hv => hsub (Or.inr hv))] at h₃ + omega + +/-- The graph `S₀` of (1) in (5.4) is connected. -/ +theorem touch_connected [Nonempty ι] {J : Set α} (hJ : Conn G J) {D : ι → Set α} + (hD : ∀ i, D i ⊆ J) (hne : ∀ i, (D i).Nonempty) (hcov : ∀ x ∈ J, ∃ i, x ∈ D i) + (hd : Pairwise fun i j => Disjoint (D i) (D j)) : + (SimpleGraph.fromRel fun i j => ∃ x ∈ D i, ∃ y ∈ D j, G.skeleton.Adj x y).Connected := by + have key : ∀ {x y : α} (w : G.skeleton.Walk x y) (_ : ∀ v ∈ w.support, v ∈ J) (i j : ι), x ∈ D i + → y ∈ D j → + (SimpleGraph.fromRel fun i j => ∃ x ∈ D i, ∃ y ∈ D j, G.skeleton.Adj x y).Reachable i j + := fun {x y} w => by + induction w with + | nil => + intro _ i j hx hy + by_cases hij : i = j + · exact hij ▸ SimpleGraph.Reachable.refl _ + · exact absurd hy (disjoint_left.1 (hd hij) hx) + | @cons x y z h q ih => + intro hw i j hx hz + obtain ⟨k, hk⟩ := hcov y (hw y (by simp)) + have h₁ := ih (fun v hv => hw v (by simp [hv])) k j hk hz + by_cases hik : i = k + · exact hik ▸ h₁ + · refine SimpleGraph.Adj.reachable ?_ |>.trans h₁ + exact (SimpleGraph.fromRel_adj _ _ _).2 ⟨hik, Or.inl ⟨x, hx, y, hk, h⟩⟩ + refine ⟨fun i j => ?_⟩ + obtain ⟨x, hx⟩ := hne i + obtain ⟨y, hy⟩ := hne j + obtain ⟨w, hw⟩ := hJ.2 x (hD i hx) y (hD j hy) + exact key w hw i j hx hy + +/-- Statement (1) in the proof of (5.4) (page 341). -/ +theorem shadow_base [Fintype ι] (hG : G.IsGraph) {T : Set (Hypergraph α β × Hypergraph α β)} {θ : + ℕ} {z : ι → α} (hN : Nodule G T θ z) {k : ℕ} (hn : 2 ≤ Fintype.card ι) (hk : Fintype.card ι + ≤ 2 * k) + (hθ : k * 20 ^ Fintype.card ι ≤ θ) : + ∃ (G' : Hypergraph α β) (T' : Set (Hypergraph α β × Hypergraph α β)) (θ' : ℕ) (z' : ι → α) + (S : SimpleGraph ι) (D : ι → Set α), + Residual G T θ z G' T' θ' z' ∧ k ≤ θ' ∧ S.IsTree ∧ Shadow G G' z z' S D := by + classical + obtain ⟨G', T', θ', z', hR, hb, C, hC, hzC, hCoff⟩ := theorem_4_3 hG hN hn hk hθ + obtain ⟨P, hP₁, hP₂, hP₃⟩ := hR.link + have : Nonempty ι := Fintype.card_pos_iff.1 (by omega) + have hne : ∀ i, z i ≠ z' i := fun i e => hR.avoid i (e ▸ hR.nodule.free.1 (mem_range_self i)) + have hlast := fun i => exists_butlast (P i) (hP₁ i) (hne i) + choose d q hd hq using hlast + let B : ι → Set α := fun i => {x | x ∈ (q i).support} + have hBc : ∀ i, Conn G (B i) := fun i => conn_support (q i) + have hBz : ∀ i, z i ∈ B i := fun i => (q i).start_mem_support + have hBoff : ∀ i, ∀ x ∈ B i, x ∉ G'.vertexSet := fun i x hx hxG => ((hq i x).1 hx).2 (hP₂ i x + ((hq i x).1 hx).1 hxG) + let J : Set α := C ∪ ⋃ i, B i + have hJc : Conn G J := by + have key : ∀ s : Finset ι, Conn G (C ∪ ⋃ i ∈ s, B i) := fun s => by + induction s using Finset.induction_on with + | empty => simpa using hC + | @insert a s _ ih => + have h₁ := ih.union (hBc a) ⟨z a, Or.inl (hzC (mem_range_self a)), hBz a⟩ + have heq : C ∪ ⋃ i ∈ insert a s, B i = (C ∪ ⋃ i ∈ s, B i) ∪ B a := by + ext v + simp only [mem_union, mem_iUnion, Finset.mem_insert] + constructor + · rintro (h | ⟨i, rfl | hi, h⟩) + · exact Or.inl (Or.inl h) + · exact Or.inr h + · exact Or.inl (Or.inr ⟨i, hi, h⟩) + · rintro ((h | ⟨i, hi, h⟩) | h) + · exact Or.inl h + · exact Or.inr ⟨i, Or.inr hi, h⟩ + · exact Or.inr ⟨a, Or.inl rfl, h⟩ + rw [heq] + exact h₁ + have := key Finset.univ + simpa [J] using this + have hJV : J ⊆ G.vertexSet := by + obtain ⟨i⟩ := ‹Nonempty ι› + intro x hx + obtain ⟨w, -⟩ := hJc.2 (z i) (Or.inl (hzC (mem_range_self i))) x hx + exact support_mem w (hN.free.1 (mem_range_self i)) w.end_mem_support + have hdB : Pairwise fun i j => Disjoint (B i) (B j) := fun i j hij => disjoint_left.2 fun x hx + hx' => + disjoint_left.1 (hP₃ hij) ((hq i x).1 hx).1 ((hq j x).1 hx').1 + obtain ⟨D, hD₁, hD₂, hD₃, hD₄, hD₅⟩ := exists_partition (G.vertexSet_finite.subset hJV) hJc hBc + (fun i => subset_iUnion B i |>.trans subset_union_right) hdB + have hDne : ∀ i, (D i).Nonempty := fun i => ⟨z i, hD₂ i (hBz i)⟩ + have hconn := touch_connected hJc hD₃ hDne hD₅ hD₄ + obtain ⟨S, hS, hSt⟩ := hconn.exists_isTree_le + refine ⟨G', T', θ', z', S, D, hR, hb, hSt, hD₁, fun i => hD₂ i (hBz i), fun i => ⟨d i, + hD₂ i (q i).end_mem_support, hd i⟩, fun i x hx => ?_, hD₄, fun i j hij => ?_⟩ + · rcases hD₃ i hx with h | h + · exact hCoff x h + · obtain ⟨l, hl⟩ := mem_iUnion.1 h + exact hBoff l x hl + · have := (SimpleGraph.fromRel_adj _ _ _).1 (hS hij) + rcases this.2 with h | h + · exact h + · obtain ⟨x, hx, y, hy, hxy⟩ := h + exact ⟨y, hy, x, hx, hxy.symm⟩ + +/-- The step of (2) in the proof of (5.4) (page 342): after (5.3), the sets `C_i` take in the paths +`P'_i`, and one of them takes in the jump. -/ +theorem Shadow.step {G' G₂ : Hypergraph α β} {z z' z₂ : ι → α} {S S' : SimpleGraph ι} {D : ι + → Set α} (hs : Shadow G G' z z' S D) (hle : G' ≤ G) (hle₂ : G₂ ≤ G') + (hz' : range z' ⊆ G'.vertexSet) + (hz₂ : range z₂ ⊆ G₂.vertexSet) (hav : ∀ c, z' c ∉ G₂.vertexSet) {P : ∀ c, G'.skeleton.Walk + (z' c) (z₂ c)} (hL : IsLinkage G' G₂ z' z₂ P) {a b : ι} {Y : Set α} + (hJ : JumpData G' (fun l => {t | t ∈ (P l).support}) Y a b) (hY : ∀ t ∈ Y, t ∉ G₂.vertexSet) + (hS' : ∀ x y, S'.Adj x y → S.Adj x y ∨ s(x, y) = s(a, b)) : + ∃ D', Shadow G G₂ z z₂ S' D' := by + classical + obtain ⟨hP₁, hP₂, hP₃⟩ := hL + obtain ⟨x, t, y, q, hty, hxa, hyb, hql, hqY, hyY⟩ := hJ + have hne : ∀ i, z' i ≠ z₂ i := fun i e => hav i (e ▸ hz₂ (mem_range_self i)) + have hlast := fun i => exists_butlast (P i) (hP₁ i) (hne i) + choose d r hd hr using hlast + let B : ι → Set α := fun i => {v | v ∈ (r i).support} + let E : ι → Set α := fun i => {v | i = a ∧ v ∈ q.support} + let D' : ι → Set α := fun i => D i ∪ B i ∪ E i + have hpG : ∀ c v, v ∈ (P c).support → v ∈ G'.vertexSet := fun c v hv => support_mem (P c) (hz' + (mem_range_self c)) hv + have hxG : x ∈ G'.vertexSet := hpG a x hxa + have hqG : ∀ v ∈ q.support, v ∈ G'.vertexSet := fun v hv => support_mem q hxG hv + have hBoff : ∀ i, ∀ v ∈ B i, v ∉ G₂.vertexSet := fun i v hv hvG => ((hr i v).1 hv).2 (hP₂ i v + ((hr i v).1 hv).1 hvG) + have hBG : ∀ i, ∀ v ∈ B i, v ∈ G'.vertexSet := fun i v hv => hpG i v ((hr i v).1 hv).1 + have hxB : x ∈ B a := (hr a x).2 ⟨hxa, fun e => hY x (hqY x q.start_mem_support) (e ▸ hz₂ + (mem_range_self a))⟩ + have hyB : y ∈ B b := (hr b y).2 ⟨hyb, fun e => hY y hyY (e ▸ hz₂ (mem_range_self b))⟩ + have hc₁ : ∀ i, Conn G (D i ∪ B i) := fun i => by + obtain ⟨u, hu, hadj⟩ := hs.attach i + exact (hs.conn i).union_adj ((conn_support (r i)).mono hle) hu (r i).start_mem_support hadj + have hconn : ∀ i, Conn G (D' i) := fun i => by + by_cases hi : i = a + · subst hi + have : D' i = D i ∪ B i ∪ {v | v ∈ q.support} := by + ext v + simp [D', E] + rw [this] + exact (hc₁ i).union ((conn_support q).mono hle) ⟨x, Or.inr hxB, q.start_mem_support⟩ + · have : D' i = D i ∪ B i := by + ext v + simp [D', E, hi] + rw [this] + exact hc₁ i + have hdoff : ∀ i, ∀ v ∈ D i, v ∉ G'.vertexSet := hs.off + refine ⟨D', hconn, fun i => Or.inl (Or.inl (hs.mem i)), fun i => ⟨d i, Or.inl (Or.inr + (r i).end_mem_support), skeleton_mono hle (hd i)⟩, ?_, fun i j hij + => disjoint_left.2 fun v hv hv' => ?_, fun i j hij => ?_⟩ + · rintro i v ((hv | hv) | ⟨-, hv⟩) hvG + · exact hdoff i v hv (hle₂.vertexSet_subset hvG) + · exact hBoff i v hv hvG + · exact hY v (hqY v hv) hvG + · have hlab : ∀ i, v ∈ D' i → v ∈ G'.vertexSet → v ∈ (P i).support ∨ (i = a ∧ v ≠ x ∧ ∀ l, v ∉ + (P l).support) := by + rintro i ((h | h) | ⟨h₁, h⟩) hvG + · exact absurd hvG (hdoff i v h) + · exact Or.inl ((hr i v).1 h).1 + · by_cases he : v = x + · exact Or.inl (he ▸ h₁ ▸ hxa) + · exact Or.inr ⟨h₁, he, hql v h he⟩ + have hDcase : ∀ i, v ∈ D' i → v ∉ G'.vertexSet → v ∈ D i := by + rintro i ((h | h) | ⟨-, h⟩) hvG + · exact h + · exact absurd (hBG i v h) hvG + · exact absurd (hqG v h) hvG + by_cases hvG : v ∈ G'.vertexSet + · rcases hlab i hv hvG with h₁ | ⟨rfl, -, h₂⟩ <;> rcases hlab j hv' hvG with h₃ | ⟨h₃, -, h₄⟩ + · exact disjoint_left.1 (hP₃ hij) h₁ h₃ + · exact h₄ _ h₁ + · exact h₂ _ h₃ + · exact hij h₃.symm + · exact disjoint_left.1 (hs.disj hij) (hDcase i hv hvG) (hDcase j hv' hvG) + · have hT : t ∈ D' a := Or.inr ⟨rfl, q.end_mem_support⟩ + have hYb : y ∈ D' b := Or.inl (Or.inr hyB) + rcases hS' i j hij with h | h + · obtain ⟨u, hu, w, hw, huw⟩ := hs.touch i j h + exact ⟨u, Or.inl (Or.inl hu), w, Or.inl (Or.inl hw), huw⟩ + · rcases Sym2.eq_iff.1 h with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact ⟨t, hT, y, hYb, skeleton_mono hle hty⟩ + · exact ⟨y, hYb, t, hT, (skeleton_mono hle hty).symm⟩ + +/-- Statement (2) in the proof of (5.4) (page 341), by induction on `r`. -/ +theorem exists_shadow [Fintype ι] (hG : G.IsGraph) {T : Set (Hypergraph α β × Hypergraph α β)} {θ : + ℕ} {z : ι → α} (hN : Nodule G T θ z) {g m k : ℕ} (hg : 2 ≤ g) (hm : 3 ≤ m) + (hcard : Fintype.card ι = (2 * g + 1) * (2 * m - 5) + 2) (hk : Fintype.card ι ≤ 2 * k) + (hθ : k * 20 ^ (2 * g * (m - 2) + Fintype.card ι) ≤ θ) (hno : ¬ HasGrid G T θ g) (d : ℕ) + (hd : d + 2 ≤ m) : + ∃ (G' : Hypergraph α β) (T' : Set (Hypergraph α β × Hypergraph α β)) (θ' : ℕ) (z' : ι → α) + (S : SimpleGraph ι) (D : ι → Set α), + Residual G T θ z G' T' θ' z' ∧ k * 20 ^ (2 * g * (m - (d + 2))) ≤ θ' ∧ S.IsTree + ∧ Shadow G G' z z' S D ∧ d + 2 ≤ (leaves S).ncard := by + have h2 : 2 ≤ Fintype.card ι := by + have : 1 ≤ (2 * g + 1) * (2 * m - 5) := Nat.mul_pos (by omega) (by omega) + omega + have : Nontrivial ι := Fintype.one_lt_card_iff_nontrivial.1 h2 + induction d with + | zero => + have hk₂ : Fintype.card ι ≤ 2 * (k * 20 ^ (2 * g * (m - 2))) := hk.trans (Nat.mul_le_mul_left 2 + (Nat.le_mul_of_pos_right k (by positivity))) + obtain ⟨G', T', θ', z', S, D, hR, hb, hS, hs⟩ := shadow_base hG hN h2 hk₂ + (by rw [Nat.mul_assoc, ← pow_add]; exact hθ) + refine ⟨G', T', θ', z', S, D, hR, hb, hS, hs, ?_⟩ + have h₁ := card_not_two_add_two hS + have h₂ : (leaves S).ncard ≤ {v | deg S v ≠ 2}.ncard := ncard_le_ncard (fun v (hv : deg S v + = 1) => by + change deg S v ≠ 2 + exact fun h => (by decide : (1 : ℕ∞) ≠ 2) (hv.symm.trans h)) (toFinite _) + omega + | succ d ih => + obtain ⟨G', T', θ', z', S, D, hR, hb, hS, hs, hL⟩ := ih (by omega) + have hexp : 2 * g * (m - (d + 2)) = 2 * g * (m - (d + 1 + 2)) + 2 * g := by + obtain ⟨u, hu⟩ : ∃ u, m - (d + 2) = u + 1 := ⟨m - (d + 2) - 1, by omega⟩ + rw [hu, show m - (d + 1 + 2) = u by omega, Nat.mul_succ] + by_cases hL₂ : d + 1 + 2 ≤ (leaves S).ncard + · refine ⟨G', T', θ', z', S, D, hR, le_trans (Nat.mul_le_mul_left k ?_) hb, hS, hs, hL₂⟩ + exact Nat.pow_le_pow_right (by omega) (by omega) + have hLe : (leaves S).ncard = d + 2 := by omega + have hrun : (2 * g + 1) * (2 * (leaves S).ncard - 3) + 1 < Fintype.card ι := by + rw [hcard, hLe] + have : (2 * g + 1) * (2 * (d + 2) - 3) ≤ (2 * g + 1) * (2 * m - 5) := Nat.mul_le_mul_left _ + (by omega) + omega + obtain ⟨c, hc₁, hc₂, hc₃⟩ := exists_long_run hS hrun + set K := k * 20 ^ (2 * g * (m - (d + 1 + 2))) with hK + have hk₂ : Fintype.card ι ≤ 2 * K := hk.trans (Nat.mul_le_mul_left 2 (Nat.le_mul_of_pos_right k + (by positivity))) + have hb₂ : K * 20 ^ (2 * g) ≤ θ' := by + rw [hK, Nat.mul_assoc, ← pow_add, ← hexp] + exact hb + have hno' : ¬ HasGrid G' T' θ' g := fun h => hno (h.of_conformal hR.le hN.tangle + hR.nodule.tangle hR.conformal) + obtain ⟨G₂, T₂, θ₂, z₂, P, p, b, Y, hR₂, hk₃, hL₂', hp₁, hp₂, hb₁, hb₂', hb₃, hJ, hYoff⟩ + := theorem_5_3 (IsGraph.of_le hG hR.le) hR.nodule hg (c := fun a => c (a + 1)) + (fun x y hx hy he => by + have := hc₁ _ _ (by omega) (by omega) he + omega) hk₂ hb₂ hno' + simp only at hb₁ hb₂' hb₃ hJ + have hsucc : p - 1 + 1 = p := by omega + rw [hsucc] at hb₁ + have hne : ∀ x y, x ≤ 2 * g → y ≤ 2 * g → x ≠ y → c x ≠ c y := fun x y hx hy h e => h + (hc₁ x y hx hy e) + have hadj₀ := hc₂ (p - 1) (by omega) + rw [hsucc] at hadj₀ + obtain ⟨S', hS', hS₂, hL₃⟩ := exists_more_leaves (t := b) hS hadj₀ (hc₂ p (by omega)) (hc₂ + (p + 1) (by omega)) (hc₂ (p + 2) (by omega)) (hc₃ _ (by omega)) (hc₃ _ (by omega)) (hc₃ _ + (by omega)) (hc₃ _ (by omega)) (hc₃ _ (by omega)) + (hne _ _ (by omega) (by omega) (by omega)) (hne _ _ (by omega) (by omega) (by omega)) + (hne _ _ (by omega) (by omega) (by omega)) hb₁ hb₂' hb₃ + obtain ⟨D', hs'⟩ := hs.step hR.le hR₂.le hR.nodule.free.1 hR₂.nodule.free.1 hR₂.avoid hL₂' hJ + hYoff hS₂ + refine ⟨G₂, T₂, θ₂, z₂, S', D', hR.trans hN.tangle hR₂, hk₃, hS', hs', ?_⟩ + omega + +/-- **(5.4)** (page 341). -/ +theorem theorem_5_4 [Fintype ι] (hG : G.IsGraph) {T : Set (Hypergraph α β × Hypergraph α β)} {θ : + ℕ} {z : ι → α} (hN : Nodule G T θ z) {g m k : ℕ} (hg : 2 ≤ g) (hm : 3 ≤ m) + (hcard : Fintype.card ι = (2 * g + 1) * (2 * m - 5) + 2) (hk : Fintype.card ι ≤ 2 * k) + (hθ : k * 20 ^ (2 * g * (m - 2) + Fintype.card ι) ≤ θ) (hno : ¬ HasGrid G T θ g) : + ∃ (G' : Hypergraph α β) (T' : Set (Hypergraph α β × Hypergraph α β)) (θ' : ℕ) (z' : ι → α) + (S : SimpleGraph ι) (D : ι → Set α), + Residual G T θ z G' T' θ' z' ∧ k ≤ θ' ∧ S.IsTree ∧ Shadow G G' z z' S D ∧ m ≤ + (leaves S).ncard := by + obtain ⟨G', T', θ', z', S, D, hR, hb, hS, hs, hL⟩ := exists_shadow hG hN hg hm hcard hk hθ hno + (m - 2) (by omega) + rw [show m - (m - 2 + 2) = 0 by omega, Nat.mul_zero, pow_zero, Nat.mul_one] at hb + exact ⟨G', T', θ', z', S, D, hR, hb, hS, hs, by omega⟩ + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section5d.lean b/LeanPool/GraphMinor/RST94/Section5d.lean new file mode 100644 index 0000000000..c343a7eeab --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section5d.lean @@ -0,0 +1,340 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section5c +import Mathlib.Tactic.Positivity + +/-! +# Section 5 of "Quickly excluding a planar graph": (5.5) + +The set `C` of (5.5) is made from the shadow of (5.4). It is the union of the sets `C_i \ Z'` that +are not at the chosen leaves, together with a short piece of each chosen leaf. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β ι κ : Type*} {G : Hypergraph α β} + +/-- A connected set with connected sets hanging from it. -/ +theorem conn_union_iUnion [Finite κ] {C : Set α} (hC : Conn G C) {E : κ → Set α} (hE : ∀ i, Conn G + (E i)) (hm : ∀ i, (C ∩ E i).Nonempty) : Conn G (C ∪ ⋃ i, E i) := by + classical + let indexFintype := Fintype.ofFinite κ + have key : ∀ s : Finset κ, Conn G (C ∪ ⋃ i ∈ s, E i) := fun s => by + induction s using Finset.induction_on with + | empty => simpa using hC + | @insert a s _ ih => + obtain ⟨x, hx₁, hx₂⟩ := hm a + have h₁ := ih.union (hE a) ⟨x, Or.inl hx₁, hx₂⟩ + have heq : C ∪ ⋃ i ∈ insert a s, E i = (C ∪ ⋃ i ∈ s, E i) ∪ E a := by + ext v + simp only [mem_union, mem_iUnion, Finset.mem_insert] + constructor + · rintro (h | ⟨i, rfl | hi, h⟩) + · exact Or.inl (Or.inl h) + · exact Or.inr h + · exact Or.inl (Or.inr ⟨i, hi, h⟩) + · rintro ((h | ⟨i, hi, h⟩) | h) + · exact Or.inl h + · exact Or.inr ⟨i, Or.inr hi, h⟩ + · exact Or.inr ⟨a, Or.inl rfl, h⟩ + rw [heq] + exact h₁ + simpa using key Finset.univ + +/-- In a tree with at least three vertices, the sets that are not at the chosen leaves form a +connected set. -/ +theorem conn_nonleaf [Fintype ι] {S : SimpleGraph ι} (hS : S.IsTree) (hcard : 3 + ≤ Fintype.card ι) {L : Set ι} (hL : L ⊆ leaves S) {D : ι → Set α} (hD : ∀ i, Conn G (D i)) + (ht : ∀ i j, S.Adj i j → ∃ x ∈ D i, ∃ y ∈ D j, G.skeleton.Adj x y) (hR : ∃ v, v ∉ L) : + Conn G (⋃ v ∈ Lᶜ, D v) ∧ ∀ l ∈ L, ∃ n, n ∉ L ∧ S.Adj l n := by + classical + have hnb : ∀ l, ∃ n, l ∈ L → S.neighborSet l = {n} := fun l => by + by_cases hl : l ∈ L + · have hdeg : (S.neighborSet l).encard = 1 := hL hl + obtain ⟨n, hn⟩ := encard_eq_one.mp hdeg + exact ⟨n, fun _ => hn⟩ + · exact ⟨l, fun h => absurd h hl⟩ + choose nb hnb using hnb + have hadj : ∀ {l}, l ∈ L → S.Adj l (nb l) := fun {l} hl => by + have : nb l ∈ S.neighborSet l := by + rw [hnb l hl] + rfl + exact this + have hnbL : ∀ l, l ∈ L → nb l ∉ L := fun l hl hn => by + have hN₂ : S.neighborSet (nb l) = {l} := by + rw [hnb _ hn] + have : l ∈ S.neighborSet (nb l) := (hadj hl).symm + rw [hnb _ hn] at this + rw [show nb (nb l) = l from (this : l = nb (nb l)).symm] + have hclosed : ∀ {x y} (w : S.Walk x y), x ∈ ({l, nb l} : Set ι) → y ∈ ({l, nb l} : Set ι) + := fun {x y} w => by + induction w with + | nil => exact id + | @cons x y z h q ih => + rintro (rfl | rfl) + · refine ih ?_ + have hm : y ∈ S.neighborSet x := h + rw [hnb x hl] at hm + exact Or.inr hm + · refine ih ?_ + have hm : y ∈ S.neighborSet (nb l) := h + rw [hN₂] at hm + exact Or.inl hm + have hall : ∀ x, x ∈ ({l, nb l} : Set ι) := fun x => by + obtain ⟨w⟩ := hS.connected l x + exact hclosed w (Or.inl rfl) + have huniv : ({l, nb l} : Set ι) = univ := eq_univ_of_forall hall + have hle : (univ : Set ι).ncard ≤ 2 := by + rw [← huniv] + exact ncard_insert_le _ _ |>.trans (by simp) + rw [ncard_univ, Nat.card_eq_fintype_card] at hle + omega + refine ⟨?_, fun l hl => ⟨nb l, hnbL l hl, hadj hl⟩⟩ + obtain ⟨v₀, hv₀⟩ := hR + let Rr : ι → ι → Prop := Relation.ReflTransGen fun a b => a ∉ L ∧ b ∉ L ∧ S.Adj a b + have hwalk : ∀ {x v} (w : S.Walk x v), v ∉ L → (x ∉ L → Rr x v) ∧ (x ∈ L → Rr (nb x) v) + := fun {x v} w => by + induction w with + | nil => + intro hv + exact ⟨fun _ => Relation.ReflTransGen.refl, fun h => absurd h hv⟩ + | @cons x y z h q ih => + intro hz + obtain ⟨h₁, h₂⟩ := ih hz + by_cases hy : y ∈ L + · have hm : x ∈ S.neighborSet y := h.symm + rw [hnb y hy] at hm + have hxy : x = nb y := hm + refine ⟨fun _ => hxy ▸ h₂ hy, fun hx => ?_⟩ + exact absurd (hxy ▸ hx) (hnbL y hy) + · refine ⟨fun hx => Relation.ReflTransGen.head ⟨hx, hy, h⟩ (h₁ hy), fun hx => ?_⟩ + have hm : y ∈ S.neighborSet x := h + rw [hnb x hx] at hm + have hyx : y = nb x := hm + exact hyx ▸ h₁ hy + obtain ⟨x₀, hx₀⟩ := (hD v₀).1 + have hreach : ∀ u, Rr u v₀ → u ∉ L → ∀ x ∈ D u, ∃ w : G.skeleton.Walk x x₀, ∀ t ∈ w.support, t ∈ + ⋃ v ∈ Lᶜ, D v := by + intro u hu + induction hu using Relation.ReflTransGen.head_induction_on with + | refl => + intro _ x hx + obtain ⟨w, hw⟩ := (hD v₀).2 x hx x₀ hx₀ + exact ⟨w, fun t ht' => mem_iUnion₂.2 ⟨v₀, hv₀, hw t ht'⟩⟩ + | @head a c hac _ ih => + intro ha x hx + obtain ⟨p, hp, q, hq, hpq⟩ := ht a c hac.2.2 + obtain ⟨w, hw⟩ := (hD a).2 x hx p hp + obtain ⟨w', hw'⟩ := ih hac.2.1 q hq + refine ⟨w.append (SimpleGraph.Walk.cons hpq w'), fun t ht' => ?_⟩ + rw [SimpleGraph.Walk.mem_support_append_iff, SimpleGraph.Walk.support_cons, + List.mem_cons] at ht' + rcases ht' with h | h | h + · exact mem_iUnion₂.2 ⟨a, ha, hw t h⟩ + · exact mem_iUnion₂.2 ⟨a, ha, hw t (by rw [h]; exact w.end_mem_support)⟩ + · exact hw' t h + refine conn_of_reach (b := x₀) (mem_iUnion₂.2 ⟨v₀, hv₀, hx₀⟩) fun x hx => ?_ + obtain ⟨u, hu, hxu⟩ := mem_iUnion₂.1 hx + obtain ⟨w⟩ := hS.connected u v₀ + exact hreach u ((hwalk w hv₀).1 hu) hu x hxu + +/-- The last part of the proof of (5.5): the paths inside the chosen leaves of the shadow, and the +set `C`. -/ +theorem shadow_touch [Fintype ι] [Finite κ] {G₂ : Hypergraph α β} {y y' : ι + → α} {S : SimpleGraph ι} {D : ι → Set α} (hs : Shadow G G₂ y y' S D) (hS : S.IsTree) (hcard : 3 + ≤ Fintype.card ι) + (hsub : ∀ i, y i ∈ G.vertexSet) (hy'G : range y' ⊆ G₂.vertexSet) (hy' : Function.Injective y') + {b : κ → ι} (hb : Function.Injective b) (hL : ∀ i, b i ∈ leaves S) + (hR : ∃ v, v ∉ range b) {z₁ : κ → α} (hz₁ : ∀ i, z₁ i ∈ D (b i)) : + ∃ (P : ∀ i, G.skeleton.Walk (z₁ i) (y' (b i))) (C : Set α), IsLinkage G G₂ z₁ (fun i => y' + (b i)) P ∧ Conn G C ∧ C ⊆ G.vertexSet ∧ (∀ x ∈ C, x ∉ G₂.vertexSet) ∧ + ∀ i, (∀ x ∈ (P i).support, x ∉ C) ∧ ∃ x ∈ C, ∃ u ∈ (P i).support, u ≠ y' (b i) + ∧ G.skeleton.Adj x u := by + classical + have hDV : ∀ i, D i ⊆ G.vertexSet := fun i x hx => by + obtain ⟨w, -⟩ := (hs.conn i).2 (y i) (hs.mem i) x hx + exact support_mem w (hsub i) w.end_mem_support + obtain ⟨hC₀, hnb⟩ := conn_nonleaf hS hcard (L := range b) (by rintro _ ⟨i, rfl⟩; exact hL i) + hs.conn hs.touch hR + -- The paths: inside `D (b i)`, then one more edge. + have hpath : ∀ i, ∃ (c : α) (w : G.skeleton.Walk (z₁ i) c), w.IsPath ∧ G.skeleton.Adj c (y' + (b i)) ∧ ∀ t ∈ w.support, t ∈ D (b i) := fun i => by + obtain ⟨c, hc, hadj⟩ := hs.attach (b i) + obtain ⟨w, hw⟩ := (hs.conn (b i)).2 (z₁ i) (hz₁ i) c hc + exact ⟨c, w.bypass, w.bypass_isPath, hadj, fun t ht => hw t + (SimpleGraph.Walk.support_bypass_subset_support w ht)⟩ + choose c w hw₁ hw₂ hw₃ using hpath + have hyoff : ∀ i j, y' i ∉ D j := fun i j h => hs.off j _ h (hy'G (mem_range_self i)) + let P : ∀ i, G.skeleton.Walk (z₁ i) (y' (b i)) := fun i => (w i).concat (hw₂ i) + have hPs : ∀ i t, t ∈ (P i).support ↔ t ∈ (w i).support ∨ t = y' (b i) := fun i t => by + simp [P, SimpleGraph.Walk.support_concat, or_comm] + -- The piece of the leaf. + have hpiece : ∀ i, ∃ E : Set α, Conn G E ∧ (E ∩ ⋃ v ∈ (range b)ᶜ, D v).Nonempty ∧ E ⊆ D + (b i) ∪ ⋃ v ∈ (range b)ᶜ, D v ∧ (∀ t ∈ E, t ∉ (w i).support) ∧ + ∃ u ∈ E, ∃ v ∈ (w i).support, G.skeleton.Adj u v := fun i => by + obtain ⟨n, hn, hadj⟩ := hnb (b i) (mem_range_self i) + obtain ⟨x, hx, x', hx', hxx⟩ := hs.touch _ _ hadj + have hx'C : x' ∈ ⋃ v ∈ (range b)ᶜ, D v := mem_iUnion₂.2 ⟨n, hn, hx'⟩ + have hne : Disjoint (D n) (D (b i)) := hs.disj fun e => hn (e ▸ mem_range_self i) + have hx'w : x' ∉ (w i).support := fun h => disjoint_left.1 hne hx' (hw₃ i x' h) + by_cases hxw : x ∈ (w i).support + · refine ⟨{x'}, conn_singleton, ⟨x', rfl, hx'C⟩, ?_, ?_, x', rfl, x, hxw, hxx.symm⟩ + · intro t ht + exact Or.inr (mem_singleton_iff.1 ht ▸ hx'C) + · intro t ht + exact mem_singleton_iff.1 ht ▸ hx'w + · obtain ⟨r, hr⟩ := (hs.conn (b i)).2 x hx (z₁ i) (hz₁ i) + have hne₂ : x ≠ z₁ i := fun e => hxw (e ▸ (w i).start_mem_support) + obtain ⟨t, u, q, h, r', hu, hq, hrr⟩ := exists_run (L := {t | t ∈ (w i).support}) r + (w i).start_mem_support hne₂ + have hqD : ∀ v ∈ q.support, v ∈ D (b i) := fun v hv => hr v (by rw [hrr]; simp + [SimpleGraph.Walk.mem_support_append_iff, hv]) + refine ⟨{x'} ∪ {v | v ∈ q.support}, conn_singleton.union_adj (conn_support q) rfl + q.start_mem_support hxx.symm, ⟨x', Or.inl rfl, hx'C⟩, ?_, ?_, t, Or.inr q.end_mem_support, + u, hu, h⟩ + · rintro v (hv | hv) + · exact Or.inr (by rw [mem_singleton_iff.1 hv]; exact hx'C) + · exact Or.inl (hqD v hv) + · rintro v (hv | hv) + · rw [mem_singleton_iff.1 hv] + exact hx'w + · by_cases hvx : v = x + · exact hvx ▸ hxw + · exact hq v hv hvx + choose E hE₁ hE₂ hE₃ hE₄ hE₅ using hpiece + let C₀ : Set α := ⋃ v ∈ (range b)ᶜ, D v + let C : Set α := C₀ ∪ ⋃ i, E i + have hCcases : ∀ x ∈ C, x ∈ C₀ ∨ ∃ i, x ∈ D (b i) ∧ x ∈ E i := by + rintro x (hx | hx) + · exact Or.inl hx + · obtain ⟨i, hi⟩ := mem_iUnion.1 hx + rcases hE₃ i hi with h | h + · exact Or.inr ⟨i, h, hi⟩ + · exact Or.inl h + have hCD : ∀ x ∈ C, ∃ v, x ∈ D v := fun x hx => by + rcases hCcases x hx with h | ⟨i, h, -⟩ + · obtain ⟨v, -, hv⟩ := mem_iUnion₂.1 h + exact ⟨v, hv⟩ + · exact ⟨_, h⟩ + have hdisj : ∀ {x i}, x ∈ C → x ∉ (w i).support := fun {x i} hx hxw => by + have hxD := hw₃ i x hxw + rcases hCcases x hx with h | ⟨j, h₁, h₂⟩ + · obtain ⟨v, hv, hxv⟩ := mem_iUnion₂.1 h + exact disjoint_left.1 (hs.disj (i := v) (j := b i) fun e => hv (e ▸ mem_range_self i)) hxv hxD + · by_cases hij : j = i + · subst hij + exact hE₄ j x h₂ hxw + · exact disjoint_left.1 (hs.disj (i := b j) (j := b i) fun e => hij (hb e)) h₁ hxD + have hm : ∀ i : κ, (C₀ ∩ E i).Nonempty := by + intro i + obtain ⟨x, hx⟩ := hE₂ i + exact ⟨x, hx.2, hx.1⟩ + have hconn : Conn G C := conn_union_iUnion hC₀ hE₁ hm + refine ⟨P, C, ⟨fun i => ?_, fun i t ht htG => ?_, fun i j hij => disjoint_left.2 fun t ht ht' + => ?_⟩, hconn, fun x hx => ?_, fun x hx hxG => ?_, fun i => ⟨fun x hx hxC => ?_, ?_⟩⟩ + · exact (hw₁ i).concat (fun h => hyoff _ _ (hw₃ i _ h)) _ + · rcases (hPs i t).1 ht with h | h + · exact absurd htG (hs.off _ t (hw₃ i t h)) + · exact h + · have hbij : b i ≠ b j := fun e => hij (hb e) + rcases (hPs i t).1 ht with h₁ | h₁ <;> rcases (hPs j t).1 ht' with h₂ | h₂ + · exact disjoint_left.1 (hs.disj hbij) (hw₃ i t h₁) (hw₃ j t h₂) + · exact hyoff _ _ (h₂ ▸ hw₃ i t h₁) + · exact hyoff _ _ (h₁ ▸ hw₃ j t h₂) + · exact hbij (hy' (h₁.symm.trans h₂)) + · obtain ⟨v, hv⟩ := hCD x hx + exact hDV v hv + · obtain ⟨v, hv⟩ := hCD x hx + exact hs.off v x hv hxG + · rcases (hPs i x).1 hx with h | h + · exact hdisj hxC h + · obtain ⟨v, hv⟩ := hCD x hxC + exact hyoff _ v (h ▸ hv) + · obtain ⟨u, hu, v, hv, huv⟩ := hE₅ i + exact ⟨u, Or.inr (mem_iUnion.2 ⟨i, hu⟩), v, (hPs i v).2 (Or.inl hv), + fun e => hyoff _ _ (e ▸ hw₃ i v hv), huv⟩ + +/-- **(5.5)** (page 342). -/ +theorem theorem_5_5 [Fintype ι] (hG : G.IsGraph) {T : Set (Hypergraph α β × Hypergraph α β)} {θ : + ℕ} {z : ι → α} (hN : Nodule G T θ z) {g m k n : ℕ} (hg : 2 ≤ g) (hm : 3 ≤ m) + (hn : n = (2 * g + 1) * (2 * m - 5) + 2) (hc : Fintype.card ι = m) (hk : n ≤ 2 * k) + (hθ : k * 20 ^ (2 * g * (m - 2) + n * (m + 1)) ≤ θ) (hno : ¬ HasGrid G T θ g) : + ∃ (G' : Hypergraph α β) (T' : Set (Hypergraph α β × Hypergraph α β)) (θ' : ℕ) (z' : ι → α) + (P : ∀ i, G.skeleton.Walk (z i) (z' i)) (C : Set α), + Residual G T θ z G' T' θ' z' ∧ k ≤ θ' ∧ IsLinkage G G' z z' P ∧ Conn G C ∧ C ⊆ G.vertexSet ∧ + (∀ x ∈ C, x ∉ G'.vertexSet) ∧ + ∀ i, (∀ x ∈ (P i).support, x ∉ C) ∧ ∃ x ∈ C, ∃ u ∈ (P i).support, u ≠ z' i + ∧ G.skeleton.Adj x u := by + classical + have hnlarge : m + 1 ≤ n ∧ 3 ≤ n := by + have h₁ : 5 * (2 * m - 5) ≤ (2 * g + 1) * (2 * m - 5) := Nat.mul_le_mul_right _ (by omega) + omega + set K := k * 20 ^ (2 * g * (m - 2) + n) with hK + have hk₂ : n ≤ 2 * K := hk.trans (Nat.mul_le_mul_left 2 (Nat.le_mul_of_pos_right k + (by positivity))) + have hθ₂ : K * 20 ^ (n * Fintype.card ι) ≤ θ := by + rw [hK, hc, Nat.mul_assoc, ← pow_add] + convert hθ using 3 + rw [Nat.mul_add, Nat.mul_one] + omega + obtain ⟨Y₀, hF, G₁, T₁, θ₁, y, hYc, hN₁, hb₁, hle₁, hconf₁, hzav, hsel⟩ := theorem_4_4 hG hN (k + := K) (n := n) (by omega) (by omega) hk₂ hθ₂ + have hno₁ : ¬ HasGrid G₁ T₁ θ₁ g := fun h => hno (h.of_conformal hle₁ hN.tangle hN₁.tangle hconf₁) + obtain ⟨G₂, T₂, θ₂, y', S, D, hR, hb₂, hS, hs, hL⟩ := theorem_5_4 (IsGraph.of_le hG hle₁) hN₁ hg + hm (hYc.trans hn) (by rw [hYc]; exact hk) (by rw [hYc]; exact hb₁) hno₁ + obtain ⟨L, hLs, hLc⟩ := exists_subset_card_eq (s := leaves S) (n := m) hL + have hZ : (y '' L).ncard = Fintype.card ι := by + rw [InjOn.ncard_image (hN₁.inj.injOn), hLc, hc] + obtain ⟨z₁, hz₁r, hR₁⟩ := hsel (y '' L) (image_subset_range _ _) hZ + have hch : ∀ i, ∃ l ∈ L, y l = z₁ i := fun i => by + have : z₁ i ∈ y '' L := hz₁r ▸ mem_range_self i + exact this + choose b hbL hby using hch + have hbinj : Function.Injective b := fun i j he => hR₁.nodule.inj (by rw [← hby i, ← hby j, he]) + have hrb : range b ⊆ L := by + rintro _ ⟨i, rfl⟩ + exact hbL i + have hRn : ∃ v, v ∉ range b := by + by_contra hcon + push Not at hcon + have huniv : range b = univ := eq_univ_of_forall hcon + have : (range b).ncard = n := by + rw [huniv, ncard_univ, Nat.card_eq_fintype_card, hYc] + rw [ncard_range hbinj, hc] at this + omega + obtain ⟨P', C, hP', hC, hCV, hCoff, hCt⟩ := shadow_touch hs hS (by rw [hYc]; omega) (fun i + => hN₁.free.1 (mem_range_self i)) hR.nodule.free.1 hR.nodule.inj hbinj (fun i => hLs + (hbL i)) hRn (z₁ := z₁) (fun i => hby i ▸ hs.mem _) + have hR₂ : Residual G₁ T₁ θ₁ z₁ G₂ T₂ θ₂ fun i => y' (b i) := + ⟨⟨hR.nodule.tangle, hR.nodule.inj.comp hbinj, hR.nodule.free.subset hR.nodule.tangle + (range_comp_subset_range _ _)⟩, hR.le, fun i => hby i ▸ hR.avoid _, hR.conformal, P', hP'⟩ + obtain ⟨R, hRl⟩ := hR₁.link + have hst : Stage G T θ z 1 G₁ T₁ θ₁ z₁ R := ⟨hR₁.nodule, hR₁.le, hR₁.conformal, hRl, fun _ + => hR₁.avoid, fun h => absurd h (by omega)⟩ + have hst₂ := hst.step hN.tangle hR₂ hP' + refine ⟨G₂, T₂, θ₂, _, _, C, hst₂.residual (by omega), ?_, hst₂.link, hC.mono hle₁, + hCV.trans hle₁.vertexSet_subset, hCoff, fun i => ⟨fun x hx hxC => ?_, ?_⟩⟩ + · exact hb₂ + · have hmem : x ∈ (R i).support ∨ x ∈ (P' i).support := by + simpa [SimpleGraph.Walk.mem_support_append_iff] using hx + rcases hmem with h | h + · have := hRl.2.1 i x h (hCV hxC) + exact (hCt i).1 x (this ▸ (P' i).start_mem_support) hxC + · exact (hCt i).1 x h hxC + · obtain ⟨-, x, hx, u, hu, hne, hadj⟩ := hCt i + exact ⟨x, hx, u, by simp [SimpleGraph.Walk.mem_support_append_iff, hu], hne, + skeleton_mono hle₁ hadj⟩ + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section5e.lean b/LeanPool/GraphMinor/RST94/Section5e.lean new file mode 100644 index 0000000000..d4de04dac9 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section5e.lean @@ -0,0 +1,402 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section5d +import Mathlib.Tactic.Positivity + +/-! +# Section 5 of "Quickly excluding a planar graph": arrays and (5.6) + +Arrays (page 343), and (5.6). We build the columns of the array one at a time, as in the proof of +(5.6) on pages 343-344: each step uses (5.5), and the last column uses (2.12). +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β : Type*} {G : Hypergraph α β} + +/-- An `m × n` array (page 343), with `i ≤ m` and `j < n`. -/ +structure IsArray (G : Hypergraph α β) (m n : ℕ) (W : ℕ → ℕ → Set α) : Prop where + sub : ∀ i ≤ m, ∀ j < n, W i j ⊆ G.vertexSet + conn : ∀ i ≤ m, ∀ j < n, Conn G (W i j) + disj : ∀ i ≤ m, ∀ j < n, ∀ i' ≤ m, ∀ j' < n, (i, j) ≠ (i', j') → Disjoint (W i j) (W i' j') + apex : ∀ i, 1 ≤ i → i ≤ m → ∀ j < n, ∃ x ∈ W 0 j, ∃ y ∈ W i j, G.skeleton.Adj x y + row : ∀ i, 1 ≤ i → i ≤ m → ∀ j, j + 1 < n → ∃ x ∈ W i j, ∃ y ∈ W i (j + 1), G.skeleton.Adj x y + +/-- The array built so far: columns `j < r`, with `W₀` the column of `W_{0j}`. -/ +structure Arr (G : Hypergraph α β) (T : Set (Hypergraph α β × Hypergraph α β)) (θ m r : ℕ) + (G' : Hypergraph α β) (z' : Fin m → α) (W : Fin m → ℕ → Set α) (W₀ : ℕ → Set α) : Prop where + sub : ∀ i, ∀ j < r, W i j ⊆ G.vertexSet + sub₀ : ∀ j < r, W₀ j ⊆ G.vertexSet + conn : ∀ i, ∀ j < r, Conn G (W i j) + conn₀ : ∀ j < r, Conn G (W₀ j) + disj : ∀ i, ∀ j < r, ∀ i', ∀ j' < r, (i, j) ≠ (i', j') → Disjoint (W i j) (W i' j') + disj₀ : ∀ j < r, ∀ j' < r, j ≠ j' → Disjoint (W₀ j) (W₀ j') + cross : ∀ j < r, ∀ i, ∀ j' < r, Disjoint (W₀ j) (W i j') + off : ∀ i, ∀ j < r, ∀ x ∈ W i j, x ∉ G'.vertexSet + off₀ : ∀ j < r, ∀ x ∈ W₀ j, x ∉ G'.vertexSet + apex : ∀ i, ∀ j < r, ∃ x ∈ W₀ j, ∃ y ∈ W i j, G.skeleton.Adj x y + row : ∀ i, ∀ j, j + 1 < r → ∃ x ∈ W i j, ∃ y ∈ W i (j + 1), G.skeleton.Adj x y + last : ∀ i, ∀ j, j + 1 = r → ∃ x ∈ W i j, G.skeleton.Adj x (z' i) + rank : ∀ j < r, m ≤ tangleRank T θ (W₀ j ∪ ⋃ i, W i j) + +/-- The rank of the current end vertices, by (2.7). -/ +theorem rank_range {T T' : Set (Hypergraph α β × Hypergraph α β)} {θ θ' m : ℕ} + (hT : IsTangle G θ T) {z' : Fin m → α} {G' : Hypergraph α β} (hN : Nodule G' T' θ' z') (hle : G' + ≤ G) + (hc : Conformal G G' T T' θ θ') : m ≤ tangleRank T θ (range z') := by + have h₂ := ((isFreeSet_iff_tangleRank_eq hN.tangle).1 hN.free).2 + rw [ncard_range hN.inj, Fintype.card_fin] at h₂ + exact h₂.symm.le.trans (rank_le_of_conformal hle hT hN.tangle hc hN.free.1) + +/-- One more column. In the middle of the array the new sets are given, and at the end they come +from (2.12). -/ +theorem Arr.add {T T' : Set (Hypergraph α β × Hypergraph α β)} {θ θ' m r : ℕ} + (hT : IsTangle G θ T) {G' G₂ : Hypergraph α β} {z' z₂ : Fin m → α} {W : Fin m → ℕ + → Set α} {W₀ : ℕ → Set α} (ha : Arr G T θ m r G' z' W W₀) (hN : Nodule G' T' θ' z') + (hle : G' ≤ G) (hc : Conformal G G' T T' θ θ') {N : Fin m → Set α} {C : Set α} + (hN₁ : ∀ i, Conn G' (N i)) (hN₂ : ∀ i, N i ⊆ G'.vertexSet) (hN₃ : ∀ i, z' i ∈ N i) + (hN₄ : Pairwise fun i j => Disjoint (N i) (N j)) + (hC₁ : Conn G' C) (hC₂ : C ⊆ G'.vertexSet) (hC₃ : ∀ i, Disjoint C (N i)) + (hC₄ : ∀ i, ∃ x ∈ C, ∃ y ∈ N i, G'.skeleton.Adj x y) (hoffN : ∀ i, ∀ x ∈ N i, x ∉ + G₂.vertexSet) (hoffC : ∀ x ∈ C, x ∉ G₂.vertexSet) (hle₂ : G₂ ≤ G') + (hlast : ∀ i, ∃ x ∈ N i, G'.skeleton.Adj x (z₂ i)) : + ∃ W₂ W₂₀, Arr G T θ m (r + 1) G₂ z₂ W₂ W₂₀ := by + classical + have hmono : ∀ {x y}, G'.skeleton.Adj x y → G.skeleton.Adj x y := fun h => skeleton_mono hle h + have hG₂ : ∀ {x}, x ∈ G₂.vertexSet → x ∈ G'.vertexSet := fun h => hle₂.vertexSet_subset h + let W₂ : Fin m → ℕ → Set α := fun i j => if j = r then N i else W i j + let W₂₀ : ℕ → Set α := fun j => if j = r then C else W₀ j + have hWr : ∀ i, W₂ i r = N i := fun i => by simp [W₂] + have hW₀r : W₂₀ r = C := by simp [W₂₀] + have hWo : ∀ i j, j < r → W₂ i j = W i j := fun i j hj => by simp [W₂, hj.ne] + have hW₀o : ∀ j, j < r → W₂₀ j = W₀ j := fun j hj => by simp [W₂₀, hj.ne] + have hcases : ∀ j, j < r + 1 → j < r ∨ j = r := fun j hj => by omega + have hdN : ∀ i i', ∀ j < r, Disjoint (N i) (W i' j) := fun i i' j hj + => disjoint_left.2 fun x hx hx' => ha.off i' j hj x hx' (hN₂ i hx) + have hdC : ∀ i', ∀ j < r, Disjoint C (W i' j) := fun i' j hj => disjoint_left.2 fun x hx hx' + => ha.off i' j hj x hx' (hC₂ hx) + have hd₀N : ∀ i, ∀ j < r, Disjoint (W₀ j) (N i) := fun i j hj => disjoint_right.2 fun x hx hx' + => ha.off₀ j hj x hx' (hN₂ i hx) + have hd₀C : ∀ j < r, Disjoint (W₀ j) C := fun j hj => disjoint_right.2 fun x hx hx' + => ha.off₀ j hj x hx' (hC₂ hx) + refine ⟨W₂, W₂₀, ⟨fun i j hj => ?_, fun j hj => ?_, fun i j hj => ?_, fun j hj + => ?_, fun i j hj i' j' hj' hne => ?_, fun j hj j' hj' hne => ?_, fun j hj i j' hj' + => ?_, fun i j hj x hx hxG => ?_, fun j hj x hx hxG => ?_, + fun i j hj => ?_, fun i j hj => ?_, fun i j hj => ?_, fun j hj => ?_⟩⟩ + · rcases hcases j hj with h | rfl + · rw [hWo _ _ h] + exact ha.sub i j h + · rw [hWr] + exact (hN₂ i).trans hle.vertexSet_subset + · rcases hcases j hj with h | rfl + · rw [hW₀o _ h] + exact ha.sub₀ j h + · rw [hW₀r] + exact hC₂.trans hle.vertexSet_subset + · rcases hcases j hj with h | rfl + · rw [hWo _ _ h] + exact ha.conn i j h + · rw [hWr] + exact (hN₁ i).mono hle + · rcases hcases j hj with h | rfl + · rw [hW₀o _ h] + exact ha.conn₀ j h + · rw [hW₀r] + exact hC₁.mono hle + · rcases hcases j hj with h | rfl <;> rcases hcases j' hj' with h' | rfl + · rw [hWo _ _ h, hWo _ _ h'] + exact ha.disj i j h i' j' h' hne + · rw [hWo _ _ h, hWr] + exact (hdN i' i j h).symm + · rw [hWr, hWo _ _ h'] + exact hdN i i' j' h' + · rw [hWr, hWr] + exact hN₄ fun e => hne (by rw [e]) + · rcases hcases j hj with h | rfl <;> rcases hcases j' hj' with h' | rfl + · rw [hW₀o _ h, hW₀o _ h'] + exact ha.disj₀ j h j' h' hne + · rw [hW₀o _ h, hW₀r] + exact hd₀C j h + · rw [hW₀r, hW₀o _ h'] + exact (hd₀C j' h').symm + · exact absurd rfl hne + · rcases hcases j hj with h | rfl <;> rcases hcases j' hj' with h' | rfl + · rw [hW₀o _ h, hWo _ _ h'] + exact ha.cross j h i j' h' + · rw [hW₀o _ h, hWr] + exact hd₀N i j h + · rw [hW₀r, hWo _ _ h'] + exact hdC i j' h' + · rw [hW₀r, hWr] + exact hC₃ i + · rcases hcases j hj with h | rfl + · rw [hWo _ _ h] at hx + exact ha.off i j h x hx (hG₂ hxG) + · rw [hWr] at hx + exact hoffN i x hx hxG + · rcases hcases j hj with h | rfl + · rw [hW₀o _ h] at hx + exact ha.off₀ j h x hx (hG₂ hxG) + · rw [hW₀r] at hx + exact hoffC x hx hxG + · rcases hcases j hj with h | rfl + · rw [hW₀o _ h, hWo _ _ h] + exact ha.apex i j h + · rw [hW₀r, hWr] + obtain ⟨x, hx, y, hy, hxy⟩ := hC₄ i + exact ⟨x, hx, y, hy, hmono hxy⟩ + · rcases hcases (j + 1) hj with h | h + · rw [hWo _ _ h, hWo _ _ (by omega)] + exact ha.row i j h + · subst h + rw [hWo _ _ (by omega), hWr] + obtain ⟨x, hx, hxz⟩ := ha.last i j rfl + exact ⟨x, hx, z' i, hN₃ i, hxz⟩ + · obtain rfl : j = r := by omega + rw [hWr] + obtain ⟨x, hx, hxz⟩ := hlast i + exact ⟨x, hx, hmono hxz⟩ + · rcases hcases j hj with h | rfl + · simp only [hW₀o _ h, hWo _ _ h] + exact ha.rank j h + · simp only [hW₀r, hWr] + refine (rank_range hT hN hle hc).trans (tangleRank_mono hT ?_) + rintro _ ⟨i, rfl⟩ + exact Or.inr (mem_iUnion.2 ⟨i, hN₃ i⟩) + +/-- The first `n - 1` columns: the induction in the proof of (5.6) (page 343). -/ +theorem exists_arr (hG : G.IsGraph) {T : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} {m : ℕ} {z + : Fin m → α} (hN : Nodule G T θ z) {g n N t : ℕ} (hg : 2 ≤ g) (hm : 3 ≤ m) + (ht : t = 2 * g * (m - 2) + N * (m + 1)) (hN' : N = (2 * g + 1) * (2 * m - 5) + 2) (hθ : 20 ^ + (n * t) ≤ θ) (hno : ¬ HasGrid G T θ g) (r : ℕ) (hr : r + 1 ≤ n) : + ∃ (G' : Hypergraph α β) (T' : Set (Hypergraph α β × Hypergraph α β)) (θ' : ℕ) (z' : Fin m → α) + (W : Fin m → ℕ → Set α) (W₀ : ℕ → Set α), + Nodule G' T' θ' z' ∧ G' ≤ G ∧ Conformal G G' T T' θ θ' ∧ 20 ^ ((n - r) * t) ≤ θ' + ∧ Arr G T θ m r G' z' W W₀ := by + have hT := hN.tangle + induction r with + | zero => + refine ⟨G, T, θ, z, fun _ _ => ∅, fun _ => ∅, hN, le_rfl, conformal_of_subset hT le_rfl + subset_rfl, hθ, ?_⟩ + constructor <;> intros <;> omega + | succ r ih => + obtain ⟨G', T', θ', z', W, W₀, hN₁, hle, hc, hb, ha⟩ := ih (by omega) + obtain ⟨e, he⟩ : ∃ e, n - (r + 1) = e + 1 := ⟨n - (r + 1) - 1, by omega⟩ + have hsplit : n - r = n - (r + 1) + 1 := by omega + set K := 20 ^ ((n - (r + 1)) * t) with hK + have htN : N ≤ t := by + have : N * 1 ≤ N * (m + 1) := Nat.mul_le_mul_left _ (by omega) + omega + have hk : N ≤ 2 * K := by + have h₁ : t ≤ (n - (r + 1)) * t := by + rw [he, Nat.succ_mul] + omega + have h₂ : (n - (r + 1)) * t < K := Nat.lt_pow_self (by omega) + omega + have hθ₂ : K * 20 ^ (2 * g * (m - 2) + N * (m + 1)) ≤ θ' := by + rw [← ht, hK, ← pow_add, ← Nat.succ_mul, Nat.succ_eq_add_one, ← hsplit] + exact hb + have hG' : G'.IsGraph := IsGraph.of_le hG hle + have hno' : ¬ HasGrid G' T' θ' g := fun h => hno (h.of_conformal hle hT hN₁.tangle hc) + obtain ⟨G₂, T₂, θ₂, z₂, P, C, hR, hb₂, hL, hC, hCV, hCoff, hCt⟩ := theorem_5_5 hG' hN₁ hg hm + hN' (Fintype.card_fin m) hk hθ₂ hno' + obtain ⟨hP₁, hP₂, hP₃⟩ := hL + have hne : ∀ i, z' i ≠ z₂ i := fun i e => hR.avoid i (e ▸ hR.nodule.free.1 (mem_range_self i)) + have hlast := fun i => exists_butlast (P i) (hP₁ i) (hne i) + choose d q hd hq using hlast + have hC₄ : ∀ i, ∃ x ∈ C, ∃ y ∈ {x | x ∈ (q i).support}, G'.skeleton.Adj x y := fun i => by + obtain ⟨-, x, hx, u, hu, hun, hadj⟩ := hCt i + exact ⟨x, hx, u, (hq i u).2 ⟨hu, hun⟩, hadj⟩ + obtain ⟨W₂, W₂₀, ha₂⟩ := ha.add (N := fun i => {x | x ∈ (q i).support}) (C := C) hT hN₁ hle hc + (fun i => conn_support (q i)) (fun i x hx => support_mem (q i) (hN₁.free.1 + (mem_range_self i)) hx) + (fun i => (q i).start_mem_support) (fun i j hij => disjoint_left.2 fun x hx hx' + => disjoint_left.1 (hP₃ hij) ((hq i x).1 hx).1 ((hq j x).1 hx').1) hC hCV + (fun i => disjoint_left.2 fun x hx hx' => (hCt i).1 x ((hq i x).1 hx').1 hx) hC₄ + (fun i x hx hxG => ((hq i x).1 hx).2 (hP₂ i x ((hq i x).1 hx).1 hxG)) hCoff hR.le (fun i + => ⟨d i, (q i).end_mem_support, hd i⟩) + exact ⟨G₂, T₂, θ₂, z₂, W₂, W₂₀, hR.nodule, hR.le.trans hle, Conformal.trans hle hR.le hT + hN₁.tangle hR.nodule.tangle hc hR.conformal, hb₂, ha₂⟩ + +/-- The array of all `n` columns, with the last column from (2.12). -/ +theorem exists_arr_all (hG : G.IsGraph) {T : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} {m : ℕ} + {z : Fin m → α} (hN : Nodule G T θ z) {g n N t : ℕ} (hg : 2 ≤ g) (hm : 3 ≤ m) (hn : 1 ≤ n) + (ht : t = 2 * g * (m - 2) + N * (m + 1)) (hN' : N = (2 * g + 1) * (2 * m - 5) + 2) (hθ : 20 ^ + (n * t) ≤ θ) (hno : ¬ HasGrid G T θ g) : + ∃ (G' : Hypergraph α β) (z' : Fin m → α) (W : Fin m → ℕ → Set α) (W₀ : ℕ + → Set α), Arr G T θ m n G' z' W W₀ := by + have hT := hN.tangle + obtain ⟨G', T', θ', z', W, W₀, hN₁, hle, hc, hb, ha⟩ := exists_arr hG hN hg hm ht hN' hθ hno + (n - 1) (by omega) + rw [show n - (n - 1) = 1 by omega, Nat.one_mul] at hb + have hmt : m < θ' := by + have h₁ : m * 1 ≤ m * ((2 * g + 1) * (2 * m - 5) + 2) := Nat.mul_le_mul_left _ (by omega) + have h₂ : t < 20 ^ t := Nat.lt_pow_self (by omega) + have h₃ : (m + 1) * 1 ≤ (m + 1) * N := Nat.mul_le_mul_left _ (by omega) + rw [Nat.mul_comm (m + 1) N] at h₃ + omega + have hrank : (range z').ncard < θ' := by + rwa [ncard_range hN₁.inj, Fintype.card_fin] + obtain ⟨C, hC₁, hC₂, hC₃, hC₄⟩ := theorem_2_12 hN₁.tangle hN₁.free hrank + have hadj : ∀ i, ∃ y, y ∈ C ∧ G'.skeleton.Adj (z' i) y := fun i => hC₄ _ (mem_range_self i) + choose y hy hy₂ using hadj + obtain ⟨W₂, W₂₀, ha₂⟩ := ha.add (G₂ := G'.deleteVertices G'.vertexSet) (z₂ := y) (N := fun i + => {z' i}) (C := C) hT hN₁ hle hc (fun i => conn_singleton) (fun i => singleton_subset_iff.2 + (hN₁.free.1 (mem_range_self i))) (fun i => rfl) + (fun i j hij => disjoint_singleton.2 fun e => hij (hN₁.inj e)) hC₁ hC₂ (fun i + => disjoint_singleton_right.2 fun h => disjoint_left.1 hC₃ h (mem_range_self i)) (fun i + => ⟨y i, hy i, z' i, rfl, (hy₂ i).symm⟩) + (fun i x _ hxG => hxG.2 hxG.1) (fun x _ hxG => hxG.2 hxG.1) (deleteVertices_le _ _) (fun i + => ⟨z' i, rfl, hy₂ i⟩) + rw [show n - 1 + 1 = n by omega] at ha₂ + exact ⟨_, y, W₂, W₂₀, ha₂⟩ + +/-- **(5.6)** (page 343). `𝒯` dominates the array means the bound on the rank in the conclusion. -/ +theorem theorem_5_6 (hG : G.IsGraph) {T : Set (Hypergraph α β × Hypergraph α β)} {θ : ℕ} + (hT : IsTangle G θ T) {g m n N t : ℕ} (hg : 2 ≤ g) (hm : 3 ≤ m) (hn : 1 ≤ n) + (ht : t = 2 * g * (m - 2) + N * (m + 1)) (hN' : N = (2 * g + 1) * (2 * m - 5) + 2) (hθ : 20 ^ + (n * t) ≤ θ) (hno : ¬ HasGrid G T θ g) : + ∃ W, IsArray G m n W ∧ ∀ i ≤ m, min m n ≤ tangleRank T θ (⋃ j ∈ {j | j < n}, W i j) := by + classical + have hmθ : m ≤ θ := by + have h₁ : m * 1 ≤ m * ((2 * g + 1) * (2 * m - 5) + 2) := Nat.mul_le_mul_left _ (by omega) + have h₂ : t * 1 ≤ t * n := Nat.mul_le_mul_left _ hn + have h₃ : n * t < 20 ^ (n * t) := Nat.lt_pow_self (by omega) + have h₄ : (m + 1) * 1 ≤ (m + 1) * N := Nat.mul_le_mul_left _ (by omega) + rw [Nat.mul_comm (m + 1) N] at h₄ + rw [Nat.mul_comm n t] at h₃ hθ + omega + obtain ⟨Y, -, hYc, hYf⟩ := exists_free_superset hT (X := ∅) ⟨empty_subset _, by simp, by simp⟩ (n + := m) (by simp) hmθ + have hYfin : Y.Finite := G.vertexSet_finite.subset hYf.1 + let e : hYfin.toFinset ≃ Fin m := Finset.equivFinOfCardEq (by rw [← ncard_eq_toFinset_card Y + hYfin, hYc]) + let z : Fin m → α := fun i => (e.symm i).1 + have hzr : range z = Y := by + ext x + constructor + · rintro ⟨i, rfl⟩ + exact hYfin.mem_toFinset.1 (e.symm i).2 + · intro hx + exact ⟨e ⟨x, hYfin.mem_toFinset.2 hx⟩, by simp [z]⟩ + have hN : Nodule G T θ z := by + refine ⟨hT, fun _ _ h => e.symm.injective (Subtype.ext h), ?_⟩ + rwa [hzr] + obtain ⟨G', z', W, W₀, ha⟩ := exists_arr_all hG hN hg hm hn ht hN' hθ hno + let U : ℕ → ℕ → Set α := fun i j => if h : i = 0 then W₀ j else if h' : i - 1 < m then W ⟨i - 1, + h'⟩ j else ∅ + have hU0 : ∀ j, U 0 j = W₀ j := fun j => by simp [U] + have hUi : ∀ (c : Fin m) j, U (c.1 + 1) j = W c j := fun c j => by simp [U, c.2] + have hcase : ∀ i, i ≤ m → i = 0 ∨ ∃ c : Fin m, i = c.1 + 1 := fun i hi => by + rcases Nat.eq_zero_or_pos i with h | h + · exact Or.inl h + · exact Or.inr ⟨⟨i - 1, by omega⟩, by simp; omega⟩ + let X : ℕ → Set α := fun j => W₀ j ∪ ⋃ i, W i j + have hsubX : ∀ i ≤ m, ∀ j, U i j ⊆ X j := fun i hi j => by + rcases hcase i hi with rfl | ⟨c, rfl⟩ + · rw [hU0] + exact subset_union_left + · rw [hUi] + exact (subset_iUnion (fun i => W i j) c).trans subset_union_right + have hXd : ∀ j < n, ∀ j' < n, j ≠ j' → Disjoint (X j) (X j') := fun j hj j' hj' hne => by + refine disjoint_union_left.2 ⟨disjoint_union_right.2 ⟨ha.disj₀ j hj j' hj' hne, + disjoint_iUnion_right.2 fun i => ha.cross j hj i j' hj'⟩, disjoint_iUnion_left.2 fun i => + disjoint_union_right.2 ⟨(ha.cross j' hj' i j hj).symm, disjoint_iUnion_right.2 fun i' + => ha.disj i j hj i' j' hj' fun e => hne (Prod.ext_iff.1 e).2⟩⟩ + have hXc : ∀ j < n, Conn G (X j) := fun j hj => by + have h₁ := conn_union_iUnion (E := fun i => W₀ j ∪ W i j) (ha.conn₀ j hj) (fun i => by + obtain ⟨x, hx, y, hy, hxy⟩ := ha.apex i j hj + exact (ha.conn₀ j hj).union_adj (ha.conn i j hj) hx hy hxy) (fun i => by + obtain ⟨x, hx⟩ := (ha.conn₀ j hj).1 + exact ⟨x, hx, Or.inl hx⟩) + have heq : (W₀ j ∪ ⋃ i, (W₀ j ∪ W i j)) = X j := by + ext v + simp only [X, mem_union, mem_iUnion] + constructor + · rintro (h | ⟨i, h | h⟩) + · exact Or.inl h + · exact Or.inl h + · exact Or.inr ⟨i, h⟩ + · rintro (h | ⟨i, h⟩) + · exact Or.inl h + · exact Or.inr ⟨i, Or.inr h⟩ + rw [heq] at h₁ + exact h₁ + refine ⟨U, ⟨fun i hi j hj => ?_, fun i hi j hj => ?_, fun i hi j hj i' hi' j' hj' hne => ?_, + fun i h₁ h₂ j hj => ?_, fun i h₁ h₂ j hj => ?_⟩, fun i hi => ?_⟩ + · rcases hcase i hi with rfl | ⟨c, rfl⟩ + · rw [hU0] + exact ha.sub₀ j hj + · rw [hUi] + exact ha.sub c j hj + · rcases hcase i hi with rfl | ⟨c, rfl⟩ + · rw [hU0] + exact ha.conn₀ j hj + · rw [hUi] + exact ha.conn c j hj + · rcases hcase i hi with rfl | ⟨c, rfl⟩ <;> rcases hcase i' hi' with rfl | ⟨c', rfl⟩ + · rw [hU0, hU0] + exact ha.disj₀ j hj j' hj' fun e => hne (by rw [e]) + · rw [hU0, hUi] + exact ha.cross j hj c' j' hj' + · rw [hU0, hUi] + exact (ha.cross j' hj' c j hj).symm + · rw [hUi, hUi] + exact ha.disj c j hj c' j' hj' fun e => hne (by + have h₁ : c = c' := (Prod.ext_iff.1 e).1 + have h₂ : j = j' := (Prod.ext_iff.1 e).2 + rw [h₁, h₂]) + · rcases hcase i h₂ with rfl | ⟨c, rfl⟩ + · omega + · rw [hU0, hUi] + exact ha.apex c j hj + · rcases hcase i h₂ with rfl | ⟨c, rfl⟩ + · omega + · rw [hUi, hUi] + exact ha.row c j hj + · refine (le_rank_iff ((min_le_left _ _).trans hmθ)).2 fun A B hAB hY => ?_ + by_contra hlt + push Not at hlt + have hs : G.IsSeparation A B := hT.isSeparation hAB + have hcard : (A ∩ B).vertexSet.ncard < (Finset.range n).card := by + rw [Finset.card_range] + have : separationOrder A B < n := hlt.trans_le (min_le_right _ _) + exact this + obtain ⟨j, hj, hd⟩ := exists_avoid (Finset.range n) X (fun a ha' b hb' hab => hXd a + (Finset.mem_range.1 ha') b (Finset.mem_range.1 hb') hab) (A ∩ B).vertexSet_finite hcard + have hj' : j < n := Finset.mem_range.1 hj + obtain ⟨a, ha₁⟩ := (ha.conn₀ j hj').1 + obtain ⟨x, hx⟩ : (U i j).Nonempty := by + rcases hcase i hi with rfl | ⟨c, rfl⟩ + · rw [hU0] + exact (ha.conn₀ j hj').1 + · rw [hUi] + exact (ha.conn c j hj').1 + have hxA : x ∈ A.vertexSet := hY (mem_iUnion₂.2 ⟨j, hj', hx⟩) + have hXA : X j ⊆ A.vertexSet := fun b hb => by + by_contra hbA + have hbV : b ∈ G.vertexSet := by + rcases hb with h | h + · exact ha.sub₀ j hj' h + · obtain ⟨c, hc⟩ := mem_iUnion.1 h + exact ha.sub c j hj' hc + have hbB : b ∈ B.vertexSet := (mem_V_or hs hbV).resolve_left hbA + obtain ⟨v, hv, hvS⟩ := (hXc j hj').meets_sep hs (hsubX i hi j hx) hb hxA hbB + exact disjoint_left.1 hd hv hvS + have h₁ := tangleRank_le_separationOrder (θ := θ) hAB hXA + have h₂ : m ≤ tangleRank T θ (X j) := ha.rank j hj' + exact absurd (h₂.trans h₁) (not_le.2 (hlt.trans_le (min_le_left _ _))) + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Section5f.lean b/LeanPool/GraphMinor/RST94/Section5f.lean new file mode 100644 index 0000000000..6314bf310e --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Section5f.lean @@ -0,0 +1,224 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section5e +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Ring + +/-! +# Section 5 of "Quickly excluding a planar graph": (5.7) + +The main result (5.7), page 344, for `g ≥ 3`, in the form `HasGrid`. We turn it into a grid minor in +`GraphMinor/RST94/Theorem23.lean`. The case `g = 2` in the paper uses Graph Minors X (8.3), and it +is not needed: XVI uses `g = 2θ + 1 ≥ 3`. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set + +variable {α β : Type*} {G : Hypergraph α β} + +/-- The sets `U_{ij}` in the proof of (5.7), with `i` and `j` from `0`: the paper's `U_{i+1, j+1}`. +-/ +def arrayU (A : ℕ → ℕ → Set α) (t i j : ℕ) : Set α := + {v | ∃ k, j * t ≤ k ∧ k < (j + 1) * t ∧ v ∈ A (i + 1) k} ∪ {v | Even (i + 1) ∧ v ∈ A 0 (j * t + + (i + 1) / 2 - 1)} + +/-- A block of consecutive sets of a row is connected. -/ +theorem conn_block {m n : ℕ} {A : ℕ → ℕ → Set α} (hA : IsArray G m n A) {i : ℕ} (h₁ : 1 ≤ i) + (h₂ : i ≤ m) (a s : ℕ) (hs : a + s + 1 ≤ n) : + Conn G {v | ∃ k, a ≤ k ∧ k < a + s + 1 ∧ v ∈ A i k} := by + induction s with + | zero => + have : {v | ∃ k, a ≤ k ∧ k < a + 0 + 1 ∧ v ∈ A i k} = A i a := by + ext v + constructor + · rintro ⟨k, h₃, h₄, h₅⟩ + obtain rfl : k = a := by omega + exact h₅ + · exact fun h => ⟨a, le_rfl, by omega, h⟩ + rw [this] + exact hA.conn i h₂ a (by omega) + | succ s ih => + have h₃ := ih (by omega) + obtain ⟨x, hx, y, hy, hxy⟩ := hA.row i h₁ h₂ (a + s) (by omega) + have h₄ := h₃.union_adj (hA.conn i h₂ (a + s + 1) (by omega)) ⟨a + s, by omega, by omega, hx⟩ + hy hxy + have : {v | ∃ k, a ≤ k ∧ k < a + (s + 1) + 1 ∧ v ∈ A i k} = {v | ∃ k, a ≤ k ∧ k < a + s + 1 + ∧ v ∈ A i k} ∪ A i (a + s + 1) := by + ext v + constructor + · rintro ⟨k, h₅, h₆, h₇⟩ + rcases Nat.lt_or_ge k (a + s + 1) with h₈ | h₈ + · exact Or.inl ⟨k, h₅, h₈, h₇⟩ + · obtain rfl : k = a + s + 1 := by omega + exact Or.inr h₇ + · rintro (⟨k, h₅, h₆, h₇⟩ | h₅) + · exact ⟨k, h₅, by omega, h₇⟩ + · exact ⟨a + s + 1, by omega, by omega, h₅⟩ + rw [this] + exact h₄ + +/-- The sets `U_{ij}` in the proof of (5.7) form a grid, with rows and columns exchanged. -/ +theorem hasGrid_of_array {T : Set (Hypergraph α β × Hypergraph α β)} {θ g t : ℕ} + (hT : IsTangle G θ T) {A : ℕ → ℕ → Set α} (hA : IsArray G g (g * t) A) (ht : 1 ≤ t) (htg : g + ≤ 2 * t + 1) + (hr : ∀ i ≤ g, min g (g * t) ≤ tangleRank T θ (⋃ j ∈ {j | j < g * t}, A i j)) : HasGrid G T θ g + := by + have hbound : ∀ {j}, j < g → (j + 1) * t ≤ g * t := fun {j} hj => Nat.mul_le_mul_right _ hj + have hsucc : ∀ j, (j + 1) * t = j * t + t := fun j => Nat.succ_mul j t + -- The index of the extra set. + have hl : ∀ {i j}, i < g → j < g → Even (i + 1) → j * t ≤ j * t + (i + 1) / 2 - 1 ∧ j * t + + (i + 1) / 2 - 1 < (j + 1) * t := fun {i j} hi hj he => by + obtain ⟨c, hc⟩ := he + rw [hsucc] + omega + have hlk : ∀ {j}, j < g → ∀ k, k < (j + 1) * t → k < g * t := fun hj k hk => hk.trans_le + (hbound hj) + have hconnU : ∀ i < g, ∀ j < g, Conn G (arrayU A t i j) := fun i hi j hj => by + obtain ⟨s, hs⟩ : ∃ s, t = s + 1 := ⟨t - 1, by omega⟩ + have hbl := hbound hj + rw [hsucc] at hbl + have h₁ := conn_block hA (i := i + 1) (by omega) (by omega) (j * t) s (by omega) + have heq : {v | ∃ k, j * t ≤ k ∧ k < (j + 1) * t ∧ v ∈ A (i + 1) k} = {v | ∃ k, j * t ≤ k + ∧ k < j * t + s + 1 ∧ v ∈ A (i + 1) k} := by + rw [hsucc, hs] + rfl + by_cases he : Even (i + 1) + · have h₂ : arrayU A t i j = {v | ∃ k, j * t ≤ k ∧ k < (j + 1) * t ∧ v ∈ A (i + 1) k} ∪ + A 0 (j * t + (i + 1) / 2 - 1) := by + ext v + simp [arrayU, he] + rw [h₂, heq] + obtain ⟨hl₁, hl₂⟩ := hl hi hj he + obtain ⟨x, hx, y, hy, hxy⟩ := hA.apex (i + 1) (by omega) (by omega) _ (hlk hj _ hl₂) + refine h₁.union_adj (hA.conn 0 (Nat.zero_le _) _ (hlk hj _ hl₂)) (x := y) (y := x) ⟨_, hl₁, + ?_, hy⟩ hx hxy.symm + rw [hsucc] at hl₂ + omega + · have h₂ : arrayU A t i j = {v | ∃ k, j * t ≤ k ∧ k < (j + 1) * t ∧ v ∈ A (i + 1) k} := by + ext v + simp [arrayU, he] + rw [h₂, heq] + exact h₁ + have hrange : ∀ {j j' k k' : ℕ}, j ≠ j' → j * t ≤ k → k < (j + 1) * t → j' * t ≤ k' → k' < + (j' + 1) * t → k ≠ k' := fun {j j' k k'} hne h₁ h₂ h₃ h₄ e => by + subst e + rcases Nat.lt_or_gt_of_ne hne with h | h + · have := Nat.mul_le_mul_right t (show j + 1 ≤ j' from h) + omega + · have := Nat.mul_le_mul_right t (show j' + 1 ≤ j from h) + omega + have hdU : ∀ i < g, ∀ j < g, ∀ i' < g, ∀ j' < g, (i, j) ≠ (i', j') → Disjoint (arrayU A t i j) + (arrayU A t i' j') := fun i hi j hj i' hi' j' hj' hne => by + refine disjoint_left.2 ?_ + rintro v (⟨k, h₁, h₂, hv⟩ | ⟨he, hv⟩) (⟨k', h₃, h₄, hv'⟩ | ⟨he', hv'⟩) + · refine disjoint_left.1 (hA.disj (i + 1) (by omega) k (hlk hj k h₂) (i' + 1) (by omega) k' + (hlk hj' k' h₄) fun e => ?_) hv hv' + have e₁ : i + 1 = i' + 1 := (Prod.ext_iff.1 e).1 + have e₂ : k = k' := (Prod.ext_iff.1 e).2 + have hii : i = i' := by omega + subst hii + exact hrange (fun hjj => hne (by rw [hjj])) h₁ h₂ h₃ h₄ e₂ + · obtain ⟨hl₁, hl₂⟩ := hl hi' hj' he' + exact disjoint_left.1 (hA.disj (i + 1) (by omega) k (hlk hj k h₂) 0 (Nat.zero_le _) _ + (hlk hj' _ hl₂) fun e => by simpa using (Prod.ext_iff.1 e).1) hv hv' + · obtain ⟨hl₁, hl₂⟩ := hl hi hj he + exact disjoint_left.1 (hA.disj 0 (Nat.zero_le _) _ (hlk hj _ hl₂) (i' + 1) (by omega) k' + (hlk hj' k' h₄) fun e => by simpa using (Prod.ext_iff.1 e).1) hv hv' + · obtain ⟨hl₁, hl₂⟩ := hl hi hj he + obtain ⟨hl₃, hl₄⟩ := hl hi' hj' he' + refine disjoint_left.1 (hA.disj 0 (Nat.zero_le _) _ (hlk hj _ hl₂) 0 (Nat.zero_le _) _ + (hlk hj' _ hl₄) fun e => ?_) hv hv' + have e₂ : j * t + (i + 1) / 2 - 1 = j' * t + (i' + 1) / 2 - 1 := (Prod.ext_iff.1 e).2 + by_cases hjj : j = j' + · subst hjj + obtain ⟨c, hc⟩ := he + obtain ⟨c', hc'⟩ := he' + have hii : i = i' := by omega + exact hne (by rw [hii]) + · exact hrange hjj hl₁ hl₂ hl₃ hl₄ e₂ + refine ⟨fun a b => arrayU A t b a, ⟨fun a ha b hb => ?_, fun a ha b hb + => hconnU b hb a ha, fun a ha b hb a' ha' b' hb' hne => hdU b hb a ha b' hb' a' ha' fun e + => hne ?_, fun a ha b hb => ?_, fun a ha b hb => ?_, fun b hb => ?_⟩⟩ + · rintro v (⟨k, -, h₂, hv⟩ | ⟨he, hv⟩) + · exact hA.sub (b + 1) (by omega) k (hlk ha k h₂) hv + · exact hA.sub 0 (Nat.zero_le _) _ (hlk ha _ (hl hb ha he).2) hv + · have e₁ : b = b' := (Prod.ext_iff.1 e).1 + have e₂ : a = a' := (Prod.ext_iff.1 e).2 + rw [e₁, e₂] + · -- Adjacent rows of `U` meet the same set `W_{0,l}`. + by_cases he : Even (b + 1) + · obtain ⟨hl₁, hl₂⟩ := hl (i := b) (j := a) (by omega) ha he + obtain ⟨x, hx, y, hy, hxy⟩ := hA.apex (b + 1 + 1) (by omega) (by omega) _ (hlk ha _ hl₂) + exact ⟨x, Or.inr ⟨he, hx⟩, y, Or.inl ⟨_, hl₁, hl₂, hy⟩, hxy⟩ + · have he₂ : Even (b + 1 + 1) := by + rcases Nat.even_or_odd (b + 1) with h | h + · exact absurd h he + · exact h.add_one + obtain ⟨hl₁, hl₂⟩ := hl (i := b + 1) (j := a) hb ha he₂ + obtain ⟨x, hx, y, hy, hxy⟩ := hA.apex (b + 1) (by omega) (by omega) _ (hlk ha _ hl₂) + exact ⟨y, Or.inl ⟨_, hl₁, hl₂, hy⟩, x, Or.inr ⟨he₂, hx⟩, hxy.symm⟩ + · -- Adjacent columns of `U` by the last and first sets of the two blocks. + have h₁ := hbound ha + have h₂ := hsucc (a + 1) + have h₃ := hsucc a + obtain ⟨x, hx, y, hy, hxy⟩ := hA.row (b + 1) (by omega) (by omega) ((a + 1) * t - 1) (by omega) + refine ⟨x, Or.inl ⟨_, by omega, by omega, hx⟩, y, Or.inl ⟨_, ?_, ?_, hy⟩, hxy⟩ <;> omega + · have hmin : min g (g * t) = g := min_eq_left (Nat.le_mul_of_pos_right g ht) + have h₂ := hr (b + 1) (by omega) + rw [hmin] at h₂ + refine h₂.trans (tangleRank_mono hT (iUnion₂_subset fun k hk v hv => ?_)) + have hk' : k < g * t := hk + have htpos : 0 < t := ht + have hdiv := Nat.div_add_mod k t + have hmod := Nat.mod_lt k htpos + have ha : k / t < g := Nat.div_lt_of_lt_mul (by rw [Nat.mul_comm]; exact hk') + rw [Nat.mul_comm] at hdiv + refine mem_iUnion₂.2 ⟨k / t, ha, Or.inl ⟨k, by omega, ?_, hv⟩⟩ + rw [hsucc] + omega + +/-- **(5.7)** (page 344), for `g ≥ 3`. -/ +theorem theorem_5_7 (hG : G.IsGraph) {T : Set (Hypergraph α β × Hypergraph α β)} {θ g : ℕ} + (hT : IsTangle G θ T) (hg : 3 ≤ g) (hθ : 20 ^ (g ^ 4 * (2 * g - 1)) ≤ θ) : HasGrid G T θ g := by + by_contra hno + obtain ⟨h, rfl⟩ : ∃ h, g = h + 3 := ⟨g - 3, by omega⟩ + set g := h + 3 with hgdef + set t := g / 2 with ht + have ht₁ : 1 ≤ t := by omega + have ht₂ : g ≤ 2 * t + 1 := by omega + have ht₃ : 2 * t ≤ g := by omega + set N := (2 * g + 1) * (2 * g - 5) + 2 with hN + set u := 2 * g * (g - 2) + N * (g + 1) with hu + have hbound : g * t * u ≤ g ^ 4 * (2 * g - 1) := by + have h₁ : u + 15 * h + 48 = 2 * g * g * (2 * g - 1) := by + have e₁ : 2 * g - 5 = 2 * h + 1 := by omega + have e₂ : g - 2 = h + 1 := by omega + have e₃ : 2 * g - 1 = 2 * h + 5 := by omega + rw [hu, hN, e₁, e₂, e₃, hgdef] + ring + have h₂ : 2 * (g * t * u) ≤ 2 * (g ^ 4 * (2 * g - 1)) := by + calc 2 * (g * t * u) = g * (2 * t) * u := by ring + _ ≤ g * g * u := by gcongr + _ ≤ g * g * (2 * g * g * (2 * g - 1)) := by + gcongr + omega + _ = 2 * (g ^ 4 * (2 * g - 1)) := by ring + omega + obtain ⟨A, hA, hr⟩ := theorem_5_6 hG hT (g := g) (m := g) (n := g * t) (N := N) (t := u) + (by omega) hg (Nat.mul_pos (by omega) ht₁) hu hN ((Nat.pow_le_pow_right + (by omega) hbound).trans hθ) hno + exact hno (hasGrid_of_array hT hA ht₁ ht₂ hr) + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Theorem23.lean b/LeanPool/GraphMinor/RST94/Theorem23.lean new file mode 100644 index 0000000000..a0c4d9f637 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Theorem23.lean @@ -0,0 +1,275 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.RST94.Section5f +public import LeanPool.GraphMinor.GM16.Cited +public import LeanPool.GraphMinor.GM16.Section7 +import Mathlib.Tactic.Positivity + +/-! +# (2.3) of "Quickly excluding a planar graph", in the form XVI cites + +Sets as in (5.1) (page 339) give a grid minor (`grid_model`), and `𝒯` dominates it in the sense XVI +uses (`no_row`). This is the proof of (5.1), with the sides of the separation swapped as in the +docstring of `GM16.RST94Theorem23Statement`. Together with (5.7) this proves the statement. +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Hypergraph GM10 Set Graph + +variable {α β : Type*} + +theorem link_of_adj {G : Graph α β} {hV : V(G).Finite} {hE : E(G).Finite} {x y : α} (h : + (Hypergraph.ofGraph G hV hE).skeleton.Adj x y) : ∃ f, G.IsLink f x y := by + obtain ⟨hne, f, ⟨a, ha⟩, ⟨b, hb⟩⟩ := h + refine ⟨f, ?_⟩ + rcases hb.left_eq_or_eq ha with rfl | rfl + · exact absurd rfl hne + · exact ha + +/-- A connected set in the hypergraph gives a connected induced graph, when the deleted edges do not +lie inside the set. -/ +theorem graphConnected_of_conn {G : Graph α β} {hV : V(G).Finite} {hE : E(G).Finite} {X : Set α} {F + : Set β} (hX : Conn (Hypergraph.ofGraph G hV hE) X) (hF : ∀ f ∈ F, ∀ x y, G.IsLink f x y → x ∈ X + → y ∉ X) : + GraphConnected ((G.deleteEdges F).induce X) := by + refine ⟨hX.1, fun x hx y hy => ?_⟩ + obtain ⟨w, hw⟩ := hX.2 x hx y hy + induction w with + | nil => exact Relation.ReflTransGen.refl + | @cons a b c h q ih => + refine Relation.ReflTransGen.head ?_ (ih (hw b (by simp)) hy fun t ht => hw t (by simp [ht])) + obtain ⟨f, hf⟩ := link_of_adj h + have ha := hw a (by simp) + have hb := hw b (by simp) + refine ⟨f, ?_⟩ + simp only [induce_isLink, deleteEdges_isLink] + exact ⟨⟨hf, fun hfF => hF f hfF a b hf ha hb⟩, ha, hb⟩ + +/-- The grid minor made from sets as in (5.1). -/ +theorem grid_model {G : Graph α β} {hV : V(G).Finite} {hE : E(G).Finite} {T : Set + (Hypergraph α β × Hypergraph α β)} {θ g : ℕ} {W : ℕ → ℕ → Set α} (hW : IsGrid + (Hypergraph.ofGraph G hV hE) T θ g W) (hg : 2 ≤ g) : + ∃ ηe : Sym2 (Fin g × Fin g) → β, IsMinorModel (GM01.gridGraph g) G (fun u => W u.1 u.2) ηe ∧ + ∀ e ∈ E(GM01.gridGraph g), ∃ u v x y, e = s(u, v) ∧ u ≠ v ∧ x ∈ W u.1 u.2 ∧ y ∈ W v.1 v.2 + ∧ G.IsLink (ηe e) x y := by + classical + have hdisj : ∀ u v : Fin g × Fin g, u ≠ v → Disjoint (W u.1 u.2) (W v.1 v.2) := fun u v hne => + hW.disj _ u.1.2 _ u.2.2 _ v.1.2 _ v.2.2 fun e => hne (Prod.ext (Fin.ext (Prod.ext_iff.1 e).1) + (Fin.ext (Prod.ext_iff.1 e).2)) + have hadj : ∀ u v : Fin g × Fin g, (SimpleGraph.pathGraph g □ SimpleGraph.pathGraph g).Adj u v + → ∃ x ∈ W u.1 u.2, ∃ y ∈ W v.1 v.2, ∃ f, G.IsLink f x y := by + have key : ∀ (a b : ℕ) (c : ℕ), c < g → b = a + 1 → b < g → (∃ x ∈ W a c, ∃ y ∈ W b c, ∃ f, + G.IsLink f x y) ∧ ∃ x ∈ W c a, ∃ y ∈ W c b, ∃ f, G.IsLink f x y := by + rintro a _ c hc rfl hb + obtain ⟨x, hx, y, hy, hxy⟩ := hW.col a hb c hc + obtain ⟨x', hx', y', hy', hxy'⟩ := hW.row c hc a hb + exact ⟨⟨x, hx, y, hy, link_of_adj hxy⟩, x', hx', y', hy', link_of_adj hxy'⟩ + have hsym : ∀ {a b : Set α}, (∃ x ∈ a, ∃ y ∈ b, ∃ f, G.IsLink f x y) + → ∃ x ∈ b, ∃ y ∈ a, ∃ f, G.IsLink f x y := fun ⟨x, hx, y, hy, f, hf⟩ + => ⟨y, hy, x, hx, f, hf.symm⟩ + rintro ⟨u₁, u₂⟩ ⟨v₁, v₂⟩ h + rw [SimpleGraph.boxProd_adj] at h + rcases h with ⟨h₁, h₂⟩ | ⟨h₁, h₂⟩ + · simp only at h₁ h₂ + subst h₂ + rcases SimpleGraph.pathGraph_adj.1 h₁ with h | h + · exact (key u₁.1 v₁.1 u₂.1 u₂.2 h.symm v₁.2).1 + · exact hsym (key v₁.1 u₁.1 u₂.1 u₂.2 h.symm u₁.2).1 + · simp only at h₁ h₂ + subst h₂ + rcases SimpleGraph.pathGraph_adj.1 h₁ with h | h + · exact (key u₂.1 v₂.1 u₁.1 u₁.2 h.symm v₂.2).2 + · exact hsym (key v₂.1 u₂.1 u₁.1 u₁.2 h.symm u₂.2).2 + have hch : ∀ e : Sym2 (Fin g × Fin g), ∃ f, e ∈ E(GM01.gridGraph g) → ∃ u v x y, e = s(u, v) + ∧ u ≠ v ∧ x ∈ W u.1 u.2 ∧ y ∈ W v.1 v.2 ∧ G.IsLink f x y := fun e => by + by_cases he : e ∈ E(GM01.gridGraph g) + · induction e with + | _ u v => + have hAdj : (SimpleGraph.pathGraph g □ SimpleGraph.pathGraph g).Adj u v := he + obtain ⟨x, hx, y, hy, f, hf⟩ := hadj u v hAdj + exact ⟨f, fun _ => ⟨u, v, x, y, rfl, hAdj.ne, hx, hy, hf⟩⟩ + · obtain ⟨x₀, -, y₀, -, h₀⟩ := hW.row 0 (by omega) 0 (by omega) + obtain ⟨f₀, -⟩ := link_of_adj h₀ + exact ⟨f₀, fun h => absurd h he⟩ + choose ηe hηe using hch + have hsame : ∀ {u u' : Fin g × Fin g} {x : α}, x ∈ W u.1 u.2 → x ∈ W u'.1 u'.2 → u = u' + := fun {u u' x} h h' => by + by_contra hne + exact disjoint_left.1 (hdisj u u' hne) h h' + have hinc : ∀ {e u v}, e ∈ E(GM01.gridGraph g) → e = s(u, v) → ∀ w, + (GM01.gridGraph g).Inc e w ↔ w = u ∨ w = v := fun {e u v} he heq w => by + constructor + · rintro ⟨z, hz, -⟩ + rcases Sym2.eq_iff.1 (heq.symm.trans hz) with ⟨h, -⟩ | ⟨-, h⟩ + · exact Or.inl h.symm + · exact Or.inr h.symm + · rintro (rfl | rfl) + · exact ⟨v, heq, he⟩ + · exact ⟨u, heq.trans Sym2.eq_swap, he⟩ + refine ⟨ηe, ⟨fun v _ => (hW.conn _ v.1.2 _ v.2.2).1, fun v _ => hW.sub _ v.1.2 _ v.2.2, fun e he + => ?_, fun v₁ _ v₂ _ hne => hdisj v₁ v₂ hne, fun e₁ he₁ e₂ he₂ hee => ?_, fun w _ e he + => ?_, fun w _ e he => ?_, fun v _ => ?_⟩, hηe⟩ + · obtain ⟨_, _, _, _, -, -, -, -, h⟩ := hηe e he + exact h.edge_mem + · obtain ⟨u, v, x, y, rfl, -, hx, hy, h⟩ := hηe e₁ he₁ + obtain ⟨u', v', x', y', rfl, -, hx', hy', h'⟩ := hηe e₂ he₂ + rw [← hee] at h' + rcases h.eq_and_eq_or_eq_and_eq h' with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · rw [hsame hx hx', hsame hy hy'] + · rw [hsame hx hy', hsame hy hx', Sym2.eq_swap] + · obtain ⟨u, v, x, y, heq, -, hx, hy, h⟩ := hηe e he + rw [hinc he heq w] + constructor + · rintro (rfl | rfl) + · exact ⟨x, hx, h.inc_left⟩ + · exact ⟨y, hy, h.inc_right⟩ + · rintro ⟨x', hx', hinc'⟩ + rcases hinc'.eq_or_eq_of_isLink h with rfl | rfl + · exact Or.inl (hsame hx' hx) + · exact Or.inr (hsame hx' hy) + · obtain ⟨u, v, x, y, heq, hne, hx, hy, h⟩ := hηe e he + constructor + · rintro ⟨h₁, h₂⟩ + exfalso + obtain h₃ := Sym2.eq_iff.1 (heq.symm.trans h₁) + rcases h₃ with ⟨rfl, h₄⟩ | ⟨rfl, h₄⟩ + · exact hne h₄.symm + · exact hne h₄.symm + · intro hall + exact absurd ((hsame (hall x h.inc_left) hx).symm.trans (hsame (hall y h.inc_right) hy)) hne + · refine ⟨(G.deleteEdges (ηe '' E(GM01.gridGraph g))).induce (W v.1 v.2), induce_le + (hW.sub _ v.1.2 _ v.2.2), rfl, graphConnected_of_conn (hW.conn _ v.1.2 _ v.2.2) ?_⟩ + rintro _ ⟨e, he, rfl⟩ a b hab ha hb + obtain ⟨u, v', x, y, -, hne, hx, hy, h⟩ := hηe e he + rcases hab.eq_and_eq_or_eq_and_eq h with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hne ((hsame hx ha).trans (hsame hb hy)) + · exact hne ((hsame hx hb).trans (hsame ha hy)) + +/-- The proof of (5.1) (page 339), for a separation `(A, B)` of `𝒯` with `E(A)` containing a row. -/ +theorem no_row {G : Graph α β} {hV : V(G).Finite} {hE : E(G).Finite} {T : Set + (Hypergraph α β × Hypergraph α β)} {θ g : ℕ} {W : ℕ → ℕ → Set α} (hT : IsTangle + (Hypergraph.ofGraph G hV hE) θ T) + (hW : IsGrid (Hypergraph.ofGraph G hV hE) T θ g W) (hg : 2 ≤ g) {ηe : Sym2 (Fin g × Fin g) → β} + (hηe : ∀ e ∈ E(GM01.gridGraph g), ∃ u v x y, e = s(u, v) ∧ u ≠ v ∧ x ∈ W u.1 u.2 + ∧ y ∈ W v.1 v.2 ∧ G.IsLink (ηe e) x y) {A B : Hypergraph α β} (hAB : (A, B) ∈ T) + (hord : separationOrder A B < g) + (i : Fin g) (hrow : ηe '' (GM10.gridRowPath g i).edgeSet ⊆ A.edgeSet) : False := by + classical + have hs := hT.isSeparation hAB + have hmeet : ∀ j, (hj : j < g) → ∃ x ∈ W i j, x ∈ A.vertexSet := fun j hj => by + obtain ⟨j', hj', hd⟩ : ∃ j', ∃ _ : j' < g, j + 1 = j' ∨ j' + 1 = j := by + rcases Nat.lt_or_ge (j + 1) g with h | h + · exact ⟨j + 1, h, Or.inl rfl⟩ + · exact ⟨j - 1, by omega, Or.inr (by omega)⟩ + let u : Fin g × Fin g := (i, ⟨j, hj⟩) + let v : Fin g × Fin g := (i, ⟨j', hj'⟩) + have hadj : (SimpleGraph.pathGraph g □ SimpleGraph.pathGraph g).Adj u v := by + rw [SimpleGraph.boxProd_adj] + exact Or.inr ⟨SimpleGraph.pathGraph_adj.2 (by simpa using hd), rfl⟩ + have he : s(u, v) ∈ E(GM01.gridGraph g) := hadj + have hrow₂ : s(u, v) ∈ (GM10.gridRowPath g i).edgeSet := by + refine ⟨he, ?_⟩ + rintro w ⟨z, hz, -⟩ + rcases Sym2.eq_iff.1 hz with ⟨h, -⟩ | ⟨-, h⟩ + · rw [← h] + · rw [← h] + have hfA : ηe s(u, v) ∈ A.edgeSet := hrow (mem_image_of_mem _ hrow₂) + obtain ⟨u', v', x, y, heq, -, hx, hy, h⟩ := hηe _ he + have hmem : ∀ {t}, G.Inc (ηe s(u, v)) t → t ∈ A.vertexSet := fun {t} ht => + A.vertex_mem_of_inc ((inc_iff_of_le hs.left_le hfA).2 ht) + rcases Sym2.eq_iff.1 heq with ⟨h₁, -⟩ | ⟨h₁, -⟩ + · subst h₁ + exact ⟨x, hx, hmem h.inc_left⟩ + · subst h₁ + exact ⟨y, hy, hmem h.inc_right⟩ + have hcol : ∀ j < g, ∀ r, r < g → Conn (Hypergraph.ofGraph G hV hE) {v | ∃ a ≤ r, v ∈ W a j} + := fun j hj r => by + induction r with + | zero => + intro _ + have : {v | ∃ a ≤ 0, v ∈ W a j} = W 0 j := by + ext v + constructor + · rintro ⟨a, ha, hv⟩ + obtain rfl : a = 0 := by omega + exact hv + · exact fun h => ⟨0, le_rfl, h⟩ + rw [this] + exact hW.conn 0 (by omega) j hj + | succ r ih => + intro hr + obtain ⟨x, hx, y, hy, hxy⟩ := hW.col r hr j hj + have h₁ := (ih (by omega)).union_adj (hW.conn (r + 1) hr j hj) ⟨r, le_rfl, hx⟩ hy hxy + have : {v | ∃ a ≤ r + 1, v ∈ W a j} = {v | ∃ a ≤ r, v ∈ W a j} ∪ W (r + 1) j := by + ext v + constructor + · rintro ⟨a, ha, hv⟩ + rcases Nat.lt_or_ge r a with h | h + · obtain rfl : a = r + 1 := by omega + exact Or.inr hv + · exact Or.inl ⟨a, h, hv⟩ + · rintro (⟨a, ha, hv⟩ | h) + · exact ⟨a, by omega, hv⟩ + · exact ⟨r + 1, le_rfl, h⟩ + rw [this] + exact h₁ + let C : ℕ → Set α := fun j => {v | ∃ a < g, v ∈ W a j} + have hCc : ∀ j < g, Conn (Hypergraph.ofGraph G hV hE) (C j) := fun j hj => by + have h₁ := hcol j hj (g - 1) (by omega) + have : {v | ∃ a ≤ g - 1, v ∈ W a j} = C j := by + ext v + constructor + · rintro ⟨a, ha, hv⟩ + exact ⟨a, by omega, hv⟩ + · rintro ⟨a, ha, hv⟩ + exact ⟨a, by omega, hv⟩ + rw [this] at h₁ + exact h₁ + have hCd : ∀ j ∈ Finset.range g, ∀ j' ∈ Finset.range g, j ≠ j' → Disjoint (C j) (C j') + := fun j hj j' hj' hne => disjoint_left.2 fun v hv hv' => by + obtain ⟨a, ha, h₁⟩ := hv + obtain ⟨a', ha', h₂⟩ := hv' + exact disjoint_left.1 (hW.disj a ha j (Finset.mem_range.1 hj) a' ha' j' + (Finset.mem_range.1 hj') fun e => hne (Prod.ext_iff.1 e).2) h₁ h₂ + obtain ⟨j, hj, hd⟩ := + exists_avoid (Finset.range g) C hCd (A ∩ B).vertexSet_finite (by rwa [Finset.card_range]) + have hj' := Finset.mem_range.1 hj + obtain ⟨x, hx, hxA⟩ := hmeet j hj' + have hCA : C j ⊆ A.vertexSet := fun b hb => by + by_contra hbA + obtain ⟨a, ha, hba⟩ := hb + have hbB : b ∈ B.vertexSet := (mem_V_or hs (hW.sub a ha j hj' hba)).resolve_left hbA + obtain ⟨v, hv, hvS⟩ := (hCc j hj').meets_sep hs ⟨i, i.2, hx⟩ ⟨a, ha, hba⟩ hxA hbB + exact disjoint_left.1 hd hv hvS + have h₁ := hW.rank j hj' + have heq : (⋃ a ∈ {a | a < g}, W a j) = C j := by + ext v + simp [C] + rw [heq] at h₁ + have h₂ := tangleRank_le_separationOrder (θ := θ) hAB hCA + omega + +/-- (2.3) of Robertson, Seymour and Thomas, *Quickly excluding a planar graph* (page 327), in the +form XVI cites. -/ +theorem rst94_theorem_2_3 : GM16.RST94Theorem23Statement := by + intro θ _ + refine ⟨20 ^ ((2 * θ + 1) ^ 4 * (2 * (2 * θ + 1) - 1)), Nat.pos_of_ne_zero (by positivity), + fun {α β} G θ_G T hT hle => ?_⟩ + obtain ⟨W, hW⟩ := theorem_5_7 (GM16.isGraph_ofGraph G hT.finite_V hT.finite_E) hT.isTangle (g + := 2 * θ + 1) (by omega) hle + obtain ⟨ηe, hm, hp⟩ := grid_model hW (by omega) + exact ⟨_, ηe, hm, fun A B hAB hord i hrow => no_row hT.isTangle hW (by omega) hp hAB + (by omega) i hrow⟩ + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/RST94/Trees.lean b/LeanPool/GraphMinor/RST94/Trees.lean new file mode 100644 index 0000000000..16e8b77346 --- /dev/null +++ b/LeanPool/GraphMinor/RST94/Trees.lean @@ -0,0 +1,471 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Combinatorics.SimpleGraph.Acyclic +public import Mathlib.Combinatorics.SimpleGraph.DegreeSum +public import Mathlib.Combinatorics.SimpleGraph.Metric +public import Mathlib.Data.Set.Card + +/-! +# Trees, for (5.4) of "Quickly excluding a planar graph" + +The two facts about trees in the proof of (5.4) (page 342). A tree with `r` leaves and many vertices +has `2g + 1` consecutive vertices of valency 2 (`exists_long_run`). Adding an edge at the middle of +such a run gives a spanning tree with more leaves (`exists_more_leaves`). +-/ + +@[expose] public section + +namespace GraphMinor.RST94 + +open Set + +variable {ι : Type*} {S : SimpleGraph ι} + +/-- The extended valency of a vertex. -/ +noncomputable def deg (S : SimpleGraph ι) (v : ι) : ℕ∞ := (S.neighborSet v).encard + +/-- On a finite neighbor set, extended valency agrees with Mathlib's natural valency. -/ +theorem deg_eq_degree (S : SimpleGraph ι) (v : ι) [Fintype (S.neighborSet v)] : + deg S v = S.degree v := by + rw [deg, ← S.card_neighborSet_eq_degree, ← Nat.card_eq_fintype_card, Nat.card_coe_set_eq, + Set.coe_ncard_eq_encard] + +/-- The leaves of a graph: vertices of valency 1 (page 341). -/ +def leaves (S : SimpleGraph ι) : Set ι := {v | deg S v = 1} + +/-- The two neighbours of a vertex of valency 2. -/ +theorem neighborSet_eq {x y z : ι} (h : deg S x = 2) (hy : S.Adj x y) (hz : S.Adj x z) + (hne : y ≠ z) : S.neighborSet x = {y, z} := by + refine (((finite_singleton z).insert y).eq_of_subset_of_encard_le ?_ ?_).symm + · rintro w (rfl | rfl) + · exact hy + · exact hz + · rw [encard_pair hne] + exact h.le + +/-- A vertex closer to the root has only one neighbour closer to the root. -/ +theorem closer_unique (hS : S.IsTree) {ρ v w w' : ι} (h : S.Adj w v) (h' : S.Adj w' v) + (hd : S.dist ρ w + 1 = S.dist ρ v) (hd' : S.dist ρ w' + 1 = S.dist ρ v) : w = w' := by + classical + have key : ∀ {w : ι} (h : S.Adj w v), S.dist ρ w + 1 = S.dist ρ v → ∃ q : S.Walk ρ w, + (q.concat h).IsPath := fun {w} h hd => by + obtain ⟨q, hq, hl⟩ := hS.connected.exists_path_of_dist ρ w + refine ⟨q, hq.concat ?_ h⟩ + intro hv + have h₁ : S.dist ρ v ≤ (q.takeUntil v hv).length := SimpleGraph.dist_le _ + have h₂ := q.length_takeUntil_le_length hv + omega + obtain ⟨q, hq⟩ := key h hd + obtain ⟨q', hq'⟩ := key h' hd' + have he := (hS.existsUnique_path ρ v).unique hq hq' + exact (SimpleGraph.Walk.concat_inj he).1 + +/-- Valency is at least 1 in a tree with at least two vertices. -/ +theorem one_le_deg [Nontrivial ι] (hS : S.IsTree) (v : ι) : 1 ≤ deg S v := by + obtain ⟨w, hw⟩ := exists_ne v + obtain ⟨q⟩ := hS.connected v w + cases q with + | nil => exact absurd rfl hw + | cons h _ => exact one_le_encard_iff_nonempty.2 ⟨_, h⟩ + +/-- The count of vertices of valency other than 2. -/ +theorem card_not_two_add_two [Finite ι] [Nontrivial ι] (hS : S.IsTree) : + (leaves S).ncard * 2 ≥ {v | deg S v ≠ 2}.ncard + 2 := by + classical + let := Fintype.ofFinite ι + have hsum : ∑ v, S.degree v + 2 = 2 * Fintype.card ι := by + have h₁ := S.sum_degrees_eq_twice_card_edges + have h₂ := hS.card_edgeFinset + omega + have hL : (leaves S).ncard = ∑ v, if deg S v = 1 then 1 else 0 := by + rw [← Finset.card_filter, ← ncard_coe_finset] + congr 1 + ext v + simp [leaves] + have hB : {v | deg S v ≠ 2}.ncard = ∑ v, if deg S v ≠ 2 then 1 else 0 := by + rw [← Finset.card_filter, ← ncard_coe_finset] + congr 1 + ext v + simp + have hH (v : ι) : + (if deg S v ≠ 2 then 1 else 0) + 2 ≤ S.degree v + 2 * (if deg S v = 1 then 1 else 0) := by + have hpos := one_le_deg hS v + rw [deg_eq_degree] at hpos + have hpos' : 1 ≤ S.degree v := ENat.natCast_le_natCast.mp hpos + have h₁ : deg S v = 1 ↔ S.degree v = 1 := by + rw [deg_eq_degree] + exact ENat.natCast_inj (b := 1) + have h₂ : deg S v = 2 ↔ S.degree v = 2 := by + rw [deg_eq_degree] + exact ENat.natCast_inj (b := 2) + by_cases htwo : S.degree v = 2 + · have hne₁ : deg S v ≠ 1 := fun h => by have := h₁.mp h; omega + rw [ite_eq_right (fun h => h (h₂.mpr htwo)), ite_eq_right hne₁] + omega + · rw [ite_eq_left (fun h => htwo (h₂.mp h))] + by_cases hone : S.degree v = 1 + · rw [ite_eq_left (h₁.mpr hone), hone] + · rw [ite_eq_right (fun h => hone (h₁.mp h))] + omega + have h₃ := Finset.sum_le_sum fun v (_ : v ∈ Finset.univ) => hH v + rw [Finset.sum_add_distrib, Finset.sum_add_distrib, ← Finset.mul_sum] at h₃ + simp only [Finset.sum_const, Finset.card_univ, smul_eq_mul] at h₃ + rw [← hL, ← hB] at h₃ + omega + +/-- **The first fact in the proof of (5.4)** (page 342): a tree with few leaves has `2g + 1` +consecutive vertices of valency 2. -/ +theorem exists_long_run [Fintype ι] [Nontrivial ι] (hS : S.IsTree) {g : ℕ} (hn : (2 * g + 1) * (2 * + (leaves S).ncard - 3) + 1 < Fintype.card ι) : + ∃ c : ℕ → ι, (∀ a b, a ≤ 2 * g → b ≤ 2 * g → c a = c b → a = b) ∧ (∀ a, a < 2 * g → S.Adj (c a) + (c (a + 1))) ∧ ∀ a, a ≤ 2 * g → deg S (c a) = 2 := by + classical + have hcount := card_not_two_add_two hS + obtain ⟨ρ, hρ⟩ : ∃ ρ, deg S ρ = 1 := by + obtain ⟨v, hv⟩ := hS.exists_vert_degree_one_of_nontrivial + refine ⟨v, ?_⟩ + simp [deg_eq_degree, hv] + have hpar : ∀ v, ∃ w, v ≠ ρ → S.Adj v w ∧ S.dist ρ w + 1 = S.dist ρ v := fun v => by + by_cases hv : v = ρ + · exact ⟨v, fun h => absurd hv h⟩ + obtain ⟨q, hq⟩ := hS.connected.exists_walk_length_eq_dist v ρ + cases q with + | nil => exact absurd rfl hv + | @cons _ w _ h q => + refine ⟨w, fun _ => ⟨h, ?_⟩⟩ + have h₁ : S.dist w ρ ≤ q.length := SimpleGraph.dist_le q + rw [SimpleGraph.Walk.length_cons] at hq + rw [SimpleGraph.dist_comm (u := ρ) (v := w), SimpleGraph.dist_comm (u := ρ) (v := v), ← hq] + have h₂ := hS.dist_eq_dist_add_one_of_adj ρ h + rw [SimpleGraph.dist_comm (u := ρ) (v := w), SimpleGraph.dist_comm (u := ρ) (v := v)] at h₂ + omega + choose p hp using hpar + have hρd : S.dist ρ ρ = 0 := SimpleGraph.dist_self + have hdown : ∀ {v w}, S.Adj v w → S.dist ρ w = S.dist ρ v + 1 → p w = v := fun {v w} h hd => by + have hw : w ≠ ρ := fun e => by + rw [e] at hd + omega + obtain ⟨h₁, h₂⟩ := hp w hw + exact closer_unique hS h₁.symm h h₂ hd.symm + have hne : ∀ {v}, deg S v = 2 → v ≠ ρ := fun {v} h e => by + rw [e, hρ] at h + exact (by decide : (1 : ℕ∞) ≠ 2) h + obtain ⟨N, hN⟩ : ∃ N, ∀ v, S.dist ρ v ≤ N := ⟨Finset.univ.sup fun v => S.dist ρ v, fun v + => Finset.le_sup (Finset.mem_univ v)⟩ + have hchild : ∀ {v}, deg S v = 2 → ∃ w, S.Adj v w ∧ S.dist ρ w = S.dist ρ v + 1 := fun {v} hv + => by + obtain ⟨h₁, h₂⟩ := hp v (hne hv) + obtain ⟨w, hw, hwn⟩ := exists_ne_of_one_lt_encard (s := S.neighborSet v) (by + change 1 < deg S v + rw [hv] + decide) (p v) + refine ⟨w, hw, (hS.dist_eq_dist_add_one_of_adj ρ hw).resolve_left fun h₃ => hwn ?_⟩ + exact closer_unique hS hw.symm h₁.symm h₃.symm h₂ + have hcover : ∀ k v, N - S.dist ρ v ≤ k → deg S v = 2 → ∃ b e, deg S b ≠ 2 ∧ b ≠ ρ ∧ 1 ≤ e + ∧ p^[e] b = v ∧ ∀ e', 1 ≤ e' → e' ≤ e → deg S (p^[e'] b) = 2 := by + intro k + induction k with + | zero => + intro v hk hv + obtain ⟨w, -, hd⟩ := hchild hv + have := hN w + omega + | succ k ih => + intro v hk hv + obtain ⟨w, hw, hd⟩ := hchild hv + have hpw := hdown hw hd + by_cases hw2 : deg S w = 2 + · obtain ⟨b, e, h₁, h₂, h₃, h₄, h₅⟩ := ih w (by have := hN w; omega) hw2 + refine ⟨b, e + 1, h₁, h₂, by omega, by rw [Function.iterate_succ_apply', h₄, hpw], fun e' + h₆ h₇ => ?_⟩ + rcases Nat.lt_or_ge e e' with h₈ | h₈ + · obtain rfl : e' = e + 1 := by omega + rw [Function.iterate_succ_apply', h₄, hpw] + exact hv + · exact h₅ e' h₆ h₈ + · refine ⟨w, 1, hw2, fun e => ?_, le_rfl, hpw, fun e' h₆ h₇ => ?_⟩ + · rw [e] at hd + omega + · obtain rfl : e' = 1 := by omega + rw [Function.iterate_one, hpw] + exact hv + by_cases hrun : ∃ b, deg S b ≠ 2 ∧ b ≠ ρ ∧ ∀ e', 1 ≤ e' → e' ≤ 2 * g + 1 → deg S (p^[e'] b) = 2 + · obtain ⟨b, -, hb, hdeg⟩ := hrun + have hdist : ∀ e, e ≤ 2 * g + 1 → S.dist ρ (p^[e] b) + e = S.dist ρ b := by + intro e + induction e with + | zero => exact fun _ => rfl + | succ e ih => + intro he + have hx : p^[e] b ≠ ρ := by + rcases Nat.eq_zero_or_pos e with rfl | h₁ + · exact hb + · exact hne (hdeg e h₁ (by omega)) + have := (hp _ hx).2 + rw [Function.iterate_succ_apply'] + have := ih (by omega) + omega + refine ⟨fun a => p^[a + 1] b, fun x y hx hy he => ?_, fun a ha => ?_, fun a ha => hdeg _ + (by omega) (by omega)⟩ + · have h₁ := hdist (x + 1) (by omega) + have h₂ := hdist (y + 1) (by omega) + simp only at he + rw [he] at h₁ + omega + · have := (hp _ (hne (hdeg (a + 1) (by omega) (by omega)))).1 + simp only + rw [Function.iterate_succ_apply' p (a + 1)] + exact this + · exfalso + let Bf : Finset ι := Finset.univ.filter fun v => deg S v ≠ 2 + let Df : Finset ι := Finset.univ.filter fun v => ¬ deg S v ≠ 2 + have hBf : {v | deg S v ≠ 2}.ncard = Bf.card := by + rw [← ncard_coe_finset] + congr 1 + ext v + simp [Bf] + have hρB : ρ ∈ Bf := by simp [Bf, hρ] + have hsum : Bf.card + Df.card = Fintype.card ι := Finset.card_filter_add_card_filter_not _ + have hsub : Df ⊆ ((Bf.erase ρ) ×ˢ Finset.Icc 1 (2 * g)).image fun q => p^[q.2] q.1 := by + intro v hv + have hv2 : deg S v = 2 := by simpa [Df] using hv + obtain ⟨b, e, h₁, h₂, h₃, h₄, h₅⟩ := hcover _ v le_rfl hv2 + have he : e ≤ 2 * g := by + by_contra hlt + exact hrun ⟨b, h₁, h₂, fun e' h₆ h₇ => h₅ e' h₆ (by omega)⟩ + refine Finset.mem_image.2 ⟨(b, e), ?_, h₄⟩ + simp [Bf, h₁, h₂, h₃, he] + have hD := (Finset.card_le_card hsub).trans Finset.card_image_le + rw [Finset.card_product, Finset.card_erase_of_mem hρB, Nat.card_Icc] at hD + have hpos : 1 ≤ Bf.card := Finset.card_pos.2 ⟨ρ, hρB⟩ + rw [hBf] at hcount + generalize (leaves S).ncard = L at hcount hn + obtain ⟨u, hu⟩ : ∃ u, Bf.card = u + 1 := ⟨Bf.card - 1, by omega⟩ + rw [hu] at hD hcount hsum + simp only [Nat.add_sub_cancel] at hD + have h₁ : (2 * g + 1) * u ≤ (2 * g + 1) * (2 * L - 3) := Nat.mul_le_mul_left _ (by omega) + have h₂ : (2 * g + 1) * u = u * (2 * g) + u := by rw [Nat.add_mul, Nat.one_mul, Nat.mul_comm] + omega + +/-- The core of the second fact: the path from `a₀` to `t` goes through `u`, then `v`. Delete the +edge `uv` and add `a₀t`. -/ +theorem exists_more_leaves_side [Finite ι] (hS : S.IsTree) {a₀ u v t : ι} (h₁ : S.Adj a₀ u) + (h₂ : S.Adj u v) (hva : v ≠ a₀) (hd₀ : deg S a₀ = 2) (hdu : deg S u = 2) + (hdv : deg S v = 2) (π : S.Walk v t) (hπ : u ∉ π.support) (hta : t ≠ a₀) (htu : t ≠ u) + (hnot : ¬ S.Adj a₀ t) : + ∃ S' : SimpleGraph ι, S'.IsTree ∧ (∀ x y, S'.Adj x y → S.Adj x y ∨ s(x, y) = s(a₀, t)) ∧ + (leaves S).ncard + 1 ≤ (leaves S').ncard := by + classical + let := Fintype.ofFinite ι + have hua : u ≠ a₀ := h₁.ne.symm + have huv : u ≠ v := h₂.ne + let S' : SimpleGraph ι := + { Adj := fun x y => (S.Adj x y ∧ s(x, y) ≠ s(u, v)) ∨ s(x, y) = s(a₀, t) + symm := ⟨fun x y h => by + rcases h with ⟨h, h'⟩ | h + · exact Or.inl ⟨h.symm, by rwa [Sym2.eq_swap]⟩ + · exact Or.inr (by rwa [Sym2.eq_swap])⟩ + loopless := ⟨fun x h => by + rcases h with ⟨h, -⟩ | h + · exact h.ne rfl + · have h₃ : x = a₀ ∧ x = t := by simpa [eq_comm] using h + exact hta (h₃.2.symm.trans h₃.1)⟩ } + have hS' : ∀ x y, S'.Adj x y ↔ (S.Adj x y ∧ s(x, y) ≠ s(u, v)) ∨ s(x, y) = s(a₀, t) := fun _ _ + => Iff.rfl + have hwalk : ∀ {x y} (w : S.Walk x y), u ∉ w.support → S'.Reachable x y := fun {x y} w => by + induction w with + | nil => exact fun _ => SimpleGraph.Reachable.refl _ + | @cons x y z h q ih => + intro hu + have hq : u ∉ q.support := fun h' => hu (by simp [h']) + have hx : x ≠ u := fun e => hu (by simp [e]) + have hy : y ≠ u := fun e => hq (e ▸ q.start_mem_support) + refine SimpleGraph.Adj.reachable (Or.inl ⟨h, fun e => ?_⟩) |>.trans (ih hq) + rcases Sym2.eq_iff.1 e with ⟨h₃, -⟩ | ⟨-, h₃⟩ + · exact hx h₃ + · exact hy h₃ + have hR : S'.Reachable u v := by + have h₃ : S'.Adj u a₀ := Or.inl ⟨h₁.symm, fun e => by + rcases Sym2.eq_iff.1 e with ⟨-, h₄⟩ | ⟨h₄, -⟩ + · exact hva h₄.symm + · exact huv h₄⟩ + have h₄ : S'.Adj a₀ t := Or.inr rfl + exact h₃.reachable.trans (h₄.reachable.trans (hwalk π hπ).symm) + have hconn : S'.Connected := by + have := hS.connected.nonempty + refine ⟨fun x y => ?_⟩ + obtain ⟨w⟩ := hS.connected x y + induction w with + | nil => exact SimpleGraph.Reachable.refl _ + | @cons x y z h q ih => + refine SimpleGraph.Reachable.trans ?_ ih + by_cases he : s(x, y) = s(u, v) + · rcases Sym2.eq_iff.1 he with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact hR + · exact hR.symm + · exact SimpleGraph.Adj.reachable (Or.inl ⟨h, he⟩) + have hedge : S'.edgeSet = (S.edgeSet \ {s(u, v)}) ∪ {s(a₀, t)} := by + ext e + induction e with + | _ x y => + simp only [SimpleGraph.mem_edgeSet, mem_union, mem_sdiff, mem_singleton_iff, hS'] + have htree : S'.IsTree := by + refine SimpleGraph.isTree_iff_connected_and_card.2 ⟨hconn, ?_⟩ + have h₃ := SimpleGraph.isTree_iff_connected_and_card.1 hS |>.2 + rw [Nat.card_coe_set_eq] at h₃ ⊢ + rw [hedge, ncard_union_eq _ (toFinite _) (toFinite _), ncard_singleton, + ncard_sdiff_singleton_of_mem (show s(u, v) ∈ S.edgeSet from h₂)] + · have : 1 ≤ S.edgeSet.ncard := (ncard_pos (toFinite _)).2 ⟨_, show s(u, v) ∈ S.edgeSet from h₂⟩ + omega + · rw [disjoint_singleton_right] + exact fun h => hnot h.1 + refine ⟨S', htree, fun x y h => ?_, ?_⟩ + · rcases h with ⟨h, -⟩ | h + · exact Or.inl h + · exact Or.inr h + have hsame : ∀ w, w ≠ a₀ → w ≠ t → w ≠ u → w ≠ v → deg S' w = deg S w := fun w h₃ h₄ h₅ h₆ => by + have : S'.neighborSet w = S.neighborSet w := by + ext x + simp only [SimpleGraph.mem_neighborSet, hS'] + constructor + · rintro (⟨h, -⟩ | h) + · exact h + · rcases Sym2.eq_iff.1 h with ⟨h₇, -⟩ | ⟨h₇, -⟩ + · exact absurd h₇ h₃ + · exact absurd h₇ h₄ + · refine fun h => Or.inl ⟨h, fun e => ?_⟩ + rcases Sym2.eq_iff.1 e with ⟨h₇, -⟩ | ⟨h₇, -⟩ + · exact h₅ h₇ + · exact h₆ h₇ + rw [deg, deg, this] + have hdeg_u : deg S' u = 1 := by + have h₃ := neighborSet_eq hdu h₁.symm h₂ hva.symm + have : S'.neighborSet u = {a₀} := by + ext x + simp only [SimpleGraph.mem_neighborSet, hS', mem_singleton_iff] + constructor + · rintro (⟨h, h'⟩ | h) + · have hx : x ∈ S.neighborSet u := h + rw [h₃] at hx + rcases hx with rfl | rfl + · rfl + · exact absurd rfl h' + · rcases Sym2.eq_iff.1 h with ⟨h₇, -⟩ | ⟨h₇, -⟩ + · exact absurd h₇ hua + · exact absurd h₇.symm htu + · rintro rfl + refine Or.inl ⟨h₁.symm, fun e => ?_⟩ + rcases Sym2.eq_iff.1 e with ⟨-, h₄⟩ | ⟨h₄, -⟩ + · exact hva h₄.symm + · exact huv h₄ + rw [deg, this, encard_singleton] + have hLf : (leaves S).Finite := toFinite _ + have hnl : ∀ {w}, deg S w = 2 → w ∉ leaves S := fun {w} h h' => by + exact (by decide : (2 : ℕ∞) ≠ 1) (h.symm.trans h') + by_cases htv : t = v + · have hsub : insert u (leaves S) ⊆ leaves S' := by + rintro w (rfl | hw) + · exact hdeg_u + · have hw' : deg S w = 1 := hw + have := hsame w (fun e => hnl (e ▸ hd₀) hw) (fun e => hnl (e ▸ htv ▸ hdv) hw) (fun e => hnl + (e ▸ hdu) hw) (fun e => hnl (e ▸ hdv) hw) + exact this.trans hw' + have h₃ := ncard_le_ncard hsub (toFinite _) + rw [ncard_insert_of_notMem (hnl hdu) hLf] at h₃ + exact h₃ + · have hdeg_v : deg S' v = 1 := by + have : S'.neighborSet v = S.neighborSet v \ {u} := by + ext x + simp only [SimpleGraph.mem_neighborSet, hS', mem_sdiff, mem_singleton_iff] + constructor + · rintro (⟨h, h'⟩ | h) + · refine ⟨h, ?_⟩ + rintro rfl + exact h' Sym2.eq_swap + · rcases Sym2.eq_iff.1 h with ⟨h₇, -⟩ | ⟨h₇, -⟩ + · exact absurd h₇ hva + · exact absurd h₇.symm htv + · rintro ⟨h, h'⟩ + refine Or.inl ⟨h, fun e => ?_⟩ + rcases Sym2.eq_iff.1 e with ⟨-, h₄⟩ | ⟨-, h₄⟩ + · exact h.ne h₄.symm + · exact h' h₄ + have hcard := encard_sdiff_singleton_add_one (show u ∈ S.neighborSet v from h₂.symm) + change (S.neighborSet v \ {u}).encard + 1 = deg S v at hcard + rw [hdv] at hcard + rw [deg, this] + exact (ENat.addLECancellable_of_ne_top ENat.one_ne_top).inj_left.mp hcard + have hsub : insert u (insert v (leaves S \ {t})) ⊆ leaves S' := by + rintro w (rfl | rfl | ⟨hw, hwt⟩) + · exact hdeg_u + · exact hdeg_v + · have hw' : deg S w = 1 := hw + have := hsame w (fun e => hnl (e ▸ hd₀) hw) hwt (fun e => hnl (e ▸ hdu) hw) (fun e => hnl + (e ▸ hdv) hw) + exact this.trans hw' + have h₃ := ncard_le_ncard hsub (toFinite _) + have hv : v ∉ leaves S \ {t} := fun h => hnl hdv h.1 + have hu : u ∉ insert v (leaves S \ {t}) := by + rintro (h | h) + · exact huv h + · exact hnl hdu h.1 + rw [ncard_insert_of_notMem hu (hLf.sdiff.insert _), ncard_insert_of_notMem hv hLf.sdiff] at h₃ + have h₄ := pred_ncard_le_ncard_sdiff_singleton (leaves S) t + omega + +/-- **The second fact in the proof of (5.4)** (page 342): adding an edge at the middle of five +consecutive vertices of valency 2 gives a spanning tree with more leaves. -/ +theorem exists_more_leaves [Finite ι] (hS : S.IsTree) {a₂ a₁ a₀ b₁ b₂ t : ι} (h₁ : S.Adj a₂ a₁) + (h₂ : S.Adj a₁ a₀) (h₃ : S.Adj a₀ b₁) (h₄ : S.Adj b₁ b₂) (hd₁ : deg S a₂ = 2) (hd₂ : deg S a₁ + = 2) (hd₃ : deg S a₀ = 2) + (hd₄ : deg S b₁ = 2) (hd₅ : deg S b₂ = 2) (hab : a₁ ≠ b₁) (ha : a₂ ≠ a₀) (hb : b₂ ≠ a₀) + (ht₁ : t ≠ a₁) (ht₂ : t ≠ a₀) (ht₃ : t ≠ b₁) : + ∃ S' : SimpleGraph ι, S'.IsTree ∧ (∀ x y, S'.Adj x y → S.Adj x y ∨ s(x, y) = s(a₀, t)) ∧ + (leaves S).ncard + 1 ≤ (leaves S').ncard := by + classical + let := Fintype.ofFinite ι + have hN₀ := neighborSet_eq hd₃ h₂.symm h₃ hab + have hnot : ¬ S.Adj a₀ t := fun h => by + have hm : t ∈ S.neighborSet a₀ := h + rw [hN₀] at hm + rcases hm with h' | h' + · exact ht₁ h' + · exact ht₃ h' + have side : ∀ {u v : ι} (_ : S.Adj a₀ u) (_ : S.Adj u v) (_ : v ≠ a₀) (_ : deg S u = 2) + (_ : deg S v = 2) (_ : t ≠ u) (q : S.Walk u t), q.IsPath → a₀ ∉ q.support → + ∃ S' : SimpleGraph ι, S'.IsTree ∧ (∀ x y, S'.Adj x y → S.Adj x y ∨ s(x, y) = s(a₀, t)) ∧ + (leaves S).ncard + 1 ≤ (leaves S').ncard := by + intro u v hu huv hv hdu hdv htu q hq hq₂ + cases q with + | nil => exact absurd rfl htu + | @cons _ w _ h' q' => + have hw : w = v := by + have hm : w ∈ S.neighborSet u := h' + rw [neighborSet_eq hdu hu.symm huv hv.symm] at hm + rcases hm with rfl | hm + · exact absurd (by simp) hq₂ + · exact hm + subst hw + refine exists_more_leaves_side hS hu huv hv hd₃ hdu hdv q' ?_ ht₂ htu hnot + exact ((SimpleGraph.Walk.cons_isPath_iff _ _).1 hq).2 + obtain ⟨π, hπ⟩ := hS.connected.exists_isPath a₀ t + cases π with + | nil => exact absurd rfl ht₂ + | @cons _ w _ h' q => + have hm : w ∈ S.neighborSet a₀ := h' + have hq₁ := (SimpleGraph.Walk.cons_isPath_iff _ _).1 hπ + rw [hN₀] at hm + rcases hm with rfl | hm + · exact side h₂.symm h₁.symm ha hd₂ hd₁ ht₁ q hq₁.1 hq₁.2 + · obtain rfl : w = b₁ := hm + exact side h₃ h₄ hb hd₄ hd₅ ht₃ q hq₁.1 hq₁.2 + +end GraphMinor.RST94 diff --git a/LeanPool/GraphMinor/Statement.lean b/LeanPool/GraphMinor/Statement.lean new file mode 100644 index 0000000000..04d0600614 --- /dev/null +++ b/LeanPool/GraphMinor/Statement.lean @@ -0,0 +1,87 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Combinatorics.Graph.Delete +public import Mathlib.Combinatorics.Graph.Maps + +/-! +# The graph minor theorem: the statement + +This file defines the relation "is isomorphic to a minor of" that appears in the graph minor +theorem. Robertson and Seymour state the theorem as a conjecture of Wagner in + +> N. Robertson and P. D. Seymour, *Graph Minors. IV. Tree-width and well-quasi-ordering*, +> J. Combin. Theory Ser. B **48** (1990), 227–254, + +> **(1.1) Conjecture.** If `G₁, G₂, …` is any countable sequence of graphs then there exist +> `j > i ≥ 1` such that `Gᵢ` is isomorphic to a minor of `Gⱼ`. + +and they prove it in + +> N. Robertson and P. D. Seymour, *Graph Minors. XX. Wagner's conjecture*, J. Combin. Theory +> Ser. B **92** (2004), 325–357. + +The definitions follow Section 1 of Graph Minors IV (page 227): "By a 'graph' we shall mean ... a +finite, undirected graph which may have loops and multiple edges. A graph is a *minor* of another +if the first can be obtained from a subgraph of the second by edge-contraction." + +* A graph is Mathlib's multigraph `Graph α β`, with vertex set `V(G) : Set α` and edge set + `E(G) : Set β`. Each edge has one or two ends, so loops and multiple edges are allowed. The + theorem assumes that `V(G)` and `E(G)` are finite. +* A subgraph is Mathlib's subgraph order `G' ≤ G`: `V(G') ⊆ V(G)`, and each edge of `G'` is an edge + of `G` with the same ends. +* `GraphMinor.contract G C` is the graph obtained from `G` by contracting the edges in `C`. Its + vertices are the vertex sets of the components of the graph with vertex set `V(G)` and edge set + `C`. Its edges are the edges of `G` not in `C`, each with the components of its ends as ends. + Contracting the edges of `C` one at a time gives the same graph, up to isomorphism. +* `GraphMinor.Iso H G` is an isomorphism: a bijection between the vertex sets and a bijection + between the edge sets that preserve the ends of every edge. +* `GraphMinor.IsIsoMinor H G` says that `H` is isomorphic to a minor of `G`: there are a subgraph + `G'` of `G` and a set `C` of edges of `G'` with `H` isomorphic to `contract G' C`. + +The theorem is available as `GraphMinor.graph_minor_theorem` from `LeanPool.GraphMinor`. +-/ + +@[expose] public section + +namespace GraphMinor + +open Graph + +variable {α β α' β' : Type*} + +/-- The graph obtained from `G` by contracting the edges in `C`. + +A vertex `v` of `G` becomes the set of vertices that `v` can reach in `G` along edges in `C`, that +is, the vertex set of the component containing `v` of the graph with vertex set `V(G)` and edge set +`C`. The edges are those of `G` that are not in `C`. An edge of `G` with ends `x` and `y` gets the +components of `x` and `y` as ends, so it becomes a loop if `x` and `y` are in the same component. +-/ +def contract (G : Graph α β) (C : Set β) : Graph (Set α) β := + (G.map fun v ↦ {w | Relation.ReflTransGen (fun x y ↦ ∃ e ∈ C, G.IsLink e x y) v w}).deleteEdges C + +/-- An isomorphism from `H` to `G`: a bijection between the vertex sets and a bijection between +the edge sets such that an edge `e` of `H` has ends `x` and `y` exactly when the edge of `G` that +corresponds to `e` has as ends the vertices that correspond to `x` and `y`. -/ +structure Iso (H : Graph α' β') (G : Graph α β) where + /-- The bijection between the vertex sets. -/ + vertexEquiv : V(H) ≃ V(G) + /-- The bijection between the edge sets. -/ + edgeEquiv : E(H) ≃ E(G) + /-- The bijections preserve the ends of every edge. -/ + isLink_iff (e : E(H)) (x y : V(H)) : + H.IsLink e x y ↔ G.IsLink (edgeEquiv e) (vertexEquiv x) (vertexEquiv y) + +/-- `H` is isomorphic to a minor of `G`: there are a subgraph `G'` of `G` and a set `C` of edges of +`G'` such that `H` is isomorphic to the graph obtained from `G'` by contracting the edges in `C`. -/ +def IsIsoMinor (H : Graph α' β') (G : Graph α β) : Prop := + ∃ G' ≤ G, ∃ C ⊆ E(G'), Nonempty (Iso H (contract G' C)) + +end GraphMinor diff --git a/LeanPool/GraphMinor/Surface/AddCrosscap.lean b/LeanPool/GraphMinor/Surface/AddCrosscap.lean new file mode 100644 index 0000000000..6942bc86af --- /dev/null +++ b/LeanPool/GraphMinor/Surface/AddCrosscap.lean @@ -0,0 +1,324 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.HoleDisc +public import LeanPool.GraphMinor.Surface.Mobius + +/-! +# Euler genus after adding a crosscap + +We have a closed connected surface `S` with an open disc `Λ`, and a closed connected surface `S'` +that is the union of a copy `S₁` of `S` minus `Λ` and a Möbius band `S₂` that meet exactly along the +boundary of each. Nothing else is given: we do not know at the start that `S₁` is a surface, nor +that the closure of `Λ` is a closed disc. + +We show that `S₁` is a surface (`piece_surface`), and so that the frontier of `Λ` is an `O`-arc. +Then the closure of `Λ` is a closed disc by `closure_disc`. So `S` is `S₁` with a disc pasted on, +and `S'` is `S₁` with a Möbius band pasted on. Comparing models gives `crosscap_model`: the number +`2 a + b` for the model `Σ(a, b, 0)` goes up by one. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +universe u v + +theorem isSurface_of_homeo {A : Type u} {B : Type v} [TopologicalSpace A] [TopologicalSpace B] + (e : A ≃ₜ B) (h : IsSurface A) : IsSurface B := by + have : CompactSpace A := h.1 + have : T2Space A := h.2.1 + refine ⟨e.surjective.compactSpace e.continuous, e.symm.isEmbedding.t2Space, fun x => ?_⟩ + simpa using isManifoldPoint_of_isOpenEmbedding e.isOpenEmbedding (h.2.2 (e.symm x)) + +theorem isOArc_image {A : Type u} {B : Type v} [TopologicalSpace A] [TopologicalSpace B] {f : A + → B} (hf : IsEmbedding f) {X : Set A} (h : IsOArc X) : IsOArc (f '' X) := by + obtain ⟨φ⟩ := h + exact ⟨φ.trans (hf.homeomorphImage X)⟩ + +theorem isOArc_of_image {A : Type u} {B : Type v} [TopologicalSpace A] [TopologicalSpace B] {f : A + → B} (hf : IsEmbedding f) {X : Set A} (h : IsOArc (f '' X)) : IsOArc X := by + obtain ⟨φ⟩ := h + exact ⟨φ.trans (hf.homeomorphImage X).symm⟩ + +variable {S : Type u} [TopologicalSpace S] + +/-- A closed set is connected if its complement is covered by finitely many disjoint closed sets, +each of which meets the set in a nonempty connected set. -/ +theorem connected_compl [ConnectedSpace S] {X : Set S} (hX : IsClosed X) + (hne : X.Nonempty) {𝓖 : Set (Set S)} (hf : 𝓖.Finite) (hc : ∀ G ∈ 𝓖, IsClosed G) + (hp : ∀ G ∈ 𝓖, IsPreconnected (G ∩ X)) (hn : ∀ G ∈ 𝓖, (G ∩ X).Nonempty) + (hd : ∀ G ∈ 𝓖, ∀ G' ∈ 𝓖, G ≠ G' → Disjoint G G') (hu : X ∪ ⋃₀ 𝓖 = univ) : + ConnectedSpace ↥X := by + have : Nonempty ↥X := hne.to_subtype + have hP : PreconnectedSpace ↥X := by + refine preconnectedSpace_iff_clopen.mpr fun A hA => ?_ + have hcl := hX.isClosedEmbedding_subtypeVal.isClosedMap + set A' : Set S := Subtype.val '' A with hA' + set B' : Set S := Subtype.val '' Aᶜ with hB' + have hAc : IsClosed A' := hcl _ hA.1 + have hBc : IsClosed B' := hcl _ hA.2.isClosed_compl + have hAB : ∀ x, x ∈ A' → x ∈ B' → False := by + rintro _ ⟨x, hx, rfl⟩ ⟨y, hy, he⟩ + exact hy (Subtype.ext he ▸ hx) + have hcov : X ⊆ A' ∪ B' := fun x hx => by + by_cases h : (⟨x, hx⟩ : ↥X) ∈ A + · exact .inl ⟨_, h, rfl⟩ + · exact .inr ⟨_, h, rfl⟩ + have hAX : A' ⊆ X := by + rintro _ ⟨x, -, rfl⟩ + exact x.2 + have hBX : B' ⊆ X := by + rintro _ ⟨x, -, rfl⟩ + exact x.2 + have hone : ∀ G ∈ 𝓖, (G ∩ A').Nonempty → (G ∩ B').Nonempty → False := by + rintro G hG ⟨x, hx1, hx2⟩ ⟨y, hy1, hy2⟩ + obtain ⟨z, -, hz1, hz2⟩ := isPreconnected_closed_iff.mp (hp G hG) A' B' hAc hBc + (inter_subset_right.trans hcov) ⟨x, ⟨hx1, hAX hx2⟩, hx2⟩ ⟨y, ⟨hy1, hBX hy2⟩, hy2⟩ + exact hAB z hz1 hz2 + set P : Set S := A' ∪ ⋃₀ {G ∈ 𝓖 | (G ∩ A').Nonempty} with hPd + set P' : Set S := B' ∪ ⋃₀ {G ∈ 𝓖 | (G ∩ B').Nonempty} with hP'd + have c1 : IsClosed P := hAc.union ((hf.subset (sep_subset _ _)).isClosed_sUnion fun G hG + => hc G hG.1) + have c2 : IsClosed P' := hBc.union ((hf.subset (sep_subset _ _)).isClosed_sUnion fun G hG + => hc G hG.1) + have hall : ∀ x, x ∈ P ∨ x ∈ P' := fun x => by + rcases (hu ▸ mem_univ x : x ∈ X ∪ ⋃₀ 𝓖) with h | ⟨G, hG, hx⟩ + · rcases hcov h with h | h + · exact .inl (.inl h) + · exact .inr (.inl h) + · obtain ⟨y, hy1, hy2⟩ := hn G hG + rcases hcov hy2 with h | h + · exact .inl (.inr ⟨G, ⟨hG, y, hy1, h⟩, hx⟩) + · exact .inr (.inr ⟨G, ⟨hG, y, hy1, h⟩, hx⟩) + have hdisj : ∀ x, x ∈ P → x ∈ P' → False := by + rintro x (h1 | ⟨G, ⟨hG, h1⟩, hx⟩) (h2 | ⟨G', ⟨hG', h2⟩, hx'⟩) + · exact hAB x h1 h2 + · exact hone G' hG' ⟨x, hx', h1⟩ h2 + · exact hone G hG h1 ⟨x, hx, h2⟩ + · by_cases he : G = G' + · subst he + exact hone G hG h1 h2 + · exact Set.disjoint_left.mp (hd G hG G' hG' he) hx hx' + have hcon := isPreconnected_closed_iff.mp (isPreconnected_univ (α := S)) P P' c1 c2 (fun x _ + => hall x) + by_cases h1 : A.Nonempty + · right + by_contra h2 + obtain ⟨z, hz⟩ := (ne_univ_iff_exists_notMem _).mp h2 + obtain ⟨w, hw⟩ := h1 + obtain ⟨y, -, hy1, hy2⟩ := hcon ⟨w.1, mem_univ _, .inl ⟨w, hw, rfl⟩⟩ ⟨z.1, mem_univ _, .inl + ⟨z, hz, rfl⟩⟩ + exact hdisj y hy1 hy2 + · exact .inl (not_nonempty_iff_eq_empty.mp h1) + exact ⟨‹Nonempty ↥X›⟩ + +variable {S' : Type u} [TopologicalSpace S'] + +/-- The piece `S₁`, which is glued to the surface `S₂` along the boundaries of both, is a surface. +-/ +theorem piece_surface [ConnectedSpace S'] (hS' : IsSurface S') (hb : bd S' = ∅) {S₁ S₂ : Set S'} + (hc : CompactSpace ↥S₁) (hS₂ : IsSurface ↥S₂) (hu : S₁ ∪ S₂ = univ) + (_h1 : S₁ ∩ S₂ = Subtype.val '' bd ↥S₁) (h2 : S₁ ∩ S₂ = Subtype.val '' bd ↥S₂) : IsSurface ↥S₁ + := by + classical + have ht2 := hS'.2.1 + have hc₂ : CompactSpace ↥S₂ := hS₂.1 + have hint : ∀ x : S', IsInteriorPoint x := fun x => by + by_contra h + have h3 : x ∈ bd S' := h + rw [hb] at h3 + exact h3 + have hT : IsClosed S₁ := (isCompact_iff_compactSpace.mpr hc).isClosed + have hZ : IsClosed S₂ := (isCompact_iff_compactSpace.mpr hc₂).isClosed + have hval := hZ.isClosedEmbedding_subtypeVal + refine ⟨hc, inferInstance, fun x => ?_⟩ + by_cases hx : x.1 ∈ S₂ + · have hk : x.1 ∈ Subtype.val '' bd ↥S₂ := h2 ▸ ⟨x.2, hx⟩ + obtain ⟨k, hk, hke⟩ := hk + obtain ⟨hcl, hfin, hO⟩ := cuff_statement.{u} ↥S₂ hS₂ + set K : Set ↥S₂ := connectedComponentIn (bd ↥S₂) k with hKd + have hKc : K ∈ cuffs ↥S₂ := ⟨k, hk, rfl⟩ + have hKb : K ⊆ bd ↥S₂ := connectedComponentIn_subset _ _ + have hD : IsClosed (bd ↥S₂ \ K) := by + have e : bd ↥S₂ \ K = ⋃₀ (cuffs ↥S₂ \ {K}) := by + ext y + constructor + · rintro ⟨hy, hyK⟩ + refine ⟨connectedComponentIn (bd ↥S₂) y, ⟨⟨y, hy, rfl⟩, fun h => hyK ?_⟩, + mem_connectedComponentIn hy⟩ + rw [mem_singleton_iff] at h + rw [← h] + exact mem_connectedComponentIn hy + · rintro ⟨C, ⟨hC, hne⟩, hy⟩ + obtain ⟨z, hz, rfl⟩ := id hC + exact ⟨connectedComponentIn_subset _ _ hy, fun h => Set.disjoint_left.mp + (cuffs_disjoint hC hKc hne) hy h⟩ + rw [e] + exact (hfin.subset sdiff_subset).isClosed_sUnion fun C hC => (hO C hC.1).isCompact.isClosed + have hmem : ∀ y ∈ Subtype.val '' K, y ∈ S₁ := fun y hy => by + have h3 : y ∈ S₁ ∩ S₂ := h2 ▸ image_mono hKb hy + exact h3.1 + have hclosure : ∀ y ∈ Subtype.val '' bd ↥S₂, y ∈ closure (S₁ \ S₂) ∧ y ∈ closure (S₂ \ S₁) := by + rintro _ ⟨z, hz, rfl⟩ + constructor + · have h3 := (bd_subset_iff hint z).mp hz + have h4 : S₂ᶜ ⊆ S₁ \ S₂ := fun w hw => ⟨(hu ▸ mem_univ w : w ∈ S₁ ∪ S₂).resolve_right hw, + hw⟩ + exact closure_mono h4 h3 + · have h3 := mem_closure_compl_bd (hS₂.2.2 z) + have h4 := image_closure_subset_closure_image continuous_subtype_val ⟨z, h3, rfl⟩ + refine closure_mono ?_ h4 + rintro _ ⟨w, hw, rfl⟩ + refine ⟨w.2, fun h5 => hw ?_⟩ + have h6 : w.1 ∈ Subtype.val '' bd ↥S₂ := h2 ▸ ⟨h5, w.2⟩ + obtain ⟨v, hv, he⟩ := h6 + exact Subtype.ext he ▸ hv + have hside := side_manifold hS' (T := S₁) (Z := S₂) (C := Subtype.val '' K) (D + := Subtype.val '' (bd ↥S₂ \ K)) hT hZ hu + (isOArc_image hval.isEmbedding (hO K hKc)) (by rw [hb]; exact disjoint_empty _) hmem + (hval.isClosedMap _ hD) + (by rw [h2, ← image_union, union_sdiff_cancel hKb]) + (Set.disjoint_left.mpr fun y ⟨p, hp, hpe⟩ ⟨q, hq, hqe⟩ => hq.2 (by + rw [← Subtype.ext (hpe.trans hqe.symm)] + exact hp)) + (fun y hy => (hclosure y (image_mono hKb hy)).1) (fun y hy => (hclosure y + (image_mono hKb hy)).2) + (x := x.1) ⟨k, mem_connectedComponentIn hk, hke⟩ + exact hside.1 + · have hsub : S₂ᶜ ⊆ S₁ := fun w hw => (hu ▸ mem_univ w : w ∈ S₁ ∪ S₂).resolve_right hw + have hop : IsOpen S₂ᶜ := hZ.isOpen_compl + exact isManifoldPoint_of_isOpenEmbedding (isOpenEmbedding_inclusion hsub hop) (x := ⟨x.1, + hx⟩) (isManifoldPoint_sub hop (hS'.2.2 x.1)) + +theorem isOArc_bd_one {Z : Type u} [TopologicalSpace Z] {a b : ℕ} (e : SurfaceModel a b 1 ≃ₜ Z) : + IsOArc (bd Z) := by + obtain ⟨C, hC, hb⟩ := model_one_cuff a b + have h1 := (cuff_statement.{0} _ (isSurface_model a b 1).1).2.2 C hC + rw [← image_bd_homeomorph e, hb] + exact isOArc_image e.isEmbedding h1 + +theorem IsOArc.isConnected' {Y : Type u} [TopologicalSpace Y] {C : Set Y} + (h : IsOArc C) : IsConnected C := by + obtain ⟨φ⟩ := id h + exact ⟨⟨_, (φ 1).2⟩, h.isPreconnected⟩ + +theorem isCuff_of_oArc {Y : Type u} [TopologicalSpace Y] (h : IsOArc (bd Y)) : IsCuff (bd Y) := by + have h1 : bd Y ∈ cuffs Y := by + rw [cuffs_eq_of_isConnected h.isConnected'] + exact mem_singleton _ + exact h1 + +/-- **Adding a crosscap raises `2 a + b` by one.** -/ +theorem crosscap_model [ConnectedSpace S] [ConnectedSpace S'] (hS : IsSurface S) (hb : bd S = ∅) + (hS' : IsSurface S') (hb' : bd S' = ∅) {Λ : Set S} {S₁ S₂ : Set S'} + (hΛ : IsOpenDisc Λ) (hu : S₁ ∪ S₂ = univ) (h1 : S₁ ∩ S₂ = Subtype.val '' bd ↥S₁) (h2 : S₁ ∩ S₂ + = Subtype.val '' bd ↥S₂) + (e₁ : ↥((univ : Set S) \ Λ) ≃ₜ S₁) (e₂ : MobiusBand ≃ₜ S₂) {a b : ℕ} + (e : S ≃ₜ SurfaceModel a b 0) : + ∃ a' b', Nonempty (S' ≃ₜ SurfaceModel a' b' 0) ∧ 2 * a' + b' = 2 * a + b + 1 := by + have ht2 := hS.2.1 + have hcS := hS.1 + have ht2' := hS'.2.1 + obtain ⟨m⟩ := nonempty_mob_homeo + let e₂' : SurfaceModel 0 1 1 ≃ₜ S₂ := m.trans e₂ + have hS₂ : IsSurface ↥S₂ := isSurface_of_homeo e₂' (isSurface_model 0 1 1).1 + let e₁' : ↥Λᶜ ≃ₜ S₁ := (Homeomorph.setCongr (compl_eq_univ_sdiff Λ)).trans e₁ + have hXc : IsClosed Λᶜ := hΛ.1.isClosed_compl + have hcX : CompactSpace ↥Λᶜ := isCompact_iff_compactSpace.mp hXc.isCompact + have hc₁ : CompactSpace ↥S₁ := e₁'.surjective.compactSpace e₁'.continuous + have hS₁ : IsSurface ↥S₁ := piece_surface hS' hb' hc₁ hS₂ hu h1 h2 + have hX : IsSurface ↥Λᶜ := isSurface_of_homeo e₁'.symm hS₁ + have hint : ∀ x : S, IsInteriorPoint x := fun x => by + by_contra h + have h3 : x ∈ bd S := h + rw [hb] at h3 + exact h3 + have hbX : ∀ x : ↥Λᶜ, x ∈ bd ↥Λᶜ ↔ x.1 ∈ closure Λ := fun x => by + have := bd_subset_iff hint x + rwa [compl_compl] at this + have himg : Subtype.val '' bd ↥Λᶜ = closure Λ \ Λ := by + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + exact ⟨(hbX y).mp hy, y.2⟩ + · rintro ⟨h3, h4⟩ + exact ⟨⟨x, h4⟩, (hbX _).mpr h3, rfl⟩ + have hval := hXc.isClosedEmbedding_subtypeVal + have hval₂ : IsClosedEmbedding (Subtype.val : ↥S₂ → S') := (isCompact_iff_compactSpace.mpr + hS₂.1).isClosed.isClosedEmbedding_subtypeVal + have hval₁ : IsClosedEmbedding (Subtype.val : ↥S₁ → S') := (isCompact_iff_compactSpace.mpr + hc₁).isClosed.isClosedEmbedding_subtypeVal + have hOb₂ : IsOArc (bd ↥S₂) := isOArc_bd_one e₂' + have hOF : IsOArc (Subtype.val '' bd ↥S₁) := by + rw [← h1, h2] + exact isOArc_image hval₂.isEmbedding hOb₂ + have hOb₁ : IsOArc (bd ↥S₁) := isOArc_of_image hval₁.isEmbedding hOF + have hObX : IsOArc (bd ↥Λᶜ) := by + rw [← image_bd_homeomorph e₁'.symm] + exact isOArc_image e₁'.symm.isEmbedding hOb₁ + have hF : IsOArc (closure Λ \ Λ) := himg ▸ isOArc_image hval.isEmbedding hObX + have hout : ∀ x ∈ closure Λ \ Λ, x ∈ closure (closure Λ)ᶜ := by + rw [← himg] + rintro _ ⟨k, -, rfl⟩ + have h3 := mem_closure_compl_bd (hX.2.2 k) + have h4 := image_closure_subset_closure_image continuous_subtype_val ⟨k, h3, rfl⟩ + refine closure_mono ?_ h4 + rintro _ ⟨w, hw, rfl⟩ + exact fun h5 => hw ((hbX w).mpr h5) + obtain ⟨hG, hGb⟩ := closure_disc hS hΛ (by rw [hb]; exact disjoint_empty _) hF hout + obtain ⟨φ⟩ := id hF + have hcov : Λᶜ ∪ closure Λ = univ := by + rw [eq_univ_iff_forall] + intro z + by_cases hz : z ∈ Λ + · exact .inr (subset_closure hz) + · exact .inl hz + have hconn : ConnectedSpace ↥Λᶜ := connected_compl hXc ⟨_, (φ 1).2.2⟩ (finite_singleton + (closure Λ)) (fun G hG => by + rw [mem_singleton_iff.mp hG] + exact isClosed_closure) (fun G hG => by + rw [mem_singleton_iff.mp hG] + exact hF.isPreconnected) (fun G hG => by + rw [mem_singleton_iff.mp hG] + exact ⟨_, (φ 1).2⟩) (fun G hG G' hG' hne => absurd ((mem_singleton_iff.mp hG).trans + (mem_singleton_iff.mp hG').symm) hne) (by + rw [sUnion_singleton] + exact hcov) + obtain ⟨a₁, b₁, c₁, ⟨e₃⟩⟩ := classification.{u} _ hX hconn + have hran : range (Subtype.val : ↥Λᶜ → S) ∪ closure Λ = univ := by + rw [Subtype.range_coe] + exact hcov + have hmeet : range (Subtype.val : ↥Λᶜ → S) ∩ closure Λ = Subtype.val '' bd ↥Λᶜ := by + rw [Subtype.range_coe, himg, inter_comm] + rfl + obtain ⟨h0, ⟨e₄⟩⟩ := paste_model hX (isCuff_of_oArc hObX) hS hval hG hran hmeet + (hGb.trans himg.symm) e₃ + obtain ⟨c0, ce, -⟩ := (modelCriterion.2 a₁ b₁ (c₁ - 1) a b 0).mp ⟨e₄.symm.trans e⟩ + obtain rfl : c₁ = 1 := by omega + have hran₁ : range (Subtype.val : ↥S₁ → S') ∪ S₂ = univ := by + rw [Subtype.range_coe] + exact hu + have hm₁ : range (Subtype.val : ↥S₁ → S') ∩ S₂ = Subtype.val '' bd ↥S₁ := by + rw [Subtype.range_coe] + exact h1 + have hBb : Subtype.val ⁻¹' (Subtype.val '' bd ↥S₁) ⊆ bd ↥S₂ := fun z hz => by + have h3 : z.1 ∈ Subtype.val '' bd ↥S₂ := by + rw [← h2, h1] + exact hz + obtain ⟨k, hk, he⟩ := h3 + exact Subtype.ext he ▸ hk + obtain ⟨-, -, ⟨e₅⟩⟩ := glue_model hS₁ (isCuff_of_oArc hOb₁) hS₂ ht2' hval₁ hran₁ hm₁ hOF hBb + (e₁'.symm.trans e₃) e₂'.symm + exact ⟨0 + a₁, 1 + b₁, ⟨e₅⟩, by omega⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/AddHandle.lean b/LeanPool/GraphMinor/Surface/AddHandle.lean new file mode 100644 index 0000000000..3a05a7d4c7 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/AddHandle.lean @@ -0,0 +1,728 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.AddCrosscap + +/-! +# Euler genus after adding a handle + +The boundary of the closed cylinder is its two end circles (`bd_cylinder`). Adding a handle removes +two open discs from a closed connected surface `S` and glues a cylinder `S₂` to what is left, `S₁`. +As for a crosscap, we show that `S₁` is a surface, that the closures of the two discs are closed +discs, and that `S₁` has model `Σ(a, b, 2)` when `S` has model `Σ(a, b, 0)`. + +To see `S'` we do not cut along both ends of the cylinder. We take a collar of one cuff of `S₁`, and +we stretch this collar so that it covers the collar and the whole cylinder. This is a map from `S₁` +onto `S'` that only glues the two cuffs of `S₁` together (`handle_cut`), and the words of +`CutLoop.lean` then show that `S'` has model `Σ(a + 1, b, 0)` or `Σ(a, b + 2, 0)` (`handle_model`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +universe u + +local notation "𝕀" => unitInterval + +/-- The end circle of the closed cylinder at height `r`. -/ +def cylEnd (r : ℝ) (hr : r ∈ Icc (1 : ℝ) 2) (w : Circle) : ClosedCylinder + := ⟨(r, w), hr, mem_univ _⟩ + +theorem isEmbedding_cylEnd (r : ℝ) (hr : r ∈ Icc (1 : ℝ) 2) : IsEmbedding (cylEnd r hr) := by + have h1 : Continuous (cylEnd r hr) := by + unfold cylEnd + fun_prop + have h2 : Function.LeftInverse (fun p : ClosedCylinder => p.1.2) (cylEnd r hr) := fun _ => rfl + exact h2.isEmbedding (by fun_prop) h1 + +/-- A rotation of the closed cylinder. -/ +noncomputable def cylRot (u : Circle) : ClosedCylinder ≃ₜ ClosedCylinder := + Homeomorph.subtype ((Homeomorph.refl ℝ).prodCongr (Homeomorph.mulLeft u)) (fun p + => by simp [ClosedCylinder]) + +theorem cylinder_interior {p : ClosedCylinder} (h1 : 1 < p.1.1) (h2 : p.1.1 < 2) : IsInteriorPoint + p := by + revert h1 h2 + obtain ⟨⟨r, u⟩, hr, -⟩ := p + intro (h1 : 1 < r) (h2 : r < 2) + set d : ℝ := 2 * r - 3 with hd + let w : ℂ := ⟨d / 2, -(d / 2)⟩ + have hw : nn w < 1 := by + simp only [nn, w] + rw [abs_neg] + rcases abs_cases (d / 2) with h3 | h3 <;> linarith + have hz : ‖mu w‖ < 1 := by rwa [norm_mu] + have hmem : ((0 : ℕ), mu w) ∈ Dsk (sW cylW) := by + refine ⟨?_, hz.le⟩ + rw [sW_zero] + simp [cylW] + have hz' : ‖((0 : ℕ), mu w).2‖ < 1 := hz + have h3 : IsInteriorPoint ((fun a : ℕ × ℂ => cylG a.2) (0, mu w)) := isInteriorPoint_of_lt (W + := sW cylW) (finW_sW cylW) presents_cyl hmem hz' + replace h3 : IsInteriorPoint (cylG (mu w)) := h3 + have h4 : cylG (mu w) = ⟨(r, 1), hr, mem_univ _⟩ := by + apply Subtype.ext + apply Prod.ext + · rw [cylG_fst hz.le] + simp only [cylR, nu_mu, w] + linarith + · rw [cylG_snd] + simp only [cylS, nu_mu, w] + have : ee ((d / 2 + -(d / 2)) / 2) = 1 := by + rw [show (d / 2 + -(d / 2)) / 2 = (0 : ℝ) by ring] + simp [ee] + exact this + have h5 : cylRot u ⟨(r, 1), hr, mem_univ _⟩ = ⟨(r, u), hr, mem_univ _⟩ := by + exact Subtype.ext (Prod.ext rfl (mul_one u)) + rw [h4] at h3 + rw [← h5] + exact (isInteriorPoint_homeomorph_iff (cylRot u) _).mpr h3 + +/-- A component of the boundary from a splitting of the boundary into two closed sets. -/ +theorem cuff_of_split {Y : Type u} [TopologicalSpace Y] {A B : Set Y} (hA : IsClosed A) + (hB : IsClosed B) (hd : Disjoint A B) (hu : A ∪ B = bd Y) (hc : IsConnected A) : + A ∈ cuffs Y := by + obtain ⟨x, hx⟩ := hc.1 + have hAb : A ⊆ bd Y := hu ▸ subset_union_left + refine ⟨x, hAb hx, ?_⟩ + apply subset_antisymm + · have h1 : IsPreconnected (connectedComponentIn (bd Y) x) := isPreconnected_connectedComponentIn + have h2 : connectedComponentIn (bd Y) x ⊆ A ∪ B := hu ▸ connectedComponentIn_subset _ _ + have hdis : Disjoint B A := hd.symm + rcases isPreconnected_closed_iff.mp h1 with h3 + by_contra hn + obtain ⟨z, hz, hzA⟩ := not_subset.mp hn + have hzB : z ∈ B := (h2 hz).resolve_left hzA + obtain ⟨y, -, hy1, hy2⟩ := h3 A B hA hB h2 ⟨x, mem_connectedComponentIn + (hAb hx), hx⟩ ⟨z, hz, hzB⟩ + exact Set.disjoint_left.mp hd hy1 hy2 + · exact hc.2.subset_connectedComponentIn hx hAb + +/-- The boundary of the closed cylinder is the union of its two end circles. -/ +theorem bd_cylinder : bd ↥ClosedCylinder = range (cylEnd 1 (by norm_num)) ∪ range (cylEnd 2 + (by norm_num)) := by + set A₁ := range (cylEnd 1 (by norm_num)) with hA₁ + set A₂ := range (cylEnd 2 (by norm_num)) with hA₂ + have memA₁ : ∀ p : ClosedCylinder, p.1.1 = 1 → p ∈ A₁ := fun p hp => ⟨p.1.2, Subtype.ext + (Prod.ext hp.symm rfl)⟩ + have memA₂ : ∀ p : ClosedCylinder, p.1.1 = 2 → p ∈ A₂ := fun p hp => ⟨p.1.2, Subtype.ext + (Prod.ext hp.symm rfl)⟩ + have hsub : bd ↥ClosedCylinder ⊆ A₁ ∪ A₂ := fun p hp => by + have h1 := p.2.1.1 + have h2 := p.2.1.2 + rcases h1.lt_or_eq with h3 | h3 + · rcases h2.lt_or_eq with h4 | h4 + · exact absurd (cylinder_interior h3 h4) hp + · exact .inr (memA₂ p h4) + · exact .inl (memA₁ p h3.symm) + obtain ⟨m⟩ := nonempty_cyl_homeo + obtain ⟨ht, f, hf⟩ := presents_ew 0 0 2 + have h2 := ncard_cuffs (presents_comp hf m) + obtain ⟨C₁, C₂, hne, hC⟩ := Set.ncard_eq_two.mp h2 + have hcase : ∀ C ∈ cuffs ↥ClosedCylinder, C = A₁ ∨ C = A₂ := by + have hS : IsSurface ↥ClosedCylinder := isSurface_of_homeo m (isSurface_model 0 0 2).1 + intro C hC' + have hO := (cuff_statement.{0} _ hS).2.2 C hC' + have hCb : C ⊆ bd ↥ClosedCylinder := by + obtain ⟨x, -, rfl⟩ := hC' + exact connectedComponentIn_subset _ _ + have o1 : IsOpen {p : ClosedCylinder | p.1.1 < 3 / 2} := isOpen_lt + (by fun_prop) continuous_const + have o2 : IsOpen {p : ClosedCylinder | 3 / 2 < p.1.1} := isOpen_lt continuous_const + (by fun_prop) + have hcov : C ⊆ {p : ClosedCylinder | p.1.1 < 3 / 2} ∪ {p : ClosedCylinder | 3 / 2 < p.1.1} + := fun p hp => by + rcases hsub (hCb hp) with ⟨w, rfl⟩ | ⟨w, rfl⟩ + · refine .inl ?_ + change (1 : ℝ) < 3 / 2 + norm_num + · refine .inr ?_ + change (3 / 2 : ℝ) < 2 + norm_num + rcases hO.isPreconnected.subset_or_subset o1 o2 (Set.disjoint_left.mpr fun p + (h3 : p.1.1 < 3 / 2) (h4 : 3 / 2 < p.1.1) => absurd h3 (not_lt.mpr h4.le)) hcov with h3 | h3 + · left + exact oarc_eq (isEmbedding_cylEnd 1 (by norm_num)).toHomeomorph hO fun p hp => by + rcases hsub (hCb hp) with h5 | ⟨w, rfl⟩ + · exact h5 + · exact absurd (h3 hp) (by change ¬ ((2 : ℝ) < 3 / 2); norm_num) + · right + exact oarc_eq (isEmbedding_cylEnd 2 (by norm_num)).toHomeomorph hO fun p hp => by + rcases hsub (hCb hp) with ⟨w, rfl⟩ | h5 + · exact absurd (h3 hp) (by change ¬ ((3 / 2 : ℝ) < 1); norm_num) + · exact h5 + have m1 : C₁ ∈ cuffs ↥ClosedCylinder := by rw [hC]; simp + have m2 : C₂ ∈ cuffs ↥ClosedCylinder := by rw [hC]; simp + have sub : ∀ C ∈ cuffs ↥ClosedCylinder, C ⊆ bd ↥ClosedCylinder := by + rintro _ ⟨x, -, rfl⟩ + exact connectedComponentIn_subset _ _ + apply subset_antisymm hsub + rcases hcase C₁ m1 with h3 | h3 <;> rcases hcase C₂ m2 with h4 | h4 + · exact absurd (h3.trans h4.symm) hne + · exact union_subset (h3 ▸ sub C₁ m1) (h4 ▸ sub C₂ m2) + · exact union_subset (h4 ▸ sub C₂ m2) (h3 ▸ sub C₁ m1) + · exact absurd (h3.trans h4.symm) hne + +variable {S : Type u} [TopologicalSpace S] + +/-- The complement of an open disc with a frontier as in `closure_disc` is a surface. -/ +theorem compl_surface [ConnectedSpace S] (hS : IsSurface S) (hb : bd S = ∅) {Λ : Set S} + (hΛ : IsOpen Λ) (hF : IsOArc (closure Λ \ Λ)) + (hout : ∀ x ∈ closure Λ \ Λ, x ∈ closure (closure Λ)ᶜ) : IsSurface ↥Λᶜ := by + have hcS := hS.1 + have ht2 := hS.2.1 + have hsub : Λ ⊆ closure Λ := subset_closure + have hXc : IsClosed Λᶜ := hΛ.isClosed_compl + refine ⟨isCompact_iff_compactSpace.mp hXc.isCompact, inferInstance, fun x => ?_⟩ + by_cases hx : x.1 ∈ closure Λ + · refine (side_manifold hS (T := Λᶜ) (Z := closure Λ) (C := closure Λ \ Λ) (D + := ∅) hXc isClosed_closure ?_ hF (by rw [hb]; exact disjoint_empty _) + (fun z hz => hz.2) isClosed_empty ?_ (disjoint_empty _) ?_ ?_ (x := x.1) ⟨hx, x.2⟩).1 + · rw [eq_univ_iff_forall] + intro z + by_cases hz : z ∈ Λ + · exact .inr (hsub hz) + · exact .inl hz + · rw [union_empty, inter_comm] + rfl + · intro z hz + have : Λᶜ \ closure Λ = (closure Λ)ᶜ := by + ext w + exact ⟨fun h => h.2, fun h => ⟨fun h' => h (hsub h'), h⟩⟩ + rw [this] + exact hout z hz + · intro z hz + have : closure Λ \ Λᶜ = Λ := by + ext w + exact ⟨fun h => not_not.mp h.2, fun h => ⟨hsub h, not_not.mpr h⟩⟩ + rw [this] + exact hz.1 + · have hop : IsOpen (closure Λ)ᶜ := isClosed_closure.isOpen_compl + have hs : (closure Λ)ᶜ ⊆ Λᶜ := compl_subset_compl.mpr hsub + exact isManifoldPoint_of_isOpenEmbedding (isOpenEmbedding_inclusion hs hop) (x := ⟨x.1, + hx⟩) (isManifoldPoint_sub hop (hS.2.2 x.1)) + +/-- The two `O`-arcs of the boundary of the complement of two open discs are the two frontiers. -/ +theorem two_frontiers {Λ₁ Λ₂ : Set S} {X : Set S} (hX : X = (Λ₁ ∪ Λ₂)ᶜ) (hd : Disjoint (closure Λ₁) + (closure Λ₂)) (h1 : (closure Λ₁ \ Λ₁).Nonempty) (h2 : (closure Λ₂ \ Λ₂).Nonempty) + (hb : ∀ x : ↥X, x ∈ bd ↥X ↔ x.1 ∈ closure (Λ₁ ∪ Λ₂)) (hΛ₁ : IsOpen Λ₁) + (hΛ₂ : IsOpen Λ₂) {P₁ P₂ : Set ↥X} (hP₁ : IsPreconnected P₁) (hP₂ : IsPreconnected P₂) + (hu : P₁ ∪ P₂ = bd ↥X) : + (Subtype.val '' P₁ = closure Λ₁ \ Λ₁ ∧ Subtype.val '' P₂ = closure Λ₂ \ Λ₂) ∨ + (Subtype.val '' P₁ = closure Λ₂ \ Λ₂ ∧ Subtype.val '' P₂ = closure Λ₁ \ Λ₁) := by + have hF₁c : IsClosed (closure Λ₁ \ Λ₁) := isClosed_closure.sdiff hΛ₁ + have hF₂c : IsClosed (closure Λ₂ \ Λ₂) := isClosed_closure.sdiff hΛ₂ + have hdF : Disjoint (closure Λ₁ \ Λ₁) (closure Λ₂ \ Λ₂) := hd.mono sdiff_subset sdiff_subset + have hvb : Subtype.val '' bd ↥X = (closure Λ₁ \ Λ₁) ∪ (closure Λ₂ \ Λ₂) := by + subst hX + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + have h3 := (hb y).mp hy + rw [closure_union] at h3 + have h4 := y.2 + simp only [mem_compl_iff, mem_union, not_or] at h4 + rcases h3 with h3 | h3 + · exact .inl ⟨h3, h4.1⟩ + · exact .inr ⟨h3, h4.2⟩ + · rintro (⟨h3, h4⟩ | ⟨h3, h4⟩) + · refine ⟨⟨x, fun h => h.elim h4 fun h' => Set.disjoint_left.mp hd h3 (subset_closure h')⟩, + (hb _).mpr ?_, rfl⟩ + exact closure_mono subset_union_left h3 + · refine ⟨⟨x, fun h => h.elim (fun h' => Set.disjoint_left.mp hd (subset_closure h') h3) h4⟩, + (hb _).mpr ?_, rfl⟩ + exact closure_mono subset_union_right h3 + have hside : ∀ P : Set ↥X, IsPreconnected P → P ⊆ bd ↥X → Subtype.val '' P ⊆ closure Λ₁ \ Λ₁ + ∨ Subtype.val '' P ⊆ closure Λ₂ \ Λ₂ := by + intro P hP hPb + have h3 := hP.image _ continuous_subtype_val.continuousOn + have h4 : Subtype.val '' P ⊆ (closure Λ₁ \ Λ₁) ∪ (closure Λ₂ \ Λ₂) := hvb ▸ image_mono hPb + by_contra hn + push Not at hn + obtain ⟨n1, n2⟩ := hn + obtain ⟨a, ha, ha'⟩ := not_subset.mp n1 + obtain ⟨c, hc, hc'⟩ := not_subset.mp n2 + obtain ⟨z, -, hz1, hz2⟩ := isPreconnected_closed_iff.mp h3 _ _ hF₁c hF₂c h4 ⟨c, hc, + (h4 hc).resolve_right hc'⟩ ⟨a, ha, (h4 ha).resolve_left ha'⟩ + exact Set.disjoint_left.mp hdF hz1 hz2 + have hu' : Subtype.val '' P₁ ∪ Subtype.val '' P₂ = (closure Λ₁ \ Λ₁) ∪ (closure Λ₂ \ Λ₂) := by + rw [← image_union, hu, hvb] + have h1b : P₁ ⊆ bd ↥X := hu ▸ subset_union_left + have h2b : P₂ ⊆ bd ↥X := hu ▸ subset_union_right + have key : ∀ {A B F G : Set S}, Disjoint F G → A ∪ B = F ∪ G → A ⊆ F → B ⊆ G → A = F ∧ B = G := by + intro A B F G hdis hun hA hB + refine ⟨subset_antisymm hA fun z hz => ?_, subset_antisymm hB fun z hz => ?_⟩ + · rcases (hun ▸ (.inl hz : z ∈ F ∪ G) : z ∈ A ∪ B) with h | h + · exact h + · exact absurd (hB h) (Set.disjoint_left.mp hdis hz) + · rcases (hun ▸ (.inr hz : z ∈ F ∪ G) : z ∈ A ∪ B) with h | h + · exact absurd hz (Set.disjoint_left.mp hdis (hA h)) + · exact h + rcases hside P₁ hP₁ h1b with h3 | h3 <;> rcases hside P₂ hP₂ h2b with h4 | h4 + · exfalso + obtain ⟨z, hz⟩ := h2 + have h5 : z ∈ closure Λ₁ \ Λ₁ := by + rcases (hu' ▸ (.inr hz) : z ∈ Subtype.val '' P₁ ∪ Subtype.val '' P₂) with h | h + · exact h3 h + · exact h4 h + exact Set.disjoint_left.mp hdF h5 hz + · exact .inl (key hdF hu' h3 h4) + · refine .inr ?_ + rw [union_comm] at hu' + have := key hdF hu' h4 h3 + exact ⟨this.2, this.1⟩ + · exfalso + obtain ⟨z, hz⟩ := h1 + have h5 : z ∈ closure Λ₂ \ Λ₂ := by + rcases (hu' ▸ (.inl hz) : z ∈ Subtype.val '' P₁ ∪ Subtype.val '' P₂) with h | h + · exact h3 h + · exact h4 h + exact Set.disjoint_left.mp hdF hz h5 + +/-- If a closed connected surface has model `Σ(a, b, 0)`, then the surface left by removing two open +discs has a model `Σ(a', b', 2)` with `2 a' + b' = 2 a + b`. -/ +theorem handle_hole_model [ConnectedSpace S] (hS : IsSurface S) (hb : bd S = ∅) {Λ₁ Λ₂ : Set S} + (hΛ₁ : IsOpenDisc Λ₁) (hΛ₂ : IsOpenDisc Λ₂) + (hd : Disjoint (closure Λ₁) (closure Λ₂)) (hX : IsSurface ↥(Λ₁ ∪ Λ₂)ᶜ) {P₁ P₂ : Set ↥(Λ₁ ∪ + Λ₂)ᶜ} (hP₁ : IsOArc P₁) (hP₂ : IsOArc P₂) + (hu : P₁ ∪ P₂ = bd ↥(Λ₁ ∪ Λ₂)ᶜ) (hdP : Disjoint P₁ P₂) (hv₁ : Subtype.val '' P₁ + = closure Λ₁ \ Λ₁) (hv₂ : Subtype.val '' P₂ = closure Λ₂ \ Λ₂) + {a b : ℕ} (e : S ≃ₜ SurfaceModel a b 0) : + ∃ a₁ b₁, Nonempty (↥(Λ₁ ∪ Λ₂)ᶜ ≃ₜ SurfaceModel a₁ b₁ 2) ∧ 2 * a₁ + b₁ = 2 * a + b := by + classical + have ht2 := hS.2.1 + have hcS := hS.1 + have hcX : CompactSpace ↥(Λ₁ ∪ Λ₂)ᶜ := hX.1 + have ht2X : T2Space ↥(Λ₁ ∪ Λ₂)ᶜ := hX.2.1 + have hXc : IsClosed (Λ₁ ∪ Λ₂)ᶜ := (hΛ₁.1.union hΛ₂.1).isClosed_compl + have hint : ∀ x : S, IsInteriorPoint x := fun x => by + by_contra h + have h3 : x ∈ bd S := h + rw [hb] at h3 + exact h3 + have hbX : ∀ x : ↥(Λ₁ ∪ Λ₂)ᶜ, x ∈ bd ↥(Λ₁ ∪ Λ₂)ᶜ ↔ x.1 ∈ closure (Λ₁ ∪ Λ₂) := fun x => by + have := bd_subset_iff hint x + rwa [compl_compl] at this + have hF₁ : IsOArc (closure Λ₁ \ Λ₁) := hv₁ ▸ isOArc_image IsEmbedding.subtypeVal hP₁ + have hF₂ : IsOArc (closure Λ₂ \ Λ₂) := hv₂ ▸ isOArc_image IsEmbedding.subtypeVal hP₂ + have hP₁b : P₁ ⊆ bd ↥(Λ₁ ∪ Λ₂)ᶜ := hu ▸ subset_union_left + have hP₂b : P₂ ⊆ bd ↥(Λ₁ ∪ Λ₂)ᶜ := hu ▸ subset_union_right + have houter : ∀ k : ↥(Λ₁ ∪ Λ₂)ᶜ, k.1 ∈ closure (Subtype.val '' (bd ↥(Λ₁ ∪ Λ₂)ᶜ)ᶜ) := fun k => + image_closure_subset_closure_image continuous_subtype_val ⟨k, mem_closure_compl_bd + (hX.2.2 k), rfl⟩ + have hsm : Subtype.val '' (bd ↥(Λ₁ ∪ Λ₂)ᶜ)ᶜ ⊆ (closure (Λ₁ ∪ Λ₂))ᶜ := by + rintro _ ⟨w, hw, rfl⟩ + exact fun h5 => hw ((hbX w).mpr h5) + have hout₁ : ∀ x ∈ closure Λ₁ \ Λ₁, x ∈ closure (closure Λ₁)ᶜ := by + rw [← hv₁] + rintro _ ⟨k, -, rfl⟩ + exact closure_mono (hsm.trans (compl_subset_compl.mpr (closure_mono subset_union_left))) + (houter k) + have hout₂ : ∀ x ∈ closure Λ₂ \ Λ₂, x ∈ closure (closure Λ₂)ᶜ := by + rw [← hv₂] + rintro _ ⟨k, -, rfl⟩ + exact closure_mono (hsm.trans (compl_subset_compl.mpr (closure_mono subset_union_right))) + (houter k) + obtain ⟨hG₁, hG₁b⟩ := closure_disc hS hΛ₁ (by rw [hb]; exact disjoint_empty _) hF₁ hout₁ + obtain ⟨hG₂, hG₂b⟩ := closure_disc hS hΛ₂ (by rw [hb]; exact disjoint_empty _) hF₂ hout₂ + have hmeet₁ : closure Λ₁ ∩ (Λ₁ ∪ Λ₂)ᶜ = closure Λ₁ \ Λ₁ := by + ext z + exact ⟨fun h => ⟨h.1, fun h' => h.2 (.inl h')⟩, fun h => ⟨h.1, + fun h' => h'.elim h.2 fun h'' => Set.disjoint_left.mp hd h.1 (subset_closure h'')⟩⟩ + have hmeet₂ : closure Λ₂ ∩ (Λ₁ ∪ Λ₂)ᶜ = closure Λ₂ \ Λ₂ := by + ext z + exact ⟨fun h => ⟨h.1, fun h' => h.2 (.inr h')⟩, fun h => ⟨h.1, + fun h' => h'.elim (fun h'' => Set.disjoint_left.mp hd (subset_closure h'') h.1) h.2⟩⟩ + obtain ⟨φ₁⟩ := id hF₁ + obtain ⟨φ₂⟩ := id hF₂ + have hcov₁ : Λ₁ᶜ ∪ closure Λ₁ = univ := by + rw [eq_univ_iff_forall] + intro z + by_cases hz : z ∈ Λ₁ + · exact .inr (subset_closure hz) + · exact .inl hz + have hconn : ConnectedSpace ↥(Λ₁ ∪ Λ₂)ᶜ := by + have hmem : (φ₁ 1).1 ∈ closure Λ₁ ∩ (Λ₁ ∪ Λ₂)ᶜ := by + rw [hmeet₁] + exact (φ₁ 1).2 + refine connected_compl hXc ⟨(φ₁ 1).1, hmem.2⟩ (𝓖 := {closure Λ₁, + closure Λ₂}) (by simp) ?_ ?_ ?_ ?_ ?_ + · rintro G (rfl | rfl) <;> exact isClosed_closure + · rintro G (rfl | rfl) + · rw [hmeet₁] + exact hF₁.isPreconnected + · rw [hmeet₂] + exact hF₂.isPreconnected + · rintro G (rfl | rfl) + · rw [hmeet₁] + exact ⟨_, (φ₁ 1).2⟩ + · rw [hmeet₂] + exact ⟨_, (φ₂ 1).2⟩ + · rintro G (rfl | rfl) G' (rfl | rfl) hne + · exact absurd rfl hne + · exact hd + · exact hd.symm + · exact absurd rfl hne + · rw [eq_univ_iff_forall] + intro z + by_cases h1 : z ∈ Λ₁ + · exact .inr ⟨_, .inl rfl, subset_closure h1⟩ + · by_cases h2 : z ∈ Λ₂ + · exact .inr ⟨_, .inr rfl, subset_closure h2⟩ + · exact .inl fun h => h.elim h1 h2 + obtain ⟨a₁, b₁, c₁, ⟨e₃⟩⟩ := classification.{u} _ hX hconn + have hQ : IsSurface ↥Λ₁ᶜ := compl_surface hS hb hΛ₁.1 hF₁ hout₁ + have hcQ : CompactSpace ↥Λ₁ᶜ := hQ.1 + have hQc : IsClosed Λ₁ᶜ := hΛ₁.1.isClosed_compl + have hXQ : (Λ₁ ∪ Λ₂)ᶜ ⊆ Λ₁ᶜ := compl_subset_compl.mpr subset_union_left + let ι : ↥(Λ₁ ∪ Λ₂)ᶜ → ↥Λ₁ᶜ := inclusion hXQ + have hι : IsClosedEmbedding ι := (continuous_inclusion hXQ).isClosedEmbedding + (inclusion_injective hXQ) + have hvalQ := hQc.isClosedEmbedding_subtypeVal + have hG₂Q : closure Λ₂ ⊆ range (Subtype.val : ↥Λ₁ᶜ → S) := fun z hz => by + rw [Subtype.range_coe] + exact fun h => Set.disjoint_left.mp hd (subset_closure h) hz + have hne : Nonempty ↥Λ₁ᶜ := ⟨⟨(φ₁ 1).1, (φ₁ 1).2.2⟩⟩ + obtain ⟨hΔ, hΔb⟩ := isClosedDisc_preimage hvalQ hG₂ hG₂Q + have hkey : ∀ z : ↥Λ₁ᶜ, z.1 ∈ closure Λ₂ \ Λ₂ ↔ z ∈ ι '' P₂ := fun z => by + rw [← hv₂] + constructor + · rintro ⟨p, hp, he⟩ + exact ⟨p, hp, Subtype.ext he⟩ + · rintro ⟨p, hp, rfl⟩ + exact ⟨p, hp, rfl⟩ + have hran : range ι ∪ Subtype.val ⁻¹' closure Λ₂ = univ := by + rw [eq_univ_iff_forall] + intro z + by_cases h1 : z.1 ∈ Λ₂ + · exact .inr (subset_closure h1) + · exact .inl ⟨⟨z.1, fun h => h.elim z.2 h1⟩, rfl⟩ + have hmeet : range ι ∩ Subtype.val ⁻¹' closure Λ₂ = ι '' P₂ := by + ext z + rw [← hkey] + constructor + · rintro ⟨⟨x, rfl⟩, h⟩ + exact ⟨h, fun h' => x.2 (.inr h')⟩ + · rintro ⟨h1, h2⟩ + exact ⟨⟨⟨z.1, fun h => h.elim z.2 h2⟩, rfl⟩, h1⟩ + have hbd₂ : discBd (Subtype.val ⁻¹' closure Λ₂ : Set ↥Λ₁ᶜ) = ι '' P₂ := by + rw [hΔb, hG₂b] + ext z + exact hkey z + have hcP₂ : P₂ ∈ cuffs ↥(Λ₁ ∪ Λ₂)ᶜ := by + exact cuff_of_split hP₂.isCompact.isClosed hP₁.isCompact.isClosed hdP.symm + ((union_comm _ _).trans hu) hP₂.isConnected' + obtain ⟨h0, ⟨e₄⟩⟩ := paste_model hX hcP₂ hQ hι hΔ hran hmeet hbd₂ e₃ + have hbQ : ∀ x : ↥Λ₁ᶜ, x ∈ bd ↥Λ₁ᶜ ↔ x.1 ∈ closure Λ₁ := fun x => by + have := bd_subset_iff hint x + rwa [compl_compl] at this + have himg : Subtype.val '' bd ↥Λ₁ᶜ = closure Λ₁ \ Λ₁ := by + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + exact ⟨(hbQ y).mp hy, y.2⟩ + · rintro ⟨h3, h4⟩ + exact ⟨⟨x, h4⟩, (hbQ _).mpr h3, rfl⟩ + have hObQ : IsOArc (bd ↥Λ₁ᶜ) := isOArc_of_image hvalQ.isEmbedding (himg ▸ hF₁) + have hran' : range (Subtype.val : ↥Λ₁ᶜ → S) ∪ closure Λ₁ = univ := by + rw [Subtype.range_coe] + exact hcov₁ + have hmeet' : range (Subtype.val : ↥Λ₁ᶜ → S) ∩ closure Λ₁ = Subtype.val '' bd ↥Λ₁ᶜ := by + rw [Subtype.range_coe, himg, inter_comm] + rfl + obtain ⟨h0', ⟨e₅⟩⟩ := paste_model hQ (isCuff_of_oArc hObQ) hS hvalQ hG₁ hran' hmeet' + (hG₁b.trans himg.symm) e₄ + obtain ⟨c0, ce, -⟩ := (modelCriterion.2 a₁ b₁ (c₁ - 1 - 1) a b 0).mp ⟨e₅.symm.trans e⟩ + obtain rfl : c₁ = 2 := by omega + exact ⟨a₁, b₁, ⟨e₃⟩, ce⟩ + +/-- The lower half of the unit interval, stretched and turned over. -/ +noncomputable def loI (t : 𝕀) : 𝕀 := projIcc 0 1 zero_le_one (1 - 2 * (t : ℝ)) + +/-- The upper half of the unit interval, stretched. -/ +noncomputable def hiI (t : 𝕀) : 𝕀 := projIcc 0 1 zero_le_one (2 * (t : ℝ) - 1) + +theorem loI_coe {t : 𝕀} (h : (t : ℝ) ≤ 1 / 2) : (loI t : ℝ) = 1 - 2 * t := by + have hm : 1 - 2 * (t : ℝ) ∈ Icc (0 : ℝ) 1 := ⟨by linarith, by linarith [t.2.1]⟩ + rw [loI, projIcc_of_mem _ hm] + +theorem hiI_coe {t : 𝕀} (h : 1 / 2 ≤ (t : ℝ)) : (hiI t : ℝ) = 2 * t - 1 := by + have hm : 2 * (t : ℝ) - 1 ∈ Icc (0 : ℝ) 1 := ⟨by linarith, by linarith [t.2.2]⟩ + rw [hiI, projIcc_of_mem _ hm] + +private theorem cut_handle_boundary_preimage + {Y : Type u} + {T : Type u} + [TopologicalSpace Y] + {ι : Y → T} + (hιi : Function.Injective ι) + {c : Circle × 𝕀 → T} + (hci : Function.Injective c) + {J₁ : Set Y} + {J₂ : Set Y} + (φ₁ : Circle ≃ₜ ↑J₁) + (h1 : ι '' J₂ = range fun w => c (w, 1)) + (b : Circle × 𝕀 → Y) + (hb0 : ∀ (w : Circle), b (w, 0) = ↑(φ₁ w)) + (τ : Circle × 𝕀 → T) + (hτlo : ∀ {p : Circle × 𝕀}, (p.2 : ℝ) ≤ 1 / 2 → τ p = c (p.1, loI p.2)) + (hτhi : ∀ {p : Circle × 𝕀}, 1 / 2 ≤ (p.2 : ℝ) → τ p = ι (b (p.1, hiI p.2))) + (ψ : Y → T) + (hψb : ∀ (p : Circle × 𝕀), ψ (b p) = τ p) + (hψn : ∀ {z : Y}, z ∉ range b → ψ z = ι z) + (hJ₂b : ∀ z ∈ J₂, z ∉ range b) + (hψ0 : ∀ (w : Circle), ψ ↑(φ₁ w) = c (w, 1)) + (hc1 : ∀ (w : Circle), c (w, 1) ∈ ι '' J₂) : + J₁ ∪ J₂ = ψ ⁻¹' ι '' J₂ := by + apply subset_antisymm + · rintro y (hy | hy) + · obtain ⟨w, he⟩ := φ₁.surjective ⟨y, hy⟩ + have h2 : y = (φ₁ w).1 := by rw [he] + rw [mem_preimage, h2, hψ0] + exact hc1 w + · rw [mem_preimage, hψn (hJ₂b y hy)] + exact ⟨y, hy, rfl⟩ + · intro y hy + by_cases h : y ∈ range b + · obtain ⟨⟨w, t⟩, rfl⟩ := h + rw [mem_preimage, hψb] at hy + by_cases ht : (t : ℝ) ≤ 1 / 2 + · rw [hτlo ht] at hy + rw [h1] at hy + obtain ⟨w', he⟩ := hy + have h3 := Prod.ext_iff.mp (hci he) + have h4 : (loI t : ℝ) = 1 := by + have h7 : (1 : 𝕀) = loI t := h3.2 + rw [← h7] + rfl + have h5 := loI_coe ht + have h6 : t = 0 := Subtype.ext (by rw [Icc.coe_zero]; linarith) + subst h6 + rw [hb0] + exact .inl (φ₁ w).2 + · rw [hτhi (le_of_lt (not_le.mp ht))] at hy + obtain ⟨y', hy', he⟩ := hy + exact absurd ⟨_, rfl⟩ (hJ₂b _ (hιi he ▸ hy')) + · rw [mem_preimage, hψn h] at hy + obtain ⟨y', hy', he⟩ := hy + exact .inr (hιi he ▸ hy') + +/-- A map that stretches a collar of the cuff `J₁` of `Y` over the collar and a cylinder `c`, which +is glued to `ι Y` by its end at `0` along `ι J₁` and by its end at `1` along `ι J₂`. So this map +only glues `J₁` to `J₂`. -/ +theorem handle_cut {Y T : Type u} [TopologicalSpace Y] [TopologicalSpace T] + (hY : IsSurface Y) {ι : Y → T} (hι : Continuous ι) (hιi : Function.Injective ι) + {c : Circle × 𝕀 → T} (hc : Continuous c) (hci : Function.Injective c) {J₁ J₂ : Set Y} + (φ₁ : Circle ≃ₜ J₁) (hJ₁ : IsCuff J₁) (hJ₂ : IsClosed J₂) (hd : Disjoint J₁ J₂) + (hbd : J₁ ∪ J₂ ⊆ bd Y) (h0 : ∀ w, ι (φ₁ w).1 = c (w, 0)) (h1 : ι '' J₂ = range fun w => c + (w, 1)) + (hm : ∀ y p, ι y = c p → ((p.2 : ℝ) = 0 ∧ y ∈ J₁) ∨ ((p.2 : ℝ) = 1 ∧ y ∈ J₂)) + (hcov : ∀ x, x ∈ range ι ∨ x ∈ range c) : + ∃ ψ : Y → T, IsCutting ψ (ι '' J₂) ∧ BijOn ψ J₁ (ι '' J₂) ∧ BijOn ψ J₂ (ι '' J₂) ∧ J₁ ∪ J₂ + = ψ ⁻¹' (ι '' J₂) := by + classical + have hcY : CompactSpace Y := hY.1 + have ht2Y : T2Space Y := hY.2.1 + obtain ⟨b, hb, hbi, hbr, hb0, hbo⟩ := exists_collar hY hJ₁ φ₁ hJ₂.isOpen_compl (fun z hz + => Set.disjoint_left.mp hd hz) + obtain ⟨f', hf', hl⟩ := exists_inv_of_compactOn (isCompact_univ (X := Circle × 𝕀)) + hb.continuousOn hbi.injOn + have hinv : ∀ p, f' (b p) = p := fun p => hl (mem_univ p) + let τ : Circle × 𝕀 → T := fun p => if (p.2 : ℝ) ≤ 1 / 2 then c (p.1, loI p.2) else ι (b + (p.1, hiI p.2)) + have hzero : ∀ p : Circle × 𝕀, (p.2 : ℝ) = 0 → p = (p.1, 0) := fun p hp => Prod.ext rfl + (Subtype.ext hp) + have hhalf : ∀ w, ι (b (w, 0)) = c (w, 0) := fun w => by rw [hb0, h0] + have hτ : Continuous τ := by + refine Continuous.if_le ?_ ?_ (by fun_prop) continuous_const ?_ + · exact hc.comp (continuous_fst.prodMk (continuous_projIcc.comp (by fun_prop))) + · exact hι.comp (hb.comp (continuous_fst.prodMk (continuous_projIcc.comp (by fun_prop)))) + · intro p hp + have e1 : loI p.2 = 0 := Subtype.ext (by rw [loI_coe hp.le, hp]; norm_num) + have e2 : hiI p.2 = 0 := Subtype.ext (by rw [hiI_coe hp.ge, hp]; norm_num) + rw [e1, e2, hhalf] + have hτlo : ∀ {p : Circle × 𝕀}, (p.2 : ℝ) ≤ 1 / 2 → τ p = c (p.1, loI p.2) := fun h + => ite_eq_left h + have hτhi : ∀ {p : Circle × 𝕀}, 1 / 2 ≤ (p.2 : ℝ) → τ p = ι (b (p.1, hiI p.2)) := fun {p} h => by + by_cases h' : (p.2 : ℝ) ≤ 1 / 2 + · have hp : (p.2 : ℝ) = 1 / 2 := le_antisymm h' h + have e1 : loI p.2 = 0 := Subtype.ext (by rw [loI_coe h', hp]; norm_num) + have e2 : hiI p.2 = 0 := Subtype.ext (by rw [hiI_coe h, hp]; norm_num) + rw [hτlo h', e1, e2, hhalf] + · exact ite_eq_right h' + let ψ : Y → T := fun z => if z ∈ range b then τ (f' z) else ι z + have hψb : ∀ p, ψ (b p) = τ p := fun p => by + simp only [ψ, mem_range_self, ite_true, hinv] + have hψn : ∀ {z}, z ∉ range b → ψ z = ι z := fun h => ite_eq_right h + have hJ₂b : ∀ z ∈ J₂, z ∉ range b := fun z hz h => hbr h hz + have hone : hiI 1 = 1 := Subtype.ext (by rw [hiI_coe (by simp; norm_num)]; norm_num) + have hψc : Continuous ψ := by + have cR : IsClosed (range b) := (isCompact_range hb).isClosed + have cB : IsClosed (range b \ b '' {x | x.2 = 1})ᶜ := hbo.isClosed_compl + have on1 : ContinuousOn ψ (range b) := by + have h2 : ContinuousOn f' (range b) := by simpa using hf' + refine (hτ.comp_continuousOn h2).congr fun z hz => ?_ + exact ite_eq_left hz + have on2 : ContinuousOn ψ (range b \ b '' {x | x.2 = 1})ᶜ := by + refine hι.continuousOn.congr fun z hz => ?_ + by_cases h : z ∈ range b + · have h3 : z ∈ b '' {x | x.2 = 1} := by + by_contra h4 + exact hz ⟨h, h4⟩ + obtain ⟨⟨w, t⟩, ht, rfl⟩ := h3 + obtain rfl : t = 1 := ht + rw [hψb, hτhi (by simp; norm_num), hone] + · exact hψn h + have h3 := on1.union_of_isClosed on2 cR cB + have h4 : range b ∪ (range b \ b '' {x | x.2 = 1})ᶜ = univ := by + rw [eq_univ_iff_forall] + intro z + by_cases h : z ∈ range b + · exact .inl h + · exact .inr fun h' => h h'.1 + rw [h4] at h3 + exact continuousOn_univ.mp h3 + have hψ0 : ∀ w, ψ (φ₁ w).1 = c (w, 1) := fun w => by + rw [← hb0, hψb, hτlo (by simp)] + have : loI 0 = 1 := Subtype.ext (by rw [loI_coe (by simp)]; norm_num) + simp only [this] + have hc1 : ∀ w, c (w, 1) ∈ ι '' J₂ := fun w => by + rw [h1] + exact ⟨w, rfl⟩ + have hc1i : ∀ {w w'}, c (w, 1) = c (w', 1) → w = w' := fun h => (Prod.ext_iff.mp (hci h)).1 + have hpre : J₁ ∪ J₂ = ψ ⁻¹' (ι '' J₂) := by + exact cut_handle_boundary_preimage (Y := Y) (T := T) (ι := ι) hιi (c := c) hci (J₁ := J₁) (J₂ + := J₂) φ₁ h1 b hb0 τ hτlo hτhi ψ hψb hψn hJ₂b hψ0 hc1 + have hCval : ∀ w (t : 𝕀), 0 < (t : ℝ) → (t : ℝ) < 1 / 2 → ∀ z, ψ (b (w, t)) = ι z → False := by + intro w t h2 h3 z he + rw [hψb, hτlo h3.le] at he + have h4 := loI_coe h3.le + rcases hm z _ he.symm with ⟨h5, -⟩ | ⟨h5, -⟩ + · simp only at h5 + linarith + · simp only at h5 + linarith + have hkind : ∀ z, z ∉ ψ ⁻¹' (ι '' J₂) → z ∉ range b ∨ (∃ w t, z = b (w, t) ∧ 1 / 2 ≤ (t : ℝ)) + ∨ ∃ w t, z = b (w, t) ∧ 0 < (t : ℝ) ∧ (t : ℝ) < 1 / 2 := by + intro z hz + by_cases h : z ∈ range b + · obtain ⟨⟨w, t⟩, rfl⟩ := h + by_cases h2 : 1 / 2 ≤ (t : ℝ) + · exact .inr (.inl ⟨w, t, rfl, h2⟩) + · refine .inr (.inr ⟨w, t, rfl, lt_of_le_of_ne t.2.1 fun h3 => hz ?_, not_le.mp h2⟩) + have h4 : t = 0 := Subtype.ext h3.symm + subst h4 + rw [← hpre, hb0] + exact .inl (φ₁ w).2 + · exact .inl h + have hinj : InjOn ψ (ψ ⁻¹' (ι '' J₂))ᶜ := by + intro y hy y' hy' he + rcases hkind y hy with h2 | ⟨w, t, rfl, h2⟩ | ⟨w, t, rfl, h2, h3⟩ + <;> rcases hkind y' hy' with h4 | ⟨w', t', rfl, h4⟩ | ⟨w', t', rfl, h4, h5⟩ + · rw [hψn h2, hψn h4] at he + exact hιi he + · rw [hψn h2, hψb, hτhi h4] at he + exact absurd ⟨_, (hιi he).symm⟩ h2 + · rw [hψn h2] at he + exact (hCval w' t' h4 h5 y he.symm).elim + · rw [hψn h4, hψb, hτhi h2] at he + exact absurd ⟨_, hιi he⟩ h4 + · rw [hψb, hψb, hτhi h2, hτhi h4] at he + have h6 := Prod.ext_iff.mp (hbi (hιi he)) + have h7 : (hiI t : ℝ) = hiI t' := congrArg Subtype.val h6.2 + rw [hiI_coe h2, hiI_coe h4] at h7 + have h8 : t = t' := Subtype.ext (by linarith) + rw [show w = w' from h6.1, h8] + · rw [hψb (w, t), hτhi h2] at he + exact (hCval w' t' h4 h5 _ he.symm).elim + · rw [hψn h4] at he + exact (hCval w t h2 h3 y' he).elim + · rw [hψb (w', t'), hτhi h4] at he + exact (hCval w t h2 h3 _ he).elim + · rw [hψb, hψb, hτlo h3.le, hτlo h5.le] at he + have h6 := Prod.ext_iff.mp (hci he) + have h7 : (loI t : ℝ) = loI t' := congrArg Subtype.val h6.2 + rw [loI_coe h3.le, loI_coe h5.le] at h7 + have h8 : t = t' := Subtype.ext (by linarith) + rw [show w = w' from h6.1, h8] + have hsurj : Function.Surjective ψ := by + intro x + rcases hcov x with ⟨y, rfl⟩ | ⟨⟨w, s⟩, rfl⟩ + · by_cases h : y ∈ range b + · obtain ⟨⟨w, s⟩, rfl⟩ := h + have hmem : (1 + (s : ℝ)) / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [s.2.1], by linarith [s.2.2]⟩ + have h2 : 1 / 2 ≤ (1 + (s : ℝ)) / 2 := by linarith [s.2.1] + refine ⟨b (w, ⟨_, hmem⟩), ?_⟩ + rw [hψb, hτhi h2] + have : hiI ⟨_, hmem⟩ = s := Subtype.ext (by rw [hiI_coe h2]; ring) + simp only [this] + · exact ⟨y, hψn h⟩ + · have hmem : (1 - (s : ℝ)) / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [s.2.2], by linarith [s.2.1]⟩ + have h2 : (1 - (s : ℝ)) / 2 ≤ 1 / 2 := by linarith [s.2.1] + refine ⟨b (w, ⟨_, hmem⟩), ?_⟩ + rw [hψb, hτlo h2] + have : loI ⟨_, hmem⟩ = s := Subtype.ext (by rw [loI_coe h2]; ring) + simp only [this] + have hcount : ∀ x ∈ ι '' J₂, (ψ ⁻¹' {x}).ncard = 2 := by + rintro _ ⟨j, hj, rfl⟩ + have h2 : ι j ∈ range fun w => c (w, 1) := h1 ▸ ⟨j, hj, rfl⟩ + obtain ⟨w, hw⟩ := h2 + have hw' : c (w, 1) = ι j := hw + have e : ψ ⁻¹' {ι j} = {j, (φ₁ w).1} := by + ext y + simp only [mem_preimage, mem_singleton_iff, mem_insert_iff] + constructor + · intro he + have h3 : y ∈ J₁ ∪ J₂ := by + rw [hpre] + exact ⟨j, hj, he.symm⟩ + rcases h3 with h3 | h3 + · right + obtain ⟨w', hw''⟩ := φ₁.surjective ⟨y, h3⟩ + have h4 : y = (φ₁ w').1 := by rw [hw''] + rw [h4, hψ0, ← hw'] at he + rw [h4, hc1i he] + · left + rw [hψn (hJ₂b y h3)] at he + exact hιi he + · rintro (rfl | rfl) + · exact hψn (hJ₂b y hj) + · rw [hψ0, hw'] + rw [e, ncard_pair] + exact fun h => Set.disjoint_left.mp hd (φ₁ w).2 (h ▸ hj) + refine ⟨ψ, ⟨hψc, hsurj, hinj, hcount, fun y hy => hbd (hpre ▸ hy)⟩, ⟨?_, ?_, ?_⟩, ⟨?_, ?_, ?_⟩, + hpre⟩ + · intro y hy + have : y ∈ ψ ⁻¹' (ι '' J₂) := hpre ▸ .inl hy + exact this + · intro y hy y' hy' he + obtain ⟨w, hw⟩ := φ₁.surjective ⟨y, hy⟩ + obtain ⟨w', hw'⟩ := φ₁.surjective ⟨y', hy'⟩ + have h2 : y = (φ₁ w).1 := by rw [hw] + have h3 : y' = (φ₁ w').1 := by rw [hw'] + rw [h2, h3, hψ0, hψ0] at he + rw [h2, h3, hc1i he] + · rintro x hx + rw [h1] at hx + obtain ⟨w, rfl⟩ := hx + exact ⟨(φ₁ w).1, (φ₁ w).2, hψ0 w⟩ + · intro y hy + have : y ∈ ψ ⁻¹' (ι '' J₂) := hpre ▸ .inr hy + exact this + · intro y hy y' hy' he + rw [hψn (hJ₂b y hy), hψn (hJ₂b y' hy')] at he + exact hιi he + · rintro _ ⟨j, hj, rfl⟩ + exact ⟨j, hj, hψn (hJ₂b j hj)⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Annulus.lean b/LeanPool/GraphMinor/Surface/Annulus.lean new file mode 100644 index 0000000000..4269c45909 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Annulus.lean @@ -0,0 +1,837 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Cap + +/-! +# The annulus between a round disc and an `O`-arc around it + +Let `F` be an `O`-arc of the plane with the closed unit disc in its inside. The annulus theorem in +this +setting says that a homeomorphism from the disc of radius `2` onto the closed domain of `F` is the +identity on the unit disc (`exists_annulus`). + +The two rays from `1` and from `-1` away from the origin, up to the first point of `F`, cut the part +between the unit circle and `F` into two closed domains with four sides each. The same holds for the +circle of radius `2` in place of `F`. By the Schoenflies theorem we may match the two pairs of +domains with any given matching of the four sides, and we paste the results. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +local notation "𝕀" => unitInterval + +universe u + +/-- A matching of two finite families of arcs of the plane that agree on where they meet. -/ +theorem exists_bdMatch_of_family {ι : Type*} [Finite ι] {a a' : ι → 𝕀 → ℂ} + (ha : ∀ i, IsArcMap (a i)) (ha' : ∀ i, IsArcMap (a' i)) + (h1 : ∀ i j s t, a i s = a j t → a' i s = a' j t) + (h2 : ∀ i j s t, a' i s = a' j t → a i s = a j t) : + ∃ h k : ℂ → ℂ, BdMatch (⋃ i, range (a i)) (⋃ i, range (a' i)) h k ∧ + ∀ i s, h (a i s) = a' i s := by + classical + have key : ∀ {a a' : ι → 𝕀 → ℂ}, (∀ i, IsArcMap (a i)) → (∀ i, IsArcMap (a' i)) → + (∀ i j s t, a i s = a j t → a' i s = a' j t) → + ∃ h : ℂ → ℂ, ContinuousOn h (⋃ i, range (a i)) ∧ ∀ i s, h (a i s) = a' i s := by + intro a a' ha ha' h1 + let h : ℂ → ℂ := fun z => if hz : ∃ p : ι × 𝕀, a p.1 p.2 = z then a' hz.choose.1 hz.choose.2 + else 0 + have hv : ∀ i s, h (a i s) = a' i s := fun i s => by + have hz : ∃ p : ι × 𝕀, a p.1 p.2 = a i s := ⟨(i, s), rfl⟩ + simp only [h, dite_eq_left hz] + exact h1 _ _ _ _ hz.choose_spec + refine ⟨h, ?_, hv⟩ + refine (locallyFinite_of_finite _).continuousOn_iUnion + (fun i => (isCompact_range (ha i).1).isClosed) fun i => ?_ + obtain ⟨f, hl, hf⟩ := (ha i).exists_inv + refine ((ha' i).1.comp_continuousOn hf).congr ?_ + rintro _ ⟨s, rfl⟩ + change h (a i s) = a' i (f (a i s)) + rw [hl, hv] + obtain ⟨h, hc, hv⟩ := key ha ha' h1 + obtain ⟨k, kc, kv⟩ := key ha' ha h2 + refine ⟨h, k, ⟨?_, ?_, ?_, ?_, hc, kc⟩, hv⟩ + · rintro _ hz + obtain ⟨i, s, rfl⟩ := mem_iUnion.mp hz + rw [hv] + exact mem_iUnion.mpr ⟨i, s, rfl⟩ + · rintro _ hz + obtain ⟨i, s, rfl⟩ := mem_iUnion.mp hz + rw [kv] + exact mem_iUnion.mpr ⟨i, s, rfl⟩ + · rintro _ hz + obtain ⟨i, s, rfl⟩ := mem_iUnion.mp hz + rw [hv, kv] + · rintro _ hz + obtain ⟨i, s, rfl⟩ := mem_iUnion.mp hz + show h (k (a' i s)) = _ + rw [kv, hv] + +/-- Two closed domains on the two sides of a cut, mapped on two matching sides of another cut, paste +to a map of the closed domain. -/ +theorem paste_cut {F F' : Set ℂ} {a b e a' b' e' : 𝕀 → ℂ} (c : IsCut F a b e) + (c' : IsCut F' a' b' e') + (J : IsJordanParts F) (J' : IsJordanParts F') {Θ₁ Θ₁' Θ₂ Θ₂' : ℂ → ℂ} + (m₁ : BdMatch (closedInner (side a e)) (closedInner (side a' e')) Θ₁ Θ₁') + (m₂ : BdMatch (closedInner (side b e)) (closedInner (side b' e')) Θ₂ Θ₂') + (h₁ : EqOn Θ₁ Θ₂ (range e)) (he : Θ₁ '' range e = range e') : + ∃ Θ Θ' : ℂ → ℂ, BdMatch (closedInner F) (closedInner F') Θ Θ' ∧ + EqOn Θ Θ₁ (closedInner (side a e)) ∧ EqOn Θ Θ₂ (closedInner (side b e)) := by + classical + obtain ⟨hu, -, -, hm, -, -⟩ := c.closedInner_facts J + obtain ⟨hu', -, -, hm', -, -⟩ := c'.closedInner_facts J' + obtain ⟨φ₁⟩ := c.oArc_side + obtain ⟨φ₂⟩ := c.symm.oArc_side + obtain ⟨φ₁'⟩ := c'.oArc_side + obtain ⟨φ₂'⟩ := c'.symm.oArc_side + have hcl : ∀ {G : Set ℂ}, Nonempty (Circle ≃ₜ G) → IsClosed (closedInner G) := fun hG => by + obtain ⟨φ⟩ := hG + exact (isJordanParts φ).isCompact_closure_inner.isClosed + have hA := hcl ⟨φ₁⟩ + have hB := hcl ⟨φ₂⟩ + have hA' := hcl ⟨φ₁'⟩ + have hB' := hcl ⟨φ₂'⟩ + set A := closedInner (side a e) + set B := closedInner (side b e) + set A' := closedInner (side a' e') + set B' := closedInner (side b' e') + have heA : range e ⊆ A := fun z hz => subset_union_right (Or.inr hz : z ∈ side a e) + have heB : range e ⊆ B := fun z hz => subset_union_right (Or.inr hz : z ∈ side b e) + have heA' : range e' ⊆ A' := fun z hz => subset_union_right (Or.inr hz : z ∈ side a' e') + -- the inverses agree on the cut + have h₂e : Θ₂ '' range e = range e' := by + rw [← he] + exact (image_congr h₁).symm + have hinv : EqOn Θ₁' Θ₂' (range e') := by + intro z hz + obtain ⟨w, hw, rfl⟩ := he.symm ▸ hz + rw [m₁.leftInvOn (heA hw), h₁ hw, m₂.leftInvOn (heB hw)] + let Θ : ℂ → ℂ := fun z => if z ∈ A then Θ₁ z else Θ₂ z + let Θ' : ℂ → ℂ := fun z => if z ∈ A' then Θ₁' z else Θ₂' z + have hΘA : EqOn Θ Θ₁ A := fun z hz => ite_eq_left hz + have hΘB : EqOn Θ Θ₂ B := fun z hz => by + by_cases h : z ∈ A + · have : Θ z = Θ₁ z := ite_eq_left h + rw [this] + exact h₁ (hm ⟨h, hz⟩) + · exact ite_eq_right h + have hΘA' : EqOn Θ' Θ₁' A' := fun z hz => ite_eq_left hz + have hΘB' : EqOn Θ' Θ₂' B' := fun z hz => by + by_cases h : z ∈ A' + · have : Θ' z = Θ₁' z := ite_eq_left h + rw [this] + exact hinv (hm' ⟨h, hz⟩) + · exact ite_eq_right h + have hc : ContinuousOn Θ (closedInner F) := by + rw [← hu] + exact ContinuousOn.union_of_isClosed ((m₁.2.2.2.2.1).congr hΘA) ((m₂.2.2.2.2.1).congr hΘB) hA hB + have hc' : ContinuousOn Θ' (closedInner F') := by + rw [← hu'] + exact ContinuousOn.union_of_isClosed ((m₁.2.2.2.2.2).congr hΘA') ((m₂.2.2.2.2.2).congr hΘB') + hA' hB' + refine ⟨Θ, Θ', ⟨?_, ?_, ?_, ?_, hc, hc'⟩, hΘA, hΘB⟩ + · rw [← hu, ← hu'] + rintro z (hz | hz) + · rw [hΘA hz] + exact .inl (m₁.1 hz) + · rw [hΘB hz] + exact .inr (m₂.1 hz) + · rw [← hu, ← hu'] + rintro z (hz | hz) + · rw [hΘA' hz] + exact .inl (m₁.2.1 hz) + · rw [hΘB' hz] + exact .inr (m₂.2.1 hz) + · rw [← hu] + rintro z (hz | hz) + · rw [hΘA hz, hΘA' (m₁.1 hz)] + exact m₁.2.2.1 hz + · rw [hΘB hz, hΘB' (m₂.1 hz)] + exact m₂.2.2.1 hz + · rw [← hu'] + rintro z (hz | hz) + · show Θ (Θ' z) = z + rw [hΘA' hz, hΘA (m₁.2.1 hz)] + exact m₁.2.2.2.1 hz + · show Θ (Θ' z) = z + rw [hΘB' hz, hΘB (m₂.2.1 hz)] + exact m₂.2.2.2.1 hz + +/-- Four arcs that form an `O`-arc in the order `u`, `p`, `x`, `m`. -/ +structure IsQuad (u p m x : 𝕀 → ℂ) : Prop where + arc_u : IsArcMap u + arc_p : IsArcMap p + arc_m : IsArcMap m + arc_x : IsArcMap x + up0 : u 0 = p 0 + um0 : u 1 = m 0 + px0 : p 1 = x 0 + mx1 : m 1 = x 1 + up : ∀ s t, u s = p t → s = 0 ∧ t = 0 + um : ∀ s t, u s = m t → s = 1 ∧ t = 0 + pm : ∀ s t, p s ≠ m t + px : ∀ s t, p s = x t → s = 1 ∧ t = 0 + mx : ∀ s t, m s = x t → s = 1 ∧ t = 1 + ux : ∀ s t, u s ≠ x t + +/-- The union of the four arcs. -/ +def quadSet (u p m x : 𝕀 → ℂ) : Set ℂ := range u ∪ range p ∪ range m ∪ range x + +/-- Four sides are matched by a homeomorphism of their unions. -/ +theorem exists_bdMatch_of_quads {u p m x u' p' m' x' : 𝕀 → ℂ} (Q : IsQuad u p m x) + (Q' : IsQuad u' p' m' x') : + ∃ h k : ℂ → ℂ, BdMatch (quadSet u p m x) (quadSet u' p' m' x') h k ∧ (∀ s, h (u s) = u' s) ∧ + (∀ s, h (p s) = p' s) ∧ (∀ s, h (m s) = m' s) ∧ ∀ s, h (x s) = x' s := by + have key : ∀ {u p m x u' p' m' x' : 𝕀 → ℂ}, IsQuad u p m x → IsQuad u' p' m' x' → + ∀ i j s t, ![u, p, m, x] i s = ![u, p, m, x] j t → + ![u', p', m', x'] i s = ![u', p', m', x'] j t := by + intro u p m x u' p' m' x' Q Q' i j s t he + fin_cases i <;> fin_cases j <;> + simp only [Nat.succ_eq_add_one, Nat.reduceAdd, Fin.zero_eta, Fin.isValue, Matrix.cons_val', + Matrix.cons_val_fin_one, Matrix.cons_val_zero, Fin.mk_one, Matrix.cons_val_one, + Fin.reduceFinMk, Matrix.cons_val] at he ⊢ + · rw [Q.arc_u.2 he] + · obtain ⟨rfl, rfl⟩ := Q.up s t he + exact Q'.up0 + · obtain ⟨rfl, rfl⟩ := Q.um s t he + exact Q'.um0 + · exact absurd he (Q.ux s t) + · obtain ⟨rfl, rfl⟩ := Q.up t s he.symm + exact Q'.up0.symm + · rw [Q.arc_p.2 he] + · exact absurd he (Q.pm s t) + · obtain ⟨rfl, rfl⟩ := Q.px s t he + exact Q'.px0 + · obtain ⟨rfl, rfl⟩ := Q.um t s he.symm + exact Q'.um0.symm + · exact absurd he.symm (Q.pm t s) + · rw [Q.arc_m.2 he] + · obtain ⟨rfl, rfl⟩ := Q.mx s t he + exact Q'.mx1 + · exact absurd he.symm (Q.ux t s) + · obtain ⟨rfl, rfl⟩ := Q.px t s he.symm + exact Q'.px0.symm + · obtain ⟨rfl, rfl⟩ := Q.mx t s he.symm + exact Q'.mx1.symm + · rw [Q.arc_x.2 he] + have harc : ∀ {u p m x : 𝕀 → ℂ}, IsQuad u p m x → ∀ i, IsArcMap (![u, p, m, x] i) := by + intro u p m x Q i + fin_cases i + · exact Q.arc_u + · exact Q.arc_p + · exact Q.arc_m + · exact Q.arc_x + have hset : ∀ {u p m x : 𝕀 → ℂ}, (⋃ i, range (![u, p, m, x] i)) = quadSet u p m x := by + intro u p m x + ext z + simp only [mem_iUnion, quadSet, mem_union] + constructor + · rintro ⟨i, hi⟩ + fin_cases i + · exact .inl (.inl (.inl hi)) + · exact .inl (.inl (.inr hi)) + · exact .inl (.inr hi) + · exact .inr hi + · rintro (((h | h) | h) | h) + · exact ⟨0, h⟩ + · exact ⟨1, h⟩ + · exact ⟨2, h⟩ + · exact ⟨3, h⟩ + obtain ⟨h, k, hm, hv⟩ := exists_bdMatch_of_family (harc Q) (harc Q') (key Q Q') (key Q' Q) + rw [hset, hset] at hm + exact ⟨h, k, hm, hv 0, hv 1, hv 2, hv 3⟩ + +/-- The first point of `F` on a ray that starts in the inside. -/ +theorem exists_first_hit {F : Set ℂ} (J : IsJordanParts F) (hFc : IsCompact F) + (hsub : closedBall (0 : ℂ) 1 ⊆ inner F) {u : ℂ} (hu : ‖u‖ = 1) : + ∃ t : ℝ, 1 < t ∧ (t : ℂ) * u ∈ F ∧ ∀ s ∈ Ico 1 t, (s : ℂ) * u ∈ inner F := by + let r : ℝ → ℂ := fun t => (t : ℂ) * u + have hr : Continuous r := Complex.continuous_ofReal.mul continuous_const + have hnorm : ∀ t : ℝ, 0 ≤ t → ‖r t‖ = t := fun t ht => by + simp only [r, norm_mul, hu, mul_one, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg ht] + have h1 : r 1 ∈ inner F := hsub (by simp [r, hu]) + have h1F : r 1 ∉ F := J.inner_subset_compl h1 + let A : Set ℝ := Ici 1 ∩ r ⁻¹' F + have hAc : IsClosed A := isClosed_Ici.inter (hFc.isClosed.preimage hr) + have hAne : A.Nonempty := by + by_contra hcon + have hdis : Disjoint (r '' Ici 1) F := Set.disjoint_left.mpr fun z hz hzF => by + obtain ⟨t, ht, rfl⟩ := hz + exact hcon ⟨t, ht, hzF⟩ + have hin := J.subset_inner (isPreconnected_Ici.image r hr.continuousOn) hdis + ⟨r 1, ⟨1, self_mem_Ici, rfl⟩, h1⟩ + obtain ⟨M, hM⟩ := J.isCompact_closure_inner.isBounded.subset_closedBall (0 : ℂ) + have h2 := hM (Or.inl (hin ⟨max 1 M + 1, by + have := le_max_left 1 M + change (1 : ℝ) ≤ _ + linarith, rfl⟩) : r (max 1 M + 1) ∈ inner F ∪ F) + rw [mem_closedBall_zero_iff, hnorm _ (by have := le_max_left 1 M; linarith)] at h2 + have := le_max_right 1 M + linarith + have hbdd : BddBelow A := ⟨1, fun x hx => hx.1⟩ + have hmem := hAc.csInf_mem hAne hbdd + set t := sInf A with ht + have h1t : 1 < t := lt_of_le_of_ne hmem.1 fun he => h1F (he ▸ hmem.2) + refine ⟨t, h1t, hmem.2, fun s hs => ?_⟩ + have hdis : Disjoint (r '' Ico 1 t) F := Set.disjoint_left.mpr fun z hz hzF => by + obtain ⟨x, hx, rfl⟩ := hz + have := csInf_le hbdd (⟨hx.1, hzF⟩ : x ∈ A) + linarith [hx.2] + exact J.subset_inner (isPreconnected_Ico.image r hr.continuousOn) hdis + ⟨r 1, ⟨1, ⟨le_rfl, h1t⟩, rfl⟩, h1⟩ ⟨s, hs, rfl⟩ + +/-- The upper half of the unit circle. -/ +noncomputable def upArc (s : 𝕀) : ℂ := cis' (Real.pi * s.1) + +/-- The lower half of the unit circle. -/ +noncomputable def loArc (s : 𝕀) : ℂ := cis' (-(Real.pi * s.1)) + +/-- A segment of the positive real axis from `1`. -/ +noncomputable def rayP (t : ℝ) (s : 𝕀) : ℂ := ((1 + s.1 * (t - 1) : ℝ) : ℂ) + +/-- A segment of the negative real axis from `-1`. -/ +noncomputable def rayM (t : ℝ) (s : 𝕀) : ℂ := -((1 + s.1 * (t - 1) : ℝ) : ℂ) + +theorem cis'_re (θ : ℝ) : (cis' θ).re = Real.cos θ := Complex.exp_ofReal_mul_I_re θ + +theorem cis'_im (θ : ℝ) : (cis' θ).im = Real.sin θ := Complex.exp_ofReal_mul_I_im θ + +theorem upArc_inj : Function.Injective upArc := fun s t he => by + have h1 := congrArg Complex.re he + simp only [upArc, cis'_re] at h1 + have hpi := Real.pi_pos + have hs : Real.pi * s.1 ∈ Icc 0 Real.pi := + ⟨mul_nonneg hpi.le s.2.1, by nlinarith [s.2.2]⟩ + have ht : Real.pi * t.1 ∈ Icc 0 Real.pi := + ⟨mul_nonneg hpi.le t.2.1, by nlinarith [t.2.2]⟩ + have h2 := Real.injOn_cos hs ht h1 + exact Subtype.ext (mul_left_cancel₀ hpi.ne' h2) + +theorem loArc_inj : Function.Injective loArc := fun s t he => by + apply upArc_inj + have h1 := congrArg Complex.re he + have h2 := congrArg Complex.im he + simp only [loArc, cis'_re, cis'_im, Real.cos_neg, Real.sin_neg] at h1 h2 + apply Complex.ext + · simpa only [upArc, cis'_re] using h1 + · simpa only [upArc, cis'_im] using neg_injective h2 + +theorem isArcMap_upArc : IsArcMap upArc := + ⟨continuous_cis'.comp (continuous_const.mul continuous_subtype_val), upArc_inj⟩ + +theorem isArcMap_loArc : IsArcMap loArc := + ⟨continuous_cis'.comp (continuous_const.mul continuous_subtype_val).neg, loArc_inj⟩ + +theorem isArcMap_rayP {t : ℝ} (ht : 1 < t) : IsArcMap (rayP t) := by + refine ⟨Complex.continuous_ofReal.comp (by fun_prop), fun s s' he => ?_⟩ + have h1 : 1 + s.1 * (t - 1) = 1 + s'.1 * (t - 1) := Complex.ofReal_injective he + have h2 : s.1 * (t - 1) = s'.1 * (t - 1) := by linarith + exact Subtype.ext (mul_right_cancel₀ (by linarith : t - 1 ≠ 0) h2) + +theorem isArcMap_rayM {t : ℝ} (ht : 1 < t) : IsArcMap (rayM t) := by + obtain ⟨h1, h2⟩ := isArcMap_rayP ht + exact ⟨h1.neg, fun s s' he => h2 (neg_injective he)⟩ + +theorem norm_upArc (s : 𝕀) : ‖upArc s‖ = 1 := norm_cis' _ + +theorem norm_loArc (s : 𝕀) : ‖loArc s‖ = 1 := norm_cis' _ + +theorem norm_rayP {t : ℝ} (ht : 1 < t) (s : 𝕀) : ‖rayP t s‖ = 1 + s.1 * (t - 1) := by + have : 0 ≤ s.1 * (t - 1) := mul_nonneg s.2.1 (by linarith) + rw [rayP, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (by linarith)] + +theorem norm_rayM {t : ℝ} (ht : 1 < t) (s : 𝕀) : ‖rayM t s‖ = 1 + s.1 * (t - 1) := by + rw [rayM, norm_neg] + exact norm_rayP ht s + +theorem eq_zero_of_norm_eq {t : ℝ} (ht : 1 < t) {s : 𝕀} (h : 1 + s.1 * (t - 1) = 1) : s = 0 := by + have h1 : s.1 * (t - 1) = 0 := by linarith + rcases mul_eq_zero.mp h1 with h2 | h2 + · exact Subtype.ext h2 + · linarith + +@[simp] theorem upArc_zero : upArc 0 = 1 := by simp [upArc, cis'] + +@[simp] theorem loArc_zero : loArc 0 = 1 := by simp [loArc, cis'] + +@[simp] theorem upArc_one : upArc 1 = -1 := by simp [upArc, cis'] + +@[simp] theorem loArc_one : loArc 1 = -1 := by + simp [loArc, cis', Complex.exp_neg] + +@[simp] theorem rayP_zero (t : ℝ) : rayP t 0 = 1 := by simp [rayP] + +@[simp] theorem rayM_zero (t : ℝ) : rayM t 0 = -1 := by simp [rayM] + +@[simp] theorem rayP_one (t : ℝ) : rayP t 1 = t := by simp [rayP] + +@[simp] theorem rayM_one (t : ℝ) : rayM t 1 = -(t : ℂ) := by simp [rayM] + +/-- A quadrilateral from a half of the unit circle, the two rays and an arc outside. -/ +theorem isQuad_of_halfCircle {u x : 𝕀 → ℂ} {tp tm : ℝ} (hu : IsArcMap u) (hx : IsArcMap x) + (hn : ∀ s, ‖u s‖ = 1) (hu0 : u 0 = 1) (hu1 : u 1 = -1) (htp : 1 < tp) (htm : 1 < tm) + (hx0 : x 0 = tp) (hx1 : x 1 = -(tm : ℂ)) (hxn : ∀ t, ‖x t‖ ≠ 1) + (hp : ∀ s t, rayP tp s = x t → s = 1) (hm : ∀ s t, rayM tm s = x t → s = 1) : + IsQuad u (rayP tp) (rayM tm) x := by + refine ⟨hu, isArcMap_rayP htp, isArcMap_rayM htm, hx, by simp [hu0], by simp [hu1], by simp [hx0], + by simp [hx1], fun s t he => ?_, fun s t he => ?_, fun s t he => ?_, fun s t he => ?_, + fun s t he => ?_, fun s t he => ?_⟩ + · have h1 : 1 + t.1 * (tp - 1) = 1 := by + rw [← norm_rayP htp, ← he, hn] + have h2 := eq_zero_of_norm_eq htp h1 + subst h2 + rw [rayP_zero, ← hu0] at he + exact ⟨hu.2 he, rfl⟩ + · have h1 : 1 + t.1 * (tm - 1) = 1 := by + rw [← norm_rayM htm, ← he, hn] + have h2 := eq_zero_of_norm_eq htm h1 + subst h2 + rw [rayM_zero, ← hu1] at he + exact ⟨hu.2 he, rfl⟩ + · have h1 := congrArg Complex.re he + simp only [rayP, rayM, Complex.ofReal_re, Complex.neg_re] at h1 + have h2 : 0 ≤ s.1 * (tp - 1) := mul_nonneg s.2.1 (by linarith) + have h3 : 0 ≤ t.1 * (tm - 1) := mul_nonneg t.2.1 (by linarith) + linarith + · obtain rfl := hp s t he + rw [rayP_one, ← hx0] at he + exact ⟨rfl, hx.2 he.symm ▸ rfl⟩ + · obtain rfl := hm s t he + rw [rayM_one, ← hx1] at he + exact ⟨rfl, hx.2 he.symm ▸ rfl⟩ + · exact hxn t (he ▸ hn s) + +/-- How the rays and the unit circle cut the domain of `F`. -/ +structure AnnCut (F : Set ℂ) (p m a b e b₂ : 𝕀 → ℂ) : Prop where + qa : IsQuad upArc p m a + qb : IsQuad loArc p m b + cut : IsCut F a b e + range_e : range e = range p ∪ range upArc ∪ range m + cut₂ : IsCut (side b e) upArc b₂ loArc + range_b : range b₂ = range p ∪ range b ∪ range m + +theorem range_upArc_union : range upArc ∪ range loArc = sphere 0 1 := by + ext z + constructor + · rintro (⟨s, rfl⟩ | ⟨s, rfl⟩) + · exact mem_sphere_zero_iff_norm.mpr (norm_upArc s) + · exact mem_sphere_zero_iff_norm.mpr (norm_loArc s) + · intro hz + have hn : ‖z‖ = 1 := mem_sphere_zero_iff_norm.mp hz + have hpi := Real.pi_pos + have harg := Complex.norm_mul_exp_arg_mul_I z + rw [hn] at harg + simp only [Complex.ofReal_one, one_mul] at harg + have h1 := Complex.neg_pi_lt_arg z + have h2 := Complex.arg_le_pi z + rcases le_total 0 (Complex.arg z) with h | h + · left + refine ⟨⟨Complex.arg z / Real.pi, div_nonneg h hpi.le, (div_le_one hpi).mpr h2⟩, ?_⟩ + change cis' (Real.pi * (Complex.arg z / Real.pi)) = z + rw [mul_div_cancel₀ _ hpi.ne', cis', harg] + · right + refine ⟨⟨-Complex.arg z / Real.pi, div_nonneg (by linarith) hpi.le, + (div_le_one hpi).mpr (by linarith)⟩, ?_⟩ + change cis' (-(Real.pi * (-Complex.arg z / Real.pi))) = z + rw [mul_div_cancel₀ _ hpi.ne', neg_neg, cis', harg] + +theorem exists_annCut {F : Set ℂ} (φ : Circle ≃ₜ F) (hsub : closedBall (0 : ℂ) 1 ⊆ inner F) : + ∃ p m a b e b₂, AnnCut F p m a b e b₂ := by + have J := isJordanParts φ + have hFc : IsCompact F := isCompact_of_oArc φ + obtain ⟨tp, htp, htpF, htpi⟩ := exists_first_hit J hFc hsub (u := 1) (by simp) + obtain ⟨tm, htm, htmF, htmi⟩ := exists_first_hit J hFc hsub (u := -1) (by simp) + simp only [mul_one, mul_neg] at htpF htpi htmF htmi + have hpin : ∀ s : 𝕀, s ≠ 1 → rayP tp s ∈ inner F := fun s hs => by + refine htpi _ ⟨?_, ?_⟩ + · have := mul_nonneg s.2.1 (by linarith : 0 ≤ tp - 1) + linarith + · have h1 : s.1 < 1 := lt_of_le_of_ne s.2.2 fun h => hs (Subtype.ext h) + nlinarith + have hmin : ∀ s : 𝕀, s ≠ 1 → rayM tm s ∈ inner F := fun s hs => by + refine htmi _ ⟨?_, ?_⟩ + · have := mul_nonneg s.2.1 (by linarith : 0 ≤ tm - 1) + linarith + · have h1 : s.1 < 1 := lt_of_le_of_ne s.2.2 fun h => hs (Subtype.ext h) + nlinarith + have hup : ∀ s, upArc s ∈ inner F := fun s => + hsub (mem_closedBall_zero_iff.mpr (norm_upArc s).le) + have hlo : ∀ s, loArc s ∈ inner F := fun s => + hsub (mem_closedBall_zero_iff.mpr (norm_loArc s).le) + have hnF : ∀ {z : ℂ}, z ∈ F → ‖z‖ ≠ 1 := fun hz hn => + J.inner_subset_compl (hsub (mem_closedBall_zero_iff.mpr hn.le)) hz + have hpF : ∀ s (z : ℂ), z ∈ F → rayP tp s = z → s = 1 := fun s z hz he => by + by_contra hs + exact J.inner_subset_compl (hpin s hs) (he ▸ hz) + have hmF : ∀ s (z : ℂ), z ∈ F → rayM tm s = z → s = 1 := fun s z hz he => by + by_contra hs + exact J.inner_subset_compl (hmin s hs) (he ▸ hz) + -- the three arcs of the chord + let r : 𝕀 → ℂ := fun s => rayP tp (unitInterval.symm s) + have hr : IsArcMap r := ⟨(isArcMap_rayP htp).1.comp unitInterval.continuous_symm, + (isArcMap_rayP htp).2.comp unitInterval.symm_bijective.injective⟩ + have hrup : ∀ s t, r s = upArc t → s = 1 ∧ t = 0 := fun s t he => by + have h1 : 1 + (unitInterval.symm s).1 * (tp - 1) = 1 := by + rw [← norm_rayP htp, show rayP tp _ = r s from rfl, he, norm_upArc] + have h2 := eq_zero_of_norm_eq htp h1 + have h3 : s = 1 := by + have := congrArg unitInterval.symm h2 + simpa using this + subst h3 + have h4 : r 1 = 1 := by simp [r] + rw [h4] at he + exact ⟨rfl, upArc_inj (he.symm.trans upArc_zero.symm)⟩ + obtain ⟨c₁, hc₁, hc₁r, hc₁0, hc₁1⟩ := exists_arc_join hr isArcMap_upArc (by simp [r]) hrup + have hc₁m : ∀ s t, c₁ s = rayM tm t → s = 1 ∧ t = 0 := fun s t he => by + have h1 : c₁ s ∈ range r ∪ range upArc := hc₁r ▸ ⟨s, rfl⟩ + rcases h1 with ⟨x, hx⟩ | ⟨x, hx⟩ + · exfalso + have h2 := congrArg Complex.re (hx.trans he) + simp only [r, rayP, rayM, Complex.ofReal_re, Complex.neg_re] at h2 + have h3 := mul_nonneg (unitInterval.symm x).2.1 (by linarith : 0 ≤ tp - 1) + have h4 := mul_nonneg t.2.1 (by linarith : 0 ≤ tm - 1) + linarith + · have h1' : 1 + t.1 * (tm - 1) = 1 := by + rw [← norm_rayM htm, ← he, ← hx, norm_upArc] + have h2 := eq_zero_of_norm_eq htm h1' + subst h2 + refine ⟨hc₁.2 ?_, rfl⟩ + rw [he, hc₁1] + simp + obtain ⟨e, he, her, he0, he1⟩ := exists_arc_join hc₁ (isArcMap_rayM htm) (by simp [hc₁1]) hc₁m + have hrr : range r = range (rayP tp) := by + ext z + constructor + · rintro ⟨s, rfl⟩ + exact ⟨_, rfl⟩ + · rintro ⟨s, rfl⟩ + exact ⟨unitInterval.symm s, by simp [r]⟩ + have hrange_e : range e = range (rayP tp) ∪ range upArc ∪ range (rayM tm) := by + rw [her, hc₁r, hrr] + have he0' : e 0 = tp := by simp [he0, hc₁0, r] + have he1' : e 1 = -(tm : ℂ) := by simp [he1] + have hne : e 0 ≠ e 1 := by + rw [he0', he1'] + intro h + have h1 := congrArg Complex.re h + simp at h1 + linarith + have hin : ∀ t, t ≠ 0 → t ≠ 1 → e t ∈ inner F := by + intro t h0 h1 + have hmem : e t ∈ range (rayP tp) ∪ range upArc ∪ range (rayM tm) := hrange_e ▸ ⟨t, rfl⟩ + rcases hmem with (⟨s, hs⟩ | ⟨s, hs⟩) | ⟨s, hs⟩ + · rw [← hs] + refine hpin s fun h => h0 (he.2 ?_) + rw [← hs, h, rayP_one, he0'] + · rw [← hs] + exact hup s + · rw [← hs] + refine hmin s fun h => h1 (he.2 ?_) + rw [← hs, h, rayM_one, he1'] + obtain ⟨a, b, c⟩ := exists_isCut φ he hne (he0' ▸ htpF) (he1' ▸ htmF) hin + -- the lower half circle lies on one side + let Lo : Set ℂ := (fun r : ℝ => cis' (-(Real.pi * r))) '' Ioo 0 1 + have hLoc : IsPreconnected Lo := + isPreconnected_Ioo.image _ (continuous_cis'.comp (by fun_prop)).continuousOn + have hLolo : ∀ s : 𝕀, s ≠ 0 → s ≠ 1 → loArc s ∈ Lo := fun s h0 h1 => + ⟨s.1, ⟨lt_of_le_of_ne s.2.1 fun h => h0 (Subtype.ext h.symm), + lt_of_le_of_ne s.2.2 fun h => h1 (Subtype.ext h)⟩, rfl⟩ + have hsinpos : ∀ r ∈ Ioo (0 : ℝ) 1, 0 < Real.sin (Real.pi * r) := fun r hr => + Real.sin_pos_of_pos_of_lt_pi (mul_pos Real.pi_pos hr.1) (by nlinarith [Real.pi_pos, hr.2]) + have hLoe : Disjoint Lo (range e) := Set.disjoint_left.mpr fun z hz hze => by + obtain ⟨x, hx, rfl⟩ := hz + have hs := hsinpos x hx + have him : (cis' (-(Real.pi * x))).im < 0 := by + rw [cis'_im, Real.sin_neg] + linarith + rw [hrange_e] at hze + rcases hze with (⟨s, hs'⟩ | ⟨s, hs'⟩) | ⟨s, hs'⟩ + · replace hs' : rayP tp s = cis' (-(Real.pi * x)) := hs' + rw [← hs'] at him + simp [rayP] at him + · replace hs' : upArc s = cis' (-(Real.pi * x)) := hs' + rw [← hs', upArc, cis'_im] at him + have := Real.sin_nonneg_of_nonneg_of_le_pi (mul_nonneg Real.pi_pos.le s.2.1) + (by nlinarith [s.2.2, Real.pi_pos] : Real.pi * s.1 ≤ Real.pi) + linarith + · replace hs' : rayM tm s = cis' (-(Real.pi * x)) := hs' + rw [← hs'] at him + simp [rayM] at him + have hLoin : Lo ⊆ inner F \ range e := fun z hz => by + refine ⟨?_, Set.disjoint_left.mp hLoe hz⟩ + obtain ⟨x, -, rfl⟩ := hz + exact hsub (mem_closedBall_zero_iff.mpr (norm_cis' _).le) + have T := c.isTheta J + have hLosub : Lo ⊆ inner (side a e) ∪ inner (side b e) := by + rw [← T.inner_sdiff] + exact hLoin + have hLone : Lo.Nonempty := ⟨_, 1 / 2, by norm_num, rfl⟩ + have hside : ∀ {a b : 𝕀 → ℂ}, IsCut F a b e → Lo ⊆ inner (side b e) → + ∃ p m a b e b₂, AnnCut F p m a b e b₂ := by + intro a b c hLo + have hb₀ : b 0 = tp := by rw [c.b_zero, he0'] + have hb₁ : b 1 = -(tm : ℂ) := by rw [c.b_one, he1'] + have ha₀ : a 0 = tp := by rw [c.a_zero, he0'] + have ha₁ : a 1 = -(tm : ℂ) := by rw [c.a_one, he1'] + have qa : IsQuad upArc (rayP tp) (rayM tm) a := isQuad_of_halfCircle isArcMap_upArc c.arc_a + norm_upArc upArc_zero upArc_one htp htm ha₀ ha₁ (fun t => hnF (c.a_mem t)) + (fun s t h => hpF s _ (c.a_mem t) h) fun s t h => hmF s _ (c.a_mem t) h + have qb : IsQuad loArc (rayP tp) (rayM tm) b := isQuad_of_halfCircle isArcMap_loArc c.arc_b + norm_loArc loArc_zero loArc_one htp htm hb₀ hb₁ (fun t => hnF (c.b_mem t)) + (fun s t h => hpF s _ (c.b_mem t) h) fun s t h => hmF s _ (c.b_mem t) h + obtain ⟨j, hj, hjr, hj0, hj1⟩ := exists_arc_join (isArcMap_rayP htp) c.arc_b + (by simp [hb₀]) qb.px + let q : 𝕀 → ℂ := fun s => rayM tm (unitInterval.symm s) + have hq : IsArcMap q := ⟨(isArcMap_rayM htm).1.comp unitInterval.continuous_symm, + (isArcMap_rayM htm).2.comp unitInterval.symm_bijective.injective⟩ + have hqr : range q = range (rayM tm) := by + ext z + constructor + · rintro ⟨s, rfl⟩ + exact ⟨_, rfl⟩ + · rintro ⟨s, rfl⟩ + exact ⟨unitInterval.symm s, by simp [q]⟩ + have hjq : ∀ s t, j s = q t → s = 1 ∧ t = 0 := fun s t hh => by + have h1 : j s ∈ range (rayP tp) ∪ range b := hjr ▸ ⟨s, rfl⟩ + rcases h1 with ⟨x, hx⟩ | ⟨x, hx⟩ + · exact absurd (hx.trans hh) (qb.pm x _) + · have h2 := qb.mx (unitInterval.symm t) x (hh.symm.trans hx.symm) + obtain ⟨h3, rfl⟩ := h2 + have h4 : t = 0 := by + have := congrArg unitInterval.symm h3 + simpa using this + refine ⟨hj.2 ?_, h4⟩ + rw [← hx, hj1] + obtain ⟨b₂, hb₂, hb₂r, hb₂0, hb₂1⟩ := exists_arc_join hj hq (by simp [hj1, q, hb₁]) hjq + have hb₂rr : range b₂ = range (rayP tp) ∪ range b ∪ range (rayM tm) := by + rw [hb₂r, hjr, hqr] + have hb₂0' : b₂ 0 = 1 := by simp [hb₂0, hj0] + have hb₂1' : b₂ 1 = -1 := by simp [hb₂1, q] + have hcut₂ : IsCut (side b e) upArc b₂ loArc := by + refine ⟨isArcMap_upArc, hb₂, isArcMap_loArc, by simp, by simp, by simp [hb₂0'], + by simp [hb₂1'], by simp; norm_num, ?_, ?_, ?_⟩ + · rw [side, hb₂rr, hrange_e] + ext z + simp only [mem_union] + tauto + · intro s t hh + have h1 : b₂ t ∈ range (rayP tp) ∪ range b ∪ range (rayM tm) := hb₂rr ▸ ⟨t, rfl⟩ + rcases h1 with (⟨x, hx⟩ | ⟨x, hx⟩) | ⟨x, hx⟩ + · obtain ⟨h2, rfl⟩ := qa.up s x (hh.trans hx.symm) + refine .inl ⟨h2, hb₂.2 ?_⟩ + rw [← hx, hb₂0'] + simp + · exact absurd (by rw [hx, ← hh, norm_upArc]) (hnF (c.b_mem x)) + · obtain ⟨h2, rfl⟩ := qa.um s x (hh.trans hx.symm) + refine .inr ⟨h2, hb₂.2 ?_⟩ + rw [← hx, hb₂1'] + simp + · intro t h0 h1 + exact hLo (hLolo t h0 h1) + exact ⟨_, _, a, b, e, b₂, qa, qb, c, hrange_e, hcut₂, hb₂rr⟩ + rcases hLoc.subset_or_subset T.parts₁.isOpen_inner T.parts₂.isOpen_inner T.disjoint_inner hLosub + with h | h + · exact hside c.symm h + · exact hside c h + +theorem closedInner_sphere_two : + Nonempty (Circle ≃ₜ sphere (0 : ℂ) 2) ∧ closedInner (sphere (0 : ℂ) 2) = closedBall 0 2 := by + have hd := isClosedDisc_of_convex (K := closedBall (0 : ℂ) 2) (convex_closedBall 0 2) + (by rw [interior_closedBall _ (by norm_num)]; exact ⟨0, by simp⟩) isBounded_closedBall + isClosed_closedBall + rw [frontier_closedBall _ (by norm_num)] at hd + have h1 : Nonempty (Circle ≃ₜ sphere (0 : ℂ) 2) := by + have := hd.1.isOArc_discBd + rwa [hd.2] at this + exact ⟨h1, (eq_closedInner_of_discBd h1 hd.1 hd.2).symm⟩ + +/-- **The annulus theorem in the plane.** See the module docstring. -/ +theorem exists_annulus {F : Set ℂ} (φ : Circle ≃ₜ F) (hsub : closedBall (0 : ℂ) 1 ⊆ inner F) : + ∃ Θ Θ' : ℂ → ℂ, BdMatch (closedBall 0 2) (closedInner F) Θ Θ' ∧ + EqOn Θ id (closedBall 0 1) ∧ Θ '' sphere 0 2 = F := by + obtain ⟨hF₀, hcl₀⟩ := closedInner_sphere_two + obtain ⟨φ₀⟩ := id hF₀ + have hsub₀ : closedBall (0 : ℂ) 1 ⊆ inner (sphere 0 2) := by + have h1 : inner (sphere (0 : ℂ) 2) = closedInner (sphere (0 : ℂ) 2) \ sphere 0 2 := by + have := (isJordanParts φ₀).inner_subset_compl + ext z + constructor + · exact fun hz => ⟨.inl hz, this hz⟩ + · rintro ⟨hz | hz, h2⟩ + · exact hz + · exact absurd hz h2 + rw [h1, hcl₀] + intro z hz + have h2 := mem_closedBall_zero_iff.mp hz + refine ⟨closedBall_subset_closedBall (by norm_num) hz, fun h3 => ?_⟩ + rw [mem_sphere_zero_iff_norm] at h3 + linarith + obtain ⟨p, m, a, b, e, b₂, A⟩ := exists_annCut φ hsub + obtain ⟨p₀, m₀, a₀, b₀, e₀, b₂₀, A₀⟩ := exists_annCut φ₀ hsub₀ + have J := isJordanParts φ + have J₀ := isJordanParts φ₀ + -- sides + have hsa : side a e = quadSet upArc p m a := by + rw [side, A.range_e, quadSet] + ext z + simp only [mem_union] + tauto + have hsa₀ : side a₀ e₀ = quadSet upArc p₀ m₀ a₀ := by + rw [side, A₀.range_e, quadSet] + ext z + simp only [mem_union] + tauto + have hsb : side b₂ loArc = quadSet loArc p m b := by + rw [side, A.range_b, quadSet] + ext z + simp only [mem_union] + tauto + have hsb₀ : side b₂₀ loArc = quadSet loArc p₀ m₀ b₀ := by + rw [side, A₀.range_b, quadSet] + ext z + simp only [mem_union] + tauto + have hsu : side upArc loArc = sphere 0 1 := range_upArc_union + -- the part below + obtain ⟨h₂, k₂, m₂, hu₂, hp₂, hm₂, hx₂⟩ := exists_bdMatch_of_quads A₀.qb A.qb + have ho₂₀ : Nonempty (Circle ≃ₜ quadSet loArc p₀ m₀ b₀) := hsb₀ ▸ A₀.cut₂.symm.oArc_side + have ho₂ : Nonempty (Circle ≃ₜ quadSet loArc p m b) := hsb ▸ A.cut₂.symm.oArc_side + obtain ⟨ψ₂, χ₂, n₂, he₂⟩ := exists_bdMatch_closedInner ho₂₀ ho₂ m₂ + -- the part above + obtain ⟨h₁, k₁, m₁, hu₁, hp₁, hm₁, hx₁⟩ := exists_bdMatch_of_quads A₀.qa A.qa + have ho₁₀ : Nonempty (Circle ≃ₜ quadSet upArc p₀ m₀ a₀) := hsa₀ ▸ A₀.cut.oArc_side + have ho₁ : Nonempty (Circle ≃ₜ quadSet upArc p m a) := hsa ▸ A.cut.oArc_side + obtain ⟨ψ₁, χ₁, n₁, he₁⟩ := exists_bdMatch_closedInner ho₁₀ ho₁ m₁ + have hJ₂ : IsJordanParts (side b e) := by + obtain ⟨φ'⟩ := A.cut.symm.oArc_side + exact isJordanParts φ' + have hJ₂₀ : IsJordanParts (side b₀ e₀) := by + obtain ⟨φ'⟩ := A₀.cut.symm.oArc_side + exact isJordanParts φ' + have hbm : BdMatch (closedBall 0 1) (closedBall 0 1) id id := + ⟨mapsTo_id _, mapsTo_id _, fun _ _ => rfl, fun _ _ => rfl, continuousOn_id, continuousOn_id⟩ + have hid : BdMatch (closedInner (side upArc loArc)) (closedInner (side upArc loArc)) id id := by + rw [hsu, closedInner_sphere] + exact hbm + have hlo₂ : ∀ s, loArc s ∈ quadSet loArc p₀ m₀ b₀ := fun s => .inl (.inl (.inl ⟨s, rfl⟩)) + have hψ₂lo : ∀ s, ψ₂ (loArc s) = loArc s := fun s => by rw [he₂ (hlo₂ s), hu₂] + obtain ⟨Θ₃, Θ₃', n₃, hΘ₃a, hΘ₃b⟩ := paste_cut A₀.cut₂ A.cut₂ hJ₂₀ hJ₂ hid + (by rw [hsb₀, hsb]; exact n₂) + (by + rintro _ ⟨s, rfl⟩ + exact (hψ₂lo s).symm) + (by simp) + have hsubin : ∀ {G : Set ℂ}, G ⊆ closedInner G := fun h => Or.inr h + have hz₁ : ∀ z ∈ closedBall (0 : ℂ) 1, Θ₃ z = z := fun z hz => by + have : z ∈ closedInner (side upArc loArc) := by + rw [hsu, closedInner_sphere] + exact hz + exact hΘ₃a this + have hp₃ : ∀ s, Θ₃ (p₀ s) = p s := fun s => by + have h1 : p₀ s ∈ quadSet loArc p₀ m₀ b₀ := .inl (.inl (.inr ⟨s, rfl⟩)) + have h2 : p₀ s ∈ closedInner (side b₂₀ loArc) := by + rw [hsb₀] + exact hsubin h1 + rw [hΘ₃b h2, he₂ h1, hp₂] + have hm₃ : ∀ s, Θ₃ (m₀ s) = m s := fun s => by + have h1 : m₀ s ∈ quadSet loArc p₀ m₀ b₀ := .inl (.inr ⟨s, rfl⟩) + have h2 : m₀ s ∈ closedInner (side b₂₀ loArc) := by + rw [hsb₀] + exact hsubin h1 + rw [hΘ₃b h2, he₂ h1, hm₂] + have hb₃ : ∀ s, Θ₃ (b₀ s) = b s := fun s => by + have h1 : b₀ s ∈ quadSet loArc p₀ m₀ b₀ := .inr ⟨s, rfl⟩ + have h2 : b₀ s ∈ closedInner (side b₂₀ loArc) := by + rw [hsb₀] + exact hsubin h1 + rw [hΘ₃b h2, he₂ h1, hx₂] + have hq₁ : ∀ {z}, z ∈ range e₀ → z ∈ quadSet upArc p₀ m₀ a₀ := fun hz => by + rw [← hsa₀] + exact .inr hz + obtain ⟨Θ, Θ', n, hΘa, hΘb⟩ := paste_cut A₀.cut A.cut J₀ J + (by rw [hsa₀, hsa]; exact n₁) n₃ + (by + intro z hz + rw [A₀.range_e] at hz + rw [he₁ (hq₁ (A₀.range_e ▸ hz))] + rcases hz with (⟨s, rfl⟩ | ⟨s, rfl⟩) | ⟨s, rfl⟩ + · rw [hp₁, hp₃] + · rw [hu₁, hz₁ _ (mem_closedBall_zero_iff.mpr (norm_upArc s).le)] + · rw [hm₁, hm₃]) + (by + ext w + constructor + · rintro ⟨z, hz, rfl⟩ + rw [he₁ (hq₁ hz), A.range_e] + rw [A₀.range_e] at hz + rcases hz with (⟨s, rfl⟩ | ⟨s, rfl⟩) | ⟨s, rfl⟩ + · rw [hp₁] + exact .inl (.inl ⟨s, rfl⟩) + · rw [hu₁] + exact .inl (.inr ⟨s, rfl⟩) + · rw [hm₁] + exact .inr ⟨s, rfl⟩ + · intro hw + rw [A.range_e] at hw + rcases hw with (⟨s, rfl⟩ | ⟨s, rfl⟩) | ⟨s, rfl⟩ + · have h1 : p₀ s ∈ range e₀ := by + rw [A₀.range_e] + exact .inl (.inl ⟨s, rfl⟩) + exact ⟨_, h1, by rw [he₁ (hq₁ h1), hp₁]⟩ + · have h1 : upArc s ∈ range e₀ := by + rw [A₀.range_e] + exact .inl (.inr ⟨s, rfl⟩) + exact ⟨_, h1, by rw [he₁ (hq₁ h1), hu₁]⟩ + · have h1 : m₀ s ∈ range e₀ := by + rw [A₀.range_e] + exact .inr ⟨s, rfl⟩ + exact ⟨_, h1, by rw [he₁ (hq₁ h1), hm₁]⟩) + rw [hcl₀] at n + have hbin : ∀ z ∈ closedInner (side b₂₀ loArc) ∪ closedInner (side upArc loArc), + z ∈ closedInner (side b₀ e₀) := fun z hz => by + have := (A₀.cut₂.closedInner_facts hJ₂₀).1 + rw [← this, union_comm] + exact hz + refine ⟨Θ, Θ', n, fun z hz => ?_, ?_⟩ + · have h1 : z ∈ closedInner (side upArc loArc) := by + rw [hsu, closedInner_sphere] + exact hz + rw [hΘb (hbin z (.inr h1)), hz₁ z hz] + rfl + · have ha₀ : ∀ s, Θ (a₀ s) = a s := fun s => by + have h1 : a₀ s ∈ quadSet upArc p₀ m₀ a₀ := .inr ⟨s, rfl⟩ + have h2 : a₀ s ∈ closedInner (side a₀ e₀) := by + rw [hsa₀] + exact hsubin h1 + rw [hΘa h2, he₁ h1, hx₁] + have hb₀ : ∀ s, Θ (b₀ s) = b s := fun s => by + have h2 : b₀ s ∈ closedInner (side b₀ e₀) := hsubin (Or.inl ⟨s, rfl⟩) + rw [hΘb h2, hb₃] + rw [← A₀.cut.union, ← A.cut.union, image_union] + congr 1 + · ext w + constructor + · rintro ⟨_, ⟨s, rfl⟩, rfl⟩ + exact ⟨s, (ha₀ s).symm⟩ + · rintro ⟨s, rfl⟩ + exact ⟨_, ⟨s, rfl⟩, ha₀ s⟩ + · ext w + constructor + · rintro ⟨_, ⟨s, rfl⟩, rfl⟩ + exact ⟨s, (hb₀ s).symm⟩ + · rintro ⟨s, rfl⟩ + exact ⟨_, ⟨s, rfl⟩, hb₀ s⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/ArcDisc.lean b/LeanPool/GraphMinor/Surface/ArcDisc.lean new file mode 100644 index 0000000000..02a15a001f --- /dev/null +++ b/LeanPool/GraphMinor/Surface/ArcDisc.lean @@ -0,0 +1,624 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ArcPlane +public import LeanPool.GraphMinor.Surface.DiscMerge +public import LeanPool.GraphMinor.Surface.DiscsInSurface +public import LeanPool.GraphMinor.Surface.Cap +import Mathlib.Analysis.Complex.ReImTopology + +/-! +# A closed disc around an arc + +Every arc `L` of a closed surface lies inside a closed disc (`exists_disc_of_arc`), and this disc +can be chosen with a chart that makes `L` a straight segment. + +Near an arc in a chart we use the strip coordinates of `exists_straight`: the arc lies on the real +axis (`exists_stripChart`). A map of the plane that is the identity on the frontier of a compact set +extends to the surface by the identity (`exists_glue`). + +To swallow an arc, suppose that a disc holds the first part of it. The next part lies in a chart. +Slide the points of this strip to the left along the real axis, by a homeomorphism `h` of the +surface that is the identity off a thin rectangle. If the rectangle is thin enough, `h` maps all of +the longer arc into the disc, so the preimage under `h` of the disc holds the longer arc. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter Complex + +local notation "𝕀" => unitInterval + +variable {T : Type} [TopologicalSpace T] + +/-- `K` is an injective continuous open map on the open set `O` of the plane. -/ +structure StripChart (O : Set ℂ) (K : ℂ → T) : Prop where + isOpen : IsOpen O + hc : ContinuousOn K O + hi : InjOn K O + ho : ∀ W, IsOpen W → W ⊆ O → IsOpen (K '' W) + +theorem exp_strip_inj {x x' y y' : ℝ} (hx : x ∈ Ioo (-Real.pi) Real.pi) (hx' : x' ∈ Ioo + (-Real.pi) Real.pi) + (hy : 0 < 1 + y) (hy' : 0 < 1 + y') + (h : ((1 + y : ℝ) : ℂ) * exp (x * I) = ((1 + y' : ℝ) : ℂ) * exp (x' * I)) : x = x' ∧ y = y' + := by + have h1 := congrArg norm h + rw [norm_mul, norm_mul, norm_exp_ofReal_mul_I, norm_exp_ofReal_mul_I, Complex.norm_real, + Complex.norm_real, + Real.norm_of_nonneg hy.le, Real.norm_of_nonneg hy'.le, mul_one, mul_one] at h1 + have hyy : y = y' := by linarith + subst hyy + have h2 : exp (x * I) = exp (x' * I) := mul_left_cancel₀ (by exact_mod_cast hy.ne') h + obtain ⟨n, hn⟩ := Complex.exp_eq_exp_iff_exists_int.mp h2 + have h3 : x = x' + n * (2 * Real.pi) := by + have h4 := congrArg Complex.im hn + simp at h4 + linarith + have hpi := Real.pi_pos + have h5 : (n : ℝ) * (2 * Real.pi) < 2 * Real.pi := by linarith [hx.2, hx'.1] + have h6 : -(2 * Real.pi) < (n : ℝ) * (2 * Real.pi) := by linarith [hx.1, hx'.2] + have h7 : (n : ℝ) < 1 := by nlinarith + have h8 : (-1 : ℝ) < n := by nlinarith + have h9 : n = 0 := by + have h10 : n < 1 := by exact_mod_cast h7 + have h11 : -1 < n := by exact_mod_cast h8 + omega + subst h9 + exact ⟨by simpa using h3, rfl⟩ + +/-- An arc in a chart of a surface lies on the real axis of a strip chart. -/ +theorem exists_stripChart (hman : ∀ x : T, IsManifoldPoint x) {R : ℝ} {U : Set T} {h : T + → ℂ} {g : ℂ → T} + (c : BallChart R U h g) {a : 𝕀 → T} (ha : IsArcMap a) (hU : range a ⊆ U) : + ∃ (O : Set ℂ) (K : ℂ → T) (θ : 𝕀 → ℝ), StripChart O K ∧ Continuous θ ∧ StrictMono θ ∧ + ∀ t, (θ t : ℂ) ∈ O ∧ K (θ t) = a t := by + have hac : Continuous fun t => h (a t) := + c.hc.comp_continuous ha.1 fun t => hU (mem_range_self t) + have hai : Function.Injective fun t => h (a t) := fun s t he => ha.2 (by + have := congrArg g he + rwa [c.gh (hU (mem_range_self s)), c.gh (hU (mem_range_self t))] at this) + obtain ⟨G, θ, hθc, hθm, hθr, hGa⟩ := exists_straight (a := fun t => h (a t)) ⟨hac, hai⟩ + let S : ℂ → ℂ := fun z => G.symm (((1 + z.im : ℝ) : ℂ) * exp ((z.re : ℂ) * I)) + have hSc : Continuous S := by + refine G.symm.continuous.comp ?_ + have h1 : Continuous fun z : ℂ => (z.re : ℂ) := continuous_ofReal.comp continuous_re + have h2 : Continuous fun z : ℂ => ((1 + z.im : ℝ) : ℂ) := continuous_ofReal.comp (by fun_prop) + fun_prop + let O : Set ℂ := {z | z.re ∈ Ioo (-Real.pi) Real.pi ∧ z.im ∈ Ioo (-1 : ℝ) 1 ∧ S z ∈ ball 0 R} + have hOo : IsOpen O := by + refine IsOpen.inter (isOpen_Ioo.preimage continuous_re) (IsOpen.inter + (isOpen_Ioo.preimage continuous_im) (isOpen_ball.preimage hSc)) + have hK : ContinuousOn (fun z => g (S z)) O := + c.gc.comp hSc.continuousOn fun z hz => hz.2.2 + have hKi : InjOn (fun z => g (S z)) O := by + intro z hz w hw he + have h1 : S z = S w := by + have := congrArg h he + simpa only [c.hg hz.2.2, c.hg hw.2.2] using this + have h2 := exp_strip_inj hz.1 hw.1 (by linarith [hz.2.1.1]) (by linarith [hw.2.1.1]) + (G.symm.injective h1) + exact Complex.ext h2.1 h2.2 + refine ⟨O, fun z => g (S z), θ, ⟨hOo, hK, hKi, fun W hW hWO => ?_⟩, hθc, hθm, fun t => ?_⟩ + · exact isOpen_image_of_manifold hW (hK.mono hWO) (hKi.mono hWO) fun z _ => hman _ + · have hS : S (θ t) = h (a t) := by + simp only [S, ofReal_re, ofReal_im, add_zero, ofReal_one, one_mul] + rw [← hGa, G.symm_apply_apply] + refine ⟨⟨by simpa using hθr t, by simp, ?_⟩, ?_⟩ + · rw [hS] + exact c.hm (hU (mem_range_self t)) + · simp only [hS] + exact c.gh (hU (mem_range_self t)) + +/-- A map of the plane that is the identity on the frontier of a compact set `R` extends, by the +identity, to the surface. There is a space of parameters, so that this gives homotopies as well. -/ +theorem exists_glue [T2Space T] {P : Type*} [TopologicalSpace P] {O : Set ℂ} {K : ℂ → T} + (hK : StripChart O K) + {R : Set ℂ} (hR : IsCompact R) (hRO : R ⊆ O) (Φ : P × ℂ → ℂ) (hΦ : ContinuousOn Φ (univ ×ˢ R)) + (hm : ∀ p, ∀ z ∈ R, Φ (p, z) ∈ R) (hid : ∀ p, ∀ z ∈ frontier R, Φ (p, z) = z) : + ∃ c : P × T → T, Continuous c ∧ (∀ p, ∀ z ∈ R, c (p, K z) = K (Φ (p, z))) + ∧ ∀ p, ∀ x ∉ K '' R, c (p, x) = x := by + classical + rcases isEmpty_or_nonempty ℂ with he | he + · exact (he.false 0).elim + let J : T → ℂ := Function.invFunOn K O + have hJ : ∀ z ∈ O, J (K z) = z := fun z hz => hK.hi.leftInvOn_invFunOn hz + have hKR : IsClosed (K '' R) := (hR.image_of_continuousOn (hK.hc.mono hRO)).isClosed + have hJc : ContinuousOn J (K '' R) := by + rw [continuousOn_iff_isClosed] + intro t ht + refine ⟨K '' (R ∩ t), ((hR.inter_right ht).image_of_continuousOn (hK.hc.mono + (inter_subset_left.trans hRO))).isClosed, ?_⟩ + ext x + constructor + · rintro ⟨hx, z, hz, rfl⟩ + have h1 : z ∈ t := by simpa [hJ z (hRO hz)] using hx + exact ⟨⟨z, ⟨hz, h1⟩, rfl⟩, ⟨z, hz, rfl⟩⟩ + · rintro ⟨⟨z, hz, rfl⟩, hx⟩ + refine ⟨?_, hx⟩ + change J (K z) ∈ t + rw [hJ z (hRO hz.1)] + exact hz.2 + have hint : IsOpen (K '' interior R) := hK.ho _ isOpen_interior (interior_subset.trans hRO) + let c : P × T → T := fun q => if q.2 ∈ K '' R then K (Φ (q.1, J q.2)) else q.2 + have hc1 : ContinuousOn c (univ ×ˢ (K '' R)) := by + have h1 : ContinuousOn (fun q : P × T => K (Φ (q.1, J q.2))) (univ ×ˢ (K '' R)) := by + have h2 : ContinuousOn (fun q : P × T => (q.1, J q.2)) (univ ×ˢ (K '' R)) := + continuousOn_fst.prodMk (hJc.comp continuousOn_snd fun q hq => hq.2) + have h3 : MapsTo (fun q : P × T => (q.1, J q.2)) (univ ×ˢ (K '' R)) (univ ×ˢ R) := by + rintro ⟨p, x⟩ ⟨-, z, hz, rfl⟩ + refine ⟨mem_univ _, ?_⟩ + change J (K z) ∈ R + rwa [hJ z (hRO hz)] + have h4 := hΦ.comp h2 h3 + refine (hK.hc.comp h4 ?_) + rintro ⟨p, x⟩ ⟨-, z, hz, rfl⟩ + have h5 : J (K z) = z := hJ z (hRO hz) + change Φ (p, J (K z)) ∈ O + rw [h5] + exact hRO (hm p z hz) + refine h1.congr ?_ + rintro ⟨p, x⟩ ⟨-, hx⟩ + exact ite_eq_left hx + have hc2 : ContinuousOn c (univ ×ˢ (K '' interior R)ᶜ) := by + have h1 : ContinuousOn (fun q : P × T => q.2) (univ ×ˢ (K '' interior R)ᶜ) := continuousOn_snd + refine h1.congr ?_ + rintro ⟨p, x⟩ ⟨-, hx⟩ + change (if x ∈ K '' R then _ else _) = _ + split_ifs with hxR + · obtain ⟨z, hz, rfl⟩ := hxR + have hfr : z ∈ frontier R := by + rw [hR.isClosed.frontier_eq] + exact ⟨hz, fun hi => hx ⟨z, hi, rfl⟩⟩ + change K (Φ (p, J (K z))) = K z + rw [hJ z (hRO hz), hid p z hfr] + · rfl + have hcov : (univ ×ˢ (K '' R)) ∪ (univ ×ˢ (K '' interior R)ᶜ) = (univ : Set (P × T)) := by + ext ⟨p, x⟩ + simp only [mem_union, mem_prod, mem_univ, true_and, iff_true] + by_cases hx : x ∈ K '' interior R + · exact .inl (image_mono interior_subset hx) + · exact .inr hx + refine ⟨c, ?_, fun p z hz => ?_, fun p x hx => ?_⟩ + · rw [← continuousOn_univ, ← hcov] + exact hc1.union_of_isClosed hc2 (isClosed_univ.prod hKR) (isClosed_univ.prod + hint.isClosed_compl) + · change (if K z ∈ K '' R then _ else _) = _ + rw [ite_eq_left (show K z ∈ K '' R from ⟨z, hz, rfl⟩), hJ z (hRO hz)] + · exact ite_eq_right hx + +/-- A convex broken line: it fixes the two ends `a`, `b`, and sends `m` to the smaller number `x`. +-/ +theorem exists_slide_fun {a x m b : ℝ} (h1 : a < x) (h2 : x < m) (h3 : m < b) : + ∃ ψ : ℝ → ℝ, Continuous ψ ∧ StrictMono ψ ∧ ψ a = a ∧ ψ b = b ∧ ψ m = x ∧ ∀ y ≤ b, a ≤ y → ψ y + ≤ y := by + set l := (x - a) / (m - a) with hl + set μ := (b - x) / (b - m) with hμ + have hma : 0 < m - a := by linarith + have hbm : 0 < b - m := by linarith + have hl0 : 0 < l := div_pos (by linarith) hma + have hl1 : l < 1 := (div_lt_one hma).mpr (by linarith) + have hμ1 : 1 < μ := (one_lt_div hbm).mpr (by linarith) + have e1 : l * (m - a) = x - a := div_mul_cancel₀ _ hma.ne' + have e2 : μ * (b - m) = b - x := div_mul_cancel₀ _ hbm.ne' + refine ⟨fun y => max (a + l * (y - a)) (b + μ * (y - b)), by fun_prop, ?_, ?_, ?_, ?_, ?_⟩ + · intro y z hyz + apply max_lt + · exact lt_max_of_lt_left (by nlinarith) + · exact lt_max_of_lt_right (by nlinarith) + · simp only + rw [max_eq_left (by nlinarith)] + ring + · simp only + rw [max_eq_right (by nlinarith)] + ring + · simp only + rw [max_eq_left (by nlinarith)] + linarith + · intro y hy hay + simp only + exact max_le (by nlinarith) (by nlinarith) + +/-- A slide in a rectangle of a strip chart: a homeomorphism of the surface that is the identity off +the rectangle `R` and moves points of `R` to the left, and by the function `ψ` on the real axis. -/ +theorem exists_slide [CompactSpace T] [T2Space T] {O : Set ℂ} {K : ℂ → T} + (hK : StripChart O K) {a b ε : ℝ} (hab : a < b) + (hε : 0 < ε) (hRO : Icc a b ×ℂ Icc (-ε) ε ⊆ O) {ψ : ℝ → ℝ} (hc : Continuous ψ) + (hm : StrictMono ψ) (ha : ψ a = a) + (hb : ψ b = b) (hle : ∀ y ≤ b, a ≤ y → ψ y ≤ y) : + ∃ e : T ≃ₜ T, (∀ x ∉ K '' (Icc a b ×ℂ Icc (-ε) ε), e x = x) ∧ (∀ x ∈ Icc a b, e (K x) = K + (ψ x)) ∧ + ∀ z ∈ Icc a b ×ℂ Icc (-ε) ε, ∃ w ∈ Icc a b ×ℂ Icc (-ε) ε, w.re ≤ z.re ∧ w.im = z.im ∧ e (K z) + = K w := by + classical + set R := Icc a b ×ℂ Icc (-ε) ε with hR + have hRc : IsCompact R := isCompact_Icc.reProdIm isCompact_Icc + let s : ℂ → ℝ := fun z => 1 - |z.im| / ε + have hs : ∀ z ∈ R, s z ∈ Icc (0 : ℝ) 1 := fun z hz => by + have h1 : |z.im| ≤ ε := abs_le.mpr hz.2 + refine ⟨?_, by simp only [s]; linarith [div_nonneg (abs_nonneg z.im) hε.le]⟩ + simp only [s] + linarith [(div_le_one hε).mpr h1] + let f : ℝ → ℝ → ℝ := fun t x => x + t * (ψ x - x) + have hfm : ∀ t ∈ Icc (0 : ℝ) 1, StrictMono (f t) := fun t ht x y h => by + have h1 := hm h + simp only [f] + have h2 : 0 ≤ (1 - t) * (y - x) := mul_nonneg (by linarith [ht.2]) (by linarith) + have h3 : 0 ≤ t * (ψ y - ψ x) := mul_nonneg ht.1 (by linarith) + rcases lt_or_eq_of_le ht.2 with h4 | h4 + · have h5 : 0 < (1 - t) * (y - x) := mul_pos (by linarith) (by linarith) + nlinarith + · subst h4 + linarith + have hfa : ∀ t, f t a = a := fun t => by simp [f, ha] + have hfb : ∀ t, f t b = b := fun t => by simp [f, hb] + have hfc : ∀ t, Continuous (f t) := fun t => by simp only [f]; fun_prop + have hfl : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ Icc a b, f t x ≤ x := fun t ht x hx => by + have := hle x hx.2 hx.1 + simp only [f] + nlinarith [ht.1, mul_nonneg ht.1 (sub_nonneg.mpr this)] + have hfI : ∀ t ∈ Icc (0 : ℝ) 1, ∀ x ∈ Icc a b, f t x ∈ Icc a b := fun t ht x hx => + ⟨by rw [← hfa t]; exact (hfm t ht).monotone hx.1, (hfl t ht x hx).trans hx.2⟩ + let Φ : Unit × ℂ → ℂ := fun q => (f (s q.2) q.2.re : ℂ) + q.2.im * I + have hΦc : Continuous Φ := by + simp only [Φ, f, s] + have : Continuous fun q : Unit × ℂ => q.2.re := continuous_re.comp continuous_snd + have h2 : Continuous fun q : Unit × ℂ => q.2.im := continuous_im.comp continuous_snd + have h3 : Continuous fun q : Unit × ℂ => ψ q.2.re := hc.comp this + have h4 : Continuous fun q : Unit × ℂ => (q.2.re + (1 - |q.2.im| / ε) * + (ψ q.2.re - q.2.re) : ℝ) := by fun_prop + exact (continuous_ofReal.comp h4).add ((continuous_ofReal.comp h2).mul continuous_const) + have hΦre : ∀ q, (Φ q).re = f (s q.2) q.2.re := fun q => by simp [Φ] + have hΦim : ∀ q, (Φ q).im = q.2.im := fun q => by simp [Φ] + have hΦR : ∀ z ∈ R, Φ ((), z) ∈ R := fun z hz => by + refine mem_reProdIm.mpr ⟨?_, ?_⟩ + · rw [hΦre] + exact hfI _ (hs z hz) _ hz.1 + · rw [hΦim] + exact hz.2 + have hfr : ∀ z ∈ frontier R, Φ ((), z) = z := by + intro z hz + rw [hRc.isClosed.frontier_eq, hR, interior_reProdIm, interior_Icc, interior_Icc] at hz + obtain ⟨hz1, hz2⟩ := hz + apply Complex.ext + · rw [hΦre] + simp only [f] + by_cases h1 : z.re = a + · rw [h1, ha]; ring + by_cases h2 : z.re = b + · rw [h2, hb]; ring + have h3 : z.im ∉ Ioo (-ε) ε := fun h3 => hz2 ⟨⟨lt_of_le_of_ne hz1.1.1 + (Ne.symm h1), lt_of_le_of_ne hz1.1.2 h2⟩, h3⟩ + have h4 : |z.im| = ε := by + have h5 := abs_le.mpr hz1.2 + refine le_antisymm h5 ?_ + by_contra h6 + exact h3 (abs_lt.mp (not_le.mp h6)) + have h5 : s z = 0 := by simp only [s]; rw [h4, div_self hε.ne']; ring + rw [h5] + ring + · rw [hΦim] + obtain ⟨c, hcc, hc1, hc2⟩ := exists_glue hK hRc hRO Φ hΦc.continuousOn (fun _ z hz => hΦR z hz) + (fun _ z hz => hfr z hz) + let h : T → T := fun x => c ((), x) + have hhc : Continuous h := hcc.comp (by fun_prop) + have hinj : Function.Injective h := by + have key : ∀ z ∈ R, ∀ w ∈ R, Φ ((), z) = Φ ((), w) → z = w := by + intro z hz w hw he + have h1 : z.im = w.im := by + have := congrArg Complex.im he + rwa [hΦim, hΦim] at this + have h2 : s z = s w := by simp only [s, h1] + have h3 := congrArg Complex.re he + rw [hΦre, hΦre] at h3 + simp only at h3 + rw [h2] at h3 + exact Complex.ext ((hfm _ (hs w hw)).injective h3) h1 + intro x y he + by_cases hx : x ∈ K '' R <;> by_cases hy : y ∈ K '' R + · obtain ⟨z, hz, rfl⟩ := hx + obtain ⟨w, hw, rfl⟩ := hy + simp only [h, hc1 _ z hz, hc1 _ w hw] at he + rw [key z hz w hw (hK.hi (hRO (hΦR z hz)) (hRO (hΦR w hw)) he)] + · obtain ⟨z, hz, rfl⟩ := hx + simp only [h, hc1 _ z hz, hc2 _ y hy] at he + exact absurd ⟨_, hΦR z hz, he⟩ hy + · obtain ⟨w, hw, rfl⟩ := hy + simp only [h, hc1 _ w hw, hc2 _ x hx] at he + exact absurd ⟨_, hΦR w hw, he.symm⟩ hx + · simpa only [h, hc2 _ x hx, hc2 _ y hy] using he + have hsurj : Function.Surjective h := by + intro y + by_cases hy : y ∈ K '' R + · obtain ⟨w, hw, rfl⟩ := hy + have hsw := hs w hw + obtain ⟨x, hx, hxe⟩ : w.re ∈ f (s w) '' Icc a b := by + refine intermediate_value_Icc hab.le (hfc _).continuousOn ?_ + rw [hfa, hfb] + exact hw.1 + refine ⟨K ((x : ℂ) + w.im * I), ?_⟩ + have hz : ((x : ℂ) + w.im * I) ∈ R := ⟨by simpa using hx, by simpa using hw.2⟩ + simp only [h] + rw [hc1 _ _ hz] + congr 1 + apply Complex.ext + · rw [hΦre] + have h1 : s ((x : ℂ) + w.im * I) = s w := by simp [s] + rw [h1] + simpa using hxe + · rw [hΦim] + simp + · exact ⟨y, hc2 _ y hy⟩ + let e : T ≃ₜ T := Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective h ⟨hinj, hsurj⟩) hhc + have he : ∀ x, e x = c ((), x) := fun _ => rfl + refine ⟨e, fun x hx => by rw [he, hc2 _ x hx], fun x hx => ?_, fun z hz => ?_⟩ + · have hz : (x : ℂ) ∈ R := ⟨by simpa using hx, by simp [hε.le]⟩ + rw [he, hc1 _ _ hz] + congr 1 + apply Complex.ext + · rw [hΦre] + have h1 : s (x : ℂ) = 1 := by simp [s] + rw [h1] + simp [f] + · rw [hΦim] + simp + · refine ⟨Φ ((), z), hΦR z hz, ?_, hΦim _, by rw [he, hc1 _ z hz]⟩ + rw [hΦre] + exact hfl _ (hs z hz) _ hz.1 + +theorem isOpen_discInt (hman : ∀ x : T, IsManifoldPoint x) {D : Set T} + (hD : IsClosedDisc D) : IsOpen (discInt D) := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + rw [c.discInt_eq] + exact c.isOpen_image_ball hman + +/-- A closed disc around a point of a closed surface, with the point inside. -/ +theorem exists_disc_at (hT : IsClosedSurface T) (y : T) : ∃ D, IsClosedDisc D ∧ y ∈ discInt D := by + obtain ⟨U, h, g, c, -, hy⟩ := (hT.2.2 y).exists_ballChart isOpen_univ (mem_univ _) (R := 2) + (by norm_num) + have hsub : closedBall (0 : ℂ) 1 ⊆ ball 0 2 := closedBall_subset_ball (by norm_num) + have hD : IsClosedDisc (closedBall (0 : ℂ) 1) := (isClosedDisc_of_convex (convex_closedBall 0 1) + (by + rw [interior_closedBall _ one_ne_zero] + exact ⟨0, by simp⟩) isBounded_closedBall isClosed_closedBall).1 + obtain ⟨h1, h2⟩ := c.image_disc hD hsub + have hb : discBd (closedBall (0 : ℂ) 1) = sphere 0 1 := by + rw [(isClosedDisc_of_convex (convex_closedBall 0 1) (by + rw [interior_closedBall _ one_ne_zero] + exact ⟨0, by simp⟩) isBounded_closedBall isClosed_closedBall).2, + frontier_closedBall _ one_ne_zero] + refine ⟨_, h1, ⟨0, by simp, hy⟩, ?_⟩ + rw [h2, hb] + rintro ⟨z, hz, he⟩ + have h3 : z = 0 := by + have h4 := congrArg h (he.trans hy.symm) + rw [c.hg (hsub (sphere_subset_closedBall hz)), c.hg (show (0 : ℂ) ∈ ball 0 2 by simp)] at h4 + exact h4 + rw [h3] at hz + simp at hz + +theorem image_sub_compact {θ : 𝕀 → ℝ} (hθ : Continuous θ) {s t : 𝕀} (hst : s ≤ t) {x : ℝ} + (hx : x ∈ Icc (θ s) (θ t)) : + ∃ r ∈ Icc s t, θ r = x := + intermediate_value_Icc hst hθ.continuousOn hx + +/-- One step of swallowing an arc. -/ +theorem disc_step (hT : IsClosedSurface T) {a : 𝕀 → T} (ha : IsArcMap a) {τ₁ : 𝕀} (hτ : 0 < τ₁) + (hB : ∀ τ < τ₁, ∃ D, IsClosedDisc D ∧ a '' Iic τ ⊆ discInt D) : + ∃ D, IsClosedDisc D ∧ a '' Iic τ₁ ⊆ discInt D := by + classical + have hcpt : CompactSpace T := hT.1 + have ht2 : T2Space T := hT.2.1 + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + obtain ⟨U, h, g, c, -, hy⟩ := (hT.2.2 (a τ₁)).exists_ballChart isOpen_univ (mem_univ _) (R + := 1) one_pos + have hUo : a ⁻¹' U ∈ 𝓝 τ₁ := by + refine ha.1.continuousAt.preimage_mem_nhds (c.isOpen.mem_nhds ?_) + rw [← hy] + exact c.gm (by simp) + obtain ⟨l, hl, hsub⟩ := exists_Ioc_subset_of_mem_nhds hUo ⟨0, hτ⟩ + obtain ⟨τb, hb1, hb2⟩ := exists_between hl + obtain ⟨D, hD, hDs⟩ := hB τb hb2 + have hDo := isOpen_discInt hman hD + -- the arc in the chart + have hne : τb ≠ τ₁ := hb2.ne + let J : 𝕀 → T := subArc a τb τ₁ + have hJ : IsArcMap J := ha.sub hne + have hJr : range J = a '' Icc τb τ₁ := range_subArc a hb2.le + have hJU : range J ⊆ U := by + rw [hJr] + rintro _ ⟨t, ht, rfl⟩ + exact hsub ⟨hb1.trans_le ht.1, ht.2⟩ + obtain ⟨O, K, θ, hK, hθc, hθm, hθ⟩ := exists_stripChart hman c hJ hJU + set α := θ 0 with hα + set β := θ 1 with hβ + have hαβ : α < β := hθm zero_lt_one + have hJ0 : J 0 = a τb := by simp [J, subArc_zero] + have hbI : a τb ∈ discInt D := hDs ⟨τb, self_mem_Iic, rfl⟩ + have hV : J ⁻¹' discInt D ∈ 𝓝 (0 : 𝕀) := hJ.1.continuousAt.preimage_mem_nhds (hDo.mem_nhds + (by rw [hJ0]; exact hbI)) + obtain ⟨u, hu, hus⟩ := exists_Ico_subset_of_mem_nhds hV ⟨1, zero_lt_one⟩ + obtain ⟨r₀, hr0, hr1⟩ := exists_between hu + have hr01 : r₀ < 1 := hr1.trans_le u.2.2 + set x := θ r₀ with hx + have hαx : α < x := hθm hr0 + have hxβ : x < β := hθm hr01 + -- the two open sets of the plane + set A := a '' Iic τb with hA + have hAc : IsClosed A := (isClosed_Iic.isCompact.image ha.1).isClosed + let W₁ : Set ℂ := O ∩ K ⁻¹' discInt D + let W₂ : Set ℂ := O ∩ K ⁻¹' Aᶜ + have hW₁ : IsOpen W₁ := hK.hc.isOpen_inter_preimage hK.isOpen hDo + have hW₂ : IsOpen W₂ := hK.hc.isOpen_inter_preimage hK.isOpen hAc.isOpen_compl + have hS₁ : ((↑) : ℝ → ℂ) '' Icc α x ⊆ W₁ := by + rintro _ ⟨y, hy', rfl⟩ + obtain ⟨r, hr, rfl⟩ := image_sub_compact hθc hr0.le hy' + refine ⟨(hθ r).1, ?_⟩ + change K (θ r) ∈ discInt D + rw [(hθ r).2] + exact hus ⟨hr.1, hr.2.trans_lt hr1⟩ + have hS₂ : ((↑) : ℝ → ℂ) '' Icc x β ⊆ W₂ := by + rintro _ ⟨y, hy', rfl⟩ + obtain ⟨r, hr, rfl⟩ := image_sub_compact hθc hr01.le hy' + refine ⟨(hθ r).1, ?_⟩ + change K (θ r) ∉ A + rw [(hθ r).2] + rintro ⟨t, ht, he⟩ + have h1 : t = lerpI τb τ₁ r := ha.2 he + have hrpos : (0 : ℝ) < r.1 := hr0.trans_le hr.1 + have hb3 : τb.1 < τ₁.1 := hb2 + have h2 : t.1 ≤ τb.1 := ht + rw [h1] at h2 + change (1 - r.1) * τb.1 + r.1 * τ₁.1 ≤ τb.1 at h2 + nlinarith [mul_pos hrpos (sub_pos.mpr hb3)] + obtain ⟨η₁, hη₁, ht₁⟩ := ((isCompact_Icc.image continuous_ofReal).exists_cthickening_subset_open + hW₁ hS₁) + obtain ⟨η₂, hη₂, ht₂⟩ := ((isCompact_Icc.image continuous_ofReal).exists_cthickening_subset_open + hW₂ hS₂) + set η := min η₁ η₂ with hη + have hηpos : 0 < η := lt_min hη₁ hη₂ + set δ := min (η / 2) (1 : ℝ) with hδ + have hδpos : 0 < δ := lt_min (by positivity) one_pos + have hδη : δ ≤ η / 2 := min_le_left _ _ + set R := Icc (α - δ) (β + δ) ×ℂ Icc (-δ) δ with hR + -- points of the rectangle are near a point of the axis + have near : ∀ z ∈ R, ∀ p q : ℝ, p ≤ q → z.re ∈ Icc (p - δ) (q + δ) → ∃ y ∈ Icc p q, ‖z - (y : ℂ)‖ + ≤ η := by + intro z hz p q hpq hzr + refine ⟨max p (min q z.re), ⟨le_max_left _ _, max_le hpq (min_le_left _ _)⟩, ?_⟩ + set y := max p (min q z.re) with hy' + have h1 : |z.re - y| ≤ δ := by + rw [abs_le] + constructor + · have : y ≤ max p z.re := max_le_max_left _ (min_le_right _ _) + rcases le_total p z.re with h | h + · rw [max_eq_right h] at this + linarith [this, hδpos] + · rw [max_eq_left h] at this + linarith [hzr.1] + · have h2 : min q z.re ≤ y := le_max_right _ _ + rcases le_total q z.re with h | h + · rw [min_eq_left h] at h2 + linarith [hzr.2] + · rw [min_eq_right h] at h2 + linarith + have h2 : |z.im| ≤ δ := abs_le.mpr hz.2 + have h3 : ‖z - (y : ℂ)‖ ≤ |(z - (y : ℂ)).re| + |(z - (y : ℂ)).im| := norm_le_abs_re_add_abs_im _ + simp only [sub_re, ofReal_re, sub_im, ofReal_im, sub_zero] at h3 + linarith + have inW₁ : ∀ z ∈ R, z.re ≤ x → z ∈ W₁ := fun z hz hzx => by + obtain ⟨y, hy', hn⟩ := near z hz α x hαx.le ⟨hz.1.1, by linarith⟩ + refine ht₁ (mem_cthickening_of_dist_le z (y : ℂ) _ _ ⟨y, hy', rfl⟩ ?_) + rw [dist_eq_norm] + exact hn.trans (min_le_left _ _) + have inW₂ : ∀ z ∈ R, x ≤ z.re → z ∈ W₂ := fun z hz hzx => by + obtain ⟨y, hy', hn⟩ := near z hz x β hxβ.le ⟨by linarith, hz.1.2⟩ + refine ht₂ (mem_cthickening_of_dist_le z (y : ℂ) _ _ ⟨y, hy', rfl⟩ ?_) + rw [dist_eq_norm] + exact hn.trans (min_le_right _ _) + have hRO : R ⊆ O := fun z hz => by + rcases le_total z.re x with h1 | h1 + · exact (inW₁ z hz h1).1 + · exact (inW₂ z hz h1).1 + obtain ⟨ψ, hψc, hψm, hψa, hψb, hψβ, hψl⟩ := exists_slide_fun (a := α - δ) (x := x) (m := β) (b + := β + δ) (by linarith) hxβ (by linarith) + obtain ⟨e, he1, he2, he3⟩ := exists_slide hK (a := α - δ) (b := β + δ) (ε := δ) + (by linarith) hδpos hRO hψc hψm hψa hψb hψl + have hDe := (hD.image (f := e.symm) (f' := e) e.symm.continuous.continuousOn + e.continuous.continuousOn fun y _ => e.apply_symm_apply y) + refine ⟨e.symm '' D, hDe.1, ?_⟩ + have key : ∀ t ≤ τ₁, e (a t) ∈ discInt D := by + intro t ht + rcases le_or_gt t τb with h1 | h1 + · have hmem : a t ∈ A := ⟨t, h1, rfl⟩ + by_cases hin : a t ∈ K '' R + · obtain ⟨z, hz, hze⟩ := hin + obtain ⟨w, hw, hwz, -, hew⟩ := he3 z hz + have hzx : z.re ≤ x := by + by_contra hc + have := (inW₂ z hz (not_le.mp hc).le).2 + exact this (hze ▸ hmem) + rw [← hze, hew] + exact (inW₁ w hw (hwz.trans hzx)).2 + · rw [he1 _ hin] + exact hDs hmem + · obtain ⟨r, hr⟩ : ∃ r, lerpI τb τ₁ r = t := by + have : t ∈ range (lerpI τb τ₁) := by + rw [range_lerpI hb2.le] + exact ⟨h1.le, ht⟩ + exact this + have hJr' : a t = K (θ r) := by rw [(hθ r).2, ← hr]; rfl + have hIcc : θ r ∈ Icc (α - δ) (β + δ) := ⟨by + have : α ≤ θ r := hθm.monotone r.2.1 + linarith, by + have : θ r ≤ β := hθm.monotone r.2.2 + linarith⟩ + rw [hJr', he2 _ hIcc] + have hψlower : α - δ ≤ ψ (θ r) := by + rw [← hψa] + exact hψm.monotone hIcc.1 + have hψmem : ψ (θ r) ∈ Icc (α - δ) (β + δ) := + ⟨hψlower, (hψl _ hIcc.2 hIcc.1).trans hIcc.2⟩ + have hψR : ((ψ (θ r) : ℝ) : ℂ) ∈ R := + mem_reProdIm.mpr ⟨by simpa using hψmem, by simp [hδpos.le]⟩ + refine (inW₁ _ hψR ?_).2 + have h2 : θ r ≤ β := hθm.monotone r.2.2 + have h3 := hψm.monotone h2 + rw [hψβ] at h3 + simpa using h3 + rintro _ ⟨t, ht, rfl⟩ + refine ⟨⟨e (a t), (key t ht).1, e.symm_apply_apply _⟩, ?_⟩ + rw [hDe.2] + rintro ⟨w, hw, he⟩ + have : w = e (a t) := by rw [← he, e.apply_symm_apply] + exact (key t ht).2 (this ▸ hw) + +/-- **A closed disc around an arc.** In a closed surface, every arc lies inside a closed disc. -/ +theorem exists_disc_of_arc (hT : IsClosedSurface T) {a : 𝕀 → T} (ha : IsArcMap a) : + ∃ D, IsClosedDisc D ∧ range a ⊆ discInt D := by + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + let B : Set 𝕀 := {τ | ∃ D, IsClosedDisc D ∧ a '' Iic τ ⊆ discInt D} + have hlow : ∀ {s t : 𝕀}, s ≤ t → t ∈ B → s ∈ B := fun h ⟨D, hD, hs⟩ => + ⟨D, hD, (image_mono (Iic_subset_Iic.mpr h)).trans hs⟩ + have h0 : (0 : 𝕀) ∈ B := by + obtain ⟨D, hD, hy⟩ := exists_disc_at hT (a 0) + refine ⟨D, hD, ?_⟩ + rintro _ ⟨t, ht, rfl⟩ + have : t = 0 := le_antisymm ht t.2.1 + rwa [this] + have hsup : sSup B ∈ B := by + by_cases hz : sSup B = 0 + · rwa [hz] + · refine disc_step hT ha (lt_of_le_of_ne (bot_le) (Ne.symm hz)) fun τ hτ => ?_ + obtain ⟨t, ht, hτt⟩ := exists_lt_of_lt_csSup ⟨0, h0⟩ hτ + exact hlow hτt.le ht + obtain ⟨D, hD, hs⟩ := id hsup + by_cases h1 : sSup B = 1 + · refine ⟨D, hD, ?_⟩ + rw [h1] at hs + rintro _ ⟨t, rfl⟩ + exact hs ⟨t, t.2.2, rfl⟩ + · exfalso + have hlt : sSup B < 1 := lt_of_le_of_ne (le_top) h1 + have hV : a ⁻¹' discInt D ∈ 𝓝 (sSup B) := ha.1.continuousAt.preimage_mem_nhds + ((isOpen_discInt hman hD).mem_nhds (hs ⟨_, self_mem_Iic, rfl⟩)) + obtain ⟨u, hu, hus⟩ := exists_Ico_subset_of_mem_nhds hV ⟨1, hlt⟩ + obtain ⟨v, hv1, hv2⟩ := exists_between hu + have hvB : v ∈ B := by + refine ⟨D, hD, ?_⟩ + rintro _ ⟨t, ht, rfl⟩ + rcases le_total t (sSup B) with h2 | h2 + · exact hs ⟨t, h2, rfl⟩ + · exact hus ⟨h2, lt_of_le_of_lt ht hv2⟩ + exact absurd (le_csSup (OrderTop.bddAbove _) hvB) (not_le.mpr hv1) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/ArcErase.lean b/LeanPool/GraphMinor/Surface/ArcErase.lean new file mode 100644 index 0000000000..541a00f5a6 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/ArcErase.lean @@ -0,0 +1,596 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.OneManifold +public import Mathlib.Topology.MetricSpace.Thickening + +/-! +# Making an arc meet a finite graph in finitely many pieces + +Two arcs of a surface can meet in a wild way. Here we replace an arc `a` by a nearby arc with the +same +ends that meets a given finite union of arcs `G` in a tame way: the part of the new arc off `G` is +a finite union of connected sets (`FinConn`). This is the tool that replaces general position, and +it needs no straightening of arcs. + +The step (`exists_arc_step`) is loop erasure. Let `g` be one arc of `G`, and let `x` and `y` be the +first and the last point of `a` on `g`. Replace the part of `a` from `x` to `y` by the part of `g` +from `x` to `y`. The new arc meets `g` in one connected piece. Doing this for all arcs of `G` gives +`exists_erase`. If the arcs of `G` are first cut into small pieces, then the new arc stays near the +old one, and two arcs with the same ends can be treated at the same time (`exists_tame_pair`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +local notation "𝕀" => unitInterval + +universe u + +variable {X : Type u} [TopologicalSpace X] + +/-- `B` is a finite union of connected sets. -/ +def FinConn (B : Set X) : Prop := + ∃ F : Set (Set X), F.Finite ∧ (∀ J ∈ F, IsPreconnected J) ∧ ⋃₀ F = B + +theorem finConn_of_isPreconnected {B : Set X} (h : IsPreconnected B) : FinConn B := + ⟨{B}, finite_singleton _, by simpa using h, by simp⟩ + +theorem FinConn.union {B C : Set X} (hB : FinConn B) (hC : FinConn C) : FinConn (B ∪ C) := by + obtain ⟨F, h1, h2, rfl⟩ := hB + obtain ⟨F', h1', h2', rfl⟩ := hC + refine ⟨F ∪ F', h1.union h1', ?_, sUnion_union F F'⟩ + rintro J (hJ | hJ) + · exact h2 J hJ + · exact h2' J hJ + +/-- A convex combination of two points of the unit interval. -/ +noncomputable def lerpI (s t r : 𝕀) : 𝕀 := + ⟨(1 - r.1) * s.1 + r.1 * t.1, by + have h1 := s.2 + have h2 := t.2 + have h3 := r.2 + constructor + · have := mul_nonneg (sub_nonneg.mpr h3.2) h1.1 + have := mul_nonneg h3.1 h2.1 + linarith + · have := mul_le_mul_of_nonneg_left h1.2 (sub_nonneg.mpr h3.2) + have := mul_le_mul_of_nonneg_left h2.2 h3.1 + linarith⟩ + +theorem continuous_lerpI (s t : 𝕀) : Continuous (lerpI s t) := by + refine Continuous.subtype_mk ?_ _ + fun_prop + +theorem lerpI_zero (s t : 𝕀) : lerpI s t 0 = s := Subtype.ext (by simp [lerpI]) + +theorem lerpI_one (s t : 𝕀) : lerpI s t 1 = t := Subtype.ext (by simp [lerpI]) + +theorem lerpI_injective {s t : 𝕀} (h : s ≠ t) : Function.Injective (lerpI s t) := by + intro r r' he + have h1 : (1 - r.1) * s.1 + r.1 * t.1 = (1 - r'.1) * s.1 + r'.1 * t.1 := congrArg Subtype.val he + have h2 : (r.1 - r'.1) * (t.1 - s.1) = 0 := by linarith + have h3 : t.1 - s.1 ≠ 0 := fun h0 => h (Subtype.ext (by linarith)) + have h4 : r.1 - r'.1 = 0 := (mul_eq_zero.mp h2).resolve_right h3 + exact Subtype.ext (by linarith) + +theorem range_lerpI {s t : 𝕀} (h : s ≤ t) : range (lerpI s t) = Icc s t := by + ext x + constructor + · rintro ⟨r, rfl⟩ + have h1 : s.1 ≤ t.1 := h + constructor + · change s.1 ≤ (1 - r.1) * s.1 + r.1 * t.1 + nlinarith [r.2.1] + · change (1 - r.1) * s.1 + r.1 * t.1 ≤ t.1 + nlinarith [r.2.2] + · rintro ⟨h1, h2⟩ + have h1' : s.1 ≤ x.1 := h1 + have h2' : x.1 ≤ t.1 := h2 + by_cases hst : s = t + · refine ⟨0, ?_⟩ + rw [lerpI_zero] + exact le_antisymm h1 (hst ▸ h2) + · have hlt : 0 < t.1 - s.1 := by + have : s.1 ≠ t.1 := fun h0 => hst (Subtype.ext h0) + have h3 : s.1 ≤ t.1 := h + exact sub_pos.mpr (lt_of_le_of_ne h3 this) + refine ⟨⟨(x.1 - s.1) / (t.1 - s.1), div_nonneg (by linarith) hlt.le, ?_⟩, ?_⟩ + · rw [div_le_one hlt] + linarith + · apply Subtype.ext + change (1 - (x.1 - s.1) / (t.1 - s.1)) * s.1 + (x.1 - s.1) / (t.1 - s.1) * t.1 = x.1 + field_simp + ring + +/-- The part of an arc between two parameters. -/ +noncomputable def subArc (a : 𝕀 → X) (s t : 𝕀) : 𝕀 → X := a ∘ lerpI s t + +omit [TopologicalSpace X] in +theorem subArc_zero (a : 𝕀 → X) (s t : 𝕀) : subArc a s t 0 = a s := by + simp [subArc, lerpI_zero] + +omit [TopologicalSpace X] in +theorem subArc_one (a : 𝕀 → X) (s t : 𝕀) : subArc a s t 1 = a t := by + simp [subArc, lerpI_one] + +theorem IsArcMap.sub {a : 𝕀 → X} (ha : IsArcMap a) {s t : 𝕀} (h : s ≠ t) : + IsArcMap (subArc a s t) := + ⟨ha.1.comp (continuous_lerpI s t), ha.2.comp (lerpI_injective h)⟩ + +omit [TopologicalSpace X] in +theorem range_subArc (a : 𝕀 → X) {s t : 𝕀} (h : s ≤ t) : + range (subArc a s t) = a '' Icc s t := by + rw [subArc, range_comp, range_lerpI h] + +omit [TopologicalSpace X] in +theorem range_subArc_subset (a : 𝕀 → X) (s t : 𝕀) : range (subArc a s t) ⊆ range a := by + rintro _ ⟨r, rfl⟩ + exact ⟨_, rfl⟩ + +/-- A connected part of an arc stays connected when cut by an interval. -/ +theorem IsArcMap.isPreconnected_inter [T2Space X] {a : 𝕀 → X} (ha : IsArcMap a) {J : Set X} + (hJ : IsPreconnected J) (hsub : J ⊆ range a) {I : Set 𝕀} (hI : I.OrdConnected) : + IsPreconnected (J ∩ a '' I) := by + have hemb : IsInducing a := (ha.1.isClosedEmbedding ha.2).isInducing + have h1 : a '' (a ⁻¹' J) = J := image_preimage_eq_of_subset hsub + have h2 : IsPreconnected (a ⁻¹' J) := by + rw [← hemb.isPreconnected_image, h1] + exact hJ + have h3 : (a ⁻¹' J ∩ I).OrdConnected := h2.ordConnected.inter hI + have h4 := h3.isPreconnected.image a ha.1.continuousOn + have h5 : a '' (a ⁻¹' J ∩ I) = J ∩ a '' I := by + rw [image_inter ha.2, image_preimage_eq_of_subset hsub] + rwa [h5] at h4 + +theorem FinConn.inter_arc [T2Space X] {a : 𝕀 → X} (ha : IsArcMap a) {B : Set X} (hB : FinConn B) + (hsub : B ⊆ range a) {I : Set 𝕀} (hI : I.OrdConnected) : FinConn (B ∩ a '' I) := by + obtain ⟨F, h1, h2, rfl⟩ := hB + refine ⟨(· ∩ a '' I) '' F, h1.image _, ?_, ?_⟩ + · rintro _ ⟨J, hJ, rfl⟩ + exact ha.isPreconnected_inter (h2 J hJ) ((subset_sUnion_of_mem hJ).trans hsub) hI + · ext x + simp only [sUnion_image, mem_iUnion, mem_inter_iff, mem_sUnion, exists_prop] + constructor + · rintro ⟨J, hJ, hx, hx'⟩ + exact ⟨⟨J, hJ, hx⟩, hx'⟩ + · rintro ⟨⟨J, hJ, hx⟩, hx'⟩ + exact ⟨J, hJ, hx, hx'⟩ + +/-- **Loop erasure, one step.** The arc `a` is rerouted along `g` between its first and its last +point on `g`. -/ +theorem exists_arc_step [T2Space X] {a g : 𝕀 → X} (ha : IsArcMap a) (hg : IsArcMap g) + (h0 : a 0 ∉ range g) (h1 : a 1 ∉ range g) {G₀ : Set X} (hF : FinConn (range a \ G₀)) : + ∃ a' : 𝕀 → X, IsArcMap a' ∧ a' 0 = a 0 ∧ a' 1 = a 1 ∧ range a' ⊆ range a ∪ range g ∧ + FinConn (range a' \ (G₀ ∪ range g)) := by + have hgc : IsClosed (range g) := (isCompact_range hg.1).isClosed + have hTc : IsCompact (a ⁻¹' range g) := (hgc.preimage ha.1).isCompact + by_cases hne : (a ⁻¹' range g).Nonempty + swap + · refine ⟨a, ha, rfl, rfl, subset_union_left, ?_⟩ + have : range a \ (G₀ ∪ range g) = range a \ G₀ := by + ext x + constructor + · rintro ⟨h2, h3⟩ + exact ⟨h2, fun h => h3 (.inl h)⟩ + · rintro ⟨⟨r, rfl⟩, h3⟩ + exact ⟨⟨r, rfl⟩, fun h => h.elim h3 fun h' => hne ⟨r, h'⟩⟩ + rwa [this] + obtain ⟨t₁, ht₁⟩ := hTc.exists_isLeast hne + obtain ⟨t₂, ht₂⟩ := hTc.exists_isGreatest hne + have hle : t₁ ≤ t₂ := ht₁.2 ht₂.1 + have hmiss₁ : ∀ r, r < t₁ → a r ∉ range g := fun r hr h => absurd (ht₁.2 h) (not_le.mpr hr) + have hmiss₂ : ∀ r, t₂ < r → a r ∉ range g := fun r hr h => absurd (ht₂.2 h) (not_le.mpr hr) + obtain ⟨s₁, hs₁⟩ := ht₁.1 + obtain ⟨s₂, hs₂⟩ := ht₂.1 + have ht₁0 : t₁ ≠ 0 := fun h => h0 (h ▸ ⟨s₁, hs₁⟩) + have ht₂1 : t₂ ≠ 1 := fun h => h1 (h ▸ ⟨s₂, hs₂⟩) + have ht₁0' : 0 < t₁ := lt_of_le_of_ne unitInterval.nonneg' ht₁0.symm + have ht₂1' : t₂ < 1 := lt_of_le_of_ne unitInterval.le_one' ht₂1 + -- the set that survives off `g` + have hFF : FinConn (range a \ G₀ ∩ a '' (Iio t₁) ∪ (range a \ G₀ ∩ a '' (Ioi t₂))) := + (hF.inter_arc ha sdiff_subset ordConnected_Iio).union + (hF.inter_arc ha sdiff_subset ordConnected_Ioi) + have hpart₁ : IsArcMap (subArc a 0 t₁) := ha.sub ht₁0.symm + have hpart₃ : IsArcMap (subArc a t₂ 1) := ha.sub ht₂1 + by_cases heq : t₁ = t₂ + · subst heq + refine ⟨a, ha, rfl, rfl, subset_union_left, ?_⟩ + have : range a \ (G₀ ∪ range g) = + range a \ G₀ ∩ a '' (Iio t₁) ∪ (range a \ G₀ ∩ a '' (Ioi t₁)) := by + ext x + constructor + · rintro ⟨⟨r, rfl⟩, h3⟩ + have h4 : a r ∉ G₀ := fun h => h3 (.inl h) + rcases lt_trichotomy r t₁ with h | rfl | h + · exact .inl ⟨⟨⟨r, rfl⟩, h4⟩, r, h, rfl⟩ + · exact absurd (.inr ⟨s₁, hs₁⟩) h3 + · exact .inr ⟨⟨⟨r, rfl⟩, h4⟩, r, h, rfl⟩ + · rintro (⟨⟨h2, h3⟩, r, hr, rfl⟩ | ⟨⟨h2, h3⟩, r, hr, rfl⟩) + · exact ⟨h2, fun h => h.elim h3 (hmiss₁ r hr)⟩ + · exact ⟨h2, fun h => h.elim h3 (hmiss₂ r hr)⟩ + rwa [this] + have hlt : t₁ < t₂ := lt_of_le_of_ne hle heq + have hs : s₁ ≠ s₂ := fun h => heq (ha.2 (by rw [← hs₁, ← hs₂, h])) + have hpart₂ : IsArcMap (subArc g s₁ s₂) := hg.sub hs + -- first join + obtain ⟨c, hc, hcr, hc0, hc1⟩ := exists_arc_join hpart₁ hpart₂ + (by rw [subArc_one, subArc_zero, hs₁]) (by + intro s t he + have hrt : subArc a 0 t₁ s ∈ a '' Icc 0 t₁ := by + rw [← range_subArc a unitInterval.nonneg'] + exact ⟨s, rfl⟩ + obtain ⟨r, hr, hrs⟩ := hrt + have hrng : a r ∈ range g := by + rw [hrs, he] + exact range_subArc_subset g _ _ ⟨t, rfl⟩ + have hr1 : r = t₁ := le_antisymm hr.2 (ht₁.2 hrng) + subst hr1 + have hs1 : s = 1 := by + apply hpart₁.2 + rw [subArc_one] + exact hrs.symm + subst hs1 + refine ⟨rfl, hpart₂.2 ?_⟩ + rw [← he, subArc_zero, subArc_one, hs₁]) + have hrc : range c = a '' Icc 0 t₁ ∪ range (subArc g s₁ s₂) := by + rw [hcr, range_subArc a unitInterval.nonneg'] + -- second join + obtain ⟨c', hc', hcr', hc0', hc1'⟩ := exists_arc_join hc hpart₃ + (by rw [hc1, subArc_one, subArc_zero, hs₂]) (by + intro s t he + have hrt : subArc a t₂ 1 t ∈ a '' Icc t₂ 1 := by + rw [← range_subArc a unitInterval.le_one'] + exact ⟨t, rfl⟩ + obtain ⟨r, hr, hrs⟩ := hrt + have hcs : c s ∈ a '' Icc 0 t₁ ∪ range (subArc g s₁ s₂) := by + rw [← hrc] + exact ⟨s, rfl⟩ + have hrng : a r ∈ range g := by + rcases hcs with ⟨r', hr', hr's⟩ | hcs + · have : r' = r := ha.2 (by rw [hr's, he, hrs]) + subst this + exact absurd (hr'.2.trans_lt hlt) (not_lt.mpr hr.1) + · rw [hrs, ← he] + exact range_subArc_subset g _ _ hcs + have hr2 : r = t₂ := le_antisymm (ht₂.2 hrng) hr.1 + subst hr2 + have ht0 : t = 0 := by + apply hpart₃.2 + rw [subArc_zero] + exact hrs.symm + subst ht0 + refine ⟨hc.2 ?_, rfl⟩ + rw [he, subArc_zero, hc1, subArc_one, hs₂]) + refine ⟨c', hc', ?_, ?_, ?_, ?_⟩ + · rw [hc0', hc0, subArc_zero] + · rw [hc1', subArc_one] + · rw [hcr', hrc, range_subArc a unitInterval.le_one'] + rintro x ((⟨r, -, rfl⟩ | hx) | ⟨r, -, rfl⟩) + · exact .inl ⟨r, rfl⟩ + · exact .inr (range_subArc_subset g _ _ hx) + · exact .inl ⟨r, rfl⟩ + · have : range c' \ (G₀ ∪ range g) = + range a \ G₀ ∩ a '' (Iio t₁) ∪ (range a \ G₀ ∩ a '' (Ioi t₂)) := by + rw [hcr', hrc, range_subArc a unitInterval.le_one'] + ext x + constructor + · rintro ⟨(⟨r, hr, rfl⟩ | hx) | ⟨r, hr, rfl⟩, h3⟩ + · have h4 : a r ∉ G₀ := fun h => h3 (.inl h) + have h5 : r ≠ t₁ := fun h => h3 (.inr (h ▸ ⟨s₁, hs₁⟩)) + exact .inl ⟨⟨⟨r, rfl⟩, h4⟩, r, (lt_of_le_of_ne hr.2 h5 : r < t₁), rfl⟩ + · exact absurd (.inr (range_subArc_subset g _ _ hx)) h3 + · have h4 : a r ∉ G₀ := fun h => h3 (.inl h) + have h5 : t₂ ≠ r := fun h => h3 (.inr (h ▸ ⟨s₂, hs₂⟩)) + exact .inr ⟨⟨⟨r, rfl⟩, h4⟩, r, (lt_of_le_of_ne hr.1 h5 : t₂ < r), rfl⟩ + · rintro (⟨⟨h2, h3⟩, r, hr, rfl⟩ | ⟨⟨h2, h3⟩, r, hr, rfl⟩) + · refine ⟨.inl (.inl ⟨r, ⟨unitInterval.nonneg', le_of_lt hr⟩, rfl⟩), + fun h => h.elim h3 (hmiss₁ r hr)⟩ + · refine ⟨.inr ⟨r, ⟨le_of_lt hr, unitInterval.le_one'⟩, rfl⟩, + fun h => h.elim h3 (hmiss₂ r hr)⟩ + rwa [this] + +/-- **Loop erasure.** An arc can be rerouted along a finite list of arcs so that the rest of it is a +finite union of connected sets. -/ +theorem exists_erase [T2Space X] (L : List (𝕀 → X)) (hL : ∀ g ∈ L, IsArcMap g) {a : 𝕀 → X} + (ha : IsArcMap a) (h0 : ∀ g ∈ L, a 0 ∉ range g) (h1 : ∀ g ∈ L, a 1 ∉ range g) : + ∃ a' : 𝕀 → X, IsArcMap a' ∧ a' 0 = a 0 ∧ a' 1 = a 1 ∧ + range a' ⊆ range a ∪ ⋃ g ∈ L, range g ∧ FinConn (range a' \ ⋃ g ∈ L, range g) := by + induction L with + | nil => + refine ⟨a, ha, rfl, rfl, subset_union_left, ?_⟩ + simp only [List.not_mem_nil, iUnion_of_empty, iUnion_empty, sdiff_empty] + exact finConn_of_isPreconnected (isPreconnected_range ha.1) + | cons g L ih => + obtain ⟨a₁, ha₁, h10, h11, h12, h13⟩ := ih (fun g' hg' => hL g' (.tail _ hg')) + (fun g' hg' => h0 g' (.tail _ hg')) (fun g' hg' => h1 g' (.tail _ hg')) + obtain ⟨a₂, ha₂, h20, h21, h22, h23⟩ := exists_arc_step ha₁ (hL g (.head _)) + (by rw [h10]; exact h0 g (.head _)) (by rw [h11]; exact h1 g (.head _)) h13 + have hU : (⋃ g' ∈ g :: L, range g') = (⋃ g' ∈ L, range g') ∪ range g := by + ext x + simp only [List.mem_cons, iUnion_iUnion_eq_or_left, mem_iUnion, mem_union, exists_prop] + exact or_comm + refine ⟨a₂, ha₂, h20.trans h10, h21.trans h11, ?_, ?_⟩ + · rw [hU] + intro x hx + rcases h22 hx with hx | hx + · rcases h12 hx with hx | hx + · exact .inl hx + · exact .inr (.inl hx) + · exact .inr (.inr hx) + · rw [hU] + exact h23 + +/-- An arc is a finite union of small arcs. -/ +theorem IsArcMap.exists_small {Y : Type u} [PseudoMetricSpace Y] {ℓ : 𝕀 → Y} (hℓ : IsArcMap ℓ) + {δ : ℝ} (hδ : 0 < δ) : + ∃ L : List (𝕀 → Y), (∀ g ∈ L, IsArcMap g) ∧ (⋃ g ∈ L, range g) = range ℓ ∧ + ∀ g ∈ L, ∀ x ∈ range g, ∀ y ∈ range g, dist x y < δ := by + have hu : UniformContinuous ℓ := CompactSpace.uniformContinuous_of_continuous hℓ.1 + obtain ⟨η, hη, hu'⟩ := Metric.uniformContinuous_iff.mp hu δ hδ + obtain ⟨n, hn⟩ := exists_nat_one_div_lt hη + let N : ℕ := n + 1 + have hN : (0 : ℝ) < N := by positivity + let pt : ℕ → 𝕀 := fun i => ⟨min (i / N : ℝ) 1, le_min (by positivity) zero_le_one, min_le_right _ + _⟩ + have hpt : ∀ i ≤ N, (pt i).1 = (i / N : ℝ) := fun i hi => by + refine min_eq_left ?_ + rw [div_le_one hN] + exact_mod_cast hi + have hne : ∀ i < N, pt i ≠ pt (i + 1) := fun i hi h => by + have h1 := congrArg Subtype.val h + rw [hpt i hi.le, hpt (i + 1) hi] at h1 + push_cast at h1 + have h2 : (i : ℝ) = i + 1 := by + field_simp at h1 + linarith + linarith + have hle : ∀ i < N, pt i ≤ pt (i + 1) := fun i hi => by + change (pt i).1 ≤ (pt (i + 1)).1 + rw [hpt i hi.le, hpt (i + 1) hi] + push_cast + gcongr + linarith + refine ⟨(List.range N).map fun i => subArc ℓ (pt i) (pt (i + 1)), ?_, ?_, ?_⟩ + · intro g hg + obtain ⟨i, hi, rfl⟩ := List.mem_map.mp hg + exact hℓ.sub (hne i (List.mem_range.mp hi)) + · refine subset_antisymm (iUnion₂_subset fun g hg => ?_) ?_ + · obtain ⟨i, -, rfl⟩ := List.mem_map.mp hg + exact range_subArc_subset _ _ _ + · rintro _ ⟨x, rfl⟩ + -- the interval containing `x` + have hex : ∃ i, i < N ∧ (i / N : ℝ) ≤ x.1 ∧ x.1 ≤ ((i + 1 : ℕ) / N : ℝ) := by + by_cases hx1 : x.1 = 1 + · refine ⟨n, by simp [N], ?_, ?_⟩ + · rw [hx1, div_le_one hN] + simp [N] + · rw [hx1] + simp only [N] + rw [div_self (by positivity)] + · have hx1' : x.1 < 1 := lt_of_le_of_ne x.2.2 hx1 + refine ⟨⌊x.1 * N⌋₊, ?_, ?_, ?_⟩ + · have : (⌊x.1 * N⌋₊ : ℝ) ≤ x.1 * N := Nat.floor_le (by have := x.2.1; positivity) + have h3 : (⌊x.1 * N⌋₊ : ℝ) < N := by nlinarith + exact_mod_cast h3 + · rw [div_le_iff₀ hN] + exact Nat.floor_le (by have := x.2.1; positivity) + · rw [le_div_iff₀ hN] + push_cast + exact (Nat.lt_floor_add_one _).le + obtain ⟨i, hi, h1, h2⟩ := hex + refine mem_iUnion₂.mpr ⟨subArc ℓ (pt i) (pt (i + 1)), List.mem_map.mpr ⟨i, List.mem_range.mpr + hi, + rfl⟩, ?_⟩ + rw [range_subArc ℓ (hle i hi)] + refine ⟨x, ⟨?_, ?_⟩, rfl⟩ + · change (pt i).1 ≤ x.1 + rwa [hpt i hi.le] + · change x.1 ≤ (pt (i + 1)).1 + rwa [hpt (i + 1) hi] + · intro g hg x hx y hy + obtain ⟨i, hi, rfl⟩ := List.mem_map.mp hg + have hi' := List.mem_range.mp hi + rw [range_subArc ℓ (hle i hi')] at hx hy + obtain ⟨r, hr, rfl⟩ := hx + obtain ⟨r', hr', rfl⟩ := hy + refine hu' ?_ + have h1 : (pt i).1 = (i / N : ℝ) := hpt i hi'.le + have h2 : (pt (i + 1)).1 = ((i + 1 : ℕ) / N : ℝ) := hpt (i + 1) hi' + have h3 : (i / N : ℝ) ≤ r.1 := h1 ▸ hr.1 + have h4 : (i / N : ℝ) ≤ r'.1 := h1 ▸ hr'.1 + have h5 : r.1 ≤ ((i + 1 : ℕ) / N : ℝ) := h2 ▸ hr.2 + have h6 : r'.1 ≤ ((i + 1 : ℕ) / N : ℝ) := h2 ▸ hr'.2 + have h7 : ((i + 1 : ℕ) / N : ℝ) = i / N + 1 / N := by + push_cast + ring + rw [Subtype.dist_eq, Real.dist_eq, abs_lt] + have h8 : (1 / N : ℝ) = 1 / (n + 1) := by simp [N] + constructor <;> linarith + +/-- A finite family of arcs can be subdivided into small arcs covering the same set. -/ +theorem exists_small_arc_cover {Y : Type u} [PseudoMetricSpace Y] (G : List (𝕀 → Y)) + (hG : ∀ g ∈ G, IsArcMap g) {δ : ℝ} (hδ : 0 < δ) : + ∃ L : List (𝕀 → Y), (∀ g ∈ L, IsArcMap g) ∧ (⋃ g ∈ L, range g) = (⋃ g ∈ G, range g) ∧ + ∀ g ∈ L, ∀ x ∈ range g, ∀ y ∈ range g, dist x y < δ := by + induction G with + | nil => + exact ⟨[], by simp, by simp, by simp⟩ + | cons g G ih => + obtain ⟨L₁, h1', h2', h3'⟩ := (hG g (.head _)).exists_small hδ + obtain ⟨L₂, h1'', h2'', h3''⟩ := ih (fun g' hg' => hG g' (.tail _ hg')) + refine ⟨L₁ ++ L₂, ?_, ?_, ?_⟩ + · intro g' hg' + rcases List.mem_append.mp hg' with h | h + · exact h1' g' h + · exact h1'' g' h + · ext x + simp only [mem_iUnion, List.mem_append, exists_prop, List.mem_cons] + have e1 := Set.ext_iff.mp h2' x + have e2 := Set.ext_iff.mp h2'' x + simp only [mem_iUnion, exists_prop] at e1 e2 + constructor + · rintro ⟨g', hg' | hg', hx⟩ + · exact ⟨g, .inl rfl, e1.mp ⟨g', hg', hx⟩⟩ + · obtain ⟨g'', h5, h6⟩ := e2.mp ⟨g', hg', hx⟩ + exact ⟨g'', .inr h5, h6⟩ + · rintro ⟨g', rfl | hg', hx⟩ + · obtain ⟨g'', h5, h6⟩ := e1.mpr hx + exact ⟨g'', .inl h5, h6⟩ + · obtain ⟨g'', h5, h6⟩ := e2.mpr ⟨g', hg', hx⟩ + exact ⟨g'', .inr h5, h6⟩ + · intro g' hg' + rcases List.mem_append.mp hg' with h | h + · exact h3' g' h + · exact h3'' g' h + +/-- **Taming two arcs.** Let `a` and `b` be two arcs with the same ends, meeting only in their ends, +and let `G` be a finite union of arcs that misses the ends. Then `a` and `b` can be moved, by less +than `ε`, so that the result has the same properties and the part of it off `G` is a finite union +of connected sets. -/ +theorem exists_tame_pair {Y : Type u} [MetricSpace Y] (G : List (𝕀 → Y)) (hG : ∀ g ∈ G, IsArcMap g) + {a b : 𝕀 → Y} (ha : IsArcMap a) (hb : IsArcMap b) (h0 : b 0 = a 0) (h1 : b 1 = a 1) + (hm : ∀ s t, a s = b t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) + (hp : ∀ g ∈ G, a 0 ∉ range g) (hq : ∀ g ∈ G, a 1 ∉ range g) {ε : ℝ} (hε : 0 < ε) : + ∃ a' b' : 𝕀 → Y, IsArcMap a' ∧ IsArcMap b' ∧ a' 0 = a 0 ∧ a' 1 = a 1 ∧ b' 0 = a 0 ∧ b' 1 = a 1 ∧ + (∀ s t, a' s = b' t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) ∧ + range a' ⊆ thickening ε (range a) ∧ range b' ⊆ thickening ε (range b) ∧ + FinConn ((range a' ∪ range b') \ ⋃ g ∈ G, range g) := by + classical + set G₀ : Set Y := ⋃ g ∈ G, range g with hG₀ + have hG₀c : IsClosed G₀ := by + have : IsCompact G₀ := G.finite_toSet.isCompact_biUnion fun g hg => + isCompact_range (hG g hg).1 + exact this.isClosed + have hAc : IsCompact (range a) := isCompact_range ha.1 + have hBc : IsCompact (range b) := isCompact_range hb.1 + have hdisj : Disjoint (range a ∩ G₀) (range b ∩ G₀) := by + rw [Set.disjoint_left] + rintro _ ⟨⟨s, rfl⟩, hs⟩ ⟨⟨t, ht⟩, -⟩ + obtain ⟨g, hg, hsg⟩ := mem_iUnion₂.mp hs + rcases hm s t ht.symm with ⟨rfl, -⟩ | ⟨rfl, -⟩ + · exact hp g hg hsg + · exact hq g hg hsg + obtain ⟨δ₀, hδ₀, hthick⟩ := hdisj.exists_thickenings (hAc.inter_right hG₀c) + (hBc.isClosed.inter hG₀c) + have hfar : ∀ x ∈ range a ∩ G₀, ∀ y ∈ range b ∩ G₀, δ₀ ≤ dist x y := by + intro x hx y hy + by_contra hlt + refine Set.disjoint_left.mp hthick (self_subset_thickening hδ₀ _ hx) ?_ + exact mem_thickening_iff.mpr ⟨y, hy, not_le.mp hlt⟩ + set δ : ℝ := min ε (δ₀ / 3) with hδdef + have hδ : 0 < δ := lt_min hε (by positivity) + have hδε : δ ≤ ε := min_le_left _ _ + have hδ3 : δ ≤ δ₀ / 3 := min_le_right _ _ + obtain ⟨L, hL1, hcover, hL3⟩ := exists_small_arc_cover G hG hδ + have hL2 : (⋃ g ∈ L, range g) = G₀ := hcover + have hLG : ∀ g ∈ L, range g ⊆ G₀ := fun g hg => by + rw [← hL2] + intro x hx + exact mem_iUnion.mpr ⟨g, mem_iUnion.mpr ⟨hg, hx⟩⟩ + let La := L.filter fun g => (range g ∩ range a).Nonempty + let Lb := L.filter fun g => (range g ∩ range b).Nonempty + have hLa : ∀ g ∈ La, g ∈ L ∧ (range g ∩ range a).Nonempty := fun g hg => by + simpa [La] using hg + have hLb : ∀ g ∈ Lb, g ∈ L ∧ (range g ∩ range b).Nonempty := fun g hg => by + simpa [Lb] using hg + have hmissG : ∀ g ∈ L, a 0 ∉ range g ∧ a 1 ∉ range g := fun g hg => by + constructor + · intro hx + obtain ⟨g', h5, h6⟩ := mem_iUnion₂.mp (hLG g hg hx) + exact hp g' h5 h6 + · intro hx + obtain ⟨g', h5, h6⟩ := mem_iUnion₂.mp (hLG g hg hx) + exact hq g' h5 h6 + obtain ⟨a', ha', ha0, ha1, ha2, ha3⟩ := exists_erase La (fun g hg => hL1 g (hLa g hg).1) ha + (fun g hg => (hmissG g (hLa g hg).1).1) (fun g hg => (hmissG g (hLa g hg).1).2) + obtain ⟨b', hb', hb0, hb1, hb2, hb3⟩ := exists_erase Lb (fun g hg => hL1 g (hLb g hg).1) hb + (fun g hg => h0 ▸ (hmissG g (hLb g hg).1).1) (fun g hg => h1 ▸ (hmissG g (hLb g hg).1).2) + -- a point of the new arc off the old one is near the old one + have hnear : ∀ {c : 𝕀 → Y} {L' : List (𝕀 → Y)}, (∀ g ∈ L', g ∈ L ∧ (range g ∩ range c).Nonempty) → + ∀ x ∈ ⋃ g ∈ L', range g, ∃ y ∈ range c ∩ G₀, dist x y < δ := by + intro c L' hL' x hx + obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp hx + obtain ⟨y, hyg, hyc⟩ := (hL' g hg).2 + exact ⟨y, ⟨hyc, hLG g (hL' g hg).1 hyg⟩, hL3 g (hL' g hg).1 x hxg y hyg⟩ + have hsep : ∀ x y, x ∈ range a ∪ ⋃ g ∈ La, range g → y ∈ range b ∪ ⋃ g ∈ Lb, range g → x = y → + x ∈ range a ∧ x ∈ range b := by + intro x y hx hy hxy + subst hxy + have hxG : ∀ {L' : List (𝕀 → Y)}, (∀ g ∈ L', g ∈ L) → x ∈ (⋃ g ∈ L', range g) → x ∈ G₀ := by + intro L' h1 h2 + obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h2 + exact hLG g (h1 g hg) hxg + rcases hx with hx | hx <;> rcases hy with hy | hy + · exact ⟨hx, hy⟩ + · exfalso + obtain ⟨w, hw, hd⟩ := hnear hLb x hy + have h3 := hfar x ⟨hx, hxG (fun g hg => (hLb g hg).1) hy⟩ w hw + linarith + · exfalso + obtain ⟨w, hw, hd⟩ := hnear hLa x hx + have h3 := hfar w hw x ⟨hy, hxG (fun g hg => (hLa g hg).1) hx⟩ + rw [dist_comm] at h3 + linarith + · exfalso + obtain ⟨w, hw, hd⟩ := hnear hLa x hx + obtain ⟨w', hw', hd'⟩ := hnear hLb x hy + have h3 := hfar w hw w' hw' + have h4 := dist_triangle_left w w' x + linarith + have hsdiff : ∀ {c : 𝕀 → Y} {c' : 𝕀 → Y} {L' : List (𝕀 → Y)}, + (∀ g ∈ L, (range g ∩ range c).Nonempty → g ∈ L') → (∀ g ∈ L', g ∈ L) → + range c' ⊆ range c ∪ ⋃ g ∈ L', range g → range c' \ G₀ = range c' \ ⋃ g ∈ L', range g := by + intro c c' L' h1 h2 h3 + ext x + constructor + · rintro ⟨h4, h5⟩ + refine ⟨h4, fun h6 => h5 ?_⟩ + obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h6 + exact hLG g (h2 g hg) hxg + · rintro ⟨h4, h5⟩ + refine ⟨h4, fun h6 => ?_⟩ + rw [← hL2] at h6 + obtain ⟨g, hg, hxg⟩ := mem_iUnion₂.mp h6 + rcases h3 h4 with h7 | h7 + · exact h5 (mem_iUnion₂.mpr ⟨g, h1 g hg ⟨x, hxg, h7⟩, hxg⟩) + · exact h5 h7 + have hthickA : ∀ {c c' : 𝕀 → Y} {L' : List (𝕀 → Y)}, + (∀ g ∈ L', g ∈ L ∧ (range g ∩ range c).Nonempty) → range c' ⊆ range c ∪ ⋃ g ∈ L', range g → + range c' ⊆ thickening ε (range c) := by + intro c c' L' h1 h2 x hx + rcases h2 hx with h3 | h3 + · exact self_subset_thickening hε _ h3 + · obtain ⟨y, hy, hd⟩ := hnear h1 x h3 + exact mem_thickening_iff.mpr ⟨y, hy.1, hd.trans_le hδε⟩ + refine ⟨a', b', ha', hb', ha0, ha1, hb0.trans h0, hb1.trans h1, ?_, hthickA hLa ha2, + hthickA hLb hb2, ?_⟩ + · intro s t he + obtain ⟨⟨s', hs'⟩, ⟨t', ht'⟩⟩ := hsep _ _ (ha2 ⟨s, rfl⟩) (hb2 ⟨t, rfl⟩) he + rcases hm s' t' (hs'.trans ht'.symm) with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · left + have e1 : a' s = a' 0 := by rw [← hs', ha0] + have e2 : b' t = b' 0 := by rw [← he, ← hs', hb0, h0] + exact ⟨ha'.2 e1, hb'.2 e2⟩ + · right + have e1 : a' s = a' 1 := by rw [← hs', ha1] + have e2 : b' t = b' 1 := by rw [← he, ← hs', hb1, h1] + exact ⟨ha'.2 e1, hb'.2 e2⟩ + · have e1 := hsdiff (c := a) (c' := a') (L' := La) (fun g hg h => by simp [La, hg, h]) + (fun g hg => (hLa g hg).1) ha2 + have e2 := hsdiff (c := b) (c' := b') (L' := Lb) (fun g hg h => by simp [Lb, hg, h]) + (fun g hg => (hLb g hg).1) hb2 + rw [union_sdiff_distrib, e1, e2] + exact ha3.union hb3 + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/ArcInPath.lean b/LeanPool/GraphMinor/Surface/ArcInPath.lean new file mode 100644 index 0000000000..1587f7de91 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/ArcInPath.lean @@ -0,0 +1,613 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Topology.UnitInterval +import Mathlib.Order.CountableDenseLinearOrder +import Mathlib.Order.Zorn +import Mathlib.Topology.Bases +import Mathlib.Topology.Order.MonotoneContinuity +import Mathlib.Topology.Separation.Hausdorff +import Mathlib.Data.Rat.Cast.Order +import Mathlib.Data.Rat.Denumerable +import Mathlib.Algebra.Order.Archimedean.Basic +import Mathlib.Topology.MetricSpace.Basic +import Mathlib.Topology.Instances.Rat + +/-! +# A path in a Hausdorff space contains an arc + +Let `γ` be a path in a Hausdorff space with different ends. This file finds an injective path with +the same ends inside the image of `γ`. Mathlib does not have this fact. + +The route: call a closed set `T ⊆ [0, 1]` containing the ends *admissible* if `γ` takes equal values +at the two ends of every gap of `T`. By Zorn's lemma there is a minimal admissible set +(`exists_minimal_admissible`). Minimality gives: if `γ s = γ t` with `s < t` in `T`, then `T` has no +point between `s` and `t`. So the order on `T`, with the gaps closed up, is dense, and Cantor's +isomorphism theorem gives a monotone continuous map from `[0, 1]` onto `[0, 1]` that closes the +gaps. +Then `γ` restricted to `T` factors through this map, and the factor is the injective path. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +local notation "𝕀" => unitInterval + +variable {X : Type*} [TopologicalSpace X] + +/-- The closed set `T` contains the ends of `[0, 1]`, and `γ` agrees at the two ends of each gap. -/ +def IsAdmissible (γ : 𝕀 → X) (T : Set 𝕀) : Prop := + IsClosed T ∧ (0 : 𝕀) ∈ T ∧ (1 : 𝕀) ∈ T ∧ + ∀ a ∈ T, ∀ b ∈ T, a < b → Ioo a b ∩ T = ∅ → γ a = γ b + +/-- The intersection of a chain of admissible sets is admissible. -/ +private theorem isAdmissible_sInter [T2Space X] {γ : 𝕀 → X} (hγ : Continuous γ) {c : Set (Set 𝕀)} + (hc : ∀ T ∈ c, IsAdmissible γ T) (hchain : IsChain (· ⊆ ·) c) (hne : c.Nonempty) : + IsAdmissible γ (⋂₀ c) := by + refine ⟨isClosed_sInter fun T hT => (hc T hT).1, fun T hT => (hc T hT).2.1, + fun T hT => (hc T hT).2.2.1, fun a ha b hb hab hgap => ?_⟩ + by_contra hne' + obtain ⟨U, V, hU, hV, haU, hbV, hUV⟩ := t2_separation hne' + have hUn : γ ⁻¹' U ∈ 𝓝[>] a := mem_nhdsWithin_of_mem_nhds (hγ.continuousAt.preimage_mem_nhds + (hU.mem_nhds haU)) + have hVn : γ ⁻¹' V ∈ 𝓝[<] b := mem_nhdsWithin_of_mem_nhds (hγ.continuousAt.preimage_mem_nhds + (hV.mem_nhds hbV)) + obtain ⟨a', ha', hUsub⟩ := (mem_nhdsGT_iff_exists_Ioo_subset' hab).mp hUn + obtain ⟨b', hb', hVsub⟩ := (mem_nhdsLT_iff_exists_Ioo_subset' hab).mp hVn + -- Choose points `p ≤ q` strictly inside the gap, near `a` and near `b`. + have ha'' : a < a' := ha' + have hb'' : b' < b := hb' + obtain ⟨p, hp⟩ := exists_between (lt_min ha'' hab) + have hpa' : p < a' := lt_of_lt_of_le hp.2 (min_le_left _ _) + have hpb : p < b := lt_of_lt_of_le hp.2 (min_le_right _ _) + obtain ⟨q, hq⟩ := exists_between (max_lt hb'' hpb) + have hqb' : b' < q := lt_of_le_of_lt (le_max_left _ _) hq.1 + have hpq : p < q := lt_of_le_of_lt (le_max_right _ _) hq.1 + -- One member of the chain misses `[p, q]`. + have hmiss : ∃ T ∈ c, Icc p q ∩ T = ∅ := by + by_contra hall + push Not at hall + have hcomp : IsCompact (Icc p q) := isCompact_Icc + have hnon := hcomp.inter_iInter_nonempty (fun T : c => T.1) (fun T => (hc T.1 T.2).1) ?_ + · obtain ⟨z, hz1, hz2⟩ := hnon + have hz : z ∈ ⋂₀ c := mem_sInter.mpr fun T hT => mem_iInter.mp hz2 ⟨T, hT⟩ + have hzgap : z ∈ Ioo a b := ⟨lt_of_lt_of_le hp.1 hz1.1, lt_of_le_of_lt hz1.2 hq.2⟩ + have : z ∈ Ioo a b ∩ ⋂₀ c := ⟨hzgap, hz⟩ + rw [hgap] at this + exact this + · intro s + induction s using Finset.induction_on with + | empty => + obtain ⟨T, hT⟩ := hne + obtain ⟨z, hz⟩ := hall T hT + exact ⟨z, hz.1, by simp⟩ + | insert T s hTs ih => + obtain ⟨z, hz1, hz2⟩ := ih + by_cases hs : s = ∅ + · subst hs + obtain ⟨z', hz'⟩ := hall T.1 T.2 + exact ⟨z', hz'.1, by simpa using hz'.2⟩ + · -- The smallest set in `s ∪ {T}` lies in all of them. + have hmin : ∃ T' ∈ c, (T' ⊆ T.1) ∧ ∀ W ∈ s, T' ⊆ W.1 := by + have : ∀ s : Finset c, ∃ T' ∈ c, (T' ⊆ T.1) ∧ ∀ W ∈ s, T' ⊆ W.1 := by + intro s + induction s using Finset.induction_on with + | empty => exact ⟨T.1, T.2, Subset.rfl, by simp⟩ + | insert W s _ ih => + obtain ⟨T', hT', h1, h2⟩ := ih + rcases hchain.total hT' W.2 with h | h + · refine ⟨T', hT', h1, ?_⟩ + intro W' hW' + rcases Finset.mem_insert.mp hW' with rfl | hW' + · exact h + · exact h2 W' hW' + · refine ⟨W.1, W.2, h.trans h1, ?_⟩ + intro W' hW' + rcases Finset.mem_insert.mp hW' with rfl | hW' + · exact Subset.rfl + · exact h.trans (h2 W' hW') + exact this s + obtain ⟨T', hT', h1, h2⟩ := hmin + obtain ⟨z', hz'⟩ := hall T' hT' + refine ⟨z', hz'.1, ?_⟩ + simp only [Finset.set_biInter_insert] + refine ⟨h1 hz'.2, ?_⟩ + simp only [mem_iInter] + exact fun W hW => h2 W hW hz'.2 + obtain ⟨T, hT, hmissT⟩ := hmiss + have haT : a ∈ T := mem_sInter.mp ha T hT + have hbT : b ∈ T := mem_sInter.mp hb T hT + have hTc : IsClosed T := (hc T hT).1 + -- The last point of `T` below `p` and the first point of `T` above `q`. + have hL : IsCompact (T ∩ Iic p) := hTc.isCompact.inter_right isClosed_Iic + have hR : IsCompact (T ∩ Ici q) := hTc.isCompact.inter_right isClosed_Ici + obtain ⟨l, hl, hlmax⟩ := hL.exists_isGreatest ⟨a, haT, hp.1.le⟩ + obtain ⟨r, hr, hrmin⟩ := hR.exists_isLeast ⟨b, hbT, hq.2.le⟩ + have hal : a ≤ l := hlmax ⟨haT, hp.1.le⟩ + have hrb : r ≤ b := hrmin ⟨hbT, hq.2.le⟩ + have hlr : l < r := lt_of_le_of_lt hl.2 (lt_of_lt_of_le hpq hr.2) + have hgapT : Ioo l r ∩ T = ∅ := by + rw [eq_empty_iff_forall_notMem] + rintro z ⟨hz1, hzT⟩ + rcases le_total z p with h | h + · exact absurd (hlmax ⟨hzT, h⟩) (not_le.mpr hz1.1) + · rcases le_total z q with h' | h' + · have : z ∈ Icc p q ∩ T := ⟨⟨h, h'⟩, hzT⟩ + rw [hmissT] at this + exact this + · exact absurd (hrmin ⟨hzT, h'⟩) (not_le.mpr hz1.2) + have heq := (hc T hT).2.2.2 l hl.1 r hr.1 hlr hgapT + have hlU : γ l ∈ U := by + rcases eq_or_lt_of_le hal with h | h + · rw [← h]; exact haU + · exact hUsub ⟨h, lt_of_le_of_lt hl.2 hpa'⟩ + have hrV : γ r ∈ V := by + rcases eq_or_lt_of_le hrb with h | h + · rw [h]; exact hbV + · exact hVsub ⟨lt_of_lt_of_le hqb' hr.2, h⟩ + exact Set.disjoint_left.mp hUV hlU (heq ▸ hrV) + +/-- There is a minimal admissible set. -/ +theorem exists_minimal_admissible [T2Space X] {γ : 𝕀 → X} (hγ : Continuous γ) : + ∃ T, Minimal (IsAdmissible γ) T := by + have hS : IsAdmissible γ (univ : Set 𝕀) := + ⟨isClosed_univ, mem_univ _, mem_univ _, fun a _ b _ hab h => by + obtain ⟨z, hz⟩ := exists_between hab + have : z ∈ Ioo a b ∩ univ := ⟨hz, mem_univ _⟩ + rw [h] at this + exact absurd this (notMem_empty z)⟩ + obtain ⟨T, -, hT⟩ := zorn_superset_nonempty {T | IsAdmissible γ T} + (fun c hc hchain hne => ⟨⋂₀ c, isAdmissible_sInter hγ hc hchain hne, + fun T hT => sInter_subset_of_mem hT⟩) univ hS + exact ⟨T, hT⟩ + +/-- A monotone continuous surjection of `[0, 1]` that is strictly increasing on a given dense-in- +itself order `Z`, and that closes every interval free of `Z`. This is where Cantor's isomorphism +theorem enters. -/ +private theorem exists_monotone_interval_collapse (Z : Set 𝕀) (hne : Z.Nonempty) + (hdense : ∀ y ∈ Z, ∀ y' ∈ Z, y < y' → ∃ z ∈ Z, y < z ∧ z < y') + (hmax : ∀ y ∈ Z, ∃ z ∈ Z, y < z) (hmin : ∀ y ∈ Z, ∃ z ∈ Z, z < y) : + ∃ c : 𝕀 → 𝕀, Monotone c ∧ Continuous c ∧ Dense (c '' Z) ∧ c 0 = 0 ∧ c 1 = 1 ∧ + (∀ y ∈ Z, ∀ y' ∈ Z, y < y' → c y < c y') ∧ + (∀ s t : 𝕀, s < t → Ioc s t ∩ Z = ∅ → c s = c t) := by + obtain ⟨S, hScount, hSdense⟩ := TopologicalSpace.exists_countable_dense Z + -- Between two points of `Z` lies a point of `S`. + have hbetween : ∀ y y' : Z, y < y' → ∃ d ∈ S, y < d ∧ d < y' := by + intro y y' hyy + obtain ⟨z, hz, h1, h2⟩ := hdense y.1 y.2 y'.1 y'.2 hyy + have hopen : IsOpen {w : Z | y < w ∧ w < y'} := + isOpen_Ioo.preimage continuous_subtype_val + obtain ⟨d, hd1, hd2⟩ := hSdense.inter_open_nonempty _ hopen ⟨⟨z, hz⟩, h1, h2⟩ + exact ⟨d, hd2, hd1.1, hd1.2⟩ + let D := S + have : Countable D := hScount.to_subtype + have hDne : Nonempty D := by + obtain ⟨y, hy⟩ := hne + obtain ⟨z, hz, hyz⟩ := hmax y hy + obtain ⟨d, hd, -⟩ := hbetween ⟨y, hy⟩ ⟨z, hz⟩ hyz + exact ⟨⟨d, hd⟩⟩ + have : DenselyOrdered D := ⟨fun a b hab => by + obtain ⟨d, hd, h1, h2⟩ := hbetween a.1 b.1 hab + exact ⟨⟨d, hd⟩, h1, h2⟩⟩ + have : NoMaxOrder D := ⟨fun a => by + obtain ⟨z, hz, h⟩ := hmax a.1.1 a.1.2 + obtain ⟨d, hd, h1, -⟩ := hbetween a.1 ⟨z, hz⟩ h + exact ⟨⟨d, hd⟩, h1⟩⟩ + have : NoMinOrder D := ⟨fun a => by + obtain ⟨z, hz, h⟩ := hmin a.1.1 a.1.2 + obtain ⟨d, hd, -, h2⟩ := hbetween ⟨z, hz⟩ a.1 h + exact ⟨⟨d, hd⟩, h2⟩⟩ + let E := Ioo (0 : ℚ) 1 + have : Countable E := Subtype.countable + have hEne : Nonempty E := ⟨⟨1 / 2, by norm_num, by norm_num⟩⟩ + have : DenselyOrdered E := ⟨fun a b hab => by + obtain ⟨q, h1, h2⟩ := exists_between (show (a : ℚ) < b from hab) + exact ⟨⟨q, a.2.1.trans h1, h2.trans b.2.2⟩, h1, h2⟩⟩ + have : NoMaxOrder E := ⟨fun a => by + obtain ⟨q, h1, h2⟩ := exists_between a.2.2 + exact ⟨⟨q, a.2.1.trans h1, h2⟩, h1⟩⟩ + have : NoMinOrder E := ⟨fun a => by + obtain ⟨q, h1, h2⟩ := exists_between a.2.1 + exact ⟨⟨q, h1, h2.trans a.2.2⟩, h2⟩⟩ + obtain ⟨e⟩ : Nonempty (D ≃o E) := Order.iso_of_countable_dense D E + -- The real value attached to a point of `D`. + let v : D → ℝ := fun d => ((e d : ℚ) : ℝ) + have hv0 : ∀ d, 0 ≤ v d := fun d => by + have := (e d).2.1 + simp only [v] + exact_mod_cast this.le + have hv1 : ∀ d, v d ≤ 1 := fun d => by + have := (e d).2.2 + simp only [v] + exact_mod_cast this.le + have hvmono : ∀ {a b : D}, a ≤ b → v a ≤ v b := fun {a b} h => by + have : (e a : ℚ) ≤ e b := e.monotone h + simp only [v] + exact_mod_cast this + have hvstrict : ∀ {a b : D}, a < b → v a < v b := fun {a b} h => by + have : (e a : ℚ) < e b := e.strictMono h + simp only [v] + exact_mod_cast this + let W : 𝕀 → Set ℝ := fun t => insert 0 (v '' {d : D | ((d : Z) : 𝕀) ≤ t}) + have hWbdd : ∀ t, BddAbove (W t) := fun t => ⟨1, by + rintro x (rfl | ⟨d, -, rfl⟩) + · exact zero_le_one + · exact hv1 d⟩ + have hWne : ∀ t, (W t).Nonempty := fun t => ⟨0, mem_insert _ _⟩ + let r : 𝕀 → ℝ := fun t => sSup (W t) + have hr0 : ∀ t, 0 ≤ r t := fun t => le_csSup (hWbdd t) (mem_insert _ _) + have hr1 : ∀ t, r t ≤ 1 := fun t => csSup_le (hWne t) (by + rintro x (rfl | ⟨d, -, rfl⟩) + · exact zero_le_one + · exact hv1 d) + let c : 𝕀 → 𝕀 := fun t => ⟨r t, hr0 t, hr1 t⟩ + have hcmono : Monotone c := by + intro s t hst + refine csSup_le_csSup (hWbdd t) (hWne s) ?_ + rintro x (rfl | ⟨d, hd, rfl⟩) + · exact mem_insert _ _ + · exact mem_insert_of_mem _ ⟨d, le_trans hd hst, rfl⟩ + have hcD : ∀ d : D, r ((d : Z) : 𝕀) = v d := by + intro d + refine le_antisymm (csSup_le (hWne _) ?_) (le_csSup (hWbdd _) (mem_insert_of_mem _ ⟨d, le_refl + ((d : Z) : 𝕀), rfl⟩)) + rintro x (rfl | ⟨d', hd', rfl⟩) + · exact hv0 d + · exact hvmono hd' + have hdenseimg : Dense (c '' Z) := by + refine dense_of_exists_between fun a b hab => ?_ + obtain ⟨q, h1, h2⟩ := exists_rat_btwn (show (a : ℝ) < b from hab) + have hq0 : (0 : ℝ) < q := lt_of_le_of_lt a.2.1 h1 + have hq1 : (q : ℝ) < 1 := lt_of_lt_of_le h2 b.2.2 + have hq0' : (0 : ℚ) < q := by exact_mod_cast hq0 + have hq1' : q < (1 : ℚ) := by exact_mod_cast hq1 + let d : D := e.symm ⟨q, hq0', hq1'⟩ + have hdv : v d = q := by simp [v, d] + refine ⟨c ((d : Z) : 𝕀), ⟨_, (d : Z).2, rfl⟩, ?_, ?_⟩ + · change (a : ℝ) < r _ + rw [hcD, hdv] + exact h1 + · change r _ < (b : ℝ) + rw [hcD, hdv] + exact h2 + have hcc : Continuous c := hcmono.continuous_of_denseRange + (hdenseimg.mono (image_subset_range c Z)) + have hsurj : Function.Surjective c := by + have hcl : IsClosed (range c) := (isCompact_range hcc).isClosed + have : range c = univ := + (hdenseimg.mono (image_subset_range c Z)).closure_eq ▸ hcl.closure_eq.symm + exact range_eq_univ.mp this + refine ⟨c, hcmono, hcc, hdenseimg, ?_, ?_, ?_, ?_⟩ + · obtain ⟨t, ht⟩ := hsurj 0 + have h := hcmono (unitInterval.nonneg' (t := t)) + rw [ht] at h + exact le_antisymm h unitInterval.nonneg' + · obtain ⟨t, ht⟩ := hsurj 1 + have h := hcmono (unitInterval.le_one' (t := t)) + rw [ht] at h + exact le_antisymm unitInterval.le_one' h + · intro y hy y' hy' hyy + obtain ⟨d₁, hd₁, h1, h2⟩ := hbetween ⟨y, hy⟩ ⟨y', hy'⟩ hyy + obtain ⟨d₂, hd₂, h3, h4⟩ := hbetween d₁ ⟨y', hy'⟩ h2 + have h5 : c y ≤ c (d₁ : 𝕀) := hcmono (le_of_lt h1) + have h6 : c (d₂ : 𝕀) ≤ c y' := hcmono (le_of_lt h4) + have h7 : c (d₁ : 𝕀) < c (d₂ : 𝕀) := by + change r _ < r _ + rw [hcD ⟨d₁, hd₁⟩, hcD ⟨d₂, hd₂⟩] + exact hvstrict h3 + exact lt_of_le_of_lt h5 (lt_of_lt_of_le h7 h6) + · intro s t hst hgap + refine Subtype.ext ?_ + change sSup (W s) = sSup (W t) + have : W s = W t := by + refine congrArg (insert 0) (congrArg _ ?_) + ext d + constructor + · exact fun h => le_trans h hst.le + · intro h + by_contra hd + have hm : ((d : Z) : 𝕀) ∈ Ioc s t ∩ Z := ⟨⟨not_le.mp hd, h⟩, (d : Z).2⟩ + rw [hgap] at hm + exact hm + rw [this] + +section Minimal + +variable [T2Space X] {γ : 𝕀 → X} {T : Set 𝕀} + +omit [TopologicalSpace X] [T2Space X] in +/-- In a minimal admissible set, equal values of `γ` leave no point of the set between them. -/ +private theorem Ioo_inter_eq_empty (hT : Minimal (IsAdmissible γ) T) {s t : 𝕀} (hs : s ∈ T) + (ht : t ∈ T) (heq : γ s = γ t) : Ioo s t ∩ T = ∅ := by + have hadm : IsAdmissible γ (T \ Ioo s t) := by + refine ⟨hT.1.1.sdiff isOpen_Ioo, ⟨hT.1.2.1, fun h => absurd h.1 (unitInterval.nonneg' (t + := s)).not_gt⟩, + ⟨hT.1.2.2.1, fun h => absurd h.2 (unitInterval.le_one' (t := t)).not_gt⟩, ?_⟩ + rintro a ⟨haT, ha⟩ b ⟨hbT, hb⟩ hab hgap + by_cases hempty : Ioo a b ∩ T = ∅ + · exact hT.1.2.2.2 a haT b hbT hab hempty + obtain ⟨z, hz, hzT⟩ := nonempty_iff_ne_empty.mpr hempty + have hzin : z ∈ Ioo s t := by + by_contra hn + have : z ∈ Ioo a b ∩ (T \ Ioo s t) := ⟨hz, hzT, hn⟩ + rw [hgap] at this + exact this + have has : a ≤ s := by + by_contra hc + exact ha ⟨not_le.mp hc, hz.1.trans hzin.2⟩ + have htb : t ≤ b := by + by_contra hc + exact hb ⟨hzin.1.trans hz.2, not_le.mp hc⟩ + have hab' : a = s := by + by_contra hne + have : s ∈ Ioo a b ∩ (T \ Ioo s t) := + ⟨⟨lt_of_le_of_ne has hne, hzin.1.trans hz.2⟩, hs, fun h => lt_irrefl _ h.1⟩ + rw [hgap] at this + exact this + have hbb : b = t := by + by_contra hne + have : t ∈ Ioo a b ∩ (T \ Ioo s t) := + ⟨⟨hz.1.trans hzin.2, lt_of_le_of_ne htb (Ne.symm hne)⟩, ht, fun h => lt_irrefl _ h.2⟩ + rw [hgap] at this + exact this + rw [hab', hbb] + exact heq + have hsub : T ⊆ T \ Ioo s t := hT.2 hadm sdiff_subset + rw [eq_empty_iff_forall_notMem] + rintro z ⟨hz, hzT⟩ + exact (hsub hzT).2 hz + +/-- `t` is the right end of a gap of `T`. -/ +private def IsRightEnd (T : Set 𝕀) (t : 𝕀) : Prop := ∃ a ∈ T, a < t ∧ Ioo a t ∩ T = ∅ + +/-- Between two points of `T` with different values lies a point of `T` that is no right end, with +a third value. -/ +private theorem exists_between_of_ne (hγ : Continuous γ) (hT : Minimal (IsAdmissible γ) T) + {s t : 𝕀} (hs : s ∈ T) (ht : t ∈ T) (hst : s < t) (hne : γ s ≠ γ t) : + ∃ z ∈ T, s < z ∧ z < t ∧ ¬ IsRightEnd T z ∧ γ z ≠ γ s ∧ γ z ≠ γ t := by + have hTc := hT.1.1 + have hA : IsCompact (T ∩ Icc s t ∩ γ ⁻¹' {γ s}) := + (hTc.inter isClosed_Icc).isCompact.inter_right (isClosed_singleton.preimage hγ) + obtain ⟨a, ha, hamax⟩ := hA.exists_isGreatest ⟨s, ⟨hs, le_rfl, hst.le⟩, rfl⟩ + have hB : IsCompact (T ∩ Icc a t ∩ γ ⁻¹' {γ t}) := + (hTc.inter isClosed_Icc).isCompact.inter_right (isClosed_singleton.preimage hγ) + obtain ⟨b, hb, hbmin⟩ := hB.exists_isLeast ⟨t, ⟨ht, ha.1.2.2, le_rfl⟩, rfl⟩ + have hγa : γ a = γ s := ha.2 + have hγb : γ b = γ t := hb.2 + have hab : a < b := lt_of_le_of_ne hb.1.2.1 fun h => hne (by rw [← hγa, h, hγb]) + have hgapne : Ioo a b ∩ T ≠ ∅ := by + intro hempty + apply hne + rw [← hγa, ← hγb] + exact hT.1.2.2.2 a ha.1.1 b hb.1.1 hab hempty + obtain ⟨p, hp, hpT⟩ := nonempty_iff_ne_empty.mpr hgapne + have hsa : s ≤ a := ha.1.2.1 + have hbt : b ≤ t := hb.1.2.2 + have hps : γ p ≠ γ s := fun h => + absurd (hamax ⟨⟨hpT, hsa.trans hp.1.le, hp.2.le.trans hbt⟩, h⟩) (not_le.mpr hp.1) + have hpt : γ p ≠ γ t := fun h => + absurd (hbmin ⟨⟨hpT, hp.1.le, hp.2.le.trans hbt⟩, h⟩) (not_le.mpr hp.2) + by_cases hre : IsRightEnd T p + · obtain ⟨q, hqT, hqp, hgap⟩ := hre + have hγq : γ q = γ p := hT.1.2.2.2 q hqT p hpT hqp hgap + have haq : a ≤ q := by + by_contra hc + have : a ∈ Ioo q p ∩ T := ⟨⟨not_le.mp hc, hp.1⟩, ha.1.1⟩ + rw [hgap] at this + exact this + have haq' : a < q := lt_of_le_of_ne haq fun h => hps (by rw [← hγq, ← h, hγa]) + refine ⟨q, hqT, lt_of_le_of_lt hsa haq', hqp.trans (hp.2.trans_le hbt), ?_, hγq ▸ hps, hγq ▸ + hpt⟩ + rintro ⟨q', hq'T, hq'q, hgap'⟩ + have hγq' : γ q' = γ q := hT.1.2.2.2 q' hq'T q hqT hq'q hgap' + have := Ioo_inter_eq_empty hT hq'T hpT (hγq'.trans hγq) + have hm : q ∈ Ioo q' p ∩ T := ⟨⟨hq'q, hqp⟩, hqT⟩ + rw [this] at hm + exact hm + · exact ⟨p, hpT, lt_of_le_of_lt hsa hp.1, hp.2.trans_le hbt, hre, hps, hpt⟩ + +/-- The points of `T` that survive the collapse. -/ +private def coreSet (T : Set 𝕀) (γ : 𝕀 → X) : Set 𝕀 := + {t | t ∈ T ∧ ¬ IsRightEnd T t ∧ γ t ≠ γ 0 ∧ γ t ≠ γ 1} + +private theorem exists_core_between (hγ : Continuous γ) (hT : Minimal (IsAdmissible γ) T) + (h01 : γ 0 ≠ γ 1) {s t : 𝕀} (hs : s ∈ T) (ht : t ∈ T) (hst : s < t) (hne : γ s ≠ γ t) : + ∃ z ∈ coreSet T γ, s < z ∧ z < t ∧ γ z ≠ γ s := by + have hTc := hT.1.1 + have h0T := hT.1.2.1 + have h1T := hT.1.2.2.1 + have hA : IsCompact (T ∩ γ ⁻¹' {γ 0}) := hTc.isCompact.inter_right (isClosed_singleton.preimage + hγ) + have hB : IsCompact (T ∩ γ ⁻¹' {γ 1}) := hTc.isCompact.inter_right (isClosed_singleton.preimage + hγ) + obtain ⟨a, ha, hamax⟩ := hA.exists_isGreatest ⟨0, h0T, rfl⟩ + obtain ⟨b, hb, hbmin⟩ := hB.exists_isLeast ⟨1, h1T, rfl⟩ + have hγa : γ a = γ 0 := ha.2 + have hγb : γ b = γ 1 := hb.2 + have h01lt : (0 : 𝕀) < 1 := zero_lt_one + have hend0 : ∀ z ∈ T, z < a → z = 0 := by + intro z hz hza + by_contra h0 + have hzpos : 0 < z := lt_of_le_of_ne unitInterval.nonneg' (Ne.symm h0) + have := Ioo_inter_eq_empty hT h0T ha.1 hγa.symm + have hm : z ∈ Ioo 0 a ∩ T := ⟨⟨hzpos, hza⟩, hz⟩ + rw [this] at hm + exact hm + have hend1 : ∀ z ∈ T, b < z → z = 1 := by + intro z hz hbz + by_contra h1 + have hzlt : z < 1 := lt_of_le_of_ne unitInterval.le_one' h1 + have := Ioo_inter_eq_empty hT hb.1 h1T hγb + have hm : z ∈ Ioo b 1 ∩ T := ⟨⟨hbz, hzlt⟩, hz⟩ + rw [this] at hm + exact hm + have hab : a < b := by + rcases lt_trichotomy a b with h | h | h + · exact h + · exact absurd (by rw [← hγa, h, hγb]) h01 + · exact absurd (by rw [← hγb, hend0 b hb.1 h]) h01.symm + have hsb : s < b := by + by_contra hc + rw [not_lt] at hc + have ht1 : t = 1 := hend1 t ht (lt_of_le_of_lt hc hst) + rcases eq_or_lt_of_le hc with h | h + · exact hne (by rw [← h, hγb, ht1]) + · have hs1 := hend1 s hs h + rw [hs1, ht1] at hst + exact lt_irrefl _ hst + have hat : a < t := by + by_contra hc + rw [not_lt] at hc + have hs0 : s = 0 := hend0 s hs (lt_of_lt_of_le hst hc) + rcases eq_or_lt_of_le hc with h | h + · exact hne (by rw [h, hγa, hs0]) + · have ht0 := hend0 t ht h + rw [ht0, hs0] at hst + exact lt_irrefl _ hst + set s₁ := max s a with hs₁ + set t₁ := min t b with ht₁ + have hs₁T : s₁ ∈ T := by + rcases max_choice s a with h | h <;> rw [hs₁, h] + · exact hs + · exact ha.1 + have ht₁T : t₁ ∈ T := by + rcases min_choice t b with h | h <;> rw [ht₁, h] + · exact ht + · exact hb.1 + have hst₁ : s₁ < t₁ := max_lt (lt_min hst hsb) (lt_min hat hab) + have hne₁ : γ s₁ ≠ γ t₁ := by + intro h + rcases max_choice s a with h1 | h1 <;> rcases min_choice t b with h2 | h2 <;> + rw [hs₁, ht₁, h1, h2] at h + · exact hne h + · exact absurd (hbmin ⟨hs, h.trans hγb⟩) (not_le.mpr hsb) + · exact absurd (hamax ⟨ht, (h.symm.trans hγa)⟩) (not_le.mpr hat) + · exact h01 (by rw [← hγa, h, hγb]) + obtain ⟨z, hzT, h1, h2, hre, h3, h4⟩ := exists_between_of_ne hγ hT hs₁T ht₁T hst₁ hne₁ + have hza : a < z := lt_of_le_of_lt (le_max_right _ _) h1 + have hzb : z < b := lt_of_lt_of_le h2 (min_le_right _ _) + have hz0 : γ z ≠ γ 0 := fun h => absurd (hamax ⟨hzT, h⟩) (not_le.mpr hza) + have hz1 : γ z ≠ γ 1 := fun h => absurd (hbmin ⟨hzT, h⟩) (not_le.mpr hzb) + refine ⟨z, ⟨hzT, hre, hz0, hz1⟩, lt_of_le_of_lt (le_max_left _ _) h1, + lt_of_lt_of_le h2 (min_le_left _ _), ?_⟩ + intro h + rcases max_choice s a with h' | h' + · rw [hs₁, h'] at h3 + exact h3 h + · -- Here `s ≤ a`, and `γ z = γ s` puts `a` strictly between `s` and `z` unless `s = a`. + rw [hs₁, h'] at h3 + have hsa : s ≤ a := max_eq_right_iff.mp h' + rcases eq_or_lt_of_le hsa with he | hl + · exact h3 (by rw [h, he]) + · have := Ioo_inter_eq_empty hT hs hzT h.symm + have hm : a ∈ Ioo s z ∩ T := ⟨⟨hl, hza⟩, ha.1⟩ + rw [this] at hm + exact hm + +end Minimal + +/-- **Arcs in paths.** A path with different ends in a Hausdorff space contains an injective path +with the same ends. -/ +theorem exists_arc_of_path [T2Space X] {γ : 𝕀 → X} (hγ : Continuous γ) (h01 : γ 0 ≠ γ 1) : + ∃ e : 𝕀 → X, Continuous e ∧ Function.Injective e ∧ e 0 = γ 0 ∧ e 1 = γ 1 ∧ + range e ⊆ range γ := by + classical + obtain ⟨T, hT⟩ := exists_minimal_admissible hγ + have h0T := hT.1.2.1 + have h1T := hT.1.2.2.1 + have h01lt : (0 : 𝕀) < 1 := zero_lt_one + have hZsub : coreSet T γ ⊆ T := fun _ h => h.1 + have hcore := fun {s t : 𝕀} => @exists_core_between X _ _ γ T hγ hT h01 s t + have hdist : ∀ y ∈ coreSet T γ, ∀ y' ∈ coreSet T γ, y < y' → γ y ≠ γ y' := by + intro y hy y' hy' hyy heq + exact hy'.2.1 ⟨y, hy.1, hyy, Ioo_inter_eq_empty hT hy.1 hy'.1 heq⟩ + obtain ⟨c, hcm, hcc, hcd, hc0, hc1, hcs, hcgap⟩ := exists_monotone_interval_collapse (coreSet T γ) + (by + obtain ⟨z, hz, -⟩ := hcore h0T h1T h01lt h01 + exact ⟨z, hz⟩) + (fun y hy y' hy' hyy => by + obtain ⟨z, hz, h1, h2, -⟩ := hcore hy.1 hy'.1 hyy (hdist y hy y' hy' hyy) + exact ⟨z, hz, h1, h2⟩) + (fun y hy => by + have hy1 : y < 1 := lt_of_le_of_ne unitInterval.le_one' fun h => hy.2.2.2 (by rw [h]) + obtain ⟨z, hz, h1, -⟩ := hcore hy.1 h1T hy1 hy.2.2.2 + exact ⟨z, hz, h1⟩) + (fun y hy => by + have hy0 : 0 < y := lt_of_le_of_ne unitInterval.nonneg' fun h => hy.2.2.1 (by rw [← h]) + obtain ⟨z, hz, -, h2, -⟩ := hcore h0T hy.1 hy0 (Ne.symm hy.2.2.1) + exact ⟨z, hz, h2⟩) + have hTcl : IsClosed T := hT.1.1 + have hcT : c '' T = univ := by + have h1 : IsClosed (c '' T) := (hTcl.isCompact.image hcc).isClosed + have h2 : closure (c '' coreSet T γ) ⊆ c '' T := + h1.closure_subset_iff.mpr (image_mono hZsub) + rw [hcd.closure_eq] at h2 + exact univ_subset_iff.mp h2 + -- Equal images under `c` force equal values of `γ`. + have hlt : ∀ s ∈ T, ∀ t ∈ T, s < t → γ s ≠ γ t → c s < c t := by + intro s hs t ht hst hne + obtain ⟨z, hz, h1, h2, h3⟩ := hcore hs ht hst hne + obtain ⟨z', hz', h4, h5, -⟩ := hcore hs hz.1 h1 (Ne.symm h3) + exact lt_of_le_of_lt (hcm h4.le) (lt_of_lt_of_le (hcs z' hz' z hz h5) (hcm h2.le)) + have hfib : ∀ s ∈ T, ∀ t ∈ T, c s = c t → γ s = γ t := by + intro s hs t ht h + rcases lt_trichotomy s t with hst | rfl | hst + · by_contra hne + exact absurd h (hlt s hs t ht hst hne).ne + · rfl + · by_contra hne + exact absurd h (hlt t ht s hs hst (Ne.symm hne)).ne' + let cT : T → 𝕀 := fun t => c t + have hcTc : Continuous cT := hcc.comp continuous_subtype_val + have hcTs : Function.Surjective cT := fun r => by + have : r ∈ c '' T := hcT ▸ mem_univ r + obtain ⟨t, ht, rfl⟩ := this + exact ⟨⟨t, ht⟩, rfl⟩ + have : CompactSpace T := isCompact_iff_compactSpace.mp hTcl.isCompact + have hq : IsQuotientMap cT := hcTc.isClosedMap.isQuotientMap hcTc hcTs + let e : 𝕀 → X := fun r => γ (Classical.choose (hcTs r)).1 + have hee : ∀ t : T, e (cT t) = γ t := fun t => + hfib _ (Classical.choose (hcTs (cT t))).2 _ t.2 (Classical.choose_spec (hcTs (cT t))) + have hecont : Continuous e := by + rw [hq.continuous_iff] + have : e ∘ cT = fun t : T => γ t := funext hee + rw [this] + exact hγ.comp continuous_subtype_val + refine ⟨e, hecont, ?_, ?_, ?_, ?_⟩ + · intro r r' h + obtain ⟨s, rfl⟩ := hcTs r + obtain ⟨t, rfl⟩ := hcTs r' + rw [hee, hee] at h + have key : ∀ s t : 𝕀, s ∈ T → t ∈ T → s < t → γ s = γ t → c s = c t := by + intro s t hs ht hst heq + refine hcgap s t hst ?_ + have hgap := Ioo_inter_eq_empty hT hs ht heq + rw [eq_empty_iff_forall_notMem] + rintro z ⟨hz1, hz2⟩ + rcases eq_or_lt_of_le hz1.2 with he | hl + · exact (he ▸ hz2).2.1 ⟨s, hs, hst, hgap⟩ + · have : z ∈ Ioo s t ∩ T := ⟨⟨hz1.1, hl⟩, hz2.1⟩ + rw [hgap] at this + exact this + rcases lt_trichotomy s.1 t.1 with hst | hst | hst + · exact key _ _ s.2 t.2 hst h + · exact congrArg cT (Subtype.ext hst) + · exact (key _ _ t.2 s.2 hst h.symm).symm + · have := hee ⟨0, h0T⟩ + simpa [cT, hc0] using this + · have := hee ⟨1, h1T⟩ + simpa [cT, hc1] using this + · rintro _ ⟨r, rfl⟩ + exact ⟨_, rfl⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/ArcPlane.lean b/LeanPool/GraphMinor/Surface/ArcPlane.lean new file mode 100644 index 0000000000..8c7c1cce32 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/ArcPlane.lean @@ -0,0 +1,466 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Schoenflies +public import LeanPool.GraphMinor.Surface.ArcInPath +public import LeanPool.GraphMinor.Surface.PlaneLog +import Mathlib.Analysis.InnerProductSpace.Convex +import Mathlib.Analysis.Convex.StrictConvexBetween + +/-! +# An arc in the plane lies on an `O`-arc + +Every arc of the plane is part of an `O`-arc (`exists_closing_arc`), so by the Schoenflies theorem +some homeomorphism of the plane maps it to an arc of the unit circle (`exists_straight`). + +To close an arc we must reach its two ends from the outside. Take a double cover of the plane +branched at the two ends: the Joukowski map `w ↦ (w + 1 / w) / 2`, after an affine change that puts +the ends at `-1` and `1`. The preimage of the arc is an `O`-arc through `-1` and `1`. Each side of +an `O`-arc is simple by the Schoenflies theorem, and the side that misses the pole `0` maps down to +a path between the two ends that misses the rest of the arc. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter Complex + +local notation "𝕀" => unitInterval + +/-- The Joukowski map. -/ +noncomputable def jou (w : ℂ) : ℂ := (w + w⁻¹) / 2 + +/-- Every continuous function on the open unit interval without zeros, which extends continuously to +the closed interval, has a continuous square root that vanishes at the ends. -/ +theorem exists_sqrt_of_ends {d : 𝕀 → ℂ} (hd : Continuous d) (h0 : d 0 = 0) (h1 : d 1 = 0) + (hne : ∀ t, t ≠ 0 → t ≠ 1 → d t ≠ 0) : ∃ r : 𝕀 → ℂ, Continuous r ∧ ∀ t, r t ^ 2 = d t := by + classical + have hmem : ∀ x : ℝ, (x / (1 + |x|) + 1) / 2 ∈ Ioo (0 : ℝ) 1 := fun x => by + have hp : 0 < 1 + |x| := by positivity + have h1 : -(1 + |x|) < x := by linarith [neg_abs_le x] + have h2 : x < 1 + |x| := by linarith [le_abs_self x] + have h3 : -1 < x / (1 + |x|) := by rw [lt_div_iff₀ hp]; linarith + have h4 : x / (1 + |x|) < 1 := by rw [div_lt_iff₀ hp]; linarith + constructor <;> linarith + let τ : ℝ → 𝕀 := fun x => ⟨(x / (1 + |x|) + 1) / 2, (hmem x).1.le, (hmem x).2.le⟩ + have hτc : Continuous τ := by + refine Continuous.subtype_mk ?_ _ + refine Continuous.div_const (Continuous.add (Continuous.div continuous_id (by fun_prop) fun x + => ?_) continuous_const) _ + positivity + let ν : 𝕀 → ℝ := fun t => (2 * t.1 - 1) / (1 - |2 * t.1 - 1|) + have hτν : ∀ t : 𝕀, t ≠ 0 → t ≠ 1 → τ (ν t) = t ∧ ContinuousAt ν t := by + intro t h0' h1' + have ht0 : 0 < t.1 := lt_of_le_of_ne t.2.1 fun h => h0' (Subtype.ext h.symm) + have ht1 : t.1 < 1 := lt_of_le_of_ne t.2.2 fun h => h1' (Subtype.ext h) + have hab : |2 * t.1 - 1| < 1 := abs_lt.mpr ⟨by linarith, by linarith⟩ + have hp : 0 < 1 - |2 * t.1 - 1| := by linarith + constructor + · apply Subtype.ext + change (ν t / (1 + |ν t|) + 1) / 2 = t.1 + have h2 : |ν t| = |2 * t.1 - 1| / (1 - |2 * t.1 - 1|) := by + simp only [ν] + rw [abs_div, abs_of_pos hp] + rw [h2] + have h3 : 1 + |2 * t.1 - 1| / (1 - |2 * t.1 - 1|) = 1 / (1 - |2 * t.1 - 1|) := by + field_simp + ring + rw [h3] + simp only [ν] + field_simp + ring + · refine ContinuousAt.div (by fun_prop) (by fun_prop) hp.ne' + obtain ⟨g, hg, hfg⟩ := hasLogOn_univ_of_ne_zero (E := ℝ) (f := fun x => d (τ x)) (hd.comp hτc) + (fun x => by + apply hne + · intro h + have := congrArg Subtype.val h + exact (hmem x).1.ne' this + · intro h + have := congrArg Subtype.val h + exact (hmem x).2.ne this) + have hgc : Continuous g := continuousOn_univ.mp hg + let r : 𝕀 → ℂ := fun t => if t = 0 ∨ t = 1 then 0 else exp (g (ν t) / 2) + have hr2 : ∀ t, r t ^ 2 = d t := by + intro t + by_cases h : t = 0 ∨ t = 1 + · rcases h with rfl | rfl + · simp [r, h0] + · simp [r, h1] + · push Not at h + simp only [r, ite_eq_right (not_or.mpr h)] + rw [← exp_nat_mul, Nat.cast_ofNat, mul_div_cancel₀ _ (two_ne_zero)] + have h5 : d (τ (ν t)) = exp (g (ν t)) := hfg (ν t) (mem_univ _) + rw [← h5, (hτν t h.1 h.2).1] + refine ⟨r, ?_, hr2⟩ + rw [continuous_iff_continuousAt] + intro t + by_cases h : t = 0 ∨ t = 1 + · have hz : r t = 0 := by simp [r, h] + have hdz : d t = 0 := by + rcases h with rfl | rfl + · exact h0 + · exact h1 + rw [ContinuousAt, hz] + have h3 : Tendsto (fun s => Real.sqrt ‖d s‖) (𝓝 t) (𝓝 0) := by + have := (hd.norm.sqrt).tendsto t + simpa [hdz] using this + refine squeeze_zero_norm (fun s => ?_) h3 + apply le_of_eq + rw [← sq_eq_sq₀ (norm_nonneg _) (Real.sqrt_nonneg _), Real.sq_sqrt + (norm_nonneg _), ← norm_pow, hr2] + · push Not at h + have hopen : IsOpen {s : 𝕀 | s ≠ 0 ∧ s ≠ 1} := isOpen_ne.inter isOpen_ne + have hev : r =ᶠ[𝓝 t] fun s => exp (g (ν s) / 2) := by + filter_upwards [hopen.mem_nhds h] with s hs + simp only [r, ite_eq_right (not_or.mpr hs)] + refine ContinuousAt.congr ?_ hev.symm + have := (hτν t h.1 h.2).2 + exact (Complex.continuous_exp.continuousAt).comp (((hgc.continuousAt (x + := ν t)).comp this).div_const _) + +/-- Each `O`-arc of the plane goes to the unit circle under some homeomorphism of the plane. -/ +theorem exists_plane_circle {F : Set ℂ} (hF : Nonempty (Circle ≃ₜ F)) : + ∃ g : ℂ ≃ₜ ℂ, g '' F = sphere 0 1 := by + obtain ⟨φ⟩ := id hF + obtain ⟨φ₀⟩ := oArc_sphere + let t : sphere (0 : ℂ) 1 ≃ₜ F := φ₀.symm.trans φ + obtain ⟨h₀, k₀, m, hv⟩ := exists_bdMatch t + obtain ⟨G, hG⟩ := exists_homeomorph_of_bdMatch hF m + refine ⟨G.symm, ?_⟩ + ext z + constructor + · rintro ⟨x, hx, rfl⟩ + have h1 : G (t.symm ⟨x, hx⟩).1 = x := by + rw [hG (t.symm ⟨x, hx⟩).2, hv] + simp + have h2 : G.symm x = (t.symm ⟨x, hx⟩).1 := by + apply G.injective + rw [G.apply_symm_apply, h1] + rw [h2] + exact (t.symm ⟨x, hx⟩).2 + · intro hz + refine ⟨G z, ?_, G.symm_apply_apply z⟩ + rw [hG hz, hv ⟨z, hz⟩] + exact (t ⟨z, hz⟩).2 + +/-- A path between two points of the unit circle, off the circle between its ends, and off a given +point that is not on the circle. -/ +theorem exists_side_path {p q z₀ : ℂ} (hp : ‖p‖ = 1) (hq : ‖q‖ = 1) (hpq : p ≠ q) (hz : ‖z₀‖ ≠ 1) : + ∃ ξ : 𝕀 → ℂ, Continuous ξ ∧ ξ 0 = p ∧ ξ 1 = q ∧ (∀ t, t ≠ 0 → t ≠ 1 → ‖ξ t‖ ≠ 1) + ∧ ∀ t, ξ t ≠ z₀ := by + have hp0 : p ≠ 0 := fun h => by simp [h] at hp + rcases lt_or_gt_of_ne hz with hz | hz + · obtain ⟨θ, hθ⟩ : ∃ θ : ℝ, q = p * exp (θ * I) := by + refine ⟨arg (q / p), ?_⟩ + have h1 : ‖q / p‖ = 1 := by rw [norm_div, hp, hq]; norm_num + have h2 := Complex.norm_mul_exp_arg_mul_I (q / p) + rw [h1] at h2 + simp only [ofReal_one, one_mul] at h2 + rw [h2] + field_simp + refine ⟨fun t => ((1 + t.1 * (1 - t.1) : ℝ) : ℂ) * (p * exp ((t.1 * θ : ℝ) * I)), by + have : Continuous fun t : 𝕀 => t.1 := continuous_subtype_val + fun_prop, by simp, by simp [hθ], ?_, ?_⟩ + · intro t h0 h1 + have ht0 : 0 < t.1 := lt_of_le_of_ne t.2.1 fun h => h0 (Subtype.ext h.symm) + have ht1 : t.1 < 1 := lt_of_le_of_ne t.2.2 fun h => h1 (Subtype.ext h) + have hpos : 0 < t.1 * (1 - t.1) := mul_pos ht0 (by linarith) + rw [norm_mul, norm_mul, hp, norm_exp_ofReal_mul_I, Complex.norm_real, Real.norm_of_nonneg + (by positivity)] + simp only [mul_one] + linarith + · intro t he + have hpos : 0 ≤ t.1 * (1 - t.1) := mul_nonneg t.2.1 (by linarith [t.2.2]) + have : ‖z₀‖ = 1 + t.1 * (1 - t.1) := by + rw [← he, norm_mul, norm_mul, hp, norm_exp_ofReal_mul_I, Complex.norm_real, + Real.norm_of_nonneg (by positivity)] + simp + linarith + · have key : ∀ t : 𝕀, ‖(1 - t.1 : ℂ) * p + t.1 * q‖ ≤ 1 := fun t => by + refine (norm_add_le _ _).trans ?_ + have h1 : ‖(1 - (t.1 : ℂ))‖ = 1 - t.1 := by + rw [← ofReal_one, ← ofReal_sub, Complex.norm_real, Real.norm_of_nonneg + (by linarith [t.2.2])] + rw [norm_mul, norm_mul, h1, hp, hq, Complex.norm_real, Real.norm_of_nonneg t.2.1] + linarith + refine ⟨fun t => (1 - t.1 : ℂ) * p + t.1 * q, by + have : Continuous fun t : 𝕀 => (t.1 : ℂ) := continuous_ofReal.comp continuous_subtype_val + fun_prop, by simp, by simp, ?_, ?_⟩ + · intro t h0 h1 he + have ht0 : 0 < t.1 := lt_of_le_of_ne t.2.1 fun h => h0 (Subtype.ext h.symm) + have ht1 : t.1 < 1 := lt_of_le_of_ne t.2.2 fun h => h1 (Subtype.ext h) + have hs : ‖(1 - t.1) • p + t.1 • q‖ < 1 := by + have h4 := (strictConvex_closedBall ℝ (0 : ℂ) 1) (x := p) (y := q) (by simpa using hp.le) + (by simpa using hq.le) hpq (a := 1 - t.1) (b := t.1) (by linarith) ht0 (by ring) + rw [interior_closedBall _ one_ne_zero] at h4 + simpa using h4 + have h3 : (1 - t.1) • p + t.1 • q = (1 - (t.1 : ℂ)) * p + t.1 * q := by + simp [Complex.real_smul] + rw [h3] at hs + exact hs.ne he + · intro t he + have := key t + rw [show (1 - (t.1 : ℂ)) * p + t.1 * q = z₀ from he] at this + linarith + +theorem jou_eq {w n r : ℂ} (h1 : w = n + r) (h2 : (n + r) * (n - r) = 1) : jou w = n := by + subst h1 + have h3 : (n + r)⁻¹ = n - r := (eq_inv_of_mul_eq_one_right h2).symm + rw [jou, h3] + ring + +/-- **Every arc of the plane lies on an `O`-arc.** -/ +theorem exists_closing_arc {a : 𝕀 → ℂ} (ha : IsArcMap a) : + ∃ b : 𝕀 → ℂ, IsArcMap b ∧ b 0 = a 0 ∧ b 1 = a 1 ∧ + ∀ s t, a s = b t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + have hne : a 0 ≠ a 1 := fun h => zero_ne_one (ha.2 h) + set c : ℂ := (a 0 + a 1) / 2 with hc + set e : ℂ := (a 1 - a 0) / 2 with he + have he0 : e ≠ 0 := by + rw [he] + exact div_ne_zero (sub_ne_zero.mpr hne.symm) two_ne_zero + let n : 𝕀 → ℂ := fun t => (a t - c) / e + have hnc : Continuous n := (ha.1.sub continuous_const).div_const _ + have hninj : Function.Injective n := fun s t h => by + have h1 : a s - c = a t - c := by + have := div_left_inj₀ he0 |>.mp h + exact this + exact ha.2 (sub_left_inj.mp h1) + have hn0 : n 0 = -1 := by + simp only [n, hc, he] + field_simp [sub_ne_zero.mpr hne.symm] + ring + have hn1 : n 1 = 1 := by + simp only [n, hc, he] + field_simp [sub_ne_zero.mpr hne.symm] + ring + have h01 : ∀ t, t ≠ 0 → t ≠ 1 → n t ^ 2 - 1 ≠ 0 := by + intro t h0 h1 h + have h2 : (n t - 1) * (n t + 1) = 0 := by linear_combination h + rcases mul_eq_zero.mp h2 with h3 | h3 + · exact h1 (hninj (by rw [hn1]; linear_combination h3)) + · exact h0 (hninj (by rw [hn0]; linear_combination h3)) + obtain ⟨r, hrc, hr⟩ := exists_sqrt_of_ends (d := fun t => n t ^ 2 - 1) (by fun_prop) + (by simp [hn0]) (by simp [hn1]) h01 + have hprod : ∀ t, (n t + r t) * (n t - r t) = 1 := fun t => by + linear_combination -(hr t) + have hr0 : r 0 = 0 := by + have := hr 0 + simp only [hn0] at this + exact pow_eq_zero_iff (two_ne_zero) |>.mp (by rw [this]; norm_num) + have hr1 : r 1 = 0 := by + have := hr 1 + simp only [hn1] at this + exact pow_eq_zero_iff (two_ne_zero) |>.mp (by rw [this]; norm_num) + let w₁ : 𝕀 → ℂ := fun t => n t + r t + let w₂ : 𝕀 → ℂ := fun t => n t - r t + have hj₁ : ∀ t, jou (w₁ t) = n t := fun t => jou_eq rfl (hprod t) + have hj₂ : ∀ t, jou (w₂ t) = n t := fun t => by + have := jou_eq (n := n t) (r := -r t) (w := w₂ t) (by simp [w₂, sub_eq_add_neg]) (by + linear_combination hprod t) + exact this + have hw₁ : IsArcMap w₁ := ⟨hnc.add hrc, fun s t h => hninj (by rw [← hj₁, ← hj₁, h])⟩ + have hw₂ : IsArcMap w₂ := ⟨hnc.sub hrc, fun s t h => hninj (by rw [← hj₂, ← hj₂, h])⟩ + have hmeet : ∀ s t, w₁ s = w₂ t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + intro s t h + have hst : s = t := hninj (by rw [← hj₁, ← hj₂, h]) + subst hst + have h3 : r s = 0 := by + have : (2 : ℂ) * r s = 0 := by + have h4 : n s + r s = n s - r s := h + linear_combination h4 + simpa using this + by_cases h0 : s = 0 + · exact .inl ⟨h0, h0⟩ + · by_cases h1 : s = 1 + · exact .inr ⟨h1, h1⟩ + · exact absurd (by rw [← hr s, h3]; simp) (h01 s h0 h1) + have hO := oArc_of_two_arcs hw₁ hw₂ (by simp [w₁, w₂, hr0]) (by simp [w₁, w₂, hr1]) hmeet + obtain ⟨g, hg⟩ := exists_plane_circle hO + have hmemC : ∀ w : ℂ, w ≠ 0 → ∀ t, jou w = n t → w ∈ range w₁ ∪ range w₂ := by + intro w hw t h + have h1 : (w - w₁ t) * (w - w₂ t) = 0 := by + have h2 : w + w⁻¹ = 2 * n t := by + rw [jou] at h + linear_combination 2 * h + have h3 : w * w⁻¹ = 1 := mul_inv_cancel₀ hw + have h4 := hprod t + simp only [w₁, w₂] + linear_combination w * h2 - h3 + h4 + rcases mul_eq_zero.mp h1 with h2 | h2 + · exact .inl ⟨t, (sub_eq_zero.mp h2).symm⟩ + · exact .inr ⟨t, (sub_eq_zero.mp h2).symm⟩ + have hsph : ∀ w, w ∈ range w₁ ∪ range w₂ → ‖g w‖ = 1 := fun w hw => by + have : g w ∈ sphere (0 : ℂ) 1 := hg ▸ mem_image_of_mem g hw + simpa using this + have hsph' : ∀ w, ‖g w‖ = 1 → w ∈ range w₁ ∪ range w₂ := fun w hw => by + have : g w ∈ g '' (range w₁ ∪ range w₂) := by + rw [hg] + simpa using hw + obtain ⟨y, hy, he'⟩ := this + rwa [← g.injective he'] + have h1C : w₁ 0 = -1 ∧ w₁ 1 = 1 := by simp [w₁, hn0, hn1, hr0, hr1] + have hzero : (0 : ℂ) ∉ range w₁ ∪ range w₂ := by + rintro (⟨t, ht⟩ | ⟨t, ht⟩) + · have := hprod t + simp only [w₁] at ht + rw [ht] at this + simp at this + · have := hprod t + simp only [w₂] at ht + rw [ht] at this + simp at this + have hp : ‖g 1‖ = 1 := hsph _ (.inl ⟨1, h1C.2⟩) + have hq : ‖g (-1)‖ = 1 := hsph _ (.inl ⟨0, h1C.1⟩) + have hpq : g 1 ≠ g (-1) := fun h => by + have := g.injective h + norm_num at this + have hz : ‖g 0‖ ≠ 1 := fun h => hzero (hsph' _ h) + obtain ⟨ξ, hξc, hξ0, hξ1, hξn, hξz⟩ := exists_side_path hp hq hpq hz + let y : 𝕀 → ℂ := fun t => g.symm (ξ t) + have hyc : Continuous y := g.symm.continuous.comp hξc + have hy0 : ∀ t, y t ≠ 0 := fun t h => hξz t (by + rw [← g.apply_symm_apply (ξ t)] + exact congrArg g h) + let β : 𝕀 → ℂ := fun t => c + e * jou (y t) + have hβc : Continuous β := by + have h1 : Continuous fun t => (y t)⁻¹ := hyc.inv₀ hy0 + simp only [β, jou] + fun_prop + have hy00 : y 0 = 1 := by simp [y, hξ0] + have hy1 : y 1 = -1 := by simp [y, hξ1] + have hβ0 : β 0 = a 1 := by + simp only [β, hy00, jou, hc, he] + norm_num + field_simp + ring + have hβ1 : β 1 = a 0 := by + simp only [β, hy1, jou, hc, he] + norm_num + field_simp + ring + have hβa : ∀ t s, β t = a s → t = 0 ∨ t = 1 := by + intro t s h + by_contra hc' + push Not at hc' + have h1 : jou (y t) = n s := by + simp only [n, ← h, β] + field_simp + ring + have h2 := hsph _ (hmemC _ (hy0 t) s h1) + simp only [y, g.apply_symm_apply] at h2 + exact hξn t hc'.1 hc'.2 h2 + obtain ⟨e', he'c, he'i, he'0, he'1, he'r⟩ := exists_arc_of_path hβc + (by rw [hβ0, hβ1]; exact hne.symm) + let σ : 𝕀 → 𝕀 := unitInterval.symm + refine ⟨e' ∘ σ, ⟨he'c.comp unitInterval.continuous_symm, he'i.comp + unitInterval.symm_bijective.injective⟩, ?_, ?_, ?_⟩ + · simp [σ, he'1, hβ1] + · simp [σ, he'0, hβ0] + · intro s t h + obtain ⟨u, hu⟩ := he'r (mem_range_self (σ t)) + have h3 : β u = a s := by rw [hu]; exact h.symm + rcases hβa u s h3 with rfl | rfl + · have h4 : a s = a 1 := by rw [← h3, hβ0] + have hs : s = 1 := ha.2 h4 + have h5 : e' (σ t) = e' 0 := by rw [← hu, he'0] + have h6 := he'i h5 + right + refine ⟨hs, ?_⟩ + have : σ (σ t) = σ 0 := congrArg σ h6 + simpa [σ] using this + · have h4 : a s = a 0 := by rw [← h3, hβ1] + have hs : s = 0 := ha.2 h4 + have h5 : e' (σ t) = e' 1 := by rw [← hu, he'1] + have h6 := he'i h5 + left + refine ⟨hs, ?_⟩ + have : σ (σ t) = σ 1 := congrArg σ h6 + simpa [σ] using this + +/-- **Straightening an arc of the plane.** A homeomorphism of the plane maps the arc to an arc of +the unit circle, with an increasing angle. -/ +theorem exists_straight {a : 𝕀 → ℂ} (ha : IsArcMap a) : + ∃ (g : ℂ ≃ₜ ℂ) (θ : 𝕀 → ℝ), Continuous θ ∧ StrictMono θ ∧ (∀ t, θ t ∈ Ioo (-Real.pi) Real.pi) ∧ + ∀ t, g (a t) = exp (θ t * I) := by + obtain ⟨b, hb, h0, h1, hm⟩ := exists_closing_arc ha + have hO := oArc_of_two_arcs ha hb h0.symm h1.symm hm + obtain ⟨g₀, hg₀⟩ := exists_plane_circle hO + have hnorm : ∀ x ∈ range a ∪ range b, ‖g₀ x‖ = 1 := fun x hx => by + have : g₀ x ∈ sphere (0 : ℂ) 1 := hg₀ ▸ mem_image_of_mem g₀ hx + simpa using this + set m : 𝕀 := ⟨1 / 2, by norm_num, by norm_num⟩ with hmd + have hm0 : m ≠ 0 := fun h => by + have := congrArg Subtype.val h + norm_num [hmd] at this + have hm1 : m ≠ 1 := fun h => by + have := congrArg Subtype.val h + norm_num [hmd] at this + set z := g₀ (b m) with hz + have hzn : ‖z‖ = 1 := hnorm _ (.inr ⟨m, rfl⟩) + have hz0 : z ≠ 0 := fun h => by simp [h] at hzn + have hzu : (-z⁻¹) ≠ 0 := neg_ne_zero.mpr (inv_ne_zero hz0) + let ρ : ℂ ≃ₜ ℂ := Homeomorph.mulLeft₀ (-z⁻¹) hzu + let g₁ : ℂ ≃ₜ ℂ := g₀.trans ρ + have hg₁ : ∀ t, ‖g₁ (a t)‖ = 1 := fun t => by + change ‖-z⁻¹ * g₀ (a t)‖ = 1 + rw [norm_mul, norm_neg, norm_inv, hzn, hnorm _ (.inl ⟨t, rfl⟩)] + simp + have hne : ∀ t, g₁ (a t) ≠ -1 := fun t h => by + have h2 : g₀ (a t) = z := by + have h3 : -z⁻¹ * g₀ (a t) = -1 := h + have h4 : z⁻¹ * g₀ (a t) = 1 := by linear_combination -h3 + rw [inv_mul_eq_iff_eq_mul₀ hz0, mul_one] at h4 + exact h4 + have h3 : a t = b m := g₀.injective h2 + rcases hm t m h3 with h4 | h4 + · exact hm0 h4.2 + · exact hm1 h4.2 + have hslit : ∀ t, g₁ (a t) ∈ slitPlane := fun t => by + rw [mem_slitPlane_iff] + by_contra h + push Not at h + have h3 : (g₁ (a t)).re ^ 2 = 1 := by + have h4 := hg₁ t + have h5 : normSq (g₁ (a t)) = 1 := by rw [normSq_eq_norm_sq, h4]; norm_num + rw [normSq_apply, h.2] at h5 + nlinarith + apply hne t + apply Complex.ext + · have : (g₁ (a t)).re = -1 := by nlinarith [h.1] + simpa using this + · simpa using h.2 + let θ₀ : 𝕀 → ℝ := fun t => arg (g₁ (a t)) + have hc : Continuous θ₀ := continuous_iff_continuousAt.mpr fun t => + ContinuousAt.comp (g := arg) (f := fun t => g₁ (a t)) (continuousAt_arg (hslit t)) + (g₁.continuous.comp ha.1).continuousAt + have hexp : ∀ t, g₁ (a t) = exp (θ₀ t * I) := fun t => by + have := Complex.norm_mul_exp_arg_mul_I (g₁ (a t)) + rw [hg₁] at this + simpa using this.symm + have hinj : Function.Injective θ₀ := fun s t h => ha.2 (g₁.injective (by rw [hexp, hexp, h])) + have hrange : ∀ t, θ₀ t ∈ Ioo (-Real.pi) Real.pi := fun t => + ⟨neg_pi_lt_arg _, lt_of_le_of_ne (arg_le_pi _) (fun h => hne t (by + have := hexp t + rw [h] at this + rw [this] + simp [exp_pi_mul_I]))⟩ + rcases hc.strictMono_of_inj hinj with hmono | hanti + · exact ⟨g₁, θ₀, hc, hmono, hrange, hexp⟩ + · let κ : ℂ ≃ₜ ℂ := conjCLE.toHomeomorph + refine ⟨g₁.trans κ, fun t => -θ₀ t, hc.neg, fun s t h => neg_lt_neg (hanti h), fun t + => ⟨by linarith [(hrange t).2], by linarith [(hrange t).1]⟩, fun t => ?_⟩ + change (starRingEnd ℂ) (g₁ (a t)) = _ + rw [hexp, ← exp_conj] + simp + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/ArcTools.lean b/LeanPool/GraphMinor/Surface/ArcTools.lean new file mode 100644 index 0000000000..6a3c23975c --- /dev/null +++ b/LeanPool/GraphMinor/Surface/ArcTools.lean @@ -0,0 +1,248 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscMerge + +/-! +# Pieces of arcs + +Splitting a line at a point, joining two lines at a common end, and the piece of a line between two +parameters. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +local notation "𝕀" => unitInterval + +universe u + +variable {X : Type u} [TopologicalSpace X] + +/-- The extension of a map of the unit interval to the real line. -/ +noncomputable def extI (a : 𝕀 → X) (t : ℝ) : X := a (projIcc 0 1 zero_le_one t) + +theorem continuous_extI {a : 𝕀 → X} (ha : Continuous a) : Continuous (extI a) := + ha.comp continuous_projIcc + +omit [TopologicalSpace X] in +theorem extI_coe (a : 𝕀 → X) (t : 𝕀) : extI a t = a t := by + unfold extI + rw [projIcc_val] + +omit [TopologicalSpace X] in +theorem extI_of_mem (a : 𝕀 → X) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : extI a t = a ⟨t, ht⟩ + := extI_coe a ⟨t, ht⟩ + +/-- The part of `a` between the parameters `s` and `r`. -/ +noncomputable def pieceA (a : 𝕀 → X) (s r : ℝ) (u : 𝕀) : X := extI a (s + u * (r - s)) + +theorem mix_mem {s r : ℝ} (hs : 0 ≤ s) (hsr : s ≤ r) (hr : r ≤ 1) (u : 𝕀) : s + u * (r - s) ∈ Icc + (0 : ℝ) 1 := by + have h0 := u.2.1 + have h1 := u.2.2 + have h2 : (u : ℝ) * (r - s) ≤ 1 * (r - s) := mul_le_mul_of_nonneg_right h1 (by linarith) + have h3 : 0 ≤ (u : ℝ) * (r - s) := mul_nonneg h0 (by linarith) + constructor <;> linarith + +theorem isArcMap_pieceA {a : 𝕀 → X} (ha : IsArcMap a) {s r : ℝ} (hs : 0 ≤ s) (hsr : s < r) (hr : r + ≤ 1) : + IsArcMap (pieceA a s r) := by + refine ⟨(continuous_extI ha.1).comp (by fun_prop), fun u v he => ?_⟩ + have hu := mix_mem hs hsr.le hr u + have hv := mix_mem hs hsr.le hr v + simp only [pieceA, extI_of_mem a hu, extI_of_mem a hv] at he + have h1 := congrArg Subtype.val (ha.2 he) + have h2 : (u : ℝ) * (r - s) = v * (r - s) := by simpa using h1 + exact Subtype.ext (mul_right_cancel₀ (sub_pos.mpr hsr).ne' h2) + +omit [TopologicalSpace X] in +theorem pieceA_zero (a : 𝕀 → X) (s r : ℝ) : pieceA a s r 0 = extI a s := by simp [pieceA] + +omit [TopologicalSpace X] in +theorem pieceA_one (a : 𝕀 → X) (s r : ℝ) : pieceA a s r 1 = extI a r := by simp [pieceA] + +omit [TopologicalSpace X] in +theorem range_pieceA (a : 𝕀 → X) {s r : ℝ} (_hs : 0 ≤ s) (hsr : s ≤ r) (hr : r ≤ 1) : + range (pieceA a s r) = extI a '' Icc s r := by + ext x + constructor + · rintro ⟨u, rfl⟩ + have h0 := u.2.1 + have h1 := u.2.2 + have h2 : (u : ℝ) * (r - s) ≤ 1 * (r - s) := mul_le_mul_of_nonneg_right h1 (by linarith) + have h3 : 0 ≤ (u : ℝ) * (r - s) := mul_nonneg h0 (by linarith) + exact ⟨_, ⟨by linarith, by linarith⟩, rfl⟩ + · rintro ⟨t, ⟨h1, h2⟩, rfl⟩ + rcases eq_or_lt_of_le hsr with rfl | hlt + · have : t = s := le_antisymm h2 h1 + exact ⟨0, by simp [pieceA, this]⟩ + · have hd : 0 < r - s := sub_pos.mpr hlt + refine ⟨⟨(t - s) / (r - s), div_nonneg (by linarith) hd.le, (div_le_one hd).mpr + (by linarith)⟩, ?_⟩ + simp only [pieceA] + congr 1 + field_simp + ring + +omit [TopologicalSpace X] in +theorem extI_injOn {a : 𝕀 → X} (ha : Function.Injective a) : InjOn (extI a) (Icc 0 1) := by + intro s hs r hr he + rw [extI_of_mem a hs, extI_of_mem a hr] at he + exact congrArg Subtype.val (ha he) + +/-- A line is split in two by a point that is not an end. -/ +theorem IsLineWithEnds.split [T2Space X] {L : Set X} {u v x : X} (h : IsLineWithEnds L u v) + (hx : x ∈ L) + (hu : x ≠ u) (hv : x ≠ v) : + ∃ L₁ L₂ : Set X, IsLineWithEnds L₁ u x ∧ IsLineWithEnds L₂ x v ∧ L₁ ∪ L₂ = L ∧ L₁ ∩ L₂ = {x} + := by + obtain ⟨a, ha, rfl, rfl, rfl⟩ := h.exists_arc + obtain ⟨t, rfl⟩ := hx + have h0 : (0 : ℝ) < t := lt_of_le_of_ne t.2.1 fun he => hu (congrArg a (Subtype.ext he.symm)) + have h1 : (t : ℝ) < 1 := lt_of_le_of_ne t.2.2 fun he => hv (congrArg a (Subtype.ext he)) + have a1 := isArcMap_pieceA ha le_rfl h0 h1.le + have a2 := isArcMap_pieceA ha h0.le h1 le_rfl + have e1 : extI a 0 = a 0 := extI_coe a 0 + have e2 : extI a 1 = a 1 := extI_coe a 1 + have e3 : extI a t = a t := extI_coe a t + refine ⟨range (pieceA a 0 t), range (pieceA a t 1), ?_, ?_, ?_, ?_⟩ + · have := a1.isLineWithEnds + rwa [pieceA_zero, pieceA_one, e1, e3] at this + · have := a2.isLineWithEnds + rwa [pieceA_zero, pieceA_one, e2, e3] at this + · rw [range_pieceA a le_rfl h0.le h1.le, range_pieceA a h0.le h1.le le_rfl, ← image_union, + Icc_union_Icc_eq_Icc h0.le h1.le] + ext y + constructor + · rintro ⟨r, hr, rfl⟩ + exact ⟨⟨r, hr⟩, (extI_of_mem a hr).symm⟩ + · rintro ⟨r, rfl⟩ + exact ⟨r, r.2, extI_coe a r⟩ + · rw [range_pieceA a le_rfl h0.le h1.le, range_pieceA a h0.le h1.le le_rfl] + ext y + constructor + · rintro ⟨⟨r, hr, rfl⟩, ⟨r', hr', he⟩⟩ + have h2 : r' = r := extI_injOn ha.2 ⟨h0.le.trans hr'.1, hr'.2⟩ ⟨hr.1, hr.2.trans h1.le⟩ he + have h3 : r = t := le_antisymm hr.2 (h2 ▸ hr'.1) + rw [h3] + exact e3 + · rintro rfl + exact ⟨⟨t, ⟨h0.le, le_rfl⟩, e3⟩, ⟨t, ⟨le_rfl, h1.le⟩, e3⟩⟩ + +theorem IsLineWithEnds.symm {L : Set X} {u v : X} (h : IsLineWithEnds L u v) : IsLineWithEnds L v u + := by + obtain ⟨f, h0, h1⟩ := h + refine ⟨unitInterval.symmHomeomorph.trans f, ?_, ?_⟩ <;> simp [h0, h1] + +/-- Two lines with one common point, an end of both, form a line. -/ +theorem IsLineWithEnds.union [T2Space X] {L₁ L₂ : Set X} {u x v : X} (h₁ : IsLineWithEnds L₁ u x) + (h₂ : IsLineWithEnds L₂ x v) (hi : L₁ ∩ L₂ = {x}) : IsLineWithEnds (L₁ ∪ L₂) u v := by + obtain ⟨a, ha, rfl, rfl, e1⟩ := h₁.exists_arc + obtain ⟨b, hb, rfl, e2, rfl⟩ := h₂.exists_arc + let c : ℝ → X := fun t => if t ≤ 1 / 2 then extI a (2 * t) else extI b (2 * t - 1) + have hc : Continuous c := by + refine Continuous.if_le ((continuous_extI ha.1).comp (by fun_prop)) + ((continuous_extI hb.1).comp (by fun_prop)) continuous_id continuous_const fun t ht => ?_ + have : t = 1 / 2 := ht + subst this + norm_num + have e3 : extI a 1 = a 1 := extI_coe a 1 + have e4 : extI b 0 = b 0 := extI_coe b 0 + rw [e3, e4, e1, e2] + have hle : ∀ t : 𝕀, (t : ℝ) ≤ 1 / 2 → 2 * (t : ℝ) ∈ Icc (0 : ℝ) 1 := fun t h => + ⟨by linarith [t.2.1], by linarith⟩ + have hge : ∀ t : 𝕀, ¬ (t : ℝ) ≤ 1 / 2 → 2 * (t : ℝ) - 1 ∈ Icc (0 : ℝ) 1 := fun t h => by + push Not at h + exact ⟨by linarith, by linarith [t.2.2]⟩ + let e : 𝕀 → X := fun t => c t + have hval : ∀ {y : X}, y ∈ range a → y ∈ range b → y = a 1 := fun {y} h1 h2 => by + have : y ∈ range a ∩ range b := ⟨h1, h2⟩ + rw [hi] at this + exact (mem_singleton_iff.mp this).trans e1.symm + have hinj : Function.Injective e := by + intro s t he + simp only [e, c] at he + by_cases h1 : (s : ℝ) ≤ 1 / 2 <;> by_cases h2 : (t : ℝ) ≤ 1 / 2 + · rw [ite_eq_left h1, ite_eq_left h2, extI_of_mem a (hle s h1), extI_of_mem a (hle t h2)] at he + have := congrArg Subtype.val (ha.2 he) + exact Subtype.ext (by simpa using this) + · rw [ite_eq_left h1, ite_eq_right h2, extI_of_mem a (hle s h1), extI_of_mem b (hge t h2)] at he + have e5 := hval ⟨_, rfl⟩ ⟨_, he.symm⟩ + have e6 := ha.2 e5 + have e7 := hb.2 (he.symm.trans (e5.trans (e1.trans e2.symm))) + have e8 := congrArg Subtype.val e6 + have e9 := congrArg Subtype.val e7 + simp at e8 e9 + push Not at h2 + linarith + · rw [ite_eq_right h1, ite_eq_left h2, extI_of_mem b (hge s h1), extI_of_mem a (hle t h2)] at he + have e5 := hval ⟨_, rfl⟩ ⟨_, he⟩ + have e6 := ha.2 e5 + have e7 := hb.2 (he.trans (e5.trans (e1.trans e2.symm))) + have e8 := congrArg Subtype.val e6 + have e9 := congrArg Subtype.val e7 + simp at e8 e9 + push Not at h1 + linarith + · rw [ite_eq_right h1, ite_eq_right h2, extI_of_mem b (hge s h1), extI_of_mem b + (hge t h2)] at he + have := congrArg Subtype.val (hb.2 he) + exact Subtype.ext (by simpa using this) + have he : IsArcMap e := ⟨hc.comp continuous_subtype_val, hinj⟩ + have hr : range e = range a ∪ range b := by + ext y + constructor + · rintro ⟨t, rfl⟩ + simp only [e, c] + by_cases h1 : (t : ℝ) ≤ 1 / 2 + · rw [ite_eq_left h1, extI_of_mem a (hle t h1)] + exact .inl ⟨_, rfl⟩ + · rw [ite_eq_right h1, extI_of_mem b (hge t h1)] + exact .inr ⟨_, rfl⟩ + · rintro (⟨t, rfl⟩ | ⟨t, rfl⟩) + · have hm : (t : ℝ) / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [t.2.1], by linarith [t.2.2]⟩ + refine ⟨⟨_, hm⟩, ?_⟩ + have h1 : (t : ℝ) / 2 ≤ 1 / 2 := by linarith [t.2.2] + simp only [e, c, ite_eq_left h1] + rw [show 2 * ((t : ℝ) / 2) = t by ring] + exact extI_coe a t + · by_cases ht : (t : ℝ) = 0 + · have ht' : t = 0 := Subtype.ext ht + refine ⟨⟨1 / 2, by norm_num, by norm_num⟩, ?_⟩ + simp only [e, c] + rw [ite_eq_left le_rfl, ht'] + norm_num + exact (extI_coe a 1).trans (e1.trans e2.symm) + · have hm : ((t : ℝ) + 1) / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [t.2.1], by linarith [t.2.2]⟩ + refine ⟨⟨_, hm⟩, ?_⟩ + have h1 : ¬ ((t : ℝ) + 1) / 2 ≤ 1 / 2 := by + have := lt_of_le_of_ne t.2.1 (Ne.symm ht) + linarith + simp only [e, c, ite_eq_right h1] + rw [show 2 * (((t : ℝ) + 1) / 2) - 1 = t by ring] + exact extI_coe b t + have hl := he.isLineWithEnds + rw [hr] at hl + have h0 : e 0 = a 0 := by + simp only [e, c] + rw [ite_eq_left (by norm_num)] + simpa using extI_coe a 0 + have h1 : e 1 = b 1 := by + simp only [e, c] + rw [ite_eq_right (by norm_num)] + norm_num + exact extI_coe b 1 + rwa [h0, h1] at hl + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Cap.lean b/LeanPool/GraphMinor/Surface/Cap.lean new file mode 100644 index 0000000000..ce260ef3f3 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Cap.lean @@ -0,0 +1,643 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.OpenDisc +import Mathlib.Analysis.Convex.GaugeRescale + +/-! +# Small discs on the outside of a closed disc + +Let `D` be a closed disc in a surface and let `L` be a short line of its boundary. In this file we +find a closed disc `T` outside `D` that meets `D` exactly in `L` (`exists_cap`). So the boundary of +`D` is flat near `L`, and `D ∪ T` is a closed disc that has the middle of `L` in its inside. This +is the tool for collars of cuffs in `Collar.lean`. + +The reason is the Schoenflies theorem. A thin strip of `D` along `L` is a closed disc in a plane +chart, +so a homeomorphism of the plane turns it into a rectangle, with `L` on the top side. The rectangle +straight above `L` is the wanted disc, when it is thin enough. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +universe u + +/-- A compact convex subset of the plane with interior is a closed disc, and its boundary as a disc +is +its frontier. -/ +theorem isClosedDisc_of_convex {K : Set ℂ} (hc : Convex ℝ K) (hne : (interior K).Nonempty) + (hb : Bornology.IsBounded K) (hcl : IsClosed K) : + IsClosedDisc K ∧ discBd K = frontier K := by + obtain ⟨Ψ, -, h2, h3⟩ := exists_homeomorph_image_interior_closure_frontier_eq_unitBall hc hne hb + rw [hcl.closure_eq] at h2 + have hK : K = Ψ.symm '' closedBall 0 1 := by + rw [← h2, image_image] + simp + have hF : frontier K = Ψ.symm '' sphere 0 1 := by + rw [← h3, image_image] + simp + obtain ⟨h4, h5⟩ := isClosedDisc_closedBall.1.image (f := Ψ.symm) (f' := Ψ) + Ψ.symm.continuous.continuousOn Ψ.continuous.continuousOn fun z _ => Ψ.apply_symm_apply z + rw [isClosedDisc_closedBall.2] at h5 + rw [hK, hF] at * + exact ⟨h4, h5⟩ + +/-- A rectangle in the plane. -/ +theorem isClosedDisc_rect {a b c d : ℝ} (hab : a < b) (hcd : c < d) : + IsClosedDisc (Icc a b ×ℂ Icc c d) ∧ discBd (Icc a b ×ℂ Icc c d) = frontier (Icc a b ×ℂ Icc c d) + := by + have hconv : Convex ℝ (Icc a b ×ℂ Icc c d) := + ((convex_Icc a b).is_linear_preimage (f := Complex.reLm) Complex.reLm.isLinear).inter + ((convex_Icc c d).is_linear_preimage (f := Complex.imLm) Complex.imLm.isLinear) + refine isClosedDisc_of_convex hconv ?_ (isCompact_Icc.reProdIm isCompact_Icc).isBounded + (isCompact_Icc.reProdIm isCompact_Icc).isClosed + have hopen : IsOpen (Ioo a b ×ℂ Ioo c d) := + (isOpen_Ioo.preimage Complex.continuous_re).inter (isOpen_Ioo.preimage Complex.continuous_im) + refine ⟨⟨(a + b) / 2, (c + d) / 2⟩, mem_interior.mpr ⟨Ioo a b ×ℂ Ioo c d, ?_, hopen, ?_⟩⟩ + · intro z hz + obtain ⟨h1, h2⟩ := Complex.mem_reProdIm.mp hz + exact Complex.mem_reProdIm.mpr ⟨Ioo_subset_Icc_self h1, Ioo_subset_Icc_self h2⟩ + · exact Complex.mem_reProdIm.mpr ⟨⟨by simp only; linarith, by simp only; linarith⟩, + ⟨by simp only; linarith, by simp only; linarith⟩⟩ + +/-- The frontier of a rectangle contains its top side. -/ +theorem top_subset_frontier_rect {a b c d : ℝ} {z : ℂ} (hz : z.re ∈ Icc a b) (hd : z.im = d) + (hcd : c ≤ d) : z ∈ frontier (Icc a b ×ℂ Icc c d) := by + have hcl : IsClosed (Icc a b ×ℂ Icc c d) := (isCompact_Icc.reProdIm isCompact_Icc).isClosed + rw [hcl.frontier_eq] + refine ⟨Complex.mem_reProdIm.mpr ⟨hz, by rw [hd]; exact ⟨hcd, le_rfl⟩⟩, fun hi => ?_⟩ + obtain ⟨ρ, hρ, hball⟩ := Metric.isOpen_iff.mp isOpen_interior z hi + have h1 : z + ((ρ / 2 : ℝ) : ℂ) * Complex.I ∈ ball z ρ := by + rw [mem_ball, dist_eq_norm, add_sub_cancel_left, norm_mul, Complex.norm_I, mul_one, + Complex.norm_real, Real.norm_eq_abs, abs_of_pos (by positivity)] + linarith + have h2 := (Complex.mem_reProdIm.mp (interior_subset (hball h1))).2.2 + simp only [Complex.add_im, Complex.mul_im, Complex.ofReal_re, Complex.I_im, Complex.ofReal_im, + Complex.I_re, mul_one, zero_mul, add_zero] at h2 + linarith + +/-- The frontier of a rectangle contains its bottom side. -/ +theorem bot_subset_frontier_rect {a b c d : ℝ} {z : ℂ} (hz : z.re ∈ Icc a b) (hc : z.im = c) + (hcd : c ≤ d) : z ∈ frontier (Icc a b ×ℂ Icc c d) := by + have hcl : IsClosed (Icc a b ×ℂ Icc c d) := (isCompact_Icc.reProdIm isCompact_Icc).isClosed + rw [hcl.frontier_eq] + refine ⟨Complex.mem_reProdIm.mpr ⟨hz, by rw [hc]; exact ⟨le_rfl, hcd⟩⟩, fun hi => ?_⟩ + obtain ⟨ρ, hρ, hball⟩ := Metric.isOpen_iff.mp isOpen_interior z hi + have h1 : z + ((-(ρ / 2) : ℝ) : ℂ) * Complex.I ∈ ball z ρ := by + rw [mem_ball, dist_eq_norm, add_sub_cancel_left, norm_mul, Complex.norm_I, mul_one, + Complex.norm_real, Real.norm_eq_abs, abs_neg, abs_of_pos (by positivity)] + linarith + have h2 := (Complex.mem_reProdIm.mp (interior_subset (hball h1))).2.1 + simp only [Complex.add_im, Complex.mul_im, Complex.ofReal_re, Complex.I_im, Complex.ofReal_im, + Complex.I_re, mul_one, zero_mul, add_zero] at h2 + linarith + +/-- The Schoenflies theorem between two `O`-arcs of the plane. -/ +theorem exists_plane_homeomorph {F₀ F : Set ℂ} (hF₀ : Nonempty (Circle ≃ₜ F₀)) + (hF : Nonempty (Circle ≃ₜ F)) {f f' : ℂ → ℂ} (m : BdMatch F₀ F f f') : + ∃ Ψ : ℂ ≃ₜ ℂ, EqOn Ψ f F₀ ∧ Ψ '' closedInner F₀ = closedInner F := by + obtain ⟨φ⟩ := id hF₀ + obtain ⟨o⟩ := oArc_sphere + obtain ⟨h₁, k₁, m₁, -⟩ := exists_bdMatch (o.symm.trans φ) + obtain ⟨G₁, hG₁⟩ := exists_homeomorph_of_bdMatch hF₀ m₁ + have hm₂ := m₁.trans m + obtain ⟨G₂, hG₂⟩ := exists_homeomorph_of_bdMatch hF hm₂ + have hG₁im : G₁ '' sphere 0 1 = F₀ := by + rw [image_congr hG₁] + exact m₁.image_eq + have hG₂im : G₂ '' sphere 0 1 = F := by + rw [image_congr hG₂] + exact hm₂.image_eq + refine ⟨G₁.symm.trans G₂, fun z hz => ?_, ?_⟩ + · have h1 := m₁.2.1 hz + have h2 : G₁ (k₁ z) = z := by + rw [hG₁ h1] + exact m₁.2.2.2.1 hz + change G₂ (G₁.symm z) = f z + rw [← h2, G₁.symm_apply_apply, hG₂ h1] + have h3 : h₁ (k₁ z) = z := m₁.2.2.2.1 hz + change f (h₁ (k₁ z)) = f (G₁ (k₁ z)) + rw [h3, h2] + · rw [← image_closedBall_of_homeomorph G₁ hF₀ hG₁im, ← image_closedBall_of_homeomorph G₂ hF hG₂im, + image_image] + exact image_congr fun z _ => by simp + +theorem bdMatch_of_leftInvOn {A : Set ℂ} {f f' : ℂ → ℂ} (hf : ContinuousOn f A) + (hf' : ContinuousOn f' (f '' A)) (hl : LeftInvOn f' f A) : BdMatch A (f '' A) f f' := by + refine ⟨mapsTo_image f A, ?_, hl, ?_, hf, hf'⟩ + · rintro _ ⟨z, hz, rfl⟩ + rwa [hl hz] + · rintro _ ⟨z, hz, rfl⟩ + show f (f' (f z)) = f z + rw [hl hz] + +variable {S : Type u} [TopologicalSpace S] + +/-- The point of the unit circle at angle `θ`. -/ +noncomputable def cis' (θ : ℝ) : ℂ := Complex.exp (θ * Complex.I) + +theorem continuous_cis' : Continuous cis' := by + unfold cis' + fun_prop + +theorem norm_cis' (θ : ℝ) : ‖cis' θ‖ = 1 := Complex.norm_exp_ofReal_mul_I θ + +theorem cis'_mem_closedBall (θ : ℝ) : cis' θ ∈ closedBall (0 : ℂ) 1 := by + rw [mem_closedBall_zero_iff, norm_cis'] + +theorem cis'_mem_sphere (θ : ℝ) : cis' θ ∈ sphere (0 : ℂ) 1 := by + rw [mem_sphere_zero_iff_norm, norm_cis'] + +theorem cis'_injOn : InjOn cis' (Ioo (-Real.pi) Real.pi) := by + intro x hx y hy he + have h1 := congrArg Complex.log he + simp only [cis'] at h1 + have hmem : ∀ t : ℝ, t ∈ Ioo (-Real.pi) Real.pi → Complex.log (Complex.exp (t * Complex.I)) + = t * Complex.I := + fun t ht => Complex.log_exp (by simpa using ht.1) (by simpa using ht.2.le) + rw [hmem x hx, hmem y hy] at h1 + have h2 := congrArg Complex.im h1 + simpa using h2 + +/-- The part of the boundary of a closed disc between two angles of a chart. -/ +noncomputable def angleArc (g : ℂ → S) (α β : ℝ) : Set S := (fun θ => g (cis' θ)) '' Icc α β + +/-- The arc between two angles is a line of the boundary. -/ +theorem IsChart.isLine_angleArc [T2Space S] {D : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart D h g) + {α β : ℝ} (hα : -Real.pi < α) (hαβ : α < β) (hβ : β < Real.pi) : + IsLineWithEnds (angleArc g α β) (g (cis' α)) (g (cis' β)) := by + let a : unitInterval → S := fun t => g (cis' (α + t.1 * (β - α))) + have hsub : ∀ t : unitInterval, α + t.1 * (β - α) ∈ Icc α β := fun t => by + have h1 := t.2.1 + have h2 := t.2.2 + constructor <;> nlinarith + have ha : IsArcMap a := by + refine ⟨c.gc.comp_continuous (continuous_cis'.comp (by fun_prop)) fun t + => cis'_mem_closedBall _, + fun s t he => ?_⟩ + have h1 := c.injOn (cis'_mem_closedBall _) (cis'_mem_closedBall _) he + have h2 := cis'_injOn ⟨hα.trans_le (hsub s).1, (hsub s).2.trans_lt hβ⟩ + ⟨hα.trans_le (hsub t).1, (hsub t).2.trans_lt hβ⟩ h1 + have h3 : s.1 * (β - α) = t.1 * (β - α) := by linarith + exact Subtype.ext (mul_right_cancel₀ (sub_pos.mpr hαβ).ne' h3) + have hr : range a = angleArc g α β := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact ⟨_, hsub t, rfl⟩ + · rintro ⟨θ, hθ, rfl⟩ + have hpos := sub_pos.mpr hαβ + refine ⟨⟨(θ - α) / (β - α), div_nonneg (by linarith [hθ.1]) hpos.le, + (div_le_one hpos).mpr (by linarith [hθ.2])⟩, ?_⟩ + change g (cis' (α + (θ - α) / (β - α) * (β - α))) = _ + rw [div_mul_cancel₀ _ hpos.ne'] + congr 2 + ring + have := ha.isLineWithEnds + rw [hr] at this + have h0 : a 0 = g (cis' α) := by simp [a] + have h1 : a 1 = g (cis' β) := by simp [a] + rwa [h0, h1] at this + +theorem IsChart.angleArc_subset {D : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart D h g) (α β : ℝ) : + angleArc g α β ⊆ discBd D := by + rw [← c.g_sphere] + rintro _ ⟨θ, -, rfl⟩ + exact ⟨_, cis'_mem_sphere θ, rfl⟩ + +/-- A little room around the angles of an arc that lies in an open set. -/ +theorem IsChart.exists_margin {D : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart D h g) {W : Set S} + (hW : IsOpen W) {α β : ℝ} (hα : -Real.pi < α) (hαβ : α ≤ β) (hβ : β < Real.pi) + (hsub : angleArc g α β ⊆ W) : + ∃ η > 0, -Real.pi < α - η ∧ β + η < Real.pi ∧ ∃ O : Set ℂ, IsOpen O ∧ + (∀ θ ∈ Icc (α - η) (β + η), cis' θ ∈ O) ∧ ∀ z ∈ O, ‖z‖ ≤ 1 → g z ∈ W := by + obtain ⟨O, hO, hOe⟩ := continuousOn_iff'.mp c.gc W hW + have hK : IsCompact (cis' '' Icc α β) := isCompact_Icc.image continuous_cis' + have hKO : cis' '' Icc α β ⊆ O := by + rintro _ ⟨θ, hθ, rfl⟩ + have h1 : cis' θ ∈ g ⁻¹' W ∩ closedBall 0 1 := ⟨hsub ⟨θ, hθ, rfl⟩, cis'_mem_closedBall θ⟩ + rw [hOe] at h1 + exact h1.1 + have hpre : IsOpen (cis' ⁻¹' O ∩ Ioo (-Real.pi) Real.pi) := + (hO.preimage continuous_cis').inter isOpen_Ioo + have hsubI : Icc α β ⊆ cis' ⁻¹' O ∩ Ioo (-Real.pi) Real.pi := fun θ hθ => + ⟨hKO ⟨θ, hθ, rfl⟩, hα.trans_le hθ.1, hθ.2.trans_lt hβ⟩ + obtain ⟨δ, hδ, hth⟩ := isCompact_Icc.exists_thickening_subset_open hpre hsubI + have hthick : ∀ θ ∈ Icc (α - δ / 2) (β + δ / 2), θ ∈ thickening δ (Icc α β) := by + intro θ hθ + rw [mem_thickening_iff] + have hmem : max α (min θ β) ∈ Icc α β := ⟨le_max_left _ _, max_le hαβ (min_le_right _ _)⟩ + refine ⟨_, hmem, ?_⟩ + rw [Real.dist_eq, abs_lt] + constructor + · rcases le_total θ β with h1 | h1 + · rw [min_eq_left h1] + have := le_max_right α θ + have h2 := hθ.2 + rcases le_total α θ with h3 | h3 + · rw [max_eq_right h3] + linarith + · rw [max_eq_left h3] + linarith [hθ.1] + · rw [min_eq_right h1, max_eq_right hαβ] + linarith [hθ.2] + · rcases le_total θ β with h1 | h1 + · rw [min_eq_left h1] + rcases le_total α θ with h3 | h3 + · rw [max_eq_right h3] + linarith + · rw [max_eq_left h3] + linarith [hθ.1] + · rw [min_eq_right h1, max_eq_right hαβ] + linarith [hθ.2] + refine ⟨δ / 2, by positivity, ?_, ?_, O, hO, ?_, ?_⟩ + · have h1 := (hth (hthick (α - δ / 2) ⟨le_rfl, by linarith⟩)).2.1 + exact h1 + · have h1 := (hth (hthick (β + δ / 2) ⟨by linarith, le_rfl⟩)).2.2 + exact h1 + · exact fun θ hθ => (hth (hthick θ hθ)).1 + · intro z hz hn + have h1 : z ∈ O ∩ closedBall 0 1 := ⟨hz, mem_closedBall_zero_iff.mpr hn⟩ + rw [← hOe] at h1 + exact h1.1 + +private theorem exists_polar_rectangle_extension + {D : Set S} {h : S → ℂ} {g : ℂ → S} (cD : IsChart D h g) + {R : ℝ} {U : Set S} {k : S → ℂ} {l : ℂ → S} (c : BallChart R U k l) + {N : Set S} {O : Set ℂ} {α β η δ ε m w : ℝ} + (hα₁ : -Real.pi < α - η) (hβ₁ : β + η < Real.pi) + (hε : ε = δ / 2) (hε0 : 0 < ε) + (hm : m = (α + β) / 2) (hw : w = (β - α) / 2 + η) (hw0 : 0 < w) + (hth : Metric.thickening δ (cis' '' Icc (α - η) (β + η)) ⊆ O) + (hOg : ∀ z ∈ O, ‖z‖ ≤ 1 → g z ∈ U ∩ N) : + let R₀ : Set ℂ := Icc (-1) 1 ×ℂ Icc (-1) 0 + let κ : ℂ → ℂ := fun z => Complex.exp (((ε * z.im : ℝ) : ℂ) + ((m + w * z.re : ℝ) : ℂ) * + Complex.I) + let ν : ℂ → ℂ := fun z => k (g (κ z)) + ∃ Ψ : ℂ ≃ₜ ℂ, EqOn Ψ ν (frontier R₀) ∧ Ψ '' R₀ = ν '' R₀ ∧ + (∀ z ∈ R₀, ν z ∈ ball (0 : ℂ) R) ∧ + (∀ z ∈ R₀, l (ν z) = g (κ z)) ∧ + ∀ z, κ z = ((Real.exp (ε * z.im) : ℝ) : ℂ) * cis' (m + w * z.re) := by + intro R₀ κ ν + have hκc : Continuous κ := by + change Continuous fun z : ℂ => Complex.exp (((ε * z.im : ℝ) : ℂ) + + ((m + w * z.re : ℝ) : ℂ) * Complex.I) + have h1 : Continuous fun z : ℂ => ((ε * z.im : ℝ) : ℂ) := + Complex.continuous_ofReal.comp (continuous_const.mul Complex.continuous_im) + have h2 : Continuous fun z : ℂ => ((m + w * z.re : ℝ) : ℂ) := + Complex.continuous_ofReal.comp (continuous_const.add (continuous_const.mul + Complex.continuous_re)) + exact Complex.continuous_exp.comp (h1.add (h2.mul continuous_const)) + have hθR : ∀ z ∈ R₀, m + w * z.re ∈ Icc (α - η) (β + η) := fun z hz => by + obtain ⟨⟨h1, h2⟩, -⟩ := Complex.mem_reProdIm.mp hz + have hmw : m - w = α - η := by rw [hm, hw]; ring + have hmw' : m + w = β + η := by rw [hm, hw]; ring + constructor + · nlinarith + · nlinarith + have hκform : ∀ z, κ z = ((Real.exp (ε * z.im) : ℝ) : ℂ) * cis' (m + w * z.re) := fun z => by + change Complex.exp _ = _ + rw [Complex.exp_add, Complex.ofReal_exp, cis'] + have hnorm : ∀ z, ‖κ z‖ = Real.exp (ε * z.im) := fun z => by + rw [hκform, norm_mul, norm_cis', mul_one, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (Real.exp_pos _)] + have hκball : ∀ z ∈ R₀, κ z ∈ closedBall (0 : ℂ) 1 := fun z hz => by + obtain ⟨-, -, h2⟩ := Complex.mem_reProdIm.mp hz + rw [mem_closedBall_zero_iff, hnorm] + exact Real.exp_le_one_iff.mpr (mul_nonpos_of_nonneg_of_nonpos hε0.le h2) + have hκO : ∀ z ∈ R₀, κ z ∈ O := fun z hz => by + obtain ⟨-, h1, h2⟩ := Complex.mem_reProdIm.mp hz + refine hth (mem_thickening_iff.mpr ⟨_, ⟨_, hθR z hz, rfl⟩, ?_⟩) + rw [dist_eq_norm, hκform] + have h3 : ((Real.exp (ε * z.im) : ℝ) : ℂ) * cis' (m + w * z.re) - cis' (m + w * z.re) = + ((Real.exp (ε * z.im) - 1 : ℝ) : ℂ) * cis' (m + w * z.re) := by + push_cast + ring + rw [h3, norm_mul, norm_cis', mul_one, Complex.norm_real, Real.norm_eq_abs] + have h4 : Real.exp (ε * z.im) ≤ 1 := + Real.exp_le_one_iff.mpr (mul_nonpos_of_nonneg_of_nonpos hε0.le h2) + have h5 := Real.add_one_le_exp (ε * z.im) + rw [abs_of_nonpos (by linarith)] + nlinarith + have hgκ : ∀ z ∈ R₀, g (κ z) ∈ U ∩ N := fun z hz => hOg _ (hκO z hz) + (mem_closedBall_zero_iff.mp (hκball z hz)) + have hlogκ : ∀ z ∈ R₀, Complex.log (κ z) = ((ε * z.im : ℝ) : ℂ) + ((m + w * z.re : ℝ) : ℂ) * + Complex.I := + fun z hz => by + have h1 := hθR z hz + refine Complex.log_exp ?_ ?_ + · simp only [Complex.add_im, Complex.ofReal_im, Complex.mul_im, Complex.ofReal_re, + Complex.I_im, + Complex.I_re, mul_one, mul_zero, zero_add, add_zero] + linarith [h1.1] + · simp only [Complex.add_im, Complex.ofReal_im, Complex.mul_im, Complex.ofReal_re, + Complex.I_im, + Complex.I_re, mul_one, mul_zero, zero_add, add_zero] + linarith [h1.2] + have hslit : ∀ z ∈ R₀, κ z ∈ Complex.slitPlane := fun z hz => by + rw [Complex.mem_slitPlane_iff_arg] + refine ⟨fun he => ?_, Complex.exp_ne_zero _⟩ + have h1 : (Complex.log (κ z)).im = Complex.arg (κ z) := Complex.log_im _ + rw [hlogκ z hz, he] at h1 + simp only [Complex.add_im, Complex.ofReal_im, Complex.mul_im, Complex.ofReal_re, Complex.I_im, + Complex.I_re, mul_one, mul_zero, zero_add, add_zero] at h1 + linarith [(hθR z hz).2] + let lam : ℂ → ℂ := fun u => ⟨((Complex.log u).im - m) / w, (Complex.log u).re / ε⟩ + have hlamκ : ∀ z ∈ R₀, lam (κ z) = z := fun z hz => by + apply Complex.ext + · change ((Complex.log (κ z)).im - m) / w = z.re + rw [hlogκ z hz] + simp only [Complex.add_im, Complex.ofReal_im, Complex.mul_im, Complex.ofReal_re, Complex.I_im, + Complex.I_re, mul_one, mul_zero, zero_add, add_zero] + field_simp + ring + · change (Complex.log (κ z)).re / ε = z.im + rw [hlogκ z hz] + simp only [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, Complex.ofReal_im, + Complex.I_im, mul_zero, zero_mul, sub_zero, add_zero] + field_simp + have hlamc : ContinuousOn lam Complex.slitPlane := by + have hlog : ContinuousOn Complex.log Complex.slitPlane := + fun u hu => (continuousAt_clog hu).continuousWithinAt + have h1 : ContinuousOn (fun u => ((Complex.log u).im - m) / w) Complex.slitPlane := + ((Complex.continuous_im.comp_continuousOn hlog).sub continuousOn_const).div_const _ + have h2 : ContinuousOn (fun u => (Complex.log u).re / ε) Complex.slitPlane := + (Complex.continuous_re.comp_continuousOn hlog).div_const _ + have h3 : Continuous fun p : ℝ × ℝ => (⟨p.1, p.2⟩ : ℂ) := + Complex.equivRealProdCLM.symm.continuous + exact h3.comp_continuousOn (h1.prodMk h2) + let ν' : ℂ → ℂ := fun u => lam (h (l u)) + have hgκc : ContinuousOn (fun z => g (κ z)) R₀ := cD.gc.comp hκc.continuousOn hκball + have hνc : ContinuousOn ν R₀ := c.hc.comp hgκc fun z hz => (hgκ z hz).1 + have hνb : ∀ z ∈ R₀, ν z ∈ ball (0 : ℂ) R := fun z hz => c.hm (hgκ z hz).1 + have hlν : ∀ z ∈ R₀, l (ν z) = g (κ z) := fun z hz => c.gh (hgκ z hz).1 + have hνl : LeftInvOn ν' ν R₀ := fun z hz => by + change lam (h (l (ν z))) = z + rw [hlν z hz, cD.hg (hκball z hz), hlamκ z hz] + have hνc' : ContinuousOn ν' (ν '' R₀) := by + have h1 : ContinuousOn l (ν '' R₀) := c.gc.mono (image_subset_iff.mpr hνb) + have h2 : MapsTo l (ν '' R₀) D := by + rintro _ ⟨z, hz, rfl⟩ + rw [hlν z hz] + exact cD.gm (hκball z hz) + have h3 : ContinuousOn (fun u => h (l u)) (ν '' R₀) := cD.hc.comp h1 h2 + refine hlamc.comp h3 ?_ + rintro _ ⟨z, hz, rfl⟩ + change h (l (ν z)) ∈ _ + rw [hlν z hz, cD.hg (hκball z hz)] + exact hslit z hz + obtain ⟨hR₀, hR₀b⟩ := isClosedDisc_rect (a := -1) (b := 1) (c := -1) (d := 0) (by norm_num) + (by norm_num) + obtain ⟨hE, hEb⟩ := hR₀.image hνc hνc' hνl + rw [hR₀b] at hEb + have hF₀ : Nonempty (Circle ≃ₜ frontier R₀) := by + have := hR₀.isOArc_discBd + rwa [hR₀b] at this + have hF : Nonempty (Circle ≃ₜ ν '' frontier R₀) := by + have := hE.isOArc_discBd + rwa [hEb] at this + have hfrR : frontier R₀ ⊆ R₀ := + (isCompact_Icc.reProdIm isCompact_Icc).isClosed.frontier_subset + have hmatch : BdMatch (frontier R₀) (ν '' frontier R₀) ν ν' := + bdMatch_of_leftInvOn (hνc.mono hfrR) (hνc'.mono (image_mono hfrR)) (hνl.mono hfrR) + obtain ⟨Ψ, hΨ, hΨi⟩ := exists_plane_homeomorph hF₀ hF hmatch + rw [← eq_closedInner_of_discBd hF₀ hR₀ hR₀b, ← eq_closedInner_of_discBd hF hE hEb] at hΨi + exact ⟨Ψ, hΨ, hΨi, hνb, hlν, hκform⟩ + +private theorem rectangle_subset_thickening {a b δ : ℝ} (hδ : 0 < δ) : + (Icc a b ×ℂ Icc 0 (δ / 2)) ⊆ Metric.thickening δ + ((fun x : ℝ => (x : ℂ)) '' Icc a b) := by + intro z hz + obtain ⟨h1, h2⟩ := Complex.mem_reProdIm.mp hz + refine mem_thickening_iff.mpr ⟨_, ⟨z.re, h1, rfl⟩, ?_⟩ + rw [dist_eq_norm] + have h3 : z - (z.re : ℂ) = (z.im : ℂ) * Complex.I := by + apply Complex.ext <;> simp + rw [h3, norm_mul, Complex.norm_I, mul_one, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg + h2.1] + linarith [h2.2] + +private theorem affine_apply_inverse {m w x : ℝ} (hw : w ≠ 0) : + m + w * ((x - m) / w) = x := by + field_simp + ring + +/-- **The cap.** Let `D` be a closed disc with a chart, let the arc between the angles `α < β` lie +in +a plane chart `U` of the surface and in the open set `N`. Then a closed disc `T ⊆ N` meets `D` +exactly +in this arc, and the arc lies in the boundary of `T`. -/ +theorem exists_cap_angle [T2Space S] {D : Set S} {h : S → ℂ} {g : ℂ → S} (cD : IsChart D h g) + {R : ℝ} {U : Set S} {k : S → ℂ} {l : ℂ → S} (c : BallChart R U k l) {N : Set S} (hN : IsOpen N) + {α β : ℝ} (hα : -Real.pi < α) (hαβ : α < β) (hβ : β < Real.pi) + (hsub : angleArc g α β ⊆ U ∩ N) : + ∃ T : Set S, IsClosedDisc T ∧ T ⊆ N ∧ T ∩ D = angleArc g α β ∧ angleArc g α β ⊆ discBd T := by + classical + obtain ⟨η, hη, hα₁, hβ₁, O, hO, hOθ, hOg⟩ := cD.exists_margin (c.isOpen.inter hN) hα hαβ.le hβ + hsub + have hcK : IsCompact (cis' '' Icc (α - η) (β + η)) := isCompact_Icc.image continuous_cis' + obtain ⟨δ, hδ, hth⟩ := hcK.exists_thickening_subset_open hO (by + rintro _ ⟨θ, hθ, rfl⟩ + exact hOθ θ hθ) + set ε := δ / 2 with hε + have hε0 : 0 < ε := by positivity + set m := (α + β) / 2 with hm + set w := (β - α) / 2 + η with hw + have hw0 : 0 < w := by rw [hw]; linarith + let R₀ : Set ℂ := Icc (-1) 1 ×ℂ Icc (-1) 0 + let κ : ℂ → ℂ := fun z => Complex.exp (((ε * z.im : ℝ) : ℂ) + ((m + w * z.re : ℝ) : ℂ) * + Complex.I) + let ν : ℂ → ℂ := fun z => k (g (κ z)) + let lam : ℂ → ℂ := fun u => ⟨((Complex.log u).im - m) / w, (Complex.log u).re / ε⟩ + obtain ⟨Ψ, hΨ, hΨi, hνb, hlν, hκform⟩ := + exists_polar_rectangle_extension cD c hα₁ hβ₁ hε hε0 hm hw hw0 hth hOg + have hfrR : frontier R₀ ⊆ R₀ := + (isCompact_Icc.reProdIm isCompact_Icc).isClosed.frontier_subset + -- the part of `D` away from the arc + let Vo : Set ℂ := (Complex.slitPlane ∩ Complex.arg ⁻¹' Ioo (α - η) (β + η)) ∩ + {u | Real.exp (-ε) < ‖u‖} + have hargc : ContinuousOn Complex.arg Complex.slitPlane := + fun u hu => (Complex.continuousAt_arg hu).continuousWithinAt + have hVo : IsOpen Vo := (hargc.isOpen_inter_preimage Complex.isOpen_slitPlane isOpen_Ioo).inter + (isOpen_lt continuous_const continuous_norm) + let D₁ : Set S := g '' (closedBall 0 1 \ Vo) + have hD₁ : IsCompact D₁ := ((isCompact_closedBall 0 1).diff hVo).image_of_continuousOn + (cD.gc.mono sdiff_subset) + have hcisV : ∀ θ ∈ Icc α β, cis' θ ∈ Vo := fun θ hθ => by + have harg : Complex.arg (cis' θ) = θ := by + rw [cis', ← Complex.log_im, Complex.log_exp] + · simp + · simpa using hα.trans_le hθ.1 + · simpa using (hθ.2.trans_lt hβ).le + refine ⟨⟨?_, ?_⟩, ?_⟩ + · rw [Complex.mem_slitPlane_iff_arg] + refine ⟨fun he => ?_, Complex.exp_ne_zero _⟩ + rw [harg] at he + linarith [hθ.2] + · change Complex.arg (cis' θ) ∈ Ioo (α - η) (β + η) + rw [harg] + exact ⟨by linarith [hθ.1], by linarith [hθ.2]⟩ + · change _ < ‖cis' θ‖ + rw [norm_cis'] + exact Real.exp_lt_one_iff.mpr (by linarith) + have harcD₁ : ∀ θ ∈ Icc α β, g (cis' θ) ∉ D₁ := by + rintro θ hθ ⟨u, hu, he⟩ + have h1 := cD.injOn hu.1 (cis'_mem_closedBall θ) he + exact hu.2 (h1 ▸ hcisV θ hθ) + let a := (α - m) / w + let b := (β - m) / w + have hab : a < b := div_lt_div_of_pos_right (by linarith) hw0 + have hma : m + w * a = α := affine_apply_inverse hw0.ne' + have hmb : m + w * b = β := affine_apply_inverse hw0.ne' + have hθseg : ∀ x ∈ Icc a b, m + w * x ∈ Icc α β := fun x hx => by + constructor + · rw [← hma] + have := mul_le_mul_of_nonneg_left hx.1 hw0.le + linarith + · rw [← hmb] + have := mul_le_mul_of_nonneg_left hx.2 hw0.le + linarith + have hsegR : ∀ x ∈ Icc a b, (x : ℂ) ∈ frontier R₀ := fun x hx => by + have h1 : -1 ≤ a := by + simp only [a] + rw [le_div_iff₀ hw0, hm, hw] + linarith + have h2 : b ≤ 1 := by + simp only [b] + rw [div_le_iff₀ hw0, hm, hw] + linarith + exact top_subset_frontier_rect (by simpa using ⟨h1.trans hx.1, hx.2.trans h2⟩) (by simp) + (by norm_num) + have hνseg : ∀ x ∈ Icc a b, l (Ψ x) = g (cis' (m + w * x)) := fun x hx => by + have h1 := hfrR (hsegR x hx) + rw [hΨ (hsegR x hx), hlν _ h1, hκform] + simp + let O' : Set ℂ := Ψ ⁻¹' (ball 0 R ∩ l ⁻¹' (N \ D₁)) + have hO' : IsOpen O' := + (c.gc.isOpen_inter_preimage isOpen_ball (hN.sdiff hD₁.isClosed)).preimage Ψ.continuous + let Sg : Set ℂ := (fun x : ℝ => (x : ℂ)) '' Icc a b + have hSg : IsCompact Sg := isCompact_Icc.image Complex.continuous_ofReal + have hSgO : Sg ⊆ O' := by + rintro _ ⟨x, hx, rfl⟩ + have h1 := hfrR (hsegR x hx) + refine ⟨?_, ?_⟩ + · change Ψ x ∈ _ + rw [hΨ (hsegR x hx)] + exact hνb _ h1 + · change l (Ψ x) ∈ N \ D₁ + rw [hνseg x hx] + exact ⟨(hsub ⟨_, hθseg x hx, rfl⟩).2, harcD₁ _ (hθseg x hx)⟩ + obtain ⟨ρ₀, hρ₀, hρth⟩ := hSg.exists_thickening_subset_open hO' hSgO + set ρ := ρ₀ / 2 with hρ + let T' : Set ℂ := Icc a b ×ℂ Icc 0 ρ + have hT'O : T' ⊆ O' := (rectangle_subset_thickening hρ₀).trans hρth + obtain ⟨hT'd, hT'b⟩ := isClosedDisc_rect hab (half_pos hρ₀) + let f : ℂ → S := fun z => l (Ψ z) + let f' : S → ℂ := fun x => Ψ.symm (k x) + have hfc : ContinuousOn f T' := + c.gc.comp Ψ.continuous.continuousOn fun z hz => (hT'O hz).1 + have hfU : ∀ z ∈ T', f z ∈ U := fun z hz => c.gm (hT'O hz).1 + have hfl : LeftInvOn f' f T' := fun z hz => by + change Ψ.symm (k (l (Ψ z))) = z + rw [c.hg (hT'O hz).1, Ψ.symm_apply_apply] + have hfc' : ContinuousOn f' (f '' T') := by + refine Ψ.symm.continuous.comp_continuousOn (c.hc.mono ?_) + rintro _ ⟨z, hz, rfl⟩ + exact hfU z hz + obtain ⟨hTd, hTb⟩ := hT'd.image hfc hfc' hfl + rw [hT'b] at hTb + have harcT : ∀ x ∈ Icc a b, g (cis' (m + w * x)) ∈ f '' frontier T' := fun x hx => + ⟨x, bot_subset_frontier_rect (by simpa using hx) (by simp) (half_pos hρ₀).le, hνseg x hx⟩ + have hparam : ∀ θ ∈ Icc α β, ∃ x ∈ Icc a b, m + w * x = θ := fun θ hθ => by + refine ⟨(θ - m) / w, ⟨?_, ?_⟩, ?_⟩ + · exact div_le_div_of_nonneg_right (by linarith [hθ.1]) hw0.le + · exact div_le_div_of_nonneg_right (by linarith [hθ.2]) hw0.le + · field_simp + ring + have hfrT : frontier T' ⊆ T' := (isCompact_Icc.reProdIm isCompact_Icc).isClosed.frontier_subset + refine ⟨f '' T', hTd, ?_, ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact (hT'O hz).2.1 + · apply Subset.antisymm + · rintro x ⟨⟨z, hz, rfl⟩, hxD⟩ + have hzO := hT'O hz + have hxD₁ : f z ∉ D₁ := hzO.2.2 + have hu : h (f z) ∈ closedBall (0 : ℂ) 1 := cD.hm hxD + have huV : h (f z) ∈ Vo := by + by_contra hcon + exact hxD₁ ⟨_, ⟨hu, hcon⟩, cD.gh hxD⟩ + set u := h (f z) with hudef + have hu0 : u ≠ 0 := Complex.slitPlane_ne_zero huV.1.1 + have huO : ‖u‖ ≤ 1 := mem_closedBall_zero_iff.mp hu + have hlogre : (Complex.log u).re = Real.log ‖u‖ := Complex.log_re u + have hlogim : (Complex.log u).im = Complex.arg u := Complex.log_im u + have hz₁ : lam u ∈ R₀ := by + refine Complex.mem_reProdIm.mpr ⟨⟨?_, ?_⟩, ⟨?_, ?_⟩⟩ + · change -1 ≤ ((Complex.log u).im - m) / w + rw [le_div_iff₀ hw0, hlogim] + have := huV.1.2.1 + rw [hm, hw] + linarith + · change ((Complex.log u).im - m) / w ≤ 1 + rw [div_le_iff₀ hw0, hlogim] + have := huV.1.2.2 + rw [hm, hw] + linarith + · change -1 ≤ (Complex.log u).re / ε + rw [le_div_iff₀ hε0, hlogre] + have h1 := huV.2 + have h2 : -ε ≤ Real.log ‖u‖ := + (Real.le_log_iff_exp_le (norm_pos_iff.mpr hu0)).mpr h1.le + linarith + · change (Complex.log u).re / ε ≤ 0 + rw [hlogre] + exact div_nonpos_of_nonpos_of_nonneg (Real.log_nonpos (norm_nonneg _) huO) hε0.le + have hκu : κ (lam u) = u := by + change Complex.exp (((ε * ((Complex.log u).re / ε) : ℝ) : ℂ) + + ((m + w * (((Complex.log u).im - m) / w) : ℝ) : ℂ) * Complex.I) = u + have h1 : ε * ((Complex.log u).re / ε) = (Complex.log u).re := by + field_simp + have h2 : m + w * (((Complex.log u).im - m) / w) = (Complex.log u).im := by + field_simp + ring + rw [h1, h2, Complex.re_add_im, Complex.exp_log hu0] + have hΨz : Ψ z = ν (lam u) := by + change Ψ z = k (g (κ (lam u))) + rw [hκu, hudef, cD.gh hxD] + change Ψ z = k (l (Ψ z)) + rw [c.hg hzO.1] + have hz' : Ψ z ∈ Ψ '' R₀ := by + rw [hΨi, hΨz] + exact ⟨_, hz₁, rfl⟩ + obtain ⟨z', hz'R, he⟩ := hz' + have hzz := Ψ.injective he + subst hzz + have him : z'.im = 0 := le_antisymm (Complex.mem_reProdIm.mp hz'R).2.2 + (Complex.mem_reProdIm.mp hz).2.1 + have hre := (Complex.mem_reProdIm.mp hz).1 + have hz'e : z' = (z'.re : ℂ) := by + apply Complex.ext <;> simp [him] + refine ⟨m + w * z'.re, hθseg _ hre, ?_⟩ + change g (cis' (m + w * z'.re)) = f z' + rw [← hνseg _ hre, ← hz'e] + · rintro _ ⟨θ, hθ, rfl⟩ + obtain ⟨x, hx, rfl⟩ := hparam θ hθ + obtain ⟨y, hy, he⟩ := harcT x hx + exact ⟨⟨y, hfrT hy, he⟩, discBd_subset D (cD.angleArc_subset α β ⟨_, hθ, rfl⟩)⟩ + · rw [hTb] + rintro _ ⟨θ, hθ, rfl⟩ + obtain ⟨x, hx, rfl⟩ := hparam θ hθ + exact harcT x hx + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CapCoh.lean b/LeanPool/GraphMinor/Surface/CapCoh.lean new file mode 100644 index 0000000000..927a098323 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CapCoh.lean @@ -0,0 +1,271 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.TriCohGlue +public import LeanPool.GraphMinor.Surface.PushOff +public import LeanPool.GraphMinor.Surface.CohCard +public import LeanPool.GraphMinor.Surface.NormalWord + +/-! +# Local cocycles on a capped surface + +Capping the cuffs of a surface with closed discs does not add classes of local cocycles +(`kCl_cap_injective`). A class on the capped surface restricts to a class on the surface, and two +classes with the same restriction are equal, by gluing primitives over the caps (`glue_prim`). + +This is what we need to compare a surface with its capped form in the proof of Graph Minors XIX, +(6.5) (page 341). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Filter + +local notation "K" => ZMod 2 + +section Glue + +variable {X : Type} [TopologicalSpace X] + +/-- A function that is a primitive of `φ + φ'` on each of finitely many closed sets that cover the +space shows that `φ` and `φ'` are equivalent. -/ +theorem glue_prim {𝓒 : Set (Set X)} (hf : 𝓒.Finite) (hc : ∀ P ∈ 𝓒, IsClosed P) (hu : ⋃₀ 𝓒 + = univ) {φ φ' : X → X → K} (hφ : IsCoc φ) + (hφ' : IsCoc φ') {k : X → K} (hk : ∀ P ∈ 𝓒, Prim (fun x y => φ x y + φ' x y) P k) : CohRel φ φ' + := by + classical + obtain ⟨N₁, hN₁, hc₁⟩ := hφ + obtain ⟨N₂, hN₂, hc₂⟩ := hφ' + let ψ : X → X → K := fun x y => φ x y + φ' x y + have hcov : ∀ x : X, ∃ P ∈ 𝓒, x ∈ P := fun x => by + have : x ∈ ⋃₀ 𝓒 := hu ▸ mem_univ x + exact this + have hnear : ∀ p : X, ∃ W ∈ 𝓝 p, W ×ˢ W ⊆ N₁ ∩ N₂ ∧ ∀ x ∈ W, ψ p x = k p + k x ∧ ψ x p + = k x + k p := fun p => by + obtain ⟨A, hA, B, hB, hAB⟩ := mem_nhds_prod_iff.mp (Filter.inter_mem (hN₁ p) (hN₂ p)) + have hfinite : {P ∈ 𝓒 | p ∉ P}.Finite := + hf.subset fun _ hP => hP.1 + have hC : IsClosed (⋃₀ {P ∈ 𝓒 | p ∉ P}) := + hfinite.isClosed_sUnion fun P hP => hc P hP.1 + have hW₁ : (⋃₀ {P ∈ 𝓒 | p ∉ P})ᶜ ∈ 𝓝 p := hC.isOpen_compl.mem_nhds (by + rintro ⟨P, hP, h1⟩ + exact hP.2 h1) + have hch : ∀ P : Set X, ∃ W ∈ 𝓝 p, P ∈ 𝓒 → p ∈ P → ∀ x ∈ W ∩ P, ∀ x' ∈ W ∩ P, ψ x x' + = k x + k x' := fun P => by + by_cases h1 : P ∈ 𝓒 ∧ p ∈ P + · obtain ⟨W, hW, h2⟩ := hk P h1.1 p h1.2 + exact ⟨W, hW, fun _ _ => h2⟩ + · exact ⟨univ, univ_mem, fun h2 h3 => absurd ⟨h2, h3⟩ h1⟩ + choose Wf hWf hWp using hch + have hW₂ : (⋂ P ∈ 𝓒, Wf P) ∈ 𝓝 p := (Filter.biInter_mem hf).mpr fun P _ => hWf P + refine ⟨A ∩ B ∩ (⋃₀ {P ∈ 𝓒 | p ∉ P})ᶜ ∩ ⋂ P ∈ 𝓒, Wf P, inter_mem (inter_mem + (inter_mem hA hB) hW₁) hW₂, ?_, ?_⟩ + · rintro ⟨x, x'⟩ ⟨hx, hx'⟩ + exact hAB ⟨hx.1.1.1, hx'.1.1.2⟩ + · intro x hx + obtain ⟨P, hP, hxP⟩ := hcov x + have hpP : p ∈ P := by + by_contra h1 + exact hx.1.2 ⟨P, ⟨hP, h1⟩, hxP⟩ + have hpW : p ∈ Wf P := mem_of_mem_nhds (hWf _) + have hxW : x ∈ Wf P := mem_iInter₂.mp hx.2 _ hP + exact ⟨hWp P hP hpP p ⟨hpW, hpP⟩ x ⟨hxW, hxP⟩, hWp P hP hpP x ⟨hxW, hxP⟩ p ⟨hpW, hpP⟩⟩ + choose W hW hWN hWk using hnear + refine ⟨k, ⋃ p, W p ×ˢ W p, fun q => Filter.mem_of_superset (prod_mem_nhds (hW q) (hW q)) + (subset_iUnion (fun p => W p ×ˢ W p) q), ?_⟩ + intro x x' hxx + obtain ⟨p, hp⟩ := mem_iUnion.mp hxx + have hpW : p ∈ W p := mem_of_mem_nhds (hW p) + have m1 : (x, p) ∈ N₁ ∩ N₂ := hWN p (show (x, p) ∈ W p ×ˢ W p from ⟨hp.1, hpW⟩) + have m2 : (p, x') ∈ N₁ ∩ N₂ := hWN p (show (p, x') ∈ W p ×ˢ W p from ⟨hpW, hp.2⟩) + have m3 : (x, x') ∈ N₁ ∩ N₂ := hWN p hp + have h1 := hc₁ x p x' m1.1 m2.1 m3.1 + have h2 := hc₂ x p x' m1.2 m2.2 m3.2 + have h3 := (hWk p x hp.1).2 + have h4 := (hWk p x' hp.2).1 + simp only [ψ] at h3 h4 + rw [CharTwo.sub_eq_add, CharTwo.sub_eq_add, ← h1, ← h2] + have h5 : φ x p + φ p x' + (φ' x p + φ' p x') = (φ x p + φ' x p) + (φ p x' + φ' p x') := by ring + rw [h5, h3, h4] + have h6 : k x + k p + (k p + k x') = k x' + k x + (k p + k p) := by ring + rw [h6, CharTwo.add_self_eq_zero, add_zero] + +end Glue + +variable {S T : Type} [TopologicalSpace S] [TopologicalSpace T] + +theorem isCoc_pbk {j : S → T} (hj : Continuous j) {φ : T → T → K} (h : IsCoc φ) : IsCoc (pbk j φ) + := by + obtain ⟨N, hN, h1⟩ := h + refine ⟨(fun p : S × S => (j p.1, j p.2)) ⁻¹' N, fun x => ?_, fun x y z h2 h3 h4 + => h1 _ _ _ h2 h3 h4⟩ + have hc : Continuous fun p : S × S => (j p.1, j p.2) := (hj.comp continuous_fst).prodMk + (hj.comp continuous_snd) + exact hc.continuousAt.preimage_mem_nhds (hN (j x)) + +/-- A class on a capped surface restricts to a class on the surface, and the restriction is +injective. -/ +theorem kCl_cap_injective [T2Space T] {j : S → T} (hj : IsClosedEmbedding j) {C : Set T} + (hu : range j ∪ C = univ) + (hi : range j ∩ C = j '' bd S) {𝓓 : Set (Set T)} (hf : 𝓓.Finite) (hU : ⋃₀ 𝓓 = C) + (hd : ∀ D ∈ 𝓓, IsClosedDisc D ∧ IsPreconnected (D ∩ range j) ∧ (D ∩ range j).Nonempty) + (hdj : ∀ D ∈ 𝓓, ∀ D' ∈ 𝓓, D ≠ D' → Disjoint D D') : + ∃ f : KCl T K → KCl S K, Function.Injective f := by + classical + have hdsc : ∀ t : T, ∃ D : Set T, t ∈ C → D ∈ 𝓓 ∧ t ∈ D := fun t => by + by_cases ht : t ∈ C + · obtain ⟨D, hD, h1⟩ := (hU ▸ ht : t ∈ ⋃₀ 𝓓) + exact ⟨D, fun _ => ⟨hD, h1⟩⟩ + · exact ⟨∅, fun h' => absurd h' ht⟩ + choose dsc hdsc using hdsc + have hdsc_eq : ∀ D ∈ 𝓓, ∀ t ∈ D, dsc t = D := fun D hD t ht => by + have htC : t ∈ C := hU ▸ ⟨D, hD, ht⟩ + by_contra hne + exact Set.disjoint_left.mp (hdj _ (hdsc t htC).1 D hD hne) (hdsc t htC).2 ht + have hclosed : ∀ D ∈ 𝓓, IsClosed D := fun D hD => (hd D hD).1.isClosed + have hCcl : IsClosed C := hU ▸ hf.isClosed_sUnion hclosed + have hb : ∀ {x}, x ∈ bd S → j x ∈ C := fun {x} hx => by + have : j x ∈ range j ∩ C := hi ▸ mem_image_of_mem j hx + exact this.2 + have hpull : ∀ φ ∈ KSet T K, pbk j φ ∈ KSet S K := fun φ hφ => by + refine ⟨isCoc_pbk hj.continuous hφ.1, ?_⟩ + have hprim : ∀ D : Set T, ∃ g, D ∈ 𝓓 → Prim φ D g := fun D => by + by_cases hD : D ∈ 𝓓 + · obtain ⟨g, hg⟩ := exists_prim_disc hφ.1 (hd D hD).1 + exact ⟨g, fun _ => hg⟩ + · exact ⟨0, fun h' => absurd h' hD⟩ + choose g hg using hprim + let k₀ : T → K := fun t => g (dsc t) t + have hW : ∀ p : T, ∃ W ∈ 𝓝 p, ∀ x ∈ W ∩ C, ∀ x' ∈ W ∩ C, φ x x' = k₀ x + k₀ x' := fun p => by + by_cases hp : p ∈ C + · obtain ⟨hD, hpD⟩ := hdsc p hp + obtain ⟨W, hW, h1⟩ := hg _ hD p hpD + have hR : IsClosed (⋃₀ (𝓓 \ {dsc p})) := (hf.subset sdiff_subset).isClosed_sUnion fun D h + => hclosed D h.1 + have hpR : p ∉ ⋃₀ (𝓓 \ {dsc p}) := by + rintro ⟨D, hD', h2⟩ + exact hD'.2 (hdsc_eq D hD'.1 p h2).symm + refine ⟨W ∩ (⋃₀ (𝓓 \ {dsc p}))ᶜ, inter_mem hW (hR.isOpen_compl.mem_nhds hpR), + fun x hx x' hx' => ?_⟩ + have hin : ∀ {y}, y ∈ (W ∩ (⋃₀ (𝓓 \ {dsc p}))ᶜ) ∩ C → y ∈ dsc p ∧ dsc y = dsc p + := fun {y} hy => by + have h2 := hdsc y hy.2 + by_cases he : dsc y = dsc p + · exact ⟨he ▸ h2.2, he⟩ + · exact absurd ⟨dsc y, ⟨h2.1, he⟩, h2.2⟩ hy.1.2 + obtain ⟨h3, h4⟩ := hin hx + obtain ⟨h5, h6⟩ := hin hx' + change φ x x' = g (dsc x) x + g (dsc x') x' + rw [h4, h6] + exact h1 x ⟨hx.1.1, h3⟩ x' ⟨hx'.1.1, h5⟩ + · exact ⟨Cᶜ, hCcl.isOpen_compl.mem_nhds hp, fun x hx => absurd hx.2 hx.1⟩ + choose W hW hWp using hW + refine ⟨k₀ ∘ j, ⋃ p, (j ⁻¹' W p) ×ˢ (j ⁻¹' W p), fun a => ?_, fun x hx y hy hxy => ?_⟩ + · have h1 : j ⁻¹' W (j a) ∈ 𝓝 a := hj.continuous.continuousAt.preimage_mem_nhds (hW (j a)) + exact Filter.mem_of_superset (prod_mem_nhds h1 h1) (subset_iUnion (fun p => (j ⁻¹' W p) ×ˢ + (j ⁻¹' W p)) (j a)) + · obtain ⟨p, hp⟩ := mem_iUnion.mp hxy + have h1 := hWp p (j x) ⟨hp.1, hb hx⟩ (j y) ⟨hp.2, hb hy⟩ + change φ (j x) (j y) = _ + rw [h1, CharTwo.neg_eq] + rfl + have hrel : ∀ φ φ' : T → T → K, CohRel φ φ' → CohRel (pbk j φ) (pbk j φ') := fun φ φ' h => by + obtain ⟨g, N, hN, h1⟩ := h + have hc : Continuous fun p : S × S => (j p.1, j p.2) := + (hj.continuous.comp continuous_fst).prodMk (hj.continuous.comp continuous_snd) + exact ⟨g ∘ j, (fun p : S × S => (j p.1, j p.2)) ⁻¹' N, fun x => + hc.continuousAt.preimage_mem_nhds (hN (j x)), + fun x y hxy => h1 _ _ hxy⟩ + let F : KCl T K → KCl S K := Quotient.map' (s₁ := kSetoid T K) (s₂ := kSetoid S K) (fun φ + => ⟨pbk j φ.1, hpull φ.1 φ.2⟩) + (fun φ φ' h => hrel φ.1 φ'.1 h) + refine ⟨F, ?_⟩ + refine Quotient.ind₂ fun φ φ' he => Quotient.sound ?_ + obtain ⟨g, N, hN, h1⟩ : CohRel (pbk j φ.1) (pbk j φ'.1) := Quotient.exact he + let ψ : T → T → K := fun x y => φ.1 x y + φ'.1 x y + have hψc : IsCoc ψ := by + obtain ⟨N₁, hN₁, c₁⟩ := φ.2.1 + obtain ⟨N₂, hN₂, c₂⟩ := φ'.2.1 + refine ⟨N₁ ∩ N₂, fun x => inter_mem (hN₁ x) (hN₂ x), fun x y z h2 h3 h4 => ?_⟩ + simp only [ψ] + rw [← c₁ x y z h2.1 h3.1 h4.1, ← c₂ x y z h2.2 h3.2 h4.2] + ring + let gt : T → K := Function.extend j g 0 + have hgt : ∀ x, gt (j x) = g x := fun x => hj.injective.extend_apply g 0 x + have hp₀ : Prim ψ (range j) gt := by + rintro _ ⟨a, rfl⟩ + obtain ⟨A, hA, B, hB, hAB⟩ := mem_nhds_prod_iff.mp (hN a) + have h2 : A ∩ B ∈ comap j (𝓝 (j a)) := by + rw [← hj.isInducing.nhds_eq_comap] + exact inter_mem hA hB + obtain ⟨W, hW, h3⟩ := mem_comap.mp h2 + refine ⟨W, hW, ?_⟩ + rintro _ ⟨hx, x, rfl⟩ _ ⟨hx', x', rfl⟩ + have h4 := h1 x x' (hAB ⟨(h3 hx).1, (h3 hx').2⟩) + change φ.1 (j x) (j x') + φ'.1 (j x) (j x') = gt (j x) + gt (j x') + change φ.1 (j x) (j x') - φ'.1 (j x) (j x') = _ at h4 + rw [hgt, hgt, ← CharTwo.sub_eq_add, h4, CharTwo.sub_eq_add, add_comm] + have hext : ∀ D : Set T, ∃ h : T → K, (D ∈ 𝓓 → Prim ψ D h) ∧ (D ∈ 𝓓 → ∀ t ∈ D ∩ range j, h t + = gt t) := fun D => by + by_cases hD : D ∈ 𝓓 + · obtain ⟨h₀, hh⟩ := exists_prim_disc hψc (hd D hD).1 + obtain ⟨a, ha⟩ := (hd D hD).2.2 + let c := h₀ a + gt a + refine ⟨fun t => h₀ t + c, fun _ p hp => ?_, fun _ t ht => ?_⟩ + · obtain ⟨W, hW, h2⟩ := hh p hp + refine ⟨W, hW, fun x hx x' hx' => ?_⟩ + rw [h2 x hx x' hx'] + have h3 : h₀ x + c + (h₀ x' + c) = h₀ x + h₀ x' + (c + c) := by ring + rw [h3, CharTwo.add_self_eq_zero, add_zero] + · have h2 := hh.const hp₀ (hd D hD).2.1 inter_subset_left inter_subset_right ht ha + have h3 : h₀ t + gt t + gt t = h₀ a + gt a + gt t := by rw [h2] + have h4 : h₀ t + gt t + gt t = h₀ t + (gt t + gt t) := by ring + rw [h4, CharTwo.add_self_eq_zero, add_zero] at h3 + change h₀ t + (h₀ a + gt a) = gt t + rw [h3] + have h5 : h₀ a + gt a + gt t + (h₀ a + gt a) = (h₀ a + gt a) + (h₀ a + gt a) + gt t := by + ring + rw [h5, CharTwo.add_self_eq_zero, zero_add] + · exact ⟨0, fun h' => absurd h' hD, fun h' => absurd h' hD⟩ + choose hx hxp hxe using hext + let k : T → K := fun t => if t ∈ C then hx (dsc t) t else gt t + have hkD : ∀ D ∈ 𝓓, ∀ t ∈ D, k t = hx D t := fun D hD t ht => by + have htC : t ∈ C := hU ▸ ⟨D, hD, ht⟩ + simp only [k, htC, ite_true, hdsc_eq D hD t ht] + have hkj : ∀ t ∈ range j, k t = gt t := fun t ht => by + by_cases htC : t ∈ C + · obtain ⟨hD, hmem⟩ := hdsc t htC + rw [hkD _ hD t hmem] + exact hxe _ hD t ⟨hmem, ht⟩ + · simp only [k, htC, ite_false] + have hcongr : ∀ {P : Set T} {u : T → K}, Prim ψ P u → (∀ t ∈ P, k t = u t) → Prim ψ P k + := fun {P u} hu' he' p hp => by + obtain ⟨W, hW, h2⟩ := hu' p hp + refine ⟨W, hW, fun x hx' x' hx'' => ?_⟩ + rw [he' x hx'.2, he' x' hx''.2] + exact h2 x hx' x' hx'' + refine glue_prim (𝓒 := insert (range j) 𝓓) (hf.insert _) ?_ ?_ φ.2.1 φ'.2.1 (k := k) ?_ + · rintro P (rfl | hP) + · exact hj.isClosed_range + · exact hclosed P hP + · rw [sUnion_insert, hU, hu] + · rintro P (rfl | hP) + · exact hcongr hp₀ hkj + · exact hcongr (hxp P hP) (hkD P hP) + +theorem card_kCl_of_model {X : Type} [TopologicalSpace X] {a b c : ℕ} + (e : X ≃ₜ SurfaceModel a b c) : + Nat.card (KCl X K) = 2 ^ (2 * a + b) := by + obtain ⟨ht, f, hf⟩ := presents_ew a b c + rw [card_kCl_congr e, GraphMinor.Surface.card_kCl hf, card_lam_two] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CellFamily.lean b/LeanPool/GraphMinor/Surface/CellFamily.lean new file mode 100644 index 0000000000..e70c2503fa --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CellFamily.lean @@ -0,0 +1,487 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CellMap +public import LeanPool.GraphMinor.Surface.WordSide +public import LeanPool.GraphMinor.Surface.WordSlide +public import LeanPool.GraphMinor.Surface.VertexLink + +/-! +# From a dissection to words + +The cells of a dissection give a family of polygons, one word for each cell, and a letter for each +edge +(`exists_family`). The letters of a word say which edges go around the cell. Each edge comes with a +fixed arc, so +that two sides with the same letter are pasted by the parameter of the arc. Fibres over points that +are not vertices +are read off from the sides, and fibres over vertices come from `prel_of_vertex`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +local notation "𝕀" => unitInterval + +variable {X : Type u} [TopologicalSpace X] [T2Space X] {V : Set X} {E : Set (Set X)} + +omit [T2Space X] in +theorem continuousOn_slots {W : ℕ → List Letter} {f : ℕ × ℂ → X} + (h : ∀ i, W i ≠ [] → ContinuousOn (fun z => f (i, z)) (closedBall 0 1)) : ContinuousOn f + (Dsk W) := by + rw [continuousOn_prod_of_discrete_left] + intro s + by_cases hs : W s = [] + · have : {z | (s, z) ∈ Dsk W} = ∅ := by + ext z + simp [Dsk, hs] + rw [this] + exact continuousOn_empty _ + · exact (h s hs).mono fun z hz => mem_closedBall_zero_iff.mpr hz.2 + +omit [T2Space X] in +theorem sd_end {a : 𝕀 → X} (ha : IsArcMap a) (b : Bool) {u : ℝ} (hu : u ∈ Ico (0 : ℝ) 1) + (h : sd a b u = a 0 ∨ sd a b u = a 1) : u = 0 := by + have e0 : extI a 0 = a 0 := extI_coe a 0 + have e1 : extI a 1 = a 1 := extI_coe a 1 + have hu' : u ∈ Icc (0 : ℝ) 1 := ⟨hu.1, hu.2.le⟩ + have hinj := sd_injOn ha b + have h0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have h1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have s0 : sd a b 0 = a 0 ∨ sd a b 0 = a 1 := by + cases b + · right + simp [sd, e1] + · left + simp [sd, e0] + have s1 : sd a b 1 = a 0 ∨ sd a b 1 = a 1 := by + cases b + · left + simp [sd, e0] + · right + simp [sd, e1] + have hsw : sd a b 0 ≠ sd a b 1 := fun he => zero_ne_one (hinj h0 h1 he) + rcases h with h | h <;> rcases s0 with s0 | s0 <;> rcases s1 with s1 | s1 + · exact absurd (s0.trans s1.symm) hsw + · exact hinj hu' h0 (h.trans s0.symm) + · exact absurd (hu.2.ne (hinj hu' h1 (h.trans s1.symm))) (by simp) + · exact absurd (s0.trans s1.symm) hsw + · exact absurd (s0.trans s1.symm) hsw + · exact absurd (hu.2.ne (hinj hu' h1 (h.trans s1.symm))) (by simp) + · exact hinj hu' h0 (h.trans s0.symm) + · exact absurd (s0.trans s1.symm) hsw + +/-- The data of one cell of a dissection. -/ +theorem exists_cell_data (hg : IsGraph V E) (A : Set X → 𝕀 → X) + (hA : ∀ e ∈ E, IsArcMap (A e) ∧ range (A e) = e ∧ e ∩ V = {A e 0, A e 1}) {Φ : Set X} + (hΦ : IsClosedDisc Φ) + (hbd : discBd Φ ⊆ ⋃₀ E) : + ∃ (m : ℕ) (s : ℕ → Set X) (ε : ℕ → Bool) (Ψ : ℂ → X), 2 ≤ m ∧ (∀ p < m, s p ∈ E + ∧ s p ⊆ discBd Φ) ∧ + (∀ p < m, ∀ q < m, p ≠ q → s p ≠ s q) ∧ ContinuousOn Ψ (closedBall 0 1) ∧ InjOn Ψ + (closedBall 0 1) ∧ + Ψ '' closedBall 0 1 = Φ ∧ (∀ z ∈ closedBall (0 : ℂ) 1, Ψ z ∈ discBd Φ ↔ ‖z‖ = 1) ∧ + ∀ p < m, ∀ t ∈ Icc (0 : ℝ) 1, Ψ (sdPt m p (ε p) t) = extI (A (s p)) t := by + obtain ⟨m, s, ε, hm, hs, hcov, hadj, hclose, hne⟩ := exists_edge_walk hg hΦ.isOArc_discBd hbd A hA + have harc : ∀ p < m, IsArcMap (A (s p)) := fun p hp => (hA _ (hs p hp).1).1 + have hdis : ∀ p < m, ∀ q < m, p ≠ q → ∀ u ∈ Ico (0 : ℝ) 1, ∀ v ∈ Ico (0 : ℝ) 1, + sd (A (s p)) (ε p) u ≠ sd (A (s q)) (ε q) v := by + intro p hp q hq hpq u hu v hv he + obtain ⟨hsne, hst⟩ := hne p hp q hq hpq + have h1 : sd (A (s p)) (ε p) u ∈ s p := (hA _ (hs p hp).1).2.1.subset (sd_mem _ _) + have h2 : sd (A (s q)) (ε q) v ∈ s q := (hA _ (hs q hq).1).2.1.subset (sd_mem _ _) + have hV : sd (A (s p)) (ε p) u ∈ V := hg.disj _ (hs p hp).1 _ (hs q hq).1 hsne ⟨h1, he ▸ h2⟩ + have h3 : sd (A (s p)) (ε p) u ∈ s p ∩ V := ⟨h1, hV⟩ + have h4 : sd (A (s q)) (ε q) v ∈ s q ∩ V := ⟨h2, he ▸ hV⟩ + rw [(hA _ (hs p hp).1).2.2] at h3 + rw [(hA _ (hs q hq).1).2.2] at h4 + have hu0 := sd_end (harc p hp) (ε p) hu h3 + have hv0 := sd_end (harc q hq) (ε q) hv h4 + rw [hu0, hv0] at he + exact hst he + obtain ⟨Ψ, h1, h2, h3, h4, h5⟩ := exists_cell_map hΦ hm (fun p => A (s p)) ε harc hadj hclose hdis + (fun p hp => by + rw [(hA _ (hs p hp).1).2.1] + exact (hs p hp).2) + (fun y hy => by + obtain ⟨p, hp, hyp⟩ := mem_iUnion₂.mp (hcov hy) + exact mem_biUnion hp (by rw [(hA _ (hs p hp).1).2.1]; exact hyp)) + refine ⟨m, s, ε, Ψ, ?_, hs, fun p hp q hq hpq => (hne p hp q hq hpq).1, h1, h2, h3, h4, h5⟩ + by_contra hlt + have hm1 : m = 1 := by omega + subst hm1 + have := sd_injOn (harc 0 hm) (ε 0) (by simp) (by simp) hclose + exact one_ne_zero this + +theorem exists_side_of_sphere {n : ℕ} (hn : 0 < n) (b : ℕ → Bool) {z : ℂ} (hz : ‖z‖ = 1) : + ∃ p < n, ∃ t ∈ Icc (0 : ℝ) 1, sdPt n p (b p) t = z := by + have h1 : z ∈ sphere (0 : ℂ) 1 := by simpa using hz + rw [← per_image hn] at h1 + obtain ⟨x, hx, rfl⟩ := h1 + have hex : ∃ p < n, x ∈ Icc (p : ℝ) (p + 1) := by + refine ⟨min ⌊x⌋₊ (n - 1), by omega, ?_⟩ + have hle : ⌊x⌋₊ ≤ x := Nat.floor_le hx.1 + have hlt : x < ⌊x⌋₊ + 1 := Nat.lt_floor_add_one x + by_cases h1 : ⌊x⌋₊ ≤ n - 1 + · rw [min_eq_left h1] + exact ⟨hle, hlt.le⟩ + · have h2 : ⌊x⌋₊ = n := by + have : ⌊x⌋₊ ≤ n := Nat.floor_le_of_le hx.2 + omega + have h3 : ((n - 1 : ℕ) : ℝ) = n - 1 := by + rw [Nat.cast_sub hn] + simp + rw [min_eq_right (by omega), h3] + rw [h2] at hle + constructor <;> linarith [hx.2] + obtain ⟨p, hp, hxp⟩ := hex + refine ⟨p, hp, if b p then x - p else 1 - (x - p), ?_, ?_⟩ + · cases b p + · simpa using ⟨by linarith [hxp.2], by linarith [hxp.1]⟩ + · simpa using ⟨by linarith [hxp.1], by linarith [hxp.2]⟩ + · cases b p <;> simp [sdPt] + +theorem cnt_le_one_of_nodup {w : List Letter} (h : (w.map Prod.fst).Nodup) (c : ℕ) : cnt w c ≤ 1 + := by + have h1 : cnt w c = (w.map Prod.fst).count c := by + rw [List.count, List.countP_map] + rfl + rw [h1] + exact List.nodup_iff_count_le_one.mp h c + +omit [T2Space X] in +private theorem cell_label_bounds {𝓕 : Set (Set X)} (hd : IsDissection V E 𝓕) + {A : Set X → 𝕀 → X} (hA : ∀ e ∈ E, IsArcMap (A e) ∧ range (A e) = e ∧ e ∩ V = {A e 0, A e 1}) + {lab : Set X → ℕ} (hlab : InjOn lab E) {D : Set ℕ} (hDf : D.Finite) + {idx : Set X → ℕ} {cl : ℕ → Set X} {m : Set X → ℕ} {s : Set X → ℕ → Set X} + {ε : Set X → ℕ → Bool} {W : ℕ → List Letter} + (hclm : ∀ i ∈ D, cl i ∈ 𝓕) (hcli : ∀ i ∈ D, idx (cl i) = i) + (hs : ∀ Φ ∈ 𝓕, ∀ p < m Φ, s Φ p ∈ E ∧ s Φ p ⊆ discBd Φ) + (hsne : ∀ Φ ∈ 𝓕, ∀ p < m Φ, ∀ q < m Φ, p ≠ q → s Φ p ≠ s Φ q) + (hget' : ∀ i p l, (W i)[p]? = some l → i ∈ D ∧ p < m (cl i) ∧ l = (lab (s (cl i) p), ε + (cl i) p)) + (hlabels : ∀ i ∈ D, (W i).map Prod.fst = (List.range (m (cl i))).map (fun p => lab (s + (cl i) p))) : + (∀ c, ∑ i ∈ hDf.toFinset, cnt (W i) c ≤ 2) ∧ IsPaired W := by + classical + have hle1 : ∀ c, ∀ i ∈ hDf.toFinset, cnt (W i) c ≤ 1 := by + intro c i hi + have hiD : i ∈ D := by simpa using hi + refine cnt_le_one_of_nodup ?_ c + rw [hlabels i hiD] + refine List.Nodup.map_on ?_ List.nodup_range + intro p hp q hq he + by_contra hpq + have hp' : p < m (cl i) := List.mem_range.mp hp + have hq' : q < m (cl i) := List.mem_range.mp hq + exact hsne _ (hclm i hiD) p hp' q hq' hpq + (hlab (hs _ (hclm i hiD) p hp').1 (hs _ (hclm i hiD) q hq').1 he) + have hTc : ∀ c, (hDf.toFinset.filter fun i => 0 < cnt (W i) c).card ≤ 2 := by + intro c + let T := hDf.toFinset.filter fun i => 0 < cnt (W i) c + change T.card ≤ 2 + rcases T.eq_empty_or_nonempty with he | ⟨i₀, hi₀⟩ + · simp [he] + have hwit : ∀ i ∈ T, ∃ p < m (cl i), lab (s (cl i) p) = c := fun i hi => by + obtain ⟨W₁, l, W₂, he, hl⟩ := exists_of_cnt_pos (Finset.mem_filter.mp hi).2 + have hl' : l ∈ W i := by simp [he] + obtain ⟨p, hp⟩ := List.getElem?_of_mem hl' + obtain ⟨-, hp', e⟩ := hget' _ _ _ hp + exact ⟨p, hp', (congrArg Prod.fst e).symm.trans hl⟩ + obtain ⟨p₀, hp₀, hl₀⟩ := hwit i₀ hi₀ + have hi₀D : i₀ ∈ D := by simpa using (Finset.mem_filter.mp hi₀).1 + let e₀ := s (cl i₀) p₀ + have he₀ : e₀ ∈ E := (hs _ (hclm _ hi₀D) p₀ hp₀).1 + obtain ⟨harc, hran, hends⟩ := hA e₀ he₀ + let x : X := A e₀ ⟨1 / 2, by norm_num, by norm_num⟩ + have hxe : x ∈ e₀ := hran.subset ⟨_, rfl⟩ + have hxV : x ∉ V := fun h => by + have h1 : x ∈ e₀ ∩ V := ⟨hxe, h⟩ + rw [hends] at h1 + rcases h1 with h1 | h1 + · have := congrArg Subtype.val (harc.2 h1) + norm_num at this + · have := congrArg Subtype.val (harc.2 h1) + norm_num at this + have hsubT : cl '' (T : Set ℕ) ⊆ {Φ ∈ 𝓕 | x ∈ Φ} := by + rintro _ ⟨i, hi, rfl⟩ + have hiD : i ∈ D := by simpa using (Finset.mem_filter.mp hi).1 + obtain ⟨p, hp, hl⟩ := hwit i hi + refine ⟨hclm i hiD, ?_⟩ + have h1 : s (cl i) p = e₀ := hlab (hs _ (hclm _ hiD) p hp).1 he₀ (hl.trans hl₀.symm) + exact discBd_subset _ ((hs _ (hclm _ hiD) p hp).2 (h1 ▸ hxe)) + have hinjT : InjOn cl (T : Set ℕ) := fun i hi j hj he => by + have hiD : i ∈ D := by simpa using (Finset.mem_filter.mp hi).1 + have hjD : j ∈ D := by simpa using (Finset.mem_filter.mp hj).1 + rw [← hcli i hiD, ← hcli j hjD, he] + have h2 := (encard_le_encard hsubT).trans (hd.count x hxV) + rw [hinjT.encard_image, encard_coe_eq_coe_finsetCard] at h2 + exact_mod_cast h2 + constructor + · intro c + have hsum : ∑ i ∈ hDf.toFinset, cnt (W i) c ≤ (hDf.toFinset.filter fun i => 0 < cnt + (W i) c).card := by + rw [Finset.card_filter] + refine Finset.sum_le_sum fun i hi => ?_ + have := hle1 c i hi + split_ifs with h <;> omega + exact hsum.trans (hTc c) + · intro k + have hinj : InjOn Prod.fst {t : ℕ × ℕ | ∃ e, (W t.1)[t.2]? = some (k, e)} := by + rintro ⟨i, p⟩ ⟨e, h1⟩ ⟨j, q⟩ ⟨e', h2⟩ (he : i = j) + subst he + simp only at h1 h2 + obtain ⟨hi, hp, hl⟩ := hget' _ _ _ h1 + obtain ⟨-, hq, hl'⟩ := hget' _ _ _ h2 + have h3 : lab (s (cl i) p) = lab (s (cl i) q) := (congrArg Prod.fst hl).symm.trans + (congrArg Prod.fst hl') + by_contra hne + have hpq : p ≠ q := fun h => hne (by rw [h]) + exact hsne _ (hclm i hi) p hp q hq hpq (hlab (hs _ (hclm i hi) p hp).1 (hs _ + (hclm i hi) q hq).1 h3) + rw [← hinj.encard_image] + refine (encard_le_encard (t := ((hDf.toFinset.filter fun i => 0 < cnt + (W i) k : Finset ℕ) : Set ℕ)) ?_).trans ?_ + · rintro _ ⟨⟨i, p⟩, ⟨e, h1⟩, rfl⟩ + simp only at h1 + have hi := (hget' _ _ _ h1).1 + have hm' : (k, e) ∈ W i := List.mem_of_getElem? h1 + have := cnt_pos hm' + simp only [Finset.coe_filter, mem_ofPred_eq] + exact ⟨by simpa using hi, this⟩ + · rw [encard_coe_eq_coe_finsetCard] + exact_mod_cast hTc k + +/-- **Words of a dissection.** Each letter of the word names an edge, and each side runs along its +edge. -/ +theorem exists_family_edges [Nonempty X] (hman : ∀ x : X, IsManifoldPoint x) {𝓕 : Set (Set X)} + (hd : IsDissection V E 𝓕) + (hne : 𝓕.Nonempty) : + ∃ (W : ℕ → List Letter) (f : ℕ × ℂ → X) (S : Finset ℕ) (A : Set X → 𝕀 → X) (lab : Set X + → ℕ), FinW W ∧ W 0 ≠ [] ∧ + Presents W f ∧ (∀ i, W i ≠ [] → 2 ≤ (W i).length) ∧ (∀ i, i ∉ S → W i = []) ∧ + (∀ c, ∑ i ∈ S, cnt (W i) c ≤ 2) ∧ + (∀ e ∈ E, IsArcMap (A e) ∧ range (A e) = e ∧ e ∩ V = {A e 0, A e 1}) ∧ InjOn lab E ∧ + (∀ i p k e', (W i)[p]? = some (k, e') → ∃ e ∈ E, lab e = k ∧ ∀ u ∈ Icc (0 : ℝ) 1, + f (spt W i p u) = extI (A e) (ofs e' u)) ∧ (∀ a ∈ Dsk W, f a ∈ ⋃₀ E → ‖a.2‖ = 1) + ∧ IsPaired W := by + classical + have hg := hd.graph + have harcs : ∀ e, ∃ a : 𝕀 → X, e ∈ E → IsArcMap a ∧ range a = e ∧ e ∩ V = {a 0, a 1} := by + intro e + by_cases he : e ∈ E + · obtain ⟨u, v, -, hl, hi⟩ := hg.edge e he + obtain ⟨a, ha, h1, rfl, rfl⟩ := hl.exists_arc + exact ⟨a, fun _ => ⟨ha, h1, hi⟩⟩ + · exact ⟨fun _ => Classical.arbitrary X, fun h => absurd h he⟩ + choose A hA using harcs + have hdata := fun Φ (hΦ : Φ ∈ 𝓕) => exists_cell_data hg A hA (hd.disc Φ hΦ) (hd.bd Φ hΦ) + choose! m s ε Ψ hm hs hsne hΨc hΨi hΨr hΨb hΨs using hdata + obtain ⟨Φ₀, hΦ₀⟩ := hne + obtain ⟨idx0, hidx0⟩ := Set.countable_iff_exists_injOn.mp hd.fin.countable + let idx : Set X → ℕ := fun Φ => Equiv.swap (idx0 Φ₀) 0 (idx0 Φ) + have hidx : InjOn idx 𝓕 := fun x hx y hy he => hidx0 hx hy ((Equiv.swap _ _).injective he) + have hidxΦ₀ : idx Φ₀ = 0 := by simp [idx] + obtain ⟨lab, hlab⟩ := Set.countable_iff_exists_injOn.mp (hg.fine.countable) + let D : Set ℕ := idx '' 𝓕 + have hDf : D.Finite := hd.fin.image _ + let cl : ℕ → Set X := Function.invFunOn idx 𝓕 + have hclm : ∀ i ∈ D, cl i ∈ 𝓕 := fun i hi => Function.invFunOn_mem hi + have hcli : ∀ i ∈ D, idx (cl i) = i := fun i hi => Function.invFunOn_eq hi + have hcld : ∀ Φ ∈ 𝓕, cl (idx Φ) = Φ := fun Φ hΦ => hidx (hclm _ ⟨Φ, hΦ, rfl⟩) hΦ + (hcli _ ⟨Φ, hΦ, rfl⟩) + let word : Set X → List Letter := fun Φ => (List.range (m Φ)).map fun p => (lab (s Φ p), ε Φ p) + let W : ℕ → List Letter := fun i => if i ∈ D then word (cl i) else [] + let f : ℕ × ℂ → X := fun a => Ψ (cl a.1) a.2 + have hlen : ∀ i ∈ D, (W i).length = m (cl i) := fun i hi => by simp [W, hi, word] + have hget : ∀ i ∈ D, ∀ p < m (cl i), (W i)[p]? = some (lab (s (cl i) p), ε (cl i) p) + := fun i hi p hp => by + simp [W, hi, word, hp] + have hget' : ∀ i p l, (W i)[p]? = some l → i ∈ D ∧ p < m (cl i) ∧ l = (lab (s (cl i) p), ε + (cl i) p) := by + intro i p l h + by_cases hi : i ∈ D + · have hlt : p < (W i).length := (List.getElem?_eq_some_iff.mp h).1 + rw [hlen i hi] at hlt + rw [hget i hi p hlt] at h + exact ⟨hi, hlt, (Option.some.inj h).symm⟩ + · simp [W, hi] at h + have hWne : ∀ i, W i ≠ [] ↔ i ∈ D := fun i => by + constructor + · intro h + by_contra hi + exact h (by simp [W, hi]) + · intro hi he + have := hlen i hi + rw [he] at this + have h2 := hm _ (hclm i hi) + simp only [List.length_nil] at this + omega + have hmemD : ∀ {a}, a ∈ Dsk W → a.1 ∈ D ∧ a.2 ∈ closedBall (0 : ℂ) 1 := fun {a} ha => + ⟨(hWne _).mp ha.1, by simpa using ha.2⟩ + have hfW : FinW W := hDf.subset fun i hi => (hWne i).mp hi + have hcont : ContinuousOn f (Dsk W) := + continuousOn_slots fun i hi => hΨc _ (hclm i ((hWne i).mp hi)) + have hsurj : f '' Dsk W = univ := by + refine eq_univ_of_forall fun x => ?_ + have h1 : x ∈ ⋃₀ 𝓕 := hd.cover ▸ mem_univ x + obtain ⟨Φ, hΦ, hx⟩ := h1 + rw [← hΨr Φ hΦ] at hx + obtain ⟨z, hz, rfl⟩ := hx + have hi : idx Φ ∈ D := ⟨Φ, hΦ, rfl⟩ + refine ⟨(idx Φ, z), ⟨(hWne _).mpr hi, by simpa using hz⟩, ?_⟩ + simp only [f, hcld Φ hΦ] + have hsval : ∀ i ∈ D, ∀ p < m (cl i), ∀ t ∈ Icc (0 : ℝ) 1, + f (i, sdPt (W i).length p (ε (cl i) p) t) = extI (A (s (cl i) p)) t := fun i hi p hp t ht + => by + simp only [f, hlen i hi] + exact hΨs _ (hclm i hi) p hp t ht + have hst : ∀ a b, Stp W a b → f a = f b := by + rintro _ _ ⟨i, j, p, q, k, e, e', t, h1, h2, -, ht, rfl, rfl⟩ + obtain ⟨hi, hp, hl⟩ := hget' _ _ _ h1 + obtain ⟨hj, hq, hl'⟩ := hget' _ _ _ h2 + obtain ⟨rfl, rfl⟩ := Prod.mk.inj hl + obtain ⟨h3, rfl⟩ := Prod.mk.inj hl' + have hes : s (cl i) p = s (cl j) q := hlab (hs _ (hclm i hi) p hp).1 (hs _ + (hclm j hj) q hq).1 h3 + rw [hsval i hi p hp t ht, hsval j hj q hq t ht, hes] + have hinj : ∀ a ∈ Dsk W, ∀ b ∈ Dsk W, a.1 = b.1 → f a = f b → a = b := by + rintro ⟨i, z⟩ ha ⟨j, z'⟩ hb he hf + obtain rfl : i = j := he + have := hΨi _ (hclm i (hmemD ha).1) (hmemD ha).2 (hmemD hb).2 hf + rw [show z = z' from this] + have hint : ∀ a ∈ Dsk W, ∀ b ∈ Dsk W, ‖a.2‖ ≠ 1 → f a = f b → a = b := by + rintro ⟨i, z⟩ ha ⟨j, z'⟩ hb hn hf + have hi := (hmemD ha).1 + have hj := (hmemD hb).1 + have h1 : f (i, z) ∈ discInt (cl i) := by + refine ⟨(hΨr _ (hclm i hi)) ▸ mem_image_of_mem _ (hmemD ha).2, fun h => hn ?_⟩ + exact (hΨb _ (hclm i hi) z (hmemD ha).2).mp h + have h2 : f (j, z') ∈ cl j := (hΨr _ (hclm j hj)) ▸ mem_image_of_mem _ (hmemD hb).2 + rw [← hf] at h2 + have hc : cl i = cl j := by + by_contra hc + exact Set.disjoint_left.mp (hd.disj _ (hclm i hi) _ (hclm j hj) hc) h1 h2 + have hij : i = j := by rw [← hcli i hi, ← hcli j hj, hc] + subst hij + exact hinj _ ha _ hb rfl hf + have hside : ∀ a ∈ Dsk W, ‖a.2‖ = 1 → ∃ p < m (cl a.1), ∃ t ∈ Icc (0 : ℝ) 1, + a = (a.1, sdPt (W a.1).length p (ε (cl a.1) p) t) ∧ f a = extI (A (s (cl a.1) p)) t := by + rintro ⟨i, z⟩ ha hn + have hi := (hmemD ha).1 + have hm0 : 0 < m (cl i) := by + have := hm _ (hclm i hi) + omega + obtain ⟨p, hp, t, ht, e⟩ := exists_side_of_sphere hm0 (ε (cl i)) hn + refine ⟨p, hp, t, ht, ?_, ?_⟩ + · simp only [hlen i hi, e] + · have := hsval i hi p hp t ht + rw [hlen i hi, e] at this + exact this + have hoff : ∀ a ∈ Dsk W, ∀ b ∈ Dsk W, f a = f b → f a ∉ V → PRel W a b := by + intro a ha b hb hf hV + by_cases hna : ‖a.2‖ = 1 + · by_cases hnb : ‖b.2‖ = 1 + · obtain ⟨p, hp, t, ht, e1, e2⟩ := hside a ha hna + obtain ⟨q, hq, t', ht', e3, e4⟩ := hside b hb hnb + have hi := (hmemD ha).1 + have hj := (hmemD hb).1 + have hsE := (hs _ (hclm _ hi) p hp).1 + have hsE' := (hs _ (hclm _ hj) q hq).1 + have mem1 : f a ∈ s (cl a.1) p := by + rw [e2] + exact (hA _ hsE).2.1.subset ⟨_, rfl⟩ + have mem2 : f a ∈ s (cl b.1) q := by + rw [hf, e4] + exact (hA _ hsE').2.1.subset ⟨_, rfl⟩ + have hes : s (cl a.1) p = s (cl b.1) q := by + by_contra hc + exact hV (hg.disj _ hsE _ hsE' hc ⟨mem1, mem2⟩) + have htt : t = t' := by + have h1 : extI (A (s (cl a.1) p)) t = extI (A (s (cl a.1) p)) t' := by + rw [← e2, hf, e4, hes] + exact extI_injOn (hA _ hsE).1.2 ht ht' h1 + subst htt + by_cases hpq : (a.1, p) = (b.1, q) + · obtain ⟨h1, h2⟩ := Prod.mk.inj hpq + have : a = b := by + rw [e1, e3] + subst h2 + simp only [h1] + rw [this] + exact .refl _ + · refine .rel _ _ ⟨a.1, b.1, p, q, lab (s (cl a.1) p), ε (cl a.1) p, ε (cl b.1) q, t, + hget _ hi p hp, ?_, hpq, ht, + e1, e3⟩ + rw [hes] + exact hget _ hj q hq + · rw [hint b hb a ha hnb hf.symm] + exact .refl _ + · rw [hint a ha b hb hna hf] + exact .refl _ + have hrelf : ∀ a b, PRel W a b → f a = f b := fun a b h => by + induction h with + | rel _ _ h => exact hst _ _ h + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + have hpres : Presents W f := by + refine ⟨hcont, hsurj, fun a ha b hb => ⟨fun he => ?_, hrelf a b⟩⟩ + by_cases hV : f a ∈ V + · have hZ : (Dsk W ∩ f ⁻¹' {f a}).Finite := by + refine Set.Finite.of_finite_image (f := Prod.fst) (hDf.subset ?_) ?_ + · rintro _ ⟨x, hx, rfl⟩ + exact (hmemD hx.1).1 + · intro x hx y hy he' + exact hinj x hx.1 y hy.1 he' (hx.2.trans hy.2.symm) + exact prel_of_vertex hfW hcont hsurj hst hinj hg.fin (hman (f a)) hZ hoff ha hb rfl he.symm + · exact hoff a ha b hb he hV + obtain ⟨hTotal, hPaired⟩ := + cell_label_bounds hd hA hlab hDf hclm hcli hs hsne hget' (fun i hi => by + simp [W, hi, word, Function.comp_def]) + refine ⟨W, f, hDf.toFinset, A, lab, hfW, ?_, hpres, ?_, ?_, hTotal, hA, hlab, ?_, ?_, hPaired⟩ + · exact (hWne 0).mpr ⟨Φ₀, hΦ₀, hidxΦ₀⟩ + · intro i hi + rw [hlen i ((hWne i).mp hi)] + exact hm _ (hclm i ((hWne i).mp hi)) + · intro i hi + by_contra he + exact hi (by simpa using (hWne i).mp he) + · intro i p k e' h + obtain ⟨hi, hp, hl⟩ := hget' _ _ _ h + obtain ⟨rfl, rfl⟩ := Prod.mk.inj hl + refine ⟨s (cl i) p, (hs _ (hclm i hi) p hp).1, rfl, fun u hu => ?_⟩ + have h1 := hsval i hi p hp (ofs (ε (cl i) p) u) (ofs_mem hu) + rw [sdPt_eq, ofs_ofs] at h1 + exact h1 + · intro a ha hfa + by_contra hn + have hi := (hmemD ha).1 + have h1 : f a ∈ discInt (cl a.1) := + ⟨(hΨr _ (hclm _ hi)) ▸ mem_image_of_mem _ (hmemD ha).2, fun h => hn ((hΨb _ (hclm _ hi) a.2 + (hmemD ha).2).mp h)⟩ + exact Set.disjoint_left.mp (hd.int _ (hclm _ hi)) h1 hfa + +/-- **Words of a dissection.** -/ +theorem exists_family [Nonempty X] (hman : ∀ x : X, IsManifoldPoint x) {𝓕 : Set (Set X)} + (hd : IsDissection V E 𝓕) + (hne : 𝓕.Nonempty) : + ∃ (W : ℕ → List Letter) (f : ℕ × ℂ → X) (S : Finset ℕ), FinW W ∧ W 0 ≠ [] ∧ Presents W f ∧ + (∀ i, W i ≠ [] → 2 ≤ (W i).length) ∧ (∀ i, i ∉ S → W i = []) ∧ ∀ c, ∑ i ∈ S, cnt (W i) c ≤ 2 + := by + obtain ⟨W, f, S, A, lab, h1, h2, h3, h4, h5, h6, -⟩ := exists_family_edges hman hd hne + exact ⟨W, f, S, h1, h2, h3, h4, h5, h6⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CellMap.lean b/LeanPool/GraphMinor/Surface/CellMap.lean new file mode 100644 index 0000000000..7601a1d41d --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CellMap.lean @@ -0,0 +1,194 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.EdgeLoop +public import LeanPool.GraphMinor.Surface.WordRules + +/-! +# A closed disc as a polygon + +A closed disc whose boundary is a cyclic list of arcs is the image of the unit disc, with the sides +of the round +polygon sent to these arcs by their parameters (`exists_cell_map`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +local notation "𝕀" => unitInterval + +variable {X : Type u} [TopologicalSpace X] [T2Space X] + +omit [T2Space X] in +theorem sd_injOn {a : 𝕀 → X} (ha : IsArcMap a) (b : Bool) : InjOn (sd a b) (Icc 0 1) := by + have h : InjOn (extI a) (Icc 0 1) := extI_injOn ha.2 + intro x hx y hy he + cases b + · rw [sd_false, sd_false] at he + have := h ⟨by linarith [hx.2], by linarith [hx.1]⟩ ⟨by linarith [hy.2], by linarith [hy.1]⟩ he + linarith + · rw [sd_true, sd_true] at he + exact h hx hy he + +omit [T2Space X] in +theorem exists_cell_map {Φ : Set X} (hΦ : IsClosedDisc Φ) {m : ℕ} (hm : 0 < m) (a : ℕ → 𝕀 → X) + (b : ℕ → Bool) + (ha : ∀ p < m, IsArcMap (a p)) + (hadj : ∀ p, p + 1 < m → sd (a p) (b p) 1 = sd (a (p + 1)) (b (p + 1)) 0) + (hclose : sd (a (m - 1)) (b (m - 1)) 1 = sd (a 0) (b 0) 0) + (hdis : ∀ p < m, ∀ q < m, p ≠ q → ∀ u ∈ Ico (0 : ℝ) 1, ∀ v ∈ Ico (0 : ℝ) 1, + sd (a p) (b p) u ≠ sd (a q) (b q) v) + (hsub : ∀ p < m, range (a p) ⊆ discBd Φ) (hcov : discBd Φ ⊆ ⋃ p ∈ Iio m, range (a p)) : + ∃ Ψ : ℂ → X, ContinuousOn Ψ (closedBall 0 1) ∧ InjOn Ψ (closedBall 0 1) ∧ Ψ '' closedBall 0 1 + = Φ ∧ + (∀ z ∈ closedBall (0 : ℂ) 1, Ψ z ∈ discBd Φ ↔ ‖z‖ = 1) ∧ + ∀ p < m, ∀ t ∈ Icc (0 : ℝ) 1, Ψ (sdPt m p (b p) t) = extI (a p) t := by + classical + obtain ⟨h, g, c⟩ := hΦ.exists_isChart + let β : ℝ → X := walkMap m a b + have hm' : (0 : ℝ) < m := by exact_mod_cast hm + have hβc : ContinuousOn β (Icc 0 m) := continuousOn_walkMap hm (fun p hp => (ha p hp).1) hadj + have hpos : ∀ x ∈ Icc (0 : ℝ) m, ∃ p < m, x ∈ Icc (p : ℝ) (p + 1) ∧ β x = sd (a p) (b p) (x - p) ∧ + (x < m → x < p + 1) := by + intro x hx + refine ⟨min ⌊x⌋₊ (m - 1), by omega, ?_, rfl, fun hxm => ?_⟩ + · have hle : ⌊x⌋₊ ≤ x := Nat.floor_le hx.1 + have hlt : x < ⌊x⌋₊ + 1 := Nat.lt_floor_add_one x + by_cases h1 : ⌊x⌋₊ ≤ m - 1 + · rw [min_eq_left h1] + exact ⟨hle, hlt.le⟩ + · have h2 : ⌊x⌋₊ = m := by + have : ⌊x⌋₊ ≤ m := Nat.floor_le_of_le hx.2 + omega + have h3 : ((m - 1 : ℕ) : ℝ) = m - 1 := by + rw [Nat.cast_sub hm] + simp + rw [min_eq_right (by omega), h3] + rw [h2] at hle + constructor <;> linarith [hx.2] + · have h1 : ⌊x⌋₊ ≤ m - 1 := by + have := Nat.floor_lt hx.1 |>.mpr hxm + omega + rw [min_eq_left h1] + exact Nat.lt_floor_add_one x + have himg : ∀ x ∈ Icc (0 : ℝ) m, β x ∈ discBd Φ := fun x hx => by + obtain ⟨p, hp, -, e, -⟩ := hpos x hx + rw [e] + exact hsub p hp ⟨_, rfl⟩ + have hsdim : ∀ p < m, ∀ t ∈ Icc (0 : ℝ) 1, sd (a p) (b p) (if b p then t else 1 - t) = extI + (a p) t := fun p _ t _ => by + cases b p + · simp [sd] + · simp [sd] + have hβat : ∀ p < m, ∀ t ∈ Icc (0 : ℝ) 1, (p + if b p then t else 1 - t) ∈ Icc (0 : ℝ) m ∧ + β (p + if b p then t else 1 - t) = extI (a p) t := fun p hp t ht => by + have hp1 : (p : ℝ) + 1 ≤ m := by exact_mod_cast hp + have hp0 : (0 : ℝ) ≤ p := Nat.cast_nonneg p + have h01 : (if b p then t else 1 - t) ∈ Icc (0 : ℝ) 1 := by + cases b p + · simpa using ⟨ht.2, ht.1⟩ + · simpa using ht + have hin : (p + if b p then t else 1 - t) ∈ Icc (p : ℝ) (p + 1) := ⟨by linarith [h01.1], by + linarith [h01.2]⟩ + refine ⟨⟨by linarith [h01.1], by linarith [h01.2]⟩, ?_⟩ + rw [show β (p + if b p then t else 1 - t) = _ from walkMap_eq hm hadj hp hin, + add_sub_cancel_left] + exact hsdim p hp t ht + have hβr : β '' Icc 0 m = discBd Φ := by + apply subset_antisymm + · rintro _ ⟨x, hx, rfl⟩ + exact himg x hx + · intro y hy + obtain ⟨p, hp, t, rfl⟩ : ∃ p < m, ∃ t, y = a p t := by + have := hcov hy + simp only [mem_iUnion, exists_prop] at this + obtain ⟨p, hp, t, ht⟩ := this + exact ⟨p, hp, t, ht.symm⟩ + obtain ⟨h1, h2⟩ := hβat p hp t t.2 + exact ⟨_, h1, h2.trans (extI_coe _ _)⟩ + have hβi : InjOn β (Ico 0 m) := by + intro x hx y hy he + obtain ⟨p, hp, hxp, e1, l1⟩ := hpos x ⟨hx.1, hx.2.le⟩ + obtain ⟨q, hq, hyq, e2, l2⟩ := hpos y ⟨hy.1, hy.2.le⟩ + have hu : x - p ∈ Ico (0 : ℝ) 1 := ⟨by linarith [hxp.1], by linarith [l1 hx.2]⟩ + have hv : y - q ∈ Ico (0 : ℝ) 1 := ⟨by linarith [hyq.1], by linarith [l2 hy.2]⟩ + have he' : sd (a p) (b p) (x - p) = sd (a q) (b q) (y - q) := by rw [← e1, ← e2, he] + by_cases hpq : p = q + · subst hpq + have := sd_injOn (ha p hp) (b p) ⟨hu.1, hu.2.le⟩ ⟨hv.1, hv.2.le⟩ he' + linarith + · exact absurd he' (hdis p hp q hq hpq _ hu _ hv) + have h0m : β 0 = β m := by + have e1 := walkMap_eq (x := 0) hm hadj hm ⟨by simp, by simp⟩ + have e2 := walkMap_eq (x := m) hm hadj (p := m - 1) (by omega) ⟨by rw [Nat.cast_sub hm]; simp, + by + rw [Nat.cast_sub hm]; simp⟩ + have e3 : (m : ℝ) - ((m - 1 : ℕ) : ℝ) = 1 := by + rw [Nat.cast_sub hm] + simp + change walkMap m a b 0 = walkMap m a b m + rw [e1, e2, e3, hclose] + simp + have hcm : ContinuousOn (fun x => h (β x)) (Icc 0 m) := + c.hc.comp hβc fun x hx => discBd_subset _ (himg x hx) + have hii : InjOn (fun x => h (β x)) (Ico 0 m) := fun x hx y hy he => by + have hx' := himg x ⟨hx.1, hx.2.le⟩ + have hy' := himg y ⟨hy.1, hy.2.le⟩ + refine hβi hx hy ?_ + rw [← c.gh (discBd_subset _ hx'), ← c.gh (discBd_subset _ hy')] + exact congrArg g he + have hrr : (fun x => h (β x)) '' Icc 0 m = discBd (closedBall (0 : ℂ) 1) := by + rw [isClosedDisc_closedBall.2, ← c.bd, ← hβr, image_image] + obtain ⟨Θ, Θ', hmt, hval⟩ := exists_polygon_map isClosedDisc_closedBall.1 hm hcm hii + (by simp only [h0m]) hrr + have hΨv : ∀ x ∈ Icc (0 : ℝ) m, g (Θ (per m x)) = β x := fun x hx => by + rw [hval x hx] + exact c.gh (discBd_subset _ (himg x hx)) + have hΨinj : InjOn (fun z => g (Θ z)) (closedBall 0 1) := fun x hx y hy he => by + have h1 : Θ x = Θ y := by + rw [← c.hg (hmt.1 hx), ← c.hg (hmt.1 hy)] + exact congrArg h he + rw [← hmt.2.2.1 hx, ← hmt.2.2.1 hy, h1] + refine ⟨fun z => g (Θ z), c.gc.comp hmt.2.2.2.2.1 hmt.1, hΨinj, ?_, ?_, ?_⟩ + · apply subset_antisymm + · rintro _ ⟨z, hz, rfl⟩ + exact c.gm (hmt.1 hz) + · intro y hy + have h1 := c.hm hy + refine ⟨Θ' (h y), hmt.2.1 h1, ?_⟩ + change g (Θ (Θ' (h y))) = y + rw [hmt.2.2.2.1 h1] + exact c.gh hy + · intro z hz + constructor + · intro hb + obtain ⟨x, hx, e⟩ := hβr.symm ▸ hb + have hxp : per m x ∈ closedBall (0 : ℂ) 1 := by simpa using (norm_per m x).le + have h1 : per m x = z := hΨinj hxp hz ((hΨv x hx).trans e) + rw [← h1] + exact norm_per m x + · intro hn + have h1 : z ∈ sphere (0 : ℂ) 1 := by simpa using hn + rw [← per_image hm] at h1 + obtain ⟨x, hx, rfl⟩ := h1 + change g (Θ (per m x)) ∈ _ + rw [hΨv x hx] + exact himg x hx + · intro p hp t ht + obtain ⟨h1, h2⟩ := hβat p hp t ht + change g (Θ (sdPt m p (b p) t)) = _ + rw [sdPt, hΨv _ h1, h2] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/ChartCells.lean b/LeanPool/GraphMinor/Surface/ChartCells.lean new file mode 100644 index 0000000000..ca1e377c91 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/ChartCells.lean @@ -0,0 +1,627 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Skeleton + +/-! +# Cutting a chart disc along a graph + +Let `G` be a graph in a surface that stays connected when a point is removed, and let `B` be a +closed disc whose +boundary lies in `G`. Starting from `B` we add the edges of `G` inside `B` along arcs with two +different ends on what we +have so far (`exists_ear`). Each such arc cuts one closed disc in two (`IsCells.split`). So `B` is +cut into closed discs +whose interiors miss `G` (`exists_cells`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +universe u + +local notation "𝕀" => unitInterval + +variable {X : Type u} [TopologicalSpace X] + +theorem IsLineWithEnds.diff_eq {L : Set X} {u v : X} {a : 𝕀 → X} (ha : IsArcMap a) + (hr : range a = L) + (h0 : a 0 = u) (h1 : a 1 = v) : L \ {u, v} = extI a '' Ioo 0 1 := by + ext x + constructor + · rintro ⟨hx, hne⟩ + obtain ⟨t, rfl⟩ := hr.symm.subset hx + have ht0 : (t : ℝ) ≠ 0 := fun he => hne (.inl (by rw [← h0]; exact congrArg a (Subtype.ext he))) + have ht1 : (t : ℝ) ≠ 1 := fun he => hne (.inr (by rw [← h1]; exact congrArg a (Subtype.ext he))) + exact ⟨t, ⟨lt_of_le_of_ne t.2.1 (Ne.symm ht0), lt_of_le_of_ne t.2.2 ht1⟩, extI_coe a t⟩ + · rintro ⟨t, ht, rfl⟩ + have hm : t ∈ Icc (0 : ℝ) 1 := Ioo_subset_Icc_self ht + rw [extI_of_mem a hm] + refine ⟨hr ▸ ⟨_, rfl⟩, ?_⟩ + rintro (he | he) + · have := congrArg Subtype.val (ha.2 (he.trans h0.symm)) + exact ht.1.ne' this + · have := congrArg Subtype.val (ha.2 (he.trans h1.symm)) + exact ht.2.ne this + +theorem IsLineWithEnds.isPreconnected_diff {L : Set X} {u v : X} + (h : IsLineWithEnds L u v) : + IsPreconnected (L \ {u, v}) := by + obtain ⟨a, ha, hr, h0, h1⟩ := h.exists_arc + rw [IsLineWithEnds.diff_eq ha hr h0 h1] + exact isPreconnected_Ioo.image _ (continuous_extI ha.1).continuousOn + +theorem IsLineWithEnds.subset_closure_diff {L : Set X} {u v : X} + (h : IsLineWithEnds L u v) : + L ⊆ closure (L \ {u, v}) := by + obtain ⟨a, ha, hr, h0, h1⟩ := h.exists_arc + rw [IsLineWithEnds.diff_eq ha hr h0 h1] + refine subset_trans ?_ (image_closure_subset_closure_image (continuous_extI ha.1)) + rw [closure_Ioo (zero_ne_one' ℝ), ← hr] + rintro _ ⟨t, rfl⟩ + exact ⟨t, t.2, extI_coe a t⟩ + +variable {V : Set X} {E : Set (Set X)} + +theorem IsGraph.diff_edge (_hg : IsGraph V E) {e : Set X} {u v : X} (hi : e ∩ V + = {u, v}) : e \ {u, v} = e \ V := by + ext x + constructor + · rintro ⟨h1, h2⟩ + exact ⟨h1, fun h3 => h2 (hi ▸ ⟨h1, h3⟩)⟩ + · rintro ⟨h1, h2⟩ + exact ⟨h1, fun h3 => h2 (by + have : x ∈ e ∩ V := hi ▸ h3 + exact this.2)⟩ + +theorem IsGraph.isPreconnected_open (hg : IsGraph V E) {e : Set X} + (he : e ∈ E) : IsPreconnected (e \ V) := by + obtain ⟨u, v, -, hl, hi⟩ := hg.edge e he + rw [← hg.diff_edge hi] + exact hl.isPreconnected_diff + +theorem IsGraph.subset_closure_open (hg : IsGraph V E) {e : Set X} + (he : e ∈ E) : e ⊆ closure (e \ V) := by + obtain ⟨u, v, -, hl, hi⟩ := hg.edge e he + rw [← hg.diff_edge hi] + exact hl.subset_closure_diff + +/-- The edges inside the disc `B`. -/ +def innerEdges (E : Set (Set X)) (B : Set X) : Set (Set X) := {e ∈ E | e ⊆ B ∧ ¬ e ⊆ discBd B} + +/-- What we have so far: the boundary of `B` and the edges in `M`. -/ +def partG (B : Set X) (M : Set (Set X)) : Set X := discBd B ∪ ⋃₀ M + +section + +variable [T2Space X] {B : Set X} + +theorem innerEdges_open (hg : IsGraph V E) (hB : IsClosedDisc B) (hbd : discBd B ⊆ gr V E) {e : Set + X} + (he : e ∈ innerEdges E B) : e \ V ⊆ discInt B := by + rcases hg.edge_or hB.isOArc_discBd hbd he.1 with h | h + · exact absurd h he.2.2 + · exact fun x hx => ⟨he.2.1 hx.1, Set.disjoint_left.mp h hx⟩ + +theorem mem_innerEdges (hman : ∀ x : X, IsManifoldPoint x) (hg : IsGraph V E) (hB : IsClosedDisc B) + (hbd : discBd B ⊆ gr V E) {e : Set X} (he : e ∈ E) {x : X} (hx : x ∈ e) (hxB : x ∈ discInt B) : + e ∈ innerEdges E B := by + have hnot : ¬ e ⊆ discBd B := fun h => hxB.2 (h hx) + refine ⟨he, ?_, hnot⟩ + have hdisj := (hg.edge_or hB.isOArc_discBd hbd he).resolve_left hnot + rcases hB.side hman (hg.isPreconnected_open he) hdisj with h | h + · exact (hg.subset_closure_open he).trans (closure_minimal (h.trans + (discInt_subset B)) hB.isClosed) + · exfalso + have hxc := hg.subset_closure_open he hx + obtain ⟨z, hz, hz'⟩ := mem_closure_iff.mp hxc _ (hB.isOpen_discInt hman) hxB + exact Set.disjoint_left.mp h hz' hz.1 + +theorem inter_partG_subset (hg : IsGraph V E) (hB : IsClosedDisc B) (hbd : discBd B ⊆ gr V E) + {M : Set (Set X)} (hM : M ⊆ innerEdges E B) {e : Set X} (he : e ∈ innerEdges E B) + (heM : e ∉ M) : + e ∩ partG B M ⊆ V := by + rintro z ⟨hz, hz' | ⟨f, hf, hzf⟩⟩ + · by_contra hzV + exact (innerEdges_open hg hB hbd he ⟨hz, hzV⟩).2 hz' + · exact hg.disj e he.1 f (hM hf).1 (fun h => heM (h ▸ hf)) ⟨hz, hzf⟩ + +omit [T2Space X] in +/-- A set that stays connected when a point is removed has no separation at a point. -/ +theorem TwoConn.no_cut {G : Set X} (hG : TwoConn G) {A C : Set X} (hA : IsClosed A) + (hC : IsClosed C) + (hu : G ⊆ A ∪ C) (hAG : A ⊆ G) (hCG : C ⊆ G) {p : X} (hi : A ∩ C ⊆ {p}) {x y : X} (hx : x ∈ A) + (hxp : x ≠ p) + (hy : y ∈ C) (hyp : y ≠ p) : False := by + obtain ⟨z, hz, hz'⟩ := isPreconnected_closed_iff.mp (hG p) A C hA hC (fun w hw => hu hw.1) + ⟨x, ⟨hAG hx, hxp⟩, hx⟩ ⟨y, ⟨hCG hy, hyp⟩, hy⟩ + exact hz.2 (hi hz') + +end + +/-- A path of edges from `p`, off the set `H`. -/ +inductive EarPath (p : X) (W : Set (Set X)) (H V : Set X) : Set (Set X) → X → Prop + | one {e : Set X} {w : X} : e ∈ W → e ∩ V = {p, w} → IsLineWithEnds e p w → w ≠ p → w ∉ H + → EarPath p W H V {e} w + | step {A : Set (Set X)} {w w' : X} {f : Set X} : EarPath p W H V A w → f ∈ W → f ∩ V = {w, w'} → + IsLineWithEnds f w w' → w' ≠ w → w' ∉ H → w' ∉ ⋃₀ A → EarPath p W H V (insert f A) w' + +section + +variable [T2Space X] {p : X} {W : Set (Set X)} {H : Set X} + +theorem EarPath.facts (hWE : W ⊆ E) (hg : IsGraph V E) (hp : p ∈ H) (hW : ∀ e ∈ W, e ∩ H ⊆ V) {A : + Set (Set X)} {w : X} + (h : EarPath p W H V A w) : + A ⊆ W ∧ A.Nonempty ∧ w ∈ V ∧ w ≠ p ∧ w ∉ H ∧ IsLineWithEnds (⋃₀ A) p w ∧ (⋃₀ A) ∩ H = {p} := by + induction h with + | @one e w he hi hl hne hn => + refine ⟨singleton_subset_iff.mpr he, singleton_nonempty _, ?_, hne, hn, by simpa using hl, ?_⟩ + · have : w ∈ e ∩ V := hi ▸ mem_insert_of_mem _ rfl + exact this.2 + · rw [sUnion_singleton] + ext z + constructor + · rintro ⟨h1, h2⟩ + have : z ∈ e ∩ V := ⟨h1, hW _ he ⟨h1, h2⟩⟩ + rw [hi] at this + rcases this with rfl | rfl + · rfl + · exact absurd h2 hn + · rintro rfl + exact ⟨hl.left_mem, hp⟩ + | @step A w w' f hA hf hi hl hne hn hnew ih => + obtain ⟨h1, h2, h3, h4, h5, h6, h7⟩ := ih + have hw'V : w' ∈ V := by + have : w' ∈ f ∩ V := hi ▸ mem_insert_of_mem _ rfl + exact this.2 + have hsU : ⋃₀ (insert f A) = ⋃₀ A ∪ f := by rw [sUnion_insert, union_comm] + refine ⟨insert_subset hf h1, insert_nonempty _ _, hw'V, ?_, hn, ?_, ?_⟩ + · rintro rfl + exact hnew h6.left_mem + · rw [hsU] + refine h6.union hl ?_ + ext z + constructor + · rintro ⟨⟨g, hgA, hzg⟩, hzf⟩ + have hgf : g ≠ f := fun he => hnew ⟨g, hgA, he ▸ hl.right_mem⟩ + have hzV := hg.disj g (hWE (h1 hgA)) f (hWE hf) hgf ⟨hzg, hzf⟩ + have : z ∈ f ∩ V := ⟨hzf, hzV⟩ + rw [hi] at this + rcases this with rfl | rfl + · rfl + · exact absurd ⟨g, hgA, hzg⟩ hnew + · rintro rfl + exact ⟨h6.right_mem, hl.left_mem⟩ + · rw [hsU] + ext z + constructor + · rintro ⟨h8 | h8, h9⟩ + · rw [← h7] + exact ⟨h8, h9⟩ + · have : z ∈ f ∩ V := ⟨h8, hW f hf ⟨h8, h9⟩⟩ + rw [hi] at this + rcases this with rfl | rfl + · exact absurd h9 h5 + · exact absurd h9 hn + · rintro rfl + exact ⟨.inl h6.left_mem, hp⟩ + +omit [T2Space X] in +theorem EarPath.reach {A : Set (Set X)} {w : X} (h : EarPath p W H V A w) {x : X} (hxV : x ∈ V) + (hxA : x ∈ ⋃₀ A) + (hxp : x ≠ p) : ∃ A', EarPath p W H V A' x := by + induction h with + | @one e w he hi hl hne hn => + have h1 : x ∈ e ∩ V := ⟨by simpa using hxA, hxV⟩ + rw [hi] at h1 + rcases h1 with rfl | rfl + · exact absurd rfl hxp + · exact ⟨_, .one he hi hl hne hn⟩ + | @step A w w' f hA hf hi hl hne hn hnew ih => + rw [sUnion_insert] at hxA + rcases hxA with h1 | h1 + · have h2 : x ∈ f ∩ V := ⟨h1, hxV⟩ + rw [hi] at h2 + rcases h2 with rfl | rfl + · exact ⟨_, hA⟩ + · exact ⟨_, .step hA hf hi hl hne hn hnew⟩ + · exact ih h1 + +/-- An arc made of edges inside `B` that are not yet used, with two different ends on what we have +so far. -/ +theorem exists_ear (hman : ∀ x : X, IsManifoldPoint x) (hg : IsGraph V E) (hG : TwoConn + (⋃₀ E)) {B : Set X} + (hB : IsClosedDisc B) (hbd : discBd B ⊆ ⋃₀ E) (hbd' : discBd B ⊆ gr V E) {M : Set (Set X)} + (hM : M ⊆ innerEdges E B) + (hne : ¬ innerEdges E B ⊆ M) : + ∃ (W : Set (Set X)) (a b : X), W ⊆ innerEdges E B \ M ∧ W.Nonempty ∧ a ≠ b ∧ a ∈ V ∧ b ∈ V ∧ + IsLineWithEnds (⋃₀ W) a b ∧ (⋃₀ W) ∩ partG B M = {a, b} := by + classical + set W0 := innerEdges E B \ M with hW0 + set H := partG B M with hH + have hWE : W0 ⊆ E := fun e he => he.1.1 + have hsubH : H ⊆ ⋃₀ E := union_subset hbd (sUnion_subset_sUnion fun e he => (hM he).1) + have hW : ∀ e ∈ W0, e ∩ H ⊆ V := fun e he => inter_partG_subset hg hB hbd' hM he.1 he.2 + have hint : ∀ {e z}, e ∈ W0 → z ∈ e → z ∉ H → z ∈ discInt B := fun he hz hzH => + ⟨he.1.2.1 hz, fun h => hzH (.inl h)⟩ + have hclosedE : ∀ D : Set (Set X), D ⊆ E → IsClosed (⋃₀ D) := fun D hD => + (hg.fine.subset hD).isClosed_sUnion fun e he => by + obtain ⟨u, v, -, hl, -⟩ := hg.edge e (hD he) + exact hl.isCompact.isClosed + have hHcl : IsClosed H := hB.isOArc_discBd.isCompact.isClosed.union (hclosedE M fun e he => + (hM he).1) + obtain ⟨c, hc, -⟩ : ∃ c ∈ discBd B, True := by + obtain ⟨φ⟩ := id hB.isOArc_discBd + exact ⟨_, (φ 1).2, trivial⟩ + have hin : ∀ {e z}, e ∈ W0 → z ∈ e → z ∉ H → ∀ f ∈ E, z ∈ f → f ∈ W0 := fun he hz hzH f hf hzf => + ⟨mem_innerEdges hman hg hB hbd' hf hzf (hint he hz hzH), fun h => hzH (.inr ⟨f, h, hzf⟩)⟩ + -- an edge that touches what we have + have hstart : ∃ e ∈ W0, (e ∩ H).Nonempty := by + by_contra hcon + push Not at hcon + obtain ⟨e0, he0⟩ : W0.Nonempty := by + obtain ⟨e, he, he'⟩ := not_subset.mp hne + exact ⟨e, he, he'⟩ + obtain ⟨u, v, -, hl, -⟩ := hg.edge e0 (hWE he0) + obtain ⟨c', hc', hcc⟩ := hB.isOArc_discBd.exists_ne c + refine hG.no_cut (A := ⋃₀ W0) (C := H ∪ ⋃₀ (E \ W0)) (p := c) (hclosedE _ hWE) + (hHcl.union (hclosedE _ sdiff_subset)) ?_ (sUnion_subset_sUnion hWE) + (union_subset hsubH (sUnion_subset_sUnion sdiff_subset)) ?_ (x := u) ⟨e0, he0, hl.left_mem⟩ ?_ + (y := c') (.inl (.inl hc')) hcc + · rintro z ⟨f, hf, hz⟩ + by_cases hfW : f ∈ W0 + · exact .inl ⟨f, hfW, hz⟩ + · exact .inr (.inr ⟨f, ⟨hf, hfW⟩, hz⟩) + · rintro z ⟨⟨e, he, hz⟩, hz' | ⟨f, hf, hzf⟩⟩ + · exact absurd hz' (Set.eq_empty_iff_forall_notMem.mp (hcon e he) z |> fun h h' => h ⟨hz, h'⟩) + · have hzH : z ∉ H := fun h' => Set.eq_empty_iff_forall_notMem.mp (hcon e he) z ⟨hz, h'⟩ + exact absurd (hin he hz hzH f hf.1 hzf) hf.2 + · rintro rfl + exact Set.eq_empty_iff_forall_notMem.mp (hcon e0 he0) u ⟨hl.left_mem, .inl hc⟩ + have hat : ∀ f ∈ E, ∀ x ∈ f, x ∈ V → ∃ o, o ≠ x ∧ f ∩ V = {x, o} ∧ IsLineWithEnds f x o + := fun f hf x hxf hxV => by + obtain ⟨u, v, huv, hl, hi⟩ := hg.edge f hf + have h1 : x ∈ f ∩ V := ⟨hxf, hxV⟩ + rw [hi] at h1 + rcases h1 with rfl | rfl + · exact ⟨v, huv.symm, hi, hl⟩ + · exact ⟨u, huv, by rw [hi, pair_comm], hl.symm⟩ + obtain ⟨e0, he0, p, hpe, hpH⟩ := hstart + have hpV : p ∈ V := hW e0 he0 ⟨hpe, hpH⟩ + obtain ⟨w, hwp, hi0, hl0⟩ := hat e0 (hWE he0) p hpe hpV + have hwV : w ∈ V := by + have : w ∈ e0 ∩ V := hi0 ▸ mem_insert_of_mem _ rfl + exact this.2 + by_cases hwH : w ∈ H + · refine ⟨{e0}, p, w, singleton_subset_iff.mpr he0, singleton_nonempty _, hwp.symm, hpV, hwV, + by simpa using hl0, ?_⟩ + rw [sUnion_singleton] + ext z + constructor + · rintro ⟨h1, h2⟩ + have h3 : z ∈ e0 ∩ V := ⟨h1, hW e0 he0 ⟨h1, h2⟩⟩ + rwa [hi0] at h3 + · rintro (rfl | rfl) + · exact ⟨hpe, hpH⟩ + · exact ⟨hl0.right_mem, hwH⟩ + have hp0 : EarPath p W0 H V {e0} w := .one he0 hi0 hl0 hwp hwH + by_cases hear : ∃ (A : Set (Set X)) (x : X) (f : Set X) (y : X), EarPath p W0 H V A x ∧ f ∈ W0 + ∧ f ∩ V = {x, y} ∧ + IsLineWithEnds f x y ∧ y ≠ x ∧ y ∈ H ∧ y ≠ p + · obtain ⟨A, x, f, y, hA, hf, hi, hl, hne', hyH, hyp⟩ := hear + obtain ⟨h1, h2, h3, h4, h5, h6, h7⟩ := hA.facts hWE hg hpH hW + have hyV : y ∈ V := by + have : y ∈ f ∩ V := hi ▸ mem_insert_of_mem _ rfl + exact this.2 + have hyA : y ∉ ⋃₀ A := fun hc' => hyp (by + have : y ∈ (⋃₀ A) ∩ H := ⟨hc', hyH⟩ + rwa [h7] at this) + have hfA : f ∉ A := fun hc' => hyA ⟨f, hc', hl.right_mem⟩ + have hsU : ⋃₀ (insert f A) = ⋃₀ A ∪ f := by rw [sUnion_insert, union_comm] + refine ⟨insert f A, p, y, insert_subset hf h1, insert_nonempty _ _, hyp.symm, hpV, hyV, ?_, ?_⟩ + · rw [hsU] + refine h6.union hl ?_ + ext z + constructor + · rintro ⟨⟨g, hgA, hzg⟩, hzf⟩ + have hgf : g ≠ f := fun he => hfA (he ▸ hgA) + have hzV := hg.disj g (hWE (h1 hgA)) f (hWE hf) hgf ⟨hzg, hzf⟩ + have : z ∈ f ∩ V := ⟨hzf, hzV⟩ + rw [hi] at this + rcases this with rfl | rfl + · rfl + · exact absurd ⟨g, hgA, hzg⟩ hyA + · rintro rfl + exact ⟨h6.right_mem, hl.left_mem⟩ + · rw [hsU] + ext z + constructor + · rintro ⟨h8 | h8, h9⟩ + · have : z ∈ (⋃₀ A) ∩ H := ⟨h8, h9⟩ + rw [h7] at this + exact .inl this + · have : z ∈ f ∩ V := ⟨h8, hW f hf ⟨h8, h9⟩⟩ + rw [hi] at this + rcases this with rfl | rfl + · exact absurd h9 h5 + · exact .inr rfl + · rintro (rfl | rfl) + · exact ⟨.inl h6.left_mem, hpH⟩ + · exact ⟨.inr hl.right_mem, hyH⟩ + push Not at hear + exfalso + have hstep : ∀ x f o A, EarPath p W0 H V A x → f ∈ W0 → f ∩ V = {x, o} → IsLineWithEnds f x o + → o ≠ x → + o = p ∨ ∃ A', EarPath p W0 H V A' o := by + intro x f o A hA hf hi hl hox + have hoV : o ∈ V := by + have : o ∈ f ∩ V := hi ▸ mem_insert_of_mem _ rfl + exact this.2 + by_cases hoH : o ∈ H + · exact .inl (hear A x f o hA hf hi hl hox hoH) + · have hop : o ≠ p := fun he => hoH (he ▸ hpH) + by_cases hoA : o ∈ ⋃₀ A + · exact .inr (hA.reach hoV hoA hop) + · exact .inr ⟨_, .step hA hf hi hl hox hoH hoA⟩ + let WR : Set (Set X) := {f ∈ W0 | ∃ x ∈ f, ∃ A, EarPath p W0 H V A x} + have hWRE : WR ⊆ E := fun f hf => hWE hf.1 + obtain ⟨c', hc', hcc⟩ := hB.isOArc_discBd.exists_ne p + refine hG.no_cut (A := ⋃₀ WR) (C := H ∪ ⋃₀ (E \ WR)) (p := p) (hclosedE _ hWRE) + (hHcl.union (hclosedE _ sdiff_subset)) ?_ (sUnion_subset_sUnion hWRE) + (union_subset hsubH (sUnion_subset_sUnion sdiff_subset)) ?_ (x := w) + ⟨e0, ⟨he0, w, hl0.right_mem, _, hp0⟩, hl0.right_mem⟩ hwp (y := c') (.inl (.inl hc')) hcc + · rintro z ⟨f, hf, hz⟩ + by_cases hfW : f ∈ WR + · exact .inl ⟨f, hfW, hz⟩ + · exact .inr (.inr ⟨f, ⟨hf, hfW⟩, hz⟩) + · rintro z ⟨⟨e, ⟨heW, x, hxe, A, hA⟩, hz⟩, hz'⟩ + obtain ⟨-, -, hxV, -, hxH, -, -⟩ := hA.facts hWE hg hpH hW + obtain ⟨o, hox, hi, hl⟩ := hat e (hWE heW) x hxe hxV + have hor := hstep x e o A hA heW hi hl hox + have hzcase : ∀ y, y ∈ e → (∃ A', EarPath p W0 H V A' y) → y = z → y ∈ ({p} : Set X) := by + rintro y hye ⟨A', hA'⟩ rfl + obtain ⟨-, -, -, -, hyH, -, -⟩ := hA'.facts hWE hg hpH hW + exfalso + rcases hz' with h1 | ⟨f, hf, hzf⟩ + · exact hyH h1 + · exact hf.2 ⟨hin heW hye hyH f hf.1 hzf, y, hzf, _, hA'⟩ + have hzV : z ∈ V := by + rcases hz' with h1 | ⟨f, hf, hzf⟩ + · exact hW e heW ⟨hz, h1⟩ + · exact hg.disj e (hWE heW) f hf.1 (fun he => hf.2 (he ▸ ⟨heW, x, hxe, A, hA⟩)) ⟨hz, hzf⟩ + have h1 : z ∈ e ∩ V := ⟨hz, hzV⟩ + rw [hi] at h1 + rcases h1 with rfl | rfl + · exact hzcase _ hz ⟨A, hA⟩ rfl + · rcases hor with rfl | h2 + · rfl + · exact hzcase _ hz h2 rfl + +/-- `𝓒` cuts the disc `B` into closed discs along `H`. -/ +structure IsCells (V B H : Set X) (𝓒 : Set (Set X)) : Prop where + fin : 𝓒.Finite + disc : ∀ Φ ∈ 𝓒, IsClosedDisc Φ + sub : ∀ Φ ∈ 𝓒, Φ ⊆ B + bd : ∀ Φ ∈ 𝓒, discBd Φ ⊆ H + int : ∀ Φ ∈ 𝓒, Disjoint (discInt Φ) H + cover : ⋃₀ 𝓒 = B + disj : ∀ Φ ∈ 𝓒, ∀ Φ' ∈ 𝓒, Φ ≠ Φ' → Disjoint (discInt Φ) Φ' + count : ∀ x ∉ V, {Φ ∈ 𝓒 | x ∈ Φ}.encard ≤ 2 + +theorem IsCells.split (hman : ∀ x : X, IsManifoldPoint x) {B H : Set X} {𝓒 : Set (Set X)} + (h : IsCells V B H 𝓒) + {A : Set X} {p q : X} (hpq : p ≠ q) (hl : IsLineWithEnds A p q) (hp : p ∈ V) (hq : q ∈ V) + (hAB : A ⊆ B) + (hA : A ∩ H = {p, q}) : ∃ 𝓒', IsCells V B (H ∪ A) 𝓒' := by + classical + have hpA : p ∈ A := hl.left_mem + have hqA : q ∈ A := hl.right_mem + have hA0 : (A \ {p, q}) ∩ H = ∅ := by + ext z + constructor + · rintro ⟨⟨h1, h2⟩, h3⟩ + exact absurd (hA ▸ (⟨h1, h3⟩ : z ∈ A ∩ H)) h2 + · simp + have hdj : Disjoint (A \ {p, q}) H := Set.disjoint_iff_inter_eq_empty.mpr hA0 + have hne : (A \ {p, q}).Nonempty := by + by_contra hc + rw [not_nonempty_iff_eq_empty] at hc + have h1 := hl.subset_closure_diff + rw [hc, closure_empty] at h1 + exact h1 hpA + obtain ⟨z, hz⟩ := hne + have hzB : z ∈ ⋃₀ 𝓒 := h.cover ▸ hAB hz.1 + obtain ⟨Φ, hΦ, hzΦ⟩ := hzB + have hdΦ := h.disc Φ hΦ + have hside : A \ {p, q} ⊆ discInt Φ := by + rcases hdΦ.side hman hl.isPreconnected_diff (hdj.mono_right (h.bd Φ hΦ)) with h1 | h1 + · exact h1 + · exact absurd hzΦ (Set.disjoint_left.mp h1 hz) + have hAΦ : A ⊆ Φ := hl.subset_closure_diff.trans + (closure_minimal (hside.trans (discInt_subset Φ)) hdΦ.isClosed) + have hH : ∀ {y}, y ∈ A ∩ H → y ∈ discBd Φ := fun {y} hy => by + by_contra hc + exact Set.disjoint_left.mp (h.int Φ hΦ) (⟨hAΦ hy.1, hc⟩ : y ∈ discInt Φ) hy.2 + have hmemp : p ∈ A ∩ H := hA ▸ mem_insert _ _ + have hmemq : q ∈ A ∩ H := hA ▸ mem_insert_of_mem _ rfl + have hAbd : A ∩ discBd Φ = {p, q} := by + ext y + constructor + · rintro ⟨h1, h2⟩ + by_contra hc + exact (hside ⟨h1, hc⟩).2 h2 + · rintro (rfl | rfl) + · exact ⟨hpA, hH hmemp⟩ + · exact ⟨hqA, hH hmemq⟩ + obtain ⟨A₁, A₂, Δ₁, Δ₂, -, hc, hd1, hd2, hun, hin, hb1, hb2, -⟩ := disc_iArc.{u} Φ A p q hdΦ hAΦ + hpq hl hAbd + have hA1 : A₁ ⊆ discBd Φ := by + have : A₁ ∈ componentsIn (discBd Φ \ {p, q}) := hc ▸ mem_insert _ _ + obtain ⟨y, hy, rfl⟩ := this + exact (connectedComponentIn_subset _ _).trans sdiff_subset + have hA2 : A₂ ⊆ discBd Φ := by + have : A₂ ∈ componentsIn (discBd Φ \ {p, q}) := hc ▸ mem_insert_of_mem _ rfl + obtain ⟨y, hy, rfl⟩ := this + exact (connectedComponentIn_subset _ _).trans sdiff_subset + have h1Φ : Δ₁ ⊆ Φ := hun ▸ subset_union_left + have h2Φ : Δ₂ ⊆ Φ := hun ▸ subset_union_right + have hi1 : discInt Δ₁ ⊆ discInt Φ := discInt_mono hman hd1 h1Φ + have hi2 : discInt Δ₂ ⊆ discInt Φ := discInt_mono hman hd2 h2Φ + have hI1 : Disjoint (discInt Δ₁) A := Set.disjoint_left.mpr fun y hy hy' => hy.2 (hb1 ▸ .inr hy') + have hI2 : Disjoint (discInt Δ₂) A := Set.disjoint_left.mpr fun y hy hy' => hy.2 (hb2 ▸ .inr hy') + have hHΦ : discBd Φ ⊆ H := h.bd Φ hΦ + have hIH : Disjoint (discInt Φ) H := h.int Φ hΦ + have holdne : ∀ Ψ ∈ 𝓒 \ {Φ}, Φ ≠ Ψ := fun Ψ hΨ he => hΨ.2 he.symm + refine ⟨insert Δ₁ (insert Δ₂ (𝓒 \ {Φ})), ⟨((h.fin.sdiff).insert _).insert _, ?_, ?_, ?_, ?_, ?_, + ?_, ?_⟩⟩ + · rintro Ψ (rfl | rfl | hΨ) + · exact hd1 + · exact hd2 + · exact h.disc Ψ hΨ.1 + · rintro Ψ (rfl | rfl | hΨ) + · exact h1Φ.trans (h.sub Φ hΦ) + · exact h2Φ.trans (h.sub Φ hΦ) + · exact h.sub Ψ hΨ.1 + · rintro Ψ (rfl | rfl | hΨ) + · rw [hb1] + exact union_subset_union_left _ (hA1.trans hHΦ) + · rw [hb2] + exact union_subset_union_left _ (hA2.trans hHΦ) + · exact (h.bd Ψ hΨ.1).trans subset_union_left + · rintro Ψ (rfl | rfl | hΨ) + · exact Set.disjoint_union_right.mpr ⟨hIH.mono_left hi1, hI1⟩ + · exact Set.disjoint_union_right.mpr ⟨hIH.mono_left hi2, hI2⟩ + · exact Set.disjoint_union_right.mpr ⟨h.int Ψ hΨ.1, + (h.disj Ψ hΨ.1 Φ hΦ (holdne Ψ hΨ).symm).mono_right hAΦ⟩ + · ext y + constructor + · rintro ⟨Ψ, rfl | rfl | hΨ, hy⟩ + · exact h.cover ▸ ⟨Φ, hΦ, h1Φ hy⟩ + · exact h.cover ▸ ⟨Φ, hΦ, h2Φ hy⟩ + · exact h.cover ▸ ⟨Ψ, hΨ.1, hy⟩ + · intro hy + rw [← h.cover] at hy + obtain ⟨Ψ, hΨ, hyΨ⟩ := hy + by_cases hΨΦ : Ψ = Φ + · subst hΨΦ + rw [← hun] at hyΨ + rcases hyΨ with h3 | h3 + · exact ⟨Δ₁, .inl rfl, h3⟩ + · exact ⟨Δ₂, .inr (.inl rfl), h3⟩ + · exact ⟨Ψ, .inr (.inr ⟨hΨ, hΨΦ⟩), hyΨ⟩ + · have h12 : Disjoint (discInt Δ₁) Δ₂ := Set.disjoint_left.mpr fun y hy hy' => + Set.disjoint_left.mp hI1 hy (hin ▸ (⟨hy.1, hy'⟩ : y ∈ Δ₁ ∩ Δ₂)) + have h21 : Disjoint (discInt Δ₂) Δ₁ := Set.disjoint_left.mpr fun y hy hy' => + Set.disjoint_left.mp hI2 hy (hin ▸ (⟨hy', hy.1⟩ : y ∈ Δ₁ ∩ Δ₂)) + rintro Ψ (rfl | rfl | hΨ) Ψ' (rfl | rfl | hΨ') hne + · exact absurd rfl hne + · exact h12 + · exact (h.disj Φ hΦ Ψ' hΨ'.1 (holdne Ψ' hΨ')).mono_left hi1 + · exact h21 + · exact absurd rfl hne + · exact (h.disj Φ hΦ Ψ' hΨ'.1 (holdne Ψ' hΨ')).mono_left hi2 + · exact (h.disj Ψ hΨ.1 Φ hΦ (holdne Ψ hΨ).symm).mono_right h1Φ + · exact (h.disj Ψ hΨ.1 Φ hΦ (holdne Ψ hΨ).symm).mono_right h2Φ + · exact h.disj Ψ hΨ.1 Ψ' hΨ'.1 hne + · intro x hxV + by_cases hxA : x ∈ A + · have hxi : x ∈ discInt Φ := hside ⟨hxA, by + rintro (rfl | rfl) + · exact hxV hp + · exact hxV hq⟩ + have hsub : {Ψ ∈ insert Δ₁ (insert Δ₂ (𝓒 \ {Φ})) | x ∈ Ψ} ⊆ {Δ₁, Δ₂} := by + rintro Ψ ⟨rfl | rfl | hΨ, hx⟩ + · exact .inl rfl + · exact .inr rfl + · exact absurd hx (Set.disjoint_left.mp (h.disj Φ hΦ Ψ hΨ.1 (holdne Ψ hΨ)) hxi) + refine (encard_le_encard hsub).trans ((encard_insert_le _ _).trans ?_) + rw [encard_singleton] + norm_num + · let σ : Set X → Set X := fun Ψ => if Ψ = Φ then (if x ∈ Δ₁ then Δ₁ else Δ₂) else Ψ + have hsub : {Ψ ∈ insert Δ₁ (insert Δ₂ (𝓒 \ {Φ})) | x ∈ Ψ} ⊆ σ '' {Ψ ∈ 𝓒 | x ∈ Ψ} := by + rintro Ψ ⟨hm, hx⟩ + rcases hm with e | e | hΨ + · rw [e] at hx ⊢ + exact ⟨Φ, ⟨hΦ, h1Φ hx⟩, by simp [σ, hx]⟩ + · rw [e] at hx ⊢ + have hn1 : x ∉ Δ₁ := fun h3 => hxA (hin ▸ (⟨h3, hx⟩ : x ∈ Δ₁ ∩ Δ₂)) + exact ⟨Φ, ⟨hΦ, h2Φ hx⟩, by simp [σ, hn1]⟩ + · have hne' : Ψ ≠ Φ := hΨ.2 + exact ⟨Ψ, ⟨hΨ.1, hx⟩, by simp [σ, hne']⟩ + exact (encard_le_encard hsub).trans (encard_image_le _ _ |>.trans (h.count x hxV)) + +theorem exists_cells_aux (hman : ∀ x : X, IsManifoldPoint x) (hg : IsGraph V E) (hG : TwoConn + (⋃₀ E)) {B : Set X} + (hB : IsClosedDisc B) (hbd : discBd B ⊆ ⋃₀ E) (hbd' : discBd B ⊆ gr V E) (n : ℕ) : + ∀ (M : Set (Set X)) (𝓒 : Set (Set X)), M ⊆ innerEdges E B → (innerEdges E B \ M).ncard = n → + IsCells V B (partG B M) 𝓒 → ∃ 𝓒', IsCells V B (partG B (innerEdges E B)) 𝓒' := by + induction n using Nat.strong_induction_on with + | _ n ih => + intro M 𝓒 hM hn hc + by_cases hne : innerEdges E B ⊆ M + · have e := subset_antisymm hne hM + rw [← e] at hc + exact ⟨𝓒, hc⟩ + obtain ⟨W, a, b, hW, hWne, hab, ha, hb, hl, hi⟩ := exists_ear hman hg hG hB hbd hbd' hM hne + have hfin : (innerEdges E B).Finite := hg.fine.subset fun e he => he.1 + have hWB : ⋃₀ W ⊆ B := sUnion_subset fun e he => (hW he).1.2.1 + obtain ⟨𝓒', hc'⟩ := hc.split hman hab hl ha hb hWB hi + have hpart : partG B M ∪ ⋃₀ W = partG B (M ∪ W) := by + simp only [partG, sUnion_union, union_assoc] + rw [hpart] at hc' + refine ih _ ?_ (M ∪ W) 𝓒' (union_subset hM fun e he => (hW he).1) rfl hc' + rw [← hn] + refine ncard_lt_ncard ?_ (hfin.subset sdiff_subset) + obtain ⟨e, he⟩ := hWne + refine ⟨fun f hf => ⟨hf.1, fun h3 => hf.2 (.inl h3)⟩, fun hc2 => ?_⟩ + have := hc2 (hW he) + exact this.2 (.inr he) + +/-- A chart disc is cut into closed discs along a graph that stays connected when a point is +removed. -/ +theorem exists_cells (hman : ∀ x : X, IsManifoldPoint x) (hg : IsGraph V E) (hG : TwoConn + (⋃₀ E)) {B : Set X} + (hB : IsClosedDisc B) (hbd : discBd B ⊆ ⋃₀ E) (hbd' : discBd B ⊆ gr V E) : + ∃ 𝓒, IsCells V B (⋃₀ E) 𝓒 := by + have hpe : partG B (∅ : Set (Set X)) = discBd B := by simp [partG] + have hstart : IsCells V B (partG B ∅) {B} := by + rw [hpe] + refine ⟨finite_singleton _, ?_, ?_, ?_, ?_, sUnion_singleton _, ?_, fun x _ => ?_⟩ + · rintro _ rfl + exact hB + · rintro _ rfl + exact subset_rfl + · rintro _ rfl + exact subset_rfl + · rintro _ rfl + exact Set.disjoint_left.mpr fun y hy => hy.2 + · rintro _ rfl _ rfl hne + exact absurd rfl hne + · refine (encard_le_encard (sep_subset _ _)).trans ?_ + rw [encard_singleton] + norm_num + obtain ⟨𝓒, hc⟩ := exists_cells_aux hman hg hG hB hbd hbd' _ ∅ {B} (empty_subset _) rfl hstart + refine ⟨𝓒, hc.fin, hc.disc, hc.sub, fun Φ hΦ => (hc.bd Φ hΦ).trans + (union_subset hbd (sUnion_subset_sUnion fun e he => he.1)), fun Φ hΦ + => ?_, hc.cover, hc.disj, hc.count⟩ + rw [Set.disjoint_left] + rintro z hz ⟨e, he, hze⟩ + have hzB : z ∈ B := hc.sub Φ hΦ hz.1 + have hnH : z ∉ partG B (innerEdges E B) := Set.disjoint_left.mp (hc.int Φ hΦ) hz + have hzi : z ∈ discInt B := ⟨hzB, fun h3 => hnH (.inl h3)⟩ + exact hnH (.inr ⟨e, mem_innerEdges hman hg hB hbd' he hze hzi, hze⟩) + +end + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Circle.lean b/LeanPool/GraphMinor/Surface/Circle.lean new file mode 100644 index 0000000000..512aa70429 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Circle.lean @@ -0,0 +1,903 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# Topological Circle, Circular Order, and Crossing Pairs + +This file establishes the topological and combinatorial properties of the unit circle `Circle` +and of points ordered around a circle that are used in Graph Minors VI, Section 2–5: +- Open arcs on `Circle` (`Circle.openArc`) and the decomposition of `Circle \ {x, y}` for $x \ne y$ + into two disjoint open path-connected arcs (via `Circle.path` from + `Mathlib.Analysis.SpecialFunctions.Complex.Circle`). +- Circular coordinate embeddings `CircleCoord` (with the canonical instance on `Circle` given by + `Complex.arg : Circle → ℝ`), the betweenness relation `onOpenArc`, and the crossing relation + `circleCrosses` ("$\{a, c\}$ crosses $\{b, d\}$", Graph Minors VI, Section 2, page 117). +- Symmetry, disjointness, non-crossing equivalence transitivity, and the four-point crossing + lemma used in Graph Minors VI, (2.1)–(2.4). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Function Complex Real Topology + +universe u + +/-- An `O`-arc contains infinitely many points. -/ +theorem IsOArc.infinite {S : Type u} [TopologicalSpace S] {F : Set S} (hF : IsOArc F) : + F.Infinite := by + obtain ⟨f⟩ := hF + have hinj : InjOn (fun t => (f (Circle.exp t)).1) (Ico (0 : ℝ) (2 * Real.pi)) := by + intro s hs t ht h + exact Circle.exp_injOn_Ico (by simp) hs ht (f.injective (Subtype.ext h)) + refine ((Set.Ico_infinite Real.two_pi_pos).image hinj).mono ?_ + rintro _ ⟨t, _, rfl⟩ + exact (f (Circle.exp t)).2 + +/-- Removing one point from an `O`-arc leaves a path-connected set. -/ +theorem IsOArc.isPathConnected_sdiff_singleton {S : Type u} [TopologicalSpace S] {F : Set S} + (hF : IsOArc F) {u : S} (hu : u ∈ F) : IsPathConnected (F \ {u}) := by + obtain ⟨f⟩ := hF + let c : Circle := f.symm ⟨u, hu⟩ + have hEq : F \ {u} = (fun z => (f z).1) '' ({c}ᶜ : Set Circle) := by + ext x + constructor + · rintro ⟨hxF, hx⟩ + refine ⟨f.symm ⟨x, hxF⟩, ?_, by simp⟩ + intro h + have h2 : f.symm ⟨x, hxF⟩ = f.symm ⟨u, hu⟩ := h + have := f.symm.injective h2 + exact hx (congrArg Subtype.val this) + · rintro ⟨z, hz, rfl⟩ + refine ⟨(f z).2, fun h => hz ?_⟩ + have : f z = ⟨u, hu⟩ := Subtype.ext h + simp [c, ← this] + rw [hEq] + exact (Circle.isPathConnected_compl_singleton c).image + (continuous_subtype_val.comp f.continuous) + +/-! ## 1. Open Arcs on `Circle` -/ + +/-- The open counterclockwise arc on `Circle` from $x$ to $y$, defined as the image of $(0, 1)$ +under `Circle.path x y`. +Route: `Circle.path` in `Mathlib.Analysis.SpecialFunctions.Complex.Circle`. -/ +noncomputable def circleOpenArc (x y : Circle) : Set Circle := + Circle.path x y '' Ioo 0 1 + +/-- For $x \ne y$ on `Circle`, the two open arcs `circleOpenArc x y` and `circleOpenArc y x` are +disjoint. +Route: `Circle.disjoint_path_image_Ioc` from Mathlib. -/ +theorem disjoint_circleOpenArc {x y : Circle} (h : x ≠ y) : + Disjoint (circleOpenArc x y) (circleOpenArc y x) := by + refine (Circle.disjoint_path_image_Ioc h).mono ?_ ?_ <;> + exact image_mono Ioo_subset_Ioc_self + +/-- For $x \ne y$ on `Circle`, the complement of the closed arc `range (Circle.path x y)` is +the reverse open arc `circleOpenArc y x`. +Route: `Circle.compl_range_path` from Mathlib. -/ +theorem compl_range_circlePath {x y : Circle} (h : x ≠ y) : + (range (Circle.path x y))ᶜ = circleOpenArc y x := + Circle.compl_range_path h + +/-- For $x \ne y$ on `Circle`, `circleOpenArc x y` is open in `Circle`. +Route: its complement is the compact (hence closed) set `range (Circle.path y x)`. -/ +theorem isOpen_circleOpenArc {x y : Circle} (h : x ≠ y) : + IsOpen (circleOpenArc x y) := by + rw [← compl_range_circlePath h.symm, isOpen_compl_iff] + exact (isCompact_range (Circle.path y x).continuous).isClosed + +/-- For $x \ne y$ on `Circle`, `circleOpenArc x y` is nonempty. -/ +theorem nonempty_circleOpenArc {x y : Circle} (h : x ≠ y) : + (circleOpenArc x y).Nonempty := by + rw [← compl_range_circlePath h.symm, nonempty_compl] + exact (Circle.range_path_ssubset_univ y x).ne + +/-- For $x \ne y$ on `Circle`, `circleOpenArc x y` is path-connected. +Route: continuous image of the convex (hence path-connected) interval `Ioo (0 : unitInterval) 1`. -/ +theorem isPathConnected_circleOpenArc (x y : Circle) : + IsPathConnected (circleOpenArc x y) := by + have hIoo : (Ioo (0 : unitInterval) 1).Nonempty := by + refine ⟨⟨2⁻¹, by constructor <;> linarith⟩, ?_⟩ + simp only [mem_Ioo, ← unitInterval.coe_pos, ← unitInterval.coe_lt_one] + constructor <;> linarith + have hconv : Convex ℝ (Subtype.val '' (Ioo (0 : unitInterval) 1)) := by + have heq : Subtype.val '' (Ioo (0 : unitInterval) 1) = Ioo (0 : ℝ) 1 := by + ext r + simp only [mem_image, mem_Ioo, Subtype.exists] + exact ⟨fun ⟨a, ⟨h0, h1⟩, ⟨ha0, ha1⟩, hr⟩ => hr ▸ ⟨ha0, ha1⟩, + fun ⟨hr0, hr1⟩ => ⟨r, ⟨hr0.le, hr1.le⟩, ⟨hr0, hr1⟩, rfl⟩⟩ + rw [heq] + exact convex_Ioo 0 1 + have hpc : IsPathConnected (Ioo (0 : unitInterval) 1) := by + rw [IsInducing.subtypeVal.isPathConnected_iff] + exact hconv.isPathConnected (hIoo.image _) + exact hpc.image (Circle.path x y).continuous + +/-- For $x \ne y$ on `Circle`, `({x, y} : Set Circle)ᶜ` is the union of `circleOpenArc x y` and +`circleOpenArc y x`. +Route: `Circle.compl_range_path` and `Circle.range_path_inter_range_path` from Mathlib. -/ +theorem compl_pair_eq_union_circleOpenArc {x y : Circle} (h : x ≠ y) : + ({x, y} : Set Circle)ᶜ = circleOpenArc x y ∪ circleOpenArc y x := by + rw [← Circle.range_path_inter_range_path h, compl_inter, + compl_range_circlePath h, compl_range_circlePath h.symm, union_comm] + +/-! ## 2. Circular Coordinates and Crossing Pairs on a Circle -/ + +/-- A circular coordinate on a type $C$ is an injective map $\alpha \colon C \to \mathbb{R}$, +representing the angular order on $C \setminus \{c_0\}$ (or `Complex.arg` on `Circle`). -/ +structure CircleCoord (C : Type u) where + /-- The injective coordinate map into $\mathbb{R}$. -/ + angle : C → ℝ + /-- Distinct points of $C$ have distinct coordinates. -/ + injective : Injective angle + +/-- The canonical `CircleCoord` on `Circle` given by `Complex.arg : Circle → (-π, π]`. +Route: `Circle.injective_arg` from `Mathlib.Analysis.SpecialFunctions.Complex.Circle`. -/ +noncomputable def circleStdCoord : CircleCoord Circle where + angle z := arg (z : ℂ) + injective := Circle.injective_arg + +/-- Transfer a `CircleCoord` along an equivalence $e \colon C' \simeq C$. -/ +def CircleCoord.comap {C C' : Type*} (coord : CircleCoord C) (e : C' ≃ C) : CircleCoord C' where + angle x := coord.angle (e x) + injective := coord.injective.comp e.injective + +/-- Given a `CircleCoord` $\alpha$ on $C$, a point $x \in C$ lies on the open coordinate arc +between $a$ and $c$ if $\min(\alpha(a), \alpha(c)) < \alpha(x) < \max(\alpha(a), \alpha(c))$. -/ +def onOpenArc {C : Type u} (coord : CircleCoord C) (a c x : C) : Prop := + min (coord.angle a) (coord.angle c) < coord.angle x ∧ + coord.angle x < max (coord.angle a) (coord.angle c) + +noncomputable instance {C : Type u} (coord : CircleCoord C) (a c x : C) : + Decidable (onOpenArc coord a c x) := by + unfold onOpenArc + infer_instance + +theorem onOpenArc_comm {C : Type u} (coord : CircleCoord C) (a c x : C) : + onOpenArc coord a c x ↔ onOpenArc coord c a x := by + simp [onOpenArc, min_comm, max_comm] + +theorem not_onOpenArc_left {C : Type u} (coord : CircleCoord C) (a c : C) : + ¬ onOpenArc coord a c a := by + intro ⟨h1, h2⟩ + rcases le_total (coord.angle a) (coord.angle c) with hac | hca + · rw [min_eq_left hac] at h1 + exact lt_irrefl _ h1 + · rw [max_eq_left hca] at h2 + exact lt_irrefl _ h2 + +theorem not_onOpenArc_right {C : Type u} (coord : CircleCoord C) (a c : C) : + ¬ onOpenArc coord a c c := by + rw [onOpenArc_comm] + exact not_onOpenArc_left coord c a + +theorem not_onOpenArc_self {C : Type u} (coord : CircleCoord C) (a x : C) : + ¬ onOpenArc coord a a x := by + intro ⟨h1, h2⟩ + rw [min_self] at h1 + rw [max_self] at h2 + exact lt_irrefl _ (h1.trans h2) + +/-- Four points $a, b, c, d \in C$ satisfy '$\{a, c\}$ *crosses* $\{b, d\}$' if $a, b, c, d$ are +all distinct and $b, d$ lie in different components of $C \setminus \{a, c\}$ (one lies in the +open arc between $a$ and $c$, and the other lies outside). +Graph Minors VI, Section 2 (page 117): "If $a, b, c, d$ are distinct points of $C$ occurring in +that order, we say that $\{a, c\}$ *crosses* $\{b, d\}$." -/ +def circleCrosses {C : Type u} (coord : CircleCoord C) (a c b d : C) : Prop := + a ≠ c ∧ b ≠ d ∧ a ≠ b ∧ a ≠ d ∧ c ≠ b ∧ c ≠ d ∧ + (onOpenArc coord a c b ↔ ¬ onOpenArc coord a c d) + +noncomputable instance {C : Type u} [DecidableEq C] (coord : CircleCoord C) (a c b d : C) : + Decidable (circleCrosses coord a c b d) := by + unfold circleCrosses + infer_instance + +theorem circleCrosses_symm_left {C : Type u} (coord : CircleCoord C) (a c b d : C) : + circleCrosses coord a c b d ↔ circleCrosses coord c a b d := by + simp only [circleCrosses, ne_comm (a := a) (b := c), onOpenArc_comm coord a c] + tauto + +theorem circleCrosses_symm_right {C : Type u} (coord : CircleCoord C) (a c b d : C) : + circleCrosses coord a c b d ↔ circleCrosses coord a c d b := by + simp only [circleCrosses, ne_comm (a := b) (b := d)] + constructor <;> rintro ⟨h1, h2, h3, h4, h5, h6, h7⟩ <;> + refine ⟨h1, h2, ?_, ?_, ?_, ?_, ?_⟩ <;> tauto + +private lemma onOpenArc_iff_lt {C : Type u} (coord : CircleCoord C) {a c x : C} : + onOpenArc coord a c x ↔ + (coord.angle a < coord.angle x ∧ coord.angle x < coord.angle c) ∨ + (coord.angle c < coord.angle x ∧ coord.angle x < coord.angle a) := by + unfold onOpenArc + rcases le_total (coord.angle a) (coord.angle c) with hac | hca + · rw [min_eq_left hac, max_eq_right hac] + constructor + · intro ⟨h1, h2⟩; exact Or.inl ⟨h1, h2⟩ + · rintro (⟨h1, h2⟩ | ⟨h1, h2⟩) + · exact ⟨h1, h2⟩ + · exact absurd (h1.trans h2) (not_lt_of_ge hac) + · rw [min_eq_right hca, max_eq_left hca] + constructor + · intro ⟨h1, h2⟩; exact Or.inr ⟨h1, h2⟩ + · rintro (⟨h1, h2⟩ | ⟨h1, h2⟩) + · exact absurd (h1.trans h2) (not_lt_of_ge hca) + · exact ⟨h1, h2⟩ + +/-- Crossing on a circle is symmetric between the two pairs: $\{a, c\}$ crosses $\{b, d\}$ if and +only if $\{b, d\}$ crosses $\{a, c\}$. +Graph Minors VI, Section 2 (page 117). -/ +theorem circleCrosses_comm {C : Type u} (coord : CircleCoord C) (a c b d : C) : + circleCrosses coord a c b d ↔ circleCrosses coord b d a c := by + suffices ∀ a c b d : C, circleCrosses coord a c b d → circleCrosses coord b d a c by + exact ⟨this a c b d, this b d a c⟩ + intro a c b d ⟨hac, hbd, hab, had, hcb, hcd, hcross⟩ + refine ⟨hbd, hac, hab.symm, hcb.symm, had.symm, hcd.symm, ?_⟩ + have ha_ne_c : coord.angle a ≠ coord.angle c := coord.injective.ne hac + have hb_ne_d : coord.angle b ≠ coord.angle d := coord.injective.ne hbd + have ha_ne_b : coord.angle a ≠ coord.angle b := coord.injective.ne hab + have ha_ne_d : coord.angle a ≠ coord.angle d := coord.injective.ne had + have hc_ne_b : coord.angle c ≠ coord.angle b := coord.injective.ne hcb + have hc_ne_d : coord.angle c ≠ coord.angle d := coord.injective.ne hcd + simp only [onOpenArc_iff_lt] at hcross ⊢ + rcases lt_or_gt_of_ne ha_ne_c with hac' | hca' <;> + rcases lt_or_gt_of_ne hb_ne_d with hbd' | hdb' <;> + rcases lt_or_gt_of_ne ha_ne_b with hab' | hba' <;> + rcases lt_or_gt_of_ne ha_ne_d with had' | hda' <;> + rcases lt_or_gt_of_ne hc_ne_b with hcb' | hbc' <;> + rcases lt_or_gt_of_ne hc_ne_d with hcd' | hdc' <;> + grind + +/-- If $v_1, v_2$ are disjoint from $\{u_1, u_2, u_3\}$, and $\{v_1, v_2\}$ crosses neither +$\{u_1, u_2\}$ nor $\{u_2, u_3\}$, then $\{v_1, v_2\}$ does not cross $\{u_1, u_3\}$. +This is the transitivity of the equivalence relation defining $\Delta^*$ in Graph Minors VI, +Section 2 (page 117). -/ +theorem not_circleCrosses_trans {C : Type u} (coord : CircleCoord C) + {v₁ v₂ u₁ u₂ u₃ : C} + (hv₁u₂ : v₁ ≠ u₂) (hv₂u₂ : v₂ ≠ u₂) + (h12 : ¬ circleCrosses coord v₁ v₂ u₁ u₂) + (h23 : ¬ circleCrosses coord v₁ v₂ u₂ u₃) : + ¬ circleCrosses coord v₁ v₂ u₁ u₃ := by + intro ⟨hv, hu13, hv1u1, hv1u3, hv2u1, hv2u3, hcross13⟩ + rcases eq_or_ne u₁ u₂ with rfl | hu12 + · exact h23 ⟨hv, hu13, hv1u1, hv1u3, hv2u1, hv2u3, hcross13⟩ + rcases eq_or_ne u₂ u₃ with rfl | hu23 + · exact h12 ⟨hv, hu13, hv1u1, hv1u3, hv2u1, hv2u3, hcross13⟩ + have h12' : ¬ (onOpenArc coord v₁ v₂ u₁ ↔ ¬ onOpenArc coord v₁ v₂ u₂) := fun h => + h12 ⟨hv, hu12, hv1u1, hv₁u₂, hv2u1, hv₂u₂, h⟩ + have h23' : ¬ (onOpenArc coord v₁ v₂ u₂ ↔ ¬ onOpenArc coord v₁ v₂ u₃) := fun h => + h23 ⟨hv, hu23, hv₁u₂, hv1u3, hv₂u₂, hv2u3, h⟩ + tauto + +/-- Four-point crossing lemma on a circle: if $\{u_1, u_3\}$ crosses $\{u_2, u_4\}$ and +$\{v_1, v_2\}$ crosses $\{u_1, u_2\}$ with $\{v_1, v_2\} \cap \{u_1, u_2, u_3, u_4\} = \emptyset$, +then $\{v_1, v_2\}$ must cross either $\{u_1, u_3\}$ or $\{u_2, u_4\}$. +Graph Minors VI, Section 2, proof of (2.1) (page 117): "But $\{v_1, v_2\}$ crosses neither +$\{u_1, u_3\}$ nor $\{u_2, u_4\}$, and that is impossible." -/ +theorem four_point_circleCrosses {C : Type u} (coord : CircleCoord C) + {u₁ u₂ u₃ u₄ v₁ v₂ : C} + (hu : circleCrosses coord u₁ u₃ u₂ u₄) + (hv12 : circleCrosses coord v₁ v₂ u₁ u₂) + (hv1u3 : v₁ ≠ u₃) (hv2u3 : v₂ ≠ u₃) + (hv1u4 : v₁ ≠ u₄) (hv2u4 : v₂ ≠ u₄) : + circleCrosses coord v₁ v₂ u₁ u₃ ∨ circleCrosses coord v₁ v₂ u₂ u₄ := by + by_contra! h + rcases h with ⟨h13, h24⟩ + rcases hu with ⟨hu13, hu24, hu12, hu14, hu32, hu34, hucross⟩ + rcases hv12 with ⟨hv, _, hv1u1, hv1u2, hv2u1, hv2u2, hvcross12⟩ + have hnc13 : ¬ (onOpenArc coord v₁ v₂ u₁ ↔ ¬ onOpenArc coord v₁ v₂ u₃) := fun hc => + h13 ⟨hv, hu13, hv1u1, hv1u3, hv2u1, hv2u3, hc⟩ + have hnc24 : ¬ (onOpenArc coord v₁ v₂ u₂ ↔ ¬ onOpenArc coord v₁ v₂ u₄) := fun hc => + h24 ⟨hv, hu24, hv1u2, hv1u4, hv2u2, hv2u4, hc⟩ + have hsame13 : onOpenArc coord v₁ v₂ u₁ ↔ onOpenArc coord v₁ v₂ u₃ := by tauto + have hsame24 : onOpenArc coord v₁ v₂ u₂ ↔ onOpenArc coord v₁ v₂ u₄ := by tauto + simp only [onOpenArc_iff_lt] at hucross hvcross12 hsame13 hsame24 + have hv_ne : coord.angle v₁ ≠ coord.angle v₂ := coord.injective.ne hv + have hu1_ne_u3 : coord.angle u₁ ≠ coord.angle u₃ := coord.injective.ne hu13 + have hu2_ne_u4 : coord.angle u₂ ≠ coord.angle u₄ := coord.injective.ne hu24 + rcases lt_or_gt_of_ne hv_ne with hv' | hv' <;> + rcases lt_or_gt_of_ne hu1_ne_u3 with hu13' | hu31' <;> + rcases lt_or_gt_of_ne hu2_ne_u4 with hu24' | hu42' <;> + grind + +/-! ## 3. Topological Characterization of Circle Arcs and Crossing via `angleDiff` -/ + +/-- If $F = A \cup B$ is the union of two disjoint open preconnected subsets $A, B \subseteq X$, +then for every $z \in A$, the connected component of $F$ containing $z$ is $A$. +Route: $A$ is preconnected in $F$ and clopen in $F$. -/ +theorem connectedComponentIn_eq_left_of_union_disjoint_open {X : Type*} [TopologicalSpace X] + {A B : Set X} (hA_open : IsOpen A) (hB_open : IsOpen B) + (hdisj : Disjoint A B) (hA_conn : IsPreconnected A) {z : X} (hz : z ∈ A) : + connectedComponentIn (A ∪ B) z = A := by + apply Subset.antisymm + · have hcc_conn : IsPreconnected (connectedComponentIn (A ∪ B) z) := + isPreconnected_connectedComponentIn + have hcc_sub : connectedComponentIn (A ∪ B) z ⊆ A ∪ B := + connectedComponentIn_subset (A ∪ B) z + have hz_cc : z ∈ connectedComponentIn (A ∪ B) z := + mem_connectedComponentIn (Or.inl hz) + by_contra hnot + obtain ⟨w, hw_cc, hw_notA⟩ := not_subset.mp hnot + have hw_B : w ∈ B := (hcc_sub hw_cc).resolve_left hw_notA + rcases hcc_conn A B hA_open hB_open hcc_sub ⟨z, hz_cc, hz⟩ ⟨w, hw_cc, hw_B⟩ with + ⟨u, _, huA, huB⟩ + exact hdisj.ne_of_mem huA huB rfl + · exact hA_conn.subset_connectedComponentIn hz subset_union_left + +/-- For $x \ne y$ on `Circle` and $z \in \operatorname{circleOpenArc} x y$, the connected component +of `({x, y} : Set Circle)ᶜ` containing $z$ is `circleOpenArc x y`. -/ +theorem connectedComponentIn_compl_pair_eq_left {x y z : Circle} (hxy : x ≠ y) + (hz : z ∈ circleOpenArc x y) : + connectedComponentIn ({x, y} : Set Circle)ᶜ z = circleOpenArc x y := by + rw [compl_pair_eq_union_circleOpenArc hxy] + exact connectedComponentIn_eq_left_of_union_disjoint_open + (isOpen_circleOpenArc hxy) (isOpen_circleOpenArc hxy.symm) + (disjoint_circleOpenArc hxy) (isPathConnected_circleOpenArc x y).isConnected.isPreconnected hz + +/-- For $x \ne y$ on `Circle` and $z \in \operatorname{circleOpenArc} y x$, the connected component +of `({x, y} : Set Circle)ᶜ` containing $z$ is `circleOpenArc y x`. -/ +theorem connectedComponentIn_compl_pair_eq_right {x y z : Circle} (hxy : x ≠ y) + (hz : z ∈ circleOpenArc y x) : + connectedComponentIn ({x, y} : Set Circle)ᶜ z = circleOpenArc y x := by + have heq : ({x, y} : Set Circle) = {y, x} := pair_comm x y + rw [heq] + exact connectedComponentIn_compl_pair_eq_left hxy.symm hz + +/-- For any basepoint $c \in \text{Circle}$, `Circle.angleDiff c : Circle → [0, 2π)` is injective +and defines a circular coordinate `circleCoordFrom c`. +Route: `Circle.exp_angleDiff_mul`. -/ +noncomputable def circleCoordFrom (c : Circle) : CircleCoord Circle where + angle z := c.angleDiff z + injective z₁ z₂ h := by + have h1 := congrArg (fun θ => Circle.exp θ * c) h + simpa only [Circle.exp_angleDiff_mul] using h1 + +@[simp] +theorem circleCoordFrom_self (c : Circle) : (circleCoordFrom c).angle c = 0 := by + change c.angleDiff c = 0 + simp [Circle.angleDiff] + +theorem circleCoordFrom_pos {c z : Circle} (h : c ≠ z) : + 0 < (circleCoordFrom c).angle z := + Circle.angleDiff_pos h + +theorem circleCoordFrom_lt_two_pi (c z : Circle) : + (circleCoordFrom c).angle z < 2 * π := + Circle.angleDiff_lt_two_pi c z + +/-- A point $z \in \text{Circle}$ lies in the open counterclockwise arc `circleOpenArc x y` +($x \ne y$) if and only if $0 < x.\operatorname{angleDiff}(z) < x.\operatorname{angleDiff}(y)$. +Route: explicit affine parameter $t = x.\operatorname{angleDiff}(z) / x.\operatorname{angleDiff}(y)$ +along `Circle.path x y` combined with `disjoint_circleOpenArc`. -/ +theorem mem_circleOpenArc_iff_angleDiff {x y z : Circle} (hxy : x ≠ y) : + z ∈ circleOpenArc x y ↔ 0 < x.angleDiff z ∧ x.angleDiff z < x.angleDiff y := by + have haux : ∀ {a b w : Circle} (hab : a ≠ b), + 0 < a.angleDiff w → a.angleDiff w < a.angleDiff b → w ∈ circleOpenArc a b := by + intro a b w hab hpos hlt + have hab_pos : 0 < a.angleDiff b := Circle.angleDiff_pos hab + let t_real : ℝ := a.angleDiff w / a.angleDiff b + have ht0 : 0 < t_real := div_pos hpos hab_pos + have ht1 : t_real < 1 := (div_lt_one hab_pos).mpr hlt + let t : unitInterval := ⟨t_real, ht0.le, ht1.le⟩ + refine ⟨t, ⟨unitInterval.coe_pos.mp ht0, unitInterval.coe_lt_one.mp ht1⟩, ?_⟩ + rw [Circle.path_apply] + have hseg : Path.segment a.val.arg (a.angleDiff b + a.val.arg) t = + a.angleDiff w + a.val.arg := by + simp only [Path.segment, Path.coe_mk_mk, AffineMap.lineMap_apply, + vsub_eq_sub, smul_eq_mul, vadd_eq_add] + have hmul : (t : ℝ) * a.angleDiff b = a.angleDiff w := div_mul_cancel₀ _ hab_pos.ne' + linarith + rw [hseg, Circle.exp_add, Circle.exp_arg, Circle.exp_angleDiff_mul] + constructor + · intro hz + have hzx : x ≠ z := by + rintro rfl + have hnot : x ∉ circleOpenArc x y := by + rw [← compl_range_circlePath hxy.symm, mem_compl_iff, not_not] + exact (Circle.path y x).target_mem_range + exact hnot hz + have hzy : y ≠ z := by + rintro rfl + have hnot : y ∉ circleOpenArc x y := by + rw [← compl_range_circlePath hxy.symm, mem_compl_iff, not_not] + exact (Circle.path y x).source_mem_range + exact hnot hz + refine ⟨Circle.angleDiff_pos hzx, ?_⟩ + by_contra! hle + have hlt : x.angleDiff y < x.angleDiff z := + lt_of_le_of_ne hle ((circleCoordFrom x).injective.ne hzy) + have hyz_pos : 0 < y.angleDiff z := Circle.angleDiff_pos hzy + have hyz_lt : y.angleDiff z < y.angleDiff x := by + grind [Circle.angleDiff, Circle.arg_eq_arg, + Complex.neg_pi_lt_arg x.val, Complex.arg_le_pi x.val, + Complex.neg_pi_lt_arg y.val, Complex.arg_le_pi y.val, + Complex.neg_pi_lt_arg z.val, Complex.arg_le_pi z.val] + have hz_yx : z ∈ circleOpenArc y x := haux hxy.symm hyz_pos hyz_lt + exact (disjoint_circleOpenArc hxy).ne_of_mem hz hz_yx rfl + · rintro ⟨hpos, hlt⟩ + exact haux hxy hpos hlt + +theorem onOpenArc_circleStdCoord_iff_angleDiff {a c b : Circle} + (hab : a ≠ b) (hcb : c ≠ b) : + onOpenArc circleStdCoord a c b ↔ + (if a.val.arg ≤ c.val.arg then a.angleDiff b < a.angleDiff c + else a.angleDiff c < a.angleDiff b) := by + rw [onOpenArc_iff_lt] + dsimp only [circleStdCoord] + grind [Circle.angleDiff, Circle.arg_eq_arg, + Complex.neg_pi_lt_arg a.val, Complex.arg_le_pi a.val, + Complex.neg_pi_lt_arg c.val, Complex.arg_le_pi c.val, + Complex.neg_pi_lt_arg b.val, Complex.arg_le_pi b.val] + +theorem angleDiff_eq_of_angleDiff {x a b : Circle} : + a.angleDiff b = + if x.angleDiff a ≤ x.angleDiff b then x.angleDiff b - x.angleDiff a + else 2 * Real.pi + x.angleDiff b - x.angleDiff a := by + grind [Circle.angleDiff, Circle.arg_eq_arg, + Complex.neg_pi_lt_arg x.val, Complex.arg_le_pi x.val, + Complex.neg_pi_lt_arg a.val, Complex.arg_le_pi a.val, + Complex.neg_pi_lt_arg b.val, Complex.arg_le_pi b.val] + +theorem onOpenArc_circleCoordFrom_iff_angleDiff {x a c b : Circle} + (hac : a ≠ c) (hab : a ≠ b) (hcb : c ≠ b) : + onOpenArc (circleCoordFrom x) a c b ↔ + (if x.angleDiff a ≤ x.angleDiff c then a.angleDiff b < a.angleDiff c + else a.angleDiff c < a.angleDiff b) := by + rw [onOpenArc_iff_lt] + dsimp only [circleCoordFrom] + have hab_eq := angleDiff_eq_of_angleDiff (x := x) (a := a) (b := b) + have hac_eq := angleDiff_eq_of_angleDiff (x := x) (a := a) (b := c) + have hxa_lt := Circle.angleDiff_lt_two_pi x a + have hxc_lt := Circle.angleDiff_lt_two_pi x c + have hxb_lt := Circle.angleDiff_lt_two_pi x b + have hxa_ge := Circle.angleDiff_nonneg x a + have hxc_ge := Circle.angleDiff_nonneg x c + have hxb_ge := Circle.angleDiff_nonneg x b + have hac_ne : x.angleDiff a ≠ x.angleDiff c := (circleCoordFrom x).injective.ne hac + have hab_ne : x.angleDiff a ≠ x.angleDiff b := (circleCoordFrom x).injective.ne hab + have hcb_ne : x.angleDiff c ≠ x.angleDiff b := (circleCoordFrom x).injective.ne hcb + grind [-Circle.angleDiff] + +theorem circleCrosses_circleStdCoord_iff_angleDiff {a c b d : Circle} : + circleCrosses circleStdCoord a c b d ↔ + a ≠ c ∧ b ≠ d ∧ a ≠ b ∧ a ≠ d ∧ c ≠ b ∧ c ≠ d ∧ + (a.angleDiff b < a.angleDiff c ↔ ¬ a.angleDiff d < a.angleDiff c) := by + simp only [circleCrosses] + constructor <;> rintro ⟨hac, hbd, hab, had, hcb, hcd, hcross⟩ <;> + refine ⟨hac, hbd, hab, had, hcb, hcd, ?_⟩ + · rw [onOpenArc_circleStdCoord_iff_angleDiff hab hcb, + onOpenArc_circleStdCoord_iff_angleDiff had hcd] at hcross + have hcb_ne : a.angleDiff c ≠ a.angleDiff b := (circleCoordFrom a).injective.ne hcb + have hcd_ne : a.angleDiff c ≠ a.angleDiff d := (circleCoordFrom a).injective.ne hcd + grind [-Circle.angleDiff] + · rw [onOpenArc_circleStdCoord_iff_angleDiff hab hcb, + onOpenArc_circleStdCoord_iff_angleDiff had hcd] + have hcb_ne : a.angleDiff c ≠ a.angleDiff b := (circleCoordFrom a).injective.ne hcb + have hcd_ne : a.angleDiff c ≠ a.angleDiff d := (circleCoordFrom a).injective.ne hcd + grind [-Circle.angleDiff] + +/-- For any basepoint $c \in \text{Circle}$, `circleCrosses (circleCoordFrom c)` agrees with +`circleCrosses circleStdCoord`. -/ +theorem circleCrosses_circleCoordFrom_iff {c a c' b d : Circle} : + circleCrosses (circleCoordFrom c) a c' b d ↔ circleCrosses circleStdCoord a c' b d := by + rw [circleCrosses_circleStdCoord_iff_angleDiff] + simp only [circleCrosses] + constructor <;> rintro ⟨hac, hbd, hab, had, hcb, hcd, hcross⟩ <;> + refine ⟨hac, hbd, hab, had, hcb, hcd, ?_⟩ + · rw [onOpenArc_circleCoordFrom_iff_angleDiff (x := c) hac hab hcb, + onOpenArc_circleCoordFrom_iff_angleDiff (x := c) hac had hcd] at hcross + have hcb_ne : a.angleDiff c' ≠ a.angleDiff b := (circleCoordFrom a).injective.ne hcb + have hcd_ne : a.angleDiff c' ≠ a.angleDiff d := (circleCoordFrom a).injective.ne hcd + grind [-Circle.angleDiff] + · rw [onOpenArc_circleCoordFrom_iff_angleDiff (x := c) hac hab hcb, + onOpenArc_circleCoordFrom_iff_angleDiff (x := c) hac had hcd] + have hcb_ne : a.angleDiff c' ≠ a.angleDiff b := (circleCoordFrom a).injective.ne hcb + have hcd_ne : a.angleDiff c' ≠ a.angleDiff d := (circleCoordFrom a).injective.ne hcd + grind [-Circle.angleDiff] + +/-- On `Circle`, four distinct points $a, b, c, d$ have $b$ and $d$ in different connected +components of `({a, c} : Set Circle)ᶜ` if and only if `circleCrosses circleStdCoord a c b d`. -/ +theorem connectedComponentIn_compl_pair_ne_iff_circleCrosses {a c b d : Circle} + (hac : a ≠ c) (hbd : b ≠ d) (hab : a ≠ b) (had : a ≠ d) (hcb : c ≠ b) (hcd : c ≠ d) : + connectedComponentIn ({a, c} : Set Circle)ᶜ b ≠ + connectedComponentIn ({a, c} : Set Circle)ᶜ d ↔ + circleCrosses circleStdCoord a c b d := by + have hb_mem : b ∈ circleOpenArc a c ∪ circleOpenArc c a := by + rw [← compl_pair_eq_union_circleOpenArc hac] + simp [hab.symm, hcb.symm] + have hd_mem : d ∈ circleOpenArc a c ∪ circleOpenArc c a := by + rw [← compl_pair_eq_union_circleOpenArc hac] + simp [had.symm, hcd.symm] + have hne_arcs : circleOpenArc a c ≠ circleOpenArc c a := by + obtain ⟨z, hz⟩ := nonempty_circleOpenArc hac + intro heq + exact (disjoint_circleOpenArc hac).ne_of_mem hz (heq ▸ hz) rfl + have hcc_iff : (connectedComponentIn ({a, c} : Set Circle)ᶜ b ≠ + connectedComponentIn ({a, c} : Set Circle)ᶜ d) ↔ + (b ∈ circleOpenArc a c ↔ d ∉ circleOpenArc a c) := by + rcases hb_mem with hb1 | hb2 <;> rcases hd_mem with hd1 | hd2 + · rw [connectedComponentIn_compl_pair_eq_left hac hb1, + connectedComponentIn_compl_pair_eq_left hac hd1] + simp [hb1, hd1] + · rw [connectedComponentIn_compl_pair_eq_left hac hb1, + connectedComponentIn_compl_pair_eq_right hac hd2] + have hd1 : d ∉ circleOpenArc a c := + fun h => (disjoint_circleOpenArc hac).ne_of_mem h hd2 rfl + simp [hne_arcs, hb1, hd1] + · rw [connectedComponentIn_compl_pair_eq_right hac hb2, + connectedComponentIn_compl_pair_eq_left hac hd1] + have hb1 : b ∉ circleOpenArc a c := + fun h => (disjoint_circleOpenArc hac).ne_of_mem h hb2 rfl + simp [hne_arcs.symm, hb1, hd1] + · rw [connectedComponentIn_compl_pair_eq_right hac hb2, + connectedComponentIn_compl_pair_eq_right hac hd2] + have hb1 : b ∉ circleOpenArc a c := + fun h => (disjoint_circleOpenArc hac).ne_of_mem h hb2 rfl + have hd1 : d ∉ circleOpenArc a c := + fun h => (disjoint_circleOpenArc hac).ne_of_mem h hd2 rfl + simp [hb1, hd1] + rw [hcc_iff, mem_circleOpenArc_iff_angleDiff hac, mem_circleOpenArc_iff_angleDiff hac, + circleCrosses_circleStdCoord_iff_angleDiff] + have hb_pos := Circle.angleDiff_pos hab + have hd_pos := Circle.angleDiff_pos had + grind [-Circle.angleDiff] + +/-- A topological embedding commutes with `connectedComponentIn`. -/ +theorem isEmbedding_image_connectedComponentIn {X Y : Type*} [TopologicalSpace X] + [TopologicalSpace Y] {f : X → Y} (hf : IsEmbedding f) {s : Set X} {x : X} (hx : x ∈ s) : + f '' connectedComponentIn s x = connectedComponentIn (f '' s) (f x) := by + refine (hf.continuous.continuousOn.image_connectedComponentIn_subset hx).antisymm ?_ + let K := connectedComponentIn (f '' s) (f x) + have hK_sub : K ⊆ f '' s := connectedComponentIn_subset (f '' s) (f x) + have hK_range : K ⊆ range f := hK_sub.trans (image_subset_range f s) + have hK_eq : f '' (f ⁻¹' K) = K := image_preimage_eq_of_subset hK_range + have hpre_conn : IsPreconnected (f ⁻¹' K) := by + rw [← hf.isInducing.isPreconnected_image, hK_eq] + exact isPreconnected_connectedComponentIn + have hx_pre : x ∈ f ⁻¹' K := mem_connectedComponentIn (mem_image_of_mem f hx) + have hpre_sub : f ⁻¹' K ⊆ s := by + rw [← preimage_image_eq s hf.injective] + exact preimage_mono hK_sub + change K ⊆ _ + rw [← hK_eq] + exact image_mono (hpre_conn.subset_connectedComponentIn hx_pre hpre_sub) + +/-! ## 4. Segments of `Circle` with respect to a Finite Set -/ + +/-- For $V \subseteq \text{Circle}$ and $v \in V$, `nextSegment V v` is the open segment of +$\text{Circle} \setminus V$ immediately following $v$ in the counterclockwise direction. -/ +def nextSegment (V : Set Circle) (v : Circle) : Set Circle := + {z : Circle | z ≠ v ∧ ∀ w ∈ V \ {v}, v.angleDiff z < v.angleDiff w} + +/-- For $V \subseteq \text{Circle}$ and $v \in V$, `prevSegment V v` is the open segment of +$\text{Circle} \setminus V$ immediately preceding $v$ in the counterclockwise direction. -/ +def prevSegment (V : Set Circle) (v : Circle) : Set Circle := + {z : Circle | z ≠ v ∧ ∀ w ∈ V \ {v}, z.angleDiff v < w.angleDiff v} + +theorem nextSegment_subset_compl {V : Set Circle} {v : Circle} : + nextSegment V v ⊆ Vᶜ := by + intro z ⟨hzv, hzw⟩ hzV + have hmem : z ∈ V \ {v} := ⟨hzV, hzv⟩ + exact lt_irrefl _ (hzw z hmem) + +theorem prevSegment_subset_compl {V : Set Circle} {v : Circle} : + prevSegment V v ⊆ Vᶜ := by + intro z ⟨hzv, hzw⟩ hzV + have hmem : z ∈ V \ {v} := ⟨hzV, hzv⟩ + exact lt_irrefl _ (hzw z hmem) + +theorem nextSegment_singleton (v : Circle) : nextSegment {v} v = {v}ᶜ := by + ext z + simp [nextSegment] + +theorem prevSegment_singleton (v : Circle) : prevSegment {v} v = {v}ᶜ := by + ext z + simp [prevSegment] + +theorem exists_min_on_finite {S : Set Circle} (hS : S.Finite) (hne : S.Nonempty) + (f : Circle → ℝ) : ∃ m ∈ S, ∀ w ∈ S, f m ≤ f w := by + obtain ⟨m, hm, hmin⟩ := hS.toFinset.exists_min_image f (hS.toFinset_nonempty.mpr hne) + exact ⟨m, hS.mem_toFinset.mp hm, fun w hw => hmin w (hS.mem_toFinset.mpr hw)⟩ + +theorem exists_max_on_finite {S : Set Circle} (hS : S.Finite) (hne : S.Nonempty) + (f : Circle → ℝ) : ∃ m ∈ S, ∀ w ∈ S, f w ≤ f m := by + obtain ⟨m, hm, hmax⟩ := hS.toFinset.exists_max_image f (hS.toFinset_nonempty.mpr hne) + exact ⟨m, hS.mem_toFinset.mp hm, fun w hw => hmax w (hS.mem_toFinset.mpr hw)⟩ + +theorem nextSegment_eq_circleOpenArc_of_min {V : Set Circle} {v v_next : Circle} + (hv_next : v_next ∈ V \ {v}) + (hmin : ∀ w ∈ V \ {v}, v.angleDiff v_next ≤ v.angleDiff w) : + nextSegment V v = circleOpenArc v v_next := by + have hne : v ≠ v_next := Ne.symm hv_next.2 + ext z + rw [mem_circleOpenArc_iff_angleDiff hne] + simp only [nextSegment, mem_ofPred_eq] + constructor + · rintro ⟨hzv, hzw⟩ + exact ⟨Circle.angleDiff_pos (Ne.symm hzv), hzw v_next hv_next⟩ + · rintro ⟨hpos, hlt⟩ + refine ⟨?_, fun w hw => lt_of_lt_of_le hlt (hmin w hw)⟩ + rintro rfl + simp [Circle.angleDiff] at hpos + +theorem nextSegment_nonempty {V : Set Circle} (hV : V.Finite) {v : Circle} (hv : v ∈ V) : + (nextSegment V v).Nonempty := by + rcases (V \ {v}).eq_empty_or_nonempty with hemp | hne + · have hV_eq : V = {v} := Subset.antisymm (sdiff_eq_empty.mp hemp) (singleton_subset_iff.mpr hv) + rw [hV_eq, nextSegment_singleton] + exact ⟨-v, Circle.neg_ne_self v⟩ + · obtain ⟨v_next, hv_next, hmin⟩ := exists_min_on_finite (hV.sdiff) hne (Circle.angleDiff v) + rw [nextSegment_eq_circleOpenArc_of_min hv_next hmin] + exact nonempty_circleOpenArc (Ne.symm hv_next.2) + +theorem connectedComponentIn_compl_eq_nextSegment {V : Set Circle} (hV : V.Finite) + {v z : Circle} (hv : v ∈ V) (hz : z ∈ nextSegment V v) : + connectedComponentIn Vᶜ z = nextSegment V v := by + rcases (V \ {v}).eq_empty_or_nonempty with hemp | hne + · have hV_eq : V = {v} := Subset.antisymm (sdiff_eq_empty.mp hemp) (singleton_subset_iff.mpr hv) + rw [hV_eq, nextSegment_singleton] at hz ⊢ + exact (Circle.isPathConnected_compl_singleton + v).isConnected.isPreconnected.connectedComponentIn hz + · obtain ⟨v_next, hv_next, hmin⟩ := exists_min_on_finite (hV.sdiff) hne (Circle.angleDiff v) + have hne_v : v ≠ v_next := Ne.symm hv_next.2 + have hseg_eq := nextSegment_eq_circleOpenArc_of_min hv_next hmin + rw [hseg_eq] at hz ⊢ + have hA_sub : circleOpenArc v v_next ⊆ Vᶜ := hseg_eq ▸ nextSegment_subset_compl + have hcompl_union : Vᶜ = circleOpenArc v v_next ∪ (Vᶜ ∩ circleOpenArc v_next v) := by + ext x + constructor + · intro hxV + have hxv : x ≠ v := fun h => hxV (h ▸ hv) + have hxv' : x ≠ v_next := fun h => hxV (h ▸ hv_next.1) + have hx_pair : x ∈ ({v, v_next} : Set Circle)ᶜ := by simp [hxv, hxv'] + rw [compl_pair_eq_union_circleOpenArc hne_v] at hx_pair + rcases hx_pair with hx1 | hx2 + · exact Or.inl hx1 + · exact Or.inr ⟨hxV, hx2⟩ + · rintro (hx1 | ⟨hxV, _⟩) + · exact hA_sub hx1 + · exact hxV + rw [hcompl_union] + exact connectedComponentIn_eq_left_of_union_disjoint_open + (isOpen_circleOpenArc hne_v) + (hV.isClosed.isOpen_compl.inter (isOpen_circleOpenArc hne_v.symm)) + ((disjoint_circleOpenArc hne_v).mono_right inter_subset_right) + (isPathConnected_circleOpenArc v v_next).isConnected.isPreconnected + hz + +theorem exists_unique_nextSegment_of_mem_compl {V : Set Circle} (hV : V.Finite) + (hne : V.Nonempty) {z : Circle} (hz : z ∈ Vᶜ) : + ∃! v, v ∈ V ∧ z ∈ nextSegment V v := by + obtain ⟨v, hv, hmin⟩ := exists_min_on_finite hV hne (fun w => w.angleDiff z) + have hzv : z ≠ v := fun h => hz (h ▸ hv) + have hz_mem : z ∈ nextSegment V v := by + refine ⟨hzv, fun w hw => ?_⟩ + by_contra! hle + have hwz : w ≠ z := fun h => hz (h ▸ hw.1) + have hvw_pos : 0 < v.angleDiff w := Circle.angleDiff_pos (Ne.symm hw.2) + have hmin_w : v.angleDiff z ≤ w.angleDiff z := hmin w hw.1 + have heq := angleDiff_eq_of_angleDiff (x := v) (a := w) (b := z) + grind [-Circle.angleDiff] + refine ⟨v, ⟨hv, hz_mem⟩, ?_⟩ + rintro v' ⟨hv', hzv', hzw'⟩ + by_contra hne' + have h1 : v.angleDiff z < v.angleDiff v' := hz_mem.2 v' ⟨hv', hne'⟩ + have h2 : v'.angleDiff z < v'.angleDiff v := hzw' v ⟨hv, Ne.symm hne'⟩ + have hzv_pos := Circle.angleDiff_pos hzv.symm + have hsum := Circle.angleDiff_add_angleDiff (Ne.symm hne') + have heq := angleDiff_eq_of_angleDiff (x := v) (a := v') (b := z) + grind [-Circle.angleDiff] + +theorem mem_prevSegment_iff {V : Set Circle} {v z : Circle} : + z ∈ prevSegment V v ↔ z ≠ v ∧ ∀ w ∈ V \ {v}, v.angleDiff w < v.angleDiff z := by + simp only [prevSegment, mem_ofPred_eq] + refine and_congr_right fun hzv => forall₂_congr fun w hw => ?_ + have h1 := Circle.angleDiff_add_angleDiff hzv + have h2 := Circle.angleDiff_add_angleDiff hw.2 + constructor <;> intro h <;> linarith + +theorem prevSegment_eq_nextSegment_of_max {V : Set Circle} {v v_prev : Circle} + (hv : v ∈ V) (hv_prev : v_prev ∈ V \ {v}) + (hmax : ∀ w ∈ V \ {v}, v.angleDiff w ≤ v.angleDiff v_prev) : + prevSegment V v = nextSegment V v_prev := by + ext z + rw [mem_prevSegment_iff] + simp only [nextSegment, mem_ofPred_eq] + have hvv' : v_prev ≠ v := hv_prev.2 + have hsum_vv' := Circle.angleDiff_add_angleDiff hvv' + have hvp_pos := Circle.angleDiff_pos hvv'.symm + constructor + · rintro ⟨hzv, hzw⟩ + have hlt : v.angleDiff v_prev < v.angleDiff z := hzw v_prev hv_prev + have hzv_prev : z ≠ v_prev := by + rintro rfl + exact lt_irrefl _ hlt + have hzv_lt := Circle.angleDiff_lt_two_pi v z + have heq_z := angleDiff_eq_of_angleDiff (x := v) (a := v_prev) (b := z) + refine ⟨hzv_prev, fun w hw => ?_⟩ + rcases eq_or_ne w v with rfl | hwv + · grind [-Circle.angleDiff] + · have hw_mem : w ∈ V \ {v} := ⟨hw.1, hwv⟩ + have hle_w := hmax w hw_mem + have hw_pos := Circle.angleDiff_pos hwv.symm + have heq_w := angleDiff_eq_of_angleDiff (x := v) (a := v_prev) (b := w) + have hlt_w : v.angleDiff w < v.angleDiff v_prev := + lt_of_le_of_ne hle_w ((circleCoordFrom v).injective.ne hw.2) + grind [-Circle.angleDiff] + · rintro ⟨hzv_prev, hzw⟩ + have hlt_v : v_prev.angleDiff z < v_prev.angleDiff v := + hzw v ⟨hv, hvv'.symm⟩ + have hzv : z ≠ v := by + rintro rfl + exact lt_irrefl _ hlt_v + have hzp_pos := Circle.angleDiff_pos hzv_prev.symm + have hzv_pos := Circle.angleDiff_pos hzv.symm + have heq_z := angleDiff_eq_of_angleDiff (x := v) (a := v_prev) (b := z) + have hgt : v.angleDiff v_prev < v.angleDiff z := by grind [-Circle.angleDiff] + exact ⟨hzv, fun w hw => lt_of_le_of_lt (hmax w hw) hgt⟩ + +theorem exists_nextSegment_eq_prevSegment {V : Set Circle} (hV : V.Finite) + {v : Circle} (hv : v ∈ V) : + ∃ v_prev ∈ V, prevSegment V v = nextSegment V v_prev := by + rcases (V \ {v}).eq_empty_or_nonempty with hemp | hne + · have hV_eq : V = {v} := Subset.antisymm (sdiff_eq_empty.mp hemp) (singleton_subset_iff.mpr hv) + refine ⟨v, hv, ?_⟩ + rw [hV_eq, prevSegment_singleton, nextSegment_singleton] + · obtain ⟨v_prev, hv_prev, hmax⟩ := exists_max_on_finite (hV.sdiff) hne (Circle.angleDiff v) + exact ⟨v_prev, hv_prev.1, prevSegment_eq_nextSegment_of_max hv hv_prev hmax⟩ + +theorem exists_unique_prevSegment_of_mem_compl {V : Set Circle} (hV : V.Finite) + (hne : V.Nonempty) {z : Circle} (hz : z ∈ Vᶜ) : + ∃! v, v ∈ V ∧ z ∈ prevSegment V v := by + obtain ⟨v, hv, hmin⟩ := exists_min_on_finite hV hne (fun w => z.angleDiff w) + have hzv : z ≠ v := fun h => hz (h ▸ hv) + have hz_mem : z ∈ prevSegment V v := by + refine ⟨hzv, fun w hw => ?_⟩ + by_contra! hle + have hwv : v ≠ w := Ne.symm hw.2 + have hmin_w : z.angleDiff v ≤ z.angleDiff w := hmin w hw.1 + have hzv_ne_zw : z.angleDiff v ≠ z.angleDiff w := (circleCoordFrom z).injective.ne hwv + have hzv_lt_zw : z.angleDiff v < z.angleDiff w := lt_of_le_of_ne hmin_w hzv_ne_zw + have hzw_lt := Circle.angleDiff_lt_two_pi z w + have hsum_zv := Circle.angleDiff_add_angleDiff hzv + have hsum_wv := Circle.angleDiff_add_angleDiff hw.2 + have heq := angleDiff_eq_of_angleDiff (x := z) (a := w) (b := v) + grind [-Circle.angleDiff] + refine ⟨v, ⟨hv, hz_mem⟩, ?_⟩ + rintro v' ⟨hv', hzv', hzw'⟩ + by_contra hne' + have h1 : z.angleDiff v < v'.angleDiff v := hz_mem.2 v' ⟨hv', hne'⟩ + have h2 : z.angleDiff v' < v.angleDiff v' := hzw' v ⟨hv, Ne.symm hne'⟩ + have hzv_pos := Circle.angleDiff_pos hzv + have hsum := Circle.angleDiff_add_angleDiff (Ne.symm hne') + have heq := angleDiff_eq_of_angleDiff (x := z) (a := v) (b := v') + grind [-Circle.angleDiff] + +theorem angleDiff_exp_mul {v : Circle} {θ : ℝ} (h0 : 0 < θ) (h2pi : θ < 2 * Real.pi) : + v.angleDiff (Circle.exp θ * v) = θ := by + let z := Circle.exp θ * v + have hexp : Circle.exp (v.angleDiff z) = Circle.exp θ := + mul_right_cancel (Circle.exp_angleDiff_mul (x := v) (y := z)) + have hinj := Circle.exp_injOn_Ioc (a := 0) (b := 2 * Real.pi) (by linarith) + have hzv : v ≠ z := by + intro h + have h1 : Circle.exp θ = Circle.exp (2 * Real.pi) := by + rw [Circle.exp_two_pi, ← mul_left_inj v, one_mul] + exact h.symm + have hθ_mem : θ ∈ Ioc 0 (2 * Real.pi) := ⟨h0, h2pi.le⟩ + have h2pi_mem : 2 * Real.pi ∈ Ioc 0 (2 * Real.pi) := ⟨Real.two_pi_pos, le_rfl⟩ + exact h2pi.ne (hinj hθ_mem h2pi_mem h1) + have hz_mem : v.angleDiff z ∈ Ioc 0 (2 * Real.pi) := + ⟨Circle.angleDiff_pos hzv, (Circle.angleDiff_lt_two_pi v z).le⟩ + have hθ_mem : θ ∈ Ioc 0 (2 * Real.pi) := ⟨h0, h2pi.le⟩ + exact hinj hz_mem hθ_mem hexp + +/-- The open arc of length $L \in (0, 2\pi]$ starting at $v \in \text{Circle}$. -/ +def arcOfLength (v : Circle) (L : ℝ) : Set Circle := + {z : Circle | 0 < v.angleDiff z ∧ v.angleDiff z < L} + +/-- Any open arc `arcOfLength v L` with $0 < L \le 2\pi$ is homeomorphic to `Ioo (0 : ℝ) 1`. -/ +noncomputable def homeomorphIooArcOfLength (v : Circle) {L : ℝ} (hL0 : 0 < L) + (hL2pi : L ≤ 2 * Real.pi) : Ioo (0 : ℝ) 1 ≃ₜ arcOfLength v L where + toFun t := ⟨Circle.exp (L * t.1) * v, by + have ht0 : 0 < L * t.1 := mul_pos hL0 t.2.1 + have htL : L * t.1 < L := by nlinarith [t.2.2] + have ht2pi : L * t.1 < 2 * Real.pi := htL.trans_le hL2pi + simp only [arcOfLength, mem_ofPred_eq, angleDiff_exp_mul ht0 ht2pi] + exact ⟨ht0, htL⟩⟩ + invFun z := ⟨v.angleDiff z.1 / L, + div_pos z.2.1 hL0, (div_lt_one hL0).mpr z.2.2⟩ + left_inv t := by + ext + have ht0 : 0 < L * t.1 := mul_pos hL0 t.2.1 + have htL : L * t.1 < L := by nlinarith [t.2.2] + have ht2pi : L * t.1 < 2 * Real.pi := htL.trans_le hL2pi + dsimp only + rw [angleDiff_exp_mul ht0 ht2pi, mul_div_cancel_left₀ t.1 hL0.ne'] + right_inv z := by + ext + dsimp only + rw [mul_div_cancel₀ _ hL0.ne', Circle.exp_angleDiff_mul] + continuous_toFun := by + refine Continuous.subtype_mk ?_ _ + exact (Circle.exp.continuous.comp (continuous_const.mul continuous_subtype_val)).mul + continuous_const + continuous_invFun := by + rw [continuous_def] + intro U hU + let e : Ioo (0 : ℝ) 1 ≃ arcOfLength v L := + { toFun := fun t => ⟨Circle.exp (L * t.1) * v, by + have ht0 : 0 < L * t.1 := mul_pos hL0 t.2.1 + have htL : L * t.1 < L := by nlinarith [t.2.2] + have ht2pi : L * t.1 < 2 * Real.pi := htL.trans_le hL2pi + simp only [arcOfLength, mem_ofPred_eq, angleDiff_exp_mul ht0 ht2pi] + exact ⟨ht0, htL⟩⟩ + invFun := fun z => ⟨v.angleDiff z.1 / L, + div_pos z.2.1 hL0, (div_lt_one hL0).mpr z.2.2⟩ + left_inv := fun t => by + ext + have ht0 : 0 < L * t.1 := mul_pos hL0 t.2.1 + have htL : L * t.1 < L := by nlinarith [t.2.2] + have ht2pi : L * t.1 < 2 * Real.pi := htL.trans_le hL2pi + dsimp only + rw [angleDiff_exp_mul ht0 ht2pi, mul_div_cancel_left₀ t.1 hL0.ne'] + right_inv := fun z => by + ext + dsimp only + rw [mul_div_cancel₀ _ hL0.ne', Circle.exp_angleDiff_mul] } + change IsOpen (e.symm ⁻¹' U) + rw [← Equiv.image_eq_preimage_symm] + have hU_real : IsOpen (Subtype.val '' U) := isOpen_Ioo.isOpenMap_subtype_val U hU + have hU_mul : IsOpen ((fun t : ℝ => L * t) '' (Subtype.val '' U)) := + (Homeomorph.mulLeft₀ L hL0.ne').isOpenMap _ hU_real + have hU_exp : IsOpen (Circle.exp '' ((fun t : ℝ => L * t) '' (Subtype.val '' U))) := + isLocalHomeomorph_circleExp.isOpenMap _ hU_mul + have hU_rot : IsOpen ((fun z : Circle => z * v) '' + (Circle.exp '' ((fun t : ℝ => L * t) '' (Subtype.val '' U)))) := + (Homeomorph.mulRight v).isOpenMap _ hU_exp + have heq : e '' U = Subtype.val ⁻¹' ((fun z : Circle => z * v) '' + (Circle.exp '' ((fun t : ℝ => L * t) '' (Subtype.val '' U)))) := by + ext z + simp only [mem_image, Subtype.exists, mem_preimage, exists_and_right, exists_eq_right] + constructor + · rintro ⟨t, htIoo, htU, htz⟩ + refine ⟨Circle.exp (L * t), ⟨L * t, ⟨t, ⟨htIoo, htU⟩, rfl⟩, rfl⟩, ?_⟩ + exact congrArg Subtype.val htz + · rintro ⟨_, ⟨_, ⟨t, ⟨htIoo, htU⟩, rfl⟩, rfl⟩, htz⟩ + refine ⟨t, htIoo, htU, Subtype.ext htz⟩ + rw [heq] + exact hU_rot.preimage continuous_subtype_val + +theorem nonempty_homeomorph_Ioo_nextSegment {V : Set Circle} (hV : V.Finite) {v : Circle} + (hv : v ∈ V) : Nonempty (Ioo (0 : ℝ) 1 ≃ₜ nextSegment V v) := by + rcases (V \ {v}).eq_empty_or_nonempty with hemp | hne + · have hV_eq : V = {v} := Subset.antisymm (sdiff_eq_empty.mp hemp) (singleton_subset_iff.mpr hv) + have hseg : nextSegment V v = arcOfLength v (2 * Real.pi) := by + rw [hV_eq, nextSegment_singleton] + ext z + simp only [mem_compl_iff, mem_singleton_iff, arcOfLength, mem_ofPred_eq] + exact ⟨fun h => ⟨Circle.angleDiff_pos (Ne.symm h), Circle.angleDiff_lt_two_pi v z⟩, + fun ⟨hpos, _⟩ h => by subst h; simp [Circle.angleDiff] at hpos⟩ + rw [hseg] + exact ⟨homeomorphIooArcOfLength v Real.two_pi_pos le_rfl⟩ + · obtain ⟨v_next, hv_next, hmin⟩ := exists_min_on_finite (hV.sdiff) hne (Circle.angleDiff v) + have hne_v : v ≠ v_next := Ne.symm hv_next.2 + have hseg : nextSegment V v = arcOfLength v (v.angleDiff v_next) := by + rw [nextSegment_eq_circleOpenArc_of_min hv_next hmin] + ext z + rw [mem_circleOpenArc_iff_angleDiff hne_v] + rfl + rw [hseg] + exact ⟨homeomorphIooArcOfLength v (Circle.angleDiff_pos hne_v) + (Circle.angleDiff_lt_two_pi v v_next).le⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CircleMove.lean b/LeanPool/GraphMinor/Surface/CircleMove.lean new file mode 100644 index 0000000000..35d0254091 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CircleMove.lean @@ -0,0 +1,338 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.MoveCuff +public import Mathlib.Analysis.SpecialFunctions.Complex.Circle +public import Mathlib.Topology.Homotopy.Lifting +public import Mathlib.Topology.Algebra.Order.Floor + +/-! +# Loops on a cuff + +We write the circle as the real line modulo the integers, through `ee`. A strictly increasing map +`τ` of `[0, 1]` with +`τ 1 = τ 0 + 1` is a homeomorphism of the circle that preserves the orientation +(`exists_circle_homeo`). So, by +`move_cuff`, a cuff can be moved along such a map (`exists_move_loop`). A loop that goes once around +a cuff gives a +homeomorphism from the circle (`exists_circle_param`), and any line in the cuff lifts to a monotone +map into the real +line (`exists_lift`, `lift_mono`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function + +universe u + +/-- The real line onto the circle, with period one. -/ +noncomputable def ee (x : ℝ) : Circle := Circle.exp (2 * Real.pi * x) + +theorem continuous_ee : Continuous ee := by + unfold ee + fun_prop + +theorem ee_eq_iff {x y : ℝ} : ee x = ee y ↔ ∃ m : ℤ, x = y + m := by + have hpi := Real.pi_pos + unfold ee + rw [Circle.exp_eq_exp] + constructor + · rintro ⟨m, hm⟩ + refine ⟨m, ?_⟩ + have : 2 * Real.pi * x = 2 * Real.pi * (y + m) := by rw [hm]; ring + exact mul_left_cancel₀ (by positivity) this + · rintro ⟨m, rfl⟩ + exact ⟨m, by ring⟩ + +theorem ee_add_int (x : ℝ) (m : ℤ) : ee (x + m) = ee x := ee_eq_iff.mpr ⟨m, rfl⟩ + +theorem ee_add_one (x : ℝ) : ee (x + 1) = ee x := by + simpa using ee_add_int x 1 + +theorem ee_surjective : Surjective ee := fun z => by + have hpi := Real.pi_pos + refine ⟨Complex.arg z / (2 * Real.pi), ?_⟩ + unfold ee + rw [mul_div_cancel₀ _ (by positivity)] + exact Circle.exp_arg z + +theorem isQuotientMap_ee : IsQuotientMap ee := by + have hpi := Real.pi_pos + have h1 : IsQuotientMap Circle.exp := Circle.isCoveringMap_exp.isQuotientMap fun z + => ⟨_, Circle.exp_arg z⟩ + have h2 : IsQuotientMap fun x : ℝ => 2 * Real.pi * x := + (Homeomorph.mulLeft₀ (2 * Real.pi) (by positivity)).isQuotientMap + exact h1.comp h2 + +/-- A continuous map of period one factors through the circle. -/ +theorem exists_circle_descend {Y : Type*} [TopologicalSpace Y] {g : ℝ → Y} (hc : Continuous g) + (hp : ∀ x, g (x + 1) = g x) : ∃ G : Circle → Y, Continuous G ∧ ∀ x, G (ee x) = g x := by + have hn : ∀ (m : ℤ) x, g (x + m) = g x := by + intro m + induction m using Int.induction_on with + | zero => simp + | succ n ih => + intro x + have := hp (x + n) + push_cast at ih ⊢ + rw [← add_assoc, this, ih] + | pred n ih => + intro x + have := hp (x - n - 1) + push_cast at ih ⊢ + rw [sub_add_cancel] at this + have e : x + (-(n : ℝ) - 1) = x - n - 1 := by ring + rw [e, ← this] + have e2 := ih x + rw [← sub_eq_add_neg] at e2 + exact e2 + let G' : C(ℝ, Y) := ⟨g, hc⟩ + let E : C(ℝ, Circle) := ⟨ee, continuous_ee⟩ + have hq : IsQuotientMap E := isQuotientMap_ee + have hf : Function.FactorsThrough G' E := fun a b he => by + obtain ⟨m, rfl⟩ := ee_eq_iff.mp he + exact hn m b + refine ⟨hq.lift G' hf, (hq.lift G' hf).continuous, fun x => ?_⟩ + exact congrArg (fun h : C(ℝ, Y) => h x) (hq.lift_comp G' hf) + +theorem fract_of_mem_Ico {u : ℝ} (hu : u ∈ Ico (0 : ℝ) 1) : Int.fract u = u + := Int.fract_eq_iff.mpr ⟨hu.1, hu.2, 0, by simp⟩ + +/-- A loop that goes once around a set gives a homeomorphism from the circle. -/ +theorem exists_circle_param {T : Type*} [TopologicalSpace T] [T2Space T] {ρ : ℝ → T} + (hc : ContinuousOn ρ (Icc 0 1)) + (hi : InjOn ρ (Ico 0 1)) (h01 : ρ 0 = ρ 1) : + ∃ φ : Circle ≃ₜ (ρ '' Icc 0 1 : Set T), ∀ u ∈ Icc (0 : ℝ) 1, (φ (ee u)).1 = ρ u := by + classical + have hg : Continuous (ρ ∘ Int.fract) := ContinuousOn.comp_fract'' hc h01 + obtain ⟨G, hG, hval⟩ := exists_circle_descend hg fun x => by simp + have hfr : ∀ u ∈ Icc (0 : ℝ) 1, ρ (Int.fract u) = ρ u := fun u hu => by + rcases eq_or_lt_of_le hu.2 with rfl | h + · simpa using h01 + · rw [fract_of_mem_Ico ⟨hu.1, h⟩] + have hmem : ∀ z, G z ∈ ρ '' Icc 0 1 := fun z => by + obtain ⟨x, rfl⟩ := ee_surjective z + rw [hval] + exact ⟨Int.fract x, ⟨Int.fract_nonneg x, (Int.fract_lt_one x).le⟩, rfl⟩ + let G₁ : Circle → (ρ '' Icc 0 1 : Set T) := fun z => ⟨G z, hmem z⟩ + have hG₁ : Continuous G₁ := hG.subtype_mk hmem + have hinj : Injective G₁ := fun z w he => by + obtain ⟨x, rfl⟩ := ee_surjective z + obtain ⟨y, rfl⟩ := ee_surjective w + have h1 : G (ee x) = G (ee y) := congrArg Subtype.val he + rw [hval, hval] at h1 + have h2 := hi ⟨Int.fract_nonneg x, Int.fract_lt_one x⟩ ⟨Int.fract_nonneg y, Int.fract_lt_one y⟩ + h1 + refine ee_eq_iff.mpr ⟨⌊x⌋ - ⌊y⌋, ?_⟩ + have h3 := Int.floor_add_fract x + have h4 := Int.floor_add_fract y + push_cast + linarith + have hsurj : Surjective G₁ := by + rintro ⟨_, u, hu, rfl⟩ + refine ⟨ee u, Subtype.ext ?_⟩ + change G (ee u) = ρ u + rw [hval] + exact hfr u hu + refine ⟨hG₁.homeoOfEquivCompactToT2 (f := Equiv.ofBijective G₁ ⟨hinj, hsurj⟩), fun u hu => ?_⟩ + change G (ee u) = ρ u + rw [hval] + exact hfr u hu + +/-- A strictly increasing map of `[0, 1]` that gains one is a homeomorphism of the circle that +preserves the orientation. -/ +theorem exists_circle_homeo {τ : ℝ → ℝ} (hc : ContinuousOn τ (Icc 0 1)) (hm : StrictMonoOn τ + (Icc 0 1)) (h1 : τ 1 = τ 0 + 1) : + ∃ h : Circle ≃ₜ Circle, PreservesCircleOrientation h ∧ ∀ u ∈ Icc (0 : ℝ) 1, h (ee u) = ee (τ u) + := by + have hpi := Real.pi_pos + let g : ℝ → ℝ := fun y => τ y - y + have hgc : Continuous (g ∘ Int.fract) := ContinuousOn.comp_fract'' (hc.sub continuousOn_id) + (by simp [g, h1]) + let t : ℝ → ℝ := fun x => x + g (Int.fract x) + have ht : Continuous t := continuous_id.add hgc + have ht1 : ∀ x, t (x + 1) = t x + 1 := fun x => by simp [t]; ring + have hform : ∀ x, t x = ⌊x⌋ + τ (Int.fract x) := fun x => by + simp only [t, g] + have := Int.floor_add_fract x + linarith + have hfm : ∀ x, Int.fract x ∈ Icc (0 : ℝ) 1 := fun x => ⟨Int.fract_nonneg x, + (Int.fract_lt_one x).le⟩ + have hmono : StrictMono t := by + intro x y hxy + rw [hform, hform] + have hle : ⌊x⌋ ≤ ⌊y⌋ := Int.floor_mono hxy.le + rcases eq_or_lt_of_le hle with he | hl + · have h2 : Int.fract x < Int.fract y := by + have h3 := Int.floor_add_fract x + have h4 := Int.floor_add_fract y + rw [he] at h3 + linarith + rw [he] + have := hm (hfm x) (hfm y) h2 + linarith + · have h2 : ((⌊x⌋ + 1 : ℤ) : ℝ) ≤ ⌊y⌋ := by exact_mod_cast hl + push_cast at h2 + have h3 := hm (hfm x) (show (1 : ℝ) ∈ Icc (0 : ℝ) 1 by simp) (Int.fract_lt_one x) + have h4 := hm.monotoneOn (show (0 : ℝ) ∈ Icc (0 : ℝ) 1 by simp) (hfm y) (Int.fract_nonneg y) + linarith + have hint : ∀ m : ℤ, t m = m + τ 0 := fun m => by + rw [hform] + simp + have hsurj : Surjective t := fun y => by + set k := ⌊y - τ 0⌋ with hk + have h2 : (k : ℝ) ≤ y - τ 0 := Int.floor_le _ + have h3 : y - τ 0 < k + 1 := Int.lt_floor_add_one _ + have h4 := hint k + have h5 := ht1 (k : ℝ) + obtain ⟨x, -, hx⟩ := intermediate_value_Icc (show (k : ℝ) ≤ k + 1 by linarith) ht.continuousOn + (show y ∈ Icc (t k) (t (k + 1)) by + rw [h5, h4] + exact ⟨by linarith, by linarith⟩) + exact ⟨x, hx⟩ + let e : ℝ ≃o ℝ := hmono.orderIsoOfSurjective t hsurj + have he : ∀ x, e x = t x := fun _ => rfl + have hs1 : ∀ x, e.symm (x + 1) = e.symm x + 1 := fun x => by + apply e.injective + rw [e.apply_symm_apply, he (e.symm x + 1), ht1, ← he, e.apply_symm_apply] + obtain ⟨H, hH, hH1⟩ := exists_circle_descend (g := fun x => ee (t x)) + (continuous_ee.comp ht) fun x => by + simp only [ht1, ee_add_one] + obtain ⟨H', hH', hH1'⟩ := exists_circle_descend (g := fun x => ee (e.symm x)) + (continuous_ee.comp e.symm.continuous) fun x => by simp only [hs1, ee_add_one] + let h : Circle ≃ₜ Circle := + { toFun := H + invFun := H' + left_inv := fun z => by + obtain ⟨x, rfl⟩ := ee_surjective z + simp only [hH1, hH1'] + rw [← he, e.symm_apply_apply] + right_inv := fun z => by + obtain ⟨x, rfl⟩ := ee_surjective z + simp only [hH1, hH1'] + rw [← he, e.apply_symm_apply] + continuous_toFun := hH + continuous_invFun := hH' } + refine ⟨h, ⟨fun x => 2 * Real.pi * t (x / (2 * Real.pi)), by fun_prop, ?_, ?_⟩, fun u hu => ?_⟩ + · intro x y hxy + have := hmono (div_lt_div_of_pos_right hxy (show 0 < 2 * Real.pi by positivity)) + simp only + nlinarith + · intro x + have h2 : H (Circle.exp x) = ee (t (x / (2 * Real.pi))) := by + have h3 : Circle.exp x = ee (x / (2 * Real.pi)) := by + unfold ee + rw [mul_div_cancel₀ _ (by positivity)] + rw [h3, hH1] + exact h2 + · change H (ee u) = ee (τ u) + rw [hH1] + rcases eq_or_lt_of_le hu.2 with rfl | h2 + · have := hform 1 + simp only [Int.floor_one, Int.fract_one, Int.cast_one] at this + rw [this, h1, add_comm] + · have := hform u + rw [fract_of_mem_Ico ⟨hu.1, h2⟩, Int.floor_eq_zero_iff.mpr ⟨hu.1, h2⟩] at this + simp only [Int.cast_zero, zero_add] at this + rw [this] + +/-- A cuff moves along a strictly increasing map of `[0, 1]` that gains one. -/ +theorem exists_move_loop {S : Type u} [TopologicalSpace S] (hS : IsSurface S) {C U : Set S} + (hC : IsCuff C) (hU : IsOpen U) + (hCU : C ⊆ U) (φ : Circle ≃ₜ C) {τ : ℝ → ℝ} (hc : ContinuousOn τ (Icc 0 1)) + (hm : StrictMonoOn τ (Icc 0 1)) + (h1 : τ 1 = τ 0 + 1) : + ∃ α : S ≃ₜ S, (∀ u ∈ Icc (0 : ℝ) 1, α (φ (ee u)).1 = (φ (ee (τ u))).1) ∧ ∀ x ∉ U, α x = x := by + obtain ⟨h, h2, h3⟩ := exists_circle_homeo hc hm h1 + obtain ⟨α, h4, h5⟩ := move_cuff S C U φ h hS hC hU hCU h2 + exact ⟨α, fun u hu => by rw [h4, h3 u hu], h5⟩ + +/-- A path in a circle lifts to the real line. -/ +theorem exists_lift {T : Type*} [TopologicalSpace T] {C : Set T} (φ : Circle ≃ₜ C) {η : ℝ → T} + (hc : ContinuousOn η (Icc 0 1)) (hη : ∀ u ∈ Icc (0 : ℝ) 1, η u ∈ C) : + ∃ m : ℝ → ℝ, ContinuousOn m (Icc 0 1) ∧ ∀ u ∈ Icc (0 : ℝ) 1, (φ (ee (m u))).1 = η u := by + have hpi := Real.pi_pos + let γ : C(unitInterval, Circle) := ⟨fun u => φ.symm ⟨η u.1, hη u.1 u.2⟩, by + refine φ.symm.continuous.comp (Continuous.subtype_mk ?_ _) + exact hc.comp_continuous continuous_subtype_val fun u => u.2⟩ + obtain ⟨Γ, h1, -⟩ := Circle.isCoveringMap_exp.exists_path_lifts γ (Complex.arg (γ 0)) + (Circle.exp_arg _).symm + let P : ℝ → unitInterval := projIcc 0 1 zero_le_one + have hP : Continuous P := continuous_projIcc + refine ⟨fun u => Γ (P u) / (2 * Real.pi), ((Γ.continuous.comp hP).div_const _).continuousOn, + fun u hu => ?_⟩ + have h2 : ee (Γ (P u) / (2 * Real.pi)) = γ (P u) := by + unfold ee + rw [mul_div_cancel₀ _ (by positivity)] + exact congrFun h1 (P u) + have hPu : (P u).1 = u := by simp [P, projIcc_of_mem zero_le_one hu] + change (φ (ee (Γ (P u) / (2 * Real.pi)))).1 = η u + rw [h2] + simp only [γ, ContinuousMap.coe_mk, Homeomorph.apply_symm_apply, hPu] + +/-- A lift of a line is strictly monotone. -/ +theorem lift_mono {m : ℝ → ℝ} (hc : ContinuousOn m (Icc 0 1)) (hi : InjOn (fun u => ee (m u)) + (Icc 0 1)) : + StrictMonoOn m (Icc 0 1) ∨ StrictAntiOn m (Icc 0 1) := + hc.strictMonoOn_of_injOn_Icc' zero_le_one fun _ hx _ hy he => hi hx hy (by simp only [he]) + +/-- A lift of a closed loop is strictly monotone. -/ +theorem lift_mono_loop {m : ℝ → ℝ} (hc : ContinuousOn m (Icc 0 1)) (hi : InjOn (fun u => ee (m u)) + (Ico 0 1)) : + StrictMonoOn m (Icc 0 1) ∨ StrictAntiOn m (Icc 0 1) := by + have key : ∀ {n : ℝ → ℝ}, ContinuousOn n (Icc 0 1) → InjOn n (Ico 0 1) → StrictMonoOn n (Icc 0 + (1 / 2)) → + StrictMonoOn n (Icc 0 1) := by + intro n hn hin hm + have hsub : ∀ b ∈ Ico (0 : ℝ) 1, Icc 0 b ⊆ Ico (0 : ℝ) 1 := fun b hb z hz + => ⟨hz.1, hz.2.trans_lt hb.2⟩ + have hIco : StrictMonoOn n (Ico 0 1) := by + intro x hx y hy hxy + set b := max y (1 / 2) with hb + have hb1 : b ∈ Ico (0 : ℝ) 1 := ⟨hy.1.trans (le_max_left _ _), max_lt hy.2 (by norm_num)⟩ + have hb2 : (1 / 2 : ℝ) ≤ b := le_max_right _ _ + have hxb : x ∈ Icc 0 b := ⟨hx.1, hxy.le.trans (le_max_left _ _)⟩ + have hyb : y ∈ Icc 0 b := ⟨hy.1, le_max_left _ _⟩ + rcases (hn.mono (Icc_subset_Icc_right hb1.2.le)).strictMonoOn_of_injOn_Icc' hb1.1 (hin.mono + (hsub b hb1)) with h | h + · exact h hxb hyb hxy + · have h1 := h (show (0 : ℝ) ∈ Icc 0 b from ⟨le_rfl, hb1.1⟩) (show + (1 / 2 : ℝ) ∈ Icc 0 b from ⟨by norm_num, hb2⟩) + (by norm_num) + have h2 := hm (show (0 : ℝ) ∈ Icc (0 : ℝ) (1 / 2) by norm_num) (show (1 / 2 : ℝ) ∈ Icc + (0 : ℝ) (1 / 2) by norm_num) + (by norm_num) + exact absurd h1 (not_lt.mpr h2.le) + intro x hx y hy hxy + rcases eq_or_lt_of_le hy.2 with rfl | hy1 + · have hx1 : x ∈ Ico (0 : ℝ) 1 := ⟨hx.1, hxy⟩ + have hmid : (x + 1) / 2 ∈ Ioo x 1 := ⟨by linarith, by linarith⟩ + have h1 : n x < n ((x + 1) / 2) := hIco hx1 ⟨by linarith [hx.1], hmid.2⟩ hmid.1 + refine h1.trans_le ?_ + have hw : ContinuousWithinAt n (Ioo ((x + 1) / 2) 1) 1 := + (hn 1 (by simp)).mono fun z hz => ⟨by linarith [hz.1, hx.1], hz.2.le⟩ + have hne : (nhdsWithin (1 : ℝ) (Ioo ((x + 1) / 2) 1)).NeBot := right_nhdsWithin_Ioo_neBot + hmid.2 + refine ge_of_tendsto hw (Filter.eventually_of_mem self_mem_nhdsWithin fun z hz => ?_) + exact (hIco ⟨by linarith [hx.1], hmid.2⟩ ⟨by linarith [hz.1, hx.1], hz.2⟩ hz.1).le + · exact hIco ⟨hx.1, hxy.trans hy1⟩ ⟨hy.1, hy1⟩ hxy + have hin : InjOn m (Ico 0 1) := fun _ hx _ hy he => hi hx hy (by simp only [he]) + have h12 : Icc (0 : ℝ) (1 / 2) ⊆ Ico (0 : ℝ) 1 := fun z hz => ⟨hz.1, hz.2.trans_lt (by norm_num)⟩ + rcases (hc.mono (Icc_subset_Icc_right (by norm_num))).strictMonoOn_of_injOn_Icc' (by norm_num) + (hin.mono h12) with h | h + · exact .inl (key hc hin h) + · have h2 := key (n := fun u => - m u) hc.neg (fun x hx y hy he => hin hx hy (neg_injective he)) + (fun x hx y hy hxy => neg_lt_neg (h hx hy hxy)) + exact .inr fun x hx y hy hxy => neg_lt_neg_iff.mp (h2 hx hy hxy) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CircleOrder.lean b/LeanPool/GraphMinor/Surface/CircleOrder.lean new file mode 100644 index 0000000000..767419719c --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CircleOrder.lean @@ -0,0 +1,97 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + + +module + +public import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# Positive cyclic order on the circle +-/ + +@[expose] public section + +namespace GraphMinor.CircleOrder + +/-- The positive cyclic order of three points of the circle: going around from `a` in the positive +direction, we reach `b` before `c`, and both before coming back to `a`. -/ +def CircleCyclic (a b c : Circle) : Prop := + ∃ s t : ℝ, 0 < s ∧ s < t ∧ t < 2 * Real.pi ∧ b = a * Circle.exp s ∧ c = a * Circle.exp t + +/-- Each point of the circle other than `1` has an angle strictly between `0` and `2π`. -/ +theorem exists_angle {z : Circle} (hz : z ≠ 1) : + ∃ s : ℝ, 0 < s ∧ s < 2 * Real.pi ∧ z = Circle.exp s := by + have harg : Circle.exp (Complex.arg z) = z := Circle.exp_arg z + have h0 : Complex.arg z ≠ 0 := fun h ↦ hz (by rw [← harg, h, Circle.exp_zero]) + have hlo := Complex.neg_pi_lt_arg (z : ℂ) + have hhi := Complex.arg_le_pi (z : ℂ) + have hpi := Real.pi_pos + rcases lt_or_gt_of_ne h0 with h | h + · refine ⟨Complex.arg z + 2 * Real.pi, by linarith, by linarith, ?_⟩ + rw [Circle.exp_add, Circle.exp_two_pi, mul_one, harg] + · exact ⟨Complex.arg z, h, by linarith, harg.symm⟩ + +/-- Three distinct points of the circle occur in one of the two cyclic orders. -/ +theorem circleCyclic_or {a b c : Circle} (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) : + CircleCyclic a b c ∨ CircleCyclic a c b := by + obtain ⟨s, hs0, hs1, hs⟩ := exists_angle (z := a⁻¹ * b) (fun h ↦ hab (by + rw [inv_mul_eq_one] at h + exact h)) + obtain ⟨t, ht0, ht1, ht⟩ := exists_angle (z := a⁻¹ * c) (fun h ↦ hac (by + rw [inv_mul_eq_one] at h + exact h)) + have hb : b = a * Circle.exp s := by rw [← hs]; simp + have hc : c = a * Circle.exp t := by rw [← ht]; simp + rcases lt_trichotomy s t with h | h | h + · exact Or.inl ⟨s, t, hs0, h, ht1, hb, hc⟩ + · exact absurd (by rw [hb, hc, h]) hbc + · exact Or.inr ⟨t, s, ht0, h, hs1, hc, hb⟩ + +theorem exp_eq_of_angles {s t : ℝ} (hs : 0 < s) (hs' : s < 2 * Real.pi) (ht : 0 < t) + (ht' : t < 2 * Real.pi) (h : Circle.exp s = Circle.exp t) : s = t := by + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.1 h + have hpi := Real.pi_pos + have h1 : (m : ℝ) * (2 * Real.pi) < 2 * Real.pi := by linarith + have h2 : -(2 * Real.pi) < (m : ℝ) * (2 * Real.pi) := by linarith + have h3 : (m : ℝ) < 1 := by nlinarith + have h4 : (-1 : ℝ) < m := by nlinarith + have h5 : m = 0 := by + have h6 : m < 1 := by exact_mod_cast h3 + have h7 : -1 < m := by exact_mod_cast h4 + omega + rw [hm, h5] + simp + +/-- Three points of the circle do not lie in both cyclic orders. -/ +theorem not_circleCyclic_both {a b c : Circle} (h : CircleCyclic a b c) + (h' : CircleCyclic a c b) : False := by + obtain ⟨s, t, hs, hst, ht, hb, hc⟩ := h + obtain ⟨s', t', hs', hst', ht', hc', hb'⟩ := h' + have h1 : Circle.exp s = Circle.exp t' := mul_left_cancel (hb.symm.trans hb') + have h2 : Circle.exp t = Circle.exp s' := mul_left_cancel (hc.symm.trans hc') + have hpos : 0 < t' := hs'.trans hst' + have hpos' : 0 < t := hs.trans hst + have e1 := exp_eq_of_angles hs (hst.trans ht) hpos ht' h1 + have e2 := exp_eq_of_angles hpos' ht hs' (hst'.trans ht') h2 + linarith + +theorem circleCyclic_inv {a b c : Circle} (h : CircleCyclic a b c) : + CircleCyclic a⁻¹ c⁻¹ b⁻¹ := by + obtain ⟨s, t, hs, hst, ht, rfl, rfl⟩ := h + have hpi := Real.pi_pos + refine ⟨2 * Real.pi - t, 2 * Real.pi - s, by linarith, by linarith, by linarith, ?_, ?_⟩ + · rw [Circle.exp_sub, Circle.exp_two_pi] + simp [mul_comm] + · rw [Circle.exp_sub, Circle.exp_two_pi] + simp [mul_comm] + +theorem exists_angle_of_circle (a : Circle) : ∃ α : ℝ, a = Circle.exp α := + ⟨Complex.arg a, (Circle.exp_arg a).symm⟩ + +end GraphMinor.CircleOrder diff --git a/LeanPool/GraphMinor/Surface/Classification.lean b/LeanPool/GraphMinor/Surface/Classification.lean new file mode 100644 index 0000000000..76257063d7 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Classification.lean @@ -0,0 +1,202 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ModelHomeo +public import LeanPool.GraphMinor.Surface.ModelWord +public import LeanPool.GraphMinor.Surface.OneWord +public import LeanPool.GraphMinor.Surface.SurfacePull +public import LeanPool.GraphMinor.Surface.WordIso + +/-! +# Classification of surfaces + +Each connected surface is homeomorphic to a model (`classification`). We cap the surface, dissect +the closed surface +around the cuffs, restrict the dissection to the surface, read off one word, bring the word to its +normal form +and compare with the word of the model. This is the proof of Seifert and Threlfall, *Lehrbuch der +Topologie*, Chapter 6, +with the dissection built by hand instead of quoting a triangulation. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +variable {S : Type u} [TopologicalSpace S] + +theorem sUnion_cuffs : ⋃₀ cuffs S = bd S := by + apply subset_antisymm + · rintro x ⟨_, ⟨y, hy, rfl⟩, hx⟩ + exact connectedComponentIn_subset _ _ hx + · intro x hx + exact ⟨_, ⟨x, hx, rfl⟩, mem_connectedComponentIn hx⟩ + +theorem cuffs_disjoint {C C' : Set S} (hC : C ∈ cuffs S) (hC' : C' ∈ cuffs S) + (hne : C ≠ C') : Disjoint C C' := by + obtain ⟨x, hx, rfl⟩ := hC + obtain ⟨y, hy, rfl⟩ := hC' + rw [Set.disjoint_left] + intro z h1 h2 + exact hne ((connectedComponentIn_eq h1).trans (connectedComponentIn_eq h2).symm) + +variable [T2Space S] + +/-- The cuffs of a surface as a graph. -/ +theorem exists_cuff_graph (hS : IsSurface S) : + ∃ (V : Set S) (E : Set (Set S)), IsGraph V E ∧ V ⊆ ⋃₀ E ∧ ⋃₀ E = bd S := by + classical + have hfin := (cuff_statement.{u} S hS).2.1 + have hO := (cuff_statement.{u} S hS).2.2 + have key : ∀ 𝓐 : Set (Set S), 𝓐.Finite → 𝓐 ⊆ cuffs S → + ∃ (V : Set S) (E : Set (Set S)), IsGraph V E ∧ V ⊆ ⋃₀ E ∧ gr V E = ⋃₀ 𝓐 := by + intro 𝓐 h𝓐 + induction 𝓐, h𝓐 using Set.Finite.induction_on with + | empty => + intro _ + exact ⟨∅, ∅, isGraph_empty, by simp, by simp [gr]⟩ + | @insert C 𝓐 hC _ ih => + intro hsub + obtain ⟨V, E, hg, hV, hgr⟩ := ih ((subset_insert _ _).trans hsub) + have hCc : C ∈ cuffs S := hsub (mem_insert _ _) + have hdisj : C \ gr V E = C := by + rw [hgr] + refine Disjoint.sdiff_eq_left (Set.disjoint_left.mpr ?_) + rintro z hz ⟨C', hC', hz'⟩ + have hne : C ≠ C' := fun h => hC (h ▸ hC') + exact Set.disjoint_left.mp (cuffs_disjoint hCc (hsub (mem_insert_of_mem _ hC')) hne) hz hz' + have hconn : FinConn (C \ gr V E) := by + rw [hdisj] + exact ⟨{C}, finite_singleton _, fun J hJ => by + rw [mem_singleton_iff.mp hJ] + exact (hO C hCc).isPreconnected, sUnion_singleton _⟩ + obtain ⟨V', E', -, hg', hgr', hV'⟩ := hg.add_curve (hO C hCc) hconn + refine ⟨V', E', hg', hV' hV, ?_⟩ + rw [hgr', hgr, sUnion_insert, union_comm] + obtain ⟨V, E, hg, hV, hgr⟩ := key _ hfin subset_rfl + refine ⟨V, E, hg, hV, ?_⟩ + rw [← sUnion_cuffs, ← hgr] + exact (union_eq_right.mpr hV).symm + +theorem TwoConn.sUnion_add {X : Type u} [TopologicalSpace X] {G : Set X} (hG : TwoConn G) {𝓐 : Set + (Set X)} (h𝓐 : 𝓐.Finite) + (hc : ∀ C ∈ 𝓐, TwoConn C) (hm : ∀ C ∈ 𝓐, ∃ x y, x ∈ G ∩ C ∧ y ∈ G ∩ C ∧ x ≠ y) : TwoConn + (G ∪ ⋃₀ 𝓐) := by + induction 𝓐, h𝓐 using Set.Finite.induction_on with + | empty => simpa using hG + | @insert C 𝓐 _ _ ih => + have h1 := ih (fun D hD => hc D (mem_insert_of_mem _ hD)) (fun D hD => hm D + (mem_insert_of_mem _ hD)) + obtain ⟨x, y, hx, hy, hxy⟩ := hm C (mem_insert _ _) + have h2 := h1.union (hc C (mem_insert _ _)) (x := x) (y := y) ⟨.inl hx.1, hx.2⟩ ⟨.inl hy.1, + hy.2⟩ hxy + have e : G ∪ ⋃₀ insert C 𝓐 = G ∪ ⋃₀ 𝓐 ∪ C := by + rw [sUnion_insert, union_assoc, union_comm C] + rwa [e] + +/-- A dissection of each connected surface. -/ +theorem exists_surface_dissection (hS : IsSurface S) [ConnectedSpace S] : + ∃ (V : Set S) (E 𝓕 : Set (Set S)), IsDissection V E 𝓕 := by + classical + obtain ⟨hcpt, -, hman⟩ := id hS + obtain ⟨T, _, j, K, hT, hj, hK, hu, hi, hconn⟩ := exists_capAll S hS + have := hconn inferInstance + have : T2Space T := hT.2.1 + have hfin := (cuff_statement.{u} S hS).2.1 + have hO := (cuff_statement.{u} S hS).2.2 + obtain ⟨V₀, E₀, hg, hV₀, hE₀⟩ := exists_cuff_graph hS + have hgT := hg.map hj.isEmbedding + have hsU : ⋃₀ ((fun e => j '' e) '' E₀) = j '' bd S := by + rw [sUnion_image, ← image_iUnion₂, ← sUnion_eq_biUnion, hE₀] + obtain ⟨ρ, hρ, hl⟩ := exists_inv_of_compactOn (isCompact_univ (X := S)) hj.continuous.continuousOn + hj.injective.injOn + have hOT : ∀ C ∈ cuffs S, IsOArc (j '' C) := fun C hC => + (hO C hC).image hj.continuous.continuousOn (hρ.mono (image_mono (subset_univ _))) + (fun x _ => hl (mem_univ x)) + obtain ⟨V, E, 𝓕, -, hsub, hd⟩ := exists_dissection hT hgT (image_mono hV₀ |>.trans (by + rintro _ ⟨y, ⟨e, he, hy⟩, rfl⟩ + exact ⟨_, ⟨e, he, rfl⟩, mem_image_of_mem j hy⟩)) (𝓒c := (fun C => j '' C) '' cuffs S) + (hfin.image _) + (by + rintro _ ⟨C, hC, rfl⟩ + exact (hOT C hC).twoConn) + (by + rintro _ ⟨C, hC, rfl⟩ + exact (hOT C hC).exists_three) + (by + intro G hG hm + rw [hsU, ← sUnion_cuffs, sUnion_eq_biUnion, image_iUnion₂, ← sUnion_image] + exact hG.sUnion_add (hfin.image _) (by + rintro _ ⟨C, hC, rfl⟩ + exact (hOT C hC).twoConn) hm) + rw [hsU] at hsub + exact ⟨_, _, _, pull_dissection hman hj hK hu hi hd hsub⟩ + +/-- **Classification of surfaces, first part.** -/ +theorem classification : ClassificationStatement.{u} := by + classical + intro S _ hS hconn + obtain ⟨hcpt, ht2, hman⟩ := id hS + obtain ⟨V, E, 𝓕, hd⟩ := exists_surface_dissection hS + have hne : 𝓕.Nonempty := by + rw [nonempty_iff_ne_empty] + rintro rfl + obtain ⟨x⟩ : Nonempty S := inferInstance + have := hd.cover + simp at this + exact (eq_empty_iff_forall_notMem.mp this.symm x (mem_univ _)) + obtain ⟨W, f, I, hW, h0, hf, hlen, hI, hcount⟩ := exists_family hman hd hne + obtain ⟨w, g, hw, hG, hg⟩ := exists_one_word (X := S) _ I W f rfl hW h0 hf hlen hI hcount + have toModel : ∀ (a b c : ℕ) (w' : List Letter), WEq.{u} w w' → + PEq.{u} (modelW a b (2 * a + b + c)) (sW w') → ∃ a b c, Nonempty (S ≃ₜ SurfaceModel a b c) + := by + intro a b c w' h1 h2 + obtain ⟨g', hg'⟩ := ((show PEq.{u} (sW w) (sW w') from h1).trans h2.symm S).mp ⟨g, hg⟩ + exact ⟨a, b, c, model_homeo a b c hg'⟩ + have sphere : ∀ x : Letter, WEq.{u} w [x, linv x] → ∃ a b c, Nonempty (S ≃ₜ SurfaceModel a b c) + := by + intro x hx + obtain ⟨w', hp, h3⟩ := exists_modelW_nf.{u} 0 0 0 + rcases h3 with ⟨-, h4⟩ | ⟨-, rfl⟩ + · exact absurd rfl h4 + · refine toModel 0 0 0 _ (hx.trans ?_) hp + refine Iso.weq ⟨fun _ => 0, fun _ => x.2, ?_, ?_⟩ + · intro l hl l' hl' _ + have e1 : l.1 = x.1 := by + simp only [List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl <;> rfl + have e2 : l'.1 = x.1 := by + simp only [List.mem_cons, List.not_mem_nil, or_false] at hl' + rcases hl' with rfl | rfl <;> rfl + rw [e1, e2] + · obtain ⟨k, e⟩ := x + cases e <;> simp [linv, segL] + rcases exists_nf.{u} hw hG with ⟨a, b, c, w', hnf, hwe⟩ | ⟨x, hx⟩ + · obtain ⟨w'', hp, h3⟩ := exists_modelW_nf.{u} a b c + rcases h3 with ⟨hnf', -⟩ | ⟨h0', rfl⟩ + · exact toModel a b c w'' (hwe.trans (nf_eq hnf hnf')) hp + · obtain ⟨rfl, rfl, rfl⟩ : a = 0 ∧ b = 0 ∧ c = 0 := by omega + obtain ⟨X, Y, Z, rfl, h1, h2, h3, -⟩ := hnf + cases h1 + cases h2 + cases h3 + obtain ⟨g', hg'⟩ := ((show PEq.{u} (sW w) (sW ([] ++ [] ++ [])) from hwe) S).mp ⟨g, hg⟩ + obtain ⟨x⟩ : Nonempty S := inferInstance + have h4 : x ∈ g' '' Dsk (sW ([] ++ [] ++ [])) := hg'.2.1 ▸ mem_univ x + obtain ⟨y, hy, -⟩ := h4 + exact absurd (by + simp [sW, nW, Function.update] ) hy.1 + · exact sphere x hx + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CohCard.lean b/LeanPool/GraphMinor/Surface/CohCard.lean new file mode 100644 index 0000000000..566c4fec28 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CohCard.lean @@ -0,0 +1,132 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CohExist + +/-! +# The number of classes of a model surface + +`card_kCl` counts the classes of a space presented by the word `ew a b c`. With coefficients in +`ZMod 2` their number +is `2 ^ (2 * a + b)`. With coefficients in `ZMod 3` it is `3 ^ (2 * a)` if `b = 0`, and `3 ^ (2 * a ++ b - 1)` otherwise. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +variable {a b c : ℕ} {Y : Type u} [TopologicalSpace Y] {f : ℕ × ℂ → Y} {A : Type} [AddCommGroup A] + +/-- Values on the labels of the handles and of the cross-caps. -/ +abbrev LamT (a b : ℕ) (A : Type) [AddCommGroup A] : Type := + (Fin (2 * a) → A) × {μ : Fin b → A // (2 : ℕ) • ∑ i, μ i = 0} + +theorem card_kCl [T2Space Y] [Finite A] (hf : Presents (sW (ew a b c)) f) : + Nat.card (KCl Y A) = Nat.card (LamT a b A) := by + classical + have hex : ∀ φ : KSet Y A, ∃ g, IsPrim φ.1 (pmap f) g := fun φ => exists_prim φ.2.1 (pmap_cont hf) + choose G hG using hex + have hsum : ∀ φ : KSet Y A, (2 : ℕ) • ∑ i : Fin b, lval a b c (G φ) (2 * a + i) = 0 := by + intro φ + have h1 := Sm_prim hf (hG φ) + rw [Sm_total] at h1 + have h2 : ∑ l ∈ Finset.range c, lval a b c (G φ) (2 * a + b + 2 * l + 1) = 0 := by + refine Finset.sum_eq_zero fun l hl => ?_ + have hl' := Finset.mem_range.mp hl + have e : lab a b c (4 * a + 2 * b + 3 * l + 1) = 2 * a + b + 2 * l + 1 := lab_t hl' (by omega) + rw [← e, ← volt_eq hf (hG φ) (by omega), volt_free hf φ.2.2 (hG φ) hl'] + rw [h2, add_zero, Finset.sum_range] at h1 + exact h1 + let T : KSet Y A → LamT a b A := fun φ => + (fun i => lval a b c (G φ) i, ⟨fun i => lval a b c (G φ) (2 * a + i), hsum φ⟩) + have hT : ∀ φ φ' : KSet Y A, (kSetoid Y A).r φ φ' → T φ = T φ' := by + intro φ φ' h + refine Prod.ext (funext fun i => ?_) (Subtype.ext (funext fun i => ?_)) + · exact lval_rel hf (hG φ) (hG φ') h (by omega) + · exact lval_rel hf (hG φ) (hG φ') h (by omega) + let T' : KCl Y A → LamT a b A := Quotient.lift T hT + refine Nat.card_eq_of_bijective T' ⟨?_, ?_⟩ + · intro x y he + obtain ⟨φ, rfl⟩ := Quotient.exists_rep x + obtain ⟨φ', rfl⟩ := Quotient.exists_rep y + have he' : T φ = T φ' := he + refine Quotient.sound (cohRel_of_lval hf φ.2.1 φ'.2.1 φ.2.2 φ'.2.2 (hG φ) (hG φ') fun k hk + => ?_) + by_cases h : k < 2 * a + · exact congrFun (congrArg Prod.fst he') ⟨k, h⟩ + · have h1 := congrFun (congrArg (fun x : LamT a b A => x.2.1) he') ⟨k - 2 * a, by omega⟩ + have e : 2 * a + (k - 2 * a) = k := by omega + simp only [T, e] at h1 + exact h1 + · rintro ⟨l, μ, hμ⟩ + let V : ℕ → A := fun k => if h : k < 2 * a then l ⟨k, h⟩ else if h' : k - 2 * a < b then μ ⟨k - + 2 * a, h'⟩ else 0 + have hV1 : ∀ i : Fin (2 * a), V i = l i := fun i => by simp [V] + have hV2 : ∀ i : Fin b, V (2 * a + i) = μ i := fun i => by simp [V] + have hV3 : ∀ i, V (2 * a + b + 2 * i + 1) = 0 := fun i => by + have h1 : ¬ 2 * a + b + 2 * i + 1 < 2 * a := by omega + have h2 : ¬ 2 * a + b + 2 * i + 1 - 2 * a < b := by omega + simp only [V, h1, h2, dite_false] + have hS : Sm a b c V (4 * a + 2 * b + 3 * c + 2) = 0 := by + rw [Sm_total, Finset.sum_eq_zero (s := Finset.range c) fun i _ => hV3 i, add_zero, + Finset.sum_range] + simp only [hV2] + exact hμ + obtain ⟨φ, g, h1, h2, h3, h4⟩ := exists_class hf V hS fun i _ => hV3 i + refine ⟨Quotient.mk _ ⟨φ, h1, h2⟩, ?_⟩ + have h5 : ∀ k < 2 * a + b, lval a b c (G ⟨φ, h1, h2⟩) k = V k := fun k hk => by + rw [lval_rel hf (hG ⟨φ, h1, h2⟩) h3 (.refl φ) hk, h4 k (by omega)] + change T ⟨φ, h1, h2⟩ = _ + refine Prod.ext (funext fun i => ?_) (Subtype.ext (funext fun i => ?_)) + · change lval a b c _ i = l i + rw [h5 _ (by omega), hV1] + · change lval a b c _ (2 * a + i) = μ i + rw [h5 _ (by omega), hV2] + +theorem card_fin_fun (n p : ℕ) [NeZero p] : Nat.card (Fin n → ZMod p) = p ^ n := by + simp [Nat.card_eq_fintype_card, ZMod.card] + +theorem card_lam_two (a b : ℕ) : Nat.card (LamT a b (ZMod 2)) = 2 ^ (2 * a + b) := by + have hz : ∀ x : ZMod 2, (2 : ℕ) • x = 0 := by decide + let e : {μ : Fin b → ZMod 2 // (2 : ℕ) • ∑ i, μ i = 0} ≃ (Fin b → ZMod 2) := + ⟨fun μ => μ.1, fun μ => ⟨μ, hz _⟩, fun _ => rfl, fun _ => rfl⟩ + rw [Nat.card_prod, Nat.card_congr e, card_fin_fun, card_fin_fun, pow_add] + +theorem card_lam_three_zero (a : ℕ) : Nat.card (LamT a 0 (ZMod 3)) = 3 ^ (2 * a) := by + have : Nat.card {μ : Fin 0 → ZMod 3 // (2 : ℕ) • ∑ i, μ i = 0} = 1 := by + refine Nat.card_eq_one_iff_unique.mpr ⟨⟨fun x y => Subtype.ext (funext fun i => i.elim0)⟩, + ⟨⟨fun i => i.elim0, by simp⟩⟩⟩ + rw [Nat.card_prod, this, card_fin_fun, mul_one] + +theorem card_lam_three_succ (a b : ℕ) : Nat.card (LamT a (b + 1) (ZMod 3)) = 3 ^ (2 * a + b) := by + have hz : ∀ x : ZMod 3, (2 : ℕ) • x = 0 → x = 0 := by decide + let e : {μ : Fin (b + 1) → ZMod 3 // (2 : ℕ) • ∑ i, μ i = 0} ≃ (Fin b → ZMod 3) := + { toFun := fun μ => fun i => μ.1 i.succ + invFun := fun ν => ⟨Fin.cons (-∑ i, ν i) ν, by simp [Fin.sum_univ_succ]⟩ + left_inv := fun μ => by + apply Subtype.ext + funext i + refine Fin.cases ?_ (fun j => ?_) i + · have h1 := hz _ μ.2 + rw [Fin.sum_univ_succ] at h1 + simp only [Fin.cons_zero] + exact (eq_neg_of_add_eq_zero_left h1).symm ▸ rfl + · simp + right_inv := fun ν => by + funext i + simp } + rw [Nat.card_prod, Nat.card_congr e, card_fin_fun, card_fin_fun, pow_add] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CohCount.lean b/LeanPool/GraphMinor/Surface/CohCount.lean new file mode 100644 index 0000000000..6c316ca784 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CohCount.lean @@ -0,0 +1,247 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CohPrim + +/-! +# The classes of the normal word + +Let `Y` be presented by the word `ew a b c`. A class in `KCl Y A` is given by the values of its +primitive on the labels +of the handles and of the cross-caps. These values are free, except that twice the sum on the +cross-caps vanishes +(`card_kCl`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +variable {a b c : ℕ} {Y : Type u} [TopologicalSpace Y] {f : ℕ × ℂ → Y} {A : Type} [AddCommGroup A] + +theorem pmap_cont (hf : Presents (sW (ew a b c)) f) : ContinuousOn (pmap f) (closedBall 0 1) := + hf.1.comp (by fun_prop) fun z hz => ⟨(ew_mem_dsk a b c).1, by simpa using hz⟩ + +theorem mem_dsk_ew {x : ℕ × ℂ} (h : x ∈ Dsk (sW (ew a b c))) : x.1 = 0 ∧ x.2 ∈ closedBall (0 : ℂ) 1 + := by + obtain ⟨i, z⟩ := x + refine ⟨?_, by simpa using h.2⟩ + by_contra hi + exact h.1 (by simp [sW, show i ≠ 0 from hi, nW]) + +theorem pmap_image (hf : Presents (sW (ew a b c)) f) : pmap f '' closedBall 0 1 = univ := by + refine eq_univ_of_forall fun y => ?_ + have h1 : y ∈ f '' Dsk (sW (ew a b c)) := by + rw [hf.2.1] + exact mem_univ y + obtain ⟨⟨i, z⟩, hz, rfl⟩ := h1 + obtain ⟨h2, h3⟩ := mem_dsk_ew hz + simp only at h2 h3 + subst h2 + exact ⟨z, h3, rfl⟩ + +theorem freeSide_hole {i : ℕ} (hi : i < c) : FreeSide (sW (ew a b c)) 0 (4 * a + 2 * b + 3 * i + 1) + := by + intro j q k e e' h1 h2 + obtain ⟨rfl, h3⟩ := sW_get h2 + rw [sW_zero] at h1 + obtain ⟨hp, hl, -⟩ := (ew_get_iff _ _ _ _ _ _).mp h1 + obtain ⟨hq, hl', -⟩ := (ew_get_iff _ _ _ _ _ _).mp h3 + have ht := (twin_eq_iff hp).mpr ⟨i, hi, rfl⟩ + rcases lab_two hp hq (hl.trans hl'.symm) with h4 | h4 + · rw [h4] + · rw [h4, ht] + +theorem twin_of_free {p : ℕ} (hp : p < 4 * a + 2 * b + 3 * c + 2) (hfr : FreeSide (sW + (ew a b c)) 0 p) : + twin a b c p = p := by + have h1 := hfr 0 (twin a b c p) (lab a b c p) (sgn a b c p) (sgn a b c (twin a b c p)) + (by rw [sW_zero]; exact ew_get a b c hp) (by + rw [sW_zero, ← lab_twin hp] + exact ew_get a b c (twin_lt hp)) + exact (Prod.mk.inj h1).2.symm + +/-- On a free side, the change of a primitive of a class that vanishes on the boundary is zero. -/ +theorem volt_free [T2Space Y] {φ : Y → Y → A} {g : ℂ → A} (hf : Presents (sW (ew a b c)) f) + (hφ : BdTriv φ) + (hg : IsPrim φ (pmap f) g) {i : ℕ} (hi : i < c) : volt a b c g (4 * a + 2 * b + 3 * i + 1) = 0 + := by + obtain ⟨h, N, hN, hbd⟩ := hφ + obtain ⟨ε, h0, h1⟩ := hg + simp only [neg_add_eq_sub] at hbd h1 + obtain ⟨ε', h0', h2⟩ := exists_eps (isCompact_closedBall 0 1) (pmap_cont hf) hN + have hs := (surface_of_presents (finW_sW _) (isPaired_ew a b c) hf).2 + set r := 4 * a + 2 * b + 3 * i + 1 with hr + set n := 4 * a + 2 * b + 3 * c + 2 with hn + have hrn : r < n := by omega + have hb : ∀ u ∈ Icc (0 : ℝ) 1, pmap f (per n (r + u)) ∈ bd Y := by + intro u hu + rw [hs] + refine ⟨spt (sW (ew a b c)) 0 r u, ⟨0, r, u, ?_, freeSide_hole hi, hu, rfl⟩, ?_⟩ + · rw [sW_zero, ew_length] + exact hrn + · rw [spt_ew] + rfl + let v : ℝ → A := fun u => g (per n (r + u)) - h (pmap f (per n (r + u))) + have hδ : 0 < min ε ε' / 9 := by positivity + have hc := const_of_near (v := v) hδ (fun s hs' t ht hst => by + have hlip : ∀ x y : ℝ, |x - y| < min ε ε' / 9 → ‖per n (r + x) - per n (r + y)‖ < min ε ε' := by + intro x y hxy + have h3 := norm_per_sub (show 0 < n by omega) (r + x) (r + y) + rw [show (r : ℝ) + x - (r + y) = x - y by ring] at h3 + have : 0 < min ε ε' := by positivity + linarith + have h3 := hlip t s (by rwa [abs_sub_comm]) + have e1 := h1 _ (mem_ball_per n (r + t)) _ (mem_ball_per n (r + s)) (lt_of_lt_of_le h3 + (min_le_left _ _)) + have e2 := hbd _ (hb t ht) _ (hb s hs') (h2 _ (mem_ball_per n (r + t)) _ (mem_ball_per n + (r + s)) + (lt_of_lt_of_le h3 (min_le_right _ _))) + rw [e1] at e2 + simp only [v] + rw [sub_eq_iff_eq_add] at e2 ⊢ + rw [e2] + abel) + have h3 := hc 1 ⟨zero_le_one, le_rfl⟩ + simp only [v] at h3 + have e0 : per n (r + (0 : ℝ)) = cor a b c r := by simp [cor, hn] + have e1 : per n (r + (1 : ℝ)) = cor a b c (r + 1) := by simp [cor, hn] + rw [e0, e1] at h3 + have e2 : pmap f (cor a b c (r + 1)) = pmap f (cor a b c r) := hole_cor hf hi + rw [e2] at h3 + have hst : st a b c r = r := by + simp only [st, hr, sgn_t hi (by omega : 1 < 3)] + rfl + have hen : en a b c r = r + 1 := by + simp only [en, hr, sgn_t hi (by omega : 1 < 3)] + rfl + rw [volt, hst, hen] + exact sub_eq_zero.mpr (sub_left_inj.mp h3) + +theorem loop_st_en (hf : Presents (sW (ew a b c)) f) {p : ℕ} (hp : p < 4 * a + 2 * b) : + pmap f (cor a b c (en a b c p)) = pmap f (cor a b c (st a b c p)) := by + unfold en st + by_cases h : sgn a b c p + · rw [ite_eq_left h, ite_eq_left h] + exact loop_cor hf hp + · rw [ite_eq_right h, ite_eq_right h] + exact (loop_cor hf hp).symm + +theorem rep_lt' {k : ℕ} (hk : k < 2 * a + b) : rep a b c k < 4 * a + 2 * b := by + unfold rep + split_ifs <;> omega + +/-- Equivalent local cocycles have the same values on the labels of the handles and of the +cross-caps. -/ +theorem lval_rel {φ φ' : Y → Y → A} {g g' : ℂ → A} (hf : Presents (sW (ew a b c)) f) (hg : IsPrim φ + (pmap f) g) + (hg' : IsPrim φ' (pmap f) g') (hr : CohRel φ φ') {k : ℕ} (hk : k < 2 * a + b) : + lval a b c g k = lval a b c g' k := by + obtain ⟨h, N, hN, hrel⟩ := hr + have h2 := hg.of_rel (pmap_cont hf) hN hrel + set x := cor a b c (st a b c (rep a b c k)) with hx + set y := cor a b c (en a b c (rep a b c k)) with hy + have h3 : g' y - g' x = (g y - h (pmap f y)) - (g x - h (pmap f x)) := by + have h5 := hg'.sub_eq h2 (a := x) (b := y) (mem_ball_per _ _) (mem_ball_per _ _) + simpa only [neg_add_eq_sub] using h5 + have h4 : pmap f y = pmap f x := loop_st_en hf (rep_lt' (c := c) hk) + rw [lval, lval, volt, volt, ← hx, ← hy, h3, h4] + abel + +/-- Two local cocycles with the same values on the labels of the handles and of the cross-caps are +equivalent, if both +vanish on the boundary. -/ +theorem cohRel_of_lval [T2Space Y] {φ φ' : Y → Y → A} {g g' : ℂ → A} (hf : Presents (sW + (ew a b c)) f) (hφ : IsCoc φ) + (hφ' : IsCoc φ') (hb : BdTriv φ) (hb' : BdTriv φ') (hg : IsPrim φ (pmap f) g) (hg' : IsPrim φ' + (pmap f) g') + (he : ∀ k < 2 * a + b, lval a b c g k = lval a b c g' k) : CohRel φ φ' := by + set n := 4 * a + 2 * b + 3 * c + 2 with hn + let V : ℕ → A := fun k => lval a b c g k - lval a b c g' k + have hSm : ∀ j, Sm a b c V j = Sm a b c (lval a b c g) j - Sm a b c (lval a b c g') j := by + intro j + simp only [Sm, ← Finset.sum_sub_distrib] + refine Finset.sum_congr rfl fun i _ => ?_ + simp only [lv, V] + split_ifs <;> abel + let d : ℂ → A := fun z => g z - g' z + have hdc : ∀ j ≤ n, d (cor a b c j) = d (cor a b c 0) + Sm a b c V j := by + intro j hj + simp only [d] + rw [g_cor hf hg hj, g_cor hf hg' hj, hSm] + abel + have hV1 : ∀ k < 2 * a + b, V k = 0 := fun k hk => sub_eq_zero.mpr (he k hk) + have hV2 : ∀ i < c, V (2 * a + b + 2 * i + 1) = 0 := by + intro i hi + have e : lab a b c (4 * a + 2 * b + 3 * i + 1) = 2 * a + b + 2 * i + 1 := lab_t hi (by omega) + have hp : 4 * a + 2 * b + 3 * i + 1 < n := by omega + simp only [V] + rw [← e, ← volt_eq hf hg hp, ← volt_eq hf hg' hp, volt_free hf hb hg hi, + volt_free hf hb' hg' hi, sub_zero] + have hpair : ∀ p q, p < n → q < n → p ≠ q → lab a b c p = lab a b c q → ∀ u ∈ Icc (0 : ℝ) 1, + d (per n (q + flp (sgn a b c p) (sgn a b c q) u)) = d (per n (p + u)) := by + intro p q hp hq hne hl u hu + obtain ⟨c₁, h1⟩ := side_const hf hg hp hq hne hl + obtain ⟨c₂, h2⟩ := side_const hf hg' hp hq hne hl + have ht1 : twin a b c p ≠ p := by + intro ht + rcases lab_two hp hq hl with h3 | h3 + · exact hne h3.symm + · exact hne (ht.symm.trans h3.symm) + have ht2 : twin a b c q ≠ q := by + intro ht + rcases lab_two hq hp hl.symm with h3 | h3 + · exact hne h3 + · exact hne (h3.trans ht) + have h3 := hdc _ (st_lt hp) + have h4 := hdc _ (st_lt hq) + rw [Sm_st_zero V hV1 hV2 hp ht1, add_zero] at h3 + rw [Sm_st_zero V hV1 hV2 hq ht2, add_zero] at h4 + have h5 := h1 _ (ofs_mem' (e := sgn a b c p) (t := 0) (.inl rfl)) + have h6 := h2 _ (ofs_mem' (e := sgn a b c p) (t := 0) (.inl rfl)) + rw [flp_ofs, per_st, per_st] at h5 h6 + have h7 : c₁ - c₂ = 0 := by + have h8 : d (cor a b c (st a b c q)) = d (cor a b c (st a b c p)) + (c₁ - c₂) := by + simp only [d] + rw [h5, h6] + abel + rw [h3, h4] at h8 + exact (add_eq_left.mp h8.symm) + have h9 : c₁ = c₂ := sub_eq_zero.mp h7 + simp only [d] + rw [h1 u hu, h2 u hu, h9] + abel + have hstp : ∀ x y, Stp (sW (ew a b c)) x y → d x.2 = d y.2 := by + intro x y hs + obtain ⟨i, j, p, q, k, e, e', u, h1, h2, h3, hu, rfl, rfl⟩ := stp_iff.mp hs + obtain ⟨rfl, h4⟩ := sW_get h1 + obtain ⟨rfl, h5⟩ := sW_get h2 + obtain ⟨hp, hl, rfl⟩ := (ew_get_iff _ _ _ _ _ _).mp h4 + obtain ⟨hq, hl', rfl⟩ := (ew_get_iff _ _ _ _ _ _).mp h5 + have h6 := hpair p q hp hq (fun he => h3 (by rw [he])) (hl.trans hl'.symm) u hu + rw [spt_ew, spt_ew] + exact h6.symm + have hprel : ∀ x y, PRel (sW (ew a b c)) x y → d x.2 = d y.2 := by + intro x y hxy + induction hxy with + | rel x y hs => exact hstp x y hs + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + refine cohRel_of_descent hφ hφ' (pmap_cont hf) (pmap_image hf) hg hg' fun x hx y hy he => ?_ + have hm : ∀ z ∈ closedBall (0 : ℂ) 1, ((0 : ℕ), z) ∈ Dsk (sW (ew a b c)) := fun z hz => + ⟨(ew_mem_dsk a b c).1, by simpa using hz⟩ + exact hprel (0, x) (0, y) ((hf.2.2 _ (hm x hx) _ (hm y hy)).mp he) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CohExist.lean b/LeanPool/GraphMinor/Surface/CohExist.lean new file mode 100644 index 0000000000..cb53f303cd --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CohExist.lean @@ -0,0 +1,175 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CohCount + +/-! +# Each set of values on the labels comes from a class + +Let `V` be a choice of values on the labels with total sum zero along the word `ew a b c` and with +zero values on the free +sides. On each side, take the sum `Sm` at the start of the side on the first half and the sum at its +end on the second +half. This function has constant jumps on pasted sides, so `exists_cocycle` gives a local cocycle +(`exists_class`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +variable {a b c : ℕ} {Y : Type u} [TopologicalSpace Y] {f : ℕ × ℂ → Y} {A : Type} [AddCommGroup A] + +open Classical in +/-- The value on the point of the side `p` at the distance `u` from its start. -/ +noncomputable def gx (a b c : ℕ) (V : ℕ → A) (p : ℕ) (u : ℝ) : A := + Sm a b c V (st a b c p) + if ofs (sgn a b c p) u < 1 / 2 then 0 else V (lab a b c p) + +theorem gx_zero (V : ℕ → A) (p : ℕ) : gx a b c V p 0 = Sm a b c V p := by + unfold gx st + by_cases h : sgn a b c p + · simp [h, ofs] + · simp only [h, Bool.false_eq_true, ite_false, ofs] + rw [ite_eq_right (by norm_num), Sm_succ, lv, ite_eq_right h] + abel + +theorem gx_one (V : ℕ → A) (p : ℕ) : gx a b c V p 1 = Sm a b c V (p + 1) := by + unfold gx st + by_cases h : sgn a b c p + · simp only [h, ite_true, ofs] + rw [ite_eq_right (by norm_num), Sm_succ, lv, ite_eq_left h] + · simp [h, ofs] + +theorem gx_congr (V : ℕ → A) (hV : Sm a b c V (4 * a + 2 * b + 3 * c + 2) = 0) {p p' : ℕ} {u u' : ℝ} + (hp : p < 4 * a + 2 * b + 3 * c + 2) (hp' : p' < 4 * a + 2 * b + 3 * c + 2) (hu : u ∈ Icc + (0 : ℝ) 1) + (hu' : u' ∈ Icc (0 : ℝ) 1) (he : per (4 * a + 2 * b + 3 * c + 2) (p + u) = per + (4 * a + 2 * b + 3 * c + 2) (p' + u')) : + gx a b c V p u = gx a b c V p' u' := by + set n := 4 * a + 2 * b + 3 * c + 2 with hn + by_cases h1 : u ∈ Ioo (0 : ℝ) 1 + · obtain ⟨rfl, rfl⟩ := side_unique hp hp' h1 hu' he + rfl + by_cases h2 : u' ∈ Ioo (0 : ℝ) 1 + · obtain ⟨rfl, rfl⟩ := side_unique hp' hp h2 hu he.symm + rfl + have hend : ∀ v ∈ Icc (0 : ℝ) 1, v ∉ Ioo (0 : ℝ) 1 → v = 0 ∨ v = 1 := fun v hv hv' => by + by_contra hc + push Not at hc + exact hv' ⟨lt_of_le_of_ne hv.1 (Ne.symm hc.1), lt_of_le_of_ne hv.2 hc.2⟩ + have key : ∀ (q : ℕ) (v : ℝ), v = 0 ∨ v = 1 → ∃ j : ℕ, (j : ℝ) = q + v ∧ j ≤ q + 1 ∧ + gx a b c V q v = Sm a b c V j := by + rintro q v (rfl | rfl) + · exact ⟨q, by simp, by omega, gx_zero V q⟩ + · exact ⟨q + 1, by simp, le_rfl, gx_one V q⟩ + obtain ⟨j, hj, hj1, hj2⟩ := key p u (hend u hu h1) + obtain ⟨j', hj', hj1', hj2'⟩ := key p' u' (hend u' hu' h2) + rw [hj2, hj2'] + rw [← hj, ← hj'] at he + obtain ⟨m, hm⟩ := per_eq (show 0 < n by omega) he + have hn0 : (0 : ℤ) < n := by exact_mod_cast (show 0 < n by omega) + have hm' : (j : ℤ) = j' + m * n := by exact_mod_cast hm + have hjn : (j : ℤ) ≤ n := by exact_mod_cast (show j ≤ n by omega) + have hjn' : (j' : ℤ) ≤ n := by exact_mod_cast (show j' ≤ n by omega) + have hj0 : (0 : ℤ) ≤ j := by positivity + have hj0' : (0 : ℤ) ≤ j' := by positivity + have hmb : m = 0 ∨ m = 1 ∨ m = -1 := by + have h3 : m < 2 := by + by_contra hc + have : 2 * (n : ℤ) ≤ m * n := by nlinarith + omega + have h4 : -2 < m := by + by_contra hc + have : m * (n : ℤ) ≤ -2 * n := by nlinarith + omega + omega + have hS0 : Sm a b c V 0 = 0 := by simp [Sm] + rcases hmb with rfl | rfl | rfl + · have : j = j' := by omega + rw [this] + · have h3 : j = n := by omega + have h4 : j' = 0 := by omega + rw [h3, h4, hV, hS0] + · have h3 : j = 0 := by omega + have h4 : j' = n := by omega + rw [h3, h4, hV, hS0] + +open Classical in +/-- The function on the polygon. -/ +noncomputable def gz (a b c : ℕ) (V : ℕ → A) (z : ℂ) : A := + if h : ∃ x : ℕ × ℝ, x.1 < 4 * a + 2 * b + 3 * c + 2 ∧ x.2 ∈ Icc (0 : ℝ) 1 ∧ + per (4 * a + 2 * b + 3 * c + 2) (x.1 + x.2) = z then gx a b c V h.choose.1 h.choose.2 else 0 + +theorem gz_per (V : ℕ → A) (hV : Sm a b c V (4 * a + 2 * b + 3 * c + 2) = 0) {p : ℕ} {u : ℝ} + (hp : p < 4 * a + 2 * b + 3 * c + 2) (hu : u ∈ Icc (0 : ℝ) 1) : + gz a b c V (per (4 * a + 2 * b + 3 * c + 2) (p + u)) = gx a b c V p u := by + have hex : ∃ x : ℕ × ℝ, x.1 < 4 * a + 2 * b + 3 * c + 2 ∧ x.2 ∈ Icc (0 : ℝ) 1 ∧ + per (4 * a + 2 * b + 3 * c + 2) (x.1 + x.2) = per (4 * a + 2 * b + 3 * c + 2) (p + u) + := ⟨(p, u), hp, hu, rfl⟩ + rw [gz, dite_eq_left hex] + obtain ⟨h1, h2, h3⟩ := hex.choose_spec + exact gx_congr V hV h1 hp h2 hu h3 + +theorem ofs_flp' (e e' : Bool) (u : ℝ) : ofs e' (flp e e' u) = ofs e u := by + rw [← ofs_flp, ofs_ofs] + +theorem sideConst_gz (V : ℕ → A) (hV : Sm a b c V (4 * a + 2 * b + 3 * c + 2) = 0) : + SideConst (sW (ew a b c)) (fun x => gz a b c V x.2) := by + intro i p j q k e e' h1 h2 _ + obtain ⟨rfl, h4⟩ := sW_get h1 + obtain ⟨rfl, h5⟩ := sW_get h2 + obtain ⟨hp, hl, rfl⟩ := (ew_get_iff _ _ _ _ _ _).mp h4 + obtain ⟨hq, hl', rfl⟩ := (ew_get_iff _ _ _ _ _ _).mp h5 + refine ⟨Sm a b c V (st a b c q) - Sm a b c V (st a b c p), fun u hu => ?_⟩ + simp only [spt_ew] + rw [gz_per V hV hp hu, gz_per V hV hq (flp_mem hu), gx, gx, ofs_flp', hl, hl'] + abel + +/-- Values on the labels with total sum zero and with zero values on the free sides come from a +class. -/ +theorem exists_class [T2Space Y] [Finite A] (hf : Presents (sW (ew a b c)) f) (V : ℕ → A) + (hV : Sm a b c V (4 * a + 2 * b + 3 * c + 2) = 0) (h2 : ∀ i < c, V (2 * a + b + 2 * i + 1) + = 0) : + ∃ (φ : Y → Y → A) (g : ℂ → A), IsCoc φ ∧ BdTriv φ ∧ IsPrim φ (pmap f) g ∧ + ∀ k ≤ 2 * a + b + 2 * c, lval a b c g k = V k := by + have h0 : sW (ew a b c) 0 ≠ [] := (ew_mem_dsk a b c).1 + obtain ⟨φ, h3, h4, h5⟩ := exists_cocycle (g := fun x => gz a b c V x.2) (finW_sW _) + (isPaired_ew a b c) hf + (sideConst_gz V hV) h0 + refine ⟨φ, gz a b c V, h3, h5 ?_, h4, fun k hk => ?_⟩ + · intro i p hp hfr + have hi : i = 0 := by + by_contra hi + simp [sW, hi, nW] at hp + subst hi + rw [sW_zero, ew_length] at hp + obtain ⟨l, hl, rfl⟩ := (twin_eq_iff hp).mp (twin_of_free hp hfr) + refine ⟨Sm a b c V (st a b c (4 * a + 2 * b + 3 * l + 1)), fun u hu => ?_⟩ + simp only [spt_ew] + rw [gz_per V hV hp hu, gx, lab_t hl (by omega : 1 < 3)] + rw [show 1 % 2 = 1 from rfl, h2 l hl] + simp + · have hr := rep_lt hk + have h6 : ∀ t : ℝ, t = 0 ∨ t = 1 → gz a b c V (per (4 * a + 2 * b + 3 * c + 2) + (rep a b c k + ofs (sgn a b c (rep a b c k)) t)) = + gx a b c V (rep a b c k) (ofs (sgn a b c (rep a b c k)) t) := fun t ht => gz_per V hV hr + (ofs_mem' ht) + have h7 := h6 0 (.inl rfl) + have h8 := h6 1 (.inr rfl) + rw [per_st] at h7 + rw [per_en] at h8 + rw [lval, volt, h7, h8, gx, gx, lab_rep hk] + cases sgn a b c (rep a b c k) <;> norm_num [ofs] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CohPrim.lean b/LeanPool/GraphMinor/Surface/CohPrim.lean new file mode 100644 index 0000000000..dab137a92e --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CohPrim.lean @@ -0,0 +1,322 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.WordCover +public import LeanPool.GraphMinor.Surface.NormalVolt + +/-! +# Primitives on the polygon of the normal word + +Let `Y` be presented by the word `ew a b c`, and let `g` be a primitive on the polygon of a local +cocycle. On a pair of +pasted sides the difference of `g` is constant (`side_const`). So the change of `g` along a side is +a function of its +label (`volt_eq`), and the values of `g` at the corners are the sums of `Sm` (`g_cor`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +/-- The corner `j` of the polygon. -/ +noncomputable def cor (a b c j : ℕ) : ℂ := per (4 * a + 2 * b + 3 * c + 2) j + +/-- The map from the polygon of a word. -/ +def pmap {Y : Type u} (f : ℕ × ℂ → Y) (z : ℂ) : Y := f (0, z) + +theorem norm_per_sub {n : ℕ} (hn : 0 < n) (x y : ℝ) : ‖per n x - per n y‖ ≤ 8 * |x - y| := by + have h1 : per n x - per n y = per n y * (cis' (2 * Real.pi * (x - y) / n) - 1) := by + rw [mul_sub, ← per_add] + simp + have hn' : (1 : ℝ) ≤ n := by exact_mod_cast hn + have hn0 : (0 : ℝ) < n := by linarith + rw [h1, norm_mul, norm_per, one_mul] + have h2 : ‖cis' (2 * Real.pi * (x - y) / n) - 1‖ ≤ ‖2 * Real.pi * (x - y) / n‖ := by + have := Real.norm_exp_I_mul_ofReal_sub_one_le (x := 2 * Real.pi * (x - y) / n) + simpa [cis', mul_comm] using this + refine h2.trans ?_ + rw [Real.norm_eq_abs, abs_div, abs_mul, abs_mul, Nat.abs_cast, abs_of_pos (by positivity : + (0 : ℝ) < 2), + abs_of_pos Real.pi_pos, div_le_iff₀ hn0] + have h3 := Real.pi_lt_four + have h4 := abs_nonneg (x - y) + nlinarith + +variable {a b c : ℕ} {Y : Type u} [TopologicalSpace Y] {f : ℕ × ℂ → Y} {A : Type} [AddCommGroup A] + +theorem spt_ew (p : ℕ) (u : ℝ) : spt (sW (ew a b c)) 0 p u = (0, per (4 * a + 2 * b + 3 * c + 2) + (p + u)) := by + simp [spt, sW_zero, ew_length] + +theorem mem_ball_per (n : ℕ) (x : ℝ) : per n x ∈ closedBall (0 : ℂ) 1 := by simp [norm_per] + +theorem per_st (a b c p : ℕ) : per (4 * a + 2 * b + 3 * c + 2) (p + ofs (sgn a b c p) 0) + = cor a b c (st a b c p) := by + unfold cor st + cases sgn a b c p <;> simp [ofs] + +theorem per_en (a b c p : ℕ) : per (4 * a + 2 * b + 3 * c + 2) (p + ofs (sgn a b c p) 1) + = cor a b c (en a b c p) := by + unfold cor en + cases sgn a b c p <;> simp [ofs] + +theorem flp_ofs (e e' : Bool) (t : ℝ) : flp e e' (ofs e t) = ofs e' t := by + cases e <;> cases e' <;> simp [flp, ofs] + +theorem ofs_mem' {e : Bool} {t : ℝ} (ht : t = 0 ∨ t = 1) : ofs e t ∈ Icc (0 : ℝ) 1 := + ofs_mem (by rcases ht with rfl | rfl <;> simp) + +/-- A step between two sides with the same label. -/ +theorem stp_pair {p q : ℕ} (hp : p < 4 * a + 2 * b + 3 * c + 2) (hq : q < 4 * a + 2 * b + 3 * c + + 2) (hne : p ≠ q) + (hl : lab a b c p = lab a b c q) {u : ℝ} (hu : u ∈ Icc (0 : ℝ) 1) : + Stp (sW (ew a b c)) (0, per (4 * a + 2 * b + 3 * c + 2) (p + u)) + (0, per (4 * a + 2 * b + 3 * c + 2) (q + flp (sgn a b c p) (sgn a b c q) u)) := by + rw [← spt_ew, ← spt_ew] + refine stp_iff.mpr ⟨0, 0, p, q, lab a b c p, _, _, u, ?_, ?_, fun h => hne (Prod.mk.inj h).2, + hu, rfl, rfl⟩ + · rw [sW_zero] + exact ew_get a b c hp + · rw [sW_zero, hl] + exact ew_get a b c hq + +theorem pair_F (hf : Presents (sW (ew a b c)) f) {p q : ℕ} (hp : p < 4 * a + 2 * b + 3 * c + 2) + (hq : q < 4 * a + 2 * b + 3 * c + 2) (hne : p ≠ q) (hl : lab a b c p = lab a b c q) {u : ℝ} + (hu : u ∈ Icc (0 : ℝ) 1) : + pmap f (per (4 * a + 2 * b + 3 * c + 2) (q + flp (sgn a b c p) (sgn a b c q) u)) = + pmap f (per (4 * a + 2 * b + 3 * c + 2) (p + u)) := + (presents_eq_of_stp hf (stp_pair hp hq hne hl hu)).symm + +theorem pair_cor (hf : Presents (sW (ew a b c)) f) {p q : ℕ} (hp : p < 4 * a + 2 * b + 3 * c + 2) + (hq : q < 4 * a + 2 * b + 3 * c + 2) (hne : p ≠ q) (hl : lab a b c p = lab a b c q) : + pmap f (cor a b c (st a b c q)) = pmap f (cor a b c (st a b c p)) ∧ + pmap f (cor a b c (en a b c q)) = pmap f (cor a b c (en a b c p)) := by + have h0 := pair_F hf hp hq hne hl (u := ofs (sgn a b c p) 0) (ofs_mem' (.inl rfl)) + have h1 := pair_F hf hp hq hne hl (u := ofs (sgn a b c p) 1) (ofs_mem' (.inr rfl)) + rw [flp_ofs, per_st, per_st] at h0 + rw [flp_ofs, per_en, per_en] at h1 + exact ⟨h0, h1⟩ + +/-- On two pasted sides the difference of a primitive is constant. -/ +theorem side_const {φ : Y → Y → A} {g : ℂ → A} (hf : Presents (sW (ew a b c)) f) (hg : IsPrim φ + (pmap f) g) {p q : ℕ} + (hp : p < 4 * a + 2 * b + 3 * c + 2) (hq : q < 4 * a + 2 * b + 3 * c + 2) (hne : p ≠ q) + (hl : lab a b c p = lab a b c q) : ∃ c', ∀ u ∈ Icc (0 : ℝ) 1, + g (per (4 * a + 2 * b + 3 * c + 2) (q + flp (sgn a b c p) (sgn a b c q) u)) = + g (per (4 * a + 2 * b + 3 * c + 2) (p + u)) + c' := by + obtain ⟨ε, h0, h1⟩ := hg + simp only [neg_add_eq_sub] at h1 + set n := 4 * a + 2 * b + 3 * c + 2 with hn + have hn0 : 0 < n := by omega + let v : ℝ → A := fun u => g (per n (q + flp (sgn a b c p) (sgn a b c q) u)) - g (per n (p + u)) + have hflp : ∀ s t : ℝ, |flp (sgn a b c p) (sgn a b c q) s - flp (sgn a b c p) (sgn a b c q) t| + = |s - t| := by + intro s t + unfold flp + split_ifs + · rfl + · rw [show 1 - s - (1 - t) = -(s - t) by ring, abs_neg] + have hc := const_of_near (v := v) (ε := ε / 9) (by positivity) (fun s hs t ht hst => by + have hlip : ∀ (m : ℕ) (x y : ℝ), |x - y| < ε / 9 → ‖per n (m + x) - per n (m + y)‖ < ε := by + intro m x y hxy + have h2 := norm_per_sub hn0 (m + x) (m + y) + rw [show (m : ℝ) + x - (m + y) = x - y by ring] at h2 + linarith + have e1 := h1 _ (mem_ball_per n (p + t)) _ (mem_ball_per n (p + s)) (hlip p t s + (by rwa [abs_sub_comm])) + have e2 := h1 _ (mem_ball_per n (q + flp _ _ t)) _ (mem_ball_per n (q + flp _ _ s)) + (hlip q (flp (sgn a b c p) (sgn a b c q) t) (flp (sgn a b c p) (sgn a b c q) s) + (by rw [hflp, abs_sub_comm]; exact hst)) + rw [pair_F hf hp hq hne hl ht, pair_F hf hp hq hne hl hs, e1] at e2 + simp only [v] + rw [sub_eq_iff_eq_add] at e2 ⊢ + rw [e2] + abel) + refine ⟨v 0, fun u hu => ?_⟩ + have h2 := hc u hu + simp only [v] at h2 ⊢ + rw [sub_eq_iff_eq_add] at h2 + rw [h2] + abel + +/-- The change of `g` along the side `p`, read along its label. -/ +noncomputable def volt (a b c : ℕ) (g : ℂ → A) (p : ℕ) : A := g (cor a b c (en a b c p)) - g + (cor a b c (st a b c p)) + +theorem volt_pair {φ : Y → Y → A} {g : ℂ → A} (hf : Presents (sW (ew a b c)) f) (hg : IsPrim φ + (pmap f) g) {p q : ℕ} + (hp : p < 4 * a + 2 * b + 3 * c + 2) (hq : q < 4 * a + 2 * b + 3 * c + 2) (hne : p ≠ q) + (hl : lab a b c p = lab a b c q) : volt a b c g q = volt a b c g p := by + obtain ⟨c', h⟩ := side_const hf hg hp hq hne hl + have h0 := h _ (ofs_mem' (e := sgn a b c p) (t := 0) (.inl rfl)) + have h1 := h _ (ofs_mem' (e := sgn a b c p) (t := 1) (.inr rfl)) + rw [flp_ofs, per_st, per_st] at h0 + rw [flp_ofs, per_en, per_en] at h1 + unfold volt + rw [h0, h1] + abel + +/-- A side with each label. -/ +def rep (a b c k : ℕ) : ℕ := + if k < 2 * a then 4 * (k / 2) + k % 2 + else if k < 2 * a + b then 4 * a + 2 * (k - 2 * a) + else if k < 2 * a + b + 2 * c then + 4 * a + 2 * b + 3 * ((k - (2 * a + b)) / 2) + (k - (2 * a + b)) % 2 + else 4 * a + 2 * b + 3 * c + +theorem lab_rep {k : ℕ} (hk : k ≤ 2 * a + b + 2 * c) : lab a b c (rep a b c k) = k := by + unfold rep + by_cases h1 : k < 2 * a + · rw [ite_eq_left h1, lab_h (by omega) (by omega)] + omega + rw [ite_eq_right h1] + by_cases h2 : k < 2 * a + b + · rw [ite_eq_left h2, ← add_zero (4 * a + 2 * (k - 2 * a)), lab_c (by omega) (by omega)] + omega + rw [ite_eq_right h2] + by_cases h3 : k < 2 * a + b + 2 * c + · rw [ite_eq_left h3, lab_t (by omega) (by omega)] + omega + · rw [ite_eq_right h3, ← add_zero (4 * a + 2 * b + 3 * c), lab_l] + omega + +theorem rep_lt {k : ℕ} (hk : k ≤ 2 * a + b + 2 * c) : rep a b c k < 4 * a + 2 * b + 3 * c + 2 := by + unfold rep + split_ifs <;> omega + +theorem lab_le {p : ℕ} (hp : p < 4 * a + 2 * b + 3 * c + 2) : lab a b c p ≤ 2 * a + b + 2 * c := by + unfold lab + split_ifs <;> omega + +theorem lab_lt_of_lt {p : ℕ} (hp : p < 4 * a + 2 * b) : lab a b c p < 2 * a + b := by + unfold lab + split_ifs <;> omega + +/-- The values of the labels. -/ +noncomputable def lval (a b c : ℕ) (g : ℂ → A) (k : ℕ) : A := volt a b c g (rep a b c k) + +theorem volt_eq {φ : Y → Y → A} {g : ℂ → A} (hf : Presents (sW (ew a b c)) f) (hg : IsPrim φ + (pmap f) g) {p : ℕ} + (hp : p < 4 * a + 2 * b + 3 * c + 2) : volt a b c g p = lval a b c g (lab a b c p) := by + have h1 := lab_le hp + by_cases he : rep a b c (lab a b c p) = p + · rw [lval, he] + · exact volt_pair hf hg (rep_lt h1) hp he (lab_rep h1) + +theorem cor_succ_eq {g : ℂ → A} (p : ℕ) : + g (cor a b c (p + 1)) - g (cor a b c p) = if sgn a b c p then volt a b c g p else - volt a b c + g p := by + unfold volt en st + by_cases h : sgn a b c p + · rw [ite_eq_left h, ite_eq_left h, ite_eq_left h] + · rw [ite_eq_right h, ite_eq_right h, ite_eq_right h] + abel + +/-- The values of a primitive at the corners are sums along the word. -/ +theorem g_cor {φ : Y → Y → A} {g : ℂ → A} (hf : Presents (sW (ew a b c)) f) (hg : IsPrim φ + (pmap f) g) {j : ℕ} + (hj : j ≤ 4 * a + 2 * b + 3 * c + 2) : g (cor a b c j) = g (cor a b c 0) + Sm a b c + (lval a b c g) j := by + induction j with + | zero => simp [Sm] + | succ j ih => + have h1 := ih (by omega) + have h2 := cor_succ_eq (a := a) (b := b) (c := c) (g := g) j + rw [volt_eq hf hg (by omega)] at h2 + rw [sub_eq_iff_eq_add] at h2 + rw [h2, h1, Sm_succ, lv] + by_cases h : sgn a b c j + · rw [ite_eq_left h] + abel + · rw [ite_eq_right h] + abel + +theorem cor_last (a b c : ℕ) : cor a b c (4 * a + 2 * b + 3 * c + 2) = cor a b c 0 := by + have h := per_add_self (m := 4 * a + 2 * b + 3 * c + 2) (by omega) 0 + rw [zero_add] at h + simpa [cor] using h + +theorem Sm_prim {φ : Y → Y → A} {g : ℂ → A} (hf : Presents (sW (ew a b c)) f) (hg : IsPrim φ + (pmap f) g) : + Sm a b c (lval a b c g) (4 * a + 2 * b + 3 * c + 2) = 0 := by + have h1 := g_cor hf hg (j := 4 * a + 2 * b + 3 * c + 2) le_rfl + rw [cor_last] at h1 + exact (add_eq_left.mp h1.symm) + +/-- The ends of a side of a handle or a cross-cap are the same point. -/ +theorem loop_cor (hf : Presents (sW (ew a b c)) f) {p : ℕ} (hp : p < 4 * a + 2 * b) : + pmap f (cor a b c (p + 1)) = pmap f (cor a b c p) := by + by_cases h4 : p < 4 * a + · obtain ⟨i, δ, hi, hδ, rfl⟩ : ∃ i δ, i < a ∧ δ < 4 ∧ p = 4 * i + δ + := ⟨p / 4, p % 4, by omega, by omega, by omega⟩ + have hp0 := pair_cor hf (p := 4 * i + 0) (q := 4 * i + 2) (by omega) (by omega) (by omega) + (by rw [lab_h hi (by omega), lab_h hi (by omega)]) + have hp1 := pair_cor hf (p := 4 * i + 1) (q := 4 * i + 3) (by omega) (by omega) (by omega) + (by rw [lab_h hi (by omega), lab_h hi (by omega)]) + have s0 : st a b c (4 * i + 0) = 4 * i + 0 := by + simp only [st, sgn_h hi (by omega : 0 < 4)]; rfl + have e0 : en a b c (4 * i + 0) = 4 * i + 1 := by + simp only [en, sgn_h hi (by omega : 0 < 4)]; rfl + have s1 : st a b c (4 * i + 1) = 4 * i + 1 := by + simp only [st, sgn_h hi (by omega : 1 < 4)]; rfl + have e1 : en a b c (4 * i + 1) = 4 * i + 2 := by + simp only [en, sgn_h hi (by omega : 1 < 4)]; rfl + have s2 : st a b c (4 * i + 2) = 4 * i + 3 := by + simp only [st, sgn_h hi (by omega : 2 < 4)]; rfl + have e2 : en a b c (4 * i + 2) = 4 * i + 2 := by + simp only [en, sgn_h hi (by omega : 2 < 4)]; rfl + have s3 : st a b c (4 * i + 3) = 4 * i + 4 := by + simp only [st, sgn_h hi (by omega : 3 < 4)]; rfl + have e3 : en a b c (4 * i + 3) = 4 * i + 3 := by + simp only [en, sgn_h hi (by omega : 3 < 4)]; rfl + rw [s0, s2, e0, e2] at hp0 + rw [s1, s3, e1, e3] at hp1 + obtain ⟨h1, h2⟩ := hp0 + obtain ⟨h3, h4'⟩ := hp1 + interval_cases δ + · exact h2.symm.trans (h4'.symm.trans h1) + · exact h2 + · exact h4' + · exact h3.trans (h2.symm.trans h4'.symm) + · obtain ⟨i, δ, hi, hδ, rfl⟩ : ∃ i δ, i < b ∧ δ < 2 ∧ p = 4 * a + 2 * i + δ := + ⟨(p - 4 * a) / 2, (p - 4 * a) % 2, by omega, by omega, by omega⟩ + have hp0 := pair_cor hf (p := 4 * a + 2 * i + 0) (q := 4 * a + 2 * i + 1) (by omega) (by omega) + (by omega) + (by rw [lab_c hi (by omega), lab_c hi (by omega)]) + have s0 : ∀ δ, δ < 2 → st a b c (4 * a + 2 * i + δ) = 4 * a + 2 * i + δ := fun δ h => by + simp only [st, sgn_c hi h, ite_true] + have e0 : ∀ δ, δ < 2 → en a b c (4 * a + 2 * i + δ) = 4 * a + 2 * i + δ + 1 := fun δ h => by + simp only [en, sgn_c hi h, ite_true] + rw [s0 0 (by omega), s0 1 (by omega), e0 0 (by omega), e0 1 (by omega)] at hp0 + interval_cases δ + · exact hp0.1 + · exact hp0.2 + +/-- The ends of the free side of a hole are the same point. -/ +theorem hole_cor (hf : Presents (sW (ew a b c)) f) {i : ℕ} (hi : i < c) : + pmap f (cor a b c (4 * a + 2 * b + 3 * i + 2)) = pmap f (cor a b c (4 * a + 2 * b + 3 * i + 1)) + := by + have h := (pair_cor hf (p := 4 * a + 2 * b + 3 * i + 0) (q := 4 * a + 2 * b + 3 * i + 2) + (by omega) (by omega) + (by omega) (by rw [lab_t hi (by omega), lab_t hi (by omega)])).2 + have e0 : en a b c (4 * a + 2 * b + 3 * i + 0) = 4 * a + 2 * b + 3 * i + 1 := by + simp only [en, sgn_t hi (by omega : 0 < 3)] + rfl + have e2 : en a b c (4 * a + 2 * b + 3 * i + 2) = 4 * a + 2 * b + 3 * i + 2 := by + simp only [en, sgn_t hi (by omega : 2 < 3)] + rfl + rw [e0, e2] at h + exact h + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Collapse.lean b/LeanPool/GraphMinor/Surface/Collapse.lean new file mode 100644 index 0000000000..f12e6ea1f4 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Collapse.lean @@ -0,0 +1,788 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ArcDisc + +/-! +# Collapsing an arc + +An arc of a closed surface can be collapsed to a point by a map of the surface to itself that is +homotopic to the identity (`exists_collapse`). The map is injective off the arc and onto. This is +the fact "`Σ' ≅ Σ`" in the proof of Graph Minors XIX, (6.3) (page 340), for one edge. + +By `exists_disc_of_arc` and the strip coordinates of `exists_stripChart`, it is enough to collapse a +segment of the real axis in the closed unit ball, by a map that is the identity on the unit circle. +For this we use the Joukowski map. Let `a > 1`. On the annulus `1 ≤ ‖w‖ ≤ R`, the map `j` sends `w = +t u` to `(w + 1 / w) / 2` with its real part divided by `a` and its imaginary part by `b`, where `a` +and `b` are the half axes of the ellipse that is the image of `‖w‖ = R`. It maps onto the unit ball, +it is injective off the circle `‖w‖ = 1`, and it folds this circle onto a segment. The map `w ↦ (t - +1) / (R - 1) u` maps onto the unit ball too, and it sends this circle to `0`. So it factors through +`j`, and this gives the collapse (`exists_ball_collapse`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter Complex + +local notation "𝕀" => unitInterval + +/-- Facts on the half axes at radius `t ≥ 1`. -/ +theorem half_axes {t R : ℝ} (h1 : 1 ≤ t) (h2 : t ≤ R) : t + t⁻¹ ≤ R + R⁻¹ ∧ t - t⁻¹ ≤ R - R⁻¹ := by + have ht : 0 < t := by linarith + have hR : 0 < R := by linarith + have h3 : R⁻¹ ≤ t⁻¹ := inv_anti₀ ht h2 + refine ⟨?_, by linarith⟩ + have h4 : t⁻¹ - R⁻¹ = (R - t) / (t * R) := by field_simp + have h5 : (R - t) / (t * R) ≤ R - t := div_le_self (by linarith) (by nlinarith) + linarith + +theorem jou_re {w : ℂ} (hw : w ≠ 0) : (jou w).re = (‖w‖ + ‖w‖⁻¹) / 2 * (w.re / ‖w‖) := by + have ht : ‖w‖ ≠ 0 := norm_ne_zero_iff.mpr hw + have h2 : normSq w = ‖w‖ ^ 2 := normSq_eq_norm_sq w + simp only [jou, div_ofNat_re, add_re, inv_re, h2] + field_simp + +theorem jou_im {w : ℂ} (hw : w ≠ 0) : (jou w).im = (‖w‖ - ‖w‖⁻¹) / 2 * (w.im / ‖w‖) := by + have ht : ‖w‖ ≠ 0 := norm_ne_zero_iff.mpr hw + have h2 : normSq w = ‖w‖ ^ 2 := normSq_eq_norm_sq w + simp only [jou, div_ofNat_im, add_im, inv_im, h2] + field_simp + ring + +theorem jou_fibre {w w' : ℂ} (hw : w ≠ 0) (hw' : w' ≠ 0) (h : jou w = jou w') : w = w' ∨ w * w' = 1 + := by + have h1 : (w - w') * (w * w' - 1) = 0 := by + simp only [jou] at h + field_simp at h + linear_combination h + rcases mul_eq_zero.mp h1 with h2 | h2 + · exact .inl (sub_eq_zero.mp h2) + · exact .inr (sub_eq_zero.mp h2) + +theorem exists_jou_root (ζ : ℂ) : ∃ w, 1 ≤ ‖w‖ ∧ jou w = ζ := by + obtain ⟨d, hd⟩ : ∃ d : ℂ, d ^ 2 = ζ ^ 2 - 1 := ⟨_, Complex.cpow_nat_inv_pow _ two_ne_zero⟩ + have hp : (ζ + d) * (ζ - d) = 1 := by linear_combination -hd + have h1 : ζ + d ≠ 0 := left_ne_zero_of_mul_eq_one hp + have h2 : ζ - d ≠ 0 := right_ne_zero_of_mul_eq_one hp + have hinv1 : (ζ + d)⁻¹ = ζ - d := inv_eq_of_mul_eq_one_right hp + have hinv2 : (ζ - d)⁻¹ = ζ + d := inv_eq_of_mul_eq_one_left hp + by_cases hn : 1 ≤ ‖ζ + d‖ + · exact ⟨ζ + d, hn, by rw [jou, hinv1]; ring⟩ + · refine ⟨ζ - d, ?_, by rw [jou, hinv2]; ring⟩ + have h3 : ‖ζ + d‖ * ‖ζ - d‖ = 1 := by rw [← norm_mul, hp, norm_one] + have h4 : 0 < ‖ζ + d‖ := norm_pos_iff.mpr h1 + by_contra! hbad + have hlt := mul_lt_mul_of_pos_left hbad h4 + rw [h3, mul_one] at hlt + exact hn hlt.le + +private theorem scaledJoukowski_mapsTo_ball {a b R : ℝ} {j : ℂ → ℂ} + (ha0 : 0 < a) (hbpos : 0 < b) + (haR : (R + R⁻¹) / 2 = a) (hbR : (R - R⁻¹) / 2 = b) + (hjre : ∀ w : ℂ, w ≠ 0 → + (j w).re = (‖w‖ + ‖w‖⁻¹) / 2 * (w.re / ‖w‖) / a) + (hjim : ∀ w : ℂ, w ≠ 0 → + (j w).im = (‖w‖ - ‖w‖⁻¹) / 2 * (w.im / ‖w‖) / b) + (hunit : ∀ w : ℂ, w ≠ 0 → (w.re / ‖w‖) ^ 2 + (w.im / ‖w‖) ^ 2 = 1) : + ∀ w : ℂ, (1 ≤ ‖w‖ ∧ ‖w‖ ≤ R) → j w ∈ closedBall (0 : ℂ) 1 := by + intro w hw + have h0 : w ≠ 0 := by + intro h + exact (not_le_of_gt zero_lt_one) (by simpa [h] using hw.1) + obtain ⟨h1, h2⟩ := half_axes hw.1 hw.2 + have hu := hunit w h0 + set p := (‖w‖ + ‖w‖⁻¹) / 2 with hp + set q := (‖w‖ - ‖w‖⁻¹) / 2 with hq + have hp0 : 0 ≤ p := by positivity + have hq0 : 0 ≤ q := by + have : ‖w‖⁻¹ ≤ 1 := inv_le_one_of_one_le₀ hw.1 + simp only [hq] + linarith [hw.1] + have hpa : p / a ≤ 1 := (div_le_one ha0).mpr (by rw [← haR]; linarith) + have hqb : q / b ≤ 1 := (div_le_one hbpos).mpr (by rw [← hbR]; linarith) + rw [mem_closedBall_zero_iff] + have h3 : ‖j w‖ ^ 2 ≤ 1 := by + rw [← normSq_eq_norm_sq, normSq_apply, hjre w h0, hjim w h0] + set c' := w.re / ‖w‖ + set s' := w.im / ‖w‖ + have h4 : p * c' / a = p / a * c' := by ring + have h5 : q * s' / b = q / b * s' := by ring + rw [h4, h5] + have h6 : (p / a) ^ 2 ≤ 1 := pow_le_one₀ (by positivity) hpa + have h7 : (q / b) ^ 2 ≤ 1 := pow_le_one₀ (by positivity) hqb + have hcs : c' ^ 2 + s' ^ 2 = 1 := hu + have hc := mul_le_of_le_one_left (sq_nonneg c') h6 + have hs := mul_le_of_le_one_left (sq_nonneg s') h7 + nlinarith only [hc, hs, hcs] + nlinarith [norm_nonneg (j w)] + +private theorem scaledJoukowski_surjOn_ball {a b R : ℝ} (hR0 : 0 < R) + (ha0 : 0 < a) (hbpos : 0 < b) + (haR : (R + R⁻¹) / 2 = a) (hbR : (R - R⁻¹) / 2 = b) + (hunit : ∀ w : ℂ, w ≠ 0 → (w.re / ‖w‖) ^ 2 + (w.im / ‖w‖) ^ 2 = 1) : + let A : Set ℂ := {w | 1 ≤ ‖w‖ ∧ ‖w‖ ≤ R} + let j : ℂ → ℂ := fun w => ((jou w).re / a : ℝ) + ((jou w).im / b : ℝ) * I + ∀ z ∈ closedBall (0 : ℂ) 1, ∃ w ∈ A, j w = z := by + intro A j + have hjre : ∀ w : ℂ, w ≠ 0 → + (j w).re = (‖w‖ + ‖w‖⁻¹) / 2 * (w.re / ‖w‖) / a := fun w hw => by + simp [j, jou_re hw] + have hjim : ∀ w : ℂ, w ≠ 0 → + (j w).im = (‖w‖ - ‖w‖⁻¹) / 2 * (w.im / ‖w‖) / b := fun w hw => by + simp [j, jou_im hw] + intro z hz + obtain ⟨w, hw1, hw2⟩ := exists_jou_root ((a * z.re : ℝ) + (b * z.im : ℝ) * I) + have h0 : w ≠ 0 := fun h => by + simp [h] at hw1 + linarith + have hjz : j w = z := by + apply Complex.ext + · simp [j, hw2, ha0.ne'] + · simp [j, hw2, hbpos.ne'] + refine ⟨w, ⟨hw1, ?_⟩, hjz⟩ + by_contra hc + push Not at hc + have hu := hunit w h0 + have h3 : ‖z‖ ^ 2 ≤ 1 := by + have := mem_closedBall_zero_iff.mp hz + nlinarith [norm_nonneg z] + rw [← normSq_eq_norm_sq, normSq_apply, ← hjz, hjre w h0, hjim w h0] at h3 + have ht0 : 0 < ‖w‖ := by linarith + have hin : ‖w‖⁻¹ < R⁻¹ := inv_strictAnti₀ hR0 hc + have hin2 : ‖w‖ - ‖w‖⁻¹ > R - R⁻¹ := by linarith + have hin3 : ‖w‖ + ‖w‖⁻¹ > R + R⁻¹ := by + have h4 : ‖w‖⁻¹ * ‖w‖ = 1 := inv_mul_cancel₀ ht0.ne' + have h5 : R⁻¹ * R = 1 := inv_mul_cancel₀ hR0.ne' + have h6 : 0 < ‖w‖⁻¹ := by positivity + have h7 : 0 < R⁻¹ := by positivity + nlinarith + set p := (‖w‖ + ‖w‖⁻¹) / 2 with hp + set q := (‖w‖ - ‖w‖⁻¹) / 2 with hq + have hpa : 1 < p / a := (one_lt_div ha0).mpr (by rw [← haR]; linarith) + have hqb : 1 < q / b := (one_lt_div hbpos).mpr (by rw [← hbR]; linarith) + set c' := w.re / ‖w‖ + set s' := w.im / ‖w‖ + have h4 : p * c' / a = p / a * c' := by ring + have h5 : q * s' / b = q / b * s' := by ring + rw [h4, h5] at h3 + have h6 : 1 < (p / a) ^ 2 := one_lt_pow₀ hpa (by norm_num) + have h7 : 1 < (q / b) ^ 2 := one_lt_pow₀ hqb (by norm_num) + have h8 : c' ^ 2 ≤ (p / a) ^ 2 * c' ^ 2 := le_mul_of_one_le_left (sq_nonneg _) h6.le + have h9 : s' ^ 2 ≤ (q / b) ^ 2 * s' ^ 2 := le_mul_of_one_le_left (sq_nonneg _) h7.le + have h10 : (p / a * c') * (p / a * c') + (q / b * s') * (q / b * s') = (p / a) ^ 2 * c' ^ 2 + + (q / b) ^ 2 * s' ^ 2 := by ring + rw [h10] at h3 + have hcs : c' ^ 2 + s' ^ 2 = 1 := hu + have hc : c' ^ 2 = 0 := by + by_contra hne + have hpos := lt_of_le_of_ne (sq_nonneg c') (Ne.symm hne) + have hlt := mul_lt_mul_of_pos_right h6 hpos + linarith only [hlt, h9, h3, hcs] + have hs : s' ^ 2 = 0 := by + by_contra hne + have hpos := lt_of_le_of_ne (sq_nonneg s') (Ne.symm hne) + have hlt := mul_lt_mul_of_pos_right h7 hpos + linarith only [hlt, h8, h3, hcs] + linarith only [hc, hs, hcs] + +private theorem norm_eq_one_of_jou_eq {w w' : ℂ} (hw : 1 ≤ ‖w‖) (hw' : 1 ≤ ‖w'‖) + (he : jou w = jou w') : w = w' ∨ ‖w‖ = 1 ∧ ‖w'‖ = 1 := by + have h0 : w ≠ 0 := by + intro h + exact (not_le_of_gt zero_lt_one) (by simpa [h] using hw) + have h0' : w' ≠ 0 := by + intro h + exact (not_le_of_gt zero_lt_one) (by simpa [h] using hw') + rcases jou_fibre h0 h0' he with h | h + · exact Or.inl h + · have hmul : ‖w‖ * ‖w'‖ = 1 := by rw [← norm_mul, h, norm_one] + have heq : ‖w‖ = 1 := le_antisymm (by + have hle := le_mul_of_one_le_right (norm_nonneg w) hw' + rwa [hmul] at hle) hw + have heq' : ‖w'‖ = 1 := by rwa [heq, one_mul] at hmul + exact Or.inr ⟨heq, heq'⟩ + +private theorem continuousOn_of_compact_surjOn {A B : Set ℂ} {j κ c : ℂ → ℂ} + (hAc : IsCompact A) (hjc : ContinuousOn j A) (hκc : ContinuousOn κ A) + (hjsurj : ∀ z ∈ B, ∃ w ∈ A, j w = z) (hcj : ∀ w ∈ A, c (j w) = κ w) : + ContinuousOn c B := by + rw [continuousOn_iff_isClosed] + intro C hC + have h1 : IsCompact (A ∩ κ ⁻¹' C) := + hAc.of_isClosed_subset (hκc.preimage_isClosed_of_isClosed hAc.isClosed hC) inter_subset_left + refine ⟨j '' (A ∩ κ ⁻¹' C), (h1.image_of_continuousOn (hjc.mono inter_subset_left)).isClosed, ?_⟩ + ext z + constructor + · rintro ⟨h2, h3⟩ + obtain ⟨w, hw, rfl⟩ := hjsurj z h3 + refine ⟨⟨w, ⟨hw, ?_⟩, rfl⟩, h3⟩ + change κ w ∈ C + rw [← hcj w hw] + exact h2 + · rintro ⟨⟨w, ⟨hw, h2⟩, rfl⟩, h3⟩ + refine ⟨?_, h3⟩ + change c (j w) ∈ C + rw [hcj w hw] + exact h2 + +private theorem scaledJoukowski_radius_eq_one {a b : ℝ} (ha0 : 0 < a) (hbpos : 0 < b) + {w z : ℂ} (hw : 1 ≤ ‖w‖) + (hu : (w.re / ‖w‖) ^ 2 + (w.im / ‖w‖) ^ 2 = 1) + (hjre : z.re = (‖w‖ + ‖w‖⁻¹) / 2 * (w.re / ‖w‖) / a) + (hjim : z.im = (‖w‖ - ‖w‖⁻¹) / 2 * (w.im / ‖w‖) / b) : + ‖w‖ = 1 ↔ z.im = 0 ∧ |z.re| ≤ a⁻¹ := by + have hw1 : 0 < ‖w‖ := by linarith [hw] + constructor + · intro h + constructor + · rw [hjim, h] + simp + · have h3 : |w.re| ≤ 1 := by + have := Complex.abs_re_le_norm w + rwa [h] at this + have h4 : (1 + (1 : ℝ)⁻¹) / 2 * (w.re / 1) / a = w.re / a := by norm_num + rw [hjre, h, h4, abs_div, abs_of_pos ha0, div_eq_mul_inv] + simpa using mul_le_mul_of_nonneg_right h3 (inv_pos.mpr ha0).le + · rintro ⟨h1, h2⟩ + by_contra hc + have hgt : 1 < ‖w‖ := lt_of_le_of_ne hw (Ne.symm hc) + have hin : ‖w‖⁻¹ < 1 := inv_lt_one_of_one_lt₀ hgt + have hq : 0 < (‖w‖ - ‖w‖⁻¹) / 2 := by linarith + have hp : 1 < (‖w‖ + ‖w‖⁻¹) / 2 := by + have h4 : ‖w‖⁻¹ * ‖w‖ = 1 := inv_mul_cancel₀ hw1.ne' + have h5 : 0 < ‖w‖⁻¹ := by positivity + nlinarith + rw [hjim] at h1 + have hs : w.im / ‖w‖ = 0 := by + have h3 := div_eq_zero_iff.mp h1 + rcases h3 with h3 | h3 + · exact (mul_eq_zero.mp h3).resolve_left hq.ne' + · exact absurd h3 hbpos.ne' + rw [hs] at hu + have hc2 : (w.re / ‖w‖) ^ 2 = 1 := by linarith + have hc3 : |w.re / ‖w‖| = 1 := by + rw [← sq_eq_sq₀ (abs_nonneg _) zero_le_one, sq_abs, hc2] + norm_num + rw [hjre, abs_div, abs_mul, hc3, mul_one, abs_of_pos ha0, abs_of_pos + (by linarith), div_le_iff₀ ha0, inv_mul_cancel₀ ha0.ne'] at h2 + linarith + +/-- The model collapse. In the closed unit ball, the segment of the real axis with `|x| ≤ 1 / a` +goes to `0`, and the map is the identity on the unit circle. -/ +theorem exists_ball_collapse {a : ℝ} (ha : 1 < a) : + ∃ c : ℂ → ℂ, ContinuousOn c (closedBall 0 1) ∧ MapsTo c (closedBall 0 1) (closedBall 0 1) ∧ + (∀ z ∈ sphere (0 : ℂ) 1, c z = z) ∧ (∀ z ∈ closedBall (0 : ℂ) 1, c z = 0 ↔ z.im = 0 ∧ |z.re| + ≤ a⁻¹) ∧ + (∀ z ∈ closedBall (0 : ℂ) 1, ∀ z' ∈ closedBall (0 : ℂ) 1, c z ≠ 0 → c z = c z' → z = z') ∧ + ∀ v ∈ closedBall (0 : ℂ) 1, ∃ z ∈ closedBall (0 : ℂ) 1, c z = v := by + classical + set b := Real.sqrt (a ^ 2 - 1) with hb + have hb2 : b ^ 2 = a ^ 2 - 1 := Real.sq_sqrt (by nlinarith) + have hbpos : 0 < b := Real.sqrt_pos.mpr (by nlinarith) + have ha0 : 0 < a := by linarith + set R := a + b with hR + have hR1 : 1 < R := by linarith + have hR0 : 0 < R := by linarith + have hRinv : R⁻¹ = a - b := inv_eq_of_mul_eq_one_right (by rw [hR]; linear_combination hb2 * + (-1 : ℝ)) + have haR : (R + R⁻¹) / 2 = a := by rw [hRinv, hR]; ring + have hbR : (R - R⁻¹) / 2 = b := by rw [hRinv, hR]; ring + let A : Set ℂ := {w | 1 ≤ ‖w‖ ∧ ‖w‖ ≤ R} + have hAc : IsCompact A := by + have h1 : A = closedBall 0 R ∩ {w | 1 ≤ ‖w‖} := by + ext w + simp [A, and_comm] + rw [h1] + exact (isCompact_closedBall _ _).inter_right (isClosed_le continuous_const continuous_norm) + have hA0 : ∀ w ∈ A, w ≠ 0 := fun w hw h => by + have := hw.1 + simp [h] at this + linarith + let j : ℂ → ℂ := fun w => ((jou w).re / a : ℝ) + ((jou w).im / b : ℝ) * I + let κ : ℂ → ℂ := fun w => ((‖w‖ - 1) / (R - 1) : ℝ) * (w / ‖w‖) + have hR1' : 0 < R - 1 := by linarith + have hjc : ContinuousOn j A := by + have h1 : ContinuousOn jou A := by + exact ContinuousOn.div_const (continuousOn_id.add (continuousOn_id.inv₀ hA0)) _ + have h2 : ContinuousOn (fun w => (jou w).re) A := continuous_re.comp_continuousOn h1 + have h3 : ContinuousOn (fun w => (jou w).im) A := continuous_im.comp_continuousOn h1 + exact (continuous_ofReal.comp_continuousOn (h2.div_const _)).add + ((continuous_ofReal.comp_continuousOn (h3.div_const _)).mul continuousOn_const) + have hκc : ContinuousOn κ A := by + have h1 : ContinuousOn (fun w : ℂ => ((‖w‖ : ℝ) : ℂ)) A := continuous_ofReal.comp_continuousOn + continuous_norm.continuousOn + have h2 : ContinuousOn (fun w : ℂ => w / ((‖w‖ : ℝ) : ℂ)) A := continuousOn_id.div h1 fun w hw + => by + exact_mod_cast norm_ne_zero_iff.mpr (hA0 w hw) + refine ContinuousOn.mul ?_ h2 + exact continuous_ofReal.comp_continuousOn ((continuous_norm.continuousOn.sub + continuousOn_const).div_const _) + have hunit : ∀ w : ℂ, w ≠ 0 → (w.re / ‖w‖) ^ 2 + (w.im / ‖w‖) ^ 2 = 1 := fun w hw => by + have ht : ‖w‖ ≠ 0 := norm_ne_zero_iff.mpr hw + have h2 : w.re ^ 2 + w.im ^ 2 = ‖w‖ ^ 2 := by + rw [← normSq_eq_norm_sq, normSq_apply] + ring + field_simp + linarith + have hjre : ∀ w : ℂ, w ≠ 0 → (j w).re = (‖w‖ + ‖w‖⁻¹) / 2 * (w.re / ‖w‖) / a := fun w hw => by + simp [j, jou_re hw] + have hjim : ∀ w : ℂ, w ≠ 0 → (j w).im = (‖w‖ - ‖w‖⁻¹) / 2 * (w.im / ‖w‖) / b := fun w hw => by + simp [j, jou_im hw] + have hjnorm : ∀ w ∈ A, j w ∈ closedBall (0 : ℂ) 1 := + scaledJoukowski_mapsTo_ball ha0 hbpos haR hbR hjre hjim hunit + have hjsurj : ∀ z ∈ closedBall (0 : ℂ) 1, ∃ w ∈ A, j w = z := + scaledJoukowski_surjOn_ball hR0 ha0 hbpos haR hbR hunit + have hκnorm : ∀ w ∈ A, ‖κ w‖ = (‖w‖ - 1) / (R - 1) := by + intro w hw + have h0 := hA0 w hw + have ht : ‖w‖ ≠ 0 := norm_ne_zero_iff.mpr h0 + have h1 : 0 ≤ (‖w‖ - 1) / (R - 1) := div_nonneg (by linarith [hw.1]) hR1'.le + simp only [κ] + rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg h1, norm_div, Complex.norm_real, + norm_norm, div_self ht, mul_one] + have hκ1 : ∀ w ∈ A, κ w = 0 ↔ ‖w‖ = 1 := by + intro w hw + rw [← norm_eq_zero, hκnorm w hw, div_eq_zero_iff] + constructor + · rintro (h | h) + · linarith + · linarith + · intro h + exact .inl (by linarith) + have hfib : ∀ w ∈ A, ∀ w' ∈ A, j w = j w' → κ w = κ w' := by + intro w hw w' hw' h + have hjj : jou w = jou w' := by + apply Complex.ext + · have := congrArg Complex.re h + simp only [j, add_re, ofReal_re, mul_re, I_re, mul_zero, ofReal_im, I_im, mul_one, + sub_self, add_zero] at this + exact (div_left_inj₀ ha0.ne').mp this + · have := congrArg Complex.im h + simp only [j, add_im, ofReal_im, mul_im, I_re, mul_zero, ofReal_re, I_im, mul_one, + zero_add, add_zero] at this + exact (div_left_inj₀ hbpos.ne').mp this + rcases norm_eq_one_of_jou_eq hw.1 hw'.1 hjj with rfl | ⟨he, he'⟩ + · rfl + · rw [(hκ1 w hw).mpr he, (hκ1 w' hw').mpr he'] + let c : ℂ → ℂ := fun z => if h : ∃ w ∈ A, j w = z then κ h.choose else 0 + have hcj : ∀ w ∈ A, c (j w) = κ w := by + intro w hw + have h : ∃ w' ∈ A, j w' = j w := ⟨w, hw, rfl⟩ + simp only [c, dite_eq_left h] + exact hfib _ h.choose_spec.1 w hw h.choose_spec.2 + have hAsub : ∀ w ∈ A, κ w ∈ closedBall (0 : ℂ) 1 := fun w hw => by + rw [mem_closedBall_zero_iff, hκnorm w hw, div_le_one hR1'] + linarith [hw.2] + refine ⟨c, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · exact continuousOn_of_compact_surjOn hAc hjc hκc hjsurj hcj + · intro z hz + obtain ⟨w, hw, rfl⟩ := hjsurj z hz + rw [hcj w hw] + exact hAsub w hw + · intro z hz + have hzn : ‖z‖ = 1 := by simpa using hz + have h0 : z ≠ 0 := fun h => by simp [h] at hzn + have hRn : ‖(R : ℂ) * z‖ = R := by + rw [norm_mul, hzn, mul_one, Complex.norm_real, Real.norm_of_nonneg hR0.le] + have hwA : (R : ℂ) * z ∈ A := ⟨by rw [hRn]; exact hR1.le, by rw [hRn]⟩ + have hw0 := hA0 _ hwA + have h1 : j ((R : ℂ) * z) = z := by + apply Complex.ext + · rw [hjre _ hw0, hRn, haR] + simp [hR0.ne', ha0.ne'] + · rw [hjim _ hw0, hRn, hbR] + simp [hR0.ne', hbpos.ne'] + rw [← h1, hcj _ hwA] + simp only [h1, κ, hRn] + rw [div_self hR1'.ne'] + simp only [ofReal_one, one_mul] + exact mul_div_cancel_left₀ _ (by exact_mod_cast hR0.ne') + · intro z hz + obtain ⟨w, hw, rfl⟩ := hjsurj z hz + rw [hcj w hw, hκ1 w hw] + have h0 := hA0 w hw + exact scaledJoukowski_radius_eq_one ha0 hbpos hw.1 (hunit w h0) + (hjre w h0) (hjim w h0) + · intro z hz z' hz' hne he + obtain ⟨w, hw, rfl⟩ := hjsurj z hz + obtain ⟨w', hw', rfl⟩ := hjsurj z' hz' + rw [hcj w hw] at hne + rw [hcj w hw, hcj w' hw'] at he + have h1 : ‖w‖ = ‖w'‖ := by + have := congrArg norm he + rw [hκnorm w hw, hκnorm w' hw', div_left_inj₀ hR1'.ne'] at this + linarith + have h2 : ((‖w‖ - 1) / (R - 1) : ℝ) ≠ 0 := by + intro h3 + apply hne + simp only [κ] + rw [h3] + simp + have ht : ((‖w‖ : ℝ) : ℂ) ≠ 0 := by + exact_mod_cast norm_ne_zero_iff.mpr (hA0 w hw) + simp only [κ, ← h1] at he + have h3 := mul_left_cancel₀ (by exact_mod_cast h2) he + rw [div_left_inj₀ ht] at h3 + rw [h3] + · intro v hv + have hvn : ‖v‖ ≤ 1 := mem_closedBall_zero_iff.mp hv + by_cases h0 : v = 0 + · have h1A : (1 : ℂ) ∈ A := ⟨by rw [norm_one], by rw [norm_one]; exact hR1.le⟩ + refine ⟨j 1, hjnorm 1 h1A, ?_⟩ + rw [hcj 1 h1A, h0] + exact (hκ1 1 h1A).mpr norm_one + · have hvn0 : (0 : ℝ) < ‖v‖ := norm_pos_iff.mpr h0 + set t := 1 + ‖v‖ * (R - 1) with ht + have ht1 : 1 ≤ t := by nlinarith + have htR : t ≤ R := by nlinarith + have ht0 : 0 < t := by linarith + set w : ℂ := (t : ℂ) * (v / ‖v‖) with hw + have hwn : ‖w‖ = t := by + rw [hw, norm_mul, norm_div, Complex.norm_real, Complex.norm_real, Real.norm_of_nonneg + ht0.le, norm_norm, div_self hvn0.ne', mul_one] + have hwA : w ∈ A := ⟨by rw [hwn]; exact ht1, by rw [hwn]; exact htR⟩ + refine ⟨j w, hjnorm w hwA, ?_⟩ + rw [hcj w hwA] + simp only [κ, hwn] + have h1 : (t - 1) / (R - 1) = ‖v‖ := by + rw [ht] + field_simp + ring + rw [h1, hw] + have h2 : ((‖v‖ : ℝ) : ℂ) ≠ 0 := by exact_mod_cast hvn0.ne' + have h3 : (t : ℂ) ≠ 0 := by exact_mod_cast ht0.ne' + field_simp + +/-- The map `z ↦ m + p x + i q y` of the plane. -/ +noncomputable def axisStretch (m p q : ℝ) (hp : 0 < p) (hq : 0 < q) : ℂ ≃ₜ ℂ where + toFun z := ((m + p * z.re : ℝ) : ℂ) + ((q * z.im : ℝ) : ℂ) * I + invFun w := (((w.re - m) / p : ℝ) : ℂ) + ((w.im / q : ℝ) : ℂ) * I + left_inv z := by + apply Complex.ext + · simp + field_simp + · simp + field_simp + right_inv w := by + apply Complex.ext + · simp + field_simp + ring + · simp + field_simp + continuous_toFun := by + refine (continuous_ofReal.comp (by fun_prop)).add ((continuous_ofReal.comp + (by fun_prop)).mul continuous_const) + continuous_invFun := by + refine (continuous_ofReal.comp (by fun_prop)).add ((continuous_ofReal.comp + (by fun_prop)).mul continuous_const) + +variable {T : Type} [TopologicalSpace T] + +/-- An axis stretch of the unit disc lies in a thickening of its real-axis segment. -/ +theorem stretch_mapsTo_cthickening {O : Set ℂ} {A : ℂ → ℂ} + {α β m ℓ η a₀ : ℝ} (hαβ : α < β) (hm : m = (α + β) / 2) (hℓ : ℓ = (β - α) / 2) + (hp : 0 < ℓ * a₀) (hq : 0 < η / 2) (hscale : ℓ * a₀ = ℓ + η / 2) + (hAre : ∀ z, (A z).re = m + ℓ * a₀ * z.re) (hAim : ∀ z, (A z).im = η / 2 * z.im) + (hth : cthickening η (((↑) : ℝ → ℂ) '' Icc α β) ⊆ O) : + MapsTo A (closedBall (0 : ℂ) 1) O := by + intro z hz + have hzn : ‖z‖ ≤ 1 := mem_closedBall_zero_iff.mp hz + have hre : |z.re| ≤ 1 := (Complex.abs_re_le_norm z).trans hzn + have him : |z.im| ≤ 1 := (Complex.abs_im_le_norm z).trans hzn + refine hth ?_ + set y := max α (min β (A z).re) with hy + have hrea := abs_le.mp hre + have hyI : y ∈ Icc α β := ⟨le_max_left _ _, max_le hαβ.le (min_le_left _ _)⟩ + refine mem_cthickening_of_dist_le (A z) (y : ℂ) _ _ ⟨y, hyI, rfl⟩ ?_ + rw [dist_eq_norm] + refine (norm_le_abs_re_add_abs_im _).trans ?_ + simp only [sub_re, ofReal_re, sub_im, ofReal_im, sub_zero] + have h1 : |(A z).im| ≤ η / 2 := by + rw [hAim, abs_mul, abs_of_pos hq] + nlinarith + have h2 : |(A z).re - y| ≤ η / 2 := by + have h3 : (A z).re ≤ β + η / 2 := by + rw [hAre] + have h7 : ℓ * a₀ * z.re ≤ ℓ * a₀ * 1 := mul_le_mul_of_nonneg_left hrea.2 hp.le + rw [mul_one] at h7 + have h8 : m + ℓ = β := by rw [hm, hℓ]; ring + linarith [hscale] + have h4 : α - η / 2 ≤ (A z).re := by + rw [hAre] + have h7 : ℓ * a₀ * (-1) ≤ ℓ * a₀ * z.re := mul_le_mul_of_nonneg_left hrea.1 hp.le + rw [mul_neg_one] at h7 + have h8 : m - ℓ = α := by rw [hm, hℓ]; ring + linarith [hscale] + rw [abs_le] + constructor + · have h5 : y ≤ max α (A z).re := max_le_max_left _ (min_le_right _ _) + rcases le_total α (A z).re with h6 | h6 + · rw [max_eq_right h6] at h5 + linarith + · rw [max_eq_left h6] at h5 + linarith + · have h5 : min β (A z).re ≤ y := le_max_right _ _ + rcases le_total β (A z).re with h6 | h6 + · rw [min_eq_left h6] at h5 + linarith + · rw [min_eq_right h6] at h5 + linarith + linarith + +/-- The chart of a line, as a segment of the real axis, in a given open set. -/ +theorem exists_stretched_arc_chart (hT : IsClosedSurface T) {a : 𝕀 → T} + (ha : IsArcMap a) {W : Set T} + (hW : IsOpen W) (haW : range a ⊆ W) : + ∃ (O : Set ℂ) (K : ℂ → T) (s : ℝ), StripChart O K ∧ 0 < s ∧ s < 1 ∧ closedBall 0 1 ⊆ O + ∧ K '' closedBall 0 1 ⊆ W ∧ + K (-s : ℝ) = a 0 ∧ K (s : ℝ) = a 1 ∧ ∀ x, x ∈ range a ↔ ∃ z ∈ closedBall (0 : ℂ) 1, z.im = 0 + ∧ |z.re| ≤ s ∧ K z = x := by + classical + have hcpt : CompactSpace T := hT.1 + have ht2 : T2Space T := hT.2.1 + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + obtain ⟨D, hD, hs⟩ := exists_disc_of_arc hT ha + obtain ⟨h, g, cc⟩ := hD.exists_isChart + have hbc : BallChart 1 (g '' ball 0 1) h g := by + refine ⟨cc.isOpen_image_ball hman, cc.hc.mono ?_, cc.gc.mono ball_subset_closedBall, ?_, ?_, + ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact cc.gm (ball_subset_closedBall hz) + · rintro _ ⟨z, hz, rfl⟩ + rwa [cc.hg (ball_subset_closedBall hz)] + · exact fun z hz => ⟨z, hz, rfl⟩ + · rintro _ ⟨z, hz, rfl⟩ + rw [cc.hg (ball_subset_closedBall hz)] + · exact fun z hz => cc.hg (ball_subset_closedBall hz) + have hU : range a ⊆ g '' ball 0 1 := by + rw [← cc.discInt_eq] + exact hs + obtain ⟨O₀, K, θ, hK₀, hθc, hθm, hθ₀⟩ := exists_stripChart hman hbc ha hU + set O := O₀ ∩ K ⁻¹' W with hOdef + have hK : StripChart O K := ⟨hK₀.hc.isOpen_inter_preimage hK₀.isOpen hW, hK₀.hc.mono + inter_subset_left, + hK₀.hi.mono inter_subset_left, fun V hV hVO => hK₀.ho V hV (hVO.trans inter_subset_left)⟩ + have hθ : ∀ t, (θ t : ℂ) ∈ O ∧ K (θ t) = a t := fun t => + ⟨⟨(hθ₀ t).1, by rw [mem_preimage, (hθ₀ t).2]; exact haW (mem_range_self t)⟩, (hθ₀ t).2⟩ + set α := θ 0 with hα + set β := θ 1 with hβ + have hαβ : α < β := hθm zero_lt_one + set m := (α + β) / 2 with hm + set ℓ := (β - α) / 2 with hℓ + have hℓpos : 0 < ℓ := by rw [hℓ]; linarith + have hS : ((↑) : ℝ → ℂ) '' Icc α β ⊆ O := by + rintro _ ⟨y, hy, rfl⟩ + obtain ⟨r, -, rfl⟩ := image_sub_compact hθc zero_le_one hy + exact (hθ r).1 + obtain ⟨η, hη, hth⟩ := (isCompact_Icc.image continuous_ofReal).exists_cthickening_subset_open + hK.isOpen hS + set a₀ := 1 + η / (2 * ℓ) with ha₀ + have ha₁ : 1 < a₀ := by + have : 0 < η / (2 * ℓ) := by positivity + linarith + have ha₀pos : 0 < a₀ := by linarith + have hscale : ℓ * a₀ = ℓ + η / 2 := by + rw [ha₀] + field_simp + have hp : 0 < ℓ * a₀ := by positivity + have hq : 0 < η / 2 := by positivity + let A : ℂ ≃ₜ ℂ := axisStretch m (ℓ * a₀) (η / 2) hp hq + have hAre : ∀ z, (A z).re = m + ℓ * a₀ * z.re := fun z => by simp [A, axisStretch] + have hAim : ∀ z, (A z).im = η / 2 * z.im := fun z => by simp [A, axisStretch] + have hBO : ∀ z ∈ closedBall (0 : ℂ) 1, A z ∈ O := by + exact stretch_mapsTo_cthickening hαβ hm hℓ hp hq hscale hAre hAim hth + let O' : Set ℂ := A ⁻¹' O + let K' : ℂ → T := fun z => K (A z) + have hK' : StripChart O' K' := by + refine ⟨hK.isOpen.preimage A.continuous, hK.hc.comp A.continuous.continuousOn fun _ h => h, + fun z hz w hw he => A.injective (hK.hi hz hw he), fun W hW hWO => ?_⟩ + have h1 : K' '' W = K '' (A '' W) := by rw [image_image] + rw [h1] + refine hK.ho _ (A.isOpenMap _ hW) ?_ + rintro _ ⟨z, hz, rfl⟩ + exact hWO hz + have hrange : ∀ x, x ∈ range a ↔ ∃ z ∈ closedBall (0 : ℂ) 1, z.im = 0 ∧ |z.re| ≤ a₀⁻¹ ∧ K' z = x + := by + intro x + constructor + · rintro ⟨t, rfl⟩ + have hin : θ t ∈ Icc α β := ⟨hθm.monotone t.2.1, hθm.monotone t.2.2⟩ + set z := A.symm (θ t) with hz + have h1 : A z = θ t := A.apply_symm_apply _ + have h2 : z.im = 0 := by + have := hAim z + rw [h1] at this + simp only [ofReal_im] at this + have h3 : η / 2 * z.im = 0 := this.symm + exact (mul_eq_zero.mp h3).resolve_left hq.ne' + have h3 : ℓ * a₀ * z.re = θ t - m := by + have := hAre z + rw [h1] at this + simp only [ofReal_re] at this + linarith + have h4 : |z.re| ≤ a₀⁻¹ := by + have h5 : |θ t - m| ≤ ℓ := by + rw [abs_le, hm, hℓ] + constructor <;> linarith [hin.1, hin.2] + rw [← h3, abs_mul, abs_of_pos hp, mul_assoc] at h5 + have h6 : a₀ * |z.re| ≤ 1 := le_of_mul_le_mul_left (by simpa using h5) hℓpos + have h7 : a₀⁻¹ * (a₀ * |z.re|) ≤ a₀⁻¹ * 1 := mul_le_mul_of_nonneg_left h6 + (inv_pos.mpr ha₀pos).le + rwa [inv_mul_cancel_left₀ ha₀pos.ne', mul_one] at h7 + have hzb : z ∈ closedBall (0 : ℂ) 1 := by + rw [mem_closedBall_zero_iff] + refine (norm_le_abs_re_add_abs_im z).trans ?_ + rw [h2, abs_zero, add_zero] + exact h4.trans (inv_le_one_of_one_le₀ ha₁.le) + refine ⟨z, hzb, h2, h4, ?_⟩ + change K (A z) = _ + rw [h1, (hθ t).2] + · rintro ⟨z, hz, h1, h2, rfl⟩ + have h3 := abs_le.mp h2 + have h4 : A z = ((m + ℓ * a₀ * z.re : ℝ) : ℂ) := by + apply Complex.ext + · rw [hAre] + simp + · rw [hAim, h1] + simp + have h5 : a₀ * a₀⁻¹ = 1 := mul_inv_cancel₀ ha₀pos.ne' + have h6 : ℓ * a₀ * z.re ≤ ℓ := by + have h7 := mul_le_mul_of_nonneg_left h3.2 hp.le + have h8 : ℓ * a₀ * a₀⁻¹ = ℓ := by rw [mul_assoc, h5, mul_one] + linarith + have h7 : -ℓ ≤ ℓ * a₀ * z.re := by + have h9 := mul_le_mul_of_nonneg_left h3.1 hp.le + have h8 : ℓ * a₀ * a₀⁻¹ = ℓ := by rw [mul_assoc, h5, mul_one] + rw [mul_neg] at h9 + linarith + have hin : m + ℓ * a₀ * z.re ∈ Icc α β := by + constructor + · rw [hm, hℓ] at * + linarith + · rw [hm, hℓ] at * + linarith + obtain ⟨r, -, hr⟩ := image_sub_compact hθc zero_le_one hin + refine ⟨r, ?_⟩ + change a r = K (A z) + rw [h4, ← hr, (hθ r).2] + have hs₀ : 0 < a₀⁻¹ := inv_pos.mpr ha₀pos + have hs₁ : a₀⁻¹ < 1 := inv_lt_one_of_one_lt₀ ha₁ + have hend : ∀ σ : ℝ, |σ| = 1 → A ((σ * a₀⁻¹ : ℝ) : ℂ) = ((m + σ * ℓ : ℝ) : ℂ) := fun σ _ => by + apply Complex.ext + · rw [hAre] + simp only [ofReal_re] + have : a₀ * a₀⁻¹ = 1 := mul_inv_cancel₀ ha₀pos.ne' + calc m + ℓ * a₀ * (σ * a₀⁻¹) = m + σ * ℓ * (a₀ * a₀⁻¹) := by ring + _ = m + σ * ℓ := by rw [this, mul_one] + · rw [hAim] + simp + refine ⟨O', K', a₀⁻¹, hK', hs₀, hs₁, fun z hz => hBO z hz, ?_, ?_, ?_, hrange⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact (hBO z hz).2 + · change K (A _) = _ + have h1 := hend (-1) (by simp) + have h2 : m + -1 * ℓ = α := by rw [hm, hℓ]; ring + rw [h2] at h1 + have h3 : ((-a₀⁻¹ : ℝ) : ℂ) = ((-1 * a₀⁻¹ : ℝ) : ℂ) := by simp + rw [h3, h1, (hθ 0).2] + · change K (A _) = _ + have h1 := hend 1 (by simp) + have h2 : m + 1 * ℓ = β := by rw [hm, hℓ]; ring + rw [h2] at h1 + have h3 : ((a₀⁻¹ : ℝ) : ℂ) = ((1 * a₀⁻¹ : ℝ) : ℂ) := by simp + rw [h3, h1, (hθ 1).2] + +/-- **Collapsing an arc.** In a closed surface, there is a homotopy from the identity to a map onto +the surface that sends the arc to one point and is injective off the arc. -/ +theorem exists_collapse (hT : IsClosedSurface T) {a : 𝕀 → T} (ha : IsArcMap a) : + ∃ (c : 𝕀 × T → T) (w : T), Continuous c ∧ (∀ x, c (0, x) = x) ∧ (∀ x ∈ range a, c (1, x) = w) ∧ + (∀ x ∉ range a, c (1, x) ≠ w) ∧ InjOn (fun x => c (1, x)) (range a)ᶜ ∧ Function.Surjective + (fun x => c (1, x)) := by + classical + have ht2 : T2Space T := hT.2.1 + obtain ⟨O, K', s, hK', hs₀, hs₁, hBO, -, -, -, hrange⟩ := + exists_stretched_arc_chart hT ha isOpen_univ (subset_univ _) + have ha₁ : 1 < s⁻¹ := (one_lt_inv₀ hs₀).2 hs₁ + obtain ⟨c₀, hc₀, hc₀m, hc₀s, hc₀z, hc₀i, hc₀o⟩ := exists_ball_collapse ha₁ + simp only [inv_inv] at hc₀z + have hBc : IsCompact (closedBall (0 : ℂ) 1) := isCompact_closedBall _ _ + let Φ : 𝕀 × ℂ → ℂ := fun q => ((1 - q.1.1 : ℝ) : ℂ) * q.2 + (q.1.1 : ℂ) * c₀ q.2 + have hΦc : ContinuousOn Φ (univ ×ˢ closedBall (0 : ℂ) 1) := by + have h1 : Continuous fun q : 𝕀 × ℂ => ((q.1.1 : ℝ) : ℂ) := continuous_ofReal.comp + (continuous_subtype_val.comp continuous_fst) + have h2 : Continuous fun q : 𝕀 × ℂ => ((1 - q.1.1 : ℝ) : ℂ) := continuous_ofReal.comp + (by fun_prop) + have h3 : ContinuousOn (fun q : 𝕀 × ℂ => c₀ q.2) (univ ×ˢ closedBall (0 : ℂ) 1) := + hc₀.comp continuousOn_snd fun q hq => hq.2 + exact (h2.continuousOn.mul continuousOn_snd).add (h1.continuousOn.mul h3) + have hΦm : ∀ p, ∀ z ∈ closedBall (0 : ℂ) 1, Φ (p, z) ∈ closedBall (0 : ℂ) 1 := by + intro p z hz + have h1 := (convex_closedBall (0 : ℂ) 1) hz (hc₀m hz) (a := 1 - p.1) (b := p.1) + (by linarith [p.2.2]) p.2.1 (by ring) + simpa [Φ, Complex.real_smul] using h1 + have hΦid : ∀ p, ∀ z ∈ frontier (closedBall (0 : ℂ) 1), Φ (p, z) = z := by + intro p z hz + rw [frontier_closedBall _ one_ne_zero] at hz + simp only [Φ, hc₀s z hz] + push_cast + ring + obtain ⟨c, hcc, hc1, hc2⟩ := exists_glue hK' hBc hBO Φ hΦc hΦm hΦid + have hΦ0 : ∀ z, Φ (0, z) = z := fun z => by simp [Φ] + have hΦ1 : ∀ z, Φ (1, z) = c₀ z := fun z => by simp [Φ] + have hc1' : ∀ z ∈ closedBall (0 : ℂ) 1, c (1, K' z) = K' (c₀ z) := fun z hz + => by rw [hc1 _ z hz, hΦ1] + have hK'i : InjOn K' (closedBall (0 : ℂ) 1) := hK'.hi.mono hBO + have h0B : (0 : ℂ) ∈ closedBall (0 : ℂ) 1 := by simp + refine ⟨c, K' 0, hcc, ?_, ?_, ?_, ?_, ?_⟩ + · intro x + by_cases hx : x ∈ K' '' closedBall (0 : ℂ) 1 + · obtain ⟨z, hz, rfl⟩ := hx + rw [hc1 _ z hz, hΦ0] + · exact hc2 _ x hx + · intro x hx + obtain ⟨z, hz, h1, h2, rfl⟩ := (hrange x).mp hx + rw [hc1' z hz, (hc₀z z hz).mpr ⟨h1, h2⟩] + · intro x hx he + by_cases hin : x ∈ K' '' closedBall (0 : ℂ) 1 + · obtain ⟨z, hz, rfl⟩ := hin + rw [hc1' z hz] at he + have h1 := hK'i (hc₀m hz) h0B he + obtain ⟨h2, h3⟩ := (hc₀z z hz).mp h1 + exact hx ((hrange _).mpr ⟨z, hz, h2, h3, rfl⟩) + · rw [hc2 _ x hin] at he + exact hin ⟨0, h0B, he.symm⟩ + · intro x hx y hy he + simp only at he + have hne : ∀ z ∈ closedBall (0 : ℂ) 1, K' z ∉ range a → c₀ z ≠ 0 := fun z hz hn h0 => by + obtain ⟨h2, h3⟩ := (hc₀z z hz).mp h0 + exact hn ((hrange _).mpr ⟨z, hz, h2, h3, rfl⟩) + by_cases hin : x ∈ K' '' closedBall (0 : ℂ) 1 <;> by_cases hin' : y ∈ K' '' closedBall (0 : ℂ) 1 + · obtain ⟨z, hz, rfl⟩ := hin + obtain ⟨z', hz', rfl⟩ := hin' + rw [hc1' z hz, hc1' z' hz'] at he + rw [hc₀i z hz z' hz' (hne z hz hx) (hK'i (hc₀m hz) (hc₀m hz') he)] + · obtain ⟨z, hz, rfl⟩ := hin + rw [hc1' z hz, hc2 _ y hin'] at he + exact absurd ⟨_, hc₀m hz, he⟩ hin' + · obtain ⟨z, hz, rfl⟩ := hin' + rw [hc1' z hz, hc2 _ x hin] at he + exact absurd ⟨_, hc₀m hz, he.symm⟩ hin + · rwa [hc2 _ x hin, hc2 _ y hin'] at he + · intro y + by_cases hin : y ∈ K' '' closedBall (0 : ℂ) 1 + · obtain ⟨v, hv, rfl⟩ := hin + obtain ⟨z, hz, rfl⟩ := hc₀o v hv + exact ⟨K' z, hc1' z hz⟩ + · exact ⟨y, hc2 _ y hin⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Collar.lean b/LeanPool/GraphMinor/Surface/Collar.lean new file mode 100644 index 0000000000..69f95e7b53 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Collar.lean @@ -0,0 +1,728 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Annulus +import Mathlib.Topology.Order.IntermediateValue + +/-! +# A larger closed disc around a closed disc + +Let `Δ` be a closed disc of a surface whose boundary consists of interior points of the surface. In +this file we find a closed disc `Δ'` that has `Δ` in its inside, in any neighbourhood of the +boundary +of `Δ` (`exists_disc_around`). + +We add caps from `Cap.lean` along the boundary of `Δ`, in two rounds. We cut the boundary into an +even +number of short arcs. The first round adds a cap exactly along every second arc, so the remaining +arcs +stay in the boundary. The second round adds a cap along each remaining arc, a little longer than the +arc. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +local notation "𝕀" => unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- There is no continuous injective map from the circle to the line, by the mean value theorem +applied to the difference between antipodal points. -/ +theorem not_injective_circle_real {f : Circle → ℝ} (hf : Continuous f) : ¬ Function.Injective f + := by + intro hinj + let d : ℝ → ℝ := fun θ => f (Circle.exp θ) - f (Circle.exp (θ + Real.pi)) + have hd : Continuous d := by fun_prop + have h2 : d Real.pi = - d 0 := by + have : Circle.exp (Real.pi + Real.pi) = Circle.exp 0 := by + rw [← two_mul, Circle.exp_two_pi, Circle.exp_zero] + simp only [d, this, zero_add] + ring + have hzero : ∃ θ, d θ = 0 := by + rcases le_total (d 0) 0 with h | h + · obtain ⟨θ, -, hθ⟩ := intermediate_value_Icc Real.pi_pos.le hd.continuousOn + (show (0 : ℝ) ∈ Icc (d 0) (d Real.pi) from ⟨h, by rw [h2]; linarith⟩) + exact ⟨θ, hθ⟩ + · obtain ⟨θ, -, hθ⟩ := intermediate_value_Icc' Real.pi_pos.le hd.continuousOn + (show (0 : ℝ) ∈ Icc (d Real.pi) (d 0) from ⟨by rw [h2]; linarith, h⟩) + exact ⟨θ, hθ⟩ + obtain ⟨θ, hθ⟩ := hzero + have h3 : Circle.exp θ = Circle.exp (θ + Real.pi) := hinj (sub_eq_zero.mp hθ) + have hpi : Circle.exp Real.pi = -1 := Circle.ext (by simp [Circle.coe_exp, Complex.exp_pi_mul_I]) + have h4 : Circle.exp (θ + Real.pi) = - Circle.exp θ := by + rw [Circle.exp_add, hpi, mul_neg, mul_one] + rw [h4] at h3 + have h5 := congrArg (fun w : Circle => (w : ℂ)) h3 + simp only [Circle.coe_neg] at h5 + have h6 : (Circle.exp θ : ℂ) = 0 := by + linear_combination h5 / 2 + exact Circle.coe_ne_zero _ h6 + +/-- A chart of a closed disc turned by the angle `ρ`. -/ +theorem IsChart.rotate {D : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart D h g) (ρ : ℝ) : + IsChart D (fun x => cis' (-ρ) * h x) (fun z => g (cis' ρ * z)) := by + have hmul : ∀ (θ : ℝ) (z : ℂ), ‖cis' θ * z‖ = ‖z‖ := fun θ z => by rw [norm_mul, norm_cis', + one_mul] + have hcan : ∀ (θ : ℝ) (z : ℂ), cis' θ * (cis' (-θ) * z) = z := fun θ z => by + rw [← mul_assoc, cis', cis', ← Complex.exp_add] + simp + have hcan' : ∀ (θ : ℝ) (z : ℂ), cis' (-θ) * (cis' θ * z) = z := fun θ z => by + have := hcan (-θ) z + rwa [neg_neg] at this + have hball : ∀ θ, MapsTo (fun z => cis' θ * z) (closedBall (0 : ℂ) 1) (closedBall 0 1) + := fun θ z hz => by + rw [mem_closedBall_zero_iff] at hz ⊢ + change ‖cis' θ * z‖ ≤ 1 + rwa [hmul] + refine ⟨continuousOn_const.mul c.hc, c.gc.comp (continuousOn_const.mul continuousOn_id) (hball ρ), + fun x hx => hball (-ρ) (c.hm hx), fun z hz => c.gm (hball ρ hz), fun x hx => ?_, fun z hz + => ?_, ?_⟩ + · show g (cis' ρ * (cis' (-ρ) * h x)) = x + rw [hcan] + exact c.gh hx + · show cis' (-ρ) * h (g (cis' ρ * z)) = z + rw [c.hg (hball ρ hz), hcan'] + · have h1 : (fun x => cis' (-ρ) * h x) '' discBd D = (fun z => cis' (-ρ) * z) '' (h '' discBd D) + := by + rw [image_image] + rw [h1, c.bd] + ext z + constructor + · rintro ⟨w, hw, rfl⟩ + rw [mem_sphere_zero_iff_norm] at hw ⊢ + change ‖cis' (-ρ) * w‖ = 1 + rwa [hmul] + · intro hz + refine ⟨cis' ρ * z, ?_, hcan' ρ z⟩ + rw [mem_sphere_zero_iff_norm] at hz ⊢ + rwa [hmul] + +theorem cis'_mul (a b : ℝ) : cis' a * cis' b = cis' (a + b) := by + rw [cis', cis', cis', ← Complex.exp_add] + congr 1 + push_cast + ring + +/-- A line in the boundary of a closed disc is an arc between two angles of a suitable chart. -/ +theorem exists_angle_chart {D Q : Set S} {s t : S} (hD : IsClosedDisc D) + (hQ : IsLineWithEnds Q s t) (hsub : Q ⊆ discBd D) : + ∃ h g α β, IsChart D h g ∧ -Real.pi < α ∧ α < β ∧ β < Real.pi ∧ angleArc g α β = Q := by + classical + obtain ⟨a, ha, har, ha0, ha1⟩ := hQ.exists_arc + have hst : s ≠ t := fun he => by + have : (0 : 𝕀) = 1 := ha.2 (by rw [ha0, ha1, he]) + exact zero_ne_one this + have hQc : IsCompact Q := har ▸ isCompact_range ha.1 + have hQp : IsPreconnected Q := har ▸ isPreconnected_range ha.1 + obtain ⟨hw, hwQ⟩ : ∃ w, w ∈ discBd D ∧ w ∉ Q := by + by_contra hcon + push Not at hcon + obtain ⟨φ⟩ := hD.isOArc_discBd + obtain ⟨f, -, -⟩ := id hQ + refine not_injective_circle_real + (f := fun w => ((f.symm ⟨(φ w).1, hcon _ (φ w).2⟩ : 𝕀) : ℝ)) + (continuous_subtype_val.comp (f.symm.continuous.comp + (Continuous.subtype_mk (continuous_subtype_val.comp φ.continuous) _))) fun w w' he => ?_ + have h1 := f.symm.injective (Subtype.ext he) + exact φ.injective (Subtype.ext (congrArg (Subtype.val : Q → S) h1)) + obtain ⟨h₀, g₀, c₀⟩ := hD.exists_isChart + -- turn the chart so that `w` goes to `-1` + have hmemS : ∀ {h : S → ℂ} {g : ℂ → S}, IsChart D h g → ∀ {x}, x ∈ discBd D → ‖h x‖ = 1 := + fun c x hx => mem_sphere_zero_iff_norm.mp (c.bd ▸ mem_image_of_mem _ hx) + have hcis : ∀ {z : ℂ}, ‖z‖ = 1 → cis' (Complex.arg z) = z := fun {z} hz => by + have := Complex.norm_mul_exp_arg_mul_I z + rw [hz] at this + simpa [cis'] using this + have hvn : ‖h₀ hw‖ = 1 := hmemS c₀ hwQ.1 + set ρ := Complex.arg (h₀ hw) + Real.pi with hρ + have c₁ := c₀.rotate ρ + set h₁ : S → ℂ := fun x => cis' (-ρ) * h₀ x with hh₁ + set g₁ : ℂ → S := fun z => g₀ (cis' ρ * z) with hg₁ + have hw1 : h₁ hw = -1 := by + change cis' (-ρ) * h₀ hw = -1 + conv_lhs => rw [← hcis hvn] + rw [cis'_mul] + have : -ρ + Complex.arg (h₀ hw) = -Real.pi := by + rw [hρ] + ring + rw [this, cis'] + simp [Complex.exp_neg] + have hDQ : Q ⊆ D := hsub.trans (discBd_subset D) + have hnorm : ∀ x ∈ Q, ‖h₁ x‖ = 1 := fun x hx => hmemS c₁ (hsub hx) + have hne1 : ∀ x ∈ Q, h₁ x ≠ -1 := fun x hx he => by + apply hwQ.2 + have h1 : hw = x := by + rw [← c₁.gh (discBd_subset D hwQ.1), ← c₁.gh (hDQ hx)] + show g₁ (h₁ hw) = g₁ (h₁ x) + rw [hw1, he] + exact h1 ▸ hx + have hslit : ∀ x ∈ Q, h₁ x ∈ Complex.slitPlane := fun x hx => by + rw [Complex.mem_slitPlane_iff_arg] + refine ⟨fun he => hne1 x hx ?_, fun h0 => ?_⟩ + · rw [← hcis (hnorm x hx), he, cis'] + simp + · have := hnorm x hx + rw [h0] at this + simp at this + have hargc : ContinuousOn Complex.arg Complex.slitPlane := + fun u hu => (Complex.continuousAt_arg hu).continuousWithinAt + have hfc : ContinuousOn (fun x => Complex.arg (h₁ x)) Q := hargc.comp (c₁.hc.mono hDQ) hslit + let A : Set ℝ := (fun x => Complex.arg (h₁ x)) '' Q + have hAc : IsCompact A := hQc.image_of_continuousOn hfc + have hsQ : s ∈ Q := by + rw [← har, ← ha0] + exact ⟨0, rfl⟩ + have htQ : t ∈ Q := by + rw [← har, ← ha1] + exact ⟨1, rfl⟩ + have hAconn : IsConnected A := ⟨⟨_, s, hsQ, rfl⟩, hQp.image _ hfc⟩ + have hAeq := eq_Icc_of_connected_compact hAconn hAc + have hαm : sInf A ∈ A := hAc.sInf_mem hAconn.nonempty + have hβm : sSup A ∈ A := hAc.sSup_mem hAconn.nonempty + have hle : sInf A ≤ sSup A := csInf_le_csSup hAconn.nonempty hAc.bddBelow hAc.bddAbove + have hbd : ∀ a ∈ A, -Real.pi < a ∧ a < Real.pi := by + rintro _ ⟨x, hx, rfl⟩ + refine ⟨Complex.neg_pi_lt_arg _, lt_of_le_of_ne (Complex.arg_le_pi _) ?_⟩ + exact ((Complex.mem_slitPlane_iff_arg.mp (hslit x hx)).1) + refine ⟨h₁, g₁, sInf A, sSup A, c₁, (hbd _ hαm).1, ?_, (hbd _ hβm).2, ?_⟩ + · refine lt_of_le_of_ne hle fun he => hst ?_ + have h1 : ∀ x ∈ A, x = sInf A := fun x hx => by + have h2 := hAeq ▸ hx + exact le_antisymm (h2.2.trans he.symm.le) h2.1 + have hs := h1 _ ⟨s, hsQ, rfl⟩ + have ht := h1 _ ⟨t, htQ, rfl⟩ + have h2 : h₁ s = h₁ t := by + rw [← hcis (hnorm s hsQ), ← hcis (hnorm t htQ)] + show cis' (Complex.arg (h₁ s)) = cis' (Complex.arg (h₁ t)) + have hs' : Complex.arg (h₁ s) = sInf A := hs + have ht' : Complex.arg (h₁ t) = sInf A := ht + rw [hs', ht'] + calc s = g₁ (h₁ s) := (c₁.gh (hDQ hsQ)).symm + _ = g₁ (h₁ t) := by rw [h2] + _ = t := c₁.gh (hDQ htQ) + · ext z + constructor + · rintro ⟨θ, hθ, rfl⟩ + have h1 : θ ∈ A := hAeq ▸ hθ + obtain ⟨x, hx, he⟩ := h1 + have he' : Complex.arg (h₁ x) = θ := he + change g₁ (cis' θ) ∈ Q + rw [← he', hcis (hnorm x hx)] + have : g₁ (h₁ x) = x := c₁.gh (hDQ hx) + rwa [this] + · intro hz + have h1 : Complex.arg (h₁ z) ∈ Icc (sInf A) (sSup A) := hAeq ▸ ⟨z, hz, rfl⟩ + refine ⟨_, h1, ?_⟩ + change g₁ (cis' (Complex.arg (h₁ z))) = z + rw [hcis (hnorm z hz)] + exact c₁.gh (hDQ hz) + +/-- Adding a cap along a line of the boundary of a closed disc. -/ +theorem exists_disc_add [T2Space S] {D Q : Set S} {s t : S} (hD : IsClosedDisc D) + (hQ : IsLineWithEnds Q s t) (hsub : Q ⊆ discBd D) {R : ℝ} {U : Set S} {k : S → ℂ} {l : ℂ → S} + (c : BallChart R U k l) {N : Set S} (hN : IsOpen N) (hQN : Q ⊆ U ∩ N) : + ∃ D', IsClosedDisc D' ∧ D ⊆ D' ∧ D' ⊆ D ∪ N ∧ discBd D \ (Q \ {s, t}) ⊆ discBd D' ∧ + Q \ {s, t} ⊆ D' \ discBd D' := by + obtain ⟨h, g, α, β, cD, hα, hαβ, hβ, rfl⟩ := exists_angle_chart hD hQ hsub + obtain ⟨T, hT, hTN, hTD, hTb⟩ := exists_cap_angle cD c hN hα hαβ hβ hQN + obtain ⟨h1, h2⟩ := disc_union D T (angleArc g α β) s t hD hT hQ (by rw [inter_comm]; exact hTD) + hsub hTb + refine ⟨D ∪ T, h1, subset_union_left, union_subset_union_right _ hTN, ?_, ?_⟩ + · rw [h2] + exact fun z hz => ⟨.inl hz.1, hz.2⟩ + · rw [h2] + intro z hz + exact ⟨.inl (discBd_subset D (hsub hz.1)), fun h3 => h3.2 hz⟩ + +/-- Adding a cap along a slightly longer line of the boundary. -/ +theorem exists_disc_add_wide [T2Space S] {D Q : Set S} {s t : S} (hD : IsClosedDisc D) + (hQ : IsLineWithEnds Q s t) (hsub : Q ⊆ discBd D) {R : ℝ} {U : Set S} {k : S → ℂ} {l : ℂ → S} + (c : BallChart R U k l) {N : Set S} (hN : IsOpen N) (hQN : Q ⊆ U ∩ N) : + ∃ D', IsClosedDisc D' ∧ D ⊆ D' ∧ D' ⊆ D ∪ N ∧ discBd D \ N ⊆ discBd D' ∧ Q ⊆ D' \ discBd D' + := by + obtain ⟨h, g, α, β, cD, hα, hαβ, hβ, rfl⟩ := exists_angle_chart hD hQ hsub + obtain ⟨η, hη, hα₁, hβ₁, O, hO, hOθ, hOg⟩ := + cD.exists_margin (c.isOpen.inter hN) hα hαβ.le hβ hQN + have hL := cD.isLine_angleArc hα₁ (by linarith) hβ₁ + have hLU : angleArc g (α - η) (β + η) ⊆ U ∩ N := by + rintro _ ⟨θ, hθ, rfl⟩ + exact hOg _ (hOθ θ hθ) (norm_cis' θ).le + obtain ⟨D', h1, h2, h3, h4, h5⟩ := exists_disc_add hD hL (cD.angleArc_subset _ _) c hN hLU + refine ⟨D', h1, h2, h3, ?_, ?_⟩ + · rintro z ⟨hz, hzN⟩ + exact h4 ⟨hz, fun h6 => hzN (hLU h6.1).2⟩ + · rintro _ ⟨θ, hθ, rfl⟩ + have hmem : ∀ x ∈ Icc (α - η) (β + η), x ∈ Ioo (-Real.pi) Real.pi := + fun x hx => ⟨hα₁.trans_le hx.1, hx.2.trans_lt hβ₁⟩ + have hθ' : θ ∈ Icc (α - η) (β + η) := ⟨by linarith [hθ.1], by linarith [hθ.2]⟩ + have hne : ∀ x ∈ Icc (α - η) (β + η), x ≠ θ → g (cis' x) ≠ g (cis' θ) := fun x hx hxθ he => by + have h6 := cD.injOn (cis'_mem_closedBall x) (cis'_mem_closedBall θ) he + exact hxθ (cis'_injOn (hmem x hx) (hmem θ hθ') h6) + refine h5 ⟨⟨θ, hθ', rfl⟩, ?_⟩ + rintro (h6 | h6) + · exact hne (α - η) ⟨le_rfl, by linarith⟩ (by linarith [hθ.1]) h6.symm + · exact hne (β + η) ⟨by linarith, le_rfl⟩ (by linarith [hθ.2]) h6.symm + +theorem IsChart.isLine_angleArc' [T2Space S] {D : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart D h g) + {a b : ℝ} (hab : a < b) (hb : b < a + 2 * Real.pi) : + IsLineWithEnds (angleArc g a b) (g (cis' a)) (g (cis' b)) := by + set m := (a + b) / 2 with hm + have c' := c.rotate m + have hL := c'.isLine_angleArc (α := a - m) (β := b - m) (by rw [hm]; linarith) (by linarith) + (by rw [hm]; linarith) + have hrot : ∀ θ, g (cis' m * cis' (θ - m)) = g (cis' θ) := fun θ => by + rw [cis'_mul, add_sub_cancel] + have heq : angleArc (fun z => g (cis' m * z)) (a - m) (b - m) = angleArc g a b := by + ext x + constructor + · rintro ⟨θ, hθ, rfl⟩ + refine ⟨θ + m, ⟨by linarith [hθ.1], by linarith [hθ.2]⟩, ?_⟩ + change g (cis' (θ + m)) = g (cis' m * cis' θ) + rw [cis'_mul, add_comm] + · rintro ⟨θ, hθ, rfl⟩ + exact ⟨θ - m, ⟨by linarith [hθ.1], by linarith [hθ.2]⟩, hrot θ⟩ + rw [heq, hrot a, hrot b] at hL + exact hL + +theorem cis'_period (θ : ℝ) : cis' (θ + 2 * Real.pi) = cis' θ := by + rw [cis', cis'] + push_cast + rw [add_mul, Complex.exp_add, Complex.exp_two_pi_mul_I, mul_one] + +theorem cis'_ne_of_lt {θ θ' : ℝ} (h1 : θ < θ') (h2 : θ' < θ + 2 * Real.pi) : cis' θ ≠ cis' θ' := by + intro he + set m := (θ + θ') / 2 with hm + have h3 : cis' (θ - m) = cis' (θ' - m) := by + rw [sub_eq_add_neg, sub_eq_add_neg, ← cis'_mul, ← cis'_mul, he] + have := cis'_injOn (x₁ := θ - m) (x₂ := θ' - m) ⟨by rw [hm]; linarith, by rw [hm]; linarith⟩ + ⟨by rw [hm]; linarith, by rw [hm]; linarith⟩ h3 + linarith + +private theorem add_even_boundary_caps [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) + {Δ W : Set S} (hΔ : IsClosedDisc Δ) (hW : IsOpen W) (hsub : discBd Δ ⊆ W) + {n : ℕ} {A : ℕ → Set S} {e₀ e₁ : ℕ → S} + {U : ℝ → Set S} {k : ℝ → S → ℂ} {l : ℝ → ℂ → S} + (hc : ∀ θ, BallChart 1 (U θ) (k θ) (l θ)) + (hAU : ∀ j : ℕ, j < 2 * n → ∃ θ, A j ⊆ U θ) + (hline : ∀ j, IsLineWithEnds (A j) (e₀ j) (e₁ j)) + (hAb : ∀ j, A j ⊆ discBd Δ) + (hsep : ∀ j j' : ℕ, j < 2 * n → j' < 2 * n → j ≠ j' → + Disjoint (A j) (A j' \ {e₀ j', e₁ j'})) : + let Ao : ℕ → Set S := fun j => A j \ {e₀ j, e₁ j} + ∀ k : ℕ, k ≤ n → ∃ D, IsClosedDisc D ∧ Δ ⊆ D ∧ D ⊆ Δ ∪ W ∧ + (∀ i < k, Ao (2 * i) ⊆ D \ discBd D) ∧ ∀ z ∈ discBd Δ, (∀ i < k, z ∉ Ao (2 * i)) → z ∈ discBd D + := by + dsimp only + intro k + induction k with + | zero => + intro _ + exact ⟨Δ, hΔ, Subset.rfl, subset_union_left, fun i hi => absurd hi (by omega), + fun z hz _ => hz⟩ + | succ k ih => + intro hk + obtain ⟨D, h1, h2, h3, h4, h5⟩ := ih (by omega) + have hj : 2 * k < 2 * n := by omega + obtain ⟨θ, hθ⟩ := hAU _ hj + have hQ : A (2 * k) ⊆ discBd D := fun z hz => h5 z (hAb _ hz) fun i hi hz' => + Set.disjoint_left.mp (hsep (2 * k) (2 * i) hj (by omega) (by omega)) hz hz' + obtain ⟨D', h6, h7, h8, h9, h10⟩ := exists_disc_add h1 (hline (2 * k)) hQ (hc θ) hW + fun z hz => ⟨hθ hz, hsub (hAb _ hz)⟩ + refine ⟨D', h6, h2.trans h7, h8.trans (union_subset h3 subset_union_right), ?_, ?_⟩ + · intro i hi + rcases Nat.lt_succ_iff_lt_or_eq.mp hi with hi' | rfl + · exact (h4 i hi').trans (discInt_mono hman h1 h7) + · exact h10 + · intro z hz hall + exact h9 ⟨h5 z hz fun i hi => hall i (by omega), hall k (by omega)⟩ + +private theorem add_odd_boundary_caps [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) + {Δ D₁ W : Set S} (h1 : IsClosedDisc D₁) (hW : IsOpen W) (hsub : discBd Δ ⊆ W) + {n : ℕ} {A : ℕ → Set S} {e₀ e₁ : ℕ → S} + {U : ℝ → Set S} {k : ℝ → S → ℂ} {l : ℝ → ℂ → S} + (hc : ∀ θ, BallChart 1 (U θ) (k θ) (l θ)) + (hAU : ∀ j : ℕ, j < 2 * n → ∃ θ, A j ⊆ U θ) + (hline : ∀ j, IsLineWithEnds (A j) (e₀ j) (e₁ j)) + (hAb : ∀ j, A j ⊆ discBd Δ) (hAc : ∀ j, IsClosed (A j)) + (hodd : ∀ i < n, A (2 * i + 1) ⊆ discBd D₁) + (hsep2 : ∀ i i' : ℕ, i < n → i' < n → i ≠ i' → + Disjoint (A (2 * i + 1)) (A (2 * i' + 1))) : + ∀ k : ℕ, k ≤ n → ∃ D, IsClosedDisc D ∧ D₁ ⊆ D ∧ D ⊆ D₁ ∪ W ∧ + (∀ i < k, A (2 * i + 1) ⊆ D \ discBd D) ∧ ∀ i, k ≤ i → i < n → A (2 * i + 1) ⊆ discBd D := by + intro k + induction k with + | zero => + intro _ + exact ⟨D₁, h1, Subset.rfl, subset_union_left, fun i hi => absurd hi (by omega), + fun i _ hi => hodd i hi⟩ + | succ k ih => + intro hk + obtain ⟨D, g1, g2, g3, g4, g5⟩ := ih (by omega) + have hj : 2 * k + 1 < 2 * n := by omega + obtain ⟨θ, hθ⟩ := hAU _ hj + let M : Set S := ⋃ i ∈ {i | i < n ∧ i ≠ k}, A (2 * i + 1) + have hMc : IsClosed M := by + refine Set.Finite.isClosed_biUnion ((finite_lt_nat n).subset fun i hi => hi.1) fun i _ => ?_ + exact hAc (2 * i + 1) + have hN : IsOpen (W \ M) := hW.sdiff hMc + obtain ⟨D', g6, g7, g8, g9, g10⟩ := exists_disc_add_wide g1 (hline (2 * k + 1)) + (g5 k le_rfl (by omega)) (hc θ) hN fun z hz => ⟨hθ hz, hsub (hAb _ hz), fun hzM => by + obtain ⟨i, hi, hzi⟩ := mem_iUnion₂.mp hzM + exact Set.disjoint_left.mp (hsep2 k i (by omega) hi.1 hi.2.symm) hz hzi⟩ + refine ⟨D', g6, g2.trans g7, g8.trans (union_subset g3 ?_), ?_, ?_⟩ + · exact (sdiff_subset).trans subset_union_right + · intro i hi + rcases Nat.lt_succ_iff_lt_or_eq.mp hi with hi' | rfl + · exact (g4 i hi').trans (discInt_mono hman g1 g7) + · exact g10 + · intro i hi hin z hz + refine g9 ⟨g5 i (by omega) hin hz, fun hzN => hzN.2 ?_⟩ + exact mem_iUnion₂.mpr ⟨i, ⟨hin, by omega⟩, hz⟩ + +/-- **A closed disc around a closed disc.** See the module docstring. -/ +theorem exists_disc_around [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) {Δ W : Set S} + (hΔ : IsClosedDisc Δ) (hint : ∀ x ∈ discBd Δ, IsInteriorPoint x) (hW : IsOpen W) + (hsub : discBd Δ ⊆ W) : + ∃ Δ', IsClosedDisc Δ' ∧ Δ ⊆ Δ' \ discBd Δ' ∧ Δ' ⊆ Δ ∪ W := by + classical + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + let P : ℝ → S := fun θ => g (cis' θ) + have hPc : Continuous P := c.gc.comp_continuous continuous_cis' fun θ => cis'_mem_closedBall θ + have hPb : ∀ θ, P θ ∈ discBd Δ := fun θ => c.angleArc_subset θ θ ⟨θ, by simp, rfl⟩ + have hch : ∀ θ, ∃ U k l, BallChart 1 U k l ∧ U ⊆ W ∧ l 0 = P θ := fun θ => + (hint _ (hPb θ)).exists_ballChart hW (hsub (hPb θ)) one_pos + choose U k l hc hUW hl0 using hch + have hmemU : ∀ θ, P θ ∈ U θ := fun θ => by + rw [← hl0 θ] + exact (hc θ).gm (by simp) + have hpi := Real.pi_pos + obtain ⟨δ, hδ, hleb⟩ := lebesgue_number_lemma_of_metric (isCompact_Icc (a := (0 : ℝ)) + (b := 2 * Real.pi)) (c := fun θ => P ⁻¹' U θ) (fun θ => (hc θ).isOpen.preimage hPc) + fun θ _ => mem_iUnion.mpr ⟨θ, hmemU θ⟩ + obtain ⟨n, hn⟩ := exists_nat_gt (Real.pi / δ + 1) + have hnpos : (0 : ℝ) < n := by + have : 0 < Real.pi / δ := by positivity + linarith + set τ := Real.pi / n with hτ + have hτ0 : 0 < τ := by positivity + have hnτ : (n : ℝ) * τ = Real.pi := by + rw [hτ] + field_simp + have hn1 : (1 : ℝ) ≤ n := by + have : 0 < Real.pi / δ := by positivity + linarith + have hτπ : τ ≤ Real.pi := by nlinarith + have hτδ : τ < δ := by + rw [hτ, div_lt_iff₀ hnpos] + have h1 : Real.pi / δ < n := by linarith + rw [div_lt_iff₀ hδ] at h1 + linarith + let E : ℕ → Set ℝ := fun j => Icc ((j : ℝ) * τ) (((j : ℝ) + 1) * τ) + let A : ℕ → Set S := fun j => angleArc g ((j : ℝ) * τ) (((j : ℝ) + 1) * τ) + let e₀ : ℕ → S := fun j => P ((j : ℝ) * τ) + let e₁ : ℕ → S := fun j => P (((j : ℝ) + 1) * τ) + let Ao : ℕ → Set S := fun j => A j \ {e₀ j, e₁ j} + have hline : ∀ j, IsLineWithEnds (A j) (e₀ j) (e₁ j) := fun j => + c.isLine_angleArc' (by nlinarith) (by nlinarith) + have hAb : ∀ j, A j ⊆ discBd Δ := fun j => c.angleArc_subset _ _ + have hAU : ∀ j : ℕ, j < 2 * n → ∃ θ, A j ⊆ U θ := fun j hj => by + have hj' : (j : ℝ) + 1 ≤ 2 * n := by exact_mod_cast hj + have hm : (j : ℝ) * τ ∈ Icc 0 (2 * Real.pi) := + ⟨by positivity, by nlinarith⟩ + obtain ⟨θ, hθ⟩ := hleb _ hm + refine ⟨θ, ?_⟩ + rintro _ ⟨x, hx, rfl⟩ + refine hθ ?_ + rw [mem_ball, Real.dist_eq, abs_lt] + constructor + · linarith [hx.1] + · linarith [hx.2] + have hord : ∀ a b : ℕ, a ≤ b → (a : ℝ) * τ ≤ (b : ℝ) * τ := fun a b hab => + mul_le_mul_of_nonneg_right (by exact_mod_cast hab) hτ0.le + have htwo : (2 * (n : ℝ)) * τ = 2 * Real.pi := by rw [mul_assoc, hnτ] + -- two points of the boundary with different angles + have hPne : ∀ {θ θ' : ℝ}, θ < θ' → θ' < θ + 2 * Real.pi → P θ ≠ P θ' := fun h1 h2 he => + cis'_ne_of_lt h1 h2 (c.injOn (cis'_mem_closedBall _) (cis'_mem_closedBall _) he) + have hEb : ∀ j : ℕ, j < 2 * n → ∀ θ ∈ E j, 0 ≤ θ ∧ θ ≤ 2 * Real.pi := fun j hj θ hθ => by + have h1 := hord (j + 1) (2 * n) hj + push_cast at h1 + have h2 := hθ.2 + have h3 := hθ.1 + constructor + · have : (0 : ℝ) ≤ (j : ℝ) * τ := by positivity + linarith + · linarith + -- a point of the open arc has an angle strictly inside + have hAo : ∀ j z, z ∈ Ao j → ∃ θ, (j : ℝ) * τ < θ ∧ θ < ((j : ℝ) + 1) * τ ∧ P θ = z := by + rintro j _ ⟨⟨θ, hθ, rfl⟩, hne⟩ + refine ⟨θ, lt_of_le_of_ne hθ.1 fun he => hne (.inl ?_), lt_of_le_of_ne hθ.2 fun he => hne + (.inr ?_), + rfl⟩ + · change P θ = P _ + rw [he] + · change P θ = P _ + rw [he] + -- a closed arc misses the open arcs of the other arcs + have hsep : ∀ j j' : ℕ, j < 2 * n → j' < 2 * n → j ≠ j' → Disjoint (A j) (Ao j') := by + intro j j' hj hj' hne + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨θ, hθ, rfl⟩ hz + obtain ⟨θ', h1, h2, h3⟩ := hAo j' _ hz + obtain ⟨h4, h5⟩ := hEb j hj θ hθ + have h6 := (hEb j' hj') θ' ⟨h1.le, h2.le⟩ + rcases lt_or_gt_of_ne hne with hlt | hlt + · have h7 := hord (j + 1) j' hlt + push_cast at h7 + have h8 := hθ.2 + have h9 := hord (j' + 1) (2 * n) hj' + push_cast at h9 + exact hPne (by linarith) (by linarith) h3.symm + · have h7 := hord (j' + 1) j hlt + push_cast at h7 + have h8 := hθ.1 + refine hPne (θ := θ') (θ' := θ) (by linarith) ?_ h3 + have h9 : (0 : ℝ) ≤ (j' : ℝ) * τ := by positivity + linarith + -- arcs of the same parity are disjoint + have hsep2 : ∀ i i' : ℕ, i < n → i' < n → i ≠ i' → Disjoint (A (2 * i + 1)) (A (2 * i' + 1)) := by + have key : ∀ i i' : ℕ, i < n → i < i' → i' < n → Disjoint (A (2 * i + 1)) (A (2 * i' + 1)) := by + intro i i' hi hii hi' + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨θ, hθ, rfl⟩ ⟨θ', hθ', he⟩ + have h1 := hord (2 * i + 1 + 1 + 1) (2 * i' + 1) (by omega) + have h2 := hord (2 * i' + 1 + 1) (2 * n) (by omega) + have h3 := hord 0 (2 * i + 1) (by omega) + have h4 := hθ.1 + have h5 := hθ.2 + have h6 := hθ'.1 + have h7 := hθ'.2 + push_cast at h1 h2 h3 h4 h5 h6 h7 + exact hPne (θ := θ) (θ' := θ') (by nlinarith) (by nlinarith) he.symm + intro i i' hi hi' hne + rcases lt_or_gt_of_ne hne with h | h + · exact key i i' hi h hi' + · exact (key i' i hi' h hi).symm + obtain ⟨D₁, h1, h2, h3, h4, h5⟩ := + add_even_boundary_caps hman hΔ hW hsub hc hAU hline hAb hsep n le_rfl + have hodd : ∀ i < n, A (2 * i + 1) ⊆ discBd D₁ := fun i hi z hz => h5 z (hAb _ hz) fun i' hi' hz' + => + Set.disjoint_left.mp (hsep (2 * i + 1) (2 * i') (by omega) (by omega) (by omega)) hz hz' + obtain ⟨D₂, f1, f2, f3, f4, -⟩ := + add_odd_boundary_caps hman h1 hW hsub hc hAU hline hAb + (fun _ => (isCompact_Icc.image hPc).isClosed) hodd hsep2 n le_rfl + refine ⟨D₂, f1, ?_, f3.trans (union_subset h3 subset_union_right)⟩ + have hD₁D₂ : D₁ \ discBd D₁ ⊆ D₂ \ discBd D₂ := discInt_mono hman h1 f2 + intro x hx + by_cases hxb : x ∈ discBd Δ + · -- the angle of `x` + have hxn : ‖h x‖ = 1 := mem_sphere_zero_iff_norm.mp (c.bd ▸ mem_image_of_mem h hxb) + have hang : ∃ θ, 0 ≤ θ ∧ θ < 2 * Real.pi ∧ P θ = x := by + have hcis : cis' (Complex.arg (h x)) = h x := by + have := Complex.norm_mul_exp_arg_mul_I (h x) + rw [hxn] at this + simpa [cis'] using this + have hgx : g (h x) = x := c.gh hx + rcases le_or_gt 0 (Complex.arg (h x)) with h0 | h0 + · refine ⟨_, h0, ?_, by change g (cis' _) = x; rw [hcis, hgx]⟩ + linarith [Complex.arg_le_pi (h x)] + · refine ⟨Complex.arg (h x) + 2 * Real.pi, by linarith [Complex.neg_pi_lt_arg (h x)], by + linarith, ?_⟩ + change g (cis' _) = x + rw [cis'_period, hcis, hgx] + obtain ⟨θ, hθ0, hθ2, hPx⟩ := hang + subst hPx + have hdiv : 0 ≤ θ / τ := by positivity + set j := ⌊θ / τ⌋₊ with hjdef + have hj1 : (j : ℝ) * τ ≤ θ := by + have := Nat.floor_le hdiv + rwa [le_div_iff₀ hτ0] at this + have hj2 : θ < ((j : ℝ) + 1) * τ := by + have := Nat.lt_floor_add_one (θ / τ) + rwa [div_lt_iff₀ hτ0] at this + have hj3 : j < 2 * n := by + have h7 : (j : ℝ) * τ < (2 * (n : ℝ)) * τ := by rw [htwo]; linarith + have h8 : (j : ℝ) < 2 * (n : ℝ) := lt_of_mul_lt_mul_right h7 hτ0.le + exact_mod_cast h8 + obtain ⟨k, hk | hk⟩ := Nat.even_or_odd' j + · by_cases he : (j : ℝ) * τ = θ + · rcases Nat.eq_zero_or_pos k with rfl | hkpos + · have hn0 : 0 < n := by omega + have hθz : θ = 0 := by + rw [← he, hk] + simp + subst hθz + have h7 : P 0 ∈ A (2 * (n - 1) + 1) := by + refine ⟨2 * Real.pi, ⟨?_, ?_⟩, ?_⟩ + · calc ((2 * (n - 1) + 1 : ℕ) : ℝ) * τ ≤ ((2 * n : ℕ) : ℝ) * τ := hord _ _ (by omega) + _ = 2 * Real.pi := by + push_cast + exact htwo + · have h8 : ((2 * (n - 1) + 1 : ℕ) : ℝ) + 1 = 2 * (n : ℝ) := by + have : 2 * (n - 1) + 1 + 1 = 2 * n := by omega + exact_mod_cast this + rw [h8, htwo] + · change g (cis' _) = g (cis' 0) + have := cis'_period 0 + rw [zero_add] at this + rw [this] + exact f4 (n - 1) (by omega) h7 + · have h7 : P θ ∈ A (2 * (k - 1) + 1) := by + refine ⟨θ, ⟨?_, ?_⟩, rfl⟩ + · have := hord (2 * (k - 1) + 1) j (by omega) + linarith + · have h8 : ((2 * (k - 1) + 1 : ℕ) : ℝ) + 1 = (j : ℝ) := by + have : 2 * (k - 1) + 1 + 1 = j := by omega + exact_mod_cast this + rw [h8] + exact he.symm.le + exact f4 (k - 1) (by omega) h7 + · have hlt : (j : ℝ) * τ < θ := lt_of_le_of_ne hj1 he + have h7 : P θ ∈ Ao (2 * k) := by + rw [← hk] + refine ⟨⟨θ, ⟨hj1, hj2.le⟩, rfl⟩, ?_⟩ + rintro (h8 | h8) + · exact hPne (θ := (j : ℝ) * τ) (θ' := θ) hlt (by nlinarith) h8.symm + · exact hPne (θ := θ) (θ' := ((j : ℝ) + 1) * τ) hj2 (by nlinarith) h8 + exact hD₁D₂ (h4 k (by omega) h7) + · exact f4 k (by omega) (hk ▸ ⟨θ, ⟨hj1, hj2.le⟩, rfl⟩) + · have h6 : x ∈ Δ \ discBd Δ := ⟨hx, hxb⟩ + exact hD₁D₂ (discInt_mono hman hΔ h2 h6) + +/-- The circle is the unit sphere of the plane. -/ +theorem exists_circle_sphere : ∃ o : Circle ≃ₜ sphere (0 : ℂ) 1, ∀ w : Circle, (o w).1 = w := by + have hemb : IsEmbedding fun w : Circle => (w : ℂ) := IsEmbedding.subtypeVal + have hr : range (fun w : Circle => (w : ℂ)) = sphere 0 1 := by + ext z + constructor + · rintro ⟨w, rfl⟩ + exact mem_sphere_zero_iff_norm.mpr (Circle.norm_coe w) + · intro hz + exact ⟨⟨z, by simpa [Submonoid.unitSphere] using hz⟩, rfl⟩ + refine ⟨hemb.toHomeomorph.trans (Homeomorph.setCongr hr), fun w => rfl⟩ + +/-- **The annulus between two nested closed discs.** Coordinates on the larger disc by the disc of +radius `2`, such that the unit disc is the smaller disc, with a given boundary parametrization. -/ +theorem exists_disc_collar {Δ Δ' : Set S} (hΔ : IsClosedDisc Δ) (hΔ' : IsClosedDisc Δ') + (hin : Δ ⊆ Δ' \ discBd Δ') (p : Circle ≃ₜ discBd Δ) : + ∃ (c : ℂ → S) (c' : S → ℂ), ContinuousOn c (closedBall 0 2) ∧ ContinuousOn c' Δ' ∧ + MapsTo c (closedBall 0 2) Δ' ∧ MapsTo c' Δ' (closedBall 0 2) ∧ + LeftInvOn c' c (closedBall 0 2) ∧ RightInvOn c' c Δ' ∧ c '' closedBall 0 1 = Δ ∧ + c '' sphere 0 2 = discBd Δ' ∧ ∀ w : Circle, c w = (p w).1 := by + classical + obtain ⟨h', g', cD⟩ := hΔ'.exists_isChart + have hsubD : Δ ⊆ Δ' := fun x hx => (hin hx).1 + have hbdΔ : discBd Δ ⊆ Δ := discBd_subset Δ + -- the small disc in the coordinates of the large one + have hg'h : LeftInvOn g' h' Δ := cD.gh.mono hsubD + have hcont₁ : ContinuousOn g' (h' '' Δ) := cD.gc.mono (cD.image_subset hsubD) + obtain ⟨hE, hEb⟩ := hΔ.image (cD.hc.mono hsubD) hcont₁ hg'h + have hFo : Nonempty (Circle ≃ₜ h' '' discBd Δ) := hEb ▸ hE.isOArc_discBd + have hEeq : h' '' Δ = closedInner (h' '' discBd Δ) := eq_closedInner_of_discBd hFo hE hEb + obtain ⟨r, hr⟩ := exists_homeomorph_image (cD.hc.mono (hbdΔ.trans hsubD)) + (cD.gc.mono (cD.image_subset (hbdΔ.trans hsubD))) (hg'h.mono hbdΔ) + obtain ⟨o, ho⟩ := exists_circle_sphere + obtain ⟨h₀, k₀, m₀, hv₀⟩ := exists_bdMatch ((o.symm.trans p).trans r) + have hoS : Nonempty (Circle ≃ₜ sphere (0 : ℂ) 1) := ⟨o⟩ + obtain ⟨Ψ, hΨ, hΨi⟩ := exists_plane_homeomorph hoS hFo m₀ + rw [closedInner_sphere, ← hEeq] at hΨi + have hh₀ : ∀ w : Circle, h₀ w = h' (p w).1 := fun w => by + have h1 := hv₀ (o w) + rw [ho w] at h1 + rw [h1] + simp [hr] + obtain ⟨hd₂, hd₂b⟩ := isClosedDisc_closedBall.1.image (f := Ψ.symm) (f' := Ψ) + Ψ.symm.continuous.continuousOn Ψ.continuous.continuousOn fun z _ => Ψ.apply_symm_apply z + rw [isClosedDisc_closedBall.2] at hd₂b + have hF₂ : Nonempty (Circle ≃ₜ Ψ.symm '' sphere (0 : ℂ) 1) := hd₂b ▸ hd₂.isOArc_discBd + have hcl₂ := image_closedBall_of_homeomorph Ψ.symm hF₂ rfl + have hin₂ : closedBall (0 : ℂ) 1 ⊆ inner (Ψ.symm '' sphere (0 : ℂ) 1) := fun z hz => by + have h1 : Ψ z ∈ h' '' Δ := hΨi ▸ mem_image_of_mem Ψ hz + obtain ⟨x, hx, hxe⟩ := h1 + have h2 : x ∈ discInt Δ' := hin hx + rw [cD.discInt_eq] at h2 + obtain ⟨u, hu, rfl⟩ := h2 + rw [cD.hg (ball_subset_closedBall hu)] at hxe + have h3 : ‖Ψ z‖ < 1 := by + rw [← hxe] + exact mem_ball_zero_iff.mp hu + have h4 : z ∈ closedInner (Ψ.symm '' sphere (0 : ℂ) 1) := by + rw [← hcl₂] + exact ⟨Ψ z, mem_ball_zero_iff.mpr h3 |> ball_subset_closedBall, Ψ.symm_apply_apply z⟩ + rcases h4 with h4 | ⟨w, hw, rfl⟩ + · exact h4 + · rw [Ψ.apply_symm_apply] at h3 + rw [mem_sphere_zero_iff_norm] at hw + linarith + obtain ⟨φ₂⟩ := id hF₂ + obtain ⟨Θ, Θ', m, hid, hsph⟩ := exists_annulus φ₂ hin₂ + rw [← hcl₂] at m + have hΘb : ∀ z ∈ closedBall (0 : ℂ) 2, Ψ (Θ z) ∈ closedBall (0 : ℂ) 1 := fun z hz => by + obtain ⟨y, hy, he⟩ := m.1 hz + rw [← he, Ψ.apply_symm_apply] + exact hy + have hb₁₂ : closedBall (0 : ℂ) 1 ⊆ closedBall 0 2 := closedBall_subset_closedBall (by norm_num) + have hc₁ : ContinuousOn (fun z => Ψ (Θ z)) (closedBall 0 2) := + Ψ.continuous.comp_continuousOn m.2.2.2.2.1 + refine ⟨fun z => g' (Ψ (Θ z)), fun x => Θ' (Ψ.symm (h' x)), cD.gc.comp hc₁ hΘb, ?_, ?_, ?_, ?_, + ?_, + ?_, ?_, ?_⟩ + · refine m.2.2.2.2.2.comp (Ψ.symm.continuous.comp_continuousOn cD.hc) ?_ + exact fun x hx => mem_image_of_mem _ (cD.hm hx) + · exact fun z hz => cD.gm (hΘb z hz) + · exact fun x hx => m.2.1 (mem_image_of_mem _ (cD.hm hx)) + · intro z hz + change Θ' (Ψ.symm (h' (g' (Ψ (Θ z))))) = z + rw [cD.hg (hΘb z hz), Ψ.symm_apply_apply] + exact m.2.2.1 hz + · intro x hx + change g' (Ψ (Θ (Θ' (Ψ.symm (h' x))))) = x + have h1 : Ψ.symm (h' x) ∈ Ψ.symm '' closedBall 0 1 := mem_image_of_mem _ (cD.hm hx) + have h2 : Θ (Θ' (Ψ.symm (h' x))) = Ψ.symm (h' x) := m.2.2.2.1 h1 + rw [h2, Ψ.apply_symm_apply] + exact cD.gh hx + · ext x + constructor + · rintro ⟨z, hz, rfl⟩ + have h1 : Θ z = z := hid hz + change g' (Ψ (Θ z)) ∈ Δ + rw [h1] + obtain ⟨y, hy, he⟩ : Ψ z ∈ h' '' Δ := hΨi ▸ mem_image_of_mem Ψ hz + rw [← he, hg'h hy] + exact hy + · intro hx + obtain ⟨z, hz, he⟩ : h' x ∈ Ψ '' closedBall 0 1 := hΨi ▸ mem_image_of_mem h' hx + refine ⟨z, hz, ?_⟩ + change g' (Ψ (Θ z)) = x + rw [hid hz] + change g' (Ψ z) = x + rw [he] + exact hg'h hx + · rw [← cD.g_sphere] + have h1 : (fun z => Ψ (Θ z)) '' sphere 0 2 = sphere 0 1 := by + have : (fun z => Ψ (Θ z)) '' sphere 0 2 = Ψ '' (Θ '' sphere 0 2) := by + rw [image_image] + rw [this, hsph, image_image] + simp + rw [← h1, image_image] + · intro w + have hw : (w : ℂ) ∈ sphere (0 : ℂ) 1 := mem_sphere_zero_iff_norm.mpr (Circle.norm_coe w) + have hw' : (w : ℂ) ∈ closedBall (0 : ℂ) 1 := sphere_subset_closedBall hw + change g' (Ψ (Θ w)) = _ + rw [hid hw'] + change g' (Ψ w) = _ + rw [hΨ hw, hh₀, cD.gh (hsubD (hbdΔ (p w).2))] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CrossCut.lean b/LeanPool/GraphMinor/Surface/CrossCut.lean new file mode 100644 index 0000000000..29b0d7c104 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CrossCut.lean @@ -0,0 +1,597 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.JordanDomain +import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# Cutting a Jordan domain along a cross-cut + +For an `O`-arc `F` in the complex plane, `inner F` is the bounded component of the complement and +`outer F` the unbounded one. `theta_cut` is the theta curve lemma: if `F = A₁ ∪ A₂`, and `c` is an +arc with its open part in `inner F` and with the same ends as `A₁` and `A₂`, then `inner F` minus +`c` is the disjoint union of `inner (A₁ ∪ c)` and `inner (A₂ ∪ c)`. The proof uses the frontier +property of the Jordan curve theorem and Janiszewski's theorem. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +/-- The bounded part of the complement of `F`. -/ +def inner (F : Set ℂ) : Set ℂ := {z | z ∉ F ∧ Bornology.IsBounded (connectedComponentIn Fᶜ z)} + +/-- The unbounded part of the complement of `F`. -/ +def outer (F : Set ℂ) : Set ℂ := {z | z ∉ F ∧ ¬ Bornology.IsBounded (connectedComponentIn Fᶜ z)} + +/-- The facts of the Jordan curve theorem in terms of `inner` and `outer`, gathered for use in this +file. `isJordanParts` proves them for every `O`-arc. -/ +structure IsJordanParts (F : Set ℂ) : Prop where + isOpen_inner : IsOpen (inner F) + isOpen_outer : IsOpen (outer F) + isConnected_inner : IsConnected (inner F) + isConnected_outer : IsConnected (outer F) + isBounded_inner : Bornology.IsBounded (inner F) + not_isBounded_outer : ¬ Bornology.IsBounded (outer F) + disjoint : Disjoint (inner F) (outer F) + union_eq : inner F ∪ outer F = Fᶜ + frontier_inner : frontier (inner F) = F + frontier_outer : frontier (outer F) = F + isCompact : IsCompact F + +/-- The Jordan curve theorem in terms of `inner` and `outer`. -/ +theorem isJordanParts {F : Set ℂ} (φ : Circle ≃ₜ F) : IsJordanParts F := by + obtain ⟨A, B, ⟨hne, hcomp, hAf, hBf⟩, hAb, hBb⟩ := jordan_complex φ + rw [← compl_eq_univ_sdiff] at hcomp + have hFc := isCompact_of_oArc φ + have hAmem : A ∈ componentsIn Fᶜ := by rw [hcomp]; simp + have hBmem : B ∈ componentsIn Fᶜ := by rw [hcomp]; simp + obtain ⟨a, ha, rfl⟩ := hAmem + obtain ⟨b, hb, rfl⟩ := hBmem + have hsplit : ∀ z, z ∉ F → connectedComponentIn Fᶜ z = connectedComponentIn Fᶜ a ∨ + connectedComponentIn Fᶜ z = connectedComponentIn Fᶜ b := by + intro z hz + have : connectedComponentIn Fᶜ z ∈ componentsIn Fᶜ := mem_image_of_mem _ hz + rw [hcomp] at this + exact this + have hinner : inner F = connectedComponentIn Fᶜ a := by + ext z + constructor + · rintro ⟨hz, hzb⟩ + rcases hsplit z hz with h | h + · exact h ▸ mem_connectedComponentIn hz + · exact absurd (h ▸ hzb) hBb + · intro hz + have hzF : z ∉ F := connectedComponentIn_subset _ _ hz + exact ⟨hzF, by rw [← connectedComponentIn_eq hz]; exact hAb⟩ + have houter : outer F = connectedComponentIn Fᶜ b := by + ext z + constructor + · rintro ⟨hz, hzb⟩ + rcases hsplit z hz with h | h + · exact absurd (h ▸ hAb) hzb + · exact h ▸ mem_connectedComponentIn hz + · intro hz + have hzF : z ∉ F := connectedComponentIn_subset _ _ hz + exact ⟨hzF, by rw [← connectedComponentIn_eq hz]; exact hBb⟩ + refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, hFc⟩ + · rw [hinner]; exact isOpen_component hFc.isClosed a + · rw [houter]; exact isOpen_component hFc.isClosed b + · rw [hinner]; exact isConnected_connectedComponentIn_iff.mpr ha + · rw [houter]; exact isConnected_connectedComponentIn_iff.mpr hb + · rw [hinner]; exact hAb + · rw [houter]; exact hBb + · exact Set.disjoint_left.mpr fun z h1 h2 => h2.2 h1.2 + · ext z + constructor + · rintro (h | h) <;> exact h.1 + · intro hz + by_cases hb' : Bornology.IsBounded (connectedComponentIn Fᶜ z) + · exact Or.inl ⟨hz, hb'⟩ + · exact Or.inr ⟨hz, hb'⟩ + · rw [hinner]; exact hAf + · rw [houter]; exact hBf + +namespace IsJordanParts + +variable {F : Set ℂ} + +theorem inner_subset_compl (_h : IsJordanParts F) : inner F ⊆ Fᶜ := fun _ hz => hz.1 + +theorem outer_subset_compl (_h : IsJordanParts F) : outer F ⊆ Fᶜ := fun _ hz => hz.1 + +theorem closure_inner (h : IsJordanParts F) : closure (inner F) = inner F ∪ F := by + rw [closure_eq_self_union_frontier, h.frontier_inner] + +theorem closure_outer (h : IsJordanParts F) : closure (outer F) = outer F ∪ F := by + rw [closure_eq_self_union_frontier, h.frontier_outer] + +theorem isCompact_closure_inner (h : IsJordanParts F) : IsCompact (inner F ∪ F) := + h.closure_inner ▸ h.isBounded_inner.isCompact_closure + +/-- A preconnected set that misses `F` and meets `outer F` lies in `outer F`. -/ +theorem subset_outer (h : IsJordanParts F) {C : Set ℂ} (hC : IsPreconnected C) (hF : Disjoint C F) + (hne : (C ∩ outer F).Nonempty) : C ⊆ outer F := by + have hsub : C ⊆ inner F ∪ outer F := by + rw [h.union_eq] + exact fun z hz hzF => Set.disjoint_left.mp hF hz hzF + have := hC.subset_right_of_subset_union h.isOpen_inner h.isOpen_outer h.disjoint hsub hne + exact this + +/-- A preconnected set that misses `F` and meets `inner F` lies in `inner F`. -/ +theorem subset_inner (h : IsJordanParts F) {C : Set ℂ} (hC : IsPreconnected C) (hF : Disjoint C F) + (hne : (C ∩ inner F).Nonempty) : C ⊆ inner F := by + have hsub : C ⊆ inner F ∪ outer F := by + rw [h.union_eq] + exact fun z hz hzF => Set.disjoint_left.mp hF hz hzF + exact hC.subset_left_of_subset_union h.isOpen_inner h.isOpen_outer h.disjoint hsub hne + +/-- A point of `F'` that is no point of `F`, and a limit of `outer F`, lies in `outer F`. -/ +theorem mem_outer_of_mem_closure (h : IsJordanParts F) {z : ℂ} (hz : z ∈ closure (outer F)) + (hzF : z ∉ F) : z ∈ outer F := by + rw [h.closure_outer] at hz + exact hz.resolve_right hzF + +end IsJordanParts + +/-- The data of a theta curve: three arcs with common ends `p, q`, the arc `c` inside `F`. -/ +structure IsTheta (F F₁ F₂ A₁ A₂ c : Set ℂ) (p q : ℂ) : Prop where + parts : IsJordanParts F + parts₁ : IsJordanParts F₁ + parts₂ : IsJordanParts F₂ + eq : F = A₁ ∪ A₂ + eq₁ : F₁ = A₁ ∪ c + eq₂ : F₂ = A₂ ∪ c + meet : A₁ ∩ A₂ ⊆ {p, q} + ends : p ∈ c ∧ q ∈ c + inside : c \ {p, q} ⊆ inner F + ends₁ : p ∈ F ∧ q ∈ F + conn : IsPreconnected c + ne₁ : (A₁ \ {p, q}).Nonempty + ne₂ : (A₂ \ {p, q}).Nonempty + +namespace IsTheta + +variable {F F₁ F₂ A₁ A₂ c : Set ℂ} {p q : ℂ} + +/-- The theta curve with the two sides exchanged. -/ +theorem symm (h : IsTheta F F₁ F₂ A₁ A₂ c p q) : IsTheta F F₂ F₁ A₂ A₁ c p q where + parts := h.parts + parts₁ := h.parts₂ + parts₂ := h.parts₁ + eq := by rw [h.eq, union_comm] + eq₁ := h.eq₂ + eq₂ := h.eq₁ + meet := by rw [inter_comm]; exact h.meet + ends := h.ends + inside := h.inside + ends₁ := h.ends₁ + conn := h.conn + ne₁ := h.ne₂ + ne₂ := h.ne₁ + +theorem c_disjoint_outer (h : IsTheta F F₁ F₂ A₁ A₂ c p q) : Disjoint c (outer F) := by + refine Set.disjoint_left.mpr fun z hz hzo => ?_ + by_cases hpq : z ∈ ({p, q} : Set ℂ) + · rcases hpq with rfl | hpq + · exact hzo.1 h.ends₁.1 + · rw [mem_singleton_iff.mp hpq] at hzo + exact hzo.1 h.ends₁.2 + · exact Set.disjoint_left.mp h.parts.disjoint (h.inside ⟨hz, hpq⟩) hzo + +theorem outer_subset₁ (h : IsTheta F F₁ F₂ A₁ A₂ c p q) : outer F ⊆ outer F₁ := by + have hdisj : Disjoint (outer F) F₁ := by + rw [h.eq₁, Set.disjoint_union_right] + refine ⟨Set.disjoint_left.mpr fun z hz hzA => hz.1 ?_, h.c_disjoint_outer.symm⟩ + rw [h.eq] + exact Or.inl hzA + have hsub : outer F ⊆ inner F₁ ∪ outer F₁ := by + rw [h.parts₁.union_eq] + exact fun z hz hzF => Set.disjoint_left.mp hdisj hz hzF + by_contra hcon + have hin : outer F ⊆ inner F₁ := by + refine h.parts.isConnected_outer.isPreconnected.subset_left_of_subset_union + h.parts₁.isOpen_inner h.parts₁.isOpen_outer h.parts₁.disjoint hsub ?_ + obtain ⟨z, hz, hzn⟩ := not_subset.mp hcon + exact ⟨z, hz, (hsub hz).resolve_right hzn⟩ + exact h.parts.not_isBounded_outer (h.parts₁.isBounded_inner.subset hin) + +/-- The open arc on the other side lies outside `F₁`. -/ +theorem open_arc_subset_outer (h : IsTheta F F₁ F₂ A₁ A₂ c p q) : A₂ \ {p, q} ⊆ outer F₁ := by + rintro z ⟨hzA, hz⟩ + have hzF : z ∈ F := by rw [h.eq]; exact Or.inr hzA + have hcl : z ∈ closure (outer F) := h.parts.frontier_outer.symm ▸ hzF |> frontier_subset_closure + refine h.parts₁.mem_outer_of_mem_closure (closure_mono h.outer_subset₁ hcl) ?_ + rw [h.eq₁] + rintro (h1 | h1) + · exact hz (h.meet ⟨h1, hzA⟩) + · exact (Set.disjoint_left.mp h.parts.disjoint (h.inside ⟨h1, hz⟩)) (by + exact absurd hzF ((h.inside ⟨h1, hz⟩).1)) + +theorem inner_disjoint_F (h : IsTheta F F₁ F₂ A₁ A₂ c p q) : Disjoint (inner F₁) F := by + refine Set.disjoint_left.mpr fun z hz hzF => ?_ + rw [h.eq] at hzF + have hzF₁ : z ∉ F₁ := hz.1 + rcases hzF with hzA | hzA + · exact hzF₁ (h.eq₁ ▸ Or.inl hzA) + · by_cases hpq : z ∈ ({p, q} : Set ℂ) + · rcases hpq with rfl | hpq + · exact hzF₁ (h.eq₁ ▸ Or.inr h.ends.1) + · rw [mem_singleton_iff.mp hpq] at hzF₁ + exact hzF₁ (h.eq₁ ▸ Or.inr h.ends.2) + · exact Set.disjoint_left.mp h.parts₁.disjoint hz (h.open_arc_subset_outer ⟨hzA, hpq⟩) + +/-- Each part lies in `inner F`. -/ +theorem inner_subset₁ (h : IsTheta F F₁ F₂ A₁ A₂ c p q) : inner F₁ ⊆ inner F := by + intro z hz + have hzF : z ∉ F := fun hzF => Set.disjoint_left.mp h.inner_disjoint_F hz hzF + have hzU : z ∈ inner F ∪ outer F := by rw [h.parts.union_eq]; exact hzF + refine hzU.resolve_right fun hzo => ?_ + exact Set.disjoint_left.mp h.parts₁.disjoint hz (h.outer_subset₁ hzo) + +/-- The two parts are disjoint. -/ +theorem disjoint_inner (h : IsTheta F F₁ F₂ A₁ A₂ c p q) : Disjoint (inner F₁) (inner F₂) := by + have hsub : inner F₁ ⊆ outer F₂ := by + obtain ⟨a, ha⟩ := h.ne₁ + have haA : a ∈ A₁ := ha.1 + have hao : a ∈ outer F₂ := h.symm.open_arc_subset_outer ha + have hfr : a ∈ frontier (inner F₁) := by + rw [h.parts₁.frontier_inner, h.eq₁] + exact Or.inl haA + have hcl : a ∈ closure (inner F₁) := frontier_subset_closure hfr + obtain ⟨z, hz1, hz2⟩ := mem_closure_iff.mp hcl _ h.parts₂.isOpen_outer hao + refine h.parts₂.subset_outer h.parts₁.isConnected_inner.isPreconnected ?_ ⟨z, hz2, hz1⟩ + refine Set.disjoint_left.mpr fun w hw hwF => ?_ + rw [h.eq₂] at hwF + rcases hwF with hwA | hwc + · exact Set.disjoint_left.mp h.inner_disjoint_F hw (h.eq ▸ Or.inr hwA) + · exact hw.1 (h.eq₁ ▸ Or.inr hwc) + exact Set.disjoint_left.mpr fun z h1 h2 => + Set.disjoint_left.mp h.parts₂.disjoint h2 (hsub h1) + +theorem inter_eq (h : IsTheta F F₁ F₂ A₁ A₂ c p q) : F₁ ∩ F₂ = c := by + ext z + constructor + · rintro ⟨h1, h2⟩ + rw [h.eq₁] at h1 + rw [h.eq₂] at h2 + rcases h1 with h1 | h1 + · rcases h2 with h2 | h2 + · rcases h.meet ⟨h1, h2⟩ with rfl | h3 + · exact h.ends.1 + · rw [mem_singleton_iff.mp h3] + exact h.ends.2 + · exact h2 + · exact h1 + · intro hz + exact ⟨h.eq₁ ▸ Or.inr hz, h.eq₂ ▸ Or.inr hz⟩ + +/-- **Theta curve lemma.** `inner F` minus the cross-cut is the union of the two parts. -/ +theorem inner_sdiff (h : IsTheta F F₁ F₂ A₁ A₂ c p q) : inner F \ c = inner F₁ ∪ inner F₂ := by + ext z + constructor + · rintro ⟨hz, hzc⟩ + have hzF : z ∉ F := hz.1 + have hz1 : z ∉ F₁ := by + rw [h.eq₁] + rintro (h1 | h1) + · exact hzF (h.eq ▸ Or.inl h1) + · exact hzc h1 + have hz2 : z ∉ F₂ := by + rw [h.eq₂] + rintro (h1 | h1) + · exact hzF (h.eq ▸ Or.inr h1) + · exact hzc h1 + by_contra hcon + rw [mem_union, not_or] at hcon + have hzo1 : z ∈ outer F₁ := + (show z ∈ inner F₁ ∪ outer F₁ by rw [h.parts₁.union_eq]; exact hz1).resolve_left hcon.1 + have hzo2 : z ∈ outer F₂ := + (show z ∈ inner F₂ ∪ outer F₂ by rw [h.parts₂.union_eq]; exact hz2).resolve_left hcon.2 + obtain ⟨w, hw⟩ := h.parts.isConnected_outer.nonempty + have hw1 := h.outer_subset₁ hw + have hw2 := h.symm.outer_subset₁ hw + have hcomp : ∀ {G : Set ℂ}, IsJordanParts G → z ∈ outer G → w ∈ outer G → + w ∈ connectedComponentIn Gᶜ z := fun hG hz' hw' => + hG.isConnected_outer.isPreconnected.subset_connectedComponentIn hz' hG.outer_subset_compl hw' + have hK : IsPreconnected (F₁ ∩ F₂) := by rw [h.inter_eq]; exact h.conn + have hunion : F ⊆ F₁ ∪ F₂ := by + rw [h.eq, h.eq₁, h.eq₂] + exact union_subset_union subset_union_left subset_union_left + have hmain := janiszewski h.parts₁.isCompact h.parts₂.isCompact hK + (fun hh => hh.elim hz1 hz2) (fun hh => hh.elim hw1.1 hw2.1) + (hcomp h.parts₁ hzo1 hw1) (hcomp h.parts₂ hzo2 hw2) + have hC : IsPreconnected (connectedComponentIn (F₁ ∪ F₂)ᶜ z) := + isPreconnected_connectedComponentIn + have hdisj : Disjoint (connectedComponentIn (F₁ ∪ F₂)ᶜ z) F := + Set.disjoint_left.mpr fun y hy hyF => connectedComponentIn_subset _ _ hy (hunion hyF) + have hout := h.parts.subset_outer hC hdisj ⟨w, hmain, hw⟩ + exact Set.disjoint_left.mp h.parts.disjoint hz + (hout (mem_connectedComponentIn fun hh => hh.elim hz1 hz2)) + · rintro (hz | hz) + · exact ⟨h.inner_subset₁ hz, fun hc => hz.1 (h.eq₁ ▸ Or.inr hc)⟩ + · exact ⟨h.symm.inner_subset₁ hz, fun hc => hz.1 (h.eq₂ ▸ Or.inr hc)⟩ + +end IsTheta + +local notation "𝕀" => unitInterval + +/-- `e` is an injective path. -/ +def IsArcMap {X : Type*} [TopologicalSpace X] (e : 𝕀 → X) : Prop := + Continuous e ∧ Function.Injective e + +/-- The range of an injective path `a` and the range of an injective path `b` with the same ends, +meeting only in the ends, form an `O`-arc. The upper half of the circle goes to `a` and the lower +half to `b`, with the parameter read off the real part. -/ +theorem oArc_of_two_arcs {X : Type*} [TopologicalSpace X] [T2Space X] {a b : 𝕀 → X} + (ha : IsArcMap a) (hb : IsArcMap b) (h0 : a 0 = b 0) (h1 : a 1 = b 1) + (h01 : ∀ s t, a s = b t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) : + Nonempty (Circle ≃ₜ (range a ∪ range b : Set X)) := by + classical + have hbd : ∀ w : Circle, |(w : ℂ).re| ≤ 1 := fun w => by + have := Complex.abs_re_le_norm (w : ℂ) + rwa [Circle.norm_coe] at this + let τ : Circle → 𝕀 := fun w => ⟨(1 - (w : ℂ).re) / 2, by + have := abs_le.mp (hbd w) + constructor <;> linarith [this.1, this.2]⟩ + have hτ : Continuous τ := by + refine Continuous.subtype_mk ?_ _ + have : Continuous fun w : Circle => (w : ℂ) := continuous_subtype_val + exact ((continuous_const.sub (Complex.continuous_re.comp this)).div_const 2) + let g : Circle → X := fun w => if 0 ≤ (w : ℂ).im then a (τ w) else b (τ w) + have him : Continuous fun w : Circle => (w : ℂ).im := + Complex.continuous_im.comp continuous_subtype_val + have hsq : ∀ w : Circle, (w : ℂ).re * (w : ℂ).re + (w : ℂ).im * (w : ℂ).im = 1 := fun w => by + have h := Complex.sq_norm (w : ℂ) + rw [Circle.norm_coe, Complex.normSq_apply] at h + linarith + have hτ0 : ∀ w : Circle, (w : ℂ).im = 0 → τ w = 0 ∨ τ w = 1 := by + intro w hw + have h := hsq w + rw [hw] at h + have hfac : ((w : ℂ).re - 1) * ((w : ℂ).re + 1) = 0 := by linarith + rcases mul_eq_zero.mp hfac with h1 | h1 + · left + refine Subtype.ext ?_ + change (1 - (w : ℂ).re) / 2 = 0 + rw [sub_eq_zero.mp h1] + norm_num + · right + refine Subtype.ext ?_ + change (1 - (w : ℂ).re) / 2 = 1 + rw [eq_neg_of_add_eq_zero_left h1] + norm_num + have hg : Continuous g := by + refine Continuous.if_le (ha.1.comp hτ) (hb.1.comp hτ) continuous_const him ?_ + intro w hw + rcases hτ0 w hw.symm with h | h + · simp only [h, h0] + · simp only [h, h1] + have hre : ∀ {w w' : Circle}, τ w = τ w' → (w : ℂ).re = (w' : ℂ).re := fun {w w'} h => by + have : (1 - (w : ℂ).re) / 2 = (1 - (w' : ℂ).re) / 2 := congrArg Subtype.val h + linarith + have hsame : ∀ {w w' : Circle}, τ w = τ w' → 0 ≤ (w : ℂ).im → 0 ≤ (w' : ℂ).im → w = w' := by + intro w w' h h1 h2 + have h3 := hre h + have h4 := hsq w + have h5 := hsq w' + rw [h3] at h4 + have h6 : (w : ℂ).im = (w' : ℂ).im := by nlinarith [mul_self_nonneg ((w : ℂ).im - (w' : ℂ).im)] + exact Circle.ext (Complex.ext h3 h6) + have hsameneg : ∀ {w w' : Circle}, τ w = τ w' → (w : ℂ).im < 0 → (w' : ℂ).im < 0 → w = w' := by + intro w w' h h1 h2 + have h3 := hre h + have h4 := hsq w + have h5 := hsq w' + rw [h3] at h4 + have h6 : (w : ℂ).im = (w' : ℂ).im := by nlinarith [mul_self_nonneg ((w : ℂ).im - (w' : ℂ).im)] + exact Circle.ext (Complex.ext h3 h6) + -- The two points with parameter `0` and `1` lie on the real axis. + have him0 : ∀ {w : Circle}, τ w = 0 ∨ τ w = 1 → (w : ℂ).im = 0 := by + intro w h + have h4 := hsq w + have hre1 : (w : ℂ).re = 1 ∨ (w : ℂ).re = -1 := by + rcases h with h | h + · left + have : (1 - (w : ℂ).re) / 2 = 0 := congrArg Subtype.val h + linarith + · right + have : (1 - (w : ℂ).re) / 2 = 1 := congrArg Subtype.val h + linarith + rcases hre1 with h1 | h1 <;> rw [h1] at h4 <;> nlinarith [mul_self_nonneg (w : ℂ).im] + have hmixed : ∀ {w w' : Circle}, 0 ≤ (w : ℂ).im → (w' : ℂ).im < 0 → a (τ w) = b (τ w') → False + := by + intro w w' h1 h2 h + rcases h01 _ _ h with ⟨_, h3⟩ | ⟨_, h3⟩ + · exact absurd (him0 (Or.inl h3)) h2.ne + · exact absurd (him0 (Or.inr h3)) h2.ne + have hgi : Function.Injective g := by + intro w w' h + simp only [g] at h + by_cases h1 : 0 ≤ (w : ℂ).im <;> by_cases h2 : 0 ≤ (w' : ℂ).im + · simp only [h1, h2, ite_true] at h + exact hsame (ha.2 h) h1 h2 + · simp only [h1, h2, ite_true, ite_false] at h + exact (hmixed h1 (not_le.mp h2) h).elim + · simp only [h1, h2, ite_true, ite_false] at h + exact (hmixed h2 (not_le.mp h1) h.symm).elim + · simp only [h1, h2, ite_false] at h + exact hsameneg (hb.2 h) (not_le.mp h1) (not_le.mp h2) + have hrange : range g = range a ∪ range b := by + ext z + constructor + · rintro ⟨w, rfl⟩ + by_cases h1 : 0 ≤ (w : ℂ).im + · left + simp only [g, h1, ite_true] + exact ⟨_, rfl⟩ + · right + simp only [g, h1, ite_false] + exact ⟨_, rfl⟩ + · have hpt : ∀ t : 𝕀, ∃ w : Circle, τ w = t ∧ 0 ≤ (w : ℂ).im ∧ + ∃ w' : Circle, τ w' = t ∧ (w' : ℂ).im ≤ 0 := by + intro t + have ht0 := t.2.1 + have ht1 := t.2.2 + set x : ℝ := 1 - 2 * t with hx + have hx2 : 0 ≤ 1 - x * x := by rw [hx]; nlinarith + set y := Real.sqrt (1 - x * x) with hy + have hy2 : y * y = 1 - x * x := Real.mul_self_sqrt hx2 + have hnorm : ∀ s : ℝ, s * s = y * y → ‖(⟨x, s⟩ : ℂ)‖ = 1 := by + intro s hs + have h := Complex.sq_norm (⟨x, s⟩ : ℂ) + rw [Complex.normSq_mk, hs, hy2] at h + have h3 : ‖(⟨x, s⟩ : ℂ)‖ ^ 2 = 1 ^ 2 := by rw [h]; ring + exact (sq_eq_sq₀ (norm_nonneg _) zero_le_one).mp h3 + have hτt : ∀ (s : ℝ) (hs : ‖(⟨x, s⟩ : ℂ)‖ = 1), + τ ⟨⟨x, s⟩, mem_sphere_zero_iff_norm.mpr hs⟩ = t := by + intro s hs + refine Subtype.ext ?_ + change (1 - x) / 2 = t + rw [hx] + ring + refine ⟨⟨⟨x, y⟩, mem_sphere_zero_iff_norm.mpr (hnorm y rfl)⟩, hτt y (hnorm y rfl), + Real.sqrt_nonneg _, ⟨⟨x, -y⟩, mem_sphere_zero_iff_norm.mpr (hnorm (-y) (by ring))⟩, + hτt (-y) (hnorm (-y) (by ring)), ?_⟩ + change -y ≤ 0 + linarith [Real.sqrt_nonneg (1 - x * x)] + rintro (⟨t, rfl⟩ | ⟨t, rfl⟩) + · obtain ⟨w, hw, h1, -⟩ := hpt t + exact ⟨w, by simp only [g, h1, ite_true, hw]⟩ + · obtain ⟨-, -, -, w, hw, hle⟩ := hpt t + rcases eq_or_lt_of_le hle with h2 | h2 + · refine ⟨w, ?_⟩ + simp only [g, h2, le_refl, ite_true, hw] + rcases hτ0 w h2 with h3 | h3 + · rw [← hw, h3, h0] + · rw [← hw, h3, h1] + · exact ⟨w, by simp only [g, not_le.mpr h2, ite_false, hw]⟩ + have hemb := (hg.isClosedEmbedding hgi).isEmbedding + exact ⟨hemb.toHomeomorph.trans (Homeomorph.setCongr hrange)⟩ + +/-- Two different points of an `O`-arc cut it into two arcs that meet only in the ends. -/ +theorem exists_two_arcs {F : Set ℂ} (φ : Circle ≃ₜ F) {p q : ℂ} (hp : p ∈ F) (hq : q ∈ F) + (hpq : p ≠ q) : ∃ a b : 𝕀 → ℂ, IsArcMap a ∧ IsArcMap b ∧ a 0 = p ∧ a 1 = q ∧ b 0 = p ∧ b 1 = q ∧ + range a ∪ range b = F ∧ (∀ s t, a s = b t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) := by + have hpi := Real.pi_pos + let t : Circle := φ.symm ⟨p, hp⟩ + let P : ℝ → ℂ := fun r => arcPoint φ t r + have hPc : Continuous P := (continuous_arcPoint φ).comp (continuous_const.prodMk continuous_id) + have hP0 : P 0 = p := by simp [P, arcPoint, t] + have hP2 : P (2 * Real.pi) = p := by simp [P, arcPoint, t, Circle.exp_two_pi] + have hexp : ∀ z (hz : z ∈ F), ∃ r, 0 ≤ r ∧ r ≤ 2 * Real.pi ∧ P r = z := by + intro z hz + obtain ⟨r, h1, h2, h3⟩ := exists_angle_near t (φ.symm ⟨z, hz⟩) 0 le_rfl hpi.le + refine ⟨r, by simpa using h1, by simpa using h2, ?_⟩ + simp [P, arcPoint, ← h3] + have hPinj : ∀ r r', 0 ≤ r → r ≤ 2 * Real.pi → 0 ≤ r' → r' ≤ 2 * Real.pi → P r = P r' → + r = r' ∨ (r = 0 ∧ r' = 2 * Real.pi) ∨ (r = 2 * Real.pi ∧ r' = 0) := by + intro r r' h1 h2 h3 h4 h + have h5 : t * Circle.exp r = t * Circle.exp r' := φ.injective (Subtype.ext h) + have h6 := mul_left_cancel h5 + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h6 + have hle : (m : ℝ) * (2 * Real.pi) = r - r' := by linarith + have hm1 : (m : ℝ) ≤ 1 := by + by_contra hc + rw [not_le] at hc + nlinarith + have hm2 : (-1 : ℝ) ≤ m := by + by_contra hc + rw [not_le] at hc + nlinarith + have hm3 : m ≤ 1 := by exact_mod_cast hm1 + have hm4 : -1 ≤ m := by exact_mod_cast hm2 + have hcases : m = -1 ∨ m = 0 ∨ m = 1 := by omega + rcases hcases with rfl | rfl | rfl + · right; left + push_cast at hle + constructor <;> nlinarith + · left + push_cast at hle + linarith + · right; right + push_cast at hle + constructor <;> nlinarith + obtain ⟨θ, hθ0, hθ1, hθ⟩ := hexp q hq + have hθpos : 0 < θ := lt_of_le_of_ne hθ0 fun h => hpq (by rw [← hP0, h, hθ]) + have hθlt : θ < 2 * Real.pi := lt_of_le_of_ne hθ1 fun h => hpq (by rw [← hP2, ← h, hθ]) + have hgap : 0 < 2 * Real.pi - θ := by linarith + let a : 𝕀 → ℂ := fun s => P (θ * s) + let b : 𝕀 → ℂ := fun s => P (2 * Real.pi - (2 * Real.pi - θ) * s) + have hs0 : ∀ s : 𝕀, 0 ≤ (s : ℝ) ∧ (s : ℝ) ≤ 1 := fun s => ⟨s.2.1, s.2.2⟩ + have hab : ∀ s : 𝕀, 0 ≤ θ * s ∧ θ * s ≤ θ := fun s => + ⟨mul_nonneg hθ0 (hs0 s).1, by nlinarith [(hs0 s).2]⟩ + have hbb : ∀ s : 𝕀, θ ≤ 2 * Real.pi - (2 * Real.pi - θ) * s ∧ + 2 * Real.pi - (2 * Real.pi - θ) * s ≤ 2 * Real.pi := fun s => by + constructor <;> nlinarith [(hs0 s).1, (hs0 s).2] + have hac : IsArcMap a := by + refine ⟨hPc.comp (continuous_const.mul continuous_subtype_val), fun s s' h => ?_⟩ + rcases hPinj _ _ (hab s).1 (by linarith [(hab s).2]) (hab s').1 (by linarith [(hab s').2]) h + with + h1 | ⟨-, h1⟩ | ⟨h1, -⟩ + · exact Subtype.ext (mul_left_cancel₀ hθpos.ne' h1) + · linarith [(hab s').2] + · linarith [(hab s).2] + have hbc : IsArcMap b := by + refine ⟨hPc.comp (continuous_const.sub (continuous_const.mul continuous_subtype_val)), + fun s s' h => ?_⟩ + rcases hPinj _ _ (by linarith [(hbb s).1]) (hbb s).2 (by linarith [(hbb s').1]) + (hbb s').2 h with + h1 | ⟨h1, -⟩ | ⟨-, h1⟩ + · refine Subtype.ext (mul_left_cancel₀ hgap.ne' ?_) + linarith + · linarith [(hbb s).1] + · linarith [(hbb s').1] + refine ⟨a, b, hac, hbc, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · simp only [a, Icc.coe_zero, mul_zero, hP0] + · simp only [a, Icc.coe_one, mul_one, hθ] + · simp only [b, Icc.coe_zero, mul_zero, sub_zero, hP2] + · simp only [b, Icc.coe_one, mul_one, sub_sub_cancel, hθ] + · ext z + constructor + · rintro (⟨s, rfl⟩ | ⟨s, rfl⟩) <;> exact (φ _).2 + · intro hz + obtain ⟨r, h1, h2, rfl⟩ := hexp z hz + by_cases hr : r ≤ θ + · left + refine ⟨⟨r / θ, div_nonneg h1 hθ0, (div_le_one hθpos).mpr hr⟩, ?_⟩ + simp only [a] + rw [mul_div_cancel₀ _ hθpos.ne'] + · right + rw [not_le] at hr + refine ⟨⟨(2 * Real.pi - r) / (2 * Real.pi - θ), div_nonneg (by linarith) hgap.le, + (div_le_one hgap).mpr (by linarith)⟩, ?_⟩ + simp only [b] + rw [mul_div_cancel₀ _ hgap.ne'] + congr 1 + ring + · intro s s' h + rcases hPinj _ _ (hab s).1 (by linarith [(hab s).2]) (by linarith [(hbb s').1]) + (hbb s').2 h with + h1 | ⟨h1, h2⟩ | ⟨h1, -⟩ + · right + have h2 := (hab s).2 + have h3 := (hbb s').1 + have h4 : θ * s = θ := by linarith + have h5 : (2 * Real.pi - θ) * s' = 2 * Real.pi - θ := by linarith + refine ⟨Subtype.ext ?_, Subtype.ext ?_⟩ + · exact mul_left_cancel₀ hθpos.ne' (h4.trans (mul_one θ).symm) + · exact mul_left_cancel₀ hgap.ne' (h5.trans (mul_one _).symm) + · left + refine ⟨Subtype.ext ?_, Subtype.ext ?_⟩ + · exact mul_left_cancel₀ hθpos.ne' (h1.trans (mul_zero θ).symm) + · refine mul_left_cancel₀ hgap.ne' ?_ + change (2 * Real.pi - θ) * (s' : ℝ) = (2 * Real.pi - θ) * 0 + linarith + · linarith [(hab s).2] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Crossing.lean b/LeanPool/GraphMinor/Surface/Crossing.lean new file mode 100644 index 0000000000..9814ba8e74 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Crossing.lean @@ -0,0 +1,577 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.InvarianceOfDomain +import Mathlib.Analysis.Normed.Module.Connected +import Mathlib.Analysis.SpecialFunctions.Trigonometric.Basic + +/-! +# Janiszewski's theorem and crossing sets in a disc + +* `janiszewski`: if the compact sets `K₁, K₂` have a preconnected intersection and neither separates + `a` from `b`, then their union does not separate `a` from `b`. The two logarithms given by + Eilenberg's criterion differ by a constant on the intersection, so they paste. +* `IsClosedDisc.exists_chart`: coordinates on a closed disc, with values in the closed unit disc of + `ℂ`. +* `disc_crossing : DiscCrossingStatement`: compact connected sets in a closed disc whose ends cross + on the boundary meet. Rotate so that the two ends of `A` lie on a vertical line, with `b` to its + right and `d` to its left. Let `F` be the frontier of a large half disc to the right of the line, + so `F` is the chord together with an outer part `R`. Suppose `A` and `B` are disjoint. Then `B` + joins `b` to `d` off the compact set `A ∪ R`, so `(z - d) / (z - b)` has a logarithm there by + Eilenberg's criterion. On the closed unit disc minus `{b, d}` this function has an explicit + logarithm, as both factors lie in a half plane. The two logarithms differ by a constant on the + connected set `A`, so they paste along `a` and `c` to a logarithm on `F`. So `b` and `d` lie in + one component of the complement of `F`, which is false since `b` lies in the half disc and `d` + outside it. The connected set `A` replaces the chord, and no path in `A` is needed. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Complex + +universe u + +/-- Two logarithms on closed sets with a preconnected intersection differ by a constant there, so +they paste to a logarithm on the union. -/ +theorem HasLogOn.union_of_isPreconnected {T : Type u} [TopologicalSpace T] {A B : Set T} + (hA : IsClosed A) (hB : IsClosed B) (hAB : IsPreconnected (A ∩ B)) {f : T → ℂ} + (h₁ : HasLogOn A f) (h₂ : HasLogOn B f) : HasLogOn (A ∪ B) f := by + obtain ⟨gA, cA, eA⟩ := h₁ + obtain ⟨gB, cB, eB⟩ := h₂ + by_cases hne : (A ∩ B).Nonempty + · obtain ⟨x₀, hx₀⟩ := hne + let c := gA x₀ - gB x₀ + have hexp : ∀ x ∈ A ∩ B, exp (gA x - gB x) = 1 := fun x hx => by + rw [exp_sub, ← eA x hx.1, ← eB x hx.2] + have : exp (gB x) ≠ 0 := exp_ne_zero _ + rw [← eB x hx.2] at this + exact div_self this + have hc : exp c = 1 := hexp x₀ hx₀ + refine hasLogOn_union (gA := gA) (gB := fun x => gB x + c) hA hB cA + (cB.add continuousOn_const) eA (fun x hx => ?_) fun x hx => ?_ + · simp only [exp_add, hc, mul_one] + exact eB x hx + · have := eq_of_exp_eq_one (g := fun x => gA x - gB x) hAB + ((cA.mono inter_subset_left).sub (cB.mono inter_subset_right)) hexp hx hx₀ + simp only [c] + linear_combination this + · exact hasLogOn_union hA hB cA cB eA eB fun x hx => absurd ⟨x, hx⟩ hne + +/-- **Janiszewski's theorem.** If the compact sets `K₁, K₂` have a preconnected intersection and +neither of them separates `a` from `b`, then their union does not separate `a` from `b`. -/ +theorem janiszewski {K₁ K₂ : Set ℂ} (h₁ : IsCompact K₁) (h₂ : IsCompact K₂) + (hK : IsPreconnected (K₁ ∩ K₂)) {a b : ℂ} (ha : a ∉ K₁ ∪ K₂) (hb : b ∉ K₁ ∪ K₂) + (hab₁ : b ∈ connectedComponentIn K₁ᶜ a) (hab₂ : b ∈ connectedComponentIn K₂ᶜ a) : + b ∈ connectedComponentIn (K₁ ∪ K₂)ᶜ a := by + have l₁ := hasLogOn_div_of_same_component h₁.isClosed (fun h => ha (Or.inl h)) hab₁ + have l₂ := hasLogOn_div_of_same_component h₂.isClosed (fun h => ha (Or.inr h)) hab₂ + have l := (l₁.union_of_isPreconnected h₁.isClosed h₂.isClosed hK (h₂ := l₂)).inv + have heq := component_eq_of_hasLogOn (h₁.union h₂) ha hb (l.congr fun z _ => by rw [inv_div]) + rw [heq] + exact mem_connectedComponentIn hb + +/-- Coordinates on a closed disc. -/ +theorem IsClosedDisc.exists_chart {S : Type u} [TopologicalSpace S] {D : Set S} + (hD : IsClosedDisc D) : ∃ (h : S → ℂ) (g : ℂ → S), + ContinuousOn h D ∧ ContinuousOn g (closedBall 0 1) ∧ + MapsTo h D (closedBall 0 1) ∧ MapsTo g (closedBall 0 1) D ∧ + LeftInvOn g h D ∧ RightInvOn g h (closedBall 0 1) ∧ h '' discBd D = sphere 0 1 := by + classical + obtain ⟨φ⟩ := id hD + have hin₀ : complexPlane 0 ∈ ClosedUnitDisc := by + refine mem_closedBall_zero_iff.mpr ?_ + simp + have hz₀ : complexPlane 0 ∈ ClosedUnitDisc := hin₀ + have hin : ∀ z : ℂ, z ∈ closedBall (0 : ℂ) 1 → complexPlane z ∈ ClosedUnitDisc := fun z hz => by + refine mem_closedBall_zero_iff.mpr ?_ + rw [LinearIsometryEquiv.norm_map] + exact mem_closedBall_zero_iff.mp hz + have hout : ∀ x : ClosedUnitDisc, complexPlane.symm x.1 ∈ closedBall (0 : ℂ) 1 := fun x => by + refine mem_closedBall_zero_iff.mpr ?_ + rw [LinearIsometryEquiv.norm_map] + exact mem_closedBall_zero_iff.mp x.2 + let h : S → ℂ := fun x => if hx : x ∈ D then complexPlane.symm (φ.symm ⟨x, hx⟩).1 else 0 + let g : ℂ → S := fun z => if hz : z ∈ closedBall (0 : ℂ) 1 then (φ ⟨complexPlane z, hin z hz⟩).1 + else (φ ⟨complexPlane 0, hz₀⟩).1 + have hh : ∀ x (hx : x ∈ D), h x = complexPlane.symm (φ.symm ⟨x, hx⟩).1 := fun x hx => by + simp only [h, hx, dite_true] + have hgz : ∀ z (hz : z ∈ closedBall (0 : ℂ) 1), g z = (φ ⟨complexPlane z, hin z hz⟩).1 := + fun z hz => by simp only [g, hz, dite_true] + refine ⟨h, g, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [continuousOn_iff_continuous_domRestrict] + have : D.domRestrict h = fun x : D => complexPlane.symm (φ.symm x).1 := by + ext x + exact hh x.1 x.2 + rw [this] + exact complexPlane.symm.continuous.comp (continuous_subtype_val.comp φ.symm.continuous) + · rw [continuousOn_iff_continuous_domRestrict] + have : (closedBall (0 : ℂ) 1).domRestrict g = + fun z : closedBall (0 : ℂ) 1 => (φ ⟨complexPlane z.1, hin z.1 z.2⟩).1 := by + ext z + exact hgz z.1 z.2 + rw [this] + refine continuous_subtype_val.comp (φ.continuous.comp ?_) + exact Continuous.subtype_mk (complexPlane.continuous.comp continuous_subtype_val) _ + · intro x hx + rw [hh x hx] + exact hout _ + · intro z hz + rw [hgz z hz] + exact (φ _).2 + · intro x hx + show g (h x) = x + rw [hgz _ (by rw [hh x hx]; exact hout _)] + simp [hh x hx] + · intro z hz + show h (g z) = z + rw [hgz z hz, hh _ (φ _).2] + simp + · rw [disc_boundary D φ] + ext w + constructor + · rintro ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + rw [hh _ (φ x).2] + simp only [Subtype.coe_eta, Homeomorph.symm_apply_apply] + rw [mem_sphere_zero_iff_norm, LinearIsometryEquiv.norm_map] + exact mem_sphere_zero_iff_norm.mp hx + · intro hw + have hwn : ‖w‖ = 1 := mem_sphere_zero_iff_norm.mp hw + have hwb : w ∈ closedBall (0 : ℂ) 1 := sphere_subset_closedBall hw + refine ⟨_, ⟨⟨complexPlane w, hin w hwb⟩, ?_, rfl⟩, ?_⟩ + · change complexPlane w ∈ UnitCircle + rw [UnitCircle, mem_sphere_zero_iff_norm, LinearIsometryEquiv.norm_map, hwn] + · rw [hh _ (φ _).2] + simp + +private theorem one_sub_div_mem_slitPlane {z w : ℂ} (hw : ‖w‖ = 1) (hz : ‖z‖ ≤ 1) (hne : z ≠ w) : + 1 - z / w ∈ slitPlane := by + have hw0 : w ≠ 0 := by + rintro rfl + simp at hw + set q := z / w with hq + have hqn : ‖q‖ ≤ 1 := by rw [hq, norm_div, hw, div_one]; exact hz + have hq1 : q ≠ 1 := fun h => hne (by rw [hq, div_eq_one_iff_eq hw0] at h; exact h) + left + rw [sub_re, one_re, sub_pos] + by_contra hge + rw [not_lt] at hge + have hsq : q.re * q.re + q.im * q.im ≤ 1 := by + have h := Complex.sq_norm q + rw [normSq_apply] at h + have h2 : ‖q‖ ^ 2 ≤ 1 := pow_le_one₀ (norm_nonneg q) hqn + linarith + have hre : q.re = 1 := by nlinarith [mul_self_nonneg q.im] + have him : q.im = 0 := by + rw [hre] at hsq + nlinarith [mul_self_nonneg q.im] + exact hq1 (Complex.ext hre him) + +/-- The crossing lemma for a vertical line: compact connected sets in the closed unit disc meet if +the line through the ends of `A` meets the circle only in those ends, and has one end of `B` on +each side. -/ +theorem crossing_of_vertical_line {A B : Set ℂ} {a c b d : ℂ} {r : ℝ} (hA : IsCompact A) + (hAc : IsPreconnected A) (hBc : IsPreconnected B) (hAD : A ⊆ closedBall 0 1) + (hBD : B ⊆ closedBall 0 1) (ha : a ∈ A) (hc : c ∈ A) (hb : b ∈ B) (hd : d ∈ B) + (hbn : ‖b‖ = 1) (hdn : ‖d‖ = 1) (hline : ∀ z : ℂ, ‖z‖ = 1 → z.re = r → z = a ∨ z = c) + (hbr : r < b.re) (hdr : d.re < r) : (A ∩ B).Nonempty := by + by_contra hcon + have hdisj : ∀ x ∈ A, x ∉ B := fun x hxA hxB => hcon ⟨x, hxA, hxB⟩ + -- The half disc and its frontier. + set H : Set ℂ := closedBall 0 2 ∩ {z | r ≤ z.re} with hH + set F := frontier H with hF + have hHc : IsClosed H := isClosed_closedBall.inter (isClosed_le continuous_const continuous_re) + have hHcomp : IsCompact H := (isCompact_closedBall 0 2).inter_right + (isClosed_le continuous_const continuous_re) + have hFc : IsCompact F := hHcomp.of_isClosed_subset isClosed_frontier hHc.frontier_subset + have hFH : F ⊆ H := hHc.frontier_subset + have hFcase : ∀ z ∈ F, ‖z‖ = 2 ∨ z.re = r := by + intro z hz + rcases frontier_inter_subset _ _ hz with h | h + · left + have := h.1 + rw [frontier_closedBall (0 : ℂ) (two_ne_zero)] at this + exact mem_sphere_zero_iff_norm.mp this + · right + exact (frontier_le_subset_eq continuous_const continuous_re h.2).symm + set P := F ∩ closedBall 0 1 with hP + set R := F ∩ (ball 0 1)ᶜ with hR + have hPc : IsClosed P := hFc.isClosed.inter isClosed_closedBall + have hRc : IsCompact R := hFc.inter_right isOpen_ball.isClosed_compl + have hPR : P ∪ R = F := by + ext z + constructor + · rintro (h | h) <;> exact h.1 + · intro h + by_cases hz : ‖z‖ ≤ 1 + · exact Or.inl ⟨h, mem_closedBall_zero_iff.mpr hz⟩ + · exact Or.inr ⟨h, fun hb => hz (mem_ball_zero_iff.mp hb).le⟩ + have hunit : ∀ z ∈ F, ‖z‖ = 1 → z = a ∨ z = c := by + intro z hz hn + rcases hFcase z hz with h | h + · rw [hn] at h + norm_num at h + · exact hline z hn h + have hPRmeet : ∀ z ∈ P ∩ R, z = a ∨ z = c := by + rintro z ⟨⟨hzF, hz1⟩, -, hz2⟩ + refine hunit z hzF (le_antisymm (mem_closedBall_zero_iff.mp hz1) ?_) + exact not_lt.mp fun h => hz2 (mem_ball_zero_iff.mpr h) + have hRB : ∀ z ∈ R, z ∉ B := by + rintro z ⟨hzF, hz2⟩ hzB + have hn : ‖z‖ = 1 := le_antisymm (mem_closedBall_zero_iff.mp (hBD hzB)) + (not_lt.mp fun h => hz2 (mem_ball_zero_iff.mpr h)) + rcases hunit z hzF hn with rfl | rfl + · exact hdisj _ ha hzB + · exact hdisj _ hc hzB + -- `B` joins `b` to `d` off `A ∪ R`. + have hTc : IsCompact (A ∪ R) := hA.union hRc + have hBT : B ⊆ (A ∪ R)ᶜ := by + rintro z hz (h | h) + · exact hdisj z h hz + · exact hRB z h hz + have hdcomp : d ∈ connectedComponentIn (A ∪ R)ᶜ b := + hBc.subset_connectedComponentIn hb hBT hd + obtain ⟨g₁, hg₁c, hg₁⟩ := hasLogOn_div_of_same_component hTc.isClosed (hBT hb) hdcomp + -- The explicit logarithm on the closed disc minus `{b, d}`. + have hb0 : b ≠ 0 := by + rintro rfl + simp at hbn + have hd0 : d ≠ 0 := by + rintro rfl + simp at hdn + set D' := closedBall (0 : ℂ) 1 \ {b, d} with hD' + have hu : HasLogOn D' fun z => 1 - z / d := by + refine hasLogOn_of_slitPlane (by fun_prop) fun z hz => ?_ + exact one_sub_div_mem_slitPlane hdn (mem_closedBall_zero_iff.mp hz.1) + fun h => hz.2 (Or.inr h) + have hv : HasLogOn D' fun z => 1 - z / b := by + refine hasLogOn_of_slitPlane (by fun_prop) fun z hz => ?_ + exact one_sub_div_mem_slitPlane hbn (mem_closedBall_zero_iff.mp hz.1) + fun h => hz.2 (Or.inl h) + have hconst : HasLogOn D' fun _ => b / d := hasLogOn_const (div_ne_zero hb0 hd0) + have hL : HasLogOn D' fun z => (z - d) / (z - b) := by + refine ((hu.div hv).mul ((hconst.inv))).congr fun z hz => ?_ + have h1 : z - b ≠ 0 := fun h => hz.2 (Or.inl (sub_eq_zero.mp h)) + have e1 : 1 - z / d = -(z - d) / d := by field_simp; ring + have e2 : 1 - z / b = -(z - b) / b := by field_simp; ring + simp only [e1, e2] + field_simp + obtain ⟨g₂, hg₂c, hg₂⟩ := hL + have hAD' : A ⊆ D' := fun x hx => ⟨hAD hx, by + rintro (h | h) + · exact hdisj x hx (h ▸ hb) + · exact hdisj x hx (h ▸ hd)⟩ + have hPD' : P ⊆ D' := by + refine fun z hz => ⟨hz.2, ?_⟩ + rintro (h | h) + · rcases hFcase z hz.1 with h' | h' + · rw [h, hbn] at h' + norm_num at h' + · rw [h] at h' + linarith + · have := (hFH hz.1).2 + rw [h] at this + exact absurd this (not_le.mpr hdr) + -- The two logarithms differ by a constant on `A`. + have hnz : ∀ x ∈ A, (x - d) / (x - b) ≠ 0 := by + intro x hx + have := hg₂ x (hAD' hx) + simp only at this + rw [this] + exact exp_ne_zero _ + have hexp : ∀ x ∈ A, exp (g₁ x - g₂ x) = 1 := by + intro x hx + rw [exp_sub, ← hg₁ x (Or.inl hx), ← hg₂ x (hAD' hx)] + exact div_self (hnz x hx) + have hdiffc : ContinuousOn (fun x => g₁ x - g₂ x) A := + (hg₁c.mono subset_union_left).sub (hg₂c.mono hAD') + have hconstant : ∀ x ∈ A, g₁ x - g₂ x = g₁ a - g₂ a := fun x hx => + eq_of_exp_eq_one hAc hdiffc hexp hx ha + set k := g₁ a - g₂ a with hk + have hkexp : exp k = 1 := hexp a ha + have hlogF : HasLogOn F fun z => (z - d) / (z - b) := by + rw [← hPR] + refine hasLogOn_union (gA := fun z => g₂ z + k) (gB := g₁) hPc hRc.isClosed + ((hg₂c.mono hPD').add continuousOn_const) (hg₁c.mono subset_union_right) (fun z hz => ?_) + (fun z hz => hg₁ z (Or.inr hz)) fun z hz => ?_ + · rw [exp_add, hkexp, mul_one] + exact hg₂ z (hPD' hz) + · have hzA : z ∈ A := by + rcases hPRmeet z hz with rfl | rfl + · exact ha + · exact hc + have := hconstant z hzA + linear_combination -this + have hbH : b ∈ H := ⟨mem_closedBall_zero_iff.mpr (by rw [hbn]; norm_num), hbr.le⟩ + have hdH : d ∉ H := fun h => absurd h.2 (not_le.mpr hdr) + have hbF : b ∉ F := by + intro h + rcases hFcase b h with h' | h' + · rw [hbn] at h' + norm_num at h' + · linarith + have hdF : d ∉ F := fun h => hdH (hFH h) + have heq := component_eq_of_hasLogOn hFc hdF hbF hlogF + have hbin : b ∈ connectedComponentIn Fᶜ d := heq ▸ mem_connectedComponentIn hbF + have hmeet := inter_frontier_nonempty_of_isPreconnected (U := H) + (isPreconnected_connectedComponentIn (F := Fᶜ) (x := d)) ⟨b, hbin, hbH⟩ + ⟨d, mem_connectedComponentIn hdF, hdH⟩ + obtain ⟨z, hz1, hz2⟩ := hmeet + exact connectedComponentIn_subset _ _ hz1 hz2 + +/-- Every unit complex number is `exp (θ i)` for some `θ` in `[0, 2π)`. -/ +private theorem exists_angle {w : ℂ} (hw : ‖w‖ = 1) : + ∃ θ : ℝ, 0 ≤ θ ∧ θ < 2 * Real.pi ∧ w = exp (θ * I) := by + have hrep : w = exp (w.arg * I) := by + have := Complex.norm_mul_exp_arg_mul_I w + rw [hw] at this + simpa using this.symm + by_cases h : 0 ≤ w.arg + · exact ⟨w.arg, h, by linarith [arg_le_pi w, Real.pi_pos], hrep⟩ + · rw [not_le] at h + refine ⟨w.arg + 2 * Real.pi, by linarith [neg_pi_lt_arg w], by linarith, ?_⟩ + push_cast + rw [add_mul, exp_add, exp_two_pi_mul_I, mul_one] + exact hrep + +private theorem cos_lt_of_inside {θ δ : ℝ} (h0 : 0 < θ) (h1 : θ < 2 * δ) (hδ : δ < Real.pi) : + Real.cos δ < Real.cos (θ - δ) := by + rw [← Real.cos_abs (θ - δ)] + refine Real.cos_lt_cos_of_nonneg_of_le_pi (abs_nonneg _) hδ.le ?_ + rw [abs_lt] + constructor <;> linarith + +private theorem cos_lt_of_outside {θ δ : ℝ} (hδ0 : 0 < δ) (_hδ : δ < Real.pi) (h1 : 2 * δ < θ) + (h2 : θ < 2 * Real.pi) : Real.cos (θ - δ) < Real.cos δ := by + by_cases hx : θ - δ ≤ Real.pi + · exact Real.cos_lt_cos_of_nonneg_of_le_pi hδ0.le hx (by linarith) + · have : Real.cos (θ - δ) = Real.cos (2 * Real.pi - (θ - δ)) := by + rw [Real.cos_two_pi_sub] + rw [this] + exact Real.cos_lt_cos_of_nonneg_of_le_pi hδ0.le (by linarith) (by linarith) + +/-- The crossing lemma on the unit circle of `ℂ`. -/ +theorem crossing_unit {A B : Set ℂ} {a c b d : ℂ} (hA : IsCompact A) + (hAc : IsPreconnected A) (hBc : IsPreconnected B) (hAD : A ⊆ closedBall 0 1) + (hBD : B ⊆ closedBall 0 1) (ha : a ∈ A) (hc : c ∈ A) (hb : b ∈ B) (hd : d ∈ B) + (han : ‖a‖ = 1) (hcn : ‖c‖ = 1) (hbn : ‖b‖ = 1) (hdn : ‖d‖ = 1) (hac : a ≠ c) + (hba : b ≠ a) (hbc : b ≠ c) (hda : d ≠ a) (hdc : d ≠ c) + (hcomp : connectedComponentIn (sphere 0 1 \ {a, c}) b ≠ + connectedComponentIn (sphere 0 1 \ {a, c}) d) : (A ∩ B).Nonempty := by + have ha0 : a ≠ 0 := by + rintro rfl + simp at han + have hdiv : ∀ {w : ℂ}, ‖w‖ = 1 → ‖w / a‖ = 1 := fun hw => by rw [norm_div, hw, han, div_one] + -- The angle `2 δ` from `a` to `c`. + obtain ⟨θc, hθ0, hθ1, hθc⟩ := exists_angle (hdiv hcn) + let e : ℝ → ℂ := fun θ => a * exp (θ * I) + have hee : ∀ {w : ℂ}, w / a = exp (0 : ℂ) → w = a := fun {w} h => by + rw [exp_zero, div_eq_one_iff_eq ha0] at h + exact h + have hθpos : 0 < θc := by + refine lt_of_le_of_ne hθ0 fun h => hac ?_ + rw [← h] at hθc + exact (hee (by simpa using hθc)).symm + set δ := θc / 2 with hδ + have hδ0 : 0 < δ := by positivity + have hδπ : δ < Real.pi := by rw [hδ]; linarith + have hce : c = e (2 * δ) := by + have : (2 * δ : ℝ) = θc := by rw [hδ]; ring + simp only [e, this, ← hθc] + field_simp + have hae : a = e 0 := by simp [e] + let u : ℂ := a⁻¹ * exp (((-δ : ℝ) : ℂ) * I) + have hun : ‖u‖ = 1 := by + rw [norm_mul, norm_inv, han, Complex.norm_exp_ofReal_mul_I] + simp + let ρ : ℂ → ℂ := fun z => z * u + have hρc : Continuous ρ := by fun_prop + have hρn : ∀ z, ‖ρ z‖ = ‖z‖ := fun z => by simp only [ρ, norm_mul, hun, mul_one] + have hρe : ∀ θ : ℝ, ρ (e θ) = exp (((θ - δ : ℝ) : ℂ) * I) := by + intro θ + simp only [ρ, e, u] + push_cast + rw [show ((θ : ℂ) - δ) * I = (θ : ℂ) * I + (-δ : ℂ) * I by ring, exp_add] + field_simp + have hρre : ∀ θ : ℝ, (ρ (e θ)).re = Real.cos (θ - δ) := fun θ => by + rw [hρe, exp_ofReal_mul_I_re] + have hρa : (ρ a).re = Real.cos δ := by + rw [hae, hρre, zero_sub, Real.cos_neg] + have hρc' : (ρ c).re = Real.cos δ := by + rw [hce, hρre] + congr 1 + ring + have hρimage : ∀ {K : Set ℂ}, K ⊆ closedBall 0 1 → ρ '' K ⊆ closedBall 0 1 := by + rintro K hK _ ⟨z, hz, rfl⟩ + rw [mem_closedBall_zero_iff, hρn] + exact mem_closedBall_zero_iff.mp (hK hz) + have hρinj : Function.Injective ρ := by + intro x y hxy + have hu0 : u ≠ 0 := by + intro h + simp [h] at hun + exact mul_right_cancel₀ hu0 hxy + -- Points of the two open arcs. + have hcase : ∀ {z : ℂ}, ‖z‖ = 1 → z ≠ a → z ≠ c → + ∃ θ : ℝ, z = e θ ∧ ((0 < θ ∧ θ < 2 * δ) ∨ (2 * δ < θ ∧ θ < 2 * Real.pi)) := by + intro z hz hza hzc + obtain ⟨θ, h0, h1, hθ⟩ := exists_angle (hdiv hz) + have hze : z = e θ := by + simp only [e, ← hθ] + field_simp + refine ⟨θ, hze, ?_⟩ + have hne0 : θ ≠ 0 := fun h => hza (by rw [hze, h, ← hae]) + have hne1 : θ ≠ 2 * δ := fun h => hzc (by rw [hze, h, ← hce]) + rcases lt_or_gt_of_ne hne1 with h | h + · exact Or.inl ⟨lt_of_le_of_ne h0 hne0.symm, h⟩ + · exact Or.inr ⟨h, h1⟩ + have hen : ∀ θ : ℝ, ‖e θ‖ = 1 := fun θ => by + simp only [e, norm_mul, han, Complex.norm_exp_ofReal_mul_I, mul_one] + have hmem : ∀ θ : ℝ, Real.cos (θ - δ) ≠ Real.cos δ → e θ ∈ sphere (0 : ℂ) 1 \ {a, c} := by + intro θ hθ + refine ⟨mem_sphere_zero_iff_norm.mpr (hen θ), ?_⟩ + rintro (h | h) + · exact hθ (by rw [← hρre, h, hρa]) + · exact hθ (by rw [← hρre, h, hρc']) + have heq_of_mem : ∀ {C : Set ℂ}, IsPreconnected C → C ⊆ sphere (0 : ℂ) 1 \ {a, c} → b ∈ C → + d ∈ C → False := by + intro C hC hsub hbC hdC + apply hcomp + have h1 := hC.subset_connectedComponentIn hbC hsub hdC + exact (connectedComponentIn_eq h1) + have heC : Continuous e := by fun_prop + have hcpre : ∀ x y : ℝ, IsPreconnected (e '' Ioo x y) := fun x y => + isPreconnected_Ioo.image _ heC.continuousOn + -- The line through the images of the ends of `A`. + have hline : ∀ z : ℂ, ‖z‖ = 1 → z.re = Real.cos δ → z = ρ a ∨ z = ρ c := by + intro z hz hre + have hρa' : ρ a = exp (((-δ : ℝ) : ℂ) * I) := by + rw [hae, hρe] + congr 3 + ring + have hρc'' : ρ c = exp ((δ : ℂ) * I) := by + rw [hce, hρe] + congr 3 + ring_nf + have hsq : z.im * z.im = Real.sin δ * Real.sin δ := by + have h1 := Complex.sq_norm z + rw [normSq_apply, hz, hre] at h1 + have h2 := Real.sin_sq_add_cos_sq δ + nlinarith + have hfac : (z.im - Real.sin δ) * (z.im + Real.sin δ) = 0 := by linear_combination hsq + rcases mul_eq_zero.mp hfac with h | h + · right + rw [hρc''] + refine Complex.ext ?_ ?_ + · rw [hre, exp_ofReal_mul_I_re] + · rw [exp_ofReal_mul_I_im] + linarith + · left + rw [hρa'] + refine Complex.ext ?_ ?_ + · rw [hre, exp_ofReal_mul_I_re, Real.cos_neg] + · rw [exp_ofReal_mul_I_im, Real.sin_neg] + linarith + have hfinal : ∀ {b' d' : ℂ}, b' ∈ B → d' ∈ B → ‖b'‖ = 1 → ‖d'‖ = 1 → + Real.cos δ < (ρ b').re → (ρ d').re < Real.cos δ → (A ∩ B).Nonempty := by + intro b' d' hb' hd' hb'n hd'n h1 h2 + have := crossing_of_vertical_line (hA.image hρc) (hAc.image _ hρc.continuousOn) + (hBc.image _ hρc.continuousOn) (hρimage hAD) (hρimage hBD) + (mem_image_of_mem ρ ha) (mem_image_of_mem ρ hc) (mem_image_of_mem ρ hb') + (mem_image_of_mem ρ hd') (by rw [hρn, hb'n]) (by rw [hρn, hd'n]) hline h1 h2 + obtain ⟨_, ⟨x, hx, rfl⟩, ⟨y, hy, hxy⟩⟩ := this + exact ⟨x, hx, hρinj hxy ▸ hy⟩ + obtain ⟨θb, hbe, hθb⟩ := hcase hbn hba hbc + obtain ⟨θd, hde, hθd⟩ := hcase hdn hda hdc + rcases hθb with ⟨hb1, hb2⟩ | ⟨hb1, hb2⟩ <;> rcases hθd with ⟨hd1, hd2⟩ | ⟨hd1, hd2⟩ + · exfalso + refine heq_of_mem (hcpre 0 (2 * δ)) ?_ ⟨θb, ⟨hb1, hb2⟩, hbe.symm⟩ ⟨θd, ⟨hd1, hd2⟩, hde.symm⟩ + rintro _ ⟨θ, hθ, rfl⟩ + exact hmem θ (cos_lt_of_inside hθ.1 hθ.2 hδπ).ne' + · refine hfinal hb hd hbn hdn ?_ ?_ + · rw [hbe, hρre] + exact cos_lt_of_inside hb1 hb2 hδπ + · rw [hde, hρre] + exact cos_lt_of_outside hδ0 hδπ hd1 hd2 + · refine hfinal hd hb hdn hbn ?_ ?_ + · rw [hde, hρre] + exact cos_lt_of_inside hd1 hd2 hδπ + · rw [hbe, hρre] + exact cos_lt_of_outside hδ0 hδπ hb1 hb2 + · exfalso + refine heq_of_mem (hcpre (2 * δ) (2 * Real.pi)) ?_ ⟨θb, ⟨hb1, hb2⟩, hbe.symm⟩ + ⟨θd, ⟨hd1, hd2⟩, hde.symm⟩ + rintro _ ⟨θ, hθ, rfl⟩ + exact hmem θ (cos_lt_of_outside hδ0 hδπ hθ.1 hθ.2).ne + +/-- **Crossing sets in a disc.** Two compact connected sets in a closed disc meet if their ends +cross on the boundary. Graph Minors VI, Sections 2 and 3; Graph Minors IX, Section 1. The route is +Eilenberg's criterion, as described in the module docstring. -/ +theorem disc_crossing : DiscCrossingStatement.{u} := by + intro S _ D A B a c b d hD hAD hBD hA _ hAc hBc ha hc hb hd hcross + obtain ⟨ha', hb', hc', hd', hac, hbd, hab, had, hcb, hcd, hcomp⟩ := hcross + obtain ⟨h, g, hh, hg, hhm, hgm, hgh, hhg, hbdh⟩ := hD.exists_chart + have hsub : discBd D ⊆ D := by + rintro _ ⟨x, -, rfl⟩ + exact x.2 + have hcirc : ∀ {x}, x ∈ discBd D → ‖h x‖ = 1 := fun hx => + mem_sphere_zero_iff_norm.mp (hbdh ▸ mem_image_of_mem h hx) + have hhinj : InjOn h D := fun x hx y hy hxy => by + rw [← hgh hx, ← hgh hy] + show g (h x) = g (h y) + rw [hxy] + have hne : ∀ {x y}, x ∈ discBd D → y ∈ discBd D → x ≠ y → h x ≠ h y := fun hx hy hxy e => + hxy (hhinj (hsub hx) (hsub hy) e) + have himage : ∀ {K : Set S}, K ⊆ D → h '' K ⊆ closedBall 0 1 := by + rintro K hK _ ⟨x, hx, rfl⟩ + exact hhm (hK hx) + have hmain := crossing_unit (hA.image_of_continuousOn (hh.mono hAD)) + (hAc.isPreconnected.image _ (hh.mono hAD)) + (hBc.isPreconnected.image _ (hh.mono hBD)) (himage hAD) (himage hBD) + (mem_image_of_mem h ha) (mem_image_of_mem h hc) (mem_image_of_mem h hb) + (mem_image_of_mem h hd) (hcirc ha') (hcirc hc') (hcirc hb') (hcirc hd') (hne ha' hc' hac) + (hne hb' ha' hab.symm) (hne hb' hc' hcb.symm) (hne hd' ha' had.symm) (hne hd' hc' hcd.symm) + ?_ + · obtain ⟨_, ⟨x, hx, rfl⟩, ⟨y, hy, hxy⟩⟩ := hmain + exact ⟨x, hx, hhinj (hBD hy) (hAD hx) hxy ▸ hy⟩ + · intro heq + apply hcomp + set C := sphere (0 : ℂ) 1 \ {h a, h c} with hC + have hhbC : h b ∈ C := ⟨mem_sphere_zero_iff_norm.mpr (hcirc hb'), by + rintro (e | e) + · exact hne hb' ha' hab.symm e + · exact hne hb' hc' hcb.symm e⟩ + have hhdC : h d ∈ C := ⟨mem_sphere_zero_iff_norm.mpr (hcirc hd'), by + rintro (e | e) + · exact hne hd' ha' had.symm e + · exact hne hd' hc' hcd.symm e⟩ + have hdin : h d ∈ connectedComponentIn C (h b) := heq ▸ mem_connectedComponentIn hhdC + have hgC : ∀ z ∈ C, g z ∈ discBd D \ {a, c} := by + rintro z ⟨hz, hzne⟩ + obtain ⟨y, hy, rfl⟩ : z ∈ h '' discBd D := hbdh ▸ hz + rw [hgh (hsub hy)] + refine ⟨hy, ?_⟩ + rintro (e | e) + · exact hzne (Or.inl (by rw [e])) + · exact hzne (Or.inr (by rw [e]; exact mem_singleton _)) + have hgcont : ContinuousOn g C := + hg.mono (sdiff_subset.trans sphere_subset_closedBall) + have hpre : IsPreconnected (g '' connectedComponentIn C (h b)) := + isPreconnected_connectedComponentIn.image _ (hgcont.mono (connectedComponentIn_subset _ _)) + have hsubC : g '' connectedComponentIn C (h b) ⊆ discBd D \ {a, c} := by + rintro _ ⟨z, hz, rfl⟩ + exact hgC z (connectedComponentIn_subset _ _ hz) + have hbin : b ∈ g '' connectedComponentIn C (h b) := + ⟨h b, mem_connectedComponentIn hhbC, hgh (hsub hb')⟩ + have hdin' : d ∈ g '' connectedComponentIn C (h b) := ⟨h d, hdin, hgh (hsub hd')⟩ + exact connectedComponentIn_eq (hpre.subset_connectedComponentIn hbin hsubC hdin') + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Cuffs.lean b/LeanPool/GraphMinor/Surface/Cuffs.lean new file mode 100644 index 0000000000..141e0828d6 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Cuffs.lean @@ -0,0 +1,383 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.OneManifold +public import LeanPool.GraphMinor.Surface.SphereDisc + +/-! +# The boundary of a surface + +`cuff_statement : CuffStatement`: the boundary of a surface is closed, and it has finitely many +components, each of them an `O`-arc. + +By invariance of domain, the points of a half plane chart that lie on the boundary line are exactly +the points of the chart in `bd S` (`mem_bd_iff_of_chart`). So `bd S` is locally an interval. Each +component is then a compact connected curve, which is a circle by `exists_homeomorph_circle`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u v + +variable {S : Type u} [TopologicalSpace S] + +/-- A homeomorphism of subsets is given by a pair of functions. -/ +theorem exists_functions_of_homeomorph {T : Type v} [TopologicalSpace T] [Nonempty S] [Nonempty T] + {A : Set S} {B : Set T} (e : A ≃ₜ B) : + ∃ (h : S → T) (k : T → S), ContinuousOn h A ∧ ContinuousOn k B ∧ MapsTo h A B ∧ MapsTo k B A ∧ + LeftInvOn k h A ∧ LeftInvOn h k B := by + classical + obtain ⟨s₀⟩ := ‹Nonempty S› + obtain ⟨t₀⟩ := ‹Nonempty T› + let h : S → T := fun z => if hz : z ∈ A then (e ⟨z, hz⟩).1 else t₀ + let k : T → S := fun z => if hz : z ∈ B then (e.symm ⟨z, hz⟩).1 else s₀ + have hv : ∀ x : A, h x.1 = (e x).1 := fun x => by simp [h] + have kv : ∀ x : B, k x.1 = (e.symm x).1 := fun x => by simp [k] + refine ⟨h, k, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rw [continuousOn_iff_continuous_domRestrict] + have : A.domRestrict h = fun x => (e x).1 := funext hv + rw [this] + exact continuous_subtype_val.comp e.continuous + · rw [continuousOn_iff_continuous_domRestrict] + have : B.domRestrict k = fun x => (e.symm x).1 := funext kv + rw [this] + exact continuous_subtype_val.comp e.symm.continuous + · intro z hz + rw [hv ⟨z, hz⟩] + exact (e _).2 + · intro z hz + rw [kv ⟨z, hz⟩] + exact (e.symm _).2 + · intro z hz + show k (h z) = z + rw [hv ⟨z, hz⟩, kv] + simp + · intro z hz + show h (k z) = z + rw [kv ⟨z, hz⟩, hv] + simp + +/-- The right half plane of `ℂ`. -/ +def halfPlane : Set ℂ := {z | 0 ≤ z.re} + +theorem complexPlane_zero (z : ℂ) : (complexPlane z) 0 = z.re := by + simp [complexPlane] + +/-- Half plane charts, in terms of functions to `ℂ`. -/ +theorem IsManifoldPoint.exists_chart {x : S} (hx : IsManifoldPoint x) : + ∃ (U : Set S) (O : Set ℂ) (j : S → ℂ) (k : ℂ → S), IsOpen U ∧ IsOpen O ∧ x ∈ U ∧ + ContinuousOn j U ∧ ContinuousOn k (O ∩ halfPlane) ∧ MapsTo j U (O ∩ halfPlane) ∧ + MapsTo k (O ∩ halfPlane) U ∧ LeftInvOn k j U ∧ LeftInvOn j k (O ∩ halfPlane) := by + obtain ⟨U, V, hU, hV, hxU, ⟨e⟩⟩ := hx + have : Nonempty S := ⟨x⟩ + obtain ⟨V', hV', hVV⟩ := isOpen_induced_iff.mp hV + let O : Set ℂ := complexPlane ⁻¹' V' + have hO : IsOpen O := hV'.preimage complexPlane.continuous + let f : V → ℂ := fun v => complexPlane.symm v.1.1 + have hf : IsEmbedding f := + (complexPlane.symm.toHomeomorph.isEmbedding.comp IsEmbedding.subtypeVal).comp + IsEmbedding.subtypeVal + have hr : range f = O ∩ halfPlane := by + ext z + constructor + · rintro ⟨v, rfl⟩ + refine ⟨?_, ?_⟩ + · change complexPlane (complexPlane.symm v.1.1) ∈ V' + rw [complexPlane.apply_symm_apply] + have : v.1 ∈ Subtype.val ⁻¹' V' := hVV ▸ v.2 + exact this + · have h1 := v.1.2 + change 0 ≤ (complexPlane.symm v.1.1).re + rw [← complexPlane_zero, complexPlane.apply_symm_apply] + exact h1 + · rintro ⟨h1, h2⟩ + have hz : 0 ≤ (complexPlane z) 0 := by + rw [complexPlane_zero] + exact h2 + have hmem : (⟨complexPlane z, hz⟩ : EuclideanHalfSpace 2) ∈ V := by + rw [← hVV] + exact h1 + exact ⟨⟨_, hmem⟩, complexPlane.symm_apply_apply z⟩ + let E : U ≃ₜ (O ∩ halfPlane : Set ℂ) := + e.trans (hf.toHomeomorph.trans (Homeomorph.setCongr hr)) + obtain ⟨j, k, h1, h2, h3, h4, h5, h6⟩ := exists_functions_of_homeomorph E + exact ⟨U, O, j, k, hU, hO, hxU, h1, h2, h3, h4, h5, h6⟩ + +/-- A ball of `ℂ` has the open unit disc as a model. -/ +theorem exists_homeomorph_ball (c : ℂ) {ρ : ℝ} (hρ : 0 < ρ) : + Nonempty (ball c ρ ≃ₜ OpenUnitDisc) := by + let f : ℂ → EuclideanPlane := fun z => complexPlane (((ρ : ℂ)⁻¹) * (z - c)) + let f' : EuclideanPlane → ℂ := fun w => c + (ρ : ℂ) * complexPlane.symm w + have hρ' : (ρ : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr hρ.ne' + have hfc : Continuous f := complexPlane.continuous.comp (by fun_prop) + have hf'c : Continuous f' := by + refine continuous_const.add (continuous_const.mul ?_) + exact complexPlane.symm.continuous + have hl : LeftInvOn f' f (ball c ρ) := fun z _ => by + simp only [f, f', complexPlane.symm_apply_apply] + field_simp + ring + have hnorm : ∀ z, ‖f z‖ = ‖z - c‖ / ρ := fun z => by + simp only [f] + rw [LinearIsometryEquiv.norm_map, norm_mul, norm_inv, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos hρ] + field_simp + have himg : f '' ball c ρ = OpenUnitDisc := by + ext w + constructor + · rintro ⟨z, hz, rfl⟩ + rw [OpenUnitDisc, mem_ball_zero_iff, hnorm, div_lt_one hρ] + rwa [mem_ball, dist_eq_norm] at hz + · intro hw + have hw' : ‖w‖ < 1 := mem_ball_zero_iff.mp hw + have hfw : f (f' w) = w := by + simp only [f, f'] + rw [add_sub_cancel_left, inv_mul_cancel_left₀ hρ', complexPlane.apply_symm_apply] + refine ⟨f' w, ?_, hfw⟩ + rw [mem_ball, dist_eq_norm] + have h1 := hnorm (f' w) + rw [hfw] at h1 + have h2 : ‖f' w - c‖ = ‖w‖ * ρ := by + rw [h1] + field_simp + rw [h2] + nlinarith + obtain ⟨e, -⟩ := exists_homeomorph_image hfc.continuousOn hf'c.continuousOn hl + exact ⟨e.trans (Homeomorph.setCongr himg)⟩ + +/-- In a half plane chart, a point off the boundary line is an interior point. -/ +theorem isInteriorPoint_of_chart {U : Set S} {O : Set ℂ} {j : S → ℂ} {k : ℂ → S} (hU : IsOpen U) + (hO : IsOpen O) (hj : ContinuousOn j U) (hk : ContinuousOn k (O ∩ halfPlane)) + (hm : MapsTo j U (O ∩ halfPlane)) (hk' : MapsTo k (O ∩ halfPlane) U) (hl : LeftInvOn k j U) + (hr : LeftInvOn j k (O ∩ halfPlane)) {y : S} (hy : y ∈ U) (hre : 0 < (j y).re) : + IsInteriorPoint y := by + have hopen : IsOpen (O ∩ {z : ℂ | 0 < z.re}) := + hO.inter (isOpen_lt continuous_const Complex.continuous_re) + obtain ⟨ρ, hρ, hball⟩ := Metric.isOpen_iff.mp hopen (j y) ⟨(hm hy).1, hre⟩ + have hsub : ball (j y) ρ ⊆ O ∩ halfPlane := fun z hz => + ⟨(hball hz).1, (show 0 < z.re from (hball hz).2).le⟩ + have hW : IsOpen (U ∩ j ⁻¹' ball (j y) ρ) := hj.isOpen_inter_preimage hU isOpen_ball + have hkm : k '' ball (j y) ρ = U ∩ j ⁻¹' ball (j y) ρ := by + ext p + constructor + · rintro ⟨z, hz, rfl⟩ + refine ⟨hk' (hsub hz), ?_⟩ + change j (k z) ∈ ball (j y) ρ + rwa [hr (hsub hz)] + · rintro ⟨h1, h2⟩ + exact ⟨j p, h2, hl h1⟩ + obtain ⟨E, -⟩ := exists_homeomorph_image (hk.mono hsub) + (hj.mono (by rw [hkm]; exact inter_subset_left)) (hr.mono hsub) + obtain ⟨b⟩ := exists_homeomorph_ball (j y) hρ + refine ⟨_, hW, ⟨hy, mem_ball_self hρ⟩, ⟨?_⟩⟩ + exact (Homeomorph.setCongr hkm.symm).trans (E.symm.trans b) + +/-- In a half plane chart, a point on the boundary line is not an interior point, by invariance of +domain. -/ +theorem not_isInteriorPoint_of_chart {U : Set S} {O : Set ℂ} {j : S → ℂ} (hU : IsOpen U) + (hj : ContinuousOn j U) (hm : MapsTo j U (O ∩ halfPlane)) (hinj : InjOn j U) {y : S} + (hy : y ∈ U) (hre : (j y).re = 0) : ¬ IsInteriorPoint y := by + rintro ⟨W, hW, hyW, ⟨f⟩⟩ + have : Nonempty S := ⟨y⟩ + obtain ⟨b⟩ := exists_homeomorph_ball (0 : ℂ) one_pos + obtain ⟨a, a', h1, h2, h3, h4, h5, h6⟩ := exists_functions_of_homeomorph (b.trans f.symm) + have hD : IsOpen (ball (0 : ℂ) 1 ∩ a ⁻¹' U) := h1.isOpen_inter_preimage isOpen_ball hU + have hG : ContinuousOn (j ∘ a) (ball (0 : ℂ) 1 ∩ a ⁻¹' U) := + hj.comp (h1.mono inter_subset_left) fun z hz => hz.2 + have hGi : InjOn (j ∘ a) (ball (0 : ℂ) 1 ∩ a ⁻¹' U) := fun z hz w hw he => + h5.injOn hz.1 hw.1 (hinj hz.2 hw.2 he) + have hopen := isOpen_image_of_injOn hD hG hGi + have hmem : j y ∈ (j ∘ a) '' (ball (0 : ℂ) 1 ∩ a ⁻¹' U) := by + refine ⟨a' y, ⟨h4 hyW, ?_⟩, ?_⟩ + · change a (a' y) ∈ U + rwa [h6 hyW] + · change j (a (a' y)) = j y + rw [h6 hyW] + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hopen _ hmem + have hz : j y - ((ε / 2 : ℝ) : ℂ) ∈ ball (j y) ε := by + rw [mem_ball, dist_eq_norm, sub_sub_cancel_left, norm_neg, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (half_pos hε)] + exact half_lt_self hε + obtain ⟨v, hv, he⟩ := hball hz + have hH : 0 ≤ ((j ∘ a) v).re := (hm hv.2).2 + rw [he, Complex.sub_re, hre, Complex.ofReal_re] at hH + linarith + +theorem isClosed_bd (S : Type u) [TopologicalSpace S] : IsClosed (bd S) := by + rw [← isOpen_compl_iff] + refine isOpen_iff_forall_mem_open.mpr fun x hx => ?_ + have hx' : IsInteriorPoint x := not_not.mp hx + obtain ⟨U, hU, hxU, ⟨f⟩⟩ := hx' + exact ⟨U, fun y hy hn => hn ⟨U, hU, hy, ⟨f⟩⟩, hU, hxU⟩ + +/-- A boundary point of a surface has an interval around it in the boundary. -/ +theorem exists_boundary_chart {x : S} (hx : IsManifoldPoint x) (hb : x ∈ bd S) : + ∃ (ψ : ℝ → S) (W : Set S), ContinuousOn ψ (Icc (-1) 1) ∧ InjOn ψ (Icc (-1) 1) ∧ IsOpen W ∧ + x ∈ W ∧ ψ '' Ioo (-1) 1 = W ∩ bd S ∧ ψ '' Icc (-1) 1 ⊆ bd S := by + obtain ⟨U, O, j, k, hU, hO, hxU, hj, hk, hm, hk', hl, hr⟩ := hx.exists_chart + have hre : (j x).re = 0 := by + refine le_antisymm (not_lt.mp fun h => hb ?_) (hm hxU).2 + exact isInteriorPoint_of_chart hU hO hj hk hm hk' hl hr hxU h + obtain ⟨ρ, hρ, hball⟩ := Metric.isOpen_iff.mp hO _ (hm hxU).1 + let c : ℝ → ℂ := fun s => j x + (((ρ / 2) * s : ℝ) : ℂ) * Complex.I + have hcn : ∀ s : ℝ, ‖c s - j x‖ = ρ / 2 * |s| := fun s => by + simp only [c, add_sub_cancel_left, norm_mul, Complex.norm_I, mul_one, Complex.norm_real, + Real.norm_eq_abs] + rw [abs_of_pos (half_pos hρ)] + have hcre : ∀ s : ℝ, (c s).re = 0 := fun s => by + simp [c, hre] + have hcO : ∀ s ∈ Icc (-1 : ℝ) 1, c s ∈ O ∩ halfPlane := fun s hs => by + refine ⟨hball ?_, ?_⟩ + · rw [mem_ball, dist_eq_norm, hcn] + have h1 : |s| ≤ 1 := abs_le.mpr hs + nlinarith + · change 0 ≤ (c s).re + rw [hcre] + have hcc : Continuous c := by fun_prop + have hci : Function.Injective c := fun s s' he => by + have h1 : ((ρ / 2) * s : ℝ) = (ρ / 2) * s' := by + have h2 : (((ρ / 2) * s : ℝ) : ℂ) * Complex.I = (((ρ / 2) * s' : ℝ) : ℂ) * Complex.I := + add_left_cancel he + exact Complex.ofReal_injective (mul_right_cancel₀ Complex.I_ne_zero h2) + exact mul_left_cancel₀ (half_pos hρ).ne' h1 + have hbd : ∀ s ∈ Icc (-1 : ℝ) 1, k (c s) ∈ bd S := by + intro s hs + refine not_isInteriorPoint_of_chart hU hj hm hl.injOn (hk' (hcO s hs)) ?_ + rw [hr (hcO s hs), hcre] + refine ⟨k ∘ c, U ∩ j ⁻¹' ball (j x) (ρ / 2), hk.comp hcc.continuousOn hcO, ?_, + hj.isOpen_inter_preimage hU isOpen_ball, ⟨hxU, mem_ball_self (half_pos hρ)⟩, ?_, ?_⟩ + · intro s hs s' hs' he + exact hci ((show LeftInvOn j k (O ∩ halfPlane) from hr).injOn (hcO s hs) (hcO s' hs') he) + · ext y + constructor + · rintro ⟨s, hs, rfl⟩ + have hs' := Ioo_subset_Icc_self hs + refine ⟨⟨hk' (hcO s hs'), ?_⟩, hbd s hs'⟩ + change j (k (c s)) ∈ ball (j x) (ρ / 2) + rw [hr (hcO s hs'), mem_ball, dist_eq_norm, hcn] + have h1 : |s| < 1 := abs_lt.mpr hs + nlinarith [half_pos hρ] + · rintro ⟨⟨h1, h2⟩, h3⟩ + have hyre : (j y).re = 0 := by + refine le_antisymm (not_lt.mp fun h => h3 ?_) (hm h1).2 + exact isInteriorPoint_of_chart hU hO hj hk hm hk' hl hr h1 h + have hd : ‖j y - j x‖ < ρ / 2 := by + have : j y ∈ ball (j x) (ρ / 2) := h2 + rwa [mem_ball, dist_eq_norm] at this + let s : ℝ := (j y - j x).im / (ρ / 2) + have hρ2 := half_pos hρ + have hcs : c s = j y := by + refine Complex.ext ?_ ?_ + · rw [hcre, hyre] + · simp only [c, s, Complex.add_im, Complex.mul_im, Complex.ofReal_re, Complex.I_im, + Complex.ofReal_im, Complex.I_re, mul_one, mul_zero, add_zero, Complex.sub_im] + field_simp + ring + have hsa : |s| < 1 := by + have h4 := hcn s + rw [hcs] at h4 + rw [h4] at hd + nlinarith + refine ⟨s, abs_lt.mp hsa, ?_⟩ + change k (c s) = y + rw [hcs] + exact hl h1 + · rintro _ ⟨s, hs, rfl⟩ + exact hbd s hs + +/-- **Cuffs.** The boundary of a surface is closed, with finitely many components, each an `O`-arc. +-/ +theorem cuff_statement : CuffStatement.{u} := by + classical + intro S _ hS + obtain ⟨hcpt, ht2, hman⟩ := hS + have hcl := isClosed_bd S + refine ⟨hcl, ?_, ?_⟩ + · have hchart : ∀ x : bd S, ∃ W : Set S, IsOpen W ∧ x.1 ∈ W ∧ + W ∩ bd S ⊆ connectedComponentIn (bd S) x.1 := by + rintro ⟨x, hx⟩ + obtain ⟨ψ, W, hc, -, hW, hxW, he, hsub⟩ := exists_boundary_chart (hman x) hx + refine ⟨W, hW, hxW, ?_⟩ + rw [← he] + have hmem : x ∈ ψ '' Ioo (-1) 1 := he ▸ ⟨hxW, hx⟩ + exact ((isPreconnected_Ioo).image ψ (hc.mono Ioo_subset_Icc_self)).subset_connectedComponentIn + hmem ((image_mono Ioo_subset_Icc_self).trans hsub) + choose W hWo hxW hWsub using hchart + obtain ⟨t, ht⟩ := hcl.isCompact.elim_finite_subcover (fun x => W x) (fun x => hWo x) + (fun x hx => mem_iUnion.mpr ⟨⟨x, hx⟩, hxW _⟩) + refine (t.finite_toSet.image fun x => connectedComponentIn (bd S) x.1).subset ?_ + rintro _ ⟨y, hy, rfl⟩ + obtain ⟨x, hxt, hyW⟩ := mem_iUnion₂.mp (ht hy) + exact ⟨x, hxt, connectedComponentIn_eq (hWsub x ⟨hyW, hy⟩)⟩ + · rintro _ ⟨x, hx, rfl⟩ + set C := connectedComponentIn (bd S) x with hC + have hxC : x ∈ C := mem_connectedComponentIn hx + have hCsub : C ⊆ bd S := connectedComponentIn_subset _ _ + have hCcl : IsClosed C := by + refine isClosed_of_closure_subset ?_ + exact isPreconnected_connectedComponentIn.closure.subset_connectedComponentIn + (subset_closure hxC) (closure_minimal hCsub hcl) + have : CompactSpace C := isCompact_iff_compactSpace.mp hCcl.isCompact + have : ConnectedSpace C := isConnected_iff_connectedSpace.mp ⟨⟨x, hxC⟩, + isPreconnected_connectedComponentIn⟩ + refine exists_homeomorph_circle fun y => ?_ + obtain ⟨ψ, W, hc, hi, hW, hyW, he, hsub⟩ := exists_boundary_chart (hman y.1) (hCsub y.2) + have hIcc : ψ '' Icc (-1) 1 ⊆ C := by + obtain ⟨s, hs, hse⟩ : y.1 ∈ ψ '' Ioo (-1) 1 := he ▸ ⟨hyW, hCsub y.2⟩ + have h1 : IsPreconnected (ψ '' Icc (-1) 1) := isPreconnected_Icc.image ψ hc + have h2 := h1.subset_connectedComponentIn ⟨s, Ioo_subset_Icc_self hs, hse⟩ hsub + have h3 : connectedComponentIn (bd S) y.1 = C := (connectedComponentIn_eq y.2).symm + rwa [h3] at h2 + have hm1 : (-1 : ℝ) ≤ 1 := by norm_num + let cl : ℝ → ℝ := fun s => (projIcc (-1) 1 hm1 s).1 + have hcl1 : ∀ s, cl s ∈ Icc (-1 : ℝ) 1 := fun s => (projIcc (-1) 1 hm1 s).2 + have hcl2 : ∀ s ∈ Icc (-1 : ℝ) 1, cl s = s := fun s hs => by + change (projIcc (-1) 1 hm1 s).1 = s + rw [projIcc_of_mem hm1 hs] + have hclc : Continuous cl := continuous_subtype_val.comp continuous_projIcc + let χ : ℝ → C := fun s => ⟨ψ (cl s), hIcc (mem_image_of_mem ψ (hcl1 s))⟩ + refine ⟨χ, ⟨?_, ?_, ?_⟩, ?_⟩ + · exact (Continuous.subtype_mk (hc.comp_continuous hclc hcl1) _).continuousOn + · intro s hs s' hs' he + have h1 : ψ (cl s) = ψ (cl s') := congrArg Subtype.val he + rw [hcl2 s hs, hcl2 s' hs'] at h1 + exact hi hs hs' h1 + · have heq : χ '' Ioo (-1) 1 = Subtype.val ⁻¹' W := by + ext p + constructor + · rintro ⟨s, hs, rfl⟩ + have h1 : ψ s ∈ ψ '' Ioo (-1) 1 := mem_image_of_mem ψ hs + rw [he] at h1 + change ψ (cl s) ∈ W + rw [hcl2 s (Ioo_subset_Icc_self hs)] + exact h1.1 + · intro hp + have h1 : p.1 ∈ ψ '' Ioo (-1) 1 := by + rw [he] + exact ⟨hp, hCsub p.2⟩ + obtain ⟨s, hs, hse⟩ := h1 + refine ⟨s, hs, Subtype.ext ?_⟩ + change ψ (cl s) = p.1 + rw [hcl2 s (Ioo_subset_Icc_self hs), hse] + rw [heq] + exact hW.preimage continuous_subtype_val + · have h1 : y.1 ∈ ψ '' Ioo (-1) 1 := by + rw [he] + exact ⟨hyW, hCsub y.2⟩ + obtain ⟨s, hs, hse⟩ := h1 + refine ⟨s, hs, Subtype.ext ?_⟩ + change ψ (cl s) = y.1 + rw [hcl2 s (Ioo_subset_Icc_self hs), hse] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutArc.lean b/LeanPool/GraphMinor/Surface/CutArc.lean new file mode 100644 index 0000000000..2a15ad59de --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutArc.lean @@ -0,0 +1,668 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutEdges + +/-! +# Cutting a surface along an arc + +`exists_cut_arc` and `exists_cut_loop` cut a connected surface along a proper `I`-arc or along an +`O`-arc off the boundary. +We dissect the surface so that the arc is a chain of edges, cut the word of the dissection along +these edges, and fit the +lifts of the edges together. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +local notation "𝕀" => unitInterval + +variable {S S' : Type u} [TopologicalSpace S] [TopologicalSpace S'] [T2Space S'] {ψ : S' → S} + +omit [TopologicalSpace S] [T2Space S'] in +theorem LiftPair.swap {Z : Set S} {u v : S} {X Y : Set S'} (h : LiftPair ψ Z u v X Y) : LiftPair ψ + Z v u X Y := by + obtain ⟨x0, x1, y0, y1, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ := h + exact ⟨x1, x0, y1, y0, h1.symm, h2.symm, h3, h4, h5, h6, h9, h10, h7, h8⟩ + +omit [TopologicalSpace S] [T2Space S'] in +theorem LiftPair.ncard {Z : Set S} {u v : S} {X Y : Set S'} (h : LiftPair ψ Z u v X Y) {x : S} + (hx : x ∈ Z) : + (ψ ⁻¹' {x}).encard = 2 ∧ (ψ ⁻¹' {x}).ncard = 2 := by + obtain ⟨x0, x1, y0, y1, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ := h + obtain ⟨a, ha, rfl⟩ := h5.surjOn hx + obtain ⟨b, hb, hab⟩ := h6.surjOn hx + have hne : a ≠ b := fun he => Set.disjoint_left.mp h3 ha (he ▸ hb) + have e : ψ ⁻¹' {ψ a} = {a, b} := by + ext z + constructor + · intro hz + have hz' : z ∈ X ∪ Y := by + rw [h4] + change ψ z ∈ Z + rw [show ψ z = ψ a from hz] + exact hx + rcases hz' with hz' | hz' + · exact .inl (h5.injOn hz' ha hz) + · exact .inr (h6.injOn hz' hb (hab ▸ hz)) + · rintro (rfl | rfl) + · rfl + · exact hab + rw [e] + exact ⟨encard_pair hne, ncard_pair hne⟩ + +/-- The index of the vertex at the end `τ` of the edge `p` of a chain. -/ +def chainAt (ε : ℕ → Bool) (p : ℕ) (τ : Bool) : ℕ := if τ = ε p then p + 1 else p + +theorem chainAt_split {ε : ℕ → Bool} {q k : ℕ} {τ : Bool} (h : chainAt ε q τ = k) : + (q = k ∧ τ = !ε q) ∨ (q + 1 = k ∧ τ = ε q) := by + unfold chainAt at h + split_ifs at h with h1 + · exact .inr ⟨h, h1⟩ + · refine .inl ⟨h, ?_⟩ + cases τ <;> cases hε : ε q <;> simp_all + +/-- The ends of the edges of a chain at a vertex. -/ +theorem chain_cases {X : Type*} {A : Set X → 𝕀 → X} {bdS : Set X} {ι : ℝ → X} {m : ℕ} {t : ℕ + → ℝ} {ss : ℕ → Set X} + {ε : ℕ → Bool} (hex : ∀ p < m, ∀ τ, extI (A (ss p)) (eo τ) = ι (t (chainAt ε p τ))) + (hinj : ∀ p < m, ∀ q < m, p ≠ q → ss p ≠ ss q) (closed : Prop) + (hk : ∀ k ≤ m, ∀ k' ≤ m, ι (t k) = ι (t k') → k = k' ∨ (closed ∧ ((k = 0 ∧ k' = m) ∨ (k = m + ∧ k' = 0)))) + (h2 : closed → 2 ≤ m) (hm : 0 < m) (hb0 : closed → ∀ k ≤ m, ι (t k) ∉ bdS) + (hb1 : ¬ closed → ι (t 0) ∈ bdS ∧ ι (t m) ∈ bdS ∧ ∀ k, 0 < k → k < m → ι (t k) ∉ bdS) + (hclose : closed → ι (t 0) = ι (t m)) {p : ℕ} (hp : p < m) (τ : Bool) : + (∃ e' ∈ ss '' Iio m, ∃ τ', e' ≠ ss p ∧ extI (A e') (eo τ') = extI (A (ss p)) (eo τ) ∧ extI (A + (ss p)) (eo τ) ∉ bdS ∧ + ∀ e'' ∈ ss '' Iio m, ∀ τ'', extI (A e'') (eo τ'') = extI (A (ss p)) (eo τ) → + (e'' = ss p ∧ τ'' = τ) ∨ (e'' = e' ∧ τ'' = τ')) ∨ + (extI (A (ss p)) (eo τ) ∈ bdS ∧ ∀ e'' ∈ ss '' Iio m, ∀ τ'', extI (A e'') (eo τ'') = extI (A + (ss p)) (eo τ) → + e'' = ss p ∧ τ'' = τ) := by + set k := chainAt ε p τ with hkdef + have hat : ∀ q < m, ∀ τ', chainAt ε q τ' ≤ m := fun q hq τ' => by + unfold chainAt + split_ifs <;> omega + have hkm : k ≤ m := hat p hp τ + have hv : extI (A (ss p)) (eo τ) = ι (t k) := hex p hp τ + rw [hv] + have two : ∀ q₂ τ₂, q₂ < m → q₂ ≠ p → ι (t (chainAt ε q₂ τ₂)) = ι (t k) → ι (t k) ∉ bdS → + (∀ q < m, ∀ τ'', ι (t (chainAt ε q τ'')) = ι (t k) → (q = p ∧ τ'' = τ) ∨ (q = q₂ ∧ τ'' = τ₂)) + → + ∃ e' ∈ ss '' Iio m, ∃ τ', e' ≠ ss p ∧ extI (A e') (eo τ') = ι (t k) ∧ ι (t k) ∉ bdS ∧ + ∀ e'' ∈ ss '' Iio m, ∀ τ'', extI (A e'') (eo τ'') = ι (t k) → (e'' = ss p ∧ τ'' = τ) ∨ (e'' + = e' ∧ τ'' = τ') := by + intro q₂ τ₂ h3 h4 h5 h6 h7 + refine ⟨ss q₂, ⟨q₂, h3, rfl⟩, τ₂, hinj q₂ h3 p hp h4, (hex q₂ h3 τ₂).trans h5, h6, ?_⟩ + rintro _ ⟨q, hq, rfl⟩ τ'' h8 + rw [hex q hq τ''] at h8 + rcases h7 q hq τ'' h8 with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact .inl ⟨rfl, rfl⟩ + · exact .inr ⟨rfl, rfl⟩ + have hreg : ∀ q < m, ∀ τ'', ι (t (chainAt ε q τ'')) = ι (t k) → chainAt ε q τ'' = k ∨ + (closed ∧ ((chainAt ε q τ'' = 0 ∧ k = m) ∨ (chainAt ε q τ'' = m ∧ k = 0))) := fun q hq τ'' h + => + hk _ (hat q hq τ'') _ hkm h + have hat1 : ∀ r, chainAt ε r (ε r) = r + 1 := fun r => by simp [chainAt] + have hat2 : ∀ r, chainAt ε r (!ε r) = r := fun r => by simp [chainAt] + by_cases hk0 : k = 0 + · have hsp := chainAt_split hkdef.symm + obtain ⟨hp0, hτ⟩ : p = 0 ∧ τ = !ε p := by + rcases hsp with h | h + · exact ⟨h.1.trans hk0, h.2⟩ + · omega + by_cases hcl : closed + · left + have hm2 := h2 hcl + refine two (m - 1) (ε (m - 1)) (by omega) (by omega) ?_ (hb0 hcl k hkm) ?_ + · rw [hat1, show m - 1 + 1 = m by omega, hk0] + exact (hclose hcl).symm + · intro q hq τ'' h8 + rcases hreg q hq τ'' h8 with h9 | ⟨-, ⟨-, h9⟩ | ⟨h9, -⟩⟩ + · rcases chainAt_split (h9.trans hk0) with h10 | h10 + · left + have hqp : q = p := by omega + subst hqp + exact ⟨rfl, h10.2.trans hτ.symm⟩ + · omega + · omega + · rcases chainAt_split h9 with h10 | h10 + · omega + · right + have : q = m - 1 := by omega + subst this + exact ⟨rfl, h10.2⟩ + · right + refine ⟨hk0 ▸ (hb1 hcl).1, ?_⟩ + rintro _ ⟨q, hq, rfl⟩ τ'' h8 + rw [hex q hq τ''] at h8 + rcases hreg q hq τ'' h8 with h9 | ⟨hc, -⟩ + · rcases chainAt_split (h9.trans hk0) with h10 | h10 + · have hq0 : q = 0 := h10.1 + subst hq0 + subst hp0 + exact ⟨rfl, by rw [hτ]; exact h10.2⟩ + · omega + · exact absurd hc hcl + by_cases hkm' : k = m + · have hsp := chainAt_split hkdef.symm + obtain ⟨hp0, hτ⟩ : p + 1 = m ∧ τ = ε p := by + rcases hsp with h | h + · omega + · exact ⟨h.1.trans hkm', h.2⟩ + by_cases hcl : closed + · left + have hm2 := h2 hcl + refine two 0 (!ε 0) hm (by omega) ?_ (hb0 hcl k hkm) ?_ + · rw [hat2, hkm'] + exact hclose hcl + · intro q hq τ'' h8 + rcases hreg q hq τ'' h8 with h9 | ⟨-, ⟨h9, -⟩ | ⟨-, h9⟩⟩ + · rcases chainAt_split (h9.trans hkm') with h10 | h10 + · omega + · left + have : q = p := by omega + subst this + exact ⟨rfl, h10.2.trans hτ.symm⟩ + · rcases chainAt_split h9 with h10 | h10 + · right + have hq0 : q = 0 := h10.1 + subst hq0 + exact ⟨rfl, h10.2⟩ + · omega + · omega + · right + refine ⟨hkm' ▸ (hb1 hcl).2.1, ?_⟩ + rintro _ ⟨q, hq, rfl⟩ τ'' h8 + rw [hex q hq τ''] at h8 + rcases hreg q hq τ'' h8 with h9 | ⟨hc, -⟩ + · rcases chainAt_split (h9.trans hkm') with h10 | h10 + · have := h10.1 + simp only [mem_Iio] at hq + omega + · have : q = p := by omega + subst this + exact ⟨rfl, h10.2.trans hτ.symm⟩ + · exact absurd hc hcl + · left + have hbv : ι (t k) ∉ bdS := by + by_cases hcl : closed + · exact hb0 hcl k hkm + · exact (hb1 hcl).2.2 k (by omega) (by omega) + have huni : ∀ q < m, ∀ τ'', ι (t (chainAt ε q τ'')) = ι (t k) → (q = k ∧ τ'' = !ε q) ∨ (q + 1 + = k ∧ τ'' = ε q) := by + intro q hq τ'' h8 + rcases hreg q hq τ'' h8 with h9 | ⟨-, ⟨-, h9⟩ | ⟨-, h9⟩⟩ + · exact chainAt_split h9 + · omega + · omega + have hsp := chainAt_split hkdef.symm + rcases hsp with ⟨hpk, hτ⟩ | ⟨hpk, hτ⟩ + · refine two (k - 1) (ε (k - 1)) (by omega) (by omega) ?_ hbv ?_ + · rw [hat1, show k - 1 + 1 = k by omega] + · intro q hq τ'' h8 + rcases huni q hq τ'' h8 with h10 | h10 + · left + have : q = p := by omega + subst this + exact ⟨rfl, h10.2.trans hτ.symm⟩ + · right + have : q = k - 1 := by omega + subst this + exact ⟨rfl, h10.2⟩ + · refine two k (!ε k) (by omega) (by omega) ?_ hbv ?_ + · rw [hat2] + · intro q hq τ'' h8 + rcases huni q hq τ'' h8 with h10 | h10 + · right + have : q = k := by omega + subst this + exact ⟨rfl, h10.2⟩ + · left + have : q = p := by omega + subst this + exact ⟨rfl, h10.2.trans hτ.symm⟩ + +theorem chain_hex {X : Type*} {A : Set X → 𝕀 → X} {ι : ℝ → X} {t : ℕ → ℝ} {ss : ℕ → Set X} {ε : ℕ + → Bool} {p : ℕ} + (h1 : ι (t p) = extI (A (ss p)) (if ε p then 0 else 1)) (h2 : ι (t (p + 1)) = extI (A (ss p)) + (if ε p then 1 else 0)) + (τ : Bool) : extI (A (ss p)) (eo τ) = ι (t (chainAt ε p τ)) := by + unfold chainAt + cases hε : ε p <;> cases τ <;> simp only [hε, eo] at h1 h2 ⊢ <;> simp_all + +variable {S₁ : Type u} [TopologicalSpace S₁] [T2Space S₁] + +/-- The words of a dissection of a connected surface. -/ +theorem exists_word_edges (hS : IsSurface S₁) [ConnectedSpace S₁] {V : Set S₁} {E 𝓕 : Set (Set S₁)} + (hd : IsDissection V E 𝓕) : + ∃ (W : ℕ → List Letter) (f : ℕ × ℂ → S₁) (A : Set S₁ → 𝕀 → S₁) (lab : Set S₁ + → ℕ), WordEdges W f V E A lab ∧ + (Dsk W).Nonempty := by + have hne : 𝓕.Nonempty := by + rw [nonempty_iff_ne_empty] + rintro rfl + obtain ⟨x⟩ : Nonempty S₁ := inferInstance + have := hd.cover + simp at this + exact eq_empty_iff_forall_notMem.mp this.symm x (mem_univ _) + obtain ⟨W, f, -, A, lab, h1, h2, h3, -, -, -, h7, h8, h9, h10, h11⟩ + := exists_family_edges hS.2.2 hd hne + exact ⟨W, f, A, lab, ⟨h1, h11, h3, hd.graph, h7, h8, h9, h10⟩, ⟨(0, 0), h2, by simp⟩⟩ + +/-- A space presented by the cut word, in the universe of the surface. -/ +theorem exists_cut_presented {W : ℕ → List Letter} (hW : FinW W) (hP : IsPaired W) (hne : + (Dsk W).Nonempty) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (_ : T2Space Y) (g : ℕ × ℂ → Y), Presents W g := by + have := t2Space_wordSpace hW hP + let e : WordSpace W ≃ₜ ULift.{u} (WordSpace W) := Homeomorph.ulift.symm + exact ⟨ULift.{u} (WordSpace W), inferInstance, e.symm.isEmbedding.t2Space, _, + presents_comp (presents_wordMap hne) e⟩ + +/-- Cutting along a chain of edges. -/ +theorem exists_cut_of_chain {W : ℕ → List Letter} {f : ℕ × ℂ → S₁} {V : Set S₁} {E : Set + (Set S₁)} {A : Set S₁ → 𝕀 → S₁} + {lab : Set S₁ → ℕ} (h : WordEdges W f V E A lab) (hne : (Dsk W).Nonempty) {ι : ℝ + → S₁} {m : ℕ} {t : ℕ → ℝ} {ss : ℕ → Set S₁} + {ε : ℕ → Bool} (hs : ∀ p < m, ss p ∈ E ∧ ι (t p) = extI (A (ss p)) (if ε p then 0 else 1) ∧ + ι (t (p + 1)) = extI (A (ss p)) (if ε p then 1 else 0)) + (hinj : ∀ p < m, ∀ q < m, p ≠ q → ss p ≠ ss q) (hmid : ∀ p < m, edgeMid A (ss p) ∉ bd S₁) + (closed : Prop) + (hk : ∀ k ≤ m, ∀ k' ≤ m, ι (t k) = ι (t k') → k = k' ∨ (closed ∧ ((k = 0 ∧ k' = m) ∨ (k = m + ∧ k' = 0)))) + (h2 : closed → 2 ≤ m) (hm : 0 < m) (hb0 : closed → ∀ k ≤ m, ι (t k) ∉ bd S₁) + (hb1 : ¬ closed → ι (t 0) ∈ bd S₁ ∧ ι (t m) ∈ bd S₁ ∧ ∀ k, 0 < k → k < m → ι (t k) ∉ bd S₁) + (hclose : closed → ι (t 0) = ι (t m)) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S₁), Continuous ψ + ∧ Function.Surjective ψ ∧ + InjOn ψ (ψ ⁻¹' (⋃₀ (ss '' Iio m))ᶜ) ∧ ψ ⁻¹' (⋃₀ (ss '' Iio m)) ⊆ bd Y ∧ IsSurface Y ∧ + ∀ p < m, ∃ X X', LiftPair ψ (ss p) (ι (t p)) (ι (t (p + 1))) X X' := by + classical + have hDE : ss '' Iio m ⊆ E := by + rintro _ ⟨p, hp, rfl⟩ + exact (hs p hp).1 + have hsd : ∀ e ∈ ss '' Iio m, ∃ (i p j q : ℕ) (e₁ e₂ : Bool), EdgeSides W (lab e) i p j q e₁ e₂ + := by + rintro _ ⟨p, hp, rfl⟩ + obtain ⟨i, p', j, q, e₁, e₂, h1, h2, h3⟩ := h.exists_sides (hs p hp).1 (hmid p hp) + exact ⟨i, p', j, q, e₁, e₂, h1, h2, h3⟩ + obtain ⟨Y, tY, t2, g, hg⟩ := exists_cut_presented.{u} (W := cutW W (lab '' (ss '' Iio m))) + (finW_cut h.fin) + (isPaired_cut h.paired) (by rw [dsk_cut]; exact hne) + obtain ⟨ψ, h1, h3, h4, h5, h6, h7⟩ := h.cut_space hDE hsd (fun e he τ => by + obtain ⟨p, hp, rfl⟩ := he + exact chain_cases (A := A) (bdS := bd S₁) (ι := ι) (m := m) (t := t) (ss := ss) (ε := ε) + (fun q hq τ => chain_hex (hs q hq).2.1 (hs q hq).2.2 τ) hinj closed hk h2 hm hb0 hb1 hclose + hp τ) hg + refine ⟨Y, tY, t2, ψ, h1, h3, h4, h5, h6, fun p hp => ?_⟩ + obtain ⟨X, X', hX⟩ := h7 (ss p) ⟨p, hp, rfl⟩ + have hv0 : extI (A (ss p)) 0 = extI (A (ss p)) (eo false) := by simp [eo] + have hv1 : extI (A (ss p)) 1 = extI (A (ss p)) (eo true) := by simp [eo] + have e0 := (hs p hp).2.1 + have e1 := (hs p hp).2.2 + cases hε : ε p + · rw [hε] at e0 e1 + simp only [Bool.false_eq_true, ite_false] at e0 e1 + rw [e0, e1] + exact ⟨X, X', hX.swap⟩ + · rw [hε] at e0 e1 + simp only [ite_true] at e0 e1 + rw [e0, e1] + exact ⟨X, X', hX⟩ + +theorem chain_mono {t : ℕ → ℝ} {m : ℕ} (hlt : ∀ p < m, t p < t (p + 1)) {k k' : ℕ} (h : k < k') + (hk : k' ≤ m) : t k < t k' := by + induction k', h using Nat.le_induction with + | base => exact hlt k (by omega) + | succ q hq ih => exact (ih (by omega)).trans (hlt q (by omega)) + +theorem chain_mono' {t : ℕ → ℝ} {m : ℕ} (hlt : ∀ p < m, t p < t (p + 1)) {k k' : ℕ} (h : k ≤ k') + (hk : k' ≤ m) : t k ≤ t k' := by + rcases eq_or_lt_of_le h with rfl | h + · exact le_rfl + · exact (chain_mono hlt h hk).le + +/-- The images of consecutive intervals of an increasing chain cover the whole interval image. -/ +theorem sUnion_image_Icc_chain {Y : Type*} (f : ℝ → Y) {m : ℕ} {t : ℕ → ℝ} + {pieces : ℕ → Set Y} (hm : 0 < m) (hlt : ∀ p < m, t p < t (p + 1)) + (hpieces : ∀ p < m, f '' Icc (t p) (t (p + 1)) = pieces p) : + ⋃₀ (pieces '' Iio m) = f '' Icc (t 0) (t m) := by + apply subset_antisymm + · rintro z ⟨_, ⟨p, hp, rfl⟩, hz⟩ + rw [← hpieces p hp] at hz + exact image_mono (Icc_subset_Icc (chain_mono' hlt (Nat.zero_le p) hp.le) + (chain_mono' hlt hp le_rfl)) hz + · have cover : ∀ k ≤ m, f '' Icc (t 0) (t k) ⊆ ⋃₀ (pieces '' Iio m) := by + intro k + induction k with + | zero => + rintro _ _ ⟨x, hx, rfl⟩ + refine ⟨pieces 0, ⟨0, hm, rfl⟩, ?_⟩ + rw [← hpieces 0 hm] + exact ⟨x, ⟨hx.1, hx.2.trans (hlt 0 hm).le⟩, rfl⟩ + | succ k ih => + rintro hk _ ⟨x, hx, rfl⟩ + by_cases hxk : x ≤ t k + · exact ih (by omega) ⟨x, ⟨hx.1, hxk⟩, rfl⟩ + · have hk' : k < m := hk + refine ⟨pieces k, ⟨k, hk', rfl⟩, ?_⟩ + rw [← hpieces k hk'] + exact ⟨x, ⟨(not_le.mp hxk).le, hx.2⟩, rfl⟩ + exact cover m le_rfl + +omit [TopologicalSpace S₁] [T2Space S₁] in +/-- The lifts of the edges of a chain fit together. -/ +theorem chain_fold {S' : Type u} [TopologicalSpace S'] [T2Space S'] {ψ : S' → S₁} {ι : ℝ + → S₁} {t : ℕ → ℝ} {ss : ℕ → Set S₁} + {m : ℕ} (hlt : ∀ p < m, t p < t (p + 1)) (h0 : t 0 = 0) (hss : ∀ p < m, ss p = ι '' Icc (t p) + (t (p + 1))) + (hlift : ∀ p < m, ∃ X X', LiftPair ψ (ss p) (ι (t p)) (ι (t (p + 1))) X X') {n : ℕ} + (hn : 0 < n) (hnm : n ≤ m) + (hι : InjOn ι (Icc 0 (t n))) : ∃ X X', LiftPair ψ (ι '' Icc 0 (t n)) (ι 0) (ι (t n)) X X' := by + induction n, hn using Nat.le_induction with + | base => + obtain ⟨X, X', hX⟩ := hlift 0 (by omega) + rw [hss 0 (by omega), h0] at hX + exact ⟨X, X', hX⟩ + | succ n hn ih => + have hnm' : n + 1 ≤ m := hnm + have hstep := hlt n (by omega) + have h1 : 0 ≤ t n := by + have := chain_mono' hlt (Nat.zero_le n) (by omega) + rwa [h0] at this + have hsub : Icc 0 (t n) ⊆ Icc 0 (t (n + 1)) := Icc_subset_Icc_right hstep.le + obtain ⟨X₁, Y₁, h2⟩ := ih (by omega) (hι.mono hsub) + obtain ⟨X₂, Y₂, h3⟩ := hlift n (by omega) + rw [hss n (by omega)] at h3 + have hi : ι '' Icc 0 (t n) ∩ ι '' Icc (t n) (t (n + 1)) = {ι (t n)} := by + ext z + constructor + · rintro ⟨⟨x, hx, rfl⟩, ⟨y, hy, he⟩⟩ + have h4 : y = x := hι ⟨h1.trans hy.1, hy.2⟩ (hsub hx) he + have h5 : x = t n := le_antisymm hx.2 (h4 ▸ hy.1) + rw [h5] + rfl + · rintro rfl + exact ⟨⟨_, ⟨h1, le_rfl⟩, rfl⟩, ⟨_, ⟨le_rfl, hstep.le⟩, rfl⟩⟩ + have hc := (h3.ncard (x := ι (t n)) ⟨_, ⟨le_rfl, hstep.le⟩, rfl⟩).1 + obtain ⟨X, X', hX⟩ := h2.join h3 hi hc.le + rw [← image_union, Icc_union_Icc_eq_Icc h1 hstep.le] at hX + exact ⟨X, X', hX⟩ + +/-- Cutting a connected surface along a proper `I`-arc, by cutting the word of a dissection. -/ +theorem exists_cut_arc (hS : IsSurface S₁) [ConnectedSpace S₁] {F : Set S₁} {s t : S₁} + (hne : s ≠ t) (hF : F ∩ bd S₁ = {s, t}) + (hl : IsLineWithEnds F s t) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S₁), IsSurface Y + ∧ IsCutting ψ F ∧ + ∃ X X', LiftPair ψ F s t X X' := by + classical + have hs : s ∈ bd S₁ := (show s ∈ F ∩ bd S₁ from hF ▸ mem_insert _ _).2 + have ht : t ∈ bd S₁ := (show t ∈ F ∩ bd S₁ from hF ▸ mem_insert_of_mem _ rfl).2 + obtain ⟨V₁, E₁, hg, hV, hgr⟩ := exists_cuff_graph hS + obtain ⟨E₂, hg2, hgr2, hs2⟩ := hg.add_point s + obtain ⟨E₃, hg3, hgr3, hs3⟩ := hg2.add_point t + have hgr1 : gr V₁ E₁ = bd S₁ := by + rw [← hgr] + exact union_eq_right.mpr hV + have hgall : gr (insert t (insert s V₁)) E₃ = bd S₁ := by + rw [hgr3, hgr2, hgr1, insert_eq_of_mem hs, insert_eq_of_mem ht] + obtain ⟨hg4, hgr4⟩ := hg3.add_arc hne hl (mem_insert_of_mem _ (mem_insert _ _)) (mem_insert _ _) + (by rw [hgall, hF]) + have hE₃ : ⋃₀ E₃ = bd S₁ := by + apply subset_antisymm + · rw [← hgall] + exact subset_union_right + · rw [← hgr] + exact hs2.trans hs3 + have hE₀ : ⋃₀ insert F E₃ = bd S₁ ∪ F := by + rw [sUnion_insert, hE₃, union_comm] + have hfin := (cuff_statement.{u} S₁ hS).2.1 + have hO := (cuff_statement.{u} S₁ hS).2.2 + have hV₀ : insert t (insert s V₁) ⊆ ⋃₀ insert F E₃ := by + rw [hE₀] + rintro z (rfl | rfl | hz) + · exact .inl ht + · exact .inl hs + · exact .inl (hgr ▸ hV hz) + obtain ⟨V, E, 𝓕, hd, hVV, hEE⟩ := exists_dissection_with hS hg4 hV₀ hfin hO subset_rfl + (.inr ⟨F, s, t, by rw [hE₀, sUnion_cuffs], hl, hne, by rwa [sUnion_cuffs], by rwa + [sUnion_cuffs]⟩) + obtain ⟨W, f, A, lab, hw, hdn⟩ := exists_word_edges hS hd + obtain ⟨a, ha, rfl, rfl, rfl⟩ := hl.exists_arc + have hιc := continuous_extI ha.1 + have hinj := extI_injOn ha.2 + have hval0 : extI a 0 = a 0 := extI_coe a 0 + have hval1 : extI a 1 = a 1 := extI_coe a 1 + have himg : extI a '' Icc 0 1 = range a := image_extI a + have hFg : range a ⊆ gr V E := fun z hz => hEE (hE₀ ▸ .inr hz) + have hstart : extI a 0 ∈ V := by + rw [hval0] + exact hVV (mem_insert_of_mem _ (mem_insert _ _)) + have hfinish : extI a 1 ∈ V := by + rw [hval1] + exact hVV (mem_insert _ _) + obtain ⟨m, τ, ss, ε, hm, ht0, htm, hlt, -, hch, hsne⟩ := exists_chain hw.graph A hw.arc hιc + (hinj.mono Ico_subset_Icc_self) (hinj.mono Ioc_subset_Icc_self) (himg ▸ hFg) hstart hfinish + (.inl (by rw [hval0, hval1]; exact hne)) + have hτI : ∀ k ≤ m, τ k ∈ Icc (0 : ℝ) 1 := fun k hk => + ⟨ht0 ▸ chain_mono' hlt (Nat.zero_le k) hk, htm ▸ chain_mono' hlt hk le_rfl⟩ + have hιk : ∀ k ≤ m, ∀ k' ≤ m, extI a (τ k) = extI a (τ k') → k = k' := fun k hk k' hk' he => by + have h1 := hinj (hτI k hk) (hτI k' hk') he + rcases lt_trichotomy k k' with h2 | h2 | h2 + · exact absurd h1 (chain_mono hlt h2 hk').ne + · exact h2 + · exact absurd h1 (chain_mono hlt h2 hk).ne' + have hsF : ∀ p < m, ss p ⊆ range a := fun p hp => by + rw [← (hch p hp).2.1, ← himg] + exact image_mono (Icc_subset_Icc (hτI p hp.le).1 (hτI (p + 1) hp).2) + have hmid : ∀ p < m, edgeMid A (ss p) ∉ bd S₁ := fun p hp hb => by + have hmem : edgeMid A (ss p) ∈ range a ∩ bd S₁ := ⟨hsF p hp (hw.extI_mem (hch p hp).1 _), hb⟩ + rw [hF] at hmem + have hVm : edgeMid A (ss p) ∈ V := by + rcases hmem with h | h + · exact h ▸ hVV (mem_insert_of_mem _ (mem_insert _ _)) + · exact h ▸ hVV (mem_insert _ _) + exact hw.extI_notMem (hch p hp).1 (show (1 / 2 : ℝ) ∈ Ioo (0 : ℝ) 1 by norm_num) hVm + obtain ⟨Y, tY, t2, ψ, h1, h2, h3, h4, h5, h6⟩ := exists_cut_of_chain hw hdn (ι := extI a) (m + := m) (t := τ) (ss := ss) + (ε := ε) (fun p hp => ⟨(hch p hp).1, (hch p hp).2.2⟩) hsne hmid False + (fun k hk k' hk' he => .inl (hιk k hk k' hk' he)) (fun h => h.elim) hm (fun h => h.elim) + (fun _ => ⟨by rw [ht0, hval0]; exact hs, by rw [htm, hval1]; exact ht, fun k hk0 hkm hb => by + have hmem : extI a (τ k) ∈ range a ∩ bd S₁ := ⟨⟨_, rfl⟩, hb⟩ + rw [hF] at hmem + rcases hmem with h | h + · have := hιk k hkm.le 0 (Nat.zero_le _) (by rw [ht0, hval0]; exact h) + omega + · have := hιk k hkm.le m le_rfl (by rw [htm, hval1]; exact h) + omega⟩) (fun h => h.elim) + obtain ⟨X, X', hX⟩ := chain_fold (ψ := ψ) hlt ht0 (fun p hp => (hch p hp).2.1.symm) h6 hm le_rfl + (by rw [htm]; exact hinj) + rw [htm, himg, hval0, hval1] at hX + have hun : ⋃₀ (ss '' Iio m) = range a := by + rw [sUnion_image_Icc_chain (extI a) hm hlt (fun p hp => (hch p hp).2.1), ht0, htm, himg] + rw [hun] at h3 h4 + exact ⟨Y, tY, t2, ψ, h5, ⟨h1, h2, h3, fun x hx => (hX.ncard hx).2, h4⟩, X, X', hX⟩ + +/-- Cutting a connected surface along an `O`-arc off the boundary, by cutting the word of a +dissection. -/ +theorem exists_cut_loop (hS : IsSurface S₁) [ConnectedSpace S₁] {F : Set S₁} (hO : IsOArc F) + (hd : Disjoint F (bd S₁)) : + ∃ (Y : Type u) (_ : TopologicalSpace Y) (_ : T2Space Y) (ψ : Y → S₁), IsSurface Y + ∧ IsCutting ψ F ∧ + ((∃ X X', Disjoint X X' ∧ X ∪ X' = ψ ⁻¹' F ∧ IsOArc X ∧ IsOArc X' ∧ BijOn ψ X F + ∧ BijOn ψ X' F) ∨ IsOArc (ψ ⁻¹' F)) ∧ + ∃ Z₁ Z₂ u c X₁ Y₁ X₂ Y₂, LiftPair ψ Z₁ u c X₁ Y₁ ∧ LiftPair ψ Z₂ c u X₂ Y₂ ∧ Z₁ ∩ Z₂ = {u, c} + ∧ Z₁ ∪ Z₂ = F ∧ u ≠ c ∧ + (ψ ⁻¹' {u}).encard ≤ 2 ∧ (ψ ⁻¹' {c}).encard ≤ 2 := by + classical + obtain ⟨V₁, E₁, hg, hV, hgr⟩ := exists_cuff_graph hS + have hgr1 : gr V₁ E₁ = bd S₁ := by + rw [← hgr] + exact union_eq_right.mpr hV + have hconn : FinConn (F \ gr V₁ E₁) := by + rw [hgr1, hd.sdiff_eq_left] + exact ⟨{F}, finite_singleton _, fun J hJ => by + rw [mem_singleton_iff.mp hJ] + exact hO.isPreconnected, sUnion_singleton _⟩ + obtain ⟨V₂, E₂, hV₂, hg2, hgr2, hno⟩ := hg.add_curve hO hconn + have hno2 := hno hV + obtain ⟨x, y, -, hx, hy, -, hxy, -, -⟩ := hO.exists_three + obtain ⟨E₃, hg3, hgr3, hs3⟩ := hg2.add_point x + obtain ⟨E₄, hg4, hgr4, hs4⟩ := hg3.add_point y + have hE₂ : ⋃₀ E₂ = bd S₁ ∪ F := by + rw [← hgr1, ← hgr2] + exact (union_eq_right.mpr hno2).symm + have hgall : gr (insert y (insert x V₂)) E₄ = bd S₁ ∪ F := by + rw [hgr4, hgr3, hgr2, hgr1, insert_eq_of_mem (a := x) (Or.inr hx : x ∈ bd S₁ ∪ F), + insert_eq_of_mem (a := y) (Or.inr hy : y ∈ bd S₁ ∪ F)] + have hE₄ : ⋃₀ E₄ = bd S₁ ∪ F := by + apply subset_antisymm + · rw [← hgall] + exact subset_union_right + · rw [← hE₂] + exact hs3.trans hs4 + have hfin := (cuff_statement.{u} S₁ hS).2.1 + have hOc := (cuff_statement.{u} S₁ hS).2.2 + have hV₀ : insert y (insert x V₂) ⊆ ⋃₀ E₄ := by + rw [hE₄] + rintro z (rfl | rfl | hz) + · exact .inr hy + · exact .inr hx + · rw [← hE₂] + exact hno2 hz + have hsA : ⋃₀ insert F (cuffs S₁) = bd S₁ ∪ F := by + rw [sUnion_insert, sUnion_cuffs, union_comm] + obtain ⟨V, E, 𝓕, hdis, hVV, hEE⟩ := exists_dissection_with hS hg4 hV₀ (hfin.insert F) + (fun C hC => hC.elim (fun h => h ▸ hO) (hOc C)) (subset_insert _ _) (.inl (by rw [hE₄, hsA])) + obtain ⟨W, f, A, lab, hw, hdn⟩ := exists_word_edges hS hdis + obtain ⟨ι, hιc, hι0, hι1, hinj, hinj', hιim⟩ := hO.exists_iota hx + have hxV : x ∈ V := hVV (mem_insert_of_mem _ (mem_insert _ _)) + have hyV : y ∈ V := hVV (mem_insert _ _) + have hIcc : ι '' Icc 0 1 = F := by + apply subset_antisymm + · rintro _ ⟨z, hz, rfl⟩ + rcases eq_or_lt_of_le hz.2 with rfl | h1 + · rw [hι1] + exact hx + · exact hιim ▸ mem_image_of_mem ι ⟨hz.1, h1⟩ + · exact hιim ▸ image_mono Ico_subset_Icc_self + obtain ⟨x₀, hx₀, hx₀y⟩ : ∃ x₀ ∈ Ioo (0 : ℝ) 1, ι x₀ = y := by + have hy' : y ∈ ι '' Ico 0 1 := hιim ▸ hy + obtain ⟨z, hz, rfl⟩ := hy' + refine ⟨z, ⟨lt_of_le_of_ne hz.1 ?_, hz.2⟩, rfl⟩ + rintro rfl + exact hxy (hι0.symm) + have hFg : ι '' Icc 0 1 ⊆ gr V E := fun z hz => hEE (by + rw [hE₄] + exact .inr (hIcc ▸ hz)) + obtain ⟨m, τ, ss, ε, hm, ht0, htm, hlt, hsort, hch, hsne⟩ := exists_chain hw.graph A hw.arc hιc + hinj hinj' hFg + (by rw [hι0]; exact hxV) (by rw [hι1]; exact hxV) (.inr ⟨x₀, hx₀, hx₀y ▸ hyV⟩) + have hm2 : 2 ≤ m := by + obtain ⟨p, hp, hx₁⟩ := hsort x₀ ⟨hx₀.1.le, hx₀.2.le⟩ (hx₀y ▸ hyV) + by_contra hc + have hm1 : m = 1 := by omega + subst hm1 + interval_cases p + · linarith [hx₀.1] + · linarith [hx₀.2] + have hτI : ∀ k ≤ m, τ k ∈ Icc (0 : ℝ) 1 := fun k hk => + ⟨ht0 ▸ chain_mono' hlt (Nat.zero_le k) hk, htm ▸ chain_mono' hlt hk le_rfl⟩ + have hτlt : ∀ k < m, τ k < 1 := fun k hk => htm ▸ chain_mono hlt hk le_rfl + have hτpos : ∀ k, 0 < k → k ≤ m → 0 < τ k := fun k h0 hk => ht0 ▸ chain_mono hlt h0 hk + have hne : ∀ k k', k < k' → k' ≤ m → τ k ≠ τ k' := fun k k' h hk => (chain_mono hlt h hk).ne + have hιk : ∀ k ≤ m, ∀ k' ≤ m, ι (τ k) = ι (τ k') → k = k' ∨ (True ∧ ((k = 0 ∧ k' = m) ∨ (k = m + ∧ k' = 0))) := by + intro k hk k' hk' he + by_cases h1 : k < m ∧ k' < m + · have h2 := hinj ⟨(hτI k hk).1, hτlt k h1.1⟩ ⟨(hτI k' hk').1, hτlt k' h1.2⟩ he + rcases lt_trichotomy k k' with h3 | h3 | h3 + · exact absurd h2 (hne k k' h3 hk') + · exact .inl h3 + · exact absurd h2.symm (hne k' k h3 hk) + by_cases h4 : 0 < k ∧ 0 < k' + · have h2 := hinj' ⟨hτpos k h4.1 hk, (hτI k hk).2⟩ ⟨hτpos k' h4.2 hk', (hτI k' hk').2⟩ he + rcases lt_trichotomy k k' with h3 | h3 | h3 + · exact absurd h2 (hne k k' h3 hk') + · exact .inl h3 + · exact absurd h2.symm (hne k' k h3 hk) + · have h5 : k = m ∨ k' = m := by omega + have h6 : k = 0 ∨ k' = 0 := by omega + rcases h5 with h5 | h5 <;> rcases h6 with h6 | h6 + · omega + · exact .inr ⟨trivial, .inr ⟨h5, h6⟩⟩ + · exact .inr ⟨trivial, .inl ⟨h6, h5⟩⟩ + · omega + have hsF : ∀ p < m, ss p ⊆ F := fun p hp => by + rw [← (hch p hp).2.1, ← hIcc] + exact image_mono (Icc_subset_Icc (hτI p hp.le).1 (hτI (p + 1) hp).2) + have hmid : ∀ p < m, edgeMid A (ss p) ∉ bd S₁ := fun p hp hb => + Set.disjoint_left.mp hd (hsF p hp (hw.extI_mem (hch p hp).1 _)) hb + have hιF : ∀ k ≤ m, ι (τ k) ∈ F := fun k hk => hIcc ▸ mem_image_of_mem ι (hτI k hk) + obtain ⟨Y, tY, t2, ψ, h1, h2, h3, h4, h5, h6⟩ := exists_cut_of_chain hw hdn (ι := ι) (m := m) (t + := τ) (ss := ss) + (ε := ε) (fun p hp => ⟨(hch p hp).1, (hch p hp).2.2⟩) hsne hmid True hιk (fun _ => hm2) hm + (fun _ k hk hb => Set.disjoint_left.mp hd (hιF k hk) hb) (fun h => absurd trivial h) + (fun _ => by rw [ht0, htm, hι0, hι1]) + have hn : 0 < m - 1 := by omega + have hn1 : m - 1 + 1 = m := by omega + have hsub : Icc 0 (τ (m - 1)) ⊆ Ico (0 : ℝ) 1 := fun z hz => ⟨hz.1, hz.2.trans_lt (hτlt _ + (by omega))⟩ + obtain ⟨X₁, Y₁, h7⟩ := chain_fold (ψ := ψ) hlt ht0 (fun p hp => (hch p hp).2.1.symm) h6 hn + (by omega) (hinj.mono hsub) + obtain ⟨X₂, Y₂, h8⟩ := h6 (m - 1) (by omega) + rw [hn1, htm, hι1, ← hι0, ← (hch (m - 1) (by omega)).2.1, hn1, htm] at h8 + have hc0 : 0 < τ (m - 1) := hτpos _ hn (by omega) + have hc1 : τ (m - 1) < 1 := hτlt _ (by omega) + have hi : ι '' Icc 0 (τ (m - 1)) ∩ ι '' Icc (τ (m - 1)) 1 = {ι 0, ι (τ (m - 1))} := by + ext z + constructor + · rintro ⟨⟨u, hu, rfl⟩, ⟨w, hw', he⟩⟩ + rcases eq_or_lt_of_le hw'.2 with rfl | hw1 + · have h9 : ι u = ι 0 := by rw [← he, hι1, hι0] + have : u = 0 := hinj ⟨hu.1, hu.2.trans_lt hc1⟩ ⟨le_rfl, zero_lt_one⟩ h9 + rw [this] + exact .inl rfl + · have h9 : w = u := hinj ⟨hc0.le.trans hw'.1, hw1⟩ ⟨hu.1, hu.2.trans_lt hc1⟩ he + have : u = τ (m - 1) := le_antisymm hu.2 (h9 ▸ hw'.1) + rw [this] + exact .inr rfl + · rintro (rfl | rfl) + · exact ⟨⟨0, ⟨le_rfl, hc0.le⟩, rfl⟩, ⟨1, ⟨hc1.le, le_rfl⟩, by rw [hι0, hι1]⟩⟩ + · exact ⟨⟨_, ⟨hc0.le, le_rfl⟩, rfl⟩, ⟨_, ⟨le_rfl, hc1.le⟩, rfl⟩⟩ + have hun : ι '' Icc 0 (τ (m - 1)) ∪ ι '' Icc (τ (m - 1)) 1 = F := by + rw [← image_union, Icc_union_Icc_eq_Icc hc0.le hc1.le, hIcc] + have huc : ι 0 ≠ ι (τ (m - 1)) := fun he => by + have := hinj ⟨le_rfl, zero_lt_one⟩ ⟨hc0.le, hc1⟩ he + exact hc0.ne this + have hfu := (h8.ncard (x := ι 0) ⟨1, ⟨hc1.le, le_rfl⟩, by rw [hι0, hι1]⟩).1 + have hfc := (h8.ncard (x := ι (τ (m - 1))) ⟨_, ⟨le_rfl, hc1.le⟩, rfl⟩).1 + have hclose := h7.close h8 hi huc hfu.le hfc.le + rw [hun] at hclose + have hsu : ⋃₀ (ss '' Iio m) = F := by + rw [sUnion_image_Icc_chain ι hm hlt (fun p hp => (hch p hp).2.1), ht0, htm, hIcc] + rw [hsu] at h3 h4 + have hcount : ∀ z ∈ F, (ψ ⁻¹' {z}).ncard = 2 := by + intro z hz + rw [← hun] at hz + rcases hz with hz | hz + · exact (h7.ncard hz).2 + · exact (h8.ncard hz).2 + exact ⟨Y, tY, t2, ψ, h5, ⟨h1, h2, h3, hcount, h4⟩, hclose, _, _, _, _, _, _, _, _, h7, h8, hi, + hun, huc, hfu.le, hfc.le⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutChain.lean b/LeanPool/GraphMinor/Surface/CutChain.lean new file mode 100644 index 0000000000..08a6fc3305 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutChain.lean @@ -0,0 +1,77 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutGraph + +/-! +# Arcs in a graph are chains of edges + +An arc or an `O`-arc inside the union of the edges of a graph is a chain of edges (`exists_chain`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +local notation "𝕀" => unitInterval + +variable {X : Type u} [TopologicalSpace X] [T2Space X] {V : Set X} {E : Set (Set X)} + +/-- A path that is injective, or a loop, in the union of the edges of a graph runs through a chain +of edges. -/ +theorem exists_chain (hg : IsGraph V E) (A : Set X → 𝕀 → X) + (hA : ∀ e ∈ E, IsArcMap (A e) ∧ range (A e) = e ∧ e ∩ V = {A e 0, A e 1}) {ι : ℝ → X} + (hιc : Continuous ι) + (hinj : InjOn ι (Ico 0 1)) (hinj' : InjOn ι (Ioc 0 1)) (hG : ι '' Icc 0 1 ⊆ gr V E) + (h0 : ι 0 ∈ V) (h1 : ι 1 ∈ V) + (hne : ι 0 ≠ ι 1 ∨ ∃ x ∈ Ioo (0 : ℝ) 1, ι x ∈ V) : + ∃ (m : ℕ) (t : ℕ → ℝ) (s : ℕ → Set X) (ε : ℕ → Bool), 0 < m ∧ t 0 = 0 ∧ t m = 1 ∧ + (∀ p < m, t p < t (p + 1)) ∧ + (∀ x ∈ Icc (0 : ℝ) 1, ι x ∈ V → ∃ p ≤ m, x = t p) ∧ + (∀ p < m, s p ∈ E ∧ ι '' Icc (t p) (t (p + 1)) = s p ∧ ι (t p) = extI (A (s p)) + (if ε p then 0 else 1) ∧ + ι (t (p + 1)) = extI (A (s p)) (if ε p then 1 else 0)) ∧ + ∀ p < m, ∀ q < m, p ≠ q → s p ≠ s q := by + obtain ⟨m, t, s, ε, hm, ht0, htm, hlt, hmem, hall, hs⟩ := + hg.exists_edge_intervals A hA hιc hinj hinj' hG h0 h1 hne + refine ⟨m, t, s, ε, hm, ht0, htm, hlt, ?_, hs, ?_⟩ + · intro x hx hxV + obtain ⟨p, hp, e⟩ := hall x ⟨hx, hxV⟩ + exact ⟨p, hp, e.symm⟩ + · have hmono : ∀ p q, p + 1 ≤ q → q ≤ m → t (p + 1) ≤ t q := by + intro p q hpq hq + induction q, hpq using Nat.le_induction with + | base => exact le_rfl + | succ q hq' ih => exact (ih (by omega)).trans (hlt q (by omega)).le + have key2 : ∀ p < m, ∀ q < m, p < q → s p ≠ s q := by + intro p hp q hq hpq he + have hab := hlt p hp + have ha1 := hmem p hp.le + have hb1 := hmem (p + 1) hp + obtain ⟨x, hx⟩ : (Ioo (t p) (t (p + 1))).Nonempty := nonempty_Ioo.mpr hab + have h1 : ι x ∈ s q := by + rw [← he, ← (hs p hp).2.1] + exact mem_image_of_mem ι ⟨hx.1.le, hx.2.le⟩ + rw [← (hs q hq).2.1] at h1 + obtain ⟨y, hy, hxy⟩ := h1 + have hxy2 : x < y := hx.2.trans_le ((hmono p q hpq hq.le).trans hy.1) + have hx0 : 0 < x := ha1.1.1.trans_lt hx.1 + have hy1 : y ≤ 1 := hy.2.trans (hmem _ hq).1.2 + exact hxy2.ne (hinj' ⟨hx0, hx.2.le.trans hb1.1.2⟩ ⟨hx0.trans hxy2, hy1⟩ hxy.symm) + intro p hp q hq hpq + rcases lt_or_gt_of_ne hpq with h | h + · exact key2 p hp q hq h + · exact (key2 q hq p hp h).symm + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutComp.lean b/LeanPool/GraphMinor/Surface/CutComp.lean new file mode 100644 index 0000000000..d2cba6bf95 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutComp.lean @@ -0,0 +1,283 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutGlue +import Mathlib.Topology.LocalAtTarget + +/-! +# Components after cutting + +A surface is locally connected, so its components are open and closed. An open and closed part of a +surface is a surface. +If `ψ` cuts a connected surface along `F`, then each component of the cut surface meets the preimage +of `F`, so there are +at most two components when this preimage has two connected pieces (`cut_comps`). Boundary points +off the preimage of `F` +map to boundary points (`bd_of_bd`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function + +universe u + +section basic + +variable {S : Type u} [TopologicalSpace S] + +theorem IsSurface.locallyConnected (hS : IsSurface S) : LocallyConnectedSpace S := by + rw [locallyConnectedSpace_iff_subsets_isOpen_isConnected] + intro x U hU + obtain ⟨U₀, O, j, k, h1, h2, h3, h4, h5, h6, h7, h8, h9⟩ := (hS.2.2 x).exists_chart + obtain ⟨W, hWU, hW, hxW⟩ := mem_nhds_iff.mp hU + have hjx := h6 h3 + have hk0 : k (j x) = x := h8 h3 + have hcont : ContinuousWithinAt k (O ∩ halfPlane) (j x) := h5 _ hjx + have hW' : k ⁻¹' W ∈ 𝓝[O ∩ halfPlane] j x := hcont.preimage_mem_nhdsWithin (hW.mem_nhds + (by rw [hk0]; exact hxW)) + obtain ⟨r, hr, hsub⟩ := Metric.mem_nhdsWithin_iff.mp hW' + obtain ⟨r', hr', hsub'⟩ := Metric.isOpen_iff.mp h2 _ hjx.1 + set s := min r r' with hs + have hs0 : 0 < s := lt_min hr hr' + have hball : Metric.ball (j x) s ⊆ Metric.ball (j x) r := Metric.ball_subset_ball + (min_le_left _ _) + have hball' : Metric.ball (j x) s ⊆ O := (Metric.ball_subset_ball (min_le_right _ _)).trans hsub' + have hV : U₀ ∩ W ∩ j ⁻¹' Metric.ball (j x) s = k '' (Metric.ball (j x) s ∩ halfPlane) := by + ext z + constructor + · rintro ⟨⟨hz, -⟩, hz2⟩ + exact ⟨j z, ⟨hz2, (h6 hz).2⟩, h8 hz⟩ + · rintro ⟨w, ⟨hw, hw2⟩, rfl⟩ + have hwO : w ∈ O ∩ halfPlane := ⟨hball' hw, hw2⟩ + refine ⟨⟨h7 hwO, hsub ⟨hball hw, hwO⟩⟩, ?_⟩ + change j (k w) ∈ Metric.ball (j x) s + rw [h9 hwO] + exact hw + refine ⟨U₀ ∩ W ∩ j ⁻¹' Metric.ball (j x) s, fun z hz => hWU hz.1.2, ?_, ⟨⟨h3, hxW⟩, + Metric.mem_ball_self hs0⟩, ?_⟩ + · exact (h4.mono inter_subset_left).isOpen_inter_preimage (h1.inter hW) Metric.isOpen_ball + · rw [hV] + have hconv : Convex ℝ (Metric.ball (j x) s ∩ halfPlane) := by + refine (convex_ball _ _).inter ?_ + intro a ha b hb c d hc hd _ + have ha' : 0 ≤ a.re := ha + have hb' : 0 ≤ b.re := hb + change 0 ≤ (c • a + d • b).re + simp only [Complex.add_re, Complex.real_smul, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero] + positivity + refine ⟨⟨k (j x), j x, ⟨Metric.mem_ball_self hs0, hjx.2⟩, rfl⟩, ?_⟩ + exact hconv.isPreconnected.image k (h5.mono fun z hz => ⟨hball' hz.1, hz.2⟩) + +theorem isManifoldPoint_of_embed {x : S} {U : Set S} (hU : IsOpen U) (hx : x ∈ U) {f : U + → EuclideanHalfSpace 2} + (hf : IsOpenEmbedding f) : IsManifoldPoint x := + ⟨U, range f, hU, hf.isOpen_range, hx, ⟨hf.isEmbedding.toHomeomorph⟩⟩ + +variable {W : Set S} + +/-- A point of an open part is a manifold point of this part. -/ +theorem isManifoldPoint_sub (hW : IsOpen W) {x : W} (hx : IsManifoldPoint x.1) : IsManifoldPoint x + := by + obtain ⟨U, V, hU, hV, hxU, ⟨e⟩⟩ := hx + have hU' : IsOpen (Subtype.val ⁻¹' U : Set W) := hU.preimage continuous_subtype_val + let f : (Subtype.val ⁻¹' U : Set W) → EuclideanHalfSpace 2 := fun z => (e ⟨z.1.1, z.2⟩).1 + refine isManifoldPoint_of_embed hU' hxU (f := f) ?_ + have h1 : IsOpenEmbedding (fun z : (Subtype.val ⁻¹' U : Set W) => (⟨z.1.1, z.2⟩ : U)) := by + refine IsOpenEmbedding.of_continuous_injective_isOpenMap (by fun_prop) ?_ ?_ + · rintro ⟨a, ha⟩ ⟨b, hb⟩ h + simpa [Subtype.ext_iff] using h + · intro T hT + obtain ⟨T', hT', rfl⟩ := isOpen_induced_iff.mp hT + obtain ⟨T'', hT'', rfl⟩ := isOpen_induced_iff.mp hT' + refine isOpen_induced_iff.mpr ⟨T'' ∩ W, hT''.inter hW, ?_⟩ + ext ⟨z, hz⟩ + constructor + · rintro ⟨h2, h3⟩ + exact ⟨⟨⟨z, h3⟩, hz⟩, h2, rfl⟩ + · rintro ⟨⟨⟨y, h3⟩, h4⟩, h5, h6⟩ + simp only [Subtype.mk.injEq] at h6 + subst h6 + exact ⟨h5, h3⟩ + exact (hV.isOpenEmbedding_subtypeVal.comp e.isOpenEmbedding).comp h1 + +theorem isSurface_sub (hS : IsSurface S) (hW : IsClopen W) : IsSurface W := by + obtain ⟨h1, h2, h3⟩ := id hS + exact ⟨isCompact_iff_compactSpace.mp hW.1.isCompact, inferInstance, + fun x => isManifoldPoint_sub hW.2 (h3 _)⟩ + +/-- A homeomorphism from the preimage of a subset of an open part. -/ +theorem exists_homeo_sub (U : Set S) (hU : U ⊆ W) : Nonempty ((Subtype.val ⁻¹' U : Set W) ≃ₜ U) + := by + refine ⟨(IsEmbedding.subtypeVal.homeomorphImage (Subtype.val ⁻¹' U : Set W)).trans + (Homeomorph.setCongr ?_)⟩ + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hU] + +theorem isInteriorPoint_sub (hW : IsOpen W) {x : W} : IsInteriorPoint x ↔ IsInteriorPoint x.1 := by + constructor + · rintro ⟨U, hU, hx, ⟨e⟩⟩ + have h1 : Subtype.val ⁻¹' (Subtype.val '' U) = U := preimage_image_eq _ Subtype.val_injective + have h2 : Subtype.val '' U ⊆ W := by + rintro _ ⟨y, -, rfl⟩ + exact y.2 + obtain ⟨e'⟩ := exists_homeo_sub (Subtype.val '' U) h2 + refine ⟨Subtype.val '' U, hW.isOpenMap_subtype_val _ hU, ⟨x, hx, rfl⟩, + ⟨e'.symm.trans ((Homeomorph.setCongr h1).trans e)⟩⟩ + · intro h + obtain ⟨U, hU, hx, hsub, ⟨e⟩⟩ := h.exists_subset hW x.2 + obtain ⟨e'⟩ := exists_homeo_sub U hsub + exact ⟨_, hU.preimage continuous_subtype_val, hx, ⟨e'.trans e⟩⟩ + +theorem mem_bd_sub (hW : IsOpen W) {x : W} : x ∈ bd W ↔ x.1 ∈ bd S := + not_congr (isInteriorPoint_sub hW) + +theorem spaceComponents_eq : spaceComponents S = range connectedComponent := by + ext C + simp [spaceComponents, componentsIn, connectedComponentIn_univ] + +end basic + +section cut + +variable {Y S : Type u} [TopologicalSpace Y] [TopologicalSpace S] [CompactSpace Y] [T2Space S] + {ψ : Y → S} {F : Set S} + +/-- An open and closed part of the cut surface that contains the preimage of `F` is everything. -/ +theorem eq_univ_of_cut [ConnectedSpace S] (hψ : IsCutting ψ F) {W : Set Y} (hW : IsClopen W) + (hne : W.Nonempty) + (hsub : ψ ⁻¹' F ⊆ W) : W = univ := by + obtain ⟨h1, h2, h3, -, -⟩ := hψ + have hc : IsClosed (ψ '' W) := (hW.1.isCompact.image h1).isClosed + have hc' : IsClosed (ψ '' Wᶜ) := (hW.compl.1.isCompact.image h1).isClosed + have hd : Disjoint (ψ '' W) (ψ '' Wᶜ) := by + rw [Set.disjoint_left] + rintro _ ⟨y, hy, rfl⟩ ⟨y', hy', he⟩ + have h4 : y' ∈ ψ ⁻¹' Fᶜ := fun h5 => hy' (hsub h5) + have h5 : y ∈ ψ ⁻¹' Fᶜ := by + change ψ y ∈ Fᶜ + rw [← he] + exact h4 + exact hy' ((h3 h4 h5 he) ▸ hy) + have hu : ψ '' W ∪ ψ '' Wᶜ = univ := by + rw [← image_union, union_compl_self, image_univ, h2.range_eq] + have hcl : IsClopen (ψ '' W) := ⟨hc, by + have h9 : (ψ '' Wᶜ)ᶜ = ψ '' W := (eq_compl_iff_isCompl.mpr (IsCompl.mk hd + (codisjoint_iff.mpr hu))).symm + rw [← h9] + exact hc'.isOpen_compl⟩ + have h6 := hcl.eq_univ (hne.image ψ) + by_contra h7 + obtain ⟨y, hy⟩ := (ne_univ_iff_exists_notMem _).mp h7 + obtain ⟨z, hz, he⟩ : ψ y ∈ ψ '' W := h6 ▸ mem_univ _ + exact Set.disjoint_left.mp hd ⟨z, hz, he⟩ ⟨y, hy, rfl⟩ + +/-- A connected cut surface. -/ +theorem connected_of_cut [ConnectedSpace S] (hψ : IsCutting ψ F) (hS : IsSurface Y) {Q : Set Y} + (hQ : IsPreconnected Q) + (hQe : Q = ψ ⁻¹' F) (hne : Q.Nonempty) : ConnectedSpace Y := by + have := hS.locallyConnected + obtain ⟨x, hx⟩ := hne + have hsub : ψ ⁻¹' F ⊆ connectedComponent x := by + rw [← hQe] + exact hQ.subset_connectedComponent hx + have hu := eq_univ_of_cut hψ ⟨isClosed_connectedComponent, isOpen_connectedComponent⟩ ⟨x, + mem_connectedComponent⟩ hsub + have h1 : IsConnected (univ : Set Y) := hu ▸ isConnected_connectedComponent + exact connectedSpace_iff_univ.mpr h1 + +/-- The surface after cutting has one component, or two components that each hold one lift. -/ +theorem cut_comps [ConnectedSpace S] (hψ : IsCutting ψ F) (hS : IsSurface Y) {X X' : Set Y} + (hX : IsPreconnected X) + (hX' : IsPreconnected X') (hu : X ∪ X' = ψ ⁻¹' F) {x y : Y} (hx : x ∈ X) (hy : y ∈ X') : + ConnectedSpace Y ∨ ∃ W₁ W₂ : Set Y, W₁ ≠ W₂ ∧ spaceComponents Y = {W₁, W₂} ∧ X ⊆ W₁ ∧ X' ⊆ W₂ + ∧ IsClopen W₁ ∧ IsClopen W₂ ∧ + W₁ ∪ W₂ = univ ∧ Disjoint W₁ W₂ ∧ ConnectedSpace W₁ ∧ ConnectedSpace W₂ := by + have := hS.locallyConnected + have h1 : IsClopen (connectedComponent x) := ⟨isClosed_connectedComponent, + isOpen_connectedComponent⟩ + have h2 : IsClopen (connectedComponent y) := ⟨isClosed_connectedComponent, + isOpen_connectedComponent⟩ + have h3 := hX.subset_connectedComponent hx + have h4 := hX'.subset_connectedComponent hy + have hun : connectedComponent x ∪ connectedComponent y = univ := + eq_univ_of_cut hψ (h1.union h2) ⟨x, .inl mem_connectedComponent⟩ (by + rw [← hu] + exact union_subset_union h3 h4) + by_cases he : connectedComponent x = connectedComponent y + · left + rw [← he, union_self] at hun + have h5 : IsConnected (univ : Set Y) := hun ▸ isConnected_connectedComponent + exact connectedSpace_iff_univ.mpr h5 + · right + refine ⟨_, _, he, ?_, h3, h4, h1, h2, hun, connectedComponent_disjoint he, ?_, ?_⟩ + · rw [spaceComponents_eq] + ext C + constructor + · rintro ⟨z, rfl⟩ + rcases (hun ▸ mem_univ z : z ∈ connectedComponent x ∪ connectedComponent y) with hz | hz + · exact .inl (connectedComponent_eq hz).symm + · exact .inr (connectedComponent_eq hz).symm + · rintro (rfl | rfl) + · exact ⟨x, rfl⟩ + · exact ⟨y, rfl⟩ + · exact isConnected_iff_connectedSpace.mp isConnected_connectedComponent + · exact isConnected_iff_connectedSpace.mp isConnected_connectedComponent + +/-- A boundary point off the preimage of `F` maps to a boundary point. -/ +theorem bd_of_bd (hψ : IsCutting ψ F) (hF : IsClosed F) {z : Y} (hz : z ∈ bd Y) + (hzF : ψ z ∉ F) : ψ z ∈ bd S := by + intro hi + apply hz + obtain ⟨h1, h2, h3, -, -⟩ := hψ + obtain ⟨U, hU, hx, hsub, ⟨e⟩⟩ := hi.exists_subset hF.isOpen_compl hzF + have hcl : IsClosedMap ψ := h1.isClosedMap + have hbij : Bijective (U.restrictPreimage ψ) := by + constructor + · rintro ⟨a, ha⟩ ⟨b, hb⟩ he + have he' : ψ a = ψ b := congrArg Subtype.val he + exact Subtype.ext (h3 (fun h => hsub ha h) (fun h => hsub hb h) he') + · rintro ⟨w, hw⟩ + obtain ⟨y, rfl⟩ := h2 w + exact ⟨⟨y, hw⟩, rfl⟩ + have hh : IsHomeomorph (U.restrictPreimage ψ) := + isHomeomorph_iff_continuous_isClosedMap_bijective.mpr ⟨h1.restrictPreimage, + hcl.restrictPreimage U, hbij⟩ + exact ⟨ψ ⁻¹' U, hU.preimage h1, hx, ⟨hh.homeomorph.trans e⟩⟩ + +end cut + +/-- A curve in the boundary, whose inside avoids the preimage of `F`, joins two points of the same +cuff. -/ +theorem same_cuff_of_curve {Y S : Type u} [TopologicalSpace Y] [TopologicalSpace S] [CompactSpace + Y] [T2Space S] + {ψ : Y → S} {F : Set S} (hψ : IsCutting ψ F) (hF : IsClosed F) {γ : ℝ → Y} (hγ : ContinuousOn γ + (Icc 0 1)) + (hb : ∀ u ∈ Icc (0 : ℝ) 1, γ u ∈ bd Y) (hi : ∀ u ∈ Ioo (0 : ℝ) 1, ψ (γ u) ∉ F) (h0 : ψ + (γ 0) ∈ bd S) (h1 : ψ (γ 1) ∈ bd S) : + connectedComponentIn (bd S) (ψ (γ 0)) = connectedComponentIn (bd S) (ψ (γ 1)) := by + have hcont : ContinuousOn (fun u => ψ (γ u)) (Icc 0 1) := hψ.1.comp_continuousOn hγ + have hconn : IsPreconnected ((fun u => ψ (γ u)) '' Icc (0 : ℝ) 1) := isPreconnected_Icc.image _ + hcont + have hs : (fun u => ψ (γ u)) '' Icc (0 : ℝ) 1 ⊆ bd S := by + rintro _ ⟨u, hu, rfl⟩ + rcases eq_or_lt_of_le hu.1 with rfl | h2 + · exact h0 + rcases eq_or_lt_of_le hu.2 with rfl | h3 + · exact h1 + exact bd_of_bd hψ hF (hb u hu) (hi u ⟨h2, h3⟩) + have hz0 : ψ (γ 0) ∈ (fun u => ψ (γ u)) '' Icc (0 : ℝ) 1 := ⟨0, by simp, rfl⟩ + have hz1 : ψ (γ 1) ∈ (fun u => ψ (γ u)) '' Icc (0 : ℝ) 1 := ⟨1, by simp, rfl⟩ + have h2 := hconn.subset_connectedComponentIn hz0 hs hz1 + exact connectedComponentIn_eq h2 + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutConn.lean b/LeanPool/GraphMinor/Surface/CutConn.lean new file mode 100644 index 0000000000..69f34598ee --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutConn.lean @@ -0,0 +1,371 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutWords +public import LeanPool.GraphMinor.Surface.CutArc + +/-! +# Lifts of an arc on the cuffs of a connected cut surface + +Let `S'` arise from `S` by cutting along an arc. The two lifts of the arc lie on cuffs of `S'`. A +word of `S'` has a side for +each cuff (`exists_one_hole`, `exists_two_holes`). We split this side so that the lifts become sides +of the word, and paste +these sides (`glue_word`). The result is a word of `S`. There are two cases: the lifts lie on two +cuffs (`arc_two_holes`) or +on one cuff (`arc_one_hole`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function + +universe uu + +local notation "𝕀" => unitInterval + +/-- Two different points of a turn have different images on the circle. -/ +theorem ee_ne {x y : ℝ} (h : x < y) (h' : y < x + 1) : ee x ≠ ee y := by + intro he + obtain ⟨m, hm⟩ := ee_eq_iff.mp he + have h1 : (m : ℝ) < 0 := by linarith + have h2 : (-1 : ℝ) < m := by linarith + have h3 : m < 0 := by exact_mod_cast h1 + have h4 : -1 < m := by exact_mod_cast h2 + omega + +theorem image_rev {T : Type*} (f : ℝ → T) : (fun u => f (1 - u)) '' Icc 0 1 = f '' Icc 0 1 := by + ext z + constructor + · rintro ⟨u, hu, rfl⟩ + exact ⟨_, rev_mem hu, rfl⟩ + · rintro ⟨u, hu, rfl⟩ + exact ⟨1 - u, rev_mem hu, by simp⟩ + +theorem injOn_rev {T : Type*} {f : ℝ → T} (h : InjOn f (Icc 0 1)) : InjOn (fun u => f (1 - u)) + (Icc 0 1) := by + intro x hx y hy he + have := h (rev_mem hx) (rev_mem hy) he + linarith + +theorem ofs_true (u : ℝ) : ofs true u = u := by simp [ofs] + +theorem ofs_false (u : ℝ) : ofs false u = 1 - u := by simp [ofs] + +/-- A monotone map, or the same map backwards, is increasing. -/ +theorem exists_dir {n : ℝ → ℝ} (hc : ContinuousOn n (Icc 0 1)) (h : StrictMonoOn n (Icc 0 1) + ∨ StrictAntiOn n (Icc 0 1)) + (hi : InjOn (fun u => ee (n u)) (Icc 0 1)) : + ∃ (σ : Bool) (n' : ℝ → ℝ), ContinuousOn n' (Icc 0 1) ∧ StrictMonoOn n' (Icc 0 1) ∧ (∀ u ∈ Icc + (0 : ℝ) 1, n' (ofs σ u) = n u) ∧ + InjOn (fun u => ee (n' u)) (Icc 0 1) := by + rcases h with h | h + · exact ⟨true, n, hc, h, fun u _ => by rw [ofs_true], hi⟩ + · refine ⟨false, fun u => n (1 - u), hc.comp (by fun_prop) fun u hu => rev_mem hu, + fun x hx y hy hxy => ?_, + fun u hu => by simp [ofs_false], injOn_rev hi⟩ + exact h (rev_mem hy) (rev_mem hx) (by linarith) + +theorem inj_of_lift {T : Type*} [TopologicalSpace T] {C : Set T} {φ : Circle ≃ₜ C} {m : ℝ + → ℝ} {ξ : ℝ → T} + (hm : ∀ u ∈ Icc (0 : ℝ) 1, (φ (ee (m u))).1 = ξ u) (hi : InjOn ξ (Icc 0 1)) : InjOn (fun u + => ee (m u)) (Icc 0 1) := by + intro x hx y hy he + simp only at he + exact hi hx hy (by rw [← hm x hx, ← hm y hy, he]) + +section + +variable {Y S : Type uu} [TopologicalSpace Y] [TopologicalSpace S] {ψ : Y → S} {F : Set S} {a₀ : ℝ + → S} {ξ η : ℝ → Y} + +/-- After reversing the arc if needed, the lift `ξ` runs forward around its cuff. -/ +theorem orient_lift (L : ArcLift ψ F a₀ ξ η) {C : Set Y} (φ : Circle ≃ₜ C) (hξ : ∀ u ∈ Icc + (0 : ℝ) 1, ξ u ∈ C) + (hi : InjOn ξ (Icc 0 1)) (hi' : InjOn η (Icc 0 1)) : + ∃ (a' : ℝ → S) (ξ' η' : ℝ → Y) (m : ℝ → ℝ), ArcLift ψ F a' ξ' η' ∧ ((a' 0 = a₀ 0 ∧ a' 1 = a₀ 1) + ∨ (a' 0 = a₀ 1 ∧ a' 1 = a₀ 0)) ∧ + ξ' '' Icc 0 1 = ξ '' Icc 0 1 ∧ η' '' Icc 0 1 = η '' Icc 0 1 ∧ InjOn ξ' (Icc 0 1) ∧ InjOn η' + (Icc 0 1) ∧ + ContinuousOn m (Icc 0 1) ∧ StrictMonoOn m (Icc 0 1) ∧ ∀ u ∈ Icc (0 : ℝ) 1, (φ (ee (m u))).1 + = ξ' u := by + obtain ⟨m, h1, h2⟩ := exists_lift φ L.cξ hξ + rcases lift_mono h1 (inj_of_lift h2 hi) with h3 | h3 + · exact ⟨a₀, ξ, η, m, L, .inl ⟨rfl, rfl⟩, rfl, rfl, hi, hi', h1, h3, h2⟩ + · refine ⟨_, _, _, fun u => m (1 - u), L.rev, .inr ⟨by simp, by simp⟩, image_rev ξ, + image_rev η, injOn_rev hi, injOn_rev hi', + h1.comp (by fun_prop) fun u hu => rev_mem hu, fun x hx y hy hxy => h3 (rev_mem hy) + (rev_mem hx) (by linarith), + fun u hu => h2 _ (rev_mem hu)⟩ + +variable [T2Space Y] [T2Space S] + +omit [T2Space Y] in +/-- The two lifts of a line, as paths. -/ +theorem exists_arcPart {X X' : Set Y} {s t : S} (h : LiftPair ψ F s t X X') (hcψ : Continuous ψ) : + ∃ (a : ℝ → S) (ξ η : ℝ → Y), ContinuousOn ξ (Icc 0 1) ∧ ContinuousOn η (Icc 0 1) ∧ (∀ u ∈ Icc + (0 : ℝ) 1, ψ (ξ u) = a u) ∧ + (∀ u ∈ Icc (0 : ℝ) 1, ψ (η u) = a u) ∧ a '' Icc 0 1 = F ∧ + (∀ y y', ψ y = ψ y' → y ≠ y' → ψ y ∈ F → ∃ u ∈ Icc (0 : ℝ) 1, (y = ξ u ∧ y' = η u) ∨ (y' + = ξ u ∧ y = η u)) ∧ + a 0 = s ∧ a 1 = t ∧ ξ '' Icc 0 1 = X ∧ η '' Icc 0 1 = X' ∧ InjOn ξ (Icc 0 1) ∧ InjOn η + (Icc 0 1) ∧ InjOn a (Icc 0 1) := by + obtain ⟨x0, x1, y0, y1, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ := h + obtain ⟨b, hb, hbr, hb0, hb1⟩ := h1.exists_arc + have hne : Nonempty Y := ⟨x0⟩ + obtain ⟨ψ', hψ'c, hψ'⟩ := exists_inv_of_compactOn h2.isCompact hcψ.continuousOn h6.injOn + have him : ψ '' X' = F := h6.image_eq + have hξ : ContinuousOn (extI b) (Icc 0 1) := (continuous_extI hb.1).continuousOn + have hξX : ∀ u ∈ Icc (0 : ℝ) 1, extI b u ∈ X := fun u hu => by + rw [← hbr, extI_of_mem b hu] + exact ⟨_, rfl⟩ + have hc1 : ContinuousOn (fun u => ψ (extI b u)) (Icc 0 1) := hcψ.comp_continuousOn hξ + have hc2 : ContinuousOn (fun u => ψ' (ψ (extI b u))) (Icc 0 1) := + hψ'c.comp hc1 fun u hu => by + rw [him] + exact h5.mapsTo (hξX u hu) + have hηX : ∀ u ∈ Icc (0 : ℝ) 1, ψ' (ψ (extI b u)) ∈ X' ∧ ψ (ψ' (ψ (extI b u))) = ψ (extI b u) + := fun u hu => by + obtain ⟨y, hy, he⟩ := h6.surjOn (h5.mapsTo (hξX u hu)) + rw [← he, hψ' hy] + exact ⟨hy, rfl⟩ + have hzero : extI b 0 = x0 := by + rw [extI_of_mem b (by simp : (0 : ℝ) ∈ Icc (0 : ℝ) 1)] + exact hb0 + have hone : extI b 1 = x1 := by + rw [extI_of_mem b (by simp : (1 : ℝ) ∈ Icc (0 : ℝ) 1)] + exact hb1 + have himξ : extI b '' Icc 0 1 = X := by rw [image_extI, hbr] + have hinjξ := extI_injOn hb.2 + refine ⟨fun u => ψ (extI b u), extI b, fun u => ψ' (ψ (extI b u)), hξ, hc2, fun u _ => rfl, + fun u hu => (hηX u hu).2, ?_, ?_, + by simp only [hzero, h7], by simp only [hone, h9], himξ, ?_, hinjξ, ?_, ?_⟩ + · rw [← h5.image_eq, ← himξ, image_image] + · intro y y' he hne' hy + have m1 : y ∈ X ∪ X' := by + rw [h4] + exact hy + have m2 : y' ∈ X ∪ X' := by + rw [h4] + change ψ y' ∈ F + rw [← he] + exact hy + have key : ∀ z ∈ X, ∀ z' ∈ X', ψ z = ψ z' → ∃ u ∈ Icc (0 : ℝ) 1, z = extI b u ∧ z' = ψ' (ψ + (extI b u)) := by + intro z hz z' hz' he' + obtain ⟨u, hu, rfl⟩ := himξ.symm.subset hz + exact ⟨u, hu, rfl, by rw [he', hψ' hz']⟩ + rcases m1 with m1 | m1 <;> rcases m2 with m2 | m2 + · exact absurd (h5.injOn m1 m2 he) hne' + · obtain ⟨u, hu, h11, h12⟩ := key y m1 y' m2 he + exact ⟨u, hu, .inl ⟨h11, h12⟩⟩ + · obtain ⟨u, hu, h11, h12⟩ := key y' m2 y m1 he.symm + exact ⟨u, hu, .inr ⟨h11, h12⟩⟩ + · exact absurd (h6.injOn m1 m2 he) hne' + · ext z + constructor + · rintro ⟨u, hu, rfl⟩ + exact (hηX u hu).1 + · intro hz + obtain ⟨y, hy, he⟩ := h5.surjOn (h6.mapsTo hz) + obtain ⟨u, hu, rfl⟩ := himξ.symm.subset hy + refine ⟨u, hu, ?_⟩ + change ψ' (ψ (extI b u)) = z + rw [he, hψ' hz] + · intro u hu v hv he + have h11 : ψ (extI b u) = ψ (extI b v) := by + rw [← (hηX u hu).2, ← (hηX v hv).2] + exact congrArg ψ he + exact hinjξ hu hv (h5.injOn (hξX u hu) (hξX v hv) h11) + · intro u hu v hv he + exact hinjξ hu hv (h5.injOn (hξX u hu) (hξX v hv) he) + +omit [T2Space Y] in +/-- The two lifts of an arc, as paths. -/ +theorem exists_arcLift {X X' : Set Y} {s t : S} (h : LiftPair ψ F s t X X') (hψ : IsCutting ψ F) : + ∃ (a : ℝ → S) (ξ η : ℝ → Y), ArcLift ψ F a ξ η ∧ a 0 = s ∧ a 1 = t ∧ ξ '' Icc 0 1 = X + ∧ η '' Icc 0 1 = X' ∧ + InjOn ξ (Icc 0 1) ∧ InjOn η (Icc 0 1) := by + obtain ⟨a, ξ, η, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, -⟩ := exists_arcPart h hψ.1 + refine ⟨a, ξ, η, ⟨h1, h2, h3, h4, h5, fun y y' he hne => ?_⟩, h7, h8, h9, h10, h11, h12⟩ + by_cases hy : ψ y ∈ F + · exact h6 y y' he hne hy + · exact absurd (hψ.2.2.1 hy (show ψ y' ∈ Fᶜ from he ▸ hy) he) hne + +end + +theorem cnt_rW_zero {a b c k : ℕ} {L : List ℕ} (h1 : 2 * a + b ≤ k) (h2 : k ≠ 2 * a + b + 2 * c) + (h3 : ∀ m ∈ L, k ≠ 2 * a + b + 2 * m ∧ k ≠ 2 * a + b + 2 * m + 1) : cnt (rW a b c L) k = 0 := + noLab_iff_cnt.mp (noLab_rW h1 h2 h3) + +/-- Counts labels in an explicit word whose tail has known counts. -/ +local macro "ct" : tactic => + `(tactic| ((try simp only [hB, holB, List.cons_append, List.nil_append, List.append_assoc, + cnt_append, cnt_cons, cnt_nil, tL, rL, frL, linv, Prod.fst, *]); (try split_ifs) <;> omega)) + +section + +variable {Y S : Type uu} [TopologicalSpace Y] [T2Space Y] [TopologicalSpace S] {ψ : Y + → S} {F : Set S} {a₀ : ℝ → S} {ξ η : ℝ → Y} + {a b c i j : ℕ} {L : List ℕ} + +/-- The lifts lie on two cuffs. -/ +theorem arc_two_aux (hS : IsSurface Y) (L₀ : ArcLift ψ F a₀ ξ η) (hψc : Continuous ψ) + (hsurj : Surjective ψ) {C C' : Set Y} + (hC : IsCuff C) (hC' : IsCuff C') (hcl : IsClosed C) (hcl' : IsClosed C') (hd : Disjoint C C') + (φ : Circle ≃ₜ C) (φ' : Circle ≃ₜ C') + (hij : i ≠ j) (hi : i < c) (hj : j < c) (hL : ∀ m ∈ L, m < c ∧ m ≠ i ∧ m ≠ j) {g₀ : ℕ × ℂ → Y} + (hg : Presents (sW (hB a b j ++ (hB a b i ++ rW a b c L))) g₀) + (h1 : SideVal (sW (hB a b j ++ (hB a b i ++ rW a b c L))) g₀ (rL a b i).1 fun u => (φ (ee u)).1) + (h2 : SideVal (sW (hB a b j ++ (hB a b i ++ rW a b c L))) g₀ (rL a b j).1 fun u => (φ' + (ee u)).1) + {m : ℝ → ℝ} (hmc : ContinuousOn m (Icc 0 1)) (hmm : StrictMonoOn m (Icc 0 1)) (hmξ : ∀ u ∈ Icc + (0 : ℝ) 1, (φ (ee (m u))).1 = ξ u) + (hη : ∀ u ∈ Icc (0 : ℝ) 1, η u ∈ C') (hiξ : InjOn ξ (Icc 0 1)) (hiη : InjOn η (Icc 0 1)) : + ∃ (σ : Bool) (g : ℕ × ℂ → Y), Presents (sW (blkA a b c i j σ ++ rW a b c L)) (ψ ∘ g) ∧ + SideVal (sW (blkA a b c i j σ ++ rW a b c L)) (ψ ∘ g) (rL a b i).1 a₀ := by + obtain ⟨n, n1, n2⟩ := exists_lift φ' L₀.cη hη + obtain ⟨σ, n', c', s', h3, h4⟩ := exists_dir n1 (lift_mono n1 (inj_of_lift n2 hiη)) + (inj_of_lift n2 hiη) + have hlt := lift_lt_add_one hmc (inj_of_lift hmξ hiξ) + have hlt' := lift_lt_add_one c' h4 + have c1 : cnt (rW a b c L) (2 * a + b + 2 * i + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL m hm + omega + have c2 : cnt (rW a b c L) (2 * a + b + 2 * j + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL m hm + omega + have c3 : cnt (rW a b c L) (2 * a + b + 2 * c + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL m hm + omega + have c4 : cnt (rW a b c L) (2 * a + b + 2 * c + 1 + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL m hm + omega + have e0 : hB a b j ++ (hB a b i ++ rW a b c L) = (hB a b j ++ [tL a b i]) ++ + ((rL a b i).1, true) :: (linv (tL a b i) :: rW a b c L) := by + simp [hB, holB, rL] + rw [e0] at hg h1 h2 + obtain ⟨g₁, p1, p2, -, p3⟩ := exists_pieces2 hS hC hcl'.isOpen_compl + (subset_compl_iff_disjoint_right.mpr hd) φ (q := frL a b c) + (by simp [rL, frL]; omega) (noLab_iff_cnt.mpr (by ct)) (noLab_iff_cnt.mpr (by ct)) hg h1 hmc + (continuousOn_lin _ _) hmm (strictMonoOn_lin hlt) + (lin_zero _ _).symm (lin_one _ _) + have p4 := p3 (rL a b j).1 (by simp [rL]; omega) (by simp [rL, frL]; omega) _ h2 fun u _ h => h + (φ' _).2 + have e1 : (hB a b j ++ [tL a b i]) ++ ((rL a b i).1, true) :: (frL a b c, true) :: (linv + (tL a b i) :: rW a b c L) = + [tL a b j] ++ ((rL a b j).1, true) :: (linv (tL a b j) :: tL a b i :: rL a b i :: + (frL a b c, true) :: linv (tL a b i) :: rW a b c L) := by + simp [hB, holB, rL] + rw [e1] at p1 p2 p4 + obtain ⟨g₂, p5, p6, -, p7⟩ := exists_pieces2 hS hC' hcl.isOpen_compl + (subset_compl_iff_disjoint_left.mpr hd) φ' (q := frL a b c + 1) + (by simp [rL, frL]; omega) (noLab_iff_cnt.mpr (by ct)) (noLab_iff_cnt.mpr (by ct)) p1 p4 c' + (continuousOn_lin _ _) s' (strictMonoOn_lin hlt') + (lin_zero _ _).symm (lin_one _ _) + have p8 := p7 (rL a b i).1 (by simp [rL]; omega) (by simp [rL, frL]; omega) _ p2 fun u _ h => h + (φ _).2 + obtain ⟨h5, h6⟩ := glue_word (p₁ := 5) L₀ hψc hsurj (A := [tL a b j]) (q := (rL a b j).1) (p := + (rL a b i).1) (σ := σ) rfl (by simp) + (by ct) (by ct) p5 (p8.congr hmξ) (ζ := fun u => (φ' (ee (n' u))).1) p6 + (fun u hu => by simp only [h3 u hu]; exact n2 u hu) + exact ⟨σ, g₂, h5, h6⟩ + +/-- The lifts lie on one cuff. -/ +theorem arc_one_aux (hS : IsSurface Y) (L₀ : ArcLift ψ F a₀ ξ η) (hψc : Continuous ψ) + (hsurj : Surjective ψ) {C : Set Y} + (hC : IsCuff C) (φ : Circle ≃ₜ C) (hi : i < c) (hL : ∀ m ∈ L, m < c ∧ m ≠ i) {g₀ : ℕ × ℂ → Y} + (hg : Presents (sW (hB a b i ++ rW a b c L)) g₀) + (h1 : SideVal (sW (hB a b i ++ rW a b c L)) g₀ (rL a b i).1 fun u => (φ (ee u)).1) + {m : ℝ → ℝ} (hmc : ContinuousOn m (Icc 0 1)) (hmm : StrictMonoOn m (Icc 0 1)) (hmξ : ∀ u ∈ Icc + (0 : ℝ) 1, (φ (ee (m u))).1 = ξ u) + (hη : ∀ u ∈ Icc (0 : ℝ) 1, η u ∈ C) (hiξ : InjOn ξ (Icc 0 1)) (hiη : InjOn η (Icc 0 1)) + (hdj : ∀ u ∈ Icc (0 : ℝ) 1, ∀ v ∈ Icc (0 : ℝ) 1, ξ u ≠ η v) : + ∃ (σ : Bool) (g : ℕ × ℂ → Y), Presents (sW (blkB a b c i σ ++ rW a b c L)) (ψ ∘ g) ∧ + SideVal (sW (blkB a b c i σ ++ rW a b c L)) (ψ ∘ g) (rL a b i).1 a₀ ∧ + ∃ p q : ℝ, p < q ∧ (φ (ee p)).1 = ξ 1 ∧ (φ (ee q)).1 = η (ofs σ 0) ∧ + ∀ v ∈ Ioo p q, (∀ u ∈ Icc (0 : ℝ) 1, (φ (ee v)).1 ≠ ξ u ∧ (φ (ee v)).1 ≠ η u) := by + obtain ⟨n, n1, n2⟩ := exists_lift φ L₀.cη hη + obtain ⟨σ, n', c', s', h3, h4⟩ := exists_dir n1 (lift_mono n1 (inj_of_lift n2 hiη)) + (inj_of_lift n2 hiη) + have hlt := lift_lt_add_one hmc (inj_of_lift hmξ hiξ) + have h0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have h1' : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hn' : ∀ v ∈ Icc (0 : ℝ) 1, (φ (ee (n' v))).1 = η (ofs σ v) := fun v hv => by + rw [← n2 _ (ofs_mem hv), ← h3 _ (ofs_mem hv), ofs_ofs] + obtain ⟨k, hk1, hk2⟩ := exists_shift hmc c' + fun u hu v hv he => hdj u hu _ (ofs_mem hv) (by rw [← hmξ u hu, he, hn' v hv]) + have c1 : cnt (rW a b c L) (2 * a + b + 2 * i + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL m hm + omega + have c3 : cnt (rW a b c L) (2 * a + b + 2 * c + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL m hm + omega + have c4 : cnt (rW a b c L) (2 * a + b + 2 * c + 1 + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL m hm + omega + have c5 : cnt (rW a b c L) (2 * a + b + 2 * c + 1 + 2) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL m hm + omega + have e0 : hB a b i ++ rW a b c L = [tL a b i] ++ ((rL a b i).1, true) :: (linv + (tL a b i) :: rW a b c L) := by + simp [hB, holB, rL] + rw [e0] at hg h1 + have hcm2 : ContinuousOn (fun u => n' u + (k : ℝ)) (Icc 0 1) := c'.add continuousOn_const + have hsm2 : StrictMonoOn (fun u => n' u + (k : ℝ)) (Icc 0 1) := fun x hx y hy hxy => by + have := s' hx hy hxy + simp only + linarith + have hn2 : ∀ v ∈ Icc (0 : ℝ) 1, (φ (ee (n' v + k))).1 = η (ofs σ v) := fun v hv => by + rw [ee_add_int, hn' v hv] + obtain ⟨g₁, p1, p2, p3, p4, p5⟩ := exists_pieces4 (U := univ) hS hC isOpen_univ (subset_univ _) φ + (q₁ := frL a b c) (q₂ := frL a b c + 1) + (q₃ := frL a b c + 2) (by simp [rL, frL]; omega) (by simp [rL, frL]; omega) + (by simp [rL, frL]; omega) (by omega) (by omega) (by omega) + (noLab_iff_cnt.mpr (by ct)) (noLab_iff_cnt.mpr (by ct)) (noLab_iff_cnt.mpr (by ct)) + (noLab_iff_cnt.mpr (by ct)) hg h1 + hmc (continuousOn_lin _ _) hcm2 (continuousOn_lin _ _) hmm (strictMonoOn_lin hk1) hsm2 + (strictMonoOn_lin hk2) + (lin_zero _ _).symm (lin_one _ _) (lin_zero _ _).symm (lin_one _ _) + obtain ⟨h5, h6⟩ := glue_word (p₁ := 1) L₀ hψc hsurj (A := [tL a b i, rL a b i, + (frL a b c, true)]) (q := frL a b c + 1) (p := (rL a b i).1) + (B := (frL a b c + 2, true) :: linv (tL a b i) :: rW a b c L) (σ := σ) rfl (by simp) + (by ct) (by ct) p1 (p2.congr hmξ) p4 + (fun u hu => by simp only [hn2 _ (ofs_mem hu), ofs_ofs]) + refine ⟨σ, g₁, h5, h6, m 1, n' 0 + k, hk1, hmξ 1 h1', hn2 0 h0, fun v hv u hu => ⟨fun he => ?_, + fun he => ?_⟩⟩ + · have h7 : (φ (ee v)) = φ (ee (m u)) := Subtype.ext (he.trans (hmξ u hu).symm) + have h8 := φ.injective h7 + have h9 := hmm.monotoneOn hu h1' hu.2 + have h10 := hmm.monotoneOn h0 hu hu.1 + have h11 := s'.monotoneOn h0 h1' zero_le_one + exact ee_ne (x := m u) (y := v) (by linarith [hv.1]) (by linarith [hv.2]) h8.symm + · have h7 : (φ (ee v)) = φ (ee (n' (ofs σ u) + k)) := Subtype.ext (by rw [he, hn2 _ + (ofs_mem hu), ofs_ofs]) + have h8 := φ.injective h7 + have hm' : ofs σ u ∈ Icc (0 : ℝ) 1 := ofs_mem hu + have h9 := s'.monotoneOn hm' h1' hm'.2 + have h10 := s'.monotoneOn h0 hm' hm'.1 + have h11 := hmm.monotoneOn h0 h1' zero_le_one + exact ee_ne (x := v) (y := n' (ofs σ u) + k) (by linarith [hv.2]) (by linarith [hv.1]) h8 + +end + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutCyl.lean b/LeanPool/GraphMinor/Surface/CutCyl.lean new file mode 100644 index 0000000000..a5f4f878ae --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutCyl.lean @@ -0,0 +1,495 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutLoop + +/-! +# The model with two holes is a cylinder + +The unit disc with four sides is mapped onto the closed cylinder as follows. The radial map `nu` +sends the unit disc to the +square `|x| + |y| ≤ 1`, and sends the four arcs of the unit circle to the four sides of this square. +Two opposite sides are +pasted to give a cylinder. This shows that the word `t r t⁻¹ r'` presents the cylinder +(`presents_cyl`), and its normal form +is `Σ(0, 0, 2)` (`nonempty_cyl_homeo`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function + +universe uu + +/-- The `ℓ¹` norm. -/ +noncomputable def nn (z : ℂ) : ℝ := |z.re| + |z.im| + +theorem nn_nonneg (z : ℂ) : 0 ≤ nn z := by + unfold nn + positivity + +theorem norm_le_nn (z : ℂ) : ‖z‖ ≤ nn z := Complex.norm_le_abs_re_add_abs_im z + +theorem nn_pos {z : ℂ} (h : z ≠ 0) : 0 < nn z := (norm_pos_iff.mpr h).trans_le (norm_le_nn z) + +theorem continuous_nn : Continuous nn := by + unfold nn + fun_prop + +theorem nn_smul {c : ℝ} (hc : 0 ≤ c) (z : ℂ) : nn ((c : ℂ) * z) = c * nn z := by + simp only [nn, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero, + Complex.mul_im, add_zero, abs_mul, abs_of_nonneg hc] + ring + +theorem norm_smul' {c : ℝ} (hc : 0 ≤ c) (z : ℂ) : ‖(c : ℂ) * z‖ = c * ‖z‖ := by + rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg hc] + +/-- The radial map from the round disc to the square. -/ +noncomputable def nu (z : ℂ) : ℂ := ((‖z‖ / nn z : ℝ) : ℂ) * z + +/-- The radial map from the square to the round disc. -/ +noncomputable def mu (w : ℂ) : ℂ := ((nn w / ‖w‖ : ℝ) : ℂ) * w + +theorem nu_zero : nu 0 = 0 := by simp [nu] + +theorem nn_nu (z : ℂ) : nn (nu z) = ‖z‖ := by + by_cases h : z = 0 + · subst h + simp [nu_zero, nn] + · have h1 := nn_pos h + rw [nu, nn_smul (by positivity)] + field_simp + +theorem mu_nu (z : ℂ) : mu (nu z) = z := by + by_cases h : z = 0 + · subst h + simp [nu_zero, mu] + · have h1 := nn_pos h + have h2 := norm_pos_iff.mpr h + have hc : 0 < ‖z‖ / nn z := by positivity + rw [mu, nn_nu, nu, norm_smul' hc.le, ← mul_assoc, ← Complex.ofReal_mul] + have e : ‖z‖ / (‖z‖ / nn z * ‖z‖) * (‖z‖ / nn z) = 1 := by field_simp + rw [e] + simp + +theorem nu_mu (w : ℂ) : nu (mu w) = w := by + by_cases h : w = 0 + · subst h + simp [nu_zero, mu] + · have h1 := nn_pos h + have h2 := norm_pos_iff.mpr h + have hc : 0 < nn w / ‖w‖ := by positivity + rw [nu, mu, norm_smul' hc.le, nn_smul hc.le, ← mul_assoc, ← Complex.ofReal_mul] + have e : nn w / ‖w‖ * ‖w‖ / (nn w / ‖w‖ * nn w) * (nn w / ‖w‖) = 1 := by field_simp + rw [e] + simp + +theorem norm_mu (w : ℂ) : ‖mu w‖ = nn w := by + by_cases h : w = 0 + · subst h + simp [mu, nn] + · have h1 := nn_pos h + have h2 := norm_pos_iff.mpr h + rw [mu, norm_smul' (by positivity)] + field_simp + +theorem nu_injective : Injective nu := fun z z' he => by + rw [← mu_nu z, he, mu_nu] + +theorem continuous_nu : Continuous nu := by + rw [continuous_iff_continuousAt] + intro z + by_cases h : z = 0 + · subst h + have h1 : Filter.Tendsto nu (𝓝 0) (𝓝 0) := by + have hnorm : Filter.Tendsto (fun z : ℂ => ‖z‖) (𝓝 0) (𝓝 0) := by + simpa only [norm_zero] using (continuous_norm (E := ℂ)).tendsto (0 : ℂ) + refine squeeze_zero_norm (a := fun z : ℂ => ‖z‖) (fun z => ?_) hnorm + by_cases hz : z = 0 + · subst hz + simp [nu_zero] + · have h2 := nn_pos hz + have h3 := norm_pos_iff.mpr hz + rw [nu, norm_smul' (by positivity), div_mul_eq_mul_div, div_le_iff₀ h2] + exact mul_le_mul_of_nonneg_left (norm_le_nn z) h3.le + unfold ContinuousAt + rwa [nu_zero] + · have h1 := (nn_pos h).ne' + unfold nu + have h2 : ContinuousAt (fun z : ℂ => ‖z‖ / nn z) z := continuous_norm.continuousAt.div + continuous_nn.continuousAt h1 + exact (Complex.continuous_ofReal.continuousAt.comp h2).mul continuousAt_id + +/-- The reflection that swaps two sides of the square. -/ +def refl' (z : ℂ) : ℂ := ⟨-z.im, -z.re⟩ + +theorem nn_refl (z : ℂ) : nn (refl' z) = nn z := by + simp only [nn, refl', abs_neg] + ring + +theorem norm_refl (z : ℂ) : ‖refl' z‖ = ‖z‖ := by + rw [Complex.norm_def, Complex.norm_def, Complex.normSq_apply, Complex.normSq_apply] + simp only [refl'] + congr 1 + ring + +theorem nu_refl (z : ℂ) : nu (refl' z) = refl' (nu z) := by + simp only [nu, norm_refl, nn_refl] + apply Complex.ext <;> simp [refl'] + +/-- The cylinder coordinate along the axis. -/ +noncomputable def cylR (z : ℂ) : ℝ := 3 / 2 + ((nu z).re - (nu z).im) / 2 + +/-- The cylinder coordinate around the axis. -/ +noncomputable def cylS (z : ℂ) : ℝ := (nu z).re + (nu z).im + +theorem abs_add_le_nn (w : ℂ) : |w.re + w.im| ≤ nn w := abs_add_le _ _ + +theorem abs_sub_le_nn (w : ℂ) : |w.re - w.im| ≤ nn w := abs_sub _ _ + +theorem cylR_mem {z : ℂ} (hz : ‖z‖ ≤ 1) : cylR z ∈ Icc (1 : ℝ) 2 := by + have h1 := abs_sub_le_nn (nu z) + rw [nn_nu] at h1 + have h2 := abs_le.mp (h1.trans hz) + unfold cylR + constructor <;> linarith [h2.1, h2.2] + +theorem cylS_mem {z : ℂ} (hz : ‖z‖ ≤ 1) : cylS z ∈ Icc (-1 : ℝ) 1 := by + have h1 := abs_add_le_nn (nu z) + rw [nn_nu] at h1 + exact abs_le.mp (h1.trans hz) + +/-- The map from the plane onto the cylinder. -/ +noncomputable def cylG (z : ℂ) : ClosedCylinder := + ⟨(max 1 (min 2 (cylR z)), ee (cylS z / 2)), ⟨le_max_left _ _, max_le (by norm_num) + (min_le_left _ _)⟩, mem_univ _⟩ + +theorem cylG_fst {z : ℂ} (hz : ‖z‖ ≤ 1) : (cylG z).1.1 = cylR z := by + have := cylR_mem hz + simp only [cylG] + rw [min_eq_right this.2, max_eq_right this.1] + +theorem cylG_snd (z : ℂ) : (cylG z).1.2 = ee (cylS z / 2) := rfl + +theorem continuous_cylG : Continuous cylG := by + have h1 : Continuous cylR := by + unfold cylR + have := continuous_nu + fun_prop + have h2 : Continuous cylS := by + unfold cylS + have := continuous_nu + fun_prop + refine Continuous.subtype_mk ?_ _ + exact (continuous_const.max (continuous_const.min h1)).prodMk (continuous_ee.comp + (h2.div_const 2)) + +theorem cylG_surj (y : ClosedCylinder) : ∃ z : ℂ, ‖z‖ ≤ 1 ∧ cylG z = y := by + obtain ⟨⟨r, θ⟩, hr, -⟩ := y + obtain ⟨x, rfl⟩ := ee_surjective θ + /- Choose `x` so that the coordinate `s = 2 * x` lies in `[-1, 1]`. -/ + obtain ⟨k, hk⟩ : ∃ k : ℤ, x - k ∈ Icc (-(1 / 2) : ℝ) (1 / 2) := by + refine ⟨⌊x + 1 / 2⌋, ?_, ?_⟩ + · linarith [Int.floor_le (x + 1 / 2)] + · linarith [Int.lt_floor_add_one (x + 1 / 2)] + set s := 2 * (x - k) with hs + have hs1 : s ∈ Icc (-1 : ℝ) 1 := ⟨by linarith [hk.1], by linarith [hk.2]⟩ + set d := 2 * r - 3 with hd + have hd1 : d ∈ Icc (-1 : ℝ) 1 := ⟨by linarith [hr.1], by linarith [hr.2]⟩ + let w : ℂ := ⟨(s + d) / 2, (s - d) / 2⟩ + have hw : nn w ≤ 1 := by + simp only [nn, w] + rcases abs_cases ((s + d) / 2) with h1 | h1 <;> rcases abs_cases ((s - d) / 2) with h2 | h2 <;> + linarith [hs1.1, hs1.2, hd1.1, hd1.2] + refine ⟨mu w, by rw [norm_mu]; exact hw, ?_⟩ + have hz : ‖mu w‖ ≤ 1 := by rw [norm_mu]; exact hw + apply Subtype.ext + apply Prod.ext + · rw [cylG_fst hz] + simp only [cylR, nu_mu, w] + linarith + · rw [cylG_snd] + simp only [cylS, nu_mu, w] + rw [← ee_add_int x (-k), show (s + d) / 2 + (s - d) / 2 = s by ring] + congr 1 + rw [hs] + push_cast + ring + +theorem cylS_refl (z : ℂ) : cylS (refl' z) = - cylS z := by + unfold cylS + rw [nu_refl] + simp only [refl'] + ring + +theorem cylR_refl (z : ℂ) : cylR (refl' z) = cylR z := by + unfold cylR + rw [nu_refl] + simp only [refl'] + ring + +theorem refl_refl (z : ℂ) : refl' (refl' z) = z := by + apply Complex.ext <;> simp [refl'] + +/-- The two sides of the square that are pasted. -/ +theorem per_refl {t : ℝ} : per 4 (3 - t) = refl' (per 4 t) := by + have e : (2 : ℝ) * Real.pi * (3 - t) / (4 : ℕ) = 3 * Real.pi / 2 - Real.pi * t / 2 := by + push_cast + ring + have e' : (2 : ℝ) * Real.pi * t / (4 : ℕ) = Real.pi * t / 2 := by + push_cast + ring + simp only [per, cis', refl', e, e'] + have hc : Real.cos (3 * Real.pi / 2) = 0 := by + rw [show 3 * Real.pi / 2 = Real.pi / 2 + Real.pi by ring, Real.cos_add_pi, Real.cos_pi_div_two] + simp + have hs : Real.sin (3 * Real.pi / 2) = -1 := by + rw [show 3 * Real.pi / 2 = Real.pi / 2 + Real.pi by ring, Real.sin_add_pi, Real.sin_pi_div_two] + apply Complex.ext + · rw [Complex.exp_ofReal_mul_I_re, Complex.exp_ofReal_mul_I_im, Real.cos_sub, hc, hs] + ring + · rw [Complex.exp_ofReal_mul_I_re, Complex.exp_ofReal_mul_I_im, Real.sin_sub, hc, hs] + ring + +theorem per_quad {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : 0 ≤ (per 4 t).re ∧ 0 ≤ (per 4 t).im := by + have e' : (2 : ℝ) * Real.pi * t / (4 : ℕ) = Real.pi * t / 2 := by + push_cast + ring + have hpi := Real.pi_pos + have h1 : 0 ≤ Real.pi * t / 2 := by + have := ht.1 + positivity + have h2 : Real.pi * t / 2 ≤ Real.pi / 2 := by nlinarith [ht.2] + simp only [per, cis', e'] + rw [Complex.exp_ofReal_mul_I_re, Complex.exp_ofReal_mul_I_im] + exact ⟨Real.cos_nonneg_of_neg_pi_div_two_le_of_le (by linarith) h2, + Real.sin_nonneg_of_nonneg_of_le_pi h1 (by linarith)⟩ + +theorem norm_per4 (t : ℝ) : ‖per 4 t‖ = 1 := by + simp only [per, cis'] + exact Complex.norm_exp_ofReal_mul_I _ + +theorem cylS_quad {z : ℂ} (h1 : 0 ≤ z.re) (h2 : 0 ≤ z.im) : cylS z = ‖z‖ := by + by_cases hz : z = 0 + · subst hz + simp [cylS, nu_zero] + have h3 := nn_pos hz + simp only [cylS, nu, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, zero_mul, sub_zero, + Complex.mul_im, add_zero] + have h4 : nn z = z.re + z.im := by simp only [nn, abs_of_nonneg h1, abs_of_nonneg h2] + rw [← mul_add, ← h4] + field_simp + +/-- A point of the disc that goes to the first side of the square is on the first arc. -/ +theorem exists_side {z : ℂ} (hz : ‖z‖ ≤ 1) (hs : cylS z = 1) : ∃ t ∈ Icc (0 : ℝ) 1, z = per 4 t + := by + have h1 := nn_nu z + have h2 : (nu z).re + (nu z).im = 1 := hs + have h3 : |(nu z).re| + |(nu z).im| = ‖z‖ := h1 + have h4 := le_abs_self (nu z).re + have h5 := le_abs_self (nu z).im + have hn : ‖z‖ = 1 := le_antisymm hz (by linarith) + have h6 : 0 ≤ (nu z).re := by + rcases abs_cases (nu z).re with h7 | h7 <;> rcases abs_cases (nu z).im with h8 | h8 <;> linarith + have h7 : 0 ≤ (nu z).im := by + rcases abs_cases (nu z).re with h7 | h7 <;> rcases abs_cases (nu z).im with h8 | h8 <;> linarith + have hz0 : z ≠ 0 := by + rintro rfl + simp at hn + have hc : 0 < ‖z‖ / nn z := div_pos (norm_pos_iff.mpr hz0) (nn_pos hz0) + have h8 : 0 ≤ z.re := by + have : (nu z).re = ‖z‖ / nn z * z.re := by simp [nu] + rw [this] at h6 + exact nonneg_of_mul_nonneg_right h6 hc + have h9 : 0 ≤ z.im := by + have : (nu z).im = ‖z‖ / nn z * z.im := by simp [nu] + rw [this] at h7 + exact nonneg_of_mul_nonneg_right h7 hc + have hpi := Real.pi_pos + have ha0 : 0 ≤ Complex.arg z := Complex.arg_nonneg_iff.mpr h9 + have ha1 : Complex.arg z ≤ Real.pi / 2 := (abs_le.mp (Complex.abs_arg_le_pi_div_two_iff.mpr h8)).2 + refine ⟨2 * Complex.arg z / Real.pi, ⟨by positivity, ?_⟩, ?_⟩ + · rw [div_le_one hpi] + linarith + · have e : (2 : ℝ) * Real.pi * (2 * Complex.arg z / Real.pi) / (4 : ℕ) = Complex.arg z := by + push_cast + field_simp + ring + simp only [per, cis', e] + have := Complex.norm_mul_exp_arg_mul_I z + rw [hn] at this + simpa using this.symm + +/-- The word of the cylinder. -/ +def cylW : List Letter := [(0, true), (1, true), (0, false), (2, true)] + +theorem sdPt_zero {t : ℝ} : sdPt 4 0 true t = per 4 t := by simp [sdPt] + +theorem sdPt_two {t : ℝ} : sdPt 4 2 false t = per 4 (3 - t) := by + simp only [sdPt] + congr 1 + simp only [Bool.false_eq_true, ite_false] + push_cast + ring + +theorem cylG_side {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : cylG (per 4 t) = cylG (per 4 (3 - t)) := by + obtain ⟨h1, h2⟩ := per_quad ht + have h3 := cylS_quad h1 h2 + rw [norm_per4] at h3 + apply Subtype.ext + apply Prod.ext + · rw [cylG_fst (norm_per4 t).le, cylG_fst (norm_per4 _).le, per_refl, cylR_refl] + · rw [cylG_snd, cylG_snd, per_refl, cylS_refl, h3] + exact ee_eq_iff.mpr ⟨1, by norm_num⟩ + +theorem cylG_fib {z z' : ℂ} (hz : ‖z‖ ≤ 1) (hz' : ‖z'‖ ≤ 1) (he : cylG z = cylG z') : + z = z' ∨ ∃ t ∈ Icc (0 : ℝ) 1, (z = per 4 t ∧ z' = per 4 (3 - t)) ∨ (z' = per 4 t ∧ z = per 4 + (3 - t)) := by + have h1 : cylR z = cylR z' := by + rw [← cylG_fst hz, ← cylG_fst hz', he] + have h2 : ee (cylS z / 2) = ee (cylS z' / 2) := by + rw [← cylG_snd, ← cylG_snd, he] + obtain ⟨m, hm⟩ := ee_eq_iff.mp h2 + have s1 := cylS_mem hz + have s2 := cylS_mem hz' + have r1 : (nu z).re - (nu z).im = (nu z').re - (nu z').im := by + simp only [cylR] at h1 + linarith + have m1 : (m : ℝ) < 2 := by linarith [s1.2, s2.1] + have m2 : (-2 : ℝ) < m := by linarith [s1.1, s2.2] + have m3 : m < 2 := by exact_mod_cast m1 + have m4 : -2 < m := by exact_mod_cast m2 + have key : ∀ {x y : ℂ}, ‖x‖ ≤ 1 → cylS x = 1 → cylS y = -1 → (nu x).re - (nu x).im = (nu y).re - + (nu y).im → + ∃ t ∈ Icc (0 : ℝ) 1, x = per 4 t ∧ y = per 4 (3 - t) := by + intro x y hx hsx hsy hd + obtain ⟨t, ht, rfl⟩ := exists_side hx hsx + refine ⟨t, ht, rfl, ?_⟩ + rw [per_refl] + apply nu_injective + rw [nu_refl] + have e1 : (nu (per 4 t)).re + (nu (per 4 t)).im = 1 := hsx + have e2 : (nu y).re + (nu y).im = -1 := hsy + apply Complex.ext + · simp only [refl'] + linarith + · simp only [refl'] + linarith + have hm5 : m = 0 ∨ m = 1 ∨ m = -1 := by omega + rcases hm5 with rfl | rfl | rfl + · left + apply nu_injective + have e : cylS z = cylS z' := by + push_cast at hm + linarith + have e' : (nu z).re + (nu z).im = (nu z').re + (nu z').im := e + apply Complex.ext <;> linarith + · right + push_cast at hm + have e1 : cylS z = 1 := by linarith [s1.2, s2.1] + have e2 : cylS z' = -1 := by linarith [s1.2, s2.1] + obtain ⟨t, ht, h3, h4⟩ := key hz e1 e2 r1 + exact ⟨t, ht, .inl ⟨h3, h4⟩⟩ + · right + push_cast at hm + have e1 : cylS z' = 1 := by linarith [s1.1, s2.2] + have e2 : cylS z = -1 := by linarith [s1.1, s2.2] + obtain ⟨t, ht, h3, h4⟩ := key hz' e1 e2 r1.symm + exact ⟨t, ht, .inr ⟨h3, h4⟩⟩ + +theorem cylW_stp {a b : ℕ × ℂ} (h : Stp (sW cylW) a b) : cylG a.2 = cylG b.2 := by + obtain ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ := h + obtain ⟨rfl, h4⟩ := sW_get h1 + obtain ⟨rfl, h5⟩ := sW_get h2 + rw [sW_zero] + have hlen : cylW.length = 4 := rfl + simp only [hlen] + have key : cylG (sdPt 4 0 true t) = cylG (sdPt 4 2 false t) := by + rw [sdPt_zero, sdPt_two] + exact cylG_side ht + rcases p with _ | _ | _ | _ | p <;> rcases q with _ | _ | _ | _ | q <;> + simp only [cylW, List.getElem?_cons_zero, List.getElem?_cons_succ, List.getElem?_nil, + Option.some.injEq, reduceCtorEq, Prod.mk.injEq, zero_add, Nat.reduceAdd] at h4 h5 h3 + all_goals obtain ⟨e1, e2⟩ := h4 + all_goals obtain ⟨e3, e4⟩ := h5 + all_goals subst e2 e4 + all_goals first + | rfl + | omega + | exact key.symm + +/-- The word `t r t⁻¹ r'` presents the cylinder. -/ +theorem presents_cyl : Presents (sW cylW) fun a => cylG a.2 := by + have hD : ∀ a, a ∈ Dsk (sW cylW) ↔ a.1 = 0 ∧ ‖a.2‖ ≤ 1 := fun a => by + constructor + · intro h + have := mem_Dsk_sW h + exact ⟨this.1, this.2.2⟩ + · rintro ⟨h1, h2⟩ + refine ⟨?_, h2⟩ + rw [h1, sW_zero] + simp [cylW] + refine ⟨(continuous_cylG.comp continuous_snd).continuousOn, ?_, ?_⟩ + · refine eq_univ_of_forall fun y => ?_ + obtain ⟨z, hz, rfl⟩ := cylG_surj y + exact ⟨(0, z), (hD _).mpr ⟨rfl, hz⟩, rfl⟩ + · intro a ha b hb + obtain ⟨h1, h2⟩ := (hD _).mp ha + obtain ⟨h3, h4⟩ := (hD _).mp hb + have ea : a = (0, a.2) := Prod.ext h1 rfl + have eb : b = (0, b.2) := Prod.ext h3 rfl + constructor + · intro he + rcases cylG_fib h2 h4 he with h5 | ⟨t, ht, ⟨h5, h6⟩ | ⟨h5, h6⟩⟩ + · rw [show a = b from Prod.ext (h1.trans h3.symm) h5] + exact .refl _ + · rw [ea, eb, h5, h6] + refine .rel _ _ ⟨0, 0, 0, 2, 0, true, false, t, rfl, rfl, by simp, ht, ?_, ?_⟩ + · simp [sW_zero, cylW, sdPt_zero] + · simp [sW_zero, cylW, sdPt_two] + · rw [ea, eb, h5, h6] + refine .symm _ _ (.rel _ _ ⟨0, 0, 0, 2, 0, true, false, t, rfl, rfl, by simp, ht, ?_, ?_⟩) + · simp [sW_zero, cylW, sdPt_zero] + · simp [sW_zero, cylW, sdPt_two] + · intro hp + clear ha hb h1 h2 h3 h4 ea eb + induction hp with + | rel x y hs => exact cylW_stp hs + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + +/-- The model with two holes is the closed cylinder. -/ +theorem nonempty_cyl_homeo : Nonempty (SurfaceModel 0 0 2 ≃ₜ ClosedCylinder) := by + have hI : Inv cylW [] [] [] 0 0 0 := by + refine ⟨.nil, .nil, .nil, by simp [DisjL], by simp [DisjL], by simp [DisjL], by simp [DisjL], + by simp [DisjL], by simp [DisjL], ?_⟩ + intro k + simp only [cylW, cnt_cons, cnt_nil] + split_ifs <;> omega + have s1 := step_hole.{0} (P := []) (x := (0, true)) (q := (1, true)) (Q := []) (V + := [(2, true)]) hI rfl (by + intro l hl + simp only [List.mem_cons, List.not_mem_nil, or_false] at hl + rw [hl] + simp [cylW, cnt_cons, cnt_nil]) + obtain ⟨u, s2, s3⟩ := step_last.{0} (R := [] ++ [(2, true)]) (q := (2, true)) (Q := []) s1.1 rfl + (by + intro l hl + simp only [List.nil_append, List.mem_cons, List.not_mem_nil, or_false] at hl + rw [hl] + simp [cnt_cons, cnt_nil]) + have : Nonempty ClosedCylinder := ⟨⟨(1, 1), by simp [ClosedCylinder]⟩⟩ + obtain ⟨e⟩ := homeo_of_nf presents_cyl s2.isNF (s1.2.trans (by simpa using s3)) + exact ⟨e.symm⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutEdges.lean b/LeanPool/GraphMinor/Surface/CutEdges.lean new file mode 100644 index 0000000000..c85374cce4 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutEdges.lean @@ -0,0 +1,730 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutWord +public import LeanPool.GraphMinor.Surface.CutLift +public import LeanPool.GraphMinor.Surface.NormalWord +public import LeanPool.GraphMinor.Surface.CohPrim + +/-! +# Cutting along edges of a dissection + +Let `W` be the word of a dissection, and cut it along the labels of a set `D` of edges. This file +studies the resulting +space near the edges in `D`. The main results are `vertex_cut`, which tells what happens at an end +of an edge in `D`, and +`exists_cut_space`, which gives the cut surface with two lifts of each edge in `D`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +local notation "𝕀" => unitInterval + +/-- `W` and `f` come from a dissection with the graph `V, E`: each side runs along the edge named by +its label. -/ +structure WordEdges {S : Type u} [TopologicalSpace S] (W : ℕ → List Letter) (f : ℕ × ℂ → S) + (V : Set S) (E : Set (Set S)) + (A : Set S → 𝕀 → S) (lab : Set S → ℕ) : Prop where + fin : FinW W + paired : IsPaired W + pres : Presents W f + graph : IsGraph V E + arc : ∀ e ∈ E, IsArcMap (A e) ∧ range (A e) = e ∧ e ∩ V = {A e 0, A e 1} + lab_inj : InjOn lab E + side : ∀ i p k e', (W i)[p]? = some (k, e') → ∃ e ∈ E, lab e = k ∧ ∀ u ∈ Icc (0 : ℝ) 1, + f (spt W i p u) = extI (A e) (ofs e' u) + circ : ∀ a ∈ Dsk W, f a ∈ ⋃₀ E → ‖a.2‖ = 1 + +variable {S : Type u} [TopologicalSpace S] [T2Space S] {W : ℕ → List Letter} {f : ℕ × ℂ + → S} {V : Set S} {E : Set (Set S)} + {A : Set S → 𝕀 → S} {lab : Set S → ℕ} + +/-- The middle of an edge. -/ +noncomputable def edgeMid (A : Set S → 𝕀 → S) (e : Set S) : S := extI (A e) (1 / 2) + +theorem spe_mem (g : SE W) : spe W g ∈ Dsk W := by + obtain ⟨⟨i, p, b⟩, h⟩ := g + replace h : p < (W i).length := h + have h1 : W i ≠ [] := fun he => by + rw [he] at h + simp at h + exact ⟨h1, by simp [spe, spt, norm_per]⟩ + +theorem spt_mem {i p : ℕ} (h : p < (W i).length) (u : ℝ) : spt W i p u ∈ Dsk W := + ⟨fun he => by + replace he : W i = [] := he + rw [he] at h + simp at h, by simp [spt, norm_per]⟩ + +namespace WordEdges + +variable (h : WordEdges W f V E A lab) + +include h + +omit [T2Space S] in +theorem extI_mem {e : Set S} (he : e ∈ E) (t : ℝ) : extI (A e) t ∈ e := + (h.arc e he).2.1.subset ⟨_, rfl⟩ + +omit [T2Space S] in +theorem extI_notMem {e : Set S} (he : e ∈ E) {t : ℝ} (ht : t ∈ Ioo (0 : ℝ) 1) : extI (A e) t ∉ V + := by + intro hV + have h1 : extI (A e) t ∈ e ∩ V := ⟨h.extI_mem he t, hV⟩ + rw [(h.arc e he).2.2] at h1 + have ht' : t ∈ Icc (0 : ℝ) 1 := ⟨ht.1.le, ht.2.le⟩ + have hinj := extI_injOn (h.arc e he).1.2 + rcases h1 with h1 | h1 + · have h2 : extI (A e) t = extI (A e) 0 := h1.trans (extI_coe (A e) 0).symm + exact ht.1.ne' (hinj ht' ⟨le_rfl, zero_le_one⟩ h2) + · have h2 : extI (A e) t = extI (A e) 1 := h1.trans (extI_coe (A e) 1).symm + exact ht.2.ne (hinj ht' ⟨zero_le_one, le_rfl⟩ h2) + +omit [T2Space S] in +theorem extI_mem_V {e : Set S} (he : e ∈ E) (b : Bool) : extI (A e) (eo b) ∈ V := by + have h1 : A e 0 ∈ e ∩ V := (h.arc e he).2.2 ▸ mem_insert _ _ + have h2 : A e 1 ∈ e ∩ V := (h.arc e he).2.2 ▸ mem_insert_of_mem _ rfl + cases b + · have : extI (A e) (eo false) = A e 0 := by + simpa [eo] using extI_coe (A e) 0 + rw [this] + exact h1.2 + · have : extI (A e) (eo true) = A e 1 := by + simpa [eo] using extI_coe (A e) 1 + rw [this] + exact h2.2 + +omit [T2Space S] in +theorem corner_of_side {i p k : ℕ} {e' : Bool} (h1 : (W i)[p]? = some (k, e')) {u : ℝ} + (hu : u ∈ Icc (0 : ℝ) 1) + (hV : f (spt W i p u) ∈ V) : ∃ b, eo b = u := by + obtain ⟨e, he, -, h3⟩ := h.side _ _ _ _ h1 + by_contra hc + push Not at hc + have h4 : u ∈ Ioo (0 : ℝ) 1 := ⟨lt_of_le_of_ne hu.1 (fun h0 => hc false (by simp [eo, h0])), + lt_of_le_of_ne hu.2 (fun h0 => hc true (by simp [eo, h0]))⟩ + have h5 : ofs e' u ∈ Ioo (0 : ℝ) 1 := by + cases e' <;> simp only [ofs, Bool.false_eq_true, ite_true, ite_false] + · exact ⟨by linarith [h4.2], by linarith [h4.1]⟩ + · exact h4 + rw [h3 u hu] at hV + exact h.extI_notMem he h5 hV + +omit [T2Space S] in +theorem eo_inj {e : Set S} (he : e ∈ E) {a b : Bool} (he' : extI (A e) (eo a) = extI (A e) + (eo b)) : a = b := by + have h1 := extI_injOn (h.arc e he).1.2 (eo_mem a) (eo_mem b) he' + cases a <;> cases b <;> simp [eo] at h1 ⊢ + +omit [T2Space S] in +/-- A point of the discs on an edge is on a side along an edge. -/ +theorem exists_side {a : ℕ × ℂ} (ha : a ∈ Dsk W) (hE : f a ∈ ⋃₀ E) : + ∃ p e', ∃ e ∈ E, ∃ u ∈ Icc (0 : ℝ) 1, (W a.1)[p]? = some (lab e, e') ∧ a = spt W a.1 p u ∧ + f a = extI (A e) (ofs e' u) := by + obtain ⟨p, k, e', u, hu, h1, h2⟩ := exists_spt ha (h.circ a ha hE) + obtain ⟨e, he, rfl, h3⟩ := h.side _ p k e' h1 + refine ⟨p, e', e, he, u, hu, h1, h2, ?_⟩ + rw [← h3 u hu, ← h2] + +omit [T2Space S] in +theorem corner_of {a : ℕ × ℂ} (ha : a ∈ Dsk W) (hE : f a ∈ ⋃₀ E) (hV : f a ∈ V) : ∃ g : SE W, spe W + g = a := by + classical + obtain ⟨p, e', e, he, u, hu, h1, h2, h3⟩ := h.exists_side ha hE + have hend : u = 0 ∨ u = 1 := by + by_contra hc + push Not at hc + have h4 : u ∈ Ioo (0 : ℝ) 1 := ⟨lt_of_le_of_ne hu.1 (Ne.symm hc.1), lt_of_le_of_ne hu.2 hc.2⟩ + have h5 : ofs e' u ∈ Ioo (0 : ℝ) 1 := by + cases e' <;> simp only [ofs, Bool.false_eq_true, ite_true, ite_false] + · exact ⟨by linarith [h4.2], by linarith [h4.1]⟩ + · exact h4 + exact h.extI_notMem he h5 (h3 ▸ hV) + refine ⟨⟨(a.1, p, decide (u = 1)), lt_length h1⟩, ?_⟩ + have hx : eo (decide (u = 1)) = u := by + rcases hend with rfl | rfl <;> simp [eo] + simp only [spe, hx] + exact h2.symm + +theorem bd_eq : bd S = f '' freePts W := (surface_of_presents h.fin h.paired h.pres).2 + +/-- An edge with the middle off the boundary is on two sides. -/ +theorem exists_sides {e : Set S} (he : e ∈ E) (hb : edgeMid A e ∉ bd S) : ∃ (i p j q : ℕ) + (e₁ e₂ : Bool), + (W i)[p]? = some (lab e, e₁) ∧ (W j)[q]? = some (lab e, e₂) ∧ (i, p) ≠ (j, q) := by + obtain ⟨a, ha, hfa⟩ : edgeMid A e ∈ f '' Dsk W := h.pres.2.1 ▸ mem_univ _ + have hmid : (1 / 2 : ℝ) ∈ Ioo (0 : ℝ) 1 := by norm_num + have hE : f a ∈ ⋃₀ E := ⟨e, he, hfa ▸ h.extI_mem he _⟩ + obtain ⟨p, e', e'', he'', u, hu, h1, h2, h3⟩ := h.exists_side ha hE + have hee : e'' = e := by + by_contra hc + have h4 : edgeMid A e ∈ V := h.graph.disj e'' he'' e he hc + ⟨by rw [← hfa, h3]; exact h.extI_mem he'' _, h.extI_mem he _⟩ + exact h.extI_notMem he hmid h4 + subst hee + by_contra hcon + push Not at hcon + have hfree : FreeSide W a.1 p := by + intro j q k e₁ e₂ h4 h5 + have hk : (k, e₁) = (lab e'', e') := by + rw [h1] at h4 + exact (Option.some.inj h4).symm + obtain ⟨rfl, rfl⟩ := Prod.mk.inj hk + by_contra hne + exact hne (hcon a.1 p j q _ _ h1 h5) + refine hb ?_ + rw [h.bd_eq] + exact ⟨a, ⟨a.1, p, u, lt_length h1, hfree, hu, h2⟩, hfa⟩ + +end WordEdges + +/-- The end of a side in the direction of its letter. -/ +def xn (e τ : Bool) : Bool := if e then τ else !τ + +theorem eo_xn (e τ : Bool) : eo (xn e τ) = ofs e (eo τ) := by + cases e <;> cases τ <;> simp [xn, eo, ofs] + +theorem xn_xn (e τ : Bool) : xn e (xn e τ) = τ := by + cases e <;> cases τ <;> rfl + +/-- The two sides along an edge. -/ +structure EdgeSides (W : ℕ → List Letter) (k : ℕ) (i p j q : ℕ) (e₁ e₂ : Bool) : Prop where + one : (W i)[p]? = some (k, e₁) + two : (W j)[q]? = some (k, e₂) + ne : (i, p) ≠ (j, q) + +variable {k i p j q : ℕ} {e₁ e₂ : Bool} + +/-- The end of the first side at the end `τ` of the edge. -/ +def EdgeSides.end₁ (s : EdgeSides W k i p j q e₁ e₂) (τ : Bool) : SE W + := ⟨(i, p, xn e₁ τ), lt_length s.one⟩ + +/-- The end of the second side at the end `τ` of the edge. -/ +def EdgeSides.end₂ (s : EdgeSides W k i p j q e₁ e₂) (τ : Bool) : SE W + := ⟨(j, q, xn e₂ τ), lt_length s.two⟩ + +theorem EdgeSides.mate {L : Set ℕ} (s : EdgeSides W k i p j q e₁ e₂) (hk : k ∉ L) (τ : Bool) : + MateL W L (s.end₁ τ) (s.end₂ τ) := by + refine ⟨k, e₁, e₂, s.one, s.two, s.ne, hk, ?_⟩ + cases e₁ <;> cases e₂ <;> cases τ <;> rfl + +theorem EdgeSides.mem (s : EdgeSides W k i p j q e₁ e₂) (hP : IsPaired W) (g : SE W) {e : Bool} + (hg : (W g.1.1)[g.1.2.1]? = some (k, e)) : ∃ τ, g = s.end₁ τ ∨ g = s.end₂ τ := by + obtain ⟨⟨i', p', b⟩, hb⟩ := g + simp only at hg + rcases hP.third s.one s.two hg s.ne with h1 | h1 + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj h1 + have he : e = e₁ := by + rw [s.one] at hg + simpa using hg.symm + subst he + refine ⟨xn e b, .inl ?_⟩ + apply Subtype.ext + simp [EdgeSides.end₁, xn_xn] + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj h1 + have he : e = e₂ := by + rw [s.two] at hg + simpa using hg.symm + subst he + refine ⟨xn e b, .inr ?_⟩ + apply Subtype.ext + simp [EdgeSides.end₂, xn_xn] + +omit [T2Space S] in +/-- The sides of the edges in `D`. -/ +theorem WordEdges.f_end₁ (h : WordEdges W f V E A lab) {e : Set S} (he : e ∈ E) + (s : EdgeSides W (lab e) i p j q e₁ e₂) (τ : Bool) : f (spe W (s.end₁ τ)) = extI (A e) (eo τ) + := by + obtain ⟨e', he', hl, h1⟩ := h.side _ _ _ _ s.one + obtain rfl := h.lab_inj he' he hl + have h2 := h1 (ofs e₁ (eo τ)) (ofs_mem (eo_mem τ)) + rw [ofs_ofs] at h2 + simp only [spe, EdgeSides.end₁, eo_xn] + exact h2 + +omit [T2Space S] in +theorem WordEdges.f_end₂ (h : WordEdges W f V E A lab) {e : Set S} (he : e ∈ E) + (s : EdgeSides W (lab e) i p j q e₁ e₂) (τ : Bool) : f (spe W (s.end₂ τ)) = extI (A e) (eo τ) + := by + obtain ⟨e', he', hl, h1⟩ := h.side _ _ _ _ s.two + obtain rfl := h.lab_inj he' he hl + have h2 := h1 (ofs e₂ (eo τ)) (ofs_mem (eo_mem τ)) + rw [ofs_ofs] at h2 + simp only [spe, EdgeSides.end₂, eo_xn] + exact h2 + +/-- At an end of a cut edge, either exactly one other edge of `D` ends there off the boundary, +or the point is on the boundary and no other cut edge ends there. -/ +def CutEndCondition (A : Set S → unitInterval → S) (D : Set (Set S)) (e : Set S) + (τ : Bool) : Prop := + (∃ e' ∈ D, ∃ τ', e' ≠ e ∧ extI (A e') (eo τ') = extI (A e) (eo τ) ∧ extI (A e) (eo τ) ∉ bd S ∧ + ∀ e'' ∈ D, ∀ τ'', extI (A e'') (eo τ'') = extI (A e) (eo τ) → (e'' = e ∧ τ'' = τ) ∨ (e'' = e' + ∧ τ'' = τ')) ∨ + (extI (A e) (eo τ) ∈ bd S ∧ ∀ e'' ∈ D, ∀ τ'', extI (A e'') (eo τ'') = extI (A e) (eo τ) → e'' = e + ∧ τ'' = τ) + +/-- What happens at an end of an edge in `D`, when we cut along the labels `L` of `D`. There are two +cases. Either exactly +one other end of an edge in `D` lies at the same point, off the boundary, or no other end does and +the point is on +the boundary. -/ +theorem WordEdges.vertex_cut (h : WordEdges W f V E A lab) {D : Set (Set S)} + (hD : D ⊆ E) {e : Set S} (heD : e ∈ D) + (hsd : ∀ e ∈ D, ∃ (i p j q : ℕ) (e₁ e₂ : Bool), EdgeSides W (lab e) i p j q e₁ e₂) + (s : EdgeSides W (lab e) i p j q e₁ e₂) (τ : Bool) + (hcase : CutEndCondition A D e τ) : + ¬ PRel (cutW W (lab '' D)) (spe W (s.end₁ τ)) (spe W (s.end₂ τ)) ∧ ∀ a ∈ Dsk W, f a = extI + (A e) (eo τ) → + PRel (cutW W (lab '' D)) (spe W (s.end₁ τ)) a ∨ PRel (cutW W (lab '' D)) (spe W (s.end₂ τ)) a + := by + classical + set L := lab '' D with hL + have heE := hD heD + have hP := h.paired + have hW := h.fin + set c := s.end₁ τ with hc + set c' := s.end₂ τ with hc' + set v := extI (A e) (eo τ) with hv + have hfc : f (spe W c) = v := h.f_end₁ heE s τ + have hfc' : f (spe W c') = v := h.f_end₂ heE s τ + have hcc : prtL W ∅ c = c' := prtL_of_mate hP (s.mate (notMem_empty _) τ) + have hne : c ≠ c' := fun he => s.ne (by + have := congrArg (fun x : SE W => (x.1.1, x.1.2.1)) he + exact this) + have hL0 : lab e ∈ L := ⟨e, heD, rfl⟩ + have hc1 : prtL W L c = c := (prtL_eq_iff hP c s.one).mpr (.inl hL0) + have hc2 : prtL W L c' = c' := (prtL_eq_iff hP c' s.two).mpr (.inl hL0) + have hrel : ∀ g : SE W, f (spe W g) = v → PRel W (spe W c) (spe W g) := fun g hg => + (h.pres.2.2 _ (spe_mem c) _ (spe_mem g)).mp (hfc.trans hg.symm) + have hrelv : ∀ g : SE W, PRel W (spe W c) (spe W g) → f (spe W g) = v := fun g hg => + ((h.pres.2.2 _ (spe_mem c) _ (spe_mem g)).mpr hg).symm.trans hfc + have hvE : v ∈ ⋃₀ E := ⟨e, heE, h.extI_mem heE _⟩ + have hvV : v ∈ V := h.extI_mem_V heE τ + /- The letter at an end of a side. -/ + have hlet : ∀ g : SE W, ∃ k e', (W g.1.1)[g.1.2.1]? = some (k, e') := fun g => + ⟨_, _, List.getElem?_eq_getElem g.2⟩ + have hτinj : ∀ a b : Bool, extI (A e) (eo a) = extI (A e) (eo b) → a = b := fun a b he' + => h.eo_inj heE he' + /- An end at `v` fixed by crossing is an end of an edge in `D` or an end of a free side. -/ + have hfixes : ∀ g : SE W, f (spe W g) = v → prtL W L g = g → (∃ e'' ∈ D, ∃ τ'', extI (A e'') + (eo τ'') = v ∧ + ∃ e', (W g.1.1)[g.1.2.1]? = some (lab e'', e')) ∨ prtL W ∅ g = g := by + intro g hg hfix + obtain ⟨k', e', hk⟩ := hlet g + rcases (prtL_eq_iff hP g hk).mp hfix with ⟨e'', he'', rfl⟩ | hfr + · obtain ⟨i', p', j', q', e₁', e₂', s'⟩ := hsd e'' he'' + obtain ⟨τ'', h5⟩ := s'.mem hP g hk + refine .inl ⟨e'', he'', τ'', ?_, e', hk⟩ + rcases h5 with h5 | h5 + · rw [← h.f_end₁ (hD he'') s' τ'', ← h5, hg] + · rw [← h.f_end₂ (hD he'') s' τ'', ← h5, hg] + · exact .inr ((prtL_eq_iff hP g hk).mpr (.inr hfr)) + /- An end at `v` with the label of `e` is one of the two ends `c`, `c'`. -/ + have hone : ∀ g : SE W, f (spe W g) = v → ∀ e', (W g.1.1)[g.1.2.1]? = some (lab e, e') → g = c + ∨ g = c' := by + intro g hg e' hk + obtain ⟨τ₃, h5⟩ := s.mem hP g hk + rcases h5 with h5 | h5 + · have h6 : extI (A e) (eo τ₃) = v := by rw [← h.f_end₁ heE s τ₃, ← h5, hg] + have h7 := hτinj _ _ h6 + subst h7 + exact .inl h5 + · have h6 : extI (A e) (eo τ₃) = v := by rw [← h.f_end₂ heE s τ₃, ← h5, hg] + have h7 := hτinj _ _ h6 + subst h7 + exact .inr h5 + have hwrap : (∀ g : SE W, PRel W (spe W c) (spe W g) → PRel (cutW W L) (spe W c) (spe W g) ∨ + PRel (cutW W L) (spe W c') (spe W g)) → ∀ a ∈ Dsk W, f a = v → PRel (cutW W L) (spe W c) a ∨ + PRel (cutW W L) (spe W c') a := by + intro h2 a ha hfa + obtain ⟨g, rfl⟩ := h.corner_of ha (hfa ▸ hvE) (hfa ▸ hvV) + exact h2 g (hrel g hfa) + rcases hcase with ⟨e', he'D, τ', hee, hv', hvb, huniq⟩ | ⟨hvb, huniq⟩ + · have he'E := hD he'D + obtain ⟨i', p', j', q', e₁', e₂', s'⟩ := hsd e' he'D + set d := s'.end₁ τ' with hd + set d' := s'.end₂ τ' with hd' + have hfd : f (spe W d) = v := (h.f_end₁ he'E s' τ').trans hv' + have hfd' : f (spe W d') = v := (h.f_end₂ he'E s' τ').trans hv' + have hdd : prtL W ∅ d = d' := prtL_of_mate hP (s'.mate (notMem_empty _) τ') + have hL1 : lab e' ∈ L := ⟨e', he'D, rfl⟩ + have hlabne : lab e' ≠ lab e := fun hl => hee (h.lab_inj he'E heE hl) + have hnesame : ∀ {x y : SE W} {ex ey : Bool}, (W x.1.1)[x.1.2.1]? = some (lab e', ex) → + (W y.1.1)[y.1.2.1]? = some (lab e, ey) → x ≠ y := by + intro x y ex ey hx hy he' + rw [he', hy] at hx + have := congrArg (Option.map Prod.fst) hx + simp at this + exact hlabne this.symm + have hdne : d ≠ d' := fun he' => s'.ne (by + have := congrArg (fun x : SE W => (x.1.1, x.1.2.1)) he' + exact this) + have hτinj' : ∀ a b : Bool, extI (A e') (eo a) = extI (A e') (eo b) → a = b := fun a b he' + => h.eo_inj he'E he' + have hone' : ∀ g : SE W, f (spe W g) = v → ∀ e₃, (W g.1.1)[g.1.2.1]? = some (lab e', e₃) → g + = d ∨ g = d' := by + intro g hg e₃ hk + obtain ⟨τ₃, h5⟩ := s'.mem hP g hk + rcases h5 with h5 | h5 + · have h6 : extI (A e') (eo τ₃) = extI (A e') (eo τ') := by + rw [← h.f_end₁ he'E s' τ₃, ← h5, hg, hv'] + have h7 := hτinj' _ _ h6 + subst h7 + exact .inl h5 + · have h6 : extI (A e') (eo τ₃) = extI (A e') (eo τ') := by + rw [← h.f_end₂ he'E s' τ₃, ← h5, hg, hv'] + have h7 := hτinj' _ _ h6 + subst h7 + exact .inr h5 + obtain ⟨h1, h2⟩ := corner_cut hW hP hcc hc1 hc2 ((prtL_eq_iff hP d s'.one).mpr (.inl hL1)) + ((prtL_eq_iff hP d' s'.two).mpr (.inl hL1)) + hne (hnesame s'.one s.one) (hnesame s'.one s.two) (hnesame s'.two s.one) + (hnesame s'.two s.two) hdne (hrel d hfd) + (hrel d' hfd') (.inr hdd) (.inl (by rw [← hdd, prtL_invol hP])) (fun g hg hfix => by + rcases hfixes g (hrelv g hg) hfix with ⟨e'', he'', τ'', h5, e₃, h6⟩ | hfr + · rcases huniq e'' he'' τ'' h5 with ⟨rfl, -⟩ | ⟨rfl, -⟩ + · rcases hone g (hrelv g hg) e₃ h6 with h7 | h7 + · exact .inl h7 + · exact .inr (.inl h7) + · rcases hone' g (hrelv g hg) e₃ h6 with h7 | h7 + · exact .inr (.inr (.inl h7)) + · exact .inr (.inr (.inr h7)) + · exfalso + obtain ⟨k', e₃, hk⟩ := hlet g + rcases (prtL_eq_iff hP g hk).mp hfr with h5 | h5 + · exact h5 + · apply hvb + change v ∈ bd S + rw [h.bd_eq, ← hrelv g hg] + exact ⟨spe W g, ⟨_, _, _, g.2, h5, eo_mem _, rfl⟩, rfl⟩) + exact ⟨h1, hwrap h2⟩ + · have hvb' : v ∈ bd S := hvb + rw [h.bd_eq] at hvb' + obtain ⟨x, ⟨i₀, p₀, u, hp₀, hfree, hu, rfl⟩, hfx⟩ := hvb' + obtain ⟨⟨k₀, e₀⟩, hk₀⟩ : ∃ l, (W i₀)[p₀]? = some l := ⟨_, List.getElem?_eq_getElem hp₀⟩ + obtain ⟨b₀, hb₀⟩ := h.corner_of_side hk₀ hu (hfx ▸ hvV) + let d : SE W := ⟨(i₀, p₀, b₀), hp₀⟩ + have hspd : spe W d = spt W i₀ p₀ u := by simp only [spe, d, hb₀] + have hfd : f (spe W d) = v := by rw [hspd, hfx] + have hdfix : prtL W ∅ d = d := (prtL_eq_iff hP d hk₀).mpr (.inr hfree) + obtain ⟨d', hd1, hd2, hd4, hd3⟩ := exists_free_end hW hP hdfix + have hrd : ∀ g : SE W, f (spe W g) = v → PRel W (spe W d) (spe W g) := fun g hg => + (h.pres.2.2 _ (spe_mem d) _ (spe_mem g)).mp (hfd.trans hg.symm) + have hfd' : f (spe W d') = v := ((h.pres.2.2 _ (spe_mem d) _ (spe_mem d')).mpr hd4).symm.trans + hfd + have hnfix : ∀ g : SE W, prtL W ∅ g = g → g ≠ c ∧ g ≠ c' := fun g hg => by + constructor + · rintro rfl + exact hne (hg.symm.trans hcc) + · rintro rfl + have h5 : prtL W ∅ c' = c := by rw [← hcc, prtL_invol hP] + exact hne (h5.symm.trans hg) + have hL2 : ∀ g : SE W, prtL W ∅ g = g → prtL W L g = g := fun g hg => by + rcases prtL_cases (L := L) hP g with h5 | h5 + · exact h5 + · exact h5.trans hg + obtain ⟨h1, h2⟩ := corner_cut hW hP hcc hc1 hc2 (hL2 d hdfix) (hL2 d' hd2) hne + (hnfix d hdfix).1 (hnfix d hdfix).2 + (hnfix d' hd2).1 (hnfix d' hd2).2 hd1.symm (hrel d hfd) (hrel d' hfd') (.inl hdfix) + (.inr hd2) (fun g hg hfix => by + rcases hfixes g (hrelv g hg) hfix with ⟨e'', he'', τ'', h5, e₃, h6⟩ | hfr + · obtain ⟨rfl, -⟩ := huniq e'' he'' τ'' h5 + rcases hone g (hrelv g hg) e₃ h6 with h7 | h7 + · exact .inl h7 + · exact .inr (.inl h7) + · rcases hd3 g (hrd g (hrelv g hg)) hfr with h5 | h5 + · exact .inr (.inr (.inl h5)) + · exact .inr (.inr (.inr h5))) + exact ⟨h1, hwrap h2⟩ + +omit [T2Space S] in +theorem WordEdges.f_side (h : WordEdges W f V E A lab) {e : Set S} (he : e ∈ E) (hs : (W i)[p]? + = some (lab e, e₁)) {u : ℝ} + (hu : u ∈ Icc (0 : ℝ) 1) : f (spt W i p u) = extI (A e) (ofs e₁ u) := by + obtain ⟨e', he', hl, h1⟩ := h.side _ _ _ _ hs + obtain rfl := h.lab_inj he' he hl + exact h1 u hu + +omit [TopologicalSpace S] [T2Space S] in +theorem image_extI (a : 𝕀 → S) : extI a '' Icc 0 1 = range a := by + ext z + constructor + · rintro ⟨t, -, rfl⟩ + exact ⟨_, rfl⟩ + · rintro ⟨t, rfl⟩ + exact ⟨t, t.2, extI_coe a t⟩ + +theorem ofs_Ioo (e : Bool) {t : ℝ} (ht : t ∈ Ioo (0 : ℝ) 1) : ofs e t ∈ Ioo (0 : ℝ) 1 := by + cases e <;> simp only [ofs, Bool.false_eq_true, ite_true, ite_false] + · exact ⟨by linarith [ht.2], by linarith [ht.1]⟩ + · exact ht + +theorem continuous_spt_ofs (W : ℕ → List Letter) (i p : ℕ) (e : Bool) : Continuous fun t + => spt W i p (ofs e t) := by + have h1 : Continuous fun t : ℝ => ofs e t := by + cases e <;> simp only [ofs, Bool.false_eq_true, ite_true, ite_false] <;> fun_prop + exact continuous_const.prodMk ((continuous_per _).comp (continuous_const.add h1)) + +/-- A map that respects the pasting descends to the quotient. -/ +theorem exists_descend {Y T : Type*} [TopologicalSpace Y] [TopologicalSpace T] [T2Space Y] {W' : ℕ + → List Letter} + (hW : FinW W') {g : ℕ × ℂ → Y} (hg : Presents W' g) {f : ℕ × ℂ → T} (hf : ContinuousOn f + (Dsk W')) + (hr : ∀ a ∈ Dsk W', ∀ b ∈ Dsk W', PRel W' a b → f a = f b) : + ∃ ψ : Y → T, Continuous ψ ∧ ∀ a ∈ Dsk W', ψ (g a) = f a := by + have : CompactSpace (Dsk W') := isCompact_iff_compactSpace.mp (isCompact_Dsk hW) + let gr : Dsk W' → Y := fun a => g a.1 + have hc : Continuous gr := continuousOn_iff_continuous_domRestrict.mp hg.1 + have hs : Function.Surjective gr := fun y => by + obtain ⟨a, ha, rfl⟩ : y ∈ g '' Dsk W' := hg.2.1 ▸ mem_univ y + exact ⟨⟨a, ha⟩, rfl⟩ + have hq : IsQuotientMap gr := hc.isClosedMap.isQuotientMap hc hs + let ψ : Y → T := fun y => f (Function.surjInv hs y).1 + have hψ : ∀ a ∈ Dsk W', ψ (g a) = f a := fun a ha => by + have h1 : gr (Function.surjInv hs (g a)) = g a := Function.surjInv_eq hs _ + exact hr _ (Function.surjInv hs (g a)).2 _ ha ((hg.2.2 _ (Function.surjInv hs + (g a)).2 _ ha).mp h1) + refine ⟨ψ, ?_, hψ⟩ + rw [hq.continuous_iff] + have e : ψ ∘ gr = fun a : Dsk W' => f a.1 := funext fun a => hψ a.1 a.2 + rw [e] + exact continuousOn_iff_continuous_domRestrict.mp hf + +omit [T2Space S] in +/-- The map induced by cutting a word, with its boundary and uncut fibers. -/ +theorem WordEdges.descend_cut (h : WordEdges W f V E A lab) {D : Set (Set S)} (hD : D ⊆ E) + {Y : Type u} [TopologicalSpace Y] [T2Space Y] {g : ℕ × ℂ → Y} + (hg : Presents (cutW W (lab '' D)) g) : + ∃ ψ : Y → S, Continuous ψ ∧ Function.Surjective ψ ∧ InjOn ψ (ψ ⁻¹' (⋃₀ D)ᶜ) ∧ + IsSurface Y ∧ bd Y = g '' freePts (cutW W (lab '' D)) ∧ + (∀ a ∈ Dsk W, ψ (g a) = f a) ∧ (∀ z : Y, ∃ a ∈ Dsk W, g a = z) ∧ + ∀ {a b}, a ∈ Dsk W → b ∈ Dsk W → (g a = g b ↔ PRel (cutW W (lab '' D)) a b) := by + classical + set L := lab '' D with hL + have hP := h.paired + have hfW' : FinW (cutW W L) := finW_cut h.fin + have hP' : IsPaired (cutW W L) := isPaired_cut hP + obtain ⟨hsurf, hbdY⟩ := surface_of_presents hfW' hP' hg + have hD' : Dsk (cutW W L) = Dsk W := dsk_cut + obtain ⟨ψ, hψc, hψ⟩ := exists_descend hfW' hg (hD' ▸ h.pres.1) (fun a ha b hb hab => + (h.pres.2.2 a (hD' ▸ ha) b (hD' ▸ hb)).mpr (prel_of_prel_cut hab)) + rw [hD'] at hψ + have hrep : ∀ z : Y, ∃ a ∈ Dsk W, g a = z := fun z => by + have hz : z ∈ g '' Dsk (cutW W L) := hg.2.1 ▸ mem_univ z + rwa [hD'] at hz + have hgeq : ∀ {a b}, a ∈ Dsk W → b ∈ Dsk W → (g a = g b ↔ PRel (cutW W L) a b) := fun {a b} ha hb + => + hg.2.2 a (hD' ▸ ha) b (hD' ▸ hb) + have hoff : ∀ a b, PRel W a b → f a = f b ∧ (f a ∉ ⋃₀ D → PRel (cutW W L) a b) := by + intro a b hab + induction hab with + | rel a b hs => + have hfe := presents_eq_of_stp h.pres hs + refine ⟨hfe, fun hF => ?_⟩ + obtain ⟨i, j, p, q, k, e, e', u, h1, h2, h3, hu, rfl, rfl⟩ := stp_iff.mp hs + refine .rel _ _ (stp_to_cut h1 h2 h3 hu fun hk => ?_) + obtain ⟨e'', he'', rfl⟩ := hk + exact hF ⟨e'', he'', by + rw [h.f_side (hD he'') h1 hu] + exact h.extI_mem (hD he'') _⟩ + | refl _ => exact ⟨rfl, fun _ => .refl _⟩ + | symm a b _ ih => exact ⟨ih.1.symm, fun hF => .symm _ _ (ih.2 (ih.1 ▸ hF))⟩ + | trans a b c _ _ h1 h2 => exact ⟨h1.1.trans h2.1, fun hF => .trans _ _ _ (h1.2 hF) (h2.2 + (h1.1 ▸ hF))⟩ + refine ⟨ψ, hψc, ?_, ?_, hsurf, hbdY, hψ, hrep, fun ha hb => hgeq ha hb⟩ + · intro x + obtain ⟨a, ha, rfl⟩ : x ∈ f '' Dsk W := h.pres.2.1 ▸ mem_univ x + exact ⟨g a, hψ a ha⟩ + · intro z hz z' hz' he + obtain ⟨a, ha, rfl⟩ := hrep z + obtain ⟨b, hb, rfl⟩ := hrep z' + have h1 : f a = f b := by rw [← hψ a ha, ← hψ b hb, he] + have h2 : f a ∉ ⋃₀ D := fun h3 => hz (by + show ψ (g a) ∈ ⋃₀ D + rw [hψ a ha] + exact h3) + exact (hgeq ha hb).mpr ((hoff a b ((h.pres.2.2 a ha b hb).mp h1)).2 h2) + +/-- Two lifts of an edge to the boundary. They are distinct and exhaust each fiber over the +open edge and at every endpoint satisfying `hend`. -/ +def IsCutEdgeLift {Y : Type u} [TopologicalSpace Y] (ψ : Y → S) (a : ℝ → S) (hend : Bool → Prop) + (r r' : ℝ → Y) : + Prop := + ContinuousOn r (Icc 0 1) ∧ ContinuousOn r' (Icc 0 1) ∧ (∀ t ∈ Icc (0 : ℝ) 1, ψ (r t) = a t ∧ ψ + (r' t) = a t) ∧ + (∀ t ∈ Icc (0 : ℝ) 1, r t ∈ bd Y ∧ r' t ∈ bd Y) ∧ + (∀ t ∈ Icc (0 : ℝ) 1, (t ∈ Ioo (0 : ℝ) 1 ∨ ∃ τ, eo τ = t ∧ hend τ) → + r t ≠ r' t ∧ ∀ z, ψ z = a t → z = r t ∨ z = r' t) + +/-- The cut surface over the union of a set `D` of edges of a word. Each edge has two lifts. -/ +theorem WordEdges.lift_cut_edges (h : WordEdges W f V E A lab) {D : Set (Set S)} (hD : D ⊆ E) + (hsd : ∀ e ∈ D, ∃ (i p j q : ℕ) (e₁ e₂ : Bool), EdgeSides W (lab e) i p j q e₁ e₂) + {Y : Type u} [TopologicalSpace Y] [T2Space Y] {g : ℕ × ℂ → Y} (hg : Presents (cutW W + (lab '' D)) g) : + ∃ ψ : Y → S, Continuous ψ ∧ Function.Surjective ψ ∧ InjOn ψ (ψ ⁻¹' (⋃₀ D)ᶜ) ∧ IsSurface Y ∧ + (∀ a ∈ Dsk W, ψ (g a) = f a) ∧ (∀ z : Y, ∃ a ∈ Dsk W, g a = z) ∧ + ∀ e ∈ D, ∃ r r', IsCutEdgeLift ψ (extI (A e)) (CutEndCondition A D e) r r' := by + classical + set L := lab '' D with hL + have hP := h.paired + have hP' : IsPaired (cutW W L) := isPaired_cut hP + have hD' : Dsk (cutW W L) = Dsk W := dsk_cut + obtain ⟨ψ, hψc, hsurj, hinj, hsurf, hbdY, hψ, hrep, hgeq⟩ := h.descend_cut hD hg + have hkey : ∀ e ∈ D, ∃ r r', IsCutEdgeLift ψ (extI (A e)) (CutEndCondition A D e) r r' := by + intro e heD + have heE := hD heD + obtain ⟨i, p, j, q, e₁, e₂, s⟩ := hsd e heD + have hL0 : lab e ∈ L := ⟨e, heD, rfl⟩ + have hv := fun τ (hτ : CutEndCondition A D e τ) => h.vertex_cut hD heD hsd s τ hτ + have hp := lt_length s.one + have hq := lt_length s.two + let r : ℝ → Y := fun t => g (spt W i p (ofs e₁ t)) + let r' : ℝ → Y := fun t => g (spt W j q (ofs e₂ t)) + have hm1 : ∀ t, spt W i p (ofs e₁ t) ∈ Dsk W := fun t => spt_mem hp _ + have hm2 : ∀ t, spt W j q (ofs e₂ t) ∈ Dsk W := fun t => spt_mem hq _ + have hrc : ContinuousOn r (Icc 0 1) := + hg.1.comp (continuous_spt_ofs W i p e₁).continuousOn fun t _ => hD' ▸ hm1 t + have hrc' : ContinuousOn r' (Icc 0 1) := + hg.1.comp (continuous_spt_ofs W j q e₂).continuousOn fun t _ => hD' ▸ hm2 t + have hr : ∀ t ∈ Icc (0 : ℝ) 1, ψ (r t) = extI (A e) t := fun t ht => by + simp only [r] + rw [hψ _ (hm1 t), h.f_side heE s.one (ofs_mem ht), ofs_ofs] + have hr' : ∀ t ∈ Icc (0 : ℝ) 1, ψ (r' t) = extI (A e) t := fun t ht => by + simp only [r'] + rw [hψ _ (hm2 t), h.f_side heE s.two (ofs_mem ht), ofs_ofs] + have hspe : ∀ τ, spe W (s.end₁ τ) = spt W i p (ofs e₁ (eo τ)) := fun τ + => by simp only [spe, EdgeSides.end₁, eo_xn] + have hspe' : ∀ τ, spe W (s.end₂ τ) = spt W j q (ofs e₂ (eo τ)) := fun τ + => by simp only [spe, EdgeSides.end₂, eo_xn] + have hneO : ∀ t ∈ Ioo (0 : ℝ) 1, r t ≠ r' t := by + intro t ht' he + have hpr := (hgeq (hm1 t) (hm2 t)).mp he + have hu := ofs_Ioo e₁ ht' + have hl' : (cutW W L i)[p]? = some (2 * Nat.pair i p + 1, e₁) := cut_get_iff.mpr ⟨_, s.one, + .inl ⟨hL0, rfl⟩⟩ + have hpr' : PRel (cutW W L) (spt (cutW W L) i p (ofs e₁ t)) (spt W j q (ofs e₂ t)) := by + rw [spt_cut] + exact hpr + have hfree := freeSide_cut (L := L) s.one hL0 + have heqs : spt W j q (ofs e₂ t) = spt W i p (ofs e₁ t) := by + rcases hpr'.eq_or_stp hP' hl' hu with h1 | h1 + · rw [h1, spt_cut] + · exfalso + obtain ⟨j', q', e', h2, h3, -⟩ := stp_of_side hP' hl' hu h1 + exact h3 (hfree _ _ _ _ _ hl' h2) + have h1 : j = i := congrArg Prod.fst heqs + subst h1 + have h2 : per (W j).length (q + ofs e₂ t) = per (W j).length (p + ofs e₁ t) + := congrArg Prod.snd heqs + obtain ⟨h3, -⟩ := side_unique hq hp (ofs_Ioo e₂ ht') (ofs_mem (Ioo_subset_Icc_self ht')) h2 + exact s.ne (by rw [h3]) + have hfillO : ∀ t ∈ Ioo (0 : ℝ) 1, ∀ z, ψ z = extI (A e) t → z = r t ∨ z = r' t := by + intro t ht' z hzt + obtain ⟨a, ha, rfl⟩ := hrep z + rw [hψ a ha] at hzt + have ht := Ioo_subset_Icc_self ht' + have hu := ofs_Ioo e₁ ht' + have hfx : f (spt W i p (ofs e₁ t)) = f a := by + rw [h.f_side heE s.one (ofs_mem ht), ofs_ofs, hzt] + have hpr := (h.pres.2.2 _ (hm1 t) _ ha).mp hfx + rcases hpr.eq_or_stp hP s.one hu with h1 | h1 + · exact .inl (by simp only [r]; rw [h1]) + · obtain ⟨j', q', e', h2, h3, h4⟩ := stp_of_side hP s.one hu h1 + rcases hP.third s.one s.two h2 s.ne with h5 | h5 + · exact absurd h5.symm h3 + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj h5 + have he' : e' = e₂ := by + rw [s.two] at h2 + simpa using h2.symm + subst he' + refine .inr ?_ + simp only [r'] + rw [h4, flp_ofs] + have hbdr : ∀ t ∈ Icc (0 : ℝ) 1, r t ∈ bd Y ∧ r' t ∈ bd Y := by + intro t ht + constructor + · rw [hbdY] + refine ⟨spt W i p (ofs e₁ t), ⟨i, p, ofs e₁ t, ?_, freeSide_cut s.one hL0, ofs_mem ht, + (spt_cut _ _ _).symm⟩, rfl⟩ + rw [cutW_length] + exact hp + · rw [hbdY] + refine ⟨spt W j q (ofs e₂ t), ⟨j, q, ofs e₂ t, ?_, freeSide_cut s.two hL0, ofs_mem ht, + (spt_cut _ _ _).symm⟩, rfl⟩ + rw [cutW_length] + exact hq + refine ⟨r, r', hrc, hrc', fun t ht => ⟨hr t ht, hr' t ht⟩, hbdr, ?_⟩ + rintro t ht (ht' | ⟨τ, rfl, hτ⟩) + · exact ⟨hneO t ht', hfillO t ht'⟩ + · refine ⟨fun he => ?_, fun z hzt => ?_⟩ + · have hpr := (hgeq (hm1 _) (hm2 _)).mp he + rw [← hspe, ← hspe'] at hpr + exact (hv τ hτ).1 hpr + · obtain ⟨a, ha, rfl⟩ := hrep z + rw [hψ a ha] at hzt + rcases (hv τ hτ).2 a ha hzt with h1 | h1 + · have := (hgeq (spe_mem _) ha).mpr h1 + rw [hspe] at this + exact .inl this.symm + · have := (hgeq (spe_mem _) ha).mpr h1 + rw [hspe'] at this + exact .inr this.symm + exact ⟨ψ, hψc, hsurj, hinj, hsurf, hψ, hrep, hkey⟩ + +/-- The cut surface over the union of a set `D` of edges, with two lifts of each edge. -/ +theorem WordEdges.cut_space (h : WordEdges W f V E A lab) {D : Set (Set S)} (hD : D ⊆ E) + (hsd : ∀ e ∈ D, ∃ (i p j q : ℕ) (e₁ e₂ : Bool), EdgeSides W (lab e) i p j q e₁ e₂) + (hcase : ∀ e ∈ D, ∀ τ, CutEndCondition A D e τ) + {Y : Type u} [TopologicalSpace Y] [T2Space Y] {g : ℕ × ℂ → Y} (hg : Presents (cutW W + (lab '' D)) g) : + ∃ ψ : Y → S, Continuous ψ ∧ Function.Surjective ψ ∧ InjOn ψ (ψ ⁻¹' (⋃₀ D)ᶜ) ∧ ψ ⁻¹' + (⋃₀ D) ⊆ bd Y ∧ IsSurface Y ∧ + ∀ e ∈ D, ∃ X X', LiftPair ψ e (extI (A e) 0) (extI (A e) 1) X X' := by + obtain ⟨ψ, hψ, hsurj, hinj, hsurf, -, -, hlift⟩ := h.lift_cut_edges hD hsd hg + have hlifts : ∀ e ∈ D, ∃ X X', LiftPair ψ e (extI (A e) 0) (extI (A e) 1) X X' ∧ + X ∪ X' ⊆ bd Y := by + intro e he + obtain ⟨r, r', hc, hc', hmaps, hbd, hsplit⟩ := hlift e he + have hall (t : ℝ) (ht : t ∈ Icc (0 : ℝ) 1) : + r t ≠ r' t ∧ ∀ z, ψ z = extI (A e) t → z = r t ∨ z = r' t := by + apply hsplit t ht + rcases lt_or_eq_of_le ht.1 with h0 | rfl + · rcases lt_or_eq_of_le ht.2 with h1 | rfl + · exact Or.inl ⟨h0, h1⟩ + · exact Or.inr ⟨true, rfl, hcase e he true⟩ + · exact Or.inr ⟨false, rfl, hcase e he false⟩ + have hfill : ∀ z, ψ z ∈ extI (A e) '' Icc 0 1 → z ∈ r '' Icc 0 1 ∪ r' '' Icc 0 1 := by + rintro z ⟨t, ht, hzt⟩ + rcases (hall t ht).2 z hzt.symm with hz | hz + · exact Or.inl ⟨t, ht, hz.symm⟩ + · exact Or.inr ⟨t, ht, hz.symm⟩ + have hpair := liftPair_of_maps (ψ := ψ) hc hc' (fun t ht => (hmaps t ht).1) + (fun t ht => (hmaps t ht).2) (extI_injOn (h.arc e (hD he)).1.2) + (fun t ht => (hall t ht).1) hfill + rw [image_extI, (h.arc e (hD he)).2.1] at hpair + refine ⟨_, _, hpair, ?_⟩ + rintro z (⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩) + · exact (hbd t ht).1 + · exact (hbd t ht).2 + refine ⟨ψ, hψ, hsurj, hinj, ?_, hsurf, ?_⟩ + · rintro z ⟨e, he, hz⟩ + obtain ⟨X, X', ⟨x0, x1, y0, y1, -, -, -, hcover, -⟩, hbd⟩ := hlifts e he + exact hbd (hcover ▸ hz) + · intro e he + obtain ⟨X, X', hpair, -⟩ := hlifts e he + exact ⟨X, X', hpair⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutGlue.lean b/LeanPool/GraphMinor/Surface/CutGlue.lean new file mode 100644 index 0000000000..9897dbcb07 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutGlue.lean @@ -0,0 +1,309 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutPieces +public import LeanPool.GraphMinor.Surface.WordCases + +/-! +# Gluing the sides of a word + +`ArcLift ψ F a ξ η` says that `ξ` and `η` are the two lifts of the path `a` around `F` to the +surface `S'` that arises by +cutting along `F`. If a word of `S'` has `ξ` and `η` as free sides, then the word with these two +sides pasted is a word of +the surface before cutting (`glue_word`). The rest of the file has the facts on labels and lifts +that all cases share. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function + +universe uu + +/-- `ξ` and `η` are the two lifts of the path `a` through the fibres of `ψ`. -/ +structure ArcLift {S' S : Type*} [TopologicalSpace S'] [TopologicalSpace S] (ψ : S' → S) + (F : Set S) (a : ℝ → S) + (ξ η : ℝ → S') : Prop where + cξ : ContinuousOn ξ (Icc 0 1) + cη : ContinuousOn η (Icc 0 1) + hξ : ∀ u ∈ Icc (0 : ℝ) 1, ψ (ξ u) = a u + hη : ∀ u ∈ Icc (0 : ℝ) 1, ψ (η u) = a u + img : a '' Icc 0 1 = F + fib : ∀ y y', ψ y = ψ y' → y ≠ y' → ∃ u ∈ Icc (0 : ℝ) 1, (y = ξ u ∧ y' = η u) ∨ (y' = ξ u ∧ y + = η u) + +theorem ArcLift.swap {S' S : Type*} [TopologicalSpace S'] [TopologicalSpace S] {ψ : S' + → S} {F : Set S} {a : ℝ → S} + {ξ η : ℝ → S'} (h : ArcLift ψ F a ξ η) : ArcLift ψ F a η ξ := + ⟨h.cη, h.cξ, h.hη, h.hξ, h.img, fun y y' h1 h2 => by + obtain ⟨u, hu, h3⟩ := h.fib y y' h1 h2 + exact ⟨u, hu, h3.elim (fun h4 => .inr h4.symm) fun h4 => .inl h4.symm⟩⟩ + +theorem rev_mem {u : ℝ} (hu : u ∈ Icc (0 : ℝ) 1) : 1 - u ∈ Icc (0 : ℝ) 1 + := ⟨by linarith [hu.2], by linarith [hu.1]⟩ + +/-- The same lifts, run backwards. -/ +theorem ArcLift.rev {S' S : Type*} [TopologicalSpace S'] [TopologicalSpace S] {ψ : S' + → S} {F : Set S} {a : ℝ → S} + {ξ η : ℝ → S'} (h : ArcLift ψ F a ξ η) : ArcLift ψ F (fun u => a (1 - u)) (fun u => ξ (1 - u)) + (fun u => η (1 - u)) := by + have hc : ContinuousOn (fun u : ℝ => 1 - u) (Icc 0 1) := by fun_prop + refine ⟨h.cξ.comp hc fun u hu => rev_mem hu, h.cη.comp hc fun u hu => rev_mem hu, + fun u hu => h.hξ _ (rev_mem hu), + fun u hu => h.hη _ (rev_mem hu), ?_, fun y y' h1 h2 => ?_⟩ + · rw [← h.img] + ext z + constructor + · rintro ⟨u, hu, rfl⟩ + exact ⟨_, rev_mem hu, rfl⟩ + · rintro ⟨u, hu, rfl⟩ + exact ⟨1 - u, rev_mem hu, by simp⟩ + · obtain ⟨u, hu, h3⟩ := h.fib y y' h1 h2 + refine ⟨1 - u, rev_mem hu, ?_⟩ + simpa using h3 + +theorem unique_of_cnt {w : List Letter} {k p q : ℕ} {e e' : Bool} (hc : cnt w k = 1) (h1 : w[p]? + = some (k, e)) + (h2 : w[q]? = some (k, e')) : p = q := by + induction w generalizing p q with + | nil => simp at h1 + | cons x w ih => + rw [cnt_cons] at hc + cases p with + | zero => + cases q with + | zero => rfl + | succ q => + have h3 : x = (k, e) := by simpa using h1 + rw [List.getElem?_cons_succ] at h2 + have h4 : 0 < cnt w k := by + have := cnt_pos (List.mem_of_getElem? h2) + simpa using this + rw [ite_eq_left (by rw [h3])] at hc + omega + | succ p => + cases q with + | zero => + have h3 : x = (k, e') := by simpa using h2 + rw [List.getElem?_cons_succ] at h1 + have h4 : 0 < cnt w k := by + have := cnt_pos (List.mem_of_getElem? h1) + simpa using this + rw [ite_eq_left (by rw [h3])] at hc + omega + | succ q => + rw [List.getElem?_cons_succ] at h1 h2 + have h5 : 0 < cnt w k := by + have := cnt_pos (List.mem_of_getElem? h1) + simpa using this + have hx : (if x.1 = k then 1 else 0) = 0 := by omega + rw [hx, zero_add] at hc + rw [ih hc h1 h2] + +theorem SideVal.at_word {T : Type*} {w : List Letter} {g : ℕ × ℂ → T} {k p : ℕ} {ρ : ℝ → T} + (h : SideVal (sW w) g k ρ) + (hw : w[p]? = some (k, true)) (hc : cnt w k = 1) : ∀ u ∈ Icc (0 : ℝ) 1, g + (0, sdPt w.length p true u) = ρ u := by + obtain ⟨i, q, h1, h2⟩ := h + obtain ⟨rfl, h3⟩ := sW_get h1 + obtain rfl := unique_of_cnt hc hw h3 + rw [sW_zero] at h2 + exact h2 + +theorem sdPt_ofs (n p : ℕ) (σ : Bool) (t : ℝ) : sdPt n p σ t = sdPt n p true (ofs σ t) := by + cases σ <;> simp [sdPt, ofs] + +/-- The word with two free sides pasted presents the surface before cutting. -/ +theorem glue_word {S' S : Type*} [TopologicalSpace S'] [TopologicalSpace S] {ψ : S' + → S} {F : Set S} {a : ℝ → S} + {ξ η : ℝ → S'} (L : ArcLift ψ F a ξ η) (hψ : Continuous ψ) (hsurj : Surjective ψ) {A B : List + Letter} {p q p₁ : ℕ} {σ : Bool} + (hp1 : (A ++ (q, true) :: B)[p₁]? = some (p, true)) (hne : p₁ ≠ A.length) + (hc1 : cnt (A ++ (q, true) :: B) q = 1) (hc2 : cnt (A ++ (q, true) :: B) p = 1) {g : ℕ × ℂ → S'} + (hg : Presents (sW (A ++ (q, true) :: B)) g) (hsξ : SideVal (sW (A ++ + (q, true) :: B)) g p ξ) {ζ : ℝ → S'} + (hsη : SideVal (sW (A ++ (q, true) :: B)) g q ζ) (hζ : ∀ u ∈ Icc (0 : ℝ) 1, ζ (ofs σ u) = η u) : + Presents (sW (A ++ (p, σ) :: B)) (ψ ∘ g) ∧ SideVal (sW (A ++ (p, σ) :: B)) (ψ ∘ g) p a := by + set w := A ++ (q, true) :: B with hw + set w₁ := A ++ (p, σ) :: B with hw₁ + have hl : w₁.length = w.length := by simp [hw, hw₁] + have hget : ∀ n, n ≠ A.length → w₁[n]? = w[n]? := by + intro n hn + rw [hw, hw₁] + by_cases h1 : n < A.length + · rw [List.getElem?_append_left h1, List.getElem?_append_left h1] + · have h2 : A.length ≤ n := not_lt.mp h1 + rw [List.getElem?_append_right h2, List.getElem?_append_right h2] + obtain ⟨m, hm⟩ : ∃ m, n - A.length = m + 1 := ⟨n - A.length - 1, by omega⟩ + rw [hm] + simp + have hq0 : w[A.length]? = some (q, true) := by simp [hw] + have hq1 : w₁[A.length]? = some (p, σ) := by simp [hw₁] + have h3 := hsξ.at_word hp1 hc2 + have h4 := hsη.at_word hq0 hc1 + have h5 : ∀ t ∈ Icc (0 : ℝ) 1, g (0, sdPt w.length A.length σ t) = η t := fun t ht => by + rw [sdPt_ofs, h4 _ (ofs_mem ht), hζ t ht] + have hsW : ∀ {v : List Letter}, (sW v 0) = v := fun {v} => sW_zero v + refine ⟨presents_glue (W := sW w) (W₁ := sW w₁) (i₀ := 0) (q₀ := A.length) (i₁ := 0) (p₁ := p₁) + (p := p) (q := q) + (σ := σ) (ε₀ := true) (ε₁ := true) hg hψ hsurj ?_ (by rw [hsW]; exact hq0) + (by rw [hsW]; exact hq1) + (by rw [hsW]; exact hp1) (by simp [hne]) ?_ ?_ ?_ ?_ ?_, ?_⟩ + · intro i n hn + by_cases hi : i = 0 + · subst hi + rw [hsW, hsW] + exact hget n fun e => hn (by rw [e]) + · simp [sW, update_of_ne hi, nW] + · intro i + by_cases hi : i = 0 + · subst hi + rw [hsW, hsW, hl] + · simp [sW, update_of_ne hi, nW] + · intro j m e h + obtain ⟨rfl, h6⟩ := sW_get h + rw [unique_of_cnt hc1 h6 hq0] + · intro j m e h + obtain ⟨rfl, h6⟩ := sW_get h + rw [unique_of_cnt hc2 h6 hp1] + · intro t ht + rw [hsW, h3 t ht, h5 t ht, L.hξ t ht, L.hη t ht] + · intro x _ y _ h6 h7 + obtain ⟨t, ht, h8⟩ := L.fib _ _ h6 h7 + refine ⟨t, ht, ?_⟩ + rw [hsW, h3 t ht, h5 t ht] + exact h8 + · refine ⟨0, p₁, ?_, fun u hu => ?_⟩ + · rw [hsW, hget p₁ hne] + exact hp1 + · simp only [Function.comp_apply, hsW, hl] + rw [h3 u hu, L.hξ u hu] + +/-! ### Labels of the rest of the word -/ + +theorem noLab_rW {a b c k : ℕ} {L : List ℕ} (h1 : 2 * a + b ≤ k) (h2 : k ≠ 2 * a + b + 2 * c) + (h3 : ∀ m ∈ L, k ≠ 2 * a + b + 2 * m ∧ k ≠ 2 * a + b + 2 * m + 1) : NoLab (rW a b c L) k := by + refine noLab_append.mpr ⟨noLab_append.mpr ⟨noLab_append.mpr ⟨fun l hl he => ?_, + fun l hl he => ?_⟩, noLab_hlW h3⟩, ?_⟩ + · have := (hW_labels 0 a l hl).2 + omega + · have := (cW_labels (2 * a) b l hl).2 + omega + · intro l hl he + simp only [eW, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl <;> exact h2 he.symm + +/-- The state of a word that starts with `R`. -/ +theorem inv_of_model {a b : ℕ} {L : List ℕ} (hL : L.Nodup) {R : List Letter} (hG : Good R) + (hR : ∀ l ∈ R, 2 * a + b ≤ l.1 ∧ ∀ m ∈ L, l.1 ≠ 2 * a + b + 2 * m + ∧ l.1 ≠ 2 * a + b + 2 * m + 1) : + Inv R (hW 0 a) (cW (2 * a) b) (hlW (2 * a + b) L) a b L.length := by + refine ⟨hL_hW _ _, cL_cW _ _, tL_hlW _ hL, ?_, ?_, ?_, ?_, ?_, ?_, hG⟩ + · intro l hl m hm he + have h1 := (hW_labels _ _ l hl).2 + have h2 := (cW_labels _ _ m hm).1 + omega + · intro l hl + have h1 := (hW_labels _ _ l hl).2 + exact noLab_hlW fun m _ => by omega + · intro l hl + have h1 := (cW_labels _ _ l hl).2 + exact noLab_hlW fun m _ => by omega + · intro l hl m hm he + have h1 := (hW_labels _ _ l hl).2 + have h2 := (hR m hm).1 + omega + · intro l hl m hm he + have h1 := (cW_labels _ _ l hl).2 + have h2 := (hR m hm).1 + omega + · intro l hl m hm he + obtain ⟨n, h1, h2⟩ := hlW_labels l hl + have h3 := (hR m hm).2 n h1 + omega + +/-- The word with a block in front is equivalent to the word with `E` and the block in front. -/ +theorem weq_front (a b c : ℕ) (L : List ℕ) (R : List Letter) : + WEq.{uu} (R ++ rW a b c L) (eW a b c ++ R ++ hW 0 a ++ cW (2 * a) b ++ hlW (2 * a + b) L) := by + refine WEq.rot' (R ++ hW 0 a ++ cW (2 * a) b ++ hlW (2 * a + b) L) (eW a b c) (by simp [rW]) + (by simp) + +/-! ### Lifts on the real line -/ + +/-- The linear map from `p` to `q`. -/ +def lin (p q u : ℝ) : ℝ := p + (q - p) * u + +theorem continuousOn_lin (p q : ℝ) : ContinuousOn (lin p q) (Icc 0 1) := by + unfold lin + fun_prop + +theorem strictMonoOn_lin {p q : ℝ} (h : p < q) : StrictMonoOn (lin p q) (Icc 0 1) + := fun x _ y _ hxy => by + unfold lin + nlinarith + +theorem lin_zero (p q : ℝ) : lin p q 0 = p := by simp [lin] + +theorem lin_one (p q : ℝ) : lin p q 1 = q := by simp [lin] + +theorem lin_mem {p q u : ℝ} (hu : u ∈ Ioo (0 : ℝ) 1) (hlt : p < q) : + lin p q u ∈ Ioo p q := by + unfold lin + constructor <;> nlinarith [hu.1, hu.2] + +/-- A lift of an injective path stays below a full turn. -/ +theorem lift_lt_add_one {m : ℝ → ℝ} (hc : ContinuousOn m (Icc 0 1)) + (hi : InjOn (fun u => ee (m u)) (Icc 0 1)) : m 1 < m 0 + 1 := by + by_contra h + push Not at h + have h0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + obtain ⟨v, hv, he⟩ := intermediate_value_Icc zero_le_one hc (show m 0 + 1 ∈ Icc (m 0) + (m 1) from ⟨by linarith, h⟩) + have h1 : ee (m v) = ee (m 0) := by + rw [he] + exact ee_add_one _ + have h2 := hi hv h0 h1 + rw [h2] at he + linarith + +/-- The two lifts of disjoint paths fit into one turn, after a shift by an integer. -/ +theorem exists_shift {m n : ℝ → ℝ} (hc : ContinuousOn m (Icc 0 1)) (hn : ContinuousOn n (Icc 0 1)) + (hd : ∀ u ∈ Icc (0 : ℝ) 1, ∀ v ∈ Icc (0 : ℝ) 1, ee (m u) ≠ ee (n v)) : + ∃ k : ℤ, m 1 < n 0 + k ∧ n 1 + k < m 0 + 1 := by + have h0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have h1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + set k := ⌈m 0 - n 0⌉ with hk + have h2 : m 0 ≤ n 0 + k := by + have := Int.le_ceil (m 0 - n 0) + linarith + have h3 : n 0 + k < m 0 + 1 := by + have := Int.ceil_lt_add_one (m 0 - n 0) + linarith + refine ⟨k, ?_, ?_⟩ + · by_contra h + push Not at h + obtain ⟨v, hv, he⟩ := intermediate_value_Icc zero_le_one hc (show n 0 + k ∈ Icc (m 0) + (m 1) from ⟨h2, h⟩) + exact hd v hv 0 h0 (by rw [he, ee_add_int]) + · by_contra h + push Not at h + have hc' : ContinuousOn (fun u => n u + (k : ℝ)) (Icc 0 1) := hn.add continuousOn_const + obtain ⟨v, hv, he⟩ := intermediate_value_Icc zero_le_one hc' + (show m 0 + 1 ∈ Icc (n 0 + k) (n 1 + k) from ⟨h3.le, h⟩) + have h4 : ee (n v) = ee (m 0) := by + rw [← ee_add_int (n v) k] + simp only at he + rw [he, ee_add_one] + exact hd 0 h0 v hv h4.symm + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutGraph.lean b/LeanPool/GraphMinor/Surface/CutGraph.lean new file mode 100644 index 0000000000..9aa00fb308 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutGraph.lean @@ -0,0 +1,229 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Classification + +/-! +# Dissections that contain a given arc + +To cut a surface along an arc or an `O`-arc `F`, we first dissect the surface so that `F` lies in +the graph of the +dissection. We add `F` to the graph of the cuffs and run the proof of `exists_surface_dissection` +(`exists_dissection_with`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +local notation "𝕀" => unitInterval + +variable {X : Type u} [TopologicalSpace X] [T2Space X] + +omit [T2Space X] in +/-- Adding a line with two distinct ends in a set keeps it connected after removing a point. -/ +theorem TwoConn.add_line {G L : Set X} (hG : TwoConn G) {s t : X} (hl : IsLineWithEnds L s t) + (hs : s ∈ G) (ht : t ∈ G) + (hne : s ≠ t) : TwoConn (G ∪ L) := by + classical + intro p + obtain ⟨a, ha, rfl, rfl, rfl⟩ := hl.exists_arc + have hemb := fun (I : Set 𝕀) (hI : IsPreconnected I) => hI.image a ha.1.continuousOn + have hbase : ((G \ {p})).Nonempty := by + by_cases h : a 0 = p + · exact ⟨a 1, ht, fun h' => hne (h.trans h'.symm)⟩ + · exact ⟨a 0, hs, fun h' => h h'⟩ + have hB : ∀ z ∈ (G ∪ range a) \ {p}, ∃ B : Set X, IsPreconnected B ∧ z ∈ B ∧ B ⊆ + (G ∪ range a) \ {p} ∧ + (B ∩ (G \ {p})).Nonempty := by + rintro z ⟨hz | ⟨r, rfl⟩, hzp⟩ + · exact ⟨G \ {p}, hG p, ⟨hz, hzp⟩, fun y hy => ⟨.inl hy.1, hy.2⟩, ⟨z, ⟨hz, hzp⟩, hz, hzp⟩⟩ + · by_cases hp : ∃ c, a c = p + · obtain ⟨c, rfl⟩ := hp + have hrc : r ≠ c := fun h => hzp (by rw [h]; rfl) + rcases lt_or_gt_of_ne hrc with h | h + · refine ⟨a '' Iic r, hemb _ isPreconnected_Iic, ⟨r, le_rfl, rfl⟩, ?_, ⟨a 0, ⟨0, + unitInterval.nonneg', rfl⟩, hs, ?_⟩⟩ + · rintro _ ⟨y, hy, rfl⟩ + exact ⟨.inr ⟨y, rfl⟩, fun he => (lt_of_le_of_lt hy h).ne (congrArg Subtype.val + (ha.2 he))⟩ + · intro he + have hzero : (0 : 𝕀) ≤ r := unitInterval.nonneg' + exact (lt_of_le_of_lt hzero h).ne (ha.2 he) + · refine ⟨a '' Ici r, hemb _ isPreconnected_Ici, ⟨r, le_rfl, rfl⟩, ?_, ⟨a 1, ⟨1, + unitInterval.le_one', rfl⟩, ht, ?_⟩⟩ + · rintro _ ⟨y, hy, rfl⟩ + exact ⟨.inr ⟨y, rfl⟩, fun he => (lt_of_lt_of_le h hy).ne' (ha.2 he)⟩ + · exact fun he => (lt_of_lt_of_le h (show r ≤ 1 from unitInterval.le_one')).ne' (ha.2 he) + · refine ⟨range a, ?_, ⟨r, rfl⟩, ?_, ⟨a 0, ⟨0, rfl⟩, hs, fun he => hp ⟨0, he⟩⟩⟩ + · rw [← image_univ] + exact hemb _ isPreconnected_univ + · rintro _ ⟨y, rfl⟩ + exact ⟨.inr ⟨y, rfl⟩, fun he => hp ⟨y, he⟩⟩ + refine isPreconnected_of_forall_pair fun x hx y hy => ?_ + obtain ⟨B, hB1, hB2, hB3, hB4⟩ := hB x hx + obtain ⟨B', hB1', hB2', hB3', hB4'⟩ := hB y hy + have hsub : G \ {p} ⊆ (G ∪ range a) \ {p} := fun z hz => ⟨.inl hz.1, hz.2⟩ + refine ⟨B ∪ (G \ {p}) ∪ B', union_subset (union_subset hB3 hsub) hB3', .inl (.inl hB2), + .inr hB2', ?_⟩ + refine IsPreconnected.union' ?_ (hB1.union' hB4 (hG p)) hB1' + obtain ⟨w, hw1, hw2⟩ := hB4' + exact ⟨w, .inr hw2, hw1⟩ + +section pull + +variable {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] [T2Space S] [T2Space T] {j : S + → T} + +omit [T2Space S] in +omit [T2Space T] in +/-- A point of the surface on an edge of a dissection of the closed surface lies on a pulled edge or +vertex. -/ +theorem mem_pull_gr (hj : IsClosedEmbedding j) {K : Set T} (hK : IsClosed K) (hu : range j ∪ K + = univ) + (hi : range j ∩ K = j '' bd S) {V : Set T} {E 𝓕 : Set (Set T)} (hd : IsDissection V E 𝓕) + (hb : j '' bd S ⊆ ⋃₀ {e ∈ E | e ⊆ range j}) {x : S} (hx : j x ∈ gr V E) : + x ∈ gr (j ⁻¹' V) ((fun e => j ⁻¹' e) '' {e ∈ E | e ⊆ range j}) := by + rcases hx with hx | ⟨e, he, hxe⟩ + · exact .inl hx + by_cases hxV : j x ∈ V + · exact .inl hxV + have hg := hd.graph + have hconn := hg.isPreconnected_open he + have hin : e ⊆ range j := by + by_cases hmeet : ∃ y ∈ e \ V, y ∈ range j ∩ K + · obtain ⟨y, hy, hyr⟩ := hmeet + rw [hi] at hyr + obtain ⟨e', he', hye'⟩ := hb hyr + have hee : e = e' := by + by_contra hc + exact hy.2 (hg.disj e he e' he'.1 hc ⟨hy.1, hye'⟩) + rw [hee] + exact he'.2 + · have hsub : e \ V ⊆ range j := by + intro z hz + by_contra hzr + have hzK : z ∈ K := (hu ▸ mem_univ z : z ∈ range j ∪ K).resolve_left hzr + obtain ⟨w, hw, hw1, hw2⟩ := isPreconnected_closed_iff.mp hconn _ _ hj.isClosed_range hK + (fun y _ => hu ▸ mem_univ y) ⟨j x, ⟨hxe, hxV⟩, x, rfl⟩ ⟨z, hz, hzK⟩ + exact hmeet ⟨w, hw, hw1, hw2⟩ + exact (hg.subset_closure_open he).trans (closure_minimal hsub hj.isClosed_range) + exact .inr ⟨_, ⟨e, ⟨he, hin⟩, rfl⟩, hxe⟩ + +end pull + +variable {S : Type u} [TopologicalSpace S] + +/-- A dissection containing a graph whose edges cover a finite family of circles and lines. +The circles contain the cuffs, and each line has two distinct endpoints on the circles. -/ +theorem exists_dissection_with_lines (hS : IsSurface S) [ConnectedSpace S] + {V₀ : Set S} {E₀ 𝓐 𝓛 : Set (Set S)} (hg : IsGraph V₀ E₀) + (hV₀ : V₀ ⊆ ⋃₀ E₀) (h𝓐 : 𝓐.Finite) (h𝓛 : 𝓛.Finite) + (hO𝓐 : ∀ C ∈ 𝓐, IsOArc C) (hcu : cuffs S ⊆ 𝓐) + (hline : ∀ L ∈ 𝓛, ∃ s t, s ≠ t ∧ IsLineWithEnds L s t ∧ s ∈ ⋃₀ 𝓐 ∧ t ∈ ⋃₀ 𝓐) + (hc : ⋃₀ E₀ = ⋃₀ 𝓐 ∪ ⋃₀ 𝓛) : + ∃ (V : Set S) (E 𝓕 : Set (Set S)), IsDissection V E 𝓕 ∧ V₀ ⊆ V ∧ ⋃₀ E₀ ⊆ gr V E := by + classical + obtain ⟨hcpt, ht2, hman⟩ := id hS + obtain ⟨T, _, j, K, hT, hj, hK, hu, hi, hconn⟩ := exists_capAll S hS + have := hconn inferInstance + have : T2Space T := hT.2.1 + have hgT := hg.map hj.isEmbedding + have hsU : ⋃₀ ((fun e => j '' e) '' E₀) = j '' ⋃₀ E₀ := by + rw [sUnion_image, sUnion_eq_biUnion, image_iUnion₂] + have hsA : ⋃₀ ((fun C => j '' C) '' 𝓐) = j '' ⋃₀ 𝓐 := by + rw [sUnion_image, sUnion_eq_biUnion, image_iUnion₂] + obtain ⟨ρ, hρ, hl⟩ := exists_inv_of_compactOn (isCompact_univ (X := S)) hj.continuous.continuousOn + hj.injective.injOn + have hOT : ∀ C ∈ 𝓐, IsOArc (j '' C) := fun C hC => + (hO𝓐 C hC).image hj.continuous.continuousOn (hρ.mono (image_mono (subset_univ _))) + (fun x _ => hl (mem_univ x)) + obtain ⟨V, E, 𝓕, hVV, hsub, hd⟩ := exists_dissection hT hgT (image_mono hV₀ |>.trans (by + rintro _ ⟨y, ⟨e, he, hy⟩, rfl⟩ + exact ⟨_, ⟨e, he, rfl⟩, mem_image_of_mem j hy⟩)) (𝓒c := (fun C => j '' C) '' 𝓐) + (h𝓐.image _) + (by + rintro _ ⟨C, hC, rfl⟩ + exact (hOT C hC).twoConn) + (by + rintro _ ⟨C, hC, rfl⟩ + exact (hOT C hC).exists_three) + (by + intro G hG hm + have h1 := hG.sUnion_add (h𝓐.image _) (by + rintro _ ⟨C, hC, rfl⟩ + exact (hOT C hC).twoConn) hm + rw [hsU] + rw [hsA] at h1 + have key : ∀ 𝓛' : Set (Set S), 𝓛'.Finite → 𝓛' ⊆ 𝓛 → TwoConn (G ∪ j '' ⋃₀ 𝓐 ∪ j '' ⋃₀ 𝓛') := by + intro 𝓛' h𝓛' + induction 𝓛', h𝓛' using Set.Finite.induction_on with + | empty => + intro _ + simpa using h1 + | @insert L 𝓛' hL hfin ih => + intro hsub + obtain ⟨s, t, hne, hl, hs, ht⟩ := hline L (hsub (mem_insert _ _)) + have h2 := (ih ((subset_insert _ _).trans hsub)).add_line (hl.map_of_embedding + hj.isEmbedding) + (.inl (.inr (mem_image_of_mem j hs))) (.inl (.inr (mem_image_of_mem j ht))) + (fun he => hne (hj.injective he)) + rw [sUnion_insert, union_comm L, image_union, ← union_assoc] + exact h2 + have h3 := key 𝓛 h𝓛 subset_rfl + rw [hc, image_union, ← union_assoc] + exact h3) + rw [hsU] at hsub + have hbd : bd S ⊆ ⋃₀ 𝓐 := by + rw [← sUnion_cuffs] + exact sUnion_mono hcu + have hsub2 : ⋃₀ 𝓐 ⊆ ⋃₀ E₀ := by + rw [hc] + exact subset_union_left + have hb0 : j '' bd S ⊆ ⋃₀ E := (image_mono (hbd.trans hsub2)).trans hsub + have hb1 : j '' bd S ⊆ ⋃₀ {e ∈ E | e ⊆ range j} := by + rintro _ ⟨x, hx, rfl⟩ + have hx' : x ∈ ⋃₀ cuffs S := sUnion_cuffs (S := S) ▸ hx + obtain ⟨C, hC, hxC⟩ := hx' + have hne : Nonempty T := ⟨j x⟩ + have hC' := hOT C (hcu hC) + have hsubC : j '' C ⊆ ⋃₀ E := + (image_mono (subset_sUnion_of_mem (hcu hC) |>.trans hsub2)).trans hsub + obtain ⟨e, he, hxe⟩ := hd.graph.subset_edges hC' hsubC (mem_image_of_mem j hxC) + exact ⟨e, ⟨he.1, he.2.trans (image_subset_range _ _)⟩, hxe⟩ + refine ⟨_, _, _, pull_dissection hman hj hK hu hi hd hb0, ?_, ?_⟩ + · intro x hx + exact hVV (mem_image_of_mem j hx) + · intro x hx + exact mem_pull_gr hj hK hu hi hd hb1 (.inr (hsub (mem_image_of_mem j hx))) + +/-- A dissection of a connected surface whose graph contains the union of some `O`-arcs and possibly +one line. -/ +theorem exists_dissection_with (hS : IsSurface S) [ConnectedSpace S] {V₀ : Set S} {E₀ 𝓐 : Set + (Set S)} (hg : IsGraph V₀ E₀) + (hV₀ : V₀ ⊆ ⋃₀ E₀) (h𝓐 : 𝓐.Finite) (hO𝓐 : ∀ C ∈ 𝓐, IsOArc C) (hcu : cuffs S ⊆ 𝓐) + (hcase : ⋃₀ E₀ = ⋃₀ 𝓐 ∨ ∃ L s t, ⋃₀ E₀ = ⋃₀ 𝓐 ∪ L ∧ IsLineWithEnds L s t ∧ s ≠ t ∧ s ∈ ⋃₀ 𝓐 + ∧ t ∈ ⋃₀ 𝓐) : + ∃ (V : Set S) (E 𝓕 : Set (Set S)), IsDissection V E 𝓕 ∧ V₀ ⊆ V ∧ ⋃₀ E₀ ⊆ gr V E := by + rcases hcase with hE | ⟨L, s, t, hE, hline, hne, hs, ht⟩ + · refine exists_dissection_with_lines (𝓛 := ∅) hS hg hV₀ h𝓐 finite_empty hO𝓐 hcu ?_ ?_ + · exact fun _ h => h.elim + · simpa using hE + · refine exists_dissection_with_lines (𝓛 := {L}) hS hg hV₀ h𝓐 (finite_singleton L) hO𝓐 hcu ?_ ?_ + · intro M hM + obtain rfl := mem_singleton_iff.mp hM + exact ⟨s, t, hne, hline, hs, ht⟩ + · simpa using hE + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutIArc.lean b/LeanPool/GraphMinor/Surface/CutIArc.lean new file mode 100644 index 0000000000..48e7c2bfce --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutIArc.lean @@ -0,0 +1,420 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutTwoArc + +/-! +# Cutting along an `I`-arc + +We prove `CutIArcStatement` (`cutIArc`). The surface `S'` comes from `exists_cut_arc`. We classify +its components by +`classification`, and write `S` as a word of `S'` with the two lifts of the arc pasted. The normal +form of this word shows +which surface `S` is. This is the classical cut and paste proof of the classification theorem, as in +Massey, *Algebraic +Topology: an Introduction*, Chapter 1, Section 7. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function + +universe u + +/-! ### The closed disc -/ + +/-- The unit disc with one side. -/ +noncomputable def discMap : ℕ × ℂ → Metric.closedBall (0 : ℂ) 1 := fun a => + if h : ‖a.2‖ ≤ 1 then ⟨a.2, by simpa using h⟩ else ⟨0, by simp⟩ + +theorem prel_one {a b : ℕ × ℂ} {k : ℕ} {e : Bool} (h : PRel (sW [(k, e)]) a b) : a = b := by + induction h with + | rel x y hs => + exfalso + obtain ⟨i, j, p, q, c, ε, ε', t, h1, h2, h3, -⟩ := hs + obtain ⟨rfl, h4⟩ := sW_get h1 + obtain ⟨rfl, h5⟩ := sW_get h2 + have hp : p = 0 := by + by_contra hne + obtain ⟨m, rfl⟩ := Nat.exists_eq_succ_of_ne_zero hne + simp at h4 + have hq : q = 0 := by + by_contra hne + obtain ⟨m, rfl⟩ := Nat.exists_eq_succ_of_ne_zero hne + simp at h5 + exact h3 (by rw [hp, hq]) + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + +theorem presents_disc (k : ℕ) (e : Bool) : Presents (sW [(k, e)]) discMap := by + have hD : ∀ a, a ∈ Dsk (sW [(k, e)]) ↔ a.1 = 0 ∧ ‖a.2‖ ≤ 1 := fun a => by + constructor + · intro h + have := mem_Dsk_sW h + exact ⟨this.1, this.2.2⟩ + · rintro ⟨h1, h2⟩ + refine ⟨?_, h2⟩ + rw [h1, sW_zero] + simp + refine ⟨?_, ?_, ?_⟩ + · refine continuousOn_iff_continuous_domRestrict.mpr ?_ + refine Continuous.subtype_mk (f := fun a : Dsk (sW [(k, e)]) => a.1.2) (by fun_prop) (fun a + => by simpa using ((hD _).mp a.2).2) |>.congr ?_ + rintro ⟨a, ha⟩ + simp [discMap, ((hD _).mp ha).2, domRestrict_apply] + · refine eq_univ_of_forall fun z => ?_ + have hz : ‖z.1‖ ≤ 1 := mem_closedBall_zero_iff.mp z.2 + exact ⟨(0, z.1), (hD _).mpr ⟨rfl, hz⟩, by simp [discMap, hz]⟩ + · intro a ha b hb + refine ⟨fun he => ?_, fun hp => by rw [prel_one hp]⟩ + obtain ⟨h1, h2⟩ := (hD _).mp ha + obtain ⟨h3, h4⟩ := (hD _).mp hb + simp only [discMap, h2, h4, dite_true, Subtype.mk.injEq] at he + rw [show a = b from Prod.ext (h1.trans h3.symm) he] + exact .refl _ + +/-- The model with one hole is a closed disc. -/ +theorem nonempty_disc_homeo : Nonempty (SurfaceModel 0 0 1 ≃ₜ ClosedUnitDisc) := by + obtain ⟨e⟩ := isClosedDisc_closedBall.1 + have hn : IsNF (holB (0, false) (1, true)) 0 0 1 := + ⟨[], [], holB (0, false) (1, true), by simp, .nil, .nil, .cons _ _ (by simp) + (by simp [DisjL, NoLab]) .nil, + by simp [DisjL, NoLab], by simp [DisjL, NoLab], by simp [DisjL, NoLab]⟩ + have h1 : WEq.{0} [(1, true)] [((0 : ℕ), true), (0, false), (1, true)] := + WEq.fold (0, true) (by simp) (by simp [NoLab]) + have h2 : WEq.{0} [((0 : ℕ), true), (0, false), (1, true)] (holB (0, false) (1, true)) := + WEq.rot' [(0, true)] [(0, false), (1, true)] rfl rfl + have : Nonempty (Metric.closedBall (0 : ℂ) 1) := ⟨⟨0, by simp⟩⟩ + obtain ⟨e'⟩ := homeo_of_nf (presents_disc 1 true) hn (h1.trans h2) + exact ⟨e'.symm.trans e.symm⟩ + +/-! ### Simpler surfaces -/ + +section + +variable {Y S : Type u} [TopologicalSpace Y] [TopologicalSpace S] + +theorem cutIsSimpler_of_connected [ConnectedSpace Y] {a b c a' b' c' : ℕ} + (e : Y ≃ₜ SurfaceModel a b c) + (e' : S ≃ₜ SurfaceModel a' b' c') (h1 : a ≤ a') (h2 : b ≤ b') + (h3 : 4 * a + 2 * b + c < 4 * a' + 2 * b' + c') : CutIsSimpler Y S := by + have h4 : spaceComponents Y = {univ} := by + rw [spaceComponents_eq] + ext C + simp only [mem_range, mem_singleton_iff] + constructor + · rintro ⟨x, rfl⟩ + exact PreconnectedSpace.connectedComponent_eq_univ x + · rintro rfl + obtain ⟨x⟩ : Nonempty Y := inferInstance + exact ⟨x, PreconnectedSpace.connectedComponent_eq_univ x⟩ + refine ⟨by rw [h4]; simp, fun C hC => ?_⟩ + rw [h4] at hC + obtain rfl : C = univ := hC + exact ⟨a, b, c, a', b', c', ⟨(Homeomorph.Set.univ Y).trans e⟩, ⟨e'⟩, h1, h2, h3⟩ + +theorem cutIsSimpler_of_two {W₁ W₂ : Set Y} (hC : spaceComponents Y = {W₁, W₂}) {a b c a₂ b₂ c₂ a' + b' c' : ℕ} (e : W₁ ≃ₜ SurfaceModel a b c) + (e₂ : W₂ ≃ₜ SurfaceModel a₂ b₂ c₂) (e' : S ≃ₜ SurfaceModel a' b' c') (h1 : a ≤ a') (h2 : b ≤ b') + (h3 : 4 * a + 2 * b + c < 4 * a' + 2 * b' + c') (h1' : a₂ ≤ a') (h2' : b₂ ≤ b') + (h3' : 4 * a₂ + 2 * b₂ + c₂ < 4 * a' + 2 * b' + c') : CutIsSimpler Y S := by + refine ⟨by rw [hC]; exact (encard_insert_le _ _).trans (by simp [one_add_one_eq_two]), fun C hC' + => ?_⟩ + rw [hC] at hC' + rcases hC' with rfl | rfl + · exact ⟨a, b, c, a', b', c', ⟨e⟩, ⟨e'⟩, h1, h2, h3⟩ + · exact ⟨a₂, b₂, c₂, a', b', c', ⟨e₂⟩, ⟨e'⟩, h1', h2', h3'⟩ + +variable [CompactSpace Y] [T2Space Y] [T2Space S] {ψ : Y → S} {F : Set S} {a₀ : ℝ → S} {ξ η : ℝ → Y} + +omit [T2Space Y] in +/-- The rest of the cuff of a lift joins the two ends of the arc in the boundary. -/ +theorem same_of_cuff (hψ : IsCutting ψ F) (hF : IsClosed F) (L : ArcLift ψ F a₀ ξ η) {C : Set Y} + (hCb : C ⊆ bd Y) (φ : Circle ≃ₜ C) + (hξ : ∀ u ∈ Icc (0 : ℝ) 1, ξ u ∈ C) (hiξ : InjOn ξ (Icc 0 1)) (hiη : InjOn η (Icc 0 1)) + (hη : ∀ u ∈ Icc (0 : ℝ) 1, η u ∉ C) + (hu : ψ ⁻¹' F = ξ '' Icc 0 1 ∪ η '' Icc 0 1) (h0 : a₀ 0 ∈ bd S) (h1 : a₀ 1 ∈ bd S) : + connectedComponentIn (bd S) (a₀ 0) = connectedComponentIn (bd S) (a₀ 1) := by + obtain ⟨a', ξ', η', m, L', ha', hxim, heim, hix, hie, hmc, hmm, hmξ⟩ := orient_lift L φ hξ hiξ hiη + have hlt := lift_lt_add_one hmc (inj_of_lift hmξ hix) + have m0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have m1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hc : ContinuousOn (fun u => (φ (ee (lin (m 1) (m 0 + 1) u))).1) (Icc 0 1) := by + refine continuous_subtype_val.comp_continuousOn (φ.continuous.comp_continuousOn ?_) + exact continuous_ee.comp_continuousOn (continuousOn_lin _ _) + have key := same_cuff_of_curve hψ hF hc (fun u _ => hCb (φ _).2) (fun u hu' hmem => ?_) ?_ ?_ + · simp only [lin_zero, lin_one, ee_add_one] at key + rw [hmξ 1 m1, L'.hξ 1 m1] at key + rw [hmξ 0 m0, L'.hξ 0 m0] at key + rcases ha' with ⟨h2, h3⟩ | ⟨h2, h3⟩ + · rw [← h2, ← h3] + exact key.symm + · rw [← h2, ← h3] + exact key + · have hv : lin (m 1) (m 0 + 1) u ∈ Ioo (m 1) (m 0 + 1) := lin_mem hu' hlt + have hm' : (φ (ee (lin (m 1) (m 0 + 1) u))).1 ∈ ψ ⁻¹' F := hmem + rw [hu, ← hxim, ← heim] at hm' + rcases hm' with ⟨v, hv1, hv2⟩ | ⟨v, hv1, hv2⟩ + · have h7 : φ (ee (m v)) = φ (ee (lin (m 1) (m 0 + 1) u)) := Subtype.ext ((hmξ v hv1).trans hv2) + have h8 := φ.injective h7 + have h9 := hmm.monotoneOn hv1 m1 hv1.2 + have h10 := hmm.monotoneOn m0 hv1 hv1.1 + exact ee_ne (x := m v) (y := lin (m 1) (m 0 + 1) u) (by linarith [hv.1]) + (by linarith [hv.2]) h8 + · have h7 : η' v ∈ η '' Icc 0 1 := heim ▸ ⟨v, hv1, rfl⟩ + obtain ⟨w, hw, hw'⟩ := h7 + exact hη w hw (by rw [hw', hv2]; exact (φ _).2) + · simp only [lin_zero] + rw [hmξ 1 m1, L'.hξ 1 m1] + rcases ha' with ⟨-, h3⟩ | ⟨-, h3⟩ <;> rw [h3] <;> assumption + · simp only [lin_one, ee_add_one] + rw [hmξ 0 m0, L'.hξ 0 m0] + rcases ha' with ⟨h3, -⟩ | ⟨h3, -⟩ <;> rw [h3] <;> assumption + +omit [T2Space Y] in +/-- A part of a cuff that avoids the preimage of `F` joins its ends in the boundary. -/ +theorem same_of_gap (hψ : IsCutting ψ F) (hF : IsClosed F) {C : Set Y} (hCb : C ⊆ bd Y) + (φ : Circle ≃ₜ C) {p q : ℝ} (hpq : p < q) + (hv : ∀ v ∈ Ioo p q, ψ (φ (ee v)).1 ∉ F) (h0 : ψ (φ (ee p)).1 ∈ bd S) (h1 : ψ (φ + (ee q)).1 ∈ bd S) : + connectedComponentIn (bd S) (ψ (φ (ee p)).1) = connectedComponentIn (bd S) (ψ (φ (ee q)).1) + := by + have hc : ContinuousOn (fun u => (φ (ee (lin p q u))).1) (Icc 0 1) := by + refine continuous_subtype_val.comp_continuousOn (φ.continuous.comp_continuousOn ?_) + exact continuous_ee.comp_continuousOn (continuousOn_lin _ _) + have key := same_cuff_of_curve (γ := fun u => (φ (ee (lin p q u))).1) hψ hF hc (fun u _ => hCb + (φ _).2) + (fun u hu => hv _ (lin_mem hu hpq)) (by simpa only [lin_zero] using h0) + (by simpa only [lin_one] using h1) + simpa only [lin_zero, lin_one] using key + +end + +theorem erase_erase_facts (c i j : ℕ) : + (((List.range' 0 c).erase i).erase j).Nodup ∧ ∀ m ∈ ((List.range' 0 c).erase i).erase j, m < c + ∧ m ≠ i ∧ m ≠ j := by + obtain ⟨h1, h2⟩ := erase_facts c i + refine ⟨h1.erase _, fun m hm => ?_⟩ + obtain ⟨h3, h4⟩ := h1.mem_erase_iff.mp hm + exact ⟨(h2 m h4).1, (h2 m h4).2, h3⟩ + +theorem length_erase_erase {c i j : ℕ} (hij : i ≠ j) (hi : i < c) (hj : j < c) : + (((List.range' 0 c).erase i).erase j).length = c - 2 := by + have h1 := List.nodup_range' (s := 0) (n := c) + rw [List.length_erase_of_mem ((h1.mem_erase_iff).mpr ⟨hij.symm, + List.mem_range'_1.mpr (by omega)⟩), length_erase_range hi] + omega + +/-- Classify both surfaces of a connected cut along a proper `I`-arc by normalizing the gluing +word. Except in the case of merging two ambient cuffs, the endpoints are in the same cuff. -/ +theorem connected_cut_arc_models {S Y : Type u} [TopologicalSpace S] [TopologicalSpace Y] + [T2Space S] {ψ : Y → S} {F : Set S} {s t : S} {X X' : Set Y} + (hY : IsSurface Y) (hYc : ConnectedSpace Y) (hψ : IsCutting ψ F) + (hP : LiftPair ψ F s t X X') (hFc : IsClosed F) (hsb : s ∈ bd S) (htb : t ∈ bd S) : + ∃ a b c : ℕ, 0 < c ∧ Nonempty (Y ≃ₜ SurfaceModel a b c) ∧ + (Nonempty (S ≃ₜ SurfaceModel a b (c + 1)) ∨ + connectedComponentIn (bd S) s = connectedComponentIn (bd S) t ∧ + (Nonempty (S ≃ₜ SurfaceModel a (b + 1) c) ∨ + 2 ≤ c ∧ (Nonempty (S ≃ₜ SurfaceModel (a + 1) b (c - 2 + 1)) ∨ + Nonempty (S ≃ₜ SurfaceModel a (b + 2) (c - 2 + 1))))) := by + have : CompactSpace Y := hY.1 + have : T2Space Y := hY.2.1 + have hPc := hP + obtain ⟨-, -, -, -, -, -, hd, hun, -, -, -, -, -, -⟩ := hP + obtain ⟨a₀, ξ, η, L, ha0, ha1, himξ, himη, hiξ, hiη⟩ := exists_arcLift hPc hψ + have hub : ψ ⁻¹' F = ξ '' Icc 0 1 ∪ η '' Icc 0 1 := by rw [himξ, himη, hun] + have hXb : X ⊆ bd Y := fun z hz => hψ.2.2.2.2 (hun ▸ Or.inl hz) + have hXb' : X' ⊆ bd Y := fun z hz => hψ.2.2.2.2 (hun ▸ Or.inr hz) + have pX : IsPreconnected X := himξ ▸ isPreconnected_Icc.image _ L.cξ + have pX' : IsPreconnected X' := himη ▸ isPreconnected_Icc.image _ L.cη + have hex : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hx : ξ 0 ∈ X := himξ ▸ ⟨0, hex, rfl⟩ + have hy : η 0 ∈ X' := himη ▸ ⟨0, hex, rfl⟩ + have hξm : ∀ u ∈ Icc (0 : ℝ) 1, ξ u ∈ X := fun u hu => himξ ▸ ⟨u, hu, rfl⟩ + have hηm : ∀ u ∈ Icc (0 : ℝ) 1, η u ∈ X' := fun u hu => himη ▸ ⟨u, hu, rfl⟩ + have hdcuff := cuff_statement.{u} Y hY + have hdc : ∀ {C : Set Y}, C ∈ cuffs Y → C ⊆ bd Y := fun {C} hC => by + obtain ⟨z, -, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + obtain ⟨a, b, c, ⟨e⟩⟩ := classification.{u} Y hY hYc + have hC : connectedComponentIn (bd Y) (ξ 0) ∈ cuffs Y := ⟨_, hXb hx, rfl⟩ + have hC' : connectedComponentIn (bd Y) (η 0) ∈ cuffs Y := ⟨_, hXb' hy, rfl⟩ + have hXC := pX.subset_connectedComponentIn hx hXb + have hXC' := pX'.subset_connectedComponentIn hy hXb' + by_cases hCC : connectedComponentIn (bd Y) (ξ 0) = connectedComponentIn (bd Y) (η 0) + · obtain ⟨i, hi, φ, g, hg, hs⟩ := exists_one_hole e hC + obtain ⟨a', ξ', η', m, L', ha', hxim, heim, hix, hie, hmc, hmm, hmξ⟩ := orient_lift L φ + (fun u hu => hXC (hξm u hu)) hiξ hiη + obtain ⟨hN, hLf⟩ := erase_facts c i + have hξ' : ∀ u ∈ Icc (0 : ℝ) 1, ξ' u ∈ X := fun u hu => by + rw [← himξ, ← hxim] + exact ⟨u, hu, rfl⟩ + have hη' : ∀ u ∈ Icc (0 : ℝ) 1, η' u ∈ X' := fun u hu => by + rw [← himη, ← heim] + exact ⟨u, hu, rfl⟩ + have hub' : ψ ⁻¹' F = ξ' '' Icc 0 1 ∪ η' '' Icc 0 1 := by rw [hxim, heim, hub] + obtain ⟨σ, g', hp, -, p, q, hpq, e1, e2, e3⟩ := arc_one_aux hY L' hψ.1 hψ.2.1 hC φ hi hLf hg + hs hmc hmm hmξ + (fun u hu => hCC ▸ hXC' (hη' u hu)) hix hie (fun u hu v hv he => Set.disjoint_left.mp hd + (hξ' u hu) (he ▸ hη' v hv)) + have hn := nf_blkB (a := a) (b := b) (c := c) hi hN hLf σ + have hlen := length_erase_range hi + have : Nonempty S := ⟨s⟩ + cases σ with + | false => + obtain ⟨w, h5, h6⟩ := hn.1 rfl + obtain ⟨e'⟩ := homeo_of_nf hp h5 h6 + rw [hlen, show c - 1 + 2 = c + 1 by omega] at e' + exact ⟨a, b, c, by omega, ⟨e⟩, Or.inl ⟨e'⟩⟩ + | true => + obtain ⟨w, h5, h6⟩ := hn.2 rfl + obtain ⟨e'⟩ := homeo_of_nf hp h5 h6 + rw [hlen, show c - 1 + 1 = c by omega] at e' + have h0 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hb1 : ψ (φ (ee p)).1 = a' 1 := by rw [e1, L'.hξ 1 h0] + have hb2 : ψ (φ (ee q)).1 = a' 0 := by + rw [e2, ofs_true, L'.hη 0 hex] + have hends : a' 0 ∈ bd S ∧ a' 1 ∈ bd S := by + rcases ha' with ⟨h2, h3⟩ | ⟨h2, h3⟩ <;> rw [h2, h3, ha0, ha1] + <;> exact ⟨by assumption, by assumption⟩ + have key := same_of_gap hψ hFc (hdc hC) φ hpq (fun v hv hF' => by + have hm' : (φ (ee v)).1 ∈ ψ ⁻¹' F := hF' + rw [hub'] at hm' + rcases hm' with ⟨u, hu, hu'⟩ | ⟨u, hu, hu'⟩ + · exact (e3 v hv u hu).1 hu'.symm + · exact (e3 v hv u hu).2 hu'.symm) (hb1 ▸ hends.2) (hb2 ▸ hends.1) + rw [hb1, hb2] at key + have same : connectedComponentIn (bd S) s = connectedComponentIn (bd S) t := by + rcases ha' with ⟨h2, h3⟩ | ⟨h2, h3⟩ + · rw [h2, h3, ha0, ha1] at key + exact key.symm + · rw [h2, h3, ha0, ha1] at key + exact key + exact ⟨a, b, c, by omega, ⟨e⟩, Or.inr ⟨same, Or.inl ⟨e'⟩⟩⟩ + · have hdis := cuffs_disjoint hC hC' hCC + obtain ⟨φ₀⟩ := hdcuff.2.2 _ hC + have same := same_of_cuff hψ hFc L (hdc hC) φ₀ (fun u hu => hXC (hξm u hu)) hiξ hiη + (fun u hu hm => Set.disjoint_left.mp hdis hm (hXC' (hηm u hu))) hub (ha0 ▸ hsb) (ha1 ▸ htb) + rw [ha0, ha1] at same + obtain ⟨i, hi, j, hj, hij, φ, φ', g, hg, hs, hs'⟩ := exists_two_holes e hC hC' hCC + obtain ⟨a', ξ', η', m, L', ha', hxim, heim, hix, hie, hmc, hmm, hmξ⟩ := orient_lift L φ + (fun u hu => hXC (hξm u hu)) hiξ hiη + obtain ⟨hN, hLf⟩ := erase_erase_facts c i j + have hη' : ∀ u ∈ Icc (0 : ℝ) 1, η' u ∈ X' := fun u hu => by + rw [← himη, ← heim] + exact ⟨u, hu, rfl⟩ + obtain ⟨σ, g', hp, -⟩ := arc_two_aux hY L' hψ.1 hψ.2.1 hC hC' (hdcuff.2.2 _ + hC).isCompact.isClosed + (hdcuff.2.2 _ hC').isCompact.isClosed hdis φ φ' hij hi hj hLf hg hs hs' hmc hmm hmξ + (fun u hu => hXC' (hη' u hu)) hix hie + have hn := nf_blkA (a := a) (b := b) (c := c) hij hi hj hN hLf σ + have hlen := length_erase_erase hij hi hj + have : Nonempty S := ⟨s⟩ + cases σ with + | false => + obtain ⟨w, h5, h6⟩ := hn.1 rfl + obtain ⟨e'⟩ := homeo_of_nf hp h5 h6 + rw [hlen] at e' + exact ⟨a, b, c, by omega, ⟨e⟩, Or.inr ⟨same, Or.inr ⟨by omega, Or.inl ⟨e'⟩⟩⟩⟩ + | true => + obtain ⟨w, h5, h6⟩ := hn.2 rfl + obtain ⟨e'⟩ := homeo_of_nf hp h5 h6 + rw [hlen] at e' + exact ⟨a, b, c, by omega, ⟨e⟩, Or.inr ⟨same, Or.inr ⟨by omega, Or.inr ⟨e'⟩⟩⟩⟩ + +/-- **Cutting along an `I`-arc.** The classical cut and paste proof: Massey, *Algebraic Topology: an +Introduction*, Chapter 1, +Section 7. -/ +theorem cutIArc : CutIArcStatement.{u} := by + intro S _ F s t hS hconn hst hF hl + have hcS : CompactSpace S := hS.1 + have ht2 : T2Space S := hS.2.1 + obtain ⟨Y, tY, t2Y, ψ, hY, hψ, X, X', hP⟩ := exists_cut_arc hS hst hF hl + have hcY : CompactSpace Y := hY.1 + refine ⟨Y, tY, ψ, hY, hψ, ?_⟩ + have hFc : IsClosed F := hl.isCompact.isClosed + have hPc := hP + obtain ⟨x0, x1, y0, y1, l1, l2, hd, hun, b1, b2, h7, h8, h9, h10⟩ := hP + have hline : ∃ X Y : Set Y, Disjoint X Y ∧ X ∪ Y = ψ ⁻¹' F ∧ IsLine X ∧ IsLine Y ∧ BijOn ψ X F + ∧ BijOn ψ Y F := by + obtain ⟨f, -⟩ := l1 + obtain ⟨f', -⟩ := l2 + exact ⟨X, X', hd, hun, ⟨f⟩, ⟨f'⟩, b1, b2⟩ + obtain ⟨a₀, ξ, η, L, ha0, ha1, himξ, himη, hiξ, hiη⟩ := exists_arcLift hPc hψ + have hsb : s ∈ bd S := (show s ∈ F ∩ bd S from hF ▸ mem_insert _ _).2 + have htb : t ∈ bd S := (show t ∈ F ∩ bd S from hF ▸ mem_insert_of_mem _ rfl).2 + have hub : ψ ⁻¹' F = ξ '' Icc 0 1 ∪ η '' Icc 0 1 := by rw [himξ, himη, hun] + have hXb : X ⊆ bd Y := fun z hz => hψ.2.2.2.2 (hun ▸ Or.inl hz) + have hXb' : X' ⊆ bd Y := fun z hz => hψ.2.2.2.2 (hun ▸ Or.inr hz) + have pX : IsPreconnected X := himξ ▸ isPreconnected_Icc.image _ L.cξ + have pX' : IsPreconnected X' := himη ▸ isPreconnected_Icc.image _ L.cη + have hex : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hx : ξ 0 ∈ X := himξ ▸ ⟨0, hex, rfl⟩ + have hy : η 0 ∈ X' := himη ▸ ⟨0, hex, rfl⟩ + have hξm : ∀ u ∈ Icc (0 : ℝ) 1, ξ u ∈ X := fun u hu => himξ ▸ ⟨u, hu, rfl⟩ + have hηm : ∀ u ∈ Icc (0 : ℝ) 1, η u ∈ X' := fun u hu => himη ▸ ⟨u, hu, rfl⟩ + have hdcuff := cuff_statement.{u} Y hY + have hdc : ∀ {C : Set Y}, C ∈ cuffs Y → C ⊆ bd Y := fun {C} hC => by + obtain ⟨z, -, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + rcases cut_comps hψ hY pX pX' hun hx hy with hYc | ⟨W₁, W₂, hne, hsc, hX₁, hX₂, hW₁, hW₂, hU, + hdW, hc₁, hc₂⟩ + · obtain ⟨a, b, c, -, ⟨e⟩, hmodels⟩ := connected_cut_arc_models hY hYc hψ hPc hFc hsb htb + rcases hmodels with he' | ⟨hsame, hmodels⟩ + · obtain ⟨e'⟩ := he' + exact ⟨fun _ => ⟨hYc, a, b, c, ⟨e'⟩, ⟨e⟩⟩, fun _ => .inl + (cutIsSimpler_of_connected e e' le_rfl le_rfl (by omega)), hline⟩ + · refine ⟨fun h => absurd hsame h, fun _ => .inl ?_, hline⟩ + rcases hmodels with he' | ⟨hc, he' | he'⟩ <;> obtain ⟨e'⟩ := he' + · exact cutIsSimpler_of_connected e e' le_rfl (by omega) (by omega) + · exact cutIsSimpler_of_connected e e' (by omega) le_rfl (by omega) + · exact cutIsSimpler_of_connected e e' le_rfl (by omega) (by omega) + · obtain ⟨a₁, b₁, c₁, ⟨e₁⟩⟩ := classification.{u} W₁ (isSurface_sub hY hW₁) hc₁ + obtain ⟨a₂, b₂, c₂, ⟨e₂⟩⟩ := classification.{u} W₂ (isSurface_sub hY hW₂) hc₂ + have hC : connectedComponentIn (bd Y) (ξ 0) ∈ cuffs Y := ⟨_, hXb hx, rfl⟩ + have hXC := pX.subset_connectedComponentIn hx hXb + have hCW : connectedComponentIn (bd Y) (ξ 0) ⊆ W₁ := + isPreconnected_connectedComponentIn.subset_isClopen hW₁ ⟨ξ 0, mem_connectedComponentIn + (hXb hx), hX₁ hx⟩ + obtain ⟨φ₀⟩ := hdcuff.2.2 _ hC + have same := same_of_cuff hψ hFc L (hdc hC) φ₀ (fun u hu => hXC (hξm u hu)) hiξ hiη + (fun u hu hm => Set.disjoint_left.mp hdW (hCW hm) (hX₂ (hηm u hu))) hub (ha0 ▸ hsb) + (ha1 ▸ htb) + rw [ha0, ha1] at same + obtain ⟨i, j, σ, a', f, hi, hj, -, -, hf, -⟩ := arc_comps_aux hY L hψ.1 hψ.2.1 hW₁ hW₂ hdW hU + e₁ e₂ + (by rw [himξ]; exact hX₁) (by rw [himη]; exact hX₂) (by rw [himξ]; exact hXb) + (by rw [himη]; exact hXb') hiξ hiη + have : Nonempty S := ⟨s⟩ + obtain ⟨hN₁, hL₁⟩ := erase_facts c₁ i + obtain ⟨hN₂, hL₂⟩ := erase_facts c₂ j + obtain ⟨e'⟩ := homeo_of_two_arc hi hj hN₁ hN₂ hL₁ hL₂ hf + rw [length_erase_range hi, length_erase_range hj] at e' + refine ⟨fun h => absurd same h, fun _ => ?_, hline⟩ + obtain ⟨d⟩ := nonempty_disc_homeo + by_cases h2 : a₂ = 0 ∧ b₂ = 0 ∧ c₂ = 1 + · obtain ⟨rfl, rfl, rfl⟩ := h2 + rw [show 0 + a₁ = a₁ by omega, show 0 + b₁ = b₁ by omega, show 1 - 1 + (c₁ - 1) + 1 + = c₁ by omega] at e' + exact .inr ⟨W₂, W₁, hne.symm, by rw [hsc, pair_comm], ⟨e₂.trans d⟩, ⟨e₁.trans e'.symm⟩⟩ + by_cases h1 : a₁ = 0 ∧ b₁ = 0 ∧ c₁ = 1 + · obtain ⟨rfl, rfl, rfl⟩ := h1 + rw [show a₂ + 0 = a₂ by omega, show b₂ + 0 = b₂ by omega, show c₂ - 1 + (1 - 1) + 1 + = c₂ by omega] at e' + exact .inr ⟨W₁, W₂, hne, hsc, ⟨e₁.trans d⟩, ⟨e₂.trans e'.symm⟩⟩ + · refine .inl (cutIsSimpler_of_two hsc e₁ e₂ e' (by omega) (by omega) ?_ (by omega) + (by omega) ?_) + · omega + · omega + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutLift.lean b/LeanPool/GraphMinor/Surface/CutLift.lean new file mode 100644 index 0000000000..e0f670ccce --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutLift.lean @@ -0,0 +1,480 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutChain + +/-! +# Lifting arcs to the cut surface + +Let `ψ` be a map that has two preimages over each point of an arc. If the arc is a chain of edges, +the two lifts of the +edges fit together to two disjoint lifts of the arc (`LiftPair.join`). For an `O`-arc, we close the +chain +(`LiftPair.close`): either we get two `O`-arcs over `F`, or one `O`-arc that runs twice around `F`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +local notation "𝕀" => unitInterval + +variable {S S' : Type u} [TopologicalSpace S] [TopologicalSpace S'] [T2Space S'] {ψ : S' → S} + +/-- Two disjoint lifts `X`, `Y` of the line `Z` from `u` to `v`, that fill the preimage of `Z`. -/ +def LiftPair (ψ : S' → S) (Z : Set S) (u v : S) (X Y : Set S') : Prop := + ∃ x0 x1 y0 y1, IsLineWithEnds X x0 x1 ∧ IsLineWithEnds Y y0 y1 ∧ Disjoint X Y ∧ X ∪ Y = ψ ⁻¹' Z + ∧ BijOn ψ X Z ∧ + BijOn ψ Y Z ∧ ψ x0 = u ∧ ψ y0 = u ∧ ψ x1 = v ∧ ψ y1 = v + +omit [TopologicalSpace S] [T2Space S'] in +theorem LiftPair.symm {Z : Set S} {u v : S} {X Y : Set S'} (h : LiftPair ψ Z u v X Y) : LiftPair ψ + Z u v Y X := by + obtain ⟨x0, x1, y0, y1, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ := h + exact ⟨y0, y1, x0, x1, h2, h1, h3.symm, by rw [union_comm, h4], h6, h5, h8, h7, h10, h9⟩ + +theorem eq_or_of_encard_le_two {α : Type*} {T : Set α} (hT : T.encard ≤ 2) {a b c : α} (ha : a ∈ T) + (hb : b ∈ T) (hc : c ∈ T) + (hab : a ≠ b) : c = a ∨ c = b := by + by_contra hcon + push Not at hcon + have h1 : ({a, b, c} : Set α) ⊆ T := by + rintro x (rfl | rfl | rfl) <;> assumption + have h2 : ({a, b, c} : Set α).encard = 3 := Set.encard_eq_three.mpr ⟨a, b, c, hab, hcon.1.symm, + hcon.2.symm, rfl⟩ + have h3 := encard_le_encard h1 + rw [h2] at h3 + exact absurd (h3.trans hT) (by norm_num) + +omit [TopologicalSpace S] in +theorem LiftPair.join_aux {Z₁ Z₂ : Set S} {u c v : S} {X₁ Y₁ X₂ Y₂ : Set S'} {x0 x1 y0 y1 y₂ y₂' : + S'} + (h1 : IsLineWithEnds X₁ x0 x1) (h2 : IsLineWithEnds Y₁ y0 y1) (h3 : Disjoint X₁ Y₁) + (h4 : X₁ ∪ Y₁ = ψ ⁻¹' Z₁) + (h5 : BijOn ψ X₁ Z₁) (h6 : BijOn ψ Y₁ Z₁) (h7 : ψ x0 = u) (h8 : ψ y0 = u) (h9 : ψ x1 = c) + (h10 : ψ y1 = c) + (h1' : IsLineWithEnds X₂ x1 y₂) (h2' : IsLineWithEnds Y₂ y1 y₂') (h3' : Disjoint X₂ Y₂) + (h4' : X₂ ∪ Y₂ = ψ ⁻¹' Z₂) + (h5' : BijOn ψ X₂ Z₂) (h6' : BijOn ψ Y₂ Z₂) (h9' : ψ y₂ = v) (h10' : ψ y₂' = v) (hi : Z₁ ∩ Z₂ + = {c}) : + LiftPair ψ (Z₁ ∪ Z₂) u v (X₁ ∪ X₂) (Y₁ ∪ Y₂) := by + have hX : X₁ ∩ X₂ = {x1} := by + ext z + constructor + · rintro ⟨hz, hz'⟩ + have h11 : ψ z ∈ Z₁ ∩ Z₂ := ⟨h5.mapsTo hz, h5'.mapsTo hz'⟩ + rw [hi] at h11 + exact h5.injOn hz h1.right_mem (h11.trans h9.symm) + · rintro rfl + exact ⟨h1.right_mem, h1'.left_mem⟩ + have hY : Y₁ ∩ Y₂ = {y1} := by + ext z + constructor + · rintro ⟨hz, hz'⟩ + have h11 : ψ z ∈ Z₁ ∩ Z₂ := ⟨h6.mapsTo hz, h6'.mapsTo hz'⟩ + rw [hi] at h11 + exact h6.injOn hz h2.right_mem (h11.trans h10.symm) + · rintro rfl + exact ⟨h2.right_mem, h2'.left_mem⟩ + have hc1 : ∀ z ∈ X₁, z ∈ Y₂ → False := fun z hz hz' => by + have h11 : ψ z ∈ Z₁ ∩ Z₂ := ⟨h5.mapsTo hz, h6'.mapsTo hz'⟩ + rw [hi] at h11 + have e1 : z = x1 := h5.injOn hz h1.right_mem (h11.trans h9.symm) + have e2 : z = y1 := h6'.injOn hz' h2'.left_mem (h11.trans h10.symm) + exact Set.disjoint_left.mp h3 h1.right_mem (show x1 ∈ Y₁ by rw [← e1, e2]; exact h2.right_mem) + have hc2 : ∀ z ∈ X₂, z ∈ Y₁ → False := fun z hz hz' => by + have h11 : ψ z ∈ Z₁ ∩ Z₂ := ⟨h6.mapsTo hz', h5'.mapsTo hz⟩ + rw [hi] at h11 + have e1 : z = x1 := h5'.injOn hz h1'.left_mem (h11.trans h9.symm) + have e2 : z = y1 := h6.injOn hz' h2.right_mem (h11.trans h10.symm) + exact Set.disjoint_left.mp h3 (show z ∈ X₁ by rw [e1]; exact h1.right_mem) hz' + refine ⟨x0, y₂, y0, y₂', h1.union h1' hX, h2.union h2' hY, ?_, ?_, ?_, ?_, h7, h8, h9', h10'⟩ + · rw [Set.disjoint_left] + rintro z (hz | hz) (hz' | hz') + · exact Set.disjoint_left.mp h3 hz hz' + · exact hc1 z hz hz' + · exact hc2 z hz hz' + · exact Set.disjoint_left.mp h3' hz hz' + · rw [preimage_union, ← h4, ← h4'] + ac_rfl + · refine ⟨fun z hz => hz.imp (fun h => h5.mapsTo h) (fun h => h5'.mapsTo h), ?_, ?_⟩ + · rintro z (hz | hz) z' (hz' | hz') he + · exact h5.injOn hz hz' he + · have h11 : ψ z ∈ Z₁ ∩ Z₂ := ⟨h5.mapsTo hz, he ▸ h5'.mapsTo hz'⟩ + rw [hi] at h11 + rw [h5.injOn hz h1.right_mem (h11.trans h9.symm), h5'.injOn hz' h1'.left_mem + ((he.symm.trans h11).trans h9.symm)] + · have h11 : ψ z ∈ Z₁ ∩ Z₂ := ⟨he ▸ h5.mapsTo hz', h5'.mapsTo hz⟩ + rw [hi] at h11 + rw [h5'.injOn hz h1'.left_mem (h11.trans h9.symm), h5.injOn hz' h1.right_mem + ((he.symm.trans h11).trans h9.symm)] + · exact h5'.injOn hz hz' he + · rintro z (hz | hz) + · obtain ⟨w, hw, rfl⟩ := h5.surjOn hz + exact ⟨w, .inl hw, rfl⟩ + · obtain ⟨w, hw, rfl⟩ := h5'.surjOn hz + exact ⟨w, .inr hw, rfl⟩ + · refine ⟨fun z hz => hz.imp (fun h => h6.mapsTo h) (fun h => h6'.mapsTo h), ?_, ?_⟩ + · rintro z (hz | hz) z' (hz' | hz') he + · exact h6.injOn hz hz' he + · have h11 : ψ z ∈ Z₁ ∩ Z₂ := ⟨h6.mapsTo hz, he ▸ h6'.mapsTo hz'⟩ + rw [hi] at h11 + rw [h6.injOn hz h2.right_mem (h11.trans h10.symm), h6'.injOn hz' h2'.left_mem + ((he.symm.trans h11).trans h10.symm)] + · have h11 : ψ z ∈ Z₁ ∩ Z₂ := ⟨he ▸ h6.mapsTo hz', h6'.mapsTo hz⟩ + rw [hi] at h11 + rw [h6'.injOn hz h2'.left_mem (h11.trans h10.symm), h6.injOn hz' h2.right_mem + ((he.symm.trans h11).trans h10.symm)] + · exact h6'.injOn hz hz' he + · rintro z (hz | hz) + · obtain ⟨w, hw, rfl⟩ := h6.surjOn hz + exact ⟨w, .inl hw, rfl⟩ + · obtain ⟨w, hw, rfl⟩ := h6'.surjOn hz + exact ⟨w, .inr hw, rfl⟩ + +omit [TopologicalSpace S] in +/-- Two lifts of two lines that meet in one point, over which there are at most two points, fit +together. -/ +theorem LiftPair.join {Z₁ Z₂ : Set S} {u c v : S} {X₁ Y₁ X₂ Y₂ : Set S'} + (h : LiftPair ψ Z₁ u c X₁ Y₁) + (h' : LiftPair ψ Z₂ c v X₂ Y₂) (hi : Z₁ ∩ Z₂ = {c}) (hc : (ψ ⁻¹' {c}).encard ≤ 2) : + ∃ X Y, LiftPair ψ (Z₁ ∪ Z₂) u v X Y := by + obtain ⟨x0, x1, y0, y1, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ := h + obtain ⟨x0', x1', y0', y1', h1', h2', h3', h4', h5', h6', h7', h8', h9', h10'⟩ := h' + have hne : x1 ≠ y1 := fun he => Set.disjoint_left.mp h3 h1.right_mem (he ▸ h2.right_mem) + have hne' : x0' ≠ y0' := fun he => Set.disjoint_left.mp h3' h1'.left_mem (he ▸ h2'.left_mem) + rcases eq_or_of_encard_le_two hc h9 h10 (c := x0') h7' hne with e | e + · have e' : y0' = y1 := by + rcases eq_or_of_encard_le_two hc h9 h10 (c := y0') h8' hne with e' | e' + · exact absurd (e.trans e'.symm) hne' + · exact e' + subst e e' + exact ⟨_, _, LiftPair.join_aux h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h1' h2' h3' h4' h5' h6' h9' h10' + hi⟩ + · have e' : y0' = x1 := by + rcases eq_or_of_encard_le_two hc h9 h10 (c := y0') h8' hne with e' | e' + · exact e' + · exact absurd (e.trans e'.symm) hne' + subst e e' + exact ⟨_, _, LiftPair.join_aux h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h2' h1' h3'.symm + (by rw [union_comm, h4']) h6' h5' h10' h9' hi⟩ + +theorem oArc_of_lines {X : Type*} [TopologicalSpace X] [T2Space X] {A B : Set X} {u v : X} + (hA : IsLineWithEnds A u v) + (hB : IsLineWithEnds B u v) (hi : A ∩ B = {u, v}) : IsOArc (A ∪ B) := by + obtain ⟨a, ha, rfl, rfl, rfl⟩ := hA.exists_arc + obtain ⟨b, hb, rfl, h0, h1⟩ := hB.exists_arc + refine oArc_of_two_arcs ha hb h0.symm h1.symm fun s t he => ?_ + have hm : a s ∈ range a ∩ range b := ⟨⟨s, rfl⟩, ⟨t, he.symm⟩⟩ + rw [hi] at hm + rcases hm with hm | hm + · left + have e1 : s = 0 := ha.2 hm + subst e1 + exact ⟨rfl, hb.2 (he.symm.trans h0.symm)⟩ + · right + have e1 : s = 1 := ha.2 hm + subst e1 + exact ⟨rfl, hb.2 (he.symm.trans h1.symm)⟩ + +theorem IsOArc.lines {X : Type*} [TopologicalSpace X] [T2Space X] {F : Set X} + (hF : IsOArc F) {x y : X} (hx : x ∈ F) (hy : y ∈ F) + (hxy : x ≠ y) : ∃ A B, IsLineWithEnds A x y ∧ IsLineWithEnds B x y ∧ A ∪ B = F ∧ A ∩ B = {x, y} + := by + obtain ⟨a, b, h1, rfl, rfl, rfl⟩ := hF.exists_arcs hx hy hxy + refine ⟨range a, range b, h1.arc_left.isLineWithEnds, ?_, rfl, h1.inter⟩ + have := h1.arc_right.isLineWithEnds + rwa [h1.zero, h1.one] at this + +omit [TopologicalSpace S] in +theorem LiftPair.close_aux {Z₁ Z₂ : Set S} {u c : S} {X₁ Y₁ X₂ Y₂ : Set S'} {x0 x1 y0 y1 p q : S'} + (h1 : IsLineWithEnds X₁ x0 x1) (h2 : IsLineWithEnds Y₁ y0 y1) (h3 : Disjoint X₁ Y₁) + (h4 : X₁ ∪ Y₁ = ψ ⁻¹' Z₁) + (h5 : BijOn ψ X₁ Z₁) (h6 : BijOn ψ Y₁ Z₁) (h7 : ψ x0 = u) (h8 : ψ y0 = u) (h9 : ψ x1 = c) + (h10 : ψ y1 = c) + (h1' : IsLineWithEnds X₂ x1 p) (h2' : IsLineWithEnds Y₂ y1 q) (h3' : Disjoint X₂ Y₂) + (h4' : X₂ ∪ Y₂ = ψ ⁻¹' Z₂) + (h5' : BijOn ψ X₂ Z₂) (h6' : BijOn ψ Y₂ Z₂) (hi : Z₁ ∩ Z₂ = {u, c}) (huc : u ≠ c) + (hpq : (p = x0 ∧ q = y0) ∨ (p = y0 ∧ q = x0)) : + (∃ X Y, Disjoint X Y ∧ X ∪ Y = ψ ⁻¹' (Z₁ ∪ Z₂) ∧ IsOArc X ∧ IsOArc Y ∧ BijOn ψ X (Z₁ ∪ Z₂) + ∧ BijOn ψ Y (Z₁ ∪ Z₂)) ∨ + IsOArc (ψ ⁻¹' (Z₁ ∪ Z₂)) := by + have hxy0 : x0 ≠ y0 := fun he => Set.disjoint_left.mp h3 h1.left_mem (he ▸ h2.left_mem) + have hxy1 : x1 ≠ y1 := fun he => Set.disjoint_left.mp h3 h1.right_mem (he ▸ h2.right_mem) + have hun : ψ ⁻¹' (Z₁ ∪ Z₂) = (X₁ ∪ X₂) ∪ (Y₁ ∪ Y₂) := by + rw [preimage_union, ← h4, ← h4'] + ac_rfl + /- The points over `u` and `c` in each of the four arcs. -/ + have hX1 : ∀ z ∈ X₁, ∀ w ∈ X₂ ∪ Y₂, ψ z = ψ w → z = x0 ∨ z = x1 := fun z hz w hw he => by + have hw' : ψ w ∈ Z₂ := by + rcases hw with hw | hw + · exact h5'.mapsTo hw + · exact h6'.mapsTo hw + have h11 : ψ z ∈ Z₁ ∩ Z₂ := ⟨h5.mapsTo hz, he ▸ hw'⟩ + rw [hi] at h11 + rcases h11 with h11 | h11 + · exact .inl (h5.injOn hz h1.left_mem (h11.trans h7.symm)) + · exact .inr (h5.injOn hz h1.right_mem (h11.trans h9.symm)) + have hY1 : ∀ z ∈ Y₁, ∀ w ∈ X₂ ∪ Y₂, ψ z = ψ w → z = y0 ∨ z = y1 := fun z hz w hw he => by + have hw' : ψ w ∈ Z₂ := by + rcases hw with hw | hw + · exact h5'.mapsTo hw + · exact h6'.mapsTo hw + have h11 : ψ z ∈ Z₁ ∩ Z₂ := ⟨h6.mapsTo hz, he ▸ hw'⟩ + rw [hi] at h11 + rcases h11 with h11 | h11 + · exact .inl (h6.injOn hz h2.left_mem (h11.trans h8.symm)) + · exact .inr (h6.injOn hz h2.right_mem (h11.trans h10.symm)) + have hψp : ψ p = u := by + rcases hpq with ⟨rfl, -⟩ | ⟨rfl, -⟩ <;> assumption + have hψq : ψ q = u := by + rcases hpq with ⟨-, rfl⟩ | ⟨-, rfl⟩ <;> assumption + have hX2 : ∀ z ∈ X₂, ∀ w ∈ X₁ ∪ Y₁, ψ z = ψ w → z = p ∨ z = x1 := fun z hz w hw he => by + have hw' : ψ w ∈ Z₁ := by + rcases hw with hw | hw + · exact h5.mapsTo hw + · exact h6.mapsTo hw + have h11 : ψ z ∈ Z₁ ∩ Z₂ := ⟨he ▸ hw', h5'.mapsTo hz⟩ + rw [hi] at h11 + rcases h11 with h11 | h11 + · exact .inl (h5'.injOn hz h1'.right_mem (h11.trans hψp.symm)) + · exact .inr (h5'.injOn hz h1'.left_mem (h11.trans h9.symm)) + have hY2 : ∀ z ∈ Y₂, ∀ w ∈ X₁ ∪ Y₁, ψ z = ψ w → z = q ∨ z = y1 := fun z hz w hw he => by + have hw' : ψ w ∈ Z₁ := by + rcases hw with hw | hw + · exact h5.mapsTo hw + · exact h6.mapsTo hw + have h11 : ψ z ∈ Z₁ ∩ Z₂ := ⟨he ▸ hw', h6'.mapsTo hz⟩ + rw [hi] at h11 + rcases h11 with h11 | h11 + · exact .inl (h6'.injOn hz h2'.right_mem (h11.trans hψq.symm)) + · exact .inr (h6'.injOn hz h2'.left_mem (h11.trans h10.symm)) + have hx0Y : x0 ∉ Y₁ := fun h => Set.disjoint_left.mp h3 h1.left_mem h + have hx1Y : x1 ∉ Y₁ := fun h => Set.disjoint_left.mp h3 h1.right_mem h + have hy0X : y0 ∉ X₁ := fun h => Set.disjoint_left.mp h3 h h2.left_mem + have hy1X : y1 ∉ X₁ := fun h => Set.disjoint_left.mp h3 h h2.right_mem + have hx1Y2 : x1 ∉ Y₂ := fun h => by + rcases hY2 x1 h y1 (.inr h2.right_mem) (h9.trans h10.symm) with e | e + · exact huc ((hψq.symm.trans (congrArg ψ e.symm)).trans h9) + · exact hxy1 e + have hy1X2 : y1 ∉ X₂ := fun h => by + rcases hX2 y1 h x1 (.inl h1.right_mem) (h10.trans h9.symm) with e | e + · exact huc ((hψp.symm.trans (congrArg ψ e.symm)).trans h10) + · exact hxy1 e.symm + have hbij : ∀ {A B : Set S'}, BijOn ψ A Z₁ → BijOn ψ B Z₂ → (∀ z ∈ A, ∀ w ∈ B, ψ z = ψ w → z = w) + → + BijOn ψ (A ∪ B) (Z₁ ∪ Z₂) := by + intro A B hA hB hAB + refine ⟨fun z hz => hz.imp (fun h => hA.mapsTo h) (fun h => hB.mapsTo h), ?_, ?_⟩ + · rintro z (hz | hz) z' (hz' | hz') he + · exact hA.injOn hz hz' he + · exact hAB z hz z' hz' he + · exact (hAB z' hz' z hz he.symm).symm + · exact hB.injOn hz hz' he + · rintro z (hz | hz) + · obtain ⟨w, hw, rfl⟩ := hA.surjOn hz + exact ⟨w, .inl hw, rfl⟩ + · obtain ⟨w, hw, rfl⟩ := hB.surjOn hz + exact ⟨w, .inr hw, rfl⟩ + rcases hpq with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · left + have hXi : X₁ ∩ X₂ = {p, x1} := by + ext z + constructor + · rintro ⟨hz, hz'⟩ + exact hX1 z hz z (.inl hz') rfl + · rintro (rfl | rfl) + · exact ⟨h1.left_mem, h1'.right_mem⟩ + · exact ⟨h1.right_mem, h1'.left_mem⟩ + have hYi : Y₁ ∩ Y₂ = {q, y1} := by + ext z + constructor + · rintro ⟨hz, hz'⟩ + exact hY1 z hz z (.inr hz') rfl + · rintro (rfl | rfl) + · exact ⟨h2.left_mem, h2'.right_mem⟩ + · exact ⟨h2.right_mem, h2'.left_mem⟩ + refine ⟨X₁ ∪ X₂, Y₁ ∪ Y₂, ?_, hun.symm, oArc_of_lines h1 h1'.symm hXi, + oArc_of_lines h2 h2'.symm hYi, ?_, ?_⟩ + · rw [Set.disjoint_left] + rintro z (hz | hz) (hz' | hz') + · exact Set.disjoint_left.mp h3 hz hz' + · rcases hX1 z hz z (.inr hz') rfl with e | e + · rcases hY2 z hz' z (.inl hz) rfl with e' | e' + · exact hxy0 (e.symm.trans e') + · exact hx0Y (by rw [← e, e']; exact h2.right_mem) + · exact hx1Y2 (e ▸ hz') + · rcases hY1 z hz' z (.inl hz) rfl with e | e + · rcases hX2 z hz z (.inr hz') rfl with e' | e' + · exact hxy0 (e'.symm.trans e) + · exact hx1Y (by rw [← e']; exact hz') + · exact hy1X2 (e ▸ hz) + · exact Set.disjoint_left.mp h3' hz hz' + · refine hbij h5 h5' fun z hz w hw he => ?_ + rcases hX1 z hz w (.inl hw) he with e | e <;> rcases hX2 w hw z (.inl hz) he.symm with e' | e' + · rw [e, e'] + · exact absurd (by rw [← h7, ← h9, ← e, ← e']; exact he) huc + · exact absurd (by rw [← h7, ← h9, ← e, ← e']; exact he) huc.symm + · rw [e, e'] + · refine hbij h6 h6' fun z hz w hw he => ?_ + rcases hY1 z hz w (.inr hw) he with e | e <;> rcases hY2 w hw z (.inr hz) he.symm with e' | e' + · rw [e, e'] + · exact absurd (by rw [← h8, ← h10, ← e, ← e']; exact he) huc + · exact absurd (by rw [← h8, ← h10, ← e, ← e']; exact he) huc.symm + · rw [e, e'] + · right + have hXi : X₁ ∩ X₂ = {x1} := by + ext z + constructor + · rintro ⟨hz, hz'⟩ + rcases hX1 z hz z (.inl hz') rfl with e | e + · rcases hX2 z hz' z (.inl hz) rfl with e' | e' + · exact absurd (e.symm.trans e') hxy0 + · exact e' + · exact e + · rintro rfl + exact ⟨h1.right_mem, h1'.left_mem⟩ + have hYi : Y₁ ∩ Y₂ = {y1} := by + ext z + constructor + · rintro ⟨hz, hz'⟩ + rcases hY1 z hz z (.inr hz') rfl with e | e + · rcases hY2 z hz' z (.inr hz) rfl with e' | e' + · exact absurd (e'.symm.trans e) hxy0 + · exact e' + · exact e + · rintro rfl + exact ⟨h2.right_mem, h2'.left_mem⟩ + have hL1 := h1.union h1' hXi + have hL2 := h2.union h2' hYi + have hLi : (X₁ ∪ X₂) ∩ (Y₁ ∪ Y₂) = {q, p} := by + ext z + constructor + · rintro ⟨hz | hz, hz' | hz'⟩ + · exact absurd hz' (Set.disjoint_left.mp h3 hz) + · rcases hX1 z hz z (.inr hz') rfl with e | e + · exact .inl e + · exact absurd (e ▸ hz') hx1Y2 + · rcases hY1 z hz' z (.inl hz) rfl with e | e + · exact .inr e + · exact absurd (e ▸ hz) hy1X2 + · exact absurd hz' (Set.disjoint_left.mp h3' hz) + · rintro (rfl | rfl) + · exact ⟨.inl h1.left_mem, .inr h2'.right_mem⟩ + · exact ⟨.inr h1'.right_mem, .inl h2.left_mem⟩ + rw [hun] + exact oArc_of_lines hL1 hL2.symm hLi + +omit [TopologicalSpace S] in +/-- Closing a chain around an `O`-arc. -/ +theorem LiftPair.close {Z₁ Z₂ : Set S} {u c : S} {X₁ Y₁ X₂ Y₂ : Set S'} + (h : LiftPair ψ Z₁ u c X₁ Y₁) + (h' : LiftPair ψ Z₂ c u X₂ Y₂) (hi : Z₁ ∩ Z₂ = {u, c}) (huc : u ≠ c) (hu : (ψ ⁻¹' {u}).encard + ≤ 2) + (hc : (ψ ⁻¹' {c}).encard ≤ 2) : + (∃ X Y, Disjoint X Y ∧ X ∪ Y = ψ ⁻¹' (Z₁ ∪ Z₂) ∧ IsOArc X ∧ IsOArc Y ∧ BijOn ψ X (Z₁ ∪ Z₂) + ∧ BijOn ψ Y (Z₁ ∪ Z₂)) ∨ + IsOArc (ψ ⁻¹' (Z₁ ∪ Z₂)) := by + obtain ⟨x0, x1, y0, y1, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ := h + obtain ⟨x0', x1', y0', y1', h1', h2', h3', h4', h5', h6', h7', h8', h9', h10'⟩ := h' + have hne : x1 ≠ y1 := fun he => Set.disjoint_left.mp h3 h1.right_mem (he ▸ h2.right_mem) + have hne0 : x0 ≠ y0 := fun he => Set.disjoint_left.mp h3 h1.left_mem (he ▸ h2.left_mem) + have hne' : x0' ≠ y0' := fun he => Set.disjoint_left.mp h3' h1'.left_mem (he ▸ h2'.left_mem) + have hne1' : x1' ≠ y1' := fun he => Set.disjoint_left.mp h3' h1'.right_mem (he ▸ h2'.right_mem) + have hu' : ∀ w, ψ w = u → ∀ w', ψ w' = u → w ≠ w' → (x1' = x0 ∧ y1' = y0) ∨ (x1' = y0 ∧ y1' = x0) + := by + intro _ _ _ _ _ + rcases eq_or_of_encard_le_two hu h7 h8 (c := x1') h9' hne0 with e | e <;> + rcases eq_or_of_encard_le_two hu h7 h8 (c := y1') h10' hne0 with e' | e' + · exact absurd (e.trans e'.symm) hne1' + · exact .inl ⟨e, e'⟩ + · exact .inr ⟨e, e'⟩ + · exact absurd (e.trans e'.symm) hne1' + have hpq := hu' _ h7 _ h8 hne0 + rcases eq_or_of_encard_le_two hc h9 h10 (c := x0') h7' hne with e | e + · have e' : y0' = y1 := by + rcases eq_or_of_encard_le_two hc h9 h10 (c := y0') h8' hne with e' | e' + · exact absurd (e.trans e'.symm) hne' + · exact e' + subst e e' + exact LiftPair.close_aux h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h1' h2' h3' h4' h5' h6' hi huc hpq + · have e' : y0' = x1 := by + rcases eq_or_of_encard_le_two hc h9 h10 (c := y0') h8' hne with e' | e' + · exact e' + · exact absurd (e.trans e'.symm) hne' + subst e e' + have hpq' : (y1' = x0 ∧ x1' = y0) ∨ (y1' = y0 ∧ x1' = x0) := by + rcases hpq with h | h + · exact .inr ⟨h.2, h.1⟩ + · exact .inl ⟨h.2, h.1⟩ + exact LiftPair.close_aux h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h2' h1' h3'.symm (by rw [union_comm, + h4']) h6' h5' hi huc hpq' + +omit [TopologicalSpace S] in +/-- Two continuous lifts of a path, that differ at each point and fill the preimage of its image. -/ +theorem liftPair_of_maps {a : ℝ → S} {r r' : ℝ → S'} (hr : ContinuousOn r (Icc 0 1)) + (hr' : ContinuousOn r' (Icc 0 1)) + (hψ : ∀ t ∈ Icc (0 : ℝ) 1, ψ (r t) = a t) (hψ' : ∀ t ∈ Icc (0 : ℝ) 1, ψ (r' t) = a t) + (ha : InjOn a (Icc 0 1)) + (hne : ∀ t ∈ Icc (0 : ℝ) 1, r t ≠ r' t) (hfill : ∀ z, ψ z ∈ a '' Icc 0 1 + → z ∈ r '' Icc 0 1 ∪ r' '' Icc 0 1) : + LiftPair ψ (a '' Icc 0 1) (a 0) (a 1) (r '' Icc 0 1) (r' '' Icc 0 1) := by + have h0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := ⟨le_rfl, zero_le_one⟩ + have h1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := ⟨zero_le_one, le_rfl⟩ + have line : ∀ q : ℝ → S', ContinuousOn q (Icc 0 1) → (∀ t ∈ Icc (0 : ℝ) 1, ψ (q t) = a t) → + IsLineWithEnds (q '' Icc 0 1) (q 0) (q 1) := by + intro q hq hψq + have harc : IsArcMap fun t : 𝕀 => q t := by + refine ⟨continuousOn_iff_continuous_domRestrict.mp hq, fun s t he => ?_⟩ + have h2 : a s = a t := by + rw [← hψq s s.2, ← hψq t t.2] + exact congrArg ψ he + exact Subtype.ext (ha s.2 t.2 h2) + have := harc.isLineWithEnds + have e : range (fun t : 𝕀 => q t) = q '' Icc 0 1 := by + ext z + constructor + · rintro ⟨t, rfl⟩ + exact ⟨t, t.2, rfl⟩ + · rintro ⟨t, ht, rfl⟩ + exact ⟨⟨t, ht⟩, rfl⟩ + rw [e] at this + exact this + have bij : ∀ q : ℝ → S', (∀ t ∈ Icc (0 : ℝ) 1, ψ (q t) = a t) → BijOn ψ (q '' Icc 0 1) + (a '' Icc 0 1) := by + intro q hψq + refine ⟨?_, ?_, ?_⟩ + · rintro _ ⟨t, ht, rfl⟩ + exact ⟨t, ht, (hψq t ht).symm⟩ + · rintro _ ⟨t, ht, rfl⟩ _ ⟨t', ht', rfl⟩ he + rw [hψq t ht, hψq t' ht'] at he + rw [ha ht ht' he] + · rintro _ ⟨t, ht, rfl⟩ + exact ⟨q t, ⟨t, ht, rfl⟩, hψq t ht⟩ + refine ⟨r 0, r 1, r' 0, r' 1, line r hr hψ, line r' hr' hψ', ?_, ?_, bij r hψ, bij r' hψ', + hψ 0 h0, hψ' 0 h0, hψ 1 h1, + hψ' 1 h1⟩ + · rw [Set.disjoint_left] + rintro _ ⟨t, ht, rfl⟩ ⟨t', ht', he⟩ + have h2 : a t' = a t := by rw [← hψ t ht, ← hψ' t' ht', he] + rw [ha ht' ht h2] at he + exact hne t ht he.symm + · ext z + constructor + · rintro (⟨t, ht, rfl⟩ | ⟨t, ht, rfl⟩) + · exact ⟨t, ht, (hψ t ht).symm⟩ + · exact ⟨t, ht, (hψ' t ht).symm⟩ + · exact hfill z + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutLoop.lean b/LeanPool/GraphMinor/Surface/CutLoop.lean new file mode 100644 index 0000000000..8436317306 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutLoop.lean @@ -0,0 +1,601 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutIArc + +/-! +# Lifts of an `O`-arc + +An `O`-arc `F` is cut into two lines, and these have lifts as paths. Joining the paths gives two +paths around `F`. Either both +of them are loops, or each one ends where the other starts (`LiftPair.paths`). Lemmas on loops in a +cuff follow: a loop that +lies on a cuff and is one to one goes around the cuff exactly once (`exists_loop_turn`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function + +universe uu + +theorem half_mem {x : ℝ} (hx : x ∈ Icc (0 : ℝ) 1) : x / 2 ∈ Icc (0 : ℝ) 1 + := ⟨by linarith [hx.1], by linarith [hx.2]⟩ + +theorem half_mem' {x : ℝ} (hx : x ∈ Icc (0 : ℝ) 1) : (1 + x) / 2 ∈ Icc (0 : ℝ) 1 + := ⟨by linarith [hx.1], by linarith [hx.2]⟩ + +/-- A point of `[0, 1]` is in the first half or the second half. -/ +theorem half_cases {x : ℝ} (hx : x ∈ Icc (0 : ℝ) 1) : + (∃ v ∈ Icc (0 : ℝ) 1, x = v / 2 ∧ x ≤ 1 / 2) ∨ (∃ v ∈ Ioc (0 : ℝ) 1, x = (1 + v) / 2) := by + by_cases h : x ≤ 1 / 2 + · exact .inl ⟨2 * x, ⟨by linarith [hx.1], by linarith⟩, by ring, h⟩ + · exact .inr ⟨2 * x - 1, ⟨by linarith, by linarith [hx.2]⟩, by ring⟩ + +section + +variable {Y S : Type uu} [TopologicalSpace Y] [T2Space Y] [TopologicalSpace S] [T2Space S] {ψ : Y + → S} + +omit [T2Space Y] in +/-- Two lifts of two lines that form an `O`-arc are joined to two paths around it. -/ +theorem LiftPair.paths {Z₁ Z₂ : Set S} {u c : S} {X₁ Y₁ X₂ Y₂ : Set Y} + (h : LiftPair ψ Z₁ u c X₁ Y₁) (h' : LiftPair ψ Z₂ c u X₂ Y₂) + (hi : Z₁ ∩ Z₂ = {u, c}) (_huc : u ≠ c) (hu : (ψ ⁻¹' {u}).encard ≤ 2) (hc : (ψ ⁻¹' {c}).encard + ≤ 2) (hψ : Continuous ψ) : + ∃ (a : ℝ → S) (ξ η : ℝ → Y), ContinuousOn ξ (Icc 0 1) ∧ ContinuousOn η (Icc 0 1) ∧ (∀ t ∈ Icc + (0 : ℝ) 1, ψ (ξ t) = a t) ∧ + (∀ t ∈ Icc (0 : ℝ) 1, ψ (η t) = a t) ∧ a '' Icc 0 1 = Z₁ ∪ Z₂ ∧ + (∀ y y', ψ y = ψ y' → y ≠ y' → ψ y ∈ Z₁ ∪ Z₂ → ∃ t ∈ Icc (0 : ℝ) 1, (y = ξ t ∧ y' = η t) ∨ + (y' = ξ t ∧ y = η t)) ∧ + InjOn a (Ico 0 1) ∧ (∀ t ∈ Icc (0 : ℝ) 1, ξ t ≠ η t) ∧ ((ξ 1 = ξ 0 ∧ η 1 = η 0) ∨ (ξ 1 = η 0 + ∧ η 1 = ξ 0)) := by + have h0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have h1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hdis := h + have hdis' := h' + obtain ⟨-, -, -, -, -, -, hd₁, -, -, -, -, -, -, -⟩ := hdis + obtain ⟨-, -, -, -, -, -, hd₂, -, -, -, -, -, -, -⟩ := hdis' + obtain ⟨a₁, ξ₁, η₁, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, -, -, c11⟩ := exists_arcPart h hψ + obtain ⟨a₂, ξ₂, η₂, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, -, -, d11⟩ := exists_arcPart h' hψ + have hne₁ : ∀ t ∈ Icc (0 : ℝ) 1, ξ₁ t ≠ η₁ t := fun t ht he => + Set.disjoint_left.mp hd₁ (c9 ▸ mem_image_of_mem _ ht) (c10 ▸ he ▸ mem_image_of_mem _ ht) + have hne₂ : ∀ t ∈ Icc (0 : ℝ) 1, ξ₂ t ≠ η₂ t := fun t ht he => + Set.disjoint_left.mp hd₂ (d9 ▸ mem_image_of_mem _ ht) (d10 ▸ he ▸ mem_image_of_mem _ ht) + /- After swapping the paths over `Z₂`, they continue the paths over `Z₁`. -/ + have key : ∀ ξ' η' : ℝ → Y, ContinuousOn ξ' (Icc 0 1) → ContinuousOn η' (Icc 0 1) → (∀ t ∈ Icc + (0 : ℝ) 1, ψ (ξ' t) = a₂ t) → + (∀ t ∈ Icc (0 : ℝ) 1, ψ (η' t) = a₂ t) → (∀ t ∈ Icc (0 : ℝ) 1, ξ' t ≠ η' t) → + (∀ y y', ψ y = ψ y' → y ≠ y' → ψ y ∈ Z₂ → ∃ t ∈ Icc (0 : ℝ) 1, (y = ξ' t ∧ y' = η' t) ∨ (y' + = ξ' t ∧ y = η' t)) → + ξ₁ 1 = ξ' 0 → η₁ 1 = η' 0 → ∃ (a : ℝ → S) (ξ η : ℝ → Y), ContinuousOn ξ (Icc 0 1) + ∧ ContinuousOn η (Icc 0 1) ∧ + (∀ t ∈ Icc (0 : ℝ) 1, ψ (ξ t) = a t) ∧ (∀ t ∈ Icc (0 : ℝ) 1, ψ (η t) = a t) ∧ a '' Icc 0 1 + = Z₁ ∪ Z₂ ∧ + (∀ y y', ψ y = ψ y' → y ≠ y' → ψ y ∈ Z₁ ∪ Z₂ → ∃ t ∈ Icc (0 : ℝ) 1, (y = ξ t ∧ y' = η t) ∨ + (y' = ξ t ∧ y = η t)) ∧ + InjOn a (Ico 0 1) ∧ (∀ t ∈ Icc (0 : ℝ) 1, ξ t ≠ η t) ∧ ((ξ 1 = ξ 0 ∧ η 1 = η 0) ∨ (ξ 1 + = η 0 ∧ η 1 = ξ 0)) := by + intro ξ' η' e1 e2 e3 e4 e5 e6 e7 e8 + have hab : a₁ 1 = a₂ 0 := by rw [c8, d7] + have hval : ∀ {T : Type uu} {f f' : ℝ → T}, f 1 = f' 0 → ∀ x ∈ Icc (0 : ℝ) 1, (conc2 f f' x = f + (2 * x) ∧ x ≤ 1 / 2) ∨ + (conc2 f f' x = f' (2 * x - 1) ∧ 1 / 2 ≤ x) := by + intro T f f' hff x hx + by_cases hx2 : x ≤ 1 / 2 + · exact .inl ⟨ite_eq_left hx2, hx2⟩ + · exact .inr ⟨ite_eq_right hx2, (not_le.mp hx2).le⟩ + have m₁ : ∀ {x : ℝ}, x ∈ Icc (0 : ℝ) 1 → x ≤ 1 / 2 → 2 * x ∈ Icc (0 : ℝ) 1 := fun hx h2 + => ⟨by linarith [hx.1], by linarith⟩ + have m₂ : ∀ {x : ℝ}, x ∈ Icc (0 : ℝ) 1 → 1 / 2 ≤ x → 2 * x - 1 ∈ Icc (0 : ℝ) 1 := fun hx h2 + => ⟨by linarith, by linarith [hx.2]⟩ + refine ⟨conc2 a₁ a₂, conc2 ξ₁ ξ', conc2 η₁ η', continuousOn_conc2 c1 e1 e7, + continuousOn_conc2 c2 e2 e8, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro t ht + rcases hval e7 t ht with ⟨e, h2⟩ | ⟨e, h2⟩ <;> rcases hval hab t ht with ⟨e', h3⟩ | ⟨e', h3⟩ + <;> rw [e, e'] + · exact c3 _ (m₁ ht h2) + · have : t = 1 / 2 := le_antisymm h2 h3 + subst this + norm_num + rw [c3 1 h1, hab] + · have : t = 1 / 2 := le_antisymm h3 h2 + subst this + norm_num + rw [e3 0 h0, hab] + · exact e3 _ (m₂ ht h2) + · intro t ht + rcases hval e8 t ht with ⟨e, h2⟩ | ⟨e, h2⟩ <;> rcases hval hab t ht with ⟨e', h3⟩ | ⟨e', h3⟩ + <;> rw [e, e'] + · exact c4 _ (m₁ ht h2) + · have : t = 1 / 2 := le_antisymm h2 h3 + subst this + norm_num + rw [c4 1 h1, hab] + · have : t = 1 / 2 := le_antisymm h3 h2 + subst this + norm_num + rw [e4 0 h0, hab] + · exact e4 _ (m₂ ht h2) + · apply subset_antisymm + · rintro _ ⟨t, ht, rfl⟩ + rcases hval hab t ht with ⟨e, h2⟩ | ⟨e, h2⟩ <;> rw [e] + · exact .inl (c5 ▸ mem_image_of_mem _ (m₁ ht h2)) + · exact .inr (d5 ▸ mem_image_of_mem _ (m₂ ht h2)) + · rintro z (hz | hz) + · obtain ⟨v, hv, rfl⟩ := c5.symm.subset hz + exact ⟨v / 2, half_mem hv, conc2_left hv⟩ + · obtain ⟨v, hv, rfl⟩ := d5.symm.subset hz + exact ⟨(1 + v) / 2, half_mem' hv, conc2_right hab hv⟩ + · intro y y' he hne hy + rcases hy with hy | hy + · obtain ⟨t, ht, h3⟩ := c6 y y' he hne hy + refine ⟨t / 2, half_mem ht, ?_⟩ + rw [conc2_left ht, conc2_left ht] + exact h3 + · obtain ⟨t, ht, h3⟩ := e6 y y' he hne hy + refine ⟨(1 + t) / 2, half_mem' ht, ?_⟩ + rw [conc2_right e7 ht, conc2_right e8 ht] + exact h3 + · have cross : ∀ x ∈ Icc (0 : ℝ) 1, ∀ y ∈ Ico (0 : ℝ) 1, a₁ x = a₂ y → y = 0 := by + intro x hx y hy he + have h3 : a₂ y ∈ Z₁ ∩ Z₂ := ⟨he ▸ c5 ▸ mem_image_of_mem _ hx, d5 ▸ mem_image_of_mem _ + (Ico_subset_Icc_self hy)⟩ + rw [hi] at h3 + rcases h3 with h3 | h3 + · have h4 : a₂ y = a₂ 1 := by rw [h3, d8] + exact absurd (d11 (Ico_subset_Icc_self hy) h1 h4) hy.2.ne + · exact d11 (Ico_subset_Icc_self hy) h0 (by rw [h3, d7]) + intro x hx y hy he + rcases hval hab x (Ico_subset_Icc_self hx) with ⟨e, h2⟩ | ⟨e, h2⟩ <;> + rcases hval hab y (Ico_subset_Icc_self hy) with ⟨e', h3⟩ | ⟨e', h3⟩ <;> rw [e, e'] at he + · have := c11 (m₁ (Ico_subset_Icc_self hx) h2) (m₁ (Ico_subset_Icc_self hy) h3) he + linarith + · have h4 := cross _ (m₁ (Ico_subset_Icc_self hx) h2) _ ⟨(m₂ (Ico_subset_Icc_self hy) h3).1, + by linarith [hy.2]⟩ he + have h5 : y = 1 / 2 := by linarith + subst h5 + have h6 : a₁ (2 * x) = a₁ 1 := by rw [he, h4, hab] + have := c11 (m₁ (Ico_subset_Icc_self hx) h2) h1 h6 + linarith + · have h4 := cross _ (m₁ (Ico_subset_Icc_self hy) h3) _ ⟨(m₂ (Ico_subset_Icc_self hx) h2).1, + by linarith [hx.2]⟩ he.symm + have h5 : x = 1 / 2 := by linarith + subst h5 + have h6 : a₁ (2 * y) = a₁ 1 := by rw [← he, h4, hab] + have := c11 (m₁ (Ico_subset_Icc_self hy) h3) h1 h6 + linarith + · have := d11 (m₂ (Ico_subset_Icc_self hx) h2) (m₂ (Ico_subset_Icc_self hy) h3) he + linarith + · intro t ht + by_cases hx2 : t ≤ 1 / 2 + · have e : conc2 ξ₁ ξ' t = ξ₁ (2 * t) := ite_eq_left hx2 + have e' : conc2 η₁ η' t = η₁ (2 * t) := ite_eq_left hx2 + rw [e, e'] + exact hne₁ _ (m₁ ht hx2) + · have e : conc2 ξ₁ ξ' t = ξ' (2 * t - 1) := ite_eq_right hx2 + have e' : conc2 η₁ η' t = η' (2 * t - 1) := ite_eq_right hx2 + rw [e, e'] + exact e5 _ (m₂ ht (not_le.mp hx2).le) + · rw [conc2_zero, conc2_zero, conc2_one e7, conc2_one e8] + have g1 : ψ (ξ' 1) = u := by rw [e3 1 h1, d8] + have g2 : ψ (η' 1) = u := by rw [e4 1 h1, d8] + have g3 : ψ (ξ₁ 0) = u := by rw [c3 0 h0, c7] + have g4 : ψ (η₁ 0) = u := by rw [c4 0 h0, c7] + rcases eq_or_of_encard_le_two hu g3 g4 (c := ξ' 1) g1 (hne₁ 0 h0) with e | e <;> + rcases eq_or_of_encard_le_two hu g3 g4 (c := η' 1) g2 (hne₁ 0 h0) with e' | e' + · exact absurd (e.trans e'.symm) (e5 1 h1) + · exact .inl ⟨e, e'⟩ + · exact .inr ⟨e, e'⟩ + · exact absurd (e.trans e'.symm) (e5 1 h1) + have g1 : ψ (ξ₂ 0) = c := by rw [d3 0 h0, d7] + have g2 : ψ (η₂ 0) = c := by rw [d4 0 h0, d7] + have g3 : ψ (ξ₁ 1) = c := by rw [c3 1 h1, c8] + have g4 : ψ (η₁ 1) = c := by rw [c4 1 h1, c8] + rcases eq_or_of_encard_le_two hc g3 g4 (c := ξ₂ 0) g1 (hne₁ 1 h1) with e | e <;> + rcases eq_or_of_encard_le_two hc g3 g4 (c := η₂ 0) g2 (hne₁ 1 h1) with e' | e' + · exact absurd (e.trans e'.symm) (hne₂ 0 h0) + · exact key ξ₂ η₂ d1 d2 d3 d4 hne₂ d6 e.symm e'.symm + · refine key η₂ ξ₂ d2 d1 d4 d3 (fun t ht => (hne₂ t ht).symm) (fun y y' he hne hy + => ?_) e'.symm e.symm + obtain ⟨t, ht, h3⟩ := d6 y y' he hne hy + exact ⟨t, ht, h3.elim (fun h4 => .inr h4.symm) fun h4 => .inl h4.symm⟩ + · exact absurd (e.trans e'.symm) (hne₂ 0 h0) + +end + +/-- A one to one loop on a circle that runs forward goes around once. -/ +theorem loop_turn {n : ℝ → ℝ} (c : ContinuousOn n (Icc 0 1)) (s : StrictMonoOn n (Icc 0 1)) + (hi : InjOn (fun u => ee (n u)) (Ico 0 1)) + (he : ee (n 0) = ee (n 1)) : n 1 = n 0 + 1 := by + have h0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have h1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + obtain ⟨m, hm⟩ := ee_eq_iff.mp he + have h01 := s h0 h1 zero_lt_one + have hm0 : (m : ℝ) < 0 := by linarith + have hm1 : m < 0 := by exact_mod_cast hm0 + by_contra hne + have hm2 : m ≠ -1 := by + rintro rfl + apply hne + push_cast at hm + linarith + have hm3 : m ≤ -2 := by omega + have hm4 : (m : ℝ) ≤ -2 := by exact_mod_cast hm3 + obtain ⟨v, hv, hev⟩ := intermediate_value_Icc zero_le_one c (show n 0 + 1 ∈ Icc (n 0) + (n 1) from ⟨by linarith, by linarith⟩) + have hv1 : v ≠ 1 := by + rintro rfl + linarith + have hv0 : v ∈ Ico (0 : ℝ) 1 := ⟨hv.1, lt_of_le_of_ne hv.2 hv1⟩ + have h2 : ee (n v) = ee (n 0) := by rw [hev, ee_add_one] + have h3 := hi hv0 ⟨le_rfl, zero_lt_one⟩ h2 + rw [h3] at hev + linarith + +/-- A loop that goes around once meets every point of the circle. -/ +theorem loop_fill {n : ℝ → ℝ} (c : ContinuousOn n (Icc 0 1)) (h1 : n 1 = n 0 + 1) + (x : ℝ) : ∃ v ∈ Icc (0 : ℝ) 1, ee (n v) = ee x := by + set k := ⌊x - n 0⌋ with hk + have h2 : (k : ℝ) ≤ x - n 0 := Int.floor_le _ + have h3 : x - n 0 < k + 1 := Int.lt_floor_add_one _ + obtain ⟨v, hv, he⟩ := intermediate_value_Icc zero_le_one c + (show x - k ∈ Icc (n 0) (n 1) from ⟨by linarith, by rw [h1]; linarith⟩) + refine ⟨v, hv, ?_⟩ + rw [he, ← ee_add_int (x - k) k] + congr 1 + ring + +theorem ee_negate_inj {x y : ℝ} (h : ee (-x) = ee (-y)) : ee x = ee y := by + obtain ⟨m, hm⟩ := ee_eq_iff.mp h + refine ee_eq_iff.mpr ⟨-m, ?_⟩ + push_cast + linarith + +/-- A one to one loop on a cuff goes around once, in one of the two directions. -/ +theorem exists_loop_turn {T : Type*} [TopologicalSpace T] {C : Set T} (φ : Circle ≃ₜ C) {ρ : ℝ → T} + (cρ : ContinuousOn ρ (Icc 0 1)) + (hρ : ∀ u ∈ Icc (0 : ℝ) 1, ρ u ∈ C) (hi : InjOn ρ (Ico 0 1)) (h01 : ρ 0 = ρ 1) : + ∃ (σ : Bool) (n : ℝ → ℝ), ContinuousOn n (Icc 0 1) ∧ StrictMonoOn n (Icc 0 1) ∧ n 1 = n 0 + 1 ∧ + ∀ u ∈ Icc (0 : ℝ) 1, (φ (ee (n u))).1 = ρ (ofs σ u) := by + have m0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have m1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + obtain ⟨n, n1, n2⟩ := exists_lift φ cρ hρ + have hinj : InjOn (fun u => ee (n u)) (Ico 0 1) := by + intro x hx y hy he + refine hi hx hy ?_ + rw [← n2 x (Ico_subset_Icc_self hx), ← n2 y (Ico_subset_Icc_self hy)] + exact congrArg (fun w => (φ w).1) he + have he : ee (n 0) = ee (n 1) := by + apply φ.injective + apply Subtype.ext + rw [n2 0 m0, n2 1 m1, h01] + rcases lift_mono_loop n1 hinj with hs | hs + · exact ⟨true, n, n1, hs, loop_turn n1 hs hinj he, fun u hu => by rw [ofs_true]; exact n2 u hu⟩ + · have hc' : ContinuousOn (fun u => - n u) (Icc 0 1) := n1.neg + have hs' : StrictMonoOn (fun u => - n u) (Icc 0 1) := fun x hx y hy hxy => neg_lt_neg + (hs hx hy hxy) + have hi' : InjOn (fun u => ee (- n u)) (Ico 0 1) := fun x hx y hy he' => hinj hx hy + (ee_negate_inj he') + have he' : ee (- n 0) = ee (- n 1) := by + obtain ⟨m, hm⟩ := ee_eq_iff.mp he + refine ee_eq_iff.mpr ⟨-m, ?_⟩ + push_cast + linarith + have h3 := loop_turn hc' hs' hi' he' + refine ⟨false, fun u => n (1 - u), n1.comp (by fun_prop) fun u hu => rev_mem hu, + fun x hx y hy hxy => hs (rev_mem hy) (rev_mem hx) (by linarith), ?_, + fun u hu => ?_⟩ + · simp only [sub_self, sub_zero] + linarith + · simp only [ofs_false] + exact n2 _ (rev_mem hu) + +/-- A one to one loop on a cuff fills the cuff. -/ +theorem loop_image {T : Type*} [TopologicalSpace T] {C : Set T} (φ : Circle ≃ₜ C) {ρ : ℝ → T} + (cρ : ContinuousOn ρ (Icc 0 1)) + (hρ : ∀ u ∈ Icc (0 : ℝ) 1, ρ u ∈ C) (hi : InjOn ρ (Ico 0 1)) (h01 : ρ 0 = ρ 1) : ρ '' Icc 0 1 + = C := by + obtain ⟨σ, n, n1, -, n3, n4⟩ := exists_loop_turn φ cρ hρ hi h01 + apply subset_antisymm + · rintro _ ⟨u, hu, rfl⟩ + exact hρ u hu + · intro z hz + obtain ⟨w, hw⟩ := φ.surjective ⟨z, hz⟩ + obtain ⟨x, rfl⟩ := ee_surjective w + obtain ⟨v, hv, he⟩ := loop_fill n1 n3 x + refine ⟨ofs σ v, ofs_mem hv, ?_⟩ + rw [← n4 v hv, he, hw] + +/-- An `O`-arc inside an `O`-arc is the whole `O`-arc. -/ +theorem oarc_eq {T : Type*} [TopologicalSpace T] {C X : Set T} (φ : Circle ≃ₜ C) + (hX : IsOArc X) (hs : X ⊆ C) : X = C := by + obtain ⟨e⟩ := id hX + obtain ⟨ι, h1, h2, h3, h4, -, h5⟩ := hX.exists_iota (e 1).2 + have h6 : ι '' Icc 0 1 = X := by + apply subset_antisymm + · rintro _ ⟨u, hu, rfl⟩ + rcases eq_or_lt_of_le hu.2 with rfl | h7 + · rw [h3] + exact (e 1).2 + · exact h5 ▸ mem_image_of_mem ι ⟨hu.1, h7⟩ + · rw [← h5] + exact image_mono Ico_subset_Icc_self + rw [← h6] + exact loop_image φ h1.continuousOn (fun u hu => hs (h6 ▸ mem_image_of_mem ι hu)) h4 + (h2.trans h3.symm) + +theorem ee_injOn : InjOn ee (Ico 0 1) := by + intro x hx y hy he + obtain ⟨m, hm⟩ := ee_eq_iff.mp he + have h1 : (m : ℝ) < 1 := by linarith [hx.2, hy.1] + have h2 : (-1 : ℝ) < m := by linarith [hx.1, hy.2] + have h3 : m < 1 := by exact_mod_cast h1 + have h4 : -1 < m := by exact_mod_cast h2 + have h5 : m = 0 := by omega + subst h5 + simpa using hm + +theorem ee_one : ee 1 = ee 0 := by + have := ee_add_one 0 + simpa using this + +section + +variable {Y S : Type uu} [TopologicalSpace Y] [TopologicalSpace S] [T2Space S] {ψ : Y + → S} {F : Set S} + +/-- The other lift of a loop. -/ +theorem loop_lift {ξ : ℝ → Y} {X X' : Set Y} (hψ : IsCutting ψ F) (hun : X ∪ X' = ψ ⁻¹' F) + (b1 : BijOn ψ X F) (b2 : BijOn ψ X' F) + (hX' : IsCompact X') (cξ : ContinuousOn ξ (Icc 0 1)) (himξ : ξ '' Icc 0 1 = X) : + ∃ η : ℝ → Y, ArcLift ψ F (fun u => ψ (ξ u)) ξ η ∧ η '' Icc 0 1 = X' ∧ + ∀ u ∈ Icc (0 : ℝ) 1, ∀ v ∈ Icc (0 : ℝ) 1, ξ u = ξ v ↔ η u = η v := by + obtain ⟨hcψ, -, hinj, -, -⟩ := id hψ + have hne : Nonempty Y := by + obtain ⟨z, hz⟩ : (Icc (0 : ℝ) 1).Nonempty := ⟨0, by simp⟩ + exact ⟨ξ z⟩ + obtain ⟨ψ', hψ'c, hψ'⟩ := exists_inv_of_compactOn hX' hcψ.continuousOn b2.injOn + have him : ψ '' X' = F := b2.image_eq + have hξX : ∀ u ∈ Icc (0 : ℝ) 1, ξ u ∈ X := fun u hu => himξ ▸ mem_image_of_mem ξ hu + have hc1 : ContinuousOn (fun u => ψ (ξ u)) (Icc 0 1) := hcψ.comp_continuousOn cξ + have hc2 : ContinuousOn (fun u => ψ' (ψ (ξ u))) (Icc 0 1) := + hψ'c.comp hc1 fun u hu => by + rw [him] + exact b1.mapsTo (hξX u hu) + have hηX : ∀ u ∈ Icc (0 : ℝ) 1, ψ' (ψ (ξ u)) ∈ X' ∧ ψ (ψ' (ψ (ξ u))) = ψ (ξ u) := fun u hu => by + obtain ⟨y, hy, he⟩ := b2.surjOn (b1.mapsTo (hξX u hu)) + rw [← he, hψ' hy] + exact ⟨hy, rfl⟩ + refine ⟨fun u => ψ' (ψ (ξ u)), ⟨cξ, hc2, fun u _ => rfl, fun u hu => (hηX u hu).2, ?_, ?_⟩, ?_, + fun u hu v hv => ⟨fun he => ?_, fun he => ?_⟩⟩ + · rw [← b1.image_eq, ← himξ, image_image] + · intro y y' he hne' + by_cases hy : ψ y ∈ F + · have m1 : y ∈ X ∪ X' := by + rw [hun] + exact hy + have m2 : y' ∈ X ∪ X' := by + rw [hun] + change ψ y' ∈ F + rw [← he] + exact hy + have key : ∀ z ∈ X, ∀ z' ∈ X', ψ z = ψ z' → ∃ u ∈ Icc (0 : ℝ) 1, z = ξ u ∧ z' = ψ' (ψ (ξ u)) + := by + intro z hz z' hz' he' + obtain ⟨u, hu, rfl⟩ := himξ.symm.subset hz + exact ⟨u, hu, rfl, by rw [he', hψ' hz']⟩ + rcases m1 with m1 | m1 <;> rcases m2 with m2 | m2 + · exact absurd (b1.injOn m1 m2 he) hne' + · obtain ⟨u, hu, h11, h12⟩ := key y m1 y' m2 he + exact ⟨u, hu, .inl ⟨h11, h12⟩⟩ + · obtain ⟨u, hu, h11, h12⟩ := key y' m2 y m1 he.symm + exact ⟨u, hu, .inr ⟨h11, h12⟩⟩ + · exact absurd (b2.injOn m1 m2 he) hne' + · exact absurd (hinj hy (show ψ y' ∈ Fᶜ from he ▸ hy) he) hne' + · ext z + constructor + · rintro ⟨u, hu, rfl⟩ + exact (hηX u hu).1 + · intro hz + obtain ⟨y, hy, he⟩ := b1.surjOn (b2.mapsTo hz) + obtain ⟨u, hu, rfl⟩ := himξ.symm.subset hy + refine ⟨u, hu, ?_⟩ + change ψ' (ψ (ξ u)) = z + rw [he, hψ' hz] + · simp only [he] + · have h11 : ψ (ξ u) = ψ (ξ v) := by + rw [← (hηX u hu).2, ← (hηX v hv).2] + exact congrArg ψ he + exact b1.injOn (hξX u hu) (hξX v hv) h11 + +end + +/-- Counts labels in an explicit word whose tail has known counts. -/ +local macro "ct" : tactic => + `(tactic| ((try simp only [hB, holB, List.cons_append, List.nil_append, List.append_assoc, + cnt_append, cnt_cons, cnt_nil, tL, rL, frL, linv, Prod.fst, *]); (try split_ifs) <;> omega)) + +section + +variable {Y S : Type uu} [TopologicalSpace Y] [T2Space Y] [TopologicalSpace S] {ψ : Y + → S} {F : Set S} + {a b c i j : ℕ} {L : List ℕ} + +omit [T2Space Y] in +/-- Two cuffs of a connected surface are the lifts of an `O`-arc. -/ +theorem loop_two_aux [T2Space S] (hS : IsSurface Y) (hψ : IsCutting ψ F) {C C' : Set Y} + (hC' : IsCuff C') (hcl : IsClosed C) (hcl' : IsClosed C') + (hd : Disjoint C C') (hun : C ∪ C' = ψ ⁻¹' F) (b1 : BijOn ψ C F) (b2 : BijOn ψ C' F) + (φ : Circle ≃ₜ C) (φ' : Circle ≃ₜ C') + (hij : i ≠ j) (_hi : i < c) (_hj : j < c) (hL : ∀ m ∈ L, m < c ∧ m ≠ i ∧ m ≠ j) {g₀ : ℕ × ℂ → Y} + (hg : Presents (sW (hB a b j ++ (hB a b i ++ rW a b c L))) g₀) + (h1 : SideVal (sW (hB a b j ++ (hB a b i ++ rW a b c L))) g₀ (rL a b i).1 fun u => (φ (ee u)).1) + (h2 : SideVal (sW (hB a b j ++ (hB a b i ++ rW a b c L))) g₀ (rL a b j).1 fun u => (φ' + (ee u)).1) : + ∃ (σ : Bool) (g : ℕ × ℂ → Y), Presents (sW (blkE a b i j σ ++ rW a b c L)) (ψ ∘ g) ∧ + SideVal (sW (blkE a b i j σ ++ rW a b c L)) (ψ ∘ g) (rL a b i).1 fun u => ψ (φ (ee u)).1 := by + have : CompactSpace Y := hS.1 + have m0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have m1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have cξ : ContinuousOn (fun u => (φ (ee u)).1) (Icc 0 1) := + (continuous_subtype_val.comp (φ.continuous.comp continuous_ee)).continuousOn + have injξ : InjOn (fun u => (φ (ee u)).1) (Ico 0 1) := fun x hx y hy he => + ee_injOn hx hy (φ.injective (Subtype.ext he)) + have h01 : (φ (ee 0)).1 = (φ (ee 1)).1 := by rw [ee_one] + have himξ := loop_image φ cξ (fun u _ => (φ _).2) injξ h01 + obtain ⟨η, L₀, himη, hiff⟩ := loop_lift hψ hun b1 b2 hcl'.isCompact cξ himξ + have hη : ∀ u ∈ Icc (0 : ℝ) 1, η u ∈ C' := fun u hu => himη ▸ mem_image_of_mem η hu + have cl : η 0 = η 1 := (hiff 0 m0 1 m1).mp h01 + have injη : InjOn η (Ico 0 1) := fun x hx y hy he => + injξ hx hy ((hiff x (Ico_subset_Icc_self hx) y (Ico_subset_Icc_self hy)).mpr he) + obtain ⟨σ, n', c', s', h3, h4⟩ := exists_loop_turn φ' L₀.cη hη injη cl + have c1 : cnt (rW a b c L) (2 * a + b + 2 * i + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL m hm + omega + have c2 : cnt (rW a b c L) (2 * a + b + 2 * j + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL m hm + omega + obtain ⟨g₁, p1, p2, p3⟩ := exists_pieces1 hS hC' hcl.isOpen_compl + (subset_compl_iff_disjoint_left.mpr hd) φ' hg h2 c' s' h3 + have p4 := p3 (rL a b i).1 _ h1 fun u _ h => h (φ _).2 + have e0 : hB a b j ++ (hB a b i ++ rW a b c L) = [tL a b j] ++ ((rL a b j).1, true) :: (linv + (tL a b j) :: tL a b i :: rL a b i :: linv (tL a b i) :: rW a b c L) := by + simp [hB, holB, rL] + rw [e0] at p1 p2 p4 + obtain ⟨h5, h6⟩ := glue_word (p₁ := 4) L₀ hψ.1 hψ.2.1 (A := [tL a b j]) (q := (rL a b j).1) (p := + (rL a b i).1) (σ := σ) rfl (by simp) + (by ct) (by ct) p1 p4 (ζ := fun u => (φ' (ee (n' u))).1) p2 + (fun u hu => by simp only [h4 _ (ofs_mem hu), ofs_ofs]) + exact ⟨σ, g₁, h5, h6⟩ + +/-- One cuff of a connected surface is the double lift of an `O`-arc. -/ +theorem loop_one_aux (hS : IsSurface Y) {a₀ : ℝ → S} {ξ η : ℝ → Y} (L₀ : ArcLift ψ F a₀ ξ η) + (hψc : Continuous ψ) (hsurj : Surjective ψ) {C : Set Y} + (hC : IsCuff C) (φ : Circle ≃ₜ C) (hi : i < c) (hL : ∀ m ∈ L, m < c ∧ m ≠ i) {g₀ : ℕ × ℂ → Y} + (hg : Presents (sW (hB a b i ++ rW a b c L)) g₀) + (h1 : SideVal (sW (hB a b i ++ rW a b c L)) g₀ (rL a b i).1 fun u => (φ (ee u)).1) + (hξ : ∀ u ∈ Icc (0 : ℝ) 1, ξ u ∈ C) (hη : ∀ u ∈ Icc (0 : ℝ) 1, η u ∈ C) (hinj : InjOn + (conc2 ξ η) (Ico 0 1)) (e1 : ξ 1 = η 0) (e2 : η 1 = ξ 0) : + ∃ (g : ℕ × ℂ → Y) (a' : ℝ → S), Presents (sW (blkD a b i ++ rW a b c L)) (ψ ∘ g) ∧ + SideVal (sW (blkD a b i ++ rW a b c L)) (ψ ∘ g) (rL a b i).1 a' ∧ (∀ u ∈ Icc + (0 : ℝ) 1, a' u ∈ F) ∧ a' 1 = a' 0 ∧ + ContinuousOn a' (Icc 0 1) := by + have cρ := continuousOn_conc2 L₀.cξ L₀.cη e1 + have hρC : ∀ u ∈ Icc (0 : ℝ) 1, conc2 ξ η u ∈ C := by + intro u hu + unfold conc2 + split_ifs with h2 + · exact hξ _ ⟨by linarith [hu.1], by linarith⟩ + · exact hη _ ⟨by linarith [not_le.mp h2], by linarith [hu.2]⟩ + have hcl : conc2 ξ η 0 = conc2 ξ η 1 := by rw [conc2_zero, conc2_one e1, e2] + obtain ⟨σ, n, n1, n2, n3, n4⟩ := exists_loop_turn φ cρ hρC hinj hcl + have c1m : ContinuousOn (fun u => n (u / 2)) (Icc 0 1) := n1.comp (by fun_prop) fun u hu + => half_mem hu + have c2m : ContinuousOn (fun u => n ((1 + u) / 2)) (Icc 0 1) := n1.comp (by fun_prop) fun u hu + => half_mem' hu + have s1m : StrictMonoOn (fun u => n (u / 2)) (Icc 0 1) := fun x hx y hy hxy => n2 (half_mem hx) + (half_mem hy) (by linarith) + have s2m : StrictMonoOn (fun u => n ((1 + u) / 2)) (Icc 0 1) := fun x hx y hy hxy => n2 + (half_mem' hx) (half_mem' hy) (by linarith) + have m0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have m1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have h01 : a₀ 1 = a₀ 0 := by rw [← L₀.hξ 1 m1, e1, L₀.hη 0 m0] + have hval : ∃ (a' : ℝ → S) (ξ' η' : ℝ → Y), a' 1 = a' 0 ∧ ArcLift ψ F a' ξ' η' ∧ (∀ u ∈ Icc + (0 : ℝ) 1, (φ (ee (n (u / 2)))).1 = ξ' u) ∧ + ∀ u ∈ Icc (0 : ℝ) 1, (φ (ee (n ((1 + u) / 2)))).1 = η' u := by + cases σ with + | true => + refine ⟨a₀, ξ, η, h01, L₀, fun u hu => ?_, fun u hu => ?_⟩ + · rw [n4 _ (half_mem hu), ofs_true, conc2_left hu] + · rw [n4 _ (half_mem' hu), ofs_true, conc2_right e1 hu] + | false => + refine ⟨_, _, _, ?_, L₀.rev.swap, fun u hu => ?_, fun u hu => ?_⟩ + · simp only [sub_self, sub_zero] + exact h01.symm + · rw [n4 _ (half_mem hu), ofs_false, show 1 - u / 2 = (1 + (1 - u)) / 2 by ring, + conc2_right e1 (rev_mem hu)] + · rw [n4 _ (half_mem' hu), ofs_false, show 1 - (1 + u) / 2 = (1 - u) / 2 by ring, + conc2_left (rev_mem hu)] + obtain ⟨a', ξ', η', hclosed, L', h2, h3⟩ := hval + have c1 : cnt (rW a b c L) (2 * a + b + 2 * i + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL m hm + omega + have c3 : cnt (rW a b c L) (2 * a + b + 2 * c + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL m hm + omega + have e0 : hB a b i ++ rW a b c L = [tL a b i] ++ ((rL a b i).1, true) :: (linv + (tL a b i) :: rW a b c L) := by + simp [hB, holB, rL] + rw [e0] at hg h1 + obtain ⟨g₁, p1, p2, p3, -⟩ := exists_pieces2 hS hC isOpen_univ (subset_univ _) φ (q := frL a b c) + (by simp [rL, frL]; omega) + (noLab_iff_cnt.mpr (by ct)) (noLab_iff_cnt.mpr (by ct)) hg h1 c1m c2m s1m s2m (by norm_num) (by + norm_num + exact n3) + obtain ⟨h5, h6⟩ := glue_word (p₁ := 1) L' hψc hsurj (A := [tL a b i, rL a b i]) (q := frL a b c) + (p := (rL a b i).1) + (B := linv (tL a b i) :: rW a b c L) (σ := true) rfl (by simp) (by ct) (by ct) + p1 (p2.congr h2) p3 + (fun u hu => by + rw [ofs_true] + exact h3 u hu) + refine ⟨g₁, a', h5, h6, fun u hu => L'.img ▸ mem_image_of_mem a' hu, ?_, ?_⟩ + · exact hclosed + · exact (hψc.comp_continuousOn L'.cξ).congr fun u hu => (L'.hξ u hu).symm + +end + +/-- Classify the connected cut surface and present the surface obtained by gluing its two +cuffs back together. -/ +theorem connected_two_cuff_presentation + {Y S : Type uu} [TopologicalSpace Y] [TopologicalSpace S] [T2Space S] + {ψ : Y → S} {F : Set S} {X X' : Set Y} + (hY : IsSurface Y) (hYc : ConnectedSpace Y) (hψ : IsCutting ψ F) + (hOX : IsOArc X) (hOX' : IsOArc X') (hdX : Disjoint X X') + (hunX : X ∪ X' = ψ ⁻¹' F) (b1 : BijOn ψ X F) (b2 : BijOn ψ X' F) : + ∃ (a b c : ℕ) (_ : Y ≃ₜ SurfaceModel a b c) + (i j : ℕ) (φ : Circle ≃ₜ X) (σ : Bool) (g : ℕ × ℂ → Y), + i < c ∧ j < c ∧ i ≠ j ∧ + let word := sW (blkE a b i j σ ++ rW a b c (((List.range' 0 c).erase i).erase j)) + Presents word (ψ ∘ g) ∧ SideVal word (ψ ∘ g) (rL a b i).1 (fun u => ψ (φ (ee u)).1) := by + have : T2Space Y := hY.2.1 + obtain ⟨a, b, c, ⟨e⟩⟩ := classification.{uu} Y hY hYc + have hdcuff := cuff_statement.{uu} Y hY + obtain ⟨param₁⟩ := id hOX + obtain ⟨param₂⟩ := id hOX' + let x := (param₁ 1).1 + let y := (param₂ 1).1 + have hx : x ∈ X := (param₁ 1).2 + have hy : y ∈ X' := (param₂ 1).2 + have hXb : X ⊆ bd Y := fun z hz => hψ.2.2.2.2 (hunX ▸ Or.inl hz) + have hXb' : X' ⊆ bd Y := fun z hz => hψ.2.2.2.2 (hunX ▸ Or.inr hz) + have hC : connectedComponentIn (bd Y) x ∈ cuffs Y := ⟨_, hXb hx, rfl⟩ + have hC' : connectedComponentIn (bd Y) y ∈ cuffs Y := ⟨_, hXb' hy, rfl⟩ + obtain ⟨φ₀⟩ := hdcuff.2.2 _ hC + obtain ⟨φ₀'⟩ := hdcuff.2.2 _ hC' + have eX := oarc_eq φ₀ hOX (hOX.isPreconnected.subset_connectedComponentIn hx hXb) + have eX' := oarc_eq φ₀' hOX' (hOX'.isPreconnected.subset_connectedComponentIn hy hXb') + have hXc : X ∈ cuffs Y := eX.symm ▸ hC + have hXc' : X' ∈ cuffs Y := eX'.symm ▸ hC' + have hne : X ≠ X' := fun h => Set.disjoint_left.mp hdX hx (h ▸ hx) + obtain ⟨i, hi, j, hj, hij, φ, φ', g, hg, hs, hs'⟩ := exists_two_holes e hXc hXc' hne + have hLf := (erase_erase_facts c i j).2 + obtain ⟨σ, g', hp, side⟩ := loop_two_aux hY hψ hXc' hOX.isCompact.isClosed + hOX'.isCompact.isClosed hdX hunX b1 b2 φ φ' hij hi hj hLf hg hs hs' + exact ⟨a, b, c, e, i, j, φ, σ, g', hi, hj, hij, hp, side⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutNull.lean b/LeanPool/GraphMinor/Surface/CutNull.lean new file mode 100644 index 0000000000..940b8a6736 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutNull.lean @@ -0,0 +1,587 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutSimilar +public import LeanPool.GraphMinor.Surface.VoltWord + +/-! +# O-arcs that are not null-homotopic + +We use `volt_zero` on the words of a surface that have an `O`-arc as a side. + +An `O`-arc that does not separate gets a value of order two. If an `O`-arc separates and neither +side is a disc, then we need a +group that is not commutative, since the two sides of a separating curve cancel in every commutative +group. We take the group +`S₃` and give the `O`-arc a 3-cycle. A 3-cycle is a commutator, it is a square, and a free side of a +hole can have any value, so +each of the two sides of the `O`-arc can close up (`exists_close`). This is the same idea as the +standard fact that surface groups +are residually finite: see P. Scott, *Subgroups of surface groups are almost geometric*, J. London +Math. Soc. 17 (1978) 555–565. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +universe u + +/-- The symmetric group on three letters, written additively. -/ +abbrev S3 : Type := Additive (Equiv.Perm (Fin 3)) + +/-- A value of order three. -/ +def T3 (v : S3) : Prop := v ≠ 0 ∧ v + v + v = 0 + +instance : DecidablePred T3 := fun v => by + unfold T3 + infer_instance + +theorem t3_exists : ∃ v, T3 v := by decide + +theorem T3.neg : ∀ {v : S3}, T3 v → T3 (-v) := by decide + +theorem T3.square : ∀ {v : S3}, T3 v → ∃ x : S3, x + x = v := by decide + +theorem T3.comm : ∀ {v : S3}, T3 v → ∃ x y : S3, x + y + -x + -y = v := by decide + +theorem order_two_exists : ∃ v : S3, v ≠ 0 ∧ v + v = 0 := by decide + +section counts + +/-- A label occurs at most `cnt w k` times, as positions of the word. -/ +theorem idx_encard_le (w : List Letter) (k : ℕ) : {p : ℕ | ∃ e, w[p]? = some (k, e)}.encard + ≤ cnt w k := by + induction w with + | nil => simp [cnt_nil] + | cons l w ih => + have himg : {p : ℕ | ∃ e, w[p]? = some (k, e)}.encard = (Nat.succ '' {p : ℕ | ∃ e, w[p]? = some + (k, e)}).encard := + (Nat.succ_injective.injOn.encard_image).symm + rw [cnt_cons] + by_cases h : l.1 = k + · have hs : {p : ℕ | ∃ e, (l :: w)[p]? = some (k, e)} ⊆ insert 0 (Nat.succ '' {p : ℕ | ∃ e, + w[p]? = some (k, e)}) := by + rintro (_ | p) ⟨e, he⟩ + · exact .inl rfl + · exact .inr ⟨p, ⟨e, by simpa using he⟩, rfl⟩ + refine (encard_le_encard hs).trans ((encard_insert_le _ _).trans ?_) + rw [← himg, ite_eq_left h] + push_cast + rw [add_comm] + gcongr + · have hs : {p : ℕ | ∃ e, (l :: w)[p]? = some (k, e)} ⊆ Nat.succ '' {p : ℕ | ∃ e, w[p]? = some + (k, e)} := by + rintro (_ | p) ⟨e, he⟩ + · simp only [List.getElem?_cons_zero, Option.some.injEq] at he + exact absurd (by rw [he]) h + · exact ⟨p, ⟨e, by simpa using he⟩, rfl⟩ + refine (encard_le_encard hs).trans ?_ + rw [← himg, ite_eq_right h, zero_add] + exact ih + +theorem isPaired_sW {w : List Letter} (h : Good w) : IsPaired (sW w) := by + intro k + have hs : {s : ℕ × ℕ | ∃ e, (sW w s.1)[s.2]? = some (k, e)} ⊆ (fun p => + ((0 : ℕ), p)) '' {p : ℕ | ∃ e, w[p]? = some (k, e)} := by + rintro ⟨i, p⟩ ⟨e, he⟩ + obtain ⟨rfl, h2⟩ := sW_get he + exact ⟨p, ⟨e, h2⟩, rfl⟩ + refine (encard_le_encard hs).trans ((encard_image_le _ _).trans ((idx_encard_le w k).trans ?_)) + exact_mod_cast h k + +theorem isPaired_dW {u v : List Letter} (h : ∀ k, cnt u k + cnt v k ≤ 2) : IsPaired (dW u v) := by + intro k + have hs : {s : ℕ × ℕ | ∃ e, (dW u v s.1)[s.2]? = some (k, e)} ⊆ + (fun p => ((0 : ℕ), p)) '' {p : ℕ | ∃ e, u[p]? = some (k, e)} ∪ (fun p => + ((1 : ℕ), p)) '' {p : ℕ | ∃ e, v[p]? = some (k, e)} := by + rintro ⟨i, p⟩ ⟨e, he⟩ + rcases dW_cases u v i with ⟨rfl, h2⟩ | ⟨rfl, h2⟩ | h2 + · rw [h2] at he + exact .inl ⟨p, ⟨e, he⟩, rfl⟩ + · rw [h2] at he + exact .inr ⟨p, ⟨e, he⟩, rfl⟩ + · rw [h2] at he + simp at he + refine (encard_le_encard hs).trans ((encard_union_le _ _).trans ?_) + have h1 := (encard_image_le (fun p => ((0 : ℕ), p)) {p : ℕ | ∃ e, u[p]? = some (k, e)}).trans + (idx_encard_le u k) + have h2 := (encard_image_le (fun p => ((1 : ℕ), p)) {p : ℕ | ∃ e, v[p]? = some (k, e)}).trans + (idx_encard_le v k) + refine (add_le_add h1 h2).trans ?_ + exact_mod_cast h k + +theorem finW_dW (u v : List Letter) : FinW (dW u v) := by + refine (finite_le_nat 1).subset fun k hk => ?_ + rcases dW_cases u v k with ⟨rfl, -⟩ | ⟨rfl, -⟩ | e + · simp + · simp + · exact absurd e hk + +theorem good_append {A B : List Letter} (hA : Good A) (hB : Good B) (hX : DisjL A B) : Good + (A ++ B) := by + intro k + rw [cnt_append] + by_cases h : ∃ l ∈ A, l.1 = k + · obtain ⟨l, hl, rfl⟩ := h + rw [noLab_iff_cnt.mp (hX l hl)] + exact hA _ + · have : NoLab A k := fun l hl he => h ⟨l, hl, he⟩ + rw [noLab_iff_cnt.mp this, zero_add] + exact hB k + +theorem BC.good {H : List Letter} {a b c : ℕ} (h : BC H a b c) : Good H := by + induction h with + | nil => exact fun k => by simp [cnt_nil] + | @hnd H a b c u v huv hX _ ih => + refine good_append (fun k => ?_) ih hX + simp only [hndB, linv, cnt_cons, cnt_nil] + split_ifs <;> omega + | @cap H a b c y hX _ ih => + refine good_append (fun k => ?_) ih hX + simp only [cnt_cons, cnt_nil] + split_ifs <;> omega + | @hole H a b c t r htr hX _ ih => + refine good_append (fun k => ?_) ih hX + simp only [holB, linv, cnt_cons, cnt_nil] + split_ifs <;> omega + +theorem good_rW {a b c : ℕ} {L : List ℕ} (hL : L.Nodup) (hc : ∀ m ∈ L, m < c) : Good (rW a b c L) + := by + rw [rW_eq] + refine good_append (bc_hH a b hL).good (fun k => ?_) (DisjL.symm ?_) + · simp only [eW, cnt_cons, cnt_nil] + split_ifs <;> omega + · intro l hl + simp only [eW, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl <;> + · exact noLab_hH (by simp only; omega) fun m hm => by + have := hc m hm + simp only + omega + +theorem wv_shW {A : Type} [AddGroup A] (V : ℕ → A) (M : ℕ) (w : List Letter) : wv V (shW M w) = wv + (fun k => V (k + M)) w := by + induction w with + | nil => rfl + | cons l w ih => + have e : shW M (l :: w) = (l.1 + M, l.2) :: shW M w := rfl + rw [e, wv_cons, wv_cons, ih] + rfl + +theorem cnt_shW (M : ℕ) (w : List Letter) (k : ℕ) : cnt (shW M w) (k + M) = cnt w k := by + induction w with + | nil => rfl + | cons l w ih => + have e : shW M (l :: w) = (l.1 + M, l.2) :: shW M w := rfl + rw [e, cnt_cons, cnt_cons, ih] + simp only [add_left_inj] + +theorem hlW_mem {k : ℕ} {L : List ℕ} {l : Letter} (h : l ∈ hlW k L) : ∃ m ∈ L, l.1 = k + 2 * m + ∨ l.1 = k + 2 * m + 1 := by + obtain ⟨m, hm, h1⟩ := List.mem_flatMap.mp h + simp only [holB, linv, List.mem_cons, List.not_mem_nil, or_false] at h1 + refine ⟨m, hm, ?_⟩ + rcases h1 with rfl | rfl | rfl <;> simp + +end counts + +section close + +/-- The word of the rest of a surface can have any 3-cycle as its value, unless the surface is a +disc. -/ +theorem exists_close {a b c : ℕ} {L : List ℕ} {v : S3} (hv : T3 v) (hL : L.Nodup) (h : 0 < a + ∨ 0 < b ∨ L ≠ []) : + ∃ V : ℕ → S3, wv V (rW a b c L) = v := by + have hrest : ∀ {K : ℕ} {V : ℕ → S3}, (∀ k ≥ K, V k = 0) → K ≤ 2 * a + b → ∀ l ∈ hlW + (2 * a + b) L ++ eW a b c, V l.1 = 0 := by + intro K V hV hK l hl + rcases List.mem_append.mp hl with hl | hl + · obtain ⟨m, -, h1⟩ := hlW_mem hl + exact hV _ (by omega) + · simp only [eW, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl <;> exact hV _ (by simp only; omega) + have hE : ∀ {K : ℕ} {V : ℕ → S3}, (∀ k ≥ K, V k = 0) → K ≤ 2 * a + b → wv V (hlW + (2 * a + b) L ++ eW a b c) = 0 := + fun hV hK => wv_zero (hrest hV hK) + rcases Nat.eq_zero_or_pos a with rfl | ha + · rcases Nat.eq_zero_or_pos b with rfl | hb + · obtain ⟨m, L', rfl⟩ : ∃ m L', L = m :: L' := by + rcases L with _ | ⟨m, L'⟩ + · simp at h + · exact ⟨m, L', rfl⟩ + refine ⟨Function.update 0 (2 * m + 1) v, ?_⟩ + have hm : m ∉ L' := (List.nodup_cons.mp hL).1 + have e1 : rW 0 0 c (m :: L') = holB (2 * m, true) (2 * m + 1, true) ++ (hlW 0 L' ++ eW 0 0 c) + := by + simp [rW, hW, cW, hlW] + rw [e1, wv_append] + have e2 : wv (Function.update 0 (2 * m + 1) v : ℕ → S3) (hlW 0 L' ++ eW 0 0 c) = 0 := by + refine wv_zero fun l hl => Function.update_of_ne ?_ _ _ + rcases List.mem_append.mp hl with hl | hl + · obtain ⟨m', hm', h1⟩ := hlW_mem hl + have : m' ≠ m := fun he => hm (he ▸ hm') + omega + · simp only [eW, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl <;> simp only <;> omega + rw [e2] + simp only [holB, linv, wv_cons, wv_nil, lVal, add_zero, Function.update_self] + simp + · obtain ⟨b', rfl⟩ : ∃ b', b = b' + 1 := ⟨b - 1, by omega⟩ + obtain ⟨x, hx⟩ := hv.square + refine ⟨Function.update 0 0 x, ?_⟩ + have e1 : rW 0 (b' + 1) c L = [(0, true), (0, true)] ++ (cW 1 b' ++ (hlW (2 * 0 + + (b' + 1)) L ++ eW 0 (b' + 1) c)) := by + simp [rW, hW, cW] + have hV : ∀ k ≥ 1, (Function.update 0 0 x : ℕ → S3) k = 0 := fun k hk => by + rw [Function.update_of_ne (by omega)] + rfl + have e2 : wv (Function.update 0 0 x : ℕ → S3) (cW 1 b') = 0 := + wv_zero fun l hl => hV _ (cW_labels 1 b' l hl).1 + rw [e1, wv_append, wv_append, e2, hE hV (by omega)] + simp [lVal, hx] + · obtain ⟨a', rfl⟩ : ∃ a', a = a' + 1 := ⟨a - 1, by omega⟩ + obtain ⟨x, y, hxy⟩ := hv.comm + refine ⟨Function.update (Function.update 0 0 x) 1 y, ?_⟩ + have e1 : rW (a' + 1) b c L = hndB (0, true) (1, true) ++ (hW 2 a' ++ cW (2 * (a' + 1)) b ++ + (hlW (2 * (a' + 1) + b) L ++ eW (a' + 1) b c)) := by + simp [rW, hW] + have hV : ∀ k ≥ 2, (Function.update (Function.update 0 0 x) 1 y : ℕ → S3) k = 0 := fun k hk + => by + rw [Function.update_of_ne (by omega), Function.update_of_ne (by omega)] + rfl + have e2 : wv (Function.update (Function.update 0 0 x) 1 y : ℕ → S3) (hW 2 a' ++ cW (2 * + (a' + 1)) b) = 0 := + wv_zero fun l hl => by + rcases List.mem_append.mp hl with hl | hl + · exact hV _ (hW_labels 2 a' l hl).1 + · exact hV _ (by have := (cW_labels _ _ l hl).1; omega) + rw [e1, wv_append, wv_append, e2, hE hV (by omega)] + simp only [hndB, linv, wv_cons, wv_nil, lVal, Bool.not_true, Bool.false_eq_true, ite_false, + ite_true, add_zero] + rw [Function.update_self, Function.update_of_ne (show (0 : ℕ) ≠ 1 by omega), + Function.update_self] + rw [← hxy] + simp only [add_assoc] + +end close + +section sides + +variable {Y : Type u} [TopologicalSpace Y] + +/-- `F` is an `O`-arc that is null-homotopic in the whole space. -/ +def NullIn (F : Set Y) : Prop := + ∃ (φ₀ : Circle ≃ₜ F) (H : C(Circle × unitInterval, Y)) (c₀ : Y), (∀ x, H (x, 0) = (φ₀ x).1) + ∧ ∀ x, H (x, 1) = c₀ + +/-- A side that goes around a null-homotopic `O`-arc has value zero. -/ +theorem side_null {A : Type} [AddGroup A] [Finite A] [T2Space Y] {W : ℕ → List Letter} {f : ℕ × ℂ + → Y} {V : ℕ → A} (hW : FinW W) (hP : IsPaired W) + (hf : Presents W f) (h0 : W 0 ≠ []) (hV : ∀ i, wv V (W i) = 0) {F : Set Y} + (hN : NullIn F) {p k : ℕ} (hp : (W 0)[p]? = some (k, true)) + {ρ : ℝ → Y} (cρ : ContinuousOn ρ (Icc 0 1)) (hc : ρ 1 = ρ 0) (hρ : ∀ u ∈ Icc (0 : ℝ) 1, ρ u ∈ F) + (hs : ∀ u ∈ Icc (0 : ℝ) 1, f (0, per (W 0).length (p + u)) = ρ u) : V k = 0 := by + obtain ⟨φ₀, H, c₀, h1, h2⟩ := hN + obtain ⟨m, cm, hm⟩ := exists_lift φ₀ cρ hρ + have m0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have m1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + exact volt_zero hW hP hf h0 hV H (c := fun x => (φ₀ x).1) h1 h2 hp cm + (φ₀.injective (Subtype.ext ((hm 1 m1).trans (hc.trans (hm 0 m0).symm)))) + fun u hu => (hs u hu).trans (hm u hu).symm + +omit [TopologicalSpace Y] in +/-- A side of a single word, at its position. -/ +theorem side_sW {w : List Letter} {f : ℕ × ℂ → Y} {k : ℕ} {ρ : ℝ → Y} (h : SideVal (sW w) f k ρ) : + ∃ p : ℕ, w[p]? = some (k, true) ∧ ∀ u ∈ Icc (0 : ℝ) 1, f (0, per w.length (p + u)) = ρ u := by + obtain ⟨i, p, h1, h2⟩ := h + obtain ⟨rfl, h3⟩ := sW_get h1 + rw [sW_zero] at h2 + refine ⟨p, h3, fun u hu => ?_⟩ + have := h2 u hu + simpa [sdPt] using this + +variable [T2Space Y] {a b c i j : ℕ} {L : List ℕ} {f : ℕ × ℂ → Y} {F : Set Y} {ρ : ℝ → Y} + +/-- Two lifts on two holes of one word: the `O`-arc does not separate. -/ +theorem not_null_E (hij : i ≠ j) (hi : i < c) (hj : j < c) (hL : L.Nodup) (hc : ∀ m ∈ L, m < c + ∧ m ≠ i ∧ m ≠ j) {σ : Bool} + (hf : Presents (sW (blkE a b i j σ ++ rW a b c L)) f) (hs : SideVal (sW + (blkE a b i j σ ++ rW a b c L)) f (rL a b i).1 ρ) + (hN : NullIn F) (cρ : ContinuousOn ρ (Icc 0 1)) (hcl : ρ 1 = ρ 0) (hρ : ∀ u ∈ Icc + (0 : ℝ) 1, ρ u ∈ F) : False := by + obtain ⟨x, hx0, hx⟩ := order_two_exists + set r := 2 * a + b + 2 * i + 1 with hr + have hzero : ∀ k, 2 * a + b ≤ k → k ≠ 2 * a + b + 2 * c → (∀ m ∈ L, k ≠ 2 * a + b + 2 * m + ∧ k ≠ 2 * a + b + 2 * m + 1) → + cnt (rW a b c L) k = 0 := fun k h1 h2 h3 => cnt_rW_zero h1 h2 h3 + have hgood : Good (blkE a b i j σ ++ rW a b c L) := by + refine good_append (fun k => ?_) (good_rW hL fun m hm => (hc m hm).1) fun l hl + => noLab_iff_cnt.mpr ?_ + · cases σ <;> simp only [blkE, tL, rL, linv, cnt_cons, cnt_nil] <;> split_ifs <;> omega + · cases σ <;> simp only [blkE, tL, rL, linv, List.mem_cons, List.not_mem_nil, or_false] at hl + <;> + · rcases hl with rfl | rfl | rfl | rfl | rfl | rfl <;> + · refine hzero _ (by simp only; omega) (by simp only; omega) fun m hm => ?_ + have := hc m hm + simp only + omega + have hne : (blkE a b i j σ ++ rW a b c L) ≠ [] := by simp [blkE] + have hV0 : ∀ l ∈ rW a b c L, (Function.update 0 r x : ℕ → S3) l.1 = 0 := fun l hl => + Function.update_of_ne (fun he => (noLab_iff_cnt.mpr (hzero r (by omega) (by omega) fun m hm + => by + have := hc m hm + omega)) l hl he) _ _ + have ht : (Function.update 0 r x : ℕ → S3) (2 * a + b + 2 * i) = 0 := Function.update_of_ne + (by omega) _ _ + have ht' : (Function.update 0 r x : ℕ → S3) (2 * a + b + 2 * j) = 0 := Function.update_of_ne + (by omega) _ _ + have hr1 : (Function.update 0 r x : ℕ → S3) r = x := Function.update_self _ _ _ + have hV : ∀ d, wv (Function.update 0 r x : ℕ → S3) (sW (blkE a b i j σ ++ rW a b c L) d) = 0 := by + intro d + by_cases hd : d = 0 + · subst hd + rw [sW_zero, wv_append, wv_zero hV0, add_zero] + cases σ <;> simp [blkE, tL, rL, linv, lVal, ht, ht', ← hr, hx] + · have : sW (blkE a b i j σ ++ rW a b c L) d = [] := by simp [sW, hd, nW] + rw [this] + rfl + obtain ⟨p, hp, h1⟩ := side_sW hs + have := side_null (finW_sW _) (isPaired_sW hgood) hf (by rw [sW_zero]; exact hne) hV hN (p := p) + (by rw [sW_zero]; exact hp) cρ hcl hρ + (fun u hu => by rw [sW_zero]; exact h1 u hu) + rw [show (rL a b i).1 = r from rfl, hr1] at this + exact hx0 this + +/-- One lift that runs twice around a hole: the `O`-arc does not separate. -/ +theorem not_null_D (hi : i < c) (hL : L.Nodup) (hc : ∀ m ∈ L, m < c ∧ m ≠ i) + (hf : Presents (sW (blkD a b i ++ rW a b c L)) f) (hs : SideVal (sW + (blkD a b i ++ rW a b c L)) f (rL a b i).1 ρ) + (hN : NullIn F) (cρ : ContinuousOn ρ (Icc 0 1)) (hcl : ρ 1 = ρ 0) (hρ : ∀ u ∈ Icc + (0 : ℝ) 1, ρ u ∈ F) : False := by + obtain ⟨x, hx0, hx⟩ := order_two_exists + set r := 2 * a + b + 2 * i + 1 with hr + have hzero : ∀ k, 2 * a + b ≤ k → k ≠ 2 * a + b + 2 * c → (∀ m ∈ L, k ≠ 2 * a + b + 2 * m + ∧ k ≠ 2 * a + b + 2 * m + 1) → + cnt (rW a b c L) k = 0 := fun k h1 h2 h3 => cnt_rW_zero h1 h2 h3 + have hgood : Good (blkD a b i ++ rW a b c L) := by + refine good_append (fun k => ?_) (good_rW hL fun m hm => (hc m hm).1) fun l hl + => noLab_iff_cnt.mpr ?_ + · simp only [blkD, tL, rL, linv, cnt_cons, cnt_nil] + split_ifs <;> omega + · simp only [blkD, tL, rL, linv, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl | rfl <;> + · refine hzero _ (by simp only; omega) (by simp only; omega) fun m hm => ?_ + have := hc m hm + simp only + omega + have hne : (blkD a b i ++ rW a b c L) ≠ [] := by simp [blkD] + have hV0 : ∀ l ∈ rW a b c L, (Function.update 0 r x : ℕ → S3) l.1 = 0 := fun l hl => + Function.update_of_ne (fun he => (noLab_iff_cnt.mpr (hzero r (by omega) (by omega) fun m hm + => by + have := hc m hm + omega)) l hl he) _ _ + have ht : (Function.update 0 r x : ℕ → S3) (2 * a + b + 2 * i) = 0 := Function.update_of_ne + (by omega) _ _ + have hr1 : (Function.update 0 r x : ℕ → S3) r = x := Function.update_self _ _ _ + have hV : ∀ d, wv (Function.update 0 r x : ℕ → S3) (sW (blkD a b i ++ rW a b c L) d) = 0 := by + intro d + by_cases hd : d = 0 + · subst hd + rw [sW_zero, wv_append, wv_zero hV0, add_zero] + simp [blkD, tL, rL, linv, lVal, ht, ← hr, hx] + · have : sW (blkD a b i ++ rW a b c L) d = [] := by simp [sW, hd, nW] + rw [this] + rfl + obtain ⟨p, hp, h1⟩ := side_sW hs + have := side_null (finW_sW _) (isPaired_sW hgood) hf (by rw [sW_zero]; exact hne) hV hN (p := p) + (by rw [sW_zero]; exact hp) cρ hcl hρ + (fun u hu => by rw [sW_zero]; exact h1 u hu) + rw [show (rL a b i).1 = r from rfl, hr1] at this + exact hx0 this + +/-- A cuff of a surface that is not a disc is not null-homotopic. -/ +theorem not_null_C (hi : i < c) (hL : L.Nodup) (hc : ∀ m ∈ L, m < c ∧ m ≠ i) (hne' : 0 < a ∨ 0 < b + ∨ L ≠ []) + (hf : Presents (sW (hB a b i ++ rW a b c L)) f) (hs : SideVal (sW (hB a b i ++ rW a b c L)) f + (rL a b i).1 ρ) + (hN : NullIn F) (cρ : ContinuousOn ρ (Icc 0 1)) (hcl : ρ 1 = ρ 0) (hρ : ∀ u ∈ Icc + (0 : ℝ) 1, ρ u ∈ F) : False := by + obtain ⟨v, hv⟩ := t3_exists + obtain ⟨V₁, hV₁⟩ := exists_close (a := a) (b := b) (c := c) hv.neg hL hne' + set r := 2 * a + b + 2 * i + 1 with hr + set t := 2 * a + b + 2 * i with ht + have hzero : ∀ k, 2 * a + b ≤ k → k ≠ 2 * a + b + 2 * c → (∀ m ∈ L, k ≠ 2 * a + b + 2 * m + ∧ k ≠ 2 * a + b + 2 * m + 1) → + cnt (rW a b c L) k = 0 := fun k h1 h2 h3 => cnt_rW_zero h1 h2 h3 + have hgood : Good (hB a b i ++ rW a b c L) := by + refine good_append (fun k => ?_) (good_rW hL fun m hm => (hc m hm).1) fun l hl + => noLab_iff_cnt.mpr ?_ + · simp only [hB, holB, tL, rL, linv, cnt_cons, cnt_nil] + split_ifs <;> omega + · simp only [hB, holB, tL, rL, linv, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl <;> + · refine hzero _ (by simp only; omega) (by simp only; omega) fun m hm => ?_ + have := hc m hm + simp only + omega + have hne : (hB a b i ++ rW a b c L) ≠ [] := by simp [hB, holB] + set V : ℕ → S3 := Function.update (Function.update V₁ r v) t 0 with hVdef + have hVr : V r = v := by + rw [hVdef, Function.update_of_ne (by omega), Function.update_self] + have hVt : V t = 0 := Function.update_self _ _ _ + have hrr : NoLab (rW a b c L) r := noLab_iff_cnt.mpr (hzero r (by omega) (by omega) fun m hm => by + have := hc m hm + omega) + have hrt : NoLab (rW a b c L) t := noLab_iff_cnt.mpr (hzero t (by omega) (by omega) fun m hm => by + have := hc m hm + omega) + have e1 : wv V (rW a b c L) = -v := by + rw [← hV₁] + exact wv_congr fun l hl => by + rw [hVdef, Function.update_of_ne (hrt l hl), Function.update_of_ne (hrr l hl)] + have hV : ∀ d, wv V (sW (hB a b i ++ rW a b c L) d) = 0 := by + intro d + by_cases hd : d = 0 + · subst hd + rw [sW_zero, wv_append, e1] + simp [hB, holB, tL, rL, linv, lVal, ← hr, ← ht, hVr, hVt] + · have : sW (hB a b i ++ rW a b c L) d = [] := by simp [sW, hd, nW] + rw [this] + rfl + obtain ⟨p, hp, h1⟩ := side_sW hs + have := side_null (finW_sW _) (isPaired_sW hgood) hf (by rw [sW_zero]; exact hne) hV hN (p := p) + (by rw [sW_zero]; exact hp) cρ hcl hρ + (fun u hu => by rw [sW_zero]; exact h1 u hu) + rw [show (rL a b i).1 = r from rfl, hVr] at this + exact hv.1 this + +/-- A separating `O`-arc with neither side a disc is not null-homotopic. -/ +theorem not_null_B {a₁ b₁ c₁ a₂ b₂ c₂ i j : ℕ} {L₁ L₂ : List ℕ} {σ : Bool} (hi : i < c₁) + (hj : j < c₂) (hN₁ : L₁.Nodup) (hN₂ : L₂.Nodup) + (hL₁ : ∀ m ∈ L₁, m < c₁ ∧ m ≠ i) (hL₂ : ∀ m ∈ L₂, m < c₂ ∧ m ≠ j) (h₁ : 0 < a₁ ∨ 0 < b₁ + ∨ L₁ ≠ []) (h₂ : 0 < a₂ ∨ 0 < b₂ ∨ L₂ ≠ []) + (hf : Presents (dW (wLoop₁ a₁ b₁ c₁ i L₁) (wLoop₂ a₂ b₂ c₂ j L₂ (frL a₁ b₁ c₁ + 1) + ((rL a₁ b₁ i).1, σ))) f) {q : ℕ} + (hq : (wLoop₁ a₁ b₁ c₁ i L₁)[q]? = some ((rL a₁ b₁ i).1, true)) + (hs : ∀ u ∈ Icc (0 : ℝ) 1, f (0, per (wLoop₁ a₁ b₁ c₁ i L₁).length (q + u)) = ρ u) + (hN : NullIn F) (cρ : ContinuousOn ρ (Icc 0 1)) (hcl : ρ 1 = ρ 0) (hρ : ∀ u ∈ Icc + (0 : ℝ) 1, ρ u ∈ F) : False := by + obtain ⟨v, hv⟩ := t3_exists + have hv₂ : T3 (-(if σ then v else -v)) := by + cases σ + · simpa using hv.neg.neg + · simpa using hv.neg + obtain ⟨V₁, hV₁⟩ := exists_close (a := a₁) (b := b₁) (c := c₁) hv.neg hN₁ h₁ + obtain ⟨V₂, hV₂⟩ := exists_close (a := a₂) (b := b₂) (c := c₂) hv₂ hN₂ h₂ + obtain ⟨M, hM⟩ : ∃ M, M = 2 * a₁ + b₁ + 2 * c₁ + 2 := ⟨_, rfl⟩ + have hMe : frL a₁ b₁ c₁ + 1 = M := by + rw [hM] + rfl + rw [hMe] at hf + obtain ⟨r, hr⟩ : ∃ r, r = 2 * a₁ + b₁ + 2 * i + 1 := ⟨_, rfl⟩ + obtain ⟨t, ht⟩ : ∃ t, t = 2 * a₁ + b₁ + 2 * i := ⟨_, rfl⟩ + obtain ⟨t₂, ht₂⟩ : ∃ t₂, t₂ = 2 * a₂ + b₂ + 2 * j := ⟨_, rfl⟩ + have er : (rL a₁ b₁ i).1 = r := hr.symm + rw [er] at hf hq + have e₁ : wLoop₁ a₁ b₁ c₁ i L₁ = (t, true) :: (r, true) :: (t, false) :: rW a₁ b₁ c₁ L₁ := by + subst hr ht + simp [wLoop₁, hB, holB, tL, rL, linv] + have e₂ : wLoop₂ a₂ b₂ c₂ j L₂ M (r, σ) = (t₂ + M, true) :: (r, σ) :: (t₂ + M, false) :: shW M + (rW a₂ b₂ c₂ L₂) := by + subst ht₂ + simp [wLoop₂, tL] + rw [e₁, e₂] at hf + rw [e₁] at hq hs + have l₁ := rW_labels_lt (a := a₁) (b := b₁) (c := c₁) (L := L₁) fun m hm => (hL₁ m hm).1 + have hfr : frL a₁ b₁ c₁ + 1 = M := hMe + have zr : NoLab (rW a₁ b₁ c₁ L₁) r := noLab_iff_cnt.mpr (cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL₁ m hm + omega) + have zt : NoLab (rW a₁ b₁ c₁ L₁) t := noLab_iff_cnt.mpr (cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL₁ m hm + omega) + have zt₂ : NoLab (rW a₂ b₂ c₂ L₂) t₂ := noLab_iff_cnt.mpr (cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL₂ m hm + omega) + have hrM : r < M := by omega + have htM : t < M := by omega + let V : ℕ → S3 := fun k => if k < M then Function.update (Function.update V₁ r v) t 0 k else if k + = t₂ + M then 0 else V₂ (k - M) + have hVr : V r = v := by + simp only [V, ite_eq_left hrM] + rw [Function.update_of_ne (by omega), Function.update_self] + have hVt : V t = 0 := by + simp only [V, ite_eq_left htM] + exact Function.update_self _ _ _ + have hVt₂ : V (t₂ + M) = 0 := by + have : ¬ t₂ + M < M := by omega + simp only [V, ite_eq_right this, ite_true] + have e3 : wv V (rW a₁ b₁ c₁ L₁) = -v := by + rw [← hV₁] + refine wv_congr fun l hl => ?_ + have h3 : l.1 < M := by + have := l₁ l hl + omega + simp only [V, ite_eq_left h3] + rw [Function.update_of_ne (zt l hl), Function.update_of_ne (zr l hl)] + have e4 : wv V (shW M (rW a₂ b₂ c₂ L₂)) = -(if σ then v else -v) := by + rw [wv_shW, ← hV₂] + refine wv_congr fun l hl => ?_ + have h3 : ¬ l.1 + M < M := by omega + have h4 : l.1 + M ≠ t₂ + M := fun he => zt₂ l hl (by omega) + simp only [V, ite_eq_right h3, ite_eq_right h4, Nat.add_sub_cancel] + have hV : ∀ d, wv V (dW ((t, true) :: (r, true) :: (t, false) :: rW a₁ b₁ c₁ L₁) + ((t₂ + M, true) :: (r, σ) :: (t₂ + M, false) :: shW M (rW a₂ b₂ c₂ L₂)) d) = 0 := by + intro d + rcases dW_cases ((t, true) :: (r, true) :: (t, false) :: rW a₁ b₁ c₁ L₁) + ((t₂ + M, true) :: (r, σ) :: (t₂ + M, false) :: shW M (rW a₂ b₂ c₂ L₂)) d with ⟨-, h3⟩ | ⟨-, + h3⟩ | h3 + · rw [h3] + simp [lVal, hVr, hVt, e3] + · rw [h3] + cases σ <;> simp [lVal, hVr, hVt₂, e4] + · rw [h3] + rfl + have hg₁ := good_rW (a := a₁) (b := b₁) hN₁ fun m hm => (hL₁ m hm).1 + have hg₂ := good_rW (a := a₂) (b := b₂) hN₂ fun m hm => (hL₂ m hm).1 + have hP : ∀ k, cnt ((t, true) :: (r, true) :: (t, false) :: rW a₁ b₁ c₁ L₁) k + + cnt ((t₂ + M, true) :: (r, σ) :: (t₂ + M, false) :: shW M (rW a₂ b₂ c₂ L₂)) k ≤ 2 := by + intro k + by_cases hk : k < M + · have s0 : cnt (shW M (rW a₂ b₂ c₂ L₂)) k = 0 := noLab_iff_cnt.mp (noLab_shW_of fun k' he + => by omega) + have g := hg₁ k + have c1 : k = r → cnt (rW a₁ b₁ c₁ L₁) k = 0 := fun h => h ▸ noLab_iff_cnt.mp zr + have c2 : k = t → cnt (rW a₁ b₁ c₁ L₁) k = 0 := fun h => h ▸ noLab_iff_cnt.mp zt + simp only [cnt_cons, s0] + split_ifs <;> omega + · obtain ⟨k', rfl⟩ : ∃ k', k = k' + M := ⟨k - M, by omega⟩ + have s0 : cnt (rW a₁ b₁ c₁ L₁) (k' + M) = 0 := noLab_iff_cnt.mp fun l hl he => by + have := l₁ l hl + omega + have g := hg₂ k' + have c1 : k' = t₂ → cnt (rW a₂ b₂ c₂ L₂) k' = 0 := fun h => h ▸ noLab_iff_cnt.mp zt₂ + simp only [cnt_cons, s0, cnt_shW] + split_ifs <;> omega + have := side_null (finW_dW _ _) (isPaired_dW hP) hf (by rw [dW_zero]; simp) hV hN (p := q) + (by rw [dW_zero]; exact hq) cρ hcl hρ + (fun u hu => by rw [dW_zero]; exact hs u hu) + rw [hVr] at this + exact hv.1 this + +end sides + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutOArc.lean b/LeanPool/GraphMinor/Surface/CutOArc.lean new file mode 100644 index 0000000000..7276db1890 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutOArc.lean @@ -0,0 +1,375 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutCyl + +/-! +# Cutting along an `O`-arc + +We prove `CutOArcStatement` (`cutOArc`). As for `I`-arcs, the cut surface comes from +`exists_cut_loop`, each component has a +word from `classification`, and the word of the surface before cutting has a normal form that shows +which surface it is. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function + +universe u uu + +section + +variable {Y S : Type uu} [TopologicalSpace Y] [T2Space Y] [TopologicalSpace S] {ψ : Y + → S} {F : Set S} + {a₁ b₁ c₁ a₂ b₂ c₂ : ℕ} + +omit [TopologicalSpace Y] [T2Space Y] [TopologicalSpace S] in +/-- Two paths that continue each other around a loop form a one to one loop. -/ +theorem conc_inj {ξ η : ℝ → Y} {a : ℝ → S} (hξ : ∀ t ∈ Icc (0 : ℝ) 1, ψ (ξ t) = a t) + (hη : ∀ t ∈ Icc (0 : ℝ) 1, ψ (η t) = a t) + (c7 : InjOn a (Ico 0 1)) (c8 : ∀ t ∈ Icc (0 : ℝ) 1, ξ t ≠ η t) (e1 : ξ 1 = η 0) (e2 : η 1 + = ξ 0) : InjOn (conc2 ξ η) (Ico 0 1) := by + have m0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have m1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have h10 : a 1 = a 0 := by rw [← hξ 1 m1, e1, hη 0 m0] + have one : ∀ v ∈ Icc (0 : ℝ) 1, a v = a 0 → v = 0 ∨ v = 1 := by + intro v hv he + rcases eq_or_lt_of_le hv.2 with rfl | h + · exact .inr rfl + · exact .inl (c7 ⟨hv.1, h⟩ ⟨le_rfl, zero_lt_one⟩ he) + have injξ : InjOn ξ (Icc 0 1) := by + intro x hx y hy he + have ha : a x = a y := by rw [← hξ x hx, ← hξ y hy, he] + rcases eq_or_lt_of_le hx.2 with rfl | h + · rcases eq_or_lt_of_le hy.2 with rfl | h' + · rfl + · rw [h10] at ha + rcases one y hy ha.symm with rfl | h4 + · exact absurd (he.symm.trans e1) (c8 0 m0) + · exact h4.symm + · rcases eq_or_lt_of_le hy.2 with rfl | h' + · rw [h10] at ha + rcases one x hx ha with rfl | h4 + · exact absurd (he.trans e1) (c8 0 m0) + · exact h4 + · exact c7 ⟨hx.1, h⟩ ⟨hy.1, h'⟩ ha + have injη : InjOn η (Icc 0 1) := by + intro x hx y hy he + have ha : a x = a y := by rw [← hη x hx, ← hη y hy, he] + rcases eq_or_lt_of_le hx.2 with rfl | h + · rcases eq_or_lt_of_le hy.2 with rfl | h' + · rfl + · rw [h10] at ha + rcases one y hy ha.symm with rfl | h4 + · exact absurd (e2.symm.trans (he)) (c8 0 m0) + · exact h4.symm + · rcases eq_or_lt_of_le hy.2 with rfl | h' + · rw [h10] at ha + rcases one x hx ha with rfl | h4 + · exact absurd (e2.symm.trans he.symm) (c8 0 m0) + · exact h4 + · exact c7 ⟨hx.1, h⟩ ⟨hy.1, h'⟩ ha + have cross : ∀ v ∈ Icc (0 : ℝ) 1, ∀ w ∈ Ioo (0 : ℝ) 1, ξ v ≠ η w := by + intro v hv w hw he + have ha : a v = a w := by rw [← hξ v hv, he, hη w (Ioo_subset_Icc_self hw)] + rcases eq_or_lt_of_le hv.2 with rfl | h + · rw [h10] at ha + exact hw.1.ne (c7 ⟨le_rfl, zero_lt_one⟩ (Ioo_subset_Ico_self hw) ha) + · have := c7 ⟨hv.1, h⟩ (Ioo_subset_Ico_self hw) ha + subst this + exact c8 v hv he + intro x hx y hy he + unfold conc2 at he + have mem1 : ∀ {z : ℝ}, z ∈ Ico (0 : ℝ) 1 → z ≤ 1 / 2 → 2 * z ∈ Icc (0 : ℝ) 1 := fun hz h + => ⟨by linarith [hz.1], by linarith⟩ + have mem2 : ∀ {z : ℝ}, z ∈ Ico (0 : ℝ) 1 → ¬ z ≤ 1 / 2 → 2 * z - 1 ∈ Ioo (0 : ℝ) 1 := fun hz h + => by + have := not_le.mp h + exact ⟨by linarith, by linarith [hz.2]⟩ + by_cases hx2 : x ≤ 1 / 2 <;> by_cases hy2 : y ≤ 1 / 2 + · rw [ite_eq_left hx2, ite_eq_left hy2] at he + have := injξ (mem1 hx hx2) (mem1 hy hy2) he + linarith + · rw [ite_eq_left hx2, ite_eq_right hy2] at he + exact absurd he (cross _ (mem1 hx hx2) _ (mem2 hy hy2)) + · rw [ite_eq_right hx2, ite_eq_left hy2] at he + exact absurd he.symm (cross _ (mem1 hy hy2) _ (mem2 hx hx2)) + · rw [ite_eq_right hx2, ite_eq_right hy2] at he + have := injη (Ioo_subset_Icc_self (mem2 hx hx2)) (Ioo_subset_Icc_self (mem2 hy hy2)) he + linarith + +/-- Counts labels in an explicit word whose tail has known counts. -/ +local macro "ct" : tactic => + `(tactic| ((try simp only [hB, holB, List.cons_append, List.nil_append, List.append_assoc, + cnt_append, cnt_cons, cnt_nil, tL, rL, frL, linv, Prod.fst, *]); (try split_ifs) <;> omega)) + +/-- Each component has a whole cuff as a lift. -/ +theorem loop_comps_aux [T2Space S] (hS : IsSurface Y) (hψ : IsCutting ψ F) {X X' : Set Y} + (hun : X ∪ X' = ψ ⁻¹' F) (b1 : BijOn ψ X F) + (b2 : BijOn ψ X' F) (hOX : IsOArc X) (hOX' : IsOArc X') {W₁ W₂ : Set Y} (hW₁ : IsClopen W₁) + (hW₂ : IsClopen W₂) (hd : Disjoint W₁ W₂) + (hU : W₁ ∪ W₂ = univ) (e₁ : W₁ ≃ₜ SurfaceModel a₁ b₁ c₁) (e₂ : W₂ ≃ₜ SurfaceModel a₂ b₂ c₂) + (s₁ : X ⊆ W₁) (s₂ : X' ⊆ W₂) + (t₁ : X ⊆ bd Y) (t₂ : X' ⊆ bd Y) : + ∃ (i j : ℕ) (σ : Bool) (f : ℕ × ℂ → S) (ρ : ℝ → Y) (q : ℕ), i < c₁ ∧ j < c₂ ∧ + Presents (dW (wLoop₁ a₁ b₁ c₁ i ((List.range' 0 c₁).erase i)) + (wLoop₂ a₂ b₂ c₂ j ((List.range' 0 c₂).erase j) (frL a₁ b₁ c₁ + 1) ((rL a₁ b₁ i).1, σ))) f ∧ + (wLoop₁ a₁ b₁ c₁ i ((List.range' 0 c₁).erase i))[q]? = some ((rL a₁ b₁ i).1, true) ∧ + (∀ u ∈ Icc (0 : ℝ) 1, f (0, per (wLoop₁ a₁ b₁ c₁ i ((List.range' 0 c₁).erase i)).length + (q + u)) = ψ (ρ u)) ∧ + ContinuousOn ρ (Icc 0 1) ∧ ρ 1 = ρ 0 ∧ ∀ u ∈ Icc (0 : ℝ) 1, ρ u ∈ X := by + have hS₁ := isSurface_sub hS hW₁ + have hS₂ := isSurface_sub hS hW₂ + have m0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have m1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have ne₁ : X.Nonempty := by + obtain ⟨e⟩ := id hOX + exact ⟨_, (e 1).2⟩ + have ne₂ : X'.Nonempty := by + obtain ⟨e⟩ := id hOX' + exact ⟨_, (e 1).2⟩ + obtain ⟨C₁, hC₁, hsC₁⟩ := exists_cuff_sub hW₁.2 hOX.isPreconnected ne₁ s₁ t₁ + obtain ⟨C₂, hC₂, hsC₂⟩ := exists_cuff_sub hW₂.2 hOX'.isPreconnected ne₂ s₂ t₂ + obtain ⟨i, hi, φ₁, g₁, hg₁, hs₁⟩ := exists_one_hole e₁ hC₁ + obtain ⟨j, hj, φ₂, g₂, hg₂, hs₂⟩ := exists_one_hole e₂ hC₂ + have eX := oarc_eq (hatC φ₁) hOX hsC₁ + have eX' := oarc_eq (hatC φ₂) hOX' hsC₂ + have : CompactSpace Y := hS.1 + have hcX' : IsCompact X' := hOX'.isCompact + have cξ : ContinuousOn (fun u => (hatC φ₁ (ee u)).1) (Icc 0 1) := + (continuous_subtype_val.comp ((hatC φ₁).continuous.comp continuous_ee)).continuousOn + have injξ : InjOn (fun u => (hatC φ₁ (ee u)).1) (Ico 0 1) := fun x hx y hy he => + ee_injOn hx hy ((hatC φ₁).injective (Subtype.ext he)) + have h01 : (hatC φ₁ (ee 0)).1 = (hatC φ₁ (ee 1)).1 := by rw [ee_one] + have himξ : (fun u => (hatC φ₁ (ee u)).1) '' Icc 0 1 = X := by + rw [eX] + exact loop_image (hatC φ₁) cξ (fun u _ => (hatC φ₁ _).2) injξ h01 + obtain ⟨η, L₀, himη, hiff⟩ := loop_lift hψ hun b1 b2 hcX' cξ himξ + have hη : ∀ u ∈ Icc (0 : ℝ) 1, η u ∈ (Subtype.val '' C₂ : Set Y) := fun u hu + => eX' ▸ himη ▸ mem_image_of_mem η hu + have cl : η 0 = η 1 := (hiff 0 m0 1 m1).mp h01 + have injη : InjOn η (Ico 0 1) := fun x hx y hy he => + injξ hx hy ((hiff x (Ico_subset_Icc_self hx) y (Ico_subset_Icc_self hy)).mpr he) + obtain ⟨σ, n', c', s', h3, h4⟩ := exists_loop_turn (hatC φ₂) L₀.cη hη injη cl + obtain ⟨hN₁, hL₁⟩ := erase_facts c₁ i + obtain ⟨hN₂, hL₂⟩ := erase_facts c₂ j + set L₁ := (List.range' 0 c₁).erase i + set L₂ := (List.range' 0 c₂).erase j + have c1 : cnt (rW a₁ b₁ c₁ L₁) (2 * a₁ + b₁ + 2 * i + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL₁ m hm + omega + have c1' : cnt (rW a₂ b₂ c₂ L₂) (2 * a₂ + b₂ + 2 * j + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL₂ m hm + omega + have hl₁ : ∀ l ∈ wLoop₁ a₁ b₁ c₁ i L₁, l.1 < frL a₁ b₁ c₁ + 1 := by + intro l hl + simp only [wLoop₁, hB, holB, List.cons_append, List.nil_append, List.mem_cons, tL, rL, linv] + at hl + rcases hl with rfl | rfl | rfl | hl + · simp only [frL]; omega + · simp only [frL]; omega + · simp only [frL]; omega + · have := rW_labels_lt (fun m hm => (hL₁ m hm).1) l hl + omega + obtain ⟨g₂', p1, p2, -⟩ := exists_pieces1 hS₂ hC₂ isOpen_univ (subset_univ _) φ₂ hg₂ hs₂ c' s' h3 + set M := frL a₁ b₁ c₁ + 1 + have p5 := presents_shW M p1 + have p6 := p2.shW M + have e1 : shW M (hB a₂ b₂ j ++ rW a₂ b₂ c₂ L₂) = + [((tL a₂ b₂ j).1 + M, true)] ++ ((rL a₂ b₂ j).1 + M, true) :: (((tL a₂ b₂ j).1 + M, false) :: + shW M (rW a₂ b₂ c₂ L₂)) := by + simp [shW, hB, holB, tL, rL, linv] + rw [e1] at p5 p6 + have c5 : cnt (shW M (rW a₂ b₂ c₂ L₂)) (2 * a₂ + b₂ + 2 * j + 1 + M) = 0 := + noLab_iff_cnt.mp (noLab_shW_of fun k' he => by + have : k' = 2 * a₂ + b₂ + 2 * j + 1 := by omega + subst this + exact noLab_iff_cnt.mpr c1') + have hcq : cnt ([((tL a₂ b₂ j).1 + M, true)] ++ ((rL a₂ b₂ j).1 + M, true) :: + (((tL a₂ b₂ j).1 + M, false) :: shW M (rW a₂ b₂ c₂ L₂))) ((rL a₂ b₂ j).1 + M) = 1 := by + simp only [List.cons_append, List.nil_append, cnt_cons, tL, rL, c5] + split_ifs <;> omega + obtain ⟨p7, -⟩ := two_gl L₀ hψ.1 hψ.2.1 hd hU (p₁ := 1) (u := wLoop₁ a₁ b₁ c₁ i L₁) (p := + (rL a₁ b₁ i).1) (σ := σ) rfl + (by simp only [wLoop₁]; ct) hcq (by + rw [← e1] + intro l hl + have := hl₁ l hl + exact noLab_shW_of fun k' he => by omega) hg₁ p5 hs₁ p6 (fun t _ => rfl) (fun t ht => by + have h5 := h4 _ (ofs_mem (e := σ) ht) + rw [ofs_ofs] at h5 + exact h5) + obtain ⟨d, q, hq1, hq2⟩ := hs₁ + obtain ⟨rfl, hq3⟩ := sW_get hq1 + rw [sW_zero] at hq2 + refine ⟨i, j, σ, _, _, q, hi, hj, p7, hq3, fun u hu => ?_, cξ, ?_, + fun u hu => himξ ▸ mem_image_of_mem _ hu⟩ + · have e6 : per (wLoop₁ a₁ b₁ c₁ i L₁).length (q + u) = sdPt (hB a₁ b₁ i ++ rW a₁ b₁ c₁ + L₁).length q true u := by + simp only [sdPt, ite_true, wLoop₁] + simp only [Function.comp, glW, ite_true] + rw [e6, hq2 u hu] + rfl + · exact h01.symm + +end + +/-- A single cuff over the cut arc determines the presentation obtained by gluing the two lifts +on that cuff. The presentation also records the arc traversal used in the homotopy argument. -/ +theorem connected_one_cuff_presentation + {Y S : Type uu} [TopologicalSpace Y] [TopologicalSpace S] [T2Space S] [ConnectedSpace S] + {ψ : Y → S} {F Z₁ Z₂ : Set S} {u c : S} {X₁ Y₁ X₂ Y₂ : Set Y} + (hY : IsSurface Y) (hψ : IsCutting ψ F) (hQ : IsOArc (ψ ⁻¹' F)) + (h7 : LiftPair ψ Z₁ u c X₁ Y₁) (h8 : LiftPair ψ Z₂ c u X₂ Y₂) + (hi : Z₁ ∩ Z₂ = {u, c}) (hun : Z₁ ∪ Z₂ = F) (huc : u ≠ c) + (hfu : (ψ ⁻¹' {u}).encard ≤ 2) (hfc : (ψ ⁻¹' {c}).encard ≤ 2) : + ConnectedSpace Y ∧ + ∃ (a b c' : ℕ) (_ : Y ≃ₜ SurfaceModel a b c') (i : ℕ) (g : ℕ × ℂ → Y) (ρ : ℝ → S), + i < c' ∧ + let word := sW (blkD a b i ++ rW a b c' ((List.range' 0 c').erase i)) + Presents word (ψ ∘ g) ∧ SideVal word (ψ ∘ g) (rL a b i).1 ρ ∧ + (∀ t ∈ Icc (0 : ℝ) 1, ρ t ∈ F) ∧ ρ 1 = ρ 0 ∧ ContinuousOn ρ (Icc 0 1) := by + have : T2Space Y := hY.2.1 + have : CompactSpace Y := hY.1 + have ne₀ : (ψ ⁻¹' F).Nonempty := by + obtain ⟨e⟩ := id hQ + exact ⟨_, (e 1).2⟩ + have hYc := connected_of_cut hψ hY hQ.isPreconnected rfl ne₀ + obtain ⟨a, b, c', ⟨e⟩⟩ := classification.{uu} Y hY hYc + obtain ⟨x, hx⟩ := ne₀ + have hdcuff := cuff_statement.{uu} Y hY + have hQb := hψ.2.2.2.2 + have hC : connectedComponentIn (bd Y) x ∈ cuffs Y := ⟨_, hQb hx, rfl⟩ + obtain ⟨φ₀⟩ := hdcuff.2.2 _ hC + have eQ := oarc_eq φ₀ hQ (hQ.isPreconnected.subset_connectedComponentIn hx hQb) + obtain ⟨i, hi', φ, g, hg, hs⟩ := exists_one_hole e hC + have hLf := (erase_facts c' i).2 + obtain ⟨a₀, ξ, η, c1, c2, c3, c4, c5, c6, c7, c8, c9⟩ := h7.paths h8 hi huc hfu hfc hψ.1 + rw [hun] at c5 c6 + have L : ArcLift ψ F a₀ ξ η := ⟨c1, c2, c3, c4, c5, fun y y' he hne' => by + by_cases hy : ψ y ∈ F + · exact c6 y y' he hne' hy + · exact absurd (hψ.2.2.1 hy (show ψ y' ∈ Fᶜ from he ▸ hy) he) hne'⟩ + have m0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hξ : ∀ t ∈ Icc (0 : ℝ) 1, ξ t ∈ connectedComponentIn (bd Y) x := fun t ht => by + rw [← eQ] + change ψ (ξ t) ∈ F + rw [c3 t ht, ← c5] + exact mem_image_of_mem _ ht + have hη : ∀ t ∈ Icc (0 : ℝ) 1, η t ∈ connectedComponentIn (bd Y) x := fun t ht => by + rw [← eQ] + change ψ (η t) ∈ F + rw [c4 t ht, ← c5] + exact mem_image_of_mem _ ht + rcases c9 with ⟨e1, e2⟩ | ⟨e1, e2⟩ + · exfalso + have injξ : InjOn ξ (Ico 0 1) := fun p hp q hq he => c7 hp hq (by + rw [← c3 p (Ico_subset_Icc_self hp), ← c3 q (Ico_subset_Icc_self hq), he]) + have him := loop_image φ c1 hξ injξ e1.symm + obtain ⟨v, hv, hve⟩ := him.symm.subset (hη 0 m0) + have ha : a₀ v = a₀ 0 := by rw [← c3 v hv, hve, c4 0 m0] + rcases eq_or_lt_of_le hv.2 with rfl | hv1 + · exact c8 0 m0 (e1.symm.trans hve) + · have := c7 ⟨hv.1, hv1⟩ ⟨le_rfl, zero_lt_one⟩ ha + subst this + exact c8 0 m0 hve + · obtain ⟨g', a', hp, hside, hmem, hclosed, hcontinuous⟩ := + loop_one_aux hY L hψ.1 hψ.2.1 hC φ hi' hLf hg hs hξ hη + (conc_inj c3 c4 c7 c8 e1 e2) e1 e2 + exact ⟨hYc, a, b, c', e, i, g', a', hi', hp, hside, hmem, hclosed, hcontinuous⟩ + +/-- **Cutting along an `O`-arc.** The classical cut and paste proof: Massey, *Algebraic Topology: an +Introduction*, Chapter 1, +Section 7. -/ +theorem cutOArc : CutOArcStatement.{u} := by + intro S _ F hS hconn hO hd + have hcS : CompactSpace S := hS.1 + have ht2 : T2Space S := hS.2.1 + obtain ⟨Y, tY, t2Y, ψ, hY, hψ, hcase, Z₁, Z₂, u, c, X₁, Y₁, X₂, Y₂, h7, h8, hi, hun, huc, hfu, + hfc⟩ := exists_cut_loop hS hO hd + have hcY : CompactSpace Y := hY.1 + refine ⟨Y, tY, ψ, hY, hψ, ?_, hcase⟩ + obtain ⟨s⟩ : Nonempty S := inferInstance + have hne : Nonempty S := ⟨s⟩ + rcases hcase with ⟨X, X', hdX, hunX, hOX, hOX', b1, b2⟩ | hQ + · have ne₁ : X.Nonempty := by + obtain ⟨e⟩ := id hOX + exact ⟨_, (e 1).2⟩ + have ne₂ : X'.Nonempty := by + obtain ⟨e⟩ := id hOX' + exact ⟨_, (e 1).2⟩ + obtain ⟨x, hx⟩ := ne₁ + obtain ⟨y, hy⟩ := ne₂ + have hXb : X ⊆ bd Y := fun z hz => hψ.2.2.2.2 (hunX ▸ Or.inl hz) + have hXb' : X' ⊆ bd Y := fun z hz => hψ.2.2.2.2 (hunX ▸ Or.inr hz) + rcases cut_comps hψ hY hOX.isPreconnected hOX'.isPreconnected hunX hx hy with hYc | ⟨W₁, W₂, + hne', hsc, hX₁, hX₂, hW₁, hW₂, hU, hdW, hc₁, hc₂⟩ + · obtain ⟨a, b, c, e, i, j, -, σ, g', hi', hj, hij, hp, -⟩ := + connected_two_cuff_presentation hY hYc hψ hOX hOX' hdX hunX b1 b2 + obtain ⟨hN, hLf⟩ := erase_erase_facts c i j + have hn := nf_blkE (a := a) (b := b) (c := c) hij hi' hj hN hLf σ + have hlen := length_erase_erase hij hi' hj + left + cases σ with + | false => + obtain ⟨w, h5, h6⟩ := hn.1 rfl + obtain ⟨e'⟩ := homeo_of_nf hp h5 h6 + rw [hlen] at e' + exact cutIsSimpler_of_connected e e' (by omega) (by omega) (by omega) + | true => + obtain ⟨w, h5, h6⟩ := hn.2 rfl + obtain ⟨e'⟩ := homeo_of_nf hp h5 h6 + rw [hlen] at e' + exact cutIsSimpler_of_connected e e' (by omega) (by omega) (by omega) + · obtain ⟨a₁, b₁, c₁, ⟨e₁⟩⟩ := classification.{u} W₁ (isSurface_sub hY hW₁) hc₁ + obtain ⟨a₂, b₂, c₂, ⟨e₂⟩⟩ := classification.{u} W₂ (isSurface_sub hY hW₂) hc₂ + obtain ⟨i, j, σ, f, -, -, hi', hj, hf, -⟩ := loop_comps_aux hY hψ hunX b1 b2 hOX hOX' hW₁ hW₂ + hdW hU e₁ e₂ hX₁ hX₂ hXb hXb' + obtain ⟨hN₁, hL₁⟩ := erase_facts c₁ i + obtain ⟨hN₂, hL₂⟩ := erase_facts c₂ j + obtain ⟨e'⟩ := homeo_of_two_loop hi' hj hN₁ hN₂ hL₁ hL₂ hf + rw [length_erase_range hi', length_erase_range hj] at e' + obtain ⟨d⟩ := nonempty_disc_homeo + obtain ⟨d'⟩ := nonempty_cyl_homeo + by_cases h2 : a₂ = 0 ∧ b₂ = 0 ∧ c₂ = 1 + · obtain ⟨rfl, rfl, rfl⟩ := h2 + exact .inr (.inr ⟨W₂, W₁, hne'.symm, by rw [hsc, pair_comm], ⟨(e₂.trans d).symm⟩⟩) + by_cases h1 : a₁ = 0 ∧ b₁ = 0 ∧ c₁ = 1 + · obtain ⟨rfl, rfl, rfl⟩ := h1 + exact .inr (.inr ⟨W₁, W₂, hne', hsc, ⟨(e₁.trans d).symm⟩⟩) + by_cases h4 : a₂ = 0 ∧ b₂ = 0 ∧ c₂ = 2 + · obtain ⟨rfl, rfl, rfl⟩ := h4 + rw [show 0 + a₁ = a₁ by omega, show 0 + b₁ = b₁ by omega, + show 2 - 1 + (c₁ - 1) = c₁ by omega] at e' + exact .inr (.inl ⟨W₂, W₁, hne'.symm, by rw [hsc, pair_comm], ⟨e₂.trans d'⟩, + ⟨e₁.trans e'.symm⟩⟩) + by_cases h3 : a₁ = 0 ∧ b₁ = 0 ∧ c₁ = 2 + · obtain ⟨rfl, rfl, rfl⟩ := h3 + rw [show a₂ + 0 = a₂ by omega, show b₂ + 0 = b₂ by omega, + show c₂ - 1 + (2 - 1) = c₂ by omega] at e' + exact .inr (.inl ⟨W₁, W₂, hne', hsc, ⟨e₁.trans d'⟩, ⟨e₂.trans e'.symm⟩⟩) + refine .inl (cutIsSimpler_of_two hsc e₁ e₂ e' (by omega) (by omega) ?_ (by omega) + (by omega) ?_) + · omega + · omega + · obtain ⟨hYc, a, b, c', e, i, g, ρ, hi', hp, -⟩ := + connected_one_cuff_presentation hY hψ hQ h7 h8 hi hun huc hfu hfc + obtain ⟨hN, hLf⟩ := erase_facts c' i + obtain ⟨w, h5, h6⟩ := nf_blkD (a := a) (b := b) (c := c') hi' hN hLf + obtain ⟨e'⟩ := homeo_of_nf hp h5 h6 + rw [length_erase_range hi'] at e' + exact .inl (cutIsSimpler_of_connected e e' (by omega) (by omega) (by omega)) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutParallel.lean b/LeanPool/GraphMinor/Surface/CutParallel.lean new file mode 100644 index 0000000000..01e4d65a4e --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutParallel.lean @@ -0,0 +1,837 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutSimilar +import Mathlib.Topology.LocalAtTarget + +/-! +# Parallel arcs + +We prove `ParallelArcsStatement` (`parallelArcs`). Let `α` map `F` to `F'`, fix the two ends, and +keep the orientation of each +cuff. Cut `S` along `F'`. We look for a homeomorphism of the cut surface that fixes the two lifts of +`F'` and that covers `α` on +the rest of the boundary. It then descends to a homeomorphism `γ` of `S` that fixes `F'` and agrees +with `α` on `bd S`, and +`γ⁻¹ ∘ α` is the map we want. + +Such a homeomorphism is built one cuff at a time with `exists_move_loop`. On a cuff of the cut +surface we need an increasing map +`τ` of the parameter. Over the lifts of `F'` it is the identity. On a gap between lifts, `α` acts on +a part of a cuff of `S` +by an increasing map `l`, and `τ` is `l` read in the parameter of the cut surface. The two +parameters are related by a monotone +map `k`, so `τ = k⁻¹ ∘ l ∘ k` is increasing whichever way `k` runs. The ends of a gap lie over the +fixed points `s` and `t`, so +`l` maps the gap onto itself. An increasing map onto an interval is continuous, so no limits are +needed at the ends of a gap. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function + +universe u + +/-- A circle can be parametrized to start at a given point. -/ +theorem exists_based {T : Type*} [TopologicalSpace T] {C : Set T} (φ₀ : Circle ≃ₜ C) {b : T} + (hb : b ∈ C) : + ∃ φ : Circle ≃ₜ C, (φ (ee 0)).1 = b := by + refine ⟨(Homeomorph.mulLeft (φ₀.symm ⟨b, hb⟩)).trans φ₀, ?_⟩ + have e : ee 0 = 1 := by simp [ee] + simp [e] + +/-- Every point of the circle has a parameter in `[0, 1)`. -/ +theorem exists_param (c : Circle) : ∃ u ∈ Ico (0 : ℝ) 1, ee u = c := by + obtain ⟨x, rfl⟩ := ee_surjective c + refine ⟨Int.fract x, ⟨Int.fract_nonneg x, Int.fract_lt_one x⟩, ee_eq_iff.mpr ⟨-⌊x⌋, ?_⟩⟩ + rw [Int.fract] + push_cast + ring + +/-- A map with null signature that fixes a point of a cuff has an increasing lift that fixes `0` and +`1`. -/ +theorem exists_null_lift {S : Type u} [TopologicalSpace S] {α : S ≃ₜ S} + (hα : HasNullSignature α) {D : Set S} (hD : D ∈ cuffs S) + (hO : IsOArc D) {b : S} (hb : b ∈ D) (hab : α b = b) : + ∃ (φ : Circle ≃ₜ D) (l : ℝ → ℝ), (φ (ee 0)).1 = b ∧ Continuous l ∧ StrictMono l ∧ l 0 = 0 ∧ l 1 + = 1 ∧ + ∀ u, α (φ (ee u)).1 = (φ (ee (l u))).1 := by + obtain ⟨φ₀⟩ := id hO + obtain ⟨φ, h0⟩ := exists_based φ₀ hb + obtain ⟨h, ⟨l₀, c₀, m₀, hl⟩, hh⟩ := hα D φ hD + have hpi := Real.pi_pos + have e1 : ∀ u, h (ee u) = ee (l₀ (2 * Real.pi * u) / (2 * Real.pi)) := fun u => by + have e2 : 2 * Real.pi * (l₀ (2 * Real.pi * u) / (2 * Real.pi)) = l₀ (2 * Real.pi * u) := by + field_simp + simp only [ee] + rw [e2, hl] + have e0 : h (ee 0) = ee 0 := by + have h3 := hh (ee 0) + rw [h0, hab] at h3 + exact φ.injective (Subtype.ext (h3.symm.trans h0.symm)) + set l₁ : ℝ → ℝ := fun u => l₀ (2 * Real.pi * u) / (2 * Real.pi) with hl₁ + have c₁ : Continuous l₁ := by + simp only [hl₁] + exact (c₀.comp (continuous_const.mul continuous_id)).div_const _ + have m₁ : StrictMono l₁ := fun x y hxy => by + simp only [hl₁] + exact div_lt_div_of_pos_right (m₀ (mul_lt_mul_of_pos_left hxy (by positivity))) (by positivity) + obtain ⟨m, hm⟩ := ee_eq_iff.mp ((e1 0).symm.trans e0) + have hz : l₁ 0 = m := by + rw [zero_add] at hm + exact hm + set l : ℝ → ℝ := fun u => l₁ u - m with hl' + have c' : Continuous l := c₁.sub continuous_const + have m' : StrictMono l := fun x y hxy => sub_lt_sub_right (m₁ hxy) _ + have e3 : ∀ u, h (ee u) = ee (l u) := fun u => by + rw [e1] + exact ee_eq_iff.mpr ⟨m, by simp [hl', hl₁]⟩ + have l0 : l 0 = 0 := by simp only [hl']; rw [hz]; ring + have e4 : ee (l 1) = ee 0 := by rw [← e3, ee_one, e0] + obtain ⟨n, hn⟩ := ee_eq_iff.mp e4 + have hn0 : l 1 = n := by simpa using hn + have hpos : (0 : ℝ) < n := by + rw [← hn0, ← l0] + exact m' zero_lt_one + have hn1 : 1 ≤ n := by exact_mod_cast hpos + have hn2 : n = 1 := by + by_contra hne + have hn3 : 2 ≤ n := by omega + have hn4 : (2 : ℝ) ≤ n := by exact_mod_cast hn3 + obtain ⟨x, hx, hx1⟩ := intermediate_value_Ioo zero_le_one c'.continuousOn (show (1 : ℝ) ∈ Ioo + (l 0) (l 1) by + rw [l0, hn0] + constructor <;> linarith) + have e5 : h (ee x) = h (ee 0) := by rw [e3, hx1, ee_one, e0] + obtain ⟨r, hr⟩ := ee_eq_iff.mp (h.injective e5) + have h1 : (0 : ℝ) < r := by linarith [hx.1] + have h2 : (r : ℝ) < 1 := by linarith [hx.2] + have h3 : 0 < r := by exact_mod_cast h1 + have h4 : r < 1 := by exact_mod_cast h2 + omega + refine ⟨φ, l, h0, c', m', l0, by rw [hn0, hn2]; simp, fun u => ?_⟩ + rw [hh, e3] + +/-- A point of `[0, 1]` that keeps its class modulo one under an increasing map fixing `0` and `1` +is fixed. -/ +theorem fix_of {l : ℝ → ℝ} (hm : StrictMono l) (l0 : l 0 = 0) (l1 : l 1 = 1) {v : ℝ} (hv : v ∈ Icc + (0 : ℝ) 1) (he : ee (l v) = ee v) : + l v = v := by + rcases eq_or_lt_of_le hv.1 with rfl | h1 + · exact l0 + rcases eq_or_lt_of_le hv.2 with rfl | h2 + · exact l1 + have h3 : 0 < l v := by rw [← l0]; exact hm h1 + have h4 : l v < 1 := by rw [← l1]; exact hm h2 + obtain ⟨r, hr⟩ := ee_eq_iff.mp he + have h5 : (r : ℝ) < 1 := by linarith + have h6 : (-1 : ℝ) < r := by linarith + have h7 : r < 1 := by exact_mod_cast h5 + have h8 : -1 < r := by exact_mod_cast h6 + have h9 : r = 0 := by omega + rw [hr, h9] + simp + +/-- Conjugating an increasing map of an interval by a monotone map gives an increasing map. -/ +theorem gap_conj {k l : ℝ → ℝ} {p q a b : ℝ} (hab : a < b) (hk : StrictMonoOn k (Icc p q) + ∨ StrictAntiOn k (Icc p q)) + (hc : ContinuousOn k (Icc p q)) (hpq : p < q) (he : (k p = a ∧ k q = b) ∨ (k p = b ∧ k q = a)) + (cl : Continuous l) (ml : StrictMono l) + (la : l a = a) (lb : l b = b) : + ∃ τ : ℝ → ℝ, (∀ u ∈ Ioo p q, τ u ∈ Ioo p q ∧ k (τ u) = l (k u)) ∧ StrictMonoOn τ (Ioo p q) + ∧ Ioo p q ⊆ τ '' Ioo p q := by + have mp : p ∈ Icc p q := left_mem_Icc.mpr hpq.le + have mq : q ∈ Icc p q := right_mem_Icc.mpr hpq.le + have hI : ∀ {u}, u ∈ Ioo p q → u ∈ Icc p q := fun hu => Ioo_subset_Icc_self hu + have mem : ∀ u ∈ Ioo p q, k u ∈ Ioo a b := by + intro u hu + rcases hk with hk | hk <;> rcases he with ⟨e1, e2⟩ | ⟨e1, e2⟩ + · exact ⟨e1 ▸ hk mp (hI hu) hu.1, e2 ▸ hk (hI hu) mq hu.2⟩ + · have := hk mp mq hpq + linarith + · have := hk mp mq hpq + linarith + · exact ⟨e2 ▸ hk (hI hu) mq hu.2, e1 ▸ hk mp (hI hu) hu.1⟩ + have sur : ∀ v ∈ Ioo a b, ∃ u ∈ Ioo p q, k u = v := by + intro v hv + have h1 : v ∈ uIcc (k p) (k q) := by + rcases he with ⟨e1, e2⟩ | ⟨e1, e2⟩ <;> rw [e1, e2] + · exact Ioo_subset_Icc_self hv |> fun h => by rwa [uIcc_of_le hab.le] + · exact Ioo_subset_Icc_self hv |> fun h => by rwa [uIcc_of_ge hab.le] + have h2 : uIcc p q = Icc p q := uIcc_of_le hpq.le + obtain ⟨u, hu, rfl⟩ := intermediate_value_uIcc (h2 ▸ hc) h1 + rw [h2] at hu + have h3 : u ≠ p := by + rintro rfl + rcases he with ⟨e1, -⟩ | ⟨e1, -⟩ <;> rw [e1] at hv <;> simp at hv + have h4 : u ≠ q := by + rintro rfl + rcases he with ⟨-, e1⟩ | ⟨-, e1⟩ <;> rw [e1] at hv <;> simp at hv + exact ⟨u, ⟨lt_of_le_of_ne hu.1 h3.symm, lt_of_le_of_ne hu.2 h4⟩, rfl⟩ + have hl : ∀ x ∈ Ioo a b, l x ∈ Ioo a b := fun x hx => ⟨la ▸ ml hx.1, lb ▸ ml hx.2⟩ + have ex : ∀ u ∈ Ioo p q, ∃ w ∈ Ioo p q, k w = l (k u) := fun u hu => sur _ (hl _ (mem u hu)) + choose! τ h1 h2 using ex + have hinj : InjOn k (Icc p q) := hk.elim StrictMonoOn.injOn StrictAntiOn.injOn + refine ⟨τ, fun u hu => ⟨h1 u hu, h2 u hu⟩, ?_, ?_⟩ + · intro u hu v hv huv + rcases hk with hk | hk + · have h3 := ml (hk (hI hu) (hI hv) huv) + rw [← h2 u hu, ← h2 v hv] at h3 + exact (StrictMonoOn.lt_iff_lt hk (hI (h1 u hu)) (hI (h1 v hv))).mp h3 + · have h3 := ml (hk (hI hu) (hI hv) huv) + rw [← h2 u hu, ← h2 v hv] at h3 + exact (StrictAntiOn.lt_iff_gt hk (hI (h1 v hv)) (hI (h1 u hu))).mp h3 + · intro v hv + obtain ⟨x, hx, hx1⟩ := intermediate_value_Ioo hab.le cl.continuousOn (show k v ∈ Ioo (l a) + (l b) by + rw [la, lb] + exact mem v hv) + obtain ⟨u, hu, rfl⟩ := sur x hx + exact ⟨u, hu, hinj (hI (h1 u hu)) (hI hv) ((h2 u hu).trans hx1)⟩ + +section cut + +variable {Y S : Type u} [TopologicalSpace Y] [TopologicalSpace S] [T2Space S] {ψ : Y + → S} {F : Set S} {α : S ≃ₜ S} {s t : S} + +/-- A point off the lifts of `F` over the boundary of `S` is a boundary point of the cut surface. -/ +theorem bd_lift [CompactSpace Y] (hψ : IsCutting ψ F) (hF : IsClosed F) {y : Y} (hy : ψ y ∈ bd S) + (hyF : ψ y ∉ F) : y ∈ bd Y := by + intro hi + apply hy + obtain ⟨h1, h2, h3, -, -⟩ := hψ + have hO : IsOpen (ψ ⁻¹' F)ᶜ := (hF.preimage h1).isOpen_compl + obtain ⟨U, hU, hx, hsub, ⟨e⟩⟩ := hi.exists_subset hO hyF + have hcl : IsClosedMap ψ := h1.isClosedMap + have hq : IsQuotientMap ψ := hcl.isQuotientMap h1 h2 + have he : ψ ⁻¹' (ψ '' U) = U := by + apply subset_antisymm + · rintro a ⟨b, hb, hab⟩ + have hb' : ψ b ∉ F := hsub hb + have ha' : ψ a ∉ F := hab ▸ hb' + rwa [h3 ha' hb' hab.symm] + · exact subset_preimage_image ψ U + have hV : IsOpen (ψ '' U) := by + rw [← hq.isOpen_preimage, he] + exact hU + have hbij : Bijective ((ψ '' U).restrictPreimage ψ) := by + constructor + · rintro ⟨a, ha⟩ ⟨b, hb⟩ he' + have he2 : ψ a = ψ b := congrArg Subtype.val he' + have ha' : a ∈ U := he ▸ ha + have hb' : b ∈ U := he ▸ hb + exact Subtype.ext (h3 (hsub ha') (hsub hb') he2) + · rintro ⟨w, hw⟩ + obtain ⟨y', rfl⟩ := h2 w + exact ⟨⟨y', hw⟩, rfl⟩ + have hh : IsHomeomorph ((ψ '' U).restrictPreimage ψ) := + isHomeomorph_iff_continuous_isClosedMap_bijective.mpr ⟨h1.restrictPreimage, + hcl.restrictPreimage _, hbij⟩ + exact ⟨ψ '' U, hV, mem_image_of_mem ψ hx, ⟨hh.homeomorph.symm.trans + ((Homeomorph.setCongr he).trans e)⟩⟩ + +/-- `α` read on a gap between two lifts. -/ +theorem exists_gap_map [CompactSpace Y] (hS : IsSurface S) (hψ : IsCutting ψ F) + (hF : IsClosed F) (hb : F ∩ bd S = {s, t}) + (hα : HasNullSignature α) (hs : α s = s) (ht : α t = t) {T : ℝ → Y} (hT : Continuous T) + (hTb : ∀ u, T u ∈ bd Y) + {p q : ℝ} (hpq : p < q) (hTp : ψ (T p) ∈ F) (hTq : ψ (T q) ∈ F) (hgap : ∀ u ∈ Ioo p q, ψ + (T u) ∉ F) (hinj : InjOn T (Ioo p q)) : + ∃ τ : ℝ → ℝ, (∀ u ∈ Ioo p q, τ u ∈ Ioo p q ∧ ψ (T (τ u)) = α (ψ (T u))) ∧ StrictMonoOn τ + (Ioo p q) ∧ Ioo p q ⊆ τ '' Ioo p q := by + have hcuff := cuff_statement.{u} S hS + have cc : Continuous fun u => ψ (T u) := hψ.1.comp hT + have hcl : closure (Ioo p q) = Icc p q := closure_Ioo hpq.ne + have hIcc : ∀ u ∈ Icc p q, ψ (T u) ∈ bd S := by + intro u hu + have h1 : ψ (T u) ∈ closure (bd S) := + map_mem_closure (f := fun u => ψ (T u)) (t := bd S) cc (hcl ▸ hu) fun x hx => bd_of_bd hψ hF + (hTb x) (hgap x hx) + rwa [hcuff.1.closure_eq] at h1 + have mp : p ∈ Icc p q := left_mem_Icc.mpr hpq.le + have mq : q ∈ Icc p q := right_mem_Icc.mpr hpq.le + have fx : ∀ x ∈ F, x ∈ bd S → α x = x := by + intro x hx hx' + have h1 : x ∈ ({s, t} : Set S) := hb ▸ ⟨hx, hx'⟩ + rcases h1 with rfl | h1 + · exact hs + · rw [mem_singleton_iff.mp h1] + exact ht + set D := connectedComponentIn (bd S) (ψ (T p)) with hDdef + have hD : D ∈ cuffs S := ⟨_, hIcc p mp, rfl⟩ + have hsub : (fun u => ψ (T u)) '' Icc p q ⊆ D := + (isPreconnected_Icc.image _ cc.continuousOn).subset_connectedComponentIn ⟨p, mp, rfl⟩ (by + rintro _ ⟨u, hu, rfl⟩ + exact hIcc u hu) + have hbD : ψ (T p) ∈ D := hsub ⟨p, mp, rfl⟩ + obtain ⟨φ, l, h0, cl, ml, l0, l1, hl⟩ := exists_null_lift hα hD (hcuff.2.2 D hD) hbD (fx _ hTp + (hIcc p mp)) + have hne : q - p ≠ 0 := sub_ne_zero.mpr hpq.ne' + have hp0 : 0 < q - p := sub_pos.mpr hpq + have mem0 : ∀ v ∈ Icc (0 : ℝ) 1, p + v * (q - p) ∈ Icc p q := fun v hv => by + constructor + · nlinarith [hv.1] + · nlinarith [hv.2] + obtain ⟨m, cm, hm⟩ := exists_lift φ (η := fun v => ψ (T (p + v * (q - p)))) (cc.comp + (continuous_const.add (continuous_id.mul continuous_const))).continuousOn (fun v hv + => hsub ⟨_, mem0 v hv, rfl⟩) + set θ : ℝ → S := fun x => (φ (ee x)).1 with hθ + set k₀ : ℝ → ℝ := fun u => m ((u - p) / (q - p)) with hk₀ + have mem1 : ∀ u ∈ Icc p q, (u - p) / (q - p) ∈ Icc (0 : ℝ) 1 := fun u hu => by + constructor + · exact div_nonneg (sub_nonneg.mpr hu.1) hp0.le + · rw [div_le_one hp0] + linarith [hu.2] + have vk₀ : ∀ u ∈ Icc p q, θ (k₀ u) = ψ (T u) := fun u hu => by + have h1 := hm _ (mem1 u hu) + have h2 : p + (u - p) / (q - p) * (q - p) = u := by + field_simp + ring + simp only [h2] at h1 + exact h1 + have ck₀ : ContinuousOn k₀ (Icc p q) := cm.comp (by fun_prop) mem1 + have θint : ∀ (x : ℝ) (n : ℤ), θ (x + n) = θ x := fun x n => by + have h1 : ee (x + n) = ee x := ee_eq_iff.mpr ⟨n, rfl⟩ + simp only [hθ, h1] + have θ0 : θ 0 = ψ (T p) := h0 + have θn : ∀ n : ℤ, θ n = ψ (T p) := fun n => by + rw [← θ0, ← θint 0 n, zero_add] + have hIoo : ∀ {u}, u ∈ Ioo p q → u ∈ Icc p q := fun hu => Ioo_subset_Icc_self hu + have noint : ∀ u ∈ Ioo p q, ∀ n : ℤ, k₀ u ≠ n := fun u hu n he => by + apply hgap u hu + rw [← vk₀ u (hIoo hu), he, θn] + exact hTp + have hmid : (p + q) / 2 ∈ Ioo p q := ⟨by linarith, by linarith⟩ + set m₀ : ℤ := ⌊k₀ ((p + q) / 2)⌋ with hm₀ + have hm1 : (m₀ : ℝ) < k₀ ((p + q) / 2) := lt_of_le_of_ne (Int.floor_le _) (noint _ hmid m₀).symm + have hm2 : k₀ ((p + q) / 2) < m₀ + 1 := Int.lt_floor_add_one _ + have pre : IsPreconnected (k₀ '' Ioo p q) := isPreconnected_Ioo.image _ + (ck₀.mono Ioo_subset_Icc_self) + have hrange : ∀ u ∈ Ioo p q, k₀ u ∈ Ioo (m₀ : ℝ) (m₀ + 1) := by + intro u hu + constructor + · by_contra hc + obtain ⟨w, hw, hw1⟩ := pre.Icc_subset ⟨u, hu, rfl⟩ ⟨_, hmid, rfl⟩ ⟨not_lt.mp hc, hm1.le⟩ + exact noint w hw m₀ hw1 + · by_contra hc + obtain ⟨w, hw, hw1⟩ := pre.Icc_subset ⟨_, hmid, rfl⟩ ⟨u, hu, rfl⟩ ⟨hm2.le, not_lt.mp hc⟩ + exact noint w hw (m₀ + 1) (by rw [hw1]; push_cast; rfl) + set k : ℝ → ℝ := fun u => k₀ u - m₀ with hk + have ck : ContinuousOn k (Icc p q) := ck₀.sub continuousOn_const + have vk : ∀ u ∈ Icc p q, θ (k u) = ψ (T u) := fun u hu => by + have h1 := θint (k u) m₀ + simp only [hk, sub_add_cancel] at h1 + rw [← vk₀ u hu] + exact h1.symm + have kIoo : ∀ u ∈ Ioo p q, k u ∈ Ioo (0 : ℝ) 1 := fun u hu => by + have h1 := hrange u hu + simp only [hk] + constructor <;> linarith [h1.1, h1.2] + have kIcc : ∀ u ∈ Icc p q, k u ∈ Icc (0 : ℝ) 1 := by + have h1 : k '' Icc p q ⊆ Icc 0 1 := by + rw [← hcl] + refine (ContinuousOn.image_closure (hcl ▸ ck)).trans (closure_minimal ?_ isClosed_Icc) + rintro _ ⟨u, hu, rfl⟩ + exact Ioo_subset_Icc_self (kIoo u hu) + exact fun u hu => h1 ⟨u, hu, rfl⟩ + have kinj : InjOn k (Ioo p q) := fun u hu u' hu' he => by + have h1 : ψ (T u) = ψ (T u') := by rw [← vk u (hIoo hu), ← vk u' (hIoo hu'), he] + exact hinj hu hu' (hψ.2.2.1 (hgap u hu) (hgap u' hu') h1) + have kend : ∀ e ∈ Icc p q, ψ (T e) ∈ F → ∀ u ∈ Ioo p q, k u ≠ k e := fun e he hF' u hu h => by + apply hgap u hu + rw [← vk u (hIoo hu), h, vk e he] + exact hF' + have knq : k p ≠ k q := by + intro he + have h1 : k ((p + q) / 2) ≠ k p := kend p mp hTp _ hmid + set y := k ((p + q) / 2) with hy + set v := (k p + y) / 2 with hv + have hv1 : v ≠ k p := fun h => h1 (by linarith) + have hv2 : v ≠ y := fun h => h1 (by linarith) + have hv3 : v ∈ uIcc (k p) y := by + rcases lt_or_gt_of_ne h1 with h | h + · rw [uIcc_of_ge h.le] + constructor <;> linarith + · rw [uIcc_of_le h.le] + constructor <;> linarith + have h3 := hmid + have s1 : uIcc p ((p + q) / 2) = Icc p ((p + q) / 2) := uIcc_of_le h3.1.le + have s2 : uIcc ((p + q) / 2) q = Icc ((p + q) / 2) q := uIcc_of_le h3.2.le + obtain ⟨u₁, hu₁, e₁⟩ := intermediate_value_uIcc (s1 ▸ ck.mono (Icc_subset_Icc_right h3.2.le)) + hv3 + obtain ⟨u₂, hu₂, e₂⟩ := intermediate_value_uIcc (s2 ▸ ck.mono (Icc_subset_Icc_left h3.1.le)) + (show v ∈ uIcc (k ((p + q) / 2)) (k q) by rw [← he, uIcc_comm]; exact hv3) + rw [s1] at hu₁ + rw [s2] at hu₂ + have n1 : u₁ ≠ p := fun h => hv1 (by rw [← e₁, h]) + have n2 : u₁ ≠ (p + q) / 2 := fun h => hv2 (by rw [← e₁, h]) + have n3 : u₂ ≠ q := fun h => hv1 (by rw [← e₂, h, he]) + have n4 : u₂ ≠ (p + q) / 2 := fun h => hv2 (by rw [← e₂, h]) + have l1' : u₁ < (p + q) / 2 := lt_of_le_of_ne hu₁.2 n2 + have l2' : (p + q) / 2 < u₂ := lt_of_le_of_ne hu₂.1 n4.symm + have := kinj (x₁ := u₁) (x₂ := u₂) ⟨lt_of_le_of_ne hu₁.1 n1.symm, by linarith⟩ ⟨by linarith, + lt_of_le_of_ne hu₂.2 n3⟩ (e₁.trans e₂.symm) + linarith + have hsplit : ∀ u ∈ Icc p q, u = p ∨ u = q ∨ u ∈ Ioo p q := fun u hu => by + rcases eq_or_lt_of_le hu.1 with h | h + · exact .inl h.symm + rcases eq_or_lt_of_le hu.2 with h' | h' + · exact .inr (.inl h') + exact .inr (.inr ⟨h, h'⟩) + have kp := kend p mp hTp + have kq := kend q mq hTq + have hI : InjOn k (Icc p q) := by + intro u hu u' hu' he + rcases hsplit u hu with rfl | rfl | h1 <;> rcases hsplit u' hu' with rfl | rfl | h2 + · rfl + · exact absurd he knq + · exact absurd he.symm (kp _ h2) + · exact absurd he.symm knq + · rfl + · exact absurd he.symm (kq _ h2) + · exact absurd he (kp _ h1) + · exact absurd he (kq _ h1) + · exact kinj h1 h2 he + have mon := ck.strictMonoOn_of_injOn_Icc' hpq.le hI + have fixl : ∀ e ∈ Icc p q, ψ (T e) ∈ F → l (k e) = k e := fun e he hFe => by + have h1 : α (θ (k e)) = θ (k e) := by + rw [vk e he] + exact fx _ hFe (hIcc e he) + have h2 : θ (l (k e)) = θ (k e) := (hl (k e)).symm.trans h1 + exact fix_of ml l0 l1 (kIcc e he) (φ.injective (Subtype.ext h2)) + have finish : ∀ a b : ℝ, a < b → ((k p = a ∧ k q = b) ∨ (k p = b ∧ k q = a)) → l a = a → l b = b → + ∃ τ : ℝ → ℝ, (∀ u ∈ Ioo p q, τ u ∈ Ioo p q ∧ ψ (T (τ u)) = α (ψ (T u))) ∧ StrictMonoOn τ + (Ioo p q) ∧ Ioo p q ⊆ τ '' Ioo p q := by + intro a b hab he la lb + obtain ⟨τ, h1, h2, h3⟩ := gap_conj hab mon ck hpq he cl ml la lb + refine ⟨τ, fun u hu => ⟨(h1 u hu).1, ?_⟩, h2, h3⟩ + rw [← vk _ (hIoo (h1 u hu).1), (h1 u hu).2, ← vk u (hIoo hu)] + exact (hl (k u)).symm + rcases lt_or_gt_of_ne knq with h | h + · exact finish _ _ h (.inl ⟨rfl, rfl⟩) (fixl p mp hTp) (fixl q mq hTq) + · exact finish _ _ h (.inr ⟨rfl, rfl⟩) (fixl q mq hTq) (fixl p mp hTp) + +/-- The increasing map of the parameter of a cuff of the cut surface that meets the lifts. -/ +theorem exists_tau [CompactSpace Y] (hS : IsSurface S) (hψ : IsCutting ψ F) + (hF : IsClosed F) (hb : F ∩ bd S = {s, t}) + (hα : HasNullSignature α) (hs : α s = s) (ht : α t = t) {T : ℝ → Y} (hT : Continuous T) + (hTb : ∀ u, T u ∈ bd Y) + (h0 : ψ (T 0) ∈ F) (h1 : ψ (T 1) ∈ F) (hinj : InjOn T (Ioo 0 1)) : + ∃ τ : ℝ → ℝ, ContinuousOn τ (Icc 0 1) ∧ StrictMonoOn τ (Icc 0 1) ∧ τ 0 = 0 ∧ τ 1 = 1 + ∧ ∀ u ∈ Icc (0 : ℝ) 1, τ u ∈ Icc (0 : ℝ) 1 ∧ + (ψ (T u) ∈ F → τ u = u) ∧ (ψ (T u) ∉ F → ψ (T (τ u)) = α (ψ (T u))) := by + set E : Set ℝ := {u | ψ (T u) ∈ F} with hE + have hEc : IsClosed E := hF.preimage (hψ.1.comp hT) + have hE0 : (0 : ℝ) ∈ E := h0 + have hE1 : (1 : ℝ) ∈ E := h1 + have gapex : ∀ u ∈ Icc (0 : ℝ) 1, u ∉ E → ∃ p q : ℝ, 0 ≤ p ∧ q ≤ 1 ∧ p < u ∧ u < q ∧ p ∈ E + ∧ q ∈ E ∧ ∀ v ∈ Ioo p q, v ∉ E := by + intro u hu hnE + have cA : IsCompact (E ∩ Icc 0 u) := isCompact_Icc.inter_left hEc + have cB : IsCompact (E ∩ Icc u 1) := isCompact_Icc.inter_left hEc + have nA : (E ∩ Icc 0 u).Nonempty := ⟨0, hE0, le_rfl, hu.1⟩ + have nB : (E ∩ Icc u 1).Nonempty := ⟨1, hE1, hu.2, le_rfl⟩ + have mA := cA.sSup_mem nA + have mB := cB.sInf_mem nB + have l1 : sSup (E ∩ Icc 0 u) < u := lt_of_le_of_ne mA.2.2 fun h => hnE (h ▸ mA.1) + have l2 : u < sInf (E ∩ Icc u 1) := lt_of_le_of_ne mB.2.1 fun h => hnE (h ▸ mB.1) + refine ⟨_, _, mA.2.1, mB.2.2, l1, l2, mA.1, mB.1, fun v hv hvE => ?_⟩ + rcases le_total v u with h | h + · exact absurd (le_csSup cA.bddAbove ⟨hvE, (mA.2.1.trans hv.1.le), h⟩) (not_le.mpr hv.1) + · exact absurd (csInf_le cB.bddBelow ⟨hvE, h, hv.2.le.trans mB.2.2⟩) (not_le.mpr hv.2) + have gm : ∀ p q : ℝ, 0 ≤ p → q ≤ 1 → p < q → p ∈ E → q ∈ E → (∀ v ∈ Ioo p q, v ∉ E) → + ∃ τ : ℝ → ℝ, (∀ u ∈ Ioo p q, τ u ∈ Ioo p q ∧ ψ (T (τ u)) = α (ψ (T u))) ∧ StrictMonoOn τ + (Ioo p q) ∧ Ioo p q ⊆ τ '' Ioo p q := + fun p q hp hq hpq mp mq hg => exists_gap_map hS hψ hF hb hα hs ht hT hTb hpq mp mq hg + (hinj.mono (Ioo_subset_Ioo hp hq)) + have ex : ∀ u ∈ Icc (0 : ℝ) 1, ∃ w, w ∈ Icc (0 : ℝ) 1 ∧ (u ∈ E → w = u) ∧ (u ∉ E → w ∈ Ioo + (0 : ℝ) 1 ∧ w ∉ E ∧ ψ (T w) = α (ψ (T u))) := by + intro u hu + by_cases hn : u ∈ E + · exact ⟨u, hu, fun _ => rfl, fun h => absurd hn h⟩ + · obtain ⟨p, q, hp, hq, l1, l2, mp, mq, hg⟩ := gapex u hu hn + obtain ⟨τ', h2, -, -⟩ := gm p q hp hq (l1.trans l2) mp mq hg + obtain ⟨h3, h4⟩ := h2 u ⟨l1, l2⟩ + have h5 : τ' u ∈ Ioo (0 : ℝ) 1 := ⟨hp.trans_lt h3.1, h3.2.trans_le hq⟩ + exact ⟨τ' u, Ioo_subset_Icc_self h5, fun h => absurd h hn, fun _ => ⟨h5, hg _ h3, h4⟩⟩ + choose! τ t1 t2 t3 using ex + have hG : ∀ u ∈ Icc (0 : ℝ) 1, u ∉ E → ∃ p q : ℝ, 0 ≤ p ∧ q ≤ 1 ∧ p < u ∧ u < q ∧ p ∈ E ∧ q ∈ E ∧ + (∀ v ∈ Ioo p q, v ∉ E) ∧ + τ u ∈ Ioo p q ∧ StrictMonoOn τ (Ioo p q) ∧ Ioo p q ⊆ τ '' Ioo p q := by + intro u hu hn + obtain ⟨p, q, hp, hq, l1, l2, mp, mq, hg⟩ := gapex u hu hn + obtain ⟨τ', h2, h3, h4⟩ := gm p q hp hq (l1.trans l2) mp mq hg + have same : ∀ v ∈ Ioo p q, τ v = τ' v := by + intro v hv + have hvI : v ∈ Icc (0 : ℝ) 1 := ⟨hp.trans hv.1.le, hv.2.le.trans hq⟩ + obtain ⟨a1, a2, a3⟩ := t3 v hvI (hg v hv) + obtain ⟨b1, b2⟩ := h2 v hv + have b3 : τ' v ∈ Ioo (0 : ℝ) 1 := ⟨hp.trans_lt b1.1, b1.2.trans_le hq⟩ + exact hinj a1 b3 (hψ.2.2.1 a2 (hg _ b1) (a3.trans b2.symm)) + refine ⟨p, q, hp, hq, l1, l2, mp, mq, hg, ?_, ?_, ?_⟩ + · rw [same u ⟨l1, l2⟩] + exact (h2 u ⟨l1, l2⟩).1 + · intro x hx y hy hxy + rw [same x hx, same y hy] + exact h3 hx hy hxy + · intro w hw + obtain ⟨v, hv, rfl⟩ := h4 hw + exact ⟨v, hv, same v hv⟩ + have hmono : StrictMonoOn τ (Icc 0 1) := by + intro u hu u' hu' huu + by_cases h2 : u ∈ E <;> by_cases h3 : u' ∈ E + · rw [t2 u hu h2, t2 u' hu' h3] + exact huu + · obtain ⟨p, q, -, -, l1, l2, -, -, hg, h4, -, -⟩ := hG u' hu' h3 + have h5 : u ≤ p := by + by_contra hc + exact hg u ⟨not_le.mp hc, huu.trans l2⟩ h2 + rw [t2 u hu h2] + exact h5.trans_lt h4.1 + · obtain ⟨p, q, -, -, l1, l2, -, -, hg, h4, -, -⟩ := hG u hu h2 + have h5 : q ≤ u' := by + by_contra hc + exact hg u' ⟨l1.trans huu, not_le.mp hc⟩ h3 + rw [t2 u' hu' h3] + exact h4.2.trans_le h5 + · obtain ⟨p, q, -, -, l1, l2, -, mq, hg, h4, h5, -⟩ := hG u hu h2 + by_cases h6 : u' < q + · exact h5 ⟨l1, l2⟩ ⟨l1.trans huu, h6⟩ huu + · obtain ⟨p', q', -, -, l1', l2', -, -, hg', h4', -, -⟩ := hG u' hu' h3 + have h7 : q ≤ p' := by + by_contra hc + exact hg' q ⟨not_le.mp hc, (not_lt.mp h6).trans_lt l2'⟩ mq + exact h4.2.trans (h7.trans_lt h4'.1) + have hsurj : ∀ w ∈ Icc (0 : ℝ) 1, ∃ u ∈ Icc (0 : ℝ) 1, τ u = w := by + intro w hw + by_cases h2 : w ∈ E + · exact ⟨w, hw, t2 w hw h2⟩ + · obtain ⟨p, q, hp, hq, l1, l2, -, -, -, -, -, h5⟩ := hG w hw h2 + obtain ⟨v, hv, rfl⟩ := h5 ⟨l1, l2⟩ + exact ⟨v, ⟨hp.trans hv.1.le, hv.2.le.trans hq⟩, rfl⟩ + have hcont : ContinuousOn τ (Icc 0 1) := by + let f : Icc (0 : ℝ) 1 → Icc (0 : ℝ) 1 := fun u => ⟨τ u.1, t1 u.1 u.2⟩ + have fm : StrictMono f := fun x y hxy => hmono x.2 y.2 hxy + have fs : Surjective f := fun w => by + obtain ⟨u, hu, h2⟩ := hsurj w.1 w.2 + exact ⟨⟨u, hu⟩, Subtype.ext h2⟩ + have fc : Continuous f := (fm.orderIsoOfSurjective f fs).continuous + exact continuousOn_iff_continuous_domRestrict.mpr (continuous_subtype_val.comp fc) + have m0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have m1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + refine ⟨τ, hcont, hmono, t2 0 m0 hE0, t2 1 m1 hE1, fun u hu => ⟨t1 u hu, t2 u hu, fun h => ?_⟩⟩ + exact (t3 u hu h).2.2 + +/-- What a homeomorphism of the cut surface does at a boundary point. -/ +def Covers (ψ : Y → S) (F : Set S) (α : S ≃ₜ S) (C : Set Y) (z z' : Y) : Prop := + z' ∈ C ∧ (ψ z ∈ F → z' = z) ∧ (ψ z ∉ F → ψ z' = α (ψ z)) + +/-- The move on a cuff of the cut surface that meets the lifts. -/ +theorem cuff_move (hY : IsSurface Y) (hS : IsSurface S) (hψ : IsCutting ψ F) + (hF : IsClosed F) (hb : F ∩ bd S = {s, t}) + (hα : HasNullSignature α) (hs : α s = s) (ht : α t = t) {C U : Set Y} (hC : C ∈ cuffs Y) + (hU : IsOpen U) (hCU : C ⊆ U) + (hO : IsOArc C) {z₀ : Y} (hz : z₀ ∈ C) (hz0 : ψ z₀ ∈ F) : + ∃ G : Y ≃ₜ Y, (∀ z ∈ C, Covers ψ F α C z (G z)) ∧ ∀ x ∉ U, G x = x := by + have hcY : CompactSpace Y := hY.1 + obtain ⟨φ₀⟩ := id hO + obtain ⟨φ, h0⟩ := exists_based φ₀ hz + have hCb : C ⊆ bd Y := by + obtain ⟨x, hx, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + set T : ℝ → Y := fun u => (φ (ee u)).1 with hTdef + have hT : Continuous T := continuous_subtype_val.comp (φ.continuous.comp continuous_ee) + have hT1 : T 1 = T 0 := by simp only [hTdef, ee_one] + have hT0 : T 0 = z₀ := h0 + have hinj : InjOn T (Ioo 0 1) := fun x hx y hy he => + ee_injOn (Ioo_subset_Ico_self hx) (Ioo_subset_Ico_self hy) (φ.injective (Subtype.ext he)) + obtain ⟨τ, c1, c2, c3, c4, c5⟩ := exists_tau hS hψ hF hb hα hs ht hT (fun u => hCb (φ (ee u)).2) + (by rw [hT0]; exact hz0) (by rw [hT1, hT0]; exact hz0) hinj + obtain ⟨G, g1, g2⟩ := exists_move_loop hY hC hU hCU φ c1 c2 (by rw [c3, c4]; norm_num) + refine ⟨G, fun z hzC => ?_, g2⟩ + obtain ⟨u, hu, e⟩ := exists_param (φ.symm ⟨z, hzC⟩) + have hI := Ico_subset_Icc_self hu + have e1 : T u = z := by simp only [hTdef, e, Homeomorph.apply_symm_apply] + obtain ⟨c6, c7, c8⟩ := c5 u hI + have e2 : G z = T (τ u) := by + rw [← e1] + exact g1 u hI + refine ⟨e2 ▸ (φ (ee (τ u))).2, fun h => ?_, fun h => ?_⟩ + · rw [e2, c7 (e1 ▸ h), e1] + · rw [e2, ← e1] + exact c8 (e1 ▸ h) + +/-- The move on a cuff of the cut surface that misses the lifts. -/ +theorem cuff_move_off (hY : IsSurface Y) (hS : IsSurface S) (hψ : IsCutting ψ F) + (hF : IsClosed F) (hα : HasNullSignature α) + {C U : Set Y} (hC : C ∈ cuffs Y) (hU : IsOpen U) (hCU : C ⊆ U) (hO : IsOArc C) + (hoff : ∀ z ∈ C, ψ z ∉ F) : + ∃ G : Y ≃ₜ Y, (∀ z ∈ C, Covers ψ F α C z (G z)) ∧ ∀ x ∉ U, G x = x := by + have hcuff := cuff_statement.{u} S hS + have hcY : CompactSpace Y := hY.1 + obtain ⟨φ⟩ := id hO + have hCb : C ⊆ bd Y := by + obtain ⟨x, hx, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + set j : Circle → S := fun x => ψ (φ x).1 with hj + have cj : Continuous j := hψ.1.comp (continuous_subtype_val.comp φ.continuous) + have ij : Injective j := fun x y he => + φ.injective (Subtype.ext (hψ.2.2.1 (hoff _ (φ x).2) (hoff _ (φ y).2) he)) + have hce : IsClosedEmbedding j := cj.isClosedEmbedding ij + have hX : IsOArc (range j) := ⟨hce.isEmbedding.toHomeomorph⟩ + have hb : range j ⊆ bd S := by + rintro _ ⟨x, rfl⟩ + exact bd_of_bd hψ hF (hCb (φ x).2) (hoff _ (φ x).2) + have hsub := (isPreconnected_range cj).subset_connectedComponentIn (mem_range_self 1) hb + have hD : connectedComponentIn (bd S) (j 1) ∈ cuffs S := ⟨_, hb (mem_range_self 1), rfl⟩ + obtain ⟨φD⟩ := hcuff.2.2 _ hD + have heq := oarc_eq φD hX hsub + let φ' : Circle ≃ₜ connectedComponentIn (bd S) (j 1) := hce.isEmbedding.toHomeomorph.trans + (Homeomorph.setCongr heq) + have hφ' : ∀ x, (φ' x).1 = j x := fun _ => rfl + obtain ⟨h, hp, hh⟩ := hα _ φ' hD + obtain ⟨G, g1, g2⟩ := move_cuff Y C U φ h hY hC hU hCU hp + refine ⟨G, fun z hzC => ?_, g2⟩ + have e1 : (φ (φ.symm ⟨z, hzC⟩)).1 = z := by simp + set x := φ.symm ⟨z, hzC⟩ + have e2 : G z = (φ (h x)).1 := by rw [← e1]; exact g1 x + refine ⟨e2 ▸ (φ (h x)).2, fun h' => absurd h' (hoff z hzC), fun _ => ?_⟩ + rw [e2, ← e1] + exact ((hh x).trans (hφ' _)).symm + +/-- A homeomorphism of the cut surface that covers `α` on the boundary and fixes the lifts. -/ +theorem exists_cover [T2Space Y] (hY : IsSurface Y) (hS : IsSurface S) (hψ : IsCutting ψ F) + (hF : IsClosed F) (hb : F ∩ bd S = {s, t}) + (hα : HasNullSignature α) (hs : α s = s) (ht : α t = t) : + ∃ G : Y ≃ₜ Y, ∀ C ∈ cuffs Y, ∀ z ∈ C, Covers ψ F α C z (G z) := by + have hcuff := cuff_statement.{u} Y hY + have step : ∀ C ∈ cuffs Y, ∀ U : Set Y, IsOpen U → C ⊆ U → ∃ G : Y ≃ₜ Y, + (∀ z ∈ C, Covers ψ F α C z (G z)) ∧ ∀ x ∉ U, G x = x := by + intro C hC U hU hCU + by_cases h : ∃ z ∈ C, ψ z ∈ F + · obtain ⟨z, hz, hz'⟩ := h + exact cuff_move hY hS hψ hF hb hα hs ht hC hU hCU (hcuff.2.2 C hC) hz hz' + · push Not at h + exact cuff_move_off hY hS hψ hF hα hC hU hCU (hcuff.2.2 C hC) h + have key : ∀ A : Set (Set Y), A.Finite → A ⊆ cuffs Y → ∃ G : Y ≃ₜ Y, + (∀ C ∈ A, ∀ z ∈ C, Covers ψ F α C z (G z)) ∧ + ∀ z ∈ bd Y, (∀ C ∈ A, z ∉ C) → G z = z := by + intro A hA + induction A, hA using Set.Finite.induction_on with + | empty => exact fun _ => ⟨Homeomorph.refl Y, by simp, fun _ _ _ => rfl⟩ + | @insert C A hnot hf ih => + intro hsub + obtain ⟨G, g1, g2⟩ := ih ((subset_insert _ _).trans hsub) + have hC : C ∈ cuffs Y := hsub (mem_insert _ _) + have hclosed : IsClosed (⋃₀ (cuffs Y \ {C})) := + (hcuff.2.1.subset sdiff_subset).isClosed_sUnion fun D hD => (hcuff.2.2 D + hD.1).isCompact.isClosed + have hCU : C ⊆ (⋃₀ (cuffs Y \ {C}))ᶜ := by + rintro z hz ⟨D, hD, hzD⟩ + exact Set.disjoint_left.mp (cuffs_disjoint hC hD.1 (fun h => hD.2 h.symm)) hz hzD + obtain ⟨Gc, h1, h2⟩ := step C hC _ hclosed.isOpen_compl hCU + have off : ∀ D ∈ cuffs Y, D ≠ C → ∀ z ∈ D, Gc z = z := fun D hD hne z hz => h2 z (fun h + => h ⟨D, ⟨hD, hne⟩, hz⟩) + refine ⟨G.trans Gc, ?_, ?_⟩ + · intro D hD z hz + rcases hD with rfl | hD + · have hzb : z ∈ bd Y := sUnion_cuffs (S := Y) ▸ (⟨D, hC, hz⟩ : z ∈ ⋃₀ cuffs Y) + have e1 : G z = z := g2 z hzb fun E hE hzE => by + have hne : E ≠ D := fun h => hnot (h ▸ hE) + exact Set.disjoint_left.mp (cuffs_disjoint (hsub (.inr hE)) hC hne) hzE hz + simpa only [Homeomorph.trans_apply, e1] using h1 z hz + · have hne : D ≠ C := fun h => hnot (h ▸ hD) + have h3 := g1 D hD z hz + have e1 : Gc (G z) = G z := off D (hsub (.inr hD)) hne _ h3.1 + simpa only [Homeomorph.trans_apply, e1] using h3 + · intro z hzb hzn + have e1 : G z = z := g2 z hzb fun E hE => hzn E (.inr hE) + have hz' : z ∈ ⋃₀ cuffs Y := (sUnion_cuffs (S := Y)).symm ▸ hzb + obtain ⟨D, hD, hzD⟩ := hz' + have hne : D ≠ C := fun h => hzn C (mem_insert _ _) (h ▸ hzD) + simp only [Homeomorph.trans_apply, e1] + exact off D hD hne z hzD + obtain ⟨G, h1, -⟩ := key _ hcuff.2.1 subset_rfl + exact ⟨G, h1⟩ + +/-- A homeomorphism that fixes the lifts descends along the cut. -/ +theorem exists_descend_cut [CompactSpace Y] (hψ : IsCutting ψ F) (G : Y ≃ₜ Y) (hG : ∀ z, ψ z ∈ F + → G z = z) : + ∃ γ : S ≃ₜ S, ∀ y, γ (ψ y) = ψ (G y) := by + have hq : IsQuotientMap ψ := hψ.1.isClosedMap.isQuotientMap hψ.1 hψ.2.1 + have aux : ∀ H : Y ≃ₜ Y, (∀ z, ψ z ∈ F → H z = z) → ∃ f : S → S, Continuous f ∧ ∀ y, f (ψ y) = ψ + (H y) := by + intro H hH + have e0 : ∀ x, ψ (surjInv hψ.2.1 x) = x := surjInv_eq hψ.2.1 + have e1 : ∀ y, ψ (H (surjInv hψ.2.1 (ψ y))) = ψ (H y) := by + intro y + by_cases h : ψ y ∈ F + · rw [hH y h, hH _ ((e0 (ψ y)).symm ▸ h), e0] + · have h' : ψ (surjInv hψ.2.1 (ψ y)) ∉ F := by + rw [e0] + exact h + rw [hψ.2.2.1 h' h (e0 (ψ y))] + refine ⟨fun x => ψ (H (surjInv hψ.2.1 x)), ?_, e1⟩ + rw [hq.continuous_iff] + have e2 : (fun x => ψ (H (surjInv hψ.2.1 x))) ∘ ψ = ψ ∘ H := funext e1 + rw [e2] + exact hψ.1.comp H.continuous + obtain ⟨f, c1, h1⟩ := aux G hG + obtain ⟨f', c2, h2⟩ := aux G.symm fun z hz => (G.symm_apply_eq).mpr (hG z hz).symm + refine ⟨{ + toFun := f + invFun := f' + left_inv := fun x => ?_ + right_inv := fun x => ?_ + continuous_toFun := c1 + continuous_invFun := c2 + }, h1⟩ + · obtain ⟨y, rfl⟩ := hψ.2.1 x + rw [h1, h2, G.symm_apply_apply] + · obtain ⟨y, rfl⟩ := hψ.2.1 x + rw [h2, h1, G.apply_symm_apply] + +end cut + +/-- `ParallelArcsStatement` for a connected surface. -/ +theorem parallel_conn {S : Type u} [TopologicalSpace S] [ConnectedSpace S] {F F' : Set S} {s t : S} + {α : S ≃ₜ S} (hS : IsSurface S) (hne : s ≠ t) + (hb : F' ∩ bd S = {s, t}) (hl : IsLineWithEnds F' s t) (hαF : α '' F = F') (hs : α s = s) + (ht : α t = t) (hα : HasNullSignature α) : + ∃ β : S ≃ₜ S, β '' F = F' ∧ ∀ x ∈ bd S, β x = x := by + have ht2 : T2Space S := hS.2.1 + have hF : IsClosed F' := hl.isCompact.isClosed + obtain ⟨Y, tY, t2Y, ψ, hY, hψ, -, -, -⟩ := exists_cut_arc hS hne hb hl + have hcY : CompactSpace Y := hY.1 + obtain ⟨G, hG⟩ := exists_cover hY hS hψ hF hb hα hs ht + have hbdY : ∀ z ∈ bd Y, ∃ C ∈ cuffs Y, z ∈ C := fun z hz => by + have hz' : z ∈ ⋃₀ cuffs Y := (sUnion_cuffs (S := Y)).symm ▸ hz + obtain ⟨C, hC, hzC⟩ := hz' + exact ⟨C, hC, hzC⟩ + have hfix : ∀ z, ψ z ∈ F' → G z = z := fun z hz => by + obtain ⟨C, hC, hzC⟩ := hbdY z (hψ.2.2.2.2 hz) + exact (hG C hC z hzC).2.1 hz + obtain ⟨γ, hγ⟩ := exists_descend_cut hψ G hfix + have fixF : ∀ x ∈ F', γ x = x := fun x hx => by + obtain ⟨y, rfl⟩ := hψ.2.1 x + rw [hγ, hfix y hx] + have onB : ∀ x ∈ bd S, γ x = α x := fun x hx => by + obtain ⟨y, rfl⟩ := hψ.2.1 x + by_cases h : ψ y ∈ F' + · have h1 : ψ y ∈ ({s, t} : Set S) := hb ▸ ⟨h, hx⟩ + rw [fixF _ h] + rcases h1 with h1 | h1 + · rw [h1, hs] + · rw [mem_singleton_iff.mp h1, ht] + · obtain ⟨C, hC, hzC⟩ := hbdY y (bd_lift hψ hF hx h) + rw [hγ] + exact (hG C hC y hzC).2.2 h + refine ⟨α.trans γ.symm, ?_, fun x hx => ?_⟩ + · ext w + constructor + · rintro ⟨x, hx, rfl⟩ + have h1 : α x ∈ F' := hαF ▸ mem_image_of_mem α hx + have h2 : γ.symm (α x) = α x := (γ.symm_apply_eq).mpr (fixF _ h1).symm + simpa only [Homeomorph.trans_apply, h2] using h1 + · intro hw + obtain ⟨x, hx, rfl⟩ := hαF.symm ▸ hw + have h2 : γ.symm (α x) = α x := (γ.symm_apply_eq).mpr (fixF _ hw).symm + exact ⟨x, hx, by simp only [Homeomorph.trans_apply, h2]⟩ + · simp only [Homeomorph.trans_apply] + exact (γ.symm_apply_eq).mpr (onB x hx).symm + +/-- **Parallel arcs.** Graph Minors VII, (3.2), claim (1), page 219. The route is the one the paper +suggests: cut along `F'` and +move the cuffs of the cut surface. Only the component of `s` is changed, since the rest of the +boundary is kept by the identity. -/ +theorem parallelArcs : ParallelArcsStatement.{u} := by + intro S _ F F' s t α hS hne hb hb' hl hl' hαF hs ht hα + have ht2 : T2Space S := hS.2.1 + have := hS.locallyConnected + have hW : IsClopen (connectedComponent s) := isClopen_connectedComponent + have hW1 : IsSurface (connectedComponent s) := isSurface_sub hS hW + have hc : ConnectedSpace (connectedComponent s) := isConnected_iff_connectedSpace.mp + isConnected_connectedComponent + have subOf : ∀ {L : Set S}, IsLineWithEnds L s t → L ⊆ connectedComponent s := fun {L} h => by + obtain ⟨a, ha, e, -, -⟩ := h.exists_arc + have hp : IsPreconnected L := e ▸ isPreconnected_range ha.1 + exact hp.subset_connectedComponent h.left_mem + have hsub := subOf hl + have hsub' := subOf hl' + have htW : t ∈ connectedComponent s := hsub hl.right_mem + have hsW : s ∈ connectedComponent s := mem_connectedComponent + have keep : ∀ (δ : S ≃ₜ S), δ s = s → ∀ x ∈ connectedComponent s, δ x ∈ connectedComponent s + := fun δ hδ x hx => + (isPreconnected_connectedComponent.image δ δ.continuous.continuousOn).subset_connectedComponent + ⟨s, hsW, hδ⟩ ⟨x, hx, rfl⟩ + have hsym : α.symm s = s := (α.symm_apply_eq).mpr hs.symm + let αW : connectedComponent s ≃ₜ connectedComponent s := α.subtype (p := + (· ∈ connectedComponent s)) (q := (· ∈ connectedComponent s)) + fun x => ⟨keep α hs x, fun h => by simpa using keep α.symm hsym _ h⟩ + have hαW : ∀ x, (αW x).1 = α x.1 := fun _ => rfl + have hbW : (Subtype.val ⁻¹' F' : Set (connectedComponent s)) ∩ bd (connectedComponent s) + = {⟨s, hsW⟩, ⟨t, htW⟩} := by + ext y + have h3 : y ∈ bd (connectedComponent s) ↔ y.1 ∈ bd S := mem_bd_sub hW.2 + have h4 := Set.ext_iff.mp hb' y.1 + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff, mem_preimage, h3, Subtype.ext_iff] + simpa using h4 + have hlW : IsLineWithEnds (Subtype.val ⁻¹' F' : Set (connectedComponent s)) ⟨s, hsW⟩ ⟨t, htW⟩ + := by + obtain ⟨u', v', e1, e2, h5⟩ := hl'.pull (j := (Subtype.val : connectedComponent s + → S)) IsEmbedding.subtypeVal (by rwa [Subtype.range_coe]) + have e3 : u' = ⟨s, hsW⟩ := Subtype.ext e1 + have e4 : v' = ⟨t, htW⟩ := Subtype.ext e2 + rwa [e3, e4] at h5 + have hnull : HasNullSignature αW := by + intro C φ hC + have hcuff := cuff_statement.{u} S hS + have hO : IsOArc (Subtype.val '' C : Set S) := ⟨hatC φ⟩ + have hbC : (Subtype.val '' C : Set S) ⊆ bd S := by + rintro _ ⟨y, hy, rfl⟩ + obtain ⟨x, hx, rfl⟩ := hC + exact (mem_bd_sub hW.2).mp (connectedComponentIn_subset _ _ hy) + have hx0 : (hatC φ 1).1 ∈ (Subtype.val '' C : Set S) := (hatC φ 1).2 + have hsubC := hO.isPreconnected.subset_connectedComponentIn hx0 hbC + have hD : connectedComponentIn (bd S) (hatC φ 1).1 ∈ cuffs S := ⟨_, hbC hx0, rfl⟩ + obtain ⟨φD⟩ := hcuff.2.2 _ hD + have heq := oarc_eq φD hO hsubC + obtain ⟨h, hp, hh⟩ := hα _ (hatC φ) (heq ▸ hD) + exact ⟨h, hp, fun x => Subtype.ext (hh x)⟩ + have himg : αW '' (Subtype.val ⁻¹' F) = (Subtype.val ⁻¹' F' : Set (connectedComponent s)) := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + exact hαF ▸ mem_image_of_mem α hx + · intro hy + obtain ⟨x, hx, e⟩ := hαF.symm ▸ (show y.1 ∈ F' from hy) + exact ⟨⟨x, hsub hx⟩, hx, Subtype.ext e⟩ + obtain ⟨βW, h1, h2⟩ := parallel_conn hW1 (s := ⟨s, hsW⟩) (t := ⟨t, htW⟩) (fun he => hne + (congrArg Subtype.val he)) hbW hlW himg + (show αW ⟨s, hsW⟩ = ⟨s, hsW⟩ from Subtype.ext hs) (show αW ⟨t, htW⟩ + = ⟨t, htW⟩ from Subtype.ext ht) hnull + obtain ⟨β, h3, h4⟩ := exists_extend hW βW + refine ⟨β, ?_, fun x hx => ?_⟩ + · have e1 : Subtype.val '' (Subtype.val ⁻¹' F : Set (connectedComponent s)) = F := by + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hsub] + have e2 : Subtype.val '' (Subtype.val ⁻¹' F' : Set (connectedComponent s)) = F' := by + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hsub'] + rw [← e1, ← e2, ← h1, image_image, image_image] + exact image_congr fun y _ => h3 y + · by_cases hxW : x ∈ connectedComponent s + · have := h3 ⟨x, hxW⟩ + rw [h2 ⟨x, hxW⟩ ((mem_bd_sub hW.2).mpr hx)] at this + exact this + · exact h4 x hxW + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutPieces.lean b/LeanPool/GraphMinor/Surface/CutPieces.lean new file mode 100644 index 0000000000..c9c9a6a1b1 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutPieces.lean @@ -0,0 +1,337 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.HoleLoop + +/-! +# Placing the sides of a word on a cuff + +A word has a free side that goes once around a cuff. We move the cuff by `exists_move_loop` and cut +the side into one, two +or four sides, so that the new sides have any given monotone lifts as parameters (`exists_pieces1`, +`exists_pieces2`, +`exists_pieces4`). The lemma `presents_glue` passes from a presentation of a surface that has been +cut to a presentation +of the surface before cutting: two free sides of the word get the same label. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function + +universe uu + +/-- Two maps of `[0, 1]` one after the other. -/ +noncomputable def conc2 {T : Type*} (m m' : ℝ → T) (x : ℝ) : T := if x ≤ 1 / 2 then m + (2 * x) else m' (2 * x - 1) + +theorem conc2_left {T : Type*} {m m' : ℝ → T} {x : ℝ} (hx : x ∈ Icc (0 : ℝ) 1) : conc2 m m' (x / 2) + = m x := by + unfold conc2 + rw [ite_eq_left (by linarith [hx.2])] + congr 1 + ring + +theorem conc2_right {T : Type*} {m m' : ℝ → T} (h : m 1 = m' 0) {x : ℝ} (hx : x ∈ Icc + (0 : ℝ) 1) : conc2 m m' ((1 + x) / 2) = m' x := by + unfold conc2 + by_cases h1 : (1 + x) / 2 ≤ 1 / 2 + · have hx0 : x = 0 := le_antisymm (by linarith) hx.1 + subst hx0 + rw [ite_eq_left h1] + norm_num + exact h + · rw [ite_eq_right h1] + congr 1 + ring + +theorem conc2_zero {T : Type*} {m m' : ℝ → T} : conc2 m m' 0 = m 0 := by + have := conc2_left (m := m) (m' := m') (x := 0) (by simp) + simpa using this + +theorem conc2_one {T : Type*} {m m' : ℝ → T} (h : m 1 = m' 0) : conc2 m m' 1 = m' 1 := by + have := conc2_right h (x := 1) (by simp) + simpa using this + +theorem continuousOn_conc2 {T : Type*} [TopologicalSpace T] {m m' : ℝ → T} (hm : ContinuousOn m + (Icc 0 1)) (hm' : ContinuousOn m' (Icc 0 1)) (h : m 1 = m' 0) : + ContinuousOn (conc2 m m') (Icc 0 1) := by + have e : Icc (0 : ℝ) 1 = Icc 0 (1 / 2) ∪ Icc (1 / 2) 1 := (Icc_union_Icc_eq_Icc (by norm_num) + (by norm_num)).symm + rw [e] + refine ContinuousOn.union_of_isClosed ?_ ?_ isClosed_Icc isClosed_Icc + · refine (hm.comp (by fun_prop) fun x hx => ⟨by linarith [hx.1], + by linarith [hx.2]⟩ : ContinuousOn (fun x => m (2 * x)) _).congr fun x hx => ?_ + exact ite_eq_left hx.2 + · refine (hm'.comp (by fun_prop) fun x hx => ⟨by linarith [hx.1], + by linarith [hx.2]⟩ : ContinuousOn (fun x => m' (2 * x - 1)) _).congr fun x hx => ?_ + unfold conc2 + split_ifs with h1 + · have hx0 : x = 1 / 2 := le_antisymm h1 hx.1 + subst hx0 + norm_num + exact h + · rfl + +theorem strictMonoOn_conc2 {m m' : ℝ → ℝ} (hm : StrictMonoOn m (Icc 0 1)) (hm' : StrictMonoOn m' + (Icc 0 1)) (h : m 1 = m' 0) : + StrictMonoOn (conc2 m m') (Icc 0 1) := by + intro x hx y hy hxy + unfold conc2 + have h0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have h1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + by_cases hx2 : x ≤ 1 / 2 + · by_cases hy2 : y ≤ 1 / 2 + · rw [ite_eq_left hx2, ite_eq_left hy2] + exact hm ⟨by linarith [hx.1], by linarith⟩ ⟨by linarith [hy.1], by linarith⟩ (by linarith) + · rw [ite_eq_left hx2, ite_eq_right hy2] + push Not at hy2 + have h3 : m (2 * x) ≤ m 1 := hm.monotoneOn ⟨by linarith [hx.1], by linarith⟩ h1 (by linarith) + have h4 : m' 0 < m' (2 * y - 1) := hm' h0 ⟨by linarith, by linarith [hy.2]⟩ (by linarith) + linarith + · have hy2 : ¬ y ≤ 1 / 2 := fun h2 => hx2 (by linarith) + rw [ite_eq_right hx2, ite_eq_right hy2] + push Not at hx2 hy2 + exact hm' ⟨by linarith, by linarith [hx.2]⟩ ⟨by linarith, by linarith [hy.2]⟩ (by linarith) + +theorem SideVal.congr {T : Type*} {W : ℕ → List Letter} {f : ℕ × ℂ → T} {k : ℕ} {ρ ρ' : ℝ → T} + (h : SideVal W f k ρ) + (he : ∀ u ∈ Icc (0 : ℝ) 1, ρ u = ρ' u) : SideVal W f k ρ' := by + obtain ⟨i, p, h1, h2⟩ := h + exact ⟨i, p, h1, fun u hu => (h2 u hu).trans (he u hu)⟩ + +theorem presents_homeo_comp {W : ℕ → List Letter} {T : Type*} [TopologicalSpace T] {g : ℕ × ℂ → T} + (hg : Presents W g) + (α : T ≃ₜ T) : Presents W (α ∘ g) := presents_comp hg α + +theorem SideVal.comp {T T' : Type*} {W : ℕ → List Letter} {f : ℕ × ℂ → T} {k : ℕ} {ρ : ℝ → T} + (h : SideVal W f k ρ) + (α : T → T') : SideVal W (α ∘ f) k (α ∘ ρ) := by + obtain ⟨i, p, h1, h2⟩ := h + exact ⟨i, p, h1, fun u hu => congrArg α (h2 u hu)⟩ + +section pieces + +variable {S : Type uu} [TopologicalSpace S] + +/-- A cuff moves, and a side that goes around it gets a new parameter. -/ +theorem exists_pieces1 (hS : IsSurface S) {C U : Set S} (hC : IsCuff C) (hU : IsOpen U) + (hCU : C ⊆ U) (φ : Circle ≃ₜ C) + {W : ℕ → List Letter} {g : ℕ × ℂ → S} (hg : Presents W g) {p : ℕ} (hρ : SideVal W g p fun u => + (φ (ee u)).1) + {τ : ℝ → ℝ} (hc : ContinuousOn τ (Icc 0 1)) (hm : StrictMonoOn τ (Icc 0 1)) (h1 : τ 1 + = τ 0 + 1) : + ∃ g', Presents W g' ∧ SideVal W g' p (fun u => (φ (ee (τ u))).1) ∧ + ∀ k ρ', SideVal W g k ρ' → (∀ u ∈ Icc (0 : ℝ) 1, ρ' u ∉ U) → SideVal W g' k ρ' := by + obtain ⟨α, h2, h3⟩ := exists_move_loop hS hC hU hCU φ hc hm h1 + refine ⟨α ∘ g, presents_comp hg α, (hρ.comp α).congr fun u hu => h2 u hu, fun k ρ' h4 h5 => ?_⟩ + exact (h4.comp α).congr fun u hu => h3 _ (h5 u hu) + +variable [T2Space S] + +/-- A side that goes around a cuff is replaced by two sides. -/ +theorem exists_pieces2 (hS : IsSurface S) {C U : Set S} (hC : IsCuff C) (hU : IsOpen U) + (hCU : C ⊆ U) (φ : Circle ≃ₜ C) + {A B : List Letter} {p q : ℕ} (hpq : p ≠ q) (hp : NoLab (B ++ A) p) (hq : NoLab + (B ++ A) q) {g : ℕ × ℂ → S} + (hg : Presents (sW (A ++ (p, true) :: B)) g) (hρ : SideVal (sW (A ++ (p, true) :: B)) g p fun u + => (φ (ee u)).1) + {m m' : ℝ → ℝ} (hc : ContinuousOn m (Icc 0 1)) (hc' : ContinuousOn m' (Icc 0 1)) + (hm : StrictMonoOn m (Icc 0 1)) + (hm' : StrictMonoOn m' (Icc 0 1)) (h1 : m 1 = m' 0) (h2 : m' 1 = m 0 + 1) : + ∃ g', Presents (sW (A ++ (p, true) :: (q, true) :: B)) g' ∧ + SideVal (sW (A ++ (p, true) :: (q, true) :: B)) g' p (fun u => (φ (ee (m u))).1) ∧ + SideVal (sW (A ++ (p, true) :: (q, true) :: B)) g' q (fun u => (φ (ee (m' u))).1) ∧ + ∀ k, k ≠ p → k ≠ q → ∀ ρ', SideVal (sW (A ++ (p, true) :: B)) g k ρ' → (∀ u ∈ Icc + (0 : ℝ) 1, ρ' u ∉ U) → + SideVal (sW (A ++ (p, true) :: (q, true) :: B)) g' k ρ' := by + obtain ⟨g₁, h3, h4, h5⟩ := exists_pieces1 hS hC hU hCU φ hg hρ (continuousOn_conc2 hc hc' h1) + (strictMonoOn_conc2 hm hm' h1) + (by rw [conc2_zero, conc2_one h1, h2]) + obtain ⟨g₂, h6, h7, h8, h9⟩ := exists_split hpq hp hq h3 h4 + refine ⟨g₂, h6, h7.congr fun u hu => ?_, h8.congr fun u hu => ?_, + fun k hk hk' ρ' h10 h11 => h9 k hk hk' ρ' (h5 k ρ' h10 h11)⟩ + · simp only [conc2_left hu] + · simp only [conc2_right h1 hu] + +/-- A side that goes around a cuff is replaced by four sides. -/ +theorem exists_pieces4 (hS : IsSurface S) {C U : Set S} (hC : IsCuff C) (hU : IsOpen U) + (hCU : C ⊆ U) (φ : Circle ≃ₜ C) + {A B : List Letter} {p q₁ q₂ q₃ : ℕ} (h12 : p ≠ q₁) (h13 : p ≠ q₂) (h14 : p ≠ q₃) + (h23 : q₁ ≠ q₂) (h24 : q₁ ≠ q₃) (h34 : q₂ ≠ q₃) + (hp : NoLab (B ++ A) p) (hq₁ : NoLab (B ++ A) q₁) (hq₂ : NoLab (B ++ A) q₂) (hq₃ : NoLab + (B ++ A) q₃) {g : ℕ × ℂ → S} + (hg : Presents (sW (A ++ (p, true) :: B)) g) (hρ : SideVal (sW (A ++ (p, true) :: B)) g p fun u + => (φ (ee u)).1) + {m₀ m₁ m₂ m₃ : ℝ → ℝ} (c0 : ContinuousOn m₀ (Icc 0 1)) (c1 : ContinuousOn m₁ (Icc 0 1)) + (c2 : ContinuousOn m₂ (Icc 0 1)) + (c3 : ContinuousOn m₃ (Icc 0 1)) (s0 : StrictMonoOn m₀ (Icc 0 1)) (s1 : StrictMonoOn m₁ + (Icc 0 1)) + (s2 : StrictMonoOn m₂ (Icc 0 1)) (s3 : StrictMonoOn m₃ (Icc 0 1)) (e1 : m₀ 1 = m₁ 0) (e2 : m₁ 1 + = m₂ 0) (e3 : m₂ 1 = m₃ 0) + (e4 : m₃ 1 = m₀ 0 + 1) : + ∃ g', Presents (sW (A ++ (p, true) :: (q₁, true) :: (q₂, true) :: (q₃, true) :: B)) g' ∧ + SideVal (sW (A ++ (p, true) :: (q₁, true) :: (q₂, true) :: (q₃, true) :: B)) g' p (fun u => + (φ (ee (m₀ u))).1) ∧ + SideVal (sW (A ++ (p, true) :: (q₁, true) :: (q₂, true) :: (q₃, true) :: B)) g' q₁ (fun u => + (φ (ee (m₁ u))).1) ∧ + SideVal (sW (A ++ (p, true) :: (q₁, true) :: (q₂, true) :: (q₃, true) :: B)) g' q₂ (fun u => + (φ (ee (m₂ u))).1) ∧ + SideVal (sW (A ++ (p, true) :: (q₁, true) :: (q₂, true) :: (q₃, true) :: B)) g' q₃ (fun u => + (φ (ee (m₃ u))).1) := by + have hl : conc2 m₀ m₁ 1 = conc2 m₂ m₃ 0 := by rw [conc2_zero, conc2_one e1, e2] + obtain ⟨g₁, h3, h4, -⟩ := exists_pieces1 hS hC hU hCU φ hg hρ + (continuousOn_conc2 (continuousOn_conc2 c0 c1 e1) (continuousOn_conc2 c2 c3 e3) hl) + (strictMonoOn_conc2 (strictMonoOn_conc2 s0 s1 e1) (strictMonoOn_conc2 s2 s3 e3) hl) + (by rw [conc2_zero, conc2_zero, conc2_one hl, conc2_one e3, e4]) + obtain ⟨g₂, h6, h7, h8, -⟩ := exists_split (q := q₂) h13 hp hq₂ h3 h4 + have n1 : NoLab (((q₂, true) :: B) ++ A) p := noLab_append.mpr ⟨noLab_cons.mpr ⟨h13.symm, + (noLab_append.mp hp).1⟩, (noLab_append.mp hp).2⟩ + have n2 : NoLab (((q₂, true) :: B) ++ A) q₁ := noLab_append.mpr ⟨noLab_cons.mpr ⟨h23.symm, + (noLab_append.mp hq₁).1⟩, (noLab_append.mp hq₁).2⟩ + obtain ⟨g₃, h9, h10, h11, h12'⟩ := exists_split (A := A) (B := (q₂, true) :: B) (q + := q₁) h12 n1 n2 h6 h7 + have h8' := h12' q₂ (Ne.symm h13) (Ne.symm h23) _ h8 + have e5 : A ++ (p, true) :: (q₁, true) :: (q₂, true) :: B = (A ++ [(p, true), (q₁, true)]) ++ + (q₂, true) :: B := by simp + rw [e5] at h9 h8' + have n3 : NoLab (B ++ (A ++ [(p, true), (q₁, true)])) q₂ := noLab_append.mpr ⟨(noLab_append.mp + hq₂).1, + noLab_append.mpr ⟨(noLab_append.mp hq₂).2, noLab_cons.mpr ⟨h13, noLab_cons.mpr ⟨h23, + noLab_nil⟩⟩⟩⟩ + have n4 : NoLab (B ++ (A ++ [(p, true), (q₁, true)])) q₃ := noLab_append.mpr ⟨(noLab_append.mp + hq₃).1, + noLab_append.mpr ⟨(noLab_append.mp hq₃).2, noLab_cons.mpr ⟨h14, noLab_cons.mpr ⟨h24, + noLab_nil⟩⟩⟩⟩ + rw [e5] at h10 h11 + obtain ⟨g₄, h13', h14', h15, h16⟩ := exists_split h34 n3 n4 h9 h8' + have e6 : (A ++ [(p, true), (q₁, true)]) ++ (q₂, true) :: (q₃, true) :: B = A ++ (p, true) :: + (q₁, true) :: (q₂, true) :: (q₃, true) :: B := by simp + rw [e6] at h13' h14' h15 h16 + refine ⟨g₄, h13', (h16 p h13 h14 _ h10).congr fun u hu => ?_, (h16 q₁ h23 h24 _ h11).congr fun u + hu => ?_, + h14'.congr fun u hu => ?_, h15.congr fun u hu => ?_⟩ + · have h0 : u / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [hu.1], by linarith [hu.2]⟩ + simp only [conc2_left h0, conc2_left hu] + · have h0 : (1 + u) / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [hu.1], by linarith [hu.2]⟩ + simp only [conc2_left h0, conc2_right e1 hu] + · have h0 : u / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [hu.1], by linarith [hu.2]⟩ + simp only [conc2_right hl h0, conc2_left hu] + · have h0 : (1 + u) / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [hu.1], by linarith [hu.2]⟩ + simp only [conc2_right hl h0, conc2_right e3 hu] + +end pieces + +/-- Identifying a free side with another free side of a family, by a map that glues them. -/ +theorem presents_glue {Y S : Type*} [TopologicalSpace Y] [TopologicalSpace S] {W W₁ : ℕ + → List Letter} {g : ℕ × ℂ → Y} {ψ : Y → S} + (hg : Presents W g) (hψ : Continuous ψ) (hsurj : Surjective ψ) {i₀ q₀ i₁ p₁ p q : ℕ} {σ ε₀ ε₁ : + Bool} + (hW : ∀ i n, (i, n) ≠ (i₀, q₀) → (W₁ i)[n]? = (W i)[n]?) (hq0 : (W i₀)[q₀]? = some (q, ε₀)) + (hq1 : (W₁ i₀)[q₀]? = some (p, σ)) (hp1 : (W i₁)[p₁]? = some (p, ε₁)) (hne : (i₁, p₁) ≠ + (i₀, q₀)) + (hlen : ∀ i, (W₁ i).length = (W i).length) + (hfq : ∀ j m e, (W j)[m]? = some (q, e) → (j, m) = (i₀, q₀)) (hfp : ∀ j m e, (W j)[m]? = some + (p, e) → (j, m) = (i₁, p₁)) + (hmatch : ∀ t ∈ Icc (0 : ℝ) 1, ψ (g (i₁, sdPt (W i₁).length p₁ ε₁ t)) = ψ (g (i₀, sdPt + (W i₀).length q₀ σ t))) + (hfib : ∀ a ∈ Dsk W, ∀ b ∈ Dsk W, ψ (g a) = ψ (g b) → g a ≠ g b → ∃ t ∈ Icc (0 : ℝ) 1, + (g a = g (i₁, sdPt (W i₁).length p₁ ε₁ t) ∧ g b = g (i₀, sdPt (W i₀).length q₀ σ t)) ∨ + (g b = g (i₁, sdPt (W i₁).length p₁ ε₁ t) ∧ g a = g (i₀, sdPt (W i₀).length q₀ σ t))) : + Presents W₁ (ψ ∘ g) := by + classical + have hDs : Dsk W₁ = Dsk W := by + ext a + simp only [Dsk, mem_ofPred_eq, ne_eq, ← List.length_eq_zero_iff, hlen] + have hSt : ∀ a b, Stp W a b → Stp W₁ a b := by + rintro _ _ ⟨i, j, n, m, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ + have hk : k ≠ q := by + rintro rfl + exact h3 ((hfq i n ε h1).trans (hfq j m ε' h2).symm) + have h4 : (i, n) ≠ (i₀, q₀) := fun he => by + obtain ⟨rfl, rfl⟩ := Prod.mk.inj he + rw [hq0] at h1 + exact hk (Prod.mk.inj (Option.some.inj h1)).1.symm + have h5 : (j, m) ≠ (i₀, q₀) := fun he => by + obtain ⟨rfl, rfl⟩ := Prod.mk.inj he + rw [hq0] at h2 + exact hk (Prod.mk.inj (Option.some.inj h2)).1.symm + exact ⟨i, j, n, m, k, ε, ε', t, by rw [hW i n h4]; exact h1, by rw [hW j m h5]; exact h2, h3, + ht, by rw [hlen], by rw [hlen]⟩ + have hmem : ∀ {i n k ε} (t : ℝ), (W i)[n]? = some (k, ε) → (i, sdPt (W i).length n ε t) ∈ Dsk W + := fun t h => + ⟨fun he => by simp [he] at h, (norm_per _ _).le⟩ + have hSt' : ∀ a b, Stp W₁ a b → ψ (g a) = ψ (g b) := by + rintro _ _ ⟨i, j, n, m, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ + rw [hlen, hlen] + by_cases h4 : (i, n) = (i₀, q₀) + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj h4 + rw [hq1] at h1 + obtain ⟨rfl, rfl⟩ := Prod.mk.inj (Option.some.inj h1) + have h5 : (j, m) ≠ (i, n) := fun he => h3 he.symm + rw [hW j m h5] at h2 + obtain ⟨rfl, rfl⟩ := Prod.mk.inj (hfp j m ε' h2) + rw [hp1] at h2 + obtain rfl : ε₁ = ε' := (Prod.mk.inj (Option.some.inj h2)).2 + exact (hmatch t ht).symm + by_cases h5 : (j, m) = (i₀, q₀) + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj h5 + rw [hq1] at h2 + obtain ⟨rfl, rfl⟩ := Prod.mk.inj (Option.some.inj h2) + rw [hW i n h4] at h1 + obtain ⟨rfl, rfl⟩ := Prod.mk.inj (hfp i n ε h1) + rw [hp1] at h1 + obtain rfl : ε₁ = ε := (Prod.mk.inj (Option.some.inj h1)).2 + exact hmatch t ht + · rw [hW i n h4] at h1 + rw [hW j m h5] at h2 + have h6 := (hg.2.2 _ (hmem t h1) _ (hmem t h2)).mpr (.rel _ _ ⟨i, j, n, m, k, ε, ε', t, h1, + h2, h3, ht, rfl, rfl⟩) + rw [h6] + have hPR : ∀ a b, PRel W a b → PRel W₁ a b := by + intro a b h + induction h with + | rel x y hs => exact .rel _ _ (hSt _ _ hs) + | refl _ => exact .refl _ + | symm _ _ _ ih => exact .symm _ _ ih + | trans _ _ _ _ _ h1 h2 => exact .trans _ _ _ h1 h2 + have hPR' : ∀ a b, PRel W₁ a b → ψ (g a) = ψ (g b) := by + intro a b h + induction h with + | rel x y hs => exact hSt' _ _ hs + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + have hstep : ∀ t ∈ Icc (0 : ℝ) 1, Stp W₁ (i₁, sdPt (W i₁).length p₁ ε₁ t) (i₀, sdPt + (W i₀).length q₀ σ t) := by + intro t ht + refine ⟨i₁, i₀, p₁, q₀, p, ε₁, σ, t, by rw [hW _ _ hne]; exact hp1, hq1, hne, ht, by rw [hlen], + by rw [hlen]⟩ + have hD0 := hmem (i := i₀) 0 hq0 + refine ⟨hψ.comp_continuousOn (hDs ▸ hg.1), ?_, fun a ha b hb => ?_⟩ + · rw [hDs, image_comp, hg.2.1, image_univ, hsurj.range_eq] + · rw [hDs] at ha hb + refine ⟨fun he => ?_, hPR' a b⟩ + by_cases h1 : g a = g b + · exact hPR _ _ ((hg.2.2 _ ha _ hb).mp h1) + obtain ⟨t, ht, h2⟩ := hfib a ha b hb he h1 + have hA := hmem (i := i₁) t hp1 + have hB : (i₀, sdPt (W i₀).length q₀ σ t) ∈ Dsk W := ⟨hD0.1, (norm_per _ _).le⟩ + rcases h2 with ⟨h3, h4⟩ | ⟨h3, h4⟩ + · have c1 := hPR _ _ ((hg.2.2 _ ha _ hA).mp h3) + have c2 := hPR _ _ ((hg.2.2 _ hb _ hB).mp h4) + exact .trans _ _ _ c1 (.trans _ _ _ (.rel _ _ (hstep t ht)) (.symm _ _ c2)) + · have c1 := hPR _ _ ((hg.2.2 _ hb _ hA).mp h3) + have c2 := hPR _ _ ((hg.2.2 _ ha _ hB).mp h4) + exact .trans _ _ _ c2 (.trans _ _ _ (.symm _ _ (.rel _ _ (hstep t ht))) (.symm _ _ c1)) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutRetract.lean b/LeanPool/GraphMinor/Surface/CutRetract.lean new file mode 100644 index 0000000000..cb494d4fb7 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutRetract.lean @@ -0,0 +1,263 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutNull +public import LeanPool.GraphMinor.Surface.PlaneLog +public import LeanPool.GraphMinor.Surface.DiscsInSurface + +/-! +# Pushing a disc minus a point onto its boundary + +If a homotopy misses a point of a disc, then we can push it out of the disc onto the boundary. We +use this when an `O`-arc bounds +a disc on one side, to move a null-homotopy to the other side of the `O`-arc. If that side is also a +disc and the homotopy misses +a point of it, then the identity of the circle would be null-homotopic, which is false. + +The map that pushes the disc onto the circle is a Möbius map that moves the point to the centre, +then the radial projection, then +the inverse Möbius map. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric +open scoped ComplexConjugate + +universe u v + +section mobius + +/-- A Möbius map of the disc. The map `mob (-a)` moves `a` to `0`, and `mob a` is its inverse. -/ +noncomputable def mob (a w : ℂ) : ℂ := (w + a) / (1 + conj a * w) + +theorem mob_den_ne {a w : ℂ} (ha : ‖a‖ < 1) (hw : ‖w‖ ≤ 1) : 1 + conj a * w ≠ 0 := by + intro h + have h1 : conj a * w = -1 := by linear_combination h + have h2 : ‖conj a * w‖ = 1 := by + rw [h1] + simp + rw [norm_mul, Complex.norm_conj] at h2 + nlinarith [norm_nonneg a, norm_nonneg w] + +theorem norm_mob {a w : ℂ} (ha : ‖a‖ < 1) (hw : ‖w‖ = 1) : ‖mob a w‖ = 1 := by + have hd := mob_den_ne ha hw.le + have hww : w * conj w = 1 := by + rw [Complex.mul_conj, Complex.normSq_eq_norm_sq, hw] + simp + have e : 1 + conj a * w = w * conj (w + a) := by + rw [map_add] + linear_combination -hww + have h3 : ‖w + a‖ ≠ 0 := by + intro h + rw [norm_eq_zero] at h + rw [e, h, map_zero, mul_zero] at hd + exact hd rfl + rw [mob, norm_div, e, norm_mul, hw, one_mul, Complex.norm_conj, div_self h3] + +theorem mob_mob {a w : ℂ} (ha : ‖a‖ < 1) (hw : ‖w‖ ≤ 1) : mob a (mob (-a) w) = w := by + have hd := mob_den_ne (a := -a) (by simpa using ha) hw + rw [map_neg] at hd + have h2 : 1 - conj a * a ≠ 0 := by + have := mob_den_ne (a := -a) (w := a) (by simpa using ha) ha.le + rwa [map_neg, neg_mul, ← sub_eq_add_neg] at this + unfold mob + rw [map_neg] + generalize conj a = b at * + have e1 : (w + -a) / (1 + -b * w) + a = w * ((1 - b * a) / (1 + -b * w)) := by + rw [← mul_div_assoc, eq_div_iff hd, add_mul, div_mul_cancel₀ _ hd] + ring + have e2 : 1 + b * ((w + -a) / (1 + -b * w)) = (1 - b * a) / (1 + -b * w) := by + rw [eq_div_iff hd, add_mul, mul_assoc, div_mul_cancel₀ _ hd] + ring + rw [e1, e2, mul_div_assoc, div_self (div_ne_zero h2 hd), mul_one] + +theorem contOn_mob {a : ℂ} (ha : ‖a‖ < 1) : ContinuousOn (mob a) (closedBall 0 1) := + ContinuousOn.div (by fun_prop) (by fun_prop) fun w hw => mob_den_ne ha + (mem_closedBall_zero_iff.mp hw) + +theorem mob_neg_ne {a w : ℂ} (ha : ‖a‖ < 1) (hw : ‖w‖ ≤ 1) (hne : w ≠ a) : mob (-a) w ≠ 0 := + div_ne_zero (fun h => hne (by linear_combination h)) (mob_den_ne (by simpa using ha) hw) + +/-- The map that pushes the disc minus the point `a` onto the circle. -/ +noncomputable def retC (a w : ℂ) : ℂ := mob a (mob (-a) w / ‖mob (-a) w‖) + +theorem norm_retC {a w : ℂ} (ha : ‖a‖ < 1) (hw : ‖w‖ ≤ 1) (hne : w ≠ a) : ‖retC a w‖ = 1 := by + refine norm_mob ha ?_ + rw [norm_div, Complex.norm_real, norm_norm, div_self (norm_ne_zero_iff.mpr + (mob_neg_ne ha hw hne))] + +theorem retC_fix {a w : ℂ} (ha : ‖a‖ < 1) (hw : ‖w‖ = 1) : retC a w = w := by + have ha' : ‖-a‖ < 1 := by simpa using ha + rw [retC, norm_mob ha' hw] + simp only [Complex.ofReal_one, div_one] + exact mob_mob ha hw.le + +theorem contOn_retC {a : ℂ} (ha : ‖a‖ < 1) : ContinuousOn (retC a) (closedBall 0 1 \ {a}) := by + have ha' : ‖-a‖ < 1 := by simpa using ha + have h1 : ContinuousOn (mob (-a)) (closedBall 0 1 \ {a}) := (contOn_mob ha').mono sdiff_subset + have h2 : ContinuousOn (fun w => mob (-a) w / ‖mob (-a) w‖) (closedBall 0 1 \ {a}) := by + refine h1.div (Complex.continuous_ofReal.comp_continuousOn h1.norm) fun w hw => ?_ + have := mob_neg_ne ha (mem_closedBall_zero_iff.mp hw.1) hw.2 + exact Complex.ofReal_ne_zero.mpr (norm_ne_zero_iff.mpr this) + refine (contOn_mob ha).comp h2 fun w hw => ?_ + have := mob_neg_ne ha (mem_closedBall_zero_iff.mp hw.1) hw.2 + rw [mem_closedBall_zero_iff, norm_div, Complex.norm_real, norm_norm, + div_self (norm_ne_zero_iff.mpr this)] + +/-- A disc minus an inner point can be pushed onto the boundary. -/ +theorem exists_ret {T : Type u} [TopologicalSpace T] (e : T ≃ₜ closedBall (0 : ℂ) 1) {t : T} + (ht : t ∉ bd T) : + ∃ R : T → T, ContinuousOn R {t}ᶜ ∧ (∀ x, x ≠ t → R x ∈ bd T) ∧ ∀ x ∈ bd T, R x = x := by + have hb : ∀ x : T, x ∈ bd T ↔ ‖(e x).1‖ = 1 := by + intro x + have h1 := image_bd_homeomorph e + have h2 := isClosedDisc_closedBall.2 + rw [discBd] at h2 + constructor + · intro hx + have h3 : (e x) ∈ bd (closedBall (0 : ℂ) 1) := h1 ▸ mem_image_of_mem _ hx + have h4 : (e x).1 ∈ sphere (0 : ℂ) 1 := h2 ▸ mem_image_of_mem _ h3 + simpa using h4 + · intro hx + have h4 : (e x).1 ∈ Subtype.val '' bd (closedBall (0 : ℂ) 1) := h2 ▸ (by simpa using hx) + obtain ⟨y, hy, he⟩ := h4 + rw [← h1] at hy + obtain ⟨x', hx', rfl⟩ := hy + rwa [← e.injective (Subtype.ext he)] + classical + have ha : ‖(e t).1‖ < 1 := lt_of_le_of_ne (mem_closedBall_zero_iff.mp (e t).2) (mt (hb t).mpr ht) + have hne : ∀ x, x ≠ t → (e x).1 ≠ (e t).1 := fun x hx he => hx (e.injective (Subtype.ext he)) + have hn : ∀ x, ‖(e x).1‖ ≤ 1 := fun x => mem_closedBall_zero_iff.mp (e x).2 + have hm : ∀ x (h : x ≠ t), retC (e t).1 (e x).1 ∈ closedBall (0 : ℂ) 1 := fun x h => + mem_closedBall_zero_iff.mpr (norm_retC ha (hn x) (hne x h)).le + let r : T → closedBall (0 : ℂ) 1 := fun x => if h : x = t then e t else ⟨retC (e t).1 + (e x).1, hm x h⟩ + have hr : ∀ x (h : x ≠ t), r x = ⟨retC (e t).1 (e x).1, hm x h⟩ := fun x h + => by simp only [r, h, dite_false] + refine ⟨fun x => e.symm (r x), ?_, fun x hx => ?_, fun x hx => ?_⟩ + · refine e.symm.continuous.comp_continuousOn ?_ + rw [IsInducing.subtypeVal.continuousOn_iff] + have h1 : ContinuousOn (fun x : T => retC (e t).1 (e x).1) {t}ᶜ := + (contOn_retC ha).comp (continuous_subtype_val.comp e.continuous).continuousOn fun x hx + => ⟨(e x).2, hne x hx⟩ + exact h1.congr fun x hx => by + change (r x).1 = _ + rw [hr x hx] + · rw [hb, e.apply_symm_apply, hr x hx] + exact norm_retC ha (hn x) (hne x hx) + · have hxt : x ≠ t := fun he => ht (he ▸ hx) + change e.symm (r x) = x + rw [e.symm_apply_eq, hr x hxt] + exact Subtype.ext (retC_fix ha ((hb x).mp hx)) + +end mobius + +section circle + +/-- The identity map of the circle is not null-homotopic. -/ +theorem circle_not_null (G : C(Circle × unitInterval, Circle)) {c : Circle} (h0 : ∀ x, G (x, 0) + = x) (h1 : ∀ x, G (x, 1) = c) : False := by + have hc : (c : ℂ) ≠ 0 := Circle.coe_ne_zero c + let H' : C(unitInterval × Circle, ℂ) := ⟨fun p => (G (p.2, unitInterval.symm p.1) : ℂ) / c, by + fun_prop⟩ + obtain ⟨g, hg, -⟩ := exists_log_of_homotopy H' (fun a => by simp [H', h1, hc]) + (fun p => div_ne_zero (Circle.coe_ne_zero _) hc) + let k : sphere (0 : ℂ) 1 → Circle := fun z => ⟨z.1, z.2⟩ + have ck : Continuous k := Continuous.subtype_mk continuous_subtype_val _ + have hL : HasLogOn (sphere (0 : ℂ) 1) fun z => (z - 0) ^ (1 : ℤ) := by + rw [hasLogOn_iff_subtype] + refine ⟨⟨fun z => g (1, k z) + Complex.log c, by fun_prop⟩, fun z => ?_⟩ + change _ = Complex.exp (g (1, k z) + Complex.log c) + rw [Complex.exp_add, hg, Complex.exp_log hc] + change _ = (G ((k z), unitInterval.symm 1) : ℂ) / c * c + rw [unitInterval.symm_one, h0, div_mul_cancel₀ _ hc] + simp [k] + have := eq_zero_of_hasLogOn_sphere (by norm_num) hL + omega + +end circle + +section glue + +theorem exists_sec {A : Type u} {S : Type v} [TopologicalSpace A] [CompactSpace A] [Nonempty A] + [TopologicalSpace S] [T2Space S] {j : A → S} + (hj : Continuous j) (hi : Function.Injective j) : ∃ s : S → A, ContinuousOn s (range j) + ∧ ∀ y, s (j y) = y := by + refine ⟨Function.invFun j, ?_, Function.leftInverse_invFun hi⟩ + rw [continuousOn_iff_isClosed] + intro t ht + refine ⟨j '' t, (ht.isCompact.image hj).isClosed, ?_⟩ + ext x + constructor + · rintro ⟨h1, y, rfl⟩ + rw [mem_preimage, Function.leftInverse_invFun hi] at h1 + exact ⟨mem_image_of_mem _ h1, mem_range_self _⟩ + · rintro ⟨⟨y, h1, rfl⟩, h2⟩ + exact ⟨by rw [mem_preimage, Function.leftInverse_invFun hi]; exact h1, h2⟩ + +/-- A space is the union of `A₁` and `A₂`, and `A₁` retracts to the common part except at a point. +Then a homotopy that misses the point +moves to `A₂`. -/ +theorem retract_two {S : Type u} {A₁ A₂ : Type v} [TopologicalSpace S] [T2Space S] + [TopologicalSpace A₁] [TopologicalSpace A₂] [CompactSpace A₁] [CompactSpace A₂] + [Nonempty A₁] [Nonempty A₂] {j₁ : A₁ → S} {j₂ : A₂ → S} (c₁ : Continuous j₁) + (c₂ : Continuous j₂) (i₁ : Function.Injective j₁) (i₂ : Function.Injective j₂) + (hu : range j₁ ∪ range j₂ = univ) {B : Set A₁} (hB : ∀ x ∈ B, j₁ x ∈ range j₂) + (hB' : ∀ x y, j₁ x = j₂ y → x ∈ B) {w : A₁} {R : A₁ → A₁} + (cR : ContinuousOn R {w}ᶜ) (hR : ∀ x, x ≠ w → R x ∈ B) (hfix : ∀ x ∈ B, R x = x) : + ∃ g : S → A₂, (∀ y, g (j₂ y) = y) ∧ (∀ x, x ∉ range j₂ → x ≠ j₁ w → j₂ (g x) ∈ j₁ '' B) ∧ + ∀ H : Circle × unitInterval → S, Continuous H → (∀ p, H p ≠ j₁ w) → Continuous (g ∘ H) := by + classical + obtain ⟨s₁, cs₁, hs₁⟩ := exists_sec c₁ i₁ + obtain ⟨s₂, cs₂, hs₂⟩ := exists_sec c₂ i₂ + let g : S → A₂ := fun x => if x ∈ range j₂ then s₂ x else s₂ (j₁ (R (s₁ x))) + have hg₂ : ∀ x ∈ range j₂, g x = s₂ x := fun x hx => ite_eq_left_iff.mpr fun h => absurd hx h + have hg₁ : ∀ x, x ≠ j₁ w → x ∈ range j₁ → g x = s₂ (j₁ (R (s₁ x))) := by + rintro _ hne ⟨y, rfl⟩ + by_cases h : j₁ y ∈ range j₂ + · obtain ⟨y', hy'⟩ := h + rw [hg₂ _ ⟨y', hy'⟩, hs₁, hfix y (hB' y y' hy'.symm)] + · exact ite_eq_right_iff.mpr fun h' => absurd h' h + have hns : ∀ x, x ≠ j₁ w → x ∈ range j₁ → s₁ x ≠ w := by + rintro _ hne ⟨y, rfl⟩ he + rw [hs₁] at he + exact hne (he ▸ rfl) + refine ⟨g, fun y => ?_, fun x h1 h2 => ?_, fun H cH hH => ?_⟩ + · rw [hg₂ _ (mem_range_self y), hs₂] + · have h3 : x ∈ range j₁ := by + have : x ∈ range j₁ ∪ range j₂ := hu ▸ mem_univ x + exact this.resolve_right h1 + have h4 := hR _ (hns x h2 h3) + obtain ⟨y, hy⟩ := hB _ h4 + rw [hg₁ x h2 h3, ← hy, hs₂, hy] + exact mem_image_of_mem _ h4 + · have hcl₁ : IsClosed (H ⁻¹' range j₁) := (isCompact_range c₁).isClosed.preimage cH + have hcl₂ : IsClosed (H ⁻¹' range j₂) := (isCompact_range c₂).isClosed.preimage cH + have hun : H ⁻¹' range j₁ ∪ H ⁻¹' range j₂ = univ := by + rw [← preimage_union, hu, preimage_univ] + rw [← continuousOn_univ, ← hun] + refine ContinuousOn.union_of_isClosed ?_ ?_ hcl₁ hcl₂ + · have h1 : ContinuousOn (fun p => s₁ (H p)) (H ⁻¹' range j₁) := cs₁.comp cH.continuousOn fun p + hp => hp + have h2 : ContinuousOn (fun p => R (s₁ (H p))) (H ⁻¹' range j₁) := + cR.comp h1 fun p hp => hns _ (hH p) hp + have h3 : ContinuousOn (fun p => s₂ (j₁ (R (s₁ (H p))))) (H ⁻¹' range j₁) := + cs₂.comp (c₁.comp_continuousOn h2) fun p hp => hB _ (hR _ (hns _ (hH p) hp)) + exact h3.congr fun p hp => hg₁ _ (hH p) hp + · have h3 : ContinuousOn (fun p => s₂ (H p)) (H ⁻¹' range j₂) := cs₂.comp cH.continuousOn fun p + hp => hp + exact h3.congr fun p hp => hg₂ _ hp + +end glue + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutSimilar.lean b/LeanPool/GraphMinor/Surface/CutSimilar.lean new file mode 100644 index 0000000000..c3ef25e559 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutSimilar.lean @@ -0,0 +1,367 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutOArc +public import LeanPool.GraphMinor.Surface.ModelHomeo + +/-! +# Finitely many classes of proper arcs + +Two spaces with the same word are homeomorphic by a map that keeps each side (`presents_homeo`). +Cutting a surface `S` along a +proper arc gives a word of `S` that has the arc as a side (`arc_data`). There are only finitely many +of these words, since the +classification bounds the parameters of the cut surface. So a surface has finitely many classes of +proper arcs +(`similarArcsFinite`). This is the proof of Graph Minors VII, (3.1), page 218. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function + +universe u + +/-- Two spaces with the same word are homeomorphic. -/ +theorem presents_homeo {X X' : Type*} [TopologicalSpace X] [T2Space X] [TopologicalSpace X'] + [T2Space X'] {W : ℕ → List Letter} + (hW : {i | W i ≠ []}.Finite) {f : ℕ × ℂ → X} {f' : ℕ × ℂ → X'} (hf : Presents W f) + (hf' : Presents W f') : + ∃ e : X ≃ₜ X', ∀ a ∈ Dsk W, e (f a) = f' a := by + have hD : IsCompact (Dsk W) := isCompact_Dsk hW + obtain ⟨hc, hs, hrel⟩ := hf + obtain ⟨hc', hs', hrel'⟩ := hf' + have ex1 : ∀ x : X, ∃ y ∈ Dsk W, f y = x := fun x => by + have h1 : x ∈ f '' Dsk W := hs ▸ mem_univ x + exact h1 + have ex2 : ∀ x : X', ∃ y ∈ Dsk W, f' y = x := fun x => by + have h1 : x ∈ f' '' Dsk W := hs' ▸ mem_univ x + exact h1 + choose s1 hs1 hs1' using ex1 + choose s2 hs2 hs2' using ex2 + have e1 : ∀ a ∈ Dsk W, f' (s1 (f a)) = f' a := fun a ha => (hrel' _ (hs1 _) _ ha).mpr ((hrel _ + (hs1 _) _ ha).mp (hs1' _)) + have e2 : ∀ a ∈ Dsk W, f (s2 (f' a)) = f a := fun a ha => (hrel _ (hs2 _) _ ha).mpr ((hrel' _ + (hs2 _) _ ha).mp (hs2' _)) + have c1 : Continuous fun x => f' (s1 x) := continuous_of_compact_quotient hD hc hs + (hc'.congr fun a ha => e1 a ha) + have c2 : Continuous fun x => f (s2 x) := continuous_of_compact_quotient hD hc' hs' + (hc.congr fun a ha => e2 a ha) + refine ⟨{ + toFun := fun x => f' (s1 x) + invFun := fun x => f (s2 x) + left_inv := fun x => ?_ + right_inv := fun x => ?_ + continuous_toFun := c1 + continuous_invFun := c2 + }, e1⟩ + · change f (s2 (f' (s1 x))) = x + rw [e2 _ (hs1 x), hs1'] + · change f' (s1 (f (s2 x))) = x + rw [e1 _ (hs2 x), hs2'] + +/-- `F` is a side of the word `W` of the surface. -/ +def HasData {S : Type*} [TopologicalSpace S] (F : Set S) (W : ℕ → List Letter) (p : ℕ) : Prop := + ∃ (f : ℕ × ℂ → S) (a : ℝ → S), Presents W f ∧ SideVal W f p a ∧ a '' Icc 0 1 = F + +/-- Two arcs with the same side of the same word are similar. -/ +theorem similar_of_data {S : Type*} [TopologicalSpace S] [T2Space S] {F F₀ : Set S} {W : ℕ + → List Letter} {p : ℕ} (hW : {i | W i ≠ []}.Finite) + (h : HasData F W p) (h₀ : HasData F₀ W p) : ∃ α : S ≃ₜ S, α '' F₀ = F := by + obtain ⟨f, a, h1, ⟨i, q, h2, h3⟩, rfl⟩ := h + obtain ⟨f₀, a₀, h1', ⟨i₀, q₀, h2', h3'⟩, rfl⟩ := h₀ + obtain ⟨e, he⟩ := presents_homeo hW h1' h1 + refine ⟨e, ?_⟩ + rw [image_image] + refine image_congr fun u hu => ?_ + by_cases hne : (i₀, q₀) = (i, q) + · simp only [Prod.mk.injEq] at hne + obtain ⟨rfl, rfl⟩ := hne + have hs : Stp W (i₀, sdPt (W i₀).length q₀ true u) (i₀, sdPt (W i₀).length q₀ true u) ∨ True + := .inr trivial + have hmem : (i₀, sdPt (W i₀).length q₀ true u) ∈ Dsk W := by + refine ⟨?_, ?_⟩ + · intro hn + simp only at hn + rw [hn] at h2 + simp at h2 + · simp only [sdPt, per, cis'] + rw [Complex.norm_exp_ofReal_mul_I] + rw [← h3' u hu, he _ hmem, h3 u hu] + · have hs : Stp W (i₀, sdPt (W i₀).length q₀ true u) (i, sdPt (W i).length q true u) := + ⟨i₀, i, q₀, q, p, true, true, u, h2', h2, hne, hu, rfl, rfl⟩ + obtain ⟨h4, h5⟩ := hs.mem_Dsk + rw [← h3' u hu, he _ h4, ← h3 u hu] + exact (h1.2.2 _ h4 _ h5).mpr (.rel _ _ hs) + +/-- The words of a surface that have a proper arc as a side. -/ +noncomputable def arcCode (t a b c a₂ b₂ c₂ i j : ℕ) (σ : Bool) : (ℕ → List Letter) × ℕ := + if t = 0 then (sW (blkA a b c i j σ ++ rW a b c (((List.range' 0 c).erase i).erase j)), + (rL a b i).1) + else if t = 1 then (sW (blkB a b c i σ ++ rW a b c ((List.range' 0 c).erase i)), (rL a b i).1) + else (dW (wArc₁ a b c i ((List.range' 0 c).erase i)) + (wArc₂ a₂ b₂ c₂ j ((List.range' 0 c₂).erase j) (frL a b c + 1) ((rL a b i).1, σ)), + (rL a b i).1) + +theorem finite_arcCode (t a b c a₂ b₂ c₂ i j : ℕ) (σ : Bool) : {k | (arcCode t a b c a₂ b₂ c₂ i j + σ).1 k ≠ []}.Finite := by + unfold arcCode + split_ifs + · exact finW_sW _ + · exact finW_sW _ + · refine (finite_le_nat 1).subset fun k hk => ?_ + rcases dW_cases _ _ k with ⟨rfl, -⟩ | ⟨rfl, -⟩ | e + · simp + · simp + · exact absurd e hk + +/-- The parameters of the words, below a bound. -/ +abbrev ArcIdx (B : ℕ) : Type := + Fin (B + 1) × Fin (B + 1) × Fin (B + 1) × Fin (B + 1) × Fin (B + 1) × Fin (B + 1) × Fin + (B + 1) × Fin (B + 1) × Fin (B + 1) × Bool + +/-- The word with the given parameters. -/ +noncomputable def arcWord {B : ℕ} (x : ArcIdx B) : (ℕ → List Letter) × ℕ := + arcCode x.1 x.2.1 x.2.2.1 x.2.2.2.1 x.2.2.2.2.1 x.2.2.2.2.2.1 x.2.2.2.2.2.2.1 x.2.2.2.2.2.2.2.1 + x.2.2.2.2.2.2.2.2.1 x.2.2.2.2.2.2.2.2.2 + +/-- A proper arc of a connected surface is a side of a word with bounded parameters. -/ +theorem arc_data {S : Type u} [TopologicalSpace S] (hS : IsSurface S) [hconn : ConnectedSpace S] + {a₀ b₀ c₀ : ℕ} (e₀ : S ≃ₜ SurfaceModel a₀ b₀ c₀) + {F : Set S} (hF' : IsProperIArc F) : ∃ x : ArcIdx (2 * a₀ + b₀ + c₀ + 3), HasData F + (arcWord x).1 (arcWord x).2 := by + obtain ⟨s, t, hst, hF, hl⟩ := hF' + have hcS : CompactSpace S := hS.1 + have ht2 : T2Space S := hS.2.1 + have crit : ∀ {a b c : ℕ}, Nonempty (S ≃ₜ SurfaceModel a b c) → c = c₀ ∧ 2 * a + b = 2 * a₀ + b₀ + := fun {a b c} h => by + obtain ⟨e'⟩ := h + obtain ⟨h1, h2, -⟩ := (modelCriterion.2 a b c a₀ b₀ c₀).mp ⟨e'.symm.trans e₀⟩ + exact ⟨h1, h2⟩ + obtain ⟨Y, tY, t2Y, ψ, hY, hψ, X, X', hP⟩ := exists_cut_arc hS hst hF hl + have hcY : CompactSpace Y := hY.1 + have hPc := hP + obtain ⟨x0, x1, y0, y1, l1, l2, hd, hun, b1, b2, h7, h8, h9, h10⟩ := hP + obtain ⟨a₁, ξ, η, L, ha0, ha1, himξ, himη, hiξ, hiη⟩ := exists_arcLift hPc hψ + have hXb : X ⊆ bd Y := fun z hz => hψ.2.2.2.2 (hun ▸ Or.inl hz) + have hXb' : X' ⊆ bd Y := fun z hz => hψ.2.2.2.2 (hun ▸ Or.inr hz) + have pX : IsPreconnected X := himξ ▸ isPreconnected_Icc.image _ L.cξ + have pX' : IsPreconnected X' := himη ▸ isPreconnected_Icc.image _ L.cη + have hex : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have hx : ξ 0 ∈ X := himξ ▸ ⟨0, hex, rfl⟩ + have hy : η 0 ∈ X' := himη ▸ ⟨0, hex, rfl⟩ + have hξm : ∀ u ∈ Icc (0 : ℝ) 1, ξ u ∈ X := fun u hu => himξ ▸ ⟨u, hu, rfl⟩ + have hηm : ∀ u ∈ Icc (0 : ℝ) 1, η u ∈ X' := fun u hu => himη ▸ ⟨u, hu, rfl⟩ + have hdcuff := cuff_statement.{u} Y hY + have : Nonempty S := ⟨s⟩ + rcases cut_comps hψ hY pX pX' hun hx hy with hYc | ⟨W₁, W₂, hne, hsc, hX₁, hX₂, hW₁, hW₂, hU, + hdW, hc₁, hc₂⟩ + · obtain ⟨a, b, c, ⟨e⟩⟩ := classification.{u} Y hY hYc + have hC : connectedComponentIn (bd Y) (ξ 0) ∈ cuffs Y := ⟨_, hXb hx, rfl⟩ + have hC' : connectedComponentIn (bd Y) (η 0) ∈ cuffs Y := ⟨_, hXb' hy, rfl⟩ + have hXC := pX.subset_connectedComponentIn hx hXb + have hXC' := pX'.subset_connectedComponentIn hy hXb' + by_cases hCC : connectedComponentIn (bd Y) (ξ 0) = connectedComponentIn (bd Y) (η 0) + · obtain ⟨i, hi, φ, g, hg, hs⟩ := exists_one_hole e hC + obtain ⟨a', ξ', η', m, L', ha', hxim, heim, hix, hie, hmc, hmm, hmξ⟩ := orient_lift L φ + (fun u hu => hXC (hξm u hu)) hiξ hiη + obtain ⟨hN, hLf⟩ := erase_facts c i + have hξ' : ∀ u ∈ Icc (0 : ℝ) 1, ξ' u ∈ X := fun u hu => by + rw [← himξ, ← hxim] + exact ⟨u, hu, rfl⟩ + have hη' : ∀ u ∈ Icc (0 : ℝ) 1, η' u ∈ X' := fun u hu => by + rw [← himη, ← heim] + exact ⟨u, hu, rfl⟩ + obtain ⟨σ, g', hp, hsd, -⟩ := arc_one_aux hY L' hψ.1 hψ.2.1 hC φ hi hLf hg hs hmc hmm hmξ + (fun u hu => hCC ▸ hXC' (hη' u hu)) hix hie (fun u hu v hv he => Set.disjoint_left.mp hd + (hξ' u hu) (he ▸ hη' v hv)) + have hn := nf_blkB (a := a) (b := b) (c := c) hi hN hLf σ + have hlen := length_erase_range hi + have hb : a ≤ 2 * a₀ + b₀ + c₀ + 3 ∧ b ≤ 2 * a₀ + b₀ + c₀ + 3 ∧ c ≤ 2 * a₀ + b₀ + c₀ + 3 := by + cases σ with + | false => + obtain ⟨w, h5, h6⟩ := hn.1 rfl + have := crit (homeo_of_nf hp h5 h6) + omega + | true => + obtain ⟨w, h5, h6⟩ := hn.2 rfl + have := crit (homeo_of_nf hp h5 h6) + omega + refine ⟨(⟨1, by omega⟩, ⟨a, by omega⟩, ⟨b, by omega⟩, ⟨c, by omega⟩, ⟨0, by omega⟩, ⟨0, + by omega⟩, ⟨0, by omega⟩, ⟨i, by omega⟩, ⟨0, by omega⟩, σ), ?_⟩ + exact ⟨_, a', hp, hsd, L'.img⟩ + · have hdis := cuffs_disjoint hC hC' hCC + obtain ⟨i, hi, j, hj, hij, φ, φ', g, hg, hs, hs'⟩ := exists_two_holes e hC hC' hCC + obtain ⟨a', ξ', η', m, L', ha', hxim, heim, hix, hie, hmc, hmm, hmξ⟩ := orient_lift L φ + (fun u hu => hXC (hξm u hu)) hiξ hiη + obtain ⟨hN, hLf⟩ := erase_erase_facts c i j + have hη' : ∀ u ∈ Icc (0 : ℝ) 1, η' u ∈ X' := fun u hu => by + rw [← himη, ← heim] + exact ⟨u, hu, rfl⟩ + obtain ⟨σ, g', hp, hsd⟩ := arc_two_aux hY L' hψ.1 hψ.2.1 hC hC' + (hdcuff.2.2 _ hC).isCompact.isClosed + (hdcuff.2.2 _ hC').isCompact.isClosed hdis φ φ' hij hi hj hLf hg hs hs' hmc hmm hmξ + (fun u hu => hXC' (hη' u hu)) hix hie + have hn := nf_blkA (a := a) (b := b) (c := c) hij hi hj hN hLf σ + have hlen := length_erase_erase hij hi hj + have hb : a ≤ 2 * a₀ + b₀ + c₀ + 3 ∧ b ≤ 2 * a₀ + b₀ + c₀ + 3 ∧ c ≤ 2 * a₀ + b₀ + c₀ + 3 := by + cases σ with + | false => + obtain ⟨w, h5, h6⟩ := hn.1 rfl + have := crit (homeo_of_nf hp h5 h6) + omega + | true => + obtain ⟨w, h5, h6⟩ := hn.2 rfl + have := crit (homeo_of_nf hp h5 h6) + omega + refine ⟨(⟨0, by omega⟩, ⟨a, by omega⟩, ⟨b, by omega⟩, ⟨c, by omega⟩, ⟨0, by omega⟩, ⟨0, + by omega⟩, ⟨0, by omega⟩, ⟨i, by omega⟩, ⟨j, by omega⟩, σ), ?_⟩ + exact ⟨_, a', hp, hsd, L'.img⟩ + · obtain ⟨a₃, b₃, c₃, ⟨e₁⟩⟩ := classification.{u} W₁ (isSurface_sub hY hW₁) hc₁ + obtain ⟨a₂, b₂, c₂, ⟨e₂⟩⟩ := classification.{u} W₂ (isSurface_sub hY hW₂) hc₂ + obtain ⟨i, j, σ, a', f, hi, hj, himg, -, hf, hsd⟩ := arc_comps_aux hY L hψ.1 hψ.2.1 hW₁ hW₂ hdW + hU e₁ e₂ + (by rw [himξ]; exact hX₁) (by rw [himη]; exact hX₂) (by rw [himξ]; exact hXb) + (by rw [himη]; exact hXb') hiξ hiη + obtain ⟨hN₁, hL₁⟩ := erase_facts c₃ i + obtain ⟨hN₂, hL₂⟩ := erase_facts c₂ j + have hb := crit (homeo_of_two_arc hi hj hN₁ hN₂ hL₁ hL₂ hf) + rw [length_erase_range hi, length_erase_range hj] at hb + refine ⟨(⟨2, by omega⟩, ⟨a₃, by omega⟩, ⟨b₃, by omega⟩, ⟨c₃, by omega⟩, ⟨a₂, by omega⟩, ⟨b₂, + by omega⟩, ⟨c₂, by omega⟩, ⟨i, by omega⟩, ⟨j, by omega⟩, σ), ?_⟩ + exact ⟨f, a', hf, hsd, himg⟩ + +/-- A connected surface has finitely many classes of proper arcs. -/ +theorem similar_conn {S : Type u} [TopologicalSpace S] (hS : IsSurface S) [hconn : ConnectedSpace + S] : + ∃ 𝓕 : Set (Set S), 𝓕.Finite ∧ ∀ F : Set S, IsProperIArc F → ∃ F₀ ∈ 𝓕, ∃ α : S ≃ₜ S, α '' F₀ = F + := by + classical + have ht2 : T2Space S := hS.2.1 + obtain ⟨a₀, b₀, c₀, ⟨e₀⟩⟩ := classification.{u} S hS hconn + set B := 2 * a₀ + b₀ + c₀ + 3 + let pick : ArcIdx B → Set S := fun x => + if h : ∃ F : Set S, IsProperIArc F ∧ HasData F (arcWord x).1 (arcWord x).2 then h.choose else ∅ + refine ⟨range pick, finite_range _, fun F hF => ?_⟩ + obtain ⟨x, hx⟩ := arc_data hS e₀ hF + have hex : ∃ F : Set S, IsProperIArc F ∧ HasData F (arcWord x).1 (arcWord x).2 := ⟨F, hF, hx⟩ + have h1 : pick x = hex.choose := dite_eq_left hex + refine ⟨pick x, ⟨x, rfl⟩, ?_⟩ + rw [h1] + exact similar_of_data (finite_arcCode ..) hx hex.choose_spec.2 + +open Classical in +/-- A map of a clopen part, extended by the identity. -/ +noncomputable def extId {S : Type*} {W : Set S} (γ : W → W) (x : S) : S := if h : x ∈ W then + (γ ⟨x, h⟩).1 else x + +theorem extId_mem {S : Type*} {W : Set S} (γ : W → W) (x : W) : extId γ x.1 = (γ x).1 := by + simp [extId] + +theorem extId_not {S : Type*} {W : Set S} (γ : W → W) {x : S} (h : x ∉ W) : extId γ x = x := by + simp [extId, h] + +theorem continuous_extId {S : Type*} [TopologicalSpace S] {W : Set S} (hW : IsClopen W) {γ : W → W} + (hγ : Continuous γ) : + Continuous (extId γ) := by + rw [continuous_iff_continuousAt] + intro x + by_cases h : x ∈ W + · have h1 : ContinuousAt (extId γ ∘ (Subtype.val : W → S)) ⟨x, h⟩ := by + have : extId γ ∘ (Subtype.val : W → S) = Subtype.val ∘ γ := funext fun y => extId_mem γ y + rw [this] + exact (continuous_subtype_val.comp hγ).continuousAt + exact (hW.2.isOpenEmbedding_subtypeVal.continuousAt_iff).mp h1 + · have h2 : IsOpen Wᶜ := hW.1.isOpen_compl + have h1 : ContinuousAt (extId γ ∘ (Subtype.val : (Wᶜ : Set S) → S)) ⟨x, h⟩ := by + have : extId γ ∘ (Subtype.val : (Wᶜ : Set S) → S) = Subtype.val := funext fun y + => extId_not γ y.2 + rw [this] + exact continuous_subtype_val.continuousAt + exact (h2.isOpenEmbedding_subtypeVal.continuousAt_iff).mp h1 + +/-- A homeomorphism of a clopen part, extended by the identity. -/ +theorem exists_extend {S : Type*} [TopologicalSpace S] {W : Set S} (hW : IsClopen W) (α : W ≃ₜ W) : + ∃ β : S ≃ₜ S, (∀ x : W, β x = (α x).1) ∧ ∀ x ∉ W, β x = x := by + have inv : ∀ (γ δ : W → W), (∀ y, γ (δ y) = y) → ∀ x, extId γ (extId δ x) = x := by + intro γ δ h x + by_cases hx : x ∈ W + · have h1 := extId_mem δ ⟨x, hx⟩ + simp only at h1 + rw [h1, extId_mem γ, h] + · rw [extId_not δ hx, extId_not γ hx] + exact ⟨{ toFun := extId α, invFun := extId α.symm, left_inv := inv _ _ fun y + => α.symm_apply_apply y, + right_inv := inv _ _ fun y => α.apply_symm_apply y, continuous_toFun + := continuous_extId hW α.continuous, + continuous_invFun := continuous_extId hW α.symm.continuous }, fun x + => extId_mem _ x, fun _ hx => extId_not _ hx⟩ + +/-- The arcs of one component of a surface. -/ +theorem similar_comp {S : Type u} [TopologicalSpace S] (hS : IsSurface S) (x : S) : + ∃ 𝓖 : Set (Set S), 𝓖.Finite ∧ ∀ F : Set S, IsProperIArc F → F ⊆ connectedComponent x → + ∃ F₀ ∈ 𝓖, ∃ α : S ≃ₜ S, α '' F₀ = F := by + have := hS.locallyConnected + have hW : IsClopen (connectedComponent x) := isClopen_connectedComponent + have ht2 : T2Space S := hS.2.1 + have hW1 : IsSurface (connectedComponent x) := isSurface_sub hS hW + have hc : ConnectedSpace (connectedComponent x) := isConnected_iff_connectedSpace.mp + isConnected_connectedComponent + obtain ⟨𝓕, h1, h2⟩ := similar_conn hW1 + refine ⟨image (image Subtype.val) 𝓕, h1.image _, fun F hF hsub => ?_⟩ + obtain ⟨s, t, hst, hb, hl⟩ := id hF + have hsW : s ∈ connectedComponent x := hsub hl.left_mem + have htW : t ∈ connectedComponent x := hsub hl.right_mem + have hF' : IsProperIArc (Subtype.val ⁻¹' F : Set (connectedComponent x)) := by + refine ⟨⟨s, hsW⟩, ⟨t, htW⟩, fun he => hst (congrArg Subtype.val he), ?_, ?_⟩ + · ext y + have h3 : y ∈ bd (connectedComponent x) ↔ y.1 ∈ bd S := mem_bd_sub hW.2 + have h4 := Set.ext_iff.mp hb y.1 + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff, mem_preimage, h3, + Subtype.ext_iff] + simpa using h4 + · obtain ⟨u', v', e1, e2, h5⟩ := hl.pull (j := (Subtype.val : connectedComponent x + → S)) IsEmbedding.subtypeVal (by rwa [Subtype.range_coe]) + have e3 : u' = ⟨s, hsW⟩ := Subtype.ext e1 + have e4 : v' = ⟨t, htW⟩ := Subtype.ext e2 + rwa [e3, e4] at h5 + obtain ⟨F₀, h3, α, h4⟩ := h2 _ hF' + obtain ⟨β, hβ, -⟩ := exists_extend hW α + refine ⟨_, mem_image_of_mem _ h3, β, ?_⟩ + have e1 : Subtype.val '' (Subtype.val ⁻¹' F : Set (connectedComponent x)) = F := by + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hsub] + rw [← e1, ← h4, image_image, image_image] + exact image_congr fun y _ => hβ y + +/-- **Finitely many classes of proper arcs.** Graph Minors VII, (3.1), page 218: cut along the arc +and use the classification. +Here `arc_data` gives a word of the surface with the arc as a side, and `presents_homeo` compares +two arcs with the same word. -/ +theorem similarArcsFinite : SimilarArcsFiniteStatement.{u} := by + intro S _ hS + have hcS : CompactSpace S := hS.1 + have := hS.locallyConnected + choose 𝓖 h1 h2 using similar_comp hS + obtain ⟨T, hT⟩ := isCompact_univ.elim_finite_subcover (fun x : S => connectedComponent x) + (fun x => isOpen_connectedComponent) (fun x _ => mem_iUnion.mpr ⟨x, mem_connectedComponent⟩) + refine ⟨⋃ x ∈ T, 𝓖 x, T.finite_toSet.biUnion fun x _ => h1 x, fun F hF => ?_⟩ + obtain ⟨s, t, hst, hb, hl⟩ := id hF + obtain ⟨x, hx, hs⟩ := mem_iUnion₂.mp (hT (mem_univ s)) + have hsub : F ⊆ connectedComponent x := by + rw [connectedComponent_eq hs] + obtain ⟨a, ha, e, -, -⟩ := hl.exists_arc + have hp : IsPreconnected F := e ▸ isPreconnected_range ha.1 + exact hp.subset_connectedComponent hl.left_mem + obtain ⟨F₀, h3, α, h4⟩ := h2 x F hF hsub + exact ⟨F₀, mem_iUnion₂.mpr ⟨x, hx, h3⟩, α, h4⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutTree.lean b/LeanPool/GraphMinor/Surface/CutTree.lean new file mode 100644 index 0000000000..2e9c3e03f1 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutTree.lean @@ -0,0 +1,170 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CrossCut + +/-! +# Cuts and trees of cuts + +`IsCut F a b e` says that `e` is a cross-cut of the `O`-arc `F` and that `a` and `b` are the two +arcs +of `F` between its ends. A `CutTree P F` is a finite binary tree of cuts that starts at `F` and has +leaves whose inner domains satisfy `P`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +local notation "𝕀" => unitInterval + +/-- The closed domain of `F`. -/ +def closedInner (F : Set ℂ) : Set ℂ := inner F ∪ F + +/-- `e` is a cross-cut of `F` with ends the ends of the two arcs `a` and `b` of `F`. -/ +structure IsCut (F : Set ℂ) (a b e : 𝕀 → ℂ) : Prop where + arc_a : IsArcMap a + arc_b : IsArcMap b + arc_e : IsArcMap e + a_zero : a 0 = e 0 + a_one : a 1 = e 1 + b_zero : b 0 = e 0 + b_one : b 1 = e 1 + ne : e 0 ≠ e 1 + union : range a ∪ range b = F + meet : ∀ s t, a s = b t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) + inside : ∀ t, t ≠ 0 → t ≠ 1 → e t ∈ inner F + +/-- The `O`-arc formed by the arc `a` and the cross-cut `e`. -/ +def side (a e : 𝕀 → ℂ) : Set ℂ := range a ∪ range e + +namespace IsCut + +variable {F : Set ℂ} {a b e : 𝕀 → ℂ} + +/-- The cut with its two sides exchanged. -/ +theorem symm (h : IsCut F a b e) : IsCut F b a e where + arc_a := h.arc_b + arc_b := h.arc_a + arc_e := h.arc_e + a_zero := h.b_zero + a_one := h.b_one + b_zero := h.a_zero + b_one := h.a_one + ne := h.ne + union := by rw [union_comm]; exact h.union + meet := fun s t hst => (h.meet t s hst.symm).imp And.symm And.symm + inside := h.inside + +theorem e_notMem (h : IsCut F a b e) {t : 𝕀} (h0 : t ≠ 0) (h1 : t ≠ 1) : e t ∉ F := + (h.inside t h0 h1).1 + +theorem a_mem (h : IsCut F a b e) (s : 𝕀) : a s ∈ F := h.union ▸ Or.inl ⟨s, rfl⟩ + +theorem b_mem (h : IsCut F a b e) (s : 𝕀) : b s ∈ F := h.union ▸ Or.inr ⟨s, rfl⟩ + +/-- The arc `a` meets the cross-cut only in their ends. -/ +theorem a_eq_e (h : IsCut F a b e) (s t : 𝕀) (hst : a s = e t) : + (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + by_cases h0 : t = 0 + · left + refine ⟨h.arc_a.2 ?_, h0⟩ + rw [hst, h0, h.a_zero] + · by_cases h1 : t = 1 + · right + refine ⟨h.arc_a.2 ?_, h1⟩ + rw [hst, h1, h.a_one] + · exact absurd (hst ▸ h.a_mem s) (h.e_notMem h0 h1) + +/-- The side of a cut is an `O`-arc. -/ +theorem oArc_side (h : IsCut F a b e) : Nonempty (Circle ≃ₜ side a e) := + oArc_of_two_arcs h.arc_a h.arc_e h.a_zero h.a_one h.a_eq_e + +/-- A cut is a theta curve. -/ +theorem isTheta (h : IsCut F a b e) (hF : IsJordanParts F) : + IsTheta F (side a e) (side b e) (range a) (range b) (range e) (e 0) (e 1) := by + obtain ⟨φ₁⟩ := h.oArc_side + obtain ⟨φ₂⟩ := h.symm.oArc_side + have hmid : (⟨1 / 2, by norm_num, by norm_num⟩ : 𝕀) ≠ 0 ∧ + (⟨1 / 2, by norm_num, by norm_num⟩ : 𝕀) ≠ 1 := by + constructor <;> intro hh <;> have := congrArg Subtype.val hh <;> norm_num at this + have hcase : ∀ {c : 𝕀 → ℂ}, IsArcMap c → c 0 = e 0 → c 1 = e 1 → (range c \ {e 0, e 1}).Nonempty + := by + intro c hc h0 h1 + refine ⟨c ⟨1 / 2, by norm_num, by norm_num⟩, ⟨_, rfl⟩, ?_⟩ + rintro (hh | hh) + · exact hmid.1 (hc.2 (hh.trans h0.symm)) + · exact hmid.2 (hc.2 (mem_singleton_iff.mp hh |>.trans h1.symm)) + refine ⟨hF, isJordanParts φ₁, isJordanParts φ₂, h.union.symm, rfl, rfl, ?_, ⟨⟨0, rfl⟩, ⟨1, rfl⟩⟩, + ?_, + ⟨h.a_zero ▸ h.a_mem 0, h.a_one ▸ h.a_mem 1⟩, ?_, hcase h.arc_a h.a_zero h.a_one, + hcase h.arc_b h.b_zero h.b_one⟩ + · rintro _ ⟨⟨s, rfl⟩, ⟨t, ht⟩⟩ + rcases h.meet s t ht.symm with ⟨rfl, -⟩ | ⟨rfl, -⟩ + · exact Or.inl h.a_zero + · exact Or.inr h.a_one + · rintro _ ⟨⟨t, rfl⟩, hn⟩ + refine h.inside t (fun h0 => hn (Or.inl (by rw [h0]))) fun h1 => hn (Or.inr (by rw [h1]; rfl)) + · exact isPreconnected_range h.arc_e.1 + +end IsCut + +/-- A cross-cut of `F` gives a cut. -/ +theorem exists_isCut {F : Set ℂ} (φ : Circle ≃ₜ F) {e : 𝕀 → ℂ} (he : IsArcMap e) (hne : e 0 ≠ e 1) + (h0 : e 0 ∈ F) (h1 : e 1 ∈ F) (hin : ∀ t, t ≠ 0 → t ≠ 1 → e t ∈ inner F) : + ∃ a b, IsCut F a b e := by + obtain ⟨a, b, ha, hb, ha0, ha1, hb0, hb1, hu, hm⟩ := exists_two_arcs φ h0 h1 hne + exact ⟨a, b, ha, hb, he, ha0, ha1, hb0, hb1, hne, hu, hm, hin⟩ + +/-- A finite binary tree of cuts from `F`, with leaves satisfying `P`. -/ +inductive CutTree (P : Set ℂ → Prop) : Set ℂ → Prop + | leaf {F : Set ℂ} : P (inner F) → CutTree P F + | node {F : Set ℂ} {a b e : 𝕀 → ℂ} : IsCut F a b e → CutTree P (side a e) → + CutTree P (side b e) → CutTree P F + +/-- The inner domains of a tree lie in the inner domain of the root. -/ +theorem IsCut.inner_side_subset {F : Set ℂ} {a b e : 𝕀 → ℂ} (h : IsCut F a b e) + (hF : IsJordanParts F) : inner (side a e) ⊆ inner F ∧ inner (side b e) ⊆ inner F := + ⟨(h.isTheta hF).inner_subset₁, (h.isTheta hF).symm.inner_subset₁⟩ + +/-- An antitone property of the root can be added to the leaves of a tree. -/ +theorem CutTree.strengthen {P Q : Set ℂ → Prop} (hQ : ∀ {U V}, U ⊆ V → Q V → Q U) {F : Set ℂ} + (ht : CutTree P F) (hF : Nonempty (Circle ≃ₜ F)) (hq : Q (inner F)) : + CutTree (fun U => Q U ∧ P U) F := by + induction ht with + | leaf h => exact .leaf ⟨hq, h⟩ + | @node F a b e hc _ _ ih₁ ih₂ => + obtain ⟨φ⟩ := hF + have hsub := hc.inner_side_subset (isJordanParts φ) + exact .node hc (ih₁ hc.oArc_side (hQ hsub.1 hq)) (ih₂ hc.symm.oArc_side (hQ hsub.2 hq)) + +/-- Trees compose: from each leaf of a tree for `Q` grow a tree for `P`, and keep `Q` if it is +antitone. -/ +theorem CutTree.bind {P Q : Set ℂ → Prop} (hQ : ∀ {U V}, U ⊆ V → Q V → Q U) {F : Set ℂ} + (ht : CutTree Q F) (hF : Nonempty (Circle ≃ₜ F)) + (hnext : ∀ G : Set ℂ, Nonempty (Circle ≃ₜ G) → CutTree P G) : + CutTree (fun U => Q U ∧ P U) F := by + induction ht with + | leaf h => exact (hnext _ hF).strengthen hQ hF h + | @node F a b e hc _ _ ih₁ ih₂ => + exact .node hc (ih₁ hc.oArc_side) (ih₂ hc.symm.oArc_side) + +/-- The leaves of a tree may be weakened. -/ +theorem CutTree.map {P Q : Set ℂ → Prop} {F : Set ℂ} (ht : CutTree P F) + (hF : Nonempty (Circle ≃ₜ F)) + (h : ∀ G : Set ℂ, Nonempty (Circle ≃ₜ G) → P (inner G) → Q (inner G)) : CutTree Q F := by + induction ht with + | leaf hp => exact .leaf (h _ hF hp) + | @node F a b e hc _ _ ih₁ ih₂ => + exact .node hc (ih₁ hc.oArc_side) (ih₂ hc.symm.oArc_side) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutTwo.lean b/LeanPool/GraphMinor/Surface/CutTwo.lean new file mode 100644 index 0000000000..b327646fba --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutTwo.lean @@ -0,0 +1,468 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutConn + +/-! +# Two components after cutting + +If the cut surface has two components, each has its own word. The two words with disjoint labels +form a family of two words +that presents the cut surface (`presents_dW`). Pasting two sides, one in each word, gives a family +for the surface before +cutting (`glue_two`), and this family is equivalent to one word (`two_to_one`). We then find the +normal form of this +word (`state_merge`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function + +universe uu + +/-! ### A family of two words -/ + +theorem PRel.map' {W W' : ℕ → List Letter} {κ : ℕ × ℂ → ℕ × ℂ} (h : ∀ x y, Stp W x y → Stp W' (κ x) + (κ y)) {a b : ℕ × ℂ} + (hp : PRel W a b) : PRel W' (κ a) (κ b) := by + induction hp with + | rel x y hs => exact .rel _ _ (h _ _ hs) + | refl _ => exact .refl _ + | symm _ _ _ ih => exact .symm _ _ ih + | trans _ _ _ _ _ h1 h2 => exact .trans _ _ _ h1 h2 + +theorem dW_zero (u v : List Letter) : dW u v 0 = u := by simp [dW, sW] + +theorem dW_one (u v : List Letter) : dW u v 1 = v := by simp [dW] + +theorem dW_of_ne (u v : List Letter) {i : ℕ} (h0 : i ≠ 0) (h1 : i ≠ 1) : dW u v i = [] := by + simp [dW, h1, sW, h0, nW] + +theorem dW_eq (u v : List Letter) (i : ℕ) : dW u v i = if i = 0 then u else if i = 1 then v else [] + := by + by_cases h0 : i = 0 + · subst h0 + simp [dW_zero] + by_cases h1 : i = 1 + · subst h1 + simp [dW_one] + · rw [ite_eq_right h0, ite_eq_right h1, dW_of_ne u v h0 h1] + +theorem dW_cases (u v : List Letter) (i : ℕ) : (i = 0 ∧ dW u v i = u) ∨ (i = 1 ∧ dW u v i = v) + ∨ dW u v i = [] := by + by_cases h0 : i = 0 + · subst h0 + exact .inl ⟨rfl, dW_zero u v⟩ + by_cases h1 : i = 1 + · subst h1 + exact .inr (.inl ⟨rfl, dW_one u v⟩) + · exact .inr (.inr (dW_of_ne u v h0 h1)) + +theorem sW_cases (u : List Letter) (i : ℕ) : (i = 0 ∧ sW u i = u) ∨ sW u i = [] := by + by_cases h0 : i = 0 + · subst h0 + exact .inl ⟨rfl, sW_zero u⟩ + · right + simp [sW, h0, nW] + +/-- A step of the family is a step inside one word. -/ +theorem stp_dW {u v : List Letter} (hl : DisjL u v) {a b : ℕ × ℂ} (h : Stp (dW u v) a b) : + (a.1 = 0 ∧ b.1 = 0 ∧ Stp (sW u) a b) ∨ (a.1 = 1 ∧ b.1 = 1 ∧ Stp (sW v) (0, a.2) (0, b.2)) := by + obtain ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ := h + have hm1 := List.mem_of_getElem? h1 + have hm2 := List.mem_of_getElem? h2 + rcases dW_cases u v i with ⟨rfl, e1⟩ | ⟨rfl, e1⟩ | e1 + · rcases dW_cases u v j with ⟨rfl, e2⟩ | ⟨rfl, e2⟩ | e2 + · left + rw [e1] at h1 + rw [e1] at h2 + simp only [e1] + refine ⟨trivial, trivial, 0, 0, p, q, k, ε, ε', t, ?_, ?_, h3, ht, ?_, ?_⟩ + · simpa only [sW_zero] using h1 + · simpa only [sW_zero] using h2 + · rw [sW_zero] + · rw [sW_zero] + · rw [e1] at hm1 + rw [e2] at hm2 + exact (hl _ hm1 _ hm2 rfl).elim + · rw [e2] at hm2 + simp at hm2 + · rcases dW_cases u v j with ⟨rfl, e2⟩ | ⟨rfl, e2⟩ | e2 + · rw [e1] at hm1 + rw [e2] at hm2 + exact (hl _ hm2 _ hm1 rfl).elim + · right + rw [e1] at h1 + rw [e1] at h2 + simp only [e1] + refine ⟨trivial, trivial, 0, 0, p, q, k, ε, ε', t, ?_, ?_, ?_, ht, ?_, ?_⟩ + · simpa only [sW_zero] using h1 + · simpa only [sW_zero] using h2 + · intro he + exact h3 (by simpa using he) + · rw [sW_zero] + · rw [sW_zero] + · rw [e2] at hm2 + simp at hm2 + · rw [e1] at hm1 + simp at hm1 + +theorem stp_left {u v : List Letter} {a b : ℕ × ℂ} (h : Stp (sW u) a b) : Stp (dW u v) a b := by + obtain ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ := h + have hi := (sW_get h1).1 + have hj := (sW_get h2).1 + subst hi hj + rw [sW_zero] at h1 h2 + refine ⟨0, 0, p, q, k, ε, ε', t, by rw [dW_zero]; exact h1, by rw [dW_zero]; exact h2, h3, ht, by + rw [dW_zero, sW_zero], by rw [dW_zero, sW_zero]⟩ + +theorem stp_right {u v : List Letter} {a b : ℕ × ℂ} (h : Stp (sW v) a b) : + Stp (dW u v) (1, a.2) (1, b.2) := by + obtain ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ := h + have hi := (sW_get h1).1 + have hj := (sW_get h2).1 + subst hi hj + rw [sW_zero] at h1 h2 + refine ⟨1, 1, p, q, k, ε, ε', t, by rw [dW_one]; exact h1, by rw [dW_one]; exact h2, ?_, ht, by + rw [dW_one, sW_zero], by rw [dW_one, sW_zero]⟩ + intro he + exact h3 (by simpa using he) + +/-- The map of a family of two words, from the maps of the two words. -/ +noncomputable def glW {T : Type*} {W₁ W₂ : Set T} (g₁ : ℕ × ℂ → W₁) (g₂ : ℕ × ℂ → W₂) : ℕ × ℂ → T := + fun a => if a.1 = 0 then (g₁ (0, a.2)).1 else (g₂ (0, a.2)).1 + +theorem mem_Dsk_sW {u : List Letter} {a : ℕ × ℂ} (h : a ∈ Dsk (sW u)) : a.1 = 0 ∧ u ≠ [] ∧ ‖a.2‖ + ≤ 1 := by + rcases sW_cases u a.1 with ⟨h1, h2⟩ | h2 + · exact ⟨h1, h2 ▸ h.1, h.2⟩ + · exact absurd h2 h.1 + +/-- Two components with their words. -/ +theorem presents_dW {T : Type*} [TopologicalSpace T] {u v : List Letter} (hu : u ≠ []) + (hv : v ≠ []) (hl : DisjL u v) {W₁ W₂ : Set T} + (hd : Disjoint W₁ W₂) (hU : W₁ ∪ W₂ = univ) {g₁ : ℕ × ℂ → W₁} {g₂ : ℕ × ℂ → W₂} (h₁ : Presents + (sW u) g₁) + (h₂ : Presents (sW v) g₂) : Presents (dW u v) (glW g₁ g₂) := by + have hmem : ∀ {z : ℂ}, ‖z‖ ≤ 1 → ((0, z) : ℕ × ℂ) ∈ Dsk (dW u v) ∧ ((1, z) : ℕ × ℂ) ∈ Dsk + (dW u v) ∧ + ((0, z) : ℕ × ℂ) ∈ Dsk (sW u) ∧ ((0, z) : ℕ × ℂ) ∈ Dsk (sW v) := fun {z} hz => + ⟨⟨by simpa only [dW_zero] using hu, hz⟩, + ⟨by simpa only [dW_one] using hv, hz⟩, + ⟨by simpa only [sW_zero] using hu, hz⟩, + ⟨by simpa only [sW_zero] using hv, hz⟩⟩ + have hsplit : Dsk (dW u v) = ({0} : Set ℕ) ×ˢ Metric.closedBall (0 : ℂ) 1 ∪ + ({1} : Set ℕ) ×ˢ Metric.closedBall (0 : ℂ) 1 := by + ext ⟨i, z⟩ + simp only [Dsk, mem_ofPred_eq, mem_union, mem_prod, mem_singleton_iff, mem_closedBall_zero_iff] + rcases dW_cases u v i with ⟨rfl, e⟩ | ⟨rfl, e⟩ | e + · simp [e, hu] + · simp [e, hv] + · have h0 : i ≠ 0 := by + rintro rfl + rw [dW_zero] at e + exact hu e + have h1 : i ≠ 1 := by + rintro rfl + rw [dW_one] at e + exact hv e + simp [e, h0, h1] + refine ⟨?_, ?_, ?_⟩ + · rw [hsplit] + refine ContinuousOn.union_of_isClosed ?_ ?_ ((isClosed_discrete _).prod + Metric.isClosed_closedBall) + ((isClosed_discrete _).prod Metric.isClosed_closedBall) + · have h3 : ContinuousOn (fun a : ℕ × ℂ => (g₁ (0, a.2)).1) (({0} : Set ℕ) ×ˢ Metric.closedBall + (0 : ℂ) 1) := by + refine continuous_subtype_val.comp_continuousOn (h₁.1.comp (by fun_prop) ?_) + rintro ⟨i, z⟩ ⟨-, hz⟩ + exact (hmem (by simpa using hz)).2.2.1 + refine h3.congr ?_ + rintro ⟨i, z⟩ ⟨hi, -⟩ + have : i = 0 := hi + subst this + simp [glW] + · have h3 : ContinuousOn (fun a : ℕ × ℂ => (g₂ (0, a.2)).1) (({1} : Set ℕ) ×ˢ Metric.closedBall + (0 : ℂ) 1) := by + refine continuous_subtype_val.comp_continuousOn (h₂.1.comp (by fun_prop) ?_) + rintro ⟨i, z⟩ ⟨-, hz⟩ + exact (hmem (by simpa using hz)).2.2.2 + refine h3.congr ?_ + rintro ⟨i, z⟩ ⟨hi, -⟩ + have : i = 1 := hi + subst this + simp [glW] + · refine eq_univ_of_forall fun y => ?_ + rcases (hU ▸ mem_univ y : y ∈ W₁ ∪ W₂) with hy | hy + · obtain ⟨a, ha, he⟩ : (⟨y, hy⟩ : W₁) ∈ g₁ '' Dsk (sW u) := h₁.2.1 ▸ mem_univ _ + obtain ⟨h0, -, hz⟩ := mem_Dsk_sW ha + refine ⟨(0, a.2), (hmem hz).1, ?_⟩ + have e : ((0, a.2) : ℕ × ℂ) = a := Prod.ext h0.symm rfl + simp [glW, e, he] + · obtain ⟨a, ha, he⟩ : (⟨y, hy⟩ : W₂) ∈ g₂ '' Dsk (sW v) := h₂.2.1 ▸ mem_univ _ + obtain ⟨h0, -, hz⟩ := mem_Dsk_sW ha + refine ⟨(1, a.2), (hmem hz).2.1, ?_⟩ + have e : ((0, a.2) : ℕ × ℂ) = a := Prod.ext h0.symm rfl + simp [glW, e, he] + · have hcase : ∀ a ∈ Dsk (dW u v), a = (0, a.2) ∧ ‖a.2‖ ≤ 1 ∨ a = (1, a.2) ∧ ‖a.2‖ ≤ 1 := by + intro a ha + rw [hsplit] at ha + rcases ha with ⟨h3, h4⟩ | ⟨h3, h4⟩ + · exact .inl ⟨Prod.ext h3 rfl, by simpa using h4⟩ + · exact .inr ⟨Prod.ext h3 rfl, by simpa using h4⟩ + have hval0 : ∀ z, glW g₁ g₂ (0, z) = (g₁ (0, z)).1 := fun z => by simp [glW] + have hval1 : ∀ z, glW g₁ g₂ (1, z) = (g₂ (0, z)).1 := fun z => by simp [glW] + have hrev : ∀ a b, PRel (dW u v) a b → glW g₁ g₂ a = glW g₁ g₂ b := by + intro a b hp + induction hp with + | rel x y hs => + obtain ⟨hx, hy⟩ := hs.mem_Dsk + rcases stp_dW hl hs with ⟨h3, h4, h5⟩ | ⟨h3, h4, h5⟩ + · obtain ⟨hx', hy'⟩ := h5.mem_Dsk + have e1 : x = (0, x.2) := Prod.ext h3 rfl + have e2 : y = (0, y.2) := Prod.ext h4 rfl + rw [e1, e2, hval0, hval0, ← e1, ← e2] + exact congrArg Subtype.val ((h₁.2.2 x hx' y hy').mpr (.rel _ _ h5)) + · obtain ⟨hx', hy'⟩ := h5.mem_Dsk + have e1 : x = (1, x.2) := Prod.ext h3 rfl + have e2 : y = (1, y.2) := Prod.ext h4 rfl + rw [e1, e2, hval1, hval1] + exact congrArg Subtype.val ((h₂.2.2 _ hx' _ hy').mpr (.rel _ _ h5)) + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + intro a ha b hb + refine ⟨fun he => ?_, hrev a b⟩ + rcases hcase a ha with ⟨e1, h3⟩ | ⟨e1, h3⟩ <;> rcases hcase b hb with ⟨e2, h4⟩ | ⟨e2, h4⟩ + · rw [e1, e2, hval0, hval0] at he + have h5 := (h₁.2.2 _ (hmem h3).2.2.1 _ (hmem h4).2.2.1).mp (Subtype.ext he) + have h6 : PRel (dW u v) (0, a.2) (0, b.2) := PRel.map' (κ := id) (fun _ _ hs + => stp_left hs) h5 + rwa [← e1, ← e2] at h6 + · rw [e1, e2, hval0, hval1] at he + exact absurd he (fun h5 => Set.disjoint_left.mp hd (g₁ _).2 (h5 ▸ (g₂ _).2)) + · rw [e1, e2, hval1, hval0] at he + exact absurd he.symm (fun h5 => Set.disjoint_left.mp hd (g₁ _).2 (h5 ▸ (g₂ _).2)) + · rw [e1, e2, hval1, hval1] at he + have h5 := (h₂.2.2 _ (hmem h3).2.2.2 _ (hmem h4).2.2.2).mp (Subtype.ext he) + have h6 : PRel (dW u v) (1, a.2) (1, b.2) := PRel.map' (κ := fun x => (1, x.2)) (a := + (0, a.2)) (b := (0, b.2)) (fun _ _ hs => stp_right hs) h5 + rwa [← e1, ← e2] at h6 + +theorem SideVal.gl_left {T : Type*} {W₁ W₂ : Set T} {g₁ : ℕ × ℂ → W₁} {g₂ : ℕ × ℂ + → W₂} {u v : List Letter} {k : ℕ} {ρ : ℝ → W₁} + (h : SideVal (sW u) g₁ k ρ) : SideVal (dW u v) (glW g₁ g₂) k fun t => (ρ t).1 := by + obtain ⟨i, p, h1, h2⟩ := h + obtain ⟨rfl, h3⟩ := sW_get h1 + rw [sW_zero] at h2 + refine ⟨0, p, by rw [dW_zero]; exact h3, fun t ht => ?_⟩ + rw [dW_zero] + simp [glW, h2 t ht] + +theorem SideVal.gl_right {T : Type*} {W₁ W₂ : Set T} {g₁ : ℕ × ℂ → W₁} {g₂ : ℕ × ℂ + → W₂} {u v : List Letter} {k : ℕ} {ρ : ℝ → W₂} + (h : SideVal (sW v) g₂ k ρ) : SideVal (dW u v) (glW g₁ g₂) k fun t => (ρ t).1 := by + obtain ⟨i, p, h1, h2⟩ := h + obtain ⟨rfl, h3⟩ := sW_get h1 + rw [sW_zero] at h2 + refine ⟨1, p, by rw [dW_one]; exact h3, fun t ht => ?_⟩ + rw [dW_one] + simp [glW, h2 t ht] + +/-- A family with a side in each word: the two sides pasted. -/ +theorem glue_two {S' S : Type*} [TopologicalSpace S'] [TopologicalSpace S] {ψ : S' + → S} {F : Set S} {a : ℝ → S} + {ξ η : ℝ → S'} (L : ArcLift ψ F a ξ η) (hψ : Continuous ψ) (hsurj : Surjective ψ) {u A B : List + Letter} {p q p₁ : ℕ} {σ : Bool} + (hp1 : u[p₁]? = some (p, true)) (hc1 : cnt u p = 1) (hc2 : cnt (A ++ (q, true) :: B) q = 1) + (hdis : DisjL u (A ++ (q, true) :: B)) {g : ℕ × ℂ → S'} + (hg : Presents (dW u (A ++ (q, true) :: B)) g) {i₁ : ℕ} (hi : i₁ = 0) (hsξ : ∀ t ∈ Icc + (0 : ℝ) 1, g (i₁, sdPt u.length p₁ true t) = ξ t) {ζ : ℝ → S'} + (hsη : ∀ t ∈ Icc (0 : ℝ) 1, g (1, sdPt (A ++ (q, true) :: B).length A.length true t) = ζ t) + (hζ : ∀ t ∈ Icc (0 : ℝ) 1, ζ (ofs σ t) = η t) : + Presents (dW u (A ++ (p, σ) :: B)) (ψ ∘ g) ∧ SideVal (dW u (A ++ (p, σ) :: B)) (ψ ∘ g) p a := by + subst hi + set w := A ++ (q, true) :: B with hw + set w₁ := A ++ (p, σ) :: B with hw₁ + have hl : w₁.length = w.length := by simp [hw, hw₁] + have hget : ∀ n, n ≠ A.length → w₁[n]? = w[n]? := by + intro n hn + rw [hw, hw₁] + by_cases h1 : n < A.length + · rw [List.getElem?_append_left h1, List.getElem?_append_left h1] + · have h2 : A.length ≤ n := not_lt.mp h1 + rw [List.getElem?_append_right h2, List.getElem?_append_right h2] + obtain ⟨m, hm⟩ : ∃ m, n - A.length = m + 1 := ⟨n - A.length - 1, by omega⟩ + rw [hm] + simp + have hq0 : w[A.length]? = some (q, true) := by simp [hw] + have hq1 : w₁[A.length]? = some (p, σ) := by simp [hw₁] + have h5 : ∀ t ∈ Icc (0 : ℝ) 1, g (1, sdPt w.length A.length σ t) = η t := fun t ht => by + rw [sdPt_ofs, hsη _ (ofs_mem ht), hζ t ht] + have hm0 : ∀ j m e, (dW u w j)[m]? = some (p, e) → (j, m) = (0, p₁) := by + intro j m e h + rcases dW_cases u w j with ⟨rfl, e1⟩ | ⟨rfl, e1⟩ | e1 + · rw [e1] at h + rw [unique_of_cnt hc1 h hp1] + · rw [e1] at h + exact (hdis _ (List.mem_of_getElem? hp1) _ (List.mem_of_getElem? h) rfl).elim + · rw [e1] at h + simp at h + have hm1 : ∀ j m e, (dW u w j)[m]? = some (q, e) → (j, m) = (1, A.length) := by + intro j m e h + rcases dW_cases u w j with ⟨rfl, e1⟩ | ⟨rfl, e1⟩ | e1 + · rw [e1] at h + exact (hdis _ (List.mem_of_getElem? h) _ (List.mem_of_getElem? hq0) rfl).elim + · rw [e1] at h + rw [unique_of_cnt hc2 h hq0] + · rw [e1] at h + simp at h + have hv := dW_eq u w₁ + have hv' := dW_eq u w + refine ⟨presents_glue (W := dW u w) (W₁ := dW u w₁) (i₀ := 1) (q₀ := A.length) (i₁ := 0) (p₁ + := p₁) (p := p) (q := q) + (σ := σ) (ε₀ := true) (ε₁ := true) hg hψ hsurj ?_ (by rw [dW_one]; exact hq0) + (by rw [dW_one]; exact hq1) + (by rw [dW_zero]; exact hp1) (by simp) ?_ hm1 hm0 ?_ ?_, ?_⟩ + · intro i n hn + rw [hv, hv'] + by_cases h0 : i = 0 + · simp [h0] + by_cases h1 : i = 1 + · subst h1 + simp only [one_ne_zero, ite_false, ite_true] + exact hget n fun e => hn (by rw [e]) + · simp [h0, h1] + · intro i + rw [hv, hv'] + by_cases h0 : i = 0 + · simp [h0] + by_cases h1 : i = 1 + · simp [h1, hl] + · simp [h0, h1] + · intro t ht + rw [dW_zero, dW_one, hsξ t ht, h5 t ht, L.hξ t ht, L.hη t ht] + · intro x _ y _ h6 h7 + obtain ⟨t, ht, h8⟩ := L.fib _ _ h6 h7 + refine ⟨t, ht, ?_⟩ + rw [dW_zero, dW_one, hsξ t ht, h5 t ht] + exact h8 + · refine ⟨0, p₁, by rw [dW_zero]; exact hp1, fun u' hu' => ?_⟩ + simp only [Function.comp_apply, dW_zero] + rw [hsξ u' hu', L.hξ u' hu'] + +/-! ### From two words to one -/ + +theorem two_to_one {T : Type uu} [TopologicalSpace T] [T2Space T] {A₁ B₁ A₂ B₂ : List Letter} {r : + ℕ} {σ : Bool} + (hN : NoLab (B₂ ++ A₂ ++ (B₁ ++ A₁)) r) {f : ℕ × ℂ → T} + (hf : Presents (dW (A₁ ++ (r, true) :: B₁) (A₂ ++ (r, σ) :: B₂)) f) (hne1 : B₁ ++ A₁ ≠ []) + (hne2 : B₂ ++ A₂ ≠ []) : + (σ = false → ∃ f' : ℕ × ℂ → T, Presents (sW ((B₂ ++ A₂) ++ (B₁ ++ A₁))) f') ∧ + (σ = true → ∃ f' : ℕ × ℂ → T, Presents (sW ((winv A₂ ++ winv B₂) ++ (B₁ ++ A₁))) f') := by + have c1 : PEq.{uu} (dW (A₁ ++ (r, true) :: B₁) (A₂ ++ (r, σ) :: B₂)) (dW ((r, true) :: + (B₁ ++ A₁)) (A₂ ++ (r, σ) :: B₂)) := by + have := dW_rot_left.{uu} A₁ ((r, true) :: B₁) (A₂ ++ (r, σ) :: B₂) + simpa using this + constructor + · rintro rfl + have c2 : PEq.{uu} (dW ((r, true) :: (B₁ ++ A₁)) (A₂ ++ (r, false) :: B₂)) (dW ((r, true) :: + (B₁ ++ A₁)) ((r, false) :: (B₂ ++ A₂))) := by + have := dW_rot_right.{uu} A₂ ((r, false) :: B₂) ((r, true) :: (B₁ ++ A₁)) + simpa using this + have c3 := peq_cut_sW.{uu} (y := r) true hne1 hne2 (u := B₁ ++ A₁) (v := B₂ ++ A₂) hN + exact ((c1.trans (c2.trans c3.symm)) T).mp ⟨f, hf⟩ + · rintro rfl + have c2 := dW_rev_right.{uu} (A₂ ++ (r, true) :: B₂) ((r, true) :: (B₁ ++ A₁)) + have e1 : winv (A₂ ++ (r, true) :: B₂) = winv B₂ ++ ((r, false) :: winv A₂) := by + simp [winv, linv] + rw [e1] at c2 + have c3 : PEq.{uu} (dW ((r, true) :: (B₁ ++ A₁)) (winv B₂ ++ (r, false) :: winv A₂)) + (dW ((r, true) :: (B₁ ++ A₁)) ((r, false) :: (winv A₂ ++ winv B₂))) := by + have := dW_rot_right.{uu} (winv B₂) ((r, false) :: winv A₂) ((r, true) :: (B₁ ++ A₁)) + simpa using this + have hN' : NoLab ((winv A₂ ++ winv B₂) ++ (B₁ ++ A₁)) r := by + have h1 := noLab_append.mp hN + have h2 := noLab_append.mp h1.1 + exact noLab_append.mpr ⟨noLab_append.mpr ⟨noLab_winv' h2.2, noLab_winv' h2.1⟩, h1.2⟩ + have hne : winv A₂ ++ winv B₂ ≠ [] := by + intro he + apply hne2 + obtain ⟨h1, h2⟩ := List.append_eq_nil_iff.mp he + have h3 : A₂ = [] := by simpa [winv] using h1 + have h4 : B₂ = [] := by simpa [winv] using h2 + simp [h3, h4] + have c4 := peq_cut_sW.{uu} (y := r) true hne1 hne (u := B₁ ++ A₁) (v := winv A₂ ++ winv B₂) hN' + exact ((c1.trans (c2.trans (c3.trans c4.symm))) T).mp ⟨f, hf⟩ + +/-- A list of blocks moves through a word. -/ +theorem move_blocks {U P Q Z : List Letter} (hU : Blocks U) (hP : DisjL U P) (hQ : DisjL U Q) + (hZ : DisjL U Z) : + WEq.{uu} (P ++ U ++ Q ++ Z) (P ++ Q ++ U ++ Z) := by + have c0 : WEq.{uu} (P ++ U ++ Q ++ Z) (Q ++ (Z ++ P) ++ U) := + WEq.rot' (P ++ U) (Q ++ Z) (by simp) (by simp) + have c1 : WEq.{uu} (Q ++ (Z ++ P) ++ U) (Z ++ P ++ Q ++ U) := by + simpa using slide hU hQ (hZ.append_right hP) + have c2 : WEq.{uu} (Z ++ P ++ Q ++ U) (P ++ Q ++ U ++ Z) := + WEq.rot' Z (P ++ Q ++ U) (by simp) (by simp) + exact c0.trans (c1.trans c2) + +theorem BC.blocks {H : List Letter} {a b c : ℕ} (h : BC H a b c) : Blocks H := by + induction h with + | nil => exact .nil + | hnd u v hu hX _ ih => exact .cons (.hnd u v hu) hX ih + | cap y hX _ ih => exact .cons (.cap y) hX ih + | hole t r hu hX _ ih => exact .cons (isBlock_holB hu) hX ih + +/-- The state of the procedure for a word with two sets of blocks. -/ +theorem state_merge {H₁ H₂ P Q Q' : List Letter} {a₁ b₁ c₁ a₂ b₂ c₂ : ℕ} (h₁ : BC H₁ a₁ b₁ c₁) + (h₂ : BC H₂ a₂ b₂ c₂) (hd : DisjL H₂ H₁) + (hP : DisjL (H₂ ++ H₁) (P ++ Q ++ Q')) (hG : Good (P ++ Q ++ Q')) : + ∃ X Y Z, Inv (P ++ Q ++ Q') X Y Z (a₂ + a₁) (b₂ + b₁) (c₂ + c₁) ∧ + WEq.{uu} (P ++ H₂ ++ Q ++ H₁ ++ Q') ((P ++ Q ++ Q') ++ X ++ Y ++ Z) := by + have hB := h₂.append h₁ hd + obtain ⟨w, ⟨X, Y, Z, rfl, n1, n2, n3, n4, n5, n6⟩, hc, hw⟩ := hB.nf + have s1 : DisjL H₂ (P ++ Q ++ Q') := hP.left + have d1 : DisjL H₂ P := s1.inl.inl + have d2 : DisjL H₂ Q := s1.inl.inr + have d3 : DisjL H₂ Q' := s1.inr + have d4 : DisjL H₁ (P ++ Q ++ Q') := hP.right + have c1 : WEq.{uu} (P ++ H₂ ++ Q ++ (H₁ ++ Q')) (P ++ Q ++ H₂ ++ (H₁ ++ Q')) := + move_blocks h₂.blocks d1 d2 (hd.append_right d3) + have c2 : WEq.{uu} ((P ++ Q) ++ (H₂ ++ H₁) ++ Q' ++ []) ((P ++ Q) ++ Q' ++ (H₂ ++ H₁) ++ []) := + move_blocks (P := P ++ Q) (Q := Q') (Z := []) hB.blocks hP.inl hP.inr fun l _ m hm + => by cases hm + have c3 := hw (P ++ Q ++ Q') hP + have hdR : DisjL (X ++ Y ++ Z) (P ++ Q ++ Q') := by + intro l hl + have h3 : cnt (H₂ ++ H₁) l.1 ≠ 0 := by + rw [← hc] + exact (cnt_pos hl).ne' + have h4 : l.1 = l.1 := rfl + obtain ⟨m, hm, hm'⟩ : ∃ m ∈ H₂ ++ H₁, m.1 = l.1 := by + by_contra h5 + push Not at h5 + exact h3 (noLab_iff_cnt.mp fun m hm => h5 m hm) + rw [← hm'] + exact hP m hm + refine ⟨X, Y, Z, ⟨n1, n2, n3, n4, n5, n6, hdR.left.left, hdR.left.right, hdR.right, hG⟩, ?_⟩ + have e1 : P ++ H₂ ++ Q ++ H₁ ++ Q' = P ++ H₂ ++ Q ++ (H₁ ++ Q') := by simp + have e2 : P ++ Q ++ H₂ ++ (H₁ ++ Q') = (P ++ Q) ++ (H₂ ++ H₁) ++ Q' ++ [] := by simp + have e3 : (P ++ Q) ++ Q' ++ (H₂ ++ H₁) ++ [] = P ++ Q ++ Q' ++ (H₂ ++ H₁) := by simp + have e4 : P ++ Q ++ Q' ++ (X ++ Y ++ Z) = P ++ Q ++ Q' ++ X ++ Y ++ Z := by simp + rw [e1, ← e4] + rw [e2] at c1 + rw [e3] at c2 + exact c1.trans (c2.trans c3) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutTwoArc.lean b/LeanPool/GraphMinor/Surface/CutTwoArc.lean new file mode 100644 index 0000000000..1c26bed9b7 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutTwoArc.lean @@ -0,0 +1,236 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutTwoWords + +/-! +# Arcs with lifts in two components + +If the two lifts of an arc lie in different components of the cut surface, then each component has a +word with the lift as a +side, and pasting these sides gives a family of two words for the surface before cutting +(`arc_two_comps`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function + +universe uu + +theorem rW_labels_lt {a b c : ℕ} {L : List ℕ} (hL : ∀ m ∈ L, m < c) : ∀ l ∈ rW a b c L, l.1 < frL a + b c := by + intro l hl + simp only [rW, frL, List.mem_append] at hl ⊢ + rcases hl with ((hl | hl) | hl) | hl + · have := (hW_labels _ _ l hl).2 + omega + · have := (cW_labels _ _ l hl).2 + omega + · obtain ⟨m, h1, h2⟩ := hlW_labels l hl + have := hL m h1 + omega + · simp only [eW, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl <;> simp + +theorem erase_facts (c i : ℕ) : ((List.range' 0 c).erase i).Nodup ∧ ∀ m ∈ + (List.range' 0 c).erase i, m < c ∧ m ≠ i := by + have h := List.nodup_range' (s := 0) (n := c) + refine ⟨h.erase _, fun m hm => ?_⟩ + obtain ⟨h1, h2⟩ := (h.mem_erase_iff).mp hm + have h3 := List.mem_range'_1.mp h2 + exact ⟨by omega, h1⟩ + +theorem length_erase_range {c i : ℕ} (h : i < c) : ((List.range' 0 c).erase i).length = c - 1 := by + rw [List.length_erase_of_mem (List.mem_range'_1.mpr (by omega))] + simp + +/-- The set `C`, as a subset of the big space. -/ +noncomputable def hatC {Y : Type*} [TopologicalSpace Y] {W : Set Y} {C : Set W} (φ : Circle ≃ₜ C) : + Circle ≃ₜ (Subtype.val '' C : Set Y) := + φ.trans (IsEmbedding.subtypeVal.homeomorphImage C) + +theorem hatC_val {Y : Type*} [TopologicalSpace Y] {W : Set Y} {C : Set W} (φ : Circle ≃ₜ C) + (x : Circle) : + (hatC φ x).1 = (φ x).1.1 := rfl + +/-- A connected part of the boundary inside an open part lies in one cuff of this part. -/ +theorem exists_cuff_sub {Y : Type*} [TopologicalSpace Y] {W K : Set Y} (hW : IsOpen W) + (hK : IsPreconnected K) (hne : K.Nonempty) + (hsub : K ⊆ W) (hb : K ⊆ bd Y) : ∃ C ∈ cuffs W, K ⊆ Subtype.val '' C := by + obtain ⟨x, hx⟩ := hne + have h1 : (Subtype.val ⁻¹' K : Set W) ⊆ bd W := fun z hz => (mem_bd_sub hW).mpr (hb hz) + have h2 : IsPreconnected (Subtype.val ⁻¹' K : Set W) := by + refine (IsInducing.subtypeVal.isPreconnected_image).mp ?_ + rw [Subtype.image_preimage_coe, inter_eq_right.mpr hsub] + exact hK + have hx' : (⟨x, hsub hx⟩ : W) ∈ (Subtype.val ⁻¹' K : Set W) := hx + refine ⟨_, ⟨_, h1 hx', rfl⟩, fun z hz => ?_⟩ + exact ⟨⟨z, hsub hz⟩, h2.subset_connectedComponentIn hx' h1 hz, rfl⟩ + +section + +variable {Y S : Type*} [TopologicalSpace Y] [TopologicalSpace S] {ψ : Y → S} {F : Set S} {a₀ : ℝ + → S} {ξ η : ℝ → Y} + +/-- Two pieces of the family, pasted. -/ +theorem two_gl (L₀ : ArcLift ψ F a₀ ξ η) (hψc : Continuous ψ) (hsurj : Surjective ψ) {W₁ W₂ : Set + Y} (hd : Disjoint W₁ W₂) + (hU : W₁ ∪ W₂ = univ) {u A B : List Letter} {p q p₁ : ℕ} {σ : Bool} (hp1 : u[p₁]? = some + (p, true)) (hc1 : cnt u p = 1) + (hc2 : cnt (A ++ (q, true) :: B) q = 1) (hdis : DisjL u (A ++ (q, true) :: B)) {g₁ : ℕ × ℂ + → W₁} {g₂ : ℕ × ℂ → W₂} + (h₁ : Presents (sW u) g₁) (h₂ : Presents (sW (A ++ (q, true) :: B)) g₂) {ρ₁ : ℝ → W₁} {ρ₂ : ℝ + → W₂} + (hs₁ : SideVal (sW u) g₁ p ρ₁) (hs₂ : SideVal (sW (A ++ (q, true) :: B)) g₂ q ρ₂) + (he₁ : ∀ t ∈ Icc (0 : ℝ) 1, (ρ₁ t).1 = ξ t) + (he₂ : ∀ t ∈ Icc (0 : ℝ) 1, (ρ₂ (ofs σ t)).1 = η t) : + Presents (dW u (A ++ (p, σ) :: B)) (ψ ∘ glW g₁ g₂) ∧ SideVal (dW u (A ++ (p, σ) :: B)) + (ψ ∘ glW g₁ g₂) p a₀ := by + have hne : u ≠ [] := by + rintro rfl + simp at hp1 + have hq : (A ++ (q, true) :: B)[A.length]? = some (q, true) := by simp + refine glue_two L₀ hψc hsurj (ζ := fun t => (ρ₂ t).1) hp1 hc1 hc2 hdis (presents_dW hne + (by simp) hdis hd hU h₁ h₂) rfl + (fun t ht => ?_) (fun t ht => ?_) he₂ + · simp only [glW, ite_true] + rw [hs₁.at_word hp1 hc1 t ht, he₁ t ht] + · simp only [glW, one_ne_zero, ite_false] + rw [hs₂.at_word hq hc2 t ht] + +end + +/-- Counts labels in an explicit word whose tail has known counts. -/ +local macro "ct" : tactic => + `(tactic| ((try simp only [hB, holB, List.cons_append, List.nil_append, List.append_assoc, + cnt_append, cnt_cons, cnt_nil, tL, rL, frL, linv, Prod.fst, *]); (try split_ifs) <;> omega)) + +section + +variable {Y S : Type uu} [TopologicalSpace Y] [T2Space Y] [TopologicalSpace S] {ψ : Y + → S} {F : Set S} {a₀ : ℝ → S} {ξ η : ℝ → Y} + {a₁ b₁ c₁ a₂ b₂ c₂ : ℕ} + +/-- Each component has the lift as a side. -/ +theorem arc_comps_aux (hS : IsSurface Y) (L₀ : ArcLift ψ F a₀ ξ η) (hψc : Continuous ψ) + (hsurj : Surjective ψ) {W₁ W₂ : Set Y} + (hW₁ : IsClopen W₁) (hW₂ : IsClopen W₂) (hd : Disjoint W₁ W₂) (hU : W₁ ∪ W₂ = univ) + (e₁ : W₁ ≃ₜ SurfaceModel a₁ b₁ c₁) + (e₂ : W₂ ≃ₜ SurfaceModel a₂ b₂ c₂) (hξ1 : ξ '' Icc 0 1 ⊆ W₁) (hη1 : η '' Icc 0 1 ⊆ W₂) + (hξ2 : ξ '' Icc 0 1 ⊆ bd Y) + (hη2 : η '' Icc 0 1 ⊆ bd Y) (hiξ : InjOn ξ (Icc 0 1)) (hiη : InjOn η (Icc 0 1)) : + ∃ (i j : ℕ) (σ : Bool) (a' : ℝ → S) (f : ℕ × ℂ → S), i < c₁ ∧ j < c₂ ∧ a' '' Icc 0 1 = F ∧ + ((a' 0 = a₀ 0 ∧ a' 1 = a₀ 1) ∨ (a' 0 = a₀ 1 ∧ a' 1 = a₀ 0)) ∧ + Presents (dW (wArc₁ a₁ b₁ c₁ i ((List.range' 0 c₁).erase i)) + (wArc₂ a₂ b₂ c₂ j ((List.range' 0 c₂).erase j) (frL a₁ b₁ c₁ + 1) ((rL a₁ b₁ i).1, σ))) f ∧ + SideVal (dW (wArc₁ a₁ b₁ c₁ i ((List.range' 0 c₁).erase i)) + (wArc₂ a₂ b₂ c₂ j ((List.range' 0 c₂).erase j) (frL a₁ b₁ c₁ + 1) ((rL a₁ b₁ i).1, σ))) f + (rL a₁ b₁ i).1 a' := by + have hS₁ := isSurface_sub hS hW₁ + have hS₂ := isSurface_sub hS hW₂ + have hne : (Icc (0 : ℝ) 1).Nonempty := ⟨0, by simp⟩ + obtain ⟨C₁, hC₁, hsC₁⟩ := exists_cuff_sub hW₁.2 (isPreconnected_Icc.image _ L₀.cξ) + (hne.image _) hξ1 hξ2 + obtain ⟨C₂, hC₂, hsC₂⟩ := exists_cuff_sub hW₂.2 (isPreconnected_Icc.image _ L₀.cη) + (hne.image _) hη1 hη2 + obtain ⟨i, hi, φ₁, g₁, hg₁, hs₁⟩ := exists_one_hole e₁ hC₁ + obtain ⟨j, hj, φ₂, g₂, hg₂, hs₂⟩ := exists_one_hole e₂ hC₂ + have hRange₁ : range (hatC φ₁) = univ := (hatC φ₁).surjective.range_eq + have hRange₂ : range (hatC φ₂) = univ := (hatC φ₂).surjective.range_eq + obtain ⟨a', ξ', η', m, L', ha', hxim, heim, hix, hie, hmc, hmm, hmξ⟩ := orient_lift L₀ (hatC φ₁) + (fun u hu => hsC₁ ⟨u, hu, rfl⟩) hiξ hiη + have hη' : ∀ u ∈ Icc (0 : ℝ) 1, η' u ∈ (Subtype.val '' C₂ : Set Y) := fun u hu => hsC₂ + (heim ▸ ⟨u, hu, rfl⟩) + obtain ⟨n, n1, n2⟩ := exists_lift (hatC φ₂) L'.cη hη' + obtain ⟨σ, n', c', s', h3, h4⟩ := exists_dir n1 (lift_mono n1 (inj_of_lift n2 hie)) + (inj_of_lift n2 hie) + have hlt := lift_lt_add_one hmc (inj_of_lift hmξ hix) + have hlt' := lift_lt_add_one c' h4 + obtain ⟨hN₁, hL₁⟩ := erase_facts c₁ i + obtain ⟨hN₂, hL₂⟩ := erase_facts c₂ j + set L₁ := (List.range' 0 c₁).erase i + set L₂ := (List.range' 0 c₂).erase j + have c1 : cnt (rW a₁ b₁ c₁ L₁) (2 * a₁ + b₁ + 2 * i + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL₁ m hm + omega + have c3 : cnt (rW a₁ b₁ c₁ L₁) (2 * a₁ + b₁ + 2 * c₁ + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL₁ m hm + omega + have c1' : cnt (rW a₂ b₂ c₂ L₂) (2 * a₂ + b₂ + 2 * j + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL₂ m hm + omega + have c3' : cnt (rW a₂ b₂ c₂ L₂) (2 * a₂ + b₂ + 2 * c₂ + 1) = 0 := cnt_rW_zero (by omega) + (by omega) fun m hm => by + have := hL₂ m hm + omega + have hl₁ : ∀ l ∈ wArc₁ a₁ b₁ c₁ i L₁, l.1 < frL a₁ b₁ c₁ + 1 := by + intro l hl + simp only [wArc₁, List.cons_append, List.nil_append, List.mem_cons, tL, rL, linv, frL] at hl + rcases hl with rfl | rfl | rfl | rfl | hl + · simp only [frL]; omega + · simp only [frL]; omega + · simp only [frL]; omega + · simp only [frL]; omega + · have := rW_labels_lt (fun m hm => (hL₁ m hm).1) l hl + omega + have e0 : ∀ a b c i' (L : List ℕ), hB a b i' ++ rW a b c L = [tL a b i'] ++ + ((rL a b i').1, true) :: (linv (tL a b i') :: rW a b c L) := by + intro a b c i' L + simp [hB, holB, rL] + rw [e0] at hg₁ hs₁ hg₂ hs₂ + obtain ⟨g₁', p1, p2, -, -⟩ := exists_pieces2 hS₁ hC₁ isOpen_univ (subset_univ _) φ₁ (q + := frL a₁ b₁ c₁) + (by simp [rL, frL]; omega) (noLab_iff_cnt.mpr (by ct)) (noLab_iff_cnt.mpr (by ct)) hg₁ hs₁ hmc + (continuousOn_lin _ _) hmm (strictMonoOn_lin hlt) + (lin_zero _ _).symm (lin_one _ _) + obtain ⟨g₂', p3, p4, -, -⟩ := exists_pieces2 hS₂ hC₂ isOpen_univ (subset_univ _) φ₂ (q + := frL a₂ b₂ c₂) + (by simp [rL, frL]; omega) (noLab_iff_cnt.mpr (by ct)) (noLab_iff_cnt.mpr (by ct)) hg₂ hs₂ c' + (continuousOn_lin _ _) s' (strictMonoOn_lin hlt') + (lin_zero _ _).symm (lin_one _ _) + set M := frL a₁ b₁ c₁ + 1 + have p5 := presents_shW M p3 + have p6 := p4.shW M + have e1 : shW M ([tL a₂ b₂ j] ++ ((rL a₂ b₂ j).1, true) :: (frL a₂ b₂ c₂, true) :: linv + (tL a₂ b₂ j) :: rW a₂ b₂ c₂ L₂) = + [((tL a₂ b₂ j).1 + M, true)] ++ ((rL a₂ b₂ j).1 + M, true) :: + ((frL a₂ b₂ c₂ + M, true) :: ((tL a₂ b₂ j).1 + M, false) :: shW M (rW a₂ b₂ c₂ L₂)) := by + simp [shW, tL, linv] + rw [e1] at p5 p6 + have c5 : cnt (shW M (rW a₂ b₂ c₂ L₂)) (2 * a₂ + b₂ + 2 * j + 1 + M) = 0 := + noLab_iff_cnt.mp (noLab_shW_of fun k' he => by + have : k' = 2 * a₂ + b₂ + 2 * j + 1 := by omega + subst this + exact noLab_iff_cnt.mpr c1') + have hcq : cnt ([((tL a₂ b₂ j).1 + M, true)] ++ ((rL a₂ b₂ j).1 + M, true) :: + ((frL a₂ b₂ c₂ + M, true) :: ((tL a₂ b₂ j).1 + M, false) :: shW M (rW a₂ b₂ c₂ L₂))) + ((rL a₂ b₂ j).1 + M) = 1 := by + simp only [List.cons_append, List.nil_append, cnt_cons, tL, rL, frL, c5] + split_ifs <;> omega + obtain ⟨p7, p8⟩ := two_gl L' hψc hsurj hd hU (p₁ := 1) (u := wArc₁ a₁ b₁ c₁ i L₁) (p := + (rL a₁ b₁ i).1) (σ := σ) rfl + (by simp only [wArc₁]; ct) hcq (by + rw [← e1] + intro l hl + have := hl₁ l hl + exact noLab_shW_of fun k' he => by omega) p1 p5 p2 p6 (fun t ht => hmξ t ht) (fun t ht => by + simp only [h3 t ht] + exact n2 t ht) + exact ⟨i, j, σ, a', _, hi, hj, L'.img, ha', p7, p8⟩ + +end + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutTwoWords.lean b/LeanPool/GraphMinor/Surface/CutTwoWords.lean new file mode 100644 index 0000000000..7da12ff3c0 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutTwoWords.lean @@ -0,0 +1,411 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutTwo + +/-! +# Words for two components + +The two components of a cut surface have the words `rW`, up to a shift of the labels of the second +word. Pasting one side of +the first word to a side of the second word gives a family of two words. Here we find the surface +that this family presents +(`homeo_of_two_arc`, `homeo_of_two_loop`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set + +universe uu + +/-- The word with labels shifted by `M`. -/ +def shW (M : ℕ) (w : List Letter) : List Letter := w.map fun l => (l.1 + M, l.2) + +theorem shW_append (M : ℕ) (a b : List Letter) : shW M (a ++ b) = shW M a ++ shW M b := by + simp [shW] + +theorem shW_cons (M : ℕ) (x : Letter) (b : List Letter) : shW M (x :: b) = + (x.1 + M, x.2) :: shW M b := by simp [shW] + +theorem shW_hndB (M : ℕ) (u v : Letter) : shW M (hndB u v) = hndB (u.1 + M, u.2) (v.1 + M, v.2) + := by simp [shW, hndB, linv] + +theorem shW_holB (M : ℕ) (t r : Letter) : shW M (holB t r) = holB (t.1 + M, t.2) (r.1 + M, r.2) + := by simp [shW, holB, linv] + +theorem noLab_shW_of {w : List Letter} {M k : ℕ} (h : ∀ k', k = k' + M → NoLab w k') : NoLab + (shW M w) k := by + intro l hl he + obtain ⟨l', hl', rfl⟩ := List.mem_map.mp hl + exact h l'.1 he.symm l' hl' rfl + +theorem disjL_shW {A B : List Letter} (M : ℕ) (h : DisjL A B) : DisjL (shW M A) (shW M B) := by + intro l hl + obtain ⟨l', hl', rfl⟩ := List.mem_map.mp hl + refine noLab_shW_of fun k' he => ?_ + have : l'.1 = k' := by simpa using he + exact this ▸ h l' hl' + +theorem BC.shift {H : List Letter} {a b c : ℕ} (M : ℕ) (h : BC H a b c) : BC (shW M H) a b c := by + induction h with + | nil => exact .nil + | hnd u v hu hX _ ih => + rw [shW_append, shW_hndB] + refine .hnd _ _ (by simpa using hu) ?_ ih + rw [← shW_hndB] + exact disjL_shW M hX + | cap y hX _ ih => + rw [shW_append] + have e : shW M [y, y] = [(y.1 + M, y.2), (y.1 + M, y.2)] := rfl + rw [e] + refine .cap _ ?_ ih + rw [← e] + exact disjL_shW M hX + | hole t r hu hX _ ih => + rw [shW_append, shW_holB] + refine .hole _ _ (by simpa using hu) ?_ ih + rw [← shW_holB] + exact disjL_shW M hX + +theorem relab_sW_shift (M : ℕ) (w : List Letter) : relab (· + M) (sW w) = sW (shW M w) := by + funext i + by_cases hi : i = 0 + · subst hi + simp [relab, sW_zero, shW] + · simp [relab, sW, hi, nW] + +theorem presents_shW {T : Type*} [TopologicalSpace T] (M : ℕ) {w : List Letter} {f : ℕ × ℂ → T} + (hf : Presents (sW w) f) : + Presents (sW (shW M w)) f := by + rw [← relab_sW_shift] + exact (presents_relab (fun _ _ _ _ _ _ h => Nat.add_right_cancel h) f).mp hf + +theorem SideVal.shW {T : Type*} {w : List Letter} {f : ℕ × ℂ → T} {k : ℕ} {ρ : ℝ → T} (h : SideVal + (sW w) f k ρ) (M : ℕ) : + SideVal (sW (shW M w)) f (k + M) ρ := by + obtain ⟨i, p, h1, h2⟩ := h + obtain ⟨rfl, h3⟩ := sW_get h1 + rw [sW_zero] at h2 + refine ⟨0, p, ?_, fun u hu => ?_⟩ + · rw [sW_zero] + simp [GraphMinor.Surface.shW, h3] + · rw [sW_zero] + have : (GraphMinor.Surface.shW M w).length = w.length := by simp [GraphMinor.Surface.shW] + rw [this] + exact h2 u hu + +/-- All blocks of the normal word without the two last letters. -/ +def hH (a b : ℕ) (L : List ℕ) : List Letter := hW 0 a ++ cW (2 * a) b ++ hlW (2 * a + b) L + +theorem rW_eq (a b c : ℕ) (L : List ℕ) : rW a b c L = hH a b L ++ eW a b c := rfl + +theorem bc_hH (a b : ℕ) {L : List ℕ} (hL : L.Nodup) : BC (hH a b L) a b L.length := by + have h1 := (hL_hW 0 a).bc + have h2 := (cL_cW (2 * a) b).bc + have h3 := (tL_hlW (2 * a + b) hL).bc + have d1 : DisjL (hW 0 a) (cW (2 * a) b) := by + intro l hl m hm he + have h4 := (hW_labels _ _ l hl).2 + have h5 := (cW_labels _ _ m hm).1 + omega + have d2 : DisjL (hW 0 a) (hlW (2 * a + b) L) := by + intro l hl + have h4 := (hW_labels _ _ l hl).2 + exact noLab_hlW fun m _ => by omega + have d3 : DisjL (cW (2 * a) b) (hlW (2 * a + b) L) := by + intro l hl + have h4 := (cW_labels _ _ l hl).2 + exact noLab_hlW fun m _ => by omega + simpa [hH] using (h1.append h2 d1).append h3 (d2.append_left d3) + +theorem noLab_hH {a b k : ℕ} {L : List ℕ} (h1 : 2 * a + b ≤ k) + (h3 : ∀ m ∈ L, k ≠ 2 * a + b + 2 * m ∧ k ≠ 2 * a + b + 2 * m + 1) : NoLab (hH a b L) k := by + refine noLab_append.mpr ⟨noLab_append.mpr ⟨fun l hl he => ?_, fun l hl he => ?_⟩, noLab_hlW h3⟩ + · have := (hW_labels 0 a l hl).2 + omega + · have := (cW_labels (2 * a) b l hl).2 + omega + +theorem winv_eW (a b c : ℕ) : winv (eW a b c) = eW a b c := by simp [winv, eW, linv] + +section + +variable {a₁ b₁ c₁ a₂ b₂ c₂ i j : ℕ} {L₁ L₂ : List ℕ} {σ : Bool} {T : Type uu} [TopologicalSpace T] + [T2Space T] [Nonempty T] + {f : ℕ × ℂ → T} + +/-- The first word for an arc. -/ +def wArc₁ (a b c i : ℕ) (L : List ℕ) : List Letter := + [tL a b i, rL a b i, (frL a b c, true), linv (tL a b i)] ++ rW a b c L + +/-- The second word for an arc, with `s` in place of the side to paste. -/ +def wArc₂ (a b c i : ℕ) (L : List ℕ) (M : ℕ) (s : Letter) : List Letter := + [((tL a b i).1 + M, true)] ++ s :: ((frL a b c + M, true) :: ((tL a b i).1 + M, false) :: shW M + (rW a b c L)) + +/-- The first word for an `O`-arc. -/ +def wLoop₁ (a b c i : ℕ) (L : List ℕ) : List Letter := hB a b i ++ rW a b c L + +/-- The second word for an `O`-arc, with `s` in place of the side to paste. -/ +def wLoop₂ (a b c i : ℕ) (L : List ℕ) (M : ℕ) (s : Letter) : List Letter := + [((tL a b i).1 + M, true)] ++ s :: (((tL a b i).1 + M, false) :: shW M (rW a b c L)) + +theorem noLab_two {M k : ℕ} (hk1 : 2 * a₁ + b₁ ≤ k) (hk2 : ∀ m ∈ L₁, k ≠ 2 * a₁ + b₁ + 2 * m + ∧ k ≠ 2 * a₁ + b₁ + 2 * m + 1) + (hk3 : ∀ k', k = k' + M → 2 * a₂ + b₂ ≤ k' ∧ ∀ m ∈ L₂, k' ≠ 2 * a₂ + b₂ + 2 * m + ∧ k' ≠ 2 * a₂ + b₂ + 2 * m + 1) : + NoLab (shW M (hH a₂ b₂ L₂) ++ hH a₁ b₁ L₁) k := + noLab_append.mpr ⟨noLab_shW_of fun k' he => noLab_hH (hk3 k' he).1 (hk3 k' he).2, noLab_hH hk1 + hk2⟩ + +theorem noLab_two' {M k : ℕ} (hk1 : 2 * a₁ + b₁ ≤ k) (hk2 : ∀ m ∈ L₁, k ≠ 2 * a₁ + b₁ + 2 * m + ∧ k ≠ 2 * a₁ + b₁ + 2 * m + 1) + (hk3 : ∀ k', k = k' + M → 2 * a₂ + b₂ ≤ k' ∧ ∀ m ∈ L₂, k' ≠ 2 * a₂ + b₂ + 2 * m + ∧ k' ≠ 2 * a₂ + b₂ + 2 * m + 1) : + NoLab (winv (shW M (hH a₂ b₂ L₂)) ++ hH a₁ b₁ L₁) k := + noLab_append.mpr ⟨noLab_winv' (noLab_shW_of fun k' he => noLab_hH (hk3 k' he).1 + (hk3 k' he).2), noLab_hH hk1 hk2⟩ + +theorem disj_hH (hL₁ : ∀ m ∈ L₁, m < c₁) {M : ℕ} (hM : 2 * a₁ + b₁ + 2 * c₁ ≤ M) : DisjL (shW M + (hH a₂ b₂ L₂)) (hH a₁ b₁ L₁) := by + refine fun l hl => ?_ + obtain ⟨l', -, rfl⟩ := List.mem_map.mp hl + refine noLab_hH (by simp only; omega) fun m hm => ?_ + have := hL₁ m hm + simp only + omega + +theorem winv_nil : winv [] = [] := rfl + +theorem shW_eW (M a b c : ℕ) : shW M (eW a b c) = [(2 * a + b + 2 * c + M, true), + (2 * a + b + 2 * c + M, false)] := rfl + +theorem winv_shW_eW (M a b c : ℕ) : winv (shW M (eW a b c)) = shW M (eW a b c) := by + simp [shW_eW, winv, linv] + +private theorem cut_words_setup (hi : i < c₁) (hN₁ : L₁.Nodup) (hN₂ : L₂.Nodup) + (hL₁ : ∀ m ∈ L₁, m < c₁ ∧ m ≠ i) : + BC (hH a₁ b₁ L₁) a₁ b₁ L₁.length ∧ + BC (shW (frL a₁ b₁ c₁ + 1) (hH a₂ b₂ L₂)) a₂ b₂ L₂.length ∧ + DisjL (shW (frL a₁ b₁ c₁ + 1) (hH a₂ b₂ L₂)) (hH a₁ b₁ L₁) ∧ + cnt (rW a₁ b₁ c₁ L₁) (rL a₁ b₁ i).1 = 0 ∧ + cnt (shW (frL a₁ b₁ c₁ + 1) (rW a₂ b₂ c₂ L₂)) (rL a₁ b₁ i).1 = 0 := by + refine ⟨bc_hH a₁ b₁ hN₁, (bc_hH a₂ b₂ hN₂).shift _, ?_, ?_, ?_⟩ + · exact disj_hH (fun m hm => (hL₁ m hm).1) (by simp only [frL]; omega) + · simp only [rL] + refine cnt_rW_zero (by omega) (by omega) fun m hm => ?_ + have := hL₁ m hm + omega + · exact noLab_iff_cnt.mp (noLab_shW_of fun k' he => by simp only [rL, frL] at he; omega) + +private theorem cut_word_extra_labels (hi : i < c₁) (hj : j < c₂) + (hL₁ : ∀ m ∈ L₁, m < c₁ ∧ m ≠ i) (hL₂ : ∀ m ∈ L₂, m < c₂ ∧ m ≠ j) + {k : ℕ} (hk : k ∈ [(tL a₁ b₁ i).1, 2 * a₁ + b₁ + 2 * c₁, frL a₁ b₁ c₁, + (tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), + 2 * a₂ + b₂ + 2 * c₂ + (frL a₁ b₁ c₁ + 1), + frL a₂ b₂ c₂ + (frL a₁ b₁ c₁ + 1)]) : + NoLab (shW (frL a₁ b₁ c₁ + 1) (hH a₂ b₂ L₂) ++ hH a₁ b₁ L₁) k ∧ + NoLab (winv (shW (frL a₁ b₁ c₁ + 1) (hH a₂ b₂ L₂)) ++ hH a₁ b₁ L₁) k := by + have h : NoLab (shW (frL a₁ b₁ c₁ + 1) (hH a₂ b₂ L₂) ++ hH a₁ b₁ L₁) k := by + simp only [tL, frL, List.mem_cons, List.not_mem_nil, or_false] at hk + rcases hk with rfl | rfl | rfl | rfl | rfl | rfl <;> + · refine noLab_two (M := frL a₁ b₁ c₁ + 1) (by omega) (fun m hm => ?_) (fun k' he => ?_) + · have := hL₁ m hm + omega + · simp only [frL] at he + exact ⟨by omega, fun m hm => by have := hL₂ m hm; omega⟩ + exact ⟨h, by simpa only [noLab_append, noLab_winv] using h⟩ + +private theorem good_cut_word (hi : i < c₁) (hj : j < c₂) : + Good [tL a₁ b₁ i, linv (tL a₁ b₁ i), (2 * a₁ + b₁ + 2 * c₁, true), + (2 * a₁ + b₁ + 2 * c₁, false), (frL a₁ b₁ c₁, true), + ((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), true), + ((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), false), + (2 * a₂ + b₂ + 2 * c₂ + (frL a₁ b₁ c₁ + 1), true), + (2 * a₂ + b₂ + 2 * c₂ + (frL a₁ b₁ c₁ + 1), false), + (frL a₂ b₂ c₂ + (frL a₁ b₁ c₁ + 1), true)] := by + intro k + simp only [tL, frL, linv, cnt_cons, cnt_nil] + split_ifs <;> omega + +/-- The letters of the second word, read in the order of the first word. -/ +theorem homeo_of_two_arc (hi : i < c₁) (hj : j < c₂) (hN₁ : L₁.Nodup) (hN₂ : L₂.Nodup) + (hL₁ : ∀ m ∈ L₁, m < c₁ ∧ m ≠ i) + (hL₂ : ∀ m ∈ L₂, m < c₂ ∧ m ≠ j) + (hf : Presents (dW (wArc₁ a₁ b₁ c₁ i L₁) (wArc₂ a₂ b₂ c₂ j L₂ (frL a₁ b₁ c₁ + 1) + ((rL a₁ b₁ i).1, σ))) f) : + Nonempty (T ≃ₜ SurfaceModel (a₂ + a₁) (b₂ + b₁) (L₂.length + L₁.length + 1)) := by + obtain ⟨bc₁, bc₂, hd, c1, c2⟩ := + cut_words_setup (c₂ := c₂) (a₂ := a₂) (b₂ := b₂) (L₂ := L₂) hi hN₁ hN₂ hL₁ + change cnt (rW a₁ b₁ c₁ L₁) (2 * a₁ + b₁ + 2 * i + 1) = 0 at c1 + change cnt (shW (frL a₁ b₁ c₁ + 1) (rW a₂ b₂ c₂ L₂)) (2 * a₁ + b₁ + 2 * i + 1) = 0 at c2 + have hLabels {k : ℕ} := + cut_word_extra_labels (a₁ := a₁) (b₁ := b₁) (a₂ := a₂) (b₂ := b₂) hi hj hL₁ hL₂ (k := k) + have hGood := good_cut_word (a₁ := a₁) (b₁ := b₁) (a₂ := a₂) (b₂ := b₂) hi hj + obtain ⟨h1, h2⟩ := two_to_one (T := T) (A₁ := [tL a₁ b₁ i]) (B₁ := (frL a₁ b₁ c₁, true) :: linv + (tL a₁ b₁ i) :: rW a₁ b₁ c₁ L₁) + (A₂ := [((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), true)]) + (B₂ := (frL a₂ b₂ c₂ + (frL a₁ b₁ c₁ + 1), true) :: ((tL a₂ b₂ j).1 + + (frL a₁ b₁ c₁ + 1), false) :: shW (frL a₁ b₁ c₁ + 1) (rW a₂ b₂ c₂ L₂)) + (r := (rL a₁ b₁ i).1) (σ := σ) (noLab_iff_cnt.mpr (by + simp only [List.cons_append, List.nil_append, List.append_assoc, cnt_append, cnt_cons, + cnt_nil, tL, rL, frL, linv, c1, c2] at * + split_ifs <;> omega)) hf (by simp) (by simp) + cases σ with + | false => + obtain ⟨f', hf'⟩ := h1 rfl + obtain ⟨X, Y, Z, h3, h4⟩ := state_merge bc₁ bc₂ hd + (P := [(frL a₂ b₂ c₂ + (frL a₁ b₁ c₁ + 1), true), ((tL a₂ b₂ j).1 + + (frL a₁ b₁ c₁ + 1), false)]) + (Q := shW (frL a₁ b₁ c₁ + 1) (eW a₂ b₂ c₂) ++ [((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), true), + (frL a₁ b₁ c₁, true), linv (tL a₁ b₁ i)]) + (Q' := eW a₁ b₁ c₁ ++ [tL a₁ b₁ i]) (DisjL.symm (by + intro l hl + refine (hLabels (k := l.1) ?_).1 + simp only [shW_eW] at hl + simp only [eW, tL, frL, linv, List.cons_append, List.nil_append, + List.mem_cons, List.not_mem_nil, or_false] at hl ⊢ + rcases hl with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl <;> simp)) (by + intro k + have hCount := hGood k + simp only [shW_eW] + simp only [eW, tL, frL, linv, List.cons_append, List.nil_append, + cnt_cons, cnt_nil] at hCount ⊢ + omega) + obtain ⟨w, h5, h6⟩ := nf_caseC_neg.{uu} (x₁ := (2 * a₁ + b₁ + 2 * c₁, true)) (x₂ := + (2 * a₂ + b₂ + 2 * c₂ + (frL a₁ b₁ c₁ + 1), true)) + (g₂ := (frL a₂ b₂ c₂ + (frL a₁ b₁ c₁ + 1), true)) (g₁ := (frL a₁ b₁ c₁, true)) (t₂ := + ((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), true)) + (t₁ := tL a₁ b₁ i) h3 (by simp only [frL]; omega) + refine homeo_of_nf (w₀ := _) (f := f') ?_ h5 (h4.trans h6) + convert hf' using 2 + simp [rW_eq, shW_append] + | true => + obtain ⟨f', hf'⟩ := h2 rfl + obtain ⟨X, Y, Z, h3, h4⟩ := state_merge bc₁ bc₂.winv hd.winv_left + (P := [((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), false)] ++ shW (frL a₁ b₁ c₁ + 1) (eW a₂ b₂ c₂)) + (Q := [((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), true), (frL a₂ b₂ c₂ + + (frL a₁ b₁ c₁ + 1), false), (frL a₁ b₁ c₁, true), linv (tL a₁ b₁ i)]) + (Q' := eW a₁ b₁ c₁ ++ [tL a₁ b₁ i]) (DisjL.symm (by + intro l hl + refine (hLabels (k := l.1) ?_).2 + simp only [shW_eW] at hl + simp only [eW, tL, frL, linv, List.cons_append, List.nil_append, + List.mem_cons, List.not_mem_nil, or_false] at hl ⊢ + rcases hl with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl <;> simp)) (by + intro k + have hCount := hGood k + simp only [shW_eW] + simp only [eW, tL, frL, linv, List.cons_append, List.nil_append, + cnt_cons, cnt_nil] at hCount ⊢ + omega) + obtain ⟨w, h5, h6⟩ := nf_caseC_pos.{uu} (x₁ := (2 * a₁ + b₁ + 2 * c₁, true)) (x₂ := + (2 * a₂ + b₂ + 2 * c₂ + (frL a₁ b₁ c₁ + 1), true)) + (g₂ := (frL a₂ b₂ c₂ + (frL a₁ b₁ c₁ + 1), false)) (g₁ := (frL a₁ b₁ c₁, true)) (t₂ := + ((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), true)) + (t₁ := tL a₁ b₁ i) h3 (by simp only [frL]; omega) + refine homeo_of_nf (w₀ := _) (f := f') ?_ h5 (h4.trans h6) + convert hf' using 2 + simp [rW_eq, shW_append, winv_append, winv_cons, winv_shW_eW, winv_nil, linv] + +/-- The surface with two components glued along a whole cuff. -/ +theorem homeo_of_two_loop (hi : i < c₁) (hj : j < c₂) (hN₁ : L₁.Nodup) (hN₂ : L₂.Nodup) + (hL₁ : ∀ m ∈ L₁, m < c₁ ∧ m ≠ i) + (hL₂ : ∀ m ∈ L₂, m < c₂ ∧ m ≠ j) + (hf : Presents (dW (wLoop₁ a₁ b₁ c₁ i L₁) (wLoop₂ a₂ b₂ c₂ j L₂ (frL a₁ b₁ c₁ + 1) + ((rL a₁ b₁ i).1, σ))) f) : + Nonempty (T ≃ₜ SurfaceModel (a₂ + a₁) (b₂ + b₁) (L₂.length + L₁.length)) := by + obtain ⟨bc₁, bc₂, hd, c1, c2⟩ := + cut_words_setup (c₂ := c₂) (a₂ := a₂) (b₂ := b₂) (L₂ := L₂) hi hN₁ hN₂ hL₁ + change cnt (rW a₁ b₁ c₁ L₁) (2 * a₁ + b₁ + 2 * i + 1) = 0 at c1 + change cnt (shW (frL a₁ b₁ c₁ + 1) (rW a₂ b₂ c₂ L₂)) (2 * a₁ + b₁ + 2 * i + 1) = 0 at c2 + have hLabels {k : ℕ} := + cut_word_extra_labels (a₁ := a₁) (b₁ := b₁) (a₂ := a₂) (b₂ := b₂) hi hj hL₁ hL₂ (k := k) + have hGood := good_cut_word (a₁ := a₁) (b₁ := b₁) (a₂ := a₂) (b₂ := b₂) hi hj + obtain ⟨h1, h2⟩ := two_to_one (T := T) (A₁ := [tL a₁ b₁ i]) (B₁ := linv + (tL a₁ b₁ i) :: rW a₁ b₁ c₁ L₁) + (A₂ := [((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), true)]) + (B₂ := ((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), false) :: shW (frL a₁ b₁ c₁ + 1) (rW a₂ b₂ c₂ L₂)) + (r := (rL a₁ b₁ i).1) (σ := σ) (noLab_iff_cnt.mpr (by + simp only [List.cons_append, List.nil_append, List.append_assoc, cnt_append, cnt_cons, + cnt_nil, tL, rL, frL, linv, c1, c2] at * + split_ifs <;> omega)) hf (by simp) (by simp) + have key : ∀ {w₀ : List Letter} {f' : ℕ × ℂ → T}, Presents (sW w₀) f' → ∀ {X Y Z : List Letter}, + Inv [((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), false), (2 * a₂ + b₂ + 2 * c₂ + + (frL a₁ b₁ c₁ + 1), true), + (2 * a₂ + b₂ + 2 * c₂ + (frL a₁ b₁ c₁ + 1), false), ((tL a₂ b₂ j).1 + + (frL a₁ b₁ c₁ + 1), true), linv (tL a₁ b₁ i), + (2 * a₁ + b₁ + 2 * c₁, true), (2 * a₁ + b₁ + 2 * c₁, false), tL a₁ b₁ i] X Y Z (a₂ + a₁) + (b₂ + b₁) (L₂.length + L₁.length) → + WEq.{uu} w₀ ([((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), false), (2 * a₂ + b₂ + 2 * c₂ + + (frL a₁ b₁ c₁ + 1), true), + (2 * a₂ + b₂ + 2 * c₂ + (frL a₁ b₁ c₁ + 1), false), ((tL a₂ b₂ j).1 + + (frL a₁ b₁ c₁ + 1), true), linv (tL a₁ b₁ i), + (2 * a₁ + b₁ + 2 * c₁, true), (2 * a₁ + b₁ + 2 * c₁, false), tL a₁ b₁ i] ++ X ++ Y ++ Z) → + Nonempty (T ≃ₜ SurfaceModel (a₂ + a₁) (b₂ + b₁) (L₂.length + L₁.length)) := by + intro w₀ f' hf' X Y Z h3 h4 + rcases nf_caseF.{uu} (x₁ := (2 * a₁ + b₁ + 2 * c₁, true)) (x₂ := (2 * a₂ + b₂ + 2 * c₂ + + (frL a₁ b₁ c₁ + 1), true)) + (t₂ := ((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), true)) (t₁ := tL a₁ b₁ i) h3 with ⟨w, h5, h6⟩ | + ⟨h5, h6, h7, y, h8⟩ + · exact homeo_of_nf hf' h5 (h4.trans h6) + · rw [h5, h6, h7] + exact homeo_of_sphere hf' (h4.trans h8) + cases σ with + | false => + obtain ⟨f', hf'⟩ := h1 rfl + obtain ⟨X, Y, Z, h3, h4⟩ := state_merge bc₁ bc₂ hd + (P := [((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), false)]) + (Q := shW (frL a₁ b₁ c₁ + 1) (eW a₂ b₂ c₂) ++ [((tL a₂ b₂ j).1 + + (frL a₁ b₁ c₁ + 1), true), linv (tL a₁ b₁ i)]) + (Q' := eW a₁ b₁ c₁ ++ [tL a₁ b₁ i]) (DisjL.symm (by + intro l hl + refine (hLabels (k := l.1) ?_).1 + simp only [shW_eW] at hl + simp only [eW, tL, frL, linv, List.cons_append, List.nil_append, + List.mem_cons, List.not_mem_nil, or_false] at hl ⊢ + rcases hl with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl <;> simp)) (by + intro k + have hCount := hGood k + simp only [shW_eW] + simp only [eW, tL, frL, linv, List.cons_append, List.nil_append, + cnt_cons, cnt_nil] at hCount ⊢ + omega) + refine key (f' := f') ?_ h3 h4 + convert hf' using 2 + simp [rW_eq, shW_append] + | true => + obtain ⟨f', hf'⟩ := h2 rfl + obtain ⟨X, Y, Z, h3, h4⟩ := state_merge bc₁ bc₂.winv hd.winv_left + (P := [((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), false)] ++ shW (frL a₁ b₁ c₁ + 1) (eW a₂ b₂ c₂)) + (Q := [((tL a₂ b₂ j).1 + (frL a₁ b₁ c₁ + 1), true), linv (tL a₁ b₁ i)]) + (Q' := eW a₁ b₁ c₁ ++ [tL a₁ b₁ i]) (DisjL.symm (by + intro l hl + refine (hLabels (k := l.1) ?_).2 + simp only [shW_eW] at hl + simp only [eW, tL, frL, linv, List.cons_append, List.nil_append, + List.mem_cons, List.not_mem_nil, or_false] at hl ⊢ + rcases hl with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl <;> simp)) (by + intro k + have hCount := hGood k + simp only [shW_eW] + simp only [eW, tL, frL, linv, List.cons_append, List.nil_append, + cnt_cons, cnt_nil] at hCount ⊢ + omega) + refine key (f' := f') ?_ h3 h4 + convert hf' using 2 + simp [rW_eq, shW_append, winv_append, winv_cons, winv_shW_eW, winv_nil, linv] + +end + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutWord.lean b/LeanPool/GraphMinor/Surface/CutWord.lean new file mode 100644 index 0000000000..c00954fd6e --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutWord.lean @@ -0,0 +1,572 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.WordSurface +public import LeanPool.GraphMinor.Surface.Dihedral + +/-! +# Cutting a word + +Let `W` be a word and `L` a set of labels. The word `cutW W L` gives each side with a label in `L` a +label of its own, so +these sides are no longer pasted. It presents the surface cut along the sides with labels in `L`. + +To see what happens at a corner, we use the *ends of sides* `SE W`. Crossing a corner of a polygon +(`twn`) and crossing a +pasted side (`prtL`) are involutions of the ends of sides, and the first one has no fixed point. So +the results of +`Dihedral.lean` apply, and `corner_cut` tells which corners stay pasted. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +variable {W : ℕ → List Letter} {L : Set ℕ} + +open Classical in +/-- The letter at the position `p` of the word `i` after cutting. -/ +noncomputable def cutL (L : Set ℕ) (i p : ℕ) (l : Letter) : Letter := + if l.1 ∈ L then (2 * Nat.pair i p + 1, l.2) else (2 * l.1, l.2) + +/-- The cut word. -/ +noncomputable def cutW (W : ℕ → List Letter) (L : Set ℕ) (i : ℕ) : List Letter := (W i).mapIdx + (cutL L i) + +theorem cutW_length (i : ℕ) : (cutW W L i).length = (W i).length := List.length_mapIdx .. + +theorem cutW_get (i p : ℕ) : (cutW W L i)[p]? = ((W i)[p]?).map (cutL L i p) := by + simp [cutW, List.getElem?_mapIdx] + +theorem spt_cut (i p : ℕ) (u : ℝ) : spt (cutW W L) i p u = spt W i p u := by + simp [spt, cutW_length] + +theorem cutW_eq_nil (i : ℕ) : cutW W L i = [] ↔ W i = [] := by + rw [← List.length_eq_zero_iff, cutW_length, List.length_eq_zero_iff] + +theorem dsk_cut : Dsk (cutW W L) = Dsk W := by + ext a + simp [Dsk, cutW_eq_nil] + +theorem finW_cut (h : FinW W) : FinW (cutW W L) := by + refine Set.Finite.subset h fun i hi => ?_ + exact fun he => hi ((cutW_eq_nil i).mpr he) + +theorem cut_get_iff {i p k' : ℕ} {e : Bool} : (cutW W L i)[p]? = some (k', e) ↔ + ∃ k, (W i)[p]? = some (k, e) ∧ ((k ∈ L ∧ k' = 2 * Nat.pair i p + 1) ∨ (k ∉ L ∧ k' = 2 * k)) + := by + classical + rw [cutW_get, Option.map_eq_some_iff] + constructor + · rintro ⟨⟨k, e'⟩, h1, h2⟩ + by_cases hk : k ∈ L + · simp only [cutL, hk, ite_true, Prod.mk.injEq] at h2 + obtain ⟨rfl, rfl⟩ := h2 + exact ⟨k, h1, .inl ⟨hk, rfl⟩⟩ + · simp only [cutL, hk, ite_false, Prod.mk.injEq] at h2 + obtain ⟨rfl, rfl⟩ := h2 + exact ⟨k, h1, .inr ⟨hk, rfl⟩⟩ + · rintro ⟨k, h1, ⟨hk, rfl⟩ | ⟨hk, rfl⟩⟩ + · exact ⟨_, h1, by simp [cutL, hk]⟩ + · exact ⟨_, h1, by simp [cutL, hk]⟩ + +theorem isPaired_cut (hP : IsPaired W) : IsPaired (cutW W L) := by + intro k' + rcases Nat.even_or_odd' k' with ⟨m, rfl | rfl⟩ + · refine (encard_le_encard ?_).trans (hP m) + rintro s ⟨e, he⟩ + obtain ⟨k, h1, ⟨-, h2⟩ | ⟨-, h2⟩⟩ := cut_get_iff.mp he + · omega + · have : k = m := by omega + subst this + exact ⟨e, h1⟩ + · have hsub : {s : ℕ × ℕ | ∃ e, (cutW W L s.1)[s.2]? = some (2 * m + 1, e)} ⊆ {Nat.unpair m} := by + rintro ⟨i, p⟩ ⟨e, he⟩ + simp only at he + obtain ⟨k, h1, ⟨-, h2⟩ | ⟨-, h2⟩⟩ := cut_get_iff.mp he + · have h3 : Nat.pair i p = m := by omega + rw [mem_singleton_iff, ← h3, Nat.unpair_pair] + · omega + refine (encard_le_encard hsub).trans ?_ + rw [encard_singleton] + norm_num + +/-- A step of the cut word is a step of the word along a side that is not cut. -/ +theorem stp_of_cut {a b : ℕ × ℂ} (h : Stp (cutW W L) a b) : ∃ (i j p q k : ℕ) (e e' : Bool) (u : ℝ), + (W i)[p]? = some (k, e) ∧ (W j)[q]? = some (k, e') ∧ (i, p) ≠ (j, q) ∧ u ∈ Icc (0 : ℝ) 1 + ∧ k ∉ L ∧ + a = spt W i p u ∧ b = spt W j q (flp e e' u) := by + obtain ⟨i, j, p, q, k', e, e', u, h1, h2, h3, hu, rfl, rfl⟩ := stp_iff.mp h + obtain ⟨k, h4, h5⟩ := cut_get_iff.mp h1 + obtain ⟨l, h6, h7⟩ := cut_get_iff.mp h2 + rw [spt_cut, spt_cut] + rcases h5 with ⟨-, h5⟩ | ⟨h8, h5⟩ <;> rcases h7 with ⟨-, h7⟩ | ⟨h9, h7⟩ + · have h9 : Nat.pair i p = Nat.pair j q := by omega + obtain ⟨rfl, rfl⟩ := Nat.pair_eq_pair.mp h9 + exact absurd rfl h3 + · omega + · omega + · have : k = l := by omega + subst this + exact ⟨i, j, p, q, k, e, e', u, h4, h6, h3, hu, h8, rfl, rfl⟩ + +theorem stp_to_cut {i j p q k : ℕ} {e e' : Bool} {u : ℝ} (h1 : (W i)[p]? = some (k, e)) (h2 : + (W j)[q]? = some (k, e')) + (h3 : (i, p) ≠ (j, q)) (hu : u ∈ Icc (0 : ℝ) 1) (hk : k ∉ L) : + Stp (cutW W L) (spt W i p u) (spt W j q (flp e e' u)) := by + rw [← spt_cut (L := L), ← spt_cut (L := L) j] + exact stp_iff.mpr ⟨i, j, p, q, 2 * k, e, e', u, cut_get_iff.mpr ⟨k, h1, .inr ⟨hk, rfl⟩⟩, + cut_get_iff.mpr ⟨k, h2, .inr ⟨hk, rfl⟩⟩, h3, hu, rfl, rfl⟩ + +theorem stp_of_stp_cut {a b : ℕ × ℂ} (h : Stp (cutW W L) a b) : Stp W a b := by + obtain ⟨i, j, p, q, k, e, e', u, h1, h2, h3, hu, -, rfl, rfl⟩ := stp_of_cut h + exact stp_iff.mpr ⟨i, j, p, q, k, e, e', u, h1, h2, h3, hu, rfl, rfl⟩ + +theorem prel_of_prel_cut {a b : ℕ × ℂ} (h : PRel (cutW W L) a b) : PRel W a b := by + induction h with + | rel _ _ h => exact .rel _ _ (stp_of_stp_cut h) + | refl _ => exact .refl _ + | symm _ _ _ ih => exact .symm _ _ ih + | trans _ _ _ _ _ h1 h2 => exact .trans _ _ _ h1 h2 + +theorem prel_cut_empty {a b : ℕ × ℂ} (h : PRel W a b) : PRel (cutW W ∅) a b := by + induction h with + | rel _ _ h => + obtain ⟨i, j, p, q, k, e, e', u, h1, h2, h3, hu, rfl, rfl⟩ := stp_iff.mp h + exact .rel _ _ (stp_to_cut h1 h2 h3 hu (notMem_empty k)) + | refl _ => exact .refl _ + | symm _ _ _ ih => exact .symm _ _ ih + | trans _ _ _ _ _ h1 h2 => exact .trans _ _ _ h1 h2 + +/-- A side with a label in `L` is free after cutting. -/ +theorem freeSide_cut {i p k : ℕ} {e : Bool} (h : (W i)[p]? = some (k, e)) (hk : k ∈ L) : FreeSide + (cutW W L) i p := by + intro j q k' e₁ e₂ h1 h2 + obtain ⟨l, h3, h4⟩ := cut_get_iff.mp h1 + obtain ⟨l', h5, h6⟩ := cut_get_iff.mp h2 + have : l = k := by + rw [h] at h3 + simpa using (congrArg (Option.map Prod.fst) h3).symm + subst this + rcases h4 with ⟨-, h4⟩ | ⟨h7, -⟩ + · rcases h6 with ⟨-, h6⟩ | ⟨-, h6⟩ + · have h9 : Nat.pair i p = Nat.pair j q := by omega + obtain ⟨rfl, rfl⟩ := Nat.pair_eq_pair.mp h9 + rfl + · omega + · exact absurd hk h7 + +theorem freeSide_of_cut {i p : ℕ} (h : FreeSide W i p) : FreeSide (cutW W L) i p := by + intro j q k' e₁ e₂ h1 h2 + obtain ⟨l, h3, h4⟩ := cut_get_iff.mp h1 + obtain ⟨l', h5, h6⟩ := cut_get_iff.mp h2 + rcases h4 with ⟨-, h4⟩ | ⟨-, h4⟩ <;> rcases h6 with ⟨-, h6⟩ | ⟨-, h6⟩ + · have h9 : Nat.pair i p = Nat.pair j q := by omega + obtain ⟨rfl, rfl⟩ := Nat.pair_eq_pair.mp h9 + rfl + · omega + · omega + · have : l = l' := by omega + subst this + exact h j q l _ _ h3 h5 + +/-! ## Ends of sides -/ + +/-- An end of a side: `true` is the end with offset one. -/ +abbrev SE (W : ℕ → List Letter) : Type := {g : ℕ × ℕ × Bool // g.2.1 < (W g.1).length} + +theorem finite_se (hW : FinW W) : Finite (SE W) := by + have h := finite_sides hW + have : Finite {x : ℕ × ℕ | ∃ l, (W x.1)[x.2]? = some l} := h + refine Finite.of_injective (β := {x : ℕ × ℕ | ∃ l, (W x.1)[x.2]? = some l} × Bool) + (fun g => (⟨(g.1.1, g.1.2.1), _, List.getElem?_eq_getElem g.2⟩, g.1.2.2)) ?_ + rintro ⟨⟨i, p, b⟩, h1⟩ ⟨⟨i', p', b'⟩, h2⟩ he + simp only [Prod.mk.injEq, Subtype.mk.injEq] at he + obtain ⟨⟨rfl, rfl⟩, rfl⟩ := he + rfl + +/-- The offset of an end. -/ +noncomputable def eo (b : Bool) : ℝ := if b then 1 else 0 + +theorem eo_mem (b : Bool) : eo b ∈ Icc (0 : ℝ) 1 := by + cases b <;> simp [eo] + +/-- The point of an end. -/ +noncomputable def spe (W : ℕ → List Letter) (g : SE W) : ℕ × ℂ := spt W g.1.1 g.1.2.1 (eo g.1.2.2) + +/-- The next position. -/ +def nxt (n p : ℕ) : ℕ := if p + 1 = n then 0 else p + 1 + +/-- The position before. -/ +def prv (n p : ℕ) : ℕ := if p = 0 then n - 1 else p - 1 + +/-- Crossing the corner at an end. -/ +def twn (W : ℕ → List Letter) (g : SE W) : SE W := + ⟨(g.1.1, if g.1.2.2 then nxt (W g.1.1).length g.1.2.1 else prv (W g.1.1).length g.1.2.1, + !g.1.2.2), by + obtain ⟨⟨i, p, b⟩, h⟩ := g + simp only at h ⊢ + cases b <;> simp only [nxt, prv, ite_true, Bool.false_eq_true, ite_false] <;> split_ifs + <;> omega⟩ + +theorem twn_ne (g : SE W) : twn W g ≠ g := by + obtain ⟨⟨i, p, b⟩, h⟩ := g + intro he + have := congrArg (fun x : SE W => x.1.2.2) he + cases b <;> simp [twn] at this + +theorem twn_invol : Function.Involutive (twn W) := by + rintro ⟨⟨i, p, b⟩, h⟩ + replace h : p < (W i).length := h + apply Subtype.ext + have h1 : nxt (W i).length (prv (W i).length p) = p := by + by_cases hp : p = 0 + · subst hp + simp only [nxt, prv, ite_true] + rw [ite_eq_left (by omega)] + · simp only [nxt, prv, ite_eq_right hp] + rw [ite_eq_right (by omega)] + omega + have h2 : prv (W i).length (nxt (W i).length p) = p := by + by_cases hp : p + 1 = (W i).length + · simp only [nxt, prv, ite_eq_left hp, ite_true] + omega + · simp only [nxt, prv, ite_eq_right hp, Nat.succ_ne_zero, ite_false, Nat.add_sub_cancel] + cases b + · change (i, nxt (W i).length (prv (W i).length p), false) = (i, p, false) + rw [h1] + · change (i, prv (W i).length (nxt (W i).length p), true) = (i, p, true) + rw [h2] + +theorem per_card (n : ℕ) (hn : 0 < n) : per n n = per n 0 := by + have := per_add_self (m := n) hn.ne' 0 + simpa using this + +theorem spe_twn (g : SE W) : spe W (twn W g) = spe W g := by + obtain ⟨⟨i, p, b⟩, h⟩ := g + simp only at h + have hn : 0 < (W i).length := by omega + cases b + · simp only [spe, twn, spt, eo, Bool.not_false, ite_true, Bool.false_eq_true, ite_false, prv, + Prod.mk.injEq, true_and] + split_ifs with h1 + · subst h1 + have : ((W i).length - 1 : ℕ) + (1 : ℝ) = (W i).length := by + rw [Nat.cast_sub (by omega)] + simp + rw [this, per_card _ hn] + simp + · have : ((p - 1 : ℕ) : ℝ) + 1 = p := by + rw [Nat.cast_sub (by omega)] + simp + rw [this] + simp + · simp only [spe, twn, spt, eo, Bool.not_true, ite_true, Bool.false_eq_true, ite_false, nxt, + Prod.mk.injEq, true_and] + split_ifs with h1 + · have : (p : ℝ) + 1 = (W i).length := by exact_mod_cast h1 + rw [this, per_card _ hn] + simp + · push_cast + simp + +/-- Two ends at the same point are equal or are the two ends of a corner. -/ +theorem same_corner {g h : SE W} (he : spe W g = spe W h) : h = g ∨ h = twn W g := by + obtain ⟨⟨i, p, b⟩, hp⟩ := g + obtain ⟨⟨j, q, b'⟩, hq⟩ := h + simp only at hp hq + have hij : i = j := congrArg Prod.fst he + subst hij + have h2 : per (W i).length (p + eo b) = per (W i).length (q + eo b') := congrArg Prod.snd he + have hn : 0 < (W i).length := by omega + obtain ⟨m, hm⟩ := per_eq hn h2 + set n := (W i).length with hndef + have hbd : ∀ x : ℤ, -n ≤ x → x ≤ n → x = m * n → x = 0 ∨ x = n ∨ x = -n := by + intro x h1 h3 h4 + have hn' : (0 : ℤ) < n := by exact_mod_cast hn + have h5 : m = 0 ∨ m = 1 ∨ m = -1 := by + have h6 : m < 2 := by + by_contra hc + have : 2 * (n : ℤ) ≤ m * n := by nlinarith + omega + have h7 : -2 < m := by + by_contra hc + have : m * (n : ℤ) ≤ -2 * n := by nlinarith + omega + omega + rcases h5 with rfl | rfl | rfl + · left + simpa using h4 + · right + left + simpa using h4 + · right + right + simpa using h4 + have hsub : ∀ (x y : ℤ), ((x : ℝ) = y + m * n) → x - y = m * n := by + intro x y h + have : (x : ℝ) - y = m * n := by linarith + exact_mod_cast this + cases b <;> cases b' <;> simp only [eo, ite_true, Bool.false_eq_true, ite_false, add_zero] at hm + · have h3 := hsub p q (by exact_mod_cast hm) + have := hbd _ (by omega) (by omega) h3 + left + have hpq : p = q := by omega + subst hpq + rfl + · have h3 := hsub p (q + 1) (by push_cast; exact_mod_cast hm) + have := hbd _ (by omega) (by omega) h3 + right + apply Subtype.ext + simp only [twn, Bool.false_eq_true, ite_false, prv, Bool.not_false, Prod.mk.injEq, and_true, + true_and] + split_ifs <;> omega + · have h3 := hsub (p + 1) q (by push_cast; exact_mod_cast hm) + have := hbd _ (by omega) (by omega) h3 + right + apply Subtype.ext + simp only [twn, ite_true, nxt, Bool.not_true, Prod.mk.injEq, and_true, true_and] + split_ifs <;> omega + · have h3 := hsub p q (by + have : (p : ℝ) = q + m * n := by linarith + exact_mod_cast this) + have := hbd _ (by omega) (by omega) h3 + left + have hpq : p = q := by omega + subst hpq + rfl + +/-- `g'` is the end of the other side with the same label not in `L`, at the same point after +pasting. -/ +def MateL (W : ℕ → List Letter) (L : Set ℕ) (g g' : SE W) : Prop := + ∃ k e e', (W g.1.1)[g.1.2.1]? = some (k, e) ∧ (W g'.1.1)[g'.1.2.1]? = some (k, e') ∧ + (g.1.1, g.1.2.1) ≠ (g'.1.1, g'.1.2.1) ∧ k ∉ L ∧ g'.1.2.2 = (if e = e' then g.1.2.2 else + !g.1.2.2) + +theorem MateL.symm {g g' : SE W} (h : MateL W L g g') : MateL W L g' g := by + obtain ⟨k, e, e', h1, h2, h3, h4, h5⟩ := h + refine ⟨k, e', e, h2, h1, h3.symm, h4, ?_⟩ + rw [h5] + by_cases he : e = e' + · simp [he] + · simp [he, Ne.symm he] + +theorem MateL.unique (hP : IsPaired W) {g g' g'' : SE W} (h : MateL W L g g') + (h' : MateL W L g g'') : g' = g'' := by + obtain ⟨k, e, e', h1, h2, h3, h4, h5⟩ := h + obtain ⟨k₂, e₂, e₂', h1', h2', h3', h4', h5'⟩ := h' + have hk : (k, e) = (k₂, e₂) := by + rw [h1] at h1' + exact Option.some.inj h1' + obtain ⟨rfl, rfl⟩ := Prod.mk.inj hk + rcases hP.third h1 h2 h2' h3 with h6 | h6 + · exact absurd h6.symm h3' + · obtain ⟨⟨j, q, b⟩, h7⟩ := g' + obtain ⟨⟨j', q', b'⟩, h8⟩ := g'' + simp only [Prod.mk.injEq] at h6 + obtain ⟨rfl, rfl⟩ := h6 + have he : e' = e₂' := by + simp only at h2 h2' + rw [h2] at h2' + simpa using h2' + subst he + apply Subtype.ext + simp only at h5 h5' + simp only [Prod.mk.injEq, true_and] + rw [h5, h5'] + +open Classical in +/-- Crossing the side at an end, if this side is pasted and is not cut. -/ +noncomputable def prtL (W : ℕ → List Letter) (L : Set ℕ) (g : SE W) : SE W := + if h : ∃ g', MateL W L g g' then h.choose else g + +theorem prtL_of_mate (hP : IsPaired W) {g g' : SE W} (h : MateL W L g g') : prtL W L g = g' := by + have hex : ∃ g', MateL W L g g' := ⟨g', h⟩ + rw [prtL, dite_eq_left hex] + exact MateL.unique hP hex.choose_spec h + +theorem prtL_of_not {g : SE W} (h : ¬ ∃ g', MateL W L g g') : prtL W L g = g := by + rw [prtL, dite_eq_right h] + +theorem prtL_invol (hP : IsPaired W) : Function.Involutive (prtL W L) := by + intro g + by_cases h : ∃ g', MateL W L g g' + · obtain ⟨g', hg⟩ := h + rw [prtL_of_mate hP hg, prtL_of_mate hP hg.symm] + · rw [prtL_of_not h, prtL_of_not h] + +theorem eo_flp (e e' b : Bool) : eo (if e = e' then b else !b) = flp e e' (eo b) := by + by_cases h : e = e' <;> cases b <;> simp [flp, eo, h] + +theorem MateL.stp {g g' : SE W} (h : MateL W L g g') : Stp (cutW W L) (spe W g) (spe W g') := by + obtain ⟨k, e, e', h1, h2, h3, h4, h5⟩ := h + have := stp_to_cut (L := L) h1 h2 h3 (eo_mem g.1.2.2) h4 + rw [← eo_flp, ← h5] at this + exact this + +theorem MateL.of_le {L' : Set ℕ} {g g' : SE W} (h : MateL W L g g') (hs : L' ⊆ L) : MateL W L' g g' + := by + obtain ⟨k, e, e', h1, h2, h3, h4, h5⟩ := h + exact ⟨k, e, e', h1, h2, h3, fun h' => h4 (hs h'), h5⟩ + +theorem prtL_cases (hP : IsPaired W) (g : SE W) : prtL W L g = g ∨ prtL W L g = prtL W ∅ g := by + by_cases h : ∃ g', MateL W L g g' + · obtain ⟨g', hg⟩ := h + right + rw [prtL_of_mate hP hg, prtL_of_mate hP (hg.of_le (empty_subset L))] + · exact .inl (prtL_of_not h) + +/-- The orbit of an end. -/ +abbrev Orb (W : ℕ → List Letter) (L : Set ℕ) : SE W → SE W → Prop := TwoOrb (twn W) (prtL W L) + +theorem prel_of_orb (hP : IsPaired W) {g g' : SE W} (h : Orb W L g g') : PRel (cutW W L) (spe W g) + (spe W g') := by + induction h with + | rel a b h => + rcases h with rfl | rfl + · rw [spe_twn] + exact .refl _ + · by_cases hm : ∃ g', MateL W L a g' + · obtain ⟨g', hg⟩ := hm + rw [prtL_of_mate hP hg] + exact .rel _ _ hg.stp + · rw [prtL_of_not hm] + exact .refl _ + | refl _ => exact .refl _ + | symm _ _ _ ih => exact .symm _ _ ih + | trans _ _ _ _ _ h1 h2 => exact .trans _ _ _ h1 h2 + +theorem orb_of_stp (hP : IsPaired W) (g : SE W) {b : ℕ × ℂ} (h : Stp (cutW W L) (spe W g) b) : + ∃ g', spe W g' = b ∧ Orb W L g g' := by + classical + obtain ⟨i, j, p, q, k, e, e', u, h1, h2, h3, hu, hk, ha, rfl⟩ := stp_of_cut h + have hp := lt_length h1 + have hq := lt_length h2 + obtain ⟨⟨i₀, p₀, b₀⟩, hg⟩ := g + replace hg : p₀ < (W i₀).length := hg + have hi : i₀ = i := congrArg Prod.fst ha + subst hi + have hper : per (W i₀).length (p₀ + eo b₀) = per (W i₀).length (p + u) := congrArg Prod.snd ha + have hend : u = 0 ∨ u = 1 := by + by_contra hc + push Not at hc + have h4 : u ∈ Ioo (0 : ℝ) 1 := ⟨lt_of_le_of_ne hu.1 (Ne.symm hc.1), lt_of_le_of_ne hu.2 hc.2⟩ + obtain ⟨-, h5⟩ := side_unique hp hg h4 (eo_mem b₀) hper.symm + cases b₀ <;> simp [eo] at h5 <;> simp [h5] at hc + let x : Bool := decide (u = 1) + have hx : eo x = u := by + rcases hend with rfl | rfl <;> simp [eo, x] + let h₁ : SE W := ⟨(i₀, p, x), hp⟩ + have hs1 : spe W h₁ = spt W i₀ p u := by simp only [spe, h₁, hx] + have hor : Orb W L ⟨(i₀, p₀, b₀), hg⟩ h₁ := by + rcases same_corner (g := ⟨(i₀, p₀, b₀), hg⟩) (h := h₁) (ha.trans hs1.symm) with h5 | h5 + · rw [h5] + exact .refl _ + · rw [h5] + exact TwoOrb.left _ _ _ + let h₂ : SE W := ⟨(j, q, if e = e' then x else !x), hq⟩ + have hm : MateL W L h₁ h₂ := ⟨k, e, e', h1, h2, h3, hk, rfl⟩ + refine ⟨h₂, ?_, .trans _ _ _ hor ?_⟩ + · simp only [spe, h₂, eo_flp, hx] + · rw [← prtL_of_mate hP hm] + exact TwoOrb.right _ _ _ + +theorem orb_of_prel (hP : IsPaired W) (g : SE W) {b : ℕ × ℂ} (h : PRel (cutW W L) (spe W g) b) : + ∃ g', spe W g' = b ∧ Orb W L g g' := by + have key : ∀ x y, PRel (cutW W L) x y → ((∃ g', spe W g' = x ∧ Orb W L g g') ↔ ∃ g', spe W g' = y + ∧ Orb W L g g') := by + have hstep : ∀ x y, Stp (cutW W L) x y → (∃ g', spe W g' = x ∧ Orb W L g g') → ∃ g', spe W g' + = y ∧ Orb W L g g' := by + rintro _ y hs ⟨g', rfl, hg⟩ + obtain ⟨g'', h1, h2⟩ := orb_of_stp hP g' hs + exact ⟨g'', h1, .trans _ _ _ hg h2⟩ + intro x y hxy + induction hxy with + | rel x y hs => exact ⟨hstep x y hs, hstep y x hs.symm⟩ + | refl _ => exact Iff.rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + exact (key _ _ h).mp ⟨g, rfl, .refl _⟩ + +theorem orb_of_spe (hP : IsPaired W) {g g' : SE W} (h : PRel (cutW W L) (spe W g) + (spe W g')) : Orb W L g g' := by + obtain ⟨g'', h1, h2⟩ := orb_of_prel hP g h + rcases same_corner h1 with h3 | h3 + · rw [h3] + exact h2 + · rw [h3] + exact .trans _ _ _ h2 (TwoOrb.left _ _ _) + +theorem orb_empty (hP : IsPaired W) {g g' : SE W} (h : PRel W (spe W g) (spe W g')) : Orb W ∅ g g' + := + orb_of_spe hP (prel_cut_empty h) + +/-- What cutting does at a corner. -/ +theorem corner_cut (hW : FinW W) (hP : IsPaired W) {c c' d d' : SE W} (hcc : prtL W ∅ c = c') + (hc1 : prtL W L c = c) + (hc2 : prtL W L c' = c') (hd1 : prtL W L d = d) (hd2 : prtL W L d' = d') (hne : c ≠ c') + (hne1 : d ≠ c) (hne2 : d ≠ c') + (hne3 : d' ≠ c) (hne4 : d' ≠ c') (hne5 : d ≠ d') (hod : PRel W (spe W c) (spe W d)) + (hod' : PRel W (spe W c) (spe W d')) + (hπd : prtL W ∅ d = d ∨ prtL W ∅ d = d') (hπd' : prtL W ∅ d' = d ∨ prtL W ∅ d' = d') + (hfix : ∀ g, PRel W (spe W c) (spe W g) → prtL W L g = g → g = c ∨ g = c' ∨ g = d ∨ g = d') : + ¬ PRel (cutW W L) (spe W c) (spe W c') ∧ ∀ g, PRel W (spe W c) (spe W g) → + PRel (cutW W L) (spe W c) (spe W g) ∨ PRel (cutW W L) (spe W c') (spe W g) := by + have := finite_se hW + obtain ⟨h1, h2⟩ := cut_classes (twn_invol (W := W)) (prtL_invol hP) (prtL_invol hP) twn_ne + (prtL_cases hP) hcc hc1 hc2 hd1 + hd2 hne hne1 hne2 hne3 hne4 hne5 (orb_empty hP hod) (orb_empty hP hod') hπd hπd' + (fun g hg hf => hfix g (prel_of_prel_cut (prel_of_orb hP hg)) hf) + refine ⟨fun h => h1 (orb_of_spe hP h), fun g hg => ?_⟩ + rcases h2 g (orb_empty hP hg) with h | h + · exact .inl (prel_of_orb hP h) + · exact .inr (prel_of_orb hP h) + +/-- A free end at a corner has one other free end at this corner. -/ +theorem exists_free_end (hW : FinW W) (hP : IsPaired W) {g : SE W} (hg : prtL W ∅ g = g) : + ∃ g', g' ≠ g ∧ prtL W ∅ g' = g' ∧ PRel W (spe W g) (spe W g') ∧ + ∀ z, PRel W (spe W g) (spe W z) → prtL W ∅ z = z → z = g ∨ z = g' := by + have := finite_se hW + obtain ⟨y, h1, h2, h3, h4⟩ := exists_other_end (twn_invol (W := W)) (prtL_invol hP) twn_ne hg + exact ⟨y, h1, h2, prel_of_prel_cut (prel_of_orb hP h3), fun z hz hf => h4 z (orb_empty hP hz) hf⟩ + +theorem prtL_eq_iff (hP : IsPaired W) (g : SE W) {k : ℕ} {e : Bool} (h : (W g.1.1)[g.1.2.1]? = some + (k, e)) : + prtL W L g = g ↔ k ∈ L ∨ FreeSide W g.1.1 g.1.2.1 := by + classical + constructor + · intro hf + by_cases hk : k ∈ L + · exact .inl hk + right + intro j q k₂ e₁ e₂ h1 h2 + by_contra hne + have hk2 : (k₂, e₁) = (k, e) := by + rw [h] at h1 + exact (Option.some.inj h1).symm + obtain ⟨rfl, rfl⟩ := Prod.mk.inj hk2 + have hm : MateL W L g ⟨(j, q, if e₁ = e₂ then g.1.2.2 else !g.1.2.2), lt_length h2⟩ + := ⟨k₂, e₁, e₂, h, h2, hne, hk, rfl⟩ + have h3 := (prtL_of_mate hP hm).symm.trans hf + exact hne (by rw [← h3]) + · intro hf + refine prtL_of_not ?_ + rintro ⟨g', k₂, e₁, e₂, h1, h2, h3, h4, -⟩ + have hk2 : (k₂, e₁) = (k, e) := by + rw [h] at h1 + exact (Option.some.inj h1).symm + obtain ⟨rfl, rfl⟩ := Prod.mk.inj hk2 + rcases hf with hf | hf + · exact h4 hf + · exact h3 (hf _ _ _ _ _ h1 h2) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/CutWords.lean b/LeanPool/GraphMinor/Surface/CutWords.lean new file mode 100644 index 0000000000..19171e8d39 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/CutWords.lean @@ -0,0 +1,175 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutComp + +/-! +# Words of a surface before cutting + +Cutting a surface `Σ(a, b, c)` along an arc is undone by pasting two sides of a word. This file +lists these words for a +connected surface and finds their normal forms. Each word consists of a short front part, and of the +rest `rW` of the +normal word of the surface. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set + +universe uu + +/-- The first label that the normal word with `c` holes does not use. -/ +def frL (a b c : ℕ) : ℕ := 2 * a + b + 2 * c + 1 + +/-- The state of the procedure for a word with front part `R`. -/ +theorem state_of_front {a b c : ℕ} {L : List ℕ} (hL : L.Nodup) {R : List Letter} (hG : Good + (eW a b c ++ R)) + (hR : ∀ l ∈ eW a b c ++ R, 2 * a + b ≤ l.1 ∧ ∀ m ∈ L, l.1 ≠ 2 * a + b + 2 * m + ∧ l.1 ≠ 2 * a + b + 2 * m + 1) : + Inv (eW a b c ++ R) (hW 0 a) (cW (2 * a) b) (hlW (2 * a + b) L) a b L.length ∧ + WEq.{uu} (R ++ rW a b c L) ((eW a b c ++ R) ++ hW 0 a ++ cW (2 * a) b ++ hlW (2 * a + b) L) + := by + refine ⟨inv_of_model hL hG hR, ?_⟩ + simpa [List.append_assoc] using weq_front.{uu} a b c L R + +/-- The front part for two lifts on two holes. -/ +def blkA (a b c i j : ℕ) (σ : Bool) : List Letter := + [tL a b j, ((rL a b i).1, σ), (frL a b c + 1, true), linv (tL a b j), tL a b i, rL a b i, + (frL a b c, true), linv (tL a b i)] + +/-- The front part for two lifts on one hole. -/ +def blkB (a b c i : ℕ) (σ : Bool) : List Letter := + [tL a b i, rL a b i, (frL a b c, true), ((rL a b i).1, σ), (frL a b c + 2, true), linv (tL a b i)] + +/-- The front part for one lift that goes twice around a hole. -/ +def blkD (a b i : ℕ) : List Letter := [tL a b i, rL a b i, rL a b i, linv (tL a b i)] + +/-- The front part for two `O`-arcs. -/ +def blkE (a b i j : ℕ) (σ : Bool) : List Letter := + [tL a b j, ((rL a b i).1, σ), linv (tL a b j), tL a b i, rL a b i, linv (tL a b i)] + +section + +variable {a b c i j : ℕ} {L : List ℕ} + +theorem nf_blkA (hij : i ≠ j) (hi : i < c) (hj : j < c) (hL : L.Nodup) (hc : ∀ m ∈ L, m < c ∧ m ≠ i + ∧ m ≠ j) (σ : Bool) : + (σ = false → ∃ w, IsNF w (a + 1) b (L.length + 1) ∧ WEq.{uu} (blkA a b c i j σ ++ rW a b c L) + w) ∧ + (σ = true → ∃ w, IsNF w a (b + 2) (L.length + 1) ∧ WEq.{uu} (blkA a b c i j σ ++ rW a b c L) w) + := by + obtain ⟨h1, h2⟩ := state_of_front (a := a) (b := b) (c := c) (L := L) (R := blkA a b c i j σ) hL + (by + intro k + cases σ <;> simp only [eW, blkA, List.cons_append, List.nil_append, cnt_cons, cnt_nil, tL, rL, + frL, linv] <;> split_ifs <;> omega) (by + intro l hl + simp only [eW, blkA, List.cons_append, List.nil_append, tL, rL, frL, linv, List.mem_cons, + List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl <;> + · refine ⟨by simp only; omega, fun m hm => ?_⟩ + have := hc m hm + simp only + omega) + constructor + · rintro rfl + obtain ⟨w, h3, h4⟩ := nf_caseA_neg.{uu} (x := (2 * a + b + 2 * c, true)) (t₁ := tL a b j) (p := + ((rL a b i).1, false)) (g₁ := (frL a b c + 1, true)) + (t₂ := tL a b i) (g₂ := (frL a b c, true)) h1 (by simp [tL, rL]; omega) (by simp) + exact ⟨w, h3, h2.trans h4⟩ + · rintro rfl + obtain ⟨w, h3, h4⟩ := nf_caseA_pos.{uu} (x := (2 * a + b + 2 * c, true)) (t₁ := tL a b j) (p + := rL a b i) (g₁ := (frL a b c + 1, true)) + (t₂ := tL a b i) (g₂ := (frL a b c, true)) h1 (by simp [linv]) + exact ⟨w, h3, h2.trans h4⟩ + +theorem nf_blkB (hi : i < c) (hL : L.Nodup) (hc : ∀ m ∈ L, m < c ∧ m ≠ i) (σ : Bool) : + (σ = false → ∃ w, IsNF w a b (L.length + 2) ∧ WEq.{uu} (blkB a b c i σ ++ rW a b c L) w) ∧ + (σ = true → ∃ w, IsNF w a (b + 1) (L.length + 1) ∧ WEq.{uu} (blkB a b c i σ ++ rW a b c L) w) + := by + obtain ⟨h1, h2⟩ := state_of_front (a := a) (b := b) (c := c) (L := L) (R := blkB a b c i σ) hL (by + intro k + cases σ <;> simp only [eW, blkB, List.cons_append, List.nil_append, cnt_cons, cnt_nil, tL, rL, + frL, linv] <;> split_ifs <;> omega) (by + intro l hl + simp only [eW, blkB, List.cons_append, List.nil_append, tL, rL, frL, linv, List.mem_cons, + List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl <;> + · refine ⟨by simp only; omega, fun m hm => ?_⟩ + have := hc m hm + simp only + omega) + constructor + · rintro rfl + obtain ⟨w, h3, h4⟩ := nf_caseB_neg.{uu} (x := (2 * a + b + 2 * c, true)) (t := tL a b i) (p + := rL a b i) (g₁ := (frL a b c, true)) + (g₂ := (frL a b c + 2, true)) h1 (by + simp only [cnt_cons, cnt_nil, tL, rL, frL, linv] + split_ifs <;> omega) (by + simp only [cnt_cons, cnt_nil, tL, frL, linv] + split_ifs <;> omega) + exact ⟨w, h3, h2.trans h4⟩ + · rintro rfl + obtain ⟨w, h3, h4⟩ := nf_caseB_pos.{uu} (x := (2 * a + b + 2 * c, true)) (t := tL a b i) (p + := rL a b i) (g₁ := (frL a b c, true)) + (g₂ := (frL a b c + 2, true)) h1 (by simp [linv]) + exact ⟨w, h3, h2.trans h4⟩ + +theorem nf_blkD (hi : i < c) (hL : L.Nodup) (hc : ∀ m ∈ L, m < c ∧ m ≠ i) : + ∃ w, IsNF w a (b + 1) L.length ∧ WEq.{uu} (blkD a b i ++ rW a b c L) w := by + obtain ⟨h1, h2⟩ := state_of_front (a := a) (b := b) (c := c) (L := L) (R := blkD a b i) hL (by + intro k + simp only [eW, blkD, List.cons_append, List.nil_append, cnt_cons, cnt_nil, tL, rL, linv] + split_ifs <;> omega) (by + intro l hl + simp only [eW, blkD, List.cons_append, List.nil_append, tL, rL, linv, List.mem_cons, + List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl | rfl | rfl | rfl <;> + · refine ⟨by simp only; omega, fun m hm => ?_⟩ + have := hc m hm + simp only + omega) + obtain ⟨w, h3, h4⟩ := nf_caseD.{uu} (x := (2 * a + b + 2 * c, true)) (t := tL a b i) (p + := rL a b i) h1 + exact ⟨w, h3, h2.trans h4⟩ + +theorem nf_blkE (hij : i ≠ j) (hi : i < c) (hj : j < c) (hL : L.Nodup) (hc : ∀ m ∈ L, m < c ∧ m ≠ i + ∧ m ≠ j) (σ : Bool) : + (σ = false → ∃ w, IsNF w (a + 1) b L.length ∧ WEq.{uu} (blkE a b i j σ ++ rW a b c L) w) ∧ + (σ = true → ∃ w, IsNF w a (b + 2) L.length ∧ WEq.{uu} (blkE a b i j σ ++ rW a b c L) w) := by + obtain ⟨h1, h2⟩ := state_of_front (a := a) (b := b) (c := c) (L := L) (R := blkE a b i j σ) hL (by + intro k + cases σ <;> simp only [eW, blkE, List.cons_append, List.nil_append, cnt_cons, cnt_nil, tL, rL, + linv] <;> split_ifs <;> omega) (by + intro l hl + simp only [eW, blkE, List.cons_append, List.nil_append, tL, rL, linv, List.mem_cons, + List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl | rfl | rfl | rfl | rfl | rfl <;> + · refine ⟨by simp only; omega, fun m hm => ?_⟩ + have := hc m hm + simp only + omega) + constructor + · rintro rfl + obtain ⟨w, h3, h4⟩ := nf_caseE_neg.{uu} (x := (2 * a + b + 2 * c, true)) (t₁ := tL a b j) (p := + ((rL a b i).1, false)) + (t₂ := tL a b i) h1 (by simp [tL, rL]; omega) + exact ⟨w, h3, h2.trans h4⟩ + · rintro rfl + obtain ⟨w, h3, h4⟩ := nf_caseE_pos.{uu} (x := (2 * a + b + 2 * c, true)) (t₁ := tL a b j) (p + := rL a b i) (t₂ := tL a b i) h1 + exact ⟨w, h3, h2.trans h4⟩ + +end + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Cylinder.lean b/LeanPool/GraphMinor/Surface/Cylinder.lean new file mode 100644 index 0000000000..4be10ca78f --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Cylinder.lean @@ -0,0 +1,310 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import Mathlib.Analysis.SpecialFunctions.Complex.Circle +public import Mathlib.Topology.Homotopy.Lifting + +/-! +# The Cylinder Surface and Winding Numbers of Curves + +This file develops the topological foundations for the cylinder +$\Sigma = [1, 2] \times S^1$ (`ClosedCylinder`) and the winding number $\theta(f) \in \mathbb{R}$ +of continuous curves $f \colon [0, 1] \to \Sigma$, as used in Graph Minors VI, Sections 4–5 +(pages 122–135): +- The two boundary cuffs `cylinderCuff1` ($\{1\} \times S^1$) and `cylinderCuff2` + ($\{2\} \times S^1$), and polar-coordinate point constructor `cylinderPoint`. +- The unique path lift `cylinderAngleLift` of the angular component of a curve $f$ through the + universal covering map `Circle.exp : ℝ → Circle` (`Circle.isCoveringMap_exp.liftPath` from + `Mathlib.Topology.Homotopy.Lifting` and `Mathlib.Analysis.SpecialFunctions.Complex.Circle`). +- The winding number `windingNumber f` ($\theta(f)$ in Graph Minors VI, Section 5, page 127). +- Homotopy invariance of the winding number, integrality of $\theta(f_0) - \theta(f_1)$ for curves + with the same endpoints, and the converse theorem that two curves on the cylinder with the same + endpoints are homotopic if and only if their winding numbers are equal. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Function Complex Real Topology unitInterval + +/-! ## 1. Cuffs and Polar Coordinates on `ClosedCylinder` -/ + +/-- The radial coordinate $r \in [1, 2]$ of a point on `ClosedCylinder`. -/ +def cylinderRadius (p : ClosedCylinder) : ℝ := + p.1.1 + +/-- The angular coordinate on `Circle` of a point on `ClosedCylinder`. -/ +def cylinderAngle (p : ClosedCylinder) : Circle := + p.1.2 + +theorem cylinderRadius_mem_Icc (p : ClosedCylinder) : + cylinderRadius p ∈ Icc (1 : ℝ) 2 := + p.2.1 + +/-- The inner cuff $C_1 = \{1\} \times S^1$ of `ClosedCylinder`. +Graph Minors VI, Section 5 (page 127): "$$C_i = \{(i, \theta): 0 \le \theta < 2\pi\} \qquad (i = 1, +2).$$" -/ +def cylinderCuff1 : Set ClosedCylinder := + {p : ClosedCylinder | p.1.1 = 1} + +/-- The outer cuff $C_2 = \{2\} \times S^1$ of `ClosedCylinder`. +Graph Minors VI, Section 5 (page 127). -/ +def cylinderCuff2 : Set ClosedCylinder := + {p : ClosedCylinder | p.1.1 = 2} + +theorem disjoint_cylinderCuffs : Disjoint cylinderCuff1 cylinderCuff2 := by + rw [Set.disjoint_left] + intro p hp1 hp2 + change p.1.1 = 1 at hp1 + change p.1.1 = 2 at hp2 + linarith + +/-- Construct a point $(r, \theta)$ on `ClosedCylinder` from $r \in [1, 2]$ and angle $\theta \in +\mathbb{R}$. +Graph Minors VI, Section 5 (page 127). -/ +noncomputable def cylinderPoint (r : ℝ) (hr : r ∈ Icc (1 : ℝ) 2) (θ : ℝ) : ClosedCylinder := + ⟨(r, Circle.exp θ), hr, trivial⟩ + +@[simp] +theorem cylinderRadius_cylinderPoint (r : ℝ) (hr : r ∈ Icc (1 : ℝ) 2) (θ : ℝ) : + cylinderRadius (cylinderPoint r hr θ) = r := + rfl + +@[simp] +theorem cylinderAngle_cylinderPoint (r : ℝ) (hr : r ∈ Icc (1 : ℝ) 2) (θ : ℝ) : + cylinderAngle (cylinderPoint r hr θ) = Circle.exp θ := + rfl + +/-! ## 2. Covering Lift and Winding Number $\theta(f)$ -/ + +/-- The angular projection $\gamma \colon [0, 1] \to S^1$ of a curve $f$ on `ClosedCylinder`. -/ +def curveCircleProj (f : Curve ClosedCylinder) : C(unitInterval, Circle) := + ⟨fun x => (f x).1.2, continuous_snd.comp (continuous_subtype_val.comp f.continuous)⟩ + +@[simp] +theorem curveCircleProj_apply (f : Curve ClosedCylinder) (x : unitInterval) : + curveCircleProj f x = (f x).1.2 := + rfl + +/-- The unique continuous angular lift $\Gamma \colon [0, 1] \to \mathbb{R}$ of a curve $f$ on +`ClosedCylinder` starting at $\operatorname{arg}(f(0)) \in (-\pi, \pi]$. +Route: `IsCoveringMap.liftPath` applied to `Circle.isCoveringMap_exp`. -/ +noncomputable def cylinderAngleLift (f : Curve ClosedCylinder) : C(unitInterval, ℝ) := + Circle.isCoveringMap_exp.liftPath (curveCircleProj f) (arg ((f 0).1.2 : ℂ)) + (Circle.exp_arg (f 0).1.2).symm + +@[simp] +theorem cylinderAngleLift_zero (f : Curve ClosedCylinder) : + cylinderAngleLift f 0 = arg ((f 0).1.2 : ℂ) := + Circle.isCoveringMap_exp.liftPath_zero _ _ _ + +theorem exp_comp_cylinderAngleLift (f : Curve ClosedCylinder) : + Circle.exp ∘ cylinderAngleLift f = curveCircleProj f := + Circle.isCoveringMap_exp.liftPath_lifts _ _ _ + +@[simp] +theorem exp_cylinderAngleLift (f : Curve ClosedCylinder) (x : unitInterval) : + Circle.exp (cylinderAngleLift f x) = (f x).1.2 := + congr_fun (exp_comp_cylinderAngleLift f) x + +/-- The *winding number* $\theta(f) \in \mathbb{R}$ of a continuous curve $f \colon [0, 1] \to +\Sigma$ +on the cylinder $\Sigma = [1, 2] \times S^1$, defined as $1/(2\pi)$ times the net angle turned +through by the lifted path `cylinderAngleLift f`. +Graph Minors VI, Section 5 (page 127): "Let $f: [0, 1] \to \Sigma$ be continuous. Then it has +a finite *winding number* $\theta(f)$, defined intuitively as $1/2\pi$ times the the total angle +turned +through (measured counterclockwise) by the line $OX$, where $O$ is the origin, $X = f(x)$, and $x$ +ranges from 0 to 1." -/ +noncomputable def windingNumber (f : Curve ClosedCylinder) : ℝ := + (cylinderAngleLift f 1 - cylinderAngleLift f 0) / (2 * π) + +/-- A constant curve on the cylinder has winding number $0$. -/ +theorem windingNumber_const {f : Curve ClosedCylinder} (hf : f.IsConstant) : + windingNumber f = 0 := by + rcases hf with ⟨c, hc⟩ + have hlift : cylinderAngleLift f = ContinuousMap.const unitInterval (arg ((f 0).1.2 : ℂ)) := by + symm + refine (Circle.isCoveringMap_exp.eq_liftPath_iff' _).mpr ⟨?_, rfl⟩ + ext x + simp [hc x, hc 0, Circle.exp_arg] + simp [windingNumber, hlift] + +/-- Homotopic curves on the cylinder have the same winding number. +Graph Minors VI, Section 5 (page 127). +Route: monodromy invariance `IsCoveringMap.liftPath_apply_one_eq_of_homotopicRel` applied to +`Circle.isCoveringMap_exp`. -/ +theorem windingNumber_eq_of_homotopic {f₀ f₁ : Curve ClosedCylinder} + (h : CurvesHomotopic f₀ f₁) : + windingNumber f₀ = windingNumber f₁ := by + rcases h with ⟨ψ, _, hψ0, hψ1, hψy0, hψy0', hψy1, hψy1'⟩ + have h0_eq : f₀ 0 = f₁ 0 := by + rw [← hψy0 0, ← hψy0' 0] + have h1_eq : f₀ 1 = f₁ 1 := by + rw [← hψy1 0, ← hψy1' 0] + let H_map : C(unitInterval × unitInterval, Circle) := + ⟨fun tx => (ψ (tx.2, tx.1)).1.2, + continuous_snd.comp (continuous_subtype_val.comp + (ψ.continuous.comp (continuous_snd.prodMk continuous_fst)))⟩ + let H_rel : (curveCircleProj f₀).HomotopyRel (curveCircleProj f₁) {0, 1} := + { toContinuousMap := H_map + map_zero_left := fun x => congrArg (fun p : ClosedCylinder => p.1.2) (hψ0 x) + map_one_left := fun x => congrArg (fun p : ClosedCylinder => p.1.2) (hψ1 x) + prop' := by + intro t x hx + rcases hx with rfl | rfl + · exact congrArg (fun p : ClosedCylinder => p.1.2) (hψy0 t) + · exact congrArg (fun p : ClosedCylinder => p.1.2) (hψy1 t) } + have hhom : (curveCircleProj f₀).HomotopicRel (curveCircleProj f₁) {0, 1} := ⟨H_rel⟩ + have hstart : arg ((f₀ 0).1.2 : ℂ) = arg ((f₁ 0).1.2 : ℂ) := by rw [h0_eq] + have hend : cylinderAngleLift f₀ 1 = cylinderAngleLift f₁ 1 := by + have h := Circle.isCoveringMap_exp.liftPath_apply_one_eq_of_homotopicRel hhom + (arg ((f₀ 0).1.2 : ℂ)) (Circle.exp_arg (f₀ 0).1.2).symm + (by rw [curveCircleProj_apply, ← h0_eq, Circle.exp_arg]) + have heq_lift : Circle.isCoveringMap_exp.liftPath (curveCircleProj f₁) (arg ((f₀ 0).1.2 : ℂ)) + (by rw [curveCircleProj_apply, ← h0_eq, Circle.exp_arg]) = cylinderAngleLift f₁ := by + symm + refine (Circle.isCoveringMap_exp.eq_liftPath_iff' _).mpr ⟨?_, ?_⟩ + · exact exp_comp_cylinderAngleLift f₁ + · simp [h0_eq] + rw [heq_lift] at h + exact h + simp only [windingNumber, cylinderAngleLift_zero, hend, hstart] + +/-- If two curves on the cylinder have the same initial point and the same terminal point, then +the difference of their winding numbers is an integer. +Graph Minors VI, Section 5 (page 127): "If $P_1$, $P_2$ are both paths drawn on $\Sigma$ from some +$s \in C_1$ to some $t \in C_2$, then $\theta(P_1) - \theta(P_2)$ is an integer, and is zero if and +only if $P_1$ is homotopic to $P_2$." +Route: fiber periodicity `Circle.exp_eq_exp`. -/ +theorem windingNumber_sub_int_of_same_ends {f₀ f₁ : Curve ClosedCylinder} + (h0 : f₀ 0 = f₁ 0) (h1 : f₀ 1 = f₁ 1) : + ∃ m : ℤ, windingNumber f₀ - windingNumber f₁ = m := by + have hexp : Circle.exp (cylinderAngleLift f₀ 1) = Circle.exp (cylinderAngleLift f₁ 1) := by + rw [exp_cylinderAngleLift, exp_cylinderAngleLift, h1] + rcases Circle.exp_eq_exp.mp hexp with ⟨m, hm⟩ + refine ⟨m, ?_⟩ + have hstart : cylinderAngleLift f₀ 0 = cylinderAngleLift f₁ 0 := by + simp [h0] + have h2pi : (2 * π : ℝ) ≠ 0 := by positivity + unfold windingNumber + rw [hm, hstart] + field_simp [h2pi] + ring + +/-- If two curves on the cylinder have the same endpoints and the same winding number, then they +are homotopic on the cylinder. +Graph Minors VI, Section 5 (page 127). +Route: straight-line homotopy of the radial coordinates in $[1, 2]$ and of the lifted angular +paths `cylinderAngleLift` in $\mathbb{R}$, projected back to `ClosedCylinder` via `Circle.exp`. -/ +theorem curvesHomotopic_of_windingNumber_eq {f₀ f₁ : Curve ClosedCylinder} + (h0 : f₀ 0 = f₁ 0) (h1 : f₀ 1 = f₁ 1) + (hw : windingNumber f₀ = windingNumber f₁) : + CurvesHomotopic f₀ f₁ := by + have hstart : cylinderAngleLift f₀ 0 = cylinderAngleLift f₁ 0 := by simp [h0] + have h2pi : (2 * π : ℝ) ≠ 0 := by positivity + have hend : cylinderAngleLift f₀ 1 = cylinderAngleLift f₁ 1 := by + unfold windingNumber at hw + have hw' := (div_left_inj₀ h2pi).mp hw + linarith + have hr_mem : ∀ p : unitInterval × unitInterval, + (1 - (p.2 : ℝ)) * (f₀ p.1).1.1 + (p.2 : ℝ) * (f₁ p.1).1.1 ∈ Icc (1 : ℝ) 2 := by + intro p + exact convex_Icc (1 : ℝ) 2 (f₀ p.1).2.1 (f₁ p.1).2.1 + (sub_nonneg.mpr p.2.2.2) p.2.2.1 (sub_add_cancel 1 (p.2 : ℝ)) + let rMap : C(unitInterval × unitInterval, ℝ) := + ⟨fun p => (1 - (p.2 : ℝ)) * (f₀ p.1).1.1 + (p.2 : ℝ) * (f₁ p.1).1.1, + Continuous.add + (Continuous.mul (continuous_const.sub (continuous_subtype_val.comp continuous_snd)) + (continuous_fst.comp (continuous_subtype_val.comp (f₀.continuous.comp continuous_fst)))) + (Continuous.mul (continuous_subtype_val.comp continuous_snd) + (continuous_fst.comp (continuous_subtype_val.comp (f₁.continuous.comp continuous_fst))))⟩ + let θMap : C(unitInterval × unitInterval, ℝ) := + ⟨fun p => (1 - (p.2 : ℝ)) * cylinderAngleLift f₀ p.1 + (p.2 : ℝ) * cylinderAngleLift f₁ p.1, + Continuous.add + (Continuous.mul (continuous_const.sub (continuous_subtype_val.comp continuous_snd)) + ((cylinderAngleLift f₀).continuous.comp continuous_fst)) + (Continuous.mul (continuous_subtype_val.comp continuous_snd) + ((cylinderAngleLift f₁).continuous.comp continuous_fst))⟩ + let Ψ : C(unitInterval × unitInterval, ClosedCylinder) := + ⟨fun p => ⟨(rMap p, Circle.exp (θMap p)), hr_mem p, trivial⟩, + (rMap.continuous.prodMk (Circle.exp.continuous.comp θMap.continuous)).subtype_mk + (fun p => ⟨hr_mem p, trivial⟩)⟩ + refine ⟨Ψ, fun _ => trivial, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro x + ext1; ext1 + · change (1 - (0 : ℝ)) * (f₀ x).1.1 + (0 : ℝ) * (f₁ x).1.1 = (f₀ x).1.1 + ring + · change Circle.exp ((1 - (0 : ℝ)) * cylinderAngleLift f₀ x + (0 : ℝ) * cylinderAngleLift f₁ x) + = (f₀ x).1.2 + have : (1 - (0 : ℝ)) * cylinderAngleLift f₀ x + (0 : ℝ) * cylinderAngleLift f₁ x + = cylinderAngleLift f₀ x := by ring + rw [this, exp_cylinderAngleLift] + · intro x + ext1; ext1 + · change (1 - (1 : ℝ)) * (f₀ x).1.1 + (1 : ℝ) * (f₁ x).1.1 = (f₁ x).1.1 + ring + · change Circle.exp ((1 - (1 : ℝ)) * cylinderAngleLift f₀ x + (1 : ℝ) * cylinderAngleLift f₁ x) + = (f₁ x).1.2 + have : (1 - (1 : ℝ)) * cylinderAngleLift f₀ x + (1 : ℝ) * cylinderAngleLift f₁ x + = cylinderAngleLift f₁ x := by ring + rw [this, exp_cylinderAngleLift] + · intro y + ext1; ext1 + · change (1 - (y : ℝ)) * (f₀ 0).1.1 + (y : ℝ) * (f₁ 0).1.1 = (f₀ 0).1.1 + rw [h0]; ring + · change Circle.exp ((1 - (y : ℝ)) * cylinderAngleLift f₀ 0 + (y : ℝ) * cylinderAngleLift f₁ 0) + = (f₀ 0).1.2 + have : (1 - (y : ℝ)) * cylinderAngleLift f₀ 0 + (y : ℝ) * cylinderAngleLift f₁ 0 + = cylinderAngleLift f₀ 0 := by + rw [hstart]; ring + rw [this, exp_cylinderAngleLift] + · intro y + ext1; ext1 + · change (1 - (y : ℝ)) * (f₀ 0).1.1 + (y : ℝ) * (f₁ 0).1.1 = (f₁ 0).1.1 + rw [h0]; ring + · change Circle.exp ((1 - (y : ℝ)) * cylinderAngleLift f₀ 0 + (y : ℝ) * cylinderAngleLift f₁ 0) + = (f₁ 0).1.2 + have : (1 - (y : ℝ)) * cylinderAngleLift f₀ 0 + (y : ℝ) * cylinderAngleLift f₁ 0 + = cylinderAngleLift f₁ 0 := by + rw [hstart]; ring + rw [this, exp_cylinderAngleLift] + · intro y + ext1; ext1 + · change (1 - (y : ℝ)) * (f₀ 1).1.1 + (y : ℝ) * (f₁ 1).1.1 = (f₀ 1).1.1 + rw [h1]; ring + · change Circle.exp ((1 - (y : ℝ)) * cylinderAngleLift f₀ 1 + (y : ℝ) * cylinderAngleLift f₁ 1) + = (f₀ 1).1.2 + have : (1 - (y : ℝ)) * cylinderAngleLift f₀ 1 + (y : ℝ) * cylinderAngleLift f₁ 1 + = cylinderAngleLift f₀ 1 := by + rw [hend]; ring + rw [this, exp_cylinderAngleLift] + · intro y + ext1; ext1 + · change (1 - (y : ℝ)) * (f₀ 1).1.1 + (y : ℝ) * (f₁ 1).1.1 = (f₁ 1).1.1 + rw [h1]; ring + · change Circle.exp ((1 - (y : ℝ)) * cylinderAngleLift f₀ 1 + (y : ℝ) * cylinderAngleLift f₁ 1) + = (f₁ 1).1.2 + have : (1 - (y : ℝ)) * cylinderAngleLift f₀ 1 + (y : ℝ) * cylinderAngleLift f₁ 1 + = cylinderAngleLift f₁ 1 := by + rw [hend]; ring + rw [this, exp_cylinderAngleLift] + +/-- Two curves on the cylinder with the same endpoints are homotopic if and only if they have the +same winding number. +Graph Minors VI, Section 5 (page 127): "and is zero if and only if $P_1$ is homotopic to $P_2$." -/ +theorem curvesHomotopic_iff_windingNumber_eq {f₀ f₁ : Curve ClosedCylinder} + (h0 : f₀ 0 = f₁ 0) (h1 : f₀ 1 = f₁ 1) : + CurvesHomotopic f₀ f₁ ↔ windingNumber f₀ = windingNumber f₁ := + ⟨windingNumber_eq_of_homotopic, curvesHomotopic_of_windingNumber_eq h0 h1⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Defs.lean b/LeanPool/GraphMinor/Surface/Defs.lean new file mode 100644 index 0000000000..1451c90a65 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Defs.lean @@ -0,0 +1,848 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Statement +public import LeanPool.GraphMinor.Hypergraph.Basic +public import Mathlib.Analysis.Complex.Circle +public import Mathlib.Geometry.Manifold.Instances.Real +public import Mathlib.Topology.Connected.PathConnected +public import Mathlib.Topology.Homotopy.Path +import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# Topological Surfaces, Curves, Discs, Drawings, and Paintings + +This file defines the foundational topological notions for surfaces and graphs/hypergraphs +drawn on surfaces, shared by Graph Minors VI–IX and XI–XX: +- Standard model spaces (`EuclideanPlane`, `ClosedUnitDisc`, `OpenUnitDisc`, `UnitCircle`, + `ClosedCylinder`) and connected/path-connected components in a subset (`componentsIn`, + `arcComponentsIn`). +- Surfaces with boundary (`IsSurface`), closed surfaces (`IsClosedSurface`), manifold boundary + (`bd`), topological frontier (`subBd`), cuffs (`IsCuff`), closed discs (`IsClosedDisc`), open + discs (`IsOpenDisc`), lines (`IsLine`, `IsLineWithEnds`), $O$-arcs (`IsOArc`), and $I$-arcs + (`IsIArc`, `IsProperIArc`). +- Parameterized curves (`Curve`), internal curves (`Curve.IsInternal`), injective curves / lines + (`Curve.IsLine`), homotopy of curves and closed curves in a subset, null-homotopic curves and + $O$-arcs, and simply connected subsets (`IsSimplyConnectedSet`). +- Topological drawings (`Drawing`) and paintings (`Painting`) in a surface $S$, their edges, + regions, atoms, subdrawings, $\Gamma$-normality, restrictions $\Gamma \cap \Delta$, 2-cell + drawings, walks and curves tracing walks, homotopy of forests, + and the canonical bridge to `Graph` (`Drawing.toGraph`, `GraphDrawing`) and + `Hypergraph` (`Painting.toHypergraph`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology unitInterval Graph + +universe u v w + +/-! ## 1. Standard Model Spaces and Components in a Subset -/ + +/-- The Euclidean plane $\mathbb{R}^2$, modeled as `EuclideanSpace ℝ (Fin 2)`. -/ +abbrev EuclideanPlane : Type := EuclideanSpace ℝ (Fin 2) + +/-- The closed unit disc $\{(x, y) \in \mathbb{R}^2 : x^2 + y^2 \le 1\}$. +Graph Minors XI, Section 3 (page 74); Graph Minors XIV, Section 2 (page 25). -/ +noncomputable def ClosedUnitDisc : Set EuclideanPlane := + Metric.closedBall 0 1 + +/-- The open unit disc $\{(x, y) \in \mathbb{R}^2 : x^2 + y^2 < 1\}$. +Graph Minors XI, Section 3 (page 74); Graph Minors XIV, Section 2 (page 25). -/ +noncomputable def OpenUnitDisc : Set EuclideanPlane := + Metric.ball 0 1 + +/-- The unit circle $\{(x, y) \in \mathbb{R}^2 : x^2 + y^2 = 1\}$ in $\mathbb{R}^2$. +Graph Minors XI, Section 3 (page 76). -/ +noncomputable def UnitCircle : Set EuclideanPlane := + Metric.sphere 0 1 + +/-- The standard closed cylinder $[1, 2] \times S^1$. +Graph Minors VI, Section 5 (page 127): "It is convenient in this section to take a concrete +representation of $\Sigma$ (using polar coordinates) as +$$\Sigma = \{(r, \theta): 1 \le r \le 2, 0 \le \theta < 2\pi\}$$" -/ +def ClosedCylinder : Set (ℝ × Circle) := + Set.Icc (1 : ℝ) 2 ×ˢ Set.univ + +/-- The equivalence relation on `[0, 1] × [0, 1]` identifying `(0, y)` with `(1, 1 - y)`. -/ +def mobiusSetoid : Setoid (unitInterval × unitInterval) := + Relation.EqvGen.setoid fun p q => p.1 = 0 ∧ q.1 = 1 ∧ q.2 = unitInterval.symm p.2 + +/-- The standard Möbius band: the square `[0, 1] × [0, 1]` with `(0, y)` glued to `(1, 1 - y)`. -/ +abbrev MobiusBand : Type := + Quotient mobiusSetoid + +/-- The set of connected components of a subset $F \subseteq S$. -/ +noncomputable def componentsIn {S : Type u} [TopologicalSpace S] (F : Set S) : Set (Set S) := + (connectedComponentIn F) '' F + +/-- The set of arc-wise (path) connected components of a subset $F \subseteq S$. +Graph Minors XI, Section 3 (page 74): "$U - V$ has only finitely many arc-wise connected +components, called *edges*, ..." -/ +def arcComponentsIn {S : Type u} [TopologicalSpace S] (F : Set S) : Set (Set S) := + {C : Set S | C.Nonempty ∧ C ⊆ F ∧ IsPathConnected C ∧ + ∀ D : Set S, D ⊆ F → IsPathConnected D → C ⊆ D → D = C} + +/-- Every point `x ∈ F` belongs to `pathComponentIn F x ∈ arcComponentsIn F`. -/ +theorem mem_arcComponentsIn_of_mem {S : Type u} [TopologicalSpace S] + {F : Set S} {x : S} (hx : x ∈ F) : + pathComponentIn F x ∈ arcComponentsIn F := by + refine ⟨⟨x, mem_pathComponentIn_self hx⟩, pathComponentIn_subset, + isPathConnected_pathComponentIn hx, ?_⟩ + intro D hDF hD hxD + exact Subset.antisymm (hD.subset_pathComponentIn (hxD (mem_pathComponentIn_self hx)) hDF) hxD + +/-! ## 2. Surfaces, Boundary, Cuffs, Discs, Lines, and $O$-Arcs -/ + +/-- A point $x \in S$ is an *interior point* of a 2-manifold $S$ if it has an open +neighbourhood homeomorphic to the open unit disc in $\mathbb{R}^2$. -/ +def IsInteriorPoint {S : Type u} [TopologicalSpace S] (x : S) : Prop := + ∃ U : Set S, IsOpen U ∧ x ∈ U ∧ Nonempty (U ≃ₜ OpenUnitDisc) + +/-- A point $x \in S$ is a *chart point* of a 2-manifold with boundary $S$ if it has an +open neighbourhood homeomorphic either to the open unit disc or to an open subset of the upper +half-plane `EuclideanHalfSpace 2`. -/ +def IsManifoldPoint {S : Type u} [TopologicalSpace S] (x : S) : Prop := + ∃ (U : Set S) (V : Set (EuclideanHalfSpace 2)), + IsOpen U ∧ IsOpen V ∧ x ∈ U ∧ Nonempty (U ≃ₜ V) + +/-- The *boundary* $\operatorname{bd}(\Sigma)$ of a surface $\Sigma$ is the set of points of +$\Sigma$ that do not have an open neighbourhood homeomorphic to an open disc. +Graph Minors VI, Section 1 (page 116): "A *surface* is a compact 2-manifold with boundary. ... We +generally denote a surface by $\Sigma$, and its boundary by $bd(\Sigma)$. Any component of +$bd(\Sigma)$ is called a *cuff* of $\Sigma$." +Graph Minors VII, Section 2 (page 213): "The boundary of a surface $\Sigma$ is denoted by +$\operatorname{bd}(\Sigma)$, and each component of $\operatorname{bd}(\Sigma)$ is called a +*cuff*." -/ +def bd (S : Type u) [TopologicalSpace S] : Set S := + {x : S | ¬ IsInteriorPoint x} + +/-- A *surface* (with possibly empty boundary) is a compact 2-manifold with boundary. +Graph Minors VI, Section 1 (page 116): "A *surface* is a compact 2-manifold with boundary." +Graph Minors VII, Section 2 (page 213): "A *surface* is a compact 2-manifold with (possibly null) +boundary." -/ +def IsSurface (S : Type u) [TopologicalSpace S] : Prop := + CompactSpace S ∧ T2Space S ∧ ∀ x : S, IsManifoldPoint x + +/-- A *closed surface* (or surface without boundary) is a compact 2-manifold without boundary. +Graph Minors XI, Section 3 (page 74): "A *surface* is a compact 2-manifold, without boundary." -/ +def IsClosedSurface (S : Type u) [TopologicalSpace S] : Prop := + CompactSpace S ∧ T2Space S ∧ ∀ x : S, IsInteriorPoint x + +/-- A *cuff* of a surface $\Sigma$ is a connected component of $\operatorname{bd}(\Sigma)$. +Graph Minors VI, Section 1 (page 116); Graph Minors VII, Section 2 (page 213); +Graph Minors XI, Section 3 (page 74); Graph Minors XIX, Section 2 (page 327). -/ +def IsCuff {S : Type u} [TopologicalSpace S] (C : Set S) : Prop := + C ∈ componentsIn (bd S) + +/-- The set of all cuffs of $\Sigma$. -/ +noncomputable def cuffs (S : Type u) [TopologicalSpace S] : Set (Set S) := + componentsIn (bd S) + +/-- For a subset $\Delta \subseteq \Sigma$, its topological boundary in $\Sigma$ is +$\bar{\Delta} \cap \overline{\Sigma - \Delta}$ (the topological frontier). +Graph Minors XI, Section 3 (page 74): "If $\Delta \subseteq \Sigma$, then $\bar{\Delta}$ denotes +the closure of $\Delta$, and $\operatorname{bd}(\Delta)$ denotes +$\bar{\Delta} \cap \overline{\Sigma - \Delta}$." -/ +def subBd {S : Type u} [TopologicalSpace S] (Δ : Set S) : Set S := + closure Δ ∩ closure (Set.univ \ Δ) + +/-- For a subset $X \subseteq \Sigma$, $\tilde{X} = \bar{X} \setminus X$. +Graph Minors XVII, Section 1 (page 164); Graph Minors XIX, Section 2 (page 327). -/ +def tilde {S : Type u} [TopologicalSpace S] (X : Set S) : Set S := + closure X \ X + +/-- A *closed disc* in $\Sigma$ is a subset $\Delta \subseteq \Sigma$ homeomorphic to +$\{(x, y) \in \mathbb{R}^2 : x^2 + y^2 \le 1\}$. +Graph Minors XI, Section 3 (pages 74–75): "$\Delta \subseteq \Sigma$ is a *closed disc* if it is +homeomorphic to $\{(x, y) : x^2 + y^2 \le 1\}$, and ... an *open disc* is defined similarly." -/ +def IsClosedDisc {S : Type u} [TopologicalSpace S] (Δ : Set S) : Prop := + Nonempty (ClosedUnitDisc ≃ₜ Δ) + +/-- The boundary $O$-arc of a closed disc $\Delta \subseteq \Sigma$, that is, its manifold boundary +$\operatorname{bd}(\Delta)$ when viewed as a surface in the subspace topology. -/ +def discBd {S : Type u} [TopologicalSpace S] (Δ : Set S) : Set S := + Subtype.val '' (bd Δ) + +/-- An *open disc* in $\Sigma$ is an open subset $\Lambda \subseteq \Sigma$ homeomorphic to +$\{(x, y) \in \mathbb{R}^2 : x^2 + y^2 < 1\}$. +Graph Minors XI, Section 3 (page 74); Graph Minors XIV, Section 2 (page 25). -/ +def IsOpenDisc {S : Type u} [TopologicalSpace S] (Λ : Set S) : Prop := + IsOpen Λ ∧ Nonempty (OpenUnitDisc ≃ₜ Λ) + +/-- If $X$ is a topological space, an *$X$-arc* in $\Sigma$ is a subset of $\Sigma$ homeomorphic to +$X$. +Graph Minors VII, Section 5 (page 231); Graph Minors VIII, Section 5 (page 262). -/ +def IsXArc {S : Type u} [TopologicalSpace S] (X : Type v) [TopologicalSpace X] + (F : Set S) : Prop := + Nonempty (X ≃ₜ F) + +/-- A *line* (or $[0, 1]$-arc) in $\Sigma$ is a subset $L \subseteq \Sigma$ homeomorphic to the unit +interval $[0, 1]$. +Graph Minors XI, Section 3 (page 74): "A *line* in $\Sigma$ is a subset homeomorphic to $[0, 1]$, +and its *ends* are defined in the natural way." -/ +def IsLine {S : Type u} [TopologicalSpace S] (L : Set S) : Prop := + Nonempty (unitInterval ≃ₜ L) + +/-- A subset $L \subseteq \Sigma$ is a *line with ends $u$ and $v$* if there is a homeomorphism +$f \colon [0, 1] \simeq_t L$ mapping $0$ to $u$ and $1$ to $v$. +Graph Minors VII, Section 2 (page 214); Graph Minors XI, Section 3 (page 74). -/ +def IsLineWithEnds {S : Type u} [TopologicalSpace S] (L : Set S) (u v : S) : Prop := + ∃ f : unitInterval ≃ₜ L, (f 0).1 = u ∧ (f 1).1 = v + +/-- A line with specified ends is preconnected. -/ +theorem IsLineWithEnds.isPreconnected {S : Type*} [TopologicalSpace S] {L : Set S} {a b : S} + (h : IsLineWithEnds L a b) : IsPreconnected L := by + obtain ⟨f, -, -⟩ := h + have hL : range (fun t => (f t).1) = L := + subset_antisymm (by rintro _ ⟨t, rfl⟩; exact (f t).2) + (fun x hx => ⟨f.symm ⟨x, hx⟩, by simp⟩) + rw [← hL] + exact isPreconnected_range (continuous_subtype_val.comp f.continuous) + +/-- The circle has a representative in each half-open interval of length one full turn. -/ +theorem exists_circleExp_mem_Ico (a : ℝ) (z : Circle) : + ∃ t ∈ Ico a (a + 2 * Real.pi), Circle.exp t = z := by + obtain ⟨t, ht⟩ := Circle.exp_surjective z + obtain ⟨s, hs, h⟩ := Circle.periodic_exp.exists_mem_Ico (by positivity) t a + exact ⟨s, hs, h.symm.trans ht⟩ + +/-- A map continuous and injective on a line carries it to a line with the image endpoints. -/ +theorem IsLineWithEnds.image_under_injOn {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] + [T2Space T] {L : Set S} {u v : S} (hl : IsLineWithEnds L u v) {g : S → T} + (hc : ContinuousOn g L) (hi : InjOn g L) : IsLineWithEnds (g '' L) (g u) (g v) := by + obtain ⟨f, h0, h1⟩ := hl + let e : unitInterval → T := fun t => g (f t).1 + have hec : Continuous e := + hc.comp_continuous (continuous_subtype_val.comp f.continuous) fun t => (f t).2 + have hei : Function.Injective e := fun x y he => + f.injective (Subtype.ext (hi (f x).2 (f y).2 he)) + have hr : range e = g '' L := by + ext y + constructor + · rintro ⟨t, rfl⟩ + exact ⟨_, (f t).2, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + exact ⟨f.symm ⟨z, hz⟩, by simp [e]⟩ + have hem := hec.isClosedEmbedding hei + refine ⟨hem.isEmbedding.toHomeomorph.trans (Homeomorph.setCongr hr), ?_, ?_⟩ + · change e 0 = g u + simp [e, h0] + · change e 1 = g v + simp [e, h1] + +/-- The points of a line other than its two endpoints are parameterized by `(0, 1)`. -/ +theorem line_interior_eq_image {S : Type u} [TopologicalSpace S] {L : Set S} {a b : S} + (f : unitInterval ≃ₜ L) (ha : (f 0).1 = a) (hb : (f 1).1 = b) : + L \ {a, b} = (fun t : ℝ ↦ (f (projIcc 0 1 zero_le_one t)).1) '' Ioo (0 : ℝ) 1 := by + let g : ℝ → S := fun t => (f (projIcc 0 1 zero_le_one t)).1 + change L \ {a, b} = g '' Ioo (0 : ℝ) 1 + ext x + constructor + · rintro ⟨hxL, hx⟩ + obtain ⟨t, ht⟩ := f.surjective ⟨x, hxL⟩ + have ht0 : t ≠ 0 := by + rintro rfl + apply hx + have := congrArg Subtype.val ht + simp only [ha] at this + simp [← this] + have ht1 : t ≠ 1 := by + rintro rfl + apply hx + have := congrArg Subtype.val ht + simp only [hb] at this + simp [← this] + have h0 : (0 : ℝ) < t.1 := lt_of_le_of_ne t.2.1 fun h => ht0 (Subtype.ext h.symm) + have h1 : t.1 < 1 := lt_of_le_of_ne t.2.2 fun h => ht1 (Subtype.ext h) + refine ⟨t.1, ⟨h0, h1⟩, ?_⟩ + have : projIcc (0 : ℝ) 1 zero_le_one t.1 = t := projIcc_val zero_le_one t + simp only [g, this, ht] + · rintro ⟨t, ⟨h0, h1⟩, rfl⟩ + have hmem : (f (projIcc 0 1 zero_le_one t)).1 ∈ L := (f _).2 + refine ⟨hmem, ?_⟩ + have hp : projIcc (0 : ℝ) 1 zero_le_one t = ⟨t, h0.le, h1.le⟩ := + projIcc_of_mem zero_le_one ⟨h0.le, h1.le⟩ + intro hx + rcases hx with hx | hx + · have : f (projIcc 0 1 zero_le_one t) = f 0 := Subtype.ext (hx.trans ha.symm) + have := f.injective this + rw [hp] at this + have := congrArg Subtype.val this + simp only [Icc.coe_zero] at this + linarith + · have : f (projIcc 0 1 zero_le_one t) = f 1 := + Subtype.ext ((mem_singleton_iff.mp hx).trans hb.symm) + have := f.injective this + rw [hp] at this + have := congrArg Subtype.val this + simp only [Icc.coe_one] at this + linarith + +/-- The interior of a line is path connected. -/ +theorem IsLineWithEnds.isPathConnected_interior {S : Type u} [TopologicalSpace S] + {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : IsPathConnected (L \ {a, b}) := by + obtain ⟨f, ha, hb⟩ := h + rw [line_interior_eq_image f ha hb] + exact ((convex_Ioo (0 : ℝ) 1).isPathConnected ⟨1 / 2, by norm_num, by norm_num⟩).image + (continuous_subtype_val.comp (f.continuous.comp continuous_projIcc)) + +/-- Each point of a line lies in the closure of its interior. -/ +theorem IsLineWithEnds.subset_closure_interior {S : Type u} [TopologicalSpace S] + {L : Set S} {a b : S} (h : IsLineWithEnds L a b) : L ⊆ closure (L \ {a, b}) := by + obtain ⟨f, ha, hb⟩ := h + let g : ℝ → S := fun t => (f (projIcc 0 1 zero_le_one t)).1 + have hg : Continuous g := continuous_subtype_val.comp (f.continuous.comp continuous_projIcc) + rw [line_interior_eq_image f ha hb] + change L ⊆ closure (g '' Ioo (0 : ℝ) 1) + apply Subset.trans ?_ (image_closure_subset_closure_image hg) + rw [closure_Ioo zero_ne_one] + intro x hx + obtain ⟨t, ht⟩ := f.surjective ⟨x, hx⟩ + exact ⟨t.1, t.2, by simp only [g, projIcc_val, ht]⟩ + +/-- In a Hausdorff space a line is closed, and its endpoints lie in the closure of any set +that covers its interior. -/ +theorem IsLineWithEnds.isClosed_union_and_endpoints_mem_closure {X : Type u} [TopologicalSpace X] + [T2Space X] {B : Set X} {s t : X} (hline : IsLineWithEnds (B ∪ {s, t}) s t) : + IsClosed (B ∪ {s, t}) ∧ s ∈ closure B ∧ t ∈ closure B := by + have hsub : (B ∪ {s, t}) \ {s, t} ⊆ B := fun _ hx => + hx.1.resolve_right hx.2 + have hclosure := hline.subset_closure_interior.trans (closure_mono hsub) + refine ⟨?_, hclosure (Or.inr (Or.inl rfl)), hclosure (Or.inr (Or.inr rfl))⟩ + obtain ⟨f, _, _⟩ := hline + have hrange : range (fun u : unitInterval => (f u).1) = B ∪ {s, t} := by + ext x + exact ⟨fun ⟨u, hu⟩ => hu ▸ (f u).2, fun hx => ⟨f.symm ⟨x, hx⟩, by simp⟩⟩ + rw [← hrange] + exact (isCompact_range (continuous_subtype_val.comp f.continuous)).isClosed + +/-- The set of ends of a line $L \subseteq \Sigma$. +Graph Minors XI, Section 3 (page 74); Graph Minors XIX, Section 15 (page 381). -/ +def lineEnds {S : Type u} [TopologicalSpace S] (L : Set S) : Set S := + {u : S | ∃ v : S, IsLineWithEnds L u v} + +/-- An *$O$-arc* in $\Sigma$ is a subset $F \subseteq \Sigma$ homeomorphic to the circle $S^1$. +Graph Minors VII, Section 2 (page 214); Graph Minors XI, Section 3 (page 74): +"An *O-arc* is a subset homeomorphic to a circle." -/ +def IsOArc {S : Type u} [TopologicalSpace S] (F : Set S) : Prop := + Nonempty (Circle ≃ₜ F) + +/-- A subset homeomorphic to the circle is preconnected. -/ +theorem IsOArc.isPreconnected {S : Type*} [TopologicalSpace S] {F : Set S} + (h : IsOArc F) : IsPreconnected F := by + obtain ⟨f⟩ := h + have hF : range (fun t => (f t).1) = F := + subset_antisymm (by rintro _ ⟨t, rfl⟩; exact (f t).2) + (fun x hx => ⟨f.symm ⟨x, hx⟩, by simp⟩) + rw [← hF] + exact isPreconnected_range (continuous_subtype_val.comp f.continuous) + +/-- An *$I$-arc* in $\Sigma$ is a subset $F \subseteq \Sigma$ homeomorphic to $[0, 1]$ with both +ends in $\operatorname{bd}(\Sigma)$. +Graph Minors VII, Section 2 (page 214): "An *I-arc* is a subset $F \subseteq \Sigma$ homeomorphic +to $[0, 1]$, such that there is a homeomorphism $f \colon [0, 1] \to F$ with +$f(0), f(1) \in \operatorname{bd}(\Sigma)$." -/ +def IsIArc {S : Type u} [TopologicalSpace S] (F : Set S) : Prop := + ∃ u v : S, u ∈ bd S ∧ v ∈ bd S ∧ IsLineWithEnds F u v + +/-- A *proper $I$-arc* in $\Sigma$ is an $I$-arc $F$ with $|F \cap \operatorname{bd}(\Sigma)| = 2$ +(its two ends are in $\operatorname{bd}(\Sigma)$ and no interior point is in +$\operatorname{bd}(\Sigma)$). +Graph Minors VII, Section 2 (page 218); Graph Minors XVII, Section 1 (page 164). -/ +def IsProperIArc {S : Type u} [TopologicalSpace S] (F : Set S) : Prop := + ∃ u v : S, u ≠ v ∧ F ∩ bd S = {u, v} ∧ IsLineWithEnds F u v + +/-! ## 3. Parameterized Curves and Homotopy -/ + +/-- A *curve* in a surface $\Sigma$ is a continuous map $\phi \colon [0, 1] \to \Sigma$. +Graph Minors VI, Section 4 (page 123) & Section 5 (page 127) (paraphrased); +Graph Minors XI, Section 3 (page 75): "A curve in a surface $\Sigma$ is a continuous function +$\phi : [0, 1] \to \Sigma$." -/ +abbrev Curve (S : Type u) [TopologicalSpace S] : Type u := + C(unitInterval, S) + +/-- The initial point $f(0)$ of a curve $f$. -/ +def Curve.head {S : Type u} [TopologicalSpace S] (f : Curve S) : S := + f 0 + +/-- The terminal point $f(1)$ of a curve $f$. -/ +def Curve.tail {S : Type u} [TopologicalSpace S] (f : Curve S) : S := + f 1 + +/-- The set $\{f(0), f(1)\}$ of *ends* of a curve $f$ (paraphrasing Graph Minors VI, Section 4, +page 123, and Graph Minors VII, Section 2, page 214). -/ +def Curve.ends {S : Type u} [TopologicalSpace S] (f : Curve S) : Set S := + {f 0, f 1} + +/-- The image $|f|$ (denoted $|f|$ in GM VI and $|\phi|$ in GM XI) of a curve $f$, that is, +$\{f(x) : 0 \le x \le 1\}$. +Graph Minors VI, Section 5 (page 129); Graph Minors XI, Section 3 (page 75). -/ +def Curve.support {S : Type u} [TopologicalSpace S] (f : Curve S) : Set S := + Set.range f + +/-- The *interior* $f((0, 1))$ of a curve $f$ (paraphrasing Graph Minors VI, Section 4, page 123, +and Graph Minors VII, Section 2, page 214). -/ +def Curve.interiorSupport {S : Type u} [TopologicalSpace S] (f : Curve S) : Set S := + f '' {t : unitInterval | (0 : ℝ) < t.1 ∧ t.1 < 1} + +/-- A curve $f$ is *internal* if its interior $f((0, 1))$ is disjoint from +$\operatorname{bd}(\Sigma)$ +(paraphrasing Graph Minors VI, Section 4, page 123, and Graph Minors VII, Section 2, page 218). -/ +def Curve.IsInternal {S : Type u} [TopologicalSpace S] (f : Curve S) : Prop := + Disjoint f.interiorSupport (bd S) + +/-- A curve $f \colon [0, 1] \to \Sigma$ is a *line* (parameterized injection) if it is +injective: $f(x) \ne f(y)$ for $0 \le x < y \le 1$ (paraphrasing the "continuous injection" +parameterization of paths in Graph Minors VI, Section 4, page 123, and Section 5, page 127). -/ +def Curve.IsLine {S : Type u} [TopologicalSpace S] (f : Curve S) : Prop := + Function.Injective f + +/-- A curve $\phi$ is *constant* if $|\phi|$ is a singleton. +Graph Minors XI, Section 3 (page 75). -/ +def Curve.IsConstant {S : Type u} [TopologicalSpace S] (f : Curve S) : Prop := + ∃ c : S, ∀ x : unitInterval, f x = c + +/-- Two curves $\phi_0, \phi_1 \colon [0, 1] \to \Sigma$ are *homotopic in $Z \subseteq \Sigma$* if +there is a continuous map $\psi \colon [0, 1] \times [0, 1] \to \Sigma$ with values in $Z$ such that +$\psi(x, 0) = \phi_0(x)$, $\psi(x, 1) = \phi_1(x)$, $\psi(0, y) = \phi_0(0) = \phi_1(0)$, and +$\psi(1, y) = \phi_0(1) = \phi_1(1)$. +Graph Minors VI, Section 4 (page 122) & Section 5 (page 126); +Graph Minors XI, Section 3 (pages 75–76). -/ +def CurvesHomotopicIn {S : Type u} [TopologicalSpace S] (Z : Set S) + (φ₀ φ₁ : Curve S) : Prop := + ∃ ψ : C(unitInterval × unitInterval, S), + (∀ p, ψ p ∈ Z) ∧ + (∀ x, ψ (x, 0) = φ₀ x) ∧ + (∀ x, ψ (x, 1) = φ₁ x) ∧ + (∀ y, ψ (0, y) = φ₀ 0) ∧ + (∀ y, ψ (0, y) = φ₁ 0) ∧ + (∀ y, ψ (1, y) = φ₀ 1) ∧ + (∀ y, ψ (1, y) = φ₁ 1) + +/-- Two curves $\phi_0, \phi_1$ are *homotopic* in $\Sigma$ if they are homotopic in `Set.univ`. +Graph Minors VI, Section 5 (page 126); Graph Minors XI, Section 3 (page 75). -/ +def CurvesHomotopic {S : Type u} [TopologicalSpace S] (φ₀ φ₁ : Curve S) : Prop := + CurvesHomotopicIn Set.univ φ₀ φ₁ + +/-- A curve $\phi$ is *null-homotopic in $Z$* if it is homotopic in $Z$ to a constant curve. +Graph Minors XI, Section 3 (page 76). -/ +def Curve.IsNullHomotopicIn {S : Type u} [TopologicalSpace S] (Z : Set S) + (φ : Curve S) : Prop := + ∃ c : Curve S, c.IsConstant ∧ CurvesHomotopicIn Z φ c + +/-- Two continuous maps $\phi_0, \phi_1 \colon S^1 \to \Sigma$ are *homotopic in $Z$* if there is a +continuous map $\psi \colon S^1 \times [0, 1] \to \Sigma$ with values in $Z$ such that +$\psi(x, 0) = \phi_0(x)$ and $\psi(x, 1) = \phi_1(x)$ for all $x \in S^1$. +Graph Minors XI, Section 3 (page 76). -/ +def ClosedCurvesHomotopicIn {S : Type u} [TopologicalSpace S] (Z : Set S) + (φ₀ φ₁ : C(Circle, S)) : Prop := + ∃ ψ : C(Circle × unitInterval, S), + (∀ p, ψ p ∈ Z) ∧ + (∀ x, ψ (x, 0) = φ₀ x) ∧ + (∀ x, ψ (x, 1) = φ₁ x) + +/-- Homotopy of closed curves in `Z` is transitive. -/ +theorem ClosedCurvesHomotopicIn.trans {S : Type u} [TopologicalSpace S] + {Z : Set S} {φ₀ φ₁ φ₂ : C(Circle, S)} + (h₁ : ClosedCurvesHomotopicIn Z φ₀ φ₁) (h₂ : ClosedCurvesHomotopicIn Z φ₁ φ₂) : + ClosedCurvesHomotopicIn Z φ₀ φ₂ := by + obtain ⟨ψ₁, h₁Z, h₁0, h₁1⟩ := h₁ + obtain ⟨ψ₂, h₂Z, h₂0, h₂1⟩ := h₂ + have hmem₀ : ∀ x, φ₀ x ∈ Z := fun x => h₁0 x ▸ h₁Z _ + have hmem₁ : ∀ x, φ₁ x ∈ Z := fun x => h₁1 x ▸ h₁Z _ + have hmem₂ : ∀ x, φ₂ x ∈ Z := fun x => h₂1 x ▸ h₂Z _ + let f₀ : C(Circle, Z) := ⟨fun x => ⟨φ₀ x, hmem₀ x⟩, by fun_prop⟩ + let f₁ : C(Circle, Z) := ⟨fun x => ⟨φ₁ x, hmem₁ x⟩, by fun_prop⟩ + let f₂ : C(Circle, Z) := ⟨fun x => ⟨φ₂ x, hmem₂ x⟩, by fun_prop⟩ + let H₁ : ContinuousMap.Homotopy f₀ f₁ := + { toFun := fun p => ⟨ψ₁ (p.2, p.1), h₁Z _⟩ + continuous_toFun := by fun_prop + map_zero_left := fun x => Subtype.ext (h₁0 x) + map_one_left := fun x => Subtype.ext (h₁1 x) } + let H₂ : ContinuousMap.Homotopy f₁ f₂ := + { toFun := fun p => ⟨ψ₂ (p.2, p.1), h₂Z _⟩ + continuous_toFun := by fun_prop + map_zero_left := fun x => Subtype.ext (h₂0 x) + map_one_left := fun x => Subtype.ext (h₂1 x) } + let H := H₁.trans H₂ + refine ⟨⟨fun p => (H (p.2, p.1)).1, by fun_prop⟩, fun p => (H (p.2, p.1)).2, fun x => ?_, + fun x => ?_⟩ + · have := H.map_zero_left x + exact congrArg Subtype.val this + · have := H.map_one_left x + exact congrArg Subtype.val this + +/-- A continuous map $\phi \colon S^1 \to \Sigma$ is *null-homotopic in $Z$* if it is homotopic in +$Z$ to a constant map. +Graph Minors XI, Section 3 (page 76). -/ +def ClosedCurveIsNullHomotopicIn {S : Type u} [TopologicalSpace S] (Z : Set S) + (φ : C(Circle, S)) : Prop := + ∃ c : S, c ∈ Z ∧ ClosedCurvesHomotopicIn Z φ (ContinuousMap.const Circle c) + +/-- An $O$-arc $F \subseteq \Sigma$ is *null-homotopic in $Z$* if there is a homeomorphism +$\phi \colon S^1 \simeq_t F$ whose composition with the inclusion $F \hookrightarrow \Sigma$ is +null-homotopic in $Z$. +Graph Minors VII, Section 2 (page 214); Graph Minors XI, Section 3 (page 76). -/ +def IsNullHomotopicOArcIn {S : Type u} [TopologicalSpace S] (Z : Set S) (F : Set S) : Prop := + ∃ φ : Circle ≃ₜ F, + ClosedCurveIsNullHomotopicIn Z ⟨fun x => (φ x).1, continuous_subtype_val.comp φ.continuous⟩ + +/-- An $O$-arc $F \subseteq \Sigma$ is *null-homotopic* in $\Sigma$ if it is null-homotopic in +`Set.univ`. +Graph Minors VII, Section 2 (page 214); Graph Minors XI, Section 3 (page 76). -/ +def IsNullHomotopicOArc {S : Type u} [TopologicalSpace S] (F : Set S) : Prop := + IsNullHomotopicOArcIn Set.univ F + +/-- A subset $Z \subseteq \Sigma$ is *simply-connected* if it is arc-wise connected and every +continuous function $\phi \colon S^1 \to Z$ is null-homotopic in $Z$. +Graph Minors XI, Section 3 (page 76). -/ +def IsSimplyConnectedSet {S : Type u} [TopologicalSpace S] (Z : Set S) : Prop := + IsPathConnected Z ∧ + ∀ φ : C(Circle, S), Set.range φ ⊆ Z → ClosedCurveIsNullHomotopicIn Z φ + +/-! ## 4. Drawings and Paintings in a Surface -/ + +/-- A *drawing* $\Gamma = (U, V)$ in a topological space $\Sigma$: $V \subseteq U \subseteq \Sigma$, +$U$ is closed, $V$ is finite, $U - V$ has finitely many arc-wise connected components (called +*edges*), and for every edge $e$, either $\bar{e}$ is a line whose set of ends is $\bar{e} \cap V$ +(with 2 distinct ends), or $\bar{e}$ is an $O$-arc and $|\bar{e} \cap V| = 1$. +Graph Minors XI, Section 3 (page 74): "A *drawing* in $\Sigma$ is a pair $(U, V)$, where +$V \subseteq U \subseteq \Sigma$, $U$ is closed, $V$ is finite, $U - V$ has only finitely many +arc-wise connected components, called *edges*, and for every edge $e$, either $\bar{e}$ is a line +whose set of ends is $\bar{e} \cap V$, or $\bar{e}$ is an $O$-arc and $|\bar{e} \cap V| = 1$." +Graph Minors VII, Section 2 (page 214); Graph Minors VIII, Section 5 (page 262); +Graph Minors XI, Section 3 (page 74); Graph Minors XII, Section 1 (page 240); +Graph Minors XIV, Section 2 (page 26). -/ +structure Drawing (S : Type u) [TopologicalSpace S] where + /-- The underlying closed subset $U(\Gamma) \subseteq \Sigma$ of the drawing. -/ + U : Set S + /-- The finite set of vertices $V(\Gamma) \subseteq U(\Gamma)$. -/ + V : Set S + /-- Every vertex lies in $U(\Gamma)$. -/ + V_subset_U : V ⊆ U + /-- $U(\Gamma)$ is closed in $\Sigma$. -/ + isClosed_U : IsClosed U + /-- $V(\Gamma)$ is finite. -/ + finite_V : V.Finite + /-- $U(\Gamma) \setminus V(\Gamma)$ has only finitely many arc-wise connected components + (edges). -/ + finite_edges : (arcComponentsIn (U \ V)).Finite + /-- Each edge $e$ has closure $\bar{e}$ either a line with ends $\bar{e} \cap V$ of size 2, or an + $O$-arc with $|\bar{e} \cap V| = 1$. -/ + edge_cond : ∀ e ∈ arcComponentsIn (U \ V), + (∃ u v : S, u ≠ v ∧ closure e ∩ V = {u, v} ∧ IsLineWithEnds (closure e) u v) ∨ + (∃ u : S, closure e ∩ V = {u} ∧ IsOArc (closure e)) + +namespace Drawing + +variable {S : Type u} [TopologicalSpace S] + +/-- The set of *edges* $E(\Gamma)$ of a drawing $\Gamma$, defined as the arc-wise connected +components of $U(\Gamma) \setminus V(\Gamma)$. +Graph Minors VII, Section 2 (page 214); Graph Minors XI, Section 3 (page 74). -/ +def E (Γ : Drawing S) : Set (Set S) := + arcComponentsIn (Γ.U \ Γ.V) + +/-- The set of *regions* $R(\Gamma)$ of a drawing $\Gamma$, defined as the connected components of +$\Sigma \setminus U(\Gamma)$. +Graph Minors VI, Section 1 (page 116); Graph Minors XI, Section 3 (page 74). -/ +noncomputable def R (Γ : Drawing S) : Set (Set S) := + componentsIn (Set.univ \ Γ.U) + +/-- The set of *atoms* $A(\Gamma)$ of a drawing $\Gamma$: the singleton vertex sets $\{v\}$ +($v \in V(\Gamma)$), the edges $e \in E(\Gamma)$, and the regions $r \in R(\Gamma)$. +Graph Minors XI, Section 9 (page 104); Graph Minors XII, Section 1 (page 240); +Graph Minors XIV, Section 2 (page 26). -/ +noncomputable def A (Γ : Drawing S) : Set (Set S) := + (fun v : S => ({v} : Set S)) '' Γ.V ∪ Γ.E ∪ Γ.R + +/-- A vertex $v \in V(\Gamma)$ is *incident with* an edge or region $x$ if $v \in \bar{x}$. +Graph Minors XI, Section 3 (page 74). -/ +def VertexIncident (Γ : Drawing S) (v : S) (x : Set S) : Prop := + v ∈ Γ.V ∧ (x ∈ Γ.E ∨ x ∈ Γ.R) ∧ v ∈ closure x + +/-- An edge $e \in E(\Gamma)$ is *incident with* a region $r \in R(\Gamma)$ if +$(e \cap \bar{r}).\text{Nonempty}$. +Graph Minors XI, Section 3 (page 74): "If $e$ is an edge and $r$ is a region, we say $e$ is +*incident with* $r$ (and vice versa) if $e \cap \bar{r} \ne \emptyset$." -/ +def EdgeRegionIncident (Γ : Drawing S) (e r : Set S) : Prop := + e ∈ Γ.E ∧ r ∈ Γ.R ∧ (e ∩ closure r).Nonempty + +/-- A subset $Z \subseteq \Sigma$ is *$\Gamma$-normal* if $Z \cap U(\Gamma) \subseteq V(\Gamma)$ +(equivalently, $Z$ is disjoint from every edge of $\Gamma$). +Graph Minors VI, Section 5 (page 127); Graph Minors VII, Section 2 (page 214); +Graph Minors VIII, Section 5 (page 263); Graph Minors XI, Section 4 (page 78). -/ +def IsNormal (Γ : Drawing S) (Z : Set S) : Prop := + Z ∩ Γ.U ⊆ Γ.V + +/-- A drawing $\Gamma$ in $\Sigma$ is *proper* (or *properly drawn*) if no edge of $\Gamma$ meets +$\operatorname{bd}(\Sigma)$, that is, $\operatorname{bd}(\Sigma)$ is $\Gamma$-normal. +Graph Minors VI, Section 1 (page 116): "A graph $G$ is *properly drawn* on $\Sigma$ if no edge of +$G$ meets $bd(\Sigma)$." +Graph Minors VII, Section 2 (page 214): "A graph $G$ in $\Sigma$ is *proper* if +$\operatorname{bd}(\Sigma)$ is $G$-normal." -/ +def IsProper (Γ : Drawing S) : Prop := + Γ.IsNormal (bd S) + +/-- A drawing $\Gamma'$ is a *subdrawing* of $\Gamma$ ($\Gamma' \subseteq \Gamma$) if +$V(\Gamma') \subseteq V(\Gamma)$ and $E(\Gamma') \subseteq E(\Gamma)$. +Graph Minors XI, Section 3 (page 74). -/ +def IsSubdrawing (Γ' Γ : Drawing S) : Prop := + Γ'.V ⊆ Γ.V ∧ Γ'.E ⊆ Γ.E + +/-- A drawing $\Gamma$ in $\Sigma$ is *2-cell* if $\Sigma$ is connected and every region of $\Gamma$ +is an open disc. +Graph Minors XI, Section 3 (page 75): "A painting or drawing $\Gamma$ in $\Sigma$ is *2-cell* if +$\Sigma$ is connected and every region is an open disc (and hence $\Gamma$ is not null)." -/ +def IsTwoCell (Γ : Drawing S) : Prop := + ConnectedSpace S ∧ ∀ r ∈ Γ.R, IsOpenDisc r + +/-- A drawing $\Gamma$ in a connected surface $\Sigma$ is *$\theta$-representative* if every +$\Gamma$-normal $O$-arc $F$ with $|F \cap V(\Gamma)| < \theta$ is null-homotopic in $\Sigma$. +Graph Minors XI, Section 4 (page 78). -/ +def IsRepresentative (Γ : Drawing S) (θ : ℕ) : Prop := + ConnectedSpace S ∧ + ∀ F : Set S, IsOArc F → Γ.IsNormal F → (F ∩ Γ.V).ncard < θ → IsNullHomotopicOArc F + +/-- Every drawing $\Gamma$ in $\Sigma$ canonically defines an abstract graph +`Γ.toGraph : Graph S (Set S)` with vertex set $V(\Gamma)$, edge set $E(\Gamma)$, and link relation +$\bar{e} \cap V(\Gamma) = \{x, y\}$. +Graph Minors XI, Section 3 (page 74): "If $\Gamma$ is a drawing, then $V(\Gamma)$, $E(\Gamma)$ and +the incidence relation between them define a graph, and in this sense we may regard $\Gamma$ as a +graph, and use graph-theoretic terminology for drawings." -/ +def toGraph (Γ : Drawing S) : Graph S (Set S) where + vertexSet := Γ.V + edgeSet := Γ.E + IsLink e x y := e ∈ Γ.E ∧ x ∈ Γ.V ∧ y ∈ Γ.V ∧ closure e ∩ Γ.V = {x, y} + isLink_symm _ _ := ⟨fun _ _ h => ⟨h.1, h.2.2.1, h.2.1, by rw [Set.pair_comm, h.2.2.2]⟩⟩ + eq_or_eq_of_isLink_of_isLink {e x y v w} h1 h2 := by + have hpair : ({x, y} : Set S) = {v, w} := h1.2.2.2.symm.trans h2.2.2.2 + have hx := Set.mem_insert x {y} + rw [hpair] at hx + exact Set.mem_insert_iff.mp hx + edge_mem_iff_exists_isLink e := by + constructor + · intro he + rcases Γ.edge_cond e he with ⟨u, v, _, hcap, _⟩ | ⟨u, hcap, _⟩ + · have hu : u ∈ Γ.V := by + have : u ∈ closure e ∩ Γ.V := by rw [hcap]; exact Set.mem_insert u {v} + exact this.2 + have hv : v ∈ Γ.V := by + have : v ∈ closure e ∩ Γ.V := by rw [hcap]; exact Set.mem_insert_of_mem u rfl + exact this.2 + exact ⟨u, v, he, hu, hv, hcap⟩ + · have hu : u ∈ Γ.V := by + have : u ∈ closure e ∩ Γ.V := by rw [hcap]; exact Set.mem_singleton u + exact this.2 + exact ⟨u, u, he, hu, hu, by rw [Set.pair_eq_singleton, hcap]⟩ + · rintro ⟨_, _, he, _, _, _⟩ + exact he + left_mem_of_isLink _ _ _ h := h.2.1 + +/-- Every drawing $\Gamma$ also canonically defines an abstract hypergraph +`Γ.toHypergraph : Hypergraph S (Set S)`. -/ +def toHypergraph (Γ : Drawing S) : Hypergraph S (Set S) where + vertexSet := Γ.V + edgeSet := Γ.E + Inc e v := e ∈ Γ.E ∧ v ∈ Γ.V ∧ v ∈ closure e + vertex_mem_of_inc _ _ h := h.2.1 + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := Γ.finite_V + edgeSet_finite := Γ.finite_edges + +end Drawing + +/-- A *drawing of an abstract graph* $G : \operatorname{Graph} \alpha \beta$ in a surface $\Sigma$ +is a topological drawing $\Gamma$ in $\Sigma$ together with a graph isomorphism between $G$ and +`Γ.toGraph`. +Graph Minors VI, Section 1 (page 116); Graph Minors VIII, Section 5 (page 262). -/ +structure GraphDrawing {α : Type u} {β : Type v} (G : Graph α β) + (S : Type w) [TopologicalSpace S] where + /-- The topological drawing $\Gamma$ in $\Sigma$. -/ + drawing : Drawing S + /-- The isomorphism between the abstract graph $G$ and the geometric graph `drawing.toGraph`. -/ + iso : Iso G drawing.toGraph + +/-! ## 5. Paintings and Radial / Dual Drawings -/ + +/-- A *painting* $\Gamma = (U, V)$ in a surface $\Sigma$: $V \subseteq U \subseteq \Sigma$, $V$ is +finite, $U - V$ has finitely many arc-wise connected components (called *edges* or *cells*), and +for every edge $e$, $\bar{e}$ is a closed disc and +$\bar{e} \cap V \subseteq \operatorname{bd}(\bar{e})$. +Graph Minors XI, Section 3 (page 75): "A *painting* $\Gamma$ in a surface $\Sigma$ is a pair +$(U, V)$, where $V \subseteq U \subseteq \Sigma$, $V$ is finite, $U - V$ has only finitely many +arc-wise connected components, called *edges*, and for every edge $e$, $\bar{e}$ is a closed disc +and $\bar{e} \cap V \subseteq \operatorname{bd}(\bar{e})$." -/ +structure Painting (S : Type u) [TopologicalSpace S] where + /-- The underlying subset $U(\Gamma) \subseteq \Sigma$. (Unlike a drawing, Graph Minors XI does + not require $U$ to be closed.) -/ + U : Set S + /-- The finite set of vertices (or nodes) $V(\Gamma) \subseteq U(\Gamma)$. -/ + V : Set S + /-- Every vertex lies in $U(\Gamma)$. -/ + V_subset_U : V ⊆ U + /-- $V(\Gamma)$ is finite. -/ + finite_V : V.Finite + /-- $U(\Gamma) \setminus V(\Gamma)$ has finitely many arc-wise connected components + (edges/cells). -/ + finite_edges : (arcComponentsIn (U \ V)).Finite + /-- Each edge $e$ has closure $\bar{e}$ a closed disc with $\bar{e} \cap V$ in its boundary. -/ + edge_cond : ∀ e ∈ arcComponentsIn (U \ V), + IsClosedDisc (closure e) ∧ closure e ∩ V ⊆ subBd (closure e) + +namespace Painting + +variable {S : Type u} [TopologicalSpace S] + +/-- The set of *edges* (or *cells*) $E(\Gamma)$ of a painting $\Gamma$. +Graph Minors XI, Section 3 (page 75). -/ +def E (Γ : Painting S) : Set (Set S) := + arcComponentsIn (Γ.U \ Γ.V) + +/-- The set of *regions* $R(\Gamma)$ of a painting $\Gamma$. +Graph Minors XI, Section 3 (page 75). -/ +noncomputable def R (Γ : Painting S) : Set (Set S) := + componentsIn (Set.univ \ Γ.U) + +/-- A subset $Z \subseteq \Sigma$ is *$\Gamma$-normal* for a painting $\Gamma$ if +$Z \cap U(\Gamma) \subseteq V(\Gamma)$. +Graph Minors XI, Section 4 (page 78); Graph Minors XVII, Section 1 (page 165). -/ +def IsNormal (Γ : Painting S) (Z : Set S) : Prop := + Z ∩ Γ.U ⊆ Γ.V + +/-- A painting $\Gamma$ in $\Sigma$ is *2-cell* if $\Sigma$ is connected and every region of +$\Gamma$ is an open disc. +Graph Minors XI, Section 3 (page 75). -/ +def IsTwoCell (Γ : Painting S) : Prop := + ConnectedSpace S ∧ ∀ r ∈ Γ.R, IsOpenDisc r + +/-- Every painting $\Gamma$ in $\Sigma$ canonically defines a hypergraph +`Γ.toHypergraph : Hypergraph S (Set S)` with vertex set $V(\Gamma)$, edge set $E(\Gamma)$, and +incidence $v \in \bar{e}$. +Graph Minors XI, Section 3 (page 75): "If $\Gamma$ is a painting, then $V(\Gamma)$, $E(\Gamma)$ and +the incidence relation between them define a hypergraph, and in this sense we may regard $\Gamma$ as +a hypergraph." -/ +def toHypergraph (Γ : Painting S) : Hypergraph S (Set S) where + vertexSet := Γ.V + edgeSet := Γ.E + Inc e v := e ∈ Γ.E ∧ v ∈ Γ.V ∧ v ∈ closure e + vertex_mem_of_inc _ _ h := h.2.1 + edge_mem_of_inc _ _ h := h.1 + vertexSet_finite := Γ.finite_V + edgeSet_finite := Γ.finite_edges + +end Painting + +/-! ## 6. Walks in Drawings, Tracing Curves, and Homotopy of Walks and Forests -/ + +/-- A *walk* $W = v_0, e_1, v_1, \dots, e_t, v_t$ in an abstract multigraph $G : +\operatorname{Graph} \alpha \beta$. +Graph Minors XI, Section 3 (pages 76–77): "A walk in a drawing $\Gamma$ is a finite sequence +$v_0, e_1, v_1, e_2, \dots, e_t, v_t$ with $t \ge 0$, where $v_0, v_1, \dots, v_t$ are vertices of +$\Gamma$, $e_1, e_2, \dots, e_t$ are edges, and for ... $1 \le i \le t$ the ends of $e_i$ are +$v_{i-1}, v_i$." -/ +inductive GraphWalk {α : Type u} {β : Type v} (G : Graph α β) : α → α → Type (max u v) + | nil {v : α} (hv : v ∈ V(G)) : GraphWalk G v v + | cons {u v w : α} {e : β} (hlink : G.IsLink e u v) (rest : GraphWalk G v w) : + GraphWalk G u w + +namespace GraphWalk + +variable {α : Type u} {β : Type v} {G : Graph α β} + +/-- The list of vertices visited by a walk $W$. -/ +def support {u v : α} : GraphWalk G u v → List α + | .nil _ => [u] + | .cons _ rest => u :: rest.support + +/-- The list of edges traversed by a walk $W$. -/ +def edges {u v : α} : GraphWalk G u v → List β + | .nil _ => [] + | .cons (e := e) _ rest => e :: rest.edges + +/-- The length $t$ of a walk $W$. +Graph Minors XI, Section 3 (page 76). -/ +def length {u v : α} (W : GraphWalk G u v) : ℕ := + W.edges.length + +/-- A walk is *simple* (a path) if all its vertices $v_0, v_1, \dots, v_t$ are distinct. +Graph Minors XI, Section 3 (page 76). -/ +def IsSimple {u v : α} (W : GraphWalk G u v) : Prop := + W.support.Nodup + +/-- A closed walk $W$ from $u$ to $u$ is *simple-closed* if $v_1, \dots, v_t$ are distinct and +$e_1, \dots, e_t$ are distinct. +Graph Minors XI, Section 3 (page 76). -/ +def IsSimpleClosed {u : α} (W : GraphWalk G u u) : Prop := + W.support.tail.Nodup ∧ W.edges.Nodup + +end GraphWalk + +/-- A multigraph $G$ is a *forest* if it has no simple-closed walks of positive length. +Graph Minors VI, Section 4 (page 122); Graph Minors VII, Section 3 (page 220): +"A *forest* in a surface $\Sigma$ is a proper graph in $\Sigma$ with no circuits." -/ +def IsGraphForest {α : Type u} {β : Type v} (G : Graph α β) : Prop := + ∀ (u : α) (W : GraphWalk G u u), W.IsSimpleClosed → W.length = 0 + +/-- A curve $\phi \colon [0, 1] \to \Sigma$ *traces* a walk $W$ in a drawing $\Gamma$ if $[0, 1]$ +can be subdivided so that each step $e_i$ from $u$ to $v$ is traced in $\bar{e}_i$. +Graph Minors XI, Section 3 (page 77). + +In `cons`, `hconcat` does not tie `φ` to `φ₁`: on `[0, t₀]` it only requires `φ 0 = u`, +`φ t₀ = v`, and `φ x ∈ closure e` (not injectivity along `e`, or covering `e` when `u = v`), and +on `[t₀, 1]` it only requires `φ t₀ = v`, `φ 1 = w`, and `φ x ∈ Set.range φ₂` rather than that `φ` +on `[t₀, 1]` reparametrizes `φ₂`, so `φ` on `[t₀, 1]` need not visit the intermediate vertices or +edges of `W` in order. Its uses in `GM07` only rely on `endpoints` (`φ 0 = u ∧ φ 1 = v`), +`range_subset_U` (`Set.range φ ⊆ Γ.U`), `exists_curveTracesWalk`, and transport along +homeomorphisms and `IsCarry` maps. -/ +inductive CurveTracesWalk {S : Type u} [TopologicalSpace S] (Γ : Drawing S) : + ∀ {u v : S}, Curve S → GraphWalk Γ.toGraph u v → Prop + | nil {v : S} (hv : v ∈ Γ.V) (φ : Curve S) (hconst : ∀ x, φ x = v) : + CurveTracesWalk Γ φ (.nil hv) + | cons {u v w : S} {e : Set S} {W : GraphWalk Γ.toGraph v w} + (hlink : Γ.toGraph.IsLink e u v) (φ₁ φ₂ φ : Curve S) + (hφ₁ : φ₁ 0 = u ∧ φ₁ 1 = v ∧ Set.range φ₁ ⊆ closure e) + (hφ₂ : CurveTracesWalk Γ φ₂ W) + (hconcat : ∃ t₀ : unitInterval, (0 : ℝ) < t₀.1 ∧ t₀.1 < 1 ∧ + φ 0 = u ∧ φ t₀ = v ∧ φ 1 = w ∧ + (∀ x : unitInterval, x.1 ≤ t₀.1 → φ x ∈ closure e) ∧ + (∀ x : unitInterval, t₀.1 ≤ x.1 → φ x ∈ Set.range φ₂)) : + CurveTracesWalk Γ φ (.cons hlink W) + +/-- Two forests $H_1, H_2$ properly drawn on $\Sigma$ are *homotopic* if: +(i) $V(H_1) \cap \operatorname{bd}(\Sigma) = V(H_2) \cap \operatorname{bd}(\Sigma)$, and +(ii) for all distinct $s, t \in V(H_1) \cap \operatorname{bd}(\Sigma)$, there is a path of $H_1$ +between $s$ and $t$ if and only if there is such a path in $H_2$, and any curves tracing such paths +are homotopic in $\Sigma$. +Graph Minors VI, Section 4 (page 122); Graph Minors VII, Section 3 (page 220). -/ +def ForestsHomotopic {S : Type u} [TopologicalSpace S] (H₁ H₂ : Drawing S) : Prop := + H₁.IsProper ∧ H₂.IsProper ∧ + IsGraphForest H₁.toGraph ∧ IsGraphForest H₂.toGraph ∧ + H₁.V ∩ bd S = H₂.V ∩ bd S ∧ + ∀ s ∈ H₁.V ∩ bd S, ∀ t ∈ H₁.V ∩ bd S, s ≠ t → + ((∃ P₁ : GraphWalk H₁.toGraph s t, P₁.IsSimple) ↔ + (∃ P₂ : GraphWalk H₂.toGraph s t, P₂.IsSimple)) ∧ + (∀ (P₁ : GraphWalk H₁.toGraph s t) (P₂ : GraphWalk H₂.toGraph s t) (φ₁ φ₂ : Curve S), + P₁.IsSimple → P₂.IsSimple → + CurveTracesWalk H₁ φ₁ P₁ → CurveTracesWalk H₂ φ₂ P₂ → + CurvesHomotopic φ₁ φ₂) + +/-- The pair `{a, c}` *crosses* `{b, d}` on `C`: the four points are distinct points of `C`, and +`b` and `d` lie in different components of `C \ {a, c}`. This is the crossing relation of Graph +Minors VI, Section 2 (page 117). -/ +abbrev PairsCrossOn {S : Type u} [TopologicalSpace S] (C : Set S) (a c b d : S) : Prop := + a ∈ C ∧ b ∈ C ∧ c ∈ C ∧ d ∈ C ∧ + a ≠ c ∧ b ≠ d ∧ a ≠ b ∧ a ≠ d ∧ c ≠ b ∧ c ≠ d ∧ + connectedComponentIn (C \ {a, c}) b ≠ connectedComponentIn (C \ {a, c}) d + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Dihedral.lean b/LeanPool/GraphMinor/Surface/Dihedral.lean new file mode 100644 index 0000000000..dccda6cf83 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Dihedral.lean @@ -0,0 +1,269 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Dynamics.PeriodicPts.Defs +public import Mathlib.GroupTheory.GroupAction.Period +public import Mathlib.GroupTheory.Perm.Finite +public import Mathlib.GroupTheory.OrderOfElement +public import Mathlib.Tactic + +/-! +# Paths made of two involutions + +Let `τ` and `σ` be involutions of a finite set, and suppose that `τ` has no fixed point. The orbits +of the two maps +together are paths and cycles, and the ends of a path are the fixed points of `σ` in it. So an orbit +with a fixed point of +`σ` has exactly two of them (`exists_other_end`). We use this for the corners of polygons around a +vertex: `τ` crosses a +corner of a polygon and `σ` crosses a side. Cutting along two sides at a vertex of a cycle gives two +paths +(`cut_classes`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Function Relation + +variable {G : Type*} + +/-- The orbit relation of two maps. -/ +abbrev TwoOrb (τ σ : G → G) : G → G → Prop := EqvGen fun a b => b = τ a ∨ b = σ a + +theorem TwoOrb.left (τ σ : G → G) (a : G) : TwoOrb τ σ a (τ a) := .rel _ _ (.inl rfl) + +theorem TwoOrb.right (τ σ : G → G) (a : G) : TwoOrb τ σ a (σ a) := .rel _ _ (.inr rfl) + +/-- An orbit with a fixed point of `σ` has exactly two fixed points of `σ`. -/ +theorem exists_other_end [Finite G] {τ σ : G → G} (hτ : Involutive τ) (hσ : Involutive σ) + (hfree : ∀ a, τ a ≠ a) {x : G} + (hx : σ x = x) : ∃ y, y ≠ x ∧ σ y = y ∧ TwoOrb τ σ x y ∧ ∀ z, TwoOrb τ σ x z → σ z = z → z = x + ∨ z = y := by + classical + let T : Equiv.Perm G := hτ.toPerm + let R : Equiv.Perm G := hσ.toPerm + let ρ : Equiv.Perm G := R * T + have hR : R * R = 1 := Equiv.ext fun a => hσ a + have hT : T * T = 1 := Equiv.ext fun a => hτ a + have hRinv : R⁻¹ = R := inv_eq_of_mul_eq_one_left hR + have hTinv : T⁻¹ = T := inv_eq_of_mul_eq_one_left hT + have hconj : R * ρ * R⁻¹ = ρ⁻¹ := by + simp only [ρ, mul_inv_rev, hRinv, hTinv] + rw [← mul_assoc, hR, one_mul] + have hzp : ∀ k : ℤ, R * ρ ^ k * R⁻¹ = ρ ^ (-k) := fun k => by + rw [← conj_zpow, hconj, inv_zpow, zpow_neg] + have hσk : ∀ k : ℤ, σ ((ρ ^ k) x) = (ρ ^ (-k)) x := fun k => by + have h1 := congrArg (fun P : Equiv.Perm G => P x) (hzp k) + simp only [Equiv.Perm.mul_apply, hRinv] at h1 + have h2 : R x = x := hx + rw [h2] at h1 + exact h1 + have hτk : ∀ k : ℤ, τ ((ρ ^ k) x) = (ρ ^ (-k - 1)) x := fun k => by + have h1 : ρ ^ (k + 1) = ρ * ρ ^ k := by rw [add_comm, zpow_add, zpow_one] + have h2 : (ρ ^ (k + 1)) x = σ (τ ((ρ ^ k) x)) := by + rw [h1] + rfl + have h3 := hσk (k + 1) + rw [h2, hσ] at h3 + rw [h3] + congr 2 + ring + let d := MulAction.period ρ x + have hd : 0 < d := MulAction.period_pos_of_orderOf_pos (orderOf_pos ρ) x + have heq : ∀ a b : ℤ, (ρ ^ a) x = (ρ ^ b) x ↔ (d : ℤ) ∣ a - b := fun a b => by + have h1 : (ρ ^ a) x = (ρ ^ b) x ↔ (ρ ^ (a - b)) • x = x := by + have e : ρ ^ a = ρ ^ b * ρ ^ (a - b) := by rw [← zpow_add, add_sub_cancel] + rw [Equiv.Perm.smul_def, e, Equiv.Perm.mul_apply] + exact (ρ ^ b).injective.eq_iff + rw [h1, MulAction.zpow_smul_eq_iff_period_dvd] + have hodd : ∀ k : ℤ, ¬ (d : ℤ) ∣ 2 * k + 1 := fun k hdv => by + have h1 : (ρ ^ (-k - 1)) x = (ρ ^ k) x := (heq _ _).mpr (by + have : -k - 1 - k = -(2 * k + 1) := by ring + rw [this] + exact (dvd_neg).mpr hdv) + exact hfree _ ((hτk k).trans h1) + obtain ⟨e, he⟩ : ∃ e : ℕ, d = 2 * e := by + rcases Nat.even_or_odd' d with ⟨e, h | h⟩ + · exact ⟨e, h⟩ + · exact absurd (show (d : ℤ) ∣ 2 * e + 1 by rw [h]; push_cast; rfl) (hodd e) + have he0 : 0 < e := by omega + have hdz : (d : ℤ) = 2 * e := by exact_mod_cast he + have hstep : ∀ a, TwoOrb τ σ a (ρ a) := fun a => .trans _ _ _ (TwoOrb.left τ σ a) + (TwoOrb.right τ σ (τ a)) + have hpow : ∀ n : ℕ, TwoOrb τ σ x ((ρ ^ n) x) := fun n => by + induction n with + | zero => exact .refl _ + | succ n ih => + rw [pow_succ', Equiv.Perm.mul_apply] + exact .trans _ _ _ ih (hstep _) + have hP : ∀ a b, TwoOrb τ σ a b → ((∃ k : ℤ, a = (ρ ^ k) x) ↔ ∃ k : ℤ, b = (ρ ^ k) x) := by + have h1 : ∀ a, (∃ k : ℤ, a = (ρ ^ k) x) → ∃ k : ℤ, τ a = (ρ ^ k) x := by + rintro _ ⟨k, rfl⟩ + exact ⟨_, hτk k⟩ + have h2 : ∀ a, (∃ k : ℤ, a = (ρ ^ k) x) → ∃ k : ℤ, σ a = (ρ ^ k) x := by + rintro _ ⟨k, rfl⟩ + exact ⟨_, hσk k⟩ + intro a b h + induction h with + | rel a b h => + rcases h with rfl | rfl + · exact ⟨h1 a, fun h' => by simpa [hτ a] using h1 _ h'⟩ + · exact ⟨h2 a, fun h' => by simpa [hσ a] using h2 _ h'⟩ + | refl _ => exact Iff.rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ i1 i2 => exact i1.trans i2 + refine ⟨(ρ ^ e) x, ?_, ?_, hpow e, ?_⟩ + · intro h + have h1 : (ρ ^ (e : ℤ)) x = (ρ ^ (0 : ℤ)) x := by simpa using h + have h2 := (heq _ _).mp h1 + rw [hdz, sub_zero] at h2 + have := Int.le_of_dvd (by omega) h2 + omega + · rw [← zpow_natCast ρ e, hσk] + refine (heq _ _).mpr ?_ + rw [hdz] + exact ⟨-1, by ring⟩ + · intro z hz hzf + obtain ⟨k, rfl⟩ := (hP _ _ hz).mp ⟨0, by simp⟩ + rw [hσk] at hzf + have h1 := (heq _ _).mp hzf + rw [hdz] at h1 + obtain ⟨r, hr⟩ := h1 + have hk : k = -(e * r) := by nlinarith + rcases Int.even_or_odd' r with ⟨l, rfl | rfl⟩ + · left + have h2 : (ρ ^ k) x = (ρ ^ (0 : ℤ)) x := (heq _ _).mpr (by + rw [hdz] + exact ⟨-l, by rw [hk]; ring⟩) + simpa using h2 + · right + have h2 : (ρ ^ k) x = (ρ ^ (e : ℤ)) x := (heq _ _).mpr (by + rw [hdz] + exact ⟨-l - 1, by rw [hk]; ring⟩) + simpa using h2 + +/-- Cutting a cycle or a path at one link `c, c'`, where `d, d'` are the other ends, gives two +pieces, and `c` and `c'` lie +in different pieces. -/ +theorem cut_classes [Finite G] {τ π σ : G → G} (hτ : Involutive τ) (hπ : Involutive π) + (hσ : Involutive σ) + (hfree : ∀ a, τ a ≠ a) (hs : ∀ a, σ a = a ∨ σ a = π a) {c c' d d' : G} (hcc : π c = c') + (hc1 : σ c = c) (hc2 : σ c' = c') + (hd1 : σ d = d) (hd2 : σ d' = d') (hne : c ≠ c') (hne1 : d ≠ c) (hne2 : d ≠ c') (hne3 : d' ≠ c) + (hne4 : d' ≠ c') + (hne5 : d ≠ d') (hod : TwoOrb τ π c d) (hod' : TwoOrb τ π c d') (hπd : π d = d ∨ π d = d') + (hπd' : π d' = d ∨ π d' = d') + (hfix : ∀ g, TwoOrb τ π c g → σ g = g → g = c ∨ g = c' ∨ g = d ∨ g = d') : + ¬ TwoOrb τ σ c c' ∧ ∀ g, TwoOrb τ π c g → TwoOrb τ σ c g ∨ TwoOrb τ σ c' g := by + have hsub : ∀ a b, TwoOrb τ σ a b → TwoOrb τ π a b := by + intro a b h + induction h with + | rel a b h => + rcases h with rfl | rfl + · exact TwoOrb.left _ _ _ + · rcases hs a with h1 | h1 + · rw [h1] + exact .refl _ + · rw [h1] + exact TwoOrb.right _ _ _ + | refl _ => exact .refl _ + | symm _ _ _ ih => exact .symm _ _ ih + | trans _ _ _ _ _ i1 i2 => exact .trans _ _ _ i1 i2 + have hcc' : π c' = c := by rw [← hcc, hπ] + have hcpo : TwoOrb τ π c c' := hcc ▸ TwoOrb.right τ π c + /- A set closed under the two maps that contains `c` contains its orbit. -/ + have hclosed : ∀ Q : Set G, c ∈ Q → (∀ a ∈ Q, τ a ∈ Q) → (∀ a ∈ Q, π a ∈ Q) → ∀ g, TwoOrb τ π c g + → g ∈ Q := by + intro Q hc h1 h2 g hg + have h3 : ∀ a b, TwoOrb τ π a b → (a ∈ Q ↔ b ∈ Q) := by + intro a b h + induction h with + | rel a b h => + rcases h with rfl | rfl + · exact ⟨h1 a, fun h' => by simpa [hτ a] using h1 _ h'⟩ + · exact ⟨h2 a, fun h' => by simpa [hπ a] using h2 _ h'⟩ + | refl _ => exact Iff.rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ i1 i2 => exact i1.trans i2 + exact (h3 _ _ hg).mp hc + have hσstep : ∀ a b, TwoOrb τ σ a a → b = σ a → TwoOrb τ σ a b := fun a b _ h + => h ▸ TwoOrb.right τ σ a + obtain ⟨y, hy1, hy2, hy3, hy4⟩ := exists_other_end hτ hσ hfree hc1 + obtain ⟨y', hy1', hy2', hy3', hy4'⟩ := exists_other_end hτ hσ hfree hc2 + have hno : ¬ TwoOrb τ σ c c' := by + intro hc + have hyc : y = c' := by + rcases hy4 c' hc hc2 with h | h + · exact absurd h.symm hne + · exact h.symm + subst hyc + have h1 := hclosed {g | TwoOrb τ σ c g} (.refl _) (fun a ha => .trans _ _ _ ha + (TwoOrb.left _ _ _)) (fun a ha => by + rcases hs a with h | h + · rcases hy4 a ha h with rfl | rfl + · rw [hcc] + exact hc + · rw [hcc'] + exact .refl _ + · rw [← h] + exact .trans _ _ _ ha (TwoOrb.right _ _ _)) d hod + rcases hy4 d h1 hd1 with h | h + · exact hne1 h + · exact hne2 h + refine ⟨hno, ?_⟩ + have hyO : TwoOrb τ π c y := hsub _ _ hy3 + have hyO' : TwoOrb τ π c y' := .trans _ _ _ hcpo (hsub _ _ hy3') + have hyd : y = d ∨ y = d' := by + rcases hfix y hyO hy2 with h | h | h | h + · exact absurd h hy1 + · exact absurd (h ▸ hy3) hno + · exact .inl h + · exact .inr h + have hyd' : y' = d ∨ y' = d' := by + rcases hfix y' hyO' hy2' with h | h | h | h + · exact absurd (.symm _ _ (h ▸ hy3')) hno + · exact absurd h hy1' + · exact .inl h + · exact .inr h + have hyy : y ≠ y' := fun h => hno (.trans _ _ _ hy3 (.symm _ _ (h ▸ hy3'))) + have hdd : ∀ g, g = d ∨ g = d' → TwoOrb τ σ c g ∨ TwoOrb τ σ c' g := by + intro g hg + rcases hyd with rfl | rfl <;> rcases hyd' with rfl | rfl <;> rcases hg with rfl | rfl <;> + first + | exact absurd rfl hyy + | exact .inl hy3 + | exact .inr hy3' + let Q : Set G := {g | TwoOrb τ σ c g ∨ TwoOrb τ σ c' g} + intro g hg + refine hclosed Q (.inl (.refl _)) ?_ ?_ g hg + · rintro a (ha | ha) + · exact .inl (.trans _ _ _ ha (TwoOrb.left _ _ _)) + · exact .inr (.trans _ _ _ ha (TwoOrb.left _ _ _)) + · intro a ha + have hao : TwoOrb τ π c a := by + rcases ha with ha | ha + · exact hsub _ _ ha + · exact .trans _ _ _ hcpo (hsub _ _ ha) + rcases hs a with h | h + · rcases hfix a hao h with rfl | rfl | rfl | rfl + · rw [hcc] + exact .inr (.refl _) + · rw [hcc'] + exact .inl (.refl _) + · exact hdd _ (by rcases hπd with h' | h' <;> simp [h']) + · exact hdd _ (by rcases hπd' with h' | h' <;> simp [h']) + · rw [← h] + rcases ha with ha | ha + · exact .inl (.trans _ _ _ ha (TwoOrb.right _ _ _)) + · exact .inr (.trans _ _ _ ha (TwoOrb.right _ _ _)) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Disc.lean b/LeanPool/GraphMinor/Surface/Disc.lean new file mode 100644 index 0000000000..21643613b4 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Disc.lean @@ -0,0 +1,274 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +import Mathlib.Analysis.Convex.PathConnected + +/-! +# Topological Properties of Closed and Open Discs + +This file proves the foundational topological properties of closed discs (`ClosedUnitDisc`, +`IsClosedDisc`) and open discs (`OpenUnitDisc`, `IsOpenDisc`) used in Graph Minors VI and XI: +- Convexity and path-connectedness of `ClosedUnitDisc` and `OpenUnitDisc` (via `convex_closedBall` + and `convex_ball` in `Mathlib.Analysis.Convex.PathConnected`). +- Straight-line homotopy in `ClosedUnitDisc`: any two curves in a closed disc $\Delta$ with the + same endpoints are homotopic in $\Delta$ (`CurvesHomotopicIn`), and every closed curve in a + closed or open disc is null-homotopic (`ClosedCurveIsNullHomotopicIn`, `IsSimplyConnectedSet`). +- Equivariance of drawings, regions, and curve homotopy under homeomorphisms of surfaces. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Function Metric Topology unitInterval + +universe u v + +/-! ## 1. Convexity and Path-Connectedness of Standard Discs -/ + +/-- The closed unit disc `ClosedUnitDisc` in $\mathbb{R}^2$ is convex. +Route: `convex_closedBall` from `Mathlib.Analysis.Convex.NormedSpace`. -/ +theorem convex_closedUnitDisc : Convex ℝ ClosedUnitDisc := + convex_closedBall 0 1 + +/-- The open unit disc `OpenUnitDisc` in $\mathbb{R}^2$ is convex. +Route: `convex_ball` from `Mathlib.Analysis.Convex.NormedSpace`. -/ +theorem convex_openUnitDisc : Convex ℝ OpenUnitDisc := + convex_ball 0 1 + +/-- The origin $0$ lies in `ClosedUnitDisc`. -/ +theorem zero_mem_closedUnitDisc : (0 : EuclideanPlane) ∈ ClosedUnitDisc := + mem_closedBall_self zero_le_one + +/-- The origin $0$ lies in `OpenUnitDisc`. -/ +theorem zero_mem_openUnitDisc : (0 : EuclideanPlane) ∈ OpenUnitDisc := + mem_ball_self zero_lt_one + +/-- `ClosedUnitDisc` is path-connected. +Route: `Convex.isPathConnected` applied to `convex_closedUnitDisc`. -/ +theorem isPathConnected_closedUnitDisc : IsPathConnected ClosedUnitDisc := + convex_closedUnitDisc.isPathConnected ⟨0, zero_mem_closedUnitDisc⟩ + +/-- `OpenUnitDisc` is path-connected. +Route: `Convex.isPathConnected` applied to `convex_openUnitDisc`. -/ +theorem isPathConnected_openUnitDisc : IsPathConnected OpenUnitDisc := + convex_openUnitDisc.isPathConnected ⟨0, zero_mem_openUnitDisc⟩ + +/-- Every closed disc $\Delta \subseteq S$ is path-connected. +Route: homeomorphic image of `ClosedUnitDisc` via `IsInducing.subtypeVal.isPathConnected_iff`. -/ +theorem IsClosedDisc.isPathConnected {S : Type u} [TopologicalSpace S] {Δ : Set S} + (hΔ : IsClosedDisc Δ) : IsPathConnected Δ := by + rcases hΔ with ⟨h⟩ + have hpc : PathConnectedSpace ClosedUnitDisc := + isPathConnected_iff_pathConnectedSpace.mp isPathConnected_closedUnitDisc + have hpc' : PathConnectedSpace Δ := h.surjective.pathConnectedSpace h.continuous + exact isPathConnected_iff_pathConnectedSpace.mpr hpc' + +/-- Every open disc $\Lambda \subseteq S$ is path-connected. +Route: homeomorphic image of `OpenUnitDisc`. -/ +theorem IsOpenDisc.isPathConnected {S : Type u} [TopologicalSpace S] {Λ : Set S} + (hΛ : IsOpenDisc Λ) : IsPathConnected Λ := by + rcases hΛ with ⟨_, ⟨h⟩⟩ + have hpc : PathConnectedSpace OpenUnitDisc := + isPathConnected_iff_pathConnectedSpace.mp isPathConnected_openUnitDisc + have hpc' : PathConnectedSpace Λ := h.surjective.pathConnectedSpace h.continuous + exact isPathConnected_iff_pathConnectedSpace.mpr hpc' + +/-! ## 2. Straight-Line Homotopy and Simple Connectivity of Discs -/ + +/-- Any two curves in a convex subset $Z \subseteq \mathbb{R}^2$ that share the same initial point +and the same terminal point are homotopic in $Z$. +Route: straight-line interpolation $(x, t) \mapsto (1 - t) \phi_0(x) + t \phi_1(x)$. -/ +theorem curvesHomotopicIn_of_convex {Z : Set EuclideanPlane} (hZ : Convex ℝ Z) + {φ₀ φ₁ : Curve EuclideanPlane} + (hφ₀ : range φ₀ ⊆ Z) (hφ₁ : range φ₁ ⊆ Z) + (h0 : φ₀ 0 = φ₁ 0) (h1 : φ₀ 1 = φ₁ 1) : + CurvesHomotopicIn Z φ₀ φ₁ := by + refine ⟨⟨fun p => (1 - (p.2 : ℝ)) • φ₀ p.1 + (p.2 : ℝ) • φ₁ p.1, by fun_prop⟩, + ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro p + exact hZ (hφ₀ (mem_range_self p.1)) (hφ₁ (mem_range_self p.1)) + (sub_nonneg.mpr p.2.2.2) p.2.2.1 (sub_add_cancel 1 (p.2 : ℝ)) + · intro x + simp + · intro x + simp + · intro y + calc (1 - (y : ℝ)) • φ₀ 0 + (y : ℝ) • φ₁ 0 + _ = (1 - (y : ℝ)) • φ₀ 0 + (y : ℝ) • φ₀ 0 := by rw [h0] + _ = ((1 - (y : ℝ)) + (y : ℝ)) • φ₀ 0 := (add_smul _ _ _).symm + _ = φ₀ 0 := by simp + · intro y + calc (1 - (y : ℝ)) • φ₀ 0 + (y : ℝ) • φ₁ 0 + _ = (1 - (y : ℝ)) • φ₁ 0 + (y : ℝ) • φ₁ 0 := by rw [h0] + _ = ((1 - (y : ℝ)) + (y : ℝ)) • φ₁ 0 := (add_smul _ _ _).symm + _ = φ₁ 0 := by simp + · intro y + calc (1 - (y : ℝ)) • φ₀ 1 + (y : ℝ) • φ₁ 1 + _ = (1 - (y : ℝ)) • φ₀ 1 + (y : ℝ) • φ₀ 1 := by rw [h1] + _ = ((1 - (y : ℝ)) + (y : ℝ)) • φ₀ 1 := (add_smul _ _ _).symm + _ = φ₀ 1 := by simp + · intro y + calc (1 - (y : ℝ)) • φ₀ 1 + (y : ℝ) • φ₁ 1 + _ = (1 - (y : ℝ)) • φ₁ 1 + (y : ℝ) • φ₁ 1 := by rw [h1] + _ = ((1 - (y : ℝ)) + (y : ℝ)) • φ₁ 1 := (add_smul _ _ _).symm + _ = φ₁ 1 := by simp + +/-- Any two curves in a closed disc $\Delta \subseteq S$ with the same endpoints are homotopic in +$\Delta$. +Graph Minors VI, Section 4 (page 123): on a disc, all routes between a given pair of boundary +points are homotopic. +Route: pull back to `ClosedUnitDisc` via the defining homeomorphism and apply straight-line +homotopy `curvesHomotopicIn_of_convex`. -/ +theorem IsClosedDisc.curvesHomotopicIn {S : Type u} [TopologicalSpace S] {Δ : Set S} + (hΔ : IsClosedDisc Δ) {φ₀ φ₁ : Curve S} + (hφ₀ : range φ₀ ⊆ Δ) (hφ₁ : range φ₁ ⊆ Δ) + (h0 : φ₀ 0 = φ₁ 0) (h1 : φ₀ 1 = φ₁ 1) : + CurvesHomotopicIn Δ φ₀ φ₁ := by + rcases hΔ with ⟨e⟩ + let lift0 : C(unitInterval, ClosedUnitDisc) := + ⟨fun x => e.symm ⟨φ₀ x, hφ₀ (mem_range_self x)⟩, + e.symm.continuous.comp ( φ₀.continuous.subtype_mk _ )⟩ + let lift1 : C(unitInterval, ClosedUnitDisc) := + ⟨fun x => e.symm ⟨φ₁ x, hφ₁ (mem_range_self x)⟩, + e.symm.continuous.comp ( φ₁.continuous.subtype_mk _ )⟩ + let c0 : Curve EuclideanPlane := ⟨fun x => (lift0 x).1, continuous_subtype_val.comp + lift0.continuous⟩ + let c1 : Curve EuclideanPlane := ⟨fun x => (lift1 x).1, continuous_subtype_val.comp + lift1.continuous⟩ + have hc0 : range c0 ⊆ ClosedUnitDisc := by rintro _ ⟨x, rfl⟩; exact (lift0 x).2 + have hc1 : range c1 ⊆ ClosedUnitDisc := by rintro _ ⟨x, rfl⟩; exact (lift1 x).2 + have hc01_0 : c0 0 = c1 0 := by + change (e.symm ⟨φ₀ 0, _⟩).1 = (e.symm ⟨φ₁ 0, _⟩).1 + congr 1; exact congrArg e.symm (Subtype.ext h0) + have hc01_1 : c0 1 = c1 1 := by + change (e.symm ⟨φ₀ 1, _⟩).1 = (e.symm ⟨φ₁ 1, _⟩).1 + congr 1; exact congrArg e.symm (Subtype.ext h1) + rcases curvesHomotopicIn_of_convex convex_closedUnitDisc hc0 hc1 hc01_0 hc01_1 with + ⟨ψ, hψZ, hψ0, hψ1, hψy0, hψy0', hψy1, hψy1'⟩ + let Ψ : C(unitInterval × unitInterval, S) := + ⟨fun p => (e ⟨ψ p, hψZ p⟩).1, + continuous_subtype_val.comp (e.continuous.comp (ψ.continuous.subtype_mk hψZ))⟩ + refine ⟨Ψ, fun p => (e ⟨ψ p, hψZ p⟩).2, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro x + have hx : (⟨ψ (x, 0), hψZ (x, 0)⟩ : ClosedUnitDisc) = lift0 x := Subtype.ext (hψ0 x) + change (e ⟨ψ (x, 0), hψZ (x, 0)⟩).1 = φ₀ x + rw [hx] + exact congrArg Subtype.val (e.apply_symm_apply _) + · intro x + have hx : (⟨ψ (x, 1), hψZ (x, 1)⟩ : ClosedUnitDisc) = lift1 x := Subtype.ext (hψ1 x) + change (e ⟨ψ (x, 1), hψZ (x, 1)⟩).1 = φ₁ x + rw [hx] + exact congrArg Subtype.val (e.apply_symm_apply _) + · intro y + have hy : (⟨ψ (0, y), hψZ (0, y)⟩ : ClosedUnitDisc) = lift0 0 := Subtype.ext (hψy0 y) + change (e ⟨ψ (0, y), hψZ (0, y)⟩).1 = φ₀ 0 + rw [hy] + exact congrArg Subtype.val (e.apply_symm_apply _) + · intro y + have hy : (⟨ψ (0, y), hψZ (0, y)⟩ : ClosedUnitDisc) = lift1 0 := Subtype.ext (hψy0' y) + change (e ⟨ψ (0, y), hψZ (0, y)⟩).1 = φ₁ 0 + rw [hy] + exact congrArg Subtype.val (e.apply_symm_apply _) + · intro y + have hy : (⟨ψ (1, y), hψZ (1, y)⟩ : ClosedUnitDisc) = lift0 1 := Subtype.ext (hψy1 y) + change (e ⟨ψ (1, y), hψZ (1, y)⟩).1 = φ₀ 1 + rw [hy] + exact congrArg Subtype.val (e.apply_symm_apply _) + · intro y + have hy : (⟨ψ (1, y), hψZ (1, y)⟩ : ClosedUnitDisc) = lift1 1 := Subtype.ext (hψy1' y) + change (e ⟨ψ (1, y), hψZ (1, y)⟩).1 = φ₁ 1 + rw [hy] + exact congrArg Subtype.val (e.apply_symm_apply _) + +/-- Every closed disc $\Delta \subseteq S$ is simply connected (`IsSimplyConnectedSet`). +Graph Minors XI, Section 3 (page 76). +Route: straight-line contraction to the image of the origin $0 \in \text{ClosedUnitDisc}$. -/ +theorem IsClosedDisc.isSimplyConnectedSet {S : Type u} [TopologicalSpace S] {Δ : Set S} + (hΔ : IsClosedDisc Δ) : IsSimplyConnectedSet Δ := by + refine ⟨hΔ.isPathConnected, fun φ hφ => ?_⟩ + rcases hΔ with ⟨e⟩ + let c0 : ClosedUnitDisc := ⟨0, zero_mem_closedUnitDisc⟩ + refine ⟨(e c0).1, (e c0).2, ?_⟩ + let lift : C(Circle, ClosedUnitDisc) := + ⟨fun x => e.symm ⟨φ x, hφ (mem_range_self x)⟩, + e.symm.continuous.comp (φ.continuous.subtype_mk _)⟩ + have hmem : ∀ p : Circle × unitInterval, + (1 - (p.2 : ℝ)) • (lift p.1).1 + (p.2 : ℝ) • (0 : EuclideanPlane) ∈ ClosedUnitDisc := by + intro p + exact convex_closedUnitDisc (lift p.1).2 zero_mem_closedUnitDisc + (sub_nonneg.mpr p.2.2.2) p.2.2.1 (sub_add_cancel 1 (p.2 : ℝ)) + let Ψ : C(Circle × unitInterval, S) := + ⟨fun p => (e ⟨(1 - (p.2 : ℝ)) • (lift p.1).1 + (p.2 : ℝ) • 0, hmem p⟩).1, + continuous_subtype_val.comp (e.continuous.comp + ((Continuous.add + (Continuous.smul (continuous_const.sub (continuous_subtype_val.comp continuous_snd)) + (continuous_subtype_val.comp (lift.continuous.comp continuous_fst))) + (Continuous.smul (continuous_subtype_val.comp continuous_snd) + continuous_const)).subtype_mk + hmem))⟩ + refine ⟨Ψ, fun p => (e ⟨_, hmem p⟩).2, ?_, ?_⟩ + · intro x + have hx : (⟨(1 - ((x, (0 : unitInterval)).2 : ℝ)) • (lift (x, (0 : unitInterval)).1).1 + + ((x, (0 : unitInterval)).2 : ℝ) • 0, hmem (x, 0)⟩ : ClosedUnitDisc) = lift x := by + ext; simp + change (e ⟨_, hmem (x, 0)⟩).1 = φ x + rw [hx] + exact congrArg Subtype.val (e.apply_symm_apply _) + · intro x + have hx : (⟨(1 - ((x, (1 : unitInterval)).2 : ℝ)) • (lift (x, (1 : unitInterval)).1).1 + + ((x, (1 : unitInterval)).2 : ℝ) • 0, hmem (x, 1)⟩ : ClosedUnitDisc) = c0 := by + ext; simp [c0] + change (e ⟨_, hmem (x, 1)⟩).1 = (e c0).1 + rw [hx] + +/-- Every open disc $\Lambda \subseteq S$ is simply connected (`IsSimplyConnectedSet`). +Graph Minors XI, Section 3 (page 76). +Route: straight-line contraction to the image of the origin $0 \in \text{OpenUnitDisc}$. -/ +theorem IsOpenDisc.isSimplyConnectedSet {S : Type u} [TopologicalSpace S] {Λ : Set S} + (hΛ : IsOpenDisc Λ) : IsSimplyConnectedSet Λ := by + refine ⟨hΛ.isPathConnected, fun φ hφ => ?_⟩ + rcases hΛ with ⟨_, ⟨e⟩⟩ + let c0 : OpenUnitDisc := ⟨0, zero_mem_openUnitDisc⟩ + refine ⟨(e c0).1, (e c0).2, ?_⟩ + let lift : C(Circle, OpenUnitDisc) := + ⟨fun x => e.symm ⟨φ x, hφ (mem_range_self x)⟩, + e.symm.continuous.comp (φ.continuous.subtype_mk _)⟩ + have hmem : ∀ p : Circle × unitInterval, + (1 - (p.2 : ℝ)) • (lift p.1).1 + (p.2 : ℝ) • (0 : EuclideanPlane) ∈ OpenUnitDisc := by + intro p + exact convex_openUnitDisc (lift p.1).2 zero_mem_openUnitDisc + (sub_nonneg.mpr p.2.2.2) p.2.2.1 (sub_add_cancel 1 (p.2 : ℝ)) + let Ψ : C(Circle × unitInterval, S) := + ⟨fun p => (e ⟨(1 - (p.2 : ℝ)) • (lift p.1).1 + (p.2 : ℝ) • 0, hmem p⟩).1, + continuous_subtype_val.comp (e.continuous.comp + ((Continuous.add + (Continuous.smul (continuous_const.sub (continuous_subtype_val.comp continuous_snd)) + (continuous_subtype_val.comp (lift.continuous.comp continuous_fst))) + (Continuous.smul (continuous_subtype_val.comp continuous_snd) + continuous_const)).subtype_mk + hmem))⟩ + refine ⟨Ψ, fun p => (e ⟨_, hmem p⟩).2, ?_, ?_⟩ + · intro x + have hx : (⟨(1 - ((x, (0 : unitInterval)).2 : ℝ)) • (lift (x, (0 : unitInterval)).1).1 + + ((x, (0 : unitInterval)).2 : ℝ) • 0, hmem (x, 0)⟩ : OpenUnitDisc) = lift x := by + ext; simp + change (e ⟨_, hmem (x, 0)⟩).1 = φ x + rw [hx] + exact congrArg Subtype.val (e.apply_symm_apply _) + · intro x + have hx : (⟨(1 - ((x, (1 : unitInterval)).2 : ℝ)) • (lift (x, (1 : unitInterval)).1).1 + + ((x, (1 : unitInterval)).2 : ℝ) • 0, hmem (x, 1)⟩ : OpenUnitDisc) = c0 := by + ext; simp [c0] + change (e ⟨_, hmem (x, 1)⟩).1 = (e c0).1 + rw [hx] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/DiscArcs.lean b/LeanPool/GraphMinor/Surface/DiscArcs.lean new file mode 100644 index 0000000000..8231e452a4 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/DiscArcs.lean @@ -0,0 +1,263 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! +# Arcs in a closed disc + +* `disc_oArc : DiscOArcStatement`: an `O`-arc in a closed disc bounds a unique closed disc there. +* `disc_iArc : DiscIArcStatement`: a proper `I`-arc divides a closed disc into two closed discs. + +The route is the one of the module docstring of `Surface/PlaneDisc.lean`. A closed disc `D` is +carried to the closed unit disc of `ℂ` by a chart (`IsChart`). There the closed disc inside an +`O`-arc is its closed domain, and the sides of a cross-cut are given by the theta lemma +`IsCut.closedInner_facts`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +local notation "𝕀" => unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- Coordinates on a closed disc, as a pair of maps. -/ +structure IsChart (D : Set S) (h : S → ℂ) (g : ℂ → S) : Prop where + hc : ContinuousOn h D + gc : ContinuousOn g (closedBall 0 1) + hm : MapsTo h D (closedBall 0 1) + gm : MapsTo g (closedBall 0 1) D + gh : LeftInvOn g h D + hg : LeftInvOn h g (closedBall 0 1) + bd : h '' discBd D = sphere 0 1 + +theorem IsClosedDisc.exists_isChart {D : Set S} (hD : IsClosedDisc D) : + ∃ h g, IsChart D h g := by + obtain ⟨h, g, h1, h2, h3, h4, h5, h6, h7⟩ := hD.exists_chart + exact ⟨h, g, h1, h2, h3, h4, h5, h6, h7⟩ + +theorem discBd_subset (D : Set S) : discBd D ⊆ D := by + rintro _ ⟨x, -, rfl⟩ + exact x.2 + +namespace IsChart + +variable {D : Set S} {h : S → ℂ} {g : ℂ → S} + +theorem image_subset (c : IsChart D h g) {X : Set S} (hX : X ⊆ D) : h '' X ⊆ closedBall 0 1 := + image_subset_iff.mpr fun _ hx => c.hm (hX hx) + +theorem g_subset (c : IsChart D h g) {Z : Set ℂ} (hZ : Z ⊆ closedBall 0 1) : g '' Z ⊆ D := + image_subset_iff.mpr fun _ hx => c.gm (hZ hx) + +theorem g_h (c : IsChart D h g) {X : Set S} (hX : X ⊆ D) : g '' (h '' X) = X := + (c.gh.mono hX).image_image + +theorem h_g (c : IsChart D h g) {Z : Set ℂ} (hZ : Z ⊆ closedBall 0 1) : h '' (g '' Z) = Z := + (c.hg.mono hZ).image_image + +theorem g_closedBall (c : IsChart D h g) : g '' closedBall 0 1 = D := by + refine Subset.antisymm (c.g_subset Subset.rfl) fun x hx => ?_ + exact ⟨h x, c.hm hx, c.gh hx⟩ + +theorem g_sphere (c : IsChart D h g) : g '' sphere 0 1 = discBd D := by + rw [← c.bd, c.g_h (discBd_subset D)] + +theorem injOn (c : IsChart D h g) : InjOn g (closedBall 0 1) := c.hg.injOn + +theorem g_inter (c : IsChart D h g) {Z W : Set ℂ} (hZ : Z ⊆ closedBall 0 1) + (hW : W ⊆ closedBall 0 1) : g '' (Z ∩ W) = g '' Z ∩ g '' W := by + refine Subset.antisymm (image_inter_subset _ _ _) ?_ + rintro _ ⟨⟨x, hx, rfl⟩, y, hy, he⟩ + obtain rfl := c.injOn (hW hy) (hZ hx) he + exact ⟨y, ⟨hx, hy⟩, rfl⟩ + +theorem g_sdiff (c : IsChart D h g) {Z W : Set ℂ} (hZ : Z ⊆ closedBall 0 1) + (hW : W ⊆ closedBall 0 1) : g '' (Z \ W) = g '' Z \ g '' W := by + ext x + constructor + · rintro ⟨z, ⟨hz, hzW⟩, rfl⟩ + refine ⟨⟨z, hz, rfl⟩, ?_⟩ + rintro ⟨w, hw, he⟩ + obtain rfl := c.injOn (hW hw) (hZ hz) he + exact hzW hw + · rintro ⟨⟨z, hz, rfl⟩, hn⟩ + exact ⟨z, ⟨hz, fun h' => hn ⟨z, h', rfl⟩⟩, rfl⟩ + +theorem disc_g (c : IsChart D h g) {Z : Set ℂ} (hZ : Z ⊆ closedBall 0 1) (hd : IsClosedDisc Z) : + IsClosedDisc (g '' Z) ∧ discBd (g '' Z) = g '' discBd Z := + hd.image (c.gc.mono hZ) (c.hc.mono (c.g_subset hZ)) (c.hg.mono hZ) + +theorem disc_h (c : IsChart D h g) {X : Set S} (hX : X ⊆ D) (hd : IsClosedDisc X) : + IsClosedDisc (h '' X) ∧ discBd (h '' X) = h '' discBd X := + hd.image (c.hc.mono hX) (c.gc.mono (c.image_subset hX)) (c.gh.mono hX) + +theorem oArc_h (c : IsChart D h g) {X : Set S} (hX : X ⊆ D) (hd : IsOArc X) : + Nonempty (Circle ≃ₜ h '' X) := + hd.image (c.hc.mono hX) (c.gc.mono (c.image_subset hX)) (c.gh.mono hX) + +theorem components_g (c : IsChart D h g) {Z : Set ℂ} (hZ : Z ⊆ closedBall 0 1) : + componentsIn (g '' Z) = (fun C => g '' C) '' componentsIn Z := + componentsIn_image (c.gc.mono hZ) (c.hc.mono (c.g_subset hZ)) (c.hg.mono hZ) + +end IsChart + +/-- **An `O`-arc in a closed disc bounds a unique closed disc there.** The closed disc is the closed +domain of the arc in a chart. -/ +theorem disc_oArc : DiscOArcStatement.{u} := by + intro S _ D F hD hFD hF + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hGsub : h '' F ⊆ closedBall 0 1 := c.image_subset hFD + have hG := c.oArc_h hFD hF + have hFg : g '' (h '' F) = F := c.g_h hFD + have hin := closedInner_subset_closedBall hG hGsub + obtain ⟨d1, d2⟩ := isClosedDisc_closedInner hG + obtain ⟨d3, d4⟩ := c.disc_g hin d1 + rw [d2, hFg] at d4 + have e1 : g '' closedInner (h '' F) \ F = g '' inner (h '' F) := by + rw [← closedInner_sdiff hG, c.g_sdiff hin hGsub, hFg] + have e2 : D \ F = g '' (closedBall 0 1 \ h '' F) := by + rw [c.g_sdiff Subset.rfl hGsub, c.g_closedBall, hFg] + obtain ⟨k1, k2, k3⟩ := components_closedBall_sdiff hG hGsub + have hinner : inner (h '' F) ⊆ closedBall 0 1 := subset_union_left.trans hin + refine ⟨g '' closedInner (h '' F), ⟨c.g_subset hin, d3, d4, ?_, ?_, ?_⟩, ?_⟩ + · rw [e1, e2, c.components_g sdiff_subset] + exact mem_image_of_mem _ k1 + · rw [e1, ← c.g_sphere, Set.disjoint_iff_inter_eq_empty, + ← c.g_inter hinner sphere_subset_closedBall, k2.inter_eq, image_empty] + · intro C hC hd + rw [e2, c.components_g sdiff_subset] at hC + obtain ⟨C', hC', rfl⟩ := hC + rw [e1] + have hdis : Disjoint C' (sphere 0 1) := by + rw [← c.g_sphere] at hd + exact Set.disjoint_left.mpr fun z h1 h2 => + Set.disjoint_left.mp hd ⟨z, h1, rfl⟩ ⟨z, h2, rfl⟩ + simp only + rw [k3 C' hC' hdis] + · intro Δ' h1 h2 h3 + obtain ⟨a, b⟩ := c.disc_h h1 h2 + rw [h3] at b + rw [← c.g_h h1, eq_closedInner_of_discBd hG a b] + +/-- **A proper `I`-arc divides a closed disc into two closed discs.** In a chart the arc is a +cross-cut of the unit circle, and the two discs are the closed domains of the two sides. -/ +theorem disc_iArc : DiscIArcStatement.{u} := by + intro S _ D F s t hD hFD hst hL hmeet + obtain ⟨h, g, c⟩ := hD.exists_isChart + obtain ⟨f, hf0, hf1⟩ := hL + have hinjh : InjOn h D := c.gh.injOn + have hsF : s ∈ F ∩ discBd D := hmeet ▸ Or.inl rfl + have htF : t ∈ F ∩ discBd D := hmeet ▸ Or.inr rfl + let e : 𝕀 → ℂ := fun u => h (f u).1 + have he : IsArcMap e := by + refine ⟨c.hc.comp_continuous (continuous_subtype_val.comp f.continuous) fun u => hFD (f u).2, + fun u v huv => f.injective (Subtype.ext (hinjh (hFD (f u).2) (hFD (f v).2) huv))⟩ + have he0 : e 0 = h s := by + simp only [e, hf0] + have he1 : e 1 = h t := by + simp only [e, hf1] + have hne : e 0 ≠ e 1 := fun heq => zero_ne_one (he.2 heq) + have hs0 : e 0 ∈ sphere (0 : ℂ) 1 := by + rw [he0, ← c.bd] + exact mem_image_of_mem h hsF.2 + have hs1 : e 1 ∈ sphere (0 : ℂ) 1 := by + rw [he1, ← c.bd] + exact mem_image_of_mem h htF.2 + have hin : ∀ u : 𝕀, u ≠ 0 → u ≠ 1 → e u ∈ inner (sphere (0 : ℂ) 1) := by + intro u h0 h1 + rw [inner_sphere, mem_ball_zero_iff] + refine lt_of_le_of_ne (mem_closedBall_zero_iff.mp (c.hm (hFD (f u).2))) fun hn => ?_ + have hz : e u ∈ sphere (0 : ℂ) 1 := mem_sphere_zero_iff_norm.mpr hn + rw [← c.bd] at hz + obtain ⟨x, hx, hxe⟩ := hz + have hxu : x = (f u).1 := hinjh (discBd_subset D hx) (hFD (f u).2) hxe + have hmem : (f u).1 ∈ F ∩ discBd D := ⟨(f u).2, hxu ▸ hx⟩ + rw [hmeet] at hmem + rcases hmem with h' | h' + · exact h0 (f.injective (Subtype.ext (h'.trans hf0.symm))) + · exact h1 (f.injective (Subtype.ext (h'.trans hf1.symm))) + obtain ⟨φ₀⟩ := oArc_sphere + have J₀ := isJordanParts φ₀ + obtain ⟨a, b, cut⟩ := exists_isCut φ₀ he hne hs0 hs1 hin + have hFe : h '' F = range e := by + ext z + constructor + · rintro ⟨x, hx, rfl⟩ + exact ⟨f.symm ⟨x, hx⟩, by simp [e]⟩ + · rintro ⟨u, rfl⟩ + exact ⟨(f u).1, (f u).2, rfl⟩ + have hFg : g '' range e = F := by + rw [← hFe] + exact c.g_h hFD + have hends : g '' {e 0, e 1} = {s, t} := by + rw [image_pair, he0, he1, c.gh (hFD hsF.1), c.gh (hFD htF.1)] + obtain ⟨-, f2, f3, f4, -, -⟩ := cut.closedInner_facts J₀ + obtain ⟨u1, u2, u3, u4, u5⟩ := cut.components J₀ + rw [closedInner_sphere] at f2 f3 u1 u2 + have hA : sphere (0 : ℂ) 1 ⊆ closedBall 0 1 := sphere_subset_closedBall + have hrsub : range e ⊆ closedBall 0 1 := by + rw [← hFe] + exact c.image_subset hFD + have hae : range a ⊆ closedBall 0 1 := fun z hz => hA (cut.union ▸ Or.inl hz) + have hbe : range b ⊆ closedBall 0 1 := fun z hz => hA (cut.union ▸ Or.inr hz) + have hpair : ({e 0, e 1} : Set ℂ) ⊆ closedBall 0 1 := by + rintro z (rfl | rfl) + · exact hA hs0 + · exact hA hs1 + obtain ⟨d1, d2⟩ := isClosedDisc_closedInner cut.oArc_side + obtain ⟨d3, d4⟩ := isClosedDisc_closedInner cut.symm.oArc_side + obtain ⟨g1, g2⟩ := c.disc_g f2 d1 + obtain ⟨g3, g4⟩ := c.disc_g f3 d3 + rw [d2] at g2 + rw [d4] at g4 + have hside : ∀ {d : 𝕀 → ℂ}, d 0 = e 0 → d 1 = e 1 → + side d e = (range d \ {e 0, e 1}) ∪ range e := by + intro d h0 h1 + ext z + constructor + · rintro (hz | hz) + · by_cases hend : z ∈ ({e 0, e 1} : Set ℂ) + · rcases hend with rfl | rfl + · exact Or.inr ⟨0, rfl⟩ + · exact Or.inr ⟨1, rfl⟩ + · exact Or.inl ⟨hz, hend⟩ + · exact Or.inr hz + · rintro (hz | hz) + · exact Or.inl hz.1 + · exact Or.inr hz + have hsid₁ := hside cut.a_zero cut.a_one + have hsid₂ := hside cut.b_zero cut.b_one + have hinter : closedInner (side a e) ∩ closedInner (side b e) = range e := by + refine Subset.antisymm f4 fun z hz => ⟨Or.inr (Or.inr hz), Or.inr (Or.inr hz)⟩ + refine ⟨g '' (range a \ {e 0, e 1}), g '' (range b \ {e 0, e 1}), _, _, ?_, ?_, g1, g3, ?_, ?_, + ?_, ?_, ?_⟩ + · intro hEq + have := congrArg (fun X => h '' X) hEq + rw [c.h_g (sdiff_subset.trans hae), c.h_g (sdiff_subset.trans hbe)] at this + exact u5 this + · rw [← c.g_sphere, ← hends, ← c.g_sdiff hA hpair, c.components_g (sdiff_subset.trans hA), u4, + image_pair] + · rw [← image_union, (cut.closedInner_facts J₀).1, closedInner_sphere, c.g_closedBall] + · rw [← c.g_inter f2 f3, hinter, hFg] + · rw [g2, hsid₁, image_union, hFg] + · rw [g4, hsid₂, image_union, hFg] + · have e3 : D \ F = g '' (closedBall 0 1 \ range e) := by + rw [c.g_sdiff Subset.rfl hrsub, c.g_closedBall, hFg] + rw [e3, c.components_g (sdiff_subset.trans Subset.rfl), u2, image_pair, + c.g_sdiff f2 hrsub, c.g_sdiff f3 hrsub, hFg] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/DiscFan.lean b/LeanPool/GraphMinor/Surface/DiscFan.lean new file mode 100644 index 0000000000..e864b6f245 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/DiscFan.lean @@ -0,0 +1,542 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Fans of closed discs + +A fan at a point `y` is a finite family of closed discs through `y`, each with two rays from `y` on +its boundary. Two +discs of the family meet only in common rays, a ray lies in at most two discs, and the family is +connected through +common rays. Then the union is a closed disc (`IsFan.exists_disc`). We merge two discs along a +common ray with +`disc_union` until at most two discs are left. No cyclic order around `y` is needed. + +If each ray lies in two discs then `y` is not on the boundary of the union. If some ray lies in only +one disc, then `y` +is on this boundary. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +universe u + +variable {X : Type u} [TopologicalSpace X] + +/-- The hypotheses on a fan at `y`. A member is a disc with the set of its two rays. -/ +structure IsFan (y : X) (𝓟 : Set (Set X × Set (Set X))) : Prop where + fin : 𝓟.Finite + disc : ∀ P ∈ 𝓟, IsClosedDisc P.1 + rays : ∀ P ∈ 𝓟, ∃ r r' u u', P.2 = {r, r'} ∧ r ≠ r' ∧ IsLineWithEnds r y u + ∧ IsLineWithEnds r' y u' ∧ + r ⊆ discBd P.1 ∧ r' ⊆ discBd P.1 ∧ r ∩ r' = {y} + meet : ∀ P ∈ 𝓟, ∀ P' ∈ 𝓟, P ≠ P' → P.1 ∩ P'.1 = {y} ∪ ⋃₀ (P.2 ∩ P'.2) + two : ∀ r, {P ∈ 𝓟 | r ∈ P.2}.encard ≤ 2 + conn : ∀ 𝓠 ⊆ 𝓟, 𝓠.Nonempty → (∀ P ∈ 𝓠, ∀ P' ∈ 𝓟, (P.2 ∩ P'.2).Nonempty → P' ∈ 𝓠) → 𝓠 = 𝓟 + +theorem IsLineWithEnds.ne' {L : Set X} {u v : X} (h : IsLineWithEnds L u v) : u ≠ v := by + obtain ⟨f, h0, h1⟩ := h + intro he + have : f 0 = f 1 := Subtype.ext (by rw [h0, h1, he]) + exact zero_ne_one (f.injective this) + +omit [TopologicalSpace X] in +theorem not_third {𝓟 : Set (Set X × Set (Set X))} {r : Set X} (h : {P ∈ 𝓟 | r ∈ P.2}.encard ≤ 2) + {P P' Q : Set X × Set (Set X)} (hP : P ∈ 𝓟) (hP' : P' ∈ 𝓟) (hQ : Q ∈ 𝓟) (h1 : r ∈ P.2) + (h2 : r ∈ P'.2) + (h3 : r ∈ Q.2) (hne : P ≠ P') (hQ1 : Q ≠ P) (hQ2 : Q ≠ P') : False := by + classical + have hs : ({Q, P, P'} : Set (Set X × Set (Set X))) ⊆ {P ∈ 𝓟 | r ∈ P.2} := by + rintro x (rfl | rfl | rfl) + · exact ⟨hQ, h3⟩ + · exact ⟨hP, h1⟩ + · exact ⟨hP', h2⟩ + have h4 := (encard_le_encard hs).trans h + rw [encard_insert_of_notMem (by simp [hQ1, hQ2]), encard_pair hne] at h4 + norm_num at h4 + +variable [T2Space X] + +omit [T2Space X] in +theorem IsFan.rays_of {y : X} {𝓟 : Set (Set X × Set (Set X))} (h : IsFan y 𝓟) {P : Set X × Set + (Set X)} (hP : P ∈ 𝓟) + {c : Set X} (hc : c ∈ P.2) : ∃ o u v, P.2 = {c, o} ∧ c ≠ o ∧ IsLineWithEnds c y u + ∧ IsLineWithEnds o y v ∧ + c ⊆ discBd P.1 ∧ o ⊆ discBd P.1 ∧ c ∩ o = {y} := by + obtain ⟨r, r', u, u', hR, hrr, hl, hl', hb, hb', hi⟩ := h.rays P hP + rw [hR] at hc + rcases hc with rfl | hc + · exact ⟨r', u, u', hR, hrr, hl, hl', hb, hb', hi⟩ + · have hc' : c = r' := hc + subst hc' + exact ⟨r, u', u, by rw [hR, pair_comm], hrr.symm, hl', hl, hb', hb, by rw [inter_comm, hi]⟩ + +omit [T2Space X] in +private theorem IsFan.merge_conn {y : X} {𝓟 : Set (Set X × Set (Set X))} + (h : IsFan y 𝓟) {P P' : Set X × Set (Set X)} + (hP : P ∈ 𝓟) (hP' : P' ∈ 𝓟) {c o o' : Set X} + (hR : P.2 = {c, o}) (hR' : P'.2 = {c, o'}) + (hNc : ∀ Q ∈ 𝓟, Q ≠ P → Q ≠ P' → c ∉ Q.2) : + let N : Set X × Set (Set X) := (P.1 ∪ P'.1, ({o, o'} : Set (Set X))) + N ∉ 𝓟 → + ∀ 𝓠 ⊆ insert N (𝓟 \ {P, P'}), 𝓠.Nonempty → + (∀ Q ∈ 𝓠, ∀ Q' ∈ insert N (𝓟 \ {P, P'}), + (Q.2 ∩ Q'.2).Nonempty → Q' ∈ 𝓠) → + 𝓠 = insert N (𝓟 \ {P, P'}) := by + classical + intro N hNnot 𝓠 hsub hne𝓠 hcl + have hshare : ∀ Q ∈ 𝓠, ∀ t, t ∈ Q.2 → t ∈ N.2 → N ∈ 𝓠 := fun Q hQ t h1 h2 => + hcl Q hQ N (.inl rfl) ⟨t, h1, h2⟩ + have hPray : ∀ Q ∈ 𝓟, Q ≠ P → Q ≠ P' → ∀ t ∈ Q.2, t ∈ P.2 ∪ P'.2 → t ∈ N.2 := by + rintro Q hQ h1 h2 t ht (h3 | h3) + · rw [hR] at h3 + rcases h3 with rfl | h3 + · exact absurd ht (hNc Q hQ h1 h2) + · exact .inl h3 + · rw [hR'] at h3 + rcases h3 with rfl | h3 + · exact absurd ht (hNc Q hQ h1 h2) + · exact .inr h3 + have hQ𝓟 : ∀ Q ∈ 𝓠, Q ≠ N → Q ∈ 𝓟 ∧ Q ≠ P ∧ Q ≠ P' := fun Q hQ hne' => by + rcases hsub hQ with rfl | h1 + · exact absurd rfl hne' + · exact ⟨h1.1, fun he => h1.2 (.inl he), fun he => h1.2 (.inr he)⟩ + let 𝓠' : Set (Set X × Set (Set X)) := (𝓠 \ {N}) ∪ (if N ∈ 𝓠 then {P, P'} else ∅) + have hsub' : 𝓠' ⊆ 𝓟 := by + rintro Q (hQ | hQ) + · exact (hQ𝓟 Q hQ.1 hQ.2).1 + · split_ifs at hQ with h1 + · rcases hQ with rfl | rfl + · exact hP + · exact hP' + · exact absurd hQ (notMem_empty _) + have hne' : 𝓠'.Nonempty := by + obtain ⟨Q, hQ⟩ := hne𝓠 + by_cases hQN : Q = N + · subst hQN + exact ⟨P, .inr (by rw [ite_eq_left hQ]; exact .inl rfl)⟩ + · exact ⟨Q, .inl ⟨hQ, hQN⟩⟩ + have hcl' : ∀ Q ∈ 𝓠', ∀ Q' ∈ 𝓟, (Q.2 ∩ Q'.2).Nonempty → Q' ∈ 𝓠' := by + intro Q hQ Q' hQ' ⟨t, ht1, ht2⟩ + have hNin : ∀ Q'' ∈ 𝓠, Q'' ≠ N → (Q' = P ∨ Q' = P') → t ∈ Q''.2 → N ∈ 𝓠 := by + intro Q'' hQ'' hn h1 h2 + obtain ⟨h3, h4, h5⟩ := hQ𝓟 Q'' hQ'' hn + refine hshare Q'' hQ'' t h2 (hPray Q'' h3 h4 h5 t h2 ?_) + rcases h1 with rfl | rfl + · exact .inl ht2 + · exact .inr ht2 + by_cases hQ'P : Q' = P ∨ Q' = P' + · have hNm : N ∈ 𝓠 := by + rcases hQ with hQ | hQ + · exact hNin Q hQ.1 hQ.2 hQ'P ht1 + · split_ifs at hQ with h1 + · exact h1 + · exact absurd hQ (notMem_empty _) + refine .inr ?_ + rw [ite_eq_left hNm] + rcases hQ'P with rfl | rfl + · exact .inl rfl + · exact .inr rfl + · push Not at hQ'P + have hQ'N : Q' ≠ N := fun he => hNnot (he ▸ hQ') + have hm' : Q' ∈ insert N (𝓟 \ {P, P'}) := .inr ⟨hQ', fun h1 => by + rcases h1 with h1 | h1 + · exact hQ'P.1 h1 + · exact hQ'P.2 h1⟩ + refine .inl ⟨?_, hQ'N⟩ + rcases hQ with hQ | hQ + · exact hcl Q hQ.1 Q' hm' ⟨t, ht1, ht2⟩ + · split_ifs at hQ with h1 + · have ht3 : t ∈ N.2 := by + refine hPray Q' hQ' hQ'P.1 hQ'P.2 t ht2 ?_ + rcases hQ with rfl | rfl + · exact .inl ht1 + · exact .inr ht1 + exact hcl N h1 Q' hm' ⟨t, ht3, ht2⟩ + · exact absurd hQ (notMem_empty _) + have hall := h.conn 𝓠' hsub' hne' hcl' + have hNm : N ∈ 𝓠 := by + have h1 : P ∈ 𝓠' := hall ▸ hP + rcases h1 with h1 | h1 + · have h2 := hsub h1.1 + rcases h2 with h2 | h2 + · exact absurd h2 h1.2 + · exact absurd (.inl rfl) h2.2 + · split_ifs at h1 with h2 + · exact h2 + · exact absurd h1 (notMem_empty _) + refine subset_antisymm hsub ?_ + rintro Q (rfl | hQ) + · exact hNm + · have h1 : Q ∈ 𝓠' := hall ▸ hQ.1 + rcases h1 with h1 | h1 + · exact h1.1 + · rw [ite_eq_left hNm] at h1 + exact absurd h1 hQ.2 + +/-- Merging two members of a fan along a common ray gives a fan. -/ +theorem IsFan.merge {y : X} {𝓟 : Set (Set X × Set (Set X))} (h : IsFan y 𝓟) {P P' : Set X × Set + (Set X)} + (hP : P ∈ 𝓟) (hP' : P' ∈ 𝓟) (hne : P ≠ P') {c o o' : Set X} {u : X} (hR : P.2 = {c, o}) + (hR' : P'.2 = {c, o'}) + (hoo : o ≠ o') (hco : c ≠ o) (hco' : c ≠ o') (hlc : IsLineWithEnds c y u) (hco1 : c ∩ o = {y}) + (hco2 : c ∩ o' = {y}) + (hbc : c ⊆ discBd P.1) (hbc' : c ⊆ discBd P'.1) (hbo : o ⊆ discBd P.1) (hbo' : o' ⊆ discBd P'.1) + (hlo : ∃ v, IsLineWithEnds o y v) (hlo' : ∃ v, IsLineWithEnds o' y v) : + (P.1 ∪ P'.1, ({o, o'} : Set (Set X))) ∉ 𝓟 ∧ IsFan y (insert (P.1 ∪ P'.1, ({o, o'} : Set + (Set X))) (𝓟 \ {P, P'})) ∧ + IsClosedDisc (P.1 ∪ P'.1) ∧ o ⊆ discBd (P.1 ∪ P'.1) ∧ o' ⊆ discBd (P.1 ∪ P'.1) := by + classical + set N : Set X × Set (Set X) := (P.1 ∪ P'.1, ({o, o'} : Set (Set X))) with hN + have hyc : y ∈ c := hlc.left_mem + have hinter : P.2 ∩ P'.2 = {c} := by + rw [hR, hR'] + ext t + simp only [mem_inter_iff, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨h1 | h1, h2 | h2⟩ + · exact h1 + · exact h1 + · exact h2 + · exact absurd (h1.symm.trans h2) hoo + · rintro rfl + exact ⟨.inl rfl, .inl rfl⟩ + have hmeet : P.1 ∩ P'.1 = c := by + rw [h.meet P hP P' hP' hne, hinter, sUnion_singleton] + exact union_eq_right.mpr (singleton_subset_iff.mpr hyc) + obtain ⟨hdisc, hbd⟩ := disc_union.{u} P.1 P'.1 c y u (h.disc P hP) (h.disc P' hP') hlc hmeet hbc + hbc' + have hoi : o ⊆ discBd (P.1 ∪ P'.1) := fun z hz => by + rw [hbd] + refine ⟨.inl (hbo hz), fun hzc => hzc.2 (.inl ?_)⟩ + have : z ∈ c ∩ o := ⟨hzc.1, hz⟩ + rwa [hco1] at this + have hoi' : o' ⊆ discBd (P.1 ∪ P'.1) := fun z hz => by + rw [hbd] + refine ⟨.inr (hbo' hz), fun hzc => hzc.2 (.inl ?_)⟩ + have : z ∈ c ∩ o' := ⟨hzc.1, hz⟩ + rwa [hco2] at this + have hNnot : N ∉ 𝓟 := by + intro hNm + have hPN : P ≠ N := by + intro he + apply hoo + have h1 : c ∈ P.2 := by rw [hR]; exact .inl rfl + rw [he] at h1 + rcases h1 with h1 | h1 + · exact absurd h1 hco + · exact absurd h1 hco' + have h1 := h.meet P hP N hNm hPN + have h2 : P.1 ∩ N.1 = P.1 := inter_eq_left.mpr subset_union_left + rw [h2] at h1 + obtain ⟨z, hz⟩ := (h.disc P hP).nonempty_discInt + have h3 : z ∈ {y} ∪ ⋃₀ (P.2 ∩ N.2) := h1 ▸ hz.1 + rcases h3 with h3 | ⟨t, ht, hzt⟩ + · exact hz.2 (hbc (by rw [show z = y from h3]; exact hyc)) + · rw [hR] at ht + rcases ht.1 with rfl | ht1 + · exact hz.2 (hbc hzt) + · have ht2 : t = o := ht1 + exact hz.2 (hbo (ht2 ▸ hzt)) + have hNc : ∀ Q ∈ 𝓟, Q ≠ P → Q ≠ P' → c ∉ Q.2 := fun Q hQ h1 h2 hc => + not_third (h.two c) hP hP' hQ (by rw [hR]; exact .inl rfl) (by rw [hR']; exact .inl rfl) hc hne + h1 h2 + have hs1 : ∀ Q ∈ 𝓟, Q ≠ P → Q ≠ P' → P.1 ∩ Q.1 = {y} ∪ ⋃₀ (({o} : Set (Set X)) ∩ Q.2) + := fun Q hQ h1 h2 => by + rw [h.meet P hP Q hQ h1.symm] + congr 2 + ext t + rw [hR] + constructor + · rintro ⟨rfl | ht, h4⟩ + · exact absurd h4 (hNc Q hQ h1 h2) + · exact ⟨ht, h4⟩ + · rintro ⟨ht, h4⟩ + exact ⟨.inr ht, h4⟩ + have hs2 : ∀ Q ∈ 𝓟, Q ≠ P → Q ≠ P' → P'.1 ∩ Q.1 = {y} ∪ ⋃₀ (({o'} : Set (Set X)) ∩ Q.2) + := fun Q hQ h1 h2 => by + rw [h.meet P' hP' Q hQ h2.symm] + congr 2 + ext t + rw [hR'] + constructor + · rintro ⟨rfl | ht, h4⟩ + · exact absurd h4 (hNc Q hQ h1 h2) + · exact ⟨ht, h4⟩ + · rintro ⟨ht, h4⟩ + exact ⟨.inr ht, h4⟩ + have hNQ : ∀ Q ∈ 𝓟, Q ≠ P → Q ≠ P' → N.1 ∩ Q.1 = {y} ∪ ⋃₀ (N.2 ∩ Q.2) := fun Q hQ h1 h2 => by + change (P.1 ∪ P'.1) ∩ Q.1 = {y} ∪ ⋃₀ (({o, o'} : Set (Set X)) ∩ Q.2) + rw [union_inter_distrib_right, hs1 Q hQ h1 h2, hs2 Q hQ h1 h2, insert_eq, + union_inter_distrib_right, sUnion_union] + ext z + simp only [mem_union, mem_singleton_iff] + tauto + refine ⟨hNnot, ⟨(h.fin.sdiff).insert _, ?_, ?_, ?_, ?_, ?_⟩, hdisc, hoi, hoi'⟩ + · rintro Q (rfl | hQ) + · exact hdisc + · exact h.disc Q hQ.1 + · rintro Q (rfl | hQ) + · obtain ⟨v, hv⟩ := hlo + obtain ⟨v', hv'⟩ := hlo' + refine ⟨o, o', v, v', rfl, hoo, hv, hv', hoi, hoi', ?_⟩ + have hy1 : y ∈ o := hv.left_mem + have hy2 : y ∈ o' := hv'.left_mem + refine subset_antisymm (fun z hz => ?_) (singleton_subset_iff.mpr ⟨hy1, hy2⟩) + have h1 : z ∈ P.1 ∩ P'.1 := ⟨discBd_subset _ (hbo hz.1), discBd_subset _ (hbo' hz.2)⟩ + rw [hmeet] at h1 + have h2 : z ∈ c ∩ o := ⟨h1, hz.1⟩ + rwa [hco1] at h2 + · exact h.rays Q hQ.1 + · have hQn : ∀ Q ∈ 𝓟 \ {P, P'}, Q ≠ N ∧ Q ≠ P ∧ Q ≠ P' := fun Q hQ => + ⟨fun he => hNnot (he ▸ hQ.1), fun he => hQ.2 (.inl he), fun he => hQ.2 (.inr he)⟩ + rintro Q (rfl | hQ) Q' (rfl | hQ') hne' + · exact absurd rfl hne' + · exact hNQ Q' hQ'.1 (hQn Q' hQ').2.1 (hQn Q' hQ').2.2 + · have := hNQ Q hQ.1 (hQn Q hQ).2.1 (hQn Q hQ).2.2 + rw [inter_comm, this, inter_comm Q.2] + · exact h.meet Q hQ.1 Q' hQ'.1 hne' + · intro t + by_cases ht : t ∈ N.2 + · let φ : Set X × Set (Set X) → Set X × Set (Set X) := fun Q => if Q = N then (if t + = o then P else P') else Q + have hsub : φ '' {Q ∈ insert N (𝓟 \ {P, P'}) | t ∈ Q.2} ⊆ {Q ∈ 𝓟 | t ∈ Q.2} := by + rintro _ ⟨Q, ⟨rfl | hQ, htQ⟩, rfl⟩ + · simp only [φ, ite_true] + split_ifs with h3 + · exact ⟨hP, by rw [hR, h3]; exact .inr rfl⟩ + · have : t = o' := by + rcases ht with h4 | h4 + · exact absurd h4 h3 + · exact h4 + exact ⟨hP', by rw [hR', this]; exact .inr rfl⟩ + · have hQN : Q ≠ N := fun he => hNnot (he ▸ hQ.1) + simp only [φ, ite_eq_right hQN] + exact ⟨hQ.1, htQ⟩ + have hinj : InjOn φ {Q ∈ insert N (𝓟 \ {P, P'}) | t ∈ Q.2} := by + have hval : ∀ Q ∈ 𝓟 \ {P, P'}, φ Q = Q := fun Q hQ => by + have hQN : Q ≠ N := fun he => hNnot (he ▸ hQ.1) + simp only [φ, ite_eq_right hQN] + have hvalN : φ N = P ∨ φ N = P' := by + simp only [φ, ite_true] + split_ifs + · exact .inl rfl + · exact .inr rfl + rintro Q ⟨rfl | hQ, -⟩ Q' ⟨rfl | hQ', -⟩ he + · rfl + · rw [hval Q' hQ'] at he + rcases hvalN with h4 | h4 + · exact absurd (h4.symm.trans he).symm (fun h5 => hQ'.2 (.inl h5)) + · exact absurd (h4.symm.trans he).symm (fun h5 => hQ'.2 (.inr h5)) + · rw [hval Q hQ] at he + rcases hvalN with h4 | h4 + · exact absurd (he.trans h4) (fun h5 => hQ.2 (.inl h5)) + · exact absurd (he.trans h4) (fun h5 => hQ.2 (.inr h5)) + · rw [hval Q hQ, hval Q' hQ'] at he + exact he + rw [← hinj.encard_image] + exact (encard_le_encard hsub).trans (h.two t) + · refine (encard_le_encard ?_).trans (h.two t) + rintro Q ⟨rfl | hQ, htQ⟩ + · exact absurd htQ ht + · exact ⟨hQ.1, htQ⟩ + · exact h.merge_conn hP hP' hR hR' hNc hNnot + +theorem IsFan.exists_disc (n : ℕ) : ∀ (y : X) (𝓟 : Set (Set X × Set (Set X))), 𝓟.ncard = n + → IsFan y 𝓟 → 𝓟.Nonempty → + ∃ E, IsClosedDisc E ∧ E = (⋃ P ∈ 𝓟, P.1) ∧ + ((∀ P ∈ 𝓟, ∀ r ∈ P.2, ∃ P' ∈ 𝓟, P' ≠ P ∧ r ∈ P'.2) → y ∉ discBd E) ∧ + ((∃ P ∈ 𝓟, ∃ r ∈ P.2, ∀ P' ∈ 𝓟, r ∈ P'.2 → P' = P) → y ∈ discBd E) := by + classical + induction n using Nat.strong_induction_on with + | _ n ih => + intro y 𝓟 hn h hne + obtain ⟨P, hP⟩ := hne + obtain ⟨r, r', u, u', hR, hrr, hl, hl', hb, hb', hi⟩ := h.rays P hP + by_cases hsing : 𝓟 = {P} + · subst hsing + refine ⟨P.1, h.disc P hP, by simp, fun hall => ?_, fun _ => hb hl.left_mem⟩ + obtain ⟨P', hP', hne, -⟩ := hall P hP r (by rw [hR]; exact .inl rfl) + exact absurd hP' hne + obtain ⟨P', hP', hPP', c, hcP, hcP'⟩ : ∃ P' ∈ 𝓟, P' ≠ P ∧ ∃ c, c ∈ P.2 ∧ c ∈ P'.2 := by + by_contra hcon + push Not at hcon + refine hsing (h.conn {P} (by simpa using hP) ⟨P, rfl⟩ ?_).symm + rintro _ rfl Q hQ ⟨c, hc1, hc2⟩ + by_contra hQne + exact hcon Q hQ hQne c hc1 hc2 + obtain ⟨o, u₁, v₁, hR1, hco, hlc, hlo, hbc, hbo, hio⟩ := h.rays_of hP hcP + obtain ⟨o', u₂, v₂, hR2, hco', hlc', hlo', hbc', hbo', hio'⟩ := h.rays_of hP' hcP' + have hPne : P ≠ P' := hPP'.symm + by_cases hoo : o = o' + · subst hoo + have hall : ({P, P'} : Set _) = 𝓟 := by + refine h.conn {P, P'} (by + rintro Q (rfl | rfl) + · exact hP + · exact hP') ⟨P, .inl rfl⟩ ?_ + rintro Q hQ Q' hQ' ⟨t, ht1, ht2⟩ + by_contra hn' + have hq1 : Q' ≠ P := fun he => hn' (.inl he) + have hq2 : Q' ≠ P' := fun he => hn' (.inr he) + have htP : t ∈ P.2 ∧ t ∈ P'.2 := by + have h1 : t ∈ ({c, o} : Set (Set X)) := by + rcases hQ with rfl | rfl + · rw [← hR1] + exact ht1 + · rw [← hR2] + exact ht1 + exact ⟨hR1 ▸ h1, hR2 ▸ h1⟩ + exact not_third (h.two t) hP hP' hQ' htP.1 htP.2 ht2 hPne hq1 hq2 + have hinter : P.2 ∩ P'.2 = {c, o} := by + rw [hR1, hR2, inter_self] + have hmeet : P.1 ∩ P'.1 = c ∪ o := by + rw [h.meet P hP P' hP' hPne, hinter, sUnion_pair] + exact union_eq_right.mpr (singleton_subset_iff.mpr (.inl hlc.left_mem)) + have hline : IsLineWithEnds (c ∪ o) u₁ v₁ := hlc.symm.union hlo hio + obtain ⟨hdisc, hbd⟩ := disc_union.{u} P.1 P'.1 (c ∪ o) u₁ v₁ (h.disc P hP) + (h.disc P' hP') hline hmeet + (union_subset hbc hbo) (union_subset hbc' hbo') + refine ⟨P.1 ∪ P'.1, hdisc, ?_, fun _ => ?_, ?_⟩ + · rw [← hall] + simp + · rw [hbd] + rintro ⟨-, h2⟩ + refine h2 ⟨.inl hlc.left_mem, ?_⟩ + rintro (h3 | h3) + · exact hlc.ne' h3 + · exact hlo.ne' h3 + · rintro ⟨Q, hQ, t, ht, hfree⟩ + have ht' : t ∈ ({c, o} : Set (Set X)) := by + rw [← hall] at hQ + rcases hQ with rfl | rfl + · rw [← hR1] + exact ht + · rw [← hR2] + exact ht + exact absurd ((hfree P hP (hR1 ▸ ht')).trans (hfree P' hP' (hR2 ▸ ht')).symm) hPne + · obtain ⟨hNnot, hfan, hdisc, hoi, hoi'⟩ := + h.merge hP hP' hPne hR1 hR2 hoo hco hco' hlc hio hio' hbc hbc' hbo hbo' ⟨_, hlo⟩ ⟨_, hlo'⟩ + set N : Set X × Set (Set X) := (P.1 ∪ P'.1, ({o, o'} : Set (Set X))) with hN + have hlt : (insert N (𝓟 \ {P, P'})).ncard < n := by + have hnN : N ∉ 𝓟 \ {P, P'} := fun h1 => hNnot h1.1 + rw [← hn, ncard_insert_of_notMem hnN h.fin.sdiff] + have hs : ({P, P'} : Set _) ⊆ 𝓟 := by + rintro Q (rfl | rfl) + · exact hP + · exact hP' + have h1 := ncard_sdiff_add_ncard_of_subset hs h.fin + rw [ncard_pair hPne] at h1 + omega + obtain ⟨E, hE, hEu, hc1, hc2⟩ := ih _ hlt y _ rfl hfan ⟨N, .inl rfl⟩ + have hcN : ∀ Q ∈ 𝓟, Q ≠ P → Q ≠ P' → c ∉ Q.2 := fun Q hQ h1 h2 hc => + not_third (h.two c) hP hP' hQ (hR1 ▸ .inl rfl) (hR2 ▸ .inl rfl) hc hPne h1 h2 + refine ⟨E, hE, ?_, fun hall => hc1 ?_, fun hfree => hc2 ?_⟩ + · rw [hEu] + ext z + simp only [mem_iUnion, exists_prop, mem_insert_iff] + constructor + · rintro ⟨Q, rfl | hQ, hz⟩ + · rcases hz with hz | hz + · exact ⟨P, hP, hz⟩ + · exact ⟨P', hP', hz⟩ + · exact ⟨Q, hQ.1, hz⟩ + · rintro ⟨Q, hQ, hz⟩ + by_cases h1 : Q = P + · exact ⟨N, .inl rfl, .inl (h1 ▸ hz)⟩ + · by_cases h2 : Q = P' + · exact ⟨N, .inl rfl, .inr (h2 ▸ hz)⟩ + · exact ⟨Q, .inr ⟨hQ, by + rintro (h3 | h3) + · exact h1 h3 + · exact h2 h3⟩, hz⟩ + · have hkeep : ∀ Q ∈ 𝓟, Q ≠ P → Q ≠ P' → Q ∈ insert N (𝓟 \ {P, P'}) := fun Q hQ h1 h2 => + .inr ⟨hQ, by + rintro (h3 | h3) + · exact h1 h3 + · exact h2 h3⟩ + have hother : ∀ t, (t = o ∨ t = o') → ∃ Q ∈ 𝓟, Q ≠ P ∧ Q ≠ P' ∧ t ∈ Q.2 := by + rintro t (rfl | rfl) + · obtain ⟨Q, hQ, hne1, ht'⟩ := hall P hP t (hR1 ▸ .inr rfl) + refine ⟨Q, hQ, hne1, fun he => ?_, ht'⟩ + rw [he, hR2] at ht' + rcases ht' with h3 | h3 + · exact hco h3.symm + · exact hoo h3 + · obtain ⟨Q, hQ, hne1, ht'⟩ := hall P' hP' t (hR2 ▸ .inr rfl) + refine ⟨Q, hQ, fun he => ?_, hne1, ht'⟩ + rw [he, hR1] at ht' + rcases ht' with h3 | h3 + · exact hco' h3.symm + · exact hoo h3.symm + rintro Q (rfl | hQ) t ht + · obtain ⟨Q, hQ, h1, h2, h3⟩ := hother t (by + rcases ht with h4 | h4 + · exact .inl h4 + · exact .inr h4) + exact ⟨Q, hkeep Q hQ h1 h2, fun he => hNnot (he ▸ hQ), h3⟩ + · have hQ1 : Q ≠ P := fun he => hQ.2 (.inl he) + have hQ2 : Q ≠ P' := fun he => hQ.2 (.inr he) + have hQN : Q ≠ N := fun he => hNnot (he ▸ hQ.1) + obtain ⟨Q', hQ', hne1, ht'⟩ := hall Q hQ.1 t ht + by_cases h1 : Q' = P + · rw [h1, hR1] at ht' + rcases ht' with h3 | h3 + · exact absurd (h3 ▸ ht) (hcN Q hQ.1 hQ1 hQ2) + · exact ⟨N, .inl rfl, hQN.symm, .inl h3⟩ + · by_cases h2 : Q' = P' + · rw [h2, hR2] at ht' + rcases ht' with h3 | h3 + · exact absurd (h3 ▸ ht) (hcN Q hQ.1 hQ1 hQ2) + · exact ⟨N, .inl rfl, hQN.symm, .inr h3⟩ + · exact ⟨Q', hkeep Q' hQ' h1 h2, hne1, ht'⟩ + · obtain ⟨Q, hQ, t, ht, hfr⟩ := hfree + have hold : ∀ R ∈ insert N (𝓟 \ {P, P'}), R ≠ N → R ∈ 𝓟 ∧ R ≠ P ∧ R ≠ P' := by + rintro R (rfl | h1) h2 + · exact absurd rfl h2 + · exact ⟨h1.1, fun he => h1.2 (.inl he), fun he => h1.2 (.inr he)⟩ + by_cases h1 : Q = P + · subst h1 + rw [hR1] at ht + rcases ht with h3 | h3 + · exact absurd (hfr P' hP' (by rw [h3]; exact hR2 ▸ .inl rfl)) hPP' + · have h3' : t = o := h3 + refine ⟨N, .inl rfl, t, .inl h3', fun R hRm htR => ?_⟩ + by_contra hRN + obtain ⟨h4, h5, -⟩ := hold R hRm hRN + exact h5 (hfr R h4 htR) + · by_cases h2 : Q = P' + · subst h2 + rw [hR2] at ht + rcases ht with h3 | h3 + · exact absurd (hfr P hP (by rw [h3]; exact hR1 ▸ .inl rfl)) hPne + · have h3' : t = o' := h3 + refine ⟨N, .inl rfl, t, .inr h3', fun R hRm htR => ?_⟩ + by_contra hRN + obtain ⟨h4, -, h5⟩ := hold R hRm hRN + exact h5 (hfr R h4 htR) + · refine ⟨Q, .inr ⟨hQ, by + rintro (h3 | h3) + · exact h1 h3 + · exact h2 h3⟩, t, ht, fun R hRm htR => ?_⟩ + by_cases hRN : R = N + · rw [hRN] at htR + rcases htR with h3 | h3 + · exact absurd (hfr P hP (by rw [h3]; exact hR1 ▸ .inr rfl)).symm h1 + · exact absurd (hfr P' hP' (by rw [show t = o' from h3]; exact hR2 ▸ .inr rfl)).symm h2 + · exact hfr R (hold R hRm hRN).1 htR + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/DiscGrow.lean b/LeanPool/GraphMinor/Surface/DiscGrow.lean new file mode 100644 index 0000000000..aba31b62db --- /dev/null +++ b/LeanPool/GraphMinor/Surface/DiscGrow.lean @@ -0,0 +1,658 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ArcErase +public import LeanPool.GraphMinor.Surface.Gluing +public import LeanPool.GraphMinor.Surface.DiscUnion +public import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# Growing a closed disc along chords + +Let `Y` be a set of a surface in which every `O`-arc bounds a closed disc. This file shows that a +closed disc `D ⊆ Y` can be made to swallow an `O`-arc `P ⊆ Y` that leaves `D` only finitely +often (`exists_disc_cover`). + +The step is `exists_disc_of_chord`. A chord `ℓ` of `D` outside `D` makes two `O`-arcs with the two +arcs +of `bd D`. The disc bounded by the first one either contains `D`, or it meets `D` exactly in the +first arc of `bd D`, and then its union with `D` is a closed disc by `disc_union`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +local notation "𝕀" => unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The range of an arc is a line. -/ +theorem IsArcMap.isLineWithEnds [T2Space S] {a : 𝕀 → S} (ha : IsArcMap a) : + IsLineWithEnds (range a) (a 0) (a 1) := by + have hemb : IsEmbedding a := (ha.1.isClosedEmbedding ha.2).isEmbedding + exact ⟨hemb.toHomeomorph, rfl, rfl⟩ + +/-- A line is the range of an arc. -/ +theorem IsLineWithEnds.exists_arc {L : Set S} {u v : S} (h : IsLineWithEnds L u v) : + ∃ a : 𝕀 → S, IsArcMap a ∧ range a = L ∧ a 0 = u ∧ a 1 = v := by + obtain ⟨f, h0, h1⟩ := h + refine ⟨fun t => (f t).1, ⟨continuous_subtype_val.comp f.continuous, + fun s t he => f.injective (Subtype.ext he)⟩, ?_, h0, h1⟩ + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (f t).2 + · intro hx + exact ⟨f.symm ⟨x, hx⟩, by simp⟩ + +/-- Every point of the circle is at a unique angle from `u`, in `[0, 2π)`. -/ +theorem exists_circle_angle (u w : Circle) : ∃ t ∈ Ico (0 : ℝ) (2 * Real.pi), w = u * Circle.exp t + := by + have hpi := Real.pi_pos + have h := Complex.arg_mem_Ioc ((u⁻¹ * w : Circle) : ℂ) + have he := Circle.exp_arg (u⁻¹ * w) + have he' : w = u * Circle.exp (Complex.arg ((u⁻¹ * w : Circle) : ℂ)) := by + rw [he] + simp + by_cases h0 : 0 ≤ Complex.arg ((u⁻¹ * w : Circle) : ℂ) + · exact ⟨_, ⟨h0, by linarith [h.2]⟩, he'⟩ + · refine ⟨Complex.arg ((u⁻¹ * w : Circle) : ℂ) + 2 * Real.pi, ⟨by linarith [h.1], ?_⟩, ?_⟩ + · linarith + · rw [Circle.exp_add_two_pi] + exact he' + +/-- The two arcs of the circle from `1` to the point at angle `θ`. -/ +theorem circle_two_arcs {θ : ℝ} (hθ : θ ∈ Ioo 0 (2 * Real.pi)) : + IsArcMap (fun r : 𝕀 => Circle.exp (r.1 * θ)) ∧ + IsArcMap (fun r : 𝕀 => Circle.exp (2 * Real.pi - r.1 * (2 * Real.pi - θ))) ∧ + (∀ s t : 𝕀, Circle.exp (s.1 * θ) = Circle.exp (2 * Real.pi - t.1 * (2 * Real.pi - θ)) → + (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) ∧ + ∀ w : Circle, (∃ r : 𝕀, Circle.exp (r.1 * θ) = w) ∨ + ∃ r : 𝕀, Circle.exp (2 * Real.pi - r.1 * (2 * Real.pi - θ)) = w := by + have hpi := Real.pi_pos + obtain ⟨h1, h2⟩ := hθ + have hθ' : 0 < 2 * Real.pi - θ := by linarith + refine ⟨⟨by fun_prop, ?_⟩, ⟨by fun_prop, ?_⟩, ?_, ?_⟩ + · intro s t he + have hin : ∀ r : 𝕀, r.1 * θ ∈ Icc (0 : ℝ) θ := fun r => + ⟨mul_nonneg r.2.1 h1.le, by nlinarith [r.2.2]⟩ + have := Circle.exp_injOn_Icc (a := 0) (b := θ) (by linarith) (hin s) (hin t) he + exact Subtype.ext (mul_right_cancel₀ h1.ne' this) + · intro s t he + have hin : ∀ r : 𝕀, 2 * Real.pi - r.1 * (2 * Real.pi - θ) ∈ Icc θ (2 * Real.pi) := + fun r => ⟨by nlinarith [r.2.2], by nlinarith [r.2.1]⟩ + have h5 := Circle.exp_injOn_Icc (a := θ) (b := 2 * Real.pi) (by linarith) (hin s) (hin t) he + exact Subtype.ext (mul_right_cancel₀ hθ'.ne' (by linarith)) + · intro s t he + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp he + have hs0 := s.2.1 + have hs1 := s.2.2 + have ht0 := t.2.1 + have ht1 := t.2.2 + have h3 : s.1 * θ + t.1 * (2 * Real.pi - θ) = 2 * Real.pi * (m + 1) := by linarith + have h4 : 0 ≤ s.1 * θ + t.1 * (2 * Real.pi - θ) := by positivity + have h5 : s.1 * θ + t.1 * (2 * Real.pi - θ) ≤ 2 * Real.pi := by nlinarith + have h6 : (0 : ℝ) ≤ m + 1 := by + by_contra hc + nlinarith + have h7 : (m : ℝ) + 1 ≤ 1 := by + by_contra hc + nlinarith + have h6' : 0 ≤ m + 1 := by exact_mod_cast h6 + have h7' : m + 1 ≤ 1 := by exact_mod_cast h7 + obtain h | h : m + 1 = 0 ∨ m + 1 = 1 := by omega + · left + have h8 : (m : ℝ) + 1 = 0 := by exact_mod_cast h + rw [h8, mul_zero] at h3 + have h9 : 0 ≤ s.1 * θ := by positivity + have h10 : 0 ≤ t.1 * (2 * Real.pi - θ) := by positivity + have h11 : s.1 * θ = 0 := by linarith + have h12 : t.1 * (2 * Real.pi - θ) = 0 := by linarith + exact ⟨Subtype.ext ((mul_eq_zero.mp h11).resolve_right h1.ne'), + Subtype.ext ((mul_eq_zero.mp h12).resolve_right hθ'.ne')⟩ + · right + have h8 : (m : ℝ) + 1 = 1 := by exact_mod_cast h + rw [h8, mul_one] at h3 + have h9 : s.1 * θ ≤ θ := by nlinarith + have h10 : t.1 * (2 * Real.pi - θ) ≤ 2 * Real.pi - θ := by nlinarith + have h11 : s.1 * θ = 1 * θ := by linarith + have h12 : t.1 * (2 * Real.pi - θ) = 1 * (2 * Real.pi - θ) := by linarith + exact ⟨Subtype.ext (mul_right_cancel₀ h1.ne' h11), Subtype.ext (mul_right_cancel₀ hθ'.ne' + h12)⟩ + · intro w + obtain ⟨x, hx, rfl⟩ := exists_circle_angle 1 w + rw [one_mul] + rcases le_total x θ with h | h + · refine .inl ⟨⟨x / θ, div_nonneg hx.1 h1.le, (div_le_one h1).mpr h⟩, ?_⟩ + change Circle.exp (x / θ * θ) = _ + rw [div_mul_cancel₀ _ h1.ne'] + · refine .inr ⟨⟨(2 * Real.pi - x) / (2 * Real.pi - θ), div_nonneg (by linarith [hx.2]) hθ'.le, + (div_le_one hθ').mpr (by linarith)⟩, ?_⟩ + change Circle.exp (2 * Real.pi - (2 * Real.pi - x) / (2 * Real.pi - θ) * (2 * Real.pi - θ)) + = _ + rw [div_mul_cancel₀ _ hθ'.ne'] + congr 1 + ring + +/-- Two arcs of the circle with the given ends. -/ +structure IsTwoArcs {X : Type*} [TopologicalSpace X] (a b : 𝕀 → X) : Prop where + arc_left : IsArcMap a + arc_right : IsArcMap b + zero : b 0 = a 0 + one : b 1 = a 1 + meet : ∀ s t, a s = b t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) + +/-- Swapping the two arcs preserves their common endpoints and their intersection property. -/ +theorem IsTwoArcs.symm {X : Type*} [TopologicalSpace X] {u v : 𝕀 → X} + (h : IsTwoArcs u v) : IsTwoArcs v u := + ⟨h.arc_right, h.arc_left, h.zero.symm, h.one.symm, fun s t hst => + (h.meet t s hst.symm).imp (fun ⟨h1, h2⟩ => ⟨h2, h1⟩) (fun ⟨h1, h2⟩ => ⟨h2, h1⟩)⟩ + +/-- The two arcs of the circle between `u` and the point at angle `θ` from `u`. -/ +theorem circle_two_arcs' (u : Circle) {θ : ℝ} (hθ : θ ∈ Ioo 0 (2 * Real.pi)) : + ∃ a b : 𝕀 → Circle, IsTwoArcs a b ∧ (∀ r : 𝕀, a r = u * Circle.exp (r.1 * θ)) ∧ + (∀ r : 𝕀, b r = u * Circle.exp (2 * Real.pi - r.1 * (2 * Real.pi - θ))) ∧ + range a ∪ range b = univ := by + obtain ⟨h1, h2, h3, h4⟩ := circle_two_arcs hθ + have hmul : Continuous fun w : Circle => u * w := by fun_prop + have hinj : Function.Injective fun w : Circle => u * w := mul_right_injective u + refine ⟨fun r => u * Circle.exp (r.1 * θ), + fun r => u * Circle.exp (2 * Real.pi - r.1 * (2 * Real.pi - θ)), ⟨⟨hmul.comp h1.1, hinj.comp + h1.2⟩, + ⟨hmul.comp h2.1, hinj.comp h2.2⟩, ?_, ?_, ?_⟩, fun _ => rfl, fun _ => rfl, ?_⟩ + · simp + · simp + · intro s t he + exact h3 s t (hinj he) + · rw [eq_univ_iff_forall] + intro w + rcases h4 (u⁻¹ * w) with ⟨r, hr⟩ | ⟨r, hr⟩ + · exact .inl ⟨r, by simp [hr]⟩ + · exact .inr ⟨r, by simp [hr]⟩ + +/-- Two points of an `O`-arc split it into two arcs. -/ +theorem IsOArc.exists_arcs {F : Set S} (hF : IsOArc F) {x y : S} (hx : x ∈ F) (hy : y ∈ F) + (hxy : x ≠ y) : + ∃ a b : 𝕀 → S, IsTwoArcs a b ∧ a 0 = x ∧ a 1 = y ∧ range a ∪ range b = F := by + obtain ⟨φ⟩ := hF + let u : Circle := φ.symm ⟨x, hx⟩ + let v : Circle := φ.symm ⟨y, hy⟩ + have huv : u ≠ v := fun h => hxy (congrArg Subtype.val (φ.symm.injective h)) + obtain ⟨θ, hθ, hv⟩ := exists_circle_angle u v + have hθ0 : θ ≠ 0 := fun h => huv (by simpa [h] using hv.symm) + obtain ⟨a, b, hab, ha, hb, hr⟩ := circle_two_arcs' u (θ := θ) + ⟨lt_of_le_of_ne hθ.1 hθ0.symm, hθ.2⟩ + have hc : Continuous fun w : Circle => (φ w).1 := continuous_subtype_val.comp φ.continuous + have hi : Function.Injective fun w : Circle => (φ w).1 := fun _ _ h => + φ.injective (Subtype.ext h) + refine ⟨fun r => (φ (a r)).1, fun r => (φ (b r)).1, ⟨⟨hc.comp hab.1.1, hi.comp hab.1.2⟩, + ⟨hc.comp hab.2.1, hi.comp hab.2.2⟩, congrArg (fun w => (φ w).1) hab.3, + congrArg (fun w => (φ w).1) hab.4, ?_⟩, ?_, ?_, ?_⟩ + · exact fun s t he => hab.5 s t (hi he) + · simp [ha, u] + · simp [ha, ← hv, v] + · ext z + constructor + · rintro (⟨r, rfl⟩ | ⟨r, rfl⟩) <;> exact (φ _).2 + · intro hz + have : φ.symm ⟨z, hz⟩ ∈ range a ∪ range b := hr ▸ mem_univ _ + rcases this with ⟨r, hr'⟩ | ⟨r, hr'⟩ + · exact .inl ⟨r, by simp [hr']⟩ + · exact .inr ⟨r, by simp [hr']⟩ + +/-- A proper closed set of the circle with at least two points: the part of the complement around +`z` +is the inside of an arc `a` with ends in `T`, and `b` is the other arc. -/ +theorem exists_circle_chord {T : Set Circle} (hT : IsClosed T) {z x y : Circle} (hz : z ∉ T) + (hx : x ∈ T) (hy : y ∈ T) (hxy : x ≠ y) : + ∃ a b : 𝕀 → Circle, IsTwoArcs a b ∧ range a ∪ range b = univ ∧ a 0 ∈ T ∧ a 1 ∈ T ∧ + (∀ r, r ≠ 0 → r ≠ 1 → a r ∉ T) ∧ z ∈ range a := by + have hpi := Real.pi_pos + let A : Set ℝ := Icc 0 (2 * Real.pi) ∩ (fun t : ℝ => z * Circle.exp t) ⁻¹' T + have hAc : IsCompact A := + isCompact_Icc.inter_right (hT.preimage (by fun_prop)) + obtain ⟨tx, htx, hx'⟩ := exists_circle_angle z x + obtain ⟨ty, hty, hy'⟩ := exists_circle_angle z y + have htxA : tx ∈ A := ⟨⟨htx.1, htx.2.le⟩, by change z * Circle.exp tx ∈ T; rwa [← hx']⟩ + have htyA : ty ∈ A := ⟨⟨hty.1, hty.2.le⟩, by change z * Circle.exp ty ∈ T; rwa [← hy']⟩ + obtain ⟨t₂, ht₂⟩ := hAc.exists_isLeast ⟨tx, htxA⟩ + obtain ⟨t₁, ht₁⟩ := hAc.exists_isGreatest ⟨tx, htxA⟩ + have htne : tx ≠ ty := fun h => hxy (by rw [hx', hy', h]) + have hlt : t₂ < t₁ := by + rcases lt_or_gt_of_ne htne with h | h + · exact (ht₂.2 htxA).trans_lt (h.trans_le (ht₁.2 htyA)) + · exact (ht₂.2 htyA).trans_lt (h.trans_le (ht₁.2 htxA)) + have hmem : ∀ t, t ∈ A → t ≠ 0 := fun t ht h => hz (by + have : z * Circle.exp t ∈ T := ht.2 + rwa [h, Circle.exp_zero, mul_one] at this) + have ht₂0 : 0 < t₂ := lt_of_le_of_ne ht₂.1.1.1 (hmem _ ht₂.1).symm + have ht₁2 : t₁ < 2 * Real.pi := by + refine lt_of_le_of_ne ht₁.1.1.2 fun h => hz ?_ + have : z * Circle.exp t₁ ∈ T := ht₁.1.2 + rwa [h, Circle.exp_two_pi, mul_one] at this + set θ := t₂ - t₁ + 2 * Real.pi with hθdef + have hθ : θ ∈ Ioo 0 (2 * Real.pi) := ⟨by linarith, by linarith⟩ + set u := z * Circle.exp (t₁ - 2 * Real.pi) with hu + obtain ⟨a, b, hab, ha, hb, hr⟩ := circle_two_arcs' u hθ + have hval : ∀ r : ℝ, u * Circle.exp (r * θ) = z * Circle.exp (t₁ - 2 * Real.pi + r * θ) := by + intro r + rw [hu, mul_assoc, ← Circle.exp_add] + refine ⟨a, b, hab, hr, ?_, ?_, ?_, ?_⟩ + · rw [ha, hval] + simp only [Set.Icc.coe_zero, zero_mul, add_zero, Circle.exp_sub_two_pi] + exact ht₁.1.2 + · rw [ha, hval] + have : t₁ - 2 * Real.pi + ((1 : 𝕀) : ℝ) * θ = t₂ := by simp [hθdef] + rw [this] + exact ht₂.1.2 + · intro r h0 h1 hmemT + have hr0 : 0 < r.1 := lt_of_le_of_ne r.2.1 fun h => h0 (Subtype.ext h.symm) + have hr1 : r.1 < 1 := lt_of_le_of_ne r.2.2 fun h => h1 (Subtype.ext h) + rw [ha, hval] at hmemT + set τ := t₁ - 2 * Real.pi + r.1 * θ with hτ + have hτ1 : t₁ - 2 * Real.pi < τ := by + have := mul_pos hr0 hθ.1 + linarith + have hτ2 : τ < t₂ := by + have := mul_lt_mul_of_pos_right hr1 hθ.1 + simp only [one_mul] at this + linarith + rcases lt_trichotomy τ 0 with h | h | h + · have hm : τ + 2 * Real.pi ∈ A := ⟨⟨by linarith, by linarith⟩, by + change z * Circle.exp (τ + 2 * Real.pi) ∈ T + rwa [Circle.exp_add_two_pi]⟩ + have := ht₁.2 hm + linarith + · rw [h, Circle.exp_zero, mul_one] at hmemT + exact hz hmemT + · have hm : τ ∈ A := ⟨⟨h.le, by linarith⟩, hmemT⟩ + have := ht₂.2 hm + linarith + · have h0 : 0 < 2 * Real.pi - t₁ := by linarith + refine ⟨⟨(2 * Real.pi - t₁) / θ, div_nonneg h0.le hθ.1.le, ?_⟩, ?_⟩ + · rw [div_le_one hθ.1] + linarith + · rw [ha, hval] + simp only + rw [div_mul_cancel₀ _ hθ.1.ne'] + simp + +/-! ### The inside of a closed disc -/ + +/-- A closed disc minus its boundary. -/ +def discInt (D : Set S) : Set S := D \ discBd D + +private theorem interior_eq_discInt_of_frontier {S : Type*} [TopologicalSpace S] + {D : Set S} (hClosed : IsClosed D) (hfr : frontier D = discBd D) : + interior D = discInt D := by + ext x + simp only [discInt, mem_sdiff, ← hfr, frontier, hClosed.closure_eq] + exact ⟨fun hx ↦ ⟨interior_subset hx, fun h ↦ h.2 hx⟩, + fun ⟨hxD, hnf⟩ ↦ by_contra fun hni ↦ hnf ⟨hxD, hni⟩⟩ + +theorem interior_eq_discInt_complex {Δ : Set ℂ} (hΔ : IsClosedDisc Δ) : + interior Δ = discInt Δ := + interior_eq_discInt_of_frontier hΔ.isCompact.isClosed (complex_disc_frontier hΔ) + +theorem interior_eq_discInt_euclideanPlane {D : Set EuclideanPlane} (hD : IsClosedDisc D) : + interior D = discInt D := + interior_eq_discInt_of_frontier hD.isCompact.isClosed (plane_disc_frontier hD) + +theorem IsChart.discInt_eq {D : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart D h g) : + discInt D = g '' ball 0 1 := by + obtain ⟨h1, h2⟩ := c.union_ball + ext x + constructor + · rintro ⟨hx, hb⟩ + rw [← h1] at hx + exact hx.resolve_right hb + · intro hx + exact ⟨h1 ▸ .inl hx, Set.disjoint_left.mp h2 hx⟩ + +theorem IsClosedDisc.isOpen_discInt (hman : ∀ x : S, IsManifoldPoint x) {D : Set S} + (hD : IsClosedDisc D) : IsOpen (discInt D) := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + rw [c.discInt_eq] + exact c.isOpen_image_ball hman + +theorem IsClosedDisc.isPreconnected_discInt {D : Set S} (hD : IsClosedDisc D) : + IsPreconnected (discInt D) := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + rw [c.discInt_eq] + exact (convex_ball (0 : ℂ) 1).isPreconnected.image g (c.gc.mono ball_subset_closedBall) + +theorem IsClosedDisc.nonempty_discInt {D : Set S} (hD : IsClosedDisc D) : (discInt D).Nonempty := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + rw [c.discInt_eq] + exact ⟨g 0, 0, by simp, rfl⟩ + +theorem IsClosedDisc.subset_closure_discInt {D : Set S} (hD : IsClosedDisc D) : + D ⊆ closure (discInt D) := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + rw [c.discInt_eq, ← c.g_closedBall] + have : closedBall (0 : ℂ) 1 = closure (ball 0 1) := (closure_ball 0 one_ne_zero).symm + rw [this] + exact ContinuousOn.image_closure (by rw [← this]; exact c.gc) + +theorem IsClosedDisc.isClosed [T2Space S] {D : Set S} (hD : IsClosedDisc D) : IsClosed D := + hD.isCompact.isClosed + +/-- Removing points that meet a closed disc only on its boundary leaves a nonempty +path-connected set whose closure is the disc. -/ +theorem IsClosedDisc.sdiff_of_inter_subset_discBd [T2Space S] {Δ F : Set S} + (hΔ : IsClosedDisc Δ) (hF : F ∩ Δ ⊆ discBd Δ) : + (Δ \ F).Nonempty ∧ IsPathConnected (Δ \ F) ∧ closure (Δ \ F) = Δ := by + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + have hball_sub : g '' ball 0 1 ⊆ Δ \ F := by + rintro _ ⟨z, hz, rfl⟩ + refine ⟨c.gm (ball_subset_closedBall hz), fun hxF => ?_⟩ + have hxΔ := c.gm (ball_subset_closedBall hz) + exact Set.disjoint_left.mp c.union_ball.2 ⟨z, hz, rfl⟩ (hF ⟨hxF, hxΔ⟩) + have h0_mem : (0 : ℂ) ∈ ball (0 : ℂ) 1 := mem_ball_self zero_lt_one + have hx₀ : g 0 ∈ Δ \ F := hball_sub ⟨0, h0_mem, rfl⟩ + have hpc : IsPathConnected (Δ \ F) := by + refine ⟨g 0, hx₀, fun {y} hy => ?_⟩ + let z : ℂ := h y + have hz_cb : z ∈ closedBall (0 : ℂ) 1 := c.hm hy.1 + have hgz : g z = y := c.gh hy.1 + let φ : unitInterval → ℂ := fun t => (t : ℝ) • z + have hφ_cont : Continuous φ := continuous_subtype_val.smul continuous_const + have hφ_mem : ∀ t : unitInterval, φ t ∈ closedBall (0 : ℂ) 1 := by + intro t + rw [mem_closedBall_zero_iff] at hz_cb ⊢ + change ‖(t : ℝ) • z‖ ≤ 1 + rw [norm_smul, Real.norm_of_nonneg t.2.1] + calc (t : ℝ) * ‖z‖ ≤ (t : ℝ) * 1 := mul_le_mul_of_nonneg_left hz_cb t.2.1 + _ ≤ 1 := by linarith [t.2.2] + let γ : Path (g 0) y := + { toFun := g ∘ φ + continuous_toFun := c.gc.comp_continuous hφ_cont hφ_mem + source' := by change g ((0 : ℝ) • z) = g 0; simp + target' := by change g ((1 : ℝ) • z) = y; simp [hgz] } + refine ⟨γ, fun t => ?_⟩ + by_cases ht1 : (t : ℝ) = 1 + · have : γ t = y := by + change g ((t : ℝ) • z) = y + rw [ht1, one_smul, hgz] + rw [this] + exact hy + · have ht_lt : (t : ℝ) < 1 := lt_of_le_of_ne t.2.2 ht1 + have hφ_ball : φ t ∈ ball (0 : ℂ) 1 := by + rw [mem_ball_zero_iff] + rw [mem_closedBall_zero_iff] at hz_cb + change ‖(t : ℝ) • z‖ < 1 + rw [norm_smul, Real.norm_of_nonneg t.2.1] + calc (t : ℝ) * ‖z‖ ≤ (t : ℝ) * 1 := mul_le_mul_of_nonneg_left hz_cb t.2.1 + _ < 1 := by linarith + exact hball_sub ⟨φ t, hφ_ball, rfl⟩ + refine ⟨⟨g 0, hx₀⟩, hpc, Subset.antisymm (closure_minimal sdiff_subset hΔ.isClosed) ?_⟩ + exact hΔ.subset_closure_discInt.trans (closure_mono fun x hx => ⟨hx.1, fun hxF => + hx.2 (hF ⟨hxF, hx.1⟩)⟩) + +theorem discInt_subset (D : Set S) : discInt D ⊆ D := sdiff_subset + +/-- A connected set that misses the boundary of a closed disc is inside the disc or disjoint from +it. -/ +theorem IsClosedDisc.side [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) {D C : Set S} + (hD : IsClosedDisc D) (hC : IsPreconnected C) (hbd : Disjoint C (discBd D)) : + C ⊆ discInt D ∨ Disjoint C D := by + have hcover : C ⊆ discInt D ∪ Dᶜ := fun x hx => by + by_cases h : x ∈ D + · exact .inl ⟨h, Set.disjoint_left.mp hbd hx⟩ + · exact .inr h + have hdisj : Disjoint (discInt D) Dᶜ := Set.disjoint_left.mpr fun x hx hx' => hx' hx.1 + rcases hC.subset_or_subset (hD.isOpen_discInt hman) hD.isClosed.isOpen_compl hdisj hcover with h + | h + · exact .inl h + · exact .inr (Set.disjoint_left.mpr fun x hx hx' => h hx hx') + +/-- **A chord of a closed disc.** See the module docstring. -/ +theorem exists_disc_of_chord [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) {Y D : Set S} + (hDY : D ⊆ Y) (hD : IsClosedDisc D) + (H : ∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) + {ℓ : 𝕀 → S} (hℓ : IsArcMap ℓ) (hℓY : range ℓ ⊆ Y) (h0 : ℓ 0 ∈ discBd D) (h1 : ℓ 1 ∈ discBd D) + (hmeet : ∀ r, ℓ r ∈ D → r = 0 ∨ r = 1) : + ∃ D₁ : Set S, D₁ ⊆ Y ∧ IsClosedDisc D₁ ∧ D ⊆ D₁ ∧ range ℓ ⊆ D₁ ∧ + discBd D₁ ⊆ discBd D ∪ range ℓ := by + have hne : ℓ 0 ≠ ℓ 1 := fun h => zero_ne_one (hℓ.2 h) + obtain ⟨a, b, hab, ha0, ha1, hr⟩ := (hD.isOArc_discBd).exists_arcs h0 h1 hne + have hbdD : discBd D ⊆ D := discBd_subset D + have haD : range a ⊆ discBd D := hr ▸ subset_union_left + have hbD : range b ⊆ discBd D := hr ▸ subset_union_right + have hmeetℓ : ∀ s t, a s = ℓ t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + intro s t he + rcases hmeet t (hbdD (haD ⟨s, he⟩)) with rfl | rfl + · exact .inl ⟨hab.1.2 (by rw [he, ha0]), rfl⟩ + · exact .inr ⟨hab.1.2 (by rw [he, ha1]), rfl⟩ + have hO : IsOArc (range a ∪ range ℓ) := + oArc_of_two_arcs hab.1 hℓ ha0 ha1 hmeetℓ + have hsubY : range a ∪ range ℓ ⊆ Y := + union_subset (haD.trans (hbdD.trans hDY)) hℓY + obtain ⟨Δ, hΔY, hΔ, hΔb⟩ := H _ hsubY hO + have hsubΔ : range a ∪ range ℓ ⊆ Δ := hΔb ▸ discBd_subset Δ + -- the inside of `D` misses the boundary of `Δ` + have hdisj : Disjoint (discInt D) (discBd Δ) := by + rw [hΔb, Set.disjoint_left] + rintro x ⟨hx, hx'⟩ (⟨s, rfl⟩ | ⟨t, rfl⟩) + · exact hx' (haD ⟨s, rfl⟩) + · rcases hmeet t hx with rfl | rfl + · exact hx' h0 + · exact hx' h1 + rcases hΔ.side hman hD.isPreconnected_discInt hdisj with hin | hout + · refine ⟨Δ, hΔY, hΔ, ?_, subset_union_right.trans hsubΔ, ?_⟩ + · exact hD.subset_closure_discInt.trans + (closure_minimal (hin.trans (discInt_subset Δ)) hΔ.isClosed) + · rw [hΔb] + exact union_subset_union_left _ haD + -- the other arc of `D` lies outside `Δ` + have hbout : ∀ t, t ≠ 0 → t ≠ 1 → b t ∉ Δ := by + intro t ht0 ht1 hmem + have hbt : b t ∉ discBd Δ := by + rw [hΔb] + rintro (⟨s, hs⟩ | ⟨r, hr'⟩) + · rcases hab.5 s t hs with ⟨-, rfl⟩ | ⟨-, rfl⟩ + · exact ht0 rfl + · exact ht1 rfl + · have hbDt : b t ∈ D := hbdD (hbD ⟨t, rfl⟩) + rw [← hr'] at hbDt + rcases hmeet r hbDt with rfl | rfl + · apply ht0 + apply hab.2.2 + rw [← hr', hab.3, ha0] + · apply ht1 + apply hab.2.2 + rw [← hr', hab.4, ha1] + have hint : b t ∈ discInt Δ := ⟨hmem, hbt⟩ + have hbtcl : b t ∈ closure (discInt D) := hD.subset_closure_discInt (hbdD (hbD ⟨t, rfl⟩)) + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp hbtcl _ (hΔ.isOpen_discInt hman) hint + exact Set.disjoint_left.mp hout hw2 hw1.1 + have hinter : Δ ∩ D = range a := by + ext x + constructor + · rintro ⟨hx, hx'⟩ + by_cases hb : x ∈ discBd D + · rw [← hr] at hb + rcases hb with hb | ⟨t, rfl⟩ + · exact hb + · by_cases ht0 : t = 0 + · subst ht0 + exact ⟨0, hab.3.symm⟩ + by_cases ht1 : t = 1 + · subst ht1 + exact ⟨1, hab.4.symm⟩ + exact absurd hx (hbout t ht0 ht1) + · exact absurd hx (Set.disjoint_left.mp hout ⟨hx', hb⟩) + · intro hx + exact ⟨hsubΔ (.inl hx), hbdD (haD hx)⟩ + have hu := disc_union.{u} Δ D (range a) (a 0) (a 1) hΔ hD hab.1.isLineWithEnds hinter + (hΔb ▸ subset_union_left) haD + refine ⟨Δ ∪ D, union_subset hΔY hDY, hu.1, subset_union_right, ?_, ?_⟩ + · exact (subset_union_right.trans hsubΔ).trans subset_union_left + · rw [hu.2, hΔb] + rintro x ⟨(h | h) | h, -⟩ + · exact .inl (haD h) + · exact .inr h + · exact .inl h + +/-- **A closed disc swallows an `O`-arc.** Let `D ⊆ Y` be a closed disc and `P ⊆ Y` an `O`-arc that +meets `D` in at least two points, such that `P \ D` is a finite union of connected sets. Then some +closed disc of `Y` contains `D` and `P`. Each step adds one chord, and the chord removes at least +one of the connected sets. -/ +theorem exists_disc_cover [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) {Y P : Set S} + (H : ∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) + (hPY : P ⊆ Y) (hP : IsOArc P) {x y : S} (hx : x ∈ P) (hy : y ∈ P) (hxy : x ≠ y) + (n : ℕ) : ∀ (D : Set S) (F : Set (Set S)), D ⊆ Y → IsClosedDisc D → x ∈ D → y ∈ D → F.Finite → + F.ncard ≤ n → (∀ J ∈ F, IsPreconnected J) → ⋃₀ F = P \ D → + ∃ D' : Set S, D' ⊆ Y ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ P ⊆ D' := by + obtain ⟨φ⟩ := id hP + let j : Circle → S := fun w => (φ w).1 + have hjc : Continuous j := continuous_subtype_val.comp φ.continuous + have hji : Function.Injective j := fun _ _ h => φ.injective (Subtype.ext h) + have hjemb : IsEmbedding j := (hjc.isClosedEmbedding hji).isEmbedding + have hjr : range j = P := by + ext z + constructor + · rintro ⟨w, rfl⟩ + exact (φ w).2 + · intro hz + exact ⟨φ.symm ⟨z, hz⟩, by simp [j]⟩ + induction n with + | zero => + intro D F hDY hD hxD hyD hF hc h1 h2 + have hF0 : F = ∅ := (Set.ncard_eq_zero hF).mp (Nat.le_zero.mp hc) + rw [hF0, sUnion_empty] at h2 + exact ⟨D, hDY, hD, subset_rfl, sdiff_eq_empty.mp h2.symm⟩ + | succ n ih => + intro D F hDY hD hxD hyD hF hc h1 h2 + by_cases hsub : P ⊆ D + · exact ⟨D, hDY, hD, subset_rfl, hsub⟩ + obtain ⟨z, hzP, hzD⟩ := not_subset.mp hsub + rw [← hjr] at hzP + obtain ⟨z', rfl⟩ := hzP + have hx' : x ∈ range j := hjr ▸ hx + have hy' : y ∈ range j := hjr ▸ hy + obtain ⟨x', rfl⟩ := hx' + obtain ⟨y', rfl⟩ := hy' + have hT : IsClosed (j ⁻¹' D) := hD.isClosed.preimage hjc + obtain ⟨a, b, hab, hcov, ha0, ha1, hamid, hzr⟩ := exists_circle_chord hT (z := z') (x := x') + (y := y') hzD hxD hyD fun h => hxy (congrArg j h) + let ℓ : 𝕀 → S := fun r => j (a r) + have hℓ : IsArcMap ℓ := ⟨hjc.comp hab.1.1, hji.comp hab.1.2⟩ + have hℓP : range ℓ ⊆ P := by + rintro _ ⟨r, rfl⟩ + exact hjr ▸ mem_range_self _ + have hmeet : ∀ r, ℓ r ∈ D → r = 0 ∨ r = 1 := fun r hr => by + by_contra hcon + push Not at hcon + exact hamid r hcon.1 hcon.2 hr + have hbdend : ∀ r₀ : 𝕀, ℓ r₀ ∈ D → r₀ ∈ closure (Ioo (0 : 𝕀) 1) → ℓ r₀ ∈ discBd D := by + intro r₀ h3 h4 + by_contra hcon + have hopen := (hD.isOpen_discInt hman).preimage hℓ.1 + obtain ⟨r, hr1, hr2⟩ := mem_closure_iff.mp h4 _ hopen ⟨h3, hcon⟩ + rcases hmeet r hr1.1 with rfl | rfl + · exact lt_irrefl _ hr2.1 + · exact lt_irrefl _ hr2.2 + have hcl : closure (Ioo (0 : 𝕀) 1) = Icc 0 1 := closure_Ioo zero_ne_one + obtain ⟨D₁, hD₁Y, hD₁, hDD₁, hℓD₁, hbdD₁⟩ := exists_disc_of_chord hman hDY hD H hℓ + (hℓP.trans hPY) (hbdend 0 ha0 (hcl ▸ ⟨le_rfl, zero_le_one⟩)) + (hbdend 1 ha1 (hcl ▸ ⟨zero_le_one, le_rfl⟩)) hmeet + classical + let F₁ : Set (Set S) := {J ∈ F | Disjoint J D₁} + have hF₁sub : F₁ ⊆ F := fun J hJ => hJ.1 + have hF₁fin : F₁.Finite := hF.subset hF₁sub + obtain ⟨J₀, hJ₀, hzJ₀⟩ : j z' ∈ ⋃₀ F := by + rw [h2] + exact ⟨hjr ▸ mem_range_self _, hzD⟩ + have hzD₁ : j z' ∈ D₁ := by + obtain ⟨r, rfl⟩ := hzr + exact hℓD₁ ⟨r, rfl⟩ + have hJ₀F₁ : J₀ ∉ F₁ := fun h => Set.disjoint_left.mp h.2 hzJ₀ hzD₁ + have hcount : F₁.ncard ≤ n := by + have h5 : F₁.ncard < F.ncard := Set.ncard_lt_ncard + ⟨hF₁sub, fun h => hJ₀F₁ (h hJ₀)⟩ hF + omega + have hU : ⋃₀ F₁ = P \ D₁ := by + ext w + constructor + · rintro ⟨J, hJ, hw⟩ + have h6 : w ∈ P \ D := h2 ▸ mem_sUnion_of_mem hw hJ.1 + exact ⟨h6.1, fun h => Set.disjoint_left.mp hJ.2 hw h⟩ + · rintro ⟨hwP, hwD₁⟩ + have hwD : w ∉ D := fun h => hwD₁ (hDD₁ h) + obtain ⟨J, hJ, hwJ⟩ : w ∈ ⋃₀ F := by + rw [h2] + exact ⟨hwP, hwD⟩ + have hJP : J ⊆ P \ D := by + rw [← h2] + exact subset_sUnion_of_mem hJ + refine ⟨J, ⟨hJ, ?_⟩, hwJ⟩ + have hJ'p : IsPreconnected (j ⁻¹' J) := by + rw [← hjemb.isInducing.isPreconnected_image, + image_preimage_eq_of_subset (by rw [hjr]; exact hJP.trans sdiff_subset)] + exact h1 J hJ + have hJℓ : Disjoint J (range ℓ) := by + rw [Set.disjoint_left] + rintro v hv ⟨r, rfl⟩ + have hvend : r ≠ 0 ∧ r ≠ 1 := by + constructor + · rintro rfl + exact (hJP hv).2 ha0 + · rintro rfl + exact (hJP hv).2 ha1 + have hw' : w ∈ range j := hjr ▸ hwP + obtain ⟨w', rfl⟩ := hw' + have hsep := hJ'p (range b)ᶜ (range a)ᶜ (isCompact_range hab.2.1).isClosed.isOpen_compl + (isCompact_range hab.1.1).isClosed.isOpen_compl ?_ ?_ ?_ + · obtain ⟨u, -, h7, h8⟩ := hsep + have : u ∈ range a ∪ range b := hcov ▸ mem_univ u + exact this.elim h8 h7 + · intro u hu + by_cases hua : u ∈ range a + · refine .inl ?_ + obtain ⟨s, rfl⟩ := hua + rintro ⟨t, ht⟩ + have hs01 : s ≠ 0 ∧ s ≠ 1 := by + constructor + · rintro rfl + exact (hJP hu).2 ha0 + · rintro rfl + exact (hJP hu).2 ha1 + rcases hab.5 s t ht.symm with ⟨h9, -⟩ | ⟨h9, -⟩ + · exact hs01.1 h9 + · exact hs01.2 h9 + · exact .inr hua + · refine ⟨a r, hv, ?_⟩ + rintro ⟨t, ht⟩ + rcases hab.5 r t ht.symm with ⟨h9, -⟩ | ⟨h9, -⟩ + · exact hvend.1 h9 + · exact hvend.2 h9 + · refine ⟨w', hwJ, ?_⟩ + rintro ⟨t, ht⟩ + exact hwD₁ (hℓD₁ ⟨t, by change j (a t) = j w'; rw [ht]⟩) + have hJbd : Disjoint J (discBd D₁) := by + rw [Set.disjoint_left] + intro v hv hv' + rcases hbdD₁ hv' with h7 | h7 + · exact (hJP hv).2 (discBd_subset D h7) + · exact Set.disjoint_left.mp hJℓ hv h7 + rcases hD₁.side hman (h1 J hJ) hJbd with h7 | h7 + · exact absurd (h7 hwJ).1 hwD₁ + · exact h7 + obtain ⟨D', h3, h4, h5, h6⟩ := ih D₁ F₁ hD₁Y hD₁ (hDD₁ hxD) (hDD₁ hyD) hF₁fin hcount + (fun J hJ => h1 J hJ.1) hU + exact ⟨D', h3, h4, hDD₁.trans h5, h6⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/DiscMatch.lean b/LeanPool/GraphMinor/Surface/DiscMatch.lean new file mode 100644 index 0000000000..48adefb78d --- /dev/null +++ b/LeanPool/GraphMinor/Surface/DiscMatch.lean @@ -0,0 +1,323 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collar +public import LeanPool.GraphMinor.Surface.DiscTwist +public import LeanPool.GraphMinor.Surface.JoinedCollar +public import LeanPool.GraphMinor.GM12.Section4DiscCompression +public import LeanPool.GraphMinor.GM12.Section4DiscEnlargement +public import LeanPool.GraphMinor.GM12.Section4ProtectedMotion +public import LeanPool.GraphMinor.GM12.Section4RadialResize +import LeanPool.GraphMinor.Surface.PushOff + +/-! +# Matching nested discs and adjusting boundary points + +XII (4.3), claim (7), page 251, uses a homeomorphism carrying the +source edge neighborhoods to their prescribed discs. For three +nested discs, join the two collars into one coordinate map and +change the radius to carry the inner disc onto the middle disc. +The resulting homeomorphism fixes the exterior of the outer disc. +A second construction extends an orientation preserving circle map +across a collar, preserving the middle disc and fixing the exterior. + +-/ + +public section + +namespace GraphMinor.Surface + +open Set Metric Topology GraphMinor.GM12 +open scoped Pointwise + +variable {S : Type*} [TopologicalSpace S] [T2Space S] + +/-- A continuous injective map on a compact set has a continuous inverse on its image. -/ +private theorem exists_inverse_on {K : Set ℂ} (hK : IsCompact K) {c : ℂ → S} + (hc : ContinuousOn c K) (hi : InjOn c K) : + ∃ c' : S → ℂ, ContinuousOn c' (c '' K) ∧ MapsTo c' (c '' K) K ∧ LeftInvOn c' c K + ∧ RightInvOn c' c (c '' K) := by + classical + have : CompactSpace K := isCompact_iff_compactSpace.mp hK + let f : K → S := K.domRestrict c + have hf : Continuous f := continuousOn_iff_continuous_domRestrict.mp hc + have hfi : Function.Injective f := fun a b he => Subtype.ext (hi a.2 b.2 he) + have hem := hf.isClosedEmbedding hfi + let e : K ≃ₜ range f := hem.isEmbedding.toHomeomorph + have hrange : range f = c '' K := by + ext x + constructor + · rintro ⟨z, rfl⟩ + exact ⟨z.1, z.2, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + exact ⟨⟨z, hz⟩, rfl⟩ + let c' : S → ℂ := fun x => if hx : x ∈ range f then (e.symm ⟨x, hx⟩).1 else 0 + have hval : ∀ z (hz : z ∈ K), c' (c z) = z := fun z hz => by + have hx : c z ∈ range f := ⟨⟨z, hz⟩, rfl⟩ + change (if hx : c z ∈ range f then (e.symm ⟨c z, hx⟩).1 else 0) = z + rw [dite_eq_left hx] + have : (⟨c z, hx⟩ : range f) = e ⟨z, hz⟩ := rfl + rw [this, e.symm_apply_apply] + refine ⟨c', ?_, ?_, fun z hz => hval z hz, ?_⟩ + · rw [← hrange, continuousOn_iff_continuous_domRestrict] + have : (range f).domRestrict c' = fun x : range f => (e.symm x).1 := by + funext x + change (if hx : x.1 ∈ range f then (e.symm ⟨x.1, hx⟩).1 else 0) = _ + rw [dite_eq_left x.2] + rw [this] + exact continuous_subtype_val.comp e.symm.continuous + · rintro _ ⟨z, hz, rfl⟩ + rw [hval z hz] + exact hz + · rintro _ ⟨z, hz, rfl⟩ + show c (c' (c z)) = c z + rw [hval z hz] + +/-- If `A` lies inside `B` and `B` inside `E`, a homeomorphism of the surface that is the identity +off `E` carries `A` onto `B`. We join a collar of `A` in `B` with a collar of `B` in `E`, and change +the radius. -/ +theorem exists_disc_onto_nested (hman : ∀ x : S, IsManifoldPoint x) {A B E : Set S} + (hA : IsClosedDisc A) (hB : IsClosedDisc B) (hE : IsClosedDisc E) (hAB : A ⊆ B \ discBd B) + (hBE : B ⊆ E \ discBd E) : + ∃ e : S ≃ₜ S, e '' A = B ∧ ∀ x, x ∉ E → e x = x := by + obtain ⟨pA⟩ := hA.isOArc_discBd + obtain ⟨c₁, c₁', hcc₁, -, hm₁, hm₁', hl₁, hr₁, hin₁, hs₁, -⟩ := exists_disc_collar hA hB hAB pA + have hi₁ : InjOn c₁ (closedBall 0 2) := hl₁.injOn + have hB₁ : c₁ '' closedBall 0 2 = B := + (hm₁.image_subset).antisymm fun x hx => ⟨_, hm₁' hx, hr₁ hx⟩ + -- The outer circle of the first collar parametrizes `bd B`. + have hS2 : ∀ w : Circle, ((2 : ℝ) : ℂ) * w ∈ sphere (0 : ℂ) 2 := fun w => by + rw [mem_sphere_zero_iff_norm, norm_mul, Circle.norm_coe, Complex.norm_real] + norm_num + let u : Circle → discBd B := fun w => ⟨c₁ (((2 : ℝ) : ℂ) * w), by + rw [← hs₁] + exact mem_image_of_mem c₁ (hS2 w)⟩ + have huc : Continuous u := by + refine Continuous.subtype_mk (hcc₁.comp_continuous (by + exact continuous_const.mul continuous_induced_dom) fun w => sphere_subset_closedBall + (hS2 w)) _ + have hui : Function.Injective u := fun w w' he => by + have h1 := hi₁ (sphere_subset_closedBall (hS2 w)) (sphere_subset_closedBall (hS2 w')) + (congrArg Subtype.val he) + exact Circle.ext (mul_left_cancel₀ (by norm_num) h1) + have hus : Function.Surjective u := fun x => by + obtain ⟨z, hz, he⟩ : x.1 ∈ c₁ '' sphere 0 2 := by rw [hs₁]; exact x.2 + have hzn : ‖z‖ = 2 := mem_sphere_zero_iff_norm.mp hz + have hz0 : z ≠ 0 := fun h => by simp [h] at hzn + refine ⟨unitOf z hz0, Subtype.ext ?_⟩ + change c₁ (((2 : ℝ) : ℂ) * unitOf z hz0) = x.1 + rw [← hzn, norm_mul_unitOf, he] + let pB : Circle ≃ₜ discBd B := huc.homeoOfEquivCompactToT2 (f := Equiv.ofBijective u ⟨hui, hus⟩) + have hpB : ∀ w : Circle, (pB w).1 = c₁ (((2 : ℝ) : ℂ) * w) := fun _ => rfl + obtain ⟨c₂, c₂', hcc₂, -, hm₂, hm₂', hl₂, hr₂, hin₂, hs₂, hp₂⟩ := exists_disc_collar hB hE hBE pB + have hi₂ : InjOn c₂ (closedBall 0 2) := hl₂.injOn + have hE₂ : c₂ '' closedBall 0 2 = E := + (hm₂.image_subset).antisymm fun x hx => ⟨_, hm₂' hx, hr₂ hx⟩ + have hcompat : ∀ z : ℂ, ‖z‖ = 2 → c₁ z = c₂ (collarOuterStep z) := by + intro z hzn + have hz0 : z ≠ 0 := fun h => by simp [h] at hzn + have h1 : collarOuterStep z = (unitOf z hz0 : ℂ) := by + rw [collarOuterStep_two hzn, coe_unitOf, hzn, Complex.real_smul] + push_cast + ring + rw [h1, hp₂, hpB, ← hzn, norm_mul_unitOf] + obtain ⟨c, hcc, hci, hcA, hcB, hcE, hcs⟩ := exists_joined_collar_coordinates c₁ c₂ hcc₁ hi₁ hcc₂ + hi₂ hin₁ hB₁ hin₂ hE₂ hs₂ hcompat + let sc : ℂ → ℂ := fun z => (3 / 2 : ℝ) • z + have hsc : Continuous sc := by fun_prop + have hsci : Function.Injective sc := smul_right_injective ℂ (by norm_num) + have hball : ∀ r : ℝ, sc '' closedBall 0 r = closedBall 0 (3 / 2 * r) := fun r => by + change (3 / 2 : ℝ) • closedBall (0 : ℂ) r = _ + have := _root_.smul_closedBall' (by norm_num : (3 / 2 : ℝ) ≠ 0) (0 : ℂ) r + simpa only [smul_zero, Real.norm_eq_abs, abs_of_pos (by norm_num : (0 : ℝ) < 3 / 2)] using this + have hsph : sc '' sphere 0 2 = sphere 0 3 := by + change (3 / 2 : ℝ) • sphere (0 : ℂ) 2 = _ + have := _root_.smul_sphere' (by norm_num : (3 / 2 : ℝ) ≠ 0) (0 : ℂ) 2 + have h2 : |(3 / 2 : ℝ)| * 2 = 3 := by rw [abs_of_pos (by norm_num)]; norm_num + simpa only [smul_zero, Real.norm_eq_abs, h2] using this + let d : ℂ → S := fun z => c (sc z) + have hsub : MapsTo sc (closedBall 0 2) (closedBall 0 3) := fun z hz => by + have : sc z ∈ sc '' closedBall 0 2 := mem_image_of_mem sc hz + rw [hball 2] at this + convert this using 2 + norm_num + have hdc : ContinuousOn d (closedBall 0 2) := hcc.comp hsc.continuousOn hsub + have hdi : InjOn d (closedBall 0 2) := fun z hz w hw he => hsci (hci (hsub hz) (hsub hw) he) + have hdimg : ∀ r r' : ℝ, 3 / 2 * r = r' → d '' closedBall 0 r = c '' closedBall 0 r' + := fun r r' he => by + rw [← he, ← hball r, image_image] + have hdE : d '' closedBall 0 2 = E := by + rw [hdimg 2 3 (by norm_num), hcE] + have hdA : d '' closedBall 0 (2 / 3) = A := by + rw [hdimg (2 / 3) 1 (by norm_num), hcA] + have hdB : d '' closedBall 0 (4 / 3) = B := by + rw [hdimg (4 / 3) 2 (by norm_num), hcB] + have hds : d '' sphere 0 2 = discBd E := by + rw [← hcs, ← hsph, image_image] + obtain ⟨d', hdc', hdm', hdl, hdr⟩ := exists_inverse_on (isCompact_closedBall 0 2) hdc hdi + rw [hdE] at hdc' hdm' hdr + have hdm : MapsTo d (closedBall 0 2) E := fun z hz => hdE ▸ mem_image_of_mem d hz + obtain ⟨Θ, hΘfix, -, hΘball⟩ := exists_radial_disc_resize + (show (0 : ℝ) < 2 / 3 by norm_num) (show (2 / 3 : ℝ) < 3 / 2 by norm_num) (show + (0 : ℝ) < 4 / 3 by norm_num) (show (4 / 3 : ℝ) < 3 / 2 by norm_num) + obtain ⟨e, hec, hefix⟩ := exists_homeomorph_of_collar hman hE hdc hdc' hdm hdm' hdl hdr hds Θ + hΘfix + refine ⟨e, ?_, hefix⟩ + rw [← hdA, image_image, ← hdB, ← hΘball, image_image] + exact image_congr fun z hz => hec z (closedBall_subset_closedBall (by norm_num) hz) + +/-- A twist of a collar of `B` in `E`. It keeps `B`, it is the identity off `E`, and on `bd B` it +acts by a chosen homeomorphism of the circle that keeps the orientation. -/ +theorem exists_boundary_twist (hman : ∀ x : S, IsManifoldPoint x) {B E : Set S} + (hB : IsClosedDisc B) (hE : IsClosedDisc E) (hBE : B ⊆ E \ discBd E) (p : Circle ≃ₜ discBd B) + {h : Circle ≃ₜ Circle} (hh : PreservesCircleOrientation h) : + ∃ e : S ≃ₜ S, e '' B = B ∧ (∀ w, e (p w).1 = (p (h w)).1) ∧ ∀ x, x ∉ E → e x = x := by + obtain ⟨c, c', hcc, hcc', hm, hm', hl, hr, hin, hs, hp⟩ := exists_disc_collar hB hE hBE p + obtain ⟨Θ, hΘfix, hΘn, hΘc⟩ := exists_twist hh + obtain ⟨e, hec, hefix⟩ := exists_homeomorph_of_collar hman hE hcc hcc' hm hm' hl hr hs Θ hΘfix + have hΘb : Θ '' closedBall 0 1 = closedBall 0 1 := by + ext z + constructor + · rintro ⟨w, hw, rfl⟩ + rw [mem_closedBall_zero_iff, hΘn] + exact mem_closedBall_zero_iff.mp hw + · intro hz + refine ⟨Θ.symm z, ?_, Θ.apply_symm_apply z⟩ + rw [mem_closedBall_zero_iff, ← hΘn, Θ.apply_symm_apply] + exact mem_closedBall_zero_iff.mp hz + have hsub : closedBall (0 : ℂ) 1 ⊆ closedBall 0 2 := closedBall_subset_closedBall (by norm_num) + refine ⟨e, ?_, fun w => ?_, hefix⟩ + · rw [← hin, image_image] + conv_rhs => rw [← hΘb, image_image] + exact image_congr fun z hz => hec z (hsub hz) + · have hw : (w : ℂ) ∈ closedBall (0 : ℂ) 2 := by + rw [mem_closedBall_zero_iff, Circle.norm_coe] + norm_num + rw [← hp, hec _ hw, hΘc, hp] + +/-- **Matching one disc.** Let `A` and `A'` be closed discs that miss the protected discs `P`. A +homeomorphism of the surface that fixes the protected discs carries `A` onto `A'`, and it can be +asked to put a chosen pair of points of `bd(A)` on a chosen pair of points of `bd(A')`. -/ +theorem exists_disc_match [ConnectedSpace S] {ι : Type*} [Finite ι] (hS : IsClosedSurface S) (P : ι + → Set S) (hP : ∀ i, IsClosedDisc (P i)) (hPP : Pairwise fun i j => Disjoint (P i) (P j)) + {A A' : Set S} (hA : IsClosedDisc A) (hA' : IsClosedDisc A') (hAP : Disjoint A (⋃ i, P i)) + (hAP' : Disjoint A' (⋃ i, P i)) : + ∃ e : S ≃ₜ S, e '' A = A' ∧ ∀ i, ∀ z ∈ P i, e z = z := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hS.2.2 x).isManifoldPoint + have hBc : IsClosed (⋃ i, P i) := isClosed_iUnion_of_finite fun i => (hP i).isClosed + obtain ⟨p, hpA, hcomp⟩ := exists_disc_compression_center hS hA hBc hAP + obtain ⟨p', hp'⟩ := hA'.nonempty_discInt + have hpn : p ∉ ⋃ i, P i := fun h => Set.disjoint_left.mp hAP hpA h + have hp'n : p' ∉ ⋃ i, P i := fun h => Set.disjoint_left.mp hAP' hp'.1 h + obtain ⟨e₁, he₁, hfix₁⟩ := exists_point_motion_fixing_discs hS P hP hPP hpn hp'n + have hU : IsOpen (e₁ ⁻¹' discInt A') := (hA'.isOpen_discInt hman).preimage e₁.continuous + obtain ⟨e₂, he₂, -, hfix₂⟩ := hcomp _ hU (by rw [mem_preimage, he₁]; exact hp') + obtain ⟨E, hE, hsub, hEP⟩ := exists_disc_enlargement_avoiding hS hA' hBc hAP' + let A₁ : Set S := e₁ '' (e₂ '' A) + have hA₁in : A₁ ⊆ A' \ discBd A' := by + rintro _ ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + exact he₂ ⟨x, hx, rfl⟩ + have hdisc : ∀ (f : S ≃ₜ S) {D : Set S}, IsClosedDisc D → IsClosedDisc (f '' D) := fun f D hD => + (hD.image f.continuous.continuousOn f.symm.continuous.continuousOn fun _ _ + => f.symm_apply_apply _).1 + obtain ⟨e₃, he₃, hfix₃⟩ := exists_disc_onto_nested hman (hdisc e₁ (hdisc e₂ hA)) hA' hE hA₁in hsub + refine ⟨(e₂.trans e₁).trans e₃, ?_, fun i z hz => ?_⟩ + · rw [← he₃] + change (fun x => e₃ (e₁ (e₂ x))) '' A = e₃ '' (e₁ '' (e₂ '' A)) + simp only [image_image] + · have hzU : z ∈ ⋃ i, P i := mem_iUnion.mpr ⟨i, hz⟩ + change e₃ (e₁ (e₂ z)) = z + rw [hfix₂ z hzU, hfix₁ i z hz, hfix₃ z fun h => Set.disjoint_left.mp hEP h hzU] + +/-- **Matching a family of discs.** A homeomorphism of the surface carries each disc of one family +onto the disc with the same index in another family, and fixes the protected discs. -/ +theorem exists_disc_family_match [ConnectedSpace S] {κ : Type*} [Finite κ] (hS : IsClosedSurface S) + (Q : κ → Set S) (hQ : ∀ i, IsClosedDisc (Q i)) (hQQ : Pairwise fun i j => Disjoint (Q i) (Q j)) + {t : ℕ} (A A' : Fin t → Set S) (hA : ∀ i, IsClosedDisc (A i)) (hA' : ∀ i, IsClosedDisc (A' i)) + (hAA : Pairwise fun i j => Disjoint (A i) (A j)) (hAA' : Pairwise fun i j => Disjoint (A' i) + (A' j)) + (hAQ : ∀ i k, Disjoint (A i) (Q k)) (hAQ' : ∀ i k, Disjoint (A' i) (Q k)) : + ∃ e : S ≃ₜ S, (∀ i, e '' A i = A' i) ∧ ∀ k, ∀ z ∈ Q k, e z = z := by + classical + have hdisc : ∀ (f : S ≃ₜ S) {D : Set S}, IsClosedDisc D → IsClosedDisc (f '' D) := fun f D hD => + (hD.image f.continuous.continuousOn f.symm.continuous.continuousOn fun _ _ + => f.symm_apply_apply _).1 + suffices H : ∀ n ≤ t, ∃ e : S ≃ₜ S, (∀ i : Fin t, i.1 < n → e '' A i = A' i) + ∧ ∀ k, ∀ z ∈ Q k, e z = z by + obtain ⟨e, h1, h2⟩ := H t le_rfl + exact ⟨e, fun i => h1 i i.2, h2⟩ + intro n + induction n with + | zero => exact fun _ => ⟨Homeomorph.refl S, fun i h => absurd h (Nat.not_lt_zero _), fun _ _ _ + => rfl⟩ + | succ n ih => + intro hn + obtain ⟨e, h1, h2⟩ := ih (by omega) + let m : Fin t := ⟨n, by omega⟩ + let ι := κ ⊕ {i : Fin t // i.1 < n} + let P : ι → Set S := fun x => match x with + | .inl k => Q k + | .inr i => A' i.1 + have hP : ∀ i, IsClosedDisc (P i) := by + rintro (k | i) + · exact hQ k + · exact hA' i.1 + have hPP : Pairwise fun i j => Disjoint (P i) (P j) := by + rintro (k | i) (l | j) hne + · exact hQQ fun h => hne (by rw [h]) + · exact (hAQ' j.1 k).symm + · exact hAQ' i.1 l + · exact hAA' fun h => hne (by rw [Subtype.ext h]) + have hmA : Disjoint (e '' A m) (⋃ i, P i) := by + refine Set.disjoint_iUnion_right.mpr ?_ + rintro (k | i) + · refine Set.disjoint_left.mpr ?_ + rintro _ ⟨x, hx, rfl⟩ hy + have hx' : x ∈ Q k := by + have : x = e x := (e.injective (h2 k (e x) hy)).symm + exact this ▸ hy + exact Set.disjoint_left.mp (hAQ m k) hx hx' + · change Disjoint (e '' A m) (A' i.1) + rw [← h1 i.1 i.2] + refine (Set.disjoint_image_iff e.injective).mpr (hAA fun h => ?_) + have := congrArg Fin.val h + have hi := i.2 + simp only [m] at this + omega + have hmA' : Disjoint (A' m) (⋃ i, P i) := by + refine Set.disjoint_iUnion_right.mpr ?_ + rintro (k | i) + · exact hAQ' m k + · refine hAA' fun h => ?_ + have := congrArg Fin.val h + have hi := i.2 + simp only [m] at this + omega + obtain ⟨e', he', hfix⟩ := exists_disc_match hS P hP hPP (hdisc e (hA m)) (hA' m) hmA hmA' + refine ⟨e.trans e', fun i hi => ?_, fun k z hz => ?_⟩ + · by_cases him : i.1 < n + · change (fun x => e' (e x)) '' A i = _ + rw [← image_image (g := e') (f := e), h1 i him] + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + rw [hfix (.inr ⟨i, him⟩) y hy] + exact hy + · intro hx + exact ⟨x, hx, hfix (.inr ⟨i, him⟩) x hx⟩ + · have him' : i = m := Fin.ext (by simp only [m]; omega) + rw [him'] + change (fun x => e' (e x)) '' A m = _ + rw [← image_image (g := e') (f := e), he'] + · change e' (e z) = z + rw [h2 k z hz] + exact hfix (.inl k) z hz + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/DiscMerge.lean b/LeanPool/GraphMinor/Surface/DiscMerge.lean new file mode 100644 index 0000000000..568176ba09 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/DiscMerge.lean @@ -0,0 +1,876 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscGrow +public import LeanPool.GraphMinor.Surface.Jordan +public import Mathlib.Topology.Metrizable.Urysohn +public import Mathlib.Analysis.Real.Pi.Bounds + +/-! +# Merging a closed disc with a chart + +Let `Y` be a set of a closed surface in which every `O`-arc bounds a closed disc. +`exists_disc_merge` +says that a closed disc of `Y` and a round disc of a chart in `Y` that overlap lie in a common +closed +disc of `Y`, unless `Y` is a whole sphere. + +The round circle of the chart meets the boundary of the disc in a wild way, so `exists_tame_pair` +first moves it a little. The new curve still goes around the centre of the chart, since a logarithm +of the coordinate on it would give two different values for the rise of the angle along its two +arcs (`not_hasLogOn_of_two_sides`). Now `exists_disc_cover` swallows the curve. + +The file also shows that an `O`-arc has empty interior in a surface, and that a surface is +metrizable. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +local notation "𝕀" => unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The plane does not embed in the circle: a logarithm of the map would be an injective continuous +real function. -/ +theorem not_injective_circle {j : ℂ → Circle} (hj : Continuous j) : ¬ Function.Injective j := by + intro hinj + obtain ⟨g, hg, hfg⟩ := hasLogOn_univ_of_ne_zero (f := fun z => ((j z : Circle) : ℂ)) + (by fun_prop) (fun z => Circle.coe_ne_zero _) + have hgc : Continuous g := continuousOn_univ.mp hg + refine not_injective_real (f := fun z => (g z).im) (by fun_prop) fun x y hxy => ?_ + have hre : ∀ z, (g z).re = 0 := by + intro z + have h1 : ‖((j z : Circle) : ℂ)‖ = 1 := Circle.norm_coe _ + have h2 : ((j z : Circle) : ℂ) = Complex.exp (g z) := hfg z (mem_univ _) + rw [h2, Complex.norm_exp] at h1 + simpa using h1 + have hgg : g x = g y := Complex.ext (by rw [hre, hre]) hxy + refine hinj (Circle.ext ?_) + have h2 : ((j x : Circle) : ℂ) = Complex.exp (g x) := hfg x (mem_univ _) + have h3 : ((j y : Circle) : ℂ) = Complex.exp (g y) := hfg y (mem_univ _) + rw [h2, h3, hgg] + +/-- An `O`-arc contains no embedded open ball of the plane. -/ +theorem not_image_ball_subset_oArc {G : Set S} (hG : IsOArc G) {w : ℂ} {ρ : ℝ} (hρ : 0 < ρ) + {g : ℂ → S} (hgc : ContinuousOn g (ball w ρ)) (hgi : InjOn g (ball w ρ)) : + ¬ g '' ball w ρ ⊆ G := by + intro hsub + obtain ⟨φ⟩ := hG + let k : ℂ → ℂ := fun z => w + ((ρ / (1 + ‖z‖) : ℝ) : ℂ) * z + have hkc : Continuous k := by + refine continuous_const.add (Continuous.mul ?_ continuous_id) + refine Complex.continuous_ofReal.comp (continuous_const.div (by fun_prop) fun z => ?_) + positivity + have hkm : ∀ z, k z ∈ ball w ρ := fun z => by + rw [mem_ball, dist_eq_norm] + simp only [k, add_sub_cancel_left, norm_mul, Complex.norm_real, Real.norm_eq_abs] + rw [abs_of_nonneg (by positivity), div_mul_eq_mul_div, div_lt_iff₀ (by positivity)] + nlinarith [norm_nonneg z] + have hki : Function.Injective k := by + intro z z' he + have h1 : ((ρ / (1 + ‖z‖) : ℝ) : ℂ) * z = ((ρ / (1 + ‖z'‖) : ℝ) : ℂ) * z' := + add_left_cancel he + have h2 := congrArg norm h1 + simp only [norm_mul, Complex.norm_real, Real.norm_eq_abs] at h2 + rw [abs_of_nonneg (by positivity), abs_of_nonneg (by positivity), div_mul_eq_mul_div, + div_mul_eq_mul_div, div_eq_div_iff (by positivity) (by positivity)] at h2 + have h3 : ‖z‖ = ‖z'‖ := by + have h4 : ρ * (‖z‖ - ‖z'‖) = 0 := by linarith + have := (mul_eq_zero.mp h4).resolve_left hρ.ne' + linarith + rw [h3] at h1 + have h5 : ((ρ / (1 + ‖z'‖) : ℝ) : ℂ) ≠ 0 := by + have : ρ / (1 + ‖z'‖) ≠ 0 := by positivity + exact_mod_cast this + exact mul_left_cancel₀ h5 h1 + let j : ℂ → Circle := fun z => φ.symm ⟨g (k z), hsub ⟨_, hkm z, rfl⟩⟩ + refine not_injective_circle (j := j) ?_ ?_ + · refine φ.symm.continuous.comp (Continuous.subtype_mk ?_ _) + exact hgc.comp_continuous hkc hkm + · intro z z' he + have h1 := congrArg Subtype.val (φ.symm.injective he) + exact hki (hgi (hkm z) (hkm z') h1) + +/-- A compact 2-manifold is second countable. -/ +theorem secondCountable_of_manifold [CompactSpace S] (hman : ∀ x : S, IsManifoldPoint x) : + SecondCountableTopology S := by + choose U V hU hV hx he using hman + obtain ⟨t, ht⟩ := isCompact_univ.elim_finite_subcover U hU fun x _ => mem_iUnion.mpr ⟨x, hx x⟩ + have hsc : ∀ i : t, SecondCountableTopology (U i.1) := fun i => by + obtain ⟨e⟩ := he i.1 + have : SecondCountableTopology (EuclideanHalfSpace 2) := + inferInstanceAs (SecondCountableTopology {x : EuclideanSpace ℝ (Fin 2) // 0 ≤ x 0}) + exact e.secondCountableTopology + refine @TopologicalSpace.secondCountableTopology_of_countable_cover S _ t _ (fun i => U i.1) hsc + (fun i => hU i.1) ?_ + rw [eq_univ_iff_forall] + intro x + obtain ⟨i, hi⟩ := mem_iUnion.mp (ht (mem_univ x)) + obtain ⟨hi', hxi⟩ := mem_iUnion.mp hi + exact mem_iUnion.mpr ⟨⟨i, hi'⟩, hxi⟩ + +/-- Coordinates on an open subset of a surface, onto the ball of radius `R`. -/ +structure BallChart (R : ℝ) (U : Set S) (h : S → ℂ) (g : ℂ → S) : Prop where + isOpen : IsOpen U + hc : ContinuousOn h U + gc : ContinuousOn g (ball 0 R) + hm : MapsTo h U (ball 0 R) + gm : MapsTo g (ball 0 R) U + gh : LeftInvOn g h U + hg : LeftInvOn h g (ball 0 R) + +namespace BallChart + +variable {R : ℝ} {U : Set S} {h : S → ℂ} {g : ℂ → S} + +theorem isOpen_image (c : BallChart R U h g) {V : Set ℂ} (hV : IsOpen V) (hsub : V ⊆ ball 0 R) : + IsOpen (g '' V) := by + have : g '' V = U ∩ h ⁻¹' V := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + refine ⟨c.gm (hsub hz), ?_⟩ + change h (g z) ∈ V + rwa [c.hg (hsub hz)] + · rintro ⟨h1, h2⟩ + exact ⟨h x, h2, c.gh h1⟩ + rw [this] + exact c.hc.isOpen_inter_preimage c.isOpen hV + +/-- The same chart, turned by `u`. -/ +theorem rotate (c : BallChart R U h g) (u : Circle) : + BallChart R U (fun x => (u⁻¹ : Circle) * h x) (fun z => g ((u : ℂ) * z)) := by + have hmem : ∀ z : ℂ, z ∈ ball (0 : ℂ) R → (u : ℂ) * z ∈ ball (0 : ℂ) R := fun z hz => by + simpa [norm_mul] using hz + have hmem' : ∀ z : ℂ, z ∈ ball (0 : ℂ) R → ((u⁻¹ : Circle) : ℂ) * z ∈ ball (0 : ℂ) R := + fun z hz => by simpa [norm_mul] using hz + have hcan : ∀ z : ℂ, (u : ℂ) * (((u⁻¹ : Circle) : ℂ) * z) = z := fun z => by + rw [← mul_assoc, ← Circle.coe_mul] + simp + have hcan' : ∀ z : ℂ, ((u⁻¹ : Circle) : ℂ) * ((u : ℂ) * z) = z := fun z => by + rw [← mul_assoc, ← Circle.coe_mul] + simp + refine ⟨c.isOpen, ContinuousOn.mul continuousOn_const c.hc, ?_, ?_, ?_, ?_, ?_⟩ + · exact c.gc.comp (by fun_prop) hmem + · exact fun x hx => hmem' _ (c.hm hx) + · exact fun z hz => c.gm (hmem z hz) + · intro x hx + change g ((u : ℂ) * (((u⁻¹ : Circle) : ℂ) * h x)) = x + rw [hcan, c.gh hx] + · intro z hz + change ((u⁻¹ : Circle) : ℂ) * h (g ((u : ℂ) * z)) = z + rw [c.hg (hmem z hz), hcan'] + +/-- A closed subset of the chart ball that is a closed disc gives a closed disc. -/ +theorem image_disc (c : BallChart R U h g) {Z : Set ℂ} (hZ : IsClosedDisc Z) (hsub : Z ⊆ ball 0 R) : + IsClosedDisc (g '' Z) ∧ discBd (g '' Z) = g '' discBd Z := + hZ.image (c.gc.mono hsub) (c.hc.mono (image_subset_iff.mpr fun _ hz => c.gm (hsub hz))) + (c.hg.mono hsub) + +end BallChart + +/-- Every interior point has a chart inside any open set, with the point at the centre. -/ +theorem IsInteriorPoint.exists_ballChart {y : S} (hy : IsInteriorPoint y) {W : Set S} + (hW : IsOpen W) (hyW : y ∈ W) {R : ℝ} (hR : 0 < R) : + ∃ U h g, BallChart R U h g ∧ U ⊆ W ∧ g 0 = y := by + obtain ⟨U₀, hU₀, hyU, hsub, ⟨f⟩⟩ := hy.exists_subset hW hyW + obtain ⟨b⟩ := exists_homeomorph_ball (0 : ℂ) one_pos + have : Nonempty S := ⟨y⟩ + obtain ⟨h₀, g₀, h1, h2, h3, h4, h5, h6⟩ := exists_functions_of_homeomorph (f.trans b.symm) + obtain ⟨ρ, hρ, hball⟩ := Metric.isOpen_iff.mp isOpen_ball _ (h3 hyU) + set c := h₀ y with hc + have hscale : ((ρ / R : ℝ) : ℂ) ≠ 0 := by + have : ρ / R ≠ 0 := by positivity + exact_mod_cast this + let e : ℂ → ℂ := fun z => c + ((ρ / R : ℝ) : ℂ) * z + let e' : ℂ → ℂ := fun z => ((R / ρ : ℝ) : ℂ) * (z - c) + have hee' : ∀ z, e (e' z) = z := fun z => by + simp only [e, e'] + rw [← mul_assoc, ← Complex.ofReal_mul, div_mul_div_comm, mul_comm ρ R, div_self (by positivity)] + simp + have he'e : ∀ z, e' (e z) = z := fun z => by + simp only [e, e', add_sub_cancel_left] + rw [← mul_assoc, ← Complex.ofReal_mul, div_mul_div_comm, mul_comm R ρ, div_self (by positivity)] + simp + have hem : ∀ z ∈ ball (0 : ℂ) R, e z ∈ ball c ρ := fun z hz => by + rw [mem_ball, dist_eq_norm] + simp only [e, add_sub_cancel_left, norm_mul, Complex.norm_real, Real.norm_eq_abs] + rw [abs_of_pos (by positivity), div_mul_eq_mul_div, div_lt_iff₀ hR] + have : ‖z‖ < R := mem_ball_zero_iff.mp hz + nlinarith + have he'm : ∀ z ∈ ball c ρ, e' z ∈ ball (0 : ℂ) R := fun z hz => by + rw [mem_ball_zero_iff] + simp only [e', norm_mul, Complex.norm_real, Real.norm_eq_abs] + rw [abs_of_pos (by positivity), div_mul_eq_mul_div, div_lt_iff₀ hρ] + have : ‖z - c‖ < ρ := by rwa [mem_ball, dist_eq_norm] at hz + nlinarith + refine ⟨U₀ ∩ h₀ ⁻¹' ball c ρ, fun x => e' (h₀ x), fun z => g₀ (e z), ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩, + inter_subset_left.trans hsub, ?_⟩ + · exact h1.isOpen_inter_preimage hU₀ isOpen_ball + · exact ContinuousOn.mul continuousOn_const ((h1.mono inter_subset_left).sub continuousOn_const) + · refine h2.comp (by fun_prop) fun z hz => hball (hem z hz) + · exact fun x hx => he'm _ hx.2 + · refine fun z hz => ⟨h4 (hball (hem z hz)), ?_⟩ + change h₀ (g₀ (e z)) ∈ ball c ρ + rw [h6 (hball (hem z hz))] + exact hem z hz + · intro x hx + change g₀ (e (e' (h₀ x))) = x + rw [hee', h5 hx.1] + · intro z hz + change e' (h₀ (g₀ (e z))) = z + rw [h6 (hball (hem z hz)), he'e] + · change g₀ (e 0) = y + simp only [e, mul_zero, add_zero] + exact h5 hyU + +/-- The coordinate has no logarithm on two sets that join `ρ e^{-iτ}` and `ρ e^{iτ}` on the two +sides of the origin: the rise of the angle along the two sets differs by `2π`. -/ +theorem not_hasLogOn_of_two_sides {A B : Set ℂ} (hA : IsPreconnected A) (hB : IsPreconnected B) + (hAs : ∀ z ∈ A, z ∈ Complex.slitPlane) (hBs : ∀ z ∈ B, -z ∈ Complex.slitPlane) {ρ τ : ℝ} + (hρ : 0 < ρ) (hτ : τ ∈ Ioo 0 Real.pi) {p q : ℂ} + (hp : p = ρ * Complex.exp (-τ * Complex.I)) (hq : q = ρ * Complex.exp (τ * Complex.I)) + (hpA : p ∈ A) (hqA : q ∈ A) (hpB : p ∈ B) (hqB : q ∈ B) : + ¬ HasLogOn (A ∪ B) fun z => z := by + rintro ⟨f, hfc, hf⟩ + have hpi := Real.pi_pos + have hlogA : ∀ z ∈ A, Complex.exp (f z - Complex.log z) = 1 := fun z hz => by + rw [Complex.exp_sub, ← hf z (.inl hz), Complex.exp_log (Complex.slitPlane_ne_zero (hAs z hz)), + div_self (Complex.slitPlane_ne_zero (hAs z hz))] + have hne : ∀ z ∈ B, z ≠ 0 := fun z hz h0 => by + have := Complex.slitPlane_ne_zero (hBs z hz) + simp [h0] at this + have hlogB : ∀ z ∈ B, Complex.exp (f z - Complex.log (-z)) = -1 := fun z hz => by + have h1 := hne z hz + rw [Complex.exp_sub, ← hf z (.inr hz), Complex.exp_log (Complex.slitPlane_ne_zero (hBs z hz))] + field_simp + have hcA : ContinuousOn (fun z => f z - Complex.log z) A := + (hfc.mono subset_union_left).sub (continuousOn_id.clog hAs) + have hcB : ContinuousOn (fun z => f z - Complex.log (-z) - Real.pi * Complex.I) B := by + refine ((hfc.mono subset_union_right).sub ?_).sub continuousOn_const + exact (continuousOn_id.neg).clog hBs + have e1 := eq_of_exp_eq_one hA hcA hlogA hpA hqA + have e2 := eq_of_exp_eq_one hB hcB (fun z hz => by + rw [Complex.exp_sub, hlogB z hz, Complex.exp_pi_mul_I] + simp) hpB hqB + have hl : ∀ θ : ℝ, -Real.pi < θ → θ ≤ Real.pi → + Complex.log (ρ * Complex.exp (θ * Complex.I)) = Real.log ρ + θ * Complex.I := fun θ h1 h2 + => by + rw [Complex.log_ofReal_mul hρ (Complex.exp_ne_zero _), Complex.log_exp (by simpa) (by simpa)] + have hminus : ∀ θ : ℝ, -(ρ * Complex.exp (θ * Complex.I)) = + ρ * Complex.exp (((θ - Real.pi : ℝ) : ℂ) * Complex.I) := fun θ => by + push_cast + rw [sub_mul, Complex.exp_sub, Complex.exp_pi_mul_I] + ring + have hminus' : ∀ θ : ℝ, -(ρ * Complex.exp (θ * Complex.I)) = + ρ * Complex.exp (((θ + Real.pi : ℝ) : ℂ) * Complex.I) := fun θ => by + push_cast + rw [add_mul, Complex.exp_add, Complex.exp_pi_mul_I] + ring + have hp' : p = ρ * Complex.exp (((-τ : ℝ) : ℂ) * Complex.I) := by simpa using hp + have l1 := hl τ (by linarith [hτ.1]) hτ.2.le + have l2 := hl (-τ) (by linarith [hτ.2]) (by linarith [hτ.1]) + have l3 := hl (τ - Real.pi) (by linarith [hτ.1]) (by linarith [hτ.2]) + have l4 := hl (-τ + Real.pi) (by linarith [hτ.2]) (by linarith [hτ.1]) + rw [← hq] at l1 + rw [← hp'] at l2 + rw [← hminus, ← hq] at l3 + rw [← hminus', ← hp'] at l4 + rw [l1, l2] at e1 + simp only [l3, l4] at e2 + have h0 : (2 * Real.pi : ℂ) * Complex.I = 0 := by + push_cast at e1 e2 + linear_combination e1 - e2 + have h1 : (2 * Real.pi : ℂ) * Complex.I ≠ 0 := by + simp [Real.pi_ne_zero] + exact h1 h0 + +/-- `P` is an `O`-arc around the centre of the plane: if it lies outside the ball of radius `2`, and +inside the ball of radius `3`, and the coordinate has no logarithm on it, then the ball of radius +`2` lies in the closed domain of `P`, and this domain lies in the ball of radius `3`. -/ +theorem closedBall_subset_inner {P : Set ℂ} (hP : Nonempty (Circle ≃ₜ P)) + (h2 : Disjoint P (closedBall 0 2)) (h3 : P ⊆ ball 0 3) (hlog : ¬ HasLogOn P fun z => z) : + closedBall 0 2 ⊆ inner P ∧ closedInner P ⊆ ball 0 3 := by + obtain ⟨φ⟩ := id hP + have J := isJordanParts φ + -- a slightly smaller radius still contains `P` + obtain ⟨r, hr, hPr⟩ : ∃ r < (3 : ℝ), 0 ≤ r ∧ P ⊆ closedBall 0 r := by + by_cases hne : P.Nonempty + · obtain ⟨z, hz, hmax⟩ := J.isCompact.exists_isMaxOn hne continuous_norm.continuousOn + refine ⟨‖z‖, mem_ball_zero_iff.mp (h3 hz), norm_nonneg _, fun w hw => ?_⟩ + exact mem_closedBall_zero_iff.mpr (hmax hw) + · exact ⟨0, by norm_num, le_rfl, fun w hw => absurd ⟨w, hw⟩ hne⟩ + obtain ⟨hr0, hPr⟩ := hPr + have houter : (closedBall (0 : ℂ) r)ᶜ ⊆ outer P := by + have hconn := isPreconnected_compl_closedBall r hr0 + have hdisj : (closedBall (0 : ℂ) r)ᶜ ⊆ inner P ∪ outer P := by + rw [J.union_eq] + exact fun z hz hzP => hz (hPr hzP) + rcases hconn.subset_or_subset J.isOpen_inner J.isOpen_outer J.disjoint hdisj with h | h + · exfalso + obtain ⟨R, hR⟩ := J.isBounded_inner.subset_closedBall 0 + have hmem : ((max R r + 1 : ℝ) : ℂ) ∈ (closedBall (0 : ℂ) r)ᶜ := by + have : ‖((max R r + 1 : ℝ) : ℂ)‖ = max R r + 1 := by + rw [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg] + have := le_max_right R r + linarith + simp only [mem_compl_iff, mem_closedBall_zero_iff, this, not_le] + linarith [le_max_right R r] + have := hR (h hmem) + simp only [mem_closedBall_zero_iff] at this + rw [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (by + have := le_max_right R r + linarith)] at this + linarith [le_max_left R r] + · exact h + have hinner : inner P ⊆ closedBall 0 r := fun z hz => by + by_contra hcon + exact Set.disjoint_left.mp J.disjoint hz (houter hcon) + have h0P : (0 : ℂ) ∉ P := fun h => Set.disjoint_left.mp h2 h (by simp) + have hmem : ∀ z ∈ closedBall (0 : ℂ) 2, z ∈ inner P ∪ outer P := fun z hz => by + rw [J.union_eq] + exact fun h => Set.disjoint_left.mp h2 h hz + have hball := (convex_closedBall (0 : ℂ) 2).isPreconnected + have h0mem : (0 : ℂ) ∈ closedBall (0 : ℂ) 2 := by simp + have hc := hball.subset_or_subset J.isOpen_inner J.isOpen_outer J.disjoint hmem + have hin : closedBall 0 2 ⊆ inner P := by + rcases hc with h | h + · exact h + exfalso + -- the centre and the far point `4` lie in one component of the complement + have h4 : (4 : ℂ) ∈ outer P := houter (by + simp only [mem_compl_iff, mem_closedBall_zero_iff, not_le] + norm_num + linarith) + have h0o : (0 : ℂ) ∈ outer P := h h0mem + have hcomp : (4 : ℂ) ∈ connectedComponentIn Pᶜ 0 := by + have hsub : outer P ⊆ Pᶜ := fun z hz => hz.1 + exact J.isConnected_outer.isPreconnected.subset_connectedComponentIn h0o hsub h4 + have hl := hasLogOn_div_of_same_component J.isCompact.isClosed h0P hcomp + have hl2 : HasLogOn P fun z : ℂ => 4 - z := hasLogOn_of_slitPlane (by fun_prop) fun z hz => by + left + have h5 : ‖z‖ < 3 := mem_ball_zero_iff.mp (h3 hz) + have h6 := (abs_le.mp (Complex.abs_re_le_norm z)).2 + simp only [Complex.sub_re] + norm_num + linarith + have hl3 : HasLogOn P fun _ : ℂ => (-1 : ℂ) := hasLogOn_const (by norm_num) + refine hlog ((((hl.inv).mul hl2).mul hl3).congr fun z hz => ?_) + have hz0 : z ≠ 0 := fun h => h0P (h ▸ hz) + have hz4 : z - 4 ≠ 0 := fun h => by + have h5 : ‖z‖ < 3 := mem_ball_zero_iff.mp (h3 hz) + rw [sub_eq_zero.mp h] at h5 + norm_num at h5 + simp only [sub_zero] + field_simp + ring + refine ⟨hin, union_subset ?_ h3⟩ + exact hinner.trans (closedBall_subset_ball hr) + +theorem IsOArc.isCompact {F : Set S} (hF : IsOArc F) : IsCompact F := by + obtain ⟨φ⟩ := hF + have h : range (fun w : Circle => (φ w).1) = F := by + ext z + constructor + · rintro ⟨w, rfl⟩ + exact (φ w).2 + · intro hz + exact ⟨φ.symm ⟨z, hz⟩, by simp⟩ + rw [← h] + exact isCompact_range (continuous_subtype_val.comp φ.continuous) + +/-- The inclusion of an open set of a space into a subspace that contains it. -/ +theorem isOpenEmbedding_inclusion_of_isOpen {Δ V : Set S} (hV : IsOpen V) (hsub : V ⊆ Δ) : + IsOpenEmbedding (fun v : V => (⟨v.1, hsub v.2⟩ : Δ)) := by + have he₂ : IsOpenEmbedding (Subtype.val : V → S) := hV.isOpenEmbedding_subtypeVal + refine .of_continuous_injective_isOpenMap + (Continuous.subtype_mk continuous_subtype_val _) + (fun a b h => Subtype.ext (show a.1 = b.1 from congrArg (Subtype.val : Δ → S) h)) fun W hW => ?_ + have h2 : IsOpen ((Subtype.val : V → S) '' W) := he₂.isOpenMap _ hW + have h3 : (fun v : V => (⟨v.1, hsub v.2⟩ : Δ)) '' W = Subtype.val ⁻¹' ((Subtype.val : V + → S) '' W) := by + ext ⟨z, hz⟩ + constructor + · rintro ⟨w, hw, he⟩ + exact ⟨w, hw, congrArg Subtype.val he⟩ + · rintro ⟨w, hw, he⟩ + exact ⟨w, hw, Subtype.ext he⟩ + rw [h3] + exact h2.preimage continuous_subtype_val + +/-- An open subset of a surface inside a closed disc, made of interior points of the surface, misses +the boundary of the disc. -/ +theorem subset_discInt_of_isOpen {Δ V : Set S} (hint : ∀ x ∈ V, IsInteriorPoint x) + (hV : IsOpen V) (hsub : V ⊆ Δ) : V ⊆ discInt Δ := by + intro x hx + refine ⟨hsub hx, ?_⟩ + rintro ⟨y, hy, rfl⟩ + apply hy + have he₂ : IsOpenEmbedding (Subtype.val : V → S) := hV.isOpenEmbedding_subtypeVal + have h1 : IsInteriorPoint (⟨y.1, hx⟩ : V) := + (isInteriorPoint_iff_of_isOpenEmbedding he₂ (x := ⟨y.1, hx⟩)).mp (hint y.1 hx) + exact isInteriorPoint_of_isOpenEmbedding (isOpenEmbedding_inclusion_of_isOpen hV hsub) h1 + +/-- A point in the inside of a closed disc of a surface is an interior point of the surface. -/ +theorem isInteriorPoint_of_mem_discInt (hman : ∀ x : S, IsManifoldPoint x) {D : Set S} + (hD : IsClosedDisc D) {x : S} (hx : x ∈ discInt D) : IsInteriorPoint x := by + have hV := hD.isOpen_discInt hman + have hsub : discInt D ⊆ D := discInt_subset D + have h1 : IsInteriorPoint (⟨x, hx.1⟩ : D) := by + by_contra hcon + exact hx.2 ⟨⟨x, hx.1⟩, hcon, rfl⟩ + have h2 : IsInteriorPoint (⟨x, hx⟩ : discInt D) := + (isInteriorPoint_iff_of_isOpenEmbedding (isOpenEmbedding_inclusion_of_isOpen hV hsub) + (x := ⟨x, hx⟩)).mp h1 + exact isInteriorPoint_of_isOpenEmbedding hV.isOpenEmbedding_subtypeVal h2 + +/-- The inside of a closed disc grows with the disc. -/ +theorem discInt_mono (hman : ∀ x : S, IsManifoldPoint x) {D E : Set S} (hD : IsClosedDisc D) + (h : D ⊆ E) : discInt D ⊆ discInt E := + subset_discInt_of_isOpen (fun _ hx => isInteriorPoint_of_mem_discInt hman hD hx) + (hD.isOpen_discInt hman) ((discInt_subset D).trans h) + +/-- A curve around the ball of radius `2` of a chart, in the annulus of the radii `2` and `3`, which +meets the +given arcs in a finite way. It bounds a closed disc in the chart. The chart must show a piece of the +circle of +radius `r` off these arcs. -/ +theorem exists_tame_curve [CompactSpace S] [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) + {U : Set S} {h : S → ℂ} {g : ℂ → S} (c : BallChart 3 U h g) (G : List (𝕀 → S)) + (hG : ∀ γ ∈ G, IsArcMap γ) + {r ρ : ℝ} (hr2 : 2 < r) (hr3 : r < 3) (hρ : 0 < ρ) (hfree : ∀ z ∈ ball + (r : ℂ) ρ, ∀ γ ∈ G, g z ∉ range γ) : + ∃ P E : Set S, IsOArc P ∧ FinConn (P \ ⋃ γ ∈ G, range γ) ∧ IsClosedDisc E ∧ discBd E = P ∧ + g '' closedBall 0 2 ⊆ E ∧ E ⊆ U ∧ Disjoint P (g '' closedBall 0 2) := by + classical + have hsc := secondCountable_of_manifold hman + let : MetricSpace S := TopologicalSpace.metrizableSpaceMetric S + have hpi := Real.pi_pos + have hpi3 : 3 < Real.pi := Real.pi_gt_three + -- the angle + set τ : ℝ := min 1 (ρ / (2 * r)) with hτdef + have hτ0 : 0 < τ := lt_min one_pos (by positivity) + have hτ1 : τ ≤ 1 := min_le_left _ _ + have hτ2 : r * τ < ρ := by + have h3 : τ ≤ ρ / (2 * r) := min_le_right _ _ + have h4 : r * τ ≤ r * (ρ / (2 * r)) := mul_le_mul_of_nonneg_left h3 (by linarith) + have h5 : r * (ρ / (2 * r)) = ρ / 2 := by + field_simp + linarith + -- the round circle as two arcs + obtain ⟨a₀, b₀, hab, ha₀, hb₀, -⟩ := circle_two_arcs' (Circle.exp (-τ)) (θ := 2 * τ) + ⟨by positivity, by nlinarith⟩ + have hrpos : (0 : ℝ) < r := by linarith + have hrc : (r : ℂ) ≠ 0 := by exact_mod_cast hrpos.ne' + let κ : Circle → ℂ := fun w => (r : ℂ) * w + have hκc : Continuous κ := by fun_prop + have hκi : Function.Injective κ := fun w w' he => + Circle.ext (mul_left_cancel₀ hrc he) + have hκn : ∀ w, ‖κ w‖ = r := fun w => by + simp [κ, abs_of_pos hrpos] + let Ω₀ : Set ℂ := {z | 2 < ‖z‖ ∧ ‖z‖ < 3} + have hΩ₀ : IsOpen Ω₀ := (isOpen_lt continuous_const continuous_norm).inter + (isOpen_lt continuous_norm continuous_const) + have hΩ₀b : Ω₀ ⊆ ball 0 3 := fun z hz => mem_ball_zero_iff.mpr hz.2 + have hκΩ : ∀ w, κ w ∈ Ω₀ := fun w => ⟨by rw [hκn]; exact hr2, by rw [hκn]; exact hr3⟩ + have hκb : ∀ w, κ w ∈ ball (0 : ℂ) 3 := fun w => hΩ₀b (hκΩ w) + have hslit : ∀ w : Circle, (w : ℂ) ≠ -1 → κ w ∈ Complex.slitPlane := fun w hw => by + have h1 := circle_mem_slitPlane hw + rw [Complex.mem_slitPlane_iff] at h1 ⊢ + simp only [κ, Complex.mul_re, Complex.mul_im, Complex.ofReal_re, Complex.ofReal_im, zero_mul, + sub_zero, add_zero] + rcases h1 with h1 | h1 + · exact .inl (mul_pos hrpos h1) + · exact .inr (mul_ne_zero hrpos.ne' h1) + have hslit' : ∀ w : Circle, (w : ℂ) ≠ 1 → -κ w ∈ Complex.slitPlane := fun w hw => by + have h1 : -κ w = κ (-w) := by + simp [κ] + rw [h1] + refine hslit (-w) fun h => hw ?_ + simpa using h + have ha₀ne : ∀ s, (a₀ s : ℂ) ≠ -1 := fun s he => by + have h1 : a₀ s = Circle.exp Real.pi := Circle.ext (by simpa using he) + rw [ha₀, ← Circle.exp_add] at h1 + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h1 + have hs0 := s.2.1 + have hs1 := s.2.2 + have h2 : -τ ≤ -τ + s.1 * (2 * τ) := by nlinarith + have h3 : -τ + s.1 * (2 * τ) ≤ τ := by nlinarith + rcases le_or_gt 0 m with h | h + · have h4 : (0 : ℝ) ≤ m := by exact_mod_cast h + nlinarith + · have h4 : (m : ℝ) ≤ -1 := by exact_mod_cast (by omega : m ≤ -1) + nlinarith + have hb₀ne : ∀ s, (b₀ s : ℂ) ≠ 1 := fun s he => by + have h1 : b₀ s = Circle.exp 0 := Circle.ext (by simpa using he) + rw [hb₀, ← Circle.exp_add] at h1 + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h1 + have hs0 := s.2.1 + have hs1 := s.2.2 + have hτ3 : 2 * τ ≤ 2 := by linarith + have hlow : 2 * τ ≤ 2 * Real.pi - s.1 * (2 * Real.pi - 2 * τ) := by nlinarith + have hup : 2 * Real.pi - s.1 * (2 * Real.pi - 2 * τ) ≤ 2 * Real.pi := by nlinarith + rcases le_or_gt m 0 with h | h + · have h4 : (m : ℝ) ≤ 0 := by exact_mod_cast h + nlinarith + · have h4 : (1 : ℝ) ≤ m := by exact_mod_cast (by omega : 1 ≤ m) + nlinarith + let a : 𝕀 → S := fun s => g (κ (a₀ s)) + let b : 𝕀 → S := fun s => g (κ (b₀ s)) + have hgκc : Continuous fun w => g (κ w) := c.gc.comp_continuous hκc hκb + have hgκi : Function.Injective fun w => g (κ w) := fun w w' he => + hκi (c.hg.injOn.eq_iff (hκb w) (hκb w') |>.mp he) + have ha : IsArcMap a := ⟨hgκc.comp hab.1.1, hgκi.comp hab.1.2⟩ + have hb : IsArcMap b := ⟨hgκc.comp hab.2.1, hgκi.comp hab.2.2⟩ + have hp0 : κ (a₀ 0) = (r : ℂ) * Complex.exp (-τ * Complex.I) := by + simp only [κ, ha₀, Set.Icc.coe_zero, zero_mul, ← Circle.exp_add, Circle.coe_exp] + congr 2 + push_cast + ring + have hq0 : κ (a₀ 1) = (r : ℂ) * Complex.exp (τ * Complex.I) := by + simp only [κ, ha₀, Set.Icc.coe_one, one_mul, ← Circle.exp_add, Circle.coe_exp] + congr 2 + push_cast + ring + have hnear : ∀ θ : ℝ, |θ| ≤ τ → (r : ℂ) * Complex.exp (θ * Complex.I) ∈ ball (r : ℂ) ρ := by + intro θ hθ + rw [mem_ball, dist_eq_norm] + have h1 : (r : ℂ) * Complex.exp (θ * Complex.I) - r = r * (Complex.exp (θ * Complex.I) - 1) + := by + ring + rw [h1, norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hrpos] + have h2 : ‖Complex.exp (θ * Complex.I) - 1‖ ≤ ‖θ‖ := by + have := Real.norm_exp_I_mul_ofReal_sub_one_le (x := θ) + rwa [mul_comm] at this + rw [Real.norm_eq_abs] at h2 + calc r * ‖Complex.exp (θ * Complex.I) - 1‖ ≤ r * τ := + mul_le_mul_of_nonneg_left (h2.trans hθ) hrpos.le + _ < ρ := hτ2 + have hpG : ∀ γ ∈ G, g (κ (a₀ 0)) ∉ range γ := fun γ hγ => by + rw [hp0] + exact hfree _ (by simpa using hnear (-τ) (by rw [abs_neg, abs_of_pos hτ0])) γ hγ + have hqG : ∀ γ ∈ G, g (κ (a₀ 1)) ∉ range γ := fun γ hγ => by + rw [hq0] + exact hfree _ (hnear τ (by rw [abs_of_pos hτ0])) γ hγ + let Na : Set ℂ := Ω₀ ∩ Complex.slitPlane + let Nb : Set ℂ := Ω₀ ∩ (fun z => -z) ⁻¹' Complex.slitPlane + have hNa : IsOpen Na := hΩ₀.inter Complex.isOpen_slitPlane + have hNb : IsOpen Nb := hΩ₀.inter (Complex.isOpen_slitPlane.preimage continuous_neg) + have hNaS : IsOpen (g '' Na) := c.isOpen_image hNa fun z hz => hΩ₀b hz.1 + have hNbS : IsOpen (g '' Nb) := c.isOpen_image hNb fun z hz => hΩ₀b hz.1 + have haN : range a ⊆ g '' Na := by + rintro _ ⟨s, rfl⟩ + exact ⟨_, ⟨hκΩ _, hslit _ (ha₀ne s)⟩, rfl⟩ + have hbN : range b ⊆ g '' Nb := by + rintro _ ⟨s, rfl⟩ + exact ⟨_, ⟨hκΩ _, hslit' _ (hb₀ne s)⟩, rfl⟩ + obtain ⟨ε₁, hε₁, hth₁⟩ := (isCompact_range ha.1).exists_thickening_subset_open hNaS haN + obtain ⟨ε₂, hε₂, hth₂⟩ := (isCompact_range hb.1).exists_thickening_subset_open hNbS hbN + have hab' : IsTwoArcs a b := ⟨ha, hb, congrArg (fun w => g (κ w)) hab.3, + congrArg (fun w => g (κ w)) hab.4, fun s t he => hab.5 s t (hgκi he)⟩ + obtain ⟨a', b', ha', hb', ha'0, ha'1, hb'0, hb'1, hm', hra, hrb, htame⟩ := + exists_tame_pair G hG ha hb hab'.3 hab'.4 hab'.5 hpG hqG (lt_min hε₁ hε₂) + have hra' : range a' ⊆ g '' Na := + (hra.trans (thickening_mono (min_le_left _ _) _)).trans hth₁ + have hrb' : range b' ⊆ g '' Nb := + (hrb.trans (thickening_mono (min_le_right _ _) _)).trans hth₂ + set P : Set S := range a' ∪ range b' with hPdef + have hPO : IsOArc P := oArc_of_two_arcs ha' hb' (ha'0.trans hb'0.symm) (ha'1.trans hb'1.symm) hm' + have hPN : P ⊆ g '' Ω₀ := union_subset + (hra'.trans (image_mono inter_subset_left)) (hrb'.trans (image_mono inter_subset_left)) + have hPU : P ⊆ U := hPN.trans (image_subset_iff.mpr fun z hz => c.gm (hΩ₀b hz)) + have hhP : ∀ x ∈ P, h x ∈ Ω₀ := fun x hx => by + obtain ⟨z, hz, rfl⟩ := hPN hx + rwa [c.hg (hΩ₀b hz)] + have hQ : IsOArc (h '' P) := + hPO.image (c.hc.mono hPU) (c.gc.mono fun z hz => by + obtain ⟨x, hx, rfl⟩ := hz + exact hΩ₀b (hhP x hx)) (c.gh.mono hPU) + have hlog : ¬ HasLogOn (h '' P) fun z => z := by + have hAc : IsPreconnected (h '' range a') := (isPreconnected_range ha'.1).image _ + (c.hc.mono (subset_union_left.trans hPU)) + have hBc : IsPreconnected (h '' range b') := (isPreconnected_range hb'.1).image _ + (c.hc.mono (subset_union_right.trans hPU)) + have hp' : h (a' 0) = (r : ℂ) * Complex.exp (-τ * Complex.I) := by + rw [ha'0] + change h (g (κ (a₀ 0))) = _ + rw [c.hg (hκb _), hp0] + have hq' : h (a' 1) = (r : ℂ) * Complex.exp (τ * Complex.I) := by + rw [ha'1] + change h (g (κ (a₀ 1))) = _ + rw [c.hg (hκb _), hq0] + have := not_hasLogOn_of_two_sides hAc hBc (ρ := r) (τ := τ) ?_ ?_ hrpos ⟨hτ0, by linarith⟩ + hp' hq' ⟨_, ⟨0, rfl⟩, rfl⟩ ⟨_, ⟨1, rfl⟩, rfl⟩ ⟨_, ⟨0, rfl⟩, ?_⟩ ⟨_, ⟨1, rfl⟩, ?_⟩ + · rwa [hPdef, image_union] + · rintro _ ⟨x, hx, rfl⟩ + obtain ⟨z, hz, rfl⟩ := hra' hx + rw [c.hg (hΩ₀b hz.1)] + exact hz.2 + · rintro _ ⟨x, hx, rfl⟩ + obtain ⟨z, hz, rfl⟩ := hrb' hx + rw [c.hg (hΩ₀b hz.1)] + exact hz.2 + · rw [hb'0, ha'0] + · rw [hb'1, ha'1] + obtain ⟨hin, hsub3⟩ := closedBall_subset_inner hQ (Set.disjoint_left.mpr fun z hz hz' => by + obtain ⟨x, hx, rfl⟩ := hz + have h1 := (hhP x hx).1 + have h2 : ‖h x‖ ≤ 2 := mem_closedBall_zero_iff.mp hz' + linarith) (fun z hz => by + obtain ⟨x, hx, rfl⟩ := hz + exact hΩ₀b (hhP x hx)) hlog + obtain ⟨hdQ, hdQb⟩ := isClosedDisc_closedInner hQ + obtain ⟨hE, hEb⟩ := c.image_disc hdQ hsub3 + have hgP : g '' (h '' P) = P := by + rw [image_image] + exact (image_congr fun x hx => c.gh (hPU hx)).trans (image_id _) + rw [hdQb, hgP] at hEb + set E := g '' closedInner (h '' P) with hEdef + have hEU : E ⊆ U := image_subset_iff.mpr fun z hz => c.gm (hsub3 hz) + have hclosedin : g '' closedBall 0 2 ⊆ E := image_mono (hin.trans subset_union_left) + have hb2 : closedBall (0 : ℂ) 2 ⊆ ball 0 3 := closedBall_subset_ball (by norm_num) + refine ⟨P, E, hPO, htame, hE, hEb, hclosedin, hEU, Set.disjoint_left.mpr ?_⟩ + rintro x hx ⟨z, hz, rfl⟩ + have h1 := (hhP _ hx).1 + rw [c.hg (hb2 hz)] at h1 + have h2 : ‖z‖ ≤ 2 := mem_closedBall_zero_iff.mp hz + linarith + +/-- Two overlapping closed discs lie in a common disc if the second boundary meets the first +in finitely many connected pieces off its boundary and every circle in the region bounds there. -/ +theorem exists_disc_cover_union [ConnectedSpace S] (hS : IsSurface S) {Y D E P : Set S} + (H : ∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) + (hns : ¬ (IsSphere S ∧ Y = univ)) (hDY : D ⊆ Y) (hD : IsClosedDisc D) + (hEY : E ⊆ Y) (hE : IsClosedDisc E) (hEb : discBd E = P) (hPO : IsOArc P) + (htame : FinConn (P \ discBd D)) (hz : (discInt D ∩ E).Nonempty) : + ∃ D' : Set S, D' ⊆ Y ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ E ⊆ D' := by + classical + have := hS.1 + have := hS.2.1 + have hman := hS.2.2 + have hPY : P ⊆ Y := (hEb ▸ discBd_subset E).trans hEY + by_cases h2 : ∃ x y, x ∈ P ∧ y ∈ P ∧ x ∈ D ∧ y ∈ D ∧ x ≠ y + · obtain ⟨x, y, hxP, hyP, hxD, hyD, hxy⟩ := h2 + obtain ⟨F, hFf, hFc, hFu⟩ := htame + let F₂ : Set (Set S) := {J ∈ F | Disjoint J D} + have hF₂ : ⋃₀ F₂ = P \ D := by + ext w + constructor + · rintro ⟨J, ⟨hJ, hJD⟩, hw⟩ + have h3 : w ∈ P \ discBd D := hFu ▸ mem_sUnion_of_mem hw hJ + exact ⟨h3.1, fun h4 => Set.disjoint_left.mp hJD hw h4⟩ + · rintro ⟨hwP, hwD⟩ + have h3 : w ∈ P \ discBd D := ⟨hwP, fun h4 => hwD (discBd_subset D h4)⟩ + rw [← hFu] at h3 + obtain ⟨J, hJ, hwJ⟩ := h3 + have hJb : Disjoint J (discBd D) := by + rw [Set.disjoint_left] + intro v hv hv' + have : v ∈ P \ discBd D := hFu ▸ mem_sUnion_of_mem hv hJ + exact this.2 hv' + rcases hD.side hman (hFc J hJ) hJb with h4 | h4 + · exact absurd (h4 hwJ).1 hwD + · exact ⟨J, ⟨hJ, h4⟩, hwJ⟩ + obtain ⟨D', hD'Y, hD', hDD', hPD'⟩ := exists_disc_cover hman H hPY hPO hxP hyP hxy _ D F₂ hDY hD + hxD hyD (hFf.subset fun J hJ => hJ.1) le_rfl (fun J hJ => hFc J hJ.1) hF₂ + obtain ⟨Δ, ⟨hΔD, hΔ, hΔb, -⟩, -⟩ := disc_oArc.{u} D' P hD' hPD' hPO + by_cases hEΔ : E = Δ + · exact ⟨D', hD'Y, hD', hDD', hEΔ ▸ hΔD⟩ + · exfalso + have hsph : IsSphere S := by + by_contra hns' + exact hEΔ (eq_of_discBd_eq hS hns' hE hΔ (hEb.trans hΔb.symm)) + obtain ⟨Δ₁, Δ₂, -, -, -, -, -, hu, -, -, huniq⟩ := sphere_disc.{u} S hsph P hPO + have hY : Y = univ := by + rw [eq_univ_iff_forall] + intro w + have hw : w ∈ Δ₁ ∪ Δ₂ := hu ▸ mem_univ w + have hΔY : Δ ⊆ Y := hΔD.trans hD'Y + rcases huniq E hE hEb with h3 | h3 <;> rcases huniq Δ hΔ hΔb with h4 | h4 + · exact absurd (h3.trans h4.symm) hEΔ + · rcases hw with hw | hw + · exact hEY (h3 ▸ hw) + · exact hΔY (h4 ▸ hw) + · rcases hw with hw | hw + · exact hΔY (h4 ▸ hw) + · exact hEY (h3 ▸ hw) + · exact absurd (h3.trans h4.symm) hEΔ + exact hns ⟨hsph, hY⟩ + · push Not at h2 + have hdisj : Disjoint (discInt D) P := by + rw [Set.disjoint_left] + intro x hx hxP + have hopen : IsOpen ({x}ᶜ : Set S) := isOpen_compl_singleton + have hother : ∃ w ∈ P, w ≠ x := by + obtain ⟨φP⟩ := id hPO + by_cases h3 : (φP 1).1 = x + · refine ⟨(φP (Circle.exp Real.pi)).1, (φP _).2, fun h4 => ?_⟩ + have h5 := φP.injective (Subtype.ext (h4.trans h3.symm)) + have h6 := congrArg (fun w : Circle => (w : ℂ)) h5 + simp at h6 + norm_num at h6 + · exact ⟨_, (φP 1).2, h3⟩ + obtain ⟨w, hwP, hwx⟩ := hother + obtain ⟨v, hvP, hv1, hv2⟩ := hPO.isPreconnected _ _ (hD.isOpen_discInt hman) hopen + (fun y _ => by + by_cases h3 : y = x + · exact .inl (h3 ▸ hx) + · exact .inr h3) ⟨x, hxP, hx⟩ ⟨w, hwP, hwx⟩ + exact hv2 (h2 x v hxP hvP hx.1 hv1.1).symm + obtain ⟨z, hzD, hzE⟩ := hz + have hbdE : Disjoint (discInt D) (discBd E) := hEb ▸ hdisj + rcases hE.side hman hD.isPreconnected_discInt hbdE with h3 | h3 + · refine ⟨E, hEY, hE, ?_, subset_rfl⟩ + exact hD.subset_closure_discInt.trans + (closure_minimal (h3.trans (discInt_subset E)) hE.isClosed) + · exact absurd hzE (Set.disjoint_left.mp h3 hzD) + +/-- Merge a disc and a ball chart when a small ball around a point `r` of the +positive real axis that misses the boundary of the disc. -/ +theorem exists_disc_merge_in_chart_aux [ConnectedSpace S] (hS : IsSurface S) {Y : Set S} + (H : ∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) + (hns : ¬ (IsSphere S ∧ Y = univ)) {D : Set S} (hDY : D ⊆ Y) (hD : IsClosedDisc D) + {U : Set S} {h : S → ℂ} {g : ℂ → S} (c : BallChart 3 U h g) (hUY : U ⊆ Y) + (hz : (discInt D ∩ g '' ball 0 1).Nonempty) {r ρ : ℝ} (hr2 : 2 < r) (hr3 : r < 3) (hρ : 0 < ρ) + (hfree : ∀ z ∈ ball (r : ℂ) ρ, g z ∉ discBd D) : + ∃ D' : Set S, D' ⊆ Y ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ g '' closedBall 0 2 ⊆ D' := by + classical + have := hS.1 + have := hS.2.1 + have hman := hS.2.2 + -- the boundary of `D` as two arcs + have hG := hD.isOArc_discBd + obtain ⟨φG⟩ := id hG + have hne : (φG 1).1 ≠ (φG (Circle.exp Real.pi)).1 := fun he => by + have h1 := φG.injective (Subtype.ext he) + have h2 := congrArg (fun w : Circle => (w : ℂ)) h1 + simp at h2 + norm_num at h2 + obtain ⟨α, β, hαβ, -, -, hr⟩ := hG.exists_arcs (φG 1).2 (φG _).2 hne + obtain ⟨P, E, hPO, htame, hE, hEb, hclosedin, hEU, -⟩ := exists_tame_curve hman c [α, β] + (by simpa using ⟨hαβ.1, hαβ.2⟩) hr2 hr3 hρ fun z hz γ hγ h1 => hfree z hz (by + simp only [List.mem_cons, List.not_mem_nil, or_false] at hγ + rcases hγ with rfl | rfl + · exact hr ▸ subset_union_left h1 + · exact hr ▸ subset_union_right h1) + have hU2 : (⋃ g' ∈ [α, β], range g') = discBd D := by rw [← hr]; simp + rw [hU2] at htame + have hzE : (discInt D ∩ E).Nonempty := by + obtain ⟨z, hzD, w, hw, rfl⟩ := hz + exact ⟨g w, hzD, hclosedin ⟨w, + closedBall_subset_closedBall (by norm_num) (ball_subset_closedBall hw), rfl⟩⟩ + obtain ⟨D', hD'Y, hD', hDD', hED'⟩ := + exists_disc_cover_union hS H hns hDY hD (hEU.trans hUY) hE hEb hPO htame hzE + exact ⟨D', hD'Y, hD', hDD', hclosedin.trans hED'⟩ + +/-- **Merging.** A closed disc of `Y` and a chart in `Y` that overlap it: the round disc of radius +`2` +of the chart and the closed disc lie in a common closed disc of `Y`, unless `Y` is a whole sphere. +See +the module docstring. -/ +theorem exists_disc_merge_in_chart [ConnectedSpace S] (hS : IsSurface S) {Y : Set S} + (H : ∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) + (hns : ¬ (IsSphere S ∧ Y = univ)) {D : Set S} (hDY : D ⊆ Y) (hD : IsClosedDisc D) + {U : Set S} {h : S → ℂ} {g : ℂ → S} (c : BallChart 3 U h g) (hUY : U ⊆ Y) + (hz : (discInt D ∩ g '' ball 0 1).Nonempty) : + ∃ D' : Set S, D' ⊆ Y ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ g '' closedBall 0 2 ⊆ D' := by + have hG := hD.isOArc_discBd + let Ω₀ : Set ℂ := {z | 2 < ‖z‖ ∧ ‖z‖ < 3} + have hΩ₀ : IsOpen Ω₀ := (isOpen_lt continuous_const continuous_norm).inter + (isOpen_lt continuous_norm continuous_const) + have hΩ₀b : Ω₀ ⊆ ball 0 3 := fun z hz => mem_ball_zero_iff.mpr hz.2 + -- a point of the annulus off the boundary of `D` + have hex : ∃ w ∈ Ω₀, g w ∉ discBd D := by + by_contra hcon + push Not at hcon + have hball : ball ((5 / 2 : ℝ) : ℂ) (1 / 4) ⊆ Ω₀ := fun z hz => by + have h1 : ‖z - ((5 / 2 : ℝ) : ℂ)‖ < 1 / 4 := by rwa [mem_ball, dist_eq_norm] at hz + have h2 : ‖((5 / 2 : ℝ) : ℂ)‖ = 5 / 2 := by + rw [Complex.norm_real, Real.norm_eq_abs, abs_of_pos (by norm_num)] + have h3 := norm_sub_norm_le z ((5 / 2 : ℝ) : ℂ) + have h4 := norm_sub_norm_le ((5 / 2 : ℝ) : ℂ) z + rw [norm_sub_rev ((5 / 2 : ℝ) : ℂ) z] at h4 + exact ⟨by linarith, by linarith⟩ + refine not_image_ball_subset_oArc hG (by norm_num) (g := g) + (c.gc.mono (hball.trans hΩ₀b)) (c.hg.injOn.mono (hball.trans hΩ₀b)) ?_ + rintro _ ⟨z, hz, rfl⟩ + exact hcon z (hball hz) + obtain ⟨w, hwΩ, hwG⟩ := hex + have := hS.2.1 + have hopen : IsOpen (Ω₀ ∩ g ⁻¹' (discBd D)ᶜ) := + (c.gc.mono hΩ₀b).isOpen_inter_preimage hΩ₀ hG.isCompact.isClosed.isOpen_compl + obtain ⟨ρ, hρ, hball⟩ := Metric.isOpen_iff.mp hopen w ⟨hwΩ, hwG⟩ + let u : Circle := Circle.exp (Complex.arg w) + have huw : (u : ℂ) * (‖w‖ : ℝ) = w := by + have := Complex.norm_mul_exp_arg_mul_I w + rw [Circle.coe_exp, mul_comm] + exact this + have hcan : ∀ z : ℂ, (u : ℂ) * (((u⁻¹ : Circle) : ℂ) * z) = z := fun z => by + rw [← mul_assoc, ← Circle.coe_mul] + simp + have hmulball : ∀ {t : ℝ} {z : ℂ}, z ∈ ball (0 : ℂ) t → ((u⁻¹ : Circle) : ℂ) * z ∈ ball (0 : ℂ) t + := + fun hz => by simpa [norm_mul] using hz + have hmulcl : ∀ {t : ℝ} {z : ℂ}, z ∈ closedBall (0 : ℂ) t → + ((u⁻¹ : Circle) : ℂ) * z ∈ closedBall (0 : ℂ) t := + fun hz => by simpa [norm_mul] using hz + obtain ⟨D', h1, h2, h3, h4⟩ := exists_disc_merge_in_chart_aux hS H hns hDY hD (c.rotate u) hUY + (by + obtain ⟨x, hx, z, hz, rfl⟩ := hz + refine ⟨g z, hx, ((u⁻¹ : Circle) : ℂ) * z, hmulball hz, ?_⟩ + change g ((u : ℂ) * (((u⁻¹ : Circle) : ℂ) * z)) = g z + rw [hcan]) + (r := ‖w‖) (ρ := ρ) hwΩ.1 hwΩ.2 hρ (fun z hz => by + show g ((u : ℂ) * z) ∉ discBd D + refine (hball ?_).2 + rw [mem_ball, ← huw, dist_eq_norm, ← mul_sub, norm_mul, Circle.norm_coe, one_mul, + ← dist_eq_norm] + exact hz) + refine ⟨D', h1, h2, h3, ?_⟩ + rintro _ ⟨z, hz, rfl⟩ + have := h4 ⟨((u⁻¹ : Circle) : ℂ) * z, hmulcl hz, rfl⟩ + simpa only [hcan] using this + +/-- The heart of `exists_disc_merge`, when the chart has a small ball around a point `r` of the +positive real axis that misses the boundary of the disc. -/ +theorem exists_disc_merge_aux [CompactSpace S] [T2Space S] [ConnectedSpace S] + (hint : ∀ x : S, IsInteriorPoint x) {Y : Set S} + (H : ∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) + (hns : ¬ (IsSphere S ∧ Y = univ)) {D : Set S} (hDY : D ⊆ Y) (hD : IsClosedDisc D) + {U : Set S} {h : S → ℂ} {g : ℂ → S} (c : BallChart 3 U h g) (hUY : U ⊆ Y) + (hz : (discInt D ∩ g '' ball 0 1).Nonempty) {r ρ : ℝ} (hr2 : 2 < r) (hr3 : r < 3) (hρ : 0 < ρ) + (hfree : ∀ z ∈ ball (r : ℂ) ρ, g z ∉ discBd D) : + ∃ D' : Set S, D' ⊆ Y ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ g '' closedBall 0 2 ⊆ D' := by + exact exists_disc_merge_in_chart_aux + ⟨inferInstance, inferInstance, fun x => (hint x).isManifoldPoint⟩ + H hns hDY hD c hUY hz hr2 hr3 hρ hfree + +/-- **Merging.** A closed disc of `Y` and a chart in `Y` that overlap it: the round disc of radius +`2` +of the chart and the closed disc lie in a common closed disc of `Y`, unless `Y` is a whole sphere. +See +the module docstring. -/ +theorem exists_disc_merge [CompactSpace S] [T2Space S] [ConnectedSpace S] + (hint : ∀ x : S, IsInteriorPoint x) {Y : Set S} + (H : ∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) + (hns : ¬ (IsSphere S ∧ Y = univ)) {D : Set S} (hDY : D ⊆ Y) (hD : IsClosedDisc D) + {U : Set S} {h : S → ℂ} {g : ℂ → S} (c : BallChart 3 U h g) (hUY : U ⊆ Y) + (hz : (discInt D ∩ g '' ball 0 1).Nonempty) : + ∃ D' : Set S, D' ⊆ Y ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ g '' closedBall 0 2 ⊆ D' := by + exact exists_disc_merge_in_chart + ⟨inferInstance, inferInstance, fun x => (hint x).isManifoldPoint⟩ H hns hDY hD c hUY hz + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/DiscNbhd.lean b/LeanPool/GraphMinor/Surface/DiscNbhd.lean new file mode 100644 index 0000000000..d464e5f179 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/DiscNbhd.lean @@ -0,0 +1,216 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscFan + +/-! +# A point with a closed disc as a neighbourhood + +A point with a closed disc as a neighbourhood is a manifold point (`isManifoldPoint_of_disc`). The +chart is the +Möbius map of the closed disc without a point onto the closed right half plane. Such a point is on +the boundary of the +space if it is on the boundary of the disc (`mem_bd_of_disc`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +variable {X : Type u} [TopologicalSpace X] + +/-- A chart to the half plane given as a pair of functions gives a manifold point. -/ +theorem isManifoldPoint_of_chart {U : Set X} {O : Set ℂ} {j : X → ℂ} {k : ℂ → X} (hU : IsOpen U) + (hO : IsOpen O) + (hj : ContinuousOn j U) (hk : ContinuousOn k (O ∩ halfPlane)) (hm : MapsTo j U (O ∩ halfPlane)) + (hk' : MapsTo k (O ∩ halfPlane) U) (hl : LeftInvOn k j U) (hr : LeftInvOn j k + (O ∩ halfPlane)) {y : X} + (hy : y ∈ U) : IsManifoldPoint y := by + let P : ℂ → EuclideanHalfSpace 2 := fun z => if h : 0 ≤ z.re then ⟨complexPlane z, by + rw [complexPlane_zero]; exact h⟩ else 0 + have hP : ∀ z (hz : 0 ≤ z.re), (P z).1 = complexPlane z := fun z hz => by simp [P, hz] + let V : Set (EuclideanHalfSpace 2) := (fun p => complexPlane.symm p.1) ⁻¹' O + have hcs : Continuous fun p : EuclideanHalfSpace 2 => complexPlane.symm p.1 := + complexPlane.symm.continuous.comp continuous_subtype_val + have hV : IsOpen V := hO.preimage hcs + have hsz : ∀ p : EuclideanHalfSpace 2, complexPlane.symm p.1 ∈ halfPlane := fun p => by + change 0 ≤ (complexPlane.symm p.1).re + rw [← complexPlane_zero, complexPlane.apply_symm_apply] + exact p.2 + have hPs : ∀ z (hz : z ∈ halfPlane), complexPlane.symm (P z).1 = z := fun z hz => by + rw [hP z hz, complexPlane.symm_apply_apply] + have hPV : ∀ x : U, P (j x.1) ∈ V := fun x => by + change complexPlane.symm (P (j x.1)).1 ∈ O + rw [hPs _ (hm x.2).2] + exact (hm x.2).1 + have hcP : Continuous fun x : U => (P (j x.1)).1 := by + have h1 : Continuous fun x : U => j x.1 := continuousOn_iff_continuous_domRestrict.mp hj + refine (complexPlane.continuous.comp h1).congr fun x => ?_ + exact (hP _ (hm x.2).2).symm + refine ⟨U, V, hU, hV, hy, ⟨?_⟩⟩ + refine { toFun := fun x => ⟨P (j x.1), hPV x⟩, invFun := fun p => ⟨k (complexPlane.symm p.1.1), + ?_⟩, + left_inv := fun x => ?_, right_inv := fun p => ?_, continuous_toFun + := ?_, continuous_invFun := ?_ } + · exact hk' ⟨p.2, hsz p.1⟩ + · apply Subtype.ext + change k (complexPlane.symm (P (j x.1)).1) = x.1 + rw [hPs _ (hm x.2).2] + exact hl x.2 + · apply Subtype.ext + apply Subtype.ext + change (P (j (k (complexPlane.symm p.1.1)))).1 = p.1.1 + rw [hr ⟨p.2, hsz p.1⟩, hP _ (hsz p.1), complexPlane.apply_symm_apply] + · exact Continuous.subtype_mk (Continuous.subtype_mk hcP _) _ + · refine Continuous.subtype_mk ?_ _ + have h1 : Continuous fun p : V => complexPlane.symm p.1.1 := hcs.comp continuous_subtype_val + exact hk.comp_continuous h1 fun p => ⟨p.2, hsz p.1⟩ + +/-- The Möbius map of the closed disc without `u` onto the right half plane. -/ +noncomputable def mobC (u z : ℂ) : ℂ := (u + z) / (u - z) + +/-- The inverse of `mobC`. -/ +noncomputable def mobD (u w : ℂ) : ℂ := u * (w - 1) / (w + 1) + +theorem mobC_re {u z : ℂ} (hu : ‖u‖ = 1) (hz : ‖z‖ ≤ 1) : 0 ≤ (mobC u z).re := by + rw [mobC, Complex.div_re] + have h1 : u.re * u.re + u.im * u.im = 1 := by + have := Complex.normSq_eq_norm_sq u + rw [hu, Complex.normSq_apply] at this + linarith + have h2 : z.re * z.re + z.im * z.im ≤ 1 := by + have := Complex.normSq_eq_norm_sq z + rw [Complex.normSq_apply] at this + have h3 : ‖z‖ ^ 2 ≤ 1 := by + have := norm_nonneg z + nlinarith + linarith + have h3 : 0 ≤ Complex.normSq (u - z) := Complex.normSq_nonneg _ + simp only [Complex.add_re, Complex.sub_re, Complex.add_im, Complex.sub_im] + rw [← add_div] + refine div_nonneg ?_ h3 + nlinarith + +theorem add_one_ne {w : ℂ} (hw : 0 ≤ w.re) : w + 1 ≠ 0 := fun h => by + have := congrArg Complex.re h + simp only [Complex.add_re, Complex.one_re, Complex.zero_re] at this + linarith + +theorem norm_mobD {u w : ℂ} (hu : ‖u‖ = 1) (hw : 0 ≤ w.re) : ‖mobD u w‖ ≤ 1 := by + rw [mobD, norm_div, norm_mul, hu, one_mul, div_le_one (norm_pos_iff.mpr (add_one_ne hw))] + have h1 : ‖w - 1‖ ^ 2 ≤ ‖w + 1‖ ^ 2 := by + rw [← Complex.normSq_eq_norm_sq, ← Complex.normSq_eq_norm_sq, Complex.normSq_apply, + Complex.normSq_apply] + simp only [Complex.sub_re, Complex.sub_im, Complex.add_re, Complex.add_im, Complex.one_re, + Complex.one_im] + nlinarith + exact (pow_le_pow_iff_left₀ (norm_nonneg _) (norm_nonneg _) two_ne_zero).mp h1 + +theorem mobD_ne {u w : ℂ} (hu : ‖u‖ = 1) (hw : 0 ≤ w.re) : mobD u w ≠ u := fun h => by + have hu0 : u ≠ 0 := fun h0 => by simp [h0] at hu + have h1 := add_one_ne hw + rw [mobD, div_eq_iff h1] at h + have h2 : u * (w - 1) = u * (w + 1) := h + have h3 := mul_left_cancel₀ hu0 h2 + have h4 : (2 : ℂ) = 0 := by linear_combination -h3 + norm_num at h4 + +theorem mobC_mobD {u w : ℂ} (hu : ‖u‖ = 1) (hw : 0 ≤ w.re) : mobC u (mobD u w) = w := by + have hu0 : u ≠ 0 := fun h0 => by simp [h0] at hu + have h1 := add_one_ne hw + rw [mobC, mobD] + have h2 : u - u * (w - 1) / (w + 1) ≠ 0 := sub_ne_zero.mpr (mobD_ne hu hw).symm + rw [div_eq_iff h2] + field_simp + ring + +theorem mobD_mobC {u z : ℂ} (hu : ‖u‖ = 1) (hz : ‖z‖ ≤ 1) (hne : z ≠ u) : mobD u (mobC u z) = z + := by + have h0 : u - z ≠ 0 := sub_ne_zero.mpr hne.symm + have hre := mobC_re hu hz + have h1 := add_one_ne hre + have hu0 : u ≠ 0 := fun h0 => by simp [h0] at hu + rw [mobD, div_eq_iff h1, mobC] + field_simp + ring + +theorem isManifoldPoint_of_disc [T2Space X] {E : Set X} (hE : IsClosedDisc E) {y : X} + (hy : E ∈ 𝓝 y) : + IsManifoldPoint y := by + classical + obtain ⟨h, g, c⟩ := hE.exists_isChart + have hyE : y ∈ E := mem_of_mem_nhds hy + obtain ⟨u, hu, hne⟩ : ∃ u : ℂ, ‖u‖ = 1 ∧ h y ≠ u := by + by_cases h1 : h y = 1 + · exact ⟨-1, by simp, by rw [h1]; norm_num⟩ + · exact ⟨1, by simp, h1⟩ + have hu1 : u ∈ closedBall (0 : ℂ) 1 := by simpa using hu.le + let U : Set X := interior E \ {g u} + have hU : IsOpen U := isOpen_interior.sdiff isClosed_singleton + have hUE : U ⊆ E := sdiff_subset.trans interior_subset + have hyU : y ∈ U := by + refine ⟨mem_interior_iff_mem_nhds.mpr hy, fun he => hne ?_⟩ + have he' : y = g u := he + rw [he', c.hg hu1] + have hhn : ∀ x ∈ U, h x ≠ u := fun x hx he => hx.2 (by + change x = g u + rw [← he, c.gh (hUE hx)]) + have hhm : ∀ x ∈ U, ‖h x‖ ≤ 1 := fun x hx => by simpa using c.hm (hUE hx) + let k : ℂ → X := fun w => g (mobD u w) + have hmd : MapsTo (mobD u) halfPlane (closedBall 0 1) := fun w hw => by + simpa using norm_mobD hu hw + have hmdc : ContinuousOn (mobD u) halfPlane := by + refine ContinuousOn.div (by fun_prop) (by fun_prop) fun w hw => add_one_ne hw + have hkc : ContinuousOn k halfPlane := c.gc.comp hmdc hmd + obtain ⟨O, hO, e⟩ := (continuousOn_iff'.mp hkc) U hU + have hkj : ∀ x ∈ U, k (mobC u (h x)) = x := fun x hx => by + change g (mobD u (mobC u (h x))) = x + rw [mobD_mobC hu (hhm x hx) (hhn x hx)] + exact c.gh (hUE hx) + have hjk : ∀ w ∈ halfPlane, mobC u (h (k w)) = w := fun w hw => by + change mobC u (h (g (mobD u w))) = w + rw [c.hg (hmd hw)] + exact mobC_mobD hu hw + refine isManifoldPoint_of_chart (j := fun x => mobC u (h x)) hU hO ?_ + (hkc.mono inter_subset_right) ?_ ?_ hkj + (fun w hw => hjk w hw.2) hyU + · refine ContinuousOn.div (by + exact continuousOn_const.add (c.hc.mono hUE)) (continuousOn_const.sub + (c.hc.mono hUE)) fun x hx => ?_ + exact sub_ne_zero.mpr (hhn x hx).symm + · intro x hx + have hre : mobC u (h x) ∈ halfPlane := mobC_re hu (hhm x hx) + have h1 : mobC u (h x) ∈ k ⁻¹' U ∩ halfPlane := ⟨by + change k _ ∈ U + rw [hkj x hx] + exact hx, hre⟩ + rw [e] at h1 + exact ⟨h1.1, hre⟩ + · intro w hw + have h1 : w ∈ k ⁻¹' U ∩ halfPlane := by + rw [e] + exact hw + exact h1.1 + +/-- A point on the boundary of a closed disc that is a neighbourhood is on the boundary of the +space. -/ +theorem mem_bd_of_disc {E : Set X} {y : X} (hy : E ∈ 𝓝 y) + (hb : y ∈ discBd E) : y ∈ bd X := by + rintro ⟨U, hU, hyU, ⟨f⟩⟩ + have hV : IsOpen (U ∩ interior E) := hU.inter isOpen_interior + have h1 := subset_discInt_of_isOpen (Δ := E) (V := U ∩ interior E) + (fun x hx => ⟨U, hU, hx.1, ⟨f⟩⟩) hV (inter_subset_right.trans interior_subset) + exact (h1 ⟨hyU, mem_interior_iff_mem_nhds.mpr hy⟩).2 hb + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/DiscPolygon.lean b/LeanPool/GraphMinor/Surface/DiscPolygon.lean new file mode 100644 index 0000000000..42fe681750 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/DiscPolygon.lean @@ -0,0 +1,188 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Lunes +public import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# A polygon and its lunes in a closed disc + +We carry the polygon and the lunes of `exists_polygon_lunes` to a closed disc of a surface. First a +homeomorphism of the boundary of the disc with +the circle extends to a chart of the disc (`exists_chart_extending`). Then the sets of the unit disc +go over by that chart (`exists_polygon_in_disc`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +variable {S : Type} [TopologicalSpace S] + +theorem eC_eq_cis' (t : ℝ) : eC t = cis' t := by simp [eC, cis', Circle.coe_exp] + +theorem Circle_exp_add_int (t : ℝ) (m : ℤ) : Circle.exp (t + 2 * Real.pi * m) = Circle.exp t := + Circle.ext (eC_add_int t m) + +/-- A parametrization of the boundary of a closed disc extends to a chart of the disc. -/ +theorem exists_chart_extending {D : Set S} (hD : IsClosedDisc D) (φ : Circle ≃ₜ discBd D) : + ∃ h g, IsChart D h g ∧ ∀ t, g (eC t) = (φ (Circle.exp t)).1 := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + have hpi := Real.pi_pos + have hm : 0 < 1 := one_pos + let β : ℝ → ℂ := fun x => h (φ (Circle.exp (2 * Real.pi * x))).1 + have hφ : ∀ w, (φ w).1 ∈ D := fun w => discBd_subset _ (φ w).2 + have hfr : ∀ t : ℝ, ∃ x ∈ Ico (0 : ℝ) 1, Circle.exp t = Circle.exp (2 * Real.pi * x) ∧ eC t + = cis' (2 * Real.pi * x) := fun t => by + let u := t / (2 * Real.pi) + have ht : t = 2 * Real.pi * Int.fract u + 2 * Real.pi * ⌊u⌋ := by + have : u = Int.fract u + ⌊u⌋ := (Int.fract_add_floor u).symm + have e : t = 2 * Real.pi * u := by simp only [u]; field_simp + rw [e, ← mul_add, ← this] + refine ⟨Int.fract u, ⟨Int.fract_nonneg u, Int.fract_lt_one u⟩, ?_, ?_⟩ + · conv_lhs => rw [ht] + exact Circle_exp_add_int _ _ + · conv_lhs => rw [ht] + rw [eC_add_int, eC_eq_cis'] + have hc : ContinuousOn β (Icc 0 (1 : ℕ)) := by + have hcc : Continuous fun x : ℝ => (φ (Circle.exp (2 * Real.pi * x))).1 + := continuous_subtype_val.comp (φ.continuous.comp (Circle.exp.continuous.comp (by fun_prop))) + exact (c.hc.comp_continuous hcc fun x => hφ _).continuousOn + have hi : InjOn β (Ico 0 (1 : ℕ)) := fun x hx y hy he => by + have h1 : (φ (Circle.exp (2 * Real.pi * x))).1 = (φ (Circle.exp (2 * Real.pi * y))).1 := by + rw [← c.gh (hφ _), ← c.gh (hφ (Circle.exp (2 * Real.pi * y)))] + exact congrArg g he + have h2 := φ.injective (Subtype.ext h1) + obtain ⟨m, hm'⟩ := Circle.exp_eq_exp.mp h2 + have hxy : x - y = m := by + have : 2 * Real.pi * (x - y - m) = 0 := by linear_combination hm' + have h3 := (mul_eq_zero.mp this).resolve_left (by positivity) + linarith + have h1' : x < 1 := by simpa using hx.2 + have h2' : y < 1 := by simpa using hy.2 + have hm1 : (m : ℝ) < 1 := by linarith [hy.1] + have hm2 : (-1 : ℝ) < m := by linarith [hx.1] + have h3 : m < 1 := by exact_mod_cast hm1 + have h4 : -1 < m := by exact_mod_cast hm2 + have h5 : m = 0 := by omega + rw [h5, Int.cast_zero] at hxy + linarith + have h0 : β 0 = β (1 : ℕ) := by + have he : Circle.exp (2 * Real.pi * ((1 : ℕ) : ℝ)) = Circle.exp (2 * Real.pi * (0 : ℝ)) := by + simp + change h (φ (Circle.exp (2 * Real.pi * 0))) = h (φ (Circle.exp (2 * Real.pi * ↑(1 : ℕ)))) + rw [he] + have hr : β '' Icc 0 (1 : ℕ) = discBd (closedBall (0 : ℂ) 1) := by + rw [isClosedDisc_closedBall.2, ← c.bd] + ext z + constructor + · rintro ⟨x, -, rfl⟩ + exact ⟨_, (φ _).2, rfl⟩ + · rintro ⟨y, hy, rfl⟩ + obtain ⟨t, ht⟩ : ∃ t : ℝ, Circle.exp t = φ.symm ⟨y, hy⟩ := ⟨_, Circle.exp_arg _⟩ + obtain ⟨x, hx, he, -⟩ := hfr t + refine ⟨x, ⟨hx.1, by simpa using hx.2.le⟩, ?_⟩ + change h (φ (Circle.exp (2 * Real.pi * x))).1 = h y + rw [← he, ht, φ.apply_symm_apply] + obtain ⟨Θ, Θ', hmt, hval⟩ := exists_polygon_map isClosedDisc_closedBall.1 hm hc hi h0 hr + refine ⟨fun y => Θ' (h y), fun z => g (Θ z), ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_⟩, fun t => ?_⟩ + · exact hmt.2.2.2.2.2.comp c.hc c.hm + · exact c.gc.comp hmt.2.2.2.2.1 hmt.1 + · exact fun y hy => hmt.2.1 (c.hm hy) + · exact fun z hz => c.gm (hmt.1 hz) + · intro y hy + change g (Θ (Θ' (h y))) = y + rw [hmt.2.2.2.1 (c.hm hy), c.gh hy] + · intro z hz + change Θ' (h (g (Θ z))) = z + rw [c.hg (hmt.1 hz), hmt.2.2.1 hz] + · have hb := isClosedDisc_closedBall.2 + have : (fun y => Θ' (h y)) '' discBd D = Θ' '' sphere 0 1 := by + rw [← c.bd, image_image] + rw [this] + have hper : ∀ t : ℝ, ∃ x ∈ Icc (0 : ℝ) (1 : ℕ), eC t = per 1 x := fun t => by + obtain ⟨x, hx, -, he'⟩ := hfr t + refine ⟨x, ⟨hx.1, by simpa using hx.2.le⟩, ?_⟩ + rw [he', per] + simp + have hs : ∀ x ∈ Icc (0 : ℝ) (1 : ℕ), Θ' (β x) = per 1 x ∧ β x ∈ sphere (0 : ℂ) 1 := fun x hx + => by + have hb' : per 1 x ∈ closedBall (0 : ℂ) 1 := by simp [norm_per] + refine ⟨by rw [← hval x hx]; exact hmt.2.2.1 hb', ?_⟩ + rw [← isClosedDisc_closedBall.2, ← hr] + exact mem_image_of_mem _ hx + ext z + constructor + · rintro ⟨y, hy, rfl⟩ + rw [← isClosedDisc_closedBall.2, ← hr] at hy + obtain ⟨x, hx, rfl⟩ := hy + rw [(hs x hx).1] + simp [norm_per] + · intro hz + obtain ⟨t, rfl⟩ := exists_eC (show ‖z‖ = 1 by simpa using hz) + obtain ⟨x, hx, he⟩ := hper t + exact ⟨β x, (hs x hx).2, by rw [(hs x hx).1, he]⟩ + · obtain ⟨x, hx, he, he'⟩ := hfr t + have hx' : x ∈ Icc (0 : ℝ) (1 : ℕ) := ⟨hx.1, by simpa using hx.2.le⟩ + have hv := hval x hx' + have hper : per 1 x = eC t := by + rw [he', per] + simp + change g (Θ (eC t)) = _ + rw [← hper, hv] + change g (h (φ (Circle.exp (2 * Real.pi * x))).1) = _ + rw [c.gh (hφ _), he] + +theorem IsLineWithEnds.image_injOn [T2Space S] {Z : Set ℂ} {a b : ℂ} (hl : IsLineWithEnds Z a b) {g + : ℂ → S} (hc : ContinuousOn g Z) (hi : InjOn g Z) : + IsLineWithEnds (g '' Z) (g a) (g b) := + hl.image_under_injOn hc hi + +/-- **The polygon and the lunes in a closed disc.** Take at least three points on the boundary of a +closed disc, in order. Then the disc splits +into a polygon and one lune for each side, with the properties of `exists_polygon_lunes`. -/ +theorem exists_polygon_in_disc [T2Space S] {E : Set S} (hE : IsClosedDisc E) + (φ : Circle ≃ₜ discBd E) {k : ℕ} (hk : 3 ≤ k) (s : Fin k → ℝ) (hs : StrictMono s) + (hl : ∀ i, s i < s ⟨0, by omega⟩ + 2 * Real.pi) (nx : Fin k → Fin k) (hnx : ∀ i, (nx i).1 = + (i.1 + 1) % k) (n : Fin k → S) + (hn : ∀ i, n i = (φ (Circle.exp (s i))).1) : + ∃ (P : Set S) (L F : Fin k → Set S), IsClosedDisc P ∧ P ⊆ E ∧ discBd P = ⋃ i, F i ∧ E + = P ∪ ⋃ i, L i ∧ + (∀ i, IsClosedDisc (L i) ∧ L i ⊆ E ∧ L i ∩ P = F i ∧ F i ⊆ discBd (L i) ∧ IsLineWithEnds + (F i) (n i) (n (nx i))) ∧ + (∀ i j, i ≠ j → L i ∩ L j ⊆ range n) ∧ ∀ i j, n j ∈ L i ↔ j = i ∨ j = nx i := by + obtain ⟨h, g, c, hg⟩ := exists_chart_extending hE φ + obtain ⟨P, L, F, h1, h2, h3, h4, h5, h6, h7⟩ := exists_polygon_lunes hk s hs hl nx hnx + have hgn : ∀ i, g (eC (s i)) = n i := fun i => by rw [hg, hn] + have hLs : ∀ i, L i ⊆ closedBall 0 1 := fun i => (h5 i).2.1 + have hFs : ∀ i, F i ⊆ closedBall 0 1 := fun i => by + rw [← (h5 i).2.2.1] + exact inter_subset_left.trans (hLs i) + have hmem : ∀ j, eC (s j) ∈ closedBall (0 : ℂ) 1 := fun j => by simp [norm_eC] + refine ⟨g '' P, fun i => g '' L i, fun i => g '' F i, (c.disc_g h2 h1).1, c.g_subset h2, ?_, ?_, + fun i => ⟨(c.disc_g (hLs i) (h5 i).1).1, c.g_subset (hLs i), ?_, ?_, ?_⟩, fun i j hij + => ?_, fun i j => ?_⟩ + · rw [(c.disc_g h2 h1).2, h3, image_iUnion] + · rw [← image_iUnion, ← image_union, ← h4, c.g_closedBall] + · rw [← c.g_inter (hLs i) h2, (h5 i).2.2.1] + · rw [(c.disc_g (hLs i) (h5 i).1).2] + exact image_mono (h5 i).2.2.2.1 + · rw [← hgn, ← hgn] + exact (h5 i).2.2.2.2.image_injOn (c.gc.mono (hFs i)) (c.injOn.mono (hFs i)) + · rw [← c.g_inter (hLs i) (hLs j)] + rintro _ ⟨z, hz, rfl⟩ + obtain ⟨m, rfl⟩ := h6 i j hij hz + exact ⟨m, (hgn m).symm⟩ + · rw [← h7, ← hgn] + exact c.injOn.mem_image_iff (hLs i) (hmem j) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/DiscRemove.lean b/LeanPool/GraphMinor/Surface/DiscRemove.lean new file mode 100644 index 0000000000..6aebeb722c --- /dev/null +++ b/LeanPool/GraphMinor/Surface/DiscRemove.lean @@ -0,0 +1,242 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Ring +public import LeanPool.GraphMinor.Surface.PasteModel +public import LeanPool.GraphMinor.Surface.Cap +public import LeanPool.GraphMinor.Surface.SurfacePull +public import LeanPool.GraphMinor.Surface.CutComp + +/-! +# Removing open discs from a surface + +Let `E` be a closed disc in a surface whose boundary lies in the interior of the surface. The +surface without the inside of `E` is a +surface, and the boundary of `E` is a new cuff (`remove_disc`). At a point of the boundary of `E`, a +small piece of the collar from +`exists_disc_collar` is a closed disc that is a neighbourhood of the point, which gives the chart. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +variable {R : Type} [TopologicalSpace R] + +/-- A subset of a space that contains an open set around a point has the same local structure there. +-/ +theorem sub_open_iff {A W : Set R} (hW : IsOpen W) (hs : W ⊆ A) {y : A} (hy : y.1 ∈ W) : + (IsInteriorPoint y ↔ IsInteriorPoint y.1) ∧ (IsManifoldPoint y.1 → IsManifoldPoint y) := by + have hW' : IsOpen (Subtype.val ⁻¹' W : Set A) := hW.preimage continuous_subtype_val + let e : (Subtype.val ⁻¹' W : Set A) ≃ₜ W := + { toFun := fun z => ⟨z.1.1, z.2⟩ + invFun := fun w => ⟨⟨w.1, hs w.2⟩, w.2⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop } + have h1 := isInteriorPoint_sub hW' (x := ⟨y, hy⟩) + have h2 := isInteriorPoint_sub hW (x := ⟨y.1, hy⟩) + have h3 := isInteriorPoint_homeomorph_iff e ⟨y, hy⟩ + refine ⟨h1.symm.trans (h3.symm.trans h2), fun hm => ?_⟩ + have h4 : IsManifoldPoint (⟨y.1, hy⟩ : W) := isManifoldPoint_sub hW hm + have h5 : IsManifoldPoint (⟨y, hy⟩ : (Subtype.val ⁻¹' W : Set A)) := + (isManifoldPoint_iff_of_isOpenEmbedding e.isOpenEmbedding).mp h4 + exact isManifoldPoint_of_isOpenEmbedding hW'.isOpenEmbedding_subtypeVal h5 + +/-- A closed disc on one side of a circle in the plane. -/ +theorem exists_half_disc {w : ℂ} (hw : ‖w‖ = 1) : + ∃ (f : ℂ → ℂ) (Q : Set ℂ), ContinuousOn f Q ∧ InjOn f Q ∧ IsCompact Q ∧ IsClosedDisc Q ∧ + (0 : ℂ) ∈ discBd Q ∧ f 0 = w ∧ (∀ ζ ∈ Q, 1 ≤ ‖f ζ‖ ∧ ‖f ζ‖ ≤ 3 / 2) ∧ + ∀ᶠ z in 𝓝 w, 1 ≤ ‖z‖ → z ∈ f '' Q := by + have hL : 0 < Real.log (3 / 2) := Real.log_pos (by norm_num) + obtain ⟨hQ, hQb⟩ := isClosedDisc_rect hL (show (-1 : ℝ) < 1 by norm_num) + have hne : w ≠ 0 := by + rintro rfl + simp at hw + refine ⟨fun ζ => w * Complex.exp ζ, Icc 0 (Real.log (3 / 2)) ×ℂ Icc (-1) 1, by fun_prop, ?_, + isCompact_Icc.reProdIm isCompact_Icc, hQ, ?_, by simp, ?_, ?_⟩ + · intro x hx y hy he + have h3 := Real.pi_gt_three + have hx2 := hx.2 + have hy2 := hy.2 + exact Complex.exp_inj_of_neg_pi_lt_of_le_pi (by linarith [hx2.1]) (by linarith [hx2.2]) + (by linarith [hy2.1]) (by linarith [hy2.2]) + (mul_left_cancel₀ hne he) + · rw [hQb, frontier, Complex.interior_reProdIm, interior_Icc, interior_Icc, + (isCompact_Icc.reProdIm isCompact_Icc).isClosed.closure_eq] + refine ⟨⟨?_, ?_⟩, fun h => ?_⟩ + · simp [hL.le] + · simp + · have := h.1 + simp at this + · intro ζ hζ + have h1 := hζ.1 + rw [norm_mul, hw, one_mul, Complex.norm_exp] + constructor + · exact Real.one_le_exp h1.1 + · calc Real.exp ζ.re ≤ Real.exp (Real.log (3 / 2)) := Real.exp_le_exp.mpr h1.2 + _ = 3 / 2 := Real.exp_log (by norm_num) + · have h1 : ContinuousAt (fun z : ℂ => z / w) w := by fun_prop + have h2 : ContinuousAt (fun z : ℂ => Complex.arg (z / w)) w := by + refine ContinuousAt.comp (f := fun z : ℂ => z / w) (g := Complex.arg) ?_ h1 + apply Complex.continuousAt_arg + rw [div_self hne] + exact Complex.one_mem_slitPlane + have h3 : ∀ᶠ z in 𝓝 w, ‖z‖ < 3 / 2 := by + refine (continuous_norm.tendsto w).eventually (gt_mem_nhds ?_) + rw [hw] + norm_num + have h4 : ∀ᶠ z in 𝓝 w, |Complex.arg (z / w)| < 1 := by + have h5 : ContinuousAt (fun z : ℂ => |Complex.arg (z / w)|) w := h2.abs + refine h5.eventually (gt_mem_nhds ?_) + simp [div_self hne] + have h6 : ∀ᶠ z in 𝓝 w, z ≠ 0 := eventually_ne_nhds hne + filter_upwards [h3, h4, h6] with z hz hz' hz0 hz1 + have hdiv : z / w ≠ 0 := div_ne_zero hz0 hne + refine ⟨Complex.log (z / w), ⟨⟨?_, ?_⟩, ?_⟩, ?_⟩ + · rw [Complex.log_re, norm_div, hw, div_one] + exact Real.log_nonneg hz1 + · rw [Complex.log_re, norm_div, hw, div_one] + exact Real.log_le_log (by linarith) hz.le + · change (Complex.log (z / w)).im ∈ Icc (-1 : ℝ) 1 + rw [Complex.log_im] + exact ⟨by linarith [(abs_lt.mp hz').1], by linarith [(abs_lt.mp hz').2]⟩ + · change w * Complex.exp (Complex.log (z / w)) = z + rw [Complex.exp_log hdiv] + field_simp + +/-- At a point of the boundary of a disc, there is a closed disc on the outer side that is a +neighbourhood of the point there. -/ +theorem exists_outer_disc (hR : IsSurface R) {E : Set R} (hE : IsClosedDisc E) + (hint : ∀ x ∈ discBd E, IsInteriorPoint x) {x : R} (hx : x ∈ discBd E) : + ∃ G, IsClosedDisc G ∧ x ∈ discBd G ∧ Disjoint G (discInt E) ∧ ∀ᶠ y in 𝓝 x, y ∉ discInt E + → y ∈ G := by + have ht2 : T2Space R := hR.2.1 + have hman := hR.2.2 + obtain ⟨Δ', hΔ', hin, -⟩ := exists_disc_around hman hE hint isOpen_univ (subset_univ _) + obtain ⟨p⟩ := hE.isOArc_discBd + obtain ⟨c, c', hcc, hc'c, hmc, hmc', hl, hr, hcE, hcb, hcp⟩ := exists_disc_collar hE hΔ' hin p + let w₀ : Circle := p.symm ⟨x, hx⟩ + have hcw : c w₀ = x := by rw [hcp, p.apply_symm_apply] + have hw : ‖(w₀ : ℂ)‖ = 1 := Circle.norm_coe w₀ + obtain ⟨f, Q, hfc, hfi, hQc, hQ, hQ0, hf0, hfn, hev⟩ := exists_half_disc hw + have hin2 : ∀ ζ ∈ Q, f ζ ∈ closedBall (0 : ℂ) 2 := fun ζ hζ => by + have := (hfn ζ hζ).2 + simp only [mem_closedBall, dist_zero_right] + linarith + have hcont : ContinuousOn (fun ζ => c (f ζ)) Q := hcc.comp hfc hin2 + have hinj : InjOn (fun ζ => c (f ζ)) Q := fun a ha b hb he => hfi ha hb (by + rw [← hl (hin2 a ha), ← hl (hin2 b hb)] + exact congrArg c' he) + have : Nonempty ℂ := ⟨0⟩ + obtain ⟨hG, hGb⟩ := isClosedDisc_image_injOn hQ hQc hcont hinj + have hball1 : ∀ z ∈ closedBall (0 : ℂ) 1, z ∈ closedBall (0 : ℂ) 2 := fun z hz + => closedBall_subset_closedBall (by norm_num) hz + have hEout : ∀ z ∈ closedBall (0 : ℂ) 2, c z ∈ E → ‖z‖ ≤ 1 := fun z hz hmem => by + rw [← hcE] at hmem + obtain ⟨u, hu, he⟩ := hmem + have h2 : u = z := by + rw [← hl (hball1 u hu), he, hl hz] + have : ‖u‖ ≤ 1 := by simpa using hu + rwa [h2] at this + have hbdc : ∀ z : ℂ, ‖z‖ = 1 → c z ∈ discBd E := fun z hz => by + have h1 : c ((⟨z, by simpa [Submonoid.unitSphere] using hz⟩ : Circle) : ℂ) = _ := hcp _ + exact h1 ▸ (p _).2 + refine ⟨_, hG, ?_, ?_, ?_⟩ + · rw [hGb] + refine ⟨0, hQ0, ?_⟩ + change c (f 0) = x + rw [hf0, hcw] + · rw [disjoint_left] + rintro _ ⟨ζ, hζ, rfl⟩ hz + have h1 := hEout _ (hin2 ζ hζ) hz.1 + have h2 := hfn ζ hζ + exact hz.2 (hbdc _ (le_antisymm h1 h2.1)) + · have hxΔ' : x ∈ Δ' \ discBd Δ' := hin (discBd_subset E hx) + have hopen := hΔ'.isOpen_discInt hman + have hnΔ : Δ' ∈ 𝓝 x := mem_of_superset (hopen.mem_nhds hxΔ') (discInt_subset Δ') + have hca : ContinuousAt c' x := hc'c.continuousAt hnΔ + have hc'x : c' x = w₀ := by + rw [← hcw] + exact hl (hball1 _ (by simp)) + rw [← hf0] at hev + have htend : Tendsto c' (𝓝 x) (𝓝 (f 0)) := by + rw [hf0, ← hc'x] + exact hca + filter_upwards [htend.eventually hev, hnΔ] with y hy hyΔ hyn + have hcy : c (c' y) = y := hr hyΔ + have hz2 := hmc' hyΔ + have hn1 : 1 ≤ ‖c' y‖ := by + by_contra hlt + push Not at hlt + apply hyn + refine ⟨hcy ▸ hcE ▸ mem_image_of_mem _ (show c' y ∈ closedBall (0 : ℂ) 1 by simpa using + hlt.le), fun hb => ?_⟩ + have h5 : c (p.symm ⟨y, hb⟩) = y := by rw [hcp, p.apply_symm_apply] + have h6 : c' y = p.symm ⟨y, hb⟩ := by + conv_lhs => rw [← h5] + exact hl (hball1 _ (by simp)) + rw [h6] at hlt + simp at hlt + obtain ⟨ζ, hζ, he⟩ := hy hn1 + exact ⟨ζ, hζ, by change c (f ζ) = y; rw [he, hcy]⟩ + +/-- Removing the inside of one closed disc from a surface. -/ +theorem remove_disc (hR : IsSurface R) {E : Set R} (hE : IsClosedDisc E) + (hint : ∀ x ∈ discBd E, IsInteriorPoint x) : + IsClosed (discInt E)ᶜ ∧ IsSurface ↥(discInt E)ᶜ ∧ bd ↥(discInt E)ᶜ = Subtype.val ⁻¹' + (bd R ∪ discBd E) := by + have ht2 : T2Space R := hR.2.1 + have hcR : CompactSpace R := hR.1 + have hman := hR.2.2 + have hop := hE.isOpen_discInt hman + have hcl : IsClosed (discInt E)ᶜ := hop.isClosed_compl + have hEc : IsClosed E := hE.isClosed + have hne : Nonempty ↥(discInt E)ᶜ := by + obtain ⟨φ⟩ := id hE.isOArc_discBd + exact ⟨⟨_, fun h => h.2 (φ 1).2⟩⟩ + have hEsub : Eᶜ ⊆ (discInt E)ᶜ := fun x hx h => hx h.1 + have hjc : IsClosedEmbedding (Subtype.val : ↥(discInt E)ᶜ → R) := hcl.isClosedEmbedding_subtypeVal + have hlocal : ∀ {x : ↥(discInt E)ᶜ}, x.1 ∈ discBd E → IsManifoldPoint x ∧ x ∈ bd ↥(discInt E)ᶜ + := by + intro x hx + obtain ⟨G, hG, hxG, hd, hev⟩ := exists_outer_disc hR hE hint hx + have hGs : G ⊆ range (Subtype.val : ↥(discInt E)ᶜ → R) := by + rw [Subtype.range_val] + exact fun y hy => disjoint_left.mp hd hy + have hcS : CompactSpace ↥(discInt E)ᶜ := isCompact_iff_compactSpace.mp hcl.isCompact + obtain ⟨hG', hGb⟩ := isClosedDisc_preimage hjc hG hGs + have hnb : (Subtype.val ⁻¹' G : Set ↥(discInt E)ᶜ) ∈ 𝓝 x := by + rw [nhds_subtype_eq_comap] + refine mem_comap.mpr ⟨_, hev, fun y hy => ?_⟩ + exact hy y.2 + exact ⟨isManifoldPoint_of_disc hG' hnb, mem_bd_of_disc hnb (hGb ▸ hxG)⟩ + have hoff : ∀ {x : ↥(discInt E)ᶜ}, x.1 ∉ discBd E → x.1 ∈ Eᶜ := fun {x} hx hxE => x.2 ⟨hxE, hx⟩ + have hsurf : IsSurface ↥(discInt E)ᶜ := by + refine ⟨isCompact_iff_compactSpace.mp hcl.isCompact, inferInstance, fun x => ?_⟩ + by_cases hx : x.1 ∈ discBd E + · exact (hlocal hx).1 + · exact (sub_open_iff hEc.isOpen_compl hEsub (hoff hx)).2 (hman _) + refine ⟨hcl, hsurf, ?_⟩ + ext x + by_cases hx : x.1 ∈ discBd E + · exact ⟨fun _ => .inr hx, fun _ => (hlocal hx).2⟩ + · have h1 := (sub_open_iff hEc.isOpen_compl hEsub (hoff hx)).1 + constructor + · intro h + exact .inl fun h2 => h (h1.mpr h2) + · rintro (h | h) + · exact fun h2 => h (h1.mp h2) + · exact absurd h hx + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/DiscTwist.lean b/LeanPool/GraphMinor/Surface/DiscTwist.lean new file mode 100644 index 0000000000..c11658c526 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/DiscTwist.lean @@ -0,0 +1,248 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.TopologyStatements +public import Mathlib.Analysis.Complex.Circle +import LeanPool.GraphMinor.Surface.MoveCuff +import LeanPool.GraphMinor.Surface.CircleMove +import LeanPool.GraphMinor.Surface.PushOff + +/-! +# Twisting a disc + +For moving marked discs, as in XII (4.3), claim (7), page 251, and XIX (15.2), step (2), page 381, a +homeomorphism must carry the marked points on one disc to those on another. Any two ordered pairs of +distinct points of the circle are matched by a +homeomorphism of the circle that keeps its orientation (`exists_circle_pair_move`). Such a +homeomorphism extends to the plane, keeping the norm and fixing everything outside a ball +(`exists_twist`): +we extend it radially inside the unit disc, and undo it along the annulus by a homotopy from +`Surface/MoveCuff.lean`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Metric Filter Topology unitInterval + +/-- The unit vector of a nonzero complex number. -/ +noncomputable def unitOf (z : ℂ) (hz : z ≠ 0) : Circle := + ⟨((‖z‖ : ℝ) : ℂ)⁻¹ * z, by + rw [Submonoid.unitSphere, Submonoid.mem_mk, Subsemigroup.mem_mk] + change _ ∈ sphere (0 : ℂ) 1 + rw [mem_sphere_zero_iff_norm, norm_mul, norm_inv, Complex.norm_real, norm_norm] + exact inv_mul_cancel₀ (norm_ne_zero_iff.mpr hz)⟩ + +theorem coe_unitOf (z : ℂ) (hz : z ≠ 0) : (unitOf z hz : ℂ) = ((‖z‖ : ℝ) : ℂ)⁻¹ * z := rfl + +theorem norm_mul_unitOf (z : ℂ) (hz : z ≠ 0) : ((‖z‖ : ℝ) : ℂ) * unitOf z hz = z := by + rw [coe_unitOf, mul_inv_cancel_left₀] + exact_mod_cast norm_ne_zero_iff.mpr hz + +theorem unitOf_mul (r : ℝ) (hr : 0 < r) (w : Circle) (h : (r : ℂ) * w ≠ 0) : unitOf ((r : ℂ) * w) h + = w := by + apply Circle.ext + rw [coe_unitOf, norm_mul, Complex.norm_real, Circle.norm_coe, mul_one, + Real.norm_of_nonneg hr.le, inv_mul_cancel_left₀] + exact_mod_cast hr.ne' + +/-- The parameter along the annulus: `0` up to radius one, and `1` from radius three halves on. -/ +noncomputable def twistParam (r : ℝ) : I := Set.projIcc 0 1 zero_le_one (2 * r - 2) + +theorem continuous_twistParam : Continuous twistParam := + continuous_projIcc.comp (by fun_prop) + +theorem twistParam_low {r : ℝ} (h : r ≤ 1) : twistParam r = 0 := + Set.projIcc_of_le_left _ (by linarith) + +theorem twistParam_high {r : ℝ} (h : 3 / 2 ≤ r) : twistParam r = 1 := + Set.projIcc_of_right_le _ (by linarith) + +open Classical in +/-- The map that follows the homotopy `μ` along rays. -/ +noncomputable def twistMap (μ : I × Circle → Circle) (z : ℂ) : ℂ := + if hz : z = 0 then 0 else ((‖z‖ : ℝ) : ℂ) * μ (twistParam ‖z‖, unitOf z hz) + +theorem norm_twistMap (μ : I × Circle → Circle) (z : ℂ) : ‖twistMap μ z‖ = ‖z‖ := by + unfold twistMap + split_ifs with hz + · simp [hz] + · rw [norm_mul, Complex.norm_real, Circle.norm_coe, mul_one, norm_norm] + +theorem continuous_unitOf : Continuous fun z : {z : ℂ // z ≠ 0} => unitOf z.1 z.2 := by + refine Continuous.subtype_mk ?_ _ + have h : Continuous fun z : {z : ℂ // z ≠ 0} => ((‖z.1‖ : ℝ) : ℂ)⁻¹ := by + refine Continuous.inv₀ (by fun_prop) fun z => ?_ + exact_mod_cast norm_ne_zero_iff.mpr z.2 + exact h.mul continuous_subtype_val + +theorem continuous_twistMap {μ : I × Circle → Circle} (hμ : Continuous μ) : Continuous (twistMap μ) + := by + rw [continuous_iff_continuousAt] + intro z + by_cases hz : z = 0 + · subst hz + have h0 : twistMap μ 0 = 0 := by simp [twistMap] + rw [ContinuousAt, h0, tendsto_zero_iff_norm_tendsto_zero] + simp only [norm_twistMap] + have := (continuous_norm (E := ℂ)).tendsto 0 + simpa using this + · have hopen : IsOpen {z : ℂ | z ≠ 0} := isOpen_ne + have hmem : {z : ℂ | z ≠ 0} ∈ 𝓝 z := hopen.mem_nhds hz + refine (ContinuousOn.continuousAt ?_ hmem) + rw [continuousOn_iff_continuous_domRestrict] + have heq : ({z : ℂ | z ≠ 0}).domRestrict (twistMap μ) = fun x : {z : ℂ // z ≠ 0} => + ((‖x.1‖ : ℝ) : ℂ) * μ (twistParam ‖x.1‖, unitOf x.1 x.2) := by + funext x + change twistMap μ x.1 = _ + simp only [twistMap] + rw [dite_eq_right x.2] + rw [heq] + refine Continuous.mul (by fun_prop) (continuous_induced_dom.comp (hμ.comp ?_)) + exact (continuous_twistParam.comp (by fun_prop)).prodMk continuous_unitOf + +/-- A homeomorphism of the circle that keeps its orientation extends to the plane. The extension +keeps the norm, and it is the identity outside the ball of radius three halves. -/ +theorem exists_twist {h : Circle ≃ₜ Circle} (hh : PreservesCircleOrientation h) : + ∃ Θ : ℂ ≃ₜ ℂ, (∀ z, 3 / 2 ≤ ‖z‖ → Θ z = z) ∧ (∀ z, ‖Θ z‖ = ‖z‖) ∧ ∀ w : Circle, Θ w = h w := by + obtain ⟨μ, hμc, hμ0, hμ1, hμb⟩ := exists_circle_homotopy hh + have hc := continuous_twistMap hμc + have hinj : Function.Injective (twistMap μ) := by + intro z w he + have hn : ‖z‖ = ‖w‖ := by rw [← norm_twistMap μ z, he, norm_twistMap] + by_cases hz : z = 0 + · subst hz + exact (norm_eq_zero.mp (by simpa using hn.symm)).symm + · have hw : w ≠ 0 := fun h => hz (norm_eq_zero.mp (by simpa [h] using hn)) + simp only [twistMap, dite_eq_right hz, dite_eq_right hw] at he + rw [← hn] at he + have hr : ((‖z‖ : ℝ) : ℂ) ≠ 0 := by exact_mod_cast norm_ne_zero_iff.mpr hz + have h1 := Circle.ext (mul_left_cancel₀ hr he) + have h2 := (hμb _).1 h1 + rw [← norm_mul_unitOf z hz, ← norm_mul_unitOf w hw, ← hn, h2] + have hsurj : Function.Surjective (twistMap μ) := by + intro w + by_cases hw : w = 0 + · exact ⟨0, by simp [twistMap, hw]⟩ + · obtain ⟨v, hv⟩ := (hμb (twistParam ‖w‖)).2 (unitOf w hw) + have hpos : 0 < ‖w‖ := norm_pos_iff.mpr hw + have hne : ((‖w‖ : ℝ) : ℂ) * v ≠ 0 := mul_ne_zero (by exact_mod_cast hpos.ne') + (Circle.coe_ne_zero v) + refine ⟨((‖w‖ : ℝ) : ℂ) * v, ?_⟩ + have hnorm : ‖((‖w‖ : ℝ) : ℂ) * v‖ = ‖w‖ := by + rw [norm_mul, Complex.norm_real, Circle.norm_coe, mul_one, norm_norm] + simp only [twistMap, dite_eq_right hne] + rw [unitOf_mul _ hpos v hne, hnorm] + have hv' : μ (twistParam ‖w‖, v) = unitOf w hw := hv + rw [hv', norm_mul_unitOf] + have hproper : IsProperMap (twistMap μ) := by + refine isProperMap_iff_tendsto_cocompact.mpr ⟨hc, ?_⟩ + rw [← Metric.cobounded_eq_cocompact, ← tendsto_norm_atTop_iff_cobounded] + simp only [norm_twistMap] + exact tendsto_norm_cobounded_atTop + let Θ : ℂ ≃ₜ ℂ := (Equiv.ofBijective _ ⟨hinj, hsurj⟩).toHomeomorphOfContinuousClosed hc + hproper.isClosedMap + have hΘ : ∀ z, Θ z = twistMap μ z := fun _ => rfl + refine ⟨Θ, fun z hz => ?_, fun z => norm_twistMap μ z, fun w => ?_⟩ + · have hz0 : z ≠ 0 := fun h => by simp [h] at hz; linarith + rw [hΘ] + simp only [twistMap, dite_eq_right hz0] + rw [twistParam_high hz, hμ1, norm_mul_unitOf] + · have hw : (w : ℂ) ≠ 0 := Circle.coe_ne_zero w + have hu : unitOf (w : ℂ) hw = w := by + have := unitOf_mul 1 one_pos w (by simp [hw]) + simpa using this + rw [hΘ] + simp only [twistMap, dite_eq_right hw] + rw [Circle.norm_coe, twistParam_low le_rfl, hμ0, hu] + simp + +theorem PreservesCircleOrientation.comp {h k : Circle ≃ₜ Circle} (hh : PreservesCircleOrientation + h) (hk : PreservesCircleOrientation k) : PreservesCircleOrientation (k.trans h) := by + obtain ⟨l, hl, hm, he⟩ := hh + obtain ⟨l', hl', hm', he'⟩ := hk + refine ⟨l ∘ l', hl.comp hl', hm.comp hm', fun t => ?_⟩ + change h (k _) = _ + rw [he', he] + rfl + +/-- Multiplication by a point of the circle keeps the orientation. -/ +theorem preservesCircleOrientation_mul (c : Circle) : PreservesCircleOrientation + (Homeomorph.mulLeft c) := by + obtain ⟨θ, rfl⟩ := Circle.exp_surjective c + exact ⟨fun t => θ + t, by fun_prop, fun a b hab => by simpa using hab, + fun t => by simp [Circle.exp_add]⟩ + +/-- Two ordered pairs of distinct points of the circle are matched by a homeomorphism that keeps the +orientation. -/ +theorem exists_circle_pair_move {x y x' y' : Circle} (hxy : x ≠ y) (hxy' : x' ≠ y') : + ∃ h : Circle ≃ₜ Circle, PreservesCircleOrientation h ∧ h x = x' ∧ h y = y' := by + obtain ⟨s, hs0, hs1, hs⟩ : ∃ s : ℝ, 0 < s ∧ s < 1 ∧ x⁻¹ * y = ee s := by + obtain ⟨v, hv⟩ := ee_surjective (x⁻¹ * y) + refine ⟨Int.fract v, ?_, Int.fract_lt_one v, ?_⟩ + · refine lt_of_le_of_ne (Int.fract_nonneg v) fun h0 => hxy ?_ + have h1 : ee v = 1 := by + have h2 : ee v = ee 0 := ee_eq_iff.mpr ⟨⌊v⌋, by + have hvfloor := Int.fract_add_floor v + rw [← h0] at hvfloor + linarith⟩ + rw [h2] + simp [ee] + rw [hv] at h1 + exact (inv_mul_eq_one.mp h1) + · rw [← hv] + exact (ee_eq_iff.mpr ⟨⌊v⌋, (Int.fract_add_floor v).symm⟩ : ee v = ee (Int.fract v)) + obtain ⟨s', hs0', hs1', hs'⟩ : ∃ s : ℝ, 0 < s ∧ s < 1 ∧ x'⁻¹ * y' = ee s := by + obtain ⟨v, hv⟩ := ee_surjective (x'⁻¹ * y') + refine ⟨Int.fract v, ?_, Int.fract_lt_one v, ?_⟩ + · refine lt_of_le_of_ne (Int.fract_nonneg v) fun h0 => hxy' ?_ + have h1 : ee v = 1 := by + have h2 : ee v = ee 0 := ee_eq_iff.mpr ⟨⌊v⌋, by + have hvfloor := Int.fract_add_floor v + rw [← h0] at hvfloor + linarith⟩ + rw [h2] + simp [ee] + rw [hv] at h1 + exact (inv_mul_eq_one.mp h1) + · rw [← hv] + exact (ee_eq_iff.mpr ⟨⌊v⌋, (Int.fract_add_floor v).symm⟩ : ee v = ee (Int.fract v)) + have hc : Continuous (tentMap 0 s s' 1) := by + unfold tentMap tent + fun_prop + have hinj : Function.Injective (tentMap 0 s s' 1) := + Function.LeftInverse.injective (g := tentMap 0 s' s 1) fun y => tentMap_inv hs0 hs1 hs0' hs1' + have h00 : tentMap 0 s s' 1 0 = 0 := by rw [tentMap, tent_low hs0 hs1 le_rfl]; ring + have h11 : tentMap 0 s s' 1 1 = 1 := by rw [tentMap, tent_high hs0 hs1 le_rfl]; ring + have hss : tentMap 0 s s' 1 s = s' := by + rw [tentMap, tent_left hs0 hs1 hs0.le le_rfl, sub_zero, div_self hs0.ne'] + ring + have hmono : StrictMono (tentMap 0 s s' 1) := by + rcases hc.strictMono_of_inj hinj with h | h + · exact h + · have := h zero_lt_one + rw [h00, h11] at this + linarith + obtain ⟨h₀, ho, he⟩ := exists_circle_homeo hc.continuousOn (hmono.strictMonoOn _) + (by rw [h00, h11]; ring) + refine ⟨(Homeomorph.mulLeft x⁻¹).trans (h₀.trans (Homeomorph.mulLeft x')), ?_, ?_, ?_⟩ + · exact PreservesCircleOrientation.comp (PreservesCircleOrientation.comp + (preservesCircleOrientation_mul x') ho) (preservesCircleOrientation_mul _) + · change x' * h₀ (x⁻¹ * x) = x' + have h1 := he 0 ⟨le_rfl, zero_le_one⟩ + rw [h00] at h1 + have h2 : ee 0 = 1 := by simp [ee] + rw [h2] at h1 + rw [inv_mul_cancel, h1, mul_one] + · change x' * h₀ (x⁻¹ * y) = y' + rw [hs, he s ⟨hs0.le, hs1.le⟩, hss, ← hs', mul_inv_cancel_left] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/DiscUnion.lean b/LeanPool/GraphMinor/Surface/DiscUnion.lean new file mode 100644 index 0000000000..30dd4b4143 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/DiscUnion.lean @@ -0,0 +1,473 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# Union and difference of closed discs + +* `disc_union : DiscUnionStatement`: two closed discs that meet exactly in a line of both boundaries + have a closed disc as union. +* `disc_difference : DiscDifferenceStatement`: the difference form. + +For the union, cut the unit disc of `ℂ` along a diameter. By the extension theorem +`exists_bdMatch_closedInner`, each of the two discs has a homeomorphism onto one half that sends the +common line to the diameter by the same parametrization. These two maps agree on the line, so they +paste, since closed discs are closed in a Hausdorff space. + +For the difference, take a chart of the larger disc. The boundary of the smaller disc is the line, +on the unit circle, together with a cross-cut of the circle. So the smaller disc is one side of the +cut, and the closure of the difference is the other side. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +local notation "𝕀" => unitInterval + +universe u + +/-- Two arcs with the same ends match any other two such arcs. -/ +theorem exists_bdMatch_of_arcs {c d c' d' : 𝕀 → ℂ} (hc : IsArcMap c) (hd : IsArcMap d) + (hc' : IsArcMap c') (hd' : IsArcMap d') (h0 : d 0 = c 0) (h1 : d 1 = c 1) (h0' : d' 0 = c' 0) + (h1' : d' 1 = c' 1) (hm : ∀ s t, c s = d t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) + (hm' : ∀ s t, c' s = d' t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) : + ∃ h k : ℂ → ℂ, BdMatch (range c ∪ range d) (range c' ∪ range d') h k ∧ + (∀ s, h (c s) = c' s) ∧ ∀ s, h (d s) = d' s := by + classical + have key : ∀ {c d c' d' : 𝕀 → ℂ}, IsArcMap c → IsArcMap d → d 0 = c 0 → d 1 = c 1 → + d' 0 = c' 0 → d' 1 = c' 1 → (∀ s t, c s = d t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) → + ∃ h : ℂ → ℂ, (∀ s, h (c s) = c' s) ∧ ∀ s, h (d s) = d' s := by + intro c d c' d' hc hd h0 h1 h0' h1' hm + obtain ⟨ι, hι, -⟩ := hc.exists_inv + obtain ⟨κ, hκ, -⟩ := hd.exists_inv + refine ⟨fun z => if z ∈ range c then c' (ι z) else d' (κ z), fun s => ?_, fun s => ?_⟩ + · have : c s ∈ range c := ⟨s, rfl⟩ + simp only [this, ite_true, hι] + · by_cases hs : d s ∈ range c + · obtain ⟨r, hr⟩ := hs + have hin : d s ∈ range c := ⟨r, hr⟩ + simp only [hin, ite_true] + rw [← hr, hι] + rcases hm r s hr with ⟨h2, h3⟩ | ⟨h2, h3⟩ + · rw [h2, h3, h0'] + · rw [h2, h3, h1'] + · simp only [hs, ite_false, hκ] + obtain ⟨h, h2, h3⟩ := key (c' := c') (d' := d') hc hd h0 h1 h0' h1' hm + obtain ⟨k, k2, k3⟩ := key (c' := c) (d' := d) hc' hd' h0' h1' h0 h1 hm' + exact ⟨h, k, bdMatch_of_arcs hc hd hc' hd' h2 h3 k2 k3, h2, h3⟩ + +variable {S : Type u} [TopologicalSpace S] + +/-- A closed disc has a homeomorphism onto the closed domain of two arcs with the same ends, taking +a given line of the boundary to one of the arcs. -/ +theorem exists_pasting_half_coordinates {Δ : Set S} (hΔ : IsClosedDisc Δ) {ℓ : 𝕀 → S} + (hℓ : Continuous ℓ) + (hinj : Function.Injective ℓ) (hr : range ℓ ⊆ discBd Δ) {a e : 𝕀 → ℂ} (ha : IsArcMap a) + (he : IsArcMap e) (h0 : a 0 = e 0) (h1 : a 1 = e 1) + (hm : ∀ s t, a s = e t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) : + ∃ (p : S → ℂ) (q : ℂ → S), ContinuousOn p Δ ∧ ContinuousOn q (closedInner (side a e)) ∧ + MapsTo p Δ (closedInner (side a e)) ∧ MapsTo q (closedInner (side a e)) Δ ∧ + LeftInvOn q p Δ ∧ LeftInvOn p q (closedInner (side a e)) ∧ (∀ u, p (ℓ u) = e u) ∧ + discBd Δ = q '' side a e := by + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + have hrΔ : ∀ u, ℓ u ∈ Δ := fun u => discBd_subset Δ (hr ⟨u, rfl⟩) + let c₀ : 𝕀 → ℂ := fun u => h (ℓ u) + have hc₀ : IsArcMap c₀ := ⟨c.hc.comp_continuous hℓ hrΔ, fun u v huv => + hinj (c.gh.injOn (hrΔ u) (hrΔ v) huv)⟩ + have hsub : range c₀ ⊆ sphere 0 1 := by + rintro _ ⟨u, rfl⟩ + rw [← c.bd] + exact mem_image_of_mem h (hr ⟨u, rfl⟩) + obtain ⟨φ₀⟩ := oArc_sphere + obtain ⟨d, hd, d0, d1, hu, hmd⟩ := exists_other_arc φ₀ hc₀ hsub + obtain ⟨h₀, k₀, m, -, v2⟩ := exists_bdMatch_of_arcs hd hc₀ ha he d0.symm d1.symm h0.symm h1.symm + (fun s t hst => (hmd t s hst.symm).imp And.symm And.symm) hm + rw [union_comm (range d), hu] at m + have hO : Nonempty (Circle ≃ₜ side a e) := oArc_of_two_arcs ha he h0 h1 hm + obtain ⟨ψ, χ, m', hψ⟩ := exists_bdMatch_closedInner ⟨φ₀⟩ hO m + rw [closedInner_sphere] at m' + obtain ⟨n1, n2, n3, n4, n5, n6⟩ := id m' + refine ⟨ψ ∘ h, g ∘ χ, n5.comp c.hc c.hm, c.gc.comp n6 n2, n1.comp c.hm, c.gm.comp n2, ?_, ?_, ?_, + ?_⟩ + · intro x hx + change g (χ (ψ (h x))) = x + rw [n3 (c.hm hx)] + exact c.gh hx + · intro z hz + change ψ (h (g (χ z))) = z + rw [c.hg (n2 hz)] + exact n4 hz + · intro u + change ψ (c₀ u) = e u + rw [hψ (hsub ⟨u, rfl⟩), v2] + · rw [← show h₀ '' sphere 0 1 = side a e from m.image_eq, ← hψ.image_eq, image_image] + rw [← c.g_sphere] + refine image_congr fun z hz => ?_ + change g z = g (χ (ψ z)) + rw [n3 (sphere_subset_closedBall hz)] + +theorem IsChart.isCompact {D : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart D h g) : IsCompact D := + c.g_closedBall ▸ (isCompact_closedBall 0 1).image_of_continuousOn c.gc + +theorem IsClosedDisc.isCompact {D : Set S} (hD : IsClosedDisc D) : IsCompact D := by + obtain ⟨h, g, c⟩ := hD.exists_isChart + exact c.isCompact + +/-- The diameter of the unit disc of `ℂ`. -/ +noncomputable def unitDiscDiameter (u : 𝕀) : ℂ := ((2 * u.1 - 1 : ℝ) : ℂ) + +private theorem isArcMap_diameter : IsArcMap unitDiscDiameter := by + refine ⟨Complex.continuous_ofReal.comp (by fun_prop), fun u v h => ?_⟩ + have h1 : 2 * u.1 - 1 = 2 * v.1 - 1 := Complex.ofReal_injective h + exact Subtype.ext (by linarith) + +theorem exists_cut_diameter : ∃ a b, IsCut (sphere (0 : ℂ) 1) a b unitDiscDiameter := by + obtain ⟨φ₀⟩ := oArc_sphere + refine exists_isCut φ₀ isArcMap_diameter ?_ ?_ ?_ ?_ + · intro h + have h1 : 2 * (0 : ℝ) - 1 = 2 * 1 - 1 := Complex.ofReal_injective h + norm_num at h1 + · rw [mem_sphere_zero_iff_norm, unitDiscDiameter, Complex.norm_real] + simp + · rw [mem_sphere_zero_iff_norm, unitDiscDiameter, Complex.norm_real] + norm_num + · intro t h0 h1 + rw [inner_sphere, mem_ball_zero_iff, unitDiscDiameter, Complex.norm_real, + Real.norm_eq_abs, abs_lt] + have h2 : 0 < t.1 := lt_of_le_of_ne t.2.1 fun h => h0 (Subtype.ext h.symm) + have h3 : t.1 < 1 := lt_of_le_of_ne t.2.2 fun h => h1 (Subtype.ext h) + constructor <;> linarith + +/-- **The union of two closed discs that meet in a line of both boundaries.** See the module +docstring for the route. -/ +theorem disc_union : DiscUnionStatement.{u} := by + classical + intro S _ _ Δ₁ Δ₂ L s t h₁ h₂ hL hmeet hL₁ hL₂ + obtain ⟨f, hf0, hf1⟩ := hL + let ℓ : 𝕀 → S := fun u => (f u).1 + have hℓ : Continuous ℓ := continuous_subtype_val.comp f.continuous + have hinj : Function.Injective ℓ := fun u v h => f.injective (Subtype.ext h) + have hrL : range ℓ = L := by + ext x + constructor + · rintro ⟨u, rfl⟩ + exact (f u).2 + · intro hx + exact ⟨f.symm ⟨x, hx⟩, by simp [ℓ]⟩ + obtain ⟨a, b, cut⟩ := exists_cut_diameter + let e : 𝕀 → ℂ := unitDiscDiameter + obtain ⟨p₁, q₁, pc₁, qc₁, pm₁, qm₁, l₁, r₁, v₁, b₁⟩ := exists_pasting_half_coordinates h₁ hℓ hinj + (hrL ▸ hL₁) cut.arc_a + cut.arc_e cut.a_zero cut.a_one cut.a_eq_e + obtain ⟨p₂, q₂, pc₂, qc₂, pm₂, qm₂, l₂, r₂, v₂, b₂⟩ := exists_pasting_half_coordinates h₂ hℓ hinj + (hrL ▸ hL₂) cut.arc_b + cut.arc_e cut.b_zero cut.b_one cut.symm.a_eq_e + obtain ⟨φ₀⟩ := oArc_sphere + obtain ⟨f1, -, -, f4, -, -⟩ := cut.closedInner_facts (isJordanParts φ₀) + rw [closedInner_sphere] at f1 + set H₁ := closedInner (side a unitDiscDiameter) with hH₁ + set H₂ := closedInner (side b unitDiscDiameter) with hH₂ + have hcl₁ : IsClosed H₁ := by + obtain ⟨φ⟩ := cut.oArc_side + exact (isJordanParts φ).isCompact_closure_inner.isClosed + have hcl₂ : IsClosed H₂ := by + obtain ⟨φ⟩ := cut.symm.oArc_side + exact (isJordanParts φ).isCompact_closure_inner.isClosed + have hLΔ₁ : ∀ u, ℓ u ∈ Δ₁ := fun u => discBd_subset _ (hL₁ (f u).2) + have hLΔ₂ : ∀ u, ℓ u ∈ Δ₂ := fun u => discBd_subset _ (hL₂ (f u).2) + have hq₁ : ∀ u, q₁ (unitDiscDiameter u) = ℓ u := fun u => by rw [← v₁ u, l₁ (hLΔ₁ u)] + have hq₂ : ∀ u, q₂ (unitDiscDiameter u) = ℓ u := fun u => by rw [← v₂ u, l₂ (hLΔ₂ u)] + let P : S → ℂ := fun x => if x ∈ Δ₁ then p₁ x else p₂ x + let Q : ℂ → S := fun z => if z ∈ H₁ then q₁ z else q₂ z + have Pon₁ : EqOn P p₁ Δ₁ := fun x hx => by simp only [P, hx, ite_true] + have Pon₂ : EqOn P p₂ Δ₂ := fun x hx => by + by_cases h : x ∈ Δ₁ + · have hxL : x ∈ range ℓ := hrL ▸ hmeet ▸ ⟨h, hx⟩ + obtain ⟨u, rfl⟩ := hxL + rw [Pon₁ h, v₁, v₂] + · simp only [P, h, ite_false] + have Qon₁ : EqOn Q q₁ H₁ := fun z hz => by simp only [Q, hz, ite_true] + have Qon₂ : EqOn Q q₂ H₂ := fun z hz => by + by_cases h : z ∈ H₁ + · obtain ⟨u, rfl⟩ := f4 ⟨h, hz⟩ + rw [Qon₁ h, hq₁, hq₂] + · simp only [Q, h, ite_false] + have Pc : ContinuousOn P (Δ₁ ∪ Δ₂) := (pc₁.congr Pon₁).union_of_isClosed (pc₂.congr Pon₂) + h₁.isCompact.isClosed h₂.isCompact.isClosed + have Qc : ContinuousOn Q (closedBall 0 1) := f1 ▸ (qc₁.congr Qon₁).union_of_isClosed + (qc₂.congr Qon₂) hcl₁ hcl₂ + have hl : LeftInvOn P Q (closedBall 0 1) := by + intro z hz + rw [← f1] at hz + show P (Q z) = z + rcases hz with hz | hz + · rw [Qon₁ hz, Pon₁ (qm₁ hz)] + exact r₁ hz + · rw [Qon₂ hz, Pon₂ (qm₂ hz)] + exact r₂ hz + have hr : LeftInvOn Q P (Δ₁ ∪ Δ₂) := by + rintro x (hx | hx) + · show Q (P x) = x + rw [Pon₁ hx, Qon₁ (pm₁ hx)] + exact l₁ hx + · show Q (P x) = x + rw [Pon₂ hx, Qon₂ (pm₂ hx)] + exact l₂ hx + have himg : Q '' closedBall 0 1 = Δ₁ ∪ Δ₂ := by + refine Subset.antisymm ?_ fun x hx => ?_ + · rw [← f1] + rintro _ ⟨z, hz | hz, rfl⟩ + · rw [Qon₁ hz] + exact Or.inl (qm₁ hz) + · rw [Qon₂ hz] + exact Or.inr (qm₂ hz) + · refine ⟨P x, ?_, hr hx⟩ + rw [← f1] + rcases hx with hx | hx + · rw [Pon₁ hx] + exact Or.inl (pm₁ hx) + · rw [Pon₂ hx] + exact Or.inr (pm₂ hx) + obtain ⟨r1, r2⟩ := isClosedDisc_closedBall.1.image (f := Q) (f' := P) Qc (himg ▸ Pc) hl + rw [himg, isClosedDisc_closedBall.2] at r2 + rw [himg] at r1 + refine ⟨r1, r2.trans ?_⟩ + have hLe : ∀ {x}, x ∈ L → ∃ u, ℓ u = x := by + intro x hx + rw [← hrL] at hx + exact hx + have hs0 : ℓ 0 = s := hf0 + have ht1 : ℓ 1 = t := hf1 + have hae : ∀ v u, a v = unitDiscDiameter u → ℓ u ∈ ({s, t} : Set S) := fun v u h => by + rcases cut.a_eq_e v u h with ⟨-, rfl⟩ | ⟨-, rfl⟩ + · exact Or.inl hs0 + · exact Or.inr ht1 + have hbe : ∀ v u, b v = unitDiscDiameter u → ℓ u ∈ ({s, t} : Set S) := fun v u h => by + rcases cut.symm.a_eq_e v u h with ⟨-, rfl⟩ | ⟨-, rfl⟩ + · exact Or.inl hs0 + · exact Or.inr ht1 + have hma : ∀ v, a v ∈ H₁ := fun v => Or.inr (Or.inl ⟨v, rfl⟩) + have hmb : ∀ v, b v ∈ H₂ := fun v => Or.inr (Or.inl ⟨v, rfl⟩) + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + rw [← cut.union] at hz + rcases hz with ⟨v, rfl⟩ | ⟨v, rfl⟩ + · rw [Qon₁ (hma v)] + refine ⟨Or.inl (b₁ ▸ ⟨a v, Or.inl ⟨v, rfl⟩, rfl⟩), ?_⟩ + rintro ⟨hx, hn⟩ + obtain ⟨u, hu⟩ := hLe hx + refine hn ?_ + rw [← hu] + refine hae v u ?_ + rw [← v₁ u, hu, r₁ (hma v)] + · rw [Qon₂ (hmb v)] + refine ⟨Or.inr (b₂ ▸ ⟨b v, Or.inl ⟨v, rfl⟩, rfl⟩), ?_⟩ + rintro ⟨hx, hn⟩ + obtain ⟨u, hu⟩ := hLe hx + refine hn ?_ + rw [← hu] + refine hbe v u ?_ + rw [← v₂ u, hu, r₂ (hmb v)] + · rintro ⟨hx, hn⟩ + have hend : x ∈ L → x ∈ ({s, t} : Set S) := fun hL' => by + by_contra h + exact hn ⟨hL', h⟩ + have hs : s ∈ Q '' sphere 0 1 := ⟨unitDiscDiameter 0, cut.a_zero ▸ cut.a_mem 0, by + rw [Qon₁ (show unitDiscDiameter 0 ∈ H₁ from Or.inr (Or.inr ⟨0, rfl⟩)), hq₁, hs0]⟩ + have ht : t ∈ Q '' sphere 0 1 := ⟨unitDiscDiameter 1, cut.a_one ▸ cut.a_mem 1, by + rw [Qon₁ (show unitDiscDiameter 1 ∈ H₁ from Or.inr (Or.inr ⟨1, rfl⟩)), hq₁, ht1]⟩ + have hLcase : x ∈ L → x ∈ Q '' sphere 0 1 := fun hL' => by + rcases hend hL' with rfl | h' + · exact hs + · rw [mem_singleton_iff.mp h'] + exact ht + rcases hx with hx | hx + · rw [b₁] at hx + obtain ⟨z, hz, rfl⟩ := hx + rcases hz with ⟨v, rfl⟩ | ⟨u, rfl⟩ + · exact ⟨a v, cut.a_mem v, Qon₁ (hma v)⟩ + · exact hLcase (by rw [hq₁]; exact (f u).2) + · rw [b₂] at hx + obtain ⟨z, hz, rfl⟩ := hx + rcases hz with ⟨v, rfl⟩ | ⟨u, rfl⟩ + · exact ⟨b v, cut.b_mem v, Qon₂ (hmb v)⟩ + · exact hLcase (by rw [hq₂]; exact (f u).2) + +/-- Removing the open arc `e` from `e ∪ m`. -/ +private theorem sdiff_open_arc {e m : 𝕀 → ℂ} (h0 : m 0 = e 0) (h1 : m 1 = e 1) + (hm : ∀ s t, e s = m t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) : + (range e ∪ range m) \ (range e \ {e 0, e 1}) = range m := by + ext z + constructor + · rintro ⟨hz | hz, hn⟩ + · by_cases hend : z ∈ ({e 0, e 1} : Set ℂ) + · rcases hend with rfl | rfl + · exact ⟨0, h0⟩ + · exact ⟨1, h1⟩ + · exact absurd ⟨hz, hend⟩ hn + · exact hz + · rintro ⟨t, rfl⟩ + refine ⟨Or.inr ⟨t, rfl⟩, ?_⟩ + rintro ⟨⟨s, hs⟩, hn⟩ + rcases hm s t hs with ⟨-, rfl⟩ | ⟨-, rfl⟩ + · exact hn (Or.inl h0) + · exact hn (Or.inr h1) + +/-- **The difference of two closed discs whose boundaries meet in a line.** See the module docstring +for the route. -/ +theorem disc_difference : DiscDifferenceStatement.{u} := by + intro S _ _ Δ₁ Δ₂ L s t h₁ h₂ hsub hL hmeet + obtain ⟨h, g, c⟩ := h₂.exists_isChart + obtain ⟨f, hf0, hf1⟩ := hL + have hLb : ∀ {x}, x ∈ L → x ∈ discBd Δ₁ ∧ x ∈ discBd Δ₂ := by + intro x hx + rw [← hmeet] at hx + exact hx + have hLD : ∀ u, (f u).1 ∈ Δ₂ := fun u => discBd_subset _ (hLb (f u).2).2 + have hbd₁ : discBd Δ₁ ⊆ Δ₂ := (discBd_subset _).trans hsub + have hhinj : InjOn h Δ₂ := c.gh.injOn + let e : 𝕀 → ℂ := fun u => h (f u).1 + have he : IsArcMap e := ⟨c.hc.comp_continuous (continuous_subtype_val.comp f.continuous) hLD, + fun u v huv => f.injective (Subtype.ext (hhinj (hLD u) (hLD v) huv))⟩ + have hrange : range e = h '' L := by + ext z + constructor + · rintro ⟨u, rfl⟩ + exact ⟨_, (f u).2, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨f.symm ⟨x, hx⟩, by simp [e]⟩ + obtain ⟨φ⟩ := c.oArc_h hbd₁ h₁.isOArc_discBd + obtain ⟨φ₀⟩ := oArc_sphere + have hsub1 : range e ⊆ h '' discBd Δ₁ := by + rw [hrange] + exact image_mono fun x hx => (hLb hx).1 + have hsub2 : range e ⊆ sphere 0 1 := by + rw [hrange, ← c.bd] + exact image_mono fun x hx => (hLb hx).2 + obtain ⟨m, hm, m0, m1, hum, hmm⟩ := exists_other_arc φ he hsub1 + obtain ⟨b, hb, b0, b1, hub, hmb⟩ := exists_other_arc φ₀ he hsub2 + have hmsub : range m ⊆ h '' discBd Δ₁ := hum ▸ subset_union_right + have hinside : ∀ u : 𝕀, u ≠ 0 → u ≠ 1 → m u ∈ inner (sphere (0 : ℂ) 1) := by + intro u h0 h1 + rw [inner_sphere, mem_ball_zero_iff] + obtain ⟨x, hx, hxu⟩ := hmsub ⟨u, rfl⟩ + refine lt_of_le_of_ne (mem_closedBall_zero_iff.mp ?_) fun hn => ?_ + · rw [← hxu] + exact c.hm (hbd₁ hx) + · have hz : m u ∈ sphere (0 : ℂ) 1 := mem_sphere_zero_iff_norm.mpr hn + rw [← c.bd] at hz + obtain ⟨y, hy, hyu⟩ := hz + have hxy : y = x := hhinj (discBd_subset _ hy) (hbd₁ hx) (hyu.trans hxu.symm) + have hxL : x ∈ L := hmeet ▸ ⟨hx, hxy ▸ hy⟩ + have hme : m u ∈ range e := by + rw [hrange, ← hxu] + exact mem_image_of_mem h hxL + obtain ⟨r, hr⟩ := hme + rcases hmm r u hr with ⟨-, h'⟩ | ⟨-, h'⟩ + · exact h0 h' + · exact h1 h' + have hne : m 0 ≠ m 1 := fun h' => zero_ne_one (hm.2 h') + have cut : IsCut (sphere (0 : ℂ) 1) e b m := ⟨he, hb, hm, m0.symm, m1.symm, b0.trans m0.symm, + b1.trans m1.symm, hne, hub, by + intro s t hst + exact hmb s t hst, hinside⟩ + have hside : side e m = h '' discBd Δ₁ := hum + have J₀ := isJordanParts φ₀ + obtain ⟨f1, f2, f3, f4, -, -⟩ := cut.closedInner_facts J₀ + rw [closedInner_sphere] at f1 f2 f3 + have hG : Nonempty (Circle ≃ₜ side e m) := cut.oArc_side + have hG' : Nonempty (Circle ≃ₜ side b m) := cut.symm.oArc_side + obtain ⟨d1, d2⟩ := c.disc_h hsub h₁ + have hΔ₁ : g '' closedInner (side e m) = Δ₁ := by + rw [hside, ← eq_closedInner_of_discBd (by rw [← hside]; exact hG) d1 d2] + exact c.g_h hsub + obtain ⟨d3, d4⟩ := isClosedDisc_closedInner hG' + obtain ⟨d5, d6⟩ := c.disc_g f3 d3 + rw [d4] at d6 + have hmH : range m ⊆ closedInner (side e m) := fun z hz => Or.inr (Or.inr hz) + have hmH' : range m ⊆ closedInner (side b m) := fun z hz => Or.inr (Or.inr hz) + have hdiff : Δ₂ \ Δ₁ = g '' (closedInner (side b m) \ range m) := by + have hset : closedBall 0 1 \ closedInner (side e m) = + closedInner (side b m) \ range m := by + ext z + constructor + · rintro ⟨hz, hn⟩ + rw [← f1] at hz + rcases hz with hz | hz + · exact absurd hz hn + · exact ⟨hz, fun h' => hn (hmH h')⟩ + · rintro ⟨hz, hn⟩ + exact ⟨f3 hz, fun h' => hn (f4 ⟨h', hz⟩)⟩ + rw [← hset, c.g_sdiff Subset.rfl f2, c.g_closedBall, hΔ₁] + obtain ⟨φ'⟩ := id hG' + have J' := isJordanParts φ' + have hclosure : closure (Δ₂ \ Δ₁) = g '' closedInner (side b m) := by + refine Subset.antisymm ?_ ?_ + · refine closure_minimal ?_ ?_ + · rw [hdiff] + exact image_mono sdiff_subset + · exact (J'.isCompact_closure_inner.image_of_continuousOn (c.gc.mono f3)).isClosed + · have hin : inner (side b m) ⊆ closedInner (side b m) \ range m := fun z hz => + ⟨Or.inl hz, fun h' => J'.inner_subset_compl hz (Or.inr h')⟩ + have hcl : closure (inner (side b m)) = closedInner (side b m) := J'.closure_inner + calc g '' closedInner (side b m) = g '' closure (inner (side b m)) := by rw [hcl] + _ ⊆ closure (g '' inner (side b m)) := + ContinuousOn.image_closure (by rw [hcl]; exact c.gc.mono f3) + _ ⊆ closure (Δ₂ \ Δ₁) := closure_mono (by + rw [hdiff] + exact image_mono hin) + have he0 : g (e 0) = s := by + change g (h (f 0).1) = s + rw [c.gh (hLD 0), hf0] + have he1 : g (e 1) = t := by + change g (h (f 1).1) = t + rw [c.gh (hLD 1), hf1] + have hLg : L = g '' range e := by + rw [hrange, c.g_h fun x hx => discBd_subset _ (hLb hx).2] + have hG₁ : discBd Δ₁ = g '' (range e ∪ range m) := by + rw [hum, c.g_h hbd₁] + have hG₂ : discBd Δ₂ = g '' (range e ∪ range b) := by + rw [hub, c.g_sphere] + have hrsub : range e ⊆ closedBall 0 1 := hsub2.trans sphere_subset_closedBall + have hmsub' : range m ⊆ closedBall 0 1 := hmH.trans f2 + have hbsub : range b ⊆ closedBall 0 1 := + (hub ▸ subset_union_right : range b ⊆ sphere 0 1).trans sphere_subset_closedBall + have hpsub : ({e 0, e 1} : Set ℂ) ⊆ closedBall 0 1 := by + rintro z (rfl | rfl) + · exact hrsub ⟨0, rfl⟩ + · exact hrsub ⟨1, rfl⟩ + have hopen : L \ {s, t} = g '' (range e \ {e 0, e 1}) := by + rw [c.g_sdiff hrsub hpsub, ← hLg, image_pair, he0, he1] + have s1 := sdiff_open_arc m0 m1 hmm + have s2 := sdiff_open_arc b0 b1 hmb + refine ⟨?_, ?_, ?_⟩ + · rw [hclosure] + exact d5 + · rw [hclosure, d6, hopen, hG₁, hG₂, ← image_union, ← c.g_sdiff + (union_subset (union_subset hrsub hmsub') (union_subset hrsub hbsub)) + (sdiff_subset.trans hrsub)] + congr 1 + rw [show range e ∪ range m ∪ (range e ∪ range b) = (range e ∪ range m) ∪ + (range e ∪ range b) from + rfl, union_sdiff_distrib, s1, s2, side, union_comm] + · rw [hclosure, hopen, hG₁, ← c.g_sdiff (union_subset hrsub hmsub') + (sdiff_subset.trans hrsub), s1] + conv_lhs => rw [← hΔ₁] + rw [← c.g_inter f3 f2] + congr 1 + rw [inter_comm] + exact Subset.antisymm f4 fun z hz => ⟨hmH hz, hmH' hz⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/DiscsInSurface.lean b/LeanPool/GraphMinor/Surface/DiscsInSurface.lean new file mode 100644 index 0000000000..ce423944ec --- /dev/null +++ b/LeanPool/GraphMinor/Surface/DiscsInSurface.lean @@ -0,0 +1,326 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Cuffs +import LeanPool.GraphMinor.Surface.Disc + +/-! +# Closed discs in a surface + +* `isOpen_image_of_manifold`: invariance of domain in a surface. So a closed disc of a surface minus + its boundary is open (`IsChart.isOpen_image_ball`). +* `exists_sphere_map`: two closed discs that meet exactly in their common boundary form a sphere. +* `eq_of_discBd_eq`: in a connected surface that is not a sphere, a closed disc is determined by its + boundary. Otherwise the two discs form a sphere that is open and closed in the surface. +* `isNullHomotopicOArcIn_of_subset_disc`: an `O`-arc in a closed disc inside `Z` is null-homotopic + in `Z`. + +The last two results are two of the three parts of `EpsteinStatement`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric OnePoint + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- **Invariance of domain in a surface.** A continuous injective map from an open set of `ℂ` to +manifold points has open image. -/ +theorem isOpen_image_of_manifold {M : Set ℂ} {ρ : ℂ → S} (hM : IsOpen M) (hc : ContinuousOn ρ M) + (hi : InjOn ρ M) (hman : ∀ z ∈ M, IsManifoldPoint (ρ z)) : IsOpen (ρ '' M) := by + refine isOpen_iff_forall_mem_open.mpr ?_ + rintro _ ⟨z, hz, rfl⟩ + obtain ⟨U, O, j, k, hU, -, hxU, hj, -, -, -, hl, -⟩ := (hman z hz).exists_chart + have hM' : IsOpen (M ∩ ρ ⁻¹' U) := hc.isOpen_inter_preimage hM hU + have hG : ContinuousOn (j ∘ ρ) (M ∩ ρ ⁻¹' U) := + hj.comp (hc.mono inter_subset_left) fun w hw => hw.2 + have hGi : InjOn (j ∘ ρ) (M ∩ ρ ⁻¹' U) := fun w hw w' hw' he => + hi hw.1 hw'.1 (hl.injOn hw.2 hw'.2 he) + have hopen := isOpen_image_of_injOn hM' hG hGi + refine ⟨U ∩ j ⁻¹' ((j ∘ ρ) '' (M ∩ ρ ⁻¹' U)), ?_, hj.isOpen_inter_preimage hU hopen, + hxU, ⟨z, ⟨hz, hxU⟩, rfl⟩⟩ + rintro y ⟨hyU, w, hw, he⟩ + exact ⟨w, hw.1, hl.injOn hw.2 hyU he⟩ + +/-- A closed disc of a surface minus its boundary is open. -/ +theorem IsChart.isOpen_image_ball {D : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart D h g) + (hman : ∀ x : S, IsManifoldPoint x) : IsOpen (g '' ball 0 1) := + isOpen_image_of_manifold isOpen_ball (c.gc.mono ball_subset_closedBall) + (c.injOn.mono ball_subset_closedBall) fun _ _ => hman _ + +/-- A closed disc minus its boundary is the image of the open ball, and it misses the boundary. -/ +theorem IsChart.union_ball {D : Set S} {h : S → ℂ} {g : ℂ → S} (c : IsChart D h g) : + g '' ball 0 1 ∪ discBd D = D ∧ Disjoint (g '' ball 0 1) (discBd D) := by + constructor + · rw [← c.g_sphere, ← image_union, ball_union_sphere, c.g_closedBall] + · rw [← c.g_sphere, Set.disjoint_iff_inter_eq_empty, + ← c.g_inter ball_subset_closedBall sphere_subset_closedBall] + have : ball (0 : ℂ) 1 ∩ sphere 0 1 = ∅ := by + ext z + simp only [mem_inter_iff, mem_ball_zero_iff, mem_sphere_zero_iff_norm, mem_empty_iff_false, + iff_false, not_and] + exact fun h1 h2 => h1.ne h2 + rw [this, image_empty] + +/-- Two closed discs that meet exactly in their common boundary are the image of a sphere. -/ +theorem exists_sphere_map {Δ₁ Δ₂ : Set S} (h₁ : IsClosedDisc Δ₁) (h₂ : IsClosedDisc Δ₂) + (hb : discBd Δ₁ = discBd Δ₂) (hm : Δ₁ ∩ Δ₂ = discBd Δ₁) : + ∃ T : OnePoint EuclideanPlane → S, Continuous T ∧ Function.Injective T ∧ + range T = Δ₁ ∪ Δ₂ := by + classical + obtain ⟨h₁', g₁, c₁⟩ := h₁.exists_isChart + obtain ⟨h₂', g₂, c₂⟩ := h₂.exists_isChart + obtain ⟨φ₀⟩ := oArc_sphere + have hA : sphere (0 : ℂ) 1 ⊆ closedBall 0 1 := sphere_subset_closedBall + have hg₁s : MapsTo g₁ (sphere 0 1) (discBd Δ₁) := fun z hz => c₁.g_sphere ▸ mem_image_of_mem g₁ hz + have hg₂s : MapsTo g₂ (sphere 0 1) (discBd Δ₂) := fun z hz => c₂.g_sphere ▸ mem_image_of_mem g₂ hz + have hsub₁ := discBd_subset Δ₁ + have hsub₂ := discBd_subset Δ₂ + have hh₁s : MapsTo h₁' (discBd Δ₁) (sphere 0 1) := fun x hx => c₁.bd ▸ mem_image_of_mem h₁' hx + have hh₂s : MapsTo h₂' (discBd Δ₂) (sphere 0 1) := fun x hx => c₂.bd ▸ mem_image_of_mem h₂' hx + let β : ℂ → ℂ := fun z => h₂' (g₁ z⁻¹) + let γ : ℂ → ℂ := fun w => (h₁' (g₂ w))⁻¹ + have hinv : ContinuousOn (fun z : ℂ => z⁻¹) (sphere 0 1) := + continuousOn_id.inv₀ fun z hz => ne_zero_of_sphere hz + have m : BdMatch (sphere 0 1) (sphere 0 1) β γ := by + refine ⟨fun z hz => hh₂s (hb ▸ hg₁s (inv_mem_sphere hz)), fun w hw => + inv_mem_sphere (hh₁s (hb ▸ hg₂s hw)), fun z hz => ?_, fun w hw => ?_, ?_, ?_⟩ + · change (h₁' (g₂ (h₂' (g₁ z⁻¹))))⁻¹ = z + have h1 : g₁ z⁻¹ ∈ Δ₂ := hsub₂ (hb ▸ hg₁s (inv_mem_sphere hz)) + rw [c₂.gh h1, c₁.hg (hA (inv_mem_sphere hz)), inv_inv] + · change h₂' (g₁ (h₁' (g₂ w))⁻¹⁻¹) = w + have h1 : g₂ w ∈ Δ₁ := hsub₁ (hb.symm ▸ hg₂s hw) + rw [inv_inv, c₁.gh h1, c₂.hg (hA hw)] + · refine c₂.hc.comp ((c₁.gc.mono hA).comp hinv fun z hz => inv_mem_sphere hz) fun z hz => ?_ + exact hsub₂ (hb ▸ hg₁s (inv_mem_sphere hz)) + · exact ((c₁.hc.comp (c₂.gc.mono hA) fun w hw => hsub₁ (hb.symm ▸ hg₂s hw)).inv₀ fun w hw => + ne_zero_of_sphere (hh₁s (hb ▸ hg₂s hw))) + obtain ⟨ψ, χ, m', hψ⟩ := exists_bdMatch_closedInner ⟨φ₀⟩ ⟨φ₀⟩ m + rw [closedInner_sphere] at m' + obtain ⟨n1, n2, n3, n4, n5, n6⟩ := id m' + let G₂ : ℂ → S := g₂ ∘ ψ + have hG₂c : ContinuousOn G₂ (closedBall 0 1) := c₂.gc.comp n5 n1 + have hG₂s : ∀ z ∈ sphere (0 : ℂ) 1, G₂ z = g₁ z⁻¹ := fun z hz => by + change g₂ (ψ z) = g₁ z⁻¹ + rw [hψ hz] + exact c₂.gh (hsub₂ (hb ▸ hg₁s (inv_mem_sphere hz))) + have hG₂i : InjOn G₂ (closedBall 0 1) := fun z hz w hw he => by + have h1 := c₂.injOn (n1 hz) (n1 hw) he + exact n3.injOn hz hw h1 + have hsph : Continuous sph := isOpenEmbedding_sph.continuous + obtain ⟨s₁, hs₁c, hs₁l⟩ := exists_inv_of_compact (isCompact_closedBall (0 : ℂ) 1) hsph + isOpenEmbedding_sph.injective.injOn + obtain ⟨s₂, hs₂c, hs₂l⟩ := exists_inv_of_compact (isCompact_closedBall (0 : ℂ) 1) continuous_rsph + rsph_injective.injOn + let D₁ := sph '' closedBall 0 1 + let D₂ := rsph '' closedBall 0 1 + have hD₁cl : IsClosed D₁ := ((isCompact_closedBall (0 : ℂ) 1).image hsph).isClosed + have hD₂cl : IsClosed D₂ := ((isCompact_closedBall (0 : ℂ) 1).image continuous_rsph).isClosed + let T : OnePoint EuclideanPlane → S := fun p => if p ∈ D₁ then g₁ (s₁ p) else G₂ (s₂ p) + have hT₁ : ∀ z ∈ closedBall (0 : ℂ) 1, T (sph z) = g₁ z := fun z hz => by + have h1 : sph z ∈ D₁ := mem_image_of_mem sph hz + simp only [T, h1, ite_true] + rw [hs₁l hz] + have hT₂ : ∀ z ∈ closedBall (0 : ℂ) 1, T (rsph z) = G₂ z := fun z hz => by + by_cases h1 : rsph z ∈ D₁ + · have h2 : rsph z ∈ sph '' sphere 0 1 := by + rw [← meet_sph] + exact ⟨h1, z, hz, rfl⟩ + rw [← rsph_sphere] at h2 + obtain ⟨w, hw, he⟩ := h2 + obtain rfl := rsph_injective he + rw [rsph_of_ne (ne_zero_of_sphere hw), hT₁ _ (hA (inv_mem_sphere hw)), hG₂s w hw] + · simp only [T, h1, ite_false] + rw [hs₂l hz] + have hTc : Continuous T := by + have hon₁ : ContinuousOn T D₁ := by + refine (c₁.gc.comp hs₁c ?_).congr ?_ + · rintro _ ⟨z, hz, rfl⟩ + show s₁ (sph z) ∈ closedBall 0 1 + rwa [hs₁l hz] + · rintro _ ⟨z, hz, rfl⟩ + change T (sph z) = g₁ (s₁ (sph z)) + rw [hT₁ z hz, hs₁l hz] + have hon₂ : ContinuousOn T D₂ := by + refine (hG₂c.comp hs₂c ?_).congr ?_ + · rintro _ ⟨z, hz, rfl⟩ + show s₂ (rsph z) ∈ closedBall 0 1 + rwa [hs₂l hz] + · rintro _ ⟨z, hz, rfl⟩ + change T (rsph z) = G₂ (s₂ (rsph z)) + rw [hT₂ z hz, hs₂l hz] + have h1 := hon₁.union_of_isClosed hon₂ hD₁cl hD₂cl + rw [show D₁ ∪ D₂ = univ from cover_sph, continuousOn_univ] at h1 + exact h1 + have hcross : ∀ z ∈ closedBall (0 : ℂ) 1, ∀ w ∈ closedBall (0 : ℂ) 1, g₁ z = G₂ w → + sph z = rsph w := by + intro z hz w hw he + have hmem : g₁ z ∈ Δ₁ ∩ Δ₂ := ⟨c₁.gm hz, by rw [he]; exact c₂.gm (n1 hw)⟩ + rw [hm] at hmem + have hzs : z ∈ sphere (0 : ℂ) 1 := by + rw [← c₁.g_sphere] at hmem + obtain ⟨v, hv, hve⟩ := hmem + obtain rfl := c₁.injOn (hA hv) hz hve + exact hv + have hws : w ∈ sphere (0 : ℂ) 1 := by + rw [hb, he, ← c₂.g_sphere] at hmem + obtain ⟨v, hv, hve⟩ := hmem + have h3 : v = ψ w := c₂.injOn (hA hv) (n1 hw) hve + have h4 : sphere (0 : ℂ) 1 = ψ '' sphere 0 1 := by + rw [hψ.image_eq, m.image_eq] + rw [h3, h4] at hv + obtain ⟨v', hv', hve'⟩ := hv + obtain rfl := n3.injOn (hA hv') hw hve' + exact hv' + rw [hG₂s w hws] at he + have h5 := c₁.injOn hz (hA (inv_mem_sphere hws)) he + rw [rsph_of_ne (ne_zero_of_sphere hws), h5] + have hcov : ∀ p, (∃ z ∈ closedBall (0 : ℂ) 1, p = sph z) ∨ ∃ z ∈ closedBall (0 : ℂ) 1, p = rsph z + := + fun p => by + have h1 : p ∈ D₁ ∪ D₂ := by + rw [show D₁ ∪ D₂ = univ from cover_sph] + exact mem_univ p + rcases h1 with ⟨z, hz, rfl⟩ | ⟨z, hz, rfl⟩ + · exact Or.inl ⟨z, hz, rfl⟩ + · exact Or.inr ⟨z, hz, rfl⟩ + refine ⟨T, hTc, ?_, ?_⟩ + · intro p p' he + rcases hcov p with ⟨z, hz, rfl⟩ | ⟨z, hz, rfl⟩ <;> rcases hcov p' with ⟨w, hw, rfl⟩ | ⟨w, hw, + rfl⟩ + · rw [hT₁ z hz, hT₁ w hw] at he + rw [c₁.injOn hz hw he] + · rw [hT₁ z hz, hT₂ w hw] at he + exact hcross z hz w hw he + · rw [hT₂ z hz, hT₁ w hw] at he + exact (hcross w hw z hz he.symm).symm + · rw [hT₂ z hz, hT₂ w hw] at he + rw [hG₂i hz hw he] + · ext x + constructor + · rintro ⟨p, rfl⟩ + rcases hcov p with ⟨z, hz, rfl⟩ | ⟨z, hz, rfl⟩ + · rw [hT₁ z hz] + exact Or.inl (c₁.gm hz) + · rw [hT₂ z hz] + exact Or.inr (c₂.gm (n1 hz)) + · rintro (hx | hx) + · exact ⟨sph (h₁' x), by rw [hT₁ _ (c₁.hm hx)]; exact c₁.gh hx⟩ + · refine ⟨rsph (χ (h₂' x)), ?_⟩ + rw [hT₂ _ (n2 (c₂.hm hx))] + change g₂ (ψ (χ (h₂' x))) = x + rw [n4 (c₂.hm hx)] + exact c₂.gh hx + +/-- The image of a continuous injective sphere map fills a preconnected manifold. -/ +theorem isSphereMap_range_eq_univ [T2Space S] [PreconnectedSpace S] + (hman : ∀ x : S, IsManifoldPoint x) {T : OnePoint EuclideanPlane → S} (hT : Continuous T) + (hi : Function.Injective T) : range T = univ := by + have hopen : IsOpen (range T) := by + refine isOpen_iff_forall_mem_open.mpr ?_ + rintro _ ⟨p, rfl⟩ + obtain ⟨q, hq⟩ : ∃ q : OnePoint EuclideanPlane, q ≠ p := by + by_cases hp : p = ∞ + · exact ⟨sph 0, hp ▸ sph_ne_infty 0⟩ + · exact ⟨∞, Ne.symm hp⟩ + obtain ⟨H, hH⟩ := exists_homeomorph_onePoint q + let ρ : ℂ → S := fun z => T (H.symm (sph z)) + have hρc : Continuous ρ := + hT.comp (H.symm.continuous.comp isOpenEmbedding_sph.continuous) + have hρi : InjOn ρ univ := fun z _ w _ he => + isOpenEmbedding_sph.injective (H.symm.injective (hi he)) + have hO := isOpen_image_of_manifold isOpen_univ hρc.continuousOn hρi fun _ _ => hman _ + refine ⟨_, ?_, hO, ?_⟩ + · rintro _ ⟨z, -, rfl⟩ + exact ⟨_, rfl⟩ + · rcases eq_infty_or_sph (H p) with h | ⟨z, hz⟩ + · exact absurd (H.injective (h.trans hH.symm)) (Ne.symm hq) + · exact ⟨z, mem_univ _, by + change T (H.symm (sph z)) = T p + rw [← hz, H.symm_apply_apply]⟩ + have hcl : IsClosed (range T) := (isCompact_range hT).isClosed + exact IsClopen.eq_univ ⟨hcl, hopen⟩ (range_nonempty T) + +/-- An injective map of the sphere into a surface is onto a connected surface, so the surface is a +sphere. -/ +theorem isSphere_of_map [T2Space S] [PreconnectedSpace S] + (hman : ∀ x : S, IsManifoldPoint x) {T : OnePoint EuclideanPlane → S} (hT : Continuous T) + (hi : Function.Injective T) : IsSphere S := by + have hu := isSphereMap_range_eq_univ hman hT hi + have hb : Function.Bijective T := ⟨hi, range_eq_univ.mp hu⟩ + exact ⟨(Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective T hb) hT).symm⟩ + +/-- Closed discs with the same boundary either coincide or meet exactly along that boundary. -/ +theorem eq_or_inter_eq_discBd_of_discBd_eq [T2Space S] + (hman : ∀ x : S, IsManifoldPoint x) {Δ₁ Δ₂ : Set S} + (h₁ : IsClosedDisc Δ₁) (h₂ : IsClosedDisc Δ₂) (hb : discBd Δ₁ = discBd Δ₂) : + Δ₁ = Δ₂ ∨ Δ₁ ∩ Δ₂ = discBd Δ₁ := by + obtain ⟨h₁', g₁, c₁⟩ := h₁.exists_isChart + obtain ⟨h₂', g₂, c₂⟩ := h₂.exists_isChart + obtain ⟨u1, d1⟩ := c₁.union_ball + obtain ⟨u2, d2⟩ := c₂.union_ball + have o1 := c₁.isOpen_image_ball hman + have o2 := c₂.isOpen_image_ball hman + have p1 : IsPreconnected (g₁ '' ball 0 1) := + (convex_ball (0 : ℂ) 1).isPreconnected.image g₁ (c₁.gc.mono ball_subset_closedBall) + have p2 : IsPreconnected (g₂ '' ball 0 1) := + (convex_ball (0 : ℂ) 1).isPreconnected.image g₂ (c₂.gc.mono ball_subset_closedBall) + have cl1 : IsClosed (g₁ '' ball 0 1 ∪ discBd Δ₁) := by + rw [u1] + exact h₁.isCompact.isClosed + have cl2 : IsClosed (g₂ '' ball 0 1 ∪ discBd Δ₁) := by + rw [hb, u2] + exact h₂.isCompact.isClosed + by_cases hne : (g₁ '' ball 0 1 ∩ g₂ '' ball 0 1).Nonempty + · have s1 := subset_of_side p1 o2 cl2 d1 hne + have s2 := subset_of_side p2 o1 cl1 (hb ▸ d2) (by rwa [inter_comm]) + left + rw [← u1, ← u2, Subset.antisymm s1 s2, hb] + · right + refine Subset.antisymm ?_ fun x hx => ⟨discBd_subset _ hx, discBd_subset _ (hb ▸ hx)⟩ + rintro x ⟨hx1, hx2⟩ + rw [← u1] at hx1 + rw [← u2] at hx2 + rcases hx1 with h1 | h1 + · rcases hx2 with h2 | h2 + · exact absurd ⟨x, h1, h2⟩ hne + · exact hb ▸ h2 + · exact h1 + +/-- In a connected surface that is not a sphere, a closed disc is determined by its boundary. This +is +the third part of `EpsteinStatement`. -/ +theorem eq_of_discBd_eq (hS : IsSurface S) [PreconnectedSpace S] (hns : ¬ IsSphere S) {Δ₁ Δ₂ : Set + S} + (h₁ : IsClosedDisc Δ₁) (h₂ : IsClosedDisc Δ₂) (hb : discBd Δ₁ = discBd Δ₂) : Δ₁ = Δ₂ := by + have : T2Space S := hS.2.1 + rcases eq_or_inter_eq_discBd_of_discBd_eq hS.2.2 h₁ h₂ hb with heq | hinter + · exact heq + · obtain ⟨T, hT, hi, -⟩ := exists_sphere_map h₁ h₂ hb hinter + exact (hns (isSphere_of_map hS.2.2 hT hi)).elim + +/-- An `O`-arc in a closed disc inside `Z` is null-homotopic in `Z`. This is the second part of +`EpsteinStatement`. -/ +theorem isNullHomotopicOArcIn_of_subset_disc {Z F Δ : Set S} (hF : IsOArc F) (hΔZ : Δ ⊆ Z) + (hΔ : IsClosedDisc Δ) (hFΔ : F ⊆ Δ) : IsNullHomotopicOArcIn Z F := by + obtain ⟨φ⟩ := hF + refine ⟨φ, ?_⟩ + obtain ⟨c, hc, ψ, h1, h2, h3⟩ := hΔ.isSimplyConnectedSet.2 + ⟨fun x => (φ x).1, continuous_subtype_val.comp φ.continuous⟩ + (by + rintro _ ⟨x, rfl⟩ + exact hFΔ (φ x).2) + exact ⟨c, hΔZ hc, ψ, fun p => hΔZ (h1 p), h2, h3⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Dissection.lean b/LeanPool/GraphMinor/Surface/Dissection.lean new file mode 100644 index 0000000000..bba0018b98 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Dissection.lean @@ -0,0 +1,214 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ChartCells +public import LeanPool.GraphMinor.Surface.PushOff + +/-! +# Dissections of closed surfaces + +`IsDissection V E 𝓕` says that the closed discs in `𝓕` cover the space, that their boundaries lie in +the graph +`(V, E)`, that their interiors miss the graph and each other, and that a point off `V` lies in at +most two of them. +`exists_dissection` builds one around a given graph in a connected closed surface. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +variable {X : Type u} [TopologicalSpace X] + +/-- A cutting of the space into closed discs along a graph. -/ +structure IsDissection (V : Set X) (E 𝓕 : Set (Set X)) : Prop where + graph : IsGraph V E + fin : 𝓕.Finite + disc : ∀ Φ ∈ 𝓕, IsClosedDisc Φ + cover : ⋃₀ 𝓕 = univ + bd : ∀ Φ ∈ 𝓕, discBd Φ ⊆ ⋃₀ E + int : ∀ Φ ∈ 𝓕, Disjoint (discInt Φ) (⋃₀ E) + disj : ∀ Φ ∈ 𝓕, ∀ Φ' ∈ 𝓕, Φ ≠ Φ' → Disjoint (discInt Φ) Φ' + count : ∀ x ∉ V, {Φ ∈ 𝓕 | x ∈ Φ}.encard ≤ 2 + +variable [T2Space X] {V : Set X} {E : Set (Set X)} + +/-- Closed discs with boundary in a closed set `G`, whose interiors miss `G` and meet, are equal. -/ +theorem eq_of_int_meet (hman : ∀ x : X, IsManifoldPoint x) {G Φ Φ' : Set X} (h1 : IsClosedDisc Φ) + (h2 : IsClosedDisc Φ') (b1 : discBd Φ ⊆ G) (b2 : discBd Φ' ⊆ G) (i1 : Disjoint (discInt Φ) G) + (i2 : Disjoint (discInt Φ') G) {z : X} (hz : z ∈ discInt Φ) (hz' : z ∈ Φ') : Φ = Φ' := by + have hzG : z ∉ G := Set.disjoint_left.mp i1 hz + have hz2 : z ∈ discInt Φ' := ⟨hz', fun h => hzG (b2 h)⟩ + have s1 : discInt Φ ⊆ discInt Φ' := by + rcases h2.side hman h1.isPreconnected_discInt (i1.mono_right b2) with h | h + · exact h + · exact absurd hz' (Set.disjoint_left.mp h hz) + have s2 : discInt Φ' ⊆ discInt Φ := by + rcases h1.side hman h2.isPreconnected_discInt (i2.mono_right b1) with h | h + · exact h + · exact absurd hz.1 (Set.disjoint_left.mp h hz2) + apply subset_antisymm + · exact h1.subset_closure_discInt.trans (closure_minimal (s1.trans (discInt_subset Φ')) + h2.isClosed) + · exact h2.subset_closure_discInt.trans (closure_minimal (s2.trans (discInt_subset Φ)) + h1.isClosed) + +/-- The cells of finitely many discs, whose interiors cover the space, form a dissection. -/ +theorem isDissection_of_cells (hman : ∀ x : X, IsManifoldPoint x) (hg : IsGraph V E) {𝓑 : Set + (Set X)} (h𝓑 : 𝓑.Finite) + (hd : ∀ B ∈ 𝓑, IsClosedDisc B) (𝓒 : Set X → Set (Set X)) (hc : ∀ B ∈ 𝓑, IsCells V B (⋃₀ E) + (𝓒 B)) (hin : ∀ x, ∃ B ∈ 𝓑, x ∈ discInt B) : + IsDissection V E (⋃ B ∈ 𝓑, 𝓒 B) := by + have hmem : ∀ {Φ}, Φ ∈ (⋃ B ∈ 𝓑, 𝓒 B) → ∃ B ∈ 𝓑, Φ ∈ 𝓒 B := fun {Φ} h => by simpa using h + have hdisc : ∀ Φ ∈ (⋃ B ∈ 𝓑, 𝓒 B), IsClosedDisc Φ := fun Φ h => by + obtain ⟨B, hB, hΦ⟩ := hmem h + exact (hc B hB).disc Φ hΦ + have hbd : ∀ Φ ∈ (⋃ B ∈ 𝓑, 𝓒 B), discBd Φ ⊆ ⋃₀ E := fun Φ h => by + obtain ⟨B, hB, hΦ⟩ := hmem h + exact (hc B hB).bd Φ hΦ + have hint : ∀ Φ ∈ (⋃ B ∈ 𝓑, 𝓒 B), Disjoint (discInt Φ) (⋃₀ E) := fun Φ h => by + obtain ⟨B, hB, hΦ⟩ := hmem h + exact (hc B hB).int Φ hΦ + have key : ∀ Φ ∈ (⋃ B ∈ 𝓑, 𝓒 B), ∀ Φ' ∈ (⋃ B ∈ 𝓑, 𝓒 B), ∀ z ∈ discInt Φ, z ∈ Φ' → Φ = Φ' + := fun Φ h Φ' h' z hz hz' => + eq_of_int_meet hman (hdisc Φ h) (hdisc Φ' h') (hbd Φ h) (hbd Φ' h') (hint Φ h) + (hint Φ' h') hz hz' + refine ⟨hg, h𝓑.biUnion fun B hB => (hc B hB).fin, hdisc, ?_, hbd, hint, ?_, ?_⟩ + · refine eq_univ_of_forall fun x => ?_ + obtain ⟨B, hB, hx⟩ := hin x + have h1 : x ∈ ⋃₀ 𝓒 B := by rw [(hc B hB).cover]; exact hx.1 + obtain ⟨Φ, hΦ, hxΦ⟩ := h1 + exact ⟨Φ, mem_biUnion hB hΦ, hxΦ⟩ + · intro Φ h Φ' h' hne + exact Set.disjoint_left.mpr fun z hz hz' => hne (key Φ h Φ' h' z hz hz') + · intro x hxV + obtain ⟨B, hB, hx⟩ := hin x + refine (encard_le_encard ?_).trans ((hc B hB).count x hxV) + rintro Φ ⟨h, hxΦ⟩ + have h1 := (hdisc Φ h).subset_closure_discInt hxΦ + obtain ⟨z, hz, hz'⟩ := mem_closure_iff.mp h1 _ ((hd B hB).isOpen_discInt hman) hx + have h2 : z ∈ ⋃₀ 𝓒 B := by rw [(hc B hB).cover]; exact hz.1 + obtain ⟨Ψ, hΨ, hzΨ⟩ := h2 + have h3 := key Φ h Ψ (mem_biUnion hB hΨ) z hz' hzΨ + exact ⟨h3 ▸ hΨ, hxΦ⟩ + +omit [T2Space X] in +theorem IsOArc.exists_three {P : Set X} (hP : IsOArc P) : ∃ a b d, a ∈ P ∧ b ∈ P ∧ d ∈ P ∧ a ≠ b + ∧ a ≠ d ∧ b ≠ d := by + obtain ⟨φ⟩ := id hP + have key : ∀ θ θ' : ℝ, θ ∈ Icc (0 : ℝ) 5 → θ' ∈ Icc (0 : ℝ) 5 → θ < θ' → + (φ (Circle.exp θ)).1 ≠ (φ (Circle.exp θ')).1 := fun θ θ' h1 h2 h3 he => by + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp (φ.injective (Subtype.ext he)) + have hpi := Real.pi_gt_three + rcases le_or_gt 0 m with h4 | h4 + · have h5 : (0 : ℝ) ≤ m := by exact_mod_cast h4 + nlinarith + · have h5 : (m : ℝ) ≤ -1 := by exact_mod_cast (by omega : m ≤ -1) + nlinarith [h1.1, h2.2] + exact ⟨_, _, _, (φ (Circle.exp 0)).2, (φ (Circle.exp 1)).2, (φ (Circle.exp 2)).2, + key 0 1 (by norm_num) (by norm_num) (by norm_num), key 0 2 (by norm_num) (by norm_num) + (by norm_num), + key 1 2 (by norm_num) (by norm_num) (by norm_num)⟩ + +omit [T2Space X] in +/-- A dissection of a connected closed surface around a given graph. The hypothesis `hZ` says that +the graph +hangs well on a set that stays connected when a point is removed, as soon as this set meets each `C +∈ 𝓒c` twice. -/ +theorem exists_dissection (hT : IsClosedSurface X) [ConnectedSpace X] {V₀ : Set X} {E₀ : Set + (Set X)} + (hg : IsGraph V₀ E₀) (hno : V₀ ⊆ ⋃₀ E₀) {𝓒c : Set (Set X)} (hfin : 𝓒c.Finite) + (hconn : ∀ C ∈ 𝓒c, TwoConn C) + (h3 : ∀ C ∈ 𝓒c, ∃ a b d, a ∈ C ∧ b ∈ C ∧ d ∈ C ∧ a ≠ b ∧ a ≠ d ∧ b ≠ d) + (hZ : ∀ G : Set X, TwoConn G → (∀ C ∈ 𝓒c, ∃ x y, x ∈ G ∩ C ∧ y ∈ G ∩ C ∧ x ≠ y) → TwoConn + (G ∪ ⋃₀ E₀)) : + ∃ (V : Set X) (E 𝓕 : Set (Set X)), V₀ ⊆ V ∧ ⋃₀ E₀ ⊆ ⋃₀ E ∧ IsDissection V E 𝓕 := by + classical + obtain ⟨hcpt, ht2, hint⟩ := id hT + have hman : ∀ x : X, IsManifoldPoint x := fun x => (hint x).isManifoldPoint + obtain ⟨x₀⟩ : Nonempty X := inferInstance + obtain ⟨U, h, g, c, -, -⟩ := (hint x₀).exists_ballChart (W := univ) isOpen_univ (mem_univ _) (R + := 3) (by norm_num) + obtain ⟨L, hL, hLu⟩ := hg.exists_list + obtain ⟨P, D, hPO, hPt, -, -, -, -, -⟩ := exists_tame_curve' hman c L hL + have hgrE : gr V₀ E₀ = ⋃₀ E₀ := union_eq_right.mpr hno + rw [hLu, ← hgrE] at hPt + obtain ⟨V1, E1, hV1, hg1, hgr1, hno1⟩ := hg.add_curve hPO hPt + obtain ⟨u, w, -, hu, hw, -, huw, -, -⟩ := hPO.exists_three + have hch : ∀ C : Set X, ∃ a b d : X, C ∈ 𝓒c → a ∈ C ∧ b ∈ C ∧ d ∈ C ∧ a ≠ b ∧ a ≠ d ∧ b ≠ d + := fun C => by + by_cases hC : C ∈ 𝓒c + · obtain ⟨a, b, d, h'⟩ := h3 C hC + exact ⟨a, b, d, fun _ => h'⟩ + · exact ⟨x₀, x₀, x₀, fun h' => absurd h' hC⟩ + choose a b d hcd using hch + let Pairs : Set (X × X) := insert (u, w) ((fun C => (a C, b C)) '' 𝓒c ∪ (fun C => + (a C, d C)) '' 𝓒c ∪ + (fun C => (b C, d C)) '' 𝓒c) + have hPf : Pairs.Finite := (((hfin.image _).union (hfin.image _)).union (hfin.image _)).insert _ + have hPne : ∀ p ∈ Pairs, p.1 ≠ p.2 := by + rintro p (rfl | ((⟨C, hC, rfl⟩ | ⟨C, hC, rfl⟩) | ⟨C, hC, rfl⟩)) + · exact huw + · exact (hcd C hC).2.2.2.1 + · exact (hcd C hC).2.2.2.2.1 + · exact (hcd C hC).2.2.2.2.2 + obtain ⟨V, E, G, 𝓑, hVV, hPG, hgE, hnoE, hgrG, hTC, hGc, h𝓑, hB, hin⟩ := exists_skeleton hT hg1 + (hno1 hno) + (G₀ := P) (Z := ⋃₀ E₀) (by rw [hgr1, hgrE, union_comm]) hPO.twoConn hPO.isCompact.isClosed hPf + hPne + (u := u) (w := w) (.inl rfl) hu hw + have hgrE2 : gr V E = ⋃₀ E := union_eq_right.mpr hnoE + have hmeet : ∀ C ∈ 𝓒c, ∃ x y, x ∈ G ∩ C ∧ y ∈ G ∩ C ∧ x ≠ y := by + intro C hC + by_contra hcon + push Not at hcon + obtain ⟨ha, hb, hd', hab, had, hbd⟩ := hcd C hC + obtain ⟨c0, hc0⟩ : ∃ c0, ∀ z ∈ G ∩ C, z = c0 := by + by_cases hne : (G ∩ C).Nonempty + · obtain ⟨c0, hc0⟩ := hne + exact ⟨c0, fun z hz => hcon z c0 hz hc0⟩ + · exact ⟨x₀, fun z hz => absurd ⟨z, hz⟩ hne⟩ + have hpair : ∃ p q, (p, q) ∈ Pairs ∧ p ∈ C ∧ q ∈ C ∧ p ≠ c0 ∧ q ≠ c0 := by + by_cases h1 : a C = c0 + · exact ⟨b C, d C, .inr (.inr ⟨C, hC, rfl⟩), hb, hd', fun h' => hab (h1.trans h'.symm), + fun h' => had (h1.trans h'.symm)⟩ + · by_cases h2 : b C = c0 + · exact ⟨a C, d C, .inr (.inl (.inr ⟨C, hC, rfl⟩)), ha, hd', h1, + fun h' => hbd (h2.trans h'.symm)⟩ + · exact ⟨a C, b C, .inr (.inl (.inl ⟨C, hC, rfl⟩)), ha, hb, h1, h2⟩ + obtain ⟨p, q, hpq, hpC, hqC, hpc, hqc⟩ := hpair + have hdisjG : Disjoint (C \ {c0}) G := Set.disjoint_left.mpr fun z hz hzG => hz.2 + (hc0 z ⟨hzG, hz.1⟩) + obtain ⟨B, hBm, hpB⟩ := hin p + obtain ⟨hdB, hbB, hpp⟩ := hB B hBm + rcases hdB.side hman (hconn C hC c0) (hdisjG.mono_right hbB) with h1 | h1 + · exact hpp (p, q) hpq ⟨hpB.1, (h1 ⟨hqC, hqc⟩).1⟩ + · exact Set.disjoint_left.mp h1 ⟨hpC, hpc⟩ hpB.1 + have hTC2 : TwoConn (⋃₀ E) := by + rw [← hgrE2, hgrG] + exact hZ G hTC hmeet + have hsub : G ⊆ ⋃₀ E := fun z hz => hgrE2 ▸ hgrG ▸ Or.inl hz + have hcells : ∀ B : Set X, ∃ 𝓒, B ∈ 𝓑 → IsCells V B (⋃₀ E) 𝓒 := fun B => by + by_cases hBm : B ∈ 𝓑 + · obtain ⟨hdB, hbB, -⟩ := hB B hBm + obtain ⟨𝓒, h𝓒⟩ := exists_cells hman hgE hTC2 hdB (hbB.trans hsub) (hgrE2 ▸ hbB.trans hsub) + exact ⟨𝓒, fun _ => h𝓒⟩ + · exact ⟨∅, fun h' => absurd h' hBm⟩ + choose 𝓒 h𝓒 using hcells + refine ⟨V, E, _, hV1.trans hVV, ?_, isDissection_of_cells hman hgE h𝓑 (fun B hBm => + (hB B hBm).1) 𝓒 h𝓒 hin⟩ + rw [← hgrE2, hgrG] + exact subset_union_right + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/DomainHomeo.lean b/LeanPool/GraphMinor/Surface/DomainHomeo.lean new file mode 100644 index 0000000000..8b3968c42b --- /dev/null +++ b/LeanPool/GraphMinor/Surface/DomainHomeo.lean @@ -0,0 +1,405 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DomainPair + +/-! +# A homeomorphism of `O`-arcs extends to their closed domains + +`exists_homeomorph_closedInner`: every homeomorphism between two `O`-arcs of the plane extends to a +homeomorphism between their closed domains. This is the heart of the Schoenflies theorem. + +Start from the pair `(F, F')`. Cut the left domains until they are small with `cutTree_small`, +matching each cut on the right. Then do the same with the sides exchanged. Repeating this gives +states `S_n` with mesh tending to `0` on both sides, each refining the last. The closed sets +`R_n = ⋃ (closure W × closure W')` over the pairs of `S_n` decrease, and their intersection is the +graph of a bijection: two domains of `S_n` that contain a point meet on their boundaries, and the +boundary maps then give a common point of the partners. The two projections of the compact set +`⋂ R_n` are homeomorphisms. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +variable {F₀ F₀' : Set ℂ} {h₀ k₀ : ℂ → ℂ} + +/-- Each pair of `S'` lies in a pair of `S`. -/ +def Refines (S' S : Set (Set ℂ × Set ℂ)) : Prop := + ∀ q ∈ S', ∃ r ∈ S, closedInner q.1 ⊆ closedInner r.1 ∧ closedInner q.2 ⊆ closedInner r.2 + +theorem Refines.trans {S₁ S₂ S₃ : Set (Set ℂ × Set ℂ)} (h : Refines S₁ S₂) (h' : Refines S₂ S₃) : + Refines S₁ S₃ := by + intro q hq + obtain ⟨r, hr, h1, h2⟩ := h q hq + obtain ⟨s, hs, h3, h4⟩ := h' r hr + exact ⟨s, hs, h1.trans h3, h2.trans h4⟩ + +theorem Refines.refl (S : Set (Set ℂ × Set ℂ)) : Refines S S := + fun q hq => ⟨q, hq, Subset.rfl, Subset.rfl⟩ + +theorem Refines.swap {S' S : Set (Set ℂ × Set ℂ)} (h : Refines S' S) : + Refines (Prod.swap '' S') (Prod.swap '' S) := by + rintro _ ⟨q, hq, rfl⟩ + obtain ⟨r, hr, h1, h2⟩ := h q hq + exact ⟨_, ⟨r, hr, rfl⟩, h2, h1⟩ + +/-- Following a tree of cuts from one pair of a state. -/ +theorem IsPairing.refine {P : Set ℂ → Prop} {F : Set ℂ} (ht : CutTree P F) : + ∀ {S : Set (Set ℂ × Set ℂ)} {h k : ℂ → ℂ}, IsPairing F₀ F₀' h₀ k₀ S h k → ∀ {F' : Set ℂ}, + (F, F') ∈ S → ∃ (S' : Set (Set ℂ × Set ℂ)) (h' k' : ℂ → ℂ), IsPairing F₀ F₀' h₀ k₀ S' h' k' ∧ + (∀ q ∈ S, q ≠ (F, F') → q ∈ S') ∧ + ∀ q ∈ S', (q ∈ S ∧ q ≠ (F, F')) ∨ + (P (inner q.1) ∧ closedInner q.1 ⊆ closedInner F ∧ closedInner q.2 ⊆ closedInner F') := by + induction ht with + | @leaf F hp => + intro S h k P' F' hq + refine ⟨S, h, k, P', fun q hq' _ => hq', fun q hq' => ?_⟩ + by_cases he : q = (F, F') + · subst he + exact Or.inr ⟨hp, Subset.rfl, Subset.rfl⟩ + · exact Or.inl ⟨hq', he⟩ + | @node F a b e c _ _ ih₁ ih₂ => + intro S h k P' F' hq + obtain ⟨φ⟩ := P'.oarc _ hq + have J := isJordanParts φ + obtain ⟨e', h₁, k₁, P₁, g2, g3, hne, hn1, hn2⟩ := P'.cut hq c + obtain ⟨-, f2, f3, -, -, -⟩ := c.closedInner_facts J + obtain ⟨S₂, h₂, k₂, P₂, h21, h22⟩ := ih₁ P₁ (Or.inl rfl) + have hb₂ : (side b e, side (h ∘ b) e') ∈ S₂ := h21 _ (Or.inr (Or.inl rfl)) (Ne.symm hne) + obtain ⟨S₃, h₃, k₃, P₃, h31, h32⟩ := ih₂ P₂ hb₂ + refine ⟨S₃, h₃, k₃, P₃, ?_, ?_⟩ + · intro q hqS hqne + have hq1 : q ∈ S \ {(F, F')} := ⟨hqS, hqne⟩ + refine h31 q (h21 q (Or.inr (Or.inr hq1)) fun he => hn1 (he ▸ hq1)) fun he => hn2 (he ▸ hq1) + · intro q hqS + rcases h32 q hqS with ⟨hq2, hne2⟩ | ⟨hp, h1, h2⟩ + · rcases h22 q hq2 with ⟨hq1, hne1⟩ | ⟨hp, h1, h2⟩ + · rcases hq1 with he | he | he + · exact absurd he hne1 + · exact absurd he hne2 + · exact Or.inl he + · exact Or.inr ⟨hp, h1.trans f2, h2.trans g2⟩ + · exact Or.inr ⟨hp, h1.trans f3, h2.trans g3⟩ + +/-- All left domains of a finite part of a state can be made small. -/ +private theorem IsPairing.make_small_aux {ε : ℝ} (hε : 0 < ε) {T : Set (Set ℂ × Set ℂ)} + (hT : T.Finite) : ∀ {S : Set (Set ℂ × Set ℂ)} {h k : ℂ → ℂ}, IsPairing F₀ F₀' h₀ k₀ S h k → + T ⊆ S → ∃ (S' : Set (Set ℂ × Set ℂ)) (h' k' : ℂ → ℂ), IsPairing F₀ F₀' h₀ k₀ S' h' k' ∧ + Refines S' S ∧ ∀ q ∈ S', q ∈ S \ T ∨ ∀ x ∈ inner q.1, ∀ y ∈ inner q.1, dist x y < ε := by + induction T, hT using Set.Finite.induction_on with + | empty => + intro S h k P _ + exact ⟨S, h, k, P, Refines.refl S, fun q hq => Or.inl ⟨hq, fun h => h⟩⟩ + | @insert p T hpT _ ih => + intro S h k P hsub + have hpS : p ∈ S := hsub (mem_insert _ _) + have hpS' : (p.1, p.2) ∈ S := hpS + obtain ⟨S₁, h₁, k₁, P₁, h1, h2⟩ := P.refine (cutTree_small (P.oarc p hpS) hε) hpS' + have hTS₁ : T ⊆ S₁ := fun q hq => h1 q (hsub (mem_insert_of_mem _ hq)) + (fun he => hpT (by + have he' : q = p := he + exact he' ▸ hq)) + obtain ⟨S₂, h₂, k₂, P₂, h3, h4⟩ := ih P₁ hTS₁ + refine ⟨S₂, h₂, k₂, P₂, h3.trans ?_, fun q hq => ?_⟩ + · intro q hq + rcases h2 q hq with ⟨hqS, -⟩ | ⟨-, h5, h6⟩ + · exact ⟨q, hqS, Subset.rfl, Subset.rfl⟩ + · exact ⟨p, hpS, h5, h6⟩ + · rcases h4 q hq with ⟨hq1, hq2⟩ | hsm + · rcases h2 q hq1 with ⟨hqS, hne⟩ | ⟨hp, -, -⟩ + · left + refine ⟨hqS, ?_⟩ + rintro (he | he) + · exact hne he + · exact hq2 he + · exact Or.inr hp + · exact Or.inr hsm + +/-- Two points of the closure of a set of small diameter are close. -/ +private theorem dist_le_of_closure {U : Set ℂ} {ε : ℝ} (hU : ∀ x ∈ U, ∀ y ∈ U, dist x y < ε) + {x y : ℂ} (hx : x ∈ closure U) (hy : y ∈ closure U) : dist x y ≤ ε := by + refine le_of_forall_pos_le_add fun η hη => ?_ + obtain ⟨x', hx', h1⟩ := Metric.mem_closure_iff.mp hx (η / 2) (half_pos hη) + obtain ⟨y', hy', h2⟩ := Metric.mem_closure_iff.mp hy (η / 2) (half_pos hη) + have h3 := hU x' hx' y' hy' + have h4 := dist_triangle x x' y + have h5 := dist_triangle x' y' y + rw [dist_comm y' y] at h5 + linarith + +/-- The diameters of the domains of a state are at most `ε`. -/ +def Mesh (ε : ℝ) (S : Set (Set ℂ × Set ℂ)) : Prop := + ∀ q ∈ S, (∀ x ∈ closedInner q.1, ∀ y ∈ closedInner q.1, dist x y ≤ ε) ∧ + ∀ x ∈ closedInner q.2, ∀ y ∈ closedInner q.2, dist x y ≤ ε + +/-- A state can be refined to one of mesh at most `ε`. -/ +theorem IsPairing.exists_mesh {S : Set (Set ℂ × Set ℂ)} {h k : ℂ → ℂ} + (P : IsPairing F₀ F₀' h₀ k₀ S h k) {ε : ℝ} (hε : 0 < ε) : + ∃ (S' : Set (Set ℂ × Set ℂ)) (h' k' : ℂ → ℂ), IsPairing F₀ F₀' h₀ k₀ S' h' k' ∧ + Refines S' S ∧ Mesh ε S' := by + have hsmall : ∀ {G : Set ℂ}, Nonempty (Circle ≃ₜ G) → + (∀ x ∈ inner G, ∀ y ∈ inner G, dist x y < ε) → + ∀ x ∈ closedInner G, ∀ y ∈ closedInner G, dist x y ≤ ε := by + rintro G ⟨φ⟩ hs x hx y hy + have h1 : closedInner G = closure (inner G) := (isJordanParts φ).closure_inner.symm + rw [h1] at hx hy + exact dist_le_of_closure hs hx hy + obtain ⟨S₁, h₁, k₁, P₁, r1, s1⟩ := P.make_small_aux hε P.fin Subset.rfl + have hs1 : ∀ q ∈ S₁, ∀ x ∈ inner q.1, ∀ y ∈ inner q.1, dist x y < ε := fun q hq => by + rcases s1 q hq with h' | h' + · exact absurd h'.1 h'.2 + · exact h' + obtain ⟨S₂, h₂, k₂, P₂, r2, s2⟩ := P₁.swap.make_small_aux hε P₁.swap.fin Subset.rfl + have hs2 : ∀ q ∈ S₂, ∀ x ∈ inner q.1, ∀ y ∈ inner q.1, dist x y < ε := fun q hq => by + rcases s2 q hq with h' | h' + · exact absurd h'.1 h'.2 + · exact h' + have P₃ := P₂.swap + refine ⟨Prod.swap '' S₂, k₂, h₂, P₃, ?_, ?_⟩ + · refine Refines.trans ?_ r1 + have hsw := r2.swap + rwa [image_image, show (fun x : Set ℂ × Set ℂ => Prod.swap (Prod.swap x)) = id from + funext Prod.swap_swap, image_id] at hsw + · rintro _ ⟨q, hq, rfl⟩ + refine ⟨?_, hsmall (P₂.oarc q hq) (hs2 q hq)⟩ + obtain ⟨r, ⟨r', hr', rfl⟩, h3, h4⟩ := r2 q hq + exact fun x hx y hy => hsmall (P₁.oarc r' hr') (hs1 r' hr') x (h4 hx) y (h4 hy) + +/-- The relation of a state. -/ +def stateRel (S : Set (Set ℂ × Set ℂ)) : Set (ℂ × ℂ) := + ⋃ q ∈ S, closedInner q.1 ×ˢ closedInner q.2 + +/-- Two partners of one point are close. -/ +theorem IsPairing.dist_le {S : Set (Set ℂ × Set ℂ)} {h k : ℂ → ℂ} + (P : IsPairing F₀ F₀' h₀ k₀ S h k) {ε : ℝ} (hm : Mesh ε S) {x y y' : ℂ} + (hy : (x, y) ∈ stateRel S) (hy' : (x, y') ∈ stateRel S) : dist y y' ≤ 2 * ε := by + obtain ⟨q, hq, hxy⟩ := mem_iUnion₂.mp hy + obtain ⟨q', hq', hxy'⟩ := mem_iUnion₂.mp hy' + have hε : 0 ≤ ε := by + have := (hm q hq).2 y hxy.2 y hxy.2 + rwa [dist_self] at this + by_cases he : q = q' + · subst he + have := (hm q hq).2 y hxy.2 y' hxy'.2 + linarith + · have hz := P.meet q hq q' hq' he ⟨hxy.1, hxy'.1⟩ + have h1 : h x ∈ q.2 := (P.bd q hq).1 hz.1 + have h2 : h x ∈ q'.2 := (P.bd q' hq').1 hz.2 + have h3 := (hm q hq).2 y hxy.2 (h x) (Or.inr h1) + have h4 := (hm q' hq').2 (h x) (Or.inr h2) y' hxy'.2 + have h5 := dist_triangle y (h x) y' + linarith + +theorem stateRel_swap {S : Set (Set ℂ × Set ℂ)} {x y : ℂ} : + (x, y) ∈ stateRel S ↔ (y, x) ∈ stateRel (Prod.swap '' S) := by + constructor + · intro hxy + obtain ⟨q, hq, h1⟩ := mem_iUnion₂.mp hxy + exact mem_iUnion₂.mpr ⟨_, ⟨q, hq, rfl⟩, h1.2, h1.1⟩ + · intro hxy + obtain ⟨_, ⟨q, hq, rfl⟩, h1⟩ := mem_iUnion₂.mp hxy + exact mem_iUnion₂.mpr ⟨q, hq, h1.2, h1.1⟩ + +theorem Mesh.swap {ε : ℝ} {S : Set (Set ℂ × Set ℂ)} (h : Mesh ε S) : Mesh ε (Prod.swap '' S) := by + rintro _ ⟨q, hq, rfl⟩ + exact ⟨(h q hq).2, (h q hq).1⟩ + +private theorem IsPairing.exists_partner {S : Set (Set ℂ × Set ℂ)} {h k : ℂ → ℂ} + (P : IsPairing F₀ F₀' h₀ k₀ S h k) {x : ℂ} (hx : x ∈ closedInner F₀) : + ∃ y, (x, y) ∈ stateRel S := by + rw [← P.cov] at hx + obtain ⟨q, hq, hxq⟩ := mem_iUnion₂.mp hx + obtain ⟨φ⟩ := P.oarc' q hq + obtain ⟨y, hy⟩ := (isJordanParts φ).isConnected_inner.nonempty + exact ⟨y, mem_iUnion₂.mpr ⟨q, hq, hxq, Or.inl hy⟩⟩ + +private theorem isCompact_closedInner {G : Set ℂ} (hG : Nonempty (Circle ≃ₜ G)) : + IsCompact (closedInner G) := by + obtain ⟨φ⟩ := hG + exact (isJordanParts φ).isCompact_closure_inner + +private theorem IsPairing.isCompact_stateRel {S : Set (Set ℂ × Set ℂ)} {h k : ℂ → ℂ} + (P : IsPairing F₀ F₀' h₀ k₀ S h k) : IsCompact (stateRel S) := + P.fin.isCompact_biUnion fun q hq => + (isCompact_closedInner (P.oarc q hq)).prod (isCompact_closedInner (P.oarc' q hq)) + +private theorem nested_inter {R : ℕ → Set (ℂ × ℂ)} (hanti : Antitone R) + (hc : ∀ n, IsCompact (R n)) {A : Set (ℂ × ℂ)} (hA : IsClosed A) + (hne : ∀ n, (R n ∩ A).Nonempty) : ((⋂ n, R n) ∩ A).Nonempty := by + have h := IsCompact.nonempty_iInter_of_sequence_nonempty_isCompact_isClosed + (fun n => R n ∩ A) (fun n => inter_subset_inter_left _ (hanti (Nat.le_succ n))) hne + ((hc 0).inter_right hA) (fun n => (hc n).isClosed.inter hA) + obtain ⟨z, hz⟩ := h + exact ⟨z, mem_iInter.mpr fun n => (mem_iInter.mp hz n).1, (mem_iInter.mp hz 0).2⟩ + +/-- A sequence of states, each refining the last, with mesh tending to `0`. -/ +private theorem exists_state_seq {F F' : Set ℂ} (hF : Nonempty (Circle ≃ₜ F)) + (hF' : Nonempty (Circle ≃ₜ F')) {h₀ k₀ : ℂ → ℂ} (m : BdMatch F F' h₀ k₀) : + ∃ (S : ℕ → Set (Set ℂ × Set ℂ)) (h k : ℕ → ℂ → ℂ), + (∀ n, IsPairing F F' h₀ k₀ (S n) (h n) (k n)) ∧ (∀ n, Refines (S (n + 1)) (S n)) ∧ + ∀ n : ℕ, Mesh (1 / ((n : ℝ) + 1)) (S (n + 1)) := by + classical + have P₀ : IsPairing F F' h₀ k₀ {(F, F')} h₀ k₀ := by + refine ⟨finite_singleton _, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, fun _ _ => rfl, fun _ _ => rfl⟩ + · rintro _ rfl + exact hF + · rintro _ rfl + exact hF' + · rintro _ rfl + exact m + · simp + · simp + · rintro _ rfl _ rfl hne + exact absurd rfl hne + · rintro _ rfl _ rfl hne + exact absurd rfl hne + · rintro _ rfl z hz + exact hz.2 + · rintro _ rfl z hz + exact hz.2 + let St := {x : Set (Set ℂ × Set ℂ) × (ℂ → ℂ) × (ℂ → ℂ) // IsPairing F F' h₀ k₀ x.1 x.2.1 x.2.2} + have hstep : ∀ (n : ℕ) (x : St), ∃ y : St, Refines y.1.1 x.1.1 ∧ Mesh (1 / ((n : ℝ) + 1)) y.1.1 + := by + intro n x + obtain ⟨S', h', k', P', r, hm⟩ := x.2.exists_mesh (ε := 1 / ((n : ℝ) + 1)) (by positivity) + exact ⟨⟨(S', h', k'), P'⟩, r, hm⟩ + choose next hnext1 hnext2 using hstep + let X : ℕ → St := fun n => Nat.rec ⟨({(F, F')}, h₀, k₀), P₀⟩ next n + have hXs : ∀ n, X (n + 1) = next n (X n) := fun n => rfl + refine ⟨fun n => (X n).1.1, fun n => (X n).1.2.1, fun n => (X n).1.2.2, fun n => (X n).2, + fun n => ?_, fun n => ?_⟩ + · change Refines (X (n + 1)).1.1 (X n).1.1 + rw [hXs] + exact hnext1 n (X n) + · change Mesh _ (X (n + 1)).1.1 + rw [hXs] + exact hnext2 n (X n) + +/-- **Extension to the closed domains.** Every homeomorphism between two `O`-arcs of the plane +extends to a homeomorphism between their closed domains. See the module docstring for the route. -/ +theorem exists_homeomorph_closedInner {F F' : Set ℂ} (hF : Nonempty (Circle ≃ₜ F)) + (hF' : Nonempty (Circle ≃ₜ F')) {h₀ k₀ : ℂ → ℂ} (m : BdMatch F F' h₀ k₀) : + ∃ Ψ : closedInner F ≃ₜ closedInner F', ∀ x : closedInner F, x.1 ∈ F → (Ψ x).1 = h₀ x.1 := by + classical + obtain ⟨S, hs, ks, hP, hRef, hMesh⟩ := exists_state_seq hF hF' m + let R : ℕ → Set (ℂ × ℂ) := fun n => stateRel (S n) + have hRanti : Antitone R := antitone_nat_of_succ_le fun n z hz => by + obtain ⟨q, hq, h1⟩ := mem_iUnion₂.mp hz + obtain ⟨r, hr, h2, h3⟩ := hRef n q hq + exact mem_iUnion₂.mpr ⟨r, hr, h2 h1.1, h3 h1.2⟩ + have hRc : ∀ n, IsCompact (R n) := fun n => (hP n).isCompact_stateRel + have hsub : ∀ n, ∀ z ∈ R n, z.1 ∈ closedInner F ∧ z.2 ∈ closedInner F' := by + intro n z hz + obtain ⟨q, hq, h1⟩ := mem_iUnion₂.mp hz + exact ⟨(hP n).cov ▸ mem_iUnion₂.mpr ⟨q, hq, h1.1⟩, (hP n).cov' ▸ mem_iUnion₂.mpr ⟨q, hq, h1.2⟩⟩ + set Rinf := ⋂ n, R n with hRinf + have hRinfc : IsCompact Rinf := + (hRc 0).of_isClosed_subset (isClosed_iInter fun n => (hRc n).isClosed) (iInter_subset _ 0) + have hmemR : ∀ {z}, z ∈ Rinf → ∀ n, z ∈ R n := fun hz n => mem_iInter.mp hz n + have hsmall : ∀ {a b : ℂ}, (∀ n : ℕ, dist a b ≤ 2 * (1 / ((n : ℝ) + 1))) → a = b := by + intro a b hab + refine eq_of_forall_dist_le fun ε hε => ?_ + obtain ⟨n, hn⟩ := exists_nat_gt (2 / ε) + refine (hab n).trans ?_ + have hpos : (0 : ℝ) < (n : ℝ) + 1 := by positivity + have h1 : 2 / ε < (n : ℝ) + 1 := by linarith + rw [mul_one_div, div_le_iff₀ hpos] + rw [div_lt_iff₀ hε] at h1 + linarith + have huniq : ∀ {x y y' : ℂ}, (x, y) ∈ Rinf → (x, y') ∈ Rinf → y = y' := fun hy hy' => + hsmall fun n => (hP (n + 1)).dist_le (hMesh n) (hmemR hy _) (hmemR hy' _) + have huniq' : ∀ {x x' y : ℂ}, (x, y) ∈ Rinf → (x', y) ∈ Rinf → x = x' := fun hy hy' => + hsmall fun n => (hP (n + 1)).swap.dist_le (hMesh n).swap (stateRel_swap.mp (hmemR hy _)) + (stateRel_swap.mp (hmemR hy' _)) + have hex : ∀ x ∈ closedInner F, ∃ y, (x, y) ∈ Rinf := by + intro x hx + obtain ⟨z, hz, hzA⟩ := nested_inter hRanti hRc (A := {x} ×ˢ univ) + (isClosed_singleton.prod isClosed_univ) (fun n => by + obtain ⟨y, hy⟩ := (hP n).exists_partner hx + exact ⟨(x, y), hy, rfl, mem_univ _⟩) + obtain ⟨z1, z2⟩ := z + have : z1 = x := hzA.1 + subst this + exact ⟨z2, hz⟩ + have hex' : ∀ y ∈ closedInner F', ∃ x, (x, y) ∈ Rinf := by + intro y hy + obtain ⟨z, hz, hzA⟩ := nested_inter hRanti hRc (A := univ ×ˢ {y}) + (isClosed_univ.prod isClosed_singleton) (fun n => by + obtain ⟨x, hx⟩ := (hP n).swap.exists_partner hy + exact ⟨(x, y), stateRel_swap.mpr hx, mem_univ _, rfl⟩) + obtain ⟨z1, z2⟩ := z + have : z2 = y := hzA.2 + subst this + exact ⟨z1, hz⟩ + have : CompactSpace Rinf := isCompact_iff_compactSpace.mp hRinfc + have hmem₀ : ∀ z : Rinf, z.1.1 ∈ closedInner F ∧ z.1.2 ∈ closedInner F' := fun z => + hsub 0 z.1 (hmemR z.2 0) + let π₁ : Rinf → closedInner F := fun z => ⟨z.1.1, (hmem₀ z).1⟩ + let π₂ : Rinf → closedInner F' := fun z => ⟨z.1.2, (hmem₀ z).2⟩ + have hπ₁c : Continuous π₁ := + Continuous.subtype_mk (continuous_fst.comp continuous_subtype_val) _ + have hπ₂c : Continuous π₂ := + Continuous.subtype_mk (continuous_snd.comp continuous_subtype_val) _ + have hπ₁b : Function.Bijective π₁ := by + constructor + · rintro ⟨⟨x, y⟩, hz⟩ ⟨⟨x', y'⟩, hz'⟩ he + have h1 : x = x' := congrArg Subtype.val he + subst h1 + have h2 := huniq hz hz' + subst h2 + rfl + · rintro ⟨x, hx⟩ + obtain ⟨y, hy⟩ := hex x hx + exact ⟨⟨(x, y), hy⟩, rfl⟩ + have hπ₂b : Function.Bijective π₂ := by + constructor + · rintro ⟨⟨x, y⟩, hz⟩ ⟨⟨x', y'⟩, hz'⟩ he + have h1 : y = y' := congrArg Subtype.val he + subst h1 + have h2 := huniq' hz hz' + subst h2 + rfl + · rintro ⟨y, hy⟩ + obtain ⟨x, hx⟩ := hex' y hy + exact ⟨⟨(x, y), hx⟩, rfl⟩ + have : CompactSpace (closedInner F) := isCompact_iff_compactSpace.mp (isCompact_closedInner hF) + have : CompactSpace (closedInner F') := isCompact_iff_compactSpace.mp (isCompact_closedInner hF') + let E₁ : Rinf ≃ₜ closedInner F := + Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective π₁ hπ₁b) hπ₁c + let E₂ : Rinf ≃ₜ closedInner F' := + Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective π₂ hπ₂b) hπ₂c + refine ⟨E₁.symm.trans E₂, fun x hxF => ?_⟩ + -- A point of `F` and its image lie in the limit relation. + have hin : (x.1, h₀ x.1) ∈ Rinf := by + refine mem_iInter.mpr fun n => ?_ + have hx : x.1 ∈ ⋃ q ∈ S n, closedInner q.1 := by + rw [(hP n).cov] + exact x.2 + obtain ⟨q, hq, hxq⟩ := mem_iUnion₂.mp hx + have hxq1 : x.1 ∈ q.1 := (hP n).top q hq ⟨hxq, hxF⟩ + have h1 := (hP n).bd q hq |>.1 hxq1 + rw [(hP n).ext hxF] at h1 + exact mem_iUnion₂.mpr ⟨q, hq, hxq, Or.inr h1⟩ + obtain ⟨z, hz⟩ := hπ₁b.2 x + have hzs : E₁.symm x = z := by + apply E₁.injective + rw [E₁.apply_symm_apply] + exact hz.symm + change (E₂ (E₁.symm x)).1 = h₀ x.1 + rw [hzs] + have h1 : z.1.1 = x.1 := congrArg Subtype.val hz + have h2 : (z.1.1, z.1.2) ∈ Rinf := z.2 + rw [h1] at h2 + exact huniq h2 hin + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/DomainPair.lean b/LeanPool/GraphMinor/Surface/DomainPair.lean new file mode 100644 index 0000000000..255a42e802 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/DomainPair.lean @@ -0,0 +1,471 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Mesh + +/-! +# Matching cuts of two Jordan domains + +`IsPairing` is the state of the proof of the Schoenflies theorem: finitely many pairs of `O`-arcs +`(G, G')`, a homeomorphism from each `G` to `G'` given by one global pair of maps, such that the +closed domains cover the two given closed domains and meet only along their boundaries. +`IsPairing.cut` cuts one pair: a cross-cut of `G` is matched with a cross-cut of `G'`, which exists +because every point of an `O`-arc is accessible. `IsPairing.refine` follows a whole tree of cuts. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +local notation "𝕀" => unitInterval + +/-- `h` and `k` are inverse homeomorphisms between `F` and `F'`. -/ +def BdMatch (F F' : Set ℂ) (h k : ℂ → ℂ) : Prop := + MapsTo h F F' ∧ MapsTo k F' F ∧ LeftInvOn k h F ∧ RightInvOn k h F' ∧ + ContinuousOn h F ∧ ContinuousOn k F' + +theorem BdMatch.symm {F F' : Set ℂ} {h k : ℂ → ℂ} (m : BdMatch F F' h k) : BdMatch F' F k h := + ⟨m.2.1, m.1, m.2.2.2.1, m.2.2.1, m.2.2.2.2.2, m.2.2.2.2.1⟩ + +theorem BdMatch.congr {F F' : Set ℂ} {h k h' k' : ℂ → ℂ} (m : BdMatch F F' h k) (e : EqOn h' h F) + (e' : EqOn k' k F') : BdMatch F F' h' k' := by + obtain ⟨m1, m2, m3, m4, m5, m6⟩ := m + refine ⟨fun x hx => e hx ▸ m1 hx, fun x hx => e' hx ▸ m2 hx, ?_, ?_, m5.congr e, m6.congr e'⟩ + · intro x hx + show k' (h' x) = x + rw [e hx, e' (m1 hx)] + exact m3 hx + · intro x hx + show h' (k' x) = x + rw [e' hx, e (m2 hx)] + exact m4 hx + +/-- An injective path has a continuous inverse on its range. -/ +theorem IsArcMap.exists_inv {e : 𝕀 → ℂ} (he : IsArcMap e) : + ∃ ι : ℂ → 𝕀, (∀ t, ι (e t) = t) ∧ ContinuousOn ι (range e) := by + classical + have hemb := (he.1.isClosedEmbedding he.2).isEmbedding + let E := hemb.toHomeomorph + refine ⟨fun z => if hz : z ∈ range e then E.symm ⟨z, hz⟩ else 0, fun t => ?_, ?_⟩ + · have hm : e t ∈ range e := ⟨t, rfl⟩ + simp only [hm, dite_true] + exact E.symm_apply_apply t + · rw [continuousOn_iff_continuous_domRestrict] + have : (range e).domRestrict (fun z => if hz : z ∈ range e then E.symm ⟨z, hz⟩ else 0) = + fun z : range e => E.symm z := by + ext z + simp [Set.domRestrict, z.2] + rw [this] + exact E.symm.continuous + +/-- Two arcs with values prescribed along them give a homeomorphism of their unions. -/ +theorem bdMatch_of_arcs {c e c' e' : 𝕀 → ℂ} (hc : IsArcMap c) (he : IsArcMap e) (hc' : IsArcMap c') + (he' : IsArcMap e') {h k : ℂ → ℂ} (h1 : ∀ s, h (c s) = c' s) (h2 : ∀ s, h (e s) = e' s) + (k1 : ∀ s, k (c' s) = c s) (k2 : ∀ s, k (e' s) = e s) : + BdMatch (range c ∪ range e) (range c' ∪ range e') h k := by + have hclosed : ∀ {d : 𝕀 → ℂ}, IsArcMap d → IsClosed (range d) := fun hd => + (isCompact_range hd.1).isClosed + have hcont : ∀ {d d' : 𝕀 → ℂ} {f : ℂ → ℂ}, IsArcMap d → IsArcMap d' → (∀ s, f (d s) = d' s) → + ContinuousOn f (range d) := by + intro d d' f hd hd' hf + obtain ⟨ι, hι, hιc⟩ := hd.exists_inv + refine (hd'.1.comp_continuousOn hιc).congr ?_ + rintro _ ⟨s, rfl⟩ + change f (d s) = d' (ι (d s)) + rw [hι, hf] + refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ + · rintro _ (⟨s, rfl⟩ | ⟨s, rfl⟩) + · exact Or.inl ⟨s, (h1 s).symm⟩ + · exact Or.inr ⟨s, (h2 s).symm⟩ + · rintro _ (⟨s, rfl⟩ | ⟨s, rfl⟩) + · exact Or.inl ⟨s, (k1 s).symm⟩ + · exact Or.inr ⟨s, (k2 s).symm⟩ + · rintro _ (⟨s, rfl⟩ | ⟨s, rfl⟩) + · show k (h (c s)) = c s + rw [h1, k1] + · show k (h (e s)) = e s + rw [h2, k2] + · rintro _ (⟨s, rfl⟩ | ⟨s, rfl⟩) + · show h (k (c' s)) = c' s + rw [k1, h1] + · show h (k (e' s)) = e' s + rw [k2, h2] + · exact (hcont hc hc' h1).union_of_isClosed (hcont he he' h2) (hclosed hc) (hclosed he) + · exact (hcont hc' hc k1).union_of_isClosed (hcont he' he k2) (hclosed hc') (hclosed he') + +/-- The state of the construction, for fixed outer curves and boundary maps. -/ +structure IsPairing (F₀ F₀' : Set ℂ) (h₀ k₀ : ℂ → ℂ) (S : Set (Set ℂ × Set ℂ)) (h k : ℂ → ℂ) : + Prop where + fin : S.Finite + oarc : ∀ q ∈ S, Nonempty (Circle ≃ₜ q.1) + oarc' : ∀ q ∈ S, Nonempty (Circle ≃ₜ q.2) + bd : ∀ q ∈ S, BdMatch q.1 q.2 h k + cov : ⋃ q ∈ S, closedInner q.1 = closedInner F₀ + cov' : ⋃ q ∈ S, closedInner q.2 = closedInner F₀' + meet : ∀ q ∈ S, ∀ q' ∈ S, q ≠ q' → closedInner q.1 ∩ closedInner q'.1 ⊆ q.1 ∩ q'.1 + meet' : ∀ q ∈ S, ∀ q' ∈ S, q ≠ q' → closedInner q.2 ∩ closedInner q'.2 ⊆ q.2 ∩ q'.2 + top : ∀ q ∈ S, closedInner q.1 ∩ F₀ ⊆ q.1 + top' : ∀ q ∈ S, closedInner q.2 ∩ F₀' ⊆ q.2 + ext : EqOn h h₀ F₀ + ext' : EqOn k k₀ F₀' + +variable {F₀ F₀' : Set ℂ} {h₀ k₀ : ℂ → ℂ} {S : Set (Set ℂ × Set ℂ)} {h k : ℂ → ℂ} + +/-- The state seen from the other side. -/ +theorem IsPairing.swap (P : IsPairing F₀ F₀' h₀ k₀ S h k) : + IsPairing F₀' F₀ k₀ h₀ (Prod.swap '' S) k h := by + refine ⟨P.fin.image _, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, P.ext', P.ext⟩ + · rintro _ ⟨q, hq, rfl⟩ + exact P.oarc' q hq + · rintro _ ⟨q, hq, rfl⟩ + exact P.oarc q hq + · rintro _ ⟨q, hq, rfl⟩ + exact (P.bd q hq).symm + · rw [biUnion_image] + exact P.cov' + · rw [biUnion_image] + exact P.cov + · rintro _ ⟨q, hq, rfl⟩ _ ⟨q', hq', rfl⟩ hne + exact P.meet' q hq q' hq' fun e => hne (e ▸ rfl) + · rintro _ ⟨q, hq, rfl⟩ _ ⟨q', hq', rfl⟩ hne + exact P.meet q hq q' hq' fun e => hne (e ▸ rfl) + · rintro _ ⟨q, hq, rfl⟩ + exact P.top' q hq + · rintro _ ⟨q, hq, rfl⟩ + exact P.top q hq + +/-- The closed domain of a side of a cut lies in the closed domain, and the sides fill it. -/ +theorem IsCut.closedInner_facts {F : Set ℂ} {a b e : 𝕀 → ℂ} (c : IsCut F a b e) + (J : IsJordanParts F) : + closedInner (side a e) ∪ closedInner (side b e) = closedInner F ∧ + closedInner (side a e) ⊆ closedInner F ∧ closedInner (side b e) ⊆ closedInner F ∧ + closedInner (side a e) ∩ closedInner (side b e) ⊆ range e ∧ + closedInner (side a e) ∩ F ⊆ range a ∧ closedInner (side b e) ∩ F ⊆ range b := by + have T := c.isTheta J + have hrange : range e ⊆ closedInner F := by + rintro _ ⟨t, rfl⟩ + by_cases h0 : t = 0 + · exact Or.inr (by rw [h0, ← c.a_zero]; exact c.a_mem 0) + · by_cases h1 : t = 1 + · exact Or.inr (by rw [h1, ← c.a_one]; exact c.a_mem 1) + · exact Or.inl (c.inside t h0 h1) + have hsub : ∀ {d : 𝕀 → ℂ}, (range d ⊆ F) → inner (side d e) ⊆ inner F → + closedInner (side d e) ⊆ closedInner F := by + intro d hd hin z hz + rcases hz with hz | hz | hz + · exact Or.inl (hin hz) + · exact Or.inr (hd hz) + · exact hrange hz + have ha : range a ⊆ F := by rintro _ ⟨s, rfl⟩; exact c.a_mem s + have hb : range b ⊆ F := by rintro _ ⟨s, rfl⟩; exact c.b_mem s + have h1 := hsub ha T.inner_subset₁ + have h2 := hsub hb T.symm.inner_subset₁ + have hnotF : ∀ {d : 𝕀 → ℂ} {z : ℂ}, z ∈ closedInner (side d e) → z ∈ F → z ∉ inner (side d e) → + z ∈ range d ∨ z ∈ range e := fun hz _ hn => hz.resolve_left hn + refine ⟨?_, h1, h2, ?_, ?_, ?_⟩ + · refine Subset.antisymm (union_subset h1 h2) ?_ + intro z hz + by_cases hze : z ∈ range e + · exact Or.inl (Or.inr (Or.inr hze)) + rcases hz with hz | hz + · have hmem : z ∈ inner F \ range e := ⟨hz, hze⟩ + rw [T.inner_sdiff] at hmem + rcases hmem with h' | h' + · exact Or.inl (Or.inl h') + · exact Or.inr (Or.inl h') + · rw [← c.union] at hz + rcases hz with h' | h' + · exact Or.inl (Or.inr (Or.inl h')) + · exact Or.inr (Or.inr (Or.inl h')) + · rintro z ⟨hz1, hz2⟩ + rcases hz1 with hz1 | hz1 | hz1 + · rcases hz2 with hz2 | hz2 | hz2 + · exact absurd hz2 (Set.disjoint_left.mp T.disjoint_inner hz1) + · exact absurd (hb hz2) (Set.disjoint_left.mp T.inner_disjoint_F hz1) + · exact absurd (Or.inr hz2) hz1.1 + · rcases hz2 with hz2 | hz2 | hz2 + · exact absurd (ha hz1) (Set.disjoint_left.mp T.symm.inner_disjoint_F hz2) + · rcases c.meet _ _ (show a (Classical.choose hz1) = b (Classical.choose hz2) by + rw [Classical.choose_spec hz1, Classical.choose_spec hz2]) with ⟨h3, -⟩ | ⟨h3, -⟩ + · refine ⟨0, ?_⟩ + rw [← c.a_zero, ← h3, Classical.choose_spec hz1] + · refine ⟨1, ?_⟩ + rw [← c.a_one, ← h3, Classical.choose_spec hz1] + · exact hz2 + · exact hz1 + · rintro z ⟨hz1, hzF⟩ + rcases hz1 with hz1 | hz1 | hz1 + · exact absurd hzF (Set.disjoint_left.mp T.inner_disjoint_F hz1) + · exact hz1 + · obtain ⟨t, rfl⟩ := hz1 + by_cases h0 : t = 0 + · exact ⟨0, by rw [h0, c.a_zero]⟩ + · by_cases h3 : t = 1 + · exact ⟨1, by rw [h3, c.a_one]⟩ + · exact absurd hzF (c.e_notMem h0 h3) + · rintro z ⟨hz1, hzF⟩ + rcases hz1 with hz1 | hz1 | hz1 + · exact absurd hzF (Set.disjoint_left.mp T.symm.inner_disjoint_F hz1) + · exact hz1 + · obtain ⟨t, rfl⟩ := hz1 + by_cases h0 : t = 0 + · exact ⟨0, by rw [h0, c.b_zero]⟩ + · by_cases h3 : t = 1 + · exact ⟨1, by rw [h3, c.b_one]⟩ + · exact absurd hzF (c.e_notMem h0 h3) + +/-- The side of a cut meets an outside set only on the side. -/ +theorem IsCut.meet_side {F : Set ℂ} {a b e : 𝕀 → ℂ} (c : IsCut F a b e) (J : IsJordanParts F) + {G : Set ℂ} (hG : closedInner F ∩ closedInner G ⊆ F ∩ G) : + closedInner (side a e) ∩ closedInner G ⊆ side a e ∩ G := by + obtain ⟨-, h1, -, -, h5, -⟩ := c.closedInner_facts J + rintro z ⟨hz1, hz2⟩ + have hz := hG ⟨h1 hz1, hz2⟩ + exact ⟨Or.inl (h5 ⟨hz1, hz.1⟩), hz.2⟩ + +theorem IsCut.meet_sides {F : Set ℂ} {a b e : 𝕀 → ℂ} (c : IsCut F a b e) (J : IsJordanParts F) : + closedInner (side a e) ∩ closedInner (side b e) ⊆ side a e ∩ side b e := by + obtain ⟨-, -, -, h4, -, -⟩ := c.closedInner_facts J + exact fun z hz => ⟨Or.inr (h4 hz), Or.inr (h4 hz)⟩ + +theorem IsCut.mem_range_of_mem {F : Set ℂ} {a b e : 𝕀 → ℂ} (c : IsCut F a b e) {z : ℂ} (hz : z ∈ F) + (he : z ∈ range e) : z = e 0 ∨ z = e 1 := by + obtain ⟨t, rfl⟩ := he + by_cases h0 : t = 0 + · left + rw [h0] + · by_cases h1 : t = 1 + · right + rw [h1] + · exact absurd hz (c.e_notMem h0 h1) + +private theorem cover_replace {Q : Type*} {S : Set Q} (region : Q → Set ℂ) + {q a b : Q} {U : Set ℂ} (hq : q ∈ S) + (hsplit : closedInner (region q) = closedInner (region a) ∪ closedInner (region b)) + (ha : closedInner (region a) ⊆ closedInner (region q)) + (hb : closedInner (region b) ⊆ closedInner (region q)) + (hcover : (⋃ r ∈ S, closedInner (region r)) = U) : + (⋃ r ∈ insert a (insert b (S \ {q})), closedInner (region r)) = U := by + refine Subset.antisymm ?_ ?_ + · refine iUnion₂_subset ?_ + rintro r (rfl | rfl | hr) + · exact ha.trans ((subset_iUnion₂_of_subset q hq Subset.rfl).trans hcover.subset) + · exact hb.trans ((subset_iUnion₂_of_subset q hq Subset.rfl).trans hcover.subset) + · exact (subset_iUnion₂_of_subset r hr.1 Subset.rfl).trans hcover.subset + · rw [← hcover] + refine iUnion₂_subset fun r hr => ?_ + by_cases heq : r = q + · subst r + intro z hz + rw [hsplit] at hz + rcases hz with hz | hz + · exact mem_iUnion₂.mpr ⟨a, Or.inl rfl, hz⟩ + · exact mem_iUnion₂.mpr ⟨b, Or.inr (Or.inl rfl), hz⟩ + · exact subset_iUnion₂_of_subset r (Or.inr (Or.inr ⟨hr, heq⟩)) Subset.rfl + +/-- The cut of one pair of a state, in terms of the maps. -/ +theorem IsPairing.cut (P : IsPairing F₀ F₀' h₀ k₀ S h k) {F F' : Set ℂ} (hq : (F, F') ∈ S) + {a b e : 𝕀 → ℂ} (c : IsCut F a b e) : + ∃ (e' : 𝕀 → ℂ) (h' k' : ℂ → ℂ), IsPairing F₀ F₀' h₀ k₀ + (insert (side a e, side (h ∘ a) e') (insert (side b e, side (h ∘ b) e') (S \ {(F, F')}))) + h' k' ∧ + closedInner (side (h ∘ a) e') ⊆ closedInner F' ∧ + closedInner (side (h ∘ b) e') ⊆ closedInner F' ∧ + (side a e, side (h ∘ a) e') ≠ (side b e, side (h ∘ b) e') ∧ + (side a e, side (h ∘ a) e') ∉ S \ {(F, F')} ∧ + (side b e, side (h ∘ b) e') ∉ S \ {(F, F')} := by + classical + obtain ⟨m1, m2, m3, m4, m5, m6⟩ := P.bd _ hq + obtain ⟨φ⟩ := P.oarc _ hq + obtain ⟨φ'⟩ := P.oarc' _ hq + simp only at m1 m2 m3 m4 m5 m6 φ φ' + have J := isJordanParts φ + have J' := isJordanParts φ' + have harc : ∀ {d : 𝕀 → ℂ}, IsArcMap d → (∀ s, d s ∈ F) → IsArcMap (h ∘ d) := by + intro d hd hmem + refine ⟨m5.comp_continuous hd.1 hmem, fun s s' he => hd.2 ?_⟩ + have := congrArg k he + simp only [Function.comp] at this + rwa [m3 (hmem s), m3 (hmem s')] at this + have hae : ∀ s, a s ∈ F := c.a_mem + have hbe : ∀ s, b s ∈ F := c.b_mem + have he0 : e 0 ∈ F := c.a_zero ▸ hae 0 + have he1 : e 1 ∈ F := c.a_one ▸ hae 1 + have hne' : h (e 0) ≠ h (e 1) := fun he => c.ne (by + have := congrArg k he + rwa [m3 he0, m3 he1] at this) + obtain ⟨x', hx'⟩ := J'.isConnected_inner.nonempty + have hx'F : x' ∉ F' := hx'.1 + obtain ⟨e', he'c, he'i, he'0, he'1, he'in⟩ := exists_crossCut φ' hx'F (m1 he0) (m1 he1) hne' + have he'inner : ∀ t, t ≠ 0 → t ≠ 1 → e' t ∈ inner F' := fun t h0 h1 => + J'.subset_inner isPreconnected_connectedComponentIn + (Set.disjoint_left.mpr fun z hz hzF => connectedComponentIn_subset F'ᶜ x' hz hzF) + ⟨x', mem_connectedComponentIn hx'F, hx'⟩ (he'in t h0 h1) + have he'arc : IsArcMap e' := ⟨he'c, he'i⟩ + have c' : IsCut F' (h ∘ a) (h ∘ b) e' := by + refine ⟨harc c.arc_a hae, harc c.arc_b hbe, he'arc, ?_, ?_, ?_, ?_, ?_, ?_, ?_, he'inner⟩ + · simp only [Function.comp, c.a_zero, he'0] + · simp only [Function.comp, c.a_one, he'1] + · simp only [Function.comp, c.b_zero, he'0] + · simp only [Function.comp, c.b_one, he'1] + · rw [he'0, he'1] + exact hne' + · ext w + constructor + · rintro (⟨s, rfl⟩ | ⟨s, rfl⟩) + · exact m1 (hae s) + · exact m1 (hbe s) + · intro hw + have hkw : k w ∈ F := m2 hw + rw [← c.union] at hkw + rcases hkw with ⟨s, hs⟩ | ⟨s, hs⟩ + · exact Or.inl ⟨s, by simp only [Function.comp, hs]; exact m4 hw⟩ + · exact Or.inr ⟨s, by simp only [Function.comp, hs]; exact m4 hw⟩ + · intro s t hst + refine c.meet s t ?_ + have := congrArg k hst + simp only [Function.comp] at this + rwa [m3 (hae s), m3 (hbe t)] at this + obtain ⟨ι, hι, -⟩ := c.arc_e.exists_inv + obtain ⟨ι', hι', -⟩ := he'arc.exists_inv + let H : ℂ → ℂ := fun z => if z ∈ range e then e' (ι z) else h z + let K : ℂ → ℂ := fun w => if w ∈ range e' then e (ι' w) else k w + have Hrange : ∀ t, H (e t) = e' t := fun t => by + have : e t ∈ range e := ⟨t, rfl⟩ + simp only [H, this, ite_true, hι] + have Krange : ∀ t, K (e' t) = e t := fun t => by + have : e' t ∈ range e' := ⟨t, rfl⟩ + simp only [K, this, ite_true, hι'] + have HF : EqOn H h F := by + intro z hz + by_cases hze : z ∈ range e + · rcases c.mem_range_of_mem hz hze with rfl | rfl + · rw [Hrange, he'0] + · rw [Hrange, he'1] + · simp only [H, hze, ite_false] + have KF : EqOn K k F' := by + intro w hw + by_cases hwe : w ∈ range e' + · rcases c'.mem_range_of_mem hw hwe with rfl | rfl + · rw [Krange, he'0, m3 he0] + · rw [Krange, he'1, m3 he1] + · simp only [K, hwe, ite_false] + have hbdside : ∀ {d d' : 𝕀 → ℂ}, IsArcMap d → (∀ s, d s ∈ F) → d' = h ∘ d → + BdMatch (side d e) (side d' e') H K := by + rintro d _ hd hmem rfl + refine bdMatch_of_arcs hd c.arc_e (harc hd hmem) he'arc (fun s => HF (hmem s)) Hrange + (fun s => ?_) Krange + change K (h (d s)) = d s + rw [KF (m1 (hmem s))] + exact m3 (hmem s) + have hrangesub : range e ⊆ closedInner F := by + obtain ⟨-, h1, -, -, -, -⟩ := c.closedInner_facts J + exact fun z hz => h1 (Or.inr (Or.inr hz)) + have hrangesub' : range e' ⊆ closedInner F' := by + obtain ⟨-, h1, -, -, -, -⟩ := c'.closedInner_facts J' + exact fun z hz => h1 (Or.inr (Or.inr hz)) + have hother : ∀ {G : Set ℂ}, closedInner F ∩ G ⊆ F → EqOn H h G := by + intro G hG z hz + by_cases hze : z ∈ range e + · exact HF (hG ⟨hrangesub hze, hz⟩) + · simp only [H, hze, ite_false] + have hother' : ∀ {G : Set ℂ}, closedInner F' ∩ G ⊆ F' → EqOn K k G := by + intro G hG z hz + by_cases hze : z ∈ range e' + · exact KF (hG ⟨hrangesub' hze, hz⟩) + · simp only [K, hze, ite_false] + have hp1 : (F, F').1 = F := rfl + have hsubq : ∀ q ∈ S \ {(F, F')}, closedInner F ∩ closedInner q.1 ⊆ F ∩ q.1 ∧ + closedInner F' ∩ closedInner q.2 ⊆ F' ∩ q.2 := by + rintro q ⟨hqS, hne⟩ + have hne' : (F, F') ≠ q := fun he => hne he.symm + exact ⟨P.meet _ hq q hqS hne', P.meet' _ hq q hqS hne'⟩ + obtain ⟨f1, f2, f3, f4, f5, f6⟩ := c.closedInner_facts J + obtain ⟨g1, g2, g3, g4, g5, g6⟩ := c'.closedInner_facts J' + have T := c.isTheta J + obtain ⟨z₁, hz₁⟩ := T.parts₁.isConnected_inner.nonempty + obtain ⟨z₂, hz₂⟩ := T.parts₂.isConnected_inner.nonempty + refine ⟨e', H, K, ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩, g2, g3, ?_, ?_, ?_⟩ + · exact ((P.fin.subset sdiff_subset).insert _).insert _ + · rintro q (rfl | rfl | hq') + · exact c.oArc_side + · exact c.symm.oArc_side + · exact P.oarc q hq'.1 + · rintro q (rfl | rfl | hq') + · exact c'.oArc_side + · exact c'.symm.oArc_side + · exact P.oarc' q hq'.1 + · rintro q (rfl | rfl | hq') + · exact hbdside c.arc_a hae rfl + · exact hbdside c.arc_b hbe rfl + · have hs := hsubq q hq' + have hz1 : ∀ {G : Set ℂ} {Z : Set ℂ}, closedInner F ∩ closedInner Z ⊆ F ∩ Z → G ⊆ Z → + closedInner F ∩ G ⊆ F := by + intro G Z h1 h2 z hz + exact (h1 ⟨hz.1, Or.inr (h2 hz.2)⟩).1 + have h3 : closedInner F ∩ q.1 ⊆ F := fun z hz => (hs.1 ⟨hz.1, Or.inr hz.2⟩).1 + have h4 : closedInner F' ∩ q.2 ⊆ F' := fun z hz => (hs.2 ⟨hz.1, Or.inr hz.2⟩).1 + exact (P.bd q hq'.1).congr (hother h3) (hother' h4) + · exact cover_replace Prod.fst hq f1.symm f2 f3 P.cov + · exact cover_replace Prod.snd hq g1.symm g2 g3 P.cov' + · rintro q (rfl | rfl | hq1) q' (rfl | rfl | hq2) hne + · exact absurd rfl hne + · exact c.meet_sides J + · exact c.meet_side J (hsubq _ hq2).1 + · rw [inter_comm, inter_comm (side b e)] + exact c.meet_sides J + · exact absurd rfl hne + · exact c.symm.meet_side J (hsubq _ hq2).1 + · rw [inter_comm, inter_comm q.1] + exact c.meet_side J (hsubq _ hq1).1 + · rw [inter_comm, inter_comm q.1] + exact c.symm.meet_side J (hsubq _ hq1).1 + · exact P.meet q hq1.1 q' hq2.1 hne + · rintro q (rfl | rfl | hq1) q' (rfl | rfl | hq2) hne + · exact absurd rfl hne + · exact c'.meet_sides J' + · exact c'.meet_side J' (hsubq _ hq2).2 + · rw [inter_comm, inter_comm (side (h ∘ b) e')] + exact c'.meet_sides J' + · exact absurd rfl hne + · exact c'.symm.meet_side J' (hsubq _ hq2).2 + · rw [inter_comm, inter_comm q.2] + exact c'.meet_side J' (hsubq _ hq1).2 + · rw [inter_comm, inter_comm q.2] + exact c'.symm.meet_side J' (hsubq _ hq1).2 + · exact P.meet' q hq1.1 q' hq2.1 hne + · rintro q (rfl | rfl | hq') z ⟨hz1, hz2⟩ + · exact Or.inl (f5 ⟨hz1, P.top _ hq ⟨f2 hz1, hz2⟩⟩) + · exact Or.inl (f6 ⟨hz1, P.top _ hq ⟨f3 hz1, hz2⟩⟩) + · exact P.top q hq'.1 ⟨hz1, hz2⟩ + · rintro q (rfl | rfl | hq') z ⟨hz1, hz2⟩ + · exact Or.inl (g5 ⟨hz1, P.top' _ hq ⟨g2 hz1, hz2⟩⟩) + · exact Or.inl (g6 ⟨hz1, P.top' _ hq ⟨g3 hz1, hz2⟩⟩) + · exact P.top' q hq'.1 ⟨hz1, hz2⟩ + · refine (hother fun z hz => ?_).trans P.ext + exact P.top _ hq ⟨hz.1, hz.2⟩ + · refine (hother' fun z hz => ?_).trans P.ext' + exact P.top' _ hq ⟨hz.1, hz.2⟩ + · intro he + have h1 : side a e = side b e := congrArg Prod.fst he + have hin : z₁ ∈ inner (side b e) := h1 ▸ hz₁ + exact Set.disjoint_left.mp T.disjoint_inner hz₁ hin + · rintro ⟨hqS, hne⟩ + have hs := hsubq _ ⟨hqS, hne⟩ + have hz := hs.1 ⟨f2 (Or.inl hz₁), Or.inl hz₁⟩ + exact Set.disjoint_left.mp T.inner_disjoint_F hz₁ hz.1 + · rintro ⟨hqS, hne⟩ + have hs := hsubq _ ⟨hqS, hne⟩ + have hz := hs.1 ⟨f3 (Or.inl hz₂), Or.inl hz₂⟩ + exact Set.disjoint_left.mp T.symm.inner_disjoint_F hz₂ hz.1 + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/DrawCarry.lean b/LeanPool/GraphMinor/Surface/DrawCarry.lean new file mode 100644 index 0000000000..2112a00b77 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/DrawCarry.lean @@ -0,0 +1,618 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM17.Defs +public import LeanPool.GraphMinor.GM19.FragmentOuter +public import LeanPool.GraphMinor.GM16.Tower +public import LeanPool.GraphMinor.Surface.DiscRemove + +/-! +# A drawing carries over to a less simple surface + +We show that a graph drawn in `Σ(a, b, c)` can be drawn in `Σ(a', b', c')` whenever `a ≤ a'` and `b +≤ b'` (`canBeDrawn_of_le`). +Graph Minors XVII states this without proof, at the end of the proof of (13.4) (page 207). + +The route has three steps. Pasting discs on the cuffs embeds `Σ(a, b, c)` in `Σ(a, b, 0)`. A drawing +is a nowhere dense closed set, so +we can remove the interiors of as many discs as we like and keep the drawing off the boundary. This +gives a drawing in `Σ(a, b, m)` +that misses `bd Σ(a, b, m)`. Finally we paste some of the cuffs of `Σ(a, b, m)`, in the plain way +given by the models. The result +is injective off the cuffs, so the drawing survives. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function GraphMinor.GM17 GraphMinor.GM20.Draw + +variable {α' β' : Type*} {H : Hypergraph α' β'} + +/-- A drawing of `H` in `S` that stays in the set `K`. -/ +def DrawnOn {S : Type*} [TopologicalSpace S] (H : Hypergraph α' β') (K : Set S) : Prop := + ∃ (ν : α' → S) (edgeOf : β' → Set S), InjOn ν H.vertexSet ∧ + (∀ e ∈ H.edgeSet, ∀ u v, H.Inc e u → H.Inc e v → u ≠ v → IsLineWithEnds (edgeOf e) (ν u) (ν v)) + ∧ + (∀ e ∈ H.edgeSet, ∀ v, H.ends e = {v} → IsOArc (edgeOf e) ∧ ν v ∈ edgeOf e) ∧ + (∀ e ∈ H.edgeSet, ∀ f ∈ H.edgeSet, e ≠ f → edgeOf e ∩ edgeOf f ⊆ ν '' H.vertexSet) ∧ + (∀ e ∈ H.edgeSet, ∀ v ∈ H.vertexSet, ν v ∈ edgeOf e → H.Inc e v) ∧ + (∀ v ∈ H.vertexSet, ν v ∈ K) ∧ ∀ e ∈ H.edgeSet, edgeOf e ⊆ K + +/-- A map that is an embedding on `K` carries a drawing on `K` to one on the image of `K`. -/ +theorem DrawnOn.map {S T : Type*} [TopologicalSpace S] [TopologicalSpace T] {K : Set S} {j : S → T} + (hj : IsEmbedding (K.domRestrict j)) + (h : DrawnOn H K) : DrawnOn H (j '' K) := by + obtain ⟨ν, F, h₁, h₂, h₃, h₄, h₅, h₆, h₇⟩ := h + have hinj : InjOn j K := fun x hx y hy he => by + have := @hj.injective ⟨x, hx⟩ ⟨y, hy⟩ he + exact congrArg Subtype.val this + have hsub : ∀ {L : Set S}, L ⊆ K → IsEmbedding (fun x : L => j x.1) := fun {L} hL => hj.comp + (IsEmbedding.inclusion hL) + have hrange : ∀ {L : Set S}, L ⊆ K → range (fun x : L => j x.1) = j '' L := fun {L} _ => by + ext y + simp [eq_comm] + have hhomeo : ∀ {L : Set S}, L ⊆ K → ∃ g : L ≃ₜ (j '' L), ∀ x, (g x).1 = j x.1 := fun {L} hL => + ⟨(hsub hL).toHomeomorph.trans (Homeomorph.setCongr (hrange hL)), fun _ => rfl⟩ + refine ⟨j ∘ ν, fun e => j '' F e, ?_, ?_, ?_, ?_, ?_, fun v hv => mem_image_of_mem _ (h₆ v hv), + fun e he => image_mono (h₇ e he)⟩ + · exact hinj.comp h₁ h₆ + · intro e he u v hu hv huv + obtain ⟨f, hf0, hf1⟩ := h₂ e he u v hu hv huv + obtain ⟨g, hg⟩ := hhomeo (h₇ e he) + exact ⟨f.trans g, by simp [hg, hf0], by simp [hg, hf1]⟩ + · intro e he v hv + obtain ⟨⟨f⟩, h₈⟩ := h₃ e he v hv + obtain ⟨g, -⟩ := hhomeo (h₇ e he) + exact ⟨⟨f.trans g⟩, mem_image_of_mem _ h₈⟩ + · rintro e he f hf hef _ ⟨⟨x, hx, rfl⟩, ⟨y, hy, hxy⟩⟩ + obtain rfl := hinj (h₇ f hf hy) (h₇ e he hx) hxy + obtain ⟨v, hv, rfl⟩ := h₄ e he f hf hef ⟨hx, hy⟩ + exact ⟨v, hv, rfl⟩ + · rintro e he v hv ⟨x, hx, hxv⟩ + obtain rfl := hinj (h₇ e he hx) (h₆ v hv) hxv + exact h₅ e he v hv hx + +theorem canBeDrawn_iff {S : Type} [TopologicalSpace S] : CanBeDrawn S H ↔ DrawnOn H (univ : Set S) + := by + constructor + · rintro ⟨ν, F, h₁, h₂, h₃, h₄, h₅⟩ + exact ⟨ν, F, h₁, h₂, h₃, h₄, h₅, fun _ _ => mem_univ _, fun _ _ => subset_univ _⟩ + · rintro ⟨ν, F, h₁, h₂, h₃, h₄, h₅, -, -⟩ + exact ⟨ν, F, h₁, h₂, h₃, h₄, h₅⟩ + +theorem DrawnOn.canBeDrawn {S : Type} [TopologicalSpace S] {K : Set S} + (h : DrawnOn H K) : CanBeDrawn S H := by + obtain ⟨ν, F, h₁, h₂, h₃, h₄, h₅, -, -⟩ := h + exact ⟨ν, F, h₁, h₂, h₃, h₄, h₅⟩ + +/-- An embedding carries a drawing to a drawing. -/ +theorem CanBeDrawn.of_isEmbedding {S T : Type} [TopologicalSpace S] [TopologicalSpace T] {j : S + → T} (hj : IsEmbedding j) + (h : CanBeDrawn S H) : CanBeDrawn T H := + (DrawnOn.map (K := univ) (j := j) (hj.comp IsEmbedding.subtypeVal) (canBeDrawn_iff.1 + h)).canBeDrawn + +/-! ### Discs in a surface -/ + +/-- A closed disc inside any open set around an interior point. -/ +theorem exists_disc_in {S : Type} [TopologicalSpace S] {y : S} (hy : IsInteriorPoint y) {W : Set S} + (hW : IsOpen W) (hyW : y ∈ W) : + ∃ D, IsClosedDisc D ∧ D ⊆ W := by + obtain ⟨U, h, g, c, hU, -⟩ := hy.exists_ballChart hW hyW (R := 2) (by norm_num) + have hsub : Metric.closedBall (0 : ℂ) 1 ⊆ Metric.ball 0 2 := Metric.closedBall_subset_ball + (by norm_num) + have hD : IsClosedDisc (Metric.closedBall (0 : ℂ) 1) := (isClosedDisc_of_convex + (convex_closedBall 0 1) (by + rw [interior_closedBall _ one_ne_zero] + exact ⟨0, by simp⟩) Metric.isBounded_closedBall Metric.isClosed_closedBall).1 + refine ⟨_, (c.image_disc hD hsub).1, ?_⟩ + rintro _ ⟨z, hz, rfl⟩ + exact hU (c.gm (hsub hz)) + +/-- A finite drawing of a graph is a closed set with dense complement, in a closed surface. -/ +theorem exists_nowhere_dense (hH : H.IsGraph) {T : Type} [TopologicalSpace T] + (hT : IsClosedSurface T) (h : CanBeDrawn T H) : + ∃ K : Set T, IsCompact K ∧ Dense Kᶜ ∧ DrawnOn H K := by + classical + have : T2Space T := hT.isSurface.2.1 + have : CompactSpace T := hT.isSurface.1 + obtain ⟨ν, F, h₁, h₂, h₃, h₄, h₅⟩ := h + let Good : Set T → Prop := fun K => IsClosed K ∧ Dense Kᶜ + have hunion : ∀ {A B : Set T}, Good A → Good B → Good (A ∪ B) := fun {A B} hA hB => by + refine ⟨hA.1.union hB.1, ?_⟩ + rw [compl_union] + exact hA.2.inter_of_isOpen_left hB.2 hA.1.isOpen_compl + have hline : ∀ {L : Set T} {a b : T}, IsLineWithEnds L a b → Good L := fun {L a b} hl => by + obtain ⟨f, -, -⟩ := id hl + have hc : IsCompact L := by + exact isCompact_iff_compactSpace.mpr (f.surjective.compactSpace f.continuous) + refine ⟨hc.isClosed, fun x => ?_⟩ + by_cases hx : x ∈ L + · exact GM19.line_subset_closure_compl hT hl hx + · exact subset_closure hx + have hedge : ∀ e ∈ H.edgeSet, Good (F e) := by + intro e he + obtain ⟨⟨u, hu⟩, hle⟩ := hH e he + by_cases hv : H.ends e = {u} + · obtain ⟨hF, hm⟩ := h₃ e he u hv + obtain ⟨φ⟩ := id hF + have hne : (φ 1).1 ≠ (φ (-1)).1 := fun h => by + have := φ.injective (Subtype.ext h) + have h' := congrArg (fun z : Circle => (z : ℂ)) this + norm_num at h' + obtain ⟨A, B, hA, hB, hu', -⟩ := hF.lines (φ 1).2 (φ (-1)).2 hne + rw [← hu'] + exact hunion (hline hA) (hline hB) + · obtain ⟨w, hw, hwu⟩ : ∃ w ∈ H.ends e, w ≠ u := by + by_contra hn + push Not at hn + exact hv (Subset.antisymm (fun w hw => hn w hw) (singleton_subset_iff.2 hu)) + exact hline (h₂ e he u w hu hw hwu.symm) + have hV : Good (ν '' H.vertexSet) := by + have hfin := H.vertexSet_finite.image ν + exact ⟨hfin.isClosed, GM19.dense_compl_finite hT.2.2 hfin⟩ + have hE : Good (⋃ e ∈ H.edgeSet, F e) := by + have hfin := H.edgeSet_finite + have hempty : Good (∅ : Set T) := ⟨isClosed_empty, by simp⟩ + refine Set.Finite.induction_on_subset (motive := fun E _ => Good (⋃ e ∈ E, + F e)) _ hfin (by simpa using hempty) ?_ + intro e E he _ _ hG + rw [biUnion_insert] + exact hunion (hedge e he) hG + have hK := hunion hV hE + refine ⟨_, hK.1.isCompact, hK.2, ν, F, h₁, h₂, h₃, h₄, h₅, fun v hv => .inl + (mem_image_of_mem _ hv), fun e he => ?_⟩ + exact (subset_biUnion_of_mem (u := F) he).trans subset_union_right + +/-- Removing the interior of a small disc off a drawing gives one more cuff, and the drawing stays +off the boundary. -/ +theorem remove_step {Y : Type} [TopologicalSpace Y] [ConnectedSpace Y] + (hY : IsSurface Y) {a b m : ℕ} (e : Y ≃ₜ SurfaceModel a b m) + {K : Set Y} (hKc : IsCompact K) (hKd : Dense Kᶜ) (hKb : Disjoint K (bd Y)) (hD : DrawnOn H K) : + ∃ K' : Set (SurfaceModel a b (m + 1)), IsCompact K' ∧ Dense K'ᶜ ∧ Disjoint K' (bd + (SurfaceModel a b (m + 1))) ∧ DrawnOn H K' := by + classical + have : CompactSpace Y := hY.1 + have : T2Space Y := hY.2.1 + have hbc := isClosed_bd Y + have hW : IsOpen (Kᶜ ∩ (bd Y)ᶜ) := hKc.isClosed.isOpen_compl.inter hbc.isOpen_compl + obtain ⟨x, hxb, hxK⟩ := hKd.inter_open_nonempty (bd Y)ᶜ hbc.isOpen_compl + (GM19.dense_interior' hY).nonempty + have hx : IsInteriorPoint x := by + by_contra h + exact hxb h + obtain ⟨E, hE, hEW⟩ := exists_disc_in hx hW ⟨hxK, hxb⟩ + have hdE : discBd E ⊆ E := by + rintro _ ⟨y, -, rfl⟩ + exact y.2 + have hint : ∀ z ∈ discBd E, IsInteriorPoint z := fun z hz => by + by_contra h + exact (hEW (hdE hz)).2 h + obtain ⟨hcl, hXs, hXb⟩ := remove_disc hY hE hint + set X : Set Y := (discInt E)ᶜ with hX + have hdeq : E ∩ X = discBd E := by + ext z + simp only [hX, discInt, mem_inter_iff, mem_compl_iff, mem_sdiff, not_and, not_not] + exact ⟨fun h => h.2 h.1, fun h => ⟨hdE h, fun _ => h⟩⟩ + have hO : IsOArc (discBd E) := hE.isOArc_discBd + have hnb : (discBd E).Nonempty := by + obtain ⟨φ⟩ := hO + exact ⟨_, (φ 1).2⟩ + have hXne : X.Nonempty := ⟨_, by + rw [hX] + exact fun h => h.2 hnb.some_mem⟩ + have hEc : IsClosed E := by + obtain ⟨d⟩ := id hE + exact (isCompact_iff_compactSpace.mpr (d.surjective.compactSpace d.continuous)).isClosed + have hconn : ConnectedSpace ↥X := connected_compl hcl hXne (𝓖 := {E}) (finite_singleton _) + (by rintro _ rfl; exact hEc) + (by rintro _ rfl; rw [hdeq]; exact hO.isConnected'.isPreconnected) + (by rintro _ rfl; rw [hdeq]; exact hnb) + (by rintro G rfl G' rfl h; exact absurd rfl h) + (by + simp only [sUnion_singleton] + ext z + by_cases hz : z ∈ discInt E + · exact ⟨fun _ => mem_univ _, fun _ => .inr hz.1⟩ + · exact ⟨fun _ => mem_univ _, fun _ => .inl hz⟩) + obtain ⟨a₁, b₁, c₁, ⟨e₁⟩⟩ := classification.{0} ↥X hXs hconn + have hval : IsClosedEmbedding (Subtype.val : X → Y) := hcl.isClosedEmbedding_subtypeVal + have hiC : (Subtype.val : X → Y) '' (Subtype.val ⁻¹' discBd E) = discBd E := by + rw [Subtype.image_preimage_coe, inter_comm, ← hdeq, inter_assoc, inter_self] + set C : Set ↥X := Subtype.val ⁻¹' discBd E with hC + have hCc : IsPreconnected C := by + have hie : (Subtype.val : X → Y) '' C = discBd E := hiC + rw [← hval.isInducing.isPreconnected_image, hie] + exact hO.isConnected'.isPreconnected + obtain ⟨z₀, hz₀⟩ : C.Nonempty := by + obtain ⟨z, hz⟩ := hnb + rw [← hiC] at hz + obtain ⟨w, hw, -⟩ := hz + exact ⟨w, hw⟩ + have hCb : C ⊆ bd ↥X := fun z hz => by + rw [hXb] + exact .inr hz + have hcuff : IsCuff C := by + refine ⟨z₀, hCb hz₀, Subset.antisymm ?_ (hCc.subset_connectedComponentIn hz₀ hCb)⟩ + have hp : IsPreconnected (connectedComponentIn (bd ↥X) z₀) := + isPreconnected_connectedComponentIn + have hsub : connectedComponentIn (bd ↥X) z₀ ⊆ bd ↥X := connectedComponentIn_subset _ _ + have h₁ : IsClosed (Subtype.val ⁻¹' E : Set ↥X) := hEc.preimage continuous_subtype_val + have h₂ : IsClosed (Subtype.val ⁻¹' bd Y : Set ↥X) := hbc.preimage continuous_subtype_val + have hdisj : ∀ z : ↥X, z.1 ∈ E → z.1 ∉ bd Y := fun z hz hb => (hEW hz).2 hb + intro z hz + by_contra hzC + obtain ⟨w, -, hw₁, hw₂⟩ := isPreconnected_closed_iff.1 hp _ _ h₁ h₂ + (fun u hu => by + have := hsub hu + rw [hXb] at this + exact this.elim .inr fun h => .inl (hdE h)) + ⟨z₀, mem_connectedComponentIn (hCb hz₀), hdE hz₀⟩ + ⟨z, hz, by + have := hsub hz + rw [hXb] at this + exact this.elim id fun h => absurd h hzC⟩ + exact hdisj w hw₁ hw₂ + have hu : range (Subtype.val : X → Y) ∪ E = univ := by + rw [Subtype.range_coe] + ext z + by_cases hz : z ∈ E + · exact ⟨fun _ => mem_univ _, fun _ => .inr hz⟩ + · exact ⟨fun _ => mem_univ _, fun _ => .inl fun h => hz h.1⟩ + have hm : range (Subtype.val : X → Y) ∩ E = (Subtype.val : X → Y) '' C := by + rw [Subtype.range_coe, inter_comm, hdeq] + exact hiC.symm + obtain ⟨hc₁, ⟨e₂⟩⟩ := paste_model hXs hcuff hY hval hE hu hm hiC.symm e₁ + obtain ⟨h₁, h₂, h₃⟩ := (modelCriterion.2 a₁ b₁ (c₁ - 1) a b m).mp ⟨e₂.symm.trans e⟩ + obtain ⟨g'⟩ := (modelCriterion.2 a₁ b₁ c₁ a b (m + 1)).mpr ⟨by omega, h₂, h₃⟩ + let g : ↥X ≃ₜ SurfaceModel a b (m + 1) := e₁.trans g' + have hKX : K ⊆ X := fun z hz hi => (hEW hi.1).1 hz + have hj : IsEmbedding (K.domRestrict fun y => if h : y ∈ X then g ⟨y, h⟩ else g ⟨z₀.1, z₀.2⟩) + := by + have : (K.domRestrict fun y => if h : y ∈ X then g ⟨y, h⟩ else g ⟨z₀.1, z₀.2⟩) + = g ∘ inclusion hKX := by + funext z + simp [domRestrict, hKX z.2, inclusion] + rw [this] + exact g.isEmbedding.comp (IsEmbedding.inclusion hKX) + set j : Y → SurfaceModel a b (m + 1) := fun y => if h : y ∈ X then g ⟨y, h⟩ else g ⟨z₀.1, z₀.2⟩ + with hjdef + have him : j '' K = g '' (Subtype.val ⁻¹' K) := by + ext z + constructor + · rintro ⟨y, hy, rfl⟩ + exact ⟨⟨y, hKX hy⟩, hy, by simp [hjdef, hKX hy]⟩ + · rintro ⟨y, hy, rfl⟩ + exact ⟨y.1, hy, by simp [hjdef]⟩ + refine ⟨j '' K, ?_, ?_, ?_, hD.map hj⟩ + · rw [image_eq_range] + have : CompactSpace ↥K := isCompact_iff_compactSpace.mp hKc + exact isCompact_range hj.continuous + · rw [him, ← g.image_compl] + refine g.surjective.denseRange.dense_image g.continuous ?_ + rw [← interior_eq_empty_iff_dense_compl, eq_empty_iff_forall_notMem] + intro u hu + obtain ⟨V, hV, hVe⟩ := isOpen_induced_iff.mp (isOpen_interior (s := + (Subtype.val ⁻¹' K : Set ↥X))) + have hoff : V ∩ Eᶜ ⊆ K := fun y hy => by + have hyX : y ∈ X := fun hi => hy.2 hi.1 + have hm : (⟨y, hyX⟩ : ↥X) ∈ interior (Subtype.val ⁻¹' K : Set ↥X) := by + rw [← hVe] + exact hy.1 + exact (interior_subset hm : (⟨y, hyX⟩ : ↥X) ∈ (Subtype.val ⁻¹' K : Set ↥X)) + have huV : u.1 ∈ V := by + have : u ∈ Subtype.val ⁻¹' V := by + rw [hVe] + exact hu + exact this + have huE : u.1 ∉ E := fun h => (hEW h).1 (interior_subset hu : u ∈ (Subtype.val ⁻¹' K : Set ↥X)) + obtain ⟨y, hy, hyK⟩ := hKd.inter_open_nonempty _ (hV.inter hEc.isOpen_compl) ⟨u.1, huV, huE⟩ + exact hyK (hoff hy) + · rw [him, Set.disjoint_left] + rintro _ ⟨y, hy, rfl⟩ hb + have hb' : y ∈ bd ↥X := by + rw [← image_bd_homeomorph g] at hb + obtain ⟨w, hw, he⟩ := hb + exact g.injective he ▸ hw + rw [hXb] at hb' + rcases hb' with h | h + · exact Set.disjoint_left.mp hKb hy h + · exact (hEW (hdE h)).1 hy + +/-! ### The maps between models -/ + +/-- The points of the circles with index from `m` up to `n`. -/ +def holePts (m n : ℕ) : Set (OnePoint EuclideanPlane) := + {p | ∃ i, m ≤ i ∧ i < n ∧ ∃ u : EuclideanPlane, ‖u‖ = 1 ∧ p = ((modelCentre i + u : + EuclideanPlane) : OnePoint EuclideanPlane)} + +theorem norm_modelMirror (u : EuclideanPlane) : ‖modelMirror u‖ = ‖u‖ := by + have h₁ : ‖modelMirror u‖ ^ 2 = ‖u‖ ^ 2 := by + rw [norm_sq, norm_sq] + simp [modelMirror] + exact (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp h₁ + +theorem not_mem_holePts {j m n : ℕ} (hj : j < m) {u : EuclideanPlane} (hu : ‖u‖ = 1) : + ((modelCentre j + u : EuclideanPlane) : OnePoint EuclideanPlane) ∉ holePts m n := by + rintro ⟨i, hi, -, v, hv, he⟩ + have he' : modelCentre j + u = modelCentre i + v := OnePoint.coe_injective he + refine modelCentre_dist (i := j) (j := i) (x := modelCentre j + u) (by omega) + (by simpa using hu) ?_ + rw [he'] + simpa using hv + +theorem glue_not_mem {a b n : ℕ} {p q : modelBase n} (h : ModelGlue a b n p q) : p.1 ∉ holePts + (2 * a + b) n ∧ q.1 ∉ holePts (2 * a + b) n := by + cases h with + | handle i hi u hu p q hp hq => + rw [hp, hq] + exact ⟨not_mem_holePts (by omega) hu, not_mem_holePts (by omega) (by rw [norm_modelMirror, hu])⟩ + | crosscap i hi u hu p q hp hq => + rw [hp, hq, sub_eq_add_neg] + exact ⟨not_mem_holePts (by omega) hu, not_mem_holePts (by omega) (by rw [norm_neg, hu])⟩ + +theorem eq_of_eqv_hole {a b n : ℕ} {p q : modelBase n} (h : Relation.EqvGen (ModelGlue a b n) p q) : + (p.1 ∈ holePts (2 * a + b) n ∨ q.1 ∈ holePts (2 * a + b) n) → p = q := by + induction h with + | rel p q h => + obtain ⟨h₁, h₂⟩ := glue_not_mem h + rintro (h | h) + · exact absurd h h₁ + · exact absurd h h₂ + | refl p => exact fun _ => rfl + | symm p q _ ih => exact fun h => (ih h.symm).symm + | trans p q r _ _ ih₁ ih₂ => + rintro (h | h) + · obtain rfl := ih₁ (.inl h) + exact ih₂ (.inl h) + · obtain rfl := ih₂ (.inr h) + exact ih₁ (.inr h) + +/-- The two shapes of the pair `(a, b)`, `(a', b')` that we use: handles and cross-caps are kept in +place by the order of the circles. -/ +def Keeps (a b a' b' : ℕ) : Prop := (a = a' ∧ b ≤ b') ∨ (b = 0 ∧ a ≤ a') + +theorem glue_mono {a b a' b' n : ℕ} (hk : Keeps a b a' b') {p q : modelBase n} + (h : ModelGlue a b n p q) : ModelGlue a' b' n p q := by + cases h with + | handle i hi u hu p q hp hq => + have : i < a' := by rcases hk with ⟨h, -⟩ | ⟨-, h⟩ <;> omega + exact .handle i this u hu p q hp hq + | crosscap i hi u hu p q hp hq => + rcases hk with ⟨rfl, h⟩ | ⟨rfl, -⟩ + · exact .crosscap i (by omega) u hu p q hp hq + · omega + +theorem glue_back {a b a' b' n : ℕ} (hk : Keeps a b a' b') (hn : 2 * a' + b' + ≤ n) {p q : modelBase n} (h : ModelGlue a' b' n p q) : + ModelGlue a b n p q ∨ (p.1 ∈ holePts (2 * a + b) n ∧ q.1 ∈ holePts (2 * a + b) n) := by + cases h with + | handle i hi u hu p q hp hq => + by_cases hia : i < a + · exact .inl (.handle i hia u hu p q hp hq) + · have hb : b = 0 := by rcases hk with ⟨h, -⟩ | ⟨h, -⟩ <;> omega + exact .inr ⟨⟨2 * i, by omega, by omega, u, hu, hp⟩, ⟨2 * i + 1, by omega, by omega, _, + by rw [norm_modelMirror, hu], hq⟩⟩ + | crosscap i hi u hu p q hp hq => + have hq' : + q.1 = ((modelCentre (2 * a' + i) + -u : EuclideanPlane) : OnePoint EuclideanPlane) := by + rw [hq, sub_eq_add_neg] + by_cases hc : a = a' ∧ i < b + · obtain ⟨rfl, hib⟩ := hc + exact .inl (.crosscap i hib u hu p q hp hq) + · have hge : 2 * a + b ≤ 2 * a' + i := by rcases hk with ⟨h, -⟩ | ⟨h, h'⟩ <;> omega + exact .inr ⟨⟨_, hge, by omega, u, hu, hp⟩, ⟨_, hge, by omega, -u, by rw [norm_neg, hu], hq'⟩⟩ + +theorem eqv_back {a b a' b' n : ℕ} (hk : Keeps a b a' b') (hn : 2 * a' + b' + ≤ n) {p q : modelBase n} (h : Relation.EqvGen (ModelGlue a' b' n) p q) : + Relation.EqvGen (ModelGlue a b n) p q ∨ (p.1 ∈ holePts (2 * a + b) n ∧ q.1 ∈ holePts + (2 * a + b) n) := by + induction h with + | rel p q h => + rcases glue_back hk hn h with h | h + · exact .inl (.rel _ _ h) + · exact .inr h + | refl p => exact .inl (.refl _) + | symm p q _ ih => + rcases ih with h | h + · exact .inl (.symm _ _ h) + · exact .inr h.symm + | trans p q r _ _ ih₁ ih₂ => + rcases ih₁ with h₁ | h₁ + · rcases ih₂ with h₂ | h₂ + · exact .inl (.trans _ _ _ h₁ h₂) + · obtain rfl := eq_of_eqv_hole h₁ (.inr h₂.1) + exact .inr h₂ + · rcases ih₂ with h₂ | h₂ + · obtain rfl := eq_of_eqv_hole h₂ (.inl h₁.2) + exact .inr h₁ + · exact .inr ⟨h₁.1, h₂.2⟩ + +/-- The map between the quotients of the same sphere with holes, and what it glues. -/ +theorem exists_quot_map {a b a' b' n₁ n₂ : ℕ} (h : n₁ = n₂) (hk : Keeps a b a' b') + (hn : 2 * a' + b' ≤ n₂) : + ∃ φ : Quot (ModelGlue a b n₁) → Quot (ModelGlue a' b' n₂), Continuous φ + ∧ ∀ p q : modelBase n₁, φ (Quot.mk _ p) = φ (Quot.mk _ q) → + Quot.mk (ModelGlue a b n₁) p = Quot.mk _ q ∨ (p.1 ∈ holePts (2 * a + b) n₁ ∧ q.1 ∈ holePts + (2 * a + b) n₁) := by + subst h + refine ⟨Quot.lift (Quot.mk _) fun p q r => Quot.sound (glue_mono hk r), + continuous_quot_lift _ continuous_quot_mk, fun p q he => ?_⟩ + rcases eqv_back hk hn (Quot.eqvGen_exact he) with h | h + · exact .inl (Quot.eqvGen_sound h) + · exact .inr h + +/-- The points of the circles that are not pasted are boundary points. -/ +theorem qq_circle_mem_bd {a b c I : ℕ} (hI : 2 * a + b ≤ I) (hI' : I < 2 * a + b + c) {w : ℂ} + (hw : ‖w‖ = 1) : + qq a b c (cp (cz I + w)) ∈ bd (SurfaceModel a b c) := by + have hB : ∀ ζ ∈ Metric.ball (cz I + w) (1 / 2), ‖ζ - cz I‖ < 3 / 2 := fun ζ hζ ↦ by + have h₁ : ‖ζ - (cz I + w)‖ < 1 / 2 := by simpa [dist_eq_norm] using hζ + have h₂ : ζ - cz I = (ζ - (cz I + w)) + w := by ring + rw [h₂] + have h₃ := norm_add_le (ζ - (cz I + w)) w + rw [hw] at h₃ + linarith + have hj := isOpenEmbedding_chart (a := a) (b := b) (c := c) (B := Metric.ball (cz I + w) (1 / 2)) + Metric.isOpen_ball fun ζ hζ _ ↦ free_near hI (by linarith [hB ζ hζ]) + have hok : Ok a b c (cp (cz I + w)) := by + have hre : (cp (cz I + w)) = (3 * (I : ℝ) + w.re, w.im) := by simp [cp, cz] + rw [hre] + refine ok_circle ?_ + have := Complex.sq_norm w + rw [hw, Complex.normSq_apply] at this + nlinarith + have hw' : cz I + w ∈ chartDom a b c (Metric.ball (cz I + w) (1 / 2)) := ⟨Metric.mem_ball_self + (by norm_num), hok⟩ + have h₁ := not_interior_of_chart hj ⟨_, hw'⟩ ?_ + · exact h₁ + · intro hint + obtain ⟨ε, hε, hball⟩ := Metric.mem_nhds_iff.mp (mem_interior_iff_mem_nhds.mp hint) + set t : ℝ := min ε 1 / 2 with ht + have ht₀ : 0 < t := by positivity + have ht₁ : t ≤ 1 / 2 := by + have := min_le_right ε 1 + rw [ht] + linarith + have ht₂ : t < ε := by + have := min_le_left ε 1 + rw [ht] + linarith [lt_min hε one_pos] + have hmem : cz I + w - (t : ℂ) * w ∈ Metric.ball (cz I + w) ε := by + rw [Metric.mem_ball, dist_eq_norm, sub_sub_cancel_left, norm_neg, norm_mul, hw, + Complex.norm_real, Real.norm_eq_abs, abs_of_pos ht₀, mul_one] + exact ht₂ + have hok' := (hball hmem).2 I hI' + change 1 ≤ ((cp _).1 - 3 * (I : ℝ)) ^ 2 + (cp _).2 ^ 2 at hok' + rw [← nsq] at hok' + have h₂ : cz I + w - (t : ℂ) * w - cz I = ((1 - t : ℝ) : ℂ) * w := by + push_cast + ring + rw [h₂, norm_mul, hw, mul_one, Complex.norm_real, Real.norm_eq_abs, sq_abs] at hok' + nlinarith + +theorem hole_mem_bd {a b c : ℕ} (p : modelBase (2 * a + b + c)) (hp : p.1 ∈ holePts (2 * a + b) + (2 * a + b + c)) : + (Quot.mk _ p : SurfaceModel a b c) ∈ bd (SurfaceModel a b c) := by + obtain ⟨I, hI, hI', u, hu, he⟩ := hp + have hw : ‖(⟨u 0, u 1⟩ : ℂ)‖ = 1 := by + have h₁ : ‖(⟨u 0, u 1⟩ : ℂ)‖ ^ 2 = ‖u‖ ^ 2 := by + rw [norm_sq, Complex.sq_norm, Complex.normSq_apply] + ring + rw [hu] at h₁ + nlinarith [norm_nonneg (⟨u 0, u 1⟩ : ℂ)] + have h := qq_circle_mem_bd hI hI' hw + have hz : cp (cz I + ⟨u 0, u 1⟩) = (3 * (I : ℝ) + u 0, u 1) := by simp [cp, cz] + have hok : Ok a b c (cp (cz I + ⟨u 0, u 1⟩)) := by + rw [hz] + refine ok_circle ?_ + have := norm_sq u + rw [hu] at this + linarith + rw [qq_of_ok hok] at h + have hpt : p = ⟨_, mem_base hok⟩ := by + apply Subtype.ext + rw [he] + congr 1 + ext i + fin_cases i <;> simp [pl, modelCentre, hz] + rw [hpt] + exact h + +/-- A drawing off the boundary carries over to any model that pastes more of the circles. -/ +theorem canBeDrawn_of_keeps {a b c a' b' c' : ℕ} (hn : 2 * a + b + c = 2 * a' + b' + c') + (hk : Keeps a b a' b') {K : Set (SurfaceModel a b c)} + (hKc : IsCompact K) (hKb : Disjoint K (bd (SurfaceModel a b c))) (hD : DrawnOn H K) : + CanBeDrawn (SurfaceModel a' b' c') H := by + obtain ⟨φ, hφ, hinj⟩ := exists_quot_map (a := a) (b := b) (a' := a') (b' := b') hn hk (by omega) + let φ' : SurfaceModel a b c → SurfaceModel a' b' c' := φ + have hφ' : Continuous φ' := hφ + have := (isSurface_model a' b' c').1.2.1 + have : CompactSpace ↥K := isCompact_iff_compactSpace.mp hKc + have hi : Injective (K.domRestrict φ') := by + rintro ⟨x, hx⟩ ⟨y, hy⟩ he + obtain ⟨p, rfl⟩ := Quot.exists_rep x + obtain ⟨q, rfl⟩ := Quot.exists_rep y + rcases hinj p q he with h | h + · exact Subtype.ext h + · exact absurd (hole_mem_bd p h.1) (Set.disjoint_left.mp hKb hx) + have hj : IsEmbedding (K.domRestrict φ') := (hφ'.comp continuous_subtype_val).isClosedEmbedding + hi |>.isEmbedding + exact (hD.map hj).canBeDrawn + +/-- Pasting discs on all the cuffs keeps a drawing. -/ +theorem canBeDrawn_cap {a b c : ℕ} (h : CanBeDrawn (SurfaceModel a b c) H) : CanBeDrawn + (SurfaceModel a b 0) H := by + induction c with + | zero => exact h + | succ c ih => + refine ih ?_ + have hS := (isSurface_model a b (c + 1)).1 + have := hS.2.1 + obtain ⟨ht, f, hf⟩ := presents_ew a b (c + 1) + have h1 := ncard_cuffs hf + obtain ⟨C, hC⟩ := nonempty_of_ncard_ne_zero (s := cuffs (SurfaceModel a b (c + 1))) (by omega) + obtain ⟨S', _, ι, Δ, hS', hι, hΔ, hu, hm, hb, -⟩ := paste_disc.{0} _ C hS hC + obtain ⟨-, ⟨e⟩⟩ := paste_model hS hC hS' hι hΔ hu hm hb (Homeomorph.refl _) + exact CanBeDrawn.of_isEmbedding (e.isEmbedding.comp hι.isEmbedding) h + +/-- The closed model is a closed surface. -/ +theorem isClosedSurface_model (a b : ℕ) : IsClosedSurface (SurfaceModel a b 0) := by + have hS := (isSurface_model a b 0).1 + refine ⟨hS.1, hS.2.1, fun x => ?_⟩ + by_contra h + have h₁ : x ∈ bd (SurfaceModel a b 0) := h + rw [GM16.bd_model] at h₁ + exact h₁ + +/-- A drawing in the closed model gives a drawing off the boundary, in the model with `m` cuffs. -/ +theorem drawn_off_bd (hH : H.IsGraph) {a b : ℕ} (h : CanBeDrawn (SurfaceModel a b 0) H) (m : ℕ) : + ∃ K : Set (SurfaceModel a b m), IsCompact K ∧ Dense Kᶜ ∧ Disjoint K (bd (SurfaceModel a b m)) + ∧ DrawnOn H K := by + induction m with + | zero => + have := (isSurface_model a b 0).2 + obtain ⟨K, h₁, h₂, h₃⟩ := exists_nowhere_dense hH (isClosedSurface_model a b) h + refine ⟨K, h₁, h₂, ?_, h₃⟩ + rw [GM16.bd_model] + exact disjoint_empty _ + | succ m ih => + obtain ⟨K, h₁, h₂, h₃, h₄⟩ := ih + have := (isSurface_model a b m).2 + exact remove_step (isSurface_model a b m).1 (Homeomorph.refl _) h₁ h₂ h₃ h₄ + +/-- **A drawing carries over.** If `a ≤ a'` and `b ≤ b'`, a graph drawn in `Σ(a, b, c)` can be drawn +in `Σ(a', b', c')`. If `b = 0` we +paste handles, then cross-caps. If `b > 0` we write `Σ(a', b', c')` with `a` handles, by the model +criterion, and paste only cross-caps. -/ +theorem canBeDrawn_of_le (hH : H.IsGraph) {a b c a' b' c' : ℕ} (ha : a ≤ a') (hb : b ≤ b') + (h : CanBeDrawn (SurfaceModel a b c) H) : + CanBeDrawn (SurfaceModel a' b' c') H := by + have h₀ := canBeDrawn_cap h + by_cases hb₀ : b = 0 + · subst hb₀ + obtain ⟨K, h₁, -, h₃, h₄⟩ := drawn_off_bd hH h₀ (2 * a' + b' + c' - 2 * a) + exact canBeDrawn_of_keeps (by omega) (.inr ⟨rfl, ha⟩) h₁ h₃ h₄ + · obtain ⟨K, h₁, -, h₃, h₄⟩ := drawn_off_bd hH h₀ (b' + 2 * (a' - a) + c' - b) + have hd := canBeDrawn_of_keeps (a' := a) (b' := b' + 2 * (a' - a)) (c' := c') + (by omega) (.inl ⟨rfl, by omega⟩) h₁ h₃ h₄ + obtain ⟨f⟩ := (modelCriterion.2 a (b' + 2 * (a' - a)) c' a' b' c').mpr ⟨rfl, by omega, by omega⟩ + exact GM20.Draw.CanBeDrawn.map f hd + +/-- A graph drawn in a surface can be drawn in any surface that the first is simpler than. -/ +theorem IsSimplerThan.canBeDrawn {X Y : Type} [TopologicalSpace X] [TopologicalSpace Y] + (hs : IsSimplerThan X Y) (hH : H.IsGraph) (h : CanBeDrawn X H) : + CanBeDrawn Y H := by + obtain ⟨a, b, c, a', b', c', ⟨e⟩, ⟨e'⟩, h₁, h₂, -⟩ := hs + exact GM20.Draw.CanBeDrawn.map e'.symm (canBeDrawn_of_le hH h₁ h₂ (GM20.Draw.CanBeDrawn.map e h)) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/EdgeLens.lean b/LeanPool/GraphMinor/Surface/EdgeLens.lean new file mode 100644 index 0000000000..40d955dfcf --- /dev/null +++ b/LeanPool/GraphMinor/Surface/EdgeLens.lean @@ -0,0 +1,664 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collapse +public import LeanPool.GraphMinor.Surface.Cap + +/-! +# A thin disc around a line + +Let `L` be a line with ends `u, v` in a closed surface, and let `Z` be a closed set that meets `L` +only at its ends. Then there is a closed disc around `L` that meets `Z` only at `u, v`, with `u, v` +on its boundary and the rest of `L` inside (`exists_edge_lens`). The line cuts the disc into two +sides, each connected and each with all of `L` in its closure. + +We make `L` straight with `exists_stripChart`, and take the region between two graphs over `L`, of +height at most half the distance to `Z`. Its image of the unit disc is `lensMap`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Complex + +local notation "𝕀" => unitInterval + +/-- A map of the unit disc onto the region of height `w` over the real line. -/ +noncomputable def lensMap (w : ℝ → ℝ) (z : ℂ) : ℂ := + (z.re : ℂ) + (w z.re * (z.im / Real.sqrt (1 - z.re ^ 2)) : ℝ) * I + +theorem lensMap_re (w : ℝ → ℝ) (z : ℂ) : (lensMap w z).re = z.re := by + simp [lensMap] + +theorem lensMap_im (w : ℝ → ℝ) (z : ℂ) : (lensMap w z).im = w z.re * (z.im / Real.sqrt + (1 - z.re ^ 2)) := by + simp [lensMap] + +theorem abs_ratio_le {z : ℂ} (hz : z ∈ closedBall (0 : ℂ) 1) : |z.im / Real.sqrt (1 - z.re ^ 2)| + ≤ 1 := by + have h1 : z.re ^ 2 + z.im ^ 2 ≤ 1 := by + have h2 : ‖z‖ ≤ 1 := by simpa using hz + have h3 := Complex.sq_norm z + rw [Complex.normSq_apply] at h3 + nlinarith [norm_nonneg z] + rw [abs_div, abs_of_nonneg (Real.sqrt_nonneg _)] + apply div_le_one_of_le₀ _ (Real.sqrt_nonneg _) + exact Real.abs_le_sqrt (by linarith) + +theorem continuousOn_lensMap {w : ℝ → ℝ} (hw : Continuous w) (h1 : w 1 = 0) (hm : w (-1) + = 0) : ContinuousOn (lensMap w) (closedBall 0 1) := by + have hb : ContinuousOn (fun z : ℂ => w z.re * (z.im / Real.sqrt (1 - z.re ^ 2))) (closedBall 0 1) + := fun z hz => by + by_cases hre : z.re ^ 2 < 1 + · have hne : Real.sqrt (1 - z.re ^ 2) ≠ 0 := (Real.sqrt_pos.mpr (by linarith)).ne' + refine ContinuousAt.continuousWithinAt ?_ + have h2 : ContinuousAt (fun z : ℂ => Real.sqrt (1 - z.re ^ 2)) z := by fun_prop + exact ContinuousAt.mul (by fun_prop) (ContinuousAt.div (by fun_prop) h2 hne) + · have hz1 : z.re ^ 2 + z.im ^ 2 ≤ 1 := by + have h2 : ‖z‖ ≤ 1 := by simpa using hz + have h3 := Complex.sq_norm z + rw [Complex.normSq_apply] at h3 + nlinarith [norm_nonneg z] + have hre2 : z.re = 1 ∨ z.re = -1 := by + have h4 : (z.re - 1) * (z.re + 1) = 0 := by nlinarith [sq_nonneg z.im] + rcases mul_eq_zero.mp h4 with h5 | h5 + · exact .inl (by linarith) + · exact .inr (by linarith) + have hw0 : w z.re = 0 := by + rcases hre2 with h | h <;> rw [h] + · exact h1 + · exact hm + rw [ContinuousWithinAt, hw0, zero_mul] + have hc : ContinuousAt (fun z : ℂ => w z.re) z := by fun_prop + refine squeeze_zero_norm' ?_ (show Filter.Tendsto (fun x : ℂ => ‖w x.re‖) + (𝓝[closedBall 0 1] z) (𝓝 0) from ?_) + · filter_upwards [self_mem_nhdsWithin] with x hx + rw [norm_mul] + have h5 : ‖x.im / Real.sqrt (1 - x.re ^ 2)‖ ≤ 1 := by + rw [Real.norm_eq_abs] + exact abs_ratio_le hx + nlinarith [norm_nonneg (w x.re)] + · have h2 : Filter.Tendsto (fun x : ℂ => w x.re) (𝓝 z) (𝓝 0) := by + have := hc.tendsto + rwa [hw0] at this + exact (h2.norm.mono_left nhdsWithin_le_nhds).trans (by simp) + have hl : ContinuousOn (fun z : ℂ => ((z.re : ℂ) + ((w z.re * (z.im / Real.sqrt + (1 - z.re ^ 2)) : ℝ) : ℂ) * I)) (closedBall 0 1) := + ContinuousOn.add (by fun_prop) ((continuous_ofReal.comp_continuousOn hb).mul continuousOn_const) + exact hl + +theorem re_sq_add_im_sq_le {z : ℂ} (hz : z ∈ closedBall (0 : ℂ) 1) : z.re ^ 2 + z.im ^ 2 ≤ 1 := by + have h2 : ‖z‖ ≤ 1 := by simpa using hz + have h3 := Complex.sq_norm z + rw [Complex.normSq_apply] at h3 + nlinarith [norm_nonneg z] + +theorem eq_one_or_of_re {z : ℂ} (hz : z ∈ closedBall (0 : ℂ) 1) (h : ¬ z.re ∈ Ioo (-1 : ℝ) 1) : z + = 1 ∨ z = -1 := by + have h1 := re_sq_add_im_sq_le hz + have h2 : z.re ≤ -1 ∨ 1 ≤ z.re := by + by_contra hc + push Not at hc + exact h ⟨hc.1, hc.2⟩ + rcases h2 with h2 | h2 + · right + have h3 : z.re = -1 := by nlinarith [sq_nonneg z.im] + have h4 : z.im = 0 := by + rw [h3] at h1 + nlinarith [sq_nonneg z.im] + exact Complex.ext (by simpa using h3) (by simpa using h4) + · left + have h3 : z.re = 1 := by nlinarith [sq_nonneg z.im] + have h4 : z.im = 0 := by + rw [h3] at h1 + nlinarith [sq_nonneg z.im] + exact Complex.ext (by simpa using h3) (by simpa using h4) + +theorem re_mem_Ioo_sqrt {z : ℂ} (h : z.re ∈ Ioo (-1 : ℝ) 1) : 0 < Real.sqrt (1 - z.re ^ 2) := + Real.sqrt_pos.mpr (by nlinarith [h.1, h.2]) + +section plane + +variable {Z : Set ℂ} + +/-- The height of the lens. -/ +noncomputable def lensW (Z : Set ℂ) (s : ℝ) : ℝ := infDist (s : ℂ) Z / 2 + +theorem lensW_pos (hZ : IsClosed Z) (hne : Z.Nonempty) {s : ℝ} (hs : (s : ℂ) ∉ Z) : 0 < lensW Z s + := by + have := (hZ.notMem_iff_infDist_pos hne).mp hs + unfold lensW + positivity + +theorem lensMap_notMem (hZ : IsClosed Z) (hne : Z.Nonempty) (hs : ∀ s ∈ Ioo (-1 : ℝ) 1, + (s : ℂ) ∉ Z) {z : ℂ} (hz : z ∈ closedBall (0 : ℂ) 1) + (hr : z.re ∈ Ioo (-1 : ℝ) 1) : lensMap (lensW Z) z ∉ Z := fun hin => by + have hpos := lensW_pos hZ hne (hs _ hr) + have h1 : infDist (z.re : ℂ) Z ≤ dist (z.re : ℂ) (lensMap (lensW Z) z) + := infDist_le_dist_of_mem hin + have h2 : dist (z.re : ℂ) (lensMap (lensW Z) z) ≤ lensW Z z.re := by + have h3 : (z.re : ℂ) - lensMap (lensW Z) z = -(((lensW Z z.re * (z.im / Real.sqrt + (1 - z.re ^ 2)) : ℝ) : ℂ) * I) := by + simp [lensMap] + rw [dist_eq_norm, h3, norm_neg, norm_mul, Complex.norm_I, mul_one, Complex.norm_real, + norm_mul, Real.norm_of_nonneg hpos.le, Real.norm_eq_abs] + nlinarith [abs_ratio_le hz] + have e : lensW Z z.re = infDist (z.re : ℂ) Z / 2 := rfl + rw [e] at hpos h2 + linarith + +theorem injOn_lensMap (hZ : IsClosed Z) (hne : Z.Nonempty) (hs : ∀ s ∈ Ioo (-1 : ℝ) 1, + (s : ℂ) ∉ Z) : InjOn (lensMap (lensW Z)) (closedBall 0 1) := fun z hz z' hz' he => by + have h1 : z.re = z'.re := by rw [← lensMap_re (lensW Z) z, he, lensMap_re] + by_cases hr : z.re ∈ Ioo (-1 : ℝ) 1 + · have h2 := congrArg Complex.im he + rw [lensMap_im, lensMap_im, ← h1] at h2 + have hpos := lensW_pos hZ hne (hs _ hr) + have h3 := mul_left_cancel₀ hpos.ne' h2 + rw [div_left_inj₀ (re_mem_Ioo_sqrt hr).ne'] at h3 + exact Complex.ext h1 h3 + · have hr' : z'.re ∉ Ioo (-1 : ℝ) 1 := h1 ▸ hr + rcases eq_one_or_of_re hz hr with rfl | rfl <;> + rcases eq_one_or_of_re hz' hr' with rfl | rfl <;> first | rfl | (norm_num at h1) + +end plane + +/-- A continuous injective map on a closed disc gives a closed disc. -/ +theorem IsClosedDisc.image_injOn {X Y : Type} [TopologicalSpace X] [TopologicalSpace Y] [T2Space Y] + {Δ : Set X} (hΔ : IsClosedDisc Δ) {f : X → Y} (hf : ContinuousOn f Δ) + (hi : InjOn f Δ) : IsClosedDisc (f '' Δ) ∧ discBd (f '' Δ) = f '' discBd Δ := by + classical + have hcΔ : CompactSpace Δ := by + obtain ⟨e⟩ := id hΔ + have : CompactSpace ClosedUnitDisc := isCompact_iff_compactSpace.mp (isCompact_closedBall _ _) + exact e.compactSpace + obtain ⟨e₀⟩ := id hΔ + let x₀ : Δ := e₀ ⟨0, by simp [ClosedUnitDisc]⟩ + let g : Δ → f '' Δ := fun x => ⟨f x.1, x.1, x.2, rfl⟩ + have hg : Continuous g := (continuousOn_iff_continuous_domRestrict.mp hf).subtype_mk _ + have hb : Function.Bijective g := ⟨fun x y h => Subtype.ext (hi x.2 y.2 + (congrArg Subtype.val h)), fun ⟨_, x, hx, rfl⟩ => ⟨⟨x, hx⟩, rfl⟩⟩ + let e : Δ ≃ₜ f '' Δ := Continuous.homeoOfEquivCompactToT2 (f := Equiv.ofBijective g hb) hg + let f' : Y → X := fun y => if h : y ∈ f '' Δ then (e.symm ⟨y, h⟩).1 else x₀.1 + have hf' : ContinuousOn f' (f '' Δ) := by + rw [continuousOn_iff_continuous_domRestrict] + have he : (f '' Δ).domRestrict f' = fun y => (e.symm y).1 := by + funext y + exact dite_eq_left y.2 + rw [he] + exact continuous_subtype_val.comp e.symm.continuous + refine hΔ.image hf hf' fun x hx => ?_ + have h1 : f x ∈ f '' Δ := ⟨x, hx, rfl⟩ + have h2 : e ⟨x, hx⟩ = ⟨f x, h1⟩ := rfl + have h3 : e.symm ⟨f x, h1⟩ = ⟨x, hx⟩ := by rw [← h2, e.symm_apply_apply] + change f' (f x) = x + rw [show f' (f x) = (e.symm ⟨f x, h1⟩).1 from dite_eq_left h1, h3] + +theorem lensMap_real {w : ℝ → ℝ} (s : ℝ) : lensMap w s = s := by + apply Complex.ext + · simp [lensMap] + · simp [lensMap] + +variable {T : Type} [TopologicalSpace T] + +private theorem lens_side_path {Φ : ℂ → T} {u v : T} + (hΦc : ContinuousOn Φ (closedBall 0 1)) (hΦm : Φ (-1) = u) (hΦ1 : Φ 1 = v) + (c : ℝ) (hc' : |c| = 1) : + ∃ p : Path u v, range p ⊆ Φ '' closedBall 0 1 ∧ + ∀ t : 𝕀, 0 < t → t < 1 → + p t ∈ Φ '' {z | z ∈ closedBall (0 : ℂ) 1 ∧ 0 < c * z.im} := by + have hcc : c * c = 1 := by rw [← abs_mul_self, abs_mul, hc', one_mul] + let z : 𝕀 → ℂ := fun t => ((2 * t.1 - 1 : ℝ) : ℂ) + ((2 * c * t.1 * (1 - t.1) : ℝ) : ℂ) * I + have hzre : ∀ t, (z t).re = 2 * t.1 - 1 := fun t => by simp [z] + have hzim : ∀ t, (z t).im = 2 * c * t.1 * (1 - t.1) := fun t => by simp [z] + have hzb : ∀ t, z t ∈ closedBall (0 : ℂ) 1 := fun t => by + have h0 := t.2.1 + have h1 := t.2.2 + have hp : 0 ≤ t.1 * (1 - t.1) := mul_nonneg h0 (by linarith) + have hq : t.1 * (1 - t.1) ≤ 1 := by nlinarith + have hsq : (z t).re ^ 2 + (z t).im ^ 2 ≤ 1 := by + rw [hzre, hzim] + have e : (2 * c * t.1 * (1 - t.1)) ^ 2 = 4 * (c * c) * (t.1 * (1 - t.1)) ^ 2 := by ring + rw [e, hcc] + nlinarith + have h3 := Complex.sq_norm (z t) + rw [Complex.normSq_apply] at h3 + rw [mem_closedBall_zero_iff] + nlinarith [norm_nonneg (z t)] + have hzc : Continuous z := by + change Continuous fun t : 𝕀 => ((2 * t.1 - 1 : ℝ) : ℂ) + ((2 * c * t.1 * (1 - t.1) : ℝ) : ℂ) * I + fun_prop + have hz0 : z 0 = -1 := by + apply Complex.ext + · rw [hzre] + norm_num + · rw [hzim] + simp + have hz1 : z 1 = 1 := by + apply Complex.ext + · rw [hzre] + norm_num + · rw [hzim] + simp + refine ⟨⟨⟨fun t => Φ (z t), hΦc.comp_continuous hzc hzb⟩, by simp [hz0, hΦm], by simp [hz1, + hΦ1]⟩, ?_, ?_⟩ + · rintro _ ⟨t, rfl⟩ + exact ⟨z t, hzb t, rfl⟩ + · intro t h0 h1 + refine ⟨z t, ⟨hzb t, ?_⟩, rfl⟩ + have h0' : 0 < t.1 := h0 + have h1' : t.1 < 1 := h1 + rw [hzim] + have e : c * (2 * c * t.1 * (1 - t.1)) = 2 * (c * c) * t.1 * (1 - t.1) := by ring + rw [e, hcc] + have := mul_pos h0' (sub_pos.mpr h1') + nlinarith + +private theorem lens_from_disc_map [T2Space T] {L Z : Set T} {u v : T} {Φ : ℂ → T} + (hΦc : ContinuousOn Φ (closedBall 0 1)) (hΦi : InjOn Φ (closedBall 0 1)) + (hΦm : Φ (-1) = u) (hΦ1 : Φ 1 = v) + (hsball : ∀ s ∈ Icc (-1 : ℝ) 1, (s : ℂ) ∈ closedBall (0 : ℂ) 1) + (hΦL : ∀ s ∈ Icc (-1 : ℝ) 1, Φ s ∈ L) + (hLs : ∀ y ∈ L, ∃ s ∈ Icc (-1 : ℝ) 1, Φ s = y) + (hΦavoid : ∀ z ∈ closedBall (0 : ℂ) 1, z.re ∈ Ioo (-1 : ℝ) 1 → Φ z ∉ Z) : + ∃ D A B, IsClosedDisc D ∧ L ⊆ D ∧ D ∩ Z ⊆ {u, v} ∧ u ∈ discBd D ∧ v ∈ discBd D + ∧ discBd D ∩ L ⊆ {u, v} ∧ + D = A ∪ B ∪ L ∧ IsPreconnected A ∧ IsPreconnected B ∧ A.Nonempty ∧ B.Nonempty ∧ Disjoint A L + ∧ Disjoint B L ∧ L ⊆ closure A ∧ L ⊆ closure B ∧ + (∃ p : Path u v, range p ⊆ D ∧ ∀ t : 𝕀, 0 < t → t < 1 → p t ∈ A) ∧ + (∃ p : Path u v, range p ⊆ D ∧ ∀ t : 𝕀, 0 < t → t < 1 → p t ∈ B) ∧ + Disjoint A B ∧ IsPathConnected (A \ discBd D) ∧ IsPathConnected (B \ discBd D) := by + obtain ⟨hball, hballbd⟩ := isClosedDisc_of_convex (convex_closedBall (0 : ℂ) 1) (by + rw [interior_closedBall _ one_ne_zero] + exact ⟨0, by simp⟩) isBounded_closedBall isClosed_closedBall + obtain ⟨hD, hDb⟩ := hball.image_injOn hΦc hΦi + rw [hballbd, frontier_closedBall _ one_ne_zero] at hDb + have hnotL : ∀ z ∈ closedBall (0 : ℂ) 1, z.im ≠ 0 → Φ z ∉ L := fun z hz him hzL => by + obtain ⟨s, hs', hse⟩ := hLs _ hzL + have := hΦi (hsball s hs') hz hse + exact him (by rw [← this]; simp) + have hclo : ∀ (c : ℝ), c ≠ 0 → |c| = 1 → L ⊆ closure (Φ '' {z | z ∈ closedBall (0 : ℂ) 1 + ∧ 0 < c * z.im}) := fun c _ hc y hy => by + obtain ⟨s, hs', rfl⟩ := hLs y hy + refine ContinuousWithinAt.mem_closure_image (hΦc _ (hsball s hs') |>.mono fun z hz => hz.1) ?_ + rw [Metric.mem_closure_iff] + intro ε hε + set τ := min 1 (ε / 3) with hτ + have hτ0 : 0 < τ := lt_min one_pos (by positivity) + have hτ1 : τ ≤ 1 := min_le_left _ _ + have hτ2 : τ ≤ ε / 3 := min_le_right _ _ + have hsn : ‖(s : ℂ)‖ ≤ 1 := by simpa using hsball s hs' + have hin : ‖((c : ℂ) * I)‖ = 1 := by simp [hc] + refine ⟨(1 - τ : ℝ) * (s : ℂ) + (τ : ℝ) * ((c : ℂ) * I), ⟨?_, ?_⟩, ?_⟩ + · rw [mem_closedBall_zero_iff] + calc _ ≤ ‖((1 - τ : ℝ) : ℂ) * (s : ℂ)‖ + ‖((τ : ℝ) : ℂ) * ((c : ℂ) * I)‖ := norm_add_le _ _ + _ ≤ (1 - τ) * 1 + τ * 1 := by + have hsn' : ‖s‖ ≤ 1 := by simpa [Complex.norm_real] using hsn + simp only [norm_mul, hin, Complex.norm_real, Real.norm_of_nonneg hτ0.le, + Real.norm_of_nonneg (show 0 ≤ 1 - τ by linarith)] + nlinarith + _ = 1 := by ring + · have him : ((1 - τ : ℝ) * (s : ℂ) + (τ : ℝ) * ((c : ℂ) * I)).im = τ * c := by simp + rw [him] + have hcc : c * c = 1 := by rw [← abs_mul_self, abs_mul, hc, one_mul] + nlinarith + · have he : (s : ℂ) - ((1 - τ : ℝ) * (s : ℂ) + (τ : ℝ) * ((c : ℂ) * I)) = (τ : ℝ) * ((s : ℂ) - + (c : ℂ) * I) := by + push_cast + ring + rw [dist_eq_norm, he, norm_mul, Complex.norm_real, Real.norm_of_nonneg hτ0.le] + have h2 : ‖(s : ℂ) - (c : ℂ) * I‖ ≤ 2 := by + calc _ ≤ ‖(s : ℂ)‖ + ‖(c : ℂ) * I‖ := norm_sub_le _ _ + _ ≤ 2 := by rw [hin]; linarith + nlinarith + have hconv : ∀ c : ℝ, Convex ℝ {z : ℂ | z ∈ closedBall (0 : ℂ) 1 ∧ 0 < c * z.im} := fun c => by + change Convex ℝ (closedBall (0 : ℂ) 1 ∩ {z : ℂ | 0 < c * z.im}) + refine (convex_closedBall _ _).inter ?_ + intro x hx y hy p q hp hq hpq + have e : c * (p • x + q • y).im = p * (c * x.im) + q * (c * y.im) := by + simp + ring + change 0 < c * (p • x + q • y).im + rw [e] + have hx' : 0 < c * x.im := hx + have hy' : 0 < c * y.im := hy + rcases hp.eq_or_lt with h | h + · have : q = 1 := by linarith + subst h + simpa [this] using hy' + · have := mul_pos h hx' + have := mul_nonneg hq hy'.le + linarith + have hupc := hconv 1 + have hloc := hconv (-1) + have hpath := lens_side_path hΦc hΦm hΦ1 + have hin : ∀ c : ℝ, IsPathConnected (Φ '' {z | z ∈ closedBall (0 : ℂ) 1 + ∧ 0 < c * z.im} \ Φ '' sphere 0 1) ∨ c = 0 := fun c => by + by_cases hc : c = 0 + · exact .inr hc + left + have hbc : Convex ℝ {z : ℂ | z ∈ ball (0 : ℂ) 1 ∧ 0 < c * z.im} := by + have e : {z : ℂ | z ∈ ball (0 : ℂ) 1 ∧ 0 < c * z.im} = ball (0 : ℂ) 1 ∩ {z | z ∈ closedBall + (0 : ℂ) 1 ∧ 0 < c * z.im} := by + ext z + exact ⟨fun h => ⟨h.1, ball_subset_closedBall h.1, h.2⟩, fun h => ⟨h.1, h.2.2⟩⟩ + rw [e] + exact (convex_ball _ _).inter (hconv c) + have hne : {z : ℂ | z ∈ ball (0 : ℂ) 1 ∧ 0 < c * z.im}.Nonempty := by + refine ⟨(((1 / 2 : ℝ) * c / |c| : ℝ) : ℂ) * I, ?_, ?_⟩ + · have : ‖(((1 / 2 : ℝ) * c / |c| : ℝ) : ℂ) * I‖ = 1 / 2 := by + rw [norm_mul, Complex.norm_I, mul_one, Complex.norm_real, Real.norm_eq_abs, abs_div, + abs_mul, abs_abs, div_eq_mul_inv] + have h2 : |c| ≠ 0 := abs_ne_zero.mpr hc + field_simp + simp + rw [mem_ball_zero_iff, this] + norm_num + · have h2 : 0 < |c| := abs_pos.mpr hc + simp only [Complex.mul_im, Complex.ofReal_re, Complex.I_im, Complex.ofReal_im, + Complex.I_re, mul_one, mul_zero, add_zero] + have : c * ((1 / 2 : ℝ) * c / |c|) = (c * c) / (2 * |c|) := by ring + rw [this] + have := mul_self_pos.mpr hc + positivity + have e : Φ '' {z | z ∈ closedBall (0 : ℂ) 1 ∧ 0 < c * z.im} \ Φ '' sphere 0 1 + = Φ '' {z | z ∈ ball (0 : ℂ) 1 ∧ 0 < c * z.im} := by + ext y + constructor + · rintro ⟨⟨z, hz, rfl⟩, hy⟩ + refine ⟨z, ⟨?_, hz.2⟩, rfl⟩ + have h1 : ‖z‖ ≤ 1 := by simpa using hz.1 + have h2 : ‖z‖ ≠ 1 := fun h => hy ⟨z, by simpa using h, rfl⟩ + simpa using lt_of_le_of_ne h1 h2 + · rintro ⟨z, hz, rfl⟩ + refine ⟨⟨z, ⟨ball_subset_closedBall hz.1, hz.2⟩, rfl⟩, ?_⟩ + rintro ⟨z', hz', he⟩ + have := hΦi (sphere_subset_closedBall hz') (ball_subset_closedBall hz.1) he + rw [this] at hz' + have h1 : ‖z‖ = 1 := by simpa using hz' + have h2 : ‖z‖ < 1 := by simpa using hz.1 + linarith + rw [e] + exact (hbc.isPathConnected hne).image' (hΦc.mono fun z hz => ball_subset_closedBall hz.1) + refine ⟨Φ '' closedBall 0 1, Φ '' {z | z ∈ closedBall (0 : ℂ) 1 ∧ 0 < (1 : ℝ) * z.im}, + Φ '' {z | z ∈ closedBall (0 : ℂ) 1 ∧ 0 < (-1 : ℝ) * z.im}, hD, ?_, ?_, ?_, ?_, ?_, ?_, + (hupc.isPreconnected.image _ (hΦc.mono fun z hz => hz.1)), (hloc.isPreconnected.image _ + (hΦc.mono fun z hz => hz.1)), ?_, ?_, ?_, ?_, hclo 1 one_ne_zero (by simp), hclo (-1) + (by norm_num) (by simp), hpath 1 (by simp), hpath (-1) (by simp), ?_, ?_, ?_⟩ + · intro y hy + obtain ⟨s, hs', rfl⟩ := hLs y hy + exact ⟨s, hsball s hs', rfl⟩ + · rintro y ⟨⟨z, hz, rfl⟩, hyZ⟩ + by_cases hre : z.re ∈ Ioo (-1 : ℝ) 1 + · exact absurd hyZ (hΦavoid z hz hre) + · rcases eq_one_or_of_re hz hre with rfl | rfl + · exact .inr hΦ1 + · exact .inl hΦm + · rw [hDb] + exact ⟨-1, by simp, hΦm⟩ + · rw [hDb] + exact ⟨1, by simp, hΦ1⟩ + · rintro y ⟨hy, hyL⟩ + rw [hDb] at hy + obtain ⟨z, hz, rfl⟩ := hy + have hzb : z ∈ closedBall (0 : ℂ) 1 := sphere_subset_closedBall hz + by_cases hre : z.re ∈ Ioo (-1 : ℝ) 1 + · exfalso + have him : z.im = 0 := not_ne_iff.mp fun hn => hnotL z hzb hn hyL + have hz1 : ‖z‖ = 1 := by simpa using hz + have hsq := Complex.sq_norm z + rw [Complex.normSq_apply, hz1, him] at hsq + nlinarith [hre.1, hre.2] + · rcases eq_one_or_of_re hzb hre with rfl | rfl + · exact .inr hΦ1 + · exact .inl hΦm + · apply Subset.antisymm + · rintro _ ⟨z, hz, rfl⟩ + rcases lt_trichotomy z.im 0 with h | h | h + · exact .inl (.inr ⟨z, ⟨hz, by linarith⟩, rfl⟩) + · refine .inr ?_ + have e : z = (z.re : ℂ) := Complex.ext (by simp) (by simp [h]) + rw [e] + have hn := re_sq_add_im_sq_le hz + rw [h] at hn + exact hΦL _ ⟨by nlinarith, by nlinarith⟩ + · exact .inl (.inl ⟨z, ⟨hz, by linarith⟩, rfl⟩) + · refine union_subset (union_subset (image_mono fun z hz => hz.1) (image_mono fun z hz + => hz.1)) ?_ + intro y hy + obtain ⟨s, hs', rfl⟩ := hLs y hy + exact ⟨s, hsball s hs', rfl⟩ + · exact ⟨_, I, ⟨by simp, by simp⟩, rfl⟩ + · exact ⟨_, -I, ⟨by simp, by simp⟩, rfl⟩ + · rw [Set.disjoint_left] + rintro _ ⟨z, hz, rfl⟩ + exact hnotL z hz.1 (by have := hz.2; intro h; simp [h] at this) + · rw [Set.disjoint_left] + rintro _ ⟨z, hz, rfl⟩ + exact hnotL z hz.1 (by have := hz.2; intro h; simp [h] at this) + · rw [Set.disjoint_left] + rintro _ ⟨z, hz, rfl⟩ ⟨z', hz', he⟩ + have := hΦi hz'.1 hz.1 he + rw [this] at hz' + have h1 := hz.2 + have h2 := hz'.2 + linarith + · rw [hDb] + exact (hin 1).resolve_right one_ne_zero + · rw [hDb] + exact (hin (-1)).resolve_right (by norm_num) + +/-- **A thin disc around a line.** See the module docstring. -/ +theorem exists_edge_lens_sides (hT : IsClosedSurface T) {L : Set T} {u v : T} + (hL : IsLineWithEnds L u v) (_huv : u ≠ v) {Z : Set T} (hZ : IsClosed Z) (hLZ : L ∩ Z ⊆ {u, v}) : + ∃ D A B, IsClosedDisc D ∧ L ⊆ D ∧ D ∩ Z ⊆ {u, v} ∧ u ∈ discBd D ∧ v ∈ discBd D + ∧ discBd D ∩ L ⊆ {u, v} ∧ + D = A ∪ B ∪ L ∧ IsPreconnected A ∧ IsPreconnected B ∧ A.Nonempty ∧ B.Nonempty ∧ Disjoint A L + ∧ Disjoint B L ∧ L ⊆ closure A ∧ L ⊆ closure B ∧ + (∃ p : Path u v, range p ⊆ D ∧ ∀ t : 𝕀, 0 < t → t < 1 → p t ∈ A) ∧ + (∃ p : Path u v, range p ⊆ D ∧ ∀ t : 𝕀, 0 < t → t < 1 → p t ∈ B) ∧ + Disjoint A B ∧ IsPathConnected (A \ discBd D) ∧ IsPathConnected (B \ discBd D) := by + classical + have hcpt : CompactSpace T := hT.1 + have ht2 : T2Space T := hT.2.1 + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hT.2.2 x).isManifoldPoint + obtain ⟨a, ha, hr, ha0, ha1⟩ := hL.exists_arc + obtain ⟨D₀, hD₀, hs⟩ := exists_disc_of_arc hT ha + obtain ⟨h, g, cc⟩ := hD₀.exists_isChart + have hbc : BallChart 1 (g '' ball 0 1) h g := by + refine ⟨cc.isOpen_image_ball hman, cc.hc.mono ?_, cc.gc.mono ball_subset_closedBall, ?_, ?_, + ?_, ?_⟩ + · rintro _ ⟨z, hz, rfl⟩ + exact cc.gm (ball_subset_closedBall hz) + · rintro _ ⟨z, hz, rfl⟩ + rwa [cc.hg (ball_subset_closedBall hz)] + · exact fun z hz => ⟨z, hz, rfl⟩ + · rintro _ ⟨z, hz, rfl⟩ + rw [cc.hg (ball_subset_closedBall hz)] + · exact fun z hz => cc.hg (ball_subset_closedBall hz) + have hU : range a ⊆ g '' ball 0 1 := by + rw [← cc.discInt_eq] + exact hs + obtain ⟨O, K, θ, hK, hθc, hθm, hθ⟩ := exists_stripChart hman hbc ha hU + have hlt : θ 0 < θ 1 := hθm (by simp) + set A : ℝ := (θ 1 - θ 0) / 2 with hA + set B : ℝ := (θ 0 + θ 1) / 2 with hB + have hApos : 0 < A := by rw [hA]; linarith + let aff : ℂ → ℂ := fun z => (B : ℂ) + (A : ℂ) * z + have haffc : Continuous aff := by fun_prop + have haffi : Function.Injective aff := fun x y h' => by + have h1 : (A : ℂ) * x = (A : ℂ) * y := add_left_cancel h' + exact mul_left_cancel₀ (by exact_mod_cast hApos.ne') h1 + have hreal : ∀ s : ℝ, aff s = ((B + A * s : ℝ) : ℂ) := fun s => by + simp [aff] + have hone : aff 1 = (θ 1 : ℂ) := by + have := hreal 1 + simp only [Complex.ofReal_one] at this + rw [this] + congr 1 + rw [hA, hB] + ring + have hmone : aff (-1) = (θ 0 : ℂ) := by + have := hreal (-1) + simp only [Complex.ofReal_neg, Complex.ofReal_one] at this + rw [this] + congr 1 + rw [hA, hB] + ring + let O₁ : Set ℂ := aff ⁻¹' O + have hO₁ : IsOpen O₁ := hK.isOpen.preimage haffc + let K₁ : ℂ → T := K ∘ aff + have hK₁c : ContinuousOn K₁ O₁ := hK.hc.comp haffc.continuousOn fun _ h' => h' + have hK₁i : InjOn K₁ O₁ := fun x hx y hy h' => haffi (hK.hi hx hy h') + have h1O : (1 : ℂ) ∈ O₁ := by + change aff 1 ∈ O + rw [hone] + exact (hθ 1).1 + have hmO : (-1 : ℂ) ∈ O₁ := by + change aff (-1) ∈ O + rw [hmone] + exact (hθ 0).1 + have hK1 : K₁ 1 = v := by + change K (aff 1) = v + rw [hone, (hθ 1).2, ha1] + have hKm : K₁ (-1) = u := by + change K (aff (-1)) = u + rw [hmone, (hθ 0).2, ha0] + have hsθ : ∀ s ∈ Icc (-1 : ℝ) 1, ∃ t, θ t = B + A * s := fun s hs' => by + apply mem_range_of_exists_le_of_exists_ge hθc + · exact ⟨0, by rw [hA, hB]; nlinarith [hs'.1]⟩ + · exact ⟨1, by rw [hA, hB]; nlinarith [hs'.2]⟩ + have hsO : ∀ s ∈ Icc (-1 : ℝ) 1, ∃ t, (s : ℂ) ∈ O₁ ∧ K₁ s = a t ∧ θ t = B + A * s := fun s hs' + => by + obtain ⟨t, ht⟩ := hsθ s hs' + have e : aff s = (θ t : ℂ) := by rw [hreal, ht] + refine ⟨t, ?_, ?_, ht⟩ + · change aff s ∈ O + rw [e] + exact (hθ t).1 + · change K (aff s) = a t + rw [e, (hθ t).2] + let Z₁ : Set ℂ := (O₁ᶜ ∪ (O₁ ∩ K₁ ⁻¹' Z)) ∪ {1, -1} + have hZ₁ : IsClosed Z₁ := by + have h1 : (O₁ ∩ K₁ ⁻¹' Zᶜ) = (O₁ᶜ ∪ (O₁ ∩ K₁ ⁻¹' Z))ᶜ := by + ext z + simp only [mem_inter_iff, mem_preimage, mem_compl_iff, mem_union, not_or, not_and, not_not] + exact ⟨fun h' => ⟨h'.1, fun _ => h'.2⟩, fun h' => ⟨h'.1, h'.2 h'.1⟩⟩ + have h2 : IsOpen (O₁ ∩ K₁ ⁻¹' Zᶜ) := hK₁c.isOpen_inter_preimage hO₁ hZ.isOpen_compl + rw [h1] at h2 + exact (isOpen_compl_iff.mp h2).union ((finite_singleton _).insert _).isClosed + have hZne : Z₁.Nonempty := ⟨1, .inr (.inl rfl)⟩ + have hsZ : ∀ s ∈ Ioo (-1 : ℝ) 1, (s : ℂ) ∉ Z₁ := fun s hs' hin => by + obtain ⟨t, hO, hKt, hθt⟩ := hsO s ⟨hs'.1.le, hs'.2.le⟩ + have ht0 : t ≠ 0 := fun h' => by + rw [h', hA, hB] at hθt + nlinarith [hs'.1] + have ht1 : t ≠ 1 := fun h' => by + rw [h', hA, hB] at hθt + nlinarith [hs'.2] + rcases hin with (h1 | h1) | h1 + · exact h1 hO + · have h2 : a t ∈ L ∩ Z := ⟨hr ▸ mem_range_self t, hKt ▸ h1.2⟩ + rcases hLZ h2 with h3 | h3 + · exact ht0 (ha.2 (h3.trans ha0.symm)) + · exact ht1 (ha.2 (h3.trans ha1.symm)) + · rcases h1 with h1 | h1 + · have : s = 1 := by exact_mod_cast h1 + linarith [hs'.2] + · have h1' : (s : ℂ) = -1 := h1 + have : s = -1 := by + have h2 := congrArg Complex.re h1' + simpa using h2 + linarith [hs'.1] + let w := lensW Z₁ + have hwc : Continuous w := by + change Continuous fun s : ℝ => infDist (s : ℂ) Z₁ / 2 + exact ((continuous_infDist_pt Z₁).comp continuous_ofReal).div_const 2 + have hw1 : w 1 = 0 := by + change infDist (((1 : ℝ) : ℂ)) Z₁ / 2 = 0 + have hmem : (1 : ℂ) ∈ Z₁ := .inr (.inl rfl) + rw [Complex.ofReal_one, infDist_zero_of_mem hmem, zero_div] + have hwm : w (-1) = 0 := by + change infDist (((-1 : ℝ) : ℂ)) Z₁ / 2 = 0 + have hmem : (-1 : ℂ) ∈ Z₁ := .inr (.inr rfl) + rw [Complex.ofReal_neg, Complex.ofReal_one, infDist_zero_of_mem hmem, zero_div] + have hlc := continuousOn_lensMap hwc hw1 hwm + have hli := injOn_lensMap hZ₁ hZne hsZ + have hl1 : lensMap w 1 = 1 := by simpa using lensMap_real (w := w) 1 + have hlm : lensMap w (-1) = -1 := by simpa using lensMap_real (w := w) (-1) + have hlin : ∀ z ∈ closedBall (0 : ℂ) 1, z.re ∈ Ioo (-1 : ℝ) 1 → lensMap w z ∈ O₁ ∧ K₁ + (lensMap w z) ∉ Z := fun z hz hre => by + have h1 := lensMap_notMem hZ₁ hZne hsZ hz hre + have h2 : lensMap w z ∈ O₁ := by + by_contra hc + exact h1 (.inl (.inl hc)) + exact ⟨h2, fun h3 => h1 (.inl (.inr ⟨h2, h3⟩))⟩ + have hlO : ∀ z ∈ closedBall (0 : ℂ) 1, lensMap w z ∈ O₁ := fun z hz => by + by_cases hre : z.re ∈ Ioo (-1 : ℝ) 1 + · exact (hlin z hz hre).1 + · rcases eq_one_or_of_re hz hre with rfl | rfl + · rw [hl1] + exact h1O + · rw [hlm] + exact hmO + let Φ : ℂ → T := K₁ ∘ lensMap w + have hΦc : ContinuousOn Φ (closedBall 0 1) := hK₁c.comp hlc hlO + have hΦi : InjOn Φ (closedBall 0 1) := fun x hx y hy he => hli hx hy (hK₁i (hlO x hx) + (hlO y hy) he) + have hΦ1 : Φ 1 = v := by + change K₁ (lensMap w 1) = v + rw [hl1, hK1] + have hΦm : Φ (-1) = u := by + change K₁ (lensMap w (-1)) = u + rw [hlm, hKm] + have hts : ∀ t, ∃ s ∈ Icc (-1 : ℝ) 1, θ t = B + A * s := fun t => by + refine ⟨(θ t - B) / A, ⟨?_, ?_⟩, by field_simp; ring⟩ + · rw [le_div_iff₀ hApos] + have := hθm.monotone (unitInterval.nonneg' (t := t)) + rw [hA, hB] + linarith + · rw [div_le_iff₀ hApos] + have := hθm.monotone (unitInterval.le_one' (t := t)) + rw [hA, hB] + linarith + have hsball : ∀ s ∈ Icc (-1 : ℝ) 1, (s : ℂ) ∈ closedBall (0 : ℂ) 1 := fun s hs' => by + have : |s| ≤ 1 := abs_le.mpr hs' + simpa [Complex.norm_real] using this + have hΦs : ∀ t, ∀ s : ℝ, θ t = B + A * s → Φ s = a t := fun t s hst => by + change K₁ (lensMap w s) = a t + rw [lensMap_real] + change K (aff s) = a t + rw [hreal, ← hst, (hθ t).2] + have hΦL : ∀ s ∈ Icc (-1 : ℝ) 1, Φ s ∈ L := fun s hs' => by + obtain ⟨t, -, hKt, hθt⟩ := hsO s hs' + rw [hΦs t s hθt, ← hr] + exact mem_range_self t + have hLs : ∀ y ∈ L, ∃ s ∈ Icc (-1 : ℝ) 1, Φ s = y := fun y hy => by + obtain ⟨t, rfl⟩ : y ∈ range a := hr ▸ hy + obtain ⟨s, hs', hst⟩ := hts t + exact ⟨s, hs', hΦs t s hst⟩ + exact lens_from_disc_map hΦc hΦi hΦm hΦ1 hsball hΦL hLs + (fun z hz hre => (hlin z hz hre).2) + +/-- A thin closed disc around a line, with its two sides. -/ +theorem exists_edge_lens (hT : IsClosedSurface T) {L : Set T} {u v : T} (hL : IsLineWithEnds L u v) + (huv : u ≠ v) {Z : Set T} (hZ : IsClosed Z) (hLZ : L ∩ Z ⊆ {u, v}) : + ∃ D A B, IsClosedDisc D ∧ L ⊆ D ∧ D ∩ Z ⊆ {u, v} ∧ u ∈ discBd D ∧ v ∈ discBd D + ∧ discBd D ∩ L ⊆ {u, v} ∧ + D = A ∪ B ∪ L ∧ IsPreconnected A ∧ IsPreconnected B ∧ A.Nonempty ∧ B.Nonempty ∧ Disjoint A L + ∧ Disjoint B L ∧ L ⊆ closure A ∧ L ⊆ closure B ∧ + (∃ p : Path u v, range p ⊆ D ∧ ∀ t : 𝕀, 0 < t → t < 1 → p t ∈ A) ∧ + (∃ p : Path u v, range p ⊆ D ∧ ∀ t : 𝕀, 0 < t → t < 1 → p t ∈ B) := by + obtain ⟨D, A, B, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, h14, h15, h16, h17, -⟩ + := exists_edge_lens_sides hT hL huv hZ hLZ + exact ⟨D, A, B, h1, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, h14, h15, h16, h17⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/EdgeLoop.lean b/LeanPool/GraphMinor/Surface/EdgeLoop.lean new file mode 100644 index 0000000000..9e9b067a75 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/EdgeLoop.lean @@ -0,0 +1,518 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Dissection + +/-! +# An `O`-arc in a graph as a loop of edges + +Let `P` be an `O`-arc in a graph. Going once around `P` we pass through finitely many edges, each of +them as a whole +(`exists_edge_loop`). The loop is parametrized by `[0, m]`, and on each `[p, p + 1]` it runs along +the given +parametrization of an edge, forwards or backwards. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +local notation "𝕀" => unitInterval + +/-- The points of a finite set in increasing order. -/ +theorem exists_sorted {T : Set ℝ} (hT : T.Finite) (hsub : T ⊆ Icc 0 1) (h0 : (0 : ℝ) ∈ T) (h1 : + (1 : ℝ) ∈ T) : + ∃ (m : ℕ) (t : ℕ → ℝ), 0 < m ∧ t 0 = 0 ∧ t m = 1 ∧ (∀ p < m, t p < t (p + 1)) ∧ (∀ p + ≤ m, t p ∈ T) ∧ + (∀ p < m, ∀ x ∈ T, x ∉ Ioo (t p) (t (p + 1))) ∧ (∀ x ∈ T, ∃ p ≤ m, t p = x) := by + classical + set s := hT.toFinset with hs + have hcard : 2 ≤ s.card := by + have h2 : ({0, 1} : Finset ℝ) ⊆ s := by + intro x hx + simp only [Finset.mem_insert, Finset.mem_singleton] at hx + rcases hx with rfl | rfl <;> simpa [hs] + have h3 := Finset.card_le_card h2 + rwa [Finset.card_pair (zero_ne_one' ℝ)] at h3 + set n := s.card with hn + let e := s.orderEmbOfFin (k := n) rfl + obtain ⟨m, hm⟩ : ∃ m, n = m + 1 := ⟨n - 1, by omega⟩ + have hb : ∀ p, min p m < n := fun p => by omega + let t : ℕ → ℝ := fun p => e ⟨min p m, hb p⟩ + have hmem : ∀ i, e i ∈ T := fun i => by + have : e i ∈ s := Finset.orderEmbOfFin_mem s rfl i + simpa [hs] using this + have hmin : ∀ x ∈ T, t 0 ≤ x := fun x hx => by + obtain ⟨i, rfl⟩ : x ∈ range e := by + rw [Finset.range_orderEmbOfFin] + simpa [hs] using hx + refine e.monotone ?_ + simp [Fin.le_def] + have hmax : ∀ x ∈ T, x ≤ t m := fun x hx => by + obtain ⟨i, rfl⟩ : x ∈ range e := by + rw [Finset.range_orderEmbOfFin] + simpa [hs] using hx + refine e.monotone ?_ + simp only [Fin.le_def, min_self] + omega + refine ⟨m, t, by omega, ?_, ?_, ?_, fun p _ => hmem _, ?_, ?_⟩ + · exact le_antisymm (hmin 0 h0) (hsub (hmem _)).1 + · exact le_antisymm (hsub (hmem _)).2 (hmax 1 h1) + · intro p hp + refine e.strictMono ?_ + simp only [Fin.lt_def] + omega + · rintro p hp x hx ⟨h2, h3⟩ + obtain ⟨i, rfl⟩ : x ∈ range e := by + rw [Finset.range_orderEmbOfFin] + simpa [hs] using hx + have h4 := e.lt_iff_lt.mp h2 + have h5 := e.lt_iff_lt.mp h3 + simp only [Fin.lt_def] at h4 h5 + omega + · intro x hx + obtain ⟨i, rfl⟩ : x ∈ range e := by + rw [Finset.range_orderEmbOfFin] + simpa [hs] using hx + refine ⟨i, by omega, ?_⟩ + simp only [t] + congr 1 + ext + simp + omega + +variable {X : Type u} [TopologicalSpace X] [T2Space X] {V : Set X} {E : Set (Set X)} + +/-- A connected set off the vertices lies in one edge. -/ +theorem IsGraph.subset_edge (hg : IsGraph V E) {J : Set X} (hJ : IsPreconnected J) (hG : J ⊆ ⋃₀ E) + (hV : Disjoint J V) + {e : Set X} (he : e ∈ E) (hm : (J ∩ e).Nonempty) : J ⊆ e := by + classical + have hcl : ∀ f ∈ E, IsClosed f := fun f hf => by + obtain ⟨u, v, -, hl, -⟩ := hg.edge f hf + exact hl.isCompact.isClosed + have h2 : IsClosed (⋃₀ (E \ {e})) := (hg.fine.subset sdiff_subset).isClosed_sUnion fun f hf + => hcl f hf.1 + by_contra hcon + obtain ⟨z, hz, hz'⟩ := not_subset.mp hcon + obtain ⟨f, hf, hzf⟩ := hG hz + have hfe : f ≠ e := fun h => hz' (h ▸ hzf) + obtain ⟨y, hy, hy1, ⟨g, hg', hyg⟩⟩ := isPreconnected_closed_iff.mp hJ _ _ (hcl e he) h2 + (fun w hw => by + obtain ⟨f', hf', hw'⟩ := hG hw + by_cases h : f' = e + · exact .inl (h ▸ hw') + · exact .inr ⟨f', ⟨hf', h⟩, hw'⟩) (by + obtain ⟨w, hw, hw'⟩ := hm + exact ⟨w, hw, hw'⟩) ⟨z, hz, f, ⟨hf, hfe⟩, hzf⟩ + exact Set.disjoint_left.mp hV hy (hg.disj e he g hg'.1 (Ne.symm hg'.2) ⟨hy1, hyg⟩) + +/-- A connected set in an arc that contains both ends is the whole arc. -/ +theorem IsLineWithEnds.eq_of_subset {L J : Set X} {u v : X} (hl : IsLineWithEnds L u v) + (hJ : IsPreconnected J) + (hs : J ⊆ L) (hu : u ∈ J) (hv : v ∈ J) : J = L := by + obtain ⟨a, ha, rfl, rfl, rfl⟩ := hl.exists_arc + refine subset_antisymm hs ?_ + have hemb : IsEmbedding a := (ha.1.isClosedEmbedding ha.2).isEmbedding + have hpc : IsPreconnected (a ⁻¹' J) := by + refine hemb.isInducing.isPreconnected_image.mp ?_ + rw [image_preimage_eq_inter_range, inter_eq_left.mpr hs] + exact hJ + rintro _ ⟨t, rfl⟩ + exact hpc.ordConnected.out hu hv ⟨unitInterval.nonneg t, unitInterval.le_one t⟩ + +omit [T2Space X] in +/-- The circle `P` as a loop on the unit interval from a given point of `P`. -/ +theorem IsOArc.exists_iota {P : Set X} (hP : IsOArc P) {v : X} (hv : v ∈ P) : + ∃ ι : ℝ → X, Continuous ι ∧ ι 0 = v ∧ ι 1 = v ∧ InjOn ι (Ico 0 1) ∧ InjOn ι (Ioc 0 1) + ∧ ι '' Ico 0 1 = P := by + obtain ⟨φ⟩ := id hP + obtain ⟨θ0, hθ0⟩ : ∃ θ : ℝ, Circle.exp θ = φ.symm ⟨v, hv⟩ := ⟨Complex.arg _, Circle.exp_arg _⟩ + let ι : ℝ → X := fun t => (φ (Circle.exp (θ0 + 2 * Real.pi * t))).1 + have hpi := Real.pi_pos + have hinj : ∀ x y : ℝ, |x - y| < 1 → ι x = ι y → x = y := fun x y hxy he => by + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp (φ.injective (Subtype.ext he)) + have h1 : x - y = m := by + have h2 : (2 * Real.pi) * (x - y) = (2 * Real.pi) * m := by linarith + exact mul_left_cancel₀ (by positivity) h2 + rw [h1] at hxy + have h3 : |m| < 1 := by exact_mod_cast hxy + have h4 : m = 0 := Int.abs_lt_one_iff.mp h3 + rw [h4] at h1 + simp only [Int.cast_zero] at h1 + linarith + have h0 : ι 0 = v := by + simp only [ι, mul_zero, add_zero, hθ0] + simp + have h1 : ι 1 = v := by + have : Circle.exp (θ0 + 2 * Real.pi * 1) = Circle.exp θ0 := by + rw [mul_one, Circle.exp_add, Circle.exp_two_pi, mul_one] + simp only [ι, this, hθ0] + simp + refine ⟨ι, ?_, h0, h1, ?_, ?_, ?_⟩ + · exact continuous_subtype_val.comp (φ.continuous.comp (Circle.exp.continuous.comp (by fun_prop))) + · intro x hx y hy he + exact hinj x y (abs_lt.mpr ⟨by linarith [hx.1, hy.2], by linarith [hx.2, hy.1]⟩) he + · intro x hx y hy he + exact hinj x y (abs_lt.mpr ⟨by linarith [hx.1, hy.2], by linarith [hx.2, hy.1]⟩) he + · ext z + constructor + · rintro ⟨t, -, rfl⟩ + exact (φ _).2 + · intro hz + obtain ⟨t, ht, e⟩ := exists_circle_angle (Circle.exp θ0) (φ.symm ⟨z, hz⟩) + rw [← Circle.exp_add] at e + refine ⟨t / (2 * Real.pi), ⟨by have := ht.1; positivity, ?_⟩, ?_⟩ + · rw [div_lt_one (by positivity)] + exact ht.2 + · simp only [ι] + rw [show 2 * Real.pi * (t / (2 * Real.pi)) = t by field_simp, ← e] + simp + +/-- The consecutive vertex preimages of a parametrized graph arc bound entire oriented edges. +For a loop, the presence of an interior vertex excludes the interval with equal endpoints. -/ +theorem IsGraph.exists_edge_intervals (hg : IsGraph V E) (A : Set X → 𝕀 → X) + (hA : ∀ e ∈ E, IsArcMap (A e) ∧ range (A e) = e ∧ e ∩ V = {A e 0, A e 1}) + {ι : ℝ → X} (hιc : Continuous ι) (hinj : InjOn ι (Ico 0 1)) (hinj' : InjOn ι (Ioc 0 1)) + (hG : ι '' Icc 0 1 ⊆ gr V E) (h0 : ι 0 ∈ V) (h1 : ι 1 ∈ V) + (hne : ι 0 ≠ ι 1 ∨ ∃ x ∈ Ioo (0 : ℝ) 1, ι x ∈ V) : + ∃ (m : ℕ) (t : ℕ → ℝ) (s : ℕ → Set X) (ε : ℕ → Bool), 0 < m ∧ t 0 = 0 ∧ t m = 1 ∧ + (∀ p < m, t p < t (p + 1)) ∧ + (∀ p ≤ m, t p ∈ Icc (0 : ℝ) 1 ∩ ι ⁻¹' V) ∧ + (∀ x ∈ Icc (0 : ℝ) 1 ∩ ι ⁻¹' V, ∃ p ≤ m, t p = x) ∧ + ∀ p < m, s p ∈ E ∧ ι '' Icc (t p) (t (p + 1)) = s p ∧ + ι (t p) = extI (A (s p)) (if ε p then 0 else 1) ∧ + ι (t (p + 1)) = extI (A (s p)) (if ε p then 1 else 0) := by + classical + have hcl : ∀ f ∈ E, IsClosed f := fun f hf => by + obtain ⟨u, v, -, hl, -⟩ := hg.edge f hf + exact hl.isCompact.isClosed + have hline : ∀ e ∈ E, IsLineWithEnds e (A e 0) (A e 1) := fun e he => by + have := (hA e he).1.isLineWithEnds + rwa [(hA e he).2.1] at this + let T : Set ℝ := Icc 0 1 ∩ ι ⁻¹' V + have hTf : T.Finite := by + have h1 : (Ico 0 1 ∩ ι ⁻¹' V : Set ℝ).Finite := + Set.Finite.of_finite_image (hg.fin.subset (by rintro _ ⟨x, hx, rfl⟩; exact hx.2)) + (hinj.mono inter_subset_left) + refine (h1.union (finite_singleton (1 : ℝ))).subset ?_ + rintro x ⟨hx, hxV⟩ + rcases eq_or_lt_of_le hx.2 with rfl | h2 + · exact .inr rfl + · exact .inl ⟨⟨hx.1, h2⟩, hxV⟩ + have h0T : (0 : ℝ) ∈ T := ⟨⟨le_rfl, zero_le_one⟩, h0⟩ + have h1T : (1 : ℝ) ∈ T := ⟨⟨zero_le_one, le_rfl⟩, h1⟩ + obtain ⟨m, t, hm, ht0, htm, hlt, hmem, hgap, hall⟩ := exists_sorted hTf inter_subset_left h0T h1T + have key : ∀ p, ∃ (e : Set X) (b : Bool), p < m → e ∈ E ∧ ι '' Icc (t p) (t (p + 1)) = e ∧ + ι (t p) = extI (A e) (if b then 0 else 1) ∧ ι (t (p + 1)) = extI (A e) (if b then 1 else 0) + := by + intro p + by_cases hp : p < m + swap + · exact ⟨∅, true, fun h => absurd h hp⟩ + have hab := hlt p hp + have ha1 := hmem p hp.le + have hb1 := hmem (p + 1) hp + have hopen : ∀ x ∈ Ioo (t p) (t (p + 1)), ι x ∉ V := fun x hx hxV => + hgap p hp x ⟨⟨ha1.1.1.trans hx.1.le, hx.2.le.trans hb1.1.2⟩, hxV⟩ hx + have hsubI : Ioo (t p) (t (p + 1)) ⊆ Icc 0 1 := fun x hx => ⟨ha1.1.1.trans hx.1.le, + hx.2.le.trans hb1.1.2⟩ + have hJP : ι '' Ioo (t p) (t (p + 1)) ⊆ ι '' Icc 0 1 := image_mono hsubI + have hconn : IsPreconnected (ι '' Ioo (t p) (t (p + 1))) := isPreconnected_Ioo.image _ + hιc.continuousOn + have hdisj : Disjoint (ι '' Ioo (t p) (t (p + 1))) V := Set.disjoint_left.mpr fun z hz hzV => by + obtain ⟨x, hx, rfl⟩ := hz + exact hopen x hx hzV + obtain ⟨x0, hx0⟩ : (Ioo (t p) (t (p + 1))).Nonempty := nonempty_Ioo.mpr hab + have hJG : ι '' Ioo (t p) (t (p + 1)) ⊆ ⋃₀ E := fun z hz => + (hG (hJP hz)).resolve_left (Set.disjoint_left.mp hdisj hz) + obtain ⟨e, he, hxe⟩ := hJG (mem_image_of_mem ι hx0) + have hJe := hg.subset_edge hconn hJG hdisj he ⟨_, mem_image_of_mem ι hx0, hxe⟩ + have hIe : ι '' Icc (t p) (t (p + 1)) ⊆ e := by + rw [← closure_Ioo hab.ne] + exact (image_closure_subset_closure_image hιc).trans (closure_minimal hJe (hcl e he)) + have hea : ι (t p) ∈ e ∩ V := ⟨hIe ⟨_, ⟨le_rfl, hab.le⟩, rfl⟩, ha1.2⟩ + have heb : ι (t (p + 1)) ∈ e ∩ V := ⟨hIe ⟨_, ⟨hab.le, le_rfl⟩, rfl⟩, hb1.2⟩ + have hne' : ι (t p) ≠ ι (t (p + 1)) := by + intro he' + have ha0 : t p = 0 := by + by_contra hc + have h1 : t p ∈ Ioc (0 : ℝ) 1 := ⟨lt_of_le_of_ne ha1.1.1 (Ne.symm hc), ha1.1.2⟩ + exact hab.ne (hinj' h1 ⟨ha1.1.1.trans_lt hab, hb1.1.2⟩ he') + have hb2 : t (p + 1) = 1 := by + by_contra hc + have h1 : t (p + 1) ∈ Ico (0 : ℝ) 1 := ⟨hb1.1.1, lt_of_le_of_ne hb1.1.2 hc⟩ + exact hab.ne (hinj ⟨ha1.1.1, hab.trans h1.2⟩ h1 he') + rw [ha0, hb2] at he' hopen + rcases hne with h3 | ⟨x, hx, hxV⟩ + · exact h3 he' + · exact hopen x hx hxV + have hpair : e ∩ V = {A e 0, A e 1} := (hA e he).2.2 + rw [hpair] at hea heb + have hval0 : extI (A e) 0 = A e 0 := extI_coe (A e) 0 + have hval1 : extI (A e) 1 = A e 1 := extI_coe (A e) 1 + have hconnI : IsPreconnected (ι '' Icc (t p) (t (p + 1))) := isPreconnected_Icc.image _ + hιc.continuousOn + rcases hea with hea | hea <;> rcases heb with heb | heb + · exact absurd (hea.trans heb.symm) hne' + · have heb' : ι (t (p + 1)) = A e 1 := heb + refine ⟨e, true, fun _ => ⟨he, ?_, by simp [hea, hval0], by simp [heb', hval1]⟩⟩ + exact (hline e he).eq_of_subset hconnI hIe ⟨_, ⟨le_rfl, hab.le⟩, hea⟩ ⟨_, ⟨hab.le, le_rfl⟩, + heb⟩ + · have hea' : ι (t p) = A e 1 := hea + refine ⟨e, false, fun _ => ⟨he, ?_, by simp [hea', hval1], by simp [heb, hval0]⟩⟩ + exact (hline e he).eq_of_subset hconnI hIe ⟨_, ⟨hab.le, le_rfl⟩, heb⟩ ⟨_, ⟨le_rfl, hab.le⟩, + hea⟩ + · exact absurd (hea.trans heb.symm) hne' + choose s ε hs using key + exact ⟨m, t, s, ε, hm, ht0, htm, hlt, hmem, hall, hs⟩ + +/-- The sides of the loop around `P`, before gluing them. -/ +theorem exists_edge_sides (hg : IsGraph V E) {P : Set X} (hP : IsOArc P) (hPG : P ⊆ ⋃₀ E) + (A : Set X → 𝕀 → X) + (hA : ∀ e ∈ E, IsArcMap (A e) ∧ range (A e) = e ∧ e ∩ V = {A e 0, A e 1}) : + ∃ (ι : ℝ → X) (m : ℕ) (t : ℕ → ℝ) (s : ℕ → Set X) (ε : ℕ → Bool), Continuous ι ∧ 0 < m ∧ t 0 + = 0 ∧ t m = 1 ∧ + (∀ p < m, t p < t (p + 1)) ∧ ι 0 = ι 1 ∧ InjOn ι (Ico 0 1) ∧ ι '' Ico 0 1 = P ∧ + ∀ p < m, s p ∈ E ∧ s p ⊆ P ∧ ι (t p) = extI (A (s p)) (if ε p then 0 else 1) ∧ + ι (t (p + 1)) = extI (A (s p)) (if ε p then 1 else 0) ∧ ι '' Icc (t p) (t (p + 1)) = s p + := by + classical + have hPg : P ⊆ gr V E := hPG.trans subset_union_right + have hends : ∀ e ∈ E, A e 0 ≠ A e 1 := fun e he he' => by + have h1 := (hA e he).1.2 he' + exact zero_ne_one h1 + have hline : ∀ e ∈ E, IsLineWithEnds e (A e 0) (A e 1) := fun e he => by + have := (hA e he).1.isLineWithEnds + rwa [(hA e he).2.1] at this + have hmemV0 : ∀ e ∈ E, A e 0 ∈ V := fun e he => by + have : A e 0 ∈ e ∩ V := (hA e he).2.2 ▸ mem_insert _ _ + exact this.2 + have hmemV1 : ∀ e ∈ E, A e 1 ∈ V := fun e he => by + have : A e 1 ∈ e ∩ V := (hA e he).2.2 ▸ mem_insert_of_mem _ rfl + exact this.2 + obtain ⟨v0, hv0P, hv0V⟩ : ∃ v ∈ P, v ∈ V := by + obtain ⟨φ⟩ := id hP + obtain ⟨e, he, hxe⟩ := hPG (φ 1).2 + by_cases hx : (φ 1).1 ∈ V + · exact ⟨_, (φ 1).2, hx⟩ + · rcases hg.edge_or hP hPg he with h1 | h1 + · exact ⟨A e 0, h1 ((hline e he).left_mem), hmemV0 e he⟩ + · exact absurd (φ 1).2 (Set.disjoint_left.mp h1 ⟨hxe, hx⟩) + obtain ⟨ι, hιc, hι0, hι1, hinj, hinj', hιim⟩ := hP.exists_iota hv0P + have hIcc : ι '' Icc 0 1 = P := by + apply subset_antisymm + · rintro _ ⟨x, hx, rfl⟩ + rcases eq_or_lt_of_le hx.2 with rfl | h1 + · rw [hι1] + exact hv0P + · exact hιim ▸ mem_image_of_mem ι ⟨hx.1, h1⟩ + · exact hιim ▸ image_mono Ico_subset_Icc_self + have hinterior : ∃ x ∈ Ioo (0 : ℝ) 1, ι x ∈ V := by + have hmid : (1 / 2 : ℝ) ∈ Ioo 0 1 := by norm_num + have hmidP : ι (1 / 2) ∈ P := hIcc ▸ mem_image_of_mem ι (Ioo_subset_Icc_self hmid) + by_cases hmidV : ι (1 / 2) ∈ V + · exact ⟨1 / 2, hmid, hmidV⟩ + obtain ⟨e, he, hme⟩ := hPG hmidP + have heP : e ⊆ P := by + rcases hg.edge_or hP hPg he with heP | hdisjoint + · exact heP + · exact (Set.disjoint_left.mp hdisjoint ⟨hme, hmidV⟩ hmidP).elim + obtain ⟨w, hwP, hwV, hwne⟩ : ∃ w ∈ P, w ∈ V ∧ w ≠ v0 := by + by_cases h : A e 0 = v0 + · exact ⟨A e 1, heP (hline e he).right_mem, hmemV1 e he, + fun h' => hends e he (h.trans h'.symm)⟩ + · exact ⟨A e 0, heP (hline e he).left_mem, hmemV0 e he, h⟩ + rw [← hιim] at hwP + obtain ⟨x, hx, rfl⟩ := hwP + exact ⟨x, ⟨lt_of_le_of_ne hx.1 (Ne.symm fun h => hwne (h ▸ hι0)), hx.2⟩, hwV⟩ + obtain ⟨m, t, s, ε, hm, ht0, htm, hlt, hmem, _, hs⟩ := + hg.exists_edge_intervals A hA hιc hinj hinj' (hIcc.symm ▸ hPg) + (hι0.symm ▸ hv0V) (hι1.symm ▸ hv0V) (Or.inr hinterior) + refine ⟨ι, m, t, s, ε, hιc, hm, ht0, htm, hlt, hι0.trans hι1.symm, hinj, hιim, + fun p hp => ?_⟩ + obtain ⟨he, himage, hleft, hright⟩ := hs p hp + refine ⟨he, ?_, hleft, hright, himage⟩ + rw [← himage, ← hIcc] + exact image_mono (Icc_subset_Icc (hmem p hp.le).1.1 (hmem (p + 1) hp).1.2) + +/-- The side of the edge with arc `a`, in the direction of `b`, with parameter `x ∈ [0, 1]`. -/ +noncomputable def sd (a : 𝕀 → X) (b : Bool) (x : ℝ) : X := extI a (if b then x else 1 - x) + +omit [T2Space X] in +theorem continuous_sd {a : 𝕀 → X} (ha : Continuous a) (b : Bool) : Continuous (sd a b) := by + have h : Continuous fun x : ℝ => if b then x else 1 - x := by + cases b <;> simp only [Bool.false_eq_true, ↓reduceIte] <;> fun_prop + exact (continuous_extI ha).comp h + +omit [TopologicalSpace X] [T2Space X] in +theorem sd_true (a : 𝕀 → X) (x : ℝ) : sd a true x = extI a x := by simp [sd] + +omit [TopologicalSpace X] [T2Space X] in +theorem sd_false (a : 𝕀 → X) (x : ℝ) : sd a false x = extI a (1 - x) := by simp [sd] + +omit [TopologicalSpace X] [T2Space X] in +theorem sd_mem (a : 𝕀 → X) (b : Bool) {x : ℝ} : sd a b x ∈ range a := ⟨_, rfl⟩ + +/-- Going around `P` is a cyclic list of whole edges, with no edge and no corner repeated. -/ +theorem exists_edge_walk (hg : IsGraph V E) {P : Set X} (hP : IsOArc P) (hPG : P ⊆ ⋃₀ E) (A : Set X + → 𝕀 → X) + (hA : ∀ e ∈ E, IsArcMap (A e) ∧ range (A e) = e ∧ e ∩ V = {A e 0, A e 1}) : + ∃ (m : ℕ) (s : ℕ → Set X) (ε : ℕ → Bool), 0 < m ∧ (∀ p < m, s p ∈ E ∧ s p ⊆ P) + ∧ P ⊆ ⋃ p ∈ Iio m, s p ∧ + (∀ p, p + 1 < m → sd (A (s p)) (ε p) 1 = sd (A (s (p + 1))) (ε (p + 1)) 0) ∧ + sd (A (s (m - 1))) (ε (m - 1)) 1 = sd (A (s 0)) (ε 0) 0 ∧ + ∀ p < m, ∀ q < m, p ≠ q → s p ≠ s q ∧ sd (A (s p)) (ε p) 0 ≠ sd (A (s q)) (ε q) 0 := by + classical + obtain ⟨ι, m, t, s, ε, hιc, hm, ht0, htm, hlt, hι01, hinj, hιim, hs⟩ + := exists_edge_sides hg hP hPG A hA + have hstart : ∀ p < m, sd (A (s p)) (ε p) 0 = ι (t p) := fun p hp => by + rw [(hs p hp).2.2.1] + cases ε p <;> simp [sd] + have hend : ∀ p < m, sd (A (s p)) (ε p) 1 = ι (t (p + 1)) := fun p hp => by + rw [(hs p hp).2.2.2.1] + cases ε p <;> simp [sd] + have hmono : StrictMonoOn t (Iic m) := by + intro p hp q hq hpq + induction q, hpq using Nat.le_induction with + | base => exact hlt p hq + | succ q hq' ih => exact (ih (Nat.le_of_succ_le hq)).trans (hlt q hq) + have ht01 : ∀ p ≤ m, t p ∈ Icc (0 : ℝ) 1 := fun p hp => by + constructor + · rcases Nat.eq_zero_or_pos p with rfl | h + · exact ht0.ge + · rw [← ht0] + exact (hmono (by simp) hp h).le + · rcases eq_or_lt_of_le hp with rfl | h + · exact htm.le + · rw [← htm] + exact (hmono hp (by simp) h).le + have hlt1 : ∀ p < m, t p < 1 := fun p hp => by + rw [← htm] + exact hmono hp.le (by simp) hp + refine ⟨m, s, ε, hm, fun p hp => ⟨(hs p hp).1, (hs p hp).2.1⟩, ?_, ?_, ?_, ?_⟩ + · intro y hy + obtain ⟨x, hx, rfl⟩ := hιim.symm ▸ hy + have hexists : ∃ p < m, x ∈ Icc (t p) (t (p + 1)) := by + by_contra hcon + push Not at hcon + have key : ∀ p ≤ m, t p ≤ x := by + intro p + induction p with + | zero => exact fun _ => ht0.le.trans hx.1 + | succ p ih => + intro hp + have h1 := ih (by omega) + by_contra h2 + exact hcon p (by omega) ⟨h1, (not_le.mp h2).le⟩ + have := key m le_rfl + rw [htm] at this + exact absurd hx.2 (not_lt.mpr this) + obtain ⟨p, hp, hxp⟩ := hexists + exact mem_biUnion (show p ∈ Iio m from hp) ((hs p hp).2.2.2.2 ▸ mem_image_of_mem ι hxp) + · intro p hp + rw [hend p (by omega), hstart (p + 1) hp] + · have h1 : m - 1 + 1 = m := by omega + rw [hend (m - 1) (by omega), h1, hstart 0 hm, htm, ht0, hι01] + · intro p hp q hq hpq + have hval : ∀ p q, p < m → q < m → p < q → s p ≠ s q ∧ ι (t p) ≠ ι (t q) := by + intro p q hp hq hpq + have htpq : t p < t q := hmono hp.le hq.le hpq + have hne2 : ι (t p) ≠ ι (t q) := fun he => + htpq.ne (hinj ⟨(ht01 p hp.le).1, hlt1 p hp⟩ ⟨(ht01 q hq.le).1, hlt1 q hq⟩ he) + refine ⟨fun he => ?_, hne2⟩ + obtain ⟨x, hx⟩ : (Ioo (t q) (t (q + 1))).Nonempty := nonempty_Ioo.mpr (hlt q hq) + have hxI : x ∈ Ico (0 : ℝ) 1 := ⟨(ht01 q hq.le).1.trans hx.1.le, hx.2.trans_le (ht01 _ hq).2⟩ + have h1 : ι x ∈ s q := (hs q hq).2.2.2.2 ▸ mem_image_of_mem ι (Ioo_subset_Icc_self hx) + rw [← he, ← (hs p hp).2.2.2.2] at h1 + obtain ⟨y, hy, hyx⟩ := h1 + have hple : t (p + 1) ≤ t q := by + rcases eq_or_lt_of_le (Nat.succ_le_of_lt hpq) with h | h + · rw [Nat.succ_eq_add_one] at h + rw [h] + · exact (hmono hp hq.le h).le + rcases eq_or_lt_of_le ((ht01 _ hp).2.trans' hy.2) with hy1 | hy1 + · have h3 : ι 0 = ι x := by rw [hι01, ← hyx, hy1] + have h4 := hinj ⟨le_rfl, one_pos⟩ hxI h3 + have h5 : 0 < x := (ht01 q hq.le).1.trans_lt hx.1 + exact h5.ne h4 + · have h3 := hinj ⟨(ht01 p hp.le).1.trans hy.1, hy1⟩ hxI hyx + have h4 := hx.1 + rw [← h3] at h4 + exact absurd (hy.2.trans hple) (not_le.mpr h4) + rw [hstart p hp, hstart q hq] + rcases lt_or_gt_of_ne hpq with h | h + · exact hval p q hp hq h + · exact ⟨(hval q p hq hp h).1.symm, (hval q p hq hp h).2.symm⟩ + +omit [T2Space X] in +/-- The closed curve that goes along the sides of a cyclic list of edges, at unit speed. -/ +noncomputable def walkMap (m : ℕ) (a : ℕ → 𝕀 → X) (b : ℕ → Bool) (x : ℝ) : X := + sd (a (min ⌊x⌋₊ (m - 1))) (b (min ⌊x⌋₊ (m - 1))) (x - min ⌊x⌋₊ (m - 1)) + +section walk + +variable {m : ℕ} {a : ℕ → 𝕀 → X} {b : ℕ → Bool} + +omit [TopologicalSpace X] [T2Space X] in +theorem walkMap_eq (hm : 0 < m) (hadj : ∀ p, p + 1 < m → sd (a p) (b p) 1 = sd (a (p + 1)) (b + (p + 1)) 0) {p : ℕ} + (hp : p < m) {x : ℝ} (hx : x ∈ Icc (p : ℝ) (p + 1)) : walkMap m a b x = sd (a p) (b p) (x - p) + := by + have h0 : (0 : ℝ) ≤ x := (Nat.cast_nonneg p).trans hx.1 + rcases eq_or_lt_of_le hx.2 with he | hl + · have hf : ⌊x⌋₊ = p + 1 := by + rw [he] + exact_mod_cast Nat.floor_natCast (R := ℝ) (p + 1) + by_cases h1 : p + 1 < m + · have hmin : min ⌊x⌋₊ (m - 1) = p + 1 := by omega + simp only [walkMap, hmin] + have e1 : x - ((p + 1 : ℕ) : ℝ) = 0 := by + push_cast + linarith + have e2 : x - p = 1 := by linarith + rw [e1, e2] + exact (hadj p h1).symm + · have hmin : min ⌊x⌋₊ (m - 1) = p := by omega + simp only [walkMap, hmin] + · have hf : ⌊x⌋₊ = p := (Nat.floor_eq_iff h0).mpr ⟨hx.1, hl⟩ + have hmin : min ⌊x⌋₊ (m - 1) = p := by omega + simp only [walkMap, hmin] + +omit [T2Space X] in +theorem continuousOn_walkMap (hm : 0 < m) (ha : ∀ p < m, Continuous (a p)) + (hadj : ∀ p, p + 1 < m → sd (a p) (b p) 1 = sd (a (p + 1)) (b (p + 1)) 0) : + ContinuousOn (walkMap m a b) (Icc 0 m) := by + have key : ∀ k ≤ m, ContinuousOn (walkMap m a b) (Icc 0 k) := by + intro k + induction k with + | zero => + intro _ + simp + | succ k ih => + intro hk + have h1 : Icc (0 : ℝ) ((k + 1 : ℕ) : ℝ) = Icc (0 : ℝ) (k : ℝ) ∪ Icc (k : ℝ) ((k : ℝ) + 1) + := by + push_cast + rw [Icc_union_Icc_eq_Icc (by positivity) (by linarith)] + rw [h1] + refine (ih (by omega)).union_of_isClosed ?_ isClosed_Icc isClosed_Icc + have hc : Continuous fun x : ℝ => sd (a k) (b k) (x - k) := + (continuous_sd (ha k hk) _).comp (by fun_prop) + exact hc.continuousOn.congr fun x hx => walkMap_eq hm hadj hk hx + exact key m le_rfl + +end walk + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Epstein.lean b/LeanPool/GraphMinor/Surface/Epstein.lean new file mode 100644 index 0000000000..103463d820 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Epstein.lean @@ -0,0 +1,338 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutRetract + +/-! +# Null-homotopic `O`-arcs bound discs + +We prove `EpsteinStatement`. The hard part says that a null-homotopic `O`-arc `F` in a set `Z` of a +surface bounds a closed disc +inside `Z`. + +We cut the surface along `F`. Words of the pieces with values in a finite group show that `F` +separates and that one piece is a disc +(`CutNull.lean`). Say that this disc does not lie in `Z`. Then a null-homotopy misses a point of the +disc, so we can push it out of +the disc, and we get a null-homotopy of the cuff of the other piece, inside this other piece. So the +other piece is a disc too. If it +also does not lie in `Z`, then we can push out of it as well, and we get a null-homotopy of the +identity map of the circle, which +is impossible. + +Epstein's Theorem 1.7 gives the ambient result using covering spaces. Robertson and Seymour's +Graph Minors XI (7.2) gives the relative disc containment proved here. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +universe u + +section two + +variable {S Y : Type u} [TopologicalSpace S] [TopologicalSpace Y] [T2Space S] [T2Space Y] + [CompactSpace Y] + +/-- The two pieces of a surface that was cut along a separating `O`-arc. -/ +structure TwoSides (ψ : Y → S) (F : Set S) (W₁ W₂ X X' : Set Y) : Prop where + hψ : IsCutting ψ F + c₁ : IsClopen W₁ + c₂ : IsClopen W₂ + hU : W₁ ∪ W₂ = univ + hd : Disjoint W₁ W₂ + hX : X ⊆ W₁ + hX' : X' ⊆ W₂ + hun : X ∪ X' = ψ ⁻¹' F + b : BijOn ψ X F + b' : BijOn ψ X' F + hbd : X ⊆ bd Y + hbd' : X' ⊆ bd Y + +variable {ψ : Y → S} {F : Set S} {W₁ W₂ X X' : Set Y} + +omit [T2Space S] [T2Space Y] [CompactSpace Y] in +theorem TwoSides.symm (T : TwoSides ψ F W₁ W₂ X X') : TwoSides ψ F W₂ W₁ X' X := + ⟨T.hψ, T.c₂, T.c₁, by rw [union_comm, T.hU], T.hd.symm, T.hX', T.hX, by rw [union_comm, T.hun], + T.b', T.b, T.hbd', T.hbd⟩ + +omit [T2Space S] [T2Space Y] [CompactSpace Y] in +theorem TwoSides.mem_of_mem (T : TwoSides ψ F W₁ W₂ X X') {y : Y} (hy : y ∈ W₁) + (hF : ψ y ∈ F) : y ∈ X := by + have h : y ∈ X ∪ X' := by + rw [T.hun] + exact hF + exact h.resolve_right fun h' => disjoint_left.mp T.hd hy (T.hX' h') + +omit [T2Space S] [T2Space Y] [CompactSpace Y] in +theorem TwoSides.inj (T : TwoSides ψ F W₁ W₂ X X') : Function.Injective fun y : W₁ => ψ y.1 := by + intro a b he + simp only at he + by_cases h : ψ a.1 ∈ F + · exact Subtype.ext (T.b.injOn (T.mem_of_mem a.2 h) (T.mem_of_mem b.2 (he ▸ h)) he) + · exact Subtype.ext (T.hψ.2.2.1 h (show ψ b.1 ∈ Fᶜ from he ▸ h) he) + +omit [T2Space S] [T2Space Y] [CompactSpace Y] in +theorem TwoSides.mem_cross (T : TwoSides ψ F W₁ W₂ X X') {a b : Y} (ha : a ∈ W₁) (hb : b ∈ W₂) + (he : ψ a = ψ b) : a ∈ X := by + have hne : a ≠ b := fun h => disjoint_left.mp T.hd ha (h ▸ hb) + refine T.mem_of_mem ha ?_ + by_contra h + exact hne (T.hψ.2.2.1 h (show ψ b ∈ Fᶜ from he ▸ h) he) + +omit [T2Space Y] in +/-- If one piece is a disc, then its image is a closed disc bounded by `F`. -/ +theorem TwoSides.disc (T : TwoSides ψ F W₁ W₂ X X') (hO : IsOArc F) (e : W₁ ≃ₜ ClosedUnitDisc) : + IsClosedDisc (ψ '' W₁) ∧ discBd (ψ '' W₁) = F ∧ ∀ x : W₁, x ∈ bd W₁ ↔ ψ x.1 ∈ F := by + have hcW : CompactSpace W₁ := isCompact_iff_compactSpace.mp T.c₁.1.isCompact + have cψ := T.hψ.1 + let j : W₁ → ψ '' W₁ := fun y => ⟨ψ y.1, mem_image_of_mem _ y.2⟩ + have cj : Continuous j := Continuous.subtype_mk (cψ.comp continuous_subtype_val) _ + have bj : Function.Bijective j := by + refine ⟨fun a b he => T.inj (congrArg Subtype.val he), ?_⟩ + rintro ⟨_, y, hy, rfl⟩ + exact ⟨⟨y, hy⟩, rfl⟩ + let e₂ : W₁ ≃ₜ ψ '' W₁ := cj.homeoOfEquivCompactToT2 (f := Equiv.ofBijective j bj) + have hD : IsClosedDisc (ψ '' W₁) := ⟨e.symm.trans e₂⟩ + have himg := image_bd_homeomorph e₂ + have hto : ∀ x : W₁, x ∈ bd W₁ → ψ x.1 ∈ discBd (ψ '' W₁) := fun x hx => + ⟨e₂ x, himg ▸ mem_image_of_mem _ hx, rfl⟩ + have hsub : F ⊆ discBd (ψ '' W₁) := by + intro x hx + obtain ⟨y, hy, rfl⟩ := T.b.surjOn hx + exact hto ⟨y, T.hX hy⟩ ((mem_bd_sub T.c₁.2).mpr (T.hbd hy)) + obtain ⟨φ⟩ := hD.isOArc_discBd + have hF := oarc_eq φ hO hsub + refine ⟨hD, hF.symm, fun x => ⟨fun hx => hF ▸ hto x hx, fun hx => ?_⟩⟩ + exact (mem_bd_sub T.c₁.2).mpr (T.hbd (T.mem_of_mem x.2 hx)) + +omit [T2Space Y] in +/-- If one piece is a disc, a null-homotopy that misses a point of the disc moves to the other +piece. -/ +theorem TwoSides.move (T : TwoSides ψ F W₁ W₂ X X') (hO : IsOArc F) (e : W₁ ≃ₜ ClosedUnitDisc) + (φ : Circle ≃ₜ F) + {H : C(Circle × unitInterval, S)} {c₀ : S} (h0 : ∀ x, H (x, 0) = (φ x).1) (h1 : ∀ x, H (x, 1) + = c₀) {z : W₁} (hz : ∀ p, H p ≠ ψ z.1) + (hzF : ψ z.1 ∉ F) {C : Set W₂} (φC : Circle ≃ₜ C) (hC : ∀ x : C, ψ x.1.1 ∈ F) (hne : + (Nonempty W₂)) : + ∃ (H' : C(Circle × unitInterval, W₂)) (c : W₂), (∀ x, H' (x, 0) = (φC x).1) ∧ (∀ x, H' (x, 1) + = c) ∧ ∀ p, ψ (H' p).1 ∈ F ∨ ∃ q, ψ (H' p).1 = H q := by + have hcW : CompactSpace W₁ := isCompact_iff_compactSpace.mp T.c₁.1.isCompact + have hcW' : CompactSpace W₂ := isCompact_iff_compactSpace.mp T.c₂.1.isCompact + obtain ⟨hD, hbdF, hb⟩ := T.disc hO e + obtain ⟨d⟩ := isClosedDisc_closedBall.1 + have hzb : z ∉ bd W₁ := fun h => hzF ((hb z).mp h) + obtain ⟨R, cR, hR, hfix⟩ := exists_ret (e.trans d) hzb + have hzn : Nonempty W₁ := ⟨z⟩ + have c₁ : Continuous fun y : W₁ => ψ y.1 := T.hψ.1.comp continuous_subtype_val + have c₂ : Continuous fun y : W₂ => ψ y.1 := T.hψ.1.comp continuous_subtype_val + have hu : range (fun y : W₁ => ψ y.1) ∪ range (fun y : W₂ => ψ y.1) = univ := by + refine eq_univ_of_forall fun x => ?_ + obtain ⟨y, rfl⟩ := T.hψ.2.1 x + have : y ∈ W₁ ∪ W₂ := T.hU ▸ mem_univ y + rcases this with h | h + · exact .inl ⟨⟨y, h⟩, rfl⟩ + · exact .inr ⟨⟨y, h⟩, rfl⟩ + have hB : ∀ x ∈ bd W₁, ψ x.1 ∈ range fun y : W₂ => ψ y.1 := fun x hx => by + obtain ⟨y, hy, he⟩ := T.b'.surjOn ((hb x).mp hx) + exact ⟨⟨y, T.hX' hy⟩, he⟩ + have hB' : ∀ (x : W₁) (y : W₂), ψ x.1 = ψ y.1 → x ∈ bd W₁ := fun x y he => + (mem_bd_sub T.c₁.2).mpr (T.hbd (T.mem_cross x.2 y.2 he)) + obtain ⟨g, g1, g2, g3⟩ := retract_two c₁ c₂ T.inj T.symm.inj hu hB hB' cR hR hfix + have cG := g3 H H.continuous hz + have cθ : Continuous fun x => φ.symm ⟨ψ (φC x).1.1, hC _⟩ := + φ.symm.continuous.comp (Continuous.subtype_mk + (T.hψ.1.comp (continuous_subtype_val.comp (continuous_subtype_val.comp φC.continuous))) _) + refine ⟨⟨fun p => g (H (φ.symm ⟨ψ (φC p.1).1.1, hC _⟩, p.2)), ?_⟩, g c₀, fun x => ?_, + fun x => ?_, fun p => ?_⟩ + · exact cG.comp (Continuous.prodMk (cθ.comp continuous_fst) continuous_snd) + · change g (H (φ.symm ⟨ψ (φC x).1.1, hC _⟩, 0)) = _ + rw [h0, φ.apply_symm_apply] + exact g1 _ + · change g (H (φ.symm ⟨ψ (φC x).1.1, hC _⟩, 1)) = _ + rw [h1] + · obtain ⟨x, t⟩ := p + change ψ (g (H (φ.symm ⟨ψ (φC x).1.1, hC _⟩, t))).1 ∈ F ∨ ∃ q, ψ (g (H (φ.symm ⟨ψ + (φC x).1.1, hC _⟩, t))).1 = H q + obtain ⟨q, hq⟩ : ∃ q, q = (φ.symm ⟨ψ (φC x).1.1, hC _⟩, t) := ⟨_, rfl⟩ + rw [← hq] + by_cases h : H q ∈ range fun y : W₂ => ψ y.1 + · obtain ⟨y, hy⟩ := h + right + refine ⟨q, ?_⟩ + rw [← hy, g1] + · left + obtain ⟨y, hy, he⟩ := g2 _ h (hz q) + show ψ (g (H q)).1 ∈ F + have := (hb y).mp hy + simp only at he + rwa [he] at this + +/-- If one piece is a disc, then `F` bounds a disc in `Z`. -/ +theorem TwoSides.of_disc (_hS : IsSurface Y) (T : TwoSides ψ F W₁ W₂ X X') (hO : IsOArc F) + (hOX' : IsOArc X') (e : W₁ ≃ₜ ClosedUnitDisc) (φ : Circle ≃ₜ F) + {Z : Set S} (hFZ : F ⊆ Z) {H : C(Circle × unitInterval, S)} {c₀ : S} (h0 : ∀ x, H (x, 0) = + (φ x).1) (h1 : ∀ x, H (x, 1) = c₀) (hHZ : ∀ p, H p ∈ Z) + {a b c : ℕ} (e₂ : W₂ ≃ₜ SurfaceModel a b c) : ∃ Δ, Δ ⊆ Z ∧ IsClosedDisc Δ ∧ discBd Δ = F := by + obtain ⟨hD, hbdF, hb⟩ := T.disc hO e + by_cases h₁ : ψ '' W₁ ⊆ Z + · exact ⟨_, h₁, hD, hbdF⟩ + obtain ⟨_, ⟨y, hy, rfl⟩, hzZ⟩ := not_subset.mp h₁ + have hne' : X'.Nonempty := by + obtain ⟨e'⟩ := id hOX' + exact ⟨_, (e' 1).2⟩ + obtain ⟨C, hC, hsub⟩ := exists_cuff_sub T.c₂.2 hOX'.isPreconnected hne' T.hX' T.hbd' + obtain ⟨i, hi, φC, g, hg, hs⟩ := exists_one_hole e₂ hC + have eX' := oarc_eq (hatC φC) hOX' (by + intro x hx + exact hsub hx) + have hCF : ∀ x : C, ψ x.1.1 ∈ F := fun x => T.b'.mapsTo (by + rw [eX'] + exact mem_image_of_mem _ x.2) + obtain ⟨H', c', h0', h1', hH'⟩ := T.move hO e φ h0 h1 (z := ⟨y, hy⟩) (fun p he => hzZ + (he ▸ hHZ p)) (fun h => hzZ (hFZ h)) φC hCF + ⟨(φC 1).1⟩ + by_cases hd : a = 0 ∧ b = 0 ∧ c = 1 + · obtain ⟨rfl, rfl, rfl⟩ := hd + obtain ⟨d⟩ := nonempty_disc_homeo + obtain ⟨hD₂, hbdF₂, hb₂⟩ := T.symm.disc hO (e₂.trans d) + by_cases h₂ : ψ '' W₂ ⊆ Z + · exact ⟨_, h₂, hD₂, hbdF₂⟩ + exfalso + obtain ⟨_, ⟨y₂, hy₂, rfl⟩, hzZ₂⟩ := not_subset.mp h₂ + obtain ⟨d'⟩ := isClosedDisc_closedBall.1 + obtain ⟨R, cR, hR, hfix⟩ := exists_ret (t := (⟨y₂, hy₂⟩ : W₂)) ((e₂.trans d).trans d') fun h + => hzZ₂ (hFZ ((hb₂ _).mp h)) + have hmem : ∀ x : W₂, x ∈ bd W₂ → x ∈ C := fun x hx => by + have h3 : x.1 ∈ X' := T.symm.mem_of_mem x.2 ((hb₂ x).mp hx) + rw [eX'] at h3 + obtain ⟨x', hx', he⟩ := h3 + rwa [← Subtype.ext he] + have hav : ∀ p, H' p ≠ ⟨y₂, hy₂⟩ := fun p he => by + have h3 := hH' p + rw [he] at h3 + rcases h3 with h3 | ⟨q, h3⟩ + · exact hzZ₂ (hFZ h3) + · exact hzZ₂ (h3 ▸ hHZ q) + have cR' : Continuous fun p => R (H' p) := cR.comp_continuous H'.continuous hav + let G : C(Circle × unitInterval, Circle) := ⟨fun p => φC.symm ⟨R (H' p), hmem _ (hR _ (hav p))⟩, + φC.symm.continuous.comp (Continuous.subtype_mk cR' _)⟩ + have hC' : ∀ x, (φC x).1 ∈ bd W₂ := fun x => (hb₂ _).mpr (hCF _) + refine circle_not_null G (c := G (1, 1)) (fun x => ?_) fun x => ?_ + · change φC.symm ⟨R (H' (x, 0)), _⟩ = x + rw [φC.symm_apply_eq] + apply Subtype.ext + change R (H' (x, 0)) = _ + rw [h0', hfix _ (hC' x)] + · change φC.symm ⟨R (H' (x, 1)), _⟩ = φC.symm ⟨R (H' (1, 1)), _⟩ + congr 2 + rw [h1', h1'] + · exfalso + obtain ⟨hN, hL⟩ := erase_facts c i + have hne : 0 < a ∨ 0 < b ∨ (List.range' 0 c).erase i ≠ [] := by + by_contra h + push Not at h + have hl := length_erase_range hi + rw [h.2.2] at hl + simp only [List.length_nil] at hl + exact hd ⟨by omega, by omega, by omega⟩ + exact not_null_C hi hN hL hne hg hs ⟨φC, H', c', h0', h1'⟩ (by + refine ContinuousOn.comp_continuous continuousOn_id ?_ (fun _ => mem_univ _) |>.continuousOn + exact continuous_subtype_val.comp (φC.continuous.comp continuous_ee)) + (by simp only [ee_one]) fun u _ => (φC (ee u)).2 + +end two + +/-- A null-homotopic `O`-arc in a set `Z` of a surface, off the boundary, bounds a closed disc in +`Z`. -/ +theorem epstein_first {S : Type u} [TopologicalSpace S] [ConnectedSpace S] {Z F : Set S} + (hS : IsSurface S) (hO : IsOArc F) (hFZ : F ⊆ Z) + (hd : Disjoint F (bd S)) (hnull : IsNullHomotopicOArcIn Z F) : ∃ Δ, Δ ⊆ Z ∧ IsClosedDisc Δ + ∧ discBd Δ = F := by + have hcS : CompactSpace S := hS.1 + have ht2 : T2Space S := hS.2.1 + obtain ⟨φF, c₀, hc₀, H, hHZ, h0, h1⟩ := hnull + have hNS : NullIn F := ⟨φF, H, c₀, h0, h1⟩ + obtain ⟨Y, tY, t2Y, ψ, hY, hψ, hcase, Z₁, Z₂, u, c, X₁, Y₁, X₂, Y₂, h7, h8, hi, hun, huc, hfu, + hfc⟩ := exists_cut_loop hS hO hd + have hcY : CompactSpace Y := hY.1 + rcases hcase with ⟨X, X', hdX, hunX, hOX, hOX', b1, b2⟩ | hQ + · have ne₁ : X.Nonempty := by + obtain ⟨e⟩ := id hOX + exact ⟨_, (e 1).2⟩ + have ne₂ : X'.Nonempty := by + obtain ⟨e⟩ := id hOX' + exact ⟨_, (e 1).2⟩ + obtain ⟨x, hx⟩ := ne₁ + obtain ⟨y, hy⟩ := ne₂ + have hXb : X ⊆ bd Y := fun z hz => hψ.2.2.2.2 (hunX ▸ Or.inl hz) + have hXb' : X' ⊆ bd Y := fun z hz => hψ.2.2.2.2 (hunX ▸ Or.inr hz) + rcases cut_comps hψ hY hOX.isPreconnected hOX'.isPreconnected hunX hx hy with hYc | ⟨W₁, W₂, + hne', hsc, hX₁, hX₂, hW₁, hW₂, hU, hdW, hc₁, hc₂⟩ + · exfalso + obtain ⟨a, b, c, -, i, j, φ, σ, g', hi', hj, hij, hp, hs₂⟩ := + connected_two_cuff_presentation hY hYc hψ hOX hOX' hdX hunX b1 b2 + obtain ⟨hN, hLf⟩ := erase_erase_facts c i j + refine not_null_E hij hi' hj hN hLf hp hs₂ hNS ?_ (by simp only [ee_one]) fun u _ + => b1.mapsTo (φ (ee u)).2 + exact (hψ.1.comp (continuous_subtype_val.comp (φ.continuous.comp continuous_ee))).continuousOn + · have T : TwoSides ψ F W₁ W₂ X X' := ⟨hψ, hW₁, hW₂, hU, hdW, hX₁, hX₂, hunX, b1, b2, hXb, hXb'⟩ + obtain ⟨a₁, b₁, c₁, ⟨e₁⟩⟩ := classification.{u} W₁ (isSurface_sub hY hW₁) hc₁ + obtain ⟨a₂, b₂, c₂, ⟨e₂⟩⟩ := classification.{u} W₂ (isSurface_sub hY hW₂) hc₂ + obtain ⟨d⟩ := nonempty_disc_homeo + by_cases h1' : a₁ = 0 ∧ b₁ = 0 ∧ c₁ = 1 + · obtain ⟨rfl, rfl, rfl⟩ := h1' + exact T.of_disc hY hO hOX' (e₁.trans d) φF hFZ h0 h1 hHZ e₂ + by_cases h2' : a₂ = 0 ∧ b₂ = 0 ∧ c₂ = 1 + · obtain ⟨rfl, rfl, rfl⟩ := h2' + exact T.symm.of_disc hY hO hOX (e₂.trans d) φF hFZ h0 h1 hHZ e₁ + exfalso + obtain ⟨i, j, σ, f, ρ, q, hi', hj, hf, hq, hs, cρ, hcl, hρ⟩ := loop_comps_aux hY hψ hunX b1 + b2 hOX hOX' hW₁ hW₂ hdW hU e₁ e₂ hX₁ hX₂ hXb hXb' + obtain ⟨hN₁, hL₁⟩ := erase_facts c₁ i + obtain ⟨hN₂, hL₂⟩ := erase_facts c₂ j + have hne₁ : 0 < a₁ ∨ 0 < b₁ ∨ (List.range' 0 c₁).erase i ≠ [] := by + by_contra h + push Not at h + have hl := length_erase_range hi' + rw [h.2.2] at hl + simp only [List.length_nil] at hl + exact h1' ⟨by omega, by omega, by omega⟩ + have hne₂ : 0 < a₂ ∨ 0 < b₂ ∨ (List.range' 0 c₂).erase j ≠ [] := by + by_contra h + push Not at h + have hl := length_erase_range hj + rw [h.2.2] at hl + simp only [List.length_nil] at hl + exact h2' ⟨by omega, by omega, by omega⟩ + exact not_null_B (F := F) (ρ := fun u => ψ (ρ u)) hi' hj hN₁ hN₂ hL₁ hL₂ hne₁ hne₂ hf hq hs + hNS (hψ.1.comp_continuousOn cρ) + (congrArg ψ hcl) fun u hu => b1.mapsTo (hρ u hu) + · exfalso + obtain ⟨-, a, b, c', -, i, g, ρ, hi', hp, hside, hmem, hclosed, hcontinuous⟩ := + connected_one_cuff_presentation hY hψ hQ h7 h8 hi hun huc hfu hfc + obtain ⟨hN, hLf⟩ := erase_facts c' i + exact not_null_D hi' hN hLf hp hside hNS hcontinuous hclosed hmem + +/-- Disc bounding inside the subset of a null-homotopy, as in Robertson and Seymour's +Graph Minors XI (7.2). Their XI (7.1) quotes Epstein's ambient result, Theorem 1.7 of +*Curves on 2-manifolds and isotopies*, Acta Math. 115 (1966) 83–107. -/ +theorem epstein : EpsteinStatement.{u} := by + intro S _ Z F hS hconn hO hFZ hd + refine ⟨epstein_first hS hO hFZ hd, ?_, ?_⟩ + · rintro ⟨Δ, h1, h2, h3⟩ + exact isNullHomotopicOArcIn_of_subset_disc hO h1 h2 h3 + · intro Δ₁ Δ₂ h1 h2 e1 e2 hns + exact eq_of_discBd_eq hS hns h1 h2 (e1.trans e2.symm) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Fan.lean b/LeanPool/GraphMinor/Surface/Fan.lean new file mode 100644 index 0000000000..2f7516c085 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Fan.lean @@ -0,0 +1,1420 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Dissection +public import LeanPool.GraphMinor.Surface.DiscArcs +public import LeanPool.GraphMinor.Surface.ArcTools +import Mathlib.Analysis.InnerProductSpace.Convex +import Mathlib.Analysis.Complex.Basic +import Mathlib.Analysis.InnerProductSpace.Basic +import Mathlib.Analysis.Complex.Isometry + +/-! +# Fans in a closed disc + +A closed disc with marked points on its boundary is cut into triangles by arcs from one boundary +point to the other marked points (`exists_disc_fan`). We use it to triangulate a surface, which is +what the Euler count of Graph Minors XIX, (6.5) (page 341) needs. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +local notation "𝕀" => unitInterval + +variable {X : Type} [TopologicalSpace X] + +/-- A cutting of the closed disc `Δ` by arcs `𝓛` into discs `𝓒`, each with three points of `Q`. -/ +structure IsChordFan (Δ Q : Set X) (𝓛 𝓒 : Set (Set X)) : Prop where + finL : 𝓛.Finite + finS : 𝓒.Finite + disc : ∀ Φ ∈ 𝓒, IsClosedDisc Φ + sub : ∀ Φ ∈ 𝓒, Φ ⊆ Δ + bd : ∀ Φ ∈ 𝓒, discBd Φ ⊆ discBd Δ ∪ ⋃₀ 𝓛 + int : ∀ Φ ∈ 𝓒, Disjoint (discInt Φ) (discBd Δ ∪ ⋃₀ 𝓛) + cover : ⋃₀ 𝓒 = Δ + disj : ∀ Φ ∈ 𝓒, ∀ Φ' ∈ 𝓒, Φ ≠ Φ' → Disjoint (discInt Φ) Φ' + three : ∀ Φ ∈ 𝓒, (Φ ∩ Q).ncard = 3 + subL : ∀ L ∈ 𝓛, L ⊆ Δ + count₁ : ∀ x ∈ discBd Δ, x ∉ Q → {Φ ∈ 𝓒 | x ∈ Φ}.encard ≤ 1 + count₂ : ∀ x, x ∉ Q → {Φ ∈ 𝓒 | x ∈ Φ}.encard ≤ 2 + +variable [T2Space X] + +/-- Two points of the boundary of a closed disc are joined by an arc through the interior. -/ +theorem exists_chord {Y : Type*} [TopologicalSpace Y] [T2Space Y] + {Δ : Set Y} (hΔ : IsClosedDisc Δ) {a b : Y} (ha : a ∈ discBd Δ) + (hb : b ∈ discBd Δ) (hab : a ≠ b) : + ∃ F, IsLineWithEnds F a b ∧ F ⊆ Δ ∧ F ∩ discBd Δ = {a, b} := by + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + have hbdΔ : discBd Δ ⊆ Δ := discBd_subset Δ + have hsph : ∀ x ∈ discBd Δ, h x ∈ sphere (0 : ℂ) 1 := fun x hx => c.bd ▸ mem_image_of_mem h hx + set p := h a with hp + set q := h b with hq + have hpq : p ≠ q := fun he => hab (by rw [← c.gh (hbdΔ ha), ← c.gh (hbdΔ hb), ← hp, ← hq, he]) + let z : 𝕀 → ℂ := fun t => ((1 - t.1 : ℝ) : ℂ) * p + ((t.1 : ℝ) : ℂ) * q + have hzc : Continuous z := by + have h1 : Continuous fun t : 𝕀 => ((t.1 : ℝ) : ℂ) := by fun_prop + have h2 : Continuous fun t : 𝕀 => ((1 - t.1 : ℝ) : ℂ) := by fun_prop + exact (h2.mul continuous_const).add (h1.mul continuous_const) + have hzb : ∀ t, z t ∈ closedBall (0 : ℂ) 1 := fun t => by + have h1 := (convex_closedBall (0 : ℂ) 1) (sphere_subset_closedBall (hsph a ha)) + (sphere_subset_closedBall (hsph b hb)) (a := 1 - t.1) (b := t.1) (by linarith [t.2.2]) t.2.1 + (by ring) + simpa [z, Complex.real_smul] using h1 + have hzi : Function.Injective z := fun s t he => by + have h1 : ((t.1 - s.1 : ℝ) : ℂ) * (q - p) = 0 := by + simp only [z] at he + push_cast at he ⊢ + linear_combination -he + rcases mul_eq_zero.mp h1 with h2 | h2 + · have h3 : t.1 - s.1 = 0 := by exact_mod_cast h2 + exact Subtype.ext (by linarith) + · exact absurd (sub_eq_zero.mp h2).symm hpq + have hz0 : z 0 = p := by simp [z] + have hz1 : z 1 = q := by simp [z] + have harc : IsArcMap (g ∘ z) := ⟨c.gc.comp_continuous hzc hzb, fun s t he => hzi (by + have := congrArg h he + rwa [Function.comp_apply, Function.comp_apply, c.hg (hzb s), c.hg (hzb t)] at this)⟩ + have hl := harc.isLineWithEnds + have hg0 : (g ∘ z) 0 = a := by rw [Function.comp_apply, hz0, hp, c.gh (hbdΔ ha)] + have hg1 : (g ∘ z) 1 = b := by rw [Function.comp_apply, hz1, hq, c.gh (hbdΔ hb)] + rw [hg0, hg1] at hl + refine ⟨_, hl, ?_, ?_⟩ + · rintro _ ⟨t, rfl⟩ + exact c.gm (hzb t) + · ext x + constructor + · rintro ⟨⟨t, rfl⟩, hx⟩ + have h1 := hsph _ hx + rw [Function.comp_apply, c.hg (hzb t)] at h1 + by_cases ht0 : t = 0 + · exact .inl (by subst ht0; exact hg0) + by_cases ht1 : t = 1 + · exact .inr (by subst ht1; exact hg1) + exfalso + have ht : t.1 ∈ Ioo (0 : ℝ) 1 := ⟨lt_of_le_of_ne t.2.1 (fun he => ht0 (Subtype.ext he.symm)), + lt_of_le_of_ne t.2.2 (fun he => ht1 (Subtype.ext he))⟩ + have h2 := (strictConvex_closedBall ℝ (0 : ℂ) 1) (sphere_subset_closedBall (hsph a ha)) + (sphere_subset_closedBall (hsph b hb)) hpq (a := 1 - t.1) (b := t.1) + (by linarith [ht.2]) ht.1 (by ring) + rw [interior_closedBall _ one_ne_zero, mem_ball_zero_iff] at h2 + have h3 : ‖z t‖ = 1 := by simpa using h1 + have h4 : ‖z t‖ < 1 := by simpa [z, Complex.real_smul] using h2 + linarith + · rintro (rfl | rfl) + · exact ⟨⟨0, hg0⟩, ha⟩ + · exact ⟨⟨1, hg1⟩, hb⟩ + +omit [T2Space X] in +/-- `{x}` joined to the part of a line off its two ends is preconnected. -/ +theorem IsLineWithEnds.isPreconnected_diff_right {L : Set X} {u v : X} (h : IsLineWithEnds L u v) : + IsPreconnected (L \ {v}) := by + refine h.isPreconnected_diff.subset_closure (fun x hx => ⟨hx.1, + fun h' => hx.2 (.inr h')⟩) fun x hx => ?_ + exact h.subset_closure_diff hx.1 + +omit [T2Space X] in +theorem IsLineWithEnds.isPreconnected_diff_left {L : Set X} {u v : X} (h : IsLineWithEnds L u v) : + IsPreconnected (L \ {u}) := by + refine h.isPreconnected_diff.subset_closure (fun x hx => ⟨hx.1, + fun h' => hx.2 (.inl h')⟩) fun x hx => ?_ + exact h.subset_closure_diff hx.1 + +omit [T2Space X] in +private theorem inter_eq_singleton_of_boundary_contacts + {L F K B : Set X} {c p q : X} (hL : IsLineWithEnds L c p) (hcF : c ∈ F) + (hLK : L ∩ K = {c, p}) (hFK : F ⊆ K) + (hFB : F ∩ B = {c, q}) (hpB : p ∈ B) (hpq : p ≠ q) : L ∩ F = {c} := by + ext y + constructor + · rintro ⟨hyL, hyF⟩ + rcases hLK.subset ⟨hyL, hFK hyF⟩ with hyc | hyp + · exact hyc + · have e : y = p := hyp + rcases hFB.subset ⟨hyF, e.symm ▸ hpB⟩ with hyc | hyq + · exact hyc + · exact (hpq (e.symm.trans hyq)).elim + · rintro rfl + exact ⟨hL.left_mem, hcF⟩ + +omit [T2Space X] in +private theorem attach_chord_to_fan {Δ Δ₁ Δ₂ F X₁ : Set X} {r : 𝕀 → X} + (S : Finset 𝕀) {s₀ s₁ : 𝕀} {n : ℕ} + (hcard : S.card = n + 1 + 2) (hr : IsArcMap r) + (hs₀ : s₀ ∈ S) (hs₁m : s₁ ∈ S.erase s₀) (h1 : (1 : 𝕀) ∉ S) + (hmin' : ∀ s ∈ S.erase s₀, s₁ ≤ s) + (hmemr : ∀ {x}, s₀ ≤ x → r x ∈ discBd Δ) (hmin : ∀ s ∈ S, s₀ ≤ s) + (hΔ₁ : IsClosedDisc Δ₁) (hun : Δ₁ ∪ Δ₂ = Δ) (hint : Δ₁ ∩ Δ₂ = F) : + let c := r 1 + let u := r s₀ + let q := r s₁ + let X₂ := r '' Icc s₁ 1 \ {q, c} + (hb₁ : discBd Δ₁ = X₁ ∪ F) → (hb₂ : discBd Δ₂ = X₂ ∪ F) → + (hF : IsLineWithEnds F c q) → (hFΔ : F ⊆ Δ) → (hFbd : F ∩ discBd Δ = {c, q}) → + (hX₁sub : X₁ ⊆ discBd Δ \ {c, q}) → (hX₂sub : X₂ ⊆ discBd Δ \ {c, q}) → + (hu_X₁ : u ∈ X₁) → (∀ {y}, y ∈ X₁ → y ∉ Δ₂) → (∀ {y}, y ∈ X₂ → y ∉ Δ₁) → + (hbdsplit : ∀ {y}, y ∈ discBd Δ → y ∈ X₁ ∨ y ∈ X₂ ∨ y = c ∨ y = q) → + ∀ {𝓛 𝓒 : Set (Set X)}, IsChordFan Δ₂ (insert c (r '' (S.erase s₀ : Set 𝕀))) 𝓛 𝓒 → + 𝓛.ncard = n → 𝓒.ncard = n + 1 → + (∀ L ∈ 𝓛, ∃ s ∈ S.erase s₀, s ≠ s₁ ∧ (∃ t ∈ S.erase s₀, s < t) ∧ + IsLineWithEnds L c (r s) ∧ L ∩ discBd Δ₂ = {c, r s}) → + (∀ L ∈ 𝓛, ∀ L' ∈ 𝓛, L ≠ L' → L ∩ L' = {c}) → + (∀ Φ ∈ 𝓒, Φ ∩ insert c (r '' (S : Set 𝕀)) = + Φ ∩ insert c (r '' (S.erase s₀ : Set 𝕀))) → + F ∉ 𝓛 → Δ₁ ∉ 𝓒 → + ∃ 𝓛' 𝓒' : Set (Set X), IsChordFan Δ (insert c (r '' (S : Set 𝕀))) 𝓛' 𝓒' ∧ + 𝓛'.ncard = n + 1 ∧ 𝓒'.ncard = n + 1 + 1 ∧ + (∀ L ∈ 𝓛', ∃ s ∈ S, s ≠ s₀ ∧ (∃ t ∈ S, s < t) ∧ + IsLineWithEnds L c (r s) ∧ L ∩ discBd Δ = {c, r s}) ∧ + ∀ L ∈ 𝓛', ∀ L' ∈ 𝓛', L ≠ L' → L ∩ L' = {c} := by + classical + intro c u q X₂ hb₁ hb₂ hF hFΔ hFbd hX₁sub hX₂sub hu_X₁ hX₁n hX₂n' hbdsplit + 𝓛 𝓒 hfan hnL hnS hspoke hpair hQ₂ hF𝓛 hΔ₁𝓒 + have hs₁S := Finset.mem_of_mem_erase hs₁m + have hs₁n := Finset.ne_of_mem_erase hs₁m + have hcq : c ≠ q := fun h => h1 (hr.2 h ▸ hs₁S) + have hcu : c ≠ u := fun h => h1 (hr.2 h ▸ hs₀) + have huq : u ≠ q := fun h => hs₁n (hr.2 h).symm + have hcbd : c ∈ discBd Δ := hmemr s₀.2.2 + have hcF : c ∈ F := hF.left_mem + have hqF : q ∈ F := hF.right_mem + have hFb₁ : F ⊆ discBd Δ₁ := hb₁ ▸ subset_union_right + have hFb₂ : F ⊆ discBd Δ₂ := hb₂ ▸ subset_union_right + have hb₁s := discBd_subset Δ₁ + have hΔ₁s : Δ₁ ⊆ Δ := hun ▸ subset_union_left + have hΔ₂s : Δ₂ ⊆ Δ := hun ▸ subset_union_right + have hinF : ∀ {y}, y ∈ Δ₁ → y ∈ Δ₂ → y ∈ F := fun {y} h1' h2' => hint ▸ ⟨h1', h2'⟩ + have hFbd' : ∀ {y}, y ∈ F → y ∈ discBd Δ → y = c ∨ y = q := fun {y} h1' h2' => by + have : y ∈ F ∩ discBd Δ := ⟨h1', h2'⟩ + rwa [hFbd] at this + have hsubQ : (r '' (S.erase s₀ : Set 𝕀)) ⊆ r '' (S : Set 𝕀) := + image_mono (Finset.coe_subset.mpr (Finset.erase_subset _ _)) + refine ⟨insert F 𝓛, insert Δ₁ 𝓒, ⟨hfan.finL.insert _, hfan.finS.insert _, ?_, ?_, ?_, ?_, + ?_, ?_, ?_, ?_, ?_, ?_⟩, ?_, ?_, ?_, ?_⟩ + · rintro Φ (rfl | hΦ) + · exact hΔ₁ + · exact hfan.disc Φ hΦ + · rintro Φ (rfl | hΦ) + · exact hΔ₁s + · exact (hfan.sub Φ hΦ).trans hΔ₂s + · rintro Φ (rfl | hΦ) + · rw [hb₁] + rintro y (h2 | h2) + · exact .inl (hX₁sub h2).1 + · exact .inr ⟨F, mem_insert _ _, h2⟩ + · refine (hfan.bd Φ hΦ).trans ?_ + rintro y (h2 | ⟨L, hL, h2⟩) + · rw [hb₂] at h2 + rcases h2 with h2 | h2 + · exact .inl (hX₂sub h2).1 + · exact .inr ⟨F, mem_insert _ _, h2⟩ + · exact .inr ⟨L, mem_insert_of_mem _ hL, h2⟩ + · rintro Φ (rfl | hΦ) + · refine Set.disjoint_left.mpr ?_ + rintro y hy (h2 | ⟨L, hL, h2⟩) + · rcases hbdsplit h2 with h3 | h3 | rfl | rfl + · exact hy.2 (hb₁ ▸ .inl h3) + · exact hX₂n' h3 hy.1 + · exact hy.2 (hFb₁ hcF) + · exact hy.2 (hFb₁ hqF) + · rcases hL with rfl | hL + · exact hy.2 (hFb₁ h2) + · exact hy.2 (hFb₁ (hinF hy.1 (hfan.subL L hL h2))) + · refine Set.disjoint_left.mpr ?_ + have h4 := hfan.int Φ hΦ + rintro y hy (h2 | ⟨L, hL, h2⟩) + · have hyΔ₂ := hfan.sub Φ hΦ hy.1 + rcases hbdsplit h2 with h3 | h3 | rfl | rfl + · exact hX₁n h3 hyΔ₂ + · exact Set.disjoint_left.mp h4 hy (.inl (hb₂ ▸ .inl h3)) + · exact Set.disjoint_left.mp h4 hy (.inl (hFb₂ hcF)) + · exact Set.disjoint_left.mp h4 hy (.inl (hFb₂ hqF)) + · rcases hL with rfl | hL + · exact Set.disjoint_left.mp h4 hy (.inl (hFb₂ h2)) + · exact Set.disjoint_left.mp h4 hy (.inr ⟨L, hL, h2⟩) + · rw [sUnion_insert, hfan.cover, hun] + · rintro Φ (rfl | hΦ) Φ' (rfl | hΦ') hne + · exact absurd rfl hne + · refine Set.disjoint_left.mpr fun y hy hy' => hy.2 (hFb₁ (hinF hy.1 (hfan.sub _ hΦ' hy'))) + · refine Set.disjoint_left.mpr fun y hy hy' => ?_ + exact Set.disjoint_left.mp (hfan.int Φ hΦ) hy (.inl (hFb₂ (hinF hy' (hfan.sub _ hΦ hy.1)))) + · exact hfan.disj Φ hΦ Φ' hΦ' hne + · rintro Φ (rfl | hΦ) + · have h2 : Φ ∩ insert c (r '' (S : Set 𝕀)) = {c, u, q} := by + ext y + constructor + · rintro ⟨h3, h4⟩ + rcases h4 with rfl | ⟨s, hs, rfl⟩ + · exact .inl rfl + · by_cases hs0 : s = s₀ + · exact .inr (.inl (congrArg r hs0)) + · have h5 := hmin' s (Finset.mem_erase.mpr ⟨hs0, hs⟩) + by_cases hs2 : s = s₁ + · exact .inr (.inr (congrArg r hs2)) + · exfalso + have h6 : r s ∈ X₂ := ⟨⟨s, ⟨h5, s.2.2⟩, rfl⟩, by + rintro (h7 | h7) + · exact hs2 (hr.2 h7) + · exact h1 ((hr.2 h7) ▸ Finset.mem_coe.mp hs)⟩ + exact hX₂n' h6 h3 + · rintro (rfl | rfl | rfl) + · exact ⟨hb₁s (hFb₁ hcF), .inl rfl⟩ + · exact ⟨hb₁s (hb₁ ▸ .inl hu_X₁), .inr ⟨s₀, hs₀, rfl⟩⟩ + · exact ⟨hb₁s (hFb₁ hqF), .inr ⟨s₁, hs₁S, rfl⟩⟩ + rw [h2] + exact ncard_eq_three.mpr ⟨_, _, _, hcu, hcq, huq, rfl⟩ + · rw [hQ₂ Φ hΦ] + exact hfan.three Φ hΦ + · rintro L (rfl | hL) + · exact hFΔ + · exact (hfan.subL L hL).trans hΔ₂s + · intro y hy hyQ + have hyQ₂ : y ∉ insert c (r '' ((S.erase s₀ : Finset 𝕀) : Set 𝕀)) := fun h => hyQ (by + rcases h with h | h + · exact .inl h + · exact .inr (hsubQ h)) + by_cases hy1 : y ∈ Δ₁ + · have hy2 : y ∉ Δ₂ := by + intro hy2 + rcases hFbd' (hinF hy1 hy2) hy with rfl | rfl + · exact hyQ (.inl rfl) + · exact hyQ (.inr ⟨s₁, hs₁S, rfl⟩) + refine (encard_le_encard (t := {Δ₁}) ?_).trans (by simp) + rintro Φ ⟨rfl | hΦ, h2⟩ + · rfl + · exact absurd (hfan.sub Φ hΦ h2) hy2 + · have heq : {Φ ∈ insert Δ₁ 𝓒 | y ∈ Φ} ⊆ {Φ ∈ 𝓒 | y ∈ Φ} := by + rintro Φ ⟨rfl | hΦ, h2⟩ + · exact absurd h2 hy1 + · exact ⟨hΦ, h2⟩ + refine (encard_le_encard heq).trans (hfan.count₁ y ?_ hyQ₂) + rcases hbdsplit hy with h3 | h3 | rfl | rfl + · exact absurd (hb₁s (hb₁ ▸ .inl h3)) hy1 + · exact hb₂ ▸ .inl h3 + · exact hFb₂ hcF + · exact hFb₂ hqF + · intro y hyQ + have hyQ₂ : y ∉ insert c (r '' ((S.erase s₀ : Finset 𝕀) : Set 𝕀)) := fun h => hyQ (by + rcases h with h | h + · exact .inl h + · exact .inr (hsubQ h)) + by_cases hy1 : y ∈ Δ₁ + · by_cases hy2 : y ∈ Δ₂ + · have h3 : {Φ ∈ insert Δ₁ 𝓒 | y ∈ Φ} ⊆ insert Δ₁ {Φ ∈ 𝓒 | y ∈ Φ} := by + rintro Φ ⟨rfl | hΦ, h2⟩ + · exact mem_insert _ _ + · exact mem_insert_of_mem _ ⟨hΦ, h2⟩ + refine (encard_le_encard h3).trans ((encard_insert_le _ _).trans ?_) + have h4 := hfan.count₁ y (hFb₂ (hinF hy1 hy2)) hyQ₂ + calc _ ≤ (1 : ℕ∞) + 1 := by gcongr + _ = 2 := by norm_num + · refine (encard_le_encard (t := {Δ₁}) ?_).trans (by simp) + rintro Φ ⟨rfl | hΦ, h2⟩ + · rfl + · exact absurd (hfan.sub Φ hΦ h2) hy2 + · have heq : {Φ ∈ insert Δ₁ 𝓒 | y ∈ Φ} ⊆ {Φ ∈ 𝓒 | y ∈ Φ} := by + rintro Φ ⟨rfl | hΦ, h2⟩ + · exact absurd h2 hy1 + · exact ⟨hΦ, h2⟩ + exact (encard_le_encard heq).trans (hfan.count₂ y hyQ₂) + · rw [ncard_insert_of_notMem hF𝓛 hfan.finL, hnL] + · rw [ncard_insert_of_notMem hΔ₁𝓒 hfan.finS, hnS] + · rintro L (rfl | hL) + · refine ⟨s₁, hs₁S, hs₁n, ?_, hF, hFbd⟩ + have hnt : ((S.erase s₀).erase s₁).Nonempty := by + rw [← Finset.card_pos, Finset.card_erase_of_mem hs₁m, Finset.card_erase_of_mem hs₀] + omega + obtain ⟨t, ht⟩ := hnt + have ht1 := Finset.mem_of_mem_erase ht + exact ⟨t, Finset.mem_of_mem_erase ht1, lt_of_le_of_ne (hmin' t ht1) + (Finset.ne_of_mem_erase ht).symm⟩ + · obtain ⟨s, hs, hne, ⟨t, ht, hst⟩, hl, h3⟩ := hspoke L hL + have hsS := Finset.mem_of_mem_erase hs + refine ⟨s, hsS, Finset.ne_of_mem_erase hs, ⟨t, Finset.mem_of_mem_erase ht, hst⟩, hl, ?_⟩ + ext y + constructor + · rintro ⟨h4, h5⟩ + have h6 : y ∈ L ∩ discBd Δ₂ := by + refine ⟨h4, ?_⟩ + rcases hbdsplit h5 with h7 | h7 | rfl | rfl + · exact absurd (hfan.subL L hL h4) (hX₁n h7) + · exact hb₂ ▸ .inl h7 + · exact hFb₂ hcF + · exact hFb₂ hqF + rwa [h3] at h6 + · rintro (rfl | rfl) + · exact ⟨hl.left_mem, hcbd⟩ + · exact ⟨hl.right_mem, hmemr (hmin _ hsS)⟩ + · have hLF : ∀ L ∈ 𝓛, L ∩ F = {c} := by + intro L hL + obtain ⟨s, hs, hne, -, hl, hcontact⟩ := hspoke L hL + exact inter_eq_singleton_of_boundary_contacts hl hcF hcontact hFb₂ hFbd + (hmemr (hmin _ (Finset.mem_of_mem_erase hs))) (fun h => hne (hr.2 h)) + rintro L (rfl | hL) L' (rfl | hL') hne + · exact absurd rfl hne + · rw [inter_comm] + exact hLF L' hL' + · exact hLF L hL + · exact hpair L hL L' hL' hne + +omit [T2Space X] in +private theorem fan_of_split_subdisc {Δ F X₁ : Set X} {r : 𝕀 → X} + (S : Finset 𝕀) {s₀ s₁ : 𝕀} {n : ℕ} + (hcard : S.card = n + 1 + 2) (hr : IsArcMap r) + (hs₀ : s₀ ∈ S) (hs₁m : s₁ ∈ S.erase s₀) (h1 : (1 : 𝕀) ∉ S) + (hmin' : ∀ s ∈ S.erase s₀, s₁ ≤ s) + (hmemr : ∀ {x}, s₀ ≤ x → r x ∈ discBd Δ) (hmin : ∀ s ∈ S, s₀ ≤ s) : + let c := r 1 + let u := r s₀ + let q := r s₁ + let L₂ := r '' Icc s₁ 1 + let X₂ := L₂ \ {q, c} + (hF : IsLineWithEnds F c q) → (hFΔ : F ⊆ Δ) → (hFbd : F ∩ discBd Δ = {c, q}) → + (hX₁sub : X₁ ⊆ discBd Δ \ {c, q}) → (hX₂sub : X₂ ⊆ discBd Δ \ {c, q}) → + (hX₁c : IsPreconnected X₁) → (hX₂c : IsPreconnected X₂) → (hu_X₁ : u ∈ X₁) → + (hcover : discBd Δ \ {c, q} ⊆ X₁ ∪ X₂) → + (hL₂sub : L₂ ⊆ discBd Δ) → (hl₂ : IsLineWithEnds L₂ q c) → + (∀ {D : Set X}, IsClosedDisc D → IsLineWithEnds F c q → + discBd D = L₂ ∪ F → L₂ ∩ F = {q, c} → + ∃ 𝓛 𝓒 : Set (Set X), IsChordFan D (insert c (r '' (S.erase s₀ : Set 𝕀))) 𝓛 𝓒 ∧ + 𝓛.ncard = n ∧ 𝓒.ncard = n + 1 ∧ + (∀ L ∈ 𝓛, ∃ s ∈ S.erase s₀, s ≠ s₁ ∧ (∃ t ∈ S.erase s₀, s < t) ∧ + IsLineWithEnds L c (r s) ∧ L ∩ discBd D = {c, r s}) ∧ + ∀ L ∈ 𝓛, ∀ L' ∈ 𝓛, L ≠ L' → L ∩ L' = {c}) → + ∀ {A₁ A₂ Δ₁ Δ₂ : Set X}, + A₁ ≠ A₂ → componentsIn (discBd Δ \ {c, q}) = {A₁, A₂} → + IsClosedDisc Δ₁ → IsClosedDisc Δ₂ → Δ₁ ∪ Δ₂ = Δ → Δ₁ ∩ Δ₂ = F → discBd Δ₁ = A₁ ∪ F → + discBd Δ₂ = A₂ ∪ F → (∃ x ∈ X₂, connectedComponentIn (discBd Δ \ {c, q}) x = A₂) → + ∃ 𝓛 𝓒 : Set (Set X), IsChordFan Δ (insert c (r '' S)) 𝓛 𝓒 ∧ 𝓛.ncard = n + 1 ∧ 𝓒.ncard + = n + 1 + 1 ∧ + (∀ L ∈ 𝓛, ∃ s ∈ S, s ≠ s₀ ∧ (∃ t ∈ S, s < t) ∧ IsLineWithEnds L c (r s) ∧ L ∩ discBd Δ + = {c, r s}) ∧ + ∀ L ∈ 𝓛, ∀ L' ∈ 𝓛, L ≠ L' → L ∩ L' = {c} := by + classical + intro c u q L₂ X₂ hF hFΔ hFbd hX₁sub hX₂sub hX₁c hX₂c hu_X₁ hcover hL₂sub hl₂ ih + have hs₁S := Finset.mem_of_mem_erase hs₁m + have hcq : c ≠ q := fun h => h1 (hr.2 h ▸ hs₁S) + intro A₁ A₂ Δ₁ Δ₂ hA hcomp hΔ₁ hΔ₂ hun hint hb₁ hb₂ ⟨x₂, hx₂, hx₂A⟩ + have hA₂ : X₂ ⊆ A₂ := hx₂A ▸ hX₂c.subset_connectedComponentIn hx₂ hX₂sub + have hcompu : connectedComponentIn (discBd Δ \ {c, q}) u = A₁ := by + have h2 : connectedComponentIn (discBd Δ \ {c, q}) u ∈ componentsIn (discBd Δ \ {c, q}) := + ⟨u, hX₁sub hu_X₁, rfl⟩ + rw [hcomp] at h2 + rcases h2 with h2 | h2 + · exact h2 + · exfalso + have hX₁A : X₁ ⊆ A₂ := h2 ▸ hX₁c.subset_connectedComponentIn hu_X₁ hX₁sub + have h3 : A₁ ∈ componentsIn (discBd Δ \ {c, q}) := hcomp ▸ .inl rfl + obtain ⟨y, hy, hyA⟩ := h3 + have hyA₂ : y ∈ connectedComponentIn (discBd Δ \ {c, q}) x₂ := by + rw [hx₂A] + rcases hcover hy with h4 | h4 + · exact hX₁A h4 + · exact hA₂ h4 + rw [connectedComponentIn_eq hyA₂, hyA] at hx₂A + exact hA hx₂A + have hA₁ : X₁ ⊆ A₁ := hcompu ▸ hX₁c.subset_connectedComponentIn hu_X₁ hX₁sub + have hdA : Disjoint A₁ A₂ := by + refine Set.disjoint_left.mpr fun y h1' h2' => hA ?_ + rw [← hcompu] at h1' ⊢ + rw [← hx₂A] at h2' ⊢ + rw [connectedComponentIn_eq h1', connectedComponentIn_eq h2'] + have hA₁s : A₁ ⊆ discBd Δ \ {c, q} := hcompu ▸ connectedComponentIn_subset _ _ + have hA₂s : A₂ ⊆ discBd Δ \ {c, q} := hx₂A ▸ connectedComponentIn_subset _ _ + have hA₁e : A₁ = X₁ := Subset.antisymm (fun y hy => (hcover (hA₁s hy)).resolve_right fun h + => Set.disjoint_left.mp hdA hy (hA₂ h)) hA₁ + have hA₂e : A₂ = X₂ := Subset.antisymm (fun y hy => (hcover (hA₂s hy)).resolve_left fun h + => Set.disjoint_left.mp hdA (hA₁ h) hy) hA₂ + rw [hA₁e] at hb₁ + rw [hA₂e] at hb₂ + have hcF : c ∈ F := hF.left_mem + have hqF : q ∈ F := hF.right_mem + have hFb₁ : F ⊆ discBd Δ₁ := hb₁ ▸ subset_union_right + have hFb₂ : F ⊆ discBd Δ₂ := hb₂ ▸ subset_union_right + have hb₁s : discBd Δ₁ ⊆ Δ₁ := discBd_subset _ + have hb₂s : discBd Δ₂ ⊆ Δ₂ := discBd_subset _ + have hΔ₁s : Δ₁ ⊆ Δ := hun ▸ subset_union_left + have hΔ₂s : Δ₂ ⊆ Δ := hun ▸ subset_union_right + have hinF : ∀ {y}, y ∈ Δ₁ → y ∈ Δ₂ → y ∈ F := fun {y} h1' h2' => hint ▸ ⟨h1', h2'⟩ + have hFbd' : ∀ {y}, y ∈ F → y ∈ discBd Δ → y = c ∨ y = q := fun {y} h1' h2' => by + have : y ∈ F ∩ discBd Δ := ⟨h1', h2'⟩ + rwa [hFbd] at this + have hX₁n : ∀ {y}, y ∈ X₁ → y ∉ Δ₂ := fun {y} hy hy2 => by + have h3 := hX₁sub hy + have h4 : y ∈ F := hinF (hb₁s (hb₁ ▸ .inl hy)) hy2 + exact h3.2 (hFbd' h4 h3.1) + have hX₂n' : ∀ {y}, y ∈ X₂ → y ∉ Δ₁ := fun {y} hy hy1 => by + have h3 := hX₂sub hy + have h4 : y ∈ F := hinF hy1 (hb₂s (hb₂ ▸ .inl hy)) + exact h3.2 (hFbd' h4 h3.1) + have hbdsplit : ∀ {y}, y ∈ discBd Δ → y ∈ X₁ ∨ y ∈ X₂ ∨ y = c ∨ y = q := fun {y} hy => by + by_cases h3 : y = c ∨ y = q + · exact .inr (.inr h3) + · rcases hcover ⟨hy, h3⟩ with h4 | h4 + · exact .inl h4 + · exact .inr (.inl h4) + have hb₂e : discBd Δ₂ = r '' Icc s₁ 1 ∪ F := by + rw [hb₂] + ext y + constructor + · rintro (h2 | h2) + · exact .inl h2.1 + · exact .inr h2 + · rintro (h2 | h2) + · by_cases h3 : y ∈ F + · exact .inr h3 + · exact .inl ⟨h2, by rintro (rfl | rfl); exacts [h3 hqF, h3 hcF]⟩ + · exact .inr h2 + have hmeet₂ : r '' Icc s₁ 1 ∩ F = {q, c} := by + ext y + constructor + · rintro ⟨h2, h3⟩ + rcases hFbd' h3 (hL₂sub h2) with h4 | h4 + · exact .inr h4 + · exact .inl h4 + · rintro (rfl | rfl) + · exact ⟨hl₂.left_mem, hqF⟩ + · exact ⟨hl₂.right_mem, hcF⟩ + obtain ⟨𝓛, 𝓒, hfan, hnL, hnS, hspoke, hpair⟩ := ih hΔ₂ hF hb₂e hmeet₂ + have hsubQ : (r '' ((S.erase s₀ : Finset 𝕀) : Set 𝕀)) ⊆ r '' (S : Set 𝕀) := + image_mono (Finset.coe_subset.mpr (Finset.erase_subset _ _)) + have hu_notΔ₂ : u ∉ Δ₂ := hX₁n hu_X₁ + have hQ₂ : ∀ Φ ∈ 𝓒, Φ ∩ insert c (r '' (S : Set 𝕀)) = Φ ∩ insert c (r '' + ((S.erase s₀ : Finset 𝕀) : Set 𝕀)) := by + intro Φ hΦ + ext y + constructor + · rintro ⟨h2, h3 | ⟨s, hs, rfl⟩⟩ + · exact ⟨h2, .inl h3⟩ + · by_cases hs0 : s = s₀ + · subst hs0 + exact absurd (hfan.sub Φ hΦ h2) hu_notΔ₂ + · exact ⟨h2, .inr ⟨s, Finset.mem_coe.mpr (Finset.mem_erase.mpr ⟨hs0, hs⟩), rfl⟩⟩ + · rintro ⟨h2, h3 | h3⟩ + · exact ⟨h2, .inl h3⟩ + · exact ⟨h2, .inr (hsubQ h3)⟩ + have hF𝓛 : F ∉ 𝓛 := fun hin => by + obtain ⟨s, hs, hne, -, -, h3⟩ := hspoke F hin + have h4 : q ∈ F ∩ discBd Δ₂ := ⟨hqF, hFb₂ hqF⟩ + rw [h3] at h4 + rcases h4 with h4 | h4 + · exact hcq h4.symm + · exact hne (hr.2 h4).symm + have hΔ₁𝓒 : Δ₁ ∉ 𝓒 := fun hin => hu_notΔ₂ (hfan.sub _ hin (hb₁s (hb₁ ▸ .inl hu_X₁))) + exact attach_chord_to_fan S hcard hr hs₀ hs₁m h1 hmin' hmemr hmin hΔ₁ hun hint + hb₁ hb₂ hF hFΔ hFbd hX₁sub hX₂sub hu_X₁ hX₁n hX₂n' hbdsplit hfan hnL hnS hspoke hpair + hQ₂ hF𝓛 hΔ₁𝓒 + +/-- The fan on the boundary points `r(s)`, `s ∈ S`, from the point `r(1)`. The boundary consists of +the part of `r` after the first point of `S` and a line `B`. -/ +theorem exists_disc_fan (n : ℕ) : ∀ {Δ B : Set X} {r : 𝕀 → X} (S : Finset 𝕀) (s₀ : 𝕀), S.card + = n + 2 → + IsClosedDisc Δ → IsArcMap r → s₀ ∈ S → (∀ s ∈ S, s₀ ≤ s) → (1 : 𝕀) ∉ S → + IsLineWithEnds B (r 1) (r s₀) → discBd Δ = r '' Icc s₀ 1 ∪ B → r '' Icc s₀ 1 ∩ B = {r s₀, r 1} → + ∃ 𝓛 𝓒 : Set (Set X), IsChordFan Δ (insert (r 1) (r '' S)) 𝓛 𝓒 ∧ 𝓛.ncard = n ∧ 𝓒.ncard = n + 1 ∧ + (∀ L ∈ 𝓛, ∃ s ∈ S, s ≠ s₀ ∧ (∃ t ∈ S, s < t) ∧ IsLineWithEnds L (r 1) (r s) ∧ L ∩ discBd Δ + = {r 1, r s}) ∧ + ∀ L ∈ 𝓛, ∀ L' ∈ 𝓛, L ≠ L' → L ∩ L' = {r 1} := by + induction n with + | zero => + intro Δ B r S s₀ hcard hΔ hr hs₀ hmin h1 hB hbd hmeet + obtain ⟨s, hs⟩ : ∃ s ∈ S, s ≠ s₀ := by + by_contra hc + push Not at hc + have : S ⊆ {s₀} := fun x hx => Finset.mem_singleton.mpr (hc x hx) + have := Finset.card_le_card this + simp at this + omega + have hS : S = {s₀, s} := by + symm + apply Finset.eq_of_subset_of_card_le + · intro x hx + simp only [Finset.mem_insert, Finset.mem_singleton] at hx + rcases hx with rfl | rfl + · exact hs₀ + · exact hs.1 + · rw [hcard, Finset.card_pair hs.2.symm] + have hs1 : s ≠ 1 := fun h => h1 (h ▸ hs.1) + have hs01 : s₀ ≠ 1 := fun h => h1 (h ▸ hs₀) + have hQ : (r '' (S : Set 𝕀)) ⊆ discBd Δ := by + rintro _ ⟨x, hx, rfl⟩ + rw [hbd] + exact .inl ⟨x, ⟨hmin x hx, x.2.2⟩, rfl⟩ + have hc : r 1 ∈ discBd Δ := by + rw [hbd] + exact .inl ⟨1, ⟨s₀.2.2, le_rfl⟩, rfl⟩ + refine ⟨∅, {Δ}, ⟨finite_empty, finite_singleton _, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩, + by simp, by simp, by simp, by simp⟩ + · rintro _ rfl + exact hΔ + · rintro _ rfl + exact Subset.rfl + · rintro _ rfl + exact subset_union_left + · rintro _ rfl + simp only [sUnion_empty, union_empty] + exact Set.disjoint_left.mpr fun x hx h => hx.2 h + · simp + · rintro _ rfl _ rfl h + exact absurd rfl h + · intro Φ hΦ + obtain rfl : Φ = Δ := hΦ + have hsub : insert (r 1) (r '' (S : Set 𝕀)) ⊆ Φ := insert_subset (discBd_subset _ hc) + (hQ.trans (discBd_subset _)) + rw [inter_eq_right.mpr hsub, hS] + have : insert (r 1) (r '' (({s₀, s} : Finset 𝕀) : Set 𝕀)) = {r 1, r s₀, r s} := by + simp + rw [this] + have hn1 : r 1 ≠ r s₀ := fun h => hs01 (hr.2 h).symm + have hn2 : r 1 ≠ r s := fun h => hs1 (hr.2 h).symm + have hn3 : r s₀ ≠ r s := fun h => hs.2 (hr.2 h).symm + exact ncard_eq_three.mpr ⟨_, _, _, hn1, hn2, hn3, rfl⟩ + · simp + · intro x _ _ + rw [show {Φ ∈ ({Δ} : Set (Set X)) | x ∈ Φ} = {Φ ∈ ({Δ} : Set (Set X)) | x ∈ Φ} from rfl] + refine (encard_le_encard (sep_subset _ _)).trans (by simp) + · intro x _ + refine (encard_le_encard (sep_subset _ _)).trans (by simp) + | succ n ih => + intro Δ B r S s₀ hcard hΔ hr hs₀ hmin h1 hB hbd hmeet + classical + have hS' : (S.erase s₀).Nonempty := by + rw [← Finset.card_pos, Finset.card_erase_of_mem hs₀] + omega + set s₁ := (S.erase s₀).min' hS' with hs₁ + have hs₁m : s₁ ∈ S.erase s₀ := Finset.min'_mem _ hS' + have hs₁S : s₁ ∈ S := Finset.mem_of_mem_erase hs₁m + have hs₁n : s₁ ≠ s₀ := Finset.ne_of_mem_erase hs₁m + have h01 : s₀ < s₁ := lt_of_le_of_ne (hmin _ hs₁S) hs₁n.symm + have hmin' : ∀ s ∈ S.erase s₀, s₁ ≤ s := fun s hs => Finset.min'_le _ _ hs + have hs₁1 : s₁ ≠ 1 := fun h => h1 (h ▸ hs₁S) + have hs₁lt : s₁ < 1 := lt_of_le_of_ne s₁.2.2 hs₁1 + have hs₀lt : s₀ < 1 := h01.trans hs₁lt + set c := r 1 with hc + set u := r s₀ with hu + set q := r s₁ with hq + have hcq : c ≠ q := fun h => hs₁1 (hr.2 h).symm + have huq : u ≠ q := fun h => hs₁n (hr.2 h).symm + have hcu : c ≠ u := fun h => hs₀lt.ne (hr.2 h).symm + have hmemr : ∀ {x}, s₀ ≤ x → r x ∈ discBd Δ := fun {x} hx => by + rw [hbd] + exact .inl ⟨x, ⟨hx, x.2.2⟩, rfl⟩ + have hcbd : c ∈ discBd Δ := hmemr s₀.2.2 + have hqbd : q ∈ discBd Δ := hmemr h01.le + obtain ⟨F, hF, hFΔ, hFbd⟩ := exists_chord hΔ hcbd hqbd hcq + obtain ⟨A₁, A₂, Δ₁, Δ₂, hA, hcomp, hΔ₁, hΔ₂, hun, hint, hb₁, hb₂, -⟩ + := disc_iArc.{0} Δ F c q hΔ hFΔ hcq hF hFbd + -- the two sides of the boundary + let L₁ : Set X := r '' Icc s₀ s₁ + let L₂ : Set X := r '' Icc s₁ 1 + have hl₁ : IsLineWithEnds L₁ u q := by + have h2 := (hr.sub (s := s₀) (t := s₁) hs₁n.symm).isLineWithEnds + rwa [range_subArc r h01.le, subArc_zero, subArc_one] at h2 + have hl₂ : IsLineWithEnds L₂ q c := by + have h2 := (hr.sub (s := s₁) (t := 1) hs₁1).isLineWithEnds + rwa [range_subArc r hs₁lt.le, subArc_zero, subArc_one] at h2 + have hL₁sub : L₁ ⊆ discBd Δ := by + rintro _ ⟨x, hx, rfl⟩ + exact hmemr hx.1 + have hL₂sub : L₂ ⊆ discBd Δ := by + rintro _ ⟨x, hx, rfl⟩ + exact hmemr (h01.le.trans hx.1) + have hBsub : B ⊆ discBd Δ := fun x hx => hbd ▸ .inr hx + have hsplit : r '' Icc s₀ 1 = L₁ ∪ L₂ := by + rw [← image_union, Icc_union_Icc_eq_Icc h01.le hs₁lt.le] + let X₁ : Set X := (L₁ \ {q}) ∪ (B \ {c}) + let X₂ : Set X := L₂ \ {q, c} + have hX₁c : IsPreconnected X₁ := hl₁.isPreconnected_diff_right.union u ⟨hl₁.left_mem, huq⟩ + ⟨hB.right_mem, fun h => hcu h.symm⟩ hB.isPreconnected_diff_left + have hX₂c : IsPreconnected X₂ := hl₂.isPreconnected_diff + have hX₂n : X₂.Nonempty := by + by_contra hc' + rw [not_nonempty_iff_eq_empty] at hc' + have h2 := hl₂.subset_closure_diff + change L₂ ⊆ closure X₂ at h2 + rw [hc', closure_empty] at h2 + exact h2 hl₂.left_mem + have hu_X₁ : u ∈ X₁ := .inl ⟨hl₁.left_mem, huq⟩ + have hL₁c : c ∉ L₁ := by + rintro ⟨x, hx, he⟩ + exact (lt_of_le_of_lt hx.2 hs₁lt).ne (hr.2 he) + have hX₁sub : X₁ ⊆ discBd Δ \ {c, q} := by + rintro x (⟨h2, h3⟩ | ⟨h2, h3⟩) + · refine ⟨hL₁sub h2, ?_⟩ + rintro (rfl | h4) + · exact hL₁c h2 + · exact h3 h4 + · refine ⟨hBsub h2, ?_⟩ + rintro (rfl | rfl) + · exact h3 rfl + · have h4 : q ∈ r '' Icc s₀ 1 ∩ B := ⟨⟨s₁, ⟨h01.le, s₁.2.2⟩, rfl⟩, h2⟩ + rw [hmeet] at h4 + rcases h4 with h4 | h4 + · exact huq h4.symm + · exact hcq h4.symm + have hX₂sub : X₂ ⊆ discBd Δ \ {c, q} := fun x hx => ⟨hL₂sub hx.1, fun h2 => hx.2 (by + rcases h2 with h2 | h2 + · exact .inr h2 + · exact .inl h2)⟩ + have hcover : discBd Δ \ {c, q} ⊆ X₁ ∪ X₂ := by + rintro x ⟨h2, h3⟩ + have hxc : x ≠ c := fun h => h3 (.inl h) + have hxq : x ≠ q := fun h => h3 (.inr h) + rw [hbd, hsplit] at h2 + rcases h2 with (h2 | h2) | h2 + · exact .inl (.inl ⟨h2, hxq⟩) + · exact .inr ⟨h2, by rintro (h | h); exacts [hxq h, hxc h]⟩ + · exact .inl (.inr ⟨h2, hxc⟩) + have hdisj : Disjoint X₁ X₂ := by + refine Set.disjoint_left.mpr ?_ + rintro x (⟨⟨a, ha, rfl⟩, h3⟩ | ⟨h2, h3⟩) ⟨⟨b, hb, he⟩, h4⟩ + · have hab : b = a := hr.2 he + subst hab + have : b = s₁ := le_antisymm ha.2 hb.1 + exact h3 (by rw [this]; rfl) + · have h5 : r b ∈ r '' Icc s₀ 1 ∩ B := ⟨⟨b, ⟨h01.le.trans hb.1, b.2.2⟩, rfl⟩, he ▸ h2⟩ + rw [hmeet] at h5 + rcases h5 with h5 | h5 + · have h6 : b = s₀ := hr.2 h5 + exact absurd hb.1 (not_le.mpr (h6 ▸ h01)) + · exact h4 (.inr (he ▸ h5)) + let main := fun {A₁ A₂ Δ₁ Δ₂ : Set X} => + fan_of_split_subdisc S hcard hr hs₀ hs₁m h1 hmin' hmemr hmin hF hFΔ hFbd + hX₁sub hX₂sub hX₁c hX₂c hu_X₁ hcover hL₂sub hl₂ + (fun hD hline hbd hmeet => + ih (S.erase s₀) s₁ (by rw [Finset.card_erase_of_mem hs₀, hcard]; rfl) + hD hr hs₁m hmin' (fun h => h1 (Finset.mem_of_mem_erase h)) hline hbd hmeet) + (A₁ := A₁) (A₂ := A₂) (Δ₁ := Δ₁) (Δ₂ := Δ₂) + -- choose the labelling of the two sides + obtain ⟨x₂, hx₂⟩ := hX₂n + have hcm : connectedComponentIn (discBd Δ \ {c, q}) x₂ ∈ componentsIn (discBd Δ \ {c, q}) + := ⟨x₂, hX₂sub hx₂, rfl⟩ + rw [hcomp] at hcm + rcases hcm with h2 | h2 + · exact main hA.symm (by rw [hcomp, pair_comm]) hΔ₂ hΔ₁ (by rw [union_comm, + hun]) (by rw [inter_comm, hint]) hb₂ hb₁ ⟨x₂, hx₂, h2⟩ + · exact main hA hcomp hΔ₁ hΔ₂ hun hint hb₁ hb₂ ⟨x₂, hx₂, h2⟩ + +/-- The fan on one side of a chord, whose boundary is a line `L` with the points `P` and two lines +`F₁, F₂` from `c` to the ends of `L`. -/ +theorem fan_side {Δ L F₁ F₂ P : Set X} {a b c : X} (hΔ : IsClosedDisc Δ) (hL : IsLineWithEnds L a b) + (h₁ : IsLineWithEnds F₁ c a) (h₂ : IsLineWithEnds F₂ c b) (hbd : discBd Δ = L ∪ F₁ ∪ F₂) + (hm₁ : L ∩ F₁ = {a}) (hm₂ : L ∩ F₂ = {b}) (hm : F₁ ∩ F₂ = {c}) (hP : P.Finite) (hPL : P ⊆ L) + (ha : a ∈ P) + (hb : b ∈ P) (hab : a ≠ b) : + ∃ (n : ℕ) (𝓛 𝓒 : Set (Set X)), IsChordFan Δ (insert c P) 𝓛 𝓒 ∧ P.ncard = n + 2 ∧ 𝓛.ncard = n + ∧ 𝓒.ncard = n + 1 ∧ + (∀ L' ∈ 𝓛, ∃ p ∈ P, p ≠ a ∧ p ≠ b ∧ IsLineWithEnds L' c p ∧ L' ∩ discBd Δ = {c, p}) ∧ + ∀ L' ∈ 𝓛, ∀ L'' ∈ 𝓛, L' ≠ L'' → L' ∩ L'' = {c} := by + classical + have hcL : c ∉ L := fun hc => by + have h3 : c ∈ L ∩ F₁ := ⟨hc, h₁.left_mem⟩ + rw [hm₁] at h3 + have h4 : c = a := h3 + have h5 : a ∈ L ∩ F₂ := ⟨hL.left_mem, h4 ▸ h₂.left_mem⟩ + rw [hm₂] at h5 + exact hab h5 + have hR : IsLineWithEnds (L ∪ F₂) a c := IsLineWithEnds.union hL h₂.symm hm₂ + obtain ⟨r, hr, hrr, hr0, hr1⟩ := hR.exists_arc + have hrinj : InjOn r (r ⁻¹' P) := hr.2.injOn + have hSf : (r ⁻¹' P).Finite := hP.preimage hrinj + let S : Finset 𝕀 := hSf.toFinset + have hSm : ∀ {s}, s ∈ S ↔ r s ∈ P := fun {s} => by simp [S] + have hrS : r '' (S : Set 𝕀) = P := by + ext x + constructor + · rintro ⟨s, hs, rfl⟩ + exact hSm.mp hs + · intro hx + have h3 : x ∈ range r := hrr ▸ .inl (hPL hx) + obtain ⟨s, rfl⟩ := h3 + exact ⟨s, hSm.mpr hx, rfl⟩ + have h0S : (0 : 𝕀) ∈ S := hSm.mpr (hr0 ▸ ha) + have h1S : (1 : 𝕀) ∉ S := fun h => hcL (hPL (hr1 ▸ hSm.mp h)) + have hbr : b ∈ range r := hrr ▸ .inl hL.right_mem + obtain ⟨tb, htb⟩ := hbr + have hcard2 : 2 ≤ S.card := by + have h3 : ({0, tb} : Finset 𝕀) ⊆ S := by + intro x hx + simp only [Finset.mem_insert, Finset.mem_singleton] at hx + rcases hx with rfl | rfl + · exact h0S + · exact hSm.mpr (htb ▸ hb) + have h4 : (0 : 𝕀) ≠ tb := fun h => hab (by rw [← hr0, h, htb]) + have := Finset.card_le_card h3 + rwa [Finset.card_pair h4] at this + obtain ⟨n, hn⟩ : ∃ n, S.card = n + 2 := ⟨S.card - 2, by omega⟩ + have hI : (Icc (0 : 𝕀) 1) = univ := by + ext x + simp only [mem_Icc, mem_univ, iff_true] + exact ⟨x.2.1, x.2.2⟩ + have hBd : discBd Δ = r '' Icc 0 1 ∪ F₁ := by + rw [hI, image_univ, hrr, hbd, union_right_comm] + have hmt : r '' Icc 0 1 ∩ F₁ = {r 0, r 1} := by + rw [hI, image_univ, hrr, hr0, hr1, union_inter_distrib_right, hm₁, inter_comm F₂, hm] + rfl + obtain ⟨𝓛, 𝓒, hf, h3, h4, h5, h6⟩ := exists_disc_fan n S 0 hn hΔ hr h0S (fun s _ => s.2.1) h1S + (by rwa [hr0, hr1]) hBd hmt + rw [hrS, hr1] at hf + rw [hr1] at h6 + refine ⟨n, 𝓛, 𝓒, hf, ?_, h3, h4, ?_, h6⟩ + · rw [← hrS, ncard_image_of_injective _ hr.2, ncard_coe_finset] + exact hn + · intro L' hL' + obtain ⟨s, hs, hs0, ⟨t, ht, hst⟩, h7, h8⟩ := h5 L' hL' + rw [hr1] at h7 h8 + refine ⟨r s, hSm.mp hs, fun he => hs0 (hr.2 (he.trans hr0.symm)), ?_, h7, h8⟩ + intro he + -- the part of `r` after `b` lies in `F₂` + have hstb : s = tb := hr.2 (he.trans htb.symm) + subst hstb + have hpre : IsPreconnected (r ⁻¹' F₂) := by + have hhe : Topology.IsEmbedding r := (hr.1.isClosedEmbedding hr.2).isEmbedding + have hrg : r '' (r ⁻¹' F₂) = F₂ := image_preimage_eq_of_subset (hrr ▸ subset_union_right) + refine hhe.isInducing.isPreconnected_image.mp ?_ + rw [hrg] + obtain ⟨e, he', her, -, -⟩ := h₂.exists_arc + rw [← her] + exact isPreconnected_range he'.1 + have htbF : s ∈ r ⁻¹' F₂ := by + change r s ∈ F₂ + rw [htb] + exact h₂.right_mem + have h1F : (1 : 𝕀) ∈ r ⁻¹' F₂ := by + change r 1 ∈ F₂ + rw [hr1] + exact h₂.left_mem + have htF : t ∈ r ⁻¹' F₂ := hpre.Icc_subset htbF h1F ⟨hst.le, t.2.2⟩ + have h9 : r t ∈ L ∩ F₂ := ⟨hPL (hSm.mp ht), htF⟩ + rw [hm₂] at h9 + exact hst.ne (hr.2 (htb.trans h9.symm)) + +omit [T2Space X] in +/-- The facts on one side of a chord that are needed to merge two fans. -/ +theorem IsChordFan.side {Δ Δ₁ Δ₂ F Q₁ : Set X} {𝓛₁ 𝓒₁ 𝓛₂ : Set (Set X)} (h : IsChordFan Δ₁ Q₁ 𝓛₁ 𝓒₁) + (hF : F ⊆ discBd Δ₁) (hint : Δ₁ ∩ Δ₂ = F) (hin : ∀ y ∈ discBd Δ, y ∈ Δ₁ → y ∈ discBd Δ₁) + (hbd₁ : discBd Δ₁ ⊆ discBd Δ ∪ F) (hL₂ : ∀ L ∈ 𝓛₂, L ⊆ Δ₂) {Φ : Set X} (hΦ : Φ ∈ 𝓒₁) : + discBd Φ ⊆ discBd Δ ∪ F ∪ ⋃₀ 𝓛₁ ∧ Disjoint (discInt Φ) (discBd Δ ∪ F ∪ ⋃₀ (𝓛₁ ∪ 𝓛₂)) := by + constructor + · refine (h.bd Φ hΦ).trans ?_ + rintro y (h1 | h1) + · exact .inl (hbd₁ h1) + · exact .inr h1 + · have hd := h.int Φ hΦ + refine Set.disjoint_left.mpr ?_ + rintro y hy ((h1 | h1) | ⟨L, hL | hL, h1⟩) + · exact Set.disjoint_left.mp hd hy (.inl (hin y h1 (h.sub Φ hΦ hy.1))) + · exact Set.disjoint_left.mp hd hy (.inl (hF h1)) + · exact Set.disjoint_left.mp hd hy (.inr ⟨L, hL, h1⟩) + · have h2 : y ∈ F := hint ▸ ⟨h.sub Φ hΦ hy.1, hL₂ L hL h1⟩ + exact Set.disjoint_left.mp hd hy (.inl (hF h2)) + +omit [T2Space X] in +theorem comps_two {Y X₁ X₂ A₁ A₂ : Set X} (hA : A₁ ≠ A₂) (hc : componentsIn Y = {A₁, A₂}) (hY : Y + = X₁ ∪ X₂) + (_hd : Disjoint X₁ X₂) (h₁ : IsPreconnected X₁) (h₂ : IsPreconnected X₂) (n₁ : X₁.Nonempty) + (n₂ : X₂.Nonempty) : + (A₁ = X₁ ∧ A₂ = X₂) ∨ (A₁ = X₂ ∧ A₂ = X₁) := by + obtain ⟨x₁, hx₁⟩ := n₁ + obtain ⟨x₂, hx₂⟩ := n₂ + have hs₁ : X₁ ⊆ Y := hY ▸ subset_union_left + have hs₂ : X₂ ⊆ Y := hY ▸ subset_union_right + have h3 : X₁ ⊆ connectedComponentIn Y x₁ := h₁.subset_connectedComponentIn hx₁ hs₁ + have h4 : X₂ ⊆ connectedComponentIn Y x₂ := h₂.subset_connectedComponentIn hx₂ hs₂ + have hne : connectedComponentIn Y x₁ ≠ connectedComponentIn Y x₂ := fun he => by + have hall : ∀ y ∈ Y, connectedComponentIn Y y = connectedComponentIn Y x₁ := fun y hy => by + rcases (hY ▸ hy : y ∈ X₁ ∪ X₂) with h5 | h5 + · exact (connectedComponentIn_eq (h3 h5)).symm + · rw [he] + exact (connectedComponentIn_eq (h4 h5)).symm + have h5 : A₁ ∈ componentsIn Y := hc ▸ .inl rfl + have h6 : A₂ ∈ componentsIn Y := hc ▸ .inr rfl + obtain ⟨y, hy, rfl⟩ := h5 + obtain ⟨z, hz, rfl⟩ := h6 + exact hA ((hall y hy).trans (hall z hz).symm) + have hd' : Disjoint (connectedComponentIn Y x₁) (connectedComponentIn Y x₂) := + Set.disjoint_left.mpr fun y hy hy' => hne ((connectedComponentIn_eq hy).trans + (connectedComponentIn_eq hy').symm) + have e₁ : connectedComponentIn Y x₁ = X₁ := Subset.antisymm (fun y hy => by + rcases (hY ▸ connectedComponentIn_subset Y x₁ hy : y ∈ X₁ ∪ X₂) with h5 | h5 + · exact h5 + · exact absurd (h4 h5) (Set.disjoint_left.mp hd' hy)) h3 + have e₂ : connectedComponentIn Y x₂ = X₂ := Subset.antisymm (fun y hy => by + rcases (hY ▸ connectedComponentIn_subset Y x₂ hy : y ∈ X₁ ∪ X₂) with h5 | h5 + · exact absurd hy (Set.disjoint_left.mp hd' (h3 h5)) + · exact h5) h4 + have m₁ : X₁ ∈ componentsIn Y := ⟨x₁, hs₁ hx₁, e₁⟩ + have m₂ : X₂ ∈ componentsIn Y := ⟨x₂, hs₂ hx₂, e₂⟩ + rw [hc] at m₁ m₂ + have hX : X₁ ≠ X₂ := fun h => hne (e₁.trans (h.trans e₂.symm)) + rcases m₁ with m₁ | m₁ <;> rcases m₂ with m₂ | m₂ + · exact absurd (m₁.trans m₂.symm) hX + · exact .inl ⟨m₁.symm, m₂.symm⟩ + · exact .inr ⟨m₂.symm, m₁.symm⟩ + · exact absurd (m₁.trans m₂.symm) hX + +omit [T2Space X] in +private theorem merge_cone_fans + {Δ Δ₁ Δ₂ F F₁ F₂ P X₁ X₂ U₁ U₂ : Set X} {a b c : X} + {𝓛₁ 𝓛₂ 𝓒₁ 𝓒₂ : Set (Set X)} {n₁ n₂ : ℕ} + (hf₁ : IsChordFan Δ₁ (insert c (P ∩ U₁)) 𝓛₁ 𝓒₁) + (hf₂ : IsChordFan Δ₂ (insert c (P ∩ U₂)) 𝓛₂ 𝓒₂) + (hPb : P ⊆ discBd Δ) (ha : a ∈ P) (hb : b ∈ P) (hcF : c ∈ F) (hcbd : c ∉ discBd Δ) + (hFΔ : F ⊆ Δ) (hFu : F = F₁ ∪ F₂) (h₁ : IsLineWithEnds F₁ c a) (h₂ : IsLineWithEnds F₂ c b) + (haF₂ : a ∉ F₂) (hbF₁ : b ∉ F₁) + (hLF : ∀ {L : Set X}, L ⊆ discBd Δ → ∀ {y}, y ∈ L → y ∈ F → y = a ∨ y = b) + (hun : Δ₁ ∪ Δ₂ = Δ) (hint : Δ₁ ∩ Δ₂ = F) + (hb₁ : discBd Δ₁ = X₁ ∪ F) (hb₂ : discBd Δ₂ = X₂ ∪ F) + (hX₁n : ∀ {y}, y ∈ X₁ → y ∉ Δ₂) (hX₂n : ∀ {y}, y ∈ X₂ → y ∉ Δ₁) + (hsplit' : ∀ {y}, y ∈ discBd Δ → y ∈ X₁ ∨ y ∈ X₂ ∨ y ∈ F) + (hin₁ : ∀ y ∈ discBd Δ, y ∈ Δ₁ → y ∈ discBd Δ₁) + (hin₂ : ∀ y ∈ discBd Δ, y ∈ Δ₂ → y ∈ discBd Δ₂) + (hbd₁ : discBd Δ₁ ⊆ discBd Δ ∪ F) (hbd₂ : discBd Δ₂ ⊆ discBd Δ ∪ F) + (hQ₁ : ∀ Φ, Φ ⊆ Δ₁ → Φ ∩ insert c P = Φ ∩ insert c (P ∩ U₁)) + (hQ₂ : ∀ Φ, Φ ⊆ Δ₂ → Φ ∩ insert c P = Φ ∩ insert c (P ∩ U₂)) + (hsp₁' : ∀ L ∈ 𝓛₁, ∃ p ∈ P, p ≠ a ∧ p ≠ b ∧ p ∈ U₁ ∧ + IsLineWithEnds L c p ∧ L ∩ discBd Δ = {p} ∧ L ∩ F = {c}) + (hsp₂' : ∀ L ∈ 𝓛₂, ∃ p ∈ P, p ≠ a ∧ p ≠ b ∧ p ∈ U₂ ∧ + IsLineWithEnds L c p ∧ L ∩ discBd Δ = {p} ∧ L ∩ F = {c}) + (hsp : ∀ L ∈ 𝓛₁ ∪ 𝓛₂, ∃ p ∈ P, p ≠ a ∧ p ≠ b ∧ IsLineWithEnds L c p ∧ + L ∩ discBd Δ = {p} ∧ L ∩ F = {c}) + (hF₁L : F₁ ∉ 𝓛₁ ∪ 𝓛₂) (hF₂L : F₂ ∉ 𝓛₁ ∪ 𝓛₂) + (hF₁₂ : F₁ ≠ F₂) (hF₁F₂ : F₁ ∩ F₂ = {c}) + (hdL : Disjoint 𝓛₁ 𝓛₂) (hd𝓒 : Disjoint 𝓒₁ 𝓒₂) + (hnL₁ : 𝓛₁.ncard = n₁) (hnL₂ : 𝓛₂.ncard = n₂) (hnS₁ : 𝓒₁.ncard = n₁ + 1) + (hnS₂ : 𝓒₂.ncard = n₂ + 1) (hPcount : P.ncard = n₁ + n₂ + 2) + (hpr₁ : ∀ L ∈ 𝓛₁, ∀ L' ∈ 𝓛₁, L ≠ L' → L ∩ L' = {c}) + (hpr₂ : ∀ L ∈ 𝓛₂, ∀ L' ∈ 𝓛₂, L ≠ L' → L ∩ L' = {c}) : + ∃ (c : X) (𝓛 𝓒 : Set (Set X)), c ∈ discInt Δ ∧ IsChordFan Δ (insert c P) 𝓛 𝓒 ∧ + 𝓛.ncard = P.ncard ∧ 𝓒.ncard = P.ncard ∧ + (∀ L ∈ 𝓛, ∃ p ∈ P, IsLineWithEnds L c p ∧ L ∩ discBd Δ = {p}) ∧ + ∀ L ∈ 𝓛, ∀ L' ∈ 𝓛, L ≠ L' → L ∩ L' = {c} := by + classical + have hΔ₁s : Δ₁ ⊆ Δ := hun ▸ subset_union_left + have hΔ₂s : Δ₂ ⊆ Δ := hun ▸ subset_union_right + have hFb₁ : F ⊆ discBd Δ₁ := hb₁ ▸ subset_union_right + have hFb₂ : F ⊆ discBd Δ₂ := hb₂ ▸ subset_union_right + have hinF : ∀ {y}, y ∈ Δ₁ → y ∈ Δ₂ → y ∈ F := fun {y} hy hz => hint ▸ (⟨hy, hz⟩ : y ∈ Δ₁ ∩ Δ₂) + have hint' : Δ₂ ∩ Δ₁ = F := by rw [inter_comm, hint] + let 𝓛 : Set (Set X) := insert F₁ (insert F₂ (𝓛₁ ∪ 𝓛₂)) + have hU : ⋃₀ 𝓛 = F ∪ ⋃₀ (𝓛₁ ∪ 𝓛₂) := by + simp only [𝓛, sUnion_insert, hFu, union_assoc] + have hnQ₁ : ∀ {y}, y ∉ insert c P → y ∉ insert c (P ∩ U₁) := + fun h => fun hy => h (insert_subset_insert inter_subset_left hy) + have hnQ₂ : ∀ {y}, y ∉ insert c P → y ∉ insert c (P ∩ U₂) := + fun h => fun hy => h (insert_subset_insert inter_subset_left hy) + have hside₁ := fun {Φ} (hΦ : Φ ∈ 𝓒₁) => hf₁.side (Δ := Δ) hFb₁ hint hin₁ hbd₁ hf₂.subL hΦ + have hside₂ := fun {Φ} (hΦ : Φ ∈ 𝓒₂) => hf₂.side (Δ := Δ) hFb₂ hint' hin₂ hbd₂ hf₁.subL hΦ + refine ⟨c, 𝓛, 𝓒₁ ∪ 𝓒₂, ⟨hFΔ hcF, hcbd⟩, ⟨?_, hf₁.finS.union hf₂.finS, + ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩, ?_, ?_, ?_, ?_⟩ + · exact ((hf₁.finL.union hf₂.finL).insert _).insert _ + · rintro Φ (hΦ | hΦ) + · exact hf₁.disc Φ hΦ + · exact hf₂.disc Φ hΦ + · rintro Φ (hΦ | hΦ) + · exact (hf₁.sub Φ hΦ).trans hΔ₁s + · exact (hf₂.sub Φ hΦ).trans hΔ₂s + · rw [hU] + rintro Φ (hΦ | hΦ) y hy + · rcases (hside₁ hΦ).1 hy with (h2 | h2) | ⟨L, hL, h2⟩ + · exact .inl h2 + · exact .inr (.inl h2) + · exact .inr (.inr ⟨L, .inl hL, h2⟩) + · rcases (hside₂ hΦ).1 hy with (h2 | h2) | ⟨L, hL, h2⟩ + · exact .inl h2 + · exact .inr (.inl h2) + · exact .inr (.inr ⟨L, .inr hL, h2⟩) + · rw [hU, ← union_assoc] + rintro Φ (hΦ | hΦ) + · exact (hside₁ hΦ).2 + · rw [union_comm 𝓛₁] + exact (hside₂ hΦ).2 + · rw [sUnion_union, hf₁.cover, hf₂.cover, hun] + · rintro Φ (hΦ | hΦ) Φ' (hΦ' | hΦ') hne + · exact hf₁.disj Φ hΦ Φ' hΦ' hne + · exact Set.disjoint_left.mpr fun y hy hy' => Set.disjoint_left.mp (hf₁.int Φ hΦ) hy + (.inl (hFb₁ (hinF (hf₁.sub Φ hΦ hy.1) (hf₂.sub Φ' hΦ' hy')))) + · exact Set.disjoint_left.mpr fun y hy hy' => Set.disjoint_left.mp (hf₂.int Φ hΦ) hy + (.inl (hFb₂ (hinF (hf₁.sub Φ' hΦ' hy') (hf₂.sub Φ hΦ hy.1)))) + · exact hf₂.disj Φ hΦ Φ' hΦ' hne + · rintro Φ (hΦ | hΦ) + · rw [hQ₁ Φ (hf₁.sub Φ hΦ)] + exact hf₁.three Φ hΦ + · rw [hQ₂ Φ (hf₂.sub Φ hΦ)] + exact hf₂.three Φ hΦ + · rintro L (rfl | rfl | hL | hL) + · exact fun y hy => hFΔ (hFu ▸ .inl hy) + · exact fun y hy => hFΔ (hFu ▸ .inr hy) + · exact (hf₁.subL L hL).trans hΔ₁s + · exact (hf₂.subL L hL).trans hΔ₂s + · intro y hy hyQ + have hyF : y ∉ F := fun h => by + rcases hLF (fun _ h => h) hy h with rfl | rfl + · exact hyQ (.inr ha) + · exact hyQ (.inr hb) + rcases hsplit' hy with h3 | h3 | h3 + · have h4 : {Φ ∈ 𝓒₁ ∪ 𝓒₂ | y ∈ Φ} ⊆ {Φ ∈ 𝓒₁ | y ∈ Φ} := by + rintro Φ ⟨hΦ | hΦ, h5⟩ + · exact ⟨hΦ, h5⟩ + · exact absurd (hf₂.sub Φ hΦ h5) (hX₁n h3) + exact (encard_le_encard h4).trans (hf₁.count₁ y (hb₁ ▸ .inl h3) (hnQ₁ hyQ)) + · have h4 : {Φ ∈ 𝓒₁ ∪ 𝓒₂ | y ∈ Φ} ⊆ {Φ ∈ 𝓒₂ | y ∈ Φ} := by + rintro Φ ⟨hΦ | hΦ, h5⟩ + · exact absurd (hf₁.sub Φ hΦ h5) (hX₂n h3) + · exact ⟨hΦ, h5⟩ + exact (encard_le_encard h4).trans (hf₂.count₁ y (hb₂ ▸ .inl h3) (hnQ₂ hyQ)) + · exact absurd h3 hyF + · intro y hyQ + by_cases hy1 : y ∈ Δ₁ <;> by_cases hy2 : y ∈ Δ₂ + · have hyF : y ∈ F := hinF hy1 hy2 + have h3 : {Φ ∈ 𝓒₁ ∪ 𝓒₂ | y ∈ Φ} ⊆ {Φ ∈ 𝓒₁ | y ∈ Φ} ∪ {Φ ∈ 𝓒₂ | y ∈ Φ} := by + rintro Φ ⟨hΦ | hΦ, h5⟩ + · exact .inl ⟨hΦ, h5⟩ + · exact .inr ⟨hΦ, h5⟩ + refine (encard_le_encard h3).trans ((encard_union_le _ _).trans ?_) + have h4 := hf₁.count₁ y (hFb₁ hyF) (hnQ₁ hyQ) + have h5 := hf₂.count₁ y (hFb₂ hyF) (hnQ₂ hyQ) + calc _ ≤ (1 : ℕ∞) + 1 := by gcongr + _ = 2 := by norm_num + · have h4 : {Φ ∈ 𝓒₁ ∪ 𝓒₂ | y ∈ Φ} ⊆ {Φ ∈ 𝓒₁ | y ∈ Φ} := by + rintro Φ ⟨hΦ | hΦ, h5⟩ + · exact ⟨hΦ, h5⟩ + · exact absurd (hf₂.sub Φ hΦ h5) hy2 + exact (encard_le_encard h4).trans (hf₁.count₂ y (hnQ₁ hyQ)) + · have h4 : {Φ ∈ 𝓒₁ ∪ 𝓒₂ | y ∈ Φ} ⊆ {Φ ∈ 𝓒₂ | y ∈ Φ} := by + rintro Φ ⟨hΦ | hΦ, h5⟩ + · exact absurd (hf₁.sub Φ hΦ h5) hy1 + · exact ⟨hΦ, h5⟩ + exact (encard_le_encard h4).trans (hf₂.count₂ y (hnQ₂ hyQ)) + · have h4 : {Φ ∈ 𝓒₁ ∪ 𝓒₂ | y ∈ Φ} = ∅ := by + ext Φ + simp only [mem_ofPred_eq, mem_empty_iff_false, iff_false] + rintro ⟨hΦ | hΦ, h5⟩ + · exact hy1 (hf₁.sub Φ hΦ h5) + · exact hy2 (hf₂.sub Φ hΦ h5) + rw [h4] + simp + · have hfinU := hf₁.finL.union hf₂.finL + have h3 : F₁ ∉ insert F₂ (𝓛₁ ∪ 𝓛₂) := by + rintro (h | h) + · exact hF₁₂ h + · exact hF₁L h + rw [ncard_insert_of_notMem h3 (hfinU.insert _), ncard_insert_of_notMem hF₂L hfinU, + ncard_union_eq hdL hf₁.finL hf₂.finL, hnL₁, hnL₂, hPcount] + · rw [ncard_union_eq hd𝓒 hf₁.finS hf₂.finS, hnS₁, hnS₂, hPcount] + omega + · rintro L (rfl | rfl | hL) + · refine ⟨a, ha, h₁, ?_⟩ + ext y + constructor + · rintro ⟨h2, h3⟩ + rcases hLF (L := discBd Δ) (fun _ h => h) h3 (hFu ▸ .inl h2) with rfl | rfl + · rfl + · exact absurd h2 hbF₁ + · rintro rfl + exact ⟨h₁.right_mem, hPb ha⟩ + · refine ⟨b, hb, h₂, ?_⟩ + ext y + constructor + · rintro ⟨h2, h3⟩ + rcases hLF (L := discBd Δ) (fun _ h => h) h3 (hFu ▸ .inr h2) with rfl | rfl + · exact absurd h2 haF₂ + · rfl + · rintro rfl + exact ⟨h₂.right_mem, hPb hb⟩ + · obtain ⟨p, h2, -, -, h3, h4, -⟩ := hsp L hL + exact ⟨p, h2, h3, h4⟩ + · have hsubF : ∀ L ∈ 𝓛₁ ∪ 𝓛₂, L ∩ F₁ = {c} ∧ L ∩ F₂ = {c} := by + intro L hL + obtain ⟨p, -, -, -, hl, -, h3⟩ := hsp L hL + have hcF₁ : c ∈ F₁ := h₁.left_mem + have hcF₂ : c ∈ F₂ := h₂.left_mem + constructor + · ext y + constructor + · rintro ⟨h4, h5⟩ + exact (show y ∈ L ∩ F from ⟨h4, hFu ▸ .inl h5⟩) |> fun h => h3 ▸ h + · rintro rfl + exact ⟨hl.left_mem, hcF₁⟩ + · ext y + constructor + · rintro ⟨h4, h5⟩ + exact (show y ∈ L ∩ F from ⟨h4, hFu ▸ .inr h5⟩) |> fun h => h3 ▸ h + · rintro rfl + exact ⟨hl.left_mem, hcF₂⟩ + rintro L (rfl | rfl | hL) L' (rfl | rfl | hL') hne + · exact absurd rfl hne + · exact hF₁F₂ + · rw [inter_comm] + exact (hsubF L' hL').1 + · rw [inter_comm] + exact hF₁F₂ + · exact absurd rfl hne + · rw [inter_comm] + exact (hsubF L' hL').2 + · exact (hsubF L hL).1 + · exact (hsubF L hL).2 + · rcases hL with hL | hL <;> rcases hL' with hL' | hL' + · exact hpr₁ L hL L' hL' hne + · have h3 : L ∩ L' ⊆ F := fun y hy => hinF (hf₁.subL L hL hy.1) (hf₂.subL L' hL' hy.2) + obtain ⟨p, -, -, -, -, hl, -, h4⟩ := hsp₁' L hL + obtain ⟨p', -, -, -, -, hl', -, -⟩ := hsp₂' L' hL' + ext y + constructor + · intro hy + exact (show y ∈ L ∩ F from ⟨hy.1, h3 hy⟩) |> fun h => h4 ▸ h + · rintro rfl + exact ⟨hl.left_mem, hl'.left_mem⟩ + · have h3 : L ∩ L' ⊆ F := fun y hy => hinF (hf₁.subL L' hL' hy.2) (hf₂.subL L hL hy.1) + obtain ⟨p, -, -, -, -, hl, -, h4⟩ := hsp₂' L hL + obtain ⟨p', -, -, -, -, hl', -, -⟩ := hsp₁' L' hL' + ext y + constructor + · intro hy + exact (show y ∈ L ∩ F from ⟨hy.1, h3 hy⟩) |> fun h => h4 ▸ h + · rintro rfl + exact ⟨hl.left_mem, hl'.left_mem⟩ + · exact hpr₂ L hL L' hL' hne + +omit [T2Space X] in +private theorem cone_spoke_on_whole_disc {Δ Δ₀ F P U L : Set X} {a b c : X} + (hsp : ∃ p ∈ P ∩ U, p ≠ a ∧ p ≠ b ∧ IsLineWithEnds L c p ∧ L ∩ discBd Δ₀ = {c, p}) + (hsubL : L ⊆ Δ₀) (hin : ∀ y ∈ discBd Δ, y ∈ Δ₀ → y ∈ discBd Δ₀) + (hFb : F ⊆ discBd Δ₀) (hUsub : U ⊆ discBd Δ) (hPb : P ⊆ discBd Δ) + (hcbd : c ∉ discBd Δ) (hcF : c ∈ F) + (hLF : ∀ {U : Set X}, U ⊆ discBd Δ → ∀ {y}, y ∈ U → y ∈ F → y = a ∨ y = b) : + ∃ p ∈ P, p ≠ a ∧ p ≠ b ∧ p ∈ U ∧ IsLineWithEnds L c p ∧ + L ∩ discBd Δ = {p} ∧ L ∩ F = {c} := by + obtain ⟨p, hp, hpa, hpb, hl, h3⟩ := hsp + refine ⟨p, hp.1, hpa, hpb, hp.2, hl, ?_, ?_⟩ + · ext y + constructor + · rintro ⟨h4, h5⟩ + have h6 : y ∈ L ∩ discBd Δ₀ := ⟨h4, hin y h5 (hsubL h4)⟩ + rw [h3] at h6 + rcases h6 with rfl | h6 + · exact absurd h5 hcbd + · exact h6 + · rintro rfl + exact ⟨hl.right_mem, hPb hp.1⟩ + · ext y + constructor + · rintro ⟨h4, h5⟩ + have h6 : y ∈ L ∩ discBd Δ₀ := ⟨h4, hFb h5⟩ + rw [h3] at h6 + rcases h6 with h6 | h6 + · exact h6 + · subst h6 + rcases hLF hUsub hp.2 h5 with h7 | h7 + · exact absurd h7 hpa + · exact absurd h7 hpb + · rintro rfl + exact ⟨hl.left_mem, hcF⟩ + +private theorem cone_of_split_discs {Δ F F₁ F₂ P : Set X} {a b c : X} + {a₁ a₂ : 𝕀 → X} (hF : IsLineWithEnds F a b) (hFΔ : F ⊆ Δ) + (hFbd : F ∩ discBd Δ = {a, b}) (hFu : F = F₁ ∪ F₂) + (h₁ : IsLineWithEnds F₁ c a) (h₂ : IsLineWithEnds F₂ c b) (hF₁F₂ : F₁ ∩ F₂ = {c}) + (hbF₁ : b ∉ F₁) (haF₂ : a ∉ F₂) (hcbd : c ∉ discBd Δ) + (hP : P.Finite) (hPb : P ⊆ discBd Δ) (ha : a ∈ P) (hb : b ∈ P) (hab : a ≠ b) + (hl₁ : IsLineWithEnds (range a₁) a b) (hl₂ : IsLineWithEnds (range a₂) a b) + (hinter : range a₁ ∩ range a₂ = {a, b}) (hu : range a₁ ∪ range a₂ = discBd Δ) : + let X₁ : Set X := range a₁ \ {a, b} + let X₂ : Set X := range a₂ \ {a, b} + ∀ {Δ₁ Δ₂ : Set X}, IsClosedDisc Δ₁ → IsClosedDisc Δ₂ → Δ₁ ∪ Δ₂ = Δ → + Δ₁ ∩ Δ₂ = F → discBd Δ₁ = X₁ ∪ F → discBd Δ₂ = X₂ ∪ F → + ∃ (c : X) (𝓛 𝓒 : Set (Set X)), c ∈ discInt Δ ∧ IsChordFan Δ (insert c P) 𝓛 𝓒 ∧ + 𝓛.ncard = P.ncard ∧ 𝓒.ncard = P.ncard ∧ + (∀ L ∈ 𝓛, ∃ p ∈ P, IsLineWithEnds L c p ∧ L ∩ discBd Δ = {p}) ∧ + ∀ L ∈ 𝓛, ∀ L' ∈ 𝓛, L ≠ L' → L ∩ L' = {c} := by + classical + intro X₁ X₂ + have hY : discBd Δ \ {a, b} = X₁ ∪ X₂ := by + rw [← hu, union_sdiff_distrib] + intro Δ₁ Δ₂ hΔ₁ hΔ₂ hun hint hb₁ hb₂ + have haF : a ∈ F := hF.left_mem + have hbF : b ∈ F := hF.right_mem + have hsplit : ∀ {L X' : Set X}, IsLineWithEnds L a b → X' = L \ {a, b} → X' ∪ F = L ∪ F₁ ∪ F₂ + := by + intro L X' hL hX' + ext y + subst hX' + constructor + · rintro (h2 | h2) + · exact .inl (.inl h2.1) + · rw [hFu] at h2 + rcases h2 with h2 | h2 + · exact .inl (.inr h2) + · exact .inr h2 + · rintro ((h2 | h2) | h2) + · by_cases h3 : y ∈ F + · exact .inr h3 + · exact .inl ⟨h2, by rintro (rfl | rfl); exacts [h3 haF, h3 hbF]⟩ + · exact .inr (hFu ▸ .inl h2) + · exact .inr (hFu ▸ .inr h2) + have hLF : ∀ {L : Set X}, L ⊆ discBd Δ → ∀ {y}, y ∈ L → y ∈ F → y = a ∨ y = b + := fun {L} hL {y} h2 h3 => by + have : y ∈ F ∩ discBd Δ := ⟨h3, hL h2⟩ + rwa [hFbd] at this + have hsub₁ : range a₁ ⊆ discBd Δ := hu ▸ subset_union_left + have hsub₂ : range a₂ ⊆ discBd Δ := hu ▸ subset_union_right + have hm1' : ∀ {L : Set X}, IsLineWithEnds L a b → L ⊆ discBd Δ → L ∩ F₁ = {a} := fun {L} hL hs + => by + ext y + constructor + · rintro ⟨h2, h3⟩ + rcases hLF hs h2 (hFu ▸ .inl h3) with rfl | rfl + · rfl + · exact absurd h3 hbF₁ + · rintro rfl + exact ⟨hL.left_mem, h₁.right_mem⟩ + have hm2' : ∀ {L : Set X}, IsLineWithEnds L a b → L ⊆ discBd Δ → L ∩ F₂ = {b} := fun {L} hL hs + => by + ext y + constructor + · rintro ⟨h2, h3⟩ + rcases hLF hs h2 (hFu ▸ .inr h3) with rfl | rfl + · exact absurd h3 haF₂ + · rfl + · rintro rfl + exact ⟨hL.right_mem, h₂.right_mem⟩ + have hPf : ∀ L : Set X, (P ∩ L).Finite := fun L => hP.subset inter_subset_left + obtain ⟨n₁, 𝓛₁, 𝓒₁, hf₁, hc₁, hnL₁, hnS₁, hsp₁, hpr₁⟩ := fan_side hΔ₁ hl₁ h₁ h₂ (hb₁.trans + (hsplit hl₁ rfl)) + (hm1' hl₁ hsub₁) (hm2' hl₁ hsub₁) hF₁F₂ (hPf _) inter_subset_right ⟨ha, hl₁.left_mem⟩ ⟨hb, + hl₁.right_mem⟩ hab + obtain ⟨n₂, 𝓛₂, 𝓒₂, hf₂, hc₂, hnL₂, hnS₂, hsp₂, hpr₂⟩ := fan_side hΔ₂ hl₂ h₁ h₂ (hb₂.trans + (hsplit hl₂ rfl)) + (hm1' hl₂ hsub₂) (hm2' hl₂ hsub₂) hF₁F₂ (hPf _) inter_subset_right ⟨ha, hl₂.left_mem⟩ ⟨hb, + hl₂.right_mem⟩ hab + have hFb₁ : F ⊆ discBd Δ₁ := hb₁ ▸ subset_union_right + have hFb₂ : F ⊆ discBd Δ₂ := hb₂ ▸ subset_union_right + have hb₁s := discBd_subset Δ₁ + have hb₂s := discBd_subset Δ₂ + have hΔ₁s : Δ₁ ⊆ Δ := hun ▸ subset_union_left + have hΔ₂s : Δ₂ ⊆ Δ := hun ▸ subset_union_right + have hinF : ∀ {y}, y ∈ Δ₁ → y ∈ Δ₂ → y ∈ F := fun {y} h1' h2' => hint ▸ ⟨h1', h2'⟩ + have hX₁n : ∀ {y}, y ∈ X₁ → y ∉ Δ₂ := fun {y} hy h2 => by + rcases hLF hsub₁ hy.1 (hinF (hb₁s (hb₁ ▸ .inl hy)) h2) with h3 | h3 + · exact hy.2 (.inl h3) + · exact hy.2 (.inr h3) + have hX₂n : ∀ {y}, y ∈ X₂ → y ∉ Δ₁ := fun {y} hy h2 => by + rcases hLF hsub₂ hy.1 (hinF h2 (hb₂s (hb₂ ▸ .inl hy))) with h3 | h3 + · exact hy.2 (.inl h3) + · exact hy.2 (.inr h3) + have hsplit' : ∀ {y}, y ∈ discBd Δ → y ∈ X₁ ∨ y ∈ X₂ ∨ y ∈ F := fun {y} hy => by + by_cases h3 : y = a ∨ y = b + · rcases h3 with rfl | rfl + · exact .inr (.inr haF) + · exact .inr (.inr hbF) + · have h4 : y ∈ discBd Δ \ {a, b} := ⟨hy, h3⟩ + rw [hY] at h4 + rcases h4 with h4 | h4 + · exact .inl h4 + · exact .inr (.inl h4) + have hin₁ : ∀ y ∈ discBd Δ, y ∈ Δ₁ → y ∈ discBd Δ₁ := fun y hy h2 => by + rcases hsplit' hy with h3 | h3 | h3 + · exact hb₁ ▸ .inl h3 + · exact absurd h2 (hX₂n h3) + · exact hFb₁ h3 + have hin₂ : ∀ y ∈ discBd Δ, y ∈ Δ₂ → y ∈ discBd Δ₂ := fun y hy h2 => by + rcases hsplit' hy with h3 | h3 | h3 + · exact absurd h2 (hX₁n h3) + · exact hb₂ ▸ .inl h3 + · exact hFb₂ h3 + have hbd₁ : discBd Δ₁ ⊆ discBd Δ ∪ F := fun y hy => by + rw [hb₁] at hy + rcases hy with hy | hy + · exact .inl (hsub₁ hy.1) + · exact .inr hy + have hbd₂ : discBd Δ₂ ⊆ discBd Δ ∪ F := fun y hy => by + rw [hb₂] at hy + rcases hy with hy | hy + · exact .inl (hsub₂ hy.1) + · exact .inr hy + have hQ₁ : ∀ Φ, Φ ⊆ Δ₁ → Φ ∩ insert c P = Φ ∩ insert c (P ∩ range a₁) := fun Φ hΦ => by + ext y + constructor + · rintro ⟨h2, h3 | h3⟩ + · exact ⟨h2, .inl h3⟩ + · refine ⟨h2, .inr ⟨h3, ?_⟩⟩ + rcases hsplit' (hPb h3) with h4 | h4 | h4 + · exact h4.1 + · exact absurd (hΦ h2) (hX₂n h4) + · rcases hFbd.subset ⟨h4, hPb h3⟩ with rfl | rfl + · exact hl₁.left_mem + · exact hl₁.right_mem + · rintro ⟨h2, h3 | h3⟩ + · exact ⟨h2, .inl h3⟩ + · exact ⟨h2, .inr h3.1⟩ + have hQ₂ : ∀ Φ, Φ ⊆ Δ₂ → Φ ∩ insert c P = Φ ∩ insert c (P ∩ range a₂) := fun Φ hΦ => by + ext y + constructor + · rintro ⟨h2, h3 | h3⟩ + · exact ⟨h2, .inl h3⟩ + · refine ⟨h2, .inr ⟨h3, ?_⟩⟩ + rcases hsplit' (hPb h3) with h4 | h4 | h4 + · exact absurd (hΦ h2) (hX₁n h4) + · exact h4.1 + · rcases hFbd.subset ⟨h4, hPb h3⟩ with rfl | rfl + · exact hl₂.left_mem + · exact hl₂.right_mem + · rintro ⟨h2, h3 | h3⟩ + · exact ⟨h2, .inl h3⟩ + · exact ⟨h2, .inr h3.1⟩ + have hd𝓒 : Disjoint 𝓒₁ 𝓒₂ := Set.disjoint_left.mpr fun Φ h1' h2' => by + have hdisc := hf₁.disc Φ h1' + obtain ⟨h', g', c'⟩ := hdisc.exists_isChart + have hg0 : g' 0 ∈ Φ := c'.gm (by simp) + have h3 := hdisc.subset_closure_discInt hg0 + obtain ⟨y, hy⟩ : (discInt Φ).Nonempty := by + by_contra hc' + rw [not_nonempty_iff_eq_empty] at hc' + rw [hc', closure_empty] at h3 + exact h3 + have h4 : y ∈ F := hinF (hf₁.sub Φ h1' hy.1) (hf₂.sub Φ h2' hy.1) + exact Set.disjoint_left.mp (hf₁.int Φ h1') hy (.inl (hFb₁ h4)) + have hcF : c ∈ F := hFu ▸ Or.inl h₁.left_mem + have hsp₁' := fun L hL => + cone_spoke_on_whole_disc (hsp₁ L hL) (hf₁.subL L hL) hin₁ hFb₁ hsub₁ hPb hcbd hcF hLF + have hsp₂' := fun L hL => + cone_spoke_on_whole_disc (hsp₂ L hL) (hf₂.subL L hL) hin₂ hFb₂ hsub₂ hPb hcbd hcF hLF + have hsp : ∀ L ∈ 𝓛₁ ∪ 𝓛₂, ∃ p ∈ P, p ≠ a ∧ p ≠ b ∧ IsLineWithEnds L c p ∧ L ∩ discBd Δ = {p} + ∧ L ∩ F = {c} := by + rintro L (hL | hL) + · obtain ⟨p, h2, h3, h4, -, h5⟩ := hsp₁' L hL + exact ⟨p, h2, h3, h4, h5⟩ + · obtain ⟨p, h2, h3, h4, -, h5⟩ := hsp₂' L hL + exact ⟨p, h2, h3, h4, h5⟩ + have hF₁L : F₁ ∉ 𝓛₁ ∪ 𝓛₂ := fun h => by + obtain ⟨p, -, hpa, -, -, h3, -⟩ := hsp _ h + have h4 : a ∈ F₁ ∩ discBd Δ := ⟨h₁.right_mem, hPb ha⟩ + rw [h3] at h4 + exact hpa h4.symm + have hF₂L : F₂ ∉ 𝓛₁ ∪ 𝓛₂ := fun h => by + obtain ⟨p, -, -, hpb, -, h3, -⟩ := hsp _ h + have h4 : b ∈ F₂ ∩ discBd Δ := ⟨h₂.right_mem, hPb hb⟩ + rw [h3] at h4 + exact hpb h4.symm + have hF₁₂ : F₁ ≠ F₂ := fun h => haF₂ (h ▸ h₁.right_mem) + have hdL : Disjoint 𝓛₁ 𝓛₂ := Set.disjoint_left.mpr fun L h1' h2' => by + obtain ⟨p, -, hpa, hpb, hpr, hl, -, -⟩ := hsp₁' L h1' + have h3 : p ∈ F := hinF (hf₁.subL L h1' hl.right_mem) (hf₂.subL L h2' hl.right_mem) + rcases hLF hsub₁ hpr h3 with h4 | h4 + · exact hpa h4 + · exact hpb h4 + have hPcount : P.ncard = n₁ + n₂ + 2 := by + have h3 : (P ∩ range a₁) ∪ (P ∩ range a₂) = P := by + rw [← inter_union_distrib_left, hu] + exact inter_eq_left.mpr hPb + have h4 : (P ∩ range a₁) ∩ (P ∩ range a₂) = {a, b} := by + rw [← inter_inter_distrib_left, hinter] + exact inter_eq_right.mpr (insert_subset ha (singleton_subset_iff.mpr hb)) + have h5 := ncard_union_add_ncard_inter (P ∩ range a₁) (P ∩ range a₂) (hPf _) (hPf _) + rw [h3, h4, ncard_pair hab, hc₁, hc₂] at h5 + omega + exact merge_cone_fans hf₁ hf₂ hPb ha hb (hFu ▸ Or.inl h₁.left_mem) hcbd hFΔ hFu h₁ h₂ haF₂ hbF₁ + hLF + hun hint hb₁ hb₂ hX₁n hX₂n hsplit' hin₁ hin₂ hbd₁ hbd₂ hQ₁ hQ₂ hsp₁' hsp₂' hsp + hF₁L hF₂L hF₁₂ hF₁F₂ hdL hd𝓒 hnL₁ hnL₂ hnS₁ hnS₂ hPcount hpr₁ hpr₂ + +/-- **The cone on a closed disc.** A closed disc with at least two marked boundary points is cut +into triangles by arcs from an interior point `c` to the marked points. -/ +theorem exists_cone {Δ P : Set X} (hΔ : IsClosedDisc Δ) (hP : P.Finite) + (hPb : P ⊆ discBd Δ) {a b : X} (ha : a ∈ P) (hb : b ∈ P) (hab : a ≠ b) : + ∃ (c : X) (𝓛 𝓒 : Set (Set X)), c ∈ discInt Δ ∧ IsChordFan Δ (insert c P) 𝓛 𝓒 ∧ 𝓛.ncard + = P.ncard ∧ 𝓒.ncard = P.ncard ∧ + (∀ L ∈ 𝓛, ∃ p ∈ P, IsLineWithEnds L c p ∧ L ∩ discBd Δ = {p}) ∧ + ∀ L ∈ 𝓛, ∀ L' ∈ 𝓛, L ≠ L' → L ∩ L' = {c} := by + classical + obtain ⟨F, hF, hFΔ, hFbd⟩ := exists_chord hΔ (hPb ha) (hPb hb) hab + obtain ⟨f, hf, hfr, hf0, hf1⟩ := hF.exists_arc + let m : 𝕀 := ⟨1 / 2, by norm_num, by norm_num⟩ + have hm0 : (0 : 𝕀) < m := by + change (0 : ℝ) < 1 / 2 + norm_num + have hm1 : m < 1 := by + change (1 / 2 : ℝ) < 1 + norm_num + set c := f m with hc + let F₁ : Set X := f '' Icc 0 m + let F₂ : Set X := f '' Icc m 1 + have h₁ : IsLineWithEnds F₁ c a := by + have h2 := (hf.sub (s := 0) (t := m) hm0.ne).isLineWithEnds + rw [range_subArc f hm0.le, subArc_zero, subArc_one, hf0] at h2 + exact h2.symm + have h₂ : IsLineWithEnds F₂ c b := by + have h2 := (hf.sub (s := m) (t := 1) hm1.ne).isLineWithEnds + rwa [range_subArc f hm1.le, subArc_zero, subArc_one, hf1] at h2 + have hFu : F = F₁ ∪ F₂ := by + rw [← image_union, Icc_union_Icc_eq_Icc hm0.le hm1.le, ← hfr] + ext x + simp only [mem_range, mem_image, mem_Icc] + exact ⟨fun ⟨t, ht⟩ => ⟨t, ⟨t.2.1, t.2.2⟩, ht⟩, fun ⟨t, _, ht⟩ => ⟨t, ht⟩⟩ + have hF₁F₂ : F₁ ∩ F₂ = {c} := by + ext x + constructor + · rintro ⟨⟨s, hs, rfl⟩, ⟨t, ht, he⟩⟩ + have h3 : t = s := hf.2 he + subst h3 + have : t = m := le_antisymm hs.2 ht.1 + rw [this] + rfl + · rintro rfl + exact ⟨⟨m, ⟨hm0.le, le_rfl⟩, rfl⟩, ⟨m, ⟨le_rfl, hm1.le⟩, rfl⟩⟩ + have hcbd : c ∉ discBd Δ := fun h => by + have h3 : c ∈ F ∩ discBd Δ := ⟨hfr ▸ mem_range_self m, h⟩ + rw [hFbd] at h3 + rcases h3 with h3 | h3 + · exact hm0.ne (hf.2 (hf0.trans h3.symm)) + · exact hm1.ne' (hf.2 (hf1.trans h3.symm)) + have hbF₁ : b ∉ F₁ := by + rintro ⟨t, ht, he⟩ + have h3 : t = 1 := hf.2 (he.trans hf1.symm) + exact absurd (ht.2.trans_lt hm1) (by rw [h3]; exact lt_irrefl _) + have haF₂ : a ∉ F₂ := by + rintro ⟨t, ht, he⟩ + have h3 : t = 0 := hf.2 (he.trans hf0.symm) + exact absurd (hm0.trans_le ht.1) (by rw [h3]; exact lt_irrefl _) + obtain ⟨a₁, a₂, hTwo, h0, h1, hu⟩ := hΔ.isOArc_discBd.exists_arcs (hPb ha) (hPb hb) hab + have hl₁ : IsLineWithEnds (range a₁) a b := by + have := hTwo.arc_left.isLineWithEnds + rwa [h0, h1] at this + have hl₂ : IsLineWithEnds (range a₂) a b := by + have := hTwo.arc_right.isLineWithEnds + rwa [hTwo.zero, hTwo.one, h0, h1] at this + have hinter : range a₁ ∩ range a₂ = {a, b} := by + rw [hTwo.inter, h0, h1] + let X₁ : Set X := range a₁ \ {a, b} + let X₂ : Set X := range a₂ \ {a, b} + have hY : discBd Δ \ {a, b} = X₁ ∪ X₂ := by + rw [← hu, union_sdiff_distrib] + have hdX : Disjoint X₁ X₂ := Set.disjoint_left.mpr fun y hy hy' => hy.2 (hinter ▸ ⟨hy.1, hy'.1⟩) + have nX : ∀ {L : Set X}, IsLineWithEnds L a b → (L \ {a, b}).Nonempty := fun {L} hL => by + by_contra hc' + rw [not_nonempty_iff_eq_empty] at hc' + have h2 := hL.subset_closure_diff + rw [hc', closure_empty] at h2 + exact h2 hL.left_mem + let main := fun {Δ₁ Δ₂ : Set X} => + cone_of_split_discs hF hFΔ hFbd hFu h₁ h₂ hF₁F₂ hbF₁ haF₂ hcbd hP hPb ha hb hab + hl₁ hl₂ hinter hu (Δ₁ := Δ₁) (Δ₂ := Δ₂) + obtain ⟨A₁, A₂, Δ₁, Δ₂, hA, hcomp, hΔ₁, hΔ₂, hun, hint, hb₁, hb₂, -⟩ + := disc_iArc.{0} Δ F a b hΔ hFΔ hab hF hFbd + rcases comps_two hA hcomp hY hdX hl₁.isPreconnected_diff hl₂.isPreconnected_diff (nX hl₁) + (nX hl₂) with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ + · exact main hΔ₁ hΔ₂ hun hint hb₁ hb₂ + · exact main hΔ₂ hΔ₁ (by rw [union_comm, hun]) (by rw [inter_comm, hint]) hb₂ hb₁ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/FanSquare.lean b/LeanPool/GraphMinor/Surface/FanSquare.lean new file mode 100644 index 0000000000..aff1c666b6 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/FanSquare.lean @@ -0,0 +1,347 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscNbhd +public import Mathlib.Analysis.Convex.GaugeRescale +public import Mathlib.Analysis.Complex.ReImTopology + +/-! +# A fan of squares + +A fan at a point `y` given by maps of the unit square, each with the corner `0` at `y`. Each square +has a left side and a +lower side at this corner. The left sides are pasted in pairs by a map `tw` and the lower sides by a +map `pt`, where +`pt g = g` means that the lower side of `g` is free. Then the union of the squares is a closed disc +(`IsSquareFan.exists_disc`), with `y` on its boundary exactly when a lower side is free. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Complex + +universe u v + +variable {X : Type u} [TopologicalSpace X] + +local notation "𝕀" => unitInterval + +/-- The unit square. -/ +def unitSq : Set ℂ := Icc (0 : ℝ) 1 ×ℂ Icc (0 : ℝ) 1 + +theorem isCompact_unitSq : IsCompact unitSq := + Metric.isCompact_of_isClosed_isBounded (isClosed_Icc.reProdIm isClosed_Icc) + (Metric.isBounded_Icc _ _ |>.reProdIm (Metric.isBounded_Icc _ _)) + +theorem unitSq_disc : IsClosedDisc unitSq ∧ discBd unitSq = frontier unitSq := by + have hc : Convex ℝ unitSq := + ((convex_Icc (0 : ℝ) 1).is_linear_preimage reLm.isLinear).inter + ((convex_Icc (0 : ℝ) 1).is_linear_preimage imLm.isLinear) + have hcl : IsClosed unitSq := isClosed_Icc.reProdIm isClosed_Icc + have hi : (interior unitSq).Nonempty := by + rw [unitSq, interior_reProdIm, interior_Icc] + exact ⟨⟨1 / 2, 1 / 2⟩, by constructor <;> norm_num⟩ + obtain ⟨e, -, h2, h3⟩ := exists_homeomorph_image_interior_closure_frontier_eq_unitBall hc hi + isCompact_unitSq.isBounded + rw [hcl.closure_eq] at h2 + have h4 := (isClosedDisc_closedBall).1.image (f := e.symm) (f' := e) + e.symm.continuous.continuousOn + e.continuous.continuousOn (fun z _ => e.apply_symm_apply z) + have h5 : ∀ A : Set ℂ, e.symm '' (e '' A) = A := fun A => by + rw [image_image] + simp + rw [← h2, h5] at h4 + refine ⟨h4.1, ?_⟩ + rw [h4.2, h2, isClosedDisc_closedBall.2, ← h3, h5] + +theorem mem_frontier_unitSq {z : ℂ} (hz : z ∈ unitSq) (h : z.re = 0 ∨ z.im + = 0) : z ∈ frontier unitSq := by + have hcl : IsClosed unitSq := isClosed_Icc.reProdIm isClosed_Icc + rw [frontier, hcl.closure_eq] + refine ⟨hz, ?_⟩ + rw [unitSq, interior_reProdIm, interior_Icc] + rintro ⟨h1, h2⟩ + rcases h with h | h + · exact h1.1.ne' h + · exact h2.1.ne' h + +/-- The hypotheses on a fan of squares. -/ +structure IsSquareFan (y : X) {G : Type v} (M : G → ℂ → X) (tw pt : G → G) : Prop where + cont : ∀ g, ContinuousOn (M g) unitSq + zero : ∀ g, M g 0 = y + tw_ne : ∀ g, tw g ≠ g + tw_eq : ∀ g, ∀ s ∈ Icc (0 : ℝ) 1, M (tw g) (s * I) = M g (s * I) + pt_eq : ∀ g, ∀ s ∈ Icc (0 : ℝ) 1, M (pt g) s = M g s + core : ∀ g g' z z', z ∈ unitSq → z' ∈ unitSq → M g z = M g' z' → + (g = g' ∧ z = z') ∨ (z = 0 ∧ z' = 0) ∨ (z = z' ∧ z.re = 0 ∧ g' = tw g) ∨ (z = z' ∧ z.im = 0 + ∧ g' = pt g) + conn : ∀ A : Set G, A.Nonempty → (∀ g ∈ A, tw g ∈ A ∧ pt g ∈ A) → A = univ + +namespace IsSquareFan + +variable {y : X} {G : Type v} {M : G → ℂ → X} {tw pt : G → G} + +theorem mem_left {s : ℝ} (hs : s ∈ Icc (0 : ℝ) 1) : (s * I : ℂ) ∈ unitSq := by + constructor <;> simp [hs.1, hs.2] + +theorem mem_low {s : ℝ} (hs : s ∈ Icc (0 : ℝ) 1) : (s : ℂ) ∈ unitSq := by + constructor <;> simp [hs.1, hs.2] + +theorem injOn (h : IsSquareFan y M tw pt) (g : G) : InjOn (M g) unitSq := fun z hz z' hz' he => by + rcases h.core g g z z' hz hz' he with h1 | h1 | h1 | h1 + · exact h1.2 + · rw [h1.1, h1.2] + · exact h1.1 + · exact h1.1 + +/-- The ray of the left side. -/ +def left (M : G → ℂ → X) (g : G) : Set X := (fun s : ℝ => M g (s * I)) '' Icc (0 : ℝ) 1 + +/-- The ray of the lower side. -/ +def low (M : G → ℂ → X) (g : G) : Set X := (fun s : ℝ => M g s) '' Icc (0 : ℝ) 1 + +/-- The member of the fan of `g`. -/ +def piece (M : G → ℂ → X) (g : G) : Set X × Set (Set X) := (M g '' unitSq, {left M g, low M g}) + +theorem left_tw (h : IsSquareFan y M tw pt) (g : G) : left M (tw g) = left M g := + image_congr fun s hs => h.tw_eq g s hs + +theorem low_pt (h : IsSquareFan y M tw pt) (g : G) : low M (pt g) = low M g := + image_congr fun s hs => h.pt_eq g s hs + +theorem I_ne_ofReal (t : ℝ) : (I : ℂ) ≠ t := fun he => by + have := congrArg Complex.im he + simp at this + +theorem of_left (h : IsSquareFan y M tw pt) {g g' : G} (hr : left M g ∈ (piece M g').2) : g' = g + ∨ g' = tw g := by + have hm : M g I ∈ left M g := ⟨1, ⟨zero_le_one, le_rfl⟩, by simp⟩ + have h1 : (I : ℂ) ∈ unitSq := by simpa using mem_left (s := 1) ⟨zero_le_one, le_rfl⟩ + rcases hr with hr | hr + · rw [hr] at hm + obtain ⟨s, hs, he⟩ := hm + rcases h.core g g' _ _ h1 (mem_left hs) he.symm with h2 | h2 | h2 | h2 + · exact .inl h2.1.symm + · simp at h2 + · exact .inr h2.2.2 + · simp at h2 + · rw [hr] at hm + obtain ⟨s, hs, he⟩ := hm + rcases h.core g g' _ _ h1 (mem_low hs) he.symm with h2 | h2 | h2 | h2 + · exact absurd h2.2 (I_ne_ofReal s) + · simp at h2 + · exact absurd h2.1 (I_ne_ofReal s) + · simp at h2 + +theorem of_low (h : IsSquareFan y M tw pt) {g g' : G} (hr : low M g ∈ (piece M g').2) : g' = g ∨ g' + = pt g := by + have hm : M g 1 ∈ low M g := ⟨1, ⟨zero_le_one, le_rfl⟩, by simp⟩ + have h1 : (1 : ℂ) ∈ unitSq := by simpa using mem_low (s := 1) ⟨zero_le_one, le_rfl⟩ + rcases hr with hr | hr + · rw [hr] at hm + obtain ⟨s, hs, he⟩ := hm + rcases h.core g g' _ _ h1 (mem_left hs) he.symm with h2 | h2 | h2 | h2 + · have := congrArg Complex.re h2.2 + simp at this + · simp at h2 + · simp at h2 + · have := congrArg Complex.re h2.1 + simp at this + · rw [hr] at hm + obtain ⟨s, hs, he⟩ := hm + rcases h.core g g' _ _ h1 (mem_low hs) he.symm with h2 | h2 | h2 | h2 + · exact .inl h2.1.symm + · simp at h2 + · simp at h2 + · exact .inr h2.2.2 + +theorem piece_inj (h : IsSquareFan y M tw pt) : Function.Injective (piece M) := by + intro g g' he + have h1 : ((1 / 2 + 1 / 2 * I : ℂ)) ∈ unitSq := by + constructor <;> norm_num + have h2 : M g (1 / 2 + 1 / 2 * I) ∈ M g' '' unitSq := by + have h3 : M g '' unitSq = M g' '' unitSq := congrArg Prod.fst he + rw [← h3] + exact mem_image_of_mem _ h1 + obtain ⟨z, hz, h3⟩ := h2 + rcases h.core g g' _ _ h1 hz h3.symm with h4 | h4 | h4 | h4 + · exact h4.1 + · have := congrArg Complex.re h4.1 + norm_num at this + · have := h4.2.1 + norm_num at this + · have := h4.2.1 + norm_num at this + +theorem low_subset (_h : IsSquareFan y M tw pt) (g _g' : G) {s : Set X} (hs : s ∈ (piece M g).2) : + s ⊆ M g '' unitSq := by + rcases hs with rfl | rfl + · rintro _ ⟨t, ht, rfl⟩ + exact mem_image_of_mem _ (mem_left ht) + · rintro _ ⟨t, ht, rfl⟩ + exact mem_image_of_mem _ (mem_low ht) + +theorem isFan [T2Space X] [Finite G] (h : IsSquareFan y M tw pt) : IsFan y (range (piece M)) := by + classical + have hdisc : ∀ g, IsClosedDisc (M g '' unitSq) ∧ discBd (M g '' unitSq) = M g '' frontier unitSq + := by + intro g + obtain ⟨f', h1, h2⟩ := exists_inv_of_compactOn isCompact_unitSq (h.cont g) (h.injOn g) + have h3 := unitSq_disc.1.image (h.cont g) h1 h2 + rw [unitSq_disc.2] at h3 + exact h3 + have hhalf : ∀ s : ℝ, s ∈ Icc (0 : ℝ) 1 → ((s : ℂ)) ∈ unitSq := fun s hs => mem_low hs + refine ⟨finite_range _, ?_, ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨g, rfl⟩ + exact (hdisc g).1 + · rintro _ ⟨g, rfl⟩ + have hL : ∀ s t : ℝ, s ∈ Icc (0 : ℝ) 1 → t ∈ Icc (0 : ℝ) 1 → M g (s * I) = M g t → s = 0 ∧ t + = 0 := by + intro s t hs ht he + have h1 := h.injOn g (mem_left hs) (mem_low ht) he + have h2 := congrArg Complex.re h1 + have h3 := congrArg Complex.im h1 + exact ⟨by simpa using h3, by simpa using h2.symm⟩ + have harc : ∀ c : ℂ, (c = 1 ∨ c = I) → IsArcMap fun t : 𝕀 => M g (t.1 * c) := by + intro c hc + have hm : ∀ t : 𝕀, (t.1 : ℂ) * c ∈ unitSq := fun t => by + rcases hc with rfl | rfl + · rw [mul_one] + exact mem_low t.2 + · exact mem_left t.2 + refine ⟨?_, fun t t' he => ?_⟩ + · refine (h.cont g).comp_continuous (by fun_prop) hm + · have h1 := h.injOn g (hm t) (hm t') he + have hc0 : c ≠ 0 := by + rcases hc with rfl | rfl <;> simp + exact Subtype.ext (by exact_mod_cast mul_right_cancel₀ hc0 h1) + have hr : ∀ c : ℂ, (c = 1 ∨ c = I) → range (fun t : 𝕀 => M g (t.1 * c)) = (fun s : ℝ => M g + (s * c)) '' Icc (0 : ℝ) 1 := by + intro c _ + ext x + constructor + · rintro ⟨t, rfl⟩ + exact ⟨t.1, t.2, rfl⟩ + · rintro ⟨s, hs, rfl⟩ + exact ⟨⟨s, hs⟩, rfl⟩ + have hL1 : IsLineWithEnds (left M g) y (M g I) := by + have h1 := (harc I (.inr rfl)).isLineWithEnds + rw [hr I (.inr rfl)] at h1 + simpa [h.zero, left] using h1 + have hL2 : IsLineWithEnds (low M g) y (M g 1) := by + have h1 := (harc 1 (.inl rfl)).isLineWithEnds + rw [hr 1 (.inl rfl)] at h1 + simpa [h.zero, left, low] using h1 + have hinter : left M g ∩ low M g = {y} := by + apply Subset.antisymm + · rintro x ⟨⟨s, hs, rfl⟩, ⟨t, ht, he⟩⟩ + have h1 := hL s t hs ht he.symm + simp [h1.1, h.zero] + · rintro _ rfl + exact ⟨⟨0, ⟨le_rfl, zero_le_one⟩, by simp [h.zero]⟩, ⟨0, ⟨le_rfl, zero_le_one⟩, + by simp [h.zero]⟩⟩ + refine ⟨left M g, low M g, M g I, M g 1, rfl, fun he => ?_, hL1, hL2, ?_, ?_, hinter⟩ + · have h1 : M g I ∈ left M g ∩ low M g := ⟨hL1.right_mem, he ▸ hL1.right_mem⟩ + rw [hinter] at h1 + have h2 : M g I = M g 0 := by rw [h.zero]; exact h1 + have h3 := h.injOn g (by simpa using mem_left (s := 1) ⟨zero_le_one, le_rfl⟩) + (by simpa using mem_low (s := 0) ⟨le_rfl, zero_le_one⟩) h2 + simp at h3 + · change (left M g) ⊆ discBd (M g '' unitSq) + rw [(hdisc g).2] + rintro _ ⟨s, hs, rfl⟩ + exact mem_image_of_mem _ (mem_frontier_unitSq (mem_left hs) (.inl (by simp))) + · change (low M g) ⊆ discBd (M g '' unitSq) + rw [(hdisc g).2] + rintro _ ⟨s, hs, rfl⟩ + exact mem_image_of_mem _ (mem_frontier_unitSq (mem_low hs) (.inr (by simp))) + · rintro _ ⟨g, rfl⟩ _ ⟨g', rfl⟩ hne + have hgg : g ≠ g' := fun he => hne (by rw [he]) + apply Subset.antisymm + · rintro x ⟨⟨z, hz, rfl⟩, ⟨z', hz', he⟩⟩ + rcases h.core g g' z z' hz hz' he.symm with h1 | h1 | h1 | h1 + · exact absurd h1.1 hgg + · exact .inl (by rw [h1.1, h.zero]; rfl) + · refine .inr ⟨left M g, ⟨.inl rfl, ?_⟩, ?_⟩ + · rw [h1.2.2, ← left_tw h g] + exact .inl (by rw [left_tw h g]) + · refine ⟨z.im, ?_, ?_⟩ + · exact hz.2 + · change M g _ = M g z + congr 1 + apply Complex.ext <;> simp [h1.2.1] + · refine .inr ⟨low M g, ⟨.inr rfl, ?_⟩, ?_⟩ + · rw [h1.2.2] + exact .inr (low_pt h g).symm + · refine ⟨z.re, hz.1, ?_⟩ + change M g _ = M g z + congr 1 + apply Complex.ext <;> simp [h1.2.1] + · rintro x (rfl | ⟨r, ⟨h1, h2⟩, hx⟩) + · exact ⟨⟨0, by simpa using mem_low (s := 0) ⟨le_rfl, zero_le_one⟩, h.zero g⟩, + ⟨0, by simpa using mem_low (s := 0) ⟨le_rfl, zero_le_one⟩, h.zero g'⟩⟩ + · exact ⟨low_subset h g g h1 hx, low_subset h g' g' h2 hx⟩ + · intro r + by_cases hemp : {P ∈ range (piece M) | r ∈ P.2} = ∅ + · rw [hemp] + simp + obtain ⟨_, ⟨g, rfl⟩, hg⟩ := nonempty_iff_ne_empty.mpr hemp + have hb : ∀ c : G, (∀ g', r ∈ (piece M g').2 → g' = g ∨ g' = c) → + {P ∈ range (piece M) | r ∈ P.2}.encard ≤ 2 := by + intro c hc + have hs : {P ∈ range (piece M) | r ∈ P.2} ⊆ {piece M g, piece M c} := by + rintro _ ⟨⟨g', rfl⟩, h2⟩ + rcases hc g' h2 with rfl | rfl + · exact .inl rfl + · exact .inr rfl + refine (encard_le_encard hs).trans ((encard_insert_le _ _).trans ?_) + rw [encard_singleton] + norm_num + rcases hg with rfl | rfl + · exact hb (tw g) fun g' hr => of_left h hr + · exact hb (pt g) fun g' hr => of_low h hr + · rintro 𝓠 hQ ⟨_, hq⟩ hcl + obtain ⟨g, rfl⟩ := hQ hq + have hA := h.conn {g | piece M g ∈ 𝓠} ⟨g, hq⟩ fun g hg => by + refine ⟨hcl _ hg _ ⟨_, rfl⟩ ⟨left M g, .inl rfl, ?_⟩, hcl _ hg _ ⟨_, rfl⟩ ⟨low M g, + .inr rfl, ?_⟩⟩ + · exact .inl (left_tw h g).symm + · exact .inr (low_pt h g).symm + apply Subset.antisymm hQ + rintro _ ⟨g', rfl⟩ + have : g' ∈ {g | piece M g ∈ 𝓠} := hA ▸ mem_univ g' + exact this + +/-- The union of the squares of a fan is a closed disc. The point is on its boundary exactly when a +lower side is +free. -/ +theorem exists_disc [T2Space X] [Finite G] [Nonempty G] (h : IsSquareFan y M tw pt) : + ∃ E, IsClosedDisc E ∧ E = (⋃ g, M g '' unitSq) ∧ ((∀ g, pt g ≠ g) → y ∉ discBd E) ∧ + ((∃ g, pt g = g) → y ∈ discBd E) := by + obtain ⟨E, h1, h2, h3, h4⟩ := h.isFan.exists_disc _ y _ rfl (range_nonempty _) + refine ⟨E, h1, ?_, fun hp => h3 ?_, fun hp => h4 ?_⟩ + · rw [h2, biUnion_range] + rfl + · rintro _ ⟨g, rfl⟩ r hr + rcases hr with rfl | rfl + · exact ⟨_, ⟨tw g, rfl⟩, fun he => h.tw_ne g (h.piece_inj he), .inl (left_tw h g).symm⟩ + · exact ⟨_, ⟨pt g, rfl⟩, fun he => hp g (h.piece_inj he), .inr (low_pt h g).symm⟩ + · obtain ⟨g, hg⟩ := hp + refine ⟨_, ⟨g, rfl⟩, low M g, .inr rfl, ?_⟩ + rintro _ ⟨g', rfl⟩ hr + rcases of_low h hr with rfl | rfl + · rfl + · rw [hg] + +end IsSquareFan + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/FreeCover.lean b/LeanPool/GraphMinor/Surface/FreeCover.lean new file mode 100644 index 0000000000..ebbef27194 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/FreeCover.lean @@ -0,0 +1,163 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.LocalCoh +public import Mathlib.Topology.UniformSpace.OfCompactT2 +public import Mathlib.Topology.UniformSpace.HeineCantor + +/-! +# A local cocycle from a free action + +Let a finite group `A` act freely on the right on a compact Hausdorff space `Z`, with quotient `Y`. +Fix a function `σ` that +picks a point in each fibre. For near points `x, y` of `Y` there is one `s` such that `s • σ x` is +near `σ y`. This `s` +is a local cocycle on `Y` (`cocycle_of_cover`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Filter +open scoped Uniformity + +universe u v + +variable {Z : Type u} {Y : Type v} {A : Type} + +theorem cocycle_of_cover_aux [UniformSpace Z] [CompactSpace Z] [T2Space Z] [TopologicalSpace Y] + [T2Space Y] + [AddGroup A] [Finite A] (τ : A → Z → Z) (hτc : ∀ s, Continuous (τ s)) (hτ0 : ∀ z, τ 0 z = z) + (hτa : ∀ s t z, τ s (τ t z) = τ (t + s) z) (hfree : ∀ s z, τ s z = z → s = 0) (q : Z → Y) + (hq : Continuous q) + (hs : Function.Surjective q) (hfib : ∀ z z', q z = q z' → ∃ s, z' = τ s z) (hfib' : ∀ s z, q + (τ s z) = q z) + (σ : Y → Z) (hσ : ∀ y, q (σ y) = y) : + ∃ (φ : Y → Y → A) (V : Set (Z × Z)), NearDiag V ∧ IsCoc φ ∧ + (∀ x y s, (τ s (σ x), σ y) ∈ V → φ x y = s) ∧ ∀ t z z', (z, z') ∈ V → (τ t z, τ t z') ∈ V + := by + classical + have hW₀ : (⋃ s ∈ {s : A | s ≠ 0}, {p : Z × Z | p.2 = τ s p.1})ᶜ ∈ 𝓤 Z := by + rw [← nhdsSet_diagonal_eq_uniformity] + have hcl : IsClosed (⋃ s ∈ {s : A | s ≠ 0}, {p : Z × Z | p.2 = τ s p.1}) := + (toFinite _).isClosed_biUnion fun s _ => isClosed_eq continuous_snd + ((hτc s).comp continuous_fst) + refine hcl.isOpen_compl.mem_nhdsSet.mpr ?_ + rintro ⟨z, z'⟩ hd h + have hd' : z = z' := hd + subst hd' + obtain ⟨s, hs0, he⟩ := mem_iUnion₂.mp h + exact hs0 (hfree s z (Eq.symm he)) + obtain ⟨V₁, hV₁, hsym₁, hc₁⟩ := comp_symm_mem_uniformity_sets hW₀ + obtain ⟨V₂, hV₂, hsym₂, hc₂⟩ := comp_symm_mem_uniformity_sets hV₁ + have hV : (⋂ s : A, (fun p : Z × Z => (τ s p.1, τ s p.2)) ⁻¹' V₂) ∈ 𝓤 Z := + (Filter.iInter_mem).mpr fun s => (CompactSpace.uniformContinuous_of_continuous (hτc s)) hV₂ + set V : Set (Z × Z) := ⋂ s : A, (fun p : Z × Z => (τ s p.1, τ s p.2)) ⁻¹' V₂ with hVdef + have hdiag : ∀ {W : Set (Z × Z)}, W ∈ 𝓤 Z → ∀ z, (z, z) ∈ W := fun hW z => refl_mem_uniformity hW + have hsub : V ⊆ V₂ := fun p hp => by + have h1 := mem_iInter.mp hp 0 + have h2 : (τ 0 p.1, τ 0 p.2) ∈ V₂ := h1 + rwa [hτ0, hτ0] at h2 + have hsub₁ : V₂ ⊆ V₁ := fun p hp => hc₂ (SetRel.prodMk_mem_comp hp (hdiag hV₂ _)) + have hinv : ∀ t {z z'}, (z, z') ∈ V → (τ t z, τ t z') ∈ V := by + intro t z z' h + refine mem_iInter.mpr fun s => ?_ + have h1 : (τ (t + s) z, τ (t + s) z') ∈ V₂ := mem_iInter.mp h (t + s) + change (τ s (τ t z), τ s (τ t z')) ∈ V₂ + rwa [hτa, hτa] + have hkey : ∀ s {a b c}, (a, b) ∈ V → (b, c) ∈ V → (τ s a, c) ∈ V → s = 0 := by + intro s a b c h1 h2 h3 + by_contra hs0 + have h4 : (a, c) ∈ V₁ := hc₂ (SetRel.prodMk_mem_comp (hsub h1) (hsub h2)) + have h5 : (c, τ s a) ∈ V₁ := hsub₁ (hsym₂.symm _ _ (hsub h3)) + have h6 := hc₁ (SetRel.prodMk_mem_comp h4 h5) + exact h6 (mem_iUnion₂.mpr ⟨s, hs0, rfl⟩) + have huniq : ∀ {x y : Y} {s s'}, (τ s (σ x), σ y) ∈ V → (τ s' (σ x), σ y) ∈ V → s = s' := by + intro x y s s' h1 h2 + have h3 : τ (-s + s') (τ s (σ x)) = τ s' (σ x) := by + rw [hτa, add_neg_cancel_left] + have h4 := hkey (-s + s') h1 (hdiag hV _) (h3 ▸ h2) + exact neg_add_eq_zero.mp h4 + let φ : Y → Y → A := fun x y => if h : ∃ s, (τ s (σ x), σ y) ∈ V then h.choose else 0 + have hφ : ∀ x y s, (τ s (σ x), σ y) ∈ V → φ x y = s := by + intro x y s h + have hex : ∃ s, (τ s (σ x), σ y) ∈ V := ⟨s, h⟩ + simp only [φ, hex, dite_eq_left] + exact huniq hex.choose_spec h + let N : Set (Y × Y) := {p | ∃ z z', q z = p.1 ∧ q z' = p.2 ∧ (z, z') ∈ V} + have hNex : ∀ x y, (x, y) ∈ N → ∃ s, (τ s (σ x), σ y) ∈ V := by + rintro x y ⟨z, z', h1, h2, h3⟩ + obtain ⟨s₁, rfl⟩ := hfib (σ x) z (by rw [hσ]; exact h1.symm) + obtain ⟨s₂, rfl⟩ := hfib (σ y) z' (by rw [hσ]; exact h2.symm) + refine ⟨s₁ + -s₂, ?_⟩ + have h4 := hinv (-s₂) h3 + rwa [hτa, hτa, add_neg_cancel, hτ0] at h4 + have hVZ : NearDiag V := fun z => by + have h1 : V ∈ 𝓝ˢ (diagonal Z) := by + rw [nhdsSet_diagonal_eq_uniformity] + exact hV + exact mem_nhdsSet_iff_forall.mp h1 (z, z) rfl + have hN : NearDiag N := by + intro p + obtain ⟨u, hu, v, hv, huv⟩ := mem_nhds_prod_iff.mp (hVZ (σ p)) + obtain ⟨O₀, hO₀, hO₀o, hzO⟩ := mem_nhds_iff.mp (Filter.inter_mem hu hv) + let U' : Set Z := ⋃ s, τ s ⁻¹' O₀ + have hU' : IsOpen U' := isOpen_iUnion fun s => hO₀o.preimage (hτc s) + have hC : IsClosed (q '' U'ᶜ) := (hU'.isClosed_compl.isCompact.image hq).isClosed + have hp : p ∉ q '' U'ᶜ := by + rintro ⟨z, hz, he⟩ + obtain ⟨s, hs'⟩ := hfib z (σ p) (by rw [hσ]; exact he) + refine hz (mem_iUnion.mpr ⟨s, ?_⟩) + change τ s z ∈ O₀ + rw [← hs'] + exact hzO + have hO : (q '' U'ᶜ)ᶜ ×ˢ (q '' U'ᶜ)ᶜ ∈ 𝓝 (p, p) := + (hC.isOpen_compl.prod hC.isOpen_compl).mem_nhds ⟨hp, hp⟩ + refine Filter.mem_of_superset hO ?_ + have hlift : ∀ x ∈ (q '' U'ᶜ)ᶜ, ∃ z ∈ O₀, q z = x := by + intro x hx + obtain ⟨z, rfl⟩ := hs x + have hz : z ∈ U' := by + by_contra hc + exact hx ⟨z, hc, rfl⟩ + obtain ⟨s, hs'⟩ := mem_iUnion.mp hz + exact ⟨τ s z, hs', hfib' s z⟩ + rintro ⟨x, y⟩ ⟨hx, hy⟩ + obtain ⟨z, hz, rfl⟩ := hlift x hx + obtain ⟨z', hz', rfl⟩ := hlift y hy + exact ⟨z, z', rfl, rfl, huv ⟨(hO₀ hz).1, (hO₀ hz').2⟩⟩ + refine ⟨φ, V, hVZ, ⟨N, hN, fun x y z hxy hyz hxz => ?_⟩, hφ, fun t z z' h => hinv t h⟩ + obtain ⟨s₁, h1⟩ := hNex _ _ hxy + obtain ⟨s₂, h2⟩ := hNex _ _ hyz + obtain ⟨s₃, h3⟩ := hNex _ _ hxz + rw [hφ _ _ _ h1, hφ _ _ _ h2, hφ _ _ _ h3] + have h4 := hinv s₂ h1 + rw [hτa] at h4 + have h5 : τ (-(s₁ + s₂) + s₃) (τ (s₁ + s₂) (σ x)) = τ s₃ (σ x) := by + rw [hτa, add_neg_cancel_left] + have h6 := hkey _ h4 h2 (h5 ▸ h3) + exact neg_add_eq_zero.mp h6 + +theorem cocycle_of_cover [TopologicalSpace Z] [CompactSpace Z] [T2Space Z] [TopologicalSpace Y] + [T2Space Y] + [AddGroup A] [Finite A] (τ : A → Z → Z) (hτc : ∀ s, Continuous (τ s)) (hτ0 : ∀ z, τ 0 z = z) + (hτa : ∀ s t z, τ s (τ t z) = τ (t + s) z) (hfree : ∀ s z, τ s z = z → s = 0) (q : Z → Y) + (hq : Continuous q) + (hs : Function.Surjective q) (hfib : ∀ z z', q z = q z' → ∃ s, z' = τ s z) (hfib' : ∀ s z, q + (τ s z) = q z) + (σ : Y → Z) (hσ : ∀ y, q (σ y) = y) : + ∃ (φ : Y → Y → A) (V : Set (Z × Z)), NearDiag V ∧ IsCoc φ ∧ + (∀ x y s, (τ s (σ x), σ y) ∈ V → φ x y = s) ∧ ∀ t z z', (z, z') ∈ V → (τ t z, τ t z') ∈ V + := by + let _ : UniformSpace Z := uniformSpaceOfCompactR1 + exact cocycle_of_cover_aux τ hτc hτ0 hτa hfree q hq hs hfib hfib' σ hσ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Gluing.lean b/LeanPool/GraphMinor/Surface/Gluing.lean new file mode 100644 index 0000000000..3c1257ec9e --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Gluing.lean @@ -0,0 +1,248 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscsInSurface +public import LeanPool.GraphMinor.Surface.SphereDisc +import Mathlib.Topology.LocalAtTarget + +/-! +# Tools for gluing surfaces + +* `t2Space_quotient_of_isClosed`: the quotient of a compact Hausdorff space by a closed equivalence + relation is Hausdorff. +* `IsInteriorPoint.isManifoldPoint`: a point with a disc around it is a manifold point. +* `isInteriorPoint_iff_of_isOpenEmbedding`, `isManifoldPoint_of_isOpenEmbedding`: being an interior + point or a manifold point is a local property. +* `isInteriorPoint_of_injOn`: a continuous injective map of a compact plane set whose image of an + open set is open gives an interior point. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u v + +/-- The quotient of a compact Hausdorff space by a closed equivalence relation is Hausdorff. -/ +theorem t2Space_quotient_of_isClosed {X : Type u} [TopologicalSpace X] [CompactSpace X] [T2Space X] + (r : Setoid X) (hr : IsClosed {p : X × X | r p.1 p.2}) : T2Space (Quotient r) := by + let q : X → Quotient r := Quotient.mk r + have hqc : Continuous q := continuous_quotient_mk' + have hsat : ∀ A : Set X, IsClosed A → IsClosed (q ⁻¹' (q '' A)) := by + intro A hA + have hK : IsCompact ({p : X × X | r p.1 p.2} ∩ (A ×ˢ univ)) := + (hr.inter (hA.prod isClosed_univ)).isCompact + have : q ⁻¹' (q '' A) = Prod.snd '' ({p : X × X | r p.1 p.2} ∩ (A ×ˢ univ)) := by + ext y + constructor + · rintro ⟨a, ha, he⟩ + exact ⟨(a, y), ⟨Quotient.exact he, ha, mem_univ _⟩, rfl⟩ + · rintro ⟨⟨a, y'⟩, ⟨h1, h2, -⟩, rfl⟩ + exact ⟨a, h2, Quotient.sound h1⟩ + rw [this] + exact (hK.image continuous_snd).isClosed + have hcl : IsClosedMap q := fun A hA => by + have h := hsat A hA + exact (isQuotientMap_quotient_mk').isClosed_preimage.mp h + refine ⟨fun y y' hne => ?_⟩ + obtain ⟨x, rfl⟩ := Quotient.exists_rep y + obtain ⟨x', rfl⟩ := Quotient.exists_rep y' + have hF : IsClosed (q ⁻¹' {Quotient.mk r x}) := by + have := hsat {x} isClosed_singleton + rwa [image_singleton] at this + have hF' : IsClosed (q ⁻¹' {Quotient.mk r x'}) := by + have := hsat {x'} isClosed_singleton + rwa [image_singleton] at this + have hdisj : Disjoint (q ⁻¹' {Quotient.mk r x}) (q ⁻¹' {Quotient.mk r x'}) := by + rw [Set.disjoint_left] + intro a ha ha' + exact hne (ha.symm.trans ha') + obtain ⟨U, U', hU, hU', hsub, hsub', hd⟩ := normal_separation hF hF' hdisj + have hV : IsOpen (q '' Uᶜ)ᶜ := (hcl _ hU.isClosed_compl).isOpen_compl + have hV' : IsOpen (q '' U'ᶜ)ᶜ := (hcl _ hU'.isClosed_compl).isOpen_compl + refine ⟨_, _, hV, hV', ?_, ?_, ?_⟩ + · rintro ⟨a, ha, he⟩ + exact ha (hsub he) + · rintro ⟨a, ha, he⟩ + exact ha (hsub' he) + · rw [Set.disjoint_left] + intro y hy hy' + obtain ⟨a, rfl⟩ := Quotient.exists_rep y + have h1 : a ∈ U := by + by_contra h + exact hy ⟨a, h, rfl⟩ + have h2 : a ∈ U' := by + by_contra h + exact hy' ⟨a, h, rfl⟩ + exact Set.disjoint_left.mp hd h1 h2 + +/-- A point with a disc around it is a manifold point. -/ +theorem IsInteriorPoint.isManifoldPoint {X : Type u} [TopologicalSpace X] {x : X} + (h : IsInteriorPoint x) : IsManifoldPoint x := by + obtain ⟨U, hU, hx, ⟨f⟩⟩ := h + let c : EuclideanPlane := EuclideanSpace.single 0 1 + have hc0 : c 0 = 1 := by simp [c] + let V : Set (EuclideanHalfSpace 2) := {p | dist p.1 c < 1} + have hV : IsOpen V := isOpen_lt (continuous_dist.comp₂ continuous_subtype_val continuous_const) + continuous_const + have hpos : ∀ y : EuclideanPlane, y ∈ OpenUnitDisc → 0 ≤ (y + c) 0 := by + intro y hy + have h1 : ‖y‖ < 1 := mem_ball_zero_iff.mp hy + have h2 : |y 0| ≤ ‖y‖ := by + simpa using PiLp.norm_apply_le y 0 + have h3 := (abs_le.mp h2).1 + simp only [PiLp.add_apply, hc0] + linarith + have hsub : ∀ p : V, p.1.1 - c ∈ OpenUnitDisc := fun p => by + have : dist p.1.1 c < 1 := p.2 + rwa [dist_eq_norm, ← mem_ball_zero_iff] at this + let g : OpenUnitDisc ≃ₜ V := + { toFun := fun y => ⟨⟨y.1 + c, by + exact hpos y.1 y.2⟩, by + change dist (y.1 + c) c < 1 + rw [dist_eq_norm, add_sub_cancel_right] + exact mem_ball_zero_iff.mp y.2⟩ + invFun := fun p => ⟨p.1.1 - c, hsub p⟩ + left_inv := fun y => Subtype.ext (add_sub_cancel_right _ _) + right_inv := fun p => Subtype.ext (Subtype.ext (sub_add_cancel _ _)) + continuous_toFun := by + refine Continuous.subtype_mk (Continuous.subtype_mk ?_ _) _ + exact continuous_subtype_val.add continuous_const + continuous_invFun := by + refine Continuous.subtype_mk ?_ _ + exact (continuous_subtype_val.comp continuous_subtype_val).sub continuous_const } + exact ⟨U, V, hU, hV, hx, ⟨f.trans g⟩⟩ + +/-- Being an interior point is preserved by open embeddings. -/ +theorem isInteriorPoint_of_isOpenEmbedding {X : Type u} {Y : Type v} [TopologicalSpace X] + [TopologicalSpace Y] {e : X → Y} (he : IsOpenEmbedding e) {x : X} (h : IsInteriorPoint x) : + IsInteriorPoint (e x) := by + obtain ⟨U, hU, hx, ⟨f⟩⟩ := h + exact ⟨e '' U, he.isOpenMap _ hU, ⟨x, hx, rfl⟩, + ⟨(he.isEmbedding.homeomorphImage U).symm.trans f⟩⟩ + +/-- Being a manifold point is preserved by open embeddings. -/ +theorem isManifoldPoint_of_isOpenEmbedding {X : Type u} {Y : Type v} [TopologicalSpace X] + [TopologicalSpace Y] {e : X → Y} (he : IsOpenEmbedding e) {x : X} (h : IsManifoldPoint x) : + IsManifoldPoint (e x) := by + obtain ⟨U, V, hU, hV, hx, ⟨f⟩⟩ := h + exact ⟨e '' U, V, he.isOpenMap _ hU, hV, ⟨x, hx, rfl⟩, + ⟨(he.isEmbedding.homeomorphImage U).symm.trans f⟩⟩ + +/-- Manifold points are detected in an open embedding. -/ +theorem isManifoldPoint_iff_of_isOpenEmbedding {X : Type u} {Y : Type v} [TopologicalSpace X] + [TopologicalSpace Y] {e : X → Y} (he : IsOpenEmbedding e) {x : X} : + IsManifoldPoint (e x) ↔ IsManifoldPoint x := by + refine ⟨fun h => ?_, isManifoldPoint_of_isOpenEmbedding he⟩ + obtain ⟨U, V, hU, hV, hx, ⟨f⟩⟩ := h + let m : e ⁻¹' U → EuclideanHalfSpace 2 := fun y => (f ⟨e y.1, y.2⟩).1 + have hm : IsOpenEmbedding m := + (hV.isOpenEmbedding_subtypeVal.comp f.isOpenEmbedding).comp (he.restrictPreimage U) + exact ⟨e ⁻¹' U, range m, hU.preimage he.continuous, hm.isOpen_range, hx, + ⟨hm.isEmbedding.toHomeomorph⟩⟩ + +/-- An interior point has arbitrarily small discs around it. -/ +theorem IsInteriorPoint.exists_subset {Y : Type u} [TopologicalSpace Y] {y : Y} + (h : IsInteriorPoint y) {W : Set Y} (hW : IsOpen W) (hy : y ∈ W) : + ∃ U : Set Y, IsOpen U ∧ y ∈ U ∧ U ⊆ W ∧ Nonempty (U ≃ₜ OpenUnitDisc) := by + obtain ⟨U, hU, hyU, ⟨f⟩⟩ := h + obtain ⟨b⟩ := exists_homeomorph_ball (0 : ℂ) one_pos + have : Nonempty Y := ⟨y⟩ + obtain ⟨h', g, h1, h2, h3, h4, h5, h6⟩ := exists_functions_of_homeomorph (f.trans b.symm) + have hO : IsOpen (ball (0 : ℂ) 1 ∩ g ⁻¹' W) := h2.isOpen_inter_preimage isOpen_ball hW + have hmem : h' y ∈ ball (0 : ℂ) 1 ∩ g ⁻¹' W := ⟨h3 hyU, by + change g (h' y) ∈ W + rwa [h5 hyU]⟩ + obtain ⟨ρ, hρ, hsub⟩ := Metric.isOpen_iff.mp hO _ hmem + have himg : g '' ball (h' y) ρ = U ∩ h' ⁻¹' ball (h' y) ρ := by + ext p + constructor + · rintro ⟨z, hz, rfl⟩ + refine ⟨h4 (hsub hz).1, ?_⟩ + change h' (g z) ∈ ball (h' y) ρ + rwa [h6 (hsub hz).1] + · rintro ⟨h7, h8⟩ + exact ⟨h' p, h8, h5 h7⟩ + have hUo : IsOpen (U ∩ h' ⁻¹' ball (h' y) ρ) := h1.isOpen_inter_preimage hU isOpen_ball + obtain ⟨E, -⟩ := exists_homeomorph_image (f := g) (f' := h') (Δ := ball (h' y) ρ) + (h2.mono fun z hz => (hsub hz).1) (h1.mono (by rw [himg]; exact inter_subset_left)) + (h6.mono fun z hz => (hsub hz).1) + obtain ⟨b'⟩ := exists_homeomorph_ball (h' y) hρ + refine ⟨_, hUo, ⟨hyU, mem_ball_self hρ⟩, ?_, ⟨?_⟩⟩ + · rw [← himg] + rintro _ ⟨z, hz, rfl⟩ + exact (hsub hz).2 + · exact (Homeomorph.setCongr himg.symm).trans (E.symm.trans b') + +/-- Interior points are detected in an open embedding. -/ +theorem isInteriorPoint_iff_of_isOpenEmbedding {X : Type u} {Y : Type v} [TopologicalSpace X] + [TopologicalSpace Y] {e : X → Y} (he : IsOpenEmbedding e) {x : X} : + IsInteriorPoint (e x) ↔ IsInteriorPoint x := by + refine ⟨fun h => ?_, isInteriorPoint_of_isOpenEmbedding he⟩ + obtain ⟨U, hU, hx, hsub, ⟨f⟩⟩ := h.exists_subset he.isOpen_range ⟨x, rfl⟩ + have hr : e '' (e ⁻¹' U) = U := image_preimage_eq_of_subset hsub + exact ⟨e ⁻¹' U, hU.preimage he.continuous, hx, + ⟨(he.isEmbedding.homeomorphImage _).trans ((Homeomorph.setCongr hr).trans f)⟩⟩ + +/-- A continuous injective map on a compact set has a continuous inverse on its image. -/ +theorem exists_inv_of_compactOn {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] + [T2Space Y] [Nonempty X] {K : Set X} (hK : IsCompact K) {f : X → Y} (hf : ContinuousOn f K) + (hinj : InjOn f K) : ∃ f' : Y → X, ContinuousOn f' (f '' K) ∧ LeftInvOn f' f K := by + classical + by_cases hne : K.Nonempty + · have : CompactSpace K := isCompact_iff_compactSpace.mp hK + have : Nonempty K := hne.to_subtype + have hemb : IsEmbedding (fun x : K => f x.1) := + ((continuousOn_iff_continuous_domRestrict.mp hf).isClosedEmbedding + fun x y h => Subtype.ext (hinj x.2 y.2 h)).isEmbedding + obtain ⟨f', hc, hl⟩ := exists_inv_of_isEmbedding hemb + have hr : range (fun x : K => f x.1) = f '' K := by + ext y + constructor + · rintro ⟨x, rfl⟩ + exact ⟨x.1, x.2, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + rw [hr] at hc + exact ⟨fun y => (f' y).1, continuous_subtype_val.comp_continuousOn hc, + fun x hx => congrArg Subtype.val (hl ⟨x, hx⟩)⟩ + · obtain ⟨x₀⟩ := ‹Nonempty X› + refine ⟨fun _ => x₀, continuousOn_const, fun x hx => absurd ⟨x, hx⟩ hne⟩ + +/-- A continuous injective map on a compact set of `ℂ` gives an interior point, as soon as the image +of an open subset is open. This is how pasted charts are checked. -/ +theorem isInteriorPoint_of_injOn {Y : Type v} [TopologicalSpace Y] [T2Space Y] {K V : Set ℂ} + (hK : IsCompact K) {Ψ : ℂ → Y} (hΨ : ContinuousOn Ψ K) (hi : InjOn Ψ K) (hVK : V ⊆ K) + (hV : IsOpen V) (hopen : IsOpen (Ψ '' V)) {c : ℂ} (hc : c ∈ V) : IsInteriorPoint (Ψ c) := by + obtain ⟨f', hf', hl⟩ := exists_inv_of_compactOn hK hΨ hi + obtain ⟨ρ, hρ, hsub⟩ := Metric.isOpen_iff.mp hV c hc + have hf'V : ContinuousOn f' (Ψ '' V) := hf'.mono (image_mono hVK) + have himg : Ψ '' ball c ρ = Ψ '' V ∩ f' ⁻¹' ball c ρ := by + ext p + constructor + · rintro ⟨z, hz, rfl⟩ + refine ⟨⟨z, hsub hz, rfl⟩, ?_⟩ + change f' (Ψ z) ∈ ball c ρ + rwa [hl (hVK (hsub hz))] + · rintro ⟨⟨z, hz, rfl⟩, h⟩ + have h' : f' (Ψ z) ∈ ball c ρ := h + rw [hl (hVK hz)] at h' + exact ⟨z, h', rfl⟩ + have hUo : IsOpen (Ψ '' V ∩ f' ⁻¹' ball c ρ) := hf'V.isOpen_inter_preimage hopen isOpen_ball + have hmc : ContinuousOn Ψ (ball c ρ) := hΨ.mono fun z hz => hVK (hsub hz) + obtain ⟨E, -⟩ := exists_homeomorph_image (f := Ψ) (f' := f') (Δ := ball c ρ) hmc + (hf'.mono (image_mono fun z hz => hVK (hsub hz))) (hl.mono fun z hz => hVK (hsub hz)) + obtain ⟨b⟩ := exists_homeomorph_ball c hρ + have hUo' : IsOpen (Ψ '' ball c ρ) := himg ▸ hUo + exact ⟨_, hUo', ⟨c, mem_ball_self hρ, rfl⟩, ⟨E.symm.trans b⟩⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/HandleModel.lean b/LeanPool/GraphMinor/Surface/HandleModel.lean new file mode 100644 index 0000000000..09a86287be --- /dev/null +++ b/LeanPool/GraphMinor/Surface/HandleModel.lean @@ -0,0 +1,243 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.AddHandle + +/-! +# Adding a handle raises the Euler genus by two + +We put together the pieces of `AddHandle.lean`: the surface `S₁` left by removing two open discs has +a model `Σ(a, b, 2)`, and the cylinder glues its two cuffs together. By the words for gluing two +cuffs in `CutLoop.lean`, the result is `Σ(a + 1, b, 0)` for an untwisted handle and `Σ(a, b + 2, 0)` +for a twisted one. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +universe u + +local notation "𝕀" => unitInterval + +variable {S S' : Type u} [TopologicalSpace S] [TopologicalSpace S'] + +/-- Reconstruct the closed model from the complement of two discs and an attached cylinder. -/ +theorem handle_model_of_surface_pieces [ConnectedSpace S] [T2Space S'] + (hS : IsSurface S) (hb : bd S = ∅) {Λ₁ Λ₂ : Set S} {S₁ S₂ : Set S'} + (hΛ₁ : IsOpenDisc Λ₁) (hΛ₂ : IsOpenDisc Λ₂) (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (hS₁ : IsSurface ↥S₁) (hS₂ : IsSurface ↥S₂) + (hu : S₁ ∪ S₂ = univ) (h1 : S₁ ∩ S₂ = Subtype.val '' bd ↥S₁) + (h2 : S₁ ∩ S₂ = Subtype.val '' bd ↥S₂) + (e₁ : ↥((univ : Set S) \ (Λ₁ ∪ Λ₂)) ≃ₜ S₁) (e₂ : ClosedCylinder ≃ₜ S₂) + {a b : ℕ} (e : S ≃ₜ SurfaceModel a b 0) : + ∃ a' b', Nonempty (S' ≃ₜ SurfaceModel a' b' 0) ∧ 2 * a' + b' = 2 * a + b + 2 := by + have := hS.2.1 + have : Nonempty S' := ⟨(e₂ (cylEnd 1 (by norm_num) 1)).1⟩ + let e₁' : ↥(Λ₁ ∪ Λ₂)ᶜ ≃ₜ S₁ := (Homeomorph.setCongr (compl_eq_univ_sdiff _)).trans e₁ + have hc₁ : CompactSpace ↥S₁ := hS₁.1 + have hX : IsSurface ↥(Λ₁ ∪ Λ₂)ᶜ := isSurface_of_homeo e₁'.symm hS₁ + have hval₂ : IsClosedEmbedding (Subtype.val : ↥S₂ → S') := (isCompact_iff_compactSpace.mpr + hS₂.1).isClosed.isClosedEmbedding_subtypeVal + have hval₁ : IsClosedEmbedding (Subtype.val : ↥S₁ → S') := (isCompact_iff_compactSpace.mpr + hc₁).isClosed.isClosedEmbedding_subtypeVal + have m1 : (1 : ℝ) ∈ Icc (1 : ℝ) 2 := by norm_num + have m2 : (2 : ℝ) ∈ Icc (1 : ℝ) 2 := by norm_num + let f₁ : Circle → S' := fun w => (e₂ (cylEnd 1 m1 w)).1 + let f₂ : Circle → S' := fun w => (e₂ (cylEnd 2 m2 w)).1 + have hf₁ : IsEmbedding f₁ := hval₂.isEmbedding.comp (e₂.isEmbedding.comp + (isEmbedding_cylEnd 1 m1)) + have hf₂ : IsEmbedding f₂ := hval₂.isEmbedding.comp (e₂.isEmbedding.comp + (isEmbedding_cylEnd 2 m2)) + have hbd₂ : Subtype.val '' bd ↥S₂ = range f₁ ∪ range f₂ := by + rw [← image_bd_homeomorph e₂, bd_cylinder, image_union, image_union, ← range_comp, + ← range_comp, ← range_comp, ← range_comp] + rfl + have hs : Subtype.val '' bd ↥S₁ = range f₁ ∪ range f₂ := h1.symm.trans (h2.trans hbd₂) + have hsub₁ : range f₁ ⊆ S₁ := fun x hx => (show x ∈ S₁ ∩ S₂ by rw [h2, hbd₂]; exact .inl hx).1 + have hsub₂ : range f₂ ⊆ S₁ := fun x hx => (show x ∈ S₁ ∩ S₂ by rw [h2, hbd₂]; exact .inr hx).1 + set J₁ : Set ↥S₁ := Subtype.val ⁻¹' range f₁ with hJ₁ + set J₂ : Set ↥S₁ := Subtype.val ⁻¹' range f₂ with hJ₂ + have hvJ₁ : Subtype.val '' J₁ = range f₁ := by + rw [hJ₁, Subtype.image_preimage_coe] + exact inter_eq_right.mpr hsub₁ + have hvJ₂ : Subtype.val '' J₂ = range f₂ := by + rw [hJ₂, Subtype.image_preimage_coe] + exact inter_eq_right.mpr hsub₂ + have hOJ₁ : IsOArc J₁ := isOArc_of_image hval₁.isEmbedding (hvJ₁ ▸ ⟨hf₁.toHomeomorph⟩) + have hOJ₂ : IsOArc J₂ := isOArc_of_image hval₁.isEmbedding (hvJ₂ ▸ ⟨hf₂.toHomeomorph⟩) + have hJu : J₁ ∪ J₂ = bd ↥S₁ := by + rw [hJ₁, hJ₂, ← preimage_union, ← hs, preimage_image_eq _ Subtype.val_injective] + have hrd : Disjoint (range f₁) (range f₂) := by + rw [Set.disjoint_left] + rintro _ ⟨w, rfl⟩ ⟨w', he⟩ + have h3 := e₂.injective (Subtype.ext he) + have h4 : (2 : ℝ) = 1 := congrArg (fun p : ClosedCylinder => p.1.1) h3 + norm_num at h4 + have hJd : Disjoint J₁ J₂ := Set.disjoint_left.mpr fun x h3 h4 => Set.disjoint_left.mp hrd h3 h4 + let P₁ : Set ↥(Λ₁ ∪ Λ₂)ᶜ := e₁'.symm '' J₁ + let P₂ : Set ↥(Λ₁ ∪ Λ₂)ᶜ := e₁'.symm '' J₂ + have hOP₁ : IsOArc P₁ := isOArc_image e₁'.symm.isEmbedding hOJ₁ + have hOP₂ : IsOArc P₂ := isOArc_image e₁'.symm.isEmbedding hOJ₂ + have hPu : P₁ ∪ P₂ = bd ↥(Λ₁ ∪ Λ₂)ᶜ := by + rw [← image_union, hJu, image_bd_homeomorph] + have hPd : Disjoint P₁ P₂ := (disjoint_image_iff e₁'.symm.injective).mpr hJd + have hint : ∀ x : S, IsInteriorPoint x := fun x => by + by_contra h + have h3 : x ∈ bd S := h + rw [hb] at h3 + exact h3 + have hbX : ∀ x : ↥(Λ₁ ∪ Λ₂)ᶜ, x ∈ bd ↥(Λ₁ ∪ Λ₂)ᶜ ↔ x.1 ∈ closure (Λ₁ ∪ Λ₂) := fun x => by + have := bd_subset_iff hint x + rwa [compl_compl] at this + have hne : ∀ {Λ Λ' : Set S}, IsOpenDisc Λ → IsOpenDisc Λ' → Disjoint (closure Λ) (closure Λ') → + (closure Λ \ Λ).Nonempty := by + intro Λ Λ' h3 h4 h5 + by_contra h6 + have h7 : closure Λ ⊆ Λ := by + intro z hz + by_contra h8 + exact h6 ⟨z, hz, h8⟩ + have h8 : IsClosed Λ := isClosed_of_closure_subset h7 + have h9 : Λ = univ := IsClopen.eq_univ ⟨h8, h3.1⟩ (IsOpenDisc.isPathConnected h3).nonempty + obtain ⟨z, hz⟩ := (IsOpenDisc.isPathConnected h4).nonempty + exact Set.disjoint_left.mp h5 (h9 ▸ subset_closure (mem_univ z)) (subset_closure hz) + obtain ⟨a₁, b₁, ⟨e₃⟩, ce⟩ : ∃ a₁ b₁, Nonempty (↥(Λ₁ ∪ Λ₂)ᶜ ≃ₜ SurfaceModel a₁ b₁ 2) ∧ 2 * a₁ + b₁ + = 2 * a + b := by + rcases two_frontiers rfl hd (hne hΛ₁ hΛ₂ hd) (hne hΛ₂ hΛ₁ hd.symm) hbX hΛ₁.1 hΛ₂.1 + hOP₁.isPreconnected hOP₂.isPreconnected hPu with ⟨v1, v2⟩ | ⟨v1, v2⟩ + · exact handle_hole_model hS hb hΛ₁ hΛ₂ hd hX hOP₁ hOP₂ hPu hPd v1 v2 e + · exact handle_hole_model hS hb hΛ₁ hΛ₂ hd hX hOP₂ hOP₁ ((union_comm _ _).trans hPu) hPd.symm + v2 v1 e + let e₄ : ↥S₁ ≃ₜ SurfaceModel a₁ b₁ 2 := e₁'.symm.trans e₃ + have hcJ₁ : J₁ ∈ cuffs ↥S₁ := cuff_of_split hOJ₁.isCompact.isClosed hOJ₂.isCompact.isClosed hJd + hJu hOJ₁.isConnected' + have hcJ₂ : J₂ ∈ cuffs ↥S₁ := cuff_of_split hOJ₂.isCompact.isClosed hOJ₁.isCompact.isClosed + hJd.symm ((union_comm _ _).trans hJu) hOJ₂.isConnected' + have hmem : ∀ p : Circle × 𝕀, (1 + (p.2 : ℝ), p.1) ∈ ClosedCylinder := fun p + => ⟨⟨by linarith [p.2.2.1], by linarith [p.2.2.2]⟩, mem_univ _⟩ + let c : Circle × 𝕀 → S' := fun p => (e₂ ⟨(1 + (p.2 : ℝ), p.1), hmem p⟩).1 + have hcc : Continuous c := by + refine continuous_subtype_val.comp (e₂.continuous.comp (Continuous.subtype_mk ?_ _)) + fun_prop + have hci : Function.Injective c := by + rintro ⟨w, t⟩ ⟨w', t'⟩ he + have h3 := e₂.injective (Subtype.ext he) + have h4 := Prod.ext_iff.mp (congrArg Subtype.val h3) + have h5 : (t : ℝ) = t' := by + have := h4.1 + simp only at this + linarith + exact Prod.ext h4.2 (Subtype.ext h5) + have hc0 : ∀ w, c (w, 0) = f₁ w := fun w => by + have : (⟨(1 + (((w, (0 : 𝕀)) : Circle × 𝕀).2 : ℝ), w), hmem (w, 0)⟩ : ClosedCylinder) + = cylEnd 1 m1 w := Subtype.ext (Prod.ext (by simp [cylEnd]) rfl) + simp only [c, this, f₁] + have hc1 : ∀ w, c (w, 1) = f₂ w := fun w => by + have : (⟨(1 + (((w, (1 : 𝕀)) : Circle × 𝕀).2 : ℝ), w), hmem (w, 1)⟩ : + ClosedCylinder) = cylEnd 2 m2 w := by + apply Subtype.ext + refine Prod.ext ?_ rfl + norm_num [cylEnd] + simp only [c, this, f₂] + let j₁ : Circle → ↥S₁ := fun w => ⟨f₁ w, hsub₁ ⟨w, rfl⟩⟩ + have hj₁ : IsEmbedding j₁ := IsEmbedding.of_comp (hf₁.continuous.subtype_mk _) + continuous_subtype_val hf₁ + have hr₁ : range j₁ = J₁ := by + ext x + constructor + · rintro ⟨w, rfl⟩ + exact ⟨w, rfl⟩ + · rintro ⟨w, he⟩ + exact ⟨w, Subtype.ext he⟩ + let φ₁ : Circle ≃ₜ J₁ := hj₁.toHomeomorph.trans (Homeomorph.setCongr hr₁) + have hφ₁ : ∀ w, (φ₁ w).1.1 = f₁ w := fun w => rfl + have hm' : ∀ (y : ↥S₁) (p : Circle × 𝕀), y.1 = c p → ((p.2 : ℝ) = 0 ∧ y ∈ J₁) ∨ ((p.2 : ℝ) = 1 + ∧ y ∈ J₂) := by + rintro y ⟨w, t⟩ he + have h3 : y.1 ∈ S₁ ∩ S₂ := ⟨y.2, he ▸ (e₂ _).2⟩ + rw [h2, hbd₂] at h3 + rcases h3 with ⟨w', hw⟩ | ⟨w', hw⟩ + · left + refine ⟨?_, ⟨w', hw⟩⟩ + have h4 : f₁ w' = c (w, t) := hw.trans he + have h5 := e₂.injective (Subtype.ext h4) + have h6 : (1 : ℝ) = 1 + t := congrArg (fun p : ClosedCylinder => p.1.1) h5 + simp only + linarith + · right + refine ⟨?_, ⟨w', hw⟩⟩ + have h4 : f₂ w' = c (w, t) := hw.trans he + have h5 := e₂.injective (Subtype.ext h4) + have h6 : (2 : ℝ) = 1 + t := congrArg (fun p : ClosedCylinder => p.1.1) h5 + simp only + linarith + have hcov : ∀ x : S', x ∈ range (Subtype.val : ↥S₁ → S') ∨ x ∈ range c := fun x => by + rcases (hu ▸ mem_univ x : x ∈ S₁ ∪ S₂) with h3 | h3 + · exact .inl ⟨⟨x, h3⟩, rfl⟩ + · right + obtain ⟨⟨⟨r, w⟩, hr, hru⟩, he⟩ := e₂.surjective ⟨x, h3⟩ + have ht : r - 1 ∈ Icc (0 : ℝ) 1 := ⟨by linarith [hr.1], by linarith [hr.2]⟩ + refine ⟨(w, ⟨r - 1, ht⟩), ?_⟩ + have h4 : (⟨(1 + (((w, (⟨r - 1, ht⟩ : 𝕀)) : Circle × 𝕀).2 : ℝ), w), hmem + (w, ⟨r - 1, ht⟩)⟩ : ClosedCylinder) = ⟨(r, w), hr, hru⟩ := + Subtype.ext (Prod.ext (by simp) rfl) + simp only [c, h4, he] + have h1' : Subtype.val '' J₂ = range fun w => c (w, 1) := by + rw [hvJ₂] + ext x + simp only [mem_range, hc1] + obtain ⟨ψ, hψ, b1, b2, hpre⟩ := handle_cut hS₁ continuous_subtype_val Subtype.val_injective hcc + hci φ₁ hcJ₁ hOJ₂.isCompact.isClosed hJd (hJu ▸ subset_rfl) + (fun w => (hφ₁ w).trans (hc0 w).symm) h1' hm' hcov + obtain ⟨i, hi', j, hj, hij, φ, φ', g, hg, hs₁, hs₂⟩ := exists_two_holes e₄ hcJ₁ hcJ₂ (fun h => by + obtain ⟨w, hw⟩ := hOJ₁.isConnected'.1 + exact Set.disjoint_left.mp hJd hw (show w ∈ J₂ by rw [← h]; exact hw)) + obtain ⟨hN, hLf⟩ := erase_erase_facts 2 i j + obtain ⟨σ, g', hp⟩ := loop_two_aux hS₁ hψ hcJ₂ hOJ₁.isCompact.isClosed hOJ₂.isCompact.isClosed + hJd hpre b1 b2 φ φ' hij hi' hj hLf hg hs₁ hs₂ + replace hp := hp.1 + have hn := nf_blkE (a := a₁) (b := b₁) (c := 2) hij hi' hj hN hLf σ + have hlen := length_erase_erase hij hi' hj + cases σ with + | false => + obtain ⟨w, h5, h6⟩ := hn.1 rfl + obtain ⟨e'⟩ := homeo_of_nf hp h5 h6 + rw [hlen] at e' + exact ⟨a₁ + 1, b₁, ⟨e'⟩, by omega⟩ + | true => + obtain ⟨w, h5, h6⟩ := hn.2 rfl + obtain ⟨e'⟩ := homeo_of_nf hp h5 h6 + rw [hlen] at e' + exact ⟨a₁, b₁ + 2, ⟨e'⟩, by omega⟩ + +/-- **Adding a handle, twisted or not, raises `2 a + b` by two.** -/ +theorem handle_model [ConnectedSpace S] [ConnectedSpace S'] (hS : IsSurface S) (hb : bd S = ∅) + (hS' : IsSurface S') (hb' : bd S' = ∅) {Λ₁ Λ₂ : Set S} {S₁ S₂ : Set S'} + (hΛ₁ : IsOpenDisc Λ₁) (hΛ₂ : IsOpenDisc Λ₂) (hd : Disjoint (closure Λ₁) (closure Λ₂)) + (hu : S₁ ∪ S₂ = univ) (h1 : S₁ ∩ S₂ = Subtype.val '' bd ↥S₁) + (h2 : S₁ ∩ S₂ = Subtype.val '' bd ↥S₂) (e₁ : ↥((univ : Set S) \ (Λ₁ ∪ Λ₂)) ≃ₜ S₁) + (e₂ : ClosedCylinder ≃ₜ S₂) {a b : ℕ} (e : S ≃ₜ SurfaceModel a b 0) : + ∃ a' b', Nonempty (S' ≃ₜ SurfaceModel a' b' 0) ∧ 2 * a' + b' = 2 * a + b + 2 := by + have ht2 := hS.2.1 + have hcS := hS.1 + have ht2' := hS'.2.1 + obtain ⟨m⟩ := nonempty_cyl_homeo + have hS₂ : IsSurface ↥S₂ := isSurface_of_homeo (m.trans e₂) (isSurface_model 0 0 2).1 + let e₁' : ↥(Λ₁ ∪ Λ₂)ᶜ ≃ₜ S₁ := (Homeomorph.setCongr (compl_eq_univ_sdiff _)).trans e₁ + have hXc : IsClosed (Λ₁ ∪ Λ₂)ᶜ := (hΛ₁.1.union hΛ₂.1).isClosed_compl + have hcX : CompactSpace ↥(Λ₁ ∪ Λ₂)ᶜ := isCompact_iff_compactSpace.mp hXc.isCompact + have hc₁ : CompactSpace ↥S₁ := e₁'.surjective.compactSpace e₁'.continuous + have hS₁ : IsSurface ↥S₁ := piece_surface hS' hb' hc₁ hS₂ hu h1 h2 + exact handle_model_of_surface_pieces hS hb hΛ₁ hΛ₂ hd hS₁ hS₂ hu h1 h2 e₁ e₂ e + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/HoleDisc.lean b/LeanPool/GraphMinor/Surface/HoleDisc.lean new file mode 100644 index 0000000000..dafd21f8d2 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/HoleDisc.lean @@ -0,0 +1,292 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.SideCut +public import LeanPool.GraphMinor.Surface.Epstein +public import LeanPool.GraphMinor.Surface.Ring +public import LeanPool.GraphMinor.Surface.ModelCriterion +public import LeanPool.GraphMinor.Surface.DiscsInSurface +public import LeanPool.GraphMinor.Surface.Disc + +/-! +# The closure of an open disc + +The operations of adding a crosscap or a handle remove an open disc `Λ` from a surface, and they say +nothing about its closure. Here we show that the closure is a closed disc, if the frontier of `Λ` is +an `O`-arc with points outside the closure of `Λ` arbitrarily near each of its points +(`closure_disc`). + +By `side_manifold`, the closure of `Λ` is a surface with the frontier as its boundary, so by the +classification it has a model with one hole. To see that this model is a disc, we paste a disc on +the hole. The result is the union of a closed disc around the pasted disc and a closed disc in `Λ`, +which exists by the relative disc-bounding result in Graph Minors XI (7.2). The result is a sphere, +so the classification says that the +model is a disc (`model_genus_zero`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +universe u + +theorem cuffs_eq_of_isConnected {Y : Type u} [TopologicalSpace Y] (h : IsConnected + (bd Y)) : cuffs Y = {bd Y} := by + ext C + constructor + · rintro ⟨x, hx, rfl⟩ + exact h.2.connectedComponentIn hx + · rintro rfl + obtain ⟨x, hx⟩ := h.1 + exact ⟨x, hx, h.2.connectedComponentIn hx⟩ + +/-- A model with one hole has one cuff, which is its whole boundary. -/ +theorem model_one_cuff (a b : ℕ) : ∃ C, IsCuff C ∧ bd (SurfaceModel a b 1) = C := by + obtain ⟨ht, f, hf⟩ := presents_ew a b 1 + have := ht + have h1 := ncard_cuffs hf + obtain ⟨C, hC⟩ := Set.ncard_eq_one.mp h1 + refine ⟨C, (show C ∈ cuffs (SurfaceModel a b 1) by rw [hC]; exact mem_singleton C), ?_⟩ + ext x + constructor + · intro hx + have h2 : connectedComponentIn (bd (SurfaceModel a b 1)) x ∈ cuffs (SurfaceModel a b 1) + := ⟨x, hx, rfl⟩ + rw [hC] at h2 + rw [← mem_singleton_iff.mp h2] + exact mem_connectedComponentIn hx + · intro hx + have h2 : C ∈ cuffs (SurfaceModel a b 1) := hC ▸ mem_singleton C + obtain ⟨y, hy, rfl⟩ := h2 + exact connectedComponentIn_subset _ _ hx + +/-- The model without holes and without handles and cross-caps is a sphere. -/ +theorem isSphere_model : IsSphere (SurfaceModel 0 0 0) := by + have hS := (isSurface_model 0 0 1).1 + have ht2 := hS.2.1 + obtain ⟨C, hC, hb⟩ := model_one_cuff 0 0 + obtain ⟨S', tS', ι, Δ, hS', hι, hΔ, hu, hm, hdb, -⟩ := paste_disc.{0} _ C hS hC + obtain ⟨-, ⟨e⟩⟩ := paste_model hS hC hS' hι hΔ hu hm hdb (Homeomorph.refl _) + obtain ⟨d⟩ := nonempty_disc_homeo + have ht2' : T2Space S' := hS'.2.1 + have hcS' : CompactSpace S' := hS'.1 + have hr : IsClosedDisc (range ι) := ⟨d.symm.trans hι.isEmbedding.toHomeomorph⟩ + have hrb : discBd (range ι) = ι '' C := by + have h1 := image_bd_homeomorph hι.isEmbedding.toHomeomorph + rw [discBd, ← h1, image_image, hb] + rfl + obtain ⟨T, hTc, hTi, hTr⟩ := exists_sphere_map hr hΔ (hrb.trans hdb.symm) (hm.trans hrb.symm) + rw [hu] at hTr + let E : OnePoint EuclideanPlane ≃ₜ S' := hTc.homeoOfEquivCompactToT2 (f + := Equiv.ofBijective T ⟨hTi, range_eq_univ.mp hTr⟩) + have e1 : (0 - 1 : ℕ) = 0 := rfl + exact ⟨(E.trans e).symm⟩ + +/-- A model with one hole whose interior is an open disc is a closed disc. -/ +theorem model_genus_zero {p q : ℕ} {Λ : Set (SurfaceModel p q 1)} (hΛ : IsOpenDisc Λ) (hb : Λ = (bd + (SurfaceModel p q 1))ᶜ) : p = 0 ∧ q = 0 := by + have hS := (isSurface_model p q 1).1 + have ht2 := hS.2.1 + obtain ⟨C, hC, hbC⟩ := model_one_cuff p q + obtain ⟨S', tS', ι, Δ, hS', hι, hΔ, hu, hm, hdb, hbS⟩ := paste_disc.{0} _ C hS hC + obtain ⟨-, ⟨e⟩⟩ := paste_model hS hC hS' hι hΔ hu hm hdb (Homeomorph.refl _) + have ht2' : T2Space S' := hS'.2.1 + have hcS' : ConnectedSpace S' := by + have := (isSurface_model p q (1 - 1)).2 + exact e.symm.surjective.connectedSpace e.symm.continuous + have hbd : bd S' = ∅ := by + rw [hbS, ← hbC, sdiff_self, image_empty] + have hint : ∀ x : S', IsInteriorPoint x := fun x => by + by_contra h + have h1 : x ∈ bd S' := h + rw [hbd] at h1 + exact h1 + obtain ⟨Δ', hΔ', hsub, -, hmeet⟩ := exists_ring hS' hΔ (fun x _ => hint x) isClosed_empty + (by simp) + simp only [inter_empty] at hmeet + have hF : discBd Δ' ⊆ ι '' Λ := fun x hx => by + have h1 : x ∉ Δ := fun h => (show x ∈ (∅ : Set S') from hmeet ▸ ⟨hx, h⟩) + rcases (hu ▸ mem_univ x : x ∈ range ι ∪ Δ) with ⟨g, rfl⟩ | h2 + · refine ⟨g, ?_, rfl⟩ + rw [hb, hbC] + exact fun hg => h1 (hm ▸ (⟨g, hg, rfl⟩ : ι g ∈ ι '' C) : ι g ∈ range ι ∩ Δ).2 + · exact absurd h2 h1 + have hZΔ : ι '' Λ = Δᶜ := by + ext x + constructor + · rintro ⟨g, hg, rfl⟩ h2 + have h3 : ι g ∈ ι '' C := hm ▸ ⟨⟨g, rfl⟩, h2⟩ + obtain ⟨g', hg', he⟩ := h3 + rw [hb, hbC] at hg + exact hg (hι.injective he ▸ hg') + · intro h1 + rcases (hu ▸ mem_univ x : x ∈ range ι ∪ Δ) with ⟨g, rfl⟩ | h2 + · refine ⟨g, ?_, rfl⟩ + rw [hb, hbC] + exact fun hg => h1 (hm ▸ (⟨g, hg, rfl⟩ : ι g ∈ ι '' C) : ι g ∈ range ι ∩ Δ).2 + · exact absurd h2 h1 + have hZ : IsOpenDisc (ι '' Λ) := by + refine ⟨hZΔ ▸ hΔ.isClosed.isOpen_compl, ?_⟩ + obtain ⟨-, ⟨φ⟩⟩ := hΛ + exact ⟨φ.trans (hι.isEmbedding.homeomorphImage Λ)⟩ + have hO := hΔ'.isOArc_discBd + have hdis : Disjoint (discBd Δ') (bd S') := by + rw [hbd] + exact disjoint_empty _ + have hnull : IsNullHomotopicOArcIn (ι '' Λ) (discBd Δ') := by + obtain ⟨φ⟩ := hO + refine ⟨φ, (IsOpenDisc.isSimplyConnectedSet hZ).2 _ ?_⟩ + rintro _ ⟨w, rfl⟩ + exact hF (φ w).2 + obtain ⟨D, hDZ, hD, hDb⟩ := epstein_first hS' hO hF hdis hnull + have hsph : IsSphere S' := by + by_contra hn + have h1 := (epstein.{0} S' _ _ hS' hcS' hO hF hdis).2.2 D Δ' hD hΔ' hDb rfl hn + obtain ⟨φ⟩ := hΔ.isOArc_discBd + have h2 : (φ 1).1 ∈ Δ := discBd_subset Δ (φ 1).2 + have h3 : (φ 1).1 ∈ Δᶜ := hZΔ ▸ hDZ (h1 ▸ hsub h2) + exact h3 h2 + obtain ⟨E⟩ := hsph + obtain ⟨E'⟩ := isSphere_model + have h1 := (modelCriterion.2 p q (1 - 1) 0 0 0).mp ⟨(e.symm.trans E).trans E'.symm⟩ + omega + +theorem isOpenEmbedding_inclusion {S : Type u} [TopologicalSpace S] {A B : Set S} (h : A ⊆ B) + (hA : IsOpen A) : IsOpenEmbedding (inclusion h) := + ⟨.inclusion h, by rw [range_inclusion]; exact hA.preimage continuous_subtype_val⟩ + +/-- In a surface without boundary, the boundary points of a subset are the points of the subset in +the closure of its complement. One direction is invariance of domain. -/ +theorem bd_subset_iff {S : Type u} [TopologicalSpace S] (hint : ∀ x : S, IsInteriorPoint x) {X : + Set S} (x : ↥X) : + x ∈ bd ↥X ↔ x.1 ∈ closure Xᶜ := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hint x).isManifoldPoint + constructor + · intro hx + by_contra h + apply hx + have hW : IsOpen (closure Xᶜ)ᶜ := isClosed_closure.isOpen_compl + have hsub : (closure Xᶜ)ᶜ ⊆ X := fun z hz => by + by_contra h' + exact hz (subset_closure h') + have h1 : IsInteriorPoint (⟨x.1, h⟩ : ↥(closure Xᶜ)ᶜ) := (isInteriorPoint_sub hW).mpr (hint _) + exact isInteriorPoint_of_isOpenEmbedding (isOpenEmbedding_inclusion hsub hW) h1 + · intro hx hin + obtain ⟨U, h', g, c, -, h0⟩ := hin.exists_ballChart isOpen_univ (mem_univ _) one_pos + have h1 : IsOpen ((Subtype.val ∘ g) '' Metric.ball 0 1) := + isOpen_image_of_manifold Metric.isOpen_ball (continuous_subtype_val.comp_continuousOn c.gc) + (fun a ha b hb he => by + have := Subtype.ext he + have h2 := congrArg h' this + rwa [c.hg ha, c.hg hb] at h2) fun _ _ => hman _ + have h2 : x.1 ∈ (Subtype.val ∘ g) '' Metric.ball 0 1 := ⟨0, Metric.mem_ball_self one_pos, by + simp [h0]⟩ + obtain ⟨y, hy, hy'⟩ := mem_closure_iff.mp hx _ h1 h2 + obtain ⟨z, -, rfl⟩ := hy + exact hy' (g z).2 + +/-- **The closure of an open disc is a closed disc**, if its frontier is an `O`-arc off the boundary +and the outside of the closure comes near every point of the frontier. The complement of the open +disc is then a surface near the frontier. -/ +theorem closure_disc {S : Type u} [TopologicalSpace S] [ConnectedSpace S] + (hS : IsSurface S) {Λ : Set S} (hΛ : IsOpenDisc Λ) (hbd : Disjoint (closure Λ) (bd S)) + (hF : IsOArc (closure Λ \ Λ)) (hout : ∀ x ∈ closure Λ \ Λ, x ∈ closure (closure Λ)ᶜ) : + IsClosedDisc (closure Λ) ∧ discBd (closure Λ) = closure Λ \ Λ := by + have ht2 := hS.2.1 + have hcS := hS.1 + have hΛo : IsOpen Λ := hΛ.1 + have hsub : Λ ⊆ closure Λ := subset_closure + have hm : closure Λ ∩ Λᶜ = (closure Λ \ Λ) ∪ ∅ := by + rw [union_empty] + rfl + have hside := @side_manifold S _ _ hS (closure Λ) Λᶜ (closure Λ \ Λ) ∅ isClosed_closure + hΛo.isClosed_compl (by + rw [eq_univ_iff_forall] + intro z + by_cases hz : z ∈ Λ + · exact .inl (hsub hz) + · exact .inr hz) hF (hbd.mono_left sdiff_subset) sdiff_subset isClosed_empty hm + (disjoint_empty _) + (fun x hx => by + have : closure Λ \ Λᶜ = Λ := by + ext z + simp only [mem_sdiff, mem_compl_iff, not_not] + exact ⟨fun h => h.2, fun h => ⟨hsub h, h⟩⟩ + rw [this] + exact hx.1) + (fun x hx => by + have : Λᶜ \ closure Λ = (closure Λ)ᶜ := by + ext z + simp only [mem_sdiff, mem_compl_iff] + exact ⟨fun h => h.2, fun h => ⟨fun h' => h (hsub h'), h⟩⟩ + rw [this] + exact hout x hx) + have hopen : IsOpenEmbedding (inclusion hsub) := isOpenEmbedding_inclusion hsub hΛo + have hG : IsSurface ↥(closure Λ) := by + refine ⟨isCompact_iff_compactSpace.mp isClosed_closure.isCompact, inferInstance, fun x => ?_⟩ + by_cases hx : x.1 ∈ Λ + · exact isManifoldPoint_of_isOpenEmbedding hopen (x := ⟨x.1, hx⟩) (isManifoldPoint_sub hΛo + (hS.2.2 x.1)) + · exact (hside ⟨x.2, hx⟩).1 + have hbG : bd ↥(closure Λ) = Subtype.val ⁻¹' (closure Λ \ Λ) := by + ext x + constructor + · intro hx + refine ⟨x.2, fun h => hx ?_⟩ + have h1 : IsInteriorPoint (⟨x.1, h⟩ : Λ) := by + refine (isInteriorPoint_sub hΛo).mpr ?_ + by_contra h2 + exact Set.disjoint_left.mp hbd x.2 h2 + exact isInteriorPoint_of_isOpenEmbedding hopen h1 + · exact fun hx => (hside hx).2 + have hval : IsEmbedding (Subtype.val : ↥(closure Λ) → S) := IsEmbedding.subtypeVal + have himg : Subtype.val '' bd ↥(closure Λ) = closure Λ \ Λ := by + rw [hbG, Subtype.image_preimage_coe] + exact inter_eq_right.mpr sdiff_subset + have hconn : ConnectedSpace ↥(closure Λ) := isConnected_iff_connectedSpace.mp + (IsOpenDisc.isPathConnected hΛ).isConnected.closure + have hbc : IsConnected (bd ↥(closure Λ)) := by + obtain ⟨φ⟩ := id hF + refine ⟨?_, ?_⟩ + · have h1 : (φ 1).1 ∈ Subtype.val '' bd ↥(closure Λ) := by + rw [himg] + exact (φ 1).2 + obtain ⟨y, hy, -⟩ := h1 + exact ⟨y, hy⟩ + · refine hval.isInducing.isPreconnected_image.mp ?_ + rw [himg] + exact hF.isPreconnected + obtain ⟨p, q, c, ⟨e⟩⟩ := classification.{u} _ hG hconn + obtain ⟨ht, f, hf⟩ := presents_ew p q c + have := ht + have hc1 : c = 1 := by + rw [← ncard_cuffs hf, ← ncard_cuffs_congr e, cuffs_eq_of_isConnected hbc, ncard_singleton] + subst hc1 + have hΛ₀ : IsOpenDisc (e '' (Subtype.val ⁻¹' Λ)) := by + refine ⟨e.isOpenMap _ (hΛo.preimage continuous_subtype_val), ?_⟩ + obtain ⟨-, ⟨φ⟩⟩ := hΛ + have h1 : Subtype.val '' (Subtype.val ⁻¹' Λ : Set ↥(closure Λ)) = Λ := by + rw [Subtype.image_preimage_coe] + exact inter_eq_right.mpr hsub + exact ⟨φ.trans ((Homeomorph.setCongr h1.symm).trans ((hval.homeomorphImage _).symm.trans + (e.image _)))⟩ + have hb₀ : e '' (Subtype.val ⁻¹' Λ) = (bd (SurfaceModel p q 1))ᶜ := by + rw [← image_bd_homeomorph e, ← image_compl_eq e.bijective, hbG] + congr 1 + ext x + simp only [mem_preimage, mem_compl_iff, mem_sdiff, not_and, not_not] + exact ⟨fun h _ => h, fun h => h x.2⟩ + obtain ⟨rfl, rfl⟩ := model_genus_zero hΛ₀ hb₀ + obtain ⟨d⟩ := nonempty_disc_homeo + exact ⟨⟨(e.trans d).symm⟩, himg⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/HoleLoop.lean b/LeanPool/GraphMinor/Surface/HoleLoop.lean new file mode 100644 index 0000000000..9dbfacd616 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/HoleLoop.lean @@ -0,0 +1,340 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ModelCriterion +public import LeanPool.GraphMinor.Surface.CircleMove +public import LeanPool.GraphMinor.Surface.WordTrack + +/-! +# Holes of the normal word + +Each cuff of a model surface is a loop that a free side of the normal word `ew a b c` goes around +once (`hole_loop`). The +moves of `WordTrack.lean` bring any hole, or any two holes, to the front of the word and keep this +side +(`exists_one_hole`, `exists_two_holes`). The rest of the word is `rW a b c L`, for the list `L` of +the holes left. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function Metric + +universe uu + +/-- The holes with indices in `L`. -/ +def hlW (k : ℕ) (L : List ℕ) : List Letter := L.flatMap fun m => holB (k + 2 * m, true) + (k + 2 * m + 1, true) + +theorem hlW_nil (k : ℕ) : hlW k [] = [] := rfl + +theorem hlW_cons (k m : ℕ) (L : List ℕ) : hlW k (m :: L) = holB (k + 2 * m, true) + (k + 2 * m + 1, true) ++ hlW k L := by + simp [hlW] + +theorem hlW_append (k : ℕ) (L L' : List ℕ) : hlW k (L ++ L') = hlW k L ++ hlW k L' := by + simp [hlW] + +theorem hlW_labels {k : ℕ} {L : List ℕ} : ∀ l ∈ hlW k L, ∃ m ∈ L, l.1 = k + 2 * m ∨ l.1 + = k + 2 * m + 1 := by + induction L with + | nil => simp [hlW_nil] + | cons m L ih => + intro l hl + rw [hlW_cons] at hl + rcases List.mem_append.mp hl with hl | hl + · refine ⟨m, by simp, ?_⟩ + simp only [holB, linv, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl <;> simp + · obtain ⟨m', h1, h2⟩ := ih l hl + exact ⟨m', List.mem_cons_of_mem _ h1, h2⟩ + +theorem noLab_hlW {k c : ℕ} {L : List ℕ} (h : ∀ m ∈ L, c ≠ k + 2 * m ∧ c ≠ k + 2 * m + 1) : NoLab + (hlW k L) c := by + intro l hl he + obtain ⟨m, h1, h2⟩ := hlW_labels l hl + rcases h2 with h2 | h2 + · exact (h m h1).1 (he.symm.trans h2) + · exact (h m h1).2 (he.symm.trans h2) + +theorem tL_hlW (k : ℕ) {L : List ℕ} (hL : L.Nodup) : TL L.length (hlW k L) := by + induction L with + | nil => exact .nil + | cons m L ih => + rw [hlW_cons] + obtain ⟨h1, h2⟩ := List.nodup_cons.mp hL + refine .cons _ _ (by simp) ?_ (ih h2) + intro l hl + refine noLab_hlW fun m' hm' => ?_ + have hne : m' ≠ m := fun he => h1 (he ▸ hm') + simp only [holB, linv, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl <;> simp only <;> omega + +theorem tW_eq (k c s : ℕ) : tW (k + 2 * s) c = hlW k (List.range' s c) := by + induction c generalizing s with + | zero => rfl + | succ c ih => + rw [List.range'_succ, hlW_cons, ← ih] + simp only [tW] + congr 2 + +/-- The two more letters at the end of the normal word. -/ +def eW (a b c : ℕ) : List Letter := [(2 * a + b + 2 * c, true), (2 * a + b + 2 * c, false)] + +/-- The normal word without the holes outside `L`. -/ +def rW (a b c : ℕ) (L : List ℕ) : List Letter := hW 0 a ++ cW (2 * a) b ++ hlW + (2 * a + b) L ++ eW a b c + +theorem ew_eq_rW (a b c : ℕ) : ew a b c = rW a b c (List.range' 0 c) := by + have := tW_eq (2 * a + b) c 0 + simp only [mul_zero, add_zero] at this + simp [ew, nfW, rW, eW, this] + +/-- The tether of the hole `m`. -/ +def tL (a b m : ℕ) : Letter := (2 * a + b + 2 * m, true) + +/-- The free letter of the hole `m`. -/ +def rL (a b m : ℕ) : Letter := (2 * a + b + 2 * m + 1, true) + +/-- The hole `m`. -/ +def hB (a b m : ℕ) : List Letter := holB (tL a b m) (rL a b m) + +/-- A hole in `L` moves to the front of a word. -/ +theorem trk_hole {a b c m : ℕ} {U : List Letter} {L : List ℕ} (hL : L.Nodup) (hm : m ∈ L) + (hmc : ∀ m' ∈ L, m' < c) + (hU : NoLab U (tL a b m).1) : + Trk.{uu} {k | k ≠ (tL a b m).1} (sW (U ++ rW a b c L)) (sW (hB a b m ++ (U ++ rW a b c + (L.erase m)))) := by + obtain ⟨L₁, L₂, rfl⟩ := List.append_of_mem hm + have hnd := (List.nodup_append.mp hL) + have hm1 : m ∉ L₁ := fun h => hnd.2.2 m h m (by simp) rfl + have hm2 : m ∉ L₂ := (List.nodup_cons.mp hnd.2.1).1 + have he : (L₁ ++ m :: L₂).erase m = L₁ ++ L₂ := by + rw [List.erase_append_right _ hm1, List.erase_cons_head] + rw [he] + have hlab : ∀ {L' : List ℕ}, m ∉ L' → NoLab (hlW (2 * a + b) L') (tL a b m).1 := fun hm' => + noLab_hlW fun m' h => by + have : m' ≠ m := fun e => hm' (e ▸ h) + simp only [tL] + omega + have h1 := hmc m (by simp) + have hH : NoLab (hW 0 a) (tL a b m).1 := fun l hl h => by + have := (hW_labels 0 a l hl).2 + simp only [tL] at h + omega + have hC : NoLab (cW (2 * a) b) (tL a b m).1 := fun l hl h => by + have := (cW_labels (2 * a) b l hl).2 + simp only [tL] at h + omega + have hE : NoLab (eW a b c) (tL a b m).1 := fun l hl h => by + simp only [eW, List.mem_cons, List.not_mem_nil, or_false] at hl + simp only [tL] at h + rcases hl with rfl | rfl <;> simp only at h <;> omega + have hP : NoLab (U ++ hW 0 a ++ cW (2 * a) b ++ hlW (2 * a + b) L₁) (tL a b m).1 := + noLab_append.mpr ⟨noLab_append.mpr ⟨noLab_append.mpr ⟨hU, hH⟩, hC⟩, hlab hm1⟩ + have hQ : NoLab (hlW (2 * a + b) L₂ ++ eW a b c) (tL a b m).1 := noLab_append.mpr ⟨hlab hm2, hE⟩ + have hs : NoLab [rL a b m] (tL a b m).1 := noLab_cons.mpr ⟨by simp [rL, tL], noLab_nil⟩ + have key := trk_hole_front.{uu} (tL a b m) hs hP hQ + have e1 : U ++ rW a b c (L₁ ++ m :: L₂) = + (U ++ hW 0 a ++ cW (2 * a) b ++ hlW (2 * a + b) L₁) ++ (tL a b m :: [rL a b m] ++ [linv + (tL a b m)]) ++ + (hlW (2 * a + b) L₂ ++ eW a b c) := by + simp [rW, hlW_append, hlW_cons, holB, tL, rL, add_assoc] + have e2 : hB a b m ++ (U ++ rW a b c (L₁ ++ L₂)) = + tL a b m :: [rL a b m] ++ linv (tL a b m) :: + ((U ++ hW 0 a ++ cW (2 * a) b ++ hlW (2 * a + b) L₁) ++ (hlW (2 * a + b) L₂ ++ eW a b c)) + := by + simp [rW, hB, holB, hlW_append] + rw [e1, e2] + exact key + +section loop + +variable {Y : Type uu} [TopologicalSpace Y] [T2Space Y] {a b c : ℕ} {f : ℕ × ℂ → Y} + +/-- The free side of the hole `i`, with its parameter. -/ +noncomputable def holeP (a b c : ℕ) (f : ℕ × ℂ → Y) (i : ℕ) (u : ℝ) : Y := + pmap f (per (4 * a + 2 * b + 3 * c + 2) ((4 * a + 2 * b + 3 * i + 1 : ℕ) + u)) + +omit [TopologicalSpace Y] [T2Space Y] in +theorem holeC_eq (a b c : ℕ) (f : ℕ × ℂ → Y) (i : ℕ) : holeC a b c f i = holeP a b c f i '' Icc 0 1 + := rfl + +omit [T2Space Y] in +/-- The free side of a hole goes once around a cuff. -/ +theorem hole_loop (hf : Presents (sW (ew a b c)) f) {i : ℕ} (hi : i < c) : + ContinuousOn (holeP a b c f i) (Icc 0 1) ∧ InjOn (holeP a b c f i) (Ico 0 1) + ∧ holeP a b c f i 0 = holeP a b c f i 1 := by + classical + have hn : 0 < 4 * a + 2 * b + 3 * c + 2 := by omega + set n := 4 * a + 2 * b + 3 * c + 2 with hn' + set p := 4 * a + 2 * b + 3 * i + 1 with hp + have hDsk : ∀ z : ℂ, ‖z‖ = 1 → ((0 : ℕ), z) ∈ Dsk (sW (ew a b c)) := fun z hz => + ⟨(ew_mem_dsk a b c).1, by simp [hz]⟩ + have hget : ∀ δ < 3, (ew a b c)[4 * a + 2 * b + 3 * i + δ]? = some (2 * a + b + 2 * i + δ % 2, + decide (δ < 2)) := by + intro δ hδ + rw [ew_get a b c (by omega), lab_t hi hδ, sgn_t hi hδ] + have hs : ∀ (q : ℕ) (u : ℝ), ((spt (sW (ew a b c)) 0 q u).1, (spt (sW (ew a b c)) 0 q u).2) = + (0, per n (q + u)) := by + intro q u + rw [spt_ew] + refine ⟨continuousOn_hole hf i, ?_, ?_⟩ + · have hfree := freeSide_hole (a := a) (b := b) hi + have hpa : IsPaired (sW (ew a b c)) := isPaired_ew a b c + have hget1 : (sW (ew a b c) 0)[p]? = some (2 * a + b + 2 * i + 1, true) := by + rw [sW_zero] + simpa using hget 1 (by norm_num) + have hkey : ∀ x ∈ Ioo (0 : ℝ) 1, ∀ y ∈ Ico (0 : ℝ) 1, holeP a b c f i x = holeP a b c f i y → x + = y := by + intro x hx y hy he + have h1 := (hf.2.2 _ (hDsk _ (norm_per _ _)) _ (hDsk _ (norm_per _ _))).mp he + have hx' : ((0 : ℕ), per n (p + x)) = spt (sW (ew a b c)) 0 p x := by rw [spt_ew] + have hy' : ((0 : ℕ), per n (p + y)) = spt (sW (ew a b c)) 0 p y := by rw [spt_ew] + rw [hx', hy'] at h1 + rcases PRel.eq_or_stp hpa hget1 hx h1 with h2 | h2 + · rw [← hx', ← hy'] at h2 + have h3 : per n (p + y) = per n (p + x) := (Prod.mk.inj h2).2 + have hb : ∀ z ∈ Ico (0 : ℝ) 1, (p : ℝ) + z ∈ Ico (0 : ℝ) n := fun z hz => by + have hp1 : ((p + 1 : ℕ) : ℝ) ≤ n := by exact_mod_cast (by omega : p + 1 ≤ n) + push_cast at hp1 + have : (0 : ℝ) ≤ p := Nat.cast_nonneg _ + exact ⟨by linarith [hz.1], by linarith [hz.2]⟩ + have := per_injOn hn (hb y hy) (hb x ⟨hx.1.le, hx.2⟩) h3 + linarith + · obtain ⟨j, q, e', h3, h4, -⟩ := stp_of_side hpa hget1 hx h2 + exact absurd (hfree j q _ _ _ hget1 h3) h4 + intro x hx y hy he + rcases eq_or_lt_of_le hx.1 with h0 | h0 + · rcases eq_or_lt_of_le hy.1 with h1 | h1 + · rw [← h0, ← h1] + · exact (hkey y ⟨h1, hy.2⟩ x hx he.symm).symm + · exact hkey x ⟨h0, hx.2⟩ y hy he + · have h1 : Stp (sW (ew a b c)) (spt (sW (ew a b c)) 0 (4 * a + 2 * b + 3 * i + 0) 1) + (spt (sW (ew a b c)) 0 (4 * a + 2 * b + 3 * i + 2) 0) := by + refine stp_iff.mpr ⟨0, 0, 4 * a + 2 * b + 3 * i + 0, 4 * a + 2 * b + 3 * i + 2, + 2 * a + b + 2 * i, true, false, 1, + ?_, ?_, ?_, by simp, rfl, ?_⟩ + · rw [sW_zero] + simpa using hget 0 (by norm_num) + · rw [sW_zero] + simpa using hget 2 (by norm_num) + · simp + · simp [flp] + have h2 := (hf.2.2 _ (h1.mem_Dsk).1 _ (h1.mem_Dsk).2).mpr (.rel _ _ h1) + rw [spt_ew, spt_ew] at h2 + unfold holeP pmap + have e1 : ((4 * a + 2 * b + 3 * i + 1 : ℕ) : ℝ) + 0 = ((4 * a + 2 * b + 3 * i + 0 : ℕ) : ℝ) + 1 + := by + push_cast + ring + have e2 : ((4 * a + 2 * b + 3 * i + 1 : ℕ) : ℝ) + 1 = ((4 * a + 2 * b + 3 * i + 2 : ℕ) : ℝ) + 0 + := by + push_cast + ring + rw [e1, e2] + exact h2 + +omit [T2Space Y] in +theorem sideVal_hole (_hf : Presents (sW (ew a b c)) f) {i : ℕ} (hi : i < c) : + SideVal (sW (rW a b c (List.range' 0 c))) f (rL a b i).1 (holeP a b c f i) := by + rw [← ew_eq_rW] + refine ⟨0, 4 * a + 2 * b + 3 * i + 1, ?_, fun u _ => ?_⟩ + · rw [sW_zero, ew_get a b c (by omega), lab_t (δ := 1) hi (by norm_num), + sgn_t (δ := 1) hi (by norm_num)] + simp [rL] + · rw [sW_zero, ew_length, sdPt_true] + rfl + +end loop + +/-- The list of the holes left after taking out `m`. -/ +theorem nodup_range_erase (c m : ℕ) : ((List.range' 0 c).erase m).Nodup := + (List.nodup_range').erase _ + +/-- A cuff of a model surface is a loop on a free side of a word with this hole in front. -/ +theorem exists_one_hole {Y : Type uu} [TopologicalSpace Y] [T2Space Y] {a b c : ℕ} + (e : Y ≃ₜ SurfaceModel a b c) {C : Set Y} + (hC : C ∈ cuffs Y) : ∃ i < c, ∃ (φ : Circle ≃ₜ C) (g : ℕ × ℂ → Y), + Presents (sW (hB a b i ++ rW a b c ((List.range' 0 c).erase i))) g ∧ + SideVal (sW (hB a b i ++ rW a b c ((List.range' 0 c).erase i))) g (rL a b i).1 fun u => (φ + (ee u)).1 := by + obtain ⟨-, f₀, hf₀⟩ := presents_ew a b c + have hf : Presents (sW (ew a b c)) (e.symm ∘ f₀) := presents_comp hf₀ e.symm + rw [cuffs_eq_holeC hf] at hC + obtain ⟨i, hi, rfl⟩ := hC + have hi' : i < c := hi + obtain ⟨h1, h2, h3⟩ := hole_loop hf hi' + obtain ⟨φ, hφ⟩ := exists_circle_param h1 h2 h3 + have hL : (List.range' 0 c).Nodup := List.nodup_range' + have hm : i ∈ List.range' 0 c := by simpa using hi' + have hmc : ∀ m' ∈ List.range' 0 c, m' < c := fun m' h => by simpa using h + have ht := trk_hole.{uu} (a := a) (b := b) (c := c) (U := []) hL hm hmc noLab_nil + have hs := sideVal_hole hf hi' + simp only [List.nil_append] at ht + rw [ew_eq_rW] at hf + obtain ⟨g, h4, h5⟩ := ht.sideVal hf + refine ⟨i, hi', φ, g, h4, ?_⟩ + obtain ⟨i₁, p, h6, h7⟩ := h5 _ (by simp [rL, tL]) _ hs + exact ⟨i₁, p, h6, fun u hu => (h7 u hu).trans (hφ u hu).symm⟩ + +/-- Two cuffs of a model surface are loops on free sides of a word with these holes in front. -/ +theorem exists_two_holes {Y : Type uu} [TopologicalSpace Y] [T2Space Y] {a b c : ℕ} + (e : Y ≃ₜ SurfaceModel a b c) {C C' : Set Y} + (hC : C ∈ cuffs Y) (hC' : C' ∈ cuffs Y) (hne : C ≠ C') : ∃ i < c, ∃ j < c, i ≠ j ∧ ∃ + (φ : Circle ≃ₜ C) (φ' : Circle ≃ₜ C') (g : ℕ × ℂ → Y), + Presents (sW (hB a b j ++ (hB a b i ++ rW a b c (((List.range' 0 c).erase i).erase j)))) g ∧ + SideVal (sW (hB a b j ++ (hB a b i ++ rW a b c (((List.range' 0 c).erase i).erase j)))) g + (rL a b i).1 (fun u => (φ (ee u)).1) ∧ + SideVal (sW (hB a b j ++ (hB a b i ++ rW a b c (((List.range' 0 c).erase i).erase j)))) g + (rL a b j).1 (fun u => (φ' (ee u)).1) := by + obtain ⟨-, f₀, hf₀⟩ := presents_ew a b c + have hf : Presents (sW (ew a b c)) (e.symm ∘ f₀) := presents_comp hf₀ e.symm + rw [cuffs_eq_holeC hf] at hC hC' + obtain ⟨i, hi, rfl⟩ := hC + obtain ⟨j, hj, rfl⟩ := hC' + have hi' : i < c := hi + have hj' : j < c := hj + have hij : i ≠ j := fun h => hne (by rw [h]) + obtain ⟨h1, h2, h3⟩ := hole_loop hf hi' + obtain ⟨φ, hφ⟩ := exists_circle_param h1 h2 h3 + obtain ⟨h1', h2', h3'⟩ := hole_loop hf hj' + obtain ⟨φ', hφ'⟩ := exists_circle_param h1' h2' h3' + have hL : (List.range' 0 c).Nodup := List.nodup_range' + have hm : i ∈ List.range' 0 c := by simpa using hi' + have hmc : ∀ m' ∈ List.range' 0 c, m' < c := fun m' h => by simpa using h + have ht := trk_hole.{uu} (a := a) (b := b) (c := c) (U := []) hL hm hmc noLab_nil + have hs := sideVal_hole hf hi' + have hs' := sideVal_hole hf hj' + simp only [List.nil_append] at ht + rw [ew_eq_rW] at hf + obtain ⟨g₁, h4, h5⟩ := ht.sideVal hf + have ht2 := trk_hole.{uu} (a := a) (b := b) (c := c) (U := hB a b i) (L := + (List.range' 0 c).erase i) (m := j) + (nodup_range_erase c i) ((List.mem_erase_of_ne (Ne.symm hij)).mpr (by simpa using hj')) + (fun m' h => hmc m' (List.mem_of_mem_erase h)) (by + refine fun l hl he => ?_ + simp only [hB, holB, tL, rL, linv, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl <;> simp only [tL] at he <;> omega) + obtain ⟨g, h6, h7⟩ := ht2.sideVal h4 + refine ⟨i, hi', j, hj', hij, φ, φ', g, h6, ?_, ?_⟩ + · obtain ⟨i₁, p, h8, h9⟩ := h7 _ (by + simp only [rL, tL, mem_ofPred_eq] + omega) _ (h5 _ (by simp [rL, tL]) _ hs) + exact ⟨i₁, p, h8, fun u hu => (h9 u hu).trans (hφ u hu).symm⟩ + · have hkey := h5 _ (by + simp only [rL, tL, mem_ofPred_eq] + omega) _ hs' + obtain ⟨i₁, p, h8, h9⟩ := h7 _ (by simp [rL, tL]) _ hkey + exact ⟨i₁, p, h8, fun u hu => (h9 u hu).trans (hφ' u hu).symm⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/InvarianceOfDomain.lean b/LeanPool/GraphMinor/Surface/InvarianceOfDomain.lean new file mode 100644 index 0000000000..643ce43f30 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/InvarianceOfDomain.lean @@ -0,0 +1,364 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Jordan +import Mathlib.Analysis.Normed.Module.Connected +import Mathlib.Analysis.Normed.Module.Ball.Homeomorph + +/-! +# Invariance of domain in the plane and the boundary of a closed disc + +This file proves two things. + +* `isOpen_image_of_injOn`: an injective continuous map from an open subset of the plane to the + plane has open image. The route is the classical one from the Jordan curve theorem. Take a + closed round disc `B` in the domain, and let `J` be the image of its boundary. An embedded closed + disc does not separate the plane (`preconnected_compl_image_closedBall`), since every function + without zeros on it has a logarithm. So the complement of `g(B)` lies in the unbounded component + of the complement of `J`, and the image of the open disc must be the whole bounded component. +* `disc_boundary : DiscBoundaryStatement`: the manifold boundary of a closed disc is the image of + the unit circle. + +The file also shows that `bd` is invariant under homeomorphisms (`Homeomorph.image_bd`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Complex + +local notation "𝕀" => unitInterval + +universe u v + +/-- A continuous function without zeros on a closed disc has a logarithm: contract to the centre. -/ +theorem hasLogOn_closedBall {c : ℂ} {r : ℝ} (hr : 0 ≤ r) {f : ℂ → ℂ} + (hf : ContinuousOn f (closedBall c r)) (hne : ∀ z ∈ closedBall c r, f z ≠ 0) : + HasLogOn (closedBall c r) f := by + have hc : c ∈ closedBall c r := mem_closedBall_self hr + have hmem : ∀ (t : 𝕀), ∀ z ∈ closedBall c r, c + (t : ℝ) • (z - c) ∈ closedBall c r := by + intro t z hz + have := (convex_closedBall c r).add_smul_sub_mem hc hz t.2 + exact this + have h := hasLogOn_of_homotopy (K := closedBall c r) + (fun t z => f (c + (t : ℝ) • (z - c)) / f c) ?_ (fun z _ => by simp [hne c hc]) + (fun t z hz => div_ne_zero (hne _ (hmem t z hz)) (hne c hc)) + · refine (h.mul (hasLogOn_const (hne c hc))).congr fun z _ => ?_ + simp [hne c hc] + · refine ContinuousOn.div_const (hf.comp (by fun_prop) ?_) _ + rintro ⟨t, z⟩ ⟨-, hz⟩ + exact hmem t z hz + +/-- The image of a closed disc under an injective continuous map does not separate the plane. -/ +theorem component_eq_of_image_closedBall {c : ℂ} {r : ℝ} (hr : 0 ≤ r) {g : ℂ → ℂ} + (hg : ContinuousOn g (closedBall c r)) (hinj : InjOn g (closedBall c r)) {a b : ℂ} + (ha : a ∉ g '' closedBall c r) (hb : b ∉ g '' closedBall c r) : + connectedComponentIn (g '' closedBall c r)ᶜ a = connectedComponentIn (g '' closedBall c r)ᶜ b + := by + have hcomp : IsCompact (g '' closedBall c r) := (isCompact_closedBall c r).image_of_continuousOn + hg + refine component_eq_of_hasLogOn hcomp ha hb ?_ + have hsne : ∀ z ∈ closedBall c r, g z - a ≠ 0 ∧ g z - b ≠ 0 := fun z hz => + ⟨fun h => ha ⟨z, hz, sub_eq_zero.mp h⟩, fun h => hb ⟨z, hz, sub_eq_zero.mp h⟩⟩ + refine hasLogOn_image (isCompact_closedBall c r) hg hinj (hasLogOn_closedBall hr ?_ ?_) + · exact (hg.sub continuousOn_const).div (hg.sub continuousOn_const) fun z hz => (hsne z hz).2 + · exact fun z hz => div_ne_zero (hsne z hz).1 (hsne z hz).2 + +/-- **Invariance of domain in the plane.** An injective continuous map from an open subset of the +plane to the plane has open image. -/ +theorem isOpen_image_of_injOn {U : Set ℂ} (hU : IsOpen U) {g : ℂ → ℂ} (hg : ContinuousOn g U) + (hinj : InjOn g U) : IsOpen (g '' U) := by + rw [isOpen_iff_mem_nhds] + rintro _ ⟨p, hp, rfl⟩ + obtain ⟨r, hr, hball⟩ := Metric.nhds_basis_closedBall.mem_iff.mp (hU.mem_nhds hp) + have hgB : ContinuousOn g (closedBall p r) := hg.mono hball + have hiB : InjOn g (closedBall p r) := hinj.mono hball + have hK : IsCompact (g '' closedBall p r) := (isCompact_closedBall p r).image_of_continuousOn hgB + -- The image `J` of the circle, as an `O`-arc. + let c : Circle → ℂ := fun w => p + r * (w : ℂ) + have hcm : ∀ w, c w ∈ sphere p r := fun w => by + simp [c, abs_of_pos hr] + have hcB : ∀ w, c w ∈ closedBall p r := fun w => sphere_subset_closedBall (hcm w) + have hcsurj : ∀ z ∈ sphere p r, ∃ w, c w = z := by + intro z hz + have hz' : ‖z - p‖ = r := by simpa [dist_eq_norm] using hz + have hne : ((r : ℝ) : ℂ) ≠ 0 := by exact_mod_cast hr.ne' + have hn : ‖(z - p) / r‖ = 1 := by + rw [norm_div, hz', norm_real, Real.norm_eq_abs, abs_of_pos hr, div_self hr.ne'] + refine ⟨⟨(z - p) / r, mem_sphere_zero_iff_norm.mpr hn⟩, ?_⟩ + change p + r * ((z - p) / r) = z + field_simp + ring + have hccont : Continuous c := by fun_prop + have hcinj : Function.Injective c := by + intro x y hxy + have hne : ((r : ℝ) : ℂ) ≠ 0 := by exact_mod_cast hr.ne' + have : (x : ℂ) = y := mul_left_cancel₀ hne (add_left_cancel hxy) + exact Circle.ext this + let γ : Circle → ℂ := fun w => g (c w) + have hγc : Continuous γ := hgB.comp_continuous hccont hcB + have hγi : Function.Injective γ := fun x y hxy => hcinj (hiB (hcB x) (hcB y) hxy) + have hemb := hγc.isClosedEmbedding hγi + obtain ⟨A, B, ⟨hne, hcomp, hAf, hBf⟩, hAb, hBb⟩ := + jordan_complex (F := range γ) hemb.isEmbedding.toHomeomorph + have hJc : IsClosed (range γ) := hemb.isClosed_range + have hset : (univ : Set ℂ) \ range γ = (range γ)ᶜ := (compl_eq_univ_sdiff _).symm + rw [hset] at hcomp + have hAmem : A ∈ componentsIn (range γ)ᶜ := by rw [hcomp]; simp + have hBmem : B ∈ componentsIn (range γ)ᶜ := by rw [hcomp]; simp + obtain ⟨xa, hxa, rfl⟩ := hAmem + obtain ⟨xb, hxb, rfl⟩ := hBmem + set A := connectedComponentIn (range γ)ᶜ xa with hAdef + set B := connectedComponentIn (range γ)ᶜ xb with hBdef + have hdisj : Disjoint A B := Set.disjoint_left.mpr fun y h1 h2 => hne (by + rw [hAdef, hBdef, connectedComponentIn_eq h1, connectedComponentIn_eq h2]) + have hcover : ∀ y, y ∉ range γ → y ∈ A ∨ y ∈ B := by + intro y hy + have h1 : connectedComponentIn (range γ)ᶜ y ∈ ({A, B} : Set (Set ℂ)) := + hcomp ▸ mem_image_of_mem _ hy + rcases h1 with h1 | h1 + · exact Or.inl (h1 ▸ mem_connectedComponentIn hy) + · exact Or.inr (h1 ▸ mem_connectedComponentIn hy) + have hJsub : range γ ⊆ g '' closedBall p r := by + rintro _ ⟨w, rfl⟩ + exact ⟨_, hcB w, rfl⟩ + -- The complement `W` of the image of the closed disc lies in `B`. + set W := (g '' closedBall p r)ᶜ with hW + have hWsub : W ⊆ (range γ)ᶜ := compl_subset_compl.mpr hJsub + have hWpre : IsPreconnected W := by + by_cases hemp : W.Nonempty + · obtain ⟨y, hy⟩ := hemp + have : W = connectedComponentIn W y := by + refine Subset.antisymm (fun z hz => ?_) (connectedComponentIn_subset _ _) + rw [hW, component_eq_of_image_closedBall hr.le hgB hiB hy hz] + exact mem_connectedComponentIn hz + rw [this] + exact isPreconnected_connectedComponentIn + · rw [not_nonempty_iff_eq_empty] at hemp + rw [hemp] + exact isPreconnected_empty + have hWbdd : ¬ Bornology.IsBounded W := fun h => by + have : Bornology.IsBounded (univ : Set ℂ) := by + rw [← union_compl_self (g '' closedBall p r)] + exact hK.isBounded.union h + exact NormedSpace.unbounded_univ ℝ ℂ this + have hAo : IsOpen A := isOpen_component hJc xa + have hBo : IsOpen B := isOpen_component hJc xb + have hWB : W ⊆ B := by + have hsub : W ⊆ A ∪ B := fun y hy => hcover y (hWsub hy) + by_cases hcase : (W ∩ A).Nonempty + · have := hWpre.subset_left_of_subset_union hAo hBo hdisj hsub hcase + exact absurd (hAb.subset this) hWbdd + · have hWne : W.Nonempty := by + by_contra hemp + rw [not_nonempty_iff_eq_empty] at hemp + exact hWbdd (hemp ▸ Bornology.isBounded_empty) + obtain ⟨y, hy⟩ := hWne + refine hWpre.subset_right_of_subset_union hAo hBo hdisj hsub ⟨y, hy, ?_⟩ + exact (hcover y (hWsub hy)).resolve_left fun h => hcase ⟨y, hy, h⟩ + -- The image of the open disc is `A`. + have hball2 : ∀ z ∈ ball p r, g z ∉ range γ := by + rintro z hz ⟨w, hw⟩ + have h1 := hiB (hcB w) (ball_subset_closedBall hz) hw + have h2 := hcm w + rw [h1, mem_sphere] at h2 + rw [mem_ball] at hz + exact hz.ne h2 + have hgball : IsPreconnected (g '' ball p r) := + (convex_ball p r).isPreconnected.image _ (hgB.mono ball_subset_closedBall) + have hgsub : g '' ball p r ⊆ A ∪ B := by + rintro _ ⟨z, hz, rfl⟩ + exact hcover _ (hball2 z hz) + have hcl : ∀ z ∈ closedBall p r, z ∈ ball p r ∨ z ∈ sphere p r := by + intro z hz + rcases lt_or_eq_of_le (mem_closedBall.mp hz) with h | h + · exact Or.inl h + · exact Or.inr h + have hAsub : A ⊆ g '' ball p r := by + intro y hy + have hyJ : y ∉ range γ := connectedComponentIn_subset _ _ hy + have hyW : y ∉ W := fun h => Set.disjoint_left.mp hdisj hy (hWB h) + obtain ⟨z, hz, rfl⟩ : y ∈ g '' closedBall p r := by simpa [hW] using hyW + rcases hcl z hz with h | h + · exact ⟨z, h, rfl⟩ + · obtain ⟨w, rfl⟩ := hcsurj z h + exact absurd ⟨w, rfl⟩ hyJ + have hgA : g '' ball p r ⊆ A := by + have hnA : A.Nonempty := ⟨xa, mem_connectedComponentIn hxa⟩ + obtain ⟨y, hy⟩ := hnA + obtain ⟨z, hz, rfl⟩ := hAsub hy + exact hgball.subset_left_of_subset_union hAo hBo hdisj hgsub ⟨_, ⟨z, hz, rfl⟩, hy⟩ + have hAeq : A = g '' ball p r := Subset.antisymm hAsub hgA + refine Filter.mem_of_superset (hAo.mem_nhds (hgA ⟨p, mem_ball_self hr, rfl⟩)) ?_ + rw [hAeq] + exact image_mono (ball_subset_closedBall.trans hball) + +/-- `bd` is invariant under homeomorphisms. -/ +theorem isInteriorPoint_homeomorph_iff {X : Type u} {Y : Type v} [TopologicalSpace X] + [TopologicalSpace Y] (e : X ≃ₜ Y) (x : X) : IsInteriorPoint (e x) ↔ IsInteriorPoint x := by + have key : ∀ {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] (e : X ≃ₜ Y) + (x : X), IsInteriorPoint x → IsInteriorPoint (e x) := by + intro X Y _ _ e x ⟨U, hU, hx, ⟨f⟩⟩ + exact ⟨e '' U, e.isOpenMap _ hU, mem_image_of_mem _ hx, ⟨(e.image U).symm.trans f⟩⟩ + refine ⟨fun h => ?_, key e x⟩ + have h' : IsInteriorPoint (e.symm (e x)) := by + obtain ⟨U, hU, hx, ⟨f⟩⟩ := h + exact ⟨e.symm '' U, e.symm.isOpenMap _ hU, mem_image_of_mem _ hx, ⟨(e.symm.image U).symm.trans + f⟩⟩ + simpa using h' + +/-- `bd` is invariant under homeomorphisms. -/ +theorem image_bd_homeomorph {X : Type u} {Y : Type v} [TopologicalSpace X] + [TopologicalSpace Y] (e : X ≃ₜ Y) : e '' bd X = bd Y := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ h + exact hx ((isInteriorPoint_homeomorph_iff e x).mp h) + · intro hy + refine ⟨e.symm y, fun h => hy ?_, by simp⟩ + have := (isInteriorPoint_homeomorph_iff e (e.symm y)).mpr h + simpa using this + +/-- A homeomorphism carries boundary points to boundary points. -/ +theorem mem_bd_homeomorph_iff {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] + (e : X ≃ₜ Y) (x : X) : e x ∈ bd Y ↔ x ∈ bd X := by + have h := image_bd_homeomorph e + constructor + · intro hx + obtain ⟨w, hw, hwx⟩ := h.symm ▸ hx + exact e.injective hwx ▸ hw + · intro hx + exact h ▸ mem_image_of_mem e hx + +/-- The points of the closed disc in the open disc form a copy of the open disc. -/ +noncomputable def openPartHomeomorph : + (Subtype.val ⁻¹' OpenUnitDisc : Set ClosedUnitDisc) ≃ₜ OpenUnitDisc where + toFun y := ⟨y.1.1, y.2⟩ + invFun z := ⟨⟨z.1, ball_subset_closedBall z.2⟩, z.2⟩ + left_inv _ := rfl + right_inv _ := rfl + continuous_toFun := by fun_prop + continuous_invFun := by + refine Continuous.subtype_mk (Continuous.subtype_mk ?_ _) _ + exact continuous_subtype_val + +/-- The manifold boundary of the closed unit disc is the unit circle. Points of the open disc are +interior points. A point of the circle has no neighbourhood homeomorphic to an open disc, since by +invariance of domain the neighbourhood would be open in the plane. -/ +theorem bd_closedUnitDisc : bd (ClosedUnitDisc) = {x | x.1 ∈ UnitCircle} := by + classical + ext x + have hxn : ‖x.1‖ ≤ 1 := mem_closedBall_zero_iff.mp x.2 + constructor + · intro hx + change x.1 ∈ UnitCircle + rw [UnitCircle, mem_sphere_zero_iff_norm] + by_contra hne + apply hx + have hlt : ‖x.1‖ < 1 := lt_of_le_of_ne hxn hne + exact ⟨Subtype.val ⁻¹' OpenUnitDisc, isOpen_ball.preimage continuous_subtype_val, + mem_ball_zero_iff.mpr hlt, ⟨openPartHomeomorph⟩⟩ + · intro hx hint + have hx1 : ‖x.1‖ = 1 := mem_sphere_zero_iff_norm.mp hx + obtain ⟨U, hU, hxU, ⟨f⟩⟩ := hint + have hmem : ∀ z : ℂ, ‖z‖ < 1 → complexPlane z ∈ OpenUnitDisc := fun z hz => by + refine mem_ball_zero_iff.mpr ?_ + rwa [LinearIsometryEquiv.norm_map] + let g : ℂ → ℂ := fun z => + if h : ‖z‖ < 1 then complexPlane.symm (f.symm ⟨complexPlane z, hmem z h⟩).1.1 else 0 + have hgb : ∀ z (h : z ∈ ball (0 : ℂ) 1), g z = + complexPlane.symm (f.symm ⟨complexPlane z, hmem z (by simpa using h)⟩).1.1 := by + intro z h + have h' : ‖z‖ < 1 := by simpa using h + simp only [g, h', dite_true] + have hgc : ContinuousOn g (ball (0 : ℂ) 1) := by + rw [continuousOn_iff_continuous_domRestrict] + have : (ball (0 : ℂ) 1).domRestrict g = fun z : ball (0 : ℂ) 1 => + complexPlane.symm (f.symm ⟨complexPlane z.1, hmem z.1 (mem_ball_zero_iff.mp z.2)⟩).1.1 + := by + ext z + exact hgb z.1 z.2 + rw [this] + have h2 : Continuous fun z : ball (0 : ℂ) 1 => + (⟨complexPlane z.1, hmem z.1 (mem_ball_zero_iff.mp z.2)⟩ : OpenUnitDisc) := by + refine Continuous.subtype_mk ?_ _ + exact complexPlane.continuous.comp continuous_subtype_val + exact complexPlane.symm.continuous.comp + (continuous_subtype_val.comp (continuous_subtype_val.comp (f.symm.continuous.comp h2))) + have hgi : InjOn g (ball (0 : ℂ) 1) := by + intro a ha b hb hab + rw [hgb a ha, hgb b hb] at hab + have h1 := complexPlane.symm.injective hab + have h2 := f.symm.injective (Subtype.ext (Subtype.ext h1)) + exact complexPlane.injective (congr_arg Subtype.val h2) + have hopen := isOpen_image_of_injOn isOpen_ball hgc hgi + have hy : complexPlane.symm x.1 ∈ g '' ball (0 : ℂ) 1 := by + have hn : ‖complexPlane.symm (f ⟨x, hxU⟩).1‖ < 1 := by + rw [LinearIsometryEquiv.norm_map] + exact mem_ball_zero_iff.mp (f ⟨x, hxU⟩).2 + refine ⟨complexPlane.symm (f ⟨x, hxU⟩).1, by simpa using hn, ?_⟩ + rw [hgb _ (by simpa using hn)] + simp + have hsmall : ∀ w ∈ g '' ball (0 : ℂ) 1, ‖w‖ ≤ 1 := by + rintro _ ⟨z, hz, rfl⟩ + rw [hgb z hz, LinearIsometryEquiv.norm_map] + exact mem_closedBall_zero_iff.mp (f.symm ⟨complexPlane z, hmem z (by simpa using hz)⟩).1.2 + obtain ⟨ε, hε, hball⟩ := Metric.isOpen_iff.mp hopen _ hy + set y := complexPlane.symm x.1 with hydef + have hyn : ‖y‖ = 1 := by rw [hydef, LinearIsometryEquiv.norm_map, hx1] + have h1 : y + ((ε / 2 : ℝ) : ℂ) * y ∈ ball y ε := by + rw [mem_ball, dist_eq_norm, add_sub_cancel_left, norm_mul, hyn, mul_one, norm_real, + Real.norm_eq_abs, abs_of_pos (by positivity)] + linarith + have h2 := hsmall _ (hball h1) + have h3 : y + ((ε / 2 : ℝ) : ℂ) * y = ((1 + ε / 2 : ℝ) : ℂ) * y := by push_cast; ring + rw [h3, norm_mul, hyn, mul_one, norm_real, Real.norm_eq_abs, abs_of_pos (by positivity)] at h2 + linarith + +/-- The boundary of a closed disc is the image of the unit circle. -/ +theorem disc_boundary : DiscBoundaryStatement.{u} := by + intro S _ Δ φ + have h := image_bd_homeomorph φ + rw [bd_closedUnitDisc] at h + rw [discBd, ← h, image_image] + +/-- The boundary of a closed disc is an `O`-arc. -/ +theorem IsClosedDisc.isOArc_discBd {S : Type u} [TopologicalSpace S] {Δ : Set S} + (hΔ : IsClosedDisc Δ) : IsOArc (discBd Δ) := by + obtain ⟨φ⟩ := hΔ + have hmem : ∀ w : Circle, complexPlane (w : ℂ) ∈ ClosedUnitDisc := fun w => by + refine mem_closedBall_zero_iff.mpr ?_ + rw [LinearIsometryEquiv.norm_map, Circle.norm_coe] + let c : Circle → S := fun w => (φ ⟨complexPlane w, hmem w⟩).1 + have hc : IsEmbedding c := by + have h1 : IsEmbedding fun w : Circle => (⟨complexPlane w, hmem w⟩ : ClosedUnitDisc) := by + refine IsEmbedding.of_comp ?_ continuous_subtype_val ?_ + · exact Continuous.subtype_mk (complexPlane.continuous.comp continuous_subtype_val) _ + · exact complexPlane.isometry.isEmbedding.comp IsEmbedding.subtypeVal + exact IsEmbedding.subtypeVal.comp (φ.isEmbedding.comp h1) + have hrange : range c = discBd Δ := by + rw [disc_boundary Δ φ] + ext y + constructor + · rintro ⟨w, rfl⟩ + refine ⟨⟨complexPlane w, hmem w⟩, ?_, rfl⟩ + change complexPlane (w : ℂ) ∈ UnitCircle + rw [UnitCircle, mem_sphere_zero_iff_norm, LinearIsometryEquiv.norm_map, Circle.norm_coe] + · rintro ⟨x, hx, rfl⟩ + have hn : ‖complexPlane.symm x.1‖ = 1 := by + rw [LinearIsometryEquiv.norm_map] + exact mem_sphere_zero_iff_norm.mp hx + refine ⟨⟨complexPlane.symm x.1, mem_sphere_zero_iff_norm.mpr hn⟩, ?_⟩ + change (φ ⟨complexPlane (complexPlane.symm x.1), _⟩).1 = _ + simp + exact ⟨hc.toHomeomorph.trans (Homeomorph.setCongr hrange)⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/JoinedCollar.lean b/LeanPool/GraphMinor/Surface/JoinedCollar.lean new file mode 100644 index 0000000000..5a4efa44cb --- /dev/null +++ b/LeanPool/GraphMinor/Surface/JoinedCollar.lean @@ -0,0 +1,208 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collar + +/-! +# Joining two collars + +Three nested closed discs in a surface must share one radius coordinate. Keep the collar of the +inner disc on radii at most two, and on radii from two to three use the collar of the middle disc +after subtracting one from the radius. +The change of radius uses a denominator bounded below by two, so it gives a continuous map of the +plane, also at zero. The collars agree along their common circle. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Metric + +/-- The outer-annulus change of radius used to join two collars. -/ +noncomputable def collarOuterStep (z : ℂ) : ℂ := + ((max 2 ‖z‖ - 1) / max 2 ‖z‖ : ℝ) • z + +theorem continuous_collarOuterStep : Continuous collarOuterStep := by + have hf : Continuous (fun z : ℂ => (max 2 ‖z‖ - 1) / max 2 ‖z‖) := by + apply Continuous.div + · fun_prop + · fun_prop + · intro z + have h : (0 : ℝ) < max 2 ‖z‖ := lt_of_lt_of_le (by norm_num) (le_max_left _ _) + exact h.ne' + exact hf.smul continuous_id + +theorem collarOuterStep_norm {z : ℂ} (hz : 2 ≤ ‖z‖) : + ‖collarOuterStep z‖ = ‖z‖ - 1 := by + have hn : 0 < ‖z‖ := lt_of_lt_of_le (by norm_num) hz + rw [collarOuterStep, max_eq_right hz, norm_smul, Real.norm_eq_abs, + abs_of_pos (div_pos (by linarith) hn), div_mul_cancel₀ _ hn.ne'] + +theorem collarOuterStep_injOn : InjOn collarOuterStep {z : ℂ | 2 ≤ ‖z‖} := by + intro z hz w hw heq + change 2 ≤ ‖z‖ at hz + change 2 ≤ ‖w‖ at hw + have hnorm : ‖z‖ = ‖w‖ := by + have h := congrArg norm heq + rw [collarOuterStep_norm hz, collarOuterStep_norm hw] at h + linarith + have hscale : (‖z‖ - 1) / ‖z‖ ≠ 0 := by + apply ne_of_gt + exact div_pos (by linarith [hz]) (by linarith [hz]) + simp only [collarOuterStep, max_eq_right hz, ← hnorm] at heq + exact (smul_right_injective _ hscale) heq + +theorem collarOuterStep_two {z : ℂ} (hz : ‖z‖ = 2) : + collarOuterStep z = (1 / 2 : ℝ) • z := by + simp only [collarOuterStep, hz, max_self] + norm_num + +/-- The inverse radius change on the outer annulus. -/ +theorem exists_collarOuterStep_preimage {w : ℂ} (hw : 1 ≤ ‖w‖) : + ∃ z : ℂ, ‖z‖ = ‖w‖ + 1 ∧ collarOuterStep z = w := by + have hn : 0 < ‖w‖ := lt_of_lt_of_le zero_lt_one hw + let z : ℂ := ((‖w‖ + 1) / ‖w‖ : ℝ) • w + have hz : ‖z‖ = ‖w‖ + 1 := by + rw [show z = ((‖w‖ + 1) / ‖w‖ : ℝ) • w from rfl, norm_smul, Real.norm_eq_abs, + abs_of_pos (div_pos (by linarith) hn), div_mul_cancel₀ _ hn.ne'] + refine ⟨z, hz, ?_⟩ + have hz2 : 2 ≤ ‖z‖ := by rw [hz]; linarith + rw [collarOuterStep, max_eq_right hz2, hz] + dsimp only [z] + rw [smul_smul] + have heq : (‖w‖ + 1 - 1) / (‖w‖ + 1) * ((‖w‖ + 1) / ‖w‖) = 1 := by + field_simp + ring + rw [heq, one_smul] + +/-- Join two compatible collars into coordinates in which the three +nested discs have radii one, two, and three. -/ +theorem exists_joined_collar_coordinates + {S : Type*} [TopologicalSpace S] {A B E : Set S} + (c₁ c₂ : ℂ → S) + (hc₁ : ContinuousOn c₁ (closedBall 0 2)) (hi₁ : InjOn c₁ (closedBall 0 2)) + (hc₂ : ContinuousOn c₂ (closedBall 0 2)) (hi₂ : InjOn c₂ (closedBall 0 2)) + (hA : c₁ '' closedBall 0 1 = A) (hB₁ : c₁ '' closedBall 0 2 = B) + (hB₂ : c₂ '' closedBall 0 1 = B) (hE : c₂ '' closedBall 0 2 = E) + (hbd : c₂ '' sphere 0 2 = discBd E) + (hcompat : ∀ z : ℂ, ‖z‖ = 2 → c₁ z = c₂ (collarOuterStep z)) : + ∃ c : ℂ → S, ContinuousOn c (closedBall 0 3) ∧ InjOn c (closedBall 0 3) ∧ + c '' closedBall 0 1 = A ∧ c '' closedBall 0 2 = B ∧ + c '' closedBall 0 3 = E ∧ c '' sphere 0 3 = discBd E := by + classical + let c : ℂ → S := fun z => if ‖z‖ ≤ 2 then c₁ z else c₂ (collarOuterStep z) + have hcinner : ∀ z, ‖z‖ ≤ 2 → c z = c₁ z := fun z hz => ite_eq_left hz + have hcouter : ∀ z, 2 ≤ ‖z‖ → c z = c₂ (collarOuterStep z) := by + intro z hz + rcases eq_or_lt_of_le hz with heq | hlt + · rw [hcinner z heq.ge] + exact hcompat z heq.symm + · exact ite_eq_right (not_le.mpr hlt) + have hJ : ∀ z, 2 ≤ ‖z‖ → ‖z‖ ≤ 3 → collarOuterStep z ∈ closedBall 0 2 := by + intro z hlo hhi + rw [mem_closedBall_zero_iff, collarOuterStep_norm hlo] + linarith + have hBc₂ : ∀ w ∈ closedBall (0 : ℂ) 2, c₂ w ∈ B → ‖w‖ ≤ 1 := by + intro w hw hBw + obtain ⟨v, hv, heq⟩ := hB₂.symm ▸ hBw + have hvw := hi₂ (closedBall_subset_closedBall (by norm_num) hv) hw heq + exact hvw ▸ mem_closedBall_zero_iff.mp hv + have hccont : ContinuousOn c (closedBall 0 3) := by + let R : Set ℂ := closedBall 0 3 ∩ {z | 2 ≤ ‖z‖} + have hR : IsClosed R := isClosed_closedBall.inter (isClosed_le continuous_const continuous_norm) + have hcontinner : ContinuousOn c (closedBall 0 2) := + hc₁.congr (fun z hz => hcinner z (mem_closedBall_zero_iff.mp hz)) + have hcontouter : ContinuousOn c R := by + have hmap : MapsTo collarOuterStep R (closedBall 0 2) := fun z hz => + hJ z hz.2 (mem_closedBall_zero_iff.mp hz.1) + exact (hc₂.comp continuous_collarOuterStep.continuousOn hmap).congr + (fun z hz => hcouter z hz.2) + have hcover : closedBall (0 : ℂ) 2 ∪ R = closedBall 0 3 := by + ext z + constructor + · rintro (hz | hz) + · exact closedBall_subset_closedBall (by norm_num) hz + · exact hz.1 + · intro hz + by_cases hz2 : ‖z‖ ≤ 2 + · exact Or.inl (mem_closedBall_zero_iff.mpr hz2) + · exact Or.inr ⟨hz, (le_of_not_ge hz2)⟩ + exact hcover ▸ hcontinner.union_of_isClosed hcontouter isClosed_closedBall hR + have hcB : c '' closedBall 0 2 = B := by + rw [← hB₁] + exact image_congr (fun z hz => hcinner z (mem_closedBall_zero_iff.mp hz)) + have hcA : c '' closedBall 0 1 = A := by + rw [← hA] + exact image_congr (fun z hz => hcinner z ((mem_closedBall_zero_iff.mp hz).trans (by norm_num))) + have hcEsub : c '' closedBall 0 3 ⊆ E := by + rintro _ ⟨z, hz, rfl⟩ + by_cases hz2 : ‖z‖ ≤ 2 + · rw [hcinner z hz2] + have hzB : c₁ z ∈ B := hB₁ ▸ mem_image_of_mem c₁ (mem_closedBall_zero_iff.mpr hz2) + obtain ⟨w, hw, heq⟩ := hB₂.symm ▸ hzB + rw [← heq] + exact hE ▸ mem_image_of_mem c₂ (closedBall_subset_closedBall (by norm_num) hw) + · rw [hcouter z (le_of_not_ge hz2)] + exact hE ▸ mem_image_of_mem c₂ (hJ z (le_of_not_ge hz2) (mem_closedBall_zero_iff.mp hz)) + have hcEsurj : E ⊆ c '' closedBall 0 3 := by + intro x hx + obtain ⟨w, hw, rfl⟩ := hE.symm ▸ hx + by_cases hw1 : ‖w‖ ≤ 1 + · have hwB : c₂ w ∈ B := hB₂ ▸ mem_image_of_mem c₂ (mem_closedBall_zero_iff.mpr hw1) + obtain ⟨z, hz, heq⟩ := hcB.symm ▸ hwB + exact ⟨z, closedBall_subset_closedBall (by norm_num) hz, heq⟩ + · obtain ⟨z, hzn, hzJ⟩ := exists_collarOuterStep_preimage (le_of_not_ge hw1) + have hz2 : 2 ≤ ‖z‖ := by rw [hzn]; linarith [le_of_not_ge hw1] + refine ⟨z, mem_closedBall_zero_iff.mpr ?_, ?_⟩ + · rw [hzn] + linarith [mem_closedBall_zero_iff.mp hw] + · rw [hcouter z hz2, hzJ] + have hci : InjOn c (closedBall 0 3) := by + intro z hz w hw heq + by_cases hz2 : ‖z‖ ≤ 2 + · by_cases hw2 : ‖w‖ ≤ 2 + · rw [hcinner z hz2, hcinner w hw2] at heq + exact hi₁ (mem_closedBall_zero_iff.mpr hz2) (mem_closedBall_zero_iff.mpr hw2) heq + · have hwlo : 2 ≤ ‖w‖ := le_of_not_ge hw2 + have hzB : c z ∈ B := hcB ▸ mem_image_of_mem c (mem_closedBall_zero_iff.mpr hz2) + rw [heq, hcouter w hwlo] at hzB + have hn := hBc₂ _ (hJ w hwlo (mem_closedBall_zero_iff.mp hw)) hzB + rw [collarOuterStep_norm hwlo] at hn + exact False.elim (hw2 (by linarith)) + · have hzlo : 2 ≤ ‖z‖ := le_of_not_ge hz2 + by_cases hw2 : ‖w‖ ≤ 2 + · have hwB : c w ∈ B := hcB ▸ mem_image_of_mem c (mem_closedBall_zero_iff.mpr hw2) + rw [← heq, hcouter z hzlo] at hwB + have hn := hBc₂ _ (hJ z hzlo (mem_closedBall_zero_iff.mp hz)) hwB + rw [collarOuterStep_norm hzlo] at hn + exact False.elim (hz2 (by linarith)) + · have hwlo : 2 ≤ ‖w‖ := le_of_not_ge hw2 + rw [hcouter z hzlo, hcouter w hwlo] at heq + exact collarOuterStep_injOn hzlo hwlo + (hi₂ (hJ z hzlo (mem_closedBall_zero_iff.mp hz)) + (hJ w hwlo (mem_closedBall_zero_iff.mp hw)) heq) + refine ⟨c, hccont, hci, hcA, hcB, hcEsub.antisymm hcEsurj, ?_⟩ + rw [← hbd] + apply Set.Subset.antisymm + · rintro _ ⟨z, hz, rfl⟩ + have hzn : ‖z‖ = 3 := mem_sphere_zero_iff_norm.mp hz + have hz2 : 2 ≤ ‖z‖ := by rw [hzn]; norm_num + refine ⟨collarOuterStep z, ?_, (hcouter z hz2).symm⟩ + rw [mem_sphere_zero_iff_norm, collarOuterStep_norm hz2, hzn] + norm_num + · rintro _ ⟨w, hw, rfl⟩ + have hwn : ‖w‖ = 2 := mem_sphere_zero_iff_norm.mp hw + obtain ⟨z, hzn, hzJ⟩ := exists_collarOuterStep_preimage (by rw [hwn]; norm_num) + have hz3 : ‖z‖ = 3 := by rw [hzn, hwn]; norm_num + refine ⟨z, mem_sphere_zero_iff_norm.mpr hz3, ?_⟩ + rw [hcouter z (by rw [hz3]; norm_num), hzJ] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Jordan.lean b/LeanPool/GraphMinor/Surface/Jordan.lean new file mode 100644 index 0000000000..f76489717d --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Jordan.lean @@ -0,0 +1,324 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.JordanPlane +import Mathlib.Topology.Compactification.OnePoint.Sphere +import Mathlib.Analysis.InnerProductSpace.Projection.Reflection +import Mathlib.Analysis.Complex.Isometry +import Mathlib.Analysis.Normed.Module.Connected + +/-! +# The Jordan curve theorem in the plane and in the sphere + +This file proves `jordan_curve_theorem : JordanCurveStatement`. + +The plane case carries `jordan_complex` over the isometry between `ℂ` and `EuclideanPlane`. For the +sphere, we first find a point off the `O`-arc (the sphere is not a circle, `exists_notMem_oArc`). +The sphere is homogeneous (`exists_homeomorph_onePoint`, by a reflection of $\mathbb{R}^3$), so we +may take that point to be the point at infinity of the one-point compactification. Then the arc lies +in the plane, and the sphere components are the bounded component and the unbounded component with +the point at infinity added. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Complex + +universe u v + +/-- A homeomorphism carries a Jordan split to a Jordan split. -/ +theorem IsJordanSplit.image {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] + {F A B : Set X} (h : IsJordanSplit F A B) (e : X ≃ₜ Y) : + IsJordanSplit (e '' F) (e '' A) (e '' B) := by + obtain ⟨hne, hcomp, hA, hB⟩ := h + refine ⟨fun heq => hne (e.injective.image_injective heq), ?_, ?_, ?_⟩ + · have hset : e '' (univ \ F) = univ \ (e '' F) := by + rw [image_sdiff e.injective, image_univ, e.surjective.range_eq] + have hcomps : componentsIn (univ \ (e '' F)) = (fun C => e '' C) '' componentsIn (univ \ F) + := by + ext C + simp only [componentsIn, mem_image, exists_exists_and_eq_and] + constructor + · rintro ⟨y, hy, rfl⟩ + rw [← hset] at hy + obtain ⟨x, hx, rfl⟩ := hy + exact ⟨x, hx, by rw [e.image_connectedComponentIn hx, hset]⟩ + · rintro ⟨x, hx, rfl⟩ + refine ⟨e x, hset ▸ mem_image_of_mem _ hx, ?_⟩ + rw [e.image_connectedComponentIn hx, hset] + rw [hcomps, hcomp, image_pair] + · rw [← e.image_frontier, hA] + · rw [← e.image_frontier, hB] + +/-- A criterion for a Jordan split: two disjoint open connected sets that fill the complement of +`F`, with closures `A ∪ F` and `B ∪ F`. -/ +theorem isJordanSplit_of_parts {X : Type u} [TopologicalSpace X] {F A B : Set X} + (hA : IsOpen A) (hB : IsOpen B) (hAc : IsPreconnected A) (hBc : IsPreconnected B) + (hAn : A.Nonempty) (hBn : B.Nonempty) (hdisj : Disjoint A B) (hun : A ∪ B = Fᶜ) + (hclA : closure A = A ∪ F) (hclB : closure B = B ∪ F) : IsJordanSplit F A B := by + have hdF : ∀ {C : Set X}, C ⊆ A ∪ B → Disjoint C F := fun hC => + Set.disjoint_left.mpr fun x hx hxF => (hun ▸ hC hx) hxF + refine ⟨fun h => ?_, ?_, ?_, ?_⟩ + · obtain ⟨x, hx⟩ := hAn + exact Set.disjoint_left.mp hdisj hx (h ▸ hx) + · rw [← compl_eq_univ_sdiff] + exact componentsIn_eq_pair hA hB hAc hBc hAn hBn hdisj hun.symm + · rw [hA.frontier_eq, hclA, + union_sdiff_cancel_left (disjoint_iff_inter_eq_empty.mp (hdF subset_union_left)).subset] + · rw [hB.frontier_eq, hclB, + union_sdiff_cancel_left (disjoint_iff_inter_eq_empty.mp (hdF subset_union_right)).subset] + +/-- The isometry between `ℂ` and the plane. -/ +noncomputable def complexPlane : ℂ ≃ₗᵢ[ℝ] EuclideanPlane := + Complex.orthonormalBasisOneI.repr + +/-- The Jordan curve theorem in the plane. -/ +theorem jordan_plane {F : Set EuclideanPlane} (hF : IsOArc F) : + ∃ A B, IsJordanSplit F A B ∧ Bornology.IsBounded A ∧ ¬ Bornology.IsBounded B := by + obtain ⟨φ⟩ := hF + let e : ℂ ≃ₜ EuclideanPlane := complexPlane.toHomeomorph + obtain ⟨A, B, hsplit, hA, hB⟩ := jordan_complex (φ.trans (e.symm.image F)) + have himg : e '' (e.symm '' F) = F := by + rw [← image_comp] + simp + refine ⟨e '' A, e '' B, himg ▸ hsplit.image e, ?_, ?_⟩ + · exact complexPlane.lipschitzWith.isBounded_image hA + · intro h + apply hB + have := complexPlane.symm.lipschitzWith.isBounded_image h + have heq : complexPlane.symm '' (e '' B) = B := by + have hid : (complexPlane.symm ∘ e) = id := funext fun x => complexPlane.symm_apply_apply x + rw [← image_comp, hid, image_id] + rwa [heq] at this + +/-- The sphere is homogeneous: every point can be moved to the point at infinity, by a reflection of +$\mathbb{R}^3$. -/ +theorem exists_homeomorph_onePoint (x : OnePoint EuclideanPlane) : + ∃ h : OnePoint EuclideanPlane ≃ₜ OnePoint EuclideanPlane, h x = OnePoint.infty := by + let T := onePointEquivSphereOfFinrankEq (ι := Fin 3) (V := EuclideanPlane) (by simp) + let v : EuclideanSpace ℝ (Fin 3) := (T x).1 + let w : EuclideanSpace ℝ (Fin 3) := (T OnePoint.infty).1 + have hv : ‖v‖ = 1 := mem_sphere_zero_iff_norm.mp (T x).2 + have hw : ‖w‖ = 1 := mem_sphere_zero_iff_norm.mp (T OnePoint.infty).2 + let R := Submodule.reflection (ℝ ∙ (v - w))ᗮ + let r : sphere (0 : EuclideanSpace ℝ (Fin 3)) 1 ≃ₜ sphere (0 : EuclideanSpace ℝ (Fin 3)) 1 := + R.toHomeomorph.subtype (fun y => by simp [R]) + refine ⟨T.trans (r.trans T.symm), ?_⟩ + have hr : r (T x) = T OnePoint.infty := by + apply Subtype.ext + exact Submodule.reflection_sub (by rw [hv, hw]) + simp [hr] + +/-- A continuous real function on the plane is not injective: it takes the same value at two +antipodal points. -/ +theorem not_injective_real {f : ℂ → ℝ} (hf : Continuous f) : ¬ Function.Injective f := by + intro hinj + let g : ℝ → ℝ := fun t => f (exp (t * I)) - f (-exp (t * I)) + have hg : Continuous g := by fun_prop + have hanti : g Real.pi = - g 0 := by + simp only [g] + simp [exp_pi_mul_I] + obtain ⟨t, ht⟩ : ∃ t, g t = 0 := by + have h1 : ∃ a, g a ≤ 0 := by + rcases le_total (g 0) 0 with h | h + · exact ⟨0, h⟩ + · exact ⟨Real.pi, by linarith⟩ + have h2 : ∃ b, 0 ≤ g b := by + rcases le_total (g 0) 0 with h | h + · exact ⟨Real.pi, by linarith⟩ + · exact ⟨0, h⟩ + exact mem_range_of_exists_le_of_exists_ge hg h1 h2 + have h3 := hinj (sub_eq_zero.mp ht) + have h4 : exp (t * I) ≠ 0 := exp_ne_zero _ + have h5 : (2 : ℂ) * exp (t * I) = 0 := by linear_combination h3 + simp [h4] at h5 + +/-- An `O`-arc is not the whole sphere. Otherwise the plane would embed in a circle, and a logarithm +of the embedding would be an injective continuous real function on the plane. -/ +theorem exists_notMem_oArc {F : Set (OnePoint EuclideanPlane)} (hF : IsOArc F) : ∃ x, x ∉ F := by + by_contra hcon + push Not at hcon + obtain ⟨φ⟩ := hF + let j : ℂ → Circle := fun z => φ.symm ⟨((complexPlane z : EuclideanPlane) : OnePoint _), hcon _⟩ + have hj : Continuous j := by + apply φ.symm.continuous.comp + apply Continuous.subtype_mk + exact OnePoint.continuous_coe.comp complexPlane.continuous + obtain ⟨g, hg, hfg⟩ := hasLogOn_univ_of_ne_zero (f := fun z => ((j z : Circle) : ℂ)) + (by fun_prop) (fun z => Circle.coe_ne_zero _) + have hgc : Continuous g := continuousOn_univ.mp hg + refine not_injective_real (f := fun z => (g z).im) (by fun_prop) fun x y hxy => ?_ + have hre : ∀ z, (g z).re = 0 := by + intro z + have h1 : ‖((j z : Circle) : ℂ)‖ = 1 := Circle.norm_coe _ + have h2 : ((j z : Circle) : ℂ) = exp (g z) := hfg z (mem_univ _) + rw [h2, norm_exp] at h1 + simpa using h1 + have hgg : g x = g y := Complex.ext (by rw [hre, hre]) hxy + have hjj : j x = j y := by + apply Circle.ext + have h2 : ((j x : Circle) : ℂ) = exp (g x) := hfg x (mem_univ _) + have h3 : ((j y : Circle) : ℂ) = exp (g y) := hfg y (mem_univ _) + rw [h2, h3, hgg] + have h1 := φ.symm.injective hjj + have h2 := OnePoint.coe_injective (congr_arg Subtype.val h1) + exact complexPlane.injective h2 + +/-- An `O`-arc in the plane gives a Jordan split in the sphere: the point at infinity joins the +unbounded component. -/ +theorem jordan_onePoint_of_plane {F : Set EuclideanPlane} (hF : IsOArc F) : + ∃ A B, IsJordanSplit (((↑) : EuclideanPlane → OnePoint EuclideanPlane) '' F) A B := by + obtain ⟨A, B, ⟨hne, hcomp, hA, hB⟩, hAb, hBb⟩ := jordan_plane hF + obtain ⟨φ⟩ := id hF + have hFc : IsCompact F := by + have : CompactSpace F := φ.compactSpace + exact isCompact_iff_compactSpace.mpr this + have hFcl : IsClosed F := hFc.isClosed + have hU : IsOpen (univ \ F) := by + rw [← compl_eq_univ_sdiff] + exact hFcl.isOpen_compl + have hmem : A ∈ componentsIn (univ \ F) ∧ B ∈ componentsIn (univ \ F) := by + rw [hcomp]; simp + have hparts : ∀ C ∈ componentsIn (univ \ F), IsOpen C ∧ IsPreconnected C ∧ C.Nonempty ∧ Cᶜ ⊇ F + := by + rintro _ ⟨x, hx, rfl⟩ + refine ⟨hU.connectedComponentIn, isPreconnected_connectedComponentIn, + ⟨x, mem_connectedComponentIn hx⟩, fun y hy h => ?_⟩ + exact (connectedComponentIn_subset _ _ h).2 hy + obtain ⟨hAo, hAp, hAn, hAF⟩ := hparts A hmem.1 + obtain ⟨hBo, hBp, hBn, hBF⟩ := hparts B hmem.2 + have hdisj : Disjoint A B := by + refine Set.disjoint_left.mpr fun y hyA hyB => hne ?_ + obtain ⟨x, _, rfl⟩ := hmem.1 + obtain ⟨z, _, rfl⟩ := hmem.2 + rw [connectedComponentIn_eq hyA, connectedComponentIn_eq hyB] + have hcover : ∀ x, x ∉ F → x ∈ A ∨ x ∈ B := by + intro x hx + have hx' : x ∈ univ \ F := ⟨mem_univ _, hx⟩ + have h1 : connectedComponentIn (univ \ F) x ∈ ({A, B} : Set (Set EuclideanPlane)) := + hcomp ▸ mem_image_of_mem _ hx' + rcases h1 with h1 | h1 + · exact Or.inl (h1 ▸ mem_connectedComponentIn hx') + · exact Or.inr (h1 ▸ mem_connectedComponentIn hx') + have hclA : closure A = A ∪ F := by rw [closure_eq_self_union_frontier, hA] + have hclB : closure B = B ∪ F := by rw [closure_eq_self_union_frontier, hB] + have hcompl : (A ∪ F)ᶜ = B := by + ext x + constructor + · intro hx + have hx1 : x ∉ A := fun h => hx (Or.inl h) + have hx2 : x ∉ F := fun h => hx (Or.inr h) + exact (hcover x hx2).resolve_left hx1 + · rintro hx (h | h) + · exact Set.disjoint_left.mp hdisj h hx + · exact hBF h hx + have hAFc : IsCompact (A ∪ F) := Metric.isCompact_of_isClosed_isBounded + (hclA ▸ isClosed_closure) (hAb.union hFc.isBounded) + let c : EuclideanPlane → OnePoint EuclideanPlane := (↑) + have hcc : Continuous c := OnePoint.continuous_coe + have hinf : (OnePoint.infty : OnePoint EuclideanPlane) ∈ closure (c '' B) := by + refine mem_closure_iff.mpr fun U hUo hUi => ?_ + obtain ⟨h1, h2⟩ := (OnePoint.isOpen_iff_of_mem hUi).mp hUo + have : ∃ b ∈ B, b ∉ (c ⁻¹' U)ᶜ := by + by_contra hcon + push Not at hcon + exact hBb (h2.isBounded.subset hcon) + obtain ⟨b, hb, hbU⟩ := this + exact ⟨c b, not_not.mp hbU, mem_image_of_mem _ hb⟩ + have hBopen : (c '' B ∪ {OnePoint.infty}) = (c '' (A ∪ F))ᶜ := by + rw [OnePoint.compl_image_coe, hcompl] + refine ⟨c '' A, c '' B ∪ {OnePoint.infty}, isJordanSplit_of_parts (OnePoint.isOpen_image_coe.mpr + hAo) + ?_ (hAp.image _ hcc.continuousOn) ?_ (hAn.image _) ⟨OnePoint.infty, Or.inr rfl⟩ ?_ ?_ ?_ ?_⟩ + · rw [hBopen] + exact OnePoint.isOpen_compl_image_coe.mpr ⟨hAFc.isClosed, hAFc⟩ + · refine (hBp.image _ hcc.continuousOn).subset_closure subset_union_left + (union_subset subset_closure ?_) + rintro _ rfl + exact hinf + · rw [hBopen] + exact Set.disjoint_left.mpr fun x hx hx' => hx' (image_mono subset_union_left hx) + · have h1 : Fᶜ = A ∪ B := by + ext x + constructor + · exact hcover x + · rintro (h | h) hx + · exact hAF hx h + · exact hBF hx h + have h2 : (c '' F)ᶜ = c '' Fᶜ ∪ {OnePoint.infty} := OnePoint.compl_image_coe F + rw [h2, h1, image_union, union_assoc] + · refine Subset.antisymm ?_ ?_ + · rw [← image_union] + exact closure_minimal (image_mono subset_union_left) + (OnePoint.isClosed_image_coe.mpr ⟨hAFc.isClosed, hAFc⟩) + · rw [← image_union, ← hclA] + exact image_closure_subset_closure_image hcc + · have h1 : Aᶜ = B ∪ F := by + ext x + constructor + · intro hx + by_cases hxF : x ∈ F + · exact Or.inr hxF + · exact Or.inl ((hcover x hxF).resolve_left hx) + · rintro (h | h) hx + · exact Set.disjoint_left.mp hdisj hx h + · exact hAF h hx + have h2 : c '' B ∪ {OnePoint.infty} ∪ c '' F = (c '' A)ᶜ := by + have h3 : (c '' A)ᶜ = c '' Aᶜ ∪ {OnePoint.infty} := OnePoint.compl_image_coe A + rw [h3, h1, image_union, union_right_comm] + refine Subset.antisymm ?_ ?_ + · refine closure_minimal subset_union_left ?_ + rw [h2] + exact (OnePoint.isOpen_image_coe.mpr hAo).isClosed_compl + · refine union_subset subset_closure ?_ + have h4 : c '' F ⊆ closure (c '' B) := by + refine (image_mono ?_).trans (image_closure_subset_closure_image hcc) + rw [hclB] + exact subset_union_right + exact h4.trans (closure_mono subset_union_left) + +/-- The Jordan curve theorem in the sphere. -/ +theorem jordan_sphere {S : Type u} [TopologicalSpace S] (hS : IsSphere S) {F : Set S} + (hF : IsOArc F) : ∃ A B, IsJordanSplit F A B := by + obtain ⟨e⟩ := hS + obtain ⟨φ⟩ := id hF + obtain ⟨x, hx⟩ := exists_notMem_oArc (F := e '' F) ⟨φ.trans (e.image F)⟩ + obtain ⟨h, hh⟩ := exists_homeomorph_onePoint x + let E : S ≃ₜ OnePoint EuclideanPlane := e.trans h + let c : EuclideanPlane → OnePoint EuclideanPlane := (↑) + have hinf : (OnePoint.infty : OnePoint EuclideanPlane) ∉ E '' F := by + rintro ⟨y, hy, hyE⟩ + have : e y = x := h.injective (hyE.trans hh.symm) + exact hx ⟨y, hy, this⟩ + have hrange : E '' F ⊆ range c := by + intro y hy + induction y using OnePoint.rec with + | infty => exact absurd hy hinf + | coe y => exact ⟨y, rfl⟩ + have himg : c '' (c ⁻¹' (E '' F)) = E '' F := image_preimage_eq_of_subset hrange + have hG : IsOArc (c ⁻¹' (E '' F)) := by + have h1 := OnePoint.isOpenEmbedding_coe.isEmbedding.homeomorphImage (c ⁻¹' (E '' F)) + have h2 : (E '' F : Set _) ≃ₜ (c '' (c ⁻¹' (E '' F)) : Set _) := Homeomorph.setCongr himg.symm + exact ⟨(φ.trans (E.image F)).trans (h2.trans h1.symm)⟩ + obtain ⟨A, B, hsplit⟩ := jordan_onePoint_of_plane hG + have h3 : E.symm '' (c '' (c ⁻¹' (E '' F))) = F := by + rw [himg, ← image_comp] + simp + exact ⟨_, _, h3 ▸ hsplit.image E.symm⟩ + +/-- **The Jordan curve theorem**, in the plane and in the sphere. Route: Eilenberg's criterion for +separation by continuous logarithms (`component_eq_of_hasLogOn`) and a Mayer–Vietoris argument +(`not_isPreconnected_compl_union`), see `GraphMinor/Surface/JordanPlane.lean`. -/ +theorem jordan_curve_theorem : JordanCurveStatement.{u} := + ⟨fun _ hF => jordan_plane hF, fun _ _ hS _ hF => jordan_sphere hS hF⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/JordanDomain.lean b/LeanPool/GraphMinor/Surface/JordanDomain.lean new file mode 100644 index 0000000000..3abc158730 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/JordanDomain.lean @@ -0,0 +1,500 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Crossing +import Mathlib.Analysis.SpecialFunctions.Complex.Circle +import LeanPool.GraphMinor.Surface.ArcInPath +import Mathlib.Topology.UniformSpace.HeineCantor +import Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds + +/-! +# Domains bounded by an `O`-arc + +Let `F` be an `O`-arc in the complex plane. This file proves what the proof of the Schoenflies +theorem needs about the two components of the complement. + +* `exists_small_connector`: two nearby points in one component of the complement of `F` are joined + inside that component by a small connected set. This is *uniform local connectivity*. If the + segment between the points misses `F`, take the segment. Otherwise cut `F` into a small arc `A` + near the segment and a far arc `A'`, and let `E` be a small circle around the segment. Then + `(z - y) / (z - x)` has a logarithm on `F`, because the points lie in one component, and a + logarithm on `A' ∪ E`, because the segment joins them. The two differ by a constant on the + connected set `A'`, so they paste to a logarithm on `F ∪ E`, and Eilenberg's criterion joins the + points off `F ∪ E`, so inside the circle. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Complex + +/-- The points of an `O`-arc at parameter `θ` from the point at parameter `t`. -/ +noncomputable def arcPoint {F : Set ℂ} (φ : Circle ≃ₜ F) (t : Circle) (θ : ℝ) : ℂ := + (φ (t * Circle.exp θ)).1 + +theorem continuous_arcPoint {F : Set ℂ} (φ : Circle ≃ₜ F) : + Continuous fun p : Circle × ℝ => arcPoint φ p.1 p.2 := by + unfold arcPoint + have : Continuous fun p : Circle × ℝ => p.1 * Circle.exp p.2 := by + exact continuous_fst.mul (Circle.exp.continuous.comp continuous_snd) + exact continuous_subtype_val.comp (φ.continuous.comp this) + +/-- Every point of the circle is `t * exp θ` with `θ` in `[-η, 2π - η)`. -/ +theorem exists_angle_near (t s : Circle) (η : ℝ) (h0 : 0 ≤ η) (h1 : η ≤ Real.pi) : + ∃ θ : ℝ, -η ≤ θ ∧ θ ≤ 2 * Real.pi - η ∧ s = t * Circle.exp θ := by + set a := (t⁻¹ * s) with ha + have hrep : t⁻¹ * s = Circle.exp (Complex.arg (a : ℂ)) := (Circle.exp_arg a).symm + have hs : s = t * Circle.exp (Complex.arg (a : ℂ)) := by + rw [← hrep] + group + by_cases h : -η ≤ Complex.arg (a : ℂ) + · refine ⟨Complex.arg (a : ℂ), h, ?_, hs⟩ + linarith [Complex.arg_le_pi (a : ℂ)] + · rw [not_le] at h + refine ⟨Complex.arg (a : ℂ) + 2 * Real.pi, by linarith [Complex.neg_pi_lt_arg (a : ℂ)], + by linarith, ?_⟩ + rw [Circle.exp_add, Circle.exp_two_pi, mul_one] + exact hs + +/-- Near parameters give near points of the arc, uniformly. Far parameters give far points. -/ +theorem exists_arc_constants {F : Set ℂ} (φ : Circle ≃ₜ F) {ε : ℝ} (hε : 0 < ε) : + ∃ η ρ : ℝ, 0 < η ∧ η < Real.pi ∧ 0 < ρ ∧ + (∀ t θ, |θ| ≤ η → dist (arcPoint φ t θ) (arcPoint φ t 0) < ε) ∧ + (∀ t θ, θ ∈ Icc η (2 * Real.pi - η) → ρ ≤ dist (arcPoint φ t θ) (arcPoint φ t 0)) := by + have hunif : UniformContinuous fun s : Circle => (φ s).1 := + CompactSpace.uniformContinuous_of_continuous (continuous_subtype_val.comp φ.continuous) + obtain ⟨η₀, hη₀, hη⟩ := Metric.uniformContinuous_iff.mp hunif ε hε + set η := min (η₀ / 2) 1 with hηdef + have hηpos : 0 < η := lt_min (by positivity) one_pos + have hηpi : η < Real.pi := lt_of_le_of_lt (min_le_right _ _) (by linarith [Real.two_le_pi]) + have hηle : η < η₀ := lt_of_le_of_lt (min_le_left _ _) (by linarith) + have hcomp : IsCompact ((univ : Set Circle) ×ˢ Icc η (2 * Real.pi - η)) := + isCompact_univ.prod isCompact_Icc + have hne : ((univ : Set Circle) ×ˢ Icc η (2 * Real.pi - η)).Nonempty := + ⟨(1, η), mem_univ _, by constructor <;> linarith [Real.two_le_pi]⟩ + let G : Circle × ℝ → ℝ := fun p => dist (arcPoint φ p.1 p.2) (arcPoint φ p.1 0) + have hG : Continuous G := by + have h1 := continuous_arcPoint φ + have h2 : Continuous fun p : Circle × ℝ => arcPoint φ p.1 0 := + h1.comp (continuous_fst.prodMk continuous_const) + exact h1.dist h2 + obtain ⟨p, hp, hmin⟩ := hcomp.exists_isMinOn hne hG.continuousOn + have hpos : 0 < G p := by + rw [dist_pos] + intro heq + have hinj := φ.injective (Subtype.ext heq) + have h1 : Circle.exp p.2 = 1 := by + have : p.1 * Circle.exp p.2 = p.1 * Circle.exp 0 := hinj + simpa using this + have hθ := hp.2 + have h2 : Circle.exp p.2 = Circle.exp 0 := by simpa using h1 + rw [Circle.exp_eq_exp] at h2 + obtain ⟨m, hm⟩ := h2 + have hle : ((m : ℝ)) * (2 * Real.pi) = p.2 := by linarith + have hm0 : (0 : ℝ) < m := by + by_contra hc + rw [not_lt] at hc + nlinarith [hθ.1, Real.pi_pos] + have hm1 : (m : ℝ) < 1 := by + by_contra hc + rw [not_lt] at hc + nlinarith [hθ.2, Real.pi_pos] + have h3 : 0 < m := by exact_mod_cast hm0 + have h4 : m < 1 := by exact_mod_cast hm1 + omega + refine ⟨η, G p, hηpos, hηpi, hpos, fun t θ hθ => ?_, fun t θ hθ => ?_⟩ + · refine hη ?_ + have : dist (t * Circle.exp θ) (t * Circle.exp 0) ≤ |θ| := by + rw [Circle.exp_zero, mul_one] + change dist ((t * Circle.exp θ : Circle) : ℂ) (t : ℂ) ≤ |θ| + have h1 : ((t * Circle.exp θ : Circle) : ℂ) - (t : ℂ) = t * (exp (I * θ) - 1) := by + rw [Circle.coe_mul, Circle.coe_exp] + ring_nf + rw [dist_eq_norm, h1, norm_mul, Circle.norm_coe, one_mul] + exact Real.norm_exp_I_mul_ofReal_sub_one_le + exact lt_of_le_of_lt this (lt_of_le_of_lt hθ hηle) + · exact isMinOn_iff.mp hmin (t, θ) ⟨mem_univ t, hθ⟩ + +/-- **Uniform local connectivity.** Nearby points in one component of the complement of an `O`-arc +are joined in the complement by a small connected set. -/ +theorem exists_small_connector {F : Set ℂ} (φ : Circle ≃ₜ F) {ε : ℝ} (hε : 0 < ε) : + ∃ δ : ℝ, 0 < δ ∧ ∀ x y : ℂ, x ∉ F → y ∉ F → y ∈ connectedComponentIn Fᶜ x → dist x y < δ → + ∃ C : Set ℂ, IsPathConnected C ∧ C ⊆ Fᶜ ∧ x ∈ C ∧ y ∈ C ∧ C ⊆ ball x ε := by + obtain ⟨η, ρ, hη, hηπ, hρ, hnear, hfar⟩ := exists_arc_constants φ (half_pos hε) + refine ⟨min ρ (ε / 2), lt_min hρ (half_pos hε), fun x y hx hy hxy hdist => ?_⟩ + have hδρ : dist x y < ρ := lt_of_lt_of_le hdist (min_le_left _ _) + have hδε : dist x y < ε / 2 := lt_of_lt_of_le hdist (min_le_right _ _) + by_cases hseg : Disjoint (segment ℝ x y) F + · refine ⟨segment ℝ x y, (convex_segment x y).isPathConnected ⟨x, left_mem_segment ℝ x y⟩, ?_, + left_mem_segment ℝ x y, right_mem_segment ℝ x y, ?_⟩ + · exact fun z hz hzF => Set.disjoint_left.mp hseg hz hzF + · refine (convex_ball x ε).segment_subset (mem_ball_self hε) ?_ + rw [mem_ball'] + linarith + obtain ⟨u, huseg, huF⟩ := not_disjoint_iff.mp hseg + have hFc : IsCompact F := isCompact_of_oArc φ + let t : Circle := φ.symm ⟨u, huF⟩ + have hut : arcPoint φ t 0 = u := by + simp [arcPoint, t] + have hthetac : Continuous fun θ : ℝ => arcPoint φ t θ := + (continuous_arcPoint φ).comp (continuous_const.prodMk continuous_id) + set A := (fun θ : ℝ => arcPoint φ t θ) '' Icc (-η) η with hA + set A' := (fun θ : ℝ => arcPoint φ t θ) '' Icc η (2 * Real.pi - η) with hA' + have hAc : IsCompact A := isCompact_Icc.image hthetac + have hA'c : IsCompact A' := isCompact_Icc.image hthetac + have hcover : F = A ∪ A' := by + ext z + constructor + · intro hz + obtain ⟨θ, h1, h2, h3⟩ := exists_angle_near t (φ.symm ⟨z, hz⟩) η hη.le hηπ.le + have hzθ : arcPoint φ t θ = z := by + simp [arcPoint, ← h3] + by_cases hθ : θ ≤ η + · exact Or.inl ⟨θ, ⟨h1, hθ⟩, hzθ⟩ + · exact Or.inr ⟨θ, ⟨(not_le.mp hθ).le, h2⟩, hzθ⟩ + · rintro (⟨θ, -, rfl⟩ | ⟨θ, -, rfl⟩) <;> exact (φ _).2 + have hAball : A ⊆ ball u (ε / 2) := by + rintro _ ⟨θ, hθ, rfl⟩ + rw [mem_ball, ← hut] + exact hnear t θ (abs_le.mpr hθ) + have hA'far : ∀ z ∈ A', ρ ≤ dist z u := by + rintro _ ⟨θ, hθ, rfl⟩ + rw [← hut] + exact hfar t θ hθ + have hxu : dist x u ≤ dist x y := by + have h := (convex_closedBall x (dist x y)).segment_subset + (mem_closedBall_self dist_nonneg) (mem_closedBall'.mpr le_rfl) huseg + exact mem_closedBall'.mp h + have hyu : dist y u ≤ dist x y := by + have h := (convex_closedBall y (dist x y)).segment_subset + (mem_closedBall.mpr le_rfl) (mem_closedBall_self dist_nonneg) huseg + exact mem_closedBall'.mp h + have hsegball : segment ℝ x y ⊆ ball u (dist x y + (min ρ (ε / 2) - dist x y) / 2) := by + have hgap : 0 < min ρ (ε / 2) - dist x y := by linarith + refine (convex_ball _ _).segment_subset ?_ ?_ <;> rw [mem_ball] <;> linarith + have hsegmin : ∀ w ∈ segment ℝ x y, dist w u < min ρ (ε / 2) := by + intro w hw + have := mem_ball.mp (hsegball hw) + linarith + set E := sphere u (ε / 2) with hE + have hEc : IsCompact E := isCompact_sphere u _ + set K := A' ∪ E with hK + have hKc : IsCompact K := hA'c.union hEc + have hsegK : segment ℝ x y ⊆ Kᶜ := by + rintro w hw (h | h) + · linarith [hA'far w h, hsegmin w hw, min_le_left ρ (ε / 2)] + · have h' : dist w u = ε / 2 := h + linarith [hsegmin w hw, min_le_right ρ (ε / 2)] + have hxseg := left_mem_segment ℝ x y + have hyseg := right_mem_segment ℝ x y + have hyK : y ∈ connectedComponentIn Kᶜ x := + (convex_segment x y).isPreconnected.subset_connectedComponentIn hxseg hsegK hyseg + obtain ⟨l₂, hl₂c, hl₂⟩ := hasLogOn_div_of_same_component hKc.isClosed (hsegK hxseg) hyK + obtain ⟨l₁, hl₁c, hl₁⟩ := hasLogOn_div_of_same_component hFc.isClosed hx hxy + have hA'F : A' ⊆ F := by rw [hcover]; exact subset_union_right + have hAF : A ⊆ F := by rw [hcover]; exact subset_union_left + have hA'pre : IsPreconnected A' := isPreconnected_Icc.image _ hthetac.continuousOn + have hexp : ∀ z ∈ A', exp (l₂ z - l₁ z) = 1 := by + intro z hz + have h1 := hl₁ z (hA'F hz) + have h2 := hl₂ z (Or.inl hz) + rw [exp_sub, ← h1, ← h2] + refine div_self ?_ + rw [h1] + exact exp_ne_zero _ + have hdiff : ContinuousOn (fun z => l₂ z - l₁ z) A' := + (hl₂c.mono subset_union_left).sub (hl₁c.mono hA'F) + have hp : arcPoint φ t η ∈ A' := ⟨η, ⟨le_rfl, by linarith⟩, rfl⟩ + set k := l₂ (arcPoint φ t η) - l₁ (arcPoint φ t η) with hk + have hkexp : exp k = 1 := hexp _ hp + have hlogU : HasLogOn (A ∪ K) fun z => (z - y) / (z - x) := by + refine hasLogOn_union (gA := fun z => l₁ z + k) (gB := l₂) hAc.isClosed hKc.isClosed + ((hl₁c.mono hAF).add continuousOn_const) hl₂c (fun z hz => ?_) hl₂ ?_ + · rw [exp_add, hkexp, mul_one] + exact hl₁ z (hAF hz) + · rintro z ⟨hzA, hzK⟩ + have hzA' : z ∈ A' := by + rcases hzK with h | h + · exact h + · have h' : dist z u = ε / 2 := h + exact absurd (mem_ball.mp (hAball hzA)) (by linarith) + have := eq_of_exp_eq_one hA'pre hdiff hexp hzA' hp + linear_combination -this + have hUc : IsCompact (A ∪ K) := hAc.union hKc + have hset : A ∪ K = F ∪ E := by rw [hK, ← union_assoc, ← hcover] + rw [hset] at hlogU hUc + have hxU : x ∉ F ∪ E := fun h => h.elim hx fun h' => hsegK hxseg (Or.inr h') + have hyU : y ∉ F ∪ E := fun h => h.elim hy fun h' => hsegK hyseg (Or.inr h') + have hcomp := component_eq_of_hasLogOn hUc hxU hyU + (hlogU.inv.congr fun z _ => by rw [inv_div]) + have hyin : y ∈ connectedComponentIn (F ∪ E)ᶜ x := hcomp ▸ mem_connectedComponentIn hyU + have hxin : x ∈ connectedComponentIn (F ∪ E)ᶜ x := mem_connectedComponentIn hxU + refine ⟨connectedComponentIn (F ∪ E)ᶜ x, + (isOpen_component hUc.isClosed x).isConnected_iff_isPathConnected.mp + (isConnected_connectedComponentIn_iff.mpr hxU), ?_, hxin, hyin, ?_⟩ + · exact fun z hz hzF => connectedComponentIn_subset _ _ hz (Or.inl hzF) + · intro z hz + have hball : z ∈ ball u (ε / 2) := by + by_contra hout + obtain ⟨w, hw1, hw2⟩ := inter_frontier_nonempty_of_isPreconnected (U := ball u (ε / 2)) + (isPreconnected_connectedComponentIn (F := (F ∪ E)ᶜ) (x := x)) + ⟨x, hxin, by rw [mem_ball]; linarith⟩ ⟨z, hz, hout⟩ + exact connectedComponentIn_subset _ _ hw1 (Or.inr (frontier_ball_subset_sphere hw2)) + rw [mem_ball] at hball ⊢ + have := dist_triangle z u x + rw [dist_comm u x] at this + linarith + +local notation "𝕀" => unitInterval + +/-- A sequence of paths, each starting where the last one ends, that tends to a point `L` joins to +a single path ending at `L`. -/ +theorem exists_path_of_tendsto {p : ℕ → 𝕀 → ℂ} (hp : ∀ n, Continuous (p n)) + (hlink : ∀ n, p n 1 = p (n + 1) 0) {L : ℂ} {r : ℕ → ℝ} (hr : Filter.Tendsto r Filter.atTop + (𝓝 0)) + (hclose : ∀ n t, dist (p n t) L ≤ r n) : + ∃ γ : 𝕀 → ℂ, Continuous γ ∧ γ 0 = p 0 0 ∧ γ 1 = L ∧ ∀ t, t ≠ 1 → ∃ n s, γ t = p n s := by + classical + let p' : ℕ → ℝ → ℂ := fun n s => p n (projIcc 0 1 zero_le_one s) + have hp'c : ∀ n, Continuous (p' n) := fun n => (hp n).comp continuous_projIcc + have hp'0 : ∀ n, p' n 0 = p n 0 := fun n => by + simp only [p', projIcc_left] + rfl + have hp'1 : ∀ n, p' n 1 = p n 1 := fun n => by + simp only [p', projIcc_right] + rfl + let Γ : ℝ → ℂ := fun s => p' ⌊s⌋₊ (s - ⌊s⌋₊) + have hstep : ∀ n : ℕ, ContinuousOn Γ (Icc (n : ℝ) (n + 1)) := by + intro n + have hc : ContinuousOn (fun s : ℝ => p' n (s - n)) (Icc (n : ℝ) (n + 1)) := + ((hp'c n).comp (continuous_id.sub continuous_const)).continuousOn + refine hc.congr fun s hs => ?_ + rcases eq_or_lt_of_le hs.2 with h | h + · have hfl : ⌊s⌋₊ = n + 1 := by + rw [h] + exact_mod_cast Nat.floor_natCast (R := ℝ) (n + 1) + simp only [Γ, hfl] + rw [h] + push_cast + rw [show (n : ℝ) + 1 - (n + 1) = 0 by ring, show (n : ℝ) + 1 - n = 1 by ring, hp'0, hp'1, + hlink] + · have hfl : ⌊s⌋₊ = n := (Nat.floor_eq_iff (le_trans (Nat.cast_nonneg n) hs.1)).mpr ⟨hs.1, h⟩ + simp only [Γ, hfl] + have hIic : ∀ N : ℕ, ContinuousOn Γ (Iic (N : ℝ)) := by + intro N + induction N with + | zero => + have hc : ContinuousOn Γ (Iic (0 : ℝ)) := + (continuousOn_const (c := p 0 0)).congr fun s hs => by + have hs' : s ≤ 0 := hs + simp only [Γ, Nat.floor_of_nonpos hs', Nat.cast_zero, sub_zero, p'] + rw [projIcc_of_le_left _ hs'] + rfl + simpa using hc + | succ N ih => + have heq : Iic ((N + 1 : ℕ) : ℝ) = Iic (N : ℝ) ∪ Icc (N : ℝ) (N + 1) := by + push_cast + exact (Iic_union_Icc_eq_Iic (by linarith)).symm + rw [heq] + exact ih.union_of_isClosed (hstep N) isClosed_Iic isClosed_Icc + have hΓ : Continuous Γ := by + rw [continuous_iff_continuousAt] + intro s + obtain ⟨N, hN⟩ := exists_nat_gt s + exact (hIic N).continuousAt (Iic_mem_nhds hN) + have hΓclose : ∀ s, dist (Γ s) L ≤ r ⌊s⌋₊ := fun s => hclose _ _ + let γ : 𝕀 → ℂ := fun t => if (t : ℝ) < 1 then Γ ((t : ℝ) / (1 - t)) else L + have hγlt : ∀ t : 𝕀, (t : ℝ) < 1 → γ t = Γ ((t : ℝ) / (1 - t)) := fun t ht => by + simp only [γ, ht, ite_true] + have hγ1 : γ 1 = L := by + simp [γ] + refine ⟨γ, ?_, ?_, hγ1, ?_⟩ + · rw [continuous_iff_continuousAt] + intro t + by_cases ht : (t : ℝ) < 1 + · have hev : ∀ᶠ u : 𝕀 in 𝓝 t, γ u = Γ ((u : ℝ) / (1 - u)) := by + have : IsOpen {u : 𝕀 | (u : ℝ) < 1} := isOpen_lt continuous_subtype_val continuous_const + filter_upwards [this.mem_nhds ht] with u hu using hγlt u hu + refine ContinuousAt.congr ?_ (Filter.EventuallyEq.symm hev) + have h1 : ContinuousAt (fun u : 𝕀 => (u : ℝ) / (1 - u)) t := + continuous_subtype_val.continuousAt.div (continuous_const.sub + continuous_subtype_val).continuousAt + (by linarith) + exact hΓ.continuousAt.comp h1 + · have ht1 : t = 1 := Subtype.ext (le_antisymm t.2.2 (not_lt.mp ht)) + subst ht1 + rw [Metric.continuousAt_iff] + intro ε hε + obtain ⟨N, hN⟩ := Filter.eventually_atTop.mp ((tendsto_order.mp hr).2 ε hε) + have hNpos : (0 : ℝ) < N + 1 := by positivity + refine ⟨1 / (N + 1), by positivity, fun u hu => ?_⟩ + rw [hγ1] + by_cases hu1 : (u : ℝ) < 1 + · rw [hγlt u hu1] + have hd : 1 - (u : ℝ) < 1 / (N + 1) := by + have h2 : dist (u : ℝ) 1 < 1 / (N + 1) := hu + rw [Real.dist_eq, abs_lt] at h2 + linarith [h2.1] + have hpos : 0 < 1 - (u : ℝ) := by linarith + have hs : (N : ℝ) ≤ (u : ℝ) / (1 - u) := by + rw [le_div_iff₀ hpos] + rw [lt_div_iff₀ hNpos] at hd + nlinarith + have hfl : N ≤ ⌊(u : ℝ) / (1 - u)⌋₊ := Nat.le_floor hs + exact lt_of_le_of_lt (hΓclose _) (hN _ hfl) + · have hu' : u = 1 := Subtype.ext (le_antisymm u.2.2 (not_lt.mp hu1)) + rw [hu', hγ1, dist_self] + exact hε + · rw [hγlt 0 (by simp)] + simp only [Γ, Icc.coe_zero, zero_div, Nat.floor_zero, Nat.cast_zero, sub_zero, hp'0] + · intro t ht + have ht1 : (t : ℝ) < 1 := lt_of_le_of_ne t.2.2 fun h => ht (Subtype.ext h) + exact ⟨_, _, hγlt t ht1⟩ + +/-- Each point of an `O`-arc is a limit of points of each component of the complement. -/ +theorem subset_closure_component {F : Set ℂ} (φ : Circle ≃ₜ F) {x : ℂ} (hx : x ∉ F) : + F ⊆ closure (connectedComponentIn Fᶜ x) := by + obtain ⟨A, B, ⟨-, hcomp, hAf, hBf⟩, -, -⟩ := jordan_complex φ + rw [← compl_eq_univ_sdiff] at hcomp + have hx' : connectedComponentIn Fᶜ x ∈ componentsIn Fᶜ := mem_image_of_mem _ hx + rw [hcomp] at hx' + rcases hx' with h | h + · rw [h] + exact hAf.symm.subset.trans frontier_subset_closure + · rw [mem_singleton_iff.mp h] + exact hBf.symm.subset.trans frontier_subset_closure + +/-- **Accessibility.** Every point of an `O`-arc is the end of a path that otherwise stays in a +given component of the complement. -/ +theorem exists_path_to_boundary {F : Set ℂ} (φ : Circle ≃ₜ F) {x p : ℂ} (hx : x ∉ F) (hp : p ∈ F) : + ∃ γ : 𝕀 → ℂ, Continuous γ ∧ γ 0 = x ∧ γ 1 = p ∧ + ∀ t, t ≠ 1 → γ t ∈ connectedComponentIn Fᶜ x := by + classical + set U := connectedComponentIn Fᶜ x with hU + have hFc := (isCompact_of_oArc φ).isClosed + have hε : ∀ n : ℕ, (0 : ℝ) < (1 / 2) ^ n := fun n => by positivity + choose δ hδ hconn using fun n => exists_small_connector φ (hε n) + let η : ℕ → ℝ := fun n => min (δ n / 2) ((1 / 2) ^ n) + have hη : ∀ n, 0 < η n := fun n => lt_min (half_pos (hδ n)) (hε n) + let e : ℕ → ℝ := fun n => Nat.casesOn n (η 0) fun k => min (η k) (η (k + 1)) + have he : ∀ n, 0 < e n := by + intro n + cases n with + | zero => exact hη 0 + | succ k => exact lt_min (hη k) (hη (k + 1)) + have heη : ∀ n, e n ≤ η n := by + intro n + cases n with + | zero => exact le_rfl + | succ k => exact min_le_right _ _ + have heη' : ∀ n, e (n + 1) ≤ η n := fun n => min_le_left _ _ + have hclosure := subset_closure_component φ hx hp + choose y hyU hyd using fun n => Metric.mem_closure_iff.mp hclosure (e n) (he n) + have hUeq : ∀ n, connectedComponentIn Fᶜ (y n) = U := fun n => (connectedComponentIn_eq + (hyU n)).symm + have hyF : ∀ n, y n ∉ F := fun n => connectedComponentIn_subset _ _ (hyU n) + have hdist : ∀ n, dist (y n) (y (n + 1)) < δ n := by + intro n + have h1 := hyd n + have h2 := hyd (n + 1) + have h3 := dist_triangle_right (y n) (y (n + 1)) p + have h4 : η n ≤ δ n / 2 := min_le_left _ _ + rw [dist_comm p] at h1 h2 + linarith [heη n, heη' n] + have hstep : ∀ n, ∃ q : Path (y n) (y (n + 1)), (∀ t, q t ∈ U) ∧ ∀ t, dist (q t) p ≤ 2 * + (1 / 2) ^ n := by + intro n + obtain ⟨C, hC, hCF, h1, h2, h3⟩ := hconn n (y n) (y (n + 1)) (hyF n) (hyF (n + 1)) + (by rw [hUeq]; exact hyU (n + 1)) (hdist n) + obtain ⟨q, hq⟩ := hC.joinedIn _ h1 _ h2 + refine ⟨q, fun t => ?_, fun t => ?_⟩ + · rw [← hUeq n] + exact hC.isConnected.isPreconnected.subset_connectedComponentIn h1 hCF (hq t) + · have h4 : dist (q t) (y n) < (1 / 2) ^ n := h3 (hq t) + have h5 := hyd n + have h6 : η n ≤ (1 / 2) ^ n := min_le_right _ _ + have h7 := dist_triangle (q t) (y n) p + rw [dist_comm p] at h5 + linarith [heη n] + choose q hqU hqd using hstep + have hxy : y 0 ∈ U := hyU 0 + have hUopen : IsOpen U := isOpen_component hFc x + have hUpath : IsPathConnected U := + hUopen.isConnected_iff_isPathConnected.mp (isConnected_connectedComponentIn_iff.mpr hx) + obtain ⟨q₀, hq₀⟩ := hUpath.joinedIn x (mem_connectedComponentIn hx) _ hxy + obtain ⟨B, hB⟩ := (isCompact_range q₀.continuous).isBounded.subset_closedBall p + let P : ℕ → 𝕀 → ℂ := fun n => Nat.casesOn n q₀ fun k => q k + let r : ℕ → ℝ := fun n => Nat.casesOn n B fun k => 2 * (1 / 2) ^ k + have hr : Filter.Tendsto r Filter.atTop (𝓝 0) := by + refine (Filter.tendsto_add_atTop_iff_nat 1).mp ?_ + have h := (tendsto_pow_atTop_nhds_zero_of_lt_one (r := (1 / 2 : ℝ)) (by norm_num) + (by norm_num)).const_mul (2 : ℝ) + rw [mul_zero] at h + exact h + have hPc : ∀ n, Continuous (P n) := by + intro n + cases n with + | zero => exact q₀.continuous + | succ k => exact (q k).continuous + have hlink : ∀ n, P n 1 = P (n + 1) 0 := by + intro n + cases n with + | zero => exact q₀.target.trans (q 0).source.symm + | succ k => exact (q k).target.trans (q (k + 1)).source.symm + have hclose : ∀ n t, dist (P n t) p ≤ r n := by + intro n t + cases n with + | zero => exact mem_closedBall.mp (hB ⟨t, rfl⟩) + | succ k => exact hqd k t + obtain ⟨γ, hγc, hγ0, hγ1, hγU⟩ := exists_path_of_tendsto hPc hlink hr hclose + refine ⟨γ, hγc, hγ0.trans q₀.source, hγ1, fun t ht => ?_⟩ + obtain ⟨n, s, hs⟩ := hγU t ht + rw [hs] + cases n with + | zero => exact hq₀ s + | succ k => exact hqU k s + +/-- **Cross-cuts.** Two different points of an `O`-arc are joined by an arc whose other points lie +in a given component of the complement. -/ +theorem exists_crossCut {F : Set ℂ} (φ : Circle ≃ₜ F) {x p q : ℂ} (hx : x ∉ F) (hp : p ∈ F) + (hq : q ∈ F) (hpq : p ≠ q) : + ∃ e : 𝕀 → ℂ, Continuous e ∧ Function.Injective e ∧ e 0 = p ∧ e 1 = q ∧ + ∀ t, t ≠ 0 → t ≠ 1 → e t ∈ connectedComponentIn Fᶜ x := by + obtain ⟨γ₁, hc₁, h1₀, h1₁, h1U⟩ := exists_path_to_boundary φ hx hp + obtain ⟨γ₂, hc₂, h2₀, h2₁, h2U⟩ := exists_path_to_boundary φ hx hq + let P₁ : Path x p := ⟨⟨γ₁, hc₁⟩, h1₀, h1₁⟩ + let P₂ : Path x q := ⟨⟨γ₂, hc₂⟩, h2₀, h2₁⟩ + let P : Path p q := P₁.symm.trans P₂ + obtain ⟨e, hec, hei, he0, he1, her⟩ := exists_arc_of_path P.continuous + (by rw [P.source, P.target]; exact hpq) + rw [P.source] at he0 + rw [P.target] at he1 + refine ⟨e, hec, hei, he0, he1, fun t ht0 ht1 => ?_⟩ + have htmem : e t ∈ range P := her ⟨t, rfl⟩ + have hrange : range P = range P₁.symm ∪ range P₂ := Path.trans_range _ _ + have hne0 : e t ≠ p := fun h => ht0 (hei (h.trans he0.symm)) + have hne1 : e t ≠ q := fun h => ht1 (hei (h.trans he1.symm)) + rw [hrange] at htmem + rcases htmem with ⟨s, hs⟩ | ⟨s, hs⟩ + · have hs' : γ₁ (unitInterval.symm s) = e t := hs + by_cases h : unitInterval.symm s = 1 + · rw [h, h1₁] at hs' + exact absurd hs'.symm hne0 + · rw [← hs'] + exact h1U _ h + · have hs' : γ₂ s = e t := hs + by_cases h : s = 1 + · rw [h, h2₁] at hs' + exact absurd hs'.symm hne1 + · rw [← hs'] + exact h2U _ h + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/JordanPlane.lean b/LeanPool/GraphMinor/Surface/JordanPlane.lean new file mode 100644 index 0000000000..9b8467e3d2 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/JordanPlane.lean @@ -0,0 +1,642 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.PlaneSeparation +public import LeanPool.GraphMinor.Surface.TopologyStatements +import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# The Jordan curve theorem in the complex plane + +An `O`-arc `F` of the complex plane is the union of two arcs with common ends `p, q`. + +* **At least two components** (`not_isPreconnected_compl_union`). This is a Mayer–Vietoris argument + on the complement. The function $(z - q)/(z - p)$ has a logarithm off each of the two arcs: move + `p` to `q` along the arc. If the complement of `F` were connected, the two logarithms would differ + by a constant on it, so they would paste to a logarithm on the plane without `p, q`. That is false + on a small circle around `p`. +* **At most two components** (`exists_zpow_mul_zpow_hasLogOn`, `component_eq_or_eq`). Two functions + on `F` without zeros have a nontrivial product of powers with a logarithm, because a function + has logarithms on both arcs and these fail to agree by one integer. With three components this + contradicts the obstruction `eq_zero_of_hasLogOn_frontier`. +* **The frontier** (`subset_frontier_component`). A function without zeros has a logarithm on `F` + minus a point. So if `x ∈ F` were not in the frontier of a component, then by Eilenberg's + criterion the frontier would not separate the two components. + +The route follows Eilenberg's criterion, as in J. Dieudonné, *Foundations of Modern Analysis*, +Appendix to Chapter IX. The Mayer–Vietoris step replaces the approximation argument there. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Complex Metric + +local notation "𝕀" => unitInterval + +universe u + +/-- The function $(z - \alpha(1)) / (z - \alpha(0))$ has a logarithm off the path `α`. -/ +theorem hasLogOn_compl_range (α : C(𝕀, ℂ)) : + HasLogOn (range α)ᶜ fun z => (z - α 1) / (z - α 0) := by + have hne : ∀ t, ∀ z ∈ (range α)ᶜ, z - α t ≠ 0 := fun t z hz h => + hz ⟨t, (sub_eq_zero.mp h).symm⟩ + refine hasLogOn_of_homotopy (K := (range α)ᶜ) (fun t z => (z - α t) / (z - α 0)) ?_ + (fun z hz => div_self (hne 0 z hz)) (fun t z hz => div_ne_zero (hne t z hz) (hne 0 z hz)) + apply ContinuousOn.div + · exact continuous_snd.continuousOn.sub (α.continuous.comp continuous_fst).continuousOn + · exact continuous_snd.continuousOn.sub continuousOn_const + · rintro ⟨t, z⟩ ⟨-, hz⟩ + exact hne 0 z hz + +/-- `z - q` has a logarithm on a small circle around `p`. -/ +theorem hasLogOn_sub_sphere {p q : ℂ} {ρ : ℝ} (hpq : ρ < ‖p - q‖) (hρ : 0 < ρ) : + HasLogOn (sphere p ρ) fun z => z - q := by + have hne : p - q ≠ 0 := norm_pos_iff.mp (hρ.trans hpq) + have h : HasLogOn (sphere p ρ) fun z => (z - q) / (p - q) := by + refine hasLogOn_of_slitPlane (by fun_prop) fun z hz => ?_ + rw [mem_sphere, dist_eq_norm] at hz + have h1 : (z - q) / (p - q) = 1 + (z - p) / (p - q) := by field_simp; ring + rw [h1] + have h2 : ‖(z - p) / (p - q)‖ < 1 := by + rw [norm_div, hz, div_lt_one (hρ.trans hpq)] + exact hpq + refine mem_slitPlane_iff.mpr (Or.inl ?_) + have h3 := abs_lt.mp ((abs_re_le_norm _).trans_lt h2) + simp only [add_re, one_re] + linarith [h3.1] + refine (h.mul (hasLogOn_const hne)).congr fun z _ => ?_ + field_simp + +/-- **At least two components.** The complement of the union of two paths with the same ends +`p ≠ q` and no other common point is not connected. -/ +theorem not_isPreconnected_compl_union {α β : C(𝕀, ℂ)} {p q : ℂ} (hα0 : α 0 = p) (hα1 : α 1 = q) + (hβ0 : β 0 = p) (hβ1 : β 1 = q) (hpq : p ≠ q) (hinter : range α ∩ range β = {p, q}) : + ¬ IsPreconnected (range α ∪ range β)ᶜ := by + classical + intro hconn + have hAc : IsClosed (range α) := (isCompact_range α.continuous).isClosed + have hBc : IsClosed (range β) := (isCompact_range β.continuous).isClosed + obtain ⟨gA, hgA, hfA⟩ := hasLogOn_compl_range α + obtain ⟨gB, hgB, hfB⟩ := hasLogOn_compl_range β + simp only [hα0, hα1] at hfA + simp only [hβ0, hβ1] at hfB + have hbdd : Bornology.IsBounded (range α ∪ range β) := + (isCompact_range α.continuous).isBounded.union (isCompact_range β.continuous).isBounded + obtain ⟨z₀, hz₀⟩ : ((range α ∪ range β)ᶜ).Nonempty := by + by_contra hemp + rw [not_nonempty_iff_eq_empty, compl_empty_iff] at hemp + rw [hemp] at hbdd + exact NormedSpace.unbounded_univ ℝ ℂ hbdd + have hsplit : ∀ {z}, z ∈ (range α ∪ range β)ᶜ → z ∈ (range α)ᶜ ∧ z ∈ (range β)ᶜ := fun hz => + ⟨fun h => hz (Or.inl h), fun h => hz (Or.inr h)⟩ + have hratio : ∀ z ∈ (range α ∪ range β)ᶜ, exp (gA z) = exp (gB z) := fun z hz => by + rw [← hfA z (hsplit hz).1, ← hfB z (hsplit hz).2] + set c := gA z₀ - gB z₀ with hc + have hexpc : exp c = 1 := by + rw [hc, exp_sub, hratio z₀ hz₀, div_self (exp_ne_zero _)] + have hUo : IsOpen (range α ∪ range β)ᶜ := (hAc.union hBc).isOpen_compl + have hdiff : ∀ z ∈ (range α ∪ range β)ᶜ, gA z = gB z + c := by + intro z hz + have hcontA : ContinuousOn gA (range α ∪ range β)ᶜ := hgA.mono fun w hw => (hsplit hw).1 + have hcontB : ContinuousOn gB (range α ∪ range β)ᶜ := hgB.mono fun w hw => (hsplit hw).2 + have h := eq_of_exp_eq_one (g := fun w => gA w - gB w) hconn (hcontA.sub hcontB) + (fun w hw => by simp only [exp_sub, hratio w hw]; exact div_self (exp_ne_zero _)) hz hz₀ + rw [hc] + linear_combination h + let L : ℂ → ℂ := fun z => if z ∈ range α then gB z + c else gA z + set ρ := ‖p - q‖ / 2 with hρdef + have hpqpos : 0 < ‖p - q‖ := norm_pos_iff.mpr (sub_ne_zero.mpr hpq) + have hρ : 0 < ρ := by positivity + have hρlt : ρ < ‖p - q‖ := by rw [hρdef]; linarith + have hnotp : ∀ z ∈ sphere p ρ, z ≠ p := fun z hz h => by + rw [mem_sphere, h, dist_self] at hz + exact hρ.ne hz + have hnotq : ∀ z ∈ sphere p ρ, z ≠ q := fun z hz h => by + rw [mem_sphere, h, dist_eq_norm, norm_sub_rev] at hz + exact hρlt.ne hz.symm + have hLA : ∀ z ∈ (range α)ᶜ, L =ᶠ[𝓝 z] gA := fun z hz => by + filter_upwards [hAc.isOpen_compl.mem_nhds hz] with w hw + have hw' : w ∉ range α := hw + simp only [L, hw', ite_false] + have hLB : ∀ z ∈ (range β)ᶜ, L =ᶠ[𝓝 z] fun w => gB w + c := fun z hz => by + filter_upwards [hBc.isOpen_compl.mem_nhds hz] with w hw + by_cases h : w ∈ range α + · simp only [L, h, ite_true] + · simp only [L, h, ite_false] + exact hdiff w fun h' => h'.elim h hw + have hnotB : ∀ z ∈ sphere p ρ, z ∈ range α → z ∈ (range β)ᶜ := fun z hz hza hzb => by + have : z ∈ ({p, q} : Set ℂ) := hinter ▸ ⟨hza, hzb⟩ + rcases this with h | h + · exact hnotp z hz h + · exact hnotq z hz h + have hLcont : ContinuousOn L (sphere p ρ) := by + intro z hz + apply ContinuousAt.continuousWithinAt + by_cases hza : z ∈ range α + · have hzb := hnotB z hz hza + exact (((hgB.continuousAt (hBc.isOpen_compl.mem_nhds hzb)).add continuousAt_const)).congr + (hLB z hzb).symm + · exact (hgA.continuousAt (hAc.isOpen_compl.mem_nhds hza)).congr (hLA z hza).symm + have hlogr : HasLogOn (sphere p ρ) fun z => (z - q) / (z - p) := by + refine ⟨L, hLcont, fun z hz => ?_⟩ + by_cases hza : z ∈ range α + · simp only [L, hza, ite_true] + rw [exp_add, hexpc, mul_one] + exact hfB z (hnotB z hz hza) + · simp only [L, hza, ite_false] + exact hfA z hza + have hfinal : HasLogOn (sphere p ρ) fun z => (z - p) ^ (1 : ℤ) := by + refine ((hasLogOn_sub_sphere hρlt hρ).div hlogr).congr fun z hz => ?_ + have h1 : z - p ≠ 0 := sub_ne_zero.mpr (hnotp z hz) + have h2 : z - q ≠ 0 := sub_ne_zero.mpr (hnotq z hz) + field_simp + exact one_ne_zero (eq_zero_of_hasLogOn_sphere hρ hfinal) + +/-- Two logarithms on closed sets that agree on the common points paste. -/ +theorem hasLogOn_union {T : Type u} [TopologicalSpace T] {A B : Set T} (hA : IsClosed A) + (hB : IsClosed B) {f gA gB : T → ℂ} (hgA : ContinuousOn gA A) (hgB : ContinuousOn gB B) + (hfA : ∀ x ∈ A, f x = exp (gA x)) (hfB : ∀ x ∈ B, f x = exp (gB x)) + (hag : ∀ x ∈ A ∩ B, gA x = gB x) : HasLogOn (A ∪ B) f := by + classical + let g : T → ℂ := fun x => if x ∈ A then gA x else gB x + have h1 : ContinuousOn g A := hgA.congr fun x hx => by simp [g, hx] + have h2 : ContinuousOn g B := hgB.congr fun x hx => by + by_cases h : x ∈ A + · simp only [g, h, ite_true] + exact hag x ⟨h, hx⟩ + · simp [g, h] + refine ⟨g, h1.union_of_isClosed h2 hA hB, ?_⟩ + rintro x (hx | hx) + · simp only [g, hx, ite_true] + exact hfA x hx + · by_cases h : x ∈ A + · simp only [g, h, ite_true] + exact hfA x h + · simp only [g, h, ite_false] + exact hfB x hx + +/-- Two functions with logarithms on each of two closed sets that meet in two points have a +nontrivial product of powers with a logarithm on the union. Each function has one integer +obstruction: how much its two logarithms fail to agree at `q` once they agree at `p`. -/ +theorem exists_zpow_mul_zpow_hasLogOn {T : Type u} [TopologicalSpace T] {A B : Set T} + (hA : IsClosed A) (hB : IsClosed B) {p q : T} (hp : p ∈ A ∩ B) (hq : q ∈ A ∩ B) + (hinter : A ∩ B = {p, q}) {f₁ f₂ : T → ℂ} + (h1A : HasLogOn A f₁) (h1B : HasLogOn B f₁) (h2A : HasLogOn A f₂) (h2B : HasLogOn B f₂) : + ∃ m₁ m₂ : ℤ, (m₁ ≠ 0 ∨ m₂ ≠ 0) ∧ HasLogOn (A ∪ B) fun x => f₁ x ^ m₁ * f₂ x ^ m₂ := by + obtain ⟨g1A, c1A, e1A⟩ := h1A + obtain ⟨g1B, c1B, e1B⟩ := h1B + obtain ⟨g2A, c2A, e2A⟩ := h2A + obtain ⟨g2B, c2B, e2B⟩ := h2B + have hint : ∀ {f gA gB : T → ℂ}, (∀ x ∈ A, f x = exp (gA x)) → (∀ x ∈ B, f x = exp (gB x)) → + ∀ x ∈ A ∩ B, ∃ n : ℤ, gA x - gB x = n * (2 * Real.pi * I) := by + intro f gA gB hA hB x hx + refine Complex.exp_eq_one_iff.mp ?_ + rw [exp_sub, ← hA x hx.1, ← hB x hx.2] + have : exp (gB x) ≠ 0 := exp_ne_zero _ + rw [← hB x hx.2] at this + exact div_self this + obtain ⟨n1p, h1p⟩ := hint e1A e1B p hp + obtain ⟨n1q, h1q⟩ := hint e1A e1B q hq + obtain ⟨n2p, h2p⟩ := hint e2A e2B p hp + obtain ⟨n2q, h2q⟩ := hint e2A e2B q hq + -- The obstructions of the two functions. + set n₁ := n1q - n1p + set n₂ := n2q - n2p + obtain ⟨m₁, m₂, hm, hzero⟩ : ∃ m₁ m₂ : ℤ, (m₁ ≠ 0 ∨ m₂ ≠ 0) ∧ m₁ * n₁ + m₂ * n₂ = 0 := by + by_cases h : n₁ = 0 + · exact ⟨1, 0, Or.inl one_ne_zero, by simp [h]⟩ + · exact ⟨n₂, -n₁, Or.inr (neg_ne_zero.mpr h), by ring⟩ + let c : ℂ := ((m₁ * n1p + m₂ * n2p : ℤ) : ℂ) * (2 * Real.pi * I) + have hexpc : exp c = 1 := Complex.exp_eq_one_iff.mpr ⟨_, rfl⟩ + have hzero' : (m₁ : ℂ) * ((n1q : ℂ) - n1p) + (m₂ : ℂ) * ((n2q : ℂ) - n2p) = 0 := by + have : ((m₁ * n₁ + m₂ * n₂ : ℤ) : ℂ) = 0 := by rw [hzero]; simp + simpa [n₁, n₂] using this + refine ⟨m₁, m₂, hm, ?_⟩ + refine hasLogOn_union (gA := fun x => (m₁ : ℂ) * g1A x + (m₂ : ℂ) * g2A x) + (gB := fun x => (m₁ : ℂ) * g1B x + (m₂ : ℂ) * g2B x + c) hA hB + ((continuousOn_const.mul c1A).add (continuousOn_const.mul c2A)) + (((continuousOn_const.mul c1B).add (continuousOn_const.mul c2B)).add continuousOn_const) + (fun x hx => by + simp only [e1A x hx, e2A x hx, exp_add, exp_int_mul]) + (fun x hx => by + simp only [e1B x hx, e2B x hx, exp_add, exp_int_mul, hexpc, mul_one]) ?_ + rw [hinter] + rintro x (rfl | rfl) + · simp only [c] + push_cast + linear_combination (m₁ : ℂ) * h1p + (m₂ : ℂ) * h2p + · simp only [c] + push_cast + linear_combination (m₁ : ℂ) * h1q + (m₂ : ℂ) * h2q + + (2 * Real.pi * I) * hzero' + +/-- A unit complex number other than `-1` lies in the slit plane. -/ +theorem circle_mem_slitPlane {z : Circle} (hz : (z : ℂ) ≠ -1) : (z : ℂ) ∈ slitPlane := by + rw [mem_slitPlane_iff] + by_contra hcon + push Not at hcon + obtain ⟨h1, h2⟩ := hcon + have h3 : normSq (z : ℂ) = 1 := Circle.normSq_coe z + rw [normSq_apply, h2] at h3 + have h4 : (z : ℂ).re = -1 := by nlinarith + exact hz (Complex.ext (by simp [h4]) (by simp [h2])) + +/-- A function without zeros has a logarithm on an `O`-arc minus a point: the rest of the arc is +an open interval. -/ +theorem hasLogOn_diff_point {T : Type u} [TopologicalSpace T] {F : Set T} (φ : Circle ≃ₜ F) + {f : T → ℂ} (hf : ContinuousOn f F) (hne : ∀ x ∈ F, f x ≠ 0) {x : T} (hx : x ∈ F) : + HasLogOn (F \ {x}) f := by + set w : Circle := φ.symm ⟨x, hx⟩ * Circle.exp Real.pi with hw + let u : ℝ → ℂ := fun t => f (φ (w * Circle.exp t) : T) + have hu : Continuous u := hf.comp_continuous (by fun_prop) fun t => (φ _).2 + obtain ⟨l, hl, hul⟩ := hasLogOn_univ_of_ne_zero hu fun t => hne _ (φ _).2 + have hlc : Continuous l := continuousOn_univ.mp hl + let c : (F \ {x} : Set T) → Circle := fun y => φ.symm ⟨y.1, y.2.1⟩ * w⁻¹ + have hc : Continuous c := by fun_prop + have hsl : ∀ y, ((c y : Circle) : ℂ) ∈ slitPlane := by + intro y + refine circle_mem_slitPlane fun h => y.2.2 ?_ + have h1 : c y = Circle.exp Real.pi := by + apply Circle.ext + rw [h, Circle.coe_exp, exp_pi_mul_I] + have h2 : φ.symm ⟨y.1, y.2.1⟩ = φ.symm ⟨x, hx⟩ := by + have h3 : φ.symm ⟨y.1, y.2.1⟩ = c y * w := by simp [c] + rw [h3, h1, hw, mul_comm, mul_assoc] + have h4 : Circle.exp Real.pi * Circle.exp Real.pi = 1 := by + rw [← Circle.exp_add, ← two_mul, Circle.exp_two_pi] + rw [h4, mul_one] + have h5 := φ.symm.injective h2 + exact congr_arg Subtype.val h5 + rw [hasLogOn_iff_subtype] + refine ⟨⟨fun y => l (arg (c y)), ?_⟩, fun y => ?_⟩ + · refine hlc.comp (continuous_iff_continuousAt.mpr fun y => ?_) + have hcc : Continuous fun y => ((c y : Circle) : ℂ) := by fun_prop + exact ContinuousAt.comp (f := fun y => ((c y : Circle) : ℂ)) (g := arg) + (continuousAt_arg (hsl y)) hcc.continuousAt + · have h1 := hul (arg (c y)) (mem_univ _) + have h2 : w * Circle.exp (arg (c y)) = φ.symm ⟨y.1, y.2.1⟩ := by + rw [Circle.exp_arg] + simp [c] + simp only [u, h2, Homeomorph.apply_symm_apply] at h1 + exact h1 + +variable {F : Set ℂ} + +/-- The two semicircles of the unit circle cover it. -/ +private theorem exists_semicircle (w : Circle) : + ∃ t : 𝕀, w = Circle.exp (Real.pi * t) ∨ w = Circle.exp (-(Real.pi * t)) := by + have hpi := Real.pi_pos + have hdiv : ∀ {θ : ℝ}, 0 ≤ θ → θ ≤ Real.pi → θ / Real.pi ∈ unitInterval := fun h0 h1 => + ⟨div_nonneg h0 hpi.le, (div_le_one hpi).mpr h1⟩ + rcases le_total 0 (arg (w : ℂ)) with h | h + · refine ⟨⟨_, hdiv h (arg_le_pi _)⟩, Or.inl ?_⟩ + simp only + rw [mul_div_cancel₀ _ hpi.ne', Circle.exp_arg] + · refine ⟨⟨_, hdiv (neg_nonneg.mpr h) (by linarith [neg_pi_lt_arg (w : ℂ)])⟩, Or.inr ?_⟩ + simp only + rw [mul_div_cancel₀ _ hpi.ne', neg_neg, Circle.exp_arg] + +/-- The two semicircles of the unit circle meet only at `1` and `-1`. -/ +private theorem semicircle_inter {s t : 𝕀} (h : Circle.exp (Real.pi * s) = + Circle.exp (-(Real.pi * t))) : + (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h + have hpi := Real.pi_pos + have hs := s.2 + have ht := t.2 + have hst : (s : ℝ) + t = 2 * m := by + have : Real.pi * ((s : ℝ) + t) = Real.pi * (2 * m) := by linarith + exact mul_left_cancel₀ hpi.ne' this + have hm0 : (0 : ℝ) ≤ m := by linarith [hs.1, ht.1] + have hm1 : (m : ℝ) ≤ 1 := by linarith [hs.2, ht.2] + have hm0' : 0 ≤ m := by exact_mod_cast hm0 + have hm1' : m ≤ 1 := by exact_mod_cast hm1 + obtain rfl | rfl : m = 0 ∨ m = 1 := by omega + · left + simp only [Int.cast_zero, mul_zero] at hst + exact ⟨Subtype.ext (show (s : ℝ) = 0 by linarith [ht.1, hs.1]), + Subtype.ext (show (t : ℝ) = 0 by linarith [ht.1, hs.1])⟩ + · right + simp only [Int.cast_one, mul_one] at hst + exact ⟨Subtype.ext (show (s : ℝ) = 1 by linarith [ht.2, hs.2]), + Subtype.ext (show (t : ℝ) = 1 by linarith [ht.2, hs.2])⟩ + +/-- The upper semicircle of the `O`-arc given by `φ`. -/ +noncomputable def upperArc (φ : Circle ≃ₜ F) : C(𝕀, ℂ) := + ⟨fun t => (φ (Circle.exp (Real.pi * t))).1, by fun_prop⟩ + +/-- The lower semicircle of the `O`-arc given by `φ`. -/ +noncomputable def lowerArc (φ : Circle ≃ₜ F) : C(𝕀, ℂ) := + ⟨fun t => (φ (Circle.exp (-(Real.pi * t)))).1, by fun_prop⟩ + +theorem lowerArc_zero (φ : Circle ≃ₜ F) : lowerArc φ 0 = upperArc φ 0 := by + change (φ (Circle.exp (-(Real.pi * ((0 : 𝕀) : ℝ))))).1 = (φ (Circle.exp (Real.pi * + ((0 : 𝕀) : ℝ)))).1 + simp + +theorem lowerArc_one (φ : Circle ≃ₜ F) : lowerArc φ 1 = upperArc φ 1 := by + have h3 : Circle.exp (-(Real.pi * ((1 : 𝕀) : ℝ))) = Circle.exp (Real.pi * ((1 : 𝕀) : ℝ)) := + Circle.exp_eq_exp.mpr ⟨-1, by push_cast; ring⟩ + change (φ (Circle.exp (-(Real.pi * ((1 : 𝕀) : ℝ))))).1 = (φ (Circle.exp (Real.pi * + ((1 : 𝕀) : ℝ)))).1 + rw [h3] + +theorem range_upper_union_lower (φ : Circle ≃ₜ F) : + range (upperArc φ) ∪ range (lowerArc φ) = F := by + ext x + constructor + · rintro (⟨t, rfl⟩ | ⟨t, rfl⟩) <;> exact (φ _).2 + · intro hx + obtain ⟨t, ht | ht⟩ := exists_semicircle (φ.symm ⟨x, hx⟩) + · refine Or.inl ⟨t, ?_⟩ + change (φ (Circle.exp (Real.pi * t))).1 = x + rw [← ht]; simp + · refine Or.inr ⟨t, ?_⟩ + change (φ (Circle.exp (-(Real.pi * t)))).1 = x + rw [← ht]; simp + +theorem range_upper_inter_lower (φ : Circle ≃ₜ F) : + range (upperArc φ) ∩ range (lowerArc φ) = {upperArc φ 0, upperArc φ 1} := by + ext x + constructor + · rintro ⟨⟨s, rfl⟩, ⟨t, ht⟩⟩ + have h : Circle.exp (Real.pi * s) = Circle.exp (-(Real.pi * t)) := + φ.injective (Subtype.ext ht.symm) + rcases semicircle_inter h with ⟨rfl, -⟩ | ⟨rfl, -⟩ + · exact Or.inl rfl + · exact Or.inr rfl + · have h1 := lowerArc_zero φ + have h2 := lowerArc_one φ + rintro (rfl | rfl) + · exact ⟨⟨0, rfl⟩, ⟨0, h1⟩⟩ + · exact ⟨⟨1, rfl⟩, ⟨1, h2⟩⟩ + +theorem upperArc_zero_ne_one (φ : Circle ≃ₜ F) : upperArc φ 0 ≠ upperArc φ 1 := by + intro h + have h1 : Circle.exp (Real.pi * ((0 : 𝕀) : ℝ)) = Circle.exp (Real.pi * ((1 : 𝕀) : ℝ)) := + φ.injective (Subtype.ext h) + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h1 + simp only [Icc.coe_zero, mul_zero, Icc.coe_one, mul_one] at hm + have hpi := Real.pi_pos + have h2 : (2 * m + 1 : ℝ) = 0 := by + have : Real.pi * (2 * m + 1) = 0 := by linarith + exact (mul_eq_zero.mp this).resolve_left hpi.ne' + have h3 : (2 * m + 1 : ℤ) = 0 := by exact_mod_cast h2 + omega + +theorem isCompact_of_oArc (φ : Circle ≃ₜ F) : IsCompact F := by + have : CompactSpace F := φ.compactSpace + exact isCompact_iff_compactSpace.mpr this + +/-- A function on an `O`-arc without zeros has a logarithm on each semicircle: a semicircle is a +subset of the arc minus a point. -/ +private theorem hasLogOn_semicircles (φ : Circle ≃ₜ F) {f : ℂ → ℂ} (hf : ContinuousOn f F) + (hne : ∀ x ∈ F, f x ≠ 0) : + HasLogOn (range (upperArc φ)) f ∧ HasLogOn (range (lowerArc φ)) f := by + let m : 𝕀 := ⟨1 / 2, by norm_num, by norm_num⟩ + have hm0 : m ≠ 0 := fun h => by + have := congr_arg Subtype.val h + norm_num [m] at this + have hm1 : m ≠ 1 := fun h => by + have := congr_arg Subtype.val h + norm_num [m] at this + constructor + · refine (hasLogOn_diff_point φ hf hne (x := lowerArc φ m) (φ _).2).mono ?_ + rintro _ ⟨t, rfl⟩ + refine ⟨(φ _).2, fun h => ?_⟩ + have h' : Circle.exp (Real.pi * t) = Circle.exp (-(Real.pi * m)) := + φ.injective (Subtype.ext h) + rcases semicircle_inter h' with ⟨-, h2⟩ | ⟨-, h2⟩ + · exact hm0 h2 + · exact hm1 h2 + · refine (hasLogOn_diff_point φ hf hne (x := upperArc φ m) (φ _).2).mono ?_ + rintro _ ⟨t, rfl⟩ + refine ⟨(φ _).2, fun h => ?_⟩ + have h' : Circle.exp (Real.pi * m) = Circle.exp (-(Real.pi * t)) := + (φ.injective (Subtype.ext h)).symm + rcases semicircle_inter h' with ⟨h2, -⟩ | ⟨h2, -⟩ + · exact hm0 h2 + · exact hm1 h2 + +/-- The function $(z - a) / (z - b)$ is continuous and without zeros off `a, b`. -/ +private theorem div_sub_continuousOn {K : Set ℂ} {a b : ℂ} (hb : b ∉ K) : + ContinuousOn (fun z => (z - a) / (z - b)) K := by + refine (continuousOn_id.sub continuousOn_const).div (continuousOn_id.sub continuousOn_const) ?_ + intro z hz h + exact hb (by rwa [sub_eq_zero.mp h] at hz) + +private theorem div_sub_ne_zero {K : Set ℂ} {a b : ℂ} (ha : a ∉ K) (hb : b ∉ K) : + ∀ z ∈ K, (z - a) / (z - b) ≠ 0 := by + intro z hz + refine div_ne_zero (fun h => ha ?_) (fun h => hb ?_) + · rwa [sub_eq_zero.mp h] at hz + · rwa [sub_eq_zero.mp h] at hz + +/-- Let `a, b, c` lie in three different components of the complement of the `O`-arc `F`, with the +component of `a` bounded. Then the exponent `m₁` of any logarithm below vanishes. -/ +private theorem exponent_eq_zero (hF : IsClosed F) {a b c : ℂ} (hb : b ∉ F) (hc : c ∉ F) + (ha : a ∉ F) (hbdd : Bornology.IsBounded (connectedComponentIn Fᶜ a)) + (hab : connectedComponentIn Fᶜ a ≠ connectedComponentIn Fᶜ b) + (hac : connectedComponentIn Fᶜ a ≠ connectedComponentIn Fᶜ c) {m₁ m₂ : ℤ} + (hlog : HasLogOn F fun z => ((z - a) / (z - c)) ^ m₁ * ((z - b) / (z - c)) ^ m₂) : m₁ = 0 := by + have hbU := notMem_closure_component hF hb hab + have hcU := notMem_closure_component hF hc hac + have hbne : ∀ z ∈ closure (connectedComponentIn Fᶜ a), z - b ≠ 0 := fun z hz h => by + rw [sub_eq_zero] at h + exact hbU (h ▸ hz) + have hcne : ∀ z ∈ closure (connectedComponentIn Fᶜ a), z - c ≠ 0 := fun z hz h => by + rw [sub_eq_zero] at h + exact hcU (h ▸ hz) + refine eq_zero_of_hasLogOn_frontier (isOpen_component hF a) hbdd (mem_connectedComponentIn ha) + (h := fun z => (z - c) ^ m₁ * (z - b) ^ (-m₂) * (z - c) ^ m₂) ?_ ?_ + ((hlog.mono (frontier_component_subset hF a)).congr fun z hz => ?_) + · refine ((ContinuousOn.zpow₀ (continuousOn_id.sub continuousOn_const) m₁ + fun z hz => Or.inl (hcne z hz)).mul (ContinuousOn.zpow₀ + (continuousOn_id.sub continuousOn_const) (-m₂) fun z hz => Or.inl (hbne z hz))).mul + (ContinuousOn.zpow₀ (continuousOn_id.sub continuousOn_const) m₂ + fun z hz => Or.inl (hcne z hz)) + · intro z hz + exact mul_ne_zero (mul_ne_zero (zpow_ne_zero _ (hcne z hz)) (zpow_ne_zero _ (hbne z hz))) + (zpow_ne_zero _ (hcne z hz)) + · have hzcl : z ∈ closure (connectedComponentIn Fᶜ a) := by + exact (frontier_subset_closure hz) + have h1 := hcne z hzcl + have h2 := hbne z hzcl + rw [div_zpow, div_zpow, zpow_neg] + have h3 := zpow_ne_zero m₁ h1 + have h4 := zpow_ne_zero m₂ h1 + have h5 := zpow_ne_zero m₂ h2 + field_simp + +/-- **At most two components.** Three different components of the complement of an `O`-arc do +not exist. -/ +theorem component_eq_or_eq (φ : Circle ≃ₜ F) {a b c : ℂ} (ha : a ∉ F) (hb : b ∉ F) (hc : c ∉ F) + (hab : connectedComponentIn Fᶜ a ≠ connectedComponentIn Fᶜ b) + (hac : connectedComponentIn Fᶜ a ≠ connectedComponentIn Fᶜ c) + (hbc : connectedComponentIn Fᶜ b ≠ connectedComponentIn Fᶜ c) : False := by + have hcomp := isCompact_of_oArc φ + have hF := hcomp.isClosed + have main : ∀ {a b c : ℂ}, a ∉ F → b ∉ F → c ∉ F → + connectedComponentIn Fᶜ a ≠ connectedComponentIn Fᶜ b → + connectedComponentIn Fᶜ a ≠ connectedComponentIn Fᶜ c → + connectedComponentIn Fᶜ b ≠ connectedComponentIn Fᶜ c → + Bornology.IsBounded (connectedComponentIn Fᶜ a) → + Bornology.IsBounded (connectedComponentIn Fᶜ b) → False := by + intro a b c ha hb hc hab hac hbc hba hbb + obtain ⟨h1A, h1B⟩ := hasLogOn_semicircles φ (div_sub_continuousOn (a := a) hc) + (div_sub_ne_zero ha hc) + obtain ⟨h2A, h2B⟩ := hasLogOn_semicircles φ (div_sub_continuousOn (a := b) hc) + (div_sub_ne_zero hb hc) + have hA : IsClosed (range (upperArc φ)) := (isCompact_range (upperArc φ).continuous).isClosed + have hB : IsClosed (range (lowerArc φ)) := (isCompact_range (lowerArc φ).continuous).isClosed + have hinter := range_upper_inter_lower φ + have hp : upperArc φ 0 ∈ range (upperArc φ) ∩ range (lowerArc φ) := by rw [hinter]; simp + have hq : upperArc φ 1 ∈ range (upperArc φ) ∩ range (lowerArc φ) := by rw [hinter]; simp + obtain ⟨m₁, m₂, hm, hlog⟩ := exists_zpow_mul_zpow_hasLogOn hA hB hp hq hinter h1A h1B h2A h2B + rw [range_upper_union_lower] at hlog + rcases hm with hm | hm + · exact hm (exponent_eq_zero hF hb hc ha hba hab hac hlog) + · refine hm (exponent_eq_zero (m₂ := m₁) hF ha hc hb hbb hab.symm hbc ?_) + exact hlog.congr fun z _ => mul_comm _ _ + rcases component_bounded_or hcomp ha hb hab with h1 | h1 + · rcases component_bounded_or hcomp hb hc hbc with h2 | h2 + · exact main ha hb hc hab hac hbc h1 h2 + · exact main ha hc hb hac hab hbc.symm h1 h2 + · rcases component_bounded_or hcomp ha hc hac with h2 | h2 + · exact main ha hb hc hab hac hbc h2 h1 + · exact main hb hc ha hbc hab.symm hac.symm h1 h2 + +/-- The frontier of a component of the complement of an `O`-arc, when there are two components, +is the whole arc. If `x` were missing, the frontier `K` would lie in the arc minus `x`, so the +function $(z - a)/(z - b)$ would have a logarithm on `K`, and `a, b` would lie in one component of +the complement of `K`. But a connected set from `a` to `b` must meet the frontier `K`. -/ +theorem subset_frontier_component (φ : Circle ≃ₜ F) {a b : ℂ} (ha : a ∉ F) (hb : b ∉ F) + (hab : connectedComponentIn Fᶜ a ≠ connectedComponentIn Fᶜ b) : + F ⊆ frontier (connectedComponentIn Fᶜ a) := by + intro x hx + by_contra hxU + have hF := (isCompact_of_oArc φ).isClosed + set U := connectedComponentIn Fᶜ a with hUdef + have hUo : IsOpen U := isOpen_component hF a + have hsub : frontier U ⊆ F := frontier_component_subset hF a + have hK : IsCompact (frontier U) := (isCompact_of_oArc φ).of_isClosed_subset isClosed_frontier + hsub + have haU : a ∈ U := mem_connectedComponentIn ha + have hbU : b ∉ U := fun h => hab (connectedComponentIn_eq h) + have hlog : HasLogOn (frontier U) fun z => (z - a) / (z - b) := + (hasLogOn_diff_point φ (div_sub_continuousOn hb) (div_sub_ne_zero ha hb) hx).mono + fun y hy => ⟨hsub hy, fun h => hxU (h ▸ hy)⟩ + have haK : a ∉ frontier U := fun h => ha (hsub h) + have hbK : b ∉ frontier U := fun h => hb (hsub h) + have heq := component_eq_of_hasLogOn hK haK hbK hlog + have hbC : b ∈ connectedComponentIn (frontier U)ᶜ a := by + rw [heq]; exact mem_connectedComponentIn hbK + have hC := isPreconnected_connectedComponentIn (F := (frontier U)ᶜ) (x := a) + obtain ⟨y, hy1, hy2⟩ := inter_frontier_nonempty_of_isPreconnected hC + ⟨a, mem_connectedComponentIn haK, haU⟩ ⟨b, hbC, hbU⟩ + exact connectedComponentIn_subset _ _ hy1 hy2 + +/-- If `U, V` are disjoint nonempty open preconnected sets with union `X`, then the components of +`X` are `U` and `V`. -/ +theorem componentsIn_eq_pair {T : Type u} [TopologicalSpace T] {X U V : Set T} (hU : IsOpen U) + (hV : IsOpen V) (hUc : IsPreconnected U) (hVc : IsPreconnected V) (hUn : U.Nonempty) + (hVn : V.Nonempty) (hdisj : Disjoint U V) (hX : X = U ∪ V) : + componentsIn X = {U, V} := by + have key : ∀ {U V : Set T}, IsOpen U → IsOpen V → IsPreconnected U → Disjoint U V → + ∀ x ∈ U, connectedComponentIn (U ∪ V) x = U := by + intro U V hU hV hUc hdisj x hx + refine Subset.antisymm ?_ (hUc.subset_connectedComponentIn hx subset_union_left) + have hC := isPreconnected_connectedComponentIn (F := U ∪ V) (x := x) + have hsub := connectedComponentIn_subset (U ∪ V) x + have := hC.subset_left_of_subset_union hU hV hdisj hsub + ⟨x, mem_connectedComponentIn (Or.inl hx), hx⟩ + exact this + subst hX + ext C + simp only [componentsIn, mem_image, mem_insert_iff, mem_singleton_iff] + constructor + · rintro ⟨x, hx | hx, rfl⟩ + · exact Or.inl (key hU hV hUc hdisj x hx) + · right + rw [union_comm] + exact key hV hU hVc hdisj.symm x hx + · rintro (rfl | rfl) + · obtain ⟨x, hx⟩ := hUn + exact ⟨x, Or.inl hx, key hU hV hUc hdisj x hx⟩ + · obtain ⟨x, hx⟩ := hVn + refine ⟨x, Or.inr hx, ?_⟩ + rw [union_comm] + exact key hV hU hVc hdisj.symm x hx + +/-- **The Jordan curve theorem in the complex plane.** -/ +theorem jordan_complex (φ : Circle ≃ₜ F) : + ∃ A B, IsJordanSplit F A B ∧ Bornology.IsBounded A ∧ ¬ Bornology.IsBounded B := by + have hcomp := isCompact_of_oArc φ + have hF := hcomp.isClosed + have hnotconn : ¬ IsPreconnected Fᶜ := by + have h := not_isPreconnected_compl_union (α := upperArc φ) (β := lowerArc φ) rfl rfl + (lowerArc_zero φ) (lowerArc_one φ) (upperArc_zero_ne_one φ) (range_upper_inter_lower φ) + rwa [range_upper_union_lower] at h + -- Two points in different components. + have hne : ∃ a b, a ∉ F ∧ b ∉ F ∧ connectedComponentIn Fᶜ a ≠ connectedComponentIn Fᶜ b := by + by_contra hcon + push Not at hcon + apply hnotconn + by_cases hemp : (Fᶜ).Nonempty + · obtain ⟨x, hx⟩ := hemp + have : Fᶜ = connectedComponentIn Fᶜ x := by + refine Subset.antisymm (fun y hy => ?_) (connectedComponentIn_subset _ _) + rw [hcon x y hx hy] + exact mem_connectedComponentIn hy + rw [this] + exact isPreconnected_connectedComponentIn + · rw [not_nonempty_iff_eq_empty] at hemp + rw [hemp] + exact isPreconnected_empty + obtain ⟨a₀, b₀, ha₀, hb₀, hab₀⟩ := hne + -- Choose `a` in a bounded component. + obtain ⟨a, b, ha, hb, hab, hbdd⟩ : ∃ a b, a ∉ F ∧ b ∉ F ∧ + connectedComponentIn Fᶜ a ≠ connectedComponentIn Fᶜ b ∧ + Bornology.IsBounded (connectedComponentIn Fᶜ a) := by + rcases component_bounded_or hcomp ha₀ hb₀ hab₀ with h | h + · exact ⟨a₀, b₀, ha₀, hb₀, hab₀, h⟩ + · exact ⟨b₀, a₀, hb₀, ha₀, hab₀.symm, h⟩ + have hcover : ∀ c, c ∉ F → c ∈ connectedComponentIn Fᶜ a ∨ c ∈ connectedComponentIn Fᶜ b := by + intro c hc + by_contra hcon + push Not at hcon + refine component_eq_or_eq φ ha hb hc hab (fun h => hcon.1 ?_) (fun h => hcon.2 ?_) + · rw [h]; exact mem_connectedComponentIn hc + · rw [h]; exact mem_connectedComponentIn hc + have hunion : Fᶜ = connectedComponentIn Fᶜ a ∪ connectedComponentIn Fᶜ b := by + refine Subset.antisymm (fun c hc => hcover c hc) (union_subset ?_ ?_) <;> + exact connectedComponentIn_subset _ _ + have hdisj : Disjoint (connectedComponentIn Fᶜ a) (connectedComponentIn Fᶜ b) := by + refine Set.disjoint_left.mpr fun x hxa hxb => hab ?_ + rw [connectedComponentIn_eq hxa, connectedComponentIn_eq hxb] + refine ⟨_, _, ⟨hab, ?_, ?_, ?_⟩, hbdd, ?_⟩ + · rw [← compl_eq_univ_sdiff] + exact componentsIn_eq_pair (isOpen_component hF a) (isOpen_component hF b) + isPreconnected_connectedComponentIn isPreconnected_connectedComponentIn + ⟨a, mem_connectedComponentIn ha⟩ ⟨b, mem_connectedComponentIn hb⟩ hdisj hunion + · exact Subset.antisymm (frontier_component_subset hF a) (subset_frontier_component φ ha hb hab) + · exact Subset.antisymm (frontier_component_subset hF b) + (subset_frontier_component φ hb ha hab.symm) + · intro hbddb + have huniv : (univ : Set ℂ) = F ∪ (connectedComponentIn Fᶜ a ∪ connectedComponentIn Fᶜ b) := by + rw [← hunion, union_compl_self] + have : Bornology.IsBounded (univ : Set ℂ) := by + rw [huniv] + exact hcomp.isBounded.union (hbdd.union hbddb) + exact NormedSpace.unbounded_univ ℝ ℂ this + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/LocalCoh.lean b/LeanPool/GraphMinor/Surface/LocalCoh.lean new file mode 100644 index 0000000000..2070a02c37 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/LocalCoh.lean @@ -0,0 +1,474 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.WordSurface +public import Mathlib.Topology.UniformSpace.Compact + +/-! +# First cohomology with local cocycles + +For a topological space `X` and an abelian group `A`, a local cocycle is a function `φ : X → X → A` +that adds up on +triples of near points. Two of them are equivalent if near the diagonal their difference is the +difference of a +function on `X`. This is the first Alexander-Spanier cohomology of `X` (see E. Spanier, Algebraic +Topology, Chapter 6, +Section 4). `KCl X A` is the set of classes that vanish on the boundary of `X`. It depends only on +the space, so its +size is unchanged by homeomorphisms (`card_kCl_congr`). + +On a closed disc a local cocycle pulled back from `X` has a primitive (`exists_prim`), by summing it +along a radius. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +universe u v + +section Basic + +variable {X : Type u} [TopologicalSpace X] {X' : Type v} [TopologicalSpace X'] {A : Type} + [AddCommGroup A] + +/-- A set that is a neighbourhood of each point of the diagonal. -/ +def NearDiag (N : Set (X × X)) : Prop := ∀ x, N ∈ 𝓝 (x, x) + +theorem NearDiag.inter {N N' : Set (X × X)} (h : NearDiag N) (h' : NearDiag N') : NearDiag (N ∩ N') + := + fun x => Filter.inter_mem (h x) (h' x) + +theorem NearDiag.mono {N N' : Set (X × X)} (h : NearDiag N) (hs : N ⊆ N') : NearDiag N' := + fun x => Filter.mem_of_superset (h x) hs + +theorem NearDiag.mem {N : Set (X × X)} (h : NearDiag N) (x : X) : (x, x) ∈ N := mem_of_mem_nhds + (h x) + +/-- A local cocycle. The group `A` need not be commutative. -/ +def IsCoc {A : Type} [Add A] (φ : X → X → A) : Prop := + ∃ N : Set (X × X), NearDiag N ∧ ∀ x y z, (x, y) ∈ N → (y, z) ∈ N → (x, z) ∈ N → φ x y + φ y z + = φ x z + +/-- Near the diagonal the difference of `φ` and `φ'` is the difference of a function. -/ +def CohRel (φ φ' : X → X → A) : Prop := + ∃ (h : X → A) (N : Set (X × X)), NearDiag N ∧ ∀ x y, (x, y) ∈ N → φ x y - φ' x y = h y - h x + +/-- Near the diagonal of the boundary, `φ` is the difference of a function. -/ +def BdTriv {A : Type} [AddGroup A] (φ : X → X → A) : Prop := + ∃ (h : X → A) (N : Set (X × X)), NearDiag N ∧ ∀ x ∈ bd X, ∀ y ∈ bd X, (x, y) ∈ N → φ x y + = -h x + h y + +/-- The local cocycles that vanish on the boundary. -/ +def KSet (X : Type u) [TopologicalSpace X] (A : Type) [AddCommGroup A] : Set (X → X → A) := + {φ | IsCoc φ ∧ BdTriv φ} + +theorem CohRel.refl (φ : X → X → A) : CohRel φ φ := + ⟨0, univ, fun _ => univ_mem, fun x y _ => by simp⟩ + +theorem CohRel.symm {φ φ' : X → X → A} (h : CohRel φ φ') : CohRel φ' φ := by + obtain ⟨g, N, hN, h⟩ := h + refine ⟨-g, N, hN, fun x y hxy => ?_⟩ + have := h x y hxy + simp only [Pi.neg_apply] + rw [← neg_sub (φ x y), this] + abel + +theorem CohRel.trans {φ φ' φ'' : X → X → A} (h : CohRel φ φ') (h' : CohRel φ' φ'') : CohRel φ φ'' + := by + obtain ⟨g, N, hN, h⟩ := h + obtain ⟨g', N', hN', h'⟩ := h' + refine ⟨g + g', N ∩ N', hN.inter hN', fun x y hxy => ?_⟩ + have h1 := h x y hxy.1 + have h2 := h' x y hxy.2 + simp only [Pi.add_apply] + calc φ x y - φ'' x y = (φ x y - φ' x y) + (φ' x y - φ'' x y) := by abel + _ = _ := by rw [h1, h2]; abel + +/-- The equivalence of local cocycles. -/ +def kSetoid (X : Type u) [TopologicalSpace X] (A : Type) [AddCommGroup A] : Setoid (KSet X A) := + ⟨fun φ φ' => CohRel φ.1 φ'.1, ⟨fun φ => .refl φ.1, fun h => h.symm, fun h h' => h.trans h'⟩⟩ + +/-- The classes of local cocycles that vanish on the boundary. -/ +def KCl (X : Type u) [TopologicalSpace X] (A : Type) [AddCommGroup A] : Type u := Quotient + (kSetoid X A) + +/-- The pull back of a function of two points. -/ +def pbk (e : X → X') (φ : X' → X' → A) : X → X → A := fun x y => φ (e x) (e y) + +theorem NearDiag.pull (e : X ≃ₜ X') {N : Set (X' × X')} (h : NearDiag N) : + NearDiag ((fun p : X × X => (e p.1, e p.2)) ⁻¹' N) := fun x => by + have hc : Continuous fun p : X × X => (e p.1, e p.2) := by fun_prop + exact hc.continuousAt.preimage_mem_nhds (h (e x)) + +theorem pbk_mem (e : X ≃ₜ X') {φ : X' → X' → A} (h : φ ∈ KSet X' A) : pbk e φ ∈ KSet X A := by + obtain ⟨⟨N, hN, h1⟩, g, N', hN', h2⟩ := h + refine ⟨⟨_, hN.pull e, fun x y z h3 h4 h5 => h1 _ _ _ h3 h4 h5⟩, g ∘ e, _, hN'.pull e, + fun x hx y hy hxy => ?_⟩ + have hb : ∀ {x : X}, x ∈ bd X → e x ∈ bd X' := fun {x} hx => by + have h3 := image_bd_homeomorph e + rw [← h3] + exact mem_image_of_mem _ hx + exact h2 _ (hb hx) _ (hb hy) hxy + +theorem pbk_rel (e : X ≃ₜ X') {φ φ' : X' → X' → A} (h : CohRel φ φ') : CohRel (pbk e φ) (pbk e φ') + := by + obtain ⟨g, N, hN, h⟩ := h + exact ⟨g ∘ e, _, hN.pull e, fun x y hxy => h _ _ hxy⟩ + +/-- A homeomorphism gives a bijection of the classes. -/ +theorem card_kCl_congr (e : X ≃ₜ X') : Nat.card (KCl X A) = Nat.card (KCl X' A) := by + let s : KSet X' A ≃ KSet X A := + { toFun := fun φ => ⟨pbk e φ.1, pbk_mem e φ.2⟩ + invFun := fun φ => ⟨pbk e.symm φ.1, pbk_mem e.symm φ.2⟩ + left_inv := fun φ => Subtype.ext (by + funext x y + simp [pbk]) + right_inv := fun φ => Subtype.ext (by + funext x y + simp [pbk]) } + have hs : ∀ a b : KSet X' A, (kSetoid X' A).r a b ↔ (kSetoid X A).r (s a) (s b) := by + intro a b + refine ⟨fun h => pbk_rel e h, fun h => ?_⟩ + have h1 : CohRel (pbk e.symm (pbk e a.1)) (pbk e.symm (pbk e b.1)) := pbk_rel e.symm h + have h2 : ∀ φ : KSet X' A, pbk e.symm (pbk e φ.1) = φ.1 := fun φ => by + funext x y + simp [pbk] + rw [h2, h2] at h1 + exact h1 + exact (Nat.card_congr (Quotient.congr s hs)).symm + +end Basic + +section Disc + +variable {Y : Type u} [TopologicalSpace Y] {A : Type} [AddGroup A] + +/-- A primitive of a local cocycle pulled back to the unit disc. -/ +def IsPrim (φ : Y → Y → A) (F : ℂ → Y) (g : ℂ → A) : Prop := + ∃ ε > 0, ∀ a ∈ closedBall (0 : ℂ) 1, ∀ b ∈ closedBall (0 : ℂ) 1, ‖a - b‖ < ε → φ (F a) (F b) + = -g a + g b + +theorem exists_eps {F : ℂ → Y} {K : Set ℂ} (hK : IsCompact K) (hF : ContinuousOn F K) {N : Set + (Y × Y)} (hN : NearDiag N) : + ∃ ε > 0, ∀ a ∈ K, ∀ b ∈ K, ‖a - b‖ < ε → (F a, F b) ∈ N := by + have : CompactSpace K := isCompact_iff_compactSpace.mp hK + let M : Set (K × K) := (fun p : K × K => (F p.1, F p.2)) ⁻¹' N + have hc : Continuous fun p : K × K => (F p.1, F p.2) := by + have h1 : Continuous fun a : K => F a := hF.comp_continuous continuous_subtype_val fun a => a.2 + exact (h1.comp continuous_fst).prodMk (h1.comp continuous_snd) + have hM : M ∈ 𝓝ˢ (diagonal K) := by + rw [mem_nhdsSet_iff_forall] + rintro ⟨a, a'⟩ h + have h' : a = a' := h + subst h' + have h1 := hN (F a) + have h2 : (fun p : K × K => (F p.1, F p.2)) ⁻¹' N ∈ 𝓝 (a, a) := + hc.continuousAt.preimage_mem_nhds h1 + exact h2 + rw [nhdsSet_diagonal_eq_uniformity, Metric.mem_uniformity_dist] at hM + obtain ⟨ε, h0, h1⟩ := hM + refine ⟨ε, h0, fun a ha b hb hab => ?_⟩ + exact h1 (a := ⟨a, ha⟩) (b := ⟨b, hb⟩) (by simpa [Subtype.dist_eq, dist_eq_norm] using hab) + +/-- A local cocycle pulled back to the unit disc has a primitive. Sum it along the radius to the +point. -/ +theorem exists_prim {φ : Y → Y → A} (hφ : IsCoc φ) {F : ℂ → Y} (hF : ContinuousOn F + (closedBall 0 1)) : + ∃ g, IsPrim φ F g := by + obtain ⟨N, hN, hc⟩ := hφ + obtain ⟨ε, h0, hε⟩ := exists_eps (isCompact_closedBall 0 1) hF hN + obtain ⟨m, hm⟩ := exists_nat_gt (4 / ε) + have hm0 : (0 : ℝ) < m := lt_trans (by positivity) hm + have hmε : 1 / (m : ℝ) < ε / 4 := by + rw [div_lt_iff₀ hm0] + have := (div_lt_iff₀ h0).mp hm + linarith + let P : ℂ → ℕ → ℂ := fun x k => ((k / m : ℝ) : ℂ) * x + have hP : ∀ x ∈ closedBall (0 : ℂ) 1, ∀ k ≤ m, P x k ∈ closedBall (0 : ℂ) 1 := by + intro x hx k hk + simp only [P, mem_closedBall, dist_zero_right, norm_mul, Complex.norm_real, + Real.norm_eq_abs] at hx ⊢ + have h1 : (k : ℝ) / m ≤ 1 := by + rw [div_le_one hm0] + exact_mod_cast hk + rw [abs_of_nonneg (by positivity)] + have := norm_nonneg x + nlinarith + have hstep : ∀ x ∈ closedBall (0 : ℂ) 1, ∀ k, ‖P x k - P x (k + 1)‖ < ε / 2 := by + intro x hx k + have h1 : P x k - P x (k + 1) = ((-1 / m : ℝ) : ℂ) * x := by + simp only [P] + push_cast + have : (m : ℂ) ≠ 0 := by exact_mod_cast hm0.ne' + field_simp + ring + rw [h1, norm_mul, Complex.norm_real, Real.norm_eq_abs, neg_div, abs_neg, + abs_of_pos (by positivity)] + have hx' : ‖x‖ ≤ 1 := by simpa using hx + have := norm_nonneg x + have h2 : 0 < 1 / (m : ℝ) := by positivity + nlinarith + have hrung : ∀ x y, ∀ k ≤ m, ‖P x k - P y k‖ ≤ ‖x - y‖ := by + intro x y k hk + have h1 : P x k - P y k = ((k / m : ℝ) : ℂ) * (x - y) := by + simp only [P] + push_cast + ring + rw [h1, norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (by positivity)] + have h2 : (k : ℝ) / m ≤ 1 := by + rw [div_le_one hm0] + exact_mod_cast hk + have := norm_nonneg (x - y) + nlinarith + let S : ℂ → ℕ → A := fun x l => Nat.rec 0 (fun k r => r + φ (F (P x k)) (F (P x (k + 1)))) l + have hS : ∀ x l, S x (l + 1) = S x l + φ (F (P x l)) (F (P x (l + 1))) := fun _ _ => rfl + refine ⟨fun x => S x m, ε / 2, by positivity, fun x hx y hy hxy => ?_⟩ + have hkey : ∀ l ≤ m, S x l + φ (F (P x l)) (F (P y l)) = φ (F (P x 0)) (F (P y 0)) + S y l := by + intro l + induction l with + | zero => intro _; simp [S] + | succ l ih => + intro hl + have hl' : l ≤ m := by omega + have h1 := ih hl' + rw [hS, hS] + have hpx := hP x hx l hl' + have hpx' := hP x hx (l + 1) hl + have hpy := hP y hy l hl' + have hpy' := hP y hy (l + 1) hl + have hr1 := hrung x y l hl' + have hr2 := hrung x y (l + 1) hl + have hs1 := hstep x hx l + have hs2 := hstep y hy l + have t1 : (F (P x l), F (P x (l + 1))) ∈ N := hε _ hpx _ hpx' (by linarith) + have t2 : (F (P x (l + 1)), F (P y (l + 1))) ∈ N := hε _ hpx' _ hpy' (by linarith) + have t3 : (F (P x l), F (P y (l + 1))) ∈ N := hε _ hpx _ hpy' (by + have h3 : ‖P x l - P y (l + 1)‖ ≤ ‖P x l - P y l‖ + ‖P y l - P y (l + 1)‖ := by + have := norm_add_le (P x l - P y l) (P y l - P y (l + 1)) + simpa using this + linarith) + have t4 : (F (P x l), F (P y l)) ∈ N := hε _ hpx _ hpy (by linarith) + have t5 : (F (P y l), F (P y (l + 1))) ∈ N := hε _ hpy _ hpy' (by linarith) + have e1 := hc _ _ _ t1 t2 t3 + have e2 := hc _ _ _ t4 t5 t3 + calc S x l + φ (F (P x l)) (F (P x (l + 1))) + φ (F (P x (l + 1))) (F (P y (l + 1))) + = S x l + φ (F (P x l)) (F (P y l)) + φ (F (P y l)) (F (P y (l + 1))) := by + rw [add_assoc, e1, add_assoc, e2] + _ = _ := by rw [h1, add_assoc] + have h1 := hkey m le_rfl + have hPm : ∀ z, P z m = z := fun z => by + simp only [P] + rw [div_self hm0.ne'] + simp + have hP0 : ∀ z, P z 0 = 0 := fun z => by simp [P] + rw [hPm, hPm, hP0, hP0] at h1 + have hz : φ (F 0) (F 0) = 0 := by + have h2 := hN.mem (F 0) + have h3 := hc _ _ _ h2 h2 h2 + exact add_eq_left.mp h3 + rw [hz, zero_add] at h1 + change _ = -S x m + S y m + rw [← h1, neg_add_cancel_left] + +/-- A function that is locally constant on the interval is constant. -/ +theorem const_of_near {A : Type} {v : ℝ → A} {ε : ℝ} (h0 : 0 < ε) + (hv : ∀ s ∈ Icc (0 : ℝ) 1, ∀ t ∈ Icc (0 : ℝ) 1, |s - t| < ε → v s = v t) : ∀ t ∈ Icc + (0 : ℝ) 1, v t = v 0 := by + intro t ht + obtain ⟨m, hm⟩ := exists_nat_gt (1 / ε) + have hm0 : (0 : ℝ) < m := lt_trans (by positivity) hm + have hle : 1 / (m : ℝ) < ε := by + rw [div_lt_iff₀ hm0] + have := (div_lt_iff₀ h0).mp hm + linarith + have key : ∀ k ≤ m, v (k / m * t) = v 0 := by + intro k + induction k with + | zero => simp + | succ k ih => + intro hk + rw [← ih (by omega)] + have hmem : ∀ l : ℕ, l ≤ m → (l : ℝ) / m * t ∈ Icc (0 : ℝ) 1 := by + intro l hl + have h1 : (l : ℝ) / m ≤ 1 := by + rw [div_le_one hm0] + exact_mod_cast hl + have h2 : (0 : ℝ) ≤ (l : ℝ) / m := by positivity + exact ⟨mul_nonneg h2 ht.1, by nlinarith [ht.1, ht.2]⟩ + refine hv _ (hmem _ hk) _ (hmem _ (by omega)) ?_ + have h3 : ((k + 1 : ℕ) : ℝ) / m * t - (k : ℝ) / m * t = t / m := by + push_cast + field_simp + ring + rw [h3, abs_of_nonneg (div_nonneg ht.1 hm0.le)] + have : t / m ≤ 1 / m := div_le_div_of_nonneg_right ht.2 hm0.le + linarith + have h1 := key m le_rfl + rw [div_self hm0.ne', one_mul] at h1 + exact h1 + +omit [TopologicalSpace Y] in +theorem IsPrim.sub_eq {φ : Y → Y → A} {F : ℂ → Y} {g g' : ℂ → A} (h : IsPrim φ F g) + (h' : IsPrim φ F g') + {a b : ℂ} (ha : a ∈ closedBall (0 : ℂ) 1) (hb : b ∈ closedBall (0 : ℂ) 1) : -g a + g b + = -g' a + g' b := by + obtain ⟨ε, h0, h1⟩ := h + obtain ⟨ε', h0', h1'⟩ := h' + have hm : ∀ t ∈ Icc (0 : ℝ) 1, a + (t : ℂ) * (b - a) ∈ closedBall (0 : ℂ) 1 := by + intro t ht + have h2 := (convex_closedBall (0 : ℂ) 1) ha hb (sub_nonneg.mpr ht.2) ht.1 (by ring) + convert h2 using 1 + simp only [Complex.real_smul] + push_cast + ring + let v : ℝ → A := fun t => g' (a + t * (b - a)) + -g (a + t * (b - a)) + have hd : ∃ δ > 0, ∀ s t : ℝ, |s - t| < δ → ‖(a + (s : ℂ) * (b - a)) - (a + t * + (b - a))‖ < min ε ε' := by + refine ⟨min ε ε' / (‖b - a‖ + 1), by positivity, fun s t hst => ?_⟩ + have h2 : (a + (s : ℂ) * (b - a)) - (a + t * (b - a)) = ((s - t : ℝ) : ℂ) * (b - a) := by + push_cast + ring + rw [h2, norm_mul, Complex.norm_real, Real.norm_eq_abs] + rw [lt_div_iff₀ (by positivity)] at hst + have := norm_nonneg (b - a) + have h3 := abs_nonneg (s - t) + nlinarith + obtain ⟨δ, hδ, hd⟩ := hd + have hv := const_of_near (v := v) hδ (fun s hs t ht hst => by + have h2 := hd s t hst + have e1 := h1 _ (hm t ht) _ (hm s hs) (by + rw [norm_sub_rev] + exact lt_of_lt_of_le h2 (min_le_left _ _)) + have e2 := h1' _ (hm t ht) _ (hm s hs) (by + rw [norm_sub_rev] + exact lt_of_lt_of_le h2 (min_le_right _ _)) + have e3 := e1.symm.trans e2 + simp only [v] + rw [neg_add_eq_iff_eq_add] at e3 + rw [e3] + simp only [neg_add_rev, neg_neg, add_assoc, add_neg_cancel_left]) + have h2 := hv 1 ⟨zero_le_one, le_rfl⟩ + simp only [v] at h2 + simp only [Complex.ofReal_one, one_mul, add_sub_cancel, Complex.ofReal_zero, zero_mul, + add_zero] at h2 + have e : g' b = g' a + -g a + g b := by + rw [← h2] + simp only [add_assoc, neg_add_cancel, add_zero] + rw [e] + simp only [add_assoc, neg_add_cancel_left] + +end Disc + +section DiscComm + +variable {Y : Type u} [TopologicalSpace Y] {A : Type} [AddCommGroup A] + +theorem IsPrim.of_rel {φ φ' : Y → Y → A} {F : ℂ → Y} {g : ℂ → A} (hg : IsPrim φ F g) + (hF : ContinuousOn F (closedBall 0 1)) {h : Y → A} {N : Set (Y × Y)} (hN : NearDiag N) + (hr : ∀ x y, (x, y) ∈ N → φ x y - φ' x y = h y - h x) : IsPrim φ' F fun a => g a - h (F a) := by + obtain ⟨ε, h0, h1⟩ := hg + obtain ⟨ε', h0', h2⟩ := exists_eps (isCompact_closedBall 0 1) hF hN + refine ⟨min ε ε', by positivity, fun a ha b hb hab => ?_⟩ + have e1 := h1 a ha b hb (lt_of_lt_of_le hab (min_le_left _ _)) + have e2 := hr _ _ (h2 a ha b hb (lt_of_lt_of_le hab (min_le_right _ _))) + rw [e1] at e2 + have e3 : φ' (F a) (F b) = -g a + g b - (h (F b) - h (F a)) := by + rw [← e2] + abel + change _ = -(g a - h (F a)) + (g b - h (F b)) + rw [e3] + abel + +/-- Two local cocycles are equivalent if the difference of their primitives is a function on `Y`. -/ +theorem cohRel_of_descent [T2Space Y] {φ φ' : Y → Y → A} (hφ : IsCoc φ) (hφ' : IsCoc φ') {F : ℂ → Y} + (hF : ContinuousOn F (closedBall 0 1)) (hs : F '' closedBall 0 1 = univ) {g g' : ℂ → A} + (hg : IsPrim φ F g) + (hg' : IsPrim φ' F g') (hd : ∀ a ∈ closedBall (0 : ℂ) 1, ∀ b ∈ closedBall (0 : ℂ) 1, F a = F b + → g a - g' a = g b - g' b) : + CohRel φ φ' := by + classical + obtain ⟨M, hM, hc⟩ := hφ + obtain ⟨M', hM', hc'⟩ := hφ' + obtain ⟨ε, h0, h1⟩ := hg + obtain ⟨ε', h0', h1'⟩ := hg' + have hlift : ∀ y : Y, ∃ a ∈ closedBall (0 : ℂ) 1, F a = y := fun y => by + have h2 : y ∈ F '' closedBall 0 1 := by + rw [hs] + exact mem_univ y + exact h2 + choose σ hσ1 hσ2 using hlift + let h : Y → A := fun y => g (σ y) - g' (σ y) + have hh : ∀ a ∈ closedBall (0 : ℂ) 1, h (F a) = g a - g' a := fun a ha => hd _ (hσ1 _) _ ha + (hσ2 _) + set δ := min ε ε' with hδ + have hδ0 : 0 < δ := by positivity + have hlocal : ∀ p : Y, ∃ O : Set Y, IsOpen O ∧ p ∈ O ∧ O ×ˢ O ⊆ M ∩ M' ∧ + ∀ x ∈ O, ∃ b ∈ closedBall (0 : ℂ) 1, F b = x ∧ ∃ a ∈ closedBall (0 : ℂ) 1, F a = p + ∧ ‖b - a‖ < δ := by + intro p + let U : Set ℂ := ⋃ a ∈ closedBall (0 : ℂ) 1 ∩ F ⁻¹' {p}, ball a δ + have hU : IsOpen U := isOpen_biUnion fun _ _ => isOpen_ball + have hC : IsClosed (F '' (closedBall 0 1 \ U)) := + (((isCompact_closedBall 0 1).diff hU).image_of_continuousOn (hF.mono sdiff_subset)).isClosed + have hp : p ∉ F '' (closedBall 0 1 \ U) := by + rintro ⟨a, ha, he⟩ + exact ha.2 (mem_biUnion (x := a) ⟨ha.1, he⟩ (mem_ball_self hδ0)) + have h2 : M ∩ M' ∈ 𝓝 (p, p) := hM.inter hM' p + obtain ⟨u, hu, v, hv, huv⟩ := mem_nhds_prod_iff.mp h2 + obtain ⟨O₁, hO₁, hO₁o, hpO₁⟩ := mem_nhds_iff.mp (Filter.inter_mem hu hv) + refine ⟨O₁ ∩ (F '' (closedBall 0 1 \ U))ᶜ, hO₁o.inter hC.isOpen_compl, ⟨hpO₁, hp⟩, ?_, ?_⟩ + · rintro ⟨x, y⟩ ⟨hx, hy⟩ + exact huv ⟨(hO₁ hx.1).1, (hO₁ hy.1).2⟩ + · intro x hx + refine ⟨σ x, hσ1 x, hσ2 x, ?_⟩ + have h3 : σ x ∈ U := by + by_contra hc + exact hx.2 ⟨σ x, ⟨hσ1 x, hc⟩, hσ2 x⟩ + obtain ⟨a, ha, hb⟩ := mem_iUnion₂.mp h3 + exact ⟨a, ha.1, ha.2, mem_ball_iff_norm.mp hb⟩ + choose O hO hpO hOM hOl using hlocal + have hN : NearDiag (⋃ p, O p ×ˢ O p) := fun p => + Filter.mem_of_superset (((hO p).prod (hO p)).mem_nhds ⟨hpO p, hpO p⟩) (subset_iUnion (fun p + => O p ×ˢ O p) p) + refine ⟨h, _, hN, fun x y hxy => ?_⟩ + obtain ⟨p, hx, hy⟩ := mem_iUnion.mp hxy + obtain ⟨b, hb, rfl, a, ha, hap, hab⟩ := hOl p x hx + obtain ⟨c, hcD, rfl, a', ha', hap', hac⟩ := hOl p y hy + have hm : ∀ {u v : Y}, u ∈ O p → v ∈ O p → (u, v) ∈ M ∧ (u, v) ∈ M' := fun hu hv => hOM p ⟨hu, hv⟩ + have hab1 : ‖b - a‖ < ε := lt_of_lt_of_le hab (min_le_left _ _) + have hab2 : ‖b - a‖ < ε' := lt_of_lt_of_le hab (min_le_right _ _) + have hac1 : ‖a' - c‖ < ε := by + rw [norm_sub_rev] + exact lt_of_lt_of_le hac (min_le_left _ _) + have hac2 : ‖a' - c‖ < ε' := by + rw [norm_sub_rev] + exact lt_of_lt_of_le hac (min_le_right _ _) + have e1 := h1 b hb a ha hab1 + have e2 := h1 a' ha' c hcD hac1 + have e3 := h1' b hb a ha hab2 + have e4 := h1' a' ha' c hcD hac2 + rw [hap] at e1 e3 + rw [hap'] at e2 e4 + have e5 := hc _ _ _ (hm hx (hpO p)).1 (hm (hpO p) hy).1 (hm hx hy).1 + have e6 := hc' _ _ _ (hm hx (hpO p)).2 (hm (hpO p) hy).2 (hm hx hy).2 + have e7 : g a - g' a = g a' - g' a' := hd a ha a' ha' (hap.trans hap'.symm) + rw [hh b hb, hh c hcD, ← e5, ← e6, e1, e2, e3, e4] + have e8 : g a = g a' - g' a' + g' a := by + rw [← e7] + abel + rw [e8] + abel + +end DiscComm + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Lunes.lean b/LeanPool/GraphMinor/Surface/Lunes.lean new file mode 100644 index 0000000000..f01fcfc2a4 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Lunes.lean @@ -0,0 +1,851 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Cap +public import LeanPool.GraphMinor.Surface.Polygon + +/-! +# A polygon and its lunes in the unit disc + +Take points on the unit circle at angles `θ i`, in order. The chord from one point to the next cuts +a lune off the unit disc, and what is left +after all the lunes are gone is the convex polygon on the points. This file gives the facts on the +polygon and the lunes that are used to turn a +vortex into a cuff in XVII (13.1). + +The angles are indexed by the integers, with period `k`, so that all shifts are easy. Everything is +described by the linear functions `gf μ`: +the lune at `i` is the part of the unit disc where `gf (midAngle θ i) ≥ halfCos θ i`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +/-- The point of the unit circle at angle `s`. -/ +noncomputable def eC (s : ℝ) : ℂ := (Circle.exp s : ℂ) + +theorem eC_re (s : ℝ) : (eC s).re = Real.cos s := by + simp [eC, Circle.coe_exp, Complex.exp_ofReal_mul_I_re] + +theorem eC_im (s : ℝ) : (eC s).im = Real.sin s := by + simp [eC, Circle.coe_exp, Complex.exp_ofReal_mul_I_im] + +theorem norm_eC (s : ℝ) : ‖eC s‖ = 1 := Circle.norm_coe _ + +theorem eC_add_int (s : ℝ) (m : ℤ) : eC (s + 2 * Real.pi * m) = eC s := by + apply Complex.ext + · rw [eC_re, eC_re, mul_comm (2 * Real.pi), Real.cos_add_int_mul_two_pi] + · rw [eC_im, eC_im, mul_comm (2 * Real.pi), Real.sin_add_int_mul_two_pi] + +theorem exists_eC {w : ℂ} (hw : ‖w‖ = 1) : ∃ s, w = eC s := by + refine ⟨Complex.arg w, ?_⟩ + apply Complex.ext + · rw [eC_re, Complex.cos_arg (by intro h; simp [h] at hw), hw, div_one] + · rw [eC_im, Complex.sin_arg, hw, div_one] + +/-- The linear function that measures how far `w` goes in the direction `μ`. -/ +noncomputable def gf (μ : ℝ) (w : ℂ) : ℝ := w.re * Real.cos μ + w.im * Real.sin μ + +theorem gf_eC (μ s : ℝ) : gf μ (eC s) = Real.cos (s - μ) := by + rw [gf, eC_re, eC_im, Real.cos_sub] + +theorem gf_add (μ : ℝ) (a b : ℂ) : gf μ (a + b) = gf μ a + gf μ b := by + simp only [gf, Complex.add_re, Complex.add_im] + ring + +theorem gf_smul (μ t : ℝ) (a : ℂ) : gf μ (t • a) = t * gf μ a := by + simp only [gf, Complex.real_smul, Complex.mul_re, Complex.mul_im, Complex.ofReal_re, + Complex.ofReal_im] + ring + +theorem continuous_gf (μ : ℝ) : Continuous (gf μ) := by + unfold gf + fun_prop + +theorem gf_period (μ : ℝ) (m : ℤ) : gf (μ + 2 * Real.pi * m) = gf μ := by + funext w + rw [gf, gf, mul_comm (2 * Real.pi), Real.cos_add_int_mul_two_pi, Real.sin_add_int_mul_two_pi] + +theorem gf_segment_le {μ c : ℝ} {a b w : ℂ} (ha : gf μ a ≤ c) (hb : gf μ b ≤ c) + (hw : w ∈ segment ℝ a b) : gf μ w ≤ c := by + obtain ⟨x, y, hx, hy, hxy, rfl⟩ := hw + rw [gf_add, gf_smul, gf_smul] + have h : c = x * c + y * c := by rw [← add_mul, hxy, one_mul] + have h1 := mul_le_mul_of_nonneg_left ha hx + have h2 := mul_le_mul_of_nonneg_left hb hy + linarith + +theorem gf_segment_eq {μ c : ℝ} {a b w : ℂ} (ha : gf μ a ≤ c) (hb : gf μ b ≤ c) + (hw : w ∈ segment ℝ a b) (he : gf μ w = c) : + w = a ∨ w = b ∨ (gf μ a = c ∧ gf μ b = c) := by + obtain ⟨x, y, hx, hy, hxy, rfl⟩ := hw + rw [gf_add, gf_smul, gf_smul] at he + rcases hx.eq_or_lt with rfl | hx' + · right; left + have : y = 1 := by linarith + simp [this] + rcases hy.eq_or_lt with rfl | hy' + · left + have : x = 1 := by linarith + simp [this] + right; right + have h : c = x * c + y * c := by rw [← add_mul, hxy, one_mul] + have h1 := mul_le_mul_of_nonneg_left ha hx + have h2 := mul_le_mul_of_nonneg_left hb hy + exact ⟨le_antisymm ha (le_of_mul_le_mul_left (by linarith) hx'), + le_antisymm hb (le_of_mul_le_mul_left (by linarith) hy')⟩ + +/-- Any point of the unit disc lies on a chord of the circle on which `gf μ` is constant. -/ +theorem exists_level_chord (μ : ℝ) {w : ℂ} (hw : ‖w‖ ≤ 1) : + ∃ a b : ℂ, ‖a‖ = 1 ∧ ‖b‖ = 1 ∧ gf μ a = gf μ w ∧ gf μ b = gf μ w ∧ w ∈ segment ℝ a b := by + set C := Real.cos μ with hC + set S := Real.sin μ with hS + have hCS : C * C + S * S = 1 := by + have := Real.sin_sq_add_cos_sq μ + nlinarith + set x := w.re * C + w.im * S with hx + set y := w.im * C - w.re * S with hy + have hwre : w.re = x * C - y * S := by + rw [hx, hy] + linear_combination (-w.re) * hCS + have hwim : w.im = x * S + y * C := by + rw [hx, hy] + linear_combination (-w.im) * hCS + have hnorm : x * x + y * y ≤ 1 := by + have h1 : ‖w‖ ^ 2 ≤ 1 := by + have := norm_nonneg w + nlinarith + have h2 : ‖w‖ ^ 2 = w.re * w.re + w.im * w.im := by + rw [← Complex.normSq_eq_norm_sq, Complex.normSq_apply] + have h3 : x * x + y * y = (w.re * w.re + w.im * w.im) * (C * C + S * S) := by + rw [hx, hy] + ring + rw [h3, hCS, mul_one, ← h2] + exact h1 + set r := Real.sqrt (1 - x * x) with hr + have hr0 : 0 ≤ r := Real.sqrt_nonneg _ + have hrr : r * r = 1 - x * x := Real.mul_self_sqrt (by nlinarith [mul_self_nonneg y]) + have hyr : |y| ≤ r := by + apply abs_le_of_sq_le_sq' (by nlinarith) hr0 |> abs_le.mpr + let pt : ℝ → ℂ := fun t => ⟨x * C - t * S, x * S + t * C⟩ + have hpt : ∀ t, t * t = r * r → ‖pt t‖ = 1 := fun t ht => by + have h1 : ‖pt t‖ ^ 2 = 1 := by + rw [← Complex.normSq_eq_norm_sq, Complex.normSq_apply] + change (x * C - t * S) * (x * C - t * S) + (x * S + t * C) * (x * S + t * C) = 1 + have : (x * C - t * S) * (x * C - t * S) + (x * S + t * C) * (x * S + t * C) = + (x * x + t * t) * (C * C + S * S) := by ring + rw [this, hCS, ht, hrr] + ring + have h2 := norm_nonneg (pt t) + nlinarith + have hgf : ∀ t, gf μ (pt t) = x := fun t => by + change (x * C - t * S) * C + (x * S + t * C) * S = x + linear_combination x * hCS + have hgw : gf μ w = x := rfl + refine ⟨pt r, pt (-r), hpt r rfl, hpt (-r) (by ring), by rw [hgf, hgw], by rw [hgf, hgw], ?_⟩ + by_cases hr' : r = 0 + · have hy0 : y = 0 := by + have := abs_nonneg y + rw [hr'] at hyr + exact abs_eq_zero.mp (le_antisymm hyr this) + have : w = pt r := by + apply Complex.ext + · change w.re = x * C - r * S + rw [hwre, hy0, hr'] + · change w.im = x * S + r * C + rw [hwim, hy0, hr'] + rw [this] + exact left_mem_segment _ _ _ + have hrp : 0 < r := lt_of_le_of_ne hr0 (Ne.symm hr') + have hab := abs_le.mp hyr + refine ⟨(r + y) / (2 * r), (r - y) / (2 * r), by apply div_nonneg <;> linarith, by apply + div_nonneg <;> linarith, by field_simp; ring, ?_⟩ + apply Complex.ext + · simp only [Complex.add_re, Complex.real_smul, Complex.mul_re, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, sub_zero, pt] + rw [hwre] + field_simp + ring + · simp only [Complex.add_im, Complex.real_smul, Complex.mul_im, Complex.ofReal_re, + Complex.ofReal_im, zero_mul, add_zero, pt] + rw [hwim] + field_simp + ring + +theorem cos_arc {h x : ℝ} (hh : 0 < h) (hh' : h < Real.pi) : + (|x| ≤ h → Real.cos h ≤ Real.cos x) ∧ (|x| < h → Real.cos h < Real.cos x) ∧ + (h ≤ x → x ≤ 2 * Real.pi - h → Real.cos x ≤ Real.cos h) ∧ (h < x → x < 2 * Real.pi - h + → Real.cos x < Real.cos h) := by + refine ⟨fun hx => ?_, fun hx => ?_, fun h1 h2 => ?_, fun h1 h2 => ?_⟩ + · rw [← Real.cos_abs x] + exact Real.cos_le_cos_of_nonneg_of_le_pi (abs_nonneg x) hh'.le hx + · rw [← Real.cos_abs x] + exact Real.cos_lt_cos_of_nonneg_of_le_pi (abs_nonneg x) hh'.le hx + · rcases le_total x Real.pi with hp | hp + · exact Real.cos_le_cos_of_nonneg_of_le_pi hh.le hp h1 + · rw [← Real.cos_two_pi_sub x] + exact Real.cos_le_cos_of_nonneg_of_le_pi hh.le (by linarith) (by linarith) + · rcases le_total x Real.pi with hp | hp + · exact Real.cos_lt_cos_of_nonneg_of_le_pi hh.le hp h1 + · rw [← Real.cos_two_pi_sub x] + exact Real.cos_lt_cos_of_nonneg_of_le_pi hh.le (by linarith) (by linarith) + +/-- The middle of the arc at `i`. -/ +noncomputable def midAngle (θ : ℤ → ℝ) (i : ℤ) : ℝ := (θ i + θ (i + 1)) / 2 + +/-- The cosine of half the arc at `i`. -/ +noncomputable def halfCos (θ : ℤ → ℝ) (i : ℤ) : ℝ := Real.cos ((θ (i + 1) - θ i) / 2) + +/-- The lune at `i`. -/ +def lune (θ : ℤ → ℝ) (i : ℤ) : Set ℂ := {w | ‖w‖ ≤ 1 ∧ halfCos θ i ≤ gf (midAngle θ i) w} + +/-- The polygon. -/ +def hull (θ : ℤ → ℝ) : Set ℂ := {w | ‖w‖ ≤ 1 ∧ ∀ i, gf (midAngle θ i) w ≤ halfCos θ i} + +/-- The hypotheses on the angles: they increase, with period `k`. -/ +structure IsAngles (θ : ℤ → ℝ) (k : ℤ) : Prop where + three : 3 ≤ k + mono : StrictMono θ + period : ∀ n m : ℤ, θ (n + k * m) = θ n + 2 * Real.pi * m + +namespace IsAngles + +variable {θ : ℤ → ℝ} {k : ℤ} (A : IsAngles θ k) +include A + +theorem half_pos (i : ℤ) : 0 < (θ (i + 1) - θ i) / 2 := by + have := A.mono (show i < i + 1 by omega) + linarith + +theorem half_lt (i : ℤ) : (θ (i + 1) - θ i) / 2 < Real.pi := by + have h1 := A.mono (show i + 1 < i + k by have := A.three; omega) + have h2 := A.period i 1 + rw [mul_one, Int.cast_one, mul_one] at h2 + rw [h2] at h1 + linarith + +theorem midAngle_shift (i m : ℤ) : midAngle θ (i + k * m) = midAngle θ i + 2 * Real.pi * m := by + have h := A.period (i + 1) m + rw [midAngle, midAngle, A.period, show i + k * m + 1 = i + 1 + k * m by ring, h] + ring + +theorem halfCos_shift (i m : ℤ) : halfCos θ (i + k * m) = halfCos θ i := by + have h := A.period (i + 1) m + rw [halfCos, halfCos, A.period, show i + k * m + 1 = i + 1 + k * m by ring, h] + congr 1 + ring + +theorem lune_shift (i m : ℤ) : lune θ (i + k * m) = lune θ i := by + rw [lune, lune, A.midAngle_shift, A.halfCos_shift, gf_period] + +theorem gf_arc {i : ℤ} {s : ℝ} (h1 : θ i ≤ s) (h2 : s ≤ θ (i + 1)) : halfCos θ i ≤ gf + (midAngle θ i) (eC s) := by + rw [gf_eC] + refine (cos_arc (A.half_pos i) (A.half_lt i)).1 (abs_le.mpr ⟨?_, ?_⟩) <;> simp only [midAngle] + <;> linarith + +theorem gf_arc_lt {i : ℤ} {s : ℝ} (h1 : θ i < s) (h2 : s < θ (i + 1)) : halfCos θ i < gf + (midAngle θ i) (eC s) := by + rw [gf_eC] + refine (cos_arc (A.half_pos i) (A.half_lt i)).2.1 (abs_lt.mpr ⟨?_, ?_⟩) <;> simp only [midAngle] + <;> linarith + +theorem gf_off {i : ℤ} {s : ℝ} (h1 : θ (i + 1) ≤ s) (h2 : s ≤ θ i + 2 * Real.pi) : gf + (midAngle θ i) (eC s) ≤ halfCos θ i := by + rw [gf_eC] + refine (cos_arc (A.half_pos i) (A.half_lt i)).2.2.1 ?_ ?_ <;> simp only [midAngle] <;> linarith + +theorem gf_off_lt {i : ℤ} {s : ℝ} (h1 : θ (i + 1) < s) (h2 : s < θ i + 2 * Real.pi) : gf + (midAngle θ i) (eC s) < halfCos θ i := by + rw [gf_eC] + refine (cos_arc (A.half_pos i) (A.half_lt i)).2.2.2 ?_ ?_ <;> simp only [midAngle] <;> linarith + +theorem theta_top (i : ℤ) : θ (i + k) = θ i + 2 * Real.pi := by + have h2 := A.period i 1 + rwa [mul_one, Int.cast_one, mul_one] at h2 + +/-- A shift by a multiple of `k` puts `i` in the range from `j + 1` to `j + k`. -/ +theorem exists_shift (i j : ℤ) : ∃ m, j + 1 ≤ i + k * m ∧ i + k * m ≤ j + k := by + have hk : 0 < k := by have := A.three; omega + refine ⟨-((i - j - 1) / k), ?_, ?_⟩ + · have h1 := Int.emod_nonneg (i - j - 1) hk.ne' + have h2 := Int.emod_add_mul_ediv (i - j - 1) k + nlinarith + · have h1 := Int.emod_lt_of_pos (i - j - 1) hk + have h2 := Int.emod_add_mul_ediv (i - j - 1) k + nlinarith + +theorem node_shift (i m : ℤ) : eC (θ (i + k * m)) = eC (θ i) := by + rw [A.period, eC_add_int] + +/-- All the nodes lie on the far side of each chord, or on the chord. -/ +theorem node_le (i j : ℤ) : gf (midAngle θ j) (eC (θ i)) ≤ halfCos θ j := by + obtain ⟨m, h1, h2⟩ := A.exists_shift i j + rw [← A.node_shift i m] + exact A.gf_off (A.mono.monotone h1) ((A.mono.monotone h2).trans_eq (A.theta_top j)) + +/-- The only nodes on a chord are its ends. -/ +theorem node_eq {i j : ℤ} (h : gf (midAngle θ j) (eC (θ i)) = halfCos θ j) : ∃ m, i + k * m = j + 1 + ∨ i + k * m = j + k := by + obtain ⟨m, h1, h2⟩ := A.exists_shift i j + refine ⟨m, ?_⟩ + by_contra hn + push Not at hn + rw [← A.node_shift i m] at h + have := A.gf_off_lt (A.mono (show j + 1 < i + k * m by omega)) + ((A.mono (show i + k * m < j + k by omega)).trans_eq (A.theta_top j)) + exact this.ne h + +/-- Every point of the circle lies on an arc. -/ +theorem exists_arc (a : ℝ) : ∃ i, θ i ≤ a ∧ a < θ (i + 1) := by + have hpi := Real.pi_pos + obtain ⟨m₁, hm₁⟩ := exists_int_lt ((a - θ 0) / (2 * Real.pi)) + obtain ⟨m₂, hm₂⟩ := exists_int_gt ((a - θ 0) / (2 * Real.pi)) + rw [lt_div_iff₀ (by positivity)] at hm₁ + rw [div_lt_iff₀ (by positivity)] at hm₂ + have hlow : θ (k * m₁) ≤ a := by + have := A.period 0 m₁ + rw [zero_add] at this + rw [this] + nlinarith + have hhigh : ∀ n, θ n ≤ a → n ≤ k * m₂ := fun n hn => by + by_contra hlt + push Not at hlt + have h1 := A.mono hlt + have := A.period 0 m₂ + rw [zero_add] at this + rw [this] at h1 + nlinarith + obtain ⟨i, hi, hmax⟩ := Int.exists_greatest_of_bdd (P := fun n => θ n + ≤ a) ⟨k * m₂, hhigh⟩ ⟨k * m₁, hlow⟩ + refine ⟨i, hi, ?_⟩ + by_contra hn + push Not at hn + have := hmax (i + 1) hn + omega + +/-- A point of the circle in a lune lies on the arc of that lune. -/ +theorem mem_arc {i : ℤ} {a : ℂ} (ha : ‖a‖ = 1) (h : halfCos θ i ≤ gf (midAngle θ i) a) : ∃ s, θ i + ≤ s ∧ s ≤ θ (i + 1) ∧ a = eC s := by + obtain ⟨s₀, rfl⟩ := exists_eC ha + obtain ⟨m, hm⟩ : ∃ m : ℤ, s₀ + 2 * Real.pi * m ∈ Ico (θ i) (θ i + 2 * Real.pi) := by + have hpi : (0 : ℝ) < 2 * Real.pi := by positivity + obtain ⟨m, hm, -⟩ := existsUnique_add_zsmul_mem_Ico hpi s₀ (θ i) + refine ⟨m, ?_⟩ + simpa [mul_comm] using hm + refine ⟨s₀ + 2 * Real.pi * m, hm.1, ?_, (eC_add_int s₀ m).symm⟩ + by_contra hn + push Not at hn + rw [← eC_add_int s₀ m] at h + exact absurd h (not_le.mpr (A.gf_off_lt hn hm.2)) + +/-- Two different lunes lie on opposite sides of the chord of the first. -/ +theorem lune_le {i j : ℤ} (hij : ∀ m, j + k * m ≠ i + k) {w : ℂ} (hw : w ∈ lune θ j) : gf + (midAngle θ i) w ≤ halfCos θ i := by + obtain ⟨a, b, ha, hb, hga, hgb, hseg⟩ := exists_level_chord (midAngle θ j) hw.1 + have key : ∀ c : ℂ, ‖c‖ = 1 → gf (midAngle θ j) c = gf (midAngle θ j) w → gf (midAngle θ i) c + ≤ halfCos θ i := fun c hc he => by + obtain ⟨s, h1, h2, rfl⟩ := A.mem_arc hc (he ▸ hw.2) + obtain ⟨m, hm1, hm2⟩ := A.exists_shift j i + have hne := hij m + have h3 : θ (i + 1) ≤ s + 2 * Real.pi * m := by + have := A.mono.monotone hm1 + have h4 := A.period j m + linarith + have h4 : s + 2 * Real.pi * m ≤ θ i + 2 * Real.pi := by + have h5 := A.mono.monotone (show j + k * m + 1 ≤ i + k by omega) + have h6 := A.period (j + 1) m + rw [show j + 1 + k * m = j + k * m + 1 by ring] at h6 + have := A.theta_top i + linarith + rw [← eC_add_int s m] + exact A.gf_off h3 h4 + exact gf_segment_le (key a ha hga) (key b hb hgb) hseg + +theorem chord_eq {i : ℤ} {w : ℂ} (hw : ‖w‖ ≤ 1) (he : gf (midAngle θ i) w = halfCos θ i) : + w ∈ segment ℝ (eC (θ i)) (eC (θ (i + 1))) := by + obtain ⟨a, b, ha, hb, hga, hgb, hseg⟩ := exists_level_chord (midAngle θ i) hw + have key : ∀ c : ℂ, ‖c‖ = 1 → gf (midAngle θ i) c = halfCos θ i → c = eC (θ i) ∨ c = eC (θ + (i + 1)) := fun c hc he' => by + obtain ⟨s, h1, h2, rfl⟩ := A.mem_arc hc he'.ge + rcases h1.eq_or_lt with rfl | h1' + · exact Or.inl rfl + rcases h2.eq_or_lt with rfl | h2' + · exact Or.inr rfl + exact absurd he' (A.gf_arc_lt h1' h2').ne' + have hend : ∀ x y : ℂ, x ∈ ({eC (θ i), eC (θ (i + 1))} : Set ℂ) → y ∈ ({eC (θ i), eC (θ + (i + 1))} : Set ℂ) → + segment ℝ x y ⊆ segment ℝ (eC (θ i)) (eC (θ (i + 1))) := fun x y hx hy => + (convex_segment _ _).segment_subset (by + rcases hx with rfl | rfl + · exact left_mem_segment _ _ _ + · exact right_mem_segment _ _ _) (by + rcases hy with rfl | rfl + · exact left_mem_segment _ _ _ + · exact right_mem_segment _ _ _) + exact hend a b (key a ha (hga.trans he)) (key b hb (hgb.trans he)) hseg + +omit A in +theorem seg_norm_le {i : ℤ} {w : ℂ} (hw : w ∈ segment ℝ (eC (θ i)) (eC (θ (i + 1)))) : ‖w‖ ≤ 1 := by + have : w ∈ closedBall (0 : ℂ) 1 := (convex_closedBall (0 : ℂ) 1).segment_subset + (by simp [norm_eC]) (by simp [norm_eC]) hw + simpa using this + +theorem seg_le (i j : ℤ) {w : ℂ} (hw : w ∈ segment ℝ (eC (θ i)) (eC (θ (i + 1)))) : gf + (midAngle θ j) w ≤ halfCos θ j := + gf_segment_le (A.node_le i j) (A.node_le (i + 1) j) hw + +theorem seg_ge (i : ℤ) {w : ℂ} (hw : w ∈ segment ℝ (eC (θ i)) (eC (θ (i + 1)))) : halfCos θ i ≤ gf + (midAngle θ i) w := by + obtain ⟨x, y, hx, hy, hxy, rfl⟩ := hw + rw [gf_add, gf_smul, gf_smul] + have h1 := A.gf_arc (le_refl (θ i)) (A.mono (show i < i + 1 by omega)).le + have h2 := A.gf_arc (A.mono (show i < i + 1 by omega)).le (le_refl (θ (i + 1))) + have h : halfCos θ i = x * halfCos θ i + y * halfCos θ i := by rw [← add_mul, hxy, one_mul] + have h3 := mul_le_mul_of_nonneg_left h1 hx + have h4 := mul_le_mul_of_nonneg_left h2 hy + linarith + +/-- The lune meets the polygon in the chord. -/ +theorem lune_inter_hull (i : ℤ) : lune θ i ∩ hull θ = segment ℝ (eC (θ i)) (eC (θ (i + 1))) := by + ext w + constructor + · rintro ⟨h1, h2⟩ + exact A.chord_eq h1.1 (le_antisymm (h2.2 i) h1.2) + · intro hw + exact ⟨⟨IsAngles.seg_norm_le (θ := θ) hw, A.seg_ge i hw⟩, IsAngles.seg_norm_le (θ + := θ) hw, fun j => A.seg_le i j hw⟩ + +omit A in +theorem isLinear_gf (μ : ℝ) : IsLinearMap ℝ (gf μ) := ⟨gf_add μ, fun t a => gf_smul μ t a⟩ + +omit A in +theorem lune_eq (i : ℤ) : lune θ i = closedBall 0 1 ∩ {w | halfCos θ i ≤ gf (midAngle θ i) w} := by + ext w + simp [lune] + +omit A in +theorem hull_eq : hull θ = closedBall 0 1 ∩ ⋂ i, {w | gf (midAngle θ i) w ≤ halfCos θ i} := by + ext w + simp [hull] + +omit A in +theorem convex_lune (i : ℤ) : Convex ℝ (lune θ i) := by + rw [lune_eq] + exact (convex_closedBall _ _).inter (convex_halfSpace_ge (isLinear_gf _) _) + +omit A in +theorem convex_hull' : Convex ℝ (hull θ) := by + rw [hull_eq] + exact (convex_closedBall _ _).inter (convex_iInter fun i => convex_halfSpace_le (isLinear_gf _) _) + +omit A in +theorem isClosed_lune (i : ℤ) : IsClosed (lune θ i) := by + rw [lune_eq] + exact isClosed_closedBall.inter (isClosed_le continuous_const (continuous_gf _)) + +omit A in +theorem isClosed_hull : IsClosed (hull θ) := by + rw [hull_eq] + exact isClosed_closedBall.inter (isClosed_iInter fun i => isClosed_le + (continuous_gf _) continuous_const) + +omit A in +theorem lune_subset (i : ℤ) : lune θ i ⊆ closedBall 0 1 := fun _ hw => by simpa using hw.1 + +omit A in +theorem hull_subset : hull θ ⊆ closedBall 0 1 := fun _ hw => by simpa using hw.1 + +theorem interior_lune (i : ℤ) : (interior (lune θ i)).Nonempty := by + have h1 : Real.cos Real.pi < halfCos θ i := Real.cos_lt_cos_of_nonneg_of_le_pi + (A.half_pos i).le le_rfl (A.half_lt i) + have h2 : halfCos θ i < Real.cos 0 := Real.cos_lt_cos_of_nonneg_of_le_pi le_rfl (A.half_lt i).le + (A.half_pos i) + rw [Real.cos_pi] at h1 + rw [Real.cos_zero] at h2 + set c := halfCos θ i + let O : Set ℂ := ball 0 1 ∩ {w | c < gf (midAngle θ i) w} + have hO : IsOpen O := isOpen_ball.inter (isOpen_lt continuous_const (continuous_gf _)) + have hsub : O ⊆ lune θ i := fun w hw => ⟨by simpa using (mem_ball_zero_iff.mp hw.1).le, hw.2.le⟩ + refine ⟨((1 + c) / 2 : ℝ) • eC (midAngle θ i), interior_maximal hsub hO ?_⟩ + refine ⟨?_, ?_⟩ + · rw [mem_ball_zero_iff, norm_smul, norm_eC, mul_one, Real.norm_eq_abs, abs_lt] + constructor <;> linarith + · change c < gf (midAngle θ i) (((1 + c) / 2 : ℝ) • eC (midAngle θ i)) + rw [gf_smul, gf_eC, sub_self, Real.cos_zero] + linarith + +omit A in +theorem same_class {a b m m' : ℤ} (h : a + k * m = b + k * m') (hab : |a - b| < k) : a = b := by + have hd : k ∣ a - b := ⟨m' - m, by linear_combination h⟩ + have := Int.eq_zero_of_abs_lt_dvd hd hab + omega + +/-- The open part of the polygon: finitely many conditions are enough, by the period. -/ +theorem isOpen_core : IsOpen {w : ℂ | ‖w‖ < 1 ∧ ∀ i, gf (midAngle θ i) w < halfCos θ i} := by + have hk : 0 < k := by have := A.three; omega + have heq : {w : ℂ | ‖w‖ < 1 ∧ ∀ i, gf (midAngle θ i) w < halfCos θ i} = + ball 0 1 ∩ ⋂ i ∈ Icc (1 : ℤ) k, {w | gf (midAngle θ i) w < halfCos θ i} := by + ext w + simp only [mem_ofPred_eq, mem_inter_iff, mem_ball_zero_iff, mem_iInter] + refine and_congr_right fun _ => ⟨fun h i _ => h i, fun h i => ?_⟩ + obtain ⟨m, h1, h2⟩ := A.exists_shift i 0 + have := h (i + k * m) ⟨by omega, by omega⟩ + rwa [A.midAngle_shift, A.halfCos_shift, gf_period] at this + rw [heq] + exact isOpen_ball.inter ((Set.finite_Icc _ _).isOpen_biInter fun i _ => isOpen_lt + (continuous_gf _) continuous_const) + +omit A in +theorem core_subset : {w : ℂ | ‖w‖ < 1 ∧ ∀ i, gf (midAngle θ i) w < halfCos θ i} ⊆ hull θ := + fun _ hw => ⟨hw.1.le, fun i => (hw.2 i).le⟩ + +theorem interior_hull : (interior (hull θ)).Nonempty := by + have hk := A.three + let t : ℝ := 1 / 3 + let w : ℂ := t • eC (θ 0) + t • eC (θ 1) + t • eC (θ 2) + have hgw : ∀ i, gf (midAngle θ i) w = (gf (midAngle θ i) (eC (θ 0)) + gf (midAngle θ i) (eC + (θ 1)) + gf (midAngle θ i) (eC (θ 2))) / 3 := fun i => by + simp only [w, gf_add, gf_smul, t] + ring + have hlt : ∀ i, gf (midAngle θ i) w < halfCos θ i := fun i => by + rw [hgw] + have h0 := A.node_le 0 i + have h1 := A.node_le 1 i + have h2 := A.node_le 2 i + by_contra hn + have e0 : gf (midAngle θ i) (eC (θ 0)) = halfCos θ i := by linarith + have e1 : gf (midAngle θ i) (eC (θ 1)) = halfCos θ i := by linarith + have e2 : gf (midAngle θ i) (eC (θ 2)) = halfCos θ i := by linarith + obtain ⟨m0, c0⟩ := A.node_eq e0 + obtain ⟨m1, c1⟩ := A.node_eq e1 + obtain ⟨m2, c2⟩ := A.node_eq e2 + have ab : ∀ {a b m m' : ℤ}, 0 ≤ a → a ≤ 2 → 0 ≤ b → b ≤ 2 → a + k * m = b + k * m' → a = b + := fun ha ha' hb hb' he => + IsAngles.same_class (k := k) he (abs_lt.mpr ⟨by omega, by omega⟩) + rcases c0 with c0 | c0 <;> rcases c1 with c1 | c1 <;> rcases c2 with c2 | c2 + · exact absurd (ab (a := 0) (b := 1) (by omega) (by omega) (by omega) (by omega) + (c0.trans c1.symm)) (by omega) + · exact absurd (ab (a := 0) (b := 1) (by omega) (by omega) (by omega) (by omega) + (c0.trans c1.symm)) (by omega) + · exact absurd (ab (a := 0) (b := 2) (by omega) (by omega) (by omega) (by omega) + (c0.trans c2.symm)) (by omega) + · exact absurd (ab (a := 1) (b := 2) (by omega) (by omega) (by omega) (by omega) + (c1.trans c2.symm)) (by omega) + · exact absurd (ab (a := 1) (b := 2) (by omega) (by omega) (by omega) (by omega) + (c1.trans c2.symm)) (by omega) + · exact absurd (ab (a := 0) (b := 2) (by omega) (by omega) (by omega) (by omega) + (c0.trans c2.symm)) (by omega) + · exact absurd (ab (a := 0) (b := 1) (by omega) (by omega) (by omega) (by omega) + (c0.trans c1.symm)) (by omega) + · exact absurd (ab (a := 0) (b := 1) (by omega) (by omega) (by omega) (by omega) + (c0.trans c1.symm)) (by omega) + have hle : ‖w‖ ≤ 1 := by + have h := norm_add₃_le (a := t • eC (θ 0)) (b := t • eC (θ 1)) (c := t • eC (θ 2)) + simp only [norm_smul, norm_eC, mul_one, t, Real.norm_eq_abs] at h + have ht : |(1 : ℝ) / 3| = 1 / 3 := abs_of_pos (by norm_num) + rw [ht] at h + calc ‖w‖ ≤ 1 / 3 + 1 / 3 + 1 / 3 := h + _ = 1 := by norm_num + have hlt1 : ‖w‖ < 1 := by + refine lt_of_le_of_ne hle fun he => ?_ + obtain ⟨s, hs⟩ := exists_eC he + obtain ⟨i, h1, h2⟩ := A.exists_arc s + have := A.gf_arc h1 h2.le + rw [← hs] at this + exact absurd this (not_le.mpr (hlt i)) + exact ⟨w, interior_maximal (IsAngles.core_subset (θ := θ)) A.isOpen_core ⟨hlt1, hlt⟩⟩ + +theorem seg_notMem_interior_hull {i : ℤ} {w : ℂ} (hw : w ∈ segment ℝ (eC (θ i)) (eC (θ + (i + 1)))) : w ∉ interior (hull θ) := by + intro hi + obtain ⟨ε, hε, hb⟩ := Metric.isOpen_iff.mp isOpen_interior w hi + have h1 : w + (ε / 2 : ℝ) • eC (midAngle θ i) ∈ ball w ε := by + rw [mem_ball_iff_norm, add_sub_cancel_left, norm_smul, norm_eC, mul_one, Real.norm_eq_abs, + abs_of_pos (by positivity)] + linarith + have h2 := (interior_subset (hb h1)).2 i + rw [gf_add, gf_smul, gf_eC, sub_self, Real.cos_zero] at h2 + have := A.seg_ge i hw + linarith + +theorem seg_notMem_interior_lune {i : ℤ} {w : ℂ} (hw : w ∈ segment ℝ (eC (θ i)) (eC (θ + (i + 1)))) : w ∉ interior (lune θ i) := by + intro hi + obtain ⟨ε, hε, hb⟩ := Metric.isOpen_iff.mp isOpen_interior w hi + have h1 : w + (-(ε / 2) : ℝ) • eC (midAngle θ i) ∈ ball w ε := by + rw [mem_ball_iff_norm, add_sub_cancel_left, norm_smul, norm_eC, mul_one, Real.norm_eq_abs, + abs_neg, abs_of_pos (by positivity)] + linarith + have h2 := (interior_subset (hb h1)).2 + rw [gf_add, gf_smul, gf_eC, sub_self, Real.cos_zero] at h2 + have := A.seg_le i i hw + linarith + +theorem frontier_hull : frontier (hull θ) = ⋃ i, segment ℝ (eC (θ i)) (eC (θ (i + 1))) := by + rw [frontier, isClosed_hull.closure_eq] + ext w + simp only [mem_sdiff, mem_iUnion] + constructor + · rintro ⟨h1, h2⟩ + by_contra hn + push Not at hn + refine h2 (interior_maximal (IsAngles.core_subset (θ := θ)) A.isOpen_core ⟨?_, fun i => ?_⟩) + · refine lt_of_le_of_ne h1.1 fun he => ?_ + obtain ⟨s, rfl⟩ := exists_eC he + obtain ⟨i, h3, h4⟩ := A.exists_arc s + exact hn i (A.chord_eq h1.1 (le_antisymm (h1.2 i) (A.gf_arc h3 h4.le))) + · exact lt_of_le_of_ne (h1.2 i) fun he => hn i (A.chord_eq h1.1 he) + · rintro ⟨i, hw⟩ + exact ⟨⟨IsAngles.seg_norm_le (θ := θ) hw, fun j => A.seg_le i j hw⟩, A.seg_notMem_interior_hull + hw⟩ + +theorem seg_shift (i m : ℤ) : segment ℝ (eC (θ (i + k * m))) (eC (θ (i + k * m + 1))) = segment ℝ + (eC (θ i)) (eC (θ (i + 1))) := by + rw [A.node_shift, show i + k * m + 1 = i + 1 + k * m by ring, A.node_shift] + +theorem node_ne {a b : ℤ} (hab : a < b) (hb : b < a + k) : eC (θ a) ≠ eC (θ b) := by + intro he + have h1 := A.mono hab + have h2 := (A.mono hb).trans_eq (A.theta_top a) + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp (Circle.ext he) + have hpi := Real.pi_pos + have hm1 : (m : ℝ) < 0 := by + by_contra hn + push Not at hn + nlinarith + have hm2 : (-1 : ℝ) < m := by + by_contra hn + push Not at hn + nlinarith + have h3 : m < 0 := by exact_mod_cast hm1 + have h4 : -1 < m := by exact_mod_cast hm2 + omega + +theorem isClosedDisc_hull : IsClosedDisc (hull θ) ∧ discBd (hull θ) = ⋃ i, segment ℝ (eC (θ i)) (eC + (θ (i + 1))) := by + obtain ⟨h1, h2⟩ := isClosedDisc_of_convex convex_hull' A.interior_hull + (isBounded_closedBall.subset hull_subset) isClosed_hull + exact ⟨h1, h2.trans A.frontier_hull⟩ + +theorem isClosedDisc_lune (i : ℤ) : IsClosedDisc (lune θ i) ∧ segment ℝ (eC (θ i)) (eC (θ + (i + 1))) ⊆ discBd (lune θ i) := by + obtain ⟨h1, h2⟩ := isClosedDisc_of_convex (convex_lune i) (A.interior_lune i) + (isBounded_closedBall.subset (lune_subset i)) (isClosed_lune i) + refine ⟨h1, fun w hw => ?_⟩ + rw [h2, frontier, (isClosed_lune i).closure_eq] + exact ⟨⟨IsAngles.seg_norm_le (θ := θ) hw, A.seg_ge i hw⟩, A.seg_notMem_interior_lune hw⟩ + +end IsAngles + +/-- A straight segment is a line. -/ +theorem isLineWithEnds_segment {a b : ℂ} (hab : a ≠ b) : IsLineWithEnds (segment ℝ a b) a b := by + let f : unitInterval → ℂ := fun t => AffineMap.lineMap a b (t : ℝ) + have hc : Continuous f := by + apply AffineMap.lineMap_continuous.comp continuous_subtype_val + have hi : Function.Injective f := fun x y he => by + have := (AffineMap.lineMap_injective ℝ hab) he + exact Subtype.ext this + have hr : range f = segment ℝ a b := by + rw [segment_eq_image_lineMap] + ext z + constructor + · rintro ⟨t, rfl⟩ + exact ⟨t.1, t.2, rfl⟩ + · rintro ⟨t, ht, rfl⟩ + exact ⟨⟨t, ht⟩, rfl⟩ + have hem := hc.isClosedEmbedding hi + refine ⟨hem.isEmbedding.toHomeomorph.trans (Homeomorph.setCongr hr), ?_, ?_⟩ + · change f 0 = a + simp [f] + · change f 1 = b + simp [f] + +/-- The periodic extension of an increasing family of angles. -/ +noncomputable def extAngle {k : ℕ} (hk : 0 < k) (s : Fin k → ℝ) (n : ℤ) : ℝ := + s ⟨(n % k).toNat, by + have h1 := Int.emod_nonneg n (show (k : ℤ) ≠ 0 by omega) + have h2 := Int.emod_lt_of_pos n (show (0 : ℤ) < k by omega) + omega⟩ + 2 * Real.pi * ((n / k : ℤ) : ℝ) + +theorem extAngle_fin {k : ℕ} (hk : 0 < k) (s : Fin k → ℝ) (i : Fin k) : extAngle hk s (i.1 : ℤ) + = s i := by + have h1 : ((i.1 : ℤ) % k) = i.1 := Int.emod_eq_of_lt (by omega) (by omega) + have h2 : ((i.1 : ℤ) / k) = 0 := Int.ediv_eq_zero_of_lt (by omega) (by omega) + have : (⟨((i.1 : ℤ) % k).toNat, by rw [h1]; simp⟩ : Fin k) = i := Fin.ext (by simp [h1]) + rw [extAngle] + simp only [h2, Int.cast_zero, mul_zero, add_zero] + exact congrArg s this + +theorem extAngle_period {k : ℕ} (hk : 0 < k) (s : Fin k → ℝ) (n m : ℤ) : + extAngle hk s (n + k * m) = extAngle hk s n + 2 * Real.pi * m := by + have h1 : (n + k * m) % (k : ℤ) = n % k := Int.add_mul_emod_self_left n k m + have h2 : (n + k * m) / (k : ℤ) = n / k + m := Int.add_mul_ediv_left n m (by omega) + simp only [extAngle, h1, h2] + push_cast + ring + +theorem isAngles_extAngle {k : ℕ} (hk : 3 ≤ k) (s : Fin k → ℝ) (hs : StrictMono s) + (hl : ∀ i, s i < s ⟨0, by omega⟩ + 2 * Real.pi) : IsAngles (extAngle (by omega) s) k := by + have hk0 : 0 < k := by omega + have hp := extAngle_period hk0 s + refine ⟨by exact_mod_cast hk, strictMono_int_of_lt_succ fun n => ?_, hp⟩ + have hr0 := Int.emod_nonneg n (show (k : ℤ) ≠ 0 by omega) + have hrk := Int.emod_lt_of_pos n (show (0 : ℤ) < k by omega) + have hn : n = n % k + k * (n / k) := (Int.emod_add_mul_ediv n k).symm + set r := n % (k : ℤ) with hr + set q := n / (k : ℤ) with hq + have e1 : n + 1 = (r + 1) + k * q := by omega + rw [e1, hn, hp, hp] + obtain ⟨r', hr'⟩ := Int.eq_ofNat_of_zero_le hr0 + have hr'k : r' < k := by omega + rw [hr'] + have hb : extAngle hk0 s (r' : ℤ) = s ⟨r', hr'k⟩ := extAngle_fin hk0 s ⟨r', hr'k⟩ + by_cases hc : r' + 1 < k + · have hb' : extAngle hk0 s ((r' : ℤ) + 1) = s ⟨r' + 1, hc⟩ := by + have := extAngle_fin hk0 s ⟨r' + 1, hc⟩ + simpa using this + rw [hb, hb'] + have := hs (show (⟨r', hr'k⟩ : Fin k) < ⟨r' + 1, hc⟩ by simp [Fin.lt_def]) + linarith + · have hrk' : (r' : ℤ) + 1 = 0 + k * 1 := by omega + rw [hrk', hp, hb] + have h0 := extAngle_fin hk0 s ⟨0, hk0⟩ + simp only [Nat.cast_zero] at h0 + rw [h0] + have := hl ⟨r', hr'k⟩ + push_cast + linarith + +/-- **The polygon and the lunes.** For at least three points of the unit circle, in order, the +closed unit disc splits into the polygon on the +points and one lune for each side. Each lune is a closed disc that meets the polygon in its side, +and two lunes meet only in the given points. -/ +theorem exists_polygon_lunes {k : ℕ} (hk : 3 ≤ k) (s : Fin k → ℝ) (hs : StrictMono s) + (hl : ∀ i, s i < s ⟨0, by omega⟩ + 2 * Real.pi) + (nx : Fin k → Fin k) (hnx : ∀ i, (nx i).1 = (i.1 + 1) % k) : + ∃ (P : Set ℂ) (L F : Fin k → Set ℂ), IsClosedDisc P ∧ P ⊆ closedBall 0 1 ∧ discBd P = ⋃ i, F i ∧ + closedBall 0 1 = P ∪ ⋃ i, L i ∧ + (∀ i, IsClosedDisc (L i) ∧ L i ⊆ closedBall 0 1 ∧ L i ∩ P = F i ∧ F i ⊆ discBd (L i) ∧ + IsLineWithEnds (F i) (eC (s i)) (eC (s (nx i)))) ∧ + (∀ i j, i ≠ j → L i ∩ L j ⊆ range fun i => eC (s i)) ∧ + ∀ i j, eC (s j) ∈ L i ↔ j = i ∨ j = nx i := by + have hk0 : 0 < k := by omega + have A := isAngles_extAngle hk s hs hl + set θ := extAngle hk0 s with hθ + have hfin : ∀ i : Fin k, θ i.1 = s i := extAngle_fin hk0 s + have hnode : ∀ i : Fin k, eC (θ (i.1 + 1)) = eC (s (nx i)) := fun i => by + have hnx' : ((nx i).1 : ℤ) + k * ((i.1 + 1) / k : ℕ) = i.1 + 1 := by + rw [hnx] + have := Nat.mod_add_div (i.1 + 1) k + exact_mod_cast this + rw [← hnx', A.node_shift, hfin] + have hcov : ∀ i : ℤ, ∃ (j : Fin k) (m : ℤ), i + k * m = j.1 := fun i => by + obtain ⟨m, h1, h2⟩ := A.exists_shift i (-1) + obtain ⟨j, hj⟩ := Int.eq_ofNat_of_zero_le (show 0 ≤ i + k * m by omega) + exact ⟨⟨j, by omega⟩, m, hj⟩ + have hne : ∀ {i j : Fin k}, i ≠ j → ∀ m : ℤ, (j.1 : ℤ) + k * m ≠ i.1 + k := fun {i j} hij m he + => by + have : (j.1 : ℤ) = i.1 := IsAngles.same_class (k := k) (m := m) (m' := 1) (by rw [he, mul_one]) + (abs_lt.mpr ⟨by omega, by omega⟩) + exact hij (Fin.ext (by omega)).symm + refine ⟨hull θ, fun i => lune θ i.1, fun i => segment ℝ (eC (s i)) (eC (s + (nx i))), A.isClosedDisc_hull.1, IsAngles.hull_subset, ?_, ?_, fun i => ?_, fun i j hij + => ?_, fun i j => ?_⟩ + · rw [A.isClosedDisc_hull.2] + ext w + simp only [mem_iUnion] + constructor + · rintro ⟨i, hw⟩ + obtain ⟨j, m, hjm⟩ := hcov i + refine ⟨j, ?_⟩ + rw [← A.seg_shift i m, hjm, hnode, hfin] at hw + exact hw + · rintro ⟨i, hw⟩ + refine ⟨i.1, ?_⟩ + rw [hnode, hfin] + exact hw + · apply subset_antisymm + · intro w hw + have hw1 : ‖w‖ ≤ 1 := by simpa using hw + by_cases h : ∀ i, gf (midAngle θ i) w ≤ halfCos θ i + · exact Or.inl ⟨hw1, h⟩ + · push Not at h + obtain ⟨i, hi⟩ := h + obtain ⟨j, m, hjm⟩ := hcov i + refine Or.inr (mem_iUnion.2 ⟨j, ?_⟩) + show w ∈ lune θ j.1 + rw [← hjm, A.lune_shift] + exact ⟨hw1, hi.le⟩ + · exact union_subset IsAngles.hull_subset (iUnion_subset fun i => IsAngles.lune_subset _) + · have hseg := A.lune_inter_hull i.1 + rw [hnode, hfin] at hseg + have hd := A.isClosedDisc_lune i.1 + rw [hnode, hfin] at hd + refine ⟨hd.1, IsAngles.lune_subset _, hseg, hd.2, isLineWithEnds_segment ?_⟩ + rw [← hnode, ← hfin] + exact A.node_ne (by omega) (by have := A.three; omega) + · rintro w ⟨hi, hj⟩ + have h1 : gf (midAngle θ i.1) w = halfCos θ i.1 := le_antisymm (A.lune_le (hne hij) hj) hi.2 + have h2 : gf (midAngle θ j.1) w = halfCos θ j.1 := le_antisymm (A.lune_le + (hne hij.symm) hi) hj.2 + have hseg := A.chord_eq hi.1 h1 + rcases gf_segment_eq (A.node_le i.1 j.1) (A.node_le (i.1 + 1) j.1) hseg h2 with rfl | rfl | + ⟨e1, e2⟩ + · exact ⟨i, by simp only [← hfin i]⟩ + · exact ⟨nx i, by simp only [← hfin (nx i), hnode i]⟩ + · exfalso + obtain ⟨m₁, c₁⟩ := A.node_eq e1 + obtain ⟨m₂, c₂⟩ := A.node_eq e2 + have hk' := A.three + have hij' : (i.1 : ℤ) ≠ j.1 := fun h => hij (Fin.ext (by omega)) + have hcl : ∀ m m' : ℤ, (i.1 : ℤ) + k * m ≠ j.1 + k * m' := fun m m' he => + hij' (IsAngles.same_class (k := k) he (abs_lt.mpr ⟨by omega, by omega⟩)) + rcases c₁ with c₁ | c₁ <;> rcases c₂ with c₂ | c₂ + · exact hcl m₂ 0 (by linarith) + · have hd : (k : ℤ) ∣ 2 := ⟨1 + m₁ - m₂, by linear_combination c₂ - c₁⟩ + have := Int.le_of_dvd (by norm_num) hd + omega + · exact hcl m₁ 1 (by linarith) + · exact hcl m₁ 1 (by linarith) + · constructor + · intro hm + have h1 : gf (midAngle θ i.1) (eC (s j)) = halfCos θ i.1 := by + rw [← hfin j] + exact le_antisymm (A.node_le _ _) (hfin j ▸ hm.2) + rw [← hfin j] at h1 + obtain ⟨m, c⟩ := A.node_eq h1 + have hk' := A.three + rcases c with c | c + · right + apply Fin.ext + rw [hnx] + have h2 : ((j.1 : ℤ) + k * m) % k = j.1 % k := Int.add_mul_emod_self_left _ _ _ + rw [c] at h2 + have h3 : (j.1 : ℤ) % k = j.1 := Int.emod_eq_of_lt (by omega) (by omega) + rw [h3] at h2 + have : ((i.1 + 1 : ℕ) : ℤ) % k = ((j.1 : ℕ) : ℤ) := by push_cast; exact h2 + exact_mod_cast this.symm + · left + have : (j.1 : ℤ) = i.1 := IsAngles.same_class (k := k) (m := m) (m' := 1) + (by rw [c, mul_one]) (abs_lt.mpr ⟨by omega, by omega⟩) + exact Fin.ext (by omega) + · rintro (rfl | rfl) + · refine ⟨by rw [norm_eC], ?_⟩ + rw [← hfin j] + exact A.gf_arc le_rfl (A.mono (by omega)).le + · refine ⟨by rw [norm_eC], ?_⟩ + rw [← hnode i] + exact A.gf_arc (A.mono (by omega)).le le_rfl + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Mesh.lean b/LeanPool/GraphMinor/Surface/Mesh.lean new file mode 100644 index 0000000000..bc1136b2e3 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Mesh.lean @@ -0,0 +1,387 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.MeshLine + +/-! +# Cutting a Jordan domain into small pieces + +`cutTree_small`: for every `O`-arc `F` and `ε > 0` there is a finite tree of cuts from `F` whose +leaves have diameter below `ε`. The cuts are segments of a grid. By `no_cross`, cutting along the +long segments of one line leaves pieces that stay on one side of the line, up to a small margin +(`line_tree`). Doing this for each line of the grid gives pieces inside small squares. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Complex + +local notation "𝕀" => unitInterval + +/-- Disjoint segments of a line that lie inside `G` or outside it can be cut one after the other. -/ +theorem tree_segments {ι : ℝ → ℂ} (hι : Isometry ι) (L : List (ℝ × ℝ)) : + ∀ G : Set ℂ, Nonempty (Circle ≃ₜ G) → (∀ x ∈ L, x.1 < x.2) → + L.Pairwise (fun x y => Disjoint (Ioo x.1 x.2) (Ioo y.1 y.2)) → + (∀ x ∈ L, ι x.1 ∉ inner G ∧ ι x.2 ∉ inner G) → + (∀ x ∈ L, ι '' Ioo x.1 x.2 ⊆ inner G ∨ Disjoint (ι '' Ioo x.1 x.2) (inner G)) → + CutTree (fun U => ∀ x ∈ L, Disjoint (ι '' Ioo x.1 x.2) U) G := by + induction L with + | nil => + intro G _ _ _ _ _ + exact .leaf (by simp) + | cons x L ih => + intro G hG hlt hpair hend hside + obtain ⟨φ⟩ := id hG + have J := isJordanParts φ + have hanti : ∀ {U V : Set ℂ}, U ⊆ V → Disjoint (ι '' Ioo x.1 x.2) V → + Disjoint (ι '' Ioo x.1 x.2) U := fun h hd => hd.mono_right h + have hmap : ∀ {H : Set ℂ}, Nonempty (Circle ≃ₜ H) → + CutTree (fun U => Disjoint (ι '' Ioo x.1 x.2) U ∧ ∀ y ∈ L, Disjoint (ι '' Ioo y.1 y.2) U) H + → + CutTree (fun U => ∀ y ∈ x :: L, Disjoint (ι '' Ioo y.1 y.2) U) H := fun hH t => + t.map hH fun H' _ hp y hy => by + rcases List.mem_cons.mp hy with rfl | hy + · exact hp.1 + · exact hp.2 y hy + have hxlt := hlt x (List.mem_cons_self) + have hrest : ∀ y ∈ L, y ∈ x :: L := fun y hy => List.mem_cons_of_mem _ hy + obtain ⟨hpx, hpL⟩ := List.pairwise_cons.mp hpair + rcases hside x List.mem_cons_self with hin | hout + · -- Cut along the segment. + let e : 𝕀 → ℂ := fun s => ι (x.1 + (x.2 - x.1) * s) + have hgap : 0 < x.2 - x.1 := by linarith [hxlt] + have hec : Continuous e := hι.continuous.comp (by fun_prop) + have hei : Function.Injective e := fun s s' h => by + have h1 := hι.injective h + exact Subtype.ext (mul_left_cancel₀ hgap.ne' (add_left_cancel h1)) + have he0 : e 0 = ι x.1 := by simp [e] + have he1 : e 1 = ι x.2 := by simp [e] + have hmemIcc : ∀ s : 𝕀, x.1 + (x.2 - x.1) * s ∈ Icc x.1 x.2 := fun s => by + have h0 : 0 ≤ (s : ℝ) := s.2.1 + have h1 : (s : ℝ) ≤ 1 := s.2.2 + constructor <;> nlinarith + have hrange : range e = ι '' Icc x.1 x.2 := by + ext z + constructor + · rintro ⟨s, rfl⟩ + exact ⟨_, hmemIcc s, rfl⟩ + · rintro ⟨r, hr, rfl⟩ + refine ⟨⟨(r - x.1) / (x.2 - x.1), div_nonneg (by linarith [hr.1]) hgap.le, + (div_le_one hgap).mpr (by linarith [hr.2])⟩, ?_⟩ + simp only [e] + rw [mul_div_cancel₀ _ hgap.ne'] + congr 1 + ring + have hend' : ∀ r ∈ Icc x.1 x.2, ι r ∉ inner G → ι r ∈ G := by + intro r hr hrn + have h3 : ι r ∈ closure (ι '' Ioo x.1 x.2) := by + have h4 : r ∈ closure (Ioo x.1 x.2) := by rw [closure_Ioo hxlt.ne]; exact hr + exact image_closure_subset_closure_image hι.continuous ⟨r, h4, rfl⟩ + have h6 := closure_mono hin h3 + rw [J.closure_inner] at h6 + exact h6.resolve_left hrn + have hx12 := hend x List.mem_cons_self + have h0G : e 0 ∈ G := he0 ▸ hend' _ ⟨le_rfl, hxlt.le⟩ hx12.1 + have h1G : e 1 ∈ G := he1 ▸ hend' _ ⟨hxlt.le, le_rfl⟩ hx12.2 + have hne : e 0 ≠ e 1 := fun h => by + have := hei h + exact absurd (congrArg Subtype.val this) (by simp) + have hinside : ∀ s, s ≠ 0 → s ≠ 1 → e s ∈ inner G := by + intro s h0 h1 + have h0' : (0 : ℝ) < s := lt_of_le_of_ne s.2.1 fun h => h0 (Subtype.ext h.symm) + have h1' : (s : ℝ) < 1 := lt_of_le_of_ne s.2.2 fun h => h1 (Subtype.ext h) + refine hin ⟨_, ⟨?_, ?_⟩, rfl⟩ <;> nlinarith + obtain ⟨a, b, hc⟩ := exists_isCut φ ⟨hec, hei⟩ hne h0G h1G hinside + have hT := hc.isTheta J + have hsplit : ∀ y ∈ L, ι '' Ioo y.1 y.2 ⊆ inner G → + ι '' Ioo y.1 y.2 ⊆ inner (side a e) ∨ ι '' Ioo y.1 y.2 ⊆ inner (side b e) := by + intro y hy hyin + have hdisj : Disjoint (ι '' Ioo y.1 y.2) (range e) := by + rw [hrange] + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨r, hr, rfl⟩ ⟨r', hr', he⟩ + have hrr : r' = r := hι.injective he + subst hrr + rcases eq_or_lt_of_le hr'.1 with h | h + · exact hx12.1 (h ▸ hyin ⟨_, hr, rfl⟩) + · rcases eq_or_lt_of_le hr'.2 with h' | h' + · exact hx12.2 (h' ▸ hyin ⟨_, hr, rfl⟩) + · exact Set.disjoint_left.mp (hpx y hy) ⟨h, h'⟩ hr + have hsub : ι '' Ioo y.1 y.2 ⊆ inner (side a e) ∪ inner (side b e) := by + rw [← hT.inner_sdiff] + exact fun z hz => ⟨hyin hz, Set.disjoint_left.mp hdisj hz⟩ + have hpre : IsPreconnected (ι '' Ioo y.1 y.2) := + isPreconnected_Ioo.image _ hι.continuous.continuousOn + have hJa := hT.parts₁ + have hJb := hT.parts₂ + by_cases hemp : (ι '' Ioo y.1 y.2 ∩ inner (side a e)).Nonempty + · exact Or.inl (hpre.subset_left_of_subset_union hJa.isOpen_inner hJb.isOpen_inner + hT.disjoint_inner hsub hemp) + · right + intro z hz + exact (hsub hz).resolve_left fun hz' => hemp ⟨z, hz, hz'⟩ + have hchild : ∀ {c : 𝕀 → ℂ} {d : 𝕀 → ℂ}, IsCut G c d e → + (∀ y ∈ L, ι '' Ioo y.1 y.2 ⊆ inner G → ι '' Ioo y.1 y.2 ⊆ inner (side c e) ∨ + ι '' Ioo y.1 y.2 ⊆ inner (side d e)) → + (Disjoint (inner (side c e)) (inner (side d e))) → + CutTree (fun U => ∀ y ∈ x :: L, Disjoint (ι '' Ioo y.1 y.2) U) (side c e) := by + intro c d hcd hsp hdj + have hsub' := (hcd.inner_side_subset J).1 + have hoa := hcd.oArc_side + have ht := ih (side c e) hoa (fun y hy => hlt y (hrest y hy)) hpL + (fun y hy => ⟨fun h => (hend y (hrest y hy)).1 (hsub' h), + fun h => (hend y (hrest y hy)).2 (hsub' h)⟩) + (fun y hy => by + rcases hside y (hrest y hy) with h | h + · rcases hsp y hy h with h' | h' + · exact Or.inl h' + · right + exact (Set.disjoint_of_subset_left h' hdj.symm) + · exact Or.inr (h.mono_right hsub')) + refine hmap hoa (ht.strengthen hanti hoa ?_) + refine Set.disjoint_left.mpr fun z hz hzin => ?_ + have hzr : z ∈ range e := by + rw [hrange] + obtain ⟨r, hr, rfl⟩ := hz + exact ⟨r, ⟨hr.1.le, hr.2.le⟩, rfl⟩ + exact hzin.1 (Or.inr hzr) + refine .node hc (hchild hc hsplit hT.disjoint_inner) + (hchild hc.symm (fun y hy h => (hsplit y hy h).symm) hT.disjoint_inner.symm) + · have ht := ih G hG (fun y hy => hlt y (hrest y hy)) hpL (fun y hy => hend y (hrest y hy)) + (fun y hy => hside y (hrest y hy)) + exact hmap hG (ht.strengthen hanti hG hout) + +/-- Cutting along the long segments of a line leaves pieces on one side of it, up to a margin. -/ +theorem line_tree {F : Set ℂ} (φ : Circle ≃ₜ F) {ρ : ℝ} (hρ : 0 < ρ) {ι : ℝ → ℂ} (hι : Isometry ι) + {ℓ : ℂ → ℝ} (hℓ : Continuous ℓ) {t : ℝ} (hline : ∀ z, ℓ z = t → z ∈ range ι) + (hℓι : ∀ r, ℓ (ι r) = t) (hlip : ∀ z r, |ℓ z - t| ≤ dist z (ι r)) : + CutTree (fun U => ∀ y₁ ∈ U, ∀ y₂ ∈ U, ℓ y₁ < t - ρ → ℓ y₂ ≤ t + ρ) F := by + classical + have J := isJordanParts φ + obtain ⟨δ₀, hδ₀, hsmall⟩ := exists_small_arc φ hρ + set δ := min δ₀ ρ with hδ + have hδpos : 0 < δ := lt_min hδ₀ hρ + set V := ι ⁻¹' inner F with hV + have hVb : Bornology.IsBounded V := by + obtain ⟨R, hR⟩ := J.isBounded_inner.subset_ball 0 + refine (Metric.isBounded_closedBall (x := (0 : ℝ)) (r := R + ‖ι 0‖)).subset fun r hr => ?_ + have h3 : ‖ι r‖ < R := mem_ball_zero_iff.mp (hR hr) + have h4 := norm_sub_le (ι r) (ι 0) + rw [← dist_eq_norm, hι.dist_eq, Real.dist_eq, sub_zero] at h4 + rw [mem_closedBall, Real.dist_eq, sub_zero] + linarith + obtain ⟨N, hN⟩ := hVb.subset_closedBall 0 + let C : Set (ℝ × ℝ) := {x | Ioo x.1 x.2 ⊆ V ∧ x.1 ∉ V ∧ x.2 ∉ V ∧ δ ≤ x.2 - x.1} + let κ : ℝ × ℝ → ℤ := fun x => ⌊2 * x.1 / δ⌋ + 1 + have hpoint : ∀ x ∈ C, (κ x : ℝ) * δ / 2 ∈ Ioo x.1 x.2 := by + intro x hx + have h1 := Int.floor_le (2 * x.1 / δ) + have h2 := Int.lt_floor_add_one (2 * x.1 / δ) + have h3 : (⌊2 * x.1 / δ⌋ : ℝ) * δ ≤ 2 * x.1 := by + rwa [le_div_iff₀ hδpos] at h1 + have h4 : 2 * x.1 < ((⌊2 * x.1 / δ⌋ : ℝ) + 1) * δ := by + rwa [div_lt_iff₀ hδpos] at h2 + have h5 := hx.2.2.2 + simp only [κ] + push_cast + constructor <;> nlinarith + have hfin : C.Finite := by + set K : ℤ := ⌈2 * N / δ⌉ + 1 with hK + refine Set.Finite.of_injOn (f := κ) (t := Icc (-K) K) ?_ ?_ (Set.finite_Icc _ _) + · intro x hx + have h1 : (κ x : ℝ) * δ / 2 ∈ V := hx.1 (hpoint x hx) + have h2 := hN h1 + rw [mem_closedBall, Real.dist_eq, sub_zero] at h2 + have h3 := abs_le.mp h2 + have h4 := Int.le_ceil (2 * N / δ) + have h5 : 2 * N ≤ (⌈2 * N / δ⌉ : ℝ) * δ := by rwa [div_le_iff₀ hδpos] at h4 + have h6 : (κ x : ℝ) ≤ K := by + have : (κ x : ℝ) * δ ≤ (K : ℝ) * δ := by + rw [hK] + push_cast + nlinarith [h3.2] + exact le_of_mul_le_mul_right this hδpos + have h7 : (-K : ℝ) ≤ κ x := by + have : (-(K : ℝ)) * δ ≤ (κ x : ℝ) * δ := by + rw [hK] + push_cast + nlinarith [h3.1] + exact le_of_mul_le_mul_right this hδpos + exact ⟨by exact_mod_cast h7, by exact_mod_cast h6⟩ + · intro x hx y hy hxy + have hp := hpoint x hx + have hp' := hpoint y hy + rw [show (κ x : ℝ) = κ y by rw [hxy]] at hp + obtain ⟨h1, h2⟩ := interval_unique hx.1 hy.1 hx.2.1 hx.2.2.1 hy.2.1 hy.2.2.1 hp hp' + exact Prod.ext h1 h2 + let L : List (ℝ × ℝ) := hfin.toFinset.toList + have hL : ∀ x, x ∈ L ↔ x ∈ C := fun x => by simp [L] + have hlt : ∀ x ∈ L, x.1 < x.2 := fun x hx => by + have := ((hL x).mp hx).2.2.2 + linarith + have hpair : L.Pairwise (fun x y => Disjoint (Ioo x.1 x.2) (Ioo y.1 y.2)) := by + refine (hfin.toFinset.nodup_toList).imp_of_mem ?_ + intro x y hx hy hne + have hx' := (hL x).mp hx + have hy' := (hL y).mp hy + refine Set.disjoint_left.mpr fun r h1 h2 => hne ?_ + obtain ⟨h3, h4⟩ := interval_unique hx'.1 hy'.1 hx'.2.1 hx'.2.2.1 hy'.2.1 hy'.2.2.1 h1 h2 + exact Prod.ext h3 h4 + have ht := tree_segments hι L F ⟨φ⟩ hlt hpair + (fun x hx => ⟨((hL x).mp hx).2.1, ((hL x).mp hx).2.2.1⟩) + (fun x hx => Or.inl (image_subset_iff.mpr ((hL x).mp hx).1)) + have hanti : ∀ {U W : Set ℂ}, U ⊆ W → W ⊆ inner F → U ⊆ inner F := fun h h' => h.trans h' + refine (ht.strengthen hanti ⟨φ⟩ Subset.rfl).map ⟨φ⟩ fun G hG hp y₁ hy₁ y₂ hy₂ h1 => ?_ + obtain ⟨ψ⟩ := hG + by_contra hc + rw [not_le] at hc + refine no_cross φ hρ (min_le_right _ _) (fun u hu v hv huv => hsmall u hu v hv + (lt_of_lt_of_le huv (min_le_left _ _))) hι hℓ hline hℓι hlip + (isJordanParts ψ).isConnected_inner.isPreconnected hp.1 ?_ hy₁ hy₂ h1 hc + intro a b hsub ha hb hl r hr hrG + have hx : (a, b) ∈ L := (hL _).mpr ⟨hsub, ha, hb, hl⟩ + exact Set.disjoint_left.mp (hp.2 _ hx) ⟨r, hr, rfl⟩ hrG + +/-- The two kinds of lines of the grid. -/ +private def lineMap (b : Bool) (t r : ℝ) : ℂ := if b then ⟨t, r⟩ else ⟨r, t⟩ + +private def lineCoord (b : Bool) (z : ℂ) : ℝ := if b then z.re else z.im + +private theorem isometry_lineMap (b : Bool) (t : ℝ) : Isometry (lineMap b t) := by + refine Isometry.of_dist_eq fun r s => ?_ + cases b + · simp only [lineMap, Bool.false_eq_true, ite_false] + exact Complex.dist_of_im_eq (z := ⟨r, t⟩) (w := ⟨s, t⟩) rfl + · simp only [lineMap, ite_true] + exact Complex.dist_of_re_eq (z := ⟨t, r⟩) (w := ⟨t, s⟩) rfl + +private theorem lineCoord_lip (b : Bool) (t : ℝ) (z : ℂ) (r : ℝ) : + |lineCoord b z - t| ≤ dist z (lineMap b t r) := by + rw [dist_eq_norm] + cases b + · simpa [lineCoord, lineMap] using Complex.abs_im_le_norm (z - ⟨r, t⟩) + · simpa [lineCoord, lineMap] using Complex.abs_re_le_norm (z - ⟨t, r⟩) + +private theorem tree_lines (ρ : ℝ) (hρ : 0 < ρ) (Ls : List (Bool × ℝ)) : + ∀ G : Set ℂ, Nonempty (Circle ≃ₜ G) → CutTree (fun U => ∀ p ∈ Ls, ∀ y₁ ∈ U, ∀ y₂ ∈ U, + lineCoord p.1 y₁ < p.2 - ρ → lineCoord p.1 y₂ ≤ p.2 + ρ) G := by + induction Ls with + | nil => + intro G _ + exact .leaf (by simp) + | cons p Ls ih => + intro G hG + obtain ⟨φ⟩ := id hG + have hc : Continuous (lineCoord p.1) := by + cases hb : p.1 + · exact Complex.continuous_im + · exact Complex.continuous_re + have ht := line_tree (t := p.2) φ hρ (isometry_lineMap p.1 p.2) hc + (fun z hz => by + cases hb : p.1 + · simp only [hb, lineCoord, Bool.false_eq_true, ite_false] at hz + refine ⟨z.re, ?_⟩ + simp only [lineMap, Bool.false_eq_true, ite_false] + exact Complex.ext rfl hz.symm + · simp only [hb, lineCoord, ite_true] at hz + refine ⟨z.im, ?_⟩ + simp only [lineMap, ite_true] + exact Complex.ext hz.symm rfl) + (fun r => by + cases hb : p.1 <;> simp [lineCoord, lineMap]) + (lineCoord_lip p.1 p.2) + have hbound := ht.bind (P := fun U => ∀ p ∈ Ls, ∀ y₁ ∈ U, ∀ y₂ ∈ U, + lineCoord p.1 y₁ < p.2 - ρ → lineCoord p.1 y₂ ≤ p.2 + ρ) + (fun h hq y₁ h1 y₂ h2 => hq y₁ (h h1) y₂ (h h2)) hG ih + refine hbound.map hG fun H _ hp q hq => ?_ + rcases List.mem_cons.mp hq with rfl | hq + · exact hp.1 + · exact hp.2 q hq + +/-- **Small pieces.** Every Jordan domain can be cut into pieces of diameter below `ε` by a finite +tree of cuts. -/ +theorem cutTree_small {F : Set ℂ} (hF : Nonempty (Circle ≃ₜ F)) {ε : ℝ} (hε : 0 < ε) : + CutTree (fun U => ∀ x ∈ U, ∀ y ∈ U, dist x y < ε) F := by + classical + obtain ⟨φ⟩ := id hF + have J := isJordanParts φ + obtain ⟨R, hR⟩ := J.isBounded_inner.subset_ball 0 + set η := ε / 8 with hη + have hηpos : 0 < η := by positivity + set K : ℤ := ⌈R / η⌉ + 3 with hK + let Ls : List (Bool × ℝ) := (Finset.Icc (-K) K).toList.flatMap fun k => + [(true, (k : ℝ) * η), (false, (k : ℝ) * η)] + have hLs : ∀ (b : Bool) (k : ℤ), k ∈ Icc (-K) K → (b, (k : ℝ) * η) ∈ Ls := by + intro b k hk + refine List.mem_flatMap.mpr ⟨k, by simpa using hk, ?_⟩ + cases b <;> simp + have ht := tree_lines η hηpos Ls F hF + refine ((ht.strengthen (Q := fun U => U ⊆ inner F) (fun h h' => h.trans h') hF + Subset.rfl)).map hF fun G _ hp x hx y hy => ?_ + -- In each direction the two points are close. + have hclose : ∀ (b : Bool) (x y : ℂ), x ∈ inner G → y ∈ inner G → + lineCoord b y - lineCoord b x ≤ 3 * η := by + intro b x y hx hy + by_contra hc + rw [not_le] at hc + set A := lineCoord b x with hA + have hxn : ‖x‖ < R := mem_ball_zero_iff.mp (hR (hp.1 hx)) + have hAabs : |A| < R := by + refine lt_of_le_of_lt ?_ hxn + cases b + · exact Complex.abs_im_le_norm x + · exact Complex.abs_re_le_norm x + set k : ℤ := ⌊(A + η) / η⌋ + 1 with hkdef + have h1 := Int.floor_le ((A + η) / η) + have h2 := Int.lt_floor_add_one ((A + η) / η) + have h3 : (⌊(A + η) / η⌋ : ℝ) * η ≤ A + η := by rwa [le_div_iff₀ hηpos] at h1 + have h4 : A + η < ((⌊(A + η) / η⌋ : ℝ) + 1) * η := by rwa [div_lt_iff₀ hηpos] at h2 + have hkc : (k : ℝ) = (⌊(A + η) / η⌋ : ℝ) + 1 := by rw [hkdef]; push_cast; ring + have h5 : A + η < (k : ℝ) * η := by rw [hkc]; exact h4 + have h6 : (k : ℝ) * η ≤ A + 2 * η := by rw [hkc]; nlinarith + have hRK := Int.le_ceil (R / η) + have hRK' : R ≤ (⌈R / η⌉ : ℝ) * η := by rwa [div_le_iff₀ hηpos] at hRK + have hKη : (K : ℝ) * η = (⌈R / η⌉ : ℝ) * η + 3 * η := by rw [hK]; push_cast; ring + have hAb := abs_lt.mp hAabs + have hkU : k ≤ K := by + have : (k : ℝ) * η ≤ (K : ℝ) * η := by rw [hKη]; linarith [hAb.2] + exact_mod_cast le_of_mul_le_mul_right this hηpos + have hkL : -K ≤ k := by + have : (-(K : ℝ)) * η ≤ (k : ℝ) * η := by + have : (-(K : ℝ)) * η = -((K : ℝ) * η) := by ring + rw [this, hKη] + linarith [hAb.1] + exact_mod_cast le_of_mul_le_mul_right this hηpos + have hkey := hp.2 (b, (k : ℝ) * η) (hLs b k ⟨hkL, hkU⟩) x hx y hy (by simp only; linarith) + simp only at hkey + linarith + have hre : |x.re - y.re| ≤ 3 * η := abs_le.mpr ⟨by + have := hclose true x y hx hy + simp only [lineCoord, ite_true] at this + linarith, by + have := hclose true y x hy hx + simp only [lineCoord, ite_true] at this + linarith⟩ + have him : |x.im - y.im| ≤ 3 * η := abs_le.mpr ⟨by + have := hclose false x y hx hy + simp only [lineCoord, Bool.false_eq_true, ite_false] at this + linarith, by + have := hclose false y x hy hx + simp only [lineCoord, Bool.false_eq_true, ite_false] at this + linarith⟩ + rw [dist_eq_norm] + have hn := Complex.norm_le_abs_re_add_abs_im (x - y) + simp only [Complex.sub_re, Complex.sub_im] at hn + rw [hη] at hre him + linarith + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/MeshLine.lean b/LeanPool/GraphMinor/Surface/MeshLine.lean new file mode 100644 index 0000000000..40b332f99b --- /dev/null +++ b/LeanPool/GraphMinor/Surface/MeshLine.lean @@ -0,0 +1,472 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutTree + +/-! +# A line and the long pieces of it inside a Jordan domain + +Let `W` be the inner domain of an `O`-arc `F`, and `L` a line. `L ∩ W` is a union of open segments. +The theorem `no_cross` says: if a connected subset `G` of `W` avoids all segments of length at least +`δ`, then `G` has no two points on opposite sides of `L` at distance more than `ρ` from it. Here `δ` +depends only on `F` and `ρ`. + +The proof uses logarithms. Suppose `G` has such points `y₁, y₂`, and let `f = (z - y₂) / (z - y₁)`. +Let `K` be the complement of `W` in a large ball together with the long segments. `G` joins `y₁` to +`y₂` off `K`, so `f` has a logarithm `l` on `K`. It also has a logarithm `g` on a long piece `I` of +`L`, since `I` is an arc. The difference `l - g` on `K ∩ I` takes values in `2πiℤ`. It does not +jump across a short segment `s` of `L ∩ W`: the ends of `s` are near each other on `F`, so a small +arc `A` of `F` joins them, and `f` has a logarithm on a small disc around `s ∪ A`, which compares +`l` and `g` at the two ends. So `l - g` is constant, and the two logarithms paste on `K ∪ I`. Then +`y₁, y₂` lie in one component of the complement of `K ∪ I`, and this is false because `I` is a +piece of `L` that crosses the ball. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Complex + +local notation "𝕀" => unitInterval + +/-- Near points of an `O`-arc are joined by a small connected subset of the arc. -/ +theorem exists_small_arc {F : Set ℂ} (φ : Circle ≃ₜ F) {ρ : ℝ} (hρ : 0 < ρ) : + ∃ δ : ℝ, 0 < δ ∧ ∀ u ∈ F, ∀ v ∈ F, dist u v < δ → + ∃ A ⊆ F, IsPreconnected A ∧ u ∈ A ∧ v ∈ A ∧ A ⊆ ball u ρ := by + obtain ⟨η, δ, hη, hηπ, hδ, hnear, hfar⟩ := exists_arc_constants φ hρ + refine ⟨δ, hδ, fun u hu v hv huv => ?_⟩ + let t : Circle := φ.symm ⟨u, hu⟩ + have hut : arcPoint φ t 0 = u := by simp [arcPoint, t] + obtain ⟨θ, h1, h2, h3⟩ := exists_angle_near t (φ.symm ⟨v, hv⟩) η hη.le hηπ.le + have hvθ : arcPoint φ t θ = v := by simp [arcPoint, ← h3] + have hθ : θ ≤ η := by + by_contra hc + have := hfar t θ ⟨(not_le.mp hc).le, h2⟩ + rw [hvθ, hut, dist_comm] at this + linarith + have hthetac : Continuous fun θ : ℝ => arcPoint φ t θ := + (continuous_arcPoint φ).comp (continuous_const.prodMk continuous_id) + refine ⟨(fun θ : ℝ => arcPoint φ t θ) '' Icc (-η) η, ?_, isPreconnected_Icc.image _ + hthetac.continuousOn, + ⟨0, ⟨by linarith, hη.le⟩, hut⟩, ⟨θ, ⟨h1, hθ⟩, hvθ⟩, ?_⟩ + · rintro _ ⟨r, -, rfl⟩ + exact (φ _).2 + · rintro _ ⟨r, hr, rfl⟩ + rw [mem_ball, ← hut] + exact hnear t r (abs_le.mpr hr) + +/-- A point of a bounded open set of reals lies in an interval of the set with ends outside it. -/ +theorem exists_interval_of_mem {V : Set ℝ} (hV : IsOpen V) (hb : Bornology.IsBounded V) {r : ℝ} + (hr : r ∈ V) : ∃ a b, r ∈ Ioo a b ∧ Ioo a b ⊆ V ∧ a ∉ V ∧ b ∉ V := by + obtain ⟨R, hR⟩ := hb.subset_closedBall 0 + have hout : ∀ x, R < |x| → x ∉ V := fun x hx hxV => by + have := hR hxV + rw [mem_closedBall, Real.dist_eq, sub_zero] at this + linarith + have hA : IsClosed (Vᶜ ∩ Iic r) := hV.isClosed_compl.inter isClosed_Iic + have hB : IsClosed (Vᶜ ∩ Ici r) := hV.isClosed_compl.inter isClosed_Ici + have hRabs : |r| ≤ R := by + have := hR hr + rwa [mem_closedBall, Real.dist_eq, sub_zero] at this + have hRnn : 0 ≤ R := (abs_nonneg r).trans hRabs + have hneA : (Vᶜ ∩ Iic r).Nonempty := by + refine ⟨-R - 1, hout _ ?_, ?_⟩ + · rw [abs_of_nonpos (by linarith)] + linarith + · have := (abs_le.mp hRabs).1 + change -R - 1 ≤ r + linarith + have hneB : (Vᶜ ∩ Ici r).Nonempty := by + refine ⟨R + 1, hout _ ?_, ?_⟩ + · rw [abs_of_nonneg (by linarith)] + linarith + · have := (abs_le.mp hRabs).2 + change r ≤ R + 1 + linarith + have hbddA : BddAbove (Vᶜ ∩ Iic r) := ⟨r, fun _ h => h.2⟩ + have hbddB : BddBelow (Vᶜ ∩ Ici r) := ⟨r, fun _ h => h.2⟩ + have ha := hA.csSup_mem hneA hbddA + have hb' := hB.csInf_mem hneB hbddB + set a := sSup (Vᶜ ∩ Iic r) + set b := sInf (Vᶜ ∩ Ici r) + have har : a < r := lt_of_le_of_ne ha.2 fun h => ha.1 (h ▸ hr) + have hrb : r < b := lt_of_le_of_ne hb'.2 fun h => hb'.1 (h.symm ▸ hr) + refine ⟨a, b, ⟨har, hrb⟩, fun x hx => ?_, ha.1, hb'.1⟩ + by_contra hn + rcases le_total x r with h | h + · exact absurd (le_csSup hbddA ⟨hn, h⟩) (not_le.mpr hx.1) + · exact absurd (csInf_le hbddB ⟨hn, h⟩) (not_le.mpr hx.2) + +/-- Two such intervals through a point are equal. -/ +theorem interval_unique {V : Set ℝ} {a b c d : ℝ} (h1 : Ioo a b ⊆ V) (h2 : Ioo c d ⊆ V) (ha : a ∉ V) + (hb : b ∉ V) (hc : c ∉ V) (hd : d ∉ V) {r : ℝ} (hr : r ∈ Ioo a b) (hr' : r ∈ Ioo c d) : + a = c ∧ b = d := by + have hac : a = c := by + rcases lt_trichotomy a c with h | h | h + · exact absurd (h1 ⟨h, hr'.1.trans hr.2⟩) hc + · exact h + · exact absurd (h2 ⟨h, hr.1.trans hr'.2⟩) ha + have hbd : b = d := by + rcases lt_trichotomy b d with h | h | h + · exact absurd (h2 ⟨hr'.1.trans hr.2, h⟩) hb + · exact h + · exact absurd (h1 ⟨hr.1.trans hr'.2, h⟩) hd + exact ⟨hac, hbd⟩ + +private theorem exp_sub_eq_one {w u v : ℂ} (h1 : w = exp u) (h2 : w = exp v) : exp (u - v) = 1 := by + rw [exp_sub, ← h1, ← h2] + exact div_self (h1 ▸ exp_ne_zero u) + +/-- Different elements of a coset of `2πiℤ` are at least `2π` apart. -/ +private theorem two_pi_le_norm {u : ℂ} (h : exp u = 1) (hne : u ≠ 0) : 2 * Real.pi ≤ ‖u‖ := by + obtain ⟨k, hk⟩ := Complex.exp_eq_one_iff.mp h + have hk0 : k ≠ 0 := by + rintro rfl + exact hne (by simpa using hk) + have hk1 : (1 : ℝ) ≤ |(k : ℝ)| := by + have : 1 ≤ |k| := Int.one_le_abs hk0 + exact_mod_cast this + rw [hk, norm_mul, norm_mul, norm_mul, Complex.norm_I, Complex.norm_intCast, Complex.norm_ofNat, + Complex.norm_real, Real.norm_eq_abs, abs_of_pos Real.pi_pos, mul_one] + nlinarith [Real.pi_pos] + +/-- The logarithms differ by a constant beyond the short gaps cut out of the line. -/ +private theorem lineLogDifference_constant {F : Set ℂ} (J : IsJordanParts F) + {ρ δ : ℝ} (hρ : 0 < ρ) (hδρ : δ ≤ ρ) + (hsmall : ∀ u ∈ F, ∀ v ∈ F, dist u v < δ → + ∃ A ⊆ F, IsPreconnected A ∧ u ∈ A ∧ v ∈ A ∧ A ⊆ ball u ρ) + {ι : ℝ → ℂ} (hιc : Continuous ι) + (hdistι : ∀ r s, dist (ι r) (ι s) = |r - s|) {ℓ : ℂ → ℝ} {t : ℝ} + (hlip : ∀ z r, |ℓ z - t| ≤ dist z (ι r)) {y₁ y₂ : ℂ} + (h1 : ℓ y₁ < t - ρ) (h2 : t + ρ < ℓ y₂) {R N : ℝ} + (hRF : ∀ z ∈ F, ‖z‖ < R) (hNpos : 0 < N) : + let W := inner F + let V := ι ⁻¹' W + let Z := {r | r ∈ V ∧ ∃ a b, r ∈ Ioo a b ∧ Ioo a b ⊆ V ∧ a ∉ V ∧ b ∉ V ∧ δ ≤ b - a} + let E := Vᶜ ∪ Z + let Q := Icc (-N) N + let P := E ∩ Q + let B := closedBall (0 : ℂ) (‖ι 0‖ + N + R) + let K := (Wᶜ ∩ B) ∪ ι '' P + let I := ι '' Q + let f := fun z : ℂ => (z - y₂) / (z - y₁) + ∀ l g : ℂ → ℂ, + let n := fun r : ℝ => l (ι r) - g (ι r) + let n₀ := n (-N) + IsCompact P → ContinuousOn n P → (∀ r ∈ P, exp (n r) = 1) → (-N) ∈ P → + ContinuousOn l K → (∀ z ∈ K, f z = exp (l z)) → + ContinuousOn g I → (∀ z ∈ I, f z = exp (g z)) → ∀ r ∈ P, n r = n₀ := by + classical + intro W V Z E Q P B K I f l g n n₀ hPc hnc hnexp hstart hlc hl hgc hg + have hW : W = inner F := rfl + have hn₀ : n₀ = n (-N) := rfl + by_contra hcon + push Not at hcon + obtain ⟨r₂, hr₂, hne⟩ := hcon + let d : ℝ → ℝ := fun r => ‖n r - n₀‖ + have hdc : ContinuousOn d P := (hnc.sub continuousOn_const).norm + have hP₁ : IsClosed (P ∩ d ⁻¹' Iic 0) := + hdc.preimage_isClosed_of_isClosed hPc.isClosed isClosed_Iic + have hP₂ : IsClosed (P ∩ d ⁻¹' Ici (2 * Real.pi)) := + hdc.preimage_isClosed_of_isClosed hPc.isClosed isClosed_Ici + have hcase : ∀ r ∈ P, r ∈ d ⁻¹' Iic 0 ∨ r ∈ d ⁻¹' Ici (2 * Real.pi) := by + intro r hr + by_cases h : n r = n₀ + · left + change ‖n r - n₀‖ ≤ 0 + rw [h, sub_self, norm_zero] + · right + refine two_pi_le_norm ?_ (sub_ne_zero.mpr h) + rw [exp_sub, hnexp r hr, hnexp _ hstart, div_one] + have hd₀ : (-N) ∈ d ⁻¹' Iic 0 := by + change ‖n (-N) - n₀‖ ≤ 0 + rw [← hn₀, sub_self, norm_zero] + have hd₂ : r₂ ∈ d ⁻¹' Ici (2 * Real.pi) := by + refine (hcase r₂ hr₂).resolve_left fun h => hne ?_ + have : ‖n r₂ - n₀‖ ≤ 0 := h + exact sub_eq_zero.mp (norm_le_zero_iff.mp this) + have hdisj : ∀ r, r ∈ d ⁻¹' Iic 0 → r ∈ d ⁻¹' Ici (2 * Real.pi) → False := by + intro r h1' h2' + have h3 : d r ≤ 0 := h1' + have h4 : 2 * Real.pi ≤ d r := h2' + linarith [Real.pi_pos] + obtain ⟨u, hu, humax⟩ := ((hPc.of_isClosed_subset hP₁ inter_subset_left).inter_right + (isClosed_Iic (a := r₂))).exists_isGreatest ⟨-N, ⟨hstart, hd₀⟩, hr₂.2.1⟩ + obtain ⟨v, hv, hvmin⟩ := ((hPc.of_isClosed_subset hP₂ inter_subset_left).inter_right + (isClosed_Ici (a := u))).exists_isLeast ⟨r₂, ⟨hr₂, hd₂⟩, hu.2⟩ + have huv : u < v := lt_of_le_of_ne hv.2 fun h => hdisj u hu.1.2 (h ▸ hv.1.2) + have hgapP : ∀ r ∈ Ioo u v, r ∉ P := by + intro r hr hrP + rcases hcase r hrP with h | h + · exact absurd (humax ⟨⟨hrP, h⟩, (hr.2.le.trans (hvmin ⟨⟨hr₂, hd₂⟩, hu.2⟩))⟩) (not_le.mpr hr.1) + · exact absurd (hvmin ⟨⟨hrP, h⟩, hr.1.le⟩) (not_le.mpr hr.2) + have huQ : u ∈ Q := hu.1.1.2 + have hvQ : v ∈ Q := hv.1.1.2 + have hgapV : ∀ r ∈ Ioo u v, r ∈ V ∧ r ∉ Z := by + intro r hr + have hrQ : r ∈ Q := ⟨huQ.1.trans hr.1.le, hr.2.le.trans hvQ.2⟩ + have hrE : r ∉ E := fun h => hgapP r hr ⟨h, hrQ⟩ + constructor + · by_contra hn + exact hrE (Or.inl hn) + · exact fun h => hrE (Or.inr h) + have hsub : Ioo u v ⊆ V := fun r hr => (hgapV r hr).1 + have huV : u ∉ V := by + intro huV + rcases hu.1.1.1 with h | ⟨-, c, e, hce, hs, hc, he, hl⟩ + · exact h huV + · obtain ⟨r, hr⟩ := exists_between (lt_min huv hce.2) + have hrIoo : r ∈ Ioo u v := ⟨hr.1, lt_of_lt_of_le hr.2 (min_le_left _ _)⟩ + have hrce : r ∈ Ioo c e := ⟨hce.1.trans hr.1, lt_of_lt_of_le hr.2 (min_le_right _ _)⟩ + exact (hgapV r hrIoo).2 ⟨hs hrce, c, e, hrce, hs, hc, he, hl⟩ + have hvV : v ∉ V := by + intro hvV + rcases hv.1.1.1 with h | ⟨-, c, e, hce, hs, hc, he, hl⟩ + · exact h hvV + · obtain ⟨r, hr⟩ := exists_between (max_lt huv hce.1) + have hrIoo : r ∈ Ioo u v := ⟨lt_of_le_of_lt (le_max_left _ _) hr.1, hr.2⟩ + have hrce : r ∈ Ioo c e := ⟨lt_of_le_of_lt (le_max_right _ _) hr.1, hr.2.trans hce.2⟩ + exact (hgapV r hrIoo).2 ⟨hs hrce, c, e, hrce, hs, hc, he, hl⟩ + have hshort : v - u < δ := by + by_contra hc + rw [not_lt] at hc + obtain ⟨r, hr⟩ := exists_between huv + exact (hgapV r hr).2 ⟨hsub hr, u, v, hr, hsub, huV, hvV, hc⟩ + -- The ends of the short segment lie on `F`. + have hend : ∀ x ∈ Icc u v, x ∉ V → ι x ∈ F := by + intro x hx hxV + have h3 : ι x ∈ closure (ι '' Ioo u v) := by + have h4 : x ∈ closure (Ioo u v) := by rw [closure_Ioo huv.ne]; exact hx + exact image_closure_subset_closure_image hιc ⟨x, h4, rfl⟩ + have h5 : ι '' Ioo u v ⊆ W := by + rintro _ ⟨r, hr, rfl⟩ + exact hsub hr + have h6 := closure_mono h5 h3 + rw [hW, J.closure_inner] at h6 + exact h6.resolve_left hxV + have huF := hend u ⟨le_rfl, huv.le⟩ huV + have hvF := hend v ⟨huv.le, le_rfl⟩ hvV + have hduv : dist (ι u) (ι v) < δ := by + rw [hdistι, abs_sub_comm, abs_of_pos (by linarith)] + exact hshort + obtain ⟨A, hAF, hApre, huA, hvA, hAball⟩ := hsmall _ huF _ hvF hduv + set D := closedBall (ι u) ρ with hD + have hyD : ∀ y, ρ < |ℓ y - t| → y ∉ D := by + intro y hy hyD + have h3 := hlip y u + have h4 : dist y (ι u) ≤ ρ := hyD + linarith + have hy₁D : y₁ ∉ D := hyD _ (by rw [abs_of_neg (by linarith)]; linarith) + have hy₂D : y₂ ∉ D := hyD _ (by rw [abs_of_pos (by linarith)]; linarith) + obtain ⟨lD, hlDc, hlD⟩ := hasLogOn_closedBall (f := f) hρ.le + (ContinuousOn.div (continuousOn_id.sub continuousOn_const) + (continuousOn_id.sub continuousOn_const) fun z hz => sub_ne_zero.mpr fun e => hy₁D (e ▸ hz)) + (fun z hz => div_ne_zero (sub_ne_zero.mpr fun e => hy₂D (e ▸ hz)) + (sub_ne_zero.mpr fun e => hy₁D (e ▸ hz))) + have hAD : A ⊆ D := fun z hz => ball_subset_closedBall (hAball hz) + have hFK : ∀ z ∈ F, z ∈ K := fun z hz => Or.inl ⟨hz |> fun hz' hzW => hzW.1 hz', by + refine mem_closedBall_zero_iff.mpr ?_ + have := hRF z hz + have h0 := norm_nonneg (ι 0) + linarith⟩ + have hAK : A ⊆ K := fun z hz => hFK z (hAF hz) + have hval1 : l (ι v) - lD (ι v) = l (ι u) - lD (ι u) := + eq_of_exp_eq_one hApre ((hlc.mono hAK).sub (hlDc.mono hAD)) + (fun z hz => exp_sub_eq_one (hl z (hAK hz)) (hlD z (hAD hz))) hvA huA + let S := ι '' Icc u v + have hSpre : IsPreconnected S := isPreconnected_Icc.image _ hιc.continuousOn + have hSI : S ⊆ I := by + rintro _ ⟨r, hr, rfl⟩ + exact ⟨r, ⟨huQ.1.trans hr.1, hr.2.trans hvQ.2⟩, rfl⟩ + have hSD : S ⊆ D := by + rintro _ ⟨r, hr, rfl⟩ + rw [hD, mem_closedBall, hdistι, abs_of_nonneg (by linarith [hr.1])] + linarith [hr.2] + have hval2 : g (ι v) - lD (ι v) = g (ι u) - lD (ι u) := + eq_of_exp_eq_one hSpre ((hgc.mono hSI).sub (hlDc.mono hSD)) + (fun z hz => exp_sub_eq_one (hg z (hSI hz)) (hlD z (hSD hz))) + ⟨v, ⟨huv.le, le_rfl⟩, rfl⟩ ⟨u, ⟨le_rfl, huv.le⟩, rfl⟩ + have hnuv : n v = n u := by + simp only [n] + linear_combination hval1 - hval2 + have hdv : d v = d u := by simp only [d, hnuv] + exact hdisj u hu.1.2 (by + have : d u ∈ Ici (2 * Real.pi) := hdv ▸ hv.1.2 + exact this) + +/-- A connected subset of `inner F` that avoids the long segments of a line cannot reach far on +both sides of the line. See the module docstring for the proof. -/ +theorem no_cross {F : Set ℂ} (φ : Circle ≃ₜ F) {ρ δ : ℝ} (hρ : 0 < ρ) (hδρ : δ ≤ ρ) + (hsmall : ∀ u ∈ F, ∀ v ∈ F, dist u v < δ → + ∃ A ⊆ F, IsPreconnected A ∧ u ∈ A ∧ v ∈ A ∧ A ⊆ ball u ρ) + {ι : ℝ → ℂ} (hι : Isometry ι) {ℓ : ℂ → ℝ} (hℓ : Continuous ℓ) {t : ℝ} + (hline : ∀ z, ℓ z = t → z ∈ range ι) (hℓι : ∀ r, ℓ (ι r) = t) + (hlip : ∀ z r, |ℓ z - t| ≤ dist z (ι r)) {G : Set ℂ} (hG : IsPreconnected G) + (hGW : G ⊆ inner F) + (hlong : ∀ a b, Ioo a b ⊆ ι ⁻¹' inner F → ι a ∉ inner F → ι b ∉ inner F → δ ≤ b - a → + ∀ r ∈ Ioo a b, ι r ∉ G) + {y₁ y₂ : ℂ} (hy₁ : y₁ ∈ G) (hy₂ : y₂ ∈ G) (h1 : ℓ y₁ < t - ρ) (h2 : t + ρ < ℓ y₂) : False := by + classical + have J := isJordanParts φ + set W := inner F with hW + have hWo : IsOpen W := J.isOpen_inner + have hιc := hι.continuous + have hιi := hι.injective + obtain ⟨R, hR⟩ := J.isCompact_closure_inner.isBounded.subset_ball 0 + have hRW : ∀ z ∈ W, ‖z‖ < R := fun z hz => mem_ball_zero_iff.mp (hR (Or.inl hz)) + have hRF : ∀ z ∈ F, ‖z‖ < R := fun z hz => mem_ball_zero_iff.mp (hR (Or.inr hz)) + have hdistι : ∀ r s, dist (ι r) (ι s) = |r - s| := fun r s => by + rw [hι.dist_eq, Real.dist_eq] + have hnorm_le : ∀ r, ‖ι r‖ ≤ ‖ι 0‖ + |r| := fun r => by + have h := norm_sub_norm_le (ι r) (ι 0) + rw [← dist_eq_norm, hdistι, sub_zero] at h + linarith + have hnorm_ge : ∀ r, |r| ≤ ‖ι r‖ + ‖ι 0‖ := fun r => by + have h := norm_sub_le (ι r) (ι 0) + rw [← dist_eq_norm, hdistι, sub_zero] at h + exact h + have hR0 : 0 ≤ R := by + obtain ⟨z, hz⟩ := J.isConnected_inner.nonempty + exact (norm_nonneg z).trans (hRW z hz).le + set N := R + ‖ι 0‖ + 1 with hN + have hNpos : 0 < N := by positivity + set R' := ‖ι 0‖ + N + R with hR' + set V := ι ⁻¹' W with hV + have hVo : IsOpen V := hWo.preimage hιc + have hVb : Bornology.IsBounded V := by + refine (Metric.isBounded_closedBall (x := (0 : ℝ)) (r := N)).subset fun r hr => ?_ + have h3 := hRW _ hr + have h4 := hnorm_ge r + rw [mem_closedBall, Real.dist_eq, sub_zero] + linarith + let Z : Set ℝ := {r | r ∈ V ∧ ∃ a b, r ∈ Ioo a b ∧ Ioo a b ⊆ V ∧ a ∉ V ∧ b ∉ V ∧ δ ≤ b - a} + let E : Set ℝ := Vᶜ ∪ Z + have hEc : IsClosed E := by + rw [← isOpen_compl_iff, isOpen_iff_mem_nhds] + intro r hr + have hrV : r ∈ V := by + by_contra hn + exact hr (Or.inl hn) + have hrZ : r ∉ Z := fun h => hr (Or.inr h) + obtain ⟨a, b, hab, hsub, ha, hb⟩ := exists_interval_of_mem hVo hVb hrV + refine Filter.mem_of_superset (isOpen_Ioo.mem_nhds hab) fun r' hr' hE => ?_ + rcases hE with hE | ⟨hr'V, c, d, hcd, hsub', hc, hd, hl⟩ + · exact hE (hsub hr') + · obtain ⟨rfl, rfl⟩ := interval_unique hsub hsub' ha hb hc hd hr' hcd + exact hrZ ⟨hrV, _, _, hab, hsub, ha, hb, hl⟩ + set Q := Icc (-N) N with hQ + set P := E ∩ Q with hP + have hPc : IsCompact P := isCompact_Icc.inter_left hEc + set B := closedBall (0 : ℂ) R' with hB + set K := (Wᶜ ∩ B) ∪ ι '' P with hK + have hKc : IsCompact K := + ((isCompact_closedBall (0 : ℂ) R').inter_left hWo.isClosed_compl).union (hPc.image hιc) + have hGK : G ⊆ Kᶜ := by + rintro z hz (h | ⟨r, hr, rfl⟩) + · exact h.1 (hGW hz) + · rcases hr.1 with h | ⟨hrV, a, b, hab, hsub, ha, hb, hl⟩ + · exact h (hGW hz) + · exact hlong a b hsub ha hb hl r hab hz + have hcomp : y₂ ∈ connectedComponentIn Kᶜ y₁ := hG.subset_connectedComponentIn hy₁ hGK hy₂ + obtain ⟨l, hlc, hl⟩ := hasLogOn_div_of_same_component hKc.isClosed (hGK hy₁) hcomp + let f : ℂ → ℂ := fun z => (z - y₂) / (z - y₁) + have hy₁L : ∀ r, ι r ≠ y₁ := fun r h => by + have := hℓι r + rw [h] at this + linarith + have hy₂L : ∀ r, ι r ≠ y₂ := fun r h => by + have := hℓι r + rw [h] at this + linarith + have hfι : HasLogOn (univ : Set ℝ) fun r => f (ι r) := by + refine hasLogOn_univ_of_ne_zero ?_ fun r => ?_ + · exact (hιc.sub continuous_const).div (hιc.sub continuous_const) + fun r => sub_ne_zero.mpr (hy₁L r) + · exact div_ne_zero (sub_ne_zero.mpr (hy₂L r)) (sub_ne_zero.mpr (hy₁L r)) + set I := ι '' Q with hI + have hIc : IsCompact I := isCompact_Icc.image hιc + obtain ⟨g, hgc, hg⟩ : HasLogOn I f := + hasLogOn_image isCompact_Icc hιc.continuousOn hιi.injOn (hfι.mono (subset_univ _)) + have hPK : ∀ r ∈ P, ι r ∈ K := fun r hr => Or.inr ⟨r, hr, rfl⟩ + have hPI : ∀ r ∈ P, ι r ∈ I := fun r hr => ⟨r, hr.2, rfl⟩ + let n : ℝ → ℂ := fun r => l (ι r) - g (ι r) + have hnc : ContinuousOn n P := by + refine ContinuousOn.sub ?_ ?_ + · exact hlc.comp hιc.continuousOn hPK + · exact hgc.comp hιc.continuousOn hPI + have hnexp : ∀ r ∈ P, exp (n r) = 1 := + fun r hr => exp_sub_eq_one (hl _ (hPK r hr)) (hg _ (hPI r hr)) + have hstart : -N ∈ P := by + refine ⟨Or.inl fun h => ?_, ⟨le_rfl, by linarith⟩⟩ + have h3 := hRW _ h + have h4 := hnorm_ge (-N) + rw [abs_neg, abs_of_pos hNpos] at h4 + linarith + set n₀ := n (-N) with hn₀ + have hconst : ∀ r ∈ P, n r = n₀ := + lineLogDifference_constant J hρ hδρ hsmall hιc hdistι hlip h1 h2 hRF hNpos l g + hPc hnc hnexp hstart hlc hl hgc hg + -- The two logarithms paste. + have hlog : HasLogOn (K ∪ I) f := by + refine hasLogOn_union (gA := l) (gB := fun z => g z + n₀) hKc.isClosed hIc.isClosed hlc + (hgc.add continuousOn_const) hl (fun z hz => ?_) ?_ + · rw [exp_add, show exp n₀ = 1 from hnexp _ hstart, mul_one] + exact hg z hz + · rintro _ ⟨hzK, r, hrQ, rfl⟩ + have hrP : r ∈ P := by + refine ⟨?_, hrQ⟩ + rcases hzK with h | ⟨r', hr', he⟩ + · exact Or.inl h.1 + · rw [← hιi he] + exact hr'.1 + have := hconst r hrP + simp only [n] at this + linear_combination this + have hUc : IsCompact (K ∪ I) := hKc.union hIc + have hy₁U : y₁ ∉ K ∪ I := by + rintro (h | ⟨r, -, h⟩) + · exact hGK hy₁ h + · exact hy₁L r h + have hy₂U : y₂ ∉ K ∪ I := by + rintro (h | ⟨r, -, h⟩) + · exact hGK hy₂ h + · exact hy₂L r h + have heq := component_eq_of_hasLogOn hUc hy₁U hy₂U + (hlog.inv.congr fun z _ => by simp only [f, inv_div]) + have hin₂ : y₂ ∈ connectedComponentIn (K ∪ I)ᶜ y₁ := heq ▸ mem_connectedComponentIn hy₂U + have hin₁ : y₁ ∈ connectedComponentIn (K ∪ I)ᶜ y₁ := mem_connectedComponentIn hy₁U + have hCpre : IsPreconnected (connectedComponentIn (K ∪ I)ᶜ y₁) := + isPreconnected_connectedComponentIn + have hsph : ∀ z, ‖z‖ = R → z ∈ K := fun z hz => Or.inl ⟨fun hzW => (hRW z hzW).ne hz, by + refine mem_closedBall_zero_iff.mpr ?_ + rw [hz] + linarith [norm_nonneg (ι 0)]⟩ + have hCball : ∀ z ∈ connectedComponentIn (K ∪ I)ᶜ y₁, ‖z‖ < R := by + intro z hz + by_contra hc + obtain ⟨w, hw1, hw2⟩ := inter_frontier_nonempty_of_isPreconnected (U := ball (0 : ℂ) R) hCpre + ⟨y₁, hin₁, mem_ball_zero_iff.mpr (hRW _ (hGW hy₁))⟩ + ⟨z, hz, fun h => hc (mem_ball_zero_iff.mp h)⟩ + have hwn : ‖w‖ = R := mem_sphere_zero_iff_norm.mp (frontier_ball_subset_sphere hw2) + exact connectedComponentIn_subset _ _ hw1 (Or.inl (hsph w hwn)) + obtain ⟨w, hw1, hw2⟩ := inter_frontier_nonempty_of_isPreconnected (U := {z | ℓ z < t}) hCpre + ⟨y₁, hin₁, show ℓ y₁ < t by linarith⟩ ⟨y₂, hin₂, fun h => by + have : ℓ y₂ < t := h + linarith⟩ + have hwt : ℓ w = t := frontier_lt_subset_eq hℓ continuous_const hw2 + obtain ⟨r, rfl⟩ := hline w hwt + have hrN : |r| ≤ N := by + have h3 := hCball _ hw1 + have h4 := hnorm_ge r + linarith + exact connectedComponentIn_subset _ _ hw1 (Or.inr ⟨r, abs_le.mp hrN, rfl⟩) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Mobius.lean b/LeanPool/GraphMinor/Surface/Mobius.lean new file mode 100644 index 0000000000..9fca6a4fd4 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Mobius.lean @@ -0,0 +1,332 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutCyl + +/-! +# The Möbius band + +The unit disc with four sides is mapped onto the Möbius band as in `CutCyl.lean`, by way of the +square `|x| + |y| ≤ 1`. Two opposite sides of this square are pasted with a half turn. +This shows that the word `t r t r'` presents the Möbius band (`presents_mob`), and its normal form +is `Σ(0, 1, 1)` (`nonempty_mob_homeo`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +open scoped unitInterval + +/-- Two pairs are glued in the Möbius band exactly if they are equal or are glued by one step. -/ +theorem mobius_rel {p q : unitInterval × unitInterval} (h : mobiusSetoid p q) : + p = q ∨ (p.1 = 0 ∧ q.1 = 1 ∧ q.2 = unitInterval.symm p.2) ∨ (q.1 = 0 ∧ p.1 = 1 ∧ p.2 + = unitInterval.symm q.2) := by + change Relation.EqvGen _ p q at h + induction h with + | rel x y h => exact .inr (.inl h) + | refl x => exact .inl rfl + | symm x y _ ih => + rcases ih with rfl | h | h + · exact .inl rfl + · exact .inr (.inr h) + · exact .inr (.inl h) + | trans x y z _ _ h1 h2 => + rcases h1 with rfl | h1 | h1 + · exact h2 + · rcases h2 with rfl | h2 | h2 + · exact .inr (.inl h1) + · exact absurd (h1.2.1.symm.trans h2.1) (by simp) + · left + refine Prod.ext (h1.1.trans h2.1.symm) ?_ + have := congrArg unitInterval.symm (h1.2.2.symm.trans h2.2.2) + simpa using this + · rcases h2 with rfl | h2 | h2 + · exact .inr (.inr h1) + · left + refine Prod.ext (h1.2.1.trans h2.2.1.symm) ?_ + rw [h1.2.2, h2.2.2] + · exact absurd (h1.1.symm.trans h2.2.1) (by simp) + +/-- The Möbius band is a Hausdorff space. -/ +instance : T2Space MobiusBand := by + refine t2Space_quotient_of_isClosed mobiusSetoid ?_ + have e : {p : (I × I) × (I × I) | mobiusSetoid p.1 p.2} = {p | p.1 = p.2} ∪ ({p | p.1.1 = 0 + ∧ p.2.1 = 1 ∧ p.2.2 = unitInterval.symm p.1.2} ∪ {p | p.2.1 = 0 ∧ p.1.1 = 1 ∧ p.1.2 + = unitInterval.symm p.2.2}) := by + ext p + constructor + · intro h + rcases mobius_rel h with h | h | h + · exact .inl h + · exact .inr (.inl h) + · exact .inr (.inr h) + · rintro (h | h | h) + · have h' : p.1 = p.2 := h + change mobiusSetoid p.1 p.2 + rw [h'] + · exact Relation.EqvGen.rel _ _ h + · exact Relation.EqvGen.symm _ _ (Relation.EqvGen.rel _ _ h) + rw [e] + have c1 : Continuous fun p : (I × I) × (I × I) => p.1.1 := by fun_prop + have c2 : Continuous fun p : (I × I) × (I × I) => p.2.1 := by fun_prop + have c3 : Continuous fun p : (I × I) × (I × I) => p.1.2 := by fun_prop + have c4 : Continuous fun p : (I × I) × (I × I) => p.2.2 := by fun_prop + refine (isClosed_eq continuous_fst continuous_snd).union (IsClosed.union ?_ ?_) + · exact (isClosed_eq c1 continuous_const).inter ((isClosed_eq c2 continuous_const).inter + (isClosed_eq c4 (unitInterval.continuous_symm.comp c3))) + · exact (isClosed_eq c2 continuous_const).inter ((isClosed_eq c1 continuous_const).inter + (isClosed_eq c3 (unitInterval.continuous_symm.comp c4))) + +/-- The first coordinate on the square. -/ +noncomputable def mobU (z : ℂ) : ℝ := (1 - cylS z) / 2 + +/-- The second coordinate on the square. -/ +noncomputable def mobV (z : ℂ) : ℝ := (1 + (nu z).re - (nu z).im) / 2 + +theorem mobU_mem {z : ℂ} (hz : ‖z‖ ≤ 1) : mobU z ∈ Icc (0 : ℝ) 1 := by + have := cylS_mem hz + simp only [mobU] + exact ⟨by linarith [this.2], by linarith [this.1]⟩ + +theorem mobV_mem {z : ℂ} (hz : ‖z‖ ≤ 1) : mobV z ∈ Icc (0 : ℝ) 1 := by + have := cylR_mem hz + have e : mobV z = cylR z - 1 := by + simp only [mobV, cylR] + ring + rw [e] + exact ⟨by linarith [this.1], by linarith [this.2]⟩ + +/-- The point of the square of a point of the disc. -/ +noncomputable def mobP (z : ℂ) : unitInterval × unitInterval := + (projIcc 0 1 zero_le_one (mobU z), projIcc 0 1 zero_le_one (mobV z)) + +/-- The map from the disc to the Möbius band. -/ +noncomputable def mobG (z : ℂ) : MobiusBand := Quotient.mk mobiusSetoid (mobP z) + +theorem mobP_fst {z : ℂ} (hz : ‖z‖ ≤ 1) : ((mobP z).1 : ℝ) = mobU z := by + simp only [mobP] + rw [projIcc_of_mem zero_le_one (mobU_mem hz)] + +theorem mobP_snd {z : ℂ} (hz : ‖z‖ ≤ 1) : ((mobP z).2 : ℝ) = mobV z := by + simp only [mobP] + rw [projIcc_of_mem zero_le_one (mobV_mem hz)] + +theorem continuous_mobG : Continuous mobG := by + have h1 : Continuous mobU := by + unfold mobU cylS + have := continuous_nu + fun_prop + have h2 : Continuous mobV := by + unfold mobV + have := continuous_nu + fun_prop + exact continuous_quotient_mk'.comp ((continuous_projIcc.comp h1).prodMk + (continuous_projIcc.comp h2)) + +theorem mobG_surj (y : MobiusBand) : ∃ z : ℂ, ‖z‖ ≤ 1 ∧ mobG z = y := by + obtain ⟨⟨u, v⟩, rfl⟩ := Quotient.exists_rep y + set s : ℝ := 1 - 2 * u with hs + set d : ℝ := 2 * v - 1 with hd + have hs1 : s ∈ Icc (-1 : ℝ) 1 := ⟨by linarith [u.2.2], by linarith [u.2.1]⟩ + have hd1 : d ∈ Icc (-1 : ℝ) 1 := ⟨by linarith [v.2.1], by linarith [v.2.2]⟩ + let w : ℂ := ⟨(s + d) / 2, (s - d) / 2⟩ + have hw : nn w ≤ 1 := by + simp only [nn, w] + rcases abs_cases ((s + d) / 2) with h1 | h1 <;> rcases abs_cases ((s - d) / 2) with h2 | h2 <;> + linarith [hs1.1, hs1.2, hd1.1, hd1.2] + have hz : ‖mu w‖ ≤ 1 := by rw [norm_mu]; exact hw + refine ⟨mu w, hz, ?_⟩ + have e : mobP (mu w) = (u, v) := by + apply Prod.ext + · apply Subtype.ext + rw [mobP_fst hz] + simp only [mobU, cylS, nu_mu, w] + linarith + · apply Subtype.ext + rw [mobP_snd hz] + simp only [mobV, nu_mu, w] + linarith + simp only [mobG, e] + +theorem nu_neg (z : ℂ) : nu (-z) = - nu z := by + have h1 : nn (-z) = nn z := by simp [nn] + simp only [nu, norm_neg, h1, mul_neg] + +theorem per_two {t : ℝ} : per 4 (2 + t) = - per 4 t := by + have e : (2 : ℝ) * Real.pi * (2 + t) / (4 : ℕ) = 2 * Real.pi * t / (4 : ℕ) + Real.pi := by + push_cast + ring + simp only [per, cis', e] + push_cast + rw [add_mul, Complex.exp_add, Complex.exp_pi_mul_I, mul_neg_one] + +/-- The word of the Möbius band. -/ +def mobW : List Letter := [(0, true), (1, true), (0, true), (2, true)] + +theorem sdPt_two' {t : ℝ} : sdPt 4 2 true t = per 4 (2 + t) := by + simp [sdPt] + +theorem mobG_side {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : mobG (per 4 t) = mobG (per 4 (2 + t)) := by + obtain ⟨h1, h2⟩ := per_quad ht + have h3 := cylS_quad h1 h2 + rw [norm_per4] at h3 + apply Quotient.sound + have hn1 := (norm_per4 t).le + have hn2 := (norm_per4 (2 + t)).le + refine Relation.EqvGen.rel _ _ ⟨?_, ?_, ?_⟩ + · apply Subtype.ext + rw [mobP_fst hn1] + simp [mobU, h3] + · apply Subtype.ext + rw [mobP_fst hn2, per_two] + simp only [mobU, cylS, nu_neg, Complex.neg_re, Complex.neg_im] + have : (nu (per 4 t)).re + (nu (per 4 t)).im = 1 := h3 + simp only [Icc.coe_one] + linarith + · apply Subtype.ext + rw [mobP_snd hn2] + simp only [unitInterval.coe_symm_eq] + rw [mobP_snd hn1, per_two] + simp only [mobV, nu_neg, Complex.neg_re, Complex.neg_im] + ring + +theorem mobG_fib {z z' : ℂ} (hz : ‖z‖ ≤ 1) (hz' : ‖z'‖ ≤ 1) (he : mobG z = mobG z') : + z = z' ∨ ∃ t ∈ Icc (0 : ℝ) 1, (z = per 4 t ∧ z' = per 4 (2 + t)) ∨ (z' = per 4 t ∧ z = per 4 + (2 + t)) := by + have key : ∀ {x y : ℂ}, ‖x‖ ≤ 1 → ‖y‖ ≤ 1 → (mobP x).1 = 0 → (mobP y).1 = 1 → (mobP y).2 + = unitInterval.symm (mobP x).2 → + ∃ t ∈ Icc (0 : ℝ) 1, x = per 4 t ∧ y = per 4 (2 + t) := by + intro x y hx hy h1 h2 h3 + have e1 : cylS x = 1 := by + have := congrArg (Subtype.val) h1 + rw [mobP_fst hx] at this + simp only [mobU, Icc.coe_zero] at this + linarith + have e2 : cylS y = -1 := by + have := congrArg (Subtype.val) h2 + rw [mobP_fst hy] at this + simp only [mobU, Icc.coe_one] at this + linarith + have e3 : mobV y = 1 - mobV x := by + have := congrArg (Subtype.val) h3 + rw [mobP_snd hy] at this + simp only [unitInterval.coe_symm_eq] at this + rw [mobP_snd hx] at this + exact this + obtain ⟨t, ht, rfl⟩ := exists_side hx e1 + refine ⟨t, ht, rfl, ?_⟩ + rw [per_two] + apply nu_injective + rw [nu_neg] + have e4 : (nu (per 4 t)).re + (nu (per 4 t)).im = 1 := e1 + have e5 : (nu y).re + (nu y).im = -1 := e2 + simp only [mobV] at e3 + apply Complex.ext + · simp only [Complex.neg_re] + linarith + · simp only [Complex.neg_im] + linarith + rcases mobius_rel (Quotient.exact he) with h | ⟨h1, h2, h3⟩ | ⟨h1, h2, h3⟩ + · left + apply nu_injective + have e1 : mobU z = mobU z' := by rw [← mobP_fst hz, ← mobP_fst hz', h] + have e2 : mobV z = mobV z' := by rw [← mobP_snd hz, ← mobP_snd hz', h] + simp only [mobU, cylS, mobV] at e1 e2 + apply Complex.ext <;> linarith + · obtain ⟨t, ht, h4, h5⟩ := key hz hz' h1 h2 h3 + exact .inr ⟨t, ht, .inl ⟨h4, h5⟩⟩ + · obtain ⟨t, ht, h4, h5⟩ := key hz' hz h1 h2 h3 + exact .inr ⟨t, ht, .inr ⟨h4, h5⟩⟩ + +theorem mobW_stp {a b : ℕ × ℂ} (h : Stp (sW mobW) a b) : mobG a.2 = mobG b.2 := by + obtain ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ := h + obtain ⟨rfl, h4⟩ := sW_get h1 + obtain ⟨rfl, h5⟩ := sW_get h2 + rw [sW_zero] + have hlen : mobW.length = 4 := rfl + simp only [hlen] + have key : mobG (sdPt 4 0 true t) = mobG (sdPt 4 2 true t) := by + rw [sdPt_zero, sdPt_two'] + exact mobG_side ht + rcases p with _ | _ | _ | _ | p <;> rcases q with _ | _ | _ | _ | q <;> + simp only [mobW, List.getElem?_cons_zero, List.getElem?_cons_succ, List.getElem?_nil, + Option.some.injEq, reduceCtorEq, Prod.mk.injEq, zero_add, Nat.reduceAdd] at h4 h5 h3 + all_goals obtain ⟨e1, e2⟩ := h4 + all_goals obtain ⟨e3, e4⟩ := h5 + all_goals subst e2 e4 + all_goals first + | rfl + | omega + | exact key.symm + +/-- The word `t r t r'` presents the Möbius band. -/ +theorem presents_mob : Presents (sW mobW) fun a => mobG a.2 := by + have hD : ∀ a, a ∈ Dsk (sW mobW) ↔ a.1 = 0 ∧ ‖a.2‖ ≤ 1 := fun a => by + constructor + · intro h + have := mem_Dsk_sW h + exact ⟨this.1, this.2.2⟩ + · rintro ⟨h1, h2⟩ + refine ⟨?_, h2⟩ + rw [h1, sW_zero] + simp [mobW] + refine ⟨(continuous_mobG.comp continuous_snd).continuousOn, ?_, ?_⟩ + · refine eq_univ_of_forall fun y => ?_ + obtain ⟨z, hz, rfl⟩ := mobG_surj y + exact ⟨(0, z), (hD _).mpr ⟨rfl, hz⟩, rfl⟩ + · intro a ha b hb + obtain ⟨h1, h2⟩ := (hD _).mp ha + obtain ⟨h3, h4⟩ := (hD _).mp hb + have ea : a = (0, a.2) := Prod.ext h1 rfl + have eb : b = (0, b.2) := Prod.ext h3 rfl + constructor + · intro he + rcases mobG_fib h2 h4 he with h5 | ⟨t, ht, ⟨h5, h6⟩ | ⟨h5, h6⟩⟩ + · rw [show a = b from Prod.ext (h1.trans h3.symm) h5] + exact .refl _ + · rw [ea, eb, h5, h6] + refine .rel _ _ ⟨0, 0, 0, 2, 0, true, true, t, rfl, rfl, by simp, ht, ?_, ?_⟩ + · simp [sW_zero, mobW, sdPt_zero] + · simp [sW_zero, mobW, sdPt_two'] + · rw [ea, eb, h5, h6] + refine .symm _ _ (.rel _ _ ⟨0, 0, 0, 2, 0, true, true, t, rfl, rfl, by simp, ht, ?_, ?_⟩) + · simp [sW_zero, mobW, sdPt_zero] + · simp [sW_zero, mobW, sdPt_two'] + · intro hp + clear ha hb h1 h2 h3 h4 ea eb + induction hp with + | rel x y hs => exact mobW_stp hs + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + +/-- The model with one cross-cap and one hole is the Möbius band. -/ +theorem nonempty_mob_homeo : Nonempty (SurfaceModel 0 1 1 ≃ₜ MobiusBand) := by + have hI : Inv mobW [] [] [] 0 0 0 := by + refine ⟨.nil, .nil, .nil, by simp [DisjL], by simp [DisjL], by simp [DisjL], by simp [DisjL], + by simp [DisjL], by simp [DisjL], ?_⟩ + intro k + simp only [mobW, cnt_cons, cnt_nil] + split_ifs <;> omega + have s1 := step_cap.{0} (P := []) (x := (0, true)) (Q := [(1, true)]) (S := [(2, true)]) hI rfl + obtain ⟨u, s2, s3⟩ := step_last.{0} (q := (2, true)) (Q := winv [(1, true)]) s1.1 (by simp) (by + intro l hl + simp only [winv, linv, List.reverse_cons, List.reverse_nil, List.map_cons, List.map_nil, + List.append_nil, List.cons_append, List.nil_append, List.mem_cons, List.not_mem_nil, + or_false] at hl ⊢ + rcases hl with rfl | rfl <;> simp [cnt_cons, cnt_nil]) + have : Nonempty MobiusBand := ⟨mobG 0⟩ + obtain ⟨e⟩ := homeo_of_nf presents_mob s2.isNF (s1.2.trans (by simpa using s3)) + exact ⟨e.symm⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/ModelCriterion.lean b/LeanPool/GraphMinor/Surface/ModelCriterion.lean new file mode 100644 index 0000000000..3ce730d431 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/ModelCriterion.lean @@ -0,0 +1,342 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CohCard +public import LeanPool.GraphMinor.Surface.TopologyStatements + +/-! +# Which model surfaces are homeomorphic + +`modelCriterion` proves `ModelCriterionStatement`. Two moves on words give the homeomorphisms +between models. For the +other direction, the number `c` is the number of cuffs. The number `2 * a + b` and the question +whether `b = 0` are read +off from the number of classes of local cocycles with values in `ZMod 2` and `ZMod 3`, by +`card_kCl`. +This is the classical proof that the first cohomology classifies surfaces (see W. Massey, Algebraic +Topology: an +Introduction, Chapter 1, Section 10, with homology in place of cohomology). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +variable {Y : Type u} [TopologicalSpace Y] + +theorem image_componentsIn {Y' : Type*} [TopologicalSpace Y'] (e : Y ≃ₜ Y') (F : Set Y) : + (fun K => e '' K) '' componentsIn F = componentsIn (e '' F) := by + have key : ∀ x ∈ F, e '' connectedComponentIn F x = connectedComponentIn (e '' F) (e x) := by + intro x hx + exact e.image_connectedComponentIn hx + ext K + constructor + · rintro ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + exact ⟨e x, mem_image_of_mem _ hx, (key x hx).symm⟩ + · rintro ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + exact ⟨_, ⟨x, hx, rfl⟩, key x hx⟩ + +theorem ncard_cuffs_congr {Y' : Type*} [TopologicalSpace Y'] (e : Y ≃ₜ Y') : (cuffs Y).ncard = + (cuffs Y').ncard := by + have h1 := image_componentsIn e (bd Y) + rw [image_bd_homeomorph e] at h1 + unfold cuffs + rw [← h1, ncard_image_of_injective _ (image_injective.mpr e.injective)] + +/-- Disjoint closed connected sets are the components of their union. -/ +theorem componentsIn_eq {C : ℕ → Set Y} {c : ℕ} (hcl : ∀ i < c, IsClosed (C i)) + (hconn : ∀ i < c, IsPreconnected (C i)) + (hne : ∀ i < c, (C i).Nonempty) (hd : ∀ i < c, ∀ j < c, i ≠ j → Disjoint (C i) (C j)) : + componentsIn (⋃ i ∈ {i | i < c}, C i) = C '' {i | i < c} := by + have key : ∀ i < c, ∀ x ∈ C i, connectedComponentIn (⋃ i ∈ {i | i < c}, C i) x = C i := by + intro i hi x hx + have hsub : C i ⊆ ⋃ i ∈ {i | i < c}, C i := subset_biUnion_of_mem (u := C) hi + apply Subset.antisymm + · set K := connectedComponentIn (⋃ i ∈ {i | i < c}, C i) x with hK + have hKp : IsPreconnected K := isPreconnected_connectedComponentIn + have hKs : K ⊆ ⋃ i ∈ {i | i < c}, C i := connectedComponentIn_subset _ _ + let D : Set Y := ⋃ j ∈ {j | j < c ∧ j ≠ i}, C j + have hDcl : IsClosed D := by + refine Set.Finite.isClosed_biUnion ?_ fun j hj => hcl j hj.1 + exact (finite_lt_nat c).subset fun j hj => hj.1 + have hcov : K ⊆ C i ∪ D := fun z hz => by + obtain ⟨j, hj, hzj⟩ := mem_iUnion₂.mp (hKs hz) + by_cases he : j = i + · exact .inl (he ▸ hzj) + · exact .inr (mem_biUnion (x := j) ⟨hj, he⟩ hzj) + have hxK : x ∈ K := mem_connectedComponentIn (hsub hx) + by_contra hc + obtain ⟨z, hz, hzi⟩ := not_subset.mp hc + have hzD : z ∈ D := (hcov hz).resolve_left hzi + obtain ⟨w, -, hw1, hw2⟩ := isPreconnected_closed_iff.mp hKp _ _ + (hcl i hi) hDcl hcov ⟨x, hxK, hx⟩ ⟨z, hz, hzD⟩ + obtain ⟨j, hj, hwj⟩ := mem_iUnion₂.mp hw2 + exact Set.disjoint_left.mp (hd i hi j hj.1 (Ne.symm hj.2)) hw1 hwj + · exact (hconn i hi).subset_connectedComponentIn hx hsub + ext K + constructor + · rintro ⟨x, hx, rfl⟩ + obtain ⟨i, hi, hxi⟩ := mem_iUnion₂.mp hx + exact ⟨i, hi, (key i hi x hxi).symm⟩ + · rintro ⟨i, hi, rfl⟩ + obtain ⟨x, hx⟩ := hne i hi + exact ⟨x, mem_biUnion hi hx, key i hi x hx⟩ + +variable {a b c : ℕ} {f : ℕ × ℂ → Y} + +/-- The image of the free side of the hole `i`. -/ +noncomputable def holeC (a b c : ℕ) (f : ℕ × ℂ → Y) (i : ℕ) : Set Y := + (fun u : ℝ => pmap f (per (4 * a + 2 * b + 3 * c + 2) ((4 * a + 2 * b + 3 * i + 1 : ℕ) + u))) '' + Icc (0 : ℝ) 1 + +theorem continuousOn_hole (hf : Presents (sW (ew a b c)) f) (i : ℕ) : + ContinuousOn (fun u : ℝ => pmap f (per (4 * a + 2 * b + 3 * c + 2) + ((4 * a + 2 * b + 3 * i + 1 : ℕ) + u))) (Icc 0 1) := by + refine (pmap_cont hf).comp ?_ fun u _ => mem_ball_per _ _ + have := continuous_per (4 * a + 2 * b + 3 * c + 2) + fun_prop + +/-- The images of the free sides of two holes are disjoint. -/ +theorem disjoint_holeC (hf : Presents (sW (ew a b c)) f) {i j : ℕ} (hi : i < c) + (hj : j < c) (hne : i ≠ j) : + Disjoint (holeC a b c f i) (holeC a b c f j) := by + classical + let V : ℕ → ZMod 2 := fun k => if k = 2 * a + b + 2 * i then 1 else 0 + have hV1 : ∀ k < 2 * a + b, V k = 0 := fun k hk => ite_eq_right (by omega) + have hV2 : ∀ l < c, V (2 * a + b + 2 * l + 1) = 0 := fun l _ => ite_eq_right (by omega) + have hV3 : ∀ l, V (2 * a + b + 2 * l) = if l = i then 1 else 0 := fun l => by + simp only [V] + by_cases h : l = i + · simp [h] + · rw [ite_eq_right (by omega), ite_eq_right h] + have hS : ∀ l ≤ c, Sm a b c V (4 * a + 2 * b + 3 * l) = 0 := by + intro l hl + rw [Sm_holes V hl, Finset.sum_eq_zero fun m hm => hV1 _ (by + have := Finset.mem_range.mp hm + omega), Finset.sum_eq_zero fun m hm => hV2 _ (by + have := Finset.mem_range.mp hm + omega)] + simp + have hSn : Sm a b c V (4 * a + 2 * b + 3 * c + 2) = 0 := by + rw [Sm_last] + exact hS c le_rfl + have hstp : ∀ x y, Stp (sW (ew a b c)) x y → gz a b c V x.2 = gz a b c V y.2 := by + intro x y hs + obtain ⟨i', j', p, q, k, e, e', u, h1, h2, h3, hu, rfl, rfl⟩ := stp_iff.mp hs + obtain ⟨rfl, h4⟩ := sW_get h1 + obtain ⟨rfl, h5⟩ := sW_get h2 + obtain ⟨hp, hl, rfl⟩ := (ew_get_iff _ _ _ _ _ _).mp h4 + obtain ⟨hq, hl', rfl⟩ := (ew_get_iff _ _ _ _ _ _).mp h5 + have hne' : p ≠ q := fun he => h3 (by rw [he]) + have hll := hl.trans hl'.symm + have ht1 : twin a b c p ≠ p := by + intro ht + rcases lab_two hp hq hll with h6 | h6 + · exact hne' h6.symm + · exact hne' (ht.symm.trans h6.symm) + have ht2 : twin a b c q ≠ q := by + intro ht + rcases lab_two hq hp hll.symm with h6 | h6 + · exact hne' h6 + · exact hne' (h6.trans ht) + simp only [spt_ew] + rw [gz_per V hSn hp hu, gz_per V hSn hq (flp_mem hu), gx, gx, ofs_flp', hl, hl', + Sm_st_zero V hV1 hV2 hp ht1, Sm_st_zero V hV1 hV2 hq ht2] + have hprel : ∀ x y, PRel (sW (ew a b c)) x y → gz a b c V x.2 = gz a b c V y.2 := by + intro x y hxy + induction hxy with + | rel x y hs => exact hstp x y hs + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + have hval : ∀ l < c, ∀ u ∈ Icc (0 : ℝ) 1, + gz a b c V (per (4 * a + 2 * b + 3 * c + 2) ((4 * a + 2 * b + 3 * l + 1 : ℕ) + u)) = if l + = i then 1 else 0 := by + intro l hl u hu + rw [gz_per V hSn (by omega) hu, gx, lab_t hl (by omega : 1 < 3), show 1 % 2 = 1 from rfl, + hV2 l hl] + have h1 : st a b c (4 * a + 2 * b + 3 * l + 1) = 4 * a + 2 * b + 3 * l + 1 := by + simp only [st, sgn_t hl (by omega : 1 < 3)] + rfl + have h2 : Sm a b c V (4 * a + 2 * b + 3 * l + 1) = if l = i then 1 else 0 := by + have e : 4 * a + 2 * b + 3 * l + 1 = 4 * a + 2 * b + 3 * l + 0 + 1 := rfl + have h3 := lv_t (a := a) (b := b) (c := c) V hl (δ := 0) (by omega) + rw [add_zero] at h3 + rw [e, add_zero, Sm_succ, h3] + simp only [Nat.zero_mod, add_zero, Nat.ofNat_pos, ite_true] + rw [hS l (by omega), zero_add, hV3] + rw [h1, h2] + simp + have hm : ∀ z ∈ closedBall (0 : ℂ) 1, ((0 : ℕ), z) ∈ Dsk (sW (ew a b c)) := fun z hz => + ⟨(ew_mem_dsk a b c).1, by simpa using hz⟩ + rw [Set.disjoint_left] + rintro _ ⟨u, hu, rfl⟩ ⟨u', hu', he⟩ + have h1 := hprel (0, _) (0, _) ((hf.2.2 _ (hm _ (mem_ball_per _ _)) _ (hm _ + (mem_ball_per _ _))).mp he) + simp only at h1 + rw [hval j hj u' hu', hval i hi u hu, ite_eq_right hne.symm, ite_eq_left rfl] at h1 + exact absurd h1 (by decide) + +/-- The cuffs of a model surface are the images of the free sides of the holes. -/ +theorem cuffs_eq_holeC [T2Space Y] (hf : Presents (sW (ew a b c)) f) : cuffs Y + = holeC a b c f '' {i | i < c} := by + have hbd := (surface_of_presents (finW_sW _) (isPaired_ew a b c) hf).2 + have hcover : bd Y = ⋃ i ∈ {i | i < c}, holeC a b c f i := by + rw [hbd] + ext y + constructor + · rintro ⟨x, ⟨i, p, u, hp, hfr, hu, rfl⟩, rfl⟩ + have hi : i = 0 := by + by_contra hi + simp [sW, hi, nW] at hp + subst hi + rw [sW_zero, ew_length] at hp + obtain ⟨l, hl, rfl⟩ := (twin_eq_iff hp).mp (twin_of_free hp hfr) + refine mem_biUnion hl ⟨u, hu, ?_⟩ + rw [spt_ew] + rfl + · intro hy + obtain ⟨l, hl, u, hu, rfl⟩ := mem_iUnion₂.mp hy + refine ⟨spt (sW (ew a b c)) 0 (4 * a + 2 * b + 3 * l + 1) u, ⟨0, _, u, ?_, + freeSide_hole hl, hu, rfl⟩, ?_⟩ + · rw [sW_zero, ew_length] + have : l < c := hl + omega + · rw [spt_ew] + rfl + have hne : ∀ i < c, (holeC a b c f i).Nonempty := fun i _ => ⟨_, 0, ⟨le_rfl, zero_le_one⟩, rfl⟩ + have hc := componentsIn_eq (C := holeC a b c f) (c := c) + (fun i _ => (isCompact_Icc.image_of_continuousOn (continuousOn_hole hf i)).isClosed) + (fun i _ => isPreconnected_Icc.image _ (continuousOn_hole hf i)) hne (fun i hi j hj h + => disjoint_holeC hf hi hj h) + unfold cuffs + rw [hcover, hc] + +theorem ncard_cuffs [T2Space Y] (hf : Presents (sW (ew a b c)) f) : (cuffs Y).ncard = c := by + have hne : ∀ i < c, (holeC a b c f i).Nonempty := fun i _ => ⟨_, 0, ⟨le_rfl, zero_le_one⟩, rfl⟩ + rw [cuffs_eq_holeC hf, Set.InjOn.ncard_image] + · have : {i | i < c} = ((Finset.range c : Finset ℕ) : Set ℕ) := by + ext i + simp + rw [this, ncard_coe_finset, Finset.card_range] + · intro i hi j hj he + by_contra hij + obtain ⟨x, hx⟩ := hne i hi + exact Set.disjoint_left.mp (disjoint_holeC hf hi hj hij) hx (he ▸ hx) + +/-- A handle and a cross-cap are three cross-caps. -/ +theorem model_tp (a b c : ℕ) : Nonempty (SurfaceModel (a + 1) (b + 1) c ≃ₜ SurfaceModel a + (b + 3) c) := by + obtain ⟨ht, f, hf⟩ := presents_ew (a + 1) (b + 1) c + obtain ⟨w, h1, h2⟩ := exists_modelW_nf.{0} (a + 1) (b + 1) c + obtain ⟨w', h1', h2'⟩ := exists_modelW_nf.{0} a (b + 3) c + have h3 : IsNF w (a + 1) (b + 1) c := by + rcases h2 with ⟨h, -⟩ | ⟨h, -⟩ + · exact h + · omega + have h3' : IsNF w' a (b + 3) c := by + rcases h2' with ⟨h, -⟩ | ⟨h, -⟩ + · exact h + · omega + have h4 : WEq.{0} w w' := nf_tp h3 h3' + have h5 := (peq_modelW_ew (a + 1) (b + 1) c (SurfaceModel (a + 1) (b + 1) c)).mpr ⟨f, hf⟩ + obtain ⟨g, hg⟩ := ((h1.trans (PEq.trans h4 h1'.symm)) (SurfaceModel (a + 1) (b + 1) c)).mp h5 + exact model_homeo a (b + 3) c hg + +theorem model_to_caps (a b c : ℕ) : Nonempty (SurfaceModel a (b + 1) c ≃ₜ SurfaceModel 0 + (2 * a + b + 1) c) := by + induction a generalizing b with + | zero => + have e : 2 * 0 + b + 1 = b + 1 := by omega + rw [e] + exact ⟨Homeomorph.refl _⟩ + | succ a ih => + obtain ⟨e1⟩ := model_tp a b c + obtain ⟨e2⟩ := ih (b + 2) + have e : 2 * a + (b + 2) + 1 = 2 * (a + 1) + b + 1 := by omega + rw [e] at e2 + exact ⟨e1.trans e2⟩ + +/-- **The model criterion.** -/ +theorem modelCriterion : ModelCriterionStatement := by + refine ⟨isSurface_model, fun a b c a' b' c' => ⟨?_, ?_⟩⟩ + · rintro ⟨e⟩ + obtain ⟨ht, f, hf⟩ := presents_ew a b c + obtain ⟨ht', f', hf'⟩ := presents_ew a' b' c' + have hc : c = c' := by + rw [← ncard_cuffs hf, ← ncard_cuffs hf', ncard_cuffs_congr e] + have h2 : 2 * a + b = 2 * a' + b' := by + have h3 := card_kCl (A := ZMod 2) hf + have h4 := card_kCl (A := ZMod 2) hf' + rw [card_lam_two, card_kCl_congr e, h4, card_lam_two] at h3 + exact (Nat.pow_right_injective (le_refl 2) h3).symm + refine ⟨hc, h2, ?_⟩ + have h3 := card_kCl (A := ZMod 3) hf + have h4 := card_kCl (A := ZMod 3) hf' + rw [card_kCl_congr e, h4] at h3 + have hinj : Function.Injective fun n : ℕ => 3 ^ n := Nat.pow_right_injective (by norm_num) + cases b with + | zero => + cases b' with + | zero => simp + | succ b' => + rw [card_lam_three_succ, card_lam_three_zero] at h3 + have := hinj h3 + omega + | succ b => + cases b' with + | zero => + rw [card_lam_three_succ, card_lam_three_zero] at h3 + have := hinj h3 + omega + | succ b' => simp + · rintro ⟨rfl, h2, h3⟩ + cases b with + | zero => + have hb' : b' = 0 := h3.mp rfl + subst hb' + have ha : a = a' := by omega + subst ha + exact ⟨Homeomorph.refl _⟩ + | succ b => + cases b' with + | zero => exact absurd (h3.mpr rfl) (by omega) + | succ b' => + obtain ⟨e1⟩ := model_to_caps a b c + obtain ⟨e2⟩ := model_to_caps a' b' c + have e : 2 * a + b + 1 = 2 * a' + b' + 1 := by omega + rw [e] at e1 + exact ⟨e1.trans e2.symm⟩ + +/-- The relation "simpler than" is well-founded, since `4 * a + 2 * b + c` depends only on the space +by the model +criterion. -/ +theorem simplerWellFounded : SimplerWellFoundedStatement.{u} := by + classical + let rk : (Σ X : Type u, TopologicalSpace X) → ℕ := fun X => + sInf {n | ∃ a b c, 4 * a + 2 * b + c = n ∧ @Nonempty (@Homeomorph X.1 + (SurfaceModel a b c) X.2 _)} + refine Subrelation.wf (r := InvImage (· < ·) rk) ?_ (InvImage.wf rk Nat.lt_wfRel.wf) + rintro ⟨X, tX⟩ ⟨Y, tY⟩ ⟨a, b, c, a', b', c', ⟨e⟩, ⟨e'⟩, -, -, h⟩ + have h1 : rk ⟨X, tX⟩ ≤ 4 * a + 2 * b + c := Nat.sInf_le ⟨a, b, c, rfl, ⟨e⟩⟩ + have h2 : rk ⟨Y, tY⟩ = 4 * a' + 2 * b' + c' := by + refine le_antisymm (Nat.sInf_le ⟨a', b', c', rfl, ⟨e'⟩⟩) ?_ + refine le_csInf ⟨_, a', b', c', rfl, ⟨e'⟩⟩ ?_ + rintro _ ⟨a₂, b₂, c₂, rfl, ⟨e₂⟩⟩ + obtain ⟨h3, h4, -⟩ := (modelCriterion.2 a' b' c' a₂ b₂ c₂).mp ⟨e'.symm.trans e₂⟩ + omega + change rk ⟨X, tX⟩ < rk ⟨Y, tY⟩ + omega + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/ModelDisc.lean b/LeanPool/GraphMinor/Surface/ModelDisc.lean new file mode 100644 index 0000000000..f12a9f332b --- /dev/null +++ b/LeanPool/GraphMinor/Surface/ModelDisc.lean @@ -0,0 +1,391 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ModelWord +public import LeanPool.GraphMinor.Surface.TopologyStatements +import Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds +import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan +import Mathlib.Analysis.Real.Pi.Bounds + +/-! +# The upper half of the model surface as a disc + +The sphere with holes around the points `3 i` of the real axis is cut along the graph of the height +function `hgt`: +its upper half consists of the points above the graph, together with the point at infinity. The +Cayley map turns the +unit disc into the closed upper half plane, and pushing up by the height gives the map `upE` from +the unit disc onto +the upper half. It is continuous and injective (`continuousOn_upE`, `injOn_upE`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +open scoped OnePoint + +/-- The point of the plane with coordinates `x`, `y`. -/ +noncomputable def pt (x y : ℝ) : EuclideanPlane := !₂[x, y] + +@[simp] theorem pt_zero (x y : ℝ) : (pt x y) 0 = x := by simp [pt] +@[simp] theorem pt_one (x y : ℝ) : (pt x y) 1 = y := by simp [pt] + +theorem pt_ext (u : EuclideanPlane) : pt (u 0) (u 1) = u := by + ext i + fin_cases i <;> simp + +theorem continuous_pt : Continuous fun p : ℝ × ℝ => pt p.1 p.2 := by + unfold pt + apply continuous_induced_rng.mpr + refine continuous_pi fun i => ?_ + fin_cases i + · simp only [Fin.zero_eta, Fin.isValue, Function.comp_apply, Matrix.cons_val_zero] + fun_prop + · simp only [Fin.mk_one, Fin.isValue, Function.comp_apply, Matrix.cons_val_one, + Matrix.cons_val_fin_one] + fun_prop + +theorem norm_pt_sq (x y : ℝ) : ‖pt x y‖ ^ 2 = x ^ 2 + y ^ 2 := by + rw [EuclideanSpace.norm_eq, Real.sq_sqrt (by positivity)] + simp [Fin.sum_univ_two] + +theorem dist_pt_sq (x y x' y' : ℝ) : dist (pt x y) (pt x' y') ^ 2 = (x - x') ^ 2 + (y - y') ^ 2 + := by + rw [EuclideanSpace.dist_eq, Real.sq_sqrt (by positivity)] + simp [Fin.sum_univ_two, Real.dist_eq, sq_abs] + +theorem modelCentre_eq (i : ℕ) : modelCentre i = pt (3 * i) 0 := rfl + +theorem modelMirror_pt (x y : ℝ) : modelMirror (pt x y) = pt x (-y) := by + simp [modelMirror, pt] + +/-- The height of the upper half circles above the real axis. -/ +noncomputable def hgt (n : ℕ) (x : ℝ) : ℝ := ∑ i ∈ Finset.range n, √(1 - (x - 3 * i) ^ 2) + +theorem continuous_hgt (n : ℕ) : Continuous (hgt n) := by + unfold hgt + fun_prop + +theorem hgt_nonneg (n : ℕ) (x : ℝ) : 0 ≤ hgt n x := Finset.sum_nonneg fun _ _ => Real.sqrt_nonneg _ + +theorem hgt_ge (n : ℕ) (x : ℝ) {i : ℕ} (hi : i < n) : √(1 - (x - 3 * i) ^ 2) ≤ hgt n x := + Finset.single_le_sum (f := fun i : ℕ => √(1 - (x - 3 * i) ^ 2)) (fun _ _ => Real.sqrt_nonneg _) + (Finset.mem_range.mpr hi) + +theorem sqrt_eq_zero_of_far {x : ℝ} {i : ℕ} (h : 1 ≤ |x - 3 * i|) : √(1 - (x - 3 * i) ^ 2) = 0 := by + refine Real.sqrt_eq_zero_of_nonpos ?_ + have := sq_abs (x - 3 * i) + nlinarith + +/-- Near the centre `k` only one term of the height is left. -/ +theorem hgt_eq {n k : ℕ} (hk : k < n) {x : ℝ} (hx : |x - 3 * k| ≤ 1) : hgt n x = √(1 - + (x - 3 * k) ^ 2) := by + unfold hgt + refine Finset.sum_eq_single_of_mem k (Finset.mem_range.mpr hk) fun i _ hi + => sqrt_eq_zero_of_far ?_ + obtain ⟨h1, h2⟩ := abs_le.mp hx + rcases lt_or_gt_of_ne hi with h | h + · have : (i : ℝ) + 1 ≤ k := by exact_mod_cast h + rw [le_abs] + left + linarith + · have : (k : ℝ) + 1 ≤ i := by exact_mod_cast h + rw [le_abs] + right + linarith + +/-- The height vanishes between the circles. -/ +theorem hgt_eq_zero {n : ℕ} {x : ℝ} (h : ∀ i < n, 1 ≤ |x - 3 * i|) : hgt n x = 0 := by + unfold hgt + exact Finset.sum_eq_zero fun i hi => sqrt_eq_zero_of_far (h i (Finset.mem_range.mp hi)) + +/-- The Cayley map from the unit disc to the upper half plane. -/ +noncomputable def cay (z : ℂ) : ℂ := Complex.I * (1 + z) / (1 - z) + +/-- The inverse of the Cayley map. -/ +noncomputable def cayI (w : ℂ) : ℂ := (w - Complex.I) / (w + Complex.I) + +theorem cayI_cay {z : ℂ} (hz : z ≠ 1) : cayI (cay z) = z := by + have h1 : 1 - z ≠ 0 := sub_ne_zero.mpr hz.symm + have hI : Complex.I ≠ 0 := Complex.I_ne_zero + have h2 : cay z + Complex.I = 2 * Complex.I / (1 - z) := by + unfold cay + field_simp + ring + have h3 : cay z - Complex.I = 2 * Complex.I * z / (1 - z) := by + unfold cay + field_simp + ring + unfold cayI + rw [h2, h3] + field_simp + +theorem cay_cayI {w : ℂ} (hw : w + Complex.I ≠ 0) : cayI w ≠ 1 ∧ cay (cayI w) = w := by + have hI : Complex.I ≠ 0 := Complex.I_ne_zero + have h2 : (2 : ℂ) ≠ 0 := two_ne_zero + have h1 : 1 - cayI w = 2 * Complex.I / (w + Complex.I) := by + unfold cayI + field_simp + ring + have h3 : 1 - cayI w ≠ 0 := by + rw [h1] + exact div_ne_zero (mul_ne_zero h2 hI) hw + refine ⟨fun h => h3 (by rw [h, sub_self]), ?_⟩ + have h4 : 1 + cayI w = 2 * w / (w + Complex.I) := by + unfold cayI + field_simp + ring + unfold cay + rw [h1, h4] + field_simp + +theorem normSq_sub_I_add_I (w : ℂ) : + Complex.normSq (w + Complex.I) - Complex.normSq (w - Complex.I) = 4 * w.im := by + simp [Complex.normSq_apply] + ring + +theorem add_I_ne {w : ℂ} (hw : 0 ≤ w.im) : w + Complex.I ≠ 0 := by + intro h + have := congrArg Complex.im h + simp at this + linarith + +theorem cay_add_I_ne {z : ℂ} (hz : z ≠ 1) : cay z + Complex.I ≠ 0 := by + have h1 : 1 - z ≠ 0 := sub_ne_zero.mpr hz.symm + have h2 : cay z + Complex.I = 2 * Complex.I / (1 - z) := by + unfold cay + field_simp + ring + rw [h2] + exact div_ne_zero (mul_ne_zero two_ne_zero Complex.I_ne_zero) h1 + +theorem norm_cayI_le_iff {w : ℂ} (hw : w + Complex.I ≠ 0) : ‖cayI w‖ ≤ 1 ↔ 0 ≤ w.im := by + have h0 : 0 < ‖w + Complex.I‖ := norm_pos_iff.mpr hw + have e := normSq_sub_I_add_I w + simp only [Complex.normSq_eq_norm_sq] at e + unfold cayI + rw [norm_div, div_le_one h0] + constructor + · intro h + have : ‖w - Complex.I‖ ^ 2 ≤ ‖w + Complex.I‖ ^ 2 := pow_le_pow_left₀ (norm_nonneg _) h 2 + linarith + · intro h + exact (pow_le_pow_iff_left₀ (norm_nonneg _) h0.le two_ne_zero).mp (by linarith) + +theorem norm_cayI_eq_iff {w : ℂ} (hw : w + Complex.I ≠ 0) : ‖cayI w‖ = 1 ↔ w.im = 0 := by + have h0 : 0 < ‖w + Complex.I‖ := norm_pos_iff.mpr hw + have e := normSq_sub_I_add_I w + simp only [Complex.normSq_eq_norm_sq] at e + unfold cayI + rw [norm_div, div_eq_one_iff_eq h0.ne'] + constructor + · intro h + rw [h] at e + linarith + · intro h + have : ‖w - Complex.I‖ ^ 2 = ‖w + Complex.I‖ ^ 2 := by linarith + exact (pow_left_inj₀ (norm_nonneg _) h0.le two_ne_zero).mp this + +/-- The map from the unit disc onto the upper half of the model surface. -/ +noncomputable def upE (n : ℕ) (z : ℂ) : OnePoint EuclideanPlane := + open Classical in if z = 1 then ∞ else ((pt (cay z).re ((cay z).im + hgt n + (cay z).re) : EuclideanPlane) : OnePoint EuclideanPlane) + +theorem upE_one (n : ℕ) : upE n 1 = ∞ := by simp [upE] + +theorem upE_ne {n : ℕ} {z : ℂ} (hz : z ≠ 1) : + upE n z = ((pt (cay z).re ((cay z).im + hgt n (cay z).re) : EuclideanPlane) : OnePoint + EuclideanPlane) := by + simp [upE, hz] + +theorem cay_im_nonneg {z : ℂ} (hz : z ≠ 1) (hb : ‖z‖ ≤ 1) : 0 ≤ (cay z).im := by + have h := cay_add_I_ne hz + rw [← norm_cayI_le_iff h, cayI_cay hz] + exact hb + +theorem injOn_upE (n : ℕ) : InjOn (upE n) (closedBall 0 1) := by + intro z _ z' _ he + by_cases h : z = 1 <;> by_cases h' : z' = 1 + · rw [h, h'] + · rw [h, upE_one, upE_ne h'] at he + exact absurd he (OnePoint.infty_ne_coe _) + · rw [h', upE_one, upE_ne h] at he + exact absurd he (OnePoint.coe_ne_infty _) + · rw [upE_ne h, upE_ne h'] at he + have e := OnePoint.coe_injective he + have e1 := congrFun (congrArg (fun u : EuclideanPlane => (u : Fin 2 → ℝ)) e) 0 + have e2 := congrFun (congrArg (fun u : EuclideanPlane => (u : Fin 2 → ℝ)) e) 1 + simp only [pt_zero, pt_one] at e1 e2 + have e3 : cay z = cay z' := by + apply Complex.ext e1 + rw [e1] at e2 + linarith + rw [← cayI_cay h, ← cayI_cay h', e3] + +theorem continuousOn_upE (n : ℕ) : ContinuousOn (upE n) (closedBall 0 1) := by + intro z hz + by_cases h : z = 1 + · subst h + have hval : upE n 1 = ∞ := upE_one n + rw [ContinuousWithinAt, hval] + let P : ℂ → EuclideanPlane := fun z => pt (cay z).re ((cay z).im + hgt n (cay z).re) + have key : Tendsto (fun z => ‖P z‖) (𝓝[closedBall 0 1 \ {1}] 1) atTop := by + refine tendsto_atTop.mpr fun R => ?_ + have hδ : 0 < 1 / (|R| + 2) := by positivity + have hmem : ball (1 : ℂ) (1 / (|R| + 2)) ∈ 𝓝[closedBall 0 1 \ {1}] (1 : ℂ) := + mem_nhdsWithin_of_mem_nhds (ball_mem_nhds _ hδ) + filter_upwards [hmem, self_mem_nhdsWithin] with z hz hz' + have hne : z ≠ 1 := hz'.2 + have hb : ‖z‖ ≤ 1 := mem_closedBall_zero_iff.mp hz'.1 + have h1 : 0 < ‖1 - z‖ := norm_pos_iff.mpr (sub_ne_zero.mpr hne.symm) + have h2 : ‖1 - z‖ < 1 / (|R| + 2) := by + rw [mem_ball, dist_eq_norm, norm_sub_rev] at hz + exact hz + have h3 : 1 / (|R| + 2) ≤ 1 / 2 := by + apply one_div_le_one_div_of_le (by norm_num) + linarith [abs_nonneg R] + have h4 : 1 ≤ ‖1 + z‖ := by + have : ‖(2 : ℂ)‖ ≤ ‖1 + z‖ + ‖1 - z‖ := by + have e : (2 : ℂ) = (1 + z) + (1 - z) := by ring + rw [e] + exact norm_add_le _ _ + simp at this + linarith + have h5 : ‖cay z‖ = ‖1 + z‖ / ‖1 - z‖ := by + simp [cay] + have h6 : |R| + 2 ≤ ‖cay z‖ := by + rw [h5, le_div_iff₀ h1] + have : (|R| + 2) * ‖1 - z‖ < 1 := by + rw [lt_div_iff₀ (by positivity)] at h2 + linarith + linarith + have h7 : ‖cay z‖ ^ 2 ≤ ‖P z‖ ^ 2 := by + rw [Complex.sq_norm, Complex.normSq_apply, norm_pt_sq] + nlinarith [hgt_nonneg n (cay z).re, cay_im_nonneg hne hb] + have h8 : ‖cay z‖ ≤ ‖P z‖ := (pow_le_pow_iff_left₀ (norm_nonneg _) + (norm_nonneg _) two_ne_zero).mp h7 + linarith [le_abs_self R] + have h1 : Tendsto P (𝓝[closedBall 0 1 \ {1}] 1) (coclosedCompact EuclideanPlane) := by + rw [coclosedCompact_eq_cocompact] + rw [← Metric.cobounded_eq_cocompact, ← comap_norm_atTop] + exact tendsto_comap_iff.mpr key + have h2 : Tendsto (upE n) (𝓝[closedBall 0 1 \ {1}] 1) (𝓝 ∞) := by + refine (OnePoint.tendsto_coe_infty.comp h1).congr' ?_ + filter_upwards [self_mem_nhdsWithin] with z hz + exact (upE_ne hz.2).symm + have h3 : closedBall (0 : ℂ) 1 = insert 1 (closedBall 0 1 \ {1}) := by + ext w + by_cases hw : w = 1 + · subst hw + simp + · simp + rw [h3, nhdsWithin_insert] + refine Tendsto.sup ?_ h2 + rw [tendsto_pure_left] + intro s hs + rw [hval] + exact mem_of_mem_nhds hs + · have h1 : ContinuousAt cay z := by + unfold cay + exact ContinuousAt.div (by fun_prop) (by fun_prop) (sub_ne_zero.mpr (Ne.symm h)) + have h2 : ContinuousAt (fun z : ℂ => ((pt (cay z).re ((cay z).im + hgt n + (cay z).re) : EuclideanPlane) : + OnePoint EuclideanPlane)) z := by + refine OnePoint.continuous_coe.continuousAt.comp ?_ + refine continuous_pt.continuousAt.comp (f := fun z => ((cay z).re, + (cay z).im + hgt n (cay z).re)) ?_ + have hr : ContinuousAt (fun z => (cay z).re) z := Complex.continuous_re.continuousAt.comp h1 + have hi : ContinuousAt (fun z => (cay z).im) z := Complex.continuous_im.continuousAt.comp h1 + exact hr.prodMk (hi.add ((continuous_hgt n).continuousAt.comp hr)) + refine (h2.congr ?_).continuousWithinAt + filter_upwards [isOpen_ne.mem_nhds h] with w hw + exact (upE_ne hw).symm + +/-- A point above the height function is a value of `upE`. -/ +theorem exists_upE {n : ℕ} {x y : ℝ} (h : hgt n x ≤ y) : + ∃ z ∈ closedBall (0 : ℂ) 1, upE n z = ((pt x y : EuclideanPlane) : OnePoint EuclideanPlane) + := by + let w : ℂ := ⟨x, y - hgt n x⟩ + have hw : 0 ≤ w.im := sub_nonneg.mpr h + have h1 := add_I_ne hw + obtain ⟨h2, h3⟩ := cay_cayI h1 + refine ⟨cayI w, mem_closedBall_zero_iff.mpr ((norm_cayI_le_iff h1).mpr hw), ?_⟩ + rw [upE_ne h2, h3] + simp [w] + +/-- The values of `upE` other than infinity lie above the height function. -/ +theorem upE_above {n : ℕ} {z : ℂ} (hz : ‖z‖ ≤ 1) (hne : z ≠ 1) : + hgt n (cay z).re ≤ (cay z).im + hgt n (cay z).re := by + linarith [cay_im_nonneg hne hz] + +/-- The angle of the point `s` of the real axis on the unit circle. -/ +noncomputable def angT (s : ℝ) : ℝ := Real.pi + 2 * Real.arctan s + +theorem angT_mem (s : ℝ) : 0 < angT s ∧ angT s < 2 * Real.pi := by + have h1 := Real.arctan_lt_pi_div_two s + have h2 := Real.neg_pi_div_two_lt_arctan s + unfold angT + constructor <;> linarith + +theorem continuous_angT : Continuous angT := by + unfold angT + fun_prop + +theorem strictMono_angT : StrictMono angT := fun a b h => by + have := Real.arctan_strictMono h + unfold angT + linarith + +/-- The unit circle minus `1` and the real axis. -/ +theorem cay_cis (s : ℝ) : cis' (angT s) ≠ 1 ∧ cay (cis' (angT s)) = (s : ℂ) := by + have h1 : cis' (angT s) = cayI (s : ℂ) := by + set φ := Real.arctan s with hφ + have hc : 0 < Real.cos φ := Real.cos_arctan_pos s + have ht : Real.tan φ = s := Real.tan_arctan s + have hs : s = Real.sin φ / Real.cos φ := by rw [← ht, Real.tan_eq_sin_div_cos] + have hne : ((Real.cos φ : ℂ)) ≠ 0 := by exact_mod_cast hc.ne' + have hne2 : (s : ℂ) + Complex.I ≠ 0 := add_I_ne (by simp) + have e1 : cis' (angT s) = - (Complex.exp (φ * Complex.I)) ^ 2 := by + simp only [cis', angT, ← hφ] + push_cast + rw [← Complex.exp_nat_mul, add_mul, Complex.exp_add, Complex.exp_pi_mul_I] + push_cast + ring_nf + have e2 : Complex.exp (φ * Complex.I) = Real.cos φ + Real.sin φ * Complex.I := by + rw [Complex.exp_mul_I] + push_cast + ring_nf + unfold cayI + rw [eq_div_iff hne2, e1, e2] + have e3 : (s : ℂ) = Real.sin φ / Real.cos φ := by rw [hs]; push_cast; rfl + have hsc : (Real.sin φ : ℂ) ^ 2 + (Real.cos φ : ℂ) ^ 2 = 1 := by + exact_mod_cast Real.sin_sq_add_cos_sq φ + have hI : Complex.I ^ 2 = -1 := Complex.I_sq + generalize (Real.sin φ : ℂ) = si at * + generalize (Real.cos φ : ℂ) = c at * + have key : -(c + si * Complex.I) ^ 2 * (si + c * Complex.I) = si - c * Complex.I := by + linear_combination (si - c * Complex.I) * hsc + + (-2 * c ^ 2 * si - si ^ 3 - c * si ^ 2 * Complex.I) * hI + have e4 : (s : ℂ) + Complex.I = (si + c * Complex.I) / c := by + rw [e3] + field_simp + have e5 : (s : ℂ) - Complex.I = (si - c * Complex.I) / c := by + rw [e3] + field_simp + rw [e4, e5, ← key] + field_simp + have h2 := cay_cayI (w := (s : ℂ)) (add_I_ne (by simp)) + rw [h1] + exact h2 + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/ModelHomeo.lean b/LeanPool/GraphMinor/Surface/ModelHomeo.lean new file mode 100644 index 0000000000..daf6f30a53 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/ModelHomeo.lean @@ -0,0 +1,109 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ModelPresent + +/-! +# Spaces presented by the model word + +A Hausdorff space presented by the word of the model `Σ(a, b, c)` is homeomorphic to it +(`model_homeo`). The map from +the discs onto a Hausdorff space identifies its target with a quotient of a compact set, and this +gives continuity +in both directions. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u v + +/-- A map out of a compact quotient is continuous when its composition with the quotient map is. -/ +theorem continuous_of_compact_quotient {A : Type*} {X : Type u} {Y : Type v} [TopologicalSpace A] + [T2Space A] + [TopologicalSpace X] [T2Space X] [TopologicalSpace Y] {D : Set A} (hD : IsCompact D) {f : A → X} + (hf : ContinuousOn f D) (hs : f '' D = univ) {e : X → Y} (he : ContinuousOn + (e ∘ f) D) : Continuous e := by + rw [continuous_iff_isClosed] + intro C hC + have h1 : IsCompact (D ∩ (e ∘ f) ⁻¹' C) := + hD.of_isClosed_subset (he.preimage_isClosed_of_isClosed hD.isClosed hC) inter_subset_left + have h2 : e ⁻¹' C = f '' (D ∩ (e ∘ f) ⁻¹' C) := by + ext x + constructor + · intro hx + have h3 : x ∈ f '' D := hs ▸ mem_univ x + obtain ⟨a, ha, rfl⟩ := h3 + exact ⟨a, ⟨ha, hx⟩, rfl⟩ + · rintro ⟨a, ⟨-, ha⟩, rfl⟩ + exact ha + rw [h2] + exact (h1.image_of_continuousOn (hf.mono inter_subset_left)).isClosed + +theorem model_homeo {X : Type u} [TopologicalSpace X] [T2Space X] (a b c : ℕ) {f : ℕ × ℂ → X} + (hf : Presents (modelW a b (2 * a + b + c)) f) : Nonempty (X ≃ₜ SurfaceModel a b c) := by + classical + obtain ⟨Φ, Φ', hΦ⟩ := exists_modelPoly (2 * a + b + c) + set n := 2 * a + b + c with hn + have hg := presents_of_isPoly (a := a) (b := b) (Φ' := Φ') hΦ (by omega) + have hW : {i | modelW a b n i ≠ []}.Finite := by + refine (finite_le_nat 1).subset fun i hi => modelW_slot hi + have hD : IsCompact (Dsk (modelW a b n)) := isCompact_Dsk hW + obtain ⟨hc, hs, hrel⟩ := hf + obtain ⟨hgc, hgs, hgrel⟩ := hg + have hbase : ∀ x ∈ Dsk (modelW a b n), Fv n Φ x ∈ modelBase n := fun x hx => Fv_base hΦ.1 hx.2 + have ex1 : ∀ x : X, ∃ y ∈ Dsk (modelW a b n), f y = x := fun x => by + have h1 : x ∈ f '' Dsk (modelW a b n) := hs ▸ mem_univ x + exact h1 + have ex2 : ∀ p : modelBase n, ∃ y ∈ Dsk (modelW a b n), Fv n Φ y = p.1 := fun p => + Fv_surj (a := a) (b := b) hΦ p.2 + choose s1 hs1 hs1' using ex1 + choose s2 hs2 hs2' using ex2 + have hret : ∀ p : modelBase n, retB n p.1 = p := fun p => Subtype.ext (retB_val p.2) + have hgs2 : ∀ p : modelBase n, toModel a b n Φ (s2 p) = Quot.mk _ p := fun p => by + simp only [toModel, hs2', hret] + let lift : Quot (ModelGlue a b n) → X := Quot.lift (fun p => f (s2 p)) (by + intro p q hpq + have h1 : toModel a b n Φ (s2 p) = toModel a b n Φ (s2 q) := by + rw [hgs2, hgs2] + exact Quot.sound hpq + exact (hrel _ (hs2 p) _ (hs2 q)).mpr ((hgrel _ (hs2 p) _ (hs2 q)).mp h1)) + let e : X → Quot (ModelGlue a b n) := fun x => toModel a b n Φ (s1 x) + have he1 : ∀ y ∈ Dsk (modelW a b n), e (f y) = toModel a b n Φ y := fun y hy => + (hgrel _ (hs1 _) _ hy).mpr ((hrel _ (hs1 _) _ hy).mp (hs1' _)) + have hl1 : ∀ y ∈ Dsk (modelW a b n), lift (toModel a b n Φ y) = f y := fun y hy => by + have h1 : toModel a b n Φ y = Quot.mk _ (retB n (Fv n Φ y)) := rfl + rw [h1] + change f (s2 _) = f y + have h2 : toModel a b n Φ (s2 (retB n (Fv n Φ y))) = toModel a b n Φ y := hgs2 _ + exact (hrel _ (hs2 _) _ hy).mpr ((hgrel _ (hs2 _) _ hy).mp h2) + have hec : Continuous e := continuous_of_compact_quotient hD hc hs + (hgc.congr fun y hy => he1 y hy) + have hrc : ContinuousOn (fun x => retB n (Fv n Φ x)) (Dsk (modelW a b n)) := + (continuousOn_retB n).comp (continuousOn_Fv hΦ.1) hbase + have hrs : (fun x => retB n (Fv n Φ x)) '' Dsk (modelW a b n) = univ := + eq_univ_of_forall fun p => ⟨s2 p, hs2 p, by simp only [hs2', hret]⟩ + have hlc : Continuous lift := by + refine continuous_quot_lift _ ?_ + exact continuous_of_compact_quotient hD hrc hrs (hc.congr fun y hy => by + exact (hrel _ (hs2 _) _ hy).mpr ((hgrel _ (hs2 _) _ hy).mp (hgs2 _))) + refine ⟨{ toFun := e, invFun := lift, left_inv := fun x => ?_, right_inv := fun q => ?_, + continuous_toFun := hec, continuous_invFun := hlc }⟩ + · show lift (e x) = x + simp only [e] + rw [hl1 _ (hs1 x), hs1'] + · obtain ⟨p, rfl⟩ := Quot.exists_rep q + change e (f (s2 p)) = _ + rw [he1 _ (hs2 p), hgs2] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/ModelLoop.lean b/LeanPool/GraphMinor/Surface/ModelLoop.lean new file mode 100644 index 0000000000..f1b146fcdd --- /dev/null +++ b/LeanPool/GraphMinor/Surface/ModelLoop.lean @@ -0,0 +1,249 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ModelDisc +import Mathlib.Analysis.SpecialFunctions.Trigonometric.Bounds +import Mathlib.Analysis.SpecialFunctions.Trigonometric.Arctan +import Mathlib.Analysis.Real.Pi.Bounds + +/-! +# The boundary loop of the upper half of a model surface + +`axS` runs along the real axis so that the circles are crossed at the same speed. `angL` is the +angle of a loop on +the unit circle: it runs along the axis and then through the point at infinity. The polygon lemma +gives a map of the +unit disc with these boundary values (`exists_modelPoly`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +open scoped OnePoint + +/-- The speed along the axis. -/ +noncomputable def axPhi (t : ℝ) : ℝ := 3 * t / 2 - 1 + (1 - Real.cos (Real.pi * t)) / 4 + +/-- The position on the axis. -/ +noncomputable def axS (y : ℝ) : ℝ := axPhi (y - 1) + +theorem continuous_axPhi : Continuous axPhi := by + unfold axPhi + fun_prop + +theorem continuous_axS : Continuous axS := continuous_axPhi.comp (by fun_prop) + +theorem strictMono_axPhi : StrictMono axPhi := by + intro x y h + have h1 := Real.abs_cos_sub_cos_le (Real.pi * x) (Real.pi * y) + have h2 : |Real.pi * x - Real.pi * y| = Real.pi * (y - x) := by + rw [← mul_sub, abs_mul, abs_of_pos Real.pi_pos, abs_sub_comm, abs_of_pos (sub_pos.mpr h)] + rw [h2] at h1 + have h3 := (abs_le.mp h1).1 + have h4 := Real.pi_lt_four + unfold axPhi + nlinarith [sub_pos.mpr h] + +theorem strictMono_axS : StrictMono axS := fun _ _ h => strictMono_axPhi (by linarith) + +theorem axPhi_zero : axPhi 0 = -1 := by norm_num [axPhi] + +theorem axPhi_one : axPhi 1 = 1 := by norm_num [axPhi] + +theorem axPhi_neg (t : ℝ) : axPhi (1 - t) = - axPhi t := by + unfold axPhi + rw [show Real.pi * (1 - t) = Real.pi - Real.pi * t by ring, Real.cos_pi_sub] + ring + +theorem axPhi_period (t : ℝ) (k : ℕ) : axPhi (t + 2 * k) = axPhi t + 3 * k := by + unfold axPhi + rw [show Real.pi * (t + 2 * k) = Real.pi * t + k * (2 * Real.pi) by ring, + Real.cos_add_nat_mul_two_pi] + ring + +theorem axS_hole (k : ℕ) (t : ℝ) : axS (2 * k + 1 + t) = 3 * k + axPhi t := by + unfold axS + rw [show (2 * (k : ℝ) + 1 + t - 1) = t + 2 * k by ring, axPhi_period] + ring + +theorem axS_even (k : ℕ) : axS (2 * k) = 3 * k - 2 := by + have h : (2 * (k : ℝ) - 1) = -1 + 2 * k := by ring + unfold axS + rw [h, axPhi_period] + have : axPhi (-1) = -2 := by norm_num [axPhi] + rw [this] + ring + +theorem axS_odd (k : ℕ) : axS (2 * k + 1) = 3 * k - 1 := by + have := axS_hole k 0 + rw [add_zero, axPhi_zero] at this + rw [this] + ring + +/-- The height on the segments of the axis is zero. -/ +theorem hgt_seg {n k : ℕ} {y : ℝ} (h0 : 2 * (k : ℝ) ≤ y) (h1 : y ≤ 2 * k + 1) : hgt n (axS y) = 0 + := by + have h2 : 3 * (k : ℝ) - 2 ≤ axS y := by rw [← axS_even]; exact strictMono_axS.monotone h0 + have h3 : axS y ≤ 3 * (k : ℝ) - 1 := by rw [← axS_odd]; exact strictMono_axS.monotone h1 + refine hgt_eq_zero fun i _ => ?_ + rcases lt_trichotomy i k with h | rfl | h + · have : (i : ℝ) + 1 ≤ k := by exact_mod_cast h + rw [le_abs] + left + linarith + · rw [le_abs] + right + linarith + · have : (k : ℝ) + 1 ≤ i := by exact_mod_cast h + rw [le_abs] + right + linarith + +theorem hgt_large {n : ℕ} {x : ℝ} (h : 3 * (n : ℝ) - 2 ≤ x) : hgt n x = 0 := by + refine hgt_eq_zero fun i hi => ?_ + have : (i : ℝ) + 1 ≤ n := by exact_mod_cast hi + rw [le_abs] + left + linarith + +theorem hgt_small {n : ℕ} {x : ℝ} (h : x ≤ -2) : hgt n x = 0 := by + refine hgt_eq_zero fun i _ => ?_ + have : (0 : ℝ) ≤ i := Nat.cast_nonneg i + rw [le_abs] + right + linarith + +/-- The angle of the loop. -/ +noncomputable def angL (n : ℕ) (y : ℝ) : ℝ := + if y ≤ 2 * n then angT (axS y) + else angT (axS (2 * n)) + (y - 2 * n) / 2 * (2 * Real.pi + angT (axS 0) - angT (axS (2 * n))) + +theorem angL_le {n : ℕ} {y : ℝ} (h : y ≤ 2 * n) : angL n y = angT (axS y) := ite_eq_left h + +theorem angL_ge {n : ℕ} {y : ℝ} (h : 2 * (n : ℝ) ≤ y) : + angL n y = angT (axS (2 * n)) + (y - 2 * n) / 2 * (2 * Real.pi + angT (axS 0) - angT (axS + (2 * n))) := by + rcases eq_or_lt_of_le h with rfl | h + · simp [angL] + · exact ite_eq_right (not_le.mpr h) + +theorem continuous_angL (n : ℕ) : Continuous (angL n) := by + refine Continuous.if_le (continuous_angT.comp continuous_axS) ?_ continuous_id continuous_const + fun y hy => ?_ + · fun_prop + · have : y = 2 * n := hy + simp [this] + +theorem angL_gap (n : ℕ) : 0 < 2 * Real.pi + angT (axS 0) - angT (axS (2 * n)) := by + have h1 := (angT_mem (axS 0)).1 + have h2 := (angT_mem (axS (2 * n))).2 + linarith + +theorem strictMono_angL (n : ℕ) : StrictMono (angL n) := by + have hg := angL_gap n + intro x y h + rcases le_total y (2 * n) with h1 | h1 + · rw [angL_le h1, angL_le (h.le.trans h1)] + exact strictMono_angT (strictMono_axS h) + rcases le_total x (2 * n) with h2 | h2 + · rw [angL_le h2, angL_ge h1] + have h3 : angT (axS x) ≤ angT (axS (2 * n)) := strictMono_angT.monotone + (strictMono_axS.monotone h2) + rcases eq_or_lt_of_le h1 with h4 | h4 + · have h5 : angT (axS x) < angT (axS (2 * n)) := strictMono_angT (strictMono_axS (by linarith)) + rw [← h4] + simpa using h5 + · have : 0 < (y - 2 * n) / 2 * (2 * Real.pi + angT (axS 0) - angT (axS (2 * n))) := + mul_pos (by linarith) hg + linarith + · rw [angL_ge h1, angL_ge h2] + have : (x - 2 * n) / 2 < (y - 2 * n) / 2 := by linarith + nlinarith + +theorem angL_zero (n : ℕ) : angL n 0 = angT (axS 0) := angL_le (by positivity) + +theorem angL_top (n : ℕ) : angL n ((2 * n + 2 : ℕ) : ℝ) = angT (axS 0) + 2 * Real.pi := by + have : 2 * (n : ℝ) ≤ ((2 * n + 2 : ℕ) : ℝ) := by push_cast; linarith + rw [angL_ge this] + push_cast + ring + +theorem cis'_injOn_Ico (a : ℝ) : InjOn cis' (Ico a (a + 2 * Real.pi)) := by + intro x hx y hy he + have h1 : Circle.exp x = Circle.exp y := Circle.ext (by simpa [cis', Circle.coe_exp] using he) + obtain ⟨k, hk⟩ := Circle.exp_eq_exp.mp h1 + have hpi := Real.pi_pos + have h3 : (k : ℝ) * (2 * Real.pi) < 1 * (2 * Real.pi) := by nlinarith [hx.2, hy.1] + have h4 : (-1 : ℝ) * (2 * Real.pi) < k * (2 * Real.pi) := by nlinarith [hx.1, hy.2] + have h5 : (k : ℝ) < 1 := lt_of_mul_lt_mul_right h3 (by positivity) + have h6 : (-1 : ℝ) < k := lt_of_mul_lt_mul_right h4 (by positivity) + have h7 : k < 1 := by exact_mod_cast h5 + have h8 : -1 < k := by exact_mod_cast h6 + obtain rfl : k = 0 := by omega + simpa using hk + +theorem exists_cis'_angle (a : ℝ) {z : ℂ} (hz : ‖z‖ = 1) : ∃ x ∈ Icc a (a + 2 * Real.pi), cis' x + = z := by + have ha : ∃ θ, cis' θ = z := ⟨_, cis'_arg hz⟩ + obtain ⟨θ, rfl⟩ := ha + have hpi := Real.pi_pos + let k : ℤ := ⌈(a - θ) / (2 * Real.pi)⌉ + have h1 : (a - θ) / (2 * Real.pi) ≤ k := Int.le_ceil _ + have h2 : (k : ℝ) < (a - θ) / (2 * Real.pi) + 1 := Int.ceil_lt_add_one _ + rw [div_le_iff₀ (by positivity)] at h1 + have h3 : (k : ℝ) * (2 * Real.pi) < a - θ + 2 * Real.pi := by + have := mul_lt_mul_of_pos_right h2 (show 0 < 2 * Real.pi by positivity) + rw [add_mul, div_mul_cancel₀ _ (by positivity)] at this + linarith + refine ⟨θ + k * (2 * Real.pi), ⟨by linarith, by linarith⟩, ?_⟩ + simp only [cis'] + push_cast + rw [add_mul, Complex.exp_add] + have : Complex.exp ((k : ℂ) * (2 * (Real.pi : ℂ)) * Complex.I) = 1 := by + rw [show (k : ℂ) * (2 * (Real.pi : ℂ)) * Complex.I = k * (2 * Real.pi * Complex.I) by ring] + exact Complex.exp_int_mul_two_pi_mul_I k + rw [this, mul_one] + +theorem cis'_add_two_pi (x : ℝ) : cis' (x + 2 * Real.pi) = cis' x := cis'_period x + +/-- The polygon map of the upper half. -/ +theorem exists_modelPoly (n : ℕ) : + ∃ Φ Φ' : ℂ → ℂ, BdMatch (closedBall 0 1) (closedBall 0 1) Φ Φ' ∧ + ∀ x ∈ Icc (0 : ℝ) (2 * n + 2 : ℕ), Φ (per (2 * n + 2) x) = cis' (angL n x) := by + have hmono := strictMono_angL n + refine exists_polygon_map isClosedDisc_closedBall.1 (by omega) (β := fun x => cis' (angL n x)) + (continuous_cis'.comp (continuous_angL n)).continuousOn ?_ ?_ ?_ + · intro x hx y hy he + have h1 (z : ℝ) (hz : z ∈ Ico 0 ((2 * n + 2 : ℕ) : ℝ)) : + angL n z ∈ Ico (angT (axS 0)) (angT (axS 0) + 2 * Real.pi) := by + refine ⟨?_, ?_⟩ + · rw [← angL_zero n] + exact hmono.monotone hz.1 + · rw [← angL_top n] + exact hmono hz.2 + exact hmono.injective (cis'_injOn_Ico _ (h1 x hx) (h1 y hy) he) + · rw [angL_zero, angL_top, cis'_add_two_pi] + · rw [isClosedDisc_closedBall.2] + ext z + constructor + · rintro ⟨x, -, rfl⟩ + exact cis'_mem_sphere _ + · intro hz + obtain ⟨θ, hθ, rfl⟩ := exists_cis'_angle (angT (axS 0)) (mem_sphere_zero_iff_norm.mp hz) + have hiv := intermediate_value_Icc (a := 0) (b := ((2 * n + 2 : ℕ) : ℝ)) (by positivity) + (continuous_angL n).continuousOn + rw [angL_zero, angL_top] at hiv + obtain ⟨x, hx, rfl⟩ := hiv hθ + exact ⟨x, hx, rfl⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/ModelPresent.lean b/LeanPool/GraphMinor/Surface/ModelPresent.lean new file mode 100644 index 0000000000..9d24b4740d --- /dev/null +++ b/LeanPool/GraphMinor/Surface/ModelPresent.lean @@ -0,0 +1,924 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ModelSides +import LeanPool.GraphMinor.Surface.WordTrack + +/-! +# The model surfaces are presented by their words + +`presents_model` shows that the two discs of `modelW` map onto $\Sigma(a, b, c)$, and that two +points have the same +image exactly when they are related by the pasting of sides. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +open scoped OnePoint + +theorem pw_length (a k : ℕ) : (pw a k).length = 2 * k := by + induction k with + | zero => rfl + | succ k ih => + simp [pw, ih] + omega + +theorem qw_length (a b k : ℕ) : (qw a b k).length = 2 * k := by + induction k with + | zero => rfl + | succ k ih => + simp [qw, ih] + omega + +theorem pw_even (a k j : ℕ) (h : j < k) : (pw a k)[2 * j]? = some (segL j) := by + induction k with + | zero => omega + | succ k ih => + simp only [pw] + by_cases hj : j < k + · rw [List.getElem?_append_left (by rw [pw_length]; omega), ih hj] + · obtain rfl : j = k := by omega + rw [List.getElem?_append_right (by rw [pw_length]), pw_length] + simp + +theorem pw_odd (a k j : ℕ) (h : j < k) : (pw a k)[2 * j + 1]? = some (holeA a j) := by + induction k with + | zero => omega + | succ k ih => + simp only [pw] + by_cases hj : j < k + · rw [List.getElem?_append_left (by rw [pw_length]; omega), ih hj] + · obtain rfl : j = k := by omega + rw [List.getElem?_append_right (by rw [pw_length]; omega), pw_length] + simp + +theorem qw_even (a b k j : ℕ) (h : j < k) : (qw a b k)[2 * j]? = some (segL j) := by + induction k with + | zero => omega + | succ k ih => + simp only [qw] + by_cases hj : j < k + · rw [List.getElem?_append_left (by rw [qw_length]; omega), ih hj] + · obtain rfl : j = k := by omega + rw [List.getElem?_append_right (by rw [qw_length]), qw_length] + simp + +theorem qw_odd (a b k j : ℕ) (h : j < k) : (qw a b k)[2 * j + 1]? = some (holeB a b j) := by + induction k with + | zero => omega + | succ k ih => + simp only [qw] + by_cases hj : j < k + · rw [List.getElem?_append_left (by rw [qw_length]; omega), ih hj] + · obtain rfl : j = k := by omega + rw [List.getElem?_append_right (by rw [qw_length]; omega), qw_length] + simp + +section + +variable {a b n : ℕ} + +theorem modelW_zero : modelW a b n 0 = pw a n ++ [segL n, zL] := by + simp [modelW, dW, sW, Function.update] + +theorem modelW_one : modelW a b n 1 = qw a b n ++ [segL n, zL] := by simp [modelW, dW] + +theorem modelW_other {i : ℕ} (h0 : i ≠ 0) (h1 : i ≠ 1) : modelW a b n i = [] := by + simp [modelW, dW, sW, Function.update_of_ne h0, Function.update_of_ne h1, nW] + +theorem modelW_len {i : ℕ} (h : i ≤ 1) : (modelW a b n i).length = 2 * n + 2 := by + obtain rfl | rfl : i = 0 ∨ i = 1 := by omega + · simp [modelW_zero, pw_length] + · simp [modelW_one, qw_length] + +theorem modelW_slot {i : ℕ} (h : modelW a b n i ≠ []) : i ≤ 1 := by + by_contra h' + exact h (modelW_other (by omega) (by omega)) + +theorem modelW_seg {i k : ℕ} (hi : i ≤ 1) (hk : k ≤ n) : (modelW a b n i)[2 * k]? = some (segL k) + := by + obtain rfl | rfl : i = 0 ∨ i = 1 := by omega + · rw [modelW_zero] + rcases Nat.lt_or_ge k n with h | h + · rw [List.getElem?_append_left (by rw [pw_length]; omega), pw_even a n k h] + · obtain rfl : k = n := by omega + rw [List.getElem?_append_right (by rw [pw_length]), pw_length] + simp + · rw [modelW_one] + rcases Nat.lt_or_ge k n with h | h + · rw [List.getElem?_append_left (by rw [qw_length]; omega), qw_even a b n k h] + · obtain rfl : k = n := by omega + rw [List.getElem?_append_right (by rw [qw_length]), qw_length] + simp + +theorem modelW_top {i : ℕ} (hi : i ≤ 1) : (modelW a b n i)[2 * n + 1]? = some zL := by + obtain rfl | rfl : i = 0 ∨ i = 1 := by omega + · rw [modelW_zero, List.getElem?_append_right (by rw [pw_length]; omega), pw_length] + simp + · rw [modelW_one, List.getElem?_append_right (by rw [qw_length]; omega), qw_length] + simp + +theorem modelW_holeA {k : ℕ} (hk : k < n) : (modelW a b n 0)[2 * k + 1]? = some (holeA a k) := by + rw [modelW_zero, List.getElem?_append_left (by rw [pw_length]; omega), pw_odd a n k hk] + +theorem modelW_holeB {k : ℕ} (hk : k < n) : (modelW a b n 1)[2 * k + 1]? = some (holeB a b k) := by + rw [modelW_one, List.getElem?_append_left (by rw [qw_length]; omega), qw_odd a b n k hk] + +/-- Each position is on the axis or on a circle. -/ +theorem modelW_cases {i p : ℕ} {l : Letter} (hi : i ≤ 1) (h : (modelW a b n i)[p]? = some l) : + (∃ k, k ≤ n ∧ p = 2 * k ∧ l = segL k) ∨ (p = 2 * n + 1 ∧ l = zL) ∨ + (∃ k, k < n ∧ p = 2 * k + 1 ∧ ((i = 0 ∧ l = holeA a k) ∨ (i = 1 ∧ l = holeB a b k))) := by + have hp : p < 2 * n + 2 := by + have := (List.getElem?_eq_some_iff.mp h).1 + rwa [modelW_len hi] at this + rcases Nat.even_or_odd' p with ⟨k, rfl | rfl⟩ + · refine .inl ⟨k, by omega, rfl, ?_⟩ + rw [modelW_seg hi (by omega)] at h + exact (Option.some.inj h).symm + · by_cases hk : k < n + · refine .inr (.inr ⟨k, hk, rfl, ?_⟩) + obtain rfl | rfl : i = 0 ∨ i = 1 := by omega + · rw [modelW_holeA hk] at h + exact .inl ⟨rfl, (Option.some.inj h).symm⟩ + · rw [modelW_holeB hk] at h + exact .inr ⟨rfl, (Option.some.inj h).symm⟩ + · obtain rfl : k = n := by omega + rw [modelW_top hi] at h + exact .inr (.inl ⟨rfl, (Option.some.inj h).symm⟩) + +end + +/-- The base with a default point. -/ +noncomputable def retB (n : ℕ) (x : OnePoint EuclideanPlane) : modelBase n := + open Classical in if h : x ∈ modelBase n then ⟨x, h⟩ else ⟨∞, fun _i _ _u he => absurd he + (OnePoint.infty_ne_coe _)⟩ + +theorem retB_val {n : ℕ} {x : OnePoint EuclideanPlane} (h : x ∈ modelBase n) : (retB n x).1 = x + := by + simp [retB, h] + +theorem continuousOn_retB (n : ℕ) : ContinuousOn (retB n) (modelBase n) := by + rw [continuousOn_iff_continuous_domRestrict] + refine continuous_induced_rng.mpr ?_ + have : (Subtype.val ∘ (modelBase n).domRestrict (retB n)) = Subtype.val := by + funext x + exact retB_val x.2 + rw [this] + exact continuous_subtype_val + +theorem mem_modelBase_coe {n : ℕ} {u : EuclideanPlane} : + (u : OnePoint EuclideanPlane) ∈ modelBase n ↔ ∀ i < n, 1 ≤ dist u (modelCentre i) := by + constructor + · intro h i hi + exact h i hi u rfl + · intro h i hi x he + rw [← OnePoint.coe_injective he] + exact h i hi + +theorem mem_modelBase_pt {n : ℕ} {x y : ℝ} : + ((pt x y : EuclideanPlane) : OnePoint EuclideanPlane) ∈ modelBase n ↔ + ∀ i < n, 1 ≤ (x - 3 * i) ^ 2 + y ^ 2 := by + rw [mem_modelBase_coe] + refine forall₂_congr fun i _ => ?_ + rw [modelCentre_eq] + have h := dist_pt_sq x y (3 * i) 0 + rw [sub_zero] at h + rw [← h] + exact (one_le_sq_iff₀ dist_nonneg).symm + +theorem mirO_base {n : ℕ} {p : OnePoint EuclideanPlane} (h : p ∈ modelBase n) : mirO p ∈ modelBase + n := by + induction p using OnePoint.rec with + | infty => exact h + | coe u => + rw [mirO_coe] + rw [← pt_ext u, mem_modelBase_pt] at h + have e : modelMirror u = pt (u 0) (-(u 1)) := rfl + rw [e, mem_modelBase_pt] + simpa using h + +/-- Points above the graph of the height lie in the base. -/ +theorem pt_above_base {n : ℕ} {x y : ℝ} (h : hgt n x ≤ y) : + ((pt x y : EuclideanPlane) : OnePoint EuclideanPlane) ∈ modelBase n := by + rw [mem_modelBase_pt] + intro i hi + have h1 := hgt_ge n x hi + have h2 := hgt_nonneg n x + by_contra hcon + push Not at hcon + have h3 : 0 < 1 - (x - 3 * i) ^ 2 := by nlinarith [sq_nonneg y] + have h4 := Real.sq_sqrt h3.le + nlinarith [Real.sqrt_nonneg (1 - (x - 3 * i) ^ 2)] + +theorem upE_base {n : ℕ} {z : ℂ} (hz : ‖z‖ ≤ 1) : upE n z ∈ modelBase n := by + by_cases h : z = 1 + · subst h + rw [upE_one] + exact fun i _ u he => absurd he (OnePoint.infty_ne_coe _) + · rw [upE_ne h] + exact pt_above_base (upE_above hz h) + +/-- Points in the base above the axis lie above the graph of the height. -/ +theorem hgt_le_of_base {n : ℕ} {x y : ℝ} (h : ((pt x y : EuclideanPlane) : OnePoint EuclideanPlane) + ∈ modelBase n) + (hy : 0 ≤ y) : hgt n x ≤ y := by + rw [mem_modelBase_pt] at h + by_cases hc : ∃ i < n, |x - 3 * i| ≤ 1 + · obtain ⟨i, hi, h1⟩ := hc + rw [hgt_eq hi h1] + refine Real.sqrt_le_iff.mpr ⟨hy, ?_⟩ + have := h i hi + linarith + · push Not at hc + rw [hgt_eq_zero fun i hi => (hc i hi).le] + exact hy + +section poly + +variable {n : ℕ} {Φ Φ' : ℂ → ℂ} + +/-- The map of the two discs to the sphere with holes. -/ +noncomputable def Fv (n : ℕ) (Φ : ℂ → ℂ) (a : ℕ × ℂ) : OnePoint EuclideanPlane := + if a.1 = 0 then upE n (Φ a.2) else mirO (upE n (Φ a.2)) + +theorem Fv_zero (z : ℂ) : Fv n Φ (0, z) = upE n (Φ z) := by simp [Fv] + +theorem Fv_one (z : ℂ) : Fv n Φ (1, z) = mirO (upE n (Φ z)) := by simp [Fv] + +theorem Fv_base (hm : BdMatch (closedBall 0 1) (closedBall 0 1) Φ Φ') {a : ℕ × ℂ} (ha : ‖a.2‖ ≤ 1) : + Fv n Φ a ∈ modelBase n := by + have h1 : Φ a.2 ∈ closedBall (0 : ℂ) 1 := hm.1 (mem_closedBall_zero_iff.mpr ha) + have h2 : ‖Φ a.2‖ ≤ 1 := mem_closedBall_zero_iff.mp h1 + unfold Fv + split_ifs + · exact upE_base h2 + · exact mirO_base (upE_base h2) + +theorem continuousOn_Fv (hm : BdMatch (closedBall 0 1) (closedBall 0 1) Φ Φ') {W : ℕ + → List Letter} : + ContinuousOn (Fv n Φ) (Dsk W) := by + rw [continuousOn_prod_of_discrete_left] + intro s + have hmp : MapsTo Φ {z | (s, z) ∈ Dsk W} (closedBall 0 1) := fun z hz => + hm.1 (mem_closedBall_zero_iff.mpr hz.2) + have hc : ContinuousOn Φ {z | (s, z) ∈ Dsk W} := + hm.2.2.2.2.1.mono fun z hz => mem_closedBall_zero_iff.mpr hz.2 + have h1 := (continuousOn_upE n).comp hc hmp + by_cases hs : s = 0 + · subst hs + simpa [Fv, Function.comp_def] using h1 + · have := mirO.continuous.comp_continuousOn h1 + simpa [Fv, hs, Function.comp_def] using this + +theorem hole_AA {a k k' : ℕ} (h : (holeA a k).1 = (holeA a k').1) : k = k' := by + simp only [holeA] at h + split_ifs at h <;> simp at h <;> omega + +theorem hole_BB {a b k k' : ℕ} (h : (holeB a b k).1 = (holeB a b k').1) : k = k' := by + simp only [holeB] at h + split_ifs at h <;> simp at h <;> omega + +theorem hole_AB {a b k k' : ℕ} (h : (holeA a k).1 = (holeB a b k').1) : + (k % 2 = 0 ∧ k + 1 < 2 * a ∧ k' = k + 1) ∨ (k % 2 = 1 ∧ k < 2 * a ∧ k' + 1 = k) ∨ + (2 * a ≤ k ∧ k < 2 * a + b ∧ k' = k) := by + simp only [holeA, holeB] at h + split_ifs at h <;> simp at h <;> omega + +theorem holeA_sign (a k : ℕ) : (holeA a k).2 = true := by + simp only [holeA] + split_ifs <;> rfl + +theorem holeB_sign {a b k : ℕ} (h : ¬ (2 * a ≤ k ∧ k < 2 * a + b)) : (holeB a b k).2 = true := by + simp only [holeB] + split_ifs <;> first | rfl | omega + +theorem holeB_sign' {a b k : ℕ} (h : 2 * a ≤ k ∧ k < 2 * a + b) : (holeB a b k).2 = false := by + simp only [holeB] + rw [ite_eq_right (by omega), ite_eq_left h.2] + +theorem hole_ne_seg_A {a k j : ℕ} : (holeA a k).1 ≠ (segL j).1 := by + simp only [holeA, segL] + split_ifs <;> simp <;> omega + +theorem hole_ne_seg_B {a b k j : ℕ} : (holeB a b k).1 ≠ (segL j).1 := by + simp only [holeB, segL] + split_ifs <;> simp <;> omega + +theorem hole_ne_z_A {a k : ℕ} : (holeA a k).1 ≠ zL.1 := by + simp only [holeA, zL] + split_ifs <;> simp; omega + +theorem hole_ne_z_B {a b k : ℕ} : (holeB a b k).1 ≠ zL.1 := by + simp only [holeB, zL] + split_ifs <;> simp <;> omega + +theorem seg_ne_z {j : ℕ} : (segL j).1 ≠ zL.1 := by + simp only [segL, zL] + omega + +theorem modelMirror_add (i : ℕ) (u : EuclideanPlane) : + modelMirror (modelCentre i + u) = modelCentre i + modelMirror u := by + ext j + fin_cases j <;> simp [modelMirror, modelCentre_eq] + +variable {a b : ℕ} + +/-- The hypotheses on the polygon map. -/ +def IsPoly (n : ℕ) (Φ Φ' : ℂ → ℂ) : Prop := + BdMatch (closedBall 0 1) (closedBall 0 1) Φ Φ' ∧ + ∀ x ∈ Icc (0 : ℝ) (2 * n + 2 : ℕ), Φ (per (2 * n + 2) x) = cis' (angL n x) + +theorem sdPt_false (m p : ℕ) (t : ℝ) : sdPt m p false t = per m (p + (1 - t)) := by simp [sdPt] + +theorem side_mem {n k : ℕ} (hk : k < n) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : + (2 * (k : ℝ) + 1 + t) ∈ Icc (0 : ℝ) (2 * n + 2 : ℕ) := by + have : (k : ℝ) + 1 ≤ n := by exact_mod_cast hk + have : (0 : ℝ) ≤ k := Nat.cast_nonneg k + push_cast + exact ⟨by linarith [ht.1], by linarith [ht.2]⟩ + +/-- The value on the circle `k` of the upper disc. -/ +theorem Fv_hole0 (hΦ : IsPoly n Φ Φ') {k : ℕ} (hk : k < n) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : + Fv n Φ (0, per (2 * n + 2) (2 * k + 1 + t)) = + ((modelCentre k + pt (axPhi t) (axPsi t) : EuclideanPlane) : OnePoint EuclideanPlane) := by + rw [Fv_zero, hΦ.2 _ (side_mem hk ht), upE_hole hk ht] + +/-- The value on the circle `k` of the lower disc. -/ +theorem Fv_hole1 (hΦ : IsPoly n Φ Φ') {k : ℕ} (hk : k < n) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : + Fv n Φ (1, per (2 * n + 2) (2 * k + 1 + t)) = + ((modelCentre k + modelMirror (pt (axPhi t) (axPsi t)) : EuclideanPlane) : OnePoint + EuclideanPlane) := by + rw [Fv_one, hΦ.2 _ (side_mem hk ht), upE_hole hk ht, mirO_coe, modelMirror_add] + +/-- The sides on the axis have equal values in both discs. -/ +theorem Fv_ax (hΦ : IsPoly n Φ Φ') {y : ℝ} (hy : y ∈ Icc (0 : ℝ) (2 * n + 2 : ℕ)) + (h : IsAx n (upE n (cis' (angL n y)))) : + Fv n Φ (0, per (2 * n + 2) y) = Fv n Φ (1, per (2 * n + 2) y) := by + rw [Fv_zero, Fv_one, hΦ.2 _ hy, h.mirO] + +theorem isAx_pos {n : ℕ} {p : ℕ} {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) + (h : (∃ k, k ≤ n ∧ p = 2 * k) ∨ p = 2 * n + 1) : + ((p : ℝ) + t) ∈ Icc (0 : ℝ) (2 * n + 2 : ℕ) ∧ IsAx n (upE n (cis' (angL n (p + t)))) := by + have hmem : ((p : ℝ) + t) ∈ Icc (0 : ℝ) (2 * n + 2 : ℕ) := by + have h1 : (p : ℝ) + 1 ≤ 2 * n + 2 := by + have : p + 1 ≤ 2 * n + 2 := by omega + exact_mod_cast this + have h0 : (0 : ℝ) ≤ p := Nat.cast_nonneg p + push_cast + exact ⟨by linarith [ht.1], by linarith [ht.2]⟩ + refine ⟨hmem, ?_⟩ + rcases h with ⟨k, hk, rfl⟩ | rfl + · rcases Nat.lt_or_ge k n with h | h + · have := isAx_seg h ht + simpa using this + · obtain rfl : k = n := by omega + refine isAx_top ?_ hmem.2 + push_cast + linarith [ht.1] + · refine isAx_top ?_ hmem.2 + push_cast + linarith [ht.1] + +section glue + +variable (a b) + +/-- Two points of the sphere with holes that are glued in the model. -/ +def Gl (n : ℕ) (x y : OnePoint EuclideanPlane) : Prop := + ∀ p q : modelBase n, p.1 = x → q.1 = y → Relation.EqvGen (ModelGlue a b n) p q + +variable {a b} + +theorem Gl.of_eq {n : ℕ} {x y : OnePoint EuclideanPlane} (h : x = y) : Gl a b n x y + := fun p q hp hq => by + have : p = q := Subtype.ext (by rw [hp, hq, h]) + rw [this] + exact .refl _ + +theorem Gl.symm {n : ℕ} {x y : OnePoint EuclideanPlane} (h : Gl a b n x y) : Gl a b n y x + := fun p q hp hq => + (h q p hq hp).symm + +theorem norm_axU {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : ‖pt (axPhi t) (axPsi t)‖ = 1 := by + have h := norm_pt_sq (axPhi t) (axPsi t) + rw [axPsi_sq ht] at h + have h2 : ‖pt (axPhi t) (axPsi t)‖ ^ 2 = 1 := by rw [h]; ring + have := norm_nonneg (pt (axPhi t) (axPsi t)) + nlinarith + +theorem norm_mirror (u : EuclideanPlane) : ‖modelMirror u‖ = ‖u‖ := by + have h1 := norm_pt_sq (u 0) (u 1) + have h2 := norm_pt_sq (u 0) (-(u 1)) + rw [pt_ext] at h1 + have e : pt (u 0) (-(u 1)) = modelMirror u := rfl + rw [e] at h2 + have h3 : ‖modelMirror u‖ ^ 2 = ‖u‖ ^ 2 := by rw [h1, h2]; ring + exact (pow_left_inj₀ (norm_nonneg _) (norm_nonneg _) two_ne_zero).mp h3 + +/-- The glued pairs of a handle. -/ +theorem gl_handle {n : ℕ} {h : ℕ} (hh : h < a) {u : EuclideanPlane} (hu : ‖u‖ = 1) : + Gl a b n ((modelCentre (2 * h) + u : EuclideanPlane) : OnePoint EuclideanPlane) + ((modelCentre (2 * h + 1) + modelMirror u : EuclideanPlane) : OnePoint EuclideanPlane) := + fun p q hp hq => .rel _ _ (.handle h hh u hu p q hp hq) + +/-- The glued pairs of a cross-cap. -/ +theorem gl_cap {n : ℕ} {i : ℕ} (hi : i < b) {u : EuclideanPlane} (hu : ‖u‖ = 1) : + Gl a b n ((modelCentre (2 * a + i) + u : EuclideanPlane) : OnePoint EuclideanPlane) + ((modelCentre (2 * a + i) - u : EuclideanPlane) : OnePoint EuclideanPlane) := + fun p q hp hq => .rel _ _ (.crosscap i hi u hu p q hp hq) + +theorem axU_neg (t : ℝ) : pt (axPhi (1 - t)) (axPsi (1 - t)) = - modelMirror (pt (axPhi t) + (axPsi t)) := by + rw [axPhi_neg, axPsi_neg] + ext j + fin_cases j <;> simp [modelMirror] + +/-- Sides of the two discs on circles with the same label are glued. -/ +theorem gl_holes (hΦ : IsPoly n Φ Φ') {k k' : ℕ} (hk : k < n) (hk' : k' < n) + (hl : (holeA a k).1 = (holeB a b k').1) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) {ε' : Bool} + (hs : ε' = (holeB a b k').2) : + Gl a b n (Fv n Φ (0, sdPt (2 * n + 2) (2 * k + 1) true t)) + (Fv n Φ (1, sdPt (2 * n + 2) (2 * k' + 1) ε' t)) := by + have e0 : sdPt (2 * n + 2) (2 * k + 1) true t = per (2 * n + 2) (2 * k + 1 + t) := by + rw [sdPt_true] + push_cast + rfl + rw [e0] + rcases hole_AB hl with ⟨h1, h2, rfl⟩ | ⟨h1, h2, rfl⟩ | ⟨h1, h2, rfl⟩ + · rw [holeB_sign (by omega)] at hs + subst hs + have e1 : sdPt (2 * n + 2) (2 * (k + 1) + 1) true t = per (2 * n + 2) (2 * (k + 1 : ℕ) + 1 + t) + := by + rw [sdPt_true] + push_cast + rfl + rw [e1, Fv_hole0 hΦ hk ht, Fv_hole1 hΦ hk' ht] + obtain ⟨h, rfl⟩ : ∃ h, k = 2 * h := ⟨k / 2, by omega⟩ + exact gl_handle (by omega) (norm_axU ht) + · rw [holeB_sign (by omega)] at hs + subst hs + have e1 : sdPt (2 * n + 2) (2 * k' + 1) true t = per (2 * n + 2) (2 * k' + 1 + t) := by + rw [sdPt_true] + push_cast + rfl + rw [e1, Fv_hole0 hΦ hk ht, Fv_hole1 hΦ hk' ht] + obtain ⟨h, rfl⟩ : ∃ h, k' = 2 * h := ⟨k' / 2, by omega⟩ + have := gl_handle (a := a) (b := b) (n := n) (h := h) (by omega) (u := modelMirror (pt + (axPhi t) (axPsi t))) + (by rw [norm_mirror]; exact norm_axU ht) + rw [modelMirror_mirror] at this + exact this.symm + · rw [holeB_sign' ⟨h1, h2⟩] at hs + subst hs + have ht' : 1 - t ∈ Icc (0 : ℝ) 1 := ⟨by linarith [ht.2], by linarith [ht.1]⟩ + have e1 : sdPt (2 * n + 2) (2 * k' + 1) false t = per (2 * n + 2) (2 * k' + 1 + (1 - t)) := by + rw [sdPt_false] + push_cast + rfl + rw [e1, Fv_hole0 hΦ hk' ht, Fv_hole1 hΦ hk' ht', axU_neg, ] + obtain ⟨i, rfl⟩ : ∃ i, k' = 2 * a + i := ⟨k' - 2 * a, by omega⟩ + have := gl_cap (a := a) (b := b) (n := n) (i := i) (by omega) (norm_axU ht) + have e2 : modelMirror (-modelMirror (pt (axPhi t) (axPsi t))) = - pt (axPhi t) (axPsi t) := by + ext j + fin_cases j <;> simp [modelMirror] + rw [e2, ← sub_eq_add_neg] + exact this + +end glue + +theorem sdPt_hole (n k : ℕ) (t : ℝ) : + sdPt (2 * n + 2) (2 * k + 1) true t = per (2 * n + 2) (2 * k + 1 + t) := by + rw [sdPt_true] + push_cast + rfl + +theorem sdPt_hole' (n k : ℕ) (t : ℝ) : + sdPt (2 * n + 2) (2 * k + 1) false t = per (2 * n + 2) (2 * k + 1 + (1 - t)) := by + rw [sdPt_false] + push_cast + rfl + +/-- Points on sides with the same label in the two discs are one step apart. -/ +theorem stp_holes {n k k' : ℕ} (hk : k < n) (hk' : k' < n) (hl : (holeA a k).1 = + (holeB a b k').1) {t : ℝ} + (ht : t ∈ Icc (0 : ℝ) 1) : + Stp (modelW a b n) (0, sdPt (2 * n + 2) (2 * k + 1) true t) + (1, sdPt (2 * n + 2) (2 * k' + 1) (holeB a b k').2 t) := by + refine ⟨0, 1, 2 * k + 1, 2 * k' + 1, (holeA a k).1, true, (holeB a b k').2, t, ?_, ?_, by simp, + ht, ?_, ?_⟩ + · rw [modelW_holeA hk] + exact congrArg some (Prod.ext rfl (holeA_sign a k)) + · rw [modelW_holeB hk', hl] + · rw [modelW_len (by omega)] + · rw [modelW_len (by omega)] + +/-- Points with the same parameter on a side on the axis are one step apart. -/ +theorem stp_ax {n p : ℕ} (h : (∃ k, k ≤ n ∧ p = 2 * k) ∨ p = 2 * n + 1) {t : ℝ} (ht : t ∈ Icc + (0 : ℝ) 1) : + Stp (modelW a b n) (0, per (2 * n + 2) (p + t)) (1, per (2 * n + 2) (p + t)) := by + have hl : ∃ m, ∀ i ≤ 1, (modelW a b n i)[p]? = some (m, true) := by + rcases h with ⟨k, hk, rfl⟩ | rfl + · exact ⟨_, fun i hi => modelW_seg hi hk⟩ + · exact ⟨_, fun i hi => modelW_top hi⟩ + obtain ⟨m, hm⟩ := hl + refine ⟨0, 1, p, p, m, true, true, t, hm 0 (by omega), hm 1 le_rfl, by simp, ht, ?_, ?_⟩ + · rw [modelW_len (by omega), sdPt_true] + · rw [modelW_len (by omega), sdPt_true] + +theorem Fv_ax_eq (hΦ : IsPoly n Φ Φ') {p : ℕ} (h : (∃ k, k ≤ n ∧ p = 2 * k) ∨ p = 2 * n + 1) {t : ℝ} + (ht : t ∈ Icc (0 : ℝ) 1) {i j : ℕ} (hi : i ≤ 1) (hj : j ≤ 1) : + Fv n Φ (i, sdPt (2 * n + 2) p true t) = Fv n Φ (j, sdPt (2 * n + 2) p true t) := by + obtain ⟨h1, h2⟩ := isAx_pos ht h + have e := Fv_ax hΦ h1 h2 + rw [sdPt_true] + obtain rfl | rfl : i = 0 ∨ i = 1 := by omega + · obtain rfl | rfl : j = 0 ∨ j = 1 := by omega + · rfl + · exact e + · obtain rfl | rfl : j = 0 ∨ j = 1 := by omega + · exact e.symm + · rfl + +theorem fst_of {m : ℕ} {ε : Bool} {l : Letter} (h : ((m, ε) : Letter) = l) : m = l.1 + := congrArg Prod.fst h + +theorem snd_of {m : ℕ} {ε : Bool} {l : Letter} (h : ((m, ε) : Letter) = l) : ε = l.2 + := congrArg Prod.snd h + +/-- Steps go to points that are glued. -/ +theorem Fv_stp (hΦ : IsPoly n Φ Φ') {x y : ℕ × ℂ} (h : Stp (modelW a b n) x y) : + Gl a b n (Fv n Φ x) (Fv n Φ y) := by + obtain ⟨i, j, p, q, l, ε, ε', t, h1, h2, hne, ht, rfl, rfl⟩ := h + have hi : i ≤ 1 := modelW_slot fun he => by rw [he] at h1; exact absurd h1 (by simp) + have hj : j ≤ 1 := modelW_slot fun he => by rw [he] at h2; exact absurd h2 (by simp) + rw [modelW_len hi, modelW_len hj] + rcases modelW_cases hi h1 with ⟨k, hk, rfl, hl⟩ | ⟨rfl, hl⟩ | ⟨k, hk, rfl, hl⟩ <;> + rcases modelW_cases hj h2 with ⟨k', hk', rfl, hl'⟩ | ⟨rfl, hl'⟩ | ⟨k', hk', rfl, hl'⟩ + · have e : k = k' := by + have := (fst_of hl).symm.trans (fst_of hl') + simpa [segL] using this + subst e + obtain rfl : ε = true := snd_of hl + obtain rfl : ε' = true := snd_of hl' + exact Gl.of_eq (Fv_ax_eq hΦ (.inl ⟨k, hk, rfl⟩) ht hi hj) + · exact absurd ((fst_of hl).symm.trans (fst_of hl')) seg_ne_z + · exfalso + have e0 := fst_of hl + rcases hl' with ⟨-, hl'⟩ | ⟨-, hl'⟩ + · exact hole_ne_seg_A ((fst_of hl').symm.trans e0) + · exact hole_ne_seg_B ((fst_of hl').symm.trans e0) + · exact absurd ((fst_of hl').symm.trans (fst_of hl)) seg_ne_z + · obtain rfl : ε = true := snd_of hl + obtain rfl : ε' = true := snd_of hl' + exact Gl.of_eq (Fv_ax_eq hΦ (.inr rfl) ht hi hj) + · exfalso + have e0 := fst_of hl + rcases hl' with ⟨-, hl'⟩ | ⟨-, hl'⟩ + · exact hole_ne_z_A ((fst_of hl').symm.trans e0) + · exact hole_ne_z_B ((fst_of hl').symm.trans e0) + · exfalso + have e0 := fst_of hl' + rcases hl with ⟨-, hl⟩ | ⟨-, hl⟩ + · exact hole_ne_seg_A ((fst_of hl).symm.trans e0) + · exact hole_ne_seg_B ((fst_of hl).symm.trans e0) + · exfalso + have e0 := fst_of hl' + rcases hl with ⟨-, hl⟩ | ⟨-, hl⟩ + · exact hole_ne_z_A ((fst_of hl).symm.trans e0) + · exact hole_ne_z_B ((fst_of hl).symm.trans e0) + · rcases hl with ⟨rfl, hl⟩ | ⟨rfl, hl⟩ <;> rcases hl' with ⟨rfl, hl'⟩ | ⟨rfl, hl'⟩ + · obtain rfl : k = k' := hole_AA ((fst_of hl).symm.trans (fst_of hl')) + exact absurd rfl hne + · obtain rfl : ε = true := (snd_of hl).trans (holeA_sign a k) + exact gl_holes hΦ hk hk' ((fst_of hl).symm.trans (fst_of hl')) ht + (snd_of hl') + · obtain rfl : ε' = true := (snd_of hl').trans (holeA_sign a k') + exact (gl_holes hΦ hk' hk ((fst_of hl').symm.trans (fst_of hl)) ht + (snd_of hl)).symm + · obtain rfl : k = k' := hole_BB ((fst_of hl).symm.trans (fst_of hl')) + exact absurd rfl hne + +theorem isPoly_inj (hΦ : IsPoly n Φ Φ') {z z' : ℂ} (hz : ‖z‖ ≤ 1) (hz' : ‖z'‖ ≤ 1) (h : Φ z + = Φ z') : z = z' := by + have h1 := hΦ.1.2.2.1 (mem_closedBall_zero_iff.mpr hz) + have h2 := hΦ.1.2.2.1 (mem_closedBall_zero_iff.mpr hz') + rw [← h1, ← h2, h] + +theorem isPoly_mem (hΦ : IsPoly n Φ Φ') {z : ℂ} (hz : ‖z‖ ≤ 1) : ‖Φ z‖ ≤ 1 := + mem_closedBall_zero_iff.mp (hΦ.1.1 (mem_closedBall_zero_iff.mpr hz)) + +theorem isPoly_right (hΦ : IsPoly n Φ Φ') {w : ℂ} (hw : ‖w‖ ≤ 1) : ∃ z, ‖z‖ ≤ 1 ∧ Φ z = w := + ⟨Φ' w, mem_closedBall_zero_iff.mp (hΦ.1.2.1 (mem_closedBall_zero_iff.mpr hw)), + hΦ.1.2.2.2.1 (mem_closedBall_zero_iff.mpr hw)⟩ + +/-- A point with the same image under `upE` and its mirror lies on the circle, and its image lies on +the axis. -/ +theorem upE_mirror {w w' : ℂ} (hw : ‖w‖ ≤ 1) (hw' : ‖w'‖ ≤ 1) (h : upE n w = mirO (upE n w')) : + w = w' ∧ ‖w‖ = 1 ∧ (w = 1 ∨ hgt n (cay w).re = 0) := by + by_cases h1 : w = 1 + · subst h1 + rw [upE_one] at h + by_cases h2 : w' = 1 + · exact ⟨h2.symm, by simp, .inl rfl⟩ + · rw [upE_ne h2, mirO_coe] at h + exact absurd h (OnePoint.infty_ne_coe _) + · by_cases h2 : w' = 1 + · subst h2 + rw [upE_one, mirO_infty, upE_ne h1] at h + exact absurd h (OnePoint.coe_ne_infty _) + · rw [upE_ne h1, upE_ne h2, mirO_coe, modelMirror_pt] at h + have e := OnePoint.coe_injective h + have e1 := congrFun (congrArg (fun u : EuclideanPlane => (u : Fin 2 → ℝ)) e) 0 + have e2 := congrFun (congrArg (fun u : EuclideanPlane => (u : Fin 2 → ℝ)) e) 1 + simp only [pt_zero, pt_one] at e1 e2 + have i1 := cay_im_nonneg h1 hw + have i2 := cay_im_nonneg h2 hw' + have g1 := hgt_nonneg n (cay w).re + have g2 := hgt_nonneg n (cay w').re + rw [← e1] at e2 g2 + have i3 : (cay w).im = 0 := by linarith + have i4 : (cay w').im = 0 := by linarith + have g3 : hgt n (cay w).re = 0 := by linarith + have e3 : cay w = cay w' := Complex.ext e1 (by rw [i3, i4]) + refine ⟨by rw [← cayI_cay h1, ← cayI_cay h2, e3], ?_, .inr g3⟩ + have := (norm_cayI_eq_iff (cay_add_I_ne h1)).mpr i3 + rwa [cayI_cay h1] at this + +theorem Fv_fiber_cross (hΦ : IsPoly n Φ Φ') {z z' : ℂ} (hz : ‖z‖ ≤ 1) (hz' : ‖z'‖ ≤ 1) + (h : Fv n Φ (0, z) = Fv n Φ (1, z')) : PRel (modelW a b n) (0, z) (1, z') := by + rw [Fv_zero, Fv_one] at h + obtain ⟨e, h1, h2⟩ := upE_mirror (isPoly_mem hΦ hz) (isPoly_mem hΦ hz') h + obtain rfl := isPoly_inj hΦ hz hz' e + obtain ⟨y, hy, hyw⟩ := exists_loop_param n h1 + have hzy : z = per (2 * n + 2) y := by + have hpb : ‖per (2 * n + 2) y‖ ≤ 1 := (norm_per _ _).le + refine isPoly_inj hΦ hz hpb ?_ + have := hΦ.2 y hy + rw [hyw] at this + exact this.symm + have hpos : (2 * (n : ℝ) ≤ y) ∨ hgt n (axS y) = 0 := by + by_cases hc : 2 * (n : ℝ) ≤ y + · exact .inl hc + right + have hle : y ≤ 2 * n := (not_le.mp hc).le + rw [angL_le hle] at hyw + obtain ⟨e1, e2⟩ := cay_cis (axS y) + rw [hyw] at e1 e2 + rcases h2 with h2 | h2 + · exact absurd h2 e1 + · rw [e2] at h2 + simpa using h2 + have key : ∃ p : ℕ, ∃ t ∈ Icc (0 : ℝ) 1, y = p + t ∧ ((∃ k, k ≤ n ∧ p = 2 * k) ∨ p = 2 * n + 1) + := by + rcases exists_side_of_ax hy (hpos.symm) with ⟨k, t, hk, ht, e⟩ | h3 + · exact ⟨2 * k, t, ht, by rw [e]; push_cast; ring, .inl ⟨k, hk.le, rfl⟩⟩ + · by_cases h4 : y ≤ 2 * n + 1 + · exact ⟨2 * n, y - 2 * n, ⟨by linarith, by linarith⟩, by push_cast; ring, .inl ⟨n, le_rfl, + rfl⟩⟩ + · have h5 := hy.2 + push_cast at h5 + push Not at h4 + exact ⟨2 * n + 1, y - (2 * n + 1), ⟨by linarith, by linarith⟩, by push_cast; ring, .inr rfl⟩ + obtain ⟨p, t, ht, rfl, hp⟩ := key + rw [hzy] + exact .rel _ _ (stp_ax hp ht) + +theorem Fv_fiber (hΦ : IsPoly n Φ Φ') {x y : ℕ × ℂ} (hx : x ∈ Dsk (modelW a b n)) (hy : y ∈ Dsk + (modelW a b n)) + (h : Fv n Φ x = Fv n Φ y) : PRel (modelW a b n) x y := by + obtain ⟨i, z⟩ := x + obtain ⟨j, z'⟩ := y + have hi : i ≤ 1 := modelW_slot hx.1 + have hj : j ≤ 1 := modelW_slot hy.1 + obtain rfl | rfl : i = 0 ∨ i = 1 := by omega + · obtain rfl | rfl : j = 0 ∨ j = 1 := by omega + · rw [Fv_zero, Fv_zero] at h + have e1 := injOn_upE n (mem_closedBall_zero_iff.mpr (isPoly_mem hΦ hx.2)) + (mem_closedBall_zero_iff.mpr (isPoly_mem hΦ hy.2)) h + have e2 : z = z' := isPoly_inj hΦ hx.2 hy.2 e1 + rw [e2] + exact .refl _ + · exact Fv_fiber_cross hΦ hx.2 hy.2 h + · obtain rfl | rfl : j = 0 ∨ j = 1 := by omega + · exact (Fv_fiber_cross hΦ hy.2 hx.2 h.symm).symm + · rw [Fv_one, Fv_one] at h + have e1 := injOn_upE n (mem_closedBall_zero_iff.mpr (isPoly_mem hΦ hx.2)) + (mem_closedBall_zero_iff.mpr (isPoly_mem hΦ hy.2)) (mirO.injective h) + have e2 : z = z' := isPoly_inj hΦ hx.2 hy.2 e1 + rw [e2] + exact .refl _ + +theorem modelW_zero_ne : modelW a b n 0 ≠ [] := by simp [modelW_zero] + +theorem modelW_one_ne : modelW a b n 1 ≠ [] := by simp [modelW_one] + +theorem Fv_surj (hΦ : IsPoly n Φ Φ') {p : OnePoint EuclideanPlane} (hp : p ∈ modelBase n) : + ∃ x ∈ Dsk (modelW a b n), Fv n Φ x = p := by + have up : ∀ q : OnePoint EuclideanPlane, (∃ z ∈ closedBall (0 : ℂ) 1, upE n z = q) → + ∃ z, ‖z‖ ≤ 1 ∧ upE n (Φ z) = q := fun q ⟨w, hw, he⟩ => by + obtain ⟨z, hz, e⟩ := isPoly_right hΦ (mem_closedBall_zero_iff.mp hw) + exact ⟨z, hz, by rw [e, he]⟩ + induction p using OnePoint.rec with + | infty => + obtain ⟨z, hz, e⟩ := up ∞ ⟨1, by simp, upE_one n⟩ + exact ⟨(0, z), ⟨modelW_zero_ne, hz⟩, by rw [Fv_zero, e]⟩ + | coe u => + rw [← pt_ext u] at hp ⊢ + rcases le_total 0 (u 1) with h | h + · obtain ⟨z, hz, e⟩ := up _ (exists_upE (hgt_le_of_base hp h)) + exact ⟨(0, z), ⟨modelW_zero_ne, hz⟩, by rw [Fv_zero, e]⟩ + · have h1 := mirO_base hp + rw [mirO_coe, modelMirror_pt] at h1 + obtain ⟨z, hz, e⟩ := up _ (exists_upE (hgt_le_of_base h1 (by linarith))) + refine ⟨(1, z), ⟨modelW_one_ne, hz⟩, ?_⟩ + rw [Fv_one, e, mirO_coe, modelMirror_pt] + simp + +theorem exists_axU {u : EuclideanPlane} (hu : ‖u‖ = 1) (h : 0 ≤ u 1) : + ∃ t ∈ Icc (0 : ℝ) 1, u = pt (axPhi t) (axPsi t) := by + have hn := norm_pt_sq (u 0) (u 1) + rw [pt_ext, hu] at hn + have h1 : -1 ≤ u 0 := by nlinarith [sq_nonneg (u 1)] + have h2 : u 0 ≤ 1 := by nlinarith [sq_nonneg (u 1)] + have hiv := intermediate_value_Icc (a := 0) (b := 1) (by norm_num) continuous_axPhi.continuousOn + rw [axPhi_zero, axPhi_one] at hiv + obtain ⟨t, ht, e⟩ := hiv ⟨h1, h2⟩ + refine ⟨t, ht, ?_⟩ + rw [← pt_ext u] + have e2 : axPsi t = u 1 := by + unfold axPsi + rw [e, show 1 - u 0 ^ 2 = u 1 ^ 2 by linarith, Real.sqrt_sq h] + simp only [Fin.isValue] + rw [e, e2] + +/-- The two sides of a glued pair. -/ +def HolePair (n : ℕ) (a b : ℕ) (Φ : ℂ → ℂ) (P Q : OnePoint EuclideanPlane) : Prop := + ∃ k k' t, k < n ∧ k' < n ∧ (holeA a k).1 = (holeB a b k').1 ∧ t ∈ Icc (0 : ℝ) 1 ∧ + P = Fv n Φ (0, sdPt (2 * n + 2) (2 * k + 1) true t) ∧ + Q = Fv n Φ (1, sdPt (2 * n + 2) (2 * k' + 1) (holeB a b k').2 t) + +theorem Fv_up (hΦ : IsPoly n Φ Φ') {k : ℕ} (hk : k < n) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : + Fv n Φ (0, sdPt (2 * n + 2) (2 * k + 1) true t) = + ((modelCentre k + pt (axPhi t) (axPsi t) : EuclideanPlane) : OnePoint EuclideanPlane) := by + rw [sdPt_hole] + exact_mod_cast Fv_hole0 hΦ hk ht + +theorem Fv_down (hΦ : IsPoly n Φ Φ') {k : ℕ} (hk : k < n) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : + Fv n Φ (1, sdPt (2 * n + 2) (2 * k + 1) true t) = + ((modelCentre k + modelMirror (pt (axPhi t) (axPsi t)) : EuclideanPlane) : OnePoint + EuclideanPlane) := by + rw [sdPt_hole] + exact_mod_cast Fv_hole1 hΦ hk ht + +theorem Fv_anti (hΦ : IsPoly n Φ Φ') {k : ℕ} (hk : k < n) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : + Fv n Φ (1, sdPt (2 * n + 2) (2 * k + 1) false t) = + ((modelCentre k - pt (axPhi t) (axPsi t) : EuclideanPlane) : OnePoint EuclideanPlane) := by + have ht' : 1 - t ∈ Icc (0 : ℝ) 1 := ⟨by linarith [ht.2], by linarith [ht.1]⟩ + rw [sdPt_hole'] + have := Fv_hole1 hΦ hk ht' + rw [show (2 * (k : ℝ) + 1 + (1 - t)) = 2 * k + 1 + (1 - t) from rfl, axU_neg] at this + have e2 : modelMirror (-modelMirror (pt (axPhi t) (axPsi t))) = - pt (axPhi t) (axPsi t) := by + ext j + fin_cases j <;> simp [modelMirror] + rw [e2, ← sub_eq_add_neg] at this + exact_mod_cast this + +theorem holePair_of_glue (hΦ : IsPoly n Φ Φ') (hn : 2 * a + b ≤ n) {p q : modelBase n} + (h : ModelGlue a b n p q) : HolePair n a b Φ p.1 q.1 ∨ HolePair n a b Φ q.1 p.1 := by + cases h with + | handle i hi u hu p q hp hq => + have k0 : 2 * i < n := by omega + have k1 : 2 * i + 1 < n := by omega + have lA0 : holeA a (2 * i) = (4 * (2 * i) + 1, true) := by simp [holeA] + have lA1 : holeA a (2 * i + 1) = (4 * (2 * i) + 2, true) := by + simp only [holeA] + rw [ite_eq_left (by omega)] + simp + have lB0 : holeB a b (2 * i) = (4 * (2 * i) + 2, true) := by + simp only [holeB] + rw [ite_eq_left (by omega), ite_eq_left (by omega)] + have lB1 : holeB a b (2 * i + 1) = (4 * (2 * i) + 1, true) := by + simp only [holeB] + rw [ite_eq_left (by omega), ite_eq_right (by omega)] + simp + rcases le_total 0 (u 1) with h | h + · obtain ⟨t, ht, rfl⟩ := exists_axU hu h + refine .inl ⟨2 * i, 2 * i + 1, t, k0, k1, by rw [lA0, lB1], ht, ?_, ?_⟩ + · rw [Fv_up hΦ k0 ht, hp] + · rw [lB1, Fv_down hΦ k1 ht, hq] + · have hm : 0 ≤ (modelMirror u) 1 := by + have : (modelMirror u) 1 = - u 1 := rfl + rw [this] + linarith + obtain ⟨t, ht, e⟩ := exists_axU (u := modelMirror u) (by rw [norm_mirror, hu]) hm + refine .inr ⟨2 * i + 1, 2 * i, t, k1, k0, by rw [lA1, lB0], ht, ?_, ?_⟩ + · rw [Fv_up hΦ k1 ht, hq, e] + · rw [lB0, Fv_down hΦ k0 ht, hp, ← e, modelMirror_mirror] + | crosscap i hi u hu p q hp hq => + set k := 2 * a + i with hk + have k0 : k < n := by omega + have lA : (holeA a k) = (4 * k + 1, true) := by + simp only [holeA] + rw [ite_eq_right (by omega)] + have lB : (holeB a b k) = (4 * k + 1, false) := by + simp only [holeB] + rw [ite_eq_right (by omega), ite_eq_left (by omega)] + rcases le_total 0 (u 1) with h | h + · obtain ⟨t, ht, rfl⟩ := exists_axU hu h + refine .inl ⟨k, k, t, k0, k0, by rw [lA, lB], ht, ?_, ?_⟩ + · rw [Fv_up hΦ k0 ht, hp] + · rw [lB, Fv_anti hΦ k0 ht, hq] + · have hm : 0 ≤ (-u) 1 := by + have : (-u) 1 = - u 1 := rfl + rw [this] + linarith + obtain ⟨t, ht, e⟩ := exists_axU (u := -u) (by rw [norm_neg, hu]) hm + refine .inr ⟨k, k, t, k0, k0, by rw [lA, lB], ht, ?_, ?_⟩ + · rw [Fv_up hΦ k0 ht, hq, ← e, sub_eq_add_neg] + · rw [lB, Fv_anti hΦ k0 ht, hp, ← e, sub_neg_eq_add] + +/-- The map from the two discs to the model surface. -/ +noncomputable def toModel (a b n : ℕ) (Φ : ℂ → ℂ) (x : ℕ × ℂ) : Quot (ModelGlue a b n) := + Quot.mk _ (retB n (Fv n Φ x)) + +theorem presents_of_isPoly (hΦ : IsPoly n Φ Φ') (hn : 2 * a + b ≤ n) : + Presents (modelW a b n) (toModel a b n Φ) := by + have hbase : ∀ x ∈ Dsk (modelW a b n), Fv n Φ x ∈ modelBase n := fun x hx => Fv_base hΦ.1 hx.2 + refine ⟨?_, ?_, ?_⟩ + · have h1 : ContinuousOn (fun x => retB n (Fv n Φ x)) (Dsk (modelW a b n)) := + (continuousOn_retB n).comp (continuousOn_Fv hΦ.1) hbase + exact continuous_quot_mk.comp_continuousOn h1 + · refine eq_univ_of_forall fun q => ?_ + obtain ⟨p, rfl⟩ := Quot.exists_rep q + obtain ⟨x, hx, e⟩ := Fv_surj (a := a) (b := b) hΦ p.2 + refine ⟨x, hx, ?_⟩ + have : retB n (Fv n Φ x) = p := Subtype.ext (by rw [retB_val (hbase x hx), e]) + simp [toModel, this] + · intro x hx y hy + constructor + · intro h + have hq := Quot.eqvGen_exact h + have key : ∀ p q, Relation.EqvGen (ModelGlue a b n) p q → ∀ x ∈ Dsk (modelW a b n), + ∀ y ∈ Dsk (modelW a b n), Fv n Φ x = p.1 → Fv n Φ y = q.1 → PRel (modelW a b n) x y := by + intro p q hpq + induction hpq with + | rel p q h => + intro x hx y hy e1 e2 + rcases holePair_of_glue hΦ hn h with ⟨k, k', t, hk, hk', hl, ht, h1, h2⟩ | ⟨k, k', t, hk, + hk', hl, ht, h1, h2⟩ + · have s := stp_holes (a := a) (b := b) hk hk' hl ht + exact ((Fv_fiber hΦ hx s.mem_Dsk.1 (e1.trans h1)).trans _ _ _ (.rel _ _ s)).trans _ _ _ + (Fv_fiber hΦ s.mem_Dsk.2 hy (h2.symm.trans e2.symm)) + · have s := stp_holes (a := a) (b := b) hk hk' hl ht + exact ((Fv_fiber hΦ hx s.mem_Dsk.2 (e1.trans h2)).trans _ _ _ (.symm _ _ + (.rel _ _ s))).trans _ _ _ + (Fv_fiber hΦ s.mem_Dsk.1 hy (h1.symm.trans e2.symm)) + | refl p => + intro x hx y hy e1 e2 + exact Fv_fiber hΦ hx hy (e1.trans e2.symm) + | symm p q _ ih => + intro x hx y hy e1 e2 + exact (ih y hy x hx e2 e1).symm + | trans p q r _ _ ih1 ih2 => + intro x hx y hy e1 e2 + obtain ⟨w, hw, e⟩ := Fv_surj (a := a) (b := b) hΦ q.2 + exact (ih1 x hx w hw e1 e).trans _ _ _ (ih2 w hw y hy e e2) + exact key _ _ hq x hx y hy (retB_val (hbase x hx)).symm (retB_val (hbase y hy)).symm + · intro h + have key : ∀ x y, PRel (modelW a b n) x y → x ∈ Dsk (modelW a b n) → + Relation.EqvGen (ModelGlue a b n) (retB n (Fv n Φ x)) (retB n (Fv n Φ y)) := by + intro x y hxy + induction hxy with + | rel x y h => + intro hx + obtain ⟨h1, h2⟩ := h.mem_Dsk + exact Fv_stp hΦ h _ _ (retB_val (hbase _ h1)) (retB_val (hbase _ h2)) + | refl x => exact fun _ => .refl _ + | symm x y h ih => + intro hx + exact (ih ((prel_mem_iff h).mpr hx)).symm + | trans x y z h1 h2 ih1 ih2 => + intro hx + exact (ih1 hx).trans _ _ _ (ih2 ((prel_mem_iff h1).mp hx)) + exact Quot.eqvGen_sound (key x y h hx) + +end poly + +/-- The model surface is presented by its word. -/ +theorem presents_model (a b c : ℕ) : + ∃ f : ℕ × ℂ → SurfaceModel a b c, Presents (modelW a b (2 * a + b + c)) f := by + obtain ⟨Φ, Φ', h⟩ := exists_modelPoly (2 * a + b + c) + exact ⟨toModel a b _ Φ, presents_of_isPoly (Φ' := Φ') h (by omega)⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/ModelSides.lean b/LeanPool/GraphMinor/Surface/ModelSides.lean new file mode 100644 index 0000000000..6f8cc1d157 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/ModelSides.lean @@ -0,0 +1,210 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ModelLoop + +/-! +# Points of the upper and lower side of a model surface + +`Fv` maps the two discs of `modelW` to the sphere with holes: the disc in the slot `0` goes to the +upper half and the +disc in the slot `1` to the lower half. Here we compute `Fv` on the sides of the two polygons. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +open scoped OnePoint + +theorem modelMirror_mirror (u : EuclideanPlane) : modelMirror (modelMirror u) = u := by + ext i + fin_cases i <;> simp [modelMirror] + +theorem continuous_modelMirror : Continuous modelMirror := by + have : modelMirror = fun u : EuclideanPlane => pt (u 0) (-(u 1)) := rfl + rw [this] + exact continuous_pt.comp ((by fun_prop : Continuous fun u : EuclideanPlane => u 0).prodMk + (by fun_prop : Continuous fun u : EuclideanPlane => -(u 1))) + +/-- The mirror map as a homeomorphism. -/ +noncomputable def mirH : EuclideanPlane ≃ₜ EuclideanPlane where + toFun := modelMirror + invFun := modelMirror + left_inv := modelMirror_mirror + right_inv := modelMirror_mirror + continuous_toFun := continuous_modelMirror + continuous_invFun := continuous_modelMirror + +/-- The mirror map on the sphere. -/ +noncomputable def mirO : OnePoint EuclideanPlane ≃ₜ OnePoint EuclideanPlane := mirH.onePointCongr + +@[simp] theorem mirO_coe (u : EuclideanPlane) : mirO (u : OnePoint EuclideanPlane) = + (modelMirror u : EuclideanPlane) := rfl + +@[simp] theorem mirO_infty : mirO ∞ = ∞ := rfl + +theorem mirO_mirO (p : OnePoint EuclideanPlane) : mirO (mirO p) = p := by + induction p using OnePoint.rec with + | infty => rfl + | coe u => simp [modelMirror_mirror] + +/-- The sides on the axis are fixed by the mirror. -/ +def IsAx (n : ℕ) (p : OnePoint EuclideanPlane) : Prop := + p = ∞ ∨ ∃ x, hgt n x = 0 ∧ p = ((pt x 0 : EuclideanPlane) : OnePoint EuclideanPlane) + +theorem IsAx.mirO {n : ℕ} {p : OnePoint EuclideanPlane} (h : IsAx n p) : mirO p = p := by + rcases h with rfl | ⟨x, -, rfl⟩ + · rfl + · rw [mirO_coe, modelMirror_pt] + simp + +theorem upE_angT (n : ℕ) (s : ℝ) : + upE n (cis' (angT s)) = ((pt s (hgt n s) : EuclideanPlane) : OnePoint EuclideanPlane) := by + obtain ⟨h1, h2⟩ := cay_cis s + rw [upE_ne h1, h2] + simp + +theorem isAx_of_angT {n : ℕ} {s : ℝ} (h : hgt n s = 0) : IsAx n (upE n (cis' (angT s))) := by + rw [upE_angT, h] + exact .inr ⟨s, h, rfl⟩ + +theorem exists_angT {θ : ℝ} (h0 : 0 < θ) (h1 : θ < 2 * Real.pi) : ∃ s, angT s = θ := by + refine ⟨Real.tan ((θ - Real.pi) / 2), ?_⟩ + unfold angT + rw [Real.arctan_tan (by linarith) (by linarith)] + ring + +/-- The part of the loop through the point at infinity is on the axis. -/ +theorem isAx_top {n : ℕ} {y : ℝ} (h0 : 2 * (n : ℝ) ≤ y) (h1 : y ≤ ((2 * n + 2 : ℕ) : ℝ)) : + IsAx n (upE n (cis' (angL n y))) := by + have hm := strictMono_angL n + have hlo : angT (axS (2 * n)) ≤ angL n y := by + rw [← angL_le (le_refl (2 * (n : ℝ)))] + exact hm.monotone h0 + have hhi : angL n y ≤ angT (axS 0) + 2 * Real.pi := by + rw [← angL_top] + exact hm.monotone h1 + have hlow := (angT_mem (axS (2 * n))).1 + rcases lt_trichotomy (angL n y) (2 * Real.pi) with h | h | h + · obtain ⟨s, hs⟩ := exists_angT (hlo.trans_lt' hlow) h + rw [← hs] + refine isAx_of_angT (hgt_large ?_) + have h2 : axS (2 * n) ≤ s := strictMono_angT.le_iff_le.mp (by rw [hs]; exact hlo) + rw [axS_even] at h2 + exact h2 + · rw [h] + have : cis' (2 * Real.pi) = 1 := by + have := cis'_add_two_pi 0 + rw [zero_add, cis'_zero] at this + exact this + rw [this, upE_one] + exact .inl rfl + · have hup := (angT_mem (axS 0)).2 + obtain ⟨s, hs⟩ := exists_angT (θ := angL n y - 2 * Real.pi) (by linarith) (by linarith) + have e : cis' (angL n y) = cis' (angT s) := by + rw [hs, ← cis'_add_two_pi (angL n y - 2 * Real.pi), sub_add_cancel] + rw [e] + refine isAx_of_angT (hgt_small ?_) + have h2 : s ≤ axS 0 := strictMono_angT.le_iff_le.mp (by rw [hs]; linarith) + have h3 := axS_even 0 + simp only [Nat.cast_zero, mul_zero, zero_sub] at h3 + rw [h3] at h2 + exact h2 + +theorem isAx_seg {n k : ℕ} (hk : k < n) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : + IsAx n (upE n (cis' (angL n (2 * k + t)))) := by + have h : (2 * (k : ℝ) + t) ≤ 2 * n := by + have : (k : ℝ) + 1 ≤ n := by exact_mod_cast hk + linarith [ht.2] + rw [angL_le h] + exact isAx_of_angT (hgt_seg (k := k) (by linarith [ht.1]) (by linarith [ht.2])) + +/-- The height on the circle `k`. -/ +noncomputable def axPsi (t : ℝ) : ℝ := √(1 - axPhi t ^ 2) + +theorem axPhi_mem {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : -1 ≤ axPhi t ∧ axPhi t ≤ 1 := by + rw [← axPhi_zero, ← axPhi_one] + exact ⟨strictMono_axPhi.monotone ht.1, strictMono_axPhi.monotone ht.2⟩ + +theorem axPsi_sq {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : axPsi t ^ 2 = 1 - axPhi t ^ 2 := by + obtain ⟨h1, h2⟩ := axPhi_mem ht + exact Real.sq_sqrt (by nlinarith) + +theorem axPsi_neg (t : ℝ) : axPsi (1 - t) = axPsi t := by + simp [axPsi, axPhi_neg] + +/-- The value of the loop on the circle `k`. -/ +theorem upE_hole {n k : ℕ} (hk : k < n) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : + upE n (cis' (angL n (2 * k + 1 + t))) = + ((modelCentre k + pt (axPhi t) (axPsi t) : EuclideanPlane) : OnePoint EuclideanPlane) := by + have h : (2 * (k : ℝ) + 1 + t) ≤ 2 * n := by + have : (k : ℝ) + 1 ≤ n := by exact_mod_cast hk + linarith [ht.2] + rw [angL_le h, upE_angT, axS_hole] + obtain ⟨h1, h2⟩ := axPhi_mem ht + rw [hgt_eq hk (by rw [add_sub_cancel_left, abs_le]; exact ⟨h1, h2⟩), add_sub_cancel_left] + congr 1 + ext i + fin_cases i <;> simp [modelCentre_eq, axPsi] + +theorem hgt_hole_pos {n k : ℕ} (hk : k < n) {t : ℝ} (h0 : 0 < t) (h1 : t < 1) : + 0 < hgt n (axS (2 * k + 1 + t)) := by + have hm := strictMono_axPhi + have h2 : -1 < axPhi t := by rw [← axPhi_zero]; exact hm h0 + have h3 : axPhi t < 1 := by rw [← axPhi_one]; exact hm h1 + rw [axS_hole, hgt_eq hk (by rw [add_sub_cancel_left, abs_le]; exact ⟨h2.le, h3.le⟩), + add_sub_cancel_left] + exact Real.sqrt_pos.mpr (by nlinarith) + +/-- Each point of the unit circle lies on the loop. -/ +theorem exists_loop_param (n : ℕ) {z : ℂ} (hz : ‖z‖ = 1) : + ∃ y ∈ Icc (0 : ℝ) (2 * n + 2 : ℕ), cis' (angL n y) = z := by + obtain ⟨θ, hθ, rfl⟩ := exists_cis'_angle (angT (axS 0)) hz + have hiv := intermediate_value_Icc (a := 0) (b := ((2 * n + 2 : ℕ) : ℝ)) (by positivity) + (continuous_angL n).continuousOn + rw [angL_zero, angL_top] at hiv + obtain ⟨x, hx, rfl⟩ := hiv hθ + exact ⟨x, hx, rfl⟩ + +/-- A point of the loop whose image is on the axis lies on a side on the axis. -/ +theorem exists_side_of_ax {n : ℕ} {y : ℝ} (hy : y ∈ Icc (0 : ℝ) (2 * n + 2 : ℕ)) + (h : hgt n (axS y) = 0 ∨ 2 * (n : ℝ) ≤ y) : + (∃ k t, k < n ∧ t ∈ Icc (0 : ℝ) 1 ∧ y = 2 * k + t) ∨ + (2 * (n : ℝ) ≤ y) := by + by_cases h2 : 2 * (n : ℝ) ≤ y + · exact .inr h2 + have h' : hgt n (axS y) = 0 := h.resolve_right h2 + push Not at h2 + left + set j := ⌊y⌋₊ with hj + have h3 : (j : ℝ) ≤ y := Nat.floor_le hy.1 + have h4 : y < j + 1 := Nat.lt_floor_add_one y + have hjn : j < 2 * n := by + have : (j : ℝ) < 2 * n := by linarith + exact_mod_cast this + rcases Nat.even_or_odd' j with ⟨k, hk | hk⟩ + · refine ⟨k, y - j, by omega, ⟨by linarith, by linarith⟩, ?_⟩ + rw [hk] + push_cast + ring + · have hk' : (j : ℝ) = 2 * k + 1 := by rw [hk]; push_cast; ring + by_cases h5 : y = j + · refine ⟨k, 1, by omega, ⟨by norm_num, le_rfl⟩, ?_⟩ + rw [h5, hk'] + · exfalso + have h6 : 0 < y - j := sub_pos.mpr (lt_of_le_of_ne h3 (Ne.symm h5)) + have h7 := hgt_hole_pos (n := n) (k := k) (by omega) h6 (by linarith) + rw [show 2 * (k : ℝ) + 1 + (y - j) = y by rw [hk']; ring, h'] at h7 + exact lt_irrefl _ h7 + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/ModelWord.lean b/LeanPool/GraphMinor/Surface/ModelWord.lean new file mode 100644 index 0000000000..d009698c9d --- /dev/null +++ b/LeanPool/GraphMinor/Surface/ModelWord.lean @@ -0,0 +1,566 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.WordIso + +/-! +# The words of the model surfaces + +`modelW a b c` is the pair of words that we get from the model surface $\Sigma(a, b, c)$ by cutting +along the real +axis: `W₀` runs along the upper side and `W₁` along the lower side. `peq_modelW` shows that this +pair is equivalent to +the normal form `nfW a b c`. We peel off the holes from the last one to the first one. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Function + +universe uu + +/-- The label of the segment number `k` of the real axis. -/ +def segL (k : ℕ) : Letter := (4 * k, true) + +/-- The label of the rest of the real axis. -/ +def zL : Letter := (3, true) + +/-- The label of the upper half of the circle `k`. -/ +def holeA (a k : ℕ) : Letter := + if k < 2 * a ∧ k % 2 = 1 then (4 * (k - 1) + 2, true) else (4 * k + 1, true) + +/-- The label of the lower half of the circle `k`. -/ +def holeB (a b k : ℕ) : Letter := + if k < 2 * a then + if k % 2 = 0 then (4 * k + 2, true) else (4 * (k - 1) + 1, true) + else if k < 2 * a + b then (4 * k + 1, false) else (4 * k + 2, true) + +/-- The upper side up to the circle `k`. -/ +def pw (a : ℕ) : ℕ → List Letter + | 0 => [] + | k + 1 => pw a k ++ [segL k, holeA a k] + +/-- The lower side up to the circle `k`. -/ +def qw (a b : ℕ) : ℕ → List Letter + | 0 => [] + | k + 1 => qw a b k ++ [segL k, holeB a b k] + +/-- The two words of the model surface with `n` circles. -/ +def modelW (a b n : ℕ) : ℕ → List Letter := + dW (pw a n ++ [segL n, zL]) (qw a b n ++ [segL n, zL]) + +/-- The inner part of the glued word. -/ +def fw (a b k : ℕ) : List Letter := winv (qw a b k) ++ pw a k + +theorem fw_succ (a b k : ℕ) : + fw a b (k + 1) = linv (holeB a b k) :: linv (segL k) :: fw a b k ++ [segL k, holeA a k] := by + simp [fw, pw, qw, winv] + +theorem pw_lt (a k : ℕ) : ∀ l ∈ pw a k, l.1 < 4 * k := by + induction k with + | zero => simp [pw] + | succ k ih => + intro l hl + simp only [pw, List.mem_append, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with hl | rfl | rfl + · have := ih l hl + omega + · simp [segL] + · simp only [holeA] + split_ifs <;> simp <;> omega + +theorem qw_lt (a b k : ℕ) : ∀ l ∈ qw a b k, l.1 < 4 * k := by + induction k with + | zero => simp [qw] + | succ k ih => + intro l hl + simp only [qw, List.mem_append, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with hl | rfl | rfl + · have := ih l hl + omega + · simp [segL] + · simp only [holeB] + split_ifs <;> simp <;> omega + +theorem fw_lt (a b k : ℕ) : ∀ l ∈ fw a b k, l.1 < 4 * k := by + intro l hl + rcases List.mem_append.mp hl with hl | hl + · simp only [winv, List.mem_map, List.mem_reverse] at hl + obtain ⟨m, hm, rfl⟩ := hl + exact qw_lt a b k m hm + · exact pw_lt a k l hl + +/-- The labels of `H` are not smaller than `4 * k`. -/ +def LabGe (H : List Letter) (k : ℕ) : Prop := ∀ l ∈ H, 4 * k ≤ l.1 + +theorem noLab_of_lt {w : List Letter} {c n : ℕ} (h : ∀ l ∈ w, l.1 < n) (hc : n ≤ c) : NoLab w c := + fun l hl he => by + have := h l hl + omega + +theorem noLab_of_ge {H : List Letter} {k c : ℕ} (h : LabGe H k) (hc : c < 4 * k) : NoLab H c := + fun l hl he => by + have := h l hl + omega + +theorem disjL_of_ge {H F : List Letter} {k : ℕ} (h : LabGe H k) (hF : ∀ l ∈ F, l.1 < 4 * k) : DisjL + H F := + fun l hl => noLab_of_lt hF (h l hl) + +/-- Peeling a free hole. -/ +theorem peel_free {F H : List Letter} {s p q : Letter} (hH : Blocks H) (hd : DisjL H F) + (_h1 : NoLab F s.1) (h2 : NoLab F p.1) (h3 : NoLab F q.1) (h4 : NoLab H s.1) (h5 : NoLab H p.1) + (h6 : NoLab H q.1) (h7 : s.1 ≠ p.1) (h8 : s.1 ≠ q.1) (h9 : p.1 ≠ q.1) : + WEq.{uu} (linv q :: linv s :: F ++ s :: p :: H) (F ++ holB s p ++ H) := by + have hsp : p.1 ≠ s.1 := fun e => h7 e.symm + have hsq : q.1 ≠ s.1 := fun e => h8 e.symm + have hqp : q.1 ≠ p.1 := fun e => h9 e.symm + have dA : DisjL H [linv q, linv s] := fun l hl => by + exact noLab_cons.mpr ⟨fun e => h6 l hl e.symm, noLab_cons.mpr ⟨fun e => h4 l hl e.symm, + noLab_nil⟩⟩ + have dB : DisjL H (F ++ [s, p]) := DisjL.append_right hd fun l hl => + noLab_cons.mpr ⟨fun e => h4 l hl e.symm, noLab_cons.mpr ⟨fun e => h5 l hl e.symm, noLab_nil⟩⟩ + have c1 := slide.{uu} hH dA dB + have c2 : WEq.{uu} ((F ++ [s]) ++ p :: [linv q] ++ (linv s :: H)) ((F ++ [s]) ++ p :: + (linv s :: H)) := by + have hc : ∀ c, cnt ((F ++ [s]) ++ p :: [linv q] ++ (linv s :: H)) c = cnt F c + cnt H c + + 2 * (if s.1 = c then 1 else 0) + (if p.1 = c then 1 else 0) + (if q.1 = c then 1 else 0) + := by + intro c + simp only [cnt_append, cnt_cons, linv, show cnt [] c = 0 from rfl] + omega + refine merge_all [linv q] fun l hl => ?_ + rw [hc] + simp only [List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with hl | hl + · rw [hl, noLab_iff_cnt.mp h2, noLab_iff_cnt.mp h5, ite_eq_right h7, ite_eq_right hqp, + ite_eq_left rfl] + · have e : l.1 = q.1 := by rw [hl]; rfl + rw [e, noLab_iff_cnt.mp h3, noLab_iff_cnt.mp h6, ite_eq_right h8, ite_eq_right h9, + ite_eq_left rfl] + refine (WEq.of_eq (by simp)).trans (c1.trans ((WEq.of_eq (by simp)).trans (c2.trans + (WEq.of_eq ?_)))) + simp [holB] + +/-- Peeling a cross-cap. -/ +theorem peel_cap {F H : List Letter} {s y : Letter} (hH : Blocks H) (hd : DisjL H F) + (h1 : NoLab F s.1) (h2 : NoLab F y.1) (h4 : NoLab H s.1) (h5 : NoLab H y.1) (h7 : s.1 ≠ y.1) : + WEq.{uu} (y :: linv s :: F ++ s :: y :: H) (F ++ [y, y] ++ H) := by + have dY : DisjL H [y] := fun l hl => noLab_cons.mpr ⟨fun e => h5 l hl e.symm, noLab_nil⟩ + have dS : DisjL H [linv s] := fun l hl => noLab_cons.mpr ⟨fun e => h4 l hl e.symm, noLab_nil⟩ + have dS' : DisjL H [s] := fun l hl => noLab_cons.mpr ⟨fun e => h4 l hl e.symm, noLab_nil⟩ + have c1 := slide.{uu} (A := [y]) (B := linv s :: F ++ [s, y]) hH dY + (DisjL.append_right (DisjL.append_right dS hd) (DisjL.append_right dS' dY)) + have hH2 : Blocks ([y, y] ++ H) := .cons (.cap y) (fun l hl => by + simp only [List.mem_cons, List.not_mem_nil, or_false, or_self] at hl + subst hl + exact h5) hH + have dd : ∀ {w : List Letter}, DisjL H w → NoLab w y.1 → DisjL ([y, y] ++ H) w := fun a1 a2 => by + refine DisjL.append_left (fun l hl => ?_) a1 + simp only [List.mem_cons, List.not_mem_nil, or_false, or_self] at hl + subst hl + exact a2 + have hyn : NoLab [linv s] y.1 := noLab_cons.mpr ⟨h7, noLab_nil⟩ + have c2 := slide.{uu} (A := [linv s]) (B := F ++ [s]) hH2 (dd dS hyn) + (dd (DisjL.append_right hd dS') (noLab_append.mpr ⟨h2, noLab_cons.mpr ⟨h7, noLab_nil⟩⟩)) + have c3 := (WEq.fold.{uu} s (u := [y, y] ++ H ++ F) (by simp) + (noLab_append.mpr ⟨noLab_append.mpr ⟨noLab_cons.mpr ⟨fun e => h7 e.symm, noLab_cons.mpr + ⟨fun e => h7 e.symm, noLab_nil⟩⟩, h4⟩, h1⟩)).symm + have c4 : WEq.{uu} (F ++ [s] ++ [linv s] ++ ([y, y] ++ H)) (s :: linv s :: ([y, y] ++ H ++ F)) := + WEq.rot' F ([s, linv s] ++ [y, y] ++ H) (by simp) (by simp) + have c5 : WEq.{uu} ([y, y] ++ H ++ F) (F ++ [y, y] ++ H) := WEq.rot' ([y, y] ++ H) F rfl (by simp) + exact (WEq.of_eq (by simp)).trans (c1.trans ((WEq.of_eq (by simp)).trans (c2.trans (c4.trans + (c3.trans c5))))) + +/-- Peeling a handle. -/ +theorem peel_hnd {F H : List Letter} {p q s t : Letter} (hH : Blocks H) (hd : DisjL H F) + (hc : ∀ l ∈ [p, q, s, t], NoLab F l.1 ∧ NoLab H l.1) (h1 : p.1 ≠ q.1) (h2 : p.1 ≠ s.1) + (h3 : p.1 ≠ t.1) + (h4 : q.1 ≠ s.1) (h5 : q.1 ≠ t.1) (h6 : s.1 ≠ t.1) : + WEq.{uu} (linv p :: linv s :: linv q :: linv t :: F ++ t :: p :: s :: q :: H) + (F ++ hndB (linv t) s ++ H) := by + have hpa := hc p (by simp) + have hqa := hc q (by simp) + have hsa := hc s (by simp) + have hta := hc t (by simp) + set C := F ++ H with hC + have hp : NoLab C p.1 := noLab_append.mpr hpa + have hq : NoLab C q.1 := noLab_append.mpr hqa + have hs : NoLab C s.1 := noLab_append.mpr hsa + have ht : NoLab C t.1 := noLab_append.mpr hta + have n : ∀ {x y : Letter}, x.1 ≠ y.1 → ∀ {w : List Letter}, NoLab w y.1 → NoLab (x :: w) y.1 := + fun h _ a => noLab_cons.mpr ⟨h, a⟩ + have n' : ∀ {x y : Letter}, x.1 ≠ y.1 → ∀ {w : List Letter}, NoLab w y.1 → NoLab + (linv x :: w) y.1 := + fun h _ a => noLab_cons.mpr ⟨h, a⟩ + have s1 := Ne.symm h1 + have s2 := Ne.symm h2 + have s3 := Ne.symm h3 + have s6 := Ne.symm h6 + have dg : ∀ {w : List Letter} {x : Letter}, DisjL H w → NoLab H x.1 → DisjL H (linv x :: w) + := fun a1 a2 l hl => + noLab_cons.mpr ⟨fun e => a2 l hl e.symm, a1 l hl⟩ + have da : ∀ {w : List Letter} {x : Letter}, DisjL H w → NoLab H x.1 → DisjL H (x :: w) + := fun a1 a2 l hl => + noLab_cons.mpr ⟨fun e => a2 l hl e.symm, a1 l hl⟩ + have dn : DisjL H [] := fun _ _ => noLab_nil + have d1 : DisjL H [linv p, linv s, linv q, linv t] := + dg (dg (dg (dg dn hta.2) hqa.2) hsa.2) hpa.2 + have d2 : DisjL H (t :: p :: s :: q :: []) := + da (da (da (da dn hqa.2) hsa.2) hpa.2) hta.2 + have c0 := slide.{uu} (A := [linv p, linv s, linv q, linv t] ++ F) (B + := t :: p :: s :: q :: []) hH + (DisjL.append_right d1 hd) d2 + have c1 : WEq.{uu} ((t :: p :: s :: q :: []) ++ ([linv p, linv s, linv q, linv t] ++ F) ++ H) + ((C ++ [t]) ++ p :: (s :: q :: linv p :: linv s :: linv q :: [linv t])) := + WEq.rot' ((t :: p :: s :: q :: []) ++ [linv p, linv s, linv q, linv t]) C (by simp [hC]) + (by simp) + have c2 : WEq.{uu} ((C ++ [t]) ++ p :: (s :: q :: linv p :: linv s :: linv q :: [linv t])) + (p :: ((C ++ [t]) ++ [linv s, linv q, linv t] ++ linv p :: [s, q])) := + ruleA' p (C ++ [t]) [] [s, q] [linv s, linv q, linv t] + (noLab_append.mpr ⟨hp, n s3 noLab_nil⟩) noLab_nil (n s2 (n s1 noLab_nil)) + (n' s2 (n' s1 (n' s3 noLab_nil))) (by simp) (by simp) + have c3 : WEq.{uu} (p :: ((C ++ [t]) ++ [linv s, linv q, linv t] ++ linv p :: [s, q])) + ((C ++ [t]) ++ linv s :: ([linv q, linv t] ++ [linv p] ++ s :: [q, p])) := + WEq.rot' [p] ((C ++ [t]) ++ linv s :: ([linv q, linv t] ++ [linv p] ++ s :: [q])) (by simp) + (by simp) + have c4 : WEq.{uu} ((C ++ [t]) ++ linv s :: ([linv q, linv t] ++ [linv p] ++ s :: [q, p])) + ([linv q, linv t] ++ linv s :: ((C ++ [t]) ++ [q, p] ++ s :: [linv p])) := + ruleA' (linv s) (C ++ [t]) [linv q, linv t] [linv p] [q, p] + (noLab_append.mpr ⟨hs, n s6 noLab_nil⟩) (n' h4 (n' s6 noLab_nil)) (n' s2.symm noLab_nil) + (n h4 (n s2.symm noLab_nil)) + (by simp [linv_linv]) (by simp [linv_linv]) + have c5 : WEq.{uu} ([linv q, linv t] ++ linv s :: ((C ++ [t]) ++ [q, p] ++ s :: [linv p])) + ((linv s :: C) ++ t :: ([q, p] ++ [s, linv p, linv q] ++ linv t :: [])) := + WEq.rot' [linv q, linv t] (linv s :: ((C ++ [t]) ++ [q, p] ++ s :: [linv p])) rfl (by simp) + have c6 : WEq.{uu} ((linv s :: C) ++ t :: ([q, p] ++ [s, linv p, linv q] ++ linv t :: [])) + ([q, p] ++ t :: ((linv s :: C) ++ [] ++ linv t :: [s, linv p, linv q])) := + ruleA' t (linv s :: C) [q, p] [s, linv p, linv q] [] (n' h6 ht) (n h5 (n h3 noLab_nil)) + (n h6 (n' h3 (n' h5 noLab_nil))) noLab_nil (by simp) (by simp) + set D := t :: linv s :: (C ++ [linv t, s]) with hD + have c7 : WEq.{uu} ([q, p] ++ t :: ((linv s :: C) ++ [] ++ linv t :: [s, linv p, linv q])) + (linv q :: q :: p :: (D ++ [linv p])) := + WEq.rot' ([q, p] ++ D ++ [linv p]) [linv q] (by simp [hD]) (by simp) + have hnD : ∀ {x : Letter}, x.1 ≠ t.1 → x.1 ≠ s.1 → NoLab C x.1 → NoLab D x.1 := fun a1 a2 a3 => + noLab_cons.mpr ⟨Ne.symm a1, noLab_cons.mpr ⟨Ne.symm a2, noLab_append.mpr ⟨a3, noLab_cons.mpr + ⟨Ne.symm a1, + noLab_cons.mpr ⟨Ne.symm a2, noLab_nil⟩⟩⟩⟩⟩ + have c8 : WEq.{uu} (linv q :: q :: p :: (D ++ [linv p])) (p :: (D ++ [linv p])) := by + have := WEq.fold.{uu} (linv q) (u := p :: (D ++ [linv p])) (by simp) + (noLab_cons.mpr ⟨h1, noLab_append.mpr ⟨hnD h5 h4 hq, noLab_cons.mpr ⟨h1, noLab_nil⟩⟩⟩) + simpa [linv_linv] using this.symm + have c9 : WEq.{uu} (p :: (D ++ [linv p])) (linv p :: p :: D) := + WEq.rot' (p :: D) [linv p] (by simp) (by simp) + have c10 : WEq.{uu} (linv p :: p :: D) D := by + have := WEq.fold.{uu} (linv p) (u := D) (by simp [hD]) (hnD h3 h2 hp) + simpa [linv_linv] using this.symm + have c11 : WEq.{uu} D (hndB (linv t) s ++ F ++ H) := + WEq.rot' (t :: linv s :: C) [linv t, s] (by simp [hD]) (by simp [hC, hndB, linv_linv]) + have hdU : DisjL H (hndB (linv t) s) := dg (da (dg (dg dn hsa.2) (x := linv t) hta.2) hsa.2) hta.2 + have c12 := slide.{uu} hH hdU hd + exact (WEq.of_eq (by simp)).trans (c0.trans (c1.trans (c2.trans (c3.trans (c4.trans (c5.trans + (c6.trans + (c7.trans (c8.trans (c9.trans (c10.trans (c11.trans c12)))))))))))) + +theorem fw_cast_lt {a b k n : ℕ} (h : k ≤ n) : ∀ l ∈ fw a b k, l.1 < 4 * n := fun l hl => by + have := fw_lt a b k l hl + omega + +theorem cross_label {F H : List Letter} {k c : ℕ} (hF : ∀ l ∈ F, l.1 < 4 * k) (hH : LabGe H (k + 1)) + (h1 : 4 * k ≤ c) (h2 : c < 4 * (k + 1)) : NoLab F c ∧ NoLab H c := + ⟨noLab_of_lt hF h1, noLab_of_ge hH h2⟩ + +/-- Peel all free holes. -/ +theorem peel_c (a b : ℕ) (c : ℕ) : ∀ (Z : List Letter) (c₀ : ℕ), TL c₀ Z → LabGe Z (2 * a + b + c) → + ∃ Z', TL (c₀ + c) Z' ∧ LabGe Z' (2 * a + b) ∧ WEq.{uu} (fw a b (2 * a + b + c) ++ Z) (fw a b + (2 * a + b) ++ Z') := by + induction c with + | zero => exact fun Z c₀ h1 h2 => ⟨Z, h1, h2, WEq.refl _⟩ + | succ c ih => + intro Z c₀ hT hL + set k := 2 * a + b + c with hk + have hF := fw_lt a b k + have hL' : LabGe Z (k + 1) := hL + have hA : holeA a k = (4 * k + 1, true) := by + simp only [holeA] + rw [ite_eq_right (by omega)] + have hB : holeB a b k = (4 * k + 2, true) := by + simp only [holeB] + rw [ite_eq_right (by omega), ite_eq_right (by omega)] + have l1 := cross_label (c := 4 * k) hF hL' (by omega) (by omega) + have l2 := cross_label (c := 4 * k + 1) hF hL' (by omega) (by omega) + have l3 := cross_label (c := 4 * k + 2) hF hL' (by omega) (by omega) + have e : fw a b (k + 1) = linv (4 * k + 2, true) :: linv (segL k) :: fw a b k ++ segL k :: + (4 * k + 1, true) :: [] := by + rw [fw_succ, hA, hB] + have p1 := peel_free.{uu} (s := segL k) (p := (4 * k + 1, true)) (q := + (4 * k + 2, true)) hT.blocks + (disjL_of_ge hL' (fw_cast_lt (by omega))) l1.1 l2.1 l3.1 l1.2 l2.2 l3.2 + (by simp [segL]) (by simp [segL]) (by simp) + have hU : DisjL (holB (segL k) (4 * k + 1, true)) Z := fun l hl => by + simp only [holB, linv, segL, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl + · exact l1.2 + · exact l2.2 + · exact l1.2 + have hT' : TL (c₀ + 1) (holB (segL k) (4 * k + 1, true) ++ Z) := .cons _ _ + (by simp [segL]) hU hT + have hL'' : LabGe (holB (segL k) (4 * k + 1, true) ++ Z) k := by + intro l hl + rcases List.mem_append.mp hl with hl | hl + · simp only [holB, linv, segL, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl <;> simp + · have := hL' l hl + omega + obtain ⟨Z', a1, a2, a3⟩ := ih _ (c₀ + 1) hT' hL'' + refine ⟨Z', by rwa [show c₀ + (c + 1) = c₀ + 1 + c by omega], a2, ?_⟩ + have e2 : 2 * a + b + (c + 1) = k + 1 := by omega + rw [e2, e] + refine (WEq.of_eq (by simp)).trans (p1.trans ((WEq.of_eq (by simp)).trans a3)) + +theorem LabGe.mono {H : List Letter} {k k' : ℕ} (h : LabGe H k) (hk : k' ≤ k) : LabGe H k' + := fun l hl => by + have := h l hl + omega + +/-- Peel all cross-caps. -/ +theorem peel_b (a b : ℕ) (b' : ℕ) : b' ≤ b → ∀ (Y Z : List Letter) (b₀ : ℕ), CL b₀ Y → Blocks Z + → DisjL Y Z → + LabGe Y (2 * a + b') → LabGe Z (2 * a + b') → + ∃ Y', CL (b₀ + b') Y' ∧ DisjL Y' Z ∧ LabGe Y' (2 * a) ∧ + WEq.{uu} (fw a b (2 * a + b') ++ Y ++ Z) (fw a b (2 * a) ++ Y' ++ Z) := by + induction b' with + | zero => exact fun _ Y Z b₀ h1 _ h3 h4 _ => ⟨Y, h1, h3, h4, WEq.refl _⟩ + | succ b' ih => + intro hb Y Z b₀ hC hZ hd hY hZl + set k := 2 * a + b' with hk + have hF := fw_lt a b k + have hY' : LabGe Y (k + 1) := hY + have hZ' : LabGe Z (k + 1) := hZl + have hH : LabGe (Y ++ Z) (k + 1) := fun l hl => by + rcases List.mem_append.mp hl with hl | hl + · exact hY' l hl + · exact hZ' l hl + have hA : holeA a k = (4 * k + 1, true) := by + simp only [holeA] + rw [ite_eq_right (by omega)] + have hB : holeB a b k = linv (4 * k + 1, true) := by + simp only [holeB] + rw [ite_eq_right (by omega), ite_eq_left (by omega)] + rfl + have l1 := cross_label (c := 4 * k) hF hH (by omega) (by omega) + have l2 := cross_label (c := 4 * k + 1) hF hH (by omega) (by omega) + have e : fw a b (k + 1) = (4 * k + 1, true) :: linv (segL k) :: fw a b k ++ segL k :: + (4 * k + 1, true) :: [] := by + rw [fw_succ, hA, hB, linv_linv] + have hBl : Blocks (Y ++ Z) := hC.blocks.append hZ hd + have p1 := peel_cap.{uu} (s := segL k) (y := (4 * k + 1, true)) hBl + (disjL_of_ge hH (fw_cast_lt (by omega))) l1.1 l2.1 l1.2 l2.2 (by simp [segL]) + have l3 := noLab_append.mp l2.2 + have hU : DisjL [((4 * k + 1, true) : Letter), (4 * k + 1, true)] Y := fun l hl => by + simp only [List.mem_cons, List.not_mem_nil, or_false, or_self] at hl + subst hl + exact l3.1 + have hC' : CL (b₀ + 1) ([(4 * k + 1, true), (4 * k + 1, true)] ++ Y) := .cons _ hU hC + have hd' : DisjL ([(4 * k + 1, true), (4 * k + 1, true)] ++ Y) Z := by + refine DisjL.append_left (fun l hl => ?_) hd + simp only [List.mem_cons, List.not_mem_nil, or_false, or_self] at hl + subst hl + exact l3.2 + have hL : LabGe ([(4 * k + 1, true), (4 * k + 1, true)] ++ Y) k := by + intro l hl + rcases List.mem_append.mp hl with hl | hl + · simp only [List.mem_cons, List.not_mem_nil, or_false, or_self] at hl + subst hl + simp + · have := hY' l hl + omega + obtain ⟨Y', a1, a2, a3, a4⟩ := ih (by omega) _ Z (b₀ + 1) hC' hZ hd' hL (hZ'.mono (by omega)) + refine ⟨Y', by rwa [show b₀ + (b' + 1) = b₀ + 1 + b' by omega], a2, a3, ?_⟩ + have e2 : 2 * a + (b' + 1) = k + 1 := by omega + rw [e2, e] + refine (WEq.of_eq (by simp)).trans (p1.trans ((WEq.of_eq (by simp)).trans a4)) + +/-- Peel all handles. -/ +theorem peel_a (a b : ℕ) (a' : ℕ) : a' ≤ a → ∀ (X T : List Letter) (a₀ : ℕ), HL a₀ X → Blocks T + → DisjL X T → + LabGe X (2 * a') → LabGe T (2 * a') → + ∃ X', HL (a₀ + a') X' ∧ DisjL X' T ∧ WEq.{uu} (fw a b (2 * a') ++ X ++ T) (X' ++ T) := by + induction a' with + | zero => exact fun _ X T a₀ h1 _ h3 _ _ => ⟨X, h1, h3, WEq.of_eq (by simp [fw, pw, qw, winv])⟩ + | succ a' ih => + intro hb X T a₀ hH hT hd hX hTl + set k := 2 * a' with hk + have hF := fw_lt a b k + have e2 : 2 * (a' + 1) = k + 2 := by omega + rw [e2] at hX hTl ⊢ + have hH2 : LabGe (X ++ T) (k + 2) := fun l hl => by + rcases List.mem_append.mp hl with hl | hl + · exact hX l hl + · exact hTl l hl + have hA : holeA a k = (4 * k + 1, true) := by + simp only [holeA] + rw [ite_eq_right (by omega)] + have hB : holeB a b k = (4 * k + 2, true) := by + simp only [holeB] + rw [ite_eq_left (by omega), ite_eq_left (by omega)] + have hA' : holeA a (k + 1) = (4 * k + 2, true) := by + simp only [holeA] + rw [ite_eq_left (by omega)] + simp + have hB' : holeB a b (k + 1) = (4 * k + 1, true) := by + simp only [holeB] + rw [ite_eq_left (by omega), ite_eq_right (by omega)] + simp + have e : fw a b (k + 2) = linv (4 * k + 1, true) :: linv (segL (k + 1)) :: linv + (4 * k + 2, true) :: + linv (segL k) :: fw a b k ++ segL k :: (4 * k + 1, true) :: segL (k + 1) :: + (4 * k + 2, true) :: [] := by + rw [fw_succ, fw_succ, hA, hB, hA', hB'] + simp + have hc : ∀ l ∈ [((4 * k + 1, true) : Letter), (4 * k + 2, true), segL (k + 1), segL k], + NoLab (fw a b k) l.1 ∧ NoLab (X ++ T) l.1 := by + intro l hl + have hl' : 4 * k ≤ l.1 ∧ l.1 < 4 * (k + 2) := by + simp only [segL, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl | rfl <;> simp <;> omega + exact ⟨noLab_of_lt hF hl'.1, noLab_of_ge hH2 hl'.2⟩ + have hBl : Blocks (X ++ T) := hH.blocks.append hT hd + have p1 := peel_hnd.{uu} (s := segL (k + 1)) (t := segL k) (p := (4 * k + 1, true)) (q := + (4 * k + 2, true)) + hBl (disjL_of_ge (hH2.mono (by omega)) hF) hc (by simp) (by simp [segL]; omega) + (by simp [segL]) + (by simp [segL]; omega) (by simp [segL]) (by simp [segL]) + have hs1 := noLab_append.mp (hc (segL (k + 1)) (by simp)).2 + have hs2 := noLab_append.mp (hc (segL k) (by simp)).2 + have hU : ∀ {w : List Letter}, NoLab w (segL k).1 → NoLab w (segL (k + 1)).1 → + DisjL (hndB (linv (segL k)) (segL (k + 1))) w := fun a1 a2 l hl => by + simp only [hndB, List.mem_cons, List.not_mem_nil, or_false, linv_linv] at hl + rcases hl with rfl | rfl | rfl | rfl + · exact a1 + · exact a2 + · exact a1 + · exact a2 + have hH' : HL (a₀ + 1) (hndB (linv (segL k)) (segL (k + 1)) ++ X) := + .cons _ _ (by simp [segL, linv]) (hU hs2.1 hs1.1) hH + have hd' : DisjL (hndB (linv (segL k)) (segL (k + 1)) ++ X) T := + DisjL.append_left (hU hs2.2 hs1.2) hd + have hL : LabGe (hndB (linv (segL k)) (segL (k + 1)) ++ X) k := by + intro l hl + rcases List.mem_append.mp hl with hl | hl + · simp only [hndB, List.mem_cons, List.not_mem_nil, or_false, segL, linv] at hl + rcases hl with rfl | rfl | rfl | rfl <;> simp + · have := hX l hl + omega + obtain ⟨X', a1, a2, a3⟩ := ih (by omega) _ T (a₀ + 1) hH' hT hd' hL (hTl.mono (by omega)) + refine ⟨X', by rwa [show a₀ + (a' + 1) = a₀ + 1 + a' by omega], a2, ?_⟩ + rw [e] + refine (WEq.of_eq (by simp)).trans (p1.trans ((WEq.of_eq (by simp)).trans a3)) + +/-- The inner word is equivalent to a normal form. -/ +theorem fw_nf (a b c : ℕ) : ∃ w, IsNF w a b c ∧ WEq.{uu} (fw a b (2 * a + b + c)) w := by + obtain ⟨Z, h1, h2, h3⟩ := peel_c.{uu} a b c [] 0 .nil (by simp [LabGe]) + obtain ⟨Y, h4, h5, h6, h7⟩ := peel_b.{uu} a b b le_rfl [] Z 0 .nil h1.blocks (by simp [DisjL]) + (by simp [LabGe]) h2 + have hZ : Blocks Z := h1.blocks + have hY : Blocks Y := h4.blocks + have hT : Blocks (Y ++ Z) := hY.append hZ h5 + have hL : LabGe (Y ++ Z) (2 * a) := fun l hl => by + rcases List.mem_append.mp hl with hl | hl + · exact h6 l hl + · exact h2.mono (by omega) l hl + obtain ⟨X, h8, h9, h10⟩ := peel_a.{uu} a b a le_rfl [] (Y ++ Z) 0 .nil hT (by simp [DisjL]) + (by simp [LabGe]) hL + refine ⟨X ++ Y ++ Z, ⟨X, Y, Z, rfl, by simpa using h8, by simpa using h4, by simpa using h1, + h9.inl, h9.inr, h5⟩, ?_⟩ + simp only [zero_add] at h4 h8 + refine (WEq.of_eq (by simp)).trans (h3.trans ((WEq.of_eq (by simp)).trans (h7.trans ?_))) + refine (WEq.of_eq (by simp)).trans (h10.trans (WEq.of_eq (by simp))) + +theorem labels_mod (a b k : ℕ) : (∀ l ∈ pw a k, l.1 % 4 ≠ 3) ∧ ∀ l ∈ qw a b k, l.1 % 4 ≠ 3 := by + induction k with + | zero => simp [pw, qw] + | succ k ih => + constructor + · intro l hl + simp only [pw, List.mem_append, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with hl | rfl | rfl + · exact ih.1 l hl + · simp [segL] + · simp only [holeA] + split_ifs <;> simp + · intro l hl + simp only [qw, List.mem_append, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with hl | rfl | rfl + · exact ih.2 l hl + · simp [segL] + · simp only [holeB] + split_ifs <;> simp + +theorem dW_rev_right (a c : List Letter) : PEq.{uu} (dW c a) (dW c (winv a)) := + peq_rev (finW_sW c) 1 a + +/-- Gluing the two words along the last letter. -/ +theorem peq_modelW_glue (a b n : ℕ) : + PEq.{uu} (modelW a b n) (sW (linv (segL n) :: fw a b n ++ [segL n])) := by + have h1 := dW_rot_left.{uu} (pw a n ++ [segL n]) [zL] (qw a b n ++ [segL n, zL]) + have h2 := dW_rev_right.{uu} (qw a b n ++ [segL n, zL]) ([zL] ++ (pw a n ++ [segL n])) + have hm := labels_mod a b n + have hn : NoLab ((linv (segL n) :: winv (qw a b n)) ++ (pw a n ++ [segL n])) zL.1 := by + refine noLab_append.mpr ⟨noLab_cons.mpr ⟨?_, noLab_winv.mpr ?_⟩, noLab_append.mpr ⟨?_, + noLab_cons.mpr ⟨?_, noLab_nil⟩⟩⟩ + · simp [segL, linv, zL] + omega + · exact fun l hl he => hm.2 l hl (by rw [he]; rfl) + · exact fun l hl he => hm.1 l hl (by rw [he]; rfl) + · simp [segL, zL] + omega + have h3 := peq_cut_sW.{uu} (y := zL.1) (u := pw a n ++ [segL n]) (v := linv (segL n) :: winv + (qw a b n)) true + (by simp) (by simp) hn + have e1 : pw a n ++ [segL n, zL] = (pw a n ++ [segL n]) ++ [zL] := by simp + have e2 : winv (qw a b n ++ [segL n, zL]) = (zL.1, !true) :: (linv (segL n) :: winv (qw a b n)) + := by + simp [winv, zL, linv] + have h4 : PEq.{uu} (modelW a b n) (dW ([zL] ++ (pw a n ++ [segL n])) (qw a b n ++ [segL n, zL])) + := by + simp only [modelW] + rw [e1] + exact h1 + rw [e2] at h2 + have e3 : (linv (segL n) :: winv (qw a b n)) ++ (pw a n ++ [segL n]) = + linv (segL n) :: fw a b n ++ [segL n] := by + simp [fw] + rw [e3] at h3 + exact h4.trans (h2.trans h3.symm) + +/-- **The model words are normal forms.** -/ +theorem exists_modelW_nf (a b c : ℕ) : + ∃ w, PEq.{uu} (modelW a b (2 * a + b + c)) (sW w) ∧ + ((IsNF w a b c ∧ 2 * a + b + c ≠ 0) ∨ (2 * a + b + c = 0 ∧ w = [linv (segL 0), segL 0])) := by + by_cases hn : 2 * a + b + c = 0 + · refine ⟨_, peq_modelW_glue a b _, .inr ⟨hn, ?_⟩⟩ + rw [hn] + simp [fw, pw, qw, winv] + · obtain ⟨w, h1, h2⟩ := fw_nf.{uu} a b c + set n := 2 * a + b + c with hN + have hne : fw a b n ≠ [] := by + obtain ⟨m, hm⟩ := Nat.exists_eq_succ_of_ne_zero hn + rw [hm, Nat.succ_eq_add_one, fw_succ] + simp + have h3 : WEq.{uu} (linv (segL n) :: fw a b n ++ [segL n]) (segL n :: linv + (segL n) :: fw a b n) := + WEq.rot' (linv (segL n) :: fw a b n) [segL n] rfl (by simp) + have h4 := (WEq.fold.{uu} (segL n) hne (noLab_of_lt (fw_lt a b n) (by simp [segL]))).symm + exact ⟨w, (peq_modelW_glue a b n).trans (h3.trans (h4.trans h2)), .inl ⟨h1, hn⟩⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/MoveCuff.lean b/LeanPool/GraphMinor/Surface/MoveCuff.lean new file mode 100644 index 0000000000..66c4ae75f0 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/MoveCuff.lean @@ -0,0 +1,466 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collar +public import LeanPool.GraphMinor.Surface.PasteDisc +import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# Collars of cuffs and moving a cuff + +`exists_collar`: every cuff of a surface has a collar inside any neighbourhood of it. We paste a +closed +disc onto the cuff (`paste_disc`), find a larger disc around this disc (`exists_disc_around`) and +use +the annulus between them (`exists_disc_collar`). + +`move_cuff : MoveCuffStatement`: a homeomorphism `h` of the circle that preserves the orientation is +joined to the identity by the straight homotopy of its lift to the line. We run this homotopy across +the +collar, so the result is `h` on the cuff and the identity on the far end of the collar. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +local notation "𝕀" => unitInterval + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- **Collars of cuffs.** -/ +theorem exists_collar (hS : IsSurface S) {C U : Set S} (hC : IsCuff C) (φ : Circle ≃ₜ C) + (hU : IsOpen U) (hCU : C ⊆ U) : + ∃ b : Circle × 𝕀 → S, Continuous b ∧ Function.Injective b ∧ range b ⊆ U ∧ + (∀ w, b (w, 0) = (φ w).1) ∧ IsOpen (range b \ b '' {x | x.2 = 1}) := by + classical + obtain ⟨hcpt, ht2, hman⟩ := id hS + obtain ⟨S', _, ι, Δ, hS', hι, hΔ, hcov, hmeet, hbd, hbdS⟩ := paste_disc.{u} S C hS hC + obtain ⟨hcpt', ht2', hman'⟩ := hS' + have hιi : Function.Injective ι := hι.injective + let W : Set S' := (ι '' Uᶜ)ᶜ + have hW : IsOpen W := (hι.isClosedMap _ hU.isClosed_compl).isOpen_compl + have hWi : ∀ x, ι x ∈ W → x ∈ U := fun x hx => by + by_contra hcon + exact hx ⟨x, hcon, rfl⟩ + have hsubW : discBd Δ ⊆ W := by + rw [hbd] + rintro _ ⟨x, hx, rfl⟩ ⟨y, hy, he⟩ + exact hy (hCU (hιi he ▸ hx)) + have hint : ∀ x ∈ discBd Δ, IsInteriorPoint x := by + rw [hbd] + rintro _ ⟨x, hx, rfl⟩ + by_contra hcon + have h1 : ι x ∈ bd S' := hcon + rw [hbdS] at h1 + obtain ⟨y, hy, he⟩ := h1 + exact hy.2 (hιi he ▸ hx) + obtain ⟨Δ', hΔ', h2, h3⟩ := exists_disc_around hman' hΔ hint hW hsubW + have hemb := hι.isEmbedding + let p : Circle ≃ₜ discBd Δ := (φ.trans (hemb.homeomorphImage C)).trans + (Homeomorph.setCongr hbd.symm) + have hp : ∀ w, (p w).1 = ι (φ w).1 := fun _ => rfl + obtain ⟨c, c', hcc, hcc', hcm, hcm', hl, hr, hc1, hc2, hcw⟩ := exists_disc_collar hΔ hΔ' h2 p + have : Nonempty S := ⟨(φ 1).1⟩ + obtain ⟨j, hjc, hjl⟩ := exists_inv_of_compactOn isCompact_univ hι.continuous.continuousOn + hιi.injOn + rw [image_univ] at hjc + let Λ : Set ℂ := closedBall 0 2 \ ball 0 1 + have hΛ2 : Λ ⊆ closedBall 0 2 := sdiff_subset + have hcw' : ∀ w : Circle, c w = ι (φ w).1 := fun w => (hcw w).trans (hp w) + have hsph : ∀ w : Circle, (w : ℂ) ∈ closedBall (0 : ℂ) 2 := fun w => by + rw [mem_closedBall_zero_iff, Circle.norm_coe] + norm_num + -- a point of `Δ` that is not in the small disc's inside + have hrange : ∀ z ∈ Λ, c z ∈ range ι := by + intro z hz + by_contra hcon + have h4 : c z ∈ Δ := by + have h5 : c z ∈ range ι ∪ Δ := hcov ▸ mem_univ _ + exact h5.resolve_left hcon + obtain ⟨z₁, hz₁, he⟩ : c z ∈ c '' closedBall 0 1 := hc1 ▸ h4 + have h6 : z₁ = z := hl.injOn (closedBall_subset_closedBall (by norm_num) hz₁) (hΛ2 hz) he + subst h6 + have h7 : ‖z₁‖ = 1 := le_antisymm (mem_closedBall_zero_iff.mp hz₁) (by + have := hz.2 + rwa [mem_ball_zero_iff, not_lt] at this) + exact hcon ⟨(φ ⟨z₁, by simpa [Submonoid.unitSphere] using h7⟩).1, + (hcw' ⟨z₁, by simpa [Submonoid.unitSphere] using h7⟩).symm⟩ + have hιj : ∀ x ∈ range ι, ι (j x) = x := by + rintro _ ⟨x, rfl⟩ + rw [hjl (mem_univ x)] + let P : Circle × 𝕀 → ℂ := fun x => ((1 + x.2.1 : ℝ) : ℂ) * x.1 + have hPc : Continuous P := by fun_prop + have hPn : ∀ x, ‖P x‖ = 1 + x.2.1 := fun x => by + simp only [P, norm_mul, Circle.norm_coe, mul_one, Complex.norm_real, Real.norm_eq_abs] + exact abs_of_nonneg (by linarith [x.2.2.1]) + have hPΛ : ∀ x, P x ∈ Λ := fun x => by + refine ⟨?_, ?_⟩ + · rw [mem_closedBall_zero_iff, hPn] + linarith [x.2.2.2] + · rw [mem_ball_zero_iff, hPn] + linarith [x.2.2.1] + have hPi : Function.Injective P := by + rintro x y he + have h4 := congrArg norm he + rw [hPn, hPn] at h4 + have h5 : x.2 = y.2 := Subtype.ext (by linarith) + have h6 : ((1 + x.2.1 : ℝ) : ℂ) ≠ 0 := by + have : (1 + x.2.1 : ℝ) ≠ 0 := by linarith [x.2.2.1] + exact_mod_cast this + have h7 : ((1 + x.2.1 : ℝ) : ℂ) * x.1 = ((1 + x.2.1 : ℝ) : ℂ) * y.1 := by + have : P x = P y := he + simp only [P] at this + rwa [← h5] at this + exact Prod.ext (Circle.ext (mul_left_cancel₀ h6 h7)) h5 + have hPs : ∀ z ∈ Λ, ∃ x, P x = z := fun z hz => by + have h4 : 1 ≤ ‖z‖ := by + have := hz.2 + rwa [mem_ball_zero_iff, not_lt] at this + have h5 : ‖z‖ ≤ 2 := mem_closedBall_zero_iff.mp hz.1 + have h6 : ‖z‖ ≠ 0 := by linarith + refine ⟨(⟨z / ‖z‖, ?_⟩, ⟨‖z‖ - 1, by linarith, by linarith⟩), ?_⟩ + · simp [Submonoid.unitSphere, h6] + · change (((1 + (‖z‖ - 1) : ℝ)) : ℂ) * (z / ‖z‖) = z + have h7 : (‖z‖ : ℂ) ≠ 0 := by exact_mod_cast h6 + rw [add_sub_cancel] + field_simp + let b : Circle × 𝕀 → S := fun x => j (c (P x)) + have hιb : ∀ x, ι (b x) = c (P x) := fun x => hιj _ (hrange _ (hPΛ x)) + have hbc : Continuous b := + hjc.comp_continuous (hcc.comp_continuous hPc fun x => hΛ2 (hPΛ x)) fun x => hrange _ (hPΛ x) + have hbi : Function.Injective b := fun x y he => by + have h4 : c (P x) = c (P y) := by rw [← hιb, ← hιb, he] + exact hPi (hl.injOn (hΛ2 (hPΛ x)) (hΛ2 (hPΛ y)) h4) + have hbU : range b ⊆ U := by + rintro _ ⟨x, rfl⟩ + have h4 : ι (b x) ∈ Δ ∪ W := h3 (by rw [hιb]; exact hcm (hΛ2 (hPΛ x))) + rcases h4 with h4 | h4 + · have h5 : ι (b x) ∈ ι '' C := hmeet ▸ ⟨⟨_, rfl⟩, h4⟩ + obtain ⟨y, hy, he⟩ := h5 + exact hCU (hιi he ▸ hy) + · exact hWi _ h4 + have hb0 : ∀ w, b (w, 0) = (φ w).1 := fun w => by + apply hιi + rw [hιb, ← hcw' w] + congr 1 + simp [P] + have hopen : range b \ b '' {x | x.2 = 1} = ι ⁻¹' (Δ' \ discBd Δ') := by + ext x + constructor + · rintro ⟨⟨y, rfl⟩, hy⟩ + refine ⟨by rw [hιb]; exact hcm (hΛ2 (hPΛ y)), ?_⟩ + show ι (b y) ∉ _ + rw [hιb, ← hc2] + rintro ⟨z, hz, he⟩ + have h4 : z = P y := hl.injOn (sphere_subset_closedBall hz) (hΛ2 (hPΛ y)) he + have h5 := mem_sphere_zero_iff_norm.mp hz + rw [h4, hPn] at h5 + exact hy ⟨y, Subtype.ext (by simp only [Set.Icc.coe_one]; linarith), rfl⟩ + · rintro ⟨h4, h5⟩ + set z := c' (ι x) with hz + have hcz : c z = ι x := hr h4 + have hz2 : z ∈ closedBall (0 : ℂ) 2 := hcm' h4 + have hzΛ : z ∈ Λ := by + refine ⟨hz2, fun hzb => ?_⟩ + have h6 : c z ∈ Δ := hc1 ▸ mem_image_of_mem c (ball_subset_closedBall hzb) + have h7 : c z ∈ ι '' C := hmeet ▸ ⟨hcz ▸ mem_range_self x, h6⟩ + obtain ⟨y, hy, he⟩ := h7 + have h8 : c ((φ.symm ⟨y, hy⟩ : Circle) : ℂ) = c z := by + rw [hcw', ← he] + simp + have h9 := hl.injOn (hsph _) hz2 h8 + have h10 := mem_ball_zero_iff.mp hzb + rw [← h9, Circle.norm_coe] at h10 + exact lt_irrefl _ h10 + obtain ⟨y, hy⟩ := hPs z hzΛ + have hxb : b y = x := hιi (by rw [hιb, hy, hcz]) + refine ⟨⟨y, hxb⟩, ?_⟩ + rintro ⟨y', hy', he⟩ + apply h5 + rw [← hc2, ← he, hιb] + refine ⟨P y', ?_, rfl⟩ + rw [mem_sphere_zero_iff_norm, hPn, show y'.2 = 1 from hy'] + norm_num + refine ⟨b, hbc, hbi, hbU, hb0, ?_⟩ + rw [hopen] + exact (hΔ'.isOpen_discInt hman').preimage hι.continuous + +/-- The lift of an orientation preserving homeomorphism of the circle moves `t + 2π` to `l t + 2π`. +-/ +theorem lift_period {h : Circle ≃ₜ Circle} {l : ℝ → ℝ} (hl : Continuous l) (hm : StrictMono l) + (he : ∀ t : ℝ, h (Circle.exp t) = Circle.exp (l t)) (t : ℝ) : + l (t + 2 * Real.pi) = l t + 2 * Real.pi := by + have hpi := Real.pi_pos + let k : ℝ → ℝ := fun t => (l (t + 2 * Real.pi) - l t) / (2 * Real.pi) + have hkc : Continuous k := by fun_prop + have hexp : ∀ t, Circle.exp (t + 2 * Real.pi) = Circle.exp t := fun t => by + rw [Circle.exp_add, Circle.exp_two_pi, mul_one] + have hint : ∀ t, k t ∈ range ((↑) : ℤ → ℝ) := fun t => by + have h1 : Circle.exp (l (t + 2 * Real.pi)) = Circle.exp (l t) := by + rw [← he, ← he, hexp] + obtain ⟨m, hm'⟩ := Circle.exp_eq_exp.mp h1 + refine ⟨m, ?_⟩ + change (m : ℝ) = (l (t + 2 * Real.pi) - l t) / (2 * Real.pi) + rw [hm'] + field_simp + ring + have hdisc : IsDiscrete (range ((↑) : ℤ → ℝ)) := + Int.isClosedEmbedding_coe_real.isEmbedding.isDiscrete_range + obtain ⟨y, hy, hconst⟩ := isPreconnected_univ.eqOn_const_of_mapsTo hdisc hkc.continuousOn + (fun t _ => hint t) ⟨0, 0, by simp⟩ + obtain ⟨d, rfl⟩ := hy + have hk : ∀ t, l (t + 2 * Real.pi) = l t + (d : ℝ) * (2 * Real.pi) := fun t => by + have h1 : k t = d := hconst (mem_univ t) + have h2 : (l (t + 2 * Real.pi) - l t) / (2 * Real.pi) = d := h1 + rw [div_eq_iff (by positivity)] at h2 + linarith + have hd1 : 1 ≤ d := by + have h1 := hm (show (0 : ℝ) < 0 + 2 * Real.pi by linarith) + rw [hk] at h1 + have h2 : (0 : ℝ) < (d : ℝ) := by + by_contra hcon + have : (d : ℝ) * (2 * Real.pi) ≤ 0 := + mul_nonpos_of_nonpos_of_nonneg (not_lt.mp hcon) (by positivity) + linarith + exact_mod_cast h2 + have hd2 : d = 1 := by + by_contra hne + have hd : (2 : ℝ) ≤ d := by + have : 2 ≤ d := by omega + exact_mod_cast this + have h0 := hk 0 + rw [zero_add] at h0 + obtain ⟨u, hu, hul⟩ := intermediate_value_Icc (show (0 : ℝ) ≤ 2 * Real.pi by positivity) + hl.continuousOn (show l 0 + 2 * Real.pi ∈ Icc (l 0) (l (2 * Real.pi)) from + ⟨by linarith, by rw [h0]; nlinarith⟩) + have h1 : Circle.exp (l u) = Circle.exp (l 0) := by + rw [hul, Circle.exp_add, Circle.exp_two_pi, mul_one] + rw [← he, ← he] at h1 + have h2 := h.injective h1 + obtain ⟨m, hm'⟩ := Circle.exp_eq_exp.mp h2 + have h3 : u ≠ 0 := fun h4 => by + rw [h4] at hul + linarith + have h4 : u ≠ 2 * Real.pi := fun h5 => by + rw [h5, h0] at hul + nlinarith + have h5 : 0 < u := lt_of_le_of_ne hu.1 h3.symm + have h6 : u < 2 * Real.pi := lt_of_le_of_ne hu.2 h4 + rw [zero_add] at hm' + have h7 : (0 : ℝ) < m := by + by_contra hcon + have : (m : ℝ) * (2 * Real.pi) ≤ 0 := + mul_nonpos_of_nonpos_of_nonneg (not_lt.mp hcon) (by positivity) + linarith + have h8 : (m : ℝ) < 1 := by + by_contra hcon + have : (1 : ℝ) * (2 * Real.pi) ≤ (m : ℝ) * (2 * Real.pi) := + mul_le_mul_of_nonneg_right (not_lt.mp hcon) (by positivity) + linarith + have h9 : 0 < m := by exact_mod_cast h7 + have h10 : m < 1 := by exact_mod_cast h8 + omega + rw [hk, hd2] + simp + +/-- The straight homotopy from `h` to the identity. -/ +theorem exists_circle_homotopy {h : Circle ≃ₜ Circle} (hh : PreservesCircleOrientation h) : + ∃ μ : 𝕀 × Circle → Circle, Continuous μ ∧ (∀ w, μ (0, w) = h w) ∧ (∀ w, μ (1, w) = w) ∧ + ∀ s, Function.Bijective fun w => μ (s, w) := by + obtain ⟨l, hlc, hlm, hle⟩ := hh + have hpi := Real.pi_pos + have hper := lift_period hlc hlm hle + have hsurj : Function.Surjective Circle.exp := fun w => by + obtain ⟨θ, -, hθ⟩ := exists_circle_angle 1 w + exact ⟨θ, by rw [hθ, one_mul]⟩ + have hq : IsQuotientMap Circle.exp := + isLocalHomeomorph_circleExp.isOpenMap.isQuotientMap Circle.exp.continuous hsurj + let D : ℝ → ℝ := fun t => t - l t + have hDp : Function.Periodic D (2 * Real.pi) := fun t => by + change t + 2 * Real.pi - l (t + 2 * Real.pi) = t - l t + rw [hper] + ring + let δ : Circle → ℝ := fun w => D (Function.surjInv hsurj w) + have hδ : ∀ t, δ (Circle.exp t) = D t := fun t => by + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp (Function.surjInv_eq hsurj (Circle.exp t)) + change D (Function.surjInv hsurj (Circle.exp t)) = D t + rw [hm] + exact (hDp.int_mul m) t + have hδc : Continuous δ := by + rw [hq.continuous_iff] + have : δ ∘ Circle.exp = D := funext hδ + rw [this] + exact continuous_id.sub hlc + let μ : 𝕀 × Circle → Circle := fun x => h x.2 * Circle.exp (x.1.1 * δ x.2) + let L : 𝕀 → ℝ → ℝ := fun s t => l t + s.1 * (t - l t) + have hμ : ∀ s t, μ (s, Circle.exp t) = Circle.exp (L s t) := fun s t => by + change h (Circle.exp t) * Circle.exp (s.1 * δ (Circle.exp t)) = _ + rw [hle, hδ, ← Circle.exp_add] + have hLm : ∀ s, StrictMono (L s) := fun s a b hab => by + have h1 := hlm hab + have h2 := s.2.1 + have h3 := s.2.2 + change l a + s.1 * (a - l a) < l b + s.1 * (b - l b) + nlinarith [mul_nonneg h2 (sub_nonneg.mpr hab.le), mul_nonneg (sub_nonneg.mpr h3) + (sub_pos.mpr h1).le] + have hLp : ∀ s t, L s (t + 2 * Real.pi) = L s t + 2 * Real.pi := fun s t => by + change l (t + 2 * Real.pi) + s.1 * (t + 2 * Real.pi - l (t + 2 * Real.pi)) = _ + rw [hper] + change _ = l t + s.1 * (t - l t) + 2 * Real.pi + ring + have hLc : ∀ s, Continuous (L s) := fun s => by + change Continuous fun t => l t + s.1 * (t - l t) + fun_prop + refine ⟨μ, by fun_prop, fun w => ?_, fun w => ?_, fun s => ⟨?_, ?_⟩⟩ + · simp [μ] + · obtain ⟨t, rfl⟩ := hsurj w + rw [hμ] + congr 1 + change l t + (1 : ℝ) * (t - l t) = t + ring + · intro w w' he + obtain ⟨t, rfl⟩ := hsurj w + obtain ⟨θ, hθ, hw'⟩ := exists_circle_angle (Circle.exp t) w' + subst hw' + rw [← Circle.exp_add] at he ⊢ + have he' : Circle.exp (L s t) = Circle.exp (L s (t + θ)) := by + rw [← hμ, ← hμ] + exact he + by_cases h0 : θ = 0 + · rw [h0, add_zero] + · exfalso + have hθ0 : 0 < θ := lt_of_le_of_ne hθ.1 (Ne.symm h0) + have h1 := hLm s (show t < t + θ by linarith) + have h2 := hLm s (show t + θ < t + 2 * Real.pi by linarith [hθ.2]) + rw [hLp] at h2 + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp he' + have h3 : (0 : ℝ) < -(m : ℝ) * (2 * Real.pi) := by linarith + have h4 : -(m : ℝ) * (2 * Real.pi) < 1 * (2 * Real.pi) := by linarith + have h5 : 0 < -(m : ℝ) := (pos_iff_pos_of_mul_pos h3).mpr (by positivity) + have h6 : -(m : ℝ) < 1 := lt_of_mul_lt_mul_right h4 (by positivity) + have h7 : 0 < -m := by exact_mod_cast h5 + have h8 : -m < 1 := by exact_mod_cast h6 + omega + · intro v + obtain ⟨θ, hθ, hv⟩ := exists_circle_angle (Circle.exp (L s 0)) v + obtain ⟨u, -, hu⟩ := intermediate_value_Icc (show (0 : ℝ) ≤ 2 * Real.pi by positivity) + (hLc s).continuousOn (show L s 0 + θ ∈ Icc (L s 0) (L s (2 * Real.pi)) by + have := hLp s 0 + rw [zero_add] at this + rw [this] + exact ⟨by linarith [hθ.1], by linarith [hθ.2]⟩) + refine ⟨Circle.exp u, ?_⟩ + change μ (s, Circle.exp u) = v + rw [hμ, hu, hv, Circle.exp_add] + +/-- **Moving a cuff.** See the module docstring. -/ +theorem move_cuff : MoveCuffStatement.{u} := by + classical + intro S _ C U φ h hS hC hU hCU hh + obtain ⟨hcpt, ht2, hman⟩ := id hS + obtain ⟨μ, hμc, hμ0, hμ1, hμb⟩ := exists_circle_homotopy hh + obtain ⟨b, hbc, hbi, hbU, hb0, hopen⟩ := exists_collar hS hC φ hU hCU + let K := Circle × 𝕀 + let M : K → K := fun x => (μ (x.2, x.1), x.2) + have hMc : Continuous M := by fun_prop + have hMi : Function.Injective M := fun x y (he : M x = M y) => by + have h1 : x.2 = y.2 := (Prod.ext_iff.mp he).2 + have h2 : μ (x.2, x.1) = μ (y.2, y.1) := (Prod.ext_iff.mp he).1 + rw [← h1] at h2 + exact Prod.ext ((hμb x.2).1 h2) h1 + have hMs : Function.Surjective M := fun y => by + obtain ⟨w, hw⟩ := (hμb y.2).2 y.1 + exact ⟨(w, y.2), Prod.ext hw rfl⟩ + have hemb := hbc.isClosedEmbedding hbi + let e : K ≃ₜ range b := hemb.isEmbedding.toHomeomorph + have hee : ∀ k, (e k).1 = b k := fun _ => rfl + let A := range b + let α : S → S := fun x => if hx : x ∈ A then b (M (e.symm ⟨x, hx⟩)) else x + have hαb : ∀ k, α (b k) = b (M k) := fun k => by + have hx : b k ∈ A := ⟨k, rfl⟩ + change (if hx : b k ∈ A then b (M (e.symm ⟨b k, hx⟩)) else b k) = _ + rw [dite_eq_left hx] + congr 2 + exact e.symm_apply_apply k + have hαn : ∀ x, x ∉ A → α x = x := fun x hx => dite_eq_right hx + let V : Set S := A \ b '' {x | x.2 = 1} + have hAc : IsClosed A := hemb.isClosed_range + have hVo : IsOpen V := hopen + have hcA : ContinuousOn α A := by + rw [continuousOn_iff_continuous_domRestrict] + have : A.domRestrict α = fun x : A => b (M (e.symm x)) := by + ext x + change (if hx : x.1 ∈ A then b (M (e.symm ⟨x.1, hx⟩)) else x.1) = _ + rw [dite_eq_left x.2] + rw [this] + exact hbc.comp (hMc.comp e.symm.continuous) + have hcV : ContinuousOn α Vᶜ := by + refine continuousOn_id.congr fun x hx => ?_ + by_cases hxA : x ∈ A + · have hxT : x ∈ b '' {x | x.2 = 1} := by + by_contra hcon + exact hx ⟨hxA, hcon⟩ + obtain ⟨k, hk, rfl⟩ := hxT + rw [hαb] + have h1 : M k = k := by + apply Prod.ext + · change μ (k.2, k.1) = k.1 + rw [show k.2 = 1 from hk] + exact hμ1 _ + · rfl + rw [h1] + rfl + · exact hαn x hxA + have hc : Continuous α := by + rw [← continuousOn_univ] + have huniv : A ∪ Vᶜ = univ := by + rw [eq_univ_iff_forall] + intro x + by_cases hx : x ∈ V + · exact .inl hx.1 + · exact .inr hx + rw [← huniv] + exact hcA.union_of_isClosed hcV hAc hVo.isClosed_compl + have hαi : Function.Injective α := by + intro x y he + by_cases hx : x ∈ A <;> by_cases hy : y ∈ A + · obtain ⟨k, rfl⟩ := hx + obtain ⟨k', rfl⟩ := hy + rw [hαb, hαb] at he + rw [hMi (hbi he)] + · obtain ⟨k, rfl⟩ := hx + rw [hαb, hαn y hy] at he + exact absurd ⟨_, he⟩ hy + · obtain ⟨k, rfl⟩ := hy + rw [hαb, hαn x hx] at he + exact absurd ⟨_, he.symm⟩ hx + · rwa [hαn x hx, hαn y hy] at he + have hαs : Function.Surjective α := by + intro y + by_cases hy : y ∈ A + · obtain ⟨k, rfl⟩ := hy + obtain ⟨k₀, rfl⟩ := hMs k + exact ⟨b k₀, hαb k₀⟩ + · exact ⟨y, hαn y hy⟩ + let E : S ≃ S := Equiv.ofBijective α ⟨hαi, hαs⟩ + have hEc : Continuous E := hc + refine ⟨hEc.homeoOfEquivCompactToT2, fun x => ?_, fun x hx => ?_⟩ + · change α (φ x).1 = _ + rw [← hb0 x, hαb, ← hb0] + change b (μ (0, x), 0) = _ + rw [hμ0] + · exact hαn x fun hxA => hx (hbU hxA) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/NormalVolt.lean b/LeanPool/GraphMinor/Surface/NormalVolt.lean new file mode 100644 index 0000000000..320106f304 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/NormalVolt.lean @@ -0,0 +1,268 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.NormalWord +public import Mathlib.Algebra.BigOperators.Fin + +/-! +# Sums along the normal word + +Give each label a value `V`. Reading the word `ew a b c`, add the value of a letter, or subtract it +for an inverse +letter. `Sm V j` is the sum of the first `j` letters. Handles add nothing, a cross-cap adds twice +its value, and a hole +adds the value of its free side (`Sm_total`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +variable {A : Type} [AddCommGroup A] {a b c : ℕ} + +/-- The corner where the side `p` starts, read along its label. -/ +def st (a b c p : ℕ) : ℕ := if sgn a b c p then p else p + 1 + +/-- The corner where the side `p` ends, read along its label. -/ +def en (a b c p : ℕ) : ℕ := if sgn a b c p then p + 1 else p + +/-- The signed value of the side `j`. -/ +def lv (a b c : ℕ) (V : ℕ → A) (j : ℕ) : A := if sgn a b c j then V (lab a b c j) else - V + (lab a b c j) + +/-- The sum of the first `j` sides. -/ +def Sm (a b c : ℕ) (V : ℕ → A) (j : ℕ) : A := ∑ i ∈ Finset.range j, lv a b c V i + +theorem Sm_succ (V : ℕ → A) (j : ℕ) : Sm a b c V (j + 1) = Sm a b c V j + lv a b c V j := + Finset.sum_range_succ _ _ + +theorem Sm_en (V : ℕ → A) (j : ℕ) : Sm a b c V (en a b c j) = Sm a b c V (st a b c j) + V + (lab a b c j) := by + unfold en st + by_cases h : sgn a b c j + · rw [ite_eq_left h, ite_eq_left h, Sm_succ, lv, ite_eq_left h] + · rw [ite_eq_right h, ite_eq_right h, Sm_succ, lv, ite_eq_right h] + abel + +theorem lab_h {i δ : ℕ} (hi : i < a) (hδ : δ < 4) : lab a b c (4 * i + δ) = 2 * i + δ % 2 := by + unfold lab + rw [ite_eq_left (by omega)] + omega + +theorem sgn_h {i δ : ℕ} (hi : i < a) (hδ : δ < 4) : sgn a b c (4 * i + δ) = decide (δ < 2) := by + unfold sgn + rw [ite_eq_left (by omega)] + congr 1 + apply propext + omega + +theorem lab_c {i δ : ℕ} (hi : i < b) (hδ : δ < 2) : lab a b c (4 * a + 2 * i + δ) = 2 * a + i := by + unfold lab + rw [ite_eq_right (by omega), ite_eq_left (by omega)] + omega + +theorem sgn_c {i δ : ℕ} (hi : i < b) (hδ : δ < 2) : sgn a b c (4 * a + 2 * i + δ) = true := by + unfold sgn + rw [ite_eq_right (by omega), ite_eq_left (by omega)] + +theorem lab_t {i δ : ℕ} (hi : i < c) (hδ : δ < 3) : + lab a b c (4 * a + 2 * b + 3 * i + δ) = 2 * a + b + 2 * i + δ % 2 := by + unfold lab + rw [ite_eq_right (by omega), ite_eq_right (by omega), ite_eq_left (by omega)] + omega + +theorem sgn_t {i δ : ℕ} (hi : i < c) (hδ : δ < 3) : sgn a b c (4 * a + 2 * b + 3 * i + δ) = decide + (δ < 2) := by + unfold sgn + rw [ite_eq_right (by omega), ite_eq_right (by omega), ite_eq_left (by omega)] + congr 1 + apply propext + omega + +theorem lab_l {δ : ℕ} : lab a b c (4 * a + 2 * b + 3 * c + δ) = 2 * a + b + 2 * c := by + unfold lab + rw [ite_eq_right (by omega), ite_eq_right (by omega), ite_eq_right (by omega)] + +theorem sgn_l {δ : ℕ} : sgn a b c (4 * a + 2 * b + 3 * c + δ) = decide (δ = 0) := by + unfold sgn + rw [ite_eq_right (by omega), ite_eq_right (by omega), ite_eq_right (by omega)] + congr 1 + apply propext + omega + +theorem lv_h (V : ℕ → A) {i δ : ℕ} (hi : i < a) (hδ : δ < 4) : lv a b c V (4 * i + δ) = + if δ < 2 then V (2 * i + δ % 2) else - V (2 * i + δ % 2) := by + simp only [lv, lab_h hi hδ, sgn_h hi hδ, decide_eq_true_eq] + +theorem lv_c (V : ℕ → A) {i δ : ℕ} (hi : i < b) (hδ : δ < 2) : lv a b c V (4 * a + 2 * i + δ) = V + (2 * a + i) := by + simp only [lv, lab_c hi hδ, sgn_c hi hδ, ite_true] + +theorem lv_t (V : ℕ → A) {i δ : ℕ} (hi : i < c) (hδ : δ < 3) : lv a b c V + (4 * a + 2 * b + 3 * i + δ) = + if δ < 2 then V (2 * a + b + 2 * i + δ % 2) else - V (2 * a + b + 2 * i + δ % 2) := by + simp only [lv, lab_t hi hδ, sgn_t hi hδ, decide_eq_true_eq] + +theorem Sm_handle (V : ℕ → A) {i : ℕ} (hi : i < a) : Sm a b c V (4 * (i + 1)) = Sm a b c V (4 * i) + := by + have e : 4 * (i + 1) = 4 * i + 3 + 1 := by ring + rw [e, Sm_succ, Sm_succ, Sm_succ, Sm_succ] + rw [show 4 * i = 4 * i + 0 from rfl, lv_h V hi (δ := 0) (by norm_num), + lv_h V hi (δ := 1) (by norm_num), + lv_h V hi (δ := 2) (by norm_num), lv_h V hi (δ := 3) (by norm_num)] + simp only [Nat.add_zero, Nat.zero_mod, Nat.reduceMod, Nat.reduceLT, ite_true, ite_false, + Nat.ofNat_pos] + abel + +theorem Sm_cap (V : ℕ → A) {i : ℕ} (hi : i < b) : + Sm a b c V (4 * a + 2 * (i + 1)) = Sm a b c V (4 * a + 2 * i) + 2 • V (2 * a + i) := by + have e : 4 * a + 2 * (i + 1) = 4 * a + 2 * i + 1 + 1 := by ring + rw [e, Sm_succ, Sm_succ] + rw [show 4 * a + 2 * i = 4 * a + 2 * i + 0 from rfl, lv_c V hi (δ := 0) (by norm_num), + lv_c V hi (δ := 1) (by norm_num)] + simp only [Nat.add_zero, two_nsmul, add_assoc] + +theorem Sm_hole (V : ℕ → A) {i : ℕ} (hi : i < c) : Sm a b c V (4 * a + 2 * b + 3 * (i + 1)) = + Sm a b c V (4 * a + 2 * b + 3 * i) + V (2 * a + b + 2 * i + 1) := by + have e : 4 * a + 2 * b + 3 * (i + 1) = 4 * a + 2 * b + 3 * i + 2 + 1 := by ring + rw [e, Sm_succ, Sm_succ, Sm_succ] + rw [show 4 * a + 2 * b + 3 * i = 4 * a + 2 * b + 3 * i + 0 from rfl, + lv_t V hi (δ := 0) (by norm_num), + lv_t V hi (δ := 1) (by norm_num), lv_t V hi (δ := 2) (by norm_num)] + simp only [Nat.add_zero, Nat.zero_mod, Nat.reduceMod, Nat.reduceLT, ite_true, ite_false, + Nat.ofNat_pos] + abel + +theorem Sm_last (V : ℕ → A) : Sm a b c V (4 * a + 2 * b + 3 * c + 2) = Sm a b c V + (4 * a + 2 * b + 3 * c) := by + have e1 : ∀ δ, lv a b c V (4 * a + 2 * b + 3 * c + δ) = + if δ = 0 then V (2 * a + b + 2 * c) else - V (2 * a + b + 2 * c) := fun δ => by + simp only [lv, lab_l, sgn_l, decide_eq_true_eq] + have e2 : 4 * a + 2 * b + 3 * c + 2 = 4 * a + 2 * b + 3 * c + 1 + 1 := rfl + rw [e2, Sm_succ, Sm_succ, e1 1, show 4 * a + 2 * b + 3 * c = 4 * a + 2 * b + 3 * c + 0 from rfl, + e1 0] + simp + +theorem Sm_handles (V : ℕ → A) {i : ℕ} (hi : i ≤ a) : Sm a b c V (4 * i) = 0 := by + induction i with + | zero => simp [Sm] + | succ i ih => rw [Sm_handle V (by omega), ih (by omega)] + +theorem Sm_caps (V : ℕ → A) {i : ℕ} (hi : i ≤ b) : + Sm a b c V (4 * a + 2 * i) = 2 • ∑ l ∈ Finset.range i, V (2 * a + l) := by + induction i with + | zero => + have := Sm_handles (a := a) (b := b) (c := c) V le_rfl + simpa using this + | succ i ih => rw [Sm_cap V (by omega), ih (by omega), Finset.sum_range_succ, smul_add] + +theorem Sm_holes (V : ℕ → A) {i : ℕ} (hi : i ≤ c) : Sm a b c V (4 * a + 2 * b + 3 * i) = + 2 • (∑ l ∈ Finset.range b, V (2 * a + l)) + ∑ l ∈ Finset.range i, V (2 * a + b + 2 * l + 1) + := by + induction i with + | zero => + have := Sm_caps (a := a) (b := b) (c := c) V le_rfl + simpa using this + | succ i ih => rw [Sm_hole V (by omega), ih (by omega), Finset.sum_range_succ, add_assoc] + +theorem Sm_total (V : ℕ → A) : Sm a b c V (4 * a + 2 * b + 3 * c + 2) = + 2 • (∑ l ∈ Finset.range b, V (2 * a + l)) + ∑ l ∈ Finset.range c, V (2 * a + b + 2 * l + 1) + := by + rw [Sm_last, Sm_holes V le_rfl] + +theorem twin_eq_iff {p : ℕ} (hp : p < 4 * a + 2 * b + 3 * c + 2) : + twin a b c p = p ↔ ∃ i < c, p = 4 * a + 2 * b + 3 * i + 1 := by + unfold twin + constructor + · intro h + refine ⟨(p - (4 * a + 2 * b)) / 3, ?_, ?_⟩ <;> split_ifs at h <;> omega + · rintro ⟨i, hi, rfl⟩ + rw [ite_eq_right (by omega), ite_eq_right (by omega), ite_eq_left (by omega), ite_eq_right + (by omega), ite_eq_right (by omega)] + +theorem st_lt {p : ℕ} (hp : p < 4 * a + 2 * b + 3 * c + 2) : st a b c p ≤ 4 * a + 2 * b + 3 * c + 2 + := by + unfold st + split_ifs <;> omega + +theorem en_lt {p : ℕ} (hp : p < 4 * a + 2 * b + 3 * c + 2) : en a b c p ≤ 4 * a + 2 * b + 3 * c + 2 + := by + unfold en + split_ifs <;> omega + +/-- If the values of the loops and of the free sides are zero, then the sum vanishes at the start of +each side that is +not free. -/ +theorem Sm_st_zero (V : ℕ → A) (h1 : ∀ k < 2 * a + b, V k = 0) (h2 : ∀ i < c, V + (2 * a + b + 2 * i + 1) = 0) {p : ℕ} + (hp : p < 4 * a + 2 * b + 3 * c + 2) (ht : twin a b c p ≠ p) : Sm a b c V (st a b c p) = 0 := by + have hb : ∑ l ∈ Finset.range b, V (2 * a + l) = 0 := Finset.sum_eq_zero fun l hl => h1 _ (by + have := Finset.mem_range.mp hl + omega) + have hc : ∀ i ≤ c, Sm a b c V (4 * a + 2 * b + 3 * i) = 0 := fun i hi => by + rw [Sm_holes V hi, hb, smul_zero, zero_add] + exact Finset.sum_eq_zero fun l hl => h2 _ (by + have := Finset.mem_range.mp hl + omega) + have hlow : ∀ j ≤ 4 * a + 2 * b, Sm a b c V j = 0 := by + intro j + induction j with + | zero => intro _; simp [Sm] + | succ j ih => + intro hj + rw [Sm_succ, ih (by omega), zero_add, lv] + have h3 : lab a b c j < 2 * a + b := by + unfold lab + split_ifs <;> omega + rw [h1 _ h3] + simp + by_cases hp1 : p < 4 * a + 2 * b + · refine hlow _ ?_ + unfold st + split_ifs <;> omega + by_cases hp2 : p < 4 * a + 2 * b + 3 * c + · obtain ⟨x, rfl⟩ : ∃ x, p = 4 * a + 2 * b + x := ⟨p - (4 * a + 2 * b), by omega⟩ + have hd : x % 3 = 0 ∨ x % 3 = 2 := by + by_contra hcon + apply ht + refine (twin_eq_iff hp).mpr ⟨x / 3, by omega, by omega⟩ + rcases hd with hd | hd + · have e : 4 * a + 2 * b + x = 4 * a + 2 * b + 3 * (x / 3) + 0 := by omega + have h4 : st a b c (4 * a + 2 * b + x) = 4 * a + 2 * b + 3 * (x / 3) := by + unfold st + rw [e, sgn_t (by omega) (by norm_num)] + simp + rw [h4] + exact hc _ (by omega) + · have e : 4 * a + 2 * b + x = 4 * a + 2 * b + 3 * (x / 3) + 2 := by omega + have h4 : st a b c (4 * a + 2 * b + x) = 4 * a + 2 * b + 3 * (x / 3 + 1) := by + unfold st + rw [e, sgn_t (by omega) (by norm_num)] + simp + omega + rw [h4] + exact hc _ (by omega) + · obtain ⟨x, hx, rfl⟩ : ∃ x, x < 2 ∧ p = 4 * a + 2 * b + 3 * c + x := ⟨p - + (4 * a + 2 * b + 3 * c), by omega, by omega⟩ + interval_cases x + · have h4 : st a b c (4 * a + 2 * b + 3 * c + 0) = 4 * a + 2 * b + 3 * c := by + unfold st + rw [sgn_l] + simp + rw [h4] + exact hc _ le_rfl + · have h4 : st a b c (4 * a + 2 * b + 3 * c + 1) = 4 * a + 2 * b + 3 * c + 2 := by + unfold st + rw [sgn_l] + simp + rw [h4, Sm_last] + exact hc _ le_rfl + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/NormalWord.lean b/LeanPool/GraphMinor/Surface/NormalWord.lean new file mode 100644 index 0000000000..775656aa04 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/NormalWord.lean @@ -0,0 +1,363 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ModelHomeo +public import LeanPool.GraphMinor.Surface.WordSurface + +/-! +# The normal word of a model surface + +`ew a b c` is the normal form word of the model surface $\Sigma(a, b, c)$ with two more sides `x +x⁻¹` at the end. So it +is never empty. We give its letters by a formula (`ew_get`), and each model surface is presented by +this word +(`presents_ew`). So the model surfaces are surfaces (`isSurface_model`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Function + +/-- The label of the side `j`. -/ +def lab (a b c j : ℕ) : ℕ := + if j < 4 * a then 2 * (j / 4) + (j % 4) % 2 + else if j < 4 * a + 2 * b then 2 * a + (j - 4 * a) / 2 + else if j < 4 * a + 2 * b + 3 * c then + 2 * a + b + 2 * ((j - (4 * a + 2 * b)) / 3) + ((j - (4 * a + 2 * b)) % 3) % 2 + else 2 * a + b + 2 * c + +/-- The sign of the side `j`. -/ +def sgn (a b c j : ℕ) : Bool := + if j < 4 * a then decide (j % 4 < 2) + else if j < 4 * a + 2 * b then true + else if j < 4 * a + 2 * b + 3 * c then decide ((j - (4 * a + 2 * b)) % 3 < 2) + else decide (j = 4 * a + 2 * b + 3 * c) + +/-- The normal word with two more sides. -/ +def ew (a b c : ℕ) : List Letter := nfW a b c ++ [(2 * a + b + 2 * c, true), + (2 * a + b + 2 * c, false)] + +theorem hW_length (k a : ℕ) : (hW k a).length = 4 * a := by + induction a generalizing k with + | zero => rfl + | succ a ih => simp [hW, hndB, ih]; omega + +theorem cW_length (k a : ℕ) : (cW k a).length = 2 * a := by + induction a generalizing k with + | zero => rfl + | succ a ih => simp [cW, ih]; omega + +theorem tW_length (k a : ℕ) : (tW k a).length = 3 * a := by + induction a generalizing k with + | zero => rfl + | succ a ih => simp [tW, holB, ih]; omega + +theorem hW_get (a : ℕ) : ∀ k j, j < 4 * a → (hW k a)[j]? = some (k + 2 * (j / 4) + + (j % 4) % 2, decide (j % 4 < 2)) := by + induction a with + | zero => intro k j h; omega + | succ a ih => + intro k j hj + by_cases h : j < 4 + · interval_cases j <;> simp [hW, hndB, linv] + · have hlen : (hndB (k, true) (k + 1, true)).length = 4 := rfl + rw [hW, List.getElem?_append_right (by rw [hlen]; omega), hlen, ih _ _ (by omega)] + have e1 : k + 2 + 2 * ((j - 4) / 4) + (j - 4) % 4 % 2 = k + 2 * (j / 4) + j % 4 % 2 := by + omega + have e2 : ((j - 4) % 4 < 2) ↔ (j % 4 < 2) := by omega + rw [e1, decide_eq_decide.mpr e2] + +theorem cW_get (a : ℕ) : ∀ k j, j < 2 * a → (cW k a)[j]? = some (k + j / 2, true) := by + induction a with + | zero => intro k j h; omega + | succ a ih => + intro k j hj + by_cases h : j < 2 + · interval_cases j <;> simp [cW] + · have hlen : ([(k, true), (k, true)] : List Letter).length = 2 := rfl + rw [cW, List.getElem?_append_right (by rw [hlen]; omega), hlen, ih _ _ (by omega)] + congr 2 + omega + +theorem tW_get (a : ℕ) : ∀ k j, j < 3 * a → (tW k a)[j]? = some (k + 2 * (j / 3) + + (j % 3) % 2, decide (j % 3 < 2)) := by + induction a with + | zero => intro k j h; omega + | succ a ih => + intro k j hj + by_cases h : j < 3 + · interval_cases j <;> simp [tW, holB, linv] + · have hlen : (holB (k, true) (k + 1, true)).length = 3 := rfl + rw [tW, List.getElem?_append_right (by rw [hlen]; omega), hlen, ih _ _ (by omega)] + have e1 : k + 2 + 2 * ((j - 3) / 3) + (j - 3) % 3 % 2 = k + 2 * (j / 3) + j % 3 % 2 := by + omega + have e2 : ((j - 3) % 3 < 2) ↔ (j % 3 < 2) := by omega + rw [e1, decide_eq_decide.mpr e2] + +theorem ew_length (a b c : ℕ) : (ew a b c).length = 4 * a + 2 * b + 3 * c + 2 := by + simp [ew, nfW, hW_length, cW_length, tW_length] + omega + +theorem ew_get (a b c : ℕ) {j : ℕ} (hj : j < 4 * a + 2 * b + 3 * c + 2) : (ew a b c)[j]? = some + (lab a b c j, sgn a b c j) := by + have h1 := hW_length 0 a + have h2 := cW_length (2 * a) b + have h3 := tW_length (2 * a + b) c + unfold ew nfW lab sgn + simp only [List.append_assoc] + by_cases j1 : j < 4 * a + · rw [List.getElem?_append_left (by omega), hW_get a 0 j j1] + simp [j1] + rw [List.getElem?_append_right (by omega), h1, ite_eq_right j1, ite_eq_right j1] + by_cases j2 : j < 4 * a + 2 * b + · rw [List.getElem?_append_left (by omega), cW_get b _ _ (by omega)] + simp [j2] + rw [List.getElem?_append_right (by omega), h2, ite_eq_right j2, ite_eq_right j2] + by_cases j3 : j < 4 * a + 2 * b + 3 * c + · rw [List.getElem?_append_left (by omega), tW_get c _ _ (by omega)] + simp only [j3, ite_true] + have e1 : j - 4 * a - 2 * b = j - (4 * a + 2 * b) := by omega + rw [e1] + rw [List.getElem?_append_right (by omega), h3, ite_eq_right j3, ite_eq_right j3] + have e : j = 4 * a + 2 * b + 3 * c ∨ j = 4 * a + 2 * b + 3 * c + 1 := by omega + rcases e with rfl | rfl + · have e1 : 4 * a + 2 * b + 3 * c - 4 * a - 2 * b - 3 * c = 0 := by omega + simp [e1] + · have e1 : 4 * a + 2 * b + 3 * c + 1 - 4 * a - 2 * b - 3 * c = 1 := by omega + simp [e1] + +theorem ew_get_iff (a b c p k : ℕ) (e : Bool) : (ew a b c)[p]? = some (k, e) ↔ + p < 4 * a + 2 * b + 3 * c + 2 ∧ lab a b c p = k ∧ sgn a b c p = e := by + constructor + · intro h + have hp : p < (ew a b c).length := (List.getElem?_eq_some_iff.mp h).1 + rw [ew_length] at hp + rw [ew_get a b c hp] at h + obtain ⟨h1, h2⟩ := Prod.mk.inj (Option.some.inj h) + exact ⟨hp, h1, h2⟩ + · rintro ⟨h1, rfl, rfl⟩ + exact ew_get a b c h1 + +/-- The other side with the same label. A free side is its own twin. -/ +def twin (a b c p : ℕ) : ℕ := + if p < 4 * a then (if p % 4 < 2 then p + 2 else p - 2) + else if p < 4 * a + 2 * b then (if (p - 4 * a) % 2 = 0 then p + 1 else p - 1) + else if p < 4 * a + 2 * b + 3 * c then + (if (p - (4 * a + 2 * b)) % 3 = 0 then p + 2 else if (p - (4 * a + 2 * b)) % 3 + = 2 then p - 2 else p) + else if p = 4 * a + 2 * b + 3 * c then p + 1 else p - 1 + +theorem lab_two {a b c p q : ℕ} (hp : p < 4 * a + 2 * b + 3 * c + 2) (hq : q < 4 * a + 2 * b + 3 * + c + 2) + (h1 : lab a b c p = lab a b c q) : q = p ∨ q = twin a b c p := by + unfold lab at h1 + unfold twin + by_cases h2 : p < 4 * a + · have h3 : q < 4 * a := by + by_contra hc + split_ifs at h1 <;> omega + simp only [h2, h3, ite_true] at h1 ⊢ + split_ifs <;> omega + by_cases h4 : p < 4 * a + 2 * b + · have h3 : ¬ q < 4 * a := by + intro hc + split_ifs at h1; omega + have h5 : q < 4 * a + 2 * b := by + by_contra hc + split_ifs at h1 <;> omega + simp only [h2, h3, h4, h5, ite_true, ite_false] at h1 ⊢ + split_ifs <;> omega + by_cases h6 : p < 4 * a + 2 * b + 3 * c + · have h3 : ¬ q < 4 * a := by + intro hc + split_ifs at h1; omega + have h5 : ¬ q < 4 * a + 2 * b := by + intro hc + split_ifs at h1; omega + have h7 : q < 4 * a + 2 * b + 3 * c := by + by_contra hc + simp only [h2, h3, h4, h5, h6, hc, ite_true, ite_false] at h1 + omega + simp only [h2, h3, h4, h5, h6, h7, ite_true, ite_false] at h1 ⊢ + obtain ⟨x, rfl⟩ : ∃ x, p = 4 * a + 2 * b + x := ⟨p - (4 * a + 2 * b), by omega⟩ + obtain ⟨y, rfl⟩ : ∃ y, q = 4 * a + 2 * b + y := ⟨q - (4 * a + 2 * b), by omega⟩ + simp only [Nat.add_sub_cancel_left] at h1 ⊢ + split_ifs <;> omega + · have h3 : ¬ q < 4 * a := by + intro hc + split_ifs at h1; omega + have h5 : ¬ q < 4 * a + 2 * b := by + intro hc + split_ifs at h1; omega + have h7 : ¬ q < 4 * a + 2 * b + 3 * c := by + intro hc + simp only [h2, h3, h4, h5, h6, hc, ite_true, ite_false] at h1 + obtain ⟨y, rfl⟩ : ∃ y, q = 4 * a + 2 * b + y := ⟨q - (4 * a + 2 * b), by omega⟩ + simp only [Nat.add_sub_cancel_left] at h1 + omega + simp only [h2, h4, h6, ite_false] + split_ifs <;> omega + +theorem twin_lt {a b c p : ℕ} (hp : p < 4 * a + 2 * b + 3 * c + 2) : twin a b c p < 4 * a + 2 * b + + 3 * c + 2 := by + unfold twin + split_ifs <;> omega + +theorem lab_twin {a b c p : ℕ} (hp : p < 4 * a + 2 * b + 3 * c + 2) : lab a b c (twin a b c p) + = lab a b c p := by + unfold twin lab + split_ifs <;> first | rfl | omega + +theorem lab_three {a b c p q r : ℕ} (hp : p < 4 * a + 2 * b + 3 * c + 2) + (hq : q < 4 * a + 2 * b + 3 * c + 2) + (hr : r < 4 * a + 2 * b + 3 * c + 2) (h1 : lab a b c p = lab a b c q) (h2 : lab a b c q + = lab a b c r) : + p = q ∨ q = r ∨ p = r := by + rcases lab_two hp hq h1 with h3 | h3 + · exact .inl h3.symm + · rcases lab_two hp hr (h1.trans h2) with h4 | h4 + · exact .inr (.inr h4.symm) + · exact .inr (.inl (h3.trans h4.symm)) + +theorem encard_le_two_of {α : Type*} {S : Set α} (h : ∀ x ∈ S, ∀ y ∈ S, ∀ z ∈ S, x = y ∨ y = z ∨ x + = z) : + S.encard ≤ 2 := by + classical + by_cases h0 : S = ∅ + · simp [h0] + obtain ⟨x, hx⟩ := nonempty_iff_ne_empty.mpr h0 + by_cases h1 : S ⊆ {x} + · refine (encard_le_encard h1).trans ?_ + rw [encard_singleton] + norm_num + obtain ⟨y, hy, hne⟩ := not_subset.mp h1 + have hs : S ⊆ {x, y} := fun z hz => by + rcases h x hx y hy z hz with h2 | h2 | h2 + · exact absurd h2.symm hne + · exact .inr h2.symm + · exact .inl h2.symm + refine (encard_le_encard hs).trans ((encard_insert_le _ _).trans ?_) + rw [encard_singleton] + norm_num + +theorem sW_get {w : List Letter} {i p : ℕ} {l : Letter} (h : (sW w i)[p]? = some l) : i = 0 ∧ w[p]? + = some l := by + by_cases hi : i = 0 + · subst hi + simpa [sW] using h + · simp [sW, hi, nW] at h + +theorem sW_zero (w : List Letter) : sW w 0 = w := by simp [sW] + +theorem isPaired_ew (a b c : ℕ) : IsPaired (sW (ew a b c)) := by + intro k + refine encard_le_two_of ?_ + rintro ⟨i, p⟩ ⟨e, hp⟩ ⟨i', q⟩ ⟨e', hq⟩ ⟨i'', r⟩ ⟨e'', hr⟩ + obtain ⟨rfl, h1⟩ := sW_get hp + obtain ⟨rfl, h2⟩ := sW_get hq + obtain ⟨rfl, h3⟩ := sW_get hr + obtain ⟨h4, h5, -⟩ := (ew_get_iff _ _ _ _ _ _).mp h1 + obtain ⟨h6, h7, -⟩ := (ew_get_iff _ _ _ _ _ _).mp h2 + obtain ⟨h8, h9, -⟩ := (ew_get_iff _ _ _ _ _ _).mp h3 + rcases lab_three h4 h6 h8 (h5.trans h7.symm) (h7.trans h9.symm) with rfl | rfl | rfl <;> simp + +theorem presents_comp {W : ℕ → List Letter} {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + {f : ℕ × ℂ → X} + (hf : Presents W f) (e : X ≃ₜ Y) : Presents W (e ∘ f) := by + refine ⟨e.continuous.comp_continuousOn hf.1, ?_, fun a ha b hb => ?_⟩ + · rw [image_comp, hf.2.1] + exact e.surjective.range_eq ▸ image_univ + · simp only [Function.comp, e.injective.eq_iff] + exact hf.2.2 a ha b hb + +theorem nfW_noLab (a b c : ℕ) : NoLab (nfW a b c) (2 * a + b + 2 * c) := by + intro l hl + simp only [nfW, List.mem_append] at hl + rcases hl with (hl | hl) | hl + · have := hW_labels _ _ l hl + omega + · have := cW_labels _ _ l hl + omega + · have := tW_labels _ _ l hl + omega + +theorem nfW_length (a b c : ℕ) : (nfW a b c).length = 4 * a + 2 * b + 3 * c := by + simp [nfW, hW_length, cW_length, tW_length] + omega + +theorem peq_modelW_ew (a b c : ℕ) : PEq.{0} (modelW a b (2 * a + b + c)) (sW (ew a b c)) := by + obtain ⟨w, h1, h2⟩ := exists_modelW_nf.{0} a b c + rcases h2 with ⟨h2, hne⟩ | ⟨hn, rfl⟩ + · have h3 : WEq.{0} w (nfW a b c) := nf_eq h2 (isNF_nfW a b c) + have hne' : nfW a b c ≠ [] := by + intro he + have := nfW_length a b c + rw [he] at this + simp only [List.length_nil] at this + omega + have h4 : WEq.{0} (nfW a b c) ([(2 * a + b + 2 * c, true), (2 * a + b + 2 * c, false)] ++ nfW a + b c) := + peq_fold finW_nW true hne' (freshIn_sW (nfW_noLab a b c)) + exact h1.trans (h3.trans (h4.trans (WEq.rot _ _))) + · have ha : a = 0 := by omega + have hb : b = 0 := by omega + have hc : c = 0 := by omega + subst ha hb hc + refine h1.trans ?_ + exact WEq.rot [linv (segL 0)] [segL 0] + +theorem ew_mem_dsk (a b c : ℕ) : ((0 : ℕ), (0 : ℂ)) ∈ Dsk (sW (ew a b c)) := by + refine ⟨?_, by simp⟩ + rw [sW_zero] + intro he + have := ew_length a b c + rw [he] at this + simp at this + +/-- A model surface is Hausdorff and presented by the word `ew`. -/ +theorem presents_ew (a b c : ℕ) : T2Space (SurfaceModel a b c) ∧ + ∃ f : ℕ × ℂ → SurfaceModel a b c, Presents (sW (ew a b c)) f := by + have h0 : (Dsk (sW (ew a b c))).Nonempty := ⟨_, ew_mem_dsk a b c⟩ + have ht := t2Space_wordSpace (finW_sW (ew a b c)) (isPaired_ew a b c) + have hp := presents_wordMap h0 + obtain ⟨g, hg⟩ := (peq_modelW_ew a b c (WordSpace (sW (ew a b c)))).mpr ⟨wordMap h0, hp⟩ + obtain ⟨e⟩ := model_homeo a b c hg + refine ⟨e.symm.isEmbedding.t2Space, e ∘ wordMap h0, presents_comp hp e⟩ + +/-- The model surfaces are connected surfaces. -/ +theorem isSurface_model (a b c : ℕ) : IsSurface (SurfaceModel a b c) ∧ ConnectedSpace + (SurfaceModel a b c) := by + obtain ⟨ht, f, hf⟩ := presents_ew a b c + have := ht + refine ⟨(surface_of_presents (finW_sW _) (isPaired_ew a b c) hf).1, ?_⟩ + have hsub : ∀ z : ℂ, z ∈ Metric.closedBall (0 : ℂ) 1 → ((0 : ℕ), z) ∈ Dsk (sW (ew a b c)) + := fun z hz => + ⟨(ew_mem_dsk a b c).1, by simpa using hz⟩ + have hc : ContinuousOn (fun z : ℂ => f (0, z)) (Metric.closedBall 0 1) := hf.1.comp + (by fun_prop) hsub + have himg : (fun z : ℂ => f (0, z)) '' Metric.closedBall 0 1 = univ := by + refine eq_univ_of_forall fun y => ?_ + have h1 : y ∈ f '' Dsk (sW (ew a b c)) := by + rw [hf.2.1] + exact mem_univ y + obtain ⟨⟨i, z⟩, hz, rfl⟩ := h1 + have hi : i = 0 := by + by_contra hi + exact hz.1 (by simp [sW, hi, nW]) + subst hi + exact ⟨z, by simpa using hz.2, rfl⟩ + have h3 : IsPreconnected (univ : Set (SurfaceModel a b c)) := by + rw [← himg] + exact (convex_closedBall (0 : ℂ) 1).isPreconnected.image _ hc + exact { toPreconnectedSpace := ⟨h3⟩, toNonempty := ⟨f (0, 0)⟩ } + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/OneManifold.lean b/LeanPool/GraphMinor/Surface/OneManifold.lean new file mode 100644 index 0000000000..0b7493584b --- /dev/null +++ b/LeanPool/GraphMinor/Surface/OneManifold.lean @@ -0,0 +1,576 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CrossCut +import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# Compact connected curves + +`exists_homeomorph_circle`: a compact connected Hausdorff space in which every point has a +neighbourhood that is an open interval is a circle. + +The proof grows a closed arc. Take finitely many interval charts that cover the space, and let `N` +be the finite set of the ends of the charts. An end `q` of an arc lies in a chart. Near `q`, the arc +lies on one side of `q` in the chart, as it is connected. So we can walk from `q` along the other +side towards the end of the chart. Either we reach this end, and then the arc gained a point of `N`, +or we meet the arc again. By invariance of domain in dimension one, an interior point of the arc has +a neighbourhood in the arc, so we can only meet the other end of the arc. Then we have a circle. The +circle is open and closed, so it is the whole space. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Filter + +local notation "𝕀" => unitInterval + +universe u + +variable {X : Type u} [TopologicalSpace X] [T2Space X] + +/-- A closed interval chart: an embedding of `[-1, 1]` that is open on `(-1, 1)`. -/ +def IsCurveChart (ψ : ℝ → X) : Prop := + ContinuousOn ψ (Icc (-1) 1) ∧ InjOn ψ (Icc (-1) 1) ∧ IsOpen (ψ '' Ioo (-1) 1) + +/-- A continuous injective map on a compact interval has a continuous inverse on the image. -/ +private theorem exists_inv_Icc {a b : ℝ} {f : ℝ → X} (hc : ContinuousOn f (Icc a b)) + (hi : InjOn f (Icc a b)) : + ∃ f' : X → ℝ, ContinuousOn f' (f '' Icc a b) ∧ LeftInvOn f' f (Icc a b) := by + classical + by_cases hne : (Icc a b).Nonempty + · have hcs : CompactSpace (Icc a b) := isCompact_iff_compactSpace.mp isCompact_Icc + have hemb : IsEmbedding (fun x : Icc a b => f x.1) := + ((continuousOn_iff_continuous_domRestrict.mp hc).isClosedEmbedding + fun x y h => Subtype.ext (hi x.2 y.2 h)).isEmbedding + let E := hemb.toHomeomorph + have hmem : ∀ y ∈ f '' Icc a b, y ∈ range fun x : Icc a b => f x.1 := by + rintro _ ⟨x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + refine ⟨fun y => if hy : y ∈ f '' Icc a b then (E.symm ⟨y, hmem y hy⟩).1 else 0, ?_, ?_⟩ + · rw [continuousOn_iff_continuous_domRestrict] + have h1 : (f '' Icc a b).domRestrict + (fun y => if hy : y ∈ f '' Icc a b then (E.symm ⟨y, hmem y hy⟩).1 else 0) = + fun y : f '' Icc a b => (E.symm ⟨y.1, hmem y.1 y.2⟩).1 := by + ext y + simp [Set.domRestrict, y.2] + rw [h1] + exact continuous_subtype_val.comp (E.symm.continuous.comp (Continuous.subtype_mk + continuous_subtype_val _)) + · intro x hx + have hm : f x ∈ f '' Icc a b := mem_image_of_mem f hx + simp only [hm, dite_true] + have h2 : (⟨f x, hmem _ hm⟩ : range fun x : Icc a b => f x.1) = E ⟨x, hx⟩ := rfl + rw [h2, E.symm_apply_apply] + · exact ⟨fun _ => 0, continuousOn_const, fun x hx => absurd ⟨x, hx⟩ hne⟩ + +namespace IsCurveChart + +variable {ψ : ℝ → X} + +/-- The image of an open subset of `(-1, 1)` is open. -/ +theorem isOpen_image (h : IsCurveChart ψ) {O : Set ℝ} (hO : IsOpen O) (hsub : O ⊆ Ioo (-1) 1) : + IsOpen (ψ '' O) := by + obtain ⟨ψ', hc, hl⟩ := exists_inv_Icc h.1 h.2.1 + have hc' : ContinuousOn ψ' (ψ '' Ioo (-1) 1) := hc.mono (image_mono Ioo_subset_Icc_self) + have heq : ψ '' O = ψ '' Ioo (-1) 1 ∩ ψ' ⁻¹' O := by + ext y + constructor + · rintro ⟨x, hx, rfl⟩ + refine ⟨mem_image_of_mem ψ (hsub hx), ?_⟩ + change ψ' (ψ x) ∈ O + rwa [hl (Ioo_subset_Icc_self (hsub hx))] + · rintro ⟨⟨x, hx, rfl⟩, hy⟩ + have hy' : ψ' (ψ x) ∈ O := hy + rw [hl (Ioo_subset_Icc_self hx)] at hy' + exact ⟨x, hy', rfl⟩ + rw [heq] + exact hc'.isOpen_inter_preimage h.2.2 hO + +/-- A continuous injective map from a real interval into a curve has a neighbourhood of the middle +point in its image. This is invariance of domain in dimension one. -/ +theorem image_mem_nhds (h : IsCurveChart ψ) {f : ℝ → X} {t ε : ℝ} (hε : 0 < ε) + (hc : ContinuousOn f (Icc (t - ε) (t + ε))) (hi : InjOn f (Icc (t - ε) (t + ε))) {s : ℝ} + (hs : s ∈ Ioo (-1 : ℝ) 1) (hft : f t = ψ s) : f '' Ioo (t - ε) (t + ε) ∈ 𝓝 (f t) := by + obtain ⟨ψ', hψc, hl⟩ := exists_inv_Icc h.1 h.2.1 + have ht : t ∈ Icc (t - ε) (t + ε) := ⟨by linarith, by linarith⟩ + have hW : ψ '' Ioo (-1) 1 ∈ 𝓝 (f t) := h.2.2.mem_nhds (hft ▸ mem_image_of_mem ψ hs) + have hfW : ∀ᶠ r in 𝓝 t, f r ∈ ψ '' Ioo (-1) 1 := by + have hcAt : ContinuousAt f t := + hc.continuousAt (Icc_mem_nhds (by linarith) (by linarith)) + exact hcAt hW + obtain ⟨δ₀, hδ₀, hball⟩ := Metric.eventually_nhds_iff_ball.mp hfW + let δ := min (δ₀ / 2) ε + have hδ : 0 < δ := lt_min (half_pos hδ₀) hε + have hδε : δ ≤ ε := min_le_right _ _ + have hsubI : Icc (t - δ) (t + δ) ⊆ Icc (t - ε) (t + ε) := + Icc_subset_Icc (by linarith) (by linarith) + have hmemW : ∀ r ∈ Icc (t - δ) (t + δ), f r ∈ ψ '' Ioo (-1) 1 := by + intro r hr + refine hball r (Metric.mem_ball.mpr ?_) + rw [Real.dist_eq, abs_lt] + have : δ ≤ δ₀ / 2 := min_le_left _ _ + constructor <;> linarith [hr.1, hr.2] + let g : ℝ → ℝ := fun r => ψ' (f r) + have hψsub : ψ '' Ioo (-1) 1 ⊆ ψ '' Icc (-1) 1 := image_mono Ioo_subset_Icc_self + have hgc : ContinuousOn g (Icc (t - δ) (t + δ)) := + hψc.comp (hc.mono hsubI) fun r hr => hψsub (hmemW r hr) + have hψf : ∀ r ∈ Icc (t - δ) (t + δ), ψ (g r) = f r := by + intro r hr + obtain ⟨x, hx, hxe⟩ := hmemW r hr + change ψ (ψ' (f r)) = f r + rw [← hxe, hl (Ioo_subset_Icc_self hx)] + have hgi : InjOn g (Icc (t - δ) (t + δ)) := fun x hx y hy he => + hi (hsubI hx) (hsubI hy) (by rw [← hψf x hx, ← hψf y hy, he]) + have hgIoo : ∀ r ∈ Icc (t - δ) (t + δ), g r ∈ Ioo (-1 : ℝ) 1 := by + intro r hr + obtain ⟨x, hx, hxe⟩ := hmemW r hr + change ψ' (f r) ∈ _ + rwa [← hxe, hl (Ioo_subset_Icc_self hx)] + have hgimg : ∃ O : Set ℝ, IsOpen O ∧ g t ∈ O ∧ O ⊆ g '' Ioo (t - δ) (t + δ) := by + have hlo : t - δ < t + δ := by linarith + have hint : IsOpen (g '' Ioo (t - δ) (t + δ)) := by + rcases hgc.strictMonoOn_of_injOn_Icc' hlo.le hgi with hm | hm + · have himg : g '' Ioo (t - δ) (t + δ) = Ioo (g (t - δ)) (g (t + δ)) := by + refine Subset.antisymm ?_ fun y hy => ?_ + · rintro _ ⟨r, hr, rfl⟩ + exact ⟨hm (left_mem_Icc.mpr hlo.le) (Ioo_subset_Icc_self hr) hr.1, + hm (Ioo_subset_Icc_self hr) (right_mem_Icc.mpr hlo.le) hr.2⟩ + · obtain ⟨r, hr, hre⟩ := intermediate_value_Ioo hlo.le hgc hy + exact ⟨r, hr, hre⟩ + rw [himg] + exact isOpen_Ioo + · have himg : g '' Ioo (t - δ) (t + δ) = Ioo (g (t + δ)) (g (t - δ)) := by + refine Subset.antisymm ?_ fun y hy => ?_ + · rintro _ ⟨r, hr, rfl⟩ + exact ⟨hm (Ioo_subset_Icc_self hr) (right_mem_Icc.mpr hlo.le) hr.2, + hm (left_mem_Icc.mpr hlo.le) (Ioo_subset_Icc_self hr) hr.1⟩ + · obtain ⟨r, hr, hre⟩ := intermediate_value_Ioo' hlo.le hgc hy + exact ⟨r, hr, hre⟩ + rw [himg] + exact isOpen_Ioo + exact ⟨_, hint, ⟨t, ⟨by linarith, by linarith⟩, rfl⟩, Subset.rfl⟩ + obtain ⟨O, hO, htO, hOsub⟩ := hgimg + have hOI : O ⊆ Ioo (-1) 1 := by + intro y hy + obtain ⟨r, hr, rfl⟩ := hOsub hy + exact hgIoo r (Ioo_subset_Icc_self hr) + have hopen := h.isOpen_image hO hOI + refine mem_of_superset (hopen.mem_nhds ?_) ?_ + · rw [← hψf t ⟨by linarith, by linarith⟩] + exact mem_image_of_mem ψ htO + · rintro _ ⟨y, hy, rfl⟩ + obtain ⟨r, hr, rfl⟩ := hOsub hy + refine ⟨r, ⟨?_, ?_⟩, (hψf r (Ioo_subset_Icc_self hr)).symm⟩ + · linarith [hr.1] + · linarith [hr.2] + +/-- Near an end of an arc, the arc lies on one side of the end in a chart. So the other side misses +the arc. -/ +theorem exists_free_side (h : IsCurveChart ψ) {a : 𝕀 → X} (ha : IsArcMap a) {q' : ℝ} + (hq : q' ∈ Ioo (-1 : ℝ) 1) (heq : a 1 = ψ q') : + ∃ σ : ℝ, (σ = 1 ∨ σ = -1) ∧ ∃ r > 0, ∀ s ∈ Ioc 0 r, q' + σ * s ∈ Ioo (-1 : ℝ) 1 ∧ + ψ (q' + σ * s) ∉ range a := by + obtain ⟨ψ', hψc, hl⟩ := exists_inv_Icc h.1 h.2.1 + have hW : a ⁻¹' (ψ '' Ioo (-1) 1) ∈ 𝓝 (1 : 𝕀) := + (h.2.2.preimage ha.1).mem_nhds (by + change a 1 ∈ ψ '' Ioo (-1) 1 + rw [heq] + exact mem_image_of_mem ψ hq) + obtain ⟨t₀, ht₀, hsub⟩ := exists_Ioc_subset_of_mem_nhds hW ⟨0, zero_lt_one⟩ + have hsub' : ψ '' Ioo (-1) 1 ⊆ ψ '' Icc (-1) 1 := image_mono Ioo_subset_Icc_self + let c : 𝕀 → ℝ := fun t => ψ' (a t) + have hψa : ∀ t ∈ Ioc t₀ 1, ψ (c t) = a t := by + intro t ht + obtain ⟨x, hx, hxe⟩ := hsub ht + change ψ (ψ' (a t)) = a t + rw [← hxe, hl (Ioo_subset_Icc_self hx)] + have hcc : ContinuousOn c (Ioo t₀ 1) := + hψc.comp ha.1.continuousOn fun t ht => hsub' (hsub (Ioo_subset_Ioc_self ht)) + have hne : ∀ t ∈ Ioo t₀ 1, c t ≠ q' := fun t ht he => by + have h1 := hψa t (Ioo_subset_Ioc_self ht) + rw [he, ← heq] at h1 + exact ht.2.ne (ha.2 h1.symm) + have hpre : IsPreconnected (c '' Ioo t₀ 1) := isPreconnected_Ioo.image c hcc + have hsplit : c '' Ioo t₀ 1 ⊆ Iio q' ∪ Ioi q' := by + rintro _ ⟨t, ht, rfl⟩ + exact (lt_or_gt_of_ne (hne t ht)).imp id id + have hlt : t₀ < 1 := ht₀ + obtain ⟨t₁, ht₁0, ht₁1⟩ := exists_between hlt + have hA : IsClosed (a '' Iic t₁) := (isClosed_Iic.isCompact.image ha.1).isClosed + have hq1 : ψ q' ∉ a '' Iic t₁ := by + rintro ⟨t, ht, he⟩ + have h1 : t = 1 := ha.2 (he.trans heq.symm) + rw [h1] at ht + exact absurd ht (not_le.mpr ht₁1) + have hcont : ContinuousAt ψ q' := + h.1.continuousAt (Icc_mem_nhds hq.1 hq.2) + have hev : ∀ᶠ x in 𝓝 q', ψ x ∉ a '' Iic t₁ ∧ x ∈ Ioo (-1 : ℝ) 1 := + (hcont.eventually (hA.isOpen_compl.mem_nhds hq1)).and (Ioo_mem_nhds hq.1 hq.2) + obtain ⟨δ, hδ, hball⟩ := Metric.eventually_nhds_iff_ball.mp hev + have hfree : ∀ σ : ℝ, (σ = 1 ∨ σ = -1) → (∀ t ∈ Ioo t₀ 1, σ * (c t - q') ≤ 0) → + ∃ r > 0, ∀ s ∈ Ioc 0 r, q' + σ * s ∈ Ioo (-1 : ℝ) 1 ∧ ψ (q' + σ * s) ∉ range a := by + intro σ hσ hside + have hσ2 : σ * σ = 1 := by rcases hσ with rfl | rfl <;> norm_num + refine ⟨δ / 2, half_pos hδ, fun s hs => ?_⟩ + have hd : q' + σ * s ∈ Metric.ball q' δ := by + rw [Metric.mem_ball, Real.dist_eq, add_sub_cancel_left, abs_mul] + have : |σ| = 1 := by rcases hσ with rfl | rfl <;> norm_num + rw [this, one_mul, abs_of_pos hs.1] + linarith [hs.2] + obtain ⟨h1, h2⟩ := hball _ hd + refine ⟨h2, ?_⟩ + rintro ⟨t, he⟩ + have ht : t₁ < t := by + by_contra hn + exact h1 ⟨t, not_lt.mp hn, he⟩ + by_cases ht1 : t = 1 + · rw [ht1, heq] at he + have h3 := h.2.1 (Ioo_subset_Icc_self hq) (Ioo_subset_Icc_self h2) he + have h4 : σ * s = 0 := by linarith + rcases mul_eq_zero.mp h4 with h5 | h5 + · rcases hσ with rfl | rfl <;> norm_num at h5 + · exact hs.1.ne' h5 + · have ht2 : t ∈ Ioo t₀ 1 := ⟨ht₁0.trans ht, lt_of_le_of_ne unitInterval.le_one' ht1⟩ + have h6 : c t = q' + σ * s := by + change ψ' (a t) = _ + rw [he, hl (Ioo_subset_Icc_self h2)] + have h7 := hside t ht2 + rw [h6] at h7 + have h8 : σ * (q' + σ * s - q') = s := by + rw [add_sub_cancel_left, ← mul_assoc, hσ2, one_mul] + linarith [hs.1] + have hdis : Disjoint (Iio q') (Ioi q') := + Set.disjoint_left.mpr fun _ h1 h2 => lt_asymm h1 h2 + rcases (isPreconnected_iff_subset_of_disjoint.mp hpre) _ _ isOpen_Iio isOpen_Ioi hsplit + (by rw [hdis.inter_eq]; simp) with h1 | h1 + · refine ⟨1, Or.inl rfl, hfree 1 (Or.inl rfl) fun t ht => ?_⟩ + have : c t < q' := h1 (mem_image_of_mem c ht) + linarith + · refine ⟨-1, Or.inr rfl, hfree (-1) (Or.inr rfl) fun t ht => ?_⟩ + have : q' < c t := h1 (mem_image_of_mem c ht) + linarith + +end IsCurveChart + +omit [T2Space X] in +/-- Two arcs that meet only at one end of each join to one arc. -/ +theorem exists_arc_join {a b : 𝕀 → X} (ha : IsArcMap a) (hb : IsArcMap b) (h : a 1 = b 0) + (hm : ∀ s t, a s = b t → s = 1 ∧ t = 0) : + ∃ c : 𝕀 → X, IsArcMap c ∧ range c = range a ∪ range b ∧ c 0 = a 0 ∧ c 1 = b 1 := by + let p : Path (a 0) (a 1) := ⟨⟨a, ha.1⟩, rfl, rfl⟩ + let p' : Path (a 1) (b 1) := ⟨⟨b, hb.1⟩, h.symm, rfl⟩ + refine ⟨p.trans p', ⟨(p.trans p').continuous, ?_⟩, ?_, (p.trans p').source, + (p.trans p').target⟩ + · have hp : ∀ t, p t = a t := fun _ => rfl + have hp' : ∀ t, p' t = b t := fun _ => rfl + intro s t he + rw [Path.trans_apply, Path.trans_apply] at he + by_cases hs : s.1 ≤ 1 / 2 <;> by_cases ht : t.1 ≤ 1 / 2 + · simp only [hs, ht, ↓reduceDIte, hp] at he + have h1 := congrArg Subtype.val (ha.2 he) + simp only at h1 + exact Subtype.ext (by linarith) + · simp only [hs, ht, ↓reduceDIte, hp, hp'] at he + have h1 := congrArg Subtype.val (hm _ _ he).2 + simp only at h1 + have h2 : (0 : 𝕀).1 = 0 := rfl + exact absurd ht (by rw [not_le]; linarith) + · simp only [hs, ht, ↓reduceDIte, hp', hp] at he + have h1 := congrArg Subtype.val (hm _ _ he.symm).2 + simp only at h1 + have h2 : (0 : 𝕀).1 = 0 := rfl + exact absurd hs (by rw [not_le]; linarith) + · simp only [hs, ht, ↓reduceDIte, hp'] at he + have h1 := congrArg Subtype.val (hb.2 he) + simp only at h1 + exact Subtype.ext (by linarith) + · rw [Path.trans_range] + rfl + +/-- The real form of a path. -/ +private noncomputable def toReal (a : 𝕀 → X) (t : ℝ) : X := a (projIcc 0 1 zero_le_one t) + +omit [TopologicalSpace X] [T2Space X] in +private theorem toReal_coe (a : 𝕀 → X) (t : 𝕀) : toReal a t.1 = a t := by + rw [toReal, projIcc_val] + +private theorem isOpen_range_of_circle {f : Circle → X} (hf : Continuous f) + (hi : Function.Injective f) (hch : ∀ x : X, ∃ ψ : ℝ → X, IsCurveChart ψ ∧ x ∈ ψ '' Ioo (-1) 1) : + IsOpen (range f) := by + refine isOpen_iff_mem_nhds.mpr ?_ + rintro _ ⟨w, rfl⟩ + obtain ⟨χ, hχ, s, hs, hse⟩ := hch (f w) + let F : ℝ → X := fun r => f (w * Circle.exp r) + have hFc : Continuous F := hf.comp (continuous_const.mul Circle.exp.continuous) + have hF0 : F 0 = f w := by simp [F] + have hpi := Real.two_le_pi + have hFi : InjOn F (Icc (0 - 1) (0 + 1)) := by + intro r hr r' hr' he + have h1 : Circle.exp r = Circle.exp r' := mul_left_cancel (hi he) + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp h1 + have h2 : (m : ℝ) * (2 * Real.pi) = r - r' := by linarith + have h3 : |r - r'| ≤ 2 := by + rw [abs_le] + constructor <;> linarith [hr.1, hr.2, hr'.1, hr'.2] + by_contra hne + have hm0 : m ≠ 0 := by + rintro rfl + apply hne + simp only [Int.cast_zero, zero_mul] at h2 + linarith + have h4 : (1 : ℝ) ≤ |(m : ℝ)| := by exact_mod_cast Int.one_le_abs hm0 + have h5 : |r - r'| = |(m : ℝ)| * (2 * Real.pi) := by + rw [← h2, abs_mul, abs_of_pos (by positivity : (0 : ℝ) < 2 * Real.pi)] + nlinarith + have h1 := hχ.image_mem_nhds one_pos (t := 0) hFc.continuousOn hFi hs (by rw [hF0, hse]) + rw [hF0] at h1 + refine mem_of_superset h1 ?_ + rintro _ ⟨r, -, rfl⟩ + exact ⟨_, rfl⟩ + +/-- An arc and a second arc with the same ends that meets it only in the ends make the space a +circle. -/ +private theorem circle_of_two_arcs [ConnectedSpace X] {a b : 𝕀 → X} + (ha : IsArcMap a) (hb : IsArcMap b) (h0 : a 0 = b 0) (h1 : a 1 = b 1) + (hm : ∀ s t, a s = b t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) + (hch : ∀ x : X, ∃ ψ : ℝ → X, IsCurveChart ψ ∧ x ∈ ψ '' Ioo (-1) 1) : Nonempty (Circle ≃ₜ X) + := by + obtain ⟨φ⟩ := oArc_of_two_arcs ha hb h0 h1 hm + let f : Circle → X := fun w => (φ w).1 + have hfc : Continuous f := continuous_subtype_val.comp φ.continuous + have hfi : Function.Injective f := fun w w' he => φ.injective (Subtype.ext he) + have hr : range f = range a ∪ range b := by + ext x + constructor + · rintro ⟨w, rfl⟩ + exact (φ w).2 + · intro hx + exact ⟨φ.symm ⟨x, hx⟩, by simp [f]⟩ + have hO := isOpen_range_of_circle hfc hfi hch + have hC : IsClosed (range f) := (isCompact_range hfc).isClosed + have hu : range f = univ := IsClopen.eq_univ ⟨hC, hO⟩ (range_nonempty f) + exact ⟨φ.trans ((Homeomorph.setCongr (hr.symm.trans hu)).trans (Homeomorph.Set.univ X))⟩ + +/-- One step of the growth of an arc. -/ +private theorem extend_arc [ConnectedSpace X] + (hch : ∀ x : X, ∃ ψ : ℝ → X, IsCurveChart ψ ∧ x ∈ ψ '' Ioo (-1) 1) {N : Set X} + (hN : ∀ x : X, ∃ ψ : ℝ → X, IsCurveChart ψ ∧ x ∈ ψ '' Ioo (-1) 1 ∧ ψ (-1) ∈ N ∧ ψ 1 ∈ N) + {a : 𝕀 → X} (ha : IsArcMap a) : + Nonempty (Circle ≃ₜ X) ∨ ∃ a', IsArcMap a' ∧ range a ⊆ range a' ∧ ∃ y ∈ N, y ∉ range a ∧ + y ∈ range a' := by + obtain ⟨ψ, hψ, ⟨q', hq', hqe⟩, hN1, hN2⟩ := hN (a 1) + obtain ⟨σ, hσ, r, hr, hfree⟩ := hψ.exists_free_side ha hq' hqe.symm + have hσ2 : σ * σ = 1 := by rcases hσ with rfl | rfl <;> norm_num + let L : ℝ := 1 - σ * q' + have hL : 0 < L := by + rcases hσ with rfl | rfl + · change 0 < 1 - 1 * q' + linarith [hq'.2] + · change 0 < 1 - -1 * q' + linarith [hq'.1] + let seg : ℝ → X := fun s => ψ (q' + σ * s) + have hmem : ∀ s ∈ Icc 0 L, q' + σ * s ∈ Icc (-1 : ℝ) 1 := by + intro s hs + have h1 := hs.1 + have h2 : s ≤ 1 - σ * q' := hs.2 + have hq1 := hq'.1 + have hq2 := hq'.2 + rcases hσ with rfl | rfl + · constructor <;> linarith + · constructor <;> linarith + have hsegc : ContinuousOn seg (Icc 0 L) := + hψ.1.comp (by fun_prop) hmem + have hsegi : InjOn seg (Icc 0 L) := by + intro s hs s' hs' he + have h1 := hψ.2.1 (hmem s hs) (hmem s' hs') he + have h2 : σ * s = σ * s' := by linarith + have h3 : σ * (σ * s) = σ * (σ * s') := by rw [h2] + rwa [← mul_assoc, ← mul_assoc, hσ2, one_mul, one_mul] at h3 + have hseg0 : seg 0 = a 1 := by + change ψ (q' + σ * 0) = a 1 + rw [mul_zero, add_zero] + exact hqe + have hsegL : seg L ∈ N := by + have h1 : q' + σ * L = σ := by + change q' + σ * (1 - σ * q') = σ + have : σ * (1 - σ * q') = σ - σ * σ * q' := by ring + rw [this, hσ2] + ring + change ψ (q' + σ * L) ∈ N + rw [h1] + rcases hσ with rfl | rfl + · exact hN2 + · exact hN1 + let r' := min r L + have hr' : 0 < r' := lt_min hr hL + have hr'L : r' ≤ L := min_le_right _ _ + have hAcl : IsClosed (range a) := (isCompact_range ha.1).isClosed + have hB : IsCompact (Icc r' L ∩ seg ⁻¹' range a) := by + have hcl : IsClosed (Icc r' L ∩ seg ⁻¹' range a) := + (hsegc.mono (Icc_subset_Icc_left hr'.le)).preimage_isClosed_of_isClosed isClosed_Icc hAcl + exact isCompact_Icc.of_isClosed_subset hcl inter_subset_left + have hnear : ∀ s ∈ Ioc 0 r', seg s ∉ range a := fun s hs => + (hfree s ⟨hs.1, hs.2.trans (min_le_left _ _)⟩).2 + have hsmall : ∀ u : 𝕀, 0 ≤ L * u.1 ∧ L * u.1 ≤ L := fun u => by + constructor + · exact mul_nonneg hL.le u.2.1 + · nlinarith [u.2.2] + by_cases hemp : (Icc r' L ∩ seg ⁻¹' range a).Nonempty + · left + obtain ⟨s₀, ⟨hs₀, hs₀a⟩, hleast⟩ := hB.exists_isLeast hemp + have hs0pos : 0 < s₀ := lt_of_lt_of_le hr' hs₀.1 + have hbefore : ∀ s ∈ Ioo 0 s₀, seg s ∉ range a := by + intro s hs hin + by_cases hsr : s ≤ r' + · exact hnear s ⟨hs.1, hsr⟩ hin + · have := hleast ⟨⟨(not_le.mp hsr).le, hs.2.le.trans hs₀.2⟩, hin⟩ + exact absurd hs.2 (not_lt.mpr this) + have hsL : Icc 0 s₀ ⊆ Icc 0 L := Icc_subset_Icc_right hs₀.2 + obtain ⟨t, ht⟩ := hs₀a + have ht1 : t ≠ 1 := by + rintro rfl + have := hsegi (right_mem_Icc.mpr hL.le |> fun _ => (⟨le_rfl, hL.le⟩ : (0 : ℝ) ∈ Icc 0 L)) + (⟨hs0pos.le, hs₀.2⟩ : s₀ ∈ Icc 0 L) (hseg0.trans ht) + exact hs0pos.ne this + have ht0 : t = 0 := by + by_contra ht0 + have hpos : 0 < t.1 := lt_of_le_of_ne t.2.1 fun h => ht0 (Subtype.ext h.symm) + have hlt : t.1 < 1 := lt_of_le_of_ne t.2.2 fun h => ht1 (Subtype.ext h) + obtain ⟨χ, hχ, s, hs, hse⟩ := hch (a t) + let ε := min t.1 (1 - t.1) + have hε : 0 < ε := lt_min hpos (by linarith) + have hε1 : ε ≤ t.1 := min_le_left _ _ + have hε2 : ε ≤ 1 - t.1 := min_le_right _ _ + have hI : Icc (t.1 - ε) (t.1 + ε) ⊆ Icc (0 : ℝ) 1 := + Icc_subset_Icc (by linarith) (by linarith) + have hfc : ContinuousOn (toReal a) (Icc (t.1 - ε) (t.1 + ε)) := + (ha.1.comp continuous_projIcc).continuousOn + have hfi : InjOn (toReal a) (Icc (t.1 - ε) (t.1 + ε)) := by + intro x hx y hy he + have h1 := ha.2 he + have h2 := congrArg Subtype.val h1 + rwa [projIcc_of_mem zero_le_one (hI hx), projIcc_of_mem zero_le_one (hI hy)] at h2 + have hnh := hχ.image_mem_nhds hε hfc hfi hs (by rw [toReal_coe, hse]) + rw [toReal_coe, ht] at hnh + have hcl : seg s₀ ∈ closure (seg '' Ioo 0 s₀) := by + refine ContinuousOn.image_closure (s := Ioo 0 s₀) ?_ ?_ + · rw [closure_Ioo hs0pos.ne] + exact hsegc.mono hsL + · exact mem_image_of_mem seg (by + rw [closure_Ioo hs0pos.ne] + exact ⟨hs0pos.le, le_rfl⟩) + obtain ⟨_, hz, s', hs', rfl⟩ := mem_closure_iff_nhds.mp hcl _ hnh + refine hbefore s' hs' ?_ + obtain ⟨x, -, hx⟩ := hz + exact ⟨_, hx⟩ + subst ht0 + let b : 𝕀 → X := fun u => seg (s₀ * (1 - u.1)) + have hbmem : ∀ u : 𝕀, s₀ * (1 - u.1) ∈ Icc 0 s₀ := fun u => + ⟨mul_nonneg hs0pos.le (by linarith [u.2.2]), by nlinarith [u.2.1]⟩ + have hb : IsArcMap b := by + refine ⟨hsegc.comp_continuous (by fun_prop) fun u => hsL (hbmem u), fun u v he => ?_⟩ + have h1 := hsegi (hsL (hbmem u)) (hsL (hbmem v)) he + have h2 : 1 - u.1 = 1 - v.1 := mul_left_cancel₀ hs0pos.ne' h1 + exact Subtype.ext (by linarith) + refine circle_of_two_arcs ha hb ?_ ?_ ?_ hch + · change a 0 = seg (s₀ * (1 - (0 : ℝ))) + rw [sub_zero, mul_one, ht] + · change a 1 = seg (s₀ * (1 - (1 : ℝ))) + rw [sub_self, mul_zero, hseg0] + · intro v u he + have hu0 : u = 0 ∨ u = 1 := by + by_contra hn + push Not at hn + have h1 : 0 < u.1 := lt_of_le_of_ne u.2.1 fun h => hn.1 (Subtype.ext h.symm) + have h2 : u.1 < 1 := lt_of_le_of_ne u.2.2 fun h => hn.2 (Subtype.ext h) + refine hbefore _ ⟨mul_pos hs0pos (by linarith), ?_⟩ ⟨v, he⟩ + nlinarith + rcases hu0 with rfl | rfl + · left + refine ⟨ha.2 ?_, rfl⟩ + rw [he] + change seg (s₀ * (1 - (0 : ℝ))) = a 0 + rw [sub_zero, mul_one, ← ht] + · right + refine ⟨ha.2 ?_, rfl⟩ + rw [he] + change seg (s₀ * (1 - (1 : ℝ))) = a 1 + rw [sub_self, mul_zero, hseg0] + · right + have hoff : ∀ s ∈ Ioc 0 L, seg s ∉ range a := by + intro s hs hin + by_cases hsr : s ≤ r' + · exact hnear s ⟨hs.1, hsr⟩ hin + · exact hemp ⟨s, ⟨(not_le.mp hsr).le, hs.2⟩, hin⟩ + let b : 𝕀 → X := fun u => seg (L * u.1) + have hb : IsArcMap b := by + refine ⟨hsegc.comp_continuous (by fun_prop) fun u => hsmall u, fun u v he => ?_⟩ + have h1 := hsegi (hsmall u) (hsmall v) he + exact Subtype.ext (mul_left_cancel₀ hL.ne' h1) + have hb0 : b 0 = a 1 := by + change seg (L * (0 : ℝ)) = a 1 + rw [mul_zero, hseg0] + obtain ⟨c, hc, hrc, -, -⟩ := exists_arc_join ha hb hb0.symm (fun s t he => by + have ht : t = 0 := by + by_contra hn + have h1 : 0 < t.1 := lt_of_le_of_ne t.2.1 fun h => hn (Subtype.ext h.symm) + exact hoff _ ⟨mul_pos hL h1, (hsmall t).2⟩ ⟨s, he⟩ + subst ht + exact ⟨ha.2 (he.trans hb0), rfl⟩) + refine ⟨c, hc, hrc ▸ subset_union_left, seg L, hsegL, hoff L ⟨hL, le_rfl⟩, ?_⟩ + rw [hrc] + refine Or.inr ⟨1, ?_⟩ + change seg (L * (1 : ℝ)) = seg L + rw [mul_one] + +/-- **A compact connected curve is a circle.** See the module docstring for the route. -/ +theorem exists_homeomorph_circle [CompactSpace X] [ConnectedSpace X] + (hch : ∀ x : X, ∃ ψ, IsCurveChart ψ ∧ x ∈ ψ '' Ioo (-1) 1) : Nonempty (Circle ≃ₜ X) := by + classical + choose ψ hψ hmem using hch + obtain ⟨t, ht⟩ := isCompact_univ.elim_nhds_subcover (fun x => ψ x '' Ioo (-1) 1) + (fun x _ => (hψ x).2.2.mem_nhds (hmem x)) + have hcov : ∀ x, ∃ y ∈ t, x ∈ ψ y '' Ioo (-1) 1 := fun x => by + have := ht.2 (mem_univ x) + simpa using this + let N : Set X := ⋃ y ∈ t, {ψ y (-1), ψ y 1} + have hNfin : N.Finite := t.finite_toSet.biUnion fun _ _ => by simp + have hN : ∀ x, ∃ χ, IsCurveChart χ ∧ x ∈ χ '' Ioo (-1) 1 ∧ χ (-1) ∈ N ∧ χ 1 ∈ N := fun x => by + obtain ⟨y, hy, hx⟩ := hcov x + exact ⟨ψ y, hψ y, hx, mem_biUnion hy (Or.inl rfl), mem_biUnion hy (Or.inr rfl)⟩ + have hch : ∀ x : X, ∃ χ, IsCurveChart χ ∧ x ∈ χ '' Ioo (-1) 1 := fun x => ⟨ψ x, hψ x, hmem x⟩ + have key : ∀ n : ℕ, ∀ a : 𝕀 → X, IsArcMap a → (N \ range a).ncard = n → + Nonempty (Circle ≃ₜ X) := by + intro n + induction n using Nat.strong_induction_on with + | _ n ih => + intro a ha hn + rcases extend_arc hch hN ha with h | ⟨a', ha', hsub, y, hyN, hy, hy'⟩ + · exact h + · refine ih _ ?_ a' ha' rfl + rw [← hn] + refine ncard_lt_ncard ⟨fun z hz => ⟨hz.1, fun h => hz.2 (?_)⟩, fun h => ?_⟩ + (hNfin.subset sdiff_subset) + · exact absurd (hsub h) hz.2 + · exact (h ⟨hyN, hy⟩).2 hy' + obtain ⟨x₀⟩ := (inferInstance : Nonempty X) + let a₀ : 𝕀 → X := fun u => ψ x₀ (2 * u.1 - 1) + have ha₀ : IsArcMap a₀ := by + have hmemI : ∀ u : 𝕀, 2 * u.1 - 1 ∈ Icc (-1 : ℝ) 1 := fun u => by + constructor <;> linarith [u.2.1, u.2.2] + refine ⟨(hψ x₀).1.comp_continuous (by fun_prop) hmemI, fun u v he => ?_⟩ + have h1 := (hψ x₀).2.1 (hmemI u) (hmemI v) he + exact Subtype.ext (by linarith) + exact key _ a₀ ha₀ rfl + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/OneWord.lean b/LeanPool/GraphMinor/Surface/OneWord.lean new file mode 100644 index 0000000000..bae622ad34 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/OneWord.lean @@ -0,0 +1,313 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CellFamily + +/-! +# From a family of words to one word + +A connected space presented by a family of words, with each label used at most twice, is presented +by one word +(`exists_one_word`). While there is more than one word, connectedness gives a label shared by the +first word and +another one, and we glue the two polygons along that label. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Function + +universe u uu + +theorem peq_self_rot {W : ℕ → List Letter} (hW : FinW W) (i : ℕ) {a b : List Letter} (h : W i + = a ++ b) : + PEq.{uu} W (update W i (b ++ a)) := by + have := peq_rot.{uu} hW i a b + rwa [← h, update_eq_self] at this + +theorem merge_opp {W : ℕ → List Letter} (hW : FinW W) {j k : ℕ} (hj : j ≠ 0) {e : Bool} {a b c d : + List Letter} + (h0 : W 0 = a ++ (k, e) :: b) (h1 : W j = c ++ (k, !e) :: d) (hu : b ++ a ≠ []) + (hv : d ++ c ≠ []) + (hab : NoLab (b ++ a) k) (hcd : NoLab (d ++ c) k) (hoth : ∀ i, i ≠ 0 → i ≠ j → NoLab (W i) k) : + PEq.{uu} W (update (update W j []) 0 (d ++ c ++ (b ++ a))) := by + have s1 : PEq.{uu} W (update W 0 ((k, e) :: b ++ a)) := by + simpa using peq_self_rot.{uu} hW 0 h0 + have hW1 : FinW (update W 0 ((k, e) :: b ++ a)) := hW.update _ _ + have s2 : PEq.{uu} (update W 0 ((k, e) :: b ++ a)) + (update (update W 0 ((k, e) :: b ++ a)) j ((k, !e) :: d ++ c)) := by + have h1' : update W 0 ((k, e) :: b ++ a) j = c ++ (k, !e) :: d := by rw [update_of_ne hj, h1] + simpa using peq_self_rot.{uu} hW1 j h1' + have hW0 : FinW (update W j []) := hW.update _ _ + have e2 : update (update W 0 ((k, e) :: b ++ a)) j ((k, !e) :: d ++ c) = + update (update (update W j []) 0 ((k, e) :: (b ++ a))) j ((k, !e) :: (d ++ c)) := by + funext i + by_cases hi : i = j + · subst hi + simp + · by_cases hi0 : i = 0 + · subst hi0 + simp [update_of_ne hi] + · simp [update_of_ne hi, update_of_ne hi0] + have s3 := peq_cut.{uu} (W := update W j []) (i := 0) (j := j) (y := k) (u := b ++ a) (v + := d ++ c) hW0 e hj + (by simp) hu hv (by + intro i l hl + by_cases hi0 : i = 0 + · subst hi0 + rw [update_self] at hl + exact (noLab_append.mpr ⟨hcd, hab⟩) l hl + · rw [update_of_ne hi0] at hl + by_cases hi : i = j + · subst hi + simp at hl + · rw [update_of_ne hi] at hl + exact hoth i hi0 hi l hl) + rw [e2] at s2 + exact s1.trans (s2.trans s3.symm) + +theorem noLab_of_cnt {w : List Letter} {c : ℕ} (h : cnt w c = 0) : NoLab w c := by + intro l hl he + have := cnt_pos (w := w) (l := l) hl + rw [he, h] at this + exact lt_irrefl _ this + +/-- Glue the word at `j` to the first word along the label `k`. -/ +theorem merge_step {W : ℕ → List Letter} (hW : FinW W) {j k : ℕ} (hj : j ≠ 0) {e e' : Bool} + (h0 : (k, e) ∈ W 0) (h1 : (k, e') ∈ W j) (c0 : cnt (W 0) k = 1) (c1 : cnt (W j) k = 1) + (hoth : ∀ i, i ≠ 0 → i ≠ j → cnt (W i) k = 0) (l0 : 2 ≤ (W 0).length) (l1 : 2 ≤ (W j).length) : + ∃ w, PEq.{uu} W (update (update W j []) 0 w) ∧ 2 ≤ w.length ∧ ∀ c, cnt w c ≤ cnt (W 0) c + cnt + (W j) c := by + have key : ∀ (W : ℕ → List Letter), FinW W → (k, !e) ∈ W j → (k, e) ∈ W 0 → cnt (W 0) k = 1 → cnt + (W j) k = 1 → + (∀ i, i ≠ 0 → i ≠ j → cnt (W i) k = 0) → 2 ≤ (W 0).length → 2 ≤ (W j).length → + ∃ w, PEq.{uu} W (update (update W j []) 0 w) ∧ 2 ≤ w.length ∧ ∀ c, cnt w c ≤ cnt + (W 0) c + cnt (W j) c := by + intro W hW h1 h0 c0 c1 hoth l0 l1 + obtain ⟨a, b, ha⟩ := List.append_of_mem h0 + obtain ⟨c, d, hc⟩ := List.append_of_mem h1 + have hc0 : cnt (b ++ a) k = 0 := by + have h2 : cnt a k + (1 + cnt b k) = 1 := by simpa [ha, cnt_append, cnt_cons] using c0 + rw [cnt_append] + omega + have hc1 : cnt (d ++ c) k = 0 := by + have h2 : cnt c k + (1 + cnt d k) = 1 := by simpa [hc, cnt_append, cnt_cons] using c1 + rw [cnt_append] + omega + have hl0 : 1 ≤ (b ++ a).length := by + rw [ha] at l0 + simp at l0 ⊢ + omega + have hl1 : 1 ≤ (d ++ c).length := by + rw [hc] at l1 + simp at l1 ⊢ + omega + refine ⟨d ++ c ++ (b ++ a), merge_opp hW hj ha hc (fun h => by simp [h] at hl0) + (fun h => by simp [h] at hl1) (noLab_of_cnt hc0) (noLab_of_cnt hc1) (fun i h h' + => noLab_of_cnt (hoth i h h')), + ?_, fun x => ?_⟩ + · simp only [List.length_append] at hl0 hl1 ⊢ + omega + · rw [ha, hc] + simp only [cnt_append, cnt_cons] + split_ifs <;> omega + by_cases he : e' = !e + · subst he + exact key W hW h1 h0 c0 c1 hoth l0 l1 + · have he' : e' = e := by + cases e <;> cases e' <;> simp_all + subst he' + have s0 : PEq.{uu} W (update W j (winv (W j))) := by + have := peq_rev.{uu} hW j (W j) + rwa [update_eq_self] at this + have hmem : (k, !e') ∈ winv (W j) := by + have : linv (k, e') ∈ winv (W j) := by + simp only [winv, List.mem_reverse, List.mem_map] + exact ⟨_, h1, rfl⟩ + simpa [linv] using this + obtain ⟨w, h2, h3, h4⟩ := key (update W j (winv (W j))) (hW.update _ _) (by simpa using hmem) + (by rwa [update_of_ne hj.symm]) (by rwa [update_of_ne hj.symm]) (by simpa [cnt_winv] using c1) + (fun i h h' => by rw [update_of_ne h']; exact hoth i h h') (by rwa [update_of_ne hj.symm]) + (by simpa [winv] using l1) + refine ⟨w, s0.trans ?_, h3, fun c => ?_⟩ + · simpa using h2 + · have := h4 c + simpa [update_of_ne hj.symm, cnt_winv] using this + +variable {X : Type u} [TopologicalSpace X] [T2Space X] + +/-- A connected space gives a label shared by the first word and another word. -/ +theorem exists_shared [ConnectedSpace X] {W : ℕ → List Letter} {f : ℕ × ℂ → X} (hW : FinW W) + (hf : Presents W f) + (h0 : W 0 ≠ []) {j₀ : ℕ} (hj₀ : j₀ ≠ 0) (hne : W j₀ ≠ []) : + ∃ j k e e', j ≠ 0 ∧ (k, e) ∈ W 0 ∧ (k, e') ∈ W j := by + by_contra hcon + push Not at hcon + obtain ⟨hc, hs, hrel⟩ := hf + have hDc : IsCompact (Dsk W) := isCompact_Dsk hW + let P : Set (ℕ × ℂ) := {a | a.1 = 0} + have hPo : IsClopen P := (isClopen_discrete ({0} : Set ℕ)).preimage continuous_fst + have hF0 : IsClosed (f '' (Dsk W ∩ P)) := + ((hDc.inter_right hPo.isClosed).image_of_continuousOn (hc.mono inter_subset_left)).isClosed + have hF1 : IsClosed (f '' (Dsk W \ P)) := + ((hDc.diff hPo.isOpen).image_of_continuousOn (hc.mono sdiff_subset)).isClosed + have hcov : (univ : Set X) ⊆ f '' (Dsk W ∩ P) ∪ f '' (Dsk W \ P) := by + intro x _ + have h1 : x ∈ f '' Dsk W := hs ▸ mem_univ x + obtain ⟨a, ha, rfl⟩ := h1 + by_cases hp : a ∈ P + · exact .inl ⟨a, ⟨ha, hp⟩, rfl⟩ + · exact .inr ⟨a, ⟨ha, hp⟩, rfl⟩ + have hn0 : (0, (0 : ℂ)) ∈ Dsk W := ⟨h0, by simp⟩ + have hn1 : (j₀, (0 : ℂ)) ∈ Dsk W := ⟨hne, by simp⟩ + obtain ⟨x, -, ⟨a, ⟨ha, hap⟩, rfl⟩, ⟨b, ⟨hb, hbp⟩, he⟩⟩ := isPreconnected_closed_iff.mp + (isPreconnected_univ (α := X)) _ _ hF0 hF1 hcov ⟨_, mem_univ _, _, ⟨hn0, rfl⟩, rfl⟩ + ⟨_, mem_univ _, _, ⟨hn1, hj₀⟩, rfl⟩ + have hr : PRel W a b := (hrel a ha b hb).mp he.symm + have key : ∀ x y, PRel W x y → (x.1 = 0 ↔ y.1 = 0) := by + intro x y h + induction h with + | rel x y hs => + obtain ⟨i, j, p, q, k, e, e', t, h1, h2, -, -, rfl, rfl⟩ := hs + have m1 : (k, e) ∈ W i := List.mem_of_getElem? h1 + have m2 : (k, e') ∈ W j := List.mem_of_getElem? h2 + constructor + · intro hi + by_contra hj + have hi' : i = 0 := hi + subst hi' + exact hcon j k e e' hj m1 m2 + · intro hj + by_contra hi + have hj' : j = 0 := hj + subst hj' + exact hcon i k e' e hi m2 m1 + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + exact hbp ((key a b hr).mp hap) + +/-- Glue all the polygons while preserving an invariant of their words and presentation. +The gluing step for two polygons supplies the invariant on the updated presentation. -/ +theorem exists_one_word_preserving [ConnectedSpace X] + (P : (ℕ → List Letter) → (ℕ × ℂ → X) → Prop) + (hglue : ∀ {W : ℕ → List Letter} {f : ℕ × ℂ → X}, FinW W → Presents W f → P W f → + ∀ {j k : ℕ} {e e' : Bool}, j ≠ 0 → (k, e) ∈ W 0 → (k, e') ∈ W j → + cnt (W 0) k = 1 → cnt (W j) k = 1 → (∀ i, i ≠ 0 → i ≠ j → cnt (W i) k = 0) → + 2 ≤ (W 0).length → 2 ≤ (W j).length → + ∃ w g, Presents (update (update W j []) 0 w) g ∧ P (update (update W j []) 0 w) g ∧ + 2 ≤ w.length ∧ ∀ c, cnt w c ≤ cnt (W 0) c + cnt (W j) c) + (n : ℕ) : + ∀ (S : Finset ℕ) (W : ℕ → List Letter) (f : ℕ × ℂ → X), + S.card = n → FinW W → W 0 ≠ [] → Presents W f → P W f → + (∀ i, W i ≠ [] → 2 ≤ (W i).length) → (∀ i, i ∉ S → W i = []) → + (∀ c, ∑ i ∈ S, cnt (W i) c ≤ 2) → + ∃ w g, 2 ≤ w.length ∧ Good w ∧ Presents (sW w) g ∧ P (sW w) g := by + classical + induction n using Nat.strong_induction_on with + | _ n ih => + intro S W f hn hW h0 hf hok hlen hS hsum + have h0S : 0 ∈ S := by + by_contra h + exact h0 (hS 0 h) + by_cases hall : ∀ j, j ≠ 0 → W j = [] + · have e : W = sW (W 0) := by + funext i + by_cases hi : i = 0 + · subst hi + simp [sW] + · simp [sW, nW, update_of_ne hi, hall i hi] + refine ⟨W 0, f, hlen 0 h0, fun c => ?_, e ▸ hf, e ▸ hok⟩ + exact (Finset.single_le_sum (f := fun i => cnt (W i) c) (fun _ _ => Nat.zero_le _) h0S).trans + (hsum c) + push Not at hall + obtain ⟨j₀, hj₀, hne⟩ := hall + obtain ⟨j, k, e, e', hj, m0, m1⟩ := exists_shared hW hf h0 hj₀ hne + have hjne : W j ≠ [] := fun he => by simp [he] at m1 + have hjS : j ∈ S := by + by_contra h + exact hjne (hS j h) + have split : ∀ c, cnt (W j) c + (cnt (W 0) c + ∑ i ∈ (S.erase j).erase 0, cnt (W i) c) ≤ 2 + := fun c => by + have h1 := Finset.add_sum_erase S (fun i => cnt (W i) c) hjS + have h2 := Finset.add_sum_erase (S.erase j) (fun i => cnt (W i) c) + (Finset.mem_erase.mpr ⟨hj.symm, h0S⟩) + have h3 := hsum c + omega + have p0 : 0 < cnt (W 0) k := cnt_pos (w := W 0) (l := (k, e)) m0 + have p1 : 0 < cnt (W j) k := cnt_pos (w := W j) (l := (k, e')) m1 + have hk := split k + have hrest : ∀ i, i ≠ 0 → i ≠ j → cnt (W i) k = 0 := by + intro i hi0 hij + by_cases hiS : i ∈ S + · have h1 : i ∈ (S.erase j).erase 0 := Finset.mem_erase.mpr ⟨hi0, Finset.mem_erase.mpr ⟨hij, + hiS⟩⟩ + have h2 := Finset.single_le_sum (f := fun i => cnt (W i) k) (fun _ _ => Nat.zero_le _) h1 + omega + · rw [hS i hiS] + rfl + obtain ⟨w, g, hg, hokg, hwl, hwc⟩ := hglue hW hf hok hj m0 m1 (by omega) + (by omega) hrest (hlen 0 h0) + (hlen j hjne) + have hwne : w ≠ [] := fun he => by simp [he] at hwl + refine ih (S.erase j).card ?_ (S.erase j) _ g rfl ((hW.update _ _).update _ _) + (by simpa using hwne) hg hokg ?_ ?_ ?_ + · rw [← hn] + exact Finset.card_erase_lt_of_mem hjS + · intro i hi + by_cases hi0 : i = 0 + · subst hi0 + simpa using hwl + · rw [update_of_ne hi0] at hi ⊢ + by_cases hij : i = j + · subst hij + simp at hi + · rw [update_of_ne hij] at hi ⊢ + exact hlen i hi + · intro i hi + have hi0 : i ≠ 0 := fun h => hi (Finset.mem_erase.mpr ⟨h ▸ hj.symm, h ▸ h0S⟩) + rw [update_of_ne hi0] + by_cases hij : i = j + · subst hij + simp + · rw [update_of_ne hij] + exact hS i fun h => hi (Finset.mem_erase.mpr ⟨hij, h⟩) + · intro c + have h1 := Finset.add_sum_erase (S.erase j) (fun i => cnt (update (update W j []) 0 w i) c) + (Finset.mem_erase.mpr ⟨hj.symm, h0S⟩) + have h2 : ∑ i ∈ (S.erase j).erase 0, cnt (update (update W j []) 0 w i) c = + ∑ i ∈ (S.erase j).erase 0, cnt (W i) c := by + refine Finset.sum_congr rfl fun i hi => ?_ + have hi0 := (Finset.mem_erase.mp hi).1 + have hij := (Finset.mem_erase.mp (Finset.mem_erase.mp hi).2).1 + rw [update_of_ne hi0, update_of_ne hij] + simp only [update_self] at h1 + have h3 := hwc c + have h4 := split c + omega + +theorem exists_one_word [ConnectedSpace X] (n : ℕ) : ∀ (S : Finset ℕ) (W : ℕ → List Letter) + (f : ℕ × ℂ → X), + S.card = n → FinW W → W 0 ≠ [] → Presents W f → (∀ i, W i ≠ [] → 2 ≤ (W i).length) → + (∀ i, i ∉ S → W i = []) → + (∀ c, ∑ i ∈ S, cnt (W i) c ≤ 2) → ∃ (w : List Letter) (g : ℕ × ℂ → X), w ≠ [] ∧ Good w + ∧ Presents (sW w) g := by + intro S W f hn hW h0 hf hlen hS hsum + obtain ⟨w, g, hwl, hgood, hg, -⟩ := + exists_one_word_preserving (X := X) (fun _ _ => True) (by + intro W' f' hW' hf' _ j k e e' hj hm0 hm1 c0 c1 hrest hlen0 hlen1 + obtain ⟨w, hpe, hwl, hwc⟩ := merge_step.{u} hW' hj hm0 hm1 c0 c1 hrest hlen0 hlen1 + obtain ⟨g, hg⟩ := (hpe X).mp ⟨f', hf'⟩ + exact ⟨w, g, hg, trivial, hwl, hwc⟩) n S W f hn hW h0 hf trivial hlen hS hsum + exact ⟨w, g, fun h => by simp [h] at hwl, hgood, hg⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/OpenDisc.lean b/LeanPool/GraphMinor/Surface/OpenDisc.lean new file mode 100644 index 0000000000..2f074405f0 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/OpenDisc.lean @@ -0,0 +1,651 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscMerge +import Mathlib.Topology.Order.IntermediateValue +import Mathlib.Analysis.Normed.Module.Ball.Homeomorph + +/-! +# Open sets in which every `O`-arc bounds a closed disc + +`open_disc : OpenDiscStatement`: Graph Minors VII, (4.2). Let `S` be a connected closed surface and +`Y ⊆ S` connected and open, such that every `O`-arc in `Y` bounds a closed disc in `Y`. Then `S` is +a +sphere and `Y = S`, or `Y` is an open disc. + +The route. By `exists_disc_merge`, `Y` is exhausted by closed discs `D₀ ⊆ D₁ ⊆ ⋯`, each in the +inside +of the next. We then map them into the plane, one after the other. A map of `D_n` has as image a +closed domain of the plane, and by the Schoenflies theorem the map on the boundary of `D_n` extends +to +a homeomorphism of the plane (`exists_extension_step`). So the map extends to `D_{n+1}`, and no +annulus theorem is needed. A push of the plane that is the identity on the image of `D_n` makes the +image of `D_{n+1}` contain any given ball, so the limit map is onto the plane. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +universe u + +/-! ### Radial pushes of the plane -/ + +/-- The map that changes the radius by `f`. -/ +noncomputable def radialMap (f : ℝ → ℝ) (z : ℂ) : ℂ := ((f ‖z‖ / ‖z‖ : ℝ) : ℂ) * z + +theorem radialMap_of_le {f : ℝ → ℝ} (hf : ∀ r ≤ 1, f r = r) {z : ℂ} (hz : ‖z‖ ≤ 1) : + radialMap f z = z := by + by_cases h0 : z = 0 + · simp [radialMap, h0] + · have : ‖z‖ ≠ 0 := norm_ne_zero_iff.mpr h0 + simp [radialMap, hf _ hz, this] + +theorem norm_radialMap {f : ℝ → ℝ} (hf : ∀ r, 0 < r → 0 < f r) {z : ℂ} (hz : z ≠ 0) : + ‖radialMap f z‖ = f ‖z‖ := by + have h1 : 0 < ‖z‖ := norm_pos_iff.mpr hz + have h2 := hf _ h1 + simp only [radialMap, norm_mul, Complex.norm_real, Real.norm_eq_abs] + rw [abs_of_pos (by positivity)] + field_simp + +theorem continuous_radialMap {f : ℝ → ℝ} (hc : Continuous f) (hf : ∀ r ≤ 1, f r = r) : + Continuous (radialMap f) := by + rw [continuous_iff_continuousAt] + intro z + by_cases h0 : z = 0 + · subst h0 + have : radialMap f =ᶠ[𝓝 0] id := by + filter_upwards [ball_mem_nhds (0 : ℂ) one_pos] with w hw + exact radialMap_of_le hf (mem_ball_zero_iff.mp hw).le + exact continuousAt_id.congr this.symm + · have h1 : ‖z‖ ≠ 0 := norm_ne_zero_iff.mpr h0 + refine ContinuousAt.mul ?_ continuousAt_id + refine Complex.continuous_ofReal.continuousAt.comp ?_ + exact (hc.comp continuous_norm).continuousAt.div continuous_norm.continuousAt h1 + +/-- For `0 < δ` and `1 + δ < M`, a homeomorphism of the plane is the identity on the unit disc and +maps the disc of radius `1 + δ` onto the disc of radius `M`. -/ +theorem exists_radial {δ M : ℝ} (hδ : 0 < δ) (hM : 1 + δ < M) : + ∃ θ : ℂ ≃ₜ ℂ, (∀ z ∈ closedBall (0 : ℂ) 1, θ z = z) ∧ + closedBall 0 M ⊆ θ '' closedBall (0 : ℂ) (1 + δ) := by + set K := (M - 1) / δ with hK + set L := M - 1 - δ with hL + have hL0 : 0 < L := by rw [hL]; linarith + have hK1 : 1 < K := by + rw [hK, lt_div_iff₀ hδ] + linarith + have hKδ : K * δ = M - 1 := by + rw [hK] + field_simp + let f : ℝ → ℝ := fun r => min (max r (1 + K * (r - 1))) (r + L) + have hsm1 : StrictMono fun r : ℝ => r := strictMono_id + have hsm2 : StrictMono fun r : ℝ => 1 + K * (r - 1) := fun a b hab => by + have : 0 < K := by linarith + change 1 + K * (a - 1) < 1 + K * (b - 1) + nlinarith + have hsm3 : StrictMono fun r : ℝ => r + L := fun a b hab => by + change a + L < b + L + linarith + have hfm : StrictMono f := fun a b hab => min_lt_min (max_lt_max (hsm1 hab) (hsm2 hab)) (hsm3 hab) + have hfc : Continuous f := by fun_prop + have hf1 : ∀ r ≤ 1, f r = r := fun r hr => by + have h1 : 1 + K * (r - 1) ≤ r := by nlinarith + change min (max r (1 + K * (r - 1))) (r + L) = r + rw [max_eq_left h1, min_eq_left (by linarith)] + have hfM : f (1 + δ) = M := by + have h1 : 1 + K * (1 + δ - 1) = M := by + rw [add_sub_cancel_left, hKδ] + ring + change min (max (1 + δ) (1 + K * (1 + δ - 1))) (1 + δ + L) = M + rw [h1, max_eq_right hM.le, min_eq_left (by rw [hL]; linarith)] + have hf0 : ∀ r, 0 < r → 0 < f r := fun r hr => by + have h1 : f 0 = 0 := hf1 0 zero_le_one + rw [← h1] + exact hfm hr + have htop : Tendsto f atTop atTop := by + refine tendsto_atTop_mono (f := fun r => r) (fun r => ?_) tendsto_id + rcases le_total r 1 with h | h + · exact (hf1 r h).symm.le + · change r ≤ min (max r (1 + K * (r - 1))) (r + L) + exact le_min (le_max_left _ _) (by linarith) + have hbot : Tendsto f atBot atBot := by + refine Tendsto.congr' ?_ tendsto_id + filter_upwards [eventually_le_atBot (1 : ℝ)] with r hr + exact (hf1 r hr).symm + have hsurj : Function.Surjective f := hfc.surjective htop hbot + let e : ℝ ≃o ℝ := hfm.orderIsoOfSurjective f hsurj + have hef : ∀ r, e r = f r := fun _ => rfl + let f' : ℝ → ℝ := e.symm + have hff' : ∀ r, f (f' r) = r := fun r => e.apply_symm_apply r + have hf'f : ∀ r, f' (f r) = r := fun r => e.symm_apply_apply r + have hf'c : Continuous f' := e.symm.continuous + have hf'1 : ∀ r ≤ 1, f' r = r := fun r hr => by + have := hf'f r + rwa [hf1 r hr] at this + have hf'0 : ∀ r, 0 < r → 0 < f' r := fun r hr => by + by_contra hcon + have h1 : f' r ≤ 0 := not_lt.mp hcon + have h2 := hfm.monotone h1 + rw [hff', hf1 0 zero_le_one] at h2 + linarith + have hinv : ∀ {g g' : ℝ → ℝ}, (∀ r, g' (g r) = r) → (∀ r, 0 < r → 0 < g r) → + ∀ z, radialMap g' (radialMap g z) = z := by + intro g g' h1 h2 z + by_cases h0 : z = 0 + · simp [radialMap, h0] + · have h3 := norm_radialMap h2 h0 + have h4 : 0 < ‖z‖ := norm_pos_iff.mpr h0 + have h5 := h2 _ h4 + have h6 : ((g ‖z‖ / ‖z‖ : ℝ) : ℂ) ≠ 0 := by + have : g ‖z‖ / ‖z‖ ≠ 0 := by positivity + exact_mod_cast this + have h7 : (‖z‖ : ℂ) ≠ 0 := by exact_mod_cast h4.ne' + have h8 : (g ‖z‖ : ℂ) ≠ 0 := by exact_mod_cast h5.ne' + rw [radialMap, h3, h1, radialMap, ← mul_assoc, ← Complex.ofReal_mul] + have : ‖z‖ / g ‖z‖ * (g ‖z‖ / ‖z‖) = 1 := by + field_simp + rw [this] + simp + let θ : ℂ ≃ₜ ℂ := + { toFun := radialMap f + invFun := radialMap f' + left_inv := hinv hf'f hf0 + right_inv := hinv hff' hf'0 + continuous_toFun := continuous_radialMap hfc hf1 + continuous_invFun := continuous_radialMap hf'c hf'1 } + refine ⟨θ, fun z hz => radialMap_of_le hf1 (mem_closedBall_zero_iff.mp hz), fun w hw => ?_⟩ + refine ⟨θ.symm w, ?_, θ.apply_symm_apply w⟩ + by_cases h0 : w = 0 + · have : θ.symm w = 0 := by + change radialMap f' w = 0 + simp [radialMap, h0] + rw [this, mem_closedBall_zero_iff, norm_zero] + linarith + · have h1 : ‖θ.symm w‖ = f' ‖w‖ := norm_radialMap hf'0 h0 + rw [mem_closedBall_zero_iff, h1] + have h2 : f' M = 1 + δ := by rw [← hfM, hf'f] + rw [← h2] + exact e.symm.monotone (mem_closedBall_zero_iff.mp hw) + +/-! ### Extending a map of a closed disc to a larger closed disc -/ + +variable {S : Type u} [TopologicalSpace S] + +/-- A homeomorphism of the plane that sends the unit circle onto `F` sends the closed unit disc +onto the closed domain of `F`. -/ +theorem image_closedBall_of_homeomorph (G : ℂ ≃ₜ ℂ) {F : Set ℂ} (hF : Nonempty (Circle ≃ₜ F)) + (h : G '' sphere 0 1 = F) : G '' closedBall 0 1 = closedInner F := by + obtain ⟨h1, h2⟩ := isClosedDisc_closedBall.1.image (f := G) (f' := G.symm) + G.continuous.continuousOn G.symm.continuous.continuousOn fun z _ => G.symm_apply_apply z + rw [isClosedDisc_closedBall.2, h] at h2 + exact eq_closedInner_of_discBd hF h1 h2 + +theorem BdMatch.trans {A B C : Set ℂ} {f f' k k' : ℂ → ℂ} (m : BdMatch A B f f') + (m' : BdMatch B C k k') : BdMatch A C (fun z => k (f z)) (fun z => f' (k' z)) := by + obtain ⟨h1, h2, h3, h4, h5, h6⟩ := m + obtain ⟨h1', h2', h3', h4', h5', h6'⟩ := m' + refine ⟨h1'.comp h1, h2.comp h2', ?_, ?_, h5'.comp h5 h1, h6.comp h6' h2'⟩ + · intro z hz + change f' (k' (k (f z))) = z + rw [h3' (h1 hz), h3 hz] + · intro z hz + change k (f (f' (k' z))) = z + rw [h4 (h2' hz), h4' hz] + +/-- **The extension step.** Let `D` be a closed disc in the inside of the closed disc `D⁺`, and let +`ψ` embed `D` in the plane. Then `ψ` extends to an embedding of `D⁺` whose image contains the ball +of radius `R`. -/ +theorem exists_extension_step [T2Space S] {D E : Set S} (hD : IsClosedDisc D) + (hE : IsClosedDisc E) (hman : ∀ x : S, IsManifoldPoint x) (hsub : D ⊆ discInt E) {ψ : S → ℂ} + (hψc : ContinuousOn ψ D) (hψi : InjOn ψ D) (R : ℝ) : + ∃ ψ' : S → ℂ, ContinuousOn ψ' E ∧ InjOn ψ' E ∧ EqOn ψ' ψ D ∧ closedBall 0 R ⊆ ψ' '' E := by + classical + obtain ⟨h, g, c⟩ := hE.exists_isChart + have hDsub : D ⊆ E := hsub.trans (discInt_subset _) + obtain ⟨y₀, hy₀⟩ := hD.nonempty_discInt + have : Nonempty S := ⟨y₀⟩ + have hDc := hD.isCompact + -- the two closed domains + obtain ⟨ψinv, hψinv, hψl⟩ := exists_inv_of_compactOn hDc hψc hψi + obtain ⟨hΩ, hΩb⟩ := hD.image hψc hψinv hψl + have hΩ₀m := hD.image (c.hc.mono hDsub) (c.gc.mono (by + rintro _ ⟨x, hx, rfl⟩ + exact c.hm (hDsub hx))) (c.gh.mono hDsub) + obtain ⟨hΩ₀, hΩ₀b⟩ := hΩ₀m + set F := ψ '' discBd D with hF + set F₀ := h '' discBd D with hF₀ + have hFo : Nonempty (Circle ≃ₜ F) := hΩb ▸ hΩ.isOArc_discBd + have hF₀o : Nonempty (Circle ≃ₜ F₀) := hΩ₀b ▸ hΩ₀.isOArc_discBd + have hΩeq := eq_closedInner_of_discBd hFo hΩ hΩb + have hΩ₀eq := eq_closedInner_of_discBd hF₀o hΩ₀ hΩ₀b + have hbdD : discBd D ⊆ D := discBd_subset D + have hgh : ∀ x ∈ D, g (h x) = x := fun x hx => c.gh (hDsub hx) + have hψψ : ∀ x ∈ D, ψinv (ψ x) = x := fun x hx => hψl hx + have hmatch : BdMatch F₀ F (fun w => ψ (g w)) (fun w => h (ψinv w)) := by + refine ⟨?_, ?_, ?_, ?_, ?_, ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + change ψ (g (h x)) ∈ F + rw [hgh x (hbdD hx)] + exact ⟨x, hx, rfl⟩ + · rintro _ ⟨x, hx, rfl⟩ + change h (ψinv (ψ x)) ∈ F₀ + rw [hψψ x (hbdD hx)] + exact ⟨x, hx, rfl⟩ + · rintro _ ⟨x, hx, rfl⟩ + change h (ψinv (ψ (g (h x)))) = h x + rw [hgh x (hbdD hx), hψψ x (hbdD hx)] + · rintro _ ⟨x, hx, rfl⟩ + change ψ (g (h (ψinv (ψ x)))) = ψ x + rw [hψψ x (hbdD hx), hgh x (hbdD hx)] + · refine hψc.comp (c.gc.mono ?_) ?_ + · rintro _ ⟨x, hx, rfl⟩ + exact c.hm (hDsub (hbdD hx)) + · rintro _ ⟨x, hx, rfl⟩ + show g (h x) ∈ D + rw [hgh x (hbdD hx)] + exact hbdD hx + · refine c.hc.comp (hψinv.mono (image_mono hbdD)) ?_ + rintro _ ⟨x, hx, rfl⟩ + show ψinv (ψ x) ∈ E + rw [hψψ x (hbdD hx)] + exact hDsub (hbdD hx) + obtain ⟨φ⟩ := id hFo + obtain ⟨o⟩ := oArc_sphere + obtain ⟨h₁, k₁, m₁, -⟩ := exists_bdMatch (o.symm.trans φ) + obtain ⟨G₂, hG₂⟩ := exists_homeomorph_of_bdMatch hFo m₁ + have hm₀ : BdMatch (sphere 0 1) F₀ (fun z => h (ψinv (h₁ z))) (fun w => k₁ (ψ (g w))) := + m₁.trans hmatch.symm + obtain ⟨G₁, hG₁⟩ := exists_homeomorph_of_bdMatch hF₀o hm₀ + have hG₂im : G₂ '' sphere 0 1 = F := by + rw [image_congr hG₂] + exact m₁.image_eq + have hG₁im : G₁ '' sphere 0 1 = F₀ := by + rw [image_congr hG₁] + exact hm₀.image_eq + have hG₂b := image_closedBall_of_homeomorph G₂ hFo hG₂im + have hG₁b := image_closedBall_of_homeomorph G₁ hF₀o hG₁im + rw [← hΩeq] at hG₂b + rw [← hΩ₀eq] at hG₁b + let ω : ℂ → ℂ := fun z => G₂ (G₁.symm z) + have hωc : Continuous ω := G₂.continuous.comp G₁.symm.continuous + have hωi : Function.Injective ω := G₂.injective.comp G₁.symm.injective + have hωF : ∀ x ∈ discBd D, ω (h x) = ψ x := by + intro x hx + have hmem : ψ x ∈ F := ⟨x, hx, rfl⟩ + have hz := m₁.2.1 hmem + have h1 : h₁ (k₁ (ψ x)) = ψ x := m₁.2.2.2.1 hmem + have h2 : G₁ (k₁ (ψ x)) = h x := by + rw [hG₁ hz] + change h (ψinv (h₁ (k₁ (ψ x)))) = h x + rw [h1, hψψ x (hbdD hx)] + change G₂ (G₁.symm (h x)) = ψ x + rw [← h2, G₁.symm_apply_apply, hG₂ hz, h1] + have hωΩ : ω '' (h '' D) = ψ '' D := by + rw [← hG₁b, ← hG₂b, image_image] + exact image_congr fun z _ => by + change G₂ (G₁.symm (G₁ z)) = G₂ z + rw [G₁.symm_apply_apply] + let ψ₀ : S → ℂ := fun x => if x ∈ D then ψ x else ω (h x) + have hψ₀D : ∀ x ∈ D, ψ₀ x = ψ x := fun x hx => ite_eq_left hx + have hψ₀n : ∀ x, x ∉ D → ψ₀ x = ω (h x) := fun x hx => ite_eq_right hx + have hE₂c : IsClosed (E \ discInt D) := hE.isClosed.sdiff (hD.isOpen_discInt hman) + have hcover : D ∪ (E \ discInt D) = E := by + ext x + constructor + · rintro (hx | hx) + · exact hDsub hx + · exact hx.1 + · intro hx + by_cases hi : x ∈ discInt D + · exact .inl hi.1 + · exact .inr ⟨hx, hi⟩ + have hE₂eq : ∀ x ∈ E \ discInt D, ψ₀ x = ω (h x) := by + intro x hx + by_cases hxD : x ∈ D + · have hxb : x ∈ discBd D := by + by_contra hcon + exact hx.2 ⟨hxD, hcon⟩ + rw [hψ₀D x hxD, hωF x hxb] + · exact hψ₀n x hxD + have hψ₀c : ContinuousOn ψ₀ E := by + rw [← hcover] + refine ContinuousOn.union_of_isClosed (hψc.congr hψ₀D) ?_ hD.isClosed hE₂c + refine ContinuousOn.congr ?_ hE₂eq + exact hωc.comp_continuousOn (c.hc.mono sdiff_subset) + have hhi : InjOn h E := c.gh.injOn + have hmix : ∀ x ∈ D, ∀ y ∈ E, y ∉ D → ψ x ≠ ω (h y) := by + intro x hx y hyE hyD he + have h1 : ψ x ∈ ω '' (h '' D) := hωΩ ▸ mem_image_of_mem ψ hx + obtain ⟨_, ⟨x', hx', rfl⟩, h2⟩ := h1 + rw [he] at h2 + have h3 := hωi h2 + exact hyD (hhi (hDsub hx') hyE h3 ▸ hx') + have hψ₀i : InjOn ψ₀ E := by + intro x hx y hy he + by_cases h1 : x ∈ D <;> by_cases h2 : y ∈ D + · rw [hψ₀D x h1, hψ₀D y h2] at he + exact hψi h1 h2 he + · rw [hψ₀D x h1, hψ₀n y h2] at he + exact absurd he (hmix x h1 y hy h2) + · rw [hψ₀n x h1, hψ₀D y h2] at he + exact absurd he.symm (hmix y h2 x hx h1) + · rw [hψ₀n x h1, hψ₀n y h2] at he + exact hhi hx hy (hωi he) + have hψ₀img : ω '' closedBall 0 1 ⊆ ψ₀ '' E := by + rintro _ ⟨z, hz, rfl⟩ + by_cases hx : g z ∈ D + · have h1 : ω z ∈ ψ '' D := by + rw [← hωΩ] + exact ⟨z, ⟨g z, hx, c.hg hz⟩, rfl⟩ + obtain ⟨x, hx', he⟩ := h1 + exact ⟨x, hDsub hx', by rw [hψ₀D x hx', he]⟩ + · refine ⟨g z, c.gm hz, ?_⟩ + rw [hψ₀n _ hx, c.hg hz] + -- the push + have hball : h '' D ⊆ ball 0 1 := by + rintro _ ⟨x, hx, rfl⟩ + have := hsub hx + rw [c.discInt_eq] at this + obtain ⟨z, hz, rfl⟩ := this + rwa [c.hg (ball_subset_closedBall hz)] + have hAo : IsOpen (G₁.symm '' ball 0 1) := G₁.symm.isOpenMap _ isOpen_ball + have hsubA : closedBall (0 : ℂ) 1 ⊆ G₁.symm '' ball 0 1 := fun z hz => + ⟨G₁ z, hball (hG₁b ▸ mem_image_of_mem G₁ hz), G₁.symm_apply_apply z⟩ + obtain ⟨δ₀, hδ₀, hth⟩ := (isCompact_closedBall (0 : ℂ) 1).exists_thickening_subset_open hAo hsubA + rw [thickening_closedBall hδ₀ zero_le_one] at hth + have hδ : 0 < δ₀ / 2 := by positivity + have hsubδ : closedBall (0 : ℂ) (1 + δ₀ / 2) ⊆ G₁.symm '' ball 0 1 := + (closedBall_subset_ball (by linarith)).trans hth + have hBc : IsCompact (G₂.symm '' closedBall (0 : ℂ) R) := + (isCompact_closedBall _ _).image G₂.symm.continuous + obtain ⟨M₀, hM₀⟩ := hBc.isBounded.subset_closedBall (0 : ℂ) + set M := max M₀ 0 + 2 + δ₀ with hM + obtain ⟨θ, hθ1, hθ2⟩ := exists_radial (M := M) hδ (by + have := le_max_right M₀ 0 + linarith) + let ζ : ℂ → ℂ := fun z => G₂ (θ (G₂.symm z)) + have hζc : Continuous ζ := G₂.continuous.comp (θ.continuous.comp G₂.symm.continuous) + have hζi : Function.Injective ζ := G₂.injective.comp (θ.injective.comp G₂.symm.injective) + refine ⟨fun x => ζ (ψ₀ x), hζc.comp_continuousOn hψ₀c, ?_, ?_, ?_⟩ + · exact fun x hx y hy he => hψ₀i hx hy (hζi he) + · intro x hx + change ζ (ψ₀ x) = ψ x + rw [hψ₀D x hx] + have h1 : ψ x ∈ G₂ '' closedBall 0 1 := hG₂b ▸ mem_image_of_mem ψ hx + obtain ⟨z, hz, he⟩ := h1 + change G₂ (θ (G₂.symm (ψ x))) = ψ x + rw [← he, G₂.symm_apply_apply, hθ1 z hz] + · intro w hw + have h1 : G₂.symm w ∈ closedBall (0 : ℂ) M := by + have := hM₀ (mem_image_of_mem G₂.symm hw) + rw [mem_closedBall_zero_iff] at this ⊢ + have h2 := le_max_left M₀ 0 + linarith + obtain ⟨u, hu, hue⟩ := hθ2 h1 + obtain ⟨z, hz, hzu⟩ := hsubδ hu + have h3 : ω z ∈ ψ₀ '' E := hψ₀img ⟨z, ball_subset_closedBall hz, rfl⟩ + obtain ⟨x, hx, hxe⟩ := h3 + refine ⟨x, hx, ?_⟩ + change G₂ (θ (G₂.symm (ψ₀ x))) = w + rw [hxe] + change G₂ (θ (G₂.symm (G₂ (G₁.symm z)))) = w + rw [G₂.symm_apply_apply, hzu, hue, G₂.apply_symm_apply] + +/-! ### The chain of discs -/ + +section Chain + +variable [CompactSpace S] [T2Space S] [ConnectedSpace S] + (hint : ∀ x : S, IsInteriorPoint x) {Y : Set S} (hYo : IsOpen Y) (hYc : IsPreconnected Y) + (H : ∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) + (hns : ¬ (IsSphere S ∧ Y = univ)) +include hint hYo H hns + +omit hYo in +/-- If a closed disc overlaps the unit ball of a chart, then a larger closed disc has that whole +unit ball in its inside. -/ +theorem exists_disc_of_overlap {D : Set S} (hDY : D ⊆ Y) (hD : IsClosedDisc D) + {U : Set S} {h : S → ℂ} {g : ℂ → S} (c : BallChart 3 U h g) (hUY : U ⊆ Y) + (hz : (discInt D ∩ g '' ball 0 1).Nonempty) : + ∃ D' : Set S, D' ⊆ Y ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ g '' ball 0 1 ⊆ discInt D' := by + obtain ⟨D', h1, h2, h3, h4⟩ := exists_disc_merge hint H hns hDY hD c hUY hz + have hb : ball (0 : ℂ) 1 ⊆ ball 0 3 := ball_subset_ball (by norm_num) + refine ⟨D', h1, h2, h3, subset_discInt_of_isOpen (fun x _ => hint x) + (c.isOpen_image isOpen_ball hb) ?_⟩ + exact (image_mono (ball_subset_closedBall.trans (closedBall_subset_closedBall + (by norm_num)))).trans h4 + +include hYc + +/-- Every point of `Y` lies in the inside of a closed disc of `Y` that contains a given closed disc +of `Y`: the set of such points is open, and so is the rest of `Y`, by `exists_disc_of_overlap`. -/ +theorem exists_disc_mem {D : Set S} (hDY : D ⊆ Y) (hD : IsClosedDisc D) {y : S} (hy : y ∈ Y) : + ∃ D' : Set S, D' ⊆ Y ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ y ∈ discInt D' := by + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hint x).isManifoldPoint + let A : Set S := {y | ∃ D' : Set S, D' ⊆ Y ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ y ∈ discInt D'} + have hAo : IsOpen A := by + refine isOpen_iff_mem_nhds.mpr ?_ + rintro x ⟨D', h1, h2, h3, h4⟩ + filter_upwards [(h2.isOpen_discInt hman).mem_nhds h4] with z hz + exact ⟨D', h1, h2, h3, hz⟩ + have hBo : IsOpen (Y \ A) := by + refine isOpen_iff_mem_nhds.mpr ?_ + rintro x ⟨hxY, hxA⟩ + obtain ⟨U, h, g, c, hUY, hg0⟩ := (hint x).exists_ballChart hYo hxY (R := 3) (by norm_num) + have hb : ball (0 : ℂ) 1 ⊆ ball 0 3 := ball_subset_ball (by norm_num) + have hV := c.isOpen_image isOpen_ball hb + have hx : x ∈ g '' ball 0 1 := ⟨0, by simp, hg0⟩ + filter_upwards [hV.mem_nhds hx] with z hz + obtain ⟨w, hw, rfl⟩ := id hz + refine ⟨hUY (c.gm (hb hw)), ?_⟩ + rintro ⟨D', h1, h2, h3, h4⟩ + obtain ⟨E, h5, h6, h7, h8⟩ := exists_disc_of_overlap hint H hns h1 h2 c hUY ⟨_, h4, hz⟩ + exact hxA ⟨E, h5, h6, h3.trans h7, h8 hx⟩ + by_contra hcon + obtain ⟨z, hz⟩ := hD.nonempty_discInt + obtain ⟨w, -, hw1, hw2⟩ := hYc A (Y \ A) hAo hBo + (fun x hx => by + by_cases hxA : x ∈ A + · exact .inl hxA + · exact .inr ⟨hx, hxA⟩) + ⟨z, hDY (discInt_subset D hz), D, hDY, hD, Subset.rfl, hz⟩ ⟨y, hy, hy, hcon⟩ + exact hw2.2 hw1 + +/-- Around every point of `Y` there is a neighbourhood that the inside of a closed disc swallows, +starting from any closed disc of `Y`. -/ +theorem exists_disc_nhds {y : S} (hy : y ∈ Y) : ∃ V ∈ 𝓝 y, ∀ D : Set S, D ⊆ Y → IsClosedDisc D → + ∃ D' : Set S, D' ⊆ Y ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ V ⊆ discInt D' := by + obtain ⟨U, h, g, c, hUY, hg0⟩ := (hint y).exists_ballChart hYo hy (R := 3) (by norm_num) + have hb : ball (0 : ℂ) 1 ⊆ ball 0 3 := ball_subset_ball (by norm_num) + have hy' : y ∈ g '' ball 0 1 := ⟨0, by simp, hg0⟩ + refine ⟨g '' ball 0 1, (c.isOpen_image isOpen_ball hb).mem_nhds hy', fun D hDY hD => ?_⟩ + obtain ⟨D₁, h1, h2, h3, h4⟩ := exists_disc_mem hint hYo hYc H hns hDY hD hy + obtain ⟨D₂, h5, h6, h7, h8⟩ := exists_disc_of_overlap hint H hns h1 h2 c hUY ⟨y, h4, hy'⟩ + exact ⟨D₂, h5, h6, h3.trans h7, h8⟩ + +/-- The inside of a closed disc of `Y` swallows any compact subset of `Y` and any given closed disc +of `Y`. -/ +theorem exists_disc_compact {K : Set S} (hK : IsCompact K) (hKY : K ⊆ Y) {D : Set S} (hDY : D ⊆ Y) + (hD : IsClosedDisc D) : + ∃ D' : Set S, D' ⊆ Y ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ K ⊆ discInt D' := by + refine hK.induction_on (p := fun K => ∀ D : Set S, D ⊆ Y → IsClosedDisc D → + ∃ D' : Set S, D' ⊆ Y ∧ IsClosedDisc D' ∧ D ⊆ D' ∧ K ⊆ discInt D') ?_ ?_ ?_ ?_ D hDY hD + · exact fun D hDY hD => ⟨D, hDY, hD, Subset.rfl, empty_subset _⟩ + · intro s t hst hp D hDY hD + obtain ⟨D', h1, h2, h3, h4⟩ := hp D hDY hD + exact ⟨D', h1, h2, h3, hst.trans h4⟩ + · intro s t hs ht D hDY hD + obtain ⟨D₁, h1, h2, h3, h4⟩ := hs D hDY hD + obtain ⟨D₂, h5, h6, h7, h8⟩ := ht D₁ h1 h2 + exact ⟨D₂, h5, h6, h3.trans h7, + union_subset (h4.trans (discInt_mono (fun x => (hint x).isManifoldPoint) h2 h7)) h8⟩ + · intro x hx + obtain ⟨V, hV, hp⟩ := exists_disc_nhds hint hYo hYc H hns (hKY hx) + exact ⟨V, mem_nhdsWithin_of_mem_nhds hV, hp⟩ + +/-- `Y` is the increasing union of the insides of a chain of closed discs. -/ +theorem exists_disc_chain (hYne : Y.Nonempty) : + ∃ D : ℕ → Set S, (∀ n, D n ⊆ Y) ∧ (∀ n, IsClosedDisc (D n)) ∧ + (∀ n, D n ⊆ discInt (D (n + 1))) ∧ Y ⊆ ⋃ n, discInt (D n) := by + classical + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hint x).isManifoldPoint + obtain ⟨y, hy⟩ := hYne + obtain ⟨U, h, g, c, hUY, -⟩ := (hint y).exists_ballChart hYo hy (R := 3) (by norm_num) + have hb : closedBall (0 : ℂ) 1 ⊆ ball 0 3 := closedBall_subset_ball (by norm_num) + have hd₀ := (c.image_disc isClosedDisc_closedBall.1 hb).1 + have hsc := secondCountable_of_manifold hman + have : LocallyCompactSpace Y := hYo.locallyCompactSpace + let E : CompactExhaustion Y := default + let T := {D : Set S // D ⊆ Y ∧ IsClosedDisc D} + have hnext : ∀ (n : ℕ) (D : T), ∃ D' : T, D.1 ⊆ discInt D'.1 ∧ + ((↑) '' E n : Set S) ⊆ discInt D'.1 := by + intro n D + have hcomp : IsCompact (((↑) '' E n : Set S) ∪ D.1) := + ((E.isCompact n).image continuous_subtype_val).union D.2.2.isCompact + obtain ⟨D', h1, h2, -, h4⟩ := exists_disc_compact hint hYo hYc H hns hcomp + (union_subset (by rintro _ ⟨x, -, rfl⟩; exact x.2) D.2.1) D.2.1 D.2.2 + exact ⟨⟨D', h1, h2⟩, subset_union_right.trans h4, subset_union_left.trans h4⟩ + choose next hnext1 hnext2 using hnext + let seq : ℕ → T := fun n => Nat.rec ⟨g '' closedBall 0 1, + (image_subset_iff.mpr fun z hz => c.gm (hb hz)).trans hUY, hd₀⟩ next n + refine ⟨fun n => (seq n).1, fun n => (seq n).2.1, fun n => (seq n).2.2, fun n => hnext1 n _, ?_⟩ + intro x hx + obtain ⟨n, hn⟩ := E.exists_mem ⟨x, hx⟩ + exact mem_iUnion.mpr ⟨n + 1, hnext2 n _ ⟨_, hn, rfl⟩⟩ + +end Chain + +/-! ### The limit map -/ + +/-- A chain of closed discs, each in the inside of the next, has as union a copy of the plane. -/ +theorem exists_homeomorph_of_chain [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) {Y : Set S} + {D : ℕ → Set S} (hD : ∀ n, IsClosedDisc (D n)) + (hsub : ∀ n, D n ⊆ discInt (D (n + 1))) (hY : Y = ⋃ n, discInt (D n)) : + Nonempty (Y ≃ₜ ℂ) := by + classical + obtain ⟨h₀, g₀, c₀⟩ := (hD 0).exists_isChart + let T : ℕ → Type u := fun n => {ψ : S → ℂ // ContinuousOn ψ (D n) ∧ InjOn ψ (D n) ∧ + closedBall 0 ((n : ℝ) - 1) ⊆ ψ '' D n} + have hnext : ∀ (n : ℕ) (ψ : T n), ∃ ψ' : T (n + 1), EqOn ψ'.1 ψ.1 (D n) := by + intro n ψ + obtain ⟨ψ', h1, h2, h3, h4⟩ := exists_extension_step (hD n) (hD (n + 1)) hman (hsub n) + ψ.2.1 ψ.2.2.1 (n : ℝ) + refine ⟨⟨ψ', h1, h2, ?_⟩, h3⟩ + push_cast + simpa using h4 + choose next hnext using hnext + have h0 : ContinuousOn h₀ (D 0) ∧ InjOn h₀ (D 0) ∧ + closedBall 0 (((0 : ℕ) : ℝ) - 1) ⊆ h₀ '' D 0 := by + refine ⟨c₀.hc, c₀.gh.injOn, ?_⟩ + rw [closedBall_eq_empty.mpr (by norm_num)] + exact empty_subset _ + let seq : (n : ℕ) → T n := fun n => Nat.rec ⟨h₀, h0⟩ next n + let ψ : ℕ → S → ℂ := fun n => (seq n).1 + have hψc : ∀ n, ContinuousOn (ψ n) (D n) := fun n => (seq n).2.1 + have hψi : ∀ n, InjOn (ψ n) (D n) := fun n => (seq n).2.2.1 + have hψb : ∀ n : ℕ, closedBall 0 ((n : ℝ) - 1) ⊆ ψ n '' D n := fun n => (seq n).2.2.2 + have hψs : ∀ n, EqOn (ψ (n + 1)) (ψ n) (D n) := fun n => hnext n _ + have hDs : ∀ n, D n ⊆ D (n + 1) := fun n => (hsub n).trans (discInt_subset _) + have hDm : Monotone D := monotone_nat_of_le_succ hDs + have hψm : ∀ {n m : ℕ}, n ≤ m → EqOn (ψ m) (ψ n) (D n) := by + intro n m hnm + induction m, hnm using Nat.le_induction with + | base => exact fun _ _ => rfl + | succ m _ ih => + intro x hx + rw [hψs m (hDm ‹n ≤ m› hx), ih hx] + have hYD : ∀ n, D n ⊆ Y := fun n => by + rw [hY] + exact (hsub n).trans (subset_iUnion (fun n => discInt (D n)) (n + 1)) + have hidx : ∀ x : S, ∃ n, x ∈ Y → x ∈ D n := fun x => by + by_cases hx : x ∈ Y + · rw [hY] at hx + obtain ⟨n, hn⟩ := mem_iUnion.mp hx + exact ⟨n, fun _ => discInt_subset _ hn⟩ + · exact ⟨0, fun h => absurd h hx⟩ + choose idx hidx using hidx + let Ψ : Y → ℂ := fun x => ψ (idx x.1) x.1 + have hΨ : ∀ (x : Y) n, x.1 ∈ D n → Ψ x = ψ n x.1 := by + intro x n hn + have h1 := hψm (le_max_left n (idx x.1)) hn + have h2 := hψm (le_max_right n (idx x.1)) (hidx x.1 x.2) + exact h2.symm.trans h1 + have hinj : Function.Injective Ψ := by + intro x y he + have hx := hDm (le_max_left (idx x.1) (idx y.1)) (hidx x.1 x.2) + have hy := hDm (le_max_right (idx x.1) (idx y.1)) (hidx y.1 y.2) + rw [hΨ x _ hx, hΨ y _ hy] at he + exact Subtype.ext (hψi _ hx hy he) + have hball : ∀ w : ℂ, ∃ n : ℕ, ‖w‖ < (n : ℝ) - 1 := fun w => by + obtain ⟨n, hn⟩ := exists_nat_gt (‖w‖ + 1) + exact ⟨n, by linarith⟩ + have hsurj : Function.Surjective Ψ := by + intro w + obtain ⟨n, hn⟩ := hball w + obtain ⟨x, hx, he⟩ := hψb n (mem_closedBall_zero_iff.mpr hn.le) + exact ⟨⟨x, hYD n hx⟩, (hΨ ⟨x, hYD n hx⟩ n hx).trans he⟩ + have hcont : Continuous Ψ := by + rw [continuous_iff_continuousAt] + intro x + have hx : x.1 ∈ ⋃ n, discInt (D n) := hY ▸ x.2 + obtain ⟨n, hn⟩ := mem_iUnion.mp hx + have hopen := (hD n).isOpen_discInt hman + have h1 : ContinuousAt (ψ n) x.1 := + (hψc n).continuousAt (mem_of_superset (hopen.mem_nhds hn) + (discInt_subset _ : discInt (D n) ⊆ D n)) + have h2 : ContinuousAt (fun z : Y => ψ n z.1) x := h1.comp continuous_subtype_val.continuousAt + refine h2.congr ?_ + have h3 : Subtype.val ⁻¹' discInt (D n) ∈ 𝓝 x := + (hopen.preimage continuous_subtype_val).mem_nhds hn + filter_upwards [h3] with z hz + exact (hΨ z n (discInt_subset _ hz)).symm + let e : Y ≃ ℂ := Equiv.ofBijective Ψ ⟨hinj, hsurj⟩ + have hsymm : Continuous e.symm := by + rw [continuous_iff_continuousAt] + intro w + obtain ⟨n, hn⟩ := hball w + have : Nonempty S := by + obtain ⟨z, hz⟩ := (hD 0).nonempty_discInt + exact ⟨z⟩ + obtain ⟨ι, hι, hιl⟩ := exists_inv_of_compactOn (hD n).isCompact (hψc n) (hψi n) + have hballn : ball 0 ((n : ℝ) - 1) ⊆ ψ n '' D n := ball_subset_closedBall.trans (hψb n) + have hw : ball 0 ((n : ℝ) - 1) ∈ 𝓝 w := isOpen_ball.mem_nhds (mem_ball_zero_iff.mpr hn) + have h1 : ContinuousAt ι w := hι.continuousAt (mem_of_superset hw hballn) + refine (IsInducing.subtypeVal.continuousAt_iff).mpr (h1.congr ?_) + filter_upwards [hw] with z hz + obtain ⟨x, hx, rfl⟩ := hballn hz + change ι (ψ n x) = (e.symm (ψ n x)).1 + have h2 : e.symm (ψ n x) = ⟨x, hYD n hx⟩ := by + rw [Equiv.symm_apply_eq] + exact (hΨ ⟨x, hYD n hx⟩ n hx).symm + rw [h2, hιl hx] + exact ⟨⟨e, hcont, hsymm⟩⟩ + +/-- **Graph Minors VII, (4.2).** See the module docstring for the route. -/ +theorem open_disc : OpenDiscStatement.{u} := by + intro S _ Y hS _ hYc hYo H + obtain ⟨hcpt, ht2, hint⟩ := hS + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hint x).isManifoldPoint + by_cases hns : IsSphere S ∧ Y = univ + · exact .inl hns + right + obtain ⟨D, hDY, hD, hsub, hcov⟩ := + exists_disc_chain hint hYo hYc.isPreconnected H hns hYc.nonempty + have hY : Y = ⋃ n, discInt (D n) := hcov.antisymm + (iUnion_subset fun n => (discInt_subset _).trans (hDY n)) + obtain ⟨e⟩ := exists_homeomorph_of_chain hman hD hsub hY + refine ⟨hYo, ⟨?_⟩⟩ + exact (Homeomorph.unitBall (E := EuclideanPlane)).symm.trans + (complexPlane.symm.toHomeomorph.trans e.symm) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/PasteDisc.lean b/LeanPool/GraphMinor/Surface/PasteDisc.lean new file mode 100644 index 0000000000..2d3a17c279 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/PasteDisc.lean @@ -0,0 +1,771 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Gluing +import Mathlib.Analysis.Complex.Basic + +/-! +# Pasting a closed disc onto a cuff + +`paste_disc : PasteDiscStatement`: pasting a closed disc onto a cuff `C` of a surface gives a +surface. + +The space is the quotient of the sum of `S` and the closed disc of `ℂ` that pastes each point `z` +of the unit circle to `b z`, for a homeomorphism `b` from the circle onto `C`. It is compact and +Hausdorff by `t2Space_quotient_of_isClosed`. Points off `C` keep their charts. At a point of `C`, +take +a half plane chart of `S`, and on the disc side use polar coordinates, with the angle read off +this chart. The two half rectangles paste to a rectangle around the point +(`isInteriorPoint_pasted`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- The closed disc of `ℂ`, as a type. -/ +abbrev DiscType : Type := closedBall (0 : ℂ) 1 + +/-- `a` and `a'` are equal, or pasted: one is `z` on the unit circle and the other is `b z`. -/ +def pasteRel (b : ℂ → S) (a a' : S ⊕ DiscType) : Prop := + a = a' ∨ (∃ z : DiscType, z.1 ∈ sphere (0 : ℂ) 1 ∧ a = .inl (b z) ∧ a' = .inr z) ∨ + (∃ z : DiscType, z.1 ∈ sphere (0 : ℂ) 1 ∧ a = .inr z ∧ a' = .inl (b z)) + +/-- The relation `pasteRel` is an equivalence relation, since `b` is injective on the circle. -/ +def pasteSetoid {b : ℂ → S} (hb : InjOn b (sphere (0 : ℂ) 1)) : Setoid (S ⊕ DiscType) where + r := pasteRel b + iseqv := + { refl := fun _ => .inl rfl + symm := by + rintro a a' (rfl | ⟨z, hz, rfl, rfl⟩ | ⟨z, hz, rfl, rfl⟩) + · exact .inl rfl + · exact .inr (.inr ⟨z, hz, rfl, rfl⟩) + · exact .inr (.inl ⟨z, hz, rfl, rfl⟩) + trans := by + rintro a a' a'' (rfl | ⟨z, hz, rfl, rfl⟩ | ⟨z, hz, rfl, rfl⟩) h' + · exact h' + · obtain rfl | ⟨w, hw, h1, rfl⟩ | ⟨w, hw, h1, rfl⟩ := h' + · exact .inr (.inl ⟨z, hz, rfl, rfl⟩) + · exact absurd h1 (by simp) + · have : z = w := Sum.inr.inj h1 + subst this + exact .inl rfl + · obtain rfl | ⟨w, hw, h1, rfl⟩ | ⟨w, hw, h1, rfl⟩ := h' + · exact .inr (.inr ⟨z, hz, rfl, rfl⟩) + · have : z = w := Subtype.ext (hb hz hw (Sum.inl.inj h1)) + subst this + exact .inl rfl + · exact absurd h1 (by simp) } + +/-- The space obtained by pasting the closed disc onto `S` along `b`. -/ +def Pasted {b : ℂ → S} (hb : InjOn b (sphere (0 : ℂ) 1)) : Type u := Quotient (pasteSetoid hb) + +instance {b : ℂ → S} (hb : InjOn b (sphere (0 : ℂ) 1)) : TopologicalSpace (Pasted hb) := + inferInstanceAs (TopologicalSpace (Quotient (pasteSetoid hb))) + +variable {b : ℂ → S} (hb : InjOn b (sphere (0 : ℂ) 1)) + +/-- The map from `S` to the pasted space. -/ +def Pasted.ι : S → Pasted hb := fun s => Quotient.mk (pasteSetoid hb) (.inl s) + +/-- The map from the closed disc to the pasted space. -/ +def Pasted.δ : DiscType → Pasted hb := fun z => Quotient.mk (pasteSetoid hb) (.inr z) + +omit [TopologicalSpace S] in +theorem Pasted.ι_eq_ι {s s' : S} : Pasted.ι hb s = Pasted.ι hb s' ↔ s = s' := by + constructor + · intro h + obtain h | ⟨z, -, -, h⟩ | ⟨z, -, h, -⟩ := Quotient.exact h + · exact Sum.inl.inj h + · exact absurd h (by simp) + · exact absurd h (by simp) + · rintro rfl + rfl + +omit [TopologicalSpace S] in +theorem Pasted.δ_eq_δ {z z' : DiscType} : Pasted.δ hb z = Pasted.δ hb z' ↔ z = z' := by + constructor + · intro h + obtain h | ⟨w, -, h, -⟩ | ⟨w, -, -, h⟩ := Quotient.exact h + · exact Sum.inr.inj h + · exact absurd h (by simp) + · exact absurd h (by simp) + · rintro rfl + rfl + +omit [TopologicalSpace S] in +theorem Pasted.ι_eq_δ {s : S} {z : DiscType} : + Pasted.ι hb s = Pasted.δ hb z ↔ z.1 ∈ sphere (0 : ℂ) 1 ∧ s = b z := by + constructor + · intro h + obtain h | ⟨w, hw, h1, h2⟩ | ⟨w, -, h, -⟩ := Quotient.exact h + · exact absurd h (by simp) + · have h3 : w = z := (Sum.inr.inj h2).symm + subst h3 + exact ⟨hw, Sum.inl.inj h1⟩ + · exact absurd h (by simp) + · rintro ⟨hz, rfl⟩ + exact Quotient.sound (.inr (.inl ⟨z, hz, rfl, rfl⟩)) + +omit [TopologicalSpace S] in +theorem Pasted.surj (p : Pasted hb) : (∃ s, p = Pasted.ι hb s) ∨ ∃ z, p = Pasted.δ hb z := by + obtain ⟨a | a, rfl⟩ := Quotient.exists_rep p + · exact .inl ⟨a, rfl⟩ + · exact .inr ⟨a, rfl⟩ + +theorem Pasted.continuous_ι : Continuous (Pasted.ι hb) := + continuous_quotient_mk'.comp continuous_inl + +theorem Pasted.continuous_δ : Continuous (Pasted.δ hb) := + continuous_quotient_mk'.comp continuous_inr + +theorem Pasted.isOpen_iff {W : Set (Pasted hb)} : + IsOpen W ↔ IsOpen (Pasted.ι hb ⁻¹' W) ∧ IsOpen (Pasted.δ hb ⁻¹' W) := by + refine (isQuotientMap_quotient_mk' (s := pasteSetoid hb)).isOpen_preimage.symm.trans ?_ + rw [isOpen_sum_iff] + rfl + +instance [CompactSpace S] : CompactSpace (Pasted hb) := + inferInstanceAs (CompactSpace (Quotient (pasteSetoid hb))) + +theorem Pasted.t2Space [CompactSpace S] [T2Space S] (hbc : ContinuousOn b (sphere (0 : ℂ) 1)) : + T2Space (Pasted hb) := by + have : CompactSpace DiscType := isCompact_iff_compactSpace.mp (isCompact_closedBall 0 1) + refine t2Space_quotient_of_isClosed (pasteSetoid hb) ?_ + let T : Set DiscType := Subtype.val ⁻¹' sphere (0 : ℂ) 1 + have hT : IsCompact T := + (isClosed_sphere.preimage continuous_subtype_val).isCompact + have hbT : ContinuousOn (fun z : DiscType => (Sum.inl (b z) : S ⊕ DiscType)) T := + continuous_inl.comp_continuousOn (hbc.comp continuous_subtype_val.continuousOn fun _ h => h) + have hG : IsCompact ((fun z : DiscType => ((Sum.inl (b z) : S ⊕ DiscType), + (Sum.inr z : S ⊕ DiscType))) '' T) := + hT.image_of_continuousOn (hbT.prodMk continuous_inr.continuousOn) + have hG' := hG.image continuous_swap + have hrel : {p : (S ⊕ DiscType) × (S ⊕ DiscType) | (pasteSetoid hb) p.1 p.2} = + diagonal _ ∪ ((fun z : DiscType => ((Sum.inl (b z) : S ⊕ DiscType), + (Sum.inr z : S ⊕ DiscType))) '' T ∪ + Prod.swap '' ((fun z : DiscType => ((Sum.inl (b z) : S ⊕ DiscType), + (Sum.inr z : S ⊕ DiscType))) '' T)) := by + ext ⟨a, a'⟩ + constructor + · rintro (h | ⟨z, hz, h1, h2⟩ | ⟨z, hz, h1, h2⟩) + · exact .inl h + · exact .inr (.inl ⟨z, hz, Prod.ext h1.symm h2.symm⟩) + · exact .inr (.inr ⟨_, ⟨z, hz, rfl⟩, Prod.ext h1.symm h2.symm⟩) + · rintro (h | ⟨z, hz, he⟩ | ⟨_, ⟨z, hz, rfl⟩, he⟩) + · exact .inl h + · simp only [Prod.mk.injEq] at he + exact .inr (.inl ⟨z, hz, he.1.symm, he.2.symm⟩) + · simp only [Prod.swap_prod_mk, Prod.mk.injEq] at he + exact .inr (.inr ⟨z, hz, he.1.symm, he.2.symm⟩) + rw [hrel] + exact isClosed_diagonal.union (hG.isClosed.union hG'.isClosed) + +/-- The map from the disc of `ℂ` to the pasted space, extended by a junk value. -/ +noncomputable def Pasted.δ' (s₀ : S) : ℂ → Pasted hb := fun z => + open Classical in if h : z ∈ closedBall (0 : ℂ) 1 then Pasted.δ hb ⟨z, h⟩ else Pasted.ι hb s₀ + +omit [TopologicalSpace S] in +theorem Pasted.δ'_of_mem (s₀ : S) {z : ℂ} (h : z ∈ closedBall (0 : ℂ) 1) : + Pasted.δ' hb s₀ z = Pasted.δ hb ⟨z, h⟩ := by + simp [Pasted.δ', h] + +theorem Pasted.continuousOn_δ' (s₀ : S) : ContinuousOn (Pasted.δ' hb s₀) (closedBall 0 1) := by + rw [continuousOn_iff_continuous_domRestrict] + have : (closedBall (0 : ℂ) 1).domRestrict (Pasted.δ' hb s₀) = Pasted.δ hb := + funext fun z => Pasted.δ'_of_mem hb s₀ z.2 + rw [this] + exact Pasted.continuous_δ hb + +omit [TopologicalSpace S] in +theorem Pasted.injOn_δ' (s₀ : S) : InjOn (Pasted.δ' hb s₀) (closedBall 0 1) := by + intro z hz w hw he + rw [Pasted.δ'_of_mem hb s₀ hz, Pasted.δ'_of_mem hb s₀ hw, Pasted.δ_eq_δ] at he + exact congrArg Subtype.val he + +/-- A point of the open disc is an interior point of the pasted space. -/ +theorem Pasted.isInteriorPoint_δ [CompactSpace S] [T2Space S] + (hbc : ContinuousOn b (sphere (0 : ℂ) 1)) (s₀ : S) {z : ℂ} (hz : z ∈ ball (0 : ℂ) 1) : + IsInteriorPoint (Pasted.δ' hb s₀ z) := by + have := Pasted.t2Space hb hbc + refine isInteriorPoint_of_injOn (isCompact_closedBall 0 1) (Pasted.continuousOn_δ' hb s₀) + (Pasted.injOn_δ' hb s₀) ball_subset_closedBall isOpen_ball ?_ hz + rw [Pasted.isOpen_iff] + constructor + · convert isOpen_empty + rw [eq_empty_iff_forall_notMem] + rintro s ⟨w, hw, he⟩ + rw [Pasted.δ'_of_mem hb s₀ (ball_subset_closedBall hw), eq_comm, Pasted.ι_eq_δ] at he + have h1 : ‖w‖ = 1 := mem_sphere_zero_iff_norm.mp he.1 + have h2 : ‖w‖ < 1 := mem_ball_zero_iff.mp hw + linarith + · have : Pasted.δ hb ⁻¹' (Pasted.δ' hb s₀ '' ball 0 1) = Subtype.val ⁻¹' ball (0 : ℂ) 1 := by + ext w + constructor + · rintro ⟨v, hv, he⟩ + rw [Pasted.δ'_of_mem hb s₀ (ball_subset_closedBall hv), Pasted.δ_eq_δ] at he + change w.1 ∈ ball (0 : ℂ) 1 + rw [← he] + exact hv + · intro hw + exact ⟨w.1, hw, by rw [Pasted.δ'_of_mem hb s₀ w.2]⟩ + rw [this] + exact isOpen_ball.preimage continuous_subtype_val + +/-- The map from `S` to the pasted space is an open embedding off `C`. -/ +theorem Pasted.isOpenEmbedding_compl [CompactSpace S] [T2Space S] + (hbc : ContinuousOn b (sphere (0 : ℂ) 1)) : + IsOpenEmbedding (fun s : ((b '' sphere (0 : ℂ) 1)ᶜ : Set S) => Pasted.ι hb s.1) := by + have := Pasted.t2Space hb hbc + have hCc : IsClosed (b '' sphere (0 : ℂ) 1) := + ((isCompact_sphere _ _).image_of_continuousOn hbc).isClosed + have hemb : IsEmbedding (Pasted.ι hb) := + ((Pasted.continuous_ι hb).isClosedEmbedding + fun _ _ h => (Pasted.ι_eq_ι hb).mp h).isEmbedding + refine ⟨hemb.comp IsEmbedding.subtypeVal, ?_⟩ + have hsub : range (fun s : ((b '' sphere (0 : ℂ) 1)ᶜ : Set S) => Pasted.ι hb s.1) = + Pasted.ι hb '' (b '' sphere (0 : ℂ) 1)ᶜ := by + ext p + constructor + · rintro ⟨s, rfl⟩ + exact ⟨s.1, s.2, rfl⟩ + · rintro ⟨s, hs, rfl⟩ + exact ⟨⟨s, hs⟩, rfl⟩ + rw [hsub, Pasted.isOpen_iff] + constructor + · rw [preimage_image_eq _ fun _ _ h => (Pasted.ι_eq_ι hb).mp h] + exact hCc.isOpen_compl + · convert isOpen_empty + rw [eq_empty_iff_forall_notMem] + rintro z ⟨s, hs, he⟩ + obtain ⟨hz, rfl⟩ := (Pasted.ι_eq_δ hb).mp he + exact hs ⟨z.1, hz, rfl⟩ + +private theorem horizontalScale_injective {ρ : ℝ} (hρ : ρ ≠ 0) : + Function.Injective + (fun z : ℂ => ((ρ * z.re : ℝ) : ℂ) + (z.im : ℂ) * Complex.I) := by + intro z w h + apply Complex.ext + · have hz := congrArg Complex.re h + simp only [Complex.add_re, Complex.ofReal_re, Complex.mul_re, Complex.I_re, + Complex.I_im, Complex.ofReal_im, mul_zero, zero_mul, sub_zero, add_zero] at hz + exact mul_left_cancel₀ hρ hz + · have hz := congrArg Complex.im h + simpa using hz + +private theorem isOpen_pasted_chart_rectangle + (hbc : ContinuousOn b (sphere (0 : ℂ) 1)) {b' : S → ℂ} + (hb'l : LeftInvOn b' b (sphere (0 : ℂ) 1)) + (hCbd : b '' sphere (0 : ℂ) 1 ⊆ bd S) {s : S} + {U : Set S} {O : Set ℂ} {j : S → ℂ} {k : ℂ → S} + (hU : IsOpen U) (hj : ContinuousOn j U) (hm : MapsTo j U (O ∩ halfPlane)) + (hk' : MapsTo k (O ∩ halfPlane) U) (hl : LeftInvOn k j U) + (hr : LeftInvOn j k (O ∩ halfPlane)) + (hre0 : ∀ y ∈ U, y ∈ bd S → (j y).re = 0) {ρ y₀ : ℝ} (hρ : 0 < ρ) : + let I₀ : Set ℝ := Icc (y₀ - ρ) (y₀ + ρ) + let line : ℝ → ℂ := fun y => (y : ℂ) * Complex.I + let u : ℝ → ℂ := fun y => b' (k (line y)) + let Rq : Set ℂ := Icc 0 ρ ×ℂ I₀ + let P : ℂ → ℂ := fun z => ((ρ * z.re : ℝ) : ℂ) + (z.im : ℂ) * Complex.I + let A : ℂ → Pasted hb := fun z => Pasted.ι hb (k (P z)) + let E : ℂ → ℂ := fun z => (((1 + z.re / 2 : ℝ) : ℂ)) * u z.im + let B : ℂ → Pasted hb := fun z => Pasted.δ' hb s (E z) + ∀ Ψ : ℂ → Pasted hb, + let Rp : Set ℂ := Icc 0 1 ×ℂ I₀ + let Rn : Set ℂ := Icc (-1) 0 ×ℂ I₀ + let R : Set ℂ := Icc (-1) 1 ×ℂ I₀ + let V : Set ℂ := Ioo (-1) 1 ×ℂ Ioo (y₀ - ρ) (y₀ + ρ) + Rq ⊆ O ∩ halfPlane → (∀ y ∈ I₀, line y ∈ Rq) → + (∀ y ∈ I₀, u y ∈ sphere (0 : ℂ) 1 ∧ b (u y) = k (line y)) → + (∀ z ∈ Rp, P z ∈ Rq) → + (∀ z, z.im ∈ I₀ → z.re ∈ Icc (-1 : ℝ) 1 → ‖E z‖ = 1 + z.re / 2) → + (∀ z ∈ Rn, E z ∈ closedBall (0 : ℂ) 1) → + EqOn Ψ A Rp → EqOn Ψ B Rn → + (∀ z ∈ R, z.re < 0 → ∀ t, Pasted.ι hb t ≠ B z) → + IsOpen (Ψ '' V) := by + intro I₀ line u Rq P A E B Ψ Rp Rn R V hRq hline hu hPR hEnorm hEball hΨp hΨn hne + have hPre : ∀ z, (P z).re = ρ * z.re := fun z => by simp [P] + have hPim : ∀ z, (P z).im = z.im := fun z => by simp [P] + have hVR : V ⊆ R := fun z hz => ⟨Ioo_subset_Icc_self hz.1, Ioo_subset_Icc_self hz.2⟩ + have hmemR : ∀ z ∈ R, 0 ≤ z.re → z ∈ Rp := fun z hz h => ⟨⟨h, hz.1.2⟩, hz.2⟩ + have hmemR' : ∀ z ∈ R, z.re < 0 → z ∈ Rn := fun z hz h => ⟨⟨hz.1.1, h.le⟩, hz.2⟩ + let T : Set ℂ := Ioo (-ρ) ρ ×ℂ Ioo (y₀ - ρ) (y₀ + ρ) + have hTo : IsOpen T := + (isOpen_Ioo.preimage Complex.continuous_re).inter (isOpen_Ioo.preimage Complex.continuous_im) + let Ω : Set S := U ∩ j ⁻¹' T + have hΩ : IsOpen Ω := hj.isOpen_inter_preimage hU hTo + have hPT : ∀ z ∈ V, 0 ≤ z.re → P z ∈ T := fun z hz h => by + refine Complex.mem_reProdIm.mpr ⟨?_, ?_⟩ + · rw [hPre] + exact ⟨by nlinarith, by nlinarith [hz.1.2]⟩ + · rw [hPim] + exact hz.2 + have hopenι : Pasted.ι hb ⁻¹' (Ψ '' V) = Ω := by + ext t + constructor + · rintro ⟨z, hz, he⟩ + by_cases h : 0 ≤ z.re + · rw [hΨp (hmemR z (hVR hz) h)] at he + have h1 : k (P z) = t := (Pasted.ι_eq_ι hb).mp he + have h2 := hPR z (hmemR z (hVR hz) h) + rw [← h1] + refine ⟨hk' (hRq h2), ?_⟩ + change j (k (P z)) ∈ T + rw [hr (hRq h2)] + exact hPT z hz h + · have h1 := hmemR' z (hVR hz) (not_le.mp h) + rw [hΨn h1] at he + exact absurd he.symm (hne z (hVR hz) (not_le.mp h) _) + · rintro ⟨h1, h2⟩ + have h3 : j t ∈ T := h2 + let z : ℂ := (((j t).re / ρ : ℝ) : ℂ) + ((j t).im : ℂ) * Complex.I + have hzre : z.re = (j t).re / ρ := by simp [z] + have hzim : z.im = (j t).im := by simp [z] + have hre0' : 0 ≤ z.re := by + rw [hzre] + exact div_nonneg (hm h1).2 hρ.le + have hzV : z ∈ V := by + refine Complex.mem_reProdIm.mpr ⟨⟨by linarith, ?_⟩, ?_⟩ + · rw [hzre, div_lt_one hρ] + exact h3.1.2 + · rw [hzim] + exact h3.2 + refine ⟨z, hzV, ?_⟩ + rw [hΨp (hmemR z (hVR hzV) hre0')] + have hPz : P z = j t := by + apply Complex.ext + · rw [hPre, hzre] + field_simp + · rw [hPim, hzim] + change Pasted.ι hb (k (P z)) = _ + rw [hPz, hl h1] + let W₀ : Set ℂ := {w | 1 / 2 < ‖w‖} + have hW₀ : IsOpen W₀ := isOpen_lt continuous_const continuous_norm + let dir : ℂ → ℂ := fun w => ((‖w‖⁻¹ : ℝ) : ℂ) * w + have hdir : ∀ w ∈ W₀, dir w ∈ sphere (0 : ℂ) 1 := fun w hw => by + have h0 : ‖w‖ ≠ 0 := by + have : (1 / 2 : ℝ) < ‖w‖ := hw + linarith + rw [mem_sphere_zero_iff_norm] + simp only [dir, norm_mul, Complex.norm_real, Real.norm_eq_abs, norm_nonneg, abs_of_nonneg, + inv_nonneg] + field_simp + have hdirc : ContinuousOn dir W₀ := by + refine ContinuousOn.mul ?_ continuousOn_id + refine Complex.continuous_ofReal.comp_continuousOn (ContinuousOn.inv₀ (by fun_prop) ?_) + intro w hw + have : (1 / 2 : ℝ) < ‖w‖ := hw + linarith + have hgc : ContinuousOn (b ∘ dir) W₀ := hbc.comp hdirc hdir + have hopenδ : Pasted.δ hb ⁻¹' (Ψ '' V) = Subtype.val ⁻¹' (W₀ ∩ (b ∘ dir) ⁻¹' Ω) := by + ext w + constructor + · rintro ⟨z, hz, he⟩ + by_cases h : 0 ≤ z.re + · rw [hΨp (hmemR z (hVR hz) h)] at he + obtain ⟨hw, hw2⟩ := (Pasted.ι_eq_δ hb).mp he + have hn : ‖w.1‖ = 1 := mem_sphere_zero_iff_norm.mp hw + have hd : dir w.1 = w.1 := by simp [dir, hn] + have hw0 : w.1 ∈ W₀ := by + change (1 / 2 : ℝ) < ‖w.1‖ + rw [hn] + norm_num + refine ⟨hw0, ?_⟩ + change b (dir w.1) ∈ Ω + rw [hd, ← hw2] + have h2 := hPR z (hmemR z (hVR hz) h) + refine ⟨hk' (hRq h2), ?_⟩ + change j (k (P z)) ∈ T + rw [hr (hRq h2)] + exact hPT z hz h + · have h1 := hmemR' z (hVR hz) (not_le.mp h) + rw [hΨn h1] at he + have he' : Pasted.δ' hb s (E z) = Pasted.δ hb w := he + rw [Pasted.δ'_of_mem hb s (hEball z h1), Pasted.δ_eq_δ] at he' + have hEw : E z = w.1 := congrArg Subtype.val he' + have hn : ‖w.1‖ = 1 + z.re / 2 := by + rw [← hEw] + exact hEnorm z h1.2 (hVR hz).1 + have hd : dir w.1 = u z.im := by + have h3 : (1 + z.re / 2 : ℝ) ≠ 0 := by linarith [(hVR hz).1.1] + change ((‖w.1‖⁻¹ : ℝ) : ℂ) * w.1 = u z.im + rw [hn, ← hEw] + simp only [E] + rw [← mul_assoc, ← Complex.ofReal_mul, inv_mul_cancel₀ h3] + simp + have hw0 : w.1 ∈ W₀ := by + change (1 / 2 : ℝ) < ‖w.1‖ + rw [hn] + linarith [hz.1.1] + refine ⟨hw0, ?_⟩ + change b (dir w.1) ∈ Ω + rw [hd, (hu _ h1.2).2] + refine ⟨hk' (hRq (hline _ h1.2)), ?_⟩ + change j (k (line z.im)) ∈ T + rw [hr (hRq (hline _ h1.2))] + refine Complex.mem_reProdIm.mpr ⟨?_, ?_⟩ + · simp [line, hρ] + · simpa [line] using hz.2 + · rintro ⟨hw0, hw1, hw2⟩ + have hw0' : (1 / 2 : ℝ) < ‖w.1‖ := hw0 + have hw1' : b (dir w.1) ∈ U := hw1 + have hbd : b (dir w.1) ∈ bd S := hCbd ⟨_, hdir _ hw0, rfl⟩ + have hre := hre0 _ hw1' hbd + have hT' : j (b (dir w.1)) ∈ T := hw2 + set y := (j (b (dir w.1))).im with hy + have hyI : y ∈ Ioo (y₀ - ρ) (y₀ + ρ) := hT'.2 + have hyI' : y ∈ I₀ := Ioo_subset_Icc_self hyI + have hline' : line y = j (b (dir w.1)) := by + apply Complex.ext <;> simp [line, hre, hy] + have hkb : k (line y) = b (dir w.1) := by + rw [hline', hl hw1'] + have huy : u y = dir w.1 := by + change b' (k (line y)) = _ + rw [hkb, hb'l (hdir _ hw0)] + have hnle : ‖w.1‖ ≤ 1 := mem_closedBall_zero_iff.mp w.2 + let z : ℂ := ((2 * (‖w.1‖ - 1) : ℝ) : ℂ) + (y : ℂ) * Complex.I + have hzre : z.re = 2 * (‖w.1‖ - 1) := by simp [z] + have hzim : z.im = y := by simp [z] + have hzV : z ∈ V := by + refine Complex.mem_reProdIm.mpr ⟨?_, ?_⟩ + · rw [hzre] + exact ⟨by linarith, by linarith⟩ + · rw [hzim] + exact hyI + refine ⟨z, hzV, ?_⟩ + have hEz : E z = w.1 := by + have h6 : (1 + z.re / 2 : ℝ) = ‖w.1‖ := by + rw [hzre] + ring + have h7 : (‖w.1‖ : ℝ) ≠ 0 := by linarith + simp only [E, h6, hzim, huy, dir] + rw [← mul_assoc, ← Complex.ofReal_mul, mul_inv_cancel₀ h7] + simp + have h8 : z ∈ Rn := ⟨⟨(hVR hzV).1.1, by rw [hzre]; linarith⟩, (hVR hzV).2⟩ + rw [hΨn h8] + change Pasted.δ' hb s (E z) = _ + rw [Pasted.δ'_of_mem hb s (hEball z h8)] + congr 1 + exact Subtype.ext hEz + have hopen : IsOpen (Ψ '' V) := by + rw [Pasted.isOpen_iff, hopenι, hopenδ] + refine ⟨hΩ, IsOpen.preimage continuous_subtype_val ?_⟩ + exact hgc.isOpen_inter_preimage hW₀ hΩ + exact hopen + +/-- A point of the cuff is an interior point of the pasted space: the half rectangle of a half plane +chart pastes to a half rectangle of the disc in polar coordinates. -/ +theorem Pasted.isInteriorPoint_ι [CompactSpace S] [T2Space S] + (hbc : ContinuousOn b (sphere (0 : ℂ) 1)) {b' : S → ℂ} + (hb'c : ContinuousOn b' (b '' sphere (0 : ℂ) 1)) + (hb'l : LeftInvOn b' b (sphere (0 : ℂ) 1)) + (hC : b '' sphere (0 : ℂ) 1 ∈ componentsIn (bd S)) (hman : ∀ x : S, IsManifoldPoint x) + {s : S} (hs : s ∈ b '' sphere (0 : ℂ) 1) : IsInteriorPoint (Pasted.ι hb s) := by + have := Pasted.t2Space hb hbc + set C := b '' sphere (0 : ℂ) 1 with hCdef + have hCbd : C ⊆ bd S := by + obtain ⟨c, hc, hce⟩ := hC + rw [← hce] + exact connectedComponentIn_subset _ _ + have hCcomp : C = connectedComponentIn (bd S) s := by + obtain ⟨c, hc, hce⟩ := hC + rw [← hce] at hs ⊢ + exact connectedComponentIn_eq hs + obtain ⟨U, O, j, k, hU, hO, hsU, hj, hk, hm, hk', hl, hr⟩ := (hman s).exists_chart + have hre0 : ∀ y ∈ U, y ∈ bd S → (j y).re = 0 := fun y hy hyb => + le_antisymm (not_lt.mp fun h => hyb (isInteriorPoint_of_chart hU hO hj hk hm hk' hl hr hy h)) + (hm hy).2 + have hjs : j s = ((j s).im : ℂ) * Complex.I := by + apply Complex.ext <;> simp [hre0 s hsU (hCbd hs)] + set y₀ := (j s).im with hy₀ + obtain ⟨ρ', hρ', hball⟩ := Metric.isOpen_iff.mp hO _ (hm hsU).1 + obtain ⟨ρ, hρ, hρρ⟩ : ∃ ρ : ℝ, 0 < ρ ∧ 2 * ρ < ρ' := ⟨ρ' / 3, by positivity, by linarith⟩ + -- the half rectangle in the chart + let Rq : Set ℂ := Icc 0 ρ ×ℂ Icc (y₀ - ρ) (y₀ + ρ) + have hRq : Rq ⊆ O ∩ halfPlane := by + rintro z ⟨h1, h2⟩ + refine ⟨hball ?_, h1.1⟩ + rw [mem_ball, dist_eq_norm] + have h3 : (z - j s).re = z.re := by simp [hre0 s hsU (hCbd hs)] + have h4 : (z - j s).im = z.im - y₀ := by simp [hy₀] + calc ‖z - j s‖ ≤ |(z - j s).re| + |(z - j s).im| := Complex.norm_le_abs_re_add_abs_im _ + _ ≤ ρ + ρ := by + rw [h3, h4, abs_of_nonneg h1.1] + exact add_le_add h1.2 (abs_le.mpr ⟨by linarith [h2.1], by linarith [h2.2]⟩) + _ < ρ' := by linarith + let line : ℝ → ℂ := fun y => (y : ℂ) * Complex.I + have hline : ∀ y ∈ Icc (y₀ - ρ) (y₀ + ρ), line y ∈ Rq := fun y hy => by + refine ⟨?_, ?_⟩ <;> simp [line, hρ.le, hy.1, hy.2] + -- the side of the rectangle lies in the cuff + have hside : k '' (line '' Icc (y₀ - ρ) (y₀ + ρ)) ⊆ C := by + rw [hCcomp] + have hpre : IsPreconnected (k '' (line '' Icc (y₀ - ρ) (y₀ + ρ))) := by + refine (isPreconnected_Icc.image line (by fun_prop)).image k ?_ + refine hk.mono ?_ + rintro _ ⟨y, hy, rfl⟩ + exact hRq (hline y hy) + refine hpre.subset_connectedComponentIn ⟨line y₀, ⟨y₀, ⟨by linarith, by linarith⟩, rfl⟩, ?_⟩ ?_ + · have : line y₀ = j s := hjs.symm + rw [this, hl hsU] + · rintro _ ⟨_, ⟨y, hy, rfl⟩, rfl⟩ hint + refine not_isInteriorPoint_of_chart (O := O) hU hj hm hl.injOn (hk' (hRq + (hline y hy))) ?_ hint + rw [hr (hRq (hline y hy))] + simp [line] + let I₀ : Set ℝ := Icc (y₀ - ρ) (y₀ + ρ) + let u : ℝ → ℂ := fun y => b' (k (line y)) + have hkC : ∀ y ∈ I₀, k (line y) ∈ C := fun y hy => hside ⟨_, ⟨y, hy, rfl⟩, rfl⟩ + have hu : ∀ y ∈ I₀, u y ∈ sphere (0 : ℂ) 1 ∧ b (u y) = k (line y) := fun y hy => by + obtain ⟨z, hz, he⟩ := hkC y hy + have : u y = z := by + change b' (k (line y)) = z + rw [← he, hb'l hz] + rw [this] + exact ⟨hz, he⟩ + have hkl : ContinuousOn (fun y => k (line y)) I₀ := + hk.comp (by fun_prop) fun y hy => hRq (hline y hy) + have huc : ContinuousOn u I₀ := hb'c.comp hkl hkC + have hunorm : ∀ y ∈ I₀, ‖u y‖ = 1 := fun y hy => mem_sphere_zero_iff_norm.mp (hu y hy).1 + let P : ℂ → ℂ := fun z => ((ρ * z.re : ℝ) : ℂ) + (z.im : ℂ) * Complex.I + have hPre : ∀ z, (P z).re = ρ * z.re := fun z => by simp [P] + have hPim : ∀ z, (P z).im = z.im := fun z => by simp [P] + have hPc : Continuous P := by fun_prop + let A : ℂ → Pasted hb := fun z => Pasted.ι hb (k (P z)) + let E : ℂ → ℂ := fun z => (((1 + z.re / 2 : ℝ) : ℂ)) * u z.im + let B : ℂ → Pasted hb := fun z => Pasted.δ' hb s (E z) + let Ψ : ℂ → Pasted hb := fun z => if 0 ≤ z.re then A z else B z + let Rp : Set ℂ := Icc 0 1 ×ℂ I₀ + let Rn : Set ℂ := Icc (-1) 0 ×ℂ I₀ + let R : Set ℂ := Icc (-1) 1 ×ℂ I₀ + have hRcover : R = Rp ∪ Rn := by + ext z + simp only [R, Rp, Rn, mem_union, Complex.mem_reProdIm, mem_Icc] + constructor + · rintro ⟨⟨h1, h2⟩, h3⟩ + rcases le_total 0 z.re with h | h + · exact .inl ⟨⟨h, h2⟩, h3⟩ + · exact .inr ⟨⟨h1, h⟩, h3⟩ + · rintro (⟨⟨h1, h2⟩, h3⟩ | ⟨⟨h1, h2⟩, h3⟩) + · exact ⟨⟨by linarith, h2⟩, h3⟩ + · exact ⟨⟨h1, by linarith⟩, h3⟩ + have hPR : ∀ z ∈ Rp, P z ∈ Rq := fun z hz => by + obtain ⟨h1, h2⟩ := hz + refine Complex.mem_reProdIm.mpr ⟨?_, ?_⟩ + · rw [hPre] + exact ⟨mul_nonneg hρ.le h1.1, by nlinarith [h1.2]⟩ + · rw [hPim] + exact h2 + have hEnorm : ∀ z, z.im ∈ I₀ → z.re ∈ Icc (-1 : ℝ) 1 → ‖E z‖ = 1 + z.re / 2 := fun z h1 h2 => by + simp only [E, norm_mul, Complex.norm_real, hunorm _ h1, mul_one, Real.norm_eq_abs] + exact abs_of_nonneg (by linarith [h2.1]) + have hEball : ∀ z ∈ Rn, E z ∈ closedBall (0 : ℂ) 1 := fun z hz => by + obtain ⟨h1, h2⟩ := hz + rw [mem_closedBall_zero_iff, hEnorm z h2 ⟨h1.1, by linarith [h1.2]⟩] + linarith [h1.2] + have hAB : ∀ z ∈ Rn, z.re = 0 → A z = B z := fun z hz h0 => by + have hP : P z = line z.im := by simp [P, h0, line] + have hE : E z = u z.im := by simp [E, h0] + change Pasted.ι hb (k (P z)) = Pasted.δ' hb s (E z) + rw [Pasted.δ'_of_mem hb s (hEball z hz), Pasted.ι_eq_δ, hP] + have h2 := hu z.im hz.2 + refine ⟨?_, ?_⟩ + · change E z ∈ _ + rw [hE] + exact h2.1 + · change k (line z.im) = b (E z) + rw [hE, h2.2] + have hΨp : EqOn Ψ A Rp := fun z hz => ite_eq_left hz.1.1 + have hΨn : EqOn Ψ B Rn := fun z hz => by + change (if 0 ≤ z.re then A z else B z) = B z + split_ifs with h + · exact hAB z hz (le_antisymm hz.1.2 h) + · rfl + have hAc : ContinuousOn A Rp := + (Pasted.continuous_ι hb).comp_continuousOn + (hk.comp hPc.continuousOn fun z hz => hRq (hPR z hz)) + have hEc : ContinuousOn E Rn := by + refine ContinuousOn.mul (by fun_prop) ?_ + exact huc.comp (by fun_prop) fun z hz => hz.2 + have hBc : ContinuousOn B Rn := (Pasted.continuousOn_δ' hb s).comp hEc hEball + have hclosedp : IsClosed Rp := + (isClosed_Icc.preimage Complex.continuous_re).inter (isClosed_Icc.preimage + Complex.continuous_im) + have hclosedn : IsClosed Rn := + (isClosed_Icc.preimage Complex.continuous_re).inter (isClosed_Icc.preimage + Complex.continuous_im) + have hΨc : ContinuousOn Ψ R := by + rw [hRcover] + exact (hAc.congr hΨp).union_of_isClosed (hBc.congr hΨn) hclosedp hclosedn + have hRcomp : IsCompact R := isCompact_Icc.reProdIm isCompact_Icc + have hmemR : ∀ z ∈ R, 0 ≤ z.re → z ∈ Rp := fun z hz h => ⟨⟨h, hz.1.2⟩, hz.2⟩ + have hmemR' : ∀ z ∈ R, z.re < 0 → z ∈ Rn := fun z hz h => ⟨⟨hz.1.1, h.le⟩, hz.2⟩ + have hPeq : Function.Injective P := horizontalScale_injective hρ.ne' + have hk_inj : ∀ z ∈ Rq, ∀ w ∈ Rq, k z = k w → z = w := fun z hz w hw h => by + rw [← hr (hRq hz), h, hr (hRq hw)] + -- a point of the disc side with `re < 0` is not in `S` + have hne : ∀ z ∈ R, z.re < 0 → ∀ t, Pasted.ι hb t ≠ B z := fun z hz h t he => by + show False + have hm := hEball z (hmemR' z hz h) + have he' : Pasted.ι hb t = Pasted.δ' hb s (E z) := he + rw [Pasted.δ'_of_mem hb s hm, Pasted.ι_eq_δ] at he' + have h1 : ‖E z‖ = 1 := mem_sphere_zero_iff_norm.mp he'.1 + rw [hEnorm z hz.2 ⟨hz.1.1, hz.1.2⟩] at h1 + linarith + have hinj : InjOn Ψ R := by + intro z hz w hw he + by_cases h1 : 0 ≤ z.re <;> by_cases h2 : 0 ≤ w.re + · rw [hΨp (hmemR z hz h1), hΨp (hmemR w hw h2)] at he + exact hPeq (hk_inj _ (hPR _ (hmemR z hz h1)) _ (hPR _ (hmemR w hw h2)) + ((Pasted.ι_eq_ι hb).mp he)) + · rw [hΨp (hmemR z hz h1), hΨn (hmemR' w hw (not_le.mp h2))] at he + exact absurd he (hne w hw (not_le.mp h2) _) + · rw [hΨn (hmemR' z hz (not_le.mp h1)), hΨp (hmemR w hw h2)] at he + exact absurd he.symm (hne z hz (not_le.mp h1) _) + · have hz' := hmemR' z hz (not_le.mp h1) + have hw' := hmemR' w hw (not_le.mp h2) + rw [hΨn hz', hΨn hw'] at he + have hEE : E z = E w := Pasted.injOn_δ' hb s (hEball z hz') (hEball w hw') he + have hn := congrArg norm hEE + rw [hEnorm z hz.2 hz.1, hEnorm w hw.2 hw.1] at hn + have hre : z.re = w.re := by linarith + have huu : u z.im = u w.im := by + have h3 : ((1 + z.re / 2 : ℝ) : ℂ) ≠ 0 := by + have : (1 + z.re / 2 : ℝ) ≠ 0 := by linarith [hz.1.1] + exact_mod_cast this + have h4 : ((1 + z.re / 2 : ℝ) : ℂ) * u z.im = ((1 + z.re / 2 : ℝ) : ℂ) * u w.im := by + have : E w = ((1 + z.re / 2 : ℝ) : ℂ) * u w.im := by simp only [E, hre] + rw [← this] + exact hEE + exact mul_left_cancel₀ h3 h4 + have hk2 : k (line z.im) = k (line w.im) := by + rw [← (hu _ hz.2).2, ← (hu _ hw.2).2, huu] + have := hk_inj _ (hline _ hz.2) _ (hline _ hw.2) hk2 + have him : z.im = w.im := by + have h5 := congrArg Complex.im this + simpa [line] using h5 + exact Complex.ext hre him + -- the open rectangle and its image + let V : Set ℂ := Ioo (-1) 1 ×ℂ Ioo (y₀ - ρ) (y₀ + ρ) + have hVo : IsOpen V := + (isOpen_Ioo.preimage Complex.continuous_re).inter (isOpen_Ioo.preimage Complex.continuous_im) + have hVR : V ⊆ R := fun z hz => ⟨Ioo_subset_Icc_self hz.1, Ioo_subset_Icc_self hz.2⟩ + have hopen : IsOpen (Ψ '' V) := + isOpen_pasted_chart_rectangle hb hbc hb'l hCbd hU hj hm hk' hl hr hre0 hρ + Ψ hRq hline hu hPR hEnorm hEball hΨp hΨn hne + have hcV : line y₀ ∈ V := by + refine Complex.mem_reProdIm.mpr ⟨?_, ?_⟩ <;> simp [line, hρ] + have hval : Ψ (line y₀) = Pasted.ι hb s := by + have h0 : ∀ z : ℂ, z = line y₀ → 0 ≤ z.re := fun z hz => by simp [hz, line] + rw [hΨp (hmemR _ (hVR hcV) (h0 _ rfl))] + change Pasted.ι hb (k (P (line y₀))) = _ + have : P (line y₀) = j s := by + rw [hjs] + simp [P, line] + rw [this, hl hsU] + rw [← hval] + exact isInteriorPoint_of_injOn hRcomp hΨc hinj hVR hVo hopen hcV + +/-- **Pasting a disc onto a cuff.** The route is that of the module docstring. -/ +theorem paste_disc : PasteDiscStatement.{u} := by + intro S _ C hS hC + obtain ⟨hcomp, ht2, hman⟩ := hS + obtain ⟨-, -, hOarc⟩ := cuff_statement.{u} S ⟨hcomp, ht2, hman⟩ + obtain ⟨φ⟩ := hOarc C hC + obtain ⟨o⟩ := oArc_sphere + have : Nonempty S := by + obtain ⟨c, hc, -⟩ := hC + exact ⟨c⟩ + obtain ⟨b, b', hbc, hb'c, hbm, hb'm, hbl, hbr⟩ := exists_functions_of_homeomorph (o.symm.trans φ) + have hbi : InjOn b (sphere (0 : ℂ) 1) := hbl.injOn + have hCeq : b '' sphere (0 : ℂ) 1 = C := by + refine subset_antisymm (image_subset_iff.mpr hbm) fun c hc => ⟨b' c, hb'm hc, hbr hc⟩ + subst hCeq + have ht2' := Pasted.t2Space hbi hbc + obtain ⟨s₀⟩ := ‹Nonempty S› + have hemb : IsClosedEmbedding (Pasted.ι hbi) := + (Pasted.continuous_ι hbi).isClosedEmbedding fun _ _ h => (Pasted.ι_eq_ι hbi).mp h + obtain ⟨d', hd'c, hd'l⟩ := exists_inv_of_compactOn (isCompact_closedBall (0 : ℂ) 1) + (Pasted.continuousOn_δ' hbi s₀) (Pasted.injOn_δ' hbi s₀) + obtain ⟨hdisc, hbdΔ⟩ := isClosedDisc_closedBall.1.image (Pasted.continuousOn_δ' hbi s₀) hd'c hd'l + have hsph : Pasted.δ' hbi s₀ '' sphere (0 : ℂ) 1 = Pasted.ι hbi '' (b '' sphere (0 : ℂ) 1) := by + ext p + constructor + · rintro ⟨z, hz, rfl⟩ + refine ⟨b z, ⟨z, hz, rfl⟩, ?_⟩ + rw [Pasted.δ'_of_mem hbi s₀ (sphere_subset_closedBall hz)] + exact (Pasted.ι_eq_δ hbi).mpr ⟨hz, rfl⟩ + · rintro ⟨_, ⟨z, hz, rfl⟩, rfl⟩ + refine ⟨z, hz, ?_⟩ + rw [Pasted.δ'_of_mem hbi s₀ (sphere_subset_closedBall hz)] + exact ((Pasted.ι_eq_δ hbi).mpr ⟨hz, rfl⟩).symm + rw [isClosedDisc_closedBall.2, hsph] at hbdΔ + have hint : ∀ s ∈ b '' sphere (0 : ℂ) 1, IsInteriorPoint (Pasted.ι hbi s) := fun s hs => + Pasted.isInteriorPoint_ι hbi hbc hb'c hbl hC hman hs + have hopen := Pasted.isOpenEmbedding_compl hbi hbc + have hCo : IsOpen (b '' sphere (0 : ℂ) 1)ᶜ := + ((isCompact_sphere _ _).image_of_continuousOn hbc).isClosed.isOpen_compl + have hcover : ∀ p : Pasted hbi, (∃ s, p = Pasted.ι hbi s) ∨ ∃ z ∈ ball (0 : ℂ) 1, + p = Pasted.δ' hbi s₀ z := fun p => by + obtain ⟨s, rfl⟩ | ⟨z, rfl⟩ := Pasted.surj hbi p + · exact .inl ⟨s, rfl⟩ + · by_cases hz : z.1 ∈ sphere (0 : ℂ) 1 + · exact .inl ⟨b z, (Pasted.ι_eq_δ hbi).mpr ⟨hz, rfl⟩ |>.symm⟩ + · refine .inr ⟨z.1, ?_, (Pasted.δ'_of_mem hbi s₀ z.2).symm⟩ + have h1 : ‖z.1‖ ≤ 1 := mem_closedBall_zero_iff.mp z.2 + have h2 : ‖z.1‖ ≠ 1 := fun h => hz (mem_sphere_zero_iff_norm.mpr h) + exact mem_ball_zero_iff.mpr (lt_of_le_of_ne h1 h2) + refine ⟨Pasted hbi, inferInstance, Pasted.ι hbi, Pasted.δ' hbi s₀ '' closedBall 0 1, ?_, hemb, + hdisc, ?_, ?_, hbdΔ, ?_⟩ + · refine ⟨inferInstance, ht2', fun p => ?_⟩ + obtain ⟨s, rfl⟩ | ⟨z, hz, rfl⟩ := hcover p + · by_cases hs : s ∈ b '' sphere (0 : ℂ) 1 + · exact (hint s hs).isManifoldPoint + · exact (isManifoldPoint_of_isOpenEmbedding hopen (x := ⟨s, hs⟩) + ((isManifoldPoint_iff_of_isOpenEmbedding hCo.isOpenEmbedding_subtypeVal).mp (hman s))) + · exact (Pasted.isInteriorPoint_δ hbi hbc s₀ hz).isManifoldPoint + · rw [eq_univ_iff_forall] + intro p + obtain ⟨s, rfl⟩ | ⟨z, hz, rfl⟩ := hcover p + · exact .inl ⟨s, rfl⟩ + · exact .inr ⟨z, ball_subset_closedBall hz, rfl⟩ + · ext p + constructor + · rintro ⟨⟨s, rfl⟩, z, hz, he⟩ + rw [Pasted.δ'_of_mem hbi s₀ hz, eq_comm, Pasted.ι_eq_δ] at he + exact ⟨s, ⟨z, he.1, he.2.symm⟩, rfl⟩ + · rintro ⟨s, hs, rfl⟩ + refine ⟨⟨s, rfl⟩, ?_⟩ + have hm : Pasted.ι hbi s ∈ Pasted.δ' hbi s₀ '' sphere (0 : ℂ) 1 := by + rw [hsph] + exact mem_image_of_mem _ hs + obtain ⟨z, hz, he⟩ := hm + exact ⟨z, sphere_subset_closedBall hz, he⟩ + · ext p + constructor + · intro hp + obtain ⟨s, rfl⟩ | ⟨z, hz, rfl⟩ := hcover p + · refine ⟨s, ⟨fun hs => ?_, fun hs => hp (hint s hs)⟩, rfl⟩ + have hsC : s ∉ b '' sphere (0 : ℂ) 1 := fun h => hp (hint s h) + exact hp (isInteriorPoint_of_isOpenEmbedding hopen (x := ⟨s, hsC⟩) + ((isInteriorPoint_iff_of_isOpenEmbedding hCo.isOpenEmbedding_subtypeVal).mp + hs)) + · exact absurd (Pasted.isInteriorPoint_δ hbi hbc s₀ hz) hp + · rintro ⟨s, ⟨hs, hsC⟩, rfl⟩ hint' + refine hs ?_ + have h1 := (isInteriorPoint_iff_of_isOpenEmbedding hopen (x := ⟨s, hsC⟩)).mp hint' + exact isInteriorPoint_of_isOpenEmbedding hCo.isOpenEmbedding_subtypeVal h1 + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/PasteModel.lean b/LeanPool/GraphMinor/Surface/PasteModel.lean new file mode 100644 index 0000000000..c3fde93a5d --- /dev/null +++ b/LeanPool/GraphMinor/Surface/PasteModel.lean @@ -0,0 +1,193 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutOArc + +/-! +# Pasting a disc on a cuff removes one cuff + +We show that pasting a disc on a cuff of `Σ(a, b, c)` gives `Σ(a, b, c - 1)` (`paste_model`). The +surface and the disc side by side are +the result of cutting the new surface along the old cuff, so the words of cut surfaces apply. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +universe u v + +/-- A boundary point stays a boundary point under an open embedding. -/ +theorem bd_of_isOpenEmbedding {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] + {e : X → Y} (he : IsOpenEmbedding e) {x : X} + (hx : x ∈ bd X) : e x ∈ bd Y := by + intro hint + obtain ⟨U, hU, hxU, hsub, ⟨f⟩⟩ := hint.exists_subset he.isOpen_range (mem_range_self x) + have h1 : e '' (e ⁻¹' U) = U := image_preimage_eq_of_subset hsub + exact hx ⟨e ⁻¹' U, hU.preimage he.continuous, hxU, ⟨(he.isEmbedding.homeomorphImage _).trans + ((Homeomorph.setCongr h1).trans f)⟩⟩ + +/-- Two surfaces pasted along one cuff of each: the models add up, and both cuffs are gone. -/ +theorem glue_model {S S' : Type u} [TopologicalSpace S] [TopologicalSpace S'] + (hS : IsSurface S) {C : Set S} (hC : IsCuff C) {ι : S → S'} {Δ : Set S'} + (hΔS : IsSurface Δ) (hS' : T2Space S') (hι : IsClosedEmbedding ι) (hu : range ι ∪ Δ = univ) + (hm : range ι ∩ Δ = ι '' C) (hOF : IsOArc (ι '' C)) + (hBb : Subtype.val ⁻¹' (ι '' C) ⊆ bd Δ) {a b c a₂ b₂ c₂ : ℕ} (e : S ≃ₜ SurfaceModel a b c) + (d' : Δ ≃ₜ SurfaceModel a₂ b₂ c₂) : + 0 < c ∧ 0 < c₂ ∧ Nonempty (S' ≃ₜ SurfaceModel (a₂ + a) (b₂ + b) (c₂ - 1 + (c - 1))) := by + classical + have hcS : CompactSpace S := hS.1 + have ht2 : T2Space S := hS.2.1 + have hΔc : CompactSpace Δ := hΔS.1 + have hCb : C ⊆ bd S := by + obtain ⟨x, -, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + let ψ : S ⊕ Δ → S' := Sum.elim ι Subtype.val + have hψc : Continuous ψ := hι.continuous.sumElim continuous_subtype_val + have hF : ∀ x ∈ ι '' C, x ∈ Δ := fun x hx => (hm ▸ hx : x ∈ range ι ∩ Δ).2 + let B : Set Δ := Subtype.val ⁻¹' (ι '' C) + have hY : IsSurface (S ⊕ Δ) := ⟨inferInstance, inferInstance, fun x => by + rcases x with x | x + · exact isManifoldPoint_of_isOpenEmbedding IsOpenEmbedding.inl (hS.2.2 x) + · exact isManifoldPoint_of_isOpenEmbedding IsOpenEmbedding.inr (hΔS.2.2 x)⟩ + have hpre : ψ ⁻¹' (ι '' C) = Sum.inl '' C ∪ Sum.inr '' B := by + ext x + rcases x with x | x + · constructor + · rintro ⟨y, hy, he⟩ + exact .inl ⟨y, hy, by rw [hι.injective he]⟩ + · rintro (⟨y, hy, he⟩ | ⟨y, -, he⟩) + · rw [← Sum.inl.inj he] + exact ⟨y, hy, rfl⟩ + · simp at he + · constructor + · intro h + exact .inr ⟨x, h, rfl⟩ + · rintro (⟨y, -, he⟩ | ⟨y, hy, he⟩) + · simp at he + · rw [← Sum.inr.inj he] + exact hy + have hcut : IsCutting ψ (ι '' C) := by + refine ⟨hψc, ?_, ?_, ?_, ?_⟩ + · intro x + have h1 : x ∈ range ι ∪ Δ := hu ▸ mem_univ x + rcases h1 with ⟨y, rfl⟩ | h1 + · exact ⟨.inl y, rfl⟩ + · exact ⟨.inr ⟨x, h1⟩, rfl⟩ + · rintro (x | x) hx (y | y) hy he + · rw [hι.injective he] + · exact absurd (hm ▸ (⟨⟨x, rfl⟩, he ▸ y.2⟩ : ψ (.inl x) ∈ range ι ∩ Δ)) hx + · have h2 : ι y ∈ Δ := by + have h3 : ψ (.inr x) = x.1 := rfl + have h4 : ψ (.inl y) = ι y := rfl + rw [← h4, ← he, h3] + exact x.2 + exact absurd (show ι y ∈ ι '' C from hm ▸ ⟨⟨y, rfl⟩, h2⟩) hy + · rw [Subtype.ext he] + · rintro _ ⟨x, hx, rfl⟩ + have h1 : ψ ⁻¹' {ι x} = {.inl x, .inr ⟨ι x, hF _ ⟨x, hx, rfl⟩⟩} := by + ext z + rcases z with z | z + · simp only [mem_preimage, mem_singleton_iff, mem_insert_iff, Sum.inl.injEq, + reduceCtorEq, or_false] + exact ⟨fun h => hι.injective h, fun h => by rw [h]; rfl⟩ + · simp only [mem_preimage, mem_singleton_iff, mem_insert_iff, Sum.inr.injEq, + reduceCtorEq, false_or] + exact ⟨fun h => Subtype.ext h, fun h => by rw [h]; rfl⟩ + rw [h1, ncard_pair (by simp)] + · rw [hpre] + rintro _ (⟨x, hx, rfl⟩ | ⟨x, hx, rfl⟩) + · exact bd_of_isOpenEmbedding IsOpenEmbedding.inl (hCb hx) + · exact bd_of_isOpenEmbedding IsOpenEmbedding.inr (hBb hx) + obtain ⟨φC⟩ := (cuff_statement.{u} S hS).2.2 C hC + have hOX : IsOArc (Sum.inl '' C : Set (S ⊕ Δ)) := ⟨φC.trans (IsEmbedding.inl.homeomorphImage C)⟩ + have hOX' : IsOArc (Sum.inr '' B : Set (S ⊕ Δ)) := by + obtain ⟨φF⟩ := hOF + obtain ⟨e'⟩ := exists_homeo_sub (ι '' C) hF + exact ⟨φF.trans (e'.symm.trans (IsEmbedding.inr.homeomorphImage B))⟩ + have b1 : BijOn ψ (Sum.inl '' C) (ι '' C) := by + refine ⟨?_, ?_, ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + exact ⟨x, hx, rfl⟩ + · rintro _ ⟨x, -, rfl⟩ _ ⟨y, -, rfl⟩ he + rw [hι.injective he] + · rintro _ ⟨x, hx, rfl⟩ + exact ⟨.inl x, ⟨x, hx, rfl⟩, rfl⟩ + have b2 : BijOn ψ (Sum.inr '' B) (ι '' C) := by + refine ⟨?_, ?_, ?_⟩ + · rintro _ ⟨x, hx, rfl⟩ + exact hx + · rintro _ ⟨x, -, rfl⟩ _ ⟨y, -, rfl⟩ he + rw [Subtype.ext he] + · intro x hx + exact ⟨.inr ⟨x, hF x hx⟩, ⟨_, hx, rfl⟩, rfl⟩ + have hW₁ : IsClopen (range (Sum.inl : S → S ⊕ Δ)) := isClopen_range_inl + have hW₂ : IsClopen (range (Sum.inr : Δ → S ⊕ Δ)) := isClopen_range_inr + have hd : Disjoint (range (Sum.inl : S → S ⊕ Δ)) (range (Sum.inr : Δ → S ⊕ Δ)) := by + rw [disjoint_left] + rintro _ ⟨x, rfl⟩ ⟨y, he⟩ + simp at he + have hU : range (Sum.inl : S → S ⊕ Δ) ∪ range (Sum.inr : Δ → S ⊕ Δ) = univ := by + ext x + rcases x with x | x <;> simp + have e₁ := IsEmbedding.inl.toHomeomorph (f := (Sum.inl : S → S ⊕ Δ)) |>.symm.trans e + have e₂ := IsEmbedding.inr.toHomeomorph (f := (Sum.inr : Δ → S ⊕ Δ)) |>.symm.trans d' + obtain ⟨i, j, σ, f, -, -, hi, hj, hf, -⟩ := loop_comps_aux hY hcut hpre.symm b1 b2 hOX hOX' hW₁ + hW₂ hd hU e₁ e₂ (image_subset_range _ _) + (image_subset_range _ _) (fun x hx => hcut.2.2.2.2 (hpre ▸ .inl hx)) (fun x hx => hcut.2.2.2.2 + (hpre ▸ .inr hx)) + have hne : Nonempty S' := by + obtain ⟨φ'⟩ := hOF + exact ⟨(φ' 1).1⟩ + obtain ⟨hN₁, hL₁⟩ := erase_facts c i + obtain ⟨hN₂, hL₂⟩ := erase_facts c₂ j + obtain ⟨e'⟩ := homeo_of_two_loop hi hj hN₁ hN₂ hL₁ hL₂ hf + rw [length_erase_range hi, length_erase_range hj] at e' + exact ⟨by omega, by omega, ⟨e'⟩⟩ + +/-- Pasting a closed disc on one cuff of a surface takes one hole away from its model. -/ +theorem paste_model {S S' : Type u} [TopologicalSpace S] [TopologicalSpace S'] + (hS : IsSurface S) {C : Set S} (hC : IsCuff C) {ι : S → S'} {Δ : Set S'} + (hS' : IsSurface S') (hι : IsClosedEmbedding ι) (hΔ : IsClosedDisc Δ) (hu : range ι ∪ Δ = univ) + (hm : range ι ∩ Δ = ι '' C) (hb : discBd Δ = ι '' C) + {a b c : ℕ} (e : S ≃ₜ SurfaceModel a b c) : 0 < c ∧ Nonempty (S' ≃ₜ SurfaceModel a b (c - 1)) + := by + classical + have hcS : CompactSpace S := hS.1 + have ht2 : T2Space S := hS.2.1 + have hcS' : CompactSpace S' := hS'.1 + have ht2' : T2Space S' := hS'.2.1 + have hCb : C ⊆ bd S := by + obtain ⟨x, -, rfl⟩ := hC + exact connectedComponentIn_subset _ _ + have hΔc : CompactSpace Δ := by + obtain ⟨φ⟩ := hΔ + have : CompactSpace ClosedUnitDisc := isCompact_iff_compactSpace.mp (isCompact_closedBall _ _) + exact φ.surjective.compactSpace φ.continuous + obtain ⟨φ⟩ := id hΔ + obtain ⟨d⟩ := nonempty_disc_homeo + let d' : Δ ≃ₜ SurfaceModel 0 0 1 := φ.symm.trans d.symm + have hΔS : IsSurface Δ := ⟨hΔc, inferInstance, fun x => by + have h1 := (isSurface_model 0 0 1).1.2.2 (d' x) + have h2 := isManifoldPoint_of_isOpenEmbedding d'.symm.isOpenEmbedding h1 + simpa using h2⟩ + have hcS' : T2Space S' := hS'.2.1 + have hBb : Subtype.val ⁻¹' (ι '' C) ⊆ bd Δ := fun x hx => by + have h1 : x.1 ∈ discBd Δ := hb ▸ hx + obtain ⟨y, hy, he⟩ := h1 + exact Subtype.ext he ▸ hy + have hOF : IsOArc (ι '' C) := hb ▸ hΔ.isOArc_discBd + obtain ⟨h1, -, ⟨e'⟩⟩ := glue_model hS hC hΔS hcS' hι hu hm hOF hBb e d' + rw [show 0 + a = a by omega, show 0 + b = b by omega, show 1 - 1 + (c - 1) = c - 1 by omega] at e' + exact ⟨h1, ⟨e'⟩⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/PlaneDisc.lean b/LeanPool/GraphMinor/Surface/PlaneDisc.lean new file mode 100644 index 0000000000..bd76628e1c --- /dev/null +++ b/LeanPool/GraphMinor/Surface/PlaneDisc.lean @@ -0,0 +1,700 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Schoenflies + +/-! +# Closed discs in the plane + +This file collects what the disc statements need from the Schoenflies theorem, in `ℂ`. + +* `isClosedDisc_closedInner`: the closed domain of an `O`-arc `G` is a closed disc with boundary + `G`. +* `eq_closedInner_of_discBd`: it is the only closed disc with this boundary. The disc minus its + boundary is open by invariance of domain, so it is a full side of `G`, and only the inner side is + bounded. +* `componentsIn_image`, `componentsIn_union_eq_pair`: tools for the components of a set. +* `IsCut.components`: the components of a closed domain minus a cross-cut, and of an `O`-arc minus + two points. +* `exists_other_arc`: an arc in an `O`-arc has a complementary arc with the same ends. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +local notation "𝕀" => unitInterval + +universe u v + +/-- A map with a continuous inverse on its image is a homeomorphism onto the image. -/ +theorem exists_homeomorph_image {S : Type u} {T : Type v} [TopologicalSpace S] [TopologicalSpace T] + {Δ : Set S} {f : S → T} {f' : T → S} (hf : ContinuousOn f Δ) (hf' : ContinuousOn f' (f '' Δ)) + (hl : LeftInvOn f' f Δ) : ∃ e : Δ ≃ₜ f '' Δ, ∀ x, (e x).1 = f x.1 := by + have hmem : ∀ y : f '' Δ, f' y.1 ∈ Δ := by + rintro ⟨_, x, hx, rfl⟩ + change f' (f x) ∈ Δ + rw [hl hx] + exact hx + refine ⟨⟨⟨fun x => ⟨f x.1, mem_image_of_mem f x.2⟩, fun y => ⟨f' y.1, hmem y⟩, fun x => ?_, + ?_⟩, ?_, ?_⟩, fun _ => rfl⟩ + · exact Subtype.ext (hl x.2) + · rintro ⟨_, x, hx, rfl⟩ + refine Subtype.ext ?_ + change f (f' (f x)) = f x + rw [hl hx] + · exact Continuous.subtype_mk (continuousOn_iff_continuous_domRestrict.mp hf) _ + · exact Continuous.subtype_mk (continuousOn_iff_continuous_domRestrict.mp hf') _ + +/-- The image of a closed disc under a map with a continuous inverse. -/ +theorem IsClosedDisc.image {S : Type u} {T : Type v} [TopologicalSpace S] [TopologicalSpace T] + {Δ : Set S} (hΔ : IsClosedDisc Δ) {f : S → T} {f' : T → S} (hf : ContinuousOn f Δ) + (hf' : ContinuousOn f' (f '' Δ)) (hl : LeftInvOn f' f Δ) : + IsClosedDisc (f '' Δ) ∧ discBd (f '' Δ) = f '' discBd Δ := by + obtain ⟨e, he⟩ := exists_homeomorph_image hf hf' hl + obtain ⟨φ⟩ := hΔ + refine ⟨⟨φ.trans e⟩, ?_⟩ + rw [disc_boundary.{v} (f '' Δ) (φ.trans e), disc_boundary.{u} Δ φ, image_image] + exact image_congr fun x _ => he (φ x) + +/-- The image of an `O`-arc under a map with a continuous inverse. -/ +theorem IsOArc.image {S : Type u} {T : Type v} [TopologicalSpace S] [TopologicalSpace T] + {F : Set S} (hF : IsOArc F) {f : S → T} {f' : T → S} (hf : ContinuousOn f F) + (hf' : ContinuousOn f' (f '' F)) (hl : LeftInvOn f' f F) : IsOArc (f '' F) := by + obtain ⟨e, -⟩ := exists_homeomorph_image hf hf' hl + obtain ⟨φ⟩ := hF + exact ⟨φ.trans e⟩ + +/-- Under a continuous map with a continuous inverse, components go to components. -/ +theorem image_connectedComponentIn {S : Type u} {T : Type v} [TopologicalSpace S] + [TopologicalSpace T] {X : Set S} {f : S → T} {f' : T → S} (hf : ContinuousOn f X) + (hf' : ContinuousOn f' (f '' X)) (hl : LeftInvOn f' f X) {x : S} (hx : x ∈ X) : + f '' connectedComponentIn X x = connectedComponentIn (f '' X) (f x) := by + have hsub : connectedComponentIn X x ⊆ X := connectedComponentIn_subset X x + have hsub' : connectedComponentIn (f '' X) (f x) ⊆ f '' X := connectedComponentIn_subset _ _ + have hxm : x ∈ connectedComponentIn X x := mem_connectedComponentIn hx + have hfm : f x ∈ f '' X := mem_image_of_mem f hx + have hym : f x ∈ connectedComponentIn (f '' X) (f x) := mem_connectedComponentIn hfm + have h1 : f '' connectedComponentIn X x ⊆ connectedComponentIn (f '' X) (f x) := + IsPreconnected.subset_connectedComponentIn + (isPreconnected_connectedComponentIn.image f (hf.mono hsub)) (mem_image_of_mem f hxm) + (image_mono hsub) + have h2 : f' '' connectedComponentIn (f '' X) (f x) ⊆ connectedComponentIn X x := by + refine IsPreconnected.subset_connectedComponentIn + (isPreconnected_connectedComponentIn.image f' (hf'.mono hsub')) ⟨f x, hym, hl hx⟩ ?_ + refine (image_mono hsub').trans ?_ + rw [hl.image_image] + refine Subset.antisymm h1 fun y hy => ?_ + obtain ⟨z, hz, rfl⟩ := hsub' hy + exact ⟨z, by simpa [hl hz] using h2 (mem_image_of_mem f' hy), rfl⟩ + +/-- Components of an image. -/ +theorem componentsIn_image {S : Type u} {T : Type v} [TopologicalSpace S] + [TopologicalSpace T] {X : Set S} {f : S → T} {f' : T → S} (hf : ContinuousOn f X) + (hf' : ContinuousOn f' (f '' X)) (hl : LeftInvOn f' f X) : + componentsIn (f '' X) = (fun C => f '' C) '' componentsIn X := by + ext C + constructor + · rintro ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + exact ⟨_, ⟨x, hx, rfl⟩, image_connectedComponentIn hf hf' hl hx⟩ + · rintro ⟨_, ⟨x, hx, rfl⟩, rfl⟩ + exact ⟨_, mem_image_of_mem f hx, (image_connectedComponentIn hf hf' hl hx).symm⟩ + +section Homeomorphisms + +variable {S : Type u} {T : Type v} [TopologicalSpace S] [TopologicalSpace T] (ψ : S ≃ₜ T) + +theorem image_tilde_homeomorph (c : Set S) : tilde (ψ '' c) = ψ '' tilde c := by + unfold tilde + rw [← ψ.image_closure, image_sdiff ψ.injective] + +theorem image_isClosedDisc_homeomorph {Δ : Set S} (h : IsClosedDisc Δ) : IsClosedDisc (ψ '' Δ) := by + obtain ⟨φ⟩ := h + exact ⟨φ.trans (ψ.image Δ)⟩ + +theorem image_isOArc_homeomorph {F : Set S} (h : IsOArc F) : IsOArc (ψ '' F) := by + obtain ⟨φ⟩ := h + exact ⟨φ.trans (ψ.image F)⟩ + +theorem image_isLine_homeomorph {F : Set S} (h : IsLine F) : IsLine (ψ '' F) := by + obtain ⟨φ⟩ := h + exact ⟨φ.trans (ψ.image F)⟩ + +theorem image_discBd_homeomorph (Δ : Set S) : discBd (ψ '' Δ) = ψ '' discBd Δ := by + unfold discBd + rw [← image_bd_homeomorph (ψ.image Δ), ← image_comp, ← image_comp] + rfl + +theorem image_lineEnds_subset_homeomorph (F : Set S) : ψ '' lineEnds F ⊆ lineEnds (ψ '' F) := by + rintro _ ⟨u, ⟨v, φ, h₀, h₁⟩, rfl⟩ + exact ⟨ψ v, φ.trans (ψ.image F), by rw [← h₀]; rfl, by rw [← h₁]; rfl⟩ + +theorem image_lineEnds_homeomorph (F : Set S) : lineEnds (ψ '' F) = ψ '' lineEnds F := by + refine Subset.antisymm ?_ (image_lineEnds_subset_homeomorph ψ F) + have h := image_lineEnds_subset_homeomorph ψ.symm (ψ '' F) + rw [← image_comp, show (ψ.symm ∘ ψ : S → S) = id from funext (by simp), image_id] at h + intro x hx + exact ⟨ψ.symm x, h ⟨x, hx, rfl⟩, by simp⟩ + +theorem image_cuffs_homeomorph : cuffs T = (fun c ↦ ψ '' c) '' cuffs S := by + unfold cuffs + rw [← image_bd_homeomorph ψ] + exact componentsIn_image (f' := ψ.symm) ψ.continuous.continuousOn ψ.symm.continuous.continuousOn + (fun x _ ↦ by simp) + +end Homeomorphisms + +/-- A preconnected subset of the union of two separated sets lies in one of them. -/ +theorem IsPreconnected.subset_or_of_separated {T : Type u} [TopologicalSpace T] {A B C : Set T} + (hC : IsPreconnected C) (hsub : C ⊆ A ∪ B) (h1 : Disjoint (closure A) B) + (h2 : Disjoint A (closure B)) : C ⊆ A ∨ C ⊆ B := by + by_contra hn + push Not at hn + obtain ⟨hA, hB⟩ := hn + obtain ⟨y, hyC, hyA⟩ := not_subset.mp hA + obtain ⟨x, hxC, hxB⟩ := not_subset.mp hB + have hxA : x ∈ A := (hsub hxC).resolve_right hxB + have hyB : y ∈ B := (hsub hyC).resolve_left hyA + obtain ⟨z, hzC, hz1, hz2⟩ := hC (closure B)ᶜ (closure A)ᶜ isClosed_closure.isOpen_compl + isClosed_closure.isOpen_compl (fun z hz => by + rcases hsub hz with h | h + · exact Or.inl (Set.disjoint_left.mp h2 h) + · exact Or.inr (Set.disjoint_right.mp h1 h)) + ⟨x, hxC, Set.disjoint_left.mp h2 hxA⟩ ⟨y, hyC, Set.disjoint_right.mp h1 hyB⟩ + rcases hsub hzC with h | h + · exact hz2 (subset_closure h) + · exact hz1 (subset_closure h) + +/-- The components of the union of two separated connected sets. -/ +theorem componentsIn_union_eq_pair {T : Type u} [TopologicalSpace T] {A B : Set T} + (hA : IsPreconnected A) + (hB : IsPreconnected B) (hA' : A.Nonempty) (hB' : B.Nonempty) (h1 : Disjoint (closure A) B) + (h2 : Disjoint A (closure B)) : componentsIn (A ∪ B) = {A, B} := by + have hdisj : Disjoint A B := h1.mono_left subset_closure + have key : ∀ {A' B' : Set T}, IsPreconnected A' → Disjoint (closure A') B' → + Disjoint A' (closure B') → A' ∪ B' = A ∪ B → ∀ x ∈ A', + connectedComponentIn (A ∪ B) x = A' := by + intro A' B' hA1 h3 h4 hu x hx + have hxm : x ∈ A ∪ B := hu ▸ Or.inl hx + refine Subset.antisymm ?_ (hA1.subset_connectedComponentIn hx (hu ▸ subset_union_left)) + have hC := isPreconnected_connectedComponentIn (F := A ∪ B) (x := x) + have hs : connectedComponentIn (A ∪ B) x ⊆ A' ∪ B' := hu ▸ connectedComponentIn_subset _ _ + rcases IsPreconnected.subset_or_of_separated hC hs h3 h4 with h | h + · exact h + · exact absurd (h (mem_connectedComponentIn hxm)) + (Set.disjoint_left.mp (h3.mono_left subset_closure) hx) + have hA2 := key hA h1 h2 rfl + have hB2 := key hB (by rw [disjoint_comm]; exact h2) (by rw [disjoint_comm]; exact h1) + (union_comm _ _) + ext C + constructor + · rintro ⟨x, hx | hx, rfl⟩ + · exact Or.inl (hA2 x hx) + · exact Or.inr (hB2 x hx) + · rintro (rfl | rfl) + · obtain ⟨x, hx⟩ := hA' + exact ⟨x, Or.inl hx, hA2 x hx⟩ + · obtain ⟨x, hx⟩ := hB' + exact ⟨x, Or.inr hx, hB2 x hx⟩ + +/-- `exists_homeomorph_closedInner` in terms of functions on the plane. -/ +theorem exists_bdMatch_closedInner {F F' : Set ℂ} (hF : Nonempty (Circle ≃ₜ F)) + (hF' : Nonempty (Circle ≃ₜ F')) {h₀ k₀ : ℂ → ℂ} (m : BdMatch F F' h₀ k₀) : + ∃ ψ χ : ℂ → ℂ, BdMatch (closedInner F) (closedInner F') ψ χ ∧ EqOn ψ h₀ F := by + obtain ⟨Ψ, hΨ⟩ := exists_homeomorph_closedInner hF hF' m + obtain ⟨ψ, χ, m', hv⟩ := exists_bdMatch Ψ + have hsub : F ⊆ closedInner F := subset_union_right + refine ⟨ψ, χ, m', fun z hz => ?_⟩ + rw [hv ⟨z, hsub hz⟩] + exact hΨ ⟨z, hsub hz⟩ hz + +theorem BdMatch.image_eq {F F' : Set ℂ} {h k : ℂ → ℂ} (m : BdMatch F F' h k) : h '' F = F' := by + refine Subset.antisymm (image_subset_iff.mpr m.1) fun w hw => ?_ + exact ⟨k w, m.2.1 hw, m.2.2.2.1 hw⟩ + +theorem BdMatch.leftInvOn {F F' : Set ℂ} {h k : ℂ → ℂ} (m : BdMatch F F' h k) : LeftInvOn k h F := + m.2.2.1 + +/-- The closed disc of `ℂ`. -/ +theorem isClosedDisc_closedBall : IsClosedDisc (closedBall (0 : ℂ) 1) ∧ + discBd (closedBall (0 : ℂ) 1) = sphere 0 1 := by + have h0 : IsClosedDisc ClosedUnitDisc := ⟨Homeomorph.refl _⟩ + have hb : discBd ClosedUnitDisc = UnitCircle := by + rw [discBd, bd_closedUnitDisc] + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + exact hy + · intro hx + have hx' : x ∈ ClosedUnitDisc := sphere_subset_closedBall hx + exact ⟨⟨x, hx'⟩, hx, rfl⟩ + have himg : ∀ {r : ℝ}, complexPlane.symm '' closedBall 0 r = closedBall 0 r := by + intro r + ext z + constructor + · rintro ⟨x, hx, rfl⟩ + rw [mem_closedBall_zero_iff, LinearIsometryEquiv.norm_map] + exact mem_closedBall_zero_iff.mp hx + · intro hz + refine ⟨complexPlane z, ?_, complexPlane.symm_apply_apply z⟩ + rw [mem_closedBall_zero_iff, LinearIsometryEquiv.norm_map] + exact mem_closedBall_zero_iff.mp hz + have himg' : complexPlane.symm '' UnitCircle = sphere 0 1 := by + ext z + constructor + · rintro ⟨x, hx, rfl⟩ + rw [mem_sphere_zero_iff_norm, LinearIsometryEquiv.norm_map] + exact mem_sphere_zero_iff_norm.mp hx + · intro hz + refine ⟨complexPlane z, ?_, complexPlane.symm_apply_apply z⟩ + rw [UnitCircle, mem_sphere_zero_iff_norm, LinearIsometryEquiv.norm_map] + exact mem_sphere_zero_iff_norm.mp hz + have := h0.image (f := complexPlane.symm) (f' := complexPlane) + complexPlane.symm.continuous.continuousOn complexPlane.continuous.continuousOn + fun x _ => complexPlane.apply_symm_apply x + rw [hb, himg', ClosedUnitDisc, himg] at this + exact this + +/-- The closed domain of an `O`-arc of `ℂ` is a closed disc with that boundary. This is the form of +the Schoenflies theorem that the disc statements use. -/ +theorem isClosedDisc_closedInner {G : Set ℂ} (hG : Nonempty (Circle ≃ₜ G)) : + IsClosedDisc (closedInner G) ∧ discBd (closedInner G) = G := by + obtain ⟨φ₀⟩ := oArc_sphere + obtain ⟨φ⟩ := id hG + obtain ⟨h₀, k₀, m, -⟩ := exists_bdMatch (φ₀.symm.trans φ) + obtain ⟨ψ, χ, m', he⟩ := exists_bdMatch_closedInner ⟨φ₀⟩ hG m + rw [closedInner_sphere] at m' + have himg := m'.image_eq + obtain ⟨h1, h2⟩ := isClosedDisc_closedBall.1.image m'.2.2.2.2.1 + (by rw [himg]; exact m'.2.2.2.2.2) m'.leftInvOn + rw [himg, isClosedDisc_closedBall.2, he.image_eq, m.image_eq] at h2 + rw [himg] at h1 + exact ⟨h1, h2⟩ + +/-- The sides of a curve: a nonempty connected open set `W` that misses `G`, and with `W ∪ G` +closed, +is a side of `G`. -/ +theorem subset_of_side {T : Type u} [TopologicalSpace T] {C W G : Set T} (hC : IsPreconnected C) + (hW : IsOpen W) + (hcl : IsClosed (W ∪ G)) (hCG : Disjoint C G) (hne : (C ∩ W).Nonempty) : C ⊆ W := by + have hsub : C ⊆ W ∪ (W ∪ G)ᶜ := fun z hz => by + by_cases h : z ∈ W + · exact Or.inl h + · exact Or.inr fun h' => h'.elim h (Set.disjoint_left.mp hCG hz) + exact hC.subset_left_of_subset_union hW hcl.isOpen_compl + (Set.disjoint_left.mpr fun z h h' => h' (Or.inl h)) hsub hne + +/-- A closed disc of `ℂ` with boundary `G` is the closed domain of `G`. -/ +theorem eq_closedInner_of_discBd {Δ G : Set ℂ} (hG : Nonempty (Circle ≃ₜ G)) (hΔ : IsClosedDisc Δ) + (hb : discBd Δ = G) : Δ = closedInner G := by + obtain ⟨φ⟩ := hG + have J := isJordanParts φ + obtain ⟨h, g, hh, hg, hhm, hgm, hgh, hhg, hbdh⟩ := hΔ.exists_chart + have hginj : InjOn g (closedBall 0 1) := (show LeftInvOn h g (closedBall 0 1) from hhg).injOn + have hgs : g '' sphere 0 1 = G := by + rw [← hbdh, hgh.image_image' ?_, hb] + rintro _ ⟨x, -, rfl⟩ + exact x.2 + let W := g '' ball 0 1 + have hsplit : ball (0 : ℂ) 1 ∪ sphere 0 1 = closedBall 0 1 := ball_union_sphere + have hW : IsOpen W := isOpen_image_of_injOn isOpen_ball + (hg.mono ball_subset_closedBall) (hginj.mono ball_subset_closedBall) + have hΔeq : g '' closedBall 0 1 = Δ := by + refine Subset.antisymm (image_subset_iff.mpr hgm) fun x hx => ?_ + exact ⟨h x, hhm hx, hgh hx⟩ + have hun : W ∪ G = Δ := by + rw [← hgs, ← image_union, hsplit, hΔeq] + have hcomp : IsCompact Δ := by + rw [← hΔeq] + exact (isCompact_closedBall 0 1).image_of_continuousOn hg + have hcl : IsClosed (W ∪ G) := hun ▸ hcomp.isClosed + have hdis : Disjoint W G := by + rw [← hgs] + refine Set.disjoint_left.mpr ?_ + rintro _ ⟨x, hx, rfl⟩ ⟨y, hy, he⟩ + have := hginj (sphere_subset_closedBall hy) (ball_subset_closedBall hx) he + subst this + exact (mem_ball_zero_iff.mp hx).ne (mem_sphere_zero_iff_norm.mp hy) + have hWc : IsPreconnected W := + (convex_ball (0 : ℂ) 1).isPreconnected.image g (hg.mono ball_subset_closedBall) + have hWne : W.Nonempty := ⟨g 0, 0, by simp, rfl⟩ + have hsub : W ⊆ inner G ∪ outer G := by + rw [J.union_eq] + exact fun z hz hzG => Set.disjoint_left.mp hdis hz hzG + have hWin : W ⊆ inner G := by + rcases (isPreconnected_iff_subset_of_disjoint.mp hWc) _ _ J.isOpen_inner J.isOpen_outer hsub + (by rw [J.disjoint.inter_eq]; simp) with h1 | h1 + · exact h1 + · exfalso + obtain ⟨z, hz⟩ := hWne + have h2 := subset_of_side J.isConnected_outer.isPreconnected hW hcl + (Set.disjoint_left.mpr fun z hz hzG => J.outer_subset_compl hz hzG) ⟨z, h1 hz, hz⟩ + exact J.not_isBounded_outer ((hcomp.isBounded.subset (hun ▸ subset_union_left)).subset h2) + obtain ⟨z, hz⟩ := hWne + have h2 := subset_of_side J.isConnected_inner.isPreconnected hW hcl + (Set.disjoint_left.mpr fun z hz hzG => J.inner_subset_compl hz hzG) ⟨z, hWin hz, hz⟩ + rw [← hun, Subset.antisymm hWin h2] + rfl + +theorem outer_sphere : outer (sphere (0 : ℂ) 1) = (closedBall 0 1)ᶜ := by + obtain ⟨φ⟩ := oArc_sphere + have J := isJordanParts φ + ext z + have h1 : z ∈ inner (sphere (0 : ℂ) 1) ↔ ‖z‖ < 1 := by + rw [inner_sphere, mem_ball_zero_iff] + constructor + · intro hz hz' + rcases lt_or_eq_of_le (mem_closedBall_zero_iff.mp hz') with h | h + · exact Set.disjoint_left.mp J.disjoint (h1.mpr h) hz + · exact J.outer_subset_compl hz (mem_sphere_zero_iff_norm.mpr h) + · intro hz + have : z ∈ (sphere (0 : ℂ) 1)ᶜ := fun h => hz (sphere_subset_closedBall h) + rw [← J.union_eq] at this + exact this.resolve_left fun h => hz (ball_subset_closedBall (inner_sphere ▸ h)) + +/-- A curve in the closed unit disc has its closed domain in the disc. -/ +theorem closedInner_subset_closedBall {G : Set ℂ} (hG : Nonempty (Circle ≃ₜ G)) + (hsub : G ⊆ closedBall 0 1) : closedInner G ⊆ closedBall 0 1 := by + obtain ⟨φ⟩ := hG + obtain ⟨φ₀⟩ := oArc_sphere + have J := isJordanParts φ + have J₀ := isJordanParts φ₀ + have hconn : IsPreconnected (closedBall (0 : ℂ) 1)ᶜ := by + rw [← outer_sphere] + exact J₀.isConnected_outer.isPreconnected + have hdis : (closedBall (0 : ℂ) 1)ᶜ ⊆ inner G ∪ outer G := by + rw [J.union_eq] + exact fun z hz hzG => hz (hsub hzG) + have hout : (closedBall (0 : ℂ) 1)ᶜ ⊆ outer G := by + rcases (isPreconnected_iff_subset_of_disjoint.mp hconn) _ _ J.isOpen_inner J.isOpen_outer hdis + (by rw [J.disjoint.inter_eq]; simp) with h | h + · refine absurd (J.isBounded_inner.subset h) ?_ + rw [← outer_sphere] + exact J₀.not_isBounded_outer + · exact h + rintro z (hz | hz) + · by_contra hn + exact Set.disjoint_left.mp J.disjoint hz (hout hn) + · exact hsub hz + +/-- A point on the outer side of a curve in the closed unit disc is joined to the unit circle +inside the disc, off the curve. -/ +private theorem exists_sphere_mem_component {G : Set ℂ} (φ : Circle ≃ₜ G) {x : ℂ} + (hx : x ∈ outer G) (hx1 : ‖x‖ ≤ 1) : + ∃ y ∈ sphere (0 : ℂ) 1, y ∈ connectedComponentIn (closedBall 0 1 \ G) x := by + have J := isJordanParts φ + have hpath : IsPathConnected (outer G) := + (J.isOpen_outer.isConnected_iff_isPathConnected).mp J.isConnected_outer + obtain ⟨w, hw, hw1⟩ : ∃ w ∈ outer G, 1 < ‖w‖ := by + by_contra hn + push Not at hn + exact J.not_isBounded_outer ((isBounded_closedBall (x := (0 : ℂ)) (r := 1)).subset + fun z hz => mem_closedBall_zero_iff.mpr (hn z hz)) + obtain ⟨p, hp⟩ := hpath.joinedIn x hx w hw + have hT : IsCompact {t : 𝕀 | 1 ≤ ‖p t‖} := + (isClosed_le continuous_const p.continuous.norm).isCompact + obtain ⟨t, ht, hmin⟩ := hT.exists_isLeast ⟨1, by simpa using hw1.le⟩ + have hle : ∀ s ≤ t, ‖p s‖ ≤ 1 := by + have hcl : IsClosed {s : 𝕀 | ‖p s‖ ≤ 1} := isClosed_le p.continuous.norm continuous_const + have hlt : Iio t ⊆ {s : 𝕀 | ‖p s‖ ≤ 1} := fun s hs => by + by_contra hn + have h1 : 1 ≤ ‖p s‖ := le_of_lt (not_le.mp hn) + exact absurd (hmin h1) (not_le.mpr hs) + intro s hs + rcases eq_or_ne t 0 with h0 | h0 + · have hs0 : s = 0 := le_antisymm (h0 ▸ hs) (show (0 : 𝕀) ≤ s from unitInterval.nonneg') + subst hs0 + simpa using hx1 + · have hne : (Iio t).Nonempty := ⟨0, bot_lt_iff_ne_bot.mpr h0⟩ + have hc := closure_minimal hlt hcl + rw [closure_Iio' hne] at hc + exact hc hs + refine ⟨p t, mem_sphere_zero_iff_norm.mpr (le_antisymm (hle t le_rfl) ht), ?_⟩ + have hsub' : p '' Iic t ⊆ closedBall 0 1 \ G := by + rintro _ ⟨s, hs, rfl⟩ + exact ⟨mem_closedBall_zero_iff.mpr (hle s hs), J.outer_subset_compl (hp s)⟩ + exact (isPreconnected_Iic.image p p.continuous.continuousOn).subset_connectedComponentIn + ⟨0, (show (0 : 𝕀) ≤ t from unitInterval.nonneg'), by simp⟩ hsub' ⟨t, le_rfl, rfl⟩ + +/-- The components of the closed unit disc minus a curve. -/ +theorem components_closedBall_sdiff {G : Set ℂ} (hG : Nonempty (Circle ≃ₜ G)) + (hsub : G ⊆ closedBall 0 1) : + inner G ∈ componentsIn (closedBall 0 1 \ G) ∧ Disjoint (inner G) (sphere 0 1) ∧ + ∀ C ∈ componentsIn (closedBall 0 1 \ G), Disjoint C (sphere 0 1) → C = inner G := by + obtain ⟨φ⟩ := id hG + have J := isJordanParts φ + have hin : inner G ⊆ closedBall 0 1 \ G := fun z hz => + ⟨closedInner_subset_closedBall hG hsub (Or.inl hz), J.inner_subset_compl hz⟩ + have hcomp : ∀ x ∈ inner G, connectedComponentIn (closedBall 0 1 \ G) x = inner G := by + intro x hx + refine Subset.antisymm ?_ (J.isConnected_inner.isPreconnected.subset_connectedComponentIn hx + hin) + refine J.subset_inner isPreconnected_connectedComponentIn ?_ + ⟨x, mem_connectedComponentIn (hin hx), hx⟩ + exact Set.disjoint_left.mpr fun z hz => (connectedComponentIn_subset _ _ hz).2 + obtain ⟨x₀, hx₀⟩ := J.isConnected_inner.nonempty + refine ⟨⟨x₀, hin hx₀, hcomp x₀ hx₀⟩, ?_, ?_⟩ + · refine Set.disjoint_left.mpr fun z hz hzs => ?_ + have hint : inner G ⊆ interior (closedBall (0 : ℂ) 1) := + interior_maximal (fun w hw => (hin hw).1) J.isOpen_inner + rw [interior_closedBall _ one_ne_zero] at hint + exact (mem_ball_zero_iff.mp (hint hz)).ne (mem_sphere_zero_iff_norm.mp hzs) + · rintro _ ⟨x, hx, rfl⟩ hdis + have hsplit : x ∈ inner G ∨ x ∈ outer G := by + have : x ∈ Gᶜ := hx.2 + rwa [← J.union_eq] at this + rcases hsplit with h | h + · exact hcomp x h + · obtain ⟨y, hy, hyc⟩ := exists_sphere_mem_component φ h (mem_closedBall_zero_iff.mp hx.1) + exact absurd hy (Set.disjoint_left.mp hdis hyc) + +theorem exists_mid : ∃ t : 𝕀, 0 < t ∧ t < 1 := by + refine ⟨⟨1 / 2, by norm_num, by norm_num⟩, ?_, ?_⟩ + · exact Subtype.mk_lt_mk.mpr (by norm_num) + · exact Subtype.mk_lt_mk.mpr (by norm_num) + +theorem mem_Ioo_iff_ne {t : 𝕀} : t ∈ Ioo (0 : 𝕀) 1 ↔ t ≠ 0 ∧ t ≠ 1 := by + constructor + · rintro ⟨h0, h1⟩ + exact ⟨h0.ne', h1.ne⟩ + · rintro ⟨h0, h1⟩ + exact ⟨bot_lt_iff_ne_bot.mpr h0, lt_top_iff_ne_top.mpr h1⟩ + +/-- An arc minus its ends. -/ +theorem IsArcMap.range_sdiff {a : 𝕀 → ℂ} (ha : IsArcMap a) : + range a \ {a 0, a 1} = a '' Ioo 0 1 := by + ext z + constructor + · rintro ⟨⟨t, rfl⟩, hz⟩ + simp only [mem_insert_iff, mem_singleton_iff, not_or] at hz + exact ⟨t, mem_Ioo_iff_ne.mpr ⟨fun h => hz.1 (by rw [h]), fun h => hz.2 (by rw [h])⟩, rfl⟩ + · rintro ⟨t, ht, rfl⟩ + obtain ⟨h0, h1⟩ := mem_Ioo_iff_ne.mp ht + refine ⟨⟨t, rfl⟩, ?_⟩ + simp only [mem_insert_iff, mem_singleton_iff, not_or] + exact ⟨fun h => h0 (ha.2 h), fun h => h1 (ha.2 h)⟩ + +private theorem disjoint_closure_open_arc {a b : 𝕀 → ℂ} (ha : IsArcMap a) + (hm : ∀ s t, a s = b t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) : + Disjoint (closure (a '' Ioo 0 1)) (b '' Ioo 0 1) := by + have hcl : closure (a '' Ioo 0 1) ⊆ range a := + closure_minimal (image_subset_range _ _) (isCompact_range ha.1).isClosed + refine Set.disjoint_left.mpr fun z hz => ?_ + obtain ⟨s, rfl⟩ := hcl hz + rintro ⟨t, ht, he⟩ + obtain ⟨h0, h1⟩ := mem_Ioo_iff_ne.mp ht + rcases hm s t he.symm with h | h + · exact h0 h.2 + · exact h1 h.2 + +private theorem swap_meet {a b : 𝕀 → ℂ} + (hm : ∀ s t, a s = b t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) : + ∀ s t, b s = a t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := fun s t h => + (hm t s h.symm).imp And.symm And.symm + +/-- An arc inside an arc with the same ends is the whole arc. -/ +theorem range_eq_of_subset {a c : 𝕀 → ℂ} (ha : IsArcMap a) (hc : IsArcMap c) + (hsub : range c ⊆ range a) (h0 : c 0 = a 0) (h1 : c 1 = a 1) : range c = range a := by + refine Subset.antisymm hsub ?_ + obtain ⟨ι, hι, hιc⟩ := ha.exists_inv + have hcont : Continuous fun t => ι (c t) := + hιc.comp_continuous hc.1 fun t => hsub ⟨t, rfl⟩ + rintro _ ⟨s, rfl⟩ + obtain ⟨t, ht⟩ := mem_range_of_exists_le_of_exists_ge hcont + ⟨0, by + change ι (c 0) ≤ s + rw [h0, hι] + exact unitInterval.nonneg'⟩ + ⟨1, by + change s ≤ ι (c 1) + rw [h1, hι] + exact unitInterval.le_one'⟩ + obtain ⟨r, hr⟩ := hsub ⟨t, rfl⟩ + refine ⟨t, ?_⟩ + rw [← hr, ← ht] + change a r = a (ι (c t)) + rw [← hr, hι] + +/-- An arc in an `O`-arc has a complementary arc with the same ends. -/ +theorem exists_other_arc {F : Set ℂ} (φ : Circle ≃ₜ F) {c : 𝕀 → ℂ} (hc : IsArcMap c) + (hsub : range c ⊆ F) : ∃ d : 𝕀 → ℂ, IsArcMap d ∧ d 0 = c 0 ∧ d 1 = c 1 ∧ range c ∪ range d = F ∧ + ∀ s t, c s = d t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + have hne : c 0 ≠ c 1 := fun h => zero_ne_one (hc.2 h) + obtain ⟨a, b, ha, hb, ha0, ha1, hb0, hb1, hu, hm⟩ := + exists_two_arcs φ (hsub ⟨0, rfl⟩) (hsub ⟨1, rfl⟩) hne + have key : ∀ a b : 𝕀 → ℂ, IsArcMap a → IsArcMap b → a 0 = c 0 → a 1 = c 1 → b 0 = c 0 → + b 1 = c 1 → range a ∪ range b = F → + (∀ s t, a s = b t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1)) → c '' Ioo 0 1 ⊆ a '' Ioo 0 1 → + ∃ d : 𝕀 → ℂ, IsArcMap d ∧ d 0 = c 0 ∧ d 1 = c 1 ∧ range c ∪ range d = F ∧ + ∀ s t, c s = d t → (s = 0 ∧ t = 0) ∨ (s = 1 ∧ t = 1) := by + intro a b ha hb ha0 ha1 hb0 hb1 hu hm hs + have hsub' : range c ⊆ range a := by + rintro _ ⟨t, rfl⟩ + by_cases h0 : t = 0 + · exact ⟨0, by rw [h0, ha0]⟩ + · by_cases h1 : t = 1 + · exact ⟨1, by rw [h1, ha1]⟩ + · exact image_subset_range _ _ (hs ⟨t, mem_Ioo_iff_ne.mpr ⟨h0, h1⟩, rfl⟩) + have hr := range_eq_of_subset ha hc hsub' ha0.symm ha1.symm + refine ⟨b, hb, hb0, hb1, by rw [hr, hu], fun s t he => ?_⟩ + obtain ⟨r, hr'⟩ := hsub' ⟨s, rfl⟩ + rw [← hr'] at he + rcases hm r t he with ⟨h1, h2⟩ | ⟨h1, h2⟩ + · left + refine ⟨hc.2 ?_, h2⟩ + rw [← hr', h1, ha0] + · right + refine ⟨hc.2 ?_, h2⟩ + rw [← hr', h1, ha1] + have hsplit : c '' Ioo 0 1 ⊆ a '' Ioo 0 1 ∪ b '' Ioo 0 1 := by + rintro _ ⟨t, ht, rfl⟩ + obtain ⟨h0, h1⟩ := mem_Ioo_iff_ne.mp ht + have hF : c t ∈ F := hsub ⟨t, rfl⟩ + have hend : ∀ {d : 𝕀 → ℂ}, d 0 = c 0 → d 1 = c 1 → ∀ s, d s = c t → s ∈ Ioo (0 : 𝕀) 1 := by + intro d h2 h3 s hs + refine mem_Ioo_iff_ne.mpr ⟨fun h => h0 (hc.2 ?_), fun h => h1 (hc.2 ?_)⟩ + · rw [← hs, h, h2] + · rw [← hs, h, h3] + rw [← hu] at hF + rcases hF with ⟨s, hs⟩ | ⟨s, hs⟩ + · exact Or.inl ⟨s, hend ha0 ha1 s hs, hs⟩ + · exact Or.inr ⟨s, hend hb0 hb1 s hs, hs⟩ + rcases IsPreconnected.subset_or_of_separated (isPreconnected_Ioo.image c hc.1.continuousOn) hsplit + (disjoint_closure_open_arc ha hm) + (by rw [disjoint_comm]; exact disjoint_closure_open_arc hb (swap_meet hm)) with h | h + · exact key a b ha hb ha0 ha1 hb0 hb1 hu hm h + · exact key b a hb ha hb0 hb1 ha0 ha1 (by rw [union_comm, hu]) (swap_meet hm) h + +/-- A closed domain minus its boundary. -/ +theorem closedInner_sdiff {G : Set ℂ} (hG : Nonempty (Circle ≃ₜ G)) : + closedInner G \ G = inner G := by + obtain ⟨φ⟩ := hG + have J := isJordanParts φ + ext z + constructor + · rintro ⟨h | h, h'⟩ + · exact h + · exact absurd h h' + · exact fun h => ⟨Or.inl h, J.inner_subset_compl h⟩ + +/-- The components of a closed domain minus a cross-cut, and of the curve minus the two ends of +the cut. -/ +theorem IsCut.components {F : Set ℂ} {a b e : 𝕀 → ℂ} (c : IsCut F a b e) (J : IsJordanParts F) : + closedInner F \ range e = + (closedInner (side a e) \ range e) ∪ (closedInner (side b e) \ range e) ∧ + componentsIn (closedInner F \ range e) = + {closedInner (side a e) \ range e, closedInner (side b e) \ range e} ∧ + F \ {e 0, e 1} = (range a \ {e 0, e 1}) ∪ (range b \ {e 0, e 1}) ∧ + componentsIn (F \ {e 0, e 1}) = {range a \ {e 0, e 1}, range b \ {e 0, e 1}} ∧ + range a \ {e 0, e 1} ≠ range b \ {e 0, e 1} := by + obtain ⟨f1, -, -, f4, -, -⟩ := c.closedInner_facts J + have hu1 : closedInner F \ range e = + (closedInner (side a e) \ range e) ∪ (closedInner (side b e) \ range e) := by + rw [← f1, union_sdiff_distrib] + have hu2 : F \ {e 0, e 1} = (range a \ {e 0, e 1}) ∪ (range b \ {e 0, e 1}) := by + rw [← c.union, union_sdiff_distrib] + have hpart : ∀ {d : 𝕀 → ℂ}, Nonempty (Circle ≃ₜ side d e) → + IsPreconnected (closedInner (side d e) \ range e) ∧ + (closedInner (side d e) \ range e).Nonempty ∧ IsClosed (closedInner (side d e)) := by + rintro d ⟨φ⟩ + have J₁ := isJordanParts φ + have hsub : inner (side d e) ⊆ closedInner (side d e) \ range e := fun z hz => + ⟨Or.inl hz, fun h => J₁.inner_subset_compl hz (Or.inr h)⟩ + refine ⟨J₁.isConnected_inner.isPreconnected.subset_closure hsub ?_, + J₁.isConnected_inner.nonempty.mono hsub, J₁.isCompact_closure_inner.isClosed⟩ + rw [J₁.closure_inner] + exact sdiff_subset + obtain ⟨p1, n1, c1⟩ := hpart (d := a) c.oArc_side + obtain ⟨p2, n2, c2⟩ := hpart (d := b) c.symm.oArc_side + have hab : Disjoint (closure (closedInner (side a e) \ range e)) + (closedInner (side b e) \ range e) := by + refine Set.disjoint_left.mpr fun z hz hz' => hz'.2 (f4 ⟨?_, hz'.1⟩) + exact closure_minimal sdiff_subset c1 hz + have hba : Disjoint (closedInner (side a e) \ range e) + (closure (closedInner (side b e) \ range e)) := by + refine Set.disjoint_left.mpr fun z hz hz' => hz.2 (f4 ⟨hz.1, ?_⟩) + exact closure_minimal sdiff_subset c2 hz' + have ea : range a \ {e 0, e 1} = a '' Ioo 0 1 := by + rw [← c.a_zero, ← c.a_one, c.arc_a.range_sdiff] + have eb : range b \ {e 0, e 1} = b '' Ioo 0 1 := by + rw [← c.b_zero, ← c.b_one, c.arc_b.range_sdiff] + obtain ⟨t₀, ht₀, ht₁⟩ := exists_mid + have hA : (a '' Ioo 0 1).Nonempty := ⟨_, t₀, ⟨ht₀, ht₁⟩, rfl⟩ + have hB : (b '' Ioo 0 1).Nonempty := ⟨_, t₀, ⟨ht₀, ht₁⟩, rfl⟩ + have hd1 := disjoint_closure_open_arc c.arc_a c.meet + have hd2 := disjoint_closure_open_arc c.arc_b (swap_meet c.meet) + refine ⟨hu1, ?_, hu2, ?_, ?_⟩ + · rw [hu1] + exact componentsIn_union_eq_pair p1 p2 n1 n2 hab hba + · rw [hu2, ea, eb] + exact componentsIn_union_eq_pair (isPreconnected_Ioo.image a c.arc_a.1.continuousOn) + (isPreconnected_Ioo.image b c.arc_b.1.continuousOn) hA hB hd1 + (by rw [disjoint_comm]; exact hd2) + · rw [ea, eb] + intro h + obtain ⟨z, hz⟩ := hA + exact Set.disjoint_left.mp hd1 (subset_closure hz) (h ▸ hz) + +/-- In the complex plane a closed disc has frontier equal to its +intrinsic boundary. -/ +theorem complex_disc_frontier {D : Set ℂ} (hD : IsClosedDisc D) : + frontier D = discBd D := by + obtain ⟨φ⟩ := hD.isOArc_discBd + have J := isJordanParts φ + have heq : closedInner (discBd D) = (outer (discBd D))ᶜ := by + ext z + change (z ∈ inner (discBd D) ∨ z ∈ discBd D) ↔ z ∉ outer (discBd D) + constructor + · rintro (hz | hz) + · exact J.disjoint.notMem_of_mem_left hz + · exact fun h => h.1 hz + · intro hz + by_cases hb : z ∈ discBd D + · exact Or.inr hb + · have hmem : z ∈ inner (discBd D) ∪ outer (discBd D) := + J.union_eq.symm ▸ hb + exact Or.inl (hmem.resolve_right hz) + conv_lhs => rw [eq_closedInner_of_discBd ⟨φ⟩ hD rfl, heq, frontier_compl, J.frontier_outer] + +/-- In the Euclidean plane the frontier and intrinsic disc boundary +also agree. -/ +theorem plane_disc_frontier {D : Set EuclideanPlane} (hD : IsClosedDisc D) : + frontier D = discBd D := by + let e : EuclideanPlane ≃ₜ ℂ := complexPlane.symm.toHomeomorph + obtain ⟨hDc, hb⟩ := hD.image (f := e) (f' := e.symm) + e.continuous.continuousOn e.symm.continuous.continuousOn + (fun _ _ => e.symm_apply_apply _) + apply e.injective.image_injective + rw [e.image_frontier, complex_disc_frontier hDc, hb] + +/-- Every point of the Euclidean plane is a surface interior point. -/ +theorem isInteriorPoint_euclideanPlane (x : EuclideanPlane) : IsInteriorPoint x := by + let U : Set EuclideanPlane := (fun y : EuclideanPlane => y + x) '' OpenUnitDisc + have hHomeo := (Homeomorph.addRight x).image OpenUnitDisc + have hOpen_ball : IsOpen OpenUnitDisc := Metric.isOpen_ball + have hOpen_U : IsOpen U := (Homeomorph.addRight x).isOpenMap OpenUnitDisc hOpen_ball + have hxU : x ∈ U := ⟨0, by simp [OpenUnitDisc], by simp⟩ + exact ⟨U, hOpen_U, hxU, ⟨hHomeo.symm⟩⟩ + +protected theorem subBd_eq_frontier {S : Type*} [TopologicalSpace S] (A : Set S) : + subBd A = frontier A := by + rw [subBd, ← compl_eq_univ_sdiff, frontier_eq_closure_inter_closure] + +theorem subBd_eq_discBd_complex {Δ : Set ℂ} (hΔ : IsClosedDisc Δ) : + subBd Δ = discBd Δ := + (Surface.subBd_eq_frontier Δ).trans (complex_disc_frontier hΔ) + +theorem subBd_eq_discBd_euclideanPlane {D : Set EuclideanPlane} (hD : IsClosedDisc D) : + subBd D = discBd D := + (Surface.subBd_eq_frontier D).trans (plane_disc_frontier hD) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/PlaneLog.lean b/LeanPool/GraphMinor/Surface/PlaneLog.lean new file mode 100644 index 0000000000..d6b7abc631 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/PlaneLog.lean @@ -0,0 +1,274 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Analysis.Complex.CoveringMap +public import Mathlib.Topology.Homotopy.Lifting +public import Mathlib.Analysis.SpecialFunctions.Complex.Log +public import Mathlib.Analysis.SpecialFunctions.Complex.LogDeriv + +/-! +# Continuous logarithms + +The topology of the plane in this development rests on one tool: continuous logarithms of +functions with no zeros. This file sets them up. + +`HasLogOn X f` says that `f` has a continuous logarithm on the set `X`. The main facts are: +- a homotopy of nonvanishing functions starting at the constant `1` has a continuous logarithm + (`exists_log_of_homotopy`), by the homotopy lifting property of the covering `exp`; +- so nonvanishing functions on the plane, and on the unit interval, have logarithms + (`hasLogOn_univ_of_ne_zero`, `hasLogOn_unitInterval`); +- the function $(z - a)^m$ has no logarithm on a circle around $a$ unless $m = 0$ + (`eq_zero_of_hasLogOn_sphere`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Complex + +local notation "𝕀" => unitInterval + +universe u + +/-- The function `f` has a continuous logarithm on the set `X`. -/ +def HasLogOn {T : Type u} [TopologicalSpace T] (X : Set T) (f : T → ℂ) : Prop := + ∃ g : T → ℂ, ContinuousOn g X ∧ ∀ x ∈ X, f x = exp (g x) + +section Basic + +variable {T : Type u} [TopologicalSpace T] {X Y : Set T} {f f₁ f₂ : T → ℂ} + +theorem HasLogOn.mono (h : HasLogOn Y f) (hX : X ⊆ Y) : HasLogOn X f := by + obtain ⟨g, hg, hf⟩ := h + exact ⟨g, hg.mono hX, fun x hx => hf x (hX hx)⟩ + +theorem HasLogOn.congr (h : HasLogOn X f₁) (hf : ∀ x ∈ X, f₂ x = f₁ x) : HasLogOn X f₂ := by + obtain ⟨g, hg, hf'⟩ := h + exact ⟨g, hg, fun x hx => (hf x hx).trans (hf' x hx)⟩ + +theorem HasLogOn.mul (h₁ : HasLogOn X f₁) (h₂ : HasLogOn X f₂) : + HasLogOn X fun x => f₁ x * f₂ x := by + obtain ⟨g₁, hg₁, hf₁⟩ := h₁ + obtain ⟨g₂, hg₂, hf₂⟩ := h₂ + exact ⟨fun x => g₁ x + g₂ x, hg₁.add hg₂, fun x hx => by + simp only [hf₁ x hx, hf₂ x hx, exp_add]⟩ + +theorem HasLogOn.inv (h : HasLogOn X f) : HasLogOn X fun x => (f x)⁻¹ := by + obtain ⟨g, hg, hf⟩ := h + exact ⟨fun x => - g x, hg.neg, fun x hx => by + simp only [hf x hx, exp_neg]⟩ + +theorem HasLogOn.div (h₁ : HasLogOn X f₁) (h₂ : HasLogOn X f₂) : + HasLogOn X fun x => f₁ x / f₂ x := by + simpa [div_eq_mul_inv] using h₁.mul h₂.inv + +theorem HasLogOn.zpow (h : HasLogOn X f) (m : ℤ) : HasLogOn X fun x => f x ^ m := by + obtain ⟨g, hg, hf⟩ := h + refine ⟨fun x => (m : ℂ) * g x, continuousOn_const.mul hg, fun x hx => ?_⟩ + simp only [hf x hx, exp_int_mul] + +theorem hasLogOn_const {c : ℂ} (hc : c ≠ 0) : HasLogOn X fun _ => c := + ⟨fun _ => log c, continuousOn_const, fun _ _ => (exp_log hc).symm⟩ + +/-- A function with values in the slit plane has a logarithm: the principal one. -/ +theorem hasLogOn_of_slitPlane (hf : ContinuousOn f X) (h : ∀ x ∈ X, f x ∈ slitPlane) : + HasLogOn X f := + ⟨fun x => log (f x), hf.clog h, fun x hx => (exp_log (slitPlane_ne_zero (h x hx))).symm⟩ + +/-- A continuous function on a preconnected set with values in $2 \pi i \mathbb{Z}$ is constant. -/ +theorem eq_of_exp_eq_one {g : T → ℂ} (hX : IsPreconnected X) (hg : ContinuousOn g X) + (h : ∀ x ∈ X, exp (g x) = 1) {x y : T} (hx : x ∈ X) (hy : y ∈ X) : g x = g y := by + have hpi : (2 * Real.pi * I : ℂ) ≠ 0 := by simp [Real.pi_ne_zero] + have hint : ∀ x ∈ X, ∃ n : ℤ, g x = n * (2 * Real.pi * I) := fun x hx => + Complex.exp_eq_one_iff.mp (h x hx) + have hre : ContinuousOn (fun x => (g x / (2 * Real.pi * I)).re) X := + Complex.continuous_re.comp_continuousOn (hg.div_const _) + have himg : (fun x => (g x / (2 * Real.pi * I)).re) '' X ⊆ range ((↑) : ℤ → ℝ) := by + rintro _ ⟨x, hx, rfl⟩ + obtain ⟨n, hn⟩ := hint x hx + refine ⟨n, ?_⟩ + change _ = (g x / (2 * Real.pi * I)).re + rw [hn, mul_div_assoc, div_self hpi, mul_one] + simp + have htd : IsTotallyDisconnected (range ((↑) : ℤ → ℝ)) := + Int.isClosedEmbedding_coe_real.isEmbedding.isTotallyDisconnected_range.mpr inferInstance + have hsub := htd _ himg (hX.image _ hre) + have heq := hsub (mem_image_of_mem _ hx) (mem_image_of_mem _ hy) + obtain ⟨n, hn⟩ := hint x hx + obtain ⟨k, hk⟩ := hint y hy + have hdiv : ∀ n : ℤ, ((n : ℂ) * (2 * Real.pi * I) / (2 * Real.pi * I)).re = n := fun n => by + rw [mul_div_assoc, div_self hpi, mul_one] + simp + have heq' : (g x / (2 * Real.pi * I)).re = (g y / (2 * Real.pi * I)).re := heq + rw [hn, hk, hdiv, hdiv, Int.cast_inj] at heq' + have heq := heq' + rw [hn, hk, heq] + +theorem hasLogOn_iff_subtype {K : Set T} {f : T → ℂ} : + HasLogOn K f ↔ ∃ g : C(K, ℂ), ∀ x : K, f x = exp (g x) := by + classical + constructor + · rintro ⟨g, hg, hf⟩ + exact ⟨⟨K.domRestrict g, continuousOn_iff_continuous_domRestrict.mp hg⟩, fun x => hf x x.2⟩ + · rintro ⟨g, hf⟩ + refine ⟨fun x => if h : x ∈ K then g ⟨x, h⟩ else 0, ?_, fun x hx => ?_⟩ + · rw [continuousOn_iff_continuous_domRestrict] + convert g.continuous using 1 + ext x + simp [Set.domRestrict, x.2] + · simp only [hx, dite_true] + exact hf ⟨x, hx⟩ + +end Basic + +section Homotopy + +/-- A homotopy of nonvanishing functions that starts at the constant `1` has a continuous +logarithm that starts at `0`. Route: the homotopy lifting property of the covering +`Complex.isCoveringMap_exp`. -/ +theorem exists_log_of_homotopy {A : Type u} [TopologicalSpace A] (H : C(𝕀 × A, ℂ)) + (h0 : ∀ a, H (0, a) = 1) (hne : ∀ p, H p ≠ 0) : + ∃ g : C(𝕀 × A, ℂ), (∀ p, exp (g p) = H p) ∧ ∀ a, g (0, a) = 0 := by + let H' : C(𝕀 × A, {z : ℂ // z ≠ 0}) := ⟨fun p => ⟨H p, hne p⟩, by fun_prop⟩ + have hH0 : ∀ a, H' (0, a) = (fun z : ℂ => (⟨exp z, exp_ne_zero z⟩ : {z : ℂ // z ≠ 0})) + ((ContinuousMap.const A (0 : ℂ)) a) := by + intro a + apply Subtype.ext + simp [H', h0] + let G := isCoveringMap_exp.liftHomotopy H' (ContinuousMap.const A (0 : ℂ)) hH0 + refine ⟨G, fun p => ?_, fun a => ?_⟩ + · have := congr_fun (isCoveringMap_exp.liftHomotopy_lifts H' (ContinuousMap.const A + (0 : ℂ)) hH0) p + exact congr_arg Subtype.val this + · exact isCoveringMap_exp.liftHomotopy_zero H' (ContinuousMap.const A (0 : ℂ)) hH0 a + +variable {T : Type u} [TopologicalSpace T] + +/-- If `H` is a homotopy of nonvanishing functions on `K` from the constant `1` to `f`, then `f` +has a logarithm on `K`. -/ +theorem hasLogOn_of_homotopy {K : Set T} (H : 𝕀 → T → ℂ) + (hc : ContinuousOn (fun p : 𝕀 × T => H p.1 p.2) (univ ×ˢ K)) + (h0 : ∀ x ∈ K, H 0 x = 1) (hne : ∀ t, ∀ x ∈ K, H t x ≠ 0) : + HasLogOn K (H 1) := by + rw [hasLogOn_iff_subtype] + let H' : C(𝕀 × K, ℂ) := ⟨fun p => H p.1 p.2.1, by + have : Continuous (fun p : 𝕀 × K => ((p.1, p.2.1) : 𝕀 × T)) := by fun_prop + exact hc.comp_continuous this fun p => ⟨mem_univ _, p.2.2⟩⟩ + obtain ⟨g, hg, -⟩ := exists_log_of_homotopy H' (fun a => h0 a a.2) + (fun p => hne p.1 p.2 p.2.2) + exact ⟨⟨fun x => g (1, x), by fun_prop⟩, fun x => (hg (1, x)).symm⟩ + +/-- A nonvanishing continuous function on a real vector space has a logarithm: contract the space +to the origin. -/ +theorem hasLogOn_univ_of_ne_zero {E : Type u} [NormedAddCommGroup E] [NormedSpace ℝ E] + {f : E → ℂ} (hf : Continuous f) (hne : ∀ x, f x ≠ 0) : HasLogOn univ f := by + have h := hasLogOn_of_homotopy (K := (univ : Set E)) + (fun t x => f ((t : ℝ) • x) / f 0) + (by apply Continuous.continuousOn; fun_prop) + (fun x _ => by simp [hne 0]) (fun t x _ => div_ne_zero (hne _) (hne 0)) + have h2 := h.mul (hasLogOn_const (hne 0)) + refine h2.congr fun x _ => ?_ + simp [hne 0] + +/-- Every nonvanishing continuous function on the unit interval has a logarithm. -/ +theorem hasLogOn_unitInterval {f : 𝕀 → ℂ} (hf : Continuous f) (hne : ∀ t, f t ≠ 0) : + HasLogOn (univ : Set 𝕀) f := by + have h := hasLogOn_of_homotopy (K := (univ : Set 𝕀)) + (fun t x => f (⟨(t : ℝ) * x, unitInterval.mul_mem t.2 x.2⟩ : 𝕀) / f 0) + (by apply Continuous.continuousOn; fun_prop) + (fun x _ => by simp [hne 0]) (fun t x _ => div_ne_zero (hne _) (hne 0)) + have h2 := h.mul (hasLogOn_const (hne 0)) + refine h2.congr fun x _ => ?_ + simp [hne 0] + +/-- A nonvanishing continuous function has a logarithm on any homeomorphic image of the unit +interval. -/ +theorem hasLogOn_of_arc {L : Set T} (φ : 𝕀 ≃ₜ L) {f : T → ℂ} (hf : ContinuousOn f L) + (hne : ∀ x ∈ L, f x ≠ 0) : HasLogOn L f := by + have hcont : Continuous fun t : 𝕀 => f (φ t).1 := + hf.comp_continuous (by fun_prop) fun t => (φ t).2 + obtain ⟨g, hg, hfg⟩ := hasLogOn_unitInterval hcont fun t => hne _ (φ t).2 + rw [hasLogOn_iff_subtype] + refine ⟨⟨fun x => g (φ.symm x), ?_⟩, fun x => ?_⟩ + · exact (continuousOn_univ.mp hg).comp φ.symm.continuous + · have := hfg (φ.symm x) (mem_univ _) + simpa using this + +/-- A logarithm of `f ∘ g` on a compact set `K`, with `g` injective on `K`, gives a logarithm of `f` +on the image of `K`. -/ +theorem hasLogOn_image {T' : Type*} [TopologicalSpace T'] [T2Space T'] {K : Set T} + (hK : IsCompact K) + {g : T → T'} (hg : ContinuousOn g K) (hinj : InjOn g K) {f : T' → ℂ} + (h : HasLogOn K fun x => f (g x)) : HasLogOn (g '' K) f := by + have : CompactSpace K := isCompact_iff_compactSpace.mp hK + let e₀ : K ≃ g '' K := Equiv.Set.imageOfInjOn g K hinj + have he₀ : Continuous e₀ := + (continuousOn_iff_continuous_domRestrict.mp hg).subtype_mk _ + let e : K ≃ₜ g '' K := he₀.homeoOfEquivCompactToT2 + obtain ⟨l, hl⟩ := hasLogOn_iff_subtype.mp h + rw [hasLogOn_iff_subtype] + refine ⟨⟨fun y => l (e.symm y), by fun_prop⟩, fun y => ?_⟩ + have h1 := hl (e.symm y) + have h2 : g (e.symm y).1 = y.1 := congr_arg Subtype.val (e.apply_symm_apply y) + rw [← h2] + exact h1 + +end Homotopy + +section Circle + +/-- The function $(z - a)^m$ has no logarithm on a circle around `a`, unless `m = 0`. Going once +around the circle would change the logarithm by $2 \pi i m$. -/ +theorem eq_zero_of_hasLogOn_sphere {a : ℂ} {R : ℝ} (hR : 0 < R) {m : ℤ} + (h : HasLogOn (Metric.sphere a R) fun z => (z - a) ^ m) : m = 0 := by + obtain ⟨g, hg, hf⟩ := h + let c : ℝ → ℂ := fun t => a + R * exp (t * I) + have hc : Continuous c := by fun_prop + have hmem : ∀ t, c t ∈ Metric.sphere a R := fun t => by + simp only [Metric.mem_sphere, dist_eq_norm, c, add_sub_cancel_left, norm_mul, norm_real, + norm_exp_ofReal_mul_I, mul_one, Real.norm_eq_abs, abs_of_pos hR] + let k : ℝ → ℂ := fun t => g (c t) - m * (t * I) - m * log R + have hk : Continuous k := by + have : Continuous fun t => g (c t) := hg.comp_continuous hc hmem + exact (this.sub (continuous_const.mul (continuous_ofReal.mul continuous_const))).sub + continuous_const + have hR' : (R : ℂ) ≠ 0 := by exact_mod_cast hR.ne' + have hexp : ∀ t ∈ (univ : Set ℝ), exp (k t) = 1 := by + intro t _ + have h1 : (c t - a) ^ m = _ := hf (c t) (hmem t) + have h2 : c t - a = R * exp (t * I) := by simp [c] + rw [h2, mul_zpow] at h1 + have h3 : exp (m * (t * I)) = exp (t * I) ^ m := exp_int_mul _ _ + have h4 : exp (m * log R) = (R : ℂ) ^ m := by rw [exp_int_mul, exp_log hR'] + simp only [k] + rw [exp_sub, exp_sub, ← h1, h3, h4] + have h5 : exp (t * I) ≠ 0 := exp_ne_zero _ + have h6 : (R : ℂ) ^ m ≠ 0 := zpow_ne_zero _ hR' + have h7 : exp (t * I) ^ m ≠ 0 := zpow_ne_zero _ h5 + field_simp + have heq := eq_of_exp_eq_one isPreconnected_univ hk.continuousOn hexp + (mem_univ (2 * Real.pi)) (mem_univ 0) + have hc2 : c (2 * Real.pi) = c 0 := by + simp only [c] + push_cast + rw [exp_two_pi_mul_I] + simp + simp only [k, hc2] at heq + have hpi : (2 * Real.pi * I : ℂ) ≠ 0 := by simp [Real.pi_ne_zero] + have : (m : ℂ) * (2 * Real.pi * I) = 0 := by + push_cast at heq + linear_combination -heq + have hm : (m : ℂ) = 0 := (mul_eq_zero.mp this).resolve_right hpi + exact_mod_cast hm + +end Circle + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/PlaneOrientation.lean b/LeanPool/GraphMinor/Surface/PlaneOrientation.lean new file mode 100644 index 0000000000..8afea341ae --- /dev/null +++ b/LeanPool/GraphMinor/Surface/PlaneOrientation.lean @@ -0,0 +1,886 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CircleOrder + +public import LeanPool.GraphMinor.GM19.Winding +public import LeanPool.GraphMinor.Surface.Cap +public import LeanPool.GraphMinor.Surface.OpenDisc +public import LeanPool.GraphMinor.Surface.PlaneDisc + +/-! +# The orientation of the plane + +We orient the plane. The direction of the boundary of a closed disc `Δ` is the one that turns +positively around the points inside `Δ`. + +By the Schoenflies theorem a parametrization of `bd(Δ)` extends to a homeomorphism `G` of the plane. +If the boundary did not turn around +`G 0`, then it would be null-homotopic off `G 0`, and `G⁻¹` would make the unit circle +null-homotopic off `0`, which it is not +(`wind_ne_zero`). + +The heart is `wind_eq_of_nested`. Let `Δ₁ ⊆ Δ₂` be discs and let `a, b, c` be common boundary +points. Take `z` inside `Δ₁`. The arc of +`bd(Δ₁)` from `a` to `b` and the arc of `bd(Δ₂)` from `a` to `b` miss `c`. So they miss a path from +`z` to `c` inside `Δ₁`, followed by a +path from `c` to a far point outside `Δ₂`. Hence the two arcs turn equally around `z`, and adding up +the three pairs of arcs shows that +the two boundaries turn equally around `z`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Metric Topology Filter GraphMinor.GM19 + +theorem isManifoldPoint_complex (x : ℂ) : IsManifoldPoint x := by + obtain ⟨e⟩ := exists_homeomorph_ball x one_pos + have : IsInteriorPoint x := ⟨ball x 1, isOpen_ball, mem_ball_self one_pos, ⟨e⟩⟩ + exact this.isManifoldPoint + +/-! ### Cyclic order on the circle -/ + +/-- The positive cyclic order of three points of the circle: going around from `a` in the positive +direction, we reach `b` before `c`, and both before coming back to `a`. -/ +abbrev CircleCyclic (a b c : Circle) : Prop := CircleOrder.CircleCyclic a b c + +/-- Each point of the circle other than `1` has an angle strictly between `0` and `2π`. -/ +theorem exists_angle {z : Circle} (hz : z ≠ 1) : + ∃ s : ℝ, 0 < s ∧ s < 2 * Real.pi ∧ z = Circle.exp s := + CircleOrder.exists_angle hz + +/-- Three distinct points of the circle occur in one of the two cyclic orders. -/ +theorem circleCyclic_or {a b c : Circle} (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) : + CircleCyclic a b c ∨ CircleCyclic a c b := + CircleOrder.circleCyclic_or hab hac hbc + +theorem exp_eq_of_angles {s t : ℝ} (hs : 0 < s) (hs' : s < 2 * Real.pi) (ht : 0 < t) + (ht' : t < 2 * Real.pi) (h : Circle.exp s = Circle.exp t) : s = t := + CircleOrder.exp_eq_of_angles hs hs' ht ht' h + +/-- Three points of the circle do not lie in both cyclic orders. -/ +theorem not_circleCyclic_both {a b c : Circle} (h : CircleCyclic a b c) + (h' : CircleCyclic a c b) : False := + CircleOrder.not_circleCyclic_both h h' + +theorem circleCyclic_inv {a b c : Circle} (h : CircleCyclic a b c) : + CircleCyclic a⁻¹ c⁻¹ b⁻¹ := + CircleOrder.circleCyclic_inv h + +theorem exists_angle_of_circle (a : Circle) : ∃ α : ℝ, a = Circle.exp α := + CircleOrder.exists_angle_of_circle a + +theorem circleCyclic_exp_of_lt {t₁ t₂ t₃ : ℝ} (h12 : t₁ < t₂) (h23 : t₂ < t₃) + (h31 : t₃ < t₁ + 2 * Real.pi) : + CircleCyclic (Circle.exp t₁) (Circle.exp t₂) (Circle.exp t₃) := by + refine ⟨t₂ - t₁, t₃ - t₁, by linarith, by linarith, by linarith, ?_, ?_⟩ + · rw [← Circle.exp_add, add_sub_cancel] + · rw [← Circle.exp_add, add_sub_cancel] + +/-! ### Winding and positive parametrizations in `ℂ` -/ + +/-- How far a parametrized closed curve turns around `z`. -/ +noncomputable def wind (φ : Circle → ℂ) (z : ℂ) : ℝ := + turn (fun t => φ (Circle.exp t) - z) 0 (2 * Real.pi) + +theorem exp_add_two_pi' (t : ℝ) : Circle.exp (t + 2 * Real.pi) = Circle.exp t := exp_add_two_pi t + +theorem isAngle_exp : IsAngle (fun t => ((Circle.exp t : Circle) : ℂ)) fun t => t := by + refine ⟨continuous_id, fun t => ?_⟩ + change ((Circle.exp t : Circle) : ℂ) = _ + rw [Circle.norm_coe, Circle.coe_exp] + simp + +/-- A curve with period `P` turns equally over each period. -/ +theorem turn_period {g : ℝ → ℂ} (hg : Continuous g) (h0 : ∀ t, g t ≠ 0) {P : ℝ} + (hP : ∀ t, g (t + P) = g t) (s t : ℝ) : + turn g s (s + P) = turn g t (t + P) := by + obtain ⟨L, hL⟩ := exists_isAngle hg h0 + have hc : Continuous fun x => x + P := by fun_prop + have h1 : IsAngle g fun x => L (x + P) := by + have := hL.comp hc + simpa only [hP] using this + have := h1.diff hL h0 s t + rw [hL.turn_eq h0, hL.turn_eq h0] + linarith + +theorem circle_exp_ne {x y : ℝ} (h0 : x ≠ y) (h : |x - y| < 2 * Real.pi) : + Circle.exp x ≠ Circle.exp y := fun he => by + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp he + have hpi := Real.pi_pos + have h1 : x - y = m * (2 * Real.pi) := by rw [hm]; ring + rw [h1, abs_mul, abs_of_pos (by positivity : 0 < 2 * Real.pi)] at h + have h2 : |(m : ℝ)| < 1 := by nlinarith + have h3 : m = 0 := by + have : |m| < 1 := by exact_mod_cast h2 + exact Int.abs_lt_one_iff.mp this + apply h0 + rw [h3] at h1 + simpa [sub_eq_zero] using h1 + +/-- A parametrization of the boundary of a plane disc extends to a homeomorphism of the plane. -/ +theorem exists_plane_extension {Δ : Set ℂ} (hΔ : IsClosedDisc Δ) {φ : Circle → ℂ} + (hc : Continuous φ) (hi : Function.Injective φ) (hr : range φ = discBd Δ) : + ∃ G : ℂ ≃ₜ ℂ, (∀ w : Circle, G w = φ w) ∧ G '' closedBall 0 1 = Δ := by + classical + let f : Circle → discBd Δ := fun w => ⟨φ w, by rw [← hr]; exact mem_range_self w⟩ + have hfb : Function.Bijective f := ⟨fun a b h => hi (congrArg Subtype.val h), fun x => by + obtain ⟨w, hw⟩ : x.1 ∈ range φ := by rw [hr]; exact x.2 + exact ⟨w, Subtype.ext hw⟩⟩ + have hfc : Continuous f := hc.subtype_mk _ + let ψ : Circle ≃ₜ discBd Δ := hfc.homeoOfEquivCompactToT2 (f := Equiv.ofBijective f hfb) + have hmem : ∀ w : Circle, (w : ℂ) ∈ sphere (0 : ℂ) 1 := fun w => by simp + have hm' : ∀ x : sphere (0 : ℂ) 1, x.1 ∈ Submonoid.unitSphere ℂ := fun x => x.2 + let ρ : Circle ≃ₜ sphere (0 : ℂ) 1 := + { toFun := fun w => ⟨w, hmem w⟩ + invFun := fun x => ⟨x.1, hm' x⟩ + left_inv := fun w => rfl + right_inv := fun x => rfl + continuous_toFun := (continuous_induced_dom).subtype_mk _ + continuous_invFun := continuous_induced_rng.mpr continuous_subtype_val } + obtain ⟨h, k, m, hh⟩ := exists_bdMatch (ρ.symm.trans ψ) + obtain ⟨Ψ, hΨ, hin⟩ := exists_plane_homeomorph ⟨ρ⟩ ⟨ψ⟩ m + refine ⟨Ψ, fun w => ?_, ?_⟩ + · rw [hΨ (hmem w)] + exact hh (ρ w) + · rw [eq_closedInner_of_discBd ⟨ρ⟩ isClosedDisc_closedBall.1 isClosedDisc_closedBall.2, hin] + exact (eq_closedInner_of_discBd ⟨ψ⟩ hΔ rfl).symm + +/-- The boundary of a closed disc turns around the centre. -/ +theorem wind_ne_zero (G : ℂ ≃ₜ ℂ) : wind (fun w : Circle => G w) (G 0) ≠ 0 := by + intro hw + have hpi : 0 < 2 * Real.pi := by positivity + let g : ℝ → ℂ := fun t => G (Circle.exp t) - G 0 + have hcoe : Continuous fun t : ℝ => ((Circle.exp t : Circle) : ℂ) := + continuous_induced_dom.comp Circle.exp.continuous + have hg : Continuous g := (G.continuous.comp hcoe).sub continuous_const + have h0 : ∀ t, g t ≠ 0 := fun t => sub_ne_zero.mpr fun h => by + have := G.injective h + have h2 : ‖((Circle.exp t : Circle) : ℂ)‖ = 1 := Circle.norm_coe _ + rw [this, norm_zero] at h2 + exact zero_ne_one h2 + have hP : ∀ t, g (t + 2 * Real.pi) = g t := fun t => by simp only [g, exp_add_two_pi] + obtain ⟨L, hL⟩ := exists_isAngle hg h0 + have hw' : L (2 * Real.pi) = L 0 := by + have : turn g 0 (2 * Real.pi) = 0 := hw + rw [hL.turn_eq h0] at this + linarith + have hLP : ∀ t, L (t + 2 * Real.pi) = L t := fun t => by + have hc : Continuous fun x : ℝ => x + 2 * Real.pi := by fun_prop + have h1 : IsAngle g fun x => L (x + 2 * Real.pi) := by + have := hL.comp hc + simpa only [hP] using this + have := h1.diff hL h0 0 t + rw [zero_add, hw'] at this + linarith + let cl : ℝ → ℝ := fun u => max 0 (min u 1) + have hcl : Continuous cl := by fun_prop + let X : ℝ → ℝ → ℂ := fun u t => + Complex.exp (((1 - cl u : ℝ) : ℂ) * (((Real.log ‖g t‖ : ℝ) : ℂ) + (L t : ℂ) * Complex.I)) + let H : ℝ → ℝ → ℂ := fun u t => G.symm (G 0 + X u t) + have hlog : Continuous fun t => Real.log ‖g t‖ := hg.norm.log fun t => norm_ne_zero_iff.mpr (h0 t) + have hX : Continuous fun q : ℝ × ℝ => X q.1 q.2 := by + have h1 : Continuous fun q : ℝ × ℝ => Real.log ‖g q.2‖ := hlog.comp continuous_snd + have h2 : Continuous fun q : ℝ × ℝ => L q.2 := hL.1.comp continuous_snd + have h3 : Continuous fun q : ℝ × ℝ => cl q.1 := hcl.comp continuous_fst + refine Complex.continuous_exp.comp ?_ + exact (Complex.continuous_ofReal.comp (continuous_const.sub h3)).mul + ((Complex.continuous_ofReal.comp h1).add ((Complex.continuous_ofReal.comp h2).mul + continuous_const)) + have hH : Continuous fun q : ℝ × ℝ => H q.1 q.2 := G.symm.continuous.comp + (continuous_const.add hX) + have hne : ∀ u t, H u t ≠ 0 := fun u t h => by + have h1 := (G.symm_apply_eq).mp h + exact Complex.exp_ne_zero _ (add_eq_left.mp h1) + have hper : ∀ u, Function.Periodic (H u) (2 * Real.pi) := fun u t => by + simp only [H, X, hLP, hP] + have hv : ∀ t, ∃ t' ∈ Icc 0 (2 * Real.pi), ∀ u, H u t = H u t' := fun t => by + have ho := toIcoMod_mem_Ico hpi 0 t + rw [zero_add] at ho + refine ⟨toIcoMod hpi 0 t, Ico_subset_Icc_self ho, fun u => ?_⟩ + rw [← self_sub_toIcoDiv_zsmul] + exact ((hper u).sub_zsmul_eq _).symm + have hhom := turn_eq_of_homotopy hH hne isCompact_Icc hv (s := 0) (t := 2 * Real.pi) (fun u => by + have := hper u 0 + rw [zero_add] at this + exact this.symm) 0 1 + have hH0 : H 0 = fun t => ((Circle.exp t : Circle) : ℂ) := by + funext t + have hc0 : cl 0 = 0 := by simp [cl] + have hn : ((‖g t‖ : ℝ) : ℂ) ≠ 0 := Complex.ofReal_ne_zero.mpr (norm_ne_zero_iff.mpr (h0 t)) + have hX0 : X 0 t = g t := by + simp only [X, hc0, sub_zero, Complex.ofReal_one, one_mul] + rw [Complex.exp_add, ← Complex.ofReal_exp, Real.exp_log (norm_pos_iff.mpr (h0 t))] + exact (hL.2 t).symm + change G.symm (G 0 + X 0 t) = _ + rw [hX0] + simp only [g, add_sub_cancel, Homeomorph.symm_apply_apply] + have hH1 : H 1 = fun _ => G.symm (G 0 + 1) := by + funext t + have hc1 : cl 1 = 1 := by simp [cl] + change G.symm (G 0 + X 1 t) = _ + simp only [X, hc1, sub_self, Complex.ofReal_zero, zero_mul, Complex.exp_zero] + rw [hH0, hH1, isAngle_exp.turn_eq (fun t => Circle.coe_ne_zero _)] at hhom + have hc : G.symm (G 0 + 1) ≠ 0 := fun h => by + have h1 := (G.symm_apply_eq).mp h + exact one_ne_zero (add_eq_left.mp h1) + obtain ⟨α, hα⟩ := isAngle_const hc + rw [hα.turn_eq (fun _ => hc)] at hhom + simp only [sub_self, sub_zero] at hhom + exact hpi.ne' hhom + +/-- Going around backwards turns the other way. -/ +theorem wind_inv {φ : Circle → ℂ} (hc : Continuous φ) {z : ℂ} (h0 : ∀ w, φ w ≠ z) : + wind (fun w => φ w⁻¹) z = - wind φ z := by + have hcoe : Continuous fun t : ℝ => Circle.exp t := Circle.exp.continuous + let g : ℝ → ℂ := fun t => φ (Circle.exp t) - z + have hg : Continuous g := (hc.comp hcoe).sub continuous_const + have hg0 : ∀ t, g t ≠ 0 := fun t => sub_ne_zero.mpr (h0 _) + have h1 : wind (fun w => φ w⁻¹) z = turn (fun t => g (-t)) 0 (2 * Real.pi) := by + simp only [wind, g, Circle.exp_neg] + rw [h1, turn_comp hg hg0 continuous_neg, wind] + have hP : ∀ t, g (t + 2 * Real.pi) = g t := fun t => by simp only [g, exp_add_two_pi] + have h2 := turn_period hg hg0 hP (-(2 * Real.pi)) 0 + have h3 := turn_add hg hg0 (-(2 * Real.pi)) 0 (-(2 * Real.pi)) + rw [turn_self hg hg0] at h3 + simp only [neg_zero] + have h4 : -(2 * Real.pi) + 2 * Real.pi = 0 := by ring + rw [h4, zero_add] at h2 + change turn g 0 (-(2 * Real.pi)) = - turn g 0 (2 * Real.pi) + linarith + +theorem exists_mem_period (t : ℝ) : + ∃ t' ∈ Icc 0 (2 * Real.pi), ∃ n : ℤ, t' = t - n • (2 * Real.pi) := by + have hpi : 0 < 2 * Real.pi := by positivity + have ho := toIcoMod_mem_Ico hpi 0 t + rw [zero_add] at ho + exact ⟨toIcoMod hpi 0 t, Ico_subset_Icc_self ho, _, (self_sub_toIcoDiv_zsmul hpi 0 t).symm⟩ + +/-- The boundary turns equally around any two points inside. -/ +theorem wind_eq_of_ball (G : ℂ ≃ₜ ℂ) {φ : Circle → ℂ} (hc : Continuous φ) + (hG : ∀ w : Circle, G w = φ w) {a b : ℂ} (ha : a ∈ ball (0 : ℂ) 1) (hb : b ∈ ball (0 : ℂ) 1) : + wind φ (G a) = wind φ (G b) := by + let cl : ℝ → ℝ := fun u => max 0 (min u 1) + have hcl : Continuous cl := by fun_prop + have hcl' : ∀ u, cl u ∈ Icc (0 : ℝ) 1 := + fun u => ⟨le_max_left _ _, max_le zero_le_one (min_le_right _ _)⟩ + let l : ℝ → ℂ := fun u => a + ((cl u : ℝ) : ℂ) * (b - a) + have hl : Continuous l := + continuous_const.add ((Complex.continuous_ofReal.comp hcl).mul continuous_const) + have hlin : ∀ u, l u ∈ ball (0 : ℂ) 1 := fun u => by + have h := (convex_ball (0 : ℂ) 1).add_smul_sub_mem ha hb (hcl' u) + rwa [Complex.real_smul] at h + have hcoe : Continuous fun t : ℝ => Circle.exp t := Circle.exp.continuous + let H : ℝ → ℝ → ℂ := fun u t => φ (Circle.exp t) - G (l u) + have hH : Continuous fun q : ℝ × ℝ => H q.1 q.2 := + (hc.comp (hcoe.comp continuous_snd)).sub (G.continuous.comp (hl.comp continuous_fst)) + have hne : ∀ u t, H u t ≠ 0 := fun u t h => by + have h1 := sub_eq_zero.mp h + rw [← hG] at h1 + have h2 := G.injective h1 + have h3 := hlin u + rw [← h2, mem_ball_zero_iff, Circle.norm_coe] at h3 + exact lt_irrefl _ h3 + have hper : ∀ u, Function.Periodic (H u) (2 * Real.pi) := fun u t => by + simp only [H, exp_add_two_pi] + have hv : ∀ t, ∃ t' ∈ Icc 0 (2 * Real.pi), ∀ u, H u t = H u t' := fun t => by + obtain ⟨t', ht', n, rfl⟩ := exists_mem_period t + exact ⟨_, ht', fun u => ((hper u).sub_zsmul_eq n).symm⟩ + have hhom := turn_eq_of_homotopy hH hne isCompact_Icc hv (s := 0) (t := 2 * Real.pi) (fun u => by + have := hper u 0 + rw [zero_add] at this + exact this.symm) 0 1 + have h0 : l 0 = a := by simp [l, cl] + have h1 : l 1 = b := by simp [l, cl] + simp only [H, h0, h1] at hhom + exact hhom + +/-- Two arcs in `Δ₂`, off the inside of `Δ₁`, with the same ends and missing the common boundary +point `x`, turn equally around the centre of `Δ₁`. -/ +theorem turn_eq_of_nested {Δ₂ : Set ℂ} (hΔ₂ : IsClosedDisc Δ₂) (G₁ G₂ : ℂ ≃ₜ ℂ) + (hG₂ : G₂ '' closedBall 0 1 = Δ₂) {x₁ x₂ : Circle} (hx : G₁ x₁ = G₂ x₂) + {g k : ℝ → ℂ} (hg : Continuous g) (hk : Continuous k) {a b c d : ℝ} (hab : a ≤ b) + (hcd : c ≤ d) (hs : g a = k c) (he : g b = k d) + (hgb : ∀ t, g t ∉ G₁ '' ball 0 1) (hkb : ∀ t, k t ∉ G₁ '' ball 0 1) + (hg₂ : ∀ t, g t ∈ Δ₂) (hk₂ : ∀ t, k t ∈ Δ₂) + (hgx : ∀ t ∈ Icc a b, g t ≠ G₁ x₁) (hkx : ∀ t ∈ Icc c d, k t ≠ G₁ x₁) : + turn (fun t => g t - G₁ 0) a b = turn (fun t => k t - G₁ 0) c d := by + obtain ⟨M, hM⟩ := hΔ₂.isCompact.isBounded.exists_norm_le + obtain ⟨R, hR⟩ := + ((isCompact_closedBall (0 : ℂ) M).image G₂.symm.continuous).isBounded.exists_norm_le + have hx₁ : ‖(x₁ : ℂ)‖ = 1 := Circle.norm_coe _ + have hx₂ : ‖(x₂ : ℂ)‖ = 1 := Circle.norm_coe _ + let R' : ℝ := max R 1 + 1 + have hR1 : 1 < R' := by have := le_max_right R 1; simp only [R']; linarith + let cl : ℝ → ℝ := fun u => max 0 (min u 1) + have hcl : Continuous cl := by fun_prop + have hcl' : ∀ u, cl u ∈ Icc (0 : ℝ) 1 := + fun u => ⟨le_max_left _ _, max_le zero_le_one (min_le_right _ _)⟩ + have hcl0 : cl 0 = 0 := by simp [cl] + have hcl1 : cl 1 = 1 := by simp [cl] + let p₁ : ℝ → ℂ := fun u => G₁ (((cl (2 * u) : ℝ) : ℂ) * x₁) + let p₂ : ℝ → ℂ := fun u => G₂ (((1 + cl (2 * u - 1) * (R' - 1) : ℝ) : ℂ) * x₂) + have hp₁ : Continuous p₁ := by + refine G₁.continuous.comp + (Continuous.mul (Complex.continuous_ofReal.comp (hcl.comp (by fun_prop))) continuous_const) + have hp₂ : Continuous p₂ := by + refine G₂.continuous.comp (Continuous.mul (Complex.continuous_ofReal.comp ?_) continuous_const) + exact continuous_const.add ((hcl.comp (by fun_prop)).mul continuous_const) + let p : ℝ → ℂ := fun u => if u ≤ 1 / 2 then p₁ u else p₂ u + have hp : Continuous p := Continuous.if_le hp₁ hp₂ continuous_id continuous_const fun u hu => by + have h1 : u = 1 / 2 := hu + subst h1 + simp only [p₁, p₂] + have e1 : (2 : ℝ) * (1 / 2) = 1 := by norm_num + have e2 : (1 : ℝ) - 1 = 0 := by norm_num + rw [e1, e2, hcl0, hcl1, zero_mul, add_zero] + simpa using hx + have hp0 : p 0 = G₁ 0 := by + simp only [p, p₁] + rw [ite_eq_left (by norm_num), mul_zero, hcl0] + simp + have hp1 : p 1 = G₂ ((R' : ℂ) * x₂) := by + simp only [p, p₂] + rw [ite_eq_right (by norm_num)] + have e1 : (2 : ℝ) * 1 - 1 = 1 := by norm_num + rw [e1, hcl1] + congr 3 + ring + have hfar : M < ‖p 1‖ := by + by_contra hn + have h1 : p 1 ∈ closedBall (0 : ℂ) M := mem_closedBall_zero_iff.mpr (not_lt.mp hn) + have h2 := hR _ (mem_image_of_mem G₂.symm h1) + rw [hp1, Homeomorph.symm_apply_apply, norm_mul, Complex.norm_real, hx₂, mul_one, + Real.norm_of_nonneg (by linarith)] at h2 + have := le_max_left R 1 + simp only [R'] at h2 + linarith + have havoid : ∀ {y : ℂ}, y ∉ G₁ '' ball 0 1 → y ∈ Δ₂ → y ≠ G₁ x₁ → ∀ u, y ≠ p u := by + intro y hy1 hy2 hy3 u he + by_cases hu : u ≤ 1 / 2 + · have e : p u = G₁ (((cl (2 * u) : ℝ) : ℂ) * x₁) := ite_eq_left hu + rw [e] at he + rcases (hcl' (2 * u)).2.lt_or_eq with h | h + · refine hy1 ⟨_, ?_, he.symm⟩ + rw [mem_ball_zero_iff, norm_mul, Complex.norm_real, hx₁, mul_one, + Real.norm_of_nonneg (hcl' _).1] + exact h + · rw [h] at he + exact hy3 (by simpa using he) + · have e : p u = G₂ (((1 + cl (2 * u - 1) * (R' - 1) : ℝ) : ℂ) * x₂) := ite_eq_right hu + rw [e] at he + have hc0 := (hcl' (2 * u - 1)).1 + rcases hc0.eq_or_lt with h | h + · rw [← h, zero_mul, add_zero] at he + apply hy3 + rw [he, hx] + simp + · rw [← hG₂] at hy2 + obtain ⟨w, hw, hwe⟩ := hy2 + have := G₂.injective (hwe.trans he) + rw [this, mem_closedBall_zero_iff, norm_mul, Complex.norm_real, hx₂, mul_one, + Real.norm_of_nonneg (by nlinarith)] at hw + nlinarith + have hne0 : ∀ {y : ℂ}, y ∉ G₁ '' ball 0 1 → y ≠ G₁ 0 := fun hy he => hy ⟨0, by simp, he.symm⟩ + have := turn_eq_of_path hg hk hab hcd hs he hp (fun t => by rw [hp0]; exact hne0 (hgb t)) + (fun t => by rw [hp0]; exact hne0 (hkb t)) + (fun u t ht => havoid (hgb t) (hg₂ t) (hgx t ht) u) + (fun u t ht => havoid (hkb t) (hk₂ t) (hkx t ht) u) + (fun t _ => lt_of_le_of_lt (hM _ (hg₂ t)) hfar) + (fun t _ => lt_of_le_of_lt (hM _ (hk₂ t)) hfar) + rwa [hp0] at this + +theorem image_sphere_of_extension (G : ℂ ≃ₜ ℂ) {φ : Circle → ℂ} (hG : ∀ w : Circle, G w = φ w) : + G '' sphere 0 1 = range φ := by + ext y + constructor + · rintro ⟨z, hz, rfl⟩ + have hm : z ∈ Submonoid.unitSphere ℂ := hz + exact ⟨⟨z, hm⟩, (hG _).symm⟩ + · rintro ⟨w, rfl⟩ + exact ⟨w, by simp, hG w⟩ + +/-- The inside of a plane disc is the image of the open ball. -/ +theorem discInt_eq_of_extension {Δ : Set ℂ} (G : ℂ ≃ₜ ℂ) {φ : Circle → ℂ} + (hG : ∀ w : Circle, G w = φ w) (hr : range φ = discBd Δ) (hΔ : G '' closedBall 0 1 = Δ) : + discInt Δ = G '' ball 0 1 := by + have hb : discBd Δ = G '' sphere 0 1 := by rw [← hr, image_sphere_of_extension G hG] + rw [discInt, hb, ← hΔ, ← image_sdiff G.injective] + congr 1 + ext z + simp only [Set.mem_sdiff, mem_closedBall_zero_iff, mem_sphere_zero_iff_norm, mem_ball_zero_iff] + exact ⟨fun h => lt_of_le_of_ne h.1 h.2, fun h => ⟨h.le, h.ne⟩⟩ + +/-- The turning of a closed curve does not depend on where it starts. -/ +theorem wind_eq_turn_rotate {φ : Circle → ℂ} (hc : Continuous φ) {z : ℂ} (h0 : ∀ w, φ w ≠ z) + (u : Circle) : wind φ z = turn (fun t => φ (u * Circle.exp t) - z) 0 (2 * Real.pi) := by + obtain ⟨α, rfl⟩ := exists_angle_of_circle u + have hcoe : Continuous fun t : ℝ => Circle.exp t := Circle.exp.continuous + let g : ℝ → ℂ := fun t => φ (Circle.exp t) - z + have hg : Continuous g := (hc.comp hcoe).sub continuous_const + have hg0 : ∀ t, g t ≠ 0 := fun t => sub_ne_zero.mpr (h0 _) + have h1 : (fun t => φ (Circle.exp α * Circle.exp t) - z) = fun t => g (α + t) := by + funext t + simp only [g, Circle.exp_add] + rw [h1, turn_comp hg hg0 (by fun_prop), wind, add_zero] + have hP : ∀ t, g (t + 2 * Real.pi) = g t := fun t => by simp only [g, exp_add_two_pi] + have := turn_period hg hg0 hP 0 α + rwa [zero_add] at this + +/-- **Nested discs.** Two nested plane discs with three common boundary points in the same cyclic +order have boundaries that turn equally around the centre of the smaller disc. -/ +theorem wind_eq_of_nested {Δ₁ Δ₂ : Set ℂ} (hΔ₁ : IsClosedDisc Δ₁) (hΔ₂ : IsClosedDisc Δ₂) + (hsub : Δ₁ ⊆ Δ₂) {φ₁ φ₂ : Circle → ℂ} (hc₁ : Continuous φ₁) (hc₂ : Continuous φ₂) + (hr₁ : range φ₁ = discBd Δ₁) (hr₂ : range φ₂ = discBd Δ₂) (G₁ G₂ : ℂ ≃ₜ ℂ) + (hG₁ : ∀ w : Circle, G₁ w = φ₁ w) (hG₂ : ∀ w : Circle, G₂ w = φ₂ w) + (hD₁ : G₁ '' closedBall 0 1 = Δ₁) (hD₂ : G₂ '' closedBall 0 1 = Δ₂) + {u₁ u₂ : Circle} {s₁ t₁ s₂ t₂ : ℝ} (hs₁ : 0 < s₁) (hst₁ : s₁ < t₁) (ht₁ : t₁ < 2 * Real.pi) + (hs₂ : 0 < s₂) (hst₂ : s₂ < t₂) (ht₂ : t₂ < 2 * Real.pi) + (ha : φ₁ u₁ = φ₂ u₂) (hb : φ₁ (u₁ * Circle.exp s₁) = φ₂ (u₂ * Circle.exp s₂)) + (hc : φ₁ (u₁ * Circle.exp t₁) = φ₂ (u₂ * Circle.exp t₂)) : + wind φ₁ (G₁ 0) = wind φ₂ (G₁ 0) := by + have hpi : 0 < 2 * Real.pi := by positivity + have hcoe : Continuous fun t : ℝ => Circle.exp t := Circle.exp.continuous + have hint₁ := discInt_eq_of_extension G₁ hG₁ hr₁ hD₁ + have hint₂ := discInt_eq_of_extension G₂ hG₂ hr₂ hD₂ + have hmono : discInt Δ₁ ⊆ discInt Δ₂ := discInt_mono isManifoldPoint_complex hΔ₁ hsub + have hinj₁ : Function.Injective φ₁ := fun a b h => by + rw [← hG₁, ← hG₁] at h + exact Circle.ext (G₁.injective h) + have hinj₂ : Function.Injective φ₂ := fun a b h => by + rw [← hG₂, ← hG₂] at h + exact Circle.ext (G₂.injective h) + have hoff₁ : ∀ w, φ₁ w ∉ G₁ '' ball 0 1 := fun w h => by + rw [← hint₁] at h + exact h.2 (by rw [← hr₁]; exact mem_range_self w) + have hoff₂ : ∀ w, φ₂ w ∉ G₁ '' ball 0 1 := fun w h => by + rw [← hint₁] at h + exact (hmono h).2 (by rw [← hr₂]; exact mem_range_self w) + have hin₁ : ∀ w, φ₁ w ∈ Δ₂ := + fun w => hsub (discBd_subset _ (by rw [← hr₁]; exact mem_range_self w)) + have hin₂ : ∀ w, φ₂ w ∈ Δ₂ := fun w => discBd_subset _ (by rw [← hr₂]; exact mem_range_self w) + have hz₁ : ∀ w, φ₁ w ≠ G₁ 0 := fun w h => hoff₁ w ⟨0, by simp, h.symm⟩ + have hz₂ : ∀ w, φ₂ w ≠ G₁ 0 := fun w h => hoff₂ w ⟨0, by simp, h.symm⟩ + let γ₁ : ℝ → ℂ := fun t => φ₁ (u₁ * Circle.exp t) + let γ₂ : ℝ → ℂ := fun t => φ₂ (u₂ * Circle.exp t) + have hγ₁ : Continuous γ₁ := hc₁.comp (continuous_const.mul hcoe) + have hγ₂ : Continuous γ₂ := hc₂.comp (continuous_const.mul hcoe) + have hγ₁c : Continuous fun t => γ₁ t - G₁ 0 := hγ₁.sub continuous_const + have hγ₂c : Continuous fun t => γ₂ t - G₁ 0 := hγ₂.sub continuous_const + have hγ₁0 : ∀ t, γ₁ t - G₁ 0 ≠ 0 := fun t => sub_ne_zero.mpr (hz₁ _) + have hγ₂0 : ∀ t, γ₂ t - G₁ 0 ≠ 0 := fun t => sub_ne_zero.mpr (hz₂ _) + have e0₁ : γ₁ 0 = φ₁ u₁ := by simp [γ₁] + have e0₂ : γ₂ 0 = φ₂ u₂ := by simp [γ₂] + have e2₁ : γ₁ (2 * Real.pi) = φ₁ u₁ := by + have := exp_add_two_pi 0 + rw [zero_add] at this + simp [γ₁, this] + have e2₂ : γ₂ (2 * Real.pi) = φ₂ u₂ := by + have := exp_add_two_pi 0 + rw [zero_add] at this + simp [γ₂, this] + have step : ∀ {x₁ x₂ : Circle} {a b c d : ℝ}, φ₁ x₁ = φ₂ x₂ → a ≤ b → c ≤ d → + γ₁ a = γ₂ c → γ₁ b = γ₂ d → (∀ t ∈ Icc a b, γ₁ t ≠ φ₁ x₁) → + (∀ t ∈ Icc c d, γ₂ t ≠ φ₁ x₁) → + turn (fun t => γ₁ t - G₁ 0) a b = turn (fun t => γ₂ t - G₁ 0) c d := by + intro x₁ x₂ a b c d hx hab hcd hs he hg hk + refine turn_eq_of_nested hΔ₂ G₁ G₂ hD₂ (x₁ := x₁) (x₂ := x₂) (by rw [hG₁, hG₂, hx]) hγ₁ hγ₂ + hab hcd hs he (fun t => hoff₁ _) (fun t => hoff₂ _) (fun t => hin₁ _) (fun t => hin₂ _) + (fun t ht => ?_) (fun t ht => ?_) + · rw [hG₁]; exact hg t ht + · rw [hG₁]; exact hk t ht + have hne₁ : ∀ {x y : ℝ}, x ≠ y → |x - y| < 2 * Real.pi → γ₁ x ≠ γ₁ y := fun hxy h he => + circle_exp_ne hxy h (mul_left_cancel (hinj₁ he)) + have hne₂ : ∀ {x y : ℝ}, x ≠ y → |x - y| < 2 * Real.pi → γ₂ x ≠ γ₂ y := fun hxy h he => + circle_exp_ne hxy h (mul_left_cancel (hinj₂ he)) + have hb' : γ₁ s₁ = γ₂ s₂ := hb + have hc' : γ₁ t₁ = γ₂ t₂ := hc + have a1 : turn (fun t => γ₁ t - G₁ 0) 0 s₁ = turn (fun t => γ₂ t - G₁ 0) 0 s₂ := by + refine step (x₁ := u₁ * Circle.exp t₁) (x₂ := u₂ * Circle.exp t₂) hc hs₁.le hs₂.le + (by rw [e0₁, e0₂, ha]) hb' (fun t ht => ?_) (fun t ht => ?_) + · refine hne₁ (x := t) (y := t₁) (fun he => by linarith [ht.2]) ?_ + rw [abs_lt]; constructor <;> linarith [ht.1, ht.2] + · rw [hc] + refine hne₂ (x := t) (y := t₂) (fun he => by linarith [ht.2]) ?_ + rw [abs_lt]; constructor <;> linarith [ht.1, ht.2] + have a2 : turn (fun t => γ₁ t - G₁ 0) s₁ t₁ = turn (fun t => γ₂ t - G₁ 0) s₂ t₂ := by + refine step (x₁ := u₁) (x₂ := u₂) ha hst₁.le hst₂.le hb' hc' (fun t ht => ?_) (fun t ht => ?_) + · rw [← e0₁] + refine hne₁ (x := t) (y := 0) (fun he => by linarith [ht.1]) ?_ + rw [abs_lt]; constructor <;> linarith [ht.1, ht.2] + · rw [ha, ← e0₂] + refine hne₂ (x := t) (y := 0) (fun he => by linarith [ht.1]) ?_ + rw [abs_lt]; constructor <;> linarith [ht.1, ht.2] + have a3 : turn (fun t => γ₁ t - G₁ 0) t₁ (2 * Real.pi) = + turn (fun t => γ₂ t - G₁ 0) t₂ (2 * Real.pi) := by + refine step (x₁ := u₁ * Circle.exp s₁) (x₂ := u₂ * Circle.exp s₂) hb ht₁.le ht₂.le hc' + (by rw [e2₁, e2₂, ha]) (fun t ht => ?_) (fun t ht => ?_) + · refine hne₁ (x := t) (y := s₁) (fun he => by linarith [ht.1]) ?_ + rw [abs_lt]; constructor <;> linarith [ht.1, ht.2] + · rw [hb] + refine hne₂ (x := t) (y := s₂) (fun he => by linarith [ht.1]) ?_ + rw [abs_lt]; constructor <;> linarith [ht.1, ht.2] + rw [wind_eq_turn_rotate hc₁ hz₁ u₁, wind_eq_turn_rotate hc₂ hz₂ u₂] + change turn (fun t => γ₁ t - G₁ 0) 0 (2 * Real.pi) = turn (fun t => γ₂ t - G₁ 0) 0 (2 * Real.pi) + rw [← turn_add hγ₁c hγ₁0 0 t₁, ← turn_add hγ₁c hγ₁0 0 s₁ t₁, ← turn_add hγ₂c hγ₂0 0 t₂, + ← turn_add hγ₂c hγ₂0 0 s₂ t₂, a1, a2, a3] + +/-- A parametrization of `bd(Δ)` that turns positively around the points inside `Δ`. -/ +def IsPosParam (Δ : Set ℂ) (φ : Circle → ℂ) : Prop := + Continuous φ ∧ Function.Injective φ ∧ range φ = discBd Δ ∧ ∀ z ∈ discInt Δ, 0 < wind φ z + +/-- Any boundary parametrization of a closed disc in `ℂ` is either positive or its circle-inverse +is positive. -/ +theorem isPosParam_or_inv {Δ : Set ℂ} (hΔ : IsClosedDisc Δ) {φ : Circle → ℂ} + (hc : Continuous φ) (hi : Function.Injective φ) (hr : range φ = discBd Δ) : + IsPosParam Δ φ ∨ IsPosParam Δ (fun w => φ w⁻¹) := by + obtain ⟨G, hG, hD⟩ := exists_plane_extension hΔ hc hi hr + have hint := discInt_eq_of_extension G hG hr hD + have hne : wind φ (G 0) ≠ 0 := by + have := wind_ne_zero G + have he : (fun w : Circle => G w) = φ := funext hG + rwa [he] at this + have hsame : ∀ z ∈ discInt Δ, wind φ z = wind φ (G 0) := by + intro z hz + rw [hint] at hz + obtain ⟨a, ha, rfl⟩ := hz + exact wind_eq_of_ball G hc hG ha (by simp) + have hoff : ∀ {z}, z ∈ discInt Δ → ∀ w, φ w ≠ z := + fun hz w he => hz.2 (by rw [← he, ← hr]; exact mem_range_self w) + rcases hne.lt_or_gt with hn | hp + · right + refine ⟨hc.comp continuous_inv, fun a b he => inv_injective (hi he), ?_, fun z hz => ?_⟩ + · rw [← hr] + ext y + exact ⟨fun ⟨w, hw⟩ => ⟨_, hw⟩, fun ⟨w, hw⟩ => ⟨w⁻¹, by simpa using hw⟩⟩ + · rw [wind_inv hc (hoff hz), hsame z hz] + linarith + · exact Or.inl ⟨hc, hi, hr, fun z hz => by rw [hsame z hz]; exact hp⟩ + +theorem exists_posParam {Δ : Set ℂ} (hΔ : IsClosedDisc Δ) : ∃ φ, IsPosParam Δ φ := by + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + have hsub : ∀ w : Circle, (w : ℂ) ∈ closedBall (0 : ℂ) 1 := fun w => by simp + let φ : Circle → ℂ := fun w => g w + have hφc : Continuous φ := c.gc.comp_continuous continuous_induced_dom hsub + have hφi : Function.Injective φ := fun a b he => by + have := congrArg h he + rw [c.hg (hsub a), c.hg (hsub b)] at this + exact Circle.ext this + have hφr : range φ = discBd Δ := by + ext y + constructor + · rintro ⟨w, rfl⟩ + have : (w : ℂ) ∈ h '' discBd Δ := by rw [c.bd]; simp + obtain ⟨x, hx, hxe⟩ := this + have hxD := discBd_subset _ hx + have := c.gh hxD + change g w ∈ _ + rw [← hxe, this] + exact hx + · intro hy + have hyD := discBd_subset _ hy + have hm : h y ∈ sphere (0 : ℂ) 1 := by rw [← c.bd]; exact mem_image_of_mem h hy + have hm' : h y ∈ Submonoid.unitSphere ℂ := hm + exact ⟨⟨h y, hm'⟩, c.gh hyD⟩ + rcases isPosParam_or_inv hΔ hφc hφi hφr with hPos | hPos + · exact ⟨φ, hPos⟩ + · exact ⟨fun w => φ w⁻¹, hPos⟩ + +/-- A positive boundary parametrization and its circle-inverse cannot both be positive. -/ +theorem not_isPosParam_inv {Δ : Set ℂ} (hΔ : IsClosedDisc Δ) {φ : Circle → ℂ} + (hφ : IsPosParam Δ φ) : ¬ IsPosParam Δ (fun w => φ w⁻¹) := by + intro hinv + obtain ⟨G, hG, hD⟩ := exists_plane_extension hΔ hφ.1 hφ.2.1 hφ.2.2.1 + have hint := discInt_eq_of_extension G hG hφ.2.2.1 hD + have hz0 : G 0 ∈ discInt Δ := by + rw [hint] + exact mem_image_of_mem G (mem_ball_self zero_lt_one) + have h1 := hφ.2.2.2 (G 0) hz0 + have h2 := hinv.2.2.2 (G 0) hz0 + have hoff : ∀ u, φ u ≠ G 0 := fun u he => + hz0.2 (by rw [← he, ← hφ.2.2.1]; exact mem_range_self u) + rw [wind_inv hφ.1 hoff] at h2 + linarith + +/-- The cyclic order on common boundary points of nested plane discs is the same. -/ +theorem order_of_nested {Δ₁ Δ₂ : Set ℂ} (hΔ₁ : IsClosedDisc Δ₁) (hΔ₂ : IsClosedDisc Δ₂) + (hsub : Δ₁ ⊆ Δ₂) {φ₁ φ₂ : Circle → ℂ} (h₁ : IsPosParam Δ₁ φ₁) (h₂ : IsPosParam Δ₂ φ₂) + {u v w u' v' w' : Circle} (hcy : CircleCyclic u v w) + (ha : φ₁ u = φ₂ u') (hb : φ₁ v = φ₂ v') (hc : φ₁ w = φ₂ w') : CircleCyclic u' v' w' := by + obtain ⟨s, t, hs, hst, ht, rfl, rfl⟩ := id hcy + have hpi := Real.pi_pos + have hne : ∀ {x y : ℝ}, x ≠ y → |x - y| < 2 * Real.pi → + ∀ a : Circle, a * Circle.exp x ≠ a * Circle.exp y := fun hxy h a he => + circle_exp_ne hxy h (mul_left_cancel he) + have hbne : u ≠ u * Circle.exp s := fun he => by + have := hne (x := s) (y := 0) hs.ne' (by rw [sub_zero, abs_of_pos hs]; linarith) u + rw [Circle.exp_zero, mul_one] at this + exact this he.symm + have hcne : u ≠ u * Circle.exp t := fun he => by + have := hne (x := t) (y := 0) (by linarith : (0 : ℝ) < t).ne' + (by rw [sub_zero, abs_of_pos (by linarith)]; linarith) u + rw [Circle.exp_zero, mul_one] at this + exact this he.symm + have hbc : u * Circle.exp s ≠ u * Circle.exp t := + hne hst.ne (by rw [abs_lt]; constructor <;> linarith) u + have hab' : u' ≠ v' := fun he => hbne (h₁.2.1 (by rw [ha, hb, he])) + have hac' : u' ≠ w' := fun he => hcne (h₁.2.1 (by rw [ha, hc, he])) + have hbc' : v' ≠ w' := fun he => hbc (h₁.2.1 (by rw [hb, hc, he])) + rcases circleCyclic_or hab' hac' hbc' with h | h + · exact h + exfalso + obtain ⟨hc₁, hi₁, hr₁, hp₁⟩ := h₁ + obtain ⟨hc₂, hi₂, hr₂, hp₂⟩ := h₂ + let φ₃ : Circle → ℂ := fun x => φ₂ x⁻¹ + have hc₃ : Continuous φ₃ := hc₂.comp continuous_inv + have hi₃ : Function.Injective φ₃ := fun a b he => inv_injective (hi₂ he) + have hr₃ : range φ₃ = discBd Δ₂ := by + rw [← hr₂] + ext y + exact ⟨fun ⟨w, hw⟩ => ⟨_, hw⟩, fun ⟨w, hw⟩ => ⟨w⁻¹, by simpa [φ₃] using hw⟩⟩ + obtain ⟨G₁, hG₁, hD₁⟩ := exists_plane_extension hΔ₁ hc₁ hi₁ hr₁ + obtain ⟨G₃, hG₃, hD₃⟩ := exists_plane_extension hΔ₂ hc₃ hi₃ hr₃ + obtain ⟨s', t', hs', hst', ht', hv', hw''⟩ := circleCyclic_inv h + have e := wind_eq_of_nested hΔ₁ hΔ₂ hsub hc₁ hc₃ hr₁ hr₃ G₁ G₃ hG₁ hG₃ hD₁ hD₃ + (u₁ := u) (u₂ := u'⁻¹) hs hst ht hs' hst' ht' (by simp [φ₃, ha]) + (by rw [← hv']; simp [φ₃, hb]) (by rw [← hw'']; simp [φ₃, hc]) + have hzi : G₁ 0 ∈ discInt Δ₁ := by + rw [discInt_eq_of_extension G₁ hG₁ hr₁ hD₁] + exact ⟨0, by simp, rfl⟩ + have hzi₂ := discInt_mono isManifoldPoint_complex hΔ₁ hsub hzi + have h1 := hp₁ _ hzi + have h2 := hp₂ _ hzi₂ + have hoff : ∀ w, φ₂ w ≠ G₁ 0 := fun w he => + hzi₂.2 (by rw [← he, ← hr₂]; exact mem_range_self w) + rw [e, wind_inv hc₂ hoff] at h1 + linarith + +/-- `a, b, c` occur in this order on `bd(Δ)`, read positively. -/ +def planePos (Δ : Set ℂ) (a b c : ℂ) : Prop := + ∃ φ u v w, IsPosParam Δ φ ∧ φ u = a ∧ φ v = b ∧ φ w = c ∧ CircleCyclic u v w + +/-! ### Complex conjugation and `EuclideanPlane` clockwise orientation -/ + +theorem isAngle_conj {g : ℝ → ℂ} {L : ℝ → ℝ} (hL : IsAngle g L) : + IsAngle (fun t => starRingEnd ℂ (g t)) (fun t => -L t) := by + refine ⟨hL.1.neg, fun t => ?_⟩ + have h1 := congrArg (starRingEnd ℂ) (hL.2 t) + simp only [map_mul, Complex.conj_ofReal, ← Complex.exp_conj, Complex.conj_I, mul_neg] at h1 + change starRingEnd ℂ (g t) = ↑‖starRingEnd ℂ (g t)‖ * Complex.exp (↑(-L t) * Complex.I) + rw [Complex.norm_conj, Complex.ofReal_neg, neg_mul, h1] + +theorem turn_conj {g : ℝ → ℂ} (hg : Continuous g) (h0 : ∀ t, g t ≠ 0) (s t : ℝ) : + turn (fun x => starRingEnd ℂ (g x)) s t = - turn g s t := by + obtain ⟨L, hL⟩ := exists_isAngle hg h0 + have h0' : ∀ x, starRingEnd ℂ (g x) ≠ 0 := fun x => map_ne_zero_iff _ + (RingHom.injective _) |>.mpr (h0 x) + rw [(isAngle_conj hL).turn_eq h0', hL.turn_eq h0] + ring + +theorem wind_conj {φ : Circle → ℂ} (hc : Continuous φ) {z : ℂ} (h0 : ∀ w, φ w ≠ z) : + wind (fun w => starRingEnd ℂ (φ w)) (starRingEnd ℂ z) = - wind φ z := by + have hcoe : Continuous fun t : ℝ => Circle.exp t := Circle.exp.continuous + let g : ℝ → ℂ := fun t => φ (Circle.exp t) - z + have hg : Continuous g := (hc.comp hcoe).sub continuous_const + have hg0 : ∀ t, g t ≠ 0 := fun t => sub_ne_zero.mpr (h0 _) + have heq : (fun t => starRingEnd ℂ (φ (Circle.exp t)) - starRingEnd ℂ z) = + fun t => starRingEnd ℂ (g t) := by + funext t + exact (map_sub (starRingEnd ℂ) (φ (Circle.exp t)) z).symm + unfold wind + rw [heq, turn_conj hg hg0] + +/-- A circle homeomorphism `φ : Circle ≃ₜ C` onto the boundary of a closed disc `D` in +`EuclideanPlane` has the plane's positive ("clockwise" in Graph Minors IX, Section 1, page 42) +orientation if its winding around every interior point of `D` (transferred to `ℂ` via +`complexPlane.symm`) is positive. -/ +def IsClockwiseDiscHomeo (D : Set EuclideanPlane) {C : Set EuclideanPlane} + (φ : Circle ≃ₜ C) : Prop := + ∀ x ∈ interior D, 0 < wind (fun w => complexPlane.symm (φ w).1) (complexPlane.symm x) + +theorem isClosedDisc_symm_image_complexPlane {D : Set EuclideanPlane} (hD : IsClosedDisc D) : + IsClosedDisc (complexPlane.symm '' D) := + (hD.image complexPlane.symm.continuous.continuousOn complexPlane.continuous.continuousOn + (fun x _ => complexPlane.apply_symm_apply x)).1 + +theorem discBd_symm_image_complexPlane_eq_image_discBd {D : Set EuclideanPlane} + (hD : IsClosedDisc D) : + discBd (complexPlane.symm '' D) = complexPlane.symm '' discBd D := + (hD.image complexPlane.symm.continuous.continuousOn complexPlane.continuous.continuousOn + (fun x _ => complexPlane.apply_symm_apply x)).2 + +theorem discBd_symm_image_complexPlane {D : Set EuclideanPlane} (hD : IsClosedDisc D) : + discBd (complexPlane.symm '' D) = complexPlane.symm '' subBd D := by + rw [subBd_eq_discBd_euclideanPlane hD, discBd_symm_image_complexPlane_eq_image_discBd hD] + +theorem discInt_symm_image_complexPlane {D : Set EuclideanPlane} (hD : IsClosedDisc D) : + discInt (complexPlane.symm '' D) = complexPlane.symm '' interior D := by + rw [← interior_eq_discInt_complex (isClosedDisc_symm_image_complexPlane hD)] + exact (complexPlane.symm.toHomeomorph.image_interior D).symm + +theorem isClockwiseDiscHomeo_iff_isPosParam {D : Set EuclideanPlane} (hD : IsClosedDisc D) + {C : Set EuclideanPlane} (hC : C = subBd D) (φ : Circle ≃ₜ C) : + IsClockwiseDiscHomeo D φ ↔ + IsPosParam (complexPlane.symm '' D) (fun w => complexPlane.symm (φ w).1) := by + let ψ : Circle → ℂ := fun w => complexPlane.symm (φ w).1 + have hψc : Continuous ψ := + complexPlane.symm.continuous.comp (continuous_subtype_val.comp φ.continuous) + have hψi : Function.Injective ψ := fun a b h => + φ.injective (Subtype.ext (complexPlane.symm.injective h)) + have hψr : range ψ = discBd (complexPlane.symm '' D) := by + rw [discBd_symm_image_complexPlane hD, ← hC] + ext z + exact ⟨fun ⟨w, hw⟩ => hw ▸ mem_image_of_mem _ (φ w).2, + fun ⟨x, hx, hxz⟩ => ⟨φ.symm ⟨x, hx⟩, by simp [ψ, hxz]⟩⟩ + refine ⟨fun h => ⟨hψc, hψi, hψr, ?_⟩, fun h x hx => ?_⟩ + · intro z hz + rw [discInt_symm_image_complexPlane hD] at hz + obtain ⟨x, hx, rfl⟩ := hz + exact h x hx + · refine h.2.2.2 (complexPlane.symm x) ?_ + rw [discInt_symm_image_complexPlane hD] + exact mem_image_of_mem _ hx + +theorem isClockwiseDiscHomeo_or_inv {D : Set EuclideanPlane} (hD : IsClosedDisc D) + {C : Set EuclideanPlane} (hC : C = subBd D) (φ : Circle ≃ₜ C) : + IsClockwiseDiscHomeo D φ ∨ IsClockwiseDiscHomeo D ((Homeomorph.inv Circle).trans φ) := by + rw [isClockwiseDiscHomeo_iff_isPosParam hD hC φ, + isClockwiseDiscHomeo_iff_isPosParam hD hC ((Homeomorph.inv Circle).trans φ)] + let ψ : Circle → ℂ := fun w => complexPlane.symm (φ w).1 + have hψc : Continuous ψ := + complexPlane.symm.continuous.comp (continuous_subtype_val.comp φ.continuous) + have hψi : Function.Injective ψ := fun a b h => + φ.injective (Subtype.ext (complexPlane.symm.injective h)) + have hψr : range ψ = discBd (complexPlane.symm '' D) := by + rw [discBd_symm_image_complexPlane hD, ← hC] + ext z + exact ⟨fun ⟨w, hw⟩ => hw ▸ mem_image_of_mem _ (φ w).2, + fun ⟨x, hx, hxz⟩ => ⟨φ.symm ⟨x, hx⟩, by simp [ψ, hxz]⟩⟩ + exact isPosParam_or_inv (isClosedDisc_symm_image_complexPlane hD) hψc hψi hψr + +theorem exists_isClockwiseDiscHomeo {D : Set EuclideanPlane} (hD : IsClosedDisc D) : + ∃ φ : Circle ≃ₜ subBd D, IsClockwiseDiscHomeo D φ := by + have hbd : subBd D = discBd D := subBd_eq_discBd_euclideanPlane hD + obtain ⟨φ₀⟩ := hD.isOArc_discBd + let φ : Circle ≃ₜ subBd D := φ₀.trans (Homeomorph.setCongr hbd.symm) + rcases isClockwiseDiscHomeo_or_inv hD rfl φ with h | h + · exact ⟨φ, h⟩ + · exact ⟨(Homeomorph.inv Circle).trans φ, h⟩ + +theorem not_isClockwiseDiscHomeo_inv {D : Set EuclideanPlane} (hD : IsClosedDisc D) + {C : Set EuclideanPlane} (hC : C = subBd D) {φ : Circle ≃ₜ C} + (hφ : IsClockwiseDiscHomeo D φ) : + ¬ IsClockwiseDiscHomeo D ((Homeomorph.inv Circle).trans φ) := by + rw [isClockwiseDiscHomeo_iff_isPosParam hD hC φ] at hφ + rw [isClockwiseDiscHomeo_iff_isPosParam hD hC ((Homeomorph.inv Circle).trans φ)] + exact not_isPosParam_inv (isClosedDisc_symm_image_complexPlane hD) hφ + +theorem order_of_nested_euclideanPlane {D₁ D₂ : Set EuclideanPlane} + (h₁ : IsClosedDisc D₁) (h₂ : IsClosedDisc D₂) (hsub : D₁ ⊆ D₂) + {C₁ C₂ : Set EuclideanPlane} (hC₁ : C₁ = subBd D₁) (hC₂ : C₂ = subBd D₂) + {φ₁ : Circle ≃ₜ C₁} {φ₂ : Circle ≃ₜ C₂} + (hp₁ : IsClockwiseDiscHomeo D₁ φ₁) (hp₂ : IsClockwiseDiscHomeo D₂ φ₂) + {u v w u' v' w' : Circle} (hcy : CircleCyclic u v w) + (ha : (φ₁ u).1 = (φ₂ u').1) (hb : (φ₁ v).1 = (φ₂ v').1) (hc : (φ₁ w).1 = (φ₂ w').1) : + CircleCyclic u' v' w' := by + have hp₁' := (isClockwiseDiscHomeo_iff_isPosParam h₁ hC₁ φ₁).mp hp₁ + have hp₂' := (isClockwiseDiscHomeo_iff_isPosParam h₂ hC₂ φ₂).mp hp₂ + exact order_of_nested (isClosedDisc_symm_image_complexPlane h₁) + (isClosedDisc_symm_image_complexPlane h₂) (image_mono hsub) hp₁' hp₂' hcy + (congrArg complexPlane.symm ha) (congrArg complexPlane.symm hb) + (congrArg complexPlane.symm hc) + +/-- Reflection of `EuclideanPlane` corresponding to complex conjugation `starRingEnd ℂ` via +`complexPlane`. -/ +noncomputable def conjPlane : EuclideanPlane ≃ₗᵢ[ℝ] EuclideanPlane := + complexPlane.symm.trans (Complex.conjLIE.trans complexPlane) + +@[simp] +theorem complexPlane_symm_conjPlane (x : EuclideanPlane) : + complexPlane.symm (conjPlane x) = starRingEnd ℂ (complexPlane.symm x) := by + simp [conjPlane] + +@[simp] +theorem conjPlane_symm : conjPlane.symm = conjPlane := by + ext x i + change (complexPlane (Complex.conjLIE.symm (complexPlane.symm x))) i = + (complexPlane (Complex.conjLIE (complexPlane.symm x))) i + rfl + +@[simp] +theorem conjPlane_conjPlane (x : EuclideanPlane) : conjPlane (conjPlane x) = x := + conjPlane.symm_apply_apply x + +theorem isClosedDisc_image_conjPlane {D : Set EuclideanPlane} (hD : IsClosedDisc D) : + IsClosedDisc (conjPlane '' D) := + (hD.image conjPlane.continuous.continuousOn conjPlane.symm.continuous.continuousOn + (fun x _ => conjPlane.symm_apply_apply x)).1 + +theorem subBd_image_conjPlane (D : Set EuclideanPlane) : + subBd (conjPlane '' D) = conjPlane '' subBd D := by + rw [Surface.subBd_eq_frontier, Surface.subBd_eq_frontier] + exact (conjPlane.toHomeomorph.image_frontier D).symm + +theorem interior_image_conjPlane (D : Set EuclideanPlane) : + interior (conjPlane '' D) = conjPlane '' interior D := + (conjPlane.toHomeomorph.image_interior D).symm + +theorem isClockwiseDiscHomeo_conjPlane_inv {D : Set EuclideanPlane} {C : Set EuclideanPlane} + {φ : Circle ≃ₜ C} (hdisj : ∀ w, (φ w).1 ∉ interior D) + (hφ : IsClockwiseDiscHomeo D φ) : + IsClockwiseDiscHomeo (conjPlane '' D) + ((Homeomorph.inv Circle).trans (φ.trans (conjPlane.toHomeomorph.image C))) := by + intro y hy + rw [interior_image_conjPlane] at hy + obtain ⟨x, hx, rfl⟩ := hy + let ψ : Circle → ℂ := fun w => complexPlane.symm (φ w).1 + have hψc : Continuous ψ := + complexPlane.symm.continuous.comp (continuous_subtype_val.comp φ.continuous) + have h0 : ∀ w, ψ w ≠ complexPlane.symm x := fun w h => + hdisj w (complexPlane.symm.injective h ▸ hx) + have h0_conj : ∀ w, starRingEnd ℂ (ψ w) ≠ starRingEnd ℂ (complexPlane.symm x) := fun w h => + h0 w (RingHom.injective (starRingEnd ℂ) h) + have hψ_conj : Continuous (fun w => starRingEnd ℂ (ψ w)) := + Complex.continuous_conj.comp hψc + change 0 < wind (fun w : Circle => complexPlane.symm (conjPlane (φ w⁻¹).1)) + (complexPlane.symm (conjPlane x)) + simp only [complexPlane_symm_conjPlane] + rw [wind_inv hψ_conj h0_conj, wind_conj hψc h0, neg_neg] + exact hφ x hx + +theorem isClockwiseDiscHomeo_conjPlane_of_not {D : Set EuclideanPlane} (hD : IsClosedDisc D) + {C : Set EuclideanPlane} (hC : C = subBd D) {φ : Circle ≃ₜ C} + (hφ : ¬ IsClockwiseDiscHomeo D φ) : + IsClockwiseDiscHomeo (conjPlane '' D) (φ.trans (conjPlane.toHomeomorph.image C)) := by + have hinv : IsClockwiseDiscHomeo D ((Homeomorph.inv Circle).trans φ) := + (isClockwiseDiscHomeo_or_inv hD hC φ).resolve_left hφ + intro y hy + rw [interior_image_conjPlane] at hy + obtain ⟨x, hx, rfl⟩ := hy + let ψ : Circle → ℂ := fun w => complexPlane.symm (φ w).1 + have hψc : Continuous ψ := + complexPlane.symm.continuous.comp (continuous_subtype_val.comp φ.continuous) + have h0 : ∀ w, ψ w ≠ complexPlane.symm x := by + intro w h + have hx' : x ∈ subBd D := hC ▸ (complexPlane.symm.injective h ▸ (φ w).2) + rw [Surface.subBd_eq_frontier] at hx' + exact hx'.2 hx + change 0 < wind (fun w : Circle => complexPlane.symm (conjPlane (φ w).1)) + (complexPlane.symm (conjPlane x)) + simp only [complexPlane_symm_conjPlane] + rw [wind_conj hψc h0] + have h1 := hinv x hx + change 0 < wind (fun w : Circle => ψ w⁻¹) (complexPlane.symm x) at h1 + rw [wind_inv hψc h0] at h1 + linarith + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/PlaneSeparation.lean b/LeanPool/GraphMinor/Surface/PlaneSeparation.lean new file mode 100644 index 0000000000..46a4052147 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/PlaneSeparation.lean @@ -0,0 +1,286 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.PlaneLog +public import Mathlib.Analysis.Complex.Basic +import Mathlib.Analysis.Complex.Tietze +import Mathlib.Analysis.Normed.Module.Connected + +/-! +# Separation in the plane by continuous logarithms + +This file links the components of the complement of a compact set `K` of the complex plane with +logarithms on `K`. This is Eilenberg's criterion: two points `a, b` outside `K` lie in the same +component of the complement if and only if $(z - a)/(z - b)$ has a continuous logarithm on `K`. +The route is the one of J. Dieudonné, *Foundations of Modern Analysis*, Appendix to Chapter IX. + +- `hasLogOn_div_of_same_component`: points in one component give a logarithm, by moving one point + to the other along a path. +- `eq_zero_of_hasLogOn_frontier`: the main obstruction. If `U` is a bounded open set around `a` + and $(z - a)^m / h(z)$ has a logarithm on the frontier of `U`, where `h` has no zeros on the + closure of `U`, then `m = 0`. Otherwise we could paste a function without zeros on the plane + that equals $(z - a)^m$ on a big circle. +- `component_eq_of_hasLogOn`: the converse of the first item, for compact `K`. +- `component_eq_of_arc`: an arc does not separate the plane. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Complex Metric + +local notation "𝕀" => unitInterval + +/-- A component of the complement of a closed set is open. -/ +theorem isOpen_component {K : Set ℂ} (hK : IsClosed K) (a : ℂ) : + IsOpen (connectedComponentIn Kᶜ a) := + hK.isOpen_compl.connectedComponentIn + +/-- A component of the complement of a closed set has its frontier in the set. -/ +theorem frontier_component_subset {K : Set ℂ} (hK : IsClosed K) (a : ℂ) : + frontier (connectedComponentIn Kᶜ a) ⊆ K := by + intro x hx + by_contra hxK + have hU := isOpen_component hK a + rw [hU.frontier_eq] at hx + have hV := isOpen_component hK x + have hxV : x ∈ connectedComponentIn Kᶜ x := mem_connectedComponentIn hxK + obtain ⟨y, hyV, hyU⟩ := mem_closure_iff.mp hx.1 _ hV hxV + have h1 := connectedComponentIn_eq hyU + have h2 := connectedComponentIn_eq hyV + exact hx.2 (by rw [h1, ← h2]; exact hxV) + +/-- The closure of a component lies in the component and the closed set. -/ +theorem closure_component_subset {K : Set ℂ} (hK : IsClosed K) (a : ℂ) : + closure (connectedComponentIn Kᶜ a) ⊆ connectedComponentIn Kᶜ a ∪ K := by + intro x hx + by_cases h : x ∈ connectedComponentIn Kᶜ a + · exact Or.inl h + · refine Or.inr (frontier_component_subset hK a ⟨hx, fun hi => h ?_⟩) + exact interior_subset hi + +/-- If `a, b` lie in one component of the complement of `K`, then $(z - a)/(z - b)$ has a +logarithm on `K`: move `b` to `a` along a path in the complement. -/ +theorem hasLogOn_div_of_same_component {K : Set ℂ} (hK : IsClosed K) {a b : ℂ} (ha : a ∉ K) + (hb : b ∈ connectedComponentIn Kᶜ a) : + HasLogOn K fun z => (z - b) / (z - a) := by + have hU := isOpen_component hK a + have hconn : IsPathConnected (connectedComponentIn Kᶜ a) := + (hU.isConnected_iff_isPathConnected).mp (isConnected_connectedComponentIn_iff.mpr ha) + obtain ⟨γ, hγ⟩ := hconn.joinedIn a (mem_connectedComponentIn ha) b hb + have hγK : ∀ t, γ t ∉ K := fun t h => connectedComponentIn_subset _ _ (hγ t) h + have hne : ∀ z ∈ K, z - a ≠ 0 := fun z hz h => ha (by rwa [sub_eq_zero.mp h] at hz) + have h := hasLogOn_of_homotopy (K := K) (fun t z => (z - γ t) / (z - a)) + (by + apply ContinuousOn.div + · exact (continuous_snd.continuousOn).sub + (γ.continuous.comp continuous_fst).continuousOn + · exact (continuous_snd.continuousOn).sub continuousOn_const + · rintro ⟨t, z⟩ ⟨-, hz⟩ + exact hne z hz) + (fun z hz => by + simp only [γ.source] + exact div_self (hne z hz)) + (fun t z hz => div_ne_zero (fun h => hγK t (by rwa [sub_eq_zero.mp h] at hz)) (hne z hz)) + simpa using h + +/-- **The obstruction.** Let `U` be a bounded open set containing `a`. Let `h` be continuous and +without zeros on the closure of `U`. If $(z - a)^m / h(z)$ has a logarithm on the frontier of `U`, +then `m = 0`. Extend the logarithm to the plane by the Tietze theorem. Then $h$ times the +exponential of the extension, on `U`, and $(z - a)^m$, off `U`, paste to a function without zeros +on the plane. It has a logarithm, which contradicts `eq_zero_of_hasLogOn_sphere` on a big circle +around `a`. -/ +theorem eq_zero_of_hasLogOn_frontier {U : Set ℂ} {a : ℂ} {m : ℤ} {h : ℂ → ℂ} + (hU : IsOpen U) (hb : Bornology.IsBounded U) (ha : a ∈ U) + (hh : ContinuousOn h (closure U)) (hne : ∀ z ∈ closure U, h z ≠ 0) + (hlog : HasLogOn (frontier U) fun z => (z - a) ^ m / h z) : m = 0 := by + classical + obtain ⟨g₀, hg₀⟩ := hasLogOn_iff_subtype.mp hlog + obtain ⟨G, hG⟩ := g₀.exists_restrict_eq isClosed_frontier + have hGeq : ∀ z (hz : z ∈ frontier U), G z = g₀ ⟨z, hz⟩ := fun z hz => by + rw [← hG]; rfl + let F : ℂ → ℂ := fun z => if z ∈ U then h z * exp (G z) else (z - a) ^ m + have haU : ∀ z ∈ closure Uᶜ, z - a ≠ 0 := by + intro z hz hza + rw [closure_compl] at hz + apply hz + rw [hU.interior_eq, sub_eq_zero.mp hza] + exact ha + have hF : Continuous F := by + refine continuous_if ?_ ?_ ?_ + · intro z hz + have hz' : z ∈ frontier U := hz + have h1 := hg₀ ⟨z, hz'⟩ + have h2 : z ∈ closure U := hz'.1 + rw [hGeq z hz'] + change _ = (z - a) ^ m + have h3 : (z - a) ^ m / h z = exp (g₀ ⟨z, hz'⟩) := h1 + rw [← h3] + field_simp [hne z h2] + · exact hh.mul (G.continuous.comp continuous_id |>.cexp).continuousOn + · refine ContinuousOn.zpow₀ (continuousOn_id.sub continuousOn_const) m ?_ + intro z hz + exact Or.inl (haU z hz) + have hFne : ∀ z, F z ≠ 0 := by + intro z + by_cases hz : z ∈ U + · simp only [F, hz, ite_true] + exact mul_ne_zero (hne z (subset_closure hz)) (exp_ne_zero _) + · simp only [F, hz, ite_false] + exact zpow_ne_zero _ (haU z (subset_closure hz)) + obtain ⟨R, hR⟩ := hb.subset_ball a + have hRpos : 0 < R := by + have := hR ha + exact pos_of_mem_ball this + refine eq_zero_of_hasLogOn_sphere (a := a) hRpos ?_ + refine ((hasLogOn_univ_of_ne_zero hF hFne).mono (subset_univ _)).congr fun z hz => ?_ + have hzU : z ∉ U := fun h' => by + have h1 := hR h' + rw [mem_ball] at h1 + rw [mem_sphere] at hz + linarith + simp [F, hzU] + +/-- The complement of a closed disc around the origin is preconnected: it is the image of a +product of an interval and a line under polar coordinates. -/ +theorem isPreconnected_compl_closedBall (R : ℝ) (hR : 0 ≤ R) : + IsPreconnected (closedBall (0 : ℂ) R)ᶜ := by + have h : (closedBall (0 : ℂ) R)ᶜ = + (fun p : ℝ × ℝ => (p.1 : ℂ) * exp (p.2 * I)) '' (Ioi R ×ˢ univ) := by + ext z + simp only [mem_compl_iff, mem_closedBall, dist_zero_right, not_le, mem_image, mem_prod, + mem_Ioi, mem_univ, and_true, Prod.exists] + constructor + · intro hz + exact ⟨‖z‖, arg z, hz, norm_mul_exp_arg_mul_I z⟩ + · rintro ⟨r, θ, hr, rfl⟩ + rw [norm_mul, norm_exp_ofReal_mul_I, mul_one, norm_real, Real.norm_eq_abs, + abs_of_pos (hR.trans_lt hr)] + exact hr + rw [h] + refine ((isPreconnected_Ioi).prod isPreconnected_univ).image _ ?_ + apply Continuous.continuousOn + fun_prop + +/-- At most one component of the complement of a compact set is unbounded. -/ +theorem component_bounded_or {K : Set ℂ} (hK : IsCompact K) {a b : ℂ} (ha : a ∉ K) (hb : b ∉ K) + (hab : connectedComponentIn Kᶜ a ≠ connectedComponentIn Kᶜ b) : + Bornology.IsBounded (connectedComponentIn Kᶜ a) ∨ + Bornology.IsBounded (connectedComponentIn Kᶜ b) := by + obtain ⟨R, hR⟩ := hK.isBounded.subset_closedBall (0 : ℂ) + obtain ⟨R', hR'pos, hR'⟩ : ∃ R' : ℝ, 0 ≤ R' ∧ K ⊆ closedBall (0 : ℂ) R' := + ⟨max R 0, le_max_right _ _, hR.trans (closedBall_subset_closedBall (le_max_left _ _))⟩ + have hE := isPreconnected_compl_closedBall R' hR'pos + have hEK : (closedBall (0 : ℂ) R')ᶜ ⊆ Kᶜ := compl_subset_compl.mpr hR' + by_contra hcon + push Not at hcon + have key : ∀ c, c ∉ K → ¬ Bornology.IsBounded (connectedComponentIn Kᶜ c) → + (closedBall (0 : ℂ) R')ᶜ ⊆ connectedComponentIn Kᶜ c := by + intro c hc hunb + have : ∃ x ∈ connectedComponentIn Kᶜ c, x ∈ (closedBall (0 : ℂ) R')ᶜ := by + by_contra hno + push Not at hno + exact hunb ((isBounded_closedBall (x := (0 : ℂ)) (r := R')).subset fun x hx => by + simpa using hno x hx) + obtain ⟨x, hxc, hxE⟩ := this + have h1 := hE.subset_connectedComponentIn hxE hEK + rw [← connectedComponentIn_eq hxc] at h1 + exact h1 + have h1 := key a ha hcon.1 + have h2 := key b hb hcon.2 + obtain ⟨y, hy⟩ : ((closedBall (0 : ℂ) R')ᶜ).Nonempty := by + refine ⟨((R' + 1 : ℝ) : ℂ), ?_⟩ + simp only [mem_compl_iff, mem_closedBall, dist_zero_right, norm_real, Real.norm_eq_abs, + not_le] + rw [abs_of_pos (by linarith)] + linarith + exact hab ((connectedComponentIn_eq (h1 hy)).trans (connectedComponentIn_eq (h2 hy)).symm) + +/-- `b` does not lie in the closure of the component of `a`, when `b` lies in another component. -/ +theorem notMem_closure_component {K : Set ℂ} (hK : IsClosed K) {a b : ℂ} (hb : b ∉ K) + (hab : connectedComponentIn Kᶜ a ≠ connectedComponentIn Kᶜ b) : + b ∉ closure (connectedComponentIn Kᶜ a) := by + intro h + rcases closure_component_subset hK a h with h | h + · exact hab (connectedComponentIn_eq h) + · exact hb h + +/-- Eilenberg's criterion, the hard direction: if $(z - a)/(z - b)$ has a logarithm on the compact +set `K`, then `a` and `b` lie in the same component of the complement of `K`. -/ +theorem component_eq_of_hasLogOn {K : Set ℂ} (hK : IsCompact K) {a b : ℂ} (ha : a ∉ K) + (hb : b ∉ K) (hlog : HasLogOn K fun z => (z - a) / (z - b)) : + connectedComponentIn Kᶜ a = connectedComponentIn Kᶜ b := by + by_contra hab + have main : ∀ {a b : ℂ}, a ∉ K → b ∉ K → + connectedComponentIn Kᶜ a ≠ connectedComponentIn Kᶜ b → + Bornology.IsBounded (connectedComponentIn Kᶜ a) → + HasLogOn K (fun z => (z - a) / (z - b)) → False := by + intro a b ha hb hab hbd hlog + have hne : ∀ z ∈ closure (connectedComponentIn Kᶜ a), z - b ≠ 0 := fun z hz h => by + rw [sub_eq_zero] at h + exact notMem_closure_component hK.isClosed hb hab (h ▸ hz) + have := eq_zero_of_hasLogOn_frontier (m := 1) (isOpen_component hK.isClosed a) hbd + (mem_connectedComponentIn ha) + (h := fun z => z - b) (continuousOn_id.sub continuousOn_const) hne + ((hlog.mono (frontier_component_subset hK.isClosed a)).congr fun z _ => by simp) + exact one_ne_zero this + rcases component_bounded_or hK ha hb hab with h | h + · exact main ha hb hab h hlog + · refine main hb ha (Ne.symm hab) h (hlog.inv.congr fun z _ => ?_) + rw [inv_div] + +/-- An arc does not separate the plane. -/ +theorem component_eq_of_arc {L : Set ℂ} (φ : 𝕀 ≃ₜ L) {a b : ℂ} (ha : a ∉ L) (hb : b ∉ L) : + connectedComponentIn Lᶜ a = connectedComponentIn Lᶜ b := by + have hcomp : IsCompact L := by + have : CompactSpace L := φ.compactSpace + exact isCompact_iff_compactSpace.mpr this + refine component_eq_of_hasLogOn hcomp ha hb (hasLogOn_of_arc φ ?_ ?_) + · refine (continuousOn_id.sub continuousOn_const).div (continuousOn_id.sub continuousOn_const) ?_ + intro z hz h + exact hb (by rwa [sub_eq_zero.mp h] at hz) + · intro z hz + refine div_ne_zero (fun h => ha ?_) (fun h => hb ?_) + · rwa [sub_eq_zero.mp h] at hz + · rwa [sub_eq_zero.mp h] at hz + +/-- A preconnected set that meets a set and its complement meets the frontier of the set. -/ +theorem inter_frontier_nonempty_of_isPreconnected {T : Type*} [TopologicalSpace T] {C U : Set T} + (hC : IsPreconnected C) (hin : (C ∩ U).Nonempty) (hout : (C ∩ Uᶜ).Nonempty) : + (C ∩ frontier U).Nonempty := by + by_contra hcon + rw [not_nonempty_iff_eq_empty] at hcon + obtain ⟨x, hxC, hxU⟩ := hin + obtain ⟨y, hyC, hyU⟩ := hout + have hin' : x ∈ interior U := by + by_contra h + have : x ∈ C ∩ frontier U := ⟨hxC, subset_closure hxU, h⟩ + rw [hcon] at this + exact this + have hout' : y ∉ closure U := fun h => by + have : y ∈ C ∩ frontier U := ⟨hyC, h, fun h' => hyU (interior_subset h')⟩ + rw [hcon] at this + exact this + have hdisj : Disjoint (interior U) (closure U)ᶜ := + Set.disjoint_left.mpr fun z hz hz' => hz' (subset_closure (interior_subset hz)) + have hsub : C ⊆ interior U ∪ (closure U)ᶜ := by + intro z hz + by_cases h : z ∈ interior U + · exact Or.inl h + · refine Or.inr fun h' => ?_ + have : z ∈ C ∩ frontier U := ⟨hz, h', h⟩ + rw [hcon] at this + exact this + have := hC.subset_left_of_subset_union isOpen_interior isClosed_closure.isOpen_compl hdisj hsub + ⟨x, hxC, hin'⟩ hyC + exact hout' (subset_closure (interior_subset this)) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/PolyMoves.lean b/LeanPool/GraphMinor/Surface/PolyMoves.lean new file mode 100644 index 0000000000..432b3dae4f --- /dev/null +++ b/LeanPool/GraphMinor/Surface/PolyMoves.lean @@ -0,0 +1,428 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Polygon +import Mathlib.Analysis.SpecialFunctions.Complex.Circle + +/-! +# The half disc and loops on the boundary of polygons + +The two loops `upLoop` (around the upper half disc) and `circLoop` (around the unit disc) give, +through the polygon +lemma, the maps of discs of the moves on words. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +/-- The half of the unit disc on one side of the real axis. -/ +def halfD (σ : ℝ) : Set ℂ := {z | ‖z‖ ≤ 1 ∧ 0 ≤ σ * z.im} + +theorem isClosed_halfD (σ : ℝ) : IsClosed (halfD σ) := + (isClosed_le continuous_norm continuous_const).inter + (isClosed_le continuous_const (continuous_const.mul Complex.continuous_im)) + +theorem convex_halfD (σ : ℝ) : Convex ℝ (halfD σ) := by + have h1 : Convex ℝ {z : ℂ | ‖z‖ ≤ 1} := by + have := convex_closedBall (0 : ℂ) 1 + simpa [closedBall, dist_zero_right] using this + have h2 : Convex ℝ {z : ℂ | 0 ≤ σ * z.im} := by + intro x hx y hy a b ha hb _ + change 0 ≤ σ * (a • x + b • y).im + simp only [Complex.add_im, Complex.real_smul, Complex.mul_im, Complex.ofReal_re, + Complex.ofReal_im, + zero_mul, add_zero] + have h3 : 0 ≤ σ * x.im := hx + have h4 : 0 ≤ σ * y.im := hy + nlinarith [mul_nonneg ha h3, mul_nonneg hb h4] + exact h1.inter h2 + +theorem frontier_halfD {σ : ℝ} (hσ : σ ≠ 0) : + frontier (halfD σ) = {z | ‖z‖ = 1 ∧ 0 ≤ σ * z.im} ∪ {z | ‖z‖ ≤ 1 ∧ z.im = 0} := by + have hcl := isClosed_halfD σ + rw [frontier, hcl.closure_eq] + ext z + constructor + · rintro ⟨⟨h1, h2⟩, h3⟩ + by_contra hcon + rw [mem_union, not_or] at hcon + have h4 : ‖z‖ < 1 := lt_of_le_of_ne h1 fun he => hcon.1 ⟨he, h2⟩ + have h5 : 0 < σ * z.im := lt_of_le_of_ne h2 fun he => hcon.2 ⟨h1, by + rcases mul_eq_zero.mp he.symm with h | h + · exact absurd h hσ + · exact h⟩ + refine h3 (mem_interior.mpr ⟨ball 0 1 ∩ {w | 0 < σ * w.im}, fun w hw => + ⟨(mem_ball_zero_iff.mp hw.1).le, le_of_lt hw.2⟩, isOpen_ball.inter + (isOpen_lt continuous_const (continuous_const.mul Complex.continuous_im)), + mem_ball_zero_iff.mpr h4, h5⟩) + · rintro (⟨h1, h2⟩ | ⟨h1, h2⟩) + · refine ⟨⟨h1.le, h2⟩, fun hi => ?_⟩ + obtain ⟨ε, hε, hb⟩ := Metric.isOpen_iff.mp isOpen_interior z hi + have h3 : (((1 + ε / 2 : ℝ) : ℂ) * z) ∈ ball z ε := by + rw [mem_ball, dist_eq_norm, show ((1 + ε / 2 : ℝ) : ℂ) * z - z = ((ε / 2 : ℝ) : ℂ) * z by + push_cast + ring, norm_mul, h1, mul_one, Complex.norm_real, Real.norm_eq_abs, abs_of_pos + (by positivity)] + linarith + have h4 := (interior_subset (hb h3)).1 + rw [norm_mul, h1, mul_one, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos (by positivity)] at h4 + linarith + · refine ⟨⟨h1, by rw [h2, mul_zero]⟩, fun hi => ?_⟩ + obtain ⟨ε, hε, hb⟩ := Metric.isOpen_iff.mp isOpen_interior z hi + have hs : 0 < |σ| := abs_pos.mpr hσ + let w : ℂ := z - (((ε / 2 : ℝ) * (σ / |σ|) : ℝ) : ℂ) * Complex.I + have h3 : w ∈ ball z ε := by + rw [mem_ball, dist_eq_norm] + simp only [w, sub_sub_cancel_left, norm_neg, norm_mul, Complex.norm_I, mul_one, + Complex.norm_real, + Real.norm_eq_abs, abs_div, abs_abs, div_self hs.ne', abs_of_pos (half_pos hε)] + linarith + have h4 := (interior_subset (hb h3)).2 + have h5 : σ * w.im = - (ε / 2) * (|σ|) := by + simp only [w, Complex.sub_im, h2, Complex.mul_im, Complex.ofReal_re, Complex.I_im, + Complex.ofReal_im, Complex.I_re, mul_one, mul_zero, add_zero, zero_sub] + have : σ * σ = |σ| * |σ| := (abs_mul_abs_self σ).symm + field_simp + nlinarith + rw [h5] at h4 + nlinarith + +theorem isClosedDisc_halfD {σ : ℝ} (hσ : σ ≠ 0) : + IsClosedDisc (halfD σ) ∧ discBd (halfD σ) = {z | ‖z‖ = 1 ∧ 0 ≤ σ * z.im} ∪ {z | ‖z‖ ≤ 1 ∧ z.im + = 0} := by + have hint : (interior (halfD σ)).Nonempty := by + let c : ℂ := ((1 / 2 * (σ / |σ|) : ℝ) : ℂ) * Complex.I + have hs : 0 < |σ| := abs_pos.mpr hσ + have hc : ‖c‖ = 1 / 2 := by + simp only [c, norm_mul, Complex.norm_I, mul_one, Complex.norm_real, Real.norm_eq_abs, + abs_div, + abs_abs, div_self hs.ne'] + norm_num + have hci : 0 < σ * c.im := by + have : σ * c.im = 1 / 2 * |σ| := by + simp only [c, Complex.mul_im, Complex.ofReal_re, Complex.I_im, Complex.ofReal_im, + Complex.I_re, + mul_one, mul_zero, add_zero] + have : σ * σ = |σ| * |σ| := (abs_mul_abs_self σ).symm + field_simp + nlinarith + rw [this] + positivity + refine ⟨c, mem_interior.mpr ⟨ball 0 1 ∩ {w | 0 < σ * w.im}, fun w hw => + ⟨(mem_ball_zero_iff.mp hw.1).le, le_of_lt hw.2⟩, isOpen_ball.inter + (isOpen_lt continuous_const (continuous_const.mul Complex.continuous_im)), + mem_ball_zero_iff.mpr (by rw [hc]; norm_num), hci⟩⟩ + have hb : Bornology.IsBounded (halfD σ) := + (isBounded_closedBall (x := (0 : ℂ)) (r := 1)).subset fun z hz => mem_closedBall_zero_iff.mpr + hz.1 + obtain ⟨h1, h2⟩ := isClosedDisc_of_convex (convex_halfD σ) hint hb (isClosed_halfD σ) + exact ⟨h1, h2.trans (frontier_halfD hσ)⟩ + +/-- `cis'` is injective on a whole turn. -/ +theorem cis'_injOn' : InjOn cis' (Ioc (-Real.pi) Real.pi) := by + intro x hx y hy he + have h1 : Circle.exp x = Circle.exp y := Circle.ext (by simpa [cis', Circle.coe_exp] using he) + have h2 := congrArg Complex.arg (congrArg ((↑) : Circle → ℂ) h1) + rwa [Circle.arg_exp hx.1 hx.2, Circle.arg_exp hy.1 hy.2] at h2 + +theorem cis'_arg {z : ℂ} (hz : ‖z‖ = 1) : cis' (Complex.arg z) = z := by + have := Complex.norm_mul_exp_arg_mul_I z + rw [hz] at this + simpa [cis'] using this + +theorem cis'_pi : cis' Real.pi = -1 := by simp [cis', Complex.exp_pi_mul_I] + +theorem cis'_zero : cis' 0 = 1 := by simp [cis'] + +theorem cis'_im_pos {θ : ℝ} (h0 : 0 < θ) (h1 : θ < Real.pi) : 0 < (cis' θ).im := by + rw [cis'_im] + exact Real.sin_pos_of_pos_of_lt_pi h0 h1 + +theorem cis'_add_pi (θ : ℝ) : cis' (θ + Real.pi) = - cis' θ := by + simp only [cis'] + push_cast + rw [add_mul, Complex.exp_add, Complex.exp_pi_mul_I, mul_neg_one] + +/-- The loop around the upper half disc: first the segment from `-1` to `1`, then the upper half +circle. -/ +noncomputable def upLoop (a l : ℕ) (x : ℝ) : ℂ := + if x ≤ a then ((-1 + 2 * x / a : ℝ) : ℂ) else cis' (Real.pi * (x - a) / l) + +/-- The loop around the unit disc: the upper half circle from `1` to `-1`, then the lower one. -/ +noncomputable def circLoop (l k : ℕ) (x : ℝ) : ℂ := + if x ≤ l then cis' (Real.pi * x / l) else cis' (Real.pi * (x - l) / k - Real.pi) + +variable {a l k : ℕ} + +theorem upLoop_le {x : ℝ} (hx : x ≤ a) : upLoop a l x = ((-1 + 2 * x / a : ℝ) : ℂ) := ite_eq_left hx + +theorem upLoop_ge (ha : 0 < a) {x : ℝ} (hx : a ≤ x) : upLoop a l x = cis' (Real.pi * (x - a) / l) + := by + rcases eq_or_lt_of_le hx with rfl | h + · have ha' : (a : ℝ) ≠ 0 := by exact_mod_cast ha.ne' + have e : (-1 + 2 * (a : ℝ) / a) = 1 := by + rw [mul_div_assoc, div_self ha'] + norm_num + rw [upLoop_le le_rfl, sub_self, mul_zero, zero_div, cis'_zero, e] + simp + · exact ite_eq_right (not_le.mpr h) + +theorem continuous_upLoop (ha : 0 < a) : Continuous (upLoop a l) := by + have ha' : (a : ℝ) ≠ 0 := by exact_mod_cast ha.ne' + refine Continuous.if_le (by fun_prop) (continuous_cis'.comp (by fun_prop)) continuous_id + continuous_const fun x hx => ?_ + have e : (-1 + 2 * (a : ℝ) / a) = 1 := by + rw [mul_div_assoc, div_self ha'] + norm_num + have hx' : x = a := hx + rw [hx', sub_self, mul_zero, zero_div, cis'_zero, e] + simp + +theorem upLoop_zero (ha : 0 < a) : upLoop a l 0 = -1 := by + rw [upLoop_le (by positivity)] + simp + +theorem upLoop_end (ha : 0 < a) (hl : 0 < l) : upLoop a l ((a + l : ℕ) : ℝ) = -1 := by + have hl' : (l : ℝ) ≠ 0 := by exact_mod_cast hl.ne' + rw [upLoop_ge ha (by push_cast; linarith [(Nat.cast_nonneg l : (0 : ℝ) ≤ l)])] + push_cast + rw [show Real.pi * ((a : ℝ) + l - a) / l = Real.pi by field_simp; ring, cis'_pi] + +theorem upLoop_injOn (ha : 0 < a) (hl : 0 < l) : InjOn (upLoop a l) (Ico 0 ((a + l : ℕ) : ℝ)) := by + have ha' : (0 : ℝ) < a := by exact_mod_cast ha + have hl' : (0 : ℝ) < l := by exact_mod_cast hl + have hpi := Real.pi_pos + have harc : ∀ x, (a : ℝ) < x → x < a + l → 0 < (upLoop a l x).im := fun x h1 h2 => by + rw [upLoop_ge ha h1.le] + refine cis'_im_pos (by have := sub_pos.mpr h1; positivity) ?_ + rw [div_lt_iff₀ hl'] + nlinarith + intro x hx y hy he + push_cast at hx hy + rcases le_or_gt x a with h1 | h1 <;> rcases le_or_gt y a with h2 | h2 + · rw [upLoop_le h1, upLoop_le h2] at he + have := Complex.ofReal_injective he + field_simp at this + linarith + · exfalso + have h3 := harc y h2 hy.2 + rw [← he, upLoop_le h1, Complex.ofReal_im] at h3 + exact lt_irrefl _ h3 + · exfalso + have h3 := harc x h1 hx.2 + rw [he, upLoop_le h2, Complex.ofReal_im] at h3 + exact lt_irrefl _ h3 + · rw [upLoop_ge ha h1.le, upLoop_ge ha h2.le] at he + have hb : ∀ x, (a : ℝ) < x → x < a + l → Real.pi * (x - a) / l ∈ Ioc (-Real.pi) Real.pi + := fun x h3 h4 => by + have h5 : 0 < Real.pi * (x - a) / l := by have := sub_pos.mpr h3; positivity + refine ⟨by linarith, ?_⟩ + rw [div_le_iff₀ hl'] + nlinarith + have h3 := cis'_injOn' (hb x h1 hx.2) (hb y h2 hy.2) he + field_simp at h3 + linarith + +theorem upLoop_image (ha : 0 < a) (hl : 0 < l) : + upLoop a l '' Icc 0 ((a + l : ℕ) : ℝ) = discBd (halfD 1) := by + have ha' : (0 : ℝ) < a := by exact_mod_cast ha + have hl' : (0 : ℝ) < l := by exact_mod_cast hl + have hpi := Real.pi_pos + rw [(isClosedDisc_halfD one_ne_zero).2] + ext z + simp only [one_mul] + constructor + · rintro ⟨x, hx, rfl⟩ + push_cast at hx + rcases le_total x a with h | h + · right + rw [upLoop_le h] + refine ⟨?_, by simp⟩ + rw [Complex.norm_real, Real.norm_eq_abs, abs_le] + have h1 : 0 ≤ 2 * x / a := div_nonneg (by linarith [hx.1]) ha'.le + have h2 : 2 * x / a ≤ 2 := by + rw [div_le_iff₀ ha'] + linarith + constructor <;> linarith + · left + rw [upLoop_ge ha h] + refine ⟨norm_cis' _, ?_⟩ + rw [cis'_im] + refine Real.sin_nonneg_of_nonneg_of_le_pi (by have := sub_nonneg.mpr h; positivity) ?_ + rw [div_le_iff₀ hl'] + nlinarith [hx.2] + · rintro (⟨h1, h2⟩ | ⟨h1, h2⟩) + · have h3 : 0 ≤ Complex.arg z := Complex.arg_nonneg_iff.mpr h2 + have h4 := Complex.arg_le_pi z + refine ⟨a + l * Complex.arg z / Real.pi, ⟨by positivity, ?_⟩, ?_⟩ + · push_cast + have : l * Complex.arg z / Real.pi ≤ l := by + rw [div_le_iff₀ hpi] + nlinarith + linarith + · rw [upLoop_ge ha (by have : 0 ≤ l * Complex.arg z / Real.pi := by positivity + linarith)] + rw [show Real.pi * ((a : ℝ) + l * Complex.arg z / Real.pi - a) / l = Complex.arg z by + field_simp + ring] + exact cis'_arg h1 + · have h3 : z = (z.re : ℂ) := Complex.ext rfl (by simp [h2]) + have h4 : |z.re| ≤ 1 := (Complex.abs_re_le_norm z).trans h1 + obtain ⟨h5, h6⟩ := abs_le.mp h4 + refine ⟨a * (z.re + 1) / 2, ⟨by have : 0 ≤ z.re + 1 := by linarith + positivity, ?_⟩, ?_⟩ + · push_cast + nlinarith + · rw [upLoop_le (by nlinarith), h3] + congr 1 + simp only [Complex.ofReal_re] + field_simp + ring + +/-- The upper half disc as a polygon. -/ +theorem exists_up_map (ha : 0 < a) (hl : 0 < l) : + ∃ Φ Φ' : ℂ → ℂ, BdMatch (closedBall 0 1) (halfD 1) Φ Φ' ∧ + ∀ x ∈ Icc (0 : ℝ) (a + l : ℕ), Φ (per (a + l) x) = upLoop a l x := + exists_polygon_map (isClosedDisc_halfD one_ne_zero).1 (by omega) + (continuous_upLoop ha).continuousOn (upLoop_injOn ha hl) + (by rw [upLoop_zero ha, upLoop_end ha hl]) (upLoop_image ha hl) + +theorem circLoop_le {x : ℝ} (hx : x ≤ l) : circLoop l k x = cis' (Real.pi * x / l) := ite_eq_left hx + +theorem circLoop_ge (hl : 0 < l) {x : ℝ} (hx : l ≤ x) : + circLoop l k x = cis' (Real.pi * (x - l) / k - Real.pi) := by + rcases eq_or_lt_of_le hx with rfl | h + · have hl' : (l : ℝ) ≠ 0 := by exact_mod_cast hl.ne' + rw [circLoop_le le_rfl, sub_self, mul_zero, zero_div, zero_sub, + show Real.pi * (l : ℝ) / l = Real.pi by field_simp, cis'_pi] + have := cis'_add_pi (-Real.pi) + rw [neg_add_cancel, cis'_zero] at this + linear_combination -this + · exact ite_eq_right (not_le.mpr h) + +theorem continuous_circLoop (hl : 0 < l) : Continuous (circLoop l k) := by + refine Continuous.if_le (continuous_cis'.comp (by fun_prop)) (continuous_cis'.comp (by fun_prop)) + continuous_id continuous_const fun x hx => ?_ + have hx' : x = l := hx + have h1 := circLoop_ge (k := k) hl (le_of_eq hx'.symm) + rw [circLoop_le (le_of_eq hx')] at h1 + exact h1 + +theorem circLoop_injOn (hl : 0 < l) (hk : 0 < k) : InjOn (circLoop l k) (Ico 0 ((l + k : ℕ) : ℝ)) + := by + have hl' : (0 : ℝ) < l := by exact_mod_cast hl + have hk' : (0 : ℝ) < k := by exact_mod_cast hk + have hpi := Real.pi_pos + let A : ℝ → ℝ := fun x => if x ≤ l then Real.pi * x / l else Real.pi * (x - l) / k - Real.pi + have hA : ∀ x : ℝ, 0 ≤ x → x < (l : ℝ) + k → A x ∈ Ioc (-Real.pi) Real.pi ∧ circLoop l k x = cis' + (A x) := by + intro x h0 h1 + rcases le_or_gt x l with h | h + · simp only [A, ite_eq_left h] + refine ⟨⟨by have : 0 ≤ Real.pi * x / l := by positivity + linarith, ?_⟩, circLoop_le h⟩ + rw [div_le_iff₀ hl'] + nlinarith + · simp only [A, ite_eq_right (not_le.mpr h)] + refine ⟨⟨by have : 0 < Real.pi * (x - l) / k := by have := sub_pos.mpr h; positivity + linarith, ?_⟩, circLoop_ge hl h.le⟩ + have : Real.pi * (x - l) / k ≤ 2 * Real.pi := by + rw [div_le_iff₀ hk'] + nlinarith + linarith + intro x hx y hy he + push_cast at hx hy + obtain ⟨h1, h2⟩ := hA x hx.1 hx.2 + obtain ⟨h3, h4⟩ := hA y hy.1 hy.2 + rw [h2, h4] at he + have h5 := cis'_injOn' h1 h3 he + have hsign : ∀ x : ℝ, 0 ≤ x → x ≤ l → 0 ≤ A x := fun x h6 h7 => by + simp only [A, ite_eq_left h7] + positivity + have hsign' : ∀ x : ℝ, (l : ℝ) < x → x < (l : ℝ) + k → A x < 0 := fun x h6 h7 => by + simp only [A, ite_eq_right (not_le.mpr h6)] + have : Real.pi * (x - l) / k < Real.pi := by + rw [div_lt_iff₀ hk'] + nlinarith + linarith + rcases le_or_gt x l with h6 | h6 <;> rcases le_or_gt y l with h7 | h7 + · simp only [A, ite_eq_left h6, ite_eq_left h7] at h5 + field_simp at h5 + exact h5 + · exfalso + linarith [hsign x hx.1 h6, hsign' y h7 hy.2] + · exfalso + linarith [hsign y hy.1 h7, hsign' x h6 hx.2] + · simp only [A, ite_eq_right (not_le.mpr h6), ite_eq_right (not_le.mpr h7)] at h5 + have : Real.pi * (x - l) / k = Real.pi * (y - l) / k := by linarith + field_simp at this + linarith + +theorem circLoop_image (hl : 0 < l) (hk : 0 < k) : + circLoop l k '' Icc 0 ((l + k : ℕ) : ℝ) = discBd (closedBall (0 : ℂ) 1) := by + have hl' : (0 : ℝ) < l := by exact_mod_cast hl + have hk' : (0 : ℝ) < k := by exact_mod_cast hk + have hpi := Real.pi_pos + rw [isClosedDisc_closedBall.2] + ext z + constructor + · rintro ⟨x, hx, rfl⟩ + rcases le_total x l with h | h + · rw [circLoop_le h] + exact cis'_mem_sphere _ + · rw [circLoop_ge hl h] + exact cis'_mem_sphere _ + · intro hz + have hn : ‖z‖ = 1 := mem_sphere_zero_iff_norm.mp hz + have h1 := Complex.arg_le_pi z + have h2 := Complex.neg_pi_lt_arg z + rcases le_total 0 (Complex.arg z) with h | h + · refine ⟨l * Complex.arg z / Real.pi, ⟨by positivity, ?_⟩, ?_⟩ + · push_cast + rw [div_le_iff₀ hpi] + nlinarith + · rw [circLoop_le (by rw [div_le_iff₀ hpi]; nlinarith)] + rw [show Real.pi * ((l : ℝ) * Complex.arg z / Real.pi) / l = Complex.arg z by + field_simp] + exact cis'_arg hn + · have h3 : 0 ≤ Complex.arg z + Real.pi := by linarith + refine ⟨l + k * (Complex.arg z + Real.pi) / Real.pi, ⟨by positivity, ?_⟩, ?_⟩ + · push_cast + have : k * (Complex.arg z + Real.pi) / Real.pi ≤ k := by + rw [div_le_iff₀ hpi] + nlinarith + linarith + · rw [circLoop_ge hl (by have : 0 ≤ k * (Complex.arg z + Real.pi) / Real.pi := by positivity + linarith)] + rw [show Real.pi * ((l : ℝ) + k * (Complex.arg z + Real.pi) / Real.pi - l) / k - Real.pi + = Complex.arg z by field_simp; ring] + exact cis'_arg hn + +theorem circLoop_zero (hk : 0 < k) (hl : 0 < l) : circLoop l k 0 = circLoop l k ((l + k : ℕ) : ℝ) + := by + have hk' : (k : ℝ) ≠ 0 := by exact_mod_cast hk.ne' + rw [circLoop_le (by positivity), circLoop_ge hl (by push_cast; linarith [(Nat.cast_nonneg k : + (0 : ℝ) ≤ k)])] + push_cast + rw [show Real.pi * ((l : ℝ) + k - l) / k - Real.pi = 0 by field_simp; ring] + simp + +/-- The unit disc as a polygon, with sides on the two half circles. -/ +theorem exists_circ_map (hl : 0 < l) (hk : 0 < k) : + ∃ Φ Φ' : ℂ → ℂ, BdMatch (closedBall 0 1) (closedBall 0 1) Φ Φ' ∧ + ∀ x ∈ Icc (0 : ℝ) (l + k : ℕ), Φ (per (l + k) x) = circLoop l k x := + exists_polygon_map isClosedDisc_closedBall.1 (by omega) (continuous_circLoop hl).continuousOn + (circLoop_injOn hl hk) (circLoop_zero hk hl) (circLoop_image hl hk) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Polygon.lean b/LeanPool/GraphMinor/Surface/Polygon.lean new file mode 100644 index 0000000000..77b4d01ada --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Polygon.lean @@ -0,0 +1,310 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.PushOff + +/-! +# Polygons with sides pasted by labels + +A word is a list of letters, and a letter is a label with a sign. A family of words `W : ℕ → List +Letter` +stands for a family of round polygons, one for each nonempty word, where a word of length `n` gives +the unit disc +with `n` sides on its boundary. Sides with the same label are pasted, by the parameter `t`: the sign +says if `t` +runs along the side or against it. + +`Presents T W f` says that `f` maps the discs onto `T`, and that two points have the same image +exactly when +the pasting relates them. This is a description of `T` by `W`. If `W` and `W'` have a map `θ` of the +discs that +is compatible with the pasting (`Presents.of_map`, `Presents.map`), then they present the same +spaces. So all the +moves on words of the later files need only such a map. + +The file also has the polygon lemma `exists_polygon_map`: the unit disc goes to any closed disc of +the plane with +prescribed values on the boundary. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +local notation "𝕀" => unitInterval + +universe u + +/-- A label with a sign. -/ +abbrev Letter := ℕ × Bool + +/-- The point at position `x` of the boundary of the round polygon with `m` sides. -/ +noncomputable def per (m : ℕ) (x : ℝ) : ℂ := cis' (2 * Real.pi * x / m) + +/-- The point with parameter `t` on the side at position `p` with sign `b`. -/ +noncomputable def sdPt (n p : ℕ) (b : Bool) (t : ℝ) : ℂ := per n (p + if b then t else 1 - t) + +theorem continuous_per (m : ℕ) : Continuous (per m) := + continuous_cis'.comp (by fun_prop) + +theorem norm_per (m : ℕ) (x : ℝ) : ‖per m x‖ = 1 := norm_cis' _ + +theorem per_add_self {m : ℕ} (hm : m ≠ 0) (x : ℝ) : per m (x + m) = per m x := by + have h : (m : ℝ) ≠ 0 := by exact_mod_cast hm + rw [per, per, show 2 * Real.pi * (x + m) / m = 2 * Real.pi * x / m + 2 * Real.pi by field_simp, + cis'_period] + +/-- The discs of the family `W`. -/ +def Dsk (W : ℕ → List Letter) : Set (ℕ × ℂ) := {a | W a.1 ≠ [] ∧ ‖a.2‖ ≤ 1} + +/-- One step of pasting: two points with the same parameter on two sides with the same label. -/ +def Stp (W : ℕ → List Letter) (a b : ℕ × ℂ) : Prop := + ∃ (i j p q k : ℕ) (ε ε' : Bool) (t : ℝ), (W i)[p]? = some (k, ε) ∧ (W j)[q]? = some (k, ε') ∧ + (i, p) ≠ (j, q) ∧ t ∈ Icc (0 : ℝ) 1 ∧ a = (i, sdPt (W i).length p ε t) ∧ + b = (j, sdPt (W j).length q ε' t) + +/-- The pasting relation. -/ +abbrev PRel (W : ℕ → List Letter) : ℕ × ℂ → ℕ × ℂ → Prop := Relation.EqvGen (Stp W) + +/-- `f` describes `T` as the discs of `W` with the pasting. -/ +def Presents {T : Type u} [TopologicalSpace T] (W : ℕ → List Letter) (f : ℕ × ℂ → T) : Prop := + ContinuousOn f (Dsk W) ∧ f '' Dsk W = univ ∧ ∀ a ∈ Dsk W, ∀ b ∈ Dsk W, f a = f b ↔ PRel W a b + +theorem isCompact_Dsk {W : ℕ → List Letter} (hW : {i | W i ≠ []}.Finite) : IsCompact (Dsk W) := by + have h : Dsk W = ⋃ i ∈ {i | W i ≠ []}, ({i} : Set ℕ) ×ˢ closedBall (0 : ℂ) 1 := by + ext ⟨i, z⟩ + simp [Dsk] + rw [h] + exact hW.isCompact_biUnion fun i _ => isCompact_singleton.prod (isCompact_closedBall _ _) + +theorem Stp.mem_Dsk {W : ℕ → List Letter} {a b : ℕ × ℂ} (h : Stp W a b) : a ∈ Dsk W ∧ b ∈ Dsk W + := by + obtain ⟨i, j, p, q, k, ε, ε', t, h1, h2, -, -, rfl, rfl⟩ := h + refine ⟨⟨fun he => ?_, (norm_per _ _).le⟩, ⟨fun he => ?_, (norm_per _ _).le⟩⟩ + · simp [he] at h1 + · simp [he] at h2 + +theorem prel_mem_iff {W : ℕ → List Letter} {a b : ℕ × ℂ} (h : PRel W a b) : a ∈ Dsk W ↔ b ∈ Dsk W + := by + induction h with + | rel _ _ h => exact iff_of_true h.mem_Dsk.1 h.mem_Dsk.2 + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + +/-- The conditions under which a map of discs is compatible with the pasting. -/ +structure IsPolyMap (W W' : ℕ → List Letter) (θ : ℕ × ℂ → ℕ × ℂ) : Prop where + cont : ContinuousOn θ (Dsk W') + maps : MapsTo θ (Dsk W') (Dsk W) + surj : Dsk W ⊆ θ '' Dsk W' + /-- Points with the same image are related. -/ + fib : ∀ a ∈ Dsk W', ∀ b ∈ Dsk W', θ a = θ b → PRel W' a b + /-- A step below comes from related points above. -/ + lift : ∀ u v, Stp W u v → ∃ a ∈ Dsk W', ∃ b ∈ Dsk W', θ a = u ∧ θ b = v ∧ PRel W' a b + /-- A step above goes to related points. -/ + push : ∀ a b, Stp W' a b → PRel W (θ a) (θ b) + +theorem IsPolyMap.rel_iff {W W' : ℕ → List Letter} {θ : ℕ × ℂ → ℕ × ℂ} (h : IsPolyMap W W' θ) + {a b : ℕ × ℂ} (ha : a ∈ Dsk W') (hb : b ∈ Dsk W') : PRel W (θ a) (θ b) ↔ PRel W' a b := by + constructor + · intro hr + have key : ∀ u v, PRel W u v → u ∈ Dsk W → + ∀ a ∈ Dsk W', ∀ b ∈ Dsk W', θ a = u → θ b = v → PRel W' a b := by + intro u v huv + induction huv with + | rel u v hs => + intro _ a ha b hb hau hbv + obtain ⟨a', ha', b', hb', e1, e2, hr⟩ := h.lift u v hs + exact .trans _ _ _ (h.fib a ha a' ha' (hau.trans e1.symm)) + (.trans _ _ _ hr (h.fib b' hb' b hb (e2.trans hbv.symm))) + | refl u => + intro _ a ha b hb hau hbv + exact h.fib a ha b hb (hau.trans hbv.symm) + | symm u v huv ih => + intro hv a ha b hb hav hbu + exact .symm _ _ (ih ((prel_mem_iff huv).mpr hv) b hb a ha hbu hav) + | trans u v w huv hvw ih1 ih2 => + intro hu a ha b hb hau hbw + have hv : v ∈ Dsk W := (prel_mem_iff huv).mp hu + obtain ⟨c, hc, rfl⟩ := h.surj hv + exact .trans _ _ _ (ih1 hu a ha c hc hau rfl) (ih2 hv c hc b hb rfl hbw) + exact key _ _ hr (h.maps ha) a ha b hb rfl rfl + · intro hr + induction hr with + | rel _ _ hs => exact h.push _ _ hs + | refl _ => exact .refl _ + | symm _ _ _ ih => exact .symm _ _ (ih hb ha) + | trans _ c _ h1 _ ih1 ih2 => + have hc : c ∈ Dsk W' := (prel_mem_iff h1).mp ha + exact .trans _ _ _ (ih1 ha hc) (ih2 hc hb) + +variable {T : Type u} [TopologicalSpace T] + +/-- A presentation by `W` gives a presentation by `W'`, through a map of discs. -/ +theorem Presents.of_map {W W' : ℕ → List Letter} {θ : ℕ × ℂ → ℕ × ℂ} (hθ : IsPolyMap W W' θ) + {f : ℕ × ℂ → T} (hf : Presents W f) : Presents W' (f ∘ θ) := by + obtain ⟨h1, h2, h3⟩ := hf + refine ⟨h1.comp hθ.cont hθ.maps, ?_, fun a ha b hb => ?_⟩ + · rw [image_comp, Subset.antisymm hθ.maps.image_subset hθ.surj, h2] + · rw [Function.comp_apply, Function.comp_apply, h3 _ (hθ.maps ha) _ (hθ.maps hb), + hθ.rel_iff ha hb] + +/-- A presentation by `W'` gives a presentation by `W`, through a map of discs. -/ +theorem Presents.map' {W W' : ℕ → List Letter} {θ : ℕ × ℂ → ℕ × ℂ} + (hθ : IsPolyMap W W' θ) + (hW' : {i | W' i ≠ []}.Finite) {f : ℕ × ℂ → T} (hf : Presents W' f) : + ∃ g : ℕ × ℂ → T, Presents W g ∧ ∀ a ∈ Dsk W', g (θ a) = f a := by + classical + obtain ⟨h1, h2, h3⟩ := hf + have hsec : ∀ u ∈ Dsk W, ∃ a ∈ Dsk W', θ a = u := fun u hu => hθ.surj hu + choose! σ hσ1 hσ2 using hsec + have hval : ∀ a ∈ Dsk W', f (σ (θ a)) = f a := fun a ha => by + have hm := hθ.maps ha + rw [h3 _ (hσ1 _ hm) _ ha, ← hθ.rel_iff (hσ1 _ hm) ha, hσ2 _ hm] + exact .refl _ + have hcomp := isCompact_Dsk hW' + refine ⟨f ∘ σ, ⟨?_, ?_, fun u hu v hv => ?_⟩, hval⟩ + · rw [continuousOn_iff_isClosed] + intro C hC + have hcl : IsCompact (Dsk W' ∩ f ⁻¹' C) := + hcomp.of_isClosed_subset (h1.preimage_isClosed_of_isClosed hcomp.isClosed hC) + inter_subset_left + refine ⟨θ '' (Dsk W' ∩ f ⁻¹' C), (hcl.image_of_continuousOn + (hθ.cont.mono inter_subset_left)).isClosed, ?_⟩ + ext u + constructor + · rintro ⟨hu, huC⟩ + exact ⟨⟨σ u, ⟨hσ1 u huC, hu⟩, hσ2 u huC⟩, huC⟩ + · rintro ⟨⟨a, ⟨ha, hC'⟩, rfl⟩, hu⟩ + refine ⟨?_, hu⟩ + change f (σ (θ a)) ∈ C + rw [hval a ha] + exact hC' + · rw [eq_univ_iff_forall] + intro y + obtain ⟨a, ha, rfl⟩ := h2.ge (mem_univ y) + exact ⟨θ a, hθ.maps ha, hval a ha⟩ + · rw [Function.comp_apply, Function.comp_apply, h3 _ (hσ1 _ hu) _ (hσ1 _ hv), + ← hθ.rel_iff (hσ1 _ hu) (hσ1 _ hv), hσ2 _ hu, hσ2 _ hv] + +/-- A presentation by `W'` gives a presentation by `W`, through a map of discs. -/ +theorem Presents.map {W W' : ℕ → List Letter} {θ : ℕ × ℂ → ℕ × ℂ} + (hθ : IsPolyMap W W' θ) + (hW' : {i | W' i ≠ []}.Finite) {f : ℕ × ℂ → T} (hf : Presents W' f) : + ∃ g : ℕ × ℂ → T, Presents W g := + (hf.map' hθ hW').imp fun _ h => h.1 + +/-- **Polygon lemma.** A closed disc of the plane, with boundary a loop `β` on `[0, m]`, is the +image of the unit +disc by a map with values `β` on the boundary. -/ +theorem exists_polygon_map {K : Set ℂ} (hK : IsClosedDisc K) {m : ℕ} (hm : 0 < m) {β : ℝ → ℂ} + (hc : ContinuousOn β (Icc 0 m)) (hi : InjOn β (Ico 0 m)) (h0 : β 0 = β m) + (hr : β '' Icc 0 m = discBd K) : + ∃ Φ Φ' : ℂ → ℂ, BdMatch (closedBall 0 1) K Φ Φ' ∧ ∀ x ∈ Icc (0 : ℝ) m, Φ (per m x) = β x := by + classical + have hm' : (0 : ℝ) < m := by exact_mod_cast hm + have hpi := Real.pi_pos + let J := Icc (0 : ℝ) m + let q : J → Circle := fun x => Circle.exp (2 * Real.pi * x.1 / m) + have hq : Continuous q := by fun_prop + have hcoe : ∀ x : J, (q x : ℂ) = per m x.1 := fun x => by + simp only [q, per, cis', Circle.coe_exp] + have : CompactSpace J := isCompact_iff_compactSpace.mp isCompact_Icc + have hqs : Function.Surjective q := fun w => by + obtain ⟨t, ht, hw⟩ := exists_circle_angle 1 w + refine ⟨⟨t * m / (2 * Real.pi), by have := ht.1; positivity, ?_⟩, ?_⟩ + · rw [div_le_iff₀ (by positivity)] + nlinarith [ht.2] + · simp only [q] + rw [hw, one_mul] + congr 1 + field_simp + have hqeq : ∀ x y : J, q x = q y → x.1 = y.1 ∨ (x.1 = 0 ∧ y.1 = m) ∨ (x.1 = m ∧ y.1 = 0) := by + intro x y he + obtain ⟨k, hk⟩ := Circle.exp_eq_exp.mp he + have h1 : x.1 = y.1 + k * m := by + field_simp at hk + nlinarith + have hx := x.2 + have hy := y.2 + have h2 : (-1 : ℝ) * m ≤ k * m := by nlinarith [hx.1, hy.2] + have h3 : (k : ℝ) * m ≤ 1 * m := by nlinarith [hx.2, hy.1] + have h4 : (-1 : ℝ) ≤ k := le_of_mul_le_mul_right h2 hm' + have h5 : (k : ℝ) ≤ 1 := le_of_mul_le_mul_right h3 hm' + have h6 : -1 ≤ k := by exact_mod_cast h4 + have h7 : k ≤ 1 := by exact_mod_cast h5 + have h8 : k = -1 ∨ k = 0 ∨ k = 1 := by omega + rcases h8 with rfl | rfl | rfl + · right; left + push_cast at h1 + constructor <;> linarith [hx.1, hy.2] + · left + simpa using h1 + · right; right + push_cast at h1 + constructor <;> linarith [hx.2, hy.1] + let b : Circle → ℂ := fun w => β (Function.surjInv hqs w).1 + have hbq : ∀ x : J, b (q x) = β x.1 := fun x => by + have h1 := Function.surjInv_eq hqs (q x) + rcases hqeq _ _ h1 with h2 | ⟨h2, h3⟩ | ⟨h2, h3⟩ + · simp only [b, h2] + · simp only [b, h2, h3, h0] + · simp only [b, h2, h3, h0] + have hbc : Continuous b := by + rw [(hq.isClosedMap.isQuotientMap hq hqs).continuous_iff] + have : b ∘ q = fun x : J => β x.1 := funext hbq + rw [this] + exact hc.comp_continuous continuous_subtype_val fun x => x.2 + have hbi : Function.Injective b := by + intro w w' he + obtain ⟨x, rfl⟩ := hqs w + obtain ⟨y, rfl⟩ := hqs w' + rw [hbq, hbq] at he + have key : ∀ z : J, ∃ z' : J, q z' = q z ∧ z'.1 < m := fun z => by + by_cases hz : z.1 < m + · exact ⟨z, rfl, hz⟩ + · have hzm : z.1 = m := le_antisymm z.2.2 (not_lt.mp hz) + refine ⟨⟨0, le_rfl, hm'.le⟩, ?_, hm'⟩ + simp only [q, hzm] + rw [show 2 * Real.pi * (m : ℝ) / m = 2 * Real.pi by field_simp, Circle.exp_two_pi] + simp + obtain ⟨x', e1, h1⟩ := key x + obtain ⟨y', e2, h2⟩ := key y + have e3 : β x'.1 = β y'.1 := by rw [← hbq, ← hbq, e1, e2, hbq, hbq, he] + have e4 := hi ⟨x'.2.1, h1⟩ ⟨y'.2.1, h2⟩ e3 + rw [← e1, ← e2, Subtype.ext e4] + have hrange : range b = discBd K := by + rw [← hr] + ext z + constructor + · rintro ⟨w, rfl⟩ + obtain ⟨x, rfl⟩ := hqs w + exact ⟨x.1, x.2, (hbq x).symm⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨q ⟨x, hx⟩, hbq _⟩ + have hemb : IsEmbedding b := (hbc.isClosedEmbedding hbi).isEmbedding + let e : Circle ≃ₜ discBd K := hemb.toHomeomorph.trans (Homeomorph.setCongr hrange) + have he : ∀ w, (e w).1 = b w := fun _ => rfl + obtain ⟨o, ho⟩ := exists_circle_sphere + have hG : Nonempty (Circle ≃ₜ discBd K) := ⟨e⟩ + obtain ⟨h₀, k₀, m₀, hv₀⟩ := exists_bdMatch (o.symm.trans e) + obtain ⟨ψ, χ, mm, hψ⟩ := exists_bdMatch_closedInner ⟨o⟩ hG m₀ + rw [closedInner_sphere, ← eq_closedInner_of_discBd hG hK rfl] at mm + refine ⟨ψ, χ, mm, fun x hx => ?_⟩ + have h1 : per m x ∈ sphere (0 : ℂ) 1 := mem_sphere_zero_iff_norm.mpr (norm_per _ _) + rw [hψ h1] + have h2 : (o (q ⟨x, hx⟩)).1 = per m x := by rw [ho, hcoe] + rw [← h2, hv₀] + simp only [Homeomorph.trans_apply, Homeomorph.symm_apply_apply] + rw [he, hbq] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/PushOff.lean b/LeanPool/GraphMinor/Surface/PushOff.lean new file mode 100644 index 0000000000..f35a95bbba --- /dev/null +++ b/LeanPool/GraphMinor/Surface/PushOff.lean @@ -0,0 +1,1355 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.MoveCuff +public import LeanPool.GraphMinor.Surface.DiscArcs + +/-! +# Pushing a closed set off discs + +`push_off : PushOffStatement`. Cap all cuffs, so that the boundary of a disc `D` consists of +interior points. A +larger disc around `D` with `D` as the unit disc (`exists_disc_collar`) lets us work in the plane. +If the line +`L` is the lower half of the unit circle, then near each point of the upper half circle there is +room outside +`D`, which is as thin as we like and goes to zero at the two ends. Vertical stretching maps a thin +lens along `L` +that misses the set onto `D` (`exists_vertical_push`). A chord splits `D` into two discs, which we +treat one +after the other. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +local notation "𝕀" => unitInterval + +universe u + +/-- The tent function with peak `1` at `l`, that is zero outside `(β, t)`. -/ +noncomputable def tent (β l t y : ℝ) : ℝ := max 0 (min ((y - β) / (l - β)) ((t - y) / (t - l))) + +/-- The piecewise linear map that fixes `β` and `t`, and moves `l` to `w`. -/ +noncomputable def tentMap (β l w t y : ℝ) : ℝ := y + (w - l) * tent β l t y + +theorem tent_left {β l t y : ℝ} (h1 : β < l) (h2 : l < t) (h3 : β ≤ y) (h4 : y ≤ l) : + tent β l t y = (y - β) / (l - β) := by + have h5 : 0 < l - β := by linarith + have h6 : 0 < t - l := by linarith + have h7 : (y - β) / (l - β) ≤ 1 := (div_le_one h5).mpr (by linarith) + have h8 : 1 ≤ (t - y) / (t - l) := (one_le_div h6).mpr (by linarith) + have h9 : 0 ≤ (y - β) / (l - β) := div_nonneg (by linarith) h5.le + rw [tent, min_eq_left (h7.trans h8), max_eq_right h9] + +theorem tent_right {β l t y : ℝ} (h1 : β < l) (h2 : l < t) (h3 : l ≤ y) (h4 : y ≤ t) : + tent β l t y = (t - y) / (t - l) := by + have h5 : 0 < l - β := by linarith + have h6 : 0 < t - l := by linarith + have h7 : (t - y) / (t - l) ≤ 1 := (div_le_one h6).mpr (by linarith) + have h8 : 1 ≤ (y - β) / (l - β) := (one_le_div h5).mpr (by linarith) + have h9 : 0 ≤ (t - y) / (t - l) := div_nonneg (by linarith) h6.le + rw [tent, min_eq_right (h7.trans h8), max_eq_right h9] + +theorem tent_low {β l t y : ℝ} (h1 : β < l) (_h2 : l < t) (h3 : y ≤ β) : tent β l t y = 0 := by + have h5 : 0 < l - β := by linarith + have h9 : (y - β) / (l - β) ≤ 0 := div_nonpos_of_nonpos_of_nonneg (by linarith) h5.le + rw [tent, max_eq_left ((min_le_left _ _).trans h9)] + +theorem tent_high {β l t y : ℝ} (_h1 : β < l) (h2 : l < t) (h3 : t ≤ y) : tent β l t y = 0 := by + have h5 : 0 < t - l := by linarith + have h9 : (t - y) / (t - l) ≤ 0 := div_nonpos_of_nonpos_of_nonneg (by linarith) h5.le + rw [tent, max_eq_left ((min_le_right _ _).trans h9)] + +theorem tent_nonneg (β l t y : ℝ) : 0 ≤ tent β l t y := le_max_left _ _ + +theorem tent_le_one {β l t y : ℝ} (h1 : β < l) (h2 : l < t) : tent β l t y ≤ 1 := by + rcases le_total y β with h | h + · rw [tent_low h1 h2 h] + exact zero_le_one + rcases le_total y l with h' | h' + · rw [tent_left h1 h2 h h'] + exact (div_le_one (by linarith)).mpr (by linarith) + rcases le_total y t with h'' | h'' + · rw [tent_right h1 h2 h' h''] + exact (div_le_one (by linarith)).mpr (by linarith) + · rw [tent_high h1 h2 h''] + exact zero_le_one + +theorem tentMap_inv {β l w t y : ℝ} (h1 : β < l) (h2 : l < t) (h3 : β < w) (h4 : w < t) : + tentMap β w l t (tentMap β l w t y) = y := by + rcases le_total y β with h | h + · have e1 : tentMap β l w t y = y := by + rw [tentMap, tent_low h1 h2 h, mul_zero, add_zero] + rw [e1, tentMap, tent_low h3 h4 h, mul_zero, add_zero] + rcases le_total y l with h' | h' + · have e1 : tentMap β l w t y = β + (y - β) * (w - β) / (l - β) := by + rw [tentMap, tent_left h1 h2 h h'] + field_simp [show l - β ≠ 0 by linarith] + ring + have h5 : 0 < l - β := by linarith + have h6 : 0 ≤ (y - β) / (l - β) := div_nonneg (by linarith) h5.le + have h7 : (y - β) / (l - β) ≤ 1 := (div_le_one h5).mpr (by linarith) + have e2 : β + (y - β) * (w - β) / (l - β) = β + (y - β) / (l - β) * (w - β) := by ring + have h8 : β ≤ tentMap β l w t y := by + rw [e1, e2] + nlinarith + have h9 : tentMap β l w t y ≤ w := by + rw [e1, e2] + nlinarith + rw [tentMap, tent_left h3 h4 h8 h9, e1] + field_simp [show l - β ≠ 0 by linarith, show w - β ≠ 0 by linarith] + ring + rcases le_total y t with h'' | h'' + · have e1 : tentMap β l w t y = t - (t - y) * (t - w) / (t - l) := by + rw [tentMap, tent_right h1 h2 h' h''] + field_simp [show t - l ≠ 0 by linarith] + ring + have h5 : 0 < t - l := by linarith + have h6 : 0 ≤ (t - y) / (t - l) := div_nonneg (by linarith) h5.le + have h7 : (t - y) / (t - l) ≤ 1 := (div_le_one h5).mpr (by linarith) + have e2 : t - (t - y) * (t - w) / (t - l) = t - (t - y) / (t - l) * (t - w) := by ring + have h8 : w ≤ tentMap β l w t y := by + rw [e1, e2] + nlinarith + have h9 : tentMap β l w t y ≤ t := by + rw [e1, e2] + nlinarith + rw [tentMap, tent_right h3 h4 h8 h9, e1] + field_simp [show t - l ≠ 0 by linarith, show t - w ≠ 0 by linarith] + ring + · have e1 : tentMap β l w t y = y := by + rw [tentMap, tent_high h1 h2 h'', mul_zero, add_zero] + rw [e1, tentMap, tent_high h3 h4 h'', mul_zero, add_zero] + +theorem w_lt_tentMap {β l w t y : ℝ} (h1 : β < l) (h2 : l < t) (h4 : w < t) (h5 : l < y) : + w < tentMap β l w t y := by + rcases le_total y t with h | h + · have e1 : tentMap β l w t y = t - (t - y) / (t - l) * (t - w) := by + rw [tentMap, tent_right h1 h2 h5.le h] + field_simp [show t - l ≠ 0 by linarith] + ring + have h6 : 0 < t - l := by linarith + have h7 : (t - y) / (t - l) < 1 := (div_lt_one h6).mpr (by linarith) + rw [e1] + nlinarith + · rw [tentMap, tent_high h1 h2 h, mul_zero, add_zero] + linarith + +/-- The pattern of the four functions of a vertical push: `β < l, w < t` over `(-1, 1)`, all equal +elsewhere. -/ +def IsPushData (β l w t : ℝ → ℝ) : Prop := + Continuous β ∧ Continuous l ∧ Continuous w ∧ Continuous t ∧ + (∀ x, |x| < 1 → β x < l x ∧ l x < t x ∧ β x < w x ∧ w x < t x) ∧ + ∀ x, 1 ≤ |x| → β x = l x ∧ l x = w x ∧ w x = t x + +theorem IsPushData.symm {β l w t : ℝ → ℝ} (h : IsPushData β l w t) : IsPushData β w l t := by + obtain ⟨hβ, hl, hw, ht, h5, h6⟩ := h + refine ⟨hβ, hw, hl, ht, fun x hx => ?_, fun x hx => ?_⟩ + · obtain ⟨a1, a2, a3, a4⟩ := h5 x hx + exact ⟨a3, a4, a1, a2⟩ + · obtain ⟨a1, a2, a3⟩ := h6 x hx + exact ⟨a1.trans a2, a2.symm, a2.trans a3⟩ + +theorem IsPushData.continuous_tent {β l w t : ℝ → ℝ} (h : IsPushData β l w t) : + Continuous fun z : ℂ => (z.im + (w z.re - l z.re) * tent (β z.re) (l z.re) (t z.re) z.im) := by + obtain ⟨hβ, hl, hw, ht, h5, h6⟩ := h + rw [continuous_iff_continuousAt] + intro z + have hre : Continuous Complex.re := Complex.continuous_re + have him : Continuous Complex.im := Complex.continuous_im + refine him.continuousAt.add ?_ + rcases lt_or_ge |z.re| 1 with hz | hz + · obtain ⟨a1, a2, -, -⟩ := h5 _ hz + have hc1 : ContinuousAt (fun z : ℂ => l z.re - β z.re) z := + ((hl.comp hre).sub (hβ.comp hre)).continuousAt + have hc2 : ContinuousAt (fun z : ℂ => t z.re - l z.re) z := + ((ht.comp hre).sub (hl.comp hre)).continuousAt + have hc3 : ContinuousAt (fun z : ℂ => z.im - β z.re) z := + (him.sub (hβ.comp hre)).continuousAt + have hc4 : ContinuousAt (fun z : ℂ => t z.re - z.im) z := + ((ht.comp hre).sub him).continuousAt + have hm : ContinuousAt (fun z : ℂ => tent (β z.re) (l z.re) (t z.re) z.im) z := + continuousAt_const.max + ((hc3.div hc1 (sub_ne_zero.mpr a1.ne')).min + (hc4.div hc2 (sub_ne_zero.mpr a2.ne'))) + exact ((hw.comp hre).sub (hl.comp hre)).continuousAt.mul hm + · have h0 := h6 _ hz + have hv : (w z.re - l z.re) * tent (β z.re) (l z.re) (t z.re) z.im = 0 := by + rw [h0.2.1.symm] + ring + rw [ContinuousAt, hv] + have hb : ∀ u : ℂ, ‖(w u.re - l u.re) * tent (β u.re) (l u.re) (t u.re) u.im‖ + ≤ |w u.re - l u.re| := by + intro u + rw [norm_mul, Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (tent_nonneg _ _ _ _)] + refine mul_le_of_le_one_right (abs_nonneg _) ?_ + rcases lt_or_ge |u.re| 1 with hu | hu + · obtain ⟨a1, a2, -, -⟩ := h5 _ hu + exact tent_le_one a1 a2 + · obtain ⟨a1, a2, a3⟩ := h6 _ hu + have a4 : t u.re = l u.re := by rw [← a3, a2] + rw [a1, a4] + simp [tent] + refine squeeze_zero_norm hb ?_ + have : Continuous fun u : ℂ => |w u.re - l u.re| := ((hw.comp hre).sub (hl.comp hre)).abs + have h7 := this.tendsto z + simpa [h0.2.1] using h7 + +/-- A push of the plane along vertical lines. -/ +theorem exists_vertical_push {β l w t : ℝ → ℝ} (h : IsPushData β l w t) : + ∃ Θ : ℂ ≃ₜ ℂ, (∀ z, (Θ z).re = z.re) ∧ + ∀ z, (Θ z).im = tentMap (β z.re) (l z.re) (w z.re) (t z.re) z.im := by + have key : ∀ {β l w t : ℝ → ℝ}, IsPushData β l w t → Continuous fun z : ℂ => + (⟨z.re, tentMap (β z.re) (l z.re) (w z.re) (t z.re) z.im⟩ : ℂ) := fun {β l w t} h => + Complex.equivRealProdCLM.symm.continuous.comp (Complex.continuous_re.prodMk h.continuous_tent) + have hinv : ∀ {β l w t : ℝ → ℝ}, IsPushData β l w t → ∀ x y : ℝ, + tentMap (β x) (w x) (l x) (t x) (tentMap (β x) (l x) (w x) (t x) y) = y := by + intro β l w t h x y + obtain ⟨-, -, -, -, h5, h6⟩ := h + rcases lt_or_ge |x| 1 with hx | hx + · obtain ⟨a1, a2, a3, a4⟩ := h5 x hx + exact tentMap_inv a1 a2 a3 a4 + · obtain ⟨a1, a2, a3⟩ := h6 x hx + simp [tentMap, a2] + refine ⟨{ toFun := fun z => ⟨z.re, tentMap (β z.re) (l z.re) (w z.re) (t z.re) z.im⟩ + invFun := fun z => ⟨z.re, tentMap (β z.re) (w z.re) (l z.re) (t z.re) z.im⟩ + left_inv := fun z => Complex.ext rfl (hinv h z.re z.im) + right_inv := fun z => Complex.ext rfl (hinv h.symm z.re z.im) + continuous_toFun := key h + continuous_invFun := key h.symm }, fun z => rfl, fun z => rfl⟩ + +section extend + +variable {T : Type u} [TopologicalSpace T] [T2Space T] + +/-- A homeomorphism of the plane that is the identity on the sphere of radius `2` moves over to the +disc +`c` parametrizes, and to the identity outside. -/ +theorem exists_homeomorph_of_collar (hman : ∀ x : T, IsManifoldPoint x) {E : Set T} + (hE : IsClosedDisc E) + {c : ℂ → T} {c' : T → ℂ} (hcc : ContinuousOn c (closedBall 0 2)) (hcc' : ContinuousOn c' E) + (hcm : MapsTo c (closedBall 0 2) E) (hcm' : MapsTo c' E (closedBall 0 2)) + (hl : LeftInvOn c' c (closedBall 0 2)) (hr : RightInvOn c' c E) (hs : c '' sphere 0 2 + = discBd E) + (Θ : ℂ ≃ₜ ℂ) (hΘ : ∀ z, 3 / 2 ≤ ‖z‖ → Θ z = z) : + ∃ h : T ≃ₜ T, (∀ z ∈ closedBall (0 : ℂ) 2, h (c z) = c (Θ z)) ∧ ∀ x ∉ E, h x = x := by + classical + have hmap : ∀ {Θ : ℂ ≃ₜ ℂ}, (∀ z, 3 / 2 ≤ ‖z‖ → Θ z = z) → MapsTo Θ (closedBall 0 2) + (closedBall 0 2) := by + intro Θ hΘ z hz + by_contra hcon + have h1 : 2 < ‖Θ z‖ := by + rw [mem_closedBall_zero_iff, not_le] at hcon + exact hcon + have h2 := hΘ (Θ z) (by linarith) + have h3 := Θ.injective h2 + rw [h3] at h1 + linarith [mem_closedBall_zero_iff.mp hz] + have hsym : ∀ z, 3 / 2 ≤ ‖z‖ → Θ.symm z = z := fun z hz => by + rw [Homeomorph.symm_apply_eq, hΘ z hz] + have hEc := hE.isClosed + have hIo := hE.isOpen_discInt hman + have key : ∀ {Θ : ℂ ≃ₜ ℂ}, (∀ z, 3 / 2 ≤ ‖z‖ → Θ z = z) → + Continuous fun x => if x ∈ E then c (Θ (c' x)) else x := by + intro Θ hΘ + rw [← continuousOn_univ] + have huniv : E ∪ (discInt E)ᶜ = univ := by + rw [eq_univ_iff_forall] + intro x + by_cases hx : x ∈ discInt E + · exact .inl (discInt_subset E hx) + · exact .inr hx + rw [← huniv] + refine ContinuousOn.union_of_isClosed ?_ ?_ hEc hIo.isClosed_compl + · refine ContinuousOn.congr (f := fun x => c (Θ (c' x))) ?_ fun x hx => ite_eq_left hx + exact hcc.comp (Θ.continuous.comp_continuousOn hcc') fun x hx => hmap hΘ (hcm' hx) + · refine continuousOn_id.congr fun x hx => ?_ + by_cases hxE : x ∈ E + · have hxb : x ∈ discBd E := by + by_contra hcon + exact hx ⟨hxE, hcon⟩ + rw [← hs] at hxb + obtain ⟨z, hz, rfl⟩ := hxb + have hz2 : z ∈ closedBall (0 : ℂ) 2 := sphere_subset_closedBall hz + have hn : ‖z‖ = 2 := mem_sphere_zero_iff_norm.mp hz + change (if c z ∈ E then c (Θ (c' (c z))) else c z) = c z + rw [ite_eq_left (hcm hz2), hl hz2, hΘ z (by linarith)] + · exact ite_eq_right hxE + have hinv : ∀ {Θ₁ Θ₂ : ℂ ≃ₜ ℂ}, (∀ z, Θ₂ (Θ₁ z) = z) → (∀ z, 3 / 2 ≤ ‖z‖ → Θ₁ z = z) → ∀ x, + (if (if x ∈ E then c (Θ₁ (c' x)) else x) ∈ E then + c (Θ₂ (c' (if x ∈ E then c (Θ₁ (c' x)) else x))) else + (if x ∈ E then c (Θ₁ (c' x)) else x)) = x := by + intro Θ₁ Θ₂ h12 h1 x + by_cases hx : x ∈ E + · have h2 := hmap h1 (hcm' hx) + simp only [ite_eq_left hx, ite_eq_left (hcm h2), hl h2, h12] + exact hr hx + · simp only [ite_eq_right hx] + refine ⟨{ toFun := fun x => if x ∈ E then c (Θ (c' x)) else x + invFun := fun x => if x ∈ E then c (Θ.symm (c' x)) else x + left_inv := fun x => hinv (fun z => Θ.symm_apply_apply z) hΘ x + right_inv := fun x => hinv (fun z => Θ.apply_symm_apply z) hsym x + continuous_toFun := key hΘ + continuous_invFun := key hsym }, fun z hz => ?_, fun x hx => ite_eq_right hx⟩ + change (if c z ∈ E then c (Θ (c' (c z))) else c z) = c (Θ z) + rw [ite_eq_left (hcm hz), hl hz] + +end extend + +/-- The height of the unit circle over `x`. -/ +noncomputable def capH (x : ℝ) : ℝ := Real.sqrt (1 - x ^ 2) + +theorem continuous_capH : Continuous capH := by + unfold capH + fun_prop + +theorem capH_sq {x : ℝ} (h : |x| ≤ 1) : capH x ^ 2 = 1 - x ^ 2 := by + have : x ^ 2 ≤ 1 := by + rw [← sq_abs] + exact pow_le_one₀ (abs_nonneg _) h + exact Real.sq_sqrt (by linarith) + +theorem capH_pos {x : ℝ} (h : |x| < 1) : 0 < capH x := by + have : x ^ 2 < 1 := by + rw [← sq_abs] + exact pow_lt_one₀ (abs_nonneg _) h (by norm_num) + exact Real.sqrt_pos.mpr (by linarith) + +theorem capH_eq_zero {x : ℝ} (h : 1 ≤ |x|) : capH x = 0 := by + have : 1 ≤ x ^ 2 := by + rw [← sq_abs] + exact one_le_pow₀ h + exact Real.sqrt_eq_zero'.mpr (by linarith) + +/-- The lower half of the unit circle, from `-1` to `1`. -/ +noncomputable def lowArc (t : 𝕀) : ℂ := ⟨2 * t.1 - 1, - capH (2 * t.1 - 1)⟩ + +/-- The upper half of the unit circle, from `-1` to `1`. -/ +noncomputable def highArc (t : 𝕀) : ℂ := ⟨2 * t.1 - 1, capH (2 * t.1 - 1)⟩ + +theorem abs_two_sub_one_le (t : 𝕀) : |2 * t.1 - 1| ≤ 1 := by + rw [abs_le] + constructor <;> linarith [t.2.1, t.2.2] + +theorem norm_of_capH {x y : ℝ} (hx : |x| ≤ 1) (hy : y ^ 2 = capH x ^ 2) : ‖(⟨x, y⟩ : ℂ)‖ = 1 := by + rw [Complex.norm_def, Complex.normSq_mk] + rw [show x * x + y * y = x ^ 2 + y ^ 2 by ring, hy, capH_sq hx] + simp + +theorem isTwoArcs_low_high : IsTwoArcs lowArc highArc := by + have hre : ∀ (f : 𝕀 → ℂ), (∀ t, (f t).re = 2 * t.1 - 1) → Function.Injective f := fun f hf s t h + => by + have := congrArg Complex.re h + rw [hf, hf] at this + exact Subtype.ext (by linarith) + have hc : Continuous fun t : 𝕀 => capH (2 * t.1 - 1) := + continuous_capH.comp (by fun_prop) + refine ⟨⟨?_, hre _ fun _ => rfl⟩, ⟨?_, hre _ fun _ => rfl⟩, ?_, ?_, ?_⟩ + · exact Complex.equivRealProdCLM.symm.continuous.comp ((by fun_prop : Continuous fun t : 𝕀 + => 2 * t.1 - 1).prodMk hc.neg) + · exact Complex.equivRealProdCLM.symm.continuous.comp ((by fun_prop : Continuous fun t : 𝕀 + => 2 * t.1 - 1).prodMk hc) + · simp [lowArc, highArc, capH] + · simp [lowArc, highArc, capH] + norm_num + · intro s t h + have h1 : s = t := Subtype.ext (by + have := congrArg Complex.re h + simp only [lowArc, highArc] at this + linarith) + subst h1 + have h2 := congrArg Complex.im h + simp only [lowArc, highArc] at h2 + have h3 : capH (2 * s.1 - 1) = 0 := by linarith + have h4 : |2 * s.1 - 1| = 1 := by + by_contra hne + have := capH_pos (lt_of_le_of_ne (abs_two_sub_one_le s) hne) + linarith + rcases abs_eq (by norm_num : (0 : ℝ) ≤ 1) |>.mp h4 with h5 | h5 + · have h6 : s = 1 := Subtype.ext (show s.1 = 1 by linarith) + exact Or.inr ⟨h6, h6⟩ + · have h6 : s = 0 := Subtype.ext (show s.1 = 0 by linarith) + exact Or.inl ⟨h6, h6⟩ + +theorem range_low_union_high : range lowArc ∪ range highArc = sphere 0 1 := by + ext z + constructor + · rintro (⟨t, rfl⟩ | ⟨t, rfl⟩) + · exact mem_sphere_zero_iff_norm.mpr (norm_of_capH (abs_two_sub_one_le t) (by ring)) + · exact mem_sphere_zero_iff_norm.mpr (norm_of_capH (abs_two_sub_one_le t) rfl) + · intro hz + have hn : ‖z‖ = 1 := mem_sphere_zero_iff_norm.mp hz + have h1 := Complex.abs_re_le_norm z + rw [hn] at h1 + have h2 := abs_le.mp h1 + have ht : (z.re + 1) / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith, by linarith⟩ + have hsq : z.re ^ 2 + z.im ^ 2 = 1 := by + have := Complex.sq_norm z + rw [hn, Complex.normSq_apply] at this + nlinarith + have hc : capH z.re = |z.im| := by + rw [capH, show 1 - z.re ^ 2 = z.im ^ 2 by linarith, Real.sqrt_sq_eq_abs] + have he : 2 * ((z.re + 1) / 2) - 1 = z.re := by ring + rcases le_total 0 z.im with h3 | h3 + · refine .inr ⟨⟨_, ht⟩, Complex.ext ?_ ?_⟩ + · simp only [highArc, he] + · simp only [highArc, he, hc, abs_of_nonneg h3] + · refine .inl ⟨⟨_, ht⟩, Complex.ext ?_ ?_⟩ + · simp only [lowArc, he] + · simp only [lowArc, he, hc, abs_of_nonpos h3, neg_neg] + +section side + +variable {T : Type u} [TopologicalSpace T] [CompactSpace T] [T2Space T] + +omit [CompactSpace T] in +/-- Disc `D` and an arc of its boundary as the lower half: coordinates around `D` where `D` is the +unit disc. -/ +theorem exists_chart_two_arcs (hman : ∀ x : T, IsManifoldPoint x) {D : Set T} {u v : 𝕀 → T} + (hD : IsClosedDisc D) (hint : ∀ x ∈ discBd D, IsInteriorPoint x) (huv : IsTwoArcs u v) + (hbd : range u ∪ range v = discBd D) : + ∃ (E : Set T) (c : ℂ → T) (c' : T → ℂ), IsClosedDisc E ∧ ContinuousOn c (closedBall 0 2) ∧ + ContinuousOn c' E ∧ MapsTo c (closedBall 0 2) E ∧ MapsTo c' E (closedBall 0 2) ∧ + LeftInvOn c' c (closedBall 0 2) ∧ RightInvOn c' c E ∧ c '' closedBall 0 1 = D ∧ + c '' sphere 0 2 = discBd E ∧ (∀ t, c (lowArc t) = u t) ∧ ∀ t, c (highArc t) = v t := by + classical + obtain ⟨E, hE, h2, -⟩ := exists_disc_around hman hD hint isOpen_univ (subset_univ _) + obtain ⟨h₀, g₀, cD⟩ := hD.exists_isChart + have hbdD : discBd D ⊆ D := discBd_subset D + have hu : ∀ t, u t ∈ D := fun t => hbdD (hbd ▸ Or.inl ⟨t, rfl⟩) + have hv : ∀ t, v t ∈ D := fun t => hbdD (hbd ▸ Or.inr ⟨t, rfl⟩) + have harc : ∀ {a : 𝕀 → T}, IsArcMap a → (∀ t, a t ∈ D) → IsArcMap fun t => h₀ (a t) := fun ha hm + => + ⟨cD.hc.comp_continuous ha.1 hm, fun s t hst => ha.2 (cD.gh.injOn (hm s) (hm t) hst)⟩ + obtain ⟨hl₁, hh₁, h01, h11, hm₁⟩ := id isTwoArcs_low_high + have hinjh := cD.gh.injOn + obtain ⟨b, k, m, hb1, hb2⟩ := exists_bdMatch_of_arcs (c := lowArc) (d := highArc) + (c' := fun t => h₀ (u t)) (d' := fun t => h₀ (v t)) hl₁ hh₁ (harc huv.1 hu) + (harc huv.2 hv) h01 h11 + (by simp only [huv.3]) (by simp only [huv.4]) hm₁ (fun s t hst => huv.5 s t + (hinjh (hu s) (hv t) hst)) + have hsr : range (fun t => h₀ (u t)) ∪ range (fun t => h₀ (v t)) = sphere 0 1 := by + rw [← cD.bd, ← hbd, image_union, ← range_comp, ← range_comp] + rfl + rw [range_low_union_high, hsr] at m + obtain ⟨G, hG⟩ := exists_homeomorph_of_bdMatch oArc_sphere m + obtain ⟨m1, m2, m3, m4, m5, m6⟩ := id m + have hsph : ∀ w : Circle, (w : ℂ) ∈ sphere (0 : ℂ) 1 := fun w => + mem_sphere_zero_iff_norm.mpr (Circle.norm_coe w) + have hb0 : ∀ w : Circle, g₀ (G w) ∈ discBd D := fun w => by + rw [← cD.g_sphere, hG (hsph w)] + exact mem_image_of_mem _ (m1 (hsph w)) + let P : Circle → discBd D := fun w => ⟨g₀ (G w), hb0 w⟩ + have hPc : Continuous P := by + refine Continuous.subtype_mk ?_ _ + have hcoe : Continuous fun w : Circle => (w : ℂ) := by fun_prop + refine (cD.gc.comp_continuous (G.continuous.comp hcoe) fun w => ?_) + rw [hG (hsph w)] + exact sphere_subset_closedBall (m1 (hsph w)) + have hPi : Function.Injective P := fun w w' he => by + have h3 : g₀ (G w) = g₀ (G w') := congrArg Subtype.val he + have h4 : ∀ w : Circle, G w ∈ closedBall (0 : ℂ) 1 := fun w => by + rw [hG (hsph w)] + exact sphere_subset_closedBall (m1 (hsph w)) + have h5 : G w = G w' := cD.hg.injOn (h4 w) (h4 w') h3 + exact Circle.ext (G.injective h5) + have hPs : Function.Surjective P := by + rintro ⟨x, hx⟩ + have hx' : h₀ x ∈ sphere (0 : ℂ) 1 := by + rw [← cD.bd] + exact mem_image_of_mem _ hx + have hk := m2 hx' + refine ⟨⟨k (h₀ x), by + simpa [Submonoid.unitSphere] using mem_sphere_zero_iff_norm.mp hk⟩, Subtype.ext ?_⟩ + change g₀ (G (k (h₀ x))) = x + rw [hG hk, m4 hx'] + exact cD.gh (hbdD hx) + let p : Circle ≃ₜ discBd D := hPc.homeoOfEquivCompactToT2 (f := Equiv.ofBijective P ⟨hPi, hPs⟩) + obtain ⟨c, c', q1, q2, q3, q4, q5, q6, q7, q8, q9⟩ := exists_disc_collar hD hE h2 p + have hval : ∀ t : 𝕀, ∀ z (hz : z = lowArc t ∨ z = highArc t), ‖z‖ = 1 := by + rintro t _ (rfl | rfl) + · exact norm_of_capH (abs_two_sub_one_le t) (by ring) + · exact norm_of_capH (abs_two_sub_one_le t) rfl + have hcall : ∀ z, (hz : ‖z‖ = 1) → c z = g₀ (b z) := fun z hz => by + have hw := q9 ⟨z, by simpa [Submonoid.unitSphere] using hz⟩ + have hzs : z ∈ sphere (0 : ℂ) 1 := mem_sphere_zero_iff_norm.mpr hz + rw [show ((⟨z, by simpa [Submonoid.unitSphere] using hz⟩ : Circle) : ℂ) = z from rfl] at hw + rw [hw] + change g₀ (G z) = _ + rw [hG hzs] + refine ⟨E, c, c', hE, q1, q2, q3, q4, q5, q6, q7, q8, fun t => ?_, fun t => ?_⟩ + · rw [hcall _ (hval t _ (.inl rfl)), hb1, cD.gh (hu t)] + · rw [hcall _ (hval t _ (.inr rfl)), hb2, cD.gh (hv t)] + +private theorem exists_collar_push {e lam : ℝ → ℝ} (hele : ∀ x, e x ≤ 1 / 2) + (hdata : IsPushData (fun x => -capH x) (fun x => -capH x + lam x) capH + (fun x => capH x + e x)) : + ∃ Θ : ℂ ≃ₜ ℂ, (∀ z, (Θ z).re = z.re) ∧ + (∀ z, (Θ z).im = tentMap (-capH z.re) (-capH z.re + lam z.re) (capH z.re) + (capH z.re + e z.re) z.im) ∧ + (∀ z : ℂ, (1 ≤ |z.re| ∨ z.im ≤ -capH z.re ∨ capH z.re + e z.re ≤ z.im) → Θ z = z) ∧ + (∀ z, 3 / 2 ≤ ‖z‖ → Θ z = z) ∧ MapsTo Θ (closedBall 0 2) (closedBall 0 2) := by + obtain ⟨Θ, hre, him⟩ := exists_vertical_push hdata + have hfix : ∀ z : ℂ, (1 ≤ |z.re| ∨ z.im ≤ - capH z.re ∨ capH z.re + e z.re ≤ z.im) → Θ z = z := by + intro z hz + refine Complex.ext (hre z) ?_ + rw [him] + rcases lt_or_ge |z.re| 1 with hx | hx + · obtain ⟨a1, a2, -, -⟩ := hdata.2.2.2.2.1 _ hx + rcases hz with hz | hz | hz + · exact absurd hx (not_lt.mpr hz) + · rw [tentMap, tent_low a1 a2 hz, mul_zero, add_zero] + · rw [tentMap, tent_high a1 a2 hz, mul_zero, add_zero] + · have a1 := (hdata.2.2.2.2.2 _ hx).2.1 + simp only at a1 + rw [tentMap, show capH z.re - (- capH z.re + lam z.re) = 0 by linarith, zero_mul, add_zero] + have hHle : ∀ x, capH x ≤ 1 := fun x => by + rw [capH] + exact Real.sqrt_le_one.mpr (by nlinarith [sq_nonneg x]) + have hHnn : ∀ x, 0 ≤ capH x := fun x => Real.sqrt_nonneg _ + have hfar : ∀ z : ℂ, 3 / 2 ≤ ‖z‖ → Θ z = z := by + intro z hz + refine hfix z ?_ + by_contra hcon + push Not at hcon + obtain ⟨a1, a2, a3⟩ := hcon + have a4 := capH_sq a1.le + have a5 := hele z.re + have a6 := hHle z.re + have a7 := hHnn z.re + have a8 : z.im ^ 2 < (capH z.re + 1 / 2) ^ 2 := sq_lt_sq' (by linarith) (by linarith) + have a9 := Complex.sq_norm z + rw [Complex.normSq_apply] at a9 + nlinarith + have hmap2 : ∀ z ∈ closedBall (0 : ℂ) 2, Θ z ∈ closedBall (0 : ℂ) 2 := by + intro z hz + by_contra hcon + have h3 : 2 < ‖Θ z‖ := by + rw [mem_closedBall_zero_iff, not_le] at hcon + exact hcon + have h4 := Θ.injective (hfar (Θ z) (by linarith)) + rw [h4] at h3 + linarith [mem_closedBall_zero_iff.mp hz] + exact ⟨Θ, hre, him, hfix, hfar, hmap2⟩ + +omit [CompactSpace T] in +/-- **Pushing a closed set off a disc.** Here `u` is an arc of the boundary of `D`, and `Y` meets +`D` only in `u`. +A homeomorphism that fixes `Y` moves `C` off `D`, except for the ends of `u`. -/ +theorem push_side (hman : ∀ x : T, IsManifoldPoint x) {D Y C : Set T} {u v : 𝕀 → T} + (hD : IsClosedDisc D) (hint : ∀ x ∈ discBd D, IsInteriorPoint x) (huv : IsTwoArcs u v) + (hbd : range u ∪ range v = discBd D) (hY : IsClosed Y) (hYD : Y ∩ D ⊆ range u) (h0 : u 0 ∈ Y) + (_h1 : u 1 ∈ Y) (hC : IsClosed C) (hCu : C ∩ range u ⊆ {u 0, u 1}) : + ∃ h : T ≃ₜ T, (∀ y ∈ Y, h y = y) ∧ h '' C ∩ D ⊆ {u 0, u 1} := by + classical + obtain ⟨E, c, c', hE, q1, q2, q3, q4, q5, q6, q7, q8, cl, ch⟩ := + exists_chart_two_arcs hman hD hint huv hbd + have hb12 : closedBall (0 : ℂ) 1 ⊆ closedBall 0 2 := closedBall_subset_closedBall (by norm_num) + have hinj : InjOn c (closedBall 0 2) := q5.injOn + have hDE : D ⊆ E := by + rw [← q7] + exact (image_mono hb12).trans q3.image_subset + have hlow : ∀ t, lowArc t ∈ closedBall (0 : ℂ) 1 := fun t => by + rw [mem_closedBall_zero_iff] + exact (norm_of_capH (y := - capH _) (abs_two_sub_one_le t) (by ring)).le + have hhigh : ∀ t, highArc t ∈ closedBall (0 : ℂ) 1 := fun t => by + rw [mem_closedBall_zero_iff] + exact (norm_of_capH (abs_two_sub_one_le t) rfl).le + have hend0 : (⟨-1, 0⟩ : ℂ) = lowArc 0 := by simp [lowArc, capH] + have hend1 : (⟨1, 0⟩ : ℂ) = lowArc 1 := by simp [lowArc, capH]; norm_num + have hnsq : ∀ z : ℂ, z.re ^ 2 + z.im ^ 2 = ‖z‖ ^ 2 := fun z => by + rw [Complex.sq_norm, Complex.normSq_apply] + ring + have hle1 (z : ℂ) (hz : ‖z‖ ≤ 1) : z.re ^ 2 + z.im ^ 2 ≤ 1 := + (hnsq z).trans_le (pow_le_one₀ (norm_nonneg z) hz) + have hpt : ∀ x : ℝ, |x| < 1 → ∃ t : 𝕀, t ≠ 0 ∧ t ≠ 1 ∧ 2 * t.1 - 1 = x := fun x hx => by + obtain ⟨h3, h4⟩ := abs_lt.mp hx + refine ⟨⟨(x + 1) / 2, by linarith, by linarith⟩, fun he => ?_, fun he => ?_, by simp; ring⟩ + · have := congrArg Subtype.val he + simp only [Set.Icc.coe_zero] at this + linarith + · have := congrArg Subtype.val he + simp only [Set.Icc.coe_one] at this + linarith + let Yc : Set ℂ := closedBall 0 2 ∩ c ⁻¹' Y + let Cc : Set ℂ := (closedBall 0 2 ∩ c ⁻¹' C) ∪ {lowArc 0, lowArc 1} + have hbdD : discBd D ⊆ D := discBd_subset D + have hYc : IsClosed Yc := q1.preimage_isClosed_of_isClosed isClosed_closedBall hY + have hCc : IsClosed Cc := (q1.preimage_isClosed_of_isClosed isClosed_closedBall hC).union + (Set.toFinite _).isClosed + have hYne : Yc.Nonempty := ⟨lowArc 0, hb12 (hlow 0), by + change c _ ∈ Y + rw [cl] + exact h0⟩ + have hCne : Cc.Nonempty := ⟨lowArc 0, Or.inr (Or.inl rfl)⟩ + let d : ℝ → ℝ := fun x => infDist (⟨x, capH x⟩ : ℂ) Yc + let d₂ : ℝ → ℝ := fun x => infDist (⟨x, - capH x⟩ : ℂ) Cc + have hpc : ∀ {f : ℝ → ℝ}, Continuous f → Continuous fun x : ℝ => (⟨x, f x⟩ : ℂ) := fun hf => + Complex.equivRealProdCLM.symm.continuous.comp (continuous_id.prodMk hf) + have hdc : Continuous d := (continuous_infDist_pt Yc).comp (hpc continuous_capH) + have hd₂c : Continuous d₂ := (continuous_infDist_pt Cc).comp (hpc continuous_capH.neg) + have hdpos : ∀ x, |x| < 1 → 0 < d x := fun x hx => by + refine (hYc.notMem_iff_infDist_pos hYne).mp fun hmem => ?_ + obtain ⟨t, ht0, ht1, ht⟩ := hpt x hx + have he : highArc t = ⟨x, capH x⟩ := by simp only [highArc, ht] + have h3 : v t ∈ Y := by + have := hmem.2 + rwa [mem_preimage, ← he, ch] at this + obtain ⟨s, hs⟩ := hYD ⟨h3, hbdD (hbd ▸ Or.inr ⟨t, rfl⟩)⟩ + rcases huv.5 s t hs with h4 | h4 + · exact ht0 h4.2 + · exact ht1 h4.2 + have hd₂pos : ∀ x, |x| < 1 → 0 < d₂ x := fun x hx => by + refine (hCc.notMem_iff_infDist_pos hCne).mp fun hmem => ?_ + obtain ⟨t, ht0, ht1, ht⟩ := hpt x hx + have he : lowArc t = ⟨x, - capH x⟩ := by simp only [lowArc, ht] + rcases hmem with hmem | hmem + · have h3 : u t ∈ C := by + have := hmem.2 + rwa [mem_preimage, ← he, cl] at this + rcases hCu ⟨h3, t, rfl⟩ with h4 | h4 + · exact ht0 (huv.1.2 h4) + · exact ht1 (huv.1.2 h4) + · obtain ⟨h3, h4⟩ := abs_lt.mp hx + rcases hmem with h5 | h5 + · have := congrArg Complex.re h5 + simp only [lowArc, Set.Icc.coe_zero] at this + linarith + · have := congrArg Complex.re h5 + simp only [lowArc, Set.Icc.coe_one] at this + linarith + let e : ℝ → ℝ := fun x => min (d x / 2) (min (1 / 2) (capH x)) + let lam : ℝ → ℝ := fun x => min (d₂ x / 2) (capH x) + have hHc := continuous_capH + have hec : Continuous e := (hdc.div_const 2).min (continuous_const.min hHc) + have hlc : Continuous lam := (hd₂c.div_const 2).min hHc + have hepos : ∀ x, |x| < 1 → 0 < e x := fun x hx => + lt_min (half_pos (hdpos x hx)) (lt_min (by norm_num) (capH_pos hx)) + have hlpos : ∀ x, |x| < 1 → 0 < lam x := fun x hx => + lt_min (half_pos (hd₂pos x hx)) (capH_pos hx) + have hele : ∀ x, e x ≤ 1 / 2 := fun x => (min_le_right _ _).trans (min_le_left _ _) + have hlle : ∀ x, lam x ≤ capH x := fun x => min_le_right _ _ + have hdata : IsPushData (fun x => - capH x) (fun x => - capH x + lam x) capH + (fun x => capH x + e x) := by + refine ⟨hHc.neg, hHc.neg.add hlc, hHc, hHc.add hec, fun x hx => ?_, fun x hx => ?_⟩ + · have a1 := capH_pos hx + have a2 := hepos x hx + have a3 := hlpos x hx + have a4 := hlle x + refine ⟨?_, ?_, ?_, ?_⟩ <;> simp only <;> linarith + · have a1 := capH_eq_zero hx + have a2 : e x = 0 := by + simp only [e, a1] + rw [min_eq_right (by norm_num : (0 : ℝ) ≤ 1 / 2)] + exact min_eq_right (div_nonneg infDist_nonneg (by norm_num)) + have a3 : lam x = 0 := by + simp only [lam, a1] + exact min_eq_right (div_nonneg infDist_nonneg (by norm_num)) + simp [a1, a2, a3] + obtain ⟨Θ, hre, him, hfix, hfar, hmap2⟩ := exists_collar_push hele hdata + obtain ⟨h, hh1, hh2⟩ := exists_homeomorph_of_collar hman hE q1 q2 q3 q4 q5 q6 q8 Θ hfar + refine ⟨h, fun y hy => ?_, ?_⟩ + · by_cases hyE : y ∈ E + · have hz := q4 hyE + have hcz : c (c' y) = y := q6 hyE + set z := c' y with hzdef + have hzY : z ∈ Yc := ⟨hz, by rw [mem_preimage, hcz]; exact hy⟩ + have hfixz : Θ z = z := by + refine hfix z ?_ + by_contra hcon + push Not at hcon + obtain ⟨a1, a2, a3⟩ := hcon + rcases le_or_gt z.im (capH z.re) with a4 | a4 + · have a5 : z.re ^ 2 + z.im ^ 2 ≤ 1 := by + have := capH_sq a1.le + have a6 : z.im ^ 2 ≤ capH z.re ^ 2 := sq_le_sq' (by linarith) a4 + linarith + have a6 : ‖z‖ ≤ 1 := by + have := hnsq z + nlinarith [norm_nonneg z] + have a7 : c z ∈ D := q7 ▸ mem_image_of_mem c (mem_closedBall_zero_iff.mpr a6) + obtain ⟨s, hs⟩ := hYD ⟨hcz ▸ hy, a7⟩ + have a8 : lowArc s = z := hinj (hb12 (hlow s)) hz (by rw [cl, hs]) + have a9 := congrArg Complex.re a8 + have a10 := congrArg Complex.im a8 + simp only [lowArc] at a9 a10 + rw [a9] at a10 + linarith + · have a5 : d z.re ≤ dist (⟨z.re, capH z.re⟩ : ℂ) z := infDist_le_dist_of_mem hzY + rw [Complex.dist_of_re_eq (show (⟨z.re, capH z.re⟩ : ℂ).re = z.re from rfl), Real.dist_eq, + abs_sub_comm, abs_of_pos (by simpa using a4)] at a5 + have a6 : e z.re ≤ d z.re / 2 := min_le_left _ _ + simp only at a5 + linarith [hdpos z.re a1, hepos z.re a1] + rw [← hcz, hh1 z hz, hfixz] + · exact hh2 y hyE + · rintro _ ⟨⟨x, hx, rfl⟩, hxD⟩ + by_cases hxE : x ∈ E + · have hz := q4 hxE + have hcz : c (c' x) = x := q6 hxE + set z := c' x with hzdef + have hzC : z ∈ Cc := Or.inl ⟨hz, by rw [mem_preimage, hcz]; exact hx⟩ + rw [← hcz, hh1 z hz] at hxD ⊢ + obtain ⟨ζ, hζ, he⟩ : c (Θ z) ∈ c '' closedBall 0 1 := q7 ▸ hxD + have hΘz : ζ = Θ z := hinj (hb12 hζ) (hmap2 hz) he + have hn1 : ‖Θ z‖ ≤ 1 := mem_closedBall_zero_iff.mp (hΘz ▸ hζ) + have hn2 := hle1 _ hn1 + rw [hre] at hn2 + rcases lt_or_ge |z.re| 1 with a1 | a1 + · exfalso + obtain ⟨a2, a3, -, a5⟩ := hdata.2.2.2.2.1 _ a1 + simp only at a2 a3 a5 + have a4 := capH_sq a1.le + have a7 := capH_pos a1 + rcases lt_or_ge z.im (- capH z.re) with a8 | a8 + · have a9 : Θ z = z := hfix z (.inr (.inl a8.le)) + rw [a9] at hn2 + nlinarith + rcases le_or_gt z.im (- capH z.re + lam z.re) with a9 | a9 + · have a10 : d₂ z.re ≤ dist (⟨z.re, - capH z.re⟩ : ℂ) z := infDist_le_dist_of_mem hzC + rw [Complex.dist_of_re_eq (show (⟨z.re, - capH z.re⟩ : ℂ).re = z.re from rfl), + Real.dist_eq, + abs_sub_comm, abs_of_nonneg (by change 0 ≤ z.im - - capH z.re; linarith)] at a10 + have a11 : lam z.re ≤ d₂ z.re / 2 := min_le_left _ _ + simp only at a10 + linarith [hd₂pos z.re a1] + · have a10 := w_lt_tentMap a2 a3 a5 a9 + rw [← him] at a10 + nlinarith + · have a9 : Θ z = z := hfix z (.inl a1) + rw [a9] at hn2 ⊢ + have a10 : z.re ^ 2 = 1 ∧ z.im = 0 := by + have a11 : 1 ≤ z.re ^ 2 := by + rw [← sq_abs] + exact one_le_pow₀ a1 + have a12 : z.im ^ 2 ≤ 0 := by linarith + have a13 : z.im = 0 := by nlinarith [sq_nonneg z.im] + rw [a13] at hn2 + exact ⟨by nlinarith, a13⟩ + have a14 : z.re = 1 ∨ z.re = -1 := by + have : (z.re - 1) * (z.re + 1) = 0 := by nlinarith [a10.1] + rcases mul_eq_zero.mp this with h3 | h3 + · exact .inl (by linarith) + · exact .inr (by linarith) + rcases a14 with a14 | a14 + · right + rw [show z = lowArc 1 from Complex.ext (by simp [lowArc, a14]; norm_num) + (by simp [lowArc, capH, a10.2]; norm_num), cl] + rfl + · left + rw [show z = lowArc 0 from Complex.ext (by simp [lowArc, a14]) + (by simp [lowArc, capH, a10.2]), cl] + · exact absurd (hDE (by rwa [hh2 x hxE] at hxD)) hxE + +end side + +/-- A line in an `O`-arc is one of the two arcs between its ends. -/ +theorem exists_arcs_of_line {X : Type u} [TopologicalSpace X] [T2Space X] {F L : Set X} {a b : X} + (hF : IsOArc F) (hL : IsLineWithEnds L a b) (hLF : L ⊆ F) : + ∃ u v : 𝕀 → X, IsTwoArcs u v ∧ range u = L ∧ u 0 = a ∧ u 1 = b ∧ range u ∪ range v = F := by + obtain ⟨f, hf0, hf1⟩ := hL + let u : 𝕀 → X := fun t => (f t).1 + have hu : IsArcMap u := ⟨continuous_subtype_val.comp f.continuous, + fun s t h => f.injective (Subtype.ext h)⟩ + have hru : range u = L := by + ext x + constructor + · rintro ⟨t, rfl⟩ + exact (f t).2 + · intro hx + exact ⟨f.symm ⟨x, hx⟩, by simp [u]⟩ + have hab : a ≠ b := fun he => by + have : u 0 = u 1 := by simp only [u, hf0, hf1, he] + exact zero_ne_one (hu.2 this) + have ha : a ∈ F := hLF (hru ▸ ⟨0, hf0⟩) + have hb : b ∈ F := hLF (hru ▸ ⟨1, hf1⟩) + obtain ⟨p, q, hpq, hp0, hp1, hun⟩ := hF.exists_arcs ha hb hab + have key : ∀ {p q : 𝕀 → X}, IsTwoArcs p q → p 0 = a → p 1 = b → range p ∪ range q = F → + u '' Ioo 0 1 ⊆ range p → ∃ u' v : 𝕀 → X, IsTwoArcs u' v ∧ range u' = L ∧ u' 0 = a ∧ u' 1 = b ∧ + range u' ∪ range v = F := by + intro p q hpq hp0 hp1 hun hsub + have h1 : range u ⊆ range p := by + rintro _ ⟨t, rfl⟩ + rcases eq_or_ne t 0 with rfl | h0 + · exact ⟨0, hp0.trans hf0.symm⟩ + rcases eq_or_ne t 1 with rfl | h1 + · exact ⟨1, hp1.trans hf1.symm⟩ + exact hsub ⟨t, ⟨unitInterval.pos_iff_ne_zero.mpr h0, unitInterval.lt_one_iff_ne_one.mpr h1⟩, + rfl⟩ + have h2 : range p ⊆ range u := by + rintro _ ⟨r, rfl⟩ + by_contra hcon + have hA : IsClosed (p '' Iic r) := (isClosed_Iic.isCompact.image hpq.1.1).isClosed + have hB : IsClosed (p '' Ici r) := (isClosed_Ici.isCompact.image hpq.1.1).isClosed + have hcov : range u ⊆ p '' Iic r ∪ p '' Ici r := fun x hx => by + obtain ⟨y, rfl⟩ := h1 hx + rcases le_total y r with h | h + · exact .inl ⟨y, h, rfl⟩ + · exact .inr ⟨y, h, rfl⟩ + obtain ⟨x, hx, hxA, hxB⟩ := isPreconnected_closed_iff.mp (isPreconnected_range hu.1) _ _ hA + hB hcov + ⟨a, ⟨0, hf0⟩, 0, unitInterval.nonneg', hp0⟩ ⟨b, ⟨1, hf1⟩, 1, unitInterval.le_one', hp1⟩ + obtain ⟨y, hy, rfl⟩ := hxA + obtain ⟨y', hy', he⟩ := hxB + have h3 : y' = y := hpq.1.2 he + subst h3 + have h4 : y' = r := le_antisymm hy hy' + subst h4 + exact hcon hx + have hre : range u = range p := Subset.antisymm h1 h2 + refine ⟨u, q, ⟨hu, hpq.2, ?_, ?_, ?_⟩, hru, hf0, hf1, by rw [hre]; exact hun⟩ + · rw [hpq.3, hp0] + exact hf0.symm + · rw [hpq.4, hp1] + exact hf1.symm + · intro s t hst + obtain ⟨r, hr⟩ := h1 ⟨s, rfl⟩ + have h3 := hpq.5 r t (hr.trans hst) + rcases h3 with ⟨h3, h4⟩ | ⟨h3, h4⟩ + · subst h3 + refine .inl ⟨hu.2 (?_ : u s = u 0), h4⟩ + rw [← hr, hp0] + exact hf0.symm + · subst h3 + refine .inr ⟨hu.2 (?_ : u s = u 1), h4⟩ + rw [← hr, hp1] + exact hf1.symm + have hswap : IsTwoArcs q p := ⟨hpq.2, hpq.1, hpq.3.symm, hpq.4.symm, + fun s t h => (hpq.5 t s h.symm).imp And.symm And.symm⟩ + have hq0 : q 0 = a := hpq.3.trans hp0 + have hq1 : q 1 = b := hpq.4.trans hp1 + have hconn : IsPreconnected (u '' Ioo 0 1) := isPreconnected_Ioo.image _ hu.1.continuousOn + have hAc : IsClosed (range p) := (isCompact_range hpq.1.1).isClosed + have hBc : IsClosed (range q) := (isCompact_range hpq.2.1).isClosed + have hcov : u '' Ioo 0 1 ⊆ range p ∪ range q := by + rintro _ ⟨t, -, rfl⟩ + rw [hun] + exact hLF (hru ▸ ⟨t, rfl⟩) + by_cases hm : u '' Ioo 0 1 ⊆ range p + · exact key hpq hp0 hp1 hun hm + by_cases hm' : u '' Ioo 0 1 ⊆ range q + · exact key hswap hq0 hq1 (by rw [union_comm]; exact hun) hm' + exfalso + obtain ⟨x, hx, hxp⟩ := not_subset.mp hm + obtain ⟨y, hy, hyq⟩ := not_subset.mp hm' + obtain ⟨z, ⟨t, ht, rfl⟩, ⟨r, hr⟩, ⟨r', hr'⟩⟩ := isPreconnected_closed_iff.mp hconn _ _ hAc hBc + hcov + ⟨y, hy, (hcov hy).resolve_right hyq⟩ ⟨x, hx, (hcov hx).resolve_left hxp⟩ + rcases hpq.5 r r' (hr.trans hr'.symm) with ⟨h1, -⟩ | ⟨h1, -⟩ + · subst h1 + have : t = 0 := hu.2 (hr.symm.trans (hp0.trans hf0.symm)) + exact ht.1.ne' this + · subst h1 + have : t = 1 := hu.2 (hr.symm.trans (hp1.trans hf1.symm)) + exact ht.2.ne this + +section disc + +variable {T : Type u} [TopologicalSpace T] [CompactSpace T] [T2Space T] + +omit [CompactSpace T] in +/-- `push_side` for a line `L` of a disc: the line lies in the boundary of the disc, or it is a +chord. -/ +theorem push_disc (hT : ∀ x : T, IsInteriorPoint x) {D L Y C : Set T} {a b : T} + (hD : IsClosedDisc D) + (hL : IsLineWithEnds L a b) (hLD : L ⊆ D) + (hcase : (L ⊆ discBd D ∧ Y ∩ D ⊆ L) ∨ (L \ {a, b} ⊆ D \ discBd D ∧ Y ∩ D ⊆ {a, b})) + (ha : a ∈ discBd D) (hb : b ∈ discBd D) + (hY : IsClosed Y) (haY : a ∈ Y) (hbY : b ∈ Y) (hC : IsClosed C) (hCL : C ∩ L ⊆ {a, b}) : + ∃ h : T ≃ₜ T, (∀ y ∈ Y, h y = y) ∧ h '' C ∩ D ⊆ {a, b} := by + have hman : ∀ x : T, IsManifoldPoint x := fun x => (hT x).isManifoldPoint + have one : ∀ {D Y C : Set T}, IsClosedDisc D → L ⊆ discBd D → IsClosed Y → Y ∩ D ⊆ L → a ∈ Y + → b ∈ Y → + IsClosed C → C ∩ L ⊆ {a, b} → ∃ h : T ≃ₜ T, (∀ y ∈ Y, h y = y) ∧ h '' C ∩ D ⊆ {a, b} := by + intro D Y C hD hLb hY hYD haY hbY hC hCL + obtain ⟨u, v, huv, hr, h0, h1, hun⟩ := exists_arcs_of_line hD.isOArc_discBd hL hLb + subst h0 h1 + exact push_side hman hD (fun x _ => hT x) huv hun hY (hr ▸ hYD) haY hbY hC (hr ▸ hCL) + rcases hcase with ⟨hLb, hYD⟩ | ⟨hLi, hYD⟩ + · exact one hD hLb hY hYD haY hbY hC hCL + · have hab : a ≠ b := by + obtain ⟨f, rfl, rfl⟩ := hL + intro he + exact zero_ne_one (f.injective (Subtype.ext he)) + have haL : a ∈ L := by + obtain ⟨f, h0, -⟩ := hL + exact h0 ▸ (f 0).2 + have hbL : b ∈ L := by + obtain ⟨f, -, h1⟩ := hL + exact h1 ▸ (f 1).2 + have hmeet : L ∩ discBd D = {a, b} := by + ext x + constructor + · rintro ⟨hx, hxb⟩ + by_contra hcon + exact (hLi ⟨hx, hcon⟩).2 hxb + · rintro (rfl | rfl) + · exact ⟨haL, ha⟩ + · exact ⟨hbL, hb⟩ + obtain ⟨A₁, A₂, Δ₁, Δ₂, -, -, d1, d2, hun, hint, b1, b2, -⟩ := disc_iArc D L a b hD hLD hab hL + hmeet + have hL1 : L ⊆ Δ₁ := fun x hx => (hint ▸ hx : x ∈ Δ₁ ∩ Δ₂).1 + have hL2 : L ⊆ Δ₂ := fun x hx => (hint ▸ hx : x ∈ Δ₁ ∩ Δ₂).2 + obtain ⟨h₁, g1, g2⟩ := one (Y := Y ∪ Δ₂) d1 (b1 ▸ subset_union_right) + (hY.union d2.isClosed) + (by + rintro x ⟨hx | hx, hx'⟩ + · rcases hYD ⟨hx, hun ▸ Or.inl hx'⟩ with rfl | rfl + · exact haL + · exact hbL + · exact hint ▸ ⟨hx', hx⟩) + (.inl haY) (.inl hbY) hC hCL + have hC' : IsClosed (h₁ '' C) := h₁.isClosed_image.mpr hC + obtain ⟨h₂, g3, g4⟩ := one (Y := Y ∪ Δ₁) (C := h₁ '' C) d2 (b2 ▸ subset_union_right) + (hY.union d1.isClosed) + (by + rintro x ⟨hx | hx, hx'⟩ + · rcases hYD ⟨hx, hun ▸ Or.inr hx'⟩ with rfl | rfl + · exact haL + · exact hbL + · exact hint ▸ ⟨hx, hx'⟩) + (.inl haY) (.inl hbY) hC' + (by + rintro _ ⟨⟨y, hy, rfl⟩, hyL⟩ + have h3 : h₁ (h₁ y) = h₁ y := g1 _ (.inr (hL2 hyL)) + have h4 : h₁ y = y := h₁.injective h3 + rw [h4] at hyL ⊢ + exact hCL ⟨hy, hyL⟩) + refine ⟨h₁.trans h₂, fun y hy => ?_, ?_⟩ + · change h₂ (h₁ y) = y + rw [g1 y (.inl hy), g3 y (.inl hy)] + · rintro _ ⟨⟨y, hy, rfl⟩, hyD⟩ + change h₂ (h₁ y) ∈ _ + change h₂ (h₁ y) ∈ D at hyD + rw [← hun] at hyD + rcases hyD with hy1 | hy2 + · have h3 : h₂ (h₂ (h₁ y)) = h₂ (h₁ y) := g3 _ (.inr hy1) + have h4 : h₂ (h₁ y) = h₁ y := h₂.injective h3 + rw [h4] at hy1 ⊢ + exact g2 ⟨mem_image_of_mem _ hy, hy1⟩ + · exact g4 ⟨mem_image_of_mem _ (mem_image_of_mem _ hy), hy2⟩ + +end disc + +theorem exists_capAll_aux (n : ℕ) : ∀ (S : Type u) [TopologicalSpace S] (l : List (Set S)), + l.length = n → IsSurface S → (∀ F ∈ l, IsPreconnected F ∧ F ⊆ bd S) → bd S ⊆ ⋃ F ∈ l, F → + ∃ (T : Type u) (_ : TopologicalSpace T) (j : S → T) (K : Set T), IsClosedSurface T ∧ + IsClosedEmbedding j ∧ IsClosed K ∧ range j ∪ K = univ ∧ range j ∩ K = j '' bd S ∧ + (ConnectedSpace S → ConnectedSpace T) ∧ + ∃ 𝓓 : Set (Set T), 𝓓.Finite ∧ ⋃₀ 𝓓 = K ∧ (∀ D ∈ 𝓓, IsClosedDisc D ∧ IsPreconnected + (D ∩ range j) ∧ (D ∩ range j).Nonempty) ∧ + ∀ D ∈ 𝓓, ∀ D' ∈ 𝓓, D ≠ D' → Disjoint D D' := by + classical + induction n with + | zero => + intro S _ l hl hS _ hcov + have hb : ∀ x : S, x ∉ bd S := fun x hx => by + have := hcov hx + rw [List.length_eq_zero_iff.mp hl] at this + simp at this + refine ⟨S, _, id, ∅, ⟨hS.1, hS.2.1, fun x => ?_⟩, IsClosedEmbedding.id, isClosed_empty, by simp, + by simp [Set.eq_empty_iff_forall_notMem.mpr hb], id, ∅, by simp, by simp, by simp, by simp⟩ + by_contra hcon + exact hb x hcon + | succ n ih => + intro S _ l hl hS hl1 hcov + obtain ⟨F, l', rfl⟩ := List.exists_cons_of_length_eq_add_one hl + have hl' : l'.length = n := by simpa using hl + rcases F.eq_empty_or_nonempty with rfl | ⟨x, hx⟩ + · refine ih S l' hl' hS (fun F' h => hl1 F' (.tail _ h)) fun y hy => ?_ + have := hcov hy + simpa using this + have hxb : x ∈ bd S := (hl1 F (.head _)).2 hx + let C := connectedComponentIn (bd S) x + have hC : IsCuff C := ⟨x, hxb, rfl⟩ + have hCb : C ⊆ bd S := connectedComponentIn_subset _ _ + have hFC : F ⊆ C := (hl1 F (.head _)).1.subset_connectedComponentIn hx (hl1 F (.head _)).2 + obtain ⟨S', _, ι, Δ, hS', hι, hΔ, hcov', hmeet, -, hbdS⟩ := paste_disc.{u} S C hS hC + have hιi := hι.injective + have : T2Space S' := hS'.2.1 + obtain ⟨T, _, j, K, hT, hj, hK, hu, hi, hconn, 𝓓, h𝓓f, h𝓓u, h𝓓d, h𝓓j⟩ := ih S' (l'.map fun F' + => ι '' (F' \ C)) (by simpa using hl') hS' + (by + intro G hG + obtain ⟨F', hF', rfl⟩ := List.mem_map.mp hG + obtain ⟨h1, h2⟩ := hl1 F' (.tail _ hF') + constructor + · by_cases hne : (F' ∩ C).Nonempty + · obtain ⟨y, hy, hyC⟩ := hne + have h3 : F' ⊆ C := by + have h4 := h1.subset_connectedComponentIn hy h2 + rwa [← connectedComponentIn_eq hyC] at h4 + rw [sdiff_eq_empty.mpr h3, image_empty] + exact isPreconnected_empty + · have h3 : F' \ C = F' := by + ext z + exact ⟨fun h => h.1, fun h => ⟨h, fun hc => hne ⟨z, h, hc⟩⟩⟩ + rw [h3] + exact h1.image _ hι.continuous.continuousOn + · rw [hbdS] + exact image_mono (sdiff_subset_sdiff_left h2)) + (by + rw [hbdS] + rintro _ ⟨y, ⟨hy, hyC⟩, rfl⟩ + have h1 := hcov hy + simp only [List.mem_cons, iUnion_iUnion_eq_or_left, mem_union, mem_iUnion, + exists_prop] at h1 + rcases h1 with h1 | ⟨F', hF', h1⟩ + · exact absurd (hFC h1) hyC + · exact Set.mem_iUnion₂.mpr ⟨_, List.mem_map.mpr ⟨F', hF', rfl⟩, y, ⟨h1, hyC⟩, rfl⟩) + have hΔK : Disjoint (j '' Δ) K := Set.disjoint_left.mpr fun y hy hyK => by + obtain ⟨z, hz, rfl⟩ := hy + have h2 : j z ∈ j '' bd S' := hi ▸ ⟨⟨z, rfl⟩, hyK⟩ + obtain ⟨z', hz', he⟩ := h2 + have h3 : z' = z := hj.injective he + subst h3 + rw [hbdS] at hz' + obtain ⟨w, hw, rfl⟩ := hz' + have h4 : ι w ∈ ι '' C := hmeet ▸ ⟨⟨w, rfl⟩, hz⟩ + obtain ⟨v, hv, he'⟩ := h4 + have h5 : v = w := hιi he' + exact hw.2 (h5 ▸ hv) + have hrange : ∀ D ∈ 𝓓, D ∩ range (j ∘ ι) = D ∩ range j := fun D hD => by + ext y + constructor + · rintro ⟨h1, w, rfl⟩ + exact ⟨h1, _, rfl⟩ + · rintro ⟨h1, z, rfl⟩ + refine ⟨h1, ?_⟩ + have h2 : z ∈ range ι ∪ Δ := hcov' ▸ mem_univ z + rcases h2 with ⟨w, rfl⟩ | h2 + · exact ⟨w, rfl⟩ + · exact absurd (h𝓓u ▸ (⟨D, hD, h1⟩ : j z ∈ ⋃₀ 𝓓)) (Set.disjoint_left.mp hΔK ⟨z, h2, rfl⟩) + have hΔj : IsClosedDisc (j '' Δ) := by + obtain ⟨φ⟩ := id hΔ + exact ⟨φ.trans (hj.isEmbedding.homeomorphImage Δ)⟩ + have hΔr : j '' Δ ∩ range (j ∘ ι) = (j ∘ ι) '' C := by + ext y + constructor + · rintro ⟨⟨z, hz, rfl⟩, w, he⟩ + have he' : ι w = z := hj.injective he + have h4 : ι w ∈ ι '' C := hmeet ▸ ⟨⟨w, rfl⟩, he' ▸ hz⟩ + obtain ⟨v, hv, h5⟩ := h4 + exact ⟨v, hv, by simp only [Function.comp, h5, he']⟩ + · rintro ⟨w, hw, rfl⟩ + have h1 : ι w ∈ range ι ∩ Δ := hmeet ▸ mem_image_of_mem ι hw + exact ⟨⟨_, h1.2, rfl⟩, w, rfl⟩ + have hnotin : j '' Δ ∉ 𝓓 := fun h' => by + obtain ⟨y, hy⟩ := hΔ.nonempty_discInt + exact Set.disjoint_left.mp hΔK ⟨y, hy.1, rfl⟩ (h𝓓u ▸ (⟨_, h', ⟨y, hy.1, rfl⟩⟩ : j y ∈ ⋃₀ 𝓓)) + refine ⟨T, _, j ∘ ι, K ∪ j '' Δ, hT, hj.comp hι, hK.union (hj.isClosedMap _ hΔ.isClosed), ?_, + ?_, fun hc => hconn ?_, + insert (j '' Δ) 𝓓, h𝓓f.insert _, ?_, ?_, ?_⟩ + rotate_left 3 + · rw [sUnion_insert, h𝓓u, union_comm] + · rintro D (rfl | hD) + · refine ⟨hΔj, ?_, ?_⟩ + · rw [hΔr] + exact (isPreconnected_connectedComponentIn).image _ (hj.comp hι).continuous.continuousOn + · rw [hΔr] + exact ⟨_, x, mem_connectedComponentIn hxb, rfl⟩ + · rw [hrange D hD] + exact h𝓓d D hD + · have hdK : ∀ D ∈ 𝓓, Disjoint (j '' Δ) D := fun D hD => + hΔK.mono_right (h𝓓u ▸ subset_sUnion_of_mem hD) + rintro D (rfl | hD) D' (rfl | hD') hne + · exact absurd rfl hne + · exact hdK D' hD' + · exact (hdK D hD).symm + · exact h𝓓j D hD D' hD' hne + rotate_left 2 + · have hCne : (ι '' C).Nonempty := ⟨ι x, x, mem_connectedComponentIn hxb, rfl⟩ + obtain ⟨y, hy⟩ := hCne + have hy' : y ∈ range ι ∩ Δ := hmeet ▸ hy + have h1 : IsPreconnected (range ι) := isPreconnected_range hι.continuous + have h2 : IsPreconnected Δ := by + obtain ⟨φ⟩ := id hΔ + have : Δ = range fun t => (φ t).1 := by + ext z + constructor + · intro hz + exact ⟨φ.symm ⟨z, hz⟩, by simp⟩ + · rintro ⟨t, rfl⟩ + exact (φ t).2 + rw [this] + have : PreconnectedSpace ClosedUnitDisc := Subtype.preconnectedSpace + (convex_closedBall _ _).isPreconnected + exact isPreconnected_range (continuous_subtype_val.comp φ.continuous) + have h3 := h1.union' ⟨y, hy'.1, hy'.2⟩ h2 + rw [hcov'] at h3 + exact { toPreconnectedSpace := ⟨h3⟩, toNonempty := ⟨y⟩ } + · rw [eq_univ_iff_forall] + intro y + have h1 : y ∈ range j ∪ K := hu ▸ mem_univ y + rcases h1 with ⟨z, rfl⟩ | h1 + · have h2 : z ∈ range ι ∪ Δ := hcov' ▸ mem_univ z + rcases h2 with ⟨w, rfl⟩ | h2 + · exact .inl ⟨w, rfl⟩ + · exact .inr (.inr ⟨z, h2, rfl⟩) + · exact .inr (.inl h1) + · ext y + constructor + · rintro ⟨⟨w, rfl⟩, h1 | ⟨z, hz, he⟩⟩ + · have h2 : (j ∘ ι) w ∈ j '' bd S' := hi ▸ ⟨⟨_, rfl⟩, h1⟩ + obtain ⟨z, hz, he⟩ := h2 + rw [hbdS] at hz + obtain ⟨v, hv, rfl⟩ := hz + have : v = w := hιi (hj.injective he) + subst this + exact ⟨v, hv.1, rfl⟩ + · have h3 : ι w = z := hj.injective he.symm + have h4 : ι w ∈ ι '' C := hmeet ▸ ⟨⟨w, rfl⟩, h3 ▸ hz⟩ + obtain ⟨v, hv, he'⟩ := h4 + have : v = w := hιi he' + subst this + exact ⟨v, hCb hv, rfl⟩ + · rintro ⟨w, hw, rfl⟩ + refine ⟨⟨w, rfl⟩, ?_⟩ + by_cases hwC : w ∈ C + · have h1 : ι w ∈ range ι ∩ Δ := hmeet ▸ mem_image_of_mem ι hwC + exact .inr ⟨_, h1.2, rfl⟩ + · have h1 : j (ι w) ∈ range j ∩ K := hi ▸ mem_image_of_mem j (hbdS ▸ ⟨w, ⟨hw, hwC⟩, rfl⟩) + exact .inl h1.2 + +/-- Capping all the cuffs of a surface gives a surface without boundary, and the caps are disjoint +closed discs. -/ +theorem exists_capAll_discs (S : Type u) [TopologicalSpace S] (hS : IsSurface S) : + ∃ (T : Type u) (_ : TopologicalSpace T) (j : S → T) (K : Set T), IsClosedSurface T ∧ + IsClosedEmbedding j ∧ IsClosed K ∧ range j ∪ K = univ ∧ range j ∩ K = j '' bd S ∧ + (ConnectedSpace S → ConnectedSpace T) ∧ + ∃ 𝓓 : Set (Set T), 𝓓.Finite ∧ ⋃₀ 𝓓 = K ∧ (∀ D ∈ 𝓓, IsClosedDisc D ∧ IsPreconnected + (D ∩ range j) ∧ (D ∩ range j).Nonempty) ∧ + ∀ D ∈ 𝓓, ∀ D' ∈ 𝓓, D ≠ D' → Disjoint D D' := by + classical + have hf := (cuff_statement.{u} S hS).2.1 + refine exists_capAll_aux _ S hf.toFinset.toList rfl hS (fun F hF => ?_) fun x hx => ?_ + · have hF' : F ∈ cuffs S := by simpa using hF + obtain ⟨x, hx, rfl⟩ := hF' + exact ⟨isPreconnected_connectedComponentIn, connectedComponentIn_subset _ _⟩ + · have hm : connectedComponentIn (bd S) x ∈ hf.toFinset.toList := by + rw [Finset.mem_toList, Set.Finite.mem_toFinset] + exact ⟨x, hx, rfl⟩ + exact Set.mem_iUnion₂.mpr ⟨_, hm, mem_connectedComponentIn hx⟩ + +/-- Capping all the cuffs of a surface gives a surface without boundary. -/ +theorem exists_capAll (S : Type u) [TopologicalSpace S] (hS : IsSurface S) : + ∃ (T : Type u) (_ : TopologicalSpace T) (j : S → T) (K : Set T), IsClosedSurface T ∧ + IsClosedEmbedding j ∧ IsClosed K ∧ range j ∪ K = univ ∧ range j ∩ K = j '' bd S ∧ + (ConnectedSpace S → ConnectedSpace T) := by + obtain ⟨T, t, j, K, h1, h2, h3, h4, h5, h6, -⟩ := exists_capAll_discs S hS + exact ⟨T, t, j, K, h1, h2, h3, h4, h5, h6⟩ + +/-- Push a curve off finitely many discs by moving each disc independently. The line in a disc is +either an interior chord or a boundary arc containing the part of the fixed set in that disc. -/ +theorem push_off_discs {S : Type u} [TopologicalSpace S] (hS : IsSurface S) + {ι : Type} [Finite ι] {N Z : Set S} {D L : ι → Set S} + (hN : N.Finite) (hZ : IsClosed Z) (hD : ∀ i, IsClosedDisc (D i)) + (hL : ∀ i, ∃ a b, IsLineWithEnds (L i) a b ∧ D i ∩ N = {a, b} ∧ + a ∈ discBd (D i) ∧ b ∈ discBd (D i) ∧ L i ⊆ D i ∧ + ((L i \ {a, b} ⊆ D i \ discBd (D i) ∧ D i ∩ bd S ⊆ N ∧ D i ∩ Z ⊆ N) ∨ + (L i ⊆ discBd (D i) ∧ D i ∩ bd S ⊆ L i ∧ D i ∩ Z ⊆ L i))) + (hDD : ∀ i j, i ≠ j → D i ∩ D j ⊆ N) {F : Set S} + (hF : IsOArc F) (hFZ : F ∩ Z ⊆ N) (hFL : ∀ i, F ∩ L i ⊆ N) : + ∃ h : S ≃ₜ S, (∀ n ∈ N, h n = n) ∧ (h '' F) ∩ Z ⊆ N ∧ ∀ i, (h '' F) ∩ D i ⊆ N := by + classical + obtain ⟨hcpt, ht2, _⟩ := id hS + obtain ⟨T, _, j, K, hT, hj, hK, hu, hi, -⟩ := exists_capAll S hS + obtain ⟨hTc, hTt, hTi⟩ := id hT + obtain ⟨φ⟩ := id hF + have : Nonempty S := ⟨(φ 1).1⟩ + have := Fintype.ofFinite ι + have hji := hj.injective + obtain ⟨j', hjc, hjl⟩ := exists_inv_of_compactOn isCompact_univ hj.continuous.continuousOn + hji.injOn + have hdisc : ∀ {E : Set S}, IsClosedDisc E → IsClosedDisc (j '' E) ∧ discBd (j '' E) + = j '' discBd E := + fun hE => hE.image hj.continuous.continuousOn (hjc.mono (image_mono (subset_univ _))) + (hjl.mono (subset_univ _)) + let Z' : Set T := K ∪ (j '' N ∪ j '' Z) + have hZ' : IsClosed Z' := hK.union ((hj.isClosedMap _ hN.isClosed).union (hj.isClosedMap _ hZ)) + have hFc : IsClosed (j '' F) := hj.isClosedMap _ hF.isCompact.isClosed + have main : ∀ s : Finset ι, ∃ h : T ≃ₜ T, (∀ y ∈ Z', h y = y) ∧ (∀ k, k ∉ s → ∀ y ∈ j '' D k, h y + = y) ∧ + ∀ k ∈ s, h '' (j '' F) ∩ j '' D k ⊆ j '' N := by + intro s + induction s using Finset.induction_on with + | empty => + exact ⟨Homeomorph.refl T, fun _ _ => rfl, fun _ _ _ _ => rfl, fun k hk => absurd hk (by simp)⟩ + | insert i s his ih => + obtain ⟨h, h1, h2, h3⟩ := ih + obtain ⟨a, b, hLi, hDN, ha, hb, hLD, hcase⟩ := hL i + have haL : a ∈ L i := by + obtain ⟨f, h4, -⟩ := hLi + exact h4 ▸ (f 0).2 + have hbL : b ∈ L i := by + obtain ⟨f, -, h4⟩ := hLi + exact h4 ▸ (f 1).2 + have haN : a ∈ D i ∩ N := hDN ▸ Or.inl rfl + have hbN : b ∈ D i ∩ N := hDN ▸ Or.inr rfl + let Y : Set T := Z' ∪ ⋃ k ∈ {k | k ≠ i}, j '' D k + have hY : IsClosed Y := hZ'.union ((Set.toFinite _).isClosed_biUnion fun k _ => + hj.isClosedMap _ (hD k).isClosed) + obtain ⟨d1, d2⟩ := hdisc (hD i) + have hYN : ∀ x ∈ Y, ∀ y ∈ D i, x = j y → y ∈ N ∨ y ∈ bd S ∨ y ∈ Z := by + rintro x (hx | hx) y hy rfl + · rcases hx with hx | ⟨w, hw, he⟩ | ⟨w, hw, he⟩ + · obtain ⟨w, hw, he⟩ : j y ∈ j '' bd S := hi ▸ ⟨⟨y, rfl⟩, hx⟩ + exact .inr (.inl (hji he ▸ hw)) + · exact .inl (hji he ▸ hw) + · exact .inr (.inr (hji he ▸ hw)) + · obtain ⟨k, hk, w, hw, he⟩ := mem_iUnion₂.mp hx + exact .inl (hDD i k hk.symm ⟨hy, hji he ▸ hw⟩) + have hline : IsLineWithEnds (j '' L i) (j a) (j b) := by + obtain ⟨f, h4, h5⟩ := hLi + refine ⟨f.trans (hj.isEmbedding.homeomorphImage (L i)), ?_, ?_⟩ + · exact congrArg j h4 + · exact congrArg j h5 + have hC : IsClosed (h '' (j '' F)) := h.isClosed_image.mpr hFc + obtain ⟨h₂, g1, g2⟩ := push_disc (T := T) hTi (D := j '' D i) (L := j '' L i) (Y := Y) + (C := h '' (j '' F)) d1 hline (image_mono hLD) + (by + rcases hcase with ⟨hinside, hbdN, hZN⟩ | ⟨hLb, hbdL, hZL⟩ + · right + refine ⟨?_, ?_⟩ + · rintro _ ⟨⟨y, hy, rfl⟩, hne⟩ + have hy' : y ∉ ({a, b} : Set S) := fun hm => hne (by + rcases hm with rfl | rfl + · exact .inl rfl + · exact .inr rfl) + obtain ⟨hd, hnotBd⟩ := hinside ⟨hy, hy'⟩ + refine ⟨mem_image_of_mem j hd, ?_⟩ + rw [d2] + rintro ⟨w, hw, he⟩ + exact hnotBd (hji he ▸ hw) + · rintro x ⟨hx, y, hy, rfl⟩ + have hyN : y ∈ N := by + rcases hYN _ hx y hy rfl with hN | hbd | hZ + · exact hN + · exact hbdN ⟨hy, hbd⟩ + · exact hZN ⟨hy, hZ⟩ + have hyEnds : y ∈ ({a, b} : Set S) := hDN ▸ ⟨hy, hyN⟩ + rcases hyEnds with rfl | rfl + · exact .inl rfl + · exact .inr rfl + · left + refine ⟨?_, ?_⟩ + · rw [d2] + exact image_mono hLb + · rintro x ⟨hx, y, hy, rfl⟩ + refine mem_image_of_mem j ?_ + rcases hYN _ hx y hy rfl with hN | hbd | hZ + · have hyEnds : y ∈ ({a, b} : Set S) := hDN ▸ ⟨hy, hN⟩ + rcases hyEnds with rfl | rfl + · exact haL + · exact hbL + · exact hbdL ⟨hy, hbd⟩ + · exact hZL ⟨hy, hZ⟩) + (by rw [d2]; exact mem_image_of_mem j ha) (by rw [d2]; exact mem_image_of_mem j hb) + hY (.inl (.inr (.inl (mem_image_of_mem j haN.2)))) (.inl (.inr (.inl + (mem_image_of_mem j hbN.2)))) + hC + (by + rintro _ ⟨⟨_, ⟨y, hy, rfl⟩, rfl⟩, w, hw, he⟩ + have h4 : h (j w) = j w := h2 i (by simpa using his) _ (mem_image_of_mem j (hLD hw)) + have h5 : j w = j y := h.injective (h4.trans he) + have h6 : w = y := hji h5 + subst h6 + have h7 : w ∈ D i ∩ N := ⟨hLD hw, hFL i ⟨hy, hw⟩⟩ + rw [hDN] at h7 + rw [← he] + rcases h7 with rfl | rfl + · exact .inl rfl + · exact .inr rfl) + refine ⟨h.trans h₂, fun y hy => ?_, fun k hk y hy => ?_, fun k hk => ?_⟩ + · change h₂ (h y) = y + rw [h1 y hy, g1 y (.inl hy)] + · have hk1 : k ≠ i := fun he => hk (by simp [he]) + have hk2 : k ∉ s := fun he => hk (by simp [he]) + change h₂ (h y) = y + rw [h2 k hk2 y hy, g1 y (.inr (mem_iUnion₂.mpr ⟨k, hk1, hy⟩))] + · rintro _ ⟨⟨_, ⟨y, hy, rfl⟩, rfl⟩, hx⟩ + by_cases hki : k = i + · subst hki + have h4 : (h.trans h₂) (j y) ∈ h₂ '' (h '' (j '' F)) ∩ j '' D k := + ⟨⟨_, ⟨_, mem_image_of_mem j hy, rfl⟩, rfl⟩, hx⟩ + rcases g2 h4 with h5 | h5 + · rw [h5] + exact mem_image_of_mem j haN.2 + · rw [h5] + exact mem_image_of_mem j hbN.2 + · have hks : k ∈ s := by simpa [hki] using hk + have h4 : h₂ (h₂ (h (j y))) = h₂ (h (j y)) := g1 _ (.inr (mem_iUnion₂.mpr ⟨k, hki, hx⟩)) + have h5 : h₂ (h (j y)) = h (j y) := h₂.injective h4 + change h₂ (h (j y)) ∈ _ at hx + change h₂ (h (j y)) ∈ _ + rw [h5] at hx ⊢ + exact h3 k hks ⟨⟨_, mem_image_of_mem j hy, rfl⟩, hx⟩ + obtain ⟨H, f1, -, f3⟩ := main Finset.univ + have hfixK : ∀ y ∈ K, H y = y := fun y hy => f1 y (.inl hy) + have hran : ∀ x, x ∈ range j ↔ H x ∈ range j := by + intro x + constructor + · intro hx + by_contra hcon + have h1 : H x ∈ K := (hu ▸ mem_univ (H x) : H x ∈ range j ∪ K).resolve_left hcon + have h2 := H.injective (hfixK _ h1) + exact hcon (by rw [h2]; exact hx) + · intro hx + by_contra hcon + have h1 : x ∈ K := (hu ▸ mem_univ x : x ∈ range j ∪ K).resolve_left hcon + exact hcon (hfixK x h1 ▸ hx) + let e : S ≃ₜ range j := hj.isEmbedding.toHomeomorph + let h : S ≃ₜ S := e.trans ((H.subtype hran).trans e.symm) + have hjh : ∀ x, j (h x) = H (j x) := fun x => by + have h1 : e (h x) = (H.subtype hran) (e x) := e.apply_symm_apply _ + exact congrArg Subtype.val h1 + have hfixN : ∀ n ∈ N, h n = n := fun n hn => + hji ((hjh n).trans (f1 _ (.inr (.inl (mem_image_of_mem j hn))))) + refine ⟨h, hfixN, ?_, fun i => ?_⟩ + · rintro _ ⟨⟨y, hy, rfl⟩, hz⟩ + have h1 : H (j (h y)) = j (h y) := f1 _ (.inr (.inr (mem_image_of_mem j hz))) + rw [hjh] at h1 + have h2 : H (j y) = j y := H.injective h1 + have h3 : h y = y := hji ((hjh y).trans h2) + rw [h3] at hz ⊢ + exact hFZ ⟨hy, hz⟩ + · rintro _ ⟨⟨y, hy, rfl⟩, hz⟩ + obtain ⟨w, hw, he⟩ := f3 i (Finset.mem_univ i) + ⟨⟨j y, mem_image_of_mem j hy, (hjh y).symm⟩, mem_image_of_mem j hz⟩ + exact hji he ▸ hw + +/-- **Pushing a closed set off discs.** See the module docstring. -/ +theorem push_off : PushOffStatement := by + intro S _ hS ι _ N Z D L hN hZ hD hL hDD hDZ F hF hFZ hFL + refine push_off_discs hS hN hZ hD ?_ hDD hF hFZ hFL + intro i + obtain ⟨a, b, hLi, hDN, ha, hb, hLD, hcase⟩ := hL i + refine ⟨a, b, hLi, hDN, ha, hb, hLD, ?_⟩ + rcases hcase with ⟨hinside, hbdN⟩ | hboundary + · exact .inl ⟨hinside, hbdN, hDZ i⟩ + · have hLb : L i ⊆ discBd (D i) := by + rw [hboundary] + rintro y ⟨hyD, hybd⟩ + by_contra hy_not + exact hybd (isInteriorPoint_of_mem_discInt hS.2.2 (hD i) ⟨hyD, hy_not⟩) + refine .inr ⟨hLb, hboundary.symm.subset, ?_⟩ + intro y hy + have hyEnds : y ∈ ({a, b} : Set S) := hDN ▸ ⟨hy.1, hDZ i hy⟩ + rcases hyEnds with rfl | rfl + · obtain ⟨f, h0, _⟩ := hLi + exact h0 ▸ (f 0).2 + · obtain ⟨f, _, h1⟩ := hLi + exact h1 ▸ (f 1).2 + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/RemoveDiscs.lean b/LeanPool/GraphMinor/Surface/RemoveDiscs.lean new file mode 100644 index 0000000000..91a1d1e650 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/RemoveDiscs.lean @@ -0,0 +1,230 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.AddCrosscap +public import LeanPool.GraphMinor.Surface.DiscRemove +public import LeanPool.GraphMinor.GM12.Section3ClosedComponents + +/-! +# Removing several discs from a closed surface + +We remove the interiors of finitely many pairwise disjoint closed discs from a closed connected +surface (`remove_discs`). The result is a +connected surface whose cuffs are the boundaries of the discs. The work for one disc is +`remove_disc`. Near a boundary of a disc the set we keep +agrees with the set that keeps all the other discs, so the facts are local. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +variable {S : Type} [TopologicalSpace S] + +/-- Two subsets of `S` that agree on an open set `W` have homeomorphic parts in `O ⊆ W`. -/ +theorem exists_local_homeo {X Y W O : Set S} (h : X ∩ W = Y ∩ W) (hO : O ⊆ W) : + Nonempty ((Subtype.val ⁻¹' O : Set ↥X) ≃ₜ (Subtype.val ⁻¹' O : Set ↥Y)) := by + have hXY : X ∩ O = Y ∩ O := by + ext z + constructor + · rintro ⟨h₁, h₂⟩ + exact ⟨(h.subset ⟨h₁, hO h₂⟩).1, h₂⟩ + · rintro ⟨h₁, h₂⟩ + exact ⟨(h.symm.subset ⟨h₁, hO h₂⟩).1, h₂⟩ + have hem : ∀ Z : Set S, IsEmbedding (fun z : (Subtype.val ⁻¹' O : Set ↥Z) => (z.1.1 : S)) + := fun Z => + IsEmbedding.subtypeVal.comp IsEmbedding.subtypeVal + have hr : ∀ Z : Set S, range (fun z : (Subtype.val ⁻¹' O : Set ↥Z) => (z.1.1 : S)) = Z ∩ O + := fun Z => by + ext z + constructor + · rintro ⟨w, rfl⟩ + exact ⟨w.1.2, w.2⟩ + · rintro ⟨h₁, h₂⟩ + exact ⟨⟨⟨z, h₁⟩, h₂⟩, rfl⟩ + have eq : range (fun z : (Subtype.val ⁻¹' O : Set ↥X) => (z.1.1 : S)) = range (fun z : + (Subtype.val ⁻¹' O : Set ↥Y) => (z.1.1 : S)) := by + rw [hr, hr, hXY] + exact ⟨((hem X).toHomeomorph.trans (Homeomorph.setCongr eq)).trans (hem Y).toHomeomorph.symm⟩ + +/-- Being an interior point is local. -/ +theorem IsInteriorPoint.congr_local {X Y W : Set S} (hW : IsOpen W) (h : X ∩ W + = Y ∩ W) {x : ↥X} {y : ↥Y} (hxy : x.1 = y.1) (hx : x.1 ∈ W) + (hi : IsInteriorPoint x) : IsInteriorPoint y := by + obtain ⟨U, hU, hxU, hsub, ⟨f⟩⟩ := hi.exists_subset (hW.preimage continuous_subtype_val) hx + obtain ⟨O₀, hO₀, rfl⟩ := isOpen_induced_iff.mp hU + have heq : (Subtype.val ⁻¹' O₀ : Set ↥X) = Subtype.val ⁻¹' (O₀ ∩ W) := by + ext z + exact ⟨fun hz => ⟨hz, hsub hz⟩, fun hz => hz.1⟩ + obtain ⟨g⟩ := exists_local_homeo h (inter_subset_right (s := O₀) (t := W)) + exact ⟨Subtype.val ⁻¹' (O₀ ∩ W), (hO₀.inter hW).preimage continuous_subtype_val, ⟨hxy ▸ hxU, + hxy ▸ hx⟩, + ⟨g.symm.trans ((Homeomorph.setCongr heq.symm).trans f)⟩⟩ + +/-- Being a manifold point is local. -/ +theorem IsManifoldPoint.congr_local {X Y W : Set S} (hW : IsOpen W) (h : X ∩ W + = Y ∩ W) {x : ↥X} {y : ↥Y} (hxy : x.1 = y.1) (hx : x.1 ∈ W) + (hi : IsManifoldPoint x) : IsManifoldPoint y := by + obtain ⟨U, V, hU, hV, hxU, ⟨f⟩⟩ := hi + obtain ⟨O₀, hO₀, rfl⟩ := isOpen_induced_iff.mp hU + obtain ⟨g⟩ := exists_local_homeo h (inter_subset_right (s := O₀) (t := W)) + have hsub : (Subtype.val ⁻¹' (O₀ ∩ W) : Set ↥X) ⊆ Subtype.val ⁻¹' O₀ := fun z hz => hz.1 + have hj : IsOpenEmbedding (fun z : (Subtype.val ⁻¹' (O₀ ∩ W) : Set ↥X) => ((f + (inclusion hsub z)).1 : EuclideanHalfSpace 2)) := by + have h₁ : IsOpenEmbedding (inclusion hsub) := .inclusion hsub (((hO₀.inter hW).preimage + continuous_subtype_val).preimage continuous_subtype_val) + exact hV.isOpenEmbedding_subtypeVal.comp (f.isOpenEmbedding.comp h₁) + exact ⟨Subtype.val ⁻¹' (O₀ ∩ W), _, (hO₀.inter hW).preimage continuous_subtype_val, + hj.isOpen_range, ⟨hxy ▸ hxU, hxy ▸ hx⟩, + ⟨g.symm.trans hj.toIsEmbedding.toHomeomorph⟩⟩ + +/-- **Removing several discs.** The interiors of finitely many pairwise disjoint closed discs come +out of a closed connected surface, and the rest is a connected surface with one cuff for each disc. +-/ +theorem remove_discs (hS : IsSurface S) (hb : ∀ x : S, IsInteriorPoint x) [ConnectedSpace S] {ι : + Type*} [Finite ι] {P : ι → Set S} (hP : ∀ i, IsClosedDisc (P i)) + (hd : Pairwise fun i j => Disjoint (P i) (P j)) : + IsClosed (⋃ i, discInt (P i))ᶜ ∧ IsSurface ↥(⋃ i, discInt (P i))ᶜ ∧ bd ↥(⋃ i, discInt (P i))ᶜ + = Subtype.val ⁻¹' (⋃ i, discBd (P i)) ∧ + ConnectedSpace ↥(⋃ i, discInt (P i))ᶜ ∧ cuffs ↥(⋃ i, discInt (P i))ᶜ = range fun i => + (Subtype.val ⁻¹' discBd (P i) : Set ↥(⋃ i, discInt (P i))ᶜ) := by + classical + have hman : ∀ x : S, IsManifoldPoint x := hS.2.2 + have : CompactSpace S := hS.1 + have : T2Space S := hS.2.1 + have hint : ∀ i, ∀ x ∈ discBd (P i), IsInteriorPoint x := fun i x _ => hb x + have hPc : ∀ i, IsClosed (P i) := fun i => (hP i).isClosed + have hopen : IsOpen (⋃ i, discInt (P i)) := isOpen_iUnion fun i => (hP i).isOpen_discInt hman + set X : Set S := (⋃ i, discInt (P i))ᶜ with hX + have hXc : IsClosed X := hopen.isClosed_compl + have hdB : ∀ i, discBd (P i) ⊆ P i := fun i => by + rintro _ ⟨y, -, rfl⟩ + exact y.2 + have hXd : ∀ {z i}, z ∈ X → z ∈ P i → z ∈ discBd (P i) := fun {z i} hz hi => by + by_contra hn + exact hz (mem_iUnion.2 ⟨i, hi, hn⟩) + have hBX : ∀ {z i}, z ∈ discBd (P i) → z ∈ X := fun {z i} hz hu => by + obtain ⟨j, hj, hn⟩ := mem_iUnion.1 hu + by_cases hij : j = i + · subst hij + exact hn hz + · exact Set.disjoint_left.mp (hd hij) hj (hdB i hz) + let W : ι → Set S := fun i => (⋃ j ∈ {j | j ≠ i}, P j)ᶜ + have hWo : ∀ i, IsOpen (W i) := fun i => ((Set.toFinite _).isClosed_biUnion fun j _ + => hPc j).isOpen_compl + have hW : ∀ i, X ∩ W i = (discInt (P i))ᶜ ∩ W i := fun i => by + ext z + constructor + · rintro ⟨h₁, h₂⟩ + exact ⟨fun h => h₁ (mem_iUnion.2 ⟨i, h⟩), h₂⟩ + · rintro ⟨h₁, h₂⟩ + refine ⟨fun hu => ?_, h₂⟩ + obtain ⟨j, hj⟩ := mem_iUnion.1 hu + by_cases hij : j = i + · exact h₁ (hij ▸ hj) + · exact h₂ (mem_iUnion₂.2 ⟨j, hij, hj.1⟩) + have hPW : ∀ {z i}, z ∈ P i → z ∈ W i := fun {z i} hz hu => by + obtain ⟨j, hj, hm⟩ := mem_iUnion₂.1 hu + exact Set.disjoint_left.mp (hd hj) hm hz + have hmem : ∀ i, IsSurface ↥(discInt (P i))ᶜ ∧ bd ↥(discInt (P i))ᶜ = Subtype.val ⁻¹' + (bd S ∪ discBd (P i)) := fun i => by + obtain ⟨-, h₂, h₃⟩ := remove_disc hS (hP i) (fun x _ => hb x) + exact ⟨h₂, h₃⟩ + have hbdS : bd S = ∅ := eq_empty_of_forall_notMem fun x hx => hx (hb x) + have hoff : ∀ x : ↥X, (∀ i, x.1 ∉ P i) → IsInteriorPoint x := fun x hn => by + have hint' : IsInteriorPoint (⟨x.1, mem_univ _⟩ : ↥(univ : Set S)) := + (isInteriorPoint_homeomorph_iff (Homeomorph.Set.univ S) ⟨x.1, mem_univ _⟩).mp (hb x.1) + have hWW : IsOpen (⋃ j, P j)ᶜ := (isClosed_iUnion_of_finite hPc).isOpen_compl + refine IsInteriorPoint.congr_local (X := univ) (Y := X) hWW ?_ rfl (by simpa using hn) hint' + ext z + simp only [mem_inter_iff, mem_univ, true_and, mem_compl_iff] + constructor + · intro h + refine ⟨fun hu => ?_, h⟩ + obtain ⟨j, hj⟩ := mem_iUnion.1 hu + exact h (mem_iUnion.2 ⟨j, hj.1⟩) + · exact fun h => h.2 + have hbdX : bd ↥X = Subtype.val ⁻¹' (⋃ i, discBd (P i)) := by + ext x + constructor + · intro hx + by_contra hn + refine hx (hoff x fun i hi => hn (mem_iUnion.2 ⟨i, hXd x.2 hi⟩)) + · intro hx hi + obtain ⟨i, hxi⟩ := mem_iUnion.1 hx + have hy : (⟨x.1, fun h => h.2 hxi⟩ : ↥(discInt (P i))ᶜ) ∈ bd ↥(discInt (P i))ᶜ := by + rw [(hmem i).2] + exact Or.inr hxi + exact hy (IsInteriorPoint.congr_local (W := W i) (hWo i) (hW i) rfl (hPW (hdB i hxi)) hi) + have hsurf : IsSurface ↥X := by + have : CompactSpace ↥X := isCompact_iff_compactSpace.mp hXc.isCompact + refine ⟨inferInstance, inferInstance, fun x => ?_⟩ + by_cases hi : ∃ i, x.1 ∈ P i + · obtain ⟨i, hi⟩ := hi + have hb' : x.1 ∈ discBd (P i) := hXd x.2 hi + exact IsManifoldPoint.congr_local (hWo i) (hW i).symm rfl (hPW hi) ((hmem i).1.2.2 ⟨x.1, + fun h => h.2 hb'⟩) + · push Not at hi + exact (hoff x hi).isManifoldPoint + have hne : ∀ i, (discBd (P i)).Nonempty := fun i => (IsOArc.isConnected' + (hP i).isOArc_discBd).nonempty + have hXne : X.Nonempty := by + by_cases hι : Nonempty ι + · obtain ⟨i⟩ := hι + obtain ⟨z, hz⟩ := hne i + exact ⟨z, hBX hz⟩ + · have : IsEmpty ι := not_nonempty_iff.mp hι + obtain ⟨z⟩ : Nonempty S := inferInstance + exact ⟨z, by simp [hX]⟩ + have hcon : ConnectedSpace ↥X := by + have hPX : ∀ i, P i ∩ X = discBd (P i) := fun i => by + ext z + exact ⟨fun h => hXd h.2 h.1, fun h => ⟨hdB i h, hBX h⟩⟩ + refine connected_compl hXc hXne (Set.finite_range P) ?_ ?_ ?_ ?_ ?_ + · rintro _ ⟨i, rfl⟩ + exact hPc i + · rintro _ ⟨i, rfl⟩ + rw [hPX] + exact (IsOArc.isConnected' (hP i).isOArc_discBd).isPreconnected + · rintro _ ⟨i, rfl⟩ + rw [hPX] + exact hne i + · rintro _ ⟨i, rfl⟩ _ ⟨j, rfl⟩ hne' + exact hd fun h => hne' (h ▸ rfl) + · ext z + simp only [mem_union, mem_sUnion, mem_range, exists_exists_eq_and, mem_univ, iff_true] + by_cases hz : z ∈ X + · exact Or.inl hz + · have : z ∈ ⋃ i, discInt (P i) := not_not.mp hz + obtain ⟨i, hi⟩ := mem_iUnion.1 this + exact Or.inr ⟨i, hi.1⟩ + refine ⟨hXc, hsurf, hbdX, hcon, ?_⟩ + have hu : (Subtype.val ⁻¹' (⋃ i, discBd (P i)) : Set ↥X) = ⋃ i, (Subtype.val ⁻¹' discBd + (P i) : Set ↥X) := preimage_iUnion + rw [cuffs, hbdX, hu] + refine GM12.componentsIn_iUnion_disjoint_closed (fun i => (Subtype.val ⁻¹' discBd + (P i) : Set ↥X)) ?_ ?_ ?_ ?_ + · exact fun i => (hP i).isOArc_discBd.isCompact.isClosed.preimage continuous_subtype_val + · intro i + refine (IsOArc.isConnected' (hP i).isOArc_discBd).isPreconnected.preimage_of_isClosedMap + Subtype.val_injective + hXc.isClosedEmbedding_subtypeVal.isClosedMap ?_ + intro z hz + exact ⟨⟨z, hBX hz⟩, rfl⟩ + · intro i + obtain ⟨z, hz⟩ := hne i + exact ⟨⟨z, hBX hz⟩, hz⟩ + · intro i j hij + refine Set.disjoint_left.mpr fun z hz hz' => ?_ + exact Set.disjoint_left.mp (hd hij) (hdB i hz) (hdB j hz') + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Ring.lean b/LeanPool/GraphMinor/Surface/Ring.lean new file mode 100644 index 0000000000..036bd8e9b7 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Ring.lean @@ -0,0 +1,259 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Wedge + +/-! +# A thin disc around a disc + +Let `B` be a closed disc whose boundary lies in the interior of a surface, and let `Z` be a closed +set that meets `B` only on its boundary. We find a closed disc `Δ` around `B` that +meets `Z` only in `B`, and whose boundary leaves `B` at every point off `Z` (`exists_ring`). In a +collar of `B` the height of `Δ` above a point of the boundary of `B` is half the +distance to `Z`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +/-- The radial stretch of the plane by the factor `1 + d` in each direction. -/ +noncomputable def stretch (d : ℂ → ℝ) (z : ℂ) : ℂ := ((1 + d (z / ‖z‖) : ℝ) : ℂ) * z + +theorem norm_unit {z : ℂ} (hz : z ≠ 0) : ‖z / ‖z‖‖ = 1 := by + rw [norm_div, Complex.norm_real, norm_norm, div_self (norm_ne_zero_iff.mpr hz)] + +theorem norm_stretch {d : ℂ → ℝ} (hd : ∀ w, 0 ≤ d w) (z : ℂ) : ‖stretch d z‖ = (1 + d + (z / ‖z‖)) * ‖z‖ := by + rw [stretch, norm_mul, Complex.norm_real, Real.norm_of_nonneg (by linarith [hd (z / ‖z‖)])] + +theorem continuousOn_stretch {d : ℂ → ℝ} (hc : Continuous d) (hd : ∀ w, 0 ≤ d w) (hb : ∀ w, ‖w‖ = 1 + → d w ≤ 1 / 2) : Continuous (stretch d) := by + rw [continuous_iff_continuousAt] + intro z + by_cases hz : z = 0 + · subst hz + rw [ContinuousAt] + have h0 : stretch d 0 = 0 := by simp [stretch] + rw [h0, tendsto_zero_iff_norm_tendsto_zero] + refine squeeze_zero (fun _ => norm_nonneg _) (g := fun z => 3 / 2 * ‖z‖) (fun y => ?_) ?_ + · rw [norm_stretch hd] + by_cases hy : y = 0 + · simp [hy] + · have := hb _ (norm_unit hy) + have h2 := norm_nonneg y + nlinarith + · have h1 : Continuous fun z : ℂ => 3 / 2 * ‖z‖ := by fun_prop + simpa using h1.tendsto (0 : ℂ) + · have h1 : ContinuousAt (fun y : ℂ => y / ‖y‖) z := by + refine ContinuousAt.div continuousAt_id (by fun_prop) ?_ + exact_mod_cast norm_ne_zero_iff.mpr hz + have h2 : ContinuousAt (fun y : ℂ => d (y / ‖y‖)) z := hc.continuousAt.comp h1 + unfold stretch + exact ((Complex.continuous_ofReal.continuousAt.comp (continuousAt_const.add h2))).mul + continuousAt_id + +theorem unit_stretch {d : ℂ → ℝ} (hd : ∀ w, 0 ≤ d w) {z : ℂ} : stretch d z / ‖stretch d z‖ + = z / ‖z‖ := by + by_cases hz : z = 0 + · simp [hz, stretch] + have h1 : 0 < 1 + d (z / ‖z‖) := by linarith [hd (z / ‖z‖)] + rw [norm_stretch hd, stretch] + push_cast + have h3 : ((1 : ℂ) + (d (z / ‖z‖) : ℂ)) ≠ 0 := by + exact_mod_cast h1.ne' + have h4 : ((‖z‖ : ℝ) : ℂ) ≠ 0 := by + exact_mod_cast norm_ne_zero_iff.mpr hz + field_simp + +theorem stretch_injective {d : ℂ → ℝ} (hd : ∀ w, 0 ≤ d w) : Function.Injective (stretch d) := by + intro z z' he + have h1 : z / ‖z‖ = z' / ‖z'‖ := by + rw [← unit_stretch hd (z := z), ← unit_stretch hd (z := z'), he] + have h2 : (1 + d (z / ‖z‖) : ℝ) ≠ 0 := by linarith [hd (z / ‖z‖)] + rw [stretch, stretch, ← h1] at he + exact mul_left_cancel₀ (by exact_mod_cast h2) he + +/-- A closed disc around a closed disc that meets a closed set only where the small disc does. -/ +theorem exists_ring {T : Type} [TopologicalSpace T] (hT : IsSurface T) {B Z : Set T} + (hB : IsClosedDisc B) (hint : ∀ x ∈ discBd B, IsInteriorPoint x) (hZ : IsClosed Z) + (hZB : Z ∩ B ⊆ discBd B) : ∃ Δ, IsClosedDisc Δ ∧ B ⊆ Δ ∧ Δ ∩ Z = B ∩ Z ∧ discBd Δ ∩ B = B ∩ Z + := by + have ht2 : T2Space T := hT.2.1 + have hman := hT.2.2 + obtain ⟨Δ', hΔ', hin, -⟩ := exists_disc_around hman hB hint isOpen_univ (subset_univ _) + obtain ⟨p⟩ := hB.isOArc_discBd + obtain ⟨c, c', hcc, hc'c, hmc, hmc', hl, -, hcB, -, hcp⟩ := exists_disc_collar hB hΔ' hin p + have hsph : ∀ w : ℂ, ‖w‖ = 1 → c w ∈ discBd B := fun w hw => by + have h1 := hcp ⟨w, by simpa [Submonoid.unitSphere] using hw⟩ + exact h1 ▸ (p _).2 + have hball : ∀ {z : ℂ}, ‖z‖ ≤ 1 → c z ∈ B := fun {z} hz => hcB ▸ mem_image_of_mem _ + (by simpa using hz) + have hsub12 : closedBall (0 : ℂ) 1 ⊆ closedBall (0 : ℂ) 2 := closedBall_subset_closedBall + (by norm_num) + let Zh : Set ℂ := (closedBall 0 2 ∩ c ⁻¹' Z) ∪ sphere 0 2 + have hZhc : IsClosed Zh := (hcc.preimage_isClosed_of_isClosed isClosed_closedBall hZ).union + isClosed_sphere + have hZhne : Zh.Nonempty := ⟨2, .inr (by simp)⟩ + let d : ℂ → ℝ := fun w => infDist w Zh / 2 + have hdc : Continuous d := (continuous_infDist_pt Zh).div_const 2 + have hd : ∀ w, 0 ≤ d w := fun w => div_nonneg infDist_nonneg (by norm_num) + have hb : ∀ w, ‖w‖ = 1 → d w ≤ 1 / 2 := fun w hw => by + have h1 : infDist w Zh ≤ dist w (2 * w) := infDist_le_dist_of_mem (.inr (by simp [hw])) + have h2 : dist w (2 * w) = 1 := by + rw [dist_eq_norm, show w - 2 * w = -w by ring, norm_neg, hw] + simp only [d] + linarith + have hclear : ∀ w : ℂ, ∀ s : ℝ, ‖w‖ = 1 → 0 < d w → 0 ≤ s → s ≤ d w → ((1 + s : ℝ) : ℂ) * w ∉ Zh + := fun w s hw hdw hs hsd hmem => by + have h1 : infDist w Zh ≤ dist w (((1 + s : ℝ) : ℂ) * w) := infDist_le_dist_of_mem hmem + have h2 : dist w (((1 + s : ℝ) : ℂ) * w) = s := by + rw [dist_eq_norm, show w - ((1 + s : ℝ) : ℂ) * w = -((s : ℂ) * w) by push_cast; ring, + norm_neg, norm_mul, hw, Complex.norm_real, Real.norm_of_nonneg hs, mul_one] + simp only [d] at hsd hdw + linarith + have hS := continuousOn_stretch hdc hd hb + have hin2 : ∀ {z : ℂ}, ‖z‖ ≤ 1 → stretch d z ∈ closedBall (0 : ℂ) 2 := fun {z} hz => by + rw [mem_closedBall, dist_zero_right, norm_stretch hd] + by_cases h0 : z = 0 + · simp [h0] + · have := hb _ (norm_unit h0) + nlinarith [norm_nonneg z, hd (z / ‖z‖)] + let f : ℂ → T := fun z => c (stretch d z) + have hfc : ContinuousOn f (closedBall 0 1) := hcc.comp hS.continuousOn fun z hz => hin2 + (by simpa using hz) + have hfi : InjOn f (closedBall 0 1) := fun z hz z' hz' he => by + have h1 : ‖z‖ ≤ 1 := by simpa using hz + have h2 : ‖z'‖ ≤ 1 := by simpa using hz' + exact stretch_injective hd (by rw [← hl (hin2 h1), ← hl (hin2 h2)]; exact congrArg c' he) + obtain ⟨hD, hbd⟩ := isClosedDisc_closedBall + obtain ⟨hΔ, hΔb⟩ := isClosedDisc_image_injOn hD (isCompact_closedBall _ _) hfc hfi + have hdec : ∀ {z : ℂ}, z ≠ 0 → ‖z / ‖z‖‖ = 1 ∧ ((‖z‖ : ℝ) : ℂ) * (z / ‖z‖) = z := fun {z} hz => by + refine ⟨norm_unit hz, ?_⟩ + have h4 : ((‖z‖ : ℝ) : ℂ) ≠ 0 := by + exact_mod_cast norm_ne_zero_iff.mpr hz + field_simp + have hsubB : B ⊆ f '' closedBall 0 1 := by + intro y₀ hy₀ + rw [← hcB] at hy₀ + obtain ⟨z, hz, rfl⟩ := hy₀ + have hz1 : ‖z‖ ≤ 1 := by simpa using hz + by_cases h0 : z = 0 + · exact ⟨0, by simp, by simp [f, stretch, h0]⟩ + obtain ⟨hu, hzz⟩ := hdec h0 + let w := z / ‖z‖ + have h1 : 0 < 1 + d w := by linarith [hd w] + let y : ℂ := ((‖z‖ / (1 + d w) : ℝ) : ℂ) * w + have hyn : ‖y‖ = ‖z‖ / (1 + d w) := by + rw [norm_mul, hu, mul_one, Complex.norm_real, Real.norm_of_nonneg (div_nonneg + (norm_nonneg _) h1.le)] + have hyne : y ≠ 0 := by + rw [← norm_ne_zero_iff, hyn] + exact (div_pos (norm_pos_iff.mpr h0) h1).ne' + have hyu : y / ‖y‖ = w := by + have h2 := (hdec hyne).2 + have h3 : ((‖y‖ : ℝ) : ℂ) ≠ 0 := by + exact_mod_cast norm_ne_zero_iff.mpr hyne + apply mul_left_cancel₀ h3 + rw [h2, hyn] + refine ⟨y, ?_, ?_⟩ + · simp only [mem_closedBall, dist_zero_right] + rw [hyn, div_le_one h1] + linarith [hd w] + · change c (stretch d y) = c z + congr 1 + rw [stretch, hyu] + change ((1 + d w : ℝ) : ℂ) * (((‖z‖ / (1 + d w) : ℝ) : ℂ) * w) = z + rw [← mul_assoc, ← Complex.ofReal_mul, mul_div_cancel₀ _ h1.ne'] + exact hzz + have hdz : ∀ {w : ℂ}, d w = 0 → w ∈ Zh := fun {w} hw => by + have h1 : infDist w Zh = 0 := by + simp only [d] at hw + linarith + exact (hZhc.mem_iff_infDist_zero hZhne).mpr h1 + have hzd : ∀ {w : ℂ}, w ∈ Zh → d w = 0 := fun {w} hw => by + simp only [d] + rw [infDist_zero_of_mem hw] + simp + have hnotz : ∀ {w : ℂ}, ‖w‖ = 1 → w ∈ Zh → c w ∈ Z := by + rintro w hw (h | h) + · exact h.2 + · rw [mem_sphere_zero_iff_norm, hw] at h + norm_num at h + have hone : ∀ {w : ℂ}, ‖w‖ = 1 → w / ‖w‖ = w := fun {w} hw => by simp [hw] + have hst : ∀ {w : ℂ}, ‖w‖ = 1 → d w = 0 → stretch d w = w := fun {w} hw h0 => by + simp [stretch, hone hw, h0] + have hkey : ∀ z, ‖z‖ ≤ 1 → f z ∈ Z → f z ∈ B := by + intro z hz hfz + by_cases h0 : z = 0 + · have h1 : stretch d z = 0 := by simp [h0, stretch] + change c (stretch d z) ∈ B + rw [h1] + exact hball (by simp) + obtain ⟨hu, hzz⟩ := hdec h0 + set w := z / ‖z‖ with hw + have hy : stretch d z = (((1 + d w) * ‖z‖ : ℝ) : ℂ) * w := by + rw [stretch, ← hw] + push_cast + rw [mul_assoc] + congr 1 + exact_mod_cast hzz.symm + by_cases hτ : (1 + d w) * ‖z‖ ≤ 1 + · refine hball ?_ + rw [norm_stretch hd] + exact hτ + · exfalso + push Not at hτ + have h1 : (1 + d w) * ‖z‖ ≤ 1 + d w := by nlinarith [hd w] + have hdw : 0 < d w := by nlinarith [norm_nonneg z] + have h2 := hclear w ((1 + d w) * ‖z‖ - 1) hu hdw (by linarith) (by linarith) + rw [show (1 + ((1 + d w) * ‖z‖ - 1) : ℝ) = (1 + d w) * ‖z‖ by ring, ← hy] at h2 + exact h2 (.inl ⟨hin2 hz, hfz⟩) + refine ⟨_, hΔ, hsubB, ?_, ?_⟩ + · apply subset_antisymm + · rintro _ ⟨⟨z, hz, rfl⟩, hZz⟩ + exact ⟨hkey z (by simpa using hz) hZz, hZz⟩ + · exact fun x hx => ⟨hsubB hx.1, hx.2⟩ + · rw [hΔb, hbd] + apply subset_antisymm + · rintro _ ⟨⟨z, hz, rfl⟩, hzB⟩ + have hz1 : ‖z‖ = 1 := by simpa using hz + rw [← hcB] at hzB + obtain ⟨q, hq, he⟩ := hzB + have h1 : q = stretch d z := by + rw [← hl (hsub12 hq), he] + exact hl (hin2 hz1.le) + have h2 : ‖stretch d z‖ ≤ 1 := by + rw [← h1] + simpa using hq + rw [norm_stretch hd, hone hz1, hz1, mul_one] at h2 + have h3 : d z = 0 := by linarith [hd z] + have h4 := hst hz1 h3 + refine ⟨by rw [← hcB]; exact ⟨q, hq, he⟩, ?_⟩ + change c (stretch d z) ∈ Z + rw [h4] + exact hnotz hz1 (hdz h3) + · rintro y ⟨hyB, hyZ⟩ + have hyb : y ∈ discBd B := hZB ⟨hyZ, hyB⟩ + let q := p.symm ⟨y, hyb⟩ + have hq : c (q : ℂ) = y := by + rw [hcp] + simp [q] + have hqn : ‖(q : ℂ)‖ = 1 := Circle.norm_coe q + have h1 : (q : ℂ) ∈ Zh := by + refine .inl ⟨hsub12 (mem_closedBall_zero_iff.mpr hqn.le), ?_⟩ + rw [mem_preimage, hq] + exact hyZ + have h2 := hst hqn (hzd h1) + exact ⟨⟨_, mem_sphere_zero_iff_norm.mpr hqn, by change c (stretch d q) = y; rw [h2, hq]⟩, hyB⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Schoenflies.lean b/LeanPool/GraphMinor/Surface/Schoenflies.lean new file mode 100644 index 0000000000..0165999cab --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Schoenflies.lean @@ -0,0 +1,574 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DomainHomeo +public import LeanPool.GraphMinor.Surface.Jordan + +/-! +# The Schoenflies theorem + +`schoenflies_theorem : SchoenfliesStatement`: every homeomorphism from the unit circle onto an +`O`-arc of the plane extends to a homeomorphism of the plane. + +The route. `exists_homeomorph_closedInner` extends the map from the closed unit disc onto the closed +inner domain. For the outside choose `a` in `inner F` and use the inversion `j z = (z - a)⁻¹`. It +exchanges the two sides of the curve, with `0` taking the place of the point at infinity. So the +closed outer domain, with infinity added, is the closed inner domain of `j '' F`, and +`exists_homeomorph_closedInner` applies again. A push of the disc that fixes the circle makes the +centre go to `0`. The two maps agree on the circle and glue to a continuous bijection of the plane, +and invariance of domain says that its inverse is continuous. + +The proof of `exists_homeomorph_closedInner` is not Thomassen's. It uses Eilenberg's criterion to +show accessibility of all points of an `O`-arc, and cuts by segments of a grid. See +`Surface/DomainHomeo.lean`. Compare C. Thomassen, *The Jordan–Schönflies theorem and the +classification of surfaces*, Amer. Math. Monthly 99 (1992) 116–130, Theorem 3.1 (page 122). +The Lean statement takes the unit circle as the source curve. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Complex + +/-- If open sets `O, I` split the complement of `G`, and `O` is bounded and not empty, then they are +the two parts of the complement. -/ +theorem IsJordanParts.eq_of_cover {G : Set ℂ} (J : IsJordanParts G) {O I : Set ℂ} (hO : IsOpen O) + (hI : IsOpen I) (hdis : Disjoint O I) (hcov : O ∪ I = Gᶜ) (hne : O.Nonempty) + (hb : Bornology.IsBounded O) : inner G = O ∧ outer G = I := by + have hsplit : ∀ {C : Set ℂ}, IsPreconnected C → C ⊆ Gᶜ → C ⊆ O ∨ C ⊆ I := by + intro C hC hsub + have hsub' : C ⊆ O ∪ I := hcov ▸ hsub + by_cases hemp : (C ∩ O).Nonempty + · exact Or.inl (hC.subset_left_of_subset_union hO hI hdis hsub' hemp) + · right + exact fun z hz => (hsub' hz).resolve_left fun h => hemp ⟨z, hz, h⟩ + have houter : outer G ⊆ I := by + rcases hsplit J.isConnected_outer.isPreconnected J.outer_subset_compl with h | h + · exact absurd (hb.subset h) J.not_isBounded_outer + · exact h + have hinner : inner G ⊆ O := by + rcases hsplit J.isConnected_inner.isPreconnected J.inner_subset_compl with h | h + · exact h + · exfalso + obtain ⟨z, hz⟩ := hne + have hz' : z ∈ Gᶜ := hcov ▸ Or.inl hz + rw [← J.union_eq] at hz' + rcases hz' with h' | h' + · exact Set.disjoint_left.mp hdis hz (h h') + · exact Set.disjoint_left.mp hdis hz (houter h') + constructor + · refine Subset.antisymm hinner fun z hz => ?_ + have hz' : z ∈ Gᶜ := hcov ▸ Or.inl hz + rw [← J.union_eq] at hz' + exact hz'.resolve_right fun h => Set.disjoint_left.mp hdis hz (houter h) + · refine Subset.antisymm houter fun z hz => ?_ + have hz' : z ∈ Gᶜ := hcov ▸ Or.inr hz + rw [← J.union_eq] at hz' + exact hz'.resolve_left fun h => Set.disjoint_left.mp hdis (hinner h) hz + +/-- The unit circle of `ℂ` as an `O`-arc. -/ +theorem oArc_sphere : Nonempty (Circle ≃ₜ sphere (0 : ℂ) 1) := by + have hemb : IsEmbedding fun w : Circle => (w : ℂ) := IsEmbedding.subtypeVal + have hr : range (fun w : Circle => (w : ℂ)) = sphere 0 1 := by + ext z + constructor + · rintro ⟨w, rfl⟩ + exact mem_sphere_zero_iff_norm.mpr (Circle.norm_coe w) + · intro hz + exact ⟨⟨z, hz⟩, rfl⟩ + exact ⟨hemb.toHomeomorph.trans (Homeomorph.setCongr hr)⟩ + +theorem inner_sphere : inner (sphere (0 : ℂ) 1) = ball 0 1 := by + obtain ⟨φ⟩ := oArc_sphere + refine ((isJordanParts φ).eq_of_cover (I := (closedBall 0 1)ᶜ) isOpen_ball + isClosed_closedBall.isOpen_compl ?_ ?_ ⟨0, by simp⟩ isBounded_ball).1 + · exact Set.disjoint_left.mpr fun z h1 h2 => h2 (ball_subset_closedBall h1) + · ext z + simp only [mem_union, mem_ball_zero_iff, mem_compl_iff, mem_closedBall_zero_iff, + mem_sphere_zero_iff_norm] + constructor + · rintro (h | h) <;> intro h' <;> linarith + · intro h + rcases lt_trichotomy ‖z‖ 1 with h1 | h1 | h1 + · exact Or.inl h1 + · exact absurd h1 h + · exact Or.inr (not_le.mpr h1) + +theorem closedInner_sphere : closedInner (sphere (0 : ℂ) 1) = closedBall 0 1 := by + rw [closedInner, inner_sphere, ball_union_sphere] + +/-- A push of the closed disc that fixes the circle and takes the centre to a given point. -/ +theorem exists_disc_push {c : ℂ} (hc : ‖c‖ < 1) : + ∃ θ : ℂ → ℂ, Continuous θ ∧ BijOn θ (closedBall 0 1) (closedBall 0 1) ∧ θ 0 = c ∧ + ∀ z ∈ sphere (0 : ℂ) 1, θ z = z := by + let θ : ℂ → ℂ := fun z => z + ((1 - ‖z‖ : ℝ) : ℂ) * c + have hθc : Continuous θ := by fun_prop + have hnorm : ∀ z, ‖z‖ ≤ 1 → ‖θ z‖ ≤ ‖z‖ + (1 - ‖z‖) * ‖c‖ := fun z hz => by + refine (norm_add_le _ _).trans ?_ + rw [norm_mul, norm_real, Real.norm_eq_abs, abs_of_nonneg (by linarith)] + have hinj : InjOn θ univ := by + intro z _ z' _ h + by_contra hne + have h1 : z - z' = ((‖z‖ - ‖z'‖ : ℝ) : ℂ) * c := by + have : z + ((1 - ‖z‖ : ℝ) : ℂ) * c = z' + ((1 - ‖z'‖ : ℝ) : ℂ) * c := h + push_cast at this ⊢ + linear_combination this + have h2 : ‖z - z'‖ = |‖z‖ - ‖z'‖| * ‖c‖ := by + rw [h1, norm_mul, norm_real, Real.norm_eq_abs] + have h3 : |‖z‖ - ‖z'‖| ≤ ‖z - z'‖ := abs_norm_sub_norm_le z z' + have h4 : 0 < ‖z - z'‖ := norm_pos_iff.mpr (sub_ne_zero.mpr hne) + have h5 : |‖z‖ - ‖z'‖| * ‖c‖ ≤ ‖z - z'‖ * ‖c‖ := + mul_le_mul_of_nonneg_right h3 (norm_nonneg c) + nlinarith + have hfix : ∀ z ∈ sphere (0 : ℂ) 1, θ z = z := fun z hz => by + have : ‖z‖ = 1 := mem_sphere_zero_iff_norm.mp hz + simp [θ, this] + have hmaps : MapsTo θ (closedBall 0 1) (closedBall 0 1) := by + intro z hz + have hz' := mem_closedBall_zero_iff.mp hz + refine mem_closedBall_zero_iff.mpr ((hnorm z hz').trans ?_) + nlinarith [norm_nonneg c] + have hopen : MapsTo θ (ball 0 1) (ball 0 1) := by + intro z hz + have hz' := mem_ball_zero_iff.mp hz + refine mem_ball_zero_iff.mpr (lt_of_le_of_lt (hnorm z hz'.le) ?_) + nlinarith [norm_nonneg c] + have hzero : θ 0 = c := by simp [θ] + refine ⟨θ, hθc, ⟨hmaps, hinj.mono (subset_univ _), ?_⟩, hzero, hfix⟩ + have hU : IsOpen (θ '' ball 0 1) := + isOpen_image_of_injOn isOpen_ball hθc.continuousOn (hinj.mono (subset_univ _)) + have hclosed : IsClosed (θ '' closedBall 0 1) := + ((isCompact_closedBall (0 : ℂ) 1).image hθc).isClosed + have hball : ball (0 : ℂ) 1 ⊆ θ '' ball 0 1 := by + refine (convex_ball (0 : ℂ) 1).isPreconnected.subset_of_closure_inter_subset hU + ⟨c, mem_ball_zero_iff.mpr hc, 0, by simp, hzero⟩ ?_ + rintro y ⟨hy1, hy2⟩ + have hy3 : y ∈ θ '' closedBall 0 1 := + hclosed.closure_subset_iff.mpr (image_mono ball_subset_closedBall) hy1 + obtain ⟨z, hz, rfl⟩ := hy3 + rcases lt_or_eq_of_le (mem_closedBall_zero_iff.mp hz) with h | h + · exact ⟨z, mem_ball_zero_iff.mpr h, rfl⟩ + · have hzs : z ∈ sphere (0 : ℂ) 1 := mem_sphere_zero_iff_norm.mpr h + rw [hfix z hzs] at hy2 + exact absurd h (mem_ball_zero_iff.mp hy2).ne + intro y hy + rcases lt_or_eq_of_le (mem_closedBall_zero_iff.mp hy) with h | h + · obtain ⟨z, hz, rfl⟩ := hball (mem_ball_zero_iff.mpr h) + exact ⟨z, ball_subset_closedBall hz, rfl⟩ + · exact ⟨y, hy, hfix y (mem_sphere_zero_iff_norm.mpr h)⟩ + +/-- A homeomorphism of subsets is given by a pair of functions on the plane. -/ +theorem exists_bdMatch {A B : Set ℂ} (e : A ≃ₜ B) : + ∃ h k : ℂ → ℂ, BdMatch A B h k ∧ ∀ x : A, h x.1 = (e x).1 := by + classical + let h : ℂ → ℂ := fun z => if hz : z ∈ A then (e ⟨z, hz⟩).1 else 0 + let k : ℂ → ℂ := fun z => if hz : z ∈ B then (e.symm ⟨z, hz⟩).1 else 0 + have hv : ∀ x : A, h x.1 = (e x).1 := fun x => by simp [h] + have kv : ∀ x : B, k x.1 = (e.symm x).1 := fun x => by simp [k] + refine ⟨h, k, ⟨?_, ?_, ?_, ?_, ?_, ?_⟩, hv⟩ + · intro z hz + rw [hv ⟨z, hz⟩] + exact (e _).2 + · intro z hz + rw [kv ⟨z, hz⟩] + exact (e.symm _).2 + · intro z hz + show k (h z) = z + rw [hv ⟨z, hz⟩, kv] + simp + · intro z hz + show h (k z) = z + rw [kv ⟨z, hz⟩, hv] + simp + · rw [continuousOn_iff_continuous_domRestrict] + have : A.domRestrict h = fun x => (e x).1 := funext hv + rw [this] + exact continuous_subtype_val.comp e.continuous + · rw [continuousOn_iff_continuous_domRestrict] + have : B.domRestrict k = fun x => (e.symm x).1 := funext kv + rw [this] + exact continuous_subtype_val.comp e.symm.continuous + +/-- `exists_homeomorph_closedInner` in terms of functions on the plane. -/ +theorem exists_extension {F F' : Set ℂ} (hF : Nonempty (Circle ≃ₜ F)) + (hF' : Nonempty (Circle ≃ₜ F')) {h₀ k₀ : ℂ → ℂ} (m : BdMatch F F' h₀ k₀) : + ∃ ψ : ℂ → ℂ, ContinuousOn ψ (closedInner F) ∧ BijOn ψ (closedInner F) (closedInner F') ∧ + EqOn ψ h₀ F := by + obtain ⟨Ψ, hΨ⟩ := exists_homeomorph_closedInner hF hF' m + obtain ⟨ψ, χ, ⟨h1, h2, h3, h4, h5, -⟩, hv⟩ := exists_bdMatch Ψ + have hsub : F ⊆ closedInner F := subset_union_right + refine ⟨ψ, h5, ⟨h1, h3.injOn, h4.surjOn h2⟩, fun z hz => ?_⟩ + rw [hv ⟨z, hsub hz⟩] + exact hΨ ⟨z, hsub hz⟩ hz + +/-- The inversion about `a`, as a bijection of the plane that exchanges `a` and `0`. -/ +private noncomputable def invAt (a z : ℂ) : ℂ := a + z⁻¹ + +private theorem invAt_eq_iff {a z w : ℂ} : invAt a w = z ↔ w = (z - a)⁻¹ := by + simp only [invAt] + constructor + · rintro rfl + simp + · rintro rfl + simp + +private theorem invAt_invAt {a z : ℂ} : invAt a (z - a)⁻¹ = z := invAt_eq_iff.mpr rfl + +private theorem invAt_injective (a : ℂ) : Function.Injective (invAt a) := by + intro w w' h + have := invAt_eq_iff.mp h + simpa [invAt] using this + +private theorem invAt_zero (a : ℂ) : invAt a 0 = a := by simp [invAt] + +private theorem continuousOn_invAt (a : ℂ) {A : Set ℂ} (hA : (0 : ℂ) ∉ A) : + ContinuousOn (invAt a) A := + continuousOn_const.add (continuousOn_id.inv₀ fun _ hz h => hA (h ▸ hz)) + +/-- The image of a curve under inversion about a point off it. -/ +private theorem oArc_preimage_invAt {F : Set ℂ} (φ : Circle ≃ₜ F) {a : ℂ} (ha : a ∉ F) : + Nonempty (Circle ≃ₜ invAt a ⁻¹' F) := by + let f : Circle → ℂ := fun w => ((φ w).1 - a)⁻¹ + have hne : ∀ w, (φ w).1 - a ≠ 0 := fun w h => ha (sub_eq_zero.mp h ▸ (φ w).2) + have hc : Continuous f := + ((continuous_subtype_val.comp φ.continuous).sub continuous_const).inv₀ hne + have hi : Function.Injective f := by + intro w w' h + have h1 : (φ w).1 - a = (φ w').1 - a := inv_injective h + exact φ.injective (Subtype.ext (sub_left_inj.mp h1)) + have hr : range f = invAt a ⁻¹' F := by + ext w + constructor + · rintro ⟨v, rfl⟩ + change invAt a _ ∈ F + rw [invAt_invAt] + exact (φ v).2 + · intro hw + obtain ⟨v, hv⟩ := φ.surjective ⟨_, hw⟩ + refine ⟨v, ?_⟩ + change ((φ v).1 - a)⁻¹ = w + rw [hv] + exact (invAt_eq_iff.mp rfl).symm + exact ⟨(hc.isClosedEmbedding hi).isEmbedding.toHomeomorph.trans (Homeomorph.setCongr hr)⟩ + +/-- Inversion about a point of the inside exchanges the two sides of a curve. -/ +private theorem inner_preimage_invAt {F : Set ℂ} (φ : Circle ≃ₜ F) {a : ℂ} (ha : a ∈ inner F) : + inner (invAt a ⁻¹' F) = invAt a ⁻¹' outer F ∪ {0} := by + have J := isJordanParts φ + have haF : a ∉ F := J.inner_subset_compl ha + obtain ⟨φ'⟩ := oArc_preimage_invAt φ haF + have J' := isJordanParts φ' + have hdisj : ∀ {z}, z ∈ inner F → z ∉ outer F := fun h h' => Set.disjoint_left.mp J.disjoint h h' + have hsplit : ∀ {z}, z ∉ F → z ∈ inner F ∨ z ∈ outer F := fun {z} hz => by + have : z ∈ Fᶜ := hz + rwa [← J.union_eq] at this + have hopen : ∀ {U : Set ℂ}, IsOpen U → IsOpen ((invAt a ⁻¹' U) \ {0}) := by + intro U hU + have h1 := (continuousOn_invAt a (A := {0}ᶜ) (by simp)).isOpen_inter_preimage + isOpen_compl_singleton hU + have h2 : {0}ᶜ ∩ invAt a ⁻¹' U = (invAt a ⁻¹' U) \ {0} := by + ext z + simp only [mem_inter_iff, mem_compl_iff, mem_sdiff] + tauto + rwa [h2] at h1 + have hd : ∀ w : ℂ, dist (invAt a w) a = ‖w‖⁻¹ := fun w => by + rw [dist_eq_norm, invAt, add_sub_cancel_left, norm_inv] + obtain ⟨R₀, hR₀⟩ := J.isCompact_closure_inner.isBounded.subset_closedBall a + have hR : 0 < max R₀ 1 := lt_of_lt_of_le one_pos (le_max_right _ _) + set R := max R₀ 1 with hRdef + have hfar : ∀ w : ℂ, w ≠ 0 → ‖w‖ < 1 / R → invAt a w ∈ outer F := by + intro w hw hwR + have hpos : 0 < ‖w‖ := norm_pos_iff.mpr hw + have h1 : ‖w‖ * ‖w‖⁻¹ = 1 := mul_inv_cancel₀ hpos.ne' + have h2 : ‖w‖ * R < 1 := (lt_div_iff₀ hR).mp hwR + have h3 : R < ‖w‖⁻¹ := by + by_contra hn + have := mul_le_mul_of_nonneg_left (not_lt.mp hn) hpos.le + linarith + have h4 : invAt a w ∉ inner F ∪ F := fun hin => by + have h5 := hR₀ hin + rw [mem_closedBall, hd] at h5 + exact absurd (h5.trans (le_max_left _ _)) (not_le.mpr h3) + exact (hsplit fun h => h4 (Or.inr h)).resolve_left fun h => h4 (Or.inl h) + obtain ⟨δ, hδ, hball⟩ := Metric.isOpen_iff.mp J.isOpen_inner a ha + have hOopen : IsOpen (invAt a ⁻¹' outer F ∪ {0}) := by + have heq : invAt a ⁻¹' outer F ∪ {0} = (invAt a ⁻¹' outer F \ {0}) ∪ ball 0 (1 / R) := by + ext w + by_cases hw : w = 0 + · subst hw + simp [hR] + · have h1 := hfar w hw + simp only [mem_union, mem_preimage, mem_singleton_iff, hw, or_false, mem_sdiff, + not_false_eq_true, and_true, mem_ball_zero_iff] + tauto + rw [heq] + exact (hopen J.isOpen_outer).union isOpen_ball + refine (J'.eq_of_cover (I := invAt a ⁻¹' inner F \ {0}) hOopen (hopen J.isOpen_inner) ?_ ?_ + ⟨0, Or.inr rfl⟩ ?_).1 + · refine Set.disjoint_left.mpr ?_ + rintro w (h1 | h1) ⟨h2, h3⟩ + · exact hdisj h2 h1 + · exact h3 h1 + · ext w + constructor + · rintro ((h1 | h1) | ⟨h1, -⟩) + · exact fun h => J.outer_subset_compl h1 h + · rw [mem_singleton_iff.mp h1] + change invAt a 0 ∉ F + rwa [invAt_zero] + · exact fun h => J.inner_subset_compl h1 h + · intro hw + by_cases h0 : w = 0 + · exact Or.inl (Or.inr h0) + · rcases hsplit hw with h | h + · exact Or.inr ⟨h, h0⟩ + · exact Or.inl (Or.inl h) + · refine (isBounded_closedBall (x := (0 : ℂ)) (r := 1 / δ)).subset ?_ + rintro w (h1 | h1) + · by_cases h0 : w = 0 + · subst h0 + simp [hδ.le] + · rw [mem_closedBall_zero_iff, le_div_iff₀ hδ] + have hpos : 0 < ‖w‖ := norm_pos_iff.mpr h0 + have h2 : ‖w‖ * ‖w‖⁻¹ = 1 := mul_inv_cancel₀ hpos.ne' + have h3 : δ ≤ ‖w‖⁻¹ := by + by_contra hn + have h4 : invAt a w ∈ ball a δ := by + rw [mem_ball, hd] + exact not_le.mp hn + exact hdisj (hball h4) h1 + have := mul_le_mul_of_nonneg_left h3 hpos.le + linarith + · rw [mem_singleton_iff.mp h1] + simp [hδ.le] + +/-- **Extension to the plane.** A homeomorphism from the unit circle of `ℂ` onto an `O`-arc extends +to a homeomorphism of `ℂ`. See the module docstring for the route. -/ +theorem exists_homeomorph_of_bdMatch {F : Set ℂ} (hF : Nonempty (Circle ≃ₜ F)) {h₀ k₀ : ℂ → ℂ} + (m : BdMatch (sphere 0 1) F h₀ k₀) : ∃ G : ℂ ≃ₜ ℂ, EqOn G h₀ (sphere 0 1) := by + classical + obtain ⟨φ⟩ := id hF + have J := isJordanParts φ + obtain ⟨a, ha⟩ := J.isConnected_inner.nonempty + have haF : a ∉ F := J.inner_subset_compl ha + obtain ⟨m1, m2, m3, m4, m5, m6⟩ := id m + obtain ⟨ψ, ψc, ψb, ψe⟩ := exists_extension oArc_sphere hF m + rw [closedInner_sphere] at ψc ψb + set Fs := invAt a ⁻¹' F with hFs + have h0F : (0 : ℂ) ∉ Fs := by + change invAt a 0 ∉ F + rwa [invAt_zero] + have hs : ∀ {z : ℂ}, z ∈ sphere (0 : ℂ) 1 → z⁻¹ ∈ sphere (0 : ℂ) 1 := fun {z} hz => by + rw [mem_sphere_zero_iff_norm] at hz ⊢ + rw [norm_inv, hz, inv_one] + have hs0 : ∀ {z : ℂ}, z ∈ sphere (0 : ℂ) 1 → z ≠ 0 := fun {z} hz h => by + rw [h, mem_sphere_zero_iff_norm, norm_zero] at hz + exact zero_ne_one hz + let hs' : ℂ → ℂ := fun z => (h₀ z⁻¹ - a)⁻¹ + let ks' : ℂ → ℂ := fun w => (k₀ (invAt a w))⁻¹ + have hmem : ∀ {z : ℂ}, z ∈ sphere (0 : ℂ) 1 → invAt a (hs' z) = h₀ z⁻¹ := fun _ => invAt_invAt + have hc1 : ContinuousOn (fun z : ℂ => h₀ z⁻¹) (sphere 0 1) := + m5.comp (continuousOn_id.inv₀ fun z hz => hs0 hz) fun z hz => hs hz + have ms : BdMatch (sphere 0 1) Fs hs' ks' := by + refine ⟨fun z hz => ?_, fun w hw => hs (m2 hw), fun z hz => ?_, fun w hw => ?_, ?_, ?_⟩ + · change invAt a (hs' z) ∈ F + rw [hmem hz] + exact m1 (hs hz) + · show ks' (hs' z) = z + simp only [ks'] + rw [hmem hz, m3 (hs hz), inv_inv] + · show hs' (ks' w) = w + simp only [hs', ks'] + rw [inv_inv, m4 hw] + exact (invAt_eq_iff.mp rfl).symm + · exact (hc1.sub continuousOn_const).inv₀ fun z hz h => + haF (by + have h' : h₀ z⁻¹ = a := sub_eq_zero.mp h + rw [← h'] + exact m1 (hs hz)) + · exact (m6.comp (continuousOn_invAt a h0F) fun w hw => hw).inv₀ fun w hw => hs0 (m2 hw) + have hFs' := oArc_preimage_invAt φ haF + obtain ⟨ψ', ψ'c, ψ'b, ψ'e⟩ := exists_extension oArc_sphere hFs' ms + rw [closedInner_sphere] at ψ'c ψ'b + obtain ⟨φ'⟩ := id hFs' + have hin : inner Fs = invAt a ⁻¹' outer F ∪ {0} := inner_preimage_invAt φ ha + have h0in : (0 : ℂ) ∈ closedInner Fs := Or.inl (hin ▸ Or.inr rfl) + obtain ⟨c, hc, hc0⟩ := ψ'b.2.2 h0in + have hclt : ‖c‖ < 1 := by + refine lt_of_le_of_ne (mem_closedBall_zero_iff.mp hc) fun h => h0F ?_ + have hcs : c ∈ sphere (0 : ℂ) 1 := mem_sphere_zero_iff_norm.mpr h + rw [← hc0, ψ'e hcs] + exact ms.1 hcs + obtain ⟨θ, θc, θb, θ0, θe⟩ := exists_disc_push hclt + let χ : ℂ → ℂ := ψ' ∘ θ + have χc : ContinuousOn χ (closedBall 0 1) := ψ'c.comp θc.continuousOn θb.1 + have χb : BijOn χ (closedBall 0 1) (closedInner Fs) := ψ'b.comp θb + have χ0 : χ 0 = 0 := by + change ψ' (θ 0) = 0 + rw [θ0, hc0] + have χe : EqOn χ hs' (sphere 0 1) := fun z hz => by + change ψ' (θ z) = hs' z + rw [θe z hz, ψ'e hz] + have hinv : ∀ {z : ℂ}, 1 ≤ ‖z‖ → z⁻¹ ∈ closedBall (0 : ℂ) 1 ∧ z⁻¹ ≠ 0 := fun {z} hz => by + have hz0 : z ≠ 0 := norm_pos_iff.mp (lt_of_lt_of_le one_pos hz) + refine ⟨?_, inv_ne_zero hz0⟩ + rw [mem_closedBall_zero_iff, norm_inv] + exact inv_le_one_of_one_le₀ hz + have h00 : (0 : ℂ) ∈ closedBall (0 : ℂ) 1 := by simp + have hχne : ∀ {v : ℂ}, v ∈ closedBall (0 : ℂ) 1 → v ≠ 0 → χ v ≠ 0 := fun hv hv0 h => + hv0 (χb.2.1 hv h00 (h.trans χ0.symm)) + have hχF : ∀ {v : ℂ}, v ∈ closedBall (0 : ℂ) 1 → χ v ∈ Fs → v ∈ sphere (0 : ℂ) 1 := by + intro v hv hvF + have hk : ks' (χ v) ∈ sphere (0 : ℂ) 1 := ms.2.1 hvF + have h1 : χ (ks' (χ v)) = χ v := by + rw [χe hk] + exact ms.2.2.2.1 hvF + have h2 := χb.2.1 (sphere_subset_closedBall hk) hv h1 + rwa [h2] at hk + have hout : ∀ {z : ℂ}, 1 < ‖z‖ → invAt a (χ z⁻¹) ∈ outer F := by + intro z hz + obtain ⟨hv, hv0⟩ := hinv hz.le + have hvs : z⁻¹ ∉ sphere (0 : ℂ) 1 := fun h => by + rw [mem_sphere_zero_iff_norm, norm_inv] at h + have := inv_lt_one_of_one_lt₀ hz + linarith + rcases χb.1 hv with h | h + · rw [hin] at h + exact h.resolve_right (hχne hv hv0) + · exact absurd (hχF hv h) hvs + let G : ℂ → ℂ := fun z => if ‖z‖ ≤ 1 then ψ z else invAt a (χ z⁻¹) + have Gin : ∀ {z : ℂ}, ‖z‖ ≤ 1 → G z = ψ z := fun {z} hz => by simp only [G, hz, ite_true] + have Gout : ∀ {z : ℂ}, 1 < ‖z‖ → G z = invAt a (χ z⁻¹) := fun {z} hz => by + simp only [G, not_le.mpr hz, ite_false] + have hGe : EqOn G h₀ (sphere 0 1) := fun z hz => by + rw [Gin (mem_sphere_zero_iff_norm.mp hz).le] + exact ψe hz + have hagree : ∀ {z : ℂ}, 1 ≤ ‖z‖ → G z = invAt a (χ z⁻¹) := by + intro z hz + rcases lt_or_eq_of_le hz with h | h + · exact Gout h + · have hzs : z ∈ sphere (0 : ℂ) 1 := mem_sphere_zero_iff_norm.mpr h.symm + rw [hGe hzs, χe (hs hzs), hmem (hs hzs), inv_inv] + have Gc : Continuous G := by + have hc1 : ContinuousOn G (closedBall 0 1) := + ψc.congr fun z hz => Gin (mem_closedBall_zero_iff.mp hz) + have hc2 : ContinuousOn G {z : ℂ | 1 ≤ ‖z‖} := by + refine ContinuousOn.congr ?_ fun z hz => hagree hz + have hi : ContinuousOn (fun z : ℂ => z⁻¹) {z : ℂ | 1 ≤ ‖z‖} := + continuousOn_id.inv₀ fun z hz => norm_pos_iff.mp (lt_of_lt_of_le one_pos hz) + have hχi : ContinuousOn (fun z : ℂ => χ z⁻¹) {z : ℂ | 1 ≤ ‖z‖} := + χc.comp hi fun z hz => (hinv hz).1 + exact (continuousOn_invAt a (A := {0}ᶜ) (by simp)).comp hχi fun z hz => + hχne (hinv hz).1 (hinv hz).2 + have hcl : IsClosed {z : ℂ | 1 ≤ ‖z‖} := isClosed_le continuous_const continuous_norm + have hun := hc1.union_of_isClosed hc2 isClosed_closedBall hcl + have hu : closedBall (0 : ℂ) 1 ∪ {z : ℂ | 1 ≤ ‖z‖} = univ := by + ext z + simp only [mem_union, mem_closedBall_zero_iff, mem_ofPred_eq, mem_univ, iff_true] + exact le_total _ _ + rwa [hu, continuousOn_univ] at hun + have hdisj : ∀ {z}, z ∈ closedInner F → z ∉ outer F := by + rintro z (h | h) h' + · exact Set.disjoint_left.mp J.disjoint h h' + · exact J.outer_subset_compl h' h + have Gi : Function.Injective G := by + intro z z' he + rcases le_or_gt ‖z‖ 1 with h1 | h1 <;> rcases le_or_gt ‖z'‖ 1 with h2 | h2 + · rw [Gin h1, Gin h2] at he + exact ψb.2.1 (mem_closedBall_zero_iff.mpr h1) (mem_closedBall_zero_iff.mpr h2) he + · rw [Gin h1, Gout h2] at he + exact absurd (hout h2) (he ▸ hdisj (ψb.1 (mem_closedBall_zero_iff.mpr h1))) + · rw [Gout h1, Gin h2] at he + exact absurd (hout h1) (he.symm ▸ hdisj (ψb.1 (mem_closedBall_zero_iff.mpr h2))) + · rw [Gout h1, Gout h2] at he + have h3 := χb.2.1 (hinv h1.le).1 (hinv h2.le).1 (invAt_injective a he) + exact inv_injective h3 + have Gs : Function.Surjective G := by + intro y + by_cases hy : y ∈ closedInner F + · obtain ⟨z, hz, rfl⟩ := ψb.2.2 hy + exact ⟨z, Gin (mem_closedBall_zero_iff.mp hz)⟩ + have hyF : y ∉ F := fun h => hy (Or.inr h) + have hyo : y ∈ outer F := by + have : y ∈ Fᶜ := hyF + rw [← J.union_eq] at this + exact this.resolve_left fun h => hy (Or.inl h) + let w := (y - a)⁻¹ + have hwy : invAt a w = y := invAt_invAt + have hw : w ∈ closedInner Fs := Or.inl (by + rw [hin] + exact Or.inl (show invAt a w ∈ outer F by rwa [hwy])) + obtain ⟨v, hv, hvw⟩ := χb.2.2 hw + have hw0 : w ≠ 0 := fun h => by + rw [h, invAt_zero] at hwy + exact hdisj (Or.inl ha) (hwy ▸ hyo) + have hv0 : v ≠ 0 := fun h => hw0 (by rw [← hvw, h, χ0]) + have hvs : v ∉ sphere (0 : ℂ) 1 := fun h => by + have h1 : χ v ∈ Fs := by + rw [χe h] + exact ms.1 h + rw [hvw] at h1 + exact hyF (hwy ▸ h1) + have hvn : ‖v‖ < 1 := lt_of_le_of_ne (mem_closedBall_zero_iff.mp hv) + fun h => hvs (mem_sphere_zero_iff_norm.mpr h) + have hz : 1 < ‖v⁻¹‖ := by + rw [norm_inv] + exact (one_lt_inv₀ (norm_pos_iff.mpr hv0)).mpr hvn + refine ⟨v⁻¹, ?_⟩ + rw [Gout hz, inv_inv, hvw, hwy] + have Go : IsOpenMap G := fun U hU => + isOpen_image_of_injOn hU Gc.continuousOn Gi.injOn + exact ⟨(Equiv.ofBijective G ⟨Gi, Gs⟩).toHomeomorphOfContinuousOpen Gc Go, hGe⟩ + +/-- **The Schoenflies theorem.** Every homeomorphism from the unit circle onto an `O`-arc of the +plane extends to a homeomorphism of the plane. See the module docstring for the route. -/ +theorem schoenflies_theorem : SchoenfliesStatement := by + intro F f + let e : ℂ ≃ₜ EuclideanPlane := complexPlane.toHomeomorph + have hsph : e '' sphere 0 1 = UnitCircle := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + rw [UnitCircle, mem_sphere_zero_iff_norm] + change ‖complexPlane z‖ = 1 + rw [complexPlane.norm_map] + exact mem_sphere_zero_iff_norm.mp hz + · intro hx + refine ⟨e.symm x, ?_, e.apply_symm_apply x⟩ + rw [UnitCircle, mem_sphere_zero_iff_norm] at hx + rw [mem_sphere_zero_iff_norm] + change ‖complexPlane.symm x‖ = 1 + rw [complexPlane.symm.norm_map] + exact hx + let t : sphere (0 : ℂ) 1 ≃ₜ e.symm '' F := + ((e.image (sphere 0 1)).trans (Homeomorph.setCongr hsph)).trans (f.trans (e.symm.image F)) + obtain ⟨φ₀⟩ := oArc_sphere + obtain ⟨h₀, k₀, m, hv⟩ := exists_bdMatch t + obtain ⟨G, hG⟩ := exists_homeomorph_of_bdMatch ⟨φ₀.trans t⟩ m + refine ⟨e.symm.trans (G.trans e), fun x => ?_⟩ + have hx : e.symm x.1 ∈ sphere (0 : ℂ) 1 := by + have h1 : x.1 ∈ e '' sphere 0 1 := by + rw [hsph] + exact x.2 + obtain ⟨z, hz, h2⟩ := h1 + rw [← h2, e.symm_apply_apply] + exact hz + change e (G (e.symm x.1)) = _ + rw [hG hx, hv ⟨_, hx⟩] + have h3 : t ⟨e.symm x.1, hx⟩ = e.symm.image F (f x) := by + change e.symm.image F (f _) = _ + congr 2 + apply Subtype.ext + exact e.apply_symm_apply x.1 + rw [h3] + exact e.apply_symm_apply _ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/SideCut.lean b/LeanPool/GraphMinor/Surface/SideCut.lean new file mode 100644 index 0000000000..5766917b9a --- /dev/null +++ b/LeanPool/GraphMinor/Surface/SideCut.lean @@ -0,0 +1,303 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.CutArc +public import LeanPool.GraphMinor.Surface.PasteModel + +/-! +# Two closed pieces of a surface that meet along an `O`-arc + +Let a connected surface be the union of two closed sets `T` and `Z`, and let an `O`-arc `C` in its +interior be a component of `T ∩ Z`, with points of both `T` and `Z` outside the other piece +arbitrarily near each point of `C`. +We show that `T` is a surface near `C`, with `C` on its boundary (`side_manifold`). + +The proof cuts the surface along `C`. Near a lifted point the cut surface is a half disc. The half +disc without its edge is connected, so it lies on one side, and so each lifted point belongs to one +side only. Each point of `C` has two lifts, one on each side. This shows that a neighbourhood of `C` +in `T` is an open set of the cut surface. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +universe u + +variable {S : Type u} [TopologicalSpace S] + +/-- Near a point of a surface there is a connected open set of interior points that is dense in a +neighbourhood of the point. -/ +theorem IsManifoldPoint.exists_half {x : S} (hx : IsManifoldPoint x) {N : Set S} (hN : IsOpen N) + (hxN : x ∈ N) : + ∃ V P : Set S, IsOpen V ∧ x ∈ V ∧ V ⊆ N ∧ P ⊆ V ∧ IsPreconnected P ∧ + (∀ y ∈ P, IsInteriorPoint y) ∧ V ⊆ closure P := by + obtain ⟨U, O, j, k, hU, hO, hxU, hj, hk, hm, hm', hl, hr⟩ := hx.exists_chart + have hA : U ∩ N ∈ 𝓝 (k (j x)) := by + rw [hl hxU] + exact (hU.inter hN).mem_nhds ⟨hxU, hxN⟩ + obtain ⟨ρ, hρ, hball⟩ := Metric.mem_nhdsWithin_iff.mp (hk _ (hm hxU) hA) + obtain ⟨ρ', hρ', hball'⟩ := Metric.isOpen_iff.mp hO _ (hm hxU).1 + let r : ℝ := min ρ ρ' + have hr0 : 0 < r := lt_min hρ hρ' + have sub1 : Metric.ball (j x) r ⊆ Metric.ball (j x) ρ := Metric.ball_subset_ball (min_le_left _ _) + have sub2 : Metric.ball (j x) r ⊆ O := (Metric.ball_subset_ball (min_le_right _ _)).trans hball' + let B : Set ℂ := Metric.ball (j x) r ∩ {z | 0 < z.re} + have hBO : B ⊆ O ∩ halfPlane := fun z hz => ⟨sub2 hz.1, le_of_lt (show (0 : ℝ) < z.re from hz.2)⟩ + have hBc : Convex ℝ B := (convex_ball _ _).inter (convex_halfSpace_gt Complex.reLm.isLinear 0) + have hV : IsOpen (U ∩ j ⁻¹' Metric.ball (j x) r) := hj.isOpen_inter_preimage hU Metric.isOpen_ball + have hint : ∀ z ∈ B, IsInteriorPoint (k z) := fun z hz => by + have h1 : k z ∈ U := hm' (hBO hz) + refine isInteriorPoint_of_chart hU hO hj hk hm hm' hl hr h1 ?_ + rw [hr (hBO hz)] + exact hz.2 + refine ⟨_, k '' B, hV, ⟨hxU, Metric.mem_ball_self hr0⟩, ?_, ?_, ?_, ?_, ?_⟩ + · rintro y ⟨h1, h2⟩ + have h3 := hball ⟨sub1 h2, hm h1⟩ + rw [mem_preimage, hl h1] at h3 + exact h3.2 + · rintro _ ⟨z, hz, rfl⟩ + refine ⟨hm' (hBO hz), ?_⟩ + rw [mem_preimage, hr (hBO hz)] + exact hz.1 + · exact hBc.isPreconnected.image _ (hk.mono hBO) + · rintro _ ⟨z, hz, rfl⟩ + exact hint z hz + · rintro y ⟨h1, h2⟩ + have hz : j y ∈ O ∩ halfPlane := hm h1 + have h3 : j y ∈ closure B := by + have ht : Filter.Tendsto (fun ε : ℝ => j y + (ε : ℂ)) (𝓝[>] 0) (𝓝 (j y)) := by + have : Continuous fun ε : ℝ => j y + (ε : ℂ) := by fun_prop + have h4 := this.tendsto 0 + simp only [Complex.ofReal_zero, add_zero] at h4 + exact h4.mono_left nhdsWithin_le_nhds + refine mem_closure_of_tendsto ht ?_ + have h5 := ht (Metric.isOpen_ball.mem_nhds h2) + filter_upwards [h5, self_mem_nhdsWithin] with ε h6 h7 + refine ⟨h6, ?_⟩ + have h8 : 0 ≤ (j y).re := hz.2 + have h9 : 0 < ε := h7 + change 0 < (j y + (ε : ℂ)).re + simp only [Complex.add_re, Complex.ofReal_re] + linarith + have h4 := (hk (j y) hz).mono hBO + have := h4.mem_closure_image h3 + rwa [hl h1] at this + +/-- Two closed pieces of a surface that meet along an `O`-arc `C`, and perhaps in a closed set `D` +away from `C`. Near `C`, the piece `T` is a surface with `C` on its boundary. -/ +theorem side_manifold [ConnectedSpace S] (hS : IsSurface S) {T Z C D : Set S} (hT : IsClosed T) + (hZ : IsClosed Z) (hu : T ∪ Z = univ) + (hO : IsOArc C) (hb : Disjoint C (bd S)) (hCT : C ⊆ T) (hD : IsClosed D) (hm : T ∩ Z = C ∪ D) + (hCD : Disjoint C D) + (h1 : ∀ x ∈ C, x ∈ closure (T \ Z)) (h2 : ∀ x ∈ C, x ∈ closure (Z \ T)) {x : S} (hx : x ∈ C) : + IsManifoldPoint (⟨x, hCT hx⟩ : T) ∧ (⟨x, hCT hx⟩ : T) ∈ bd T := by + classical + have ht2 : T2Space S := hS.2.1 + obtain ⟨Y, tY, t2Y, ψ, hY, hψ, -⟩ := exists_cut_loop hS hO hb + have hcY : CompactSpace Y := hY.1 + have hcl : IsClosedMap ψ := hψ.1.isClosedMap + have hsurj := hψ.2.1 + have hc := hψ.1 + have hbdC : ψ ⁻¹' C ⊆ bd Y := hψ.2.2.2.2 + have hTc : T \ Z = Zᶜ := by + ext z + have h3 : z ∈ T ∪ Z := hu ▸ mem_univ z + exact ⟨fun h => h.2, fun h => ⟨h3.resolve_right h, h⟩⟩ + have hZc : Z \ T = Tᶜ := by + ext z + have h3 : z ∈ T ∪ Z := hu ▸ mem_univ z + exact ⟨fun h => h.2, fun h => ⟨h3.resolve_left h, h⟩⟩ + set O₁ : Set Y := ψ ⁻¹' (T \ Z) with hO₁ + set O₂ : Set Y := ψ ⁻¹' (Z \ T) with hO₂ + have hO₁o : IsOpen O₁ := by + rw [hO₁, hTc] + exact hZ.isOpen_compl.preimage hc + have hO₂o : IsOpen O₂ := by + rw [hO₂, hZc] + exact hT.isOpen_compl.preimage hc + have hDc : IsClosed (ψ ⁻¹' D) := hD.preimage hc + have hcover : ∀ y : Y, y ∈ O₁ ∨ y ∈ O₂ ∨ y ∈ ψ ⁻¹' C ∨ y ∈ ψ ⁻¹' D := fun y => by + have h3 : ψ y ∈ T ∪ Z := hu ▸ mem_univ _ + by_cases h4 : ψ y ∈ T <;> by_cases h5 : ψ y ∈ Z + · rcases (hm ▸ (⟨h4, h5⟩ : ψ y ∈ T ∩ Z) : ψ y ∈ C ∪ D) with h | h + · exact .inr (.inr (.inl h)) + · exact .inr (.inr (.inr h)) + · exact .inl ⟨h4, h5⟩ + · exact .inr (.inl ⟨h5, h4⟩) + · exact absurd h3 (by simp [h4, h5]) + have hdis12 : Disjoint O₁ O₂ := Set.disjoint_left.mpr fun y h3 h4 => h3.2 h4.1 + have hCDd : ∀ y, y ∈ ψ ⁻¹' C → y ∉ ψ ⁻¹' D := fun y h3 h4 => Set.disjoint_left.mp hCD h3 h4 + have hCO₁ : ∀ y, y ∈ ψ ⁻¹' C → y ∉ O₁ := fun y h3 h4 => h4.2 ((show ψ y ∈ T ∩ Z from hm ▸ .inl + h3).2) + have hCO₂ : ∀ y, y ∈ ψ ⁻¹' C → y ∉ O₂ := fun y h3 h4 => h4.2 ((show ψ y ∈ T ∩ Z from hm ▸ .inl + h3).1) + have hDO₁ : ∀ y, y ∈ ψ ⁻¹' D → y ∉ O₁ := fun y h3 h4 => h4.2 ((show ψ y ∈ T ∩ Z from hm ▸ .inr + h3).2) + have hDO₂ : ∀ y, y ∈ ψ ⁻¹' D → y ∉ O₂ := fun y h3 h4 => h4.2 ((show ψ y ∈ T ∩ Z from hm ▸ .inr + h3).1) + /- Each lifted point lies on one side at least. -/ + have key : ∀ y ∈ ψ ⁻¹' C, y ∉ closure O₁ ∨ y ∉ closure O₂ := by + intro y hy + obtain ⟨V, P, hV, hyV, hVD, hPV, hPc, hPi, hVc⟩ := (hY.2.2 y).exists_half hDc.isOpen_compl + (hCDd y hy) + have hsub : P ⊆ O₁ ∪ O₂ := fun z hz => by + rcases hcover z with h | h | h | h + · exact .inl h + · exact .inr h + · exact absurd (hPi z hz) (hbdC h) + · exact absurd h (hVD (hPV hz)) + rcases hPc.subset_or_subset hO₁o hO₂o hdis12 hsub with h | h + · right + intro hcl2 + obtain ⟨z, ⟨hz1, hz2⟩⟩ := mem_closure_iff_nhds.mp hcl2 _ (hV.mem_nhds hyV) |>.imp fun _ h => h + have h3 : z ∈ closure P := hVc hz1 + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp h3 _ hO₂o hz2 + exact Set.disjoint_left.mp hdis12 (h hw2) hw1 + · left + intro hcl2 + obtain ⟨z, ⟨hz1, hz2⟩⟩ := mem_closure_iff_nhds.mp hcl2 _ (hV.mem_nhds hyV) |>.imp fun _ h => h + have h3 : z ∈ closure P := hVc hz1 + obtain ⟨w, hw1, hw2⟩ := mem_closure_iff.mp h3 _ hO₁o hz2 + exact Set.disjoint_left.mp hdis12 hw1 (h hw2) + /- The two open sets around the two sides. -/ + set N₁ : Set Y := (closure O₂ ∪ ψ ⁻¹' D)ᶜ with hN₁ + set N₂ : Set Y := (closure O₁ ∪ ψ ⁻¹' D)ᶜ with hN₂ + have hN₁o : IsOpen N₁ := (isClosed_closure.union hDc).isOpen_compl + have hN₂o : IsOpen N₂ := (isClosed_closure.union hDc).isOpen_compl + have hN₁s : ∀ y ∈ N₁, y ∈ O₁ ∨ y ∈ ψ ⁻¹' C := fun y hy => by + rcases hcover y with h | h | h | h + · exact .inl h + · exact absurd (.inl (subset_closure h)) hy + · exact .inr h + · exact absurd (.inr h) hy + have hN₂s : ∀ y ∈ N₂, y ∈ O₂ ∨ y ∈ ψ ⁻¹' C := fun y hy => by + rcases hcover y with h | h | h | h + · exact absurd (.inl (subset_closure h)) hy + · exact .inl h + · exact .inr h + · exact absurd (.inr h) hy + have hNd : ∀ y, y ∈ N₁ → y ∈ N₂ → False := by + intro y h3 h4 + have hN : IsOpen (N₁ ∩ N₂) := hN₁o.inter hN₂o + obtain ⟨z, hz, hz'⟩ := mem_closure_iff.mp (mem_closure_compl_bd (hY.2.2 y)) _ hN ⟨h3, h4⟩ + rcases hN₁s z hz.1 with h | h + · exact hz.2 (.inl (subset_closure h)) + · exact hz' (hbdC h) + have hkey2 : ∀ y ∈ ψ ⁻¹' C, y ∈ N₁ ∨ y ∈ N₂ := fun y hy => by + rcases key y hy with h | h + · refine .inr fun h' => ?_ + rcases h' with h' | h' + · exact h h' + · exact hCDd y hy h' + · refine .inl fun h' => ?_ + rcases h' with h' | h' + · exact h h' + · exact hCDd y hy h' + /- Over each point of `C` there is one lift on each side. -/ + have hex₁ : ∀ x ∈ C, ∃ y ∈ N₁, ψ y = x := fun x hx => by + have h3 : ψ '' closure O₁ ⊇ T \ Z := fun z hz => by + obtain ⟨y, rfl⟩ := hsurj z + exact ⟨y, subset_closure hz, rfl⟩ + have h4 : x ∈ ψ '' closure O₁ := (hcl _ isClosed_closure).closure_subset_iff.mpr h3 (h1 x hx) + obtain ⟨y, hy, rfl⟩ := h4 + rcases hkey2 y hx with h | h + · exact ⟨y, h, rfl⟩ + · exact absurd (.inl hy) h + have hex₂ : ∀ x ∈ C, ∃ y ∈ N₂, ψ y = x := fun x hx => by + have h3 : ψ '' closure O₂ ⊇ Z \ T := fun z hz => by + obtain ⟨y, rfl⟩ := hsurj z + exact ⟨y, subset_closure hz, rfl⟩ + have h4 : x ∈ ψ '' closure O₂ := (hcl _ isClosed_closure).closure_subset_iff.mpr h3 (h2 x hx) + obtain ⟨y, hy, rfl⟩ := h4 + rcases hkey2 y hx with h | h + · exact absurd (.inl hy) h + · exact ⟨y, h, rfl⟩ + have hinj : InjOn ψ N₁ := by + intro y hy y' hy' he + by_cases hC : ψ y ∈ C + · obtain ⟨w, hw, hwe⟩ := hex₂ _ hC + have hc2 := hψ.2.2.2.1 _ hC + obtain ⟨p, q, hpq, hpq'⟩ := Set.ncard_eq_two.mp hc2 + have m1 : y ∈ ψ ⁻¹' {ψ y} := rfl + have m2 : y' ∈ ψ ⁻¹' {ψ y} := he.symm + have m3 : w ∈ ψ ⁻¹' {ψ y} := hwe + rw [hpq'] at m1 m2 m3 + have hyw : y ≠ w := fun h => hNd y hy (h ▸ hw) + have hyw' : y' ≠ w := fun h => hNd y' hy' (h ▸ hw) + simp only [mem_insert_iff, mem_singleton_iff] at m1 m2 m3 + rcases m1 with e1 | e1 <;> rcases m2 with e2 | e2 <;> rcases m3 with e3 | e3 <;> + first + | exact e1.trans e2.symm + | exact absurd (e1.trans e3.symm) hyw + | exact absurd (e2.trans e3.symm) hyw' + · have hC' : ψ y' ∉ C := he ▸ hC + exact hψ.2.2.1 hC hC' he + set K : Set Y := (N₁ ∪ N₂)ᶜ with hK + have hKc : IsClosed K := (hN₁o.union hN₂o).isClosed_compl + set W : Set S := (ψ '' K)ᶜ with hWd + have hWo : IsOpen W := (hcl _ hKc).isOpen_compl + have hWN : ∀ y, ψ y ∈ W → y ∈ N₁ ∪ N₂ := fun y hy => by + by_contra h + exact hy ⟨y, h, rfl⟩ + have hCW : C ⊆ W := by + rintro z hz ⟨y, hy, rfl⟩ + exact hy (by simpa using hkey2 y hz) + have hTW : ∀ t ∈ T, t ∈ W → ∃ y ∈ N₁, ψ y = t := fun t ht htW => by + obtain ⟨y, rfl⟩ := hsurj t + rcases hWN y htW with h | h + · exact ⟨y, h, rfl⟩ + · rcases hN₂s y h with h' | h' + · exact absurd ht h'.2 + · exact hex₁ _ h' + /- The open set `P` of the cut surface is an open set of `T`. -/ + let P : Set Y := N₁ ∩ ψ ⁻¹' W + have hPo : IsOpen P := hN₁o.inter (hWo.preimage hc) + have hPT : ∀ y ∈ P, ψ y ∈ T := fun y hy => by + rcases hN₁s y hy.1 with h | h + · exact h.1 + · exact hCT h + let ρ : P → T := fun y => ⟨ψ y, hPT y y.2⟩ + have hρ : IsOpenEmbedding ρ := by + have c1 : Continuous ρ := (hc.comp continuous_subtype_val).subtype_mk _ + have i1 : Function.Injective ρ := fun a b he => + Subtype.ext (hinj a.2.1 b.2.1 (congrArg Subtype.val he)) + refine (IsOpenEmbedding.of_continuous_injective_isOpenMap c1 i1 ?_) + intro U hU + obtain ⟨U', hU', rfl⟩ := isOpen_induced_iff.mp hU + have hc' : IsClosed ((U' ∩ P) ∪ N₂)ᶜ := ((hU'.inter hPo).union hN₂o).isClosed_compl + have : ρ '' (Subtype.val ⁻¹' U') = Subtype.val ⁻¹' (W ∩ (ψ '' ((U' ∩ P) ∪ N₂)ᶜ)ᶜ) := by + ext t + constructor + · rintro ⟨y, hy, rfl⟩ + refine ⟨y.2.2, ?_⟩ + rintro ⟨y', hy', he⟩ + rcases hWN y' (he.symm ▸ y.2.2) with h | h + · have : y' = y.1 := hinj h y.2.1 he + exact hy' (.inl ⟨this ▸ hy, this ▸ y.2⟩) + · exact hy' (.inr h) + · rintro ⟨h3, h4⟩ + obtain ⟨y, hy, he⟩ := hTW t.1 t.2 h3 + have hyP : y ∈ P := ⟨hy, by rw [mem_preimage, he]; exact h3⟩ + by_cases hyU : y ∈ U' + · exact ⟨⟨y, hyP⟩, hyU, Subtype.ext he⟩ + · exact absurd ⟨y, fun h => h.elim (fun h' => hyU h'.1) (fun h' => hNd y hy h'), he⟩ h4 + rw [this] + exact (hWo.inter (hcl _ hc').isOpen_compl).preimage continuous_subtype_val + obtain ⟨y, hy, rfl⟩ := hex₁ x hx + have hyP : y ∈ P := ⟨hy, hCW hx⟩ + have hyC : y ∈ ψ ⁻¹' C := hx + have m1 : IsManifoldPoint (⟨y, hyP⟩ : P) := isManifoldPoint_sub hPo (hY.2.2 y) + have m2 : (⟨y, hyP⟩ : P) ∈ bd P := fun h => hbdC hyC ((isInteriorPoint_sub hPo).mp h) + exact ⟨isManifoldPoint_of_isOpenEmbedding hρ m1, bd_of_isOpenEmbedding hρ m2⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Skeleton.lean b/LeanPool/GraphMinor/Surface/Skeleton.lean new file mode 100644 index 0000000000..b05765b40b --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Skeleton.lean @@ -0,0 +1,363 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# A skeleton of a closed surface + +Starting from a given graph in a connected closed surface, `exists_skeleton` adds round curves of +charts, moved a +little so that they meet the graph in a finite way, until the closed discs that they bound cover the +surface. The new +curves form a set `G` that stays connected when one point is removed. No connecting arcs are needed: +`G` has a point +inside and a point outside each new disc, so the new curve must meet `G` twice. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +local notation "𝕀" => unitInterval + +variable {S : Type u} [TopologicalSpace S] + +/-- An arc has no interior in a surface. -/ +theorem not_image_ball_subset_arc [T2Space S] {γ : 𝕀 → S} (hγ : IsArcMap γ) {w : ℂ} {ρ : ℝ} + (hρ : 0 < ρ) + {g : ℂ → S} (hgc : ContinuousOn g (ball w ρ)) (hgi : InjOn g (ball w ρ)) : ¬ g '' ball w ρ ⊆ + range γ := by + intro hsub + obtain ⟨k, hk1, hk2⟩ := exists_inv_of_compactOn isCompact_univ hγ.1.continuousOn hγ.2.injOn + rw [image_univ] at hk1 + have hcirc : IsOArc (univ : Set Circle) := ⟨(Homeomorph.Set.univ Circle).symm⟩ + let g' : ℂ → Circle := fun z => Circle.exp (k (g z)) + refine not_image_ball_subset_oArc hcirc (w := w) hρ (g := g') ?_ ?_ (subset_univ _) + · have h1 : ContinuousOn (fun z => k (g z)) (ball w ρ) := hk1.comp hgc fun z hz + => hsub ⟨z, hz, rfl⟩ + exact Circle.exp.continuous.comp_continuousOn (continuous_subtype_val.comp_continuousOn h1) + · intro z hz z' hz' he + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp he + have hpi := Real.pi_gt_three + have b0 := (k (g z)).2.1 + have b1 := (k (g z)).2.2 + have b2 := (k (g z')).2.1 + have b3 := (k (g z')).2.2 + have hm0 : m = 0 := by + by_contra hne + have h6 : (1 : ℝ) ≤ |(m : ℝ)| := by exact_mod_cast Int.one_le_abs hne + have h7 : |(m : ℝ) * (2 * Real.pi)| ≤ 1 := by + rw [abs_le] + constructor <;> linarith + rw [abs_mul, abs_of_pos (show 0 < 2 * Real.pi by positivity)] at h7 + nlinarith + subst hm0 + have h8 : k (g z) = k (g z') := Subtype.ext (by simpa using hm) + obtain ⟨s, hs⟩ := hsub ⟨z, hz, rfl⟩ + obtain ⟨s', hs'⟩ := hsub ⟨z', hz', rfl⟩ + rw [← hs, ← hs', hk2 (mem_univ s), hk2 (mem_univ s')] at h8 + refine hgi hz hz' ?_ + rw [← hs, ← hs', h8] + +/-- A nonempty open set of a surface has a point off finitely many arcs. -/ +theorem exists_off_arcs [T2Space S] (_hman : ∀ x : S, IsManifoldPoint x) {U : Set S} {h : S + → ℂ} {g : ℂ → S} {R : ℝ} + (c : BallChart R U h g) (L : List (𝕀 → S)) (hL : ∀ γ ∈ L, IsArcMap γ) : + ∀ W : Set ℂ, IsOpen W → W ⊆ ball 0 R → W.Nonempty → ∃ w ∈ W, ∀ γ ∈ L, g w ∉ range γ := by + induction L with + | nil => + rintro W - - ⟨w, hw⟩ + exact ⟨w, hw, by simp⟩ + | cons γ L ih => + intro W hW hsub hne + have hγ : IsArcMap γ := hL γ (by simp) + obtain ⟨w, hw⟩ := hne + obtain ⟨ρ, hρ, hb⟩ := Metric.isOpen_iff.mp hW w hw + have hn := not_image_ball_subset_arc hγ hρ (g := g) (c.gc.mono (hb.trans hsub)) + (c.hg.injOn.mono (hb.trans hsub)) + obtain ⟨_, ⟨z, hz, rfl⟩, hz'⟩ := not_subset.mp hn + have hopen : IsOpen (W ∩ g ⁻¹' (range γ)ᶜ) := + (c.gc.mono hsub).isOpen_inter_preimage hW (isCompact_range hγ.1).isClosed.isOpen_compl + obtain ⟨w', hw', hoff⟩ := ih (fun γ' hγ' => hL γ' (by simp [hγ'])) _ hopen + (inter_subset_left.trans hsub) + ⟨z, hb hz, hz'⟩ + refine ⟨w', hw'.1, fun γ' hγ' => ?_⟩ + rcases List.mem_cons.mp hγ' with rfl | h' + · exact hw'.2 + · exact hoff γ' h' + +/-- A curve around the ball of radius `2` of a chart, which meets finitely many given arcs in a +finite way. -/ +theorem exists_tame_curve' [CompactSpace S] [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) + {U : Set S} {h : S → ℂ} {g : ℂ → S} (c : BallChart 3 U h g) (G : List (𝕀 → S)) + (hG : ∀ γ ∈ G, IsArcMap γ) : + ∃ P E : Set S, IsOArc P ∧ FinConn (P \ ⋃ γ ∈ G, range γ) ∧ IsClosedDisc E ∧ discBd E = P ∧ + g '' closedBall 0 2 ⊆ E ∧ E ⊆ U ∧ Disjoint P (g '' closedBall 0 2) := by + let Ω₀ : Set ℂ := {z | 2 < ‖z‖ ∧ ‖z‖ < 3} + have hΩ₀ : IsOpen Ω₀ := (isOpen_lt continuous_const continuous_norm).inter + (isOpen_lt continuous_norm continuous_const) + have hΩ₀b : Ω₀ ⊆ ball 0 3 := fun z hz => mem_ball_zero_iff.mpr hz.2 + have hne : Ω₀.Nonempty := ⟨((5 / 2 : ℝ) : ℂ), by + simp only [Ω₀, mem_ofPred_eq, Complex.norm_real, Real.norm_eq_abs] + rw [abs_of_pos (by norm_num)] + norm_num⟩ + obtain ⟨w, hwΩ, hw⟩ := exists_off_arcs hman c G hG Ω₀ hΩ₀ hΩ₀b hne + have hcl : IsClosed (⋃ γ ∈ G, range γ) := by + refine G.finite_toSet.isClosed_biUnion fun γ hγ => (isCompact_range (hG γ hγ).1).isClosed + have hopen : IsOpen (Ω₀ ∩ g ⁻¹' (⋃ γ ∈ G, range γ)ᶜ) := + (c.gc.mono hΩ₀b).isOpen_inter_preimage hΩ₀ hcl.isOpen_compl + obtain ⟨ρ, hρ, hball⟩ := Metric.isOpen_iff.mp hopen w ⟨hwΩ, by simpa using hw⟩ + let u : Circle := Circle.exp (Complex.arg w) + have huw : (u : ℂ) * (‖w‖ : ℝ) = w := by + have := Complex.norm_mul_exp_arg_mul_I w + rw [Circle.coe_exp, mul_comm] + exact this + have hcan : ∀ z : ℂ, (u : ℂ) * (((u⁻¹ : Circle) : ℂ) * z) = z := fun z => by + rw [← mul_assoc, ← Circle.coe_mul] + simp + have hmulcl : ∀ {t : ℝ} {z : ℂ}, z ∈ closedBall (0 : ℂ) t → + ((u⁻¹ : Circle) : ℂ) * z ∈ closedBall (0 : ℂ) t := + fun hz => by simpa [norm_mul] using hz + have hmulcl' : ∀ {t : ℝ} {z : ℂ}, z ∈ closedBall (0 : ℂ) t → (u : ℂ) * z ∈ closedBall (0 : ℂ) t := + fun hz => by simpa [norm_mul] using hz + have himg : (fun z => g ((u : ℂ) * z)) '' closedBall 0 2 = g '' closedBall 0 2 := by + ext x + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨_, hmulcl' hz, rfl⟩ + · rintro ⟨z, hz, rfl⟩ + exact ⟨_, hmulcl hz, by simp only [hcan]⟩ + obtain ⟨P, E, h1, h2, h3, h4, h5, h6, h7⟩ := exists_tame_curve hman (c.rotate u) G hG (r := ‖w‖) + (ρ := ρ) + hwΩ.1 hwΩ.2 hρ (fun z hz γ hγ => by + have h8 : (u : ℂ) * z ∈ ball w ρ := by + rw [mem_ball, ← huw, dist_eq_norm, ← mul_sub, norm_mul, Circle.norm_coe, one_mul, ← + dist_eq_norm] + exact hz + have h9 := (hball h8).2 + simp only [mem_preimage, mem_compl_iff, mem_iUnion, not_exists] at h9 + exact h9 γ hγ) + rw [himg] at h5 h7 + exact ⟨P, E, h1, h2, h3, h4, h5, h6, h7⟩ + +theorem IsGraph.exists_list {V : Set S} {E : Set (Set S)} (h : IsGraph V E) : + ∃ L : List (𝕀 → S), (∀ γ ∈ L, IsArcMap γ) ∧ (⋃ γ ∈ L, range γ) = ⋃₀ E := by + classical + have key : ∀ e ∈ E, ∃ a : 𝕀 → S, IsArcMap a ∧ range a = e := fun e he => by + obtain ⟨u, v, -, hl, -⟩ := h.edge e he + obtain ⟨a, ha, hr, -, -⟩ := hl.exists_arc + exact ⟨a, ha, hr⟩ + by_cases hE : E.Nonempty + swap + · rw [not_nonempty_iff_eq_empty] at hE + exact ⟨[], by simp, by simp [hE]⟩ + obtain ⟨e0, he0⟩ := hE + have : Nonempty (𝕀 → S) := ⟨(key e0 he0).choose⟩ + choose! A hA hr using key + refine ⟨h.fine.toFinset.toList.map A, ?_, ?_⟩ + · intro γ hγ + simp only [List.mem_map, Finset.mem_toList, Finite.mem_toFinset] at hγ + obtain ⟨e, he, rfl⟩ := hγ + exact hA e he + · ext x + simp only [List.mem_map, Finset.mem_toList, Finite.mem_toFinset, mem_iUnion, exists_prop, + mem_sUnion] + constructor + · rintro ⟨γ, ⟨e, he, rfl⟩, hx⟩ + exact ⟨e, he, hr e he ▸ hx⟩ + · rintro ⟨e, he, hx⟩ + exact ⟨A e, ⟨e, he, rfl⟩, (hr e he).symm ▸ hx⟩ + +/-- A finite cover by chart discs which contain at most one point of each given pair. -/ +theorem exists_charts (hT : IsClosedSurface S) {Pairs : Set (S × S)} (hP : Pairs.Finite) + (hne : ∀ p ∈ Pairs, p.1 ≠ p.2) : + ∃ I : Set (S), I.Finite ∧ ∃ U : S → Set S, ∃ h : S → S → ℂ, ∃ g : S → ℂ → S, + (∀ i ∈ I, BallChart 3 (U i) (h i) (g i)) ∧ (∀ i ∈ I, ∀ p ∈ Pairs, ¬ (p.1 ∈ U i ∧ p.2 ∈ U i)) ∧ + (⋃ i ∈ I, g i '' ball 0 1) = univ := by + classical + obtain ⟨hc, ht, hint⟩ := id hT + have key : ∀ x : S, ∃ U : Set S, ∃ h : S → ℂ, ∃ g : ℂ → S, BallChart 3 U h g ∧ g 0 = x ∧ + ∀ p ∈ Pairs, ¬ (p.1 ∈ U ∧ p.2 ∈ U) := by + intro x + let W : Set S := ⋂ p ∈ Pairs, (if x = p.1 then {p.2}ᶜ else {p.1}ᶜ) + have hW : IsOpen W := hP.isOpen_biInter fun p _ => by + split_ifs <;> exact isOpen_compl_singleton + have hxW : x ∈ W := by + simp only [W, mem_iInter] + intro p hp + split_ifs with he + · exact fun h' => hne p hp (he.symm.trans h') + · exact he + obtain ⟨U, h, g, c, hU, h0⟩ := (hint x).exists_ballChart hW hxW (R := 3) (by norm_num) + refine ⟨U, h, g, c, h0, fun p hp hin => ?_⟩ + have h1 := hU hin.1 + have h2 := hU hin.2 + simp only [W, mem_iInter] at h1 h2 + have h3 := h1 p hp + have h4 := h2 p hp + split_ifs at h3 h4 with he + · exact h4 rfl + · exact h3 rfl + choose U h g c hg0 hpair using key + have hopen : ∀ x, IsOpen (g x '' ball 0 1) := fun x => + (c x).isOpen_image isOpen_ball (ball_subset_ball (by norm_num)) + have hcov : (univ : Set S) ⊆ ⋃ x, g x '' ball 0 1 := fun x _ => + mem_iUnion.mpr ⟨x, 0, by simp, hg0 x⟩ + obtain ⟨t, ht⟩ := isCompact_univ.elim_finite_subcover _ hopen hcov + refine ⟨t, t.finite_toSet, U, h, g, fun i _ => c i, fun i _ => hpair i, ?_⟩ + refine eq_univ_of_univ_subset (ht.trans fun x hx => ?_) + simpa using hx + +/-- A new curve around a point of `G` that leaves a point of `G` outside its disc meets `G` twice. +-/ +theorem exists_two_meets [T2Space S] (hman : ∀ x : S, IsManifoldPoint x) {G B : Set S} + (hG : TwoConn G) + (hB : IsClosedDisc B) {x y : S} (hx : x ∈ G) (hy : y ∈ G) (hxB : x ∈ discInt B) (hyB : y ∉ B) : + ∃ a b, a ∈ G ∩ discBd B ∧ b ∈ G ∩ discBd B ∧ a ≠ b := by + by_contra hcon + push Not at hcon + have hP := hB.isOArc_discBd + obtain ⟨c, hcP, hc⟩ : ∃ c ∈ discBd B, ∀ z ∈ G ∩ discBd B, z = c := by + by_cases h3 : (G ∩ discBd B).Nonempty + · obtain ⟨c, hc⟩ := h3 + exact ⟨c, hc.2, fun z hz => hcon z c hz hc⟩ + · obtain ⟨c, hc, -⟩ := hP.exists_ne x + exact ⟨c, hc, fun z hz => absurd ⟨z, hz⟩ h3⟩ + have hdisj : Disjoint (G \ {c}) (discBd B) := by + rw [Set.disjoint_left] + exact fun z hz hz' => hz.2 (hc z ⟨hz.1, hz'⟩) + have hxc : x ≠ c := fun he => hxB.2 (he ▸ hcP) + have hyc : y ≠ c := fun he => hyB (discBd_subset B (he ▸ hcP)) + rcases hB.side hman (hG c) hdisj with h1 | h1 + · exact hyB (h1 ⟨hy, hyc⟩).1 + · exact Set.disjoint_left.mp h1 ⟨hx, hxc⟩ hxB.1 + +/-- Curves of charts added to a graph, until each point lies inside one of their discs. -/ +theorem exists_skeleton_aux (hT : IsClosedSurface S) [ConnectedSpace S] {Pairs : Set + (S × S)} {u w : S} + (huw : (u, w) ∈ Pairs) {I : Set S} (hI : I.Finite) {U : S → Set S} {h : S → S → ℂ} {g : S → ℂ + → S} + (c : ∀ i ∈ I, BallChart 3 (U i) (h i) (g i)) (hp : ∀ i ∈ I, ∀ p ∈ Pairs, ¬ (p.1 ∈ U i + ∧ p.2 ∈ U i)) + (hcov : (⋃ i ∈ I, g i '' ball 0 1) = univ) (Z : Set S) (n : ℕ) : + ∀ (V : Set S) (E : Set (Set S)) (G : Set S) (𝓑 : Set (Set S)) (R : Set S), IsGraph V E + → V ⊆ ⋃₀ E → + gr V E = G ∪ Z → TwoConn G → IsClosed G → u ∈ G → w ∈ G → 𝓑.Finite → + (∀ B ∈ 𝓑, IsClosedDisc B ∧ discBd B ⊆ G ∧ ∀ p ∈ Pairs, ¬ (p.1 ∈ B ∧ p.2 ∈ B)) → + R ⊆ I → (∀ i ∈ I \ R, ∃ B ∈ 𝓑, g i '' ball 0 1 ⊆ discInt B) → R.ncard = n → + ∃ (V' : Set S) (E' : Set (Set S)) (G' : Set S) (𝓑' : Set (Set S)), V ⊆ V' ∧ G ⊆ G' + ∧ IsGraph V' E' ∧ V' ⊆ ⋃₀ E' ∧ gr V' E' = G' ∪ Z ∧ TwoConn G' ∧ IsClosed G' ∧ + 𝓑'.Finite ∧ (∀ B ∈ 𝓑', IsClosedDisc B ∧ discBd B ⊆ G' ∧ ∀ p ∈ Pairs, ¬ (p.1 ∈ B ∧ p.2 ∈ B)) + ∧ + ∀ x, ∃ B ∈ 𝓑', x ∈ discInt B := by + obtain ⟨hcpt, ht2, hint⟩ := id hT + have hman : ∀ x : S, IsManifoldPoint x := fun x => (hint x).isManifoldPoint + induction n using Nat.strong_induction_on with + | _ n ih => + intro V E G 𝓑 R hg hno hgr hG hGc hu hw h𝓑 hB hRI hdone hn + by_cases hall : ∀ i ∈ R, Disjoint (g i '' ball 0 1) G + · refine ⟨V, E, G, 𝓑, subset_rfl, subset_rfl, hg, hno, hgr, hG, hGc, h𝓑, hB, ?_⟩ + have hin : ∀ x ∈ G, ∃ B ∈ 𝓑, x ∈ discInt B := fun x hx => by + obtain ⟨i, hi, hxi⟩ : ∃ i ∈ I, x ∈ g i '' ball 0 1 := by + have : x ∈ ⋃ i ∈ I, g i '' ball 0 1 := hcov ▸ mem_univ x + simpa using this + by_cases hiR : i ∈ R + · exact absurd hx (Set.disjoint_left.mp (hall i hiR) hxi) + · obtain ⟨B, hb, hs⟩ := hdone i ⟨hi, hiR⟩ + exact ⟨B, hb, hs hxi⟩ + set Q : Set S := G ∪ ⋃₀ 𝓑 with hQ + have hQc : IsClosed Q := hGc.union (h𝓑.isClosed_sUnion fun B hb => (hB B hb).1.isClosed) + have hQint : Q ⊆ interior Q := by + have hsub : ∀ B ∈ 𝓑, discInt B ⊆ interior Q := fun B hb => interior_maximal + ((discInt_subset B).trans fun z hz => .inr ⟨B, hb, hz⟩) ((hB B hb).1.isOpen_discInt hman) + rintro x (hx | ⟨B, hb, hxB⟩) + · obtain ⟨B, hb, hxB⟩ := hin x hx + exact hsub B hb hxB + · by_cases h1 : x ∈ discBd B + · obtain ⟨B', hb', hxB'⟩ := hin x ((hB B hb).2.1 h1) + exact hsub B' hb' hxB' + · exact hsub B hb ⟨hxB, h1⟩ + have hQo : IsOpen Q := by + rw [← subset_interior_iff_isOpen] + exact hQint + have hQu : Q = univ := IsClopen.eq_univ ⟨hQc, hQo⟩ ⟨u, .inl hu⟩ + intro x + have hxQ : x ∈ Q := hQu ▸ mem_univ x + rcases hxQ with hx | ⟨B, hb, hxB⟩ + · exact hin x hx + · by_cases h1 : x ∈ discBd B + · exact hin x ((hB B hb).2.1 h1) + · exact ⟨B, hb, hxB, h1⟩ + push Not at hall + obtain ⟨i, hiR, hnd⟩ := hall + obtain ⟨x, hxi, hxG⟩ := Set.not_disjoint_iff.mp hnd + have hi : i ∈ I := hRI hiR + have hci := c i hi + obtain ⟨L, hL, hLu⟩ := hg.exists_list + obtain ⟨P, D, hPO, hPt, hD, hDb, hDg, hDU, hPd⟩ := exists_tame_curve' hman hci L hL + have hgrE : gr V E = ⋃₀ E := union_eq_right.mpr hno + rw [hLu, ← hgrE] at hPt + obtain ⟨V1, E1, hV1, hg1, hgr1, hno1⟩ := hg.add_curve hPO hPt + have hsubD : g i '' ball 0 1 ⊆ discInt D := by + rintro _ ⟨z, hz, rfl⟩ + have hz2 : g i z ∈ g i '' closedBall 0 2 := ⟨z, ball_subset_closedBall (ball_subset_ball + (by norm_num) hz), rfl⟩ + exact ⟨hDg hz2, fun h3 => Set.disjoint_left.mp hPd (hDb ▸ h3) hz2⟩ + have hxD : x ∈ discInt D := hsubD hxi + obtain ⟨y, hyG, hyD⟩ : ∃ y ∈ G, y ∉ D := by + by_cases h3 : u ∈ D + · refine ⟨w, hw, fun h4 => hp i hi _ huw ⟨hDU h3, hDU h4⟩⟩ + · exact ⟨u, hu, h3⟩ + obtain ⟨a, b, ha, hb, hab⟩ := exists_two_meets hman hG hD hxG hyG hxD hyD + have hG' : TwoConn (G ∪ P) := hG.union hPO.twoConn (x := a) (y := b) ⟨ha.1, hDb ▸ ha.2⟩ ⟨hb.1, + hDb ▸ hb.2⟩ hab + have hlt : (R \ {i}).ncard < n := by + rw [← hn] + exact ncard_sdiff_singleton_lt_of_mem hiR (hI.subset hRI) + obtain ⟨V', E', G', 𝓑', h1, h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ := ih _ hlt V1 E1 (G ∪ P) + (insert D 𝓑) (R \ {i}) + hg1 (hno1 hno) (by rw [hgr1, hgr, union_right_comm]) hG' (hGc.union hPO.isCompact.isClosed) + (.inl hu) (.inl hw) + (h𝓑.insert _) (by + rintro B (rfl | hb') + · refine ⟨hD, hDb ▸ subset_union_right, fun p hpp hin => hp i hi p hpp ⟨hDU hin.1, hDU hin.2⟩⟩ + · exact ⟨(hB B hb').1, (hB B hb').2.1.trans subset_union_left, (hB B hb').2.2⟩) + (sdiff_subset.trans hRI) (fun j hj => by + by_cases hji : j = i + · exact ⟨D, .inl rfl, hji ▸ hsubD⟩ + · have hjR : j ∉ R := fun h' => hj.2 ⟨h', hji⟩ + obtain ⟨B, hb', hs⟩ := hdone j ⟨hj.1, hjR⟩ + exact ⟨B, .inr hb', hs⟩) rfl + exact ⟨V', E', G', 𝓑', hV1.trans h1, subset_union_left.trans h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ + +/-- The skeleton: curves of charts added to a graph, such that each point lies inside one of their +discs, and +each disc has at most one point of each given pair. -/ +theorem exists_skeleton (hT : IsClosedSurface S) [ConnectedSpace S] {V₀ : Set S} {E₀ : Set (Set S)} + (hg : IsGraph V₀ E₀) (hno : V₀ ⊆ ⋃₀ E₀) {G₀ Z : Set S} (hgr : gr V₀ E₀ = G₀ ∪ Z) + (hG₀ : TwoConn G₀) + (hGc : IsClosed G₀) {Pairs : Set (S × S)} (hP : Pairs.Finite) (hne : ∀ p ∈ Pairs, p.1 ≠ p.2) {u + w : S} + (huw : (u, w) ∈ Pairs) (hu : u ∈ G₀) (hw : w ∈ G₀) : + ∃ (V : Set S) (E : Set (Set S)) (G : Set S) (𝓑 : Set (Set S)), V₀ ⊆ V ∧ G₀ ⊆ G ∧ IsGraph V E + ∧ V ⊆ ⋃₀ E ∧ gr V E = G ∪ Z ∧ TwoConn G ∧ IsClosed G ∧ + 𝓑.Finite ∧ (∀ B ∈ 𝓑, IsClosedDisc B ∧ discBd B ⊆ G ∧ ∀ p ∈ Pairs, ¬ (p.1 ∈ B ∧ p.2 ∈ B)) ∧ + ∀ x, ∃ B ∈ 𝓑, x ∈ discInt B := by + obtain ⟨I, hI, U, h, g, c, hp, hcov⟩ := exists_charts hT hP hne + exact exists_skeleton_aux hT huw hI c hp hcov Z _ V₀ E₀ G₀ ∅ I hg hno hgr hG₀ hGc hu hw + finite_empty (by simp) + subset_rfl (by simp) rfl + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/SphereDisc.lean b/LeanPool/GraphMinor/Surface/SphereDisc.lean new file mode 100644 index 0000000000..eeb51989a0 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/SphereDisc.lean @@ -0,0 +1,463 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.DiscUnion + +/-! +# `O`-arcs in a sphere + +`sphere_disc : SphereDiscStatement`: an `O`-arc in a sphere is the common boundary of exactly two +closed discs. + +Move a point off the arc to infinity, and then use the Schoenflies theorem. This gives a +homeomorphism +of the sphere onto the one-point compactification of the plane that takes the arc to the unit +circle of `ℂ` (`exists_homeomorph_model`). For the unit circle the two discs are the closed unit +disc +and its image under `z ↦ 1 / z`. A closed disc with boundary the unit circle is minus its boundary +an +open set, by invariance of domain in the plane obtained by removing one of its points, so it fills +one of the two sides. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter OnePoint + +universe u v + +/-- An embedding has a continuous inverse on its range. -/ +theorem exists_inv_of_isEmbedding {X : Type u} {Y : Type v} [TopologicalSpace X] + [TopologicalSpace Y] [Nonempty X] {f : X → Y} (hf : IsEmbedding f) : + ∃ f' : Y → X, ContinuousOn f' (range f) ∧ ∀ x, f' (f x) = x := by + classical + let E := hf.toHomeomorph + obtain ⟨x₀⟩ := ‹Nonempty X› + refine ⟨fun z => if hz : z ∈ range f then E.symm ⟨z, hz⟩ else x₀, ?_, fun t => ?_⟩ + · rw [continuousOn_iff_continuous_domRestrict] + have : (range f).domRestrict (fun z => if hz : z ∈ range f then E.symm ⟨z, hz⟩ else x₀) = + fun z : range f => E.symm z := by + ext z + simp [Set.domRestrict, z.2] + rw [this] + exact E.symm.continuous + · have hm : f t ∈ range f := ⟨t, rfl⟩ + simp only [hm, dite_true] + exact E.symm_apply_apply t + +/-- The body of `SphereDiscStatement`, for one `O`-arc. -/ +def SphereDiscAt (S : Type u) [TopologicalSpace S] (F : Set S) : Prop := + ∃ Δ₁ Δ₂ : Set S, Δ₁ ≠ Δ₂ ∧ IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ + discBd Δ₁ = F ∧ discBd Δ₂ = F ∧ Δ₁ ∪ Δ₂ = univ ∧ Δ₁ ∩ Δ₂ = F ∧ + componentsIn (univ \ F) = {Δ₁ \ F, Δ₂ \ F} ∧ + ∀ Δ : Set S, IsClosedDisc Δ → discBd Δ = F → Δ = Δ₁ ∨ Δ = Δ₂ + +theorem SphereDiscAt.transport {S : Type u} {S' : Type v} [TopologicalSpace S] [TopologicalSpace S'] + (T : S ≃ₜ S') {F : Set S} (h : SphereDiscAt S F) : SphereDiscAt S' (T '' F) := by + obtain ⟨Δ₁, Δ₂, ne, d1, d2, b1, b2, cov, meet, comp, uniq⟩ := h + have hd : ∀ {Δ : Set S}, IsClosedDisc Δ → IsClosedDisc (T '' Δ) ∧ discBd (T '' Δ) = T '' discBd Δ + := + fun h => h.image T.continuous.continuousOn T.symm.continuous.continuousOn + fun x _ => T.symm_apply_apply x + have hl : ∀ {X : Set S'}, T '' (T.symm '' X) = X := fun {X} => by + rw [image_image] + simp + have hl' : ∀ {X : Set S}, T.symm '' (T '' X) = X := fun {X} => by + rw [image_image] + simp + have himg : ∀ {X Y : Set S}, T '' (X \ Y) = T '' X \ T '' Y := fun {X Y} => by + ext y + constructor + · rintro ⟨x, ⟨h1, h2⟩, rfl⟩ + exact ⟨⟨x, h1, rfl⟩, fun ⟨z, hz, he⟩ => h2 (T.injective he ▸ hz)⟩ + · rintro ⟨⟨x, h1, rfl⟩, h2⟩ + exact ⟨x, ⟨h1, fun h' => h2 ⟨x, h', rfl⟩⟩, rfl⟩ + refine ⟨T '' Δ₁, T '' Δ₂, fun e => ne (T.injective.image_injective e), (hd d1).1, + (hd d2).1, ?_, ?_, + ?_, ?_, ?_, ?_⟩ + · rw [(hd d1).2, b1] + · rw [(hd d2).2, b2] + · rw [← image_union, cov, image_univ, T.surjective.range_eq] + · rw [← image_inter T.injective, meet] + · have hu : univ \ T '' F = T '' (univ \ F) := by + rw [himg, image_univ, T.surjective.range_eq] + rw [hu, componentsIn_image T.continuous.continuousOn T.symm.continuous.continuousOn + (fun x _ => T.symm_apply_apply x), comp, image_pair, himg, himg] + · intro Δ hΔ hb + have h1 : IsClosedDisc (T.symm '' Δ) ∧ discBd (T.symm '' Δ) = T.symm '' discBd Δ := + hΔ.image T.symm.continuous.continuousOn T.continuous.continuousOn + fun x _ => T.apply_symm_apply x + rw [hb, hl'] at h1 + rcases uniq _ h1.1 h1.2 with h2 | h2 + · exact Or.inl (by rw [← h2, hl]) + · exact Or.inr (by rw [← h2, hl]) + +/-- The plane `ℂ` in the sphere. -/ +noncomputable def sph (z : ℂ) : OnePoint EuclideanPlane := ((complexPlane z : EuclideanPlane) : _) + +/-- The inversion `z ↦ 1 / z`, with values in the sphere. -/ +noncomputable def rsph : ℂ → OnePoint EuclideanPlane := Function.update (fun z => sph z⁻¹) 0 ∞ + +theorem isOpenEmbedding_sph : IsOpenEmbedding sph := + OnePoint.isOpenEmbedding_coe.comp complexPlane.toHomeomorph.isOpenEmbedding + +theorem rsph_zero : rsph 0 = ∞ := by simp [rsph] + +theorem rsph_of_ne {z : ℂ} (hz : z ≠ 0) : rsph z = sph z⁻¹ := by simp [rsph, hz] + +theorem sph_ne_infty (z : ℂ) : sph z ≠ ∞ := OnePoint.coe_ne_infty _ + +theorem eq_infty_or_sph (p : OnePoint EuclideanPlane) : p = ∞ ∨ ∃ z, p = sph z := by + induction p using OnePoint.rec with + | infty => exact Or.inl rfl + | coe y => exact Or.inr ⟨complexPlane.symm y, by simp [sph]⟩ + +theorem continuous_rsph : Continuous rsph := by + have hsph : Continuous sph := isOpenEmbedding_sph.continuous + refine continuous_iff_continuousAt.mpr fun z => ?_ + by_cases hz : z = 0 + · subst hz + refine continuousAt_update_same.mpr ?_ + have h1 : Tendsto (fun z : ℂ => z⁻¹) (𝓝[≠] 0) (cocompact ℂ) := by + rw [← Metric.cobounded_eq_cocompact] + exact tendsto_inv₀_nhdsNE_zero + have h2 : Tendsto sph (cocompact ℂ) (𝓝 ∞) := by + have h3 : Tendsto (fun x : EuclideanPlane => (x : OnePoint EuclideanPlane)) + (cocompact EuclideanPlane) (𝓝 ∞) := by + rw [← coclosedCompact_eq_cocompact, OnePoint.nhds_infty_eq] + exact tendsto_map.mono_right le_sup_left + exact h3.comp complexPlane.toHomeomorph.isClosedEmbedding.tendsto_cocompact + exact h2.comp h1 + · refine (continuousAt_update_of_ne hz).mpr ?_ + exact hsph.continuousAt.comp (continuousAt_inv₀ hz) + +theorem rsph_injective : Function.Injective rsph := by + intro z w h + by_cases hz : z = 0 + · subst hz + by_contra hw + rw [rsph_zero, rsph_of_ne (Ne.symm hw)] at h + exact sph_ne_infty _ h.symm + · by_cases hw : w = 0 + · subst hw + rw [rsph_zero, rsph_of_ne hz] at h + exact absurd h (sph_ne_infty _) + · rw [rsph_of_ne hz, rsph_of_ne hw] at h + exact inv_injective (isOpenEmbedding_sph.injective h) + +theorem exists_inv_of_compact {T : Type v} [TopologicalSpace T] [T2Space T] {K : Set ℂ} + (hK : IsCompact K) {f : ℂ → T} (hf : Continuous f) (hinj : InjOn f K) : + ∃ f' : T → ℂ, ContinuousOn f' (f '' K) ∧ LeftInvOn f' f K := by + classical + by_cases hne : K.Nonempty + · have : CompactSpace K := isCompact_iff_compactSpace.mp hK + have : Nonempty K := hne.to_subtype + have hemb : IsEmbedding (fun x : K => f x.1) := + ((hf.comp continuous_subtype_val).isClosedEmbedding + fun x y h => Subtype.ext (hinj x.2 y.2 h)).isEmbedding + obtain ⟨f', hc, hl⟩ := exists_inv_of_isEmbedding hemb + have hr : range (fun x : K => f x.1) = f '' K := by + ext y + constructor + · rintro ⟨x, rfl⟩ + exact ⟨x.1, x.2, rfl⟩ + · rintro ⟨x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + rw [hr] at hc + exact ⟨fun y => (f' y).1, continuous_subtype_val.comp_continuousOn hc, + fun x hx => congrArg Subtype.val (hl ⟨x, hx⟩)⟩ + · refine ⟨fun _ => 0, continuousOn_const, fun x hx => absurd ⟨x, hx⟩ hne⟩ + +theorem inv_mem_sphere {z : ℂ} (hz : z ∈ sphere (0 : ℂ) 1) : z⁻¹ ∈ sphere (0 : ℂ) 1 := by + rw [mem_sphere_zero_iff_norm] at hz ⊢ + rw [norm_inv, hz, inv_one] + +theorem ne_zero_of_sphere {z : ℂ} (hz : z ∈ sphere (0 : ℂ) 1) : z ≠ 0 := fun h => by + rw [h, mem_sphere_zero_iff_norm, norm_zero] at hz + exact zero_ne_one hz + +theorem rsph_sphere : rsph '' sphere 0 1 = sph '' sphere 0 1 := by + ext p + constructor + · rintro ⟨z, hz, rfl⟩ + exact ⟨z⁻¹, inv_mem_sphere hz, (rsph_of_ne (ne_zero_of_sphere hz)).symm⟩ + · rintro ⟨z, hz, rfl⟩ + refine ⟨z⁻¹, inv_mem_sphere hz, ?_⟩ + rw [rsph_of_ne (inv_ne_zero (ne_zero_of_sphere hz)), inv_inv] + +theorem cover_sph : sph '' closedBall 0 1 ∪ rsph '' closedBall 0 1 = univ := by + refine eq_univ_of_forall fun p => ?_ + rcases eq_infty_or_sph p with rfl | ⟨z, rfl⟩ + · exact Or.inr ⟨0, by simp, rsph_zero⟩ + · rcases le_or_gt ‖z‖ 1 with h | h + · exact Or.inl ⟨z, mem_closedBall_zero_iff.mpr h, rfl⟩ + · have hz0 : z ≠ 0 := norm_pos_iff.mp (one_pos.trans h) + refine Or.inr ⟨z⁻¹, ?_, ?_⟩ + · rw [mem_closedBall_zero_iff, norm_inv] + exact inv_le_one_of_one_le₀ h.le + · rw [rsph_of_ne (inv_ne_zero hz0), inv_inv] + +theorem meet_sph : sph '' closedBall 0 1 ∩ rsph '' closedBall 0 1 = sph '' sphere 0 1 := by + refine Subset.antisymm ?_ ?_ + · rintro _ ⟨⟨z, hz, rfl⟩, w, hw, he⟩ + have hw0 : w ≠ 0 := fun h => sph_ne_infty z (by rw [← he, h, rsph_zero]) + rw [rsph_of_ne hw0] at he + have h1 : w⁻¹ = z := isOpenEmbedding_sph.injective he + have h2 : ‖z‖ ≤ 1 := mem_closedBall_zero_iff.mp hz + have h3 : ‖w‖ ≤ 1 := mem_closedBall_zero_iff.mp hw + have h4 : ‖z‖ * ‖w‖ = 1 := by + rw [← h1, norm_inv] + exact inv_mul_cancel₀ (norm_pos_iff.mpr hw0).ne' + have h5 : ‖z‖ = 1 := by nlinarith [norm_nonneg z, norm_nonneg w] + exact ⟨z, mem_sphere_zero_iff_norm.mpr h5, rfl⟩ + · refine subset_inter (image_mono sphere_subset_closedBall) ?_ + rw [← rsph_sphere] + exact image_mono sphere_subset_closedBall + +private theorem rsph_ball : rsph '' ball 0 1 = (sph '' closedBall 0 1)ᶜ := by + ext p + constructor + · rintro ⟨w, hw, rfl⟩ hm + have h1 : rsph w ∈ sph '' sphere 0 1 := by + rw [← meet_sph] + exact ⟨hm, w, ball_subset_closedBall hw, rfl⟩ + rw [← rsph_sphere] at h1 + obtain ⟨v, hv, he⟩ := h1 + obtain rfl := rsph_injective he + exact (mem_ball_zero_iff.mp hw).ne (mem_sphere_zero_iff_norm.mp hv) + · intro hp + have h1 : p ∈ sph '' closedBall 0 1 ∪ rsph '' closedBall 0 1 := by + rw [cover_sph] + exact mem_univ _ + obtain ⟨w, hw, rfl⟩ := h1.resolve_left hp + refine ⟨w, ?_, rfl⟩ + rcases lt_or_eq_of_le (mem_closedBall_zero_iff.mp hw) with h | h + · exact mem_ball_zero_iff.mpr h + · exfalso + refine hp (image_mono sphere_subset_closedBall ?_) + rw [← rsph_sphere] + exact mem_image_of_mem _ (mem_sphere_zero_iff_norm.mpr h) + +private theorem disc_of_embedding {f : ℂ → OnePoint EuclideanPlane} (hf : Continuous f) + (hinj : Function.Injective f) : + IsClosedDisc (f '' closedBall 0 1) ∧ discBd (f '' closedBall 0 1) = f '' sphere 0 1 := by + obtain ⟨f', hc, hl⟩ := exists_inv_of_compact (isCompact_closedBall (0 : ℂ) 1) hf hinj.injOn + have := isClosedDisc_closedBall.1.image hf.continuousOn hc hl + rwa [isClosedDisc_closedBall.2] at this + +/-- A closed disc of the sphere minus its boundary is open. Remove one more point of the disc and +apply invariance of domain in the plane that remains. -/ +private theorem isOpen_image_ball {D : Set (OnePoint EuclideanPlane)} {h : OnePoint EuclideanPlane + → ℂ} + {g : ℂ → OnePoint EuclideanPlane} (c : IsChart D h g) : IsOpen (g '' ball 0 1) := by + have hhalf : (1 / 2 : ℂ) ∈ ball (0 : ℂ) 1 := by + rw [mem_ball_zero_iff] + norm_num + have h0 : (0 : ℂ) ∈ ball (0 : ℂ) 1 := by simp + refine isOpen_iff_forall_mem_open.mpr ?_ + rintro _ ⟨v, hv, rfl⟩ + obtain ⟨q, hq, hqv⟩ : ∃ q ∈ ball (0 : ℂ) 1, q ≠ v := by + by_cases hv0 : v = 0 + · exact ⟨1 / 2, hhalf, by rw [hv0]; norm_num⟩ + · exact ⟨0, h0, Ne.symm hv0⟩ + obtain ⟨H, hH⟩ := exists_homeomorph_onePoint (g q) + obtain ⟨s', hs', hl⟩ := exists_inv_of_isEmbedding isOpenEmbedding_sph.isEmbedding + let U : Set ℂ := ball 0 1 \ {q} + have hUo : IsOpen U := isOpen_ball.sdiff isClosed_singleton + have hUb : U ⊆ closedBall 0 1 := sdiff_subset.trans ball_subset_closedBall + have hrange : ∀ z ∈ U, H (g z) ∈ range sph := fun z hz => by + rcases eq_infty_or_sph (H (g z)) with h' | ⟨w, hw⟩ + · exfalso + have h1 : g z = g q := H.injective (h'.trans hH.symm) + exact hz.2 (c.injOn (hUb hz) (ball_subset_closedBall hq) h1) + · exact ⟨w, hw.symm⟩ + let j : ℂ → ℂ := fun z => s' (H (g z)) + have hjc : ContinuousOn j U := + hs'.comp (H.continuous.comp_continuousOn (c.gc.mono hUb)) hrange + have hsj : ∀ z ∈ U, sph (j z) = H (g z) := fun z hz => by + obtain ⟨w, hw⟩ := hrange z hz + change sph (s' (H (g z))) = H (g z) + rw [← hw, hl] + have hji : InjOn j U := fun z hz w hw he => by + have h1 : H (g z) = H (g w) := by rw [← hsj z hz, ← hsj w hw, he] + exact c.injOn (hUb hz) (hUb hw) (H.injective h1) + have hopen := isOpen_image_of_injOn hUo hjc hji + have hO : IsOpen (sph '' (j '' U)) := isOpenEmbedding_sph.isOpenMap _ hopen + have heq : sph '' (j '' U) = H '' (g '' U) := by + rw [image_image, image_image] + exact image_congr hsj + refine ⟨g '' U, image_mono sdiff_subset, ?_, ⟨v, ⟨hv, Ne.symm hqv⟩, rfl⟩⟩ + have hO' : IsOpen (H '' (g '' U)) := heq ▸ hO + exact (H.isOpen_image).mp hO' + +private theorem sphereDiscAt_model : SphereDiscAt (OnePoint EuclideanPlane) (sph '' sphere 0 1) + := by + have hsphc : Continuous sph := isOpenEmbedding_sph.continuous + obtain ⟨d1, b1⟩ := disc_of_embedding hsphc isOpenEmbedding_sph.injective + obtain ⟨d2, b2⟩ := disc_of_embedding continuous_rsph rsph_injective + rw [rsph_sphere] at b2 + set F₀ := sph '' sphere 0 1 with hF₀ + have hd1 : sph '' closedBall 0 1 \ F₀ = sph '' ball 0 1 := by + rw [hF₀, ← ball_union_sphere, image_union] + ext p + constructor + · rintro ⟨h | h, hn⟩ + · exact h + · exact absurd h hn + · intro h + refine ⟨Or.inl h, ?_⟩ + rintro ⟨z, hz, rfl⟩ + obtain ⟨w, hw, he⟩ := h + obtain rfl := isOpenEmbedding_sph.injective he + exact (mem_ball_zero_iff.mp hw).ne (mem_sphere_zero_iff_norm.mp hz) + have hd2 : rsph '' closedBall 0 1 \ F₀ = rsph '' ball 0 1 := by + rw [hF₀, ← rsph_sphere, ← ball_union_sphere, image_union] + ext p + constructor + · rintro ⟨h | h, hn⟩ + · exact h + · exact absurd h hn + · intro h + refine ⟨Or.inl h, ?_⟩ + rintro ⟨z, hz, rfl⟩ + obtain ⟨w, hw, he⟩ := h + obtain rfl := rsph_injective he + exact (mem_ball_zero_iff.mp hw).ne (mem_sphere_zero_iff_norm.mp hz) + have hU₁ : IsOpen (sph '' ball 0 1) := isOpenEmbedding_sph.isOpenMap _ isOpen_ball + have hcl : IsClosed (sph '' closedBall 0 1) := + ((isCompact_closedBall (0 : ℂ) 1).image hsphc).isClosed + have hcl₂ : IsClosed (rsph '' closedBall 0 1) := + ((isCompact_closedBall (0 : ℂ) 1).image continuous_rsph).isClosed + have hU₂ : IsOpen (rsph '' ball 0 1) := by + rw [rsph_ball] + exact hcl.isOpen_compl + have hconn : ∀ {f : ℂ → OnePoint EuclideanPlane}, Continuous f → IsPreconnected (f '' ball 0 1) := + fun hf => (convex_ball (0 : ℂ) 1).isPreconnected.image _ hf.continuousOn + have hdisj : Disjoint (sph '' ball 0 1) (rsph '' ball 0 1) := by + rw [rsph_ball] + exact Set.disjoint_left.mpr fun p h1 h2 => h2 (image_mono ball_subset_closedBall h1) + have hne : ∀ f : ℂ → OnePoint EuclideanPlane, (f '' ball 0 1).Nonempty := fun f => + ⟨f 0, 0, by simp, rfl⟩ + have huniv : univ \ F₀ = sph '' ball 0 1 ∪ rsph '' ball 0 1 := by + rw [← hd1, ← hd2, ← union_sdiff_distrib, cover_sph] + have hcomp := componentsIn_eq_pair hU₁ hU₂ (hconn hsphc) (hconn continuous_rsph) (hne _) (hne _) + hdisj huniv + refine ⟨_, _, ?_, d1, d2, b1, b2, cover_sph, meet_sph, ?_, ?_⟩ + · intro he + have h1 := congrArg (fun X => X \ F₀) he + simp only [hd1, hd2] at h1 + obtain ⟨p, hp⟩ := hne sph + exact Set.disjoint_left.mp hdisj hp (h1 ▸ hp) + · rw [hd1, hd2] + exact hcomp + · intro Δ hΔ hb + obtain ⟨h, g, c⟩ := hΔ.exists_isChart + have hW := isOpen_image_ball c + have hgs : g '' sphere 0 1 = F₀ := by rw [c.g_sphere, hb] + have hun : g '' ball 0 1 ∪ F₀ = Δ := by + rw [← hgs, ← image_union, ball_union_sphere, c.g_closedBall] + have hclΔ : IsClosed (g '' ball 0 1 ∪ F₀) := hun ▸ c.isCompact.isClosed + have hWF : Disjoint (g '' ball 0 1) F₀ := by + rw [← hgs, Set.disjoint_iff_inter_eq_empty, ← c.g_inter ball_subset_closedBall + sphere_subset_closedBall] + have : ball (0 : ℂ) 1 ∩ sphere 0 1 = ∅ := by + ext z + simp only [mem_inter_iff, mem_ball_zero_iff, mem_sphere_zero_iff_norm, mem_empty_iff_false, + iff_false, not_and] + exact fun h1 h2 => h1.ne h2 + rw [this, image_empty] + have hsub : g '' ball 0 1 ⊆ sph '' ball 0 1 ∪ rsph '' ball 0 1 := by + rw [← huniv] + exact fun p hp => ⟨mem_univ _, Set.disjoint_left.mp hWF hp⟩ + have hWc : IsPreconnected (g '' ball 0 1) := + (convex_ball (0 : ℂ) 1).isPreconnected.image g (c.gc.mono ball_subset_closedBall) + have hF₁ : Disjoint (sph '' ball 0 1) F₀ := by + rw [← hd1] + exact disjoint_sdiff_left + have hF₂ : Disjoint (rsph '' ball 0 1) F₀ := by + rw [← hd2] + exact disjoint_sdiff_left + have hWne : (g '' ball 0 1).Nonempty := hne g + have hfin : ∀ {C : Set (OnePoint EuclideanPlane)}, IsPreconnected C → Disjoint C F₀ → + g '' ball 0 1 ⊆ C → C ∪ F₀ = Δ := by + intro C hCc hCF hin + have hsubC := subset_of_side hCc hW hclΔ hCF (hWne.mono (subset_inter hin Subset.rfl)) + rw [← hun, Subset.antisymm hsubC hin] + rcases (isPreconnected_iff_subset_of_disjoint.mp hWc) _ _ hU₁ hU₂ hsub + (by rw [hdisj.inter_eq]; simp) with h1 | h1 + · left + rw [← hfin (hconn hsphc) hF₁ h1, ← hd1, sdiff_union_of_subset] + rw [hF₀] + exact image_mono sphere_subset_closedBall + · right + rw [← hfin (hconn continuous_rsph) hF₂ h1, ← hd2, sdiff_union_of_subset] + rw [hF₀, ← rsph_sphere] + exact image_mono sphere_subset_closedBall + +/-- A sphere can be mapped to the model so that a given `O`-arc goes to the unit circle. -/ +theorem exists_homeomorph_model {S : Type u} [TopologicalSpace S] (hS : IsSphere S) {F : Set S} + (hF : IsOArc F) : + ∃ T : S ≃ₜ OnePoint EuclideanPlane, T '' F = sph '' sphere 0 1 := by + obtain ⟨e⟩ := hS + obtain ⟨φ⟩ := id hF + obtain ⟨x, hx⟩ := exists_notMem_oArc (F := e '' F) ⟨φ.trans (e.image F)⟩ + obtain ⟨h, hh⟩ := exists_homeomorph_onePoint x + let E : S ≃ₜ OnePoint EuclideanPlane := e.trans h + have hinf : (∞ : OnePoint EuclideanPlane) ∉ E '' F := by + rintro ⟨y, hy, hyE⟩ + have : e y = x := h.injective (hyE.trans hh.symm) + exact hx ⟨y, hy, this⟩ + have hsub : E '' F ⊆ range sph := fun p hp => by + rcases eq_infty_or_sph p with rfl | ⟨z, rfl⟩ + · exact absurd hp hinf + · exact ⟨z, rfl⟩ + have himg : sph '' (sph ⁻¹' (E '' F)) = E '' F := image_preimage_eq_of_subset hsub + obtain ⟨s', hs', hl⟩ := exists_inv_of_isEmbedding isOpenEmbedding_sph.isEmbedding + have hG : IsOArc (sph ⁻¹' (E '' F)) := by + have h1 := isOpenEmbedding_sph.isEmbedding.homeomorphImage (sph ⁻¹' (E '' F)) + have h2 : (E '' F : Set _) ≃ₜ (sph '' (sph ⁻¹' (E '' F)) : Set _) := + Homeomorph.setCongr himg.symm + exact ⟨(φ.trans (E.image F)).trans (h2.trans h1.symm)⟩ + obtain ⟨φ₀⟩ := oArc_sphere + obtain ⟨φ'⟩ := id hG + obtain ⟨h₀, k₀, m, -⟩ := exists_bdMatch (φ₀.symm.trans φ') + obtain ⟨G, hGe⟩ := exists_homeomorph_of_bdMatch hG m + let g : EuclideanPlane ≃ₜ EuclideanPlane := + complexPlane.symm.toHomeomorph.trans (G.trans complexPlane.toHomeomorph) + let C : OnePoint EuclideanPlane ≃ₜ OnePoint EuclideanPlane := g.onePointCongr + have hC : ∀ z, C (sph z) = sph (G z) := fun z => by + change ((g (complexPlane z) : EuclideanPlane) : OnePoint EuclideanPlane) = sph (G z) + simp [g, sph] + refine ⟨E.trans C.symm, ?_⟩ + have h3 : C '' (sph '' sphere 0 1) = E '' F := by + rw [image_image] + simp only [hC] + rw [← image_image (g := sph) (f := G), hGe.image_eq, m.image_eq, himg] + have h4 : (E.trans C.symm) '' F = C.symm '' (E '' F) := by + rw [image_image] + rfl + rw [h4, ← h3, image_image] + simp + +/-- **An `O`-arc in a sphere is the common boundary of exactly two closed discs.** See the module +docstring for the route. -/ +theorem sphere_disc : SphereDiscStatement.{u} := by + intro S _ hS F hF + obtain ⟨T, hT⟩ := exists_homeomorph_model hS hF + have h := sphereDiscAt_model.transport T.symm + have h1 : T.symm '' (sph '' sphere 0 1) = F := by + rw [← hT, image_image] + simp + rw [h1] at h + exact h + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/SurfaceGraph.lean b/LeanPool/GraphMinor/Surface/SurfaceGraph.lean new file mode 100644 index 0000000000..d01be0784c --- /dev/null +++ b/LeanPool/GraphMinor/Surface/SurfaceGraph.lean @@ -0,0 +1,749 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.ArcTools + +/-! +# Finite graphs in a space + +`IsGraph V E` says that `E` is a finite set of arcs with ends in the finite set `V`, that meet only +in `V`. We add +points (`IsGraph.add_point`), arcs and whole curves (`IsGraph.add_curve`), as long as the new curve +meets the old graph +in a finite way. An `O`-arc in the graph contains or misses the open part of each edge +(`IsGraph.edge_or`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +universe u + +local notation "𝕀" => unitInterval + +variable {X : Type u} [TopologicalSpace X] + +theorem IsLineWithEnds.left_mem {L : Set X} {u v : X} (h : IsLineWithEnds L u v) : u ∈ L := by + obtain ⟨f, h0, -⟩ := h + exact h0 ▸ (f 0).2 + +theorem IsLineWithEnds.right_mem {L : Set X} {u v : X} (h : IsLineWithEnds L u v) : v ∈ L := by + obtain ⟨f, -, h1⟩ := h + exact h1 ▸ (f 1).2 + +/-- Both endpoints of a line belong to the line. -/ +theorem IsLineWithEnds.ends_mem {L : Set X} {u v : X} (h : IsLineWithEnds L u v) : + u ∈ L ∧ v ∈ L := + ⟨h.left_mem, h.right_mem⟩ + +/-- A line has an interior point distinct from its two endpoints. -/ +theorem IsLineWithEnds.nonempty_sdiff {S : Type*} [TopologicalSpace S] + {L : Set S} {a b : S} (hL : IsLineWithEnds L a b) : (L \ {a, b}).Nonempty := by + obtain ⟨f, hf0, hf1⟩ := hL + let m : unitInterval := ⟨1 / 2, by norm_num, by norm_num⟩ + refine ⟨(f m).val, (f m).property, ?_⟩ + rintro (h | h) + · have hm : m = 0 := f.injective (Subtype.ext (h.trans hf0.symm)) + have hh := congrArg Subtype.val hm + norm_num [m] at hh + · have hm : m = 1 := f.injective (Subtype.ext (h.trans hf1.symm)) + have hh := congrArg Subtype.val hm + norm_num [m] at hh + +theorem IsLineWithEnds.isCompact {L : Set X} {u v : X} (h : IsLineWithEnds L u v) : IsCompact L + := by + obtain ⟨f, -, -⟩ := h + have : L = range fun t => (f t).1 := by + ext x + constructor + · intro hx + exact ⟨f.symm ⟨x, hx⟩, by simp⟩ + · rintro ⟨t, rfl⟩ + exact (f t).2 + rw [this] + exact isCompact_range (continuous_subtype_val.comp f.continuous) + +/-- The carrier of a graph. -/ +def gr (V : Set X) (E : Set (Set X)) : Set X := V ∪ ⋃₀ E + +/-- `E` is a finite set of arcs with ends in the finite set `V`, that meet only in `V`. -/ +structure IsGraph (V : Set X) (E : Set (Set X)) : Prop where + fin : V.Finite + fine : E.Finite + edge : ∀ e ∈ E, ∃ u v, u ≠ v ∧ IsLineWithEnds e u v ∧ e ∩ V = {u, v} + disj : ∀ e ∈ E, ∀ f ∈ E, e ≠ f → e ∩ f ⊆ V + +theorem isGraph_empty : IsGraph (∅ : Set X) ∅ := ⟨finite_empty, finite_empty, by simp, by simp⟩ + +theorem IsGraph.isClosed_gr [T2Space X] {V : Set X} {E : Set (Set X)} (h : IsGraph V E) : IsClosed + (gr V E) := by + refine h.fin.isClosed.union (h.fine.isClosed_sUnion fun e he => ?_) + obtain ⟨u, v, -, hl, -⟩ := h.edge e he + exact hl.isCompact.isClosed + +/-- Insert a vertex, subdividing at most one edge. Each resulting edge lies in an old edge. -/ +theorem IsGraph.add_point_counted [T2Space X] {V : Set X} {E : Set (Set X)} (h : IsGraph V E) + (x : X) : + ∃ E', IsGraph (insert x V) E' ∧ gr (insert x V) E' = insert x (gr V E) ∧ ⋃₀ E ⊆ ⋃₀ E' + ∧ E'.ncard ≤ E.ncard + 1 ∧ + ∀ f ∈ E', ∃ e ∈ E, f ⊆ e := by + classical + by_cases hV : x ∈ V + · refine ⟨E, by rwa [insert_eq_of_mem hV], ?_, subset_rfl, by omega, fun f hf ↦ ⟨f, hf, + subset_rfl⟩⟩ + rw [insert_eq_of_mem hV, insert_eq_of_mem (Or.inl hV : x ∈ gr V E)] + by_cases hE : ∃ e ∈ E, x ∈ e + · obtain ⟨e, he, hx⟩ := hE + obtain ⟨u, v, huv, hl, hi⟩ := h.edge e he + have hu : u ∈ V := (hi.symm ▸ mem_insert u {v} : u ∈ e ∩ V).2 + have hv : v ∈ V := (hi.symm ▸ mem_insert_of_mem u rfl : v ∈ e ∩ V).2 + have hxu : x ≠ u := fun he' => hV (he' ▸ hu) + have hxv : x ≠ v := fun he' => hV (he' ▸ hv) + obtain ⟨L₁, L₂, h₁, h₂, hun, hin⟩ := hl.split hx hxu hxv + have hs1 : L₁ ⊆ e := hun ▸ subset_union_left + have hs2 : L₂ ⊆ e := hun ▸ subset_union_right + have hof : ∀ f ∈ E, f ≠ e → x ∉ f := fun f hf hne hxf => hV (h.disj e he f hf hne.symm ⟨hx, + hxf⟩) + have hvL : v ∉ L₁ := fun hc => hxv (mem_singleton_iff.mp (hin ▸ (⟨hc, h₂.right_mem⟩ : v ∈ L₁ ∩ + L₂))).symm + have huL : u ∉ L₂ := fun hc => hxu (mem_singleton_iff.mp (hin ▸ (⟨h₁.left_mem, hc⟩ : u ∈ L₁ ∩ + L₂))).symm + refine ⟨insert L₁ (insert L₂ (E \ {e})), ⟨h.fin.insert x, ((h.fine.sdiff).insert _).insert _, + ?_, ?_⟩, ?_, ?_, ?_, ?_⟩ + · rintro f (rfl | rfl | ⟨hf, hne⟩) + · refine ⟨u, x, hxu.symm, h₁, ?_⟩ + ext y + constructor + · rintro ⟨hy, rfl | hy'⟩ + · simp + · have : y ∈ e ∩ V := ⟨hs1 hy, hy'⟩ + rw [hi] at this + rcases this with rfl | rfl + · simp + · exact absurd hy hvL + · rintro (rfl | rfl) + · exact ⟨h₁.left_mem, .inr hu⟩ + · exact ⟨h₁.right_mem, .inl rfl⟩ + · refine ⟨x, v, hxv, h₂, ?_⟩ + ext y + constructor + · rintro ⟨hy, rfl | hy'⟩ + · simp + · have : y ∈ e ∩ V := ⟨hs2 hy, hy'⟩ + rw [hi] at this + rcases this with rfl | rfl + · exact absurd hy huL + · simp + · rintro (rfl | rfl) + · exact ⟨h₂.left_mem, .inl rfl⟩ + · exact ⟨h₂.right_mem, .inr hv⟩ + · obtain ⟨a, b, hab, hl', hi'⟩ := h.edge f hf + refine ⟨a, b, hab, hl', ?_⟩ + rw [inter_insert_of_notMem (hof f hf hne), hi'] + · have hL1 : ∀ g ∈ E \ {e}, L₁ ∩ g ⊆ insert x V := fun g hg y hy => + .inr (h.disj e he g hg.1 (Ne.symm hg.2) ⟨hs1 hy.1, hy.2⟩) + have hL2 : ∀ g ∈ E \ {e}, L₂ ∩ g ⊆ insert x V := fun g hg y hy => + .inr (h.disj e he g hg.1 (Ne.symm hg.2) ⟨hs2 hy.1, hy.2⟩) + have h12 : L₁ ∩ L₂ ⊆ insert x V := by + rw [hin] + exact singleton_subset_iff.mpr (mem_insert _ _) + rintro f (rfl | rfl | hf) g (rfl | rfl | hg) hne + · exact absurd rfl hne + · exact h12 + · exact hL1 g hg + · exact (inter_comm _ _).subset.trans h12 + · exact absurd rfl hne + · exact hL2 g hg + · exact (inter_comm _ _).subset.trans (hL1 f hf) + · exact (inter_comm _ _).subset.trans (hL2 f hf) + · exact (h.disj f hf.1 g hg.1 hne).trans (subset_insert _ _) + · ext y + simp only [gr, mem_union, mem_insert_iff, mem_sUnion, mem_sdiff, mem_singleton_iff] + constructor + · rintro ((rfl | hy) | ⟨f, (rfl | rfl | ⟨hf, -⟩), hy⟩) + · exact .inl rfl + · exact .inr (.inl hy) + · exact .inr (.inr ⟨e, he, hs1 hy⟩) + · exact .inr (.inr ⟨e, he, hs2 hy⟩) + · exact .inr (.inr ⟨f, hf, hy⟩) + · rintro (rfl | hy | ⟨f, hf, hy⟩) + · exact .inl (.inl rfl) + · exact .inl (.inr hy) + · by_cases hfe : f = e + · subst hfe + rw [← hun] at hy + rcases hy with hy | hy + · exact .inr ⟨L₁, .inl rfl, hy⟩ + · exact .inr ⟨L₂, .inr (.inl rfl), hy⟩ + · exact .inr ⟨f, .inr (.inr ⟨hf, hfe⟩), hy⟩ + · rintro y ⟨f, hf, hy⟩ + by_cases hfe : f = e + · subst hfe + rw [← hun] at hy + rcases hy with hy | hy + · exact ⟨L₁, .inl rfl, hy⟩ + · exact ⟨L₂, .inr (.inl rfl), hy⟩ + · exact ⟨f, .inr (.inr ⟨hf, hfe⟩), hy⟩ + · have h1 : (insert L₁ (insert L₂ (E \ {e}))).ncard ≤ (insert L₂ (E \ {e})).ncard + 1 + := ncard_insert_le _ _ + have h2 : (insert L₂ (E \ {e})).ncard ≤ (E \ {e}).ncard + 1 := ncard_insert_le _ _ + have h3 : (E \ {e}).ncard + 1 = E.ncard := ncard_sdiff_singleton_add_one he h.fine + omega + · rintro f (rfl | rfl | ⟨hf, -⟩) + · exact ⟨e, he, hs1⟩ + · exact ⟨e, he, hs2⟩ + · exact ⟨f, hf, subset_rfl⟩ + · push Not at hE + refine ⟨E, ⟨h.fin.insert x, h.fine, fun e he => ?_, fun e he f hf hne => + (h.disj e he f hf hne).trans (subset_insert _ _)⟩, ?_, subset_rfl, by omega, fun f hf ↦ ⟨f, + hf, subset_rfl⟩⟩ + · obtain ⟨a, b, hab, hl', hi'⟩ := h.edge e he + refine ⟨a, b, hab, hl', ?_⟩ + rw [inter_insert_of_notMem (hE e he), hi'] + · simp only [gr, insert_union] + +theorem IsGraph.add_point [T2Space X] {V : Set X} {E : Set (Set X)} (h : IsGraph V E) (x : X) : + ∃ E', IsGraph (insert x V) E' ∧ gr (insert x V) E' = insert x (gr V E) ∧ ⋃₀ E ⊆ ⋃₀ E' := by + obtain ⟨E', hGraph, hPointSet, hCover, _, _⟩ := h.add_point_counted x + exact ⟨E', hGraph, hPointSet, hCover⟩ + +/-- Adding an arc whose ends are vertices and which misses the rest of the graph. -/ +theorem IsGraph.add_arc {V : Set X} {E : Set (Set X)} (h : IsGraph V E) {A : Set X} {p q : X} + (hpq : p ≠ q) + (hl : IsLineWithEnds A p q) (hp : p ∈ V) (hq : q ∈ V) (hA : A ∩ gr V E = {p, q}) : + IsGraph V (insert A E) ∧ gr V (insert A E) = gr V E ∪ A := by + have hsub : ∀ f ∈ E, A ∩ f ⊆ V := fun f hf y hy => by + have : y ∈ A ∩ gr V E := ⟨hy.1, .inr ⟨f, hf, hy.2⟩⟩ + rw [hA] at this + rcases this with rfl | rfl + · exact hp + · exact hq + refine ⟨⟨h.fin, h.fine.insert _, ?_, ?_⟩, ?_⟩ + · rintro f (rfl | hf) + · refine ⟨p, q, hpq, hl, ?_⟩ + ext y + constructor + · rintro ⟨h1, h2⟩ + rw [← hA] + exact ⟨h1, .inl h2⟩ + · rintro (rfl | rfl) + · exact ⟨hl.left_mem, hp⟩ + · exact ⟨hl.right_mem, hq⟩ + · exact h.edge f hf + · rintro f (rfl | hf) g (rfl | hg) hne + · exact absurd rfl hne + · exact hsub g hg + · exact (inter_comm _ _).subset.trans (hsub f hf) + · exact h.disj f hf g hg hne + · ext y + simp only [gr, mem_union, mem_sUnion, mem_insert_iff] + constructor + · rintro (hy | ⟨f, rfl | hf, hy⟩) + · exact .inl (.inl hy) + · exact .inr hy + · exact .inl (.inr ⟨f, hf, hy⟩) + · rintro ((hy | ⟨f, hf, hy⟩) | hy) + · exact .inl hy + · exact .inr ⟨f, .inr hf, hy⟩ + · exact .inr ⟨A, .inl rfl, hy⟩ + +/-- Adding an arc with ends in the graph which meets the graph in a finite way. -/ +theorem IsGraph.add_path [T2Space X] {a : 𝕀 → X} (ha : IsArcMap a) (n : ℕ) : + ∀ (V : Set X) (E : Set (Set X)) (F : Set (Set X)), IsGraph V E → a 0 ∈ gr V E → a 1 ∈ gr V E + → F.Finite → + F.ncard = n → (∀ J ∈ F, IsPreconnected J) → ⋃₀ F = range a \ gr V E → + ∃ V' E', V ⊆ V' ∧ IsGraph V' E' ∧ gr V' E' = gr V E ∪ range a ∧ (V ⊆ ⋃₀ E → V' ⊆ ⋃₀ E') := by + classical + induction n using Nat.strong_induction_on with + | _ n ih => + intro V E F h h0 h1 hF hn hJ hU + by_cases hW : range a ⊆ gr V E + · exact ⟨V, E, subset_rfl, h, by rw [union_eq_left.mpr hW], id⟩ + obtain ⟨_, ⟨t0, rfl⟩, ht0⟩ := not_subset.mp hW + have hcl : IsClosed (a ⁻¹' gr V E) := h.isClosed_gr.preimage ha.1 + have hc1 : IsCompact (a ⁻¹' gr V E ∩ Iic t0) := (hcl.inter isClosed_Iic).isCompact + have hc2 : IsCompact (a ⁻¹' gr V E ∩ Ici t0) := (hcl.inter isClosed_Ici).isCompact + obtain ⟨s, ⟨hs1, hs2⟩, hsg⟩ := hc1.exists_isGreatest ⟨0, h0, unitInterval.nonneg t0⟩ + obtain ⟨r, ⟨hr1, hr2⟩, hrl⟩ := hc2.exists_isLeast ⟨1, h1, unitInterval.le_one t0⟩ + have hst : s < t0 := lt_of_le_of_ne hs2 fun he => ht0 (he ▸ hs1) + have htr : t0 < r := lt_of_le_of_ne hr2 fun he => ht0 (he ▸ hr1) + have hsr : s < r := hst.trans htr + have hsrR : (s : ℝ) < r := hsr + set A : Set X := a '' Icc s r with hAdef + have hline : IsLineWithEnds A (a s) (a r) := by + have := (IsArcMap.sub ha hsr.ne).isLineWithEnds + rw [range_subArc a hsr.le, subArc_zero, subArc_one] at this + exact this + have hne : a s ≠ a r := fun he => hsr.ne (ha.2 he) + have hAi : A ∩ gr V E = {a s, a r} := by + ext y + constructor + · rintro ⟨⟨t, ⟨h3, h4⟩, rfl⟩, hy⟩ + rcases le_total t t0 with h5 | h5 + · have : t ≤ s := hsg ⟨hy, h5⟩ + exact .inl (congrArg a (le_antisymm this h3)) + · have : r ≤ t := hrl ⟨hy, h5⟩ + exact .inr (congrArg a (le_antisymm h4 this)) + · rintro (rfl | rfl) + · exact ⟨⟨s, ⟨le_rfl, hsr.le⟩, rfl⟩, hs1⟩ + · exact ⟨⟨r, ⟨hsr.le, le_rfl⟩, rfl⟩, hr1⟩ + obtain ⟨E1, hG1, hg1, hu1⟩ := h.add_point (a s) + obtain ⟨E2, hG2, hg2, hu2⟩ := hG1.add_point (a r) + have hgr : gr (insert (a r) (insert (a s) V)) E2 = gr V E := by + rw [hg2, hg1, insert_eq_of_mem (show a s ∈ gr V E from hs1), + insert_eq_of_mem (show a r ∈ gr V E from hr1)] + obtain ⟨hG3, hg3⟩ := hG2.add_arc hne hline (.inr (.inl rfl)) (.inl rfl) (by rw [hgr, hAi]) + rw [hgr] at hg3 + have hsame : ∀ J ∈ F, (J ∩ A).Nonempty → J ⊆ A := by + rintro J hJF ⟨_, hy, ⟨t, ht, rfl⟩⟩ y' hy' + have hJW : J ⊆ range a \ gr V E := hU ▸ subset_sUnion_of_mem hJF + obtain ⟨t', rfl⟩ := (hJW hy').1 + have hemb : IsEmbedding a := (ha.1.isClosedEmbedding ha.2).isEmbedding + have hpc : IsPreconnected (a ⁻¹' J) := by + refine hemb.isInducing.isPreconnected_image.mp ?_ + rw [image_preimage_eq_inter_range, inter_eq_left.mpr fun z hz => (hJW hz).1] + exact hJ J hJF + have hord := hpc.ordConnected + by_contra hcon + have ht' : t' < s ∨ r < t' := by + by_contra hc + push Not at hc + exact hcon ⟨t', ⟨hc.1, hc.2⟩, rfl⟩ + have hbad : ∀ w ∈ a ⁻¹' J, w ∉ a ⁻¹' gr V E := fun w hw => (hJW hw).2 + rcases ht' with h3 | h3 + · exact hbad s (hord.out hy' hy ⟨h3.le, ht.1⟩) hs1 + · exact hbad r (hord.out hy hy' ⟨ht.2, h3.le⟩) hr1 + let F' : Set (Set X) := {J ∈ F | Disjoint J A} + obtain ⟨J0, hJ0, hx0⟩ : ∃ J ∈ F, a t0 ∈ J := by + have : a t0 ∈ ⋃₀ F := hU ▸ ⟨⟨t0, rfl⟩, ht0⟩ + exact this + have hA0 : a t0 ∈ A := ⟨t0, ⟨hst.le, htr.le⟩, rfl⟩ + have hlt : F'.ncard < n := by + rw [← hn] + refine ncard_lt_ncard ?_ hF + refine ⟨fun J hJ => hJ.1, fun hc => ?_⟩ + exact Set.disjoint_left.mp (hc hJ0).2 hx0 hA0 + obtain ⟨V', E', hVV, hG', hg', hno⟩ := ih _ hlt _ _ F' hG3 (by rw [hg3]; exact .inl h0) + (by rw [hg3]; exact .inl h1) + (hF.subset fun J hJ => hJ.1) rfl (fun J hJ' => hJ J hJ'.1) (by + rw [hg3] + ext y + constructor + · rintro ⟨J, ⟨hJF, hd⟩, hy⟩ + have : y ∈ range a \ gr V E := hU ▸ mem_sUnion_of_mem hy hJF + exact ⟨this.1, fun hc => hc.elim this.2 (Set.disjoint_left.mp hd hy)⟩ + · rintro ⟨hy1, hy2⟩ + have hy3 : y ∈ ⋃₀ F := hU ▸ ⟨hy1, fun hc => hy2 (.inl hc)⟩ + obtain ⟨J, hJF, hyJ⟩ := hy3 + refine ⟨J, ⟨hJF, ?_⟩, hyJ⟩ + rw [Set.disjoint_iff_inter_eq_empty, ← not_nonempty_iff_eq_empty] + intro hne' + exact hy2 (.inr (hsame J hJF hne' hyJ))) + refine ⟨V', E', (subset_insert _ _).trans ((subset_insert _ _).trans hVV), hG', ?_, fun hVE + => hno ?_⟩ + · rw [hg', hg3, union_assoc, union_eq_right.mpr (image_subset_range a _)] + · rintro y (rfl | rfl | hy) + · exact ⟨A, .inl rfl, hline.right_mem⟩ + · exact ⟨A, .inl rfl, hline.left_mem⟩ + · obtain ⟨f, hf, hyf⟩ := hu2 (hu1 (hVE hy)) + exact ⟨f, .inr hf, hyf⟩ + +theorem IsOArc.exists_ne {P : Set X} (hP : IsOArc P) (x : X) : ∃ y ∈ P, y ≠ x := by + obtain ⟨φ⟩ := id hP + by_cases h3 : (φ 1).1 = x + · refine ⟨(φ (Circle.exp Real.pi)).1, (φ _).2, fun h4 => ?_⟩ + have h5 := φ.injective (Subtype.ext (h4.trans h3.symm)) + have h6 := congrArg (fun w : Circle => (w : ℂ)) h5 + simp at h6 + norm_num at h6 + · exact ⟨_, (φ 1).2, h3⟩ + +theorem IsTwoArcs.inter {a b : 𝕀 → X} (h : IsTwoArcs a b) : range a ∩ range b = {a 0, a 1} := by + ext y + constructor + · rintro ⟨⟨s, rfl⟩, ⟨t, ht⟩⟩ + rcases h.meet s t ht.symm with ⟨rfl, -⟩ | ⟨rfl, -⟩ + · exact .inl rfl + · exact .inr rfl + · rintro (rfl | rfl) + · exact ⟨⟨0, rfl⟩, ⟨0, h.zero⟩⟩ + · exact ⟨⟨1, rfl⟩, ⟨1, h.one⟩⟩ + +/-- Adding a curve which meets the graph in a finite way. -/ +theorem IsGraph.add_curve [T2Space X] {V : Set X} {E : Set (Set X)} (h : IsGraph V E) {P : Set X} + (hP : IsOArc P) + (hF : FinConn (P \ gr V E)) : + ∃ V' E', V ⊆ V' ∧ IsGraph V' E' ∧ gr V' E' = gr V E ∪ P ∧ (V ⊆ ⋃₀ E → V' ⊆ ⋃₀ E') := by + classical + by_cases h2 : ∃ x y, x ∈ P ∧ y ∈ P ∧ x ∈ gr V E ∧ y ∈ gr V E ∧ x ≠ y + · obtain ⟨x, y, hxP, hyP, hxG, hyG, hxy⟩ := h2 + obtain ⟨a, b, hab, rfl, rfl, rfl⟩ := hP.exists_arcs hxP hyP hxy + obtain ⟨F, hFf, hFc, hFu⟩ := hF + have hi := hab.inter + have hca : IsClosed (range a) := (isCompact_range hab.1.1).isClosed + have hcb : IsClosed (range b) := (isCompact_range hab.2.1).isClosed + have hside : ∀ J ∈ F, J ⊆ range a ∨ J ⊆ range b := fun J hJ => by + have h3 : J ⊆ (range a ∪ range b) \ gr V E := hFu ▸ subset_sUnion_of_mem hJ + by_contra hcon + push Not at hcon + obtain ⟨h4, h5⟩ := hcon + obtain ⟨z, hz, hz'⟩ := not_subset.mp h4 + obtain ⟨z', hw, hw'⟩ := not_subset.mp h5 + have hzb : z ∈ range b := ((h3 hz).1).resolve_left hz' + have hwa : z' ∈ range a := ((h3 hw).1).resolve_right hw' + obtain ⟨v, hv, hv'⟩ := isPreconnected_closed_iff.mp (hFc J hJ) _ _ hca hcb + (fun w hw => (h3 hw).1) ⟨z', hw, hwa⟩ ⟨z, hz, hzb⟩ + rw [hi] at hv' + rcases hv' with rfl | rfl + · exact (h3 hv).2 hxG + · exact (h3 hv).2 hyG + let Fa : Set (Set X) := {J ∈ F | J ⊆ range a} + let Fb : Set (Set X) := {J ∈ F | J ⊆ range b} + obtain ⟨V1, E1, hV1, hG1, hg1, hno1⟩ := IsGraph.add_path hab.1 _ V E Fa h hxG hyG + (hFf.subset fun J hJ => hJ.1) rfl + (fun J hJ => hFc J hJ.1) (by + ext z + constructor + · rintro ⟨J, hJ, hz⟩ + have h3 : z ∈ (range a ∪ range b) \ gr V E := hFu ▸ mem_sUnion_of_mem hz hJ.1 + exact ⟨hJ.2 hz, h3.2⟩ + · rintro ⟨hz, hz'⟩ + have h3 : z ∈ ⋃₀ F := hFu ▸ ⟨.inl hz, hz'⟩ + obtain ⟨J, hJ, hzJ⟩ := h3 + rcases hside J hJ with h4 | h4 + · exact ⟨J, ⟨hJ, h4⟩, hzJ⟩ + · have h5 : z ∈ range a ∩ range b := ⟨hz, h4 hzJ⟩ + rw [hi] at h5 + rcases h5 with rfl | rfl + · exact absurd hxG hz' + · exact absurd hyG hz') + have h0b : b 0 ∈ gr V1 E1 := by rw [hg1, hab.zero]; exact .inl hxG + have h1b : b 1 ∈ gr V1 E1 := by rw [hg1, hab.one]; exact .inl hyG + obtain ⟨V2, E2, hV2, hG2, hg2, hno2⟩ := IsGraph.add_path hab.2 _ V1 E1 Fb hG1 h0b h1b + (hFf.subset fun J hJ => hJ.1) rfl + (fun J hJ => hFc J hJ.1) (by + rw [hg1] + ext z + constructor + · rintro ⟨J, hJ, hz⟩ + have h3 : z ∈ (range a ∪ range b) \ gr V E := hFu ▸ mem_sUnion_of_mem hz hJ.1 + refine ⟨hJ.2 hz, ?_⟩ + rintro (h4 | h4) + · exact h3.2 h4 + · have h5 : z ∈ range a ∩ range b := ⟨h4, hJ.2 hz⟩ + rw [hi] at h5 + rcases h5 with rfl | rfl + · exact h3.2 hxG + · exact h3.2 hyG + · rintro ⟨hz, hz'⟩ + have h3 : z ∈ ⋃₀ F := hFu ▸ ⟨.inr hz, fun h4 => hz' (.inl h4)⟩ + obtain ⟨J, hJ, hzJ⟩ := h3 + rcases hside J hJ with h4 | h4 + · exact absurd (.inr (h4 hzJ)) hz' + · exact ⟨J, ⟨hJ, h4⟩, hzJ⟩) + exact ⟨V2, E2, hV1.trans hV2, hG2, by rw [hg2, hg1, union_assoc], hno2 ∘ hno1⟩ + · push Not at h2 + obtain ⟨x, hxP, hx1⟩ : ∃ x ∈ P, ∀ z ∈ P, z ∈ gr V E → z = x := by + by_cases h3 : ∃ x ∈ P, x ∈ gr V E + · obtain ⟨x, hxP, hxG⟩ := h3 + exact ⟨x, hxP, fun z hz hzG => h2 z x hz hxP hzG hxG⟩ + · push Not at h3 + obtain ⟨x, hxP, -⟩ := hP.exists_ne (Classical.choice (by + obtain ⟨φ⟩ := hP + exact ⟨(φ 1).1⟩)) + exact ⟨x, hxP, fun z hz hzG => absurd hzG (h3 z hz)⟩ + obtain ⟨y, hyP, hyx⟩ := hP.exists_ne x + obtain ⟨a, b, hab, ha0, ha1, hu⟩ := hP.exists_arcs hxP hyP (Ne.symm hyx) + obtain ⟨E1, hG1, hg1, hu1⟩ := h.add_point x + obtain ⟨E2, hG2, hg2, hu2⟩ := hG1.add_point y + have hi := hab.inter + rw [ha0, ha1] at hi + have hg3 : gr (insert y (insert x V)) E2 = insert y (insert x (gr V E)) := by rw [hg2, hg1] + have hra : range a ⊆ P := hu ▸ subset_union_left + have hrb : range b ⊆ P := hu ▸ subset_union_right + obtain ⟨hG3, hg4⟩ := hG2.add_arc (Ne.symm hyx) (by + have := hab.1.isLineWithEnds + rwa [ha0, ha1] at this) (.inr (.inl rfl)) (.inl rfl) (by + rw [hg3] + ext z + constructor + · rintro ⟨hz, rfl | rfl | hz'⟩ + · exact .inr rfl + · exact .inl rfl + · exact .inl (hx1 z (hra hz) hz') + · rintro (rfl | rfl) + · exact ⟨⟨0, ha0⟩, .inr (.inl rfl)⟩ + · exact ⟨⟨1, ha1⟩, .inl rfl⟩) + obtain ⟨hG4, hg5⟩ := hG3.add_arc (Ne.symm hyx) (by + have := hab.2.isLineWithEnds + rwa [hab.zero, hab.one, ha0, ha1] at this) (.inr (.inl rfl)) (.inl rfl) (by + rw [hg4, hg3] + ext z + constructor + · rintro ⟨hz, (rfl | rfl | hz') | hz'⟩ + · exact .inr rfl + · exact .inl rfl + · exact .inl (hx1 z (hrb hz) hz') + · rw [← hi] + exact ⟨hz', hz⟩ + · rintro (rfl | rfl) + · exact ⟨⟨0, by rw [hab.zero, ha0]⟩, .inl (.inr (.inl rfl))⟩ + · exact ⟨⟨1, by rw [hab.one, ha1]⟩, .inl (.inl rfl)⟩) + refine ⟨_, _, (subset_insert _ _).trans (subset_insert _ _), hG4, ?_, fun hVE => ?_⟩ + swap + · rintro z (rfl | rfl | hz) + · exact ⟨range a, .inr (.inl rfl), ⟨1, ha1⟩⟩ + · exact ⟨range a, .inr (.inl rfl), ⟨0, ha0⟩⟩ + · obtain ⟨f, hf, hzf⟩ := hu2 (hu1 (hVE hz)) + exact ⟨f, .inr (.inr hf), hzf⟩ + rw [hg5, hg4, hg3, ← hu] + ext z + simp only [mem_union, mem_insert_iff] + constructor + · rintro (((rfl | rfl | hz) | hz) | hz) + · exact .inr (.inl ⟨1, ha1⟩) + · exact .inr (.inl ⟨0, ha0⟩) + · exact .inl hz + · exact .inr (.inl hz) + · exact .inr (.inr hz) + · rintro (hz | hz | hz) + · exact .inl (.inl (.inr (.inr hz))) + · exact .inl (.inr hz) + · exact .inr hz + +/-- `G` stays connected when one point is removed. -/ +def TwoConn (G : Set X) : Prop := ∀ p, IsPreconnected (G \ {p}) + +theorem TwoConn.union {A B : Set X} (hA : TwoConn A) (hB : TwoConn B) {x y : X} (hx : x ∈ A ∩ B) + (hy : y ∈ A ∩ B) + (hxy : x ≠ y) : TwoConn (A ∪ B) := by + intro p + rw [union_sdiff_distrib] + by_cases hp : x = p + · refine (hA p).union y ⟨hy.1, ?_⟩ ⟨hy.2, ?_⟩ (hB p) + all_goals exact fun h => hxy (hp.trans (mem_singleton_iff.mp h).symm) + · exact (hA p).union x ⟨hx.1, hp⟩ ⟨hx.2, hp⟩ (hB p) + +/-- An `O`-arc is still connected when one point is removed. -/ +theorem IsOArc.twoConn {P : Set X} (hP : IsOArc P) : TwoConn P := by + intro p + obtain ⟨φ⟩ := id hP + by_cases hp : p ∈ P + · obtain ⟨θ, hθ⟩ : ∃ θ : ℝ, Circle.exp θ = φ.symm ⟨p, hp⟩ := ⟨Complex.arg _, Circle.exp_arg _⟩ + have hc : Continuous fun t : ℝ => (φ (Circle.exp t)).1 := + continuous_subtype_val.comp (φ.continuous.comp Circle.exp.continuous) + have heq : P \ {p} = (fun t : ℝ => (φ (Circle.exp t)).1) '' Ioo θ (θ + 2 * Real.pi) := by + ext z + constructor + · rintro ⟨hz, hzp⟩ + obtain ⟨t, ht, e⟩ := exists_circle_angle (Circle.exp θ) (φ.symm ⟨z, hz⟩) + rw [← Circle.exp_add] at e + have ht0 : 0 < t := by + refine lt_of_le_of_ne ht.1 fun h0 => hzp ?_ + rw [← h0, add_zero, hθ] at e + have := φ.symm.injective e + exact congrArg Subtype.val this + refine ⟨θ + t, ⟨by linarith, by linarith [ht.2]⟩, ?_⟩ + simp only + rw [← e] + simp + · rintro ⟨t, ⟨h1, h2⟩, rfl⟩ + refine ⟨(φ _).2, fun he => ?_⟩ + have e : φ (Circle.exp t) = φ (Circle.exp θ) := Subtype.ext (by rw [hθ]; simpa using he) + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp (φ.injective e) + have hpi := Real.pi_pos + rcases le_or_gt m 0 with h3 | h3 + · have h4 : (m : ℝ) ≤ 0 := by exact_mod_cast h3 + nlinarith + · have h4 : (1 : ℝ) ≤ m := by exact_mod_cast (by omega : 1 ≤ m) + nlinarith + rw [heq] + exact isPreconnected_Ioo.image _ hc.continuousOn + · rw [sdiff_singleton_eq_self hp] + exact hP.isPreconnected + +/-- An `O`-arc in a graph contains or misses the open part of each edge. -/ +theorem IsGraph.edge_or [T2Space X] {V : Set X} {E : Set (Set X)} (h : IsGraph V E) {P : Set X} + (hP : IsOArc P) + (hPG : P ⊆ gr V E) {e : Set X} (he : e ∈ E) : e ⊆ P ∨ Disjoint (e \ V) P := by + classical + obtain ⟨u, v, huv, hl, hi⟩ := h.edge e he + obtain ⟨a, ha, rfl, rfl, rfl⟩ := hl.exists_arc + have hP0 : IsClosed P := hP.isCompact.isClosed + obtain ⟨k, -, hk⟩ := exists_inv_of_compactOn isCompact_univ ha.1.continuousOn ha.2.injOn + have hk' : ∀ x ∈ range a, a (k x) = x := by + rintro _ ⟨s, rfl⟩ + rw [hk (mem_univ s)] + have hkc : ContinuousOn k (range a) := by + obtain ⟨k', hk1, hk2⟩ := exists_inv_of_compactOn isCompact_univ ha.1.continuousOn ha.2.injOn + rw [← image_univ] + refine hk1.congr fun x hx => ?_ + obtain ⟨s, -, rfl⟩ := hx + rw [hk (mem_univ s), hk2 (mem_univ s)] + have hc := continuous_extI ha.1 + have hint : ∀ t ∈ Ioo (0 : ℝ) 1, extI a t ∉ V := fun t ht hV => by + have h1 : extI a t ∈ range a ∩ V := ⟨by rw [extI_of_mem a ⟨ht.1.le, ht.2.le⟩]; exact ⟨_, rfl⟩, + hV⟩ + rw [hi, extI_of_mem a ⟨ht.1.le, ht.2.le⟩] at h1 + rcases h1 with h2 | h2 + · have := congrArg Subtype.val (ha.2 h2) + exact ht.1.ne' this + · have := congrArg Subtype.val (ha.2 h2) + exact ht.2.ne this + have hmem : ∀ t ∈ Ioo (0 : ℝ) 1, extI a t ∈ range a := fun t ht => by + rw [extI_of_mem a ⟨ht.1.le, ht.2.le⟩] + exact ⟨_, rfl⟩ + let T : Set ℝ := {t | t ∈ Ioo (0 : ℝ) 1 ∧ extI a t ∈ P} + have hTo : IsOpen T := by + rw [isOpen_iff_mem_nhds] + rintro t ⟨ht, htP⟩ + obtain ⟨φ⟩ := id hP + let ψ : ℝ → X := fun θ => (φ (Circle.exp θ)).1 + have hψ : Continuous ψ := continuous_subtype_val.comp (φ.continuous.comp Circle.exp.continuous) + obtain ⟨θ0, hθ0⟩ : ∃ θ : ℝ, ψ θ = extI a t := by + refine ⟨Complex.arg (φ.symm ⟨_, htP⟩), ?_⟩ + simp [ψ, Circle.exp_arg] + have hOc : IsClosed (V ∪ ⋃₀ (E \ {range a})) := by + refine h.fin.isClosed.union ((h.fine.subset sdiff_subset).isClosed_sUnion fun f hf => ?_) + obtain ⟨u, v, -, hl', -⟩ := h.edge f hf.1 + exact hl'.isCompact.isClosed + have hyO : extI a t ∉ V ∪ ⋃₀ (E \ {range a}) := by + rintro (hV | ⟨f, hf, hyf⟩) + · exact hint t ht hV + · exact hint t ht (h.disj _ he f hf.1 (Ne.symm hf.2) ⟨hmem t ht, hyf⟩) + have hO : ψ ⁻¹' (V ∪ ⋃₀ (E \ {range a}))ᶜ ∈ 𝓝 θ0 := + hOc.isOpen_compl.preimage hψ |>.mem_nhds (by rw [mem_preimage, hθ0]; exact hyO) + obtain ⟨δ', hδ', hball⟩ := Metric.mem_nhds_iff.mp hO + let δ := min (δ' / 2) 1 + have hδ0 : 0 < δ := lt_min (by positivity) one_pos + have hδ1 : δ < δ' := lt_of_le_of_lt (min_le_left _ _) (by linarith) + have hδ2 : δ ≤ 1 := min_le_right _ _ + let I : Set ℝ := Icc (θ0 - δ) (θ0 + δ) + have hIO : ∀ θ ∈ I, ψ θ ∈ range a ∧ ψ θ ∉ V := fun θ hθ => by + have h1 : θ ∈ Metric.ball θ0 δ' := by + rw [Metric.mem_ball, Real.dist_eq, abs_lt] + exact ⟨by linarith [hθ.1], by linarith [hθ.2]⟩ + have h2 := hball h1 + have h3 : ψ θ ∈ gr V E := hPG (φ _).2 + refine ⟨?_, fun hV => h2 (.inl hV)⟩ + rcases h3 with h3 | ⟨f, hf, h3⟩ + · exact absurd (.inl h3) h2 + · by_cases hfe : f = range a + · exact hfe ▸ h3 + · exact absurd (.inr ⟨f, ⟨hf, hfe⟩, h3⟩) h2 + have hinjψ : InjOn ψ I := fun x hx y hy he => by + have e1 := φ.injective (Subtype.ext he) + obtain ⟨m, hm⟩ := Circle.exp_eq_exp.mp e1 + have hpi := Real.pi_gt_three + have h5 : |(m : ℝ) * (2 * Real.pi)| ≤ 2 := by + rw [abs_le] + constructor <;> linarith [hx.1, hx.2, hy.1, hy.2] + rcases eq_or_ne m 0 with rfl | hm0 + · simpa using hm + · exfalso + have h6 : (1 : ℝ) ≤ |(m : ℝ)| := by exact_mod_cast Int.one_le_abs hm0 + rw [abs_mul, abs_of_pos (show 0 < 2 * Real.pi by positivity)] at h5 + nlinarith + let q : ℝ → ℝ := fun θ => k (ψ θ) + have hqc : ContinuousOn q I := by + refine continuous_subtype_val.comp_continuousOn (hkc.comp hψ.continuousOn fun θ hθ => + (hIO θ hθ).1) + have hqi : InjOn q I := fun x hx y hy he => by + have h1 : k (ψ x) = k (ψ y) := Subtype.ext he + refine hinjψ hx hy ?_ + rw [← hk' _ (hIO x hx).1, ← hk' _ (hIO y hy).1, h1] + have hqa : ∀ θ ∈ I, a (k (ψ θ)) = ψ θ := fun θ hθ => hk' _ (hIO θ hθ).1 + have hq01 : ∀ θ ∈ I, q θ ∈ Ioo (0 : ℝ) 1 := fun θ hθ => by + have h1 := hIO θ hθ + have hu0 : a 0 ∈ V := by + have : a 0 ∈ range a ∩ V := hi ▸ mem_insert _ _ + exact this.2 + have hu1 : a 1 ∈ V := by + have : a 1 ∈ range a ∩ V := hi ▸ mem_insert_of_mem _ rfl + exact this.2 + refine ⟨lt_of_le_of_ne (k (ψ θ)).2.1 fun h0 => ?_, lt_of_le_of_ne (k (ψ θ)).2.2 fun h0 => ?_⟩ + · have : k (ψ θ) = 0 := Subtype.ext h0.symm + apply h1.2 + rw [← hqa θ hθ, this] + exact hu0 + · have : k (ψ θ) = 1 := Subtype.ext h0 + apply h1.2 + rw [← hqa θ hθ, this] + exact hu1 + have hθI : θ0 ∈ I := ⟨by linarith, by linarith⟩ + have hq0 : q θ0 = t := by + have h1 : a (k (ψ θ0)) = a ⟨t, ht.1.le, ht.2.le⟩ := by + rw [hqa θ0 hθI, hθ0, extI_of_mem a ⟨ht.1.le, ht.2.le⟩] + exact congrArg Subtype.val (ha.2 h1) + have hle : θ0 - δ ≤ θ0 + δ := by linarith + have hlI : θ0 - δ ∈ I := ⟨le_rfl, hle⟩ + have hrI : θ0 + δ ∈ I := ⟨hle, le_rfl⟩ + have hbetween : min (q (θ0 - δ)) (q (θ0 + δ)) < t ∧ t < max (q (θ0 - δ)) (q (θ0 + δ)) := by + rcases hqc.strictMonoOn_of_injOn_Icc' hle hqi with hm | hm + · have h1 := hm hlI hθI (by linarith) + have h2 := hm hθI hrI (by linarith) + rw [hq0] at h1 h2 + exact ⟨min_lt_iff.mpr (.inl h1), lt_max_iff.mpr (.inr h2)⟩ + · have h1 := hm hlI hθI (by linarith) + have h2 := hm hθI hrI (by linarith) + rw [hq0] at h1 h2 + exact ⟨min_lt_iff.mpr (.inr h2), lt_max_iff.mpr (.inl h1)⟩ + refine Filter.mem_of_superset (Ioo_mem_nhds hbetween.1 hbetween.2) fun s hs => ?_ + have hiv := intermediate_value_uIcc (a := θ0 - δ) (b := θ0 + δ) (f := q) + (by rw [uIcc_of_le hle]; exact hqc) + have hsu : s ∈ uIcc (q (θ0 - δ)) (q (θ0 + δ)) := Ioo_subset_Icc_self hs + obtain ⟨θ, hθ, rfl⟩ := hiv hsu + rw [uIcc_of_le hle] at hθ + have hmemI := hq01 θ hθ + refine ⟨hmemI, ?_⟩ + rw [extI_coe] + show a (k (ψ θ)) ∈ P + rw [hqa θ hθ] + exact (φ _).2 + by_cases hemp : T.Nonempty + · left + have hall : Ioo (0 : ℝ) 1 ⊆ extI a ⁻¹' P := by + intro t ht + by_contra hcon + obtain ⟨z, -, hz⟩ := isPreconnected_Ioo _ _ hTo (hP0.isOpen_compl.preimage hc) + (fun w hw => by + by_cases h1 : extI a w ∈ P + · exact .inl ⟨hw, h1⟩ + · exact .inr h1) (by + obtain ⟨w, hw⟩ := hemp + exact ⟨w, hw.1, hw⟩) ⟨t, ht, hcon⟩ + exact hz.2 hz.1.2 + have hcl : Icc (0 : ℝ) 1 ⊆ extI a ⁻¹' P := by + rw [← closure_Ioo (zero_ne_one' ℝ)] + exact closure_minimal hall (hP0.preimage hc) + rintro _ ⟨t, rfl⟩ + have := hcl t.2 + rwa [mem_preimage, extI_coe] at this + · right + rw [Set.disjoint_left] + rintro _ ⟨⟨t, rfl⟩, htV⟩ htP + apply hemp + have h0 : (t : ℝ) ≠ 0 := fun h0 => htV (by + have : t = 0 := Subtype.ext h0 + rw [this] + have : a 0 ∈ range a ∩ V := hi ▸ mem_insert _ _ + exact this.2) + have h1 : (t : ℝ) ≠ 1 := fun h0 => htV (by + have : t = 1 := Subtype.ext h0 + rw [this] + have : a 1 ∈ range a ∩ V := hi ▸ mem_insert_of_mem _ rfl + exact this.2) + refine ⟨t, ⟨lt_of_le_of_ne t.2.1 (Ne.symm h0), lt_of_le_of_ne t.2.2 h1⟩, ?_⟩ + rwa [extI_coe] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/SurfacePull.lean b/LeanPool/GraphMinor/Surface/SurfacePull.lean new file mode 100644 index 0000000000..f8c85e25cc --- /dev/null +++ b/LeanPool/GraphMinor/Surface/SurfacePull.lean @@ -0,0 +1,290 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.EdgeLoop + +/-! +# Dissections of surfaces with boundary + +A surface with boundary sits in a closed surface, by capping its cuffs. If the cuffs lie in the +graph of a dissection +of the closed surface, each cell lies in the surface or in the caps, since its interior is +connected. The cells in the +surface, with the edges in the surface, form a dissection of the surface (`pull_dissection`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +local notation "𝕀" => unitInterval + +section dense + +variable {S : Type u} [TopologicalSpace S] + +/-- Points that are not on the boundary are dense. -/ +theorem mem_closure_compl_bd {x : S} (hx : IsManifoldPoint x) : x ∈ closure (bd S)ᶜ := by + obtain ⟨U, O, j, k, hU, hO, hxU, hj, hk, hm, hk', hl, hr⟩ := hx.exists_chart + rw [_root_.mem_closure_iff] + intro N hN hxN + have hcw : ContinuousWithinAt k (O ∩ halfPlane) (j x) := hk _ (hm hxU) + have hA : U ∩ N ∈ 𝓝 (k (j x)) := by + rw [hl hxU] + exact (hU.inter hN).mem_nhds ⟨hxU, hxN⟩ + have h1 := hcw hA + obtain ⟨ρ, hρ, hball⟩ := Metric.mem_nhdsWithin_iff.mp h1 + obtain ⟨ρ', hρ', hball'⟩ := Metric.isOpen_iff.mp hO _ (hm hxU).1 + let r : ℝ := min ρ ρ' / 2 + have hr0 : 0 < r := by positivity + have hr1 : r < ρ := by + have := min_le_left ρ ρ' + simp only [r] + linarith [lt_min hρ hρ'] + have hr2 : r < ρ' := by + have := min_le_right ρ ρ' + simp only [r] + linarith [lt_min hρ hρ'] + let z : ℂ := j x + (r : ℂ) + have hzd : dist z (j x) = r := by + simp [z, dist_eq_norm, abs_of_pos hr0] + have hzH : z ∈ O ∩ halfPlane := by + refine ⟨hball' (by simpa [hzd] using hr2), ?_⟩ + have := (hm hxU).2 + have h' : 0 ≤ (j x).re := this + change 0 ≤ (j x + (r : ℂ)).re + simp only [Complex.add_re, Complex.ofReal_re] + linarith + have hkz : k z ∈ U ∩ N := hball ⟨by simpa [hzd] using hr1, hzH⟩ + refine ⟨k z, hkz.2, ?_⟩ + have hre : 0 < (j (k z)).re := by + rw [hr hzH] + have h' : 0 ≤ (j x).re := (hm hxU).2 + simp only [z, Complex.add_re, Complex.ofReal_re] + linarith + exact fun hb => hb (isInteriorPoint_of_chart hU hO hj hk hm hk' hl hr hkz.1 hre) + +end dense + +section map + +variable {S : Type u} {T : Type u} [TopologicalSpace S] [TopologicalSpace T] [T2Space S] [T2Space + T] {j : S → T} + +omit [T2Space S] in +theorem IsLineWithEnds.map_of_embedding (hj : IsEmbedding j) {L : Set S} {u v : S} + (hl : IsLineWithEnds L u v) : + IsLineWithEnds (j '' L) (j u) (j v) := by + obtain ⟨a, ha, rfl, rfl, rfl⟩ := hl.exists_arc + have h1 : IsArcMap (j ∘ a) := ⟨hj.continuous.comp ha.1, hj.injective.comp ha.2⟩ + have := h1.isLineWithEnds + rwa [range_comp] at this + +omit [T2Space T] in +theorem IsLineWithEnds.pull (hj : IsEmbedding j) {L : Set T} {u v : T} (hl : IsLineWithEnds L u v) + (hs : L ⊆ range j) : ∃ u' v', j u' = u ∧ j v' = v ∧ IsLineWithEnds (j ⁻¹' L) u' v' := by + obtain ⟨a, ha, rfl, rfl, rfl⟩ := hl.exists_arc + have hex : ∀ t, ∃ y, j y = a t := fun t => hs ⟨t, rfl⟩ + choose a' ha' using hex + have hc : Continuous a' := by + rw [hj.continuous_iff] + have : j ∘ a' = a := funext ha' + rw [this] + exact ha.1 + have hi : IsArcMap a' := ⟨hc, fun x y he => ha.2 (by rw [← ha', ← ha', he])⟩ + refine ⟨a' 0, a' 1, ha' 0, ha' 1, ?_⟩ + have := hi.isLineWithEnds + have e : j ⁻¹' range a = range a' := by + ext y + constructor + · rintro ⟨t, ht⟩ + exact ⟨t, hj.injective ((ha' t).trans ht)⟩ + · rintro ⟨t, rfl⟩ + exact ⟨t, (ha' t).symm⟩ + rwa [e] + +omit [T2Space S] in +/-- The image of a graph by an embedding. -/ +theorem IsGraph.map (hj : IsEmbedding j) {V : Set S} {E : Set (Set S)} (h : IsGraph V E) : + IsGraph (j '' V) ((fun e => j '' e) '' E) := by + refine ⟨h.fin.image _, h.fine.image _, ?_, ?_⟩ + · rintro _ ⟨e, he, rfl⟩ + obtain ⟨u, v, hne, hl, hi⟩ := h.edge e he + refine ⟨j u, j v, hj.injective.ne hne, hl.map_of_embedding hj, ?_⟩ + rw [← image_inter hj.injective, hi, image_pair] + · rintro _ ⟨e, he, rfl⟩ _ ⟨f, hf, rfl⟩ hne + have hne' : e ≠ f := fun h' => hne (by rw [h']) + rw [← image_inter hj.injective] + exact image_mono (h.disj e he f hf hne') + +omit [T2Space T] in +/-- The part of a graph on the image of an embedding, made of whole edges. -/ +theorem IsGraph.pull (hj : IsEmbedding j) {V : Set T} {E : Set (Set T)} (h : IsGraph V E) : + IsGraph (j ⁻¹' V) ((fun e => j ⁻¹' e) '' {e ∈ E | e ⊆ range j}) := by + refine ⟨h.fin.preimage hj.injective.injOn, (h.fine.subset (sep_subset _ _)).image _, ?_, ?_⟩ + · rintro _ ⟨e, ⟨he, hs⟩, rfl⟩ + obtain ⟨u, v, hne, hl, hi⟩ := h.edge e he + obtain ⟨u', v', rfl, rfl, hl'⟩ := hl.pull hj hs + refine ⟨u', v', fun h' => hne (by rw [h']), hl', ?_⟩ + ext y + simp only [mem_inter_iff, mem_preimage, mem_insert_iff, mem_singleton_iff] + constructor + · intro h1 + have h2 : j y ∈ e ∩ V := h1 + rw [hi] at h2 + rcases h2 with h2 | h2 + · exact .inl (hj.injective h2) + · exact .inr (hj.injective h2) + · rintro (h1 | h1) + · have : j y ∈ e ∩ V := by rw [hi, h1]; exact .inl rfl + exact this + · have : j y ∈ e ∩ V := by rw [hi, h1]; exact .inr rfl + exact this + · rintro _ ⟨e, ⟨he, hs⟩, rfl⟩ _ ⟨f, ⟨hf, hs'⟩, rfl⟩ hne + have hne' : e ≠ f := fun h' => hne (by rw [h']) + exact fun y hy => h.disj e he f hf hne' hy + +end map + +/-- An `O`-arc in a graph is the union of the edges inside it. -/ +theorem IsGraph.subset_edges {X : Type u} [TopologicalSpace X] [T2Space X] [Nonempty X] {V : Set X} + {E : Set (Set X)} + (hg : IsGraph V E) {P : Set X} (hP : IsOArc P) (hPG : P ⊆ ⋃₀ E) : P ⊆ ⋃₀ {e ∈ E | e ⊆ P} := by + classical + have harcs : ∀ e, ∃ a : 𝕀 → X, e ∈ E → IsArcMap a ∧ range a = e ∧ e ∩ V = {a 0, a 1} := by + intro e + by_cases he : e ∈ E + · obtain ⟨u, v, -, hl, hi⟩ := hg.edge e he + obtain ⟨a, ha, h1, rfl, rfl⟩ := hl.exists_arc + exact ⟨a, fun _ => ⟨ha, h1, hi⟩⟩ + · exact ⟨fun _ => Classical.arbitrary X, fun h => absurd h he⟩ + choose A hA using harcs + obtain ⟨m, s, ε, -, hs, hcov, -⟩ := exists_edge_walk hg hP hPG A hA + intro y hy + obtain ⟨p, hp, hyp⟩ := mem_iUnion₂.mp (hcov hy) + exact ⟨s p, hs p hp, hyp⟩ + +section pull + +variable {S T : Type u} [TopologicalSpace S] [TopologicalSpace T] [T2Space S] [T2Space T] {j : S + → T} + +omit [T2Space S] in +theorem isClosedDisc_preimage [CompactSpace S] [Nonempty S] (hj : IsClosedEmbedding j) {Φ : Set T} + (hΦ : IsClosedDisc Φ) (hs : Φ ⊆ range j) : + IsClosedDisc (j ⁻¹' Φ) ∧ discBd (j ⁻¹' Φ) = j ⁻¹' discBd Φ := by + obtain ⟨ρ, hρ, hl⟩ := exists_inv_of_compactOn (isCompact_univ (X := S)) hj.continuous.continuousOn + hj.injective.injOn + have hl' : ∀ x, ρ (j x) = x := fun x => hl (mem_univ x) + have hsr : ∀ y ∈ Φ, j (ρ y) = y := fun y hy => by + obtain ⟨x, rfl⟩ := hs hy + rw [hl'] + have hrΦ : Φ ⊆ j '' univ := by + rw [image_univ] + exact hs + have e : ∀ F : Set T, F ⊆ Φ → ρ '' F = j ⁻¹' F := fun F hF => by + ext x + constructor + · rintro ⟨y, hy, rfl⟩ + change j (ρ y) ∈ F + rwa [hsr y (hF hy)] + · intro hx + exact ⟨j x, hx, hl' x⟩ + obtain ⟨h1, h2⟩ := hΦ.image (f := ρ) (f' := j) (hρ.mono hrΦ) hj.continuous.continuousOn + (fun y hy => hsr y hy) + rw [e Φ subset_rfl] at h1 h2 + rw [e _ (discBd_subset Φ)] at h2 + exact ⟨h1, h2⟩ + +/-- Cells and edges of a dissection of a closed surface, restricted to a surface inside it. -/ +theorem pull_dissection [CompactSpace S] [Nonempty S] (hman : ∀ x : S, IsManifoldPoint x) + (hj : IsClosedEmbedding j) {K : Set T} (hK : IsClosed K) + (hu : range j ∪ K = univ) (hi : range j ∩ K = j '' bd S) {V : Set T} {E 𝓕 : Set (Set T)} + (hd : IsDissection V E 𝓕) + (hb : j '' bd S ⊆ ⋃₀ E) : + IsDissection (j ⁻¹' V) ((fun e => j ⁻¹' e) '' {e ∈ E | e ⊆ range j}) ((fun Φ + => j ⁻¹' Φ) '' {Φ ∈ 𝓕 | Φ ⊆ range j}) := by + classical + have hR : IsClosed (range j) := hj.isClosed_range + have hside : ∀ Φ ∈ 𝓕, Φ ⊆ range j ∨ Φ ⊆ K := by + intro Φ hΦ + have hD := hd.disc Φ hΦ + have hcov : discInt Φ ⊆ range j ∪ K := fun y _ => hu ▸ mem_univ y + by_cases h1 : (discInt Φ ∩ range j).Nonempty + · by_cases h2 : (discInt Φ ∩ K).Nonempty + · obtain ⟨y, hy, hy1, hy2⟩ := + isPreconnected_closed_iff.mp hD.isPreconnected_discInt _ _ hR hK hcov h1 h2 + exact absurd (hb (hi ▸ (⟨hy1, hy2⟩ : y ∈ range j ∩ K))) (Set.disjoint_left.mp + (hd.int Φ hΦ) hy) + · left + have h3 : discInt Φ ⊆ range j := fun y hy => + (hcov hy).resolve_right fun h => h2 ⟨y, hy, h⟩ + exact hD.subset_closure_discInt.trans (closure_minimal h3 hR) + · right + have h3 : discInt Φ ⊆ K := fun y hy => (hcov hy).resolve_left fun h => h1 ⟨y, hy, h⟩ + exact hD.subset_closure_discInt.trans (closure_minimal h3 hK) + have hpb : ∀ Φ ∈ {Φ ∈ 𝓕 | Φ ⊆ range j}, IsClosedDisc (j ⁻¹' Φ) ∧ discBd (j ⁻¹' Φ) + = j ⁻¹' discBd Φ := + fun Φ hΦ => isClosedDisc_preimage hj (hd.disc Φ hΦ.1) hΦ.2 + have hint : ∀ Φ ∈ {Φ ∈ 𝓕 | Φ ⊆ range j}, ∀ y ∈ discInt (j ⁻¹' Φ), j y ∈ discInt Φ := by + intro Φ hΦ y hy + refine ⟨hy.1, fun h => hy.2 ?_⟩ + rw [(hpb Φ hΦ).2] + exact h + refine ⟨hd.graph.pull hj.isEmbedding, (hd.fin.subset (sep_subset _ _)).image _, ?_, ?_, ?_, ?_, + ?_, ?_⟩ + · rintro _ ⟨Φ, hΦ, rfl⟩ + exact (hpb Φ hΦ).1 + · refine eq_univ_of_forall fun x => ?_ + have hfin : {Φ ∈ 𝓕 | Φ ⊆ range j}.Finite := hd.fin.subset (sep_subset _ _) + have hQ : IsClosed (⋃₀ {Φ ∈ 𝓕 | Φ ⊆ range j}) := + hfin.isClosed_sUnion fun Φ hΦ => (hd.disc Φ hΦ.1).isClosed + have hsub : (bd S)ᶜ ⊆ j ⁻¹' (⋃₀ {Φ ∈ 𝓕 | Φ ⊆ range j}) := by + intro y hy + have h1 : j y ∈ ⋃₀ 𝓕 := hd.cover ▸ mem_univ _ + obtain ⟨Φ, hΦ, hyΦ⟩ := h1 + rcases hside Φ hΦ with h2 | h2 + · exact ⟨Φ, ⟨hΦ, h2⟩, hyΦ⟩ + · have h3 : j y ∈ j '' bd S := hi ▸ (⟨⟨y, rfl⟩, h2 hyΦ⟩ : j y ∈ range j ∩ K) + obtain ⟨z, hz, he⟩ := h3 + exact absurd (hj.injective he ▸ hz) hy + have h4 := closure_minimal hsub (hQ.preimage hj.continuous) (mem_closure_compl_bd (hman x)) + obtain ⟨Φ, hΦ, hx⟩ := h4 + exact ⟨_, ⟨Φ, hΦ, rfl⟩, hx⟩ + · rintro _ ⟨Φ, hΦ, rfl⟩ + rw [(hpb Φ hΦ).2] + intro y hy + have hne : Nonempty T := ⟨j y⟩ + have hdO := (hd.disc Φ hΦ.1).isOArc_discBd + obtain ⟨e, he, hye⟩ := hd.graph.subset_edges hdO (hd.bd Φ hΦ.1) hy + exact ⟨_, ⟨e, ⟨he.1, he.2.trans ((discBd_subset Φ).trans hΦ.2)⟩, rfl⟩, hye⟩ + · rintro _ ⟨Φ, hΦ, rfl⟩ + rw [Set.disjoint_left] + rintro y hy ⟨_, ⟨e, he, rfl⟩, hye⟩ + exact Set.disjoint_left.mp (hd.int Φ hΦ.1) (hint Φ hΦ y hy) ⟨e, he.1, hye⟩ + · rintro _ ⟨Φ, hΦ, rfl⟩ _ ⟨Φ', hΦ', rfl⟩ hne + have hne' : Φ ≠ Φ' := fun h => hne (by rw [h]) + rw [Set.disjoint_left] + intro y hy hy' + exact Set.disjoint_left.mp (hd.disj Φ hΦ.1 Φ' hΦ'.1 hne') (hint Φ hΦ y hy) hy' + · intro x hx + have hx' : j x ∉ V := hx + refine (encard_le_encard ?_).trans ((encard_image_le (fun Φ => j ⁻¹' Φ) _).trans (hd.count + (j x) hx')) + rintro _ ⟨⟨Φ, hΦ, rfl⟩, hxΦ⟩ + exact ⟨Φ, ⟨hΦ.1, hxΦ⟩, rfl⟩ + +end pull + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/TopologyStatements.lean b/LeanPool/GraphMinor/Surface/TopologyStatements.lean new file mode 100644 index 0000000000..3cf92c2ce1 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/TopologyStatements.lean @@ -0,0 +1,467 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Defs +public import Mathlib.Topology.Compactification.OnePoint.Basic + +/-! +# The topological facts that Graph Minors VI–XIX use without proof + +The papers use several theorems of plane and surface topology without proof, or with a reference +to the literature. This file states each of them as a `Prop`, in the form the papers use it, on +the definitions of `GraphMinor/Surface/Defs.lean`. + +The statements, in order: +- the 2-sphere (`IsSphere`), the boundary of a closed disc (`DiscBoundaryStatement`), and cuffs + (`CuffStatement`); +- the Jordan curve theorem (`JordanCurveStatement`) and the Schoenflies theorem + (`SchoenfliesStatement`, `SphereDiscStatement`); +- discs: `O`-arcs and proper `I`-arcs in a closed disc (`DiscOArcStatement`, `DiscIArcStatement`), + union and difference of discs (`DiscUnionStatement`, `DiscDifferenceStatement`), and crossing + connected sets (`DiscCrossingStatement`); +- the model surfaces $\Sigma(a, b, c)$ (`SurfaceModel`), and their classification + (`ClassificationStatement`, `ModelCriterionStatement`); +- cutting along arcs and pasting discs (`IsCutting`, `IsSimplerThan`, `CutIArcStatement`, + `CutOArcStatement`, `PasteDiscStatement`, `SimplerWellFoundedStatement`); +- null-homotopic `O`-arcs (`EpsteinStatement`, `OpenDiscStatement`); +- moving points and arcs by homeomorphisms (`MoveCuffStatement`, `ParallelArcsStatement`, + `SimilarArcsFiniteStatement`, `PushOffStatement`). + +Each statement holds as written for the topological notions of `Defs.lean`. Two points differ from +the loose wording in the papers. + +* Crossing connected sets: two arbitrary connected sets in a disc whose ends cross need not meet. + With the axiom of choice one can split a disc into two disjoint dense connected sets (a + Bernstein set and its complement). So `DiscCrossingStatement` asks for compact sets, which is + what the papers use, and `DiscCrossingStatement.of_isPathConnected` deduces the form for + path-connected sets. +* Parallel arcs: Graph Minors VII, (3.2), claim (1) must also ask that the homeomorphism fixes the + ends of the arc. See `ParallelArcsStatement`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +universe u + +/-! ## 1. The sphere, the boundary of a disc, and cuffs -/ + +/-- `S` is a *2-sphere*: homeomorphic to the one-point compactification of the plane. Mathlib's +`onePointEquivSphereOfFinrankEq` identifies this space with the unit sphere of $\mathbb{R}^3$. +Graph Minors VII, Section 2 (page 213). -/ +def IsSphere (S : Type u) [TopologicalSpace S] : Prop := + Nonempty (S ≃ₜ OnePoint EuclideanPlane) + +/-- The manifold boundary of a closed disc is the image of the unit circle under every +homeomorphism from the closed unit disc onto it. This is the invariance of the boundary, and it +makes `discBd` the boundary that the papers mean. -/ +def DiscBoundaryStatement : Prop := + ∀ {S : Type u} [TopologicalSpace S] (Δ : Set S) (φ : ClosedUnitDisc ≃ₜ Δ), + discBd Δ = (fun x => (φ x).1) '' {x | x.1 ∈ UnitCircle} + +/-- A surface has finitely many cuffs, and each of them is an `O`-arc. +Graph Minors VI, Section 1 (page 116); Graph Minors VII, Section 2 (page 213): "Every cuff is +homeomorphic to the circle $S^1$." -/ +def CuffStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S], IsSurface S → + IsClosed (bd S) ∧ (cuffs S).Finite ∧ ∀ C ∈ cuffs S, IsOArc C + +/-! ## 2. The Jordan curve theorem and the Schoenflies theorem -/ + +/-- `A` and `B` are the two components of the complement of `F`, and `F` is the frontier of +each. -/ +def IsJordanSplit {S : Type u} [TopologicalSpace S] (F A B : Set S) : Prop := + A ≠ B ∧ componentsIn (univ \ F) = {A, B} ∧ frontier A = F ∧ frontier B = F + +/-- **Jordan curve theorem.** The complement of an `O`-arc `F` in the plane has exactly two +components, one bounded and one unbounded, and `F` is the frontier of each. The complement of an +`O`-arc in a sphere has exactly two components, and `F` is the frontier of each. +Used in Graph Minors VI, Section 3 (pages 119–121), and throughout the later papers. -/ +def JordanCurveStatement : Prop := + (∀ F : Set EuclideanPlane, IsOArc F → + ∃ A B, IsJordanSplit F A B ∧ Bornology.IsBounded A ∧ ¬ Bornology.IsBounded B) ∧ + (∀ (S : Type u) [TopologicalSpace S], IsSphere S → ∀ F : Set S, IsOArc F → + ∃ A B, IsJordanSplit F A B) + +/-- **Schoenflies theorem.** Every homeomorphism from the unit circle onto an `O`-arc of the plane +extends to a homeomorphism of the plane. -/ +def SchoenfliesStatement : Prop := + ∀ (F : Set EuclideanPlane) (f : UnitCircle ≃ₜ F), + ∃ g : EuclideanPlane ≃ₜ EuclideanPlane, ∀ x : UnitCircle, g x.1 = (f x).1 + +/-- An `O`-arc `F` in a sphere is the common boundary of exactly two closed discs. They cover the +sphere, they meet exactly in `F`, and the complement of `F` has the two components `Δ₁ \ F` and +`Δ₂ \ F`. +Graph Minors XI, Section 4 (page 79), treats the sphere separately because of these two sides. -/ +def SphereDiscStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S], IsSphere S → ∀ F : Set S, IsOArc F → + ∃ Δ₁ Δ₂ : Set S, Δ₁ ≠ Δ₂ ∧ IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ + discBd Δ₁ = F ∧ discBd Δ₂ = F ∧ Δ₁ ∪ Δ₂ = univ ∧ Δ₁ ∩ Δ₂ = F ∧ + componentsIn (univ \ F) = {Δ₁ \ F, Δ₂ \ F} ∧ + ∀ Δ : Set S, IsClosedDisc Δ → discBd Δ = F → Δ = Δ₁ ∨ Δ = Δ₂ + +/-! ## 3. Closed discs -/ + +/-- `Δ` is the closed disc inside the `O`-arc `F` of the closed disc `D`: it lies in `D`, its +boundary is `F`, and `Δ \ F` is a component of `D \ F` that misses the boundary of `D`, the only +such component. -/ +def IsInsideDisc {S : Type u} [TopologicalSpace S] (D F Δ : Set S) : Prop := + Δ ⊆ D ∧ IsClosedDisc Δ ∧ discBd Δ = F ∧ + Δ \ F ∈ componentsIn (D \ F) ∧ Disjoint (Δ \ F) (discBd D) ∧ + ∀ C ∈ componentsIn (D \ F), Disjoint C (discBd D) → C = Δ \ F + +/-- Every `O`-arc `F` in a closed disc `D` bounds a closed disc `Δ ⊆ D`, and `Δ` is the only closed +disc in `D` with boundary `F`. Moreover `Δ \ F` is the unique component of `D \ F` disjoint from +`bd D`. The arc `F` may meet `bd D`, or may equal it, and then `Δ = D`. +Graph Minors VI, Section 4 (pages 122–125); Graph Minors XVII, Section 5 (pages 172–173). -/ +def DiscOArcStatement : Prop := + ∀ {S : Type u} [TopologicalSpace S] (D F : Set S), IsClosedDisc D → F ⊆ D → IsOArc F → + ∃ Δ : Set S, IsInsideDisc D F Δ ∧ + ∀ Δ' : Set S, Δ' ⊆ D → IsClosedDisc Δ' → discBd Δ' = F → Δ' = Δ + +/-- Let `F` be a line in the closed disc `D` with distinct ends `s, t` in `bd D` and no other point +in `bd D`. Then `bd D` minus `{s, t}` has two components `A₁, A₂`, and `F` divides `D` into two +closed discs `Δ₁, Δ₂` that meet exactly in `F`, with boundaries `A₁ ∪ F` and `A₂ ∪ F`. The set +`D \ F` has the two components `Δ₁ \ F` and `Δ₂ \ F`. +The two-component fact is used in Graph Minors VII, Section 4 (page 229), and the two-disc +cut appears in the proof of Graph Minors XVII, (5.3) (page 172). The proof in `disc_iArc` uses +the planar cross-cut theorem in a chart. -/ +def DiscIArcStatement : Prop := + ∀ {S : Type u} [TopologicalSpace S] (D F : Set S) (s t : S), IsClosedDisc D → F ⊆ D → + s ≠ t → IsLineWithEnds F s t → F ∩ discBd D = {s, t} → + ∃ A₁ A₂ Δ₁ Δ₂ : Set S, A₁ ≠ A₂ ∧ componentsIn (discBd D \ {s, t}) = {A₁, A₂} ∧ + IsClosedDisc Δ₁ ∧ IsClosedDisc Δ₂ ∧ Δ₁ ∪ Δ₂ = D ∧ Δ₁ ∩ Δ₂ = F ∧ + discBd Δ₁ = A₁ ∪ F ∧ discBd Δ₂ = A₂ ∪ F ∧ + componentsIn (D \ F) = {Δ₁ \ F, Δ₂ \ F} + +/-- Two closed discs that meet exactly in a line `L` of both boundaries have a closed disc as +union. Its boundary consists of the two boundaries without the interior of `L`. +Graph Minors IX, Section 11 (page 67): "the union of $\Delta_0$ with all lawns is a closed disc"; +Graph Minors XI, proof of (6.1) (page 88): "$\Delta = \Delta_1 \cup \Delta_2$ is a closed disc with +$bd(\Delta) = F$." -/ +def DiscUnionStatement : Prop := + ∀ {S : Type u} [TopologicalSpace S] [T2Space S] (Δ₁ Δ₂ L : Set S) (s t : S), + IsClosedDisc Δ₁ → IsClosedDisc Δ₂ → IsLineWithEnds L s t → Δ₁ ∩ Δ₂ = L → + L ⊆ discBd Δ₁ → L ⊆ discBd Δ₂ → + IsClosedDisc (Δ₁ ∪ Δ₂) ∧ discBd (Δ₁ ∪ Δ₂) = (discBd Δ₁ ∪ discBd Δ₂) \ (L \ {s, t}) + +/-- Let `Δ₁ ⊆ Δ₂` be closed discs whose boundaries meet exactly in a line `L`. Then +`closure (Δ₂ \ Δ₁)` is a closed disc. Its boundary consists of the two boundaries without the +interior of `L`, and it meets `Δ₁` exactly in the rest of `bd Δ₁`. +Graph Minors XI, proof of (6.1) (page 88): "If $\Delta_1 \subseteq \Delta_2$ then since +$F_1 \cap F_2 = F'$, it follows that $\Delta = \overline{\Delta_2 - \Delta_1}$ is a closed disc +and $bd(\Delta) = F$." -/ +def DiscDifferenceStatement : Prop := + ∀ {S : Type u} [TopologicalSpace S] [T2Space S] (Δ₁ Δ₂ L : Set S) (s t : S), + IsClosedDisc Δ₁ → IsClosedDisc Δ₂ → Δ₁ ⊆ Δ₂ → IsLineWithEnds L s t → + discBd Δ₁ ∩ discBd Δ₂ = L → + IsClosedDisc (closure (Δ₂ \ Δ₁)) ∧ + discBd (closure (Δ₂ \ Δ₁)) = (discBd Δ₁ ∪ discBd Δ₂) \ (L \ {s, t}) ∧ + closure (Δ₂ \ Δ₁) ∩ Δ₁ = discBd Δ₁ \ (L \ {s, t}) + +/-- Two compact connected sets in a closed disc `D` meet if their ends cross on `bd D`. +Graph Minors VI, Sections 2 and 3; Graph Minors IX, Section 1 (page 41). The sets of the papers +are paths and connected subgraphs of drawings, which are compact. For arbitrary connected sets +the statement fails (see the module docstring). -/ +def DiscCrossingStatement : Prop := + ∀ {S : Type u} [TopologicalSpace S] (D A B : Set S) (a c b d : S), + IsClosedDisc D → A ⊆ D → B ⊆ D → IsCompact A → IsCompact B → + IsConnected A → IsConnected B → a ∈ A → c ∈ A → b ∈ B → d ∈ B → + PairsCrossOn (discBd D) a c b d → (A ∩ B).Nonempty + +/-- `DiscCrossingStatement` for path-connected sets: the ends lie on compact paths inside the two +sets. -/ +theorem DiscCrossingStatement.of_isPathConnected (h : DiscCrossingStatement.{u}) + {S : Type u} [TopologicalSpace S] (D A B : Set S) (a c b d : S) + (hD : IsClosedDisc D) (hA : A ⊆ D) (hB : B ⊆ D) + (hA' : IsPathConnected A) (hB' : IsPathConnected B) + (ha : a ∈ A) (hc : c ∈ A) (hb : b ∈ B) (hd : d ∈ B) + (hcross : PairsCrossOn (discBd D) a c b d) : (A ∩ B).Nonempty := by + obtain ⟨p, hp⟩ := hA'.joinedIn a ha c hc + obtain ⟨q, hq⟩ := hB'.joinedIn b hb d hd + have hprange : range p ⊆ A := by rintro _ ⟨x, rfl⟩; exact hp x + have hqrange : range q ⊆ B := by rintro _ ⟨x, rfl⟩; exact hq x + have hmeet := h D (range p) (range q) a c b d hD (hprange.trans hA) (hqrange.trans hB) + (isCompact_range p.continuous) (isCompact_range q.continuous) + (isConnected_range p.continuous) (isConnected_range q.continuous) + ⟨0, p.source⟩ ⟨1, p.target⟩ ⟨0, q.source⟩ ⟨1, q.target⟩ hcross + exact hmeet.mono (inter_subset_inter hprange hqrange) + +/-! ## 4. The surfaces $\Sigma(a, b, c)$ and their classification -/ + +/-- The centre $(3i, 0)$ of the `i`-th deleted disc of the model surfaces. Any two of the unit +discs around these points are disjoint. -/ +noncomputable def modelCentre (i : ℕ) : EuclideanPlane := + !₂[3 * (i : ℝ), 0] + +/-- The mirror image $(x, -y)$ of $(x, y)$. -/ +noncomputable def modelMirror (u : EuclideanPlane) : EuclideanPlane := + !₂[u 0, -u 1] + +/-- The sphere with the interiors of `n` pairwise disjoint closed discs removed: the points of +the one-point compactification of the plane outside the first `n` open unit discs around the +points `modelCentre i`. -/ +def modelBase (n : ℕ) : Set (OnePoint EuclideanPlane) := + {p | ∀ i < n, ∀ x : EuclideanPlane, p = x → 1 ≤ dist x (modelCentre i)} + +/-- The identifications that add `a` handles and `b` cross-caps to the sphere with holes. The +circles around centres `2i` and `2i + 1` with `i < a` are pasted to each other by the mirror map +(this map reverses the boundary orientation, so the result is a handle). Antipodal points of the +circle around centre `2a + i` with `i < b` are pasted to each other (this is a cross-cap). -/ +inductive ModelGlue (a b n : ℕ) : modelBase n → modelBase n → Prop + | handle (i : ℕ) (hi : i < a) (u : EuclideanPlane) (hu : ‖u‖ = 1) (p q : modelBase n) + (hp : p.1 = ((modelCentre (2 * i) + u : EuclideanPlane) : OnePoint EuclideanPlane)) + (hq : q.1 = ((modelCentre (2 * i + 1) + modelMirror u : EuclideanPlane) : + OnePoint EuclideanPlane)) : ModelGlue a b n p q + | crosscap (i : ℕ) (hi : i < b) (u : EuclideanPlane) (hu : ‖u‖ = 1) (p q : modelBase n) + (hp : p.1 = ((modelCentre (2 * a + i) + u : EuclideanPlane) : OnePoint EuclideanPlane)) + (hq : q.1 = ((modelCentre (2 * a + i) - u : EuclideanPlane) : OnePoint EuclideanPlane)) : + ModelGlue a b n p q + +/-- $\Sigma(a, b, c)$: the surface obtained from a 2-sphere by adding `a` handles and `b` +cross-caps, +and then removing the interiors of `c` pairwise disjoint closed discs. +Graph Minors VII, Section 2 (page 213); Graph Minors VIII, Section 5 (page 262); Graph Minors +XVII, Section 1 (page 163). Here we remove the interiors of `2a + b + c` discs from the sphere, +paste the boundaries of the first `2a + b` of them as in `ModelGlue`, and keep the remaining `c` +as cuffs. This is the model that Graph Minors VI, Section 1 (page 116), describes. -/ +def SurfaceModel (a b c : ℕ) : Type := + Quot (ModelGlue a b (2 * a + b + c)) + +noncomputable instance (a b c : ℕ) : TopologicalSpace (SurfaceModel a b c) := + inferInstanceAs (TopologicalSpace (Quot (ModelGlue a b (2 * a + b + c)))) + +/-- **Classification of surfaces, part (i).** Every connected surface is homeomorphic to +$\Sigma(a, b, c)$ for some $a, b, c$. +Graph Minors VII, Section 2 (page 213); Graph Minors XVII, (1.1)(i) (page 163). -/ +def ClassificationStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S], IsSurface S → ConnectedSpace S → + ∃ a b c : ℕ, Nonempty (S ≃ₜ SurfaceModel a b c) + +/-- **Classification of surfaces, part (ii).** The models are surfaces, and +$\Sigma(a, b, c) \cong \Sigma(a', b', c')$ if and only if $c = c'$, $2a + b = 2a' + b'$, and both or +neither of $b, b'$ are zero. +Graph Minors XVII, (1.1)(ii) (page 163). The printed "$a + 2b = a' + 2b'$" is a slip: page 164 +uses $2a + b$, and $\Sigma(1, 1, 0) \cong \Sigma(0, 3, 0)$ is the classical relation it must allow. +-/ +def ModelCriterionStatement : Prop := + (∀ a b c : ℕ, IsSurface (SurfaceModel a b c) ∧ ConnectedSpace (SurfaceModel a b c)) ∧ + ∀ a b c a' b' c' : ℕ, Nonempty (SurfaceModel a b c ≃ₜ SurfaceModel a' b' c') ↔ + c = c' ∧ 2 * a + b = 2 * a' + b' ∧ (b = 0 ↔ b' = 0) + +/-! ## 5. Cutting along arcs and pasting discs -/ + +/-- `X` is *simpler than* `Y`, for connected surfaces: there are $a \le a'$ and $b \le b'$ with +$X \cong \Sigma(a, b, c)$, $Y \cong \Sigma(a', b', c')$ and $4a + 2b + c < 4a' + 2b' + c'$. +Graph Minors XVII, Section 1 (page 164), second form. + +The paper first gives another condition, on any representations: (i) if $b' = 0$ then $b = 0$; +(ii) $2a + b \le 2a' + b'$; (iii) $4a + 2b + c < 4a' + 2b' + c'$. It calls the two equivalent, but +they are not: $\Sigma(1, 0, 0)$ and $\Sigma(0, 2, 1)$ meet (i) to (iii), and the only representation +of $\Sigma(0, 2, 1)$ with $b' \neq 0$ has $a' = 0$. The proof of (13.4) (page 207) needs that a +graph +drawn in a simpler surface can be drawn in the larger one, and this needs the second form. The first +form follows from the second, by `IsSimplerThan.conditions`. -/ +def IsSimplerThan (X Y : Type*) [TopologicalSpace X] [TopologicalSpace Y] : Prop := + ∃ a b c a' b' c' : ℕ, Nonempty (X ≃ₜ SurfaceModel a b c) ∧ Nonempty (Y ≃ₜ SurfaceModel a' b' c') ∧ + a ≤ a' ∧ b ≤ b' ∧ 4 * a + 2 * b + c < 4 * a' + 2 * b' + c' + +/-- The paper's first form of "simpler" follows from the second. -/ +theorem IsSimplerThan.conditions {X Y : Type*} [TopologicalSpace X] [TopologicalSpace Y] + (h : IsSimplerThan X Y) : + ∃ a b c a' b' c' : ℕ, Nonempty (X ≃ₜ SurfaceModel a b c) ∧ Nonempty + (Y ≃ₜ SurfaceModel a' b' c') ∧ + (b' = 0 → b = 0) ∧ 2 * a + b ≤ 2 * a' + b' ∧ 4 * a + 2 * b + c < 4 * a' + 2 * b' + c' := by + obtain ⟨a, b, c, a', b', c', hX, hY, h1, h2, h3⟩ := h + exact ⟨a, b, c, a', b', c', hX, hY, by omega, by omega, h3⟩ + +/-- The relation "simpler than" on spaces is well-founded. Graph Minors VII, VIII, XVII and XIX +use induction along it. -/ +def SimplerWellFoundedStatement : Prop := + WellFounded fun X Y : (Σ X : Type u, TopologicalSpace X) => + @IsSimplerThan X.1 Y.1 X.2 Y.2 + +/-- `ψ : S' → S` is the surjection associated with cutting `S` along `F`: it is a continuous +surjection, it is injective off `F`, every point of `F` has exactly two preimages, and these +preimages lie in the boundary of `S'`. +Graph Minors VII, Section 2 (page 214): pasting and cutting of arcs; (4.4) and (4.5) use "the +associated surjection". -/ +def IsCutting {S' S : Type u} [TopologicalSpace S'] [TopologicalSpace S] + (ψ : S' → S) (F : Set S) : Prop := + Continuous ψ ∧ Function.Surjective ψ ∧ InjOn ψ (ψ ⁻¹' Fᶜ) ∧ + (∀ x ∈ F, (ψ ⁻¹' {x}).ncard = 2) ∧ ψ ⁻¹' F ⊆ bd S' + +/-- The set of components of a space, as subsets. -/ +noncomputable def spaceComponents (S : Type u) [TopologicalSpace S] : Set (Set S) := + componentsIn univ + +/-- Every component of `S'` is simpler than `S`, and `S'` has one or two components. These are the +cases "(i) a connected surface simpler than $\Sigma$" and "(ii) a surface with two components, both +simpler than $\Sigma$" of Graph Minors XVII, Section 1 (page 164). -/ +def CutIsSimpler (S' S : Type u) [TopologicalSpace S'] [TopologicalSpace S] : Prop := + (spaceComponents S').encard ≤ 2 ∧ ∀ C ∈ spaceComponents S', IsSimplerThan C S + +/-- `S'` has exactly two components, one of them a closed disc. -/ +def CutHasDisc (S' : Type u) [TopologicalSpace S'] : Prop := + ∃ C₁ C₂ : Set S', C₁ ≠ C₂ ∧ spaceComponents S' = {C₁, C₂} ∧ IsClosedDisc C₁ + +/-- `S'` has exactly two components, one homeomorphic to `X` and the other homeomorphic to `S`. -/ +def CutHasCopy (S' S X : Type*) [TopologicalSpace S'] [TopologicalSpace S] + [TopologicalSpace X] : Prop := + ∃ C₁ C₂ : Set S', C₁ ≠ C₂ ∧ spaceComponents S' = {C₁, C₂} ∧ + Nonempty (C₁ ≃ₜ X) ∧ Nonempty (C₂ ≃ₜ S) + +/-- Cutting along an `I`-arc. Let `F` be a proper `I`-arc with ends `s, t` of a connected surface +`S`. Cutting along `F` gives a surface `S'`. If the ends lie in different cuffs, then `S'` is +connected with one cuff fewer. If they lie in the same cuff, then `S'` is either (i) connected and +simpler than `S`, (ii) two components, both simpler than `S`, or (iii) two components, one a +closed disc and the other homeomorphic to `S`. The preimage of `F` is two disjoint lines `X, Y` in +the boundary of `S'`, and `S` arises from `S'` by pasting them (these are the arcs $X, Y$ of the +proof of Graph Minors VII, (3.1), page 218). +Graph Minors XVII, Section 1 (page 164). -/ +def CutIArcStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S] (F : Set S) (s t : S), IsSurface S → ConnectedSpace S → + s ≠ t → F ∩ bd S = {s, t} → IsLineWithEnds F s t → + ∃ (S' : Type u) (_ : TopologicalSpace S') (ψ : S' → S), IsSurface S' ∧ IsCutting ψ F ∧ + (connectedComponentIn (bd S) s ≠ connectedComponentIn (bd S) t → + ConnectedSpace S' ∧ ∃ a b c : ℕ, Nonempty (S ≃ₜ SurfaceModel a b (c + 1)) ∧ + Nonempty (S' ≃ₜ SurfaceModel a b c)) ∧ + (connectedComponentIn (bd S) s = connectedComponentIn (bd S) t → + CutIsSimpler S' S ∨ CutHasCopy S' S ClosedUnitDisc) ∧ + ∃ X Y : Set S', Disjoint X Y ∧ X ∪ Y = ψ ⁻¹' F ∧ IsLine X ∧ IsLine Y ∧ + BijOn ψ X F ∧ BijOn ψ Y F + +/-- Cutting along an `O`-arc. Let `F` be an `O`-arc disjoint from the boundary of a connected +surface `S`. Cutting along `F` gives a surface `S'` that is either (i) connected and simpler than +`S`, (ii) two components, both simpler than `S`, (iii) two components, one a cylinder and the other +homeomorphic to `S`, or (iv) two components, one a closed disc. The preimage of `F` is two disjoint +`O`-arcs that `ψ` maps bijectively onto `F` (if `F` is two-sided), or one `O`-arc (if `F` is +one-sided). +Graph Minors XVII, Section 1 (page 164). -/ +def CutOArcStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S] (F : Set S), IsSurface S → ConnectedSpace S → + IsOArc F → Disjoint F (bd S) → + ∃ (S' : Type u) (_ : TopologicalSpace S') (ψ : S' → S), IsSurface S' ∧ IsCutting ψ F ∧ + (CutIsSimpler S' S ∨ CutHasCopy S' S ClosedCylinder ∨ CutHasDisc S') ∧ + ((∃ X Y : Set S', Disjoint X Y ∧ X ∪ Y = ψ ⁻¹' F ∧ IsOArc X ∧ IsOArc Y ∧ + BijOn ψ X F ∧ BijOn ψ Y F) ∨ IsOArc (ψ ⁻¹' F)) + +/-- Pasting a closed disc onto a cuff `C` of `S` gives a surface `S'`: `S` embeds in `S'` as a +closed set, and the rest of `S'` is the interior of a closed disc `Δ` with +$\Delta \cap S = \operatorname{bd}(\Delta) = C$. Its boundary is `bd S` without `C`. +Graph Minors VII, Section 4 (page 224); Graph Minors VIII, Section 18 (page 285); Graph Minors +XIX, Section 2 (page 327). -/ +def PasteDiscStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S] (C : Set S), IsSurface S → IsCuff C → + ∃ (S' : Type u) (_ : TopologicalSpace S') (ι : S → S') (Δ : Set S'), + IsSurface S' ∧ IsClosedEmbedding ι ∧ IsClosedDisc Δ ∧ range ι ∪ Δ = univ ∧ + range ι ∩ Δ = ι '' C ∧ discBd Δ = ι '' C ∧ bd S' = ι '' (bd S \ C) + +/-! ## 6. Null-homotopic `O`-arcs -/ + +/-- **Disc bounding for null-homotopic curves.** Let `S` be a connected surface, and let +`F ⊆ Z` be an `O`-arc disjoint from `bd S`. Then `F` is null-homotopic in `Z` if and only if +`F` bounds a closed disc included in `Z`. This is equivalent to `F` lying inside a closed disc +included in `Z`. If `S` is +not a sphere, a closed disc bounded by `F` is unique. +Graph Minors VII, Section 2, page 214, cites H. I. Levine, *Homotopic curves on surfaces*, for +disc bounding in the ambient surface. Graph Minors XI (7.1) quotes the ambient result from +D. B. A. Epstein, *Curves on 2-manifolds and isotopies*, Acta Math. 115 (1966) 83–107, Theorem 1.7. +Robertson and Seymour's XI (7.2), page 93, gives disc containment in the subset `Z`. -/ +def EpsteinStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S] (Z F : Set S), IsSurface S → ConnectedSpace S → + IsOArc F → F ⊆ Z → Disjoint F (bd S) → + (IsNullHomotopicOArcIn Z F → ∃ Δ : Set S, Δ ⊆ Z ∧ IsClosedDisc Δ ∧ discBd Δ = F) ∧ + ((∃ Δ : Set S, Δ ⊆ Z ∧ IsClosedDisc Δ ∧ F ⊆ Δ) → IsNullHomotopicOArcIn Z F) ∧ + (∀ Δ₁ Δ₂ : Set S, IsClosedDisc Δ₁ → IsClosedDisc Δ₂ → discBd Δ₁ = F → discBd Δ₂ = F → + ¬ IsSphere S → Δ₁ = Δ₂) + +/-- Graph Minors VII, (4.2) (page 222): "Let $\Sigma$ be a connected surface with +$bd(\Sigma) = \emptyset$, and let $Y \subseteq \Sigma$ be connected and open. Suppose that every +$O$-arc included in $Y$ bounds a disc included in $Y$. Then either $\Sigma$ is a sphere and +$Y = \Sigma$, or $Y$ is an open disc." -/ +def OpenDiscStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S] (Y : Set S), IsClosedSurface S → ConnectedSpace S → + IsConnected Y → IsOpen Y → + (∀ F : Set S, F ⊆ Y → IsOArc F → ∃ Δ : Set S, Δ ⊆ Y ∧ IsClosedDisc Δ ∧ discBd Δ = F) → + (IsSphere S ∧ Y = univ) ∨ IsOpenDisc Y + +/-! ## 7. Moving points and arcs by homeomorphisms -/ + +/-- A homeomorphism of the circle *preserves orientation* if it lifts to an increasing continuous +map of the real line. -/ +def PreservesCircleOrientation (h : Circle ≃ₜ Circle) : Prop := + ∃ l : ℝ → ℝ, Continuous l ∧ StrictMono l ∧ ∀ t : ℝ, h (Circle.exp t) = Circle.exp (l t) + +/-- Let `C` be a cuff of a surface `S` with arc-map `φ`, and let `h` be an orientation-preserving +homeomorphism of the circle. Then the homeomorphism $\varphi h \varphi^{-1}$ of `C` extends to a +homeomorphism of `S` that is the identity outside any given open set `U ⊇ C`, so in particular on +all other cuffs. This moves finite sets of boundary points in the same circular order onto each +other. +Graph Minors VII, Section 3 (pages 218–221); Graph Minors XIX, Section 3 (page 330) and proof of +(2.1) ("replacing each $\Gamma_i$ by its image under a suitable homeomorphism"). -/ +def MoveCuffStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S] (C U : Set S) (φ : Circle ≃ₜ C) (h : Circle ≃ₜ Circle), + IsSurface S → IsCuff C → IsOpen U → C ⊆ U → PreservesCircleOrientation h → + ∃ α : S ≃ₜ S, (∀ x : Circle, α (φ x).1 = (φ (h x)).1) ∧ ∀ x ∉ U, α x = x + +/-- `α` maps every cuff to itself, preserving its orientation. This is the "null signature" of +Graph Minors VII, (3.2) (page 219). -/ +def HasNullSignature {S : Type u} [TopologicalSpace S] (α : S ≃ₜ S) : Prop := + ∀ (C : Set S) (φ : Circle ≃ₜ C), C ∈ cuffs S → + ∃ h : Circle ≃ₜ Circle, PreservesCircleOrientation h ∧ ∀ x, α (φ x).1 = (φ (h x)).1 + +/-- Graph Minors VII, (3.2), claim (1) (page 219): if `F, F'` are proper `I`-arcs with the same +ends `s, t`, and a homeomorphism `α` with null signature maps `F` to `F'` and fixes `s` and `t`, +then `F` and `F'` are parallel: a homeomorphism fixing `bd S` pointwise maps `F` to `F'`. + +The paper does not ask that `α` fixes the ends. This is needed: take an annulus with `s, t` +antipodal on one cuff, and two arcs with these ends on the two sides of the hole. A rotation by a +half turn swaps them and has null signature, yet each arc cuts off a different part of the cuff. -/ +def ParallelArcsStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S] (F F' : Set S) (s t : S) (α : S ≃ₜ S), IsSurface S → + s ≠ t → F ∩ bd S = {s, t} → F' ∩ bd S = {s, t} → IsLineWithEnds F s t → IsLineWithEnds F' s t → + α '' F = F' → α s = s → α t = t → HasNullSignature α → + ∃ β : S ≃ₜ S, β '' F = F' ∧ ∀ x ∈ bd S, β x = x + +/-- Graph Minors VII, (3.1) (page 218): a surface has only finitely many similarity classes of +proper `I`-arcs, where two arcs are similar if a homeomorphism of the surface maps one to the +other. The paper's proof reduces this to the classification and to cutting along the arc. -/ +def SimilarArcsFiniteStatement : Prop := + ∀ (S : Type u) [TopologicalSpace S], IsSurface S → + ∃ 𝓕 : Set (Set S), 𝓕.Finite ∧ ∀ F : Set S, IsProperIArc F → + ∃ F₀ ∈ 𝓕, ∃ α : S ≃ₜ S, α '' F₀ = F + +/-- The step that makes a disc narrow, as a statement on surfaces: an `O`-arc that misses the chords +of +some discs can be pushed off these discs by a homeomorphism of the surface that fixes the nodes. +Here the +discs `D i` meet each other and the closed set `Z` only in the finite set `N`, and each disc has +exactly +two points in `N`, on its boundary. The line `L i` joins these two points. Either it runs through +the +interior of `D i`, and then `D i` meets `bd(Σ)` only in `N`, or it is `D i ∩ bd(Σ)`. + +This is the content of the paper's "make the discs narrow" (Graph Minors XX, Section 8, page 348). +-/ +def PushOffStatement : Prop := + ∀ (S : Type) [TopologicalSpace S], IsSurface S → ∀ (ι : Type) [Finite ι] (N Z : Set S) + (D L : ι → Set S), N.Finite → IsClosed Z → (∀ i, IsClosedDisc (D i)) → + (∀ i, ∃ a b, IsLineWithEnds (L i) a b ∧ D i ∩ N = {a, b} ∧ a ∈ discBd (D i) ∧ + b ∈ discBd (D i) ∧ L i ⊆ D i ∧ + ((L i \ {a, b} ⊆ D i \ discBd (D i) ∧ D i ∩ bd S ⊆ N) ∨ L i = D i ∩ bd S)) → + (∀ i j, i ≠ j → D i ∩ D j ⊆ N) → (∀ i, D i ∩ Z ⊆ N) → + ∀ F : Set S, IsOArc F → F ∩ Z ⊆ N → (∀ i, F ∩ L i ⊆ N) → + ∃ h : S ≃ₜ S, (∀ n ∈ N, h n = n) ∧ (h '' F) ∩ Z ⊆ N ∧ ∀ i, (h '' F) ∩ D i ⊆ N + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/TriCoh.lean b/LeanPool/GraphMinor/Surface/TriCoh.lean new file mode 100644 index 0000000000..6ff912db1e --- /dev/null +++ b/LeanPool/GraphMinor/Surface/TriCoh.lean @@ -0,0 +1,415 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.TriLocal +public import LeanPool.GraphMinor.Surface.TriCount +public import LeanPool.GraphMinor.Surface.LocalCoh +public import Mathlib.Topology.LocallyConstant.Basic + +/-! +# The cohomology of a triangulation + +For a triangulation of a connected closed surface we compare the classes of local cocycles with +values in the field with two elements (`KCl`) to the cocycles of the triangulation modulo +coboundaries. This gives `|V| - |E| + |F| + κ = 2`, where `2 ^ κ` is the number of classes +(`euler_eq`). The classification of surfaces gives the value of `κ` on each surface, so the number +`|V| - |E| + |F|` depends only on the surface. This is the Euler characteristic used in the proof of +Graph Minors XIX, (6.5) (page 341). + +A local cocycle has a primitive on each face (`exists_prim_disc`). The primitives on two faces +differ by a constant on a common edge, so the differences of the primitive at the two ends of an +edge define a cocycle of the triangulation. In the other direction, a cocycle `y` of the +triangulation gives a local cocycle through a map `s` from the surface to the vertices with `x` in +the open star of `s x`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter Matrix + +local notation "K" => ZMod 2 + +section Primitive + +universe u + +variable {X : Type u} [TopologicalSpace X] + +/-- A primitive of `φ` on the set `Φ`. -/ +def Prim (φ : X → X → K) (Φ : Set X) (g : X → K) : Prop := + ∀ p ∈ Φ, ∃ W ∈ 𝓝 p, ∀ x ∈ W ∩ Φ, ∀ x' ∈ W ∩ Φ, φ x x' = g x + g x' + +theorem exists_prim_disc {φ : X → X → K} (hφ : IsCoc φ) {Φ : Set X} (hD : IsClosedDisc Φ) : ∃ g, + Prim φ Φ g := by + obtain ⟨k, l, c⟩ := hD.exists_isChart + obtain ⟨G, ε, hε, hG⟩ := exists_prim hφ c.gc + refine ⟨G ∘ k, fun p hp => ?_⟩ + have hk : ContinuousWithinAt k Φ p := c.hc p hp + have h1 : k ⁻¹' ball (k p) (ε / 2) ∈ 𝓝[Φ] p := hk.preimage_mem_nhdsWithin (ball_mem_nhds _ + (by positivity)) + obtain ⟨W, hW, hWs⟩ := mem_nhdsWithin_iff_exists_mem_nhds_inter.mp h1 + refine ⟨W, hW, fun x hx x' hx' => ?_⟩ + have h2 := hG (k x) (c.hm hx.2) (k x') (c.hm hx'.2) (by + have h3 : k x ∈ ball (k p) (ε / 2) := hWs hx + have h4 : k x' ∈ ball (k p) (ε / 2) := hWs hx' + rw [mem_ball, dist_eq_norm] at h3 h4 + have h5 : ‖k x - k x'‖ ≤ ‖k x - k p‖ + ‖k x' - k p‖ := by + have : k x - k x' = (k x - k p) - (k x' - k p) := by ring + rw [this] + exact norm_sub_le _ _ + linarith) + rw [c.gh hx.2, c.gh hx'.2] at h2 + rw [h2, CharTwo.neg_eq] + rfl + +theorem Prim.mono {φ : X → X → K} {Φ Ψ : Set X} {g : X → K} (h : Prim φ Φ g) + (hs : Ψ ⊆ Φ) : Prim φ Ψ g := fun p hp => by + obtain ⟨W, hW, h1⟩ := h p (hs hp) + exact ⟨W, hW, fun x hx x' hx' => h1 x ⟨hx.1, hs hx.2⟩ x' ⟨hx'.1, hs hx'.2⟩⟩ + +theorem Prim.add {φ φ' : X → X → K} {Φ : Set X} {g g' : X → K} (h : Prim φ Φ g) + (h' : Prim φ' Φ g') : + Prim (fun x y => φ x y + φ' x y) Φ (fun x => g x + g' x) := fun p hp => by + obtain ⟨W, hW, h1⟩ := h p hp + obtain ⟨W', hW', h2⟩ := h' p hp + refine ⟨W ∩ W', inter_mem hW hW', fun x hx x' hx' => ?_⟩ + change φ x x' + φ' x x' = (g x + g' x) + (g x' + g' x') + rw [h1 x ⟨hx.1.1, hx.2⟩ x' ⟨hx'.1.1, hx'.2⟩, h2 x ⟨hx.1.2, hx.2⟩ x' ⟨hx'.1.2, hx'.2⟩] + ring + +/-- A function that is locally constant on a preconnected set is constant. -/ +theorem const_of_locally {C : Set X} (hC : IsPreconnected C) {u : X → K} + (h : ∀ p ∈ C, ∃ W ∈ 𝓝 p, ∀ x ∈ W ∩ C, u x = u p) + {a b : X} (ha : a ∈ C) (hb : b ∈ C) : u a = u b := by + have hp : PreconnectedSpace C := isPreconnected_iff_preconnectedSpace.mp hC + let f : C → K := fun x => u x + have hf : IsLocallyConstant f := by + rw [IsLocallyConstant.iff_eventually_eq] + intro x + obtain ⟨W, hW, h1⟩ := h x.1 x.2 + have h2 : Subtype.val ⁻¹' W ∈ 𝓝 x := continuous_subtype_val.continuousAt.preimage_mem_nhds hW + exact Filter.mem_of_superset h2 fun y hy => h1 y.1 ⟨hy, y.2⟩ + exact hf.apply_eq_of_preconnectedSpace ⟨a, ha⟩ ⟨b, hb⟩ + +/-- Two primitives of the same `φ` differ by a constant on a preconnected common subset. -/ +theorem Prim.const {φ : X → X → K} {Φ Φ' C : Set X} {g g' : X → K} (h : Prim φ Φ g) + (h' : Prim φ Φ' g') (hC : IsPreconnected C) + (hs : C ⊆ Φ) (hs' : C ⊆ Φ') {a b : X} (ha : a ∈ C) (hb : b ∈ C) : g a + g' a = g b + g' b := by + refine const_of_locally hC (u := fun x => g x + g' x) (fun p hp => ?_) ha hb + obtain ⟨W, hW, h1⟩ := h p (hs hp) + obtain ⟨W', hW', h2⟩ := h' p (hs' hp) + refine ⟨W ∩ W', inter_mem hW hW', fun x hx => ?_⟩ + have h3 := h1 p ⟨mem_of_mem_nhds hW, hs hp⟩ x ⟨hx.1.1, hs hx.2⟩ + have h4 := h2 p ⟨mem_of_mem_nhds hW', hs' hp⟩ x ⟨hx.1.2, hs' hx.2⟩ + have h5 := h3.symm.trans h4 + have h6 : g x + g' x + (g p + g' p) = (g p + g x) + (g' p + g' x) := by ring + have h7 : g x + g' x + (g p + g' p) = 0 := by + rw [h6, h5] + exact CharTwo.add_self_eq_zero _ + exact CharTwo.add_eq_zero.mp h7 + +end Primitive + +variable {X : Type} [TopologicalSpace X] + +variable [T2Space X] + +/-- Pull back a set to a subtype and count the elements in the intersection. -/ +theorem ncard_val_preimage {α : Type*} (V A : Set α) : + ({v : V | v.1 ∈ A}).ncard = (A ∩ V).ncard := + Set.ncard_subtype (· ∈ V) A + +namespace IsTriang + +variable {V : Set X} {E 𝓕 : Set (Set X)} + +/-- The combinatorics of a triangulation. -/ +noncomputable def cx (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) [ConnectedSpace X] : TriCx V E 𝓕 + where + ends e := {v | v.1 ∈ e.1} + verts Φ := {v | v.1 ∈ Φ.1} + ends_two e := by + rw [ncard_val_preimage] + exact h.ends_ncard e.2 + ends_inj e f hef := by + have hef' : {v : V | v.1 ∈ e.1} = {v : V | v.1 ∈ f.1} := hef + refine Subtype.ext (h.simple e.1 e.2 f.1 f.2 ?_) + ext x + constructor + · intro hx + have : (⟨x, hx.2⟩ : V) ∈ {v : V | v.1 ∈ f.1} := hef' ▸ (hx.1 : (⟨x, hx.2⟩ : V).1 ∈ e.1) + exact ⟨this, hx.2⟩ + · intro hx + have : (⟨x, hx.2⟩ : V) ∈ {v : V | v.1 ∈ e.1} := hef' ▸ (hx.1 : (⟨x, hx.2⟩ : V).1 ∈ f.1) + exact ⟨this, hx.2⟩ + verts_three Φ := by + rw [ncard_val_preimage] + exact h.three Φ.1 Φ.2 + pair Φ a ha b hb hab := by + obtain ⟨e, he, -, hi⟩ := h.face_pair Φ.2 ⟨ha, a.2⟩ ⟨hb, b.2⟩ (fun h' => hab (Subtype.ext h')) + refine ⟨⟨e, he⟩, ?_⟩ + ext v + have h1 : v.1 ∈ e ∩ V ↔ v.1 ∈ ({a.1, b.1} : Set X) := by rw [hi] + constructor + · intro hv + rcases h1.mp ⟨hv, v.2⟩ with h2 | h2 + · exact .inl (Subtype.ext h2) + · exact .inr (Subtype.ext h2) + · rintro (rfl | rfl) + · exact (h1.mpr (.inl rfl)).1 + · exact (h1.mpr (.inr rfl)).1 + two e := by + have h1 := h.two_faces hT e.2 + have h2 : Subtype.val '' {Φ : 𝓕 | ({v : V | v.1 ∈ e.1} : Set V) ⊆ {v | v.1 ∈ Φ.1}} + = {Φ ∈ 𝓕 | e.1 ⊆ Φ} := by + ext Φ + constructor + · rintro ⟨Φ', hΦ', rfl⟩ + refine ⟨Φ'.2, (h.sub_iff e.2 Φ'.2).mpr fun y hy => ?_⟩ + exact hΦ' (show (⟨y, hy.2⟩ : V).1 ∈ e.1 from hy.1) + · rintro ⟨hΦ, h3⟩ + exact ⟨⟨Φ, hΦ⟩, fun v hv => h3 hv, rfl⟩ + rw [← h1, ← h2, ncard_image_of_injective _ Subtype.val_injective] + conn S hS hne := by + have h1 := h.graph_conn (S := Subtype.val '' S) (fun e he a ha b hb has => by + obtain ⟨a', ha', rfl⟩ := has + exact ⟨⟨b, hb.2⟩, hS ⟨e, he⟩ a' ha.1 ⟨b, hb.2⟩ hb.1 ha', rfl⟩) (by + obtain ⟨v, hv⟩ := hne + exact ⟨v.1, ⟨v, hv, rfl⟩, v.2⟩) + rw [eq_univ_iff_forall] + intro v + obtain ⟨v', hv', h2⟩ := h1 v.2 + rwa [show v = v' from (Subtype.ext h2).symm] + dual S hS hne := by + have h1 := h.dual_conn hT (𝓐 := Subtype.val '' S) (by + rintro _ ⟨Φ, -, rfl⟩ + exact Φ.2) (fun e he Φ hΦ Φ' hΦ' h2 h3 => by + obtain ⟨Φ₀, hΦ₀, rfl⟩ := hΦ + exact ⟨⟨Φ', hΦ'⟩, hS ⟨e, he⟩ Φ₀ hΦ₀ ⟨Φ', hΦ'⟩ (fun v hv => h2 hv) (fun v hv => h3 hv), + rfl⟩) (hne.image _) + rw [eq_univ_iff_forall] + intro Φ + obtain ⟨Φ', hΦ', h2⟩ : Φ.1 ∈ Subtype.val '' S := by + rw [h1] + exact Φ.2 + rwa [show Φ = Φ' from (Subtype.ext h2).symm] + link w S hS hcl hne Φ' hw := by + have h1 := h.link_conn hT w.2 (𝓐 := Subtype.val '' S) (by + rintro _ ⟨Φ, -, rfl⟩ + exact Φ.2) (by + rintro _ ⟨Φ, hΦ, rfl⟩ + exact hS Φ hΦ) (fun e he hwe Φ hΦ Φ₂ hΦ₂ h2 h3 => by + obtain ⟨Φ₀, hΦ₀, rfl⟩ := hΦ + exact ⟨⟨Φ₂, hΦ₂⟩, hcl ⟨e, he⟩ hwe Φ₀ hΦ₀ ⟨Φ₂, hΦ₂⟩ (fun v hv => h2 hv) (fun v hv => h3 hv), + rfl⟩) (hne.image _) Φ'.2 hw + obtain ⟨Φ₂, hΦ₂, h2⟩ := h1 + rwa [show Φ' = Φ₂ from (Subtype.ext h2).symm] + +theorem cx_I (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) [ConnectedSpace X] (e : E) (Φ : 𝓕) : + (h.cx hT).I e Φ ↔ e.1 ⊆ Φ.1 := by + constructor + · intro h1 + refine (h.sub_iff e.2 Φ.2).mpr fun y hy => ?_ + exact h1 (show (⟨y, hy.2⟩ : V).1 ∈ e.1 from hy.1) + · exact fun h1 v hv => h1 hv + +variable [Fintype V] [Fintype E] [Fintype 𝓕] + +/-- The function `y` on the edges records the primitives of `φ` on the faces. -/ +def Rep (V : Set X) (E 𝓕 : Set (Set X)) (φ : X → X → K) (y : E → K) : Prop := + ∃ g : Set X → X → K, (∀ Φ ∈ 𝓕, Prim φ Φ (g Φ)) ∧ + ∀ e : E, ∀ Φ ∈ 𝓕, e.1 ⊆ Φ → ∀ a ∈ e.1 ∩ V, ∀ b ∈ e.1 ∩ V, a ≠ b → y e = g Φ a + g Φ b + +theorem zero3 (a b c : K) : (a + b) + (b + c) + (a + c) = 0 := by + revert a b c + decide + +omit [T2Space X] [Fintype ↑V] [Fintype ↑E] [Fintype ↑𝓕] in +theorem exists_face (h : IsTriang V E 𝓕) (y : X) : ∃ Φ ∈ 𝓕, y ∈ Φ := by + have : y ∈ ⋃₀ 𝓕 := h.dis.cover ▸ mem_univ y + exact this + +omit [T2Space X] [Fintype ↑V] [Fintype ↑E] [Fintype ↑𝓕] in +theorem isPreconnected_edge (h : IsTriang V E 𝓕) {e : Set X} (he : e ∈ E) : IsPreconnected e := by + obtain ⟨u, v, -, hl, -⟩ := h.dis.graph.edge e he + obtain ⟨a, ha, hr, -, -⟩ := hl.exists_arc + rw [← hr] + exact isPreconnected_range ha.1 + +omit [Fintype ↑V] [Fintype ↑E] [Fintype ↑𝓕] in +/-- The three edges of a face. -/ +theorem exists_three_edges (h : IsTriang V E 𝓕) {Φ : Set X} (hΦ : Φ ∈ 𝓕) {a b c : X} + (ha : a ∈ Φ ∩ V) (hb : b ∈ Φ ∩ V) + (hc : c ∈ Φ ∩ V) (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) : + ∃ e₁ ∈ E, ∃ e₂ ∈ E, ∃ e₃ ∈ E, e₁ ⊆ Φ ∧ e₂ ⊆ Φ ∧ e₃ ⊆ Φ ∧ e₁ ∩ V = {a, b} ∧ e₂ ∩ V = {b, c} + ∧ e₃ ∩ V = {a, c} ∧ + e₁ ≠ e₂ ∧ e₁ ≠ e₃ ∧ e₂ ≠ e₃ := by + obtain ⟨e₁, h1, h1s, h1i⟩ := h.face_pair hΦ ha hb hab + obtain ⟨e₂, h2, h2s, h2i⟩ := h.face_pair hΦ hb hc hbc + obtain ⟨e₃, h3, h3s, h3i⟩ := h.face_pair hΦ ha hc hac + refine ⟨e₁, h1, e₂, h2, e₃, h3, h1s.trans (discBd_subset Φ), h2s.trans (discBd_subset Φ), + h3s.trans (discBd_subset Φ), + h1i, h2i, h3i, ?_, ?_, ?_⟩ + · rintro rfl + have : a ∈ ({b, c} : Set X) := h2i ▸ h1i ▸ (Or.inl rfl : a ∈ ({a, b} : Set X)) + rcases this with h4 | h4 + · exact hab h4 + · exact hac h4 + · rintro rfl + have : c ∈ ({a, b} : Set X) := h1i ▸ h3i ▸ (Or.inr rfl : c ∈ ({a, c} : Set X)) + rcases this with h4 | h4 + · exact hac h4.symm + · exact hbc h4.symm + · rintro rfl + have : a ∈ ({b, c} : Set X) := h2i ▸ h3i ▸ (Or.inl rfl : a ∈ ({a, c} : Set X)) + rcases this with h4 | h4 + · exact hab h4 + · exact hac h4 + +omit [T2Space X] [Fintype ↑V] [Fintype ↑E] [Fintype ↑𝓕] in +/-- Three names for the vertices of a face. -/ +theorem exists_verts (h : IsTriang V E 𝓕) {Φ : Set X} (hΦ : Φ ∈ 𝓕) : + ∃ a b c, a ≠ b ∧ a ≠ c ∧ b ≠ c ∧ Φ ∩ V = {a, b, c} := by + obtain ⟨a, b, c, h1, h2, h3, h4⟩ := ncard_eq_three.mp (h.three Φ hΦ) + exact ⟨a, b, c, h1, h2, h3, h4⟩ + +omit [Fintype ↑V] [Fintype ↑𝓕] in +/-- **Each local cocycle gives a cocycle of the triangulation.** -/ +theorem exists_rep (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) [ConnectedSpace X] {φ : X → X → K} + (hφ : IsCoc φ) : + ∃ y : E → K, (h.cx hT).M.mulVec y = 0 ∧ Rep V E 𝓕 φ y := by + classical + have : Finite V := h.dis.graph.fin.to_subtype + have : Finite 𝓕 := h.dis.fin.to_subtype + have hch : ∀ Φ : Set X, ∃ g, Φ ∈ 𝓕 → Prim φ Φ g := fun Φ => by + by_cases hΦ : Φ ∈ 𝓕 + · obtain ⟨g, hg⟩ := exists_prim_disc hφ (h.dis.disc Φ hΦ) + exact ⟨g, fun _ => hg⟩ + · exact ⟨0, fun h' => absurd h' hΦ⟩ + choose g hg using hch + have agree : ∀ e ∈ E, ∀ Φ ∈ 𝓕, ∀ Φ' ∈ 𝓕, e ⊆ Φ → e ⊆ Φ' → ∀ a ∈ e, ∀ b ∈ e, g Φ a + g Φ b + = g Φ' a + g Φ' b := + fun e he Φ hΦ Φ' hΦ' h1 h2 a ha b hb => by + have h3 := (hg Φ hΦ).const (hg Φ' hΦ') (h.isPreconnected_edge he) h1 h2 ha hb + have h4 : g Φ a + g Φ b + (g Φ' a + g Φ' b) = (g Φ a + g Φ' a) + (g Φ b + g Φ' b) := by ring + refine CharTwo.add_eq_zero.mp ?_ + rw [h4, h3] + exact CharTwo.add_self_eq_zero _ + have hdata : ∀ e : E, ∃ (Φ : Set X) (u v : X), Φ ∈ 𝓕 ∧ e.1 ⊆ Φ ∧ u ≠ v ∧ e.1 ∩ V = {u, v} + := fun e => by + obtain ⟨u, v, huv, -, hi⟩ := h.dis.graph.edge e.1 e.2 + obtain ⟨x, hxe, hxV⟩ := h.exists_inner e.2 + obtain ⟨Φ, hΦ, hx⟩ := h.exists_face x + exact ⟨Φ, u, v, hΦ, (h.edge_sub e.2 hΦ hxe hxV hx).trans (discBd_subset Φ), huv, hi⟩ + choose Φ₀ u₀ v₀ hΦ₀ hsub₀ hne₀ hi₀ using hdata + let y : E → K := fun e => g (Φ₀ e) (u₀ e) + g (Φ₀ e) (v₀ e) + have hrep : ∀ e : E, ∀ Φ ∈ 𝓕, e.1 ⊆ Φ → ∀ a ∈ e.1 ∩ V, ∀ b ∈ e.1 ∩ V, a ≠ b → y e = g Φ a + g Φ b + := by + intro e Φ hΦ hs a ha b hb hab + have hu : u₀ e ∈ e.1 ∩ V := hi₀ e ▸ Or.inl rfl + have hv : v₀ e ∈ e.1 ∩ V := hi₀ e ▸ Or.inr rfl + have h1 : y e = g Φ (u₀ e) + g Φ (v₀ e) := agree e.1 e.2 _ (hΦ₀ e) Φ hΦ + (hsub₀ e) hs _ hu.1 _ hv.1 + rw [h1] + have ha' : a ∈ ({u₀ e, v₀ e} : Set X) := hi₀ e ▸ ha + have hb' : b ∈ ({u₀ e, v₀ e} : Set X) := hi₀ e ▸ hb + rcases ha' with h2 | h2 <;> rcases hb' with h3 | h3 + · exact absurd (h2.trans h3.symm) hab + · rw [h2, h3] + · rw [h2, h3, add_comm] + · exact absurd (h2.trans h3.symm) hab + refine ⟨y, ?_, g, hg, hrep⟩ + funext Φ + obtain ⟨a, b, c, hab, hac, hbc, hE⟩ := h.exists_verts Φ.2 + have ha : a ∈ Φ.1 ∩ V := hE ▸ Or.inl rfl + have hb : b ∈ Φ.1 ∩ V := hE ▸ Or.inr (Or.inl rfl) + have hc : c ∈ Φ.1 ∩ V := hE ▸ Or.inr (Or.inr rfl) + obtain ⟨e₁, h1, e₂, h2, e₃, h3, s1, s2, s3, i1, i2, i3, n12, n13, n23⟩ + := h.exists_three_edges Φ.2 ha hb hc hab hac hbc + have hn : ∀ {e f : Set X} (he : e ∈ E) (hf : f ∈ E), e ≠ f → (⟨e, he⟩ : E) ≠ ⟨f, hf⟩ + := fun _ _ hn h' => hn (congrArg Subtype.val h') + rw [(h.cx hT).sum_three y Φ ((h.cx_I hT ⟨e₁, h1⟩ Φ).mpr s1) ((h.cx_I hT ⟨e₂, h2⟩ Φ).mpr s2) + ((h.cx_I hT ⟨e₃, h3⟩ Φ).mpr s3) (hn _ _ n12) (hn _ _ n13) (hn _ _ n23)] + rw [hrep ⟨e₁, h1⟩ Φ Φ.2 s1 a (i1 ▸ Or.inl rfl) b (i1 ▸ Or.inr rfl) hab, + hrep ⟨e₂, h2⟩ Φ Φ.2 s2 b (i2 ▸ Or.inl rfl) c (i2 ▸ Or.inr rfl) hbc, + hrep ⟨e₃, h3⟩ Φ Φ.2 s3 a (i3 ▸ Or.inl rfl) c (i3 ▸ Or.inr rfl) hac] + exact zero3 _ _ _ + +omit [Fintype ↑V] [Fintype ↑E] [Fintype ↑𝓕] in +/-- The ends of an edge in the complex. -/ +theorem cx_ends (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) [ConnectedSpace X] (e : E) {a b : X} + (ha : a ∈ V) (hb : b ∈ V) + (hi : e.1 ∩ V = {a, b}) : (h.cx hT).ends e = {⟨a, ha⟩, ⟨b, hb⟩} := by + ext v + change v.1 ∈ e.1 ↔ _ + constructor + · intro hv + have : v.1 ∈ ({a, b} : Set X) := hi ▸ ⟨hv, v.2⟩ + rcases this with h1 | h1 + · exact .inl (Subtype.ext h1) + · exact .inr (Subtype.ext h1) + · rintro (rfl | rfl) + · exact (hi ▸ (Or.inl rfl) : a ∈ e.1 ∩ V).1 + · exact (hi ▸ (Or.inr rfl) : b ∈ e.1 ∩ V).1 + +omit [Fintype ↑V] [Fintype ↑E] [Fintype ↑𝓕] in +theorem exists_edge_face (h : IsTriang V E 𝓕) (e : E) : ∃ (Φ : Set X) (u v : X), Φ ∈ 𝓕 ∧ e.1 ⊆ Φ + ∧ u ≠ v ∧ e.1 ∩ V = {u, v} := by + obtain ⟨u, v, huv, -, hi⟩ := h.dis.graph.edge e.1 e.2 + obtain ⟨x, hxe, hxV⟩ := h.exists_inner e.2 + obtain ⟨Φ, hΦ, hx⟩ := h.exists_face x + exact ⟨Φ, u, v, hΦ, (h.edge_sub e.2 hΦ hxe hxV hx).trans (discBd_subset Φ), huv, hi⟩ + +omit [Fintype ↑E] [Fintype ↑𝓕] in +/-- **Equivalent local cocycles give cocycles that differ by a coboundary.** -/ +theorem rep_coboundary (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) [ConnectedSpace X] {φ φ' : X + → X → K} {y y' : E → K} + (hy : Rep V E 𝓕 φ y) (hy' : Rep V E 𝓕 φ' y') (hr : CohRel φ φ') : + ∃ w : V → K, (h.cx hT).N.mulVec w = y + y' := by + obtain ⟨g, hg, hrep⟩ := hy + obtain ⟨g', hg', hrep'⟩ := hy' + obtain ⟨h₀, N, hN, hrel⟩ := hr + refine ⟨fun v => h₀ v.1, ?_⟩ + funext e + obtain ⟨Φ, u, v, hΦ, hs, huv, hi⟩ := h.exists_edge_face e + have hu : u ∈ e.1 ∩ V := hi ▸ Or.inl rfl + have hv : v ∈ e.1 ∩ V := hi ▸ Or.inr rfl + have hne : (⟨u, hu.2⟩ : V) ≠ ⟨v, hv.2⟩ := fun h' => huv (congrArg Subtype.val h') + rw [(h.cx hT).sum_ends e hne (h.cx_ends hT e hu.2 hv.2 hi), Pi.add_apply, + hrep e Φ hΦ hs u hu v hv huv, + hrep' e Φ hΦ hs u hu v hv huv] + have hc := const_of_locally (h.isPreconnected_edge e.2) (u := fun x => g Φ x + g' Φ x + h₀ x) + (fun p hp => by + obtain ⟨W, hW, h1⟩ := hg Φ hΦ p (hs hp) + obtain ⟨W', hW', h2⟩ := hg' Φ hΦ p (hs hp) + have hNp : (fun x => (p, x)) ⁻¹' N ∈ 𝓝 p := + (Continuous.prodMk_right p).continuousAt.preimage_mem_nhds (hN p) + refine ⟨W ∩ W' ∩ _, inter_mem (inter_mem hW hW') hNp, fun x hx => ?_⟩ + have h3 := h1 p ⟨mem_of_mem_nhds hW, hs hp⟩ x ⟨hx.1.1.1, hs hx.2⟩ + have h4 := h2 p ⟨mem_of_mem_nhds hW', hs hp⟩ x ⟨hx.1.1.2, hs hx.2⟩ + have h5 := hrel p x hx.1.2 + rw [CharTwo.sub_eq_add, CharTwo.sub_eq_add, h3, h4] at h5 + have h6 : (g Φ x + g' Φ x + h₀ x) + (g Φ p + g' Φ p + h₀ p) = (g Φ p + g Φ x + + (g' Φ p + g' Φ x)) + (h₀ x + h₀ p) := by + ring + refine CharTwo.add_eq_zero.mp ?_ + rw [h6, h5] + exact CharTwo.add_self_eq_zero _) hu.1 hv.1 + have h7 : (g Φ u + g Φ v + (g' Φ u + g' Φ v)) + (h₀ u + h₀ v) = + (g Φ u + g' Φ u + h₀ u) + (g Φ v + g' Φ v + h₀ v) := by ring + refine (CharTwo.add_eq_zero.mp ?_).symm + rw [h7, hc] + exact CharTwo.add_self_eq_zero _ + +end IsTriang + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/TriCohGlue.lean b/LeanPool/GraphMinor/Surface/TriCohGlue.lean new file mode 100644 index 0000000000..c57367f6f0 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/TriCohGlue.lean @@ -0,0 +1,431 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.TriCoh +public import Mathlib.Topology.ShrinkingLemma +public import Mathlib.FieldTheory.Finiteness + +/-! +# Gluing primitives over a triangulation + +Two local cocycles whose cocycles on the triangulation differ by a coboundary are equivalent +(`rep_rel`). We correct the primitives on the faces by constants so that they take the given values +at the vertices. Then they agree on common edges and glue to a function on the surface. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter Matrix + +local notation "K" => ZMod 2 + +variable {X : Type} [TopologicalSpace X] [T2Space X] + +namespace IsTriang + +variable {V : Set X} {E 𝓕 : Set (Set X)} [Fintype V] [Fintype E] [Fintype 𝓕] + +omit [T2Space X] in +theorem _root_.GraphMinor.Surface.Prim.add_const {φ : X → X → K} {Φ : Set X} {g : X → K} + (h : Prim φ Φ g) (c : K) : + Prim φ Φ (fun x => g x + c) := fun p hp => by + obtain ⟨W, hW, h1⟩ := h p hp + refine ⟨W, hW, fun x hx x' hx' => ?_⟩ + rw [h1 x hx x' hx'] + have h2 : g x + c + (g x' + c) = g x + g x' + (c + c) := by ring + rw [h2, CharTwo.add_self_eq_zero, add_zero] + +omit [Fintype ↑E] [Fintype ↑𝓕] in +/-- **Cocycles that differ by a coboundary come from equivalent local cocycles.** -/ +theorem rep_rel (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) [ConnectedSpace X] {φ φ' : X → X + → K} {y y' : E → K} + (hφ : IsCoc φ) (hφ' : IsCoc φ') (hy : Rep V E 𝓕 φ y) (hy' : Rep V E 𝓕 φ' y') {w : V → K} + (hw : (h.cx hT).N.mulVec w = y + y') : CohRel φ φ' := by + classical + obtain ⟨g, hg, hrep⟩ := hy + obtain ⟨g', hg', hrep'⟩ := hy' + let ψ : X → X → K := fun x x' => φ x x' + φ' x x' + let u : Set X → X → K := fun Φ x => g Φ x + g' Φ x + have hu : ∀ Φ ∈ 𝓕, Prim ψ Φ (u Φ) := fun Φ hΦ => (hg Φ hΦ).add (hg' Φ hΦ) + have hbase : ∀ Φ : Set X, ∃ a : V, Φ ∈ 𝓕 → a.1 ∈ Φ := fun Φ => by + by_cases hΦ : Φ ∈ 𝓕 + · obtain ⟨a, b, c, -, -, -, hE⟩ := h.exists_verts hΦ + have ha : a ∈ Φ ∩ V := hE ▸ Or.inl rfl + exact ⟨⟨a, ha.2⟩, fun _ => ha.1⟩ + · obtain ⟨Φ', hΦ', -⟩ := h.exists_face (Classical.choice ‹ConnectedSpace X›.toNonempty) + obtain ⟨a, b, c, -, -, -, hE⟩ := h.exists_verts hΦ' + have ha : a ∈ Φ' ∩ V := hE ▸ Or.inl rfl + exact ⟨⟨a, ha.2⟩, fun h' => absurd h' hΦ⟩ + choose a₀ ha₀ using hbase + let v : Set X → X → K := fun Φ x => u Φ x + (u Φ (a₀ Φ).1 + w (a₀ Φ)) + have hv : ∀ Φ ∈ 𝓕, Prim ψ Φ (v Φ) := fun Φ hΦ => (hu Φ hΦ).add_const _ + have hvV : ∀ Φ ∈ 𝓕, ∀ b : V, b.1 ∈ Φ → v Φ b.1 = w b := fun Φ hΦ b hb => by + by_cases hab : (a₀ Φ) = b + · simp only [v, ← hab] + have h1 : u Φ (a₀ Φ).1 + (u Φ (a₀ Φ).1 + w (a₀ Φ)) = (u Φ (a₀ Φ).1 + u Φ (a₀ Φ).1) + w (a₀ Φ) + := by ring + rw [h1, CharTwo.add_self_eq_zero, zero_add] + · have hab' : (a₀ Φ).1 ≠ b.1 := fun h' => hab (Subtype.ext h') + obtain ⟨e, he, hs, hi⟩ := h.face_pair hΦ ⟨ha₀ Φ hΦ, (a₀ Φ).2⟩ ⟨hb, b.2⟩ hab' + have hs' := hs.trans (discBd_subset Φ) + have h1 := congrFun hw ⟨e, he⟩ + rw [(h.cx hT).sum_ends ⟨e, he⟩ hab (h.cx_ends hT ⟨e, he⟩ _ _ hi), Pi.add_apply, + hrep ⟨e, he⟩ Φ hΦ hs' _ (hi ▸ Or.inl rfl) _ (hi ▸ Or.inr rfl) hab', + hrep' ⟨e, he⟩ Φ hΦ hs' _ (hi ▸ Or.inl rfl) _ (hi ▸ Or.inr rfl) hab'] at h1 + have h2 : v Φ b.1 + w b = (u Φ b.1 + u Φ (a₀ Φ).1) + (w (a₀ Φ) + w b) := by + simp only [v] + ring + refine CharTwo.add_eq_zero.mp ?_ + rw [h2, h1] + have h3 : u Φ b.1 + u Φ (a₀ Φ).1 + (g Φ (a₀ Φ).1 + g Φ b.1 + (g' Φ (a₀ Φ).1 + g' Φ b.1)) = + (u Φ b.1 + u Φ b.1) + (u Φ (a₀ Φ).1 + u Φ (a₀ Φ).1) := by + simp only [u] + ring + rw [h3, CharTwo.add_self_eq_zero, CharTwo.add_self_eq_zero, add_zero] + have hagree : ∀ Φ ∈ 𝓕, ∀ Φ' ∈ 𝓕, ∀ x ∈ Φ, x ∈ Φ' → v Φ x = v Φ' x := fun Φ hΦ Φ' hΦ' x hx hx' + => by + by_cases heq : Φ = Φ' + · rw [heq] + by_cases hxV : x ∈ V + · rw [hvV Φ hΦ ⟨x, hxV⟩ hx, hvV Φ' hΦ' ⟨x, hxV⟩ hx'] + have hb := h.mem_bd_of_ne hΦ hΦ' heq hx hx' + obtain ⟨e, he, hxe⟩ := h.dis.bd Φ hΦ hb + have s1 := (h.edge_sub he hΦ hxe hxV hx).trans (discBd_subset Φ) + have s2 := (h.edge_sub he hΦ' hxe hxV hx').trans (discBd_subset Φ') + obtain ⟨p, q, -, -, hi⟩ := h.dis.graph.edge e he + have hp : p ∈ e ∩ V := hi ▸ Or.inl rfl + have h1 := (hv Φ hΦ).const (hv Φ' hΦ') (h.isPreconnected_edge he) s1 s2 hxe hp.1 + rw [hvV Φ hΦ ⟨p, hp.2⟩ (s1 hp.1), hvV Φ' hΦ' ⟨p, hp.2⟩ (s2 hp.1), + CharTwo.add_self_eq_zero] at h1 + exact CharTwo.add_eq_zero.mp h1 + have hfc : ∀ x : X, ∃ Φ ∈ 𝓕, x ∈ Φ := h.exists_face + choose fc hfc₁ hfc₂ using hfc + let k : X → K := fun x => v (fc x) x + have hk : ∀ Φ ∈ 𝓕, ∀ x ∈ Φ, v Φ x = k x := fun Φ hΦ x hx => hagree Φ hΦ _ (hfc₁ x) x hx (hfc₂ x) + obtain ⟨N₁, hN₁, hc₁⟩ := hφ + obtain ⟨N₂, hN₂, hc₂⟩ := hφ' + have hnear : ∀ p : X, ∃ W ∈ 𝓝 p, W ×ˢ W ⊆ N₁ ∩ N₂ ∧ ∀ x ∈ W, ψ p x = k p + k x ∧ ψ x p + = k x + k p := fun p => by + obtain ⟨A, hA, B, hB, hAB⟩ := mem_nhds_prod_iff.mp (Filter.inter_mem (hN₁ p) (hN₂ p)) + have hC : IsClosed (⋃₀ {Φ ∈ 𝓕 | p ∉ Φ}) := + (h.dis.fin.subset (fun _ (hΦ : _ ∈ {Φ ∈ 𝓕 | p ∉ Φ}) => hΦ.1)).isClosed_sUnion + fun Φ hΦ => (h.dis.disc Φ hΦ.1).isClosed + have hW₁ : (⋃₀ {Φ ∈ 𝓕 | p ∉ Φ})ᶜ ∈ 𝓝 p := hC.isOpen_compl.mem_nhds (by + rintro ⟨Φ, hΦ, h1⟩ + exact hΦ.2 h1) + have hch : ∀ Φ : Set X, ∃ W ∈ 𝓝 p, Φ ∈ 𝓕 → p ∈ Φ → ∀ x ∈ W ∩ Φ, ∀ x' ∈ W ∩ Φ, ψ x x' + = v Φ x + v Φ x' := fun Φ => by + by_cases h1 : Φ ∈ 𝓕 ∧ p ∈ Φ + · obtain ⟨W, hW, h2⟩ := hv Φ h1.1 p h1.2 + exact ⟨W, hW, fun _ _ => h2⟩ + · exact ⟨univ, univ_mem, fun h2 h3 => absurd ⟨h2, h3⟩ h1⟩ + choose Wf hWf hWp using hch + have hW₂ : (⋂ Φ ∈ 𝓕, Wf Φ) ∈ 𝓝 p := (Filter.biInter_mem h.dis.fin).mpr fun Φ _ => hWf Φ + refine ⟨A ∩ B ∩ (⋃₀ {Φ ∈ 𝓕 | p ∉ Φ})ᶜ ∩ ⋂ Φ ∈ 𝓕, Wf Φ, inter_mem (inter_mem + (inter_mem hA hB) hW₁) hW₂, ?_, ?_⟩ + · rintro ⟨x, x'⟩ ⟨hx, hx'⟩ + exact hAB ⟨hx.1.1.1, hx'.1.1.2⟩ + · intro x hx + have hxΦ := hfc₂ x + have hΦ := hfc₁ x + have hpΦ : p ∈ fc x := by + by_contra h1 + exact hx.1.2 ⟨fc x, ⟨hΦ, h1⟩, hxΦ⟩ + have hpW : p ∈ Wf (fc x) := mem_of_mem_nhds (hWf _) + have hxW : x ∈ Wf (fc x) := mem_iInter₂.mp hx.2 _ hΦ + have h1 := hWp (fc x) hΦ hpΦ p ⟨hpW, hpΦ⟩ x ⟨hxW, hxΦ⟩ + have h2 := hWp (fc x) hΦ hpΦ x ⟨hxW, hxΦ⟩ p ⟨hpW, hpΦ⟩ + rw [hk _ hΦ p hpΦ, hk _ hΦ x hxΦ] at h1 h2 + exact ⟨h1, h2⟩ + choose W hW hWN hWk using hnear + refine ⟨k, ⋃ p, W p ×ˢ W p, fun q => Filter.mem_of_superset (prod_mem_nhds (hW q) (hW q)) + (subset_iUnion (fun p => W p ×ˢ W p) q), ?_⟩ + intro x x' hxx + obtain ⟨p, hp⟩ := mem_iUnion.mp hxx + have hpW : p ∈ W p := mem_of_mem_nhds (hW p) + have m1 : (x, p) ∈ N₁ ∩ N₂ := hWN p (show (x, p) ∈ W p ×ˢ W p from ⟨hp.1, hpW⟩) + have m2 : (p, x') ∈ N₁ ∩ N₂ := hWN p (show (p, x') ∈ W p ×ˢ W p from ⟨hpW, hp.2⟩) + have m3 : (x, x') ∈ N₁ ∩ N₂ := hWN p hp + have h1 := hc₁ x p x' m1.1 m2.1 m3.1 + have h2 := hc₂ x p x' m1.2 m2.2 m3.2 + have h3 := (hWk p x hp.1).2 + have h4 := (hWk p x' hp.2).1 + simp only [ψ] at h3 h4 + rw [CharTwo.sub_eq_add, CharTwo.sub_eq_add, ← h1, ← h2] + have h5 : φ x p + φ p x' + (φ' x p + φ' p x') = (φ x p + φ' x p) + (φ p x' + φ' p x') := by ring + rw [h5, h3, h4] + have h6 : k x + k p + (k p + k x') = k x' + k x + (k p + k p) := by ring + rw [h6, CharTwo.add_self_eq_zero, add_zero] + +/-- The value of a function on edges at a pair of vertices. -/ +noncomputable def Yf (E : Set (Set X)) (V : Set X) (y : E → K) (a b : X) : K := by + classical + exact if h : ∃ e : E, e.1 ∩ V = {a, b} then y h.choose else 0 + +omit [Fintype ↑V] [Fintype ↑E] [Fintype ↑𝓕] in +omit [T2Space X] in +theorem Yf_eq (h : IsTriang V E 𝓕) (y : E → K) {a b : X} (e : E) (hi : e.1 ∩ V + = {a, b}) : Yf E V y a b = y e := by + classical + have hex : ∃ e : E, e.1 ∩ V = {a, b} := ⟨e, hi⟩ + have h1 : hex.choose = e := Subtype.ext (h.simple _ hex.choose.2 _ e.2 + (hex.choose_spec.trans hi.symm)) + simp only [Yf, dite_eq_left hex, h1] + +omit [Fintype ↑V] [Fintype ↑E] [Fintype ↑𝓕] in +omit [T2Space X] in +theorem Yf_self (h : IsTriang V E 𝓕) (y : E → K) (a : X) : Yf E V y a a = 0 := by + classical + have hn : ¬ ∃ e : E, e.1 ∩ V = {a, a} := fun ⟨e, he⟩ => by + have h1 := h.ends_ncard e.2 + rw [he, pair_eq_singleton, ncard_singleton] at h1 + omega + simp only [Yf, dite_eq_right hn] + +omit [Fintype ↑V] [Fintype ↑E] [Fintype ↑𝓕] in +omit [T2Space X] in +theorem Yf_comm (h : IsTriang V E 𝓕) (y : E → K) (a b : X) : Yf E V y a b = Yf E V y b a := by + classical + by_cases hex : ∃ e : E, e.1 ∩ V = {a, b} + · obtain ⟨e, he⟩ := hex + rw [h.Yf_eq y e he, h.Yf_eq y e (he.trans (pair_comm a b))] + · have hex' : ¬ ∃ e : E, e.1 ∩ V = {b, a} := by rwa [pair_comm b a] + simp only [Yf, dite_eq_right hex, dite_eq_right hex'] + +omit [Fintype ↑V] [Fintype ↑𝓕] in +/-- A cocycle adds up on the vertices of a face. -/ +theorem Yf_add (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) [ConnectedSpace X] {y : E → K} + (hy : (h.cx hT).M.mulVec y = 0) {Φ : Set X} (hΦ : Φ ∈ 𝓕) {a b c : X} (ha : a ∈ Φ ∩ V) + (hb : b ∈ Φ ∩ V) (hc : c ∈ Φ ∩ V) : + Yf E V y a b + Yf E V y b c = Yf E V y a c := by + have : Finite V := h.dis.graph.fin.to_subtype + have : Finite 𝓕 := h.dis.fin.to_subtype + by_cases hab : a = b + · subst hab + rw [h.Yf_self, zero_add] + by_cases hbc : b = c + · subst hbc + rw [h.Yf_self, add_zero] + by_cases hac : a = c + · subst hac + rw [h.Yf_self, h.Yf_comm y b a, CharTwo.add_self_eq_zero] + obtain ⟨e₁, h1, e₂, h2, e₃, h3, s1, s2, s3, i1, i2, i3, n12, n13, n23⟩ + := h.exists_three_edges hΦ ha hb hc hab hac hbc + have hn : ∀ {e f : Set X} (he : e ∈ E) (hf : f ∈ E), e ≠ f → (⟨e, he⟩ : E) ≠ ⟨f, hf⟩ + := fun _ _ hn h' => hn (congrArg Subtype.val h') + have h4 := (h.cx hT).sum_three y ⟨Φ, hΦ⟩ ((h.cx_I hT ⟨e₁, h1⟩ ⟨Φ, hΦ⟩).mpr s1) + ((h.cx_I hT ⟨e₂, h2⟩ ⟨Φ, hΦ⟩).mpr s2) + ((h.cx_I hT ⟨e₃, h3⟩ ⟨Φ, hΦ⟩).mpr s3) (hn _ _ n12) (hn _ _ n13) (hn _ _ n23) + rw [congrFun hy] at h4 + rw [h.Yf_eq y ⟨e₁, h1⟩ i1, h.Yf_eq y ⟨e₂, h2⟩ i2, h.Yf_eq y ⟨e₃, h3⟩ i3] + exact CharTwo.add_eq_zero.mp h4.symm + +omit [Fintype ↑V] [Fintype ↑𝓕] in +/-- **Each cocycle of the triangulation comes from a local cocycle.** -/ +theorem exists_coc (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) [ConnectedSpace X] {y : E → K} + (hy : (h.cx hT).M.mulVec y = 0) : ∃ φ : X → X → K, IsCoc φ ∧ BdTriv φ ∧ Rep V E 𝓕 φ y := by + have : Finite V := h.dis.graph.fin.to_subtype + have : Finite 𝓕 := h.dis.fin.to_subtype + classical + obtain ⟨hcpt, -, hint⟩ := id hT + have hne : Nonempty X := ‹ConnectedSpace X›.toNonempty + let St : V → Set X := fun v => (⋃₀ {Φ ∈ 𝓕 | v.1 ∉ Φ})ᶜ + have hStO : ∀ v, IsOpen (St v) := fun v => by + have hC : IsClosed (⋃₀ {Φ ∈ 𝓕 | v.1 ∉ Φ}) := + (h.dis.fin.subset (fun _ (hΦ : _ ∈ {Φ ∈ 𝓕 | v.1 ∉ Φ}) => hΦ.1)).isClosed_sUnion + fun Φ hΦ => (h.dis.disc Φ hΦ.1).isClosed + exact hC.isOpen_compl + have hSt : ∀ v, ∀ x ∈ St v, ∀ Φ ∈ 𝓕, x ∈ Φ → v.1 ∈ Φ := fun v x hx Φ hΦ h1 => by + by_contra h2 + exact hx ⟨Φ, ⟨hΦ, h2⟩, h1⟩ + have hStV : ∀ v : V, v.1 ∈ St v := fun v => by + rintro ⟨Φ, hΦ, h1⟩ + exact hΦ.2 h1 + have hcov : ∀ x : X, ∃ v, x ∈ St v := fun x => by + by_cases hxV : x ∈ V + · exact ⟨⟨x, hxV⟩, hStV _⟩ + by_cases hxE : x ∈ ⋃₀ E + · obtain ⟨e, he, hxe⟩ := hxE + obtain ⟨p, q, -, -, hi⟩ := h.dis.graph.edge e he + have hp : p ∈ e ∩ V := hi ▸ Or.inl rfl + refine ⟨⟨p, hp.2⟩, ?_⟩ + rintro ⟨Φ, hΦ, h1⟩ + exact hΦ.2 (discBd_subset Φ (h.edge_sub he hΦ.1 hxe hxV h1 hp.1)) + · obtain ⟨Φ, hΦ, hx⟩ := h.exists_face x + obtain ⟨a, b, c, -, -, -, hE⟩ := h.exists_verts hΦ + have ha : a ∈ Φ ∩ V := hE ▸ Or.inl rfl + refine ⟨⟨a, ha.2⟩, ?_⟩ + rintro ⟨Φ', hΦ', h1⟩ + have hne' : Φ ≠ Φ' := fun h2 => hΦ'.2 (h2 ▸ ha.1) + have hb := h.mem_bd_of_ne hΦ hΦ'.1 hne' hx h1 + exact hxE (h.dis.bd Φ hΦ hb) + have hnorm : NormalSpace X := inferInstance + obtain ⟨K₀, hK₀u, hK₀c, hK₀s⟩ := exists_subset_iUnion_closed_subset (u := St) isClosed_univ hStO + (fun x _ => Set.toFinite _) (fun x _ => mem_iUnion.mpr (hcov x)) + let C : V → Set X := fun v => insert v.1 (K₀ v) + have hCc : ∀ v, IsClosed (C v) := fun v => by + have h1 := (isClosed_singleton (x := v.1)).union (hK₀c v) + rwa [singleton_union] at h1 + have hCs : ∀ v, C v ⊆ St v := fun v => insert_subset (hStV v) (hK₀s v) + have hs : ∀ x : X, ∃ v : V, x ∈ C v ∧ ∀ hx : x ∈ V, v = ⟨x, hx⟩ := fun x => by + by_cases hxV : x ∈ V + · exact ⟨⟨x, hxV⟩, .inl rfl, fun _ => rfl⟩ + · obtain ⟨v, hv⟩ := mem_iUnion.mp (hK₀u (mem_univ x)) + exact ⟨v, .inr hv, fun h' => absurd h' hxV⟩ + choose s hsC hsV using hs + let N : Set (X × X) := ⋂ v : V, {p | (p.1 ∈ C v → p.2 ∈ St v) ∧ (p.2 ∈ C v → p.1 ∈ St v)} + have hN : NearDiag N := fun p => by + refine (Filter.iInter_mem).mpr fun v => ?_ + change {q : X × X | q.1 ∈ C v → q.2 ∈ St v} ∩ + {q : X × X | q.2 ∈ C v → q.1 ∈ St v} ∈ 𝓝 (p, p) + refine inter_mem ?_ ?_ + · by_cases hp : p ∈ C v + · have h1 : (fun q : X × X => q.2) ⁻¹' St v ∈ 𝓝 (p, p) := + continuous_snd.continuousAt.preimage_mem_nhds ((hStO v).mem_nhds (hCs v hp)) + exact Filter.mem_of_superset h1 fun q hq _ => hq + · have h1 : (fun q : X × X => q.1) ⁻¹' (C v)ᶜ ∈ 𝓝 (p, p) := + continuous_fst.continuousAt.preimage_mem_nhds ((hCc v).isOpen_compl.mem_nhds hp) + exact Filter.mem_of_superset h1 fun q hq h' => absurd h' hq + · by_cases hp : p ∈ C v + · have h1 : (fun q : X × X => q.1) ⁻¹' St v ∈ 𝓝 (p, p) := + continuous_fst.continuousAt.preimage_mem_nhds ((hStO v).mem_nhds (hCs v hp)) + exact Filter.mem_of_superset h1 fun q hq _ => hq + · have h1 : (fun q : X × X => q.2) ⁻¹' (C v)ᶜ ∈ 𝓝 (p, p) := + continuous_snd.continuousAt.preimage_mem_nhds ((hCc v).isOpen_compl.mem_nhds hp) + exact Filter.mem_of_superset h1 fun q hq h' => absurd h' hq + let φ : X → X → K := fun x x' => Yf E V y (s x).1 (s x').1 + have hface : ∀ {Φ : Set X}, Φ ∈ 𝓕 → ∀ x ∈ Φ, (s x).1 ∈ Φ ∩ V := fun hΦ x hx => + ⟨hSt _ x (hCs _ (hsC x)) _ hΦ hx, (s x).2⟩ + refine ⟨φ, ⟨N, hN, fun x x' z h1 h2 h3 => ?_⟩, ⟨0, univ, fun _ => univ_mem, + fun x hx => absurd (hint x) hx⟩, ?_⟩ + · have h1' := mem_iInter.mp h1 + have h2' := mem_iInter.mp h2 + have h3' := mem_iInter.mp h3 + have za : z ∈ St (s x) := (h3' (s x)).1 (hsC x) + have zb : z ∈ St (s x') := (h2' (s x')).1 (hsC x') + have zc : z ∈ St (s z) := hCs _ (hsC z) + obtain ⟨Φ, hΦ, hz⟩ := h.exists_face z + exact h.Yf_add hT hy hΦ ⟨hSt _ z za Φ hΦ hz, (s x).2⟩ ⟨hSt _ z zb Φ hΦ hz, + (s x').2⟩ ⟨hSt _ z zc Φ hΦ hz, (s z).2⟩ + · have hb : ∀ Φ : Set X, ∃ a₀ : V, Φ ∈ 𝓕 → a₀.1 ∈ Φ := fun Φ => by + by_cases hΦ : Φ ∈ 𝓕 + · obtain ⟨a, b, c, -, -, -, hE⟩ := h.exists_verts hΦ + have ha : a ∈ Φ ∩ V := hE ▸ Or.inl rfl + exact ⟨⟨a, ha.2⟩, fun _ => ha.1⟩ + · obtain ⟨Φ', hΦ', -⟩ := h.exists_face (Classical.choice hne) + obtain ⟨a, b, c, -, -, -, hE⟩ := h.exists_verts hΦ' + have ha : a ∈ Φ' ∩ V := hE ▸ Or.inl rfl + exact ⟨⟨a, ha.2⟩, fun h' => absurd h' hΦ⟩ + choose a₀ ha₀ using hb + refine ⟨fun Φ x => Yf E V y (a₀ Φ).1 (s x).1, fun Φ hΦ p hp => ?_, + fun e Φ hΦ hs' a ha b hb hab => ?_⟩ + · obtain ⟨A, hA, B, hB, hAB⟩ := mem_nhds_prod_iff.mp (hN p) + refine ⟨A ∩ B, inter_mem hA hB, fun x hx x' hx' => ?_⟩ + have h1 := h.Yf_add hT hy hΦ ⟨ha₀ Φ hΦ, (a₀ Φ).2⟩ (hface hΦ x hx.2) (hface hΦ x' hx'.2) + change Yf E V y (s x).1 (s x').1 = Yf E V y (a₀ Φ).1 (s x).1 + Yf E V y (a₀ Φ).1 (s x').1 + rw [← h1, ← add_assoc, CharTwo.add_self_eq_zero, zero_add] + · have h1 := h.Yf_add hT hy hΦ ⟨ha₀ Φ hΦ, (a₀ Φ).2⟩ ⟨hs' ha.1, ha.2⟩ ⟨hs' hb.1, hb.2⟩ + have hsa : (s a).1 = a := by rw [hsV a ha.2] + have hsb : (s b).1 = b := by rw [hsV b hb.2] + have hi : e.1 ∩ V = {a, b} := by + have hsub : ({a, b} : Set X) ⊆ e.1 ∩ V := insert_subset ha (singleton_subset_iff.mpr hb) + exact (eq_of_subset_of_ncard_le hsub (by rw [h.ends_ncard e.2, + ncard_pair hab]) (Set.toFinite _)).symm + change y e = Yf E V y (a₀ Φ).1 (s a).1 + Yf E V y (a₀ Φ).1 (s b).1 + rw [hsa, hsb, ← h.Yf_eq y e hi, ← h1, ← add_assoc, CharTwo.add_self_eq_zero, zero_add] + +omit [Fintype ↑V] [Fintype ↑E] [Fintype ↑𝓕] in +omit [T2Space X] in +theorem nonempty_faces (h : IsTriang V E 𝓕) [ConnectedSpace X] : Nonempty 𝓕 := by + obtain ⟨Φ, hΦ, -⟩ := h.exists_face (Classical.choice ‹ConnectedSpace X›.toNonempty) + exact ⟨⟨Φ, hΦ⟩⟩ + +omit [Fintype ↑V] [Fintype ↑E] [Fintype ↑𝓕] in +omit [T2Space X] in +theorem nonempty_verts (h : IsTriang V E 𝓕) [ConnectedSpace X] : Nonempty V := by + obtain ⟨Φ⟩ := h.nonempty_faces + obtain ⟨a, b, c, -, -, -, hE⟩ := h.exists_verts Φ.2 + have ha : a ∈ Φ.1 ∩ V := hE ▸ Or.inl rfl + exact ⟨⟨a, ha.2⟩⟩ + +omit [TopologicalSpace X] [T2Space X] [Fintype ↑E] in +theorem sub_fn (a b : E → K) : a - b = a + b := funext fun _ => CharTwo.sub_eq_add _ _ + +omit [Fintype ↑𝓕] in +/-- **The classes of local cocycles are the classes of the triangulation.** -/ +theorem card_kCl (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) [ConnectedSpace X] : + Nat.card (KCl X K) = 2 ^ (Module.finrank K (↥(LinearMap.ker (h.cx hT).M.mulVecLin) ⧸ + (LinearMap.range (h.cx hT).N.mulVecLin).comap (LinearMap.ker (h.cx hT).M.mulVecLin).subtype)) + := by + classical + set Z := LinearMap.ker (h.cx hT).M.mulVecLin with hZ + set B := (LinearMap.range (h.cx hT).N.mulVecLin).comap Z.subtype with hB + have hch : ∀ φ : KSet X K, ∃ y : Z, Rep V E 𝓕 φ.1 y.1 := fun φ => by + obtain ⟨y, hy, hr⟩ := h.exists_rep hT φ.2.1 + exact ⟨⟨y, LinearMap.mem_ker.mpr hy⟩, hr⟩ + choose yf hyf using hch + let f : KSet X K → Z ⧸ B := fun φ => Submodule.Quotient.mk (yf φ) + have hrespect : ∀ φ φ' : KSet X K, (kSetoid X K).r φ φ' → f φ = f φ' := fun φ φ' hr => by + obtain ⟨w, hw⟩ := h.rep_coboundary hT (hyf φ) (hyf φ') hr + refine (Submodule.Quotient.eq B).mpr ?_ + refine ⟨w, ?_⟩ + change (h.cx hT).N.mulVec w = (yf φ).1 - (yf φ').1 + rw [hw, sub_fn] + let F : KCl X K → Z ⧸ B := Quotient.lift f hrespect + have hF : Function.Bijective F := by + constructor + · refine Quotient.ind₂ fun φ φ' he => Quotient.sound ?_ + obtain ⟨w, hw⟩ := (Submodule.Quotient.eq B).mp (show f φ = f φ' from he) + refine h.rep_rel hT φ.2.1 φ'.2.1 (hyf φ) (hyf φ') (w := w) ?_ + have hw' : (h.cx hT).N.mulVec w = (yf φ).1 - (yf φ').1 := hw + rw [hw', sub_fn] + · intro q + induction q using Submodule.Quotient.induction_on with + | H y => + obtain ⟨φ, h1, h2, h3⟩ := h.exists_coc hT (LinearMap.mem_ker.mp y.2) + refine ⟨Quotient.mk _ ⟨φ, h1, h2⟩, ?_⟩ + refine (Submodule.Quotient.eq B).mpr ?_ + have hw := h.rep_coboundary hT (hyf ⟨φ, h1, h2⟩) h3 (.refl φ) + obtain ⟨w, hw⟩ := hw + refine ⟨w, ?_⟩ + change (h.cx hT).N.mulVec w = (yf ⟨φ, h1, h2⟩).1 - y.1 + rw [hw, sub_fn] + have h9 : Nat.card (Z ⧸ B) = Nat.card (ZMod 2) ^ Module.finrank (ZMod 2) (Z ⧸ B) + := Module.natCard_eq_pow_finrank + rw [Nat.card_congr (Equiv.ofBijective F hF), h9, Nat.card_zmod] + +/-- **Euler's formula.** For a triangulation of a connected closed surface with `2 ^ κ` classes of +local cocycles, `|V| - |E| + |F| + κ = 2`. -/ +theorem euler_eq (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) [ConnectedSpace X] : + ∃ κ : ℕ, Nat.card (KCl X K) = 2 ^ κ ∧ (Fintype.card V : ℤ) - Fintype.card E + Fintype.card 𝓕 + + κ = 2 := by + have : Nonempty V := h.nonempty_verts + have : Nonempty 𝓕 := h.nonempty_faces + refine ⟨_, h.card_kCl hT, ?_⟩ + have h1 := (h.cx hT).finrank_ker_M + have h2 := (h.cx hT).finrank_range_N + set Z := LinearMap.ker (h.cx hT).M.mulVecLin with hZ + have hle : LinearMap.range (h.cx hT).N.mulVecLin ≤ Z := by + rintro _ ⟨w, rfl⟩ + refine LinearMap.mem_ker.mpr ?_ + change (h.cx hT).M.mulVec ((h.cx hT).N.mulVec w) = 0 + rw [Matrix.mulVec_mulVec, TriCx.M_mul_N, Matrix.zero_mulVec] + have h3 := Submodule.finrank_quotient_add_finrank ((LinearMap.range + (h.cx hT).N.mulVecLin).comap Z.subtype) + have h4 : Module.finrank K ((LinearMap.range (h.cx hT).N.mulVecLin).comap Z.subtype) = + Module.finrank K (LinearMap.range (h.cx hT).N.mulVecLin) := + (Submodule.comapSubtypeEquivOfLe hle).finrank_eq + omega + +end IsTriang + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/TriCount.lean b/LeanPool/GraphMinor/Surface/TriCount.lean new file mode 100644 index 0000000000..4957d5d928 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/TriCount.lean @@ -0,0 +1,947 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.LinearAlgebra.Matrix.Rank +public import Mathlib.LinearAlgebra.Dimension.Finrank +public import Mathlib.Data.ZMod.Basic +public import Mathlib.Data.Nat.Prime.Basic +public import Mathlib.Algebra.Field.ZMod +public import Mathlib.Algebra.CharP.Two +public import Mathlib.LinearAlgebra.FiniteDimensional.Lemmas +public import Mathlib.Data.Set.Card +public import Mathlib.Data.Fintype.Card +public import Mathlib.Algebra.BigOperators.Ring.Finset + +/-! +# Counting in a triangulation + +This file is pure counting. A triangulated surface is recorded by `TriCx V E F`: vertices, edges and +faces, where each edge has two ends, each face has three vertices, each edge lies in two faces, and +three connectivity conditions hold. Over the field with two elements, the incidence matrices `M` +(faces against edges) and `N` (edges against vertices) satisfy `M * N = 0`. We compute their ranks +(`finrank_range_N`, `finrank_ker_M`). + +Then we bound a subgraph. If `Y` is a set of edges, let `R` be the number of classes of faces under +sharing an edge outside `Y`. Then `|V| - |E| + |F| ≤ |V(Y)| - |Y| + R` (`euler_le`). This is the +Euler formula for a graph in a surface in the form that is needed for Graph Minors XIX, (6.5) (page +341). Regions need not be discs. For a drawing with at least three edges and no parallel edges, each +class meets three edges, and this gives `3 R ≤ 2 |E|` (`three_classes_le`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Matrix + +/-- The combinatorics of a triangulation of a connected closed surface. -/ +structure TriCx (V E F : Type) where + /-- The two endpoints of each edge. -/ + ends : E → Set V + /-- The three vertices of each face. -/ + verts : F → Set V + ends_two : ∀ e, (ends e).ncard = 2 + ends_inj : Function.Injective ends + verts_three : ∀ Φ, (verts Φ).ncard = 3 + pair : ∀ Φ, ∀ a ∈ verts Φ, ∀ b ∈ verts Φ, a ≠ b → ∃ e, ends e = {a, b} + two : ∀ e, {Φ | ends e ⊆ verts Φ}.ncard = 2 + conn : ∀ S : Set V, (∀ e, ∀ a ∈ ends e, ∀ b ∈ ends e, a ∈ S → b ∈ S) → S.Nonempty → S = univ + dual : ∀ S : Set F, (∀ e, ∀ Φ ∈ S, ∀ Φ', ends e ⊆ verts Φ → ends e ⊆ verts Φ' → Φ' ∈ S) + → S.Nonempty → S = univ + link : ∀ w, ∀ S : Set F, (∀ Φ ∈ S, w ∈ verts Φ) → + (∀ e, w ∈ ends e → ∀ Φ ∈ S, ∀ Φ', ends e ⊆ verts Φ → ends e ⊆ verts Φ' → Φ' ∈ S) → S.Nonempty → + ∀ Φ', w ∈ verts Φ' → Φ' ∈ S + +namespace TriCx + +variable {V E F : Type} [Fintype V] [Fintype E] [Fintype F] (T : TriCx V E F) + +/-- An edge lies in a face. -/ +def I (e : E) (Φ : F) : Prop := T.ends e ⊆ T.verts Φ + +local notation "K" => ZMod 2 + +open Classical in +/-- Faces against edges. -/ +noncomputable def M : Matrix F E K := fun Φ e => if T.I e Φ then 1 else 0 + +open Classical in +/-- Edges against vertices. -/ +noncomputable def N : Matrix E V K := fun e v => if v ∈ T.ends e then 1 else 0 + +omit [Fintype V] [Fintype E] [Fintype F] in +theorem exists_ends (e : E) : ∃ a b, a ≠ b ∧ T.ends e = {a, b} := by + obtain ⟨a, b, h, h'⟩ := ncard_eq_two.mp (T.ends_two e) + exact ⟨a, b, h, h'⟩ + +omit [Fintype V] [Fintype E] [Fintype F] in +theorem exists_faces (e : E) : ∃ Φ Φ', Φ ≠ Φ' ∧ {Φ | T.I e Φ} = {Φ, Φ'} := by + obtain ⟨a, b, h, h'⟩ := ncard_eq_two.mp (T.two e) + exact ⟨a, b, h, h'⟩ + +omit [Fintype E] [Fintype F] in +theorem sum_ends (e : E) {a b : V} (hab : a ≠ b) (he : T.ends e = {a, b}) (w : V → K) : + T.N.mulVec w e = w a + w b := by + classical + have h1 : ∀ v, T.N e v * w v = (if v = a then w v else 0) + (if v = b then w v else 0) := fun v + => by + simp only [N, he, mem_insert_iff, mem_singleton_iff] + by_cases h2 : v = a + · have h3 : v ≠ b := h2 ▸ hab + simp [h2, hab] + · by_cases h3 : v = b + · simp [h3, hab.symm] + · simp [h2, h3] + simp only [mulVec, dotProduct, h1, Finset.sum_add_distrib] + simp + +omit [Fintype V] [Fintype E] in +theorem sum_faces (e : E) {Φ Φ' : F} (h : Φ ≠ Φ') (he : {Φ | T.I e Φ} = {Φ, Φ'}) (f : F → K) : + T.Mᵀ.mulVec f e = f Φ + f Φ' := by + classical + have hm : ∀ Ψ, T.I e Ψ ↔ Ψ = Φ ∨ Ψ = Φ' := fun Ψ => by + have : Ψ ∈ {Φ | T.I e Φ} ↔ Ψ ∈ ({Φ, Φ'} : Set F) := by rw [he] + simpa using this + have h1 : ∀ v, T.M v e * f v = (if v = Φ then f v else 0) + (if v = Φ' then f v else 0) := fun v + => by + simp only [M, hm] + by_cases h2 : v = Φ + · have h3 : v ≠ Φ' := h2 ▸ h + simp [h2, h] + · by_cases h3 : v = Φ' + · simp [h3, h.symm] + · simp [h2, h3] + simp only [mulVec, dotProduct, transpose_apply, h1, Finset.sum_add_distrib] + simp + +theorem zmod_add_self (x : K) : x + x = 0 := CharTwo.add_self_eq_zero x + +omit [Fintype V] [Fintype F] in +/-- Each vertex of a face lies on two edges of the face. -/ +theorem card_at [Finite V] [Finite F] (Φ : F) {v : V} (hv : v ∈ T.verts Φ) [DecidablePred fun e + => T.I e Φ ∧ v ∈ T.ends e] : + (Finset.univ.filter fun e => T.I e Φ ∧ v ∈ T.ends e).card = 2 := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite F + · have hc : (T.verts Φ \ {v}).ncard = 2 := by + rw [ncard_sdiff (singleton_subset_iff.mpr hv) (Set.toFinite _), T.verts_three Φ, + ncard_singleton] + obtain ⟨b, c, hbc, hE⟩ := ncard_eq_two.mp hc + have hb : b ∈ T.verts Φ \ {v} := hE ▸ .inl rfl + have hc' : c ∈ T.verts Φ \ {v} := hE ▸ .inr rfl + obtain ⟨e₁, h1⟩ := T.pair Φ v hv b hb.1 (Ne.symm hb.2) + obtain ⟨e₂, h2⟩ := T.pair Φ v hv c hc'.1 (Ne.symm hc'.2) + have hne : e₁ ≠ e₂ := fun h => by + rw [h, h2] at h1 + have h3 : c ∈ ({v, b} : Set V) := h1 ▸ Or.inr rfl + rcases h3 with h3 | h3 + · exact hc'.2 h3 + · exact hbc h3.symm + have hset : (Finset.univ.filter fun e => T.I e Φ ∧ v ∈ T.ends e) = {e₁, e₂} := by + ext e + simp only [Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_insert, + Finset.mem_singleton] + constructor + · rintro ⟨h3, h4⟩ + obtain ⟨p, q, hpq, he⟩ := T.exists_ends e + have hother : ∃ o, o ≠ v ∧ T.ends e = {v, o} := by + rw [he] at h4 ⊢ + rcases h4 with rfl | rfl + · exact ⟨q, Ne.symm hpq, rfl⟩ + · exact ⟨p, hpq, pair_comm _ _⟩ + obtain ⟨o, hov, heo⟩ := hother + have ho : o ∈ T.verts Φ \ {v} := ⟨h3 (heo ▸ Or.inr rfl), hov⟩ + rw [hE] at ho + rcases ho with rfl | rfl + · exact .inl (T.ends_inj (heo.trans h1.symm)) + · exact .inr (T.ends_inj (heo.trans h2.symm)) + · rintro (rfl | rfl) + · refine ⟨fun y hy => ?_, h1 ▸ Or.inl rfl⟩ + rw [h1] at hy + rcases hy with rfl | rfl + · exact hv + · exact hb.1 + · refine ⟨fun y hy => ?_, h2 ▸ Or.inl rfl⟩ + rw [h2] at hy + rcases hy with rfl | rfl + · exact hv + · exact hc'.1 + rw [hset, Finset.card_pair hne] + +omit [Fintype V] [Fintype F] in +/-- Each vertex lies on an even number of edges of a face. -/ +theorem even_card [Finite V] [Finite F] (Φ : F) (v : V) [DecidablePred fun e => T.I e Φ + ∧ v ∈ T.ends e] : + Even (Finset.univ.filter fun e => T.I e Φ ∧ v ∈ T.ends e).card := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite F + by_cases hv : v ∈ T.verts Φ + · rw [T.card_at Φ hv] + exact even_two + · have : (Finset.univ.filter fun e => T.I e Φ ∧ v ∈ T.ends e) = ∅ := by + ext e + simp only [Finset.mem_filter, Finset.mem_univ, true_and, Finset.notMem_empty, iff_false, + not_and] + exact fun h1 h2 => hv (h1 h2) + rw [this] + simp + +omit [Fintype V] [Fintype F] in +theorem M_mul_N [Finite V] [Finite F] : T.M * T.N = 0 := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite F + ext Φ v + simp only [Matrix.zero_apply] + have h1 : (∑ e, if T.I e Φ then (if v ∈ T.ends e then (1 : K) else 0) else 0) = + ((Finset.univ.filter fun e => T.I e Φ ∧ v ∈ T.ends e).card : K) := by + rw [Finset.card_filter] + push_cast + refine Finset.sum_congr rfl fun e _ => ?_ + by_cases h2 : T.I e Φ <;> by_cases h3 : v ∈ T.ends e <;> simp [h2, h3] + have h2 : (∑ e, (if T.I e Φ then (if v ∈ T.ends e then (1 : K) else 0) else 0)) = 0 := by + rw [h1] + obtain ⟨r, hr⟩ := T.even_card Φ v + rw [hr, Nat.cast_add] + exact zmod_add_self _ + calc _ = ∑ e, (if T.I e Φ then (if v ∈ T.ends e then (1 : K) else 0) else 0) := by + refine Finset.sum_congr rfl fun e _ => ?_ + by_cases h3 : T.I e Φ <;> by_cases h4 : v ∈ T.ends e <;> simp [M, N, h3, h4] + _ = 0 := h2 + +/-- The boundary of a set of faces: the edges with exactly one face in the set. -/ +noncomputable def bdry (f : F → K) : E → K := T.Mᵀ.mulVec f + +open Classical in +omit [Fintype V] in +/-- The boundary of a set of faces has even degree at each vertex. -/ +theorem bdry_even [Finite V] (f : F → K) (w : V) : ∑ e, (if w ∈ T.ends e then T.bdry f e else 0) + = 0 := by + let := Fintype.ofFinite V + have h1 : ∑ e, (if w ∈ T.ends e then T.bdry f e else 0) = dotProduct (T.bdry f) (T.N.mulVec + (Pi.single w 1)) := by + simp only [dotProduct] + refine Finset.sum_congr rfl fun e _ => ?_ + have h2 : T.N.mulVec (Pi.single w 1) e = T.N e w := by + simp + rw [h2] + by_cases h3 : w ∈ T.ends e <;> simp [N, h3] + rw [h1, bdry, Matrix.mulVec_transpose, ← Matrix.dotProduct_mulVec, Matrix.mulVec_mulVec, M_mul_N, + Matrix.zero_mulVec, + dotProduct_zero] + +omit [Fintype E] [Fintype F] in +/-- The constant functions are the only ones with zero image under `N`. -/ +theorem ker_N_const [Finite E] [Finite F] {w : V → K} (hw : T.N.mulVec w = 0) (a b : V) : w a = w b + := by + classical + let := Fintype.ofFinite E + let := Fintype.ofFinite F + have hstep : ∀ e, ∀ p ∈ T.ends e, ∀ q ∈ T.ends e, w p = w q := fun e p hp q hq => by + obtain ⟨c, d, hcd, he⟩ := T.exists_ends e + have h1 := T.sum_ends e hcd he w + rw [hw] at h1 + have h2 : w c = w d := by + have h3 : w c + w d = 0 := h1.symm + exact CharTwo.add_eq_zero.mp h3 + rw [he] at hp hq + rcases hp with rfl | rfl <;> rcases hq with rfl | rfl <;> simp [h2] + have := T.conn {v | w v = w a} (fun e p hp q hq h => (hstep e p hp q hq).symm.trans h) ⟨a, rfl⟩ + have hb : b ∈ {v | w v = w a} := this ▸ mem_univ b + exact hb.symm + +omit [Fintype V] [Fintype E] in +theorem ker_M_const [Finite V] [Finite E] {f : F → K} (hf : T.Mᵀ.mulVec f = 0) (a b : F) : f a + = f b := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite E + have hstep : ∀ e, ∀ p, T.I e p → ∀ q, T.I e q → f p = f q := fun e p hp q hq => by + obtain ⟨c, d, hcd, he⟩ := T.exists_faces e + have h1 := T.sum_faces e hcd he f + rw [hf] at h1 + have h2 : f c = f d := CharTwo.add_eq_zero.mp h1.symm + have hp' : p ∈ ({c, d} : Set F) := he ▸ hp + have hq' : q ∈ ({c, d} : Set F) := he ▸ hq + rcases hp' with rfl | rfl <;> rcases hq' with rfl | rfl <;> simp [h2] + have := T.dual {v | f v = f a} (fun e p hp q h1 h2 => (hstep e p h1 q h2).symm.trans hp) ⟨a, rfl⟩ + have hb : b ∈ {v | f v = f a} := this ▸ mem_univ b + exact hb.symm + +theorem finrank_span_one {ι : Type} [Nonempty ι] {W : Submodule K (ι → K)} (h1 : (fun _ => 1) ∈ W) + (h2 : ∀ w ∈ W, ∀ a b, w a = w b) : Module.finrank K W = 1 := by + have h3 : W = Submodule.span K {(fun _ => 1 : ι → K)} := by + refine le_antisymm (fun w hw => ?_) ((Submodule.span_singleton_le_iff_mem _ _).mpr h1) + obtain ⟨a⟩ := ‹Nonempty ι› + refine Submodule.mem_span_singleton.mpr ⟨w a, ?_⟩ + funext b + simp [h2 w hw b a] + rw [h3] + refine finrank_span_singleton fun h => ?_ + obtain ⟨a⟩ := ‹Nonempty ι› + have := congrFun h a + simp at this + +omit [Fintype E] [Fintype F] in +/-- The rank of `N`. -/ +theorem finrank_range_N [Finite E] [Finite F] [Nonempty V] : Module.finrank K + (LinearMap.range T.N.mulVecLin) + 1 = Fintype.card V := by + let := Fintype.ofFinite E + let := Fintype.ofFinite F + have h1 := LinearMap.finrank_range_add_finrank_ker T.N.mulVecLin + rw [Module.finrank_fintype_fun_eq_card] at h1 + rw [← h1] + congr 1 + refine (finrank_span_one ?_ fun w hw a b => T.ker_N_const hw a b).symm + rw [LinearMap.mem_ker] + funext e + obtain ⟨c, d, hcd, he⟩ := T.exists_ends e + exact (T.sum_ends e hcd he _).trans (zmod_add_self _) + +omit [Fintype V] in +theorem rank_M_add_one [Finite V] [Nonempty F] : T.M.rank + 1 = Fintype.card F := by + let := Fintype.ofFinite V + have h1 := LinearMap.finrank_range_add_finrank_ker T.Mᵀ.mulVecLin + rw [Module.finrank_fintype_fun_eq_card] at h1 + rw [← Matrix.rank_transpose, ← h1, Matrix.rank] + congr 1 + refine (finrank_span_one ?_ fun w hw a b => T.ker_M_const hw a b).symm + rw [LinearMap.mem_ker] + funext e + obtain ⟨c, d, hcd, he⟩ := T.exists_faces e + exact (T.sum_faces e hcd he _).trans (zmod_add_self _) + +omit [Fintype V] in +/-- The size of the kernel of `M`. -/ +theorem finrank_ker_M [Finite V] [Nonempty F] : Module.finrank K (LinearMap.ker T.M.mulVecLin) + + Fintype.card F = Fintype.card E + 1 := by + let := Fintype.ofFinite V + have h1 := LinearMap.finrank_range_add_finrank_ker T.M.mulVecLin + rw [Module.finrank_fintype_fun_eq_card] at h1 + have h2 := T.rank_M_add_one + rw [Matrix.rank] at h2 + omega + +/-- Faces related by an edge of `C`. -/ +def rel (C : Set E) (Φ Φ' : F) : Prop := ∃ e ∈ C, T.I e Φ ∧ T.I e Φ' + +/-- The matrix of the edges of `C`. -/ +noncomputable def Msub (C : Set E) : Matrix F C K := T.M.submatrix id Subtype.val + +omit [Fintype V] [Fintype E] in +theorem rel_eq [Finite V] [Finite E] {C : Set E} [Finite C] {f : F → K} (hf : (T.Msub C)ᵀ.mulVec f + = 0) {Φ Φ' : F} (h : T.rel C Φ Φ') : f Φ = f Φ' := by + let := Fintype.ofFinite V + let := Fintype.ofFinite E + let := Fintype.ofFinite C + obtain ⟨e, he, hp, hq⟩ := h + obtain ⟨c, d, hcd, hE⟩ := T.exists_faces e + have h1 := T.sum_faces e hcd hE f + have h3 : T.Mᵀ.mulVec f e = 0 := congrFun hf ⟨e, he⟩ + rw [h3] at h1 + have h2 : f c = f d := CharTwo.add_eq_zero.mp h1.symm + have hp' : Φ ∈ ({c, d} : Set F) := hE ▸ hp + have hq' : Φ' ∈ ({c, d} : Set F) := hE ▸ hq + rcases hp' with rfl | rfl <;> rcases hq' with rfl | rfl <;> simp [h2] + +omit [Fintype V] [Fintype E] in +theorem card_le_rank_add [Finite V] [Finite E] (C : Set E) [Fintype C] [Finite (Quot (T.rel C))] : + Fintype.card F ≤ (T.Msub C).rank + Nat.card (Quot (T.rel C)) := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite E + have : Fintype (Quot (T.rel C)) := Fintype.ofFinite _ + have h1 := LinearMap.finrank_range_add_finrank_ker (T.Msub C)ᵀ.mulVecLin + rw [Module.finrank_fintype_fun_eq_card] at h1 + have hker : ∀ f : LinearMap.ker (T.Msub C)ᵀ.mulVecLin, ∀ a b, T.rel C a b → f.1 a = f.1 b + := fun f a b h => + T.rel_eq (LinearMap.mem_ker.mp f.2) h + let L : LinearMap.ker (T.Msub C)ᵀ.mulVecLin →ₗ[K] (Quot (T.rel C) → K) := + { toFun := fun f => Quot.lift f.1 (hker f) + map_add' := fun f g => by + funext q + induction q using Quot.ind + rfl + map_smul' := fun c f => by + funext q + induction q using Quot.ind + rfl } + have hL : Function.Injective L := by + intro f g hfg + apply Subtype.ext + funext a + exact congrFun hfg (Quot.mk _ a) + have h2 := LinearMap.finrank_le_finrank_of_injective hL + rw [Module.finrank_fintype_fun_eq_card] at h2 + rw [← Matrix.rank_transpose, Matrix.rank, Nat.card_eq_fintype_card] + omega + +/-- **Euler's inequality for a subgraph.** -/ +theorem euler_le (Y : Set E) (VY : Set V) (hY : ∀ e ∈ Y, T.ends e ⊆ VY) + (hne : VY.Nonempty) : + (Fintype.card V : ℤ) - Fintype.card E + Fintype.card F ≤ VY.ncard - Y.ncard + Nat.card (Quot + (T.rel Yᶜ)) := by + classical + let S : Set V := VYᶜ + let C : Set E := Yᶜ + let ext : (S → K) →ₗ[K] (V → K) := + { toFun := fun z v => if h : v ∈ S then z ⟨v, h⟩ else 0 + map_add' := fun z z' => by + funext v + by_cases h : v ∈ S <;> simp [h] + map_smul' := fun c z => by + funext v + by_cases h : v ∈ S <;> simp [h] } + have hext : ∀ z, ∀ v ∈ VY, ext z v = 0 := fun z v hv => by + have : v ∉ S := fun h => h hv + simp [ext, this] + let res : (E → K) →ₗ[K] (C → K) := LinearMap.funLeft K K Subtype.val + let L₀ : (S → K) →ₗ[K] (C → K) := res ∘ₗ T.N.mulVecLin ∘ₗ ext + have hzero : ∀ z, ∀ e ∈ Y, T.N.mulVec (ext z) e = 0 := fun z e he => by + obtain ⟨c, d, hcd, hE⟩ := T.exists_ends e + rw [T.sum_ends e hcd hE, hext z c (hY e he (hE ▸ Or.inl rfl)), hext z d (hY e he + (hE ▸ Or.inr rfl)), add_zero] + have hmem : ∀ z, L₀ z ∈ LinearMap.ker (T.Msub C).mulVecLin := fun z => by + rw [LinearMap.mem_ker] + funext Φ + have h1 : (T.M * T.N).mulVec (ext z) Φ = 0 := by + rw [T.M_mul_N, Matrix.zero_mulVec] + rfl + rw [← Matrix.mulVec_mulVec] at h1 + have h2 : (T.Msub C).mulVecLin (L₀ z) Φ = ∑ e : C, T.M Φ e.1 * T.N.mulVec (ext z) e.1 := rfl + have h6 : (T.M.mulVec (T.N.mulVec (ext z))) Φ = ∑ e, T.M Φ e * T.N.mulVec (ext z) e := rfl + rw [h6] at h1 + change _ = (0 : K) + have h7 := Finset.sum_subtype (Finset.univ.filter (· ∈ C)) (p := (· ∈ C)) (F := inferInstanceAs + (Fintype C)) (by simp) + (fun e => T.M Φ e * T.N.mulVec (ext z) e) + have h8 : (∑ e : C, T.M Φ e.1 * T.N.mulVec (ext z) e.1) = ∑ e : {e // e ∈ C}, T.M Φ e.1 * + T.N.mulVec (ext z) e.1 := rfl + rw [h2, ← h1, h8, ← h7] + refine Finset.sum_subset (Finset.filter_subset _ _) fun e _ h3 => ?_ + have h4 : e ∈ Y := by + by_contra h5 + exact h3 (by simpa [C] using h5) + rw [hzero z e h4, mul_zero] + let L : (S → K) →ₗ[K] LinearMap.ker (T.Msub C).mulVecLin := L₀.codRestrict _ hmem + have hL : Function.Injective L := by + refine (injective_iff_map_eq_zero L).mpr fun z hz => ?_ + have h1 : L₀ z = 0 := congrArg Subtype.val hz + have h2 : T.N.mulVec (ext z) = 0 := by + funext e + by_cases he : e ∈ Y + · exact hzero z e he + · exact congrFun h1 ⟨e, he⟩ + obtain ⟨v₀, hv₀⟩ := hne + funext v + have h3 := T.ker_N_const h2 v.1 v₀ + rw [hext z v₀ hv₀] at h3 + have h4 : ext z v.1 = z v := by simp [ext, v.2] + rw [← h4, h3] + rfl + have h3 := LinearMap.finrank_le_finrank_of_injective hL + rw [Module.finrank_fintype_fun_eq_card] at h3 + have h4 := LinearMap.finrank_range_add_finrank_ker (T.Msub C).mulVecLin + rw [Module.finrank_fintype_fun_eq_card] at h4 + have h5 := T.card_le_rank_add C + rw [Matrix.rank] at h5 + have hc1 : Fintype.card S + VY.ncard = Fintype.card V := by + rw [← Nat.card_eq_fintype_card, ← Nat.card_coe_set_eq, add_comm] + have := ncard_add_ncard_compl VY + rw [Nat.card_eq_fintype_card] at this + exact this + have hc2 : Fintype.card C + Y.ncard = Fintype.card E := by + rw [← Nat.card_eq_fintype_card, ← Nat.card_coe_set_eq, add_comm] + have := ncard_add_ncard_compl Y + rw [Nat.card_eq_fintype_card] at this + exact this + have h6 : Nat.card (Quot (T.rel C)) = Nat.card (Quot (T.rel Yᶜ)) := rfl + omega + +/-- A subdivided graph in the triangulation: the edges of the graph are the paths `Y i`, whose inner +vertices are `Int i` and whose ends are `D i`. -/ +structure Subdiv {I : Type} (T : TriCx V E F) (Y : I → Set E) (Int D : I → Set V) : Prop where + disj : ∀ i j, i ≠ j → Disjoint (Y i) (Y j) + ne : ∀ i, (Y i).Nonempty + path : ∀ i, ∀ S ⊆ Y i, S.Nonempty → S ≠ Y i → ∃ w ∈ Int i, ∃ x ∈ S, ∃ x' ∈ Y i \ S, w ∈ T.ends x + ∧ w ∈ T.ends x' + deg : ∀ i, ∀ w ∈ Int i, {x | (∃ j, x ∈ Y j) ∧ w ∈ T.ends x}.ncard ≤ 2 + end_one : ∀ i, ∀ u ∈ D i, {x ∈ Y i | u ∈ T.ends x}.ncard = 1 + end_zero : ∀ i j, ∀ u ∈ D i, u ∉ D j → ∀ x ∈ Y j, u ∉ T.ends x + two : ∀ i, (D i).ncard = 2 + inj : Function.Injective D + +section Flags + +variable {I : Type} [Fintype I] {T} {Y : I → Set E} {Int D : I → Set V} + +/-- The indicator of a class of faces. -/ +noncomputable def clsInd (C : Set E) (ρ : Quot (T.rel C)) : F → K := by + classical + exact fun Φ => if Quot.mk _ Φ = ρ then 1 else 0 + +omit [Fintype V] [Fintype E] in +theorem bdry_clsInd [Finite V] [Finite E] (C : Set E) (ρ : Quot (T.rel C)) {e : E} + (he : e ∈ C) : T.bdry (clsInd C ρ) e = 0 := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite E + obtain ⟨c, d, hcd, hE⟩ := T.exists_faces e + rw [bdry, T.sum_faces e hcd hE] + have hc : T.I e c := (hE ▸ Or.inl rfl : c ∈ {Φ | T.I e Φ}) + have hd : T.I e d := (hE ▸ Or.inr rfl : d ∈ {Φ | T.I e Φ}) + have h1 : Quot.mk (T.rel C) c = Quot.mk _ d := Quot.sound ⟨e, he, hc, hd⟩ + simp only [clsInd, h1] + exact zmod_add_self _ + +omit [Fintype V] [Fintype E] in +/-- If the boundary vanishes at an edge and one face of the edge is in the set, so is the other. -/ +theorem mem_of_bdry_zero [Finite V] [Finite E] (f : F → K) {e : E} (h : T.bdry f e = 0) {Φ Φ' : F} + (hΦ : T.I e Φ) (hΦ' : T.I e Φ') : f Φ = f Φ' := by + let := Fintype.ofFinite V + let := Fintype.ofFinite E + obtain ⟨c, d, hcd, hE⟩ := T.exists_faces e + rw [bdry, T.sum_faces e hcd hE] at h + have h2 : f c = f d := CharTwo.add_eq_zero.mp h + have hp' : Φ ∈ ({c, d} : Set F) := hE ▸ hΦ + have hq' : Φ' ∈ ({c, d} : Set F) := hE ▸ hΦ' + rcases hp' with rfl | rfl <;> rcases hq' with rfl | rfl <;> simp [h2] + +omit [Fintype V] [Fintype E] in +/-- If the boundary does not vanish at an edge, then a face of the edge has `f = 1`. -/ +theorem exists_one_of_bdry [Finite V] [Finite E] (f : F → K) {e : E} (h : T.bdry f e ≠ 0) : ∃ Φ, + T.I e Φ ∧ f Φ ≠ 0 := by + let := Fintype.ofFinite V + let := Fintype.ofFinite E + obtain ⟨c, d, hcd, hE⟩ := T.exists_faces e + rw [bdry, T.sum_faces e hcd hE] at h + have hc : T.I e c := (hE ▸ Or.inl rfl : c ∈ {Φ | T.I e Φ}) + have hd : T.I e d := (hE ▸ Or.inr rfl : d ∈ {Φ | T.I e Φ}) + by_cases h1 : f c = 0 + · refine ⟨d, hd, fun h2 => h ?_⟩ + rw [h1, h2, add_zero] + · exact ⟨c, hc, h1⟩ + +theorem zmod_ne_zero {x : K} (h : x ≠ 0) : x = 1 := by + revert x + decide + +open Classical in +omit [Fintype V] in +/-- The sum of the boundary over the edges of the graph at a vertex vanishes. -/ +theorem sum_graph [Finite V] (ρ : Quot (T.rel (⋃ i, Y i)ᶜ)) (w : V) : + ∑ e ∈ Finset.univ.filter (fun e => (∃ j, e ∈ Y j) ∧ w ∈ T.ends e), T.bdry (clsInd _ ρ) e = 0 + := by + let := Fintype.ofFinite V + have h1 := T.bdry_even (clsInd _ ρ) w + rw [← h1, Finset.sum_filter] + refine Finset.sum_congr rfl fun e _ => ?_ + by_cases h2 : ∃ j, e ∈ Y j + · by_cases h3 : w ∈ T.ends e <;> simp [h2, h3] + · have h4 : e ∈ (⋃ i, Y i)ᶜ := by simpa using h2 + simp [h2, bdry_clsInd _ ρ h4] + +omit [Fintype V] [Fintype E] [Fintype I] in +/-- Two edges of the graph at a vertex of degree two have the same boundary value. -/ +theorem bdry_eq_of_deg [Finite V] [Finite E] [Finite I] (hS : T.Subdiv Y Int D) (ρ : Quot (T.rel + (⋃ i, Y i)ᶜ)) {i : I} {w : V} (hw : w ∈ Int i) {x x' : E} + (hx : ∃ j, x ∈ Y j) (hx' : ∃ j, x' ∈ Y j) (hwx : w ∈ T.ends x) (hwx' : w ∈ T.ends x') + (hne : x ≠ x') : + T.bdry (clsInd _ ρ) x = T.bdry (clsInd _ ρ) x' := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite E + let := Fintype.ofFinite I + have h1 := sum_graph ρ w + have hset : Finset.univ.filter (fun e => (∃ j, e ∈ Y j) ∧ w ∈ T.ends e) = {x, x'} := by + have hs : ({x, x'} : Finset E) ⊆ Finset.univ.filter (fun e => (∃ j, e ∈ Y j) ∧ w ∈ T.ends e) + := by + intro e he + simp only [Finset.mem_insert, Finset.mem_singleton] at he + rcases he with rfl | rfl + · simpa using ⟨hx, hwx⟩ + · simpa using ⟨hx', hwx'⟩ + refine (Finset.eq_of_subset_of_card_le hs ?_).symm + have h2 := hS.deg i w hw + rw [Finset.card_pair hne] + have h3 : ({x | (∃ j, x ∈ Y j) ∧ w ∈ T.ends x} : Set E) = ↑(Finset.univ.filter (fun e => + (∃ j, e ∈ Y j) ∧ w ∈ T.ends e)) := by + ext e + simp + rwa [h3, ncard_coe_finset] at h2 + rw [hset, Finset.sum_pair hne] at h1 + exact CharTwo.add_eq_zero.mp h1 + +/-- A class is touched by an edge if one of its faces has this edge. -/ +def Tch (C : Set E) (ρ : Quot (T.rel C)) (x : E) : Prop := ∃ Φ, T.I x Φ ∧ Quot.mk _ Φ = ρ + +omit [Fintype V] [Fintype E] [Fintype F] in +theorem clsInd_ne {C : Set E} {ρ : Quot (T.rel C)} {Φ : F} : clsInd C ρ Φ ≠ 0 ↔ Quot.mk _ Φ = ρ + := by + classical + simp only [clsInd] + by_cases h : Quot.mk (T.rel C) Φ = ρ <;> simp [h] + +omit [Fintype V] [Fintype E] [Fintype F] in +theorem exists_face [Finite V] [Finite E] [Finite F] (e : E) : ∃ Φ, T.I e Φ := by + let := Fintype.ofFinite V + let := Fintype.ofFinite E + let := Fintype.ofFinite F + obtain ⟨c, d, hcd, hE⟩ := T.exists_faces e + exact ⟨c, (hE ▸ Or.inl rfl : c ∈ {Φ | T.I e Φ})⟩ + +omit [Fintype V] [Fintype E] [Fintype F] [Fintype I] in +/-- Touching passes along a vertex of degree two, by the link condition. -/ +theorem tch_step [Finite V] [Finite E] [Finite F] [Finite I] (hS : T.Subdiv Y Int D) (ρ : Quot + (T.rel (⋃ i, Y i)ᶜ)) {i : I} {w : V} (hw : w ∈ Int i) {x x' : E} + (hx : ∃ j, x ∈ Y j) (hx' : ∃ j, x' ∈ Y j) (hwx : w ∈ T.ends x) (hwx' : w ∈ T.ends x') + (hne : x ≠ x') (ht : Tch _ ρ x) : + Tch _ ρ x' := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite E + let := Fintype.ofFinite F + let := Fintype.ofFinite I + have heq := bdry_eq_of_deg hS ρ hw hx hx' hwx hwx' hne + by_cases h0 : T.bdry (clsInd _ ρ) x' = 0 + · have h0x := heq.trans h0 + have hall : ∀ e, w ∈ T.ends e → T.bdry (clsInd _ ρ) e = 0 := fun e hwe => by + by_cases h1 : e = x + · rw [h1, h0x] + by_cases h2 : e = x' + · rw [h2, h0] + by_cases h3 : ∃ j, e ∈ Y j + · exfalso + have hsub : ({x, x', e} : Set E) ⊆ {x | (∃ j, x ∈ Y j) ∧ w ∈ T.ends x} := by + rintro y (rfl | rfl | rfl) + · exact ⟨hx, hwx⟩ + · exact ⟨hx', hwx'⟩ + · exact ⟨h3, hwe⟩ + have h4 := ncard_le_ncard hsub (Set.toFinite _) + rw [ncard_eq_three.mpr ⟨x, x', e, hne, Ne.symm h1, Ne.symm h2, rfl⟩] at h4 + have := hS.deg i w hw + omega + · exact bdry_clsInd _ ρ (by simpa using h3) + obtain ⟨Φ, hΦ, hρ⟩ := ht + obtain ⟨Φ', hΦ'⟩ := exists_face (T := T) x' + refine ⟨Φ', hΦ', ?_⟩ + have hmem : Φ' ∈ {Ψ | w ∈ T.verts Ψ ∧ Quot.mk (T.rel (⋃ i, Y i)ᶜ) Ψ = ρ} := by + refine T.link w {Ψ | w ∈ T.verts Ψ ∧ Quot.mk (T.rel (⋃ i, Y i)ᶜ) Ψ = ρ} (fun Ψ h => h.1) + (fun e hwe Ψ hΨ Ψ' h1 h2 => ⟨h2 hwe, ?_⟩) ⟨Φ, hΦ hwx, hρ⟩ Φ' (hΦ' hwx') + have h3 := mem_of_bdry_zero (clsInd _ ρ) (hall e hwe) h1 h2 + exact clsInd_ne.mp (by rw [← h3]; exact clsInd_ne.mpr hΨ.2) + exact hmem.2 + · obtain ⟨Φ, hΦ, h1⟩ := exists_one_of_bdry _ h0 + exact ⟨Φ, hΦ, clsInd_ne.mp h1⟩ + +omit [Fintype V] [Fintype E] [Fintype F] [Fintype I] in +theorem subset_all (hS : T.Subdiv Y Int D) {i : I} {P : E → Prop} + (hstep : ∀ w ∈ Int i, ∀ x ∈ Y i, ∀ x' ∈ Y i, w ∈ T.ends x → w ∈ T.ends x' → x ≠ x' → P x → P x') + {x : E} (hx : x ∈ Y i) (hP : P x) {x' : E} (hx' : x' ∈ Y i) : P x' := by + by_contra hn + have hne : {y ∈ Y i | P y} ≠ Y i := fun h => by + have h1 : x' ∈ {y ∈ Y i | P y} := by + rw [h] + exact hx' + exact hn h1.2 + obtain ⟨w, hw, y, hy, y', hy', h1, h2⟩ := hS.path i {y ∈ Y i | P y} (fun y hy + => hy.1) ⟨x, hx, hP⟩ hne + have hyne : y ≠ y' := fun h => hy'.2 (h ▸ hy) + exact hy'.2 ⟨hy'.1, hstep w hw y hy.1 y' hy'.1 h1 h2 hyne hy.2⟩ + +theorem bdry_cases (x : K) : x = 0 ∨ x = 1 := by + revert x + decide + +omit [Fintype V] [Fintype E] [Fintype F] in +/-- Each class of faces is touched by at least three edges of the graph. -/ +theorem three_le_touch [Finite V] [Finite E] [Finite F] (hS : T.Subdiv Y Int D) (hI : 3 + ≤ Fintype.card I) (ρ : Quot (T.rel (⋃ i, Y i)ᶜ)) : + 3 ≤ {i | ∃ x ∈ Y i, Tch _ ρ x}.ncard := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite E + let := Fintype.ofFinite F + by_contra hlt + push Not at hlt + have hY : ∀ {i x}, x ∈ Y i → ∃ j, x ∈ Y j := fun {i x} h => ⟨i, h⟩ + let g := T.bdry (clsInd _ ρ) + have hgall : ∀ i, ∀ x ∈ Y i, g x ≠ 0 → ∀ x' ∈ Y i, g x' ≠ 0 := fun i x hx h x' hx' => + subset_all hS (P := fun y => g y ≠ 0) (fun w hw y hy y' hy' h1 h2 hne h3 h4 => + h3 ((bdry_eq_of_deg hS ρ hw (hY hy) (hY hy') h1 h2 hne).trans h4)) hx h hx' + have htouch : ∀ i, ∀ x ∈ Y i, g x ≠ 0 → i ∈ {i | ∃ x ∈ Y i, Tch _ ρ x} := fun i x hx h => by + obtain ⟨Φ, hΦ, h1⟩ := exists_one_of_bdry _ h + exact ⟨x, hx, Φ, hΦ, clsInd_ne.mp h1⟩ + let J : Set I := {i | ∃ x ∈ Y i, g x ≠ 0} + have hJs : J ⊆ {i | ∃ x ∈ Y i, Tch _ ρ x} := fun i ⟨x, hx, h⟩ => htouch i x hx h + have hJ2 : J.ncard ≤ 2 := by + have := ncard_le_ncard hJs (Set.toFinite _) + omega + have hother : ∀ i ∈ J, ∀ u ∈ D i, ∃ j ∈ J, j ≠ i ∧ u ∈ D j := fun i ⟨x₀, hx₀, hg₀⟩ u hu => by + by_contra hn + push Not at hn + obtain ⟨x, hxs⟩ := ncard_eq_one.mp (hS.end_one i u hu) + have hxm : x ∈ {x ∈ Y i | u ∈ T.ends x} := hxs ▸ rfl + have hgx : g x ≠ 0 := hgall i x₀ hx₀ hg₀ x hxm.1 + have h1 := sum_graph ρ u + rw [Finset.sum_eq_single_of_mem x (by simpa using ⟨hY hxm.1, hxm.2⟩)] at h1 + · exact hgx h1 + · intro e he hne + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at he + obtain ⟨⟨j, hj⟩, hue⟩ := he + by_contra hge + have hjJ : j ∈ J := ⟨e, hj, hge⟩ + by_cases hij : j = i + · subst hij + have : e ∈ {x ∈ Y j | u ∈ T.ends x} := ⟨hj, hue⟩ + rw [hxs] at this + exact hne this + · by_cases huj : u ∈ D j + · exact hn j hjJ hij huj + · exact hS.end_zero i j u hu huj e hj hue + have hJe : J = ∅ := by + by_contra hc + obtain ⟨i, hi⟩ := nonempty_iff_ne_empty.mpr hc + obtain ⟨u, v, huv, hE⟩ := ncard_eq_two.mp (hS.two i) + obtain ⟨j, hj, hji, hju⟩ := hother i hi u (hE ▸ Or.inl rfl) + obtain ⟨j', hj', hji', hjv⟩ := hother i hi v (hE ▸ Or.inr rfl) + have hjj : j = j' := by + by_contra hne + have h1 : ({i, j, j'} : Set I) ⊆ J := by + rintro y (rfl | rfl | rfl) + · exact hi + · exact hj + · exact hj' + have h2 := ncard_le_ncard h1 (Set.toFinite _) + rw [ncard_eq_three.mpr ⟨i, j, j', Ne.symm hji, Ne.symm hji', hne, rfl⟩] at h2 + omega + subst hjj + have hsub : D i ⊆ D j := by + rw [hE] + rintro y (rfl | rfl) + · exact hju + · exact hjv + have h3 : D i = D j := eq_of_subset_of_ncard_le hsub (by rw [hS.two, hS.two]) (Set.toFinite _) + exact hji (hS.inj h3).symm + have hg0 : ∀ e, g e = 0 := fun e => by + by_contra hne + by_cases h1 : ∃ j, e ∈ Y j + · obtain ⟨j, hj⟩ := h1 + have : j ∈ J := ⟨e, hj, hne⟩ + rw [hJe] at this + exact this + · exact hne (bdry_clsInd _ ρ (by simpa using h1)) + have hall : {Φ | Quot.mk (T.rel (⋃ i, Y i)ᶜ) Φ = ρ} = univ := by + refine T.dual _ (fun e Φ hΦ Φ' h1 h2 => ?_) ?_ + · have h3 := mem_of_bdry_zero (clsInd _ ρ) (hg0 e) h1 h2 + exact clsInd_ne.mp (by rw [← h3]; exact clsInd_ne.mpr hΦ) + · induction ρ using Quot.ind with + | mk a => exact ⟨a, rfl⟩ + have huniv : {i | ∃ x ∈ Y i, Tch _ ρ x} = univ := by + rw [eq_univ_iff_forall] + intro i + obtain ⟨x, hx⟩ := hS.ne i + obtain ⟨Φ, hΦ⟩ := exists_face (T := T) x + have : Φ ∈ {Φ | Quot.mk (T.rel (⋃ i, Y i)ᶜ) Φ = ρ} := hall ▸ mem_univ Φ + exact ⟨x, hx, Φ, hΦ, this⟩ + rw [huniv, ncard_univ, Nat.card_eq_fintype_card] at hlt + omega + +omit [Fintype V] [Fintype E] [Fintype F] in +/-- **Three times the classes is at most twice the edges.** -/ +theorem three_classes_le [Finite V] [Finite E] [Finite F] (hS : T.Subdiv Y Int D) (hI : 3 + ≤ Fintype.card I) [Finite (Quot (T.rel (⋃ i, Y i)ᶜ))] : + 3 * Nat.card (Quot (T.rel (⋃ i, Y i)ᶜ)) ≤ 2 * Fintype.card I := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite E + let := Fintype.ofFinite F + have : Fintype (Quot (T.rel (⋃ i, Y i)ᶜ)) := Fintype.ofFinite _ + set Q := Quot (T.rel (⋃ i, Y i)ᶜ) with hQ + have hch : ∀ i, ∃ x, x ∈ Y i := fun i => hS.ne i + choose x hx using hch + have hf : ∀ i, ∃ a b, ∀ ρ : Q, (∃ y ∈ Y i, Tch _ ρ y) → ρ = a ∨ ρ = b := fun i => by + obtain ⟨c, d, hcd, hE⟩ := T.exists_faces (x i) + refine ⟨Quot.mk _ c, Quot.mk _ d, fun ρ ⟨y, hy, ht⟩ => ?_⟩ + have h1 : Tch _ ρ (x i) := subset_all hS (P := fun y => Tch _ ρ y) + (fun w hw y hy y' hy' h1 h2 hne h3 => + tch_step hS ρ hw ⟨i, hy⟩ ⟨i, hy'⟩ h1 h2 hne h3) hy ht (hx i) + obtain ⟨Φ, hΦ, rfl⟩ := h1 + have h2 : Φ ∈ ({c, d} : Set F) := hE ▸ hΦ + rcases h2 with rfl | rfl + · exact .inl rfl + · exact .inr rfl + choose a b hab using hf + let P : Q → I → Prop := fun ρ i => ∃ y ∈ Y i, Tch _ ρ y + have h1 : ∀ ρ : Q, 3 ≤ (Finset.univ.filter (P ρ)).card := fun ρ => by + have h2 := three_le_touch hS hI ρ + have h3 : ({i | ∃ x ∈ Y i, Tch _ ρ x} : Set I) = ↑(Finset.univ.filter (P ρ)) := by + ext i + simp [P] + rwa [h3, ncard_coe_finset] at h2 + have h2 : ∀ i : I, (Finset.univ.filter fun ρ => P ρ i).card ≤ 2 := fun i => by + refine (Finset.card_le_card (t := {a i, b i}) fun ρ hρ => ?_).trans Finset.card_le_two + simp only [Finset.mem_filter, Finset.mem_univ, true_and] at hρ + simpa using hab i ρ hρ + have h3 : ∑ ρ : Q, (Finset.univ.filter (P ρ)).card = ∑ i : I, (Finset.univ.filter fun ρ + => P ρ i).card := by + simp only [Finset.card_filter] + exact Finset.sum_comm + have h4 : Fintype.card Q * 3 ≤ ∑ ρ : Q, (Finset.univ.filter (P ρ)).card := by + have := Finset.card_nsmul_le_sum Finset.univ _ 3 fun ρ _ => h1 ρ + simpa using this + have h5 : ∑ i : I, (Finset.univ.filter fun ρ => P ρ i).card ≤ Fintype.card I * 2 := by + have := Finset.sum_le_card_nsmul Finset.univ _ 2 fun i _ => h2 i + simpa using this + rw [Nat.card_eq_fintype_card] + omega + +end Flags + +theorem ncard_biUnion_sum {ι α : Type*} (s : Finset ι) (f : ι → Set α) [Finite α] + (hd : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → Disjoint (f i) (f j)) : + (⋃ i ∈ s, f i).ncard = ∑ i ∈ s, (f i).ncard := by + classical + induction s using Finset.induction_on with + | empty => simp + | insert a s ha ih => + have h2 : Disjoint (f a) (⋃ i ∈ s, f i) := by + refine disjoint_iUnion₂_right.mpr fun i hi => hd a (Finset.mem_insert_self _ _) i + (Finset.mem_insert_of_mem hi) ?_ + rintro rfl + exact ha hi + rw [Finset.sum_insert ha, Finset.set_biUnion_insert, ncard_union_eq h2 (Set.toFinite _) + (Set.toFinite _), + ih (fun i hi j hj => hd i (Finset.mem_insert_of_mem hi) j (Finset.mem_insert_of_mem hj))] + +theorem ncard_biUnion_le_sum {ι α : Type*} (s : Finset ι) (f : ι → Set α) : + (⋃ i ∈ s, f i).ncard ≤ ∑ i ∈ s, (f i).ncard := by + classical + induction s using Finset.induction_on with + | empty => simp + | insert a s ha ih => + rw [Finset.sum_insert ha, Finset.set_biUnion_insert] + exact (ncard_union_le _ _).trans (by omega) + +/-- **The edge bound.** A simple graph with at least three edges in a triangulated surface has at +most `3 |V| - 3 χ` edges. -/ +theorem edges_le {I : Type} [Fintype I] {Y : I → Set E} {Int D : I → Set V} (hS : T.Subdiv Y Int D) + (hI : 3 ≤ Fintype.card I) + {VD : Set V} (hVD : VD.Nonempty) (hVY : ∀ i, ∀ x ∈ Y i, T.ends x ⊆ VD ∪ ⋃ i, Int i) + (hc : ∀ i, (Int i).ncard + 1 ≤ (Y i).ncard) : + (Fintype.card I : ℤ) ≤ 3 * VD.ncard - 3 * ((Fintype.card V : ℤ) - Fintype.card E + Fintype.card + F) := by + classical + have h1 := T.euler_le (⋃ i, Y i) (VD ∪ ⋃ i, Int i) (fun e he => by + obtain ⟨i, hi⟩ := mem_iUnion.mp he + exact hVY i e hi) (hVD.mono subset_union_left) + have h2 := three_classes_le hS hI + have h3 : (⋃ i, Y i).ncard = ∑ i, (Y i).ncard := by + have := ncard_biUnion_sum Finset.univ Y fun i _ j _ hne => hS.disj i j hne + simpa using this + have h4 : (⋃ i, Int i).ncard ≤ ∑ i, (Int i).ncard := by + have := ncard_biUnion_le_sum Finset.univ Int + simpa using this + have h5 : (VD ∪ ⋃ i, Int i).ncard ≤ VD.ncard + ∑ i, (Int i).ncard := + (ncard_union_le _ _).trans (by omega) + have h6 : ∑ i, ((Int i).ncard + 1) ≤ ∑ i, (Y i).ncard := Finset.sum_le_sum fun i _ => hc i + rw [Finset.sum_add_distrib, Finset.sum_const, Finset.card_univ, smul_eq_mul, mul_one] at h6 + omega + +omit [Fintype V] [Fintype F] in +theorem card_edges [Finite V] [Finite F] (Φ : F) [DecidablePred fun e => T.I e Φ] : + (Finset.univ.filter fun e => T.I e Φ).card = 3 := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite F + have hends : ∀ e, (Finset.univ.filter fun v => v ∈ T.ends e).card = 2 := fun e => by + have h1 := T.ends_two e + have h2 : T.ends e = ↑(Finset.univ.filter fun v => v ∈ T.ends e) := by + ext v + simp + rwa [h2, ncard_coe_finset] at h1 + have hthree : ∀ Φ, (Finset.univ.filter fun v => v ∈ T.verts Φ).card = 3 := fun Φ => by + have h1 := T.verts_three Φ + have h2 : T.verts Φ = ↑(Finset.univ.filter fun v => v ∈ T.verts Φ) := by + ext v + simp + rwa [h2, ncard_coe_finset] at h1 + have h1 : ∑ v, (Finset.univ.filter fun e => T.I e Φ ∧ v ∈ T.ends e).card = + ∑ e, (Finset.univ.filter fun v => T.I e Φ ∧ v ∈ T.ends e).card := by + simp only [Finset.card_filter] + exact Finset.sum_comm + have h2 : ∀ v, (Finset.univ.filter fun e => T.I e Φ ∧ v ∈ T.ends e).card + = if v ∈ T.verts Φ then 2 else 0 := fun v => by + by_cases hv : v ∈ T.verts Φ + · simp only [hv, ite_true] + exact T.card_at Φ hv + · simp only [hv, ite_false] + rw [Finset.card_eq_zero] + ext e + simp only [Finset.mem_filter, Finset.mem_univ, true_and, Finset.notMem_empty, iff_false, + not_and] + exact fun h1 h2 => hv (h1 h2) + have h3 : ∀ e, (Finset.univ.filter fun v => T.I e Φ ∧ v ∈ T.ends e).card + = if T.I e Φ then 2 else 0 := fun e => by + by_cases he : T.I e Φ + · simp [he, hends] + · simp [he] + simp only [h2, h3] at h1 + rw [← Finset.sum_filter, ← Finset.sum_filter, Finset.sum_const, Finset.sum_const, hthree, + smul_eq_mul, smul_eq_mul] at h1 + have h4 : (Finset.univ.filter fun e => T.I e Φ).card = 3 := by omega + convert h4 + +include T in +omit [Fintype V] in +/-- Each face has three edges and each edge has two faces. -/ +theorem three_faces [Finite V] : 3 * Fintype.card F = 2 * Fintype.card E := by + classical + let := Fintype.ofFinite V + have hfaces : ∀ e, (Finset.univ.filter fun Φ => T.I e Φ).card = 2 := fun e => by + have h1 := T.two e + have h2 : {Φ | T.ends e ⊆ T.verts Φ} = ↑(Finset.univ.filter fun Φ => T.I e Φ) := by + ext v + simp only [mem_ofPred_eq, Finset.mem_coe, Finset.mem_filter, Finset.mem_univ, true_and] + exact Iff.rfl + rwa [h2, ncard_coe_finset] at h1 + have h1 : ∑ Φ, (Finset.univ.filter fun e => T.I e Φ).card = ∑ e, (Finset.univ.filter fun Φ + => T.I e Φ).card := by + simp only [Finset.card_filter] + exact Finset.sum_comm + simp only [T.card_edges, hfaces, Finset.sum_const, Finset.card_univ, smul_eq_mul] at h1 + omega + +omit [Fintype V] [Fintype F] in +/-- The value of `M` on a function, in terms of the three edges of a face. -/ +theorem sum_three [Finite V] [Finite F] (y : E → K) (Φ : F) {e₁ e₂ e₃ : E} (h₁ : T.I e₁ Φ) + (h₂ : T.I e₂ Φ) (h₃ : T.I e₃ Φ) (h12 : e₁ ≠ e₂) + (h13 : e₁ ≠ e₃) (h23 : e₂ ≠ e₃) : T.M.mulVec y Φ = y e₁ + y e₂ + y e₃ := by + classical + let := Fintype.ofFinite V + let := Fintype.ofFinite F + have hs : ({e₁, e₂, e₃} : Finset E) ⊆ Finset.univ.filter fun e => T.I e Φ := by + intro e he + simp only [Finset.mem_insert, Finset.mem_singleton] at he + rcases he with rfl | rfl | rfl <;> simpa + have hc : ({e₁, e₂, e₃} : Finset E).card = 3 := Finset.card_eq_three.mpr ⟨e₁, e₂, e₃, h12, h13, + h23, rfl⟩ + have heq := Finset.eq_of_subset_of_card_le hs (by rw [T.card_edges, hc]) + have h1 : T.M.mulVec y Φ = ∑ e ∈ Finset.univ.filter (fun e => T.I e Φ), y e := by + simp only [mulVec, dotProduct, M, Finset.sum_filter] + refine Finset.sum_congr rfl fun e _ => ?_ + by_cases h : T.I e Φ <;> simp [h] + rw [h1, ← heq, Finset.sum_insert (by simp [h12, h13]), Finset.sum_pair h23, add_assoc] + +end TriCx + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/TriGraph.lean b/LeanPool/GraphMinor/Surface/TriGraph.lean new file mode 100644 index 0000000000..949d11429f --- /dev/null +++ b/LeanPool/GraphMinor/Surface/TriGraph.lean @@ -0,0 +1,284 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.TriPath +public import LeanPool.GraphMinor.Surface.TriCohGlue + +/-! +# Simple graphs in a surface + +A simple graph with at least three edges inside a triangulation has at most `3 |V| - 3 χ` edges, +where `χ` is the value of `|V| - |E| + |F|` on the triangulation (`IsTriang.graph_bound`). This is +the count named in the proof of Graph Minors XIX, (6.5) (page 341). By `IsTriang.euler_eq` the +number `χ` depends only on the surface. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +local notation "K" => ZMod 2 + +/-- Pull back a set to a subtype and count the elements in the intersection. -/ +theorem ncard_coe_preimage {α : Type*} (V A : Set α) : + ({v : V | v.1 ∈ A}).ncard = (A ∩ V).ncard := + ncard_val_preimage V A + +variable {X : Type} [TopologicalSpace X] [T2Space X] + +namespace IsTriang + +variable {V : Set X} {E 𝓕 : Set (Set X)} + +theorem euler_ncard (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) [ConnectedSpace X] : + ∃ κ : ℕ, Nat.card (KCl X K) = 2 ^ κ ∧ (V.ncard : ℤ) - E.ncard + 𝓕.ncard + κ = 2 := by + classical + have := h.dis.graph.fin.fintype + have := h.dis.graph.fine.fintype + have := h.dis.fin.fintype + obtain ⟨κ, h1, h2⟩ := h.euler_eq hT + refine ⟨κ, h1, ?_⟩ + rw [← Nat.card_coe_set_eq V, ← Nat.card_coe_set_eq E, ← Nat.card_coe_set_eq 𝓕, + Nat.card_eq_fintype_card, Nat.card_eq_fintype_card, + Nat.card_eq_fintype_card] + exact h2 + +/-- No vertex cuts the graph of a triangulation: a part of the graph without `w`, closed under the +edges that miss `w`, is all of it. The neighbours of `w` lie on one cycle, by `IsTriang.link_conn`. +-/ +theorem conn_minus (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) [ConnectedSpace X] {w : X} + (hw : w ∈ V) {S : Set X} + (hS : ∀ e ∈ E, ∀ a ∈ e ∩ V, ∀ b ∈ e ∩ V, a ≠ w → b ≠ w → a ∈ S → b ∈ S) (hne : (S ∩ + (V \ {w})).Nonempty) : V \ {w} ⊆ S := by + classical + have := h.dis.graph.fin.fintype + have := h.dis.graph.fine.fintype + have := h.dis.fin.fintype + have hF1 : ∀ Φ ∈ 𝓕, ∀ a ∈ Φ ∩ V, ∀ b ∈ Φ ∩ V, a ≠ w → b ≠ w → a ∈ S → b ∈ S + := fun Φ hΦ a ha b hb haw hbw has => by + by_cases hab : a = b + · exact hab ▸ has + · obtain ⟨e, he, -, hi⟩ := h.face_pair hΦ ha hb hab + have h1 : a ∈ e ∩ V := hi ▸ .inl rfl + have h2 : b ∈ e ∩ V := hi ▸ .inr rfl + exact hS e he a h1 b h2 haw hbw has + let N : Set X := {y | y ∈ V ∧ y ≠ w ∧ ∃ e ∈ E, w ∈ e ∧ y ∈ e} + let 𝓐 : Set (Set X) := {Φ | Φ ∈ 𝓕 ∧ w ∈ Φ ∧ ∀ z ∈ Φ ∩ V, z ≠ w → z ∈ S} + have hmem𝓐 : ∀ Φ ∈ 𝓕, w ∈ Φ → ∀ z ∈ Φ ∩ V, z ≠ w → z ∈ S → Φ ∈ 𝓐 := fun Φ hΦ hwΦ z hz hzw hzS => + ⟨hΦ, hwΦ, fun t ht htw => hF1 Φ hΦ z hz t ht hzw htw hzS⟩ + have hall : ∀ x ∈ N, x ∈ S → N ⊆ S := by + rintro x ⟨hxV, hxw, e₀, he₀, hwe₀, hxe₀⟩ hxS y ⟨hyV, hyw, e₁, he₁, hwe₁, hye₁⟩ + obtain ⟨Φ₀, -, -, hΦ₀, hsub₀, -⟩ := h.exists_edge_face ⟨e₀, he₀⟩ + obtain ⟨Φ₁, -, -, hΦ₁, hsub₁, -⟩ := h.exists_edge_face ⟨e₁, he₁⟩ + have h0 : Φ₀ ∈ 𝓐 := hmem𝓐 Φ₀ hΦ₀ (hsub₀ hwe₀) x ⟨hsub₀ hxe₀, hxV⟩ hxw hxS + have hl : Φ₁ ∈ 𝓐 := h.link_conn hT hw (𝓐 := 𝓐) (fun Φ hΦ => hΦ.1) (fun Φ hΦ => hΦ.2.1) + (fun e he hwe Φ hΦ Φ' hΦ' hs hs' => by + obtain ⟨p, q, hpq, -, hi⟩ := h.dis.graph.edge e he + have hwi : w ∈ e ∩ V := ⟨hwe, hw⟩ + have hpm : p ∈ e ∩ V := hi ▸ .inl rfl + have hqm : q ∈ e ∩ V := hi ▸ .inr rfl + obtain ⟨z, hz, hzw⟩ : ∃ z ∈ e ∩ V, z ≠ w := by + by_cases hp : p = w + · exact ⟨q, hqm, fun hq => hpq (hp.trans hq.symm)⟩ + · exact ⟨p, hpm, hp⟩ + exact hmem𝓐 Φ' hΦ' (hs' hwe) z ⟨hs' hz.1, hz.2⟩ hzw (hΦ.2.2 z ⟨hs hz.1, hz.2⟩ hzw)) ⟨Φ₀, + h0⟩ hΦ₁ (hsub₁ hwe₁) + exact hl.2.2 y ⟨hsub₁ hye₁, hyV⟩ hyw + obtain ⟨a₀, ha₀S, ha₀V⟩ := hne + by_cases hN : (N ∩ S).Nonempty + · obtain ⟨x, hxN, hxS⟩ := hN + have hNS := hall x hxN hxS + have hV : V ⊆ S ∪ {w} := h.graph_conn (S := S ∪ {w}) (fun e he a ha b hb has => by + by_cases hbw : b = w + · exact .inr hbw + by_cases haw : a = w + · subst haw + exact .inl (hNS ⟨hb.2, hbw, e, he, ha.1, hb.1⟩) + · exact .inl (hS e he a ha b hb haw hbw (has.resolve_right haw))) ⟨a₀, .inl ha₀S, ha₀V.1⟩ + exact fun y hy => (hV hy.1).resolve_right hy.2 + · exfalso + have hV : V ⊆ S \ {w} := h.graph_conn (S := S \ {w}) (fun e he a ha b hb has => by + have hbw : b ≠ w := fun hbw => hN ⟨a, ⟨ha.2, has.2, e, he, hbw ▸ hb.1, ha.1⟩, has.1⟩ + exact ⟨hS e he a ha b hb has.2 hbw has.1, hbw⟩) ⟨a₀, ⟨ha₀S, ha₀V.2⟩, ha₀V.1⟩ + exact (hV hw).2 rfl + +/-- **The edge bound in a surface.** -/ +theorem graph_bound (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) [ConnectedSpace X] {V₀ : Set X} + {E₀ : Set (Set X)} + (hg : IsGraph V₀ E₀) (hV : V₀ ⊆ V) (hU : ⋃₀ E₀ ⊆ ⋃₀ E) (hs : ∀ e ∈ E₀, ∀ f ∈ E₀, e ∩ V₀ + = f ∩ V₀ → e = f) + (h3 : 3 ≤ E₀.ncard) : (E₀.ncard : ℤ) ≤ 3 * V₀.ncard - 3 * ((V.ncard : ℤ) - E.ncard + 𝓕.ncard) + := by + classical + have := h.dis.graph.fin.fintype + have := h.dis.graph.fine.fintype + have := h.dis.fin.fintype + have := hg.fine.fintype + have hne𝓕 := h.nonempty_faces + have hdata : ∀ i : E₀, ∃ (u v : X) (Y : Set (Set X)), u ≠ v ∧ IsLineWithEnds i.1 u v ∧ i.1 ∩ V₀ + = {u, v} ∧ Y ⊆ E ∧ + (∀ x ∈ Y, x ⊆ i.1) ∧ ⋃₀ Y = i.1 ∧ ((i.1 ∩ V) \ {u, v}).ncard + 1 ≤ Y.ncard ∧ + (∀ w ∈ (i.1 ∩ V) \ {u, v}, {x ∈ Y | w ∈ x}.ncard ≤ 2) ∧ {x ∈ Y | u ∈ x}.ncard = 1 + ∧ {x ∈ Y | v ∈ x}.ncard = 1 := fun i => by + obtain ⟨u, v, huv, hl, hi⟩ := hg.edge i.1 i.2 + have hu : u ∈ i.1 ∩ V₀ := hi ▸ Or.inl rfl + have hv : v ∈ i.1 ∩ V₀ := hi ▸ Or.inr rfl + obtain ⟨Y, h1, h2, h4, h5, h6, h7, h8⟩ := h.dis.graph.exists_subdiv _ rfl hl huv (hV hu.2) + (hV hv.2) + (fun y hy => .inr (hU ⟨i.1, i.2, hy⟩)) + exact ⟨u, v, Y, huv, hl, hi, h1, h2, h4, h5, h6, h7, h8⟩ + choose u v Y₀ huv hl hi hYE hYs hYU hYc hYd hYu hYv using hdata + let Y : E₀ → Set E := fun i => {x | x.1 ∈ Y₀ i} + let Int : E₀ → Set V := fun i => {w | w.1 ∈ (i.1 ∩ V) \ {u i, v i}} + let D : E₀ → Set V := fun i => {w | w.1 ∈ i.1 ∩ V₀} + have hcard : ∀ i, (Int i).ncard + 1 ≤ (Y i).ncard := fun i => by + have h1 : (Int i).ncard = ((i.1 ∩ V) \ {u i, v i}).ncard := by + rw [ncard_coe_preimage] + congr 1 + ext y + exact ⟨fun h' => h'.1, fun h' => ⟨h', h'.1.2⟩⟩ + have h2 : (Y i).ncard = (Y₀ i).ncard := by + rw [ncard_coe_preimage, inter_eq_left.mpr (hYE i)] + rw [h1, h2] + exact hYc i + have hne : ∀ i, ∃ x, x ∈ Y₀ i ∧ u i ∈ x := fun i => by + obtain ⟨x, hx⟩ := ncard_eq_one.mp (hYu i) + have : x ∈ {x ∈ Y₀ i | u i ∈ x} := hx ▸ rfl + exact ⟨x, this.1, this.2⟩ + have hcl : ∀ i, ∀ x ∈ Y₀ i, IsClosed x := fun i x hx => by + obtain ⟨p, q, -, hl', -⟩ := h.dis.graph.edge x (hYE i hx) + exact hl'.isCompact.isClosed + have hend : ∀ i j : E₀, i ≠ j → ∀ w ∈ i.1, w ∈ j.1 → w ∈ V₀ := fun i j hij w h1 h2 => + hg.disj i.1 i.2 j.1 j.2 (fun h' => hij (Subtype.ext h')) ⟨h1, h2⟩ + have hS : (h.cx hT).Subdiv Y Int D := by + refine ⟨?_, ?_, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro i j hij + refine Set.disjoint_left.mpr fun x h1 h2 => ?_ + obtain ⟨y, hy, hyV⟩ := h.exists_inner x.2 + exact hyV (hV (hend i j hij y (hYs i _ h1 hy) (hYs j _ h2 hy))) + · intro i + obtain ⟨x, hx, -⟩ := hne i + exact ⟨⟨x, hYE i hx⟩, hx⟩ + · intro i S hSs hSne hSn + let A : Set (Set X) := Subtype.val '' S + let B : Set (Set X) := Y₀ i \ A + have hAs : A ⊆ Y₀ i := by + rintro _ ⟨x, hx, rfl⟩ + exact hSs hx + have hfin : (Y₀ i).Finite := h.dis.graph.fine.subset (hYE i) + have hAc : IsClosed (⋃₀ A) := (hfin.subset hAs).isClosed_sUnion fun x hx => hcl i x (hAs hx) + have hBc : IsClosed (⋃₀ B) := (hfin.subset sdiff_subset).isClosed_sUnion fun x hx + => hcl i x hx.1 + have hBne : B.Nonempty := by + by_contra hc + rw [not_nonempty_iff_eq_empty] at hc + apply hSn + refine Subset.antisymm hSs fun x hx => ?_ + have h1 : x.1 ∈ Y₀ i := hx + by_contra h2 + have h3 : x.1 ∈ B := ⟨h1, fun ⟨y, hy, h4⟩ => h2 ((Subtype.ext h4 : y = x) ▸ hy)⟩ + rw [hc] at h3 + exact h3 + obtain ⟨x₁, hx₁⟩ := hBne + obtain ⟨x₀, hx₀⟩ := hSne + obtain ⟨y₀, hy₀, -⟩ := h.exists_inner x₀.2 + obtain ⟨y₁, hy₁, -⟩ := h.exists_inner (hYE i hx₁.1) + obtain ⟨z, hz, ⟨a, ha, hza⟩, ⟨b, hb, hzb⟩⟩ := isPreconnected_closed_iff.mp + (hl i).isPreconnected_self _ _ hAc hBc (fun y hy => by + have : y ∈ ⋃₀ Y₀ i := by rwa [hYU i] + obtain ⟨x, hx, hyx⟩ := this + by_cases hxA : x ∈ A + · exact .inl ⟨x, hxA, hyx⟩ + · exact .inr ⟨x, ⟨hx, hxA⟩, hyx⟩) ⟨y₀, hYs i _ (hSs hx₀) hy₀, x₀.1, ⟨x₀, hx₀, rfl⟩, hy₀⟩ + ⟨y₁, hYs i _ hx₁.1 hy₁, x₁, hx₁, hy₁⟩ + have hne' : a ≠ b := fun h' => hb.2 (h' ▸ ha) + have hzV : z ∈ V := h.dis.graph.disj a (hYE i (hAs ha)) b (hYE i hb.1) hne' ⟨hza, hzb⟩ + have huniq : ∀ {c : X}, {x ∈ Y₀ i | c ∈ x}.ncard = 1 → c ≠ z := fun {c} hc hcz => by + obtain ⟨x, hx⟩ := ncard_eq_one.mp hc + have h1 : a ∈ {x ∈ Y₀ i | c ∈ x} := ⟨hAs ha, hcz ▸ hza⟩ + have h2 : b ∈ {x ∈ Y₀ i | c ∈ x} := ⟨hb.1, hcz ▸ hzb⟩ + rw [hx] at h1 h2 + exact hne' (h1.trans h2.symm) + obtain ⟨a', ha', rfl⟩ := ha + refine ⟨⟨z, hzV⟩, ⟨⟨hz, hzV⟩, ?_⟩, a', ha', ⟨b, hYE i hb.1⟩, ⟨hb.1, fun h' => hb.2 ⟨_, h', + rfl⟩⟩, hza, hzb⟩ + rintro (h1 | h1) + · exact huniq (hYu i) h1.symm + · exact huniq (hYv i) h1.symm + · intro i w hw + have hsub : Subtype.val '' {x : E | (∃ j, x ∈ Y j) ∧ w ∈ (h.cx hT).ends x} ⊆ {x ∈ Y₀ i | w.1 + ∈ x} := by + rintro _ ⟨x, ⟨⟨j, hj⟩, hwx⟩, rfl⟩ + have hwx' : w.1 ∈ x.1 := hwx + have hji : j = i := by + by_contra hne' + have h1 : w.1 ∈ V₀ := hend i j (Ne.symm hne') w.1 hw.1.1 (hYs j _ hj hwx') + have h2 : w.1 ∈ ({u i, v i} : Set X) := hi i ▸ ⟨hw.1.1, h1⟩ + exact hw.2 h2 + subst hji + exact ⟨hj, hwx'⟩ + have h1 := ncard_le_ncard hsub ((h.dis.graph.fine.subset (hYE i)).subset fun x hx => hx.1) + rw [ncard_image_of_injective _ Subtype.val_injective] at h1 + exact h1.trans (hYd i w.1 hw) + · intro i w hw + have hE : {x ∈ Y i | w ∈ (h.cx hT).ends x}.ncard = {x ∈ Y₀ i | w.1 ∈ x}.ncard := by + have h1 := ncard_coe_preimage E {x ∈ Y₀ i | w.1 ∈ x} + rw [inter_eq_left.mpr fun x (hx : x ∈ {x ∈ Y₀ i | w.1 ∈ x}) => hYE i hx.1] at h1 + exact h1 + rw [hE] + have h2 : w.1 ∈ ({u i, v i} : Set X) := hi i ▸ hw + rcases h2 with h2 | h2 + · rw [h2] + exact hYu i + · rw [h2] + exact hYv i + · intro i j w hw hwn x hx hwx + exact hwn ⟨hYs j _ hx hwx, hw.2⟩ + · intro i + have h1 : (D i).ncard = ((i.1 ∩ V₀) ∩ V).ncard := ncard_coe_preimage V (i.1 ∩ V₀) + have h2 : (i.1 ∩ V₀) ∩ V = i.1 ∩ V₀ := inter_eq_left.mpr fun y hy => hV hy.2 + rw [h1, h2, hi i, ncard_pair (huv i)] + · intro i j hij + have hij' : {w : V | w.1 ∈ i.1 ∩ V₀} = {w : V | w.1 ∈ j.1 ∩ V₀} := hij + refine Subtype.ext (hs i.1 i.2 j.1 j.2 ?_) + ext y + constructor + · intro hy + have : (⟨y, hV hy.2⟩ : V) ∈ {w : V | w.1 ∈ j.1 ∩ V₀} := hij' ▸ hy + exact this + · intro hy + have : (⟨y, hV hy.2⟩ : V) ∈ {w : V | w.1 ∈ i.1 ∩ V₀} := hij'.symm ▸ hy + exact this + have hI : 3 ≤ Fintype.card E₀ := by + rw [← Nat.card_eq_fintype_card, Nat.card_coe_set_eq] + exact h3 + have hVne : ({w : V | w.1 ∈ V₀} : Set V).Nonempty := by + obtain ⟨i⟩ : Nonempty E₀ := Fintype.card_pos_iff.mp (by omega) + have hu : u i ∈ i.1 ∩ V₀ := hi i ▸ Or.inl rfl + exact ⟨⟨u i, hV hu.2⟩, hu.2⟩ + have hb := (h.cx hT).edges_le hS hI hVne (fun i x hx w hw => by + have hw' : w.1 ∈ x.1 := hw + by_cases h1 : w.1 ∈ ({u i, v i} : Set X) + · have h2 : w.1 ∈ i.1 ∩ V₀ := (hi i).symm ▸ h1 + exact .inl h2.2 + · exact .inr (mem_iUnion.mpr ⟨i, ⟨hYs i _ hx hw', w.2⟩, h1⟩)) hcard + have e0 : ({w : V | w.1 ∈ V₀} : Set V).ncard = V₀.ncard := by + rw [ncard_coe_preimage, inter_eq_left.mpr hV] + rw [e0] at hb + rw [← Nat.card_coe_set_eq E₀, ← Nat.card_coe_set_eq V, ← Nat.card_coe_set_eq E, + ← Nat.card_coe_set_eq 𝓕, Nat.card_eq_fintype_card, + Nat.card_eq_fintype_card, Nat.card_eq_fintype_card, Nat.card_eq_fintype_card] + exact hb + +end IsTriang + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/TriLocal.lean b/LeanPool/GraphMinor/Surface/TriLocal.lean new file mode 100644 index 0000000000..2d982faea8 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/TriLocal.lean @@ -0,0 +1,504 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Triangulate +public import Mathlib.Analysis.Normed.Module.Connected +public import Mathlib.LinearAlgebra.Complex.FiniteDimensional +import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# Local structure of a triangulation + +We read off the combinatorics of a triangulation of a connected closed surface (`IsTriang`): each +edge lies in exactly two faces, each face has three edges, two vertices of a face are joined by an +edge of the face, the graph is connected, faces are connected through common edges, and the faces at +a vertex are connected through common edges at the vertex. The topological inputs are that a +connected open set of a surface stays connected when a point is removed, and that a surface has no +boundary point. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +local notation "𝕀" => unitInterval + +variable {X : Type} [TopologicalSpace X] + +theorem punctured_unit_ball : IsPreconnected (ball (0 : ℂ) 1 \ {0}) := by + have hs : IsPreconnected (sphere (0 : ℂ) 1) := isPreconnected_sphere (by + rw [Complex.rank_real_complex] + norm_num) 0 1 + have h1 : IsPreconnected (Ioo (0 : ℝ) 1 ×ˢ sphere (0 : ℂ) 1) := isPreconnected_Ioo.prod hs + have h2 := h1.image (fun p : ℝ × ℂ => (p.1 : ℂ) * p.2) (by fun_prop) + convert h2 using 1 + ext x + constructor + · rintro ⟨h3, h4⟩ + have h5 : x ≠ 0 := h4 + have h6 : 0 < ‖x‖ := norm_pos_iff.mpr h5 + refine ⟨(‖x‖, x / ‖x‖), ⟨⟨h6, by simpa using h3⟩, ?_⟩, ?_⟩ + · simp [h6.ne'] + · have : (‖x‖ : ℂ) ≠ 0 := by exact_mod_cast h6.ne' + simp only + field_simp + · rintro ⟨⟨r, z⟩, ⟨h3, h4⟩, rfl⟩ + have h5 : ‖z‖ = 1 := by simpa using h4 + have h6 : (r : ℂ) ≠ 0 := by exact_mod_cast h3.1.ne' + have h7 : z ≠ 0 := fun h => by simp [h] at h5 + constructor + · simp [h5, abs_of_pos h3.1, h3.2] + · simp [h6, h7] + +theorem BallChart.isPreconnected_punctured {U : Set X} {h : X → ℂ} {g : ℂ → X} + (c : BallChart 1 U h g) : + IsPreconnected (U \ {g 0}) := by + have h1 := punctured_unit_ball.image g (c.gc.mono sdiff_subset) + convert h1 using 1 + ext x + constructor + · rintro ⟨h2, h3⟩ + refine ⟨h x, ⟨c.hm h2, fun h4 => h3 ?_⟩, c.gh h2⟩ + rw [← c.gh h2, show h x = 0 from h4] + rfl + · rintro ⟨y, ⟨h2, h3⟩, rfl⟩ + refine ⟨c.gm h2, fun h4 => h3 ?_⟩ + have h5 := c.hg h2 + rw [show g y = g 0 from h4, c.hg (by simp)] at h5 + exact h5.symm + +/-- A boundary point of a closed disc in a closed surface is a limit of points outside the disc. -/ +theorem not_nhds_of_mem_discBd {Φ W : Set X} {x : X} (hi : IsInteriorPoint x) (hx : x ∈ discBd Φ) + (hW : IsOpen W) + (hxW : x ∈ W) (hWΦ : W ⊆ Φ) : False := by + obtain ⟨⟨y, hxΦ⟩, hb, rfl⟩ := hx + apply hb + obtain ⟨U, hU, hyU, hsub, ⟨f⟩⟩ := hi.exists_subset hW hxW + refine ⟨Subtype.val ⁻¹' U, hU.preimage continuous_subtype_val, hyU, ⟨?_⟩⟩ + refine Homeomorph.trans ?_ f + exact + { toFun := fun z => ⟨z.1.1, z.2⟩ + invFun := fun z => ⟨⟨z.1, hWΦ (hsub z.2)⟩, z.2⟩ + left_inv := fun z => rfl + right_inv := fun z => rfl + continuous_toFun := by fun_prop + continuous_invFun := by fun_prop } + +variable [T2Space X] + +/-- Removing a point from a connected open set of a closed surface leaves a connected set. -/ +theorem IsPreconnected.diff_point (hT : IsClosedSurface X) {U : Set X} (hU : IsPreconnected U) + (hUo : IsOpen U) (p : X) : + IsPreconnected (U \ {p}) := by + by_cases hp : p ∈ U + swap + · rwa [sdiff_singleton_eq_self hp] + obtain ⟨B, h, g, c, hBU, hg0⟩ := (hT.2.2 p).exists_ballChart hUo hp (R := 1) one_pos + have hpc := c.isPreconnected_punctured + rw [hg0] at hpc + have hpB : p ∈ B := hg0 ▸ c.gm (by simp) + rw [isPreconnected_iff_subset_of_disjoint] at hU ⊢ + intro A A' hA hA' hcov hd + have hopen : IsOpen (U \ {p}) := hUo.sdiff isClosed_singleton + have hAo := hA.inter hopen + have hAo' := hA'.inter hopen + have hcase : B \ {p} ⊆ A ∨ B \ {p} ⊆ A' := by + refine isPreconnected_iff_subset_of_disjoint.mp hpc A A' hA hA' ((sdiff_subset_sdiff_left + hBU).trans hcov) ?_ + refine Set.eq_empty_iff_forall_notMem.mpr fun y hy => ?_ + have : y ∈ (U \ {p}) ∩ (A ∩ A') := ⟨⟨hBU hy.1.1, hy.1.2⟩, hy.2⟩ + rw [hd] at this + exact this + have main : ∀ {A A' : Set X}, IsOpen A → IsOpen A' → U \ {p} ⊆ A ∪ A' → (U \ {p}) ∩ (A ∩ A') = ∅ + → B \ {p} ⊆ A → + U \ {p} ⊆ A ∨ U \ {p} ⊆ A' := by + intro A A' hA hA' hcov hd hB + have h1 := hU ((A ∩ (U \ {p})) ∪ B) (A' ∩ (U \ {p})) ((hA.inter hopen).union c.isOpen) + (hA'.inter hopen) (fun y hy => by + by_cases hyp : y = p + · exact .inl (.inr (hyp ▸ hpB)) + · rcases hcov ⟨hy, hyp⟩ with h2 | h2 + · exact .inl (.inl ⟨h2, hy, hyp⟩) + · exact .inr ⟨h2, hy, hyp⟩) (by + refine Set.eq_empty_iff_forall_notMem.mpr ?_ + rintro y ⟨-, h2 | h2, ⟨h3, h4⟩⟩ + · have : y ∈ (U \ {p}) ∩ (A ∩ A') := ⟨h4, h2.1, h3⟩ + rw [hd] at this + exact this + · have h5 : y ∈ A := hB ⟨h2, h4.2⟩ + have : y ∈ (U \ {p}) ∩ (A ∩ A') := ⟨h4, h5, h3⟩ + rw [hd] at this + exact this) + rcases h1 with h1 | h1 + · left + intro y hy + rcases h1 hy.1 with h2 | h2 + · exact h2.1 + · exact hB ⟨h2, hy.2⟩ + · right + intro y hy + exact (h1 hy.1).1 + rcases hcase with h1 | h1 + · exact main hA hA' hcov hd h1 + · rcases main hA' hA (by rwa [union_comm]) (by rwa [inter_comm A']) h1 with h2 | h2 + · exact .inr h2 + · exact .inl h2 + +/-- A connected closed surface stays connected when finitely many points are removed. -/ +theorem isPreconnected_compl_finite (hT : IsClosedSurface X) [ConnectedSpace X] {P : Set X} + (hP : P.Finite) : + IsPreconnected Pᶜ := by + induction P, hP using Set.Finite.induction_on with + | empty => simpa using isPreconnected_univ + | @insert a s _ hs ih => + have h1 := IsPreconnected.diff_point hT ih hs.isClosed.isOpen_compl a + convert h1 using 1 + ext y + simp only [mem_compl_iff, mem_insert_iff, not_or, mem_sdiff, mem_singleton_iff] + tauto + +namespace IsTriang + +variable {V : Set X} {E 𝓕 : Set (Set X)} + +omit [T2Space X] in +theorem mem_bd (h : IsTriang V E 𝓕) {Φ : Set X} (hΦ : Φ ∈ 𝓕) {y : X} (hy : y ∈ Φ) + (hyE : y ∈ ⋃₀ E) : y ∈ discBd Φ := by + by_contra hn + exact Set.disjoint_left.mp (h.dis.int Φ hΦ) ⟨hy, hn⟩ hyE + +omit [T2Space X] in +theorem mem_bd_of_ne (h : IsTriang V E 𝓕) {Φ Φ' : Set X} (hΦ : Φ ∈ 𝓕) (hΦ' : Φ' ∈ 𝓕) + (hne : Φ ≠ Φ') {y : X} (hy : y ∈ Φ) + (hy' : y ∈ Φ') : y ∈ discBd Φ := by + by_contra hn + exact Set.disjoint_left.mp (h.dis.disj Φ hΦ Φ' hΦ' hne) ⟨hy, hn⟩ hy' + +/-- A face that contains an inner point of an edge has this edge on its boundary. -/ +theorem edge_sub (h : IsTriang V E 𝓕) {e Φ : Set X} (he : e ∈ E) (hΦ : Φ ∈ 𝓕) {x : X} (hxe : x ∈ e) + (hxV : x ∉ V) (hxΦ : x ∈ Φ) : + e ⊆ discBd Φ := by + have hb := h.mem_bd hΦ hxΦ ⟨e, he, hxe⟩ + have hO := (h.dis.disc Φ hΦ).isOArc_discBd + rcases h.dis.graph.edge_or hO ((h.dis.bd Φ hΦ).trans subset_union_right) he with h1 | h1 + · exact h1 + · exact absurd hb (Set.disjoint_left.mp h1 ⟨hxe, hxV⟩) + +omit [T2Space X] in +theorem exists_inner (h : IsTriang V E 𝓕) {e : Set X} (he : e ∈ E) : ∃ x ∈ e, x ∉ V := by + obtain ⟨u, v, huv, hl, hi⟩ := h.dis.graph.edge e he + have hne : (e \ {u, v}).Nonempty := hl.nonempty_sdiff + obtain ⟨x, hx, hn⟩ := hne + exact ⟨x, hx, fun hV => hn (hi ▸ ⟨hx, hV⟩)⟩ + +omit [T2Space X] in +theorem ends_ncard (h : IsTriang V E 𝓕) {e : Set X} (he : e ∈ E) : (e ∩ V).ncard = 2 := by + obtain ⟨u, v, huv, -, hi⟩ := h.dis.graph.edge e he + rw [hi, ncard_pair huv] + +/-- Two vertices of a face are joined by an edge on the boundary of the face. -/ +theorem face_pair (h : IsTriang V E 𝓕) {Φ : Set X} (hΦ : Φ ∈ 𝓕) {a b : X} (ha : a ∈ Φ ∩ V) + (hb : b ∈ Φ ∩ V) (hab : a ≠ b) : + ∃ e ∈ E, e ⊆ discBd Φ ∧ e ∩ V = {a, b} := by + classical + have hfinV := h.dis.graph.fin + have hVb : ∀ y ∈ Φ ∩ V, y ∈ discBd Φ := fun y hy => h.mem_bd hΦ hy.1 (h.cov hy.2) + have h3 := h.three Φ hΦ + have hsub : ({a, b} : Set X) ⊆ Φ ∩ V := insert_subset ha (singleton_subset_iff.mpr hb) + have hc1 : ((Φ ∩ V) \ {a, b}).ncard = 1 := by + rw [ncard_sdiff hsub (Set.toFinite _), h3, ncard_pair hab] + obtain ⟨c, hc⟩ := ncard_eq_one.mp hc1 + have hcm : c ∈ (Φ ∩ V) \ {a, b} := hc ▸ rfl + have hall : ∀ y ∈ Φ ∩ V, y = a ∨ y = b ∨ y = c := fun y hy => by + by_cases h1 : y = a ∨ y = b + · rcases h1 with h1 | h1 + · exact .inl h1 + · exact .inr (.inl h1) + · have : y ∈ (Φ ∩ V) \ {a, b} := ⟨hy, h1⟩ + rw [hc] at this + exact .inr (.inr this) + obtain ⟨a₁, a₂, hTwo, h0, h1, hu⟩ := (h.dis.disc Φ hΦ).isOArc_discBd.exists_arcs (hVb a ha) + (hVb b hb) hab + have hl₁ : IsLineWithEnds (range a₁) a b := by + have := hTwo.arc_left.isLineWithEnds + rwa [h0, h1] at this + have hl₂ : IsLineWithEnds (range a₂) a b := by + have := hTwo.arc_right.isLineWithEnds + rwa [hTwo.zero, hTwo.one, h0, h1] at this + have hinter : range a₁ ∩ range a₂ = {a, b} := by + rw [hTwo.inter, h0, h1] + have main : ∀ {L L' : Set X}, IsLineWithEnds L a b → L ∪ L' = discBd Φ → L ∩ L' = {a, b} + → IsClosed L' → c ∉ L → + ∃ e ∈ E, e ⊆ discBd Φ ∧ e ∩ V = {a, b} := by + intro L L' hL hLu hLi hL' hcL + have hne : (L \ {a, b}).Nonempty := hL.nonempty_sdiff + obtain ⟨x, hx, hxn⟩ := hne + have hxb : x ∈ discBd Φ := hLu ▸ .inl hx + have hxV : x ∉ V := fun hV => by + rcases hall x ⟨discBd_subset Φ hxb, hV⟩ with h2 | h2 | h2 + · exact hxn (.inl h2) + · exact hxn (.inr h2) + · exact hcL (h2 ▸ hx) + obtain ⟨e, he, hxe⟩ := h.dis.bd Φ hΦ hxb + have hes := h.edge_sub he hΦ hxe hxV (discBd_subset Φ hxb) + obtain ⟨u, v, huv, hl, hi⟩ := h.dis.graph.edge e he + have hdiff : e \ {u, v} ⊆ L := by + have hp : IsPreconnected (e \ {u, v}) := hl.isPreconnected_diff + by_contra hns + obtain ⟨y, hy, hyL⟩ := not_subset.mp hns + have hxe' : x ∈ e \ {u, v} := ⟨hxe, fun h2 => hxV (hi ▸ h2 |> fun h3 : x ∈ e ∩ V => h3.2)⟩ + have hyL' : y ∈ L' := by + have : y ∈ L ∪ L' := hLu ▸ hes hy.1 + exact this.resolve_left hyL + obtain ⟨z, hz, hz1, hz2⟩ := isPreconnected_closed_iff.mp hp L L' hL.isCompact.isClosed hL' + (fun w hw => by + have : w ∈ discBd Φ := hes hw.1 + rwa [← hLu] at this) ⟨x, hxe', hx⟩ ⟨y, hy, hyL'⟩ + have hzab : z ∈ L ∩ L' := ⟨hz1, hz2⟩ + rw [hLi] at hzab + have hzV : z ∈ V := by + rcases hzab with rfl | rfl + · exact ha.2 + · exact hb.2 + exact hz.2 (hi ▸ (⟨hz.1, hzV⟩ : z ∈ e ∩ V)) + have hesL : e ⊆ L := hl.subset_closure_diff.trans (closure_minimal hdiff hL.isCompact.isClosed) + refine ⟨e, he, hes, ?_⟩ + have hs : e ∩ V ⊆ {a, b} := by + rintro y ⟨h2, h3⟩ + rcases hall y ⟨discBd_subset Φ (hes h2), h3⟩ with h4 | h4 | h4 + · exact .inl h4 + · exact .inr h4 + · exact absurd (h4 ▸ hesL h2) hcL + exact eq_of_subset_of_ncard_le hs (by rw [ncard_pair hab, h.ends_ncard he]) (by simp) + by_cases hcl : c ∈ range a₁ + · have hcl₂ : c ∉ range a₂ := fun h2 => hcm.2 (hinter ▸ ⟨hcl, h2⟩) + exact main hl₂ (by rw [union_comm, hu]) (by rw [inter_comm, hinter]) hl₁.isCompact.isClosed hcl₂ + · exact main hl₁ hu hinter hl₂.isCompact.isClosed hcl + +/-- An edge lies in a face as soon as its two ends do. -/ +theorem sub_iff (h : IsTriang V E 𝓕) {e Φ : Set X} (he : e ∈ E) (hΦ : Φ ∈ 𝓕) : e ⊆ Φ ↔ e ∩ V ⊆ Φ + := by + refine ⟨fun h1 => inter_subset_left.trans h1, fun h1 => ?_⟩ + obtain ⟨u, v, huv, -, hi⟩ := h.dis.graph.edge e he + have hu : u ∈ e ∩ V := hi ▸ .inl rfl + have hv : v ∈ e ∩ V := hi ▸ .inr rfl + obtain ⟨f, hf, h2, h3⟩ := h.face_pair hΦ ⟨h1 hu, hu.2⟩ ⟨h1 hv, hv.2⟩ huv + rw [h.simple e he f hf (hi.trans h3.symm)] + exact h2.trans (discBd_subset Φ) + +/-- Each edge lies in exactly two faces. The second face exists because a surface has no boundary +point. -/ +theorem two_faces (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) {e : Set X} + (he : e ∈ E) : {Φ ∈ 𝓕 | e ⊆ Φ}.ncard = 2 := by + classical + obtain ⟨x, hxe, hxV⟩ := h.exists_inner he + have hcov : ∀ y : X, ∃ Φ ∈ 𝓕, y ∈ Φ := fun y => by + have : y ∈ ⋃₀ 𝓕 := h.dis.cover ▸ mem_univ y + exact this + have hle : {Φ ∈ 𝓕 | e ⊆ Φ}.encard ≤ 2 := by + have hs : {Φ ∈ 𝓕 | e ⊆ Φ} ⊆ {Φ ∈ 𝓕 | x ∈ Φ} := fun Φ hΦ => ⟨hΦ.1, hΦ.2 hxe⟩ + exact (encard_le_encard hs).trans (h.dis.count x hxV) + obtain ⟨Φ₁, h1, hx1⟩ := hcov x + have hb := h.mem_bd h1 hx1 ⟨e, he, hxe⟩ + have hs1 := (h.edge_sub he h1 hxe hxV hx1).trans (discBd_subset Φ₁) + obtain ⟨Φ₂, h2, hx2, hne⟩ : ∃ Φ₂ ∈ 𝓕, x ∈ Φ₂ ∧ Φ₂ ≠ Φ₁ := by + by_contra hc + push Not at hc + let W : Set X := (⋃₀ (𝓕 \ {Φ₁}))ᶜ + have hWo : IsOpen W := by + have h5 : IsClosed (⋃₀ (𝓕 \ {Φ₁})) := + (h.dis.fin.subset sdiff_subset).isClosed_sUnion fun Φ hΦ => (h.dis.disc Φ hΦ.1).isClosed + exact h5.isOpen_compl + have hxW : x ∈ W := by + rintro ⟨Φ, hΦ, h3⟩ + exact hΦ.2 (hc Φ hΦ.1 h3) + have hWs : W ⊆ Φ₁ := fun y hy => by + obtain ⟨Φ, hΦ, h3⟩ := hcov y + by_cases h4 : Φ = Φ₁ + · exact h4 ▸ h3 + · exact absurd ⟨Φ, ⟨hΦ, h4⟩, h3⟩ hy + exact not_nhds_of_mem_discBd (hT.2.2 x) hb hWo hxW hWs + have hs2 := (h.edge_sub he h2 hxe hxV hx2).trans (discBd_subset Φ₂) + have hsub : ({Φ₁, Φ₂} : Set (Set X)) ⊆ {Φ ∈ 𝓕 | e ⊆ Φ} := by + rintro Φ (rfl | rfl) + · exact ⟨h1, hs1⟩ + · exact ⟨h2, hs2⟩ + have hf : {Φ ∈ 𝓕 | e ⊆ Φ}.Finite := h.dis.fin.subset fun Φ hΦ => hΦ.1 + have h3 : (2 : ℕ∞) ≤ {Φ ∈ 𝓕 | e ⊆ Φ}.encard := by + have := encard_le_encard hsub + rwa [encard_pair (Ne.symm hne)] at this + have h4 : {Φ ∈ 𝓕 | e ⊆ Φ}.encard = 2 := le_antisymm hle h3 + rw [← hf.cast_ncard_eq] at h4 + exact_mod_cast h4 + +/-- The graph of a triangulation of a connected surface is connected. -/ +theorem graph_conn (h : IsTriang V E 𝓕) [ConnectedSpace X] {S : Set X} + (hS : ∀ e ∈ E, ∀ a ∈ e ∩ V, ∀ b ∈ e ∩ V, a ∈ S → b ∈ S) + (hne : (S ∩ V).Nonempty) : V ⊆ S := by + classical + have hcov : ∀ y : X, ∃ Φ ∈ 𝓕, y ∈ Φ := fun y => by + have : y ∈ ⋃₀ 𝓕 := h.dis.cover ▸ mem_univ y + exact this + have hsame : ∀ Φ ∈ 𝓕, ∀ a ∈ Φ ∩ V, ∀ b ∈ Φ ∩ V, a ∈ S → b ∈ S := fun Φ hΦ a ha b hb has => by + by_cases hab : a = b + · exact hab ▸ has + obtain ⟨e, he, -, hi⟩ := h.face_pair hΦ ha hb hab + exact hS e he a (hi ▸ .inl rfl) b (hi ▸ .inr rfl) has + let 𝓐 : Set (Set X) := {Φ ∈ 𝓕 | ∃ a ∈ Φ ∩ V, a ∈ S} + let 𝓑 : Set (Set X) := 𝓕 \ 𝓐 + have hdis : Disjoint (⋃₀ 𝓐) (⋃₀ 𝓑) := Set.disjoint_left.mpr fun x ⟨Φ, hΦ, hx⟩ ⟨Φ', hΦ', hx'⟩ => by + have hne : Φ ≠ Φ' := fun h1 => hΦ'.2 (h1 ▸ hΦ) + obtain ⟨a, ha, has⟩ := hΦ.2 + have hb := h.mem_bd_of_ne hΦ.1 hΦ'.1 hne hx hx' + obtain ⟨e, he, hxe⟩ := h.dis.bd Φ hΦ.1 hb + by_cases hxV : x ∈ V + · exact hΦ'.2 ⟨hΦ'.1, x, ⟨hx', hxV⟩, hsame Φ hΦ.1 a ha x ⟨hx, hxV⟩ has⟩ + · have h1 := (h.edge_sub he hΦ.1 hxe hxV hx).trans (discBd_subset Φ) + have h2 := (h.edge_sub he hΦ'.1 hxe hxV hx').trans (discBd_subset Φ') + obtain ⟨u, v, -, hl, hi⟩ := h.dis.graph.edge e he + have hu : u ∈ e ∩ V := hi ▸ .inl rfl + exact hΦ'.2 ⟨hΦ'.1, u, ⟨h2 hu.1, hu.2⟩, hsame Φ hΦ.1 a ha u ⟨h1 hu.1, hu.2⟩ has⟩ + have hA : IsClosed (⋃₀ 𝓐) := + (h.dis.fin.subset (show 𝓐 ⊆ 𝓕 from fun _ hΦ => hΦ.1)).isClosed_sUnion + fun Φ hΦ => (h.dis.disc Φ hΦ.1).isClosed + have hB : IsClosed (⋃₀ 𝓑) := + (h.dis.fin.subset (show 𝓑 ⊆ 𝓕 from fun _ hΦ => hΦ.1)).isClosed_sUnion + fun Φ hΦ => (h.dis.disc Φ hΦ.1).isClosed + have hU : ⋃₀ 𝓐 ∪ ⋃₀ 𝓑 = univ := by + rw [eq_univ_iff_forall] + intro y + obtain ⟨Φ, hΦ, hy⟩ := hcov y + by_cases h1 : Φ ∈ 𝓐 + · exact .inl ⟨Φ, h1, hy⟩ + · exact .inr ⟨Φ, ⟨hΦ, h1⟩, hy⟩ + have hclopen : IsClopen (⋃₀ 𝓐) := ⟨hA, by + have : (⋃₀ 𝓐)ᶜ = ⋃₀ 𝓑 := by + ext y + constructor + · intro hy + have h2 : y ∈ ⋃₀ 𝓐 ∪ ⋃₀ 𝓑 := hU ▸ mem_univ y + exact h2.resolve_left hy + · exact fun hy h1 => Set.disjoint_left.mp hdis h1 hy + rw [← isClosed_compl_iff, this] + exact hB⟩ + obtain ⟨v₀, hv₀, hv₀V⟩ := hne + obtain ⟨Φ₀, hΦ₀, hv₀Φ⟩ := hcov v₀ + have hall : ⋃₀ 𝓐 = univ := (isClopen_iff.mp hclopen).resolve_left (nonempty_iff_ne_empty.mp + ⟨v₀, Φ₀, ⟨hΦ₀, v₀, ⟨hv₀Φ, hv₀V⟩, hv₀⟩, hv₀Φ⟩) + intro v hv + obtain ⟨Φ, hΦ, hvΦ⟩ : v ∈ ⋃₀ 𝓐 := hall ▸ mem_univ v + obtain ⟨a, ha, has⟩ := hΦ.2 + exact hsame Φ hΦ.1 a ha v ⟨hvΦ, hv⟩ has + +omit [T2Space X] in +theorem discInt_disj_V (h : IsTriang V E 𝓕) {Φ : Set X} (hΦ : Φ ∈ 𝓕) {y : X} + (hy : y ∈ discInt Φ) : y ∉ V := fun hV => + Set.disjoint_left.mp (h.dis.int Φ hΦ) hy (h.cov hV) + +/-- Faces of a triangulation of a connected surface are connected through common edges. -/ +theorem dual_conn (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) [ConnectedSpace X] {𝓐 : Set + (Set X)} (hs : 𝓐 ⊆ 𝓕) + (hcl : ∀ e ∈ E, ∀ Φ ∈ 𝓐, ∀ Φ' ∈ 𝓕, e ⊆ Φ → e ⊆ Φ' → Φ' ∈ 𝓐) (hne : 𝓐.Nonempty) : 𝓐 = 𝓕 := by + classical + refine Subset.antisymm hs fun Φ' hΦ' => ?_ + by_contra hn + obtain ⟨Φ, hΦ⟩ := hne + obtain ⟨y, hy⟩ := (h.dis.disc Φ (hs hΦ)).discInt_nonempty + obtain ⟨y', hy'⟩ := (h.dis.disc Φ' hΦ').discInt_nonempty + have hA : IsClosed (⋃₀ 𝓐) := (h.dis.fin.subset hs).isClosed_sUnion fun Φ hΦ => (h.dis.disc Φ + (hs hΦ)).isClosed + have hB : IsClosed (⋃₀ (𝓕 \ 𝓐)) := + (h.dis.fin.subset sdiff_subset).isClosed_sUnion fun Φ hΦ => (h.dis.disc Φ hΦ.1).isClosed + obtain ⟨z, hz, ⟨Ψ, hΨ, hzΨ⟩, ⟨Ψ', hΨ', hzΨ'⟩⟩ := isPreconnected_closed_iff.mp + (isPreconnected_compl_finite hT h.dis.graph.fin) + _ _ hA hB (fun x _ => by + have : x ∈ ⋃₀ 𝓕 := h.dis.cover ▸ mem_univ x + obtain ⟨Ψ, hΨ, hx⟩ := this + by_cases h1 : Ψ ∈ 𝓐 + · exact .inl ⟨Ψ, h1, hx⟩ + · exact .inr ⟨Ψ, ⟨hΨ, h1⟩, hx⟩) ⟨y, h.discInt_disj_V (hs hΦ) hy, Φ, hΦ, hy.1⟩ + ⟨y', h.discInt_disj_V hΦ' hy', Φ', ⟨hΦ', hn⟩, hy'.1⟩ + have hne' : Ψ ≠ Ψ' := fun h1 => hΨ'.2 (h1 ▸ hΨ) + have hb := h.mem_bd_of_ne (hs hΨ) hΨ'.1 hne' hzΨ hzΨ' + obtain ⟨e, he, hze⟩ := h.dis.bd Ψ (hs hΨ) hb + have h1 := (h.edge_sub he (hs hΨ) hze hz hzΨ).trans (discBd_subset Ψ) + have h2 := (h.edge_sub he hΨ'.1 hze hz hzΨ').trans (discBd_subset Ψ') + exact hΨ'.2 (hcl e he Ψ hΨ Ψ' hΨ'.1 h1 h2) + +/-- The faces at a vertex are connected through common edges at the vertex. -/ +theorem link_conn (h : IsTriang V E 𝓕) (hT : IsClosedSurface X) {w : X} (hw : w ∈ V) {𝓐 : Set + (Set X)} (hs : 𝓐 ⊆ 𝓕) + (hsw : ∀ Φ ∈ 𝓐, w ∈ Φ) (hcl : ∀ e ∈ E, w ∈ e → ∀ Φ ∈ 𝓐, ∀ Φ' ∈ 𝓕, e ⊆ Φ → e ⊆ Φ' → Φ' ∈ 𝓐) + (hne : 𝓐.Nonempty) + {Φ' : Set X} (hΦ' : Φ' ∈ 𝓕) (hwΦ' : w ∈ Φ') : Φ' ∈ 𝓐 := by + classical + by_contra hn + obtain ⟨Φ, hΦ⟩ := hne + let C : Set X := ⋃₀ {Ψ ∈ 𝓕 | w ∉ Ψ} ∪ (V \ {w}) ∪ ⋃₀ {e ∈ E | w ∉ e} + have hC : IsClosed C := by + refine (IsClosed.union ?_ ?_).union ?_ + · exact (h.dis.fin.subset (show {Ψ ∈ 𝓕 | w ∉ Ψ} ⊆ 𝓕 from fun _ hΨ => hΨ.1)).isClosed_sUnion + fun Ψ hΨ => (h.dis.disc Ψ hΨ.1).isClosed + · exact (h.dis.graph.fin.subset sdiff_subset).isClosed + · refine (h.dis.graph.fine.subset (show {e ∈ E | w ∉ e} ⊆ E from fun _ he + => he.1)).isClosed_sUnion + fun e he => ?_ + obtain ⟨u, v, -, hl, -⟩ := h.dis.graph.edge e he.1 + exact hl.isCompact.isClosed + have hwC : w ∉ C := by + rintro ((⟨Ψ, hΨ, h1⟩ | h1) | ⟨e, he, h1⟩) + · exact hΨ.2 h1 + · exact h1.2 rfl + · exact he.2 h1 + obtain ⟨B, k, g, c, hBC, hg0⟩ := (hT.2.2 w).exists_ballChart hC.isOpen_compl hwC (R := 1) one_pos + have hpc := c.isPreconnected_punctured + rw [hg0] at hpc + have hwB : w ∈ B := hg0 ▸ c.gm (by simp) + let 𝓑 : Set (Set X) := {Ψ ∈ 𝓕 | w ∈ Ψ} \ 𝓐 + have hA : IsClosed (⋃₀ 𝓐) := (h.dis.fin.subset hs).isClosed_sUnion fun Φ hΦ => (h.dis.disc Φ + (hs hΦ)).isClosed + have hB : IsClosed (⋃₀ 𝓑) := + (h.dis.fin.subset (show 𝓑 ⊆ 𝓕 from fun _ hΨ => hΨ.1.1)).isClosed_sUnion + fun Ψ hΨ => (h.dis.disc Ψ hΨ.1.1).isClosed + have hmeet : ∀ Ψ ∈ 𝓕, w ∈ Ψ → ∃ y ∈ B \ {w}, y ∈ Ψ := fun Ψ hΨ hwΨ => by + have h1 : w ∈ closure (discInt Ψ) := (h.dis.disc Ψ hΨ).subset_closure_discInt hwΨ + obtain ⟨y, hy, hyi⟩ := mem_closure_iff.mp h1 B c.isOpen hwB + refine ⟨y, ⟨hy, fun h2 => ?_⟩, hyi.1⟩ + have h3 : y = w := h2 + exact hyi.2 (h3 ▸ h.mem_bd hΨ hwΨ (h.cov hw)) + obtain ⟨y₁, hy₁, hy₁Φ⟩ := hmeet Φ (hs hΦ) (hsw Φ hΦ) + obtain ⟨y₂, hy₂, hy₂Φ⟩ := hmeet Φ' hΦ' hwΦ' + obtain ⟨z, hz, ⟨Ψ, hΨ, hzΨ⟩, ⟨Ψ', hΨ', hzΨ'⟩⟩ := isPreconnected_closed_iff.mp hpc _ _ hA hB + (fun x hx => by + have : x ∈ ⋃₀ 𝓕 := h.dis.cover ▸ mem_univ x + obtain ⟨Ψ, hΨ, hxΨ⟩ := this + have hwΨ : w ∈ Ψ := by + by_contra h1 + exact hBC hx.1 (.inl (.inl ⟨Ψ, ⟨hΨ, h1⟩, hxΨ⟩)) + by_cases h1 : Ψ ∈ 𝓐 + · exact .inl ⟨Ψ, h1, hxΨ⟩ + · exact .inr ⟨Ψ, ⟨⟨hΨ, hwΨ⟩, h1⟩, hxΨ⟩) ⟨y₁, hy₁, Φ, hΦ, hy₁Φ⟩ ⟨y₂, hy₂, Φ', ⟨⟨hΦ', hwΦ'⟩, + hn⟩, hy₂Φ⟩ + have hne' : Ψ ≠ Ψ' := fun h1 => hΨ'.2 (h1 ▸ hΨ) + have hb := h.mem_bd_of_ne (hs hΨ) hΨ'.1.1 hne' hzΨ hzΨ' + obtain ⟨e, he, hze⟩ := h.dis.bd Ψ (hs hΨ) hb + have hzV : z ∉ V := fun h1 => hBC hz.1 (.inl (.inr ⟨h1, hz.2⟩)) + have hwe : w ∈ e := by + by_contra h1 + exact hBC hz.1 (.inr ⟨e, ⟨he, h1⟩, hze⟩) + have h1 := (h.edge_sub he (hs hΨ) hze hzV hzΨ).trans (discBd_subset Ψ) + have h2 := (h.edge_sub he hΨ'.1.1 hze hzV hzΨ').trans (discBd_subset Ψ') + exact hΨ'.2 (hcl e he hwe Ψ hΨ Ψ' hΨ'.1.1 h1 h2) + +end IsTriang + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/TriPath.lean b/LeanPool/GraphMinor/Surface/TriPath.lean new file mode 100644 index 0000000000..f9992231c0 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/TriPath.lean @@ -0,0 +1,288 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.TriLocal + +/-! +# Lines in a graph + +A line in a graph with both ends at vertices is a path of edges (`IsGraph.exists_subdiv`). We use +this to see a simple drawing inside a triangulation that refines it. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology + +local notation "𝕀" => unitInterval + +variable {X : Type} [TopologicalSpace X] [T2Space X] + +omit [T2Space X] in +theorem IsLineWithEnds.isPreconnected_self {L : Set X} {u v : X} (hl : IsLineWithEnds L u v) : + IsPreconnected L := + GraphMinor.Surface.IsLineWithEnds.isPreconnected hl + +/-- A line in a graph, with its two ends the only vertices on it, is an edge. -/ +theorem IsGraph.line_mem {V : Set X} {E : Set (Set X)} (hg : IsGraph V E) {L : Set X} {u v : X} + (hl : IsLineWithEnds L u v) + (huv : u ≠ v) (hs : L ⊆ gr V E) (hi : L ∩ V = {u, v}) : L ∈ E := by + classical + have hJ : IsPreconnected (L \ {u, v}) := hl.isPreconnected_diff + have hne : (L \ {u, v}).Nonempty := by + by_contra hc + rw [not_nonempty_iff_eq_empty] at hc + have h2 := hl.subset_closure_diff + rw [hc, closure_empty] at h2 + exact h2 hl.left_mem + have hnV : ∀ y ∈ L \ {u, v}, y ∉ V := fun y hy hV => hy.2 (hi ▸ (⟨hy.1, hV⟩ : y ∈ L ∩ V)) + have hcl : ∀ e ∈ E, IsClosed e := fun e he => by + obtain ⟨p, q, -, hl', -⟩ := hg.edge e he + exact hl'.isCompact.isClosed + obtain ⟨x, hx⟩ := hne + have hxE : x ∈ ⋃₀ E := (hs hx.1).resolve_left (hnV x hx) + obtain ⟨e, he, hxe⟩ := hxE + have hR : IsClosed (⋃₀ (E \ {e})) := (hg.fine.subset sdiff_subset).isClosed_sUnion fun f hf + => hcl f hf.1 + have hJs : L \ {u, v} ⊆ e := by + by_contra hns + obtain ⟨y, hy, hye⟩ := not_subset.mp hns + have hyE : y ∈ ⋃₀ E := (hs hy.1).resolve_left (hnV y hy) + obtain ⟨f, hf, hyf⟩ := hyE + have hne' : f ≠ e := fun h' => hye (h' ▸ hyf) + obtain ⟨z, hz, hz1, ⟨f', hf', hz2⟩⟩ := isPreconnected_closed_iff.mp hJ e _ (hcl e he) hR + (fun w hw => by + have hwE : w ∈ ⋃₀ E := (hs hw.1).resolve_left (hnV w hw) + obtain ⟨g, hg', hwg⟩ := hwE + by_cases hge : g = e + · exact .inl (hge ▸ hwg) + · exact .inr ⟨g, ⟨hg', hge⟩, hwg⟩) ⟨x, hx, hxe⟩ ⟨y, hy, f, ⟨hf, hne'⟩, hyf⟩ + exact hnV z hz (hg.disj e he f' hf'.1 (Ne.symm hf'.2) ⟨hz1, hz2⟩) + have hLe : L ⊆ e := hl.subset_closure_diff.trans (closure_minimal hJs (hcl e he)) + obtain ⟨p, q, hpq, hle, hie⟩ := hg.edge e he + have hu : u ∈ L ∩ V := hi ▸ Or.inl rfl + have hv : v ∈ L ∩ V := hi ▸ Or.inr rfl + have hu' : u ∈ ({p, q} : Set X) := hie ▸ (⟨hLe hu.1, hu.2⟩ : u ∈ e ∩ V) + have hv' : v ∈ ({p, q} : Set X) := hie ▸ (⟨hLe hv.1, hv.2⟩ : v ∈ e ∩ V) + have hp : p ∈ L := by + rcases hu' with h1 | h1 <;> rcases hv' with h2 | h2 + · exact absurd (h1.trans h2.symm) huv + · exact h1 ▸ hu.1 + · exact h2 ▸ hv.1 + · exact absurd (h1.trans h2.symm) huv + have hq : q ∈ L := by + rcases hu' with h1 | h1 <;> rcases hv' with h2 | h2 + · exact absurd (h1.trans h2.symm) huv + · exact h2 ▸ hv.1 + · exact h1 ▸ hu.1 + · exact absurd (h1.trans h2.symm) huv + obtain ⟨b, hb, hr, h0, h1⟩ := hle.exists_arc + have hhe : Topology.IsEmbedding b := (hb.1.isClosedEmbedding hb.2).isEmbedding + have hpre : IsPreconnected (b ⁻¹' L) := by + refine hhe.isInducing.isPreconnected_image.mp ?_ + rw [image_preimage_eq_of_subset (by rw [hr]; exact hLe)] + exact hl.isPreconnected_self + have h0m : (0 : 𝕀) ∈ b ⁻¹' L := by + change b 0 ∈ L + rwa [h0] + have h1m : (1 : 𝕀) ∈ b ⁻¹' L := by + change b 1 ∈ L + rwa [h1] + have hall : e ⊆ L := by + rw [← hr] + rintro _ ⟨t, rfl⟩ + exact hpre.Icc_subset h0m h1m ⟨t.2.1, t.2.2⟩ + rwa [Subset.antisymm hLe hall] + +/-- A line in a graph with both ends at vertices is a path of edges. -/ +theorem IsGraph.exists_subdiv {V : Set X} {E : Set (Set X)} (hg : IsGraph V E) (n : ℕ) : + ∀ {L : Set X} {u v : X}, (L ∩ V).ncard = n → IsLineWithEnds L u v → u ≠ v → u ∈ V → v ∈ V + → L ⊆ gr V E → + ∃ Y : Set (Set X), Y ⊆ E ∧ (∀ x ∈ Y, x ⊆ L) ∧ ⋃₀ Y = L ∧ ((L ∩ V) \ {u, v}).ncard + 1 + ≤ Y.ncard ∧ + (∀ w ∈ (L ∩ V) \ {u, v}, {x ∈ Y | w ∈ x}.ncard ≤ 2) ∧ {x ∈ Y | u ∈ x}.ncard = 1 + ∧ {x ∈ Y | v ∈ x}.ncard = 1 := by + classical + induction n using Nat.strong_induction_on with + | _ n ih => + intro L u v hn hl huv hu hv hs + have hfinV := hg.fin + have hfinE := hg.fine + have hYf : ∀ {Y : Set (Set X)}, Y ⊆ E → Y.Finite := fun h => hfinE.subset h + by_cases hbase : (L ∩ V) \ {u, v} = ∅ + · have hi : L ∩ V = {u, v} := by + refine Subset.antisymm (sdiff_eq_empty.mp hbase) ?_ + rintro y (rfl | rfl) + · exact ⟨hl.left_mem, hu⟩ + · exact ⟨hl.right_mem, hv⟩ + have hLE := hg.line_mem hl huv hs hi + refine ⟨{L}, singleton_subset_iff.mpr hLE, by simp, by simp, by simp [hbase], + by simp [hbase], ?_, ?_⟩ + · have : {x ∈ ({L} : Set (Set X)) | u ∈ x} = {L} := by + ext x + constructor + · exact fun h => h.1 + · rintro rfl + exact ⟨rfl, hl.left_mem⟩ + rw [this, ncard_singleton] + · have : {x ∈ ({L} : Set (Set X)) | v ∈ x} = {L} := by + ext x + constructor + · exact fun h => h.1 + · rintro rfl + exact ⟨rfl, hl.right_mem⟩ + rw [this, ncard_singleton] + obtain ⟨w, hw⟩ := nonempty_iff_ne_empty.mpr hbase + obtain ⟨a, ha, hr, h0, h1⟩ := hl.exists_arc + have hmemL : ∀ t, a t ∈ L := fun t => hr ▸ mem_range_self t + obtain ⟨tw, htw⟩ : ∃ t, a t = w := by + have : w ∈ range a := hr ▸ hw.1.1 + exact this + have hAf : ({t | a t ∈ V ∧ t ≠ 0} : Set 𝕀).Finite := + (hfinV.preimage ha.2.injOn).subset fun t ht => ht.1 + have hAne : ({t | a t ∈ V ∧ t ≠ 0} : Set 𝕀).Nonempty := ⟨tw, htw ▸ hw.1.2, fun h' => hw.2 (.inl + (by rw [← htw, h', h0]))⟩ + obtain ⟨t₀, ht₀, hmin⟩ := exists_min_image _ id hAf hAne + simp only [id] at hmin + have htw1 : tw ≠ 1 := fun h' => hw.2 (.inr (by rw [← htw, h', h1]; rfl)) + have htw0 : tw ≠ 0 := fun h' => hw.2 (.inl (by rw [← htw, h', h0])) + have hle : t₀ ≤ tw := hmin tw ⟨htw ▸ hw.1.2, htw0⟩ + have ht₀1 : t₀ < 1 := lt_of_le_of_ne (unitInterval.le_one t₀) fun h' => by + rw [h'] at hle + exact htw1 (le_antisymm (unitInterval.le_one tw) hle) + have ht₀0 : (0 : 𝕀) < t₀ := lt_of_le_of_ne (unitInterval.nonneg t₀) (Ne.symm ht₀.2) + set w₀ := a t₀ with hw₀ + let L₁ : Set X := a '' Icc 0 t₀ + let L₂ : Set X := a '' Icc t₀ 1 + have hl₁ : IsLineWithEnds L₁ u w₀ := by + have h2 := (ha.sub (s := 0) (t := t₀) ht₀0.ne).isLineWithEnds + rwa [range_subArc _ ht₀0.le, subArc_zero, subArc_one, h0] at h2 + have hl₂ : IsLineWithEnds L₂ w₀ v := by + have h2 := (ha.sub (s := t₀) (t := 1) ht₀1.ne).isLineWithEnds + rwa [range_subArc _ ht₀1.le, subArc_zero, subArc_one, h1] at h2 + have hLu : L₁ ∪ L₂ = L := by + change a '' Icc 0 t₀ ∪ a '' Icc t₀ 1 = L + rw [← image_union, Icc_union_Icc_eq_Icc ht₀0.le ht₀1.le, ← hr] + ext x + simp only [mem_range, mem_image, mem_Icc] + exact ⟨fun ⟨t, _, ht⟩ => ⟨t, ht⟩, fun ⟨t, ht⟩ => ⟨t, ⟨unitInterval.nonneg t, + unitInterval.le_one t⟩, ht⟩⟩ + have hs₁ : L₁ ⊆ L := hLu ▸ subset_union_left + have hs₂ : L₂ ⊆ L := hLu ▸ subset_union_right + have huL₂ : u ∉ L₂ := by + rintro ⟨s, hs', he⟩ + have h2 : s = 0 := ha.2 (he.trans h0.symm) + exact absurd (ht₀0.trans_le hs'.1) (by rw [h2]; exact lt_irrefl _) + have hvL₁ : v ∉ L₁ := by + rintro ⟨s, hs', he⟩ + have h2 : s = 1 := ha.2 (he.trans h1.symm) + exact absurd (hs'.2.trans_lt ht₀1) (by rw [h2]; exact lt_irrefl _) + have hw₀V : w₀ ∈ V := ht₀.1 + have hw₀u : w₀ ≠ u := fun h' => huL₂ (h' ▸ hl₂.left_mem) + have hw₀v : w₀ ≠ v := fun h' => hvL₁ (h' ▸ hl₁.right_mem) + have hi₁ : L₁ ∩ V = {u, w₀} := by + ext y + constructor + · rintro ⟨⟨s, hs', rfl⟩, hV⟩ + by_cases hs0 : s = 0 + · exact .inl (by rw [hs0, h0]) + · have h2 := hmin s ⟨hV, hs0⟩ + exact .inr (by rw [le_antisymm hs'.2 h2]; rfl) + · rintro (rfl | rfl) + · exact ⟨hl₁.left_mem, hu⟩ + · exact ⟨hl₁.right_mem, hw₀V⟩ + have hL₁E : L₁ ∈ E := hg.line_mem hl₁ (Ne.symm hw₀u) (hs₁.trans hs) hi₁ + have hlt : (L₂ ∩ V).ncard < n := by + rw [← hn] + refine ncard_lt_ncard ⟨inter_subset_inter_left _ hs₂, fun h2 => ?_⟩ + (hfinV.subset inter_subset_right) + exact huL₂ (h2 ⟨hl.left_mem, hu⟩).1 + obtain ⟨Y₂, h2E, h2s, h2U, h2c, h2d, h2u, h2v⟩ := ih _ hlt rfl hl₂ hw₀v hw₀V hv (hs₂.trans hs) + have hL₁Y : L₁ ∉ Y₂ := fun h' => huL₂ (h2s L₁ h' hl₁.left_mem) + have huY : ∀ x ∈ Y₂, u ∉ x := fun x hx h' => huL₂ (h2s x hx h') + have hIntE : (L ∩ V) \ {u, v} = insert w₀ ((L₂ ∩ V) \ {w₀, v}) := by + ext y + constructor + · rintro ⟨⟨h3, h4⟩, h5⟩ + by_cases hy : y = w₀ + · exact .inl hy + · refine .inr ⟨⟨?_, h4⟩, ?_⟩ + · rcases (hLu ▸ h3 : y ∈ L₁ ∪ L₂) with h6 | h6 + · have h7 : y ∈ ({u, w₀} : Set X) := hi₁ ▸ ⟨h6, h4⟩ + rcases h7 with h7 | h7 + · exact absurd (.inl h7) h5 + · exact absurd h7 hy + · exact h6 + · rintro (h6 | h6) + · exact hy h6 + · exact h5 (.inr h6) + · rintro (rfl | ⟨⟨h3, h4⟩, h5⟩) + · exact ⟨⟨hs₁ hl₁.right_mem, hw₀V⟩, by + rintro (h6 | h6) + · exact hw₀u h6 + · exact hw₀v h6⟩ + · exact ⟨⟨hs₂ h3, h4⟩, by + rintro (h6 | h6) + · exact huL₂ (h6 ▸ h3) + · exact h5 (.inr h6)⟩ + have hw₀n : w₀ ∉ (L₂ ∩ V) \ {w₀, v} := fun h' => h'.2 (.inl rfl) + have hIntf : ((L₂ ∩ V) \ {w₀, v}).Finite := hfinV.subset fun y hy => hy.1.2 + refine ⟨insert L₁ Y₂, insert_subset hL₁E h2E, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · rintro x (rfl | hx) + · exact hs₁ + · exact (h2s x hx).trans hs₂ + · rw [sUnion_insert, h2U, hLu] + · rw [hIntE, ncard_insert_of_notMem hw₀n hIntf, ncard_insert_of_notMem hL₁Y (hYf h2E)] + omega + · intro w' hw' + rw [hIntE] at hw' + rcases hw' with rfl | hw' + · have hsub : {x ∈ insert L₁ Y₂ | w₀ ∈ x} ⊆ insert L₁ {x ∈ Y₂ | w₀ ∈ x} := by + rintro x ⟨rfl | hx, h3⟩ + · exact .inl rfl + · exact .inr ⟨hx, h3⟩ + refine (ncard_le_ncard hsub ((hYf h2E).insert _ |>.subset (insert_subset_insert fun x hx + => hx.1))).trans ?_ + exact (ncard_insert_le _ _).trans (by rw [h2u]) + · have hnL₁ : w' ∉ L₁ := fun h3 => by + have h4 : w' ∈ ({u, w₀} : Set X) := hi₁ ▸ ⟨h3, hw'.1.2⟩ + rcases h4 with h4 | h4 + · exact huL₂ (h4 ▸ hw'.1.1) + · exact hw'.2 (.inl h4) + have h3 : {x ∈ insert L₁ Y₂ | w' ∈ x} = {x ∈ Y₂ | w' ∈ x} := by + ext x + constructor + · rintro ⟨rfl | hx, h4⟩ + · exact absurd h4 hnL₁ + · exact ⟨hx, h4⟩ + · exact fun h4 => ⟨.inr h4.1, h4.2⟩ + rw [h3] + exact h2d w' hw' + · have h3 : {x ∈ insert L₁ Y₂ | u ∈ x} = {L₁} := by + ext x + constructor + · rintro ⟨rfl | hx, h4⟩ + · rfl + · exact absurd h4 (huY x hx) + · rintro rfl + exact ⟨.inl rfl, hl₁.left_mem⟩ + rw [h3, ncard_singleton] + · have h3 : {x ∈ insert L₁ Y₂ | v ∈ x} = {x ∈ Y₂ | v ∈ x} := by + ext x + constructor + · rintro ⟨rfl | hx, h4⟩ + · exact absurd h4 hvL₁ + · exact ⟨hx, h4⟩ + · exact fun h4 => ⟨.inr h4.1, h4.2⟩ + rw [h3, h2v] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Triangulate.lean b/LeanPool/GraphMinor/Surface/Triangulate.lean new file mode 100644 index 0000000000..f602321486 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Triangulate.lean @@ -0,0 +1,623 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Fan +public import Mathlib.Topology.Separation.Connected +import LeanPool.GraphMinor.Surface.Circle + +/-! +# Triangulating a closed surface + +A dissection can be refined to one in which each face has three vertices and no two edges have the +same ends (`exists_triang`), without changing the number `|V| - |E| + |F|`. We cut each edge in two, +and then put a cone on each face by `exists_cone`. These refinements are the triangulations named in +the proof of Graph Minors XIX, (6.5) (page 341). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +local notation "𝕀" => unitInterval + +variable {X : Type} [TopologicalSpace X] + +/-- A dissection whose faces have three vertices each, and with no parallel edges. -/ +structure IsTriang (V : Set X) (E 𝓕 : Set (Set X)) : Prop where + dis : IsDissection V E 𝓕 + cov : V ⊆ ⋃₀ E + three : ∀ Φ ∈ 𝓕, (Φ ∩ V).ncard = 3 + simple : ∀ e ∈ E, ∀ f ∈ E, e ∩ V = f ∩ V → e = f + +theorem ncard_biUnion_eq {ι α : Type*} (s : Finset ι) (f : ι → Set α) (hf : ∀ i ∈ s, (f i).Finite) + (hd : ∀ i ∈ s, ∀ j ∈ s, i ≠ j → Disjoint (f i) (f j)) : + (⋃ i ∈ s, f i).ncard = ∑ i ∈ s, (f i).ncard := by + classical + induction s using Finset.induction_on with + | empty => simp + | insert a s ha ih => + have h1 : (⋃ i ∈ s, f i).Finite := s.finite_toSet.biUnion fun i hi => hf i + (Finset.mem_insert_of_mem hi) + have h2 : Disjoint (f a) (⋃ i ∈ s, f i) := by + refine disjoint_iUnion₂_right.mpr fun i hi => hd a (Finset.mem_insert_self _ _) i + (Finset.mem_insert_of_mem hi) ?_ + rintro rfl + exact ha hi + rw [Finset.sum_insert ha, Finset.set_biUnion_insert, ncard_union_eq h2 (hf a + (Finset.mem_insert_self _ _)) h1, + ih (fun i hi => hf i (Finset.mem_insert_of_mem hi)) + (fun i hi j hj => hd i (Finset.mem_insert_of_mem hi) j (Finset.mem_insert_of_mem hj))] + +variable [T2Space X] + +omit [T2Space X] in +/-- Vertices on no edge can be dropped from a dissection. -/ +theorem IsDissection.trim {V : Set X} {E 𝓕 : Set (Set X)} (h : IsDissection V E 𝓕) : + IsDissection (V ∩ ⋃₀ E) E 𝓕 := by + refine ⟨⟨h.graph.fin.subset inter_subset_left, h.graph.fine, fun e he => ?_, + fun e he f hf hne x hx => ?_⟩, h.fin, h.disc, h.cover, h.bd, h.int, h.disj, fun x hx => ?_⟩ + · obtain ⟨u, v, huv, hl, hi⟩ := h.graph.edge e he + refine ⟨u, v, huv, hl, ?_⟩ + ext y + constructor + · rintro ⟨h1, h2, -⟩ + exact hi ▸ ⟨h1, h2⟩ + · intro hy + have : y ∈ e ∩ V := hi ▸ hy + exact ⟨this.1, this.2, e, he, this.1⟩ + · exact ⟨h.graph.disj e he f hf hne hx, e, he, hx.1⟩ + · by_cases hV : x ∈ V + · have hxE : x ∉ ⋃₀ E := fun h' => hx ⟨hV, h'⟩ + have hle : {Φ ∈ 𝓕 | x ∈ Φ}.encard ≤ 1 := by + refine encard_le_one_iff.mpr ?_ + rintro Φ Φ' ⟨hΦ, h1⟩ ⟨hΦ', h2⟩ + by_contra hne + have h3 : x ∈ discInt Φ := ⟨h1, fun h' => hxE (h.bd Φ hΦ h')⟩ + exact Set.disjoint_left.mp (h.disj Φ hΦ Φ' hΦ' hne) h3 h2 + exact hle.trans (by norm_num) + · exact h.count x hV + +omit [TopologicalSpace X] [T2Space X] in +private theorem half_edge_vertex_intersection + {V : Set X} {E : Set (Set X)} {mid : Set X → X} {H e : Set X} {a b : X} + (he : e ∈ E) (hsub : H ⊆ e) (hends : e ∩ V = {a, b}) + (ha : a ∈ H) (hm : mid e ∈ H) (hb : b ∉ H) + (hmidE : ∀ f ∈ E, mid f ∈ e → e = f) : + H ∩ (V ∪ mid '' E) = {a, mid e} := by + ext y + constructor + · rintro ⟨hy, hyV | ⟨f, hf, rfl⟩⟩ + · rcases hends.subset ⟨hsub hy, hyV⟩ with hya | hyb + · exact Or.inl hya + · exact (hb (hyb ▸ hy)).elim + · exact Or.inr (congrArg mid (hmidE f hf (hsub hy)).symm) + · rintro (rfl | rfl) + · exact ⟨ha, Or.inl (hends.symm.subset (Or.inl rfl)).2⟩ + · exact ⟨hm, Or.inr ⟨e, he, rfl⟩⟩ + +/-- Cutting every edge of a dissection in two. -/ +theorem IsDissection.exists_halves {V : Set X} {E 𝓕 : Set (Set X)} (h : IsDissection V E 𝓕) + (hV : V ⊆ ⋃₀ E) : + ∃ (V₁ : Set X) (E₁ : Set (Set X)), IsDissection V₁ E₁ 𝓕 ∧ V ⊆ V₁ ∧ V₁ ⊆ ⋃₀ E₁ ∧ ⋃₀ E₁ = ⋃₀ E ∧ + (∀ e ∈ E₁, ∀ f ∈ E₁, e ∩ V₁ = f ∩ V₁ → e = f) ∧ V₁.ncard = V.ncard + E.ncard ∧ E₁.ncard + = 2 * E.ncard ∧ + ∀ e ∈ E, ∃ m ∈ V₁, m ∉ V ∧ m ∈ e := by + classical + have hg := h.graph + rcases E.eq_empty_or_nonempty with rfl | ⟨e₀, he₀⟩ + · have hV0 : V = ∅ := by simpa using hV + subst hV0 + exact ⟨∅, ∅, h, Subset.rfl, by simp, rfl, by simp, by simp, by simp, by simp⟩ + obtain ⟨u₀, -, -, hl₀, -⟩ := hg.edge e₀ he₀ + have hne : Nonempty X := ⟨u₀⟩ + have hch : ∀ e ∈ E, ∃ a : 𝕀 → X, IsArcMap a ∧ range a = e ∧ e ∩ V = {a 0, a 1} := fun e he => by + obtain ⟨u, v, huv, hl, hi⟩ := hg.edge e he + obtain ⟨a, ha, hr, h0, h1⟩ := hl.exists_arc + exact ⟨a, ha, hr, by rw [hi, h0, h1]⟩ + choose! a harc hrange hends using hch + let m : 𝕀 := ⟨1 / 2, by norm_num, by norm_num⟩ + have hm0 : (0 : 𝕀) < m := by + change (0 : ℝ) < 1 / 2 + norm_num + have hm1 : m < 1 := by + change (1 / 2 : ℝ) < 1 + norm_num + let mid : Set X → X := fun e => a e m + let H₀ : Set X → Set X := fun e => a e '' Icc 0 m + let H₁ : Set X → Set X := fun e => a e '' Icc m 1 + let V₁ : Set X := V ∪ mid '' E + let E₁ : Set (Set X) := H₀ '' E ∪ H₁ '' E + have hat : ∀ e ∈ E, ∀ t, a e t ∈ e := fun e he t => by + have h1 : a e t ∈ range (a e) := mem_range_self t + rwa [hrange e he] at h1 + have hmid : ∀ e ∈ E, mid e ∈ e := fun e he => hat e he m + have hmidV : ∀ e ∈ E, mid e ∉ V := fun e he hV' => by + have h1 : mid e ∈ e ∩ V := ⟨hmid e he, hV'⟩ + rw [hends e he] at h1 + rcases h1 with h1 | h1 + · exact hm0.ne' ((harc e he).2 h1) + · exact hm1.ne ((harc e he).2 h1) + have hmidE : ∀ e ∈ E, ∀ f ∈ E, mid e ∈ f → f = e := fun e he f hf h1 => by + by_contra hc + exact hmidV e he (hg.disj f hf e he hc ⟨h1, hmid e he⟩) + have hH₀s : ∀ e ∈ E, H₀ e ⊆ e := fun e he => by + rintro _ ⟨t, -, rfl⟩ + exact hat e he t + have hH₁s : ∀ e ∈ E, H₁ e ⊆ e := fun e he => by + rintro _ ⟨t, -, rfl⟩ + exact hat e he t + have hmH₀ : ∀ e, mid e ∈ H₀ e := fun e => ⟨m, ⟨hm0.le, le_rfl⟩, rfl⟩ + have hmH₁ : ∀ e, mid e ∈ H₁ e := fun e => ⟨m, ⟨le_rfl, hm1.le⟩, rfl⟩ + have h0H₀ : ∀ e, a e 0 ∈ H₀ e := fun e => ⟨0, ⟨le_rfl, hm0.le⟩, rfl⟩ + have h1H₁ : ∀ e, a e 1 ∈ H₁ e := fun e => ⟨1, ⟨hm1.le, le_rfl⟩, rfl⟩ + have h1notH₀ : ∀ e ∈ E, a e 1 ∉ H₀ e := fun e he => by + rintro ⟨t, ht, h1⟩ + have h2 : t = 1 := (harc e he).2 h1 + exact absurd (ht.2.trans_lt hm1) (by rw [h2]; exact lt_irrefl _) + have h0notH₁ : ∀ e ∈ E, a e 0 ∉ H₁ e := fun e he => by + rintro ⟨t, ht, h1⟩ + have h2 : t = 0 := (harc e he).2 h1 + exact absurd (hm0.trans_le ht.1) (by rw [h2]; exact lt_irrefl _) + have hH₀V : ∀ e ∈ E, H₀ e ∩ V₁ = {a e 0, mid e} := fun e he => + half_edge_vertex_intersection he (hH₀s e he) (hends e he) + (h0H₀ e) (hmH₀ e) (h1notH₀ e he) (fun f hf => hmidE f hf e he) + have hH₁V : ∀ e ∈ E, H₁ e ∩ V₁ = {mid e, a e 1} := by + intro e he + rw [pair_comm] + exact half_edge_vertex_intersection he (hH₁s e he) ((hends e he).trans (pair_comm _ _)) + (h1H₁ e) (hmH₁ e) (h0notH₁ e he) (fun f hf => hmidE f hf e he) + have hH₀H₁ : ∀ e ∈ E, H₀ e ∩ H₁ e ⊆ {mid e} := by + rintro e he _ ⟨⟨s, hs, rfl⟩, ⟨t, ht, he'⟩⟩ + have h1 : t = s := (harc e he).2 he' + subst h1 + have : t = m := le_antisymm hs.2 ht.1 + rw [this] + rfl + have hunion : ∀ e ∈ E, H₀ e ∪ H₁ e = e := fun e he => by + change a e '' Icc 0 m ∪ a e '' Icc m 1 = e + rw [← image_union, Icc_union_Icc_eq_Icc hm0.le hm1.le] + conv_rhs => rw [← hrange e he] + ext x + simp only [mem_range, mem_image, mem_Icc] + exact ⟨fun ⟨t, _, ht⟩ => ⟨t, ht⟩, fun ⟨t, ht⟩ => ⟨t, ⟨t.2.1, t.2.2⟩, ht⟩⟩ + have hsU : ⋃₀ E₁ = ⋃₀ E := by + ext x + constructor + · rintro ⟨_, ⟨e, he, rfl⟩ | ⟨e, he, rfl⟩, h1⟩ + · exact ⟨e, he, hH₀s e he h1⟩ + · exact ⟨e, he, hH₁s e he h1⟩ + · rintro ⟨e, he, h1⟩ + rcases (hunion e he).symm ▸ h1 with h2 | h2 + · exact ⟨_, .inl ⟨e, he, rfl⟩, h2⟩ + · exact ⟨_, .inr ⟨e, he, rfl⟩, h2⟩ + have hV₁f : V₁.Finite := hg.fin.union (hg.fine.image _) + have hline₀ : ∀ e ∈ E, a e 0 ≠ mid e ∧ IsLineWithEnds (H₀ e) (a e 0) (mid e) := fun e he => by + have h2 := ((harc e he).sub (s := 0) (t := m) hm0.ne).isLineWithEnds + rw [range_subArc _ hm0.le, subArc_zero, subArc_one] at h2 + exact ⟨fun h1 => hm0.ne ((harc e he).2 h1), h2⟩ + have hline₁ : ∀ e ∈ E, mid e ≠ a e 1 ∧ IsLineWithEnds (H₁ e) (mid e) (a e 1) := fun e he => by + have h2 := ((harc e he).sub (s := m) (t := 1) hm1.ne).isLineWithEnds + rw [range_subArc _ hm1.le, subArc_zero, subArc_one] at h2 + exact ⟨fun h1 => hm1.ne ((harc e he).2 h1), h2⟩ + have hdis : IsDissection V₁ E₁ 𝓕 := by + refine ⟨⟨hV₁f, (hg.fine.image _).union (hg.fine.image _), ?_, ?_⟩, h.fin, h.disc, h.cover, + ?_, ?_, h.disj, ?_⟩ + · rintro _ (⟨e, he, rfl⟩ | ⟨e, he, rfl⟩) + · exact ⟨_, _, (hline₀ e he).1, (hline₀ e he).2, hH₀V e he⟩ + · exact ⟨_, _, (hline₁ e he).1, (hline₁ e he).2, hH₁V e he⟩ + · have hin : ∀ e ∈ E, ∀ f ∈ E, e ≠ f → ∀ x ∈ e, x ∈ f → x ∈ V₁ := fun e he f hf hne' x h1 h2 => + .inl (hg.disj e he f hf hne' ⟨h1, h2⟩) + rintro _ (⟨e, he, rfl⟩ | ⟨e, he, rfl⟩) _ (⟨f, hf, rfl⟩ | ⟨f, hf, rfl⟩) hne' x ⟨h1, h2⟩ + · by_cases hef : e = f + · subst hef + exact absurd rfl hne' + · exact hin e he f hf hef x (hH₀s e he h1) (hH₀s f hf h2) + · by_cases hef : e = f + · subst hef + rw [hH₀H₁ e he ⟨h1, h2⟩] + exact .inr ⟨e, he, rfl⟩ + · exact hin e he f hf hef x (hH₀s e he h1) (hH₁s f hf h2) + · by_cases hef : e = f + · subst hef + rw [hH₀H₁ e he ⟨h2, h1⟩] + exact .inr ⟨e, he, rfl⟩ + · exact hin e he f hf hef x (hH₁s e he h1) (hH₀s f hf h2) + · by_cases hef : e = f + · subst hef + exact absurd rfl hne' + · exact hin e he f hf hef x (hH₁s e he h1) (hH₁s f hf h2) + · rw [hsU] + exact h.bd + · rw [hsU] + exact h.int + · exact fun x hx => h.count x fun h' => hx (.inl h') + have hne01 : ∀ e ∈ E, H₀ e ≠ H₁ e := fun e he h1 => h0notH₁ e he (h1 ▸ h0H₀ e) + have hinj₀ : InjOn H₀ E := fun e he f hf h1 => by + have h2 : mid e ∈ H₀ f := by + rw [← (show H₀ e = H₀ f from h1)] + exact hmH₀ e + exact (hmidE e he f hf (hH₀s f hf h2)).symm + have hinj₁ : InjOn H₁ E := fun e he f hf h1 => by + have h2 : mid e ∈ H₁ f := by + rw [← (show H₁ e = H₁ f from h1)] + exact hmH₁ e + exact (hmidE e he f hf (hH₁s f hf h2)).symm + have hinjm : InjOn mid E := fun e he f hf h1 => (hmidE e he f hf (h1 ▸ hmid f hf)).symm + have hdV : Disjoint V (mid '' E) := Set.disjoint_right.mpr fun _ ⟨e, he, h1⟩ h2 => hmidV e he + (h1 ▸ h2) + have hdE : Disjoint (H₀ '' E) (H₁ '' E) := Set.disjoint_left.mpr fun _ ⟨e, he, h1⟩ ⟨f, hf, h2⟩ + => by + have h3 : mid f ∈ H₀ e := by + rw [h1, ← h2] + exact hmH₁ f + have h4 := hmidE f hf e he (hH₀s e he h3) + subst h4 + exact hne01 e he (h1.trans h2.symm) + refine ⟨V₁, E₁, hdis, subset_union_left, ?_, hsU, ?_, ?_, ?_, fun e he => ⟨mid e, .inr ⟨e, he, + rfl⟩, hmidV e he, hmid e he⟩⟩ + · rw [hsU] + rintro x (h1 | ⟨e, he, rfl⟩) + · exact hV h1 + · exact ⟨e, he, hmid e he⟩ + · have key : ∀ (e f : Set X), e ∈ E → f ∈ E → ∀ g g' : Set X, mid e ∈ g → (g = H₀ e ∨ g = H₁ e) → + (g' ⊆ f) → + g ∩ V₁ = g' ∩ V₁ → f = e := by + intro e f he hf g g' h1 _ h3 h4 + have h5 : mid e ∈ g ∩ V₁ := ⟨h1, .inr ⟨e, he, rfl⟩⟩ + rw [h4] at h5 + exact hmidE e he f hf (h3 h5.1) + have h01 : ∀ e ∈ E, H₀ e ∩ V₁ ≠ H₁ e ∩ V₁ := fun e he h1 => by + have h2 : a e 0 ∈ H₀ e ∩ V₁ := by + rw [hH₀V e he] + exact .inl rfl + rw [h1] at h2 + exact h0notH₁ e he h2.1 + rintro _ (⟨e, he, rfl⟩ | ⟨e, he, rfl⟩) _ (⟨f, hf, rfl⟩ | ⟨f, hf, rfl⟩) h1 + · have := key e f he hf _ _ (hmH₀ e) (.inl rfl) (hH₀s f hf) h1 + subst this + rfl + · have := key e f he hf _ _ (hmH₀ e) (.inl rfl) (hH₁s f hf) h1 + subst this + exact absurd h1 (h01 f hf) + · have := key e f he hf _ _ (hmH₁ e) (.inr rfl) (hH₀s f hf) h1 + subst this + exact absurd h1.symm (h01 f hf) + · have := key e f he hf _ _ (hmH₁ e) (.inr rfl) (hH₁s f hf) h1 + subst this + rfl + · rw [ncard_union_eq hdV hg.fin (hg.fine.image _), hinjm.ncard_image] + · rw [ncard_union_eq hdE (hg.fine.image _) (hg.fine.image _), hinj₀.ncard_image, + hinj₁.ncard_image] + omega + +omit [T2Space X] in +/-- The boundary of a disc, or any other `O`-arc, has infinitely many points. -/ +theorem isOArc_infinite {F : Set X} (hF : IsOArc F) : F.Infinite := + hF.infinite + +/-- Each face of a dissection has an edge on its boundary, so two vertices. -/ +theorem IsDissection.two_vertices {V : Set X} {E 𝓕 : Set (Set X)} (h : IsDissection V E 𝓕) {Φ : Set + X} (hΦ : Φ ∈ 𝓕) : + ∃ a b, a ∈ Φ ∩ V ∧ b ∈ Φ ∩ V ∧ a ≠ b := by + have hO : IsOArc (discBd Φ) := (h.disc Φ hΦ).isOArc_discBd + obtain ⟨y, hy, hyV⟩ := ((isOArc_infinite hO).sdiff h.graph.fin).nonempty + obtain ⟨e, he, hye⟩ := h.bd Φ hΦ hy + have hsub : discBd Φ ⊆ gr V E := (h.bd Φ hΦ).trans subset_union_right + obtain ⟨u, v, huv, hl, hi⟩ := h.graph.edge e he + rcases h.graph.edge_or hO hsub he with h1 | h1 + · have hu : u ∈ e ∩ V := hi ▸ .inl rfl + have hv : v ∈ e ∩ V := hi ▸ .inr rfl + exact ⟨u, v, ⟨discBd_subset Φ (h1 hu.1), hu.2⟩, ⟨discBd_subset Φ (h1 hv.1), hv.2⟩, huv⟩ + · exact absurd hy (Set.disjoint_left.mp h1 ⟨hye, hyV⟩) + +omit [T2Space X] in +theorem IsClosedDisc.discInt_nonempty {Φ : Set X} (hΦ : IsClosedDisc Φ) : (discInt Φ).Nonempty := by + obtain ⟨h', g', c'⟩ := hΦ.exists_isChart + have hg0 : g' 0 ∈ Φ := c'.gm (by simp) + have h3 := hΦ.subset_closure_discInt hg0 + by_contra hc' + rw [not_nonempty_iff_eq_empty] at hc' + rw [hc', closure_empty] at h3 + exact h3 + +omit [T2Space X] in +private theorem dissection_from_chord_fans + {V : Set X} {E 𝓕 : Set (Set X)} (h : IsDissection V E 𝓕) + (c : Set X → X) (𝓛 𝓒 : Set X → Set (Set X)) + (hfan : ∀ Φ ∈ 𝓕, IsChordFan Φ (insert (c Φ) (Φ ∩ V)) (𝓛 Φ) (𝓒 Φ)) : + let V₂ : Set X := V ∪ c '' 𝓕 + let S₂ : Set (Set X) := ⋃ Φ ∈ 𝓕, 𝓛 Φ + let E₂ : Set (Set X) := E ∪ S₂ + let 𝓕₂ : Set (Set X) := ⋃ Φ ∈ 𝓕, 𝓒 Φ + IsGraph V₂ E₂ → IsDissection V₂ E₂ 𝓕₂ := by + classical + intro V₂ S₂ E₂ 𝓕₂ hgraph + have hfin𝓕₂ : 𝓕₂.Finite := h.fin.biUnion fun Φ hΦ => (hfan Φ hΦ).finS + have hmS : ∀ {L}, L ∈ S₂ → ∃ Φ ∈ 𝓕, L ∈ 𝓛 Φ := fun {L} hL => by simpa [S₂] using hL + have hm𝓕 : ∀ {Ψ}, Ψ ∈ 𝓕₂ → ∃ Φ ∈ 𝓕, Ψ ∈ 𝓒 Φ := fun {Ψ} hΨ => by simpa [𝓕₂] using hΨ + have hfS : ∀ Φ ∈ 𝓕, ∀ Ψ ∈ 𝓒 Φ, Ψ ⊆ Φ := fun Φ hΦ Ψ hΨ => (hfan Φ hΦ).sub Ψ hΨ + have hfL : ∀ Φ ∈ 𝓕, ∀ L ∈ 𝓛 Φ, L ⊆ Φ := fun Φ hΦ L hL => (hfan Φ hΦ).subL L hL + have hintΨ : ∀ Φ ∈ 𝓕, ∀ Ψ ∈ 𝓒 Φ, discInt Ψ ⊆ discInt Φ := fun Φ hΦ Ψ hΨ y hy => + ⟨hfS Φ hΦ Ψ hΨ hy.1, fun h' => Set.disjoint_left.mp ((hfan Φ hΦ).int Ψ hΨ) hy (.inl h')⟩ + refine ⟨hgraph, hfin𝓕₂, ?_, ?_, ?_, ?_, ?_, ?_⟩ + · intro Ψ hΨ + obtain ⟨Φ, hΦ, hΨ⟩ := hm𝓕 hΨ + exact (hfan Φ hΦ).disc Ψ hΨ + · rw [eq_univ_iff_forall] + intro y + obtain ⟨Φ, hΦ, hy⟩ := (eq_univ_iff_forall.mp h.cover) y + rw [← (hfan Φ hΦ).cover] at hy + obtain ⟨Ψ, hΨ, hy⟩ := hy + exact ⟨Ψ, by simpa [𝓕₂] using ⟨Φ, hΦ, hΨ⟩, hy⟩ + · intro Ψ hΨ y hy + obtain ⟨Φ, hΦ, hΨ⟩ := hm𝓕 hΨ + rcases (hfan Φ hΦ).bd Ψ hΨ hy with h1 | ⟨L, hL, h1⟩ + · obtain ⟨e, he, h2⟩ := h.bd Φ hΦ h1 + exact ⟨e, .inl he, h2⟩ + · exact ⟨L, .inr (by simpa [S₂] using ⟨Φ, hΦ, hL⟩), h1⟩ + · intro Ψ hΨ + obtain ⟨Φ, hΦ, hΨ⟩ := hm𝓕 hΨ + refine Set.disjoint_left.mpr ?_ + rintro y hy ⟨e, he | he, h1⟩ + · exact Set.disjoint_left.mp (h.int Φ hΦ) (hintΨ Φ hΦ Ψ hΨ hy) ⟨e, he, h1⟩ + · obtain ⟨Φ', hΦ', hL⟩ := hmS he + by_cases hq : Φ = Φ' + · subst hq + exact Set.disjoint_left.mp ((hfan Φ hΦ).int Ψ hΨ) hy (.inr ⟨e, hL, h1⟩) + · exact Set.disjoint_left.mp (h.disj Φ hΦ Φ' hΦ' hq) (hintΨ Φ hΦ Ψ hΨ hy) (hfL Φ' hΦ' e hL h1) + · intro Ψ hΨ Ψ' hΨ' hne + obtain ⟨Φ, hΦ, hΨ⟩ := hm𝓕 hΨ + obtain ⟨Φ', hΦ', hΨ'⟩ := hm𝓕 hΨ' + by_cases hq : Φ = Φ' + · subst hq + exact (hfan Φ hΦ).disj Ψ hΨ Ψ' hΨ' hne + · exact Set.disjoint_left.mpr fun y hy hy' => + Set.disjoint_left.mp (h.disj Φ hΦ Φ' hΦ' hq) (hintΨ Φ hΦ Ψ hΨ hy) (hfS Φ' hΦ' Ψ' hΨ' hy') + · intro y hy + have hyV : y ∉ V := fun h1 => hy (.inl h1) + have hyQ : ∀ Φ ∈ 𝓕, y ∉ insert (c Φ) (Φ ∩ V) := fun Φ hΦ h1 => by + rcases h1 with h1 | h1 + · exact hy (.inr ⟨Φ, hΦ, h1.symm⟩) + · exact hyV h1.2 + by_cases hint : ∃ Φ ∈ 𝓕, y ∈ discInt Φ + · obtain ⟨Φ, hΦ, hyi⟩ := hint + have hsub : {Ψ ∈ 𝓕₂ | y ∈ Ψ} ⊆ {Ψ ∈ 𝓒 Φ | y ∈ Ψ} := by + rintro Ψ ⟨hΨ, h1⟩ + obtain ⟨Φ', hΦ', hΨ⟩ := hm𝓕 hΨ + by_cases hq : Φ = Φ' + · subst hq + exact ⟨hΨ, h1⟩ + · exact absurd (hfS Φ' hΦ' Ψ hΨ h1) (Set.disjoint_left.mp (h.disj Φ hΦ Φ' hΦ' hq) hyi) + exact (encard_le_encard hsub).trans ((hfan Φ hΦ).count₂ y (hyQ Φ hΦ)) + · push Not at hint + have hle : ∀ Φ ∈ {Φ ∈ 𝓕 | y ∈ Φ}, ({Ψ ∈ 𝓒 Φ | y ∈ Ψ}).encard ≤ 1 := by + rintro Φ ⟨hΦ, h1⟩ + have hb : y ∈ discBd Φ := by + by_contra hn + exact hint Φ hΦ ⟨h1, hn⟩ + exact (hfan Φ hΦ).count₁ y hb (hyQ Φ hΦ) + have hown : ∀ Ψ, Ψ ∈ 𝓕₂ → ∃ Φ ∈ 𝓕, Ψ ∈ 𝓒 Φ := fun Ψ hΨ => hm𝓕 hΨ + choose! own hown₁ hown₂ using hown + have hle2 : ({Ψ ∈ 𝓕₂ | y ∈ Ψ}).encard ≤ ({Φ ∈ 𝓕 | y ∈ Φ}).encard := by + refine encard_le_encard_of_injOn (f := own) ?_ ?_ + · rintro Ψ ⟨hΨ, h1⟩ + exact ⟨hown₁ Ψ hΨ, hfS _ (hown₁ Ψ hΨ) Ψ (hown₂ Ψ hΨ) h1⟩ + · rintro Ψ ⟨hΨ, h1⟩ Ψ' ⟨hΨ', h2⟩ h3 + have hm : own Ψ ∈ {Φ ∈ 𝓕 | y ∈ Φ} := ⟨hown₁ Ψ hΨ, hfS _ (hown₁ Ψ hΨ) Ψ (hown₂ Ψ hΨ) h1⟩ + refine encard_le_one_iff.mp (hle _ hm) Ψ Ψ' ⟨hown₂ Ψ hΨ, h1⟩ ⟨?_, h2⟩ + rw [h3] + exact hown₂ Ψ' hΨ' + exact hle2.trans (h.count y hyV) + +/-- Putting a cone on each face of a simple dissection gives a triangulation with the same value of +`|V| - |E| + |F|`. -/ +theorem IsDissection.exists_coned [Nonempty X] {V : Set X} {E 𝓕 : Set (Set X)} + (h : IsDissection V E 𝓕) (hV : V ⊆ ⋃₀ E) + (hs : ∀ e ∈ E, ∀ f ∈ E, e ∩ V = f ∩ V → e = f) : + ∃ (V₂ : Set X) (E₂ 𝓕₂ : Set (Set X)), IsTriang V₂ E₂ 𝓕₂ ∧ V ⊆ V₂ ∧ E ⊆ E₂ ∧ + (V₂.ncard : ℤ) - E₂.ncard + 𝓕₂.ncard = (V.ncard : ℤ) - E.ncard + 𝓕.ncard := by + classical + have hg := h.graph + have hVb : ∀ Φ ∈ 𝓕, Φ ∩ V ⊆ discBd Φ := fun Φ hΦ y hy => by + by_contra hn + exact Set.disjoint_left.mp (h.int Φ hΦ) ⟨hy.1, hn⟩ (hV hy.2) + have hch : ∀ Φ ∈ 𝓕, ∃ (c : X) (𝓛 𝓒 : Set (Set X)), c ∈ discInt Φ ∧ IsChordFan Φ (insert c + (Φ ∩ V)) 𝓛 𝓒 ∧ + 𝓛.ncard = (Φ ∩ V).ncard ∧ 𝓒.ncard = (Φ ∩ V).ncard ∧ + (∀ L ∈ 𝓛, ∃ p ∈ Φ ∩ V, IsLineWithEnds L c p ∧ L ∩ discBd Φ = {p}) ∧ + ∀ L ∈ 𝓛, ∀ L' ∈ 𝓛, L ≠ L' → L ∩ L' = {c} := fun Φ hΦ => by + obtain ⟨a, b, ha, hb, hab⟩ := h.two_vertices hΦ + exact exists_cone (h.disc Φ hΦ) (hg.fin.subset inter_subset_right) (hVb Φ hΦ) ha hb hab + choose! c 𝓛 𝓒 hc hfan hnL hnS hsp hpr using hch + have hIntOff : ∀ Φ ∈ 𝓕, ∀ Φ' ∈ 𝓕, Φ ≠ Φ' → ∀ y ∈ Φ, y ∈ Φ' → y ∈ discBd Φ + := fun Φ hΦ Φ' hΦ' hne y h1 h2 => by + by_contra hn + exact Set.disjoint_left.mp (h.disj Φ hΦ Φ' hΦ' hne) ⟨h1, hn⟩ h2 + have hcIn : ∀ Φ ∈ 𝓕, ∀ Φ' ∈ 𝓕, c Φ ∈ Φ' → Φ' = Φ := fun Φ hΦ Φ' hΦ' h1 => by + by_contra hne + exact Set.disjoint_left.mp (h.disj Φ hΦ Φ' hΦ' (Ne.symm hne)) (hc Φ hΦ) h1 + have hcE : ∀ Φ ∈ 𝓕, c Φ ∉ ⋃₀ E := fun Φ hΦ h1 => Set.disjoint_left.mp (h.int Φ hΦ) (hc Φ hΦ) h1 + have hcΦ : ∀ Φ ∈ 𝓕, c Φ ∈ Φ := fun Φ hΦ => (hc Φ hΦ).1 + have hbdn : ∀ Φ ∈ 𝓕, c Φ ∉ discBd Φ := fun Φ hΦ => (hc Φ hΦ).2 + have hcV : ∀ Φ ∈ 𝓕, c Φ ∉ V := fun Φ hΦ h1 => hcE Φ hΦ (hV h1) + have hfS : ∀ Φ ∈ 𝓕, ∀ Ψ ∈ 𝓒 Φ, Ψ ⊆ Φ := fun Φ hΦ Ψ hΨ => (hfan Φ hΦ).sub Ψ hΨ + have hfL : ∀ Φ ∈ 𝓕, ∀ L ∈ 𝓛 Φ, L ⊆ Φ := fun Φ hΦ L hL => (hfan Φ hΦ).subL L hL + have hintΨ : ∀ Φ ∈ 𝓕, ∀ Ψ ∈ 𝓒 Φ, discInt Ψ ⊆ discInt Φ := fun Φ hΦ Ψ hΨ y hy => + ⟨hfS Φ hΦ Ψ hΨ hy.1, fun h' => Set.disjoint_left.mp ((hfan Φ hΦ).int Ψ hΨ) hy (.inl h')⟩ + have hLV : ∀ Φ ∈ 𝓕, ∀ L ∈ 𝓛 Φ, ∀ y ∈ L, y ∈ discBd Φ → y ∈ V := fun Φ hΦ L hL y h1 h2 => by + obtain ⟨p, hp, -, h3⟩ := hsp Φ hΦ L hL + have h4 : y ∈ L ∩ discBd Φ := ⟨h1, h2⟩ + rw [h3] at h4 + exact h4 ▸ hp.2 + have hEbd : ∀ Φ ∈ 𝓕, ∀ y ∈ Φ, y ∈ ⋃₀ E → y ∈ discBd Φ := fun Φ hΦ y h1 h2 => by + by_contra hn + exact Set.disjoint_left.mp (h.int Φ hΦ) ⟨h1, hn⟩ h2 + have hEnd : ∀ Φ ∈ 𝓕, ∀ L ∈ 𝓛 Φ, ∃ p ∈ Φ ∩ V, p ≠ c Φ ∧ L ∩ (V ∪ c '' 𝓕) = {c Φ, p} + ∧ IsLineWithEnds L (c Φ) p := by + intro Φ hΦ L hL + obtain ⟨p, hp, hl, h3⟩ := hsp Φ hΦ L hL + refine ⟨p, hp, fun h4 => hcV Φ hΦ (h4 ▸ hp.2), ?_, hl⟩ + ext y + constructor + · rintro ⟨h4, h5 | ⟨Φ', hΦ', rfl⟩⟩ + · have h6 : c Φ ∈ L ∧ y ∈ discBd Φ := ⟨hl.left_mem, hVb Φ hΦ ⟨hfL Φ hΦ L hL h4, h5⟩⟩ + have h7 : y ∈ L ∩ discBd Φ := ⟨h4, h6.2⟩ + rw [h3] at h7 + exact .inr h7 + · have := hcIn Φ' hΦ' Φ hΦ (hfL Φ hΦ L hL h4) + subst this + exact .inl rfl + · rintro (rfl | rfl) + · exact ⟨hl.left_mem, .inr ⟨Φ, hΦ, rfl⟩⟩ + · exact ⟨hl.right_mem, .inl hp.2⟩ + let V₂ : Set X := V ∪ c '' 𝓕 + let S₂ : Set (Set X) := ⋃ Φ ∈ 𝓕, 𝓛 Φ + let E₂ : Set (Set X) := E ∪ S₂ + let 𝓕₂ : Set (Set X) := ⋃ Φ ∈ 𝓕, 𝓒 Φ + have hdS₂ : ∀ Φ ∈ 𝓕, ∀ Φ' ∈ 𝓕, Φ ≠ Φ' → Disjoint (𝓛 Φ) (𝓛 Φ') := fun Φ hΦ Φ' hΦ' hne => + Set.disjoint_left.mpr fun L h1 h2 => by + obtain ⟨p, -, hl, -⟩ := hsp Φ hΦ L h1 + exact hne (hcIn Φ hΦ Φ' hΦ' (hfL Φ' hΦ' L h2 hl.left_mem)).symm + have hd𝓒 : ∀ Φ ∈ 𝓕, ∀ Φ' ∈ 𝓕, Φ ≠ Φ' → Disjoint (𝓒 Φ) (𝓒 Φ') := fun Φ hΦ Φ' hΦ' hne => + Set.disjoint_left.mpr fun Ψ h1 h2 => by + obtain ⟨y, hy⟩ := ((hfan Φ hΦ).disc Ψ h1).discInt_nonempty + exact Set.disjoint_left.mp (h.disj Φ hΦ Φ' hΦ' hne) (hintΨ Φ hΦ Ψ h1 hy) + (hfS Φ' hΦ' Ψ h2 hy.1) + have hdES : Disjoint E S₂ := Set.disjoint_left.mpr fun e he hS => by + obtain ⟨Φ, hΦ, hL⟩ : ∃ Φ ∈ 𝓕, e ∈ 𝓛 Φ := by simpa [S₂] using hS + obtain ⟨p, -, hl, -⟩ := hsp Φ hΦ e hL + exact hcE Φ hΦ ⟨e, he, hl.left_mem⟩ + have hfinS : S₂.Finite := h.fin.biUnion fun Φ hΦ => (hfan Φ hΦ).finL + have hcinj : InjOn c 𝓕 := fun Φ hΦ Φ' hΦ' h1 => (hcIn Φ hΦ Φ' hΦ' (h1 ▸ hcΦ Φ' hΦ')).symm + have hdVc : Disjoint V (c '' 𝓕) := Set.disjoint_right.mpr fun _ ⟨Φ, hΦ, h1⟩ h2 => hcV Φ hΦ + (h1 ▸ h2) + have hmS : ∀ {L}, L ∈ S₂ → ∃ Φ ∈ 𝓕, L ∈ 𝓛 Φ := fun {L} hL => by simpa [S₂] using hL + have hm𝓕 : ∀ {Ψ}, Ψ ∈ 𝓕₂ → ∃ Φ ∈ 𝓕, Ψ ∈ 𝓒 Φ := fun {Ψ} hΨ => by simpa [𝓕₂] using hΨ + have hEV₂ : ∀ e ∈ E, e ∩ V₂ = e ∩ V := fun e he => by + ext y + constructor + · rintro ⟨h1, h2 | ⟨Φ, hΦ, rfl⟩⟩ + · exact ⟨h1, h2⟩ + · exact absurd ⟨e, he, h1⟩ (hcE Φ hΦ) + · exact fun h1 => ⟨h1.1, .inl h1.2⟩ + have hgraph : IsGraph V₂ E₂ := by + refine ⟨hg.fin.union (h.fin.image _), hg.fine.union hfinS, ?_, ?_⟩ + · rintro e (he | he) + · obtain ⟨u, v, huv, hl, hi⟩ := hg.edge e he + exact ⟨u, v, huv, hl, (hEV₂ e he).trans hi⟩ + · obtain ⟨Φ, hΦ, hL⟩ := hmS he + obtain ⟨p, -, hne, hi, hl⟩ := hEnd Φ hΦ e hL + exact ⟨c Φ, p, hne.symm, hl, hi⟩ + · have hmix : ∀ e ∈ E, ∀ L ∈ S₂, ∀ y ∈ e, y ∈ L → y ∈ V₂ := fun e he L hL y h1 h2 => by + obtain ⟨Φ, hΦ, hL⟩ := hmS hL + exact .inl (hLV Φ hΦ L hL y h2 (hEbd Φ hΦ y (hfL Φ hΦ L hL h2) ⟨e, he, h1⟩)) + rintro e (he | he) f (hf | hf) hne y ⟨h1, h2⟩ + · exact .inl (hg.disj e he f hf hne ⟨h1, h2⟩) + · exact hmix e he f hf y h1 h2 + · exact hmix f hf e he y h2 h1 + · obtain ⟨Φ, hΦ, hL⟩ := hmS he + obtain ⟨Φ', hΦ', hL'⟩ := hmS hf + by_cases hq : Φ = Φ' + · subst hq + have h3 : y ∈ e ∩ f := ⟨h1, h2⟩ + rw [hpr Φ hΦ e hL f hL' hne] at h3 + exact .inr ⟨Φ, hΦ, h3.symm⟩ + · exact .inl (hLV Φ hΦ e hL y h1 (hIntOff Φ hΦ Φ' hΦ' hq y (hfL Φ hΦ e hL h1) + (hfL Φ' hΦ' f hL' h2))) + have hsimple : ∀ e ∈ E₂, ∀ f ∈ E₂, e ∩ V₂ = f ∩ V₂ → e = f := by + have hcross : ∀ e ∈ E, ∀ L ∈ S₂, e ∩ V₂ ≠ L ∩ V₂ := fun e he L hL h1 => by + obtain ⟨Φ, hΦ, hL⟩ := hmS hL + obtain ⟨p, -, hl, -⟩ := hsp Φ hΦ L hL + have h2 : c Φ ∈ L ∩ V₂ := ⟨hl.left_mem, .inr ⟨Φ, hΦ, rfl⟩⟩ + rw [← h1] at h2 + exact hcE Φ hΦ ⟨e, he, h2.1⟩ + rintro e (he | he) f (hf | hf) h1 + · rw [hEV₂ e he, hEV₂ f hf] at h1 + exact hs e he f hf h1 + · exact absurd h1 (hcross e he f hf) + · exact absurd h1.symm (hcross f hf e he) + · obtain ⟨Φ, hΦ, hL⟩ := hmS he + obtain ⟨Φ', hΦ', hL'⟩ := hmS hf + obtain ⟨p, hp, -, -, hl⟩ := hEnd Φ hΦ e hL + obtain ⟨p', hp', -, -, hl'⟩ := hEnd Φ' hΦ' f hL' + have h2 : c Φ ∈ f ∩ V₂ := h1 ▸ ⟨hl.left_mem, .inr ⟨Φ, hΦ, rfl⟩⟩ + have := (hcIn Φ hΦ Φ' hΦ' (hfL Φ' hΦ' f hL' h2.1)).symm + subst this + by_contra hne + have h3 : p ∈ f ∩ V₂ := h1 ▸ ⟨hl.right_mem, .inl hp.2⟩ + have h4 : p ∈ e ∩ f := ⟨hl.right_mem, h3.1⟩ + rw [hpr Φ hΦ e hL f hL' hne] at h4 + exact hbdn Φ hΦ (h4 ▸ hVb Φ hΦ hp) + have hdis : IsDissection V₂ E₂ 𝓕₂ := dissection_from_chord_fans h c 𝓛 𝓒 hfan hgraph + have htri : IsTriang V₂ E₂ 𝓕₂ := by + refine ⟨hdis, ?_, ?_, hsimple⟩ + · rintro y (hy | ⟨Φ, hΦ, rfl⟩) + · obtain ⟨e, he, h1⟩ := hV hy + exact ⟨e, .inl he, h1⟩ + · obtain ⟨a, b, ha, -, -⟩ := h.two_vertices hΦ + have hn : (Φ ∩ V).Nonempty := ⟨a, ha⟩ + have hL : (𝓛 Φ).Nonempty := by + rw [← ncard_pos ((hfan Φ hΦ).finL), hnL Φ hΦ] + exact (ncard_pos (hg.fin.subset inter_subset_right)).mpr hn + obtain ⟨L, hL⟩ := hL + obtain ⟨p, -, hl, -⟩ := hsp Φ hΦ L hL + exact ⟨L, .inr (by simpa [S₂] using ⟨Φ, hΦ, hL⟩), hl.left_mem⟩ + intro Ψ hΨ + obtain ⟨Φ, hΦ, hΨ⟩ := hm𝓕 hΨ + have h1 : Ψ ∩ V₂ = Ψ ∩ insert (c Φ) (Φ ∩ V) := by + ext y + constructor + · rintro ⟨h2, h3 | ⟨Φ', hΦ', rfl⟩⟩ + · exact ⟨h2, .inr ⟨hfS Φ hΦ Ψ hΨ h2, h3⟩⟩ + · have := hcIn Φ' hΦ' Φ hΦ (hfS Φ hΦ Ψ hΨ h2) + subst this + exact ⟨h2, .inl rfl⟩ + · rintro ⟨h2, h3 | h3⟩ + · exact ⟨h2, .inr ⟨Φ, hΦ, h3.symm⟩⟩ + · exact ⟨h2, .inl h3.2⟩ + rw [h1] + exact (hfan Φ hΦ).three Ψ hΨ + refine ⟨V₂, E₂, 𝓕₂, htri, subset_union_left, subset_union_left, ?_⟩ + have hS : S₂ = ⋃ Φ ∈ h.fin.toFinset, 𝓛 Φ := by simp [S₂] + have hF : 𝓕₂ = ⋃ Φ ∈ h.fin.toFinset, 𝓒 Φ := by simp [𝓕₂] + have c1 : S₂.ncard = ∑ Φ ∈ h.fin.toFinset, (Φ ∩ V).ncard := by + rw [hS, ncard_biUnion_eq _ _ (fun Φ hΦ => (hfan Φ (by simpa using hΦ)).finL) + (fun Φ hΦ Φ' hΦ' => hdS₂ Φ (by simpa using hΦ) Φ' (by simpa using hΦ'))] + exact Finset.sum_congr rfl fun Φ hΦ => hnL Φ (by simpa using hΦ) + have c2 : 𝓕₂.ncard = ∑ Φ ∈ h.fin.toFinset, (Φ ∩ V).ncard := by + rw [hF, ncard_biUnion_eq _ _ (fun Φ hΦ => (hfan Φ (by simpa using hΦ)).finS) + (fun Φ hΦ Φ' hΦ' => hd𝓒 Φ (by simpa using hΦ) Φ' (by simpa using hΦ'))] + exact Finset.sum_congr rfl fun Φ hΦ => hnS Φ (by simpa using hΦ) + have c3 : V₂.ncard = V.ncard + 𝓕.ncard := by + rw [ncard_union_eq hdVc hg.fin (h.fin.image _), hcinj.ncard_image] + have c4 : E₂.ncard = E.ncard + S₂.ncard := ncard_union_eq hdES hg.fine hfinS + rw [c3, c4, c1, c2] + push_cast + ring + +/-- **Triangulations.** Every dissection of a nonempty space can be refined to a triangulation, with +the same value of `|V| - |E| + |F|` and with each edge a union of edges of the triangulation. -/ +theorem IsDissection.exists_triang [Nonempty X] {V : Set X} {E 𝓕 : Set (Set X)} + (h : IsDissection V E 𝓕) : + ∃ (V₂ : Set X) (E₂ 𝓕₂ : Set (Set X)), IsTriang V₂ E₂ 𝓕₂ ∧ V ∩ ⋃₀ E ⊆ V₂ ∧ ⋃₀ E ⊆ ⋃₀ E₂ ∧ + (V₂.ncard : ℤ) - E₂.ncard + 𝓕₂.ncard = ((V ∩ ⋃₀ E).ncard : ℤ) - E.ncard + 𝓕.ncard := by + have ht := h.trim + obtain ⟨V₁, E₁, hd, hV, hV₁, hU, hs, hcV, hcE, -⟩ := ht.exists_halves inter_subset_right + obtain ⟨V₂, E₂, 𝓕₂, htri, h1, h2, h3⟩ := hd.exists_coned hV₁ hs + refine ⟨V₂, E₂, 𝓕₂, htri, hV.trans h1, ?_, ?_⟩ + · rw [← hU] + exact sUnion_mono h2 + · rw [h3, hcV, hcE] + push_cast + ring + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/VertexLink.lean b/LeanPool/GraphMinor/Surface/VertexLink.lean new file mode 100644 index 0000000000..bfb78e42e2 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/VertexLink.lean @@ -0,0 +1,444 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Polygon +public import Mathlib.Analysis.Normed.Module.Connected + +/-! +# Points of a presented surface + +A manifold point has small open neighbourhoods that stay connected when the point is removed +(`IsManifoldPoint.exists_punctured`). We use this at a vertex of a family of polygons with sides +glued by labels. Let +`f` send the discs onto a Hausdorff space. Suppose that `f` is compatible with the pasting and that +fibres over the +other points are single pasting classes. If the corners over the vertex `v` split into two classes, +then points near +`v` split into two parts that are closed in the punctured neighbourhood, which is impossible. So +all the corners over `v` are in one class (`prel_of_vertex`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +theorem isPreconnected_punctured_ball (w : EuclideanPlane) {r : ℝ} (_hr : 0 < r) : + IsPreconnected (ball w r \ {w}) := by + have hrk : 1 < Module.rank ℝ EuclideanPlane := by + rw [← Module.finrank_eq_rank] + simp [EuclideanPlane] + have hs : IsPreconnected (sphere (0 : EuclideanPlane) 1) := isPreconnected_sphere hrk 0 1 + have h1 := (isPreconnected_Ioo (a := (0 : ℝ)) (b := r)).prod hs + have h2 : ball w r \ {w} = (fun x : ℝ × EuclideanPlane => w + x.1 • x.2) '' + (Ioo 0 r ×ˢ sphere 0 1) := by + ext y + constructor + · rintro ⟨hy, hne⟩ + have h3 : y - w ≠ 0 := sub_ne_zero.mpr hne + have h4 : ‖y - w‖ ≠ 0 := norm_ne_zero_iff.mpr h3 + refine ⟨(‖y - w‖, (‖y - w‖)⁻¹ • (y - w)), ⟨⟨norm_pos_iff.mpr h3, ?_⟩, ?_⟩, ?_⟩ + · simpa [dist_eq_norm] using hy + · simp [norm_smul, h4] + · simp [smul_smul, h4] + · rintro ⟨⟨s, u⟩, ⟨hs1, hu⟩, rfl⟩ + have hu' : ‖u‖ = 1 := by simpa using hu + have hsn : ‖s‖ = s := Real.norm_of_nonneg hs1.1.le + refine ⟨?_, ?_⟩ + · simp [dist_eq_norm, norm_smul, hu', hsn, hs1.2] + · intro h3 + have h4 : s • u = 0 := by simpa using h3 + have h5 : ‖s • u‖ = s := by rw [norm_smul, hu', mul_one, hsn] + rw [h4, norm_zero] at h5 + exact hs1.1.ne h5 + rw [h2] + exact h1.image _ (by fun_prop) + +theorem isPreconnected_punctured_half (w : EuclideanPlane) (hw : w 0 = 0) {r : ℝ} (_hr : 0 < r) : + IsPreconnected ((ball w r ∩ {x | 0 ≤ x 0}) \ {w}) := by + let e : EuclideanPlane := EuclideanSpace.single 0 1 + have he0 : e 0 = 1 := by simp [e] + have hen : ‖e‖ = 1 := by simp [e] + let C : Set EuclideanPlane := ball w r ∩ {x | 0 < x 0} + have hcv : Convex ℝ C := by + refine (convex_ball _ _).inter ?_ + intro a ha b hb s t hs ht hst + have ha' : 0 < a 0 := ha + have hb' : 0 < b 0 := hb + change 0 < (s • a + t • b) 0 + simp only [PiLp.add_apply, PiLp.smul_apply, smul_eq_mul] + rcases eq_or_lt_of_le hs with rfl | h1 + · have : t = 1 := by linarith + subst this + simpa using hb' + · have := mul_pos h1 ha' + have := mul_nonneg ht hb'.le + linarith + refine hcv.isPreconnected.subset_closure ?_ ?_ + · rintro y ⟨h1, h2⟩ + refine ⟨⟨h1, le_of_lt (show 0 < y 0 from h2)⟩, fun h3 => ?_⟩ + have h4 : y = w := h3 + have h5 : 0 < y 0 := h2 + rw [h4, hw] at h5 + exact lt_irrefl _ h5 + · rintro y ⟨⟨h1, h2⟩, -⟩ + have h1' : dist y w < r := h1 + rw [mem_closure_iff_seq_limit] + let δ : ℝ := r - dist y w + have hδ : 0 < δ := sub_pos.mpr h1' + let u : ℕ → EuclideanPlane := fun n => y + (δ / 2 / (n + 1)) • e + have hsm : ∀ n : ℕ, 0 < δ / 2 / (n + 1) := fun n => by positivity + have hsm2 : ∀ n : ℕ, δ / 2 / (n + 1) ≤ δ / 2 := fun n => + div_le_self (by positivity) (by + have : (0 : ℝ) ≤ n := Nat.cast_nonneg n + linarith) + refine ⟨u, fun n => ⟨?_, ?_⟩, ?_⟩ + · have h3 : dist (u n) y = δ / 2 / (n + 1) := by + simp only [u, dist_eq_norm, add_sub_cancel_left, norm_smul, hen, mul_one, Real.norm_eq_abs, + abs_of_pos (hsm n)] + have h4 := dist_triangle (u n) y w + have h5 := hsm2 n + change dist (u n) w < r + simp only [δ] at * + linarith + · change 0 < (u n) 0 + have h2' : 0 ≤ y 0 := h2 + simp only [u, PiLp.add_apply, PiLp.smul_apply, smul_eq_mul, he0, mul_one] + linarith [hsm n] + · have h3 : Filter.Tendsto (fun n : ℕ => δ / 2 / ((n : ℝ) + 1)) Filter.atTop (𝓝 0) := + tendsto_const_div_atTop_nhds_zero_nat (δ / 2) |>.comp (Filter.tendsto_add_atTop_nat 1) + |>.congr (by + intro n + simp) + have h4 : Filter.Tendsto u Filter.atTop (𝓝 (y + (0 : ℝ) • e)) := + tendsto_const_nhds.add (h3.smul_const e) + simpa using h4 + +/-- A point of the half plane has small open neighbourhoods that are connected without the point. -/ +theorem halfSpace_punctured (w : EuclideanHalfSpace 2) {O : Set (EuclideanHalfSpace 2)} + (hO : IsOpen O) (hw : w ∈ O) : + ∃ O', IsOpen O' ∧ w ∈ O' ∧ O' ⊆ O ∧ IsPreconnected (O' \ {w}) := by + have hind : IsInducing (fun x : EuclideanHalfSpace 2 => x.1) := ⟨rfl⟩ + obtain ⟨O1, hO1, e1⟩ := hind.isOpen_iff.mp hO + have hw1 : w.1 ∈ O1 := by + have : w ∈ (fun x : EuclideanHalfSpace 2 => x.1) ⁻¹' O1 := e1 ▸ hw + exact this + obtain ⟨r, hr, hsub⟩ := Metric.isOpen_iff.mp hO1 w.1 hw1 + have hbdd : ∃ r' : ℝ, 0 < r' ∧ r' ≤ r ∧ (0 < w.1 0 → r' ≤ w.1 0) := by + rcases eq_or_lt_of_le w.2 with h0 | h0 + · exact ⟨r, hr, le_rfl, fun h1 => absurd h1 (by rw [← h0]; exact lt_irrefl _)⟩ + · exact ⟨min r (w.1 0), lt_min hr h0, min_le_left _ _, fun _ => min_le_right _ _⟩ + obtain ⟨r', hr', hr'r, hr'w⟩ := hbdd + refine ⟨(fun x : EuclideanHalfSpace 2 => x.1) ⁻¹' ball w.1 r', isOpen_ball.preimage + hind.continuous, + mem_ball_self hr', ?_, ?_⟩ + · intro y hy + rw [← e1] + exact hsub (ball_subset_ball hr'r hy) + refine hind.isPreconnected_image.mp ?_ + rcases eq_or_lt_of_le w.2 with h0 | h0 + · have e : (fun x : EuclideanHalfSpace 2 => x.1) '' ((fun x : EuclideanHalfSpace 2 + => x.1) ⁻¹' ball w.1 r' \ {w}) = + (ball w.1 r' ∩ {x | 0 ≤ x 0}) \ {w.1} := by + ext y + constructor + · rintro ⟨z, ⟨hz, hne⟩, rfl⟩ + exact ⟨⟨hz, z.2⟩, fun h => hne (Subtype.ext h)⟩ + · rintro ⟨⟨h1, h2⟩, h3⟩ + exact ⟨⟨y, h2⟩, ⟨h1, fun h => h3 (congrArg Subtype.val h)⟩, rfl⟩ + rw [e] + exact isPreconnected_punctured_half w.1 h0.symm hr' + · have e : (fun x : EuclideanHalfSpace 2 => x.1) '' ((fun x : EuclideanHalfSpace 2 + => x.1) ⁻¹' ball w.1 r' \ {w}) = + ball w.1 r' \ {w.1} := by + ext y + constructor + · rintro ⟨z, ⟨hz, hne⟩, rfl⟩ + exact ⟨hz, fun h => hne (Subtype.ext h)⟩ + · rintro ⟨h1, h3⟩ + have h2 : 0 ≤ y 0 := by + have h4 : |y 0 - w.1 0| ≤ dist y w.1 := by + have := PiLp.norm_apply_le (y - w.1) 0 + simpa [dist_eq_norm, Real.norm_eq_abs] using this + have h5 : dist y w.1 < r' := h1 + have h6 := hr'w h0 + have h7 := abs_lt.mp (h4.trans_lt h5) + linarith [h7.1] + exact ⟨⟨y, h2⟩, ⟨h1, fun h => h3 (congrArg Subtype.val h)⟩, rfl⟩ + rw [e] + exact isPreconnected_punctured_ball w.1 hr' + +/-- A manifold point has small open neighbourhoods that are connected without the point. -/ +theorem IsManifoldPoint.exists_punctured {X : Type u} [TopologicalSpace X] {v : X} + (hv : IsManifoldPoint v) {N : Set X} + (hN : IsOpen N) (hvN : v ∈ N) : ∃ N', IsOpen N' ∧ v ∈ N' ∧ N' ⊆ N ∧ IsPreconnected (N' \ {v}) + := by + obtain ⟨U, V, hU, hV, hvU, ⟨φ⟩⟩ := hv + let vU : U := ⟨v, hvU⟩ + let O0 : Set V := φ '' (Subtype.val ⁻¹' N) + have hO0 : IsOpen O0 := φ.isOpenMap _ (hN.preimage continuous_subtype_val) + obtain ⟨O1, hO1, e1⟩ := isOpen_induced_iff.mp hO0 + have hO : IsOpen (O1 ∩ V) := hO1.inter hV + have hw : (φ vU).1 ∈ O1 ∩ V := by + refine ⟨?_, (φ vU).2⟩ + have : φ vU ∈ O0 := ⟨vU, hvN, rfl⟩ + rw [← e1] at this + exact this + obtain ⟨O', hO', hwO', hsub, hconn⟩ := halfSpace_punctured _ hO hw + have hVO : O' ⊆ V := hsub.trans inter_subset_right + let G : Set V := Subtype.val ⁻¹' O' + have hG : IsOpen G := hO'.preimage continuous_subtype_val + let N' : Set X := (fun y : U => y.1) '' (φ ⁻¹' G) + have hN' : IsOpen N' := hU.isOpenMap_subtype_val _ (hG.preimage φ.continuous) + refine ⟨N', hN', ⟨vU, hwO', rfl⟩, ?_, ?_⟩ + · rintro _ ⟨y, hy, rfl⟩ + have h1 : (φ y).1 ∈ O1 := (hsub hy).1 + have h2 : φ y ∈ O0 := by + rw [← e1] + exact h1 + obtain ⟨y', hy', e⟩ := h2 + rw [φ.injective e] at hy' + exact hy' + · have hm : (fun z : EuclideanHalfSpace 2 => z) ⁻¹' O' = O' := rfl + have himg : N' \ {v} = (fun z : V => (φ.symm z).1) '' (Subtype.val ⁻¹' (O' \ {(φ vU).1})) := by + ext x + constructor + · rintro ⟨⟨y, hy, rfl⟩, hne⟩ + refine ⟨φ y, ⟨hy, fun h => hne ?_⟩, by simp⟩ + have : φ y = φ vU := Subtype.ext h + rw [φ.injective this] + rfl + · rintro ⟨z, ⟨hz, hne⟩, rfl⟩ + refine ⟨⟨φ.symm z, ?_, rfl⟩, fun h => hne ?_⟩ + · simpa [G] using hz + · have h2 : φ.symm z = vU := Subtype.ext h + rw [← h2] + simp + rw [himg] + have hind : IsInducing (Subtype.val : V → EuclideanHalfSpace 2) := IsInducing.subtypeVal + have hpc : IsPreconnected (Subtype.val ⁻¹' (O' \ {(φ vU).1}) : Set V) := by + refine hind.isPreconnected_image.mp ?_ + rw [image_preimage_eq_inter_range, Subtype.range_coe, inter_eq_left.mpr + (sdiff_subset.trans hVO)] + exact hconn + exact hpc.image _ (continuous_subtype_val.comp φ.symm.continuous).continuousOn + +/-- The set of steps of a finite family is compact. -/ +theorem isCompact_stp {W : ℕ → List Letter} (hW : {i | W i ≠ []}.Finite) : + IsCompact {x : (ℕ × ℂ) × (ℕ × ℂ) | Stp W x.1 x.2} := by + classical + let Sd : Set (ℕ × ℕ × Bool) := {x | ∃ k, (W x.1)[x.2.1]? = some (k, x.2.2)} + have hSd : Sd.Finite := by + refine (hW.biUnion fun i _ => ((finite_singleton i).prod ((finite_lt_nat (W i).length).prod + (finite_univ (α := Bool))))).subset ?_ + rintro ⟨i, p, ε⟩ ⟨k, h⟩ + have h1 : (W i)[p]? = some (k, ε) := h + have hlt : p < (W i).length := (List.getElem?_eq_some_iff.mp h1).1 + refine mem_biUnion (x := i) (fun he => ?_) ⟨rfl, hlt, mem_univ _⟩ + simp [he] at hlt + let pc : (ℕ × ℕ × Bool) × (ℕ × ℕ × Bool) → Set ((ℕ × ℂ) × (ℕ × ℂ)) := fun x => + (fun t : ℝ => ((x.1.1, sdPt (W x.1.1).length x.1.2.1 x.1.2.2 t), + (x.2.1, sdPt (W x.2.1).length x.2.2.1 x.2.2.2 t))) '' Icc 0 1 + have hcp : ∀ x, IsCompact (pc x) := fun x => by + refine isCompact_Icc.image ?_ + have hs : ∀ n p b, Continuous (sdPt n p b) := fun n p b => by + unfold sdPt + split_ifs + · exact (continuous_per n).comp (by fun_prop) + · exact (continuous_per n).comp (by fun_prop) + exact (continuous_const.prodMk (hs _ _ _)).prodMk (continuous_const.prodMk (hs _ _ _)) + have hT : ((Sd ×ˢ Sd) ∩ {x | (x.1.1, x.1.2.1) ≠ (x.2.1, x.2.2.1) ∧ ∃ k, (W x.1.1)[x.1.2.1]? + = some (k, x.1.2.2) ∧ + (W x.2.1)[x.2.2.1]? = some (k, x.2.2.2)}).Finite := (hSd.prod hSd).subset inter_subset_left + have e : {x : (ℕ × ℂ) × (ℕ × ℂ) | Stp W x.1 x.2} = ⋃ x ∈ ((Sd ×ˢ Sd) ∩ {x | (x.1.1, x.1.2.1) ≠ + (x.2.1, x.2.2.1) ∧ + ∃ k, (W x.1.1)[x.1.2.1]? = some (k, x.1.2.2) ∧ (W x.2.1)[x.2.2.1]? = some + (k, x.2.2.2)}), pc x := by + ext ⟨a, b⟩ + simp only [mem_ofPred_eq, mem_iUnion, exists_prop] + constructor + · rintro ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ + exact ⟨((i, p, ε), (j, q, ε')), ⟨⟨⟨k, h1⟩, ⟨k, h2⟩⟩, h3, k, h1, h2⟩, t, ht, rfl⟩ + · rintro ⟨⟨⟨i, p, ε⟩, ⟨j, q, ε'⟩⟩, ⟨-, h3, k, h1, h2⟩, t, ht, e⟩ + obtain ⟨rfl, rfl⟩ := Prod.mk.inj e + exact ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ + rw [e] + exact hT.isCompact_biUnion fun x _ => hcp x + +theorem Stp.symm {W : ℕ → List Letter} {a b : ℕ × ℂ} (h : Stp W a b) : Stp W b a := by + obtain ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ := h + exact ⟨j, i, q, p, k, ε', ε, t, h2, h1, h3.symm, ht, rfl, rfl⟩ + +theorem mem_closure_punctured_ball {z : ℂ} (hz : z ∈ closedBall (0 : ℂ) 1) : + z ∈ closure (closedBall (0 : ℂ) 1 \ {z}) := by + have h1 : ball (0 : ℂ) 1 ⊆ closure (ball (0 : ℂ) 1 ∩ {z}ᶜ) := by + intro y hy + refine isOpen_ball.inter_closure ⟨hy, ?_⟩ + rw [closure_compl_singleton] + exact mem_univ _ + have h2 : z ∈ closure (ball (0 : ℂ) 1) := by + rwa [closure_ball _ one_ne_zero] + have h3 := closure_minimal h1 isClosed_closure h2 + have h4 : ball (0 : ℂ) 1 ∩ {z}ᶜ ⊆ closedBall (0 : ℂ) 1 \ {z} := fun y hy => + ⟨ball_subset_closedBall hy.1, hy.2⟩ + exact closure_mono h4 h3 + +variable {X : Type u} [TopologicalSpace X] [T2Space X] {W : ℕ → List Letter} {f : ℕ × ℂ → X} + +/-- If the corners over a manifold point `v` are not all related, the punctured neighbourhoods of +`v` fall apart. -/ +theorem prel_of_vertex (hW : {i | W i ≠ []}.Finite) (hc : ContinuousOn f (Dsk W)) (hs : f '' Dsk W + = univ) + (hst : ∀ a b, Stp W a b → f a = f b) + (hinj : ∀ a ∈ Dsk W, ∀ b ∈ Dsk W, a.1 = b.1 → f a = f b → a = b) + {V : Set X} (hV : V.Finite) {v : X} (hv : IsManifoldPoint v) (hZ : (Dsk W ∩ f ⁻¹' {v}).Finite) + (hoff : ∀ a ∈ Dsk W, ∀ b ∈ Dsk W, f a = f b → f a ∉ V → PRel W a b) + {a b : ℕ × ℂ} (ha : a ∈ Dsk W) (hb : b ∈ Dsk W) (hav : f a = v) (hbv : f b = v) : PRel W a b + := by + classical + by_contra hnot + have hDc : IsCompact (Dsk W) := isCompact_Dsk hW + let A : Set (ℕ × ℂ) := {z | z ∈ Dsk W ∧ f z = v ∧ PRel W a z} + let B : Set (ℕ × ℂ) := {z | z ∈ Dsk W ∧ f z = v ∧ ¬ PRel W a z} + have hAf : A.Finite := hZ.subset fun z hz => by exact ⟨hz.1, hz.2.1⟩ + have hBf : B.Finite := hZ.subset fun z hz => by exact ⟨hz.1, hz.2.1⟩ + have hAB : Disjoint A B := Set.disjoint_left.mpr fun z hz hz' => hz'.2.2 hz.2.2 + obtain ⟨U₀, hU₀, hBU₀, hcl₀⟩ : ∃ U₀, IsOpen U₀ ∧ B ⊆ U₀ ∧ closure U₀ ⊆ Aᶜ := + normal_exists_closure_subset hBf.isClosed hAf.isClosed.isOpen_compl + (subset_compl_iff_disjoint_left.mpr hAB) + obtain ⟨UA, hUA, hAUA, hclA⟩ : ∃ UA, IsOpen UA ∧ A ⊆ UA ∧ closure UA ⊆ (closure U₀)ᶜ := + normal_exists_closure_subset hAf.isClosed isClosed_closure.isOpen_compl + (fun z hz hz' => hcl₀ hz' hz) + let UB := U₀ + have hdisj : ∀ z, z ∈ closure UA → z ∈ closure UB → False := fun z h1 h2 => hclA h1 h2 + have hdisj' : ∀ z, z ∈ UA → z ∉ UB := fun z h1 h2 => hdisj z (subset_closure h1) + (subset_closure h2) + let R : Set ((ℕ × ℂ) × (ℕ × ℂ)) := {x | Stp W x.1 x.2} ∩ (closure UA ×ˢ closure UB) + have hRc : IsCompact R := (isCompact_stp hW).inter_right (isClosed_closure.prod isClosed_closure) + let C : Set X := (fun x : (ℕ × ℂ) × (ℕ × ℂ) => f x.1) '' R + have hCc : IsCompact C := by + refine hRc.image_of_continuousOn ?_ + exact hc.comp continuousOn_fst fun x hx => (hx.1 : Stp W x.1 x.2).mem_Dsk.1 + have hvC : v ∉ C := by + rintro ⟨⟨x, y⟩, ⟨hs1, hx, hy⟩, hfx⟩ + have hs2 : Stp W x y := hs1 + have hfx' : f x = v := hfx + have hfy : f y = v := (hst x y hs2).symm.trans hfx' + obtain ⟨hxD, hyD⟩ := hs2.mem_Dsk + have hxA : x ∈ A := by + by_contra hn + have : x ∈ B := ⟨hxD, hfx', fun h => hn ⟨hxD, hfx', h⟩⟩ + exact hdisj x hx (subset_closure (hBU₀ this)) + have hyB : y ∈ B := ⟨hyD, hfy, fun h => hdisj y (subset_closure (hAUA ⟨hyD, hfy, h⟩)) hy⟩ + exact hyB.2.2 (.trans _ _ _ hxA.2.2 (.rel _ _ hs2)) + let C1 : Set X := f '' (Dsk W \ (UA ∪ UB)) + have hC1c : IsCompact C1 := + (hDc.diff (hUA.union hU₀)).image_of_continuousOn (hc.mono sdiff_subset) + have hvC1 : v ∉ C1 := by + rintro ⟨z, ⟨hzD, hz⟩, hfz⟩ + by_cases hp : PRel W a z + · exact hz (.inl (hAUA ⟨hzD, hfz, hp⟩)) + · exact hz (.inr (hBU₀ ⟨hzD, hfz, hp⟩)) + have hC2f : (V \ {v}).Finite := hV.subset sdiff_subset + let N : Set X := (C ∪ C1 ∪ (V \ {v}))ᶜ + have hN : IsOpen N := ((hCc.isClosed.union hC1c.isClosed).union hC2f.isClosed).isOpen_compl + have hvN : v ∈ N := by + rintro ((h | h) | h) + · exact hvC h + · exact hvC1 h + · exact h.2 rfl + obtain ⟨N', hN', hvN', hsub, hconn⟩ := hv.exists_punctured hN hvN + let FA : Set X := f '' (Dsk W \ UB) + let FB : Set X := f '' (Dsk W \ UA) + have hFA : IsClosed FA := ((hDc.diff hU₀).image_of_continuousOn (hc.mono sdiff_subset)).isClosed + have hFB : IsClosed FB := ((hDc.diff hUA).image_of_continuousOn (hc.mono sdiff_subset)).isClosed + have hcov : N' \ {v} ⊆ FA ∪ FB := by + rintro y ⟨hy, -⟩ + have h1 : y ∈ f '' Dsk W := hs ▸ mem_univ y + obtain ⟨x, hx, rfl⟩ := h1 + by_cases hxA : x ∈ UA + · exact .inl ⟨x, ⟨hx, hdisj' x hxA⟩, rfl⟩ + · exact .inr ⟨x, ⟨hx, hxA⟩, rfl⟩ + have hnear : ∀ (z : ℕ × ℂ) (U : Set (ℕ × ℂ)), z ∈ Dsk W → f z = v → IsOpen U → z ∈ U → + ∃ y ∈ N' \ {v}, ∃ z' ∈ Dsk W, z' ∈ U ∧ f z' = y := by + rintro ⟨i, z⟩ U hzD hfz hU hzU + have hz1 : z ∈ closedBall (0 : ℂ) 1 := by simpa using hzD.2 + have hmap : MapsTo (fun w : ℂ => (i, w)) (closedBall (0 : ℂ) 1) (Dsk W) := fun w hw => + ⟨hzD.1, by simpa using hw⟩ + have hcw : ContinuousOn (fun w : ℂ => f (i, w)) (closedBall 0 1) := + hc.comp (by fun_prop) hmap + have hcont := hcw z hz1 + have hopen : (fun w : ℂ => (i, w)) ⁻¹' U ∈ 𝓝 z := + (hU.preimage (by fun_prop)).mem_nhds hzU + have hn : (fun w : ℂ => f (i, w)) ⁻¹' N' ∈ 𝓝[closedBall 0 1] z := + hcont (hN'.mem_nhds (by simpa [hfz] using hvN')) + obtain ⟨Q, hQ, hQo, hzQ⟩ := mem_nhdsWithin.mp hn + have hcl := mem_closure_punctured_ball hz1 + obtain ⟨w, ⟨hwQ, hwU⟩, hw⟩ := mem_closure_iff.mp hcl _ (hQ.inter (hU.preimage (by fun_prop))) + ⟨hQo, hzU⟩ + have hwN : f (i, w) ∈ N' := hzQ ⟨hwQ, hw.1⟩ + refine ⟨f (i, w), ⟨hwN, fun he => hw.2 ?_⟩, (i, w), hmap hw.1, hwU, rfl⟩ + have := hinj (i, w) (hmap hw.1) (i, z) hzD rfl (he.trans hfz.symm) + exact (Prod.mk.inj this).2 + have haA : a ∈ A := ⟨ha, hav, .refl _⟩ + have hbB : b ∈ B := ⟨hb, hbv, hnot⟩ + obtain ⟨y1, hy1, z1, hz1, hz1U, rfl⟩ := hnear a UA ha hav hUA (hAUA haA) + obtain ⟨y2, hy2, z2, hz2, hz2U, rfl⟩ := hnear b UB hb hbv hU₀ (hBU₀ hbB) + obtain ⟨y, hy, hyA, hyB⟩ := isPreconnected_closed_iff.mp hconn FA FB hFA hFB hcov + ⟨_, hy1, z1, ⟨hz1, hdisj' z1 hz1U⟩, rfl⟩ ⟨_, hy2, z2, ⟨hz2, fun h => hdisj' z2 h hz2U⟩, rfl⟩ + obtain ⟨x1, ⟨hx1, hx1U⟩, rfl⟩ := hyA + obtain ⟨x2, ⟨hx2, hx2U⟩, he⟩ := hyB + have hyN : f x1 ∈ N := hsub hy.1 + have hoffcov : ∀ x ∈ Dsk W, f x = f x1 → x ∈ UA ∪ UB := fun x hx hfx => by + by_contra hn + exact hyN (.inl (.inr ⟨x, ⟨hx, hn⟩, hfx⟩)) + have hx1A : x1 ∈ UA := (hoffcov x1 hx1 rfl).resolve_right hx1U + have hx2B : x2 ∈ UB := (hoffcov x2 hx2 he).resolve_left hx2U + have hnotV : f x1 ∉ V := fun h => hyN (.inr ⟨h, hy.2⟩) + have hrel : PRel W x1 x2 := hoff x1 hx1 x2 hx2 he.symm hnotV + have hstep : ∀ x x', PRel W x x' → x ∈ Dsk W → f x = f x1 → (x ∈ UA ↔ x' ∈ UA) ∧ f x' = f x1 + ∧ x' ∈ Dsk W := by + intro x x' h + induction h with + | rel x x' hs => + intro hxD hfx + have hfx' : f x' = f x1 := (hst x x' hs).symm.trans hfx + have hxD' := hs.mem_Dsk.2 + refine ⟨⟨fun h1 => ?_, fun h1 => ?_⟩, hfx', hxD'⟩ + · by_contra hn + have h2 : x' ∈ UB := (hoffcov x' hxD' hfx').resolve_left hn + exact hyN (.inl (.inl ⟨(x, x'), ⟨hs, subset_closure h1, subset_closure h2⟩, hfx⟩)) + · by_contra hn + have h2 : x ∈ UB := (hoffcov x hxD hfx).resolve_left hn + exact hyN (.inl (.inl ⟨(x', x), ⟨hs.symm, subset_closure h1, subset_closure h2⟩, hfx'⟩)) + | refl x => exact fun hxD hfx => ⟨Iff.rfl, hfx, hxD⟩ + | symm x x' h ih => + intro hxD hfx + have hmem : x ∈ Dsk W := (prel_mem_iff h).mpr hxD + have hf' : f x = f x1 := by + have key : ∀ p q, PRel W p q → f p = f q := fun p q hpq => by + induction hpq with + | rel _ _ hs => exact hst _ _ hs + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ i1 i2 => exact i1.trans i2 + exact (key _ _ h).trans hfx + exact ⟨(ih hmem hf').1.symm, hf', hmem⟩ + | trans x x' x'' _ _ i1 i2 => + intro hxD hfx + obtain ⟨h1, h2, h3⟩ := i1 hxD hfx + obtain ⟨h4, h5, h6⟩ := i2 h3 h2 + exact ⟨h1.trans h4, h5, h6⟩ + exact hx2U ((hstep _ _ hrel hx1 rfl).1.mp hx1A) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/VoltWord.lean b/LeanPool/GraphMinor/Surface/VoltWord.lean new file mode 100644 index 0000000000..12818f409a --- /dev/null +++ b/LeanPool/GraphMinor/Surface/VoltWord.lean @@ -0,0 +1,355 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.WordCover +public import LeanPool.GraphMinor.Surface.CircleMove + +/-! +# Voltages on words + +Give each label of a family of words a value in a finite group `A`, which need not be commutative, +such that the values along +each word add up to zero. The partial sums along a word give a function on the discs with constant +jumps on pasted sides +(`sideConst_gW`), so `exists_cocycle` gives a local cocycle with this function as a primitive. The +main result is `volt_zero`. +A closed curve that is null-homotopic has a primitive that closes up, so a side of the word that +runs along such a curve has +value zero. This is how we show below that an `O`-arc is not null-homotopic. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +universe u + +section words + +variable {A : Type} [AddGroup A] + +/-- The value of a letter. -/ +def lVal (V : ℕ → A) (l : Letter) : A := if l.2 then V l.1 else -V l.1 + +/-- The sum of the values along a word. -/ +def wv (V : ℕ → A) (w : List Letter) : A := (w.map (lVal V)).sum + +@[simp] theorem wv_nil (V : ℕ → A) : wv V [] = 0 := rfl + +@[simp] theorem wv_cons (V : ℕ → A) (l : Letter) (w : List Letter) : wv V (l :: w) + = lVal V l + wv V w := by + simp [wv] + +@[simp] theorem wv_append (V : ℕ → A) (w w' : List Letter) : wv V (w ++ w') = wv V w + wv V w' := by + simp [wv] + +theorem lVal_linv (V : ℕ → A) (l : Letter) : lVal V (linv l) = -lVal V l := by + obtain ⟨k, e⟩ := l + cases e <;> simp [lVal, linv] + +theorem wv_congr {V V' : ℕ → A} {w : List Letter} (h : ∀ l ∈ w, V l.1 = V' l.1) : wv V w = wv V' w + := by + induction w with + | nil => rfl + | cons l w ih => + rw [wv_cons, wv_cons, ih fun l' hl' => h l' (.tail _ hl')] + have := h l (.head _) + simp only [lVal, this] + +theorem wv_zero {V : ℕ → A} {w : List Letter} (h : ∀ l ∈ w, V l.1 = 0) : wv V w = 0 := by + induction w with + | nil => rfl + | cons l w ih => + rw [wv_cons, ih fun l' hl' => h l' (.tail _ hl')] + have := h l (.head _) + simp [lVal, this] + +/-- The sum of the values of the first `j` letters. -/ +def pr (V : ℕ → A) (w : List Letter) (j : ℕ) : A := wv V (w.take j) + +theorem pr_zero (V : ℕ → A) (w : List Letter) : pr V w 0 = 0 := by simp [pr] + +theorem pr_succ (V : ℕ → A) {w : List Letter} {p : ℕ} {l : Letter} (h : w[p]? = some l) : pr V w + (p + 1) = pr V w p + lVal V l := by + obtain ⟨hp, rfl⟩ := List.getElem?_eq_some_iff.mp h + rw [pr, pr, List.take_succ_eq_append_getElem hp, wv_append, wv_cons, wv_nil, add_zero] + +theorem pr_length (V : ℕ → A) (w : List Letter) : pr V w w.length = wv V w := by + rw [pr, List.take_length] + +open Classical in +/-- The value at the point of the side `p` at the distance `u` from its start. It jumps at the +middle of the side. -/ +noncomputable def gs (V : ℕ → A) (w : List Letter) (p : ℕ) (u : ℝ) : A := + match w[p]? with + | some l => pr V w (if l.2 then p else p + 1) + if ofs l.2 u < 1 / 2 then 0 else V l.1 + | none => 0 + +theorem gs_zero (V : ℕ → A) {w : List Letter} {p : ℕ} {l : Letter} (h : w[p]? + = some l) : gs V w p 0 = pr V w p := by + obtain ⟨k, e⟩ := l + simp only [gs, h] + cases e + · simp only [Bool.false_eq_true, ite_false, ofs] + rw [pr_succ V h] + norm_num [lVal] + · simp only [ite_true, ofs] + norm_num + +theorem gs_one (V : ℕ → A) {w : List Letter} {p : ℕ} {l : Letter} (h : w[p]? = some l) : gs V w p 1 + = pr V w (p + 1) := by + obtain ⟨k, e⟩ := l + simp only [gs, h] + cases e + · simp only [Bool.false_eq_true, ite_false, ofs] + norm_num + · simp only [ite_true, ofs] + rw [pr_succ V h] + norm_num [lVal] + +theorem gs_congr (V : ℕ → A) {w : List Letter} (hV : wv V w = 0) {p p' : ℕ} {u u' : ℝ} + (hp : p < w.length) (hp' : p' < w.length) + (hu : u ∈ Icc (0 : ℝ) 1) (hu' : u' ∈ Icc (0 : ℝ) 1) (he : per w.length (p + u) = per w.length + (p' + u')) : + gs V w p u = gs V w p' u' := by + set n := w.length with hn + by_cases h1 : u ∈ Ioo (0 : ℝ) 1 + · obtain ⟨rfl, rfl⟩ := side_unique hp hp' h1 hu' he + rfl + by_cases h2 : u' ∈ Ioo (0 : ℝ) 1 + · obtain ⟨rfl, rfl⟩ := side_unique hp' hp h2 hu he.symm + rfl + have hend : ∀ v ∈ Icc (0 : ℝ) 1, v ∉ Ioo (0 : ℝ) 1 → v = 0 ∨ v = 1 := fun v hv hv' => by + by_contra hc + push Not at hc + exact hv' ⟨lt_of_le_of_ne hv.1 (Ne.symm hc.1), lt_of_le_of_ne hv.2 hc.2⟩ + have key : ∀ (q : ℕ) (v : ℝ), q < n → v = 0 ∨ v = 1 → ∃ j : ℕ, (j : ℝ) = q + v ∧ j ≤ q + 1 + ∧ gs V w q v = pr V w j := by + rintro q v hq (rfl | rfl) + · exact ⟨q, by simp, by omega, gs_zero V (List.getElem?_eq_getElem hq)⟩ + · exact ⟨q + 1, by simp, le_rfl, gs_one V (List.getElem?_eq_getElem hq)⟩ + obtain ⟨j, hj, hj1, hj2⟩ := key p u hp (hend u hu h1) + obtain ⟨j', hj', hj1', hj2'⟩ := key p' u' hp' (hend u' hu' h2) + rw [hj2, hj2'] + rw [← hj, ← hj'] at he + obtain ⟨m, hm⟩ := per_eq (show 0 < n by omega) he + have hn0 : (0 : ℤ) < n := by exact_mod_cast (show 0 < n by omega) + have hm' : (j : ℤ) = j' + m * n := by exact_mod_cast hm + have hjn : (j : ℤ) ≤ n := by exact_mod_cast (show j ≤ n by omega) + have hjn' : (j' : ℤ) ≤ n := by exact_mod_cast (show j' ≤ n by omega) + have hj0 : (0 : ℤ) ≤ j := by positivity + have hj0' : (0 : ℤ) ≤ j' := by positivity + have hmb : m = 0 ∨ m = 1 ∨ m = -1 := by + have h3 : m < 2 := by + by_contra hc + have : 2 * (n : ℤ) ≤ m * n := by nlinarith + omega + have h4 : -2 < m := by + by_contra hc + have : m * (n : ℤ) ≤ -2 * n := by nlinarith + omega + omega + have hT : pr V w n = 0 := by rw [hn, pr_length, hV] + rcases hmb with rfl | rfl | rfl + · have : j = j' := by omega + rw [this] + · have h3 : j = n := by omega + have h4 : j' = 0 := by omega + rw [h3, h4, hT, pr_zero] + · have h3 : j = 0 := by omega + have h4 : j' = n := by omega + rw [h3, h4, hT, pr_zero] + +open Classical in +/-- The function on one disc. -/ +noncomputable def gz' (V : ℕ → A) (w : List Letter) (z : ℂ) : A := + if h : ∃ x : ℕ × ℝ, x.1 < w.length ∧ x.2 ∈ Icc (0 : ℝ) 1 ∧ per w.length (x.1 + x.2) + = z then gs V w h.choose.1 h.choose.2 else 0 + +theorem gz'_per (V : ℕ → A) {w : List Letter} (hV : wv V w = 0) {p : ℕ} {u : ℝ} (hp : p < w.length) + (hu : u ∈ Icc (0 : ℝ) 1) : + gz' V w (per w.length (p + u)) = gs V w p u := by + have hex : ∃ x : ℕ × ℝ, x.1 < w.length ∧ x.2 ∈ Icc (0 : ℝ) 1 ∧ per w.length (x.1 + x.2) + = per w.length (p + u) := + ⟨(p, u), hp, hu, rfl⟩ + rw [gz', dite_eq_left hex] + obtain ⟨h1, h2, h3⟩ := hex.choose_spec + exact gs_congr V hV h1 hp h2 hu h3 + +/-- The function on the discs. -/ +noncomputable def gW (W : ℕ → List Letter) (V : ℕ → A) (x : ℕ × ℂ) : A := gz' V (W x.1) x.2 + +theorem sideConst_gW {W : ℕ → List Letter} {V : ℕ → A} (hV : ∀ i, wv V (W i) = 0) : SideConst W + (gW W V) := by + intro i p j q k e e' h1 h2 _ + have hp : p < (W i).length := (List.getElem?_eq_some_iff.mp h1).1 + have hq : q < (W j).length := (List.getElem?_eq_some_iff.mp h2).1 + refine ⟨pr V (W j) (if e' then q else q + 1) + -pr V (W i) (if e then p else p + 1), + fun u hu => ?_⟩ + simp only [gW, spt] + rw [gz'_per V (hV j) hq (flp_mem hu), gz'_per V (hV i) hp hu] + have e1 : ofs e' (flp e e' u) = ofs e u := by rw [← ofs_flp, ofs_ofs] + simp only [gs, h1, h2, e1, add_assoc, neg_add_cancel_left] + +end words + +section homotopy + +variable {Y : Type u} [TopologicalSpace Y] + +/-- A homotopy of a closed curve to a constant gives a map of the closed disc. -/ +theorem exists_disc_map (H : C(Circle × unitInterval, Y)) {c₀ : Y} (h1 : ∀ x, H (x, 1) + = c₀) : + ∃ P : ℂ → Y, ContinuousOn P (closedBall 0 1) ∧ ∀ x : Circle, P x = H (x, 0) := by + classical + have mem : ∀ p : Circle × unitInterval, ((1 - p.2.1 : ℝ) : ℂ) * (p.1 : ℂ) ∈ closedBall (0 : ℂ) 1 + := fun p => by + have h2 := p.2.2 + simp only [mem_closedBall, dist_zero_right, norm_mul, Complex.norm_real, Circle.norm_coe, + mul_one, Real.norm_eq_abs] + rw [abs_of_nonneg (by linarith [h2.2])] + linarith [h2.1] + let π : Circle × unitInterval → closedBall (0 : ℂ) 1 := fun p => ⟨_, mem p⟩ + have hπ : Continuous π := by + refine Continuous.subtype_mk ?_ _ + fun_prop + have hsurj : Function.Surjective π := by + rintro ⟨w, hw⟩ + have hw' : ‖w‖ ≤ 1 := by simpa using hw + by_cases h0 : w = 0 + · subst h0 + exact ⟨(1, 1), Subtype.ext (by simp [π])⟩ + · refine ⟨(Circle.exp (Complex.arg w), ⟨1 - ‖w‖, by linarith [norm_nonneg w], + by linarith [norm_nonneg w]⟩), Subtype.ext ?_⟩ + have h3 := Complex.norm_mul_exp_arg_mul_I w + simp only [π, sub_sub_cancel, Circle.coe_exp] + exact h3 + have hq : IsQuotientMap π := hπ.isClosedMap.isQuotientMap hπ hsurj + have hfib : ∀ p p', π p = π p' → H p = H p' := by + rintro ⟨x, t⟩ ⟨x', t'⟩ he + have he' : ((1 - t.1 : ℝ) : ℂ) * (x : ℂ) = ((1 - t'.1 : ℝ) : ℂ) * (x' : ℂ) + := congrArg Subtype.val he + have n1 := congrArg norm he' + have h2 := t.2 + have h3 := t'.2 + simp only [norm_mul, Complex.norm_real, Circle.norm_coe, mul_one, Real.norm_eq_abs] at n1 + rw [abs_of_nonneg (by linarith [h2.2]), abs_of_nonneg (by linarith [h3.2])] at n1 + have ht : t = t' := Subtype.ext (by linarith) + subst ht + by_cases h4 : t = 1 + · subst h4 + rw [h1, h1] + · have h5 : (1 - t.1 : ℝ) ≠ 0 := fun h => h4 (Subtype.ext (by change t.1 = (1 : ℝ); linarith)) + have h6 : ((1 - t.1 : ℝ) : ℂ) ≠ 0 := by exact_mod_cast h5 + have h7 : (x : ℂ) = x' := mul_left_cancel₀ h6 he' + rw [Circle.ext h7] + let P₀ : closedBall (0 : ℂ) 1 → Y := fun w => H (Function.surjInv hsurj w) + have hP₀ : ∀ p, P₀ (π p) = H p := fun p => hfib _ _ (Function.surjInv_eq hsurj (π p)) + have cP₀ : Continuous P₀ := by + rw [hq.continuous_iff] + have : P₀ ∘ π = H := funext hP₀ + rw [this] + exact H.continuous + refine ⟨fun z => if h : z ∈ closedBall (0 : ℂ) 1 then P₀ ⟨z, h⟩ else c₀, ?_, fun x => ?_⟩ + · rw [continuousOn_iff_continuous_domRestrict] + have : (closedBall (0 : ℂ) 1).domRestrict (fun z => if h : z ∈ closedBall + (0 : ℂ) 1 then P₀ ⟨z, h⟩ else c₀) = P₀ := by + funext w + simp only [Set.domRestrict_apply, w.2, dite_true] + rw [this] + exact cP₀ + · have hx : (x : ℂ) ∈ closedBall (0 : ℂ) 1 := by simp + have e : π (x, 0) = ⟨x, hx⟩ := Subtype.ext (by simp [π]) + simp only [hx, dite_true] + rw [← e, hP₀] + +end homotopy + +section prim + +variable {Y : Type u} [TopologicalSpace Y] {A : Type} [AddGroup A] + +omit [TopologicalSpace Y] in +/-- Two primitives along two paths with the same image in `Y` change by the same amount. -/ +theorem prim_path {φ : Y → Y → A} {F₁ F₂ : ℂ → Y} {g₁ g₂ : ℂ → A} (h₁ : IsPrim φ F₁ g₁) + (h₂ : IsPrim φ F₂ g₂) {γ₁ γ₂ : ℝ → ℂ} + (c₁ : ContinuousOn γ₁ (Icc 0 1)) (c₂ : ContinuousOn γ₂ (Icc 0 1)) (m₁ : ∀ t ∈ Icc + (0 : ℝ) 1, γ₁ t ∈ closedBall (0 : ℂ) 1) + (m₂ : ∀ t ∈ Icc (0 : ℝ) 1, γ₂ t ∈ closedBall (0 : ℂ) 1) (he : ∀ t ∈ Icc (0 : ℝ) 1, F₁ (γ₁ t) + = F₂ (γ₂ t)) : + g₁ (γ₁ 1) + -g₂ (γ₂ 1) = g₁ (γ₁ 0) + -g₂ (γ₂ 0) := by + obtain ⟨ε, h0, e1⟩ := h₁ + obtain ⟨ε', h0', e2⟩ := h₂ + obtain ⟨δ, hδ, d1⟩ := Metric.uniformContinuousOn_iff.mp + (isCompact_Icc.uniformContinuousOn_of_continuous c₁) ε h0 + obtain ⟨δ', hδ', d2⟩ := Metric.uniformContinuousOn_iff.mp + (isCompact_Icc.uniformContinuousOn_of_continuous c₂) ε' h0' + have hv := const_of_near (A := A) (v := fun t => g₁ (γ₁ t) + -g₂ (γ₂ t)) (ε := min δ δ') + (lt_min hδ hδ') (fun s hs t ht hst => by + have hd : dist t s < min δ δ' := by + rw [Real.dist_eq, abs_sub_comm] + exact hst + have n1 := d1 t ht s hs (lt_of_lt_of_le hd (min_le_left _ _)) + have n2 := d2 t ht s hs (lt_of_lt_of_le hd (min_le_right _ _)) + rw [dist_eq_norm] at n1 n2 + have e3 := e1 _ (m₁ t ht) _ (m₁ s hs) n1 + have e4 := e2 _ (m₂ t ht) _ (m₂ s hs) n2 + rw [he t ht, he s hs, e4] at e3 + have e5 := neg_add_eq_iff_eq_add.mp e3.symm + change g₁ (γ₁ s) + -g₂ (γ₂ s) = g₁ (γ₁ t) + -g₂ (γ₂ t) + rw [e5] + simp only [add_assoc, add_neg_cancel, add_zero]) + exact hv 1 ⟨zero_le_one, le_rfl⟩ + +/-- **Null-homotopic curves have zero voltage.** Let a side of the word `W 0` with label `k` run +along a closed curve `c`, and let +`c` be homotopic to a constant. Then the value of `k` is zero. The cocycle from `exists_cocycle` has +a primitive on the disc +of the homotopy (`exists_prim`), and this primitive closes up along `c`. -/ +theorem volt_zero {W : ℕ → List Letter} {f : ℕ × ℂ → Y} {V : ℕ → A} [T2Space Y] [Finite A] + (hW : FinW W) (hP : IsPaired W) (hf : Presents W f) + (h0 : W 0 ≠ []) (hV : ∀ i, wv V (W i) = 0) (H : C(Circle × unitInterval, Y)) {c : Circle + → Y} {c₀ : Y} (hH0 : ∀ x, H (x, 0) = c x) + (hH1 : ∀ x, H (x, 1) = c₀) {p k : ℕ} (hp : (W 0)[p]? = some (k, true)) {m : ℝ → ℝ} + (hm : ContinuousOn m (Icc 0 1)) + (hee : ee (m 1) = ee (m 0)) (hs : ∀ u ∈ Icc (0 : ℝ) 1, f (0, per (W 0).length (p + u)) = c (ee + (m u))) : V k = 0 := by + obtain ⟨φ, hφ, hg₁, -⟩ := exists_cocycle (g := gW W V) hW hP hf (sideConst_gW hV) h0 + obtain ⟨P, cP, hPe⟩ := exists_disc_map H hH1 + obtain ⟨g₂, hg₂⟩ := exists_prim hφ cP + have hlt : p < (W 0).length := (List.getElem?_eq_some_iff.mp hp).1 + have cc : Continuous fun x : Circle => (x : ℂ) := by fun_prop + have c₂ : ContinuousOn (fun u => ((ee (m u) : Circle) : ℂ)) (Icc 0 1) := + cc.comp_continuousOn (continuous_ee.comp_continuousOn hm) + have c₁ : ContinuousOn (fun u : ℝ => per (W 0).length (p + u)) (Icc 0 1) := + ((continuous_per _).comp (continuous_const.add continuous_id)).continuousOn + have key : gW W V (0, per (W 0).length (p + 1)) + -g₂ (ee (m 1)) = gW W V (0, per (W 0).length + (p + 0)) + -g₂ (ee (m 0)) := + prim_path hg₁ hg₂ c₁ c₂ (fun t _ => by simp [norm_per]) (fun t _ => by simp) (fun t ht => by + show f (0, per (W 0).length (p + t)) = P (ee (m t)) + rw [hs t ht, hPe, hH0]) + rw [hee] at key + have key' := add_right_cancel key + have m1 : (1 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have m0 : (0 : ℝ) ∈ Icc (0 : ℝ) 1 := by simp + have e1 : gW W V (0, per (W 0).length (p + 1)) = pr V (W 0) (p + 1) := by + simp only [gW] + rw [gz'_per V (hV 0) hlt m1, gs_one V hp] + have e2 : gW W V (0, per (W 0).length (p + 0)) = pr V (W 0) p := by + simp only [gW] + rw [gz'_per V (hV 0) hlt m0, gs_zero V hp] + rw [e1, e2, pr_succ V hp] at key' + simpa [lVal] using key' + +end prim + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/Wedge.lean b/LeanPool/GraphMinor/Surface/Wedge.lean new file mode 100644 index 0000000000..07eb0482b2 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/Wedge.lean @@ -0,0 +1,461 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Collar +public import LeanPool.GraphMinor.Surface.PasteDisc +public import LeanPool.GraphMinor.Surface.DiscGrow +public import LeanPool.GraphMinor.Surface.DiscMerge +public import LeanPool.GraphMinor.Surface.SurfaceGraph + +/-! +# A thin disc along a line of the boundary + +Let `K` be a line in the boundary of a surface, and let `Z` be a closed set that meets `K` at most +in its ends. We find a closed disc that +has `K` in its boundary, meets the boundary of the surface exactly in `K`, and meets `Z` at most in +the ends of `K` (`exists_wedge`). The +disc is a wedge in a collar of the cuff of `K`: paste a disc on the cuff, and use the collar of that +disc from `exists_disc_collar`. The +height of the wedge above a point of `K` is less than the distance to `Z`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +universe u + +/-- An injective continuous map on a closed disc carries it to a closed disc. -/ +theorem isClosedDisc_image_injOn {A T : Type*} [TopologicalSpace A] [Nonempty A] [TopologicalSpace + T] [T2Space T] {Δ : Set A} (hΔ : IsClosedDisc Δ) (hc : IsCompact Δ) + {f : A → T} (hf : ContinuousOn f Δ) (hi : InjOn f Δ) : IsClosedDisc (f '' Δ) ∧ discBd (f '' Δ) + = f '' discBd Δ := by + have hl : LeftInvOn (Function.invFunOn f Δ) f Δ := hi.leftInvOn_invFunOn + refine hΔ.image hf ?_ hl + have hcomp : CompactSpace Δ := isCompact_iff_compactSpace.mp hc + let g : Δ → f '' Δ := fun x => ⟨f x, x.1, x.2, rfl⟩ + have hg : Continuous g := (continuousOn_iff_continuous_domRestrict.mp hf).subtype_mk _ + have hgb : Function.Bijective g := by + constructor + · intro x y h + exact Subtype.ext (hi x.2 y.2 (congrArg Subtype.val h)) + · rintro ⟨_, x, hx, rfl⟩ + exact ⟨⟨x, hx⟩, rfl⟩ + let e : Δ ≃ₜ f '' Δ := hg.homeoOfEquivCompactToT2 (f := Equiv.ofBijective g hgb) + have hr : (f '' Δ).domRestrict (Function.invFunOn f Δ) = fun y => (e.symm y).1 := by + funext y + obtain ⟨x, rfl⟩ := e.surjective y + rw [e.symm_apply_apply] + exact hl x.2 + rw [continuousOn_iff_continuous_domRestrict, hr] + exact continuous_subtype_val.comp e.symm.continuous + +/-- The first coordinate of the wedge. -/ +noncomputable def wedgeT (z : ℂ) : unitInterval := projIcc 0 1 zero_le_one ((z.re + 1) / 2) + +/-- The height of the wedge at `z`, as a fraction. -/ +noncomputable def wedgeTau (z : ℂ) : ℝ := (z.im + √(1 - z.re ^ 2)) / (2 * √(1 - z.re ^ 2)) + +theorem wedgeTau_mem {z : ℂ} (hz : z ∈ closedBall (0 : ℂ) 1) : 0 ≤ wedgeTau z ∧ wedgeTau z ≤ 1 := by + have h1 : z.re ^ 2 + z.im ^ 2 ≤ 1 := by + have h2 : ‖z‖ ≤ 1 := by simpa using hz + have h3 := Complex.sq_norm z + rw [Complex.normSq_apply] at h3 + nlinarith [norm_nonneg z] + have hw : |z.im| ≤ √(1 - z.re ^ 2) := by + apply Real.abs_le_sqrt + linarith + obtain ⟨h4, h5⟩ := abs_le.mp hw + rcases (Real.sqrt_nonneg (1 - z.re ^ 2)).eq_or_lt with h | h + · rw [wedgeTau, ← h] + simp + · rw [wedgeTau] + constructor + · apply div_nonneg <;> linarith + · rw [div_le_one (by linarith)] + linarith + +theorem re_of_wedgeT {z z' : ℂ} (hz : z ∈ closedBall (0 : ℂ) 1) (hz' : z' ∈ closedBall (0 : ℂ) 1) + (h : wedgeT z = wedgeT z') : z.re = z'.re := by + have hb : ∀ {w : ℂ}, w ∈ closedBall (0 : ℂ) 1 → (w.re + 1) / 2 ∈ Icc (0 : ℝ) 1 := fun {w} hw => by + have h2 : ‖w‖ ≤ 1 := by simpa using hw + have h3 := abs_le.mp ((Complex.abs_re_le_norm w).trans h2) + constructor <;> linarith [h3.1, h3.2] + have h1 := congrArg Subtype.val h + simp only [wedgeT, projIcc_of_mem _ (hb hz), projIcc_of_mem _ (hb hz')] at h1 + linarith + +theorem continuous_wedgeT : Continuous wedgeT := continuous_projIcc.comp (by fun_prop) + +theorem wedgeT_coe {z : ℂ} (hz : z ∈ closedBall (0 : ℂ) 1) : (wedgeT z : ℝ) = (z.re + 1) / 2 := by + have h2 : ‖z‖ ≤ 1 := by simpa using hz + have h3 := abs_le.mp ((Complex.abs_re_le_norm z).trans h2) + rw [wedgeT, projIcc_of_mem _ (show (z.re + 1) / 2 ∈ Icc (0 : ℝ) 1 by constructor + <;> linarith [h3.1, h3.2])] + +/-- The height function of a wedge is continuous on the unit disc, where `ρ` vanishes at the two +ends. -/ +theorem continuousOn_wedge {ρ : unitInterval → ℝ} (hρ : Continuous ρ) (h0 : ρ 0 = 0) (h1 : ρ 1 = 0) + (hnn : ∀ t, 0 ≤ ρ t) : + ContinuousOn (fun z => ρ (wedgeT z) * wedgeTau z) (closedBall (0 : ℂ) 1) := by + have htc := continuous_wedgeT + intro z hz + by_cases hw : √(1 - z.re ^ 2) = 0 + · have hval : ρ (wedgeT z) = 0 := by + have h2 : 1 - z.re ^ 2 ≤ 0 := Real.sqrt_eq_zero'.mp hw + have h3 : ‖z‖ ≤ 1 := by simpa using hz + have h4 := abs_le.mp ((Complex.abs_re_le_norm z).trans h3) + have h5 : z.re = 1 ∨ z.re = -1 := by + have h6 : (z.re - 1) * (z.re + 1) = 0 := by nlinarith [h4.1, h4.2] + rcases mul_eq_zero.mp h6 with h7 | h7 + · exact .inl (by linarith) + · exact .inr (by linarith) + rcases h5 with h5 | h5 + · have : wedgeT z = 1 := by + simp only [wedgeT, h5] + norm_num + rw [this, h1] + · have : wedgeT z = 0 := by + simp only [wedgeT, h5] + norm_num + rw [this, h0] + have ht : Tendsto (fun z => ρ (wedgeT z)) (𝓝[closedBall (0 : ℂ) 1] z) (𝓝 0) := by + rw [← hval] + exact ((hρ.comp htc).continuousAt).tendsto.mono_left nhdsWithin_le_nhds + change Tendsto _ _ _ + simp only [hval, zero_mul] + refine squeeze_zero' ?_ ?_ ht + · filter_upwards [self_mem_nhdsWithin] with y hy + exact mul_nonneg (hnn _) (wedgeTau_mem hy).1 + · filter_upwards [self_mem_nhdsWithin] with y hy + exact mul_le_of_le_one_right (hnn _) (wedgeTau_mem hy).2 + · have h2 : ContinuousAt wedgeTau z := by + unfold wedgeTau + refine ContinuousAt.div (by fun_prop) (by fun_prop) (by simpa using hw) + exact (((hρ.comp htc).continuousAt).mul h2).continuousWithinAt + +private theorem exists_boundary_arc_strip {Y : Type} [TopologicalSpace Y] + (hY : IsSurface Y) {a : unitInterval → Y} (ha : IsArcMap a) (hKb : range a ⊆ bd Y) : + ∃ E : unitInterval × unitInterval → Y, Continuous E ∧ Function.Injective E ∧ + (∀ t, E (t, 0) = a t) ∧ + ∀ q, 0 < (q.2 : ℝ) → (q.2 : ℝ) < 1 → E q ∉ bd Y := by + have hC : connectedComponentIn (bd Y) (a 0) ∈ cuffs Y := ⟨a 0, hKb (mem_range_self 0), rfl⟩ + set C := connectedComponentIn (bd Y) (a 0) with hCdef + have hKC : range a ⊆ C := + (isPreconnected_range ha.1).subset_connectedComponentIn (mem_range_self 0) hKb + obtain ⟨T, tT, ι, Δ, hT, hι, hΔ, hun, hmeet, hbdΔ, hbdT⟩ := paste_disc.{0} Y C hY hC + have ht2T : T2Space T := hT.2.1 + have hman : ∀ x : T, IsManifoldPoint x := hT.2.2 + have hint : ∀ x ∈ discBd Δ, IsInteriorPoint x := fun x hx => by + by_contra hn + have h1 : x ∈ bd T := hn + rw [hbdT] at h1 + rw [hbdΔ] at hx + obtain ⟨y, hy, rfl⟩ := h1 + obtain ⟨y', hy', he⟩ := hx + exact hy.2 (hι.injective he ▸ hy') + obtain ⟨Δ', hΔ', hin, -⟩ := exists_disc_around hman hΔ hint isOpen_univ (subset_univ _) + obtain ⟨p⟩ := hΔ.isOArc_discBd + obtain ⟨c, c', hcc, hc'c, hmc, hmc', hl, -, hcΔ, hcb, hcp⟩ := exists_disc_collar hΔ hΔ' hin p + have hιa : ∀ t, ι (a t) ∈ discBd Δ := fun t => hbdΔ ▸ mem_image_of_mem _ (hKC (mem_range_self t)) + let b : unitInterval → Circle := fun t => p.symm ⟨ι (a t), hιa t⟩ + have hbc : Continuous b := p.symm.continuous.comp ((hι.continuous.comp ha.1).subtype_mk _) + have hpb : ∀ t, c (b t) = ι (a t) := fun t => by + rw [hcp, p.apply_symm_apply] + let P := unitInterval × unitInterval + let zz : P → ℂ := fun q => (1 + (q.2 : ℝ)) * (b q.1 : ℂ) + have hzzc : Continuous zz := by + have h1 : Continuous fun q : P => ((b q.1 : Circle) : ℂ) := continuous_subtype_val.comp + (hbc.comp continuous_fst) + have h2 : Continuous fun q : P => (((q.2 : unitInterval) : ℝ) : ℂ) + := Complex.continuous_ofReal.comp (continuous_subtype_val.comp continuous_snd) + exact (continuous_const.add h2).mul h1 + have hzzn : ∀ q, ‖zz q‖ = 1 + (q.2 : ℝ) := fun q => by + simp only [zz, norm_mul, Circle.norm_coe, mul_one] + rw [show (1 + ((q.2 : unitInterval) : ℂ)) = ((1 + (q.2 : ℝ) : ℝ) : ℂ) by push_cast; rfl, + Complex.norm_real, Real.norm_of_nonneg (by linarith [q.2.2.1])] + have hzz2 : ∀ q, zz q ∈ closedBall (0 : ℂ) 2 := fun q => by + simp only [mem_closedBall, dist_zero_right, hzzn] + linarith [q.2.2.2] + have hzzi : Function.Injective zz := by + intro q q' h + have h1 := congrArg norm h + rw [hzzn, hzzn] at h1 + have h2 : (q.2 : ℝ) = q'.2 := by linarith + have h3 : (1 + ((q.2 : ℝ) : ℂ)) ≠ 0 := by + rw [show (1 + (((q.2 : ℝ)) : ℂ)) = ((1 + (q.2 : ℝ) : ℝ) : ℂ) by push_cast; rfl] + exact_mod_cast (by linarith [q.2.2.1] : (1 + (q.2 : ℝ)) ≠ 0) + have h4 : (b q.1 : ℂ) = b q'.1 := by + have h5 : (1 + ((q.2 : ℝ) : ℂ)) * (b q.1 : ℂ) = (1 + ((q.2 : ℝ) : ℂ)) * (b q'.1 : ℂ) := by + simpa only [zz, h2] using h + exact mul_left_cancel₀ h3 h5 + have h6 : b q.1 = b q'.1 := Circle.ext h4 + have h7 : q.1 = q'.1 := by + have h8 := p.symm.injective h6 + exact ha.2 (hι.injective (congrArg Subtype.val h8)) + exact Prod.ext h7 (Subtype.ext h2) + have hoff : ∀ q : P, 0 < (q.2 : ℝ) → c (zz q) ∉ Δ := fun q hq hmem => by + rw [← hcΔ] at hmem + obtain ⟨w, hw, he⟩ := hmem + have h1 := hl (hzz2 q) + have h2 := hl (closedBall_subset_closedBall (by norm_num) hw) + rw [he] at h2 + rw [h1] at h2 + have h3 : ‖zz q‖ ≤ 1 := by + rw [h2] + simpa using hw + rw [hzzn] at h3 + linarith + have hrange : ∀ q : P, c (zz q) ∈ range ι := fun q => by + by_cases hq : (q.2 : ℝ) = 0 + · have h1 : zz q = b q.1 := by + simp [zz, hq] + rw [h1, hpb] + exact mem_range_self _ + · exact (hun.symm ▸ mem_univ (c (zz q)) : c (zz q) ∈ range ι ∪ Δ).resolve_right (hoff q + (lt_of_le_of_ne q.2.2.1 (Ne.symm hq))) + choose E hE using fun q => hrange q + have hEc : Continuous E := by + rw [hι.isInducing.continuous_iff] + have : ι ∘ E = c ∘ zz := funext hE + rw [this] + exact hcc.comp_continuous hzzc hzz2 + have hEi : Function.Injective E := fun q q' h => by + have h1 : c (zz q) = c (zz q') := by rw [← hE, ← hE, h] + exact hzzi (by rw [← hl (hzz2 q), ← hl (hzz2 q'), h1]) + have hE0 : ∀ t, E (t, 0) = a t := fun t => by + apply hι.injective + rw [hE] + have h1 : zz (t, 0) = b t := by simp [zz] + rw [h1, hpb] + have hEint : ∀ q : P, 0 < (q.2 : ℝ) → (q.2 : ℝ) < 1 → E q ∉ bd Y := fun q h0 h1 hb => by + have hin2 : c (zz q) ∈ discInt Δ' := by + refine ⟨hmc (hzz2 q), fun h => ?_⟩ + rw [← hcb] at h + obtain ⟨w, hw, he⟩ := h + have h2 := hl (hzz2 q) + have h3 := hl (sphere_subset_closedBall hw) + rw [he, h2] at h3 + have h4 : ‖zz q‖ = 2 := by + rw [h3] + simpa using hw + rw [hzzn] at h4 + linarith + have h3 := isInteriorPoint_of_mem_discInt hman hΔ' hin2 + by_cases hmemC : E q ∈ C + · apply hoff q h0 + rw [← hE] + exact discBd_subset Δ (hbdΔ ▸ mem_image_of_mem _ hmemC) + · have h4 : ι (E q) ∈ bd T := hbdT ▸ mem_image_of_mem _ ⟨hb, hmemC⟩ + rw [hE] at h4 + exact h4 h3 + exact ⟨E, hEc, hEi, hE0, hEint⟩ + +/-- A closed disc along a line `K` of the boundary. It meets the boundary exactly in `K` and it +meets the closed set `Z` at most in the +ends of `K`. -/ +theorem exists_wedge {Y : Type} [TopologicalSpace Y] (hY : IsSurface Y) {K Z : Set Y} {u v : Y} + (hK : IsLineWithEnds K u v) (hKb : K ⊆ bd Y) (hZ : IsClosed Z) + (hZK : Z ∩ K ⊆ {u, v}) : ∃ D, IsClosedDisc D ∧ K ⊆ discBd D ∧ D ∩ Z ⊆ {u, v} ∧ D ∩ bd Y = K + := by + have ht2 : T2Space Y := hY.2.1 + obtain ⟨a, ha, hr, rfl, rfl⟩ := hK.exists_arc + obtain ⟨E, hEc, hEi, hE0, hEint⟩ := exists_boundary_arc_strip hY ha (hr ▸ hKb) + let P := unitInterval × unitInterval + classical + let A : Set P := E ⁻¹' (Z ∪ {a 0, a 1}) + have hAc : IsClosed A := (hZ.union (toFinite _).isClosed).preimage hEc + have hA0 : ((0, 0) : P) ∈ A := by + change E (0, 0) ∈ Z ∪ {a 0, a 1} + rw [hE0] + exact .inr (.inl rfl) + have hA1 : ((1, 0) : P) ∈ A := by + change E (1, 0) ∈ Z ∪ {a 0, a 1} + rw [hE0] + exact .inr (.inr rfl) + have hAne : A.Nonempty := ⟨_, hA0⟩ + let ρ : unitInterval → ℝ := fun t => min (1 / 2) (infDist ((t, 0) : P) A / 2) + have hρc : Continuous ρ := by + refine continuous_const.min ((continuous_infDist_pt A).comp (by fun_prop) |>.div_const 2) + have hρ0 : ρ 0 = 0 := by + simp only [ρ, infDist_zero_of_mem hA0] + norm_num + have hρ1 : ρ 1 = 0 := by + simp only [ρ, infDist_zero_of_mem hA1] + norm_num + have hρnn : ∀ t, 0 ≤ ρ t := fun t => le_min (by norm_num) (div_nonneg infDist_nonneg + (by norm_num)) + have hρle : ∀ t, ρ t ≤ 1 / 2 := fun t => min_le_left _ _ + have hρpos : ∀ t, t ≠ 0 → t ≠ 1 → 0 < ρ t := by + intro t h0 h1 + have h2 : ((t, 0) : P) ∉ A := by + rintro (h | h | h) + · have h3 : a t ∈ Z := by + have := hE0 t + rwa [show E (t, 0) = a t from this] at h + rcases hZK ⟨h3, hr ▸ mem_range_self t⟩ with h4 | h4 + · exact h0 (ha.2 h4) + · exact h1 (ha.2 h4) + · rw [hE0] at h + exact h0 (ha.2 h) + · rw [hE0] at h + exact h1 (ha.2 h) + have h3 := (hAc.notMem_iff_infDist_pos hAne).mp h2 + exact lt_min (by norm_num) (by positivity) + have hoffA : ∀ t (s : unitInterval), (s : ℝ) ≤ ρ t → 0 < ρ t → ((t, s) : P) ∉ A := by + intro t s hs hpos hmem + have h1 := infDist_le_dist_of_mem (x := ((t, 0) : P)) hmem + have h2 : dist ((t, 0) : P) (t, s) = (s : ℝ) := by + rw [Prod.dist_eq, dist_self, max_eq_right dist_nonneg, Subtype.dist_eq, Real.dist_eq] + simp [abs_of_nonneg s.2.1] + have h3 : ρ t ≤ infDist ((t, 0) : P) A / 2 := min_le_right _ _ + rw [h2] at h1 + linarith + let f : ℂ → ℝ := fun z => ρ (wedgeT z) * wedgeTau z + have hfc : ContinuousOn f (closedBall (0 : ℂ) 1) := continuousOn_wedge hρc hρ0 hρ1 hρnn + have hf0 : ∀ z ∈ closedBall (0 : ℂ) 1, 0 ≤ f z := fun z hz => mul_nonneg (hρnn _) + (wedgeTau_mem hz).1 + have hf1 : ∀ z ∈ closedBall (0 : ℂ) 1, f z ≤ ρ (wedgeT z) := fun z hz => mul_le_of_le_one_right + (hρnn _) (wedgeTau_mem hz).2 + let ss : ℂ → unitInterval := fun z => projIcc 0 1 zero_le_one (f z) + have hss : ∀ z ∈ closedBall (0 : ℂ) 1, (ss z : ℝ) = f z := fun z hz => by + have h1 := hf1 z hz + have h2 := hρle (wedgeT z) + simp only [ss] + rw [projIcc_of_mem _ (show f z ∈ Icc (0 : ℝ) 1 from ⟨hf0 z hz, by linarith⟩)] + let Ψ : ℂ → Y := fun z => E (wedgeT z, ss z) + have hΨc : ContinuousOn Ψ (closedBall (0 : ℂ) 1) := + hEc.comp_continuousOn (continuous_wedgeT.continuousOn.prodMk + (continuous_projIcc.comp_continuousOn hfc)) + have hsq : ∀ z ∈ closedBall (0 : ℂ) 1, z.re ^ 2 + z.im ^ 2 ≤ 1 := fun z hz => by + have h2 : ‖z‖ ≤ 1 := by simpa using hz + have h3 := Complex.sq_norm z + rw [Complex.normSq_apply] at h3 + nlinarith [norm_nonneg z] + have hend : ∀ z ∈ closedBall (0 : ℂ) 1, (wedgeT z = 0 ∨ wedgeT z = 1) → z.re ^ 2 = 1 ∧ z.im = 0 + := fun z hz h => by + have h1 := wedgeT_coe hz + have h2 : z.re = -1 ∨ z.re = 1 := by + rcases h with h | h + · rw [h] at h1 + left + have h3 : (((0 : unitInterval) : ℝ)) = 0 := rfl + linarith + · rw [h] at h1 + right + have h3 : (((1 : unitInterval) : ℝ)) = 1 := rfl + linarith + have h3 : z.re ^ 2 = 1 := by + rcases h2 with h2 | h2 <;> rw [h2] <;> norm_num + exact ⟨h3, by nlinarith [hsq z hz, sq_nonneg z.im]⟩ + have hΨi : InjOn Ψ (closedBall (0 : ℂ) 1) := by + intro z hz z' hz' h + have h1 := hEi h + have h2 : wedgeT z = wedgeT z' := congrArg Prod.fst h1 + have h3 : ss z = ss z' := congrArg Prod.snd h1 + have hre := re_of_wedgeT hz hz' h2 + by_cases hend0 : wedgeT z = 0 ∨ wedgeT z = 1 + · have h4 := hend z hz hend0 + have h5 := hend z' hz' (h2 ▸ hend0) + exact Complex.ext hre (h4.2.trans h5.2.symm) + · push Not at hend0 + have hp := hρpos _ hend0.1 hend0.2 + have h4 : f z = f z' := by rw [← hss z hz, ← hss z' hz', h3] + have h5 : wedgeTau z = wedgeTau z' := by + simp only [f, ← h2] at h4 + exact mul_left_cancel₀ hp.ne' h4 + have hw : 0 < √(1 - z.re ^ 2) := by + refine lt_of_le_of_ne (Real.sqrt_nonneg _) fun h6 => ?_ + have h7 : 1 - z.re ^ 2 ≤ 0 := Real.sqrt_eq_zero'.mp h6.symm + have h8 : z.re ^ 2 = 1 := by nlinarith [hsq z hz, sq_nonneg z.im] + have h9 : (z.re - 1) * (z.re + 1) = 0 := by nlinarith + have h10 := wedgeT_coe hz + rcases mul_eq_zero.mp h9 with h11 | h11 + · exact hend0.2 (Subtype.ext (by rw [h10]; change _ = (1 : ℝ); linarith)) + · exact hend0.1 (Subtype.ext (by rw [h10]; change _ = (0 : ℝ); linarith)) + simp only [wedgeTau, ← hre] at h5 + rw [div_left_inj₀ (by positivity)] at h5 + exact Complex.ext hre (by linarith) + obtain ⟨hD, hDb⟩ := isClosedDisc_image_injOn isClosedDisc_closedBall.1 + (isCompact_closedBall 0 1) hΨc hΨi + rw [isClosedDisc_closedBall.2] at hDb + have hlow : ∀ t, ∃ z ∈ sphere (0 : ℂ) 1, Ψ z = a t := fun t => by + have ht0 := t.2.1 + have ht1 := t.2.2 + have hw : 0 ≤ 1 - (2 * (t : ℝ) - 1) ^ 2 := by nlinarith + let z : ℂ := ⟨2 * t - 1, -√(1 - (2 * (t : ℝ) - 1) ^ 2)⟩ + have hzn : ‖z‖ = 1 := by + have h3 := Complex.sq_norm z + rw [Complex.normSq_apply] at h3 + have h4 : z.re * z.re + z.im * z.im = 1 := by + simp only [z, neg_mul_neg, Real.mul_self_sqrt hw] + ring + rw [h4] at h3 + nlinarith [norm_nonneg z] + have hzb : z ∈ closedBall (0 : ℂ) 1 := by simp [hzn] + have htz : wedgeT z = t := Subtype.ext (by rw [wedgeT_coe hzb]; simp only [z]; ring) + have hτ : wedgeTau z = 0 := by + simp only [wedgeTau, z] + simp + have hs0 : ss z = 0 := Subtype.ext (by + rw [hss z hzb] + simp only [f, hτ, mul_zero] + rfl) + refine ⟨z, by simp [hzn], ?_⟩ + simp only [Ψ, htz, hs0] + exact hE0 t + have hzero : ∀ z ∈ closedBall (0 : ℂ) 1, ρ (wedgeT z) = 0 → ss z = 0 := fun z hz h => Subtype.ext + (by + rw [hss z hz] + simp only [f, h, zero_mul] + rfl) + have hp0 : ∀ t, ρ t = 0 → t = 0 ∨ t = 1 := fun t h => by + by_contra hn + push Not at hn + exact (hρpos t hn.1 hn.2).ne' h + have hKD : K ⊆ Ψ '' sphere (0 : ℂ) 1 := by + rw [← hr] + rintro _ ⟨t, rfl⟩ + obtain ⟨z, hz, he⟩ := hlow t + exact ⟨z, hz, he⟩ + refine ⟨Ψ '' closedBall 0 1, hD, hDb ▸ hKD, ?_, ?_⟩ + · rintro _ ⟨⟨z, hz, rfl⟩, hy⟩ + rcases (hρnn (wedgeT z)).eq_or_lt with h | h + · have h1 := hzero z hz h.symm + have h2 : Ψ z = a (wedgeT z) := by + simp only [Ψ, h1] + exact hE0 _ + rw [h2] + rcases hp0 _ h.symm with h3 | h3 + · rw [h3] + exact .inl rfl + · rw [h3] + exact .inr rfl + · exact absurd (Or.inl hy) (hoffA (wedgeT z) (ss z) (by rw [hss z hz]; exact hf1 z hz) h) + · apply subset_antisymm + · rintro _ ⟨⟨z, hz, rfl⟩, hy⟩ + rcases (ss z).2.1.eq_or_lt with h | h + · have h1 : ss z = 0 := Subtype.ext h.symm + have h2 : Ψ z = a (wedgeT z) := by + simp only [Ψ, h1] + exact hE0 _ + rw [h2, ← hr] + exact mem_range_self _ + · have h1 : (ss z : ℝ) < 1 := by + rw [hss z hz] + linarith [hf1 z hz, hρle (wedgeT z)] + exact absurd hy (hEint (wedgeT z, ss z) h h1) + · intro y hy + obtain ⟨z, hz, rfl⟩ := hKD hy + exact ⟨⟨z, sphere_subset_closedBall hz, rfl⟩, hKb hy⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/WordCases.lean b/LeanPool/GraphMinor/Surface/WordCases.lean new file mode 100644 index 0000000000..1bff31fb8c --- /dev/null +++ b/LeanPool/GraphMinor/Surface/WordCases.lean @@ -0,0 +1,431 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.HoleLoop + +/-! +# Normal forms of glued words + +When a surface is cut along an arc, the surface before cutting has a word with one pair of letters +more than a normal +word. Here we compute its normal form, in each of the cases that arise. Each lemma follows the steps +of `normalize` by +hand. The product `BC` lists blocks in any order; `BC.nf` puts them in normal order, and this is +what we need when two +words are glued. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Function + +universe uu + +/-- A product of blocks in any order, with `a` handles, `b` cross-caps and `c` holes. -/ +inductive BC : List Letter → ℕ → ℕ → ℕ → Prop + | nil : BC [] 0 0 0 + | hnd {H : List Letter} {a b c : ℕ} (u v : Letter) (h : u.1 ≠ v.1) (hX : DisjL (hndB u v) H) : + BC H a b c → BC (hndB u v ++ H) (a + 1) b c + | cap {H : List Letter} {a b c : ℕ} (y : Letter) (hX : DisjL [y, y] H) : BC H a b c → BC + ([y, y] ++ H) a (b + 1) c + | hole {H : List Letter} {a b c : ℕ} (t r : Letter) (h : t.1 ≠ r.1) (hX : DisjL (holB t r) H) : + BC H a b c → BC (holB t r ++ H) a b (c + 1) + +theorem BC.append {A B : List Letter} {a b c a' b' c' : ℕ} (hA : BC A a b c) (hB : BC B a' b' c') + (h : DisjL A B) : + BC (A ++ B) (a + a') (b + b') (c + c') := by + induction hA with + | nil => simpa using hB + | hnd u v hu hX _ ih => + rw [List.append_assoc, show ∀ a : ℕ, a + 1 + a' = a + a' + 1 by omega] + exact .hnd u v hu (hX.append_right h.left) (ih h.right) + | cap y hX _ ih => + rw [List.append_assoc, show ∀ b : ℕ, b + 1 + b' = b + b' + 1 by omega] + exact .cap y (hX.append_right h.left) (ih h.right) + | hole t r hu hX _ ih => + rw [List.append_assoc, show ∀ c : ℕ, c + 1 + c' = c + c' + 1 by omega] + exact .hole t r hu (hX.append_right h.left) (ih h.right) + +theorem HL.bc {a : ℕ} {X : List Letter} (h : HL a X) : BC X a 0 0 := by + induction h with + | nil => exact .nil + | cons u v h hX _ ih => exact .hnd u v h hX ih + +theorem CL.bc {b : ℕ} {X : List Letter} (h : CL b X) : BC X 0 b 0 := by + induction h with + | nil => exact .nil + | cons y hX _ ih => exact .cap y hX ih + +theorem TL.bc {c : ℕ} {X : List Letter} (h : TL c X) : BC X 0 0 c := by + induction h with + | nil => exact .nil + | cons t r h hX _ ih => exact .hole t r h hX ih + +theorem IsNF.bc {w : List Letter} {a b c : ℕ} (h : IsNF w a b c) : BC w a b c := by + obtain ⟨X, Y, Z, rfl, h1, h2, h3, h4, h5, h6⟩ := h + simpa using (h1.bc.append h2.bc h4).append h3.bc (h5.append_left h6) + +theorem noLab_winv' {a : List Letter} {c : ℕ} (h : NoLab a c) : NoLab (winv a) c := noLab_winv.mpr h + +theorem DisjL.winv_right {A B : List Letter} (h : DisjL A B) : DisjL A (winv B) := fun l hl + => noLab_winv' (h l hl) + +theorem DisjL.winv_left {A B : List Letter} (h : DisjL A B) : DisjL (winv A) B := + (h.symm.winv_right).symm + +theorem winv_hndB (u v : Letter) : winv (hndB u v) = hndB v u := by simp [winv, hndB, linv] + +theorem winv_cap (y : Letter) : winv [y, y] = [linv y, linv y] := by simp [winv] + +theorem winv_holB (t r : Letter) : winv (holB t r) = holB t (linv r) := by simp [winv, holB, linv] + +theorem BC.winv {H : List Letter} {a b c : ℕ} (h : BC H a b c) : BC (winv H) a b c := by + induction h with + | nil => exact .nil + | @hnd H a b c u v hu hX _ ih => + rw [winv_append] + have e := winv_hndB u v + rw [e] + have h1 : BC (hndB v u) 1 0 0 := by + simpa using BC.hnd v u (Ne.symm hu) (by simp [DisjL, NoLab]) .nil + have h2 : DisjL (GraphMinor.Surface.winv H) (hndB v u) := by + rw [← e] + exact hX.symm.winv_left.winv_right + simpa using ih.append h1 h2 + | @cap H a b c y hX _ ih => + rw [winv_append] + have e := winv_cap y + rw [e] + have h1 : BC [linv y, linv y] 0 1 0 := by + simpa using BC.cap (linv y) (by simp [DisjL, NoLab]) .nil + have h2 : DisjL (GraphMinor.Surface.winv H) [linv y, linv y] := by + rw [← e] + exact hX.symm.winv_left.winv_right + simpa using ih.append h1 h2 + | @hole H a b c t r ht hX _ ih => + rw [winv_append] + have e := winv_holB t r + rw [e] + have h1 : BC (holB t (linv r)) 0 0 1 := by + simpa using BC.hole t (linv r) ht (by simp [DisjL, NoLab]) .nil + have h2 : DisjL (GraphMinor.Surface.winv H) (holB t (linv r)) := by + rw [← e] + exact hX.symm.winv_left.winv_right + simpa using ih.append h1 h2 + +/-- Blocks in any order can be put in normal order, after any word without their labels. -/ +theorem BC.nf {H : List Letter} {a b c : ℕ} (h : BC H a b c) : + ∃ w, IsNF w a b c ∧ (∀ k, cnt w k = cnt H k) ∧ ∀ P, DisjL H P → WEq.{uu} (P ++ H) (P ++ w) := by + induction h with + | nil => + refine ⟨[], ⟨[], [], [], rfl, .nil, .nil, .nil, by simp [DisjL], by simp [DisjL], + by simp [DisjL]⟩, fun _ => rfl, fun P _ => WEq.refl _⟩ + | @hnd H a b c u v hu hX _ ih => + obtain ⟨w, ⟨X, Y, Z, rfl, h1, h2, h3, h4, h5, h6⟩, hc, hw⟩ := ih + have hd : DisjL (hndB u v) (X ++ Y ++ Z) := hX.mono fun k => by rw [hc] + refine ⟨(hndB u v ++ X) ++ Y ++ Z, ⟨_, Y, Z, rfl, .cons u v hu hd.inl.inl h1, h2, h3, + DisjL.append_left hd.inl.inr h4, + DisjL.append_left hd.inr h5, h6⟩, fun k => ?_, fun P hP => ?_⟩ + · have := hc k + simp only [cnt_append] at this ⊢ + omega + · have := hw (P ++ hndB u v) (DisjL.append_right hP.right hX.symm) + simpa using this + | @cap H a b c y hX _ ih => + obtain ⟨w, ⟨X, Y, Z, rfl, h1, h2, h3, h4, h5, h6⟩, hc, hw⟩ := ih + have hd : DisjL [y, y] (X ++ Y ++ Z) := hX.mono fun k => by rw [hc] + refine ⟨X ++ ([y, y] ++ Y) ++ Z, ⟨X, _, Z, rfl, h1, .cons y hd.inl.inr h2, h3, + DisjL.append_right hd.inl.inl.symm h4, h5, + DisjL.append_left hd.inr h6⟩, fun k => ?_, fun P hP => ?_⟩ + · have := hc k + simp only [cnt_append] at this ⊢ + omega + · have c1 := hw (P ++ [y, y]) (DisjL.append_right hP.right hX.symm) + have c2 := move_block.{uu} (U := [y, y]) (P := P) (Q := X) (Z := Y ++ Z) + (.cap y) hP.left hd.inl.inl + (DisjL.append_right hd.inl.inr hd.inr) + have e1 : P ++ ([y, y] ++ H) = (P ++ [y, y]) ++ H := by simp + have e2 : (P ++ [y, y]) ++ (X ++ Y ++ Z) = P ++ [y, y] ++ X ++ (Y ++ Z) := by simp + have e3 : P ++ X ++ [y, y] ++ (Y ++ Z) = P ++ (X ++ ([y, y] ++ Y) ++ Z) := by simp + rw [e1, ← e3] + exact c1.trans (e2 ▸ c2) + | @hole H a b c t r ht hX _ ih => + obtain ⟨w, ⟨X, Y, Z, rfl, h1, h2, h3, h4, h5, h6⟩, hc, hw⟩ := ih + have hd : DisjL (holB t r) (X ++ Y ++ Z) := hX.mono fun k => by rw [hc] + refine ⟨X ++ Y ++ (holB t r ++ Z), ⟨X, Y, _, rfl, h1, h2, .cons t r ht hd.inr h3, h4, + DisjL.append_right hd.inl.inl.symm h5, + DisjL.append_right hd.inl.inr.symm h6⟩, fun k => ?_, fun P hP => ?_⟩ + · have := hc k + simp only [cnt_append] at this ⊢ + omega + · have c1 := hw (P ++ holB t r) (DisjL.append_right hP.right hX.symm) + have c2 := move_block.{uu} (U := holB t r) (P := P) (Q := X ++ Y) (Z := Z) + (isBlock_holB ht) hP.left hd.inl hd.inr + have e1 : P ++ (holB t r ++ H) = (P ++ holB t r) ++ H := by simp + have e2 : (P ++ holB t r) ++ (X ++ Y ++ Z) = P ++ holB t r ++ (X ++ Y) ++ Z := by simp + have e3 : P ++ (X ++ Y) ++ holB t r ++ Z = P ++ (X ++ Y ++ (holB t r ++ Z)) := by simp + rw [e1, ← e3] + exact c1.trans (e2 ▸ c2) + +/-- A state gives a normal form. -/ +theorem Inv.isNF {R X Y Z : List Letter} {a b c : ℕ} (h : Inv R X Y Z a b c) : IsNF + (X ++ Y ++ Z) a b c := by + obtain ⟨h1, h2, h3, h4, h5, h6, -⟩ := h + exact ⟨X, Y, Z, rfl, h1, h2, h3, h4, h5, h6⟩ + +theorem cnt_nil (c : ℕ) : cnt [] c = 0 := rfl + +/-- A pair of letters with different labels, each once. -/ +theorem cnt_pair {g g' : Letter} (h : g.1 ≠ g'.1) : ∀ l ∈ [g, g'], cnt [g, g'] l.1 = 1 := by + intro l hl + simp only [List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl + · simp [cnt_cons, cnt_nil, Ne.symm h] + · simp [cnt_cons, cnt_nil, h] + +section cases + +variable {X Y Z : List Letter} {a b c : ℕ} {x t t₁ t₂ p g₁ g₂ : Letter} + +/-- Different cuffs, opposite signs. -/ +theorem nf_caseA_neg (hI : Inv [x, linv x, t₁, p, g₁, linv t₁, t₂, linv p, g₂, linv t₂] X Y Z a b + c) (h1 : t₁.1 ≠ p.1) + (h2 : g₁.1 ≠ g₂.1) : + ∃ w, IsNF w (a + 1) b (c + 1) ∧ WEq.{uu} ([x, linv x, t₁, p, g₁, linv t₁, t₂, linv p, g₂, linv + t₂] ++ X ++ Y ++ Z) w := by + have s1 := step_hnd.{uu} (P := [x, linv x]) (Q := []) (S := [g₁]) (T := [t₂]) (V + := [g₂, linv t₂]) hI h1 rfl + have s2 := step_fold.{uu} (P := [g₂, linv t₂]) (V := [t₂, g₁]) s1.1 rfl (by simp) + have s3 := step_fold.{uu} (P := [g₂]) (V := [g₁]) (x := linv t₂) s2.1 (by simp [linv]) (by simp) + obtain ⟨u, s4, s5⟩ := step_last.{uu} (R := [g₂] ++ [g₁]) (q := g₂) (Q := [g₁]) s3.1 rfl (cnt_pair + (Ne.symm h2)) + exact ⟨_, s4.isNF, s1.2.trans (s2.2.trans (s3.2.trans (by simpa using s5)))⟩ + +/-- Different cuffs, equal signs. -/ +theorem nf_caseA_pos (hI : Inv [x, linv x, t₁, p, g₁, linv t₁, t₂, p, g₂, linv t₂] X Y Z a b c) + (h2 : (linv g₁).1 ≠ g₂.1) : + ∃ w, IsNF w a (b + 2) (c + 1) ∧ WEq.{uu} ([x, linv x, t₁, p, g₁, linv t₁, t₂, p, g₂, linv t₂] + ++ X ++ Y ++ Z) w := by + have s1 := step_cap.{uu} (P := [x, linv x, t₁]) (Q := [g₁, linv t₁, t₂]) (S := [g₂, linv t₂]) (x + := p) hI rfl + have e1 : [g₂, linv t₂] ++ [x, linv x, t₁] ++ winv [g₁, linv t₁, t₂] = + [g₂, linv t₂, x, linv x] ++ t₁ :: [linv t₂] ++ t₁ :: [linv g₁] := by simp [winv, linv_linv] + rw [e1] at s1 + have s2 := step_cap.{uu} (P := [g₂, linv t₂, x, linv x]) (Q := [linv t₂]) (S := [linv g₁]) (x + := t₁) s1.1 rfl + have e2 : [linv g₁] ++ [g₂, linv t₂, x, linv x] ++ winv [linv t₂] = [linv g₁, g₂, linv t₂] ++ x + :: linv x :: [t₂] := by + simp [winv, linv_linv] + rw [e2] at s2 + have s3 := step_fold.{uu} (P := [linv g₁, g₂, linv t₂]) (V := [t₂]) s2.1 rfl (by simp) + have s4 := step_fold.{uu} (P := [linv g₁, g₂]) (V := []) (x := linv t₂) s3.1 + (by simp [linv_linv]) (by simp) + obtain ⟨u, s5, s6⟩ := step_last.{uu} (R := [linv g₁, g₂] ++ []) (q := linv g₁) (Q + := [g₂]) s4.1 rfl (cnt_pair h2) + exact ⟨_, s5.isNF, s1.2.trans (s2.2.trans (s3.2.trans (s4.2.trans (by simpa using s6))))⟩ + +/-- The same cuff, opposite signs. -/ +theorem nf_caseB_neg (hI : Inv [x, linv x, t, p, g₁, linv p, g₂, linv t] X Y Z a b c) + (h1 : cnt [x, linv x, t, p, g₁, linv p, g₂, linv t] g₁.1 = 1) (h2 : cnt [t, g₂, linv t] g₂.1 + = 1) : + ∃ w, IsNF w a b (c + 2) ∧ WEq.{uu} ([x, linv x, t, p, g₁, linv p, g₂, linv t] ++ X ++ Y ++ Z) w + := by + have s1 := step_hole.{uu} (P := [x, linv x, t]) (x := p) (q := g₁) (Q := []) (V + := [g₂, linv t]) hI rfl (by + intro l hl + simp only [List.mem_cons, List.not_mem_nil, or_false] at hl + rw [hl] + exact h1) + have s2 := step_fold.{uu} (P := []) (V := [t, g₂, linv t]) s1.1 rfl (by simp) + have s3 := step_hole.{uu} (P := []) (x := t) (q := g₂) (Q := []) (V := []) s2.1 rfl (by + intro l hl + simp only [List.mem_cons, List.not_mem_nil, or_false] at hl + rw [hl] + exact h2) + exact ⟨_, s3.1.isNF, s1.2.trans (s2.2.trans (by simpa using s3.2))⟩ + +/-- The same cuff, equal signs. -/ +theorem nf_caseB_pos (hI : Inv [x, linv x, t, p, g₁, p, g₂, linv t] X Y Z a b c) (h2 : g₂.1 ≠ + (linv g₁).1) : + ∃ w, IsNF w a (b + 1) (c + 1) ∧ WEq.{uu} ([x, linv x, t, p, g₁, p, g₂, linv t] ++ X ++ Y ++ Z) + w := by + have s1 := step_cap.{uu} (P := [x, linv x, t]) (Q := [g₁]) (S := [g₂, linv t]) (x := p) hI rfl + have e1 : [g₂, linv t] ++ [x, linv x, t] ++ winv [g₁] = [g₂, linv t] ++ x :: linv x :: [t, linv + g₁] := by simp [winv] + rw [e1] at s1 + have s2 := step_fold.{uu} (P := [g₂, linv t]) (V := [t, linv g₁]) s1.1 rfl (by simp) + have s3 := step_fold.{uu} (P := [g₂]) (V := [linv g₁]) (x := linv t) s2.1 (by simp [linv_linv]) + (by simp) + obtain ⟨u, s4, s5⟩ := step_last.{uu} (R := [g₂] ++ [linv g₁]) (q := g₂) (Q := [linv g₁]) s3.1 rfl + (cnt_pair h2) + exact ⟨_, s4.isNF, s1.2.trans (s2.2.trans (s3.2.trans (by simpa using s5)))⟩ + +/-- Two components, glued along an arc with opposite signs. -/ +theorem nf_caseC_neg {x₁ x₂ : Letter} + (hI : Inv [g₂, linv t₂, x₂, linv x₂, t₂, g₁, linv t₁, x₁, linv x₁, t₁] X Y Z a b c) + (h2 : g₂.1 ≠ g₁.1) : + ∃ w, IsNF w a b (c + 1) ∧ WEq.{uu} ([g₂, linv t₂, x₂, linv x₂, t₂, g₁, linv t₁, x₁, linv x₁, + t₁] ++ X ++ Y ++ Z) w := by + have s1 := step_fold.{uu} (P := [g₂, linv t₂]) (V := [t₂, g₁, linv t₁, x₁, linv x₁, t₁]) hI rfl + (by simp) + have s2 := step_fold.{uu} (P := [g₂]) (V := [g₁, linv t₁, x₁, linv x₁, t₁]) (x := linv t₂) s1.1 + (by simp [linv_linv]) (by simp) + have s3 := step_fold.{uu} (P := [g₂, g₁, linv t₁]) (V := [t₁]) (x := x₁) s2.1 rfl (by simp) + have s4 := step_fold.{uu} (P := [g₂, g₁]) (V := []) (x := linv t₁) s3.1 (by simp [linv_linv]) + (by simp) + obtain ⟨u, s5, s6⟩ := step_last.{uu} (R := [g₂, g₁] ++ []) (q := g₂) (Q := [g₁]) s4.1 rfl + (cnt_pair h2) + exact ⟨_, s5.isNF, s1.2.trans (s2.2.trans (s3.2.trans (s4.2.trans (by simpa using s6))))⟩ + +/-- Two components, glued along an arc with equal signs. -/ +theorem nf_caseC_pos {x₁ x₂ : Letter} + (hI : Inv [linv t₂, x₂, linv x₂, t₂, g₂, g₁, linv t₁, x₁, linv x₁, t₁] X Y Z a b c) + (h2 : g₂.1 ≠ g₁.1) : + ∃ w, IsNF w a b (c + 1) ∧ WEq.{uu} ([linv t₂, x₂, linv x₂, t₂, g₂, g₁, linv t₁, x₁, linv x₁, + t₁] ++ X ++ Y ++ Z) w := by + have s1 := step_fold.{uu} (P := [linv t₂]) (V := [t₂, g₂, g₁, linv t₁, x₁, linv x₁, t₁]) hI rfl + (by simp) + have s2 := step_fold.{uu} (P := []) (V := [g₂, g₁, linv t₁, x₁, linv x₁, t₁]) (x := linv t₂) s1.1 + (by simp [linv_linv]) (by simp) + have s3 := step_fold.{uu} (P := [g₂, g₁, linv t₁]) (V := [t₁]) (x := x₁) s2.1 rfl (by simp) + have s4 := step_fold.{uu} (P := [g₂, g₁]) (V := []) (x := linv t₁) s3.1 (by simp [linv_linv]) + (by simp) + obtain ⟨u, s5, s6⟩ := step_last.{uu} (R := [g₂, g₁] ++ []) (q := g₂) (Q := [g₁]) s4.1 rfl + (cnt_pair h2) + exact ⟨_, s5.isNF, s1.2.trans (s2.2.trans (s3.2.trans (s4.2.trans (by simpa using s6))))⟩ + +/-- A one-sided `O`-arc. -/ +theorem nf_caseD (hI : Inv [x, linv x, t, p, p, linv t] X Y Z a b c) : + ∃ w, IsNF w a (b + 1) c ∧ WEq.{uu} ([x, linv x, t, p, p, linv t] ++ X ++ Y ++ Z) w := by + have s1 := step_cap.{uu} (P := [x, linv x, t]) (Q := []) (S := [linv t]) (x := p) hI rfl + have e1 : [linv t] ++ [x, linv x, t] ++ winv [] = [linv t] ++ x :: linv x :: [t] := by simp [winv] + rw [e1] at s1 + have s2 := step_fold.{uu} (P := [linv t]) (V := [t]) s1.1 rfl (by simp) + have s3 := step_fold.{uu} (P := []) (V := []) (x := linv t) s2.1 (by simp [linv_linv]) (by simp) + exact ⟨_, s3.1.isNF, s1.2.trans (s2.2.trans (by simpa using s3.2))⟩ + +/-- Two cuffs glued along `O`-arcs, opposite signs. -/ +theorem nf_caseE_neg (hI : Inv [x, linv x, t₁, p, linv t₁, t₂, linv p, linv t₂] X Y Z a b c) + (h1 : t₁.1 ≠ p.1) : + ∃ w, IsNF w (a + 1) b c ∧ WEq.{uu} ([x, linv x, t₁, p, linv t₁, t₂, linv p, linv t₂] ++ X ++ Y + ++ Z) w := by + have s1 := step_hnd.{uu} (P := [x, linv x]) (Q := []) (S := []) (T := [t₂]) (V + := [linv t₂]) hI h1 rfl + have s2 := step_fold.{uu} (P := [linv t₂]) (V := [t₂]) s1.1 rfl (by simp [hndB]) + have s3 := step_fold.{uu} (P := []) (V := []) (x := linv t₂) s2.1 (by simp [linv_linv]) + (by simp [hndB]) + exact ⟨_, s3.1.isNF, s1.2.trans (s2.2.trans (by simpa using s3.2))⟩ + +/-- Two cuffs glued along `O`-arcs, equal signs. -/ +theorem nf_caseE_pos (hI : Inv [x, linv x, t₁, p, linv t₁, t₂, p, linv t₂] X Y Z a b c) : + ∃ w, IsNF w a (b + 2) c ∧ WEq.{uu} ([x, linv x, t₁, p, linv t₁, t₂, p, linv t₂] ++ X ++ Y ++ Z) + w := by + have s1 := step_cap.{uu} (P := [x, linv x, t₁]) (Q := [linv t₁, t₂]) (S := [linv t₂]) (x + := p) hI rfl + have e1 : [linv t₂] ++ [x, linv x, t₁] ++ winv [linv t₁, t₂] = [linv t₂, x, linv x] ++ t₁ :: + [linv t₂] ++ t₁ :: [] := by + simp [winv, linv_linv] + rw [e1] at s1 + have s2 := step_cap.{uu} (P := [linv t₂, x, linv x]) (Q := [linv t₂]) (S := []) (x := t₁) s1.1 rfl + have e2 : [] ++ [linv t₂, x, linv x] ++ winv [linv t₂] = [linv t₂] ++ x :: linv x :: [t₂] := by + simp [winv, linv_linv] + rw [e2] at s2 + have s3 := step_fold.{uu} (P := [linv t₂]) (V := [t₂]) s2.1 rfl (by simp) + have s4 := step_fold.{uu} (P := []) (V := []) (x := linv t₂) s3.1 (by simp [linv_linv]) (by simp) + exact ⟨_, s4.1.isNF, s1.2.trans (s2.2.trans (s3.2.trans (by simpa using s4.2)))⟩ + +/-- Two components, glued along `O`-arcs. -/ +theorem nf_caseF {x₁ x₂ : Letter} (hI : Inv [linv t₂, x₂, linv x₂, t₂, linv t₁, x₁, linv x₁, t₁] X + Y Z a b c) : + (∃ w, IsNF w a b c ∧ WEq.{uu} ([linv t₂, x₂, linv x₂, t₂, linv t₁, x₁, linv x₁, t₁] ++ X ++ Y + ++ Z) w) ∨ + (a = 0 ∧ b = 0 ∧ c = 0 ∧ ∃ y, WEq.{uu} ([linv t₂, x₂, linv x₂, t₂, linv t₁, x₁, linv x₁, t₁] + ++ X ++ Y ++ Z) [y, linv y]) := by + have s1 := step_fold.{uu} (P := [linv t₂]) (V := [t₂, linv t₁, x₁, linv x₁, t₁]) hI rfl (by simp) + have s2 := step_fold.{uu} (P := []) (V := [linv t₁, x₁, linv x₁, t₁]) (x := linv t₂) s1.1 + (by simp [linv_linv]) (by simp) + have s3 := step_fold.{uu} (P := [linv t₁]) (V := [t₁]) (x := x₁) s2.1 rfl (by simp) + have c1 := s1.2.trans (s2.2.trans s3.2) + by_cases hne : X ++ Y ++ Z = [] + · right + have hX : X = [] := by + simpa using (List.append_eq_nil_iff.mp (List.append_eq_nil_iff.mp hne).1).1 + have hY : Y = [] := by + simpa using (List.append_eq_nil_iff.mp (List.append_eq_nil_iff.mp hne).1).2 + have hZ : Z = [] := (List.append_eq_nil_iff.mp hne).2 + subst hX hY hZ + obtain ⟨h1, h2, h3, -⟩ := id hI + have ha : a = 0 := by + cases h1 + rfl + have hb : b = 0 := by + cases h2 + rfl + have hc : c = 0 := by + cases h3 + rfl + refine ⟨ha, hb, hc, linv t₁, ?_⟩ + simpa [linv_linv] using c1 + · left + have s4 := step_fold.{uu} (P := []) (V := []) (x := linv t₁) s3.1 (by simp [linv_linv]) (by + simpa [List.append_assoc] using hne) + exact ⟨_, s4.1.isNF, c1.trans (by simpa using s4.2)⟩ + +end cases + +/-- A space presented by a word equivalent to a normal form is the model. -/ +theorem homeo_of_nf {T : Type uu} [TopologicalSpace T] [T2Space T] [Nonempty T] {w₀ w : List + Letter} {a b c : ℕ} {f : ℕ × ℂ → T} + (hf : Presents (sW w₀) f) (hn : IsNF w a b c) (he : WEq.{uu} w₀ w) : Nonempty + (T ≃ₜ SurfaceModel a b c) := by + obtain ⟨w'', hp, h3⟩ := exists_modelW_nf.{uu} a b c + rcases h3 with ⟨hnf', -⟩ | ⟨h0', rfl⟩ + · obtain ⟨g', hg'⟩ := (((show PEq.{uu} (sW w₀) (sW w) from he).trans (PEq.trans + (nf_eq hn hnf') hp.symm)) T).mp ⟨f, hf⟩ + exact model_homeo a b c hg' + · exfalso + obtain ⟨rfl, rfl, rfl⟩ : a = 0 ∧ b = 0 ∧ c = 0 := by omega + obtain ⟨X, Y, Z, rfl, h1, h2, h3, -⟩ := hn + cases h1 + cases h2 + cases h3 + obtain ⟨g', hg'⟩ := ((show PEq.{uu} (sW w₀) (sW ([] ++ [] ++ [])) from he) T).mp ⟨f, hf⟩ + obtain ⟨x⟩ : Nonempty T := inferInstance + have h4 : x ∈ g' '' Dsk (sW ([] ++ [] ++ [])) := hg'.2.1 ▸ mem_univ x + obtain ⟨y, hy, -⟩ := h4 + exact absurd (by simp [sW, nW, Function.update]) hy.1 + +/-- A space presented by a word equivalent to `y y⁻¹` is the sphere model. -/ +theorem homeo_of_sphere {T : Type uu} [TopologicalSpace T] [T2Space T] {w₀ : List Letter} {y : + Letter} {f : ℕ × ℂ → T} + (hf : Presents (sW w₀) f) (he : WEq.{uu} w₀ [y, linv y]) : Nonempty (T ≃ₜ SurfaceModel 0 0 0) + := by + obtain ⟨w', hp, h3⟩ := exists_modelW_nf.{uu} 0 0 0 + rcases h3 with ⟨-, h4⟩ | ⟨-, rfl⟩ + · exact absurd rfl h4 + · have h5 : WEq.{uu} [y, linv y] [linv (segL 0), segL 0] := by + refine Iso.weq ⟨fun _ => 0, fun _ => y.2, ?_, ?_⟩ + · intro l hl l' hl' _ + have e1 : l.1 = y.1 := by + simp only [List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl <;> rfl + have e2 : l'.1 = y.1 := by + simp only [List.mem_cons, List.not_mem_nil, or_false] at hl' + rcases hl' with rfl | rfl <;> rfl + rw [e1, e2] + · obtain ⟨k, e⟩ := y + cases e <;> simp [linv, segL] + obtain ⟨g', hg'⟩ := ((show PEq.{uu} (sW w₀) (sW [y, linv y]) from he).trans + (PEq.trans h5 hp.symm) T).mp ⟨f, hf⟩ + exact model_homeo 0 0 0 hg' + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/WordCover.lean b/LeanPool/GraphMinor/Surface/WordCover.lean new file mode 100644 index 0000000000..4c52b12c0f --- /dev/null +++ b/LeanPool/GraphMinor/Surface/WordCover.lean @@ -0,0 +1,366 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.FreeCover + +/-! +# Local cocycles from functions on the sides + +Let `W` be a finite paired family of words and let `g` be a function on the discs such that on each +pair of pasted sides +the difference of `g` is constant (`SideConst`). Take `A` copies of the discs. Paste the copy `s` of +a point `a` to the +copy `s + g b - g a` of `b` when `a` and `b` are pasted. The group `A` acts freely on this space, +with quotient the +space presented by `W`. So we get a local cocycle with primitive `g` (`exists_cocycle`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter + +universe u + +/-- On each pair of pasted sides the difference of `g` is constant. -/ +def SideConst {A : Type} [AddGroup A] (W : ℕ → List Letter) (g : ℕ × ℂ → A) : Prop := + ∀ i p j q k e e', (W i)[p]? = some (k, e) → (W j)[q]? = some (k, e') → (i, p) ≠ (j, q) → + ∃ c, ∀ u ∈ Icc (0 : ℝ) 1, g (spt W j q (flp e e' u)) = c + g (spt W i p u) + +variable {W : ℕ → List Letter} {A : Type} [AddGroup A] {g : ℕ × ℂ → A} + +/-- The relation on the copies of the discs. -/ +def covRel (W : ℕ → List Letter) (g : ℕ × ℂ → A) (x y : Dsk W × A) : Prop := + PRel W x.1.1 y.1.1 ∧ -g x.1.1 + x.2 = -g y.1.1 + y.2 + +/-- The relation on the copies of the discs, as a setoid. -/ +def covSetoid (W : ℕ → List Letter) (g : ℕ × ℂ → A) : Setoid (Dsk W × A) := + ⟨covRel W g, ⟨fun _ => ⟨.refl _, rfl⟩, fun h => ⟨.symm _ _ h.1, h.2.symm⟩, + fun h h' => ⟨.trans _ _ _ h.1 h'.1, h.2.trans h'.2⟩⟩⟩ + +theorem isClosed_covRel [TopologicalSpace A] [DiscreteTopology A] [Finite A] (hW : FinW W) + (hP : IsPaired W) + (hg : SideConst W g) : IsClosed {p : (Dsk W × A) × (Dsk W × A) | covRel W g p.1 p.2} := by + classical + have hS := finite_sides hW + let Ix : Set ((ℕ × ℕ) × (ℕ × ℕ) × Bool × Bool) := + {d | ∃ k, (W d.1.1)[d.1.2]? = some (k, d.2.2.1) ∧ (W d.2.1.1)[d.2.1.2]? = some (k, d.2.2.2) + ∧ d.1 ≠ d.2.1} + have hIx : Ix.Finite := by + refine ((hS.prod (hS.prod (finite_univ (α := Bool × Bool)))).image + fun x => (x.1, x.2.1, x.2.2.1, x.2.2.2)).subset ?_ + rintro ⟨x, y, e, e'⟩ ⟨k, h1, h2, -⟩ + exact ⟨(x, y, e, e'), ⟨⟨_, h1⟩, ⟨_, h2⟩, mem_univ _⟩, rfl⟩ + have hc : ∀ d : (ℕ × ℕ) × (ℕ × ℕ) × Bool × Bool, ∃ c : A, d ∈ Ix → ∀ u ∈ Icc (0 : ℝ) 1, + g (spt W d.2.1.1 d.2.1.2 (flp d.2.2.1 d.2.2.2 u)) = c + g (spt W d.1.1 d.1.2 u) := by + intro d + by_cases hd : d ∈ Ix + · obtain ⟨k, h1, h2, h3⟩ := hd + obtain ⟨c, hc⟩ := hg _ _ _ _ k _ _ h1 h2 h3 + exact ⟨c, fun _ => hc⟩ + · exact ⟨0, fun h => absurd h hd⟩ + choose c hc using hc + let E : (ℕ × ℕ) × (ℕ × ℕ) × Bool × Bool → Set ((ℕ × ℂ) × (ℕ × ℂ)) := fun d => + (fun u => (spt W d.1.1 d.1.2 u, spt W d.2.1.1 d.2.1.2 (flp d.2.2.1 d.2.2.2 u))) '' Icc (0 : ℝ) 1 + have hE : ∀ d, IsClosed (E d) := by + intro d + refine (isCompact_Icc.image ?_).isClosed + have h1 : ∀ i p, Continuous (spt W i p) := fun i p => by + unfold spt + have := continuous_per (W i).length + fun_prop + have h2 : Continuous (flp d.2.2.1 d.2.2.2) := by + unfold flp + split_ifs <;> fun_prop + exact (h1 _ _).prodMk ((h1 _ _).comp h2) + let R1 : Set ((Dsk W × A) × (Dsk W × A)) := {p | p.1 = p.2} + let R2 : Set ((Dsk W × A) × (Dsk W × A)) := + ⋃ d ∈ Ix, {p | (p.1.1.1, p.2.1.1) ∈ E d ∧ p.2.2 - p.1.2 = c d} + let R3 : Set ((Dsk W × A) × (Dsk W × A)) := + {p | p.1.1.1 ∈ crn W ∧ p.2.1.1 ∈ crn W ∧ covRel W g p.1 p.2} + have hR2 : IsClosed R2 := by + refine hIx.isClosed_biUnion fun d _ => ?_ + change IsClosed ({p : (Dsk W × A) × (Dsk W × A) | (p.1.1.1, p.2.1.1) ∈ E d} ∩ + {p : (Dsk W × A) × (Dsk W × A) | p.2.2 - p.1.2 = c d}) + apply IsClosed.inter + · have h1 : Continuous fun p : (Dsk W × A) × (Dsk W × A) => (p.1.1.1, p.2.1.1) := by fun_prop + exact (hE d).preimage h1 + · have h1 : Continuous fun p : (Dsk W × A) × (Dsk W × A) => (p.1.2, p.2.2) := by fun_prop + exact (isClosed_discrete {x : A × A | x.2 - x.1 = c d}).preimage h1 + have hR3 : R3.Finite := by + have hinj : InjOn (fun p : (Dsk W × A) × (Dsk W × A) => ((p.1.1.1, p.2.1.1), p.1.2, p.2.2)) R3 + := by + rintro ⟨⟨a, s⟩, ⟨b, t⟩⟩ _ ⟨⟨a', s'⟩, ⟨b', t'⟩⟩ _ he + simp only [Prod.mk.injEq] at he + obtain ⟨⟨h1, h2⟩, h3, h4⟩ := he + rw [Subtype.ext h1, Subtype.ext h2, h3, h4] + refine Set.Finite.of_finite_image (((finite_crn hW).prod (finite_crn hW)).prod (toFinite + (univ : Set (A × A))) |>.subset ?_) hinj + rintro _ ⟨p, hp, rfl⟩ + exact ⟨⟨hp.1, hp.2.1⟩, mem_univ _⟩ + have hsym : ∀ x y, Stp W x y → Stp W y x := fun _ _ h => h.symm + have hstepmem : ∀ p : (Dsk W × A) × (Dsk W × A), Stp W p.1.1.1 p.2.1.1 → covRel W g p.1 p.2 + → p ∈ R2 := by + rintro ⟨⟨⟨a, ha⟩, s⟩, ⟨⟨b, hb⟩, t⟩⟩ hs hr + obtain ⟨i, j, p, q, k, e, e', u, h1, h2, h3, hu, ha', hb'⟩ := stp_iff.mp hs + simp only at ha' hb' + subst ha' hb' + have hd : ((i, p), (j, q), e, e') ∈ Ix := ⟨k, h1, h2, h3⟩ + refine mem_biUnion hd ⟨⟨u, hu, rfl⟩, ?_⟩ + have h4 := hc _ hd u hu + have h5 : -g (spt W i p u) + s = -g (spt W j q (flp e e' u)) + t := hr.2 + simp only at h4 + change t - s = _ + rw [h4, neg_add_rev, add_assoc] at h5 + rw [add_left_cancel h5, sub_eq_add_neg, neg_add_rev, neg_neg, add_neg_cancel_left] + have e : {p : (Dsk W × A) × (Dsk W × A) | covRel W g p.1 p.2} = R1 ∪ R2 ∪ R3 := by + ext ⟨x, y⟩ + constructor + · intro hr + have hr' : covRel W g x y := hr + by_cases ha : x.1.1 ∈ crn W + · by_cases hb : y.1.1 ∈ crn W + · exact .inr ⟨ha, hb, hr'⟩ + · rcases prel_of_not_crn hP y.1.2 hb (.symm _ _ hr'.1) with h | h + · refine .inl (.inl (Prod.ext (Subtype.ext h) ?_)) + have h2 := hr'.2 + rw [h] at h2 + exact add_left_cancel h2 + · exact .inl (.inr (hstepmem (x, y) (hsym _ _ h) hr')) + · rcases prel_of_not_crn hP x.1.2 ha hr'.1 with h | h + · refine .inl (.inl (Prod.ext (Subtype.ext h.symm) ?_)) + have h2 := hr'.2 + rw [h] at h2 + exact add_left_cancel h2 + · exact .inl (.inr (hstepmem (x, y) h hr')) + · rintro ((h | h) | h) + · have h' : x = y := h + subst h' + exact ⟨.refl _, rfl⟩ + · obtain ⟨d, hd, ⟨u, hu, he⟩, h3⟩ := mem_iUnion₂.mp h + obtain ⟨h1, h2⟩ := Prod.mk.inj he + obtain ⟨k, hk1, hk2, hk3⟩ := hd + have hs : Stp W x.1.1 y.1.1 := by + rw [← h1, ← h2] + exact stp_iff.mpr ⟨_, _, _, _, k, _, _, u, hk1, hk2, hk3, hu, rfl, rfl⟩ + refine ⟨.rel _ _ hs, ?_⟩ + have h4 := hc d ⟨k, hk1, hk2, hk3⟩ u hu + rw [h1, h2] at h4 + have h5 : y.2 - x.2 = c d := h3 + change -g x.1.1 + x.2 = -g y.1.1 + y.2 + rw [h4, ← h5] + simp only [sub_eq_add_neg, neg_add_rev, neg_neg, add_assoc, neg_add_cancel, add_zero] + · exact h.2.2 + rw [e] + exact (isClosed_eq continuous_fst continuous_snd |>.union hR2).union hR3.isClosed + +theorem finite_freeSides (hW : FinW W) : {x : ℕ × ℕ | x.2 < (W x.1).length + ∧ FreeSide W x.1 x.2}.Finite := by + refine (finite_sides hW).subset ?_ + rintro ⟨i, p⟩ ⟨h1, -⟩ + exact ⟨(W i)[p]'h1, List.getElem?_eq_getElem h1⟩ + +/-- A function on the sides gives a local cocycle with this function as a primitive. If the function +is constant on each +free side, then the local cocycle vanishes on the boundary. -/ +theorem exists_cocycle {Y : Type u} [TopologicalSpace Y] [T2Space Y] [Finite A] {f : ℕ × ℂ → Y} + (hW : FinW W) + (hP : IsPaired W) (hf : Presents W f) (hg : SideConst W g) (h0 : W 0 ≠ []) : + ∃ φ : Y → Y → A, IsCoc φ ∧ IsPrim φ (fun z => f (0, z)) (fun z => g (0, z)) ∧ + ((∀ i p, p < (W i).length → FreeSide W i p → ∃ c, ∀ u ∈ Icc (0 : ℝ) 1, g (spt W i p u) = c) + → BdTriv φ) := by + classical + let _ : TopologicalSpace A := ⊥ + have : DiscreteTopology A := ⟨rfl⟩ + have hcD := compactSpace_dsk hW + have ht : T2Space (Quotient (covSetoid W g)) := + t2Space_quotient_of_isClosed (covSetoid W g) (isClosed_covRel hW hP hg) + let Z := Quotient (covSetoid W g) + let mk : Dsk W × A → Z := Quotient.mk (covSetoid W g) + have hmk : Continuous mk := continuous_quotient_mk' + have hsound : ∀ {x y : Dsk W × A}, PRel W x.1.1 y.1.1 → -g x.1.1 + x.2 = -g y.1.1 + y.2 → mk x + = mk y := + fun h1 h2 => Quotient.sound ⟨h1, h2⟩ + have hexact : ∀ {x y : Dsk W × A}, mk x = mk y → PRel W x.1.1 y.1.1 ∧ -g x.1.1 + x.2 + = -g y.1.1 + y.2 := + fun h => Quotient.exact h + let τ : A → Z → Z := fun s => Quotient.lift (fun x => mk (x.1, x.2 + s)) (fun x y h => hsound h.1 + (by + have h2 : -g x.1.1 + x.2 = -g y.1.1 + y.2 := h.2 + simp only + rw [← add_assoc, h2, add_assoc])) + have hτmk : ∀ s x, τ s (mk x) = mk (x.1, x.2 + s) := fun _ _ => rfl + have hτc : ∀ s, Continuous (τ s) := fun s => + Continuous.quotient_lift (hmk.comp (by fun_prop)) _ + have hexZ : ∀ z : Z, ∃ x, mk x = z := fun z => Quotient.exists_rep z + have hτ0 : ∀ z, τ 0 z = z := by + intro z + obtain ⟨x, rfl⟩ := hexZ z + rw [hτmk, add_zero] + have hτa : ∀ s t z, τ s (τ t z) = τ (t + s) z := by + intro s t z + obtain ⟨x, rfl⟩ := hexZ z + rw [hτmk, hτmk, hτmk, add_assoc] + have hfree : ∀ s z, τ s z = z → s = 0 := by + intro s z he + obtain ⟨x, rfl⟩ := hexZ z + rw [hτmk] at he + have h1 := (hexact he).2 + simp only at h1 + exact add_eq_left.mp (add_left_cancel h1) + let q : Z → Y := Quotient.lift (fun x => f x.1.1) (fun x y h => (hf.2.2 _ x.1.2 _ y.1.2).mpr h.1) + have hqmk : ∀ x, q (mk x) = f x.1.1 := fun _ => rfl + have hfc : Continuous fun x : Dsk W => f x.1 := hf.1.comp_continuous continuous_subtype_val fun x + => x.2 + have hq : Continuous q := Continuous.quotient_lift (hfc.comp continuous_fst) _ + have hlift : ∀ y : Y, ∃ a : Dsk W, f a.1 = y := fun y => by + have h1 : y ∈ f '' Dsk W := by + rw [hf.2.1] + exact mem_univ y + obtain ⟨a, ha, rfl⟩ := h1 + exact ⟨⟨a, ha⟩, rfl⟩ + have hs : Function.Surjective q := fun y => by + obtain ⟨a, rfl⟩ := hlift y + exact ⟨mk (a, 0), rfl⟩ + have hfib : ∀ z z', q z = q z' → ∃ s, z' = τ s z := by + intro z z' he + obtain ⟨x, rfl⟩ := hexZ z + obtain ⟨y, rfl⟩ := hexZ z' + have h1 : PRel W x.1.1 y.1.1 := (hf.2.2 _ x.1.2 _ y.1.2).mp he + refine ⟨-x.2 + (g x.1.1 + (-g y.1.1 + y.2)), ?_⟩ + rw [hτmk] + refine hsound (.symm _ _ h1) ?_ + simp only [add_neg_cancel_left, neg_add_cancel_left] + have hfib' : ∀ s z, q (τ s z) = q z := by + intro s z + obtain ⟨x, rfl⟩ := hexZ z + rfl + choose l hl using hlift + let σ : Y → Z := fun y => mk (l y, g (l y).1) + have hσ : ∀ y, q (σ y) = y := fun y => hl y + have hσf : ∀ a : Dsk W, σ (f a.1) = mk (a, g a.1) := fun a => + hsound ((hf.2.2 _ (l (f a.1)).2 _ a.2).mp (hl _)) (by simp) + obtain ⟨φ, V, hV, hφ, hφs, hinv⟩ := cocycle_of_cover τ hτc hτ0 hτa hfree q hq hs hfib hfib' σ hσ + have hba : ∀ z ∈ closedBall (0 : ℂ) 1, ((0 : ℕ), z) ∈ Dsk W := fun z hz => ⟨h0, by simpa using hz⟩ + have hprim : IsPrim φ (fun z => f (0, z)) (fun z => g (0, z)) := by + let P : ℂ → Z := fun z => if h : z ∈ closedBall (0 : ℂ) 1 then mk (⟨(0, z), hba z h⟩, 0) else + mk (⟨(0, 0), hba 0 (by simp)⟩, 0) + have hP : ∀ z (h : z ∈ closedBall (0 : ℂ) 1), P z = mk (⟨(0, z), hba z h⟩, 0) := fun z h => by + simp only [P, h, dite_eq_left] + have hPc : ContinuousOn P (closedBall 0 1) := by + rw [continuousOn_iff_continuous_domRestrict] + have e : (closedBall (0 : ℂ) 1).domRestrict P = mk ∘ fun z : closedBall (0 : ℂ) 1 => + (⟨(0, z.1), hba z.1 z.2⟩, 0) := by + funext z + exact hP z.1 z.2 + rw [e] + refine hmk.comp (Continuous.prodMk (Continuous.subtype_mk ?_ _) continuous_const) + fun_prop + obtain ⟨ε, hε, h1⟩ := exists_eps (isCompact_closedBall 0 1) hPc hV + refine ⟨ε, hε, fun a ha b hb hab => ?_⟩ + have h2 := hinv (g (0, b)) _ _ (h1 a ha b hb hab) + rw [hP a ha, hP b hb, hτmk, hτmk] at h2 + have e1 := hσf ⟨(0, a), hba a ha⟩ + have e2 := hσf ⟨(0, b), hba b hb⟩ + simp only at e1 e2 + refine hφs _ _ _ ?_ + rw [e1, e2, hτmk] + simp only [zero_add] at h2 ⊢ + have e3 : g (0, a) + (-g (0, a) + g (0, b)) = g (0, b) := add_neg_cancel_left _ _ + rw [e3] + exact h2 + refine ⟨φ, hφ, hprim, fun hconst => ?_⟩ + have hbd := (surface_of_presents hW hP hf).2 + have hconst' : ∀ d : ℕ × ℕ, ∃ c, d ∈ {x : ℕ × ℕ | x.2 < (W x.1).length ∧ FreeSide W x.1 x.2} → + ∀ u ∈ Icc (0 : ℝ) 1, g (spt W d.1 d.2 u) = c := by + intro d + by_cases hd : d ∈ {x : ℕ × ℕ | x.2 < (W x.1).length ∧ FreeSide W x.1 x.2} + · obtain ⟨c, hc⟩ := hconst _ _ hd.1 hd.2 + exact ⟨c, fun _ => hc⟩ + · exact ⟨0, fun h => absurd h hd⟩ + choose c hc using hconst' + have hm : ∀ d ∈ {x : ℕ × ℕ | x.2 < (W x.1).length ∧ FreeSide W x.1 x.2}, ∀ u, spt W d.1 d.2 u ∈ + Dsk W := by + intro d hd u + refine ⟨fun he => ?_, (norm_per _ _).le⟩ + have h1 := hd.1 + simp only [spt] at he + rw [he] at h1 + simp at h1 + let K : Set Z := ⋃ d ∈ {x : ℕ × ℕ | x.2 < (W x.1).length ∧ FreeSide W x.1 x.2}, + (fun u : ℝ => if h : spt W d.1 d.2 u ∈ Dsk W then mk (⟨_, h⟩, c d) else mk (l (f + (0, 0)), 0)) '' Icc (0 : ℝ) 1 + have hmemK : ∀ d (hd : d ∈ {x : ℕ × ℕ | x.2 < (W x.1).length ∧ FreeSide W x.1 x.2}), ∀ u ∈ Icc + (0 : ℝ) 1, + mk (⟨_, hm d hd u⟩, g (spt W d.1 d.2 u)) ∈ K := by + intro d hd u hu + refine mem_biUnion hd ⟨u, hu, ?_⟩ + simp only [hm d hd u, dite_eq_left, hc d hd u hu] + have hKform : ∀ z ∈ K, ∃ a : Dsk W, z = mk (a, g a.1) := by + intro z hz + obtain ⟨d, hd, u, hu, rfl⟩ := mem_iUnion₂.mp hz + refine ⟨⟨_, hm d hd u⟩, ?_⟩ + simp only [hm d hd u, dite_eq_left, hc d hd u hu] + have hK : IsCompact K := by + refine (finite_freeSides hW).isCompact_biUnion fun d hd => ?_ + refine isCompact_Icc.image_of_continuousOn ?_ + rw [continuousOn_iff_continuous_domRestrict] + have e : (Icc (0 : ℝ) 1).domRestrict (fun u : ℝ => if h : spt W d.1 d.2 u ∈ Dsk W then mk + (⟨_, h⟩, c d) + else mk (l (f (0, 0)), 0)) = mk ∘ fun u : Icc (0 : ℝ) 1 => (⟨_, hm d hd u.1⟩, c d) := by + funext u + simp only [Set.domRestrict_apply, hm d hd u.1, dite_eq_left, Function.comp] + rw [e] + refine hmk.comp (Continuous.prodMk (Continuous.subtype_mk ?_ _) continuous_const) + unfold spt + have := continuous_per (W d.1).length + fun_prop + have hne : Nonempty Z := ⟨mk (l (f (0, 0)), 0)⟩ + have hinj : InjOn q K := by + intro z hz z' hz' he + obtain ⟨a, rfl⟩ := hKform z hz + obtain ⟨b, rfl⟩ := hKform z' hz' + exact hsound ((hf.2.2 _ a.2 _ b.2).mp he) (by simp) + obtain ⟨q', hq', hql⟩ := exists_inv_of_compactOn hK hq.continuousOn hinj + have hσK : ∀ x ∈ bd Y, σ x ∈ K := by + intro x hx + rw [hbd] at hx + obtain ⟨a, ⟨i, p, u, hp, hfr, hu, rfl⟩, rfl⟩ := hx + have hd : (i, p) ∈ {x : ℕ × ℕ | x.2 < (W x.1).length ∧ FreeSide W x.1 x.2} := ⟨hp, hfr⟩ + have h1 := hσf ⟨_, hm (i, p) hd u⟩ + simp only at h1 + rw [h1] + exact hmemK _ hd u hu + have hσc : ContinuousOn σ (bd Y) := by + have hsub : bd Y ⊆ q '' K := fun x hx => ⟨σ x, hσK x hx, hσ x⟩ + refine (hq'.mono hsub).congr fun x hx => ?_ + have h1 := hql (hσK x hx) + rw [hσ] at h1 + exact h1.symm + have hcl : IsClosed (bd Y) := isClosed_bd Y + refine ⟨0, {p | p.1 ∈ bd Y → p.2 ∈ bd Y → (σ p.1, σ p.2) ∈ V}, fun y => ?_, + fun x hx y hy hxy => ?_⟩ + · by_cases hy : y ∈ bd Y + · have h1 : ContinuousWithinAt (fun p : Y × Y => (σ p.1, σ p.2)) (bd Y ×ˢ bd Y) (y, y) := by + have h2 := hσc.prodMap hσc + exact h2 (y, y) ⟨hy, hy⟩ + have h3 := h1 (hV (σ y)) + obtain ⟨u, hu, hus⟩ := mem_nhdsWithin_iff_exists_mem_nhds_inter.mp h3 + refine Filter.mem_of_superset hu fun p hp h4 h5 => ?_ + exact hus ⟨hp, h4, h5⟩ + · have h1 : (bd Y)ᶜ ×ˢ (univ : Set Y) ∈ 𝓝 (y, y) := (hcl.isOpen_compl.prod + isOpen_univ).mem_nhds ⟨hy, mem_univ _⟩ + refine Filter.mem_of_superset h1 fun p hp h4 => ?_ + exact absurd h4 hp.1 + · have h1 := hφs x y 0 (by rw [hτ0]; exact hxy hx hy) + simp [h1] + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/WordFold.lean b/LeanPool/GraphMinor/Surface/WordFold.lean new file mode 100644 index 0000000000..aa3f16ccc7 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/WordFold.lean @@ -0,0 +1,311 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.WordMoves + +/-! +# Folding and renaming + +Two adjacent sides `x x⁻¹` of a word can be folded together (`exists_isPolyMap_fold`): the map of +discs opens the +polygon onto the upper half disc and then squares. Renaming labels does not change the relation +between points. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter Function + +universe u + +theorem sv_sv (ε : Bool) (t : ℝ) : sv ε (sv ε t) = t := by + cases ε <;> simp [sv] + +theorem sv_not (ε : Bool) (t : ℝ) : sv (!ε) t = 1 - sv ε t := by + cases ε <;> simp [sv] + +theorem exists_sqrt_half {z : ℂ} (hz : ‖z‖ ≤ 1) : ∃ w ∈ halfD 1, w ^ 2 = z := by + have hw : (z ^ ((2 : ℕ) : ℂ)⁻¹) ^ 2 = z := Complex.cpow_nat_inv_pow z two_ne_zero + generalize z ^ ((2 : ℕ) : ℂ)⁻¹ = w at hw + have hn : ‖w‖ ≤ 1 := by + have : ‖w‖ ^ 2 ≤ 1 := by rw [← norm_pow, hw]; exact hz + nlinarith [norm_nonneg w] + rcases le_total 0 w.im with h | h + · exact ⟨w, ⟨hn, by simpa using h⟩, hw⟩ + · exact ⟨-w, ⟨by simpa using hn, by simpa using h⟩, by rw [neg_sq, hw]⟩ + +theorem up_sq {n _p : ℕ} (_hn : 0 < n) (x : ℝ) : (cis' (Real.pi * x / n)) ^ 2 = per n x := by + simp only [cis', per] + rw [← Complex.exp_nat_mul] + congr 1 + push_cast + ring + +section fold + +variable {W : ℕ → List Letter} {i : ℕ} {u : List Letter} {y : ℕ} {e : Bool} + +/-- Folding two adjacent sides. -/ +theorem exists_isPolyMap_fold (hu : u ≠ []) (hy : FreshIn (update W i u) y) : + ∃ θ, IsPolyMap (update W i u) (update W i ((y, e) :: (y, !e) :: u)) θ := by + classical + set n := u.length with hn + have hn0 : 0 < n := List.length_pos_iff.mpr hu + obtain ⟨Φ, Φ', m, hv⟩ := exists_up_map (a := 2) (l := n) two_pos hn0 + rw [Nat.add_comm 2 n] at hv + set W0 := update W i u with hW0 + set W1 := update W i ((y, e) :: (y, !e) :: u) with hW1 + have e1 : W1 i = (y, e) :: (y, !e) :: u := by rw [hW1, update_self] + have e2 : W0 i = u := by rw [hW0, update_self] + have e3 : ∀ s, s ≠ i → W1 s = W0 s := fun s h => by rw [hW1, hW0, update_of_ne h, update_of_ne h] + have hyu : ∀ l' ∈ u, l'.1 ≠ y := fun l' h => hy i l' (by rw [e2]; exact h) + have hlen1 : (W1 i).length = n + 2 := by rw [e1]; simp [hn] + have hlen0 : (W0 i).length = n := by rw [e2] + have hball : ∀ {V : ℕ → List Letter} {s : ℕ} {z : ℂ}, (s, z) ∈ Dsk V → z ∈ closedBall (0 : ℂ) 1 := + fun h => mem_closedBall_zero_iff.mpr h.2 + have hHalf : ∀ {z}, z ∈ closedBall (0 : ℂ) 1 → Φ z ∈ halfD 1 := fun hz => m.1 hz + have hinj : ∀ {z z'}, z ∈ closedBall (0 : ℂ) 1 → z' ∈ closedBall (0 : ℂ) 1 → Φ z = Φ z' → z = z' + := + fun hz hz' he => by rw [← m.2.2.1 hz, ← m.2.2.1 hz', he] + have hb : ∀ {t : ℝ}, ‖sdPt (n + 2) 0 e t‖ ≤ 1 ∧ ‖sdPt (n + 2) 1 (!e) t‖ ≤ 1 := + ⟨(norm_per _ _).le, (norm_per _ _).le⟩ + have hs0 : ∀ t ∈ Icc (0 : ℝ) 1, Φ (sdPt (n + 2) 0 e t) = ((-1 + sv e t : ℝ) : ℂ) := by + intro t ht + have hs := sv_mem e ht + have h1 : sdPt (n + 2) 0 e t = per (n + 2) (sv e t) := by simp [sdPt, sv] + have h3 : (0 : ℝ) ≤ n := Nat.cast_nonneg n + rw [h1, hv _ ⟨hs.1, by push_cast; linarith [hs.2]⟩, upLoop_le (by push_cast; linarith [hs.2])] + push_cast + ring + have hs1 : ∀ t ∈ Icc (0 : ℝ) 1, Φ (sdPt (n + 2) 1 (!e) t) = ((1 - sv e t : ℝ) : ℂ) := by + intro t ht + have hs := sv_mem e ht + have h1 : sdPt (n + 2) 1 (!e) t = per (n + 2) (1 + (1 - sv e t)) := by + rw [← sv_not] + simp [sdPt, sv] + have h3 : (0 : ℝ) ≤ n := Nat.cast_nonneg n + rw [h1, hv _ ⟨by linarith [hs.2], by push_cast; linarith [hs.1]⟩, + upLoop_le (by push_cast; linarith [hs.1])] + push_cast + ring + have hs2 : ∀ p ε t, p < n → t ∈ Icc (0 : ℝ) 1 → + (Φ (sdPt (n + 2) (p + 2) ε t)) ^ 2 = sdPt n p ε t := by + intro p ε t hp ht + have hs := sv_mem ε ht + have h1 : sdPt (n + 2) (p + 2) ε t = per (n + 2) (((p + 2 : ℕ) : ℝ) + sv ε t) := rfl + have h2 : ((p + 1 : ℕ) : ℝ) ≤ n := by exact_mod_cast hp + push_cast at h2 + have h3 : (0 : ℝ) ≤ p := Nat.cast_nonneg p + rw [h1, hv _ ⟨by push_cast; linarith [hs.1], by push_cast; linarith [hs.2]⟩, + upLoop_ge two_pos (by push_cast; linarith [hs.1])] + have h4 := up_sq (n := n) (_p := 0) hn0 ((p : ℝ) + sv ε t) + have h5 : (((p + 2 : ℕ) : ℝ) + sv ε t - (2 : ℕ)) = (p : ℝ) + sv ε t := by + push_cast + ring + rw [h5, h4] + rfl + let θ : ℕ × ℂ → ℕ × ℂ := fun a => if a.1 = i then (i, (Φ a.2) ^ 2) else a + have θi : ∀ z, θ (i, z) = (i, (Φ z) ^ 2) := fun z => by simp [θ] + have θo : ∀ s z, s ≠ i → θ (s, z) = (s, z) := fun s z h1 => by simp [θ, h1] + have hmix : ∀ z z', z ∈ closedBall (0 : ℂ) 1 → z' ∈ closedBall (0 : ℂ) 1 → Φ z = - Φ z' → + 0 ≤ (Φ z').re → PRel W1 (i, z) (i, z') := by + intro z z' hz hz' he hr + have h1 := hHalf hz + have h2 := hHalf hz' + have h3 : (Φ z').im = 0 := by + have h4 := h1.2 + rw [he] at h4 + simp only [one_mul, Complex.neg_im] at h4 + have h5 := h2.2 + simp only [one_mul] at h5 + linarith + have h6 : (Φ z').re ≤ 1 := (Complex.re_le_norm _).trans h2.1 + have hsm : (1 - (Φ z').re) ∈ Icc (0 : ℝ) 1 := ⟨by linarith, by linarith⟩ + let t := sv e (1 - (Φ z').re) + have ht : t ∈ Icc (0 : ℝ) 1 := sv_mem e hsm + have hst : sv e t = 1 - (Φ z').re := sv_sv e _ + have h7 : Φ z' = (((Φ z').re : ℝ) : ℂ) := Complex.ext rfl (by simp [h3]) + have ha : z = sdPt (n + 2) 0 e t := by + refine hinj hz (mem_closedBall_zero_iff.mpr (norm_per _ _).le) ?_ + rw [hs0 t ht, he, hst, h7] + apply Complex.ext <;> simp + ring + have hb' : z' = sdPt (n + 2) 1 (!e) t := by + refine hinj hz' (mem_closedBall_zero_iff.mpr (norm_per _ _).le) ?_ + rw [hs1 t ht, hst, h7] + apply Complex.ext <;> simp + refine .rel _ _ ⟨i, i, 0, 1, y, e, !e, t, by rw [e1]; rfl, by rw [e1]; rfl, + by simp, ht, ?_, ?_⟩ + · rw [hlen1, ha] + · rw [hlen1, hb'] + refine ⟨θ, IsPolyMap.of_sides (Y := {y}) ?_ ?_ ?_ ?_ ?_ ?_ ?_⟩ + · rw [continuousOn_prod_of_discrete_left] + intro s + by_cases h1 : s = i + · subst h1 + have hs : (fun z => θ (s, z)) = fun z => (s, (Φ z) ^ 2) := funext θi + rw [hs] + exact continuousOn_const.prodMk ((m.2.2.2.2.1.mono fun z hz => hball hz).pow 2) + · have hs : (fun z => θ (s, z)) = fun z => (s, z) := funext fun z => θo s z h1 + rw [hs] + exact (Continuous.prodMk continuous_const continuous_id).continuousOn + · rintro ⟨s, z⟩ hz + by_cases h1 : s = i + · subst h1 + rw [θi] + refine ⟨by rw [e2]; exact hu, ?_⟩ + have := (hHalf (hball hz)).1 + simp only [norm_pow] + exact pow_le_one₀ (norm_nonneg _) this + · rw [θo s z h1] + refine ⟨?_, hz.2⟩ + have := hz.1 + rwa [e3 s h1] at this + · rintro ⟨s, z⟩ hz + by_cases h1 : s = i + · subst h1 + obtain ⟨w, hw, rfl⟩ := exists_sqrt_half hz.2 + refine ⟨(s, Φ' w), ⟨by rw [e1]; simp, mem_closedBall_zero_iff.mp (m.2.1 hw)⟩, ?_⟩ + rw [θi, m.2.2.2.1 hw] + · refine ⟨(s, z), ⟨?_, hz.2⟩, θo s z h1⟩ + have := hz.1 + rwa [← e3 s h1] at this + · rintro ⟨s, z⟩ hz ⟨s', z'⟩ hz' he + by_cases h1 : s = i <;> by_cases h3 : s' = i + · subst h1 h3 + rw [θi, θi] at he + have h4 := (Prod.mk.inj he).2 + rcases sq_eq_sq_iff_eq_or_eq_neg.mp h4 with h5 | h5 + · rw [hinj (hball hz) (hball hz') h5] + exact .refl _ + · rcases le_total 0 (Φ z').re with h6 | h6 + · exact hmix _ _ (hball hz) (hball hz') h5 h6 + · refine (hmix _ _ (hball hz') (hball hz) (by rw [h5, neg_neg]) ?_).symm + rw [h5, Complex.neg_re] + linarith + · subst h1 + rw [θi, θo s' z' h3] at he + exact absurd (Prod.mk.inj he).1.symm h3 + · subst h3 + rw [θo s z h1, θi] at he + exact absurd (Prod.mk.inj he).1 h1 + · rw [θo s z h1, θo s' z' h3] at he + rw [he] + exact .refl _ + · intro s p c ε h hc + by_cases h1 : s = i + · subst h1 + rw [e1] at h + match p, h with + | 0, h => + have : (y, e) = (c, ε) := by simpa using h + exact absurd (Prod.mk.inj this).1.symm hc + | 1, h => + have : (y, !e) = (c, ε) := by simpa using h + exact absurd (Prod.mk.inj this).1.symm hc + | p + 2, h => + rw [List.getElem?_cons_succ, List.getElem?_cons_succ] at h + have hp : p < n := (List.getElem?_eq_some_iff.mp h).1 + refine ⟨s, p, ε, by rw [e2]; exact h, fun t ht => ?_⟩ + rw [θi, hlen1, hlen0, hs2 p ε t hp ht] + · refine ⟨s, p, ε, by rwa [← e3 s h1], fun t _ => ?_⟩ + rw [θo _ _ h1, e3 s h1] + · intro s p c ε h + by_cases h1 : s = i + · subst h1 + rw [e2] at h + have hp : p < n := (List.getElem?_eq_some_iff.mp h).1 + refine ⟨s, p + 2, ε, by rw [e1, List.getElem?_cons_succ, List.getElem?_cons_succ]; exact h, + fun t ht => ?_⟩ + rw [θi, hlen1, hlen0, hs2 p ε t hp ht] + · refine ⟨s, p, ε, by rwa [e3 s h1], fun t _ => ?_⟩ + rw [θo _ _ h1, e3 s h1] + · have hside : ∀ s q ε, (W1 s)[q]? = some (y, ε) → ∀ t ∈ Icc (0 : ℝ) 1, + θ (s, sdPt (W1 s).length q ε t) = (i, ((1 - sv e t : ℝ) : ℂ) ^ 2) := by + intro s q ε h t ht + by_cases h1 : s = i + · subst h1 + rw [e1] at h + match q, h with + | 0, h => + have : ε = e := by simpa using h.symm + subst this + rw [θi, hlen1, hs0 t ht] + congr 1 + push_cast + ring + | 1, h => + have : ε = !e := by simpa using h.symm + subst this + rw [θi, hlen1, hs1 t ht] + | q + 2, h => + rw [List.getElem?_cons_succ, List.getElem?_cons_succ] at h + exact absurd rfl (hyu _ (List.mem_of_getElem? h)) + · rw [e3 s h1] at h + have h3 := hy s _ (List.mem_of_getElem? h) + exact absurd rfl h3 + intro s s' q q' c ε ε' t hc h1 h2 ht + obtain rfl : c = y := hc + rw [hside s q ε h1 t ht, hside s' q' ε' h2 t ht] + +end fold + +/-- Renaming labels. -/ +def relab (r : ℕ → ℕ) (W : ℕ → List Letter) : ℕ → List Letter := + fun i => (W i).map fun l => (r l.1, l.2) + +theorem relab_getElem {r : ℕ → ℕ} {W : ℕ → List Letter} {i p : ℕ} {c : ℕ} {ε : Bool} + (h : (W i)[p]? = some (c, ε)) : (relab r W i)[p]? = some (r c, ε) := by + simp [relab, h] + +theorem relab_getElem' {r : ℕ → ℕ} {W : ℕ → List Letter} {i p : ℕ} {c : ℕ} {ε : Bool} + (h : (relab r W i)[p]? = some (c, ε)) : ∃ c', r c' = c ∧ (W i)[p]? = some (c', ε) := by + simp only [relab, List.getElem?_map, Option.map_eq_some_iff, Prod.mk.injEq, Prod.exists] at h + obtain ⟨a, b, h1, h2, h3⟩ := h + exact ⟨a, h2, by rw [h1, h3]⟩ + +theorem relab_length {r : ℕ → ℕ} {W : ℕ → List Letter} {i : ℕ} : (relab r W i).length = + (W i).length := by + simp [relab] + +theorem Dsk_relab {r : ℕ → ℕ} {W : ℕ → List Letter} : Dsk (relab r W) = Dsk W := by + ext a + simp [Dsk, relab] + +/-- Renaming labels, without merging two labels that occur in the family, keeps a presentation. -/ +theorem presents_relab {T : Type u} [TopologicalSpace T] {r : ℕ → ℕ} {W : ℕ → List Letter} + (hr : ∀ i j, ∀ l ∈ W i, ∀ l' ∈ W j, r l.1 = r l'.1 → l.1 = l'.1) (f : ℕ × ℂ → T) : + Presents W f ↔ Presents (relab r W) f := by + have key : ∀ a b, Stp W a b ↔ Stp (relab r W) a b := by + intro a b + constructor + · rintro ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ + exact ⟨i, j, p, q, r k, ε, ε', t, relab_getElem h1, relab_getElem h2, h3, ht, + by rw [relab_length], by rw [relab_length]⟩ + · rintro ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ + obtain ⟨c, rfl, h4⟩ := relab_getElem' h1 + obtain ⟨c', he, h5⟩ := relab_getElem' h2 + have := hr i j _ (List.mem_of_getElem? h4) _ (List.mem_of_getElem? h5) he.symm + obtain rfl : c = c' := this + exact ⟨i, j, p, q, c, ε, ε', t, h4, h5, h3, ht, by rw [relab_length], by rw [relab_length]⟩ + have hS : Stp W = Stp (relab r W) := by + ext a b + exact key a b + unfold Presents PRel + rw [Dsk_relab, hS] + +/-- Renaming labels, without merging two labels that occur in the family. -/ +theorem peq_relab {r : ℕ → ℕ} {W : ℕ → List Letter} + (hr : ∀ i j, ∀ l ∈ W i, ∀ l' ∈ W j, r l.1 = r l'.1 → l.1 = l'.1) : PEq.{u} W (relab r W) := + fun _T _ _ => exists_congr (presents_relab hr) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/WordGerm.lean b/LeanPool/GraphMinor/Surface/WordGerm.lean new file mode 100644 index 0000000000..08c06cc8fa --- /dev/null +++ b/LeanPool/GraphMinor/Surface/WordGerm.lean @@ -0,0 +1,480 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.WordSpace +public import LeanPool.GraphMinor.Surface.FanSquare + +/-! +# Germs of a family of words + +A germ is a point of a side of a word, with a direction along the side. A small polar rectangle in +the disc of the word +starts at a germ. Its left side runs along the radius and its lower side runs along the side of the +word. Two +rectangles at the same point share the left side. The rectangles of two germs that are pasted share +the lower side. +Off these sides and the point the rectangles do not meet (`Germ.rect_same`, `Germ.rect_stp`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +/-- A point of a side and a direction along it. -/ +@[ext] structure Germ where + /-- Index of the word containing the side. -/ + i : ℕ + /-- Position of the side in that word. -/ + p : ℕ + /-- Coordinate of the point on the side. -/ + u : ℝ + /-- Direction along the side. -/ + τ : Bool + +/-- The sign of a direction. -/ +noncomputable def sg (τ : Bool) : ℝ := if τ then 1 else -1 + +@[simp] theorem sg_true : sg true = 1 := rfl +@[simp] theorem sg_false : sg false = -1 := rfl + +/-- The side of a word that has no other side with its label. -/ +def FreeSide (W : ℕ → List Letter) (i p : ℕ) : Prop := + ∀ j q k e e', (W i)[p]? = some (k, e) → (W j)[q]? = some (k, e') → (i, p) = (j, q) + +theorem per_eq {n : ℕ} (hn : 0 < n) {x y : ℝ} (h : per n x = per n y) : ∃ m : ℤ, x = y + m * n := by + have hn' : (n : ℂ) ≠ 0 := by exact_mod_cast hn.ne' + obtain ⟨m, hm⟩ := Complex.exp_eq_exp_iff_exists_int.mp h + refine ⟨m, ?_⟩ + have hpi : (Real.pi : ℂ) ≠ 0 := by exact_mod_cast Real.pi_ne_zero + have h1 : (x : ℂ) = y + m * n := by + have h2 : (2 * Real.pi * x / n : ℝ) * Complex.I = (2 * Real.pi * y / n : ℝ) * Complex.I + + m * (2 * Real.pi * Complex.I) := hm + push_cast at h2 + have hc : (2 * Real.pi * Complex.I : ℂ) ≠ 0 := by simp [hpi] + have h3 : (2 * Real.pi * Complex.I : ℂ) * (x / n) = (2 * Real.pi * Complex.I) * (y / n + m) + := by + linear_combination h2 + have h4 := mul_left_cancel₀ hc h3 + field_simp at h4 + linear_combination h4 + exact_mod_cast h1 + +theorem int_eq_zero_of {n : ℕ} (hn : 0 < n) {m : ℤ} (h : |(m : ℝ) * n| < n) : m = 0 := by + have hn' : (0 : ℝ) < n := by exact_mod_cast hn + rw [abs_mul, Nat.abs_cast] at h + have h1 : |(m : ℝ)| < 1 := by + by_contra hc + push Not at hc + nlinarith + have h2 : |m| < 1 := by exact_mod_cast h1 + exact Int.abs_lt_one_iff.mp h2 + +theorem sg_cancel {a b : ℝ} {τ τ' : Bool} (ha : 0 ≤ a) (hb : 0 ≤ b) (hp : 0 < a ∨ 0 < b) + (h : sg τ * a = sg τ' * b) : τ = τ' ∧ a = b := by + cases τ <;> cases τ' <;> simp only [sg_false, sg_true] at h <;> + first + | exact ⟨rfl, by linarith⟩ + | (exfalso; rcases hp with h9 | h9 <;> linarith) + +theorem abs_sub_le_of_sg {u u' a b h : ℝ} {τ τ' : Bool} (ha : 0 ≤ a) (ha' : a ≤ h) (hb : 0 ≤ b) + (hb' : b ≤ h) + (he : u + sg τ * a = u' + sg τ' * b) : |u - u'| ≤ 2 * h := by + rw [abs_le] + cases τ <;> cases τ' <;> simp only [sg_false, sg_true] at he <;> constructor <;> linarith + +namespace Germ + +variable {W : ℕ → List Letter} + +/-- A germ in a family of words: the direction goes into the side. -/ +def Valid (W : ℕ → List Letter) (g : Germ) : Prop := + g.p < (W g.i).length ∧ g.u ∈ Icc (0 : ℝ) 1 ∧ (g.τ = true → g.u < 1) ∧ (g.τ = false → 0 < g.u) + +/-- The point of a germ. -/ +noncomputable def pt (W : ℕ → List Letter) (g : Germ) : ℕ × ℂ := spt W g.i g.p g.u + +/-- The offset on the side of the point `z` of the square. -/ +noncomputable def th (h : ℝ) (g : Germ) (z : ℂ) : ℝ := g.u + sg g.τ * (h * z.re) + +/-- The polar rectangle of a germ, of size `h`. -/ +noncomputable def rect (W : ℕ → List Letter) (h : ℝ) (g : Germ) (z : ℂ) : ℕ × ℂ := + (g.i, ((1 - h * z.im : ℝ) : ℂ) * per (W g.i).length (g.p + th h g z)) + +/-- The germ is far from the ends of the side, on the side that it looks at. -/ +def Small (h : ℝ) (g : Germ) : Prop := (g.τ = true → g.u + h < 1) ∧ (g.τ = false → 0 < g.u - h) + +theorem Valid.len_pos {g : Germ} (hv : Valid W g) : 0 < (W g.i).length := by + have := hv.1 + omega + +theorem Valid.ne_nil {g : Germ} (hv : Valid W g) : W g.i ≠ [] := List.length_pos_iff.mp hv.len_pos + +theorem Valid.exists_label {g : Germ} (hv : Valid W g) : ∃ k e, (W g.i)[g.p]? = some (k, e) := + ⟨((W g.i)[g.p]'hv.1).1, ((W g.i)[g.p]'hv.1).2, List.getElem?_eq_getElem hv.1⟩ + +theorem Valid.pt_mem {g : Germ} (hv : Valid W g) : g.pt W ∈ Dsk W := + ⟨hv.ne_nil, (norm_per _ _).le⟩ + +theorem Valid.norm_pt {g : Germ} (_hv : Valid W g) : ‖(g.pt W).2‖ = 1 := norm_per _ _ + +theorem eq_of_pt {g g' : Germ} (hv : Valid W g) (hv' : Valid W g') (hτ : g.τ = g'.τ) (he : g.pt W + = g'.pt W) : + g = g' := by + obtain ⟨i, p, u, τ⟩ := g + obtain ⟨i', p', u', τ'⟩ := g' + simp only at hτ + subst hτ + have hi : i = i' := congrArg Prod.fst he + subst hi + obtain ⟨hp, hu, h1, h2⟩ := hv + obtain ⟨hp', hu', h1', h2'⟩ := hv' + simp only at hp hu h1 h2 hp' hu' h1' h2' + have hn : 0 < (W i).length := by omega + have hpn : (p : ℝ) + 1 ≤ (W i).length := by exact_mod_cast hp + have hpn' : (p' : ℝ) + 1 ≤ (W i).length := by exact_mod_cast hp' + have hn0 : (0 : ℝ) ≤ p := Nat.cast_nonneg p + have hn0' : (0 : ℝ) ≤ p' := Nat.cast_nonneg p' + obtain ⟨m, hm⟩ := per_eq hn (congrArg Prod.snd he) + have hm0 : m = 0 := by + apply int_eq_zero_of hn + have h3 : (m : ℝ) * (W i).length = (p + u) - (p' + u') := by linarith + rw [h3, abs_lt] + cases τ + · have h4 := h2 rfl + have h4' := h2' rfl + constructor <;> linarith [hu.2, hu'.2] + · have h4 := h1 rfl + have h4' := h1' rfl + constructor <;> linarith [hu.1, hu'.1] + rw [hm0] at hm + simp only [Int.cast_zero, zero_mul, add_zero] at hm + have hpp : p = p' := by + rcases lt_trichotomy p p' with h3 | h3 | h3 + · have h5 : (p : ℝ) + 1 ≤ p' := by exact_mod_cast h3 + cases τ + · have := h2' rfl + linarith [hu.2] + · have := h1 rfl + linarith [hu'.1] + · exact h3 + · have h5 : (p' : ℝ) + 1 ≤ p := by exact_mod_cast h3 + cases τ + · have := h2 rfl + linarith [hu'.2] + · have := h1' rfl + linarith [hu.1] + subst hpp + have huu : u = u' := by linarith + rw [huu] + +/-- Each germ has a germ at the same point in the other direction. -/ +theorem exists_twin {g : Germ} (hv : Valid W g) : ∃ g', Valid W g' ∧ g'.pt W = g.pt W ∧ g'.τ = !g.τ + := by + obtain ⟨i, p, u, τ⟩ := g + obtain ⟨hp, hu, h1, h2⟩ := hv + simp only at hp hu h1 h2 + have hn : 0 < (W i).length := by omega + have hper : ∀ x, per (W i).length (x + (W i).length) = per (W i).length x := per_add_self hn.ne' + cases τ + · have hu0 := h2 rfl + rcases lt_or_eq_of_le hu.2 with h3 | h3 + · exact ⟨⟨i, p, u, true⟩, ⟨hp, hu, fun _ => h3, by simp⟩, rfl, rfl⟩ + · subst h3 + by_cases hp1 : p + 1 < (W i).length + · refine ⟨⟨i, p + 1, 0, true⟩, ⟨hp1, by simp, by simp, by simp⟩, ?_, rfl⟩ + simp [pt, spt] + · have hpe : p + 1 = (W i).length := by omega + refine ⟨⟨i, 0, 0, true⟩, ⟨hn, by simp, by simp, by simp⟩, ?_, rfl⟩ + have h4 : (p : ℝ) + 1 = (0 : ℝ) + (W i).length := by + rw [zero_add] + exact_mod_cast hpe + simp only [pt, spt] + rw [h4, hper] + simp + · have hu0 := h1 rfl + rcases lt_or_eq_of_le hu.1 with h3 | h3 + · exact ⟨⟨i, p, u, false⟩, ⟨hp, hu, by simp, fun _ => h3⟩, rfl, rfl⟩ + · subst h3 + rcases Nat.eq_zero_or_pos p with h4 | h4 + · subst h4 + refine ⟨⟨i, (W i).length - 1, 1, false⟩, ⟨Nat.sub_lt hn one_pos, by simp, by simp, + by simp⟩, ?_, rfl⟩ + have h5 : (((W i).length - 1 : ℕ) : ℝ) + 1 = (0 : ℝ) + (W i).length := by + rw [Nat.cast_sub hn] + simp + simp only [pt, spt] + rw [h5, hper] + simp + · refine ⟨⟨i, p - 1, 1, false⟩, ⟨by simp only; omega, by simp, by simp, by simp⟩, ?_, rfl⟩ + have h5 : ((p - 1 : ℕ) : ℝ) + 1 = p := by + rw [Nat.cast_sub h4] + simp + simp only [pt, spt] + rw [h5] + simp + +/-- `g'` is the germ on the other side with the same label as `g`. -/ +def Partner (W : ℕ → List Letter) (g g' : Germ) : Prop := + ∃ k e e', (W g.i)[g.p]? = some (k, e) ∧ (W g'.i)[g'.p]? = some (k, e') ∧ (g.i, g.p) ≠ + (g'.i, g'.p) ∧ + g'.u = flp e e' g.u ∧ g'.τ = (if e = e' then g.τ else !g.τ) + +theorem flp_add (e e' : Bool) (τ : Bool) (u t : ℝ) : + flp e e' (u + sg τ * t) = flp e e' u + sg (if e = e' then τ else !τ) * t := by + cases e <;> cases e' <;> cases τ <;> simp [flp] <;> ring + +/-- Each side with a label on another side gives a partner. -/ +theorem exists_partner {g : Germ} (hv : Valid W g) (hfree : ¬ FreeSide W g.i g.p) : + ∃ g', Valid W g' ∧ Partner W g g' := by + unfold FreeSide at hfree + push Not at hfree + obtain ⟨j, q, k, e, e', h1, h2, h3⟩ := hfree + refine ⟨⟨j, q, flp e e' g.u, if e = e' then g.τ else !g.τ⟩, ⟨(List.getElem?_eq_some_iff.mp h2).1, + flp_mem hv.2.1, ?_, ?_⟩, k, e, e', h1, h2, h3, rfl, rfl⟩ + · simp only + intro h4 + have hu := hv.2.1 + have h5 := hv.2.2.1 + have h6 := hv.2.2.2 + by_cases h7 : e = e' + · simp only [h7, ite_true] at h4 ⊢ + simpa [flp] using h5 h4 + · simp only [h7, ite_false] at h4 ⊢ + have h8 : g.τ = false := by simpa using h4 + simpa [flp, h7] using h6 h8 + · simp only + intro h4 + have hu := hv.2.1 + have h5 := hv.2.2.1 + have h6 := hv.2.2.2 + by_cases h7 : e = e' + · simp only [h7, ite_true] at h4 ⊢ + simpa [flp] using h6 h4 + · simp only [h7, ite_false] at h4 ⊢ + have h8 : g.τ = true := by simpa using h4 + simpa [flp, h7] using h5 h8 + +theorem Partner.ne {g g' : Germ} (h : Partner W g g') : g' ≠ g := by + rintro rfl + obtain ⟨k, e, e', -, -, h3, -⟩ := h + exact h3 rfl + +theorem Partner.not_free {g g' : Germ} (h : Partner W g g') : ¬ FreeSide W g.i g.p := by + obtain ⟨k, e, e', h1, h2, h3, -⟩ := h + exact fun hf => h3 (hf _ _ k e e' h1 h2) + +theorem Partner.stp {g g' : Germ} (h : Partner W g g') {u : ℝ} (hu : u ∈ Icc (0 : ℝ) 1) : + ∃ e e', Stp W (spt W g.i g.p u) (spt W g'.i g'.p (flp e e' u)) ∧ g'.u = flp e e' g.u ∧ + g'.τ = (if e = e' then g.τ else !g.τ) := by + obtain ⟨k, e, e', h1, h2, h3, h4, h5⟩ := h + exact ⟨e, e', stp_iff.mpr ⟨_, _, _, _, k, e, e', u, h1, h2, h3, hu, rfl, rfl⟩, h4, h5⟩ + +theorem rect_zero (W : ℕ → List Letter) (h : ℝ) (g : Germ) : rect W h g 0 = g.pt W := by + simp [rect, pt, spt, th] + +theorem rect_im {h : ℝ} (g : Germ) {z : ℂ} (hz : z.im = 0) : rect W h g z = spt W g.i g.p + (th h g z) := by + simp [rect, spt, hz] + +theorem rect_left (W : ℕ → List Letter) (h : ℝ) (g : Germ) (s : ℝ) : + rect W h g (s * Complex.I) = (g.i, ((1 - h * s : ℝ) : ℂ) * (g.pt W).2) := by + simp [rect, pt, spt, th] + +section Small + +variable {h : ℝ} (h0 : 0 < h) (h1 : h < 1) + +include h0 in +theorem th_mem {g : Germ} (hv : Valid W g) (hs : Small h g) {z : ℂ} (hz : z ∈ unitSq) : + th h g z ∈ Icc (0 : ℝ) 1 ∧ (0 < z.re → th h g z ∈ Ioo (0 : ℝ) 1) := by + obtain ⟨hz1, -⟩ := hz + have hu := hv.2.1 + have hb : h * z.re ≤ h := by nlinarith [hz1.2] + have hb0 : 0 ≤ h * z.re := mul_nonneg h0.le hz1.1 + unfold th + cases hτ : g.τ + · have h3 := hs.2 hτ + simp only [sg_false] + refine ⟨⟨by linarith, by linarith [hu.2]⟩, fun hp => ?_⟩ + have := mul_pos h0 hp + exact ⟨by linarith, by linarith [hu.2]⟩ + · have h3 := hs.1 hτ + simp only [sg_true] + refine ⟨⟨by linarith [hu.1], by linarith⟩, fun hp => ?_⟩ + have := mul_pos h0 hp + exact ⟨by linarith [hu.1], by linarith⟩ + +include h0 h1 in +theorem rect_mem {g : Germ} (hv : Valid W g) {z : ℂ} (hz : z ∈ unitSq) : rect W h g z ∈ Dsk W := by + obtain ⟨-, hz2⟩ := hz + refine ⟨hv.ne_nil, ?_⟩ + simp only [rect, norm_mul, norm_per, mul_one, Complex.norm_real, Real.norm_eq_abs] + have hb : h * z.im ≤ h := by nlinarith [hz2.2] + have hb0 : 0 ≤ h * z.im := mul_nonneg h0.le hz2.1 + rw [abs_of_pos (by linarith)] + linarith + +include h0 h1 in +theorem norm_rect {g : Germ} {z : ℂ} (hz : z ∈ unitSq) : ‖(rect W h g z).2‖ = 1 - h * z.im := by + obtain ⟨-, hz2⟩ := hz + simp only [rect, norm_mul, norm_per, mul_one, Complex.norm_real, Real.norm_eq_abs] + have hb : h * z.im ≤ h := by nlinarith [hz2.2] + rw [abs_of_pos (by linarith)] + +theorem continuous_rect (W : ℕ → List Letter) (h : ℝ) (g : Germ) : Continuous (rect W h g) := by + unfold rect th + have := continuous_per (W g.i).length + fun_prop + +/-- The set of germs is separated at the scale `h`. -/ +def Sep (h : ℝ) (G : Set Germ) : Prop := + ∀ g ∈ G, ∀ g' ∈ G, g.i = g'.i → g.p = g'.p → g.u ≠ g'.u → 2 * h < |g.u - g'.u| + +include h0 h1 in +/-- Two equal points of the rectangles of germs. -/ +theorem rect_same {G : Set Germ} (hG : ∀ g ∈ G, Valid W g) (hS : ∀ g ∈ G, Small h g) + (hsep : Sep h G) + {g g' : Germ} (hg : g ∈ G) (hg' : g' ∈ G) {z z' : ℂ} (hz : z ∈ unitSq) (hz' : z' ∈ unitSq) + (he : rect W h g z = rect W h g' z') : + z = z' ∧ (g = g' ∨ (z.re = 0 ∧ g'.τ = !g.τ ∧ g'.pt W = g.pt W)) := by + have hi : g.i = g'.i := congrArg Prod.fst he + have hnorm : ‖(rect W h g z).2‖ = ‖(rect W h g' z').2‖ := by rw [he] + rw [norm_rect h0 h1 hz, norm_rect h0 h1 hz'] at hnorm + have him : z.im = z'.im := mul_left_cancel₀ h0.ne' (by linarith) + have hρ : ((1 - h * z.im : ℝ) : ℂ) ≠ 0 := by + have hb : h * z.im ≤ h := by nlinarith [hz.2.2] + have : 1 - h * z.im ≠ 0 := by linarith + exact_mod_cast this + have hv := hG g hg + have hv' := hG g' hg' + have hper : per (W g.i).length (g.p + th h g z) = per (W g.i).length (g'.p + th h g' z') := by + have h3 : ((1 - h * z.im : ℝ) : ℂ) * per (W g.i).length (g.p + th h g z) = + ((1 - h * z'.im : ℝ) : ℂ) * per (W g'.i).length (g'.p + th h g' z') := congrArg Prod.snd he + rw [← him, ← hi] at h3 + exact mul_left_cancel₀ hρ h3 + have hm1 := th_mem h0 hv (hS g hg) hz + have hm2 := th_mem h0 hv' (hS g' hg') hz' + have hre0 : 0 ≤ z.re := hz.1.1 + have hre0' : 0 ≤ z'.re := hz'.1.1 + have hre1 : z.re ≤ 1 := hz.1.2 + have hre1' : z'.re ≤ 1 := hz'.1.2 + by_cases hboth : z.re = 0 ∧ z'.re = 0 + · have hzz : z = z' := Complex.ext (by rw [hboth.1, hboth.2]) him + refine ⟨hzz, ?_⟩ + have hpp : g'.pt W = g.pt W := by + have h3 := he + rw [hzz] at h3 + have h4 : rect W h g z' = (g.i, ((1 - h * z'.im : ℝ) : ℂ) * (g.pt W).2) := by + conv_lhs => rw [show z' = (z'.im : ℝ) * Complex.I from Complex.ext (by simp [hboth.2]) + (by simp)] + rw [rect_left] + have h5 : rect W h g' z' = (g'.i, ((1 - h * z'.im : ℝ) : ℂ) * (g'.pt W).2) := by + conv_lhs => rw [show z' = (z'.im : ℝ) * Complex.I from Complex.ext (by simp [hboth.2]) + (by simp)] + rw [rect_left] + rw [h4, h5] at h3 + have h6 := mul_left_cancel₀ (by rw [him] at hρ; exact hρ) (congrArg Prod.snd h3) + exact Prod.ext hi.symm h6.symm + by_cases hτ : g'.τ = g.τ + · exact .inl (eq_of_pt hv hv' hτ.symm hpp.symm) + · refine .inr ⟨hboth.1, ?_, hpp⟩ + cases h7 : g.τ <;> cases h8 : g'.τ <;> simp_all + · have hkey : g.p = g'.p ∧ th h g z = th h g' z' := by + have hlen : (W g.i).length = (W g'.i).length := by rw [hi] + by_cases h5 : z.re = 0 + · have h6 : 0 < z'.re := lt_of_le_of_ne hre0' fun h7 => hboth ⟨h5, h7.symm⟩ + have h7 := side_unique hv'.1 (hlen ▸ hv.1) (hm2.2 h6) hm1.1 (by rw [← hlen]; exact + hper.symm) + exact ⟨h7.1.symm, h7.2.symm⟩ + · have h6 : 0 < z.re := lt_of_le_of_ne hre0 (Ne.symm h5) + exact side_unique hv.1 (hlen ▸ hv'.1) (hm1.2 h6) hm2.1 hper + obtain ⟨hp, hth⟩ := hkey + have hb : h * z.re ≤ h := by nlinarith + have hb' : h * z'.re ≤ h := by nlinarith + have hb0 : 0 ≤ h * z.re := mul_nonneg h0.le hre0 + have hb0' : 0 ≤ h * z'.re := mul_nonneg h0.le hre0' + have huu : g.u = g'.u := by + by_contra hne + have h6 := hsep g hg g' hg' hi hp hne + have h7 : g.u + sg g.τ * (h * z.re) = g'.u + sg g'.τ * (h * z'.re) := hth + have h8 := abs_sub_le_of_sg hb0 hb hb0' hb' h7 + linarith + have h7 : sg g.τ * (h * z.re) = sg g'.τ * (h * z'.re) := by + have h8 : g.u + sg g.τ * (h * z.re) = g'.u + sg g'.τ * (h * z'.re) := hth + linarith + have hpos : 0 < z.re ∨ 0 < z'.re := by + by_contra hc + push Not at hc + exact hboth ⟨le_antisymm hc.1 hre0, le_antisymm hc.2 hre0'⟩ + have hpos' : 0 < h * z.re ∨ 0 < h * z'.re := hpos.imp (mul_pos h0) (mul_pos h0) + have h8 : g.τ = g'.τ ∧ h * z.re = h * z'.re := sg_cancel hb0 hb0' hpos' h7 + have hre : z.re = z'.re := mul_left_cancel₀ h0.ne' h8.2 + exact ⟨Complex.ext hre him, .inl (Germ.ext hi hp huu h8.1)⟩ + +include h0 in +/-- A step from a rectangle goes to the rectangle of the partner. -/ +theorem rect_stp {G : Set Germ} (hP : IsPaired W) (hG : ∀ g ∈ G, Valid W g) + (hS : ∀ g ∈ G, Small h g) (hsep : Sep h G) + {g g' g₄ : Germ} (hg : g ∈ G) (hg' : g' ∈ G) (hg₄ : g₄ ∈ G) (hp : Partner W g g₄) {z z' : ℂ} + (hz : z ∈ unitSq) + (hz' : z' ∈ unitSq) (hi : z.im = 0) (hi' : z'.im = 0) (hre : 0 < z.re) + (he : Stp W (rect W h g z) (rect W h g' z')) : z = z' ∧ g' = g₄ := by + have hv := hG g hg + have hv' := hG g' hg' + have hv₄ := hG g₄ hg₄ + have hm1 := th_mem h0 hv (hS g hg) hz + have hm2 := th_mem h0 hv' (hS g' hg') hz' + have hm3 := hm1.2 hre + rw [rect_im g hi, rect_im g' hi'] at he + obtain ⟨k, e, e', hs1, hs2, hs3, hs4, hs5⟩ := id hp + obtain ⟨j, q, e₂, h2, h3, h4⟩ := stp_of_side hP hs1 hm3 he + have h5 : (j, q) = (g.i, g.p) ∨ (j, q) = (g₄.i, g₄.p) := hP.third hs1 hs2 h2 hs3 + have h6 : (j, q) = (g₄.i, g₄.p) := h5.resolve_left fun h7 => h3 h7.symm + obtain ⟨rfl, rfl⟩ := Prod.mk.inj h6 + rw [hs2] at h2 + obtain ⟨-, h7⟩ := Prod.mk.inj (Option.some.inj h2) + subst h7 + have hi2 : g'.i = g₄.i := congrArg Prod.fst h4 + have hφ := flp_mem' (e := e) (e' := e') hm3 + have hlen : (W g₄.i).length = (W g'.i).length := by rw [hi2] + have h8 := side_unique hv₄.1 (hlen ▸ hv'.1) hφ hm2.1 (by + have h9 : per (W g'.i).length (g'.p + th h g' z') = per (W g₄.i).length (g₄.p + flp e e' + (th h g z)) := + congrArg Prod.snd h4 + rw [← hlen] at h9 + exact h9.symm) + obtain ⟨hpp, hφe⟩ := h8 + have h9 : g₄.u + sg g₄.τ * (h * z.re) = g'.u + sg g'.τ * (h * z'.re) := by + have h10 : flp e e' (th h g z) = g₄.u + sg g₄.τ * (h * z.re) := by + rw [th, flp_add, hs4, hs5] + rw [← h10, hφe] + rfl + have hre0' : 0 ≤ z'.re := hz'.1.1 + have hb : h * z.re ≤ h := by nlinarith [hz.1.2] + have hb' : h * z'.re ≤ h := by nlinarith [hz'.1.2] + have hb0 : 0 < h * z.re := mul_pos h0 hre + have hb0' : 0 ≤ h * z'.re := mul_nonneg h0.le hre0' + have huu : g₄.u = g'.u := by + by_contra hne + have h10 := hsep g₄ hg₄ g' hg' hi2.symm hpp hne + have h11 := abs_sub_le_of_sg hb0.le hb hb0' hb' h9 + linarith + have h7 : sg g₄.τ * (h * z.re) = sg g'.τ * (h * z'.re) := by linarith + have h8 : g₄.τ = g'.τ ∧ h * z.re = h * z'.re := sg_cancel hb0.le hb0' (.inl hb0) h7 + have hre2 : z.re = z'.re := mul_left_cancel₀ h0.ne' h8.2 + exact ⟨Complex.ext hre2 (by rw [hi, hi']), (Germ.ext hi2.symm hpp huu h8.1).symm⟩ + +end Small + +end Germ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/WordIso.lean b/LeanPool/GraphMinor/Surface/WordIso.lean new file mode 100644 index 0000000000..412583c860 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/WordIso.lean @@ -0,0 +1,419 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.WordNormal + +/-! +# Comparing normal forms + +Two normal forms with the same numbers `a`, `b`, `c` are equal up to names and signs of labels +(`nf_eq`). A handle +next to a cross-cap can be replaced by two cross-caps (`nf_tp`). The list `nfW a b c` is a normal +form for each `a`, +`b`, `c`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Function + +universe uu + +/-- Equal words up to names and signs of labels. -/ +def Iso (w w' : List Letter) : Prop := + ∃ (r : ℕ → ℕ) (f : ℕ → Bool), (∀ l ∈ w, ∀ l' ∈ w, r l.1 = r l'.1 → l.1 = l'.1) ∧ + w.map (fun l => (r l.1, xor (f l.1) l.2)) = w' + +theorem Iso.weq {w w' : List Letter} (h : Iso w w') : WEq.{uu} w w' := by + obtain ⟨r, f, hr, rfl⟩ := h + have h1 := WEq.flip.{uu} w f + have hm : ∀ {l : Letter}, l ∈ w.map (flipL f) → ∃ m ∈ w, m.1 = l.1 := fun hl => by + obtain ⟨m, hm, rfl⟩ := List.mem_map.mp hl + exact ⟨m, hm, rfl⟩ + have h2 := peq_relab.{uu} (r := r) (W := sW (w.map (flipL f))) (by + intro i j l hl l' hl' he + have hmem : ∀ i, ∀ l ∈ sW (w.map (flipL f)) i, l ∈ w.map (flipL f) := by + intro i l hl + by_cases hi : i = 0 + · subst hi + simpa [sW] using hl + · simp [sW, update_of_ne hi, nW] at hl + obtain ⟨m, hm1, hm2⟩ := hm (hmem _ _ hl) + obtain ⟨m', hm1', hm2'⟩ := hm (hmem _ _ hl') + rw [← hm2, ← hm2'] at he ⊢ + exact hr m hm1 m' hm1' he) + have e : relab r (sW (w.map (flipL f))) = sW (w.map fun l => (r l.1, xor (f l.1) l.2)) := by + funext i + by_cases hi : i = 0 + · subst hi + simp [relab, sW, flipL, Function.comp_def] + · simp [relab, sW, update_of_ne hi, nW] + rw [e] at h2 + exact h1.trans h2 + +theorem Iso.nil : Iso [] [] := ⟨id, fun _ => false, by simp, rfl⟩ + +theorem Iso.append {a a' b b' : List Letter} (ha : Iso a a') (hb : Iso b b') (hd : DisjL a b) + (hd' : DisjL a' b') : + Iso (a ++ b) (a' ++ b') := by + classical + obtain ⟨r, f, hr, rfl⟩ := ha + obtain ⟨r', f', hr', rfl⟩ := hb + let A : Set ℕ := {c | ∃ l ∈ a, l.1 = c} + have hmap : ∀ l ∈ a, (fun l : Letter => ((if l.1 ∈ A then r l.1 else r' l.1), + xor (if l.1 ∈ A then f l.1 else f' l.1) l.2)) l = (r l.1, xor (f l.1) l.2) := fun l hl => by + have : l.1 ∈ A := ⟨l, hl, rfl⟩ + simp [this] + have hmap' : ∀ l ∈ b, (fun l : Letter => ((if l.1 ∈ A then r l.1 else r' l.1), + xor (if l.1 ∈ A then f l.1 else f' l.1) l.2)) l = (r' l.1, xor (f' l.1) l.2) := fun l hl => by + have : l.1 ∉ A := by + rintro ⟨m, hm, he⟩ + exact hd m hm l hl he.symm + simp [this] + refine ⟨fun c => if c ∈ A then r c else r' c, fun c => if c ∈ A then f c else f' c, ?_, ?_⟩ + · have key : ∀ l ∈ a, ∀ l' ∈ b, r l.1 ≠ r' l'.1 := fun l hl l' hl' he => by + have h1 : (r l.1, xor (f l.1) l.2) ∈ a.map (fun l => (r l.1, xor (f l.1) l.2)) := + List.mem_map.mpr ⟨l, hl, rfl⟩ + have h2 : (r' l'.1, xor (f' l'.1) l'.2) ∈ b.map (fun l => (r' l.1, xor (f' l.1) l.2)) := + List.mem_map.mpr ⟨l', hl', rfl⟩ + exact hd' _ h1 _ h2 he.symm + intro l hl l' hl' he + have ga : ∀ m ∈ a, (if m.1 ∈ A then r m.1 else r' m.1) = r m.1 := fun m hm => by + have : m.1 ∈ A := ⟨m, hm, rfl⟩ + simp [this] + have gb : ∀ m ∈ b, (if m.1 ∈ A then r m.1 else r' m.1) = r' m.1 := fun m hm => by + have : m.1 ∉ A := by + rintro ⟨n, hn, he⟩ + exact hd n hn m hm he.symm + simp [this] + dsimp only at he + rcases List.mem_append.mp hl with h1 | h1 <;> rcases List.mem_append.mp hl' with h2 | h2 + · rw [ga l h1, ga l' h2] at he + exact hr l h1 l' h2 he + · rw [ga l h1, gb l' h2] at he + exact absurd he (key l h1 l' h2) + · rw [gb l h1, ga l' h2] at he + exact absurd he.symm (key l' h2 l h1) + · rw [gb l h1, gb l' h2] at he + exact hr' l h1 l' h2 he + · rw [List.map_append] + congr 1 + · exact List.map_congr_left hmap + · exact List.map_congr_left hmap' + +theorem iso_hnd {u v u' v' : Letter} (h : u.1 ≠ v.1) (h' : u'.1 ≠ v'.1) : Iso (hndB u v) + (hndB u' v') := by + classical + obtain ⟨a, b⟩ := u + obtain ⟨c, d⟩ := v + obtain ⟨a', b'⟩ := u' + obtain ⟨c', d'⟩ := v' + have h1 : a ≠ c := h + have h2 : c ≠ a := fun e => h e.symm + refine ⟨fun n => if n = a then a' else c', fun n => if n = a then xor b b' else xor d d', ?_, ?_⟩ + · intro l hl l' hl' he + simp only [hndB, linv, List.mem_cons, List.not_mem_nil, or_false] at hl hl' + have ha' : a' ≠ c' := h' + rcases hl with rfl | rfl | rfl | rfl <;> rcases hl' with rfl | rfl | rfl | rfl <;> + simp_all + · simp only [hndB, linv, List.map_cons, List.map_nil, ite_true, ite_eq_right h2] + cases b <;> cases b' <;> cases d <;> cases d' <;> simp + +theorem iso_cap (y y' : Letter) : Iso [y, y] [y', y'] := by + refine ⟨fun _ => y'.1, fun _ => xor y.2 y'.2, ?_, ?_⟩ + · intro l hl l' hl' _ + simp only [List.mem_cons, List.not_mem_nil, or_false, or_self] at hl hl' + rw [hl, hl'] + · obtain ⟨a, b⟩ := y + obtain ⟨c, d⟩ := y' + cases b <;> cases d <;> simp + +theorem iso_hol {u v u' v' : Letter} (h : u.1 ≠ v.1) (h' : u'.1 ≠ v'.1) : Iso (holB u v) + (holB u' v') := by + classical + obtain ⟨a, b⟩ := u + obtain ⟨c, d⟩ := v + obtain ⟨a', b'⟩ := u' + obtain ⟨c', d'⟩ := v' + have h1 : a ≠ c := h + have h2 : c ≠ a := fun e => h e.symm + refine ⟨fun n => if n = a then a' else c', fun n => if n = a then xor b b' else xor d d', ?_, ?_⟩ + · intro l hl l' hl' he + simp only [holB, linv, List.mem_cons, List.not_mem_nil, or_false] at hl hl' + have ha' : a' ≠ c' := h' + rcases hl with rfl | rfl | rfl <;> rcases hl' with rfl | rfl | rfl <;> simp_all + · simp only [holB, linv, List.map_cons, List.map_nil, ite_true, ite_eq_right h2] + cases b <;> cases b' <;> cases d <;> cases d' <;> simp + +theorem HL.iso {a : ℕ} {X X' : List Letter} (h : HL a X) (h' : HL a X') : Iso X X' := by + induction h generalizing X' with + | nil => + cases h' + exact Iso.nil + | cons u v huv hX _ ih => + cases h' with + | cons u' v' huv' hX' h'' => exact (iso_hnd huv huv').append (ih h'') hX hX' + +theorem CL.iso {a : ℕ} {X X' : List Letter} (h : CL a X) (h' : CL a X') : Iso X X' := by + induction h generalizing X' with + | nil => + cases h' + exact Iso.nil + | cons u hX _ ih => + cases h' with + | cons u' hX' h'' => exact (iso_cap u u').append (ih h'') hX hX' + +theorem TL.iso {a : ℕ} {X X' : List Letter} (h : TL a X) (h' : TL a X') : Iso X X' := by + induction h generalizing X' with + | nil => + cases h' + exact Iso.nil + | cons u v huv hX _ ih => + cases h' with + | cons u' v' huv' hX' h'' => exact (iso_hol huv huv').append (ih h'') hX hX' + +/-- **Equal numbers give equivalent normal forms.** -/ +theorem nf_eq {w w' : List Letter} {a b c : ℕ} (h : IsNF w a b c) (h' : IsNF w' a b c) : WEq.{uu} w + w' := by + obtain ⟨X, Y, Z, rfl, h1, h2, h3, h4, h5, h6⟩ := h + obtain ⟨X', Y', Z', rfl, h1', h2', h3', h4', h5', h6'⟩ := h' + exact (((h1.iso h1').append (h2.iso h2') h4 h4').append (h3.iso h3') (h5.append_left h6) + (h5'.append_left h6')).weq + +/-- The handles with labels from `k` on. -/ +def hW (k : ℕ) : ℕ → List Letter + | 0 => [] + | a + 1 => hndB (k, true) (k + 1, true) ++ hW (k + 2) a + +/-- The cross-caps with labels from `k` on. -/ +def cW (k : ℕ) : ℕ → List Letter + | 0 => [] + | a + 1 => [(k, true), (k, true)] ++ cW (k + 1) a + +/-- The holes with labels from `k` on. -/ +def tW (k : ℕ) : ℕ → List Letter + | 0 => [] + | a + 1 => holB (k, true) (k + 1, true) ++ tW (k + 2) a + +theorem hW_labels (k a : ℕ) : ∀ l ∈ hW k a, k ≤ l.1 ∧ l.1 < k + 2 * a := by + induction a generalizing k with + | zero => simp [hW] + | succ a ih => + intro l hl + simp only [hW, hndB, linv, List.cons_append, List.mem_cons, List.nil_append] at hl + rcases hl with rfl | rfl | rfl | rfl | hl + · simp + · simp; omega + · simp + · simp; omega + · have := ih (k + 2) l hl + omega + +theorem cW_labels (k a : ℕ) : ∀ l ∈ cW k a, k ≤ l.1 ∧ l.1 < k + a := by + induction a generalizing k with + | zero => simp [cW] + | succ a ih => + intro l hl + simp only [cW, List.cons_append, List.mem_cons, List.nil_append] at hl + rcases hl with rfl | rfl | hl + · simp + · simp + · have := ih (k + 1) l hl + omega + +theorem tW_labels (k a : ℕ) : ∀ l ∈ tW k a, k ≤ l.1 ∧ l.1 < k + 2 * a := by + induction a generalizing k with + | zero => simp [tW] + | succ a ih => + intro l hl + simp only [tW, holB, linv, List.cons_append, List.mem_cons, List.nil_append] at hl + rcases hl with rfl | rfl | rfl | hl + · simp + · simp; omega + · simp + · have := ih (k + 2) l hl + omega + +theorem hL_hW (k a : ℕ) : HL a (hW k a) := by + induction a generalizing k with + | zero => exact .nil + | succ a ih => + refine .cons _ _ (by simp) ?_ (ih (k + 2)) + intro l hl m hm he + have := (hW_labels _ _ m hm).1 + simp only [hndB, linv, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl | rfl <;> simp at he <;> omega + +theorem cL_cW (k a : ℕ) : CL a (cW k a) := by + induction a generalizing k with + | zero => exact .nil + | succ a ih => + refine .cons _ ?_ (ih (k + 1)) + intro l hl m hm he + have := (cW_labels _ _ m hm).1 + simp only [List.mem_cons, List.not_mem_nil, or_false, or_self] at hl + subst hl + simp at he + omega + +theorem tL_tW (k a : ℕ) : TL a (tW k a) := by + induction a generalizing k with + | zero => exact .nil + | succ a ih => + refine .cons _ _ (by simp) ?_ (ih (k + 2)) + intro l hl m hm he + have := (tW_labels _ _ m hm).1 + simp only [holB, linv, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl <;> simp at he <;> omega + +/-- The chosen normal form. -/ +def nfW (a b c : ℕ) : List Letter := hW 0 a ++ cW (2 * a) b ++ tW (2 * a + b) c + +theorem isNF_nfW (a b c : ℕ) : IsNF (nfW a b c) a b c := by + refine ⟨_, _, _, rfl, hL_hW _ _, cL_cW _ _, tL_tW _ _, ?_, ?_, ?_⟩ + · intro l hl m hm he + have h1 := (hW_labels _ _ l hl).2 + have h2 := (cW_labels _ _ m hm).1 + omega + · intro l hl m hm he + have h1 := (hW_labels _ _ l hl).2 + have h2 := (tW_labels _ _ m hm).1 + omega + · intro l hl m hm he + have h1 := (cW_labels _ _ l hl).2 + have h2 := (tW_labels _ _ m hm).1 + omega + +/-- A handle and a cross-cap are three cross-caps. -/ +theorem weq_tp {u v y : Letter} (C : List Letter) (huv : u.1 ≠ v.1) (huy : u.1 ≠ y.1) + (hvy : v.1 ≠ y.1) + (hu : NoLab C u.1) (hv : NoLab C v.1) (hy : NoLab C y.1) : + WEq.{uu} (C ++ hndB u v ++ [y, y]) (C ++ [linv v, linv v] ++ [u, u] ++ [y, y]) := by + have hvu : v.1 ≠ u.1 := fun e => huv e.symm + have hyu : y.1 ≠ u.1 := fun e => huy e.symm + have hyv : y.1 ≠ v.1 := fun e => hvy e.symm + have c0 : WEq.{uu} (C ++ hndB u v ++ [y, y]) (y :: C ++ u :: v :: linv u :: linv v :: [y]) := + WEq.rot' (C ++ hndB u v ++ [y]) [y] (by simp [hndB]) (by simp [hndB]) + have c1 : WEq.{uu} (y :: C ++ u :: v :: linv u :: linv v :: [y]) (u :: + ((y :: C) ++ [linv v, y] ++ linv u :: [v])) := + ruleA' u (y :: C) [] [v] [linv v, y] (noLab_cons.mpr ⟨hyu, hu⟩) noLab_nil + (noLab_cons.mpr ⟨hvu, noLab_nil⟩) + (noLab_cons.mpr ⟨hvu, noLab_cons.mpr ⟨hyu, noLab_nil⟩⟩) (by simp) (by simp) + have c2 : WEq.{uu} (u :: ((y :: C) ++ [linv v, y] ++ linv u :: [v])) (C ++ linv v :: y :: + (linv u :: v :: u :: [y])) := + WEq.rot' [u, y] (C ++ linv v :: y :: linv u :: [v]) (by simp) (by simp) + have c3 : WEq.{uu} (C ++ linv v :: y :: (linv u :: v :: u :: [y])) + (y :: (C ++ [linv v] ++ winv [linv u, v, u] ++ [y])) := + ruleB' y (C ++ [linv v]) [] [linv u, v, u] [] (noLab_append.mpr ⟨hy, noLab_cons.mpr ⟨hvy, + noLab_nil⟩⟩) noLab_nil + (noLab_cons.mpr ⟨huy, noLab_cons.mpr ⟨hvy, noLab_cons.mpr ⟨huy, noLab_nil⟩⟩⟩) noLab_nil + (by simp) + (by simp [winv]) + have e : winv [linv u, v, u] = [linv u, linv v, u] := by simp [winv, linv_linv] + rw [e] at c3 + have c4 : WEq.{uu} (y :: (C ++ [linv v] ++ [linv u, linv v, u] ++ [y])) + (linv v :: ([u, y, y] ++ C ++ linv v :: [linv u])) := + WEq.rot' (y :: C ++ [linv v, linv u]) [linv v, u, y] (by simp) (by simp) + have n1 : NoLab ([u, y, y] ++ C) (linv v).1 := noLab_append.mpr + ⟨noLab_cons.mpr ⟨huv, noLab_cons.mpr ⟨hyv, noLab_cons.mpr ⟨hyv, noLab_nil⟩⟩⟩, hv⟩ + have c5 : WEq.{uu} (linv v :: ([u, y, y] ++ C ++ linv v :: [linv u])) + ([u, y, y] ++ C ++ linv v :: linv v :: winv [linv u]) := + ruleB' (linv v) [] ([u, y, y] ++ C) [] [linv u] noLab_nil n1 noLab_nil + (noLab_cons.mpr ⟨huv, noLab_nil⟩) (by simp) (by simp [winv]) + have e2 : winv [linv u] = [u] := by simp [winv, linv_linv] + rw [e2] at c5 + have c6 : WEq.{uu} ([u, y, y] ++ C ++ linv v :: linv v :: [u]) (C ++ [linv v, linv v] ++ [u, u] + ++ [y, y]) := + WEq.rot' [u, y, y] (C ++ linv v :: linv v :: [u]) (by simp) (by simp) + exact c0.trans (c1.trans (c2.trans (c3.trans (c4.trans (c5.trans c6))))) + +/-- **A handle and a cross-cap are three cross-caps.** -/ +theorem nf_tp {w w' : List Letter} {a b c : ℕ} (h : IsNF w (a + 1) (b + 1) c) (h' : IsNF w' a + (b + 3) c) : + WEq.{uu} w w' := by + obtain ⟨X, Y, Z, rfl, h1, h2, h3, h4, h5, h6⟩ := h + cases h1 with + | cons u v huv hX h1 => + cases h2 with + | cons y hY h2 => + rename_i X₀ Y₀ + have hu : u ∈ hndB u v := by simp [hndB] + have hv : v ∈ hndB u v := by simp [hndB] + have hyy : y ∈ [y, y] := by simp + have d1 : DisjL (hndB u v) ([y, y] ++ Y₀) := h4.left + have d2 : DisjL X₀ ([y, y] ++ Y₀) := h4.right + have d3 : DisjL (hndB u v) Z := h5.left + have d4 : DisjL X₀ Z := h5.right + have d5 : DisjL [y, y] Z := h6.left + have d6 : DisjL Y₀ Z := h6.right + have n1 := d1 u hu + have n2 := d1 v hv + have huy : u.1 ≠ y.1 := (noLab_cons.mp n1).1.symm + have hvy : v.1 ≠ y.1 := (noLab_cons.mp n2).1.symm + have huY := (noLab_append.mp n1).2 + have hvY := (noLab_append.mp n2).2 + have hxy : DisjL X₀ [y, y] := d2.inl + have hyX : NoLab X₀ y.1 := hxy.symm y hyy + have c0 : WEq.{uu} (hndB u v ++ X₀ ++ ([y, y] ++ Y₀) ++ Z) (X₀ ++ hndB u v ++ [y, y] ++ + (Y₀ ++ Z)) := by + have := move_block.{uu} (P := []) (Q := X₀) (Z := [y, y] ++ Y₀ ++ Z) (.hnd u v huv) + (by simp [DisjL, NoLab]) + hX (DisjL.append_right d1 d3) + simpa using this + have hC : (∀ l ∈ hndB u v ++ [y, y], NoLab (Y₀ ++ Z ++ X₀) l.1) := by + intro l hl + rcases List.mem_append.mp hl with hl | hl + · exact noLab_append.mpr ⟨noLab_append.mpr ⟨(d1.inr) l hl, d3 l hl⟩, hX l hl⟩ + · exact noLab_append.mpr ⟨noLab_append.mpr ⟨hY l hl, d5 l hl⟩, hxy.symm l hl⟩ + have c1 : WEq.{uu} (X₀ ++ hndB u v ++ [y, y] ++ (Y₀ ++ Z)) ((Y₀ ++ Z ++ X₀) ++ hndB u v ++ + [y, y]) := + WEq.rot' (X₀ ++ hndB u v ++ [y, y]) (Y₀ ++ Z) (by simp) (by simp) + have c2 := weq_tp.{uu} (Y₀ ++ Z ++ X₀) huv huy hvy (hC u (by simp [hndB])) (hC v + (by simp [hndB])) + (hC y (by simp)) + set Y' := [linv v, linv v] ++ [u, u] ++ [y, y] ++ Y₀ with hY' + have c3 : WEq.{uu} ((Y₀ ++ Z ++ X₀) ++ [linv v, linv v] ++ [u, u] ++ [y, y]) (X₀ ++ Y' ++ Z) + := + WEq.rot' (Y₀ ++ Z) (X₀ ++ [linv v, linv v] ++ [u, u] ++ [y, y]) (by simp) (by simp [hY']) + have hNF : IsNF (X₀ ++ Y' ++ Z) a (b + 3) c := by + have hvu : v.1 ≠ u.1 := fun e => huv e.symm + have dv : ∀ {w : List Letter}, NoLab w v.1 → DisjL [linv v, linv v] w := fun h l hl => by + simp only [List.mem_cons, List.not_mem_nil, or_false, or_self] at hl + subst hl + exact h + have du : ∀ {w : List Letter}, NoLab w u.1 → DisjL [u, u] w := fun h l hl => by + simp only [List.mem_cons, List.not_mem_nil, or_false, or_self] at hl + subst hl + exact h + have dy : ∀ {w : List Letter}, NoLab w y.1 → DisjL [y, y] w := fun h l hl => by + simp only [List.mem_cons, List.not_mem_nil, or_false, or_self] at hl + subst hl + exact h + have hnX : NoLab X₀ u.1 := hX u hu + have hnX' : NoLab X₀ v.1 := hX v hv + have e1 : Y' = [linv v, linv v] ++ ([u, u] ++ ([y, y] ++ Y₀)) := by simp [hY'] + have cl3 : CL (b + 1) ([y, y] ++ Y₀) := .cons y hY h2 + have cl2 : CL (b + 2) ([u, u] ++ ([y, y] ++ Y₀)) := .cons u (du n1) cl3 + have cl1 : CL (b + 3) Y' := by + rw [e1] + refine .cons (linv v) (dv ?_) cl2 + exact noLab_cons.mpr ⟨huv, noLab_cons.mpr ⟨huv, n2⟩⟩ + have hs : ∀ c, cnt Y' c ≤ cnt (hndB u v ++ ([y, y] ++ Y₀)) c := fun c => by + rw [e1] + simp only [hndB, cnt_append, cnt_cons, show cnt [] c = 0 from rfl, linv] + omega + have d7 : DisjL X₀ (hndB u v ++ ([y, y] ++ Y₀)) := DisjL.append_right hX.symm d2 + have d8 : DisjL Z (hndB u v ++ ([y, y] ++ Y₀)) := DisjL.append_right d3.symm h6.symm + exact ⟨X₀, Y', Z, rfl, h1, cl1, h3, d7.mono hs, d4, (d8.mono hs).symm⟩ + exact c0.trans (c1.trans (c2.trans (c3.trans (nf_eq hNF h')))) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/WordMoves.lean b/LeanPool/GraphMinor/Surface/WordMoves.lean new file mode 100644 index 0000000000..065e38b91f --- /dev/null +++ b/LeanPool/GraphMinor/Surface/WordMoves.lean @@ -0,0 +1,853 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.PolyMoves + +/-! +# Moves on words + +`PEq W W'`: the families `W` and `W'` present the same Hausdorff spaces. Each move gives this +through a map of +discs: rotating a word (`peq_rot`), reversing it (`peq_rev`), renaming labels (`peq_rename`), +cutting a word along a +chord or gluing two words along a letter (`peq_cut`), and folding two adjacent letters (`peq_fold`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Filter Function + +universe u + +/-- Sides of `W'` go to sides of `W` with the same label, except labels in `Y`, where the two sides +have the +same image. All sides of `W` arise. -/ +theorem IsPolyMap.of_sides' {W W' : ℕ → List Letter} {θ : ℕ × ℂ → ℕ × ℂ} {Y Z : Set ℕ} + (cont : ContinuousOn θ (Dsk W')) (maps : MapsTo θ (Dsk W') (Dsk W)) (surj : Dsk W ⊆ θ '' Dsk W') + (fib : ∀ a ∈ Dsk W', ∀ b ∈ Dsk W', θ a = θ b → PRel W' a b) + (down : ∀ i p k ε, (W' i)[p]? = some (k, ε) → k ∉ Y → ∃ i' p' ε', (W i')[p']? = some (k, ε') ∧ + ∀ t ∈ Icc (0 : ℝ) 1, θ (i, sdPt (W' i).length p ε t) = (i', sdPt (W i').length p' ε' t)) + (up : ∀ i' p' k ε', (W i')[p']? = some (k, ε') → k ∉ Z → ∃ i p ε, (W' i)[p]? = some (k, ε) ∧ + ∀ t ∈ Icc (0 : ℝ) 1, θ (i, sdPt (W' i).length p ε t) = (i', sdPt (W i').length p' ε' t)) + (hZ : ∀ (i j p q k : ℕ) (ε ε' : Bool), k ∈ Z → (W i)[p]? = some (k, ε) → (W j)[q]? = some + (k, ε') → (i, p) = (j, q)) + (hY : ∀ i j p q k ε ε' t, k ∈ Y → (W' i)[p]? = some (k, ε) → (W' j)[q]? = some (k, ε') → + t ∈ Icc (0 : ℝ) 1 → θ (i, sdPt (W' i).length p ε t) = θ (j, sdPt (W' j).length q ε' t)) : + IsPolyMap W W' θ := by + have hmem : ∀ {W : ℕ → List Letter} {i p k ε} (t : ℝ), (W i)[p]? = some (k, ε) → + (i, sdPt (W i).length p ε t) ∈ Dsk W := fun t h => + ⟨fun he => by simp [he] at h, (norm_per _ _).le⟩ + refine ⟨cont, maps, surj, fib, ?_, ?_⟩ + · rintro _ _ ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ + have hk : k ∉ Z := fun hk => h3 (hZ i j p q k ε ε' hk h1 h2) + obtain ⟨i₁, p₁, ε₁, a1, a2⟩ := up i p k ε h1 hk + obtain ⟨i₂, p₂, ε₂, b1, b2⟩ := up j q k ε' h2 hk + refine ⟨_, hmem t a1, _, hmem t b1, a2 t ht, b2 t ht, ?_⟩ + by_cases he : (i₁, p₁) = (i₂, p₂) + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj he + rw [a1] at b1 + have : ε₁ = ε₂ := by simpa using b1 + subst this + exact .refl _ + · exact .rel _ _ ⟨i₁, i₂, p₁, p₂, k, ε₁, ε₂, t, a1, b1, he, ht, rfl, rfl⟩ + · rintro _ _ ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ + by_cases hk : k ∈ Y + · rw [hY i j p q k ε ε' t hk h1 h2 ht] + exact .refl _ + · obtain ⟨i₁, p₁, ε₁, a1, a2⟩ := down i p k ε h1 hk + obtain ⟨i₂, p₂, ε₂, b1, b2⟩ := down j q k ε' h2 hk + rw [a2 t ht, b2 t ht] + by_cases he : (i₁, p₁) = (i₂, p₂) + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj he + rw [a1] at b1 + have : ε₁ = ε₂ := by simpa using b1 + subst this + exact .refl _ + · exact .rel _ _ ⟨i₁, i₂, p₁, p₂, k, ε₁, ε₂, t, a1, b1, he, ht, rfl, rfl⟩ + +/-- `IsPolyMap.of_sides'` when all sides of `W` arise. -/ +theorem IsPolyMap.of_sides {W W' : ℕ → List Letter} {θ : ℕ × ℂ → ℕ × ℂ} {Y : Set ℕ} + (cont : ContinuousOn θ (Dsk W')) (maps : MapsTo θ (Dsk W') (Dsk W)) (surj : Dsk W ⊆ θ '' Dsk W') + (fib : ∀ a ∈ Dsk W', ∀ b ∈ Dsk W', θ a = θ b → PRel W' a b) + (down : ∀ i p k ε, (W' i)[p]? = some (k, ε) → k ∉ Y → ∃ i' p' ε', (W i')[p']? = some (k, ε') ∧ + ∀ t ∈ Icc (0 : ℝ) 1, θ (i, sdPt (W' i).length p ε t) = (i', sdPt (W i').length p' ε' t)) + (up : ∀ i' p' k ε', (W i')[p']? = some (k, ε') → ∃ i p ε, (W' i)[p]? = some (k, ε) ∧ + ∀ t ∈ Icc (0 : ℝ) 1, θ (i, sdPt (W' i).length p ε t) = (i', sdPt (W i').length p' ε' t)) + (hY : ∀ i j p q k ε ε' t, k ∈ Y → (W' i)[p]? = some (k, ε) → (W' j)[q]? = some (k, ε') → + t ∈ Icc (0 : ℝ) 1 → θ (i, sdPt (W' i).length p ε t) = θ (j, sdPt (W' j).length q ε' t)) : + IsPolyMap W W' θ := + IsPolyMap.of_sides' (Z := ∅) cont maps surj fib down (fun i' p' k ε' h _ => up i' p' k ε' h) + (fun _ _ _ _ _ _ _ h => absurd h (notMem_empty _)) hY + +/-- `W` and `W'` present the same Hausdorff spaces. -/ +def PEq (W W' : ℕ → List Letter) : Prop := + ∀ (T : Type u) [TopologicalSpace T] [T2Space T], + (∃ f : ℕ × ℂ → T, Presents W f) ↔ ∃ f : ℕ × ℂ → T, Presents W' f + +theorem PEq.refl (W : ℕ → List Letter) : PEq.{u} W W := fun _ _ _ => Iff.rfl + +theorem PEq.symm {W W' : ℕ → List Letter} (h : PEq.{u} W W') : PEq.{u} W' W := + fun T _ _ => (h T).symm + +theorem PEq.trans {W W' W'' : ℕ → List Letter} (h : PEq.{u} W W') (h' : PEq.{u} W' W'') : PEq.{u} W + W'' := + fun T _ _ => (h T).trans (h' T) + +theorem IsPolyMap.peq {W W' : ℕ → List Letter} {θ : ℕ × ℂ → ℕ × ℂ} (hθ : IsPolyMap W W' θ) + (hW' : {i | W' i ≠ []}.Finite) : PEq.{u} W W' := fun _T _ _ => + ⟨fun ⟨_, hf⟩ => ⟨_, hf.of_map hθ⟩, fun ⟨_, hf⟩ => hf.map hθ hW'⟩ + +/-- The families with finitely many words. -/ +def FinW (W : ℕ → List Letter) : Prop := {i | W i ≠ []}.Finite + +theorem FinW.update {W : ℕ → List Letter} (h : FinW W) (i : ℕ) (w : List Letter) : + FinW (Function.update W i w) := by + refine (h.union (finite_singleton i)).subset fun j hj => ?_ + by_cases he : j = i + · exact .inr he + · refine .inl ?_ + simpa [Function.update_of_ne he] using hj + +theorem per_mul (m : ℕ) (x y : ℝ) : per m x * per m y = per m (x + y) := by + simp only [per, cis'] + rw [← Complex.exp_add] + congr 1 + push_cast + ring + +theorem conj_per (m : ℕ) (x : ℝ) : (starRingEnd ℂ) (per m x) = per m (-x) := by + simp only [per, cis'] + rw [← Complex.exp_conj] + congr 1 + simp only [map_mul, Complex.conj_ofReal, Complex.conj_I] + push_cast + ring + +theorem update_ne {W : ℕ → List Letter} {i j : ℕ} {w : List Letter} (h : j ≠ i) : + Function.update W i w j = W j := Function.update_of_ne h _ _ + +section rot + +variable {W : ℕ → List Letter} {i : ℕ} {x : Letter} {u : List Letter} + +/-- Rotating a word by one letter. -/ +theorem isPolyMap_rot1 : + IsPolyMap (update W i (x :: u)) (update W i (u ++ [x])) + (fun a => if a.1 = i then (i, per (u.length + 1) 1 * a.2) else a) := by + set n := u.length + 1 with hn + have hn0 : n ≠ 0 := by omega + have hlen1 : (update W i (x :: u) i).length = n := by simp [hn] + have hlen2 : (update W i (u ++ [x]) i).length = n := by simp [hn] + refine IsPolyMap.of_sides (Y := ∅) ?_ ?_ ?_ ?_ ?_ ?_ ?_ + · rw [continuousOn_prod_of_discrete_left] + intro j + by_cases hj : j = i + · subst hj + simp only [ite_true] + exact (Continuous.prodMk continuous_const (continuous_const.mul continuous_id)).continuousOn + · simp only [ite_eq_right hj] + exact (Continuous.prodMk continuous_const continuous_id).continuousOn + · rintro ⟨j, z⟩ ⟨h1, h2⟩ + by_cases hj : j = i + · subst hj + simp only [ite_true] + refine ⟨by simp, ?_⟩ + simp only [norm_mul, norm_per, one_mul] + exact h2 + · simp only [ite_eq_right hj] + refine ⟨?_, h2⟩ + simpa [update_ne hj] using h1 + · rintro ⟨j, z⟩ ⟨h1, h2⟩ + by_cases hj : j = i + · subst hj + refine ⟨(j, per n (-1) * z), ⟨by simp, by simpa [norm_per] using h2⟩, ?_⟩ + simp only [ite_true] + rw [← mul_assoc, per_mul, add_neg_cancel] + simp [per, cis'] + · refine ⟨(j, z), ⟨by simpa [update_ne hj] using h1, h2⟩, ?_⟩ + simp [hj] + · rintro ⟨j, z⟩ ⟨-, h2⟩ ⟨j', z'⟩ ⟨-, h3⟩ he + have h1 : j = j' := by + by_cases hj : j = i <;> by_cases hj' : j' = i + · rw [hj, hj'] + · simp only [ite_eq_left hj, ite_eq_right hj', Prod.mk.injEq] at he + exact absurd he.1.symm hj' + · simp only [ite_eq_right hj, ite_eq_left hj', Prod.mk.injEq] at he + exact absurd he.1 hj + · simp only [ite_eq_right hj, ite_eq_right hj', Prod.mk.injEq] at he + exact he.1 + subst h1 + have h4 : z = z' := by + by_cases hj : j = i + · simp only [ite_eq_left hj, Prod.mk.injEq, true_and] at he + exact mul_left_cancel₀ (by + intro h0 + have := norm_per (u.length + 1) 1 + rw [h0] at this + simp at this) he + · simp only [ite_eq_right hj, Prod.mk.injEq] at he + exact he.2 + rw [h4] + exact .refl _ + · intro j p k ε h _ + by_cases hj : j = i + · subst hj + rw [update_self] at h + rw [hlen2] + by_cases hp : p < u.length + · refine ⟨j, p + 1, ε, ?_, fun t _ => ?_⟩ + · rw [update_self, List.getElem?_cons_succ] + rwa [List.getElem?_append_left hp] at h + · simp only [ite_true] + rw [hlen1] + simp only [sdPt, per_mul] + congr 2 + push_cast + ring + · have hp' : p = u.length := by + have := (List.getElem?_eq_some_iff.mp h).1 + simp at this + omega + subst hp' + rw [List.getElem?_append_right le_rfl] at h + simp only [Nat.sub_self] at h + refine ⟨j, 0, ε, ?_, fun t _ => ?_⟩ + · rw [update_self] + simpa using h + · simp only [ite_true] + rw [hlen1] + simp only [sdPt, per_mul] + rw [Prod.mk.injEq] + refine ⟨rfl, ?_⟩ + have := per_add_self hn0 (((0 : ℕ) : ℝ) + if ε then t else 1 - t) + rw [← this] + congr 1 + rw [hn] + push_cast + ring + · refine ⟨j, p, ε, by rw [update_ne hj] at h ⊢; exact h, fun t _ => ?_⟩ + simp only [ite_eq_right hj, update_ne hj] + · intro j p k ε h + by_cases hj : j = i + · subst hj + rw [update_self] at h + rw [hlen1] + cases p with + | zero => + refine ⟨j, u.length, ε, ?_, fun t _ => ?_⟩ + · rw [update_self, List.getElem?_append_right le_rfl] + simpa using h + · simp only [ite_true] + rw [hlen2] + simp only [sdPt, per_mul] + rw [Prod.mk.injEq] + refine ⟨rfl, ?_⟩ + have := per_add_self hn0 (((0 : ℕ) : ℝ) + if ε then t else 1 - t) + rw [← this] + congr 1 + rw [hn] + push_cast + ring + | succ p => + rw [List.getElem?_cons_succ] at h + have hp : p < u.length := (List.getElem?_eq_some_iff.mp h).1 + refine ⟨j, p, ε, ?_, fun t _ => ?_⟩ + · rw [update_self, List.getElem?_append_left hp] + exact h + · simp only [ite_true] + rw [hlen2] + simp only [sdPt, per_mul] + congr 2 + push_cast + ring + · refine ⟨j, p, ε, by rw [update_ne hj] at h ⊢; exact h, fun t _ => ?_⟩ + simp only [ite_eq_right hj, update_ne hj] + · intro _ _ _ _ _ _ _ _ h + exact absurd h (notMem_empty _) + +end rot + +/-- The inverse of a letter. -/ +def linv (l : Letter) : Letter := (l.1, !l.2) + +/-- The inverse of a word. -/ +def winv (w : List Letter) : List Letter := w.reverse.map linv + +theorem conj_sdPt {n p : ℕ} (hp : p < n) (ε : Bool) (t : ℝ) : + (starRingEnd ℂ) (sdPt n p ε t) = sdPt n (n - 1 - p) (!ε) t := by + have hn : n ≠ 0 := by omega + have h1 : ((n - 1 - p : ℕ) : ℝ) = n - 1 - p := by + rw [Nat.cast_sub (by omega), Nat.cast_sub (by omega)] + simp + rw [sdPt, conj_per, sdPt, ← per_add_self hn, h1] + congr 1 + cases ε <;> simp <;> ring + +section rev + +variable {W : ℕ → List Letter} {i : ℕ} {w : List Letter} + +/-- Reversing a word. -/ +theorem isPolyMap_rev : + IsPolyMap (update W i w) (update W i (winv w)) + (fun a => if a.1 = i then (i, (starRingEnd ℂ) a.2) else a) := by + have hlen : (winv w).length = w.length := by simp [winv] + have hne : winv w ≠ [] ↔ w ≠ [] := by simp [winv] + have hget : ∀ p, p < w.length → (winv w)[p]? = (w[w.length - 1 - p]?).map linv := fun p hp => by + rw [winv, List.getElem?_map, List.getElem?_reverse hp] + refine IsPolyMap.of_sides (Y := ∅) ?_ ?_ ?_ ?_ ?_ ?_ ?_ + · rw [continuousOn_prod_of_discrete_left] + intro j + by_cases hj : j = i + · subst hj + simp only [ite_true] + exact (Continuous.prodMk continuous_const Complex.continuous_conj).continuousOn + · simp only [ite_eq_right hj] + exact (Continuous.prodMk continuous_const continuous_id).continuousOn + · rintro ⟨j, z⟩ ⟨h1, h2⟩ + by_cases hj : j = i + · subst hj + simp only [ite_true] + refine ⟨by simpa [hne] using h1, by simpa using h2⟩ + · simp only [ite_eq_right hj] + refine ⟨?_, h2⟩ + simpa [update_ne hj] using h1 + · rintro ⟨j, z⟩ ⟨h1, h2⟩ + by_cases hj : j = i + · subst hj + refine ⟨(j, (starRingEnd ℂ) z), ⟨by simpa [hne] using h1, by simpa using h2⟩, ?_⟩ + simp + · refine ⟨(j, z), ⟨by simpa [update_ne hj] using h1, h2⟩, ?_⟩ + simp [hj] + · rintro ⟨j, z⟩ ⟨-, h2⟩ ⟨j', z'⟩ ⟨-, h3⟩ he + have h1 : j = j' := by + by_cases hj : j = i <;> by_cases hj' : j' = i + · rw [hj, hj'] + · simp only [ite_eq_left hj, ite_eq_right hj', Prod.mk.injEq] at he + exact absurd he.1.symm hj' + · simp only [ite_eq_right hj, ite_eq_left hj', Prod.mk.injEq] at he + exact absurd he.1 hj + · simp only [ite_eq_right hj, ite_eq_right hj', Prod.mk.injEq] at he + exact he.1 + subst h1 + have h4 : z = z' := by + by_cases hj : j = i + · simp only [ite_eq_left hj, Prod.mk.injEq, true_and] at he + exact (starRingEnd ℂ).injective he + · simp only [ite_eq_right hj, Prod.mk.injEq] at he + exact he.2 + rw [h4] + exact .refl _ + · intro j p k ε h _ + by_cases hj : j = i + · subst hj + rw [update_self] at h + have hp : p < w.length := hlen ▸ (List.getElem?_eq_some_iff.mp h).1 + rw [hget p hp] at h + obtain ⟨l, hl, hl'⟩ := Option.map_eq_some_iff.mp h + refine ⟨j, w.length - 1 - p, !ε, ?_, fun t _ => ?_⟩ + · rw [update_self, hl] + obtain ⟨a, b⟩ := l + simp only [linv, Prod.mk.injEq] at hl' + simp [← hl'.1, ← hl'.2] + · simp only [ite_true, update_self, hlen, conj_sdPt hp] + · refine ⟨j, p, ε, by rw [update_ne hj] at h ⊢; exact h, fun t _ => ?_⟩ + simp only [ite_eq_right hj, update_ne hj] + · intro j p k ε h + by_cases hj : j = i + · subst hj + rw [update_self] at h + have hp : p < w.length := (List.getElem?_eq_some_iff.mp h).1 + have hq : w.length - 1 - p < w.length := by omega + have hq' : w.length - 1 - (w.length - 1 - p) = p := by omega + refine ⟨j, w.length - 1 - p, !ε, ?_, fun t _ => ?_⟩ + · rw [update_self, hget _ hq, hq', h] + simp [linv] + · simp only [ite_true, update_self, hlen] + rw [conj_sdPt hq, hq'] + simp + · refine ⟨j, p, ε, by rw [update_ne hj] at h ⊢; exact h, fun t _ => ?_⟩ + simp only [ite_eq_right hj, update_ne hj] + · intro _ _ _ _ _ _ _ _ h + exact absurd h (notMem_empty _) + +end rev + +/-- The label `y` does not occur in `W`. -/ +def FreshIn (W : ℕ → List Letter) (y : ℕ) : Prop := ∀ i, ∀ l ∈ W i, l.1 ≠ y + +section cut + +variable {W : ℕ → List Letter} {i j : ℕ} {u v : List Letter} {y : ℕ} + +/-- The values of the map of discs of a cut, on the sides. -/ +theorem up_side {a l : ℕ} (ha : 0 < a) {p : ℕ} (_hp : p < l) (ε : Bool) {t : ℝ} (ht : t ∈ Icc + (0 : ℝ) 1) : + upLoop a l (a + p + if ε then t else 1 - t) = cis' (Real.pi * (p + if ε then t else 1 - t) / l) + := by + have hs : 0 ≤ if ε then t else 1 - t := by + cases ε + · simp [ht.2] + · simp [ht.1] + rw [upLoop_ge ha (by have : (0 : ℝ) ≤ p := Nat.cast_nonneg p + linarith)] + congr 2 + ring + +/-- The value of a side parameter. -/ +noncomputable def sv (ε : Bool) (t : ℝ) : ℝ := if ε then t else 1 - t + +theorem sv_mem (ε : Bool) {t : ℝ} (ht : t ∈ Icc (0 : ℝ) 1) : sv ε t ∈ Icc (0 : ℝ) 1 := by + cases ε + · simp only [sv, Bool.false_eq_true, ite_false] + exact ⟨by linarith [ht.2], by linarith [ht.1]⟩ + · simpa [sv] using ht + +theorem cis'_neg_eq (θ : ℝ) : - cis' θ = cis' (θ - Real.pi) := by + have := cis'_add_pi (θ - Real.pi) + rw [sub_add_cancel] at this + rw [this, neg_neg] + +private theorem cut_side_parameters {k l : ℕ} (hl0 : 0 < l) (e : Bool) + {Φ₁ Φ₂ Ψ Ψ' : ℂ → ℂ} + (v₁ : ∀ x ∈ Icc (0 : ℝ) (k + 1 : ℕ), Φ₁ (per (k + 1) x) = upLoop 1 k x) + (v₂ : ∀ x ∈ Icc (0 : ℝ) (l + 1 : ℕ), Φ₂ (per (l + 1) x) = upLoop 1 l x) + (vΨ : ∀ x ∈ Icc (0 : ℝ) (l + k : ℕ), Ψ (per (l + k) x) = circLoop l k x) + (m3 : LeftInvOn Ψ' Ψ (closedBall 0 1)) : + (∀ p ε t, p < k → t ∈ Icc (0 : ℝ) 1 → + Ψ' (-Φ₁ (sdPt (k + 1) (p + 1) ε t)) = sdPt (l + k) (l + p) ε t) ∧ + (∀ p ε t, p < l → t ∈ Icc (0 : ℝ) 1 → + Ψ' (Φ₂ (sdPt (l + 1) (p + 1) ε t)) = sdPt (l + k) p ε t) ∧ + (∀ t ∈ Icc (0 : ℝ) 1, -Φ₁ (sdPt (k + 1) 0 e t) = ((1 - 2 * sv e t : ℝ) : ℂ)) ∧ + (∀ t ∈ Icc (0 : ℝ) 1, Φ₂ (sdPt (l + 1) 0 (!e) t) = ((1 - 2 * sv e t : ℝ) : ℂ)) := by + have hsub : ∀ {l : ℕ} {p : ℕ}, p < l → ∀ {s : ℝ}, s ∈ Icc (0 : ℝ) 1 → + ((p + 1 : ℕ) : ℝ) + s ∈ Icc (0 : ℝ) ((l + 1 : ℕ) : ℝ) := fun {l p} hp {s} hs => by + have h1 : ((p + 1 : ℕ) : ℝ) ≤ l := by exact_mod_cast hp + constructor + · have : (0 : ℝ) ≤ ((p + 1 : ℕ) : ℝ) := Nat.cast_nonneg _ + linarith [hs.1] + · push_cast at h1 ⊢ + linarith [hs.2] + have s₁ : ∀ p ε t, p < k → t ∈ Icc (0 : ℝ) 1 → + Ψ' (-Φ₁ (sdPt (k + 1) (p + 1) ε t)) = sdPt (l + k) (l + p) ε t := by + intro p ε t hp ht + have hs := sv_mem ε ht + have h1 := v₁ _ (hsub hp hs) + have h2 := up_side (a := 1) (l := k) one_pos hp ε ht + have h3 : Ψ (sdPt (l + k) (l + p) ε t) = -Φ₁ (sdPt (k + 1) (p + 1) ε t) := by + have h4 : ((l + p : ℕ) : ℝ) + sv ε t ∈ Icc (0 : ℝ) ((l + k : ℕ) : ℝ) := by + have h5 : ((p + 1 : ℕ) : ℝ) ≤ k := by exact_mod_cast hp + push_cast at h5 ⊢ + have : (0 : ℝ) ≤ l := Nat.cast_nonneg _ + have : (0 : ℝ) ≤ p := Nat.cast_nonneg _ + exact ⟨by linarith [hs.1], by linarith [hs.2]⟩ + have h6 := vΨ _ h4 + have h7 : sdPt (k + 1) (p + 1) ε t = per (k + 1) (((p + 1 : ℕ) : ℝ) + sv ε t) := rfl + rw [h7, h1] + have h8 : sdPt (l + k) (l + p) ε t = per (l + k) (((l + p : ℕ) : ℝ) + sv ε t) := rfl + rw [h8, h6, circLoop_ge hl0 (by + push_cast + have : (0 : ℝ) ≤ p := Nat.cast_nonneg _ + linarith [hs.1])] + have h9 : upLoop 1 k (((p + 1 : ℕ) : ℝ) + sv ε t) = cis' (Real.pi * (p + sv ε t) / k) := by + have e : ((p + 1 : ℕ) : ℝ) + sv ε t = ((1 : ℕ) : ℝ) + p + if ε then t else 1 - t := by + unfold sv + push_cast + ring + rw [e, h2] + rfl + rw [h9, cis'_neg_eq] + congr 2 + push_cast + ring + rw [← h3] + exact m3 (mem_closedBall_zero_iff.mpr (norm_per _ _).le) + have s₂ : ∀ p ε t, p < l → t ∈ Icc (0 : ℝ) 1 → + Ψ' (Φ₂ (sdPt (l + 1) (p + 1) ε t)) = sdPt (l + k) p ε t := by + intro p ε t hp ht + have hs := sv_mem ε ht + have h1 := v₂ _ (hsub hp hs) + have h2 := up_side (a := 1) (l := l) one_pos hp ε ht + have h3 : Ψ (sdPt (l + k) p ε t) = Φ₂ (sdPt (l + 1) (p + 1) ε t) := by + have h5 : ((p + 1 : ℕ) : ℝ) ≤ l := by exact_mod_cast hp + have h4 : (p : ℝ) + sv ε t ∈ Icc (0 : ℝ) ((l + k : ℕ) : ℝ) := by + push_cast at h5 ⊢ + have : (0 : ℝ) ≤ k := Nat.cast_nonneg _ + have : (0 : ℝ) ≤ p := Nat.cast_nonneg _ + exact ⟨by linarith [hs.1], by linarith [hs.2]⟩ + have h6 := vΨ _ h4 + have h7 : sdPt (l + 1) (p + 1) ε t = per (l + 1) (((p + 1 : ℕ) : ℝ) + sv ε t) := rfl + rw [h7, h1] + have h8 : sdPt (l + k) p ε t = per (l + k) ((p : ℝ) + sv ε t) := rfl + rw [h8, h6, circLoop_le (by push_cast at h5; linarith [hs.2])] + have h9 : upLoop 1 l (((p + 1 : ℕ) : ℝ) + sv ε t) = cis' (Real.pi * (p + sv ε t) / l) := by + have e : ((p + 1 : ℕ) : ℝ) + sv ε t = ((1 : ℕ) : ℝ) + p + if ε then t else 1 - t := by + unfold sv + push_cast + ring + rw [e, h2] + rfl + rw [h9] + rw [← h3] + exact m3 (mem_closedBall_zero_iff.mpr (norm_per _ _).le) + have hv₁ : ∀ t ∈ Icc (0 : ℝ) 1, -Φ₁ (sdPt (k + 1) 0 e t) = ((1 - 2 * sv e t : ℝ) : ℂ) := by + intro t ht + have hs := sv_mem e ht + have h1 : sdPt (k + 1) 0 e t = per (k + 1) (sv e t) := by simp [sdPt, sv] + rw [h1, v₁ _ ⟨hs.1, by push_cast; linarith [hs.2, (Nat.cast_nonneg k : (0 : ℝ) ≤ k)]⟩, + upLoop_le (by simpa using hs.2)] + push_cast + ring + have hv₂ : ∀ t ∈ Icc (0 : ℝ) 1, Φ₂ (sdPt (l + 1) 0 (!e) t) = ((1 - 2 * sv e t : ℝ) : ℂ) := by + intro t ht + have hs := sv_mem e ht + have h1 : sdPt (l + 1) 0 (!e) t = per (l + 1) (1 - sv e t) := by + cases e <;> simp [sdPt, sv] + rw [h1, v₂ (1 - sv e t) ⟨by linarith [hs.2], by + push_cast + linarith [hs.1, (Nat.cast_nonneg l : (0 : ℝ) ≤ l)]⟩, upLoop_le (by simpa using hs.1)] + push_cast + ring + exact ⟨s₁, s₂, hv₁, hv₂⟩ + +private theorem cut_cross_face_relation {W1 : ℕ → List Letter} {k l : ℕ} + (e : Bool) (hij : j ≠ i) (e1 : W1 i = (y, e) :: u) (e2 : W1 j = (y, !e) :: v) + (hlen1 : (W1 i).length = k + 1) (hlen2 : (W1 j).length = l + 1) + {Φ₁ Φ₂ Ψ' : ℂ → ℂ} + (hDΦ₁ : ∀ z ∈ closedBall (0 : ℂ) 1, -Φ₁ z ∈ closedBall (0 : ℂ) 1 ∧ (-Φ₁ z).im ≤ 0) + (hDΦ₂ : ∀ z ∈ closedBall (0 : ℂ) 1, Φ₂ z ∈ closedBall (0 : ℂ) 1 ∧ 0 ≤ (Φ₂ z).im) + (hinj₁ : InjOn Φ₁ (closedBall (0 : ℂ) 1)) + (hinj₂ : InjOn Φ₂ (closedBall (0 : ℂ) 1)) + (hinjΨ : InjOn Ψ' (closedBall (0 : ℂ) 1)) + (hv₁ : ∀ t ∈ Icc (0 : ℝ) 1, -Φ₁ (sdPt (k + 1) 0 e t) = ((1 - 2 * sv e t : ℝ) : ℂ)) + (hv₂ : ∀ t ∈ Icc (0 : ℝ) 1, Φ₂ (sdPt (l + 1) 0 (!e) t) = ((1 - 2 * sv e t : ℝ) : ℂ)) + {z z' : ℂ} (hz : z ∈ closedBall (0 : ℂ) 1) (hz' : z' ∈ closedBall (0 : ℂ) 1) + (he : Ψ' (-Φ₁ z) = Ψ' (Φ₂ z')) : PRel W1 (i, z) (j, z') := by + have h1 := hinjΨ (hDΦ₁ z hz).1 (hDΦ₂ z' hz').1 he + have h2 := (hDΦ₁ z hz).2 + have h3 := (hDΦ₂ z' hz').2 + rw [h1] at h2 + have h4 : (Φ₂ z').im = 0 := le_antisymm h2 h3 + have h5 : ‖Φ₂ z'‖ ≤ 1 := mem_closedBall_zero_iff.mp (hDΦ₂ z' hz').1 + have h6 : |(Φ₂ z').re| ≤ 1 := (Complex.abs_re_le_norm _).trans h5 + obtain ⟨h7, h8⟩ := abs_le.mp h6 + have hs0 : (1 - (Φ₂ z').re) / 2 ∈ Icc (0 : ℝ) 1 := ⟨by linarith, by linarith⟩ + let t : ℝ := sv e ((1 - (Φ₂ z').re) / 2) + have ht : t ∈ Icc (0 : ℝ) 1 := sv_mem e hs0 + have hst : sv e t = (1 - (Φ₂ z').re) / 2 := by + simp only [t] + cases e <;> simp [sv] + have h9 : Φ₂ z' = ((1 - 2 * sv e t : ℝ) : ℂ) := by + apply Complex.ext + · rw [hst, Complex.ofReal_re] + ring + · simp [h4] + have ha : z = sdPt (k + 1) 0 e t := by + refine hinj₁ hz (mem_closedBall_zero_iff.mpr (norm_per _ _).le) ?_ + have := hv₁ t ht + rw [← neg_inj, this, h1, h9] + have hb : z' = sdPt (l + 1) 0 (!e) t := by + refine hinj₂ hz' (mem_closedBall_zero_iff.mpr (norm_per _ _).le) ?_ + rw [hv₂ t ht, h9] + refine .rel _ _ ⟨i, j, 0, 0, y, e, !e, t, by rw [e1]; rfl, by rw [e2]; rfl, + fun he' => hij (Prod.mk.inj he').1.symm, ht, ?_, ?_⟩ + · rw [hlen1, ha] + · rw [hlen2, hb] + +private theorem cut_uncut_side_correspondence + {W0 W1 : ℕ → List Letter} (e : Bool) (hWj : W j = []) + (e1 : W1 i = (y, e) :: u) (e2 : W1 j = (y, !e) :: v) + (e3 : ∀ s, s ≠ i → s ≠ j → W1 s = W s) + (e4 : W0 i = v ++ u) (e5 : ∀ s, s ≠ i → W0 s = W s) + {θ : ℕ × ℂ → ℕ × ℂ} : + let k := u.length + let l := v.length + (∀ p ε t, p < k → t ∈ Icc (0 : ℝ) 1 → + θ (i, sdPt (k + 1) (p + 1) ε t) = (i, sdPt (l + k) (l + p) ε t)) → + (∀ p ε t, p < l → t ∈ Icc (0 : ℝ) 1 → + θ (j, sdPt (l + 1) (p + 1) ε t) = (i, sdPt (l + k) p ε t)) → + (∀ s z, s ≠ i → s ≠ j → θ (s, z) = (s, z)) → + (∀ s p c ε, (W1 s)[p]? = some (c, ε) → c ∉ ({y} : Set ℕ) → ∃ i' p', (W0 i')[p']? = some (c, ε) ∧ + ∀ t ∈ Icc (0 : ℝ) 1, θ (s, sdPt (W1 s).length p ε t) = (i', sdPt (W0 i').length p' ε t)) ∧ + (∀ i' p' c ε, (W0 i')[p']? = some (c, ε) → ∃ s p, (W1 s)[p]? = some (c, ε) ∧ + ∀ t ∈ Icc (0 : ℝ) 1, θ (s, sdPt (W1 s).length p ε t) = (i', sdPt (W0 i').length p' ε t)) := by + intro k l s₁ s₂ θo + have hlen0 : (W0 i).length = l + k := by rw [e4, List.length_append] + have hlen1 : (W1 i).length = k + 1 := by rw [e1, List.length_cons] + have hlen2 : (W1 j).length = l + 1 := by rw [e2, List.length_cons] + have hdown : ∀ s p c ε, (W1 s)[p]? = some (c, ε) → c ∉ ({y} : Set ℕ) → ∃ i' p', (W0 i')[p']? + = some (c, ε) ∧ + ∀ t ∈ Icc (0 : ℝ) 1, θ (s, sdPt (W1 s).length p ε t) = (i', sdPt (W0 i').length p' ε t) := by + intro s p c ε h hc + by_cases h1 : s = i + · subst h1 + rw [e1] at h + cases p with + | zero => + have : (y, e) = (c, ε) := by simpa using h + exact absurd (Prod.mk.inj this).1.symm hc + | succ p => + rw [List.getElem?_cons_succ] at h + have hp : p < k := (List.getElem?_eq_some_iff.mp h).1 + refine ⟨s, l + p, ?_, fun t ht => ?_⟩ + · rw [e4, List.getElem?_append_right (by omega)] + simpa [l] using h + · rw [hlen1, hlen0, s₁ p ε t hp ht] + by_cases h2 : s = j + · subst h2 + rw [e2] at h + cases p with + | zero => + have : (y, !e) = (c, ε) := by simpa using h + exact absurd (Prod.mk.inj this).1.symm hc + | succ p => + rw [List.getElem?_cons_succ] at h + have hp : p < l := (List.getElem?_eq_some_iff.mp h).1 + refine ⟨i, p, ?_, fun t ht => ?_⟩ + · rw [e4, List.getElem?_append_left hp] + exact h + · rw [hlen2, hlen0, s₂ p ε t hp ht] + · refine ⟨s, p, by rwa [e5 s h1, ← e3 s h1 h2], fun t _ => ?_⟩ + rw [θo _ _ h1 h2, e3 s h1 h2, e5 s h1] + have hup : ∀ i' p' c ε, (W0 i')[p']? = some (c, ε) → ∃ s p, (W1 s)[p]? = some (c, ε) ∧ + ∀ t ∈ Icc (0 : ℝ) 1, θ (s, sdPt (W1 s).length p ε t) = (i', sdPt (W0 i').length p' ε t) := by + intro s p c ε h + by_cases h1 : s = i + · subst h1 + rw [e4] at h + rw [hlen0] + by_cases hp : p < l + · refine ⟨j, p + 1, ?_, fun t ht => ?_⟩ + · rw [e2, List.getElem?_cons_succ] + rwa [List.getElem?_append_left hp] at h + · rw [hlen2, s₂ p ε t hp ht] + · have hp' : l ≤ p := not_lt.mp hp + obtain ⟨q, rfl⟩ := Nat.exists_eq_add_of_le hp' + rw [List.getElem?_append_right (by omega)] at h + have h2 : u[q]? = some (c, ε) := by simpa [l] using h + have hq : q < k := (List.getElem?_eq_some_iff.mp h2).1 + refine ⟨s, q + 1, ?_, fun t ht => ?_⟩ + · rw [e1, List.getElem?_cons_succ] + exact h2 + · rw [hlen1, s₁ q ε t hq ht] + by_cases h2 : s = j + · subst h2 + rw [e5 s h1, hWj] at h + simp at h + · refine ⟨s, p, by rwa [e3 s h1 h2, ← e5 s h1], fun t _ => ?_⟩ + rw [θo _ _ h1 h2, e3 s h1 h2, e5 s h1] + exact ⟨hdown, hup⟩ + +/-- Cutting a word along a chord, or gluing two words along a letter. -/ +theorem exists_isPolyMap_cut (e : Bool) (hij : j ≠ i) (hWj : W j = []) (hu : u ≠ []) (hv : v ≠ []) + (hy : FreshIn (update W i (v ++ u)) y) : + ∃ θ, IsPolyMap (update W i (v ++ u)) (update (update W i ((y, e) :: u)) j ((y, !e) :: v)) θ ∧ + (∀ s p c ε, (update (update W i ((y, e) :: u)) j ((y, !e) :: v) s)[p]? = some (c, ε) → c ∉ + ({y} : Set ℕ) → + ∃ i' p', (update W i (v ++ u) i')[p']? = some (c, ε) ∧ ∀ t ∈ Icc (0 : ℝ) 1, + θ (s, sdPt (update (update W i ((y, e) :: u)) j ((y, !e) :: v) s).length p ε t) = + (i', sdPt (update W i (v ++ u) i').length p' ε t)) ∧ + (∀ i' p' c ε, (update W i (v ++ u) i')[p']? = some (c, ε) → + ∃ s p, (update (update W i ((y, e) :: u)) j ((y, !e) :: v) s)[p]? = some (c, ε) ∧ ∀ t ∈ Icc + (0 : ℝ) 1, + θ (s, sdPt (update (update W i ((y, e) :: u)) j ((y, !e) :: v) s).length p ε t) = + (i', sdPt (update W i (v ++ u) i').length p' ε t)) := by + classical + set k := u.length with hk + set l := v.length with hl + have hk0 : 0 < k := List.length_pos_iff.mpr hu + have hl0 : 0 < l := List.length_pos_iff.mpr hv + obtain ⟨Φ₁, Φ₁', m₁, v₁⟩ := exists_up_map (a := 1) (l := k) one_pos hk0 + obtain ⟨Φ₂, Φ₂', m₂, v₂⟩ := exists_up_map (a := 1) (l := l) one_pos hl0 + obtain ⟨Ψ, Ψ', m, vΨ⟩ := exists_circ_map (l := l) (k := k) hl0 hk0 + rw [Nat.add_comm 1 k] at v₁ + rw [Nat.add_comm 1 l] at v₂ + set W0 := update W i (v ++ u) with hW0 + set W1 := update (update W i ((y, e) :: u)) j ((y, !e) :: v) with hW1 + have e1 : W1 i = (y, e) :: u := by + rw [hW1, update_of_ne hij.symm, update_self] + have e2 : W1 j = (y, !e) :: v := by rw [hW1, update_self] + have e3 : ∀ s, s ≠ i → s ≠ j → W1 s = W s := fun s h1 h2 => by + rw [hW1, update_of_ne h2, update_of_ne h1] + have e4 : W0 i = v ++ u := by rw [hW0, update_self] + have e5 : ∀ s, s ≠ i → W0 s = W s := fun s h => by rw [hW0, update_of_ne h] + have hyu : ∀ l' ∈ u, l'.1 ≠ y := fun l' h => hy i l' (by rw [e4]; exact List.mem_append_right _ h) + have hyv : ∀ l' ∈ v, l'.1 ≠ y := fun l' h => hy i l' (by rw [e4]; exact List.mem_append_left _ h) + have hlen0 : (W0 i).length = l + k := by rw [e4, List.length_append] + have hlen1 : (W1 i).length = k + 1 := by rw [e1, List.length_cons] + have hlen2 : (W1 j).length = l + 1 := by rw [e2, List.length_cons] + have hDΦ₁ : ∀ z ∈ closedBall (0 : ℂ) 1, -Φ₁ z ∈ closedBall (0 : ℂ) 1 ∧ (-Φ₁ z).im ≤ 0 := fun z hz + => by + obtain ⟨h1, h2⟩ := m₁.1 hz + refine ⟨by simpa using h1, ?_⟩ + simp only [one_mul] at h2 + simpa using h2 + have hDΦ₂ : ∀ z ∈ closedBall (0 : ℂ) 1, Φ₂ z ∈ closedBall (0 : ℂ) 1 ∧ 0 ≤ (Φ₂ z).im := fun z hz + => by + obtain ⟨h1, h2⟩ := m₂.1 hz + refine ⟨by simpa using h1, ?_⟩ + simpa using h2 + obtain ⟨m1, m2, m3, m4, m5, m6⟩ := id m + obtain ⟨s₁, s₂, hv₁, hv₂⟩ := cut_side_parameters (Ψ' := Ψ') hl0 e v₁ v₂ vΨ m3 + let θ : ℕ × ℂ → ℕ × ℂ := fun a => + if a.1 = i then (i, Ψ' (-Φ₁ a.2)) else if a.1 = j then (i, Ψ' (Φ₂ a.2)) else a + have θi : ∀ z, θ (i, z) = (i, Ψ' (-Φ₁ z)) := fun z => by simp [θ] + have θj : ∀ z, θ (j, z) = (i, Ψ' (Φ₂ z)) := fun z => by simp [θ, hij] + have θo : ∀ s z, s ≠ i → s ≠ j → θ (s, z) = (s, z) := fun s z h1 h2 => by simp [θ, h1, h2] + have hball : ∀ {V : ℕ → List Letter} {s : ℕ} {z : ℂ}, (s, z) ∈ Dsk V → z ∈ closedBall (0 : ℂ) 1 := + fun h => mem_closedBall_zero_iff.mpr h.2 + have hne0 : W0 i ≠ [] := by + rw [e4] + simp [hu] + have hinj₁ : ∀ {z z'}, z ∈ closedBall (0 : ℂ) 1 → z' ∈ closedBall (0 : ℂ) 1 → Φ₁ z = Φ₁ z' → z + = z' := + fun hz hz' he => by rw [← m₁.2.2.1 hz, ← m₁.2.2.1 hz', he] + have hinj₂ : ∀ {z z'}, z ∈ closedBall (0 : ℂ) 1 → z' ∈ closedBall (0 : ℂ) 1 → Φ₂ z = Φ₂ z' → z + = z' := + fun hz hz' he => by rw [← m₂.2.2.1 hz, ← m₂.2.2.1 hz', he] + have hinjΨ : ∀ {z z'}, z ∈ closedBall (0 : ℂ) 1 → z' ∈ closedBall (0 : ℂ) 1 → Ψ' z = Ψ' z' → z + = z' := + fun hz hz' he => by rw [← m4 hz, ← m4 hz', he] + have hmix : ∀ z z', z ∈ closedBall (0 : ℂ) 1 → z' ∈ closedBall (0 : ℂ) 1 → + Ψ' (-Φ₁ z) = Ψ' (Φ₂ z') → PRel W1 (i, z) (j, z') := + fun _ _ => cut_cross_face_relation e hij e1 e2 hlen1 hlen2 hDΦ₁ hDΦ₂ + (fun {_} hz {_} hz' h => hinj₁ hz hz' h) (fun {_} hz {_} hz' h => hinj₂ hz hz' h) + (fun {_} hz {_} hz' h => hinjΨ hz hz' h) hv₁ hv₂ + obtain ⟨hdown, hup⟩ := cut_uncut_side_correspondence e hWj e1 e2 e3 e4 e5 + (fun p ε t hp ht => by rw [θi, s₁ p ε t hp ht]) + (fun p ε t hp ht => by rw [θj, s₂ p ε t hp ht]) θo + refine ⟨θ, IsPolyMap.of_sides (Y := {y}) ?_ ?_ ?_ ?_ (fun s p c ε h hc => ?_) (fun i' p' c ε h + => ?_) ?_, hdown, hup⟩ + · rw [continuousOn_prod_of_discrete_left] + intro s + by_cases h1 : s = i + · subst h1 + have hs : (fun z => θ (s, z)) = fun z => (s, Ψ' (-Φ₁ z)) := funext θi + rw [hs] + refine continuousOn_const.prodMk (m6.comp (m₁.2.2.2.2.1.neg.mono fun z hz => hball hz) ?_) + exact fun z hz => (hDΦ₁ z (hball hz)).1 + by_cases h2 : s = j + · subst h2 + have hs : (fun z => θ (s, z)) = fun z => (i, Ψ' (Φ₂ z)) := funext θj + rw [hs] + refine continuousOn_const.prodMk (m6.comp (m₂.2.2.2.2.1.mono fun z hz => hball hz) ?_) + exact fun z hz => (hDΦ₂ z (hball hz)).1 + · have hs : (fun z => θ (s, z)) = fun z => (s, z) := funext fun z => θo s z h1 h2 + rw [hs] + exact (Continuous.prodMk continuous_const continuous_id).continuousOn + · rintro ⟨s, z⟩ hz + by_cases h1 : s = i + · subst h1 + rw [θi] + exact ⟨hne0, mem_closedBall_zero_iff.mp (m2 (hDΦ₁ z (hball hz)).1)⟩ + by_cases h2 : s = j + · subst h2 + rw [θj] + exact ⟨hne0, mem_closedBall_zero_iff.mp (m2 (hDΦ₂ z (hball hz)).1)⟩ + · rw [θo s z h1 h2] + refine ⟨?_, hz.2⟩ + have := hz.1 + rwa [e3 s h1 h2, ← e5 s h1] at this + · rintro ⟨s, z⟩ hz + by_cases h1 : s = i + · subst h1 + have h3 : Ψ z ∈ closedBall (0 : ℂ) 1 := m1 (hball hz) + rcases le_total (Ψ z).im 0 with h4 | h4 + · have h5 : - Ψ z ∈ halfD 1 := ⟨by simpa using mem_closedBall_zero_iff.mp h3, by simpa using + h4⟩ + refine ⟨(s, Φ₁' (- Ψ z)), ⟨by rw [e1]; simp, mem_closedBall_zero_iff.mp (m₁.2.1 h5)⟩, ?_⟩ + rw [θi, m₁.2.2.2.1 h5, neg_neg, m3 (hball hz)] + · have h5 : Ψ z ∈ halfD 1 := ⟨mem_closedBall_zero_iff.mp h3, by simpa using h4⟩ + refine ⟨(j, Φ₂' (Ψ z)), ⟨by rw [e2]; simp, mem_closedBall_zero_iff.mp (m₂.2.1 h5)⟩, ?_⟩ + rw [θj, m₂.2.2.2.1 h5, m3 (hball hz)] + by_cases h2 : s = j + · subst h2 + exact absurd (by rw [e5 s h1]; exact hWj) hz.1 + · refine ⟨(s, z), ⟨?_, hz.2⟩, θo s z h1 h2⟩ + have := hz.1 + rwa [e5 s h1, ← e3 s h1 h2] at this + · rintro ⟨s, z⟩ hz ⟨s', z'⟩ hz' he + by_cases h1 : s = i <;> by_cases h2 : s = j <;> by_cases h3 : s' = i <;> by_cases h4 : s' = j + all_goals try (exfalso; subst_vars; exact hij rfl) + · subst h1 h3 + rw [θi, θi] at he + have := hinj₁ (hball hz) (hball hz') (neg_injective (hinjΨ (hDΦ₁ _ (hball hz)).1 (hDΦ₁ _ + (hball hz')).1 + (Prod.mk.inj he).2)) + rw [this] + exact .refl _ + · subst h1 h4 + rw [θi, θj] at he + exact hmix _ _ (hball hz) (hball hz') (Prod.mk.inj he).2 + · subst h1 + rw [θi, θo s' z' h3 h4] at he + exact absurd (Prod.mk.inj he).1.symm h3 + · subst h2 h3 + rw [θj, θi] at he + exact (hmix _ _ (hball hz') (hball hz) (Prod.mk.inj he).2.symm).symm + · subst h2 h4 + rw [θj, θj] at he + have := hinj₂ (hball hz) (hball hz') (hinjΨ (hDΦ₂ _ (hball hz)).1 (hDΦ₂ _ (hball hz')).1 + (Prod.mk.inj he).2) + rw [this] + exact .refl _ + · subst h2 + rw [θj, θo s' z' h3 h4] at he + exact absurd (Prod.mk.inj he).1.symm h3 + · subst h3 + rw [θo s z h1 h2, θi] at he + exact absurd (Prod.mk.inj he).1 h1 + · subst h4 + rw [θo s z h1 h2, θj] at he + exact absurd (Prod.mk.inj he).1 h1 + · rw [θo s z h1 h2, θo s' z' h3 h4] at he + rw [he] + exact .refl _ + · obtain ⟨a, b, h1, h2⟩ := hdown s p c ε h hc + exact ⟨a, b, ε, h1, h2⟩ + · obtain ⟨a, b, h1, h2⟩ := hup i' p' c ε h + exact ⟨a, b, ε, h1, h2⟩ + · have hside : ∀ s q ε, (W1 s)[q]? = some (y, ε) → ∀ t ∈ Icc (0 : ℝ) 1, + θ (s, sdPt (W1 s).length q ε t) = (i, Ψ' ((1 - 2 * sv e t : ℝ) : ℂ)) := by + intro s q ε h t ht + by_cases h1 : s = i + · subst h1 + rw [e1] at h + cases q with + | zero => + have : ε = e := by simpa using h.symm + subst this + rw [θi, hlen1, hv₁ t ht] + | succ q => + rw [List.getElem?_cons_succ] at h + exact absurd rfl (hyu _ (List.mem_of_getElem? h)) + by_cases h2 : s = j + · subst h2 + rw [e2] at h + cases q with + | zero => + have : ε = !e := by simpa using h.symm + subst this + rw [θj, hlen2, hv₂ t ht] + | succ q => + rw [List.getElem?_cons_succ] at h + exact absurd rfl (hyv _ (List.mem_of_getElem? h)) + · rw [e3 s h1 h2] at h + have h3 := hy s _ (List.mem_of_getElem? (by rw [e5 s h1]; exact h)) + exact absurd rfl h3 + intro s s' q q' c ε ε' t hc h1 h2 ht + obtain rfl : c = y := hc + rw [hside s q ε h1 t ht, hside s' q' ε' h2 t ht] + +end cut + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/WordNormal.lean b/LeanPool/GraphMinor/Surface/WordNormal.lean new file mode 100644 index 0000000000..55d3013c13 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/WordNormal.lean @@ -0,0 +1,597 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.WordSlide + +/-! +# Normal form of a word + +Every nonempty word with labels used at most twice is equivalent to a product of handles, cross-caps +and holes +(`exists_nf`), or to `x x⁻¹`. We keep a word in the form `R H`, with `H` a sorted product of blocks, +and each step +moves letters of `R` into `H`: a pair with equal signs gives a cross-cap (`step_cap`), two +interleaved pairs give a +handle (`step_hnd`), an innermost pair around letters that occur once gives a hole (`step_hole`) or +folds +(`step_fold`), and finally the letters that occur once form one more hole (`step_last`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Function + +universe uu + +/-- The hole with the tether `t` around the letter `r`. -/ +def holB (t r : Letter) : List Letter := [t, r, linv t] + +/-- Products of `a` handles. -/ +inductive HL : ℕ → List Letter → Prop + | nil : HL 0 [] + | cons {a : ℕ} {X : List Letter} (u v : Letter) (h : u.1 ≠ v.1) (hX : DisjL (hndB u v) X) : + HL a X → HL (a + 1) (hndB u v ++ X) + +/-- Products of `b` cross-caps. -/ +inductive CL : ℕ → List Letter → Prop + | nil : CL 0 [] + | cons {b : ℕ} {X : List Letter} (y : Letter) (hX : DisjL [y, y] X) : CL b X → CL (b + 1) + ([y, y] ++ X) + +/-- Products of `c` holes. -/ +inductive TL : ℕ → List Letter → Prop + | nil : TL 0 [] + | cons {c : ℕ} {X : List Letter} (t r : Letter) (h : t.1 ≠ r.1) (hX : DisjL (holB t r) X) : + TL c X → TL (c + 1) (holB t r ++ X) + +theorem isBlock_holB {t r : Letter} (h : t.1 ≠ r.1) : IsBlock (holB t r) := by + have := IsBlock.hole t [r] (noLab_cons.mpr ⟨fun e => h e.symm, noLab_nil⟩) + simpa [holB] using this + +theorem HL.blocks {a : ℕ} {X : List Letter} (h : HL a X) : Blocks X := by + induction h with + | nil => exact .nil + | cons u v h hX _ ih => exact .cons (.hnd u v h) hX ih + +theorem CL.blocks {b : ℕ} {X : List Letter} (h : CL b X) : Blocks X := by + induction h with + | nil => exact .nil + | cons y hX _ ih => exact .cons (.cap y) hX ih + +theorem TL.blocks {c : ℕ} {X : List Letter} (h : TL c X) : Blocks X := by + induction h with + | nil => exact .nil + | cons t r h hX _ ih => exact .cons (isBlock_holB h) hX ih + +/-- The normal forms: a product of handles, cross-caps and holes. -/ +def IsNF (w : List Letter) (a b c : ℕ) : Prop := + ∃ X Y Z, w = X ++ Y ++ Z ∧ HL a X ∧ CL b Y ∧ TL c Z ∧ DisjL X Y ∧ DisjL X Z ∧ DisjL Y Z + +/-- The state of the procedure. -/ +def Inv (R X Y Z : List Letter) (a b c : ℕ) : Prop := + HL a X ∧ CL b Y ∧ TL c Z ∧ DisjL X Y ∧ DisjL X Z ∧ DisjL Y Z ∧ DisjL X R ∧ DisjL Y R ∧ DisjL Z R + ∧ Good R + +theorem DisjL.mono {L a b : List Letter} (h : DisjL L a) (hs : ∀ c, cnt b c ≤ cnt a c) : DisjL L b + := by + intro l hl + have h1 := noLab_iff_cnt.mp (h l hl) + have h2 := hs l.1 + exact noLab_iff_cnt.mpr (by omega) + +theorem DisjL.mono_left {L a b : List Letter} (h : DisjL a L) (hs : ∀ c, cnt b c + ≤ cnt a c) : DisjL b L := + (h.symm.mono hs).symm + +theorem Good.mono {a b : List Letter} (h : Good a) (hs : ∀ c, cnt b c ≤ cnt a c) : Good b := + fun c => (hs c).trans (h c) + +theorem noLab_of_cnt {w : List Letter} {c : ℕ} (h : cnt w c = 0) : NoLab w c := noLab_iff_cnt.mpr h + +theorem Inv.blocks {R X Y Z : List Letter} {a b c : ℕ} (h : Inv R X Y Z a b c) : Blocks + (X ++ Y ++ Z) := by + obtain ⟨h1, h2, h3, h4, h5, h6, -⟩ := h + exact (h1.blocks.append h2.blocks h4).append h3.blocks (h5.append_left h6) + +theorem Inv.disj {R X Y Z : List Letter} {a b c : ℕ} (h : Inv R X Y Z a b c) : DisjL + (X ++ Y ++ Z) R := by + obtain ⟨-, -, -, -, -, -, h7, h8, h9, -⟩ := h + exact (h7.append_left h8).append_left h9 + +/-- A pair with equal signs gives a cross-cap. -/ +theorem step_cap {R X Y Z P Q S : List Letter} {x : Letter} {a b c : ℕ} (hI : Inv R X Y Z a b c) + (hR : R = P ++ x :: Q ++ x :: S) : + Inv (S ++ P ++ winv Q) X ([x, x] ++ Y) Z a (b + 1) c ∧ + WEq.{uu} (R ++ X ++ Y ++ Z) ((S ++ P ++ winv Q) ++ X ++ ([x, x] ++ Y) ++ Z) := by + obtain ⟨h1, h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ := id hI + have hc : ∀ c, cnt R c = cnt P c + cnt Q c + cnt S c + 2 * (if x.1 = c then 1 else 0) := by + intro c + rw [hR] + simp only [cnt_append, cnt_cons] + omega + have hx := h10 x.1 + rw [hc] at hx + simp only [ite_true] at hx + have hP : NoLab P x.1 := noLab_of_cnt (by omega) + have hQ : NoLab Q x.1 := noLab_of_cnt (by omega) + have hS : NoLab S x.1 := noLab_of_cnt (by omega) + have hsub : ∀ c, cnt (S ++ P ++ winv Q) c ≤ cnt R c := fun c => by + rw [hc] + simp only [cnt_append, cnt_winv] + omega + have hcp : ∀ c, cnt [x, x] c ≤ cnt R c := fun c => by + rw [hc] + simp only [cnt_cons, show cnt [] c = 0 from rfl] + omega + have hxH : NoLab (X ++ Y ++ Z) x.1 := by + have h11 := hI.disj.symm x (by rw [hR]; simp) + exact h11 + have hB := hI.blocks + set H := X ++ Y ++ Z with hH + have hXYZ := noLab_append.mp hxH + have hXY := noLab_append.mp hXYZ.1 + have hSP : NoLab (S ++ P ++ winv Q) x.1 := noLab_append.mpr ⟨noLab_append.mpr ⟨hS, hP⟩, + noLab_winv.mpr hQ⟩ + refine ⟨⟨h1, .cons x (fun l hl => ?_) h2, h3, ?_, h5, ?_, h7.mono hsub, ?_, h9.mono hsub, + h10.mono hsub⟩, ?_⟩ + · exact (h8.mono hcp).symm l hl + · exact DisjL.append_right (h7.mono hcp) h4 + · exact DisjL.append_left (fun l hl => by + have hlx : l = x := by + simpa only [List.mem_cons, List.not_mem_nil, or_false, or_self] using hl + have : l.1 = x.1 := congrArg Prod.fst hlx + rw [this] + exact hXYZ.2) h6 + · exact DisjL.append_left (fun l hl => by + have hlx : l = x := by + simpa only [List.mem_cons, List.not_mem_nil, or_false, or_self] using hl + have : l.1 = x.1 := congrArg Prod.fst hlx + rw [this] + exact hSP) (h8.mono hsub) + · have c0 : WEq.{uu} (R ++ X ++ Y ++ Z) (S ++ H ++ P ++ x :: Q ++ [x]) := + WEq.rot' (P ++ x :: Q ++ [x]) (S ++ H) (by simp [hR, hH]) (by simp) + have c1 : WEq.{uu} (S ++ H ++ P ++ x :: Q ++ [x]) (x :: (S ++ H ++ P ++ winv Q ++ [x])) := + ruleB' x (S ++ H ++ P) [] Q [] (noLab_append.mpr ⟨noLab_append.mpr ⟨hS, hxH⟩, hP⟩) noLab_nil + hQ noLab_nil + (by simp) (by simp [winv]) + have c2 : WEq.{uu} (x :: (S ++ H ++ P ++ winv Q ++ [x])) (P ++ winv Q ++ [x, x] ++ S ++ H) := + WEq.rot' (x :: S ++ H) (P ++ winv Q ++ [x]) (by simp) (by simp) + have hdA : DisjL H (P ++ winv Q ++ [x, x]) := hI.disj.mono fun c => by + rw [hc] + simp only [cnt_append, cnt_winv, cnt_cons, show cnt [] c = 0 from rfl] + omega + have hdS : DisjL H S := hI.disj.mono fun c => by + rw [hc] + omega + have c3 : WEq.{uu} (P ++ winv Q ++ [x, x] ++ S ++ H) (S ++ (P ++ winv Q ++ [x, x]) ++ H) := + slide hB hdA hdS + have hd1 : DisjL [x, x] (S ++ P ++ winv Q) := fun l hl => by + have hlx : l = x := by + simpa only [List.mem_cons, List.not_mem_nil, or_false, or_self] using hl + have : l.1 = x.1 := congrArg Prod.fst hlx + rw [this] + exact hSP + have hd2 : DisjL [x, x] X := fun l hl => by + have hlx : l = x := by + simpa only [List.mem_cons, List.not_mem_nil, or_false, or_self] using hl + have : l.1 = x.1 := congrArg Prod.fst hlx + rw [this] + exact hXY.1 + have hd3 : DisjL [x, x] (Y ++ Z) := fun l hl => by + have hlx : l = x := by + simpa only [List.mem_cons, List.not_mem_nil, or_false, or_self] using hl + have : l.1 = x.1 := congrArg Prod.fst hlx + rw [this] + exact noLab_append.mpr ⟨hXY.2, hXYZ.2⟩ + have c4 := move_block.{uu} (.cap x) hd1 hd2 hd3 + refine c0.trans (c1.trans (c2.trans (c3.trans ((WEq.of_eq ?_).trans (c4.trans + (WEq.of_eq ?_)))))) + · simp [hH] + · simp + +/-- Two interleaved pairs give a handle. -/ +theorem step_hnd {R X Y Z P Q S T V : List Letter} {x y : Letter} {a b c : ℕ} + (hI : Inv R X Y Z a b c) + (hxy : x.1 ≠ y.1) (hR : R = P ++ x :: Q ++ y :: S ++ linv x :: T ++ linv y :: V) : + Inv (V ++ P ++ T ++ S ++ Q) (hndB y (linv x) ++ X) Y Z (a + 1) b c ∧ + WEq.{uu} (R ++ X ++ Y ++ Z) ((V ++ P ++ T ++ S ++ Q) ++ (hndB y (linv x) ++ X) ++ Y ++ Z) + := by + obtain ⟨h1, h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ := id hI + have hc : ∀ c, cnt R c = cnt P c + cnt Q c + cnt S c + cnt T c + cnt V c + + 2 * (if x.1 = c then 1 else 0) + 2 * (if y.1 = c then 1 else 0) := by + intro c + rw [hR] + simp only [cnt_append, cnt_cons, linv] + omega + have hx := h10 x.1 + have hy := h10 y.1 + rw [hc] at hx hy + simp only [ite_true] at hx hy + have nx : ∀ {w}, cnt w x.1 = 0 → NoLab w x.1 := noLab_of_cnt + have ny : ∀ {w}, cnt w y.1 = 0 → NoLab w y.1 := noLab_of_cnt + have hP : NoLab P x.1 := nx (by omega) + have hQ : NoLab Q x.1 := nx (by omega) + have hS : NoLab S x.1 := nx (by omega) + have hT : NoLab T x.1 := nx (by omega) + have hV : NoLab V x.1 := nx (by omega) + have hP' : NoLab P y.1 := ny (by omega) + have hQ' : NoLab Q y.1 := ny (by omega) + have hS' : NoLab S y.1 := ny (by omega) + have hT' : NoLab T y.1 := ny (by omega) + have hV' : NoLab V y.1 := ny (by omega) + have hsub : ∀ c, cnt (V ++ P ++ T ++ S ++ Q) c ≤ cnt R c := fun c => by + rw [hc] + simp only [cnt_append] + omega + have hU : ∀ c, cnt (hndB y (linv x)) c ≤ cnt R c := fun c => by + rw [hc] + simp only [hndB, cnt_cons, show cnt [] c = 0 from rfl, linv] + split_ifs <;> omega + have hxH : NoLab (X ++ Y ++ Z) x.1 := hI.disj.symm x (by rw [hR]; simp) + have hyH : NoLab (X ++ Y ++ Z) y.1 := hI.disj.symm y (by rw [hR]; simp) + have hB := hI.blocks + have hd := hI.disj + have hXn := noLab_append.mp (noLab_append.mp hxH).1 + set H := X ++ Y ++ Z with hH + have hyx : y.1 ≠ x.1 := fun e => hxy e.symm + have hU1 : DisjL (hndB y (linv x)) (V ++ P ++ T ++ S ++ Q) := by + intro l hl + simp only [hndB, List.mem_cons, List.not_mem_nil, or_false, linv] at hl + have hn : ∀ {w : List Letter}, NoLab w x.1 → NoLab w y.1 → NoLab w l.1 := fun {w} a1 a2 => by + rcases hl with rfl | rfl | rfl | rfl + · exact a2 + · exact a1 + · exact a2 + · simpa [linv_linv] using a1 + refine hn ?_ ?_ + · exact noLab_append.mpr ⟨noLab_append.mpr ⟨noLab_append.mpr ⟨noLab_append.mpr ⟨hV, hP⟩, hT⟩, + hS⟩, hQ⟩ + · exact noLab_append.mpr ⟨noLab_append.mpr ⟨noLab_append.mpr ⟨noLab_append.mpr ⟨hV', hP'⟩, + hT'⟩, hS'⟩, hQ'⟩ + have hhx : DisjL X (hndB y (linv x)) := h7.mono hU + refine ⟨⟨.cons y (linv x) hyx hhx.symm h1, h2, h3, DisjL.append_left ((h8.mono hU).symm) h4, + DisjL.append_left ((h9.mono hU).symm) h5, h6, DisjL.append_left hU1 + (h7.mono hsub), h8.mono hsub, h9.mono hsub, + h10.mono hsub⟩, ?_⟩ + set C := V ++ H ++ P with hCd + have hCx : NoLab C x.1 := noLab_append.mpr ⟨noLab_append.mpr ⟨hV, hxH⟩, hP⟩ + have hCy : NoLab C y.1 := noLab_append.mpr ⟨noLab_append.mpr ⟨hV', hyH⟩, hP'⟩ + have c0 : WEq.{uu} (R ++ X ++ Y ++ Z) (C ++ x :: Q ++ y :: S ++ linv x :: T ++ [linv y]) := + WEq.rot' (P ++ x :: Q ++ y :: S ++ linv x :: T ++ [linv y]) (V ++ H) (by simp [hR, hH]) + (by simp [hCd]) + have c1 : WEq.{uu} (C ++ x :: Q ++ y :: S ++ linv x :: T ++ [linv y]) + (Q ++ x :: (C ++ (T ++ [linv y]) ++ linv x :: y :: S)) := + ruleA' x C Q (y :: S) (T ++ [linv y]) hCx hQ (noLab_cons.mpr ⟨hyx, hS⟩) + (noLab_append.mpr ⟨hT, noLab_cons.mpr ⟨hyx, noLab_nil⟩⟩) (by simp) (by simp) + have c2 : WEq.{uu} (Q ++ x :: (C ++ (T ++ [linv y]) ++ linv x :: y :: S)) + (x :: C ++ T ++ linv y :: linv x :: y :: (S ++ Q)) := + WEq.rot' Q (x :: (C ++ (T ++ [linv y]) ++ linv x :: y :: S)) rfl (by simp) + have c3 : WEq.{uu} (x :: C ++ T ++ linv y :: linv x :: y :: (S ++ Q)) + (linv y :: ((x :: C ++ T) ++ (S ++ Q) ++ y :: [linv x])) := + ruleA' (linv y) (x :: C ++ T) [] [linv x] (S ++ Q) + (noLab_append.mpr ⟨noLab_cons.mpr ⟨hxy, hCy⟩, hT'⟩) noLab_nil + (noLab_cons.mpr ⟨hxy, noLab_nil⟩) (noLab_append.mpr ⟨hS', hQ'⟩) (by simp [linv_linv]) + (by simp [linv_linv]) + have c4 : WEq.{uu} (linv y :: ((x :: C ++ T) ++ (S ++ Q) ++ y :: [linv x])) + ((P ++ T ++ S ++ Q ++ hndB y (linv x)) ++ V ++ H) := + WEq.rot' ([linv y, x] ++ V ++ H) (P ++ T ++ S ++ Q ++ [y, linv x]) (by simp [hCd]) + (by simp [hndB, linv_linv]) + have hdA : DisjL H (P ++ T ++ S ++ Q ++ hndB y (linv x)) := hd.mono fun c => by + rw [hc] + simp only [hndB, cnt_append, cnt_cons, show cnt [] c = 0 from rfl, linv] + split_ifs <;> omega + have hdV : DisjL H V := hd.mono fun c => by + rw [hc] + omega + have c5 := slide.{uu} hB hdA hdV + exact c0.trans (c1.trans (c2.trans (c3.trans (c4.trans (c5.trans (WEq.of_eq (by simp [hH]))))))) + +/-- Merging letters in a word. -/ +theorem merge_all {A C : List Letter} {q : Letter} (B : List Letter) + (hG : ∀ l ∈ q :: B, cnt (A ++ q :: B ++ C) l.1 = 1) : + WEq.{uu} (A ++ q :: B ++ C) (A ++ q :: C) := by + induction B with + | nil => exact WEq.of_eq (by simp) + | cons m B ih => + have hq := hG q (by simp) + have hm := hG m (by simp) + simp only [cnt_append, cnt_cons] at hq hm + simp only [ite_true] at hq hm + have hqm : q.1 ≠ m.1 := by + intro he + rw [ite_eq_left he] at hm + omega + have hn : NoLab (B ++ C ++ A) q.1 := noLab_of_cnt (by + simp only [cnt_append] + rw [ite_eq_right (fun e : m.1 = q.1 => hqm e.symm)] at hq + omega) + have hn' : NoLab (B ++ C ++ A) m.1 := noLab_of_cnt (by + simp only [cnt_append] + rw [ite_eq_right hqm] at hm + omega) + have c0 : WEq.{uu} (A ++ q :: (m :: B) ++ C) (q :: m :: (B ++ C ++ A)) := + WEq.rot' A (q :: m :: (B ++ C)) (by simp) (by simp) + have c1 : WEq.{uu} (q :: m :: (B ++ C ++ A)) (q :: (B ++ C ++ A)) := + (WEq.merge (p := q.1) (q := m.1) (e := q.2) (e' := m.2) hqm hn hn').symm + have c2 : WEq.{uu} (q :: (B ++ C ++ A)) (A ++ q :: B ++ C) := + WEq.rot' (q :: (B ++ C)) A (by simp) (by simp) + refine c0.trans (c1.trans (c2.trans (ih fun l hl => ?_))) + have h1 := hG l (by + rcases List.mem_cons.mp hl with rfl | hl + · simp + · simp [hl]) + have h2 : l.1 ≠ m.1 := by + rcases List.mem_cons.mp hl with rfl | hl + · exact hqm + · intro he + have := cnt_pos hl + rw [he] at this + omega + simp only [cnt_append, cnt_cons, ite_eq_right (fun e : m.1 = l.1 => h2 e.symm)] at h1 ⊢ + omega + +/-- An innermost pair around letters that occur once gives a hole. -/ +theorem step_hole {R X Y Z P Q V : List Letter} {x q : Letter} {a b c : ℕ} (hI : Inv R X Y Z a b c) + (hR : R = P ++ x :: q :: Q ++ linv x :: V) (hB : ∀ l ∈ q :: Q, cnt R l.1 = 1) : + Inv (P ++ V) X Y (holB x q ++ Z) a b (c + 1) ∧ + WEq.{uu} (R ++ X ++ Y ++ Z) ((P ++ V) ++ X ++ Y ++ (holB x q ++ Z)) := by + obtain ⟨h1, h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ := id hI + have hc : ∀ c, cnt R c = cnt P c + (if q.1 = c then 1 else 0) + cnt Q c + cnt V c + + 2 * (if x.1 = c then 1 else 0) := by + intro c + rw [hR] + simp only [cnt_append, cnt_cons, linv] + omega + have hx := h10 x.1 + rw [hc] at hx + simp only [ite_true] at hx + have hqq := hB q (by simp) + rw [hc] at hqq + simp only [ite_true] at hqq + have hxq : x.1 ≠ q.1 := by + intro he + rw [ite_eq_left he] at hqq + omega + have hqx : q.1 ≠ x.1 := fun e => hxq e.symm + rw [ite_eq_right hqx] at hx + have hPx : NoLab P x.1 := noLab_of_cnt (by omega) + have hQx : NoLab Q x.1 := noLab_of_cnt (by omega) + have hVx : NoLab V x.1 := noLab_of_cnt (by omega) + have hPq : NoLab P q.1 := noLab_of_cnt (by omega) + have hVq : NoLab V q.1 := noLab_of_cnt (by omega) + have hsub : ∀ c, cnt (P ++ V) c ≤ cnt R c := fun c => by + rw [hc, cnt_append] + omega + have hU : ∀ c, cnt (holB x q) c ≤ cnt R c := fun c => by + rw [hc] + simp only [holB, cnt_cons, show cnt [] c = 0 from rfl, linv] + split_ifs <;> omega + have hUd : DisjL (holB x q) (P ++ V) := by + intro l hl + simp only [holB, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl + · exact noLab_append.mpr ⟨hPx, hVx⟩ + · exact noLab_append.mpr ⟨hPq, hVq⟩ + · exact noLab_append.mpr ⟨hPx, hVx⟩ + have hd := hI.disj + have hdU : DisjL (X ++ Y ++ Z) (holB x q) := hd.mono hU + refine ⟨⟨h1, h2, .cons x q hxq (h9.mono hU).symm h3, h4, DisjL.append_right (h7.mono hU) h5, + DisjL.append_right (h8.mono hU) h6, h7.mono hsub, h8.mono hsub, DisjL.append_left hUd + (h9.mono hsub), + h10.mono hsub⟩, ?_⟩ + have hmerge : WEq.{uu} ((P ++ [x]) ++ q :: Q ++ (linv x :: (V ++ X ++ Y ++ Z))) + ((P ++ [x]) ++ q :: (linv x :: (V ++ X ++ Y ++ Z))) := by + refine merge_all Q fun l hl => ?_ + have h11 := hB l hl + have hlR : l ∈ R := by + rw [hR] + rcases List.mem_cons.mp hl with rfl | hl + · simp + · simp [hl] + have h12 := noLab_iff_cnt.mp (hd.symm l hlR) + have e : (P ++ [x]) ++ q :: Q ++ (linv x :: (V ++ X ++ Y ++ Z)) = R ++ (X ++ Y ++ Z) := by + simp [hR] + rw [e, cnt_append, h11, h12] + have hx1 : DisjL (holB x q) P := hUd.inl + have hx2 : DisjL (holB x q) (V ++ X ++ Y) := by + refine DisjL.append_right (DisjL.append_right hUd.inr ?_) ?_ + · exact (h7.mono hU).symm + · exact (h8.mono hU).symm + have c2 := move_block.{uu} (isBlock_holB hxq) hx1 hx2 (h9.mono hU).symm + refine (WEq.of_eq (by simp [hR])).trans (hmerge.trans ((WEq.of_eq (by simp [holB])).trans + (c2.trans (WEq.of_eq (by simp))))) + +theorem WEq.fold (x : Letter) {u : List Letter} (hu : u ≠ []) (hy : NoLab u x.1) : + WEq.{uu} u (x :: linv x :: u) := + peq_fold finW_nW x.2 hu (freshIn_sW hy) + +/-- A pair of adjacent letters is folded. -/ +theorem step_fold {R X Y Z P V : List Letter} {x : Letter} {a b c : ℕ} (hI : Inv R X Y Z a b c) + (hR : R = P ++ x :: linv x :: V) (hne : P ++ V ++ X ++ Y ++ Z ≠ []) : + Inv (P ++ V) X Y Z a b c ∧ WEq.{uu} (R ++ X ++ Y ++ Z) ((P ++ V) ++ X ++ Y ++ Z) := by + obtain ⟨h1, h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ := id hI + have hc : ∀ c, cnt R c = cnt P c + cnt V c + 2 * (if x.1 = c then 1 else 0) := by + intro c + rw [hR] + simp only [cnt_append, cnt_cons, linv] + omega + have hx := h10 x.1 + rw [hc] at hx + simp only [ite_true] at hx + have hPx : NoLab P x.1 := noLab_of_cnt (by omega) + have hVx : NoLab V x.1 := noLab_of_cnt (by omega) + have hsub : ∀ c, cnt (P ++ V) c ≤ cnt R c := fun c => by + rw [hc, cnt_append] + omega + have hxH : NoLab (X ++ Y ++ Z) x.1 := hI.disj.symm x (by rw [hR]; simp) + refine ⟨⟨h1, h2, h3, h4, h5, h6, h7.mono hsub, h8.mono hsub, h9.mono hsub, h10.mono hsub⟩, ?_⟩ + set H := X ++ Y ++ Z with hH + have c0 : WEq.{uu} (R ++ X ++ Y ++ Z) (x :: linv x :: (V ++ H ++ P)) := + WEq.rot' P (x :: linv x :: (V ++ H)) (by simp [hR, hH]) (by simp) + have hne' : V ++ H ++ P ≠ [] := by + intro he + apply hne + simp only [List.append_eq_nil_iff] at he ⊢ + simp only [hH, List.append_eq_nil_iff] at he + tauto + have c1 := (WEq.fold.{uu} x hne' (noLab_append.mpr ⟨noLab_append.mpr ⟨hVx, hxH⟩, hPx⟩)).symm + have c2 : WEq.{uu} (V ++ H ++ P) (P ++ V ++ X ++ Y ++ Z) := WEq.rot' (V ++ H) P (by simp) + (by simp [hH]) + exact c0.trans (c1.trans c2) + +/-- The letters that occur once form the last hole. -/ +theorem step_last {R X Y Z Q : List Letter} {q : Letter} {a b c : ℕ} (hI : Inv R X Y Z a b c) + (hR : R = q :: Q) (hB : ∀ l ∈ R, cnt R l.1 = 1) : + ∃ t, Inv [] X Y (holB t q ++ Z) a b (c + 1) ∧ + WEq.{uu} (R ++ X ++ Y ++ Z) ([] ++ X ++ Y ++ (holB t q ++ Z)) := by + obtain ⟨h1, h2, h3, h4, h5, h6, h7, h8, h9, h10⟩ := id hI + have hd := hI.disj + have hB' := hI.blocks + have hqH : NoLab (X ++ Y ++ Z) q.1 := hd.symm q (by rw [hR]; simp) + obtain ⟨y, -, hy⟩ := exists_fresh (q :: (X ++ Y ++ Z)) + let t : Letter := (y, true) + have hyq : q.1 ≠ y := (noLab_cons.mp hy).1 + have hyH : NoLab (X ++ Y ++ Z) t.1 := (noLab_cons.mp hy).2 + have hyXYZ := noLab_append.mp hyH + have hyXY := noLab_append.mp hyXYZ.1 + have hqXYZ := noLab_append.mp hqH + have hqXY := noLab_append.mp hqXYZ.1 + have hmerge : WEq.{uu} ([] ++ q :: Q ++ (X ++ Y ++ Z)) ([] ++ q :: (X ++ Y ++ Z)) := by + refine merge_all Q fun l hl => ?_ + have h11 := hB l (by rw [hR]; exact hl) + have hlR : l ∈ R := by rw [hR]; exact hl + have h12 := noLab_iff_cnt.mp (hd.symm l hlR) + have e : [] ++ q :: Q ++ (X ++ Y ++ Z) = R ++ (X ++ Y ++ Z) := by simp [hR] + rw [e, cnt_append, h11, h12] + have hUX : ∀ {w : List Letter}, NoLab w t.1 → NoLab w q.1 → DisjL (holB t q) w := by + intro w a1 a2 l hl + simp only [holB, List.mem_cons, List.not_mem_nil, or_false] at hl + rcases hl with rfl | rfl | rfl + · exact a1 + · exact a2 + · exact a1 + have ht1 : t.1 ≠ q.1 := fun e => hyq e.symm + refine ⟨t, ⟨h1, h2, .cons t q ht1 (hUX hyXYZ.2 hqXYZ.2) h3, h4, ?_, ?_, ?_, ?_, ?_, ?_⟩, ?_⟩ + · exact DisjL.append_right (hUX hyXY.1 hqXY.1).symm h5 + · exact DisjL.append_right (hUX hyXY.2 hqXY.2).symm h6 + · simp [DisjL, NoLab] + · simp [DisjL, NoLab] + · simp [DisjL, NoLab] + · simp [Good, cnt] + · have c1 := WEq.fold.{uu} (linv t) (u := q :: (X ++ Y ++ Z)) (by simp) + (noLab_cons.mpr ⟨hyq, hyH⟩) + have d1 : DisjL (X ++ Y ++ Z) [linv t] := fun l hl m hm he => by + simp only [List.mem_singleton] at hm + subst hm + exact hyH l hl he.symm + have d2 : DisjL (X ++ Y ++ Z) [t, q] := fun l hl m hm he => by + simp only [List.mem_cons, List.not_mem_nil, or_false] at hm + rcases hm with rfl | rfl + · exact hyH l hl he.symm + · exact hqH l hl he.symm + have c2 := slide.{uu} hB' d1 d2 + have c3 := move_block.{uu} (P := []) (isBlock_holB ht1) (by simp [DisjL, NoLab]) (hUX + (noLab_append.mpr ⟨hyXY.1, hyXY.2⟩) (noLab_append.mpr ⟨hqXY.1, hqXY.2⟩)) (hUX hyXYZ.2 hqXYZ.2) + refine (WEq.of_eq (by simp [hR])).trans (hmerge.trans ((WEq.of_eq (by simp)).trans (c1.trans + ((WEq.of_eq (by simp [linv_linv])).trans (c2.trans ((WEq.of_eq (by simp [holB])).trans + (c3.trans + (WEq.of_eq (by simp))))))))) + +/-- Reaching a normal form from a state. -/ +theorem normalize (n : ℕ) : ∀ (R X Y Z : List Letter) (a b c : ℕ), R.length ≤ n → Inv R X Y Z a b c + → + R ++ X ++ Y ++ Z ≠ [] → + (∃ a' b' c' w', IsNF w' a' b' c' ∧ WEq.{uu} (R ++ X ++ Y ++ Z) w') ∨ + ∃ x, WEq.{uu} (R ++ X ++ Y ++ Z) [x, linv x] := by + induction n using Nat.strong_induction_on with + | _ n ih => + intro R X Y Z a b c hn hI hne + have good := hI.2.2.2.2.2.2.2.2.2 + have len : ∀ (R' : List Letter), R'.length < R.length → R'.length < R.length := fun _ h => h + have recur : ∀ (R' X' Y' Z' : List Letter) (a' b' c' : ℕ), R'.length < R.length → + Inv R' X' Y' Z' a' b' c' → WEq.{uu} (R ++ X ++ Y ++ Z) (R' ++ X' ++ Y' ++ Z') → + R' ++ X' ++ Y' ++ Z' ≠ [] → + (∃ a' b' c' w', IsNF w' a' b' c' ∧ WEq.{uu} (R ++ X ++ Y ++ Z) w') ∨ + ∃ x, WEq.{uu} (R ++ X ++ Y ++ Z) [x, linv x] := by + intro R' X' Y' Z' a' b' c' hl hI' he hne' + have hR0 : 0 < R.length := by omega + cases n with + | zero => omega + | succ m => + rcases ih m (by omega) R' X' Y' Z' a' b' c' (by omega) hI' hne' with + ⟨a'', b'', c'', w', h1, h2⟩ | ⟨x, h2⟩ + · exact .inl ⟨a'', b'', c'', w', h1, he.trans h2⟩ + · exact .inr ⟨x, he.trans h2⟩ + by_cases hone : ∀ l ∈ R, cnt R l.1 = 1 + · cases R with + | nil => + obtain ⟨h1, h2, h3, h4, h5, h6, -⟩ := hI + exact .inl ⟨a, b, c, _, ⟨X, Y, Z, rfl, h1, h2, h3, h4, h5, h6⟩, WEq.of_eq (by simp)⟩ + | cons q Q => + obtain ⟨t, hI', he⟩ := step_last.{uu} hI rfl hone + obtain ⟨h1, h2, h3, h4, h5, h6, -⟩ := hI' + exact .inl ⟨a, b, c + 1, _, ⟨X, Y, _, rfl, h1, h2, h3, h4, h5, h6⟩, + he.trans (WEq.of_eq (by simp))⟩ + push Not at hone + obtain ⟨l, hl, hl1⟩ := hone + have hpos := cnt_pos hl + obtain ⟨P₀, Q₀, hsplit⟩ := List.append_of_mem hl + have hcR : cnt R l.1 = cnt P₀ l.1 + 1 + cnt Q₀ l.1 := by + rw [hsplit, cnt_append, cnt_cons, ite_eq_left rfl] + omega + have hcases : ∃ P B V x x', R = P ++ x :: B ++ x' :: V ∧ x'.1 = x.1 := by + by_cases h : 0 < cnt Q₀ l.1 + · obtain ⟨B, m, V, rfl, hm⟩ := exists_of_cnt_pos h + exact ⟨P₀, B, V, l, m, by simpa using hsplit, hm⟩ + · have h' : 0 < cnt P₀ l.1 := by omega + obtain ⟨P, m, B, rfl, hm⟩ := exists_of_cnt_pos h' + exact ⟨P, B, Q₀, m, l, by simpa using hsplit, hm.symm⟩ + obtain ⟨P, B, V, x, x', hE, hx⟩ := hcases + rcases pair_cases good _ P B V x x' le_rfl hE hx with ⟨P, Q, S, x, hE⟩ | + ⟨P, Q, S, T, V, x, y, hxy, hE⟩ | ⟨P, B, V, x, hE, hB⟩ + · obtain ⟨h1, h2⟩ := step_cap.{uu} hI hE + refine recur _ _ _ _ _ _ _ ?_ h1 h2 (by simp) + rw [hE] + simp [winv] + omega + · obtain ⟨h1, h2⟩ := step_hnd.{uu} hI hxy hE + refine recur _ _ _ _ _ _ _ ?_ h1 h2 (by simp [hndB]) + rw [hE] + simp + omega + · cases B with + | nil => + by_cases hempty : P ++ V ++ X ++ Y ++ Z = [] + · simp only [List.append_eq_nil_iff] at hempty + obtain ⟨⟨⟨⟨rfl, rfl⟩, rfl⟩, rfl⟩, rfl⟩ := hempty + exact .inr ⟨x, WEq.of_eq (by simp [hE])⟩ + · have hE' : R = P ++ x :: linv x :: V := by simpa using hE + obtain ⟨h1, h2⟩ := step_fold.{uu} hI hE' hempty + refine recur _ _ _ _ _ _ _ ?_ h1 h2 hempty + rw [hE'] + simp + | cons q Q => + obtain ⟨h1, h2⟩ := step_hole.{uu} hI hE hB + refine recur _ _ _ _ _ _ _ ?_ h1 h2 (by simp [holB]) + rw [hE] + simp + omega + +/-- **Normal form of a word.** -/ +theorem exists_nf {w : List Letter} (hw : w ≠ []) (hG : Good w) : + (∃ a b c w', IsNF w' a b c ∧ WEq.{uu} w w') ∨ ∃ x, WEq.{uu} w [x, linv x] := by + have hI : Inv w [] [] [] 0 0 0 := ⟨.nil, .nil, .nil, by simp [DisjL], by simp [DisjL], by simp + [DisjL], + by simp [DisjL], by simp [DisjL], by simp [DisjL], hG⟩ + simpa using normalize.{uu} _ w [] [] [] 0 0 0 le_rfl hI (by simpa using hw) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/WordRules.lean b/LeanPool/GraphMinor/Surface/WordRules.lean new file mode 100644 index 0000000000..c9d4817726 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/WordRules.lean @@ -0,0 +1,656 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.WordFold + +/-! +# Rules for one word + +We work with one word in the slot `0` (`sW`). `WEq w w'` says that `w` and `w'` present the same +spaces. The two rules +`ruleA` and `ruleB` move a pair of letters: we cut the word in two and glue the two pieces along the +pair. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Function Metric + +universe uu + +theorem peq_rot1 {W : ℕ → List Letter} (hW : FinW W) (i : ℕ) (x : Letter) (u : List Letter) : + PEq.{uu} (update W i (x :: u)) (update W i (u ++ [x])) := + IsPolyMap.peq isPolyMap_rot1 (hW.update _ _) + +theorem peq_rot {W : ℕ → List Letter} (hW : FinW W) (i : ℕ) (a b : List Letter) : + PEq.{uu} (update W i (a ++ b)) (update W i (b ++ a)) := by + induction a generalizing b with + | nil => simp [PEq.refl] + | cons x a ih => + have h1 := peq_rot1.{uu} hW i x (a ++ b) + have h2 := ih (b ++ [x]) + simp only [List.cons_append] + refine h1.trans ?_ + simp only [List.append_assoc] at h2 ⊢ + simpa using h2 + +theorem peq_rev {W : ℕ → List Letter} (hW : FinW W) (i : ℕ) (w : List Letter) : + PEq.{uu} (update W i w) (update W i (winv w)) := + IsPolyMap.peq isPolyMap_rev (hW.update _ _) + +theorem peq_cut {W : ℕ → List Letter} {i j y : ℕ} {u v : List Letter} (hW : FinW W) (e : Bool) + (hij : j ≠ i) + (hWj : W j = []) (hu : u ≠ []) (hv : v ≠ []) (hy : FreshIn (update W i (v ++ u)) y) : + PEq.{uu} (update W i (v ++ u)) (update (update W i ((y, e) :: u)) j ((y, !e) :: v)) := by + obtain ⟨θ, hθ, -, -⟩ := exists_isPolyMap_cut e hij hWj hu hv hy + exact hθ.peq ((hW.update _ _).update _ _) + +theorem peq_fold {W : ℕ → List Letter} {i y : ℕ} {u : List Letter} (hW : FinW W) (e : Bool) + (hu : u ≠ []) + (hy : FreshIn (update W i u) y) : + PEq.{uu} (update W i u) (update W i ((y, e) :: (y, !e) :: u)) := by + obtain ⟨θ, hθ⟩ := exists_isPolyMap_fold (e := e) hu hy + exact hθ.peq (hW.update _ _) + +/-- The family with no words. -/ +def nW : ℕ → List Letter := fun _ => [] + +theorem finW_nW : FinW nW := by simp [FinW, nW] + +/-- One word, in the slot `0`. -/ +def sW (w : List Letter) : ℕ → List Letter := update nW 0 w + +/-- Two words, in the slots `0` and `1`. -/ +def dW (a b : List Letter) : ℕ → List Letter := update (sW a) 1 b + +theorem finW_sW (w : List Letter) : FinW (sW w) := finW_nW.update _ _ + +theorem dW_comm (a b : List Letter) : dW a b = update (update nW 1 b) 0 a := by + simp only [dW, sW] + rw [update_comm (by decide)] + +/-- Equivalent single words. -/ +def WEq (w w' : List Letter) : Prop := PEq.{uu} (sW w) (sW w') + +theorem WEq.refl (w : List Letter) : WEq.{uu} w w := PEq.refl _ +theorem WEq.symm {w w' : List Letter} (h : WEq.{uu} w w') : WEq.{uu} w' w := PEq.symm h +theorem WEq.trans {w w' w'' : List Letter} (h : WEq.{uu} w w') (h' : WEq.{uu} w' w'') : WEq.{uu} w + w'' := + PEq.trans h h' + +theorem WEq.rot (a b : List Letter) : WEq.{uu} (a ++ b) (b ++ a) := peq_rot finW_nW 0 a b + +theorem WEq.rev (w : List Letter) : WEq.{uu} w (winv w) := peq_rev finW_nW 0 w + +theorem dW_rot_left (a b c : List Letter) : PEq.{uu} (dW (a ++ b) c) (dW (b ++ a) c) := by + rw [dW_comm, dW_comm] + exact peq_rot (finW_nW.update _ _) 0 a b + +theorem dW_rot_right (a b c : List Letter) : PEq.{uu} (dW c (a ++ b)) (dW c (b ++ a)) := + peq_rot (finW_sW c) 1 a b + +theorem dW_rev_left (a c : List Letter) : PEq.{uu} (dW a c) (dW (winv a) c) := by + rw [dW_comm, dW_comm] + exact peq_rev (finW_nW.update _ _) 0 a + +/-- Labels of a word. -/ +def NoLab (w : List Letter) (c : ℕ) : Prop := ∀ l ∈ w, l.1 ≠ c + +theorem freshIn_sW {w : List Letter} {y : ℕ} (h : NoLab w y) : FreshIn (sW w) y := by + intro i l hl + by_cases hi : i = 0 + · subst hi + exact h l (by simpa [sW] using hl) + · simp [sW, update_of_ne hi, nW] at hl + +theorem exists_fresh (w : List Letter) : ∃ y, y % 2 = 0 ∧ NoLab w y := by + refine ⟨2 * (w.map Prod.fst).sum + 2, by omega, fun l hl h => ?_⟩ + have : l.1 ≤ (w.map Prod.fst).sum := List.single_le_sum (by simp) _ (List.mem_map_of_mem hl) + omega + +theorem peq_cut_sW {y : ℕ} {u v : List Letter} (e : Bool) (hu : u ≠ []) (hv : v ≠ []) + (hy : NoLab (v ++ u) y) : PEq.{uu} (sW (v ++ u)) (dW ((y, e) :: u) ((y, !e) :: v)) := by + refine peq_cut finW_nW e (by decide) rfl hu hv (freshIn_sW hy) + +theorem relab_rename_inj {w : List Letter} {y c : ℕ} (hc : NoLab w c) : + ∀ i j, ∀ l ∈ sW w i, ∀ l' ∈ sW w j, (fun n => if n = y then c else n) l.1 = + (fun n => if n = y then c else n) l'.1 → l.1 = l'.1 := by + intro i j l hl l' hl' he + have h1 : ∀ i, ∀ l ∈ sW w i, l ∈ w := by + intro i l hl + by_cases hi : i = 0 + · subst hi + simpa [sW] using hl + · simp [sW, update_of_ne hi, nW] at hl + have h2 := hc l (h1 _ _ hl) + have h3 := hc l' (h1 _ _ hl') + simp only at he + split_ifs at he with h4 h5 h5 + · rw [h4, h5] + · exact absurd he.symm h3 + · exact absurd he h2 + · exact he + +theorem relab_sW (r : ℕ → ℕ) (w : List Letter) : relab r (sW w) = sW (w.map fun l => (r l.1, l.2)) + := by + funext i + by_cases hi : i = 0 + · subst hi + simp [relab, sW] + · simp [relab, sW, update_of_ne hi, nW] + +/-- Renaming the label `y` of `w` to a label `c` that does not occur. -/ +theorem WEq.rename {w : List Letter} {y c : ℕ} (hc : NoLab w c) : + WEq.{uu} w (w.map fun l => (if l.1 = y then c else l.1, l.2)) := by + have h := peq_relab.{uu} (r := fun n => if n = y then c else n) (W := sW w) (relab_rename_inj hc) + rw [relab_sW] at h + exact h + +theorem map_rename_of_noLab {w : List Letter} {y c : ℕ} (h : NoLab w y) : + (w.map fun l => (if l.1 = y then c else l.1, l.2)) = w := by + conv_rhs => rw [← List.map_id w] + refine List.map_congr_left fun l hl => ?_ + simp [h l hl] + +theorem noLab_append {a b : List Letter} {c : ℕ} : NoLab (a ++ b) c ↔ NoLab a c ∧ NoLab b c := by + simp only [NoLab, List.mem_append] + constructor + · intro h + exact ⟨fun l hl => h l (.inl hl), fun l hl => h l (.inr hl)⟩ + · rintro ⟨h1, h2⟩ l (hl | hl) + · exact h1 l hl + · exact h2 l hl + +theorem noLab_cons {x : Letter} {b : List Letter} {c : ℕ} : NoLab (x :: b) c ↔ x.1 ≠ c ∧ NoLab b c + := by + simp only [NoLab, List.mem_cons] + constructor + · intro h + exact ⟨h x (.inl rfl), fun l hl => h l (.inr hl)⟩ + · rintro ⟨h1, h2⟩ l (rfl | hl) + · exact h1 + · exact h2 l hl + +theorem noLab_nil {c : ℕ} : NoLab [] c := by simp [NoLab] + +theorem noLab_winv {a : List Letter} {c : ℕ} : NoLab (winv a) c ↔ NoLab a c := by + constructor + · intro h l hl + exact h (linv l) (List.mem_map.mpr ⟨l, List.mem_reverse.mpr hl, rfl⟩) + · intro h l hl + simp only [winv, List.mem_map, List.mem_reverse] at hl + obtain ⟨m, hm, rfl⟩ := hl + exact h m hm + +theorem winv_append (a b : List Letter) : winv (a ++ b) = winv b ++ winv a := by simp [winv] + +theorem winv_cons (x : Letter) (a : List Letter) : winv (x :: a) = winv a ++ [linv x] := by + simp [winv] + +theorem linv_linv (x : Letter) : linv (linv x) = x := by simp [linv] + +theorem winv_winv (a : List Letter) : winv (winv a) = a := by + simp [winv, List.map_reverse, Function.comp_def, linv] + +theorem map_rename_append {y c : ℕ} (a b : List Letter) : + ((a ++ b).map fun l => (if l.1 = y then c else l.1, l.2)) = + (a.map fun l => (if l.1 = y then c else l.1, l.2)) ++ (b.map fun l => (if l.1 + = y then c else l.1, l.2)) := + List.map_append .. + +/-- Replace a pair of letters by a fresh label: the core of `ruleA` and `ruleB`. -/ +theorem weq_glue {U V : List Letter} {y : ℕ} {x : Letter} {X : List Letter} + (_hy : NoLab X y) (hcut : PEq.{uu} (sW X) (dW (linv x :: U) (x :: V))) + (h2 : V ≠ []) (h1 : U ≠ []) (hx1 : NoLab U x.1) (hx2 : NoLab V x.1) : + WEq.{uu} X ((V ++ U).map fun l => (if l.1 = y then x.1 else l.1, l.2)) := by + have hc : NoLab (V ++ U) x.1 := noLab_append.mpr ⟨hx2, hx1⟩ + have h3 := peq_cut_sW.{uu} (y := x.1) (!x.2) h1 h2 hc + have e1 : ((x.1, !x.2) : Letter) = linv x := rfl + have e2 : ((x.1, !!x.2) : Letter) = x := by simp + rw [e1, e2] at h3 + exact (hcut.trans h3.symm).trans (WEq.rename hc) + +/-- **Rule A.** A pair `x`, `x⁻¹` of letters of a word exchanges the two blocks on each of its +sides. -/ +theorem ruleA (x : Letter) {u₁ u₂ v₁ v₂ : List Letter} (h1 : NoLab u₁ x.1) (h2 : NoLab u₂ x.1) + (h3 : NoLab v₁ x.1) (h4 : NoLab v₂ x.1) : + WEq.{uu} (u₁ ++ x :: (u₂ ++ v₁ ++ linv x :: v₂)) (u₂ ++ x :: (u₁ ++ v₂ ++ linv x :: v₁)) := by + set X := u₁ ++ x :: (u₂ ++ v₁ ++ linv x :: v₂) with hX + obtain ⟨y, -, hy⟩ := exists_fresh X + have hy' : y ≠ x.1 := fun he => (noLab_append.mp hy).2 x (by simp) he.symm |>.elim + have hA : NoLab (u₁ ++ x :: u₂) y ∧ NoLab (v₁ ++ linv x :: v₂) y := by + have e : X = (u₁ ++ x :: u₂) ++ (v₁ ++ linv x :: v₂) := by simp [hX] + rw [e] at hy + exact noLab_append.mp hy + have e : X = (u₁ ++ x :: u₂) ++ (v₁ ++ linv x :: v₂) := by simp [hX] + have c1 : PEq.{uu} (sW X) (dW ((y, !x.2) :: (v₁ ++ linv x :: v₂)) ((y, x.2) :: (u₁ ++ x :: u₂))) + := by + have := peq_cut_sW.{uu} (y := y) (u := v₁ ++ linv x :: v₂) (v := u₁ ++ x :: u₂) (!x.2) + (by simp) (by simp) + (by rw [← e]; exact hy) + rw [← e] at this + simpa using this + have c2 : PEq.{uu} (dW ((y, !x.2) :: (v₁ ++ linv x :: v₂)) ((y, x.2) :: (u₁ ++ x :: u₂))) + (dW (linv x :: (v₂ ++ (y, !x.2) :: v₁)) ((y, x.2) :: (u₁ ++ x :: u₂))) := by + have := dW_rot_left.{uu} ((y, !x.2) :: v₁) (linv x :: v₂) ((y, x.2) :: (u₁ ++ x :: u₂)) + simpa using this + have c3 : PEq.{uu} (dW (linv x :: (v₂ ++ (y, !x.2) :: v₁)) ((y, x.2) :: (u₁ ++ x :: u₂))) + (dW (linv x :: (v₂ ++ (y, !x.2) :: v₁)) (x :: (u₂ ++ (y, x.2) :: u₁))) := by + have := dW_rot_right.{uu} ((y, x.2) :: u₁) (x :: u₂) (linv x :: (v₂ ++ (y, !x.2) :: v₁)) + simpa using this + have g := weq_glue (x := x) (y := y) (U := v₂ ++ (y, !x.2) :: v₁) (V := u₂ ++ (y, x.2) :: u₁) hy + (c1.trans (c2.trans c3)) (by simp) (by simp) + (noLab_append.mpr ⟨h4, noLab_cons.mpr ⟨hy', h3⟩⟩) (noLab_append.mpr ⟨h2, noLab_cons.mpr ⟨hy', + h1⟩⟩) + refine (g.trans ?_) + have hm : ∀ {a : List Letter}, NoLab a y → (a.map fun l => (if l.1 = y then x.1 else l.1, l.2)) + = a := + fun h => map_rename_of_noLab h + have ha := noLab_append.mp hA.1 + have hb := noLab_append.mp hA.2 + have hu₂ := (noLab_cons.mp ha.2).2 + have hv₂ := (noLab_cons.mp hb.2).2 + have e3 : ((u₂ ++ (y, x.2) :: u₁ ++ (v₂ ++ (y, !x.2) :: v₁)).map + fun l => (if l.1 = y then x.1 else l.1, l.2)) = u₂ ++ x :: (u₁ ++ v₂ ++ linv x :: v₁) := by + simp only [List.map_append, List.map_cons, hm ha.1, hm hb.1, hm hu₂, hm hv₂, ite_true, linv, + List.append_assoc, List.cons_append] + rw [e3] + exact WEq.refl _ + +/-- **Rule B.** The same for a pair `x`, `x` with the same sign: one block is reversed. -/ +theorem ruleB (x : Letter) {u₁ u₂ v₁ v₂ : List Letter} (h1 : NoLab u₁ x.1) (h2 : NoLab u₂ x.1) + (h3 : NoLab v₁ x.1) (h4 : NoLab v₂ x.1) : + WEq.{uu} (u₁ ++ x :: (u₂ ++ v₁ ++ x :: v₂)) (u₂ ++ x :: (u₁ ++ winv v₁ ++ x :: winv v₂)) := by + set X := u₁ ++ x :: (u₂ ++ v₁ ++ x :: v₂) with hX + obtain ⟨y, -, hy⟩ := exists_fresh X + have hy' : y ≠ x.1 := fun he => (noLab_append.mp hy).2 x (by simp) he.symm |>.elim + have e : X = (u₁ ++ x :: u₂) ++ (v₁ ++ x :: v₂) := by simp [hX] + have hA : NoLab (u₁ ++ x :: u₂) y ∧ NoLab (v₁ ++ x :: v₂) y := by + rw [e] at hy + exact noLab_append.mp hy + have c1 : PEq.{uu} (sW X) (dW ((y, !x.2) :: (v₁ ++ x :: v₂)) ((y, x.2) :: (u₁ ++ x :: u₂))) := by + have := peq_cut_sW.{uu} (y := y) (u := v₁ ++ x :: v₂) (v := u₁ ++ x :: u₂) (!x.2) (by simp) + (by simp) + (by rw [← e]; exact hy) + rw [← e] at this + simpa using this + have c0 := dW_rev_left.{uu} ((y, !x.2) :: (v₁ ++ x :: v₂)) ((y, x.2) :: (u₁ ++ x :: u₂)) + have e0 : winv ((y, !x.2) :: (v₁ ++ x :: v₂)) = + (winv v₂ ++ [linv x] ++ winv v₁) ++ [(y, x.2)] := by + simp [winv, linv] + rw [e0] at c0 + have c2 := dW_rot_left.{uu} (winv v₂) ([linv x] ++ winv v₁ ++ [(y, x.2)]) + ((y, x.2) :: (u₁ ++ x :: u₂)) + have e2 : winv v₂ ++ ([linv x] ++ winv v₁ ++ [(y, x.2)]) = + winv v₂ ++ [linv x] ++ winv v₁ ++ [(y, x.2)] := by simp + have e4 : [linv x] ++ winv v₁ ++ [(y, x.2)] ++ winv v₂ = + linv x :: (winv v₁ ++ (y, x.2) :: winv v₂) := by simp + rw [e2, e4] at c2 + have c3 := dW_rot_right.{uu} ((y, x.2) :: u₁) (x :: u₂) + (linv x :: (winv v₁ ++ (y, x.2) :: winv v₂)) + have e5 : (y, x.2) :: u₁ ++ x :: u₂ = (y, x.2) :: (u₁ ++ x :: u₂) := by simp + have e6 : x :: u₂ ++ (y, x.2) :: u₁ = x :: (u₂ ++ (y, x.2) :: u₁) := by simp + rw [e5, e6] at c3 + have g := weq_glue (x := x) (y := y) (U := winv v₁ ++ (y, x.2) :: winv v₂) (V := u₂ ++ + (y, x.2) :: u₁) hy + (c1.trans (c0.trans (c2.trans c3))) (by simp) (by simp) + (noLab_append.mpr ⟨noLab_winv.mpr h3, noLab_cons.mpr ⟨hy', noLab_winv.mpr h4⟩⟩) + (noLab_append.mpr ⟨h2, noLab_cons.mpr ⟨hy', h1⟩⟩) + refine (g.trans ?_) + have hm : ∀ {a : List Letter}, NoLab a y → (a.map fun l => (if l.1 = y then x.1 else l.1, l.2)) + = a := + fun h => map_rename_of_noLab h + have ha := noLab_append.mp hA.1 + have hb := noLab_append.mp hA.2 + have hu₂ := (noLab_cons.mp ha.2).2 + have hv₂ := (noLab_cons.mp hb.2).2 + have e3 : ((u₂ ++ (y, x.2) :: u₁ ++ (winv v₁ ++ (y, x.2) :: winv v₂)).map + fun l => (if l.1 = y then x.1 else l.1, l.2)) = u₂ ++ x :: (u₁ ++ winv v₁ ++ x :: winv v₂) + := by + simp only [List.map_append, List.map_cons, hm ha.1, hm hu₂, hm (noLab_winv.mpr hb.1), + hm (noLab_winv.mpr hv₂), ite_true, List.append_assoc, List.cons_append] + rw [e3] + exact WEq.refl _ + +theorem per_injOn {n : ℕ} (hn : 0 < n) : InjOn (per n) (Ico 0 n) := by + have hn' : (0 : ℝ) < n := by exact_mod_cast hn + have hpi := Real.pi_pos + intro x hx y hy he + have h1 : Circle.exp (2 * Real.pi * x / n) = Circle.exp (2 * Real.pi * y / n) := + Circle.ext (by simpa [per, cis', Circle.coe_exp] using he) + obtain ⟨k, hk⟩ := Circle.exp_eq_exp.mp h1 + have h2 : x = y + k * n := by + field_simp at hk + nlinarith + have h3 : (k : ℝ) * n < 1 * n := by nlinarith [hx.2, hy.1] + have h4 : (-1 : ℝ) * n < k * n := by nlinarith [hx.1, hy.2] + have h5 : (k : ℝ) < 1 := lt_of_mul_lt_mul_right h3 hn'.le + have h6 : (-1 : ℝ) < k := lt_of_mul_lt_mul_right h4 hn'.le + have h7 : k < 1 := by exact_mod_cast h5 + have h8 : -1 < k := by exact_mod_cast h6 + obtain rfl : k = 0 := by omega + simpa using h2 + +theorem per_image {n : ℕ} (hn : 0 < n) : per n '' Icc 0 n = Metric.sphere 0 1 := by + have hn' : (0 : ℝ) < n := by exact_mod_cast hn + have hpi := Real.pi_pos + ext z + constructor + · rintro ⟨x, -, rfl⟩ + exact mem_sphere_zero_iff_norm.mpr (norm_per _ _) + · intro hz + have h1 : ‖z‖ = 1 := mem_sphere_zero_iff_norm.mp hz + obtain ⟨t, ht, hw⟩ := exists_circle_angle 1 (⟨z, by simpa [Submonoid.unitSphere] using h1⟩ : + Circle) + refine ⟨t * n / (2 * Real.pi), ⟨by have := ht.1; positivity, ?_⟩, ?_⟩ + · rw [div_le_iff₀ (by positivity)] + nlinarith [ht.2] + · have h2 : (z : ℂ) = Circle.exp t := by + have := congrArg ((↑) : Circle → ℂ) hw + simpa using this + rw [h2, per, cis', Circle.coe_exp] + congr 2 + push_cast + have : (n : ℂ) ≠ 0 := by exact_mod_cast hn.ne' + have hp : (Real.pi : ℂ) ≠ 0 := by exact_mod_cast hpi.ne' + field_simp + +/-- The reparametrisation of the boundary that merges two sides. -/ +noncomputable def mergeG (x : ℝ) : ℝ := if x ≤ 2 then x / 2 else x - 1 + +theorem continuous_mergeG : Continuous mergeG := by + refine Continuous.if_le (by fun_prop) (by fun_prop) continuous_id continuous_const fun x hx => ?_ + have : x = 2 := hx + subst this + norm_num + +theorem strictMono_mergeG : StrictMono mergeG := by + intro x y h + simp only [mergeG] + split_ifs <;> linarith + +theorem mergeG_ge {x : ℝ} (h : 2 ≤ x) : mergeG x = x - 1 := by + rcases eq_or_lt_of_le h with rfl | h + · norm_num [mergeG] + · exact ite_eq_right (not_le.mpr h) + +/-- Two adjacent sides with labels that occur once are merged. -/ +theorem exists_isPolyMap_merge {B : List Letter} {p q : ℕ} {e e' : Bool} (hpq : p ≠ q) + (hp : NoLab B p) (hq : NoLab B q) : + ∃ θ, IsPolyMap (sW ((p, e) :: B)) (sW ((p, e) :: (q, e') :: B)) θ ∧ + ∀ x ∈ Icc (0 : ℝ) ((B.length + 2 : ℕ) : ℝ), θ (0, per (B.length + 2) x) = (0, per + (B.length + 1) (mergeG x)) := by + classical + set n := B.length + 1 with hn + have hn0 : 0 < n := by omega + have hnr : (0 : ℝ) ≤ B.length := Nat.cast_nonneg _ + have hnn : (n : ℝ) = B.length + 1 := by rw [hn]; push_cast; ring + let β : ℝ → ℂ := fun x => per n (mergeG x) + have e0 : mergeG 0 = 0 := by norm_num [mergeG] + have e2 : mergeG ((n + 1 : ℕ) : ℝ) = n := by + rw [mergeG_ge (by push_cast; linarith)] + push_cast + ring + have himg : mergeG '' Icc 0 ((n + 1 : ℕ) : ℝ) = Icc 0 (n : ℝ) := by + apply Subset.antisymm + · rintro _ ⟨x, hx, rfl⟩ + refine ⟨?_, ?_⟩ + · rw [← e0] + exact strictMono_mergeG.monotone hx.1 + · rw [← e2] + exact strictMono_mergeG.monotone hx.2 + · intro y hy + have := intermediate_value_Icc (a := 0) (b := ((n + 1 : ℕ) : ℝ)) (by positivity) + continuous_mergeG.continuousOn + rw [e0, e2] at this + exact this hy + obtain ⟨Φ, Φ', m, hv⟩ := exists_polygon_map (K := closedBall (0 : ℂ) 1) isClosedDisc_closedBall.1 + (m := n + 1) (by omega) (β := β) ((continuous_per n).comp continuous_mergeG).continuousOn + (by + intro x hx y hy he + have h1 : ∀ z ∈ Ico 0 ((n + 1 : ℕ) : ℝ), mergeG z ∈ Ico 0 (n : ℝ) := fun z hz => + ⟨by rw [← e0]; exact strictMono_mergeG.monotone hz.1, + by rw [← e2]; exact strictMono_mergeG hz.2⟩ + exact strictMono_mergeG.injective (per_injOn hn0 (h1 x hx) (h1 y hy) he)) + (by + simp only [β, e0, e2] + have := per_add_self hn0.ne' 0 + rw [zero_add] at this + rw [this]) + (by + rw [isClosedDisc_closedBall.2, ← per_image hn0, ← himg, image_image]) + set W0 := sW ((p, e) :: B) with hW0 + set W1 := sW ((p, e) :: (q, e') :: B) with hW1 + have e3 : W1 0 = (p, e) :: (q, e') :: B := by simp [hW1, sW] + have e4 : W0 0 = (p, e) :: B := by simp [hW0, sW] + have e5 : ∀ s, s ≠ 0 → W1 s = [] := fun s h => by simp [hW1, sW, update_of_ne h, nW] + have e6 : ∀ s, s ≠ 0 → W0 s = [] := fun s h => by simp [hW0, sW, update_of_ne h, nW] + have s0 : ∀ {V : ℕ → List Letter}, (∀ s, s ≠ 0 → V s = []) → ∀ a ∈ Dsk V, a.1 = 0 := by + intro V h a ha + by_contra h' + exact ha.1 (h _ h') + have hlen1 : (W1 0).length = n + 1 := by rw [e3]; simp [hn] + have hlen0 : (W0 0).length = n := by rw [e4]; simp [hn] + have hball : ∀ {V : ℕ → List Letter} (a : ℕ × ℂ), a ∈ Dsk V → a.2 ∈ closedBall (0 : ℂ) 1 := + fun a h => mem_closedBall_zero_iff.mpr h.2 + have hside : ∀ r ε t, r < B.length → t ∈ Icc (0 : ℝ) 1 → + Φ (sdPt (n + 1) (r + 2) ε t) = sdPt n (r + 1) ε t := by + intro r ε t hr ht + have hs := sv_mem ε ht + have h1 : sdPt (n + 1) (r + 2) ε t = per (n + 1) (((r + 2 : ℕ) : ℝ) + sv ε t) := rfl + have h2 : sdPt n (r + 1) ε t = per n (((r + 1 : ℕ) : ℝ) + sv ε t) := rfl + have h3 : ((r + 1 : ℕ) : ℝ) ≤ B.length := by exact_mod_cast hr + push_cast at h3 + have h4 : (0 : ℝ) ≤ r := Nat.cast_nonneg r + rw [h1, h2, hv _ ⟨by push_cast; linarith [hs.1], by push_cast; rw [hnn]; linarith [hs.2]⟩] + simp only [β] + rw [mergeG_ge (by push_cast; linarith [hs.1])] + congr 1 + push_cast + ring + have hone : ∀ {V : ℕ → List Letter} {c : ℕ} (b : List Letter), NoLab b c → V = sW b → ∀ (i r : ℕ) + (ε : Bool), + (V i)[r]? = some (c, ε) → False := by + intro V c b hb hV i r ε h + rw [hV] at h + by_cases hi : i = 0 + · subst hi + have h1 : (sW b 0) = b := by simp [sW] + rw [h1] at h + exact hb _ (List.mem_of_getElem? h) rfl + · simp [sW, update_of_ne hi, nW] at h + refine ⟨fun a => (a.1, Φ a.2), IsPolyMap.of_sides' (Y := {p, q}) (Z + := {p}) ?_ ?_ ?_ ?_ ?_ ?_ ?_ ?_, + fun x hx => ?_⟩ + · exact continuous_fst.continuousOn.prodMk (m.2.2.2.2.1.comp continuous_snd.continuousOn + fun a ha => hball a ha) + · rintro ⟨s, z⟩ hz + obtain rfl : s = 0 := s0 e5 _ hz + refine ⟨by simp [e4], ?_⟩ + exact mem_closedBall_zero_iff.mp (m.1 (hball _ hz)) + · rintro ⟨s, z⟩ hz + obtain rfl : s = 0 := s0 e6 _ hz + refine ⟨(0, Φ' z), ⟨by simp [e3], mem_closedBall_zero_iff.mp (m.2.1 (hball _ hz))⟩, ?_⟩ + simp only [m.2.2.2.1 (hball _ hz)] + · rintro ⟨s, z⟩ hz ⟨s', z'⟩ hz' he + obtain rfl : s = 0 := s0 e5 _ hz + obtain rfl : s' = 0 := s0 e5 _ hz' + have h1 : Φ z = Φ z' := (Prod.mk.inj he).2 + have h2 : z = z' := by + have h3 : Φ' (Φ z) = z := m.2.2.1 (hball _ hz) + have h4 : Φ' (Φ z') = z' := m.2.2.1 (hball _ hz') + rw [← h3, ← h4, h1] + rw [h2] + exact .refl _ + · intro s r c ε h hc + by_cases hs : s ≠ 0 + · rw [e5 s hs] at h + simp at h + obtain rfl : s = 0 := not_not.mp hs + rw [e3] at h + match r, h with + | 0, h => + have : (p, e) = (c, ε) := by simpa using h + exact absurd (.inl (Prod.mk.inj this).1.symm) hc + | 1, h => + have : (q, e') = (c, ε) := by simpa using h + exact absurd (.inr (Prod.mk.inj this).1.symm) hc + | r + 2, h => + rw [List.getElem?_cons_succ, List.getElem?_cons_succ] at h + have hr : r < B.length := (List.getElem?_eq_some_iff.mp h).1 + refine ⟨0, r + 1, ε, by rw [e4, List.getElem?_cons_succ]; exact h, fun t ht => ?_⟩ + simp only [hlen1, hlen0, hside r ε t hr ht] + · intro s r c ε h hc + by_cases hs : s ≠ 0 + · rw [e6 s hs] at h + simp at h + obtain rfl : s = 0 := not_not.mp hs + rw [e4] at h + cases r with + | zero => + have : (p, e) = (c, ε) := by simpa using h + exact absurd (Prod.mk.inj this).1.symm hc + | succ r => + rw [List.getElem?_cons_succ] at h + have hr : r < B.length := (List.getElem?_eq_some_iff.mp h).1 + refine ⟨0, r + 2, ε, by rw [e3, List.getElem?_cons_succ, List.getElem?_cons_succ]; exact h, + fun t ht => ?_⟩ + simp only [hlen1, hlen0, hside r ε t hr ht] + · intro i j r r' k ε ε' hk h1 h2 + obtain rfl : k = p := hk + have key : ∀ i r ε, (W0 i)[r]? = some (k, ε) → i = 0 ∧ r = 0 := by + intro i r ε h + by_cases hi : i = 0 + · subst hi + rw [e4] at h + cases r with + | zero => exact ⟨rfl, rfl⟩ + | succ r => + rw [List.getElem?_cons_succ] at h + exact (hp _ (List.mem_of_getElem? h) rfl).elim + · rw [e6 i hi] at h + simp at h + obtain ⟨rfl, rfl⟩ := key _ _ _ h1 + obtain ⟨rfl, rfl⟩ := key _ _ _ h2 + rfl + · intro i j r r' k ε ε' t hk h1 h2 _ + have key : ∀ i r ε, (W1 i)[r]? = some (k, ε) → + i = 0 ∧ ((k = p ∧ r = 0 ∧ ε = e) ∨ (k = q ∧ r = 1 ∧ ε = e')) := by + intro i r ε h + by_cases hi : i = 0 + · subst hi + rw [e3] at h + match r, h with + | 0, h => + have : (p, e) = (k, ε) := by simpa using h + exact ⟨rfl, .inl ⟨(Prod.mk.inj this).1.symm, rfl, (Prod.mk.inj this).2.symm⟩⟩ + | 1, h => + have : (q, e') = (k, ε) := by simpa using h + exact ⟨rfl, .inr ⟨(Prod.mk.inj this).1.symm, rfl, (Prod.mk.inj this).2.symm⟩⟩ + | r + 2, h => + have h' : B[r]? = some (k, ε) := by + rwa [List.getElem?_cons_succ, List.getElem?_cons_succ] at h + have h'' := List.mem_of_getElem? h' + rcases hk with hk | hk + · exact (hp _ h'' hk).elim + · exact (hq _ h'' hk).elim + · rw [e5 i hi] at h + simp at h + obtain ⟨rfl, h3⟩ := key _ _ _ h1 + obtain ⟨rfl, h4⟩ := key _ _ _ h2 + rcases h3 with ⟨h5, rfl, rfl⟩ | ⟨h5, rfl, rfl⟩ <;> rcases h4 with ⟨h6, rfl, rfl⟩ | ⟨h6, rfl, + rfl⟩ + · rfl + · exact absurd (h5.symm.trans h6) hpq + · exact absurd (h6.symm.trans h5) hpq + · rfl + · change (0, Φ (per (n + 1) x)) = _ + rw [hv x hx] + +theorem WEq.merge {B : List Letter} {p q : ℕ} {e e' : Bool} (hpq : p ≠ q) (hp : NoLab B p) + (hq : NoLab B q) : + WEq.{uu} ((p, e) :: B) ((p, e) :: (q, e') :: B) := by + obtain ⟨θ, hθ, -⟩ := exists_isPolyMap_merge (e := e) (e' := e') hpq hp hq + exact hθ.peq (finW_sW _) + +/-- Sign flips of the labels in `f`. -/ +def flipL (f : ℕ → Bool) (l : Letter) : Letter := (l.1, xor (f l.1) l.2) + +theorem sdPt_not (n p : ℕ) (b : Bool) (t : ℝ) : sdPt n p (!b) (1 - t) = sdPt n p b t := by + cases b <;> simp [sdPt] + +/-- Flipping the signs of some labels. -/ +theorem WEq.flip (w : List Letter) (c : ℕ → Bool) : WEq.{uu} w (w.map (flipL c)) := by + intro T _ _ + have hlen : ∀ i, (sW (w.map (flipL c)) i).length = (sW w i).length := fun i => by + by_cases hi : i = 0 + · subst hi + simp [sW] + · simp [sW, update_of_ne hi, nW] + have hD : Dsk (sW (w.map (flipL c))) = Dsk (sW w) := by + ext a + have := hlen a.1 + simp only [Dsk, mem_ofPred_eq, ne_eq, ← List.length_eq_zero_iff, this] + have hget : ∀ i p, (sW (w.map (flipL c)) i)[p]? = ((sW w i)[p]?).map (flipL c) := fun i p => by + by_cases hi : i = 0 + · subst hi + have e1 : ∀ v : List Letter, sW v 0 = v := fun v => by simp [sW] + rw [e1, e1, List.getElem?_map] + · have e1 : ∀ v : List Letter, sW v i = [] := fun v => by simp [sW, update_of_ne hi, nW] + rw [e1, e1] + simp + have hS : ∀ a b, Stp (sW w) a b → Stp (sW (w.map (flipL c))) a b := by + rintro _ _ ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ + by_cases hk : c k = true + · refine ⟨i, j, p, q, k, !ε, !ε', 1 - t, by simp [hget, h1, flipL, hk], by simp [hget, h2, + flipL, hk], h3, + ⟨by linarith [ht.2], by linarith [ht.1]⟩, ?_, ?_⟩ + · rw [hlen, sdPt_not] + · rw [hlen, sdPt_not] + · exact ⟨i, j, p, q, k, ε, ε', t, by simp [hget, h1, flipL, hk], by simp [hget, h2, flipL, + hk], h3, ht, + by rw [hlen], by rw [hlen]⟩ + have hS' : ∀ a b, Stp (sW (w.map (flipL c))) a b → Stp (sW w) a b := by + rintro _ _ ⟨i, j, p, q, k, ε, ε', t, h1, h2, h3, ht, rfl, rfl⟩ + rw [hget, Option.map_eq_some_iff] at h1 h2 + obtain ⟨⟨k₁, ε₁⟩, a1, a2⟩ := h1 + obtain ⟨⟨k₂, ε₂⟩, b1, b2⟩ := h2 + simp only [flipL, Prod.mk.injEq] at a2 b2 + obtain ⟨rfl, a3⟩ := a2 + obtain ⟨hk2, b3⟩ := b2 + subst hk2 + by_cases hk : c k₂ = true + · simp only [hk, Bool.true_xor] at a3 b3 + subst a3 + subst b3 + refine ⟨i, j, p, q, k₂, ε₁, ε₂, 1 - t, a1, b1, h3, ⟨by linarith [ht.2], + by linarith [ht.1]⟩, ?_, ?_⟩ + · have := sdPt_not (sW w i).length p ε₁ (1 - t) + rw [sub_sub_cancel] at this + rw [hlen, this] + · have := sdPt_not (sW w j).length q ε₂ (1 - t) + rw [sub_sub_cancel] at this + rw [hlen, this] + · simp only [Bool.not_eq_true] at hk + simp only [hk, Bool.false_xor] at a3 b3 + subst a3 + subst b3 + exact ⟨i, j, p, q, k₂, ε₁, ε₂, t, a1, b1, h3, ht, by rw [hlen], by rw [hlen]⟩ + have hSe : Stp (sW (w.map (flipL c))) = Stp (sW w) := by + ext a b + exact ⟨hS' a b, hS a b⟩ + have hP : ∀ f : ℕ × ℂ → T, Presents (sW w) f ↔ Presents (sW (w.map (flipL c))) f := fun f => by + unfold Presents PRel + rw [hD, hSe] + exact exists_congr hP + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/WordSide.lean b/LeanPool/GraphMinor/Surface/WordSide.lean new file mode 100644 index 0000000000..72f4fbdfe7 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/WordSide.lean @@ -0,0 +1,206 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.Polygon +public import LeanPool.GraphMinor.Surface.WordRules + +/-! +# Sides of a family of words + +We say that a family of words is paired if each label is on at most two sides. A point of a side +that is not a corner is +related to at most one other point, the point with the same parameter on the other side with this +label +(`PRel.eq_or_stp`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +/-- Each label is on at most two sides. -/ +def IsPaired (W : ℕ → List Letter) : Prop := + ∀ k, {s : ℕ × ℕ | ∃ e, (W s.1)[s.2]? = some (k, e)}.encard ≤ 2 + +/-- The point of the side `p` of the word `i` at the distance `u` from the start of the side. -/ +noncomputable def spt (W : ℕ → List Letter) (i p : ℕ) (u : ℝ) : ℕ × ℂ := (i, per (W i).length + (p + u)) + +/-- The change of the offset between two sides with these signs. -/ +noncomputable def flp (e e' : Bool) (u : ℝ) : ℝ := if e = e' then u else 1 - u + +theorem flp_mem {e e' : Bool} {u : ℝ} (hu : u ∈ Icc (0 : ℝ) 1) : flp e e' u ∈ Icc (0 : ℝ) 1 := by + unfold flp + split_ifs + · exact hu + · exact ⟨by linarith [hu.2], by linarith [hu.1]⟩ + +theorem flp_mem' {e e' : Bool} {u : ℝ} (hu : u ∈ Ioo (0 : ℝ) 1) : flp e e' u ∈ Ioo (0 : ℝ) 1 := by + unfold flp + split_ifs + · exact hu + · exact ⟨by linarith [hu.2], by linarith [hu.1]⟩ + +theorem flp_flp (e e' : Bool) (u : ℝ) : flp e' e (flp e e' u) = u := by + unfold flp + by_cases h : e = e' + · simp [h] + · have h' : ¬ e' = e := fun he => h he.symm + simp [h, h'] + +/-- The offset of the parameter `t` on a side with sign `e`. -/ +noncomputable def ofs (e : Bool) (t : ℝ) : ℝ := if e then t else 1 - t + +theorem ofs_ofs (e : Bool) (t : ℝ) : ofs e (ofs e t) = t := by + cases e <;> simp [ofs] + +theorem ofs_flp (e e' : Bool) (u : ℝ) : ofs e' (ofs e u) = flp e e' u := by + cases e <;> cases e' <;> simp [ofs, flp] + +theorem ofs_mem {e : Bool} {u : ℝ} (hu : u ∈ Icc (0 : ℝ) 1) : ofs e u ∈ Icc (0 : ℝ) 1 := by + cases e + · simpa [ofs] using ⟨hu.2, hu.1⟩ + · simpa [ofs] using hu + +theorem sdPt_eq (n p : ℕ) (e : Bool) (t : ℝ) : sdPt n p e t = per n (p + ofs e t) := rfl + +/-- A step in terms of offsets. -/ +theorem stp_iff {W : ℕ → List Letter} {a b : ℕ × ℂ} : Stp W a b ↔ + ∃ (i j p q k : ℕ) (e e' : Bool) (u : ℝ), (W i)[p]? = some (k, e) ∧ (W j)[q]? = some (k, e') ∧ + (i, p) ≠ (j, q) ∧ + u ∈ Icc (0 : ℝ) 1 ∧ a = spt W i p u ∧ b = spt W j q (flp e e' u) := by + constructor + · rintro ⟨i, j, p, q, k, e, e', t, h1, h2, h3, ht, rfl, rfl⟩ + refine ⟨i, j, p, q, k, e, e', ofs e t, h1, h2, h3, ofs_mem ht, rfl, ?_⟩ + rw [spt, ← ofs_flp, ofs_ofs] + rfl + · rintro ⟨i, j, p, q, k, e, e', u, h1, h2, h3, hu, rfl, rfl⟩ + refine ⟨i, j, p, q, k, e, e', ofs e u, h1, h2, h3, ofs_mem hu, ?_, ?_⟩ + · rw [spt, sdPt_eq, ofs_ofs] + · rw [spt, sdPt_eq, ofs_flp] + +theorem side_unique {n p p' : ℕ} (hp : p < n) (hp' : p' < n) {u v : ℝ} (hu : u ∈ Ioo (0 : ℝ) 1) + (hv : v ∈ Icc (0 : ℝ) 1) (he : per n (p + u) = per n (p' + v)) : p = p' ∧ u = v := by + have hn : 0 < n := by omega + have hp1 : (p : ℝ) + 1 ≤ n := by exact_mod_cast hp + have hp1' : (p' : ℝ) + 1 ≤ n := by exact_mod_cast hp' + have hp0 : (0 : ℝ) ≤ p := Nat.cast_nonneg p + have hp0' : (0 : ℝ) ≤ p' := Nat.cast_nonneg p' + have hx : (p : ℝ) + u ∈ Ico (0 : ℝ) n := ⟨by linarith [hu.1], by linarith [hu.2]⟩ + have hn' : (0 : ℝ) ∈ Ico (0 : ℝ) n := ⟨le_rfl, by exact_mod_cast hn⟩ + rcases eq_or_lt_of_le (show (p' : ℝ) + v ≤ n by linarith [hv.2]) with h1 | h1 + · have h2 : per n (p + u) = per n 0 := by + rw [he, h1] + have := per_add_self hn.ne' 0 + simpa using this + have := per_injOn hn hx hn' h2 + linarith [hu.1] + · have h2 := per_injOn hn hx ⟨by linarith [hv.1], h1⟩ he + have hpq : p = p' := by + rcases lt_trichotomy p p' with h3 | h3 | h3 + · have : (p : ℝ) + 1 ≤ p' := by exact_mod_cast h3 + linarith [hu.2, hv.1] + · exact h3 + · have : (p' : ℝ) + 1 ≤ p := by exact_mod_cast h3 + linarith [hu.1, hv.2] + subst hpq + exact ⟨rfl, by linarith⟩ + +variable {W : ℕ → List Letter} + +theorem lt_length {i p k : ℕ} {e : Bool} (h : (W i)[p]? = some (k, e)) : p < (W i).length := + (List.getElem?_eq_some_iff.mp h).1 + +/-- A third side with a label is one of two given sides. -/ +theorem IsPaired.third (hW : IsPaired W) {i j l p q r k : ℕ} {e e' e'' : Bool} (h1 : (W i)[p]? + = some (k, e)) + (h2 : (W j)[q]? = some (k, e')) (h3 : (W l)[r]? = some (k, e'')) (hne : (i, p) ≠ (j, q)) : + (l, r) = (i, p) ∨ (l, r) = (j, q) := by + classical + by_contra hcon + push Not at hcon + have hs : ({(l, r), (i, p), (j, q)} : Set (ℕ × ℕ)) ⊆ {s : ℕ × ℕ | ∃ e, (W s.1)[s.2]? = some + (k, e)} := by + rintro x (rfl | rfl | rfl) + · exact ⟨e'', h3⟩ + · exact ⟨e, h1⟩ + · exact ⟨e', h2⟩ + have h4 := (encard_le_encard hs).trans (hW k) + rw [encard_insert_of_notMem (by simp [hcon.1, hcon.2]), encard_pair hne] at h4 + norm_num at h4 + +/-- Steps out of a point of a side that is not a corner go to the other side with the label. -/ +theorem stp_of_side (_hW : IsPaired W) {i p k : ℕ} {e : Bool} (h : (W i)[p]? = some (k, e)) {u : ℝ} + (hu : u ∈ Ioo (0 : ℝ) 1) {b : ℕ × ℂ} (hs : Stp W (spt W i p u) b) : + ∃ j q e', (W j)[q]? = some (k, e') ∧ (i, p) ≠ (j, q) ∧ b = spt W j q (flp e e' u) := by + obtain ⟨i', j, p', q, k', e₁, e', v, h1, h2, h3, hv, ha, rfl⟩ := stp_iff.mp hs + have hi : i = i' := congrArg Prod.fst ha + subst hi + have hsnd : per (W i).length (p + u) = per (W i).length (p' + v) := congrArg Prod.snd ha + obtain ⟨rfl, rfl⟩ := side_unique (lt_length h) (lt_length h1) hu hv hsnd + rw [h] at h1 + obtain ⟨rfl, rfl⟩ := Prod.mk.inj (Option.some.inj h1) + exact ⟨j, q, e', h2, h3, rfl⟩ + +/-- The pasting class of a point of a side that is not a corner has at most two points. -/ +theorem PRel.eq_or_stp (hW : IsPaired W) {i p k : ℕ} {e : Bool} (h : (W i)[p]? = some + (k, e)) {u : ℝ} + (hu : u ∈ Ioo (0 : ℝ) 1) {b : ℕ × ℂ} (hr : PRel W (spt W i p u) b) : b = spt W i p u ∨ Stp W + (spt W i p u) b := by + let a := spt W i p u + let C : Set (ℕ × ℂ) := {x | x = a ∨ Stp W a x} + have hstep : ∀ x y, Stp W x y → x ∈ C → y ∈ C := by + rintro x y hxy (rfl | hx) + · exact .inr hxy + · obtain ⟨j, q, e', h2, h3, rfl⟩ := stp_of_side hW h hu hx + obtain ⟨j', q', e'', h4, h5, rfl⟩ := stp_of_side hW h2 (flp_mem' hu) hxy + have h6 := hW.third h h2 h4 h3 + rcases h6 with h6 | h6 + · obtain ⟨rfl, rfl⟩ := Prod.mk.inj h6 + rw [h] at h4 + obtain ⟨-, rfl⟩ := Prod.mk.inj (Option.some.inj h4) + rw [flp_flp] + exact .inl rfl + · exact absurd h6.symm h5 + have hsym : ∀ x y, Stp W x y → Stp W y x := by + rintro _ _ ⟨i, j, p, q, k, e, e', t, h1, h2, h3, ht, rfl, rfl⟩ + exact ⟨j, i, q, p, k, e', e, t, h2, h1, h3.symm, ht, rfl, rfl⟩ + have key : ∀ x y, PRel W x y → (x ∈ C ↔ y ∈ C) := by + intro x y hxy + induction hxy with + | rel x y hs => exact ⟨hstep x y hs, hstep y x (hsym x y hs)⟩ + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + exact (key a b hr).mp (.inl rfl) + +/-- A point inside a disc is related only to itself. -/ +theorem PRel.eq_of_lt {a b : ℕ × ℂ} (hr : PRel W a b) (ha : ‖a.2‖ < 1) : b = a := by + have hn : ∀ x y, Stp W x y → ‖x.2‖ = 1 ∧ ‖y.2‖ = 1 := by + rintro _ _ ⟨i, j, p, q, k, e, e', t, -, -, -, -, rfl, rfl⟩ + exact ⟨norm_per _ _, norm_per _ _⟩ + have key : ∀ x y, PRel W x y → (x = a ↔ y = a) := by + intro x y hxy + induction hxy with + | rel x y hs => + obtain ⟨h1, h2⟩ := hn x y hs + constructor + · rintro rfl + exact absurd h1 ha.ne + · rintro rfl + exact absurd h2 ha.ne + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + exact (key a b hr).mp rfl + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/WordSlide.lean b/LeanPool/GraphMinor/Surface/WordSlide.lean new file mode 100644 index 0000000000..10af712b76 --- /dev/null +++ b/LeanPool/GraphMinor/Surface/WordSlide.lean @@ -0,0 +1,367 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.WordRules + +/-! +# Blocks of a word + +A handle `u v u⁻¹ v⁻¹`, a cross-cap `y y` and a hole `t s t⁻¹` can be moved past any part of a word +(`slide_block`). For a product of blocks `H` this gives `slide`: the two parts before `H` can be +exchanged. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Function + +universe uu + +theorem WEq.of_eq {a b : List Letter} (h : a = b) : WEq.{uu} a b := by rw [h]; exact WEq.refl _ + +theorem WEq.rot' {w w' : List Letter} (a b : List Letter) (h : w = a ++ b) (h' : w' + = b ++ a) : WEq.{uu} w w' := by + rw [h, h'] + exact WEq.rot a b + +theorem ruleA' (x : Letter) (u₁ u₂ v₁ v₂ : List Letter) (h1 : NoLab u₁ x.1) (h2 : NoLab u₂ x.1) + (h3 : NoLab v₁ x.1) (h4 : NoLab v₂ x.1) {w w' : List Letter} + (h : w = u₁ ++ x :: (u₂ ++ v₁ ++ linv x :: v₂)) (h' : w' = u₂ ++ x :: + (u₁ ++ v₂ ++ linv x :: v₁)) : + WEq.{uu} w w' := by + rw [h, h'] + exact ruleA x h1 h2 h3 h4 + +theorem ruleB' (x : Letter) (u₁ u₂ v₁ v₂ : List Letter) (h1 : NoLab u₁ x.1) (h2 : NoLab u₂ x.1) + (h3 : NoLab v₁ x.1) (h4 : NoLab v₂ x.1) {w w' : List Letter} + (h : w = u₁ ++ x :: (u₂ ++ v₁ ++ x :: v₂)) (h' : w' = u₂ ++ x :: (u₁ ++ winv v₁ ++ x :: winv + v₂)) : + WEq.{uu} w w' := by + rw [h, h'] + exact ruleB x h1 h2 h3 h4 + +/-- A hole slides. -/ +theorem slide_hole (t : Letter) {s A B : List Letter} (hs : NoLab s t.1) (hA : NoLab A t.1) + (hB : NoLab B t.1) : + WEq.{uu} (A ++ B ++ t :: s ++ [linv t]) (B ++ A ++ t :: s ++ [linv t]) := by + have hAB : NoLab (A ++ B) t.1 := noLab_append.mpr ⟨hA, hB⟩ + have c0 : WEq.{uu} (A ++ B ++ t :: s ++ [linv t]) (t :: s ++ linv t :: (A ++ B)) := + WEq.rot' (A ++ B) (t :: s ++ [linv t]) (by simp) (by simp) + have c1 : WEq.{uu} (t :: s ++ linv t :: (A ++ B)) (t :: (A ++ B ++ linv t :: s)) := + ruleA' t [] [] s (A ++ B) noLab_nil noLab_nil hs hAB (by simp) (by simp) + have c2 : WEq.{uu} (t :: (A ++ B ++ linv t :: s)) (A ++ t :: (s ++ linv t :: B)) := + ruleA' t [] A B s noLab_nil hA hB hs (by simp) (by simp) + have c3 : WEq.{uu} (A ++ t :: (s ++ linv t :: B)) (B ++ A ++ t :: s ++ [linv t]) := + WEq.rot' (A ++ t :: s ++ [linv t]) B (by simp) (by simp) + exact c0.trans (c1.trans (c2.trans c3)) + +/-- The fixed flip of one label. -/ +def flipAt (c : ℕ) : ℕ → Bool := fun n => decide (n = c) + +theorem map_flipAt_of_noLab {w : List Letter} {c : ℕ} (h : NoLab w c) : w.map (flipL (flipAt c)) + = w := by + conv_rhs => rw [← List.map_id w] + refine List.map_congr_left fun l hl => ?_ + have := h l hl + simp [flipL, flipAt, this] + +theorem flipL_self (l : Letter) : flipL (flipAt l.1) l = linv l := by + simp [flipL, flipAt, linv] + +theorem flipL_linv (l : Letter) : flipL (flipAt l.1) (linv l) = l := by + simp [flipL, flipAt, linv] + +/-- A cross-cap slides. -/ +theorem slide_cap (y : Letter) {A B : List Letter} (hA : NoLab A y.1) (hB : NoLab B y.1) : + WEq.{uu} (A ++ B ++ [y, y]) (B ++ A ++ [y, y]) := by + have hB' := noLab_winv.mpr hB + have hA' := noLab_winv.mpr hA + have c0 : WEq.{uu} (A ++ B ++ [y, y]) (y :: (A ++ B ++ [y])) := + WEq.rot' (A ++ B ++ [y]) [y] (by simp) (by simp) + have c1 : WEq.{uu} (y :: (A ++ B ++ [y])) (A ++ y :: (winv B ++ [y])) := + ruleB' y [] A B [] noLab_nil hA hB noLab_nil (by simp) (by simp [winv]) + have c2 : WEq.{uu} (A ++ y :: (winv B ++ [y])) (y :: (winv B ++ y :: A)) := + WEq.rot' A (y :: (winv B ++ [y])) rfl (by simp) + have c3 : WEq.{uu} (y :: (winv B ++ y :: A)) (winv B ++ y :: y :: winv A) := + ruleB' y [] (winv B) [] A noLab_nil hB' noLab_nil hA (by simp) (by simp [winv]) + have c4 : WEq.{uu} (winv B ++ y :: y :: winv A) (y :: y :: (winv A ++ winv B)) := + WEq.rot' (winv B) (y :: y :: winv A) rfl (by simp) + have c5 : WEq.{uu} (y :: y :: (winv A ++ winv B)) (B ++ A ++ [linv y, linv y]) := by + have := WEq.rev (y :: y :: (winv A ++ winv B)) + refine this.trans (WEq.of_eq ?_) + simp [winv_append, winv_cons, winv_winv] + have c6 : WEq.{uu} (B ++ A ++ [linv y, linv y]) (B ++ A ++ [y, y]) := by + refine (WEq.flip _ (flipAt y.1)).trans (WEq.of_eq ?_) + rw [List.map_append, List.map_append, map_flipAt_of_noLab hB, map_flipAt_of_noLab hA] + simp [flipL_linv] + exact c0.trans (c1.trans (c2.trans (c3.trans (c4.trans (c5.trans c6))))) + +/-- The handle on the letters `u`, `v`. -/ +def hndB (u v : Letter) : List Letter := [u, v, linv u, linv v] + +/-- A handle slides. -/ +theorem slide_hnd {u v : Letter} (huv : u.1 ≠ v.1) {A B : List Letter} (hA : NoLab A u.1) + (hB : NoLab B u.1) + (hA' : NoLab A v.1) (hB' : NoLab B v.1) : + WEq.{uu} (A ++ B ++ hndB u v) (B ++ A ++ hndB u v) := by + have hvu : v.1 ≠ u.1 := fun h => huv h.symm + have n1 : NoLab [linv v] u.1 := noLab_cons.mpr ⟨hvu, noLab_nil⟩ + have n2 : NoLab [v] u.1 := noLab_cons.mpr ⟨hvu, noLab_nil⟩ + have n3 : NoLab [u] v.1 := noLab_cons.mpr ⟨huv, noLab_nil⟩ + have n4 : NoLab [linv u] v.1 := noLab_cons.mpr ⟨huv, noLab_nil⟩ + have c0 : WEq.{uu} (A ++ B ++ hndB u v) (B ++ u :: v :: linv u :: linv v :: A) := + WEq.rot' A (B ++ hndB u v) (by simp) (by simp [hndB]) + have c1 : WEq.{uu} (B ++ u :: v :: linv u :: linv v :: A) (u :: (B ++ linv v :: A ++ linv u :: + [v])) := + ruleA' u B [] [v] (linv v :: A) hB noLab_nil n2 (noLab_cons.mpr ⟨hvu, hA⟩) (by simp) (by simp) + have c2 : WEq.{uu} (u :: (B ++ linv v :: A ++ linv u :: [v])) (linv u :: v :: u :: + (B ++ linv v :: A)) := + WEq.rot' (u :: (B ++ linv v :: A)) (linv u :: [v]) (by simp) (by simp) + have c3 : WEq.{uu} (linv u :: v :: u :: (B ++ linv v :: A)) (u :: v :: linv u :: + (A ++ linv v :: B)) := + ruleA' v [linv u] [u] B A n4 n3 hB' hA' (by simp) (by simp) + have c4 : WEq.{uu} (u :: v :: linv u :: (A ++ linv v :: B)) (linv v :: + (B ++ u :: v :: linv u :: A)) := + WEq.rot' (u :: v :: linv u :: A) (linv v :: B) (by simp) (by simp) + have c5 : WEq.{uu} (linv v :: (B ++ u :: v :: linv u :: A)) (u :: (linv v :: B ++ A ++ linv u :: + [v])) := + ruleA' u (linv v :: B) [] [v] A (noLab_cons.mpr ⟨hvu, hB⟩) noLab_nil n2 hA (by simp) (by simp) + have c6 : WEq.{uu} (u :: (linv v :: B ++ A ++ linv u :: [v])) (B ++ A ++ [linv u, v, u, linv v]) + := + WEq.rot' [u, linv v] (B ++ A ++ [linv u, v]) (by simp) (by simp) + have c7 : WEq.{uu} (B ++ A ++ [linv u, v, u, linv v]) (B ++ A ++ hndB u v) := by + refine (WEq.flip _ (flipAt u.1)).trans (WEq.of_eq ?_) + rw [List.map_append, List.map_append, map_flipAt_of_noLab hB, map_flipAt_of_noLab hA] + simp [hndB, flipL, flipAt, linv, hvu] + exact c0.trans (c1.trans (c2.trans (c3.trans (c4.trans (c5.trans (c6.trans c7)))))) + +/-- `w` has no label of `H`. -/ +def DisjL (H w : List Letter) : Prop := ∀ l ∈ H, NoLab w l.1 + +/-- The blocks of a word. -/ +inductive IsBlock : List Letter → Prop + | hnd (u v : Letter) (h : u.1 ≠ v.1) : IsBlock (hndB u v) + | cap (y : Letter) : IsBlock [y, y] + | hole (t : Letter) (s : List Letter) (h : NoLab s t.1) : IsBlock (t :: s ++ [linv t]) + +/-- Any block slides. -/ +theorem slide_block {U A B : List Letter} (hU : IsBlock U) (hA : DisjL U A) (hB : DisjL U B) : + WEq.{uu} (A ++ B ++ U) (B ++ A ++ U) := by + cases hU with + | hnd u v h => + have h1 : u ∈ hndB u v := by simp [hndB] + have h2 : v ∈ hndB u v := by simp [hndB] + exact slide_hnd h (hA u h1) (hB u h1) (hA v h2) (hB v h2) + | cap y => exact slide_cap y (hA y (by simp)) (hB y (by simp)) + | hole t s h => + have h1 : t ∈ t :: s ++ [linv t] := by simp + have := slide_hole.{uu} t h (hA t h1) (hB t h1) + simpa [List.append_assoc] using this + +/-- Products of blocks with pairwise disjoint labels. -/ +inductive Blocks : List Letter → Prop + | nil : Blocks [] + | cons {U H : List Letter} : IsBlock U → DisjL U H → Blocks H → Blocks (U ++ H) + +theorem DisjL.symm {a b : List Letter} (h : DisjL a b) : DisjL b a := by + intro l hl m hm he + exact h m hm l hl he.symm + +theorem DisjL.append_left {a b c : List Letter} (h : DisjL a c) (h' : DisjL b c) : DisjL (a ++ b) c + := by + intro l hl + rcases List.mem_append.mp hl with hl | hl + · exact h l hl + · exact h' l hl + +theorem DisjL.append_right {a b c : List Letter} (h : DisjL c a) (h' : DisjL c b) : DisjL c + (a ++ b) := + fun l hl => noLab_append.mpr ⟨h l hl, h' l hl⟩ + +theorem DisjL.left {a b c : List Letter} (h : DisjL (a ++ b) c) : DisjL a c := + fun l hl => h l (List.mem_append_left _ hl) + +theorem DisjL.right {a b c : List Letter} (h : DisjL (a ++ b) c) : DisjL b c := + fun l hl => h l (List.mem_append_right _ hl) + +theorem DisjL.inl {a b c : List Letter} (h : DisjL c (a ++ b)) : DisjL c a := + fun l hl => (noLab_append.mp (h l hl)).1 + +theorem DisjL.inr {a b c : List Letter} (h : DisjL c (a ++ b)) : DisjL c b := + fun l hl => (noLab_append.mp (h l hl)).2 + +/-- **Slide.** The two parts before a product of blocks can be exchanged. -/ +theorem slide {H : List Letter} (hH : Blocks H) {A B : List Letter} (hA : DisjL H A) + (hB : DisjL H B) : + WEq.{uu} (A ++ B ++ H) (B ++ A ++ H) := by + induction hH generalizing A B with + | nil => simpa using WEq.rot A B + | @cons U H' hU hd _ ih => + have a1 : DisjL U A := hA.left + have a2 : DisjL U B := hB.left + have a3 : DisjL H' A := hA.right + have a4 : DisjL H' B := hB.right + have c0 : WEq.{uu} (A ++ B ++ (U ++ H')) (H' ++ A ++ B ++ U) := + WEq.rot' (A ++ B ++ U) H' (by simp) (by simp) + have c1 : WEq.{uu} (H' ++ A ++ B ++ U) (B ++ (H' ++ A) ++ U) := + slide_block hU (hd.append_right a1) a2 + have c2 : WEq.{uu} (B ++ (H' ++ A) ++ U) (A ++ U ++ B ++ H') := + WEq.rot' (B ++ H') (A ++ U) (by simp) (by simp) + have c3 : WEq.{uu} (A ++ U ++ B ++ H') (B ++ (A ++ U) ++ H') := + ih (a3.append_right hd.symm) a4 + exact c0.trans (c1.trans (c2.trans (c3.trans (WEq.of_eq (by simp))))) + +/-- A block moves past any part of a word. -/ +theorem move_block {U P Q Z : List Letter} (hU : IsBlock U) (hP : DisjL U P) (hQ : DisjL U Q) + (hZ : DisjL U Z) : + WEq.{uu} (P ++ U ++ Q ++ Z) (P ++ Q ++ U ++ Z) := by + have c0 : WEq.{uu} (P ++ U ++ Q ++ Z) (Q ++ (Z ++ P) ++ U) := + WEq.rot' (P ++ U) (Q ++ Z) (by simp) (by simp) + have c1 : WEq.{uu} (Q ++ (Z ++ P) ++ U) (Z ++ P ++ Q ++ U) := by + simpa using slide_block hU hQ (hZ.append_right hP) + have c2 : WEq.{uu} (Z ++ P ++ Q ++ U) (P ++ Q ++ U ++ Z) := + WEq.rot' Z (P ++ Q ++ U) (by simp) (by simp) + exact c0.trans (c1.trans c2) + +theorem Blocks.append {X Y : List Letter} (hX : Blocks X) (hY : Blocks Y) (h : DisjL X Y) : Blocks + (X ++ Y) := by + induction hX with + | nil => simpa using hY + | @cons U H hU hd _ ih => + rw [List.append_assoc] + exact .cons hU (hd.append_right h.left) (ih h.right) + +/-- The number of letters with label `c`. -/ +def cnt (w : List Letter) (c : ℕ) : ℕ := w.countP fun l => l.1 == c + +theorem cnt_append (a b : List Letter) (c : ℕ) : cnt (a ++ b) c = cnt a c + cnt b c := + List.countP_append .. + +theorem cnt_cons (x : Letter) (b : List Letter) (c : ℕ) : + cnt (x :: b) c = (if x.1 = c then 1 else 0) + cnt b c := by + simp [cnt, List.countP_cons] + omega + +theorem noLab_iff_cnt {w : List Letter} {c : ℕ} : NoLab w c ↔ cnt w c = 0 := by + simp [NoLab, cnt, List.countP_eq_zero] + +theorem cnt_pos {w : List Letter} {l : Letter} (h : l ∈ w) : 0 < cnt w l.1 := + List.countP_pos_iff.mpr ⟨l, h, by simp⟩ + +theorem cnt_winv (w : List Letter) (c : ℕ) : cnt (winv w) c = cnt w c := by + induction w with + | nil => rfl + | cons x w ih => + rw [winv_cons, cnt_append, cnt_cons, ih, cnt_cons] + have e1 : (linv x).1 = x.1 := rfl + have e2 : cnt [] c = 0 := rfl + rw [e1, e2] + omega + +theorem exists_of_cnt_pos {w : List Letter} {c : ℕ} (h : 0 < cnt w c) : + ∃ a m b, w = a ++ m :: b ∧ m.1 = c := by + obtain ⟨m, hm, hc⟩ := List.countP_pos_iff.mp h + obtain ⟨a, b, rfl⟩ := List.append_of_mem hm + exact ⟨a, m, b, rfl, by simpa using hc⟩ + +theorem eq_or_linv {m l : Letter} (h : m.1 = l.1) : m = l ∨ m = linv l := by + obtain ⟨a, b⟩ := m + obtain ⟨c, d⟩ := l + obtain rfl : a = c := h + cases b <;> cases d <;> simp [linv] + +/-- Each label occurs at most twice. -/ +def Good (w : List Letter) : Prop := ∀ c, cnt w c ≤ 2 + +/-- **Case analysis of a word.** A word with labels used at most twice has a pair with equal signs, +or two +interleaved pairs, or a pair around letters that occur once, or only letters that occur once. -/ +theorem pair_cases {R : List Letter} (hR : Good R) : + ∀ n (P B Z : List Letter) (x x' : Letter), B.length ≤ n → R = P ++ x :: B ++ x' :: Z → x'.1 + = x.1 → + (∃ P Q S x, R = P ++ x :: Q ++ x :: S) ∨ + (∃ P Q S T Z x y, x.1 ≠ y.1 ∧ R = P ++ x :: Q ++ y :: S ++ linv x :: T ++ linv y :: Z) ∨ + (∃ P B Z x, R = P ++ x :: B ++ linv x :: Z ∧ ∀ l ∈ B, cnt R l.1 = 1) := by + intro n + induction n with + | zero => + intro P B Z x x' hB hE hx + have hB0 : B = [] := List.length_eq_zero_iff.mp (by omega) + subst hB0 + obtain ⟨c, e⟩ := x + obtain ⟨c', e'⟩ := x' + obtain rfl : c' = c := hx + by_cases he : e' = e + · subst he + exact .inl ⟨P, [], Z, (c', e'), by simpa using hE⟩ + · refine .inr (.inr ⟨P, [], Z, (c', e), ?_, by simp⟩) + have : e' = !e := by cases e <;> cases e' <;> simp_all + simpa [linv, this] using hE + | succ n ih => + intro P B Z x x' hB hE hx + obtain ⟨c, e⟩ := x + obtain ⟨c', e'⟩ := x' + obtain rfl : c' = c := hx + by_cases he : e' = e + · subst he + exact .inl ⟨P, B, Z, (c', e'), by simpa using hE⟩ + have hee : e' = !e := by + cases e <;> cases e' <;> first | rfl | exact absurd rfl he + subst hee + have hcnt : cnt R c' = cnt P c' + 2 + cnt B c' + cnt Z c' := by + rw [hE] + simp only [cnt_append, cnt_cons, ite_true] + omega + have h2 := hR c' + by_cases hall : ∀ l ∈ B, cnt R l.1 = 1 + · exact .inr (.inr ⟨P, B, Z, (c', e), by simpa [linv] using hE, hall⟩) + push Not at hall + obtain ⟨l, hl, hl1⟩ := hall + obtain ⟨B₁, B₂, rfl⟩ := List.append_of_mem hl + have hlc : c' ≠ l.1 := by + rintro h + have h3 := cnt_pos (w := B₁ ++ l :: B₂) (l := l) hl + rw [← h] at h3 + omega + have hc : cnt R l.1 = cnt P l.1 + cnt B₁ l.1 + 1 + cnt B₂ l.1 + cnt Z l.1 := by + rw [hE] + simp only [cnt_append, cnt_cons, ite_eq_right hlc, ite_true] + omega + have hge : 1 ≤ cnt R l.1 := cnt_pos (w := R) (l := l) (by rw [hE]; simp) + have hsum : 0 < cnt P l.1 + cnt B₁ l.1 + cnt B₂ l.1 + cnt Z l.1 := by omega + have hEl : R = P ++ (c', e) :: B₁ ++ l :: B₂ ++ (c', !e) :: Z := by simpa using hE + have hlen : B₁.length + B₂.length ≤ n := by + simp at hB + omega + by_cases h3 : 0 < cnt B₂ l.1 + · obtain ⟨B₃, m, B₄, rfl, hm⟩ := exists_of_cnt_pos h3 + simp only [List.length_append, List.length_cons] at hlen + exact ih (P ++ (c', e) :: B₁) B₃ (B₄ ++ (c', !e) :: Z) l m (by omega) (by simpa using hEl) hm + by_cases h4 : 0 < cnt B₁ l.1 + · obtain ⟨B₃, m, B₄, rfl, hm⟩ := exists_of_cnt_pos h4 + simp only [List.length_append, List.length_cons] at hlen + exact ih (P ++ (c', e) :: B₃) B₄ (B₂ ++ (c', !e) :: Z) m l (by omega) + (by simpa using hEl) hm.symm + by_cases h5 : 0 < cnt Z l.1 + · obtain ⟨Z₁, m, Z₂, rfl, hm⟩ := exists_of_cnt_pos h5 + rcases eq_or_linv hm with rfl | rfl + · exact .inl ⟨P ++ (c', e) :: B₁, B₂ ++ (c', !e) :: Z₁, Z₂, m, by simpa using hEl⟩ + · exact .inr (.inl ⟨P, B₁, B₂, Z₁, Z₂, (c', e), l, hlc, by simpa [linv] using hEl⟩) + · have h6 : 0 < cnt P l.1 := by omega + obtain ⟨P₁, m, P₂, rfl, hm⟩ := exists_of_cnt_pos h6 + rcases eq_or_linv hm with rfl | rfl + · exact .inl ⟨P₁, P₂ ++ (c', e) :: B₁, B₂ ++ (c', !e) :: Z, m, by simpa using hEl⟩ + · refine .inr (.inl ⟨P₁, P₂, B₁, B₂, Z, linv l, (c', e), + fun he => hlc he.symm, ?_⟩) + simpa [linv_linv, linv] using hEl + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/WordSpace.lean b/LeanPool/GraphMinor/Surface/WordSpace.lean new file mode 100644 index 0000000000..4e2ddd82fa --- /dev/null +++ b/LeanPool/GraphMinor/Surface/WordSpace.lean @@ -0,0 +1,222 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.VertexLink +public import LeanPool.GraphMinor.Surface.WordSide + +/-! +# The space of a family of words + +`WordSpace W` is the quotient of the discs of a family of words by the pasting relation. For a +finite paired family the +relation is closed, since off a finite set of corners a class has at most two points. So the +quotient is +compact and Hausdorff (`t2Space_wordSpace`), and it is presented by `W` (`presents_wordMap`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric + +universe u + +theorem exists_spt {W : ℕ → List Letter} {a : ℕ × ℂ} (ha : a ∈ Dsk W) (hn : ‖a.2‖ = 1) : + ∃ p k e, ∃ u ∈ Icc (0 : ℝ) 1, (W a.1)[p]? = some (k, e) ∧ a = spt W a.1 p u := by + obtain ⟨i, z⟩ := a + have hpos : 0 < (W i).length := List.length_pos_iff.mpr ha.1 + have h1 : z ∈ sphere (0 : ℂ) 1 := by simpa using hn + rw [← per_image hpos] at h1 + obtain ⟨x, hx, rfl⟩ := h1 + have hex : ∃ p < (W i).length, x ∈ Icc (p : ℝ) (p + 1) := by + set n := (W i).length with hndef + refine ⟨min ⌊x⌋₊ (n - 1), by omega, ?_⟩ + have hle : ⌊x⌋₊ ≤ x := Nat.floor_le hx.1 + have hlt : x < ⌊x⌋₊ + 1 := Nat.lt_floor_add_one x + by_cases h1 : ⌊x⌋₊ ≤ n - 1 + · rw [min_eq_left h1] + exact ⟨hle, hlt.le⟩ + · have h2 : ⌊x⌋₊ = n := by + have : ⌊x⌋₊ ≤ n := Nat.floor_le_of_le hx.2 + omega + have h3 : ((n - 1 : ℕ) : ℝ) = n - 1 := by + rw [Nat.cast_sub hpos] + simp + rw [min_eq_right (by omega), h3] + rw [h2] at hle + constructor <;> linarith [hx.2] + obtain ⟨p, hp, hxp⟩ := hex + refine ⟨p, ((W i)[p]'hp).1, ((W i)[p]'hp).2, x - p, ⟨by linarith [hxp.1], by linarith [hxp.2]⟩, + ?_, ?_⟩ + · exact List.getElem?_eq_getElem hp + · simp [spt] + +/-- The pasting relation on the discs. -/ +def wordSetoid (W : ℕ → List Letter) : Setoid (Dsk W) := + ⟨fun a b => PRel W a.1 b.1, ⟨fun _ => .refl _, fun h => .symm _ _ h, fun h h' + => .trans _ _ _ h h'⟩⟩ + +/-- The quotient of the discs of `W` by the pasting relation. -/ +abbrev WordSpace (W : ℕ → List Letter) : Type := Quotient (wordSetoid W) + +/-- The map of the discs to the quotient. -/ +noncomputable def wordMap {W : ℕ → List Letter} (h0 : (Dsk W).Nonempty) (a : ℕ × ℂ) : WordSpace W := + open Classical in if h : a ∈ Dsk W then Quotient.mk _ ⟨a, h⟩ else Quotient.mk _ ⟨h0.some, + h0.some_mem⟩ + +theorem wordMap_of_mem {W : ℕ → List Letter} (h0 : (Dsk W).Nonempty) {a : ℕ × ℂ} (h : a ∈ Dsk W) : + wordMap h0 a = Quotient.mk _ ⟨a, h⟩ := by + simp [wordMap, h] + +theorem presents_wordMap {W : ℕ → List Letter} (h0 : (Dsk W).Nonempty) : Presents W (wordMap h0) + := by + refine ⟨?_, ?_, fun a ha b hb => ?_⟩ + · rw [continuousOn_iff_continuous_domRestrict] + have e : (Dsk W).domRestrict (wordMap h0) = Quotient.mk (wordSetoid W) := by + funext a + exact wordMap_of_mem h0 a.2 + rw [e] + exact continuous_quotient_mk' + · refine eq_univ_of_forall fun x => ?_ + obtain ⟨a, rfl⟩ := Quotient.exists_rep x + exact ⟨a.1, a.2, wordMap_of_mem h0 a.2⟩ + · rw [wordMap_of_mem h0 ha, wordMap_of_mem h0 hb] + exact ⟨fun h => Quotient.exact h, fun h => Quotient.sound h⟩ + +variable {W : ℕ → List Letter} + +theorem compactSpace_dsk (hW : FinW W) : CompactSpace (Dsk W) := + isCompact_iff_compactSpace.mp (isCompact_Dsk hW) + +theorem compactSpace_wordSpace (hW : FinW W) : CompactSpace (WordSpace W) := + have := compactSpace_dsk hW + Quotient.compactSpace + +theorem finite_sides (hW : FinW W) : {x : ℕ × ℕ | ∃ l, (W x.1)[x.2]? = some l}.Finite := by + refine (hW.biUnion fun i _ => ((finite_singleton i).prod (finite_lt_nat (W i).length))).subset ?_ + rintro ⟨i, p⟩ ⟨l, h⟩ + have h1 : (W i)[p]? = some l := h + have hlt : p < (W i).length := (List.getElem?_eq_some_iff.mp h1).1 + refine mem_biUnion (x := i) (fun he => ?_) ⟨rfl, hlt⟩ + simp [he] at hlt + +/-- The corners of a family of words. -/ +noncomputable def crn (W : ℕ → List Letter) : Set (ℕ × ℂ) := + (fun x : ℕ × ℕ => spt W x.1 x.2 0) '' {x : ℕ × ℕ | ∃ l, (W x.1)[x.2]? = some l} ∪ + (fun x : ℕ × ℕ => spt W x.1 x.2 1) '' {x : ℕ × ℕ | ∃ l, (W x.1)[x.2]? = some l} + +theorem finite_crn (hW : FinW W) : (crn W).Finite := + ((finite_sides hW).image _).union ((finite_sides hW).image _) + +/-- A point of the discs that is not a corner is related to itself and to the points one step away. +-/ +theorem prel_of_not_crn (hP : IsPaired W) {a b : ℕ × ℂ} (ha : a ∈ Dsk W) (hna : a ∉ crn W) + (hr : PRel W a b) : + b = a ∨ Stp W a b := by + by_cases hn : ‖a.2‖ < 1 + · exact .inl (PRel.eq_of_lt hr hn) + · have hn1 : ‖a.2‖ = 1 := le_antisymm ha.2 (not_lt.mp hn) + obtain ⟨p, k, e, u, hu, hs, ha'⟩ := exists_spt ha hn1 + have hu' : u ∈ Ioo (0 : ℝ) 1 := by + refine ⟨lt_of_le_of_ne hu.1 fun h0 => hna (.inl ⟨(a.1, p), ⟨_, hs⟩, ?_⟩), + lt_of_le_of_ne hu.2 fun h1 => hna + (.inr ⟨(a.1, p), ⟨_, hs⟩, ?_⟩)⟩ + · rw [ha', ← h0] + simp [spt] + · rw [ha', h1] + simp [spt] + rw [ha'] at hr ⊢ + exact PRel.eq_or_stp hP hs hu' hr + +/-- A pasting class is finite. -/ +theorem finite_class (hW : FinW W) (hP : IsPaired W) {a : ℕ × ℂ} (ha : a ∈ Dsk W) : {b | PRel W a + b}.Finite := by + classical + by_cases hc : {b | PRel W a b} ⊆ crn W + · exact (finite_crn hW).subset hc + obtain ⟨b, hb, hbc⟩ := not_subset.mp hc + have hbD : b ∈ Dsk W := (prel_mem_iff hb).mp ha + have hfin : {x | Stp W b x}.Finite := by + by_cases hn : ‖b.2‖ < 1 + · refine (finite_singleton b).subset fun x hx => ?_ + exact PRel.eq_of_lt (.rel _ _ hx) hn + · have hn1 : ‖b.2‖ = 1 := le_antisymm hbD.2 (not_lt.mp hn) + obtain ⟨p, k, e, u, hu, hs, hb'⟩ := exists_spt hbD hn1 + have hu' : u ∈ Ioo (0 : ℝ) 1 := by + refine ⟨lt_of_le_of_ne hu.1 fun h0 => hbc (.inl ⟨(b.1, p), ⟨_, hs⟩, ?_⟩), + lt_of_le_of_ne hu.2 fun h1 => hbc + (.inr ⟨(b.1, p), ⟨_, hs⟩, ?_⟩)⟩ + · rw [hb', ← h0] + simp [spt] + · rw [hb', h1] + simp [spt] + refine (((finite_sides hW).prod (finite_univ (α := Bool))).image + fun x => spt W x.1.1 x.1.2 (flp e x.2 u)).subset fun x hx => ?_ + have hx' : Stp W (spt W b.1 p u) x := hb' ▸ hx + obtain ⟨j, q, e', h1, -, rfl⟩ := stp_of_side hP hs hu' hx' + exact ⟨((j, q), e'), ⟨⟨_, h1⟩, mem_univ _⟩, rfl⟩ + refine ((finite_singleton b).union hfin).subset fun x hx => ?_ + rcases prel_of_not_crn hP hbD hbc (.trans _ _ _ (.symm _ _ hb) hx) with h | h + · exact .inl h + · exact .inr h + +/-- The pasting relation is closed. -/ +theorem isClosed_prel (hW : FinW W) (hP : IsPaired W) : + IsClosed {p : Dsk W × Dsk W | PRel W p.1.1 p.2.1} := by + classical + let Cn := crn W + have hCn : Cn.Finite := finite_crn hW + have hsym : ∀ x y, Stp W x y → Stp W y x := by + rintro _ _ ⟨i, j, p, q, k, e, e', t, h1, h2, h3, ht, rfl, rfl⟩ + exact ⟨j, i, q, p, k, e', e, t, h2, h1, h3.symm, ht, rfl, rfl⟩ + have hkey : ∀ a ∈ Dsk W, ∀ b, a ∉ Cn → PRel W a b → b = a ∨ Stp W a b := + fun a ha b hna hr => prel_of_not_crn hP ha hna hr + let R1 : Set (Dsk W × Dsk W) := {p | p.1 = p.2} + let R2 : Set (Dsk W × Dsk W) := {p | Stp W p.1.1 p.2.1} + let R3 : Set (Dsk W × Dsk W) := {p | p.1.1 ∈ Cn ∧ p.2.1 ∈ Cn ∧ PRel W p.1.1 p.2.1} + have hR2 : IsClosed R2 := by + have hc : Continuous fun p : Dsk W × Dsk W => (p.1.1, p.2.1) := by fun_prop + exact (isCompact_stp hW).isClosed.preimage hc + have hR3 : R3.Finite := by + have hinj : InjOn (fun p : Dsk W × Dsk W => (p.1.1, p.2.1)) R3 := fun p _ q _ he => by + obtain ⟨h1, h2⟩ := Prod.mk.inj he + exact Prod.ext (Subtype.ext h1) (Subtype.ext h2) + exact Set.Finite.of_finite_image ((hCn.prod hCn).subset (by + rintro _ ⟨p, hp, rfl⟩ + exact ⟨hp.1, hp.2.1⟩)) hinj + have e : {p : Dsk W × Dsk W | PRel W p.1.1 p.2.1} = R1 ∪ R2 ∪ R3 := by + ext ⟨a, b⟩ + constructor + · intro hr + have hr' : PRel W a.1 b.1 := hr + by_cases ha : a.1 ∈ Cn + · by_cases hb : b.1 ∈ Cn + · exact .inr ⟨ha, hb, hr'⟩ + · rcases hkey b.1 b.2 a.1 hb (.symm _ _ hr') with h | h + · exact .inl (.inl (Subtype.ext h)) + · exact .inl (.inr (hsym _ _ h)) + · rcases hkey a.1 a.2 b.1 ha hr' with h | h + · exact .inl (.inl (Subtype.ext h.symm)) + · exact .inl (.inr h) + · rintro ((h | h) | h) + · have h' : a = b := h + subst h' + exact .refl _ + · exact .rel _ _ h + · exact h.2.2 + rw [e] + exact (isClosed_eq continuous_fst continuous_snd |>.union hR2).union hR3.isClosed + +theorem t2Space_wordSpace (hW : FinW W) (hP : IsPaired W) : T2Space (WordSpace W) := + have := compactSpace_dsk hW + t2Space_quotient_of_isClosed (wordSetoid W) (isClosed_prel hW hP) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/WordSurface.lean b/LeanPool/GraphMinor/Surface/WordSurface.lean new file mode 100644 index 0000000000..2fe55d235b --- /dev/null +++ b/LeanPool/GraphMinor/Surface/WordSurface.lean @@ -0,0 +1,569 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.WordGerm + +/-! +# A presented space is a surface + +Let `W` be a finite family of words with each label on at most two sides. Then a Hausdorff space +presented by `W` is a +surface and its boundary is the image of the free sides (`surface_of_presents`). + +A point inside a disc has a small ball around it. At another point `y`, take the rectangles of all +germs at `y`. They +form a fan of squares by the lemmas of `WordGerm.lean`, so their union is a closed disc, which is a +neighbourhood of `y`. +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Metric Germ + +universe u + +variable {W : ℕ → List Letter} {Y : Type u} [TopologicalSpace Y] {f : ℕ × ℂ → Y} + +/-- The germs at a point of a presented space. -/ +def germsAt (W : ℕ → List Letter) (f : ℕ × ℂ → Y) (y : Y) : Set Germ := {g | Valid W g ∧ f (g.pt W) + = y} + +theorem finite_germsAt (hW : FinW W) (hP : IsPaired W) (hf : Presents W f) (y : Y) : + (germsAt W f y).Finite := by + classical + by_cases hne : (germsAt W f y).Nonempty + · obtain ⟨g₀, hg₀⟩ := hne + have hF := finite_class hW hP hg₀.1.pt_mem + refine Set.Finite.of_finite_image (f := fun g : Germ => (g.pt W, g.τ)) + ((hF.prod (finite_univ (α := Bool))).subset ?_) ?_ + · rintro _ ⟨g, hg, rfl⟩ + refine ⟨?_, mem_univ _⟩ + exact (hf.2.2 _ hg₀.1.pt_mem _ hg.1.pt_mem).mp (hg₀.2.trans hg.2.symm) + · intro g hg g' hg' he + obtain ⟨h1, h2⟩ := Prod.mk.inj he + exact eq_of_pt hg.1 hg'.1 h2 h1 + · rw [not_nonempty_iff_eq_empty.mp hne] + exact finite_empty + +theorem exists_small_of_finite {A : Set ℝ} (hA : A.Finite) (hpos : ∀ t ∈ A, 0 < t) : ∃ h, 0 < h + ∧ ∀ t ∈ A, h < t := by + obtain ⟨t₀, ht₀, hmin⟩ := Set.exists_min_image (insert 1 A) id (hA.insert 1) (insert_nonempty _ _) + have h0 : 0 < t₀ := by + rcases ht₀ with rfl | h + · exact one_pos + · exact hpos _ h + exact ⟨t₀ / 2, by linarith, fun t ht => by + have := hmin t (.inr ht) + simp only [id] at this + linarith⟩ + +theorem exists_scale {G : Set Germ} (hG : G.Finite) (hv : ∀ g ∈ G, Valid W g) : + ∃ h, 0 < h ∧ h < 1 ∧ (∀ g ∈ G, Small h g) ∧ Sep h G := by + classical + let c1 : Germ → ℝ := fun g => if g.τ = true then 1 - g.u else g.u + let c2 : Germ × Germ → ℝ := fun x => if x.1.i = x.2.i ∧ x.1.p = x.2.p + ∧ x.1.u ≠ x.2.u then |x.1.u - x.2.u| / 2 else 1 + have hA : (insert 1 (c1 '' G ∪ c2 '' (G ×ˢ G))).Finite := ((hG.image _).union + ((hG.prod hG).image _)).insert 1 + obtain ⟨h, h0, hb⟩ := exists_small_of_finite hA (by + rintro t (rfl | ⟨g, hg, rfl⟩ | ⟨x, -, rfl⟩) + · exact one_pos + · have h1 := hv g hg + simp only [c1] + split_ifs with h2 + · linarith [h1.2.2.1 h2] + · exact h1.2.2.2 (by simpa using h2) + · simp only [c2] + split_ifs with h2 + · have : 0 < |x.1.u - x.2.u| := abs_pos.mpr (sub_ne_zero.mpr h2.2.2) + linarith + · exact one_pos) + refine ⟨h, h0, hb 1 (.inl rfl), fun g hg => ⟨fun ht => ?_, fun ht => ?_⟩, ?_⟩ + · have h1 := hb (c1 g) (.inr (.inl ⟨g, hg, rfl⟩)) + simp only [c1, ht, ite_true] at h1 + linarith + · have h1 := hb (c1 g) (.inr (.inl ⟨g, hg, rfl⟩)) + simp only [c1, ht] at h1 + simp only [Bool.false_eq_true, ite_false] at h1 + linarith + · intro g hg g' hg' hi hp hu + have h1 := hb (c2 (g, g')) (.inr (.inr ⟨(g, g'), ⟨hg, hg'⟩, rfl⟩)) + simp only [c2, hi, hp, hu, ne_eq, not_false_eq_true, and_self, ite_true] at h1 + linarith + +/-- The germ in the direction into the side at a point of a side. -/ +theorem exists_germ_of_side {i p : ℕ} (hp : p < (W i).length) {u : ℝ} (hu : u ∈ Icc (0 : ℝ) 1) : + ∃ g, Valid W g ∧ g.i = i ∧ g.p = p ∧ g.u = u := by + by_cases h : u < 1 + · exact ⟨⟨i, p, u, true⟩, ⟨hp, hu, fun _ => h, by simp⟩, rfl, rfl, rfl⟩ + · have h1 : u = 1 := le_antisymm hu.2 (not_lt.mp h) + exact ⟨⟨i, p, u, false⟩, ⟨hp, hu, by simp, fun _ => by linarith⟩, rfl, rfl, rfl⟩ + +theorem presents_eq_of_stp (hf : Presents W f) {a b : ℕ × ℂ} (h : Stp W a b) : f a = f b := + (hf.2.2 _ h.mem_Dsk.1 _ h.mem_Dsk.2).mpr (.rel _ _ h) + +/-- The rectangles of the germs at a point form a fan of squares. -/ +theorem exists_fan (hW : FinW W) (hP : IsPaired W) (hf : Presents W f) (y : Y) : + ∃ (h : ℝ) (tw pt : germsAt W f y → germsAt W f y), 0 < h ∧ h < 1 ∧ + IsSquareFan y (fun g => f ∘ rect W h g.1) tw pt ∧ (∀ g, pt g = g ↔ FreeSide W g.1.i g.1.p) + := by + classical + obtain ⟨h, h0, h1, hS, hsep⟩ := exists_scale (finite_germsAt hW hP hf y) fun g hg => hg.1 + have hG : ∀ g ∈ germsAt W f y, Valid W g := fun g hg => hg.1 + have htw : ∀ g : germsAt W f y, ∃ g' : germsAt W f y, g'.1.pt W = g.1.pt W ∧ g'.1.τ = !g.1.τ := by + intro g + obtain ⟨g', h2, h3, h4⟩ := exists_twin g.2.1 + exact ⟨⟨g', h2, by rw [h3]; exact g.2.2⟩, h3, h4⟩ + choose tw htw1 htw2 using htw + have hpt : ∀ g : germsAt W f y, ∃ g' : germsAt W f y, (g' = g ∧ FreeSide W g.1.i g.1.p) + ∨ Partner W g.1 g'.1 := by + intro g + by_cases hfree : FreeSide W g.1.i g.1.p + · exact ⟨g, .inl ⟨rfl, hfree⟩⟩ + · obtain ⟨g', h2, h3⟩ := exists_partner g.2.1 hfree + refine ⟨⟨g', h2, ?_⟩, .inr h3⟩ + obtain ⟨e, e', h4, h5, -⟩ := h3.stp g.2.1.2.1 + rw [← g.2.2] + have h6 : spt W g'.i g'.p (flp e e' g.1.u) = g'.pt W := by rw [← h5]; rfl + rw [h6] at h4 + exact (presents_eq_of_stp hf h4).symm + choose pt hpt using hpt + have hfree : ∀ g, pt g = g ↔ FreeSide W g.1.i g.1.p := by + intro g + rcases hpt g with h2 | h2 + · exact ⟨fun _ => h2.2, fun _ => h2.1⟩ + · exact ⟨fun h3 => absurd (congrArg Subtype.val h3) h2.ne, fun h3 => absurd h3 h2.not_free⟩ + have hmem : ∀ (g : germsAt W f y) {z : ℂ}, z ∈ unitSq → rect W h g.1 z ∈ Dsk W := + fun g _ hz => rect_mem h0 h1 g.2.1 hz + have hsame : ∀ (g g' : germsAt W f y) {z z' : ℂ}, z ∈ unitSq → z' ∈ unitSq → rect W h g.1 z + = rect W h g'.1 z' → + (g = g' ∧ z = z') ∨ (z = 0 ∧ z' = 0) ∨ (z = z' ∧ z.re = 0 ∧ g' = tw g) ∨ (z = z' ∧ z.im = 0 + ∧ g' = pt g) := by + intro g g' z z' hz hz' he + obtain ⟨h2, h3⟩ := rect_same h0 h1 hG hS hsep g.2 g'.2 hz hz' he + rcases h3 with h3 | ⟨h3, h4, h5⟩ + · exact .inl ⟨Subtype.ext h3, h2⟩ + · refine .inr (.inr (.inl ⟨h2, h3, Subtype.ext ?_⟩)) + exact eq_of_pt g'.2.1 (tw g).2.1 (by rw [h4, htw2]) (by rw [h5, htw1]) + have hstp : ∀ (g g' : germsAt W f y) {z z' : ℂ}, z ∈ unitSq → z' ∈ unitSq → z.im = 0 → z'.im = 0 + → 0 < z.re → + Stp W (rect W h g.1 z) (rect W h g'.1 z') → z = z' ∧ g' = pt g := by + intro g g' z z' hz hz' hi hi' hre he + rcases hpt g with h2 | h2 + · exfalso + have hm := th_mem h0 g.2.1 (hS g g.2) hz + rw [rect_im g.1 hi] at he + obtain ⟨k, e, hs⟩ := g.2.1.exists_label + obtain ⟨j, q, e', h3, h4, -⟩ := stp_of_side hP hs (hm.2 hre) he + exact h4 (h2.2 _ _ k e e' hs h3) + · obtain ⟨h3, h4⟩ := rect_stp h0 hP hG hS hsep g.2 g'.2 (pt g).2 h2 hz hz' hi hi' hre he + exact ⟨h3, Subtype.ext h4⟩ + refine ⟨h, tw, pt, h0, h1, ⟨fun g => ?_, fun g => ?_, fun g he => ?_, fun g s hs => ?_, + fun g s hs => ?_, ?_, ?_⟩, hfree⟩ + · exact hf.1.comp (continuous_rect W h g.1).continuousOn fun z hz => hmem g hz + · simp only [Function.comp, rect_zero] + exact g.2.2 + · have h2 := htw2 g + rw [he] at h2 + cases hτ : g.1.τ <;> simp [hτ] at h2 + · simp only [Function.comp, rect_left] + have h2 := htw1 g + have h3 : (tw g).1.i = g.1.i := congrArg Prod.fst h2 + rw [h2, h3] + · rcases hpt g with h2 | h2 + · simp only [h2.1] + · simp only [Function.comp] + have hm := th_mem h0 g.2.1 (hS g g.2) (IsSquareFan.mem_low hs) + obtain ⟨e, e', h4, h5, h6⟩ := h2.stp hm.1 + have h7 : flp e e' (th h g.1 s) = th h (pt g).1 s := by + rw [th, flp_add, th, h5, h6] + rw [h7] at h4 + rw [rect_im g.1 (by simp), rect_im (pt g).1 (by simp)] + exact (presents_eq_of_stp hf h4).symm + · intro g g' z z' hz hz' he + have hr : PRel W (rect W h g.1 z) (rect W h g'.1 z') := (hf.2.2 _ (hmem g hz) _ + (hmem g' hz')).mp he + by_cases hρ : z.im = 0 + · by_cases hρ' : z'.im = 0 + · by_cases hre : 0 < z.re + · have hm := th_mem h0 g.2.1 (hS g g.2) hz + obtain ⟨k, e, hs⟩ := g.2.1.exists_label + have hr' := hr + rw [rect_im g.1 hρ] at hr' + rcases PRel.eq_or_stp hP hs (hm.2 hre) hr' with h2 | h2 + · rw [← rect_im g.1 hρ] at h2 + exact hsame g g' hz hz' h2.symm + · rw [← rect_im g.1 hρ] at h2 + obtain ⟨h3, h4⟩ := hstp g g' hz hz' hρ hρ' hre h2 + exact .inr (.inr (.inr ⟨h3, hρ, h4⟩)) + · have hre0 : z.re = 0 := le_antisymm (not_lt.mp hre) hz.1.1 + by_cases hre' : 0 < z'.re + · have hm := th_mem h0 g'.2.1 (hS g' g'.2) hz' + obtain ⟨k, e, hs⟩ := g'.2.1.exists_label + have hr' : PRel W (rect W h g'.1 z') (rect W h g.1 z) := .symm _ _ hr + rw [rect_im g'.1 hρ'] at hr' + rcases PRel.eq_or_stp hP hs (hm.2 hre') hr' with h2 | h2 + · rw [← rect_im g'.1 hρ'] at h2 + exact hsame g g' hz hz' h2 + · rw [← rect_im g'.1 hρ'] at h2 + obtain ⟨h3, -⟩ := hstp g' g hz' hz hρ' hρ hre' h2 + rw [h3, hre0] at hre' + exact absurd hre' (lt_irrefl _) + · have hre0' : z'.re = 0 := le_antisymm (not_lt.mp hre') hz'.1.1 + exact .inr (.inl ⟨Complex.ext hre0 hρ, Complex.ext hre0' hρ'⟩) + · have hlt : ‖(rect W h g'.1 z').2‖ < 1 := by + rw [norm_rect h0 h1 hz'] + have := mul_pos h0 (lt_of_le_of_ne hz'.2.1 (Ne.symm hρ')) + linarith + exact hsame g g' hz hz' (PRel.eq_of_lt (.symm _ _ hr) hlt) + · have hlt : ‖(rect W h g.1 z).2‖ < 1 := by + rw [norm_rect h0 h1 hz] + have := mul_pos h0 (lt_of_le_of_ne hz.2.1 (Ne.symm hρ)) + linarith + exact hsame g g' hz hz' (PRel.eq_of_lt hr hlt).symm + · rintro A ⟨g₀, hg₀⟩ hcl + let B : Set (ℕ × ℂ) := {x | ∃ g ∈ A, g.1.pt W = x} + have htw' : ∀ (g g' : germsAt W f y), g'.1.pt W = g.1.pt W → g' = g ∨ g' = tw g := by + intro g g' he + by_cases hτ : g'.1.τ = g.1.τ + · exact .inl (Subtype.ext (eq_of_pt g'.2.1 g.2.1 hτ he)) + · refine .inr (Subtype.ext (eq_of_pt g'.2.1 (tw g).2.1 ?_ (by rw [he, htw1]))) + rw [htw2] + cases h7 : g.1.τ <;> cases h8 : g'.1.τ <;> simp_all + have hstep : ∀ x x', Stp W x x' → x ∈ B → x' ∈ B := by + intro x x' hs hx + obtain ⟨g, hg, hgx⟩ := hx + obtain ⟨i, j, p, q, k, e, e', u, h2, h3, h4, hu, rfl, rfl⟩ := stp_iff.mp hs + obtain ⟨g₃, hv₃, hi₃, hp₃, hu₃⟩ := exists_germ_of_side (lt_length h2) hu + subst hi₃ hp₃ hu₃ + have hg₃ : g₃ ∈ germsAt W f y := ⟨hv₃, by + change f (spt W _ _ _) = y + rw [← hgx] + exact g.2.2⟩ + have hA₃ : (⟨g₃, hg₃⟩ : germsAt W f y) ∈ A := by + rcases htw' g ⟨g₃, hg₃⟩ hgx.symm with h5 | h5 + · rw [h5] + exact hg + · rw [h5] + exact (hcl g hg).1 + refine ⟨pt ⟨g₃, hg₃⟩, (hcl _ hA₃).2, ?_⟩ + rcases hpt ⟨g₃, hg₃⟩ with h5 | h5 + · exact absurd (h5.2 _ _ k e e' h2 h3) h4 + · obtain ⟨k₂, e₂, e₂', h6, h7, h8, h9, -⟩ := h5 + rw [h2] at h6 + obtain ⟨rfl, rfl⟩ := Prod.mk.inj (Option.some.inj h6) + have h10 := (hP.third h2 h7 h3 h8).resolve_left h4.symm + obtain ⟨h11, h12⟩ := Prod.mk.inj h10 + rw [h12, h11] at h3 + rw [h3] at h7 + obtain ⟨-, h13⟩ := Prod.mk.inj (Option.some.inj h7) + change spt W _ _ _ = _ + rw [h9, ← h11, ← h12, ← h13] + have hkey : ∀ x x', PRel W x x' → (x ∈ B ↔ x' ∈ B) := by + intro x x' hxy + induction hxy with + | rel x y hs => exact ⟨hstep x y hs, hstep y x hs.symm⟩ + | refl _ => rfl + | symm _ _ _ ih => exact ih.symm + | trans _ _ _ _ _ h1 h2 => exact h1.trans h2 + refine eq_univ_of_forall fun g => ?_ + have h2 : PRel W (g₀.1.pt W) (g.1.pt W) := (hf.2.2 _ g₀.2.1.pt_mem _ g.2.1.pt_mem).mp + (g₀.2.2.trans g.2.2.symm) + obtain ⟨g', hg', he⟩ := (hkey _ _ h2).mp ⟨g₀, hg₀, rfl⟩ + rcases htw' g' g he.symm with h3 | h3 + · rw [h3] + exact hg' + · rw [h3] + exact (hcl g' hg').1 + +theorem per_add (n : ℕ) (x y : ℝ) : per n (x + y) = per n x * cis' (2 * Real.pi * y / n) := by + simp only [per, cis'] + rw [← Complex.exp_add] + congr 1 + push_cast + ring + +/-- Near a point of the circle the unit disc is covered by the rectangles of the two germs at the +point. -/ +theorem eventually_rect {g g' : Germ} (hv : Valid W g) (_hv' : Valid W g') (hτ : g.τ = true) + (hτ' : g'.τ = false) + (he : g'.pt W = g.pt W) {h : ℝ} (h0 : 0 < h) : + ∀ᶠ w in 𝓝 (g.pt W).2, ‖w‖ ≤ 1 → ∃ c ∈ unitSq, rect W h g c = (g.i, w) ∨ rect W h g' c = + (g.i, w) := by + set z₀ := (g.pt W).2 with hz₀ + have hn1 : ‖z₀‖ = 1 := norm_per _ _ + have hz0 : z₀ ≠ 0 := fun h => by simp [h] at hn1 + set n := (W g.i).length with hn + have hnpos : (0 : ℝ) < n := by exact_mod_cast hv.len_pos + have hc : ContinuousAt (fun w : ℂ => Complex.arg (w / z₀)) z₀ := by + have h1 : ContinuousAt (fun w : ℂ => w / z₀) z₀ := by fun_prop + have h2 : ContinuousAt Complex.arg (z₀ / z₀) := by + rw [div_self hz0] + exact Complex.continuousAt_arg (by simp) + exact ContinuousAt.comp (f := fun w : ℂ => w / z₀) h2 h1 + have hε : 0 < 2 * Real.pi * h / n := by positivity + have h1 : ∀ᶠ w in 𝓝 z₀, |Complex.arg (w / z₀)| < 2 * Real.pi * h / n := by + have h2 : Filter.Tendsto (fun w : ℂ => Complex.arg (w / z₀)) (𝓝 z₀) (𝓝 0) := by + have h3 := hc.tendsto + simpa [div_self hz0] using h3 + have h3 := h2.eventually (Metric.ball_mem_nhds (0 : ℝ) hε) + filter_upwards [h3] with w hw + simpa using hw + have h2 : ∀ᶠ w in 𝓝 z₀, 1 - h < ‖w‖ := by + have h3 : Filter.Tendsto (fun w : ℂ => ‖w‖) (𝓝 z₀) (𝓝 ‖z₀‖) := continuous_norm.tendsto _ + rw [hn1] at h3 + exact h3.eventually (lt_mem_nhds (by linarith)) + filter_upwards [h1, h2] with w hw1 hw2 hle + set A := Complex.arg (w / z₀) with hA + set t := A * n / (2 * Real.pi) with ht + have hpi : (0 : ℝ) < 2 * Real.pi := by positivity + have hAt : 2 * Real.pi * t / n = A := by + rw [ht] + field_simp + have htb : |t| < h := by + rw [ht, abs_div, abs_mul, Nat.abs_cast, abs_of_pos hpi, div_lt_iff₀ hpi] + have := (lt_div_iff₀ hnpos).mp hw1 + linarith + have hw : w = ((‖w‖ : ℝ) : ℂ) * (z₀ * cis' A) := by + have h3 := Complex.norm_mul_exp_arg_mul_I (w / z₀) + rw [norm_div, hn1, div_one] at h3 + have h4 : w = z₀ * (w / z₀) := by field_simp + conv_lhs => rw [h4, ← h3] + simp only [cis'] + ring + have him : (1 - ‖w‖) / h ∈ Icc (0 : ℝ) 1 := by + constructor + · exact div_nonneg (by linarith) h0.le + · rw [div_le_one h0] + linarith + have hsim : h * ((1 - ‖w‖) / h) = 1 - ‖w‖ := by field_simp + have hgp : per n (g.p + g.u) = z₀ := rfl + have hgp' : per (W g'.i).length (g'.p + g'.u) = z₀ := by + have h3 : (g'.pt W).2 = (g.pt W).2 := congrArg Prod.snd he + exact h3 + have hi' : g'.i = g.i := congrArg Prod.fst he + have hgp'' : per n (g'.p + g'.u) = z₀ := by + rw [hn, ← hi'] + exact hgp' + have hre : ∀ v s : ℝ, ((v : ℂ) + (s : ℂ) * Complex.I).re = v := fun v s => by simp + have him' : ∀ v s : ℝ, ((v : ℂ) + (s : ℂ) * Complex.I).im = s := fun v s => by simp + have hmk : ∀ v ∈ Icc (0 : ℝ) 1, ((v : ℂ) + (((1 - ‖w‖) / h : ℝ) : ℂ) * Complex.I) ∈ unitSq + := fun v hv => by + constructor + · change ((v : ℂ) + (((1 - ‖w‖) / h : ℝ) : ℂ) * Complex.I).re ∈ Icc (0 : ℝ) 1 + rw [hre] + exact hv + · change ((v : ℂ) + (((1 - ‖w‖) / h : ℝ) : ℂ) * Complex.I).im ∈ Icc (0 : ℝ) 1 + rw [him'] + exact him + rcases le_total 0 t with hsign | hsign + · rw [abs_of_nonneg hsign] at htb + refine ⟨_, hmk (t / h) ⟨by positivity, by rw [div_le_one h0]; exact htb.le⟩, .inl ?_⟩ + simp only [rect, th, hτ, sg_true] + rw [hre, him', hsim] + have h6 : h * (t / h) = t := by field_simp + rw [h6, one_mul, ← add_assoc, per_add, hgp, hAt] + rw [Prod.mk.injEq] + refine ⟨rfl, ?_⟩ + rw [show (1 - (1 - ‖w‖) : ℝ) = ‖w‖ by ring] + exact hw.symm + · rw [abs_of_nonpos hsign] at htb + refine ⟨_, hmk (-t / h) ⟨div_nonneg (by linarith) h0.le, by rw [div_le_one h0]; exact htb.le⟩, + .inr ?_⟩ + simp only [rect, th, hτ', sg_false] + rw [hre, him', hsim] + have h6 : -1 * (h * (-t / h)) = t := by field_simp + rw [h6, ← add_assoc, hi', per_add, ← hn, hgp'', hAt] + rw [Prod.mk.injEq] + refine ⟨rfl, ?_⟩ + rw [show (1 - (1 - ‖w‖) : ℝ) = ‖w‖ by ring] + exact hw.symm + +theorem exists_germ_of_circle {a : ℕ × ℂ} (ha : a ∈ Dsk W) (hn : ‖a.2‖ = 1) : ∃ g, Valid W g ∧ g.τ + = true ∧ g.pt W = a := by + obtain ⟨p, k, e, u, hu, hs, he⟩ := exists_spt ha hn + obtain ⟨g, hv, h1, h2, h3⟩ := exists_germ_of_side (lt_length hs) hu + have hp : g.pt W = a := by + rw [he, pt, h1, h2, h3] + cases hτ : g.τ + · obtain ⟨g', h1, h2, h3⟩ := exists_twin hv + exact ⟨g', h1, by rw [h3, hτ]; rfl, h2.trans hp⟩ + · exact ⟨g, hv, hτ, hp⟩ + +/-- The rectangles at a point of a presented space give a neighbourhood of the point. -/ +theorem rects_mem_nhds [T2Space Y] (hW : FinW W) (hf : Presents W f) {y : Y} (hne : + (germsAt W f y).Nonempty) + {h : ℝ} (h0 : 0 < h) : (⋃ g : germsAt W f y, (f ∘ rect W h g.1) '' unitSq) ∈ 𝓝 y := by + obtain ⟨g₀, hg₀⟩ := hne + have hnorm : ∀ a ∈ Dsk W, f a = y → ‖a.2‖ = 1 := by + intro a ha hy + by_contra hc + have hlt : ‖a.2‖ < 1 := lt_of_le_of_ne ha.2 hc + have h1 : PRel W a (g₀.pt W) := (hf.2.2 _ ha _ hg₀.1.pt_mem).mp (hy.trans hg₀.2.symm) + have h2 := PRel.eq_of_lt h1 hlt + rw [← h2] at hlt + exact absurd hg₀.1.norm_pt hlt.ne + let K : Set (ℕ × ℂ) := ⋃ g : germsAt W f y, rect W h g.1 '' unitSq + let S : Set (ℕ × ℂ) := K ∪ (Dsk W)ᶜ + have hS : ∀ a ∈ Dsk W, f a = y → S ∈ 𝓝 a := by + intro a ha hy + obtain ⟨g, hv, hτ, rfl⟩ := exists_germ_of_circle ha (hnorm a ha hy) + obtain ⟨g', hv', h2, h3⟩ := exists_twin hv + have hτ' : g'.τ = false := by rw [h3, hτ]; rfl + have hgG : g ∈ germsAt W f y := ⟨hv, hy⟩ + have hgG' : g' ∈ germsAt W f y := ⟨hv', by rw [h2]; exact hy⟩ + have hev := eventually_rect hv hv' hτ hτ' h2 h0 + rw [show g.pt W = ((g.pt W).1, (g.pt W).2) from rfl, mem_nhds_prod_iff] + refine ⟨{(g.pt W).1}, by simp, _, hev, ?_⟩ + rintro ⟨i, w⟩ ⟨hi, hw⟩ + have hi' : i = g.i := hi + subst hi' + by_cases hle : ‖w‖ ≤ 1 + · obtain ⟨c, hc, h4 | h4⟩ := hw hle + · exact .inl (mem_iUnion.mpr ⟨⟨g, hgG⟩, c, hc, h4⟩) + · exact .inl (mem_iUnion.mpr ⟨⟨g', hgG'⟩, c, hc, h4⟩) + · exact .inr fun h5 => hle h5.2 + have hC : IsClosed (f '' (Dsk W \ interior S)) := + (((isCompact_Dsk hW).diff isOpen_interior).image_of_continuousOn (hf.1.mono + sdiff_subset)).isClosed + have hy : (f '' (Dsk W \ interior S))ᶜ ∈ 𝓝 y := by + refine hC.isOpen_compl.mem_nhds ?_ + rintro ⟨a, ha, hay⟩ + exact ha.2 (mem_interior_iff_mem_nhds.mpr (hS a ha.1 hay)) + refine Filter.mem_of_superset hy fun w hw => ?_ + have h1 : w ∈ f '' Dsk W := by + rw [hf.2.1] + exact mem_univ w + obtain ⟨a, ha, rfl⟩ := h1 + have h2 : a ∈ interior S := by + by_contra hc + exact hw ⟨a, ⟨ha, hc⟩, rfl⟩ + rcases interior_subset h2 with h3 | h3 + · obtain ⟨g, c, hc, rfl⟩ := mem_iUnion.mp h3 + exact mem_iUnion.mpr ⟨g, c, hc, rfl⟩ + · exact absurd ha h3 + +/-- A point inside a disc gives an interior point. -/ +theorem isInteriorPoint_of_lt [T2Space Y] (hW : FinW W) (hf : Presents W f) {a : ℕ × ℂ} + (ha : a ∈ Dsk W) + (hn : ‖a.2‖ < 1) : IsInteriorPoint (f a) := by + obtain ⟨i, z⟩ := a + have hn' : ‖z‖ < 1 := hn + have hr : 0 < (1 - ‖z‖) / 2 := by linarith + set r := (1 - ‖z‖) / 2 with hrdef + let Ψ : ℂ → Y := fun w => f (i, w) + have hin : ∀ w ∈ closedBall z r, (i, w) ∈ Dsk W ∧ ‖w‖ < 1 := by + intro w hw + have h1 : ‖w‖ ≤ ‖z‖ + r := by + have h2 := mem_closedBall_iff_norm.mp hw + have h3 := norm_sub_norm_le w z + linarith + have h2 : ‖w‖ < 1 := by linarith + exact ⟨⟨ha.1, h2.le⟩, h2⟩ + have hc : ContinuousOn Ψ (closedBall z r) := + hf.1.comp (by fun_prop) fun w hw => (hin w hw).1 + have hi : InjOn Ψ (closedBall z r) := fun w hw w' hw' he => by + have h1 : PRel W (i, w) (i, w') := (hf.2.2 _ (hin w hw).1 _ (hin w' hw').1).mp he + have h2 := PRel.eq_of_lt h1 (hin w hw).2 + exact (congrArg Prod.snd h2).symm + let V' : Set (ℕ × ℂ) := {i} ×ˢ ball z r + have hV' : IsOpen V' := (isOpen_discrete _).prod isOpen_ball + have hcl : IsClosed (f '' (Dsk W \ V')) := + (((isCompact_Dsk hW).diff hV').image_of_continuousOn (hf.1.mono sdiff_subset)).isClosed + have he : Ψ '' ball z r = (f '' (Dsk W \ V'))ᶜ := by + ext x + constructor + · rintro ⟨w, hw, rfl⟩ ⟨b, hb, hbe⟩ + have hw' := ball_subset_closedBall hw + have h1 : PRel W (i, w) b := (hf.2.2 _ (hin w hw').1 _ hb.1).mp hbe.symm + have h2 := PRel.eq_of_lt h1 (hin w hw').2 + rw [h2] at hb + exact hb.2 ⟨rfl, hw⟩ + · intro hx + have h1 : x ∈ f '' Dsk W := by + rw [hf.2.1] + exact mem_univ x + obtain ⟨⟨j, w⟩, hb, rfl⟩ := h1 + have h2 : (j, w) ∈ V' := by + by_contra hc + exact hx ⟨_, ⟨hb, hc⟩, rfl⟩ + obtain ⟨h3, h4⟩ := h2 + have h3' : j = i := h3 + subst h3' + exact ⟨w, h4, rfl⟩ + exact isInteriorPoint_of_injOn (isCompact_closedBall _ _) hc hi ball_subset_closedBall isOpen_ball + (he ▸ hcl.isOpen_compl) (mem_ball_self hr) + +/-- The points of the free sides of a family of words. -/ +def freePts (W : ℕ → List Letter) : Set (ℕ × ℂ) := + {x | ∃ i p u, p < (W i).length ∧ FreeSide W i p ∧ u ∈ Icc (0 : ℝ) 1 ∧ x = spt W i p u} + +/-- A Hausdorff space presented by a finite family of words with each label on at most two sides is +a surface, and its +boundary is the image of the free sides. -/ +theorem surface_of_presents [T2Space Y] (hW : FinW W) (hP : IsPaired W) (hf : Presents W f) : + IsSurface Y ∧ bd Y = f '' freePts W := by + classical + have hsurj : ∀ y : Y, ∃ a ∈ Dsk W, f a = y := fun y => by + have h1 : y ∈ f '' Dsk W := by + rw [hf.2.1] + exact mem_univ y + exact h1 + have hfan : ∀ y : Y, (germsAt W f y).Nonempty → ∃ E : Set Y, IsClosedDisc E ∧ E ∈ 𝓝 y ∧ + ((∀ g ∈ germsAt W f y, ¬ FreeSide W g.i g.p) → y ∉ discBd E) ∧ + ((∃ g ∈ germsAt W f y, FreeSide W g.i g.p) → y ∈ discBd E) := by + intro y hne + obtain ⟨h, tw, pt, h0, -, hS, hfree⟩ := exists_fan hW hP hf y + have : Finite (germsAt W f y) := (finite_germsAt hW hP hf y).to_subtype + have : Nonempty (germsAt W f y) := hne.to_subtype + obtain ⟨E, h1, h2, h3, h4⟩ := hS.exists_disc + refine ⟨E, h1, ?_, fun hn => h3 fun g he => hn g.1 g.2 ((hfree g).mp he), ?_⟩ + · rw [h2] + exact rects_mem_nhds hW hf hne h0 + · rintro ⟨g, hg, hg'⟩ + exact h4 ⟨⟨g, hg⟩, (hfree ⟨g, hg⟩).mpr hg'⟩ + have hgerm : ∀ a ∈ Dsk W, ‖a.2‖ = 1 → (germsAt W f (f a)).Nonempty := by + intro a ha hn + obtain ⟨g, hv, -, rfl⟩ := exists_germ_of_circle ha hn + exact ⟨g, hv, rfl⟩ + have hman : ∀ y : Y, IsManifoldPoint y := by + intro y + obtain ⟨a, ha, rfl⟩ := hsurj y + by_cases hn : ‖a.2‖ < 1 + · exact (isInteriorPoint_of_lt hW hf ha hn).isManifoldPoint + · obtain ⟨E, h1, h2, -⟩ := hfan _ (hgerm a ha (le_antisymm ha.2 (not_lt.mp hn))) + exact isManifoldPoint_of_disc h1 h2 + have hc : CompactSpace Y := ⟨by + rw [← hf.2.1] + exact (isCompact_Dsk hW).image_of_continuousOn hf.1⟩ + refine ⟨⟨hc, inferInstance, hman⟩, ?_⟩ + ext y + constructor + · intro hy + obtain ⟨a, ha, rfl⟩ := hsurj y + have hn : ‖a.2‖ = 1 := by + by_contra hc + exact hy (isInteriorPoint_of_lt hW hf ha (lt_of_le_of_ne ha.2 hc)) + obtain ⟨E, h1, h2, h3, -⟩ := hfan _ (hgerm a ha hn) + by_contra hcon + have hno : ∀ g ∈ germsAt W f (f a), ¬ FreeSide W g.i g.p := by + intro g hg hfr + exact hcon ⟨g.pt W, ⟨g.i, g.p, g.u, hg.1.1, hfr, hg.1.2.1, rfl⟩, hg.2⟩ + have h4 : f a ∈ discInt E := ⟨mem_of_mem_nhds h2, h3 hno⟩ + exact hy (isInteriorPoint_of_mem_discInt hman h1 h4) + · rintro ⟨x, ⟨i, p, u, hp, hfr, hu, rfl⟩, rfl⟩ + obtain ⟨g, hv, rfl, rfl, rfl⟩ := exists_germ_of_side hp hu + have hg : g ∈ germsAt W f (f (spt W g.i g.p g.u)) := ⟨hv, rfl⟩ + obtain ⟨E, h1, h2, -, h3⟩ := hfan _ ⟨g, hg⟩ + exact mem_bd_of_disc h2 (h3 ⟨g, hg, hfr⟩) + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Surface/WordTrack.lean b/LeanPool/GraphMinor/Surface/WordTrack.lean new file mode 100644 index 0000000000..bec09e1a7e --- /dev/null +++ b/LeanPool/GraphMinor/Surface/WordTrack.lean @@ -0,0 +1,400 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Surface.WordSlide + +/-! +# Moves that record sides + +`PEq` only says that two families present the same spaces. To choose which hole of a word is a given +cuff we need a +sharper form: `Trk K W W'` says that a presentation by `W` gives a presentation by `W'` in which +each side with a label +in `K` has the same image, with the same parameter. Rotating a word, cutting along a chord and +gluing along a letter +all have this form. So a hole can be moved to the front of a word (`trk_hole_front`). +-/ + +@[expose] public section + +namespace GraphMinor.Surface + +open Set Topology Function + +universe uu + +/-- A presentation by `W` gives one by `W'` that agrees with it on the sides with labels in `K`. -/ +def Trk (K : Set ℕ) (W W' : ℕ → List Letter) : Prop := + ∀ (T : Type uu) [TopologicalSpace T] [T2Space T] (f : ℕ × ℂ → T), Presents W f → + ∃ f' : ℕ × ℂ → T, Presents W' f' ∧ ∀ k ∈ K, ∀ i p ε, (W i)[p]? = some (k, ε) → + ∃ i' p', (W' i')[p']? = some (k, ε) ∧ ∀ t ∈ Icc (0 : ℝ) 1, + f' (i', sdPt (W' i').length p' ε t) = f (i, sdPt (W i).length p ε t) + +theorem Trk.refl (K : Set ℕ) (W : ℕ → List Letter) : Trk.{uu} K W W := fun _ _ _ f hf => + ⟨f, hf, fun _ _ i p _ h => ⟨i, p, h, fun _ _ => rfl⟩⟩ + +theorem Trk.trans {K : Set ℕ} {W W' W'' : ℕ → List Letter} (h : Trk.{uu} K W W') + (h' : Trk.{uu} K W' W'') : + Trk.{uu} K W W'' := fun T _ _ f hf => by + obtain ⟨f₁, h1, h2⟩ := h T f hf + obtain ⟨f₂, h3, h4⟩ := h' T f₁ h1 + refine ⟨f₂, h3, fun k hk i p ε he => ?_⟩ + obtain ⟨i₁, p₁, a1, a2⟩ := h2 k hk i p ε he + obtain ⟨i₂, p₂, b1, b2⟩ := h4 k hk i₁ p₁ ε a1 + exact ⟨i₂, p₂, b1, fun t ht => (b2 t ht).trans (a2 t ht)⟩ + +/-- A smaller set of labels, up to labels that do not occur in the first family. -/ +theorem Trk.restrict {K K' : Set ℕ} {W W' : ℕ → List Letter} (h : Trk.{uu} K W W') + (hK : ∀ k ∈ K', k ∈ K ∨ ∀ i, ∀ l ∈ W i, l.1 ≠ k) : Trk.{uu} K' W W' := fun T _ _ f hf => by + obtain ⟨f₁, h1, h2⟩ := h T f hf + refine ⟨f₁, h1, fun k hk i p ε he => ?_⟩ + rcases hK k hk with h3 | h3 + · exact h2 k h3 i p ε he + · exact absurd rfl (h3 i _ (List.mem_of_getElem? he)) + +theorem trk_rot1 {W : ℕ → List Letter} {i : ℕ} (x : Letter) (u : List Letter) : + Trk.{uu} univ (update W i (x :: u)) (update W i (u ++ [x])) := fun T _ _ f hf => by + refine ⟨_, hf.of_map isPolyMap_rot1, fun k _ j p ε h => ?_⟩ + set n := u.length + 1 with hn + have hn0 : n ≠ 0 := by omega + have hlen1 : (update W i (x :: u) i).length = n := by simp [hn] + have hlen2 : (update W i (u ++ [x]) i).length = n := by simp [hn] + by_cases hj : j = i + · subst hj + rw [update_self] at h + cases p with + | zero => + refine ⟨j, u.length, ?_, fun t _ => ?_⟩ + · have : (k, ε) = x := by simpa using h.symm + simp [this] + · simp only [Function.comp_apply, ite_true] + rw [hlen1, hlen2] + simp only [sdPt, per_mul] + congr 2 + have := per_add_self hn0 (((0 : ℕ) : ℝ) + if ε then t else 1 - t) + rw [← this] + congr 1 + rw [hn] + push_cast + ring + | succ p => + rw [List.getElem?_cons_succ] at h + have hp : p < u.length := (List.getElem?_eq_some_iff.mp h).1 + refine ⟨j, p, ?_, fun t _ => ?_⟩ + · rw [update_self, List.getElem?_append_left hp] + exact h + · simp only [Function.comp_apply, ite_true] + rw [hlen1, hlen2] + simp only [sdPt, per_mul] + congr 2 + push_cast + ring_nf + · refine ⟨j, p, by rw [update_ne hj] at h ⊢; exact h, fun t _ => ?_⟩ + simp only [Function.comp_apply, ite_eq_right hj, update_ne hj] + +theorem trk_rot {W : ℕ → List Letter} {i : ℕ} (a b : List Letter) : + Trk.{uu} univ (update W i (a ++ b)) (update W i (b ++ a)) := by + induction a generalizing b with + | nil => simpa using Trk.refl.{uu} univ _ + | cons x a ih => + have h1 : Trk.{uu} univ (update W i ((x :: a) ++ b)) (update W i ((a ++ b) ++ [x])) := by + simpa using trk_rot1 (W := W) (i := i) x (a ++ b) + have h2 : Trk.{uu} univ (update W i (a ++ (b ++ [x]))) (update W i ((b ++ [x]) ++ a)) := ih + (b ++ [x]) + have e1 : (a ++ b) ++ [x] = a ++ (b ++ [x]) := by simp + have e2 : (b ++ [x]) ++ a = b ++ x :: a := by simp + rw [e1] at h1 + rw [e2] at h2 + exact h1.trans h2 + +theorem trk_cut {W : ℕ → List Letter} {i j y : ℕ} {u v : List Letter} (e : Bool) (hij : j ≠ i) + (hWj : W j = []) (hu : u ≠ []) (hv : v ≠ []) (hy : FreshIn (update W i (v ++ u)) y) : + Trk.{uu} univ (update W i (v ++ u)) (update (update W i ((y, e) :: u)) j ((y, !e) :: v)) + := fun T _ _ f hf => by + obtain ⟨θ, hθ, -, hup⟩ := exists_isPolyMap_cut (e := e) hij hWj hu hv hy + refine ⟨_, hf.of_map hθ, fun k _ i' p ε h => ?_⟩ + obtain ⟨s, q, h1, h2⟩ := hup i' p k ε h + exact ⟨s, q, h1, fun t ht => by simp only [Function.comp_apply, h2 t ht]⟩ + +theorem trk_glue {W : ℕ → List Letter} {i j y : ℕ} {u v : List Letter} (hW : FinW W) (e : Bool) + (hij : j ≠ i) + (hWj : W j = []) (hu : u ≠ []) (hv : v ≠ []) (hy : FreshIn (update W i (v ++ u)) y) : + Trk.{uu} {y}ᶜ (update (update W i ((y, e) :: u)) j ((y, !e) :: v)) (update W i (v ++ u)) + := fun T _ _ f hf => by + obtain ⟨θ, hθ, hdown, -⟩ := exists_isPolyMap_cut (e := e) hij hWj hu hv hy + obtain ⟨g, hg, hval⟩ := hf.map' hθ ((hW.update i _).update j _) + refine ⟨g, hg, fun k hk i' p ε h => ?_⟩ + obtain ⟨s, q, h1, h2⟩ := hdown i' p k ε h hk + refine ⟨s, q, h1, fun t ht => ?_⟩ + rw [← h2 t ht] + refine hval _ ⟨?_, (norm_per _ _).le⟩ + intro he + simp only [he, List.getElem?_nil, reduceCtorEq] at h + +theorem trk_relab {r : ℕ → ℕ} {W : ℕ → List Letter} {K : Set ℕ} (hK : ∀ k ∈ K, r k = k) + (hr : ∀ i j, ∀ l ∈ W i, ∀ l' ∈ W j, r l.1 = r l'.1 → l.1 = l'.1) : Trk.{uu} K W (relab r W) + := fun T _ _ f hf => by + refine ⟨f, (presents_relab hr f).mp hf, fun k hk i p ε h => ⟨i, p, ?_, + fun t _ => by rw [relab_length]⟩⟩ + have := relab_getElem (r := r) h + rwa [hK k hk] at this + +theorem trk_rot_sW {w w' : List Letter} (a b : List Letter) (h : w = a ++ b) (h' : w' = b ++ a) : + Trk.{uu} univ (sW w) (sW w') := by + rw [h, h'] + exact trk_rot a b + +theorem trk_cut_sW {y : ℕ} {u v : List Letter} (e : Bool) (hu : u ≠ []) (hv : v ≠ []) (hy : NoLab + (v ++ u) y) : + Trk.{uu} univ (sW (v ++ u)) (dW ((y, e) :: u) ((y, !e) :: v)) := + trk_cut (W := nW) e (by decide) rfl hu hv (freshIn_sW hy) + +theorem trk_glue_sW {y : ℕ} {u v : List Letter} (e : Bool) (hu : u ≠ []) (hv : v ≠ []) (hy : NoLab + (v ++ u) y) : + Trk.{uu} {y}ᶜ (dW ((y, e) :: u) ((y, !e) :: v)) (sW (v ++ u)) := + trk_glue (W := nW) finW_nW e (by decide) rfl hu hv (freshIn_sW hy) + +theorem trk_dW_left (a b c : List Letter) : Trk.{uu} univ (dW (a ++ b) c) (dW (b ++ a) c) := by + rw [dW_comm, dW_comm] + exact trk_rot a b + +theorem trk_dW_right (a b c : List Letter) : Trk.{uu} univ (dW c (a ++ b)) (dW c (b ++ a)) := + trk_rot a b + +/-- `ruleA`, keeping all sides with other labels. -/ +theorem trk_ruleA (x : Letter) (u₁ u₂ v₁ v₂ : List Letter) (h1 : NoLab u₁ x.1) (h2 : NoLab u₂ x.1) + (h3 : NoLab v₁ x.1) (h4 : NoLab v₂ x.1) {w w' : List Letter} + (he : w = u₁ ++ x :: (u₂ ++ v₁ ++ linv x :: v₂)) (he' : w' = u₂ ++ x :: + (u₁ ++ v₂ ++ linv x :: v₁)) : + Trk.{uu} {k | k ≠ x.1} (sW w) (sW w') := by + subst he he' + set X := u₁ ++ x :: (u₂ ++ v₁ ++ linv x :: v₂) with hX + obtain ⟨y, -, hy⟩ := exists_fresh X + have hy' : y ≠ x.1 := fun he => (noLab_append.mp hy).2 x (by simp) he.symm |>.elim + have e : X = (u₁ ++ x :: u₂) ++ (v₁ ++ linv x :: v₂) := by simp [hX] + have hA : NoLab (u₁ ++ x :: u₂) y ∧ NoLab (v₁ ++ linv x :: v₂) y := by + rw [e] at hy + exact noLab_append.mp hy + let K : Set ℕ := {k | k ≠ x.1 ∧ k ≠ y} + have c1 : Trk.{uu} K (sW X) (dW ((y, !x.2) :: (v₁ ++ linv x :: v₂)) ((y, x.2) :: + (u₁ ++ x :: u₂))) := by + have := trk_cut_sW.{uu} (y := y) (u := v₁ ++ linv x :: v₂) (v := u₁ ++ x :: u₂) (!x.2) + (by simp) (by simp) + (by rw [← e]; exact hy) + rw [← e] at this + have h5 := this.restrict (K' := K) fun k _ => .inl (mem_univ _) + simpa using h5 + have c2 : Trk.{uu} K (dW ((y, !x.2) :: (v₁ ++ linv x :: v₂)) ((y, x.2) :: (u₁ ++ x :: u₂))) + (dW (linv x :: (v₂ ++ (y, !x.2) :: v₁)) ((y, x.2) :: (u₁ ++ x :: u₂))) := by + have := (trk_dW_left.{uu} ((y, !x.2) :: v₁) (linv x :: v₂) ((y, x.2) :: + (u₁ ++ x :: u₂))).restrict (K' := K) + fun k _ => .inl (mem_univ _) + simpa using this + have c3 : Trk.{uu} K (dW (linv x :: (v₂ ++ (y, !x.2) :: v₁)) ((y, x.2) :: (u₁ ++ x :: u₂))) + (dW (linv x :: (v₂ ++ (y, !x.2) :: v₁)) (x :: (u₂ ++ (y, x.2) :: u₁))) := by + have := (trk_dW_right.{uu} ((y, x.2) :: u₁) (x :: u₂) (linv x :: (v₂ ++ + (y, !x.2) :: v₁))).restrict (K' := K) + fun k _ => .inl (mem_univ _) + simpa using this + set U := v₂ ++ (y, !x.2) :: v₁ with hU + set V := u₂ ++ (y, x.2) :: u₁ with hV + have hx1 : NoLab U x.1 := noLab_append.mpr ⟨h4, noLab_cons.mpr ⟨hy', h3⟩⟩ + have hx2 : NoLab V x.1 := noLab_append.mpr ⟨h2, noLab_cons.mpr ⟨hy', h1⟩⟩ + have hc : NoLab (V ++ U) x.1 := noLab_append.mpr ⟨hx2, hx1⟩ + have c4 : Trk.{uu} K (dW (linv x :: U) (x :: V)) (sW (V ++ U)) := by + have h5 := trk_glue_sW.{uu} (y := x.1) (u := U) (v := V) (!x.2) (by simp [hU]) (by simp [hV]) hc + have e1 : ((x.1, !x.2) : Letter) = linv x := rfl + have e2 : ((x.1, !!x.2) : Letter) = x := by simp + rw [e1, e2] at h5 + exact h5.restrict fun k hk => .inl hk.1 + have c5 : Trk.{uu} K (sW (V ++ U)) (sW ((V ++ U).map fun l => (if l.1 + = y then x.1 else l.1, l.2))) := by + have h5 := trk_relab.{uu} (r := fun n => if n = y then x.1 else n) (W := sW (V ++ U)) (K := K) + (fun k hk => ite_eq_right hk.2) (relab_rename_inj hc) + rwa [relab_sW] at h5 + have hm : ∀ {a : List Letter}, NoLab a y → (a.map fun l => (if l.1 = y then x.1 else l.1, l.2)) + = a := + fun h => map_rename_of_noLab h + have ha := noLab_append.mp hA.1 + have hb := noLab_append.mp hA.2 + have hu₂ := (noLab_cons.mp ha.2).2 + have hv₂ := (noLab_cons.mp hb.2).2 + have e3 : ((V ++ U).map fun l => (if l.1 = y then x.1 else l.1, l.2)) = u₂ ++ x :: + (u₁ ++ v₂ ++ linv x :: v₁) := by + simp only [hU, hV, List.map_append, List.map_cons, hm ha.1, hm hb.1, hm hu₂, hm hv₂, ite_true, + linv, + List.append_assoc, List.cons_append] + rw [e3] at c5 + refine (c1.trans (c2.trans (c3.trans (c4.trans c5)))).restrict fun k hk => ?_ + by_cases hky : k = y + · refine .inr fun i l hl => ?_ + subst hky + by_cases hi : i = 0 + · subst hi + exact hy l (by simpa [sW] using hl) + · simp [sW, update_of_ne hi, nW] at hl + · exact .inl ⟨hk, hky⟩ + +/-- A hole slides, keeping all sides with other labels. -/ +theorem trk_slide_hole (t : Letter) {s A B : List Letter} (hs : NoLab s t.1) (hA : NoLab A t.1) + (hB : NoLab B t.1) : + Trk.{uu} {k | k ≠ t.1} (sW (A ++ B ++ t :: s ++ [linv t])) (sW (B ++ A ++ t :: s ++ [linv t])) + := by + have hAB : NoLab (A ++ B) t.1 := noLab_append.mpr ⟨hA, hB⟩ + have r : ∀ {w w' : List Letter} (a b : List Letter), w = a ++ b → w' = b ++ a → + Trk.{uu} {k | k ≠ t.1} (sW w) (sW w') := fun a b h h' => + (trk_rot_sW a b h h').restrict fun k _ => .inl (mem_univ _) + have c0 : Trk.{uu} {k | k ≠ t.1} (sW (A ++ B ++ t :: s ++ [linv t])) (sW (t :: s ++ linv t :: + (A ++ B))) := + r (A ++ B) (t :: s ++ [linv t]) (by simp) (by simp) + have c1 : Trk.{uu} {k | k ≠ t.1} (sW (t :: s ++ linv t :: (A ++ B))) (sW (t :: + (A ++ B ++ linv t :: s))) := + trk_ruleA t [] [] s (A ++ B) noLab_nil noLab_nil hs hAB (by simp) (by simp) + have c2 : Trk.{uu} {k | k ≠ t.1} (sW (t :: (A ++ B ++ linv t :: s))) (sW (A ++ t :: + (s ++ linv t :: B))) := + trk_ruleA t [] A B s noLab_nil hA hB hs (by simp) (by simp) + have c3 : Trk.{uu} {k | k ≠ t.1} (sW (A ++ t :: (s ++ linv t :: B))) (sW + (B ++ A ++ t :: s ++ [linv t])) := + r (A ++ t :: s ++ [linv t]) B (by simp) (by simp) + exact c0.trans (c1.trans (c2.trans c3)) + +/-- A hole moves to the front of a word, keeping all sides with other labels. -/ +theorem trk_hole_front (t : Letter) {s P Q : List Letter} (hs : NoLab s t.1) (hP : NoLab P t.1) + (hQ : NoLab Q t.1) : + Trk.{uu} {k | k ≠ t.1} (sW (P ++ (t :: s ++ [linv t]) ++ Q)) (sW (t :: s ++ linv t :: + (P ++ Q))) := by + have r : ∀ {w w' : List Letter} (a b : List Letter), w = a ++ b → w' = b ++ a → + Trk.{uu} {k | k ≠ t.1} (sW w) (sW w') := fun a b h h' => + (trk_rot_sW a b h h').restrict fun k _ => .inl (mem_univ _) + have c0 : Trk.{uu} {k | k ≠ t.1} (sW (P ++ (t :: s ++ [linv t]) ++ Q)) (sW + (Q ++ P ++ t :: s ++ [linv t])) := + r (P ++ (t :: s ++ [linv t])) Q (by simp) (by simp) + have c2 : Trk.{uu} {k | k ≠ t.1} (sW (P ++ Q ++ t :: s ++ [linv t])) (sW (t :: s ++ linv t :: + (P ++ Q))) := + r (P ++ Q) (t :: s ++ [linv t]) (by simp) (by simp) + exact c0.trans ((trk_slide_hole t hs hQ hP).trans c2) + +/-- The side of `W` with label `k` and sign `true` has parameter `ρ`. -/ +def SideVal {T : Type*} (W : ℕ → List Letter) (f : ℕ × ℂ → T) (k : ℕ) (ρ : ℝ → T) : Prop := + ∃ i p, (W i)[p]? = some (k, true) ∧ ∀ u ∈ Icc (0 : ℝ) 1, f (i, sdPt (W i).length p true u) = ρ u + +/-- Sides that a move keeps. -/ +theorem Trk.sideVal {K : Set ℕ} {W W' : ℕ → List Letter} (h : Trk.{uu} K W W') {T : Type uu} + [TopologicalSpace T] + [T2Space T] {f : ℕ × ℂ → T} (hf : Presents W f) : ∃ f', Presents W' f' + ∧ ∀ k ∈ K, ∀ ρ, SideVal W f k ρ → SideVal W' f' k ρ := by + obtain ⟨f', h1, h2⟩ := h T f hf + refine ⟨f', h1, fun k hk ρ ⟨i, p, h3, h4⟩ => ?_⟩ + obtain ⟨i', p', h5, h6⟩ := h2 k hk i p true h3 + exact ⟨i', p', h5, fun u hu => (h6 u hu).trans (h4 u hu)⟩ + +theorem sdPt_true (n p : ℕ) (u : ℝ) : sdPt n p true u = per n (p + u) := by + simp [sdPt] + +/-- A free side with parameter `ρ` at the front of a word is cut into two halves. -/ +theorem exists_split_front {T : Type uu} [TopologicalSpace T] {B : List Letter} {p q : ℕ} + (hpq : p ≠ q) + (hp : NoLab B p) (hq : NoLab B q) {f : ℕ × ℂ → T} (hf : Presents (sW + ((p, true) :: B)) f) {ρ : ℝ → T} + (hρ : SideVal (sW ((p, true) :: B)) f p ρ) : + ∃ f', Presents (sW ((p, true) :: (q, true) :: B)) f' ∧ SideVal (sW ((p, true) :: + (q, true) :: B)) f' p (fun u => ρ (u / 2)) ∧ + SideVal (sW ((p, true) :: (q, true) :: B)) f' q (fun u => ρ ((1 + u) / 2)) ∧ + ∀ k, k ≠ p → k ≠ q → ∀ ρ', SideVal (sW ((p, true) :: B)) f k ρ' → SideVal (sW ((p, true) :: + (q, true) :: B)) f' k ρ' := by + obtain ⟨θ, hθ, hv⟩ := exists_isPolyMap_merge (e := true) (e' := true) hpq hp hq + have hS0 : ∀ {w : List Letter} {i p : ℕ} {l : Letter}, (sW w i)[p]? = some l → i = 0 ∧ w[p]? + = some l := by + intro w i p l h + by_cases hi : i = 0 + · subst hi + exact ⟨rfl, by simpa [sW] using h⟩ + · simp [sW, update_of_ne hi, nW] at h + have hlen : (B.length : ℝ) = ((B.length : ℕ) : ℝ) := rfl + have hB0 : (0 : ℝ) ≤ B.length := Nat.cast_nonneg _ + have hbase : ∀ _ : ℕ, (sW ((p, true) :: B) 0).length = B.length + 1 ∧ + (sW ((p, true) :: (q, true) :: B) 0).length = B.length + 2 := by + intro _ + simp [sW] + have hρ0 : ∀ u ∈ Icc (0 : ℝ) 1, f (0, per (B.length + 1) u) = ρ u := by + obtain ⟨i, r, h1, h2⟩ := hρ + obtain ⟨rfl, h3⟩ := hS0 h1 + cases r with + | zero => + intro u hu + have := h2 u hu + rw [(hbase 0).1, sdPt_true] at this + simpa using this + | succ r => + rw [List.getElem?_cons_succ] at h3 + exact absurd rfl (hp _ (List.mem_of_getElem? h3)) + refine ⟨f ∘ θ, hf.of_map hθ, ⟨0, 0, by simp [sW], fun u hu => ?_⟩, ⟨0, 1, by simp [sW], + fun u hu => ?_⟩, ?_⟩ + · have hu₀ : ((0 : ℕ) : ℝ) + u ∈ Icc (0 : ℝ) ↑(B.length + 2) := by + constructor + · simpa using hu.1 + · push_cast + linarith [hu.2] + rw [(hbase 0).2, sdPt_true, Function.comp_apply, hv _ hu₀] + have : mergeG (((0 : ℕ) : ℝ) + u) = u / 2 := by + simp only [mergeG, Nat.cast_zero, zero_add] + rw [ite_eq_left (by linarith [hu.2])] + rw [this] + exact hρ0 _ ⟨by linarith [hu.1], by linarith [hu.2]⟩ + · rw [(hbase 0).2, sdPt_true, Function.comp_apply, hv _ ⟨by push_cast; linarith [hu.1], by + push_cast; linarith [hu.2]⟩] + have : mergeG (((1 : ℕ) : ℝ) + u) = (1 + u) / 2 := by + simp only [mergeG, Nat.cast_one] + rw [ite_eq_left (by linarith [hu.2])] + rw [this] + exact hρ0 _ ⟨by linarith [hu.1], by linarith [hu.2]⟩ + · rintro k hkp hkq ρ' ⟨i, r, h1, h2⟩ + obtain ⟨rfl, h3⟩ := hS0 h1 + cases r with + | zero => + have : (p, true) = (k, true) := by simpa using h3 + exact absurd (Prod.mk.inj this).1.symm hkp + | succ r => + rw [List.getElem?_cons_succ] at h3 + have hr : r < B.length := (List.getElem?_eq_some_iff.mp h3).1 + refine ⟨0, r + 2, by simpa [sW] using h3, fun u hu => ?_⟩ + have h4 := h2 u hu + rw [(hbase 0).1, sdPt_true] at h4 + rw [(hbase 0).2, sdPt_true, Function.comp_apply] + have hr' : ((r + 1 : ℕ) : ℝ) ≤ B.length := by exact_mod_cast hr + push_cast at hr' + have hr0 : (0 : ℝ) ≤ r := Nat.cast_nonneg _ + rw [hv _ ⟨by push_cast; linarith [hu.1], by push_cast; linarith [hu.2]⟩, + mergeG_ge (by push_cast; linarith [hu.1])] + rw [← h4] + congr 3 + push_cast + ring + +/-- A free side with parameter `ρ` inside a word is cut into two halves. -/ +theorem exists_split {T : Type uu} [TopologicalSpace T] [T2Space T] {A B : List Letter} {p q : ℕ} + (hpq : p ≠ q) + (hp : NoLab (B ++ A) p) (hq : NoLab (B ++ A) q) {f : ℕ × ℂ → T} (hf : Presents (sW (A ++ + (p, true) :: B)) f) {ρ : ℝ → T} + (hρ : SideVal (sW (A ++ (p, true) :: B)) f p ρ) : + ∃ f', Presents (sW (A ++ (p, true) :: (q, true) :: B)) f' ∧ SideVal (sW (A ++ (p, true) :: + (q, true) :: B)) f' p (fun u => ρ (u / 2)) ∧ + SideVal (sW (A ++ (p, true) :: (q, true) :: B)) f' q (fun u => ρ ((1 + u) / 2)) ∧ + ∀ k, k ≠ p → k ≠ q → ∀ ρ', SideVal (sW (A ++ (p, true) :: B)) f k ρ' → SideVal (sW (A ++ + (p, true) :: (q, true) :: B)) f' k ρ' := by + obtain ⟨f₁, h1, h2⟩ := (trk_rot_sW.{uu} (w := A ++ (p, true) :: B) (w' := (p, true) :: + (B ++ A)) A ((p, true) :: B) rfl (by simp)).sideVal hf + obtain ⟨f₂, h3, h4, h5, h6⟩ := exists_split_front hpq hp hq h1 (h2 _ (mem_univ _) _ hρ) + obtain ⟨f₃, h7, h8⟩ := (trk_rot_sW.{uu} (w := (p, true) :: (q, true) :: (B ++ A)) (w' := A ++ + (p, true) :: (q, true) :: B) ((p, true) :: (q, true) :: B) A (by simp) rfl).sideVal h3 + exact ⟨f₃, h7, h8 _ (mem_univ _) _ h4, h8 _ (mem_univ _) _ h5, fun k h9 h10 ρ' h11 => + h8 _ (mem_univ _) _ (h6 k h9 h10 ρ' (h2 _ (mem_univ _) _ h11))⟩ + +end GraphMinor.Surface diff --git a/LeanPool/GraphMinor/Thomas/Amalgamate.lean b/LeanPool/GraphMinor/Thomas/Amalgamate.lean new file mode 100644 index 0000000000..ca8c76e8bb --- /dev/null +++ b/LeanPool/GraphMinor/Thomas/Amalgamate.lean @@ -0,0 +1,480 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Thomas.Basic + +/-! +# Amalgamating tree-decompositions (Bellenbaum–Diestel, Section 2) + +This file formalizes Section 2 of P. Bellenbaum and R. Diestel, *Two short proofs concerning +tree-decompositions*, Combin. Probab. Comput. 11 (2002) 541–547 (page 2): + +- Given a tree-decomposition `D = (V_t)_{t ∈ T}` of `(G, V₀)`, a subset `X ⊆ V₀`, a union `C` of + components of `G - X`, `H := G[C ∪ X]`, a node `s ∈ T`, and a choice of 'home' node `home x ∈ T` + with `x ∈ V_{home x}` for each `x ∈ X`, we define + $$W_t := (V_t \cap (C \cup X)) \cup \{\, x \in X \mid t \in t_x T s \,\}$$ + (`shiftBag`) and prove that `D_s(H) := (W_t)_{t ∈ T}` (`shift`) is a tree-decomposition of `H` + with `X ⊆ W_s`. +- **Lemma 2** (`lemma_2`): If `G - C` contains a set `{P_x | x ∈ X}` of disjoint `X`–`V_s` paths + with `x ∈ P_x` for all `x`, then `|W_t| ≤ |V_t|` for all `t ∈ T`. +- **Amalgamation** (`combine`): For two disjoint copies `T^1, T^2` of `T` joined by the edge + `t₂^1 t₁^2` (`T' := T^1 ∪ T^2 + t₂^1 t₁^2`, indexed by `Bool × ι`), combining `D_{t₂}(H₁)` and + `D_{t₁}(H₂)` yields a tree-decomposition `D'` of `G`. +-/ + +@[expose] public section + +namespace GraphMinor.Thomas + +open SimpleGraph + +variable {α ι : Type*} + +namespace TreeDecomp + +variable [Fintype ι] {G : SimpleGraph α} {V₀ : Set α} (D : TreeDecomp G V₀ ι) + +/-- The modified bag `W_t := (V_t ∩ (C ∪ X)) ∪ {x ∈ X | t ∈ t_x T s}` of `\mathcal{D}_s(H)` +(Bellenbaum and Diestel, Section 2, page 2). -/ +def shiftBag (X C : Set α) (home : α → ι) (s : ι) (t : ι) : Set α := + (D.bag t ∩ (C ∪ X)) ∪ {x ∈ X | OnTreePath D.T (home x) s t} + +@[simp] +theorem mem_shiftBag {X C : Set α} {home : α → ι} {s t : ι} {x : α} : + x ∈ D.shiftBag X C home s t ↔ + (x ∈ D.bag t ∧ (x ∈ C ∨ x ∈ X)) ∨ (x ∈ X ∧ OnTreePath D.T (home x) s t) := + Iff.rfl + +theorem subset_shiftBag_self (X C : Set α) (home : α → ι) (s : ι) : + X ⊆ D.shiftBag X C home s s := + fun x hx ↦ Or.inr ⟨hx, onTreePath_right D.T (home x) s⟩ + +theorem shiftBag_sdiff_subset (X C : Set α) (home : α → ι) (s t : ι) : + D.shiftBag X C home s t \ X ⊆ D.bag t ∩ C := by + rintro x ⟨(⟨hbt, hxC | hxX⟩ | ⟨hxX, _⟩), hnotX⟩ + · exact ⟨hbt, hxC⟩ + · exact (hnotX hxX).elim + · exact (hnotX hxX).elim + +theorem shiftBag_inter_compl_eq (X C : Set α) (home : α → ι) (s t : ι) : + D.shiftBag X C home s t \ D.bag t = + {x ∈ X | OnTreePath D.T (home x) s t} \ D.bag t := by + ext x + simp only [shiftBag, Set.mem_sdiff, Set.mem_union, Set.mem_inter_iff, Set.mem_sep_iff] + tauto + +theorem shiftBag_subset (X C : Set α) (home : α → ι) (s t : ι) + (hX : X ⊆ V₀) : + D.shiftBag X C home s t ⊆ V₀ := by + rintro x (⟨hbt, _⟩ | ⟨hxX, _⟩) + · exact D.bag_subset t hbt + · exact hX hxX + +theorem shiftBag_finite (hV₀ : V₀.Finite) {X C : Set α} (hX : X ⊆ V₀) + (home : α → ι) (s t : ι) : + (D.shiftBag X C home s t).Finite := + hV₀.subset (D.shiftBag_subset X C home s t hX) + +/-- `\mathcal{D}_s(H) := (W_t)_{t ∈ T}` is a tree-decomposition of `H = G[C ∪ X]` +(Bellenbaum and Diestel, Section 2, page 2). -/ +def shift {X C : Set α} (hX : X ⊆ V₀) (hC : C ⊆ V₀) + {home : α → ι} (hhome : ∀ x ∈ X, x ∈ D.bag (home x)) (s : ι) : + TreeDecomp G (C ∪ X) ι where + T := D.T + isTree := D.isTree + bag := D.shiftBag X C home s + iUnion_bag := by + ext x + simp only [Set.mem_iUnion, mem_shiftBag, Set.mem_union] + constructor + · rintro ⟨t, ⟨_, h⟩ | ⟨hxX, _⟩⟩ + · exact h + · exact Or.inr hxX + · intro hx + obtain ⟨t, hxt⟩ := D.exists_mem_bag (Set.union_subset hC hX hx) + exact ⟨t, Or.inl ⟨hxt, hx⟩⟩ + adj_mem_bag u v hu hv hadj := by + obtain ⟨t, hut, hvt⟩ := D.adj_mem_bag (Set.union_subset hC hX hu) + (Set.union_subset hC hX hv) hadj + exact ⟨t, Or.inl ⟨hut, hu⟩, Or.inl ⟨hvt, hv⟩⟩ + inter_subset_bag t₁ t₂ t₃ ht x := by + rintro ⟨h₁, h₃⟩ + rcases h₁ with ⟨hx₁, hxCX⟩ | ⟨hxX, hpath₁⟩ + · rcases h₃ with ⟨hx₃, _⟩ | ⟨hxX, hpath₃⟩ + · exact Or.inl ⟨D.mem_bag_of_onTreePath ht hx₁ hx₃, hxCX⟩ + · rcases onTreePath_left_or_right D.isTree (home x) ht with h | h + · exact Or.inl ⟨D.mem_bag_of_onTreePath (onTreePath_symm h) (hhome x hxX) hx₁, hxCX⟩ + · exact Or.inr ⟨hxX, onTreePath_trans_left D.isTree hpath₃ h⟩ + · rcases h₃ with ⟨hx₃, _⟩ | ⟨_, hpath₃⟩ + · rcases onTreePath_left_or_right D.isTree (home x) (onTreePath_symm ht) with h | h + · exact Or.inl ⟨D.mem_bag_of_onTreePath (onTreePath_symm h) (hhome x hxX) hx₃, Or.inr hxX⟩ + · exact Or.inr ⟨hxX, onTreePath_trans_left D.isTree hpath₁ h⟩ + · rcases onTreePath_left_or_right D.isTree s ht with h | h + · exact Or.inr ⟨hxX, onTreePath_trans_right D.isTree hpath₁ h⟩ + · exact Or.inr ⟨hxX, onTreePath_trans_right D.isTree hpath₃ (onTreePath_symm h)⟩ + +/-- **Lemma 2** of Bellenbaum and Diestel (Section 2, page 2): +If `G - C` contains a set `{P_x | x ∈ X}` of disjoint `X`–`V_s` paths with `x ∈ P_x` for all `x`, +then `|W_t| ≤ |V_t|` for all `t ∈ T`. + +Here each `x ∈ X` has a walk `P x` in `G` from `x` to `endVert x ∈ D.bag s` whose support lies in +`V₀ \ C`, such that for distinct `x, y ∈ X` the supports of `P x` and `P y` are disjoint. -/ +theorem lemma_2 (hV₀ : V₀.Finite) {X C : Set α} (hX : X ⊆ V₀) + {home : α → ι} (hhome : ∀ x ∈ X, x ∈ D.bag (home x)) (s : ι) + {endVert : α → α} (hend : ∀ x ∈ X, endVert x ∈ D.bag s) + (P : ∀ x ∈ X, G.Walk x (endVert x)) + (hP_sub : ∀ x (hx : x ∈ X), ∀ z ∈ (P x hx).support, z ∈ V₀ \ C) + (hP_disj : ∀ x (hx : x ∈ X) y (hy : y ∈ X), x ≠ y → + Disjoint {z | z ∈ (P x hx).support} {z | z ∈ (P y hy).support}) + (t : ι) : + (D.shiftBag X C home s t).ncard ≤ (D.bag t).ncard := by + classical + have hY_mem : ∀ x ∈ D.shiftBag X C home s t \ D.bag t, x ∈ X ∧ OnTreePath D.T (home x) s t := by + intro x hx + rw [shiftBag_inter_compl_eq] at hx + exact hx.1 + have hY_ex : ∀ x (hx : x ∈ D.shiftBag X C home s t \ D.bag t), + ∃ z ∈ (P x (hY_mem x hx).1).support, z ∈ D.bag t \ D.shiftBag X C home s t := by + intro x hx + have ⟨hxX, hpath⟩ := hY_mem x hx + have hnotbag : x ∉ D.bag t := hx.2 + obtain ⟨z, hzP, hzt⟩ := D.lemma_1_vertex hpath (hhome x hxX) (hend x hxX) (P x hxX) + (fun w hw ↦ (hP_sub x hxX w hw).1) + refine ⟨z, hzP, hzt, ?_⟩ + intro hzW + rcases hzW with ⟨_, hzC | hzX⟩ | ⟨hzX, _⟩ + · exact (hP_sub x hxX z hzP).2 hzC + · have hzx : x = z := by + by_contra hne + exact Set.disjoint_left.1 (hP_disj x hxX z hzX hne) hzP (Walk.start_mem_support _) + exact hnotbag (hzx ▸ hzt) + · have hzx : x = z := by + by_contra hne + exact Set.disjoint_left.1 (hP_disj x hxX z hzX hne) hzP (Walk.start_mem_support _) + exact hnotbag (hzx ▸ hzt) + let f : α → α := fun x ↦ + if hx : x ∈ D.shiftBag X C home s t \ D.bag t then (hY_ex x hx).choose else x + have hf_mem : ∀ x ∈ D.shiftBag X C home s t \ D.bag t, + f x ∈ D.bag t \ D.shiftBag X C home s t := by + intro x hx + dsimp only [f] + rw [dite_eq_left hx] + exact (hY_ex x hx).choose_spec.2 + have hf_inj : Set.InjOn f (D.shiftBag X C home s t \ D.bag t) := by + intro x hx y hy hxy + dsimp only [f] at hxy + rw [dite_eq_left hx, dite_eq_left hy] at hxy + by_contra hne + have h1 := (hY_ex x hx).choose_spec.1 + have h2 := hxy ▸ (hY_ex y hy).choose_spec.1 + exact Set.disjoint_left.1 (hP_disj x (hY_mem x hx).1 y (hY_mem y hy).1 hne) h1 h2 + rw [Set.ncard_le_ncard_iff_ncard_sdiff_le_ncard_sdiff + (D.shiftBag_finite hV₀ hX home s t) (D.bag_finite hV₀ t)] + exact Set.ncard_le_ncard_of_injOn f hf_mem hf_inj ((D.bag_finite hV₀ t).sdiff) + +end TreeDecomp + +/-! ## Combining two tree-decompositions (`T^1 ∪ T^2 + t₂^1 t₁^2`) -/ + +/-- Two disjoint copies `T^1 ∪ T^2` of a graph `T` on `Bool × ι`. -/ +def disjointCopy (T : SimpleGraph ι) : SimpleGraph (Bool × ι) where + Adj p q := p.1 = q.1 ∧ T.Adj p.2 q.2 + symm := ⟨fun _ _ h ↦ ⟨h.1.symm, h.2.symm⟩⟩ + loopless := ⟨fun p h ↦ T.loopless.irrefl p.2 h.2⟩ + +/-- Projection homomorphism from `disjointCopy T` to `T`. -/ +def sndHom (T : SimpleGraph ι) : disjointCopy T →g T where + toFun p := p.2 + map_rel' h := h.2 + +theorem disjointCopy_fst_eq_of_mem_support {T : SimpleGraph ι} {u v : Bool × ι} + (w : (disjointCopy T).Walk u v) {x : Bool × ι} (hx : x ∈ w.support) : + x.1 = u.1 := by + induction w with + | nil => + simp only [Walk.support_nil, List.mem_singleton] at hx + rw [hx] + | cons hadj p ih => + simp only [Walk.support_cons, List.mem_cons] at hx + rcases hx with rfl | hx + · rfl + · exact (ih hx).trans hadj.1.symm + +theorem not_reachable_disjointCopy (T : SimpleGraph ι) (t₂ t₁ : ι) : + ¬ (disjointCopy T).Reachable (false, t₂) (true, t₁) := by + rintro ⟨w⟩ + exact Bool.false_ne_true (disjointCopy_fst_eq_of_mem_support w w.end_mem_support).symm + +theorem disjointCopy_support_eq {T : SimpleGraph ι} {u v : Bool × ι} + (w : (disjointCopy T).Walk u v) : + w.support = (w.map (sndHom T)).support.map (fun s ↦ (u.1, s)) := by + rw [Walk.support_map, List.map_map] + conv_lhs => rw [← List.map_id w.support] + refine List.map_congr_left fun x hx ↦ ?_ + exact Prod.ext (disjointCopy_fst_eq_of_mem_support w hx) rfl + +theorem disjointCopy_isPath_map {T : SimpleGraph ι} {u v : Bool × ι} + {w : (disjointCopy T).Walk u v} (hw : w.IsPath) : + (w.map (sndHom T)).IsPath := by + rw [Walk.isPath_def] + have h := hw.support_nodup + rw [disjointCopy_support_eq w] at h + exact h.of_map _ + +theorem disjointCopy_isAcyclic {T : SimpleGraph ι} (hT : T.IsAcyclic) : + (disjointCopy T).IsAcyclic := by + rw [isAcyclic_iff_subsingleton_path] + intro u v + refine ⟨fun ⟨p, hp⟩ ⟨q, hq⟩ ↦ Subtype.ext ?_⟩ + have hp' : (p.map (sndHom T)).IsPath := disjointCopy_isPath_map hp + have hq' : (q.map (sndHom T)).IsPath := disjointCopy_isPath_map hq + have heq : p.map (sndHom T) = q.map (sndHom T) := + Subtype.ext_iff.1 ((hT.subsingleton_path u.2 v.2).elim ⟨_, hp'⟩ ⟨_, hq'⟩) + apply Walk.ext_support + rw [disjointCopy_support_eq p, disjointCopy_support_eq q, heq] + +/-- The tree `T' := T^1 ∪ T^2 + t₂^1 t₁^2` on `Bool × ι`, where `false` is copy `1` and `true` is +copy `2`, and the bridge edge joins `(false, t₂)` and `(true, t₁)` (Bellenbaum and Diestel, proof +of Theorem 3, page 3). -/ +def combineTree (T : SimpleGraph ι) (t₂ t₁ : ι) : SimpleGraph (Bool × ι) where + Adj p q := + (p.1 = q.1 ∧ T.Adj p.2 q.2) ∨ + (p = (false, t₂) ∧ q = (true, t₁)) ∨ + (p = (true, t₁) ∧ q = (false, t₂)) + symm := ⟨fun _ _ h ↦ by + rcases h with ⟨h1, h2⟩ | ⟨h1, h2⟩ | ⟨h1, h2⟩ + · exact Or.inl ⟨h1.symm, h2.symm⟩ + · exact Or.inr (Or.inr ⟨h2, h1⟩) + · exact Or.inr (Or.inl ⟨h2, h1⟩)⟩ + loopless := ⟨fun p h ↦ by + rcases h with ⟨_, h2⟩ | ⟨h1, h2⟩ | ⟨h1, h2⟩ + · exact T.loopless.irrefl p.2 h2 + · exact Bool.false_ne_true (congrArg Prod.fst (h1.symm.trans h2)) + · exact Bool.false_ne_true (congrArg Prod.fst (h2.symm.trans h1))⟩ + +theorem combineTree_eq_sup_edge (T : SimpleGraph ι) (t₂ t₁ : ι) : + combineTree T t₂ t₁ = disjointCopy T ⊔ SimpleGraph.edge (false, t₂) (true, t₁) := by + ext p q + simp only [combineTree, SimpleGraph.sup_adj, disjointCopy, SimpleGraph.edge_adj, ne_eq] + constructor + · rintro (h | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) + · exact Or.inl h + · exact Or.inr ⟨Or.inl ⟨rfl, rfl⟩, fun h ↦ Bool.false_ne_true (congrArg Prod.fst h)⟩ + · exact Or.inr ⟨Or.inr ⟨rfl, rfl⟩, fun h ↦ Bool.false_ne_true (congrArg Prod.fst h.symm)⟩ + · rintro (h | ⟨⟨rfl, rfl⟩ | ⟨rfl, rfl⟩, _⟩) + · exact Or.inl h + · exact Or.inr (Or.inl ⟨rfl, rfl⟩) + · exact Or.inr (Or.inr ⟨rfl, rfl⟩) + +theorem combineTree_adj_embed {T : SimpleGraph ι} (t₂ t₁ : ι) (b : Bool) {s₁ s₂ : ι} + (h : T.Adj s₁ s₂) : (combineTree T t₂ t₁).Adj (b, s₁) (b, s₂) := + Or.inl ⟨rfl, h⟩ + +theorem combineTree_adj_bridge_left (T : SimpleGraph ι) (t₂ t₁ : ι) : + (combineTree T t₂ t₁).Adj (false, t₂) (true, t₁) := + Or.inr (Or.inl ⟨rfl, rfl⟩) + +theorem combineTree_adj_bridge_right (T : SimpleGraph ι) (t₂ t₁ : ι) : + (combineTree T t₂ t₁).Adj (true, t₁) (false, t₂) := + Or.inr (Or.inr ⟨rfl, rfl⟩) + +/-- Embedding a walk of `T` into copy `b : Bool` of `combineTree T t₂ t₁`. -/ +abbrev embedCombineHom (T : SimpleGraph ι) (t₂ t₁ : ι) (b : Bool) : + T →g combineTree T t₂ t₁ where + toFun s := (b, s) + map_rel' h := combineTree_adj_embed t₂ t₁ b h + +theorem embedCombineHom_injective (b : Bool) : + Function.Injective (fun s : ι ↦ (b, s)) := + fun _ _ h ↦ Prod.ext_iff.1 h |>.2 + +/-- Canonical path in `combineTree T t₂ t₁` between `u` and `v`. -/ +noncomputable def combinePath {T : SimpleGraph ι} (hT : T.IsTree) (t₂ t₁ : ι) : + ∀ u v : Bool × ι, (combineTree T t₂ t₁).Walk u v + | (false, s₁), (false, s₂) => + (treePath hT s₁ s₂).map (embedCombineHom T t₂ t₁ false) + | (true, s₁), (true, s₂) => + (treePath hT s₁ s₂).map (embedCombineHom T t₂ t₁ true) + | (false, s₁), (true, s₂) => + ((treePath hT s₁ t₂).map (embedCombineHom T t₂ t₁ false)).append + (Walk.cons (combineTree_adj_bridge_left T t₂ t₁) + ((treePath hT t₁ s₂).map (embedCombineHom T t₂ t₁ true))) + | (true, s₁), (false, s₂) => + ((treePath hT s₁ t₁).map (embedCombineHom T t₂ t₁ true)).append + (Walk.cons (combineTree_adj_bridge_right T t₂ t₁) + ((treePath hT t₂ s₂).map (embedCombineHom T t₂ t₁ false))) + +theorem combinePath_isPath {T : SimpleGraph ι} (hT : T.IsTree) (t₂ t₁ : ι) + (u v : Bool × ι) : (combinePath hT t₂ t₁ u v).IsPath := by + rcases u with ⟨b₁, s₁⟩ + rcases v with ⟨b₂, s₂⟩ + cases b₁ <;> cases b₂ + · exact (treePath_isPath hT s₁ s₂).map (embedCombineHom_injective false) + · dsimp [combinePath] + have hp1 : ((treePath hT s₁ t₂).map (embedCombineHom T t₂ t₁ false)).IsPath := + (treePath_isPath hT s₁ t₂).map (embedCombineHom_injective false) + have hp2 : ((treePath hT t₁ s₂).map (embedCombineHom T t₂ t₁ true)).IsPath := + (treePath_isPath hT t₁ s₂).map (embedCombineHom_injective true) + rw [Walk.isPath_def, Walk.support_append, Walk.support_cons, List.tail_cons, List.nodup_append'] + refine ⟨hp1.support_nodup, hp2.support_nodup, ?_⟩ + intro x hx1 hx2 + rw [Walk.support_map, List.mem_map] at hx1 hx2 + obtain ⟨a1, _, rfl⟩ := hx1 + obtain ⟨a2, _, heq⟩ := hx2 + exact Bool.false_ne_true (congrArg Prod.fst heq).symm + · dsimp [combinePath] + have hp1 : ((treePath hT s₁ t₁).map (embedCombineHom T t₂ t₁ true)).IsPath := + (treePath_isPath hT s₁ t₁).map (embedCombineHom_injective true) + have hp2 : ((treePath hT t₂ s₂).map (embedCombineHom T t₂ t₁ false)).IsPath := + (treePath_isPath hT t₂ s₂).map (embedCombineHom_injective false) + rw [Walk.isPath_def, Walk.support_append, Walk.support_cons, List.tail_cons, List.nodup_append'] + refine ⟨hp1.support_nodup, hp2.support_nodup, ?_⟩ + intro x hx1 hx2 + rw [Walk.support_map, List.mem_map] at hx1 hx2 + obtain ⟨a1, _, rfl⟩ := hx1 + obtain ⟨a2, _, heq⟩ := hx2 + exact Bool.false_ne_true (congrArg Prod.fst heq) + · exact (treePath_isPath hT s₁ s₂).map (embedCombineHom_injective true) + +theorem combineTree_isTree {T : SimpleGraph ι} (hT : T.IsTree) (t₂ t₁ : ι) : + (combineTree T t₂ t₁).IsTree where + connected := + { preconnected := fun u v ↦ (combinePath hT t₂ t₁ u v).reachable + nonempty := ⟨(false, t₂)⟩ } + isAcyclic := by + rw [combineTree_eq_sup_edge] + exact (disjointCopy_isAcyclic hT.isAcyclic).sup_edge_of_not_reachable + (not_reachable_disjointCopy T t₂ t₁) + +theorem treePath_combineTree_eq {T : SimpleGraph ι} (hT : T.IsTree) (t₂ t₁ : ι) + (u v : Bool × ι) : + treePath (combineTree_isTree hT t₂ t₁) u v = combinePath hT t₂ t₁ u v := + (eq_treePath (combineTree_isTree hT t₂ t₁) (combinePath hT t₂ t₁ u v) + (combinePath_isPath hT t₂ t₁ u v)).symm + +theorem onTreePath_combineTree_same {T : SimpleGraph ι} (hT : T.IsTree) (t₂ t₁ : ι) + (b : Bool) (s₁ s₂ : ι) (p : Bool × ι) : + OnTreePath (combineTree T t₂ t₁) (b, s₁) (b, s₂) p ↔ + p.1 = b ∧ OnTreePath T s₁ s₂ p.2 := by + rw [onTreePath_iff_mem_treePath (combineTree_isTree hT t₂ t₁), treePath_combineTree_eq hT] + rcases p with ⟨bp, sp⟩ + cases b <;> + · simp only [combinePath, Walk.support_map, List.mem_map, RelHom.coeFn_mk, Prod.mk.injEq, + exists_eq_right_right, onTreePath_iff_mem_treePath hT] + tauto + +theorem onTreePath_combineTree_false_true {T : SimpleGraph ι} (hT : T.IsTree) (t₂ t₁ : ι) + (s₁ s₂ : ι) (p : Bool × ι) : + OnTreePath (combineTree T t₂ t₁) (false, s₁) (true, s₂) p ↔ + (p.1 = false ∧ OnTreePath T s₁ t₂ p.2) ∨ (p.1 = true ∧ OnTreePath T t₁ s₂ p.2) := by + rw [onTreePath_iff_mem_treePath (combineTree_isTree hT t₂ t₁), treePath_combineTree_eq hT] + rcases p with ⟨bp, sp⟩ + dsimp [combinePath] + rw [Walk.support_append, Walk.support_cons, List.tail_cons, List.mem_append, + Walk.support_map, Walk.support_map, List.mem_map, List.mem_map] + cases bp <;> + simp [onTreePath_iff_mem_treePath hT] + +namespace TreeDecomp + +variable [Fintype ι] {G : SimpleGraph α} {V₀ : Set α} (D : TreeDecomp G V₀ ι) + +/-- The bags of the amalgamated tree-decomposition `\mathcal{D}'` on `T' = T^1 ∪ T^2 + t₂^1 t₁^2` +(Bellenbaum and Diestel, proof of Theorem 3, page 3). -/ +def combineBag (X C₁ C₂ : Set α) (home : α → ι) (t₁ t₂ : ι) : Bool × ι → Set α + | (false, t) => D.shiftBag X C₁ home t₂ t + | (true, t) => D.shiftBag X C₂ home t₁ t + +theorem shiftBag_subset_union (X C : Set α) (home : α → ι) (s t : ι) : + D.shiftBag X C home s t ⊆ C ∪ X := by + rintro x (⟨_, hx⟩ | ⟨hxX, _⟩) + · exact hx + · exact Or.inr hxX + +/-- Amalgamating `\mathcal{D}_{t₂}(H₁)` and `\mathcal{D}_{t₁}(H₂)` along the edge `t₂^1 t₁^2` yields +a tree-decomposition `\mathcal{D}'` of `G` (Bellenbaum and Diestel, proof of Theorem 3, page 3). -/ +def combine {X C₁ C₂ : Set α} (hX : X ⊆ V₀) (hC₁ : C₁ ⊆ V₀) (hC₂ : C₂ ⊆ V₀) + (hcov : V₀ ⊆ C₁ ∪ C₂ ∪ X) (hdisj : Disjoint C₁ C₂) + (hsep : ∀ ⦃u v : α⦄, u ∈ V₀ → v ∈ V₀ → G.Adj u v → + (u ∈ C₁ ∪ X ∧ v ∈ C₁ ∪ X) ∨ (u ∈ C₂ ∪ X ∧ v ∈ C₂ ∪ X)) + {home : α → ι} (hhome : ∀ x ∈ X, x ∈ D.bag (home x)) (t₁ t₂ : ι) : + TreeDecomp G V₀ (Bool × ι) where + T := combineTree D.T t₂ t₁ + isTree := combineTree_isTree D.isTree t₂ t₁ + bag := D.combineBag X C₁ C₂ home t₁ t₂ + iUnion_bag := by + have h1 := (D.shift hX hC₁ hhome t₂).iUnion_bag + have h2 := (D.shift hX hC₂ hhome t₁).iUnion_bag + ext x + simp only [Set.mem_iUnion, Prod.exists, Bool.exists_bool, combineBag] + have h1' : (∃ t, x ∈ D.shiftBag X C₁ home t₂ t) ↔ x ∈ C₁ ∪ X := by + rw [← Set.mem_iUnion]; exact Eq.to_iff (congrArg (x ∈ ·) h1) + have h2' : (∃ t, x ∈ D.shiftBag X C₂ home t₁ t) ↔ x ∈ C₂ ∪ X := by + rw [← Set.mem_iUnion]; exact Eq.to_iff (congrArg (x ∈ ·) h2) + rw [h1', h2'] + constructor + · rintro ((hx | hx) | (hx | hx)) + · exact hC₁ hx + · exact hX hx + · exact hC₂ hx + · exact hX hx + · intro hx + rcases hcov hx with (hx | hx) | hx + · exact Or.inl (Or.inl hx) + · exact Or.inr (Or.inl hx) + · exact Or.inl (Or.inr hx) + adj_mem_bag u v hu hv hadj := by + rcases hsep hu hv hadj with ⟨hu1, hv1⟩ | ⟨hu2, hv2⟩ + · obtain ⟨t, hut, hvt⟩ := (D.shift hX hC₁ hhome t₂).adj_mem_bag hu1 hv1 hadj + exact ⟨(false, t), hut, hvt⟩ + · obtain ⟨t, hut, hvt⟩ := (D.shift hX hC₂ hhome t₁).adj_mem_bag hu2 hv2 hadj + exact ⟨(true, t), hut, hvt⟩ + inter_subset_bag := by + rintro ⟨b₁, s₁⟩ ⟨b₂, s₂⟩ ⟨b₃, s₃⟩ hp x ⟨hx₁, hx₃⟩ + cases b₁ <;> cases b₃ + · rw [onTreePath_combineTree_same D.isTree t₂ t₁ false s₁ s₃ (b₂, s₂)] at hp + rcases hp with ⟨rfl, hp⟩ + exact (D.shift hX hC₁ hhome t₂).inter_subset_bag hp ⟨hx₁, hx₃⟩ + · rw [onTreePath_combineTree_false_true D.isTree t₂ t₁ s₁ s₃ (b₂, s₂)] at hp + have hxX : x ∈ X := by + have h1 := D.shiftBag_subset_union X C₁ home t₂ s₁ hx₁ + have h2 := D.shiftBag_subset_union X C₂ home t₁ s₃ hx₃ + rcases h1 with hC1 | hX1 + · rcases h2 with hC2 | hX2 + · exact (Set.disjoint_left.1 hdisj hC1 hC2).elim + · exact hX2 + · exact hX1 + rcases hp with ⟨rfl, hp⟩ | ⟨rfl, hp⟩ + · exact (D.shift hX hC₁ hhome t₂).inter_subset_bag hp + ⟨hx₁, D.subset_shiftBag_self X C₁ home t₂ hxX⟩ + · exact (D.shift hX hC₂ hhome t₁).inter_subset_bag hp + ⟨D.subset_shiftBag_self X C₂ home t₁ hxX, hx₃⟩ + · have hp' := onTreePath_symm hp + rw [onTreePath_combineTree_false_true D.isTree t₂ t₁ s₃ s₁ (b₂, s₂)] at hp' + have hxX : x ∈ X := by + have h1 := D.shiftBag_subset_union X C₂ home t₁ s₁ hx₁ + have h2 := D.shiftBag_subset_union X C₁ home t₂ s₃ hx₃ + rcases h1 with hC2 | hX2 + · rcases h2 with hC1 | hX1 + · exact (Set.disjoint_left.1 hdisj hC1 hC2).elim + · exact hX1 + · exact hX2 + rcases hp' with ⟨rfl, hp'⟩ | ⟨rfl, hp'⟩ + · exact (D.shift hX hC₁ hhome t₂).inter_subset_bag hp' + ⟨hx₃, D.subset_shiftBag_self X C₁ home t₂ hxX⟩ + · exact (D.shift hX hC₂ hhome t₁).inter_subset_bag hp' + ⟨D.subset_shiftBag_self X C₂ home t₁ hxX, hx₁⟩ + · rw [onTreePath_combineTree_same D.isTree t₂ t₁ true s₁ s₃ (b₂, s₂)] at hp + rcases hp with ⟨rfl, hp⟩ + exact (D.shift hX hC₂ hhome t₁).inter_subset_bag hp ⟨hx₁, hx₃⟩ + +end TreeDecomp + +end GraphMinor.Thomas diff --git a/LeanPool/GraphMinor/Thomas/Basic.lean b/LeanPool/GraphMinor/Thomas/Basic.lean new file mode 100644 index 0000000000..6dcd00e354 --- /dev/null +++ b/LeanPool/GraphMinor/Thomas/Basic.lean @@ -0,0 +1,401 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.TreePath +public import Mathlib.Data.Finset.Card +public import Mathlib.Data.Set.Card +public import LeanPool.GraphMinor.Hypergraph.Basic + +/-! +# Undirected trees and Bellenbaum–Diestel tree-decompositions + +This file defines tree-decompositions in the sense of R. Diestel, *Graph Theory*, as used by +P. Bellenbaum and R. Diestel, *Two short proofs concerning tree-decompositions*, Combin. Probab. +Comput. 11 (2002) 541–547, Sections 1–3, and proves the basic properties of paths in trees and +Lemma 1 of that paper. + +In a tree `T : SimpleGraph ι` (`hT : T.IsTree`), for any two vertices `t₁, t₂ : ι`, there is a +unique path between `t₁` and `t₂`. We denote by `treePath hT t₁ t₂` this path, by +`OnTreePath T t₁ t₂ t` the relation that `t` lies on `t₁ T t₂` (which for a tree is equivalent to +every path from `t₁` to `t₂` passing through `t`), and by `OnTreePathEdge T t₁ t₂ t t'` that the +edge `t t'` lies on `t₁ T t₂`. + +A tree-decomposition `D : TreeDecomp G V₀` of a graph `(G, V₀)` (a `SimpleGraph α` on vertex set +`V₀ : Set α`) consists of an index type `ι` (`[Fintype ι]`), a tree `T : SimpleGraph ι`, and bags +` bag : ι → Set α` satisfying: +- (T1) `⋃ t, bag t = V₀` (`iUnion_bag`) +- (T2) every edge of `G` with both ends in `V₀` has both ends in some `bag t` (`adj_mem_bag`) +- (T3) if `t₂` lies on the path `t₁ T t₃`, then `bag t₁ ∩ bag t₃ ⊆ bag t₂` (`inter_subset_bag`). +-/ + +@[expose] public section + +namespace GraphMinor.Thomas + +open SimpleGraph + +variable {α ι : Type*} + +/-! ## Paths in trees -/ + +/-- `t` lies on the path of `T` between `t₁` and `t₂`: every path in `T` from `t₁` to `t₂` contains +`t`. In a tree there is a unique such path (`IsTree.existsUnique_path`). -/ +abbrev OnTreePath (T : SimpleGraph ι) (t₁ t₂ t : ι) : Prop := + GraphMinor.TreePath.OnTreePath T t₁ t₂ t + +/-- The edge `t t'` lies on the path of `T` between `t₁` and `t₂`: `t` and `t'` are adjacent in `T` +and every path in `T` from `t₁` to `t₂` traverses the edge `s(t, t')`. -/ +def OnTreePathEdge (T : SimpleGraph ι) (t₁ t₂ t t' : ι) : Prop := + T.Adj t t' ∧ ∀ p : T.Walk t₁ t₂, p.IsPath → s(t, t') ∈ p.edges + +/-- The unique path in a tree `T` between `t₁` and `t₂`. -/ +noncomputable def treePath {T : SimpleGraph ι} (hT : T.IsTree) (t₁ t₂ : ι) : T.Walk t₁ t₂ := + (hT.existsUnique_path t₁ t₂).choose + +theorem treePath_isPath {T : SimpleGraph ι} (hT : T.IsTree) (t₁ t₂ : ι) : + (treePath hT t₁ t₂).IsPath := + (hT.existsUnique_path t₁ t₂).choose_spec.1 + +theorem eq_treePath {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ : ι} (p : T.Walk t₁ t₂) + (hp : p.IsPath) : p = treePath hT t₁ t₂ := + (hT.existsUnique_path t₁ t₂).choose_spec.2 p hp + +theorem onTreePath_iff_mem_treePath {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ t : ι} : + OnTreePath T t₁ t₂ t ↔ t ∈ (treePath hT t₁ t₂).support := + ⟨fun h ↦ h _ (treePath_isPath hT t₁ t₂), + fun h p hp ↦ eq_treePath hT p hp ▸ h⟩ + +theorem onTreePathEdge_iff_mem_treePath {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ t t' : ι} : + OnTreePathEdge T t₁ t₂ t t' ↔ T.Adj t t' ∧ s(t, t') ∈ (treePath hT t₁ t₂).edges := + ⟨fun ⟨ha, h⟩ ↦ ⟨ha, h _ (treePath_isPath hT t₁ t₂)⟩, + fun ⟨ha, h⟩ ↦ ⟨ha, fun p hp ↦ eq_treePath hT p hp ▸ h⟩⟩ + +@[simp] +theorem onTreePath_left (T : SimpleGraph ι) (t₁ t₂ : ι) : OnTreePath T t₁ t₂ t₁ := + GraphMinor.TreePath.left T t₁ t₂ + +@[simp] +theorem onTreePath_right (T : SimpleGraph ι) (t₁ t₂ : ι) : OnTreePath T t₁ t₂ t₂ := + GraphMinor.TreePath.right T t₁ t₂ + +theorem onTreePath_symm {T : SimpleGraph ι} {t₁ t₂ t : ι} (h : OnTreePath T t₁ t₂ t) : + OnTreePath T t₂ t₁ t := + GraphMinor.TreePath.symm h + +theorem onTreePath_comm (T : SimpleGraph ι) (t₁ t₂ t : ι) : + OnTreePath T t₁ t₂ t ↔ OnTreePath T t₂ t₁ t := + ⟨onTreePath_symm, onTreePath_symm⟩ + +@[simp] +theorem onTreePath_self (T : SimpleGraph ι) (t₁ t : ι) : + OnTreePath T t₁ t₁ t ↔ t = t₁ := + GraphMinor.TreePath.self_iff + +theorem onTreePathEdge_symm_endpoints {T : SimpleGraph ι} {t₁ t₂ t t' : ι} + (h : OnTreePathEdge T t₁ t₂ t t') : OnTreePathEdge T t₂ t₁ t t' := by + refine ⟨h.1, fun p hp ↦ ?_⟩ + have := h.2 p.reverse hp.reverse + rwa [Walk.edges_reverse, List.mem_reverse] at this + +theorem onTreePathEdge_swap {T : SimpleGraph ι} {t₁ t₂ t t' : ι} + (h : OnTreePathEdge T t₁ t₂ t t') : OnTreePathEdge T t₁ t₂ t' t := by + refine ⟨h.1.symm, fun p hp ↦ ?_⟩ + rw [Sym2.eq_swap] + exact h.2 p hp + +theorem OnTreePathEdge.onTreePath_left {T : SimpleGraph ι} {t₁ t₂ t t' : ι} + (h : OnTreePathEdge T t₁ t₂ t t') : OnTreePath T t₁ t₂ t := + fun p hp ↦ p.fst_mem_support_of_mem_edges (h.2 p hp) + +theorem OnTreePathEdge.onTreePath_right {T : SimpleGraph ι} {t₁ t₂ t t' : ι} + (h : OnTreePathEdge T t₁ t₂ t t') : OnTreePath T t₁ t₂ t' := + fun p hp ↦ p.snd_mem_support_of_mem_edges (h.2 p hp) + +/-- In a tree, a vertex `t` lies on the path between `t₁` and `t₂` if and only if +there are paths from `t₁` to `t` and from `t` to `t₂` whose concatenation is a path. -/ +theorem onTreePath_iff_exists_append {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ t : ι} : + OnTreePath T t₁ t₂ t ↔ + ∃ (p : T.Walk t₁ t) (q : T.Walk t t₂), p.IsPath ∧ q.IsPath ∧ (p.append q).IsPath := by + rw [onTreePath_iff_mem_treePath hT, (treePath_isPath hT t₁ t₂).mem_support_iff_exists_append] + constructor + · rintro ⟨p, q, hp, hq, heq⟩ + exact ⟨p, q, hp, hq, heq ▸ treePath_isPath hT t₁ t₂⟩ + · rintro ⟨p, q, hp, hq, hpq⟩ + exact ⟨p, q, hp, hq, (eq_treePath hT (p.append q) hpq).symm⟩ + +/-- `t` lies on `t₁ T t₂` if and only if every walk (not necessarily a path) from `t₁` to `t₂` +contains `t`. -/ +theorem onTreePath_iff_forall_walk {T : SimpleGraph ι} {t₁ t₂ t : ι} : + OnTreePath T t₁ t₂ t ↔ ∀ w : T.Walk t₁ t₂, t ∈ w.support := + ⟨GraphMinor.TreePath.mem_support, fun h p _ ↦ h p⟩ + +/-- `t t'` is an edge of `t₁ T t₂` if and only if `T.Adj t t'` and `t₁, t₂` are not +reachable in `T - t t'`, that is, every walk in `T` from `t₁` to `t₂` uses the edge `s(t, t')`. -/ +theorem onTreePathEdge_iff_not_reachable_deleteEdges {T : SimpleGraph ι} {t₁ t₂ t t' : ι} : + OnTreePathEdge T t₁ t₂ t t' ↔ + T.Adj t t' ∧ ¬ (T.deleteEdges {s(t, t')}).Reachable t₁ t₂ := by + classical + rw [reachable_deleteEdges_iff_exists_walk, not_exists_not] + refine and_congr_right fun _ ↦ ⟨fun h w ↦ ?_, fun h p _ ↦ h p⟩ + exact w.edges_bypass_subset_edges (h w.bypass w.bypass_isPath) + +/-- If `s` lies on `t₁ T t₃` and `t₂` lies on `t₁ T s` or `s T t₃`, then `t₂` lies on `t₁ T t₃`. -/ +theorem onTreePath_trans_left {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ s t₃ : ι} + (hs : OnTreePath T t₁ t₃ s) (ht₂ : OnTreePath T t₁ s t₂) : + OnTreePath T t₁ t₃ t₂ := by + rw [onTreePath_iff_exists_append hT] at hs + obtain ⟨p, q, hp, hq, hpq⟩ := hs + rw [onTreePath_iff_mem_treePath hT, ← eq_treePath hT _ hpq, Walk.mem_support_append_iff] + exact Or.inl (ht₂ p hp) + +theorem onTreePath_trans_right {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ s t₃ : ι} + (hs : OnTreePath T t₁ t₃ s) (ht₂ : OnTreePath T s t₃ t₂) : + OnTreePath T t₁ t₃ t₂ := by + exact onTreePath_symm (onTreePath_trans_left hT (onTreePath_symm hs) (onTreePath_symm ht₂)) + +/-- For any walk `w` from `t₁` to `t₂` in `T`, every vertex of `t₁ T t₂` is in `w.support`; +if `s` is on a walk from `t₁` to `t₂` then `t₁ T t₂` is contained in `(t₁ T s) ∪ (s T t₂)`. -/ +theorem onTreePath_left_or_right {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ t : ι} (s : ι) + (ht : OnTreePath T t₁ t₂ t) : + OnTreePath T t₁ s t ∨ OnTreePath T s t₂ t := by + rw [onTreePath_iff_forall_walk] at ht + have := ht ((treePath hT t₁ s).append (treePath hT s t₂)) + rw [Walk.mem_support_append_iff] at this + rcases this with h | h + · exact Or.inl ((onTreePath_iff_mem_treePath hT).2 h) + · exact Or.inr ((onTreePath_iff_mem_treePath hT).2 h) + +theorem onTreePathEdge_left_or_right {T : SimpleGraph ι} {t₁ t₂ t t' : ι} (s : ι) + (h : OnTreePathEdge T t₁ t₂ t t') : + OnTreePathEdge T t₁ s t t' ∨ OnTreePathEdge T s t₂ t t' := by + rw [onTreePathEdge_iff_not_reachable_deleteEdges] at h ⊢ + rw [onTreePathEdge_iff_not_reachable_deleteEdges] + by_contra! hc + exact h.2 ((hc.1 h.1).trans (hc.2 h.1)) + +/-- If `s` lies on `t₁ T t₂`, then `t` lies on `t₁ T t₂` if and only if `t` lies on `t₁ T s` or +`s T t₂`. -/ +theorem onTreePath_split_iff {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ s t : ι} + (hs : OnTreePath T t₁ t₂ s) : + OnTreePath T t₁ t₂ t ↔ OnTreePath T t₁ s t ∨ OnTreePath T s t₂ t := + ⟨onTreePath_left_or_right hT s, + fun h ↦ h.elim (onTreePath_trans_left hT hs) (onTreePath_trans_right hT hs)⟩ + +/-- If `s` lies on `t₁ T t₂`, then `t₁` and `t₂` are separated by `s` in `T`: the only common +vertex of `t₁ T s` and `s T t₂` is `s`. -/ +theorem onTreePath_inter_eq_of_onTreePath {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ s t : ι} + (hs : OnTreePath T t₁ t₂ s) (h₁ : OnTreePath T t₁ s t) (h₂ : OnTreePath T s t₂ t) : + t = s := by + rw [onTreePath_iff_exists_append hT] at hs + obtain ⟨p, q, hp, hq, hpq⟩ := hs + by_contra hts + exact hpq.ne_of_mem_support_of_append hts (h₁ p hp) (h₂ q hq) rfl + +/-- Antisymmetry of `OnTreePath`: if `s` lies on `t₁ T t₂` and `t₂` lies on `t₁ T s`, then `s = t₂`. +-/ +theorem onTreePath_antisymm {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ s : ι} + (h₁ : OnTreePath T t₁ t₂ s) (h₂ : OnTreePath T t₁ s t₂) : + s = t₂ := + (onTreePath_inter_eq_of_onTreePath hT h₁ h₂ (onTreePath_right T s t₂)).symm + +/-- In a tree, for an adjacent pair `t, t'`, every vertex `s` is on the `t`-side (meaning `t` lies +on `s T t'`) or on the `t'`-side (meaning `t'` lies on `s T t`), and not both. -/ +theorem onTreePath_adj_dichotomy {T : SimpleGraph ι} (hT : T.IsTree) {t t' : ι} + (hadj : T.Adj t t') (s : ι) : + (OnTreePath T s t' t ∧ ¬ OnTreePath T s t t') ∨ + (OnTreePath T s t t' ∧ ¬ OnTreePath T s t' t) := by + have he : OnTreePathEdge T t t' t t' := by + rw [onTreePathEdge_iff_mem_treePath hT] + refine ⟨hadj, ?_⟩ + rw [← eq_treePath hT hadj.toWalk hadj.isPath_toWalk] + simp + have hdisj : ¬ (OnTreePath T s t' t ∧ OnTreePath T s t t') := by + rintro ⟨h1, h2⟩ + exact hadj.ne (onTreePath_antisymm hT h1 h2) + rcases onTreePathEdge_left_or_right s he with h | h + · exact Or.inr ⟨onTreePath_symm h.onTreePath_right, fun h' ↦ hdisj ⟨h', onTreePath_symm + h.onTreePath_right⟩⟩ + · exact Or.inl ⟨h.onTreePath_left, fun h' ↦ hdisj ⟨h.onTreePath_left, h'⟩⟩ + +/-- If `t t'` is an edge of `t₁ T t₂`, then either (`t` lies on `t₁ T t'` and `t'` lies on `t T t₂`) +or (`t'` lies on `t₁ T t` and `t` lies on `t' T t₂`). -/ +theorem OnTreePathEdge.orient {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ t t' : ι} + (h : OnTreePathEdge T t₁ t₂ t t') : + (OnTreePath T t₁ t' t ∧ OnTreePath T t t₂ t' ∧ ¬ OnTreePath T t₁ t t' ∧ ¬ OnTreePath T t' t₂ t) + ∨ + (OnTreePath T t₁ t t' ∧ OnTreePath T t' t₂ t ∧ ¬ OnTreePath T t₁ t' t ∧ ¬ OnTreePath T t t₂ t') + := by + have ht : OnTreePath T t₁ t₂ t := h.onTreePath_left + have ht' : OnTreePath T t₁ t₂ t' := h.onTreePath_right + rcases (onTreePath_split_iff hT ht).1 ht' with h1 | h2 + · right + have h2' : OnTreePath T t' t₂ t := by + rcases (onTreePath_split_iff hT ht').1 ht with h3 | h4 + · exfalso; exact h.1.ne (onTreePath_antisymm hT h3 h1) + · exact h4 + refine ⟨h1, h2', fun hc ↦ h.1.ne (onTreePath_antisymm hT hc h1), + fun hc ↦ h.1.ne (onTreePath_antisymm hT (onTreePath_symm h2') (onTreePath_symm hc))⟩ + · left + have h1' : OnTreePath T t₁ t' t := by + rcases (onTreePath_split_iff hT ht').1 ht with h3 | h4 + · exact h3 + · exfalso; exact h.1.ne (onTreePath_antisymm hT (onTreePath_symm h4) (onTreePath_symm h2)) + refine ⟨h1', h2, fun hc ↦ h.1.ne (onTreePath_antisymm hT h1' hc), + fun hc ↦ h.1.ne (onTreePath_antisymm hT (onTreePath_symm hc) (onTreePath_symm h2))⟩ + +/-- Given a walk `p : t₁ → t₂` in `T`, if a predicate `P` holds at `t₁` and fails at `t₂`, there is +an edge `t t'` on `p` (and if `p` is a path, on `t₁ T t₂`) where `P t` holds and `P t'` fails. -/ +theorem exists_onTreePathEdge_of_prop {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ : ι} + (P : ι → Prop) (h₁ : P t₁) (h₂ : ¬ P t₂) : + ∃ t t', OnTreePathEdge T t₁ t₂ t t' ∧ P t ∧ ¬ P t' := by + have walk_lem : ∀ {u v : ι} (p : T.Walk u v), p.IsPath → P u → ¬ P v → + ∃ t t', T.Adj t t' ∧ s(t, t') ∈ p.edges ∧ P t ∧ ¬ P t' := by + intro u v p + induction p with + | nil => intros _ hu hv; exact (hv hu).elim + | @cons u w v hadj q ih => + intro hp hu hv + by_cases hw : P w + · obtain ⟨t, t', ha, he, ht, ht'⟩ := ih hp.of_cons hw hv + exact ⟨t, t', ha, List.mem_cons_of_mem _ he, ht, ht'⟩ + · exact ⟨u, w, hadj, List.Mem.head _, hu, hw⟩ + obtain ⟨t, t', ha, he, ht, ht'⟩ := walk_lem (treePath hT t₁ t₂) (treePath_isPath hT t₁ t₂) h₁ h₂ + exact ⟨t, t', (onTreePathEdge_iff_mem_treePath hT).2 ⟨ha, he⟩, ht, ht'⟩ + +/-- If `s₁` is on the `t₁`-side of an edge `t₁ t₂` (that is, `OnTreePath T s₁ t₂ t₁`) and `s₂` is on +the `t₂`-side (`OnTreePath T s₂ t₁ t₂`), then both `t₁` and `t₂` lie on `s₁ T s₂`. -/ +theorem onTreePath_of_sides {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ s₁ s₂ : ι} + (hadj : T.Adj t₁ t₂) (hs₁ : OnTreePath T s₁ t₂ t₁) (hs₂ : OnTreePath T s₂ t₁ t₂) : + OnTreePath T s₁ s₂ t₁ ∧ OnTreePath T s₁ s₂ t₂ := by + have ht₂ : OnTreePath T s₁ s₂ t₂ := by + rcases onTreePath_left_or_right hT s₁ (onTreePath_symm hs₂) with h | h + · exfalso; exact hadj.ne (onTreePath_antisymm hT hs₁ (onTreePath_symm h)) + · exact h + have ht₁ : OnTreePath T s₁ s₂ t₁ := by + rcases onTreePath_left_or_right hT s₂ hs₁ with h | h + · exact h + · exfalso; exact hadj.ne (onTreePath_antisymm hT h hs₂) + exact ⟨ht₁, ht₂⟩ + +/-! ## Tree-decompositions (Bellenbaum–Diestel) -/ + +/-- A tree-decomposition of `(G, V₀)` in the sense of R. Diestel, *Graph Theory* (as used in +Bellenbaum and Diestel, Section 1): a finite tree `T` on an index type `ι` and a family of vertex +sets `bag : ι → Set α` satisfying: +- (T1) `⋃ t, bag t = V₀` (`iUnion_bag`) +- (T2) every edge of `G` with both ends in `V₀` has both ends in some `bag t` (`adj_mem_bag`) +- (T3) if `t₂` lies on the path `t₁ T t₃`, then `bag t₁ ∩ bag t₃ ⊆ bag t₂` (`inter_subset_bag`). -/ +structure TreeDecomp (G : SimpleGraph α) (V₀ : Set α) (ι : Type*) [Fintype ι] where + /-- The decomposition tree `T`. -/ + T : SimpleGraph ι + /-- `T` is a tree. -/ + isTree : T.IsTree + /-- The parts `(V_t)_{t ∈ T}`. -/ + bag : ι → Set α + /-- (T1): `V(G) = ⋃_{t ∈ T} V_t`. -/ + iUnion_bag : ⋃ t, bag t = V₀ + /-- (T2): every edge of `G` (within `V₀`) has both ends in some `V_t`. -/ + adj_mem_bag : ∀ ⦃u v : α⦄, u ∈ V₀ → v ∈ V₀ → G.Adj u v → ∃ t, u ∈ bag t ∧ v ∈ bag t + /-- (T3): `V_{t₁} ∩ V_{t₃} ⊆ V_{t₂}` whenever `t₂ ∈ t₁ T t₃`. -/ + inter_subset_bag : ∀ ⦃t₁ t₂ t₃ : ι⦄, OnTreePath T t₁ t₃ t₂ → bag t₁ ∩ bag t₃ ⊆ bag t₂ + +namespace TreeDecomp + +variable {G : SimpleGraph α} {V₀ : Set α} [Fintype ι] (D : TreeDecomp G V₀ ι) + +theorem bag_subset (t : ι) : D.bag t ⊆ V₀ := + fun _ hx ↦ D.iUnion_bag ▸ Set.mem_iUnion.2 ⟨t, hx⟩ + +theorem exists_mem_bag {x : α} (hx : x ∈ V₀) : ∃ t, x ∈ D.bag t := by + rw [← D.iUnion_bag, Set.mem_iUnion] at hx + exact hx + +theorem bag_finite (hV₀ : V₀.Finite) (t : ι) : (D.bag t).Finite := + hV₀.subset (D.bag_subset t) + +theorem mem_bag_of_onTreePath {t₁ t₂ t₃ : ι} {x : α} (ht : OnTreePath D.T t₁ t₃ t₂) + (h₁ : x ∈ D.bag t₁) (h₃ : x ∈ D.bag t₃) : x ∈ D.bag t₂ := + D.inter_subset_bag ht ⟨h₁, h₃⟩ + +/-- The width of `D` is at most `w`: `|V_t| ≤ w + 1` for all `t ∈ T`. -/ +def WidthLE (w : ℕ) : Prop := + ∀ t : ι, (D.bag t).encard ≤ (w + 1 : ℕ) + +/-- For a finite vertex set the width bound can be checked with natural cardinalities. -/ +theorem widthLE_iff_ncard_le (hV₀ : V₀.Finite) {w : ℕ} : + D.WidthLE w ↔ ∀ t, (D.bag t).ncard ≤ w + 1 := by + constructor + · exact fun h t ↦ (Set.encard_le_coe_iff_finite_ncard_le.mp (h t)).2 + · exact fun h t ↦ Set.encard_le_coe_iff_finite_ncard_le.mpr ⟨D.bag_finite hV₀ t, h t⟩ + +/-- **Lemma 1** of Bellenbaum and Diestel (page 2), edge-removal form: +Let `(V_t)_{t ∈ T}` be a tree-decomposition of a graph `G`, let `t₁ t₂` be an edge of `T`, and let +`T₁` and `T₂` be the components of `T - t₁ t₂`. Then `V_{t₁} ∩ V_{t₂}` separates `⋃_{t ∈ T₁} V_t` +from `⋃_{t ∈ T₂} V_t` in `G`. + +Here the two components of `T - t₁ t₂` are `{s | OnTreePath T s t₂ t₁}` (the `t₁`-side) and +`{s | OnTreePath T s t₁ t₂}` (the `t₂`-side), and any walk `p` in `G` (within `V₀`) from `bag s₁` +(with `s₁` on the `t₁`-side) to `bag s₂` (with `s₂` on the `t₂`-side) meets `bag t₁ ∩ bag t₂`. -/ +theorem lemma_1_edge {t₁ t₂ s₁ s₂ : ι} (hadj : D.T.Adj t₁ t₂) + (hs₁ : OnTreePath D.T s₁ t₂ t₁) (hs₂ : OnTreePath D.T s₂ t₁ t₂) + {u v : α} (hu : u ∈ D.bag s₁) (hv : v ∈ D.bag s₂) + (p : G.Walk u v) (hp : ∀ x ∈ p.support, x ∈ V₀) : + ∃ x ∈ p.support, x ∈ D.bag t₁ ∩ D.bag t₂ := by + induction p generalizing s₁ with + | @nil u => + have ⟨ht₁, ht₂⟩ := onTreePath_of_sides D.isTree hadj hs₁ hs₂ + exact ⟨u, Walk.start_mem_support _, + D.mem_bag_of_onTreePath ht₁ hu hv, D.mem_bag_of_onTreePath ht₂ hu hv⟩ + | @cons u w v hadjG q ih => + have huV : u ∈ V₀ := hp u (List.Mem.head _) + have hwV : w ∈ V₀ := hp w (List.mem_cons_of_mem _ q.start_mem_support) + obtain ⟨s', hus', hws'⟩ := D.adj_mem_bag huV hwV hadjG + rcases onTreePath_adj_dichotomy D.isTree hadj s' with ⟨hs'₁, _⟩ | ⟨hs'₂, _⟩ + · obtain ⟨x, hx, hxbag⟩ := ih hs'₁ hws' hv (fun z hz ↦ hp z (List.mem_cons_of_mem _ hz)) + exact ⟨x, List.mem_cons_of_mem _ hx, hxbag⟩ + · have ⟨ht₁, ht₂⟩ := onTreePath_of_sides D.isTree hadj hs₁ hs'₂ + exact ⟨u, List.Mem.head _, + D.mem_bag_of_onTreePath ht₁ hu hus', D.mem_bag_of_onTreePath ht₂ hu hus'⟩ + +/-- **Lemma 1** of Bellenbaum and Diestel (page 2), for an edge `t₁ t₂` lying on a path `s₁ T s₂`: +every walk in `G` (within `V₀`) from `bag s₁` to `bag s₂` contains a vertex of `bag t₁ ∩ bag t₂`. -/ +theorem lemma_1_onTreePathEdge {s₁ s₂ t₁ t₂ : ι} (he : OnTreePathEdge D.T s₁ s₂ t₁ t₂) + {u v : α} (hu : u ∈ D.bag s₁) (hv : v ∈ D.bag s₂) + (p : G.Walk u v) (hp : ∀ x ∈ p.support, x ∈ V₀) : + ∃ x ∈ p.support, x ∈ D.bag t₁ ∩ D.bag t₂ := by + rcases he.orient D.isTree with ⟨h1, h2, _, _⟩ | ⟨h1, h2, _, _⟩ + · exact D.lemma_1_edge he.1 h1 (onTreePath_symm h2) hu hv p hp + · obtain ⟨x, hx, hx2, hx1⟩ := D.lemma_1_edge he.1.symm h1 (onTreePath_symm h2) hu hv p hp + exact ⟨x, hx, hx1, hx2⟩ + +/-- Vertex-separator consequence of **Lemma 1** (used in the proof of Lemma 2 and Claim (1) of +Theorem 3): if `t` lies on `s₁ T s₂`, then `bag t` separates `bag s₁` from `bag s₂` in `G`, that is, +every walk in `G` (within `V₀`) from `bag s₁` to `bag s₂` contains a vertex of `bag t`. -/ +theorem lemma_1_vertex {s₁ s₂ t : ι} (ht : OnTreePath D.T s₁ s₂ t) + {u v : α} (hu : u ∈ D.bag s₁) (hv : v ∈ D.bag s₂) + (p : G.Walk u v) (hp : ∀ x ∈ p.support, x ∈ V₀) : + ∃ x ∈ p.support, x ∈ D.bag t := by + by_cases hts₁ : t = s₁ + · subst hts₁ + exact ⟨u, p.start_mem_support, hu⟩ + · obtain ⟨t₁, t₂, he, h1, h2⟩ := + exists_onTreePathEdge_of_prop D.isTree (fun s ↦ ¬ OnTreePath D.T s₁ s t) + (fun h ↦ hts₁ ((onTreePath_self D.T s₁ t).1 h)) + (not_not.2 ht) + obtain ⟨x, hx, hx1, hx2⟩ := D.lemma_1_onTreePathEdge he hu hv p hp + have ht_on : OnTreePath D.T t₁ t₂ t := by + rcases onTreePath_left_or_right D.isTree t₁ (not_not.1 h2) with h | h + · exact (h1 h).elim + · exact h + exact ⟨x, hx, D.mem_bag_of_onTreePath ht_on hx1 hx2⟩ + +end TreeDecomp + +end GraphMinor.Thomas diff --git a/LeanPool/GraphMinor/Thomas/Claims.lean b/LeanPool/GraphMinor/Thomas/Claims.lean new file mode 100644 index 0000000000..ab405c5f81 --- /dev/null +++ b/LeanPool/GraphMinor/Thomas/Claims.lean @@ -0,0 +1,714 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Thomas.Separator +public import Mathlib.Algebra.BigOperators.Group.Finset.Basic +public import Mathlib.Algebra.Order.BigOperators.Group.Finset + +/-! +# Claims ($\ast$), (1), and (2) in the proof of Theorem 3 (Bellenbaum–Diestel, Section 3) + +This file formalizes the leanness condition (T4′), the tree-distance quantities $d_x$ and $t_x$, and +the three numbered claims ($\ast$), (1), and (2) in the proof of Theorem 3 of P. Bellenbaum and +R. Diestel, *Two short proofs concerning tree-decompositions*, Combin. Probab. Comput. 11 (2002) +541–547 (pages 3–5): + +- **Claim ($\ast$)** (`theorem_3_star`, page 4): + $$Y := W_t^1 \setminus V_t = \{\, x \in X \mid t \in t_x T t_2 \,\} \setminus V_t,$$ + and if $|W_t^1| = |V_t|$ then $|Y| = |V_t \cap V(C_2)|$. +- **Claim (1)** (`theorem_3_claim_1_left`, `theorem_3_claim_1`, pages 4–5): + $$(\forall t \in T)(\forall i = 1, 2)\ \bigl(|W_t^i| = |V_t| \Rightarrow W_t^{3-i} \subseteq + X\bigr).$$ +- **Claim (2)** (`theorem_3_claim_2`, page 5): + $$(\exists t \in t_1 T t_2)\ \bigl(|W_t^1|, |W_t^2| < |V_t|\bigr).$$ +-/ + +@[expose] public section + +namespace GraphMinor.Thomas + +open SimpleGraph + +variable {α ι : Type*} + +/-! ## Distance in a tree -/ + +/-- Distance $d_T(t_1, t_2)$ in a tree $T$: the length of the unique path `treePath hT t₁ t₂`. -/ +noncomputable def treeDist {T : SimpleGraph ι} (hT : T.IsTree) (t₁ t₂ : ι) : ℕ := + (treePath hT t₁ t₂).length + +@[simp] +theorem treeDist_self {T : SimpleGraph ι} (hT : T.IsTree) (t : ι) : + treeDist hT t t = 0 := by + unfold treeDist + rw [← eq_treePath hT Walk.nil Walk.IsPath.nil] + rfl + +theorem treeDist_pos_of_ne {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ : ι} (hne : t₁ ≠ t₂) : + 0 < treeDist hT t₁ t₂ := by + unfold treeDist + cases h : treePath hT t₁ t₂ with + | nil => exact (hne rfl).elim + | cons _ _ => simp + +theorem treeDist_comm {T : SimpleGraph ι} (hT : T.IsTree) (t₁ t₂ : ι) : + treeDist hT t₁ t₂ = treeDist hT t₂ t₁ := by + unfold treeDist + rw [← eq_treePath hT (treePath hT t₁ t₂).reverse (treePath_isPath hT t₁ t₂).reverse, + Walk.length_reverse] + +theorem treeDist_eq_add_of_onTreePath {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ t : ι} + (ht : OnTreePath T t₁ t₂ t) : + treeDist hT t₁ t₂ = treeDist hT t₁ t + treeDist hT t t₂ := by + rw [onTreePath_iff_exists_append hT] at ht + obtain ⟨p, q, hp, hq, hpq⟩ := ht + unfold treeDist + rw [← eq_treePath hT p hp, ← eq_treePath hT q hq, ← eq_treePath hT (p.append q) hpq, + Walk.length_append] + +theorem treeDist_lt_right_of_onTreePath {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ t : ι} + (ht : OnTreePath T t₁ t₂ t) (hne : t ≠ t₁) : + treeDist hT t t₂ < treeDist hT t₁ t₂ := by + rw [treeDist_eq_add_of_onTreePath hT ht] + have := treeDist_pos_of_ne hT hne.symm + omega + +theorem treeDist_lt_left_of_onTreePath {T : SimpleGraph ι} (hT : T.IsTree) {t₁ t₂ t : ι} + (ht : OnTreePath T t₁ t₂ t) (hne : t ≠ t₂) : + treeDist hT t₁ t < treeDist hT t₁ t₂ := by + rw [treeDist_eq_add_of_onTreePath hT ht] + have := treeDist_pos_of_ne hT hne + omega + +theorem onTreePathEdge_of_onTreePath_right {T : SimpleGraph ι} (hT : T.IsTree) + {t₁ t₂ t s s' : ι} (ht : OnTreePath T t₁ t₂ t) (he : OnTreePathEdge T t t₂ s s') : + OnTreePathEdge T t₁ t₂ s s' := by + rw [onTreePath_iff_exists_append hT] at ht + obtain ⟨p, q, hp, hq, hpq⟩ := ht + rw [onTreePathEdge_iff_mem_treePath hT] at he ⊢ + refine ⟨he.1, ?_⟩ + rw [← eq_treePath hT (p.append q) hpq, Walk.edges_append, List.mem_append] + right + rw [eq_treePath hT q hq] + exact he.2 + +/-! ## Symmetries of `HasDisjointPaths` -/ + +theorem hasDisjointPaths_symm {K : SimpleGraph α} {Z₁ Z₂ : Set α} {k : ℕ} + (h : HasDisjointPaths K Z₁ Z₂ k) : HasDisjointPaths K Z₂ Z₁ k := by + obtain ⟨P, hP⟩ := h + refine ⟨fun i ↦ + { first := (P i).last + last := (P i).first + walk := (P i).walk.reverse + isPath := (P i).isPath.reverse + first_mem := (P i).last_mem + last_mem := (P i).first_mem }, fun i j hij ↦ ?_⟩ + simpa [Walk.support_reverse] using hP hij + +theorem hasDisjointPaths_comm (K : SimpleGraph α) (Z₁ Z₂ : Set α) (k : ℕ) : + HasDisjointPaths K Z₁ Z₂ k ↔ HasDisjointPaths K Z₂ Z₁ k := + ⟨hasDisjointPaths_symm, hasDisjointPaths_symm⟩ + +namespace TreeDecomp + +variable [Fintype ι] {G : SimpleGraph α} {V₀ : Set α} (D : TreeDecomp G V₀ ι) + +/-! ## Leanness condition (T4′) -/ + +/-- A quadruple `(t₁, t₂, Z₁, Z₂)` violates the leanness condition (T4′) of `D` at order `k` +(Bellenbaum and Diestel, Section 3, page 3). -/ +structure ViolatesLean (t₁ t₂ : ι) (Z₁ Z₂ : Set α) (k : ℕ) : Prop where + subset_left : Z₁ ⊆ D.bag t₁ + subset_right : Z₂ ⊆ D.bag t₂ + ncard_left : Z₁.ncard = k + ncard_right : Z₂.ncard = k + not_hasDisjointPaths : ¬ HasDisjointPaths G Z₁ Z₂ k + le_inter_ncard : ∀ ⦃t t' : ι⦄, OnTreePathEdge D.T t₁ t₂ t t' → k ≤ (D.bag t ∩ D.bag t').ncard + +/-- A tree-decomposition `D = (V_t)_{t ∈ T}` is *lean* if it satisfies condition (T4′) of +Bellenbaum and Diestel (Section 3, page 3): given `t₁, t₂ ∈ T` and vertex sets `Z₁ ⊆ V_{t₁}` and +`Z₂ ⊆ V_{t₂}` such that `|Z₁| = |Z₂| = k`, either `G` contains `k` disjoint `Z₁`–`Z₂` paths or +there exists an edge `t t' ∈ t₁ T t₂` with `|V_t ∩ V_{t'}| < k`. -/ +def IsLean : Prop := + ∀ (t₁ t₂ : ι) (Z₁ Z₂ : Set α) (k : ℕ), + Z₁ ⊆ D.bag t₁ → Z₂ ⊆ D.bag t₂ → Z₁.ncard = k → Z₂.ncard = k → + HasDisjointPaths G Z₁ Z₂ k ∨ + ∃ t t', OnTreePathEdge D.T t₁ t₂ t t' ∧ (D.bag t ∩ D.bag t').ncard < k + +theorem not_isLean_iff : + ¬ D.IsLean ↔ ∃ t₁ t₂ Z₁ Z₂ k, D.ViolatesLean t₁ t₂ Z₁ Z₂ k := by + unfold IsLean + push Not + constructor + · rintro ⟨t₁, t₂, Z₁, Z₂, k, h1, h2, h3, h4, h5, h6⟩ + exact ⟨t₁, t₂, Z₁, Z₂, k, ⟨h1, h2, h3, h4, h5, h6⟩⟩ + · rintro ⟨t₁, t₂, Z₁, Z₂, k, ⟨h1, h2, h3, h4, h5, h6⟩⟩ + exact ⟨t₁, t₂, Z₁, Z₂, k, h1, h2, h3, h4, h5, h6⟩ + +theorem ViolatesLean.symm {t₁ t₂ : ι} {Z₁ Z₂ : Set α} {k : ℕ} + (h : D.ViolatesLean t₁ t₂ Z₁ Z₂ k) : D.ViolatesLean t₂ t₁ Z₂ Z₁ k where + subset_left := h.subset_right + subset_right := h.subset_left + ncard_left := h.ncard_right + ncard_right := h.ncard_left + not_hasDisjointPaths hp := h.not_hasDisjointPaths (hasDisjointPaths_symm hp) + le_inter_ncard _ _ he := h.le_inter_ncard (onTreePathEdge_symm_endpoints he) + +theorem le_bag_ncard_of_violatesLean (hV₀ : V₀.Finite) {t₁ t₂ t : ι} {Z₁ Z₂ : Set α} {k : ℕ} + (hv : D.ViolatesLean t₁ t₂ Z₁ Z₂ k) (ht : OnTreePath D.T t₁ t₂ t) : + k ≤ (D.bag t).ncard := by + by_cases htt₂ : t = t₂ + · subst htt₂ + rw [← hv.ncard_right] + exact Set.ncard_le_ncard hv.subset_right (D.bag_finite hV₀ t) + · obtain ⟨s, s', he, rfl, _⟩ := + exists_onTreePathEdge_of_prop D.isTree (· = t) rfl (Ne.symm htt₂) + have he' := onTreePathEdge_of_onTreePath_right D.isTree ht he + exact (hv.le_inter_ncard he').trans + (Set.ncard_le_ncard Set.inter_subset_left (D.bag_finite hV₀ s)) + +/-! ## Distance to `t₁ T t₂` and home nodes `t_x` -/ + +/-- The distance in `D.T` from `s` to the path `t₁ T t₂`: +$\min\{\, d_T(r, s) \mid r \in t_1 T t_2 \,\}$. -/ +noncomputable def distToPath (t₁ t₂ s : ι) : ℕ := + open Classical in + ((Finset.univ.filter fun r : ι ↦ OnTreePath D.T t₁ t₂ r).image + (fun r ↦ treeDist D.isTree r s)).min' + (Finset.Nonempty.image ⟨t₁, by simp [onTreePath_left]⟩ _) + +theorem distToPath_le {t₁ t₂ r s : ι} (hr : OnTreePath D.T t₁ t₂ r) : + D.distToPath t₁ t₂ s ≤ treeDist D.isTree r s := by + classical + unfold distToPath + apply Finset.min'_le + rw [Finset.mem_image] + exact ⟨r, Finset.mem_filter.2 ⟨Finset.mem_univ r, hr⟩, rfl⟩ + +theorem exists_onTreePath_treeDist_eq (t₁ t₂ s : ι) : + ∃ r, OnTreePath D.T t₁ t₂ r ∧ treeDist D.isTree r s = D.distToPath t₁ t₂ s := by + classical + have hmem := Finset.min'_mem + ((Finset.univ.filter fun r : ι ↦ OnTreePath D.T t₁ t₂ r).image + (fun r ↦ treeDist D.isTree r s)) + (Finset.Nonempty.image ⟨t₁, by simp [onTreePath_left]⟩ _) + rw [Finset.mem_image] at hmem + obtain ⟨r, hr, hdist⟩ := hmem + rw [Finset.mem_filter] at hr + exact ⟨r, hr.2, hdist⟩ + +theorem distToPath_comm (t₁ t₂ s : ι) : + D.distToPath t₁ t₂ s = D.distToPath t₂ t₁ s := by + apply le_antisymm + · obtain ⟨r, hr, hreq⟩ := D.exists_onTreePath_treeDist_eq t₂ t₁ s + rw [← hreq] + exact D.distToPath_le (onTreePath_symm hr) + · obtain ⟨r, hr, hreq⟩ := D.exists_onTreePath_treeDist_eq t₁ t₂ s + rw [← hreq] + exact D.distToPath_le (onTreePath_symm hr) + +/-- If $t \in s T t_2$ and $t \notin \mathring{t}_1 T t_2$, then $t$ separates $s$ from the whole +path $t_1 T t_2$ in $T$, so if $t \ne s$ the distance of $t$ from $t_1 T t_2$ is strictly smaller +than that of $s$ (Bellenbaum and Diestel, proof of Claim (1), page 5). -/ +theorem distToPath_lt_of_onTreePath_of_not_inner {t₁ t₂ s t : ι} + (ht : OnTreePath D.T s t₂ t) (hnot : OnTreePath D.T t₁ t₂ t → t = t₁) (hne : t ≠ s) : + D.distToPath t₁ t₂ t < D.distToPath t₁ t₂ s := by + obtain ⟨r, hr, hreq⟩ := D.exists_onTreePath_treeDist_eq t₁ t₂ s + have h_rst : OnTreePath D.T r s t := by + rcases onTreePath_left_or_right D.isTree r ht with h | h + · exact onTreePath_symm h + · have ht_on : OnTreePath D.T t₁ t₂ t := onTreePath_trans_right D.isTree hr h + have ht₁ : t = t₁ := hnot ht_on + subst ht₁ + have hr' : OnTreePath D.T t₂ t r := onTreePath_symm hr + have h' : OnTreePath D.T t₂ r t := onTreePath_symm h + have hrt : r = t := onTreePath_antisymm D.isTree hr' h' + subst hrt + exact onTreePath_left D.T r s + have hlt : treeDist D.isTree r t < treeDist D.isTree r s := + treeDist_lt_left_of_onTreePath D.isTree h_rst hne + exact (D.distToPath_le hr).trans_lt (hreq ▸ hlt) + +/-- $d_x := \min\{\, d_T(r, t_x) \mid r \in t_1 T t_2 \text{ and } x \in V_{t_x} \,\}$ +(Bellenbaum and Diestel, proof of Theorem 3, page 3). -/ +noncomputable def vertDist (t₁ t₂ : ι) (x : α) : ℕ := + open Classical in + if h : (Finset.univ.filter fun s : ι ↦ x ∈ D.bag s).Nonempty then + ((Finset.univ.filter fun s : ι ↦ x ∈ D.bag s).image (D.distToPath t₁ t₂)).min' (h.image _) + else 0 + +theorem vertDist_le {t₁ t₂ s : ι} {x : α} (hx : x ∈ D.bag s) : + D.vertDist t₁ t₂ x ≤ D.distToPath t₁ t₂ s := by + classical + have hs : s ∈ Finset.univ.filter (fun s : ι ↦ x ∈ D.bag s) := + Finset.mem_filter.2 ⟨Finset.mem_univ s, hx⟩ + have hne : (Finset.univ.filter fun s : ι ↦ x ∈ D.bag s).Nonempty := ⟨s, hs⟩ + unfold vertDist + rw [dite_eq_left hne] + apply Finset.min'_le + exact Finset.mem_image.2 ⟨s, hs, rfl⟩ + +theorem exists_mem_bag_distToPath_eq (t₁ t₂ : ι) {x : α} (hx : x ∈ V₀) : + ∃ s : ι, x ∈ D.bag s ∧ D.distToPath t₁ t₂ s = D.vertDist t₁ t₂ x := by + classical + obtain ⟨s₀, hs₀⟩ := D.exists_mem_bag hx + have hne : (Finset.univ.filter fun s : ι ↦ x ∈ D.bag s).Nonempty := + ⟨s₀, Finset.mem_filter.2 ⟨Finset.mem_univ s₀, hs₀⟩⟩ + have hmem := Finset.min'_mem + ((Finset.univ.filter fun s : ι ↦ x ∈ D.bag s).image (D.distToPath t₁ t₂)) (hne.image _) + rw [Finset.mem_image] at hmem + obtain ⟨s, hs, hdist⟩ := hmem + rw [Finset.mem_filter] at hs + refine ⟨s, hs.2, ?_⟩ + unfold vertDist + rw [dite_eq_left hne] + exact hdist + +theorem vertDist_comm (t₁ t₂ : ι) (x : α) : + D.vertDist t₁ t₂ x = D.vertDist t₂ t₁ x := by + have h : D.distToPath t₁ t₂ = D.distToPath t₂ t₁ := funext (D.distToPath_comm t₁ t₂) + unfold vertDist + simp_rw [h] + +/-- Choice of 'home' node $t_x \in T$ at minimum distance from $t_1 T t_2$ in $T$ such that +$x \in V_{t_x}$ (Bellenbaum and Diestel, proof of Theorem 3, page 3). -/ +noncomputable def chooseHome (t₁ t₂ : ι) (x : α) : ι := + open Classical in + if hx : x ∈ V₀ then (D.exists_mem_bag_distToPath_eq t₁ t₂ hx).choose else t₁ + +theorem chooseHome_mem_bag (t₁ t₂ : ι) {x : α} (hx : x ∈ V₀) : + x ∈ D.bag (D.chooseHome t₁ t₂ x) := by + classical + unfold chooseHome + rw [dite_eq_left hx] + exact (D.exists_mem_bag_distToPath_eq t₁ t₂ hx).choose_spec.1 + +theorem distToPath_chooseHome (t₁ t₂ : ι) {x : α} (hx : x ∈ V₀) : + D.distToPath t₁ t₂ (D.chooseHome t₁ t₂ x) = D.vertDist t₁ t₂ x := by + classical + unfold chooseHome + rw [dite_eq_left hx] + exact (D.exists_mem_bag_distToPath_eq t₁ t₂ hx).choose_spec.2 + +/-- $\sum_{x \in X} d_x$ for a vertex set $X \subseteq V_0$ (Bellenbaum and Diestel, page 3). -/ +noncomputable def sepDistSum (hV₀ : V₀.Finite) (t₁ t₂ : ι) (X : Set α) : ℕ := + open Classical in + ∑ x ∈ hV₀.toFinset.filter (· ∈ X), D.vertDist t₁ t₂ x + +theorem sepDistSum_comm (hV₀ : V₀.Finite) (t₁ t₂ : ι) (X : Set α) : + D.sepDistSum hV₀ t₁ t₂ X = D.sepDistSum hV₀ t₂ t₁ X := by + have h : D.vertDist t₁ t₂ = D.vertDist t₂ t₁ := funext (D.vertDist_comm t₁ t₂) + unfold sepDistSum + rw [h] + +/-! ## Claim ($\ast$), Claim (1), and Claim (2) of Theorem 3 -/ + +/-- **Claim ($\ast$)** in the proof of Theorem 3 of Bellenbaum and Diestel (Section 3, page 4): +For $Y := W_t^1 \setminus V_t$, we have +$$Y = \{\, x \in X \mid t \in t_x T t_2 \,\} \setminus V_t,$$ +$V_t \setminus W_t^1 = V_t \cap C_2$, and if $|W_t^1| = |V_t|$ then $|Y| = |V_t \cap C_2|$. -/ +theorem theorem_3_star (hV₀ : V₀.Finite) {X C₁ C₂ : Set α} + (hX : X ⊆ V₀) (hcov : V₀ ⊆ C₁ ∪ C₂ ∪ X) + (hdisj : Disjoint C₁ C₂) (hdisj₂ : Disjoint C₂ X) + (home : α → ι) (t₂ t : ι) : + D.shiftBag X C₁ home t₂ t \ D.bag t = + {x ∈ X | OnTreePath D.T (home x) t₂ t} \ D.bag t ∧ + D.bag t \ D.shiftBag X C₁ home t₂ t = D.bag t ∩ C₂ ∧ + ((D.shiftBag X C₁ home t₂ t).ncard = (D.bag t).ncard → + (D.shiftBag X C₁ home t₂ t \ D.bag t).ncard = (D.bag t ∩ C₂).ncard) := by + have h1 := D.shiftBag_inter_compl_eq X C₁ home t₂ t + have h2 : D.bag t \ D.shiftBag X C₁ home t₂ t = D.bag t ∩ C₂ := by + ext x + simp only [Set.mem_sdiff, mem_shiftBag, Set.mem_inter_iff] + constructor + · rintro ⟨hxt, hnot⟩ + refine ⟨hxt, ?_⟩ + rcases hcov (D.bag_subset t hxt) with (hC1 | hC2) | hX' + · exact (hnot (Or.inl ⟨hxt, Or.inl hC1⟩)).elim + · exact hC2 + · exact (hnot (Or.inl ⟨hxt, Or.inr hX'⟩)).elim + · rintro ⟨hxt, hxC₂⟩ + refine ⟨hxt, ?_⟩ + rintro (⟨_, hxC₁ | hxX⟩ | ⟨hxX, _⟩) + · exact Set.disjoint_left.1 hdisj hxC₁ hxC₂ + · exact Set.disjoint_left.1 hdisj₂ hxC₂ hxX + · exact Set.disjoint_left.1 hdisj₂ hxC₂ hxX + refine ⟨h1, h2, fun hcard ↦ ?_⟩ + rw [← h2] + have hW_fin := D.shiftBag_finite hV₀ (C := C₁) hX home t₂ t + have hV_fin := D.bag_finite hV₀ t + apply le_antisymm + · exact (Set.ncard_le_ncard_iff_ncard_sdiff_le_ncard_sdiff hW_fin hV_fin).1 hcard.le + · exact (Set.ncard_le_ncard_iff_ncard_sdiff_le_ncard_sdiff hV_fin hW_fin).1 hcard.ge + +/-- Separation step in the proof of **Claim (1)** of Theorem 3 (Bellenbaum and Diestel, page 4): +For $Y := W_t^1 \setminus V_t$ and $X' := (X \setminus Y) \cup (V_t \cap C_2)$, the set $X'$ +separates both $Z_1$ and $V_t$ from $Z_2$ in $(G, V_0)$. -/ +theorem theorem_3_claim_1_separates {X C₁ C₂ Z₁ Z₂ : Set α} + (hX : X ⊆ V₀) (hC₂ : C₂ ⊆ V₀) (hcov : V₀ ⊆ C₁ ∪ C₂ ∪ X) + (hdisj : Disjoint C₁ C₂) (hdisj₂ : Disjoint C₂ X) + (hno_adj : ∀ ⦃a b : α⦄, a ∈ C₁ → b ∈ C₂ → ¬ G.Adj a b) + (hZ₁C : Z₁ ⊆ C₁ ∪ X) (hZ₂C : Z₂ ⊆ C₂ ∪ X) + {t₂ t : ι} (hZ₂_bag : Z₂ ⊆ D.bag t₂) + {home : α → ι} (hhome : ∀ x ∈ X, x ∈ D.bag (home x)) : + let Y := D.shiftBag X C₁ home t₂ t \ D.bag t + let X' := (X \ Y) ∪ (D.bag t ∩ C₂) + Separates G V₀ Z₁ Z₂ X' ∧ Separates G V₀ (D.bag t) Z₂ X' := by + intro Y X' + have hX'_sub : X' ⊆ V₀ := + Set.union_subset (Set.sdiff_subset.trans hX) (Set.inter_subset_right.trans hC₂) + have hwalk_C₂ : ∀ {a v : α} (q : G.Walk a v), v ∈ Z₂ → + (∀ z ∈ q.support, z ∈ V₀) → (∀ z ∈ q.support, z ∉ X') → + ∀ z ∈ q.support, z ∈ C₂ := by + intro a v q hv hqV hqX' + induction q with + | nil => + intro z hz + simp only [Walk.support_nil, List.mem_singleton] at hz + subst hz + rcases hZ₂C hv with haC₂ | haX + · exact haC₂ + · exfalso + have ha_not_X' : z ∉ X' := hqX' z (by simp) + have haY : z ∈ Y := by + by_contra haY + exact ha_not_X' (Or.inl ⟨haX, haY⟩) + have ha_not_bag : z ∉ D.bag t := haY.2 + change z ∈ D.shiftBag X C₁ home t₂ t \ D.bag t at haY + rw [D.shiftBag_inter_compl_eq] at haY + have ha_path : OnTreePath D.T (home z) t₂ t := haY.1.2 + exact ha_not_bag (D.mem_bag_of_onTreePath ha_path (hhome z haX) (hZ₂_bag hv)) + | @cons a b v hadj r ih => + have hrC₂ : ∀ z ∈ r.support, z ∈ C₂ := + ih hv (fun z hz ↦ hqV z (List.mem_cons_of_mem _ hz)) + (fun z hz ↦ hqX' z (List.mem_cons_of_mem _ hz)) + have hbC₂ : b ∈ C₂ := hrC₂ b r.start_mem_support + have haC₂ : a ∈ C₂ := by + by_contra ha_not_C₂ + have haV : a ∈ V₀ := hqV a (List.Mem.head _) + have haX : a ∈ X := by + rcases hcov haV with (haC₁ | haC₂) | haX + · exact (hno_adj haC₁ hbC₂ hadj).elim + · exact (ha_not_C₂ haC₂).elim + · exact haX + have ha_not_X' : a ∉ X' := hqX' a (List.Mem.head _) + have haY : a ∈ Y := by + by_contra haY + exact ha_not_X' (Or.inl ⟨haX, haY⟩) + have ha_not_bag : a ∉ D.bag t := haY.2 + have ha_path : OnTreePath D.T (home a) t₂ t := by + change a ∈ D.shiftBag X C₁ home t₂ t \ D.bag t at haY + rw [D.shiftBag_inter_compl_eq] at haY + exact haY.1.2 + obtain ⟨z, hz_supp, hz_bag⟩ := + D.lemma_1_vertex ha_path (hhome a haX) (hZ₂_bag hv) (Walk.cons hadj r) hqV + simp only [Walk.support_cons, List.mem_cons] at hz_supp + rcases hz_supp with rfl | hz_r + · exact ha_not_bag hz_bag + · exact hqX' z (List.mem_cons_of_mem _ hz_r) (Or.inr ⟨hz_bag, hrC₂ z hz_r⟩) + intro z hz + simp only [Walk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · exact haC₂ + · exact hrC₂ z hz + refine ⟨⟨hX'_sub, fun u v hu hv p hp ↦ ?_⟩, ⟨hX'_sub, fun u v hu hv p hp ↦ ?_⟩⟩ + · by_contra! hno + have huC₂ : u ∈ C₂ := hwalk_C₂ p hv hp hno u p.start_mem_support + rcases hZ₁C hu with huC₁ | huX + · exact Set.disjoint_left.1 hdisj huC₁ huC₂ + · exact Set.disjoint_left.1 hdisj₂ huC₂ huX + · by_contra! hno + have huC₂ : u ∈ C₂ := hwalk_C₂ p hv hp hno u p.start_mem_support + exact hno u p.start_mem_support (Or.inr ⟨hu, huC₂⟩) + +/-- **Claim (1)** in the proof of Theorem 3 of Bellenbaum and Diestel (Section 3, pages 4–5), +for $i = 1$: if $|W_t^1| = |V_t|$, then $W_t^2 \subseteq X$. -/ +theorem theorem_3_claim_1_left (hV₀ : V₀.Finite) + (hG : ∀ ⦃u v : α⦄, G.Adj u v → u ∈ V₀ ∧ v ∈ V₀) + {t₁ t₂ : ι} {Z₁ Z₂ : Set α} {k : ℕ} + (hv : D.ViolatesLean t₁ t₂ Z₁ Z₂ k) + (hmin_dist : ∀ t₁' t₂' Z₁' Z₂' k', D.ViolatesLean t₁' t₂' Z₁' Z₂' k' → + treeDist D.isTree t₁ t₂ ≤ treeDist D.isTree t₁' t₂') + {X C₁ C₂ : Set α} + (hX : X ⊆ V₀) (hC₂ : C₂ ⊆ V₀) + (hcov : V₀ ⊆ C₁ ∪ C₂ ∪ X) + (hdisj : Disjoint C₁ C₂) (hdisj₂ : Disjoint C₂ X) + (hno_adj : ∀ ⦃a b : α⦄, a ∈ C₁ → b ∈ C₂ → ¬ G.Adj a b) + (hZ₁C : Z₁ ⊆ C₁ ∪ X) (hZ₂C : Z₂ ⊆ C₂ ∪ X) + (hX_lt : X.ncard < k) + (hmin_sep : ∀ X', Separates G V₀ Z₁ Z₂ X' → X'.ncard ≤ X.ncard → + D.sepDistSum hV₀ t₁ t₂ X ≤ D.sepDistSum hV₀ t₁ t₂ X') + {home : α → ι} (hhome : ∀ x ∈ V₀, x ∈ D.bag (home x)) + (hhome_dist : ∀ x ∈ V₀, D.distToPath t₁ t₂ (home x) = D.vertDist t₁ t₂ x) + (t : ι) (hcard : (D.shiftBag X C₁ home t₂ t).ncard = (D.bag t).ncard) : + D.shiftBag X C₂ home t₁ t ⊆ X := by + classical + have hstar := D.theorem_3_star hV₀ hX hcov hdisj hdisj₂ home t₂ t + let Y := D.shiftBag X C₁ home t₂ t \ D.bag t + let X' := (X \ Y) ∪ (D.bag t ∩ C₂) + have hY_sub_X : Y ⊆ X := by + change D.shiftBag X C₁ home t₂ t \ D.bag t ⊆ X + rw [hstar.1] + exact fun _ h ↦ h.1.1 + have hY_ncard : Y.ncard = (D.bag t ∩ C₂).ncard := hstar.2.2 hcard + suffices hbag_C₂ : D.bag t ∩ C₂ = ∅ by + rintro x (⟨hxt, hxC₂ | hxX⟩ | ⟨hxX, _⟩) + · exfalso + have : x ∈ D.bag t ∩ C₂ := ⟨hxt, hxC₂⟩ + rw [hbag_C₂] at this + exact this + · exact hxX + · exact hxX + by_contra hne_C₂ + obtain ⟨x₀, hx₀⟩ := Set.nonempty_iff_ne_empty.2 hne_C₂ + have ⟨hsep_Z₁, hsep_Vt⟩ := + D.theorem_3_claim_1_separates hX hC₂ hcov hdisj hdisj₂ hno_adj hZ₁C hZ₂C hv.subset_right + (fun x hx ↦ hhome x (hX hx)) (t := t) + have hX'_ncard : X'.ncard = X.ncard := by + have hdisj_X'_parts : Disjoint (X \ Y) (D.bag t ∩ C₂) := + Disjoint.mono_left Set.sdiff_subset (Disjoint.mono_right Set.inter_subset_right hdisj₂.symm) + rw [Set.ncard_union_eq hdisj_X'_parts ((hV₀.subset hX).sdiff) + ((D.bag_finite hV₀ t).subset Set.inter_subset_left), + ← hY_ncard, Set.ncard_sdiff_add_ncard_of_subset hY_sub_X (hV₀.subset hX)] + have hnot_inner : OnTreePath D.T t₁ t₂ t → t = t₁ := by + intro ht_on + by_contra htt₁ + have hk_le : k ≤ (D.bag t).ncard := D.le_bag_ncard_of_violatesLean hV₀ hv ht_on + obtain ⟨Z, hZ_sub, hZ_card⟩ := Set.exists_subset_card_eq hk_le + have hv' : D.ViolatesLean t t₂ Z Z₂ k := + { subset_left := hZ_sub + subset_right := hv.subset_right + ncard_left := hZ_card + ncard_right := hv.ncard_right + not_hasDisjointPaths := fun hpaths ↦ by + have hsep_Z : Separates G V₀ Z Z₂ X' := + ⟨hsep_Vt.1, fun u v hu hv p hp ↦ hsep_Vt.2 (hZ_sub hu) hv p hp⟩ + have hle := ncard_le_of_hasDisjointPaths_of_separates hV₀ + (hZ_sub.trans (D.bag_subset t)) hG hpaths hsep_Z + omega + le_inter_ncard := fun s s' he ↦ + hv.le_inter_ncard (onTreePathEdge_of_onTreePath_right D.isTree ht_on he) } + have hlt := treeDist_lt_right_of_onTreePath D.isTree ht_on htt₁ + have hle := hmin_dist t t₂ Z Z₂ k hv' + omega + -- Now t ∉ tRing₁ T t₂; show sepDistSum X' < sepDistSum X + let FX := hV₀.toFinset.filter (· ∈ X) + let FY := hV₀.toFinset.filter (· ∈ Y) + let FB := hV₀.toFinset.filter (· ∈ D.bag t ∩ C₂) + let FX' := hV₀.toFinset.filter (· ∈ X') + have hFY_sub_FX : FY ⊆ FX := by + intro x hx + rw [Finset.mem_filter] at hx ⊢ + exact ⟨hx.1, hY_sub_X hx.2⟩ + have hFX'_eq : FX' = (FX \ FY) ∪ FB := by + ext x + simp only [FX', FX, FY, FB, X', Finset.mem_filter, Set.Finite.mem_toFinset, Finset.mem_union, + Finset.mem_sdiff, Set.mem_union, Set.mem_sdiff, Set.mem_inter_iff] + constructor + · rintro ⟨hxV, ⟨hxX, hxY⟩ | ⟨hxt, hxC₂⟩⟩ + · exact Or.inl ⟨⟨hxV, hxX⟩, fun h ↦ hxY h.2⟩ + · exact Or.inr ⟨hxV, hxt, hxC₂⟩ + · rintro (⟨⟨hxV, hxX⟩, hxY⟩ | ⟨hxV, hxt, hxC₂⟩) + · exact ⟨hxV, Or.inl ⟨hxX, fun h ↦ hxY ⟨hxV, h⟩⟩⟩ + · exact ⟨hxV, Or.inr ⟨hxt, hxC₂⟩⟩ + have hdisj_FX_FB : Disjoint (FX \ FY) FB := by + rw [Finset.disjoint_left] + intro x hx1 hx2 + rw [Finset.mem_sdiff, Finset.mem_filter] at hx1 + rw [Finset.mem_filter] at hx2 + exact Set.disjoint_left.1 hdisj₂ hx2.2.2 hx1.1.2 + have hFY_card : FY.card = Y.ncard := by + rw [Set.ncard_eq_toFinset_card Y (hV₀.subset (hY_sub_X.trans hX))] + congr 1 + ext x + simp only [FY, Finset.mem_filter, Set.Finite.mem_toFinset] + exact ⟨fun h ↦ h.2, fun h ↦ ⟨hX (hY_sub_X h), h⟩⟩ + have hFB_card : FB.card = (D.bag t ∩ C₂).ncard := by + rw [Set.ncard_eq_toFinset_card (D.bag t ∩ C₂) + (hV₀.subset (Set.inter_subset_right.trans hC₂))] + congr 1 + ext x + simp only [FB, Finset.mem_filter, Set.Finite.mem_toFinset] + exact ⟨fun h ↦ h.2, fun h ↦ ⟨hC₂ h.2, h⟩⟩ + have hFB_pos : 0 < FB.card := by + rw [Finset.card_pos] + exact ⟨x₀, Finset.mem_filter.2 ⟨hV₀.mem_toFinset.2 (hC₂ hx₀.2), hx₀⟩⟩ + have hsum_FB : ∑ x' ∈ FB, D.vertDist t₁ t₂ x' ≤ FB.card * D.distToPath t₁ t₂ t := by + rw [← smul_eq_mul] + refine Finset.sum_le_card_nsmul FB (D.vertDist t₁ t₂) (D.distToPath t₁ t₂ t) ?_ + intro x' hx' + rw [Finset.mem_filter] at hx' + exact D.vertDist_le hx'.2.1 + have hsum_FY : FY.card * (D.distToPath t₁ t₂ t + 1) ≤ ∑ y ∈ FY, D.vertDist t₁ t₂ y := by + rw [← smul_eq_mul] + refine Finset.card_nsmul_le_sum FY (D.vertDist t₁ t₂) (D.distToPath t₁ t₂ t + 1) ?_ + intro y hy + rw [Finset.mem_filter] at hy + have hyY : y ∈ D.shiftBag X C₁ home t₂ t \ D.bag t := hy.2 + rw [hstar.1] at hyY + have hyX : y ∈ X := hyY.1.1 + have hy_path : OnTreePath D.T (home y) t₂ t := hyY.1.2 + have hy_not_bag : y ∉ D.bag t := hyY.2 + have hne_ty : t ≠ home y := fun h ↦ hy_not_bag (h ▸ hhome y (hX hyX)) + have hlt := D.distToPath_lt_of_onTreePath_of_not_inner hy_path hnot_inner hne_ty + rw [hhome_dist y (hX hyX)] at hlt + omega + have hsum_X' : D.sepDistSum hV₀ t₁ t₂ X' = + (∑ x ∈ FX \ FY, D.vertDist t₁ t₂ x) + ∑ x' ∈ FB, D.vertDist t₁ t₂ x' := by + rw [← Finset.sum_union hdisj_FX_FB, ← hFX'_eq] + unfold sepDistSum + congr 1 + ext x + simp [FX'] + have hsum_X : D.sepDistSum hV₀ t₁ t₂ X = + (∑ x ∈ FX \ FY, D.vertDist t₁ t₂ x) + ∑ y ∈ FY, D.vertDist t₁ t₂ y := by + rw [Finset.sum_sdiff hFY_sub_FX] + unfold sepDistSum + congr 1 + have hcard_FY_FB : FY.card = FB.card := by rw [hFY_card, hFB_card, hY_ncard] + rw [hcard_FY_FB, Nat.mul_add, Nat.mul_one] at hsum_FY + have h_le_min := hmin_sep X' hsep_Z₁ (le_of_eq hX'_ncard) + omega + +/-- **Claim (1)** in the proof of Theorem 3 of Bellenbaum and Diestel (Section 3, page 4), +in both directions ($i = 1$ and $i = 2$): +$$(\forall t \in T)(\forall i = 1, 2)\ \bigl(|W_t^i| = |V_t| \Rightarrow W_t^{3-i} \subseteq +X\bigr).$$ -/ +theorem theorem_3_claim_1 (hV₀ : V₀.Finite) + (hG : ∀ ⦃u v : α⦄, G.Adj u v → u ∈ V₀ ∧ v ∈ V₀) + {t₁ t₂ : ι} {Z₁ Z₂ : Set α} {k : ℕ} + (hv : D.ViolatesLean t₁ t₂ Z₁ Z₂ k) + (hmin_dist : ∀ t₁' t₂' Z₁' Z₂' k', D.ViolatesLean t₁' t₂' Z₁' Z₂' k' → + treeDist D.isTree t₁ t₂ ≤ treeDist D.isTree t₁' t₂') + {X C₁ C₂ : Set α} + (hX : X ⊆ V₀) (hC₁ : C₁ ⊆ V₀) (hC₂ : C₂ ⊆ V₀) + (hcov : V₀ ⊆ C₁ ∪ C₂ ∪ X) + (hdisj : Disjoint C₁ C₂) (hdisj₁ : Disjoint C₁ X) (hdisj₂ : Disjoint C₂ X) + (hno_adj : ∀ ⦃a b : α⦄, a ∈ C₁ → b ∈ C₂ → ¬ G.Adj a b) + (hZ₁C : Z₁ ⊆ C₁ ∪ X) (hZ₂C : Z₂ ⊆ C₂ ∪ X) + (hX_lt : X.ncard < k) + (hmin_sep : ∀ X', Separates G V₀ Z₁ Z₂ X' → X'.ncard ≤ X.ncard → + D.sepDistSum hV₀ t₁ t₂ X ≤ D.sepDistSum hV₀ t₁ t₂ X') + {home : α → ι} (hhome : ∀ x ∈ V₀, x ∈ D.bag (home x)) + (hhome_dist : ∀ x ∈ V₀, D.distToPath t₁ t₂ (home x) = D.vertDist t₁ t₂ x) + (t : ι) : + ((D.shiftBag X C₁ home t₂ t).ncard = (D.bag t).ncard → D.shiftBag X C₂ home t₁ t ⊆ X) ∧ + ((D.shiftBag X C₂ home t₁ t).ncard = (D.bag t).ncard → D.shiftBag X C₁ home t₂ t ⊆ X) := by + refine ⟨D.theorem_3_claim_1_left hV₀ hG hv hmin_dist hX hC₂ hcov hdisj hdisj₂ + hno_adj hZ₁C hZ₂C hX_lt hmin_sep hhome hhome_dist t, ?_⟩ + have hcov' : V₀ ⊆ C₂ ∪ C₁ ∪ X := by + intro x hx + rcases hcov hx with (h1 | h2) | h3 + · exact Or.inl (Or.inr h1) + · exact Or.inl (Or.inl h2) + · exact Or.inr h3 + have hno_adj' : ∀ ⦃a b : α⦄, a ∈ C₂ → b ∈ C₁ → ¬ G.Adj a b := + fun a b ha hb hadj ↦ hno_adj hb ha hadj.symm + have hmin_dist' : ∀ t₁' t₂' Z₁' Z₂' k', D.ViolatesLean t₁' t₂' Z₁' Z₂' k' → + treeDist D.isTree t₂ t₁ ≤ treeDist D.isTree t₁' t₂' := by + intro t₁' t₂' Z₁' Z₂' k' hv' + rw [treeDist_comm D.isTree t₂ t₁] + exact hmin_dist t₁' t₂' Z₁' Z₂' k' hv' + have hmin_sep' : ∀ X', Separates G V₀ Z₂ Z₁ X' → X'.ncard ≤ X.ncard → + D.sepDistSum hV₀ t₂ t₁ X ≤ D.sepDistSum hV₀ t₂ t₁ X' := by + intro X' hsep' hcard' + rw [sepDistSum_comm D hV₀ t₂ t₁ X, sepDistSum_comm D hV₀ t₂ t₁ X'] + exact hmin_sep X' (separates_symm hsep') hcard' + have hhome_dist' : ∀ x ∈ V₀, D.distToPath t₂ t₁ (home x) = D.vertDist t₂ t₁ x := by + intro x hx + rw [distToPath_comm D t₂ t₁, vertDist_comm D t₂ t₁] + exact hhome_dist x hx + exact D.theorem_3_claim_1_left hV₀ hG hv.symm hmin_dist' hX hC₁ hcov' hdisj.symm + hdisj₁ hno_adj' hZ₂C hZ₁C hX_lt hmin_sep' hhome hhome_dist' t + +/-- **Claim (2)** in the proof of Theorem 3 of Bellenbaum and Diestel (Section 3, page 5): +$$(\exists t \in t_1 T t_2)\ \bigl(|W_t^1| < |V_t| \land |W_t^2| < |V_t|\bigr).$$ -/ +theorem theorem_3_claim_2 (hV₀ : V₀.Finite) + {t₁ t₂ : ι} {Z₁ Z₂ : Set α} {k : ℕ} + (hv : D.ViolatesLean t₁ t₂ Z₁ Z₂ k) + {X C₁ C₂ : Set α} + (hX : X ⊆ V₀) (hcov : V₀ ⊆ C₁ ∪ C₂ ∪ X) + (hdisj₁ : Disjoint C₁ X) (hdisj₂ : Disjoint C₂ X) + (hZ₁C : Z₁ ⊆ C₁ ∪ X) (hZ₂C : Z₂ ⊆ C₂ ∪ X) + (hX_lt : X.ncard < k) + {home : α → ι} + (hclaim₁ : ∀ t : ι, + ((D.shiftBag X C₁ home t₂ t).ncard = (D.bag t).ncard → D.shiftBag X C₂ home t₁ t ⊆ X) ∧ + ((D.shiftBag X C₂ home t₁ t).ncard = (D.bag t).ncard → D.shiftBag X C₁ home t₂ t ⊆ X)) + (hle₁ : ∀ t : ι, (D.shiftBag X C₁ home t₂ t).ncard ≤ (D.bag t).ncard) + (hle₂ : ∀ t : ι, (D.shiftBag X C₂ home t₁ t).ncard ≤ (D.bag t).ncard) : + ∃ t : ι, OnTreePath D.T t₁ t₂ t ∧ + (D.shiftBag X C₁ home t₂ t).ncard < (D.bag t).ncard ∧ + (D.shiftBag X C₂ home t₁ t).ncard < (D.bag t).ncard := by + -- First show that V_{t₁} meets C₁ and V_{t₂} meets C₂ + have ht₁_C₁ : (D.bag t₁ ∩ C₁).Nonempty := by + by_contra h + rw [Set.not_nonempty_iff_eq_empty] at h + have hZ₁_sub_X : Z₁ ⊆ X := by + intro z hz + rcases hZ₁C hz with hzC₁ | hzX + · exfalso + have : z ∈ D.bag t₁ ∩ C₁ := ⟨hv.subset_left hz, hzC₁⟩ + rw [h] at this + exact this + · exact hzX + have := Set.ncard_le_ncard hZ₁_sub_X (hV₀.subset hX) + rw [hv.ncard_left] at this + omega + have ht₂_C₂ : (D.bag t₂ ∩ C₂).Nonempty := by + by_contra h + rw [Set.not_nonempty_iff_eq_empty] at h + have hZ₂_sub_X : Z₂ ⊆ X := by + intro z hz + rcases hZ₂C hz with hzC₂ | hzX + · exfalso + have : z ∈ D.bag t₂ ∩ C₂ := ⟨hv.subset_right hz, hzC₂⟩ + rw [h] at this + exact this + · exact hzX + have := Set.ncard_le_ncard hZ₂_sub_X (hV₀.subset hX) + rw [hv.ncard_right] at this + omega + -- Find t ∈ t₁ T t₂ such that V_t meets both C₁ and C₂ + have hex_cross : ∃ t, OnTreePath D.T t₁ t₂ t ∧ + (D.bag t ∩ C₁).Nonempty ∧ (D.bag t ∩ C₂).Nonempty := by + by_contra hno + have hnot_t₂ : ¬ (D.bag t₂ ∩ C₁).Nonempty := + fun h ↦ hno ⟨t₂, onTreePath_right D.T t₁ t₂, h, ht₂_C₂⟩ + obtain ⟨t, t', he, ht_C₁, ht'_not_C₁⟩ := + exists_onTreePathEdge_of_prop D.isTree (fun s ↦ (D.bag s ∩ C₁).Nonempty) ht₁_C₁ hnot_t₂ + have ht_not_C₂ : ¬ (D.bag t ∩ C₂).Nonempty := + fun h ↦ hno ⟨t, he.onTreePath_left, ht_C₁, h⟩ + have hinter_sub_X : D.bag t ∩ D.bag t' ⊆ X := by + rintro x ⟨hxt, hxt'⟩ + rcases hcov (D.bag_subset t hxt) with (hxC₁ | hxC₂) | hxX + · exact (ht'_not_C₁ ⟨x, hxt', hxC₁⟩).elim + · exact (ht_not_C₂ ⟨x, hxt, hxC₂⟩).elim + · exact hxX + have hcard_le := Set.ncard_le_ncard hinter_sub_X (hV₀.subset hX) + have hk_le := hv.le_inter_ncard he + omega + obtain ⟨t, ht_on, ⟨c₁, htc₁, hc₁⟩, ⟨c₂, htc₂, hc₂⟩⟩ := hex_cross + refine ⟨t, ht_on, ?_, ?_⟩ + · apply lt_of_le_of_ne (hle₁ t) + intro heq + have hsub := (hclaim₁ t).1 heq + have hc₂_W₂ : c₂ ∈ D.shiftBag X C₂ home t₁ t := Or.inl ⟨htc₂, Or.inl hc₂⟩ + exact Set.disjoint_left.1 hdisj₂ hc₂ (hsub hc₂_W₂) + · apply lt_of_le_of_ne (hle₂ t) + intro heq + have hsub := (hclaim₁ t).2 heq + have hc₁_W₁ : c₁ ∈ D.shiftBag X C₁ home t₂ t := Or.inl ⟨htc₁, Or.inl hc₁⟩ + exact Set.disjoint_left.1 hdisj₁ hc₁ (hsub hc₁_W₁) + +end TreeDecomp + +end GraphMinor.Thomas diff --git a/LeanPool/GraphMinor/Thomas/LeanDecomp.lean b/LeanPool/GraphMinor/Thomas/LeanDecomp.lean new file mode 100644 index 0000000000..21c5d8db77 --- /dev/null +++ b/LeanPool/GraphMinor/Thomas/LeanDecomp.lean @@ -0,0 +1,404 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Thomas.Claims +public import Mathlib.Data.DFinsupp.WellFounded + +/-! +# Fatness and Theorem 3 of Bellenbaum and Diestel + +This file defines the fatness of a tree-decomposition (Section 1 of Bellenbaum and Diestel, +*Two short proofs concerning tree-decompositions*, Combin. Probab. Comput. 11 (2002), 541–547) +and completes the proof of Theorem 3: every finite graph has a lean tree-decomposition of minimum +width. + +## Main definitions and results + +* `GraphMinor.Thomas.TreeDecomp.countParts`: number of parts of a given size $h$. +* `GraphMinor.Thomas.TreeDecomp.fatness`: the lexicographically ordered tuple + $(a_{|G|}, \dots, a_1)$ where $a_h$ is the number of parts of size $h$. +* `GraphMinor.Thomas.TreeDecomp.fatness_combine_lt`: the amalgamated tree-decomposition +$\mathcal{D}'$ + constructed in the proof of Theorem 3 has strictly smaller fatness than $\mathcal{D}$. +* `GraphMinor.Thomas.theorem_3`: **Theorem 3** of Bellenbaum and Diestel (Section 3, page 3). +-/ + +namespace GraphMinor.Thomas + +open SimpleGraph + +universe u v w + +public section + +variable {α : Type u} {β : Type v} {ι : Type w} [Fintype ι] {G : SimpleGraph α} {V₀ : Set α} + +namespace TreeDecomp + +/-- The number of parts $V_t$ ($t \in T$) of size $h$ in a tree-decomposition $\mathcal{D}$. -/ +noncomputable def countParts (D : TreeDecomp G V₀ ι) (h : ℕ) : ℕ := + open Classical in + (Finset.univ.filter fun t : ι ↦ (D.bag t).ncard = h).card + +/-- The fatness of a tree-decomposition $\mathcal{D}$ of $(G, V_0)$ is the $|V_0|$-tuple +$(a_{|V_0|}, \dots, a_1) \in \mathbb{N}^{|V_0|}$, ordered lexicographically, where $a_h$ is the +number of parts of $\mathcal{D}$ of size $h$ (Bellenbaum and Diestel, Section 1, page 2). -/ +noncomputable def fatness (D : TreeDecomp G V₀ ι) : Lex (Fin V₀.ncard → ℕ) := + toLex fun i : Fin V₀.ncard ↦ D.countParts (V₀.ncard - i.val) + +/-- Reindexing the tree nodes by an equivalence preserves `countParts`. -/ +theorem countParts_reindex (D : TreeDecomp G V₀ ι) {ι' : Type*} [Fintype ι'] (e : ι ≃ ι') (h : ℕ) : + (D.reindex e).countParts h = D.countParts h := by + classical + unfold countParts + refine Finset.card_bij (fun t _ ↦ e.symm t) ?_ ?_ ?_ + · intro t ht + rw [Finset.mem_filter] at ht ⊢ + exact ⟨Finset.mem_univ _, ht.2⟩ + · intro t₁ _ t₂ _ hEq + exact e.symm.injective hEq + · intro t ht + rw [Finset.mem_filter] at ht + refine ⟨e t, Finset.mem_filter.2 ⟨Finset.mem_univ _, ?_⟩, e.symm_apply_apply t⟩ + change (D.bag (e.symm (e t))).ncard = h + rw [e.symm_apply_apply] + exact ht.2 + +/-- Reindexing the tree nodes by an equivalence preserves `fatness`. -/ +theorem fatness_reindex (D : TreeDecomp G V₀ ι) {ι' : Type*} [Fintype ι'] (e : ι ≃ ι') : + (D.reindex e).fatness = D.fatness := by + unfold fatness + congr 1 + ext i + exact D.countParts_reindex e (V₀.ncard - i.val) + +/-- If $\mathcal{D}$ has width $\le w$, then it has no parts of size $> w + 1$. -/ +theorem countParts_eq_zero_of_widthLE (D : TreeDecomp G V₀ ι) {w h : ℕ} + (hw : D.WidthLE w) (hh : w + 1 < h) : D.countParts h = 0 := by + classical + unfold countParts + rw [Finset.card_eq_zero, Finset.filter_eq_empty_iff] + intro t _ + have hle := (Set.encard_le_coe_iff_finite_ncard_le.mp (hw t)).2 + omega + +/-- If $\mathcal{D}$ has fatness at most that of $\mathcal{D}_0$ and $\mathcal{D}_0$ has width +$\le w$, then $\mathcal{D}$ also has width $\le w$. -/ +theorem widthLE_of_fatness_le (D : TreeDecomp G V₀ ι) {ι₀ : Type*} [Fintype ι₀] + (D₀ : TreeDecomp G V₀ ι₀) (hV₀ : V₀.Finite) {w : ℕ} + (hw : D₀.WidthLE w) (hle : D.fatness ≤ D₀.fatness) : D.WidthLE w := by + apply (D.widthLE_iff_ncard_le hV₀).mpr + intro t + by_contra! hgt + set h := (D.bag t).ncard + have hh_le : h ≤ V₀.ncard := Set.ncard_le_ncard (D.bag_subset t) hV₀ + have hh_pos : 1 ≤ h := by omega + let i : Fin V₀.ncard := ⟨V₀.ncard - h, by omega⟩ + have hi_val : V₀.ncard - i.val = h := Nat.sub_sub_self hh_le + have hD_pos : 0 < D.fatness i := by + classical + change 0 < D.countParts (V₀.ncard - i.val) + rw [hi_val] + unfold countParts + rw [Finset.card_pos] + exact ⟨t, Finset.mem_filter.2 ⟨Finset.mem_univ _, rfl⟩⟩ + have hD₀_zero : ∀ j : Fin V₀.ncard, j ≤ i → D₀.fatness j = 0 := by + intro j hj + change D₀.countParts (V₀.ncard - j.val) = 0 + apply D₀.countParts_eq_zero_of_widthLE hw + have hj_le : j.val ≤ V₀.ncard - h := hj + omega + rcases lt_or_eq_of_le hle with hlt | heq + · rcases hlt with ⟨j, hj_eq, hj_lt⟩ + rcases le_or_gt j i with hji | hij + · exact Nat.not_lt_zero _ (hD₀_zero j hji ▸ hj_lt) + · have h1 : D.fatness i = D₀.fatness i := hj_eq i hij + have h0 : D₀.fatness i = 0 := hD₀_zero i le_rfl + omega + · have h1 : D.fatness i = D₀.fatness i := by rw [heq] + have h0 := hD₀_zero i le_rfl + omega + +/-- In the proof of Theorem 3 of Bellenbaum and Diestel (Section 3, page 5), the combined +tree-decomposition $\mathcal{D}'$ has strictly smaller fatness than $\mathcal{D}$. -/ +theorem fatness_combine_lt (D : TreeDecomp G V₀ ι) (hV₀ : V₀.Finite) + {X C₁ C₂ : Set α} (hX : X ⊆ V₀) (hC₁ : C₁ ⊆ V₀) (hC₂ : C₂ ⊆ V₀) + (hcov : V₀ ⊆ C₁ ∪ C₂ ∪ X) (hdisj : Disjoint C₁ C₂) + (hsep : ∀ ⦃u v : α⦄, u ∈ V₀ → v ∈ V₀ → G.Adj u v → + (u ∈ C₁ ∪ X ∧ v ∈ C₁ ∪ X) ∨ (u ∈ C₂ ∪ X ∧ v ∈ C₂ ∪ X)) + {home : α → ι} (hhome : ∀ x ∈ X, x ∈ D.bag (home x)) + {t₁ t₂ : ι} + (hle₁ : ∀ t, (D.shiftBag X C₁ home t₂ t).ncard ≤ (D.bag t).ncard) + (hle₂ : ∀ t, (D.shiftBag X C₂ home t₁ t).ncard ≤ (D.bag t).ncard) + (hclaim₁ : ∀ t, + ((D.shiftBag X C₁ home t₂ t).ncard = (D.bag t).ncard → D.shiftBag X C₂ home t₁ t ⊆ X) ∧ + ((D.shiftBag X C₂ home t₁ t).ncard = (D.bag t).ncard → D.shiftBag X C₁ home t₂ t ⊆ X)) + {t₀ : ι} + (ht₀_X : X.ncard < (D.bag t₀).ncard) + (ht₀_1 : (D.shiftBag X C₁ home t₂ t₀).ncard < (D.bag t₀).ncard) + (ht₀_2 : (D.shiftBag X C₂ home t₁ t₀).ncard < (D.bag t₀).ncard) : + (D.combine hX hC₁ hC₂ hcov hdisj hsep hhome t₁ t₂).fatness < D.fatness := by + classical + let D' := D.combine hX hC₁ hC₂ hcov hdisj hsep hhome t₁ t₂ + let M : Finset ι := Finset.univ.filter fun t : ι ↦ + (D.shiftBag X C₁ home t₂ t).ncard < (D.bag t).ncard ∧ + (D.shiftBag X C₂ home t₁ t).ncard < (D.bag t).ncard + have ht₀_M : t₀ ∈ M := Finset.mem_filter.2 ⟨Finset.mem_univ _, ht₀_1, ht₀_2⟩ + let S : Finset ℕ := M.image fun t ↦ (D.bag t).ncard + have hS_ne : S.Nonempty := ⟨(D.bag t₀).ncard, Finset.mem_image_of_mem _ ht₀_M⟩ + let hstar : ℕ := S.max' hS_ne + have ht₀_le_hstar : (D.bag t₀).ncard ≤ hstar := + Finset.le_max' S _ (Finset.mem_image_of_mem _ ht₀_M) + have hX_lt_hstar : X.ncard < hstar := lt_of_lt_of_le ht₀_X ht₀_le_hstar + have hhstar_mem : hstar ∈ S := Finset.max'_mem S hS_ne + obtain ⟨tmax, htmax_M, htmax_eq⟩ := Finset.mem_image.1 hhstar_mem + have hhstar_le_V₀ : hstar ≤ V₀.ncard := by + rw [← htmax_eq] + exact Set.ncard_le_ncard (D.bag_subset tmax) hV₀ + have hM_le_hstar : ∀ t ∈ M, (D.bag t).ncard ≤ hstar := + fun t ht ↦ Finset.le_max' S _ (Finset.mem_image_of_mem _ ht) + -- Key bijection for all h ≥ hstar: parts of D' of size h correspond to t ∉ M with |V_t| = h + have hcount_eq : ∀ h : ℕ, hstar ≤ h → + D'.countParts h = (Finset.univ.filter fun t : ι ↦ t ∉ M ∧ (D.bag t).ncard = h).card := by + intro h hh + have hX_lt_h : X.ncard < h := lt_of_lt_of_le hX_lt_hstar hh + unfold countParts + refine Finset.card_bij (fun (p : Bool × ι) _ ↦ p.2) ?_ ?_ ?_ + · rintro ⟨b, t⟩ hp + rw [Finset.mem_filter] at hp + have hp_card : (D'.bag (b, t)).ncard = h := hp.2 + have hbag_ge : h ≤ (D.bag t).ncard := by + cases b + · rw [← hp_card]; exact hle₁ t + · rw [← hp_card]; exact hle₂ t + have ht_not_M : t ∉ M := by + intro htM + have hle_star := hM_le_hstar t htM + rw [Finset.mem_filter] at htM + cases b + · change (D.shiftBag X C₁ home t₂ t).ncard = h at hp_card + have := htM.2.1; omega + · change (D.shiftBag X C₂ home t₁ t).ncard = h at hp_card + have := htM.2.2; omega + have hbag_eq : (D.bag t).ncard = h := by + have hnot_both : ¬ ((D.shiftBag X C₁ home t₂ t).ncard < (D.bag t).ncard ∧ + (D.shiftBag X C₂ home t₁ t).ncard < (D.bag t).ncard) := by + intro hboth + exact ht_not_M (Finset.mem_filter.2 ⟨Finset.mem_univ _, hboth⟩) + have hle1 := hle₁ t + have hle2 := hle₂ t + cases b + · change (D.shiftBag X C₁ home t₂ t).ncard = h at hp_card + by_contra hne + have hlt1 : (D.shiftBag X C₁ home t₂ t).ncard < (D.bag t).ncard := by omega + have heq2 : (D.shiftBag X C₂ home t₁ t).ncard = (D.bag t).ncard := by omega + have hsub1 : D.shiftBag X C₁ home t₂ t ⊆ X := (hclaim₁ t).2 heq2 + have hle_X : (D.shiftBag X C₁ home t₂ t).ncard ≤ X.ncard := + Set.ncard_le_ncard hsub1 (hV₀.subset hX) + omega + · change (D.shiftBag X C₂ home t₁ t).ncard = h at hp_card + by_contra hne + have hlt2 : (D.shiftBag X C₂ home t₁ t).ncard < (D.bag t).ncard := by omega + have heq1 : (D.shiftBag X C₁ home t₂ t).ncard = (D.bag t).ncard := by omega + have hsub2 : D.shiftBag X C₂ home t₁ t ⊆ X := (hclaim₁ t).1 heq1 + have hle_X : (D.shiftBag X C₂ home t₁ t).ncard ≤ X.ncard := + Set.ncard_le_ncard hsub2 (hV₀.subset hX) + omega + exact Finset.mem_filter.2 ⟨Finset.mem_univ _, ht_not_M, hbag_eq⟩ + · rintro ⟨b₁, s₁⟩ hp₁ ⟨b₂, s₂⟩ hp₂ (rfl : s₁ = s₂) + rw [Finset.mem_filter] at hp₁ hp₂ + congr 1 + by_contra hb_ne + have hfalse : (D.shiftBag X C₁ home t₂ s₁).ncard = h := by + cases b₁ + · exact hp₁.2 + · cases b₂ + · exact hp₂.2 + · exact (hb_ne rfl).elim + have htrue : (D.shiftBag X C₂ home t₁ s₁).ncard = h := by + cases b₁ + · cases b₂ + · exact (hb_ne rfl).elim + · exact hp₂.2 + · exact hp₁.2 + have hle1 := hle₁ s₁ + have hle2 := hle₂ s₁ + have hbag_ge : h ≤ (D.bag s₁).ncard := by omega + by_cases heq1 : (D.shiftBag X C₁ home t₂ s₁).ncard = (D.bag s₁).ncard + · have hsub2 : D.shiftBag X C₂ home t₁ s₁ ⊆ X := (hclaim₁ s₁).1 heq1 + have hle_X : (D.shiftBag X C₂ home t₁ s₁).ncard ≤ X.ncard := + Set.ncard_le_ncard hsub2 (hV₀.subset hX) + omega + · have hlt1 : (D.shiftBag X C₁ home t₂ s₁).ncard < (D.bag s₁).ncard := by omega + have hlt2 : (D.shiftBag X C₂ home t₁ s₁).ncard < (D.bag s₁).ncard := by omega + have hs₁_M : s₁ ∈ M := Finset.mem_filter.2 ⟨Finset.mem_univ _, hlt1, hlt2⟩ + have := hM_le_hstar s₁ hs₁_M + omega + · intro t ht + rw [Finset.mem_filter] at ht + rcases ht with ⟨_, ht_not_M, ht_card⟩ + have hnot_both : ¬ ((D.shiftBag X C₁ home t₂ t).ncard < (D.bag t).ncard ∧ + (D.shiftBag X C₂ home t₁ t).ncard < (D.bag t).ncard) := + fun hboth ↦ ht_not_M (Finset.mem_filter.2 ⟨Finset.mem_univ _, hboth⟩) + have hle1 := hle₁ t + have hle2 := hle₂ t + by_cases heq1 : (D.shiftBag X C₁ home t₂ t).ncard = h + · refine ⟨(false, t), Finset.mem_filter.2 ⟨Finset.mem_univ _, heq1⟩, rfl⟩ + · have heq2 : (D.shiftBag X C₂ home t₁ t).ncard = h := by omega + refine ⟨(true, t), Finset.mem_filter.2 ⟨Finset.mem_univ _, heq2⟩, rfl⟩ + let istar : Fin V₀.ncard := ⟨V₀.ncard - hstar, by omega⟩ + have histar_val : V₀.ncard - istar.val = hstar := Nat.sub_sub_self hhstar_le_V₀ + refine ⟨istar, ?_, ?_⟩ + · intro j hj + change D'.countParts (V₀.ncard - j.val) = D.countParts (V₀.ncard - j.val) + have hj_lt : j.val < V₀.ncard - hstar := hj + have hh_gt : hstar < V₀.ncard - j.val := by omega + rw [hcount_eq (V₀.ncard - j.val) (le_of_lt hh_gt)] + unfold countParts + congr 1 + ext t + simp only [Finset.mem_filter, Finset.mem_univ, true_and, and_iff_right_iff_imp] + intro ht_eq htM + have := hM_le_hstar t htM + omega + · change D'.countParts (V₀.ncard - istar.val) < D.countParts (V₀.ncard - istar.val) + rw [histar_val, hcount_eq hstar le_rfl] + unfold countParts + apply Finset.card_lt_card + rw [Finset.ssubset_iff_of_subset] + · refine ⟨tmax, Finset.mem_filter.2 ⟨Finset.mem_univ _, htmax_eq⟩, ?_⟩ + rw [Finset.mem_filter] + intro h + exact h.2.1 htmax_M + · intro t ht + rw [Finset.mem_filter] at ht ⊢ + exact ⟨Finset.mem_univ _, ht.2.2⟩ + +end TreeDecomp + +/-- **Theorem 3** of Bellenbaum and Diestel (Section 3, page 3): +Every finite graph has a lean tree-decomposition of minimum width (that is, if `G` admits +a tree-decomposition of width $\le w$, then it admits a lean tree-decomposition of width $\le w$). +-/ +theorem theorem_3 (G : Hypergraph α β) + {ι₀ : Type w} [Fintype ι₀] (D₀ : TreeDecomp G.skeleton G.vertexSet ι₀) {w : ℕ} + (hw₀ : D₀.WidthLE w) : + ∃ (m : ℕ) (D : TreeDecomp G.skeleton G.vertexSet (Fin m)), D.IsLean ∧ D.WidthLE w := by + classical + have hV₀ : G.vertexSet.Finite := G.vertexSet_finite + have hG : ∀ ⦃u v : α⦄, G.skeleton.Adj u v → u ∈ G.vertexSet ∧ v ∈ G.vertexSet := + fun _ _ ⟨_, _, hu, hv⟩ ↦ ⟨G.vertex_mem_of_inc hu, G.vertex_mem_of_inc hv⟩ + let Pack := Σ m : ℕ, TreeDecomp G.skeleton G.vertexSet (Fin m) + let wf_fat : WellFounded (InvImage (· < ·) (fun p : Pack ↦ p.2.fatness)) := + InvImage.wf (fun p : Pack ↦ p.2.fatness) wellFounded_lt + let S : Set Pack := {p | p.2.fatness ≤ D₀.fatness} + have hS_ne : S.Nonempty := by + refine ⟨⟨Fintype.card ι₀, D₀.reindex (Fintype.equivFin ι₀)⟩, ?_⟩ + rw [Set.mem_ofPred_eq, D₀.fatness_reindex] + obtain ⟨⟨m, D⟩, hD_le, hD_min⟩ := wf_fat.has_min S hS_ne + refine ⟨m, D, ?_, D.widthLE_of_fatness_le D₀ hV₀ hw₀ hD_le⟩ + by_contra hnot_lean + -- There exists a violation of leanness + have hex_viol : ∃ p : Fin m × Fin m × Set α × Set α × ℕ, + D.ViolatesLean p.1 p.2.1 p.2.2.1 p.2.2.2.1 p.2.2.2.2 := by + unfold TreeDecomp.IsLean at hnot_lean + push Not at hnot_lean + rcases hnot_lean with ⟨t₁, t₂, Z₁, Z₂, k, hZ₁, hZ₂, hk₁, hk₂, hpaths, hinter⟩ + exact ⟨(t₁, t₂, Z₁, Z₂, k), ⟨hZ₁, hZ₂, hk₁, hk₂, hpaths, hinter⟩⟩ + -- Minimize treeDist D.isTree t₁ t₂ among violations of leanness + let wf_dist := InvImage.wf + (fun p : Fin m × Fin m × Set α × Set α × ℕ ↦ treeDist D.isTree p.1 p.2.1) wellFounded_lt + obtain ⟨⟨t₁, t₂, Z₁, Z₂, k⟩, hv, hmin_dist_raw⟩ := + wf_dist.has_min {p | D.ViolatesLean p.1 p.2.1 p.2.2.1 p.2.2.2.1 p.2.2.2.2} hex_viol + have hmin_dist : ∀ t₁' t₂' Z₁' Z₂' k', D.ViolatesLean t₁' t₂' Z₁' Z₂' k' → + treeDist D.isTree t₁ t₂ ≤ treeDist D.isTree t₁' t₂' := by + intro t₁' t₂' Z₁' Z₂' k' hv' + exact not_lt.1 (hmin_dist_raw (t₁', t₂', Z₁', Z₂', k') hv') + -- By Menger's theorem, there exists a separator of Z₁ and Z₂ of size < k + have hZ₁_V₀ : Z₁ ⊆ G.vertexSet := hv.subset_left.trans (D.bag_subset t₁) + have hZ₂_V₀ : Z₂ ⊆ G.vertexSet := hv.subset_right.trans (D.bag_subset t₂) + obtain ⟨X₀, hX₀_sep, hX₀_lt⟩ := + exists_separates_lt_of_not_hasDisjointPaths G hZ₁_V₀ hZ₂_V₀ hv.not_hasDisjointPaths + -- First minimize |X| among separators of Z₁ and Z₂ + let wf_card := InvImage.wf (fun X : Set α ↦ X.ncard) wellFounded_lt + obtain ⟨X₁, hX₁_sep, hmin_card_raw⟩ := + wf_card.has_min {X | Separates G.skeleton G.vertexSet Z₁ Z₂ X} ⟨X₀, hX₀_sep⟩ + have hmin_card₁ : ∀ X', Separates G.skeleton G.vertexSet Z₁ Z₂ X' → X₁.ncard ≤ X'.ncard := + fun X' hX' ↦ not_lt.1 (hmin_card_raw X' hX') + -- Among minimum-order separators of Z₁ and Z₂, minimize sepDistSum + let wf_sum := InvImage.wf (fun X : Set α ↦ D.sepDistSum hV₀ t₁ t₂ X) wellFounded_lt + obtain ⟨X, ⟨hX_sep, hX_card_le⟩, hmin_sum_raw⟩ := + wf_sum.has_min {X | Separates G.skeleton G.vertexSet Z₁ Z₂ X ∧ X.ncard ≤ X₁.ncard} + ⟨X₁, hX₁_sep, le_rfl⟩ + have hX_card_eq : X.ncard = X₁.ncard := le_antisymm hX_card_le (hmin_card₁ X hX_sep) + have hmin_card : ∀ X', Separates G.skeleton G.vertexSet Z₁ Z₂ X' → X.ncard ≤ X'.ncard := by + intro X' hX' + rw [hX_card_eq] + exact hmin_card₁ X' hX' + have hX_lt : X.ncard < k := lt_of_le_of_lt (hmin_card X₀ hX₀_sep) hX₀_lt + have hmin_sep : ∀ X', Separates G.skeleton G.vertexSet Z₁ Z₂ X' → X'.ncard ≤ X.ncard → + D.sepDistSum hV₀ t₁ t₂ X ≤ D.sepDistSum hV₀ t₁ t₂ X' := by + intro X' hX'_sep hX'_le + rw [hX_card_eq] at hX'_le + exact not_lt.1 (hmin_sum_raw X' ⟨hX'_sep, hX'_le⟩) + -- Define C₁, C₂ and home + let C₁ := sepCompLeft G.skeleton G.vertexSet X Z₁ + let C₂ := sepCompRight G.skeleton G.vertexSet X Z₁ + have hX : X ⊆ G.vertexSet := hX_sep.1 + have hC₁ : C₁ ⊆ G.vertexSet := sepCompLeft_subset G.skeleton G.vertexSet X Z₁ + have hC₂ : C₂ ⊆ G.vertexSet := sepCompRight_subset G.skeleton G.vertexSet X Z₁ + have hcov : G.vertexSet ⊆ C₁ ∪ C₂ ∪ X := subset_sepComp_union G.skeleton Z₁ + have hdisj : Disjoint C₁ C₂ := disjoint_sepCompLeft_sepCompRight G.skeleton G.vertexSet X Z₁ + have hdisj₁ : Disjoint C₁ X := disjoint_sepCompLeft_sep G.skeleton G.vertexSet X Z₁ + have hdisj₂ : Disjoint C₂ X := disjoint_sepCompRight_sep G.skeleton G.vertexSet X Z₁ + have hno_adj : ∀ ⦃a b : α⦄, a ∈ C₁ → b ∈ C₂ → ¬ G.skeleton.Adj a b := + fun _ _ ha hb ↦ not_adj_sepCompLeft_sepCompRight ha hb + have hsep_adj : ∀ ⦃u v : α⦄, u ∈ G.vertexSet → v ∈ G.vertexSet → G.skeleton.Adj u v → + (u ∈ C₁ ∪ X ∧ v ∈ C₁ ∪ X) ∨ (u ∈ C₂ ∪ X ∧ v ∈ C₂ ∪ X) := + fun _ _ hu hv hadj ↦ adj_mem_sepComp_or hu hv hadj + have hZ₁C : Z₁ ⊆ C₁ ∪ X := subset_sepCompLeft_union G.skeleton hZ₁_V₀ + have hZ₂C : Z₂ ⊆ C₂ ∪ X := subset_sepCompRight_union hZ₂_V₀ hX_sep + -- Obtain Menger paths for the minimum separator X + obtain ⟨end₁, end₂, hend₁, hend₂, P₁, P₂, hP₁_sub, hP₁_disj, hP₂_sub, hP₂_disj⟩ := + exists_menger_walks_of_min_sep G hZ₁_V₀ hZ₂_V₀ hX_sep hmin_card hcov + hdisj hdisj₁ hdisj₂ hno_adj hZ₁C hZ₂C + let home := D.chooseHome t₁ t₂ + have hhome : ∀ x ∈ G.vertexSet, x ∈ D.bag (home x) := fun x hx ↦ D.chooseHome_mem_bag t₁ t₂ hx + have hhome_X : ∀ x ∈ X, x ∈ D.bag (home x) := fun x hx ↦ hhome x (hX hx) + have hhome_dist : ∀ x ∈ G.vertexSet, D.distToPath t₁ t₂ (home x) = D.vertDist t₁ t₂ x := + fun x hx ↦ D.distToPath_chooseHome t₁ t₂ hx + -- Apply Lemma 2, Claim (1), and Claim (2) + have hle₁ : ∀ t, (D.shiftBag X C₁ home t₂ t).ncard ≤ (D.bag t).ncard := + D.lemma_2 hV₀ hX hhome_X t₂ (fun x hx ↦ hv.subset_right (hend₂ x hx)) P₁ hP₁_sub hP₁_disj + have hle₂ : ∀ t, (D.shiftBag X C₂ home t₁ t).ncard ≤ (D.bag t).ncard := + D.lemma_2 hV₀ hX hhome_X t₁ (fun x hx ↦ hv.subset_left (hend₁ x hx)) P₂ hP₂_sub hP₂_disj + have hclaim₁ := + D.theorem_3_claim_1 hV₀ hG hv hmin_dist hX hC₁ hC₂ hcov hdisj hdisj₁ hdisj₂ hno_adj + hZ₁C hZ₂C hX_lt hmin_sep hhome hhome_dist + obtain ⟨t₀, ht₀_on, ht₀_1, ht₀_2⟩ := + D.theorem_3_claim_2 hV₀ hv hX hcov hdisj₁ hdisj₂ hZ₁C hZ₂C hX_lt hclaim₁ hle₁ hle₂ + have hk_le_t₀ : k ≤ (D.bag t₀).ncard := D.le_bag_ncard_of_violatesLean hV₀ hv ht₀_on + have ht₀_X : X.ncard < (D.bag t₀).ncard := lt_of_lt_of_le hX_lt hk_le_t₀ + have hfat_lt := + D.fatness_combine_lt hV₀ hX hC₁ hC₂ hcov hdisj hsep_adj hhome_X hle₁ hle₂ hclaim₁ + ht₀_X ht₀_1 ht₀_2 + -- Reindex D' to Fin (2 * m) and contradict minimality of D + let D' := D.combine hX hC₁ hC₂ hcov hdisj hsep_adj hhome_X t₁ t₂ + let m' := Fintype.card (Bool × Fin m) + let D'' := D'.reindex (Fintype.equivFin (Bool × Fin m)) + have hfat_D'' : D''.fatness < D.fatness := by + rw [D'.fatness_reindex] + exact hfat_lt + have hD''_mem : (⟨m', D''⟩ : Pack) ∈ S := le_trans (le_of_lt hfat_D'') hD_le + exact hD_min ⟨m', D''⟩ hD''_mem hfat_D'' + +end + +end GraphMinor.Thomas diff --git a/LeanPool/GraphMinor/Thomas/RootedTree.lean b/LeanPool/GraphMinor/Thomas/RootedTree.lean new file mode 100644 index 0000000000..285145176c --- /dev/null +++ b/LeanPool/GraphMinor/Thomas/RootedTree.lean @@ -0,0 +1,755 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.GM04.TreeDecomposition +public import LeanPool.GraphMinor.Thomas.Claims +import LeanPool.GraphMinor.GM04.TreeLemma.Basic + +/-! +# Translation between `GM04.RootedTree` and undirected trees + +This file connects the directed rooted trees `GraphMinor.GM04.RootedTree` of Graph Minors IV +(Section 2) with the undirected trees (`SimpleGraph.IsTree`) used in Bellenbaum and Diestel's +proof of Thomas's lemma. + +## Main definitions and results + +* `GraphMinor.Thomas.cross_subtreeAt_inter_rootSide_vertexSet` and + `GraphMinor.Thomas.edgeOrder_eq_ncard_inter`: for any tree-decomposition `(T, τ)` of `G` and any + edge `f ∈ T.edges`, `edgeOrder T τ f = ((τ f).vertexSet ∩ (τ (T.parent f)).vertexSet).ncard`. +* `GraphMinor.Thomas.toSimpleGraph`: the underlying undirected graph of `T : RootedTree ι` on + `T.verts`. +* `GraphMinor.Thomas.toSimpleGraph_isTree`: `toSimpleGraph T` is an undirected tree. +* `GraphMinor.Thomas.onTreePath_toSimpleGraph_iff`: `OnTreePath (toSimpleGraph T) t₁ t₂ t` + agrees with `T.OnPath t₁.1 t₂.1 t.1`. +* `GraphMinor.Thomas.rootedTreeOfIsTree`: constructs a `RootedTree ℕ` on `Finset.range m` from an + undirected tree on `Fin m`. +-/ + +namespace GraphMinor.Thomas + +open SimpleGraph GraphMinor.GM04 + +universe u + +@[expose] public section + +/-! ## Elementary properties of `GM04.RootedTree` -/ + +section RootedTreeProps + +variable {ι : Type u} (T : RootedTree ι) + +theorem mem_verts_of_mem_edges {f : ι} (hf : f ∈ T.edges) : f ∈ T.verts := + GM04.RootedTree.mem_verts_of_mem_edges T hf + +theorem ne_root_of_mem_edges {f : ι} (hf : f ∈ T.edges) : f ≠ T.root := + GM04.RootedTree.ne_root_of_mem_edges T hf + +theorem mem_edges_iff {f : ι} : f ∈ T.edges ↔ f ∈ T.verts ∧ f ≠ T.root := + (GM04.RootedTree.mem_edges T).trans and_comm + +theorem iterate_parent_mem {v : ι} (hv : v ∈ T.verts) (n : ℕ) : + T.parent^[n] v ∈ T.verts := + GM04.RootedTree.iterate_parent_mem T hv n + +theorem iterate_parent_root (n : ℕ) : T.parent^[n] T.root = T.root := + GM04.RootedTree.iterate_parent_root T n + +theorem iterate_parent_eq_root_of_le {v : ι} {n m : ℕ} + (hn : T.parent^[n] v = T.root) (hle : n ≤ m) : + T.parent^[m] v = T.root := + GM04.RootedTree.iterate_parent_eq_root_of_le T hn hle + +theorem not_iterate_succ_eq_self {v : ι} (hv : v ∈ T.verts) (hne : v ≠ T.root) (n : ℕ) : + T.parent^[n + 1] v ≠ v := + fun h => hne (GM04.RootedTree.eq_root_of_iterate_eq_self T hv (Nat.succ_pos n) h) + +theorem reaches_refl {v : ι} (hv : v ∈ T.verts) : T.Reaches v v := + GM04.RootedTree.reaches_refl T hv + +theorem reaches_mem_left {u v : ι} (h : T.Reaches u v) : u ∈ T.verts := + GM04.RootedTree.Reaches.verts_left T h + +theorem reaches_trans {u v w : ι} (huv : T.Reaches u v) (hvw : T.Reaches v w) : + T.Reaches u w := + GM04.RootedTree.Reaches.trans T huv hvw + +theorem reaches_antisymm {u v : ι} (huv : T.Reaches u v) (hvu : T.Reaches v u) : + u = v := + GM04.RootedTree.Reaches.antisymm T huv hvu + +theorem reaches_total_of_reaches {u v w : ι} (hu : T.Reaches u w) (hv : T.Reaches v w) : + T.Reaches u v ∨ T.Reaches v u := + GM04.RootedTree.Reaches.total_of_reaches T hu hv + +theorem reaches_root_iff {u : ι} : T.Reaches u T.root ↔ u = T.root := + GM04.RootedTree.reaches_root_iff T + +theorem onPath_subtreeAt_rootSide {f t s : ι} (hf : f ∈ T.edges) + (ht : t ∈ T.subtreeAt f) (hs : s ∈ T.rootSide f) : + T.OnPath t s f ∧ T.OnPath t s (T.parent f) := by + classical + unfold RootedTree.subtreeAt at ht + unfold RootedTree.rootSide RootedTree.subtreeAt at hs + rw [Finset.mem_filter] at ht + rw [Finset.mem_sdiff, Finset.mem_filter, not_and] at hs + have hft : T.Reaches f t := ht.2 + have hs_verts : s ∈ T.verts := hs.1 + have hnot_fs : ¬ T.Reaches f s := hs.2 hs_verts + have hf_parent : T.Reaches (T.parent f) f := ⟨mem_verts_of_mem_edges T hf, 1, rfl⟩ + have h_common : ∀ x, T.Reaches x t → T.Reaches x s → T.Reaches x f := by + intro x hxt hxs + rcases reaches_total_of_reaches T hxt hft with hxf | hfx + · exact hxf + · exact (hnot_fs (reaches_trans T hfx hxs)).elim + refine ⟨⟨Or.inl hft, h_common⟩, ⟨Or.inl (reaches_trans T hf_parent hft), ?_⟩⟩ + intro x hxt hxs + have hxf := h_common x hxt hxs + obtain ⟨_, n, rfl⟩ := hxf + rcases n with _ | n + · exact (hnot_fs hxs).elim + · refine ⟨T.parent_mem f (mem_verts_of_mem_edges T hf), n, ?_⟩ + rw [← Function.iterate_succ_apply] + +/-! ## `edgeOrder` of an edge in any `GM04.IsTreeDecomposition` -/ + +/-- For any tree-decomposition `(T, τ)` of `G` and any edge `f ∈ T.edges`, the intersection of +`τ × T^f` and `τ × T_f` has vertex set `V(τ(f)) ∩ V(τ(parent f))`. -/ +theorem cross_subtreeAt_inter_rootSide_vertexSet {α β : Type*} {G : RootedHypergraph α β} + {τ : ι → RootedHypergraph α β} (hD : IsTreeDecomposition G T τ) + {f : ι} (hf : f ∈ T.edges) : + ((cross τ (T.subtreeAt f) f).toHypergraph ∩ + (cross τ (T.rootSide f) T.root).toHypergraph).vertexSet = + (τ f).vertexSet ∩ (τ (T.parent f)).vertexSet := by + classical + have hf_verts : f ∈ T.verts := mem_verts_of_mem_edges T hf + have hf_ne_root : f ≠ T.root := ne_root_of_mem_edges T hf + have hparent_verts : T.parent f ∈ T.verts := T.parent_mem f hf_verts + have hf_sub : f ∈ T.subtreeAt f := by + unfold RootedTree.subtreeAt + exact Finset.mem_filter.2 ⟨hf_verts, reaches_refl T hf_verts⟩ + have hroot_side : T.root ∈ T.rootSide f := by + unfold RootedTree.rootSide RootedTree.subtreeAt + rw [Finset.mem_sdiff, Finset.mem_filter] + refine ⟨T.root_mem, fun h ↦ hf_ne_root ((reaches_root_iff T).1 h.2)⟩ + have hparent_side : T.parent f ∈ T.rootSide f := by + unfold RootedTree.rootSide RootedTree.subtreeAt + rw [Finset.mem_sdiff, Finset.mem_filter] + refine ⟨hparent_verts, fun h ↦ ?_⟩ + have hf_par : T.Reaches (T.parent f) f := ⟨hf_verts, 1, rfl⟩ + have heq := reaches_antisymm T h.2 hf_par + exact not_iterate_succ_eq_self T hf_verts hf_ne_root 0 heq.symm + have hins_f : insert f (T.subtreeAt f) = T.subtreeAt f := Finset.insert_eq_of_mem hf_sub + have hins_r : insert T.root (T.rootSide f) = T.rootSide f := Finset.insert_eq_of_mem hroot_side + ext v + change (v ∈ ⋃ t ∈ insert f (T.subtreeAt f), (τ t).vertexSet) ∧ + (v ∈ ⋃ s ∈ insert T.root (T.rootSide f), (τ s).vertexSet) ↔ + v ∈ (τ f).vertexSet ∧ v ∈ (τ (T.parent f)).vertexSet + rw [hins_f, hins_r, Set.mem_iUnion₂, Set.mem_iUnion₂] + constructor + · rintro ⟨⟨t, ht, hvt⟩, ⟨s, hs, hvs⟩⟩ + have ht_verts : t ∈ T.verts := by + unfold RootedTree.subtreeAt at ht + exact (Finset.mem_filter.1 ht).1 + have hs_verts : s ∈ T.verts := by + unfold RootedTree.rootSide at hs + exact (Finset.mem_sdiff.1 hs).1 + have ⟨hon_f, hon_p⟩ := onPath_subtreeAt_rootSide T hf ht hs + have hvf : v ∈ (τ f).vertexSet := + (hD.inter_le t ht_verts f hf_verts s hs_verts hon_f).vertexSet_subset ⟨hvt, hvs⟩ + have hvp : v ∈ (τ (T.parent f)).vertexSet := + (hD.inter_le t ht_verts (T.parent f) hparent_verts s hs_verts hon_p).vertexSet_subset ⟨hvt, + hvs⟩ + exact ⟨hvf, hvp⟩ + · rintro ⟨hvf, hvp⟩ + exact ⟨⟨f, hf_sub, hvf⟩, ⟨T.parent f, hparent_side, hvp⟩⟩ + +/-- For any tree-decomposition `(T, τ)` of `G` and any edge `f ∈ T.edges`, the order of `f` is +`|V(τ(f)) ∩ V(τ(parent f))|`. -/ +theorem edgeOrder_eq_ncard_inter {α β : Type*} {G : RootedHypergraph α β} + {τ : ι → RootedHypergraph α β} (hD : IsTreeDecomposition G T τ) + {f : ι} (hf : f ∈ T.edges) : + edgeOrder T τ f = ((τ f).vertexSet ∩ (τ (T.parent f)).vertexSet).ncard := by + unfold edgeOrder Hypergraph.separationOrder + rw [cross_subtreeAt_inter_rootSide_vertexSet T hD hf] + +/-! ## Underlying `SimpleGraph` of a `RootedTree` -/ + +/-- The underlying undirected simple graph of a `RootedTree` on the subtype `T.verts`. -/ +def toSimpleGraph : SimpleGraph T.verts where + Adj u v := (u.1 ≠ T.root ∧ T.parent u.1 = v.1) ∨ (v.1 ≠ T.root ∧ T.parent v.1 = u.1) + symm := ⟨fun _ _ h ↦ h.symm⟩ + loopless := ⟨fun u h ↦ by + rcases h with ⟨hne, heq⟩ | ⟨hne, heq⟩ <;> + exact not_iterate_succ_eq_self T u.2 hne 0 heq⟩ + +/-- The root of `T` as an element of `T.verts`. -/ +def rootVert : T.verts := ⟨T.root, T.root_mem⟩ + +/-- The parent of `v : T.verts` as an element of `T.verts`. -/ +def parentVert (v : T.verts) : T.verts := ⟨T.parent v.1, T.parent_mem v.1 v.2⟩ + +/-- The distance of `v : T.verts` to the root: the smallest `n` with `T.parent^[n] v.1 = T.root`. -/ +noncomputable def depth (v : T.verts) : ℕ := + open Classical in + Nat.find (T.exists_iterate_eq_root v.1 v.2) + +theorem iterate_parent_depth (v : T.verts) : + T.parent^[depth T v] v.1 = T.root := by + classical + exact Nat.find_spec (T.exists_iterate_eq_root v.1 v.2) + +theorem depth_le_of_iterate_eq_root {v : T.verts} {n : ℕ} (h : T.parent^[n] v.1 = T.root) : + depth T v ≤ n := by + classical + exact Nat.find_min' (T.exists_iterate_eq_root v.1 v.2) h + +theorem depth_eq_zero_iff (v : T.verts) : depth T v = 0 ↔ v = rootVert T := by + constructor + · intro h0 + ext + have h := iterate_parent_depth T v + rw [h0] at h + exact h + · rintro rfl + exact Nat.le_zero.1 (depth_le_of_iterate_eq_root T (n := 0) rfl) + +theorem depth_parentVert (v : T.verts) (hne : v.1 ≠ T.root) : + depth T (parentVert T v) + 1 = depth T v := by + have hpos : 0 < depth T v := by + by_contra h0 + have := (depth_eq_zero_iff T v).1 (Nat.le_zero.1 (not_lt.1 h0)) + exact hne (congrArg Subtype.val this) + apply le_antisymm + · have h1 : T.parent^[depth T v - 1] (parentVert T v).1 = T.root := by + change T.parent^[depth T v - 1] (T.parent v.1) = T.root + rw [← Function.iterate_succ_apply] + have hsub : (depth T v - 1).succ = depth T v := Nat.sub_add_cancel hpos + rw [hsub] + exact iterate_parent_depth T v + have hle := depth_le_of_iterate_eq_root T h1 + omega + · have h2 : T.parent^[depth T (parentVert T v) + 1] v.1 = T.root := by + rw [Function.iterate_succ_apply] + exact iterate_parent_depth T (parentVert T v) + exact depth_le_of_iterate_eq_root T h2 + +theorem adj_parentVert {v : T.verts} (hne : v.1 ≠ T.root) : + (toSimpleGraph T).Adj v (parentVert T v) := + Or.inl ⟨hne, rfl⟩ + +theorem toSimpleGraph_adj_iff_parentVert {u v : T.verts} : + (toSimpleGraph T).Adj u v ↔ + (u.1 ≠ T.root ∧ v = parentVert T u ∧ depth T v + 1 = depth T u) ∨ + (v.1 ≠ T.root ∧ u = parentVert T v ∧ depth T u + 1 = depth T v) := by + constructor + · rintro (⟨hne, heq⟩ | ⟨hne, heq⟩) + · have hv : v = parentVert T u := Subtype.ext heq.symm + subst hv + exact Or.inl ⟨hne, rfl, depth_parentVert T u hne⟩ + · have hu : u = parentVert T v := Subtype.ext heq.symm + subst hu + exact Or.inr ⟨hne, rfl, depth_parentVert T v hne⟩ + · rintro (⟨hne, rfl, _⟩ | ⟨hne, rfl, _⟩) + · exact Or.inl ⟨hne, rfl⟩ + · exact Or.inr ⟨hne, rfl⟩ + +/-- Auxiliary walk in `toSimpleGraph T` from `v` (with `depth T v ≤ n`) to `rootVert T`. -/ +noncomputable def walkToRootAux : ∀ (n : ℕ) (v : T.verts), depth T v ≤ n → + (toSimpleGraph T).Walk v (rootVert T) + | 0, v, hn => Walk.nil.copy rfl ((depth_eq_zero_iff T v).1 (Nat.le_zero.1 hn)) + | n + 1, v, hn => + open Classical in + if hv : v.1 = T.root then + Walk.nil.copy rfl (Subtype.ext hv) + else + Walk.cons (adj_parentVert T hv) + (walkToRootAux n (parentVert T v) (by have := depth_parentVert T v hv; omega)) + +/-- Canonical walk in `toSimpleGraph T` from `v` to `rootVert T`. -/ +noncomputable def walkToRoot (v : T.verts) : (toSimpleGraph T).Walk v (rootVert T) := + walkToRootAux T (depth T v) v le_rfl + +theorem mem_walkToRootAux_support_iff (n : ℕ) (v : T.verts) (hn : depth T v ≤ n) (w : T.verts) : + w ∈ (walkToRootAux T n v hn).support ↔ T.Reaches w.1 v.1 := by + classical + induction n generalizing v with + | zero => + have hv : v = rootVert T := (depth_eq_zero_iff T v).1 (Nat.le_zero.1 hn) + dsimp [walkToRootAux] + rw [Walk.support_copy, Walk.support_nil, List.mem_singleton] + constructor + · rintro rfl + exact reaches_refl T w.2 + · intro h + have hv_val : v.1 = T.root := congrArg Subtype.val hv + rw [hv_val, reaches_root_iff T] at h + exact Subtype.ext (h.trans hv_val.symm) + | succ n ih => + dsimp [walkToRootAux] + split_ifs with hv + · rw [Walk.support_copy, Walk.support_nil, List.mem_singleton] + constructor + · rintro rfl + exact reaches_refl T w.2 + · intro h + rw [hv, reaches_root_iff T] at h + exact Subtype.ext (h.trans hv.symm) + · rw [Walk.support_cons, List.mem_cons, ih (parentVert T v)] + constructor + · rintro (rfl | ⟨_, k, hk⟩) + · exact reaches_refl T w.2 + · exact ⟨v.2, k + 1, by rw [Function.iterate_succ_apply]; exact hk⟩ + · rintro ⟨_, k, hk⟩ + rcases k with _ | k + · exact Or.inl (Subtype.ext hk.symm) + · exact Or.inr ⟨(parentVert T v).2, k, by rw [Function.iterate_succ_apply] at hk; exact hk⟩ + +theorem mem_walkToRoot_support_iff (v w : T.verts) : + w ∈ (walkToRoot T v).support ↔ T.Reaches w.1 v.1 := + mem_walkToRootAux_support_iff T (depth T v) v le_rfl w + +theorem walkToRootAux_isPath (n : ℕ) (v : T.verts) (hn : depth T v ≤ n) : + (walkToRootAux T n v hn).IsPath := by + classical + induction n generalizing v with + | zero => + dsimp [walkToRootAux] + rw [Walk.isPath_copy] + exact Walk.IsPath.nil + | succ n ih => + dsimp [walkToRootAux] + split_ifs with hv + · rw [Walk.isPath_copy] + exact Walk.IsPath.nil + · rw [Walk.cons_isPath_iff] + refine ⟨ih (parentVert T v) _, ?_⟩ + rw [mem_walkToRootAux_support_iff T] + intro hreach + have h1 : T.Reaches (T.parent v.1) v.1 := ⟨v.2, 1, rfl⟩ + have heq := reaches_antisymm T hreach h1 + exact not_iterate_succ_eq_self T v.2 hv 0 heq.symm + +theorem walkToRoot_isPath (v : T.verts) : (walkToRoot T v).IsPath := + walkToRootAux_isPath T (depth T v) v le_rfl + +/-- Along any walk `Walk.cons hadj r` with `Nodup` support where the first step increases `depth`, +every subsequent step also increases `depth`. -/ +private theorem depth_lt_of_cons_nodup {u x v : T.verts} + (hadj : (toSimpleGraph T).Adj u x) (r : (toSimpleGraph T).Walk x v) + (hnodup : (Walk.cons hadj r).support.Nodup) (hlt : depth T u < depth T x) : + depth T u < depth T v := by + induction r generalizing u with + | nil => exact hlt + | @cons x y v hadj₂ r' ih => + have hu_parent : u = parentVert T x := by + rcases (toSimpleGraph_adj_iff_parentVert T).1 hadj with ⟨_, _, h⟩ | ⟨_, heq, _⟩ + · omega + · exact heq + have huy_ne : u ≠ y := by + rw [Walk.support_cons, Walk.support_cons, List.nodup_cons] at hnodup + intro heq + exact hnodup.1 (by simp [heq]) + have hlt₂ : depth T x < depth T y := by + rcases (toSimpleGraph_adj_iff_parentVert T).1 hadj₂ with ⟨_, heq, _⟩ | ⟨_, _, h⟩ + · exfalso + exact huy_ne (hu_parent.trans heq.symm) + · omega + have hnodup' : (Walk.cons hadj₂ r').support.Nodup := by + rw [Walk.support_cons, List.nodup_cons] at hnodup + exact hnodup.2 + exact lt_trans hlt (ih hadj₂ hnodup' hlt₂) + +theorem toSimpleGraph_isTree : (toSimpleGraph T).IsTree where + connected := + { preconnected := fun u v ↦ (walkToRoot T u).reachable.trans (walkToRoot T v).reachable.symm + nonempty := ⟨rootVert T⟩ } + isAcyclic := by + intro u c hc + have hlen : 3 ≤ c.length := hc.three_le_length + have h_no_up : ∀ {a : T.verts} (w : (toSimpleGraph T).Walk a a), + w.IsCycle → ∀ {x : T.verts} (hadj : (toSimpleGraph T).Adj a x) + (r : (toSimpleGraph T).Walk x a), w = Walk.cons hadj r → ¬ depth T a < depth T x := by + intro a w hw x hadj r hw_eq hlt + have hlen_w := hw.three_le_length + rw [hw_eq] at hw hlen_w + have hr_nodup : r.support.Nodup := hw.support_nodup + cases r with + | nil => simp at hlen_w + | @cons x y a hadj₂ r' => + rw [Walk.length_cons, Walk.length_cons] at hlen_w + have hr'_ne : ¬ r'.Nil := by + cases r' with + | nil => simp at hlen_w + | cons _ _ => exact Walk.not_nil_cons + have hay_ne : a ≠ y := by + intro hya + subst hya + rw [Walk.support_cons, List.nodup_cons] at hr_nodup + cases r' with + | nil => exact hr'_ne Walk.Nil.nil + | @cons a z a hadj₃ r'' => + rw [Walk.support_cons, List.nodup_cons] at hr_nodup + exact hr_nodup.2.1 r''.end_mem_support + have ha_parent : a = parentVert T x := by + rcases (toSimpleGraph_adj_iff_parentVert T).1 hadj with ⟨_, _, h⟩ | ⟨_, heq, _⟩ + · omega + · exact heq + have hlt₂ : depth T x < depth T y := by + rcases (toSimpleGraph_adj_iff_parentVert T).1 hadj₂ with ⟨_, heq, _⟩ | ⟨_, _, h⟩ + · exact (hay_ne (ha_parent.trans heq.symm)).elim + · omega + have hlt_xa := depth_lt_of_cons_nodup T hadj₂ r' hr_nodup hlt₂ + omega + cases c with + | nil => simp at hlen + | @cons u x _ hadj r => + rcases (toSimpleGraph_adj_iff_parentVert T).1 hadj with ⟨_, hx_par, hdepth⟩ | ⟨_, _, hdepth⟩ + · -- u -> x goes down, so look at c.reverse + have hrev_cycle : (Walk.cons hadj r).reverse.IsCycle := hc.reverse + have hrev_len : 3 ≤ (Walk.cons hadj r).reverse.length := hrev_cycle.three_le_length + generalize hcr : (Walk.cons hadj r).reverse = cr at hrev_cycle hrev_len + cases cr with + | nil => simp at hrev_len + | @cons u z _ hadj_rev r_rev => + rcases (toSimpleGraph_adj_iff_parentVert T).1 hadj_rev with ⟨_, hz_par, _⟩ | ⟨_, _, + hdepth_z⟩ + · -- Both x and z equal parentVert T u, so first and last edges of c are equal + have hxz : x = z := hx_par.trans hz_par.symm + subst hxz + have hedges : (Walk.cons hadj r).reverse.edges = (Walk.cons hadj_rev r_rev).edges := + congrArg Walk.edges hcr + rw [Walk.edges_reverse, Walk.edges_cons, List.reverse_cons, Walk.edges_cons] at hedges + have hnodup := hc.edges_nodup + rw [Walk.edges_cons, List.nodup_cons] at hnodup + have hlen_r : 0 < r.edges.reverse.length := by + rw [List.length_reverse, Walk.length_edges] + rw [Walk.length_cons] at hlen + omega + cases hrev_list : r.edges.reverse with + | nil => + rw [hrev_list] at hlen_r + exact absurd hlen_r (lt_irrefl 0) + | cons e es => + rw [hrev_list, List.cons_append, List.cons.injEq] at hedges + have he_mem : e ∈ r.edges.reverse := by + rw [hrev_list] + exact List.Mem.head _ + rw [List.mem_reverse, hedges.1] at he_mem + exact hnodup.1 he_mem + · exact h_no_up (Walk.cons hadj_rev r_rev) hrev_cycle hadj_rev r_rev rfl (by omega) + · exact h_no_up (Walk.cons hadj r) hc hadj r rfl (by omega) + +theorem walkToRoot_eq_treePath (v : T.verts) : + walkToRoot T v = treePath (toSimpleGraph_isTree T) v (rootVert T) := + eq_treePath (toSimpleGraph_isTree T) (walkToRoot T v) (walkToRoot_isPath T v) + +theorem onTreePath_toSimpleGraph_rootVert_iff (v w : T.verts) : + OnTreePath (toSimpleGraph T) v (rootVert T) w ↔ T.Reaches w.1 v.1 := by + rw [onTreePath_iff_mem_treePath (toSimpleGraph_isTree T), ← walkToRoot_eq_treePath T, + mem_walkToRoot_support_iff T] + +theorem onTreePath_imp_onPath {t₁ t₂ t : T.verts} + (ht : OnTreePath (toSimpleGraph T) t₁ t₂ t) : + T.OnPath t₁.1 t₂.1 t.1 := by + have hK := toSimpleGraph_isTree T + refine ⟨?_, ?_⟩ + · rcases onTreePath_left_or_right hK (rootVert T) ht with h1 | h2 + · exact Or.inl ((onTreePath_toSimpleGraph_rootVert_iff T t₁ t).1 h1) + · exact Or.inr ((onTreePath_toSimpleGraph_rootVert_iff T t₂ t).1 (onTreePath_symm h2)) + · intro x hx₁ hx₂ + let xv : T.verts := ⟨x, reaches_mem_left T hx₁⟩ + have hx₁' : OnTreePath (toSimpleGraph T) t₁ (rootVert T) xv := + (onTreePath_toSimpleGraph_rootVert_iff T t₁ xv).2 hx₁ + have hx₂' : OnTreePath (toSimpleGraph T) t₂ (rootVert T) xv := + (onTreePath_toSimpleGraph_rootVert_iff T t₂ xv).2 hx₂ + rcases onTreePath_left_or_right hK t hx₁' with h1 | h1 + · rcases onTreePath_left_or_right hK t hx₂' with h2 | h2 + · have hxv_t : xv = t := + onTreePath_inter_eq_of_onTreePath hK ht h1 (onTreePath_symm h2) + have hxv_val : x = t.1 := congrArg Subtype.val hxv_t + rw [hxv_val] + exact reaches_refl T t.2 + · exact (onTreePath_toSimpleGraph_rootVert_iff T t xv).1 h2 + · exact (onTreePath_toSimpleGraph_rootVert_iff T t xv).1 h1 + +theorem exists_common_reaches_onTreePath (t₁ t₂ : T.verts) : + ∃ x : T.verts, OnTreePath (toSimpleGraph T) t₁ t₂ x ∧ + T.Reaches x.1 t₁.1 ∧ T.Reaches x.1 t₂.1 := by + have hK := toSimpleGraph_isTree T + by_cases ht₂ : T.Reaches t₂.1 t₁.1 + · exact ⟨t₂, onTreePath_right _ t₁ t₂, ht₂, reaches_refl T t₂.2⟩ + · obtain ⟨x, y, he, hx_r, hy_not_r⟩ := + exists_onTreePathEdge_of_prop hK (fun s : T.verts ↦ T.Reaches s.1 t₁.1) + (reaches_refl T t₁.2) ht₂ + have hx_par_y : x = parentVert T y := by + rcases (toSimpleGraph_adj_iff_parentVert T).1 he.1 with ⟨_, hy_par, _⟩ | ⟨_, hx_par, _⟩ + · exfalso + have hyx : T.Reaches y.1 x.1 := ⟨x.2, 1, (congrArg Subtype.val hy_par).symm⟩ + exact hy_not_r (reaches_trans T hyx hx_r) + · exact hx_par + have hxy : T.Reaches x.1 y.1 := ⟨y.2, 1, (congrArg Subtype.val hx_par_y).symm⟩ + have hy_on : T.OnPath t₁.1 t₂.1 y.1 := onTreePath_imp_onPath T he.onTreePath_right + rcases hy_on.1 with hyt₁ | hyt₂ + · exact (hy_not_r hyt₁).elim + · exact ⟨x, he.onTreePath_left, hx_r, reaches_trans T hxy hyt₂⟩ + +theorem onTreePath_toSimpleGraph_iff (t₁ t₂ t : T.verts) : + OnTreePath (toSimpleGraph T) t₁ t₂ t ↔ T.OnPath t₁.1 t₂.1 t.1 := by + have hK := toSimpleGraph_isTree T + refine ⟨onTreePath_imp_onPath T, fun ht ↦ ?_⟩ + obtain ⟨x, hx_path, hx₁, hx₂⟩ := exists_common_reaches_onTreePath T t₁ t₂ + have hxt : OnTreePath (toSimpleGraph T) t (rootVert T) x := + (onTreePath_toSimpleGraph_rootVert_iff T t x).2 (ht.2 x.1 hx₁ hx₂) + rcases ht.1 with ht₁ | ht₂ + · have ht₁' : OnTreePath (toSimpleGraph T) t₁ (rootVert T) t := + (onTreePath_toSimpleGraph_rootVert_iff T t₁ t).2 ht₁ + rcases onTreePath_left_or_right hK x ht₁' with h1 | h2 + · exact onTreePath_trans_left hK hx_path h1 + · have htx : t = x := + onTreePath_antisymm hK (onTreePath_symm h2) (onTreePath_symm hxt) + exact htx ▸ hx_path + · have ht₂' : OnTreePath (toSimpleGraph T) t₂ (rootVert T) t := + (onTreePath_toSimpleGraph_rootVert_iff T t₂ t).2 ht₂ + rcases onTreePath_left_or_right hK x ht₂' with h1 | h2 + · exact onTreePath_symm (onTreePath_trans_left hK (onTreePath_symm hx_path) h1) + · have htx : t = x := + onTreePath_antisymm hK (onTreePath_symm h2) (onTreePath_symm hxt) + exact htx ▸ hx_path + +theorem exists_onPathEdge_of_onTreePathEdge {t₁ t₂ s s' : T.verts} + (he : OnTreePathEdge (toSimpleGraph T) t₁ t₂ s s') : + ∃ f : T.verts, f.1 ∈ T.edges ∧ T.OnPathEdge t₁.1 t₂.1 f.1 ∧ + (s = f ∧ s' = parentVert T f ∨ s' = f ∧ s = parentVert T f) := by + have hs_on : T.OnPath t₁.1 t₂.1 s.1 := + (onTreePath_toSimpleGraph_iff T t₁ t₂ s).1 he.onTreePath_left + have hs'_on : T.OnPath t₁.1 t₂.1 s'.1 := + (onTreePath_toSimpleGraph_iff T t₁ t₂ s').1 he.onTreePath_right + rcases (toSimpleGraph_adj_iff_parentVert T).1 he.1 with ⟨hne, hs', _⟩ | ⟨hne, hs, _⟩ + · refine ⟨s, (mem_edges_iff T).2 ⟨s.2, hne⟩, ⟨(mem_edges_iff T).2 ⟨s.2, hne⟩, hs_on, ?_⟩, + Or.inl ⟨rfl, hs'⟩⟩ + have hps : T.parent s.1 = s'.1 := (congrArg Subtype.val hs').symm + rwa [hps] + · refine ⟨s', (mem_edges_iff T).2 ⟨s'.2, hne⟩, ⟨(mem_edges_iff T).2 ⟨s'.2, hne⟩, hs'_on, ?_⟩, + Or.inr ⟨rfl, hs⟩⟩ + have hps' : T.parent s'.1 = s.1 := (congrArg Subtype.val hs).symm + rwa [hps'] + +end RootedTreeProps + +/-! ## Constructing a `RootedTree ℕ` from an undirected tree on `Fin m` -/ + +section FromIsTree + +variable {m : ℕ} {K : SimpleGraph (Fin m)} + +theorem pos_of_isTree (hK : K.IsTree) : 0 < m := by + obtain ⟨x⟩ := hK.connected.nonempty + exact x.pos + +/-- The chosen root `⟨0, hm⟩ : Fin m` of an undirected tree on `Fin m`. -/ +def treeRootFin (hK : K.IsTree) : Fin m := + ⟨0, pos_of_isTree hK⟩ + +/-- The parent of `u : Fin m` in `(K, hK)` with respect to `treeRootFin hK`: the second vertex on +the unique path from `u` to the root (and the root itself if `u` is the root). -/ +noncomputable def parentFin (hK : K.IsTree) (u : Fin m) : Fin m := + if u = treeRootFin hK then treeRootFin hK + else (treePath hK u (treeRootFin hK)).getVert 1 + +theorem treePath_eq_cons_parentFin (hK : K.IsTree) {u : Fin m} (hu : u ≠ treeRootFin hK) : + ∃ (hadj : K.Adj u (parentFin hK u)), + treePath hK u (treeRootFin hK) = + Walk.cons hadj (treePath hK (parentFin hK u) (treeRootFin hK)) := by + generalize hp : treePath hK u (treeRootFin hK) = p + cases p with + | nil => exact (hu rfl).elim + | @cons _ v _ hadj q => + have hpar : parentFin hK u = v := by + unfold parentFin + rw [ite_eq_right hu, hp, Walk.getVert_cons_succ, Walk.getVert_zero] + subst hpar + refine ⟨hadj, ?_⟩ + have hpath : (Walk.cons hadj q).IsPath := hp ▸ treePath_isPath hK u (treeRootFin hK) + have hq_path : q.IsPath := hpath.of_cons + rw [eq_treePath hK q hq_path] + +theorem treeDist_parentFin (hK : K.IsTree) {u : Fin m} (hu : u ≠ treeRootFin hK) : + treeDist hK (parentFin hK u) (treeRootFin hK) + 1 = treeDist hK u (treeRootFin hK) := by + obtain ⟨hadj, heq⟩ := treePath_eq_cons_parentFin hK hu + unfold treeDist + rw [heq, Walk.length_cons] + +theorem iterate_parentFin_treeDist (hK : K.IsTree) (u : Fin m) : + (parentFin hK)^[treeDist hK u (treeRootFin hK)] u = treeRootFin hK := by + generalize hd : treeDist hK u (treeRootFin hK) = d + induction d generalizing u with + | zero => + by_contra hne + exact absurd hd (ne_of_gt (treeDist_pos_of_ne hK hne)) + | succ d ih => + have hu : u ≠ treeRootFin hK := by + rintro rfl + rw [treeDist_self] at hd + exact Nat.noConfusion hd + have hpar_d : treeDist hK (parentFin hK u) (treeRootFin hK) = d := by + have := treeDist_parentFin hK hu + omega + rw [Function.iterate_succ_apply] + exact ih (parentFin hK u) hpar_d + +private theorem parentFin_eq_of_not_onTreePath (hK : K.IsTree) {u v : Fin m} + (hadj : K.Adj u v) (hnot : ¬ OnTreePath K v (treeRootFin hK) u) : + u ≠ treeRootFin hK ∧ parentFin hK u = v := by + have hu_not_supp : u ∉ (treePath hK v (treeRootFin hK)).support := by + rwa [← onTreePath_iff_mem_treePath hK] + have hpath : (Walk.cons hadj (treePath hK v (treeRootFin hK))).IsPath := by + rw [Walk.cons_isPath_iff] + exact ⟨treePath_isPath hK v (treeRootFin hK), hu_not_supp⟩ + have heq := eq_treePath hK _ hpath + have hu_ne : u ≠ treeRootFin hK := by + rintro rfl + exact hnot (onTreePath_right K v (treeRootFin hK)) + refine ⟨hu_ne, ?_⟩ + unfold parentFin + rw [ite_eq_right hu_ne, ← heq, Walk.getVert_cons_succ, Walk.getVert_zero] + +theorem adj_iff_parentFin (hK : K.IsTree) (u v : Fin m) : + K.Adj u v ↔ + (u ≠ treeRootFin hK ∧ parentFin hK u = v) ∨ + (v ≠ treeRootFin hK ∧ parentFin hK v = u) := by + constructor + · intro hadj + by_cases hnot : ¬ OnTreePath K v (treeRootFin hK) u + · exact Or.inl (parentFin_eq_of_not_onTreePath hK hadj hnot) + · push Not at hnot + have hnot' : ¬ OnTreePath K u (treeRootFin hK) v := by + intro hv + exact hadj.ne (onTreePath_antisymm hK (onTreePath_symm hnot) (onTreePath_symm hv)) + exact Or.inr (parentFin_eq_of_not_onTreePath hK hadj.symm hnot') + · rintro (⟨hu, rfl⟩ | ⟨hv, rfl⟩) + · obtain ⟨hadj, _⟩ := treePath_eq_cons_parentFin hK hu + exact hadj + · obtain ⟨hadj, _⟩ := treePath_eq_cons_parentFin hK hv + exact hadj.symm + +/-- Construct a `RootedTree ℕ` on `Finset.range m` from an undirected tree `K` on `Fin m`. -/ +noncomputable def rootedTreeOfIsTree (hK : K.IsTree) : RootedTree ℕ where + verts := Finset.range m + root := 0 + parent n := if hn : n < m then (parentFin hK ⟨n, hn⟩).val else 0 + root_mem := Finset.mem_range.2 (pos_of_isTree hK) + parent_mem n hn := by + rw [Finset.mem_range] at hn ⊢ + rw [dite_eq_left hn] + exact (parentFin hK ⟨n, hn⟩).isLt + parent_root := by + have hm := pos_of_isTree hK + rw [dite_eq_left hm] + unfold parentFin treeRootFin + rw [ite_eq_left rfl] + exists_iterate_eq_root n hn := by + rw [Finset.mem_range] at hn + have hit : ∀ (k : ℕ) (u : Fin m), + ((fun x : ℕ ↦ if hx : x < m then (parentFin hK ⟨x, hx⟩).val else 0)^[k] u.val) = + ((parentFin hK)^[k] u).val := by + intro k + induction k with + | zero => intro _; rfl + | succ k ih => + intro u + rw [Function.iterate_succ_apply, Function.iterate_succ_apply] + rw [dite_eq_left u.isLt] + exact ih (parentFin hK u) + refine ⟨treeDist hK ⟨n, hn⟩ (treeRootFin hK), ?_⟩ + rw [hit _ ⟨n, hn⟩, iterate_parentFin_treeDist hK ⟨n, hn⟩] + rfl + +/-- Canonical equivalence `(rootedTreeOfIsTree hK).verts ≃ Fin m`. -/ +abbrev equivFinOfIsTree (hK : K.IsTree) : (rootedTreeOfIsTree hK).verts ≃ Fin m where + toFun u := ⟨u.1, Finset.mem_range.1 u.2⟩ + invFun i := ⟨i.val, Finset.mem_range.2 i.isLt⟩ + left_inv _ := Subtype.ext rfl + right_inv _ := Fin.ext rfl + +theorem toSimpleGraph_rootedTreeOfIsTree_adj_iff (hK : K.IsTree) + (u v : (rootedTreeOfIsTree hK).verts) : + (toSimpleGraph (rootedTreeOfIsTree hK)).Adj u v ↔ + K.Adj (equivFinOfIsTree hK u) (equivFinOfIsTree hK v) := by + rw [adj_iff_parentFin hK] + unfold toSimpleGraph rootedTreeOfIsTree treeRootFin equivFinOfIsTree + have hu : u.1 < m := Finset.mem_range.1 u.2 + have hv : v.1 < m := Finset.mem_range.1 v.2 + change ((u.1 ≠ 0 ∧ (if hn : u.1 < m then (parentFin hK ⟨u.1, hn⟩).val else 0) = v.1) ∨ + (v.1 ≠ 0 ∧ (if hn : v.1 < m then (parentFin hK ⟨v.1, hn⟩).val else 0) = u.1)) ↔ + ((⟨u.1, hu⟩ : Fin m) ≠ ⟨0, pos_of_isTree hK⟩ ∧ parentFin hK ⟨u.1, hu⟩ = ⟨v.1, hv⟩) ∨ + ((⟨v.1, hv⟩ : Fin m) ≠ ⟨0, pos_of_isTree hK⟩ ∧ parentFin hK ⟨v.1, hv⟩ = ⟨u.1, hu⟩) + rw [dite_eq_left hu, dite_eq_left hv] + simp only [Fin.ext_iff, ne_eq] + +/-- Graph homomorphism `toSimpleGraph (rootedTreeOfIsTree hK) →g K`. -/ +abbrev homOfIsTree (hK : K.IsTree) : toSimpleGraph (rootedTreeOfIsTree hK) →g K where + toFun u := equivFinOfIsTree hK u + map_rel' h := (toSimpleGraph_rootedTreeOfIsTree_adj_iff hK _ _).1 h + +theorem onTreePath_of_isTree_iff (hK : K.IsTree) (u v w : (rootedTreeOfIsTree hK).verts) : + OnTreePath K (equivFinOfIsTree hK u) (equivFinOfIsTree hK v) (equivFinOfIsTree hK w) ↔ + OnTreePath (toSimpleGraph (rootedTreeOfIsTree hK)) u v w := by + have hp : ((treePath (toSimpleGraph_isTree (rootedTreeOfIsTree hK)) u v).map + (homOfIsTree hK)).IsPath := + (treePath_isPath (toSimpleGraph_isTree (rootedTreeOfIsTree hK)) u v).map + (equivFinOfIsTree hK).injective + have heq : ((treePath (toSimpleGraph_isTree (rootedTreeOfIsTree hK)) u v).map + (homOfIsTree hK)) = treePath hK (equivFinOfIsTree hK u) (equivFinOfIsTree hK v) := + eq_treePath hK _ hp + rw [onTreePath_iff_mem_treePath hK, ← heq, + onTreePath_iff_mem_treePath (toSimpleGraph_isTree (rootedTreeOfIsTree hK)), + Walk.support_map, List.mem_map] + constructor + · rintro ⟨z, hz, hzw⟩ + have hzw' : z = w := (equivFinOfIsTree hK).injective hzw + exact hzw' ▸ hz + · intro hw + exact ⟨w, hw, rfl⟩ + +theorem onPath_rootedTreeOfIsTree_iff (hK : K.IsTree) (u v w : (rootedTreeOfIsTree hK).verts) : + (rootedTreeOfIsTree hK).OnPath u.1 v.1 w.1 ↔ + OnTreePath K (equivFinOfIsTree hK u) (equivFinOfIsTree hK v) (equivFinOfIsTree hK w) := by + rw [← onTreePath_toSimpleGraph_iff (rootedTreeOfIsTree hK), onTreePath_of_isTree_iff] + +theorem onTreePathEdge_of_isTree_imp (hK : K.IsTree) + {u v s s' : (rootedTreeOfIsTree hK).verts} + (he : OnTreePathEdge K (equivFinOfIsTree hK u) (equivFinOfIsTree hK v) + (equivFinOfIsTree hK s) (equivFinOfIsTree hK s')) : + OnTreePathEdge (toSimpleGraph (rootedTreeOfIsTree hK)) u v s s' := by + have hp : ((treePath (toSimpleGraph_isTree (rootedTreeOfIsTree hK)) u v).map + (homOfIsTree hK)).IsPath := + (treePath_isPath (toSimpleGraph_isTree (rootedTreeOfIsTree hK)) u v).map + (equivFinOfIsTree hK).injective + have heq : ((treePath (toSimpleGraph_isTree (rootedTreeOfIsTree hK)) u v).map + (homOfIsTree hK)) = treePath hK (equivFinOfIsTree hK u) (equivFinOfIsTree hK v) := + eq_treePath hK _ hp + rw [onTreePathEdge_iff_mem_treePath hK, ← heq] at he + rw [onTreePathEdge_iff_mem_treePath (toSimpleGraph_isTree (rootedTreeOfIsTree hK))] + refine ⟨(toSimpleGraph_rootedTreeOfIsTree_adj_iff hK s s').2 he.1, ?_⟩ + have hedges := he.2 + rw [Walk.edges_map, List.mem_map] at hedges + obtain ⟨e, he_mem, he_eq⟩ := hedges + have hmap_inj : Function.Injective (Sym2.map (homOfIsTree hK)) := + Sym2.map.injective (equivFinOfIsTree hK).injective + have he_ss' : e = s(s, s') := hmap_inj he_eq + exact he_ss' ▸ he_mem + +end FromIsTree + +end + +end GraphMinor.Thomas diff --git a/LeanPool/GraphMinor/Thomas/Separator.lean b/LeanPool/GraphMinor/Thomas/Separator.lean new file mode 100644 index 0000000000..c200b76fa4 --- /dev/null +++ b/LeanPool/GraphMinor/Thomas/Separator.lean @@ -0,0 +1,581 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +import LeanPool.GraphMinor.Menger.Basic + +public import LeanPool.GraphMinor.Thomas.Amalgamate + +/-! +# Vertex separators, Menger's theorem on the 1-skeleton, and reindexing decompositions + +This file provides the graph-theoretic separator infrastructure used in the proof of Theorem 3 of +P. Bellenbaum and R. Diestel, *Two short proofs concerning tree-decompositions*, Combin. Probab. +Comput. 11 (2002) 541–547 (Section 3, pages 3–5): + +- Reindexing a `TreeDecomp` along an equivalence `ι ≃ ι'` (`TreeDecomp.reindex`). +- Vertex separators `Separates K V₀ Z₁ Z₂ X` in a simple graph `K` on vertex set `V₀`, and the + partition of `V₀ \ X` into `sepCompLeft K V₀ X Z₁` (`C₁`, the union of components of `G - X` + meeting `Z₁`) and `sepCompRight K V₀ X Z₁` (`C₂`, the union of the remaining components). +- Equivalence between hypergraph separations `G.IsSeparation G₁ G₂` and vertex separators of + `G.skeleton`, deducing the vertex-separator form of Menger's theorem from `MengerStatement`. +- Splitting the Menger paths `{P_x | x ∈ X}` of a minimum-order `Z₁`–`Z₂` separator `X` at each + `x ∈ X` into disjoint `X`–`Z₂` paths `P_x^1` in `G - C₁` and disjoint `X`–`Z₁` paths `P_x^2` in + `G - C₂`. +-/ + +@[expose] public section + +namespace GraphMinor.Thomas + +open SimpleGraph + +universe u v + +variable {α : Type u} {β : Type v} {ι ι' : Type*} + +namespace TreeDecomp + +variable [Fintype ι] [Fintype ι'] {G : SimpleGraph α} {V₀ : Set α} (D : TreeDecomp G V₀ ι) + +/-- Reindex a tree-decomposition along a bijection `e : ι ≃ ι'`. -/ +def reindex (e : ι ≃ ι') : TreeDecomp G V₀ ι' where + T := D.T.map e.toEmbedding + isTree := (Iso.map e D.T).isTree_iff.1 D.isTree + bag t' := D.bag (e.symm t') + iUnion_bag := by + ext x + simp only [Set.mem_iUnion, ← D.iUnion_bag] + exact ⟨fun ⟨t', ht'⟩ ↦ ⟨e.symm t', ht'⟩, fun ⟨t, ht⟩ ↦ ⟨e t, by simpa using ht⟩⟩ + adj_mem_bag u v hu hv hadj := by + obtain ⟨t, hut, hvt⟩ := D.adj_mem_bag hu hv hadj + exact ⟨e t, by simpa using hut, by simpa using hvt⟩ + inter_subset_bag := by + rintro t₁' t₂' t₃' ht x ⟨h₁, h₃⟩ + have hpath : OnTreePath D.T (e.symm t₁') (e.symm t₃') (e.symm t₂') := by + rw [onTreePath_iff_forall_walk] + intro w + have hu : (Iso.map e D.T).toHom (e.symm t₁') = t₁' := e.apply_symm_apply t₁' + have hv : (Iso.map e D.T).toHom (e.symm t₃') = t₃' := e.apply_symm_apply t₃' + have hmem := onTreePath_iff_forall_walk.1 ht ((w.map (Iso.map e D.T).toHom).copy hu hv) + rw [Walk.support_copy, Walk.support_map, List.mem_map] at hmem + obtain ⟨s, hs, hs_eq⟩ := hmem + have : s = e.symm t₂' := by + apply e.injective + exact hs_eq.trans (e.apply_symm_apply t₂').symm + exact this ▸ hs + exact D.inter_subset_bag hpath ⟨h₁, h₃⟩ + +@[simp] +theorem reindex_bag (e : ι ≃ ι') (t' : ι') : + (D.reindex e).bag t' = D.bag (e.symm t') := + rfl + +theorem reindex_widthLE (e : ι ≃ ι') {w : ℕ} : + (D.reindex e).WidthLE w ↔ D.WidthLE w := by + constructor + · intro h t + simpa using h (e t) + · intro h t' + exact h (e.symm t') + +end TreeDecomp + +/-! ## Vertex separators and component partitions of `G - X` -/ + +/-- `X` separates `Z₁` from `Z₂` in `(K, V₀)`: `X ⊆ V₀` and every walk in `K` (within `V₀`) from +`Z₁` to `Z₂` contains a vertex of `X`. -/ +def Separates (K : SimpleGraph α) (V₀ Z₁ Z₂ X : Set α) : Prop := + X ⊆ V₀ ∧ ∀ ⦃u v : α⦄, u ∈ Z₁ → v ∈ Z₂ → ∀ p : K.Walk u v, + (∀ z ∈ p.support, z ∈ V₀) → ∃ x ∈ p.support, x ∈ X + +theorem separates_symm {K : SimpleGraph α} {V₀ Z₁ Z₂ X : Set α} + (h : Separates K V₀ Z₁ Z₂ X) : Separates K V₀ Z₂ Z₁ X := by + refine ⟨h.1, fun u v hu hv p hp ↦ ?_⟩ + obtain ⟨x, hx, hxX⟩ := h.2 hv hu p.reverse (by simpa using hp) + rw [Walk.support_reverse, List.mem_reverse] at hx + exact ⟨x, hx, hxX⟩ + +theorem ncard_le_of_hasDisjointPaths_of_separates {K : SimpleGraph α} {V₀ Z₁ Z₂ X : Set α} + {k : ℕ} (hV₀ : V₀.Finite) (hZ₁ : Z₁ ⊆ V₀) + (hK : ∀ ⦃u v : α⦄, K.Adj u v → u ∈ V₀ ∧ v ∈ V₀) + (hpaths : HasDisjointPaths K Z₁ Z₂ k) (hsep : Separates K V₀ Z₁ Z₂ X) : + k ≤ X.ncard := by + classical + obtain ⟨P, hP⟩ := hpaths + have hsupp : ∀ (i : Fin k) (z : α), z ∈ (P i).walk.support → z ∈ V₀ := by + intro i z hz + have hwalk : ∀ {u v : α} (w : K.Walk u v), u ∈ V₀ → ∀ z ∈ w.support, z ∈ V₀ := by + intro u v w hu z hz + induction w with + | nil => + simp only [Walk.support_nil, List.mem_singleton] at hz + exact hz ▸ hu + | cons hadj q ih => + simp only [Walk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · exact hu + · exact ih (hK hadj).2 hz + exact hwalk (P i).walk (hZ₁ (P i).first_mem) z hz + have hex : ∀ i : Fin k, ∃ x ∈ (P i).walk.support, x ∈ X := + fun i ↦ hsep.2 (P i).first_mem (P i).last_mem (P i).walk (hsupp i) + let f : Fin k → α := fun i ↦ (hex i).choose + have hf_mem : ∀ i ∈ (Set.univ : Set (Fin k)), f i ∈ X := + fun i _ ↦ (hex i).choose_spec.2 + have hf_inj : Set.InjOn f Set.univ := by + intro i _ j _ hij + by_contra hne + have h1 : f i ∈ (P i).walk.support := (hex i).choose_spec.1 + have h2 : f i ∈ (P j).walk.support := hij ▸ (hex j).choose_spec.1 + exact Set.disjoint_left.1 (hP hne) h1 h2 + have hcard := Set.ncard_le_ncard_of_injOn f hf_mem hf_inj (hV₀.subset hsep.1) + rwa [Set.ncard_univ, Nat.card_eq_fintype_card, Fintype.card_fin] at hcard + +/-- `C₁`: the union of the components of `(K, V₀) - X` that meet `Z₁` (Bellenbaum and Diestel, +proof of Theorem 3, page 3). -/ +def sepCompLeft (K : SimpleGraph α) (V₀ X Z₁ : Set α) : Set α := + {v ∈ V₀ \ X | ∃ u ∈ Z₁ \ X, ∃ p : K.Walk u v, ∀ w ∈ p.support, w ∈ V₀ \ X} + +/-- `C₂`: the union of all the other components of `(K, V₀) - X` (Bellenbaum and Diestel, proof of +Theorem 3, page 3). -/ +def sepCompRight (K : SimpleGraph α) (V₀ X Z₁ : Set α) : Set α := + (V₀ \ X) \ sepCompLeft K V₀ X Z₁ + +theorem sepCompLeft_subset_sdiff (K : SimpleGraph α) (V₀ X Z₁ : Set α) : + sepCompLeft K V₀ X Z₁ ⊆ V₀ \ X := + fun _ h ↦ h.1 + +theorem sepCompRight_subset_sdiff (K : SimpleGraph α) (V₀ X Z₁ : Set α) : + sepCompRight K V₀ X Z₁ ⊆ V₀ \ X := + Set.sdiff_subset + +theorem sepCompLeft_subset (K : SimpleGraph α) (V₀ X Z₁ : Set α) : + sepCompLeft K V₀ X Z₁ ⊆ V₀ := + fun _ h ↦ h.1.1 + +theorem sepCompRight_subset (K : SimpleGraph α) (V₀ X Z₁ : Set α) : + sepCompRight K V₀ X Z₁ ⊆ V₀ := + fun _ h ↦ h.1.1 + +theorem disjoint_sepCompLeft_sepCompRight (K : SimpleGraph α) (V₀ X Z₁ : Set α) : + Disjoint (sepCompLeft K V₀ X Z₁) (sepCompRight K V₀ X Z₁) := + disjoint_sdiff_self_right + +theorem disjoint_sepCompLeft_sep (K : SimpleGraph α) (V₀ X Z₁ : Set α) : + Disjoint (sepCompLeft K V₀ X Z₁) X := + Set.disjoint_left.2 fun _ h ↦ h.1.2 + +theorem disjoint_sepCompRight_sep (K : SimpleGraph α) (V₀ X Z₁ : Set α) : + Disjoint (sepCompRight K V₀ X Z₁) X := + Set.disjoint_left.2 fun _ h ↦ h.1.2 + +theorem subset_sepComp_union (K : SimpleGraph α) {V₀ X : Set α} (Z₁ : Set α) : + V₀ ⊆ sepCompLeft K V₀ X Z₁ ∪ sepCompRight K V₀ X Z₁ ∪ X := by + intro v hv + by_cases hvX : v ∈ X + · exact Or.inr hvX + · by_cases hvC : v ∈ sepCompLeft K V₀ X Z₁ + · exact Or.inl (Or.inl hvC) + · exact Or.inl (Or.inr ⟨⟨hv, hvX⟩, hvC⟩) + +theorem not_adj_sepCompLeft_sepCompRight {K : SimpleGraph α} {V₀ X Z₁ : Set α} + ⦃u v : α⦄ (hu : u ∈ sepCompLeft K V₀ X Z₁) (hv : v ∈ sepCompRight K V₀ X Z₁) : + ¬ K.Adj u v := by + intro hadj + obtain ⟨_, z₁, hz₁, p, hp⟩ := hu + refine hv.2 ⟨hv.1, z₁, hz₁, p.concat hadj, ?_⟩ + intro w hw + rw [Walk.support_concat, List.mem_append, List.mem_singleton] at hw + rcases hw with hw | rfl + · exact hp w hw + · exact hv.1 + +theorem adj_mem_sepComp_or {K : SimpleGraph α} {V₀ X Z₁ : Set α} + ⦃u v : α⦄ (hu : u ∈ V₀) (hv : v ∈ V₀) (hadj : K.Adj u v) : + (u ∈ sepCompLeft K V₀ X Z₁ ∪ X ∧ v ∈ sepCompLeft K V₀ X Z₁ ∪ X) ∨ + (u ∈ sepCompRight K V₀ X Z₁ ∪ X ∧ v ∈ sepCompRight K V₀ X Z₁ ∪ X) := by + rcases subset_sepComp_union K Z₁ hu with (hu1 | hu2) | huX + · rcases subset_sepComp_union K Z₁ hv with (hv1 | hv2) | hvX + · exact Or.inl ⟨Or.inl hu1, Or.inl hv1⟩ + · exact (not_adj_sepCompLeft_sepCompRight hu1 hv2 hadj).elim + · exact Or.inl ⟨Or.inl hu1, Or.inr hvX⟩ + · rcases subset_sepComp_union K Z₁ hv with (hv1 | hv2) | hvX + · exact (not_adj_sepCompLeft_sepCompRight hv1 hu2 hadj.symm).elim + · exact Or.inr ⟨Or.inl hu2, Or.inl hv2⟩ + · exact Or.inr ⟨Or.inl hu2, Or.inr hvX⟩ + · rcases subset_sepComp_union K Z₁ hv with (hv1 | hv2) | hvX + · exact Or.inl ⟨Or.inr huX, Or.inl hv1⟩ + · exact Or.inr ⟨Or.inr huX, Or.inl hv2⟩ + · exact Or.inl ⟨Or.inr huX, Or.inr hvX⟩ + +theorem subset_sepCompLeft_union (K : SimpleGraph α) {V₀ X Z₁ : Set α} (hZ₁ : Z₁ ⊆ V₀) : + Z₁ ⊆ sepCompLeft K V₀ X Z₁ ∪ X := by + intro z hz + by_cases hzX : z ∈ X + · exact Or.inr hzX + · refine Or.inl ⟨⟨hZ₁ hz, hzX⟩, z, ⟨hz, hzX⟩, Walk.nil, ?_⟩ + simp [hZ₁ hz, hzX] + +theorem subset_sepCompRight_union {K : SimpleGraph α} {V₀ X Z₁ Z₂ : Set α} + (hZ₂ : Z₂ ⊆ V₀) (hsep : Separates K V₀ Z₁ Z₂ X) : + Z₂ ⊆ sepCompRight K V₀ X Z₁ ∪ X := by + intro z₂ hz₂ + by_cases hz₂X : z₂ ∈ X + · exact Or.inr hz₂X + · refine Or.inl ⟨⟨hZ₂ hz₂, hz₂X⟩, ?_⟩ + rintro ⟨_, z₁, ⟨hz₁, _⟩, p, hp⟩ + obtain ⟨x, hx, hxX⟩ := hsep.2 hz₁ hz₂ p (fun w hw ↦ (hp w hw).1) + exact (hp x hx).2 hxX + +/-! ## Hypergraph separations and Menger's theorem for vertex separators -/ + +theorem separates_of_isSeparation (G : Hypergraph α β) {G₁ G₂ : Hypergraph α β} + (hsep : G.IsSeparation G₁ G₂) {Z₁ Z₂ : Set α} + (hZ₁ : Z₁ ⊆ G₁.vertexSet) (hZ₂ : Z₂ ⊆ G₂.vertexSet) : + Separates G.skeleton G.vertexSet Z₁ Z₂ (G₁ ∩ G₂).vertexSet := by + refine ⟨fun x hx ↦ hsep.left_le.vertexSet_subset hx.1, ?_⟩ + have hwalk : ∀ {u v : α} (p : G.skeleton.Walk u v), u ∈ G₁.vertexSet → v ∈ G₂.vertexSet → + ∃ x ∈ p.support, x ∈ G₁.vertexSet ∧ x ∈ G₂.vertexSet := by + intro u v p + induction p with + | nil => + intro hu hv + exact ⟨_, Walk.start_mem_support _, hu, hv⟩ + | @cons u w v hadj q ih => + intro hu hv + obtain ⟨_, e, heu, hew⟩ := hadj + have he : e ∈ G₁.edgeSet ∪ G₂.edgeSet := by + have : e ∈ (G₁ ∪ G₂).edgeSet := hsep.union_eq.symm ▸ G.edge_mem_of_inc heu + exact this + rcases he with he₁ | he₂ + · have hw₁ : w ∈ G₁.vertexSet := by + have : w ∈ G₁.ends e := (hsep.left_le.ends_eq e he₁) ▸ hew + exact G₁.vertex_mem_of_inc this + obtain ⟨x, hx, hx1, hx2⟩ := ih hw₁ hv + exact ⟨x, List.mem_cons_of_mem _ hx, hx1, hx2⟩ + · have hu₂ : u ∈ G₂.vertexSet := by + have : u ∈ G₂.ends e := (hsep.right_le.ends_eq e he₂) ▸ heu + exact G₂.vertex_mem_of_inc this + exact ⟨u, List.Mem.head _, hu, hu₂⟩ + intro u v hu hv p _ + exact hwalk p (hZ₁ hu) (hZ₂ hv) + +theorem exists_isSeparation_of_separates (G : Hypergraph α β) {Z₁ Z₂ X : Set α} + (hZ₁ : Z₁ ⊆ G.vertexSet) (hZ₂ : Z₂ ⊆ G.vertexSet) + (hsep : Separates G.skeleton G.vertexSet Z₁ Z₂ X) : + ∃ G₁ G₂ : Hypergraph α β, + G.IsSeparation G₁ G₂ ∧ Z₁ ⊆ G₁.vertexSet ∧ Z₂ ⊆ G₂.vertexSet ∧ + Hypergraph.separationOrder G₁ G₂ = X.ncard := by + let C₁ := sepCompLeft G.skeleton G.vertexSet X Z₁ + let C₂ := sepCompRight G.skeleton G.vertexSet X Z₁ + have hC₁ : C₁ ⊆ G.vertexSet := sepCompLeft_subset _ _ _ _ + have hC₂ : C₂ ⊆ G.vertexSet := sepCompRight_subset _ _ _ _ + have hX : X ⊆ G.vertexSet := hsep.1 + have hE₂ : ∀ e ∈ G.edgeSet, ¬ (G.ends e ⊆ C₁ ∪ X) → G.ends e ⊆ C₂ ∪ X := by + intro e he hnot v hv + have hvV : v ∈ G.vertexSet := G.vertex_mem_of_inc hv + obtain ⟨u, hu, hunot⟩ := Set.not_subset.1 hnot + have huV : u ∈ G.vertexSet := G.vertex_mem_of_inc hu + have huC₂ : u ∈ C₂ := by + rcases subset_sepComp_union G.skeleton Z₁ huV with (hu1 | hu2) | huX + · exact (hunot (Or.inl hu1)).elim + · exact hu2 + · exact (hunot (Or.inr huX)).elim + by_cases huv : u = v + · exact Or.inl (huv ▸ huC₂) + · have hadj : G.skeleton.Adj u v := ⟨huv, e, hu, hv⟩ + rcases subset_sepComp_union G.skeleton Z₁ hvV with (hv1 | hv2) | hvX + · exact (not_adj_sepCompLeft_sepCompRight hv1 huC₂ hadj.symm).elim + · exact Or.inl hv2 + · exact Or.inr hvX + let E₁ : Set β := {e ∈ G.edgeSet | G.ends e ⊆ C₁ ∪ X} + let G₁ : Hypergraph α β := + { vertexSet := C₁ ∪ X + edgeSet := E₁ + Inc := fun e v ↦ e ∈ E₁ ∧ G.Inc e v + vertex_mem_of_inc := fun e v ⟨he, hv⟩ ↦ he.2 hv + edge_mem_of_inc := fun _ _ h ↦ h.1 + vertexSet_finite := G.vertexSet_finite.subset (Set.union_subset hC₁ hX) + edgeSet_finite := G.edgeSet_finite.subset fun _ h ↦ h.1 } + let G₂ : Hypergraph α β := + { vertexSet := C₂ ∪ X + edgeSet := G.edgeSet \ E₁ + Inc := fun e v ↦ e ∈ G.edgeSet \ E₁ ∧ G.Inc e v + vertex_mem_of_inc := fun e v ⟨he, hv⟩ ↦ + hE₂ e he.1 (fun hsub ↦ he.2 ⟨he.1, hsub⟩) hv + edge_mem_of_inc := fun _ _ h ↦ h.1 + vertexSet_finite := G.vertexSet_finite.subset (Set.union_subset hC₂ hX) + edgeSet_finite := G.edgeSet_finite.subset Set.sdiff_subset } + refine ⟨G₁, G₂, ?_, subset_sepCompLeft_union G.skeleton hZ₁, + subset_sepCompRight_union hZ₂ hsep, ?_⟩ + · refine ⟨⟨Set.union_subset hC₁ hX, fun _ h ↦ h.1, ?_⟩, + ⟨Set.union_subset hC₂ hX, Set.sdiff_subset, ?_⟩, ?_, ?_⟩ + · intro e he + ext v + exact ⟨fun h ↦ ⟨he, h⟩, fun h ↦ h.2⟩ + · intro e he + ext v + exact ⟨fun h ↦ ⟨he, h⟩, fun h ↦ h.2⟩ + · refine Hypergraph.ext ?_ ?_ ?_ + · apply Set.Subset.antisymm + · exact Set.union_subset (Set.union_subset hC₁ hX) (Set.union_subset hC₂ hX) + · intro v hv + rcases subset_sepComp_union G.skeleton Z₁ hv with (h1 | h2) | h3 + · exact Or.inl (Or.inl h1) + · exact Or.inr (Or.inl h2) + · exact Or.inl (Or.inr h3) + · change G₁.edgeSet ∪ G₂.edgeSet = G.edgeSet + ext e + simp only [G₁, G₂, Set.mem_union, Set.mem_sdiff] + exact ⟨fun h ↦ h.elim (fun h1 ↦ h1.1) (fun h2 ↦ h2.1), + fun he ↦ em (e ∈ E₁) |>.imp_right fun hnot ↦ ⟨he, hnot⟩⟩ + · funext e v + apply propext + change (G₁.Inc e v ∨ G₂.Inc e v) ↔ G.Inc e v + exact ⟨fun h ↦ h.elim (fun h1 ↦ h1.2) (fun h2 ↦ h2.2), + fun hv ↦ em (e ∈ E₁) |>.imp (fun h1 ↦ ⟨h1, hv⟩) + (fun h2 ↦ ⟨⟨G.edge_mem_of_inc hv, h2⟩, hv⟩)⟩ + · change E₁ ∩ (G.edgeSet \ E₁) = ∅ + ext e + simp only [Set.mem_inter_iff, Set.mem_sdiff, Set.mem_empty_iff_false, + iff_false, not_and] + intro h1 _ h3 + exact h3 h1 + · unfold Hypergraph.separationOrder + have hinter : (G₁ ∩ G₂).vertexSet = X := by + change (C₁ ∪ X) ∩ (C₂ ∪ X) = X + ext v + simp only [Set.mem_inter_iff, Set.mem_union] + constructor + · rintro ⟨h1 | hX1, h2 | hX2⟩ + · exact (Set.disjoint_left.1 (disjoint_sepCompLeft_sepCompRight _ _ _ _) h1 h2).elim + · exact hX2 + · exact hX1 + · exact hX1 + · intro hv + exact ⟨Or.inr hv, Or.inr hv⟩ + rw [hinter] + +/-- Menger's theorem on `(G.skeleton, G.vertexSet)` in terms of vertex separators `X`. -/ +theorem hasDisjointPaths_iff_forall_separates + (G : Hypergraph α β) {Z₁ Z₂ : Set α} (hZ₁ : Z₁ ⊆ G.vertexSet) (hZ₂ : Z₂ ⊆ G.vertexSet) + (k : ℕ) : + HasDisjointPaths G.skeleton Z₁ Z₂ k ↔ + ∀ X, Separates G.skeleton G.vertexSet Z₁ Z₂ X → k ≤ X.ncard := by + rw [← menger.{u, v} G Z₁ Z₂ hZ₁ hZ₂ k] + constructor + · intro h X hsep + obtain ⟨G₁, G₂, hsepG, h1, h2, hord⟩ := exists_isSeparation_of_separates G hZ₁ hZ₂ hsep + exact hord ▸ h G₁ G₂ hsepG h1 h2 + · intro h G₁ G₂ hsepG h1 h2 + exact h (G₁ ∩ G₂).vertexSet (separates_of_isSeparation G hsepG h1 h2) + +theorem exists_separates_lt_of_not_hasDisjointPaths + (G : Hypergraph α β) {Z₁ Z₂ : Set α} (hZ₁ : Z₁ ⊆ G.vertexSet) (hZ₂ : Z₂ ⊆ G.vertexSet) + {k : ℕ} (hnot : ¬ HasDisjointPaths G.skeleton Z₁ Z₂ k) : + ∃ X, Separates G.skeleton G.vertexSet Z₁ Z₂ X ∧ X.ncard < k := by + rw [hasDisjointPaths_iff_forall_separates G hZ₁ hZ₂ k, not_forall] at hnot + obtain ⟨X, hX⟩ := hnot + rw [not_imp, not_le] at hX + exact ⟨X, hX.1, hX.2⟩ + +/-! ## Splitting the Menger paths `{P_x | x ∈ X}` of a minimum-order separator -/ + +theorem walk_support_subset_of_not_adj {K : SimpleGraph α} {V₀ C₁ C₂ X : Set α} + (hcov : V₀ ⊆ C₁ ∪ C₂ ∪ X) + (hno_adj : ∀ ⦃a b : α⦄, a ∈ C₁ → b ∈ C₂ → ¬ K.Adj a b) + {u v : α} (p : K.Walk u v) (hp : p.IsPath) (hpV : ∀ w ∈ p.support, w ∈ V₀) + (hpX : ∀ w ∈ p.support, w ∈ X → w = v) (hu : u ∈ C₁ ∪ X) : + ∀ w ∈ p.support, w ∈ C₁ ∪ {v} := by + induction p with + | nil => + intro w hw + simp only [Walk.support_nil, List.mem_singleton] at hw + exact Or.inr hw + | @cons u u' v hadj q ih => + intro w hw + simp only [Walk.support_cons, List.mem_cons] at hw + have huv : u ≠ v := by + rintro rfl + rw [Walk.cons_isPath_iff] at hp + exact hp.2 q.end_mem_support + have huC₁ : u ∈ C₁ := by + rcases hu with hu1 | huX + · exact hu1 + · exact (huv (hpX u (List.Mem.head _) huX)).elim + rcases hw with rfl | hw + · exact Or.inl huC₁ + · have hu'V := hpV u' (List.mem_cons_of_mem _ q.start_mem_support) + have hu' : u' ∈ C₁ ∪ X := by + rcases hcov hu'V with (hu'1 | hu'2) | hu'X + · exact Or.inl hu'1 + · exact (hno_adj huC₁ hu'2 hadj).elim + · exact Or.inr hu'X + exact ih hp.of_cons (fun z hz ↦ hpV z (List.mem_cons_of_mem _ hz)) + (fun z hz hzX ↦ hpX z (List.mem_cons_of_mem _ hz) hzX) hu' w hw + +/-- Given a minimum-order `Z₁`–`Z₂` separator `X` in `(G.skeleton, G.vertexSet)` and any partition +`G.vertexSet \ X = C₁ ∪ C₂` with no edges between `C₁` and `C₂`, `Z₁ ⊆ C₁ ∪ X`, and +`Z₂ ⊆ C₂ ∪ X`, Menger's theorem supplies pairwise disjoint paths `P_x^1` (`x ∈ X`) in +`G.vertexSet \ C₁` from `x` to `Z₂` and pairwise disjoint paths `P_x^2` (`x ∈ X`) in +`G.vertexSet \ C₂` from `x` to `Z₁` (Bellenbaum and Diestel, proof of Theorem 3, page 3). -/ +theorem exists_menger_walks_of_min_sep + (G : Hypergraph α β) {Z₁ Z₂ X C₁ C₂ : Set α} + (hZ₁ : Z₁ ⊆ G.vertexSet) (hZ₂ : Z₂ ⊆ G.vertexSet) + (hsep : Separates G.skeleton G.vertexSet Z₁ Z₂ X) + (hmin : ∀ X', Separates G.skeleton G.vertexSet Z₁ Z₂ X' → X.ncard ≤ X'.ncard) + (hcov : G.vertexSet ⊆ C₁ ∪ C₂ ∪ X) + (hdisj : Disjoint C₁ C₂) (hdisj₁ : Disjoint C₁ X) (hdisj₂ : Disjoint C₂ X) + (hno_adj : ∀ ⦃a b : α⦄, a ∈ C₁ → b ∈ C₂ → ¬ G.skeleton.Adj a b) + (hZ₁C : Z₁ ⊆ C₁ ∪ X) (hZ₂C : Z₂ ⊆ C₂ ∪ X) : + ∃ (end₁ end₂ : α → α) + (_ : ∀ x ∈ X, end₁ x ∈ Z₁) + (_ : ∀ x ∈ X, end₂ x ∈ Z₂) + (P₁ : ∀ x ∈ X, G.skeleton.Walk x (end₂ x)) + (P₂ : ∀ x ∈ X, G.skeleton.Walk x (end₁ x)), + (∀ x (hx : x ∈ X), ∀ z ∈ (P₁ x hx).support, z ∈ G.vertexSet \ C₁) ∧ + (∀ x (hx : x ∈ X) y (hy : y ∈ X), x ≠ y → + Disjoint {z | z ∈ (P₁ x hx).support} {z | z ∈ (P₁ y hy).support}) ∧ + (∀ x (hx : x ∈ X), ∀ z ∈ (P₂ x hx).support, z ∈ G.vertexSet \ C₂) ∧ + (∀ x (hx : x ∈ X) y (hy : y ∈ X), x ≠ y → + Disjoint {z | z ∈ (P₂ x hx).support} {z | z ∈ (P₂ y hy).support}) := by + classical + have hpaths : HasDisjointPaths G.skeleton Z₁ Z₂ X.ncard := + (hasDisjointPaths_iff_forall_separates G hZ₁ hZ₂ X.ncard).2 hmin + obtain ⟨Q, hQ⟩ := hpaths + have hQ_V : ∀ (i : Fin X.ncard) (z : α), z ∈ (Q i).walk.support → z ∈ G.vertexSet := by + intro i z hz + have hwalk : ∀ {u v : α} (w : G.skeleton.Walk u v), u ∈ G.vertexSet → + ∀ z ∈ w.support, z ∈ G.vertexSet := by + intro u v w hu z hz + induction w with + | nil => + simp only [Walk.support_nil, List.mem_singleton] at hz + exact hz ▸ hu + | cons hadj q ih => + simp only [Walk.support_cons, List.mem_cons] at hz + rcases hz with rfl | hz + · exact hu + · obtain ⟨_, e, _, hew⟩ := hadj + exact ih (G.vertex_mem_of_inc hew) hz + exact hwalk (Q i).walk (hZ₁ (Q i).first_mem) z hz + have hex : ∀ i : Fin X.ncard, ∃ x ∈ (Q i).walk.support, x ∈ X := + fun i ↦ hsep.2 (Q i).first_mem (Q i).last_mem (Q i).walk (hQ_V i) + have : Fintype X := (G.vertexSet_finite.subset hsep.1).fintype + let g : Fin X.ncard → X := fun i ↦ ⟨(hex i).choose, (hex i).choose_spec.2⟩ + have hg_inj : Function.Injective g := by + intro i j hij + by_contra hne + have h1 : (g i).1 ∈ (Q i).walk.support := (hex i).choose_spec.1 + have h2 : (g i).1 ∈ (Q j).walk.support := + (congrArg Subtype.val hij) ▸ (hex j).choose_spec.1 + exact Set.disjoint_left.1 (hQ hne) h1 h2 + have hcard_eq : Fintype.card (Fin X.ncard) = Fintype.card X := by + rw [Fintype.card_fin, Set.ncard_eq_toFinset_card X (G.vertexSet_finite.subset hsep.1), + Set.Finite.card_toFinset] + have hg_bij : Function.Bijective g := + (Fintype.bijective_iff_injective_and_card g).2 ⟨hg_inj, hcard_eq⟩ + have hg_uniq : ∀ (i : Fin X.ncard) (y : α), y ∈ (Q i).walk.support → y ∈ X → y = (g i).1 := by + intro i y hyQ hyX + obtain ⟨j, hj⟩ := hg_bij.2 ⟨y, hyX⟩ + have hj' : (g j).1 = y := congrArg Subtype.val hj + have hyj : y ∈ (Q j).walk.support := hj' ▸ (hex j).choose_spec.1 + have hij : i = j := by + by_contra hne + exact Set.disjoint_left.1 (hQ hne) hyQ hyj + exact hij ▸ hj'.symm + have hx_idx : ∀ x ∈ X, ∃ i : Fin X.ncard, (g i).1 = x := by + intro x hx + obtain ⟨i, hi⟩ := hg_bij.2 ⟨x, hx⟩ + exact ⟨i, congrArg Subtype.val hi⟩ + let idx : ∀ x ∈ X, Fin X.ncard := fun x hx ↦ (hx_idx x hx).choose + have hidx_eq : ∀ x (hx : x ∈ X), (g (idx x hx)).1 = x := + fun x hx ↦ (hx_idx x hx).choose_spec + have hidx_mem : ∀ x (hx : x ∈ X), x ∈ (Q (idx x hx)).walk.support := by + intro x hx + have h1 : (g (idx x hx)).1 ∈ (Q (idx x hx)).walk.support := (hex (idx x hx)).choose_spec.1 + rwa [hidx_eq x hx] at h1 + have hidx_inj : ∀ x (hx : x ∈ X) y (hy : y ∈ X), x ≠ y → idx x hx ≠ idx y hy := by + intro x hx y hy hne heq + apply hne + rw [← hidx_eq x hx, ← hidx_eq y hy, heq] + let end₁ : α → α := fun x ↦ if hx : x ∈ X then (Q (idx x hx)).first else x + let end₂ : α → α := fun x ↦ if hx : x ∈ X then (Q (idx x hx)).last else x + have hend₁_eq : ∀ x (hx : x ∈ X), end₁ x = (Q (idx x hx)).first := + fun x hx ↦ dite_eq_left hx + have hend₂_eq : ∀ x (hx : x ∈ X), end₂ x = (Q (idx x hx)).last := + fun x hx ↦ dite_eq_left hx + refine ⟨end₁, end₂, + fun x hx ↦ hend₁_eq x hx ▸ (Q (idx x hx)).first_mem, + fun x hx ↦ hend₂_eq x hx ▸ (Q (idx x hx)).last_mem, + fun x hx ↦ ((Q (idx x hx)).walk.dropUntil x (hidx_mem x hx)).copy rfl (hend₂_eq x hx).symm, + fun x hx ↦ ((Q (idx x hx)).walk.takeUntil x (hidx_mem x hx)).reverse.copy rfl + (hend₁_eq x hx).symm, + ?_, ?_, ?_, ?_⟩ + · intro x hx z hz + rw [Walk.support_copy] at hz + have hzQ : z ∈ (Q (idx x hx)).walk.support := + Walk.support_dropUntil_subset_support _ _ hz + have hcov' : G.vertexSet ⊆ C₂ ∪ C₁ ∪ X := by + intro w hw + rcases hcov hw with (h1 | h2) | h3 + · exact Or.inl (Or.inr h1) + · exact Or.inl (Or.inl h2) + · exact Or.inr h3 + have hno' : ∀ ⦃a b : α⦄, a ∈ C₂ → b ∈ C₁ → ¬ G.skeleton.Adj a b := + fun a b ha hb hadj ↦ hno_adj hb ha hadj.symm + have hmem := walk_support_subset_of_not_adj hcov' hno' + ((Q (idx x hx)).walk.dropUntil x (hidx_mem x hx)).reverse + ((Q (idx x hx)).isPath.dropUntil (hidx_mem x hx)).reverse + (fun w hw ↦ by + rw [Walk.support_reverse, List.mem_reverse] at hw + exact hQ_V _ w (Walk.support_dropUntil_subset_support _ _ hw)) + (fun w hw hwX ↦ by + rw [Walk.support_reverse, List.mem_reverse] at hw + have := hg_uniq (idx x hx) w (Walk.support_dropUntil_subset_support _ _ hw) hwX + exact this.trans (hidx_eq x hx)) + (hZ₂C (Q (idx x hx)).last_mem) z + (by rwa [Walk.support_reverse, List.mem_reverse]) + refine ⟨hQ_V _ z hzQ, ?_⟩ + rcases hmem with hzC₂ | rfl + · exact Set.disjoint_right.1 hdisj hzC₂ + · exact Set.disjoint_right.1 hdisj₁ hx + · intro x hx y hy hne + rw [Set.disjoint_left] + intro z hzx hzy + simp only [Set.mem_ofPred_eq, Walk.support_copy] at hzx hzy + exact Set.disjoint_left.1 (hQ (hidx_inj x hx y hy hne)) + (Walk.support_dropUntil_subset_support _ _ hzx) + (Walk.support_dropUntil_subset_support _ _ hzy) + · intro x hx z hz + rw [Walk.support_copy, Walk.support_reverse, List.mem_reverse] at hz + have hzQ : z ∈ (Q (idx x hx)).walk.support := + Walk.support_takeUntil_subset_support _ _ hz + have hmem := walk_support_subset_of_not_adj hcov hno_adj + ((Q (idx x hx)).walk.takeUntil x (hidx_mem x hx)) + ((Q (idx x hx)).isPath.takeUntil (hidx_mem x hx)) + (fun w hw ↦ hQ_V _ w (Walk.support_takeUntil_subset_support _ _ hw)) + (fun w hw hwX ↦ (hg_uniq (idx x hx) w (Walk.support_takeUntil_subset_support _ _ hw) + hwX).trans + (hidx_eq x hx)) + (hZ₁C (Q (idx x hx)).first_mem) z hz + refine ⟨hQ_V _ z hzQ, ?_⟩ + rcases hmem with hzC₁ | rfl + · exact Set.disjoint_left.1 hdisj hzC₁ + · exact Set.disjoint_right.1 hdisj₂ hx + · intro x hx y hy hne + rw [Set.disjoint_left] + intro z hzx hzy + simp only [Set.mem_ofPred_eq, Walk.support_copy, Walk.support_reverse, List.mem_reverse] + at hzx hzy + exact Set.disjoint_left.1 (hQ (hidx_inj x hx y hy hne)) + (Walk.support_takeUntil_subset_support _ _ hzx) + (Walk.support_takeUntil_subset_support _ _ hzy) + +end GraphMinor.Thomas diff --git a/LeanPool/GraphMinor/Thomas/Translate.lean b/LeanPool/GraphMinor/Thomas/Translate.lean new file mode 100644 index 0000000000..b1adf375b2 --- /dev/null +++ b/LeanPool/GraphMinor/Thomas/Translate.lean @@ -0,0 +1,473 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import LeanPool.GraphMinor.Thomas.LeanDecomp +public import LeanPool.GraphMinor.Thomas.RootedTree + +/-! +# Translation between tree-decompositions and Proof of Graph Minors IV, (5.1) + +This file translates between the rooted-hypergraph tree-decompositions of Graph Minors IV +(`GraphMinor.GM04.IsTreeDecomposition`) and the tree-decompositions of Bellenbaum and Diestel +(`GraphMinor.Thomas.TreeDecomp`), deduces the Menger-like path/edge-order property of (5.1) from +leanness (condition (T4′)), and proves **Graph Minors IV, (5.1)** (`GraphMinor.GM04.thomas_5_1`). + +## Main results + +* `GraphMinor.Thomas.TreeDecomp.thomas_of_isLean`: a lean tree-decomposition satisfies Thomas's + path-or-separator property between any two distinct bags. +* `GraphMinor.Thomas.treeDecompOfGM04`: converts a Graph Minors IV tree-decomposition of +`G.toRooted` + of width $\le w$ into a `TreeDecomp G.skeleton G.vertexSet T.verts` of width $\le w$. +* `GraphMinor.Thomas.gm04OfTreeDecomp`: converts a lean `TreeDecomp G.skeleton G.vertexSet (Fin m)` + of width $\le w$ into a Graph Minors IV tree-decomposition of `G.toRooted` on `RootedTree ℕ` + satisfying the conclusion of `ThomasStatement`. +* `GraphMinor.GM04.thomas_5_1`: **Graph Minors IV, (5.1)** (Thomas's lemma). +-/ + +namespace GraphMinor.Thomas + +open SimpleGraph GraphMinor.GM04 + +universe u v + +public section + +variable {α : Type u} {β : Type v} + +/-! ## Step 3: Deducing (5.1) on `TreeDecomp` from leanness (T4′) -/ + +theorem hasDisjointPaths_mono {K : SimpleGraph α} {Z₁ Z₂ W₁ W₂ : Set α} {k : ℕ} + (h₁ : Z₁ ⊆ W₁) (h₂ : Z₂ ⊆ W₂) (h : HasDisjointPaths K Z₁ Z₂ k) : + HasDisjointPaths K W₁ W₂ k := by + obtain ⟨P, hP⟩ := h + refine ⟨fun i ↦ + { first := (P i).first + last := (P i).last + walk := (P i).walk + isPath := (P i).isPath + first_mem := h₁ (P i).first_mem + last_mem := h₂ (P i).last_mem }, hP⟩ + +namespace TreeDecomp + +variable {ι : Type*} [Fintype ι] {K : SimpleGraph α} {V₀ : Set α} (D : TreeDecomp K V₀ ι) + +theorem exists_first_onTreePathEdge {t₁ t₂ : ι} (hne : t₁ ≠ t₂) : + ∃ s : ι, OnTreePathEdge D.T t₁ t₂ t₁ s := by + generalize hp : treePath D.isTree t₁ t₂ = p + cases p with + | nil => exact (hne rfl).elim + | @cons _ s _ hadj q => + refine ⟨s, ?_⟩ + rw [onTreePathEdge_iff_mem_treePath D.isTree, hp] + exact ⟨hadj, List.Mem.head _⟩ + +/-- If $\mathcal{D}$ is a lean tree-decomposition of $(K, V_0)$, then for all distinct $t_1, t_2 \in +T$ +and all $k \ge 0$, either there are $k$ mutually vertex-disjoint paths in $K$ from $V_{t_1}$ to +$V_{t_2}$, or some edge $s s'$ on $t_1 T t_2$ has $|V_s \cap V_{s'}| < k$ +(Bellenbaum and Diestel, Section 1, page 1). If `k` is at most the sizes of both bags, apply +condition (T4′) of leanness to `k`-subsets of the two bags. Otherwise one of the two bags has fewer +than `k` vertices, and the edge of `t₁ T t₂` at that bag has `|V_s ∩ V_{s'}| < k`. -/ +theorem thomas_of_isLean (hV₀ : V₀.Finite) (hlean : D.IsLean) + {t₁ t₂ : ι} (hne : t₁ ≠ t₂) (k : ℕ) : + HasDisjointPaths K (D.bag t₁) (D.bag t₂) k ∨ + ∃ s s' : ι, OnTreePathEdge D.T t₁ t₂ s s' ∧ (D.bag s ∩ D.bag s').ncard < k := by + rcases le_or_gt k (D.bag t₁).ncard with hk₁ | hk₁ + · rcases le_or_gt k (D.bag t₂).ncard with hk₂ | hk₂ + · obtain ⟨Z₁, hZ₁_sub, hZ₁_card⟩ := Set.exists_subset_card_eq hk₁ + obtain ⟨Z₂, hZ₂_sub, hZ₂_card⟩ := Set.exists_subset_card_eq hk₂ + rcases hlean t₁ t₂ Z₁ Z₂ k hZ₁_sub hZ₂_sub hZ₁_card hZ₂_card with hpaths | hex + · exact Or.inl (hasDisjointPaths_mono hZ₁_sub hZ₂_sub hpaths) + · exact Or.inr hex + · right + obtain ⟨s, hs⟩ := D.exists_first_onTreePathEdge hne.symm + refine ⟨s, t₂, onTreePathEdge_swap (onTreePathEdge_symm_endpoints hs), ?_⟩ + have hle : (D.bag s ∩ D.bag t₂).ncard ≤ (D.bag t₂).ncard := + Set.ncard_le_ncard Set.inter_subset_right (D.bag_finite hV₀ t₂) + omega + · right + obtain ⟨s, hs⟩ := D.exists_first_onTreePathEdge hne + refine ⟨t₁, s, hs, ?_⟩ + have hle : (D.bag t₁ ∩ D.bag s).ncard ≤ (D.bag t₁).ncard := + Set.ncard_le_ncard Set.inter_subset_left (D.bag_finite hV₀ t₁) + omega + +end TreeDecomp + +/-! ## Step 4A: From Graph Minors IV `IsTreeDecomposition` to `TreeDecomp` -/ + +/-- Convert a Graph Minors IV tree-decomposition `(T, τ)` of `G.toRooted` into a +Bellenbaum–Diestel tree-decomposition on `T.verts`. -/ +noncomputable def treeDecompOfGM04 {ι : Type*} {G : Hypergraph α β} {T : RootedTree ι} + {τ : ι → RootedHypergraph α β} (hD : IsTreeDecomposition G.toRooted T τ) : + TreeDecomp G.skeleton G.vertexSet T.verts where + T := toSimpleGraph T + isTree := toSimpleGraph_isTree T + bag t := (τ t.1).vertexSet + iUnion_bag := by + have h := congrArg Hypergraph.vertexSet hD.biUnion_eq + change (⋃ i ∈ T.verts, (τ i).vertexSet) = G.vertexSet at h + ext v + rw [← h, Set.mem_iUnion, Set.mem_iUnion₂] + exact ⟨fun ⟨t, hv⟩ ↦ ⟨t.1, t.2, hv⟩, fun ⟨i, hi, hv⟩ ↦ ⟨⟨i, hi⟩, hv⟩⟩ + adj_mem_bag u v _ _ hadj := by + obtain ⟨_, e, heu, hev⟩ := hadj + have hinc : (Hypergraph.biUnion T.verts fun t ↦ (τ t).toHypergraph).Inc e u := by + rw [hD.biUnion_eq] + exact heu + obtain ⟨t, ht, htu⟩ := hinc + have he_mem : e ∈ (τ t).edgeSet := (τ t).edge_mem_of_inc htu + have hends := (hD.le t ht).ends_eq e he_mem + have htv : (τ t).Inc e v := by + change v ∈ (τ t).ends e + rw [← hends] + exact hev + exact ⟨⟨t, ht⟩, (τ t).vertex_mem_of_inc htu, (τ t).vertex_mem_of_inc htv⟩ + inter_subset_bag t₁ t₂ t₃ hp := by + have hon : T.OnPath t₁.1 t₃.1 t₂.1 := (onTreePath_toSimpleGraph_iff T t₁ t₃ t₂).1 hp + exact (hD.inter_le t₁.1 t₁.2 t₂.1 t₂.2 t₃.1 t₃.2 hon).vertexSet_subset + +theorem widthLE_treeDecompOfGM04 {ι : Type*} {G : Hypergraph α β} {T : RootedTree ι} + {τ : ι → RootedHypergraph α β} (hD : IsTreeDecomposition G.toRooted T τ) + {w : ℕ} (hw : GM04.WidthLE T τ w) : + (treeDecompOfGM04 hD).WidthLE w := + ((treeDecompOfGM04 hD).widthLE_iff_ncard_le G.vertexSet_finite).mpr + (fun t ↦ hw t.1 t.2) + +/-! ## Step 4B: From `TreeDecomp` on `Fin m` to Graph Minors IV `IsTreeDecomposition` -/ + +section ToGM04 + +variable {G : Hypergraph α β} {m : ℕ} (D : TreeDecomp G.skeleton G.vertexSet (Fin m)) + +/-- Every edge of a graph `G` has all its ends (1 or 2 vertices) contained in some bag of `D`. -/ +theorem exists_bag_superset_ends (hG : G.IsGraph) {e : β} (he : e ∈ G.edgeSet) : + ∃ t : Fin m, G.ends e ⊆ D.bag t := by + obtain ⟨⟨u, hu⟩, hcard⟩ := hG e he + by_cases hsub : G.ends e ⊆ {u} + · obtain ⟨t, hut⟩ := D.exists_mem_bag (G.vertex_mem_of_inc hu) + exact ⟨t, fun v hv ↦ (Set.mem_singleton_iff.1 (hsub hv)) ▸ hut⟩ + · obtain ⟨v, hv, hvu⟩ := Set.not_subset.1 hsub + rw [Set.mem_singleton_iff] at hvu + have hadj : G.skeleton.Adj u v := ⟨Ne.symm hvu, e, hu, hv⟩ + obtain ⟨t, hut, hvt⟩ := + D.adj_mem_bag (G.vertex_mem_of_inc hu) (G.vertex_mem_of_inc hv) hadj + refine ⟨t, fun z hz ↦ ?_⟩ + by_cases hzu : z = u + · exact hzu ▸ hut + · by_cases hzv : z = v + · exact hzv ▸ hvt + · exfalso + have h3_sub : ({z, u, v} : Set α) ⊆ G.ends e := by + intro w hw + simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hw + rcases hw with rfl | rfl | rfl + · exact hz + · exact hu + · exact hv + have hends_fin : (G.ends e).Finite := + G.vertexSet_finite.subset fun w hw ↦ G.vertex_mem_of_inc hw + have hle := Set.ncard_le_ncard h3_sub hends_fin + have hcard3 : ({z, u, v} : Set α).ncard = 3 := by + rw [Set.ncard_insert_of_notMem, Set.ncard_insert_of_notMem, Set.ncard_singleton] + · simp [Ne.symm hvu] + · simp [hzu, hzv] + omega + +/-- Choice of a tree node `t : Fin m` whose bag contains the ends of `e`. -/ +noncomputable def edgeBag (hG : G.IsGraph) (e : β) : Fin m := + open Classical in + if he : e ∈ G.edgeSet then (exists_bag_superset_ends D hG he).choose + else treeRootFin D.isTree + +theorem ends_subset_bag_edgeBag (hG : G.IsGraph) {e : β} (he : e ∈ G.edgeSet) : + G.ends e ⊆ D.bag (edgeBag D hG e) := by + classical + unfold edgeBag + rw [dite_eq_left he] + exact (exists_bag_superset_ends D hG he).choose_spec + +/-- The hypergraph `(τ n)⁻` at node `n : ℕ` for the Graph Minors IV tree-decomposition built from +`D`. -/ +noncomputable def gm04BagHypergraph (hG : G.IsGraph) (n : ℕ) : Hypergraph α β := + open Classical in + if hn : n < m then + { vertexSet := D.bag ⟨n, hn⟩ + edgeSet := {e ∈ G.edgeSet | edgeBag D hG e = ⟨n, hn⟩} + Inc := fun e v ↦ e ∈ G.edgeSet ∧ edgeBag D hG e = ⟨n, hn⟩ ∧ G.Inc e v + vertex_mem_of_inc := fun _ _ ⟨he, hbag, hinc⟩ ↦ + hbag ▸ ends_subset_bag_edgeBag D hG he hinc + edge_mem_of_inc := fun _ _ ⟨he, hbag, _⟩ ↦ ⟨he, hbag⟩ + vertexSet_finite := D.bag_finite G.vertexSet_finite ⟨n, hn⟩ + edgeSet_finite := G.edgeSet_finite.subset fun _ h ↦ h.1 } + else + { vertexSet := ∅ + edgeSet := ∅ + Inc := fun _ _ ↦ False + vertex_mem_of_inc := fun _ _ h ↦ h.elim + edge_mem_of_inc := fun _ _ h ↦ h.elim + vertexSet_finite := Set.finite_empty + edgeSet_finite := Set.finite_empty } + +/-- The march `π(τ(n))` at node `n : ℕ`: empty at the root `0` (and outside `Finset.range m`), and +an enumeration of `D.bag n ∩ D.bag (parent n)` for `0 < n < m`. -/ +noncomputable def gm04BagRoots (n : ℕ) : List α := + open Classical in + if hn : n < m then + if n = 0 then [] + else + ((D.bag_finite G.vertexSet_finite ⟨n, hn⟩).subset Set.inter_subset_left : + (D.bag ⟨n, hn⟩ ∩ D.bag (parentFin D.isTree ⟨n, hn⟩)).Finite).toFinset.toList + else [] + +/-- The rooted hypergraph `τ(n)` at node `n : ℕ`. -/ +noncomputable def gm04Bags (hG : G.IsGraph) (n : ℕ) : RootedHypergraph α β where + toHypergraph := gm04BagHypergraph D hG n + roots := gm04BagRoots D n + roots_nodup := by + classical + unfold gm04BagRoots + split_ifs with hn h0 + · exact List.nodup_nil + · exact Finset.nodup_toList _ + · exact List.nodup_nil + roots_subset v hv := by + classical + unfold gm04BagRoots at hv + unfold gm04BagHypergraph + split_ifs at hv with hn h0 + · exact absurd hv List.not_mem_nil + · rw [dite_eq_left hn] + rw [Finset.mem_toList, Set.Finite.mem_toFinset] at hv + exact hv.1 + · exact absurd hv List.not_mem_nil + +theorem gm04Bags_vertexSet_of_lt (hG : G.IsGraph) {n : ℕ} (hn : n < m) : + (gm04Bags D hG n).vertexSet = D.bag ⟨n, hn⟩ := by + classical + change (gm04BagHypergraph D hG n).vertexSet = D.bag ⟨n, hn⟩ + unfold gm04BagHypergraph + rw [dite_eq_left hn] + +theorem gm04Bags_edgeSet_of_lt (hG : G.IsGraph) {n : ℕ} (hn : n < m) : + (gm04Bags D hG n).edgeSet = {e ∈ G.edgeSet | edgeBag D hG e = ⟨n, hn⟩} := by + classical + change (gm04BagHypergraph D hG n).edgeSet = _ + unfold gm04BagHypergraph + rw [dite_eq_left hn] + +theorem gm04Bags_inc_of_lt (hG : G.IsGraph) {n : ℕ} (hn : n < m) (e : β) (v : α) : + (gm04Bags D hG n).Inc e v ↔ e ∈ G.edgeSet ∧ edgeBag D hG e = ⟨n, hn⟩ ∧ G.Inc e v := by + classical + change (gm04BagHypergraph D hG n).Inc e v ↔ _ + unfold gm04BagHypergraph + rw [dite_eq_left hn] + +theorem isTreeDecomposition_gm04Bags (hG : G.IsGraph) : + IsTreeDecomposition G.toRooted (rootedTreeOfIsTree D.isTree) (gm04Bags D hG) where + le t ht := by + have ht_lt : t < m := Finset.mem_range.1 ht + refine ⟨?_, ?_, ?_⟩ + · rw [gm04Bags_vertexSet_of_lt D hG ht_lt] + exact D.bag_subset ⟨t, ht_lt⟩ + · rw [gm04Bags_edgeSet_of_lt D hG ht_lt] + exact fun _ h ↦ h.1 + · intro e he + rw [gm04Bags_edgeSet_of_lt D hG ht_lt] at he + ext v + change G.Inc e v ↔ (gm04Bags D hG t).Inc e v + rw [gm04Bags_inc_of_lt D hG ht_lt] + exact ⟨fun h ↦ ⟨he.1, he.2, h⟩, fun h ↦ h.2.2⟩ + biUnion_eq := by + refine Hypergraph.ext ?_ ?_ ?_ + · change (⋃ t ∈ Finset.range m, (gm04Bags D hG t).vertexSet) = G.vertexSet + ext v + rw [Set.mem_iUnion₂, ← D.iUnion_bag, Set.mem_iUnion] + constructor + · rintro ⟨t, ht, hv⟩ + have ht_lt : t < m := Finset.mem_range.1 ht + rw [gm04Bags_vertexSet_of_lt D hG ht_lt] at hv + exact ⟨⟨t, ht_lt⟩, hv⟩ + · rintro ⟨⟨t, ht_lt⟩, hv⟩ + refine ⟨t, Finset.mem_range.2 ht_lt, ?_⟩ + rw [gm04Bags_vertexSet_of_lt D hG ht_lt] + exact hv + · change (⋃ t ∈ Finset.range m, (gm04Bags D hG t).edgeSet) = G.edgeSet + ext e + rw [Set.mem_iUnion₂] + constructor + · rintro ⟨t, ht, he⟩ + have ht_lt : t < m := Finset.mem_range.1 ht + rw [gm04Bags_edgeSet_of_lt D hG ht_lt] at he + exact he.1 + · intro he + let t := edgeBag D hG e + refine ⟨t.val, Finset.mem_range.2 t.isLt, ?_⟩ + rw [gm04Bags_edgeSet_of_lt D hG t.isLt] + exact ⟨he, rfl⟩ + · funext e v + apply propext + change (∃ t ∈ Finset.range m, (gm04Bags D hG t).Inc e v) ↔ G.Inc e v + constructor + · rintro ⟨t, ht, hinc⟩ + have ht_lt : t < m := Finset.mem_range.1 ht + rw [gm04Bags_inc_of_lt D hG ht_lt] at hinc + exact hinc.2.2 + · intro hinc + have he : e ∈ G.edgeSet := G.edge_mem_of_inc hinc + let t := edgeBag D hG e + refine ⟨t.val, Finset.mem_range.2 t.isLt, ?_⟩ + rw [gm04Bags_inc_of_lt D hG t.isLt] + exact ⟨he, rfl, hinc⟩ + edgeSet_inter_eq t₁ ht₁ t₂ ht₂ hne := by + have h₁ : t₁ < m := Finset.mem_range.1 ht₁ + have h₂ : t₂ < m := Finset.mem_range.1 ht₂ + change (gm04Bags D hG t₁).edgeSet ∩ (gm04Bags D hG t₂).edgeSet = ∅ + rw [gm04Bags_edgeSet_of_lt D hG h₁, gm04Bags_edgeSet_of_lt D hG h₂] + ext e + simp only [Set.mem_inter_iff, Set.mem_ofPred_eq, Set.mem_empty_iff_false, iff_false, not_and] + rintro ⟨_, he₁⟩ _ he₂ + exact hne (congrArg Fin.val (he₁.symm.trans he₂)) + inter_le t₁ ht₁ t₂ ht₂ t₃ ht₃ hon := by + have h₁ : t₁ < m := Finset.mem_range.1 ht₁ + have h₂ : t₂ < m := Finset.mem_range.1 ht₂ + have h₃ : t₃ < m := Finset.mem_range.1 ht₃ + have hon_D : OnTreePath D.T ⟨t₁, h₁⟩ ⟨t₃, h₃⟩ ⟨t₂, h₂⟩ := + (onPath_rootedTreeOfIsTree_iff D.isTree ⟨t₁, ht₁⟩ ⟨t₃, ht₃⟩ ⟨t₂, ht₂⟩).1 hon + refine ⟨?_, ?_, ?_⟩ + · change (gm04Bags D hG t₁).vertexSet ∩ (gm04Bags D hG t₃).vertexSet ⊆ + (gm04Bags D hG t₂).vertexSet + rw [gm04Bags_vertexSet_of_lt D hG h₁, gm04Bags_vertexSet_of_lt D hG h₂, + gm04Bags_vertexSet_of_lt D hG h₃] + exact D.inter_subset_bag hon_D + · change (gm04Bags D hG t₁).edgeSet ∩ (gm04Bags D hG t₃).edgeSet ⊆ + (gm04Bags D hG t₂).edgeSet + rw [gm04Bags_edgeSet_of_lt D hG h₁, gm04Bags_edgeSet_of_lt D hG h₂, + gm04Bags_edgeSet_of_lt D hG h₃] + rintro e ⟨⟨he, he₁⟩, ⟨_, he₃⟩⟩ + have h13 : (⟨t₁, h₁⟩ : Fin m) = ⟨t₃, h₃⟩ := he₁.symm.trans he₃ + have h21 : (⟨t₂, h₂⟩ : Fin m) = ⟨t₃, h₃⟩ := (onTreePath_self D.T _ _).1 (h13 ▸ hon_D) + exact ⟨he, he₃.trans h21.symm⟩ + · intro e he + change e ∈ (gm04Bags D hG t₁).edgeSet ∩ (gm04Bags D hG t₃).edgeSet at he + rw [gm04Bags_edgeSet_of_lt D hG h₁, gm04Bags_edgeSet_of_lt D hG h₃] at he + have h13 : (⟨t₁, h₁⟩ : Fin m) = ⟨t₃, h₃⟩ := he.1.2.symm.trans he.2.2 + have h21 : (⟨t₂, h₂⟩ : Fin m) = ⟨t₃, h₃⟩ := (onTreePath_self D.T _ _).1 (h13 ▸ hon_D) + ext v + change (gm04Bags D hG t₂).Inc e v ↔ (gm04Bags D hG t₁).Inc e v ∧ (gm04Bags D hG t₃).Inc e v + rw [gm04Bags_inc_of_lt D hG h₁, gm04Bags_inc_of_lt D hG h₂, gm04Bags_inc_of_lt D hG h₃] + exact ⟨fun h ↦ ⟨⟨h.1, (h.2.1.trans h21).trans h13.symm, h.2.2⟩, ⟨h.1, h.2.1.trans h21, + h.2.2⟩⟩, + fun h ↦ ⟨h.1.1, h.2.2.1.trans h21.symm, h.1.2.2⟩⟩ + roots_root := by + classical + change gm04BagRoots D 0 = [] + unfold gm04BagRoots + rw [dite_eq_left (pos_of_isTree D.isTree), ite_eq_left rfl] + rootSet_edge f hf := by + classical + have hf_verts : f ∈ (rootedTreeOfIsTree D.isTree).verts := + mem_verts_of_mem_edges (rootedTreeOfIsTree D.isTree) hf + have hf_ne_0 : f ≠ 0 := + ne_root_of_mem_edges (rootedTreeOfIsTree D.isTree) hf + have hf_lt : f < m := Finset.mem_range.1 hf_verts + have hpar_lt : (rootedTreeOfIsTree D.isTree).parent f < m := + Finset.mem_range.1 ((rootedTreeOfIsTree D.isTree).parent_mem f hf_verts) + have hpar_eq : (⟨(rootedTreeOfIsTree D.isTree).parent f, hpar_lt⟩ : Fin m) = + parentFin D.isTree ⟨f, hf_lt⟩ := by + ext + change (if hn : f < m then (parentFin D.isTree ⟨f, hn⟩).val else 0) = _ + rw [dite_eq_left hf_lt] + change {v | v ∈ gm04BagRoots D f} = + (gm04Bags D hG f).vertexSet ∩ + (gm04Bags D hG ((rootedTreeOfIsTree D.isTree).parent f)).vertexSet + rw [gm04Bags_vertexSet_of_lt D hG hf_lt, gm04Bags_vertexSet_of_lt D hG hpar_lt, hpar_eq] + unfold gm04BagRoots + rw [dite_eq_left hf_lt, ite_eq_right hf_ne_0] + ext v + simp only [Set.mem_ofPred_eq, Finset.mem_toList, Set.Finite.mem_toFinset] + +theorem widthLE_gm04Bags (hG : G.IsGraph) {w : ℕ} (hw : D.WidthLE w) : + GM04.WidthLE (rootedTreeOfIsTree D.isTree) (gm04Bags D hG) w := by + intro t ht + have ht_lt : t < m := Finset.mem_range.1 ht + rw [gm04Bags_vertexSet_of_lt D hG ht_lt] + exact (D.widthLE_iff_ncard_le G.vertexSet_finite).mp hw ⟨t, ht_lt⟩ + +end ToGM04 + +end + +end GraphMinor.Thomas + +namespace GraphMinor.GM04 + +open GraphMinor.Thomas + +universe u v + +public section + +/-- Graph Minors IV, (5.1): Thomas's lemma. -/ +theorem thomas_5_1 : ThomasStatement.{u, v} := by + intro α β G hG w ⟨T₀, τ₀, hD₀, hw₀⟩ + let D₀ := treeDecompOfGM04 hD₀ + have hw_D₀ : D₀.WidthLE w := widthLE_treeDecompOfGM04 hD₀ hw₀ + obtain ⟨m, D, hlean, hw_D⟩ := theorem_3 G D₀ hw_D₀ + let T := rootedTreeOfIsTree D.isTree + let τ := gm04Bags D hG + have hD : IsTreeDecomposition G.toRooted T τ := isTreeDecomposition_gm04Bags D hG + have hw : WidthLE T τ w := widthLE_gm04Bags D hG hw_D + refine ⟨T, τ, hD, hw, ?_⟩ + intro t₁ ht₁ t₂ ht₂ hne k + have h₁ : t₁ < m := Finset.mem_range.1 ht₁ + have h₂ : t₂ < m := Finset.mem_range.1 ht₂ + let u₁ : T.verts := ⟨t₁, ht₁⟩ + let u₂ : T.verts := ⟨t₂, ht₂⟩ + have hne_fin : equivFinOfIsTree D.isTree u₁ ≠ equivFinOfIsTree D.isTree u₂ := + fun h ↦ hne (congrArg Fin.val h) + rcases D.thomas_of_isLean G.vertexSet_finite hlean hne_fin k with hpaths | ⟨i₁, i₂, he, hlt⟩ + · left + rw [gm04Bags_vertexSet_of_lt D hG h₁, gm04Bags_vertexSet_of_lt D hG h₂] + exact hpaths + · right + let s : T.verts := (equivFinOfIsTree D.isTree).symm i₁ + let s' : T.verts := (equivFinOfIsTree D.isTree).symm i₂ + have he_T : OnTreePathEdge (toSimpleGraph T) u₁ u₂ s s' := by + apply onTreePathEdge_of_isTree_imp D.isTree + rwa [Equiv.apply_symm_apply, Equiv.apply_symm_apply] + obtain ⟨f, hf_edges, hf_on, h_orient⟩ := exists_onPathEdge_of_onTreePathEdge T he_T + refine ⟨f.1, hf_on, ?_⟩ + rw [edgeOrder_eq_ncard_inter T hD hf_edges] + have hf_lt : f.1 < m := Finset.mem_range.1 f.2 + have hpar_lt : T.parent f.1 < m := Finset.mem_range.1 (T.parent_mem f.1 f.2) + rw [gm04Bags_vertexSet_of_lt D hG hf_lt, gm04Bags_vertexSet_of_lt D hG hpar_lt] + rcases h_orient with ⟨hs_eq, hs'_eq⟩ | ⟨hs'_eq, hs_eq⟩ + · have hi₁ : (⟨f.1, hf_lt⟩ : Fin m) = i₁ := by + have := congrArg (equivFinOfIsTree D.isTree) hs_eq.symm + rwa [Equiv.apply_symm_apply] at this + have hi₂ : (⟨T.parent f.1, hpar_lt⟩ : Fin m) = i₂ := by + have := congrArg (equivFinOfIsTree D.isTree) hs'_eq.symm + rwa [Equiv.apply_symm_apply] at this + rwa [hi₁, hi₂] + · have hi₂ : (⟨f.1, hf_lt⟩ : Fin m) = i₂ := by + have := congrArg (equivFinOfIsTree D.isTree) hs'_eq.symm + rwa [Equiv.apply_symm_apply] at this + have hi₁ : (⟨T.parent f.1, hpar_lt⟩ : Fin m) = i₁ := by + have := congrArg (equivFinOfIsTree D.isTree) hs_eq.symm + rwa [Equiv.apply_symm_apply] at this + rw [hi₂, hi₁, Set.inter_comm] + exact hlt + +end + +end GraphMinor.GM04 diff --git a/LeanPool/GraphMinor/TreePath.lean b/LeanPool/GraphMinor/TreePath.lean new file mode 100644 index 0000000000..38e7271510 --- /dev/null +++ b/LeanPool/GraphMinor/TreePath.lean @@ -0,0 +1,61 @@ +/- +Copyright (c) 2026 MohammadTaghi Hajiaghayi and Mahdi JafariRaviz. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: MohammadTaghi Hajiaghayi, Mahdi JafariRaviz +-/ + +/- Modified by Lean Pool contributors for the Lean 4.36 port. -/ + +module + +public import Mathlib.Combinatorics.SimpleGraph.Acyclic + +/-! +# Vertices on the path in a tree + +A vertex lies on a path between two endpoints if it lies on every simple path between them. +When the graph is a tree there is a unique simple path. The basic facts also apply to +arbitrary simple graphs. +-/ + +@[expose] public section + +namespace GraphMinor.TreePath + +open SimpleGraph + +variable {ι : Type*} + +/-- Every path from `a` to `b` passes through `v`. -/ +def OnTreePath (T : SimpleGraph ι) (a b v : ι) : Prop := + ∀ p : T.Walk a b, p.IsPath → v ∈ p.support + +/-- The start vertex lies on every path. -/ +theorem left (T : SimpleGraph ι) (a b : ι) : OnTreePath T a b a := + fun p _ ↦ p.start_mem_support + +/-- The end vertex lies on every path. -/ +theorem right (T : SimpleGraph ι) (a b : ι) : OnTreePath T a b b := + fun p _ ↦ p.end_mem_support + +/-- Reversing the endpoints preserves the vertex-on-path property. -/ +theorem symm {T : SimpleGraph ι} {a b v : ι} (h : OnTreePath T a b v) : OnTreePath T b a v := by + intro p hp + have hm := h p.reverse hp.reverse + rwa [Walk.support_reverse, List.mem_reverse] at hm + +/-- The trivial path contains only its endpoint. -/ +theorem self_iff {T : SimpleGraph ι} {a v : ι} : OnTreePath T a a v ↔ v = a := by + constructor + · intro h + simpa using h Walk.nil Walk.IsPath.nil + · rintro rfl + exact left T _ _ + +/-- A vertex on every simple path lies on every walk between the same endpoints. -/ +theorem mem_support {T : SimpleGraph ι} {a b v : ι} (h : OnTreePath T a b v) + (w : T.Walk a b) : v ∈ w.support := by + classical + exact w.support_bypass_subset_support (h w.bypass w.bypass_isPath) + +end GraphMinor.TreePath diff --git a/LeanPool/projects/robertson-seymour-graph-minor.yaml b/LeanPool/projects/robertson-seymour-graph-minor.yaml new file mode 100644 index 0000000000..d38fa683d2 --- /dev/null +++ b/LeanPool/projects/robertson-seymour-graph-minor.yaml @@ -0,0 +1,46 @@ +slug: robertson-seymour-graph-minor +title: The Robertson–Seymour graph minor theorem +summary: >- + In every infinite sequence of finite multigraphs, an earlier graph is + isomorphic to a minor of a later one. The proof uses Mathlib multigraphs + and develops supporting theory for graph drawings on surfaces, tangles + and well-quasi-ordering. +branch: structural graph theory +entry_module: LeanPool.GraphMinor +authors: +- MohammadTaghi Hajiaghayi +- Mahdi JafariRaviz +source: + title: Graph Minors. XX. Wagner's conjecture + authors: + - Neil Robertson + - Paul D. Seymour + doi: 10.1016/j.jctb.2004.08.001 + url: https://github.com/mahdi-jfri/GraphMinor/tree/89c19b2fd07130fe6fc0fb7df2743ad99558c939 + github_repo: mahdi-jfri/GraphMinor + commit: 89c19b2fd07130fe6fc0fb7df2743ad99558c939 + initial_release: https://github.com/mahdi-jfri/GraphMinor/commit/04a7046c000043c02c6a3351f4d7d9a4b24b2b34 + announcement_url: https://leanprover.zulipchat.com/#narrow/channel/583339/near/640335582 + announcement_date: '2026-11-14T15:56:45Z' +license: Apache-2.0 +status: verified +provenance: AI +provenance_evidence: >- + The upstream formalization.yaml identifies agent automation. MohammadTaghi + Hajiaghayi and Mahdi JafariRaviz are the attributed formalization authors. +main_declarations: +- GraphMinor.graph_minor_theorem +main_results: +- declaration: GraphMinor.graph_minor_theorem + informal: >- + In any infinite sequence of multigraphs with finite vertex and edge sets, + there are indices i < j such that graph i is isomorphic to a subgraph + of graph j after contracting a subset of that subgraph's edges. +tags: +- graph-theory +- graph-minors +- multigraphs +- well-quasi-ordering +msc: +- 05C83 +- 05C10